mirror of
https://github.com/jlengrand/adyen-web.git
synced 2026-03-10 08:01:22 +00:00
Feature/indicate when analytics disabled (#2290)
* Send 'do-not-track' as value for checkoutAttemptId when analytics is disabled * adding .changeset * Fixing e2e tests
This commit is contained in:
5
.changeset/neat-pandas-mix.md
Normal file
5
.changeset/neat-pandas-mix.md
Normal file
@@ -0,0 +1,5 @@
|
||||
---
|
||||
'@adyen/adyen-web': patch
|
||||
---
|
||||
|
||||
Send 'do-not-track' as value for checkoutAttemptId when analytics is disabled
|
||||
@@ -56,7 +56,8 @@ class BaseElement<P extends BaseElementProps> {
|
||||
*/
|
||||
get data(): PaymentData | RiskData {
|
||||
const clientData = getProp(this.props, 'modules.risk.data');
|
||||
const checkoutAttemptId = getProp(this.props, 'modules.analytics.checkoutAttemptId');
|
||||
const useAnalytics = !!getProp(this.props, 'modules.analytics.props.enabled');
|
||||
const checkoutAttemptId = useAnalytics ? getProp(this.props, 'modules.analytics.checkoutAttemptId') : 'do-not-track';
|
||||
const order = this.state.order || this.props.order;
|
||||
|
||||
const componentData = this.formatData();
|
||||
|
||||
@@ -3,12 +3,18 @@ import Paypal from './Paypal';
|
||||
describe('Paypal', () => {
|
||||
test('Returns a data object', () => {
|
||||
const paypal = new Paypal({});
|
||||
expect(paypal.data).toEqual({ clientStateDataIndicator: true, paymentMethod: { subtype: 'sdk', type: 'paypal' } });
|
||||
expect(paypal.data).toEqual({
|
||||
clientStateDataIndicator: true,
|
||||
paymentMethod: { subtype: 'sdk', type: 'paypal', checkoutAttemptId: 'do-not-track' }
|
||||
});
|
||||
});
|
||||
|
||||
test('should return subtype express if isExpress flag is set', () => {
|
||||
const paypal = new Paypal({ isExpress: true });
|
||||
expect(paypal.data).toEqual({ clientStateDataIndicator: true, paymentMethod: { subtype: 'express', type: 'paypal' } });
|
||||
expect(paypal.data).toEqual({
|
||||
clientStateDataIndicator: true,
|
||||
paymentMethod: { subtype: 'express', type: 'paypal', checkoutAttemptId: 'do-not-track' }
|
||||
});
|
||||
});
|
||||
|
||||
test('Is always valid', () => {
|
||||
|
||||
@@ -4,7 +4,7 @@ import userEvent from '@testing-library/user-event';
|
||||
|
||||
test('should return only payment type if personalDetails is not required', async () => {
|
||||
const pixElement = new Pix({});
|
||||
expect(pixElement.data).toEqual({ clientStateDataIndicator: true, paymentMethod: { type: 'pix' } });
|
||||
expect(pixElement.data).toEqual({ clientStateDataIndicator: true, paymentMethod: { type: 'pix', checkoutAttemptId: 'do-not-track' } });
|
||||
});
|
||||
|
||||
test('should show personal details form if enabled', async () => {
|
||||
|
||||
Reference in New Issue
Block a user