@delopay/sdk 0.108.0 → 0.111.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-C2O3D7ZM.js → chunk-TS422PA3.js} +235 -33
- package/dist/chunk-TS422PA3.js.map +1 -0
- package/dist/index.cjs +249 -29
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +647 -104
- package/dist/index.d.ts +647 -104
- package/dist/index.js +37 -1
- package/dist/internal.cjs +249 -29
- package/dist/internal.cjs.map +1 -1
- package/dist/internal.d.cts +81 -2
- package/dist/internal.d.ts +81 -2
- package/dist/internal.js +37 -1
- package/dist/internal.js.map +1 -1
- package/package.json +1 -1
- package/dist/chunk-C2O3D7ZM.js.map +0 -1
package/dist/internal.cjs
CHANGED
|
@@ -27,6 +27,7 @@ __export(internal_exports, {
|
|
|
27
27
|
AdminPortal: () => AdminPortal,
|
|
28
28
|
Analytics: () => Analytics,
|
|
29
29
|
AnalyticsDashboard: () => AnalyticsDashboard,
|
|
30
|
+
Audit: () => Audit,
|
|
30
31
|
AuditLogs: () => AuditLogs,
|
|
31
32
|
AvailabilityOverrides: () => AvailabilityOverrides,
|
|
32
33
|
BRANDING_EXPORT_FORMAT: () => BRANDING_EXPORT_FORMAT,
|
|
@@ -65,10 +66,15 @@ __export(internal_exports, {
|
|
|
65
66
|
NATIVE_PANE_CATEGORY_KEYS: () => NATIVE_PANE_CATEGORY_KEYS,
|
|
66
67
|
NATIVE_PANE_ICON_KEYS: () => NATIVE_PANE_ICON_KEYS,
|
|
67
68
|
OperationLimits: () => OperationLimits,
|
|
69
|
+
PANES_MAX: () => PANES_MAX,
|
|
70
|
+
PANE_CATEGORY_KEYS: () => PANE_CATEGORY_KEYS,
|
|
71
|
+
PANE_ICON_KEYS: () => PANE_ICON_KEYS,
|
|
68
72
|
PlatformBilling: () => PlatformBilling,
|
|
69
73
|
PlatformFees: () => PlatformFees,
|
|
70
74
|
Regions: () => Regions,
|
|
71
75
|
Risk: () => Risk,
|
|
76
|
+
STRIPE_FALLBACK_PANE_CATALOG: () => STRIPE_FALLBACK_PANE_CATALOG,
|
|
77
|
+
STRIPE_FALLBACK_PANE_METHODS: () => STRIPE_FALLBACK_PANE_METHODS,
|
|
72
78
|
STRIPE_NATIVE_PANE_METHODS: () => STRIPE_NATIVE_PANE_METHODS,
|
|
73
79
|
Search: () => Search,
|
|
74
80
|
Settlement: () => Settlement,
|
|
@@ -82,6 +88,7 @@ __export(internal_exports, {
|
|
|
82
88
|
cloneBranding: () => cloneBranding,
|
|
83
89
|
cloneCustomField: () => cloneCustomField,
|
|
84
90
|
cloneNativePane: () => cloneNativePane,
|
|
91
|
+
clonePane: () => clonePane,
|
|
85
92
|
customFieldContextFromMetadata: () => customFieldContextFromMetadata,
|
|
86
93
|
customFieldIsTextLike: () => customFieldIsTextLike,
|
|
87
94
|
customFieldOperatorTakesValue: () => customFieldOperatorTakesValue,
|
|
@@ -91,14 +98,18 @@ __export(internal_exports, {
|
|
|
91
98
|
decodeBranding: () => decodeBranding,
|
|
92
99
|
decodeCustomFields: () => decodeCustomFields,
|
|
93
100
|
decodeNativePanes: () => decodeNativePanes,
|
|
101
|
+
decodePanes: () => decodePanes,
|
|
94
102
|
defaultBranding: () => defaultBranding,
|
|
95
103
|
defaultCustomFieldVisibility: () => defaultCustomFieldVisibility,
|
|
96
104
|
defaultNativePane: () => defaultNativePane,
|
|
97
105
|
defaultOperatorForSource: () => defaultOperatorForSource,
|
|
106
|
+
defaultPane: () => defaultPane,
|
|
107
|
+
emptyPaneCatalog: () => emptyPaneCatalog,
|
|
98
108
|
encodeBadges: () => encodeBadges,
|
|
99
109
|
encodeBranding: () => encodeBranding,
|
|
100
110
|
encodeCustomFields: () => encodeCustomFields,
|
|
101
111
|
encodeNativePanes: () => encodeNativePanes,
|
|
112
|
+
encodePanes: () => encodePanes,
|
|
102
113
|
evaluateCustomFieldCondition: () => evaluateCustomFieldCondition,
|
|
103
114
|
evaluateCustomFieldVisibility: () => evaluateCustomFieldVisibility,
|
|
104
115
|
feeProgram: () => feeProgram,
|
|
@@ -112,6 +123,12 @@ __export(internal_exports, {
|
|
|
112
123
|
leaf: () => leaf,
|
|
113
124
|
logoDimensions: () => logoDimensions,
|
|
114
125
|
nativePaneMethodInfo: () => nativePaneMethodInfo,
|
|
126
|
+
offerablePaneMethods: () => offerablePaneMethods,
|
|
127
|
+
paneCatalogFor: () => paneCatalogFor,
|
|
128
|
+
paneDisplayDefaults: () => paneDisplayDefaults,
|
|
129
|
+
paneMethodInfo: () => paneMethodInfo,
|
|
130
|
+
paneRailAllowed: () => paneRailAllowed,
|
|
131
|
+
paneViewVisibility: () => paneViewVisibility,
|
|
115
132
|
parseCustomFieldsLoose: () => parseCustomFieldsLoose,
|
|
116
133
|
parseImportedBranding: () => parseImportedBranding,
|
|
117
134
|
programToTree: () => programToTree,
|
|
@@ -120,6 +137,7 @@ __export(internal_exports, {
|
|
|
120
137
|
sanitizeCustomCss: () => sanitizeCustomCss,
|
|
121
138
|
shadowFor: () => shadowFor,
|
|
122
139
|
surfacePadValue: () => surfacePadValue,
|
|
140
|
+
validatePanes: () => validatePanes,
|
|
123
141
|
verticalGapValue: () => verticalGapValue,
|
|
124
142
|
visibleCustomFields: () => visibleCustomFields
|
|
125
143
|
});
|
|
@@ -611,23 +629,38 @@ var Connectors = class {
|
|
|
611
629
|
);
|
|
612
630
|
}
|
|
613
631
|
/**
|
|
614
|
-
* Every connector's
|
|
615
|
-
*
|
|
616
|
-
*
|
|
632
|
+
* Every connector's pane capabilities, as the router itself knows them —
|
|
633
|
+
* which rails a connector supports, and which methods it can publish as a
|
|
634
|
+
* pane with the confirm routing keys each one carries.
|
|
617
635
|
*
|
|
618
636
|
* Capability facts only: no label, sublabel or category comes back. A
|
|
619
637
|
* designer renders a method's copy from its own locale files, keyed by
|
|
620
638
|
* `key`, and takes `payment_method` / `payment_method_type` from here
|
|
621
639
|
* verbatim rather than deriving them client-side.
|
|
622
640
|
*
|
|
641
|
+
* This is what the pane helpers in `src/panes.ts` should be driven from —
|
|
642
|
+
* `paneMethodInfo`, `defaultPane` and `validatePanes` all take a
|
|
643
|
+
* {@link PanesConnectorCatalog} out of this response, so a connector the
|
|
644
|
+
* router starts publishing panes for needs no SDK release.
|
|
645
|
+
*
|
|
623
646
|
* `GET /account/{accountId}/connectors/native-panes/catalog`
|
|
647
|
+
*
|
|
648
|
+
* The path keeps the `native-panes` spelling deliberately. The identifiers
|
|
649
|
+
* were renamed off "native pane"; the route was not, and pointing at the
|
|
650
|
+
* backend's new name before it is deployed everywhere would both 404 against
|
|
651
|
+
* un-upgraded replicas mid-rollout and fail `scripts/parity-check.mjs`,
|
|
652
|
+
* which blocks publishing.
|
|
624
653
|
*/
|
|
625
|
-
async
|
|
654
|
+
async getPanesCatalog(accountId) {
|
|
626
655
|
return this.request(
|
|
627
656
|
"GET",
|
|
628
657
|
`/account/${encodeURIComponent(accountId)}/connectors/native-panes/catalog`
|
|
629
658
|
);
|
|
630
659
|
}
|
|
660
|
+
/** @deprecated Renamed to {@link getPanesCatalog}. Removed in 0.112.0. */
|
|
661
|
+
async getNativePanesCatalog(accountId) {
|
|
662
|
+
return this.getPanesCatalog(accountId);
|
|
663
|
+
}
|
|
631
664
|
/**
|
|
632
665
|
* Sweep the merchant's own e-Payouts module and return the rails it
|
|
633
666
|
* actually has enabled. Server-side this makes many upstream calls, so it
|
|
@@ -4109,6 +4142,25 @@ var Subscriptions = class {
|
|
|
4109
4142
|
}
|
|
4110
4143
|
};
|
|
4111
4144
|
|
|
4145
|
+
// src/resources/audit.ts
|
|
4146
|
+
var Audit = class {
|
|
4147
|
+
constructor(request) {
|
|
4148
|
+
this.request = request;
|
|
4149
|
+
}
|
|
4150
|
+
async list(params) {
|
|
4151
|
+
return this.request("GET", "/audit", {
|
|
4152
|
+
query: params
|
|
4153
|
+
});
|
|
4154
|
+
}
|
|
4155
|
+
/**
|
|
4156
|
+
* One entry. An id belonging to another merchant answers 404, not 403 — the
|
|
4157
|
+
* endpoint does not confirm that an entry it will not serve exists.
|
|
4158
|
+
*/
|
|
4159
|
+
async retrieve(logId) {
|
|
4160
|
+
return this.request("GET", `/audit/${encodeURIComponent(logId)}`);
|
|
4161
|
+
}
|
|
4162
|
+
};
|
|
4163
|
+
|
|
4112
4164
|
// src/resources/settlement.ts
|
|
4113
4165
|
var Settlement = class {
|
|
4114
4166
|
constructor(request) {
|
|
@@ -4610,6 +4662,7 @@ var Delopay = class {
|
|
|
4610
4662
|
this.relay = new Relay(request);
|
|
4611
4663
|
this.stripeConnect = new StripeConnect(request);
|
|
4612
4664
|
this.threeDsRules = new ThreeDsRules(request);
|
|
4665
|
+
this.audit = new Audit(request);
|
|
4613
4666
|
this.settlement = new Settlement(request);
|
|
4614
4667
|
this.operationLimits = new OperationLimits(request);
|
|
4615
4668
|
this.risk = new Risk(request);
|
|
@@ -6388,11 +6441,23 @@ var CheckoutSession = class {
|
|
|
6388
6441
|
}
|
|
6389
6442
|
};
|
|
6390
6443
|
|
|
6391
|
-
// src/
|
|
6392
|
-
var
|
|
6444
|
+
// src/panes.ts
|
|
6445
|
+
var PANE_VISIBILITIES = ["always", "embedded_only", "external_only"];
|
|
6446
|
+
function parseVisibility(raw) {
|
|
6447
|
+
return PANE_VISIBILITIES.find((value) => value === raw) ?? "always";
|
|
6448
|
+
}
|
|
6449
|
+
function paneViewVisibility(view) {
|
|
6450
|
+
const declared = PANE_VISIBILITIES.find((value) => value === view.visibility);
|
|
6451
|
+
if (declared) return declared;
|
|
6452
|
+
return view.embedded_only === true ? "embedded_only" : "always";
|
|
6453
|
+
}
|
|
6454
|
+
var STRIPE_FALLBACK_PANE_METHODS = [
|
|
6393
6455
|
{
|
|
6394
6456
|
key: "apple_pay",
|
|
6395
6457
|
rail: "wallet",
|
|
6458
|
+
paymentMethod: "wallet",
|
|
6459
|
+
paymentMethodType: "apple_pay",
|
|
6460
|
+
requiresBillingCountry: false,
|
|
6396
6461
|
defaultLabel: "Apple Pay",
|
|
6397
6462
|
defaultSublabel: "Pay with Apple Pay",
|
|
6398
6463
|
defaultCategory: "wallet",
|
|
@@ -6401,6 +6466,9 @@ var STRIPE_NATIVE_PANE_METHODS = [
|
|
|
6401
6466
|
{
|
|
6402
6467
|
key: "google_pay",
|
|
6403
6468
|
rail: "wallet",
|
|
6469
|
+
paymentMethod: "wallet",
|
|
6470
|
+
paymentMethodType: "google_pay",
|
|
6471
|
+
requiresBillingCountry: false,
|
|
6404
6472
|
defaultLabel: "Google Pay",
|
|
6405
6473
|
defaultSublabel: "Pay with Google Pay",
|
|
6406
6474
|
defaultCategory: "wallet",
|
|
@@ -6409,6 +6477,9 @@ var STRIPE_NATIVE_PANE_METHODS = [
|
|
|
6409
6477
|
{
|
|
6410
6478
|
key: "link",
|
|
6411
6479
|
rail: "wallet",
|
|
6480
|
+
paymentMethod: "wallet",
|
|
6481
|
+
paymentMethodType: "link",
|
|
6482
|
+
requiresBillingCountry: false,
|
|
6412
6483
|
defaultLabel: "Link",
|
|
6413
6484
|
defaultSublabel: "Pay with saved details",
|
|
6414
6485
|
defaultCategory: "wallet",
|
|
@@ -6417,7 +6488,18 @@ var STRIPE_NATIVE_PANE_METHODS = [
|
|
|
6417
6488
|
{
|
|
6418
6489
|
key: "klarna",
|
|
6419
6490
|
rail: "redirect",
|
|
6491
|
+
paymentMethod: "pay_later",
|
|
6492
|
+
paymentMethodType: "klarna",
|
|
6493
|
+
// Stripe's Klarna needs the buyer's country echoed into the confirm body.
|
|
6494
|
+
requiresBillingCountry: true,
|
|
6420
6495
|
defaultLabel: "Klarna",
|
|
6496
|
+
// NOT the router's current "Pay later or in 3 instalments". This table is
|
|
6497
|
+
// what a router predating the capability endpoint (delopay-backend#964)
|
|
6498
|
+
// renders, and that copy only gained the "3" in delopay-backend#1051 —
|
|
6499
|
+
// the same release that added the endpoint. Restating the new string here
|
|
6500
|
+
// would put copy no reachable router emits in front of a merchant, and
|
|
6501
|
+
// would change what the deprecated `nativePaneMethodInfo` has returned
|
|
6502
|
+
// since 0.106.0.
|
|
6421
6503
|
defaultSublabel: "Pay later or in instalments",
|
|
6422
6504
|
defaultCategory: "bnpl",
|
|
6423
6505
|
defaultIcon: "bnpl"
|
|
@@ -6425,6 +6507,9 @@ var STRIPE_NATIVE_PANE_METHODS = [
|
|
|
6425
6507
|
{
|
|
6426
6508
|
key: "affirm",
|
|
6427
6509
|
rail: "redirect",
|
|
6510
|
+
paymentMethod: "pay_later",
|
|
6511
|
+
paymentMethodType: "affirm",
|
|
6512
|
+
requiresBillingCountry: false,
|
|
6428
6513
|
defaultLabel: "Affirm",
|
|
6429
6514
|
defaultSublabel: "Pay over time",
|
|
6430
6515
|
defaultCategory: "bnpl",
|
|
@@ -6433,18 +6518,20 @@ var STRIPE_NATIVE_PANE_METHODS = [
|
|
|
6433
6518
|
{
|
|
6434
6519
|
key: "ideal",
|
|
6435
6520
|
rail: "redirect",
|
|
6521
|
+
paymentMethod: "bank_redirect",
|
|
6522
|
+
paymentMethodType: "ideal",
|
|
6523
|
+
requiresBillingCountry: false,
|
|
6436
6524
|
defaultLabel: "iDEAL",
|
|
6437
6525
|
defaultSublabel: "Pay from your bank",
|
|
6438
6526
|
defaultCategory: "bank_redirect",
|
|
6439
6527
|
defaultIcon: "bank"
|
|
6440
6528
|
},
|
|
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
6529
|
{
|
|
6446
6530
|
key: "alipay",
|
|
6447
6531
|
rail: "redirect",
|
|
6532
|
+
paymentMethod: "wallet",
|
|
6533
|
+
paymentMethodType: "ali_pay",
|
|
6534
|
+
requiresBillingCountry: false,
|
|
6448
6535
|
defaultLabel: "Alipay",
|
|
6449
6536
|
defaultSublabel: "Pay with Alipay",
|
|
6450
6537
|
defaultCategory: "wallet",
|
|
@@ -6453,6 +6540,9 @@ var STRIPE_NATIVE_PANE_METHODS = [
|
|
|
6453
6540
|
{
|
|
6454
6541
|
key: "revolut_pay",
|
|
6455
6542
|
rail: "redirect",
|
|
6543
|
+
paymentMethod: "wallet",
|
|
6544
|
+
paymentMethodType: "revolut_pay",
|
|
6545
|
+
requiresBillingCountry: false,
|
|
6456
6546
|
defaultLabel: "Revolut Pay",
|
|
6457
6547
|
defaultSublabel: "Pay with Revolut",
|
|
6458
6548
|
defaultCategory: "wallet",
|
|
@@ -6461,35 +6551,120 @@ var STRIPE_NATIVE_PANE_METHODS = [
|
|
|
6461
6551
|
{
|
|
6462
6552
|
key: "amazon_pay",
|
|
6463
6553
|
rail: "redirect",
|
|
6554
|
+
paymentMethod: "wallet",
|
|
6555
|
+
paymentMethodType: "amazon_pay",
|
|
6556
|
+
requiresBillingCountry: false,
|
|
6464
6557
|
defaultLabel: "Amazon Pay",
|
|
6465
6558
|
defaultSublabel: "Pay with Amazon",
|
|
6466
6559
|
defaultCategory: "wallet",
|
|
6467
6560
|
defaultIcon: "wallet"
|
|
6468
6561
|
}
|
|
6469
6562
|
];
|
|
6470
|
-
var
|
|
6563
|
+
var STRIPE_FALLBACK_PANE_CATALOG = {
|
|
6564
|
+
connector: "stripe",
|
|
6565
|
+
allowed_rails: ["wallet", "redirect"],
|
|
6566
|
+
methods: STRIPE_FALLBACK_PANE_METHODS.map((info) => ({
|
|
6567
|
+
key: info.key,
|
|
6568
|
+
rail: info.rail,
|
|
6569
|
+
payment_method: info.paymentMethod,
|
|
6570
|
+
payment_method_type: info.paymentMethodType,
|
|
6571
|
+
requires_billing_country: info.requiresBillingCountry
|
|
6572
|
+
}))
|
|
6573
|
+
};
|
|
6574
|
+
function emptyPaneCatalog(connector) {
|
|
6575
|
+
return { connector, allowed_rails: [], methods: [] };
|
|
6576
|
+
}
|
|
6577
|
+
function paneCatalogFor(response, connector) {
|
|
6578
|
+
return response.connectors.find((entry) => entry.connector === connector) ?? emptyPaneCatalog(connector);
|
|
6579
|
+
}
|
|
6580
|
+
var PANE_ICON_KEYS = [
|
|
6471
6581
|
"wallet",
|
|
6472
6582
|
"card",
|
|
6473
6583
|
"bank",
|
|
6474
6584
|
"apple",
|
|
6475
6585
|
"google",
|
|
6476
6586
|
"bnpl",
|
|
6477
|
-
"cash"
|
|
6587
|
+
"cash",
|
|
6588
|
+
// Brand marks, not category glyphs: the checkout draws PayPal's monogram,
|
|
6589
|
+
// Klarna's squircle-K and the Bitcoin mark for these, the same logos the
|
|
6590
|
+
// bespoke panes they replace already drew. Listed here so a merchant's own
|
|
6591
|
+
// dashboard can offer them; the router decides which one a tile *defaults*
|
|
6592
|
+
// to, and a router predating them simply keeps sending the old default.
|
|
6593
|
+
"paypal",
|
|
6594
|
+
"klarna",
|
|
6595
|
+
"crypto"
|
|
6478
6596
|
];
|
|
6479
|
-
var
|
|
6597
|
+
var PANE_CATEGORY_KEYS = [
|
|
6480
6598
|
"wallet",
|
|
6481
6599
|
"card",
|
|
6482
6600
|
"bnpl",
|
|
6483
6601
|
"bank_redirect",
|
|
6484
6602
|
"bank_transfer",
|
|
6603
|
+
"crypto",
|
|
6604
|
+
"game_items",
|
|
6485
6605
|
"cash"
|
|
6486
6606
|
];
|
|
6487
|
-
var
|
|
6488
|
-
function
|
|
6489
|
-
return
|
|
6607
|
+
var PANES_MAX = 12;
|
|
6608
|
+
function paneMethodInfo(method, catalog = STRIPE_FALLBACK_PANE_CATALOG) {
|
|
6609
|
+
return catalog.methods.find((info) => info.key === method);
|
|
6490
6610
|
}
|
|
6491
|
-
function
|
|
6492
|
-
|
|
6611
|
+
function paneRailAllowed(rail, catalog) {
|
|
6612
|
+
return catalog.allowed_rails.includes(rail);
|
|
6613
|
+
}
|
|
6614
|
+
function offerablePaneMethods(catalog) {
|
|
6615
|
+
return catalog.methods.filter((info) => paneRailAllowed(info.rail, catalog));
|
|
6616
|
+
}
|
|
6617
|
+
var DISPLAY_DEFAULTS_BY_KEY = {
|
|
6618
|
+
apple_pay: { icon: "apple", category: "wallet" },
|
|
6619
|
+
google_pay: { icon: "google", category: "wallet" },
|
|
6620
|
+
paypal: { icon: "paypal", category: "wallet" },
|
|
6621
|
+
// Both the Klarna connector's own tile and Stripe's Klarna. Affirm stays on
|
|
6622
|
+
// the generic `bnpl` glyph — same rail, no mark of its own.
|
|
6623
|
+
klarna: { icon: "klarna", category: "bnpl" }
|
|
6624
|
+
};
|
|
6625
|
+
var DISPLAY_DEFAULTS_BY_PAYMENT_METHOD = {
|
|
6626
|
+
wallet: { icon: "wallet", category: "wallet" },
|
|
6627
|
+
card: { icon: "card", category: "card" },
|
|
6628
|
+
card_redirect: { icon: "card", category: "card" },
|
|
6629
|
+
pay_later: { icon: "bnpl", category: "bnpl" },
|
|
6630
|
+
bank_redirect: { icon: "bank", category: "bank_redirect" },
|
|
6631
|
+
bank_transfer: { icon: "bank", category: "bank_transfer" },
|
|
6632
|
+
bank_debit: { icon: "bank", category: "bank_transfer" },
|
|
6633
|
+
// Cryptomus and NowPayments publish the same `crypto` key on this rail, and
|
|
6634
|
+
// the router defaults both to the Bitcoin mark.
|
|
6635
|
+
crypto: { icon: "crypto", category: "crypto" },
|
|
6636
|
+
// Skinsback, which has no mark: the router defaults it to `wallet` too.
|
|
6637
|
+
game_items: { icon: "wallet", category: "game_items" },
|
|
6638
|
+
cash: { icon: "cash", category: "cash" },
|
|
6639
|
+
voucher: { icon: "cash", category: "cash" }
|
|
6640
|
+
};
|
|
6641
|
+
var DISPLAY_DEFAULTS_FALLBACK = { icon: "wallet", category: "wallet" };
|
|
6642
|
+
function paneDisplayDefaults(info) {
|
|
6643
|
+
if (!info) return DISPLAY_DEFAULTS_FALLBACK;
|
|
6644
|
+
return DISPLAY_DEFAULTS_BY_KEY[info.key] ?? DISPLAY_DEFAULTS_BY_PAYMENT_METHOD[info.payment_method] ?? DISPLAY_DEFAULTS_FALLBACK;
|
|
6645
|
+
}
|
|
6646
|
+
function validatePanes(panes, catalog = STRIPE_FALLBACK_PANE_CATALOG) {
|
|
6647
|
+
const issues = [];
|
|
6648
|
+
const claimedBy = /* @__PURE__ */ new Set();
|
|
6649
|
+
panes.forEach((pane, index) => {
|
|
6650
|
+
const info = paneMethodInfo(pane.method, catalog);
|
|
6651
|
+
if (!info) {
|
|
6652
|
+
issues.push({ index, method: pane.method, code: "method_unknown" });
|
|
6653
|
+
} else if (!paneRailAllowed(info.rail, catalog)) {
|
|
6654
|
+
issues.push({ index, method: pane.method, code: "rail_not_allowed" });
|
|
6655
|
+
} else if (pane.enabled) {
|
|
6656
|
+
if (claimedBy.has(info.key)) {
|
|
6657
|
+
issues.push({ index, method: pane.method, code: "duplicate_method" });
|
|
6658
|
+
} else {
|
|
6659
|
+
claimedBy.add(info.key);
|
|
6660
|
+
}
|
|
6661
|
+
}
|
|
6662
|
+
if (index >= PANES_MAX) issues.push({ index, method: pane.method, code: "over_cap" });
|
|
6663
|
+
});
|
|
6664
|
+
return issues;
|
|
6665
|
+
}
|
|
6666
|
+
function defaultPane(method, catalog = STRIPE_FALLBACK_PANE_CATALOG) {
|
|
6667
|
+
const defaults = paneDisplayDefaults(paneMethodInfo(method, catalog));
|
|
6493
6668
|
return {
|
|
6494
6669
|
method,
|
|
6495
6670
|
enabled: true,
|
|
@@ -6497,15 +6672,15 @@ function defaultNativePane(method) {
|
|
|
6497
6672
|
labelTranslations: {},
|
|
6498
6673
|
sublabel: null,
|
|
6499
6674
|
sublabelTranslations: {},
|
|
6500
|
-
category:
|
|
6501
|
-
icon:
|
|
6675
|
+
category: defaults.category,
|
|
6676
|
+
icon: defaults.icon,
|
|
6502
6677
|
iconSvg: "",
|
|
6503
6678
|
displayOrder: 0,
|
|
6504
6679
|
visibility: "always",
|
|
6505
6680
|
openIn: "tab"
|
|
6506
6681
|
};
|
|
6507
6682
|
}
|
|
6508
|
-
function
|
|
6683
|
+
function clonePane(pane) {
|
|
6509
6684
|
return {
|
|
6510
6685
|
...pane,
|
|
6511
6686
|
labelTranslations: { ...pane.labelTranslations },
|
|
@@ -6532,7 +6707,7 @@ function clampDisplayOrder(raw) {
|
|
|
6532
6707
|
if (!Number.isFinite(raw)) return 0;
|
|
6533
6708
|
return Math.min(DISPLAY_ORDER_MAX, Math.max(DISPLAY_ORDER_MIN, Math.trunc(raw)));
|
|
6534
6709
|
}
|
|
6535
|
-
function
|
|
6710
|
+
function decodePanes(raw) {
|
|
6536
6711
|
if (!Array.isArray(raw)) return null;
|
|
6537
6712
|
const decodeRow = (entry, method) => ({
|
|
6538
6713
|
method,
|
|
@@ -6546,14 +6721,14 @@ function decodeNativePanes(raw) {
|
|
|
6546
6721
|
iconSvg: str(entry["icon_svg"]),
|
|
6547
6722
|
displayOrder: clampDisplayOrder(Number(entry["display_order"])),
|
|
6548
6723
|
// Anything unrecognised degrades to `always` rather than dropping the row.
|
|
6549
|
-
visibility: entry["visibility"]
|
|
6724
|
+
visibility: parseVisibility(entry["visibility"]),
|
|
6550
6725
|
// Same tolerance: an unknown value degrades to the default `tab`.
|
|
6551
6726
|
openIn: entry["open_in"] === "popup" ? "popup" : "tab"
|
|
6552
6727
|
});
|
|
6553
6728
|
const indexByMethod = /* @__PURE__ */ new Map();
|
|
6554
6729
|
const out = [];
|
|
6555
6730
|
for (const entry of raw) {
|
|
6556
|
-
if (out.length >=
|
|
6731
|
+
if (out.length >= PANES_MAX) break;
|
|
6557
6732
|
if (!isObject2(entry)) continue;
|
|
6558
6733
|
const method = str(entry["method"]).trim();
|
|
6559
6734
|
if (!method) continue;
|
|
@@ -6569,12 +6744,12 @@ function decodeNativePanes(raw) {
|
|
|
6569
6744
|
}
|
|
6570
6745
|
return out;
|
|
6571
6746
|
}
|
|
6572
|
-
function
|
|
6747
|
+
function encodePanes(panes) {
|
|
6573
6748
|
const nonEmpty = (map) => {
|
|
6574
6749
|
const entries = Object.entries(map).filter(([, v]) => v.trim().length > 0);
|
|
6575
6750
|
return entries.length > 0 ? Object.fromEntries(entries) : void 0;
|
|
6576
6751
|
};
|
|
6577
|
-
return panes.slice(0,
|
|
6752
|
+
return panes.slice(0, PANES_MAX).map((pane) => {
|
|
6578
6753
|
const labelTranslations = nonEmpty(pane.labelTranslations);
|
|
6579
6754
|
const sublabelTranslations = nonEmpty(pane.sublabelTranslations);
|
|
6580
6755
|
return {
|
|
@@ -6582,7 +6757,7 @@ function encodeNativePanes(panes) {
|
|
|
6582
6757
|
enabled: pane.enabled,
|
|
6583
6758
|
...pane.label.trim() ? { label: pane.label.trim() } : {},
|
|
6584
6759
|
...labelTranslations ? { label_translations: labelTranslations } : {},
|
|
6585
|
-
// `null` omits the key entirely (
|
|
6760
|
+
// `null` omits the key entirely (catalogue default wins); `''` is sent
|
|
6586
6761
|
// as-is because that is how the merchant hides the second line.
|
|
6587
6762
|
...pane.sublabel !== null ? { sublabel: pane.sublabel } : {},
|
|
6588
6763
|
...sublabelTranslations ? { sublabel_translations: sublabelTranslations } : {},
|
|
@@ -6594,8 +6769,13 @@ function encodeNativePanes(panes) {
|
|
|
6594
6769
|
// writing e.g. 3.5 or Date.now() verbatim would silently delete the
|
|
6595
6770
|
// pane at render while every read surface shows it healthy.
|
|
6596
6771
|
display_order: clampDisplayOrder(pane.displayOrder),
|
|
6597
|
-
|
|
6598
|
-
|
|
6772
|
+
// Normalised on encode for the same reason `display_order` is clamped:
|
|
6773
|
+
// the router's strict row decode drops a row whole on a value outside
|
|
6774
|
+
// its enum, and a caller who built a `Pane` by hand (or in plain JS)
|
|
6775
|
+
// never went through `decodePanes`. A decoded pane always holds a valid
|
|
6776
|
+
// value, so this is a no-op on the round-trip path.
|
|
6777
|
+
visibility: parseVisibility(pane.visibility),
|
|
6778
|
+
open_in: pane.openIn === "popup" ? "popup" : "tab"
|
|
6599
6779
|
};
|
|
6600
6780
|
});
|
|
6601
6781
|
}
|
|
@@ -6605,6 +6785,10 @@ function focusedCheckoutUrl(params) {
|
|
|
6605
6785
|
params.paymentId
|
|
6606
6786
|
)}`;
|
|
6607
6787
|
const query = new URLSearchParams({ pane: params.method });
|
|
6788
|
+
const connector = params.connector?.trim();
|
|
6789
|
+
if (connector) query.set("connector", connector);
|
|
6790
|
+
const merchantConnectorId = params.merchantConnectorId?.trim();
|
|
6791
|
+
if (merchantConnectorId) query.set("mca", merchantConnectorId);
|
|
6608
6792
|
if (params.locale) query.set("locale", params.locale);
|
|
6609
6793
|
if (params.customFieldsCollected) query.set("cf", "1");
|
|
6610
6794
|
return `${path}?${query.toString()}`;
|
|
@@ -6616,6 +6800,24 @@ var CHECKOUT_EVENT_KINDS = [
|
|
|
6616
6800
|
"native_pane_abandoned",
|
|
6617
6801
|
"native_pane_returned"
|
|
6618
6802
|
];
|
|
6803
|
+
var STRIPE_NATIVE_PANE_METHODS = STRIPE_FALLBACK_PANE_METHODS;
|
|
6804
|
+
var NATIVE_PANE_ICON_KEYS = PANE_ICON_KEYS;
|
|
6805
|
+
var NATIVE_PANE_CATEGORY_KEYS = PANE_CATEGORY_KEYS;
|
|
6806
|
+
var NATIVE_PANES_MAX = PANES_MAX;
|
|
6807
|
+
function nativePaneMethodInfo(method) {
|
|
6808
|
+
return STRIPE_FALLBACK_PANE_METHODS.find((info) => info.key === method);
|
|
6809
|
+
}
|
|
6810
|
+
function defaultNativePane(method) {
|
|
6811
|
+
const info = nativePaneMethodInfo(method);
|
|
6812
|
+
return {
|
|
6813
|
+
...defaultPane(method),
|
|
6814
|
+
category: "",
|
|
6815
|
+
icon: info?.defaultIcon ?? ""
|
|
6816
|
+
};
|
|
6817
|
+
}
|
|
6818
|
+
var cloneNativePane = clonePane;
|
|
6819
|
+
var decodeNativePanes = decodePanes;
|
|
6820
|
+
var encodeNativePanes = encodePanes;
|
|
6619
6821
|
|
|
6620
6822
|
// src/internal/resources/admin.ts
|
|
6621
6823
|
var Admin = class {
|
|
@@ -7484,6 +7686,7 @@ var DelopayInternal = class extends Delopay {
|
|
|
7484
7686
|
AdminPortal,
|
|
7485
7687
|
Analytics,
|
|
7486
7688
|
AnalyticsDashboard,
|
|
7689
|
+
Audit,
|
|
7487
7690
|
AuditLogs,
|
|
7488
7691
|
AvailabilityOverrides,
|
|
7489
7692
|
BRANDING_EXPORT_FORMAT,
|
|
@@ -7522,10 +7725,15 @@ var DelopayInternal = class extends Delopay {
|
|
|
7522
7725
|
NATIVE_PANE_CATEGORY_KEYS,
|
|
7523
7726
|
NATIVE_PANE_ICON_KEYS,
|
|
7524
7727
|
OperationLimits,
|
|
7728
|
+
PANES_MAX,
|
|
7729
|
+
PANE_CATEGORY_KEYS,
|
|
7730
|
+
PANE_ICON_KEYS,
|
|
7525
7731
|
PlatformBilling,
|
|
7526
7732
|
PlatformFees,
|
|
7527
7733
|
Regions,
|
|
7528
7734
|
Risk,
|
|
7735
|
+
STRIPE_FALLBACK_PANE_CATALOG,
|
|
7736
|
+
STRIPE_FALLBACK_PANE_METHODS,
|
|
7529
7737
|
STRIPE_NATIVE_PANE_METHODS,
|
|
7530
7738
|
Search,
|
|
7531
7739
|
Settlement,
|
|
@@ -7539,6 +7747,7 @@ var DelopayInternal = class extends Delopay {
|
|
|
7539
7747
|
cloneBranding,
|
|
7540
7748
|
cloneCustomField,
|
|
7541
7749
|
cloneNativePane,
|
|
7750
|
+
clonePane,
|
|
7542
7751
|
customFieldContextFromMetadata,
|
|
7543
7752
|
customFieldIsTextLike,
|
|
7544
7753
|
customFieldOperatorTakesValue,
|
|
@@ -7548,14 +7757,18 @@ var DelopayInternal = class extends Delopay {
|
|
|
7548
7757
|
decodeBranding,
|
|
7549
7758
|
decodeCustomFields,
|
|
7550
7759
|
decodeNativePanes,
|
|
7760
|
+
decodePanes,
|
|
7551
7761
|
defaultBranding,
|
|
7552
7762
|
defaultCustomFieldVisibility,
|
|
7553
7763
|
defaultNativePane,
|
|
7554
7764
|
defaultOperatorForSource,
|
|
7765
|
+
defaultPane,
|
|
7766
|
+
emptyPaneCatalog,
|
|
7555
7767
|
encodeBadges,
|
|
7556
7768
|
encodeBranding,
|
|
7557
7769
|
encodeCustomFields,
|
|
7558
7770
|
encodeNativePanes,
|
|
7771
|
+
encodePanes,
|
|
7559
7772
|
evaluateCustomFieldCondition,
|
|
7560
7773
|
evaluateCustomFieldVisibility,
|
|
7561
7774
|
feeProgram,
|
|
@@ -7569,6 +7782,12 @@ var DelopayInternal = class extends Delopay {
|
|
|
7569
7782
|
leaf,
|
|
7570
7783
|
logoDimensions,
|
|
7571
7784
|
nativePaneMethodInfo,
|
|
7785
|
+
offerablePaneMethods,
|
|
7786
|
+
paneCatalogFor,
|
|
7787
|
+
paneDisplayDefaults,
|
|
7788
|
+
paneMethodInfo,
|
|
7789
|
+
paneRailAllowed,
|
|
7790
|
+
paneViewVisibility,
|
|
7572
7791
|
parseCustomFieldsLoose,
|
|
7573
7792
|
parseImportedBranding,
|
|
7574
7793
|
programToTree,
|
|
@@ -7577,6 +7796,7 @@ var DelopayInternal = class extends Delopay {
|
|
|
7577
7796
|
sanitizeCustomCss,
|
|
7578
7797
|
shadowFor,
|
|
7579
7798
|
surfacePadValue,
|
|
7799
|
+
validatePanes,
|
|
7580
7800
|
verticalGapValue,
|
|
7581
7801
|
visibleCustomFields
|
|
7582
7802
|
});
|