@paypal/checkout-components 5.0.266 → 5.0.267
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/package.json +2 -2
- package/src/constants/button.js +0 -4
- package/src/constants/class.js +0 -2
- package/src/declarations.js +0 -5
- package/src/funding/card/config.jsx +1 -26
- package/src/funding/common.jsx +0 -2
- package/src/types.js +0 -12
- package/src/ui/buttons/button.jsx +2 -11
- package/src/ui/buttons/buttons.jsx +7 -33
- package/src/ui/buttons/props.js +1 -34
- package/src/ui/buttons/style.jsx +2 -2
- package/src/ui/buttons/styles/base.js +0 -6
- package/src/zoid/buttons/component.jsx +0 -50
- package/src/zoid/buttons/prerender.jsx +1 -6
- package/src/zoid/buttons/util.js +1 -51
- package/src/zoid/checkout/component.jsx +0 -9
- package/src/zoid/checkout/props.js +0 -1
- package/src/ui/buttons/styles/custom.js +0 -37
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@paypal/checkout-components",
|
|
3
|
-
"version": "5.0.
|
|
3
|
+
"version": "5.0.267",
|
|
4
4
|
"description": "PayPal Checkout components, for integrating checkout products.",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
"debug": "cross-env NODE_ENV=debug",
|
|
13
13
|
"delete-size": "rm dist/size.* dist/report.html",
|
|
14
14
|
"demo": "serve ./demo -l 1337",
|
|
15
|
-
"dev": "npm run check-node-version && babel-node $(npm bin)/webpack-dev-server --config webpack.config.dev.js --port 9001 --host localhost.paypal.com --open
|
|
15
|
+
"dev": "npm run check-node-version && babel-node $(npm bin)/webpack-dev-server --config webpack.config.dev.js --port 9001 --host localhost.paypal.com --open /index.htm --https --hot=false --static './demo/dev'",
|
|
16
16
|
"eslint-find-rules": "eslint-find-rules --current .eslintrc.js --unused --plugin",
|
|
17
17
|
"flow": "flow",
|
|
18
18
|
"flow-typed": "rm -rf flow-typed && flow-typed install && rm flow-typed/npm/puppeteer_*",
|
package/src/constants/button.js
CHANGED
package/src/constants/class.js
CHANGED
package/src/declarations.js
CHANGED
|
@@ -156,32 +156,7 @@ export function getCardConfig(): FundingSourceConfig {
|
|
|
156
156
|
);
|
|
157
157
|
},
|
|
158
158
|
|
|
159
|
-
Label: ({ logo, locale, content
|
|
160
|
-
if (custom && custom.label && custom.label.length) {
|
|
161
|
-
const validLabels = {
|
|
162
|
-
buy: "Buy",
|
|
163
|
-
checkout: "Checkout",
|
|
164
|
-
pay: "Pay",
|
|
165
|
-
"buy now": "Buy Now",
|
|
166
|
-
"pay now": "Pay Now",
|
|
167
|
-
"checkout now": "Checkout Now",
|
|
168
|
-
"proceed to checkout": "Proceed to checkout",
|
|
169
|
-
};
|
|
170
|
-
|
|
171
|
-
let label = validLabels.checkout;
|
|
172
|
-
|
|
173
|
-
const lowerCaseLabel = custom.label.toLowerCase();
|
|
174
|
-
if (validLabels[lowerCaseLabel]) {
|
|
175
|
-
label = validLabels[lowerCaseLabel];
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
return (
|
|
179
|
-
<Fragment>
|
|
180
|
-
<Text>{label}</Text>
|
|
181
|
-
<Space />
|
|
182
|
-
</Fragment>
|
|
183
|
-
);
|
|
184
|
-
}
|
|
159
|
+
Label: ({ logo, locale, content }) => {
|
|
185
160
|
const { lang } = locale;
|
|
186
161
|
const isRTL = isRTLLanguage(lang);
|
|
187
162
|
return (
|
package/src/funding/common.jsx
CHANGED
|
@@ -17,7 +17,6 @@ import { LOGO_COLOR } from "@paypal/sdk-logos/src";
|
|
|
17
17
|
|
|
18
18
|
import type {
|
|
19
19
|
ContentType,
|
|
20
|
-
CustomStyle,
|
|
21
20
|
WalletInstrument,
|
|
22
21
|
Experiment,
|
|
23
22
|
Requires,
|
|
@@ -71,7 +70,6 @@ export type LabelOptions = {|
|
|
|
71
70
|
tagline: ?boolean,
|
|
72
71
|
content: ?ContentType,
|
|
73
72
|
experiment?: Experiment,
|
|
74
|
-
custom?: ?CustomStyle,
|
|
75
73
|
|};
|
|
76
74
|
|
|
77
75
|
export type DesignExperimentLabelOptions = {|
|
package/src/types.js
CHANGED
|
@@ -62,13 +62,6 @@ export type Requires = {|
|
|
|
62
62
|
native?: boolean,
|
|
63
63
|
|};
|
|
64
64
|
|
|
65
|
-
export type CustomStyle = {|
|
|
66
|
-
css?: {|
|
|
67
|
-
[string]: string,
|
|
68
|
-
|},
|
|
69
|
-
label?: string,
|
|
70
|
-
|};
|
|
71
|
-
|
|
72
65
|
export type LazyExport<T> = {|
|
|
73
66
|
__get__: () => T,
|
|
74
67
|
|};
|
|
@@ -76,8 +69,3 @@ export type LazyExport<T> = {|
|
|
|
76
69
|
export type LazyProtectedExport<T> = {|
|
|
77
70
|
__get__: () => ?T,
|
|
78
71
|
|};
|
|
79
|
-
|
|
80
|
-
export type InlineXOEligibilityType = {|
|
|
81
|
-
eligible: boolean,
|
|
82
|
-
ineligibilityReason: string,
|
|
83
|
-
|};
|
|
@@ -23,7 +23,6 @@ import {
|
|
|
23
23
|
CLASS,
|
|
24
24
|
BUTTON_COLOR,
|
|
25
25
|
BUTTON_NUMBER,
|
|
26
|
-
EXPERIENCE,
|
|
27
26
|
TEXT_COLOR,
|
|
28
27
|
BUTTON_FLOW,
|
|
29
28
|
} from "../../constants";
|
|
@@ -65,7 +64,6 @@ type IndividualButtonProps = {|
|
|
|
65
64
|
vault: boolean,
|
|
66
65
|
merchantFundingSource: ?$Values<typeof FUNDING>,
|
|
67
66
|
instrument: ?WalletInstrument,
|
|
68
|
-
experience?: string,
|
|
69
67
|
showPayLabel: boolean,
|
|
70
68
|
|};
|
|
71
69
|
|
|
@@ -88,12 +86,10 @@ export function Button({
|
|
|
88
86
|
commit,
|
|
89
87
|
experiment,
|
|
90
88
|
instrument,
|
|
91
|
-
experience,
|
|
92
89
|
showPayLabel,
|
|
93
90
|
}: IndividualButtonProps): ElementNode {
|
|
94
|
-
const {
|
|
95
|
-
|
|
96
|
-
experience === EXPERIENCE.INLINE && custom && custom.label;
|
|
91
|
+
const { layout, shape } = style;
|
|
92
|
+
|
|
97
93
|
const fundingConfig = getFundingConfig()[fundingSource];
|
|
98
94
|
|
|
99
95
|
if (!fundingConfig) {
|
|
@@ -193,7 +189,6 @@ export function Button({
|
|
|
193
189
|
personalization={personalization}
|
|
194
190
|
tagline={tagline}
|
|
195
191
|
content={content}
|
|
196
|
-
custom={inlineExperience ? custom : undefined}
|
|
197
192
|
experiment={experiment}
|
|
198
193
|
/>
|
|
199
194
|
);
|
|
@@ -266,7 +261,6 @@ export function Button({
|
|
|
266
261
|
<div
|
|
267
262
|
class={[
|
|
268
263
|
CLASS.BUTTON_ROW,
|
|
269
|
-
inlineExperience && fundingSource === FUNDING.CARD ? CLASS.CUSTOM : "",
|
|
270
264
|
`${CLASS.NUMBER}-${i}`,
|
|
271
265
|
`${CLASS.LAYOUT}-${layout}`,
|
|
272
266
|
`${CLASS.SHAPE}-${shape}`,
|
|
@@ -299,9 +293,6 @@ export function Button({
|
|
|
299
293
|
}}
|
|
300
294
|
class={[
|
|
301
295
|
CLASS.BUTTON,
|
|
302
|
-
inlineExperience && fundingSource === FUNDING.CARD
|
|
303
|
-
? CLASS.CUSTOM
|
|
304
|
-
: "",
|
|
305
296
|
`${CLASS.NUMBER}-${i}`,
|
|
306
297
|
`${CLASS.LAYOUT}-${layout}`,
|
|
307
298
|
`${CLASS.SHAPE}-${shape}`,
|
|
@@ -15,7 +15,6 @@ import {
|
|
|
15
15
|
BUTTON_NUMBER,
|
|
16
16
|
BUTTON_LAYOUT,
|
|
17
17
|
BUTTON_FLOW,
|
|
18
|
-
EXPERIENCE,
|
|
19
18
|
} from "../../constants";
|
|
20
19
|
import {
|
|
21
20
|
determineEligibleFunding,
|
|
@@ -177,16 +176,9 @@ export function Buttons(props: ButtonsProps): ElementNode {
|
|
|
177
176
|
applePaySupport,
|
|
178
177
|
supportsPopups,
|
|
179
178
|
supportedNativeBrowser,
|
|
180
|
-
experience,
|
|
181
179
|
showPayLabel,
|
|
182
180
|
} = normalizeButtonProps(props);
|
|
183
|
-
const {
|
|
184
|
-
|
|
185
|
-
const inlineExperience =
|
|
186
|
-
experience === EXPERIENCE.INLINE &&
|
|
187
|
-
custom &&
|
|
188
|
-
custom.label &&
|
|
189
|
-
custom.label.length !== 0;
|
|
181
|
+
const { layout, shape, tagline } = style;
|
|
190
182
|
|
|
191
183
|
let fundingSources = determineEligibleFunding({
|
|
192
184
|
fundingSource,
|
|
@@ -216,17 +208,10 @@ export function Buttons(props: ButtonsProps): ElementNode {
|
|
|
216
208
|
}
|
|
217
209
|
|
|
218
210
|
if (fundingSources.indexOf(FUNDING.CARD) !== -1) {
|
|
219
|
-
|
|
220
|
-
fundingSources
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
];
|
|
224
|
-
} else {
|
|
225
|
-
fundingSources = [
|
|
226
|
-
...fundingSources.filter((src) => src !== FUNDING.CARD),
|
|
227
|
-
FUNDING.CARD,
|
|
228
|
-
];
|
|
229
|
-
}
|
|
211
|
+
fundingSources = [
|
|
212
|
+
...fundingSources.filter((src) => src !== FUNDING.CARD),
|
|
213
|
+
FUNDING.CARD,
|
|
214
|
+
];
|
|
230
215
|
}
|
|
231
216
|
|
|
232
217
|
const isAPM = fundingSources.some((src) => {
|
|
@@ -248,16 +233,7 @@ export function Buttons(props: ButtonsProps): ElementNode {
|
|
|
248
233
|
|
|
249
234
|
const { buttonDesignScript = "" } = getButtonDesign(personalization);
|
|
250
235
|
const index = (i) => {
|
|
251
|
-
|
|
252
|
-
return i;
|
|
253
|
-
}
|
|
254
|
-
|
|
255
|
-
// InlineXO: Need to change color indexing because we bring Cards to the top
|
|
256
|
-
if (i === 0) {
|
|
257
|
-
return fundingSources.length - 1;
|
|
258
|
-
} else {
|
|
259
|
-
return i - 1;
|
|
260
|
-
}
|
|
236
|
+
return i;
|
|
261
237
|
};
|
|
262
238
|
|
|
263
239
|
return (
|
|
@@ -304,7 +280,6 @@ export function Buttons(props: ButtonsProps): ElementNode {
|
|
|
304
280
|
flow={flow}
|
|
305
281
|
vault={vault}
|
|
306
282
|
instrument={instruments[source]}
|
|
307
|
-
experience={experience}
|
|
308
283
|
showPayLabel={showPayLabel}
|
|
309
284
|
/>
|
|
310
285
|
))}
|
|
@@ -332,8 +307,7 @@ export function Buttons(props: ButtonsProps): ElementNode {
|
|
|
332
307
|
) : null}
|
|
333
308
|
|
|
334
309
|
{layout === BUTTON_LAYOUT.VERTICAL &&
|
|
335
|
-
fundingSources.indexOf(FUNDING.CARD) !== -1
|
|
336
|
-
!inlineExperience ? (
|
|
310
|
+
fundingSources.indexOf(FUNDING.CARD) !== -1 ? (
|
|
337
311
|
<PoweredByPayPal locale={locale} nonce={nonce} />
|
|
338
312
|
) : null}
|
|
339
313
|
|
package/src/ui/buttons/props.js
CHANGED
|
@@ -30,7 +30,7 @@ import { LOGO_COLOR } from "@paypal/sdk-logos/src";
|
|
|
30
30
|
import { SUPPORTED_FUNDING_SOURCES } from "@paypal/funding-components/src";
|
|
31
31
|
import type { ComponentFunctionType } from "@krakenjs/jsx-pragmatic/src";
|
|
32
32
|
|
|
33
|
-
import type { ContentType,
|
|
33
|
+
import type { ContentType, Wallet, Experiment } from "../../types";
|
|
34
34
|
import {
|
|
35
35
|
BUTTON_LABEL,
|
|
36
36
|
BUTTON_COLOR,
|
|
@@ -317,7 +317,6 @@ export type ButtonStyle = {|
|
|
|
317
317
|
menuPlacement: $Values<typeof MENU_PLACEMENT>,
|
|
318
318
|
period?: number,
|
|
319
319
|
height?: number,
|
|
320
|
-
custom?: ?CustomStyle,
|
|
321
320
|
|};
|
|
322
321
|
|
|
323
322
|
export type ButtonStyleInputs = {|
|
|
@@ -328,7 +327,6 @@ export type ButtonStyleInputs = {|
|
|
|
328
327
|
layout?: $Values<typeof BUTTON_LAYOUT> | void,
|
|
329
328
|
period?: number | void,
|
|
330
329
|
height?: number | void,
|
|
331
|
-
custom?: ?CustomStyle,
|
|
332
330
|
|};
|
|
333
331
|
|
|
334
332
|
type PersonalizationComponentProps = {|
|
|
@@ -459,7 +457,6 @@ export type RenderButtonProps = {|
|
|
|
459
457
|
applePaySupport: boolean,
|
|
460
458
|
supportsPopups: boolean,
|
|
461
459
|
supportedNativeBrowser: boolean,
|
|
462
|
-
experience: string,
|
|
463
460
|
showPayLabel: boolean,
|
|
464
461
|
|};
|
|
465
462
|
|
|
@@ -516,7 +513,6 @@ export type ButtonProps = {|
|
|
|
516
513
|
applePay: ApplePaySessionConfigRequest,
|
|
517
514
|
meta: {||},
|
|
518
515
|
renderedButtons: $ReadOnlyArray<$Values<typeof FUNDING>>,
|
|
519
|
-
experience: string,
|
|
520
516
|
createVaultSetupToken: CreateVaultSetupToken,
|
|
521
517
|
|};
|
|
522
518
|
|
|
@@ -557,7 +553,6 @@ export type ButtonPropsInputs = {
|
|
|
557
553
|
applePaySupport: boolean,
|
|
558
554
|
supportsPopups: boolean,
|
|
559
555
|
supportedNativeBrowser: boolean,
|
|
560
|
-
experience: string,
|
|
561
556
|
showPayLabel: boolean,
|
|
562
557
|
};
|
|
563
558
|
|
|
@@ -615,7 +610,6 @@ export function normalizeButtonStyle(
|
|
|
615
610
|
height,
|
|
616
611
|
period,
|
|
617
612
|
menuPlacement = MENU_PLACEMENT.BELOW,
|
|
618
|
-
custom,
|
|
619
613
|
} = style;
|
|
620
614
|
|
|
621
615
|
// $FlowFixMe
|
|
@@ -678,32 +672,7 @@ export function normalizeButtonStyle(
|
|
|
678
672
|
}
|
|
679
673
|
}
|
|
680
674
|
|
|
681
|
-
if (custom) {
|
|
682
|
-
if (custom.label && typeof custom.label !== "string") {
|
|
683
|
-
throw new Error(`style.custom.label is expected to be a String.`);
|
|
684
|
-
}
|
|
685
|
-
|
|
686
|
-
if (custom.css && typeof custom.css !== "object") {
|
|
687
|
-
throw new Error(`style.custom.css is expected to be JSON.`);
|
|
688
|
-
}
|
|
689
|
-
|
|
690
|
-
if (custom.css && custom.label && custom.label.length === 0) {
|
|
691
|
-
throw new Error(
|
|
692
|
-
`Expected style.custom.label to be used with style.custom.css`
|
|
693
|
-
);
|
|
694
|
-
}
|
|
695
|
-
|
|
696
|
-
if (custom.label && custom.label.length > 0 && !custom.css) {
|
|
697
|
-
custom.css = {
|
|
698
|
-
"background-color": "black",
|
|
699
|
-
height: "48px",
|
|
700
|
-
"margin-bottom": "15px",
|
|
701
|
-
};
|
|
702
|
-
}
|
|
703
|
-
}
|
|
704
|
-
|
|
705
675
|
return {
|
|
706
|
-
custom,
|
|
707
676
|
label,
|
|
708
677
|
layout,
|
|
709
678
|
color,
|
|
@@ -766,7 +735,6 @@ export function normalizeButtonProps(
|
|
|
766
735
|
applePaySupport = false,
|
|
767
736
|
supportsPopups = false,
|
|
768
737
|
supportedNativeBrowser = false,
|
|
769
|
-
experience = "",
|
|
770
738
|
showPayLabel = true,
|
|
771
739
|
} = props;
|
|
772
740
|
|
|
@@ -854,7 +822,6 @@ export function normalizeButtonProps(
|
|
|
854
822
|
applePaySupport,
|
|
855
823
|
supportsPopups,
|
|
856
824
|
supportedNativeBrowser,
|
|
857
|
-
experience,
|
|
858
825
|
showPayLabel,
|
|
859
826
|
};
|
|
860
827
|
}
|
package/src/ui/buttons/style.jsx
CHANGED
|
@@ -18,8 +18,8 @@ export function Style({
|
|
|
18
18
|
nonce,
|
|
19
19
|
fundingEligibility,
|
|
20
20
|
}: StyleProps): ElementNode {
|
|
21
|
-
const {
|
|
22
|
-
const css = componentStyle({
|
|
21
|
+
const { height } = style;
|
|
22
|
+
const css = componentStyle({ height, fundingEligibility });
|
|
23
23
|
|
|
24
24
|
return <style nonce={nonce} innerHTML={css} />;
|
|
25
25
|
}
|
|
@@ -2,21 +2,16 @@
|
|
|
2
2
|
|
|
3
3
|
import { type FundingEligibilityType } from "@paypal/sdk-constants/src";
|
|
4
4
|
|
|
5
|
-
import type { CustomStyle } from "../../../types";
|
|
6
|
-
|
|
7
5
|
import { pageStyle } from "./page";
|
|
8
6
|
import { buttonStyle } from "./button";
|
|
9
7
|
import { labelStyle } from "./labels";
|
|
10
8
|
import { buttonResponsiveStyle } from "./responsive";
|
|
11
9
|
import { buttonColorStyle } from "./color";
|
|
12
|
-
import { customStyle } from "./custom";
|
|
13
10
|
|
|
14
11
|
export function componentStyle({
|
|
15
|
-
custom,
|
|
16
12
|
height,
|
|
17
13
|
fundingEligibility,
|
|
18
14
|
}: {|
|
|
19
|
-
custom?: ?CustomStyle,
|
|
20
15
|
height?: ?number,
|
|
21
16
|
fundingEligibility: FundingEligibilityType,
|
|
22
17
|
|}): string {
|
|
@@ -26,6 +21,5 @@ export function componentStyle({
|
|
|
26
21
|
${buttonColorStyle}
|
|
27
22
|
${labelStyle}
|
|
28
23
|
${buttonResponsiveStyle({ height, fundingEligibility })}
|
|
29
|
-
${customStyle({ custom })}
|
|
30
24
|
`;
|
|
31
25
|
}
|
|
@@ -70,8 +70,6 @@ import {
|
|
|
70
70
|
} from "../../lib";
|
|
71
71
|
import { normalizeButtonStyle, type ButtonProps } from "../../ui/buttons/props";
|
|
72
72
|
import { isFundingEligible } from "../../funding";
|
|
73
|
-
import { EXPERIENCE } from "../../constants";
|
|
74
|
-
import { type InlineXOEligibilityType } from "../../types";
|
|
75
73
|
|
|
76
74
|
import { containerTemplate } from "./container";
|
|
77
75
|
import { PrerenderedButtons } from "./prerender";
|
|
@@ -83,7 +81,6 @@ import {
|
|
|
83
81
|
getRenderedButtons,
|
|
84
82
|
getButtonSize,
|
|
85
83
|
getButtonExperiments,
|
|
86
|
-
isInlineXOEligible,
|
|
87
84
|
} from "./util";
|
|
88
85
|
|
|
89
86
|
export type ButtonsComponent = ZoidComponent<ButtonProps>;
|
|
@@ -798,53 +795,6 @@ export const getButtonsComponent: () => ButtonsComponent = memoize(() => {
|
|
|
798
795
|
value: applePaySession,
|
|
799
796
|
},
|
|
800
797
|
|
|
801
|
-
experience: {
|
|
802
|
-
queryParam: true,
|
|
803
|
-
required: false,
|
|
804
|
-
type: "string",
|
|
805
|
-
value: ({ props }) => {
|
|
806
|
-
const {
|
|
807
|
-
commit,
|
|
808
|
-
createBillingAgreement,
|
|
809
|
-
currency,
|
|
810
|
-
disableFunding = [],
|
|
811
|
-
experience,
|
|
812
|
-
fundingEligibility,
|
|
813
|
-
onComplete,
|
|
814
|
-
style: { custom = {}, layout },
|
|
815
|
-
vault,
|
|
816
|
-
} = props || {};
|
|
817
|
-
|
|
818
|
-
if (experience === "accelerated") {
|
|
819
|
-
return EXPERIENCE.INLINE;
|
|
820
|
-
}
|
|
821
|
-
|
|
822
|
-
const inlineCheckoutEligibility: InlineXOEligibilityType =
|
|
823
|
-
__INLINE_CHECKOUT_ELIGIBILITY__ || {
|
|
824
|
-
eligible: false,
|
|
825
|
-
};
|
|
826
|
-
|
|
827
|
-
const eligible =
|
|
828
|
-
inlineCheckoutEligibility &&
|
|
829
|
-
inlineCheckoutEligibility.eligible &&
|
|
830
|
-
isInlineXOEligible({
|
|
831
|
-
props: {
|
|
832
|
-
commit,
|
|
833
|
-
createBillingAgreement,
|
|
834
|
-
currency,
|
|
835
|
-
custom,
|
|
836
|
-
disableFunding,
|
|
837
|
-
fundingEligibility,
|
|
838
|
-
layout,
|
|
839
|
-
onComplete,
|
|
840
|
-
vault,
|
|
841
|
-
},
|
|
842
|
-
});
|
|
843
|
-
|
|
844
|
-
return eligible ? EXPERIENCE.INLINE : "";
|
|
845
|
-
},
|
|
846
|
-
},
|
|
847
|
-
|
|
848
798
|
// allowBillingPayments prop is used by Honey Extension to render the one-click button
|
|
849
799
|
// with payment methods & to use the payment methods instead of the Billing Agreement
|
|
850
800
|
allowBillingPayments: {
|
|
@@ -17,7 +17,6 @@ import { getLogger } from "@paypal/sdk-client/src";
|
|
|
17
17
|
import type { ZoidProps } from "@krakenjs/zoid/src";
|
|
18
18
|
|
|
19
19
|
import { DEFAULT_POPUP_SIZE } from "../checkout";
|
|
20
|
-
import { EXPERIENCE } from "../../constants";
|
|
21
20
|
import { Buttons } from "../../ui";
|
|
22
21
|
import { type ButtonProps } from "../../ui/buttons/props";
|
|
23
22
|
|
|
@@ -59,11 +58,7 @@ export function PrerenderedButtons({
|
|
|
59
58
|
})
|
|
60
59
|
.flush();
|
|
61
60
|
|
|
62
|
-
if (
|
|
63
|
-
fundingSource === FUNDING.VENMO ||
|
|
64
|
-
fundingSource === FUNDING.APPLEPAY ||
|
|
65
|
-
(fundingSource === FUNDING.CARD && props.experience === EXPERIENCE.INLINE)
|
|
66
|
-
) {
|
|
61
|
+
if (fundingSource === FUNDING.VENMO || fundingSource === FUNDING.APPLEPAY) {
|
|
67
62
|
// wait for button to load
|
|
68
63
|
} else if (supportsPopups() && !props.merchantRequestedPopupsDisabled) {
|
|
69
64
|
// remember the popup window to prevent showing a new popup window on every click in the prerender state
|
package/src/zoid/buttons/util.js
CHANGED
|
@@ -15,7 +15,7 @@ import {
|
|
|
15
15
|
isStandAlone,
|
|
16
16
|
once,
|
|
17
17
|
} from "@krakenjs/belter/src";
|
|
18
|
-
import {
|
|
18
|
+
import { ENV, FUNDING } from "@paypal/sdk-constants/src";
|
|
19
19
|
import {
|
|
20
20
|
getEnableFunding,
|
|
21
21
|
getLogger,
|
|
@@ -24,7 +24,6 @@ import {
|
|
|
24
24
|
getPlatform,
|
|
25
25
|
getComponents,
|
|
26
26
|
getEnv,
|
|
27
|
-
type FundingEligibilityType,
|
|
28
27
|
} from "@paypal/sdk-client/src";
|
|
29
28
|
import { getRefinedFundingEligibility } from "@paypal/funding-components/src";
|
|
30
29
|
|
|
@@ -374,52 +373,3 @@ export function getButtonSize(
|
|
|
374
373
|
}
|
|
375
374
|
}
|
|
376
375
|
}
|
|
377
|
-
|
|
378
|
-
type InlineCheckoutEligibilityProps = {|
|
|
379
|
-
commit: boolean,
|
|
380
|
-
createBillingAgreement?: Function,
|
|
381
|
-
currency: string,
|
|
382
|
-
disableFunding: $ReadOnlyArray<$Values<typeof FUNDING>>,
|
|
383
|
-
fundingEligibility: FundingEligibilityType,
|
|
384
|
-
layout: $Values<typeof BUTTON_LAYOUT>,
|
|
385
|
-
merchantID?: $ReadOnlyArray<string>,
|
|
386
|
-
onComplete: Function,
|
|
387
|
-
custom?: ?{|
|
|
388
|
-
css?: {|
|
|
389
|
-
[string]: string,
|
|
390
|
-
|},
|
|
391
|
-
label?: string,
|
|
392
|
-
|},
|
|
393
|
-
vault: boolean,
|
|
394
|
-
|};
|
|
395
|
-
|
|
396
|
-
export function isInlineXOEligible({
|
|
397
|
-
props,
|
|
398
|
-
}: {|
|
|
399
|
-
props: InlineCheckoutEligibilityProps,
|
|
400
|
-
|}): boolean {
|
|
401
|
-
const {
|
|
402
|
-
commit,
|
|
403
|
-
currency,
|
|
404
|
-
custom,
|
|
405
|
-
createBillingAgreement,
|
|
406
|
-
disableFunding,
|
|
407
|
-
fundingEligibility,
|
|
408
|
-
layout,
|
|
409
|
-
onComplete,
|
|
410
|
-
vault,
|
|
411
|
-
} = props;
|
|
412
|
-
|
|
413
|
-
const isEligible =
|
|
414
|
-
(custom?.label && custom.label.length > 0,
|
|
415
|
-
onComplete &&
|
|
416
|
-
commit === true &&
|
|
417
|
-
!createBillingAgreement &&
|
|
418
|
-
currency === CURRENCY.USD &&
|
|
419
|
-
disableFunding?.indexOf(FUNDING.CARD) === -1 &&
|
|
420
|
-
(fundingEligibility?.card?.eligible || false) &&
|
|
421
|
-
layout === BUTTON_LAYOUT.VERTICAL &&
|
|
422
|
-
vault === false);
|
|
423
|
-
|
|
424
|
-
return isEligible;
|
|
425
|
-
}
|
|
@@ -75,7 +75,6 @@ export function getCheckoutComponent(): CheckoutComponent {
|
|
|
75
75
|
const {
|
|
76
76
|
nonce,
|
|
77
77
|
locale: { lang },
|
|
78
|
-
inlinexo,
|
|
79
78
|
} = props;
|
|
80
79
|
const content = containerContent[lang];
|
|
81
80
|
return (
|
|
@@ -88,7 +87,6 @@ export function getCheckoutComponent(): CheckoutComponent {
|
|
|
88
87
|
prerenderFrame={prerenderFrame}
|
|
89
88
|
content={content}
|
|
90
89
|
nonce={nonce}
|
|
91
|
-
fullScreen={inlinexo === true}
|
|
92
90
|
/>
|
|
93
91
|
).render(dom({ doc }));
|
|
94
92
|
},
|
|
@@ -279,13 +277,6 @@ export function getCheckoutComponent(): CheckoutComponent {
|
|
|
279
277
|
default: () => window.__test__ || { action: "checkout" },
|
|
280
278
|
},
|
|
281
279
|
|
|
282
|
-
inlinexo: {
|
|
283
|
-
type: "boolean",
|
|
284
|
-
required: false,
|
|
285
|
-
queryParam: true,
|
|
286
|
-
allowDelegate: true,
|
|
287
|
-
},
|
|
288
|
-
|
|
289
280
|
smokeHash: {
|
|
290
281
|
type: "string",
|
|
291
282
|
required: false,
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
/* @flow */
|
|
2
|
-
|
|
3
|
-
import type { CustomStyle } from "../../../types";
|
|
4
|
-
import { CLASS } from "../../../constants";
|
|
5
|
-
|
|
6
|
-
export const customStyle = ({
|
|
7
|
-
custom,
|
|
8
|
-
}: {|
|
|
9
|
-
custom?: ?CustomStyle,
|
|
10
|
-
|}): string => {
|
|
11
|
-
const { css } = custom || {};
|
|
12
|
-
|
|
13
|
-
if (!css) {
|
|
14
|
-
return "";
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
let heightStyle = "";
|
|
18
|
-
let marginStyle = "";
|
|
19
|
-
let style = Object.keys(css).reduce((acc, key) => {
|
|
20
|
-
if (key === "height") {
|
|
21
|
-
heightStyle = `
|
|
22
|
-
height: ${css[key]};
|
|
23
|
-
max-height: ${css[key]};
|
|
24
|
-
`;
|
|
25
|
-
} else if (key.indexOf("margin") !== -1) {
|
|
26
|
-
marginStyle = `${key}: ${css[key]};`;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
acc += `${key}: ${css[key]};`;
|
|
30
|
-
return acc;
|
|
31
|
-
}, "");
|
|
32
|
-
style = `.${CLASS.BUTTON}.${CLASS.CUSTOM} { ${style} } .${CLASS.BUTTON_ROW}.${
|
|
33
|
-
CLASS.CUSTOM
|
|
34
|
-
} { ${heightStyle + marginStyle}}`;
|
|
35
|
-
|
|
36
|
-
return style;
|
|
37
|
-
};
|