@delopay/sdk 0.248.0 → 0.255.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-RPPCA42D.js → chunk-U3KDAIWB.js} +319 -2
- package/dist/chunk-U3KDAIWB.js.map +1 -0
- package/dist/index.cjs +328 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +633 -9
- package/dist/index.d.ts +633 -9
- package/dist/index.js +21 -1
- package/dist/internal.cjs +356 -1
- package/dist/internal.cjs.map +1 -1
- package/dist/internal.d.cts +69 -2
- package/dist/internal.d.ts +69 -2
- package/dist/internal.js +49 -1
- package/dist/internal.js.map +1 -1
- package/package.json +1 -1
- package/dist/chunk-RPPCA42D.js.map +0 -1
package/dist/index.js
CHANGED
|
@@ -20,6 +20,7 @@ import {
|
|
|
20
20
|
AvailabilityOverrides,
|
|
21
21
|
BRANDING_EXPORT_FORMAT,
|
|
22
22
|
BRANDING_EXPORT_VERSION,
|
|
23
|
+
BUILTIN_PAYMENT_ICON_KEYS,
|
|
23
24
|
BuyerBlocklist,
|
|
24
25
|
CARD_FIELD_CHROMES,
|
|
25
26
|
CARD_FIELD_FONT_SIZES,
|
|
@@ -81,7 +82,9 @@ import {
|
|
|
81
82
|
PANE_ICON_KEYS,
|
|
82
83
|
PAYPAL_CARD_LAYOUTS,
|
|
83
84
|
PAYPAL_LABEL_STYLES,
|
|
85
|
+
PRESENTATION_CONTRACT_VERSION,
|
|
84
86
|
PaypalDisputes,
|
|
87
|
+
PresentationCache,
|
|
85
88
|
ProcessorCosts,
|
|
86
89
|
Products,
|
|
87
90
|
RTL_CHECKOUT_LOCALES,
|
|
@@ -135,6 +138,8 @@ import {
|
|
|
135
138
|
applyBrandingVariables,
|
|
136
139
|
asAirwallexCardPreset,
|
|
137
140
|
buildBrandingExport,
|
|
141
|
+
builtinPaymentIconDataUri,
|
|
142
|
+
builtinPaymentIconSvg,
|
|
138
143
|
buttonPadValue,
|
|
139
144
|
canonicalSectionId,
|
|
140
145
|
cardFieldFontPx,
|
|
@@ -192,6 +197,7 @@ import {
|
|
|
192
197
|
isNoticeIcon,
|
|
193
198
|
isSubscriptionDisputeWebhook,
|
|
194
199
|
isSubscriptionLifecycleWebhook,
|
|
200
|
+
isSupportedPresentation,
|
|
195
201
|
knownSectionLabelKey,
|
|
196
202
|
leaf,
|
|
197
203
|
logoDimensions,
|
|
@@ -209,6 +215,9 @@ import {
|
|
|
209
215
|
parseCustomFieldsLoose,
|
|
210
216
|
parseImportedBranding,
|
|
211
217
|
parseNoticesLoose,
|
|
218
|
+
presentationIconDataUri,
|
|
219
|
+
presentationIconSrc,
|
|
220
|
+
presentationTiers,
|
|
212
221
|
programToTree,
|
|
213
222
|
radiusValue,
|
|
214
223
|
readableInkOn,
|
|
@@ -223,6 +232,7 @@ import {
|
|
|
223
232
|
sanitizeCustomCss,
|
|
224
233
|
sectionLabel,
|
|
225
234
|
sectionOrderOf,
|
|
235
|
+
selectableEntries,
|
|
226
236
|
shadowFor,
|
|
227
237
|
shownNotices,
|
|
228
238
|
stripeSpacingValues,
|
|
@@ -238,7 +248,7 @@ import {
|
|
|
238
248
|
visibleCustomFields,
|
|
239
249
|
whopAccentSwatch,
|
|
240
250
|
whopCardElement
|
|
241
|
-
} from "./chunk-
|
|
251
|
+
} from "./chunk-U3KDAIWB.js";
|
|
242
252
|
export {
|
|
243
253
|
AIRWALLEX_AUTOFILL_TREATMENTS,
|
|
244
254
|
AIRWALLEX_CARD_LAYOUTS,
|
|
@@ -261,6 +271,7 @@ export {
|
|
|
261
271
|
AvailabilityOverrides,
|
|
262
272
|
BRANDING_EXPORT_FORMAT,
|
|
263
273
|
BRANDING_EXPORT_VERSION,
|
|
274
|
+
BUILTIN_PAYMENT_ICON_KEYS,
|
|
264
275
|
BuyerBlocklist,
|
|
265
276
|
CARD_FIELD_CHROMES,
|
|
266
277
|
CARD_FIELD_FONT_SIZES,
|
|
@@ -322,7 +333,9 @@ export {
|
|
|
322
333
|
PANE_ICON_KEYS,
|
|
323
334
|
PAYPAL_CARD_LAYOUTS,
|
|
324
335
|
PAYPAL_LABEL_STYLES,
|
|
336
|
+
PRESENTATION_CONTRACT_VERSION,
|
|
325
337
|
PaypalDisputes,
|
|
338
|
+
PresentationCache,
|
|
326
339
|
ProcessorCosts,
|
|
327
340
|
Products,
|
|
328
341
|
RTL_CHECKOUT_LOCALES,
|
|
@@ -376,6 +389,8 @@ export {
|
|
|
376
389
|
applyBrandingVariables,
|
|
377
390
|
asAirwallexCardPreset,
|
|
378
391
|
buildBrandingExport,
|
|
392
|
+
builtinPaymentIconDataUri,
|
|
393
|
+
builtinPaymentIconSvg,
|
|
379
394
|
buttonPadValue,
|
|
380
395
|
canonicalSectionId,
|
|
381
396
|
cardFieldFontPx,
|
|
@@ -433,6 +448,7 @@ export {
|
|
|
433
448
|
isNoticeIcon,
|
|
434
449
|
isSubscriptionDisputeWebhook,
|
|
435
450
|
isSubscriptionLifecycleWebhook,
|
|
451
|
+
isSupportedPresentation,
|
|
436
452
|
knownSectionLabelKey,
|
|
437
453
|
leaf,
|
|
438
454
|
logoDimensions,
|
|
@@ -450,6 +466,9 @@ export {
|
|
|
450
466
|
parseCustomFieldsLoose,
|
|
451
467
|
parseImportedBranding,
|
|
452
468
|
parseNoticesLoose,
|
|
469
|
+
presentationIconDataUri,
|
|
470
|
+
presentationIconSrc,
|
|
471
|
+
presentationTiers,
|
|
453
472
|
programToTree,
|
|
454
473
|
radiusValue,
|
|
455
474
|
readableInkOn,
|
|
@@ -464,6 +483,7 @@ export {
|
|
|
464
483
|
sanitizeCustomCss,
|
|
465
484
|
sectionLabel,
|
|
466
485
|
sectionOrderOf,
|
|
486
|
+
selectableEntries,
|
|
467
487
|
shadowFor,
|
|
468
488
|
shownNotices,
|
|
469
489
|
stripeSpacingValues,
|
package/dist/internal.cjs
CHANGED
|
@@ -44,6 +44,7 @@ __export(internal_exports, {
|
|
|
44
44
|
AvailabilityOverrides: () => AvailabilityOverrides,
|
|
45
45
|
BRANDING_EXPORT_FORMAT: () => BRANDING_EXPORT_FORMAT,
|
|
46
46
|
BRANDING_EXPORT_VERSION: () => BRANDING_EXPORT_VERSION,
|
|
47
|
+
BUILTIN_PAYMENT_ICON_KEYS: () => BUILTIN_PAYMENT_ICON_KEYS,
|
|
47
48
|
BuyerBlocklist: () => BuyerBlocklist,
|
|
48
49
|
CARD_FIELD_CHROMES: () => CARD_FIELD_CHROMES,
|
|
49
50
|
CARD_FIELD_FONT_SIZES: () => CARD_FIELD_FONT_SIZES,
|
|
@@ -114,11 +115,13 @@ __export(internal_exports, {
|
|
|
114
115
|
PANE_ICON_KEYS: () => PANE_ICON_KEYS,
|
|
115
116
|
PAYPAL_CARD_LAYOUTS: () => PAYPAL_CARD_LAYOUTS,
|
|
116
117
|
PAYPAL_LABEL_STYLES: () => PAYPAL_LABEL_STYLES,
|
|
118
|
+
PRESENTATION_CONTRACT_VERSION: () => PRESENTATION_CONTRACT_VERSION,
|
|
117
119
|
PaypalDisputes: () => PaypalDisputes,
|
|
118
120
|
PlatformBilling: () => PlatformBilling,
|
|
119
121
|
PlatformFees: () => PlatformFees,
|
|
120
122
|
PlatformMessageTemplates: () => PlatformMessageTemplates,
|
|
121
123
|
PlatformSettings: () => PlatformSettings,
|
|
124
|
+
PresentationCache: () => PresentationCache,
|
|
122
125
|
ProcessorCosts: () => ProcessorCosts,
|
|
123
126
|
Products: () => Products,
|
|
124
127
|
RTL_CHECKOUT_LOCALES: () => RTL_CHECKOUT_LOCALES,
|
|
@@ -172,6 +175,8 @@ __export(internal_exports, {
|
|
|
172
175
|
applyBrandingVariables: () => applyBrandingVariables,
|
|
173
176
|
asAirwallexCardPreset: () => asAirwallexCardPreset,
|
|
174
177
|
buildBrandingExport: () => buildBrandingExport,
|
|
178
|
+
builtinPaymentIconDataUri: () => builtinPaymentIconDataUri,
|
|
179
|
+
builtinPaymentIconSvg: () => builtinPaymentIconSvg,
|
|
175
180
|
buttonPadValue: () => buttonPadValue,
|
|
176
181
|
canonicalSectionId: () => canonicalSectionId,
|
|
177
182
|
cardFieldFontPx: () => cardFieldFontPx,
|
|
@@ -229,6 +234,7 @@ __export(internal_exports, {
|
|
|
229
234
|
isNoticeIcon: () => isNoticeIcon,
|
|
230
235
|
isSubscriptionDisputeWebhook: () => isSubscriptionDisputeWebhook,
|
|
231
236
|
isSubscriptionLifecycleWebhook: () => isSubscriptionLifecycleWebhook,
|
|
237
|
+
isSupportedPresentation: () => isSupportedPresentation,
|
|
232
238
|
knownSectionLabelKey: () => knownSectionLabelKey,
|
|
233
239
|
leaf: () => leaf,
|
|
234
240
|
logoDimensions: () => logoDimensions,
|
|
@@ -246,6 +252,9 @@ __export(internal_exports, {
|
|
|
246
252
|
parseCustomFieldsLoose: () => parseCustomFieldsLoose,
|
|
247
253
|
parseImportedBranding: () => parseImportedBranding,
|
|
248
254
|
parseNoticesLoose: () => parseNoticesLoose,
|
|
255
|
+
presentationIconDataUri: () => presentationIconDataUri,
|
|
256
|
+
presentationIconSrc: () => presentationIconSrc,
|
|
257
|
+
presentationTiers: () => presentationTiers,
|
|
249
258
|
programToTree: () => programToTree,
|
|
250
259
|
radiusValue: () => radiusValue,
|
|
251
260
|
readableInkOn: () => readableInkOn,
|
|
@@ -260,6 +269,7 @@ __export(internal_exports, {
|
|
|
260
269
|
sanitizeCustomCss: () => sanitizeCustomCss,
|
|
261
270
|
sectionLabel: () => sectionLabel,
|
|
262
271
|
sectionOrderOf: () => sectionOrderOf,
|
|
272
|
+
selectableEntries: () => selectableEntries,
|
|
263
273
|
shadowFor: () => shadowFor,
|
|
264
274
|
shownNotices: () => shownNotices,
|
|
265
275
|
stripeSpacingValues: () => stripeSpacingValues,
|
|
@@ -1243,11 +1253,92 @@ var Connectors = class {
|
|
|
1243
1253
|
{ body: params }
|
|
1244
1254
|
);
|
|
1245
1255
|
}
|
|
1256
|
+
/**
|
|
1257
|
+
* Every webhook the connector's payment provider lists for its credentials
|
|
1258
|
+
* in one environment: Delopay's own, other connector accounts', former
|
|
1259
|
+
* addresses' and other integrations'.
|
|
1260
|
+
* `GET /account/{merchantId}/connectors/webhooks/{connectorId}/provider`
|
|
1261
|
+
*
|
|
1262
|
+
* Available for Stripe, PayPal, Airwallex, Whop and Adyen. Destinations are
|
|
1263
|
+
* masked; `capabilities` says which changes the provider allows and
|
|
1264
|
+
* `editable` whether the caller may make them.
|
|
1265
|
+
*/
|
|
1266
|
+
async listProviderWebhooks(merchantId, connectorId, environment) {
|
|
1267
|
+
return this.request("GET", providerWebhooksPath(merchantId, connectorId), {
|
|
1268
|
+
query: { environment }
|
|
1269
|
+
});
|
|
1270
|
+
}
|
|
1271
|
+
/**
|
|
1272
|
+
* Create a webhook at the provider for the merchant's own systems.
|
|
1273
|
+
* `POST /account/{merchantId}/connectors/webhooks/{connectorId}/provider`
|
|
1274
|
+
*
|
|
1275
|
+
* The URL must be `https` and outside Delopay; Delopay's own webhook is
|
|
1276
|
+
* registered with `registerWebhook`. A returned `signing_secret` is not kept
|
|
1277
|
+
* by Delopay and cannot be read again.
|
|
1278
|
+
*/
|
|
1279
|
+
async createProviderWebhook(merchantId, connectorId, params) {
|
|
1280
|
+
return this.request("POST", providerWebhooksPath(merchantId, connectorId), { body: params });
|
|
1281
|
+
}
|
|
1282
|
+
/**
|
|
1283
|
+
* Change one webhook at the provider.
|
|
1284
|
+
* `PATCH /account/{merchantId}/connectors/webhooks/{connectorId}/provider/{webhookId}`
|
|
1285
|
+
*
|
|
1286
|
+
* Refused once the webhook changed since `fingerprint`, and for Delopay's
|
|
1287
|
+
* own webhooks.
|
|
1288
|
+
*/
|
|
1289
|
+
async updateProviderWebhook(merchantId, connectorId, webhookId, params) {
|
|
1290
|
+
return this.request(
|
|
1291
|
+
"PATCH",
|
|
1292
|
+
`${providerWebhooksPath(merchantId, connectorId)}/${encodeURIComponent(webhookId)}`,
|
|
1293
|
+
{ body: params }
|
|
1294
|
+
);
|
|
1295
|
+
}
|
|
1296
|
+
/**
|
|
1297
|
+
* Delete one webhook at the provider.
|
|
1298
|
+
* `POST /account/{merchantId}/connectors/webhooks/{connectorId}/provider/{webhookId}/delete`
|
|
1299
|
+
*
|
|
1300
|
+
* Refused once the webhook changed since `fingerprint`. Deleting Delopay's
|
|
1301
|
+
* own webhook needs `confirm_managed: true`; another connector account's is
|
|
1302
|
+
* never deleted from here.
|
|
1303
|
+
*/
|
|
1304
|
+
async deleteProviderWebhook(merchantId, connectorId, webhookId, params) {
|
|
1305
|
+
return this.request(
|
|
1306
|
+
"POST",
|
|
1307
|
+
`${providerWebhooksPath(merchantId, connectorId)}/${encodeURIComponent(webhookId)}/delete`,
|
|
1308
|
+
{ body: params }
|
|
1309
|
+
);
|
|
1310
|
+
}
|
|
1311
|
+
/**
|
|
1312
|
+
* What "replace all" would delete and keep. Nothing is changed.
|
|
1313
|
+
* `GET /account/{merchantId}/connectors/webhooks/{connectorId}/provider/replace`
|
|
1314
|
+
*/
|
|
1315
|
+
async previewProviderWebhookReplace(merchantId, connectorId, environment) {
|
|
1316
|
+
return this.request("GET", `${providerWebhooksPath(merchantId, connectorId)}/replace`, {
|
|
1317
|
+
query: { environment }
|
|
1318
|
+
});
|
|
1319
|
+
}
|
|
1320
|
+
/**
|
|
1321
|
+
* Keep only Delopay's webhook: delete exactly the confirmed webhooks of the
|
|
1322
|
+
* preview, after registering Delopay's own unless `sequence` is
|
|
1323
|
+
* `delete_first`.
|
|
1324
|
+
* `POST /account/{merchantId}/connectors/webhooks/{connectorId}/provider/replace`
|
|
1325
|
+
*
|
|
1326
|
+
* A list that changed since the preview answers `scope_changed` and deletes
|
|
1327
|
+
* nothing. A second replacement while one runs is refused as busy (`HE_00`).
|
|
1328
|
+
*/
|
|
1329
|
+
async replaceProviderWebhooks(merchantId, connectorId, params) {
|
|
1330
|
+
return this.request("POST", `${providerWebhooksPath(merchantId, connectorId)}/replace`, {
|
|
1331
|
+
body: params
|
|
1332
|
+
});
|
|
1333
|
+
}
|
|
1246
1334
|
/** List available payment methods. `GET /account/payment-methods` */
|
|
1247
1335
|
async listPaymentMethods() {
|
|
1248
1336
|
return this.request("GET", "/account/payment-methods");
|
|
1249
1337
|
}
|
|
1250
1338
|
};
|
|
1339
|
+
function providerWebhooksPath(merchantId, connectorId) {
|
|
1340
|
+
return `/account/${encodeURIComponent(merchantId)}/connectors/webhooks/${encodeURIComponent(connectorId)}/provider`;
|
|
1341
|
+
}
|
|
1251
1342
|
|
|
1252
1343
|
// src/resources/customers.ts
|
|
1253
1344
|
function toQuery(params) {
|
|
@@ -2420,6 +2511,44 @@ var PaymentMethods = class {
|
|
|
2420
2511
|
query: params
|
|
2421
2512
|
});
|
|
2422
2513
|
}
|
|
2514
|
+
/**
|
|
2515
|
+
* The shop's payment buttons as the hosted checkout draws them: order,
|
|
2516
|
+
* labels in the shop's or caller's language, artwork, and what selecting
|
|
2517
|
+
* each one does. For rendering payment buttons on your own site without a
|
|
2518
|
+
* local table of provider names and icons.
|
|
2519
|
+
*
|
|
2520
|
+
* With a secret key, name the shop (`profile_id`) and optionally the
|
|
2521
|
+
* environment and a buyer context; the answer may be reused for
|
|
2522
|
+
* `cache.max_age_seconds` — {@link PresentationCache} does that. With a
|
|
2523
|
+
* publishable key, pass the payment's `client_secret` (or use
|
|
2524
|
+
* `CheckoutSession.paymentMethodPresentation`); that answer is never reused.
|
|
2525
|
+
*
|
|
2526
|
+
* A displayed entry is not a promise: the payment is confirmed against the
|
|
2527
|
+
* current configuration.
|
|
2528
|
+
*
|
|
2529
|
+
* `GET /account/payment-methods/presentation`
|
|
2530
|
+
*
|
|
2531
|
+
* @example
|
|
2532
|
+
* ```typescript
|
|
2533
|
+
* const buttons = await delopay.paymentMethods.presentation({
|
|
2534
|
+
* profile_id: 'pro_123',
|
|
2535
|
+
* country: 'DE',
|
|
2536
|
+
* currency: 'EUR',
|
|
2537
|
+
* amount: 4999,
|
|
2538
|
+
* locale: 'de',
|
|
2539
|
+
* });
|
|
2540
|
+
* for (const entry of buttons.entries) {
|
|
2541
|
+
* if (entry.kind === 'heading') renderHeading(entry.label);
|
|
2542
|
+
* else renderButton(entry.label, entry.sublabel, presentationIconSrc(entry));
|
|
2543
|
+
* }
|
|
2544
|
+
* ```
|
|
2545
|
+
*/
|
|
2546
|
+
async presentation(params, options) {
|
|
2547
|
+
return this.request("GET", "/account/payment-methods/presentation", {
|
|
2548
|
+
query: params,
|
|
2549
|
+
...options
|
|
2550
|
+
});
|
|
2551
|
+
}
|
|
2423
2552
|
/**
|
|
2424
2553
|
* List all saved payment methods for a customer, optionally filtered.
|
|
2425
2554
|
*
|
|
@@ -7262,7 +7391,7 @@ var BuyerAccount = class {
|
|
|
7262
7391
|
constructor(request) {
|
|
7263
7392
|
this.request = request;
|
|
7264
7393
|
}
|
|
7265
|
-
/** Whether buyers can sign in
|
|
7394
|
+
/** Whether buyers can sign in on this platform, and which methods are offered. */
|
|
7266
7395
|
async availability(options) {
|
|
7267
7396
|
return this.request("GET", "/buyer-account/availability", { ...options });
|
|
7268
7397
|
}
|
|
@@ -12650,8 +12779,196 @@ var CheckoutSession = class {
|
|
|
12650
12779
|
headers: this.pkHeaders(options?.headers)
|
|
12651
12780
|
});
|
|
12652
12781
|
}
|
|
12782
|
+
/**
|
|
12783
|
+
* This payment's checkout buttons, as the hosted checkout draws them: order,
|
|
12784
|
+
* labels, artwork, and what selecting each one does. The shop, environment,
|
|
12785
|
+
* currency and amount are the payment's. Ask again when the cart changes;
|
|
12786
|
+
* an answer is never reused for another payment.
|
|
12787
|
+
*
|
|
12788
|
+
* `GET /account/payment-methods/presentation` (publishable key + client secret)
|
|
12789
|
+
*
|
|
12790
|
+
* @param params - `country` outranks the billing address and IP
|
|
12791
|
+
* geolocation; `locale` names the language of the labels.
|
|
12792
|
+
*/
|
|
12793
|
+
async paymentMethodPresentation(params, options) {
|
|
12794
|
+
return this.client.request("GET", "/account/payment-methods/presentation", {
|
|
12795
|
+
query: {
|
|
12796
|
+
client_secret: this.requireClientSecret(),
|
|
12797
|
+
country: params?.country,
|
|
12798
|
+
locale: params?.locale,
|
|
12799
|
+
contract_version: params?.contract_version
|
|
12800
|
+
},
|
|
12801
|
+
...options,
|
|
12802
|
+
headers: this.pkHeaders(options?.headers)
|
|
12803
|
+
});
|
|
12804
|
+
}
|
|
12653
12805
|
};
|
|
12654
12806
|
|
|
12807
|
+
// src/paymentPresentation.ts
|
|
12808
|
+
var PRESENTATION_CONTRACT_VERSION = 1;
|
|
12809
|
+
var BUILTIN_PAYMENT_ICON_KEYS = [
|
|
12810
|
+
"wallet",
|
|
12811
|
+
"card",
|
|
12812
|
+
"bank",
|
|
12813
|
+
"apple",
|
|
12814
|
+
"google",
|
|
12815
|
+
"bnpl",
|
|
12816
|
+
"cash",
|
|
12817
|
+
"paypal",
|
|
12818
|
+
"klarna",
|
|
12819
|
+
"crypto"
|
|
12820
|
+
];
|
|
12821
|
+
var SVG_OPEN = '<svg xmlns="http://www.w3.org/2000/svg"';
|
|
12822
|
+
function glyph(key, color) {
|
|
12823
|
+
const line = (body) => `${SVG_OPEN} viewBox="0 0 24 24" fill="none" stroke="${color}" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round">${body}</svg>`;
|
|
12824
|
+
switch (key) {
|
|
12825
|
+
case "card":
|
|
12826
|
+
return line('<rect x="2" y="5" width="20" height="14" rx="2"/><path d="M2 10h20"/>');
|
|
12827
|
+
case "bank":
|
|
12828
|
+
return line(
|
|
12829
|
+
'<path d="M3 10h18"/><path d="m12 3 9 5H3l9-5Z"/><path d="M6 10v7M10 10v7M14 10v7M18 10v7"/><path d="M3 20h18"/>'
|
|
12830
|
+
);
|
|
12831
|
+
case "bnpl":
|
|
12832
|
+
return line(
|
|
12833
|
+
'<rect x="2" y="6" width="20" height="12" rx="2"/><path d="M6 12h4"/><path d="M14 10v4"/><path d="M18 10v4"/>'
|
|
12834
|
+
);
|
|
12835
|
+
case "cash":
|
|
12836
|
+
return line(
|
|
12837
|
+
'<rect x="2" y="6" width="20" height="12" rx="2"/><circle cx="12" cy="12" r="2.5"/><path d="M6 12h.01M18 12h.01"/>'
|
|
12838
|
+
);
|
|
12839
|
+
case "apple":
|
|
12840
|
+
return `${SVG_OPEN} viewBox="0 0 384 512" fill="${color}"><path d="M318.7 268.7c-.2-36.7 16.4-64.4 50-84.8-18.8-26.9-47.2-41.7-84.7-44.6-35.5-2.8-74.3 20.7-88.5 20.7-15 0-49.4-19.7-76.4-19.7C63.3 141.2 4 184.8 4 273.5q0 39.3 14.4 81.2c12.8 36.7 59 126.7 107.2 125.2 25.2-.6 43-17.9 75.8-17.9 31.8 0 48.3 17.9 76.4 17.9 48.6-.7 90.4-82.5 102.6-119.3-65.2-30.7-61.7-90-61.7-91.9zm-56.6-164.2c27.3-32.4 24.8-61.9 24-72.5-24.1 1.4-52 16.4-67.9 34.9-17.5 19.8-27.8 44.3-25.6 71.9 26.1 2 49.9-11.4 69.5-34.3z"/></svg>`;
|
|
12841
|
+
case "google":
|
|
12842
|
+
return `${SVG_OPEN} viewBox="0 0 48 48"><path fill="#4285F4" d="M45.12 24.5c0-1.56-.14-3.06-.4-4.5H24v8.51h11.84c-.51 2.75-2.06 5.08-4.39 6.64v5.52h7.11c4.16-3.83 6.56-9.47 6.56-16.17z"/><path fill="#34A853" d="M24 46c5.94 0 10.92-1.97 14.56-5.33l-7.11-5.52c-1.97 1.32-4.49 2.1-7.45 2.1-5.73 0-10.58-3.87-12.31-9.07H4.34v5.7C7.96 41.07 15.4 46 24 46z"/><path fill="#FBBC05" d="M11.69 28.18C11.25 26.86 11 25.45 11 24s.25-2.86.69-4.18v-5.7H4.34C2.85 17.09 2 20.45 2 24s.85 6.91 2.34 9.88l7.35-5.7z"/><path fill="#EA4335" d="M24 10.75c3.23 0 6.13 1.11 8.41 3.29l6.31-6.31C34.91 4.18 29.93 2 24 2 15.4 2 7.96 6.93 4.34 14.12l7.35 5.7c1.73-5.2 6.58-9.07 12.31-9.07z"/></svg>`;
|
|
12843
|
+
case "paypal":
|
|
12844
|
+
return `${SVG_OPEN} viewBox="0 0 32 32"><path d="M9 4h7.2c3.4 0 6 2.4 5.6 5.8-.4 3.6-3.5 6-7.1 6h-3.2L10.4 23H6.7L9 4z" fill="#003087"/><path d="M13 8.5h7.2c3.4 0 6 2.4 5.6 5.8-.4 3.6-3.5 6-7.1 6h-3.2L14.4 27.5H10.7L13 8.5z" fill="#009cde"/></svg>`;
|
|
12845
|
+
case "klarna":
|
|
12846
|
+
return `${SVG_OPEN} viewBox="0 0 24 24"><rect width="24" height="24" rx="6" fill="#FFA8CD"/><path fill="#0B051D" d="M8 6h2.7v12H8V6zm6.5 0h2.5c-.4 2.7-1.5 5-3 6.6 1.6 1.6 2.7 3.6 3.2 5.4h-2.7c-.5-1.6-1.4-3-2.7-4.2v4.2H10V12c2.1-1 3.8-3.2 4.5-6z"/></svg>`;
|
|
12847
|
+
case "crypto":
|
|
12848
|
+
return `${SVG_OPEN} viewBox="0 0 64 64"><path fill="#F7931A" d="m63.033,39.744c-4.274,17.143-21.637,27.576-38.782,23.301-17.138-4.274-27.571-21.638-23.295-38.78,4.272-17.145,21.635-27.579,38.775-23.305,17.144,4.274,27.576,21.64,23.302,38.784z"/><path fill="#FFF" d="m46.103,27.444c0.637-4.258-2.605-6.547-7.038-8.074l1.438-5.768-3.511-0.875-1.4,5.616c-0.923-0.23-1.871-0.447-2.813-0.662l1.41-5.653-3.509-0.875-1.439,5.766c-0.764-0.174-1.514-0.346-2.242-0.527l0.004-0.018-4.842-1.209-0.934,3.75s2.605,0.597,2.55,0.634c1.422,0.355,1.679,1.296,1.636,2.042l-1.638,6.571c0.098,0.025,0.225,0.061,0.365,0.117-0.117-0.029-0.242-0.061-0.371-0.092l-2.296,9.205c-0.174,0.432-0.615,1.08-1.609,0.834,0.035,0.051-2.552-0.637-2.552-0.637l-1.743,4.019,4.569,1.139c0.85,0.213,1.683,0.436,2.503,0.646l-1.453,5.834,3.507,0.875,1.439-5.772c0.958,0.26,1.888,0.5,2.798,0.726l-1.434,5.745,3.511,0.875,1.453-5.823c5.987,1.133,10.489,0.676,12.384-4.739,1.527-4.36-0.076-6.875-3.226-8.515,2.294-0.529,4.022-2.038,4.483-5.155zm-8.022,11.249c-1.085,4.36-8.426,2.003-10.806,1.412l1.928-7.729c2.38,0.594,10.012,1.77,8.878,6.317zm1.086-11.312c-0.99,3.966-7.1,1.951-9.082,1.457l1.748-7.01c1.982,0.494,8.365,1.416,7.334,5.553z"/></svg>`;
|
|
12849
|
+
case "wallet":
|
|
12850
|
+
return line(
|
|
12851
|
+
'<path d="M3 7a2 2 0 0 1 2-2h12a2 2 0 0 1 2 2"/><rect x="3" y="7" width="18" height="12" rx="2"/><path d="M16 13h3"/>'
|
|
12852
|
+
);
|
|
12853
|
+
}
|
|
12854
|
+
}
|
|
12855
|
+
function isBuiltinKey(key) {
|
|
12856
|
+
return BUILTIN_PAYMENT_ICON_KEYS.includes(key);
|
|
12857
|
+
}
|
|
12858
|
+
function builtinPaymentIconSvg(key, color = "#1f2937") {
|
|
12859
|
+
return glyph(isBuiltinKey(key) ? key : "wallet", color);
|
|
12860
|
+
}
|
|
12861
|
+
function builtinPaymentIconDataUri(key, color) {
|
|
12862
|
+
return `data:image/svg+xml;charset=utf-8,${encodeURIComponent(builtinPaymentIconSvg(key, color))}`;
|
|
12863
|
+
}
|
|
12864
|
+
function presentationIconDataUri(icon, color) {
|
|
12865
|
+
return icon.type === "svg" ? icon.data_uri : builtinPaymentIconDataUri(icon.key, color);
|
|
12866
|
+
}
|
|
12867
|
+
function presentationIconSrc(entry, color) {
|
|
12868
|
+
if (entry.icon) return presentationIconDataUri(entry.icon, color);
|
|
12869
|
+
if (entry.fallback_icon) return builtinPaymentIconDataUri(entry.fallback_icon, color);
|
|
12870
|
+
return null;
|
|
12871
|
+
}
|
|
12872
|
+
function isSupportedPresentation(response) {
|
|
12873
|
+
return response.contract_version === PRESENTATION_CONTRACT_VERSION;
|
|
12874
|
+
}
|
|
12875
|
+
function presentationTiers(response) {
|
|
12876
|
+
const out = { express: [], normal: [], alternative: [] };
|
|
12877
|
+
for (const entry of response.entries) {
|
|
12878
|
+
if (entry.tier === "express") {
|
|
12879
|
+
const row = entry.row ?? 0;
|
|
12880
|
+
while (out.express.length <= row) out.express.push([]);
|
|
12881
|
+
out.express[row]?.push(entry);
|
|
12882
|
+
} else {
|
|
12883
|
+
out[entry.tier].push(entry);
|
|
12884
|
+
}
|
|
12885
|
+
}
|
|
12886
|
+
out.express = out.express.filter((row) => row.length > 0);
|
|
12887
|
+
return out;
|
|
12888
|
+
}
|
|
12889
|
+
function selectableEntries(response) {
|
|
12890
|
+
return response.entries.filter((entry) => entry.action !== void 0);
|
|
12891
|
+
}
|
|
12892
|
+
var PresentationCache = class _PresentationCache {
|
|
12893
|
+
constructor(options) {
|
|
12894
|
+
this.slots = /* @__PURE__ */ new Map();
|
|
12895
|
+
this.load = options.load;
|
|
12896
|
+
this.now = options.now ?? Date.now;
|
|
12897
|
+
this.maxEntries = options.maxEntries ?? 500;
|
|
12898
|
+
}
|
|
12899
|
+
/** The key two requests share exactly when DeloPay would answer them alike. */
|
|
12900
|
+
static keyOf(params) {
|
|
12901
|
+
return JSON.stringify([
|
|
12902
|
+
params.profile_id ?? null,
|
|
12903
|
+
params.environment ?? "live",
|
|
12904
|
+
params.locale?.toLowerCase() ?? null,
|
|
12905
|
+
params.country?.toUpperCase() ?? null,
|
|
12906
|
+
params.currency ?? null,
|
|
12907
|
+
params.amount ?? null,
|
|
12908
|
+
params.contract_version ?? PRESENTATION_CONTRACT_VERSION
|
|
12909
|
+
]);
|
|
12910
|
+
}
|
|
12911
|
+
async get(params) {
|
|
12912
|
+
const request = {
|
|
12913
|
+
...params,
|
|
12914
|
+
contract_version: params.contract_version ?? PRESENTATION_CONTRACT_VERSION
|
|
12915
|
+
};
|
|
12916
|
+
if (request.client_secret) {
|
|
12917
|
+
return { response: await this.load(request, {}), stale: false };
|
|
12918
|
+
}
|
|
12919
|
+
const key = _PresentationCache.keyOf(request);
|
|
12920
|
+
const slot = this.slots.get(key);
|
|
12921
|
+
const now = this.now();
|
|
12922
|
+
if (slot && now - slot.fetchedAt < slot.response.cache.max_age_seconds * 1e3) {
|
|
12923
|
+
return { response: slot.response, stale: false };
|
|
12924
|
+
}
|
|
12925
|
+
try {
|
|
12926
|
+
const response = await this.load(
|
|
12927
|
+
request,
|
|
12928
|
+
slot ? { headers: { "If-None-Match": `"${slot.response.revision}"` } } : {}
|
|
12929
|
+
);
|
|
12930
|
+
this.store(key, response, now);
|
|
12931
|
+
return { response, stale: false };
|
|
12932
|
+
} catch (error) {
|
|
12933
|
+
if (slot && error instanceof DelopayError && error.status === 304) {
|
|
12934
|
+
this.store(key, slot.response, now);
|
|
12935
|
+
return { response: slot.response, stale: false };
|
|
12936
|
+
}
|
|
12937
|
+
const policy = slot?.response.cache;
|
|
12938
|
+
const usableUntil = slot ? slot.fetchedAt + ((policy?.max_age_seconds ?? 0) + (policy?.stale_if_error_seconds ?? 0)) * 1e3 : 0;
|
|
12939
|
+
if (slot && isUnavailable(error) && now < usableUntil) {
|
|
12940
|
+
return { response: slot.response, stale: true };
|
|
12941
|
+
}
|
|
12942
|
+
if (slot && isRefusal(error)) this.slots.delete(key);
|
|
12943
|
+
throw error;
|
|
12944
|
+
}
|
|
12945
|
+
}
|
|
12946
|
+
/** Forget every answer, e.g. after the merchant changes the checkout editor. */
|
|
12947
|
+
clear() {
|
|
12948
|
+
this.slots.clear();
|
|
12949
|
+
}
|
|
12950
|
+
store(key, response, now) {
|
|
12951
|
+
if (response.cache.max_age_seconds <= 0) {
|
|
12952
|
+
this.slots.delete(key);
|
|
12953
|
+
return;
|
|
12954
|
+
}
|
|
12955
|
+
this.slots.delete(key);
|
|
12956
|
+
this.slots.set(key, { response, fetchedAt: now });
|
|
12957
|
+
while (this.slots.size > this.maxEntries) {
|
|
12958
|
+
const oldest = this.slots.keys().next().value;
|
|
12959
|
+
if (oldest === void 0) break;
|
|
12960
|
+
this.slots.delete(oldest);
|
|
12961
|
+
}
|
|
12962
|
+
}
|
|
12963
|
+
};
|
|
12964
|
+
function isRefusal(error) {
|
|
12965
|
+
return error instanceof DelopayError && error.status >= 400 && error.status < 500 && error.status !== 429;
|
|
12966
|
+
}
|
|
12967
|
+
function isUnavailable(error) {
|
|
12968
|
+
if (!(error instanceof DelopayError)) return false;
|
|
12969
|
+
return error.status === 0 || error.status === 429 || error.status >= 500;
|
|
12970
|
+
}
|
|
12971
|
+
|
|
12655
12972
|
// src/panes.ts
|
|
12656
12973
|
var PANE_VISIBILITIES = ["always", "embedded_only", "external_only"];
|
|
12657
12974
|
function parseOpenTarget(raw) {
|
|
@@ -13124,6 +13441,34 @@ var AdminPortal = class {
|
|
|
13124
13441
|
}
|
|
13125
13442
|
);
|
|
13126
13443
|
}
|
|
13444
|
+
/** Read whether refunds return their share of the platform fee, and the scope supplying it. */
|
|
13445
|
+
async getPlatformFeeReturn(merchantId, query = {}) {
|
|
13446
|
+
return this.request(
|
|
13447
|
+
"GET",
|
|
13448
|
+
`/admin-portal/accounts/${encodeURIComponent(merchantId)}/platform-fee-return`,
|
|
13449
|
+
{
|
|
13450
|
+
query: { ...query }
|
|
13451
|
+
}
|
|
13452
|
+
);
|
|
13453
|
+
}
|
|
13454
|
+
/** Change the fee return for refunds that succeed from now on; earlier refunds keep their decision. */
|
|
13455
|
+
async updatePlatformFeeReturn(merchantId, body, query = {}) {
|
|
13456
|
+
return this.request(
|
|
13457
|
+
"PUT",
|
|
13458
|
+
`/admin-portal/accounts/${encodeURIComponent(merchantId)}/platform-fee-return`,
|
|
13459
|
+
{
|
|
13460
|
+
query: { ...query },
|
|
13461
|
+
body
|
|
13462
|
+
}
|
|
13463
|
+
);
|
|
13464
|
+
}
|
|
13465
|
+
/** What each successful refund of one payment returned of the platform fee. */
|
|
13466
|
+
async listPaymentPlatformFeeReturns(merchantId, paymentId) {
|
|
13467
|
+
return this.request(
|
|
13468
|
+
"GET",
|
|
13469
|
+
`/admin-portal/accounts/${encodeURIComponent(merchantId)}/transactions/${encodeURIComponent(paymentId)}/platform-fee-returns`
|
|
13470
|
+
);
|
|
13471
|
+
}
|
|
13127
13472
|
/**
|
|
13128
13473
|
* The deployment's merchant roles: shared roles, the roles defined in code,
|
|
13129
13474
|
* and every merchant's own custom roles. `GET /admin-portal/merchant-roles`
|
|
@@ -14684,6 +15029,7 @@ var DelopayInternal = class extends Delopay {
|
|
|
14684
15029
|
AvailabilityOverrides,
|
|
14685
15030
|
BRANDING_EXPORT_FORMAT,
|
|
14686
15031
|
BRANDING_EXPORT_VERSION,
|
|
15032
|
+
BUILTIN_PAYMENT_ICON_KEYS,
|
|
14687
15033
|
BuyerBlocklist,
|
|
14688
15034
|
CARD_FIELD_CHROMES,
|
|
14689
15035
|
CARD_FIELD_FONT_SIZES,
|
|
@@ -14754,11 +15100,13 @@ var DelopayInternal = class extends Delopay {
|
|
|
14754
15100
|
PANE_ICON_KEYS,
|
|
14755
15101
|
PAYPAL_CARD_LAYOUTS,
|
|
14756
15102
|
PAYPAL_LABEL_STYLES,
|
|
15103
|
+
PRESENTATION_CONTRACT_VERSION,
|
|
14757
15104
|
PaypalDisputes,
|
|
14758
15105
|
PlatformBilling,
|
|
14759
15106
|
PlatformFees,
|
|
14760
15107
|
PlatformMessageTemplates,
|
|
14761
15108
|
PlatformSettings,
|
|
15109
|
+
PresentationCache,
|
|
14762
15110
|
ProcessorCosts,
|
|
14763
15111
|
Products,
|
|
14764
15112
|
RTL_CHECKOUT_LOCALES,
|
|
@@ -14812,6 +15160,8 @@ var DelopayInternal = class extends Delopay {
|
|
|
14812
15160
|
applyBrandingVariables,
|
|
14813
15161
|
asAirwallexCardPreset,
|
|
14814
15162
|
buildBrandingExport,
|
|
15163
|
+
builtinPaymentIconDataUri,
|
|
15164
|
+
builtinPaymentIconSvg,
|
|
14815
15165
|
buttonPadValue,
|
|
14816
15166
|
canonicalSectionId,
|
|
14817
15167
|
cardFieldFontPx,
|
|
@@ -14869,6 +15219,7 @@ var DelopayInternal = class extends Delopay {
|
|
|
14869
15219
|
isNoticeIcon,
|
|
14870
15220
|
isSubscriptionDisputeWebhook,
|
|
14871
15221
|
isSubscriptionLifecycleWebhook,
|
|
15222
|
+
isSupportedPresentation,
|
|
14872
15223
|
knownSectionLabelKey,
|
|
14873
15224
|
leaf,
|
|
14874
15225
|
logoDimensions,
|
|
@@ -14886,6 +15237,9 @@ var DelopayInternal = class extends Delopay {
|
|
|
14886
15237
|
parseCustomFieldsLoose,
|
|
14887
15238
|
parseImportedBranding,
|
|
14888
15239
|
parseNoticesLoose,
|
|
15240
|
+
presentationIconDataUri,
|
|
15241
|
+
presentationIconSrc,
|
|
15242
|
+
presentationTiers,
|
|
14889
15243
|
programToTree,
|
|
14890
15244
|
radiusValue,
|
|
14891
15245
|
readableInkOn,
|
|
@@ -14900,6 +15254,7 @@ var DelopayInternal = class extends Delopay {
|
|
|
14900
15254
|
sanitizeCustomCss,
|
|
14901
15255
|
sectionLabel,
|
|
14902
15256
|
sectionOrderOf,
|
|
15257
|
+
selectableEntries,
|
|
14903
15258
|
shadowFor,
|
|
14904
15259
|
shownNotices,
|
|
14905
15260
|
stripeSpacingValues,
|