@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/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-P56D2ZU2.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
  });
@@ -566,6 +583,11 @@ var Connectors = class {
566
583
  * This is the retrieve path alone. `create` and `update` echo back what the
567
584
  * caller sent, and `clone` returns the *copied* secrets — see that method.
568
585
  *
586
+ * Because the value is gone, `has_live_webhook_secret` and
587
+ * `has_sandbox_webhook_secret` are what tell a stored webhook signing secret
588
+ * from an unconfigured one. Render those; never infer configuration from the
589
+ * `null` block.
590
+ *
569
591
  * `GET /account/{accountId}/connectors/{connectorId}`
570
592
  */
571
593
  async retrieve(accountId, connectorId) {
@@ -606,23 +628,38 @@ var Connectors = class {
606
628
  );
607
629
  }
608
630
  /**
609
- * Every connector's native-pane capabilities, as the router itself knows
610
- * them — which rails a connector supports, and which methods it can publish
611
- * 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.
612
634
  *
613
635
  * Capability facts only: no label, sublabel or category comes back. A
614
636
  * designer renders a method's copy from its own locale files, keyed by
615
637
  * `key`, and takes `payment_method` / `payment_method_type` from here
616
638
  * verbatim rather than deriving them client-side.
617
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
+ *
618
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.
619
652
  */
620
- async getNativePanesCatalog(accountId) {
653
+ async getPanesCatalog(accountId) {
621
654
  return this.request(
622
655
  "GET",
623
656
  `/account/${encodeURIComponent(accountId)}/connectors/native-panes/catalog`
624
657
  );
625
658
  }
659
+ /** @deprecated Renamed to {@link getPanesCatalog}. Removed in 0.112.0. */
660
+ async getNativePanesCatalog(accountId) {
661
+ return this.getPanesCatalog(accountId);
662
+ }
626
663
  /**
627
664
  * Sweep the merchant's own e-Payouts module and return the rails it
628
665
  * actually has enabled. Server-side this makes many upstream calls, so it
@@ -636,6 +673,21 @@ var Connectors = class {
636
673
  `/account/${encodeURIComponent(accountId)}/connectors/${encodeURIComponent(connectorId)}/epayouts/catalog/sync`
637
674
  );
638
675
  }
676
+ /**
677
+ * Update a connector account.
678
+ *
679
+ * `connector_webhook_details` **merges** into the stored block key by key
680
+ * (be#992): an absent key keeps its stored secret, an explicit value is
681
+ * written, and an explicit empty string clears that secret. Send only the
682
+ * keys the operator typed — padding the other environment's keys with `''`
683
+ * clears a live signing secret and inbound webhooks stop verifying.
684
+ *
685
+ * The other credential-bearing fields — `connector_wallets_details`,
686
+ * `pm_auth_config`, `additional_merchant_data` — are still whole-value
687
+ * replacements: omit them unless you are writing a complete new value.
688
+ *
689
+ * `POST /account/{accountId}/connectors/{connectorId}`
690
+ */
639
691
  async update(accountId, connectorId, params) {
640
692
  return this.request(
641
693
  "POST",
@@ -2931,6 +2983,32 @@ var Shops = class {
2931
2983
  { body: params, ...options }
2932
2984
  );
2933
2985
  }
2986
+ /**
2987
+ * Read only the checkout appearance of a shop, so the role that may restyle a
2988
+ * checkout can load the checkout it may restyle.
2989
+ *
2990
+ * Gated on `ProfileCheckoutBrandingRead` — the read twin of the
2991
+ * `ProfileCheckoutBrandingEdit` guard on `updateCheckoutBranding` above.
2992
+ * Prefer this over `shops.retrieve` for the branding editor: `retrieve`
2993
+ * returns the whole profile, including the webhook signing key and the
2994
+ * card-vault configuration, and needs the shop-read permission for exactly
2995
+ * that reason.
2996
+ *
2997
+ * `GET /shops/{merchantId}/{shopId}/checkout-branding`
2998
+ *
2999
+ * @param merchantId - The merchant account ID.
3000
+ * @param shopId - The shop (business profile) ID whose branding to read.
3001
+ * @returns The shop's id, name and stored `payment_link_config`. That config
3002
+ * is `null` when the shop has never been styled — the untouched default, not
3003
+ * an error, and distinct from a stored-but-empty style.
3004
+ */
3005
+ async retrieveCheckoutBranding(merchantId, shopId, options) {
3006
+ return this.request(
3007
+ "GET",
3008
+ `/shops/${encodeURIComponent(merchantId)}/${encodeURIComponent(shopId)}/checkout-branding`,
3009
+ options
3010
+ );
3011
+ }
2934
3012
  };
2935
3013
 
2936
3014
  // src/resources/stripeConnect.ts
@@ -6342,11 +6420,23 @@ var CheckoutSession = class {
6342
6420
  }
6343
6421
  };
6344
6422
 
6345
- // src/nativePanes.ts
6346
- 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 = [
6347
6434
  {
6348
6435
  key: "apple_pay",
6349
6436
  rail: "wallet",
6437
+ paymentMethod: "wallet",
6438
+ paymentMethodType: "apple_pay",
6439
+ requiresBillingCountry: false,
6350
6440
  defaultLabel: "Apple Pay",
6351
6441
  defaultSublabel: "Pay with Apple Pay",
6352
6442
  defaultCategory: "wallet",
@@ -6355,6 +6445,9 @@ var STRIPE_NATIVE_PANE_METHODS = [
6355
6445
  {
6356
6446
  key: "google_pay",
6357
6447
  rail: "wallet",
6448
+ paymentMethod: "wallet",
6449
+ paymentMethodType: "google_pay",
6450
+ requiresBillingCountry: false,
6358
6451
  defaultLabel: "Google Pay",
6359
6452
  defaultSublabel: "Pay with Google Pay",
6360
6453
  defaultCategory: "wallet",
@@ -6363,6 +6456,9 @@ var STRIPE_NATIVE_PANE_METHODS = [
6363
6456
  {
6364
6457
  key: "link",
6365
6458
  rail: "wallet",
6459
+ paymentMethod: "wallet",
6460
+ paymentMethodType: "link",
6461
+ requiresBillingCountry: false,
6366
6462
  defaultLabel: "Link",
6367
6463
  defaultSublabel: "Pay with saved details",
6368
6464
  defaultCategory: "wallet",
@@ -6371,7 +6467,18 @@ var STRIPE_NATIVE_PANE_METHODS = [
6371
6467
  {
6372
6468
  key: "klarna",
6373
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,
6374
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.
6375
6482
  defaultSublabel: "Pay later or in instalments",
6376
6483
  defaultCategory: "bnpl",
6377
6484
  defaultIcon: "bnpl"
@@ -6379,6 +6486,9 @@ var STRIPE_NATIVE_PANE_METHODS = [
6379
6486
  {
6380
6487
  key: "affirm",
6381
6488
  rail: "redirect",
6489
+ paymentMethod: "pay_later",
6490
+ paymentMethodType: "affirm",
6491
+ requiresBillingCountry: false,
6382
6492
  defaultLabel: "Affirm",
6383
6493
  defaultSublabel: "Pay over time",
6384
6494
  defaultCategory: "bnpl",
@@ -6387,18 +6497,20 @@ var STRIPE_NATIVE_PANE_METHODS = [
6387
6497
  {
6388
6498
  key: "ideal",
6389
6499
  rail: "redirect",
6500
+ paymentMethod: "bank_redirect",
6501
+ paymentMethodType: "ideal",
6502
+ requiresBillingCountry: false,
6390
6503
  defaultLabel: "iDEAL",
6391
6504
  defaultSublabel: "Pay from your bank",
6392
6505
  defaultCategory: "bank_redirect",
6393
6506
  defaultIcon: "bank"
6394
6507
  },
6395
- // eps / p24 / bancontact were removed from the router catalog: Stripe
6396
- // hard-requires billing fields the focused checkout never collects (full
6397
- // name for EPS/Bancontact, email for Przelewy24), so their tiles could
6398
- // never succeed. They may return behind billing-aware gating.
6399
6508
  {
6400
6509
  key: "alipay",
6401
6510
  rail: "redirect",
6511
+ paymentMethod: "wallet",
6512
+ paymentMethodType: "ali_pay",
6513
+ requiresBillingCountry: false,
6402
6514
  defaultLabel: "Alipay",
6403
6515
  defaultSublabel: "Pay with Alipay",
6404
6516
  defaultCategory: "wallet",
@@ -6407,6 +6519,9 @@ var STRIPE_NATIVE_PANE_METHODS = [
6407
6519
  {
6408
6520
  key: "revolut_pay",
6409
6521
  rail: "redirect",
6522
+ paymentMethod: "wallet",
6523
+ paymentMethodType: "revolut_pay",
6524
+ requiresBillingCountry: false,
6410
6525
  defaultLabel: "Revolut Pay",
6411
6526
  defaultSublabel: "Pay with Revolut",
6412
6527
  defaultCategory: "wallet",
@@ -6415,13 +6530,33 @@ var STRIPE_NATIVE_PANE_METHODS = [
6415
6530
  {
6416
6531
  key: "amazon_pay",
6417
6532
  rail: "redirect",
6533
+ paymentMethod: "wallet",
6534
+ paymentMethodType: "amazon_pay",
6535
+ requiresBillingCountry: false,
6418
6536
  defaultLabel: "Amazon Pay",
6419
6537
  defaultSublabel: "Pay with Amazon",
6420
6538
  defaultCategory: "wallet",
6421
6539
  defaultIcon: "wallet"
6422
6540
  }
6423
6541
  ];
6424
- 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 = [
6425
6560
  "wallet",
6426
6561
  "card",
6427
6562
  "bank",
@@ -6430,20 +6565,70 @@ var NATIVE_PANE_ICON_KEYS = [
6430
6565
  "bnpl",
6431
6566
  "cash"
6432
6567
  ];
6433
- var NATIVE_PANE_CATEGORY_KEYS = [
6568
+ var PANE_CATEGORY_KEYS = [
6434
6569
  "wallet",
6435
6570
  "card",
6436
6571
  "bnpl",
6437
6572
  "bank_redirect",
6438
6573
  "bank_transfer",
6574
+ "crypto",
6575
+ "game_items",
6439
6576
  "cash"
6440
6577
  ];
6441
- var NATIVE_PANES_MAX = 12;
6442
- function nativePaneMethodInfo(method) {
6443
- 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);
6444
6581
  }
6445
- function defaultNativePane(method) {
6446
- 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));
6447
6632
  return {
6448
6633
  method,
6449
6634
  enabled: true,
@@ -6451,15 +6636,15 @@ function defaultNativePane(method) {
6451
6636
  labelTranslations: {},
6452
6637
  sublabel: null,
6453
6638
  sublabelTranslations: {},
6454
- category: "",
6455
- icon: info?.defaultIcon ?? "",
6639
+ category: defaults.category,
6640
+ icon: defaults.icon,
6456
6641
  iconSvg: "",
6457
6642
  displayOrder: 0,
6458
6643
  visibility: "always",
6459
6644
  openIn: "tab"
6460
6645
  };
6461
6646
  }
6462
- function cloneNativePane(pane) {
6647
+ function clonePane(pane) {
6463
6648
  return {
6464
6649
  ...pane,
6465
6650
  labelTranslations: { ...pane.labelTranslations },
@@ -6486,7 +6671,7 @@ function clampDisplayOrder(raw) {
6486
6671
  if (!Number.isFinite(raw)) return 0;
6487
6672
  return Math.min(DISPLAY_ORDER_MAX, Math.max(DISPLAY_ORDER_MIN, Math.trunc(raw)));
6488
6673
  }
6489
- function decodeNativePanes(raw) {
6674
+ function decodePanes(raw) {
6490
6675
  if (!Array.isArray(raw)) return null;
6491
6676
  const decodeRow = (entry, method) => ({
6492
6677
  method,
@@ -6500,14 +6685,14 @@ function decodeNativePanes(raw) {
6500
6685
  iconSvg: str(entry["icon_svg"]),
6501
6686
  displayOrder: clampDisplayOrder(Number(entry["display_order"])),
6502
6687
  // Anything unrecognised degrades to `always` rather than dropping the row.
6503
- visibility: entry["visibility"] === "embedded_only" ? "embedded_only" : "always",
6688
+ visibility: parseVisibility(entry["visibility"]),
6504
6689
  // Same tolerance: an unknown value degrades to the default `tab`.
6505
6690
  openIn: entry["open_in"] === "popup" ? "popup" : "tab"
6506
6691
  });
6507
6692
  const indexByMethod = /* @__PURE__ */ new Map();
6508
6693
  const out = [];
6509
6694
  for (const entry of raw) {
6510
- if (out.length >= NATIVE_PANES_MAX) break;
6695
+ if (out.length >= PANES_MAX) break;
6511
6696
  if (!isObject2(entry)) continue;
6512
6697
  const method = str(entry["method"]).trim();
6513
6698
  if (!method) continue;
@@ -6523,12 +6708,12 @@ function decodeNativePanes(raw) {
6523
6708
  }
6524
6709
  return out;
6525
6710
  }
6526
- function encodeNativePanes(panes) {
6711
+ function encodePanes(panes) {
6527
6712
  const nonEmpty = (map) => {
6528
6713
  const entries = Object.entries(map).filter(([, v]) => v.trim().length > 0);
6529
6714
  return entries.length > 0 ? Object.fromEntries(entries) : void 0;
6530
6715
  };
6531
- return panes.slice(0, NATIVE_PANES_MAX).map((pane) => {
6716
+ return panes.slice(0, PANES_MAX).map((pane) => {
6532
6717
  const labelTranslations = nonEmpty(pane.labelTranslations);
6533
6718
  const sublabelTranslations = nonEmpty(pane.sublabelTranslations);
6534
6719
  return {
@@ -6536,7 +6721,7 @@ function encodeNativePanes(panes) {
6536
6721
  enabled: pane.enabled,
6537
6722
  ...pane.label.trim() ? { label: pane.label.trim() } : {},
6538
6723
  ...labelTranslations ? { label_translations: labelTranslations } : {},
6539
- // `null` omits the key entirely (catalog default wins); `''` is sent
6724
+ // `null` omits the key entirely (catalogue default wins); `''` is sent
6540
6725
  // as-is because that is how the merchant hides the second line.
6541
6726
  ...pane.sublabel !== null ? { sublabel: pane.sublabel } : {},
6542
6727
  ...sublabelTranslations ? { sublabel_translations: sublabelTranslations } : {},
@@ -6548,8 +6733,13 @@ function encodeNativePanes(panes) {
6548
6733
  // writing e.g. 3.5 or Date.now() verbatim would silently delete the
6549
6734
  // pane at render while every read surface shows it healthy.
6550
6735
  display_order: clampDisplayOrder(pane.displayOrder),
6551
- visibility: pane.visibility,
6552
- 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"
6553
6743
  };
6554
6744
  });
6555
6745
  }
@@ -6559,6 +6749,10 @@ function focusedCheckoutUrl(params) {
6559
6749
  params.paymentId
6560
6750
  )}`;
6561
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);
6562
6756
  if (params.locale) query.set("locale", params.locale);
6563
6757
  if (params.customFieldsCollected) query.set("cf", "1");
6564
6758
  return `${path}?${query.toString()}`;
@@ -6570,6 +6764,24 @@ var CHECKOUT_EVENT_KINDS = [
6570
6764
  "native_pane_abandoned",
6571
6765
  "native_pane_returned"
6572
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;
6573
6785
 
6574
6786
  // src/internal/resources/admin.ts
6575
6787
  var Admin = class {
@@ -7476,10 +7688,15 @@ var DelopayInternal = class extends Delopay {
7476
7688
  NATIVE_PANE_CATEGORY_KEYS,
7477
7689
  NATIVE_PANE_ICON_KEYS,
7478
7690
  OperationLimits,
7691
+ PANES_MAX,
7692
+ PANE_CATEGORY_KEYS,
7693
+ PANE_ICON_KEYS,
7479
7694
  PlatformBilling,
7480
7695
  PlatformFees,
7481
7696
  Regions,
7482
7697
  Risk,
7698
+ STRIPE_FALLBACK_PANE_CATALOG,
7699
+ STRIPE_FALLBACK_PANE_METHODS,
7483
7700
  STRIPE_NATIVE_PANE_METHODS,
7484
7701
  Search,
7485
7702
  Settlement,
@@ -7493,6 +7710,7 @@ var DelopayInternal = class extends Delopay {
7493
7710
  cloneBranding,
7494
7711
  cloneCustomField,
7495
7712
  cloneNativePane,
7713
+ clonePane,
7496
7714
  customFieldContextFromMetadata,
7497
7715
  customFieldIsTextLike,
7498
7716
  customFieldOperatorTakesValue,
@@ -7502,14 +7720,18 @@ var DelopayInternal = class extends Delopay {
7502
7720
  decodeBranding,
7503
7721
  decodeCustomFields,
7504
7722
  decodeNativePanes,
7723
+ decodePanes,
7505
7724
  defaultBranding,
7506
7725
  defaultCustomFieldVisibility,
7507
7726
  defaultNativePane,
7508
7727
  defaultOperatorForSource,
7728
+ defaultPane,
7729
+ emptyPaneCatalog,
7509
7730
  encodeBadges,
7510
7731
  encodeBranding,
7511
7732
  encodeCustomFields,
7512
7733
  encodeNativePanes,
7734
+ encodePanes,
7513
7735
  evaluateCustomFieldCondition,
7514
7736
  evaluateCustomFieldVisibility,
7515
7737
  feeProgram,
@@ -7523,6 +7745,12 @@ var DelopayInternal = class extends Delopay {
7523
7745
  leaf,
7524
7746
  logoDimensions,
7525
7747
  nativePaneMethodInfo,
7748
+ offerablePaneMethods,
7749
+ paneCatalogFor,
7750
+ paneDisplayDefaults,
7751
+ paneMethodInfo,
7752
+ paneRailAllowed,
7753
+ paneViewVisibility,
7526
7754
  parseCustomFieldsLoose,
7527
7755
  parseImportedBranding,
7528
7756
  programToTree,
@@ -7531,6 +7759,7 @@ var DelopayInternal = class extends Delopay {
7531
7759
  sanitizeCustomCss,
7532
7760
  shadowFor,
7533
7761
  surfacePadValue,
7762
+ validatePanes,
7534
7763
  verticalGapValue,
7535
7764
  visibleCustomFields
7536
7765
  });