Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Checkoutanalytics mvp with 3DS2 events #2531

Conversation

sponglord
Copy link
Contributor

@sponglord sponglord commented Jan 24, 2024

Summary

  • Adding analytics events for the 3DS2 process (data sent, iframe loaded, fingerprint/challenge complete)
  • Moved app specific analytics logic to a separate processing function (analyticsPreProcessor) in order to separate concerns and make testing easier
  • Added "configured" type to info event - generate when a component's securedFields are all configured and ready for use
  • Added "focus" & "unfocus" info events for the Custom Card component

Tested scenarios

All existing unit tests run
Added unit tests for all the analytics events that we currently generate


NOTE: extends changes made in #2521

Copy link

changeset-bot bot commented Jan 24, 2024

⚠️ No Changeset found

Latest commit: b25d26a

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@sponglord sponglord changed the base branch from main to feature/using_checkoutanalytics January 24, 2024 17:33
@sponglord sponglord marked this pull request as draft January 24, 2024 17:33
Copy link
Contributor

github-actions bot commented Jan 24, 2024

Size Change: +2.13 kB (0%)

Total Size: 1.13 MB

Filename Size Change
packages/lib/dist/adyen.js 299 kB +651 B (0%)
packages/lib/dist/cjs/index.js 259 kB +514 B (0%)
packages/lib/dist/es.modern/index.js 123 kB +401 B (0%)
packages/lib/dist/es/index.js 143 kB +569 B (0%)
ℹ️ View Unchanged
Filename Size
packages/lib/dist/es.modern/ar.js 6.92 kB
packages/lib/dist/es.modern/cs-CZ.js 6.17 kB
packages/lib/dist/es.modern/da-DK.js 5.6 kB
packages/lib/dist/es.modern/de-DE.js 6.07 kB
packages/lib/dist/es.modern/el-GR.js 7.88 kB
packages/lib/dist/es.modern/es-ES.js 5.7 kB
packages/lib/dist/es.modern/fi-FI.js 5.71 kB
packages/lib/dist/es.modern/fr-FR.js 5.94 kB
packages/lib/dist/es.modern/hr-HR.js 5.97 kB
packages/lib/dist/es.modern/hu-HU.js 6.25 kB
packages/lib/dist/es.modern/it-IT.js 5.79 kB
packages/lib/dist/es.modern/ja-JP.js 6.67 kB
packages/lib/dist/es.modern/ko-KR.js 6.29 kB
packages/lib/dist/es.modern/nl-NL.js 5.73 kB
packages/lib/dist/es.modern/no-NO.js 5.56 kB
packages/lib/dist/es.modern/pl-PL.js 6.25 kB
packages/lib/dist/es.modern/pt-BR.js 5.76 kB
packages/lib/dist/es.modern/pt-PT.js 5.88 kB
packages/lib/dist/es.modern/ro-RO.js 6.02 kB
packages/lib/dist/es.modern/ru-RU.js 7.36 kB
packages/lib/dist/es.modern/sk-SK.js 6.34 kB
packages/lib/dist/es.modern/sl-SI.js 5.88 kB
packages/lib/dist/es.modern/sv-SE.js 5.57 kB
packages/lib/dist/es.modern/zh-CN.js 6.11 kB
packages/lib/dist/es.modern/zh-TW.js 6.2 kB
packages/lib/dist/es/ar.js 6.92 kB
packages/lib/dist/es/cs-CZ.js 6.17 kB
packages/lib/dist/es/da-DK.js 5.6 kB
packages/lib/dist/es/de-DE.js 6.07 kB
packages/lib/dist/es/el-GR.js 7.88 kB
packages/lib/dist/es/es-ES.js 5.7 kB
packages/lib/dist/es/fi-FI.js 5.71 kB
packages/lib/dist/es/fr-FR.js 5.94 kB
packages/lib/dist/es/hr-HR.js 5.97 kB
packages/lib/dist/es/hu-HU.js 6.25 kB
packages/lib/dist/es/it-IT.js 5.79 kB
packages/lib/dist/es/ja-JP.js 6.67 kB
packages/lib/dist/es/ko-KR.js 6.29 kB
packages/lib/dist/es/nl-NL.js 5.73 kB
packages/lib/dist/es/no-NO.js 5.56 kB
packages/lib/dist/es/pl-PL.js 6.25 kB
packages/lib/dist/es/pt-BR.js 5.76 kB
packages/lib/dist/es/pt-PT.js 5.88 kB
packages/lib/dist/es/ro-RO.js 6.02 kB
packages/lib/dist/es/ru-RU.js 7.36 kB
packages/lib/dist/es/sk-SK.js 6.34 kB
packages/lib/dist/es/sl-SI.js 5.88 kB
packages/lib/dist/es/sv-SE.js 5.57 kB
packages/lib/dist/es/zh-CN.js 6.11 kB
packages/lib/dist/es/zh-TW.js 6.2 kB

