@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/index.cjs
CHANGED
|
@@ -25,6 +25,7 @@ __export(index_exports, {
|
|
|
25
25
|
ALL_CUSTOM_FIELD_TYPES: () => ALL_CUSTOM_FIELD_TYPES,
|
|
26
26
|
Analytics: () => Analytics,
|
|
27
27
|
AnalyticsDashboard: () => AnalyticsDashboard,
|
|
28
|
+
Audit: () => Audit,
|
|
28
29
|
AvailabilityOverrides: () => AvailabilityOverrides,
|
|
29
30
|
BRANDING_EXPORT_FORMAT: () => BRANDING_EXPORT_FORMAT,
|
|
30
31
|
BRANDING_EXPORT_VERSION: () => BRANDING_EXPORT_VERSION,
|
|
@@ -55,8 +56,13 @@ __export(index_exports, {
|
|
|
55
56
|
NATIVE_PANE_CATEGORY_KEYS: () => NATIVE_PANE_CATEGORY_KEYS,
|
|
56
57
|
NATIVE_PANE_ICON_KEYS: () => NATIVE_PANE_ICON_KEYS,
|
|
57
58
|
OperationLimits: () => OperationLimits,
|
|
59
|
+
PANES_MAX: () => PANES_MAX,
|
|
60
|
+
PANE_CATEGORY_KEYS: () => PANE_CATEGORY_KEYS,
|
|
61
|
+
PANE_ICON_KEYS: () => PANE_ICON_KEYS,
|
|
58
62
|
Regions: () => Regions,
|
|
59
63
|
Risk: () => Risk,
|
|
64
|
+
STRIPE_FALLBACK_PANE_CATALOG: () => STRIPE_FALLBACK_PANE_CATALOG,
|
|
65
|
+
STRIPE_FALLBACK_PANE_METHODS: () => STRIPE_FALLBACK_PANE_METHODS,
|
|
60
66
|
STRIPE_NATIVE_PANE_METHODS: () => STRIPE_NATIVE_PANE_METHODS,
|
|
61
67
|
Search: () => Search,
|
|
62
68
|
Settlement: () => Settlement,
|
|
@@ -70,6 +76,7 @@ __export(index_exports, {
|
|
|
70
76
|
cloneBranding: () => cloneBranding,
|
|
71
77
|
cloneCustomField: () => cloneCustomField,
|
|
72
78
|
cloneNativePane: () => cloneNativePane,
|
|
79
|
+
clonePane: () => clonePane,
|
|
73
80
|
customFieldContextFromMetadata: () => customFieldContextFromMetadata,
|
|
74
81
|
customFieldIsTextLike: () => customFieldIsTextLike,
|
|
75
82
|
customFieldOperatorTakesValue: () => customFieldOperatorTakesValue,
|
|
@@ -79,14 +86,18 @@ __export(index_exports, {
|
|
|
79
86
|
decodeBranding: () => decodeBranding,
|
|
80
87
|
decodeCustomFields: () => decodeCustomFields,
|
|
81
88
|
decodeNativePanes: () => decodeNativePanes,
|
|
89
|
+
decodePanes: () => decodePanes,
|
|
82
90
|
defaultBranding: () => defaultBranding,
|
|
83
91
|
defaultCustomFieldVisibility: () => defaultCustomFieldVisibility,
|
|
84
92
|
defaultNativePane: () => defaultNativePane,
|
|
85
93
|
defaultOperatorForSource: () => defaultOperatorForSource,
|
|
94
|
+
defaultPane: () => defaultPane,
|
|
95
|
+
emptyPaneCatalog: () => emptyPaneCatalog,
|
|
86
96
|
encodeBadges: () => encodeBadges,
|
|
87
97
|
encodeBranding: () => encodeBranding,
|
|
88
98
|
encodeCustomFields: () => encodeCustomFields,
|
|
89
99
|
encodeNativePanes: () => encodeNativePanes,
|
|
100
|
+
encodePanes: () => encodePanes,
|
|
90
101
|
evaluateCustomFieldCondition: () => evaluateCustomFieldCondition,
|
|
91
102
|
evaluateCustomFieldVisibility: () => evaluateCustomFieldVisibility,
|
|
92
103
|
feeProgram: () => feeProgram,
|
|
@@ -100,6 +111,12 @@ __export(index_exports, {
|
|
|
100
111
|
leaf: () => leaf,
|
|
101
112
|
logoDimensions: () => logoDimensions,
|
|
102
113
|
nativePaneMethodInfo: () => nativePaneMethodInfo,
|
|
114
|
+
offerablePaneMethods: () => offerablePaneMethods,
|
|
115
|
+
paneCatalogFor: () => paneCatalogFor,
|
|
116
|
+
paneDisplayDefaults: () => paneDisplayDefaults,
|
|
117
|
+
paneMethodInfo: () => paneMethodInfo,
|
|
118
|
+
paneRailAllowed: () => paneRailAllowed,
|
|
119
|
+
paneViewVisibility: () => paneViewVisibility,
|
|
103
120
|
parseCustomFieldsLoose: () => parseCustomFieldsLoose,
|
|
104
121
|
parseImportedBranding: () => parseImportedBranding,
|
|
105
122
|
programToTree: () => programToTree,
|
|
@@ -108,6 +125,7 @@ __export(index_exports, {
|
|
|
108
125
|
sanitizeCustomCss: () => sanitizeCustomCss,
|
|
109
126
|
shadowFor: () => shadowFor,
|
|
110
127
|
surfacePadValue: () => surfacePadValue,
|
|
128
|
+
validatePanes: () => validatePanes,
|
|
111
129
|
verticalGapValue: () => verticalGapValue,
|
|
112
130
|
visibleCustomFields: () => visibleCustomFields
|
|
113
131
|
});
|
|
@@ -599,23 +617,38 @@ var Connectors = class {
|
|
|
599
617
|
);
|
|
600
618
|
}
|
|
601
619
|
/**
|
|
602
|
-
* Every connector's
|
|
603
|
-
*
|
|
604
|
-
*
|
|
620
|
+
* Every connector's pane capabilities, as the router itself knows them —
|
|
621
|
+
* which rails a connector supports, and which methods it can publish as a
|
|
622
|
+
* pane with the confirm routing keys each one carries.
|
|
605
623
|
*
|
|
606
624
|
* Capability facts only: no label, sublabel or category comes back. A
|
|
607
625
|
* designer renders a method's copy from its own locale files, keyed by
|
|
608
626
|
* `key`, and takes `payment_method` / `payment_method_type` from here
|
|
609
627
|
* verbatim rather than deriving them client-side.
|
|
610
628
|
*
|
|
629
|
+
* This is what the pane helpers in `src/panes.ts` should be driven from —
|
|
630
|
+
* `paneMethodInfo`, `defaultPane` and `validatePanes` all take a
|
|
631
|
+
* {@link PanesConnectorCatalog} out of this response, so a connector the
|
|
632
|
+
* router starts publishing panes for needs no SDK release.
|
|
633
|
+
*
|
|
611
634
|
* `GET /account/{accountId}/connectors/native-panes/catalog`
|
|
635
|
+
*
|
|
636
|
+
* The path keeps the `native-panes` spelling deliberately. The identifiers
|
|
637
|
+
* were renamed off "native pane"; the route was not, and pointing at the
|
|
638
|
+
* backend's new name before it is deployed everywhere would both 404 against
|
|
639
|
+
* un-upgraded replicas mid-rollout and fail `scripts/parity-check.mjs`,
|
|
640
|
+
* which blocks publishing.
|
|
612
641
|
*/
|
|
613
|
-
async
|
|
642
|
+
async getPanesCatalog(accountId) {
|
|
614
643
|
return this.request(
|
|
615
644
|
"GET",
|
|
616
645
|
`/account/${encodeURIComponent(accountId)}/connectors/native-panes/catalog`
|
|
617
646
|
);
|
|
618
647
|
}
|
|
648
|
+
/** @deprecated Renamed to {@link getPanesCatalog}. Removed in 0.112.0. */
|
|
649
|
+
async getNativePanesCatalog(accountId) {
|
|
650
|
+
return this.getPanesCatalog(accountId);
|
|
651
|
+
}
|
|
619
652
|
/**
|
|
620
653
|
* Sweep the merchant's own e-Payouts module and return the rails it
|
|
621
654
|
* actually has enabled. Server-side this makes many upstream calls, so it
|
|
@@ -4097,6 +4130,25 @@ var Subscriptions = class {
|
|
|
4097
4130
|
}
|
|
4098
4131
|
};
|
|
4099
4132
|
|
|
4133
|
+
// src/resources/audit.ts
|
|
4134
|
+
var Audit = class {
|
|
4135
|
+
constructor(request) {
|
|
4136
|
+
this.request = request;
|
|
4137
|
+
}
|
|
4138
|
+
async list(params) {
|
|
4139
|
+
return this.request("GET", "/audit", {
|
|
4140
|
+
query: params
|
|
4141
|
+
});
|
|
4142
|
+
}
|
|
4143
|
+
/**
|
|
4144
|
+
* One entry. An id belonging to another merchant answers 404, not 403 — the
|
|
4145
|
+
* endpoint does not confirm that an entry it will not serve exists.
|
|
4146
|
+
*/
|
|
4147
|
+
async retrieve(logId) {
|
|
4148
|
+
return this.request("GET", `/audit/${encodeURIComponent(logId)}`);
|
|
4149
|
+
}
|
|
4150
|
+
};
|
|
4151
|
+
|
|
4100
4152
|
// src/resources/settlement.ts
|
|
4101
4153
|
var Settlement = class {
|
|
4102
4154
|
constructor(request) {
|
|
@@ -4598,6 +4650,7 @@ var Delopay = class {
|
|
|
4598
4650
|
this.relay = new Relay(request);
|
|
4599
4651
|
this.stripeConnect = new StripeConnect(request);
|
|
4600
4652
|
this.threeDsRules = new ThreeDsRules(request);
|
|
4653
|
+
this.audit = new Audit(request);
|
|
4601
4654
|
this.settlement = new Settlement(request);
|
|
4602
4655
|
this.operationLimits = new OperationLimits(request);
|
|
4603
4656
|
this.risk = new Risk(request);
|
|
@@ -6376,11 +6429,23 @@ var CheckoutSession = class {
|
|
|
6376
6429
|
}
|
|
6377
6430
|
};
|
|
6378
6431
|
|
|
6379
|
-
// src/
|
|
6380
|
-
var
|
|
6432
|
+
// src/panes.ts
|
|
6433
|
+
var PANE_VISIBILITIES = ["always", "embedded_only", "external_only"];
|
|
6434
|
+
function parseVisibility(raw) {
|
|
6435
|
+
return PANE_VISIBILITIES.find((value) => value === raw) ?? "always";
|
|
6436
|
+
}
|
|
6437
|
+
function paneViewVisibility(view) {
|
|
6438
|
+
const declared = PANE_VISIBILITIES.find((value) => value === view.visibility);
|
|
6439
|
+
if (declared) return declared;
|
|
6440
|
+
return view.embedded_only === true ? "embedded_only" : "always";
|
|
6441
|
+
}
|
|
6442
|
+
var STRIPE_FALLBACK_PANE_METHODS = [
|
|
6381
6443
|
{
|
|
6382
6444
|
key: "apple_pay",
|
|
6383
6445
|
rail: "wallet",
|
|
6446
|
+
paymentMethod: "wallet",
|
|
6447
|
+
paymentMethodType: "apple_pay",
|
|
6448
|
+
requiresBillingCountry: false,
|
|
6384
6449
|
defaultLabel: "Apple Pay",
|
|
6385
6450
|
defaultSublabel: "Pay with Apple Pay",
|
|
6386
6451
|
defaultCategory: "wallet",
|
|
@@ -6389,6 +6454,9 @@ var STRIPE_NATIVE_PANE_METHODS = [
|
|
|
6389
6454
|
{
|
|
6390
6455
|
key: "google_pay",
|
|
6391
6456
|
rail: "wallet",
|
|
6457
|
+
paymentMethod: "wallet",
|
|
6458
|
+
paymentMethodType: "google_pay",
|
|
6459
|
+
requiresBillingCountry: false,
|
|
6392
6460
|
defaultLabel: "Google Pay",
|
|
6393
6461
|
defaultSublabel: "Pay with Google Pay",
|
|
6394
6462
|
defaultCategory: "wallet",
|
|
@@ -6397,6 +6465,9 @@ var STRIPE_NATIVE_PANE_METHODS = [
|
|
|
6397
6465
|
{
|
|
6398
6466
|
key: "link",
|
|
6399
6467
|
rail: "wallet",
|
|
6468
|
+
paymentMethod: "wallet",
|
|
6469
|
+
paymentMethodType: "link",
|
|
6470
|
+
requiresBillingCountry: false,
|
|
6400
6471
|
defaultLabel: "Link",
|
|
6401
6472
|
defaultSublabel: "Pay with saved details",
|
|
6402
6473
|
defaultCategory: "wallet",
|
|
@@ -6405,7 +6476,18 @@ var STRIPE_NATIVE_PANE_METHODS = [
|
|
|
6405
6476
|
{
|
|
6406
6477
|
key: "klarna",
|
|
6407
6478
|
rail: "redirect",
|
|
6479
|
+
paymentMethod: "pay_later",
|
|
6480
|
+
paymentMethodType: "klarna",
|
|
6481
|
+
// Stripe's Klarna needs the buyer's country echoed into the confirm body.
|
|
6482
|
+
requiresBillingCountry: true,
|
|
6408
6483
|
defaultLabel: "Klarna",
|
|
6484
|
+
// NOT the router's current "Pay later or in 3 instalments". This table is
|
|
6485
|
+
// what a router predating the capability endpoint (delopay-backend#964)
|
|
6486
|
+
// renders, and that copy only gained the "3" in delopay-backend#1051 —
|
|
6487
|
+
// the same release that added the endpoint. Restating the new string here
|
|
6488
|
+
// would put copy no reachable router emits in front of a merchant, and
|
|
6489
|
+
// would change what the deprecated `nativePaneMethodInfo` has returned
|
|
6490
|
+
// since 0.106.0.
|
|
6409
6491
|
defaultSublabel: "Pay later or in instalments",
|
|
6410
6492
|
defaultCategory: "bnpl",
|
|
6411
6493
|
defaultIcon: "bnpl"
|
|
@@ -6413,6 +6495,9 @@ var STRIPE_NATIVE_PANE_METHODS = [
|
|
|
6413
6495
|
{
|
|
6414
6496
|
key: "affirm",
|
|
6415
6497
|
rail: "redirect",
|
|
6498
|
+
paymentMethod: "pay_later",
|
|
6499
|
+
paymentMethodType: "affirm",
|
|
6500
|
+
requiresBillingCountry: false,
|
|
6416
6501
|
defaultLabel: "Affirm",
|
|
6417
6502
|
defaultSublabel: "Pay over time",
|
|
6418
6503
|
defaultCategory: "bnpl",
|
|
@@ -6421,18 +6506,20 @@ var STRIPE_NATIVE_PANE_METHODS = [
|
|
|
6421
6506
|
{
|
|
6422
6507
|
key: "ideal",
|
|
6423
6508
|
rail: "redirect",
|
|
6509
|
+
paymentMethod: "bank_redirect",
|
|
6510
|
+
paymentMethodType: "ideal",
|
|
6511
|
+
requiresBillingCountry: false,
|
|
6424
6512
|
defaultLabel: "iDEAL",
|
|
6425
6513
|
defaultSublabel: "Pay from your bank",
|
|
6426
6514
|
defaultCategory: "bank_redirect",
|
|
6427
6515
|
defaultIcon: "bank"
|
|
6428
6516
|
},
|
|
6429
|
-
// eps / p24 / bancontact were removed from the router catalog: Stripe
|
|
6430
|
-
// hard-requires billing fields the focused checkout never collects (full
|
|
6431
|
-
// name for EPS/Bancontact, email for Przelewy24), so their tiles could
|
|
6432
|
-
// never succeed. They may return behind billing-aware gating.
|
|
6433
6517
|
{
|
|
6434
6518
|
key: "alipay",
|
|
6435
6519
|
rail: "redirect",
|
|
6520
|
+
paymentMethod: "wallet",
|
|
6521
|
+
paymentMethodType: "ali_pay",
|
|
6522
|
+
requiresBillingCountry: false,
|
|
6436
6523
|
defaultLabel: "Alipay",
|
|
6437
6524
|
defaultSublabel: "Pay with Alipay",
|
|
6438
6525
|
defaultCategory: "wallet",
|
|
@@ -6441,6 +6528,9 @@ var STRIPE_NATIVE_PANE_METHODS = [
|
|
|
6441
6528
|
{
|
|
6442
6529
|
key: "revolut_pay",
|
|
6443
6530
|
rail: "redirect",
|
|
6531
|
+
paymentMethod: "wallet",
|
|
6532
|
+
paymentMethodType: "revolut_pay",
|
|
6533
|
+
requiresBillingCountry: false,
|
|
6444
6534
|
defaultLabel: "Revolut Pay",
|
|
6445
6535
|
defaultSublabel: "Pay with Revolut",
|
|
6446
6536
|
defaultCategory: "wallet",
|
|
@@ -6449,35 +6539,120 @@ var STRIPE_NATIVE_PANE_METHODS = [
|
|
|
6449
6539
|
{
|
|
6450
6540
|
key: "amazon_pay",
|
|
6451
6541
|
rail: "redirect",
|
|
6542
|
+
paymentMethod: "wallet",
|
|
6543
|
+
paymentMethodType: "amazon_pay",
|
|
6544
|
+
requiresBillingCountry: false,
|
|
6452
6545
|
defaultLabel: "Amazon Pay",
|
|
6453
6546
|
defaultSublabel: "Pay with Amazon",
|
|
6454
6547
|
defaultCategory: "wallet",
|
|
6455
6548
|
defaultIcon: "wallet"
|
|
6456
6549
|
}
|
|
6457
6550
|
];
|
|
6458
|
-
var
|
|
6551
|
+
var STRIPE_FALLBACK_PANE_CATALOG = {
|
|
6552
|
+
connector: "stripe",
|
|
6553
|
+
allowed_rails: ["wallet", "redirect"],
|
|
6554
|
+
methods: STRIPE_FALLBACK_PANE_METHODS.map((info) => ({
|
|
6555
|
+
key: info.key,
|
|
6556
|
+
rail: info.rail,
|
|
6557
|
+
payment_method: info.paymentMethod,
|
|
6558
|
+
payment_method_type: info.paymentMethodType,
|
|
6559
|
+
requires_billing_country: info.requiresBillingCountry
|
|
6560
|
+
}))
|
|
6561
|
+
};
|
|
6562
|
+
function emptyPaneCatalog(connector) {
|
|
6563
|
+
return { connector, allowed_rails: [], methods: [] };
|
|
6564
|
+
}
|
|
6565
|
+
function paneCatalogFor(response, connector) {
|
|
6566
|
+
return response.connectors.find((entry) => entry.connector === connector) ?? emptyPaneCatalog(connector);
|
|
6567
|
+
}
|
|
6568
|
+
var PANE_ICON_KEYS = [
|
|
6459
6569
|
"wallet",
|
|
6460
6570
|
"card",
|
|
6461
6571
|
"bank",
|
|
6462
6572
|
"apple",
|
|
6463
6573
|
"google",
|
|
6464
6574
|
"bnpl",
|
|
6465
|
-
"cash"
|
|
6575
|
+
"cash",
|
|
6576
|
+
// Brand marks, not category glyphs: the checkout draws PayPal's monogram,
|
|
6577
|
+
// Klarna's squircle-K and the Bitcoin mark for these, the same logos the
|
|
6578
|
+
// bespoke panes they replace already drew. Listed here so a merchant's own
|
|
6579
|
+
// dashboard can offer them; the router decides which one a tile *defaults*
|
|
6580
|
+
// to, and a router predating them simply keeps sending the old default.
|
|
6581
|
+
"paypal",
|
|
6582
|
+
"klarna",
|
|
6583
|
+
"crypto"
|
|
6466
6584
|
];
|
|
6467
|
-
var
|
|
6585
|
+
var PANE_CATEGORY_KEYS = [
|
|
6468
6586
|
"wallet",
|
|
6469
6587
|
"card",
|
|
6470
6588
|
"bnpl",
|
|
6471
6589
|
"bank_redirect",
|
|
6472
6590
|
"bank_transfer",
|
|
6591
|
+
"crypto",
|
|
6592
|
+
"game_items",
|
|
6473
6593
|
"cash"
|
|
6474
6594
|
];
|
|
6475
|
-
var
|
|
6476
|
-
function
|
|
6477
|
-
return
|
|
6595
|
+
var PANES_MAX = 12;
|
|
6596
|
+
function paneMethodInfo(method, catalog = STRIPE_FALLBACK_PANE_CATALOG) {
|
|
6597
|
+
return catalog.methods.find((info) => info.key === method);
|
|
6478
6598
|
}
|
|
6479
|
-
function
|
|
6480
|
-
|
|
6599
|
+
function paneRailAllowed(rail, catalog) {
|
|
6600
|
+
return catalog.allowed_rails.includes(rail);
|
|
6601
|
+
}
|
|
6602
|
+
function offerablePaneMethods(catalog) {
|
|
6603
|
+
return catalog.methods.filter((info) => paneRailAllowed(info.rail, catalog));
|
|
6604
|
+
}
|
|
6605
|
+
var DISPLAY_DEFAULTS_BY_KEY = {
|
|
6606
|
+
apple_pay: { icon: "apple", category: "wallet" },
|
|
6607
|
+
google_pay: { icon: "google", category: "wallet" },
|
|
6608
|
+
paypal: { icon: "paypal", category: "wallet" },
|
|
6609
|
+
// Both the Klarna connector's own tile and Stripe's Klarna. Affirm stays on
|
|
6610
|
+
// the generic `bnpl` glyph — same rail, no mark of its own.
|
|
6611
|
+
klarna: { icon: "klarna", category: "bnpl" }
|
|
6612
|
+
};
|
|
6613
|
+
var DISPLAY_DEFAULTS_BY_PAYMENT_METHOD = {
|
|
6614
|
+
wallet: { icon: "wallet", category: "wallet" },
|
|
6615
|
+
card: { icon: "card", category: "card" },
|
|
6616
|
+
card_redirect: { icon: "card", category: "card" },
|
|
6617
|
+
pay_later: { icon: "bnpl", category: "bnpl" },
|
|
6618
|
+
bank_redirect: { icon: "bank", category: "bank_redirect" },
|
|
6619
|
+
bank_transfer: { icon: "bank", category: "bank_transfer" },
|
|
6620
|
+
bank_debit: { icon: "bank", category: "bank_transfer" },
|
|
6621
|
+
// Cryptomus and NowPayments publish the same `crypto` key on this rail, and
|
|
6622
|
+
// the router defaults both to the Bitcoin mark.
|
|
6623
|
+
crypto: { icon: "crypto", category: "crypto" },
|
|
6624
|
+
// Skinsback, which has no mark: the router defaults it to `wallet` too.
|
|
6625
|
+
game_items: { icon: "wallet", category: "game_items" },
|
|
6626
|
+
cash: { icon: "cash", category: "cash" },
|
|
6627
|
+
voucher: { icon: "cash", category: "cash" }
|
|
6628
|
+
};
|
|
6629
|
+
var DISPLAY_DEFAULTS_FALLBACK = { icon: "wallet", category: "wallet" };
|
|
6630
|
+
function paneDisplayDefaults(info) {
|
|
6631
|
+
if (!info) return DISPLAY_DEFAULTS_FALLBACK;
|
|
6632
|
+
return DISPLAY_DEFAULTS_BY_KEY[info.key] ?? DISPLAY_DEFAULTS_BY_PAYMENT_METHOD[info.payment_method] ?? DISPLAY_DEFAULTS_FALLBACK;
|
|
6633
|
+
}
|
|
6634
|
+
function validatePanes(panes, catalog = STRIPE_FALLBACK_PANE_CATALOG) {
|
|
6635
|
+
const issues = [];
|
|
6636
|
+
const claimedBy = /* @__PURE__ */ new Set();
|
|
6637
|
+
panes.forEach((pane, index) => {
|
|
6638
|
+
const info = paneMethodInfo(pane.method, catalog);
|
|
6639
|
+
if (!info) {
|
|
6640
|
+
issues.push({ index, method: pane.method, code: "method_unknown" });
|
|
6641
|
+
} else if (!paneRailAllowed(info.rail, catalog)) {
|
|
6642
|
+
issues.push({ index, method: pane.method, code: "rail_not_allowed" });
|
|
6643
|
+
} else if (pane.enabled) {
|
|
6644
|
+
if (claimedBy.has(info.key)) {
|
|
6645
|
+
issues.push({ index, method: pane.method, code: "duplicate_method" });
|
|
6646
|
+
} else {
|
|
6647
|
+
claimedBy.add(info.key);
|
|
6648
|
+
}
|
|
6649
|
+
}
|
|
6650
|
+
if (index >= PANES_MAX) issues.push({ index, method: pane.method, code: "over_cap" });
|
|
6651
|
+
});
|
|
6652
|
+
return issues;
|
|
6653
|
+
}
|
|
6654
|
+
function defaultPane(method, catalog = STRIPE_FALLBACK_PANE_CATALOG) {
|
|
6655
|
+
const defaults = paneDisplayDefaults(paneMethodInfo(method, catalog));
|
|
6481
6656
|
return {
|
|
6482
6657
|
method,
|
|
6483
6658
|
enabled: true,
|
|
@@ -6485,15 +6660,15 @@ function defaultNativePane(method) {
|
|
|
6485
6660
|
labelTranslations: {},
|
|
6486
6661
|
sublabel: null,
|
|
6487
6662
|
sublabelTranslations: {},
|
|
6488
|
-
category:
|
|
6489
|
-
icon:
|
|
6663
|
+
category: defaults.category,
|
|
6664
|
+
icon: defaults.icon,
|
|
6490
6665
|
iconSvg: "",
|
|
6491
6666
|
displayOrder: 0,
|
|
6492
6667
|
visibility: "always",
|
|
6493
6668
|
openIn: "tab"
|
|
6494
6669
|
};
|
|
6495
6670
|
}
|
|
6496
|
-
function
|
|
6671
|
+
function clonePane(pane) {
|
|
6497
6672
|
return {
|
|
6498
6673
|
...pane,
|
|
6499
6674
|
labelTranslations: { ...pane.labelTranslations },
|
|
@@ -6520,7 +6695,7 @@ function clampDisplayOrder(raw) {
|
|
|
6520
6695
|
if (!Number.isFinite(raw)) return 0;
|
|
6521
6696
|
return Math.min(DISPLAY_ORDER_MAX, Math.max(DISPLAY_ORDER_MIN, Math.trunc(raw)));
|
|
6522
6697
|
}
|
|
6523
|
-
function
|
|
6698
|
+
function decodePanes(raw) {
|
|
6524
6699
|
if (!Array.isArray(raw)) return null;
|
|
6525
6700
|
const decodeRow = (entry, method) => ({
|
|
6526
6701
|
method,
|
|
@@ -6534,14 +6709,14 @@ function decodeNativePanes(raw) {
|
|
|
6534
6709
|
iconSvg: str(entry["icon_svg"]),
|
|
6535
6710
|
displayOrder: clampDisplayOrder(Number(entry["display_order"])),
|
|
6536
6711
|
// Anything unrecognised degrades to `always` rather than dropping the row.
|
|
6537
|
-
visibility: entry["visibility"]
|
|
6712
|
+
visibility: parseVisibility(entry["visibility"]),
|
|
6538
6713
|
// Same tolerance: an unknown value degrades to the default `tab`.
|
|
6539
6714
|
openIn: entry["open_in"] === "popup" ? "popup" : "tab"
|
|
6540
6715
|
});
|
|
6541
6716
|
const indexByMethod = /* @__PURE__ */ new Map();
|
|
6542
6717
|
const out = [];
|
|
6543
6718
|
for (const entry of raw) {
|
|
6544
|
-
if (out.length >=
|
|
6719
|
+
if (out.length >= PANES_MAX) break;
|
|
6545
6720
|
if (!isObject2(entry)) continue;
|
|
6546
6721
|
const method = str(entry["method"]).trim();
|
|
6547
6722
|
if (!method) continue;
|
|
@@ -6557,12 +6732,12 @@ function decodeNativePanes(raw) {
|
|
|
6557
6732
|
}
|
|
6558
6733
|
return out;
|
|
6559
6734
|
}
|
|
6560
|
-
function
|
|
6735
|
+
function encodePanes(panes) {
|
|
6561
6736
|
const nonEmpty = (map) => {
|
|
6562
6737
|
const entries = Object.entries(map).filter(([, v]) => v.trim().length > 0);
|
|
6563
6738
|
return entries.length > 0 ? Object.fromEntries(entries) : void 0;
|
|
6564
6739
|
};
|
|
6565
|
-
return panes.slice(0,
|
|
6740
|
+
return panes.slice(0, PANES_MAX).map((pane) => {
|
|
6566
6741
|
const labelTranslations = nonEmpty(pane.labelTranslations);
|
|
6567
6742
|
const sublabelTranslations = nonEmpty(pane.sublabelTranslations);
|
|
6568
6743
|
return {
|
|
@@ -6570,7 +6745,7 @@ function encodeNativePanes(panes) {
|
|
|
6570
6745
|
enabled: pane.enabled,
|
|
6571
6746
|
...pane.label.trim() ? { label: pane.label.trim() } : {},
|
|
6572
6747
|
...labelTranslations ? { label_translations: labelTranslations } : {},
|
|
6573
|
-
// `null` omits the key entirely (
|
|
6748
|
+
// `null` omits the key entirely (catalogue default wins); `''` is sent
|
|
6574
6749
|
// as-is because that is how the merchant hides the second line.
|
|
6575
6750
|
...pane.sublabel !== null ? { sublabel: pane.sublabel } : {},
|
|
6576
6751
|
...sublabelTranslations ? { sublabel_translations: sublabelTranslations } : {},
|
|
@@ -6582,8 +6757,13 @@ function encodeNativePanes(panes) {
|
|
|
6582
6757
|
// writing e.g. 3.5 or Date.now() verbatim would silently delete the
|
|
6583
6758
|
// pane at render while every read surface shows it healthy.
|
|
6584
6759
|
display_order: clampDisplayOrder(pane.displayOrder),
|
|
6585
|
-
|
|
6586
|
-
|
|
6760
|
+
// Normalised on encode for the same reason `display_order` is clamped:
|
|
6761
|
+
// the router's strict row decode drops a row whole on a value outside
|
|
6762
|
+
// its enum, and a caller who built a `Pane` by hand (or in plain JS)
|
|
6763
|
+
// never went through `decodePanes`. A decoded pane always holds a valid
|
|
6764
|
+
// value, so this is a no-op on the round-trip path.
|
|
6765
|
+
visibility: parseVisibility(pane.visibility),
|
|
6766
|
+
open_in: pane.openIn === "popup" ? "popup" : "tab"
|
|
6587
6767
|
};
|
|
6588
6768
|
});
|
|
6589
6769
|
}
|
|
@@ -6593,6 +6773,10 @@ function focusedCheckoutUrl(params) {
|
|
|
6593
6773
|
params.paymentId
|
|
6594
6774
|
)}`;
|
|
6595
6775
|
const query = new URLSearchParams({ pane: params.method });
|
|
6776
|
+
const connector = params.connector?.trim();
|
|
6777
|
+
if (connector) query.set("connector", connector);
|
|
6778
|
+
const merchantConnectorId = params.merchantConnectorId?.trim();
|
|
6779
|
+
if (merchantConnectorId) query.set("mca", merchantConnectorId);
|
|
6596
6780
|
if (params.locale) query.set("locale", params.locale);
|
|
6597
6781
|
if (params.customFieldsCollected) query.set("cf", "1");
|
|
6598
6782
|
return `${path}?${query.toString()}`;
|
|
@@ -6604,6 +6788,24 @@ var CHECKOUT_EVENT_KINDS = [
|
|
|
6604
6788
|
"native_pane_abandoned",
|
|
6605
6789
|
"native_pane_returned"
|
|
6606
6790
|
];
|
|
6791
|
+
var STRIPE_NATIVE_PANE_METHODS = STRIPE_FALLBACK_PANE_METHODS;
|
|
6792
|
+
var NATIVE_PANE_ICON_KEYS = PANE_ICON_KEYS;
|
|
6793
|
+
var NATIVE_PANE_CATEGORY_KEYS = PANE_CATEGORY_KEYS;
|
|
6794
|
+
var NATIVE_PANES_MAX = PANES_MAX;
|
|
6795
|
+
function nativePaneMethodInfo(method) {
|
|
6796
|
+
return STRIPE_FALLBACK_PANE_METHODS.find((info) => info.key === method);
|
|
6797
|
+
}
|
|
6798
|
+
function defaultNativePane(method) {
|
|
6799
|
+
const info = nativePaneMethodInfo(method);
|
|
6800
|
+
return {
|
|
6801
|
+
...defaultPane(method),
|
|
6802
|
+
category: "",
|
|
6803
|
+
icon: info?.defaultIcon ?? ""
|
|
6804
|
+
};
|
|
6805
|
+
}
|
|
6806
|
+
var cloneNativePane = clonePane;
|
|
6807
|
+
var decodeNativePanes = decodePanes;
|
|
6808
|
+
var encodeNativePanes = encodePanes;
|
|
6607
6809
|
// Annotate the CommonJS export names for ESM import in node:
|
|
6608
6810
|
0 && (module.exports = {
|
|
6609
6811
|
ALL_CUSTOM_FIELD_CONDITION_SOURCES,
|
|
@@ -6611,6 +6813,7 @@ var CHECKOUT_EVENT_KINDS = [
|
|
|
6611
6813
|
ALL_CUSTOM_FIELD_TYPES,
|
|
6612
6814
|
Analytics,
|
|
6613
6815
|
AnalyticsDashboard,
|
|
6816
|
+
Audit,
|
|
6614
6817
|
AvailabilityOverrides,
|
|
6615
6818
|
BRANDING_EXPORT_FORMAT,
|
|
6616
6819
|
BRANDING_EXPORT_VERSION,
|
|
@@ -6641,8 +6844,13 @@ var CHECKOUT_EVENT_KINDS = [
|
|
|
6641
6844
|
NATIVE_PANE_CATEGORY_KEYS,
|
|
6642
6845
|
NATIVE_PANE_ICON_KEYS,
|
|
6643
6846
|
OperationLimits,
|
|
6847
|
+
PANES_MAX,
|
|
6848
|
+
PANE_CATEGORY_KEYS,
|
|
6849
|
+
PANE_ICON_KEYS,
|
|
6644
6850
|
Regions,
|
|
6645
6851
|
Risk,
|
|
6852
|
+
STRIPE_FALLBACK_PANE_CATALOG,
|
|
6853
|
+
STRIPE_FALLBACK_PANE_METHODS,
|
|
6646
6854
|
STRIPE_NATIVE_PANE_METHODS,
|
|
6647
6855
|
Search,
|
|
6648
6856
|
Settlement,
|
|
@@ -6656,6 +6864,7 @@ var CHECKOUT_EVENT_KINDS = [
|
|
|
6656
6864
|
cloneBranding,
|
|
6657
6865
|
cloneCustomField,
|
|
6658
6866
|
cloneNativePane,
|
|
6867
|
+
clonePane,
|
|
6659
6868
|
customFieldContextFromMetadata,
|
|
6660
6869
|
customFieldIsTextLike,
|
|
6661
6870
|
customFieldOperatorTakesValue,
|
|
@@ -6665,14 +6874,18 @@ var CHECKOUT_EVENT_KINDS = [
|
|
|
6665
6874
|
decodeBranding,
|
|
6666
6875
|
decodeCustomFields,
|
|
6667
6876
|
decodeNativePanes,
|
|
6877
|
+
decodePanes,
|
|
6668
6878
|
defaultBranding,
|
|
6669
6879
|
defaultCustomFieldVisibility,
|
|
6670
6880
|
defaultNativePane,
|
|
6671
6881
|
defaultOperatorForSource,
|
|
6882
|
+
defaultPane,
|
|
6883
|
+
emptyPaneCatalog,
|
|
6672
6884
|
encodeBadges,
|
|
6673
6885
|
encodeBranding,
|
|
6674
6886
|
encodeCustomFields,
|
|
6675
6887
|
encodeNativePanes,
|
|
6888
|
+
encodePanes,
|
|
6676
6889
|
evaluateCustomFieldCondition,
|
|
6677
6890
|
evaluateCustomFieldVisibility,
|
|
6678
6891
|
feeProgram,
|
|
@@ -6686,6 +6899,12 @@ var CHECKOUT_EVENT_KINDS = [
|
|
|
6686
6899
|
leaf,
|
|
6687
6900
|
logoDimensions,
|
|
6688
6901
|
nativePaneMethodInfo,
|
|
6902
|
+
offerablePaneMethods,
|
|
6903
|
+
paneCatalogFor,
|
|
6904
|
+
paneDisplayDefaults,
|
|
6905
|
+
paneMethodInfo,
|
|
6906
|
+
paneRailAllowed,
|
|
6907
|
+
paneViewVisibility,
|
|
6689
6908
|
parseCustomFieldsLoose,
|
|
6690
6909
|
parseImportedBranding,
|
|
6691
6910
|
programToTree,
|
|
@@ -6694,6 +6913,7 @@ var CHECKOUT_EVENT_KINDS = [
|
|
|
6694
6913
|
sanitizeCustomCss,
|
|
6695
6914
|
shadowFor,
|
|
6696
6915
|
surfacePadValue,
|
|
6916
|
+
validatePanes,
|
|
6697
6917
|
verticalGapValue,
|
|
6698
6918
|
visibleCustomFields
|
|
6699
6919
|
});
|