@paypal/checkout-components 5.0.349-alpha-4a3a827.0 → 5.0.349
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 +0 -2
- package/src/funding/paypal/config.jsx +0 -4
- package/src/funding/paypal/template.jsx +6 -17
- package/src/types.js +0 -2
- package/src/ui/buttons/button.jsx +0 -4
- package/src/ui/buttons/buttons.jsx +0 -1
- package/src/ui/buttons/props.js +1 -8
- package/src/ui/buttons/style.jsx +0 -5
- package/src/ui/buttons/styles/base.js +0 -5
- package/src/ui/buttons/styles/color.js +0 -38
- package/src/ui/buttons/styles/responsive.js +3 -17
- package/src/zoid/buttons/component.jsx +0 -2
package/package.json
CHANGED
package/src/constants/button.js
CHANGED
|
@@ -12,8 +12,6 @@ export const BUTTON_LABEL = {
|
|
|
12
12
|
|
|
13
13
|
export const BUTTON_COLOR = {
|
|
14
14
|
DEFAULT: ("default": "default"),
|
|
15
|
-
DEFAULT_BLUE_LIGHT_BLUE: ("defaultBlue_lightBlue": "defaultBlue_lightBlue"),
|
|
16
|
-
DEFAULT_BLUE_DARK_BLUE: ("defaultBlue_darkBlue": "defaultBlue_darkBlue"),
|
|
17
15
|
GOLD: ("gold": "gold"),
|
|
18
16
|
BLUE: ("blue": "blue"),
|
|
19
17
|
SILVER: ("silver": "silver"),
|
|
@@ -33,8 +33,6 @@ export function getPayPalConfig(): FundingSourceConfig {
|
|
|
33
33
|
BUTTON_COLOR.SILVER,
|
|
34
34
|
BUTTON_COLOR.BLACK,
|
|
35
35
|
BUTTON_COLOR.WHITE,
|
|
36
|
-
BUTTON_COLOR.DEFAULT_BLUE_LIGHT_BLUE,
|
|
37
|
-
BUTTON_COLOR.DEFAULT_BLUE_DARK_BLUE,
|
|
38
36
|
],
|
|
39
37
|
|
|
40
38
|
logoColors: {
|
|
@@ -43,8 +41,6 @@ export function getPayPalConfig(): FundingSourceConfig {
|
|
|
43
41
|
[BUTTON_COLOR.BLUE]: LOGO_COLOR.WHITE,
|
|
44
42
|
[BUTTON_COLOR.BLACK]: LOGO_COLOR.WHITE,
|
|
45
43
|
[BUTTON_COLOR.WHITE]: LOGO_COLOR.BLUE,
|
|
46
|
-
[BUTTON_COLOR.DEFAULT_BLUE_LIGHT_BLUE]: LOGO_COLOR.BLACK,
|
|
47
|
-
[BUTTON_COLOR.DEFAULT_BLUE_DARK_BLUE]: LOGO_COLOR.DARK_BLUE,
|
|
48
44
|
},
|
|
49
45
|
|
|
50
46
|
labelText: ({ content, label, period }) => {
|
|
@@ -12,7 +12,6 @@ import {
|
|
|
12
12
|
PPLogoInlineSVG,
|
|
13
13
|
PayPalLogoExternalImage,
|
|
14
14
|
PayPalLogoInlineSVG,
|
|
15
|
-
PayPalRebrandLogoInlineSVG,
|
|
16
15
|
CreditLogoExternalImage,
|
|
17
16
|
CreditLogoInlineSVG,
|
|
18
17
|
CreditMarkExternalImage,
|
|
@@ -47,22 +46,12 @@ import {
|
|
|
47
46
|
|
|
48
47
|
import css from "./style.scoped.scss";
|
|
49
48
|
|
|
50
|
-
export function Logo({ logoColor
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
// helps reduce bundle size by fetching logos
|
|
57
|
-
<PayPalLogoExternalImage logoColor={logoColor} />
|
|
58
|
-
) : (
|
|
59
|
-
// cdnx/sdk-logo/xxxx/paypal-gold.svg
|
|
60
|
-
// use for server side rendering
|
|
61
|
-
<PayPalLogoInlineSVG logoColor={logoColor} />
|
|
62
|
-
);
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
return <PayPalRebrandLogoInlineSVG logoColor={logoColor} />;
|
|
49
|
+
export function Logo({ logoColor }: LogoOptions): ChildType {
|
|
50
|
+
return __WEB__ ? (
|
|
51
|
+
<PayPalLogoExternalImage logoColor={logoColor} />
|
|
52
|
+
) : (
|
|
53
|
+
<PayPalLogoInlineSVG logoColor={logoColor} />
|
|
54
|
+
);
|
|
66
55
|
}
|
|
67
56
|
|
|
68
57
|
function getPersonalizationText({
|
package/src/types.js
CHANGED
|
@@ -97,7 +97,6 @@ export function Button({
|
|
|
97
97
|
vault,
|
|
98
98
|
}: IndividualButtonProps): ElementNode {
|
|
99
99
|
const { layout, shape, borderRadius } = style;
|
|
100
|
-
const { isPaypalRebrandEnabled, defaultBlueButtonColor } = experiment;
|
|
101
100
|
|
|
102
101
|
const fundingConfig = getFundingConfig()[fundingSource];
|
|
103
102
|
|
|
@@ -127,9 +126,6 @@ export function Button({
|
|
|
127
126
|
color = colors[0];
|
|
128
127
|
}
|
|
129
128
|
|
|
130
|
-
if (isPaypalRebrandEnabled) {
|
|
131
|
-
color = defaultBlueButtonColor;
|
|
132
|
-
}
|
|
133
129
|
// The secondary colors are used to render the smart stack (multiple buttons)
|
|
134
130
|
// they keep track of the mapping of the color style prop to the
|
|
135
131
|
if (multiple && i > 0) {
|
package/src/ui/buttons/props.js
CHANGED
|
@@ -648,8 +648,7 @@ export function normalizeButtonStyle(
|
|
|
648
648
|
}
|
|
649
649
|
|
|
650
650
|
props = props || getDefaultButtonPropsInput();
|
|
651
|
-
const { fundingSource
|
|
652
|
-
const { isPaypalRebrandEnabled, defaultBlueButtonColor } = experiment;
|
|
651
|
+
const { fundingSource } = props;
|
|
653
652
|
|
|
654
653
|
const FUNDING_CONFIG = getFundingConfig();
|
|
655
654
|
const fundingConfig =
|
|
@@ -678,12 +677,6 @@ export function normalizeButtonStyle(
|
|
|
678
677
|
borderRadius,
|
|
679
678
|
} = style;
|
|
680
679
|
|
|
681
|
-
const isColorUnset = color === "" || color === undefined;
|
|
682
|
-
|
|
683
|
-
if (isPaypalRebrandEnabled && isColorUnset) {
|
|
684
|
-
color = defaultBlueButtonColor;
|
|
685
|
-
}
|
|
686
|
-
|
|
687
680
|
// $FlowFixMe
|
|
688
681
|
if (tagline === "false") {
|
|
689
682
|
// $FlowFixMe
|
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,14 +11,12 @@ 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
21
|
const { height, disableMaxWidth, disableMaxHeight, borderRadius } = style;
|
|
26
22
|
const css = componentStyle({
|
|
@@ -29,7 +25,6 @@ export function Style({
|
|
|
29
25
|
disableMaxWidth,
|
|
30
26
|
disableMaxHeight,
|
|
31
27
|
borderRadius,
|
|
32
|
-
experiment,
|
|
33
28
|
});
|
|
34
29
|
|
|
35
30
|
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,12 @@ export function componentStyle({
|
|
|
16
14
|
disableMaxWidth,
|
|
17
15
|
disableMaxHeight,
|
|
18
16
|
borderRadius,
|
|
19
|
-
experiment,
|
|
20
17
|
}: {|
|
|
21
18
|
height?: ?number,
|
|
22
19
|
fundingEligibility: FundingEligibilityType,
|
|
23
20
|
disableMaxWidth?: ?boolean,
|
|
24
21
|
disableMaxHeight?: ?boolean,
|
|
25
22
|
borderRadius?: ?number,
|
|
26
|
-
experiment: Experiment,
|
|
27
23
|
|}): string {
|
|
28
24
|
return `
|
|
29
25
|
${pageStyle}
|
|
@@ -36,7 +32,6 @@ export function componentStyle({
|
|
|
36
32
|
disableMaxWidth,
|
|
37
33
|
disableMaxHeight,
|
|
38
34
|
borderRadius,
|
|
39
|
-
experiment,
|
|
40
35
|
})}
|
|
41
36
|
`;
|
|
42
37
|
}
|
|
@@ -25,44 +25,6 @@ export const buttonColorStyle = `
|
|
|
25
25
|
border-top-color: rgba(255, 255, 255, .85);
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
-
.${CLASS.BUTTON}.${CLASS.COLOR}-${BUTTON_COLOR.DEFAULT_BLUE_LIGHT_BLUE},
|
|
29
|
-
.${CLASS.BUTTON_ROW}.${CLASS.COLOR}-${BUTTON_COLOR.DEFAULT_BLUE_LIGHT_BLUE} .menu-button {
|
|
30
|
-
background: #60CDFF;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
@media (hover:hover) {
|
|
34
|
-
.${CLASS.BUTTON}.${CLASS.COLOR}-${BUTTON_COLOR.DEFAULT_BLUE_LIGHT_BLUE}:hover {
|
|
35
|
-
background: #008CFF;
|
|
36
|
-
overflow: inherit;
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
@media (hover:hover) {
|
|
41
|
-
.${CLASS.BUTTON}.${CLASS.COLOR}-${BUTTON_COLOR.DEFAULT_BLUE_LIGHT_BLUE}:active {
|
|
42
|
-
background: #E3F7FF;
|
|
43
|
-
overflow: inherit;
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
.${CLASS.BUTTON}.${CLASS.COLOR}-${BUTTON_COLOR.DEFAULT_BLUE_DARK_BLUE},
|
|
48
|
-
.${CLASS.BUTTON_ROW}.${CLASS.COLOR}-${BUTTON_COLOR.DEFAULT_BLUE_DARK_BLUE} .menu-button {
|
|
49
|
-
background: #002991;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
@media (hover:hover) {
|
|
53
|
-
.${CLASS.BUTTON}.${CLASS.COLOR}-${BUTTON_COLOR.DEFAULT_BLUE_DARK_BLUE}:hover {
|
|
54
|
-
background: #0038BA;
|
|
55
|
-
overflow: inherit;
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
@media (hover:hover) {
|
|
60
|
-
.${CLASS.BUTTON}.${CLASS.COLOR}-${BUTTON_COLOR.DEFAULT_BLUE_DARK_BLUE}:active {
|
|
61
|
-
background: #0057D9;
|
|
62
|
-
overflow: inherit;
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
|
|
66
28
|
.${CLASS.BUTTON}.${CLASS.COLOR}-${BUTTON_COLOR.GOLD},
|
|
67
29
|
.${CLASS.BUTTON_ROW}.${CLASS.COLOR}-${BUTTON_COLOR.GOLD} .menu-button {
|
|
68
30
|
background: #ffc439;
|
|
@@ -15,7 +15,6 @@ import {
|
|
|
15
15
|
} from "../../../constants";
|
|
16
16
|
import { BUTTON_SIZE_STYLE, BUTTON_RELATIVE_STYLE } from "../config";
|
|
17
17
|
import { isBorderRadiusNumber } from "../util";
|
|
18
|
-
import type { Experiment } from "../../../types";
|
|
19
18
|
|
|
20
19
|
const BUTTON_MIN_ASPECT_RATIO = 2.2;
|
|
21
20
|
const MIN_SPLIT_BUTTON_WIDTH = 300;
|
|
@@ -29,20 +28,13 @@ export function buttonResponsiveStyle({
|
|
|
29
28
|
disableMaxWidth,
|
|
30
29
|
disableMaxHeight,
|
|
31
30
|
borderRadius,
|
|
32
|
-
experiment = {},
|
|
33
31
|
}: {|
|
|
34
32
|
height?: ?number,
|
|
35
33
|
fundingEligibility: FundingEligibilityType,
|
|
36
34
|
disableMaxWidth?: ?boolean,
|
|
37
35
|
disableMaxHeight?: ?boolean,
|
|
38
36
|
borderRadius?: ?number,
|
|
39
|
-
experiment: Experiment,
|
|
40
37
|
|}): string {
|
|
41
|
-
const { isPaypalRebrandEnabled, defaultBlueButtonColor } = experiment;
|
|
42
|
-
const color = defaultBlueButtonColor;
|
|
43
|
-
|
|
44
|
-
const shouldApplyRebrandedStyles = isPaypalRebrandEnabled && color !== "gold";
|
|
45
|
-
|
|
46
38
|
return Object.keys(BUTTON_SIZE_STYLE)
|
|
47
39
|
.map((size) => {
|
|
48
40
|
const style = BUTTON_SIZE_STYLE[size];
|
|
@@ -63,18 +55,12 @@ export function buttonResponsiveStyle({
|
|
|
63
55
|
|
|
64
56
|
const textPercPercentage = shouldResizeLabel ? 32 : 36;
|
|
65
57
|
const labelPercPercentage = shouldResizeLabel ? 32 : 35;
|
|
66
|
-
|
|
58
|
+
const smallerLabelHeight = max(
|
|
67
59
|
roundUp(perc(buttonHeight, labelPercPercentage) + 5, 2),
|
|
68
60
|
12
|
|
69
61
|
);
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
if (shouldApplyRebrandedStyles) {
|
|
73
|
-
labelHeight = roundUp(perc(buttonHeight, 76));
|
|
74
|
-
// smallerLabelHeight gets triggered at widths < 320px
|
|
75
|
-
// We will need to investigate why the labels need to get significantly smaller at this breakpoint
|
|
76
|
-
smallerLabelHeight = labelHeight;
|
|
77
|
-
}
|
|
62
|
+
|
|
63
|
+
const labelHeight = max(roundUp(perc(buttonHeight, 35) + 5, 2), 12);
|
|
78
64
|
|
|
79
65
|
const pillBorderRadius = Math.ceil(buttonHeight / 2);
|
|
80
66
|
|
|
@@ -108,11 +108,9 @@ export type ButtonsComponent = ZoidComponent<
|
|
|
108
108
|
ButtonExtensions
|
|
109
109
|
>;
|
|
110
110
|
|
|
111
|
-
// $FlowIssue
|
|
112
111
|
export const getButtonsComponent: () => ButtonsComponent = memoize(() => {
|
|
113
112
|
const queriedEligibleFunding = [];
|
|
114
113
|
|
|
115
|
-
// $FlowIssue
|
|
116
114
|
return create({
|
|
117
115
|
tag: "paypal-buttons",
|
|
118
116
|
url: () => `${getPayPalDomain()}${__PAYPAL_CHECKOUT__.__URI__.__BUTTONS__}`,
|