compressed-size-action

@sponglord sponglord marked this pull request as ready for review January 25, 2024 12:18
Copy link

Quality Gate Passed Quality Gate passed

The SonarCloud Quality Gate passed, but some issues were introduced.

4 New issues
0 Security Hotspots
82.5% Coverage on New Code
0.0% Duplication on New Code

See analysis details on SonarCloud

@sponglord sponglord merged commit c2a0306 into feature/using_checkoutanalytics Jan 30, 2024
5 of 6 checks passed
@sponglord sponglord deleted the feature/using_checkoutanalytics_mvp_3DS2_events branch January 30, 2024 10:05
sponglord added a commit that referenced this pull request Mar 11, 2024
* First use of checkoutanlytics endpoint (for logging onSubmit & createFromAction events)

* Added comments and fixed type

* Commenting out "target" property until API accepts it

* Fixing unit tests

* Fixing sonarcloud gripe

* Tightening up types

* Adding test for event queue

* Updated test description

* Enhancing test

* Adding collect-id unit test

* Adding TelemetryEvent type

* Increasing test coverage

* Adding test

* Adding Storage.test

* Further checks to ensure checkoutanalytics calls fail silently

* Aligning fallback storage solution with normal, window based, Storage API

* Some adjustments now actual endpoint is accepting requests

* Analytics path read from constant and passed to relevant components

* Removing unused components

* Fixed unit test

* Added comments on the shape of objects for the /checkoutanalytics endpoint

* Unit test for when checkoutanalytics url is wrong

* Remove constant for mismatching threeDSServerTransID (it is no longer a situation we catch)

* Use await when calling collectId

* Remove analyticsContext from CoreOptions

* Adding createAnalyticsAction function in Analytics to make it simpler for other components to submit analytics

* Renaming CAEventsQueue to EventsQueue

* Clarifying the "modular" nature of Analytics and EventsQueue

* Fixing return type

* Pass in containerWidth with initial analytics call

* Drop addAnalyticsAction from Analytics module. Tidy up Analytics' types

* Switch to v3 of the endpoint

* Fix unit test (set new analytics version)

* Changes reflecting discussion on final API tweaks

* Create analytics-action for when PM selected or mounted. Send in sessionId in initial call

* Commented out logs and removed unused code

* Moved initial analytics setup to UIElement now that it (potentially) needs to pass on the session.id

* Added type

* Fixed unit test

* Temporarily don't pass isStoredPaymentMethod (waiting for API fix)

* Adding isStoredPaymentMethod to analytics event action now the b/e supports it

* Adding getter for Analytics' enabled prop so 'do-not-track' can be added as checkoutAttemptId value, if required

* fixing e2e tests

* remove .only from e2e test

* Only load analytics pixel once

* comments added

* Aligning Dropin & comps so that a 'mounted' event is always sent, from the same place, for both implementations

* Renamed initial Analytics call from "send" to "setUp"

* Create timer to send events after a set period of time

* Setup analytics after render has been called. Make call to submit the "mounted" event from BaseElement c.f. UIElement

* DropinComponent sends 'rendered' analytics-action

* For clarity UIElement uses switch in submitAnalytics function

* Added comment about Dropin also being able to pass a list of paymentMethods to analytics

* Use single "rendered" event to describe component mounting, dropin pm list rendering & dropin pm selection

* Changing analytics terminology - generic term is events with specific types being: info, log, error

* Changing analytics terminology - info events are collected into an an array named "info" (as opposed to the "logs" & "errors" arrays)

* Fixing unit tests

* Also debounce errors

* Fixed unit test

* Extends feature/using_checkoutanalytics. First draft: adding focus/blur events for Credit card fields

* Second draft: adding error analytics events for Credit card fields

* Second draft: adding error analytics events for Credit card fields

* Second draft: adding error analytics events for Credit card fields

