@paypal/checkout-components 5.0.426-alpha-ea5d1e6.0 → 5.0.427
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/button.js +1 -1
- package/dist/test/button.js +1 -1
- package/package.json +8 -8
- package/src/connect/component.jsx +1 -1
- package/src/connect/component.test.js +2 -2
- package/src/funding/card/config.jsx +3 -3
- package/src/funding/card/config.test.jsx +10 -10
- package/src/funding/funding.js +6 -6
- package/src/funding/funding.test.js +3 -3
- package/src/funding/paylater/config.jsx +2 -2
- package/src/funding/paypal/template.jsx +8 -8
- package/src/funding/util.js +2 -2
- package/src/funding/util.test.js +16 -16
- package/src/hosted-buttons/index.test.js +9 -9
- package/src/hosted-buttons/types.js +3 -3
- package/src/hosted-buttons/utils.js +8 -8
- package/src/hosted-buttons/utils.test.js +43 -43
- package/src/lib/api.js +2 -2
- package/src/lib/appSwitchResume.js +1 -1
- package/src/lib/perceived-latency-instrumentation.js +1 -1
- package/src/lib/security.js +1 -1
- package/src/marks/component.jsx +4 -4
- package/src/marks/templateRebrand.test.jsx +1 -1
- package/src/shopper-insights/shopperSession.js +13 -13
- package/src/shopper-insights/shopperSession.test.js +25 -25
- package/src/three-domain-secure/api.js +1 -1
- package/src/three-domain-secure/api.test.js +4 -4
- package/src/three-domain-secure/component.jsx +3 -3
- package/src/three-domain-secure/component.test.js +14 -14
- package/src/ui/buttons/buttons.jsx +2 -2
- package/src/ui/buttons/buttons.test.js +4 -4
- package/src/ui/buttons/config.js +1 -1
- package/src/ui/buttons/poweredBy.jsx +1 -1
- package/src/ui/buttons/props.bnpl.test.js +1 -1
- package/src/ui/buttons/props.js +43 -43
- package/src/ui/buttons/props.test.js +8 -8
- package/src/ui/buttons/script.jsx +10 -10
- package/src/ui/buttons/styles/button.js +2 -2
- package/src/ui/buttons/styles/disableMaxHeightConfig.test.js +1 -1
- package/src/ui/buttons/styles/labelContainerHeight.test.js +5 -5
- package/src/ui/buttons/styles/labels.js +7 -7
- package/src/ui/buttons/styles/page.js +1 -1
- package/src/ui/buttons/styles/responsive.js +137 -137
- package/src/ui/buttons/styles/styleUtils.js +14 -12
- package/src/ui/buttons/styles/styleUtils.test.constants.js +731 -0
- package/src/ui/buttons/styles/styleUtils.test.js +198 -610
- package/src/ui/buttons/util.js +4 -4
- package/src/ui/overlay/paypal-app-switch/style.jsx +1 -1
- package/src/ui/overlay/three-domain-secure/overlay.jsx +1 -1
- package/src/ui/overlay/three-domain-secure/style.jsx +1 -1
- package/src/ui/saved-payment-methods/template.jsx +1 -1
- package/src/ui/text/text.jsx +1 -1
- package/src/zoid/buttons/component.jsx +13 -13
- package/src/zoid/buttons/container.jsx +2 -2
- package/src/zoid/buttons/prerender.jsx +3 -3
- package/src/zoid/buttons/util.js +10 -10
- package/src/zoid/buttons/util.test.js +2 -2
- package/src/zoid/card-fields/component.jsx +8 -9
- package/src/zoid/card-form/component.js +3 -3
- package/src/zoid/checkout/component.jsx +2 -2
- package/src/zoid/payment-fields/component.jsx +1 -1
- package/src/zoid/qr-code/container.test.jsx +2 -2
- package/src/zoid/qr-code/prerender.test.jsx +1 -1
- package/src/zoid/saved-payment-methods/component.jsx +8 -8
- package/src/zoid/saved-payment-methods/util.js +2 -2
- package/src/zoid/saved-payment-methods/util.test.js +14 -14
- package/src/zoid/wallet/component.jsx +1 -1
|
@@ -23,7 +23,7 @@ const mockFindEligiblePaymentsRequest = (
|
|
|
23
23
|
recommended: true,
|
|
24
24
|
recommended_priority: 1,
|
|
25
25
|
},
|
|
26
|
-
}
|
|
26
|
+
},
|
|
27
27
|
) =>
|
|
28
28
|
vi.fn().mockResolvedValue({
|
|
29
29
|
eligible_methods: eligibility,
|
|
@@ -188,7 +188,7 @@ describe("shopper insights component - getRecommendedPaymentMethods()", () => {
|
|
|
188
188
|
countryCode: "1",
|
|
189
189
|
nationalNumber: "2345678905",
|
|
190
190
|
},
|
|
191
|
-
})
|
|
191
|
+
}),
|
|
192
192
|
).rejects.toThrow(new Error("Error with API"));
|
|
193
193
|
expect(mockRequest).toHaveBeenCalled();
|
|
194
194
|
});
|
|
@@ -215,7 +215,7 @@ describe("shopper insights component - getRecommendedPaymentMethods()", () => {
|
|
|
215
215
|
}),
|
|
216
216
|
}),
|
|
217
217
|
}),
|
|
218
|
-
})
|
|
218
|
+
}),
|
|
219
219
|
);
|
|
220
220
|
});
|
|
221
221
|
|
|
@@ -233,7 +233,7 @@ describe("shopper insights component - getRecommendedPaymentMethods()", () => {
|
|
|
233
233
|
email: "email2@test.com",
|
|
234
234
|
}),
|
|
235
235
|
}),
|
|
236
|
-
})
|
|
236
|
+
}),
|
|
237
237
|
);
|
|
238
238
|
});
|
|
239
239
|
|
|
@@ -258,7 +258,7 @@ describe("shopper insights component - getRecommendedPaymentMethods()", () => {
|
|
|
258
258
|
}),
|
|
259
259
|
}),
|
|
260
260
|
}),
|
|
261
|
-
})
|
|
261
|
+
}),
|
|
262
262
|
);
|
|
263
263
|
});
|
|
264
264
|
|
|
@@ -273,11 +273,11 @@ describe("shopper insights component - getRecommendedPaymentMethods()", () => {
|
|
|
273
273
|
countryCode: "1",
|
|
274
274
|
nationalNumber: "2345678901",
|
|
275
275
|
},
|
|
276
|
-
})
|
|
276
|
+
}),
|
|
277
277
|
).rejects.toEqual(
|
|
278
278
|
new ValidationError(
|
|
279
|
-
"Expected shopper information to include a valid email format"
|
|
280
|
-
)
|
|
279
|
+
"Expected shopper information to include a valid email format",
|
|
280
|
+
),
|
|
281
281
|
);
|
|
282
282
|
});
|
|
283
283
|
|
|
@@ -291,11 +291,11 @@ describe("shopper insights component - getRecommendedPaymentMethods()", () => {
|
|
|
291
291
|
countryCode: "1",
|
|
292
292
|
nationalNumber: "not a phone",
|
|
293
293
|
},
|
|
294
|
-
})
|
|
294
|
+
}),
|
|
295
295
|
).rejects.toEqual(
|
|
296
296
|
new ValidationError(
|
|
297
|
-
"Expected shopper information to be a valid phone number format"
|
|
298
|
-
)
|
|
297
|
+
"Expected shopper information to be a valid phone number format",
|
|
298
|
+
),
|
|
299
299
|
);
|
|
300
300
|
});
|
|
301
301
|
|
|
@@ -308,11 +308,11 @@ describe("shopper insights component - getRecommendedPaymentMethods()", () => {
|
|
|
308
308
|
phone: {
|
|
309
309
|
nationalNumber: "2345678901",
|
|
310
310
|
},
|
|
311
|
-
})
|
|
311
|
+
}),
|
|
312
312
|
).rejects.toEqual(
|
|
313
313
|
new ValidationError(
|
|
314
|
-
"Expected phone number for shopper insights to include nationalNumber and countryCode"
|
|
315
|
-
)
|
|
314
|
+
"Expected phone number for shopper insights to include nationalNumber and countryCode",
|
|
315
|
+
),
|
|
316
316
|
);
|
|
317
317
|
|
|
318
318
|
expect(
|
|
@@ -320,11 +320,11 @@ describe("shopper insights component - getRecommendedPaymentMethods()", () => {
|
|
|
320
320
|
phone: {
|
|
321
321
|
countryCode: "1",
|
|
322
322
|
},
|
|
323
|
-
})
|
|
323
|
+
}),
|
|
324
324
|
).rejects.toEqual(
|
|
325
325
|
new ValidationError(
|
|
326
|
-
"Expected phone number for shopper insights to include nationalNumber and countryCode"
|
|
327
|
-
)
|
|
326
|
+
"Expected phone number for shopper insights to include nationalNumber and countryCode",
|
|
327
|
+
),
|
|
328
328
|
);
|
|
329
329
|
});
|
|
330
330
|
|
|
@@ -346,7 +346,7 @@ describe("shopper insights component - getRecommendedPaymentMethods()", () => {
|
|
|
346
346
|
}),
|
|
347
347
|
]),
|
|
348
348
|
}),
|
|
349
|
-
})
|
|
349
|
+
}),
|
|
350
350
|
);
|
|
351
351
|
});
|
|
352
352
|
|
|
@@ -371,7 +371,7 @@ describe("shopper insights component - getRecommendedPaymentMethods()", () => {
|
|
|
371
371
|
country_code: "US",
|
|
372
372
|
}),
|
|
373
373
|
}),
|
|
374
|
-
})
|
|
374
|
+
}),
|
|
375
375
|
);
|
|
376
376
|
});
|
|
377
377
|
|
|
@@ -391,7 +391,7 @@ describe("shopper insights component - getRecommendedPaymentMethods()", () => {
|
|
|
391
391
|
|
|
392
392
|
// $FlowIssue
|
|
393
393
|
expect(mockRequest.mock.calls[0][0].data.customer.country_code).toEqual(
|
|
394
|
-
undefined
|
|
394
|
+
undefined,
|
|
395
395
|
);
|
|
396
396
|
});
|
|
397
397
|
|
|
@@ -409,7 +409,7 @@ describe("shopper insights component - getRecommendedPaymentMethods()", () => {
|
|
|
409
409
|
include_account_details: true,
|
|
410
410
|
}),
|
|
411
411
|
}),
|
|
412
|
-
})
|
|
412
|
+
}),
|
|
413
413
|
);
|
|
414
414
|
});
|
|
415
415
|
});
|
|
@@ -427,9 +427,9 @@ describe("shopper insights component - validateSdkConfig()", () => {
|
|
|
427
427
|
sdkToken: "",
|
|
428
428
|
pageType: "",
|
|
429
429
|
},
|
|
430
|
-
})
|
|
430
|
+
}),
|
|
431
431
|
).toThrowError(
|
|
432
|
-
"script data attribute sdk-client-token is required but was not passed"
|
|
432
|
+
"script data attribute sdk-client-token is required but was not passed",
|
|
433
433
|
);
|
|
434
434
|
});
|
|
435
435
|
|
|
@@ -441,9 +441,9 @@ describe("shopper insights component - validateSdkConfig()", () => {
|
|
|
441
441
|
sdkToken: "sdk-token",
|
|
442
442
|
pageType: "",
|
|
443
443
|
},
|
|
444
|
-
})
|
|
444
|
+
}),
|
|
445
445
|
).toThrowError(
|
|
446
|
-
"script data attribute page-type is required but was not passed"
|
|
446
|
+
"script data attribute page-type is required but was not passed",
|
|
447
447
|
);
|
|
448
448
|
});
|
|
449
449
|
});
|
|
@@ -73,7 +73,7 @@ export function callGraphQLAPI({
|
|
|
73
73
|
|}): ZalgoPromise<any> {
|
|
74
74
|
if (!accessToken) {
|
|
75
75
|
throw new Error(
|
|
76
|
-
`No access token passed to GraphQL request ${baseURL}${GRAPHQL_URI}
|
|
76
|
+
`No access token passed to GraphQL request ${baseURL}${GRAPHQL_URI}`,
|
|
77
77
|
);
|
|
78
78
|
}
|
|
79
79
|
|
|
@@ -78,11 +78,11 @@ describe("API", () => {
|
|
|
78
78
|
baseURL,
|
|
79
79
|
data: gqlQuery,
|
|
80
80
|
headers: {},
|
|
81
|
-
})
|
|
81
|
+
}),
|
|
82
82
|
).toThrowError(
|
|
83
83
|
new Error(
|
|
84
|
-
`No access token passed to GraphQL request ${baseURL}/graphql
|
|
85
|
-
)
|
|
84
|
+
`No access token passed to GraphQL request ${baseURL}/graphql`,
|
|
85
|
+
),
|
|
86
86
|
);
|
|
87
87
|
});
|
|
88
88
|
|
|
@@ -140,7 +140,7 @@ describe("API", () => {
|
|
|
140
140
|
});
|
|
141
141
|
} catch (error) {
|
|
142
142
|
expect(error.message).toBe(
|
|
143
|
-
`${baseURL}/graphql returned status ${status}
|
|
143
|
+
`${baseURL}/graphql returned status ${status}`,
|
|
144
144
|
);
|
|
145
145
|
}
|
|
146
146
|
});
|
|
@@ -23,7 +23,7 @@ import type { GraphQLClient, RestClient } from "./api";
|
|
|
23
23
|
const parseSdkConfig = ({ sdkConfig, logger }): SdkConfig => {
|
|
24
24
|
if (!sdkConfig.authenticationToken) {
|
|
25
25
|
throw new ValidationError(
|
|
26
|
-
`script data attribute sdk-client-token is required but was not passed
|
|
26
|
+
`script data attribute sdk-client-token is required but was not passed`,
|
|
27
27
|
);
|
|
28
28
|
}
|
|
29
29
|
|
|
@@ -122,7 +122,7 @@ export class ThreeDomainSecureComponent {
|
|
|
122
122
|
let responseStatus = false;
|
|
123
123
|
if (status === "PAYER_ACTION_REQUIRED") {
|
|
124
124
|
this.authenticationURL = links.find(
|
|
125
|
-
(link) => link.rel === "payer-action"
|
|
125
|
+
(link) => link.rel === "payer-action",
|
|
126
126
|
).href;
|
|
127
127
|
responseStatus = true;
|
|
128
128
|
this.threeDSIframe = getThreeDS();
|
|
@@ -137,7 +137,7 @@ export class ThreeDomainSecureComponent {
|
|
|
137
137
|
async show(): Promise<ThreeDSResponse> {
|
|
138
138
|
if (!this.threeDSIframe) {
|
|
139
139
|
return Promise.reject(
|
|
140
|
-
new ValidationError(`Ineligible for three domain secure`)
|
|
140
|
+
new ValidationError(`Ineligible for three domain secure`),
|
|
141
141
|
);
|
|
142
142
|
}
|
|
143
143
|
// eslint-disable-next-line compat/compat
|
|
@@ -83,7 +83,7 @@ describe("three domain secure component - isEligible method", () => {
|
|
|
83
83
|
mockRestClient.request = mockEligibilityRequest();
|
|
84
84
|
const threeDomainSecureClient = createThreeDomainSecureComponent();
|
|
85
85
|
const eligibility = await threeDomainSecureClient.isEligible(
|
|
86
|
-
defaultMerchantPayload
|
|
86
|
+
defaultMerchantPayload,
|
|
87
87
|
);
|
|
88
88
|
expect(eligibility).toEqual(true);
|
|
89
89
|
});
|
|
@@ -96,7 +96,7 @@ describe("three domain secure component - isEligible method", () => {
|
|
|
96
96
|
mockRestClient.request = mockEligibilityRequest(inEligibilityResponse);
|
|
97
97
|
const threeDomainSecureClient = createThreeDomainSecureComponent();
|
|
98
98
|
const eligibility = await threeDomainSecureClient.isEligible(
|
|
99
|
-
defaultMerchantPayload
|
|
99
|
+
defaultMerchantPayload,
|
|
100
100
|
);
|
|
101
101
|
expect(eligibility).toEqual(false);
|
|
102
102
|
});
|
|
@@ -106,7 +106,7 @@ describe("three domain secure component - isEligible method", () => {
|
|
|
106
106
|
const threeDomainSecureClient = createThreeDomainSecureComponent();
|
|
107
107
|
await threeDomainSecureClient.isEligible(defaultMerchantPayload);
|
|
108
108
|
expect(threeDomainSecureClient.authenticationURL).toEqual(
|
|
109
|
-
"https://testurl.com"
|
|
109
|
+
"https://testurl.com",
|
|
110
110
|
);
|
|
111
111
|
});
|
|
112
112
|
|
|
@@ -131,7 +131,7 @@ describe("three domain secure component - isEligible method", () => {
|
|
|
131
131
|
value: defaultMerchantPayload.amount,
|
|
132
132
|
}),
|
|
133
133
|
}),
|
|
134
|
-
})
|
|
134
|
+
}),
|
|
135
135
|
);
|
|
136
136
|
});
|
|
137
137
|
|
|
@@ -143,7 +143,7 @@ describe("three domain secure component - isEligible method", () => {
|
|
|
143
143
|
|
|
144
144
|
expect.assertions(2);
|
|
145
145
|
await expect(() =>
|
|
146
|
-
threeDomainSecureClient.isEligible(defaultMerchantPayload)
|
|
146
|
+
threeDomainSecureClient.isEligible(defaultMerchantPayload),
|
|
147
147
|
).rejects.toThrow(new Error("Error with API"));
|
|
148
148
|
expect(mockRestClient.request).toHaveBeenCalled();
|
|
149
149
|
});
|
|
@@ -188,13 +188,13 @@ describe("three domain secure component - isEligible method", () => {
|
|
|
188
188
|
const threeDomainSecureClient = createThreeDomainSecureComponent();
|
|
189
189
|
|
|
190
190
|
await expect(() =>
|
|
191
|
-
threeDomainSecureClient.isEligible(params)
|
|
191
|
+
threeDomainSecureClient.isEligible(params),
|
|
192
192
|
).rejects.toThrow(new ValidationError(expected));
|
|
193
193
|
|
|
194
194
|
expect(threeDomainSecureClient.logger.warn).toHaveBeenCalledWith(
|
|
195
|
-
expected
|
|
195
|
+
expected,
|
|
196
196
|
);
|
|
197
|
-
}
|
|
197
|
+
},
|
|
198
198
|
);
|
|
199
199
|
});
|
|
200
200
|
|
|
@@ -204,7 +204,7 @@ describe("three domain descure component - show method", () => {
|
|
|
204
204
|
// $FlowFixMe
|
|
205
205
|
threeDomainSecureClient.threeDSIframe = undefined;
|
|
206
206
|
await expect(threeDomainSecureClient.show()).rejects.toThrowError(
|
|
207
|
-
"Ineligible for three domain secure"
|
|
207
|
+
"Ineligible for three domain secure",
|
|
208
208
|
);
|
|
209
209
|
});
|
|
210
210
|
});
|
|
@@ -217,9 +217,9 @@ describe("three domain secure component - initialization", () => {
|
|
|
217
217
|
...defaultSdkConfig,
|
|
218
218
|
authenticationToken: "",
|
|
219
219
|
},
|
|
220
|
-
})
|
|
220
|
+
}),
|
|
221
221
|
).toThrowError(
|
|
222
|
-
`script data attribute sdk-client-token is required but was not passed
|
|
222
|
+
`script data attribute sdk-client-token is required but was not passed`,
|
|
223
223
|
);
|
|
224
224
|
});
|
|
225
225
|
|
|
@@ -307,10 +307,10 @@ describe(" three domain secure component - parseMerchantPayload", () => {
|
|
|
307
307
|
});
|
|
308
308
|
|
|
309
309
|
expect(resultTrue.payment_source.card.verification_method).toBe(
|
|
310
|
-
"SCA_ALWAYS"
|
|
310
|
+
"SCA_ALWAYS",
|
|
311
311
|
);
|
|
312
312
|
expect(resultFalse.payment_source.card.verification_method).toBe(
|
|
313
|
-
"SCA_WHEN_REQUIRED"
|
|
313
|
+
"SCA_WHEN_REQUIRED",
|
|
314
314
|
);
|
|
315
315
|
});
|
|
316
316
|
|
|
@@ -349,7 +349,7 @@ describe(" three domain secure component - parseMerchantPayload", () => {
|
|
|
349
349
|
const result = parseMerchantPayload({ merchantPayload: payload });
|
|
350
350
|
|
|
351
351
|
expect(result.payment_source.card.verification_method).toBe(
|
|
352
|
-
"SCA_WHEN_REQUIRED"
|
|
352
|
+
"SCA_WHEN_REQUIRED",
|
|
353
353
|
);
|
|
354
354
|
});
|
|
355
355
|
});
|
|
@@ -159,13 +159,13 @@ describe("Smart Payment Buttons - limit button to PayPal for FSS", () => {
|
|
|
159
159
|
|
|
160
160
|
const allButtonsTotalCount = jsxElems?.children.filter(
|
|
161
161
|
// $FlowFixMe
|
|
162
|
-
(elem) => elem?.component?.name === "Button"
|
|
162
|
+
(elem) => elem?.component?.name === "Button",
|
|
163
163
|
).length;
|
|
164
164
|
|
|
165
165
|
const hasPayPalButton =
|
|
166
166
|
jsxElems?.children.filter(
|
|
167
167
|
// $FlowFixMe
|
|
168
|
-
(elem) => elem?.props?.fundingSource === "paypal"
|
|
168
|
+
(elem) => elem?.props?.fundingSource === "paypal",
|
|
169
169
|
).length === 1;
|
|
170
170
|
|
|
171
171
|
expect(allButtonsTotalCount).toBe(1);
|
|
@@ -183,13 +183,13 @@ describe("Smart Payment Buttons - limit button to PayPal for FSS", () => {
|
|
|
183
183
|
|
|
184
184
|
const allButtonsTotalCount = jsxElems?.children.filter(
|
|
185
185
|
// $FlowFixMe
|
|
186
|
-
(elem) => elem?.component?.name === "Button"
|
|
186
|
+
(elem) => elem?.component?.name === "Button",
|
|
187
187
|
).length;
|
|
188
188
|
|
|
189
189
|
const hasPayPalButton =
|
|
190
190
|
jsxElems?.children.filter(
|
|
191
191
|
// $FlowFixMe
|
|
192
|
-
(elem) => elem?.props?.fundingSource === "paypal"
|
|
192
|
+
(elem) => elem?.props?.fundingSource === "paypal",
|
|
193
193
|
).length === 1;
|
|
194
194
|
|
|
195
195
|
expect(allButtonsTotalCount).toBeGreaterThanOrEqual(1);
|
package/src/ui/buttons/config.js
CHANGED
|
@@ -40,7 +40,7 @@ export const REBRAND_LABEL_HEIGHT_RATIO = 0.5;
|
|
|
40
40
|
// Current: 0.05 / 0.5 = 0.10 (10%)
|
|
41
41
|
const LOGO_VISUAL_OFFSET = 0.05;
|
|
42
42
|
export const REBRAND_LOGO_TRANSLATE_Y: number = Math.round(
|
|
43
|
-
(LOGO_VISUAL_OFFSET / REBRAND_LABEL_HEIGHT_RATIO) * 100
|
|
43
|
+
(LOGO_VISUAL_OFFSET / REBRAND_LABEL_HEIGHT_RATIO) * 100,
|
|
44
44
|
);
|
|
45
45
|
|
|
46
46
|
type ButtonStyleMap = {
|
|
@@ -83,7 +83,7 @@ export function PoweredByPayPal({
|
|
|
83
83
|
text-align: center;
|
|
84
84
|
margin: 10px auto;
|
|
85
85
|
height: 12px;
|
|
86
|
-
font-family:
|
|
86
|
+
font-family: PayPalOpen-Regular, system-ui, -apple-system, Roboto, "Segoe UI", Helvetica-Neue, Helvetica, Arial, sans-serif;
|
|
87
87
|
font-size: 10px;
|
|
88
88
|
font-weight: 400;
|
|
89
89
|
color: #000000;
|