@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/index.js CHANGED
@@ -34,8 +34,13 @@ import {
34
34
  NATIVE_PANE_CATEGORY_KEYS,
35
35
  NATIVE_PANE_ICON_KEYS,
36
36
  OperationLimits,
37
+ PANES_MAX,
38
+ PANE_CATEGORY_KEYS,
39
+ PANE_ICON_KEYS,
37
40
  Regions,
38
41
  Risk,
42
+ STRIPE_FALLBACK_PANE_CATALOG,
43
+ STRIPE_FALLBACK_PANE_METHODS,
39
44
  STRIPE_NATIVE_PANE_METHODS,
40
45
  Search,
41
46
  Settlement,
@@ -49,6 +54,7 @@ import {
49
54
  cloneBranding,
50
55
  cloneCustomField,
51
56
  cloneNativePane,
57
+ clonePane,
52
58
  customFieldContextFromMetadata,
53
59
  customFieldIsTextLike,
54
60
  customFieldOperatorTakesValue,
@@ -58,14 +64,18 @@ import {
58
64
  decodeBranding,
59
65
  decodeCustomFields,
60
66
  decodeNativePanes,
67
+ decodePanes,
61
68
  defaultBranding,
62
69
  defaultCustomFieldVisibility,
63
70
  defaultNativePane,
64
71
  defaultOperatorForSource,
72
+ defaultPane,
73
+ emptyPaneCatalog,
65
74
  encodeBadges,
66
75
  encodeBranding,
67
76
  encodeCustomFields,
68
77
  encodeNativePanes,
78
+ encodePanes,
69
79
  evaluateCustomFieldCondition,
70
80
  evaluateCustomFieldVisibility,
71
81
  feeProgram,
@@ -79,6 +89,12 @@ import {
79
89
  leaf,
80
90
  logoDimensions,
81
91
  nativePaneMethodInfo,
92
+ offerablePaneMethods,
93
+ paneCatalogFor,
94
+ paneDisplayDefaults,
95
+ paneMethodInfo,
96
+ paneRailAllowed,
97
+ paneViewVisibility,
82
98
  parseCustomFieldsLoose,
83
99
  parseImportedBranding,
84
100
  programToTree,
@@ -87,9 +103,10 @@ import {
87
103
  sanitizeCustomCss,
88
104
  shadowFor,
89
105
  surfacePadValue,
106
+ validatePanes,
90
107
  verticalGapValue,
91
108
  visibleCustomFields
92
- } from "./chunk-C2O3D7ZM.js";
109
+ } from "./chunk-XMFG7CPX.js";
93
110
  export {
94
111
  ALL_CUSTOM_FIELD_CONDITION_SOURCES,
95
112
  ALL_CUSTOM_FIELD_OPERATORS,
@@ -126,8 +143,13 @@ export {
126
143
  NATIVE_PANE_CATEGORY_KEYS,
127
144
  NATIVE_PANE_ICON_KEYS,
128
145
  OperationLimits,
146
+ PANES_MAX,
147
+ PANE_CATEGORY_KEYS,
148
+ PANE_ICON_KEYS,
129
149
  Regions,
130
150
  Risk,
151
+ STRIPE_FALLBACK_PANE_CATALOG,
152
+ STRIPE_FALLBACK_PANE_METHODS,
131
153
  STRIPE_NATIVE_PANE_METHODS,
132
154
  Search,
133
155
  Settlement,
@@ -141,6 +163,7 @@ export {
141
163
  cloneBranding,
142
164
  cloneCustomField,
143
165
  cloneNativePane,
166
+ clonePane,
144
167
  customFieldContextFromMetadata,
145
168
  customFieldIsTextLike,
146
169
  customFieldOperatorTakesValue,
@@ -150,14 +173,18 @@ export {
150
173
  decodeBranding,
151
174
  decodeCustomFields,
152
175
  decodeNativePanes,
176
+ decodePanes,
153
177
  defaultBranding,
154
178
  defaultCustomFieldVisibility,
155
179
  defaultNativePane,
156
180
  defaultOperatorForSource,
181
+ defaultPane,
182
+ emptyPaneCatalog,
157
183
  encodeBadges,
158
184
  encodeBranding,
159
185
  encodeCustomFields,
160
186
  encodeNativePanes,
187
+ encodePanes,
161
188
  evaluateCustomFieldCondition,
162
189
  evaluateCustomFieldVisibility,
163
190
  feeProgram,
@@ -171,6 +198,12 @@ export {
171
198
  leaf,
172
199
  logoDimensions,
173
200
  nativePaneMethodInfo,
201
+ offerablePaneMethods,
202
+ paneCatalogFor,
203
+ paneDisplayDefaults,
204
+ paneMethodInfo,
205
+ paneRailAllowed,
206
+ paneViewVisibility,
174
207
  parseCustomFieldsLoose,
175
208
  parseImportedBranding,
176
209
  programToTree,
@@ -179,6 +212,7 @@ export {
179
212
  sanitizeCustomCss,
180
213
  shadowFor,
181
214
  surfacePadValue,
215
+ validatePanes,
182
216
  verticalGapValue,
183
217
  visibleCustomFields
184
218
  };
package/dist/internal.cjs CHANGED
@@ -65,10 +65,15 @@ __export(internal_exports, {
65
65
  NATIVE_PANE_CATEGORY_KEYS: () => NATIVE_PANE_CATEGORY_KEYS,
66
66
  NATIVE_PANE_ICON_KEYS: () => NATIVE_PANE_ICON_KEYS,
67
67
  OperationLimits: () => OperationLimits,
68
+ PANES_MAX: () => PANES_MAX,
69
+ PANE_CATEGORY_KEYS: () => PANE_CATEGORY_KEYS,
70
+ PANE_ICON_KEYS: () => PANE_ICON_KEYS,
68
71
  PlatformBilling: () => PlatformBilling,
69
72
  PlatformFees: () => PlatformFees,
70
73
  Regions: () => Regions,
71
74
  Risk: () => Risk,
75
+ STRIPE_FALLBACK_PANE_CATALOG: () => STRIPE_FALLBACK_PANE_CATALOG,
76
+ STRIPE_FALLBACK_PANE_METHODS: () => STRIPE_FALLBACK_PANE_METHODS,
72
77
  STRIPE_NATIVE_PANE_METHODS: () => STRIPE_NATIVE_PANE_METHODS,
73
78
  Search: () => Search,
74
79
  Settlement: () => Settlement,
@@ -82,6 +87,7 @@ __export(internal_exports, {
82
87
  cloneBranding: () => cloneBranding,
83
88
  cloneCustomField: () => cloneCustomField,
84
89
  cloneNativePane: () => cloneNativePane,
90
+ clonePane: () => clonePane,
85
91
  customFieldContextFromMetadata: () => customFieldContextFromMetadata,
86
92
  customFieldIsTextLike: () => customFieldIsTextLike,
87
93
  customFieldOperatorTakesValue: () => customFieldOperatorTakesValue,
@@ -91,14 +97,18 @@ __export(internal_exports, {
91
97
  decodeBranding: () => decodeBranding,
92
98
  decodeCustomFields: () => decodeCustomFields,
93
99
  decodeNativePanes: () => decodeNativePanes,
100
+ decodePanes: () => decodePanes,
94
101
  defaultBranding: () => defaultBranding,
95
102
  defaultCustomFieldVisibility: () => defaultCustomFieldVisibility,
96
103
  defaultNativePane: () => defaultNativePane,
97
104
  defaultOperatorForSource: () => defaultOperatorForSource,
105
+ defaultPane: () => defaultPane,
106
+ emptyPaneCatalog: () => emptyPaneCatalog,
98
107
  encodeBadges: () => encodeBadges,
99
108
  encodeBranding: () => encodeBranding,
100
109
  encodeCustomFields: () => encodeCustomFields,
101
110
  encodeNativePanes: () => encodeNativePanes,
111
+ encodePanes: () => encodePanes,
102
112
  evaluateCustomFieldCondition: () => evaluateCustomFieldCondition,
103
113
  evaluateCustomFieldVisibility: () => evaluateCustomFieldVisibility,
104
114
  feeProgram: () => feeProgram,
@@ -112,6 +122,12 @@ __export(internal_exports, {
112
122
  leaf: () => leaf,
113
123
  logoDimensions: () => logoDimensions,
114
124
  nativePaneMethodInfo: () => nativePaneMethodInfo,
125
+ offerablePaneMethods: () => offerablePaneMethods,
126
+ paneCatalogFor: () => paneCatalogFor,
127
+ paneDisplayDefaults: () => paneDisplayDefaults,
128
+ paneMethodInfo: () => paneMethodInfo,
129
+ paneRailAllowed: () => paneRailAllowed,
130
+ paneViewVisibility: () => paneViewVisibility,
115
131
  parseCustomFieldsLoose: () => parseCustomFieldsLoose,
116
132
  parseImportedBranding: () => parseImportedBranding,
117
133
  programToTree: () => programToTree,
@@ -120,6 +136,7 @@ __export(internal_exports, {
120
136
  sanitizeCustomCss: () => sanitizeCustomCss,
121
137
  shadowFor: () => shadowFor,
122
138
  surfacePadValue: () => surfacePadValue,
139
+ validatePanes: () => validatePanes,
123
140
  verticalGapValue: () => verticalGapValue,
124
141
  visibleCustomFields: () => visibleCustomFields
125
142
  });
@@ -611,23 +628,38 @@ var Connectors = class {
611
628
  );
612
629
  }
613
630
  /**
614
- * Every connector's native-pane capabilities, as the router itself knows
615
- * them — which rails a connector supports, and which methods it can publish
616
- * as a pane with the confirm routing keys each one carries.
631
+ * Every connector's pane capabilities, as the router itself knows them —
632
+ * which rails a connector supports, and which methods it can publish as a
633
+ * pane with the confirm routing keys each one carries.
617
634
  *
618
635
  * Capability facts only: no label, sublabel or category comes back. A
619
636
  * designer renders a method's copy from its own locale files, keyed by
620
637
  * `key`, and takes `payment_method` / `payment_method_type` from here
621
638
  * verbatim rather than deriving them client-side.
622
639
  *
640
+ * This is what the pane helpers in `src/panes.ts` should be driven from —
641
+ * `paneMethodInfo`, `defaultPane` and `validatePanes` all take a
642
+ * {@link PanesConnectorCatalog} out of this response, so a connector the
643
+ * router starts publishing panes for needs no SDK release.
644
+ *
623
645
  * `GET /account/{accountId}/connectors/native-panes/catalog`
646
+ *
647
+ * The path keeps the `native-panes` spelling deliberately. The identifiers
648
+ * were renamed off "native pane"; the route was not, and pointing at the
649
+ * backend's new name before it is deployed everywhere would both 404 against
650
+ * un-upgraded replicas mid-rollout and fail `scripts/parity-check.mjs`,
651
+ * which blocks publishing.
624
652
  */
625
- async getNativePanesCatalog(accountId) {
653
+ async getPanesCatalog(accountId) {
626
654
  return this.request(
627
655
  "GET",
628
656
  `/account/${encodeURIComponent(accountId)}/connectors/native-panes/catalog`
629
657
  );
630
658
  }
659
+ /** @deprecated Renamed to {@link getPanesCatalog}. Removed in 0.112.0. */
660
+ async getNativePanesCatalog(accountId) {
661
+ return this.getPanesCatalog(accountId);
662
+ }
631
663
  /**
632
664
  * Sweep the merchant's own e-Payouts module and return the rails it
633
665
  * actually has enabled. Server-side this makes many upstream calls, so it
@@ -6388,11 +6420,23 @@ var CheckoutSession = class {
6388
6420
  }
6389
6421
  };
6390
6422
 
6391
- // src/nativePanes.ts
6392
- var STRIPE_NATIVE_PANE_METHODS = [
6423
+ // src/panes.ts
6424
+ var PANE_VISIBILITIES = ["always", "embedded_only", "external_only"];
6425
+ function parseVisibility(raw) {
6426
+ return PANE_VISIBILITIES.find((value) => value === raw) ?? "always";
6427
+ }
6428
+ function paneViewVisibility(view) {
6429
+ const declared = PANE_VISIBILITIES.find((value) => value === view.visibility);
6430
+ if (declared) return declared;
6431
+ return view.embedded_only === true ? "embedded_only" : "always";
6432
+ }
6433
+ var STRIPE_FALLBACK_PANE_METHODS = [
6393
6434
  {
6394
6435
  key: "apple_pay",
6395
6436
  rail: "wallet",
6437
+ paymentMethod: "wallet",
6438
+ paymentMethodType: "apple_pay",
6439
+ requiresBillingCountry: false,
6396
6440
  defaultLabel: "Apple Pay",
6397
6441
  defaultSublabel: "Pay with Apple Pay",
6398
6442
  defaultCategory: "wallet",
@@ -6401,6 +6445,9 @@ var STRIPE_NATIVE_PANE_METHODS = [
6401
6445
  {
6402
6446
  key: "google_pay",
6403
6447
  rail: "wallet",
6448
+ paymentMethod: "wallet",
6449
+ paymentMethodType: "google_pay",
6450
+ requiresBillingCountry: false,
6404
6451
  defaultLabel: "Google Pay",
6405
6452
  defaultSublabel: "Pay with Google Pay",
6406
6453
  defaultCategory: "wallet",
@@ -6409,6 +6456,9 @@ var STRIPE_NATIVE_PANE_METHODS = [
6409
6456
  {
6410
6457
  key: "link",
6411
6458
  rail: "wallet",
6459
+ paymentMethod: "wallet",
6460
+ paymentMethodType: "link",
6461
+ requiresBillingCountry: false,
6412
6462
  defaultLabel: "Link",
6413
6463
  defaultSublabel: "Pay with saved details",
6414
6464
  defaultCategory: "wallet",
@@ -6417,7 +6467,18 @@ var STRIPE_NATIVE_PANE_METHODS = [
6417
6467
  {
6418
6468
  key: "klarna",
6419
6469
  rail: "redirect",
6470
+ paymentMethod: "pay_later",
6471
+ paymentMethodType: "klarna",
6472
+ // Stripe's Klarna needs the buyer's country echoed into the confirm body.
6473
+ requiresBillingCountry: true,
6420
6474
  defaultLabel: "Klarna",
6475
+ // NOT the router's current "Pay later or in 3 instalments". This table is
6476
+ // what a router predating the capability endpoint (delopay-backend#964)
6477
+ // renders, and that copy only gained the "3" in delopay-backend#1051 —
6478
+ // the same release that added the endpoint. Restating the new string here
6479
+ // would put copy no reachable router emits in front of a merchant, and
6480
+ // would change what the deprecated `nativePaneMethodInfo` has returned
6481
+ // since 0.106.0.
6421
6482
  defaultSublabel: "Pay later or in instalments",
6422
6483
  defaultCategory: "bnpl",
6423
6484
  defaultIcon: "bnpl"
@@ -6425,6 +6486,9 @@ var STRIPE_NATIVE_PANE_METHODS = [
6425
6486
  {
6426
6487
  key: "affirm",
6427
6488
  rail: "redirect",
6489
+ paymentMethod: "pay_later",
6490
+ paymentMethodType: "affirm",
6491
+ requiresBillingCountry: false,
6428
6492
  defaultLabel: "Affirm",
6429
6493
  defaultSublabel: "Pay over time",
6430
6494
  defaultCategory: "bnpl",
@@ -6433,18 +6497,20 @@ var STRIPE_NATIVE_PANE_METHODS = [
6433
6497
  {
6434
6498
  key: "ideal",
6435
6499
  rail: "redirect",
6500
+ paymentMethod: "bank_redirect",
6501
+ paymentMethodType: "ideal",
6502
+ requiresBillingCountry: false,
6436
6503
  defaultLabel: "iDEAL",
6437
6504
  defaultSublabel: "Pay from your bank",
6438
6505
  defaultCategory: "bank_redirect",
6439
6506
  defaultIcon: "bank"
6440
6507
  },
6441
- // eps / p24 / bancontact were removed from the router catalog: Stripe
6442
- // hard-requires billing fields the focused checkout never collects (full
6443
- // name for EPS/Bancontact, email for Przelewy24), so their tiles could
6444
- // never succeed. They may return behind billing-aware gating.
6445
6508
  {
6446
6509
  key: "alipay",
6447
6510
  rail: "redirect",
6511
+ paymentMethod: "wallet",
6512
+ paymentMethodType: "ali_pay",
6513
+ requiresBillingCountry: false,
6448
6514
  defaultLabel: "Alipay",
6449
6515
  defaultSublabel: "Pay with Alipay",
6450
6516
  defaultCategory: "wallet",
@@ -6453,6 +6519,9 @@ var STRIPE_NATIVE_PANE_METHODS = [
6453
6519
  {
6454
6520
  key: "revolut_pay",
6455
6521
  rail: "redirect",
6522
+ paymentMethod: "wallet",
6523
+ paymentMethodType: "revolut_pay",
6524
+ requiresBillingCountry: false,
6456
6525
  defaultLabel: "Revolut Pay",
6457
6526
  defaultSublabel: "Pay with Revolut",
6458
6527
  defaultCategory: "wallet",
@@ -6461,13 +6530,33 @@ var STRIPE_NATIVE_PANE_METHODS = [
6461
6530
  {
6462
6531
  key: "amazon_pay",
6463
6532
  rail: "redirect",
6533
+ paymentMethod: "wallet",
6534
+ paymentMethodType: "amazon_pay",
6535
+ requiresBillingCountry: false,
6464
6536
  defaultLabel: "Amazon Pay",
6465
6537
  defaultSublabel: "Pay with Amazon",
6466
6538
  defaultCategory: "wallet",
6467
6539
  defaultIcon: "wallet"
6468
6540
  }
6469
6541
  ];
6470
- var NATIVE_PANE_ICON_KEYS = [
6542
+ var STRIPE_FALLBACK_PANE_CATALOG = {
6543
+ connector: "stripe",
6544
+ allowed_rails: ["wallet", "redirect"],
6545
+ methods: STRIPE_FALLBACK_PANE_METHODS.map((info) => ({
6546
+ key: info.key,
6547
+ rail: info.rail,
6548
+ payment_method: info.paymentMethod,
6549
+ payment_method_type: info.paymentMethodType,
6550
+ requires_billing_country: info.requiresBillingCountry
6551
+ }))
6552
+ };
6553
+ function emptyPaneCatalog(connector) {
6554
+ return { connector, allowed_rails: [], methods: [] };
6555
+ }
6556
+ function paneCatalogFor(response, connector) {
6557
+ return response.connectors.find((entry) => entry.connector === connector) ?? emptyPaneCatalog(connector);
6558
+ }
6559
+ var PANE_ICON_KEYS = [
6471
6560
  "wallet",
6472
6561
  "card",
6473
6562
  "bank",
@@ -6476,20 +6565,70 @@ var NATIVE_PANE_ICON_KEYS = [
6476
6565
  "bnpl",
6477
6566
  "cash"
6478
6567
  ];
6479
- var NATIVE_PANE_CATEGORY_KEYS = [
6568
+ var PANE_CATEGORY_KEYS = [
6480
6569
  "wallet",
6481
6570
  "card",
6482
6571
  "bnpl",
6483
6572
  "bank_redirect",
6484
6573
  "bank_transfer",
6574
+ "crypto",
6575
+ "game_items",
6485
6576
  "cash"
6486
6577
  ];
6487
- var NATIVE_PANES_MAX = 12;
6488
- function nativePaneMethodInfo(method) {
6489
- return STRIPE_NATIVE_PANE_METHODS.find((m) => m.key === method);
6578
+ var PANES_MAX = 12;
6579
+ function paneMethodInfo(method, catalog = STRIPE_FALLBACK_PANE_CATALOG) {
6580
+ return catalog.methods.find((info) => info.key === method);
6490
6581
  }
6491
- function defaultNativePane(method) {
6492
- const info = nativePaneMethodInfo(method);
6582
+ function paneRailAllowed(rail, catalog) {
6583
+ return catalog.allowed_rails.includes(rail);
6584
+ }
6585
+ function offerablePaneMethods(catalog) {
6586
+ return catalog.methods.filter((info) => paneRailAllowed(info.rail, catalog));
6587
+ }
6588
+ var DISPLAY_DEFAULTS_BY_KEY = {
6589
+ apple_pay: { icon: "apple", category: "wallet" },
6590
+ google_pay: { icon: "google", category: "wallet" }
6591
+ };
6592
+ var DISPLAY_DEFAULTS_BY_PAYMENT_METHOD = {
6593
+ wallet: { icon: "wallet", category: "wallet" },
6594
+ card: { icon: "card", category: "card" },
6595
+ card_redirect: { icon: "card", category: "card" },
6596
+ pay_later: { icon: "bnpl", category: "bnpl" },
6597
+ bank_redirect: { icon: "bank", category: "bank_redirect" },
6598
+ bank_transfer: { icon: "bank", category: "bank_transfer" },
6599
+ bank_debit: { icon: "bank", category: "bank_transfer" },
6600
+ crypto: { icon: "wallet", category: "crypto" },
6601
+ game_items: { icon: "wallet", category: "game_items" },
6602
+ cash: { icon: "cash", category: "cash" },
6603
+ voucher: { icon: "cash", category: "cash" }
6604
+ };
6605
+ var DISPLAY_DEFAULTS_FALLBACK = { icon: "wallet", category: "wallet" };
6606
+ function paneDisplayDefaults(info) {
6607
+ if (!info) return DISPLAY_DEFAULTS_FALLBACK;
6608
+ return DISPLAY_DEFAULTS_BY_KEY[info.key] ?? DISPLAY_DEFAULTS_BY_PAYMENT_METHOD[info.payment_method] ?? DISPLAY_DEFAULTS_FALLBACK;
6609
+ }
6610
+ function validatePanes(panes, catalog = STRIPE_FALLBACK_PANE_CATALOG) {
6611
+ const issues = [];
6612
+ const claimedBy = /* @__PURE__ */ new Set();
6613
+ panes.forEach((pane, index) => {
6614
+ const info = paneMethodInfo(pane.method, catalog);
6615
+ if (!info) {
6616
+ issues.push({ index, method: pane.method, code: "method_unknown" });
6617
+ } else if (!paneRailAllowed(info.rail, catalog)) {
6618
+ issues.push({ index, method: pane.method, code: "rail_not_allowed" });
6619
+ } else if (pane.enabled) {
6620
+ if (claimedBy.has(info.key)) {
6621
+ issues.push({ index, method: pane.method, code: "duplicate_method" });
6622
+ } else {
6623
+ claimedBy.add(info.key);
6624
+ }
6625
+ }
6626
+ if (index >= PANES_MAX) issues.push({ index, method: pane.method, code: "over_cap" });
6627
+ });
6628
+ return issues;
6629
+ }
6630
+ function defaultPane(method, catalog = STRIPE_FALLBACK_PANE_CATALOG) {
6631
+ const defaults = paneDisplayDefaults(paneMethodInfo(method, catalog));
6493
6632
  return {
6494
6633
  method,
6495
6634
  enabled: true,
@@ -6497,15 +6636,15 @@ function defaultNativePane(method) {
6497
6636
  labelTranslations: {},
6498
6637
  sublabel: null,
6499
6638
  sublabelTranslations: {},
6500
- category: "",
6501
- icon: info?.defaultIcon ?? "",
6639
+ category: defaults.category,
6640
+ icon: defaults.icon,
6502
6641
  iconSvg: "",
6503
6642
  displayOrder: 0,
6504
6643
  visibility: "always",
6505
6644
  openIn: "tab"
6506
6645
  };
6507
6646
  }
6508
- function cloneNativePane(pane) {
6647
+ function clonePane(pane) {
6509
6648
  return {
6510
6649
  ...pane,
6511
6650
  labelTranslations: { ...pane.labelTranslations },
@@ -6532,7 +6671,7 @@ function clampDisplayOrder(raw) {
6532
6671
  if (!Number.isFinite(raw)) return 0;
6533
6672
  return Math.min(DISPLAY_ORDER_MAX, Math.max(DISPLAY_ORDER_MIN, Math.trunc(raw)));
6534
6673
  }
6535
- function decodeNativePanes(raw) {
6674
+ function decodePanes(raw) {
6536
6675
  if (!Array.isArray(raw)) return null;
6537
6676
  const decodeRow = (entry, method) => ({
6538
6677
  method,
@@ -6546,14 +6685,14 @@ function decodeNativePanes(raw) {
6546
6685
  iconSvg: str(entry["icon_svg"]),
6547
6686
  displayOrder: clampDisplayOrder(Number(entry["display_order"])),
6548
6687
  // Anything unrecognised degrades to `always` rather than dropping the row.
6549
- visibility: entry["visibility"] === "embedded_only" ? "embedded_only" : "always",
6688
+ visibility: parseVisibility(entry["visibility"]),
6550
6689
  // Same tolerance: an unknown value degrades to the default `tab`.
6551
6690
  openIn: entry["open_in"] === "popup" ? "popup" : "tab"
6552
6691
  });
6553
6692
  const indexByMethod = /* @__PURE__ */ new Map();
6554
6693
  const out = [];
6555
6694
  for (const entry of raw) {
6556
- if (out.length >= NATIVE_PANES_MAX) break;
6695
+ if (out.length >= PANES_MAX) break;
6557
6696
  if (!isObject2(entry)) continue;
6558
6697
  const method = str(entry["method"]).trim();
6559
6698
  if (!method) continue;
@@ -6569,12 +6708,12 @@ function decodeNativePanes(raw) {
6569
6708
  }
6570
6709
  return out;
6571
6710
  }
6572
- function encodeNativePanes(panes) {
6711
+ function encodePanes(panes) {
6573
6712
  const nonEmpty = (map) => {
6574
6713
  const entries = Object.entries(map).filter(([, v]) => v.trim().length > 0);
6575
6714
  return entries.length > 0 ? Object.fromEntries(entries) : void 0;
6576
6715
  };
6577
- return panes.slice(0, NATIVE_PANES_MAX).map((pane) => {
6716
+ return panes.slice(0, PANES_MAX).map((pane) => {
6578
6717
  const labelTranslations = nonEmpty(pane.labelTranslations);
6579
6718
  const sublabelTranslations = nonEmpty(pane.sublabelTranslations);
6580
6719
  return {
@@ -6582,7 +6721,7 @@ function encodeNativePanes(panes) {
6582
6721
  enabled: pane.enabled,
6583
6722
  ...pane.label.trim() ? { label: pane.label.trim() } : {},
6584
6723
  ...labelTranslations ? { label_translations: labelTranslations } : {},
6585
- // `null` omits the key entirely (catalog default wins); `''` is sent
6724
+ // `null` omits the key entirely (catalogue default wins); `''` is sent
6586
6725
  // as-is because that is how the merchant hides the second line.
6587
6726
  ...pane.sublabel !== null ? { sublabel: pane.sublabel } : {},
6588
6727
  ...sublabelTranslations ? { sublabel_translations: sublabelTranslations } : {},
@@ -6594,8 +6733,13 @@ function encodeNativePanes(panes) {
6594
6733
  // writing e.g. 3.5 or Date.now() verbatim would silently delete the
6595
6734
  // pane at render while every read surface shows it healthy.
6596
6735
  display_order: clampDisplayOrder(pane.displayOrder),
6597
- visibility: pane.visibility,
6598
- open_in: pane.openIn
6736
+ // Normalised on encode for the same reason `display_order` is clamped:
6737
+ // the router's strict row decode drops a row whole on a value outside
6738
+ // its enum, and a caller who built a `Pane` by hand (or in plain JS)
6739
+ // never went through `decodePanes`. A decoded pane always holds a valid
6740
+ // value, so this is a no-op on the round-trip path.
6741
+ visibility: parseVisibility(pane.visibility),
6742
+ open_in: pane.openIn === "popup" ? "popup" : "tab"
6599
6743
  };
6600
6744
  });
6601
6745
  }
@@ -6605,6 +6749,10 @@ function focusedCheckoutUrl(params) {
6605
6749
  params.paymentId
6606
6750
  )}`;
6607
6751
  const query = new URLSearchParams({ pane: params.method });
6752
+ const connector = params.connector?.trim();
6753
+ if (connector) query.set("connector", connector);
6754
+ const merchantConnectorId = params.merchantConnectorId?.trim();
6755
+ if (merchantConnectorId) query.set("mca", merchantConnectorId);
6608
6756
  if (params.locale) query.set("locale", params.locale);
6609
6757
  if (params.customFieldsCollected) query.set("cf", "1");
6610
6758
  return `${path}?${query.toString()}`;
@@ -6616,6 +6764,24 @@ var CHECKOUT_EVENT_KINDS = [
6616
6764
  "native_pane_abandoned",
6617
6765
  "native_pane_returned"
6618
6766
  ];
6767
+ var STRIPE_NATIVE_PANE_METHODS = STRIPE_FALLBACK_PANE_METHODS;
6768
+ var NATIVE_PANE_ICON_KEYS = PANE_ICON_KEYS;
6769
+ var NATIVE_PANE_CATEGORY_KEYS = PANE_CATEGORY_KEYS;
6770
+ var NATIVE_PANES_MAX = PANES_MAX;
6771
+ function nativePaneMethodInfo(method) {
6772
+ return STRIPE_FALLBACK_PANE_METHODS.find((info) => info.key === method);
6773
+ }
6774
+ function defaultNativePane(method) {
6775
+ const info = nativePaneMethodInfo(method);
6776
+ return {
6777
+ ...defaultPane(method),
6778
+ category: "",
6779
+ icon: info?.defaultIcon ?? ""
6780
+ };
6781
+ }
6782
+ var cloneNativePane = clonePane;
6783
+ var decodeNativePanes = decodePanes;
6784
+ var encodeNativePanes = encodePanes;
6619
6785
 
6620
6786
  // src/internal/resources/admin.ts
6621
6787
  var Admin = class {
@@ -7522,10 +7688,15 @@ var DelopayInternal = class extends Delopay {
7522
7688
  NATIVE_PANE_CATEGORY_KEYS,
7523
7689
  NATIVE_PANE_ICON_KEYS,
7524
7690
  OperationLimits,
7691
+ PANES_MAX,
7692
+ PANE_CATEGORY_KEYS,
7693
+ PANE_ICON_KEYS,
7525
7694
  PlatformBilling,
7526
7695
  PlatformFees,
7527
7696
  Regions,
7528
7697
  Risk,
7698
+ STRIPE_FALLBACK_PANE_CATALOG,
7699
+ STRIPE_FALLBACK_PANE_METHODS,
7529
7700
  STRIPE_NATIVE_PANE_METHODS,
7530
7701
  Search,
7531
7702
  Settlement,
@@ -7539,6 +7710,7 @@ var DelopayInternal = class extends Delopay {
7539
7710
  cloneBranding,
7540
7711
  cloneCustomField,
7541
7712
  cloneNativePane,
7713
+ clonePane,
7542
7714
  customFieldContextFromMetadata,
7543
7715
  customFieldIsTextLike,
7544
7716
  customFieldOperatorTakesValue,
@@ -7548,14 +7720,18 @@ var DelopayInternal = class extends Delopay {
7548
7720
  decodeBranding,
7549
7721
  decodeCustomFields,
7550
7722
  decodeNativePanes,
7723
+ decodePanes,
7551
7724
  defaultBranding,
7552
7725
  defaultCustomFieldVisibility,
7553
7726
  defaultNativePane,
7554
7727
  defaultOperatorForSource,
7728
+ defaultPane,
7729
+ emptyPaneCatalog,
7555
7730
  encodeBadges,
7556
7731
  encodeBranding,
7557
7732
  encodeCustomFields,
7558
7733
  encodeNativePanes,
7734
+ encodePanes,
7559
7735
  evaluateCustomFieldCondition,
7560
7736
  evaluateCustomFieldVisibility,
7561
7737
  feeProgram,
@@ -7569,6 +7745,12 @@ var DelopayInternal = class extends Delopay {
7569
7745
  leaf,
7570
7746
  logoDimensions,
7571
7747
  nativePaneMethodInfo,
7748
+ offerablePaneMethods,
7749
+ paneCatalogFor,
7750
+ paneDisplayDefaults,
7751
+ paneMethodInfo,
7752
+ paneRailAllowed,
7753
+ paneViewVisibility,
7572
7754
  parseCustomFieldsLoose,
7573
7755
  parseImportedBranding,
7574
7756
  programToTree,
@@ -7577,6 +7759,7 @@ var DelopayInternal = class extends Delopay {
7577
7759
  sanitizeCustomCss,
7578
7760
  shadowFor,
7579
7761
  surfacePadValue,
7762
+ validatePanes,
7580
7763
  verticalGapValue,
7581
7764
  visibleCustomFields
7582
7765
  });