@delopay/sdk 0.108.0 → 0.109.0
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/dist/{chunk-C2O3D7ZM.js → chunk-XMFG7CPX.js} +198 -32
- package/dist/chunk-XMFG7CPX.js.map +1 -0
- package/dist/index.cjs +211 -28
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +513 -103
- package/dist/index.d.ts +513 -103
- package/dist/index.js +35 -1
- package/dist/internal.cjs +211 -28
- package/dist/internal.cjs.map +1 -1
- package/dist/internal.d.cts +1 -1
- package/dist/internal.d.ts +1 -1
- package/dist/internal.js +35 -1
- package/dist/internal.js.map +1 -1
- package/package.json +1 -1
- package/dist/chunk-C2O3D7ZM.js.map +0 -1
package/dist/index.cjs
CHANGED
|
@@ -55,8 +55,13 @@ __export(index_exports, {
|
|
|
55
55
|
NATIVE_PANE_CATEGORY_KEYS: () => NATIVE_PANE_CATEGORY_KEYS,
|
|
56
56
|
NATIVE_PANE_ICON_KEYS: () => NATIVE_PANE_ICON_KEYS,
|
|
57
57
|
OperationLimits: () => OperationLimits,
|
|
58
|
+
PANES_MAX: () => PANES_MAX,
|
|
59
|
+
PANE_CATEGORY_KEYS: () => PANE_CATEGORY_KEYS,
|
|
60
|
+
PANE_ICON_KEYS: () => PANE_ICON_KEYS,
|
|
58
61
|
Regions: () => Regions,
|
|
59
62
|
Risk: () => Risk,
|
|
63
|
+
STRIPE_FALLBACK_PANE_CATALOG: () => STRIPE_FALLBACK_PANE_CATALOG,
|
|
64
|
+
STRIPE_FALLBACK_PANE_METHODS: () => STRIPE_FALLBACK_PANE_METHODS,
|
|
60
65
|
STRIPE_NATIVE_PANE_METHODS: () => STRIPE_NATIVE_PANE_METHODS,
|
|
61
66
|
Search: () => Search,
|
|
62
67
|
Settlement: () => Settlement,
|
|
@@ -70,6 +75,7 @@ __export(index_exports, {
|
|
|
70
75
|
cloneBranding: () => cloneBranding,
|
|
71
76
|
cloneCustomField: () => cloneCustomField,
|
|
72
77
|
cloneNativePane: () => cloneNativePane,
|
|
78
|
+
clonePane: () => clonePane,
|
|
73
79
|
customFieldContextFromMetadata: () => customFieldContextFromMetadata,
|
|
74
80
|
customFieldIsTextLike: () => customFieldIsTextLike,
|
|
75
81
|
customFieldOperatorTakesValue: () => customFieldOperatorTakesValue,
|
|
@@ -79,14 +85,18 @@ __export(index_exports, {
|
|
|
79
85
|
decodeBranding: () => decodeBranding,
|
|
80
86
|
decodeCustomFields: () => decodeCustomFields,
|
|
81
87
|
decodeNativePanes: () => decodeNativePanes,
|
|
88
|
+
decodePanes: () => decodePanes,
|
|
82
89
|
defaultBranding: () => defaultBranding,
|
|
83
90
|
defaultCustomFieldVisibility: () => defaultCustomFieldVisibility,
|
|
84
91
|
defaultNativePane: () => defaultNativePane,
|
|
85
92
|
defaultOperatorForSource: () => defaultOperatorForSource,
|
|
93
|
+
defaultPane: () => defaultPane,
|
|
94
|
+
emptyPaneCatalog: () => emptyPaneCatalog,
|
|
86
95
|
encodeBadges: () => encodeBadges,
|
|
87
96
|
encodeBranding: () => encodeBranding,
|
|
88
97
|
encodeCustomFields: () => encodeCustomFields,
|
|
89
98
|
encodeNativePanes: () => encodeNativePanes,
|
|
99
|
+
encodePanes: () => encodePanes,
|
|
90
100
|
evaluateCustomFieldCondition: () => evaluateCustomFieldCondition,
|
|
91
101
|
evaluateCustomFieldVisibility: () => evaluateCustomFieldVisibility,
|
|
92
102
|
feeProgram: () => feeProgram,
|
|
@@ -100,6 +110,12 @@ __export(index_exports, {
|
|
|
100
110
|
leaf: () => leaf,
|
|
101
111
|
logoDimensions: () => logoDimensions,
|
|
102
112
|
nativePaneMethodInfo: () => nativePaneMethodInfo,
|
|
113
|
+
offerablePaneMethods: () => offerablePaneMethods,
|
|
114
|
+
paneCatalogFor: () => paneCatalogFor,
|
|
115
|
+
paneDisplayDefaults: () => paneDisplayDefaults,
|
|
116
|
+
paneMethodInfo: () => paneMethodInfo,
|
|
117
|
+
paneRailAllowed: () => paneRailAllowed,
|
|
118
|
+
paneViewVisibility: () => paneViewVisibility,
|
|
103
119
|
parseCustomFieldsLoose: () => parseCustomFieldsLoose,
|
|
104
120
|
parseImportedBranding: () => parseImportedBranding,
|
|
105
121
|
programToTree: () => programToTree,
|
|
@@ -108,6 +124,7 @@ __export(index_exports, {
|
|
|
108
124
|
sanitizeCustomCss: () => sanitizeCustomCss,
|
|
109
125
|
shadowFor: () => shadowFor,
|
|
110
126
|
surfacePadValue: () => surfacePadValue,
|
|
127
|
+
validatePanes: () => validatePanes,
|
|
111
128
|
verticalGapValue: () => verticalGapValue,
|
|
112
129
|
visibleCustomFields: () => visibleCustomFields
|
|
113
130
|
});
|
|
@@ -599,23 +616,38 @@ var Connectors = class {
|
|
|
599
616
|
);
|
|
600
617
|
}
|
|
601
618
|
/**
|
|
602
|
-
* Every connector's
|
|
603
|
-
*
|
|
604
|
-
*
|
|
619
|
+
* Every connector's pane capabilities, as the router itself knows them —
|
|
620
|
+
* which rails a connector supports, and which methods it can publish as a
|
|
621
|
+
* pane with the confirm routing keys each one carries.
|
|
605
622
|
*
|
|
606
623
|
* Capability facts only: no label, sublabel or category comes back. A
|
|
607
624
|
* designer renders a method's copy from its own locale files, keyed by
|
|
608
625
|
* `key`, and takes `payment_method` / `payment_method_type` from here
|
|
609
626
|
* verbatim rather than deriving them client-side.
|
|
610
627
|
*
|
|
628
|
+
* This is what the pane helpers in `src/panes.ts` should be driven from —
|
|
629
|
+
* `paneMethodInfo`, `defaultPane` and `validatePanes` all take a
|
|
630
|
+
* {@link PanesConnectorCatalog} out of this response, so a connector the
|
|
631
|
+
* router starts publishing panes for needs no SDK release.
|
|
632
|
+
*
|
|
611
633
|
* `GET /account/{accountId}/connectors/native-panes/catalog`
|
|
634
|
+
*
|
|
635
|
+
* The path keeps the `native-panes` spelling deliberately. The identifiers
|
|
636
|
+
* were renamed off "native pane"; the route was not, and pointing at the
|
|
637
|
+
* backend's new name before it is deployed everywhere would both 404 against
|
|
638
|
+
* un-upgraded replicas mid-rollout and fail `scripts/parity-check.mjs`,
|
|
639
|
+
* which blocks publishing.
|
|
612
640
|
*/
|
|
613
|
-
async
|
|
641
|
+
async getPanesCatalog(accountId) {
|
|
614
642
|
return this.request(
|
|
615
643
|
"GET",
|
|
616
644
|
`/account/${encodeURIComponent(accountId)}/connectors/native-panes/catalog`
|
|
617
645
|
);
|
|
618
646
|
}
|
|
647
|
+
/** @deprecated Renamed to {@link getPanesCatalog}. Removed in 0.112.0. */
|
|
648
|
+
async getNativePanesCatalog(accountId) {
|
|
649
|
+
return this.getPanesCatalog(accountId);
|
|
650
|
+
}
|
|
619
651
|
/**
|
|
620
652
|
* Sweep the merchant's own e-Payouts module and return the rails it
|
|
621
653
|
* actually has enabled. Server-side this makes many upstream calls, so it
|
|
@@ -6376,11 +6408,23 @@ var CheckoutSession = class {
|
|
|
6376
6408
|
}
|
|
6377
6409
|
};
|
|
6378
6410
|
|
|
6379
|
-
// src/
|
|
6380
|
-
var
|
|
6411
|
+
// src/panes.ts
|
|
6412
|
+
var PANE_VISIBILITIES = ["always", "embedded_only", "external_only"];
|
|
6413
|
+
function parseVisibility(raw) {
|
|
6414
|
+
return PANE_VISIBILITIES.find((value) => value === raw) ?? "always";
|
|
6415
|
+
}
|
|
6416
|
+
function paneViewVisibility(view) {
|
|
6417
|
+
const declared = PANE_VISIBILITIES.find((value) => value === view.visibility);
|
|
6418
|
+
if (declared) return declared;
|
|
6419
|
+
return view.embedded_only === true ? "embedded_only" : "always";
|
|
6420
|
+
}
|
|
6421
|
+
var STRIPE_FALLBACK_PANE_METHODS = [
|
|
6381
6422
|
{
|
|
6382
6423
|
key: "apple_pay",
|
|
6383
6424
|
rail: "wallet",
|
|
6425
|
+
paymentMethod: "wallet",
|
|
6426
|
+
paymentMethodType: "apple_pay",
|
|
6427
|
+
requiresBillingCountry: false,
|
|
6384
6428
|
defaultLabel: "Apple Pay",
|
|
6385
6429
|
defaultSublabel: "Pay with Apple Pay",
|
|
6386
6430
|
defaultCategory: "wallet",
|
|
@@ -6389,6 +6433,9 @@ var STRIPE_NATIVE_PANE_METHODS = [
|
|
|
6389
6433
|
{
|
|
6390
6434
|
key: "google_pay",
|
|
6391
6435
|
rail: "wallet",
|
|
6436
|
+
paymentMethod: "wallet",
|
|
6437
|
+
paymentMethodType: "google_pay",
|
|
6438
|
+
requiresBillingCountry: false,
|
|
6392
6439
|
defaultLabel: "Google Pay",
|
|
6393
6440
|
defaultSublabel: "Pay with Google Pay",
|
|
6394
6441
|
defaultCategory: "wallet",
|
|
@@ -6397,6 +6444,9 @@ var STRIPE_NATIVE_PANE_METHODS = [
|
|
|
6397
6444
|
{
|
|
6398
6445
|
key: "link",
|
|
6399
6446
|
rail: "wallet",
|
|
6447
|
+
paymentMethod: "wallet",
|
|
6448
|
+
paymentMethodType: "link",
|
|
6449
|
+
requiresBillingCountry: false,
|
|
6400
6450
|
defaultLabel: "Link",
|
|
6401
6451
|
defaultSublabel: "Pay with saved details",
|
|
6402
6452
|
defaultCategory: "wallet",
|
|
@@ -6405,7 +6455,18 @@ var STRIPE_NATIVE_PANE_METHODS = [
|
|
|
6405
6455
|
{
|
|
6406
6456
|
key: "klarna",
|
|
6407
6457
|
rail: "redirect",
|
|
6458
|
+
paymentMethod: "pay_later",
|
|
6459
|
+
paymentMethodType: "klarna",
|
|
6460
|
+
// Stripe's Klarna needs the buyer's country echoed into the confirm body.
|
|
6461
|
+
requiresBillingCountry: true,
|
|
6408
6462
|
defaultLabel: "Klarna",
|
|
6463
|
+
// NOT the router's current "Pay later or in 3 instalments". This table is
|
|
6464
|
+
// what a router predating the capability endpoint (delopay-backend#964)
|
|
6465
|
+
// renders, and that copy only gained the "3" in delopay-backend#1051 —
|
|
6466
|
+
// the same release that added the endpoint. Restating the new string here
|
|
6467
|
+
// would put copy no reachable router emits in front of a merchant, and
|
|
6468
|
+
// would change what the deprecated `nativePaneMethodInfo` has returned
|
|
6469
|
+
// since 0.106.0.
|
|
6409
6470
|
defaultSublabel: "Pay later or in instalments",
|
|
6410
6471
|
defaultCategory: "bnpl",
|
|
6411
6472
|
defaultIcon: "bnpl"
|
|
@@ -6413,6 +6474,9 @@ var STRIPE_NATIVE_PANE_METHODS = [
|
|
|
6413
6474
|
{
|
|
6414
6475
|
key: "affirm",
|
|
6415
6476
|
rail: "redirect",
|
|
6477
|
+
paymentMethod: "pay_later",
|
|
6478
|
+
paymentMethodType: "affirm",
|
|
6479
|
+
requiresBillingCountry: false,
|
|
6416
6480
|
defaultLabel: "Affirm",
|
|
6417
6481
|
defaultSublabel: "Pay over time",
|
|
6418
6482
|
defaultCategory: "bnpl",
|
|
@@ -6421,18 +6485,20 @@ var STRIPE_NATIVE_PANE_METHODS = [
|
|
|
6421
6485
|
{
|
|
6422
6486
|
key: "ideal",
|
|
6423
6487
|
rail: "redirect",
|
|
6488
|
+
paymentMethod: "bank_redirect",
|
|
6489
|
+
paymentMethodType: "ideal",
|
|
6490
|
+
requiresBillingCountry: false,
|
|
6424
6491
|
defaultLabel: "iDEAL",
|
|
6425
6492
|
defaultSublabel: "Pay from your bank",
|
|
6426
6493
|
defaultCategory: "bank_redirect",
|
|
6427
6494
|
defaultIcon: "bank"
|
|
6428
6495
|
},
|
|
6429
|
-
// eps / p24 / bancontact were removed from the router catalog: Stripe
|
|
6430
|
-
// hard-requires billing fields the focused checkout never collects (full
|
|
6431
|
-
// name for EPS/Bancontact, email for Przelewy24), so their tiles could
|
|
6432
|
-
// never succeed. They may return behind billing-aware gating.
|
|
6433
6496
|
{
|
|
6434
6497
|
key: "alipay",
|
|
6435
6498
|
rail: "redirect",
|
|
6499
|
+
paymentMethod: "wallet",
|
|
6500
|
+
paymentMethodType: "ali_pay",
|
|
6501
|
+
requiresBillingCountry: false,
|
|
6436
6502
|
defaultLabel: "Alipay",
|
|
6437
6503
|
defaultSublabel: "Pay with Alipay",
|
|
6438
6504
|
defaultCategory: "wallet",
|
|
@@ -6441,6 +6507,9 @@ var STRIPE_NATIVE_PANE_METHODS = [
|
|
|
6441
6507
|
{
|
|
6442
6508
|
key: "revolut_pay",
|
|
6443
6509
|
rail: "redirect",
|
|
6510
|
+
paymentMethod: "wallet",
|
|
6511
|
+
paymentMethodType: "revolut_pay",
|
|
6512
|
+
requiresBillingCountry: false,
|
|
6444
6513
|
defaultLabel: "Revolut Pay",
|
|
6445
6514
|
defaultSublabel: "Pay with Revolut",
|
|
6446
6515
|
defaultCategory: "wallet",
|
|
@@ -6449,13 +6518,33 @@ var STRIPE_NATIVE_PANE_METHODS = [
|
|
|
6449
6518
|
{
|
|
6450
6519
|
key: "amazon_pay",
|
|
6451
6520
|
rail: "redirect",
|
|
6521
|
+
paymentMethod: "wallet",
|
|
6522
|
+
paymentMethodType: "amazon_pay",
|
|
6523
|
+
requiresBillingCountry: false,
|
|
6452
6524
|
defaultLabel: "Amazon Pay",
|
|
6453
6525
|
defaultSublabel: "Pay with Amazon",
|
|
6454
6526
|
defaultCategory: "wallet",
|
|
6455
6527
|
defaultIcon: "wallet"
|
|
6456
6528
|
}
|
|
6457
6529
|
];
|
|
6458
|
-
var
|
|
6530
|
+
var STRIPE_FALLBACK_PANE_CATALOG = {
|
|
6531
|
+
connector: "stripe",
|
|
6532
|
+
allowed_rails: ["wallet", "redirect"],
|
|
6533
|
+
methods: STRIPE_FALLBACK_PANE_METHODS.map((info) => ({
|
|
6534
|
+
key: info.key,
|
|
6535
|
+
rail: info.rail,
|
|
6536
|
+
payment_method: info.paymentMethod,
|
|
6537
|
+
payment_method_type: info.paymentMethodType,
|
|
6538
|
+
requires_billing_country: info.requiresBillingCountry
|
|
6539
|
+
}))
|
|
6540
|
+
};
|
|
6541
|
+
function emptyPaneCatalog(connector) {
|
|
6542
|
+
return { connector, allowed_rails: [], methods: [] };
|
|
6543
|
+
}
|
|
6544
|
+
function paneCatalogFor(response, connector) {
|
|
6545
|
+
return response.connectors.find((entry) => entry.connector === connector) ?? emptyPaneCatalog(connector);
|
|
6546
|
+
}
|
|
6547
|
+
var PANE_ICON_KEYS = [
|
|
6459
6548
|
"wallet",
|
|
6460
6549
|
"card",
|
|
6461
6550
|
"bank",
|
|
@@ -6464,20 +6553,70 @@ var NATIVE_PANE_ICON_KEYS = [
|
|
|
6464
6553
|
"bnpl",
|
|
6465
6554
|
"cash"
|
|
6466
6555
|
];
|
|
6467
|
-
var
|
|
6556
|
+
var PANE_CATEGORY_KEYS = [
|
|
6468
6557
|
"wallet",
|
|
6469
6558
|
"card",
|
|
6470
6559
|
"bnpl",
|
|
6471
6560
|
"bank_redirect",
|
|
6472
6561
|
"bank_transfer",
|
|
6562
|
+
"crypto",
|
|
6563
|
+
"game_items",
|
|
6473
6564
|
"cash"
|
|
6474
6565
|
];
|
|
6475
|
-
var
|
|
6476
|
-
function
|
|
6477
|
-
return
|
|
6566
|
+
var PANES_MAX = 12;
|
|
6567
|
+
function paneMethodInfo(method, catalog = STRIPE_FALLBACK_PANE_CATALOG) {
|
|
6568
|
+
return catalog.methods.find((info) => info.key === method);
|
|
6478
6569
|
}
|
|
6479
|
-
function
|
|
6480
|
-
|
|
6570
|
+
function paneRailAllowed(rail, catalog) {
|
|
6571
|
+
return catalog.allowed_rails.includes(rail);
|
|
6572
|
+
}
|
|
6573
|
+
function offerablePaneMethods(catalog) {
|
|
6574
|
+
return catalog.methods.filter((info) => paneRailAllowed(info.rail, catalog));
|
|
6575
|
+
}
|
|
6576
|
+
var DISPLAY_DEFAULTS_BY_KEY = {
|
|
6577
|
+
apple_pay: { icon: "apple", category: "wallet" },
|
|
6578
|
+
google_pay: { icon: "google", category: "wallet" }
|
|
6579
|
+
};
|
|
6580
|
+
var DISPLAY_DEFAULTS_BY_PAYMENT_METHOD = {
|
|
6581
|
+
wallet: { icon: "wallet", category: "wallet" },
|
|
6582
|
+
card: { icon: "card", category: "card" },
|
|
6583
|
+
card_redirect: { icon: "card", category: "card" },
|
|
6584
|
+
pay_later: { icon: "bnpl", category: "bnpl" },
|
|
6585
|
+
bank_redirect: { icon: "bank", category: "bank_redirect" },
|
|
6586
|
+
bank_transfer: { icon: "bank", category: "bank_transfer" },
|
|
6587
|
+
bank_debit: { icon: "bank", category: "bank_transfer" },
|
|
6588
|
+
crypto: { icon: "wallet", category: "crypto" },
|
|
6589
|
+
game_items: { icon: "wallet", category: "game_items" },
|
|
6590
|
+
cash: { icon: "cash", category: "cash" },
|
|
6591
|
+
voucher: { icon: "cash", category: "cash" }
|
|
6592
|
+
};
|
|
6593
|
+
var DISPLAY_DEFAULTS_FALLBACK = { icon: "wallet", category: "wallet" };
|
|
6594
|
+
function paneDisplayDefaults(info) {
|
|
6595
|
+
if (!info) return DISPLAY_DEFAULTS_FALLBACK;
|
|
6596
|
+
return DISPLAY_DEFAULTS_BY_KEY[info.key] ?? DISPLAY_DEFAULTS_BY_PAYMENT_METHOD[info.payment_method] ?? DISPLAY_DEFAULTS_FALLBACK;
|
|
6597
|
+
}
|
|
6598
|
+
function validatePanes(panes, catalog = STRIPE_FALLBACK_PANE_CATALOG) {
|
|
6599
|
+
const issues = [];
|
|
6600
|
+
const claimedBy = /* @__PURE__ */ new Set();
|
|
6601
|
+
panes.forEach((pane, index) => {
|
|
6602
|
+
const info = paneMethodInfo(pane.method, catalog);
|
|
6603
|
+
if (!info) {
|
|
6604
|
+
issues.push({ index, method: pane.method, code: "method_unknown" });
|
|
6605
|
+
} else if (!paneRailAllowed(info.rail, catalog)) {
|
|
6606
|
+
issues.push({ index, method: pane.method, code: "rail_not_allowed" });
|
|
6607
|
+
} else if (pane.enabled) {
|
|
6608
|
+
if (claimedBy.has(info.key)) {
|
|
6609
|
+
issues.push({ index, method: pane.method, code: "duplicate_method" });
|
|
6610
|
+
} else {
|
|
6611
|
+
claimedBy.add(info.key);
|
|
6612
|
+
}
|
|
6613
|
+
}
|
|
6614
|
+
if (index >= PANES_MAX) issues.push({ index, method: pane.method, code: "over_cap" });
|
|
6615
|
+
});
|
|
6616
|
+
return issues;
|
|
6617
|
+
}
|
|
6618
|
+
function defaultPane(method, catalog = STRIPE_FALLBACK_PANE_CATALOG) {
|
|
6619
|
+
const defaults = paneDisplayDefaults(paneMethodInfo(method, catalog));
|
|
6481
6620
|
return {
|
|
6482
6621
|
method,
|
|
6483
6622
|
enabled: true,
|
|
@@ -6485,15 +6624,15 @@ function defaultNativePane(method) {
|
|
|
6485
6624
|
labelTranslations: {},
|
|
6486
6625
|
sublabel: null,
|
|
6487
6626
|
sublabelTranslations: {},
|
|
6488
|
-
category:
|
|
6489
|
-
icon:
|
|
6627
|
+
category: defaults.category,
|
|
6628
|
+
icon: defaults.icon,
|
|
6490
6629
|
iconSvg: "",
|
|
6491
6630
|
displayOrder: 0,
|
|
6492
6631
|
visibility: "always",
|
|
6493
6632
|
openIn: "tab"
|
|
6494
6633
|
};
|
|
6495
6634
|
}
|
|
6496
|
-
function
|
|
6635
|
+
function clonePane(pane) {
|
|
6497
6636
|
return {
|
|
6498
6637
|
...pane,
|
|
6499
6638
|
labelTranslations: { ...pane.labelTranslations },
|
|
@@ -6520,7 +6659,7 @@ function clampDisplayOrder(raw) {
|
|
|
6520
6659
|
if (!Number.isFinite(raw)) return 0;
|
|
6521
6660
|
return Math.min(DISPLAY_ORDER_MAX, Math.max(DISPLAY_ORDER_MIN, Math.trunc(raw)));
|
|
6522
6661
|
}
|
|
6523
|
-
function
|
|
6662
|
+
function decodePanes(raw) {
|
|
6524
6663
|
if (!Array.isArray(raw)) return null;
|
|
6525
6664
|
const decodeRow = (entry, method) => ({
|
|
6526
6665
|
method,
|
|
@@ -6534,14 +6673,14 @@ function decodeNativePanes(raw) {
|
|
|
6534
6673
|
iconSvg: str(entry["icon_svg"]),
|
|
6535
6674
|
displayOrder: clampDisplayOrder(Number(entry["display_order"])),
|
|
6536
6675
|
// Anything unrecognised degrades to `always` rather than dropping the row.
|
|
6537
|
-
visibility: entry["visibility"]
|
|
6676
|
+
visibility: parseVisibility(entry["visibility"]),
|
|
6538
6677
|
// Same tolerance: an unknown value degrades to the default `tab`.
|
|
6539
6678
|
openIn: entry["open_in"] === "popup" ? "popup" : "tab"
|
|
6540
6679
|
});
|
|
6541
6680
|
const indexByMethod = /* @__PURE__ */ new Map();
|
|
6542
6681
|
const out = [];
|
|
6543
6682
|
for (const entry of raw) {
|
|
6544
|
-
if (out.length >=
|
|
6683
|
+
if (out.length >= PANES_MAX) break;
|
|
6545
6684
|
if (!isObject2(entry)) continue;
|
|
6546
6685
|
const method = str(entry["method"]).trim();
|
|
6547
6686
|
if (!method) continue;
|
|
@@ -6557,12 +6696,12 @@ function decodeNativePanes(raw) {
|
|
|
6557
6696
|
}
|
|
6558
6697
|
return out;
|
|
6559
6698
|
}
|
|
6560
|
-
function
|
|
6699
|
+
function encodePanes(panes) {
|
|
6561
6700
|
const nonEmpty = (map) => {
|
|
6562
6701
|
const entries = Object.entries(map).filter(([, v]) => v.trim().length > 0);
|
|
6563
6702
|
return entries.length > 0 ? Object.fromEntries(entries) : void 0;
|
|
6564
6703
|
};
|
|
6565
|
-
return panes.slice(0,
|
|
6704
|
+
return panes.slice(0, PANES_MAX).map((pane) => {
|
|
6566
6705
|
const labelTranslations = nonEmpty(pane.labelTranslations);
|
|
6567
6706
|
const sublabelTranslations = nonEmpty(pane.sublabelTranslations);
|
|
6568
6707
|
return {
|
|
@@ -6570,7 +6709,7 @@ function encodeNativePanes(panes) {
|
|
|
6570
6709
|
enabled: pane.enabled,
|
|
6571
6710
|
...pane.label.trim() ? { label: pane.label.trim() } : {},
|
|
6572
6711
|
...labelTranslations ? { label_translations: labelTranslations } : {},
|
|
6573
|
-
// `null` omits the key entirely (
|
|
6712
|
+
// `null` omits the key entirely (catalogue default wins); `''` is sent
|
|
6574
6713
|
// as-is because that is how the merchant hides the second line.
|
|
6575
6714
|
...pane.sublabel !== null ? { sublabel: pane.sublabel } : {},
|
|
6576
6715
|
...sublabelTranslations ? { sublabel_translations: sublabelTranslations } : {},
|
|
@@ -6582,8 +6721,13 @@ function encodeNativePanes(panes) {
|
|
|
6582
6721
|
// writing e.g. 3.5 or Date.now() verbatim would silently delete the
|
|
6583
6722
|
// pane at render while every read surface shows it healthy.
|
|
6584
6723
|
display_order: clampDisplayOrder(pane.displayOrder),
|
|
6585
|
-
|
|
6586
|
-
|
|
6724
|
+
// Normalised on encode for the same reason `display_order` is clamped:
|
|
6725
|
+
// the router's strict row decode drops a row whole on a value outside
|
|
6726
|
+
// its enum, and a caller who built a `Pane` by hand (or in plain JS)
|
|
6727
|
+
// never went through `decodePanes`. A decoded pane always holds a valid
|
|
6728
|
+
// value, so this is a no-op on the round-trip path.
|
|
6729
|
+
visibility: parseVisibility(pane.visibility),
|
|
6730
|
+
open_in: pane.openIn === "popup" ? "popup" : "tab"
|
|
6587
6731
|
};
|
|
6588
6732
|
});
|
|
6589
6733
|
}
|
|
@@ -6593,6 +6737,10 @@ function focusedCheckoutUrl(params) {
|
|
|
6593
6737
|
params.paymentId
|
|
6594
6738
|
)}`;
|
|
6595
6739
|
const query = new URLSearchParams({ pane: params.method });
|
|
6740
|
+
const connector = params.connector?.trim();
|
|
6741
|
+
if (connector) query.set("connector", connector);
|
|
6742
|
+
const merchantConnectorId = params.merchantConnectorId?.trim();
|
|
6743
|
+
if (merchantConnectorId) query.set("mca", merchantConnectorId);
|
|
6596
6744
|
if (params.locale) query.set("locale", params.locale);
|
|
6597
6745
|
if (params.customFieldsCollected) query.set("cf", "1");
|
|
6598
6746
|
return `${path}?${query.toString()}`;
|
|
@@ -6604,6 +6752,24 @@ var CHECKOUT_EVENT_KINDS = [
|
|
|
6604
6752
|
"native_pane_abandoned",
|
|
6605
6753
|
"native_pane_returned"
|
|
6606
6754
|
];
|
|
6755
|
+
var STRIPE_NATIVE_PANE_METHODS = STRIPE_FALLBACK_PANE_METHODS;
|
|
6756
|
+
var NATIVE_PANE_ICON_KEYS = PANE_ICON_KEYS;
|
|
6757
|
+
var NATIVE_PANE_CATEGORY_KEYS = PANE_CATEGORY_KEYS;
|
|
6758
|
+
var NATIVE_PANES_MAX = PANES_MAX;
|
|
6759
|
+
function nativePaneMethodInfo(method) {
|
|
6760
|
+
return STRIPE_FALLBACK_PANE_METHODS.find((info) => info.key === method);
|
|
6761
|
+
}
|
|
6762
|
+
function defaultNativePane(method) {
|
|
6763
|
+
const info = nativePaneMethodInfo(method);
|
|
6764
|
+
return {
|
|
6765
|
+
...defaultPane(method),
|
|
6766
|
+
category: "",
|
|
6767
|
+
icon: info?.defaultIcon ?? ""
|
|
6768
|
+
};
|
|
6769
|
+
}
|
|
6770
|
+
var cloneNativePane = clonePane;
|
|
6771
|
+
var decodeNativePanes = decodePanes;
|
|
6772
|
+
var encodeNativePanes = encodePanes;
|
|
6607
6773
|
// Annotate the CommonJS export names for ESM import in node:
|
|
6608
6774
|
0 && (module.exports = {
|
|
6609
6775
|
ALL_CUSTOM_FIELD_CONDITION_SOURCES,
|
|
@@ -6641,8 +6807,13 @@ var CHECKOUT_EVENT_KINDS = [
|
|
|
6641
6807
|
NATIVE_PANE_CATEGORY_KEYS,
|
|
6642
6808
|
NATIVE_PANE_ICON_KEYS,
|
|
6643
6809
|
OperationLimits,
|
|
6810
|
+
PANES_MAX,
|
|
6811
|
+
PANE_CATEGORY_KEYS,
|
|
6812
|
+
PANE_ICON_KEYS,
|
|
6644
6813
|
Regions,
|
|
6645
6814
|
Risk,
|
|
6815
|
+
STRIPE_FALLBACK_PANE_CATALOG,
|
|
6816
|
+
STRIPE_FALLBACK_PANE_METHODS,
|
|
6646
6817
|
STRIPE_NATIVE_PANE_METHODS,
|
|
6647
6818
|
Search,
|
|
6648
6819
|
Settlement,
|
|
@@ -6656,6 +6827,7 @@ var CHECKOUT_EVENT_KINDS = [
|
|
|
6656
6827
|
cloneBranding,
|
|
6657
6828
|
cloneCustomField,
|
|
6658
6829
|
cloneNativePane,
|
|
6830
|
+
clonePane,
|
|
6659
6831
|
customFieldContextFromMetadata,
|
|
6660
6832
|
customFieldIsTextLike,
|
|
6661
6833
|
customFieldOperatorTakesValue,
|
|
@@ -6665,14 +6837,18 @@ var CHECKOUT_EVENT_KINDS = [
|
|
|
6665
6837
|
decodeBranding,
|
|
6666
6838
|
decodeCustomFields,
|
|
6667
6839
|
decodeNativePanes,
|
|
6840
|
+
decodePanes,
|
|
6668
6841
|
defaultBranding,
|
|
6669
6842
|
defaultCustomFieldVisibility,
|
|
6670
6843
|
defaultNativePane,
|
|
6671
6844
|
defaultOperatorForSource,
|
|
6845
|
+
defaultPane,
|
|
6846
|
+
emptyPaneCatalog,
|
|
6672
6847
|
encodeBadges,
|
|
6673
6848
|
encodeBranding,
|
|
6674
6849
|
encodeCustomFields,
|
|
6675
6850
|
encodeNativePanes,
|
|
6851
|
+
encodePanes,
|
|
6676
6852
|
evaluateCustomFieldCondition,
|
|
6677
6853
|
evaluateCustomFieldVisibility,
|
|
6678
6854
|
feeProgram,
|
|
@@ -6686,6 +6862,12 @@ var CHECKOUT_EVENT_KINDS = [
|
|
|
6686
6862
|
leaf,
|
|
6687
6863
|
logoDimensions,
|
|
6688
6864
|
nativePaneMethodInfo,
|
|
6865
|
+
offerablePaneMethods,
|
|
6866
|
+
paneCatalogFor,
|
|
6867
|
+
paneDisplayDefaults,
|
|
6868
|
+
paneMethodInfo,
|
|
6869
|
+
paneRailAllowed,
|
|
6870
|
+
paneViewVisibility,
|
|
6689
6871
|
parseCustomFieldsLoose,
|
|
6690
6872
|
parseImportedBranding,
|
|
6691
6873
|
programToTree,
|
|
@@ -6694,6 +6876,7 @@ var CHECKOUT_EVENT_KINDS = [
|
|
|
6694
6876
|
sanitizeCustomCss,
|
|
6695
6877
|
shadowFor,
|
|
6696
6878
|
surfacePadValue,
|
|
6879
|
+
validatePanes,
|
|
6697
6880
|
verticalGapValue,
|
|
6698
6881
|
visibleCustomFields
|
|
6699
6882
|
});
|