@paypal/checkout-components 5.0.363 → 5.0.365
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 +1 -1
- package/src/constants/button.js +8 -2
- package/src/constants/class.js +1 -0
- package/src/funding/common.jsx +2 -0
- package/src/funding/paypal/config.jsx +6 -4
- package/src/funding/paypal/template.jsx +5 -4
- package/src/funding/venmo/style.scoped.scss +5 -0
- package/src/funding/venmo/template.jsx +1 -3
- package/src/marks/template.jsx +1 -1
- package/src/types.js +1 -3
- package/src/ui/buttons/button.jsx +3 -9
- package/src/ui/buttons/buttons.jsx +0 -1
- package/src/ui/buttons/poweredBy.jsx +1 -1
- package/src/ui/buttons/props.js +320 -11
- package/src/ui/buttons/props.test.js +830 -0
- package/src/ui/buttons/style.jsx +8 -6
- package/src/ui/buttons/styles/base.js +3 -5
- package/src/ui/buttons/styles/button.js +0 -2
- package/src/ui/buttons/styles/color.js +10 -10
- package/src/ui/buttons/styles/labels.js +15 -0
- package/src/ui/buttons/styles/page.js +1 -1
- package/src/ui/buttons/styles/responsive.js +10 -11
- package/src/ui/buttons/styles/styleUtils.js +4 -13
- package/src/ui/buttons/styles/styleUtils.test.js +21 -34
- package/src/ui/overlay/paypal-app-switch/style.jsx +1 -1
- package/src/ui/overlay/three-domain-secure/style.jsx +1 -1
- package/src/zoid/buttons/component.jsx +21 -0
- package/src/zoid/checkout/component.jsx +13 -0
- package/src/zoid/checkout/props.js +10 -0
package/src/ui/buttons/style.jsx
CHANGED
|
@@ -4,8 +4,6 @@
|
|
|
4
4
|
import { node, type ElementNode } from "@krakenjs/jsx-pragmatic/src";
|
|
5
5
|
import { type FundingEligibilityType } from "@paypal/sdk-constants/src";
|
|
6
6
|
|
|
7
|
-
import type { Experiment } from "../../types";
|
|
8
|
-
|
|
9
7
|
import { type ButtonStyle } from "./props";
|
|
10
8
|
import { componentStyle } from "./styles";
|
|
11
9
|
|
|
@@ -13,23 +11,27 @@ type StyleProps = {|
|
|
|
13
11
|
style: ButtonStyle,
|
|
14
12
|
nonce: string,
|
|
15
13
|
fundingEligibility: FundingEligibilityType,
|
|
16
|
-
experiment: Experiment,
|
|
17
14
|
|};
|
|
18
15
|
|
|
19
16
|
export function Style({
|
|
20
17
|
style,
|
|
21
18
|
nonce,
|
|
22
19
|
fundingEligibility,
|
|
23
|
-
experiment,
|
|
24
20
|
}: StyleProps): ElementNode {
|
|
25
|
-
const {
|
|
21
|
+
const {
|
|
22
|
+
height,
|
|
23
|
+
disableMaxWidth,
|
|
24
|
+
disableMaxHeight,
|
|
25
|
+
borderRadius,
|
|
26
|
+
shouldApplyRebrandedStyles,
|
|
27
|
+
} = style;
|
|
26
28
|
const css = componentStyle({
|
|
27
29
|
height,
|
|
28
30
|
fundingEligibility,
|
|
29
31
|
disableMaxWidth,
|
|
30
32
|
disableMaxHeight,
|
|
31
33
|
borderRadius,
|
|
32
|
-
|
|
34
|
+
shouldApplyRebrandedStyles,
|
|
33
35
|
});
|
|
34
36
|
|
|
35
37
|
return <style nonce={nonce} innerHTML={css} />;
|
|
@@ -2,8 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
import { type FundingEligibilityType } from "@paypal/sdk-constants/src";
|
|
4
4
|
|
|
5
|
-
import type { Experiment } from "../../../types";
|
|
6
|
-
|
|
7
5
|
import { pageStyle } from "./page";
|
|
8
6
|
import { buttonStyle } from "./button";
|
|
9
7
|
import { labelStyle } from "./labels";
|
|
@@ -16,14 +14,14 @@ export function componentStyle({
|
|
|
16
14
|
disableMaxWidth,
|
|
17
15
|
disableMaxHeight,
|
|
18
16
|
borderRadius,
|
|
19
|
-
|
|
17
|
+
shouldApplyRebrandedStyles,
|
|
20
18
|
}: {|
|
|
21
19
|
height?: ?number,
|
|
22
20
|
fundingEligibility: FundingEligibilityType,
|
|
23
21
|
disableMaxWidth?: ?boolean,
|
|
24
22
|
disableMaxHeight?: ?boolean,
|
|
25
23
|
borderRadius?: ?number,
|
|
26
|
-
|
|
24
|
+
shouldApplyRebrandedStyles: boolean,
|
|
27
25
|
|}): string {
|
|
28
26
|
return `
|
|
29
27
|
${pageStyle}
|
|
@@ -36,7 +34,7 @@ export function componentStyle({
|
|
|
36
34
|
disableMaxWidth,
|
|
37
35
|
disableMaxHeight,
|
|
38
36
|
borderRadius,
|
|
39
|
-
|
|
37
|
+
shouldApplyRebrandedStyles,
|
|
40
38
|
})}
|
|
41
39
|
`;
|
|
42
40
|
}
|
|
@@ -15,9 +15,7 @@ export const buttonStyle = `
|
|
|
15
15
|
margin: 0;
|
|
16
16
|
background: 0;
|
|
17
17
|
border: 0;
|
|
18
|
-
font-family: PayPalPlain-Regular, system-ui, -apple-system, Roboto, "Segoe UI", Helvetica-Neue, Helvetica, Arial, sans-serif;
|
|
19
18
|
text-transform: none;
|
|
20
|
-
font-weight: 500;
|
|
21
19
|
font-smoothing: antialiased;
|
|
22
20
|
z-index: 0;
|
|
23
21
|
font-size: 0;
|
|
@@ -25,39 +25,39 @@ export const buttonColorStyle = `
|
|
|
25
25
|
border-top-color: rgba(255, 255, 255, .85);
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
-
.${CLASS.BUTTON}.${CLASS.COLOR}-${BUTTON_COLOR.
|
|
29
|
-
.${CLASS.BUTTON_ROW}.${CLASS.COLOR}-${BUTTON_COLOR.
|
|
28
|
+
.${CLASS.BUTTON}.${CLASS.COLOR}-${BUTTON_COLOR.REBRAND_BLUE},
|
|
29
|
+
.${CLASS.BUTTON_ROW}.${CLASS.COLOR}-${BUTTON_COLOR.REBRAND_BLUE} .menu-button {
|
|
30
30
|
background: #60CDFF;
|
|
31
31
|
}
|
|
32
32
|
|
|
33
33
|
@media (hover:hover) {
|
|
34
|
-
.${CLASS.BUTTON}.${CLASS.COLOR}-${BUTTON_COLOR.
|
|
35
|
-
background: #
|
|
34
|
+
.${CLASS.BUTTON}.${CLASS.COLOR}-${BUTTON_COLOR.REBRAND_BLUE}:hover {
|
|
35
|
+
background: #54B4E0;
|
|
36
36
|
overflow: inherit;
|
|
37
37
|
}
|
|
38
38
|
}
|
|
39
39
|
|
|
40
40
|
@media (hover:hover) {
|
|
41
|
-
.${CLASS.BUTTON}.${CLASS.COLOR}-${BUTTON_COLOR.
|
|
42
|
-
background: #
|
|
41
|
+
.${CLASS.BUTTON}.${CLASS.COLOR}-${BUTTON_COLOR.REBRAND_BLUE}:active {
|
|
42
|
+
background: #3DB5FF;
|
|
43
43
|
overflow: inherit;
|
|
44
44
|
}
|
|
45
45
|
}
|
|
46
46
|
|
|
47
|
-
.${CLASS.BUTTON}.${CLASS.COLOR}-${BUTTON_COLOR.
|
|
48
|
-
.${CLASS.BUTTON_ROW}.${CLASS.COLOR}-${BUTTON_COLOR.
|
|
47
|
+
.${CLASS.BUTTON}.${CLASS.COLOR}-${BUTTON_COLOR.REBRAND_DARKBLUE},
|
|
48
|
+
.${CLASS.BUTTON_ROW}.${CLASS.COLOR}-${BUTTON_COLOR.REBRAND_DARKBLUE} .menu-button {
|
|
49
49
|
background: #002991;
|
|
50
50
|
}
|
|
51
51
|
|
|
52
52
|
@media (hover:hover) {
|
|
53
|
-
.${CLASS.BUTTON}.${CLASS.COLOR}-${BUTTON_COLOR.
|
|
53
|
+
.${CLASS.BUTTON}.${CLASS.COLOR}-${BUTTON_COLOR.REBRAND_DARKBLUE}:hover {
|
|
54
54
|
background: #0038BA;
|
|
55
55
|
overflow: inherit;
|
|
56
56
|
}
|
|
57
57
|
}
|
|
58
58
|
|
|
59
59
|
@media (hover:hover) {
|
|
60
|
-
.${CLASS.BUTTON}.${CLASS.COLOR}-${BUTTON_COLOR.
|
|
60
|
+
.${CLASS.BUTTON}.${CLASS.COLOR}-${BUTTON_COLOR.REBRAND_DARKBLUE}:active {
|
|
61
61
|
background: #0057D9;
|
|
62
62
|
overflow: inherit;
|
|
63
63
|
}
|
|
@@ -55,4 +55,19 @@ export const labelStyle = `
|
|
|
55
55
|
0% { ${COMPRESSED} }
|
|
56
56
|
100% { ${EXPANDED} }
|
|
57
57
|
}
|
|
58
|
+
|
|
59
|
+
.${CLASS.BUTTON_LABEL} {
|
|
60
|
+
font-family: system-ui, -apple-system, Roboto, "Segoe UI", Helvetica-Neue, Helvetica, Arial, sans-serif;
|
|
61
|
+
font-weight: 500;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
.${CLASS.BUTTON_REBRAND} .${CLASS.BUTTON_LABEL} {
|
|
65
|
+
font-family: PayPal Pro Book, system-ui, -apple-system, Roboto, "Segoe UI", Helvetica-Neue, Helvetica, Arial, sans-serif;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
.${CLASS.BUTTON_REBRAND} div[data-funding-source=venmo] .${
|
|
69
|
+
CLASS.BUTTON_LABEL
|
|
70
|
+
} {
|
|
71
|
+
font-family: Scto Grotesk A, system-ui, -apple-system, Roboto, "Segoe UI", Helvetica-Neue, Helvetica, Arial, sans-serif;
|
|
72
|
+
}
|
|
58
73
|
`;
|
|
@@ -4,7 +4,7 @@ import { CLASS } from "../../../constants";
|
|
|
4
4
|
|
|
5
5
|
export const pageStyle = `
|
|
6
6
|
html, body {
|
|
7
|
-
font-family:
|
|
7
|
+
font-family: PayPal Plain, system-ui, -apple-system, Roboto, "Segoe UI", Helvetica-Neue, Helvetica, Arial, sans-serif;
|
|
8
8
|
padding: 0;
|
|
9
9
|
margin: 0;
|
|
10
10
|
width: 100%;
|
|
@@ -19,7 +19,6 @@ import {
|
|
|
19
19
|
BUTTON_DISABLE_MAX_HEIGHT_STYLE,
|
|
20
20
|
} from "../config";
|
|
21
21
|
import { isBorderRadiusNumber } from "../util";
|
|
22
|
-
import type { Experiment } from "../../../types";
|
|
23
22
|
|
|
24
23
|
import {
|
|
25
24
|
getResponsiveStyleVariables,
|
|
@@ -35,14 +34,14 @@ const generateButtonSizeStyles = ({
|
|
|
35
34
|
disableMaxWidth,
|
|
36
35
|
disableMaxHeight,
|
|
37
36
|
borderRadius,
|
|
38
|
-
|
|
37
|
+
shouldApplyRebrandedStyles,
|
|
39
38
|
}: {|
|
|
40
39
|
height?: ?number,
|
|
41
40
|
fundingEligibility: FundingEligibilityType,
|
|
42
41
|
disableMaxWidth?: ?boolean,
|
|
43
42
|
disableMaxHeight?: ?boolean,
|
|
44
43
|
borderRadius?: ?number,
|
|
45
|
-
|
|
44
|
+
shouldApplyRebrandedStyles: boolean,
|
|
46
45
|
|}): string => {
|
|
47
46
|
return Object.keys(BUTTON_SIZE_STYLE)
|
|
48
47
|
.map((size) => {
|
|
@@ -58,7 +57,7 @@ const generateButtonSizeStyles = ({
|
|
|
58
57
|
} = getResponsiveStyleVariables({
|
|
59
58
|
height,
|
|
60
59
|
fundingEligibility,
|
|
61
|
-
|
|
60
|
+
shouldApplyRebrandedStyles,
|
|
62
61
|
size,
|
|
63
62
|
});
|
|
64
63
|
|
|
@@ -362,10 +361,10 @@ const generateButtonSizeStyles = ({
|
|
|
362
361
|
|
|
363
362
|
const generateDisableMaxHeightStyles = ({
|
|
364
363
|
fundingEligibility,
|
|
365
|
-
|
|
364
|
+
shouldApplyRebrandedStyles,
|
|
366
365
|
}: {|
|
|
367
366
|
fundingEligibility: FundingEligibilityType,
|
|
368
|
-
|
|
367
|
+
shouldApplyRebrandedStyles: boolean,
|
|
369
368
|
|}): string => {
|
|
370
369
|
return Object.keys(BUTTON_DISABLE_MAX_HEIGHT_STYLE)
|
|
371
370
|
.map((disableMaxHeightSize) => {
|
|
@@ -382,7 +381,7 @@ const generateDisableMaxHeightStyles = ({
|
|
|
382
381
|
gap,
|
|
383
382
|
} = getDisableMaxHeightResponsiveStyleVariables({
|
|
384
383
|
fundingEligibility,
|
|
385
|
-
|
|
384
|
+
shouldApplyRebrandedStyles,
|
|
386
385
|
disableMaxHeightSize,
|
|
387
386
|
});
|
|
388
387
|
|
|
@@ -477,14 +476,14 @@ export function buttonResponsiveStyle({
|
|
|
477
476
|
disableMaxWidth,
|
|
478
477
|
disableMaxHeight,
|
|
479
478
|
borderRadius,
|
|
480
|
-
|
|
479
|
+
shouldApplyRebrandedStyles,
|
|
481
480
|
}: {|
|
|
482
481
|
height?: ?number,
|
|
483
482
|
fundingEligibility: FundingEligibilityType,
|
|
484
483
|
disableMaxWidth?: ?boolean,
|
|
485
484
|
disableMaxHeight?: ?boolean,
|
|
486
485
|
borderRadius?: ?number,
|
|
487
|
-
|
|
486
|
+
shouldApplyRebrandedStyles: boolean,
|
|
488
487
|
|}): string {
|
|
489
488
|
const buttonSizeStyles = generateButtonSizeStyles({
|
|
490
489
|
height,
|
|
@@ -492,13 +491,13 @@ export function buttonResponsiveStyle({
|
|
|
492
491
|
disableMaxWidth,
|
|
493
492
|
disableMaxHeight,
|
|
494
493
|
borderRadius,
|
|
495
|
-
|
|
494
|
+
shouldApplyRebrandedStyles,
|
|
496
495
|
});
|
|
497
496
|
|
|
498
497
|
const disableMaxHeightStyles = disableMaxHeight
|
|
499
498
|
? generateDisableMaxHeightStyles({
|
|
500
499
|
fundingEligibility,
|
|
501
|
-
|
|
500
|
+
shouldApplyRebrandedStyles,
|
|
502
501
|
})
|
|
503
502
|
: "";
|
|
504
503
|
|
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
import { max, perc, roundUp } from "@krakenjs/belter/src";
|
|
4
4
|
import type { FundingEligibilityType } from "@paypal/sdk-constants/src";
|
|
5
5
|
|
|
6
|
-
import type { Experiment } from "../../../types";
|
|
7
6
|
import { BUTTON_DISABLE_MAX_HEIGHT_STYLE, BUTTON_SIZE_STYLE } from "../config";
|
|
8
7
|
import {
|
|
9
8
|
BUTTON_SIZE,
|
|
@@ -98,18 +97,14 @@ function getApplePayButtonHeight({ height }: {| height: number |}): number {
|
|
|
98
97
|
export function getResponsiveStyleVariables({
|
|
99
98
|
height,
|
|
100
99
|
fundingEligibility,
|
|
101
|
-
|
|
100
|
+
shouldApplyRebrandedStyles,
|
|
102
101
|
size,
|
|
103
102
|
}: {|
|
|
104
103
|
height?: ?number,
|
|
105
104
|
fundingEligibility: FundingEligibilityType,
|
|
106
|
-
|
|
105
|
+
shouldApplyRebrandedStyles: boolean,
|
|
107
106
|
size: $Values<typeof BUTTON_SIZE>,
|
|
108
107
|
|}): Object {
|
|
109
|
-
const { isPaypalRebrandEnabled, defaultBlueButtonColor } = experiment;
|
|
110
|
-
const shouldApplyRebrandedStyles =
|
|
111
|
-
isPaypalRebrandEnabled && defaultBlueButtonColor !== "gold";
|
|
112
|
-
|
|
113
108
|
const style = BUTTON_SIZE_STYLE[size];
|
|
114
109
|
|
|
115
110
|
const buttonHeight = height || style.defaultHeight;
|
|
@@ -163,17 +158,13 @@ export function getResponsiveStyleVariables({
|
|
|
163
158
|
|
|
164
159
|
export function getDisableMaxHeightResponsiveStyleVariables({
|
|
165
160
|
fundingEligibility,
|
|
166
|
-
|
|
161
|
+
shouldApplyRebrandedStyles,
|
|
167
162
|
disableMaxHeightSize,
|
|
168
163
|
}: {|
|
|
169
164
|
fundingEligibility: FundingEligibilityType,
|
|
170
|
-
|
|
165
|
+
shouldApplyRebrandedStyles: boolean,
|
|
171
166
|
disableMaxHeightSize: $Values<typeof BUTTON_DISABLE_MAX_HEIGHT_SIZE>,
|
|
172
167
|
|}): Object {
|
|
173
|
-
const { isPaypalRebrandEnabled, defaultBlueButtonColor } = experiment;
|
|
174
|
-
const shouldApplyRebrandedStyles =
|
|
175
|
-
isPaypalRebrandEnabled && defaultBlueButtonColor !== "gold";
|
|
176
|
-
|
|
177
168
|
const disableHeightStyle =
|
|
178
169
|
BUTTON_DISABLE_MAX_HEIGHT_STYLE[disableMaxHeightSize];
|
|
179
170
|
const buttonHeight = disableHeightStyle.defaultHeight;
|
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
import { describe, expect, test } from "vitest";
|
|
4
4
|
|
|
5
5
|
import {
|
|
6
|
-
BUTTON_COLOR,
|
|
7
6
|
BUTTON_SIZE,
|
|
8
7
|
BUTTON_DISABLE_MAX_HEIGHT_SIZE,
|
|
9
8
|
} from "../../../constants/button";
|
|
@@ -313,7 +312,7 @@ const expectedLegacyDisableMaxHeightStylesXXXL = {
|
|
|
313
312
|
gap: 7,
|
|
314
313
|
};
|
|
315
314
|
|
|
316
|
-
// expected shouldResizeLabel = true style variables for disable max
|
|
315
|
+
// expected shouldResizeLabel = true style variables for disable max height
|
|
317
316
|
const expectedResizeLabelDisableMaxHeightStylesTiny = {
|
|
318
317
|
APMHeight: 18,
|
|
319
318
|
applePayHeight: 25,
|
|
@@ -572,10 +571,8 @@ const expectedRebrandDisableMaxHeightStylesXXXL = {
|
|
|
572
571
|
};
|
|
573
572
|
|
|
574
573
|
describe("test responsive style variables for legacy", () => {
|
|
575
|
-
const
|
|
576
|
-
|
|
577
|
-
defaultBlueButtonColor: BUTTON_COLOR.GOLD,
|
|
578
|
-
};
|
|
574
|
+
const shouldApplyRebrandedStyles = false;
|
|
575
|
+
|
|
579
576
|
const fundingEligibility = {
|
|
580
577
|
paypal: {
|
|
581
578
|
eligible: true,
|
|
@@ -597,7 +594,7 @@ describe("test responsive style variables for legacy", () => {
|
|
|
597
594
|
({ input, expected }) => {
|
|
598
595
|
expect(
|
|
599
596
|
getResponsiveStyleVariables({
|
|
600
|
-
|
|
597
|
+
shouldApplyRebrandedStyles,
|
|
601
598
|
fundingEligibility,
|
|
602
599
|
size: input,
|
|
603
600
|
})
|
|
@@ -607,10 +604,8 @@ describe("test responsive style variables for legacy", () => {
|
|
|
607
604
|
});
|
|
608
605
|
|
|
609
606
|
describe("test responsive style variables when shouldResizeLabel == true", () => {
|
|
610
|
-
const
|
|
611
|
-
|
|
612
|
-
defaultBlueButtonColor: BUTTON_COLOR.GOLD,
|
|
613
|
-
};
|
|
607
|
+
const shouldApplyRebrandedStyles = false;
|
|
608
|
+
|
|
614
609
|
const fundingEligibility = {
|
|
615
610
|
paypal: {
|
|
616
611
|
eligible: true,
|
|
@@ -659,7 +654,7 @@ describe("test responsive style variables when shouldResizeLabel == true", () =>
|
|
|
659
654
|
expect(
|
|
660
655
|
getResponsiveStyleVariables({
|
|
661
656
|
fundingEligibility,
|
|
662
|
-
|
|
657
|
+
shouldApplyRebrandedStyles,
|
|
663
658
|
size: input,
|
|
664
659
|
})
|
|
665
660
|
).toEqual(expected);
|
|
@@ -667,11 +662,9 @@ describe("test responsive style variables when shouldResizeLabel == true", () =>
|
|
|
667
662
|
);
|
|
668
663
|
});
|
|
669
664
|
|
|
670
|
-
describe("test responsive style variables for
|
|
671
|
-
const
|
|
672
|
-
|
|
673
|
-
defaultBlueButtonColor: BUTTON_COLOR.DEFAULT_BLUE_LIGHT_BLUE,
|
|
674
|
-
};
|
|
665
|
+
describe("test responsive style variables for rebranded buttons", () => {
|
|
666
|
+
const shouldApplyRebrandedStyles = true;
|
|
667
|
+
|
|
675
668
|
const fundingEligibility = {
|
|
676
669
|
paypal: {
|
|
677
670
|
eligible: true,
|
|
@@ -705,7 +698,7 @@ describe("test responsive style variables for rebrand light blue button", () =>
|
|
|
705
698
|
({ input, expected }) => {
|
|
706
699
|
expect(
|
|
707
700
|
getResponsiveStyleVariables({
|
|
708
|
-
|
|
701
|
+
shouldApplyRebrandedStyles,
|
|
709
702
|
fundingEligibility,
|
|
710
703
|
size: input,
|
|
711
704
|
})
|
|
@@ -715,10 +708,8 @@ describe("test responsive style variables for rebrand light blue button", () =>
|
|
|
715
708
|
});
|
|
716
709
|
|
|
717
710
|
describe("test responsive style variables for legacy disable max height", () => {
|
|
718
|
-
const
|
|
719
|
-
|
|
720
|
-
defaultBlueButtonColor: BUTTON_COLOR.GOLD,
|
|
721
|
-
};
|
|
711
|
+
const shouldApplyRebrandedStyles = false;
|
|
712
|
+
|
|
722
713
|
const fundingEligibility = {
|
|
723
714
|
paypal: {
|
|
724
715
|
eligible: true,
|
|
@@ -769,7 +760,7 @@ describe("test responsive style variables for legacy disable max height", () =>
|
|
|
769
760
|
expect(
|
|
770
761
|
getDisableMaxHeightResponsiveStyleVariables({
|
|
771
762
|
fundingEligibility,
|
|
772
|
-
|
|
763
|
+
shouldApplyRebrandedStyles,
|
|
773
764
|
disableMaxHeightSize: input,
|
|
774
765
|
})
|
|
775
766
|
).toEqual(expected);
|
|
@@ -777,11 +768,9 @@ describe("test responsive style variables for legacy disable max height", () =>
|
|
|
777
768
|
);
|
|
778
769
|
});
|
|
779
770
|
|
|
780
|
-
describe("test responsive style variables when
|
|
781
|
-
const
|
|
782
|
-
|
|
783
|
-
defaultBlueButtonColor: BUTTON_COLOR.GOLD,
|
|
784
|
-
};
|
|
771
|
+
describe("test responsive style variables when shouldResizeLabel == true for disable max height", () => {
|
|
772
|
+
const shouldApplyRebrandedStyles = false;
|
|
773
|
+
|
|
785
774
|
const fundingEligibility = {
|
|
786
775
|
paypal: {
|
|
787
776
|
eligible: true,
|
|
@@ -846,7 +835,7 @@ describe("test responsive style variables when shouldResizeLable == true for dis
|
|
|
846
835
|
expect(
|
|
847
836
|
getDisableMaxHeightResponsiveStyleVariables({
|
|
848
837
|
fundingEligibility,
|
|
849
|
-
|
|
838
|
+
shouldApplyRebrandedStyles,
|
|
850
839
|
disableMaxHeightSize: input,
|
|
851
840
|
})
|
|
852
841
|
).toEqual(expected);
|
|
@@ -855,10 +844,8 @@ describe("test responsive style variables when shouldResizeLable == true for dis
|
|
|
855
844
|
});
|
|
856
845
|
|
|
857
846
|
describe("test rebrand responsive style variables for disable max height", () => {
|
|
858
|
-
const
|
|
859
|
-
|
|
860
|
-
defaultBlueButtonColor: BUTTON_COLOR.DEFAULT_BLUE_LIGHT_BLUE,
|
|
861
|
-
};
|
|
847
|
+
const shouldApplyRebrandedStyles = true;
|
|
848
|
+
|
|
862
849
|
const fundingEligibility = {
|
|
863
850
|
paypal: {
|
|
864
851
|
eligible: true,
|
|
@@ -909,7 +896,7 @@ describe("test rebrand responsive style variables for disable max height", () =>
|
|
|
909
896
|
expect(
|
|
910
897
|
getDisableMaxHeightResponsiveStyleVariables({
|
|
911
898
|
fundingEligibility,
|
|
912
|
-
|
|
899
|
+
shouldApplyRebrandedStyles,
|
|
913
900
|
disableMaxHeightSize: input,
|
|
914
901
|
})
|
|
915
902
|
).toEqual(expected);
|
|
@@ -91,7 +91,7 @@ export function getContainerStyle({ uid }: {| uid: string |}): string {
|
|
|
91
91
|
}
|
|
92
92
|
|
|
93
93
|
#${uid} .paypal-checkout-modal {
|
|
94
|
-
font-family:
|
|
94
|
+
font-family: PayPal Plain, system-ui, -apple-system, Roboto, "Segoe UI", Helvetica-Neue, Helvetica, Arial, sans-serif;
|
|
95
95
|
font-size: 14px;
|
|
96
96
|
text-align: center;
|
|
97
97
|
|
|
@@ -113,7 +113,7 @@ export function getContainerStyle({ uid }: {| uid: string |}): string {
|
|
|
113
113
|
}
|
|
114
114
|
|
|
115
115
|
#${uid} .paypal-checkout-modal {
|
|
116
|
-
font-family:
|
|
116
|
+
font-family: PayPal Plain, system-ui, -apple-system, Roboto, "Segoe UI", Helvetica-Neue, Helvetica, Arial, sans-serif;
|
|
117
117
|
font-size: 14px;
|
|
118
118
|
text-align: center;
|
|
119
119
|
|
|
@@ -82,6 +82,7 @@ import {
|
|
|
82
82
|
import {
|
|
83
83
|
normalizeButtonStyle,
|
|
84
84
|
normalizeButtonMessage,
|
|
85
|
+
getButtonColor,
|
|
85
86
|
type ButtonProps,
|
|
86
87
|
type ButtonExtensions,
|
|
87
88
|
} from "../../ui/buttons/props";
|
|
@@ -1226,6 +1227,26 @@ export const getButtonsComponent: () => ButtonsComponent = memoize(() => {
|
|
|
1226
1227
|
default: () => ({}),
|
|
1227
1228
|
},
|
|
1228
1229
|
|
|
1230
|
+
buttonColor: {
|
|
1231
|
+
type: "object",
|
|
1232
|
+
default: () => ({
|
|
1233
|
+
shouldApplyRebrandedStyles: false,
|
|
1234
|
+
color: "gold",
|
|
1235
|
+
}),
|
|
1236
|
+
queryParam: true,
|
|
1237
|
+
decorate: ({ props }) => {
|
|
1238
|
+
const { experiment, style, sessionID, fundingSource } = props;
|
|
1239
|
+
|
|
1240
|
+
return getButtonColor({
|
|
1241
|
+
experiment,
|
|
1242
|
+
style,
|
|
1243
|
+
sessionID,
|
|
1244
|
+
storageState,
|
|
1245
|
+
fundingSource,
|
|
1246
|
+
});
|
|
1247
|
+
},
|
|
1248
|
+
},
|
|
1249
|
+
|
|
1229
1250
|
supportedNativeBrowser: {
|
|
1230
1251
|
type: "boolean",
|
|
1231
1252
|
value: isSupportedNativeBrowser,
|
|
@@ -283,6 +283,19 @@ export function getCheckoutComponent(): CheckoutComponent {
|
|
|
283
283
|
required: false,
|
|
284
284
|
},
|
|
285
285
|
|
|
286
|
+
hasShippingCallback: {
|
|
287
|
+
type: "boolean",
|
|
288
|
+
required: false,
|
|
289
|
+
queryParam: true,
|
|
290
|
+
value: ({ props }) => {
|
|
291
|
+
return Boolean(
|
|
292
|
+
props.onShippingChange ||
|
|
293
|
+
props.onShippingAddressChange ||
|
|
294
|
+
props.onShippingOptionsChange
|
|
295
|
+
);
|
|
296
|
+
},
|
|
297
|
+
},
|
|
298
|
+
|
|
286
299
|
clientMetadataID: {
|
|
287
300
|
type: "string",
|
|
288
301
|
required: false,
|
|
@@ -4,6 +4,12 @@ import type { ZalgoPromise } from "@krakenjs/zalgo-promise/src";
|
|
|
4
4
|
import type { CrossDomainWindowType } from "@krakenjs/cross-domain-utils/src";
|
|
5
5
|
import { FUNDING, ENV, type LocaleType } from "@paypal/sdk-constants/src";
|
|
6
6
|
|
|
7
|
+
import type {
|
|
8
|
+
OnShippingAddressChange,
|
|
9
|
+
OnShippingChange,
|
|
10
|
+
OnShippingOptionsChange,
|
|
11
|
+
} from "../../ui/buttons/props";
|
|
12
|
+
|
|
7
13
|
export type OnApproveData = {|
|
|
8
14
|
orderID: string,
|
|
9
15
|
payerID: string,
|
|
@@ -33,6 +39,10 @@ export type CheckoutPropsType = {|
|
|
|
33
39
|
env: $Values<typeof ENV>,
|
|
34
40
|
stage?: string,
|
|
35
41
|
stageUrl?: string,
|
|
42
|
+
onShippingChange: ?OnShippingChange,
|
|
43
|
+
onShippingAddressChange: ?OnShippingAddressChange,
|
|
44
|
+
onShippingOptionsChange: ?OnShippingOptionsChange,
|
|
45
|
+
hasShippingCallback: boolean,
|
|
36
46
|
locale: LocaleType,
|
|
37
47
|
style: {||},
|
|
38
48
|
nonce: string,
|