@paypal/checkout-components 5.0.412 → 5.0.414
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 +2 -2
- package/src/constants/button.js +6 -0
- package/src/funding/common.jsx +6 -0
- package/src/funding/funding.js +8 -1
- package/src/funding/funding.test.js +69 -0
- package/src/funding/itau/config.jsx +21 -8
- package/src/funding/paylater/config.jsx +7 -12
- package/src/funding/paypal/monogramMark.jsx +10 -0
- package/src/funding/paypal/monogramMark.test.jsx +24 -0
- package/src/funding/sepa/config.jsx +29 -1
- package/src/marks/component.jsx +8 -1
- package/src/marks/templateRebrand.jsx +32 -2
- package/src/marks/templateRebrand.test.jsx +101 -0
- package/src/ui/buttons/buttons.jsx +2 -0
- package/src/ui/buttons/config.js +50 -26
- package/src/ui/buttons/poweredBy.jsx +8 -3
- package/src/ui/buttons/props.js +7 -29
- package/src/ui/buttons/props.test.js +0 -42
- package/src/ui/buttons/script.jsx +0 -47
- package/src/ui/buttons/styles/button.js +21 -4
- package/src/ui/buttons/styles/color.js +67 -41
- package/src/ui/buttons/styles/disableMaxHeightConfig.test.js +71 -0
- package/src/ui/buttons/styles/labels.js +23 -0
- package/src/ui/buttons/styles/responsive.js +124 -88
- package/src/ui/buttons/styles/styleUtils.js +9 -7
- package/src/ui/buttons/styles/styleUtils.test.js +23 -76
- package/src/ui/buttons/tagline.jsx +8 -4
- package/src/zoid/buttons/component.jsx +4 -0
|
@@ -398,10 +398,9 @@ const expectedRebrandDisableMaxHeightStylesTiny = {
|
|
|
398
398
|
buttonHeight: 25,
|
|
399
399
|
disableHeightStyle:
|
|
400
400
|
BUTTON_DISABLE_MAX_HEIGHT_STYLE[BUTTON_DISABLE_MAX_HEIGHT_SIZE.TINY],
|
|
401
|
-
labelHeight:
|
|
401
|
+
labelHeight: 13,
|
|
402
402
|
fontSize: 10,
|
|
403
403
|
marginTop: 1,
|
|
404
|
-
pillBorderRadius: 13,
|
|
405
404
|
spinnerSize: 13,
|
|
406
405
|
gap: 3,
|
|
407
406
|
};
|
|
@@ -412,10 +411,9 @@ const expectedRebrandDisableMaxHeightStylesSmall = {
|
|
|
412
411
|
buttonHeight: 30,
|
|
413
412
|
disableHeightStyle:
|
|
414
413
|
BUTTON_DISABLE_MAX_HEIGHT_STYLE[BUTTON_DISABLE_MAX_HEIGHT_SIZE.SMALL],
|
|
415
|
-
labelHeight:
|
|
414
|
+
labelHeight: 15,
|
|
416
415
|
fontSize: 11,
|
|
417
416
|
marginTop: 1,
|
|
418
|
-
pillBorderRadius: 15,
|
|
419
417
|
spinnerSize: 15,
|
|
420
418
|
gap: 3,
|
|
421
419
|
};
|
|
@@ -428,10 +426,9 @@ const expectedRebrandDisableMaxHeightStylesMediumSmall = {
|
|
|
428
426
|
BUTTON_DISABLE_MAX_HEIGHT_STYLE[
|
|
429
427
|
BUTTON_DISABLE_MAX_HEIGHT_SIZE.MEDIUM_SMALL
|
|
430
428
|
],
|
|
431
|
-
labelHeight:
|
|
429
|
+
labelHeight: 18,
|
|
432
430
|
fontSize: 13,
|
|
433
431
|
marginTop: 1,
|
|
434
|
-
pillBorderRadius: 18,
|
|
435
432
|
spinnerSize: 18,
|
|
436
433
|
gap: 4,
|
|
437
434
|
};
|
|
@@ -442,10 +439,9 @@ const expectedRebrandDisableMaxHeightStylesMediumBig = {
|
|
|
442
439
|
buttonHeight: 40,
|
|
443
440
|
disableHeightStyle:
|
|
444
441
|
BUTTON_DISABLE_MAX_HEIGHT_STYLE[BUTTON_DISABLE_MAX_HEIGHT_SIZE.MEDIUM_BIG],
|
|
445
|
-
labelHeight:
|
|
442
|
+
labelHeight: 20,
|
|
446
443
|
fontSize: 14,
|
|
447
444
|
marginTop: 1,
|
|
448
|
-
pillBorderRadius: 20,
|
|
449
445
|
spinnerSize: 20,
|
|
450
446
|
gap: 4,
|
|
451
447
|
};
|
|
@@ -456,10 +452,9 @@ const expectedRebrandDisableMaxHeightStylesLargeSmall = {
|
|
|
456
452
|
buttonHeight: 45,
|
|
457
453
|
disableHeightStyle:
|
|
458
454
|
BUTTON_DISABLE_MAX_HEIGHT_STYLE[BUTTON_DISABLE_MAX_HEIGHT_SIZE.LARGE_SMALL],
|
|
459
|
-
labelHeight:
|
|
455
|
+
labelHeight: 23,
|
|
460
456
|
fontSize: 16,
|
|
461
457
|
marginTop: 2,
|
|
462
|
-
pillBorderRadius: 23,
|
|
463
458
|
spinnerSize: 23,
|
|
464
459
|
gap: 5,
|
|
465
460
|
};
|
|
@@ -470,10 +465,9 @@ const expectedRebrandDisableMaxHeightStylesLargeBig = {
|
|
|
470
465
|
buttonHeight: 50,
|
|
471
466
|
disableHeightStyle:
|
|
472
467
|
BUTTON_DISABLE_MAX_HEIGHT_STYLE[BUTTON_DISABLE_MAX_HEIGHT_SIZE.LARGE_BIG],
|
|
473
|
-
labelHeight:
|
|
468
|
+
labelHeight: 25,
|
|
474
469
|
fontSize: 18,
|
|
475
470
|
marginTop: 2,
|
|
476
|
-
pillBorderRadius: 25,
|
|
477
471
|
spinnerSize: 25,
|
|
478
472
|
gap: 5,
|
|
479
473
|
};
|
|
@@ -484,10 +478,9 @@ const expectedRebrandDisableMaxHeightStylesXL = {
|
|
|
484
478
|
buttonHeight: 55,
|
|
485
479
|
disableHeightStyle:
|
|
486
480
|
BUTTON_DISABLE_MAX_HEIGHT_STYLE[BUTTON_DISABLE_MAX_HEIGHT_SIZE.XL],
|
|
487
|
-
labelHeight:
|
|
481
|
+
labelHeight: 28,
|
|
488
482
|
fontSize: 20,
|
|
489
483
|
marginTop: 2,
|
|
490
|
-
pillBorderRadius: 28,
|
|
491
484
|
spinnerSize: 28,
|
|
492
485
|
gap: 6,
|
|
493
486
|
};
|
|
@@ -498,10 +491,9 @@ const expectedRebrandDisableMaxHeightStylesXXL = {
|
|
|
498
491
|
buttonHeight: 65,
|
|
499
492
|
disableHeightStyle:
|
|
500
493
|
BUTTON_DISABLE_MAX_HEIGHT_STYLE[BUTTON_DISABLE_MAX_HEIGHT_SIZE.XXL],
|
|
501
|
-
labelHeight:
|
|
494
|
+
labelHeight: 33,
|
|
502
495
|
fontSize: 23,
|
|
503
496
|
marginTop: 2,
|
|
504
|
-
pillBorderRadius: 33,
|
|
505
497
|
spinnerSize: 33,
|
|
506
498
|
gap: 7,
|
|
507
499
|
};
|
|
@@ -512,10 +504,9 @@ const expectedRebrandDisableMaxHeightStylesXXXL = {
|
|
|
512
504
|
buttonHeight: 75,
|
|
513
505
|
disableHeightStyle:
|
|
514
506
|
BUTTON_DISABLE_MAX_HEIGHT_STYLE[BUTTON_DISABLE_MAX_HEIGHT_SIZE.XXXL],
|
|
515
|
-
labelHeight:
|
|
507
|
+
labelHeight: 38,
|
|
516
508
|
fontSize: 27,
|
|
517
509
|
marginTop: 3,
|
|
518
|
-
pillBorderRadius: 38,
|
|
519
510
|
spinnerSize: 38,
|
|
520
511
|
gap: 7,
|
|
521
512
|
};
|
|
@@ -524,7 +515,6 @@ const expectedRebrandDisableMaxHeightStylesXXXL = {
|
|
|
524
515
|
const expectedRebrandedResponsiveStylesExtraSmall = {
|
|
525
516
|
style: BUTTON_REDESIGN_STYLE[BUTTON_REDESIGN_SIZE.EXTRA_SMALL],
|
|
526
517
|
buttonHeight: 20,
|
|
527
|
-
pillBorderRadius: 10,
|
|
528
518
|
gap: 3,
|
|
529
519
|
defaultHeight: 20,
|
|
530
520
|
minHeight: 20,
|
|
@@ -532,13 +522,12 @@ const expectedRebrandedResponsiveStylesExtraSmall = {
|
|
|
532
522
|
minWidth: 50,
|
|
533
523
|
minDualWidth: 300,
|
|
534
524
|
maxWidth: 75,
|
|
535
|
-
fontSize:
|
|
525
|
+
fontSize: 10,
|
|
536
526
|
};
|
|
537
527
|
|
|
538
528
|
const expectedRebrandedResponsiveStylesTiny = {
|
|
539
529
|
style: BUTTON_REDESIGN_STYLE[BUTTON_REDESIGN_SIZE.TINY],
|
|
540
530
|
buttonHeight: 25,
|
|
541
|
-
pillBorderRadius: 13,
|
|
542
531
|
gap: 3,
|
|
543
532
|
defaultHeight: 25,
|
|
544
533
|
minHeight: 25,
|
|
@@ -546,27 +535,25 @@ const expectedRebrandedResponsiveStylesTiny = {
|
|
|
546
535
|
minWidth: 75,
|
|
547
536
|
minDualWidth: 300,
|
|
548
537
|
maxWidth: 200,
|
|
549
|
-
fontSize:
|
|
538
|
+
fontSize: 10,
|
|
550
539
|
};
|
|
551
540
|
|
|
552
541
|
const expectedRebrandedResponsiveStylesSmall = {
|
|
553
542
|
style: BUTTON_REDESIGN_STYLE[BUTTON_REDESIGN_SIZE.SMALL],
|
|
554
543
|
buttonHeight: 35,
|
|
555
|
-
|
|
556
|
-
gap: 3,
|
|
544
|
+
gap: 4,
|
|
557
545
|
defaultHeight: 35,
|
|
558
546
|
minHeight: 30,
|
|
559
547
|
maxHeight: 35,
|
|
560
548
|
minWidth: 200,
|
|
561
549
|
minDualWidth: 300,
|
|
562
550
|
maxWidth: 250,
|
|
563
|
-
fontSize:
|
|
551
|
+
fontSize: 12,
|
|
564
552
|
};
|
|
565
553
|
|
|
566
554
|
const expectedRebrandedResponsiveStylesMediumSmall = {
|
|
567
555
|
style: BUTTON_REDESIGN_STYLE[BUTTON_REDESIGN_SIZE.MEDIUM_SMALL],
|
|
568
556
|
buttonHeight: 35,
|
|
569
|
-
pillBorderRadius: 18,
|
|
570
557
|
gap: 4,
|
|
571
558
|
defaultHeight: 35,
|
|
572
559
|
minHeight: 35,
|
|
@@ -574,27 +561,25 @@ const expectedRebrandedResponsiveStylesMediumSmall = {
|
|
|
574
561
|
minWidth: 250,
|
|
575
562
|
minDualWidth: 300,
|
|
576
563
|
maxWidth: 300,
|
|
577
|
-
fontSize:
|
|
564
|
+
fontSize: 14,
|
|
578
565
|
};
|
|
579
566
|
|
|
580
567
|
const expectedRebrandedResponsiveStylesMediumBig = {
|
|
581
568
|
style: BUTTON_REDESIGN_STYLE[BUTTON_REDESIGN_SIZE.MEDIUM_BIG],
|
|
582
569
|
buttonHeight: 45,
|
|
583
|
-
|
|
584
|
-
gap: 4,
|
|
570
|
+
gap: 5,
|
|
585
571
|
defaultHeight: 45,
|
|
586
572
|
minHeight: 40,
|
|
587
573
|
maxHeight: 45,
|
|
588
574
|
minWidth: 300,
|
|
589
575
|
minDualWidth: 300,
|
|
590
576
|
maxWidth: 350,
|
|
591
|
-
fontSize:
|
|
577
|
+
fontSize: 14,
|
|
592
578
|
};
|
|
593
579
|
|
|
594
580
|
const expectedRebrandedResponsiveStylesLargeSmall = {
|
|
595
581
|
style: BUTTON_REDESIGN_STYLE[BUTTON_REDESIGN_SIZE.LARGE_SMALL],
|
|
596
582
|
buttonHeight: 45,
|
|
597
|
-
pillBorderRadius: 23,
|
|
598
583
|
gap: 5,
|
|
599
584
|
defaultHeight: 45,
|
|
600
585
|
minHeight: 45,
|
|
@@ -602,63 +587,33 @@ const expectedRebrandedResponsiveStylesLargeSmall = {
|
|
|
602
587
|
minWidth: 350,
|
|
603
588
|
minDualWidth: 300,
|
|
604
589
|
maxWidth: 425,
|
|
605
|
-
fontSize:
|
|
590
|
+
fontSize: 16,
|
|
606
591
|
};
|
|
607
592
|
|
|
608
593
|
const expectedRebrandedResponsiveStylesLargeBig = {
|
|
609
594
|
style: BUTTON_REDESIGN_STYLE[BUTTON_REDESIGN_SIZE.LARGE_BIG],
|
|
610
|
-
buttonHeight:
|
|
611
|
-
pillBorderRadius: 23,
|
|
595
|
+
buttonHeight: 50,
|
|
612
596
|
gap: 5,
|
|
613
|
-
defaultHeight:
|
|
597
|
+
defaultHeight: 50,
|
|
614
598
|
minHeight: 50,
|
|
615
599
|
maxHeight: 55,
|
|
616
600
|
minWidth: 425,
|
|
617
601
|
minDualWidth: 300,
|
|
618
602
|
maxWidth: 500,
|
|
619
|
-
fontSize:
|
|
603
|
+
fontSize: 18,
|
|
620
604
|
};
|
|
621
605
|
|
|
622
606
|
const expectedRebrandedResponsiveStylesXlSmall = {
|
|
623
607
|
style: BUTTON_REDESIGN_STYLE[BUTTON_REDESIGN_SIZE.XL_SMALL],
|
|
624
608
|
buttonHeight: 55,
|
|
625
|
-
pillBorderRadius: 28,
|
|
626
609
|
gap: 6,
|
|
627
610
|
defaultHeight: 55,
|
|
628
611
|
minHeight: 55,
|
|
629
612
|
maxHeight: 60,
|
|
630
613
|
minWidth: 500,
|
|
631
614
|
minDualWidth: 300,
|
|
632
|
-
maxWidth: 550,
|
|
633
|
-
fontSize: 22,
|
|
634
|
-
};
|
|
635
|
-
|
|
636
|
-
const expectedRebrandedResponsiveStylesXlBig = {
|
|
637
|
-
style: BUTTON_REDESIGN_STYLE[BUTTON_REDESIGN_SIZE.XL_BIG],
|
|
638
|
-
buttonHeight: 55,
|
|
639
|
-
pillBorderRadius: 28,
|
|
640
|
-
gap: 7,
|
|
641
|
-
defaultHeight: 55,
|
|
642
|
-
minHeight: 60,
|
|
643
|
-
maxHeight: 65,
|
|
644
|
-
minWidth: 550,
|
|
645
|
-
minDualWidth: 300,
|
|
646
|
-
maxWidth: 650,
|
|
647
|
-
fontSize: 24,
|
|
648
|
-
};
|
|
649
|
-
|
|
650
|
-
const expectedRebrandedResponsiveStylesXXL = {
|
|
651
|
-
style: BUTTON_REDESIGN_STYLE[BUTTON_REDESIGN_SIZE.XXL],
|
|
652
|
-
buttonHeight: 55,
|
|
653
|
-
pillBorderRadius: 28,
|
|
654
|
-
gap: 7,
|
|
655
|
-
defaultHeight: 55,
|
|
656
|
-
minHeight: 65,
|
|
657
|
-
maxHeight: 100,
|
|
658
|
-
minWidth: 650,
|
|
659
|
-
minDualWidth: 300,
|
|
660
615
|
maxWidth: 750,
|
|
661
|
-
fontSize:
|
|
616
|
+
fontSize: 18,
|
|
662
617
|
};
|
|
663
618
|
|
|
664
619
|
describe("test responsive style variables for legacy", () => {
|
|
@@ -784,20 +739,12 @@ describe("test responsive style variables for rebranded buttons", () => {
|
|
|
784
739
|
input: BUTTON_REDESIGN_SIZE.XL_SMALL,
|
|
785
740
|
expected: expectedRebrandedResponsiveStylesXlSmall,
|
|
786
741
|
},
|
|
787
|
-
{
|
|
788
|
-
input: BUTTON_REDESIGN_SIZE.XL_BIG,
|
|
789
|
-
expected: expectedRebrandedResponsiveStylesXlBig,
|
|
790
|
-
},
|
|
791
|
-
{
|
|
792
|
-
input: BUTTON_REDESIGN_SIZE.XXL,
|
|
793
|
-
expected: expectedRebrandedResponsiveStylesXXL,
|
|
794
|
-
},
|
|
795
742
|
])(
|
|
796
743
|
`should return rebrand responsive styles for size $input`,
|
|
797
744
|
({ input, expected }) => {
|
|
798
745
|
expect(
|
|
799
746
|
getResponsiveRebrandedStyleVariables({
|
|
800
|
-
|
|
747
|
+
redesignSize: input,
|
|
801
748
|
})
|
|
802
749
|
).toEqual(expected);
|
|
803
750
|
}
|
|
@@ -993,7 +940,7 @@ describe("test rebrand responsive style variables for disable max height", () =>
|
|
|
993
940
|
shouldApplyRebrandedStyles,
|
|
994
941
|
disableMaxHeightSize: input,
|
|
995
942
|
})
|
|
996
|
-
).
|
|
943
|
+
).toMatchObject(expected);
|
|
997
944
|
}
|
|
998
945
|
);
|
|
999
946
|
});
|
|
@@ -16,6 +16,7 @@ export function TagLine({
|
|
|
16
16
|
multiple,
|
|
17
17
|
nonce,
|
|
18
18
|
personalization,
|
|
19
|
+
style,
|
|
19
20
|
}: {|
|
|
20
21
|
fundingSource: $Values<typeof FUNDING>,
|
|
21
22
|
style: ButtonStyle,
|
|
@@ -25,6 +26,7 @@ export function TagLine({
|
|
|
25
26
|
personalization: ?Personalization,
|
|
26
27
|
|}): ?ElementNode {
|
|
27
28
|
const fundingConfig = getFundingConfig()[fundingSource];
|
|
29
|
+
const { shouldApplyRebrandedStyles } = style;
|
|
28
30
|
|
|
29
31
|
if (!fundingConfig) {
|
|
30
32
|
throw new Error(`Can not get config for ${fundingSource}`);
|
|
@@ -39,12 +41,14 @@ export function TagLine({
|
|
|
39
41
|
const tagline = personalization && personalization.tagline;
|
|
40
42
|
|
|
41
43
|
return (
|
|
42
|
-
<div
|
|
44
|
+
<div
|
|
45
|
+
class={`${CLASS.TAGLINE}${
|
|
46
|
+
shouldApplyRebrandedStyles ? ` ${CLASS.BUTTON_REBRAND}` : ""
|
|
47
|
+
}`}
|
|
48
|
+
>
|
|
43
49
|
{tagline ? (
|
|
44
50
|
<Fragment>
|
|
45
|
-
<
|
|
46
|
-
{tagline.Component ? <tagline.Component /> : tagline.text}
|
|
47
|
-
</span>
|
|
51
|
+
{tagline.Component ? <tagline.Component /> : tagline.text}
|
|
48
52
|
{tagline.tracking && tagline.tracking.impression && (
|
|
49
53
|
<TrackingBeacon url={tagline.tracking.impression} nonce={nonce} />
|
|
50
54
|
)}
|
|
@@ -251,6 +251,7 @@ export const getButtonsComponent: () => ButtonsComponent = memoize(() => {
|
|
|
251
251
|
onShippingOptionsChange,
|
|
252
252
|
style = {},
|
|
253
253
|
enableFunding = getEnableFunding(),
|
|
254
|
+
disableFunding = getDisableFunding(),
|
|
254
255
|
fundingEligibility = getRefinedFundingEligibility(),
|
|
255
256
|
supportsPopups = userAgentSupportsPopups(),
|
|
256
257
|
supportedNativeBrowser = isSupportedNativeBrowser(),
|
|
@@ -302,6 +303,7 @@ export const getButtonsComponent: () => ButtonsComponent = memoize(() => {
|
|
|
302
303
|
fundingSource,
|
|
303
304
|
fundingEligibility,
|
|
304
305
|
enableFunding,
|
|
306
|
+
disableFunding,
|
|
305
307
|
components,
|
|
306
308
|
onShippingChange,
|
|
307
309
|
onShippingAddressChange,
|
|
@@ -730,6 +732,7 @@ export const getButtonsComponent: () => ButtonsComponent = memoize(() => {
|
|
|
730
732
|
style = {},
|
|
731
733
|
fundingEligibility = getRefinedFundingEligibility(),
|
|
732
734
|
enableFunding = getEnableFunding(),
|
|
735
|
+
disableFunding = getDisableFunding(),
|
|
733
736
|
experiment = getButtonExperiments(),
|
|
734
737
|
applePaySupport,
|
|
735
738
|
supportsPopups,
|
|
@@ -761,6 +764,7 @@ export const getButtonsComponent: () => ButtonsComponent = memoize(() => {
|
|
|
761
764
|
fundingSource,
|
|
762
765
|
fundingEligibility,
|
|
763
766
|
enableFunding,
|
|
767
|
+
disableFunding,
|
|
764
768
|
experiment,
|
|
765
769
|
components,
|
|
766
770
|
onShippingChange,
|