* Using UIElement.submitAnalytics as a gateway for all analytics events (to set event type and create final analytics worthy objects)

* Added comment about onFocus/onBlur callbacks now working for non-SFs

* Changed constant ANALYTICS_UNFOCUS_STR to have value "unfocus"

* Non dropdown fields for Address also have focus/blur analytics

* Reduce the analytics info event timer to 5 secs when in development mode

* Aligning some analytics values with what the endpoint expects

* Fixing typo

* Clauses added so unit tests pass

* Adding analytics for when an instant PM button is pressed

* Fixed TS error

* Removing unused code

* Keep object sent to onFocus & onBlur callbacks in the form expected by v5 users

* Moving logic to create different types of Analytics events into the Analytics module

* Improving types

* Redeclare BaseElement.this._node *before* we render (was causing an issue in CustomCard)

* Checkoutanalytics mvp with 3DS2 events (#2531)

* Add 3DS2 analytics events for data sent & iframe loaded. Plus error event when paymentData missing in 3DS2

* Using UIElement.submitAnalytics for 3DS2

* Fixed clause (had been changed to test error)

* Move app specific analytics logic to a separate "processing" function. This separates concerns and makes testing easier

* core.ts uses sendAnalytics function

* Comments added regarding what properties are added to what analytics objects

* Redeclare BaseElement.this._node *before* we render (was causing an issue in CustomCard)

* Card has onConfigSuccess function to send analytics info event (type="configured") when SFS have all configured

* Adding analytics logs for when 3DS2 fingerprint or challenge complete

* Also pass isStoredPaymentMethod and brand with "configured" analytics events for storedCards

* Added unit tests for Card & GooglePay testing the shape of the analytics objects they generate

* Added unit tests for 3DS2 errors - testing the shape of the analytics objects they generate

* Fixing type

* Jumping through hoops for sonarcloud

* Jumping through hoops for sonarcloud

* Removing console.log

* Specifying type. Move card related, "is it a stored card" logic, out of UIElement

* Fixing linting

* Fixing linting, tightening up onSubmitAnalytics type

* After SDKs meeting: removing target prop from "submit" log events

* Added "focus" & "unfocus" info events to Custom Card comp

* Feature/using checkoutanalytics mvp iDeal (#2549)

* Adding selected info event for issuerList buttons

* IssuerList handles analytics for both dropdown & issuerList buttons

* Detect and send analytics event when issuerList's dropdown is expanded

* Detect and send analytics event (debounced) when issuerList search functionality is used

* Moved debounce function to own util file

* Fixes for unit tests

* Made debounce for search a constant

* Adding new unit tests

* Removing child comp's submitAnalytics function (since all it does is call super). Removing unused param.

* Feature/using checkoutanalytics mvp qr codes (#2550)

* Detect and send analytics event when qrCode's "Copy" btn is pressed

* Fixing unit test fail

* Removing child comp's submitAnalytics function (since all it does is call super)

* Add platform prop to all subsequent analytics calls

* All events have a unique id

* Fixing type

* Fixing unit tests

* Fixing issue where analytics calls were still being sent despite checkoutAttemptId call failing

* Added some tsconfig & linting exclusions

* Failed attempt to retrieve checkoutAttemptId returns rejected promise

* Refactoring Analytics.test to run in a way that more accurately mimics how analytics events are created

* Feature/using checkoutanalytics mapping validation errors (#2583)

* Mapping validation error codes to those expected by the endpoint

* Fixing unit tests

* Changing logic that dictates when we jump focus from PAN to expiryDate

* Feature/using checkoutanalytics_with_base64 refactor (#2586)

* Extending branch feature_using_checkoutanalytics to add 3DS2 analytic-actions (for data sent & iframe loaded)

* commenting out console logs

* Extending branch feature_using_checkoutanalytics_with_3DS2_events to add base64 refactor code (more errors detected in decode process)

* Changing analytics terminology - generic term is events with specific types being: info, log, error

* Changing analytics terminology - generic term is events with specific types being: info, log, error

* Fixing unit tests

* Fixing unit tests

* Fixed unit test

* Adding util to determine if base64 decoding has lead to an error object. Tightened up types

* Changing message for actionHandled when challenge iframe loaded

* Updating card rules for Discover and Diners, just for transparency on what the rules are within securedFields

* Fixing e2e tests
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants