@paypal/checkout-components 5.0.395 → 5.0.396
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/package.json
CHANGED
package/src/funding/common.jsx
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
/** @jsx node */
|
|
3
3
|
|
|
4
4
|
import type { FundingEligibilityType } from "@paypal/sdk-client/src";
|
|
5
|
-
import { FUNDING } from "@paypal/sdk-constants/src";
|
|
5
|
+
import { FUNDING, type LocaleType } from "@paypal/sdk-constants/src";
|
|
6
6
|
import { node, Style } from "@krakenjs/jsx-pragmatic/src";
|
|
7
7
|
import {
|
|
8
8
|
PPLogoExternalImage,
|
|
@@ -22,9 +22,11 @@ import css from "./style.scoped.scss";
|
|
|
22
22
|
|
|
23
23
|
function getLabelText(
|
|
24
24
|
fundingEligibility: FundingEligibilityType,
|
|
25
|
+
locale?: LocaleType,
|
|
25
26
|
shouldApplyRebrandedStyles?: boolean
|
|
26
27
|
): ?string {
|
|
27
28
|
const { paylater } = fundingEligibility;
|
|
29
|
+
const { lang } = locale || {};
|
|
28
30
|
|
|
29
31
|
let labelText;
|
|
30
32
|
|
|
@@ -53,6 +55,14 @@ function getLabelText(
|
|
|
53
55
|
labelText = "Paga a rate";
|
|
54
56
|
}
|
|
55
57
|
|
|
58
|
+
if (
|
|
59
|
+
paylater?.products?.paylater?.eligible &&
|
|
60
|
+
paylater?.products?.paylater?.variant === "CA" &&
|
|
61
|
+
lang === "fr"
|
|
62
|
+
) {
|
|
63
|
+
labelText = "Payer en 4";
|
|
64
|
+
}
|
|
65
|
+
|
|
56
66
|
if (paylater?.products?.payIn4?.eligible) {
|
|
57
67
|
labelText = "Pay in 4";
|
|
58
68
|
}
|
|
@@ -104,7 +114,9 @@ export function getPaylaterConfig(): FundingSourceConfig {
|
|
|
104
114
|
) : (
|
|
105
115
|
<PPLogoInlineSVG logoColor={logoColor} />
|
|
106
116
|
)}
|
|
107
|
-
<Text>
|
|
117
|
+
<Text>
|
|
118
|
+
{getLabelText(fundingEligibility, locale) || "Pay Later"}
|
|
119
|
+
</Text>
|
|
108
120
|
</Style>
|
|
109
121
|
);
|
|
110
122
|
}
|
|
@@ -125,8 +137,11 @@ export function getPaylaterConfig(): FundingSourceConfig {
|
|
|
125
137
|
<PPRebrandLogoInlineSVG logoColor={logoColorPP} />
|
|
126
138
|
)}
|
|
127
139
|
<Text>
|
|
128
|
-
{getLabelText(
|
|
129
|
-
|
|
140
|
+
{getLabelText(
|
|
141
|
+
fundingEligibility,
|
|
142
|
+
locale,
|
|
143
|
+
shouldApplyRebrandedStyles
|
|
144
|
+
) || "Pay Later"}
|
|
130
145
|
</Text>
|
|
131
146
|
</Style>
|
|
132
147
|
);
|
|
@@ -175,9 +190,9 @@ export function getPaylaterConfig(): FundingSourceConfig {
|
|
|
175
190
|
[BUTTON_COLOR.REBRAND_BLACK]: LOGO_COLOR.WHITE,
|
|
176
191
|
},
|
|
177
192
|
|
|
178
|
-
labelText: ({ fundingEligibility }) => {
|
|
193
|
+
labelText: ({ fundingEligibility, locale }) => {
|
|
179
194
|
return (
|
|
180
|
-
(fundingEligibility && getLabelText(fundingEligibility)) ||
|
|
195
|
+
(fundingEligibility && getLabelText(fundingEligibility, locale)) ||
|
|
181
196
|
`${FUNDING.PAYPAL} ${FUNDING.PAYLATER}`
|
|
182
197
|
);
|
|
183
198
|
},
|