@paypal/checkout-components 5.0.265 → 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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@paypal/checkout-components",
3
- "version": "5.0.265",
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 demo/dev/index.htm --https --hot=false --static './'",
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_*",
@@ -62,7 +62,3 @@ export const MENU_PLACEMENT = {
62
62
  ABOVE: ("above": "above"),
63
63
  BELOW: ("below": "below"),
64
64
  };
65
-
66
- export const EXPERIENCE = {
67
- INLINE: ("inline": "inline"),
68
- };
@@ -41,6 +41,4 @@ export const CLASS = {
41
41
  HIDDEN: ("hidden": "hidden"),
42
42
 
43
43
  IMMEDIATE: ("immediate": "immediate"),
44
-
45
- CUSTOM: ("custom": "custom"),
46
44
  };
@@ -20,10 +20,5 @@ declare var __PAYPAL_CHECKOUT__: {|
20
20
  |},
21
21
  |};
22
22
 
23
- declare var __INLINE_CHECKOUT_ELIGIBILITY__: {|
24
- eligible: boolean,
25
- ineligibilityReason: string,
26
- |};
27
-
28
23
  declare var __WEB__: boolean;
29
24
  declare var __TREE_SHAKE__: boolean;
@@ -59,9 +59,6 @@ export function getCardConfig(): FundingSourceConfig {
59
59
  eligible: ({ components, fundingSource, fundingEligibility, wallet }) => {
60
60
  const cardEligibility = fundingEligibility.card;
61
61
 
62
- const hostedFieldsRequested = Boolean(
63
- components.indexOf(COMPONENTS.HOSTED_FIELDS) !== -1
64
- );
65
62
  const cardEligible = Boolean(cardEligibility && cardEligibility.eligible);
66
63
  const cardBranded = Boolean(cardEligibility && cardEligibility.branded);
67
64
  const cardVaulted = Boolean(
@@ -76,23 +73,43 @@ export function getCardConfig(): FundingSourceConfig {
76
73
  return false;
77
74
  }
78
75
 
79
- // If card is branded, always show card buttons
76
+ /*
77
+ *
78
+ * the next 5 if statements are in a very important order. Each if statement relies on the one above
79
+ * to verify we are not in a situation where card fields should or should not be shown. Switching the
80
+ * order of these if statements could break merchant integrations
81
+ *
82
+ * 1. If funding eligibility says branded: true for card, it means that the merchant is not
83
+ * eligible for unbranded experiences. In that case, the card button should always be eligible
84
+ * 2. If the merchant is attempting to render a standalone card, we should mark it as eligible
85
+ * since it is outside of the smart stack
86
+ * 3. If the merchant is using the new card-fields component, the card button should be ineligible
87
+ * because we should not mix branded and unbranded experiences
88
+ * 4. If there is a vaulted card in the buyer's wallet we should show the button. This is very important
89
+ * because the old hosted card fields (hosted-fields) uses the card button as its return buyer experience
90
+ * this is why this check happens before checking if hosted-fields was requested
91
+ * 5. If hosted-fields were requested, we shouldn't show the card button because we shouldn't mix branded and
92
+ * unbranded experience. The exception is for vaulted cards explained in the point above
93
+ *
94
+ */
95
+
80
96
  if (cardBranded) {
81
97
  return true;
82
98
  }
83
99
 
84
- // If there's a vaulted card, always show card button
85
- if (cardVaulted) {
100
+ if (fundingSource === FUNDING.CARD) {
86
101
  return true;
87
102
  }
88
103
 
89
- // If standalone card is selected, always show card button
90
- if (fundingSource === FUNDING.CARD) {
104
+ if (components.includes("card-fields")) {
105
+ return false;
106
+ }
107
+
108
+ if (cardVaulted) {
91
109
  return true;
92
110
  }
93
111
 
94
- // If hosted fields is requested, do not show card buttons
95
- if (hostedFieldsRequested) {
112
+ if (components.includes(COMPONENTS.HOSTED_FIELDS)) {
96
113
  return false;
97
114
  }
98
115
 
@@ -139,32 +156,7 @@ export function getCardConfig(): FundingSourceConfig {
139
156
  );
140
157
  },
141
158
 
142
- Label: ({ logo, locale, content, custom }) => {
143
- if (custom && custom.label && custom.label.length) {
144
- const validLabels = {
145
- buy: "Buy",
146
- checkout: "Checkout",
147
- pay: "Pay",
148
- "buy now": "Buy Now",
149
- "pay now": "Pay Now",
150
- "checkout now": "Checkout Now",
151
- "proceed to checkout": "Proceed to checkout",
152
- };
153
-
154
- let label = validLabels.checkout;
155
-
156
- const lowerCaseLabel = custom.label.toLowerCase();
157
- if (validLabels[lowerCaseLabel]) {
158
- label = validLabels[lowerCaseLabel];
159
- }
160
-
161
- return (
162
- <Fragment>
163
- <Text>{label}</Text>
164
- <Space />
165
- </Fragment>
166
- );
167
- }
159
+ Label: ({ logo, locale, content }) => {
168
160
  const { lang } = locale;
169
161
  const isRTL = isRTLLanguage(lang);
170
162
  return (
@@ -0,0 +1,132 @@
1
+ /* @flow */
2
+ import { describe, test, expect } from "vitest";
3
+ import { FUNDING, COMPONENTS } from "@paypal/sdk-constants/src";
4
+
5
+ import { getCardConfig } from "./config";
6
+
7
+ const getEligibility = ({
8
+ eligible = true,
9
+ branded = false,
10
+ vendors = {},
11
+ } = {}) => ({
12
+ card: {
13
+ eligible,
14
+ branded,
15
+ vendors,
16
+ },
17
+ });
18
+
19
+ const getWallet = ({ card = [] } = {}) => ({
20
+ card: {
21
+ instruments: card,
22
+ },
23
+ credit: {
24
+ instruments: [],
25
+ },
26
+ paypal: {
27
+ instruments: [],
28
+ },
29
+ venmo: {
30
+ instruments: [],
31
+ },
32
+ });
33
+
34
+ describe("card eligibility", () => {
35
+ // $FlowIssue .eligible is marked as optional in type
36
+ const getCardConfigEligible = (...args) => getCardConfig().eligible(...args);
37
+
38
+ test("should not be eligible when funding eligibility is false", () => {
39
+ expect(
40
+ getCardConfigEligible({
41
+ components: [],
42
+ fundingSource: FUNDING.PAYPAL,
43
+ fundingEligibility: getEligibility({ eligible: false }),
44
+ // $FlowIssue
45
+ wallet: getWallet(),
46
+ })
47
+ ).toEqual(false);
48
+ });
49
+
50
+ test("should be eligible if card funding eligibility says branded is true", () => {
51
+ expect(
52
+ getCardConfigEligible({
53
+ components: [],
54
+ fundingSource: FUNDING.PAYPAL,
55
+ fundingEligibility: getEligibility({ branded: true }),
56
+ wallet: getWallet(),
57
+ })
58
+ ).toEqual(true);
59
+ });
60
+
61
+ test("should be eligible if standalone card was rendered", () => {
62
+ expect(
63
+ getCardConfigEligible({
64
+ components: [],
65
+ fundingSource: FUNDING.CARD,
66
+ fundingEligibility: getEligibility(),
67
+ wallet: getWallet(),
68
+ })
69
+ ).toEqual(true);
70
+ });
71
+
72
+ test("should be ineligible if card-fields were requested", () => {
73
+ expect(
74
+ getCardConfigEligible({
75
+ // $FlowIssue need to add the new card fields as a constant
76
+ components: ["card-fields"],
77
+ fundingSource: FUNDING.PAYPAL,
78
+ fundingEligibility: getEligibility(),
79
+ wallet: getWallet(),
80
+ })
81
+ ).toEqual(false);
82
+ });
83
+
84
+ test("should be ineligible if card-fields were requested, even if there is a vaulted instrument", () => {
85
+ expect(
86
+ getCardConfigEligible({
87
+ // $FlowIssue need to add the new card fields as a constant
88
+ components: ["card-fields"],
89
+ fundingSource: FUNDING.PAYPAL,
90
+ fundingEligibility: getEligibility(),
91
+ wallet: getWallet({
92
+ card: ["some instrument"],
93
+ }),
94
+ })
95
+ ).toEqual(false);
96
+ });
97
+
98
+ test("should be eligible if there is a vaulted card", () => {
99
+ expect(
100
+ getCardConfigEligible({
101
+ components: [],
102
+ fundingSource: FUNDING.PAYPAL,
103
+ fundingEligibility: getEligibility(),
104
+ wallet: getWallet({
105
+ card: ["some instrument"],
106
+ }),
107
+ })
108
+ ).toEqual(true);
109
+ });
110
+
111
+ test("should be ineligible if hosted-fields was requested", () => {
112
+ expect(
113
+ getCardConfigEligible({
114
+ components: [COMPONENTS.HOSTED_FIELDS],
115
+ fundingSource: FUNDING.PAYPAL,
116
+ fundingEligibility: getEligibility(),
117
+ wallet: getWallet(),
118
+ })
119
+ ).toEqual(false);
120
+ });
121
+
122
+ test("should default to true", () => {
123
+ expect(
124
+ getCardConfigEligible({
125
+ components: [],
126
+ fundingSource: FUNDING.PAYPAL,
127
+ fundingEligibility: getEligibility(),
128
+ wallet: getWallet(),
129
+ })
130
+ ).toEqual(true);
131
+ });
132
+ });
@@ -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 = {|
@@ -126,10 +124,10 @@ export type FundingSourceConfig = {|
126
124
  vendors?: { [$Values<typeof CARD>]: ?CardConfig },
127
125
  eligible?: ({|
128
126
  components: $ReadOnlyArray<$Values<typeof COMPONENTS>>,
129
- experiment: ?Experiment,
127
+ experiment?: ?Experiment,
130
128
  fundingEligibility: FundingEligibilityType,
131
129
  fundingSource: ?$Values<typeof FUNDING>,
132
- layout: ?$Values<typeof BUTTON_LAYOUT>,
130
+ layout?: ?$Values<typeof BUTTON_LAYOUT>,
133
131
  wallet: ?Wallet,
134
132
  |}) => boolean,
135
133
  Logo: (LogoOptions) => ChildType,
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 { custom, layout, shape } = style;
95
- const inlineExperience =
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 { custom, layout, shape, tagline } = style;
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
- if (inlineExperience) {
220
- fundingSources = [
221
- FUNDING.CARD,
222
- ...fundingSources.filter((src) => src !== FUNDING.CARD),
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
- if (!inlineExperience) {
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
 
@@ -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, CustomStyle, Wallet, Experiment } from "../../types";
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
  }
@@ -18,8 +18,8 @@ export function Style({
18
18
  nonce,
19
19
  fundingEligibility,
20
20
  }: StyleProps): ElementNode {
21
- const { custom = { label: undefined, css: undefined }, height } = style;
22
- const css = componentStyle({ custom, height, fundingEligibility });
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: {