@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,419 +1,515 @@
|
|
|
1
1
|
/* @flow */
|
|
2
2
|
/** @jsx node */
|
|
3
3
|
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
import {
|
|
5
|
+
node,
|
|
6
|
+
Fragment,
|
|
7
|
+
Style,
|
|
8
|
+
type ChildType,
|
|
9
|
+
} from "@krakenjs/jsx-pragmatic/src";
|
|
10
|
+
import {
|
|
11
|
+
PPLogoExternalImage,
|
|
12
|
+
PPLogoInlineSVG,
|
|
13
|
+
PayPalLogoExternalImage,
|
|
14
|
+
PayPalLogoInlineSVG,
|
|
15
|
+
CreditLogoExternalImage,
|
|
16
|
+
CreditLogoInlineSVG,
|
|
17
|
+
CreditMarkExternalImage,
|
|
18
|
+
CreditMarkInlineSVG,
|
|
19
|
+
PayPalMarkExternalImage,
|
|
20
|
+
PayPalMarkInlineSVG,
|
|
21
|
+
GlyphCardExternalImage,
|
|
22
|
+
GlyphCardInlineSVG,
|
|
23
|
+
GlyphBankExternalImage,
|
|
24
|
+
GlyphBankInlineSVG,
|
|
25
|
+
LOGO_CLASS,
|
|
26
|
+
} from "@paypal/sdk-logos/src";
|
|
27
|
+
import { FUNDING, WALLET_INSTRUMENT } from "@paypal/sdk-constants/src";
|
|
7
28
|
|
|
8
29
|
import {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
} from
|
|
16
|
-
import { CLASS, ATTRIBUTE, BUTTON_LAYOUT } from
|
|
17
|
-
import { componentContent } from
|
|
18
|
-
import { Text, Space, PlaceHolder } from
|
|
19
|
-
import { TrackingBeacon } from
|
|
20
|
-
import {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
30
|
+
type LogoOptions,
|
|
31
|
+
type LabelOptions,
|
|
32
|
+
type DesignExperimentLabelOptions,
|
|
33
|
+
type WalletLabelOptions,
|
|
34
|
+
type TagOptions,
|
|
35
|
+
BasicLabel,
|
|
36
|
+
} from "../common";
|
|
37
|
+
import { CLASS, ATTRIBUTE, BUTTON_LAYOUT } from "../../constants";
|
|
38
|
+
import { componentContent } from "../content";
|
|
39
|
+
import { Text, Space, PlaceHolder } from "../../ui/text";
|
|
40
|
+
import { TrackingBeacon } from "../../ui/tracking";
|
|
41
|
+
import {
|
|
42
|
+
HIDDEN,
|
|
43
|
+
VISIBLE,
|
|
44
|
+
COMPRESSED,
|
|
45
|
+
EXPANDED,
|
|
46
|
+
} from "../../ui/buttons/styles/labels";
|
|
47
|
+
|
|
48
|
+
import css from "./style.scoped.scss";
|
|
49
|
+
|
|
50
|
+
export function Logo({ logoColor }: LogoOptions): ChildType {
|
|
51
|
+
return __WEB__ ? (
|
|
52
|
+
<PayPalLogoExternalImage logoColor={logoColor} />
|
|
53
|
+
) : (
|
|
54
|
+
<PayPalLogoInlineSVG logoColor={logoColor} />
|
|
55
|
+
);
|
|
27
56
|
}
|
|
28
57
|
|
|
29
|
-
function getPersonalizationText({
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
return
|
|
58
|
+
function getPersonalizationText({
|
|
59
|
+
personalization,
|
|
60
|
+
layout,
|
|
61
|
+
multiple,
|
|
62
|
+
}: LabelOptions): ?string {
|
|
63
|
+
const personalizationText =
|
|
64
|
+
personalization &&
|
|
65
|
+
personalization.buttonText &&
|
|
66
|
+
personalization.buttonText.text;
|
|
67
|
+
|
|
68
|
+
if (!personalizationText) {
|
|
69
|
+
return;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
if (personalizationText.match(/[{}]/)) {
|
|
73
|
+
return;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
if (layout === BUTTON_LAYOUT.HORIZONTAL && multiple) {
|
|
77
|
+
return;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
return personalizationText;
|
|
45
81
|
}
|
|
46
82
|
|
|
47
|
-
function getPersonalizationTracker({ personalization }
|
|
48
|
-
|
|
83
|
+
function getPersonalizationTracker({ personalization }: LabelOptions): ?string {
|
|
84
|
+
const personalizationTracker =
|
|
85
|
+
personalization &&
|
|
86
|
+
personalization.buttonText &&
|
|
87
|
+
personalization.buttonText.tracking &&
|
|
88
|
+
personalization.buttonText.tracking.impression;
|
|
49
89
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
90
|
+
if (!personalizationTracker) {
|
|
91
|
+
return;
|
|
92
|
+
}
|
|
53
93
|
|
|
54
|
-
|
|
94
|
+
return personalizationTracker;
|
|
55
95
|
}
|
|
56
96
|
|
|
57
|
-
function getButtonPersonalizationStyle(opts
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
97
|
+
function getButtonPersonalizationStyle(opts: LabelOptions): ?ChildType {
|
|
98
|
+
if (__TEST__) {
|
|
99
|
+
return null;
|
|
100
|
+
}
|
|
61
101
|
|
|
62
|
-
|
|
102
|
+
const { tagline } = opts;
|
|
63
103
|
|
|
64
|
-
|
|
104
|
+
const personalizationText = !tagline && getPersonalizationText(opts);
|
|
65
105
|
|
|
66
|
-
|
|
67
|
-
|
|
106
|
+
const MIN_WIDTH = 300;
|
|
107
|
+
const PERSONALIZATION_DURATION = 5;
|
|
68
108
|
|
|
69
|
-
|
|
109
|
+
const PAYPAL_BUTTON = `.${CLASS.BUTTON}[${ATTRIBUTE.FUNDING_SOURCE}=${FUNDING.PAYPAL}]`;
|
|
70
110
|
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
111
|
+
return (
|
|
112
|
+
<style
|
|
113
|
+
innerHTML={`
|
|
114
|
+
@media only screen and (max-width: ${MIN_WIDTH}px) {
|
|
115
|
+
.${CLASS.DOM_READY} ${PAYPAL_BUTTON} .${
|
|
116
|
+
CLASS.PERSONALIZATION_TEXT
|
|
117
|
+
} {
|
|
118
|
+
${HIDDEN}
|
|
76
119
|
}
|
|
77
120
|
}
|
|
78
121
|
|
|
79
|
-
@media only screen and (min-width: ${
|
|
80
|
-
.${
|
|
81
|
-
|
|
122
|
+
@media only screen and (min-width: ${MIN_WIDTH}px) {
|
|
123
|
+
.${CLASS.DOM_READY} ${PAYPAL_BUTTON} .${LOGO_CLASS.LOGO}.${
|
|
124
|
+
LOGO_CLASS.LOGO
|
|
125
|
+
}-${FUNDING.PAYPAL} {
|
|
126
|
+
animation: ${
|
|
127
|
+
personalizationText
|
|
128
|
+
? `toggle-paypal-logo ${PERSONALIZATION_DURATION}s 0s forwards`
|
|
129
|
+
: `none`
|
|
130
|
+
};
|
|
82
131
|
}
|
|
83
132
|
|
|
84
|
-
.${
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
133
|
+
.${CLASS.DOM_READY} ${PAYPAL_BUTTON} .${CLASS.TEXT}:not(.${
|
|
134
|
+
CLASS.PERSONALIZATION_TEXT
|
|
135
|
+
}):not(.${CLASS.HIDDEN}) {
|
|
136
|
+
${COMPRESSED}
|
|
137
|
+
${VISIBLE}
|
|
138
|
+
animation: ${
|
|
139
|
+
personalizationText
|
|
140
|
+
? `show-text-delayed ${PERSONALIZATION_DURATION}s 0s forwards`
|
|
141
|
+
: `show-text 1s 0s forwards`
|
|
142
|
+
};
|
|
88
143
|
}
|
|
89
144
|
|
|
90
|
-
.${
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
145
|
+
.${CLASS.DOM_READY} ${PAYPAL_BUTTON} .${
|
|
146
|
+
CLASS.PERSONALIZATION_TEXT
|
|
147
|
+
} {
|
|
148
|
+
${COMPRESSED}
|
|
149
|
+
${VISIBLE}
|
|
150
|
+
animation: show-personalization-text ${PERSONALIZATION_DURATION}s 0s forwards;
|
|
94
151
|
}
|
|
95
152
|
}
|
|
96
153
|
|
|
97
154
|
@keyframes toggle-paypal-logo {
|
|
98
|
-
0% { ${
|
|
99
|
-
15% { ${
|
|
100
|
-
85% { ${
|
|
101
|
-
100% { ${
|
|
155
|
+
0% { ${EXPANDED} }
|
|
156
|
+
15% { ${COMPRESSED} }
|
|
157
|
+
85% { ${COMPRESSED} }
|
|
158
|
+
100% { ${EXPANDED} }
|
|
102
159
|
}
|
|
103
160
|
|
|
104
161
|
@keyframes show-text-delayed {
|
|
105
|
-
0% { ${
|
|
106
|
-
85% { ${
|
|
107
|
-
100% { ${
|
|
162
|
+
0% { ${COMPRESSED} }
|
|
163
|
+
85% { ${COMPRESSED} }
|
|
164
|
+
100% { ${EXPANDED} }
|
|
108
165
|
}
|
|
109
166
|
|
|
110
167
|
@keyframes show-personalization-text {
|
|
111
|
-
0% { ${
|
|
112
|
-
15% { ${
|
|
113
|
-
25% { ${
|
|
114
|
-
70% { ${
|
|
115
|
-
85% { ${
|
|
116
|
-
100% { ${
|
|
168
|
+
0% { ${COMPRESSED} }
|
|
169
|
+
15% { ${COMPRESSED} }
|
|
170
|
+
25% { ${EXPANDED} }
|
|
171
|
+
70% { ${EXPANDED} }
|
|
172
|
+
85% { ${COMPRESSED} }
|
|
173
|
+
100% { ${COMPRESSED} }
|
|
117
174
|
}
|
|
118
|
-
`
|
|
119
|
-
|
|
175
|
+
`}
|
|
176
|
+
/>
|
|
177
|
+
);
|
|
120
178
|
}
|
|
121
179
|
|
|
122
|
-
function ButtonPersonalization(opts
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
);
|
|
180
|
+
function ButtonPersonalization(opts: LabelOptions): ?ChildType {
|
|
181
|
+
if (__WEB__) {
|
|
182
|
+
return;
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
const { nonce, tagline, label } = opts;
|
|
186
|
+
|
|
187
|
+
if (tagline || !label) {
|
|
188
|
+
return;
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
const personalizationText = getPersonalizationText(opts);
|
|
192
|
+
const personalizationTracker = getPersonalizationTracker(opts);
|
|
193
|
+
|
|
194
|
+
if (!personalizationText) {
|
|
195
|
+
return;
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
return (
|
|
199
|
+
<Fragment>
|
|
200
|
+
<Text className={[CLASS.PERSONALIZATION_TEXT]} optional={2}>
|
|
201
|
+
{personalizationText}
|
|
202
|
+
</Text>
|
|
203
|
+
{personalizationTracker && (
|
|
204
|
+
<TrackingBeacon url={personalizationTracker} nonce={nonce} />
|
|
205
|
+
)}
|
|
206
|
+
{getButtonPersonalizationStyle(opts)}
|
|
207
|
+
</Fragment>
|
|
208
|
+
);
|
|
153
209
|
}
|
|
154
210
|
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
);
|
|
211
|
+
export function Label(opts: LabelOptions): ChildType {
|
|
212
|
+
return (
|
|
213
|
+
<Fragment>
|
|
214
|
+
<BasicLabel {...opts} />
|
|
215
|
+
<ButtonPersonalization {...opts} />
|
|
216
|
+
</Fragment>
|
|
217
|
+
);
|
|
163
218
|
}
|
|
164
219
|
|
|
165
|
-
export function DesignExperimentLabel(
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
220
|
+
export function DesignExperimentLabel(
|
|
221
|
+
opts: DesignExperimentLabelOptions
|
|
222
|
+
): ChildType {
|
|
223
|
+
const { buttonDesignComponent, ...updatedOpts } = opts;
|
|
224
|
+
const basicLabel = <BasicLabel {...updatedOpts} />;
|
|
225
|
+
const buttonPersonalization = <ButtonPersonalization {...updatedOpts} />;
|
|
226
|
+
return (
|
|
227
|
+
<Fragment>
|
|
228
|
+
{basicLabel}
|
|
229
|
+
{buttonDesignComponent}
|
|
230
|
+
{buttonPersonalization}
|
|
231
|
+
</Fragment>
|
|
232
|
+
);
|
|
176
233
|
}
|
|
177
234
|
|
|
178
|
-
export function WalletLabelOld(opts
|
|
179
|
-
|
|
235
|
+
export function WalletLabelOld(opts: WalletLabelOptions): ?ChildType {
|
|
236
|
+
const { logoColor, instrument, locale, content, commit } = opts;
|
|
180
237
|
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
238
|
+
if (__WEB__) {
|
|
239
|
+
return;
|
|
240
|
+
}
|
|
184
241
|
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
242
|
+
if (!instrument) {
|
|
243
|
+
throw new Error(`Expected instrument`);
|
|
244
|
+
}
|
|
188
245
|
|
|
189
|
-
|
|
246
|
+
let logo;
|
|
190
247
|
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
logo = enableLogoCDNExperiment(CreditLogo, { locale, logoColor });
|
|
199
|
-
}
|
|
200
|
-
|
|
201
|
-
return (
|
|
202
|
-
<Style css={ css }>
|
|
203
|
-
<div class='wallet-label'>
|
|
204
|
-
<div class='paypal-mark'>
|
|
205
|
-
{enableLogoCDNExperiment(PPLogo ,{ logoColor })}
|
|
206
|
-
</div>
|
|
207
|
-
{
|
|
208
|
-
(instrument.oneClick && commit && content) &&
|
|
209
|
-
<div class='pay-label'>
|
|
210
|
-
<Space />
|
|
211
|
-
<Text>{ content.payNow }</Text>
|
|
212
|
-
</div>
|
|
213
|
-
}
|
|
214
|
-
<div class='paypal-wordmark'>
|
|
215
|
-
<Space />
|
|
216
|
-
{enableLogoCDNExperiment(PayPalLogo ,{ logoColor })}
|
|
217
|
-
</div>
|
|
218
|
-
<div class='divider'>|</div>
|
|
219
|
-
{
|
|
220
|
-
logo &&
|
|
221
|
-
<div class='logo' optional>
|
|
222
|
-
{ logo }
|
|
223
|
-
<Space />
|
|
224
|
-
</div>
|
|
225
|
-
}
|
|
226
|
-
<div class='label'>
|
|
227
|
-
<Text className={ [ 'limit' ] }>
|
|
228
|
-
{ instrument.label }
|
|
229
|
-
</Text>
|
|
230
|
-
</div>
|
|
231
|
-
</div>
|
|
232
|
-
</Style>
|
|
248
|
+
if (instrument.logoUrl) {
|
|
249
|
+
logo = <img class="card-art" src={instrument.logoUrl} />;
|
|
250
|
+
} else if (instrument.type === WALLET_INSTRUMENT.CARD) {
|
|
251
|
+
logo = __WEB__ ? (
|
|
252
|
+
<GlyphCardExternalImage logoColor={logoColor} />
|
|
253
|
+
) : (
|
|
254
|
+
<GlyphCardInlineSVG logoColor={logoColor} />
|
|
233
255
|
);
|
|
234
|
-
}
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
return (
|
|
240
|
-
<div class='show-pay-label'>
|
|
241
|
-
<div class='pay-label' optional={ 2 }>
|
|
242
|
-
<Space />
|
|
243
|
-
{
|
|
244
|
-
(instrument && content)
|
|
245
|
-
? <Text>{ payNow ? content.payNow : content.payWith }</Text>
|
|
246
|
-
: <Text><PlaceHolder chars={ 7 } color={ textColor } /></Text>
|
|
247
|
-
}
|
|
248
|
-
<Space />
|
|
249
|
-
</div>
|
|
250
|
-
<div class='logo' optional={ 1 }>
|
|
251
|
-
{
|
|
252
|
-
(instrument && logo)
|
|
253
|
-
? logo
|
|
254
|
-
: <Text><PlaceHolder chars={ 4 } color={ textColor } /></Text>
|
|
255
|
-
}
|
|
256
|
-
</div>
|
|
257
|
-
<div class='label'>
|
|
258
|
-
<Space />
|
|
259
|
-
{
|
|
260
|
-
(instrument && label)
|
|
261
|
-
? <Text>{ label }</Text>
|
|
262
|
-
: <Text><PlaceHolder chars={ 6 } color={ textColor } /></Text>
|
|
263
|
-
}
|
|
264
|
-
</div>
|
|
265
|
-
</div>
|
|
256
|
+
} else if (instrument.type === WALLET_INSTRUMENT.BANK) {
|
|
257
|
+
logo = __WEB__ ? (
|
|
258
|
+
<GlyphBankExternalImage logoColor={logoColor} />
|
|
259
|
+
) : (
|
|
260
|
+
<GlyphBankInlineSVG logoColor={logoColor} />
|
|
266
261
|
);
|
|
267
|
-
}
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
return (
|
|
273
|
-
<div class='show-instruments-on-file'>
|
|
274
|
-
{
|
|
275
|
-
instrument?.secondaryInstruments?.[0]
|
|
276
|
-
? (
|
|
277
|
-
<div class='balance'>
|
|
278
|
-
<Text>{ content?.balance } &</Text>
|
|
279
|
-
<Space />
|
|
280
|
-
</div>
|
|
281
|
-
)
|
|
282
|
-
: null
|
|
283
|
-
}
|
|
284
|
-
{
|
|
285
|
-
(instrument?.type === "balance")
|
|
286
|
-
? (
|
|
287
|
-
<div class='paypal-balance'>
|
|
288
|
-
<Text>{ content?.payPalBalance }</Text>
|
|
289
|
-
</div>
|
|
290
|
-
)
|
|
291
|
-
: (
|
|
292
|
-
<div class='fi-container'>
|
|
293
|
-
<div class='fi-logo'>
|
|
294
|
-
{
|
|
295
|
-
(instrument && logo)
|
|
296
|
-
? logo
|
|
297
|
-
: <Text><PlaceHolder chars={ 4 } color={ textColor } /></Text>
|
|
298
|
-
}
|
|
299
|
-
</div>
|
|
300
|
-
<div class='fi-label'>
|
|
301
|
-
<Space />
|
|
302
|
-
{
|
|
303
|
-
(instrument && label)
|
|
304
|
-
? <Text>{ label }</Text>
|
|
305
|
-
: <Text><PlaceHolder chars={ 6 } color={ textColor } /></Text>
|
|
306
|
-
}
|
|
307
|
-
</div>
|
|
308
|
-
</div>
|
|
309
|
-
)
|
|
310
|
-
}
|
|
311
|
-
</div>
|
|
262
|
+
} else if (instrument.type === WALLET_INSTRUMENT.CREDIT) {
|
|
263
|
+
logo = __WEB__ ? (
|
|
264
|
+
<CreditLogoExternalImage locale={locale} logoColor={logoColor} />
|
|
265
|
+
) : (
|
|
266
|
+
<CreditLogoInlineSVG locale={locale} logoColor={logoColor} />
|
|
312
267
|
);
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
return (
|
|
271
|
+
<Style css={css}>
|
|
272
|
+
<div class="wallet-label">
|
|
273
|
+
<div class="paypal-mark">
|
|
274
|
+
{__WEB__ ? (
|
|
275
|
+
<PPLogoExternalImage logoColor={logoColor} />
|
|
276
|
+
) : (
|
|
277
|
+
<PPLogoInlineSVG logoColor={logoColor} />
|
|
278
|
+
)}
|
|
279
|
+
</div>
|
|
280
|
+
{instrument.oneClick && commit && content && (
|
|
281
|
+
<div class="pay-label">
|
|
282
|
+
<Space />
|
|
283
|
+
<Text>{content.payNow}</Text>
|
|
284
|
+
</div>
|
|
285
|
+
)}
|
|
286
|
+
<div class="paypal-wordmark">
|
|
287
|
+
<Space />
|
|
288
|
+
{__WEB__ ? (
|
|
289
|
+
<PayPalLogoExternalImage logoColor={logoColor} />
|
|
290
|
+
) : (
|
|
291
|
+
<PayPalLogoInlineSVG logoColor={logoColor} />
|
|
292
|
+
)}
|
|
293
|
+
</div>
|
|
294
|
+
<div class="divider">|</div>
|
|
295
|
+
{logo && (
|
|
296
|
+
<div class="logo" optional>
|
|
297
|
+
{logo}
|
|
298
|
+
<Space />
|
|
299
|
+
</div>
|
|
300
|
+
)}
|
|
301
|
+
<div class="label">
|
|
302
|
+
<Text className={["limit"]}>{instrument.label}</Text>
|
|
303
|
+
</div>
|
|
304
|
+
</div>
|
|
305
|
+
</Style>
|
|
306
|
+
);
|
|
313
307
|
}
|
|
314
308
|
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
309
|
+
function ShowPayLabel(opts): ?ChildType {
|
|
310
|
+
const { instrument, content, payNow, textColor, logo, label } = opts;
|
|
311
|
+
|
|
312
|
+
return (
|
|
313
|
+
<div class="show-pay-label">
|
|
314
|
+
<div class="pay-label" optional={2}>
|
|
315
|
+
<Space />
|
|
316
|
+
{instrument && content ? (
|
|
317
|
+
<Text>{payNow ? content.payNow : content.payWith}</Text>
|
|
318
|
+
) : (
|
|
319
|
+
<Text>
|
|
320
|
+
<PlaceHolder chars={7} color={textColor} />
|
|
321
|
+
</Text>
|
|
322
|
+
)}
|
|
323
|
+
<Space />
|
|
324
|
+
</div>
|
|
325
|
+
<div class="logo" optional={1}>
|
|
326
|
+
{instrument && logo ? (
|
|
327
|
+
logo
|
|
328
|
+
) : (
|
|
329
|
+
<Text>
|
|
330
|
+
<PlaceHolder chars={4} color={textColor} />
|
|
331
|
+
</Text>
|
|
332
|
+
)}
|
|
333
|
+
</div>
|
|
334
|
+
<div class="label">
|
|
335
|
+
<Space />
|
|
336
|
+
{instrument && label ? (
|
|
337
|
+
<Text>{label}</Text>
|
|
338
|
+
) : (
|
|
339
|
+
<Text>
|
|
340
|
+
<PlaceHolder chars={6} color={textColor} />
|
|
341
|
+
</Text>
|
|
342
|
+
)}
|
|
343
|
+
</div>
|
|
344
|
+
</div>
|
|
345
|
+
);
|
|
346
|
+
}
|
|
353
347
|
|
|
354
|
-
|
|
348
|
+
function ShowInstrumentsOnFile(opts): ?ChildType {
|
|
349
|
+
const { instrument, textColor, logo, label, content } = opts;
|
|
355
350
|
|
|
356
|
-
|
|
357
|
-
|
|
351
|
+
return (
|
|
352
|
+
<div class="show-instruments-on-file">
|
|
353
|
+
{instrument?.secondaryInstruments?.[0] ? (
|
|
354
|
+
<div class="balance">
|
|
355
|
+
<Text>{content?.balance} &</Text>
|
|
356
|
+
<Space />
|
|
357
|
+
</div>
|
|
358
|
+
) : null}
|
|
359
|
+
{instrument?.type === "balance" ? (
|
|
360
|
+
<div class="paypal-balance">
|
|
361
|
+
<Text>{content?.payPalBalance}</Text>
|
|
362
|
+
</div>
|
|
363
|
+
) : (
|
|
364
|
+
<div class="fi-container">
|
|
365
|
+
<div class="fi-logo">
|
|
366
|
+
{instrument && logo ? (
|
|
367
|
+
logo
|
|
368
|
+
) : (
|
|
369
|
+
<Text>
|
|
370
|
+
<PlaceHolder chars={4} color={textColor} />
|
|
371
|
+
</Text>
|
|
372
|
+
)}
|
|
373
|
+
</div>
|
|
374
|
+
<div class="fi-label">
|
|
375
|
+
<Space />
|
|
376
|
+
{instrument && label ? (
|
|
377
|
+
<Text>{label}</Text>
|
|
378
|
+
) : (
|
|
379
|
+
<Text>
|
|
380
|
+
<PlaceHolder chars={6} color={textColor} />
|
|
381
|
+
</Text>
|
|
382
|
+
)}
|
|
383
|
+
</div>
|
|
384
|
+
</div>
|
|
385
|
+
)}
|
|
386
|
+
</div>
|
|
387
|
+
);
|
|
388
|
+
}
|
|
358
389
|
|
|
359
|
-
|
|
390
|
+
export function WalletLabel(opts: WalletLabelOptions): ?ChildType {
|
|
391
|
+
const {
|
|
392
|
+
logoColor,
|
|
393
|
+
instrument,
|
|
394
|
+
content,
|
|
395
|
+
commit,
|
|
396
|
+
vault,
|
|
397
|
+
textColor,
|
|
398
|
+
fundingSource,
|
|
399
|
+
showPayLabel,
|
|
400
|
+
} = opts;
|
|
401
|
+
|
|
402
|
+
if (instrument && !instrument.type) {
|
|
403
|
+
return WalletLabelOld(opts);
|
|
404
|
+
}
|
|
405
|
+
|
|
406
|
+
let logo;
|
|
407
|
+
let label;
|
|
408
|
+
let branded;
|
|
409
|
+
|
|
410
|
+
if (instrument && typeof instrument.branded === "boolean") {
|
|
411
|
+
branded = instrument.branded;
|
|
412
|
+
} else if (
|
|
413
|
+
fundingSource === FUNDING.PAYPAL ||
|
|
414
|
+
fundingSource === FUNDING.CREDIT
|
|
415
|
+
) {
|
|
416
|
+
branded = true;
|
|
417
|
+
} else if (fundingSource === FUNDING.CARD) {
|
|
418
|
+
branded = false;
|
|
419
|
+
} else {
|
|
420
|
+
branded = true;
|
|
421
|
+
}
|
|
422
|
+
|
|
423
|
+
if (instrument) {
|
|
424
|
+
const cardSVG = __WEB__ ? (
|
|
425
|
+
<GlyphCardExternalImage logoColor={logoColor} />
|
|
426
|
+
) : (
|
|
427
|
+
<GlyphCardInlineSVG logoColor={logoColor} />
|
|
428
|
+
);
|
|
429
|
+
const bankSVG = __WEB__ ? (
|
|
430
|
+
<GlyphBankExternalImage logoColor={logoColor} />
|
|
431
|
+
) : (
|
|
432
|
+
<GlyphBankInlineSVG logoColor={logoColor} />
|
|
433
|
+
);
|
|
360
434
|
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
}
|
|
364
|
-
|
|
435
|
+
if (instrument.type === WALLET_INSTRUMENT.CARD && instrument.label) {
|
|
436
|
+
logo = instrument.logoUrl ? (
|
|
437
|
+
<img class="card-art" src={instrument.logoUrl} />
|
|
438
|
+
) : (
|
|
439
|
+
cardSVG
|
|
440
|
+
);
|
|
441
|
+
|
|
442
|
+
label = instrument.label.replace("••••", "••");
|
|
443
|
+
} else if (instrument.type === WALLET_INSTRUMENT.BANK && instrument.label) {
|
|
444
|
+
logo = instrument.logoUrl ? (
|
|
445
|
+
<img class="card-art" src={instrument.logoUrl} />
|
|
446
|
+
) : (
|
|
447
|
+
bankSVG
|
|
448
|
+
);
|
|
449
|
+
|
|
450
|
+
label = instrument.label.replace("••••", "••");
|
|
451
|
+
} else if (instrument.type === WALLET_INSTRUMENT.CREDIT) {
|
|
452
|
+
logo = __WEB__ ? <CreditMarkExternalImage /> : <CreditMarkInlineSVG />;
|
|
365
453
|
|
|
366
|
-
|
|
454
|
+
label = content && content.credit;
|
|
455
|
+
} else if (instrument.type === WALLET_INSTRUMENT.BALANCE) {
|
|
456
|
+
logo = __WEB__ ? <PayPalMarkExternalImage /> : <PayPalMarkInlineSVG />;
|
|
367
457
|
|
|
368
|
-
|
|
369
|
-
if (
|
|
370
|
-
|
|
458
|
+
label = content && content.balance;
|
|
459
|
+
} else if (instrument.label) {
|
|
460
|
+
label = instrument.label;
|
|
371
461
|
}
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
462
|
+
}
|
|
463
|
+
|
|
464
|
+
const payNow = Boolean(instrument && instrument.oneClick && commit && !vault);
|
|
465
|
+
|
|
466
|
+
const attrs = {};
|
|
467
|
+
if (payNow) {
|
|
468
|
+
attrs[ATTRIBUTE.PAY_NOW] = true;
|
|
469
|
+
}
|
|
470
|
+
|
|
471
|
+
return (
|
|
472
|
+
<Style css={css}>
|
|
473
|
+
<div class="wallet-label-new" {...attrs}>
|
|
474
|
+
{branded ? (
|
|
475
|
+
<div class="paypal-mark">
|
|
476
|
+
{__WEB__ ? (
|
|
477
|
+
<PPLogoExternalImage logoColor={logoColor} />
|
|
478
|
+
) : (
|
|
479
|
+
<PPLogoInlineSVG logoColor={logoColor} />
|
|
480
|
+
)}
|
|
481
|
+
<Space />
|
|
482
|
+
</div>
|
|
483
|
+
) : null}
|
|
484
|
+
{showPayLabel ? (
|
|
485
|
+
<ShowPayLabel
|
|
486
|
+
instrument={instrument}
|
|
487
|
+
content={content}
|
|
488
|
+
payNow={payNow}
|
|
489
|
+
textColor={textColor}
|
|
490
|
+
logo={logo}
|
|
491
|
+
label={label}
|
|
492
|
+
/>
|
|
493
|
+
) : (
|
|
494
|
+
<ShowInstrumentsOnFile
|
|
495
|
+
instrument={instrument}
|
|
496
|
+
textColor={textColor}
|
|
497
|
+
logo={logo}
|
|
498
|
+
label={label}
|
|
499
|
+
content={content}
|
|
500
|
+
/>
|
|
501
|
+
)}
|
|
502
|
+
</div>
|
|
503
|
+
</Style>
|
|
504
|
+
);
|
|
407
505
|
}
|
|
408
506
|
|
|
409
|
-
export function Tag({ multiple, locale: { lang } }
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
507
|
+
export function Tag({ multiple, locale: { lang } }: TagOptions): ?ChildType {
|
|
508
|
+
if (__WEB__) {
|
|
509
|
+
return null;
|
|
510
|
+
}
|
|
413
511
|
|
|
414
|
-
|
|
512
|
+
const { DualTag, SaferTag } = componentContent[lang];
|
|
415
513
|
|
|
416
|
-
|
|
417
|
-
? <DualTag optional />
|
|
418
|
-
: <SaferTag optional />;
|
|
514
|
+
return multiple && DualTag ? <DualTag optional /> : <SaferTag optional />;
|
|
419
515
|
}
|