@delopay/sdk 0.124.0 → 0.126.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-4TVKPQTZ.js → chunk-D44FJRXS.js} +200 -4
- package/dist/chunk-D44FJRXS.js.map +1 -0
- package/dist/index.cjs +216 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +377 -2
- package/dist/index.d.ts +377 -2
- package/dist/index.js +35 -1
- package/dist/internal.cjs +216 -3
- package/dist/internal.cjs.map +1 -1
- package/dist/internal.d.cts +1 -1
- package/dist/internal.d.ts +1 -1
- package/dist/internal.js +35 -1
- package/dist/internal.js.map +1 -1
- package/package.json +1 -1
- package/dist/chunk-4TVKPQTZ.js.map +0 -1
package/dist/index.js
CHANGED
|
@@ -33,6 +33,10 @@ import {
|
|
|
33
33
|
Files,
|
|
34
34
|
Forex,
|
|
35
35
|
LOCALIZABLE_COPY_FIELDS,
|
|
36
|
+
MAX_SECTION_LABEL_LENGTH,
|
|
37
|
+
MAX_SECTION_ORDER,
|
|
38
|
+
METHOD_SECTIONS,
|
|
39
|
+
MIN_SECTION_ORDER,
|
|
36
40
|
NATIVE_PANES_MAX,
|
|
37
41
|
NATIVE_PANE_CATEGORY_KEYS,
|
|
38
42
|
NATIVE_PANE_ICON_KEYS,
|
|
@@ -43,6 +47,7 @@ import {
|
|
|
43
47
|
RTL_CHECKOUT_LOCALES,
|
|
44
48
|
Regions,
|
|
45
49
|
Risk,
|
|
50
|
+
SECTION_ALIASES,
|
|
46
51
|
STRIPE_FALLBACK_PANE_CATALOG,
|
|
47
52
|
STRIPE_FALLBACK_PANE_METHODS,
|
|
48
53
|
STRIPE_NATIVE_PANE_METHODS,
|
|
@@ -59,6 +64,7 @@ import {
|
|
|
59
64
|
Search,
|
|
60
65
|
Settlement,
|
|
61
66
|
Subscriptions,
|
|
67
|
+
UNKNOWN_SECTION_ORDER,
|
|
62
68
|
WCAG_AA_TEXT,
|
|
63
69
|
WCAG_AA_UI,
|
|
64
70
|
Webhooks,
|
|
@@ -67,12 +73,14 @@ import {
|
|
|
67
73
|
applyBrandingVariables,
|
|
68
74
|
buildBrandingExport,
|
|
69
75
|
buttonPadValue,
|
|
76
|
+
canonicalSectionId,
|
|
70
77
|
checkoutCopy,
|
|
71
78
|
checkoutLocaleDir,
|
|
72
79
|
cloneBranding,
|
|
73
80
|
cloneCustomField,
|
|
74
81
|
cloneNativePane,
|
|
75
82
|
clonePane,
|
|
83
|
+
compareSections,
|
|
76
84
|
contrastRatio,
|
|
77
85
|
copyTranslationsKey,
|
|
78
86
|
customFieldContextFromMetadata,
|
|
@@ -83,10 +91,13 @@ import {
|
|
|
83
91
|
decodeBadges,
|
|
84
92
|
decodeBranding,
|
|
85
93
|
decodeCustomFields,
|
|
94
|
+
decodeMethodSectionLabels,
|
|
95
|
+
decodeMethodSectionOrder,
|
|
86
96
|
decodeNativePanes,
|
|
87
97
|
decodePanes,
|
|
88
98
|
defaultBranding,
|
|
89
99
|
defaultCustomFieldVisibility,
|
|
100
|
+
defaultMethodSectionOrder,
|
|
90
101
|
defaultNativePane,
|
|
91
102
|
defaultOperatorForSource,
|
|
92
103
|
defaultPane,
|
|
@@ -94,6 +105,8 @@ import {
|
|
|
94
105
|
encodeBadges,
|
|
95
106
|
encodeBranding,
|
|
96
107
|
encodeCustomFields,
|
|
108
|
+
encodeMethodSectionLabels,
|
|
109
|
+
encodeMethodSectionOrder,
|
|
97
110
|
encodeNativePanes,
|
|
98
111
|
encodePanes,
|
|
99
112
|
evaluateCustomFieldCondition,
|
|
@@ -106,6 +119,7 @@ import {
|
|
|
106
119
|
isCheckboxChecked,
|
|
107
120
|
isDarkSurface,
|
|
108
121
|
isHexColor,
|
|
122
|
+
knownSectionLabelKey,
|
|
109
123
|
leaf,
|
|
110
124
|
logoDimensions,
|
|
111
125
|
nativePaneMethodInfo,
|
|
@@ -122,16 +136,19 @@ import {
|
|
|
122
136
|
readableInkOn,
|
|
123
137
|
ruleMatchToTree,
|
|
124
138
|
sanitizeCustomCss,
|
|
139
|
+
sectionLabel,
|
|
140
|
+
sectionOrderOf,
|
|
125
141
|
shadowFor,
|
|
126
142
|
surchargeFigurePlan,
|
|
127
143
|
surchargeShowsLabel,
|
|
128
144
|
surchargeStyleDrawsAShape,
|
|
129
145
|
surchargeWordFor,
|
|
130
146
|
surfacePadValue,
|
|
147
|
+
validSectionOrder,
|
|
131
148
|
validatePanes,
|
|
132
149
|
verticalGapValue,
|
|
133
150
|
visibleCustomFields
|
|
134
|
-
} from "./chunk-
|
|
151
|
+
} from "./chunk-D44FJRXS.js";
|
|
135
152
|
export {
|
|
136
153
|
ALL_CUSTOM_FIELD_CONDITION_SOURCES,
|
|
137
154
|
ALL_CUSTOM_FIELD_OPERATORS,
|
|
@@ -167,6 +184,10 @@ export {
|
|
|
167
184
|
Files,
|
|
168
185
|
Forex,
|
|
169
186
|
LOCALIZABLE_COPY_FIELDS,
|
|
187
|
+
MAX_SECTION_LABEL_LENGTH,
|
|
188
|
+
MAX_SECTION_ORDER,
|
|
189
|
+
METHOD_SECTIONS,
|
|
190
|
+
MIN_SECTION_ORDER,
|
|
170
191
|
NATIVE_PANES_MAX,
|
|
171
192
|
NATIVE_PANE_CATEGORY_KEYS,
|
|
172
193
|
NATIVE_PANE_ICON_KEYS,
|
|
@@ -177,6 +198,7 @@ export {
|
|
|
177
198
|
RTL_CHECKOUT_LOCALES,
|
|
178
199
|
Regions,
|
|
179
200
|
Risk,
|
|
201
|
+
SECTION_ALIASES,
|
|
180
202
|
STRIPE_FALLBACK_PANE_CATALOG,
|
|
181
203
|
STRIPE_FALLBACK_PANE_METHODS,
|
|
182
204
|
STRIPE_NATIVE_PANE_METHODS,
|
|
@@ -193,6 +215,7 @@ export {
|
|
|
193
215
|
Search,
|
|
194
216
|
Settlement,
|
|
195
217
|
Subscriptions,
|
|
218
|
+
UNKNOWN_SECTION_ORDER,
|
|
196
219
|
WCAG_AA_TEXT,
|
|
197
220
|
WCAG_AA_UI,
|
|
198
221
|
Webhooks,
|
|
@@ -201,12 +224,14 @@ export {
|
|
|
201
224
|
applyBrandingVariables,
|
|
202
225
|
buildBrandingExport,
|
|
203
226
|
buttonPadValue,
|
|
227
|
+
canonicalSectionId,
|
|
204
228
|
checkoutCopy,
|
|
205
229
|
checkoutLocaleDir,
|
|
206
230
|
cloneBranding,
|
|
207
231
|
cloneCustomField,
|
|
208
232
|
cloneNativePane,
|
|
209
233
|
clonePane,
|
|
234
|
+
compareSections,
|
|
210
235
|
contrastRatio,
|
|
211
236
|
copyTranslationsKey,
|
|
212
237
|
customFieldContextFromMetadata,
|
|
@@ -217,10 +242,13 @@ export {
|
|
|
217
242
|
decodeBadges,
|
|
218
243
|
decodeBranding,
|
|
219
244
|
decodeCustomFields,
|
|
245
|
+
decodeMethodSectionLabels,
|
|
246
|
+
decodeMethodSectionOrder,
|
|
220
247
|
decodeNativePanes,
|
|
221
248
|
decodePanes,
|
|
222
249
|
defaultBranding,
|
|
223
250
|
defaultCustomFieldVisibility,
|
|
251
|
+
defaultMethodSectionOrder,
|
|
224
252
|
defaultNativePane,
|
|
225
253
|
defaultOperatorForSource,
|
|
226
254
|
defaultPane,
|
|
@@ -228,6 +256,8 @@ export {
|
|
|
228
256
|
encodeBadges,
|
|
229
257
|
encodeBranding,
|
|
230
258
|
encodeCustomFields,
|
|
259
|
+
encodeMethodSectionLabels,
|
|
260
|
+
encodeMethodSectionOrder,
|
|
231
261
|
encodeNativePanes,
|
|
232
262
|
encodePanes,
|
|
233
263
|
evaluateCustomFieldCondition,
|
|
@@ -240,6 +270,7 @@ export {
|
|
|
240
270
|
isCheckboxChecked,
|
|
241
271
|
isDarkSurface,
|
|
242
272
|
isHexColor,
|
|
273
|
+
knownSectionLabelKey,
|
|
243
274
|
leaf,
|
|
244
275
|
logoDimensions,
|
|
245
276
|
nativePaneMethodInfo,
|
|
@@ -256,12 +287,15 @@ export {
|
|
|
256
287
|
readableInkOn,
|
|
257
288
|
ruleMatchToTree,
|
|
258
289
|
sanitizeCustomCss,
|
|
290
|
+
sectionLabel,
|
|
291
|
+
sectionOrderOf,
|
|
259
292
|
shadowFor,
|
|
260
293
|
surchargeFigurePlan,
|
|
261
294
|
surchargeShowsLabel,
|
|
262
295
|
surchargeStyleDrawsAShape,
|
|
263
296
|
surchargeWordFor,
|
|
264
297
|
surfacePadValue,
|
|
298
|
+
validSectionOrder,
|
|
265
299
|
validatePanes,
|
|
266
300
|
verticalGapValue,
|
|
267
301
|
visibleCustomFields
|
package/dist/internal.cjs
CHANGED
|
@@ -64,6 +64,10 @@ __export(internal_exports, {
|
|
|
64
64
|
Forex: () => Forex,
|
|
65
65
|
Gsm: () => Gsm,
|
|
66
66
|
LOCALIZABLE_COPY_FIELDS: () => LOCALIZABLE_COPY_FIELDS,
|
|
67
|
+
MAX_SECTION_LABEL_LENGTH: () => MAX_SECTION_LABEL_LENGTH,
|
|
68
|
+
MAX_SECTION_ORDER: () => MAX_SECTION_ORDER,
|
|
69
|
+
METHOD_SECTIONS: () => METHOD_SECTIONS,
|
|
70
|
+
MIN_SECTION_ORDER: () => MIN_SECTION_ORDER,
|
|
67
71
|
NATIVE_PANES_MAX: () => NATIVE_PANES_MAX,
|
|
68
72
|
NATIVE_PANE_CATEGORY_KEYS: () => NATIVE_PANE_CATEGORY_KEYS,
|
|
69
73
|
NATIVE_PANE_ICON_KEYS: () => NATIVE_PANE_ICON_KEYS,
|
|
@@ -76,6 +80,7 @@ __export(internal_exports, {
|
|
|
76
80
|
RTL_CHECKOUT_LOCALES: () => RTL_CHECKOUT_LOCALES,
|
|
77
81
|
Regions: () => Regions,
|
|
78
82
|
Risk: () => Risk,
|
|
83
|
+
SECTION_ALIASES: () => SECTION_ALIASES,
|
|
79
84
|
STRIPE_FALLBACK_PANE_CATALOG: () => STRIPE_FALLBACK_PANE_CATALOG,
|
|
80
85
|
STRIPE_FALLBACK_PANE_METHODS: () => STRIPE_FALLBACK_PANE_METHODS,
|
|
81
86
|
STRIPE_NATIVE_PANE_METHODS: () => STRIPE_NATIVE_PANE_METHODS,
|
|
@@ -92,6 +97,7 @@ __export(internal_exports, {
|
|
|
92
97
|
Search: () => Search,
|
|
93
98
|
Settlement: () => Settlement,
|
|
94
99
|
Subscriptions: () => Subscriptions,
|
|
100
|
+
UNKNOWN_SECTION_ORDER: () => UNKNOWN_SECTION_ORDER,
|
|
95
101
|
WCAG_AA_TEXT: () => WCAG_AA_TEXT,
|
|
96
102
|
WCAG_AA_UI: () => WCAG_AA_UI,
|
|
97
103
|
Webhooks: () => Webhooks,
|
|
@@ -100,12 +106,14 @@ __export(internal_exports, {
|
|
|
100
106
|
applyBrandingVariables: () => applyBrandingVariables,
|
|
101
107
|
buildBrandingExport: () => buildBrandingExport,
|
|
102
108
|
buttonPadValue: () => buttonPadValue,
|
|
109
|
+
canonicalSectionId: () => canonicalSectionId,
|
|
103
110
|
checkoutCopy: () => checkoutCopy,
|
|
104
111
|
checkoutLocaleDir: () => checkoutLocaleDir,
|
|
105
112
|
cloneBranding: () => cloneBranding,
|
|
106
113
|
cloneCustomField: () => cloneCustomField,
|
|
107
114
|
cloneNativePane: () => cloneNativePane,
|
|
108
115
|
clonePane: () => clonePane,
|
|
116
|
+
compareSections: () => compareSections,
|
|
109
117
|
contrastRatio: () => contrastRatio,
|
|
110
118
|
copyTranslationsKey: () => copyTranslationsKey,
|
|
111
119
|
customFieldContextFromMetadata: () => customFieldContextFromMetadata,
|
|
@@ -116,10 +124,13 @@ __export(internal_exports, {
|
|
|
116
124
|
decodeBadges: () => decodeBadges,
|
|
117
125
|
decodeBranding: () => decodeBranding,
|
|
118
126
|
decodeCustomFields: () => decodeCustomFields,
|
|
127
|
+
decodeMethodSectionLabels: () => decodeMethodSectionLabels,
|
|
128
|
+
decodeMethodSectionOrder: () => decodeMethodSectionOrder,
|
|
119
129
|
decodeNativePanes: () => decodeNativePanes,
|
|
120
130
|
decodePanes: () => decodePanes,
|
|
121
131
|
defaultBranding: () => defaultBranding,
|
|
122
132
|
defaultCustomFieldVisibility: () => defaultCustomFieldVisibility,
|
|
133
|
+
defaultMethodSectionOrder: () => defaultMethodSectionOrder,
|
|
123
134
|
defaultNativePane: () => defaultNativePane,
|
|
124
135
|
defaultOperatorForSource: () => defaultOperatorForSource,
|
|
125
136
|
defaultPane: () => defaultPane,
|
|
@@ -127,6 +138,8 @@ __export(internal_exports, {
|
|
|
127
138
|
encodeBadges: () => encodeBadges,
|
|
128
139
|
encodeBranding: () => encodeBranding,
|
|
129
140
|
encodeCustomFields: () => encodeCustomFields,
|
|
141
|
+
encodeMethodSectionLabels: () => encodeMethodSectionLabels,
|
|
142
|
+
encodeMethodSectionOrder: () => encodeMethodSectionOrder,
|
|
130
143
|
encodeNativePanes: () => encodeNativePanes,
|
|
131
144
|
encodePanes: () => encodePanes,
|
|
132
145
|
evaluateCustomFieldCondition: () => evaluateCustomFieldCondition,
|
|
@@ -139,6 +152,7 @@ __export(internal_exports, {
|
|
|
139
152
|
isCheckboxChecked: () => isCheckboxChecked,
|
|
140
153
|
isDarkSurface: () => isDarkSurface,
|
|
141
154
|
isHexColor: () => isHexColor,
|
|
155
|
+
knownSectionLabelKey: () => knownSectionLabelKey,
|
|
142
156
|
leaf: () => leaf,
|
|
143
157
|
logoDimensions: () => logoDimensions,
|
|
144
158
|
nativePaneMethodInfo: () => nativePaneMethodInfo,
|
|
@@ -155,12 +169,15 @@ __export(internal_exports, {
|
|
|
155
169
|
readableInkOn: () => readableInkOn,
|
|
156
170
|
ruleMatchToTree: () => ruleMatchToTree,
|
|
157
171
|
sanitizeCustomCss: () => sanitizeCustomCss,
|
|
172
|
+
sectionLabel: () => sectionLabel,
|
|
173
|
+
sectionOrderOf: () => sectionOrderOf,
|
|
158
174
|
shadowFor: () => shadowFor,
|
|
159
175
|
surchargeFigurePlan: () => surchargeFigurePlan,
|
|
160
176
|
surchargeShowsLabel: () => surchargeShowsLabel,
|
|
161
177
|
surchargeStyleDrawsAShape: () => surchargeStyleDrawsAShape,
|
|
162
178
|
surchargeWordFor: () => surchargeWordFor,
|
|
163
179
|
surfacePadValue: () => surfacePadValue,
|
|
180
|
+
validSectionOrder: () => validSectionOrder,
|
|
164
181
|
validatePanes: () => validatePanes,
|
|
165
182
|
verticalGapValue: () => verticalGapValue,
|
|
166
183
|
visibleCustomFields: () => visibleCustomFields
|
|
@@ -2553,6 +2570,23 @@ var Routing = class {
|
|
|
2553
2570
|
async connectorCaps(profileId) {
|
|
2554
2571
|
return this.request("GET", `/routing/connector-caps/${encodeURIComponent(profileId)}`);
|
|
2555
2572
|
}
|
|
2573
|
+
/**
|
|
2574
|
+
* The live `routing_volume` counters behind a shop's active advanced
|
|
2575
|
+
* program: one per distinct budget the program reads, each with the window
|
|
2576
|
+
* it covers, the figure in the pinned threshold currency, and the rules that
|
|
2577
|
+
* read it. Lets a merchant see whether a `routing_volume < 50000` rule is at
|
|
2578
|
+
* 120 or at 499 today, and support answer why a payment went to the overflow
|
|
2579
|
+
* connector.
|
|
2580
|
+
*
|
|
2581
|
+
* What routing will use right now, not what the shop turned over: the
|
|
2582
|
+
* counters are held in Redis only and a lost Redis restarts the window at
|
|
2583
|
+
* zero. Read-only; needs the same permission as reading the rules.
|
|
2584
|
+
*
|
|
2585
|
+
* `GET /routing/volume-counters/{profileId}`
|
|
2586
|
+
*/
|
|
2587
|
+
async volumeCounters(profileId) {
|
|
2588
|
+
return this.request("GET", `/routing/volume-counters/${encodeURIComponent(profileId)}`);
|
|
2589
|
+
}
|
|
2556
2590
|
/**
|
|
2557
2591
|
* Replace a shop's per-connector payment caps.
|
|
2558
2592
|
*
|
|
@@ -5617,6 +5651,151 @@ var DEFAULT_BADGES_DARK = [
|
|
|
5617
5651
|
borderColor: "#1e40af"
|
|
5618
5652
|
}
|
|
5619
5653
|
];
|
|
5654
|
+
var METHOD_SECTION_ORDER_KEY = "methodSectionOrder";
|
|
5655
|
+
var METHOD_SECTION_LABELS_KEY = "methodSectionLabels";
|
|
5656
|
+
var MIN_SECTION_ORDER = 1;
|
|
5657
|
+
var MAX_SECTION_ORDER = 100;
|
|
5658
|
+
var MAX_SECTION_LABEL_LENGTH = 120;
|
|
5659
|
+
var METHOD_SECTIONS = [
|
|
5660
|
+
{ id: "card", labelKey: "sections.card", order: 10 },
|
|
5661
|
+
{ id: "wallet", labelKey: "sections.wallets", order: 20 },
|
|
5662
|
+
{ id: "bnpl", labelKey: "sections.bnpl", order: 30 },
|
|
5663
|
+
{ id: "bank_redirect", labelKey: "sections.onlineBanking", order: 40 },
|
|
5664
|
+
{ id: "bank_transfer", labelKey: "sections.bankTransfer", order: 45 },
|
|
5665
|
+
{ id: "crypto", labelKey: "sections.cryptocurrency", order: 50 },
|
|
5666
|
+
{ id: "game_items", labelKey: "sections.gameItems", order: 60 },
|
|
5667
|
+
{ id: "voucher", labelKey: "sections.vouchers", order: 70 },
|
|
5668
|
+
{ id: "gift_card", labelKey: "sections.giftCards", order: 75 },
|
|
5669
|
+
{ id: "reward", labelKey: "sections.rewards", order: 80 },
|
|
5670
|
+
{ id: "cash", labelKey: "sections.cash", order: 90 }
|
|
5671
|
+
];
|
|
5672
|
+
var SECTION_ALIASES = {
|
|
5673
|
+
card_redirect: "card"
|
|
5674
|
+
};
|
|
5675
|
+
var UNKNOWN_SECTION_ORDER = MAX_SECTION_ORDER;
|
|
5676
|
+
function canonicalSectionId(category) {
|
|
5677
|
+
return SECTION_ALIASES[category] ?? category;
|
|
5678
|
+
}
|
|
5679
|
+
function defaultMethodSectionOrder() {
|
|
5680
|
+
const order = {};
|
|
5681
|
+
for (const section of METHOD_SECTIONS) order[section.id] = section.order;
|
|
5682
|
+
return order;
|
|
5683
|
+
}
|
|
5684
|
+
function validSectionOrder(raw) {
|
|
5685
|
+
if (typeof raw !== "number" || !Number.isInteger(raw)) return null;
|
|
5686
|
+
if (raw < MIN_SECTION_ORDER || raw > MAX_SECTION_ORDER) return null;
|
|
5687
|
+
return raw;
|
|
5688
|
+
}
|
|
5689
|
+
function decodeMethodSectionOrder(raw) {
|
|
5690
|
+
const order = defaultMethodSectionOrder();
|
|
5691
|
+
if (raw === void 0) return order;
|
|
5692
|
+
let parsed;
|
|
5693
|
+
try {
|
|
5694
|
+
parsed = JSON.parse(raw);
|
|
5695
|
+
} catch {
|
|
5696
|
+
return order;
|
|
5697
|
+
}
|
|
5698
|
+
if (parsed === null || typeof parsed !== "object" || Array.isArray(parsed)) return order;
|
|
5699
|
+
for (const [key, value] of Object.entries(parsed)) {
|
|
5700
|
+
const valid = validSectionOrder(value);
|
|
5701
|
+
if (valid === null) continue;
|
|
5702
|
+
order[canonicalSectionId(key)] = valid;
|
|
5703
|
+
}
|
|
5704
|
+
return order;
|
|
5705
|
+
}
|
|
5706
|
+
function encodeMethodSectionOrder(order) {
|
|
5707
|
+
return JSON.stringify(order);
|
|
5708
|
+
}
|
|
5709
|
+
function decodeMethodSectionLabels(raw) {
|
|
5710
|
+
if (raw === void 0) return {};
|
|
5711
|
+
let parsed;
|
|
5712
|
+
try {
|
|
5713
|
+
parsed = JSON.parse(raw);
|
|
5714
|
+
} catch {
|
|
5715
|
+
return {};
|
|
5716
|
+
}
|
|
5717
|
+
if (parsed === null || typeof parsed !== "object" || Array.isArray(parsed)) return {};
|
|
5718
|
+
const labels = {};
|
|
5719
|
+
for (const [section, byLocale] of Object.entries(parsed)) {
|
|
5720
|
+
if (!section || byLocale === null || typeof byLocale !== "object" || Array.isArray(byLocale)) {
|
|
5721
|
+
continue;
|
|
5722
|
+
}
|
|
5723
|
+
const kept = {};
|
|
5724
|
+
for (const [locale, text] of Object.entries(byLocale)) {
|
|
5725
|
+
if (typeof text !== "string") continue;
|
|
5726
|
+
const trimmed = text.trim();
|
|
5727
|
+
if (!trimmed) continue;
|
|
5728
|
+
kept[locale] = trimmed.slice(0, MAX_SECTION_LABEL_LENGTH);
|
|
5729
|
+
}
|
|
5730
|
+
if (Object.keys(kept).length > 0) labels[canonicalSectionId(section)] = kept;
|
|
5731
|
+
}
|
|
5732
|
+
return labels;
|
|
5733
|
+
}
|
|
5734
|
+
function encodeMethodSectionLabels(labels) {
|
|
5735
|
+
const cleaned = {};
|
|
5736
|
+
for (const [section, byLocale] of Object.entries(labels)) {
|
|
5737
|
+
const kept = {};
|
|
5738
|
+
for (const [locale, text] of Object.entries(byLocale)) {
|
|
5739
|
+
const trimmed = (text ?? "").trim();
|
|
5740
|
+
if (trimmed) kept[locale] = trimmed.slice(0, MAX_SECTION_LABEL_LENGTH);
|
|
5741
|
+
}
|
|
5742
|
+
if (Object.keys(kept).length > 0) cleaned[section] = kept;
|
|
5743
|
+
}
|
|
5744
|
+
return Object.keys(cleaned).length > 0 ? JSON.stringify(cleaned) : null;
|
|
5745
|
+
}
|
|
5746
|
+
function sectionCatalogueIndex(sectionId) {
|
|
5747
|
+
const index = METHOD_SECTIONS.findIndex((section) => section.id === sectionId);
|
|
5748
|
+
return index === -1 ? METHOD_SECTIONS.length : index;
|
|
5749
|
+
}
|
|
5750
|
+
function sectionOrderOf(order, category) {
|
|
5751
|
+
return order[canonicalSectionId(category)] ?? UNKNOWN_SECTION_ORDER;
|
|
5752
|
+
}
|
|
5753
|
+
function compareSections(order) {
|
|
5754
|
+
return (a, b) => {
|
|
5755
|
+
const left = canonicalSectionId(a);
|
|
5756
|
+
const right = canonicalSectionId(b);
|
|
5757
|
+
const byOrder = sectionOrderOf(order, left) - sectionOrderOf(order, right);
|
|
5758
|
+
if (byOrder !== 0) return byOrder;
|
|
5759
|
+
const byCatalogue = sectionCatalogueIndex(left) - sectionCatalogueIndex(right);
|
|
5760
|
+
if (byCatalogue !== 0) return byCatalogue;
|
|
5761
|
+
return left < right ? -1 : left > right ? 1 : 0;
|
|
5762
|
+
};
|
|
5763
|
+
}
|
|
5764
|
+
function sectionLabel(labels, category, locale, knownKey, translate) {
|
|
5765
|
+
const id = canonicalSectionId(category);
|
|
5766
|
+
if (id in labels) {
|
|
5767
|
+
const captions = labels[id];
|
|
5768
|
+
const matched = translationFor(captions, locale)?.trim();
|
|
5769
|
+
if (matched) return matched;
|
|
5770
|
+
for (const value of Object.values(captions)) {
|
|
5771
|
+
const any = value.trim();
|
|
5772
|
+
if (any) return any;
|
|
5773
|
+
}
|
|
5774
|
+
}
|
|
5775
|
+
if (knownKey) {
|
|
5776
|
+
const translated = translate(knownKey);
|
|
5777
|
+
if (translated) return translated;
|
|
5778
|
+
}
|
|
5779
|
+
return category;
|
|
5780
|
+
}
|
|
5781
|
+
function parseSectionOrderLoose(raw) {
|
|
5782
|
+
if (typeof raw === "string") return decodeMethodSectionOrder(raw);
|
|
5783
|
+
if (raw !== null && typeof raw === "object" && !Array.isArray(raw)) {
|
|
5784
|
+
return decodeMethodSectionOrder(JSON.stringify(raw));
|
|
5785
|
+
}
|
|
5786
|
+
return defaultMethodSectionOrder();
|
|
5787
|
+
}
|
|
5788
|
+
function parseSectionLabelsLoose(raw) {
|
|
5789
|
+
if (typeof raw === "string") return decodeMethodSectionLabels(raw);
|
|
5790
|
+
if (raw !== null && typeof raw === "object" && !Array.isArray(raw)) {
|
|
5791
|
+
return decodeMethodSectionLabels(JSON.stringify(raw));
|
|
5792
|
+
}
|
|
5793
|
+
return {};
|
|
5794
|
+
}
|
|
5795
|
+
function knownSectionLabelKey(category) {
|
|
5796
|
+
const id = canonicalSectionId(category);
|
|
5797
|
+
return METHOD_SECTIONS.find((section) => section.id === id)?.labelKey;
|
|
5798
|
+
}
|
|
5620
5799
|
var DEFAULT_BRANDING_BASE = {
|
|
5621
5800
|
displayName: "",
|
|
5622
5801
|
logoUrl: "",
|
|
@@ -5705,7 +5884,9 @@ var DEFAULT_BRANDING = {
|
|
|
5705
5884
|
...DEFAULT_BRANDING_BASE,
|
|
5706
5885
|
...LIGHT_PALETTE,
|
|
5707
5886
|
trustBadges: DEFAULT_BADGES.map((b) => ({ ...b })),
|
|
5708
|
-
customFields: []
|
|
5887
|
+
customFields: [],
|
|
5888
|
+
methodSectionOrder: defaultMethodSectionOrder(),
|
|
5889
|
+
methodSectionLabels: {}
|
|
5709
5890
|
};
|
|
5710
5891
|
var DEFAULT_BRANDING_DARK = {
|
|
5711
5892
|
...DEFAULT_BRANDING_BASE,
|
|
@@ -5726,7 +5907,9 @@ var DEFAULT_BRANDING_DARK = {
|
|
|
5726
5907
|
surchargeColor: "#fbbf24",
|
|
5727
5908
|
discountColor: "#34d399",
|
|
5728
5909
|
trustBadges: DEFAULT_BADGES_DARK.map((b) => ({ ...b })),
|
|
5729
|
-
customFields: []
|
|
5910
|
+
customFields: [],
|
|
5911
|
+
methodSectionOrder: defaultMethodSectionOrder(),
|
|
5912
|
+
methodSectionLabels: {}
|
|
5730
5913
|
};
|
|
5731
5914
|
function defaultBranding() {
|
|
5732
5915
|
return cloneBranding(DEFAULT_BRANDING);
|
|
@@ -5736,6 +5919,10 @@ function cloneBranding(b) {
|
|
|
5736
5919
|
...b,
|
|
5737
5920
|
trustBadges: b.trustBadges.map((badge) => ({ ...badge })),
|
|
5738
5921
|
customFields: b.customFields.map(cloneCustomField),
|
|
5922
|
+
methodSectionOrder: { ...b.methodSectionOrder },
|
|
5923
|
+
methodSectionLabels: Object.fromEntries(
|
|
5924
|
+
Object.entries(b.methodSectionLabels).map(([id, byLocale]) => [id, { ...byLocale }])
|
|
5925
|
+
),
|
|
5739
5926
|
// Copied, not shared. A spread alone would leave the clone pointing at the
|
|
5740
5927
|
// original's maps, and the dashboard edits a clone precisely so the form
|
|
5741
5928
|
// can be abandoned without touching what is saved.
|
|
@@ -6351,6 +6538,8 @@ function decodeBranding(source) {
|
|
|
6351
6538
|
showOrderItems: parseBool(extras["showOrderItems"], DEFAULT_BRANDING.showOrderItems),
|
|
6352
6539
|
trustBadges: decodedBadges ?? DEFAULT_BRANDING.trustBadges.map((b) => ({ ...b })),
|
|
6353
6540
|
customFields: decodedCustomFields ?? [],
|
|
6541
|
+
methodSectionOrder: decodeMethodSectionOrder(extras[METHOD_SECTION_ORDER_KEY]),
|
|
6542
|
+
methodSectionLabels: decodeMethodSectionLabels(extras[METHOD_SECTION_LABELS_KEY]),
|
|
6354
6543
|
headerText: s(source.payment_form_header_text),
|
|
6355
6544
|
payButtonLabel: s(source.payment_button_text),
|
|
6356
6545
|
cardTermsMessage: s(source.custom_message_for_card_terms),
|
|
@@ -6417,8 +6606,11 @@ function encodeBranding(branding, base) {
|
|
|
6417
6606
|
logoShape: branding.logoShape,
|
|
6418
6607
|
logoSize: branding.logoSize,
|
|
6419
6608
|
labelStyle: branding.labelStyle,
|
|
6420
|
-
trustBadges: encodeBadges(branding.trustBadges)
|
|
6609
|
+
trustBadges: encodeBadges(branding.trustBadges),
|
|
6610
|
+
[METHOD_SECTION_ORDER_KEY]: encodeMethodSectionOrder(branding.methodSectionOrder)
|
|
6421
6611
|
};
|
|
6612
|
+
const sectionLabels = encodeMethodSectionLabels(branding.methodSectionLabels);
|
|
6613
|
+
if (sectionLabels) extras[METHOD_SECTION_LABELS_KEY] = sectionLabels;
|
|
6422
6614
|
if (branding.customFields.length > 0) {
|
|
6423
6615
|
extras["customFields"] = encodeCustomFields(branding.customFields);
|
|
6424
6616
|
}
|
|
@@ -6620,6 +6812,10 @@ function parseImportedBranding(raw) {
|
|
|
6620
6812
|
showOrderItems: parseBool(root["showOrderItems"], dflt.showOrderItems),
|
|
6621
6813
|
trustBadges,
|
|
6622
6814
|
customFields,
|
|
6815
|
+
// An export writes the decoded maps; a hand-written file may carry the
|
|
6816
|
+
// JSON strings the bag uses. Both are accepted, and neither is required.
|
|
6817
|
+
methodSectionOrder: parseSectionOrderLoose(root[METHOD_SECTION_ORDER_KEY]),
|
|
6818
|
+
methodSectionLabels: parseSectionLabelsLoose(root[METHOD_SECTION_LABELS_KEY]),
|
|
6623
6819
|
headerText: sStr(root["headerText"], dflt.headerText),
|
|
6624
6820
|
payButtonLabel: sStr(root["payButtonLabel"], dflt.payButtonLabel),
|
|
6625
6821
|
cardTermsMessage: sStr(root["cardTermsMessage"], dflt.cardTermsMessage),
|
|
@@ -8441,6 +8637,10 @@ var DelopayInternal = class extends Delopay {
|
|
|
8441
8637
|
Forex,
|
|
8442
8638
|
Gsm,
|
|
8443
8639
|
LOCALIZABLE_COPY_FIELDS,
|
|
8640
|
+
MAX_SECTION_LABEL_LENGTH,
|
|
8641
|
+
MAX_SECTION_ORDER,
|
|
8642
|
+
METHOD_SECTIONS,
|
|
8643
|
+
MIN_SECTION_ORDER,
|
|
8444
8644
|
NATIVE_PANES_MAX,
|
|
8445
8645
|
NATIVE_PANE_CATEGORY_KEYS,
|
|
8446
8646
|
NATIVE_PANE_ICON_KEYS,
|
|
@@ -8453,6 +8653,7 @@ var DelopayInternal = class extends Delopay {
|
|
|
8453
8653
|
RTL_CHECKOUT_LOCALES,
|
|
8454
8654
|
Regions,
|
|
8455
8655
|
Risk,
|
|
8656
|
+
SECTION_ALIASES,
|
|
8456
8657
|
STRIPE_FALLBACK_PANE_CATALOG,
|
|
8457
8658
|
STRIPE_FALLBACK_PANE_METHODS,
|
|
8458
8659
|
STRIPE_NATIVE_PANE_METHODS,
|
|
@@ -8469,6 +8670,7 @@ var DelopayInternal = class extends Delopay {
|
|
|
8469
8670
|
Search,
|
|
8470
8671
|
Settlement,
|
|
8471
8672
|
Subscriptions,
|
|
8673
|
+
UNKNOWN_SECTION_ORDER,
|
|
8472
8674
|
WCAG_AA_TEXT,
|
|
8473
8675
|
WCAG_AA_UI,
|
|
8474
8676
|
Webhooks,
|
|
@@ -8477,12 +8679,14 @@ var DelopayInternal = class extends Delopay {
|
|
|
8477
8679
|
applyBrandingVariables,
|
|
8478
8680
|
buildBrandingExport,
|
|
8479
8681
|
buttonPadValue,
|
|
8682
|
+
canonicalSectionId,
|
|
8480
8683
|
checkoutCopy,
|
|
8481
8684
|
checkoutLocaleDir,
|
|
8482
8685
|
cloneBranding,
|
|
8483
8686
|
cloneCustomField,
|
|
8484
8687
|
cloneNativePane,
|
|
8485
8688
|
clonePane,
|
|
8689
|
+
compareSections,
|
|
8486
8690
|
contrastRatio,
|
|
8487
8691
|
copyTranslationsKey,
|
|
8488
8692
|
customFieldContextFromMetadata,
|
|
@@ -8493,10 +8697,13 @@ var DelopayInternal = class extends Delopay {
|
|
|
8493
8697
|
decodeBadges,
|
|
8494
8698
|
decodeBranding,
|
|
8495
8699
|
decodeCustomFields,
|
|
8700
|
+
decodeMethodSectionLabels,
|
|
8701
|
+
decodeMethodSectionOrder,
|
|
8496
8702
|
decodeNativePanes,
|
|
8497
8703
|
decodePanes,
|
|
8498
8704
|
defaultBranding,
|
|
8499
8705
|
defaultCustomFieldVisibility,
|
|
8706
|
+
defaultMethodSectionOrder,
|
|
8500
8707
|
defaultNativePane,
|
|
8501
8708
|
defaultOperatorForSource,
|
|
8502
8709
|
defaultPane,
|
|
@@ -8504,6 +8711,8 @@ var DelopayInternal = class extends Delopay {
|
|
|
8504
8711
|
encodeBadges,
|
|
8505
8712
|
encodeBranding,
|
|
8506
8713
|
encodeCustomFields,
|
|
8714
|
+
encodeMethodSectionLabels,
|
|
8715
|
+
encodeMethodSectionOrder,
|
|
8507
8716
|
encodeNativePanes,
|
|
8508
8717
|
encodePanes,
|
|
8509
8718
|
evaluateCustomFieldCondition,
|
|
@@ -8516,6 +8725,7 @@ var DelopayInternal = class extends Delopay {
|
|
|
8516
8725
|
isCheckboxChecked,
|
|
8517
8726
|
isDarkSurface,
|
|
8518
8727
|
isHexColor,
|
|
8728
|
+
knownSectionLabelKey,
|
|
8519
8729
|
leaf,
|
|
8520
8730
|
logoDimensions,
|
|
8521
8731
|
nativePaneMethodInfo,
|
|
@@ -8532,12 +8742,15 @@ var DelopayInternal = class extends Delopay {
|
|
|
8532
8742
|
readableInkOn,
|
|
8533
8743
|
ruleMatchToTree,
|
|
8534
8744
|
sanitizeCustomCss,
|
|
8745
|
+
sectionLabel,
|
|
8746
|
+
sectionOrderOf,
|
|
8535
8747
|
shadowFor,
|
|
8536
8748
|
surchargeFigurePlan,
|
|
8537
8749
|
surchargeShowsLabel,
|
|
8538
8750
|
surchargeStyleDrawsAShape,
|
|
8539
8751
|
surchargeWordFor,
|
|
8540
8752
|
surfacePadValue,
|
|
8753
|
+
validSectionOrder,
|
|
8541
8754
|
validatePanes,
|
|
8542
8755
|
verticalGapValue,
|
|
8543
8756
|
visibleCustomFields
|