@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
|
@@ -439,6 +439,11 @@ var Connectors = class {
|
|
|
439
439
|
* This is the retrieve path alone. `create` and `update` echo back what the
|
|
440
440
|
* caller sent, and `clone` returns the *copied* secrets — see that method.
|
|
441
441
|
*
|
|
442
|
+
* Because the value is gone, `has_live_webhook_secret` and
|
|
443
|
+
* `has_sandbox_webhook_secret` are what tell a stored webhook signing secret
|
|
444
|
+
* from an unconfigured one. Render those; never infer configuration from the
|
|
445
|
+
* `null` block.
|
|
446
|
+
*
|
|
442
447
|
* `GET /account/{accountId}/connectors/{connectorId}`
|
|
443
448
|
*/
|
|
444
449
|
async retrieve(accountId, connectorId) {
|
|
@@ -479,23 +484,38 @@ var Connectors = class {
|
|
|
479
484
|
);
|
|
480
485
|
}
|
|
481
486
|
/**
|
|
482
|
-
* Every connector's
|
|
483
|
-
*
|
|
484
|
-
*
|
|
487
|
+
* Every connector's pane capabilities, as the router itself knows them —
|
|
488
|
+
* which rails a connector supports, and which methods it can publish as a
|
|
489
|
+
* pane with the confirm routing keys each one carries.
|
|
485
490
|
*
|
|
486
491
|
* Capability facts only: no label, sublabel or category comes back. A
|
|
487
492
|
* designer renders a method's copy from its own locale files, keyed by
|
|
488
493
|
* `key`, and takes `payment_method` / `payment_method_type` from here
|
|
489
494
|
* verbatim rather than deriving them client-side.
|
|
490
495
|
*
|
|
496
|
+
* This is what the pane helpers in `src/panes.ts` should be driven from —
|
|
497
|
+
* `paneMethodInfo`, `defaultPane` and `validatePanes` all take a
|
|
498
|
+
* {@link PanesConnectorCatalog} out of this response, so a connector the
|
|
499
|
+
* router starts publishing panes for needs no SDK release.
|
|
500
|
+
*
|
|
491
501
|
* `GET /account/{accountId}/connectors/native-panes/catalog`
|
|
502
|
+
*
|
|
503
|
+
* The path keeps the `native-panes` spelling deliberately. The identifiers
|
|
504
|
+
* were renamed off "native pane"; the route was not, and pointing at the
|
|
505
|
+
* backend's new name before it is deployed everywhere would both 404 against
|
|
506
|
+
* un-upgraded replicas mid-rollout and fail `scripts/parity-check.mjs`,
|
|
507
|
+
* which blocks publishing.
|
|
492
508
|
*/
|
|
493
|
-
async
|
|
509
|
+
async getPanesCatalog(accountId) {
|
|
494
510
|
return this.request(
|
|
495
511
|
"GET",
|
|
496
512
|
`/account/${encodeURIComponent(accountId)}/connectors/native-panes/catalog`
|
|
497
513
|
);
|
|
498
514
|
}
|
|
515
|
+
/** @deprecated Renamed to {@link getPanesCatalog}. Removed in 0.112.0. */
|
|
516
|
+
async getNativePanesCatalog(accountId) {
|
|
517
|
+
return this.getPanesCatalog(accountId);
|
|
518
|
+
}
|
|
499
519
|
/**
|
|
500
520
|
* Sweep the merchant's own e-Payouts module and return the rails it
|
|
501
521
|
* actually has enabled. Server-side this makes many upstream calls, so it
|
|
@@ -509,6 +529,21 @@ var Connectors = class {
|
|
|
509
529
|
`/account/${encodeURIComponent(accountId)}/connectors/${encodeURIComponent(connectorId)}/epayouts/catalog/sync`
|
|
510
530
|
);
|
|
511
531
|
}
|
|
532
|
+
/**
|
|
533
|
+
* Update a connector account.
|
|
534
|
+
*
|
|
535
|
+
* `connector_webhook_details` **merges** into the stored block key by key
|
|
536
|
+
* (be#992): an absent key keeps its stored secret, an explicit value is
|
|
537
|
+
* written, and an explicit empty string clears that secret. Send only the
|
|
538
|
+
* keys the operator typed — padding the other environment's keys with `''`
|
|
539
|
+
* clears a live signing secret and inbound webhooks stop verifying.
|
|
540
|
+
*
|
|
541
|
+
* The other credential-bearing fields — `connector_wallets_details`,
|
|
542
|
+
* `pm_auth_config`, `additional_merchant_data` — are still whole-value
|
|
543
|
+
* replacements: omit them unless you are writing a complete new value.
|
|
544
|
+
*
|
|
545
|
+
* `POST /account/{accountId}/connectors/{connectorId}`
|
|
546
|
+
*/
|
|
512
547
|
async update(accountId, connectorId, params) {
|
|
513
548
|
return this.request(
|
|
514
549
|
"POST",
|
|
@@ -2804,6 +2839,32 @@ var Shops = class {
|
|
|
2804
2839
|
{ body: params, ...options }
|
|
2805
2840
|
);
|
|
2806
2841
|
}
|
|
2842
|
+
/**
|
|
2843
|
+
* Read only the checkout appearance of a shop, so the role that may restyle a
|
|
2844
|
+
* checkout can load the checkout it may restyle.
|
|
2845
|
+
*
|
|
2846
|
+
* Gated on `ProfileCheckoutBrandingRead` — the read twin of the
|
|
2847
|
+
* `ProfileCheckoutBrandingEdit` guard on `updateCheckoutBranding` above.
|
|
2848
|
+
* Prefer this over `shops.retrieve` for the branding editor: `retrieve`
|
|
2849
|
+
* returns the whole profile, including the webhook signing key and the
|
|
2850
|
+
* card-vault configuration, and needs the shop-read permission for exactly
|
|
2851
|
+
* that reason.
|
|
2852
|
+
*
|
|
2853
|
+
* `GET /shops/{merchantId}/{shopId}/checkout-branding`
|
|
2854
|
+
*
|
|
2855
|
+
* @param merchantId - The merchant account ID.
|
|
2856
|
+
* @param shopId - The shop (business profile) ID whose branding to read.
|
|
2857
|
+
* @returns The shop's id, name and stored `payment_link_config`. That config
|
|
2858
|
+
* is `null` when the shop has never been styled — the untouched default, not
|
|
2859
|
+
* an error, and distinct from a stored-but-empty style.
|
|
2860
|
+
*/
|
|
2861
|
+
async retrieveCheckoutBranding(merchantId, shopId, options) {
|
|
2862
|
+
return this.request(
|
|
2863
|
+
"GET",
|
|
2864
|
+
`/shops/${encodeURIComponent(merchantId)}/${encodeURIComponent(shopId)}/checkout-branding`,
|
|
2865
|
+
options
|
|
2866
|
+
);
|
|
2867
|
+
}
|
|
2807
2868
|
};
|
|
2808
2869
|
|
|
2809
2870
|
// src/resources/stripeConnect.ts
|
|
@@ -6215,11 +6276,23 @@ var CheckoutSession = class {
|
|
|
6215
6276
|
}
|
|
6216
6277
|
};
|
|
6217
6278
|
|
|
6218
|
-
// src/
|
|
6219
|
-
var
|
|
6279
|
+
// src/panes.ts
|
|
6280
|
+
var PANE_VISIBILITIES = ["always", "embedded_only", "external_only"];
|
|
6281
|
+
function parseVisibility(raw) {
|
|
6282
|
+
return PANE_VISIBILITIES.find((value) => value === raw) ?? "always";
|
|
6283
|
+
}
|
|
6284
|
+
function paneViewVisibility(view) {
|
|
6285
|
+
const declared = PANE_VISIBILITIES.find((value) => value === view.visibility);
|
|
6286
|
+
if (declared) return declared;
|
|
6287
|
+
return view.embedded_only === true ? "embedded_only" : "always";
|
|
6288
|
+
}
|
|
6289
|
+
var STRIPE_FALLBACK_PANE_METHODS = [
|
|
6220
6290
|
{
|
|
6221
6291
|
key: "apple_pay",
|
|
6222
6292
|
rail: "wallet",
|
|
6293
|
+
paymentMethod: "wallet",
|
|
6294
|
+
paymentMethodType: "apple_pay",
|
|
6295
|
+
requiresBillingCountry: false,
|
|
6223
6296
|
defaultLabel: "Apple Pay",
|
|
6224
6297
|
defaultSublabel: "Pay with Apple Pay",
|
|
6225
6298
|
defaultCategory: "wallet",
|
|
@@ -6228,6 +6301,9 @@ var STRIPE_NATIVE_PANE_METHODS = [
|
|
|
6228
6301
|
{
|
|
6229
6302
|
key: "google_pay",
|
|
6230
6303
|
rail: "wallet",
|
|
6304
|
+
paymentMethod: "wallet",
|
|
6305
|
+
paymentMethodType: "google_pay",
|
|
6306
|
+
requiresBillingCountry: false,
|
|
6231
6307
|
defaultLabel: "Google Pay",
|
|
6232
6308
|
defaultSublabel: "Pay with Google Pay",
|
|
6233
6309
|
defaultCategory: "wallet",
|
|
@@ -6236,6 +6312,9 @@ var STRIPE_NATIVE_PANE_METHODS = [
|
|
|
6236
6312
|
{
|
|
6237
6313
|
key: "link",
|
|
6238
6314
|
rail: "wallet",
|
|
6315
|
+
paymentMethod: "wallet",
|
|
6316
|
+
paymentMethodType: "link",
|
|
6317
|
+
requiresBillingCountry: false,
|
|
6239
6318
|
defaultLabel: "Link",
|
|
6240
6319
|
defaultSublabel: "Pay with saved details",
|
|
6241
6320
|
defaultCategory: "wallet",
|
|
@@ -6244,7 +6323,18 @@ var STRIPE_NATIVE_PANE_METHODS = [
|
|
|
6244
6323
|
{
|
|
6245
6324
|
key: "klarna",
|
|
6246
6325
|
rail: "redirect",
|
|
6326
|
+
paymentMethod: "pay_later",
|
|
6327
|
+
paymentMethodType: "klarna",
|
|
6328
|
+
// Stripe's Klarna needs the buyer's country echoed into the confirm body.
|
|
6329
|
+
requiresBillingCountry: true,
|
|
6247
6330
|
defaultLabel: "Klarna",
|
|
6331
|
+
// NOT the router's current "Pay later or in 3 instalments". This table is
|
|
6332
|
+
// what a router predating the capability endpoint (delopay-backend#964)
|
|
6333
|
+
// renders, and that copy only gained the "3" in delopay-backend#1051 —
|
|
6334
|
+
// the same release that added the endpoint. Restating the new string here
|
|
6335
|
+
// would put copy no reachable router emits in front of a merchant, and
|
|
6336
|
+
// would change what the deprecated `nativePaneMethodInfo` has returned
|
|
6337
|
+
// since 0.106.0.
|
|
6248
6338
|
defaultSublabel: "Pay later or in instalments",
|
|
6249
6339
|
defaultCategory: "bnpl",
|
|
6250
6340
|
defaultIcon: "bnpl"
|
|
@@ -6252,6 +6342,9 @@ var STRIPE_NATIVE_PANE_METHODS = [
|
|
|
6252
6342
|
{
|
|
6253
6343
|
key: "affirm",
|
|
6254
6344
|
rail: "redirect",
|
|
6345
|
+
paymentMethod: "pay_later",
|
|
6346
|
+
paymentMethodType: "affirm",
|
|
6347
|
+
requiresBillingCountry: false,
|
|
6255
6348
|
defaultLabel: "Affirm",
|
|
6256
6349
|
defaultSublabel: "Pay over time",
|
|
6257
6350
|
defaultCategory: "bnpl",
|
|
@@ -6260,18 +6353,20 @@ var STRIPE_NATIVE_PANE_METHODS = [
|
|
|
6260
6353
|
{
|
|
6261
6354
|
key: "ideal",
|
|
6262
6355
|
rail: "redirect",
|
|
6356
|
+
paymentMethod: "bank_redirect",
|
|
6357
|
+
paymentMethodType: "ideal",
|
|
6358
|
+
requiresBillingCountry: false,
|
|
6263
6359
|
defaultLabel: "iDEAL",
|
|
6264
6360
|
defaultSublabel: "Pay from your bank",
|
|
6265
6361
|
defaultCategory: "bank_redirect",
|
|
6266
6362
|
defaultIcon: "bank"
|
|
6267
6363
|
},
|
|
6268
|
-
// eps / p24 / bancontact were removed from the router catalog: Stripe
|
|
6269
|
-
// hard-requires billing fields the focused checkout never collects (full
|
|
6270
|
-
// name for EPS/Bancontact, email for Przelewy24), so their tiles could
|
|
6271
|
-
// never succeed. They may return behind billing-aware gating.
|
|
6272
6364
|
{
|
|
6273
6365
|
key: "alipay",
|
|
6274
6366
|
rail: "redirect",
|
|
6367
|
+
paymentMethod: "wallet",
|
|
6368
|
+
paymentMethodType: "ali_pay",
|
|
6369
|
+
requiresBillingCountry: false,
|
|
6275
6370
|
defaultLabel: "Alipay",
|
|
6276
6371
|
defaultSublabel: "Pay with Alipay",
|
|
6277
6372
|
defaultCategory: "wallet",
|
|
@@ -6280,6 +6375,9 @@ var STRIPE_NATIVE_PANE_METHODS = [
|
|
|
6280
6375
|
{
|
|
6281
6376
|
key: "revolut_pay",
|
|
6282
6377
|
rail: "redirect",
|
|
6378
|
+
paymentMethod: "wallet",
|
|
6379
|
+
paymentMethodType: "revolut_pay",
|
|
6380
|
+
requiresBillingCountry: false,
|
|
6283
6381
|
defaultLabel: "Revolut Pay",
|
|
6284
6382
|
defaultSublabel: "Pay with Revolut",
|
|
6285
6383
|
defaultCategory: "wallet",
|
|
@@ -6288,13 +6386,33 @@ var STRIPE_NATIVE_PANE_METHODS = [
|
|
|
6288
6386
|
{
|
|
6289
6387
|
key: "amazon_pay",
|
|
6290
6388
|
rail: "redirect",
|
|
6389
|
+
paymentMethod: "wallet",
|
|
6390
|
+
paymentMethodType: "amazon_pay",
|
|
6391
|
+
requiresBillingCountry: false,
|
|
6291
6392
|
defaultLabel: "Amazon Pay",
|
|
6292
6393
|
defaultSublabel: "Pay with Amazon",
|
|
6293
6394
|
defaultCategory: "wallet",
|
|
6294
6395
|
defaultIcon: "wallet"
|
|
6295
6396
|
}
|
|
6296
6397
|
];
|
|
6297
|
-
var
|
|
6398
|
+
var STRIPE_FALLBACK_PANE_CATALOG = {
|
|
6399
|
+
connector: "stripe",
|
|
6400
|
+
allowed_rails: ["wallet", "redirect"],
|
|
6401
|
+
methods: STRIPE_FALLBACK_PANE_METHODS.map((info) => ({
|
|
6402
|
+
key: info.key,
|
|
6403
|
+
rail: info.rail,
|
|
6404
|
+
payment_method: info.paymentMethod,
|
|
6405
|
+
payment_method_type: info.paymentMethodType,
|
|
6406
|
+
requires_billing_country: info.requiresBillingCountry
|
|
6407
|
+
}))
|
|
6408
|
+
};
|
|
6409
|
+
function emptyPaneCatalog(connector) {
|
|
6410
|
+
return { connector, allowed_rails: [], methods: [] };
|
|
6411
|
+
}
|
|
6412
|
+
function paneCatalogFor(response, connector) {
|
|
6413
|
+
return response.connectors.find((entry) => entry.connector === connector) ?? emptyPaneCatalog(connector);
|
|
6414
|
+
}
|
|
6415
|
+
var PANE_ICON_KEYS = [
|
|
6298
6416
|
"wallet",
|
|
6299
6417
|
"card",
|
|
6300
6418
|
"bank",
|
|
@@ -6303,20 +6421,70 @@ var NATIVE_PANE_ICON_KEYS = [
|
|
|
6303
6421
|
"bnpl",
|
|
6304
6422
|
"cash"
|
|
6305
6423
|
];
|
|
6306
|
-
var
|
|
6424
|
+
var PANE_CATEGORY_KEYS = [
|
|
6307
6425
|
"wallet",
|
|
6308
6426
|
"card",
|
|
6309
6427
|
"bnpl",
|
|
6310
6428
|
"bank_redirect",
|
|
6311
6429
|
"bank_transfer",
|
|
6430
|
+
"crypto",
|
|
6431
|
+
"game_items",
|
|
6312
6432
|
"cash"
|
|
6313
6433
|
];
|
|
6314
|
-
var
|
|
6315
|
-
function
|
|
6316
|
-
return
|
|
6434
|
+
var PANES_MAX = 12;
|
|
6435
|
+
function paneMethodInfo(method, catalog = STRIPE_FALLBACK_PANE_CATALOG) {
|
|
6436
|
+
return catalog.methods.find((info) => info.key === method);
|
|
6317
6437
|
}
|
|
6318
|
-
function
|
|
6319
|
-
|
|
6438
|
+
function paneRailAllowed(rail, catalog) {
|
|
6439
|
+
return catalog.allowed_rails.includes(rail);
|
|
6440
|
+
}
|
|
6441
|
+
function offerablePaneMethods(catalog) {
|
|
6442
|
+
return catalog.methods.filter((info) => paneRailAllowed(info.rail, catalog));
|
|
6443
|
+
}
|
|
6444
|
+
var DISPLAY_DEFAULTS_BY_KEY = {
|
|
6445
|
+
apple_pay: { icon: "apple", category: "wallet" },
|
|
6446
|
+
google_pay: { icon: "google", category: "wallet" }
|
|
6447
|
+
};
|
|
6448
|
+
var DISPLAY_DEFAULTS_BY_PAYMENT_METHOD = {
|
|
6449
|
+
wallet: { icon: "wallet", category: "wallet" },
|
|
6450
|
+
card: { icon: "card", category: "card" },
|
|
6451
|
+
card_redirect: { icon: "card", category: "card" },
|
|
6452
|
+
pay_later: { icon: "bnpl", category: "bnpl" },
|
|
6453
|
+
bank_redirect: { icon: "bank", category: "bank_redirect" },
|
|
6454
|
+
bank_transfer: { icon: "bank", category: "bank_transfer" },
|
|
6455
|
+
bank_debit: { icon: "bank", category: "bank_transfer" },
|
|
6456
|
+
crypto: { icon: "wallet", category: "crypto" },
|
|
6457
|
+
game_items: { icon: "wallet", category: "game_items" },
|
|
6458
|
+
cash: { icon: "cash", category: "cash" },
|
|
6459
|
+
voucher: { icon: "cash", category: "cash" }
|
|
6460
|
+
};
|
|
6461
|
+
var DISPLAY_DEFAULTS_FALLBACK = { icon: "wallet", category: "wallet" };
|
|
6462
|
+
function paneDisplayDefaults(info) {
|
|
6463
|
+
if (!info) return DISPLAY_DEFAULTS_FALLBACK;
|
|
6464
|
+
return DISPLAY_DEFAULTS_BY_KEY[info.key] ?? DISPLAY_DEFAULTS_BY_PAYMENT_METHOD[info.payment_method] ?? DISPLAY_DEFAULTS_FALLBACK;
|
|
6465
|
+
}
|
|
6466
|
+
function validatePanes(panes, catalog = STRIPE_FALLBACK_PANE_CATALOG) {
|
|
6467
|
+
const issues = [];
|
|
6468
|
+
const claimedBy = /* @__PURE__ */ new Set();
|
|
6469
|
+
panes.forEach((pane, index) => {
|
|
6470
|
+
const info = paneMethodInfo(pane.method, catalog);
|
|
6471
|
+
if (!info) {
|
|
6472
|
+
issues.push({ index, method: pane.method, code: "method_unknown" });
|
|
6473
|
+
} else if (!paneRailAllowed(info.rail, catalog)) {
|
|
6474
|
+
issues.push({ index, method: pane.method, code: "rail_not_allowed" });
|
|
6475
|
+
} else if (pane.enabled) {
|
|
6476
|
+
if (claimedBy.has(info.key)) {
|
|
6477
|
+
issues.push({ index, method: pane.method, code: "duplicate_method" });
|
|
6478
|
+
} else {
|
|
6479
|
+
claimedBy.add(info.key);
|
|
6480
|
+
}
|
|
6481
|
+
}
|
|
6482
|
+
if (index >= PANES_MAX) issues.push({ index, method: pane.method, code: "over_cap" });
|
|
6483
|
+
});
|
|
6484
|
+
return issues;
|
|
6485
|
+
}
|
|
6486
|
+
function defaultPane(method, catalog = STRIPE_FALLBACK_PANE_CATALOG) {
|
|
6487
|
+
const defaults = paneDisplayDefaults(paneMethodInfo(method, catalog));
|
|
6320
6488
|
return {
|
|
6321
6489
|
method,
|
|
6322
6490
|
enabled: true,
|
|
@@ -6324,15 +6492,15 @@ function defaultNativePane(method) {
|
|
|
6324
6492
|
labelTranslations: {},
|
|
6325
6493
|
sublabel: null,
|
|
6326
6494
|
sublabelTranslations: {},
|
|
6327
|
-
category:
|
|
6328
|
-
icon:
|
|
6495
|
+
category: defaults.category,
|
|
6496
|
+
icon: defaults.icon,
|
|
6329
6497
|
iconSvg: "",
|
|
6330
6498
|
displayOrder: 0,
|
|
6331
6499
|
visibility: "always",
|
|
6332
6500
|
openIn: "tab"
|
|
6333
6501
|
};
|
|
6334
6502
|
}
|
|
6335
|
-
function
|
|
6503
|
+
function clonePane(pane) {
|
|
6336
6504
|
return {
|
|
6337
6505
|
...pane,
|
|
6338
6506
|
labelTranslations: { ...pane.labelTranslations },
|
|
@@ -6359,7 +6527,7 @@ function clampDisplayOrder(raw) {
|
|
|
6359
6527
|
if (!Number.isFinite(raw)) return 0;
|
|
6360
6528
|
return Math.min(DISPLAY_ORDER_MAX, Math.max(DISPLAY_ORDER_MIN, Math.trunc(raw)));
|
|
6361
6529
|
}
|
|
6362
|
-
function
|
|
6530
|
+
function decodePanes(raw) {
|
|
6363
6531
|
if (!Array.isArray(raw)) return null;
|
|
6364
6532
|
const decodeRow = (entry, method) => ({
|
|
6365
6533
|
method,
|
|
@@ -6373,14 +6541,14 @@ function decodeNativePanes(raw) {
|
|
|
6373
6541
|
iconSvg: str(entry["icon_svg"]),
|
|
6374
6542
|
displayOrder: clampDisplayOrder(Number(entry["display_order"])),
|
|
6375
6543
|
// Anything unrecognised degrades to `always` rather than dropping the row.
|
|
6376
|
-
visibility: entry["visibility"]
|
|
6544
|
+
visibility: parseVisibility(entry["visibility"]),
|
|
6377
6545
|
// Same tolerance: an unknown value degrades to the default `tab`.
|
|
6378
6546
|
openIn: entry["open_in"] === "popup" ? "popup" : "tab"
|
|
6379
6547
|
});
|
|
6380
6548
|
const indexByMethod = /* @__PURE__ */ new Map();
|
|
6381
6549
|
const out = [];
|
|
6382
6550
|
for (const entry of raw) {
|
|
6383
|
-
if (out.length >=
|
|
6551
|
+
if (out.length >= PANES_MAX) break;
|
|
6384
6552
|
if (!isObject2(entry)) continue;
|
|
6385
6553
|
const method = str(entry["method"]).trim();
|
|
6386
6554
|
if (!method) continue;
|
|
@@ -6396,12 +6564,12 @@ function decodeNativePanes(raw) {
|
|
|
6396
6564
|
}
|
|
6397
6565
|
return out;
|
|
6398
6566
|
}
|
|
6399
|
-
function
|
|
6567
|
+
function encodePanes(panes) {
|
|
6400
6568
|
const nonEmpty = (map) => {
|
|
6401
6569
|
const entries = Object.entries(map).filter(([, v]) => v.trim().length > 0);
|
|
6402
6570
|
return entries.length > 0 ? Object.fromEntries(entries) : void 0;
|
|
6403
6571
|
};
|
|
6404
|
-
return panes.slice(0,
|
|
6572
|
+
return panes.slice(0, PANES_MAX).map((pane) => {
|
|
6405
6573
|
const labelTranslations = nonEmpty(pane.labelTranslations);
|
|
6406
6574
|
const sublabelTranslations = nonEmpty(pane.sublabelTranslations);
|
|
6407
6575
|
return {
|
|
@@ -6409,7 +6577,7 @@ function encodeNativePanes(panes) {
|
|
|
6409
6577
|
enabled: pane.enabled,
|
|
6410
6578
|
...pane.label.trim() ? { label: pane.label.trim() } : {},
|
|
6411
6579
|
...labelTranslations ? { label_translations: labelTranslations } : {},
|
|
6412
|
-
// `null` omits the key entirely (
|
|
6580
|
+
// `null` omits the key entirely (catalogue default wins); `''` is sent
|
|
6413
6581
|
// as-is because that is how the merchant hides the second line.
|
|
6414
6582
|
...pane.sublabel !== null ? { sublabel: pane.sublabel } : {},
|
|
6415
6583
|
...sublabelTranslations ? { sublabel_translations: sublabelTranslations } : {},
|
|
@@ -6421,8 +6589,13 @@ function encodeNativePanes(panes) {
|
|
|
6421
6589
|
// writing e.g. 3.5 or Date.now() verbatim would silently delete the
|
|
6422
6590
|
// pane at render while every read surface shows it healthy.
|
|
6423
6591
|
display_order: clampDisplayOrder(pane.displayOrder),
|
|
6424
|
-
|
|
6425
|
-
|
|
6592
|
+
// Normalised on encode for the same reason `display_order` is clamped:
|
|
6593
|
+
// the router's strict row decode drops a row whole on a value outside
|
|
6594
|
+
// its enum, and a caller who built a `Pane` by hand (or in plain JS)
|
|
6595
|
+
// never went through `decodePanes`. A decoded pane always holds a valid
|
|
6596
|
+
// value, so this is a no-op on the round-trip path.
|
|
6597
|
+
visibility: parseVisibility(pane.visibility),
|
|
6598
|
+
open_in: pane.openIn === "popup" ? "popup" : "tab"
|
|
6426
6599
|
};
|
|
6427
6600
|
});
|
|
6428
6601
|
}
|
|
@@ -6432,6 +6605,10 @@ function focusedCheckoutUrl(params) {
|
|
|
6432
6605
|
params.paymentId
|
|
6433
6606
|
)}`;
|
|
6434
6607
|
const query = new URLSearchParams({ pane: params.method });
|
|
6608
|
+
const connector = params.connector?.trim();
|
|
6609
|
+
if (connector) query.set("connector", connector);
|
|
6610
|
+
const merchantConnectorId = params.merchantConnectorId?.trim();
|
|
6611
|
+
if (merchantConnectorId) query.set("mca", merchantConnectorId);
|
|
6435
6612
|
if (params.locale) query.set("locale", params.locale);
|
|
6436
6613
|
if (params.customFieldsCollected) query.set("cf", "1");
|
|
6437
6614
|
return `${path}?${query.toString()}`;
|
|
@@ -6443,6 +6620,24 @@ var CHECKOUT_EVENT_KINDS = [
|
|
|
6443
6620
|
"native_pane_abandoned",
|
|
6444
6621
|
"native_pane_returned"
|
|
6445
6622
|
];
|
|
6623
|
+
var STRIPE_NATIVE_PANE_METHODS = STRIPE_FALLBACK_PANE_METHODS;
|
|
6624
|
+
var NATIVE_PANE_ICON_KEYS = PANE_ICON_KEYS;
|
|
6625
|
+
var NATIVE_PANE_CATEGORY_KEYS = PANE_CATEGORY_KEYS;
|
|
6626
|
+
var NATIVE_PANES_MAX = PANES_MAX;
|
|
6627
|
+
function nativePaneMethodInfo(method) {
|
|
6628
|
+
return STRIPE_FALLBACK_PANE_METHODS.find((info) => info.key === method);
|
|
6629
|
+
}
|
|
6630
|
+
function defaultNativePane(method) {
|
|
6631
|
+
const info = nativePaneMethodInfo(method);
|
|
6632
|
+
return {
|
|
6633
|
+
...defaultPane(method),
|
|
6634
|
+
category: "",
|
|
6635
|
+
icon: info?.defaultIcon ?? ""
|
|
6636
|
+
};
|
|
6637
|
+
}
|
|
6638
|
+
var cloneNativePane = clonePane;
|
|
6639
|
+
var decodeNativePanes = decodePanes;
|
|
6640
|
+
var encodeNativePanes = encodePanes;
|
|
6446
6641
|
|
|
6447
6642
|
export {
|
|
6448
6643
|
DelopayError,
|
|
@@ -6524,6 +6719,25 @@ export {
|
|
|
6524
6719
|
applyBrandingVariables,
|
|
6525
6720
|
shadowFor,
|
|
6526
6721
|
CheckoutSession,
|
|
6722
|
+
paneViewVisibility,
|
|
6723
|
+
STRIPE_FALLBACK_PANE_METHODS,
|
|
6724
|
+
STRIPE_FALLBACK_PANE_CATALOG,
|
|
6725
|
+
emptyPaneCatalog,
|
|
6726
|
+
paneCatalogFor,
|
|
6727
|
+
PANE_ICON_KEYS,
|
|
6728
|
+
PANE_CATEGORY_KEYS,
|
|
6729
|
+
PANES_MAX,
|
|
6730
|
+
paneMethodInfo,
|
|
6731
|
+
paneRailAllowed,
|
|
6732
|
+
offerablePaneMethods,
|
|
6733
|
+
paneDisplayDefaults,
|
|
6734
|
+
validatePanes,
|
|
6735
|
+
defaultPane,
|
|
6736
|
+
clonePane,
|
|
6737
|
+
decodePanes,
|
|
6738
|
+
encodePanes,
|
|
6739
|
+
focusedCheckoutUrl,
|
|
6740
|
+
CHECKOUT_EVENT_KINDS,
|
|
6527
6741
|
STRIPE_NATIVE_PANE_METHODS,
|
|
6528
6742
|
NATIVE_PANE_ICON_KEYS,
|
|
6529
6743
|
NATIVE_PANE_CATEGORY_KEYS,
|
|
@@ -6532,8 +6746,6 @@ export {
|
|
|
6532
6746
|
defaultNativePane,
|
|
6533
6747
|
cloneNativePane,
|
|
6534
6748
|
decodeNativePanes,
|
|
6535
|
-
encodeNativePanes
|
|
6536
|
-
focusedCheckoutUrl,
|
|
6537
|
-
CHECKOUT_EVENT_KINDS
|
|
6749
|
+
encodeNativePanes
|
|
6538
6750
|
};
|
|
6539
|
-
//# sourceMappingURL=chunk-
|
|
6751
|
+
//# sourceMappingURL=chunk-XMFG7CPX.js.map
|