@paypal/checkout-components 5.0.270-alpha.2 → 5.0.270

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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@paypal/checkout-components",
3
- "version": "5.0.270-alpha.2",
3
+ "version": "5.0.270",
4
4
  "description": "PayPal Checkout components, for integrating checkout products.",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -86,9 +86,9 @@
86
86
  "jest": "^29.3.1",
87
87
  "karma": "^6.0.0",
88
88
  "karma-coverage": "^2.0.3",
89
- "lint-staged": "^12.3.4",
89
+ "lint-staged": "^13.0.0",
90
90
  "memory-fs": "^0.5.0",
91
- "mocha": "^4.1.0",
91
+ "mocha": "^10.0.0",
92
92
  "mocketeer": "^0.3.1",
93
93
  "pixelmatch": "^5.2.1",
94
94
  "playwright": "^1.29.1",
@@ -96,7 +96,7 @@
96
96
  "prettier": "^2.5.1",
97
97
  "prettier-plugin-sh": "^0.10.0",
98
98
  "puppeteer": "^1.20.0",
99
- "serve": "^13.0.0",
99
+ "serve": "^14.0.0",
100
100
  "vite": "^3.2.4",
101
101
  "vitest": "^0.25.3"
102
102
  },
@@ -109,7 +109,7 @@
109
109
  "@krakenjs/zoid": "^10.0.0",
110
110
  "@paypal/common-components": "^1.0.35",
111
111
  "@paypal/funding-components": "^1.0.31",
112
- "@paypal/sdk-client": "4.0.171-pwv-1",
112
+ "@paypal/sdk-client": "^4.0.166",
113
113
  "@paypal/sdk-constants": "^1.0.128",
114
114
  "@paypal/sdk-logos": "^2.2.6"
115
115
  },
@@ -151,6 +151,8 @@ export type FundingSourceConfig = {|
151
151
  | (({|
152
152
  content: ?ContentType,
153
153
  fundingEligibility: ?FundingEligibilityType,
154
+ label?: string,
155
+ period?: number,
154
156
  |}) => string),
155
157
  showWalletMenu: ({|
156
158
  instrument: WalletInstrument,
@@ -4,7 +4,12 @@
4
4
  import { LOGO_COLOR } from "@paypal/sdk-logos/src";
5
5
  import { FUNDING_BRAND_LABEL } from "@paypal/sdk-constants/src";
6
6
 
7
- import { BUTTON_COLOR, BUTTON_LAYOUT, BUTTON_FLOW } from "../../constants";
7
+ import {
8
+ BUTTON_COLOR,
9
+ BUTTON_LAYOUT,
10
+ BUTTON_FLOW,
11
+ BUTTON_LABEL,
12
+ } from "../../constants";
8
13
  import { DEFAULT_FUNDING_CONFIG, type FundingSourceConfig } from "../common";
9
14
 
10
15
  import { Logo, Label, WalletLabel, Tag } from "./template";
@@ -38,8 +43,22 @@ export function getPayPalConfig(): FundingSourceConfig {
38
43
  [BUTTON_COLOR.WHITE]: LOGO_COLOR.BLUE,
39
44
  },
40
45
 
41
- labelText: `${FUNDING_BRAND_LABEL.PAYPAL}`,
42
-
46
+ labelText: ({ content, label, period }) => {
47
+ let text = `${FUNDING_BRAND_LABEL.PAYPAL}`;
48
+ if (content && label === BUTTON_LABEL.INSTALLMENT) {
49
+ if (period) {
50
+ text = content["label.installment.withPeriod"].replace(
51
+ "{period}",
52
+ String(period)
53
+ );
54
+ } else {
55
+ text = content["label.installment.withoutPeriod"];
56
+ }
57
+ } else if (content && label) {
58
+ text = content[`label.${label}`];
59
+ }
60
+ return text;
61
+ },
43
62
  Logo,
44
63
  Label,
45
64
  WalletLabel,
package/src/types.js CHANGED
@@ -48,6 +48,12 @@ export type ContentType = {|
48
48
  flex: string,
49
49
  payPalBalance: string,
50
50
  moreOptions: string,
51
+ "label.paypal": string,
52
+ "label.checkout": string,
53
+ "label.buynow": string,
54
+ "label.pay": string,
55
+ "label.installment.withPeriod": string,
56
+ "label.installment.withoutPeriod": string,
51
57
  |};
52
58
 
53
59
  export type Experiment = {|
@@ -144,7 +144,12 @@ export function Button({
144
144
  function getAriaLabel(): string {
145
145
  let labelText =
146
146
  typeof fundingConfig.labelText === "function"
147
- ? fundingConfig.labelText({ content, fundingEligibility })
147
+ ? fundingConfig.labelText({
148
+ content,
149
+ fundingEligibility,
150
+ label,
151
+ period,
152
+ })
148
153
  : fundingConfig.labelText || fundingSource;
149
154
 
150
155
  if (!showPayLabel && instrument?.vendor && instrument.label) {
@@ -246,6 +246,7 @@ export function getCheckoutComponent(): CheckoutComponent {
246
246
  onAuth: {
247
247
  type: "function",
248
248
  required: false,
249
+ sameDomain: true,
249
250
  },
250
251
 
251
252
  onSmartWalletEligible: {