@delopay/sdk 0.107.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-P56D2ZU2.js → chunk-XMFG7CPX.js} +244 -32
- package/dist/chunk-XMFG7CPX.js.map +1 -0
- package/dist/index.cjs +257 -28
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +651 -108
- package/dist/index.d.ts +651 -108
- package/dist/index.js +35 -1
- package/dist/internal.cjs +257 -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-P56D2ZU2.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
|
});
|
|
@@ -554,6 +571,11 @@ var Connectors = class {
|
|
|
554
571
|
* This is the retrieve path alone. `create` and `update` echo back what the
|
|
555
572
|
* caller sent, and `clone` returns the *copied* secrets — see that method.
|
|
556
573
|
*
|
|
574
|
+
* Because the value is gone, `has_live_webhook_secret` and
|
|
575
|
+
* `has_sandbox_webhook_secret` are what tell a stored webhook signing secret
|
|
576
|
+
* from an unconfigured one. Render those; never infer configuration from the
|
|
577
|
+
* `null` block.
|
|
578
|
+
*
|
|
557
579
|
* `GET /account/{accountId}/connectors/{connectorId}`
|
|
558
580
|
*/
|
|
559
581
|
async retrieve(accountId, connectorId) {
|
|
@@ -594,23 +616,38 @@ var Connectors = class {
|
|
|
594
616
|
);
|
|
595
617
|
}
|
|
596
618
|
/**
|
|
597
|
-
* Every connector's
|
|
598
|
-
*
|
|
599
|
-
*
|
|
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.
|
|
600
622
|
*
|
|
601
623
|
* Capability facts only: no label, sublabel or category comes back. A
|
|
602
624
|
* designer renders a method's copy from its own locale files, keyed by
|
|
603
625
|
* `key`, and takes `payment_method` / `payment_method_type` from here
|
|
604
626
|
* verbatim rather than deriving them client-side.
|
|
605
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
|
+
*
|
|
606
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.
|
|
607
640
|
*/
|
|
608
|
-
async
|
|
641
|
+
async getPanesCatalog(accountId) {
|
|
609
642
|
return this.request(
|
|
610
643
|
"GET",
|
|
611
644
|
`/account/${encodeURIComponent(accountId)}/connectors/native-panes/catalog`
|
|
612
645
|
);
|
|
613
646
|
}
|
|
647
|
+
/** @deprecated Renamed to {@link getPanesCatalog}. Removed in 0.112.0. */
|
|
648
|
+
async getNativePanesCatalog(accountId) {
|
|
649
|
+
return this.getPanesCatalog(accountId);
|
|
650
|
+
}
|
|
614
651
|
/**
|
|
615
652
|
* Sweep the merchant's own e-Payouts module and return the rails it
|
|
616
653
|
* actually has enabled. Server-side this makes many upstream calls, so it
|
|
@@ -624,6 +661,21 @@ var Connectors = class {
|
|
|
624
661
|
`/account/${encodeURIComponent(accountId)}/connectors/${encodeURIComponent(connectorId)}/epayouts/catalog/sync`
|
|
625
662
|
);
|
|
626
663
|
}
|
|
664
|
+
/**
|
|
665
|
+
* Update a connector account.
|
|
666
|
+
*
|
|
667
|
+
* `connector_webhook_details` **merges** into the stored block key by key
|
|
668
|
+
* (be#992): an absent key keeps its stored secret, an explicit value is
|
|
669
|
+
* written, and an explicit empty string clears that secret. Send only the
|
|
670
|
+
* keys the operator typed — padding the other environment's keys with `''`
|
|
671
|
+
* clears a live signing secret and inbound webhooks stop verifying.
|
|
672
|
+
*
|
|
673
|
+
* The other credential-bearing fields — `connector_wallets_details`,
|
|
674
|
+
* `pm_auth_config`, `additional_merchant_data` — are still whole-value
|
|
675
|
+
* replacements: omit them unless you are writing a complete new value.
|
|
676
|
+
*
|
|
677
|
+
* `POST /account/{accountId}/connectors/{connectorId}`
|
|
678
|
+
*/
|
|
627
679
|
async update(accountId, connectorId, params) {
|
|
628
680
|
return this.request(
|
|
629
681
|
"POST",
|
|
@@ -2919,6 +2971,32 @@ var Shops = class {
|
|
|
2919
2971
|
{ body: params, ...options }
|
|
2920
2972
|
);
|
|
2921
2973
|
}
|
|
2974
|
+
/**
|
|
2975
|
+
* Read only the checkout appearance of a shop, so the role that may restyle a
|
|
2976
|
+
* checkout can load the checkout it may restyle.
|
|
2977
|
+
*
|
|
2978
|
+
* Gated on `ProfileCheckoutBrandingRead` — the read twin of the
|
|
2979
|
+
* `ProfileCheckoutBrandingEdit` guard on `updateCheckoutBranding` above.
|
|
2980
|
+
* Prefer this over `shops.retrieve` for the branding editor: `retrieve`
|
|
2981
|
+
* returns the whole profile, including the webhook signing key and the
|
|
2982
|
+
* card-vault configuration, and needs the shop-read permission for exactly
|
|
2983
|
+
* that reason.
|
|
2984
|
+
*
|
|
2985
|
+
* `GET /shops/{merchantId}/{shopId}/checkout-branding`
|
|
2986
|
+
*
|
|
2987
|
+
* @param merchantId - The merchant account ID.
|
|
2988
|
+
* @param shopId - The shop (business profile) ID whose branding to read.
|
|
2989
|
+
* @returns The shop's id, name and stored `payment_link_config`. That config
|
|
2990
|
+
* is `null` when the shop has never been styled — the untouched default, not
|
|
2991
|
+
* an error, and distinct from a stored-but-empty style.
|
|
2992
|
+
*/
|
|
2993
|
+
async retrieveCheckoutBranding(merchantId, shopId, options) {
|
|
2994
|
+
return this.request(
|
|
2995
|
+
"GET",
|
|
2996
|
+
`/shops/${encodeURIComponent(merchantId)}/${encodeURIComponent(shopId)}/checkout-branding`,
|
|
2997
|
+
options
|
|
2998
|
+
);
|
|
2999
|
+
}
|
|
2922
3000
|
};
|
|
2923
3001
|
|
|
2924
3002
|
// src/resources/stripeConnect.ts
|
|
@@ -6330,11 +6408,23 @@ var CheckoutSession = class {
|
|
|
6330
6408
|
}
|
|
6331
6409
|
};
|
|
6332
6410
|
|
|
6333
|
-
// src/
|
|
6334
|
-
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 = [
|
|
6335
6422
|
{
|
|
6336
6423
|
key: "apple_pay",
|
|
6337
6424
|
rail: "wallet",
|
|
6425
|
+
paymentMethod: "wallet",
|
|
6426
|
+
paymentMethodType: "apple_pay",
|
|
6427
|
+
requiresBillingCountry: false,
|
|
6338
6428
|
defaultLabel: "Apple Pay",
|
|
6339
6429
|
defaultSublabel: "Pay with Apple Pay",
|
|
6340
6430
|
defaultCategory: "wallet",
|
|
@@ -6343,6 +6433,9 @@ var STRIPE_NATIVE_PANE_METHODS = [
|
|
|
6343
6433
|
{
|
|
6344
6434
|
key: "google_pay",
|
|
6345
6435
|
rail: "wallet",
|
|
6436
|
+
paymentMethod: "wallet",
|
|
6437
|
+
paymentMethodType: "google_pay",
|
|
6438
|
+
requiresBillingCountry: false,
|
|
6346
6439
|
defaultLabel: "Google Pay",
|
|
6347
6440
|
defaultSublabel: "Pay with Google Pay",
|
|
6348
6441
|
defaultCategory: "wallet",
|
|
@@ -6351,6 +6444,9 @@ var STRIPE_NATIVE_PANE_METHODS = [
|
|
|
6351
6444
|
{
|
|
6352
6445
|
key: "link",
|
|
6353
6446
|
rail: "wallet",
|
|
6447
|
+
paymentMethod: "wallet",
|
|
6448
|
+
paymentMethodType: "link",
|
|
6449
|
+
requiresBillingCountry: false,
|
|
6354
6450
|
defaultLabel: "Link",
|
|
6355
6451
|
defaultSublabel: "Pay with saved details",
|
|
6356
6452
|
defaultCategory: "wallet",
|
|
@@ -6359,7 +6455,18 @@ var STRIPE_NATIVE_PANE_METHODS = [
|
|
|
6359
6455
|
{
|
|
6360
6456
|
key: "klarna",
|
|
6361
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,
|
|
6362
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.
|
|
6363
6470
|
defaultSublabel: "Pay later or in instalments",
|
|
6364
6471
|
defaultCategory: "bnpl",
|
|
6365
6472
|
defaultIcon: "bnpl"
|
|
@@ -6367,6 +6474,9 @@ var STRIPE_NATIVE_PANE_METHODS = [
|
|
|
6367
6474
|
{
|
|
6368
6475
|
key: "affirm",
|
|
6369
6476
|
rail: "redirect",
|
|
6477
|
+
paymentMethod: "pay_later",
|
|
6478
|
+
paymentMethodType: "affirm",
|
|
6479
|
+
requiresBillingCountry: false,
|
|
6370
6480
|
defaultLabel: "Affirm",
|
|
6371
6481
|
defaultSublabel: "Pay over time",
|
|
6372
6482
|
defaultCategory: "bnpl",
|
|
@@ -6375,18 +6485,20 @@ var STRIPE_NATIVE_PANE_METHODS = [
|
|
|
6375
6485
|
{
|
|
6376
6486
|
key: "ideal",
|
|
6377
6487
|
rail: "redirect",
|
|
6488
|
+
paymentMethod: "bank_redirect",
|
|
6489
|
+
paymentMethodType: "ideal",
|
|
6490
|
+
requiresBillingCountry: false,
|
|
6378
6491
|
defaultLabel: "iDEAL",
|
|
6379
6492
|
defaultSublabel: "Pay from your bank",
|
|
6380
6493
|
defaultCategory: "bank_redirect",
|
|
6381
6494
|
defaultIcon: "bank"
|
|
6382
6495
|
},
|
|
6383
|
-
// eps / p24 / bancontact were removed from the router catalog: Stripe
|
|
6384
|
-
// hard-requires billing fields the focused checkout never collects (full
|
|
6385
|
-
// name for EPS/Bancontact, email for Przelewy24), so their tiles could
|
|
6386
|
-
// never succeed. They may return behind billing-aware gating.
|
|
6387
6496
|
{
|
|
6388
6497
|
key: "alipay",
|
|
6389
6498
|
rail: "redirect",
|
|
6499
|
+
paymentMethod: "wallet",
|
|
6500
|
+
paymentMethodType: "ali_pay",
|
|
6501
|
+
requiresBillingCountry: false,
|
|
6390
6502
|
defaultLabel: "Alipay",
|
|
6391
6503
|
defaultSublabel: "Pay with Alipay",
|
|
6392
6504
|
defaultCategory: "wallet",
|
|
@@ -6395,6 +6507,9 @@ var STRIPE_NATIVE_PANE_METHODS = [
|
|
|
6395
6507
|
{
|
|
6396
6508
|
key: "revolut_pay",
|
|
6397
6509
|
rail: "redirect",
|
|
6510
|
+
paymentMethod: "wallet",
|
|
6511
|
+
paymentMethodType: "revolut_pay",
|
|
6512
|
+
requiresBillingCountry: false,
|
|
6398
6513
|
defaultLabel: "Revolut Pay",
|
|
6399
6514
|
defaultSublabel: "Pay with Revolut",
|
|
6400
6515
|
defaultCategory: "wallet",
|
|
@@ -6403,13 +6518,33 @@ var STRIPE_NATIVE_PANE_METHODS = [
|
|
|
6403
6518
|
{
|
|
6404
6519
|
key: "amazon_pay",
|
|
6405
6520
|
rail: "redirect",
|
|
6521
|
+
paymentMethod: "wallet",
|
|
6522
|
+
paymentMethodType: "amazon_pay",
|
|
6523
|
+
requiresBillingCountry: false,
|
|
6406
6524
|
defaultLabel: "Amazon Pay",
|
|
6407
6525
|
defaultSublabel: "Pay with Amazon",
|
|
6408
6526
|
defaultCategory: "wallet",
|
|
6409
6527
|
defaultIcon: "wallet"
|
|
6410
6528
|
}
|
|
6411
6529
|
];
|
|
6412
|
-
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 = [
|
|
6413
6548
|
"wallet",
|
|
6414
6549
|
"card",
|
|
6415
6550
|
"bank",
|
|
@@ -6418,20 +6553,70 @@ var NATIVE_PANE_ICON_KEYS = [
|
|
|
6418
6553
|
"bnpl",
|
|
6419
6554
|
"cash"
|
|
6420
6555
|
];
|
|
6421
|
-
var
|
|
6556
|
+
var PANE_CATEGORY_KEYS = [
|
|
6422
6557
|
"wallet",
|
|
6423
6558
|
"card",
|
|
6424
6559
|
"bnpl",
|
|
6425
6560
|
"bank_redirect",
|
|
6426
6561
|
"bank_transfer",
|
|
6562
|
+
"crypto",
|
|
6563
|
+
"game_items",
|
|
6427
6564
|
"cash"
|
|
6428
6565
|
];
|
|
6429
|
-
var
|
|
6430
|
-
function
|
|
6431
|
-
return
|
|
6566
|
+
var PANES_MAX = 12;
|
|
6567
|
+
function paneMethodInfo(method, catalog = STRIPE_FALLBACK_PANE_CATALOG) {
|
|
6568
|
+
return catalog.methods.find((info) => info.key === method);
|
|
6432
6569
|
}
|
|
6433
|
-
function
|
|
6434
|
-
|
|
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));
|
|
6435
6620
|
return {
|
|
6436
6621
|
method,
|
|
6437
6622
|
enabled: true,
|
|
@@ -6439,15 +6624,15 @@ function defaultNativePane(method) {
|
|
|
6439
6624
|
labelTranslations: {},
|
|
6440
6625
|
sublabel: null,
|
|
6441
6626
|
sublabelTranslations: {},
|
|
6442
|
-
category:
|
|
6443
|
-
icon:
|
|
6627
|
+
category: defaults.category,
|
|
6628
|
+
icon: defaults.icon,
|
|
6444
6629
|
iconSvg: "",
|
|
6445
6630
|
displayOrder: 0,
|
|
6446
6631
|
visibility: "always",
|
|
6447
6632
|
openIn: "tab"
|
|
6448
6633
|
};
|
|
6449
6634
|
}
|
|
6450
|
-
function
|
|
6635
|
+
function clonePane(pane) {
|
|
6451
6636
|
return {
|
|
6452
6637
|
...pane,
|
|
6453
6638
|
labelTranslations: { ...pane.labelTranslations },
|
|
@@ -6474,7 +6659,7 @@ function clampDisplayOrder(raw) {
|
|
|
6474
6659
|
if (!Number.isFinite(raw)) return 0;
|
|
6475
6660
|
return Math.min(DISPLAY_ORDER_MAX, Math.max(DISPLAY_ORDER_MIN, Math.trunc(raw)));
|
|
6476
6661
|
}
|
|
6477
|
-
function
|
|
6662
|
+
function decodePanes(raw) {
|
|
6478
6663
|
if (!Array.isArray(raw)) return null;
|
|
6479
6664
|
const decodeRow = (entry, method) => ({
|
|
6480
6665
|
method,
|
|
@@ -6488,14 +6673,14 @@ function decodeNativePanes(raw) {
|
|
|
6488
6673
|
iconSvg: str(entry["icon_svg"]),
|
|
6489
6674
|
displayOrder: clampDisplayOrder(Number(entry["display_order"])),
|
|
6490
6675
|
// Anything unrecognised degrades to `always` rather than dropping the row.
|
|
6491
|
-
visibility: entry["visibility"]
|
|
6676
|
+
visibility: parseVisibility(entry["visibility"]),
|
|
6492
6677
|
// Same tolerance: an unknown value degrades to the default `tab`.
|
|
6493
6678
|
openIn: entry["open_in"] === "popup" ? "popup" : "tab"
|
|
6494
6679
|
});
|
|
6495
6680
|
const indexByMethod = /* @__PURE__ */ new Map();
|
|
6496
6681
|
const out = [];
|
|
6497
6682
|
for (const entry of raw) {
|
|
6498
|
-
if (out.length >=
|
|
6683
|
+
if (out.length >= PANES_MAX) break;
|
|
6499
6684
|
if (!isObject2(entry)) continue;
|
|
6500
6685
|
const method = str(entry["method"]).trim();
|
|
6501
6686
|
if (!method) continue;
|
|
@@ -6511,12 +6696,12 @@ function decodeNativePanes(raw) {
|
|
|
6511
6696
|
}
|
|
6512
6697
|
return out;
|
|
6513
6698
|
}
|
|
6514
|
-
function
|
|
6699
|
+
function encodePanes(panes) {
|
|
6515
6700
|
const nonEmpty = (map) => {
|
|
6516
6701
|
const entries = Object.entries(map).filter(([, v]) => v.trim().length > 0);
|
|
6517
6702
|
return entries.length > 0 ? Object.fromEntries(entries) : void 0;
|
|
6518
6703
|
};
|
|
6519
|
-
return panes.slice(0,
|
|
6704
|
+
return panes.slice(0, PANES_MAX).map((pane) => {
|
|
6520
6705
|
const labelTranslations = nonEmpty(pane.labelTranslations);
|
|
6521
6706
|
const sublabelTranslations = nonEmpty(pane.sublabelTranslations);
|
|
6522
6707
|
return {
|
|
@@ -6524,7 +6709,7 @@ function encodeNativePanes(panes) {
|
|
|
6524
6709
|
enabled: pane.enabled,
|
|
6525
6710
|
...pane.label.trim() ? { label: pane.label.trim() } : {},
|
|
6526
6711
|
...labelTranslations ? { label_translations: labelTranslations } : {},
|
|
6527
|
-
// `null` omits the key entirely (
|
|
6712
|
+
// `null` omits the key entirely (catalogue default wins); `''` is sent
|
|
6528
6713
|
// as-is because that is how the merchant hides the second line.
|
|
6529
6714
|
...pane.sublabel !== null ? { sublabel: pane.sublabel } : {},
|
|
6530
6715
|
...sublabelTranslations ? { sublabel_translations: sublabelTranslations } : {},
|
|
@@ -6536,8 +6721,13 @@ function encodeNativePanes(panes) {
|
|
|
6536
6721
|
// writing e.g. 3.5 or Date.now() verbatim would silently delete the
|
|
6537
6722
|
// pane at render while every read surface shows it healthy.
|
|
6538
6723
|
display_order: clampDisplayOrder(pane.displayOrder),
|
|
6539
|
-
|
|
6540
|
-
|
|
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"
|
|
6541
6731
|
};
|
|
6542
6732
|
});
|
|
6543
6733
|
}
|
|
@@ -6547,6 +6737,10 @@ function focusedCheckoutUrl(params) {
|
|
|
6547
6737
|
params.paymentId
|
|
6548
6738
|
)}`;
|
|
6549
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);
|
|
6550
6744
|
if (params.locale) query.set("locale", params.locale);
|
|
6551
6745
|
if (params.customFieldsCollected) query.set("cf", "1");
|
|
6552
6746
|
return `${path}?${query.toString()}`;
|
|
@@ -6558,6 +6752,24 @@ var CHECKOUT_EVENT_KINDS = [
|
|
|
6558
6752
|
"native_pane_abandoned",
|
|
6559
6753
|
"native_pane_returned"
|
|
6560
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;
|
|
6561
6773
|
// Annotate the CommonJS export names for ESM import in node:
|
|
6562
6774
|
0 && (module.exports = {
|
|
6563
6775
|
ALL_CUSTOM_FIELD_CONDITION_SOURCES,
|
|
@@ -6595,8 +6807,13 @@ var CHECKOUT_EVENT_KINDS = [
|
|
|
6595
6807
|
NATIVE_PANE_CATEGORY_KEYS,
|
|
6596
6808
|
NATIVE_PANE_ICON_KEYS,
|
|
6597
6809
|
OperationLimits,
|
|
6810
|
+
PANES_MAX,
|
|
6811
|
+
PANE_CATEGORY_KEYS,
|
|
6812
|
+
PANE_ICON_KEYS,
|
|
6598
6813
|
Regions,
|
|
6599
6814
|
Risk,
|
|
6815
|
+
STRIPE_FALLBACK_PANE_CATALOG,
|
|
6816
|
+
STRIPE_FALLBACK_PANE_METHODS,
|
|
6600
6817
|
STRIPE_NATIVE_PANE_METHODS,
|
|
6601
6818
|
Search,
|
|
6602
6819
|
Settlement,
|
|
@@ -6610,6 +6827,7 @@ var CHECKOUT_EVENT_KINDS = [
|
|
|
6610
6827
|
cloneBranding,
|
|
6611
6828
|
cloneCustomField,
|
|
6612
6829
|
cloneNativePane,
|
|
6830
|
+
clonePane,
|
|
6613
6831
|
customFieldContextFromMetadata,
|
|
6614
6832
|
customFieldIsTextLike,
|
|
6615
6833
|
customFieldOperatorTakesValue,
|
|
@@ -6619,14 +6837,18 @@ var CHECKOUT_EVENT_KINDS = [
|
|
|
6619
6837
|
decodeBranding,
|
|
6620
6838
|
decodeCustomFields,
|
|
6621
6839
|
decodeNativePanes,
|
|
6840
|
+
decodePanes,
|
|
6622
6841
|
defaultBranding,
|
|
6623
6842
|
defaultCustomFieldVisibility,
|
|
6624
6843
|
defaultNativePane,
|
|
6625
6844
|
defaultOperatorForSource,
|
|
6845
|
+
defaultPane,
|
|
6846
|
+
emptyPaneCatalog,
|
|
6626
6847
|
encodeBadges,
|
|
6627
6848
|
encodeBranding,
|
|
6628
6849
|
encodeCustomFields,
|
|
6629
6850
|
encodeNativePanes,
|
|
6851
|
+
encodePanes,
|
|
6630
6852
|
evaluateCustomFieldCondition,
|
|
6631
6853
|
evaluateCustomFieldVisibility,
|
|
6632
6854
|
feeProgram,
|
|
@@ -6640,6 +6862,12 @@ var CHECKOUT_EVENT_KINDS = [
|
|
|
6640
6862
|
leaf,
|
|
6641
6863
|
logoDimensions,
|
|
6642
6864
|
nativePaneMethodInfo,
|
|
6865
|
+
offerablePaneMethods,
|
|
6866
|
+
paneCatalogFor,
|
|
6867
|
+
paneDisplayDefaults,
|
|
6868
|
+
paneMethodInfo,
|
|
6869
|
+
paneRailAllowed,
|
|
6870
|
+
paneViewVisibility,
|
|
6643
6871
|
parseCustomFieldsLoose,
|
|
6644
6872
|
parseImportedBranding,
|
|
6645
6873
|
programToTree,
|
|
@@ -6648,6 +6876,7 @@ var CHECKOUT_EVENT_KINDS = [
|
|
|
6648
6876
|
sanitizeCustomCss,
|
|
6649
6877
|
shadowFor,
|
|
6650
6878
|
surfacePadValue,
|
|
6879
|
+
validatePanes,
|
|
6651
6880
|
verticalGapValue,
|
|
6652
6881
|
visibleCustomFields
|
|
6653
6882
|
});
|