@paypal/checkout-components 5.0.199 → 5.0.201
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/CHANGELOG.md +12 -0
- package/dist/button.js +1 -1
- package/package.json +1 -1
- package/src/constants/class.js +1 -0
- package/src/funding/common.jsx +1 -1
- package/src/funding/paylater/config.jsx +45 -38
- package/src/ui/buttons/button.jsx +1 -1
- package/src/ui/buttons/buttonDesigns/divideLogoAnimation.jsx +7 -5
- package/src/zoid/buttons/component.jsx +1 -1
package/package.json
CHANGED
package/src/constants/class.js
CHANGED
|
@@ -5,6 +5,7 @@ export const CLASS = {
|
|
|
5
5
|
BUTTON_ROW: ('paypal-button-row' : 'paypal-button-row'),
|
|
6
6
|
BUTTON: ('paypal-button' : 'paypal-button'),
|
|
7
7
|
BUTTON_LABEL: ('paypal-button-label-container' : 'paypal-button-label-container'),
|
|
8
|
+
LOGO_PP: ('paypal-logo-pp' : 'paypal-logo-pp'),
|
|
8
9
|
|
|
9
10
|
LABEL: ('paypal-button-label' : 'paypal-button-label'),
|
|
10
11
|
COLOR: ('paypal-button-color' : 'paypal-button-color'),
|
package/src/funding/common.jsx
CHANGED
|
@@ -118,7 +118,7 @@ export type FundingSourceConfig = {|
|
|
|
118
118
|
secondaryVaultColors : { [$Values<typeof BUTTON_COLOR>] : $Values<typeof BUTTON_COLOR> },
|
|
119
119
|
logoColors : { [$Values<typeof BUTTON_COLOR>] : $Values<typeof LOGO_COLOR> },
|
|
120
120
|
shapes : $ReadOnlyArray<$Values<typeof BUTTON_SHAPE>>,
|
|
121
|
-
labelText? : string | (({| content : ?ContentType |}) => string),
|
|
121
|
+
labelText? : string | (({| content : ?ContentType, fundingEligibility : ?FundingEligibilityType |}) => string),
|
|
122
122
|
showWalletMenu : ({| instrument : WalletInstrument |}) => boolean
|
|
123
123
|
|};
|
|
124
124
|
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/* @flow */
|
|
2
2
|
/** @jsx node */
|
|
3
3
|
|
|
4
|
+
import type { FundingEligibilityType } from '@paypal/sdk-client/src';
|
|
4
5
|
import { FUNDING } from '@paypal/sdk-constants/src';
|
|
5
6
|
import { node, Style } from 'jsx-pragmatic/src';
|
|
6
7
|
import { PPLogo, LOGO_COLOR } from '@paypal/sdk-logos/src';
|
|
@@ -11,6 +12,46 @@ import { Text, Space } from '../../ui/text';
|
|
|
11
12
|
|
|
12
13
|
import css from './style.scoped.scss';
|
|
13
14
|
|
|
15
|
+
function getLabelText(fundingEligibility : FundingEligibilityType) : ?string {
|
|
16
|
+
const { paylater } = fundingEligibility;
|
|
17
|
+
|
|
18
|
+
let labelText;
|
|
19
|
+
|
|
20
|
+
if (
|
|
21
|
+
paylater?.products?.paylater?.eligible &&
|
|
22
|
+
paylater?.products?.paylater?.variant === 'DE'
|
|
23
|
+
) {
|
|
24
|
+
labelText = 'Später Bezahlen';
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
if (
|
|
28
|
+
paylater?.products?.payIn3?.eligible &&
|
|
29
|
+
paylater?.products?.payIn3?.variant === 'ES'
|
|
30
|
+
) {
|
|
31
|
+
labelText = 'Paga en 3 plazos';
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
if (
|
|
35
|
+
paylater?.products?.payIn3?.eligible &&
|
|
36
|
+
paylater?.products?.payIn3?.variant === 'IT'
|
|
37
|
+
) {
|
|
38
|
+
labelText = 'Paga in 3 rate';
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
if (paylater?.products?.payIn4?.eligible) {
|
|
42
|
+
labelText = 'Pay in 4';
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
if (
|
|
46
|
+
paylater?.products?.payIn4?.eligible &&
|
|
47
|
+
paylater?.products?.payIn4?.variant === 'FR'
|
|
48
|
+
) {
|
|
49
|
+
labelText = '4X PayPal';
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
return labelText;
|
|
53
|
+
}
|
|
54
|
+
|
|
14
55
|
export function getPaylaterConfig() : FundingSourceConfig {
|
|
15
56
|
return {
|
|
16
57
|
...DEFAULT_FUNDING_CONFIG,
|
|
@@ -34,47 +75,11 @@ export function getPaylaterConfig() : FundingSourceConfig {
|
|
|
34
75
|
Label: ({ logo }) => logo,
|
|
35
76
|
|
|
36
77
|
Logo: ({ logoColor, nonce, fundingEligibility }) => {
|
|
37
|
-
const { paylater } = fundingEligibility;
|
|
38
|
-
|
|
39
|
-
let label = <Text>Pay Later</Text>;
|
|
40
|
-
|
|
41
|
-
if (
|
|
42
|
-
paylater?.products?.paylater?.eligible &&
|
|
43
|
-
paylater?.products?.paylater?.variant === 'DE'
|
|
44
|
-
) {
|
|
45
|
-
label = <Text>Später Bezahlen</Text>;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
if (
|
|
49
|
-
paylater?.products?.payIn3?.eligible &&
|
|
50
|
-
paylater?.products?.payIn3?.variant === 'ES'
|
|
51
|
-
) {
|
|
52
|
-
label = <Text>Paga en 3 plazos</Text>;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
if (
|
|
56
|
-
paylater?.products?.payIn3?.eligible &&
|
|
57
|
-
paylater?.products?.payIn3?.variant === 'IT'
|
|
58
|
-
) {
|
|
59
|
-
label = <Text>Paga in 3 rate</Text>;
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
if (paylater?.products?.payIn4?.eligible) {
|
|
63
|
-
label = <Text>Pay in 4</Text>;
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
if (
|
|
67
|
-
paylater?.products?.payIn4?.eligible &&
|
|
68
|
-
paylater?.products?.payIn4?.variant === 'FR'
|
|
69
|
-
) {
|
|
70
|
-
label = <Text>4X PayPal</Text>;
|
|
71
|
-
}
|
|
72
|
-
|
|
73
78
|
return (
|
|
74
79
|
<Style css={ css } nonce={ nonce }>
|
|
75
80
|
<PPLogo logoColor={ logoColor } />
|
|
76
81
|
<Space />
|
|
77
|
-
{
|
|
82
|
+
<Text>{ getLabelText(fundingEligibility) || 'Pay Later' }</Text>
|
|
78
83
|
</Style>
|
|
79
84
|
);
|
|
80
85
|
},
|
|
@@ -104,6 +109,8 @@ export function getPaylaterConfig() : FundingSourceConfig {
|
|
|
104
109
|
[BUTTON_COLOR.WHITE]: LOGO_COLOR.BLUE
|
|
105
110
|
},
|
|
106
111
|
|
|
107
|
-
labelText:
|
|
112
|
+
labelText: ({ fundingEligibility }) => {
|
|
113
|
+
return (fundingEligibility && getLabelText(fundingEligibility)) || `${ FUNDING.PAYPAL } ${ FUNDING.PAYLATER }`;
|
|
114
|
+
}
|
|
108
115
|
};
|
|
109
116
|
}
|
|
@@ -96,7 +96,7 @@ export function Button({ fundingSource, style, multiple, locale, env, fundingEli
|
|
|
96
96
|
|
|
97
97
|
const { layout, shape } = style;
|
|
98
98
|
|
|
99
|
-
const labelText = typeof fundingConfig.labelText === 'function' ? fundingConfig.labelText({ content }) : (fundingConfig.labelText || fundingSource);
|
|
99
|
+
const labelText = typeof fundingConfig.labelText === 'function' ? fundingConfig.labelText({ content, fundingEligibility }) : (fundingConfig.labelText || fundingSource);
|
|
100
100
|
|
|
101
101
|
const logoNode = (
|
|
102
102
|
<Logo
|
|
@@ -21,13 +21,14 @@ export const DIVIDE_LOGO_CONFIG = {
|
|
|
21
21
|
cssUtilClasses: {
|
|
22
22
|
DOM_READY: CLASS.DOM_READY,
|
|
23
23
|
PAYPAL_LOGO: LOGO_CLASS.LOGO,
|
|
24
|
-
PAYPAL_BUTTON_LABEL: CLASS.BUTTON_LABEL
|
|
24
|
+
PAYPAL_BUTTON_LABEL: CLASS.BUTTON_LABEL,
|
|
25
|
+
PAYPAL_LOGO_PP: CLASS.LOGO_PP
|
|
25
26
|
}
|
|
26
27
|
};
|
|
27
28
|
|
|
28
29
|
// Returns props necessary to render the animation as long as they are valid
|
|
29
30
|
export const getDivideLogoProps = function (document : Object, configuration : Object) : DivideLogoAnimationProps | null {
|
|
30
|
-
const { PAYPAL_BUTTON_LABEL, PAYPAL_LOGO } = configuration.cssUtilClasses;
|
|
31
|
+
const { PAYPAL_BUTTON_LABEL, PAYPAL_LOGO, PAYPAL_LOGO_PP } = configuration.cssUtilClasses;
|
|
31
32
|
|
|
32
33
|
const designContainer = (document && document.querySelector('.personalized-design-container')) || null;
|
|
33
34
|
if (!designContainer) {
|
|
@@ -47,7 +48,7 @@ export const getDivideLogoProps = function (document : Object, configuration : O
|
|
|
47
48
|
}
|
|
48
49
|
|
|
49
50
|
// get starting position for element so it doesn't flicker when animation begins
|
|
50
|
-
const paypalLogoElement = (paypalLabelContainerElement && paypalLabelContainerElement.querySelector(`.${ PAYPAL_LOGO }`)) || null;
|
|
51
|
+
const paypalLogoElement = (paypalLabelContainerElement && paypalLabelContainerElement.querySelector(`.${ PAYPAL_LOGO }.${ PAYPAL_LOGO_PP }`)) || null;
|
|
51
52
|
if (!paypalLogoElement) {
|
|
52
53
|
return null;
|
|
53
54
|
}
|
|
@@ -66,7 +67,8 @@ export function getDivideLogoAnimation(designProps : DivideLogoAnimationProps, c
|
|
|
66
67
|
max,
|
|
67
68
|
cssUtilClasses: {
|
|
68
69
|
DOM_READY,
|
|
69
|
-
PAYPAL_LOGO
|
|
70
|
+
PAYPAL_LOGO,
|
|
71
|
+
PAYPAL_LOGO_PP
|
|
70
72
|
}
|
|
71
73
|
} = configuration;
|
|
72
74
|
|
|
@@ -77,7 +79,7 @@ export function getDivideLogoAnimation(designProps : DivideLogoAnimationProps, c
|
|
|
77
79
|
} = designProps;
|
|
78
80
|
|
|
79
81
|
const designCss = `
|
|
80
|
-
.${ DOM_READY } .personalized-design-container img.${ PAYPAL_LOGO }{
|
|
82
|
+
.${ DOM_READY } .personalized-design-container img.${ PAYPAL_LOGO }.${ PAYPAL_LOGO_PP }{
|
|
81
83
|
animation: 3s divide-logo-animation-left-side 2s infinite alternate;
|
|
82
84
|
}
|
|
83
85
|
|
|
@@ -45,7 +45,7 @@ export const getButtonsComponent : () => ButtonsComponent = memoize(() => {
|
|
|
45
45
|
const { buttonSessionID } = props;
|
|
46
46
|
|
|
47
47
|
if (!isLocalStorageEnabled()) {
|
|
48
|
-
getLogger().info('
|
|
48
|
+
getLogger().info('localstorage_inaccessible_possible_private_browsing').track({
|
|
49
49
|
[ FPTI_KEY.BUTTON_SESSION_UID ]: buttonSessionID,
|
|
50
50
|
[ FPTI_KEY.CONTEXT_TYPE ]: 'button_session_id',
|
|
51
51
|
[ FPTI_KEY.CONTEXT_ID ]: buttonSessionID,
|