@paypal/checkout-components 5.0.297-alpha.0 → 5.0.297
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/__sdk__.js +4 -4
- package/dist/button.js +1 -1
- package/dist/test/button.js +1 -1
- package/package.json +2 -4
- package/src/connect/component.jsx +3 -2
- package/src/connect/component.test.js +35 -19
- package/src/connect/interface.js +16 -9
- package/src/constants/button.js +1 -0
- package/src/constants/class.js +1 -0
- package/src/funding/common.jsx +1 -1
- package/src/interface/hosted-buttons.js +1 -7
- package/src/ui/buttons/button.jsx +7 -3
- package/src/ui/buttons/props.js +19 -0
- package/src/ui/buttons/style.jsx +7 -2
- package/src/ui/buttons/styles/base.js +3 -0
- package/src/ui/buttons/styles/responsive.js +35 -5
- package/src/ui/buttons/util.js +5 -0
- package/src/zoid/buttons/component.jsx +385 -375
- package/src/api/api.js +0 -67
- package/src/api/shopper-insights/component.js +0 -203
- package/src/api/shopper-insights/component.test.js +0 -343
- package/src/api/shopper-insights/interface.js +0 -12
- package/src/connect/interface.test.js +0 -24
|
@@ -39,6 +39,7 @@ import {
|
|
|
39
39
|
getDisableSetCookie,
|
|
40
40
|
getExperimentation,
|
|
41
41
|
getSDKAttribute,
|
|
42
|
+
getSDKIntegrationSource,
|
|
42
43
|
} from "@paypal/sdk-client/src";
|
|
43
44
|
import {
|
|
44
45
|
rememberFunding,
|
|
@@ -251,124 +252,121 @@ export const getButtonsComponent: () => ButtonsComponent = memoize(() => {
|
|
|
251
252
|
},
|
|
252
253
|
|
|
253
254
|
props: {
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
*/
|
|
259
|
-
sdkVersion: {
|
|
260
|
-
type: "string",
|
|
255
|
+
// allowBillingPayments prop is used by Honey Extension to render the one-click button
|
|
256
|
+
// with payment methods & to use the payment methods instead of the Billing Agreement
|
|
257
|
+
allowBillingPayments: {
|
|
258
|
+
type: "boolean",
|
|
261
259
|
queryParam: true,
|
|
262
|
-
|
|
263
|
-
|
|
260
|
+
required: false,
|
|
261
|
+
default: () => true,
|
|
264
262
|
},
|
|
265
|
-
|
|
263
|
+
|
|
264
|
+
amount: {
|
|
266
265
|
type: "string",
|
|
267
|
-
queryParam: true,
|
|
268
266
|
required: false,
|
|
267
|
+
queryParam: true,
|
|
268
|
+
value: getAmount,
|
|
269
|
+
},
|
|
269
270
|
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
onShippingOptionsChange,
|
|
276
|
-
style = {},
|
|
277
|
-
fundingEligibility = getRefinedFundingEligibility(),
|
|
278
|
-
enableFunding = getEnableFunding(),
|
|
279
|
-
applePaySupport,
|
|
280
|
-
supportsPopups,
|
|
281
|
-
supportedNativeBrowser,
|
|
282
|
-
createBillingAgreement,
|
|
283
|
-
createSubscription,
|
|
284
|
-
createVaultSetupToken,
|
|
285
|
-
} = props;
|
|
286
|
-
|
|
287
|
-
const flow = determineFlow({
|
|
288
|
-
createBillingAgreement,
|
|
289
|
-
createSubscription,
|
|
290
|
-
createVaultSetupToken,
|
|
291
|
-
});
|
|
292
|
-
const { layout } = style;
|
|
271
|
+
apiStageHost: {
|
|
272
|
+
type: "string",
|
|
273
|
+
value: getAPIStageHost,
|
|
274
|
+
required: false,
|
|
275
|
+
},
|
|
293
276
|
|
|
294
|
-
|
|
295
|
-
|
|
277
|
+
applePay: {
|
|
278
|
+
type: "function",
|
|
279
|
+
required: false,
|
|
280
|
+
value: applePaySession,
|
|
281
|
+
},
|
|
296
282
|
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
fundingEligibility,
|
|
304
|
-
enableFunding,
|
|
305
|
-
components,
|
|
306
|
-
onShippingChange,
|
|
307
|
-
onShippingAddressChange,
|
|
308
|
-
onShippingOptionsChange,
|
|
309
|
-
flow,
|
|
310
|
-
applePaySupport,
|
|
311
|
-
supportsPopups,
|
|
312
|
-
supportedNativeBrowser,
|
|
313
|
-
})
|
|
314
|
-
) {
|
|
315
|
-
throw new Error(`${fundingSource} is not eligible`);
|
|
316
|
-
}
|
|
283
|
+
applePaySupport: {
|
|
284
|
+
type: "boolean",
|
|
285
|
+
value: ({ props }) => {
|
|
286
|
+
return props?.fundingEligibility?.applepay?.eligible
|
|
287
|
+
? isApplePaySupported()
|
|
288
|
+
: false;
|
|
317
289
|
},
|
|
290
|
+
queryParam: true,
|
|
318
291
|
},
|
|
319
292
|
|
|
320
|
-
|
|
321
|
-
type: "
|
|
293
|
+
branded: {
|
|
294
|
+
type: "boolean",
|
|
322
295
|
queryParam: true,
|
|
323
296
|
required: false,
|
|
324
|
-
|
|
325
|
-
// $FlowFixMe
|
|
326
|
-
return normalizeButtonStyle(props, value);
|
|
327
|
-
},
|
|
297
|
+
},
|
|
328
298
|
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
299
|
+
buttonLocation: {
|
|
300
|
+
type: "string",
|
|
301
|
+
value: () => window.location.hostname,
|
|
302
|
+
queryParam: false,
|
|
303
|
+
},
|
|
333
304
|
|
|
334
|
-
|
|
305
|
+
buttonSessionID: {
|
|
306
|
+
type: "string",
|
|
307
|
+
value: uniqueID,
|
|
308
|
+
queryParam: true,
|
|
335
309
|
},
|
|
336
310
|
|
|
337
|
-
|
|
338
|
-
type: "
|
|
339
|
-
|
|
311
|
+
buttonSize: {
|
|
312
|
+
type: "string",
|
|
313
|
+
required: false,
|
|
314
|
+
value: ({ props, container }) => {
|
|
315
|
+
return getButtonSize(props, container);
|
|
316
|
+
},
|
|
317
|
+
queryParam: true,
|
|
340
318
|
},
|
|
341
319
|
|
|
342
|
-
|
|
343
|
-
type: "
|
|
344
|
-
|
|
320
|
+
buyerCountry: {
|
|
321
|
+
type: "string",
|
|
322
|
+
queryParam: true,
|
|
323
|
+
required: false,
|
|
324
|
+
value: getBuyerCountry,
|
|
345
325
|
},
|
|
346
326
|
|
|
347
|
-
|
|
348
|
-
type: "
|
|
327
|
+
clientAccessToken: {
|
|
328
|
+
type: "string",
|
|
329
|
+
required: false,
|
|
349
330
|
queryParam: true,
|
|
350
|
-
value:
|
|
331
|
+
value: getClientAccessToken,
|
|
351
332
|
},
|
|
352
333
|
|
|
353
|
-
|
|
354
|
-
type: "
|
|
334
|
+
clientID: {
|
|
335
|
+
type: "string",
|
|
336
|
+
value: getClientID,
|
|
355
337
|
queryParam: true,
|
|
356
|
-
value: getLocale,
|
|
357
338
|
},
|
|
358
339
|
|
|
359
|
-
|
|
340
|
+
clientMetadataID: {
|
|
360
341
|
type: "string",
|
|
342
|
+
required: false,
|
|
343
|
+
default: () => {
|
|
344
|
+
const clientMetadataId = getClientMetadataID();
|
|
345
|
+
const sessionID = getSessionID();
|
|
346
|
+
|
|
347
|
+
return clientMetadataId || sessionID;
|
|
348
|
+
},
|
|
361
349
|
queryParam: true,
|
|
362
|
-
sendToChild: false,
|
|
363
|
-
value: getSDKMeta,
|
|
364
350
|
},
|
|
365
351
|
|
|
366
|
-
|
|
352
|
+
commit: {
|
|
353
|
+
type: "boolean",
|
|
354
|
+
queryParam: true,
|
|
355
|
+
value: getCommit,
|
|
356
|
+
},
|
|
357
|
+
|
|
358
|
+
components: {
|
|
359
|
+
type: "array",
|
|
360
|
+
queryParam: true,
|
|
361
|
+
value: getComponents,
|
|
362
|
+
},
|
|
363
|
+
|
|
364
|
+
createBillingAgreement: {
|
|
367
365
|
type: "function",
|
|
368
366
|
required: false,
|
|
369
367
|
},
|
|
370
368
|
|
|
371
|
-
|
|
369
|
+
createOrder: {
|
|
372
370
|
type: "function",
|
|
373
371
|
required: false,
|
|
374
372
|
},
|
|
@@ -378,51 +376,185 @@ export const getButtonsComponent: () => ButtonsComponent = memoize(() => {
|
|
|
378
376
|
required: false,
|
|
379
377
|
},
|
|
380
378
|
|
|
381
|
-
|
|
379
|
+
createVaultSetupToken: {
|
|
382
380
|
type: "function",
|
|
383
381
|
required: false,
|
|
384
382
|
},
|
|
385
383
|
|
|
386
|
-
|
|
387
|
-
type: "
|
|
384
|
+
csp: {
|
|
385
|
+
type: "object",
|
|
388
386
|
required: false,
|
|
387
|
+
value: () => {
|
|
388
|
+
return {
|
|
389
|
+
nonce: getCSPNonce(),
|
|
390
|
+
};
|
|
391
|
+
},
|
|
389
392
|
},
|
|
390
393
|
|
|
391
|
-
|
|
392
|
-
type: "
|
|
394
|
+
currency: {
|
|
395
|
+
type: "string",
|
|
396
|
+
queryParam: true,
|
|
397
|
+
value: getCurrency,
|
|
398
|
+
},
|
|
399
|
+
|
|
400
|
+
debug: {
|
|
401
|
+
type: "boolean",
|
|
402
|
+
value: getDebug,
|
|
403
|
+
queryParam: true,
|
|
404
|
+
},
|
|
405
|
+
|
|
406
|
+
disableCard: {
|
|
407
|
+
type: "array",
|
|
408
|
+
queryParam: true,
|
|
409
|
+
value: getDisableCard,
|
|
410
|
+
},
|
|
411
|
+
|
|
412
|
+
disableFunding: {
|
|
413
|
+
type: "array",
|
|
414
|
+
queryParam: true,
|
|
415
|
+
value: getDisableFunding,
|
|
416
|
+
},
|
|
417
|
+
|
|
418
|
+
disableSetCookie: {
|
|
419
|
+
type: "boolean",
|
|
420
|
+
queryParam: true,
|
|
393
421
|
required: false,
|
|
422
|
+
value: getDisableSetCookie,
|
|
423
|
+
},
|
|
424
|
+
|
|
425
|
+
displayOnly: {
|
|
426
|
+
type: "array",
|
|
394
427
|
queryParam: true,
|
|
395
|
-
|
|
396
|
-
|
|
428
|
+
required: false,
|
|
429
|
+
value: ({ props }) => {
|
|
430
|
+
return props?.displayOnly || [];
|
|
397
431
|
},
|
|
398
432
|
},
|
|
399
433
|
|
|
400
|
-
|
|
401
|
-
type: "
|
|
402
|
-
|
|
434
|
+
enableFunding: {
|
|
435
|
+
type: "array",
|
|
436
|
+
queryParam: true,
|
|
437
|
+
value: getEnableFunding,
|
|
403
438
|
},
|
|
404
439
|
|
|
405
|
-
|
|
406
|
-
type: "
|
|
440
|
+
enableThreeDomainSecure: {
|
|
441
|
+
type: "boolean",
|
|
442
|
+
value: getEnableThreeDomainSecure,
|
|
443
|
+
},
|
|
444
|
+
|
|
445
|
+
enableVault: {
|
|
446
|
+
type: "boolean",
|
|
407
447
|
required: false,
|
|
448
|
+
queryParam: true,
|
|
408
449
|
},
|
|
409
450
|
|
|
410
|
-
|
|
411
|
-
type: "
|
|
451
|
+
env: {
|
|
452
|
+
type: "string",
|
|
453
|
+
queryParam: true,
|
|
454
|
+
value: getEnv,
|
|
455
|
+
},
|
|
456
|
+
|
|
457
|
+
experiment: {
|
|
458
|
+
type: "object",
|
|
459
|
+
queryParam: true,
|
|
460
|
+
value: () => {
|
|
461
|
+
const experiments = getButtonExperiments();
|
|
462
|
+
return experiments;
|
|
463
|
+
},
|
|
464
|
+
},
|
|
465
|
+
|
|
466
|
+
experimentation: {
|
|
467
|
+
type: "object",
|
|
468
|
+
queryParam: true,
|
|
412
469
|
required: false,
|
|
470
|
+
value: getExperimentation,
|
|
413
471
|
},
|
|
414
472
|
|
|
415
|
-
|
|
416
|
-
type: "
|
|
473
|
+
flow: {
|
|
474
|
+
type: "string",
|
|
475
|
+
queryParam: true,
|
|
476
|
+
value: ({ props }) => {
|
|
477
|
+
const {
|
|
478
|
+
createBillingAgreement,
|
|
479
|
+
createSubscription,
|
|
480
|
+
createVaultSetupToken,
|
|
481
|
+
} = props;
|
|
482
|
+
return determineFlow({
|
|
483
|
+
createBillingAgreement,
|
|
484
|
+
createSubscription,
|
|
485
|
+
createVaultSetupToken,
|
|
486
|
+
});
|
|
487
|
+
},
|
|
488
|
+
},
|
|
489
|
+
|
|
490
|
+
fundingEligibility: {
|
|
491
|
+
type: "object",
|
|
492
|
+
default: getRefinedFundingEligibility,
|
|
493
|
+
value: __ENV__ === ENV.LOCAL ? undefined : getRefinedFundingEligibility,
|
|
494
|
+
queryParam: true,
|
|
495
|
+
serialization: "base64",
|
|
496
|
+
},
|
|
497
|
+
|
|
498
|
+
fundingSource: {
|
|
499
|
+
type: "string",
|
|
500
|
+
queryParam: true,
|
|
417
501
|
required: false,
|
|
502
|
+
|
|
503
|
+
validate: ({ props }) => {
|
|
504
|
+
const {
|
|
505
|
+
fundingSource,
|
|
506
|
+
onShippingChange,
|
|
507
|
+
onShippingAddressChange,
|
|
508
|
+
onShippingOptionsChange,
|
|
509
|
+
style = {},
|
|
510
|
+
fundingEligibility = getRefinedFundingEligibility(),
|
|
511
|
+
enableFunding = getEnableFunding(),
|
|
512
|
+
applePaySupport,
|
|
513
|
+
supportsPopups,
|
|
514
|
+
supportedNativeBrowser,
|
|
515
|
+
createBillingAgreement,
|
|
516
|
+
createSubscription,
|
|
517
|
+
createVaultSetupToken,
|
|
518
|
+
} = props;
|
|
519
|
+
|
|
520
|
+
const flow = determineFlow({
|
|
521
|
+
createBillingAgreement,
|
|
522
|
+
createSubscription,
|
|
523
|
+
createVaultSetupToken,
|
|
524
|
+
});
|
|
525
|
+
const { layout } = style;
|
|
526
|
+
|
|
527
|
+
const platform = getPlatform();
|
|
528
|
+
const components = getComponents();
|
|
529
|
+
|
|
530
|
+
if (
|
|
531
|
+
fundingSource &&
|
|
532
|
+
!isFundingEligible(fundingSource, {
|
|
533
|
+
layout,
|
|
534
|
+
platform,
|
|
535
|
+
fundingSource,
|
|
536
|
+
fundingEligibility,
|
|
537
|
+
enableFunding,
|
|
538
|
+
components,
|
|
539
|
+
onShippingChange,
|
|
540
|
+
onShippingAddressChange,
|
|
541
|
+
onShippingOptionsChange,
|
|
542
|
+
flow,
|
|
543
|
+
applePaySupport,
|
|
544
|
+
supportsPopups,
|
|
545
|
+
supportedNativeBrowser,
|
|
546
|
+
})
|
|
547
|
+
) {
|
|
548
|
+
throw new Error(`${fundingSource} is not eligible`);
|
|
549
|
+
}
|
|
550
|
+
},
|
|
418
551
|
},
|
|
419
552
|
|
|
420
|
-
|
|
553
|
+
getPageUrl: {
|
|
421
554
|
type: "function",
|
|
422
|
-
value:
|
|
423
|
-
(
|
|
424
|
-
|
|
425
|
-
state.prerenderDetails,
|
|
555
|
+
value: () => {
|
|
556
|
+
return () => window.location.href;
|
|
557
|
+
},
|
|
426
558
|
},
|
|
427
559
|
|
|
428
560
|
getPopupBridge: {
|
|
@@ -451,28 +583,12 @@ export const getButtonsComponent: () => ButtonsComponent = memoize(() => {
|
|
|
451
583
|
},
|
|
452
584
|
},
|
|
453
585
|
|
|
454
|
-
|
|
586
|
+
getPrerenderDetails: {
|
|
455
587
|
type: "function",
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
buttonSessionID: props.buttonSessionID,
|
|
461
|
-
phase: "buttons-first-render",
|
|
462
|
-
});
|
|
463
|
-
|
|
464
|
-
return (...args) => {
|
|
465
|
-
const venmoExperiment = createVenmoExperiment();
|
|
466
|
-
|
|
467
|
-
if (venmoExperiment) {
|
|
468
|
-
venmoExperiment.logStart({
|
|
469
|
-
[FPTI_KEY.BUTTON_SESSION_UID]: props.buttonSessionID,
|
|
470
|
-
});
|
|
471
|
-
}
|
|
472
|
-
|
|
473
|
-
return value(...args);
|
|
474
|
-
};
|
|
475
|
-
},
|
|
588
|
+
value:
|
|
589
|
+
({ state }) =>
|
|
590
|
+
() =>
|
|
591
|
+
state.prerenderDetails,
|
|
476
592
|
},
|
|
477
593
|
|
|
478
594
|
getQueriedEligibleFunding: {
|
|
@@ -482,220 +598,163 @@ export const getButtonsComponent: () => ButtonsComponent = memoize(() => {
|
|
|
482
598
|
},
|
|
483
599
|
},
|
|
484
600
|
|
|
485
|
-
|
|
486
|
-
type: "string",
|
|
487
|
-
value: getClientID,
|
|
488
|
-
queryParam: true,
|
|
489
|
-
},
|
|
490
|
-
|
|
491
|
-
clientAccessToken: {
|
|
492
|
-
type: "string",
|
|
493
|
-
required: false,
|
|
494
|
-
queryParam: true,
|
|
495
|
-
value: getClientAccessToken,
|
|
496
|
-
},
|
|
497
|
-
|
|
498
|
-
partnerAttributionID: {
|
|
499
|
-
type: "string",
|
|
500
|
-
required: false,
|
|
501
|
-
value: getPartnerAttributionID,
|
|
502
|
-
},
|
|
503
|
-
|
|
504
|
-
merchantRequestedPopupsDisabled: {
|
|
505
|
-
type: "boolean",
|
|
506
|
-
required: false,
|
|
507
|
-
value: getMerchantRequestedPopupsDisabled,
|
|
508
|
-
},
|
|
509
|
-
|
|
510
|
-
enableThreeDomainSecure: {
|
|
511
|
-
type: "boolean",
|
|
512
|
-
value: getEnableThreeDomainSecure,
|
|
513
|
-
},
|
|
514
|
-
|
|
515
|
-
sdkCorrelationID: {
|
|
601
|
+
hostedButtonId: {
|
|
516
602
|
type: "string",
|
|
517
603
|
required: false,
|
|
518
|
-
value: getCorrelationID,
|
|
519
604
|
queryParam: true,
|
|
520
605
|
},
|
|
521
606
|
|
|
522
|
-
|
|
607
|
+
intent: {
|
|
523
608
|
type: "string",
|
|
524
|
-
value: getStorageID,
|
|
525
609
|
queryParam: true,
|
|
610
|
+
value: getIntent,
|
|
526
611
|
},
|
|
527
612
|
|
|
528
|
-
|
|
529
|
-
type: "
|
|
530
|
-
value: getSessionID,
|
|
613
|
+
locale: {
|
|
614
|
+
type: "object",
|
|
531
615
|
queryParam: true,
|
|
616
|
+
value: getLocale,
|
|
532
617
|
},
|
|
533
618
|
|
|
534
|
-
|
|
535
|
-
type: "
|
|
536
|
-
value: () => window.location.hostname,
|
|
537
|
-
queryParam: false,
|
|
538
|
-
},
|
|
539
|
-
|
|
540
|
-
buttonSessionID: {
|
|
541
|
-
type: "string",
|
|
542
|
-
value: uniqueID,
|
|
619
|
+
merchantID: {
|
|
620
|
+
type: "array",
|
|
543
621
|
queryParam: true,
|
|
622
|
+
value: getMerchantID,
|
|
544
623
|
},
|
|
545
624
|
|
|
546
|
-
|
|
625
|
+
merchantRequestedPopupsDisabled: {
|
|
547
626
|
type: "boolean",
|
|
548
627
|
required: false,
|
|
549
|
-
|
|
628
|
+
value: getMerchantRequestedPopupsDisabled,
|
|
550
629
|
},
|
|
551
630
|
|
|
552
|
-
|
|
631
|
+
nonce: {
|
|
553
632
|
type: "string",
|
|
554
|
-
|
|
555
|
-
value: getEnv,
|
|
633
|
+
default: getCSPNonce,
|
|
556
634
|
},
|
|
557
635
|
|
|
558
|
-
|
|
559
|
-
type: "
|
|
636
|
+
onApprove: {
|
|
637
|
+
type: "function",
|
|
560
638
|
required: false,
|
|
561
|
-
queryParam: true,
|
|
562
|
-
value: getAmount,
|
|
563
639
|
},
|
|
564
640
|
|
|
565
|
-
|
|
566
|
-
type: "
|
|
567
|
-
value: getStageHost,
|
|
641
|
+
onCancel: {
|
|
642
|
+
type: "function",
|
|
568
643
|
required: false,
|
|
569
644
|
},
|
|
570
645
|
|
|
571
|
-
|
|
572
|
-
type: "
|
|
646
|
+
onClick: {
|
|
647
|
+
type: "function",
|
|
573
648
|
required: false,
|
|
574
|
-
value: ({ props, container }) => {
|
|
575
|
-
return getButtonSize(props, container);
|
|
576
|
-
},
|
|
577
|
-
queryParam: true,
|
|
578
649
|
},
|
|
579
650
|
|
|
580
|
-
|
|
581
|
-
type: "
|
|
582
|
-
value: getAPIStageHost,
|
|
651
|
+
onComplete: {
|
|
652
|
+
type: "function",
|
|
583
653
|
required: false,
|
|
584
654
|
},
|
|
585
655
|
|
|
586
|
-
|
|
587
|
-
type: "
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
656
|
+
onInit: {
|
|
657
|
+
type: "function",
|
|
658
|
+
required: false,
|
|
659
|
+
default: () => noop,
|
|
660
|
+
decorate: ({ props, value = noop }) => {
|
|
661
|
+
logLatencyInstrumentationPhase({
|
|
662
|
+
buttonSessionID: props.buttonSessionID,
|
|
663
|
+
phase: "buttons-first-render",
|
|
664
|
+
});
|
|
593
665
|
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
queryParam: true,
|
|
597
|
-
value: getPlatform,
|
|
598
|
-
},
|
|
666
|
+
return (...args) => {
|
|
667
|
+
const venmoExperiment = createVenmoExperiment();
|
|
599
668
|
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
669
|
+
if (venmoExperiment) {
|
|
670
|
+
venmoExperiment.logStart({
|
|
671
|
+
[FPTI_KEY.BUTTON_SESSION_UID]: props.buttonSessionID,
|
|
672
|
+
});
|
|
673
|
+
}
|
|
605
674
|
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
queryParam: true,
|
|
609
|
-
value: () => {
|
|
610
|
-
const experiments = getButtonExperiments();
|
|
611
|
-
return experiments;
|
|
675
|
+
return value(...args);
|
|
676
|
+
};
|
|
612
677
|
},
|
|
613
678
|
},
|
|
614
679
|
|
|
615
|
-
|
|
616
|
-
type: "
|
|
617
|
-
queryParam: false,
|
|
680
|
+
onShippingAddressChange: {
|
|
681
|
+
type: "function",
|
|
618
682
|
required: false,
|
|
619
683
|
},
|
|
620
684
|
|
|
621
|
-
|
|
622
|
-
type: "
|
|
685
|
+
onShippingChange: {
|
|
686
|
+
type: "function",
|
|
687
|
+
required: false,
|
|
623
688
|
queryParam: true,
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
createBillingAgreement,
|
|
627
|
-
createSubscription,
|
|
628
|
-
createVaultSetupToken,
|
|
629
|
-
} = props;
|
|
630
|
-
return determineFlow({
|
|
631
|
-
createBillingAgreement,
|
|
632
|
-
createSubscription,
|
|
633
|
-
createVaultSetupToken,
|
|
634
|
-
});
|
|
689
|
+
queryValue: ({ value }) => {
|
|
690
|
+
return value ? QUERY_BOOL.TRUE : QUERY_BOOL.FALSE;
|
|
635
691
|
},
|
|
636
692
|
},
|
|
637
693
|
|
|
638
|
-
|
|
694
|
+
onShippingOptionsChange: {
|
|
639
695
|
type: "function",
|
|
640
|
-
|
|
641
|
-
return (fundingSources: $ReadOnlyArray<$Values<typeof FUNDING>>) =>
|
|
642
|
-
rememberFunding(fundingSources, { cookie: false });
|
|
643
|
-
},
|
|
696
|
+
required: false,
|
|
644
697
|
},
|
|
645
698
|
|
|
646
|
-
|
|
699
|
+
pageType: {
|
|
647
700
|
type: "string",
|
|
701
|
+
required: false,
|
|
648
702
|
queryParam: true,
|
|
649
|
-
value:
|
|
703
|
+
value: () => getSDKAttribute(SDK_SETTINGS.PAGE_TYPE),
|
|
650
704
|
},
|
|
651
705
|
|
|
652
|
-
|
|
706
|
+
partnerAttributionID: {
|
|
653
707
|
type: "string",
|
|
654
|
-
|
|
655
|
-
value:
|
|
708
|
+
required: false,
|
|
709
|
+
value: getPartnerAttributionID,
|
|
656
710
|
},
|
|
657
711
|
|
|
658
|
-
|
|
712
|
+
paymentMethodNonce: {
|
|
659
713
|
type: "string",
|
|
660
714
|
queryParam: true,
|
|
661
715
|
required: false,
|
|
662
|
-
value: getBuyerCountry,
|
|
663
716
|
},
|
|
664
717
|
|
|
665
|
-
|
|
666
|
-
type: "
|
|
718
|
+
paymentMethodToken: {
|
|
719
|
+
type: "string",
|
|
667
720
|
queryParam: true,
|
|
668
|
-
|
|
721
|
+
required: false,
|
|
669
722
|
},
|
|
670
723
|
|
|
671
|
-
|
|
672
|
-
type: "
|
|
673
|
-
queryParam:
|
|
674
|
-
|
|
724
|
+
paymentRequest: {
|
|
725
|
+
type: "object",
|
|
726
|
+
queryParam: false,
|
|
727
|
+
required: false,
|
|
675
728
|
},
|
|
676
729
|
|
|
677
|
-
|
|
678
|
-
type: "
|
|
730
|
+
platform: {
|
|
731
|
+
type: "string",
|
|
679
732
|
queryParam: true,
|
|
680
|
-
value:
|
|
733
|
+
value: getPlatform,
|
|
681
734
|
},
|
|
682
735
|
|
|
683
|
-
|
|
684
|
-
type: "
|
|
685
|
-
|
|
686
|
-
value:
|
|
736
|
+
referrerDomain: {
|
|
737
|
+
type: "string",
|
|
738
|
+
required: false,
|
|
739
|
+
value: () => {
|
|
740
|
+
if (window.document.referrer) {
|
|
741
|
+
return new URL(window.document.referrer).host || undefined;
|
|
742
|
+
}
|
|
743
|
+
},
|
|
687
744
|
},
|
|
688
745
|
|
|
689
|
-
|
|
690
|
-
type: "
|
|
691
|
-
|
|
692
|
-
|
|
746
|
+
remember: {
|
|
747
|
+
type: "function",
|
|
748
|
+
value: () => {
|
|
749
|
+
return (fundingSources: $ReadOnlyArray<$Values<typeof FUNDING>>) =>
|
|
750
|
+
rememberFunding(fundingSources, { cookie: false });
|
|
751
|
+
},
|
|
693
752
|
},
|
|
694
753
|
|
|
695
|
-
|
|
754
|
+
remembered: {
|
|
696
755
|
type: "array",
|
|
697
756
|
queryParam: true,
|
|
698
|
-
value:
|
|
757
|
+
value: getRememberedFunding,
|
|
699
758
|
},
|
|
700
759
|
|
|
701
760
|
renderedButtons: {
|
|
@@ -704,104 +763,87 @@ export const getButtonsComponent: () => ButtonsComponent = memoize(() => {
|
|
|
704
763
|
value: ({ props }) => getRenderedButtons(props),
|
|
705
764
|
},
|
|
706
765
|
|
|
707
|
-
|
|
708
|
-
type: "object",
|
|
709
|
-
required: false,
|
|
710
|
-
value: () => {
|
|
711
|
-
return {
|
|
712
|
-
nonce: getCSPNonce(),
|
|
713
|
-
};
|
|
714
|
-
},
|
|
715
|
-
},
|
|
716
|
-
|
|
717
|
-
nonce: {
|
|
766
|
+
sessionID: {
|
|
718
767
|
type: "string",
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
getPageUrl: {
|
|
723
|
-
type: "function",
|
|
724
|
-
value: () => {
|
|
725
|
-
return () => window.location.href;
|
|
726
|
-
},
|
|
768
|
+
value: getSessionID,
|
|
769
|
+
queryParam: true,
|
|
727
770
|
},
|
|
728
771
|
|
|
729
|
-
|
|
772
|
+
sdkCorrelationID: {
|
|
730
773
|
type: "string",
|
|
731
774
|
required: false,
|
|
732
|
-
value:
|
|
733
|
-
|
|
734
|
-
return new URL(window.document.referrer).host || undefined;
|
|
735
|
-
}
|
|
736
|
-
},
|
|
775
|
+
value: getCorrelationID,
|
|
776
|
+
queryParam: true,
|
|
737
777
|
},
|
|
738
778
|
|
|
739
|
-
|
|
779
|
+
sdkIntegrationSource: {
|
|
740
780
|
type: "string",
|
|
741
|
-
|
|
781
|
+
queryParam: true,
|
|
742
782
|
required: false,
|
|
743
|
-
|
|
744
|
-
bodyParam: getEnv() === ENV.LOCAL || getEnv() === ENV.STAGE,
|
|
783
|
+
value: getSDKIntegrationSource,
|
|
745
784
|
},
|
|
746
785
|
|
|
747
|
-
|
|
786
|
+
sdkMeta: {
|
|
748
787
|
type: "string",
|
|
749
|
-
required: false,
|
|
750
|
-
default: () => {
|
|
751
|
-
const clientMetadataId = getClientMetadataID();
|
|
752
|
-
const sessionID = getSessionID();
|
|
753
|
-
|
|
754
|
-
return clientMetadataId || sessionID;
|
|
755
|
-
},
|
|
756
788
|
queryParam: true,
|
|
789
|
+
sendToChild: false,
|
|
790
|
+
value: getSDKMeta,
|
|
757
791
|
},
|
|
758
792
|
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
793
|
+
/**
|
|
794
|
+
* Version of the SDK used in first render.
|
|
795
|
+
* This is passed to the `/smart/buttons` endpoint in order for the second render
|
|
796
|
+
* to be aware of what sdk version to load during SSR of the buttons
|
|
797
|
+
*/
|
|
798
|
+
sdkVersion: {
|
|
799
|
+
type: "string",
|
|
762
800
|
queryParam: true,
|
|
801
|
+
sendToChild: false,
|
|
802
|
+
value: getVersion,
|
|
763
803
|
},
|
|
764
804
|
|
|
765
|
-
|
|
805
|
+
sessionState: {
|
|
766
806
|
type: "object",
|
|
767
|
-
|
|
768
|
-
return {
|
|
769
|
-
action: "checkout",
|
|
770
|
-
};
|
|
771
|
-
},
|
|
807
|
+
value: () => sessionState,
|
|
772
808
|
},
|
|
773
809
|
|
|
774
|
-
|
|
775
|
-
type: "
|
|
810
|
+
stageHost: {
|
|
811
|
+
type: "string",
|
|
812
|
+
value: getStageHost,
|
|
776
813
|
required: false,
|
|
777
|
-
default: () => window.__TEST_WALLET__,
|
|
778
814
|
},
|
|
779
815
|
|
|
780
|
-
|
|
816
|
+
storageID: {
|
|
781
817
|
type: "string",
|
|
818
|
+
value: getStorageID,
|
|
782
819
|
queryParam: true,
|
|
783
|
-
required: false,
|
|
784
820
|
},
|
|
785
821
|
|
|
786
|
-
|
|
787
|
-
type: "
|
|
788
|
-
|
|
789
|
-
required: false,
|
|
822
|
+
storageState: {
|
|
823
|
+
type: "object",
|
|
824
|
+
value: () => storageState,
|
|
790
825
|
},
|
|
791
826
|
|
|
792
|
-
|
|
793
|
-
type: "
|
|
827
|
+
style: {
|
|
828
|
+
type: "object",
|
|
794
829
|
queryParam: true,
|
|
795
830
|
required: false,
|
|
831
|
+
decorate: ({ props, value }) => {
|
|
832
|
+
// $FlowFixMe
|
|
833
|
+
return normalizeButtonStyle(props, value);
|
|
834
|
+
},
|
|
835
|
+
|
|
836
|
+
validate: ({ props, value = {} }) => {
|
|
837
|
+
// $FlowFixMe
|
|
838
|
+
normalizeButtonStyle(props, value);
|
|
839
|
+
},
|
|
840
|
+
|
|
841
|
+
default: () => ({}),
|
|
796
842
|
},
|
|
797
843
|
|
|
798
|
-
|
|
844
|
+
supportedNativeBrowser: {
|
|
799
845
|
type: "boolean",
|
|
800
|
-
value:
|
|
801
|
-
return props?.fundingEligibility?.applepay?.eligible
|
|
802
|
-
? isApplePaySupported()
|
|
803
|
-
: false;
|
|
804
|
-
},
|
|
846
|
+
value: isSupportedNativeBrowser,
|
|
805
847
|
queryParam: true,
|
|
806
848
|
},
|
|
807
849
|
|
|
@@ -811,10 +853,13 @@ export const getButtonsComponent: () => ButtonsComponent = memoize(() => {
|
|
|
811
853
|
queryParam: true,
|
|
812
854
|
},
|
|
813
855
|
|
|
814
|
-
|
|
815
|
-
type: "
|
|
816
|
-
|
|
817
|
-
|
|
856
|
+
test: {
|
|
857
|
+
type: "object",
|
|
858
|
+
default(): Object {
|
|
859
|
+
return {
|
|
860
|
+
action: "checkout",
|
|
861
|
+
};
|
|
862
|
+
},
|
|
818
863
|
},
|
|
819
864
|
|
|
820
865
|
userExperienceFlow: {
|
|
@@ -823,59 +868,24 @@ export const getButtonsComponent: () => ButtonsComponent = memoize(() => {
|
|
|
823
868
|
value: getUserExperienceFlow,
|
|
824
869
|
},
|
|
825
870
|
|
|
826
|
-
|
|
827
|
-
type: "
|
|
828
|
-
|
|
829
|
-
value: applePaySession,
|
|
830
|
-
},
|
|
831
|
-
|
|
832
|
-
// allowBillingPayments prop is used by Honey Extension to render the one-click button
|
|
833
|
-
// with payment methods & to use the payment methods instead of the Billing Agreement
|
|
834
|
-
allowBillingPayments: {
|
|
835
|
-
type: "boolean",
|
|
836
|
-
queryParam: true,
|
|
837
|
-
required: false,
|
|
838
|
-
default: () => true,
|
|
839
|
-
},
|
|
840
|
-
createVaultSetupToken: {
|
|
841
|
-
type: "function",
|
|
871
|
+
userIDToken: {
|
|
872
|
+
type: "string",
|
|
873
|
+
default: getUserIDToken,
|
|
842
874
|
required: false,
|
|
875
|
+
queryParam: getEnv() !== ENV.LOCAL && getEnv() !== ENV.STAGE,
|
|
876
|
+
bodyParam: getEnv() === ENV.LOCAL || getEnv() === ENV.STAGE,
|
|
843
877
|
},
|
|
844
878
|
|
|
845
|
-
|
|
879
|
+
vault: {
|
|
846
880
|
type: "boolean",
|
|
847
881
|
queryParam: true,
|
|
848
|
-
|
|
849
|
-
value: getDisableSetCookie,
|
|
882
|
+
value: getVault,
|
|
850
883
|
},
|
|
851
884
|
|
|
852
|
-
|
|
885
|
+
wallet: {
|
|
853
886
|
type: "object",
|
|
854
|
-
queryParam: true,
|
|
855
|
-
required: false,
|
|
856
|
-
value: getExperimentation,
|
|
857
|
-
},
|
|
858
|
-
|
|
859
|
-
hostedButtonId: {
|
|
860
|
-
type: "string",
|
|
861
|
-
required: false,
|
|
862
|
-
queryParam: true,
|
|
863
|
-
},
|
|
864
|
-
|
|
865
|
-
pageType: {
|
|
866
|
-
type: "string",
|
|
867
|
-
required: false,
|
|
868
|
-
queryParam: true,
|
|
869
|
-
value: () => getSDKAttribute(SDK_SETTINGS.PAGE_TYPE),
|
|
870
|
-
},
|
|
871
|
-
|
|
872
|
-
displayOnly: {
|
|
873
|
-
type: "array",
|
|
874
|
-
queryParam: true,
|
|
875
887
|
required: false,
|
|
876
|
-
|
|
877
|
-
return props?.displayOnly || [];
|
|
878
|
-
},
|
|
888
|
+
default: () => window.__TEST_WALLET__,
|
|
879
889
|
},
|
|
880
890
|
},
|
|
881
891
|
});
|