@paypal/checkout-components 5.0.256 → 5.0.258
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/README.md +8 -0
- package/__sdk__.js +72 -76
- package/dist/button.js +1 -1
- package/globals.js +28 -30
- package/package.json +6 -4
- package/src/constants/button.js +37 -36
- package/src/constants/class.js +32 -30
- package/src/constants/index.js +3 -3
- package/src/constants/misc.js +14 -12
- package/src/declarations.js +19 -19
- package/src/funding/applepay/config.jsx +51 -50
- package/src/funding/applepay/index.js +1 -1
- package/src/funding/applepay/style.scoped.scss +1 -1
- package/src/funding/applepay/template.jsx +16 -11
- package/src/funding/bancontact/config.jsx +48 -37
- package/src/funding/bancontact/index.js +1 -2
- package/src/funding/blik/config.jsx +48 -37
- package/src/funding/blik/index.js +1 -2
- package/src/funding/boleto/config.jsx +50 -39
- package/src/funding/boleto/index.js +1 -2
- package/src/funding/card/amex/config.js +9 -8
- package/src/funding/card/amex/index.js +1 -2
- package/src/funding/card/config.jsx +246 -177
- package/src/funding/card/discover/config.js +9 -7
- package/src/funding/card/discover/index.js +1 -2
- package/src/funding/card/elo/config.js +6 -7
- package/src/funding/card/elo/index.js +1 -2
- package/src/funding/card/hiper/config.js +9 -7
- package/src/funding/card/hiper/index.js +1 -2
- package/src/funding/card/index.js +1 -1
- package/src/funding/card/jcb/config.js +6 -7
- package/src/funding/card/jcb/index.js +1 -2
- package/src/funding/card/mastercard/config.js +9 -7
- package/src/funding/card/mastercard/index.js +1 -2
- package/src/funding/card/visa/config.js +9 -7
- package/src/funding/card/visa/index.js +1 -2
- package/src/funding/common.jsx +242 -216
- package/src/funding/config.js +212 -65
- package/src/funding/content.jsx +1946 -337
- package/src/funding/credit/config.jsx +74 -57
- package/src/funding/credit/index.js +1 -2
- package/src/funding/eps/config.jsx +45 -37
- package/src/funding/eps/index.js +1 -2
- package/src/funding/funding.js +193 -100
- package/src/funding/giropay/config.jsx +48 -38
- package/src/funding/giropay/index.js +1 -2
- package/src/funding/ideal/config.jsx +48 -37
- package/src/funding/ideal/index.js +1 -2
- package/src/funding/index.js +2 -2
- package/src/funding/itau/config.jsx +41 -41
- package/src/funding/itau/index.js +1 -1
- package/src/funding/maxima/config.jsx +25 -19
- package/src/funding/maxima/index.js +1 -2
- package/src/funding/mercadopago/config.jsx +48 -37
- package/src/funding/mercadopago/index.js +1 -2
- package/src/funding/multibanco/config.jsx +50 -39
- package/src/funding/multibanco/index.js +1 -2
- package/src/funding/mybank/config.jsx +48 -37
- package/src/funding/mybank/index.js +1 -2
- package/src/funding/oxxo/config.jsx +50 -39
- package/src/funding/oxxo/index.js +1 -2
- package/src/funding/p24/config.jsx +45 -37
- package/src/funding/p24/index.js +1 -2
- package/src/funding/paidy/config.jsx +50 -39
- package/src/funding/paidy/index.js +1 -1
- package/src/funding/paylater/config.jsx +118 -111
- package/src/funding/paylater/index.js +1 -2
- package/src/funding/paypal/config.jsx +44 -46
- package/src/funding/paypal/index.js +1 -2
- package/src/funding/paypal/style.scoped.scss +80 -74
- package/src/funding/paypal/template.jsx +450 -354
- package/src/funding/payu/config.jsx +50 -39
- package/src/funding/payu/index.js +1 -1
- package/src/funding/satispay/config.jsx +50 -39
- package/src/funding/satispay/index.js +1 -1
- package/src/funding/sepa/config.jsx +19 -13
- package/src/funding/sepa/index.js +1 -2
- package/src/funding/sofort/config.jsx +48 -37
- package/src/funding/sofort/index.js +1 -2
- package/src/funding/trustly/config.jsx +50 -39
- package/src/funding/trustly/index.js +1 -2
- package/src/funding/venmo/config.jsx +80 -75
- package/src/funding/venmo/index.js +1 -2
- package/src/funding/venmo/style.scoped.scss +30 -32
- package/src/funding/venmo/template.jsx +56 -57
- package/src/funding/verkkopankki/config.jsx +50 -39
- package/src/funding/verkkopankki/index.js +1 -1
- package/src/funding/wechatpay/config.jsx +48 -37
- package/src/funding/wechatpay/index.js +1 -2
- package/src/funding/zimpler/config.jsx +19 -13
- package/src/funding/zimpler/index.js +1 -2
- package/src/interface/button.js +60 -44
- package/src/interface/card-fields.js +11 -8
- package/src/interface/fields.js +7 -4
- package/src/interface/marks.js +4 -4
- package/src/interface/payment-fields.js +7 -4
- package/src/interface/wallet.js +4 -4
- package/src/lib/errors.js +7 -7
- package/src/lib/index.js +5 -5
- package/src/lib/isRTLLanguage.js +3 -3
- package/src/lib/perceived-latency-instrumentation.js +54 -36
- package/src/lib/security.js +21 -17
- package/src/lib/session.js +39 -35
- package/src/marks/component.jsx +114 -65
- package/src/marks/index.js +1 -2
- package/src/marks/template.jsx +79 -65
- package/src/types.js +48 -48
- package/src/ui/buttons/button.jsx +311 -249
- package/src/ui/buttons/buttonDesigns/control.jsx +3 -5
- package/src/ui/buttons/buttonDesigns/divideLogoAnimation.jsx +127 -99
- package/src/ui/buttons/buttonDesigns/index.js +78 -75
- package/src/ui/buttons/buttonDesigns/inlineLogoTextDesign.jsx +102 -82
- package/src/ui/buttons/buttonDesigns/script.jsx +24 -18
- package/src/ui/buttons/buttonDesigns/types.js +6 -7
- package/src/ui/buttons/buttons.jsx +318 -212
- package/src/ui/buttons/config.js +62 -59
- package/src/ui/buttons/content.jsx +304 -119
- package/src/ui/buttons/index.js +1 -1
- package/src/ui/buttons/menu-button/index.js +1 -1
- package/src/ui/buttons/menu-button/menu-button.jsx +29 -22
- package/src/ui/buttons/menu-button/menu-button.scoped.scss +16 -17
- package/src/ui/buttons/poweredBy.jsx +23 -23
- package/src/ui/buttons/props.js +680 -529
- package/src/ui/buttons/script.jsx +182 -160
- package/src/ui/buttons/spinner.jsx +4 -6
- package/src/ui/buttons/style.jsx +15 -14
- package/src/ui/buttons/styles/base.js +24 -16
- package/src/ui/buttons/styles/button.js +24 -22
- package/src/ui/buttons/styles/color.js +118 -118
- package/src/ui/buttons/styles/custom.js +30 -24
- package/src/ui/buttons/styles/index.js +1 -1
- package/src/ui/buttons/styles/labels.js +17 -13
- package/src/ui/buttons/styles/page.js +3 -3
- package/src/ui/buttons/styles/responsive.js +226 -118
- package/src/ui/buttons/tagline.jsx +53 -54
- package/src/ui/chevron.jsx +27 -16
- package/src/ui/index.js +3 -3
- package/src/ui/loading.jsx +25 -18
- package/src/ui/text/index.js +1 -1
- package/src/ui/text/style.scoped.scss +25 -26
- package/src/ui/text/text.jsx +42 -20
- package/src/ui/tracking.jsx +18 -11
- package/src/zoid/buttons/component.jsx +836 -684
- package/src/zoid/buttons/container.jsx +140 -107
- package/src/zoid/buttons/index.js +1 -1
- package/src/zoid/buttons/prerender.jsx +84 -64
- package/src/zoid/buttons/util.js +355 -254
- package/src/zoid/card-fields/component.jsx +581 -549
- package/src/zoid/card-fields/index.js +1 -1
- package/src/zoid/card-fields/prerender.jsx +20 -17
- package/src/zoid/card-form/component.js +155 -141
- package/src/zoid/card-form/index.js +1 -1
- package/src/zoid/checkout/component.jsx +314 -282
- package/src/zoid/checkout/config.js +2 -2
- package/src/zoid/checkout/content.js +190 -154
- package/src/zoid/checkout/hacks.js +31 -28
- package/src/zoid/checkout/index.js +2 -2
- package/src/zoid/checkout/props.js +27 -33
- package/src/zoid/installments/component.jsx +83 -70
- package/src/zoid/installments/index.js +1 -1
- package/src/zoid/installments/props.js +1 -1
- package/src/zoid/menu/component.jsx +53 -48
- package/src/zoid/menu/index.js +1 -1
- package/src/zoid/menu/props.js +1 -3
- package/src/zoid/modal/component.jsx +119 -106
- package/src/zoid/modal/index.js +1 -1
- package/src/zoid/modal/props.js +1 -3
- package/src/zoid/payment-fields/component.jsx +215 -191
- package/src/zoid/payment-fields/container.jsx +73 -64
- package/src/zoid/payment-fields/index.js +1 -1
- package/src/zoid/payment-fields/prerender.jsx +16 -14
- package/src/zoid/payment-fields/props.js +6 -6
- package/src/zoid/qr-code/component.jsx +131 -115
- package/src/zoid/qr-code/container.jsx +74 -68
- package/src/zoid/qr-code/index.js +1 -1
- package/src/zoid/qr-code/prerender.jsx +17 -12
- package/src/zoid/qr-code/types.js +2 -2
- package/src/zoid/wallet/component.jsx +298 -260
- package/src/zoid/wallet/container.jsx +73 -64
- package/src/zoid/wallet/index.js +1 -1
- package/src/zoid/wallet/prerender.jsx +14 -14
- package/src/zoid/wallet/props.js +4 -4
- package/src/actions/save/index.js +0 -40
- package/src/interface/actions.js +0 -14
- package/src/lib/getLogoCDNExperiment.js +0 -25
|
@@ -1,11 +1,19 @@
|
|
|
1
1
|
/* @flow */
|
|
2
2
|
|
|
3
|
-
import { max, perc, roundUp } from
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
3
|
+
import { max, perc, roundUp } from "@krakenjs/belter/src";
|
|
4
|
+
import {
|
|
5
|
+
FUNDING,
|
|
6
|
+
type FundingEligibilityType,
|
|
7
|
+
} from "@paypal/sdk-constants/src";
|
|
8
|
+
|
|
9
|
+
import {
|
|
10
|
+
BUTTON_SHAPE,
|
|
11
|
+
BUTTON_LAYOUT,
|
|
12
|
+
BUTTON_NUMBER,
|
|
13
|
+
CLASS,
|
|
14
|
+
ATTRIBUTE,
|
|
15
|
+
} from "../../../constants";
|
|
16
|
+
import { BUTTON_SIZE_STYLE, BUTTON_RELATIVE_STYLE } from "../config";
|
|
9
17
|
|
|
10
18
|
const BUTTON_MIN_ASPECT_RATIO = 2.2;
|
|
11
19
|
const MIN_SPLIT_BUTTON_WIDTH = 300;
|
|
@@ -13,197 +21,297 @@ const MIN_SPLIT_BUTTON_WIDTH = 300;
|
|
|
13
21
|
const FIRST_BUTTON_PERC = 50;
|
|
14
22
|
const WALLET_BUTTON_PERC = 60;
|
|
15
23
|
|
|
16
|
-
export function buttonResponsiveStyle({
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
24
|
+
export function buttonResponsiveStyle({
|
|
25
|
+
height,
|
|
26
|
+
fundingEligibility,
|
|
27
|
+
}: {|
|
|
28
|
+
height?: ?number,
|
|
29
|
+
fundingEligibility: FundingEligibilityType,
|
|
30
|
+
|}): string {
|
|
31
|
+
return Object.keys(BUTTON_SIZE_STYLE)
|
|
32
|
+
.map((size) => {
|
|
33
|
+
const style = BUTTON_SIZE_STYLE[size];
|
|
34
|
+
const buttonHeight = height || style.defaultHeight;
|
|
35
|
+
const minDualWidth = Math.max(
|
|
36
|
+
Math.round(
|
|
37
|
+
buttonHeight * BUTTON_MIN_ASPECT_RATIO * (100 / WALLET_BUTTON_PERC)
|
|
38
|
+
),
|
|
39
|
+
MIN_SPLIT_BUTTON_WIDTH
|
|
40
|
+
);
|
|
41
|
+
|
|
42
|
+
const { paylater } = fundingEligibility;
|
|
43
|
+
const shouldResizeLabel =
|
|
44
|
+
paylater?.products?.paylater?.variant === "DE" ||
|
|
45
|
+
paylater?.products?.payIn3?.variant === "IT" ||
|
|
46
|
+
paylater?.products?.payIn3?.variant === "ES";
|
|
47
|
+
|
|
48
|
+
const textPercPercentage = shouldResizeLabel ? 32 : 36;
|
|
49
|
+
const labelPercPercentage = shouldResizeLabel ? 32 : 35;
|
|
50
|
+
const smallerLabelHeight = max(
|
|
51
|
+
roundUp(perc(buttonHeight, labelPercPercentage) + 5, 2),
|
|
52
|
+
12
|
|
53
|
+
);
|
|
54
|
+
|
|
55
|
+
const labelHeight = max(roundUp(perc(buttonHeight, 35) + 5, 2), 12);
|
|
56
|
+
|
|
57
|
+
return `
|
|
58
|
+
@media only screen and (min-width: ${style.minWidth}px) {
|
|
59
|
+
|
|
60
|
+
.${CLASS.CONTAINER} {
|
|
61
|
+
min-width: ${style.minWidth}px;
|
|
62
|
+
max-width: ${style.maxWidth}px;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
.${CLASS.CONTAINER} .${CLASS.BUTTON_ROW} .${CLASS.TEXT}, .${
|
|
66
|
+
CLASS.CONTAINER
|
|
67
|
+
} .${CLASS.BUTTON_ROW} .${CLASS.SPACE} {
|
|
68
|
+
font-size: ${max(perc(buttonHeight, 36), 10)}px;
|
|
69
|
+
margin-top: -${perc(max(perc(buttonHeight, 36), 10), 10)}px;
|
|
70
|
+
line-height: ${labelHeight}px;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
.${CLASS.CONTAINER} .${CLASS.BUTTON_ROW} .${CLASS.TEXT} * {
|
|
74
|
+
margin-top: ${perc(max(perc(buttonHeight, 36), 10), 10)}px;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
.${CLASS.BUTTON_ROW} {
|
|
78
|
+
height: ${buttonHeight}px;
|
|
56
79
|
vertical-align: top;
|
|
57
|
-
min-height: ${
|
|
58
|
-
max-height: ${
|
|
80
|
+
min-height: ${height || style.minHeight}px;
|
|
81
|
+
max-height: ${height || style.maxHeight}px;
|
|
59
82
|
}
|
|
60
83
|
|
|
61
|
-
.${
|
|
62
|
-
margin-bottom: ${
|
|
84
|
+
.${CLASS.BUTTON_ROW}.${CLASS.LAYOUT}-${BUTTON_LAYOUT.VERTICAL} {
|
|
85
|
+
margin-bottom: ${perc(
|
|
86
|
+
buttonHeight,
|
|
87
|
+
BUTTON_RELATIVE_STYLE.VERTICAL_MARGIN
|
|
88
|
+
)}px;
|
|
63
89
|
}
|
|
64
90
|
|
|
65
|
-
.${
|
|
91
|
+
.${CLASS.BUTTON_ROW}.${CLASS.LAYOUT}-${
|
|
92
|
+
BUTTON_LAYOUT.VERTICAL
|
|
93
|
+
}:last-of-type {
|
|
66
94
|
margin-bottom: 0;
|
|
67
95
|
}
|
|
68
96
|
|
|
69
|
-
.${
|
|
97
|
+
.${CLASS.BUTTON} {
|
|
70
98
|
display: inline-block;
|
|
71
99
|
text-align: center;
|
|
72
100
|
height: 100%;
|
|
73
101
|
}
|
|
74
102
|
|
|
75
|
-
.${
|
|
76
|
-
height: ${
|
|
77
|
-
width: ${
|
|
103
|
+
.${CLASS.BUTTON} .${CLASS.SPINNER} {
|
|
104
|
+
height: ${perc(buttonHeight, 50)}px;
|
|
105
|
+
width: ${perc(buttonHeight, 50)}px;
|
|
78
106
|
}
|
|
79
107
|
|
|
80
|
-
.${
|
|
108
|
+
.${CLASS.BUTTON} > .${CLASS.BUTTON_LABEL} {
|
|
81
109
|
margin: 0px 4vw;
|
|
82
|
-
height: ${
|
|
110
|
+
height: ${labelHeight}px;
|
|
83
111
|
}
|
|
84
112
|
|
|
85
|
-
.${
|
|
86
|
-
|
|
113
|
+
.${CLASS.BUTTON}[${ATTRIBUTE.FUNDING_SOURCE}=${
|
|
114
|
+
FUNDING.APPLEPAY
|
|
115
|
+
}] .${CLASS.BUTTON_LABEL} {
|
|
116
|
+
height: ${perc(buttonHeight, 80) + 5}px;
|
|
87
117
|
}
|
|
88
118
|
|
|
89
|
-
.${
|
|
90
|
-
|
|
119
|
+
.${CLASS.BUTTON}[${ATTRIBUTE.FUNDING_SOURCE}=${
|
|
120
|
+
FUNDING.APPLEPAY
|
|
121
|
+
}] .${CLASS.BUTTON_LABEL} .${CLASS.TEXT} {
|
|
122
|
+
line-height: ${perc(buttonHeight, 80) + 5}px;
|
|
91
123
|
}
|
|
92
124
|
|
|
93
|
-
.${
|
|
94
|
-
|
|
95
|
-
|
|
125
|
+
.${CLASS.BUTTON}[${ATTRIBUTE.FUNDING_SOURCE}=${FUNDING.EPS}] .${
|
|
126
|
+
CLASS.BUTTON_LABEL
|
|
127
|
+
},
|
|
128
|
+
.${CLASS.BUTTON}[${ATTRIBUTE.FUNDING_SOURCE}=${
|
|
129
|
+
FUNDING.MYBANK
|
|
130
|
+
}] .${CLASS.BUTTON_LABEL} {
|
|
131
|
+
height: ${perc(buttonHeight, 50) + 5}px;
|
|
96
132
|
}
|
|
97
133
|
|
|
98
|
-
.${
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
.${
|
|
102
|
-
|
|
134
|
+
.${CLASS.BUTTON}[${ATTRIBUTE.FUNDING_SOURCE}=${FUNDING.EPS}] .${
|
|
135
|
+
CLASS.BUTTON_LABEL
|
|
136
|
+
} .${CLASS.TEXT},
|
|
137
|
+
.${CLASS.BUTTON}[${ATTRIBUTE.FUNDING_SOURCE}=${FUNDING.EPS}] .${
|
|
138
|
+
CLASS.BUTTON_LABEL
|
|
139
|
+
} .${CLASS.SPACE},
|
|
140
|
+
.${CLASS.BUTTON}[${ATTRIBUTE.FUNDING_SOURCE}=${
|
|
141
|
+
FUNDING.MYBANK
|
|
142
|
+
}] .${CLASS.BUTTON_LABEL} .${CLASS.TEXT},
|
|
143
|
+
.${CLASS.BUTTON}[${ATTRIBUTE.FUNDING_SOURCE}=${
|
|
144
|
+
FUNDING.MYBANK
|
|
145
|
+
}] .${CLASS.BUTTON_LABEL} .${CLASS.SPACE} {
|
|
146
|
+
line-height: ${perc(buttonHeight, 50) + 5}px;
|
|
103
147
|
}
|
|
104
148
|
|
|
105
|
-
.${
|
|
149
|
+
.${CLASS.BUTTON}.${CLASS.SHAPE}-${BUTTON_SHAPE.RECT} {
|
|
106
150
|
border-radius: 4px;
|
|
107
151
|
}
|
|
108
152
|
|
|
109
|
-
.${
|
|
110
|
-
border-radius: ${
|
|
153
|
+
.${CLASS.BUTTON}.${CLASS.SHAPE}-${BUTTON_SHAPE.PILL} {
|
|
154
|
+
border-radius: ${Math.ceil(buttonHeight / 2)}px;
|
|
111
155
|
}
|
|
112
156
|
|
|
113
|
-
.${
|
|
157
|
+
.${CLASS.BUTTON_ROW}.${CLASS.SHAPE}-${
|
|
158
|
+
BUTTON_SHAPE.RECT
|
|
159
|
+
} .menu-button {
|
|
114
160
|
border-top-right-radius: 4px;
|
|
115
161
|
border-bottom-right-radius: 4px;
|
|
116
162
|
}
|
|
117
163
|
|
|
118
|
-
.${
|
|
119
|
-
|
|
120
|
-
|
|
164
|
+
.${CLASS.BUTTON_ROW}.${CLASS.SHAPE}-${
|
|
165
|
+
BUTTON_SHAPE.PILL
|
|
166
|
+
} .menu-button {
|
|
167
|
+
border-top-right-radius: ${Math.ceil(buttonHeight / 2)}px;
|
|
168
|
+
border-bottom-right-radius: ${Math.ceil(
|
|
169
|
+
buttonHeight / 2
|
|
170
|
+
)}px;
|
|
121
171
|
}
|
|
122
172
|
|
|
123
|
-
.${
|
|
124
|
-
height: ${
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
173
|
+
.${CLASS.TAGLINE} .${CLASS.TEXT} {
|
|
174
|
+
height: ${perc(
|
|
175
|
+
buttonHeight,
|
|
176
|
+
BUTTON_RELATIVE_STYLE.TAGLINE
|
|
177
|
+
)}px;
|
|
178
|
+
line-height: ${perc(
|
|
179
|
+
buttonHeight,
|
|
180
|
+
BUTTON_RELATIVE_STYLE.TAGLINE
|
|
181
|
+
)}px;
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
.${CLASS.CARD} {
|
|
129
185
|
display: inline-block;
|
|
130
186
|
height: 100%;
|
|
131
187
|
}
|
|
132
188
|
|
|
133
|
-
.${
|
|
134
|
-
|
|
189
|
+
.${CLASS.BUTTON_ROW}.${CLASS.WALLET}.${CLASS.WALLET_MENU} .${
|
|
190
|
+
CLASS.BUTTON
|
|
191
|
+
} {
|
|
192
|
+
width: calc(100% - ${buttonHeight + 2}px);
|
|
135
193
|
border-top-right-radius: 0px;
|
|
136
194
|
border-bottom-right-radius: 0px;
|
|
137
195
|
}
|
|
138
196
|
|
|
139
197
|
.menu-button {
|
|
140
|
-
height: ${
|
|
141
|
-
width: ${
|
|
198
|
+
height: ${buttonHeight}px;
|
|
199
|
+
width: ${buttonHeight}px;
|
|
142
200
|
}
|
|
143
201
|
}
|
|
144
202
|
|
|
145
|
-
@media only screen and (min-width: ${
|
|
203
|
+
@media only screen and (min-width: ${
|
|
204
|
+
style.minWidth
|
|
205
|
+
}px) and (max-width: 320px) {
|
|
146
206
|
|
|
147
|
-
.${
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
207
|
+
.${CLASS.CONTAINER} .${CLASS.BUTTON_ROW} .${CLASS.TEXT}, .${
|
|
208
|
+
CLASS.CONTAINER
|
|
209
|
+
} .${CLASS.BUTTON_ROW} .${CLASS.SPACE} {
|
|
210
|
+
font-size: ${max(
|
|
211
|
+
perc(buttonHeight, textPercPercentage),
|
|
212
|
+
10
|
|
213
|
+
)}px;
|
|
214
|
+
margin-top: -${perc(
|
|
215
|
+
max(perc(buttonHeight, textPercPercentage), 10),
|
|
216
|
+
10
|
|
217
|
+
)}px;
|
|
218
|
+
line-height: ${smallerLabelHeight}px;
|
|
151
219
|
}
|
|
152
220
|
|
|
153
221
|
|
|
154
|
-
.${
|
|
155
|
-
margin-top: ${
|
|
222
|
+
.${CLASS.CONTAINER} .${CLASS.BUTTON_ROW} .${CLASS.TEXT} * {
|
|
223
|
+
margin-top: ${perc(
|
|
224
|
+
max(perc(buttonHeight, textPercPercentage), 10),
|
|
225
|
+
10
|
|
226
|
+
)}px;
|
|
156
227
|
}
|
|
157
228
|
|
|
158
|
-
.${
|
|
229
|
+
.${CLASS.BUTTON} > .${CLASS.BUTTON_LABEL} {
|
|
159
230
|
margin: 0px 4vw;
|
|
160
|
-
height: ${
|
|
231
|
+
height: ${smallerLabelHeight}px;
|
|
161
232
|
}
|
|
162
233
|
}
|
|
163
234
|
|
|
164
|
-
@media only screen and (min-width: ${
|
|
235
|
+
@media only screen and (min-width: ${
|
|
236
|
+
style.minWidth
|
|
237
|
+
}px) and (max-width: ${minDualWidth}px) {
|
|
165
238
|
|
|
166
|
-
.${
|
|
239
|
+
.${CLASS.BUTTON_ROW}.${CLASS.LAYOUT}-${
|
|
240
|
+
BUTTON_LAYOUT.HORIZONTAL
|
|
241
|
+
}.${CLASS.NUMBER}-${BUTTON_NUMBER.MULTIPLE}.${CLASS.NUMBER}-0 {
|
|
167
242
|
width: 100%;
|
|
168
243
|
margin-right: 0;
|
|
169
244
|
}
|
|
170
245
|
|
|
171
|
-
.${
|
|
246
|
+
.${CLASS.BUTTON_ROW}.${CLASS.LAYOUT}-${
|
|
247
|
+
BUTTON_LAYOUT.HORIZONTAL
|
|
248
|
+
}.${CLASS.NUMBER}-${BUTTON_NUMBER.MULTIPLE}.${CLASS.NUMBER}-1 {
|
|
172
249
|
display: none;
|
|
173
250
|
}
|
|
174
251
|
|
|
175
|
-
.${
|
|
252
|
+
.${CLASS.CONTAINER}.${CLASS.LAYOUT}-${
|
|
253
|
+
BUTTON_LAYOUT.HORIZONTAL
|
|
254
|
+
}.${CLASS.NUMBER}-${BUTTON_NUMBER.MULTIPLE} .${CLASS.TAGLINE} {
|
|
176
255
|
display: none;
|
|
177
256
|
}
|
|
178
257
|
}
|
|
179
258
|
|
|
180
|
-
@media only screen and (min-width: ${
|
|
259
|
+
@media only screen and (min-width: ${max(
|
|
260
|
+
style.minWidth,
|
|
261
|
+
minDualWidth
|
|
262
|
+
)}px) {
|
|
181
263
|
|
|
182
|
-
.${
|
|
264
|
+
.${CLASS.BUTTON_ROW}.${CLASS.LAYOUT}-${
|
|
265
|
+
BUTTON_LAYOUT.HORIZONTAL
|
|
266
|
+
}.${CLASS.NUMBER}-${BUTTON_NUMBER.MULTIPLE}.${CLASS.NUMBER}-0 {
|
|
183
267
|
display: inline-block;
|
|
184
|
-
width: calc(${
|
|
185
|
-
|
|
268
|
+
width: calc(${FIRST_BUTTON_PERC}% - ${perc(
|
|
269
|
+
buttonHeight,
|
|
270
|
+
7
|
|
271
|
+
)}px);
|
|
272
|
+
margin-right: ${perc(buttonHeight, 7) * 2}px;
|
|
186
273
|
}
|
|
187
274
|
|
|
188
|
-
.${
|
|
275
|
+
.${CLASS.BUTTON_ROW}.${CLASS.LAYOUT}-${
|
|
276
|
+
BUTTON_LAYOUT.HORIZONTAL
|
|
277
|
+
}.${CLASS.NUMBER}-${BUTTON_NUMBER.MULTIPLE}.${CLASS.NUMBER}-1 {
|
|
189
278
|
display: inline-block;
|
|
190
|
-
width: calc(${
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
279
|
+
width: calc(${100 - FIRST_BUTTON_PERC}% - ${perc(
|
|
280
|
+
buttonHeight,
|
|
281
|
+
7
|
|
282
|
+
)}px);
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
.${CLASS.CONTAINER}.${CLASS.WALLET} .${CLASS.BUTTON_ROW}.${
|
|
286
|
+
CLASS.WALLET
|
|
287
|
+
}.${CLASS.LAYOUT}-${BUTTON_LAYOUT.HORIZONTAL}.${CLASS.NUMBER}-${
|
|
288
|
+
BUTTON_NUMBER.MULTIPLE
|
|
289
|
+
} {
|
|
290
|
+
width: calc(${WALLET_BUTTON_PERC}% - ${perc(
|
|
291
|
+
buttonHeight,
|
|
292
|
+
7
|
|
293
|
+
)}px);
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
.${CLASS.CONTAINER}.${CLASS.WALLET} .${CLASS.BUTTON_ROW}:not(.${
|
|
297
|
+
CLASS.WALLET
|
|
298
|
+
}).${CLASS.LAYOUT}-${BUTTON_LAYOUT.HORIZONTAL}.${CLASS.NUMBER}-${
|
|
299
|
+
BUTTON_NUMBER.MULTIPLE
|
|
300
|
+
} {
|
|
301
|
+
width: calc(${100 - WALLET_BUTTON_PERC}% - ${perc(
|
|
302
|
+
buttonHeight,
|
|
303
|
+
7
|
|
304
|
+
)}px);
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
.${CLASS.CONTAINER}.${CLASS.LAYOUT}-${
|
|
308
|
+
BUTTON_LAYOUT.HORIZONTAL
|
|
309
|
+
}.${CLASS.NUMBER}-${BUTTON_NUMBER.MULTIPLE} .${CLASS.TAGLINE} {
|
|
202
310
|
display: block;
|
|
203
311
|
}
|
|
204
312
|
}
|
|
205
313
|
|
|
206
314
|
`;
|
|
207
|
-
|
|
208
|
-
|
|
315
|
+
})
|
|
316
|
+
.join("\n");
|
|
209
317
|
}
|
|
@@ -1,58 +1,57 @@
|
|
|
1
1
|
/* @flow */
|
|
2
2
|
/** @jsx node */
|
|
3
3
|
|
|
4
|
-
import { FUNDING, type LocaleType } from
|
|
5
|
-
import { node, Fragment, type ElementNode } from
|
|
6
|
-
|
|
7
|
-
import { CLASS } from
|
|
8
|
-
import { getFundingConfig } from
|
|
9
|
-
import { TrackingBeacon } from
|
|
10
|
-
|
|
11
|
-
import { type ButtonStyle, type Personalization } from
|
|
12
|
-
|
|
13
|
-
export function TagLine({
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
);
|
|
4
|
+
import { FUNDING, type LocaleType } from "@paypal/sdk-constants/src";
|
|
5
|
+
import { node, Fragment, type ElementNode } from "@krakenjs/jsx-pragmatic/src";
|
|
6
|
+
|
|
7
|
+
import { CLASS } from "../../constants";
|
|
8
|
+
import { getFundingConfig } from "../../funding";
|
|
9
|
+
import { TrackingBeacon } from "../tracking";
|
|
10
|
+
|
|
11
|
+
import { type ButtonStyle, type Personalization } from "./props";
|
|
12
|
+
|
|
13
|
+
export function TagLine({
|
|
14
|
+
fundingSource,
|
|
15
|
+
locale,
|
|
16
|
+
multiple,
|
|
17
|
+
nonce,
|
|
18
|
+
personalization,
|
|
19
|
+
}: {|
|
|
20
|
+
fundingSource: $Values<typeof FUNDING>,
|
|
21
|
+
style: ButtonStyle,
|
|
22
|
+
locale: LocaleType,
|
|
23
|
+
multiple: boolean,
|
|
24
|
+
nonce: string,
|
|
25
|
+
personalization: ?Personalization,
|
|
26
|
+
|}): ?ElementNode {
|
|
27
|
+
const fundingConfig = getFundingConfig()[fundingSource];
|
|
28
|
+
|
|
29
|
+
if (!fundingConfig) {
|
|
30
|
+
throw new Error(`Can not get config for ${fundingSource}`);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
const { Tag } = fundingConfig;
|
|
34
|
+
|
|
35
|
+
if (!Tag) {
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
const tagline = personalization && personalization.tagline;
|
|
40
|
+
|
|
41
|
+
return (
|
|
42
|
+
<div class={CLASS.TAGLINE}>
|
|
43
|
+
{tagline ? (
|
|
44
|
+
<Fragment>
|
|
45
|
+
<span>
|
|
46
|
+
{tagline.Component ? <tagline.Component /> : tagline.text}
|
|
47
|
+
</span>
|
|
48
|
+
{tagline.tracking && tagline.tracking.impression && (
|
|
49
|
+
<TrackingBeacon url={tagline.tracking.impression} nonce={nonce} />
|
|
50
|
+
)}
|
|
51
|
+
</Fragment>
|
|
52
|
+
) : (
|
|
53
|
+
<Tag locale={locale} multiple={multiple} />
|
|
54
|
+
)}
|
|
55
|
+
</div>
|
|
56
|
+
);
|
|
58
57
|
}
|
package/src/ui/chevron.jsx
CHANGED
|
@@ -1,24 +1,35 @@
|
|
|
1
1
|
/* @flow */
|
|
2
2
|
/** @jsx node */
|
|
3
3
|
|
|
4
|
-
import { node, type ComponentNode } from
|
|
5
|
-
import { SVGLogo } from
|
|
4
|
+
import { node, type ComponentNode } from "@krakenjs/jsx-pragmatic/src";
|
|
5
|
+
import { SVGLogo } from "@paypal/sdk-logos/src/lib";
|
|
6
6
|
|
|
7
7
|
type ChevronProps = {|
|
|
8
|
-
|
|
8
|
+
color?: string,
|
|
9
9
|
|};
|
|
10
10
|
|
|
11
|
-
export function Chevron({
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
11
|
+
export function Chevron({
|
|
12
|
+
color = "#848484",
|
|
13
|
+
...props
|
|
14
|
+
}: ChevronProps = {}): ComponentNode<{||}> {
|
|
15
|
+
return (
|
|
16
|
+
<SVGLogo
|
|
17
|
+
{...props}
|
|
18
|
+
name="chevron"
|
|
19
|
+
render={() => (
|
|
20
|
+
<svg
|
|
21
|
+
width="256"
|
|
22
|
+
height="158.18601989746094"
|
|
23
|
+
viewBox="-1.935 0.221 256 158.186"
|
|
24
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
25
|
+
>
|
|
26
|
+
<polygon
|
|
27
|
+
points="223.878 0.221 126.065 98.034 28.252 0.221 -1.935 30.407 126.065 158.407 254.065 30.407"
|
|
28
|
+
transform="matrix(1, 0, 0, 1, 0, 0)"
|
|
29
|
+
fill={color}
|
|
30
|
+
/>
|
|
31
|
+
</svg>
|
|
32
|
+
)}
|
|
33
|
+
/>
|
|
34
|
+
);
|
|
23
35
|
}
|
|
24
|
-
|
package/src/ui/index.js
CHANGED