@paypal/checkout-components 5.0.256-alpha.1 → 5.0.257
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 +76 -76
- package/dist/button.js +1 -1
- package/globals.js +28 -30
- package/package.json +7 -5
- package/src/actions/save/index.js +17 -12
- package/src/constants/button.js +36 -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 -49
- package/src/funding/applepay/index.js +1 -1
- package/src/funding/applepay/style.scoped.scss +1 -1
- package/src/funding/applepay/template.jsx +16 -9
- package/src/funding/bancontact/config.jsx +48 -36
- package/src/funding/bancontact/index.js +1 -2
- package/src/funding/blik/config.jsx +48 -36
- package/src/funding/blik/index.js +1 -2
- package/src/funding/boleto/config.jsx +50 -38
- package/src/funding/boleto/index.js +1 -2
- package/src/funding/card/amex/config.js +9 -7
- package/src/funding/card/amex/index.js +1 -2
- package/src/funding/card/config.jsx +246 -178
- package/src/funding/card/discover/config.js +9 -6
- package/src/funding/card/discover/index.js +1 -2
- package/src/funding/card/elo/config.js +6 -6
- package/src/funding/card/elo/index.js +1 -2
- package/src/funding/card/hiper/config.js +9 -6
- 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 -6
- package/src/funding/card/jcb/index.js +1 -2
- package/src/funding/card/mastercard/config.js +9 -6
- package/src/funding/card/mastercard/index.js +1 -2
- package/src/funding/card/visa/config.js +9 -6
- 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 -54
- package/src/funding/credit/index.js +1 -2
- package/src/funding/eps/config.jsx +45 -36
- package/src/funding/eps/index.js +1 -2
- package/src/funding/funding.js +193 -100
- package/src/funding/giropay/config.jsx +48 -37
- package/src/funding/giropay/index.js +1 -2
- package/src/funding/ideal/config.jsx +48 -36
- package/src/funding/ideal/index.js +1 -2
- package/src/funding/index.js +2 -2
- package/src/funding/itau/config.jsx +41 -40
- package/src/funding/itau/index.js +1 -1
- package/src/funding/maxima/config.jsx +25 -18
- package/src/funding/maxima/index.js +1 -2
- package/src/funding/mercadopago/config.jsx +48 -36
- package/src/funding/mercadopago/index.js +1 -2
- package/src/funding/multibanco/config.jsx +50 -38
- package/src/funding/multibanco/index.js +1 -2
- package/src/funding/mybank/config.jsx +48 -36
- package/src/funding/mybank/index.js +1 -2
- package/src/funding/oxxo/config.jsx +50 -38
- package/src/funding/oxxo/index.js +1 -2
- package/src/funding/p24/config.jsx +45 -36
- package/src/funding/p24/index.js +1 -2
- package/src/funding/paidy/config.jsx +50 -38
- package/src/funding/paidy/index.js +1 -1
- package/src/funding/paylater/config.jsx +118 -110
- package/src/funding/paylater/index.js +1 -2
- package/src/funding/paypal/config.jsx +43 -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 -355
- package/src/funding/payu/config.jsx +50 -38
- package/src/funding/payu/index.js +1 -1
- package/src/funding/satispay/config.jsx +50 -38
- package/src/funding/satispay/index.js +1 -1
- package/src/funding/sepa/config.jsx +19 -12
- package/src/funding/sepa/index.js +1 -2
- package/src/funding/sofort/config.jsx +48 -36
- package/src/funding/sofort/index.js +1 -2
- package/src/funding/trustly/config.jsx +50 -38
- package/src/funding/trustly/index.js +1 -2
- package/src/funding/venmo/config.jsx +80 -74
- package/src/funding/venmo/index.js +1 -2
- package/src/funding/venmo/style.scoped.scss +30 -32
- package/src/funding/venmo/template.jsx +56 -56
- package/src/funding/verkkopankki/config.jsx +50 -38
- package/src/funding/verkkopankki/index.js +1 -1
- package/src/funding/wechatpay/config.jsx +48 -36
- package/src/funding/wechatpay/index.js +1 -2
- package/src/funding/zimpler/config.jsx +19 -12
- package/src/funding/zimpler/index.js +1 -2
- package/src/interface/actions.js +1 -1
- 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 +677 -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 +820 -677
- 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 +346 -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
|
@@ -1,420 +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
|
-
|
|
27
|
-
|
|
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
|
+
);
|
|
28
56
|
}
|
|
29
57
|
|
|
30
|
-
function getPersonalizationText({
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
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;
|
|
46
81
|
}
|
|
47
82
|
|
|
48
|
-
function getPersonalizationTracker({ personalization }
|
|
49
|
-
|
|
83
|
+
function getPersonalizationTracker({ personalization }: LabelOptions): ?string {
|
|
84
|
+
const personalizationTracker =
|
|
85
|
+
personalization &&
|
|
86
|
+
personalization.buttonText &&
|
|
87
|
+
personalization.buttonText.tracking &&
|
|
88
|
+
personalization.buttonText.tracking.impression;
|
|
50
89
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
90
|
+
if (!personalizationTracker) {
|
|
91
|
+
return;
|
|
92
|
+
}
|
|
54
93
|
|
|
55
|
-
|
|
94
|
+
return personalizationTracker;
|
|
56
95
|
}
|
|
57
96
|
|
|
58
|
-
function getButtonPersonalizationStyle(opts
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
97
|
+
function getButtonPersonalizationStyle(opts: LabelOptions): ?ChildType {
|
|
98
|
+
if (__TEST__) {
|
|
99
|
+
return null;
|
|
100
|
+
}
|
|
62
101
|
|
|
63
|
-
|
|
102
|
+
const { tagline } = opts;
|
|
64
103
|
|
|
65
|
-
|
|
104
|
+
const personalizationText = !tagline && getPersonalizationText(opts);
|
|
66
105
|
|
|
67
|
-
|
|
68
|
-
|
|
106
|
+
const MIN_WIDTH = 300;
|
|
107
|
+
const PERSONALIZATION_DURATION = 5;
|
|
69
108
|
|
|
70
|
-
|
|
109
|
+
const PAYPAL_BUTTON = `.${CLASS.BUTTON}[${ATTRIBUTE.FUNDING_SOURCE}=${FUNDING.PAYPAL}]`;
|
|
71
110
|
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
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}
|
|
77
119
|
}
|
|
78
120
|
}
|
|
79
121
|
|
|
80
|
-
@media only screen and (min-width: ${
|
|
81
|
-
.${
|
|
82
|
-
|
|
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
|
+
};
|
|
83
131
|
}
|
|
84
132
|
|
|
85
|
-
.${
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
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
|
+
};
|
|
89
143
|
}
|
|
90
144
|
|
|
91
|
-
.${
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
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;
|
|
95
151
|
}
|
|
96
152
|
}
|
|
97
153
|
|
|
98
154
|
@keyframes toggle-paypal-logo {
|
|
99
|
-
0% { ${
|
|
100
|
-
15% { ${
|
|
101
|
-
85% { ${
|
|
102
|
-
100% { ${
|
|
155
|
+
0% { ${EXPANDED} }
|
|
156
|
+
15% { ${COMPRESSED} }
|
|
157
|
+
85% { ${COMPRESSED} }
|
|
158
|
+
100% { ${EXPANDED} }
|
|
103
159
|
}
|
|
104
160
|
|
|
105
161
|
@keyframes show-text-delayed {
|
|
106
|
-
0% { ${
|
|
107
|
-
85% { ${
|
|
108
|
-
100% { ${
|
|
162
|
+
0% { ${COMPRESSED} }
|
|
163
|
+
85% { ${COMPRESSED} }
|
|
164
|
+
100% { ${EXPANDED} }
|
|
109
165
|
}
|
|
110
166
|
|
|
111
167
|
@keyframes show-personalization-text {
|
|
112
|
-
0% { ${
|
|
113
|
-
15% { ${
|
|
114
|
-
25% { ${
|
|
115
|
-
70% { ${
|
|
116
|
-
85% { ${
|
|
117
|
-
100% { ${
|
|
168
|
+
0% { ${COMPRESSED} }
|
|
169
|
+
15% { ${COMPRESSED} }
|
|
170
|
+
25% { ${EXPANDED} }
|
|
171
|
+
70% { ${EXPANDED} }
|
|
172
|
+
85% { ${COMPRESSED} }
|
|
173
|
+
100% { ${COMPRESSED} }
|
|
118
174
|
}
|
|
119
|
-
`
|
|
120
|
-
|
|
175
|
+
`}
|
|
176
|
+
/>
|
|
177
|
+
);
|
|
121
178
|
}
|
|
122
179
|
|
|
123
|
-
function ButtonPersonalization(opts
|
|
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
|
-
|
|
153
|
-
);
|
|
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
|
+
);
|
|
154
209
|
}
|
|
155
210
|
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
);
|
|
211
|
+
export function Label(opts: LabelOptions): ChildType {
|
|
212
|
+
return (
|
|
213
|
+
<Fragment>
|
|
214
|
+
<BasicLabel {...opts} />
|
|
215
|
+
<ButtonPersonalization {...opts} />
|
|
216
|
+
</Fragment>
|
|
217
|
+
);
|
|
164
218
|
}
|
|
165
219
|
|
|
166
|
-
export function DesignExperimentLabel(
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
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
|
+
);
|
|
177
233
|
}
|
|
178
234
|
|
|
179
|
-
export function WalletLabelOld(opts
|
|
180
|
-
|
|
235
|
+
export function WalletLabelOld(opts: WalletLabelOptions): ?ChildType {
|
|
236
|
+
const { logoColor, instrument, locale, content, commit } = opts;
|
|
181
237
|
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
238
|
+
if (__WEB__) {
|
|
239
|
+
return;
|
|
240
|
+
}
|
|
185
241
|
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
242
|
+
if (!instrument) {
|
|
243
|
+
throw new Error(`Expected instrument`);
|
|
244
|
+
}
|
|
189
245
|
|
|
190
|
-
|
|
246
|
+
let logo;
|
|
191
247
|
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
logo = <CreditLogo locale={ locale } logoColor={ logoColor } loadFromCDN={ __WEB__ } />;
|
|
200
|
-
}
|
|
201
|
-
|
|
202
|
-
return (
|
|
203
|
-
<Style css={ css }>
|
|
204
|
-
<div class='wallet-label'>
|
|
205
|
-
<div class='paypal-mark'>
|
|
206
|
-
<PPLogo logoColor={ logoColor } loadFromCDN={ __WEB__ } />
|
|
207
|
-
</div>
|
|
208
|
-
{
|
|
209
|
-
(instrument.oneClick && commit && content) &&
|
|
210
|
-
<div class='pay-label'>
|
|
211
|
-
<Space />
|
|
212
|
-
<Text>{ content.payNow }</Text>
|
|
213
|
-
</div>
|
|
214
|
-
}
|
|
215
|
-
<div class='paypal-wordmark'>
|
|
216
|
-
<Space />
|
|
217
|
-
<PayPalLogo logoColor={ logoColor } loadFromCDN={ __WEB__ } />
|
|
218
|
-
</div>
|
|
219
|
-
<div class='divider'>|</div>
|
|
220
|
-
{
|
|
221
|
-
logo &&
|
|
222
|
-
<div class='logo' optional>
|
|
223
|
-
{ logo }
|
|
224
|
-
<Space />
|
|
225
|
-
</div>
|
|
226
|
-
}
|
|
227
|
-
<div class='label'>
|
|
228
|
-
<Text className={ [ 'limit' ] }>
|
|
229
|
-
{ instrument.label }
|
|
230
|
-
</Text>
|
|
231
|
-
</div>
|
|
232
|
-
</div>
|
|
233
|
-
</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} />
|
|
234
255
|
);
|
|
235
|
-
}
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
return (
|
|
241
|
-
<div class='show-pay-label'>
|
|
242
|
-
<div class='pay-label' optional={ 2 }>
|
|
243
|
-
<Space />
|
|
244
|
-
{
|
|
245
|
-
(instrument && content)
|
|
246
|
-
? <Text>{ payNow ? content.payNow : content.payWith }</Text>
|
|
247
|
-
: <Text><PlaceHolder chars={ 7 } color={ textColor } /></Text>
|
|
248
|
-
}
|
|
249
|
-
<Space />
|
|
250
|
-
</div>
|
|
251
|
-
<div class='logo' optional={ 1 }>
|
|
252
|
-
{
|
|
253
|
-
(instrument && logo)
|
|
254
|
-
? logo
|
|
255
|
-
: <Text><PlaceHolder chars={ 4 } color={ textColor } /></Text>
|
|
256
|
-
}
|
|
257
|
-
</div>
|
|
258
|
-
<div class='label'>
|
|
259
|
-
<Space />
|
|
260
|
-
{
|
|
261
|
-
(instrument && label)
|
|
262
|
-
? <Text>{ label }</Text>
|
|
263
|
-
: <Text><PlaceHolder chars={ 6 } color={ textColor } /></Text>
|
|
264
|
-
}
|
|
265
|
-
</div>
|
|
266
|
-
</div>
|
|
256
|
+
} else if (instrument.type === WALLET_INSTRUMENT.BANK) {
|
|
257
|
+
logo = __WEB__ ? (
|
|
258
|
+
<GlyphBankExternalImage logoColor={logoColor} />
|
|
259
|
+
) : (
|
|
260
|
+
<GlyphBankInlineSVG logoColor={logoColor} />
|
|
267
261
|
);
|
|
268
|
-
}
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
return (
|
|
274
|
-
<div class='show-instruments-on-file'>
|
|
275
|
-
{
|
|
276
|
-
instrument?.secondaryInstruments?.[0]
|
|
277
|
-
? (
|
|
278
|
-
<div class='balance'>
|
|
279
|
-
<Text>{ content?.balance } &</Text>
|
|
280
|
-
<Space />
|
|
281
|
-
</div>
|
|
282
|
-
)
|
|
283
|
-
: null
|
|
284
|
-
}
|
|
285
|
-
{
|
|
286
|
-
(instrument?.type === "balance")
|
|
287
|
-
? (
|
|
288
|
-
<div class='paypal-balance'>
|
|
289
|
-
<Text>{ content?.payPalBalance }</Text>
|
|
290
|
-
</div>
|
|
291
|
-
)
|
|
292
|
-
: (
|
|
293
|
-
<div class='fi-container'>
|
|
294
|
-
<div class='fi-logo'>
|
|
295
|
-
{
|
|
296
|
-
(instrument && logo)
|
|
297
|
-
? logo
|
|
298
|
-
: <Text><PlaceHolder chars={ 4 } color={ textColor } /></Text>
|
|
299
|
-
}
|
|
300
|
-
</div>
|
|
301
|
-
<div class='fi-label'>
|
|
302
|
-
<Space />
|
|
303
|
-
{
|
|
304
|
-
(instrument && label)
|
|
305
|
-
? <Text>{ label }</Text>
|
|
306
|
-
: <Text><PlaceHolder chars={ 6 } color={ textColor } /></Text>
|
|
307
|
-
}
|
|
308
|
-
</div>
|
|
309
|
-
</div>
|
|
310
|
-
)
|
|
311
|
-
}
|
|
312
|
-
</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} />
|
|
313
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
|
+
);
|
|
314
307
|
}
|
|
315
308
|
|
|
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
|
-
|
|
353
|
-
|
|
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
|
+
}
|
|
354
347
|
|
|
355
|
-
|
|
348
|
+
function ShowInstrumentsOnFile(opts): ?ChildType {
|
|
349
|
+
const { instrument, textColor, logo, label, content } = opts;
|
|
356
350
|
|
|
357
|
-
|
|
358
|
-
|
|
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
|
+
}
|
|
359
389
|
|
|
360
|
-
|
|
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
|
+
);
|
|
361
434
|
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
}
|
|
365
|
-
|
|
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 />;
|
|
366
453
|
|
|
367
|
-
|
|
454
|
+
label = content && content.credit;
|
|
455
|
+
} else if (instrument.type === WALLET_INSTRUMENT.BALANCE) {
|
|
456
|
+
logo = __WEB__ ? <PayPalMarkExternalImage /> : <PayPalMarkInlineSVG />;
|
|
368
457
|
|
|
369
|
-
|
|
370
|
-
if (
|
|
371
|
-
|
|
458
|
+
label = content && content.balance;
|
|
459
|
+
} else if (instrument.label) {
|
|
460
|
+
label = instrument.label;
|
|
372
461
|
}
|
|
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
|
-
|
|
407
|
-
|
|
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
|
+
);
|
|
408
505
|
}
|
|
409
506
|
|
|
410
|
-
export function Tag({ multiple, locale: { lang } }
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
507
|
+
export function Tag({ multiple, locale: { lang } }: TagOptions): ?ChildType {
|
|
508
|
+
if (__WEB__) {
|
|
509
|
+
return null;
|
|
510
|
+
}
|
|
414
511
|
|
|
415
|
-
|
|
512
|
+
const { DualTag, SaferTag } = componentContent[lang];
|
|
416
513
|
|
|
417
|
-
|
|
418
|
-
? <DualTag optional />
|
|
419
|
-
: <SaferTag optional />;
|
|
514
|
+
return multiple && DualTag ? <DualTag optional /> : <SaferTag optional />;
|
|
420
515
|
}
|