@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,69 +1,86 @@
|
|
|
1
1
|
/* @flow */
|
|
2
2
|
/** @jsx node */
|
|
3
3
|
|
|
4
|
-
import { COUNTRY, FUNDING_BRAND_LABEL } from
|
|
5
|
-
import { node, Fragment } from
|
|
6
|
-
import {
|
|
4
|
+
import { COUNTRY, FUNDING_BRAND_LABEL } from "@paypal/sdk-constants/src";
|
|
5
|
+
import { node, Fragment } from "@krakenjs/jsx-pragmatic/src";
|
|
6
|
+
import {
|
|
7
|
+
CreditLogoExternalImage,
|
|
8
|
+
CreditLogoInlineSVG,
|
|
9
|
+
PPLogoExternalImage,
|
|
10
|
+
PPLogoInlineSVG,
|
|
11
|
+
PayPalLogoExternalImage,
|
|
12
|
+
PayPalLogoInlineSVG,
|
|
13
|
+
LOGO_COLOR,
|
|
14
|
+
} from "@paypal/sdk-logos/src";
|
|
7
15
|
|
|
8
|
-
import {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
16
|
+
import {
|
|
17
|
+
BUTTON_COLOR,
|
|
18
|
+
BUTTON_LAYOUT,
|
|
19
|
+
DEFAULT,
|
|
20
|
+
BUTTON_FLOW,
|
|
21
|
+
} from "../../constants";
|
|
22
|
+
import { DEFAULT_FUNDING_CONFIG, type FundingSourceConfig } from "../common";
|
|
23
|
+
import { Space } from "../../ui/text";
|
|
24
|
+
import { WalletLabel } from "../paypal/template";
|
|
13
25
|
|
|
14
|
-
export function getCreditConfig()
|
|
15
|
-
|
|
16
|
-
|
|
26
|
+
export function getCreditConfig(): FundingSourceConfig {
|
|
27
|
+
return {
|
|
28
|
+
...DEFAULT_FUNDING_CONFIG,
|
|
17
29
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
30
|
+
flows: [
|
|
31
|
+
BUTTON_FLOW.PURCHASE,
|
|
32
|
+
BUTTON_FLOW.BILLING_SETUP,
|
|
33
|
+
BUTTON_FLOW.SUBSCRIPTION_SETUP,
|
|
34
|
+
],
|
|
23
35
|
|
|
24
|
-
|
|
25
|
-
BUTTON_LAYOUT.HORIZONTAL,
|
|
26
|
-
BUTTON_LAYOUT.VERTICAL
|
|
27
|
-
],
|
|
36
|
+
layouts: [BUTTON_LAYOUT.HORIZONTAL, BUTTON_LAYOUT.VERTICAL],
|
|
28
37
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
<Space />
|
|
38
|
-
<span optional>
|
|
39
|
-
{enableLogoCDNExperiment(PayPalLogo, { logoColor }) }
|
|
40
|
-
<Space />
|
|
41
|
-
</span>
|
|
42
|
-
{
|
|
43
|
-
enableLogoCDNExperiment(CreditLogo, { locale, logoColor })
|
|
44
|
-
}
|
|
45
|
-
</Fragment>
|
|
46
|
-
);
|
|
47
|
-
},
|
|
38
|
+
Logo: ({ locale, logoColor }) => {
|
|
39
|
+
if (locale.country === COUNTRY.DE) {
|
|
40
|
+
return __WEB__ ? (
|
|
41
|
+
<CreditLogoExternalImage locale={locale} logoColor={logoColor} />
|
|
42
|
+
) : (
|
|
43
|
+
<CreditLogoInlineSVG locale={locale} logoColor={logoColor} />
|
|
44
|
+
);
|
|
45
|
+
}
|
|
48
46
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
47
|
+
return __WEB__ ? (
|
|
48
|
+
<Fragment>
|
|
49
|
+
<PPLogoExternalImage logoColor={logoColor} />
|
|
50
|
+
<Space />
|
|
51
|
+
<span optional>
|
|
52
|
+
<PayPalLogoExternalImage logoColor={logoColor} />
|
|
53
|
+
<Space />
|
|
54
|
+
</span>
|
|
55
|
+
<CreditLogoExternalImage locale={locale} logoColor={logoColor} />
|
|
56
|
+
</Fragment>
|
|
57
|
+
) : (
|
|
58
|
+
<Fragment>
|
|
59
|
+
<PPLogoInlineSVG logoColor={logoColor} />
|
|
60
|
+
<Space />
|
|
61
|
+
<span optional>
|
|
62
|
+
<PayPalLogoInlineSVG logoColor={logoColor} />
|
|
63
|
+
<Space />
|
|
64
|
+
</span>
|
|
65
|
+
<CreditLogoInlineSVG locale={locale} logoColor={logoColor} />
|
|
66
|
+
</Fragment>
|
|
67
|
+
);
|
|
68
|
+
},
|
|
56
69
|
|
|
57
|
-
|
|
58
|
-
...DEFAULT_FUNDING_CONFIG.secondaryColors,
|
|
59
|
-
[ DEFAULT ]: BUTTON_COLOR.DARKBLUE
|
|
60
|
-
},
|
|
70
|
+
WalletLabel,
|
|
61
71
|
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
72
|
+
colors: [BUTTON_COLOR.DARKBLUE, BUTTON_COLOR.BLACK, BUTTON_COLOR.WHITE],
|
|
73
|
+
|
|
74
|
+
secondaryColors: {
|
|
75
|
+
...DEFAULT_FUNDING_CONFIG.secondaryColors,
|
|
76
|
+
[DEFAULT]: BUTTON_COLOR.DARKBLUE,
|
|
77
|
+
},
|
|
78
|
+
|
|
79
|
+
logoColors: {
|
|
80
|
+
[DEFAULT]: LOGO_COLOR.WHITE,
|
|
81
|
+
[BUTTON_COLOR.WHITE]: LOGO_COLOR.BLUE,
|
|
82
|
+
},
|
|
83
|
+
|
|
84
|
+
labelText: FUNDING_BRAND_LABEL.CREDIT,
|
|
85
|
+
};
|
|
69
86
|
}
|
|
@@ -1,41 +1,49 @@
|
|
|
1
1
|
/* @flow */
|
|
2
2
|
/** @jsx node */
|
|
3
3
|
|
|
4
|
-
import {
|
|
5
|
-
import { Fragment, node } from
|
|
6
|
-
|
|
7
|
-
import { BUTTON_LAYOUT } from
|
|
8
|
-
import {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
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
|
-
|
|
4
|
+
import { EpsLogoInlineSVG, EpsLogoExternalImage } from "@paypal/sdk-logos/src";
|
|
5
|
+
import { Fragment, node } from "@krakenjs/jsx-pragmatic/src";
|
|
6
|
+
|
|
7
|
+
import { BUTTON_LAYOUT } from "../../constants";
|
|
8
|
+
import {
|
|
9
|
+
DEFAULT_APM_FUNDING_CONFIG,
|
|
10
|
+
type FundingSourceConfig,
|
|
11
|
+
BasicLabel,
|
|
12
|
+
} from "../common";
|
|
13
|
+
import { Text, Space } from "../../ui/text";
|
|
14
|
+
|
|
15
|
+
export function getEpsConfig(): FundingSourceConfig {
|
|
16
|
+
return {
|
|
17
|
+
...DEFAULT_APM_FUNDING_CONFIG,
|
|
18
|
+
|
|
19
|
+
shippingChange: false,
|
|
20
|
+
|
|
21
|
+
layouts: [BUTTON_LAYOUT.VERTICAL],
|
|
22
|
+
|
|
23
|
+
Logo: ({ logoColor, optional }) => {
|
|
24
|
+
if (__WEB__) {
|
|
25
|
+
return EpsLogoExternalImage({ logoColor, optional });
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
return EpsLogoInlineSVG({ logoColor, optional });
|
|
29
|
+
},
|
|
30
|
+
|
|
31
|
+
Label: ({ logo, ...opts }) => {
|
|
32
|
+
if (__WEB__) {
|
|
33
|
+
return logo;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
const apmLogo = (
|
|
37
|
+
<Fragment>
|
|
38
|
+
{logo}
|
|
39
|
+
<Space />
|
|
40
|
+
<Text animate optional>
|
|
41
|
+
eps
|
|
42
|
+
</Text>
|
|
43
|
+
</Fragment>
|
|
44
|
+
);
|
|
45
|
+
|
|
46
|
+
return <BasicLabel {...opts} logo={apmLogo} />;
|
|
47
|
+
},
|
|
48
|
+
};
|
|
41
49
|
}
|
package/src/funding/eps/index.js
CHANGED
package/src/funding/funding.js
CHANGED
|
@@ -1,125 +1,218 @@
|
|
|
1
1
|
/* @flow */
|
|
2
2
|
|
|
3
|
-
import type { FundingEligibilityType } from
|
|
4
|
-
import { PLATFORM, FUNDING, COMPONENTS } from
|
|
5
|
-
import { SUPPORTED_FUNDING_SOURCES } from
|
|
3
|
+
import type { FundingEligibilityType } from "@paypal/sdk-client/src";
|
|
4
|
+
import { PLATFORM, FUNDING, COMPONENTS } from "@paypal/sdk-constants/src";
|
|
5
|
+
import { SUPPORTED_FUNDING_SOURCES } from "@paypal/funding-components/src";
|
|
6
6
|
|
|
7
|
-
import type { Wallet, Experiment } from
|
|
8
|
-
import { BUTTON_LAYOUT, BUTTON_FLOW } from
|
|
9
|
-
import type {
|
|
7
|
+
import type { Wallet, Experiment } from "../types";
|
|
8
|
+
import { BUTTON_LAYOUT, BUTTON_FLOW } from "../constants";
|
|
9
|
+
import type {
|
|
10
|
+
OnShippingChange,
|
|
11
|
+
OnShippingAddressChange,
|
|
12
|
+
OnShippingOptionsChange,
|
|
13
|
+
} from "../ui/buttons/props";
|
|
10
14
|
|
|
11
|
-
import { getFundingConfig } from
|
|
15
|
+
import { getFundingConfig } from "./config";
|
|
12
16
|
|
|
13
17
|
type IsFundingEligibleOptions = {|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
18
|
+
layout?: $Values<typeof BUTTON_LAYOUT>,
|
|
19
|
+
platform: $Values<typeof PLATFORM>,
|
|
20
|
+
fundingSource: ?$Values<typeof FUNDING>,
|
|
21
|
+
flow: $Values<typeof BUTTON_FLOW>,
|
|
22
|
+
fundingEligibility: FundingEligibilityType,
|
|
23
|
+
components: $ReadOnlyArray<$Values<typeof COMPONENTS>>,
|
|
24
|
+
onShippingChange: ?Function,
|
|
25
|
+
onShippingAddressChange: ?Function,
|
|
26
|
+
onShippingOptionsChange: ?Function,
|
|
27
|
+
wallet?: ?Wallet,
|
|
28
|
+
applePaySupport: boolean,
|
|
29
|
+
supportsPopups: boolean,
|
|
30
|
+
supportedNativeBrowser: boolean,
|
|
31
|
+
experiment?: Experiment,
|
|
28
32
|
|};
|
|
29
33
|
|
|
30
|
-
export function isFundingEligible(
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
34
|
+
export function isFundingEligible(
|
|
35
|
+
source: $Values<typeof FUNDING>,
|
|
36
|
+
{
|
|
37
|
+
layout,
|
|
38
|
+
platform,
|
|
39
|
+
fundingSource,
|
|
40
|
+
fundingEligibility,
|
|
41
|
+
components,
|
|
42
|
+
onShippingChange,
|
|
43
|
+
onShippingAddressChange,
|
|
44
|
+
onShippingOptionsChange,
|
|
45
|
+
flow,
|
|
46
|
+
wallet,
|
|
47
|
+
applePaySupport,
|
|
48
|
+
supportsPopups,
|
|
49
|
+
supportedNativeBrowser,
|
|
50
|
+
experiment,
|
|
51
|
+
}: IsFundingEligibleOptions
|
|
52
|
+
): boolean {
|
|
53
|
+
if (!fundingEligibility[source] || !fundingEligibility[source].eligible) {
|
|
54
|
+
return false;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
const fundingConfig = getFundingConfig()[source];
|
|
58
|
+
|
|
59
|
+
if (!fundingConfig) {
|
|
60
|
+
return false;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
if (!fundingConfig.enabled) {
|
|
64
|
+
return false;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
if (!fundingConfig.automatic && source !== fundingSource) {
|
|
68
|
+
return false;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
if (
|
|
72
|
+
fundingConfig.eligible &&
|
|
73
|
+
!fundingConfig.eligible({
|
|
74
|
+
components,
|
|
75
|
+
experiment,
|
|
76
|
+
fundingSource,
|
|
77
|
+
fundingEligibility,
|
|
78
|
+
layout,
|
|
79
|
+
wallet,
|
|
80
|
+
})
|
|
81
|
+
) {
|
|
82
|
+
return false;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
if (
|
|
86
|
+
layout &&
|
|
87
|
+
fundingConfig.layouts &&
|
|
88
|
+
fundingConfig.layouts.indexOf(layout) === -1
|
|
89
|
+
) {
|
|
90
|
+
if (fundingSource && layout === BUTTON_LAYOUT.HORIZONTAL) {
|
|
91
|
+
// continue
|
|
92
|
+
} else {
|
|
93
|
+
return false;
|
|
41
94
|
}
|
|
95
|
+
}
|
|
42
96
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
97
|
+
if (
|
|
98
|
+
fundingConfig.platforms &&
|
|
99
|
+
fundingConfig.platforms.indexOf(platform) === -1
|
|
100
|
+
) {
|
|
101
|
+
return false;
|
|
102
|
+
}
|
|
46
103
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
}
|
|
104
|
+
if (fundingConfig.requires) {
|
|
105
|
+
const required = fundingConfig.requires({ platform });
|
|
50
106
|
|
|
51
|
-
if (
|
|
52
|
-
|
|
107
|
+
if (required.popup === true && supportsPopups === false) {
|
|
108
|
+
return false;
|
|
53
109
|
}
|
|
54
110
|
|
|
55
|
-
if (
|
|
56
|
-
|
|
57
|
-
// continue
|
|
58
|
-
} else {
|
|
59
|
-
return false;
|
|
60
|
-
}
|
|
111
|
+
if (required.applepay === true && applePaySupport === false) {
|
|
112
|
+
return false;
|
|
61
113
|
}
|
|
62
114
|
|
|
63
|
-
if (
|
|
64
|
-
|
|
115
|
+
if (required.native === true && supportedNativeBrowser === false) {
|
|
116
|
+
return false;
|
|
65
117
|
}
|
|
118
|
+
}
|
|
66
119
|
|
|
67
|
-
|
|
68
|
-
|
|
120
|
+
if (
|
|
121
|
+
fundingConfig.shippingChange === false &&
|
|
122
|
+
(onShippingChange || onShippingAddressChange || onShippingOptionsChange)
|
|
123
|
+
) {
|
|
124
|
+
return false;
|
|
125
|
+
}
|
|
69
126
|
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
127
|
+
if (fundingConfig.flows && flow && fundingConfig.flows.indexOf(flow) === -1) {
|
|
128
|
+
return false;
|
|
129
|
+
}
|
|
73
130
|
|
|
74
|
-
|
|
75
|
-
return false;
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
if (required.native === true && supportedNativeBrowser === false) {
|
|
79
|
-
return false;
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
if (fundingConfig.shippingChange === false && (onShippingChange || onShippingAddressChange || onShippingOptionsChange)) {
|
|
84
|
-
return false;
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
if (fundingConfig.flows && flow && fundingConfig.flows.indexOf(flow) === -1) {
|
|
88
|
-
return false;
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
return true;
|
|
131
|
+
return true;
|
|
92
132
|
}
|
|
93
133
|
|
|
94
|
-
export function determineEligibleFunding({
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
134
|
+
export function determineEligibleFunding({
|
|
135
|
+
fundingSource,
|
|
136
|
+
layout,
|
|
137
|
+
platform,
|
|
138
|
+
fundingEligibility,
|
|
139
|
+
components,
|
|
140
|
+
onShippingChange,
|
|
141
|
+
onShippingAddressChange,
|
|
142
|
+
onShippingOptionsChange,
|
|
143
|
+
flow,
|
|
144
|
+
wallet,
|
|
145
|
+
applePaySupport,
|
|
146
|
+
supportsPopups,
|
|
147
|
+
supportedNativeBrowser,
|
|
148
|
+
experiment,
|
|
149
|
+
}: {|
|
|
150
|
+
fundingSource: ?$Values<typeof FUNDING>,
|
|
151
|
+
remembered: $ReadOnlyArray<$Values<typeof FUNDING>>,
|
|
152
|
+
layout: $Values<typeof BUTTON_LAYOUT>,
|
|
153
|
+
platform: $Values<typeof PLATFORM>,
|
|
154
|
+
fundingEligibility: FundingEligibilityType,
|
|
155
|
+
components: $ReadOnlyArray<$Values<typeof COMPONENTS>>,
|
|
156
|
+
onShippingChange?: ?Function,
|
|
157
|
+
onShippingAddressChange?: ?Function,
|
|
158
|
+
onShippingOptionsChange?: ?Function,
|
|
159
|
+
flow: $Values<typeof BUTTON_FLOW>,
|
|
160
|
+
wallet?: ?Wallet,
|
|
161
|
+
applePaySupport: boolean,
|
|
162
|
+
supportsPopups: boolean,
|
|
163
|
+
supportedNativeBrowser: boolean,
|
|
164
|
+
experiment: Experiment,
|
|
165
|
+
|}): $ReadOnlyArray<$Values<typeof FUNDING>> {
|
|
166
|
+
if (fundingSource) {
|
|
167
|
+
return [fundingSource];
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
let eligibleFunding = SUPPORTED_FUNDING_SOURCES.filter((source) =>
|
|
171
|
+
isFundingEligible(source, {
|
|
172
|
+
layout,
|
|
173
|
+
platform,
|
|
174
|
+
fundingSource,
|
|
175
|
+
fundingEligibility,
|
|
176
|
+
components,
|
|
177
|
+
onShippingChange,
|
|
178
|
+
onShippingAddressChange,
|
|
179
|
+
onShippingOptionsChange,
|
|
180
|
+
flow,
|
|
181
|
+
wallet,
|
|
182
|
+
applePaySupport,
|
|
183
|
+
supportsPopups,
|
|
184
|
+
supportedNativeBrowser,
|
|
185
|
+
experiment,
|
|
186
|
+
})
|
|
187
|
+
);
|
|
188
|
+
|
|
189
|
+
if (layout === BUTTON_LAYOUT.HORIZONTAL) {
|
|
190
|
+
eligibleFunding = eligibleFunding.slice(0, 2);
|
|
191
|
+
} else if (layout === BUTTON_LAYOUT.VERTICAL) {
|
|
192
|
+
eligibleFunding = eligibleFunding.slice(0, 6);
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
return eligibleFunding;
|
|
113
196
|
}
|
|
114
197
|
|
|
115
|
-
export function isWalletFundingEligible({
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
198
|
+
export function isWalletFundingEligible({
|
|
199
|
+
wallet,
|
|
200
|
+
onShippingChange,
|
|
201
|
+
onShippingAddressChange,
|
|
202
|
+
onShippingOptionsChange,
|
|
203
|
+
}: {|
|
|
204
|
+
wallet: ?Wallet,
|
|
205
|
+
onShippingChange: ?OnShippingChange,
|
|
206
|
+
onShippingAddressChange: ?OnShippingAddressChange,
|
|
207
|
+
onShippingOptionsChange: ?OnShippingOptionsChange,
|
|
208
|
+
|}): boolean {
|
|
209
|
+
if (!wallet) {
|
|
210
|
+
return false;
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
if (onShippingChange || onShippingAddressChange || onShippingOptionsChange) {
|
|
214
|
+
return false;
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
return true;
|
|
125
218
|
}
|
|
@@ -1,42 +1,52 @@
|
|
|
1
1
|
/* @flow */
|
|
2
2
|
/** @jsx node */
|
|
3
3
|
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
import {
|
|
9
|
-
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
|
|
13
|
-
|
|
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
|
-
|
|
4
|
+
import {
|
|
5
|
+
GiropayLogoInlineSVG,
|
|
6
|
+
GiropayLogoExternalImage,
|
|
7
|
+
} from "@paypal/sdk-logos/src";
|
|
8
|
+
import { Fragment, node } from "@krakenjs/jsx-pragmatic/src";
|
|
9
|
+
|
|
10
|
+
import { BUTTON_LAYOUT } from "../../constants";
|
|
11
|
+
import {
|
|
12
|
+
DEFAULT_APM_FUNDING_CONFIG,
|
|
13
|
+
type FundingSourceConfig,
|
|
14
|
+
BasicLabel,
|
|
15
|
+
} from "../common";
|
|
16
|
+
import { Text, Space } from "../../ui/text";
|
|
17
|
+
|
|
18
|
+
export function getGiropayConfig(): FundingSourceConfig {
|
|
19
|
+
return {
|
|
20
|
+
...DEFAULT_APM_FUNDING_CONFIG,
|
|
21
|
+
|
|
22
|
+
shippingChange: false,
|
|
23
|
+
|
|
24
|
+
layouts: [BUTTON_LAYOUT.VERTICAL],
|
|
25
|
+
|
|
26
|
+
Logo: ({ logoColor, optional }) => {
|
|
27
|
+
if (__WEB__) {
|
|
28
|
+
return GiropayLogoExternalImage({ logoColor, optional });
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
return GiropayLogoInlineSVG({ logoColor, optional });
|
|
32
|
+
},
|
|
33
|
+
|
|
34
|
+
Label: ({ logo, ...opts }) => {
|
|
35
|
+
if (__WEB__) {
|
|
36
|
+
return logo;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
const apmLogo = (
|
|
40
|
+
<Fragment>
|
|
41
|
+
{logo}
|
|
42
|
+
<Space />
|
|
43
|
+
<Text animate optional>
|
|
44
|
+
giropay
|
|
45
|
+
</Text>
|
|
46
|
+
</Fragment>
|
|
47
|
+
);
|
|
48
|
+
|
|
49
|
+
return <BasicLabel {...opts} logo={apmLogo} />;
|
|
50
|
+
},
|
|
51
|
+
};
|
|
42
52
|
}
|