@delopay/sdk 0.248.0 → 0.261.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-BPDN5AIB.js} +532 -2
- package/dist/chunk-BPDN5AIB.js.map +1 -0
- package/dist/index.cjs +542 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1276 -9
- package/dist/index.d.ts +1276 -9
- package/dist/index.js +23 -1
- package/dist/internal.cjs +570 -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 +51 -1
- package/dist/internal.js.map +1 -1
- package/package.json +18 -17
- package/dist/chunk-RPPCA42D.js.map +0 -1
package/dist/index.cjs
CHANGED
|
@@ -41,7 +41,9 @@ __export(index_exports, {
|
|
|
41
41
|
AvailabilityOverrides: () => AvailabilityOverrides,
|
|
42
42
|
BRANDING_EXPORT_FORMAT: () => BRANDING_EXPORT_FORMAT,
|
|
43
43
|
BRANDING_EXPORT_VERSION: () => BRANDING_EXPORT_VERSION,
|
|
44
|
+
BUILTIN_PAYMENT_ICON_KEYS: () => BUILTIN_PAYMENT_ICON_KEYS,
|
|
44
45
|
BuyerBlocklist: () => BuyerBlocklist,
|
|
46
|
+
BuyerConversations: () => BuyerConversations,
|
|
45
47
|
CARD_FIELD_CHROMES: () => CARD_FIELD_CHROMES,
|
|
46
48
|
CARD_FIELD_FONT_SIZES: () => CARD_FIELD_FONT_SIZES,
|
|
47
49
|
CARD_FIELD_WEIGHTS: () => CARD_FIELD_WEIGHTS,
|
|
@@ -102,7 +104,9 @@ __export(index_exports, {
|
|
|
102
104
|
PANE_ICON_KEYS: () => PANE_ICON_KEYS,
|
|
103
105
|
PAYPAL_CARD_LAYOUTS: () => PAYPAL_CARD_LAYOUTS,
|
|
104
106
|
PAYPAL_LABEL_STYLES: () => PAYPAL_LABEL_STYLES,
|
|
107
|
+
PRESENTATION_CONTRACT_VERSION: () => PRESENTATION_CONTRACT_VERSION,
|
|
105
108
|
PaypalDisputes: () => PaypalDisputes,
|
|
109
|
+
PresentationCache: () => PresentationCache,
|
|
106
110
|
ProcessorCosts: () => ProcessorCosts,
|
|
107
111
|
Products: () => Products,
|
|
108
112
|
RTL_CHECKOUT_LOCALES: () => RTL_CHECKOUT_LOCALES,
|
|
@@ -156,6 +160,8 @@ __export(index_exports, {
|
|
|
156
160
|
applyBrandingVariables: () => applyBrandingVariables,
|
|
157
161
|
asAirwallexCardPreset: () => asAirwallexCardPreset,
|
|
158
162
|
buildBrandingExport: () => buildBrandingExport,
|
|
163
|
+
builtinPaymentIconDataUri: () => builtinPaymentIconDataUri,
|
|
164
|
+
builtinPaymentIconSvg: () => builtinPaymentIconSvg,
|
|
159
165
|
buttonPadValue: () => buttonPadValue,
|
|
160
166
|
canonicalSectionId: () => canonicalSectionId,
|
|
161
167
|
cardFieldFontPx: () => cardFieldFontPx,
|
|
@@ -213,6 +219,7 @@ __export(index_exports, {
|
|
|
213
219
|
isNoticeIcon: () => isNoticeIcon,
|
|
214
220
|
isSubscriptionDisputeWebhook: () => isSubscriptionDisputeWebhook,
|
|
215
221
|
isSubscriptionLifecycleWebhook: () => isSubscriptionLifecycleWebhook,
|
|
222
|
+
isSupportedPresentation: () => isSupportedPresentation,
|
|
216
223
|
knownSectionLabelKey: () => knownSectionLabelKey,
|
|
217
224
|
leaf: () => leaf,
|
|
218
225
|
logoDimensions: () => logoDimensions,
|
|
@@ -230,6 +237,9 @@ __export(index_exports, {
|
|
|
230
237
|
parseCustomFieldsLoose: () => parseCustomFieldsLoose,
|
|
231
238
|
parseImportedBranding: () => parseImportedBranding,
|
|
232
239
|
parseNoticesLoose: () => parseNoticesLoose,
|
|
240
|
+
presentationIconDataUri: () => presentationIconDataUri,
|
|
241
|
+
presentationIconSrc: () => presentationIconSrc,
|
|
242
|
+
presentationTiers: () => presentationTiers,
|
|
233
243
|
programToTree: () => programToTree,
|
|
234
244
|
radiusValue: () => radiusValue,
|
|
235
245
|
readableInkOn: () => readableInkOn,
|
|
@@ -244,6 +254,7 @@ __export(index_exports, {
|
|
|
244
254
|
sanitizeCustomCss: () => sanitizeCustomCss,
|
|
245
255
|
sectionLabel: () => sectionLabel,
|
|
246
256
|
sectionOrderOf: () => sectionOrderOf,
|
|
257
|
+
selectableEntries: () => selectableEntries,
|
|
247
258
|
shadowFor: () => shadowFor,
|
|
248
259
|
shownNotices: () => shownNotices,
|
|
249
260
|
stripeSpacingValues: () => stripeSpacingValues,
|
|
@@ -1227,11 +1238,92 @@ var Connectors = class {
|
|
|
1227
1238
|
{ body: params }
|
|
1228
1239
|
);
|
|
1229
1240
|
}
|
|
1241
|
+
/**
|
|
1242
|
+
* Every webhook the connector's payment provider lists for its credentials
|
|
1243
|
+
* in one environment: Delopay's own, other connector accounts', former
|
|
1244
|
+
* addresses' and other integrations'.
|
|
1245
|
+
* `GET /account/{merchantId}/connectors/webhooks/{connectorId}/provider`
|
|
1246
|
+
*
|
|
1247
|
+
* Available for Stripe, PayPal, Airwallex, Whop and Adyen. Destinations are
|
|
1248
|
+
* masked; `capabilities` says which changes the provider allows and
|
|
1249
|
+
* `editable` whether the caller may make them.
|
|
1250
|
+
*/
|
|
1251
|
+
async listProviderWebhooks(merchantId, connectorId, environment) {
|
|
1252
|
+
return this.request("GET", providerWebhooksPath(merchantId, connectorId), {
|
|
1253
|
+
query: { environment }
|
|
1254
|
+
});
|
|
1255
|
+
}
|
|
1256
|
+
/**
|
|
1257
|
+
* Create a webhook at the provider for the merchant's own systems.
|
|
1258
|
+
* `POST /account/{merchantId}/connectors/webhooks/{connectorId}/provider`
|
|
1259
|
+
*
|
|
1260
|
+
* The URL must be `https` and outside Delopay; Delopay's own webhook is
|
|
1261
|
+
* registered with `registerWebhook`. A returned `signing_secret` is not kept
|
|
1262
|
+
* by Delopay and cannot be read again.
|
|
1263
|
+
*/
|
|
1264
|
+
async createProviderWebhook(merchantId, connectorId, params) {
|
|
1265
|
+
return this.request("POST", providerWebhooksPath(merchantId, connectorId), { body: params });
|
|
1266
|
+
}
|
|
1267
|
+
/**
|
|
1268
|
+
* Change one webhook at the provider.
|
|
1269
|
+
* `PATCH /account/{merchantId}/connectors/webhooks/{connectorId}/provider/{webhookId}`
|
|
1270
|
+
*
|
|
1271
|
+
* Refused once the webhook changed since `fingerprint`, and for Delopay's
|
|
1272
|
+
* own webhooks.
|
|
1273
|
+
*/
|
|
1274
|
+
async updateProviderWebhook(merchantId, connectorId, webhookId, params) {
|
|
1275
|
+
return this.request(
|
|
1276
|
+
"PATCH",
|
|
1277
|
+
`${providerWebhooksPath(merchantId, connectorId)}/${encodeURIComponent(webhookId)}`,
|
|
1278
|
+
{ body: params }
|
|
1279
|
+
);
|
|
1280
|
+
}
|
|
1281
|
+
/**
|
|
1282
|
+
* Delete one webhook at the provider.
|
|
1283
|
+
* `POST /account/{merchantId}/connectors/webhooks/{connectorId}/provider/{webhookId}/delete`
|
|
1284
|
+
*
|
|
1285
|
+
* Refused once the webhook changed since `fingerprint`. Deleting Delopay's
|
|
1286
|
+
* own webhook needs `confirm_managed: true`; another connector account's is
|
|
1287
|
+
* never deleted from here.
|
|
1288
|
+
*/
|
|
1289
|
+
async deleteProviderWebhook(merchantId, connectorId, webhookId, params) {
|
|
1290
|
+
return this.request(
|
|
1291
|
+
"POST",
|
|
1292
|
+
`${providerWebhooksPath(merchantId, connectorId)}/${encodeURIComponent(webhookId)}/delete`,
|
|
1293
|
+
{ body: params }
|
|
1294
|
+
);
|
|
1295
|
+
}
|
|
1296
|
+
/**
|
|
1297
|
+
* What "replace all" would delete and keep. Nothing is changed.
|
|
1298
|
+
* `GET /account/{merchantId}/connectors/webhooks/{connectorId}/provider/replace`
|
|
1299
|
+
*/
|
|
1300
|
+
async previewProviderWebhookReplace(merchantId, connectorId, environment) {
|
|
1301
|
+
return this.request("GET", `${providerWebhooksPath(merchantId, connectorId)}/replace`, {
|
|
1302
|
+
query: { environment }
|
|
1303
|
+
});
|
|
1304
|
+
}
|
|
1305
|
+
/**
|
|
1306
|
+
* Keep only Delopay's webhook: delete exactly the confirmed webhooks of the
|
|
1307
|
+
* preview, after registering Delopay's own unless `sequence` is
|
|
1308
|
+
* `delete_first`.
|
|
1309
|
+
* `POST /account/{merchantId}/connectors/webhooks/{connectorId}/provider/replace`
|
|
1310
|
+
*
|
|
1311
|
+
* A list that changed since the preview answers `scope_changed` and deletes
|
|
1312
|
+
* nothing. A second replacement while one runs is refused as busy (`HE_00`).
|
|
1313
|
+
*/
|
|
1314
|
+
async replaceProviderWebhooks(merchantId, connectorId, params) {
|
|
1315
|
+
return this.request("POST", `${providerWebhooksPath(merchantId, connectorId)}/replace`, {
|
|
1316
|
+
body: params
|
|
1317
|
+
});
|
|
1318
|
+
}
|
|
1230
1319
|
/** List available payment methods. `GET /account/payment-methods` */
|
|
1231
1320
|
async listPaymentMethods() {
|
|
1232
1321
|
return this.request("GET", "/account/payment-methods");
|
|
1233
1322
|
}
|
|
1234
1323
|
};
|
|
1324
|
+
function providerWebhooksPath(merchantId, connectorId) {
|
|
1325
|
+
return `/account/${encodeURIComponent(merchantId)}/connectors/webhooks/${encodeURIComponent(connectorId)}/provider`;
|
|
1326
|
+
}
|
|
1235
1327
|
|
|
1236
1328
|
// src/resources/customers.ts
|
|
1237
1329
|
function toQuery(params) {
|
|
@@ -2404,6 +2496,44 @@ var PaymentMethods = class {
|
|
|
2404
2496
|
query: params
|
|
2405
2497
|
});
|
|
2406
2498
|
}
|
|
2499
|
+
/**
|
|
2500
|
+
* The shop's payment buttons as the hosted checkout draws them: order,
|
|
2501
|
+
* labels in the shop's or caller's language, artwork, and what selecting
|
|
2502
|
+
* each one does. For rendering payment buttons on your own site without a
|
|
2503
|
+
* local table of provider names and icons.
|
|
2504
|
+
*
|
|
2505
|
+
* With a secret key, name the shop (`profile_id`) and optionally the
|
|
2506
|
+
* environment and a buyer context; the answer may be reused for
|
|
2507
|
+
* `cache.max_age_seconds` — {@link PresentationCache} does that. With a
|
|
2508
|
+
* publishable key, pass the payment's `client_secret` (or use
|
|
2509
|
+
* `CheckoutSession.paymentMethodPresentation`); that answer is never reused.
|
|
2510
|
+
*
|
|
2511
|
+
* A displayed entry is not a promise: the payment is confirmed against the
|
|
2512
|
+
* current configuration.
|
|
2513
|
+
*
|
|
2514
|
+
* `GET /account/payment-methods/presentation`
|
|
2515
|
+
*
|
|
2516
|
+
* @example
|
|
2517
|
+
* ```typescript
|
|
2518
|
+
* const buttons = await delopay.paymentMethods.presentation({
|
|
2519
|
+
* profile_id: 'pro_123',
|
|
2520
|
+
* country: 'DE',
|
|
2521
|
+
* currency: 'EUR',
|
|
2522
|
+
* amount: 4999,
|
|
2523
|
+
* locale: 'de',
|
|
2524
|
+
* });
|
|
2525
|
+
* for (const entry of buttons.entries) {
|
|
2526
|
+
* if (entry.kind === 'heading') renderHeading(entry.label);
|
|
2527
|
+
* else renderButton(entry.label, entry.sublabel, presentationIconSrc(entry));
|
|
2528
|
+
* }
|
|
2529
|
+
* ```
|
|
2530
|
+
*/
|
|
2531
|
+
async presentation(params, options) {
|
|
2532
|
+
return this.request("GET", "/account/payment-methods/presentation", {
|
|
2533
|
+
query: params,
|
|
2534
|
+
...options
|
|
2535
|
+
});
|
|
2536
|
+
}
|
|
2407
2537
|
/**
|
|
2408
2538
|
* List all saved payment methods for a customer, optionally filtered.
|
|
2409
2539
|
*
|
|
@@ -5698,6 +5828,73 @@ var BuyerBlocklist = class {
|
|
|
5698
5828
|
}
|
|
5699
5829
|
};
|
|
5700
5830
|
|
|
5831
|
+
// src/resources/buyerConversations.ts
|
|
5832
|
+
var BuyerConversations = class {
|
|
5833
|
+
constructor(request) {
|
|
5834
|
+
this.request = request;
|
|
5835
|
+
}
|
|
5836
|
+
/**
|
|
5837
|
+
* One page of the inbox, the latest message first, filtered by shop,
|
|
5838
|
+
* status, assignee, mode or buyer. `GET /buyer-conversations`
|
|
5839
|
+
*/
|
|
5840
|
+
async list(params) {
|
|
5841
|
+
return this.request("GET", "/buyer-conversations", {
|
|
5842
|
+
query: params
|
|
5843
|
+
});
|
|
5844
|
+
}
|
|
5845
|
+
/**
|
|
5846
|
+
* Starts the conversation with a buyer at one shop, or adds to the one that
|
|
5847
|
+
* exists, with a first message. `POST /buyer-conversations`
|
|
5848
|
+
*/
|
|
5849
|
+
async start(params) {
|
|
5850
|
+
return this.request("POST", "/buyer-conversations", { body: params });
|
|
5851
|
+
}
|
|
5852
|
+
/**
|
|
5853
|
+
* One conversation and its newest messages, oldest first; `before` pages
|
|
5854
|
+
* back. `GET /buyer-conversations/{id}`
|
|
5855
|
+
*/
|
|
5856
|
+
async retrieve(id, params) {
|
|
5857
|
+
return this.request("GET", `/buyer-conversations/${encodeURIComponent(id)}`, {
|
|
5858
|
+
query: params
|
|
5859
|
+
});
|
|
5860
|
+
}
|
|
5861
|
+
/**
|
|
5862
|
+
* A team member's answer. A closed conversation refuses it.
|
|
5863
|
+
* `POST /buyer-conversations/{id}/messages`
|
|
5864
|
+
*/
|
|
5865
|
+
async reply(id, params) {
|
|
5866
|
+
return this.request("POST", `/buyer-conversations/${encodeURIComponent(id)}/messages`, {
|
|
5867
|
+
body: params
|
|
5868
|
+
});
|
|
5869
|
+
}
|
|
5870
|
+
/**
|
|
5871
|
+
* The team has read the conversation up to its last accepted message.
|
|
5872
|
+
* `POST /buyer-conversations/{id}/read`
|
|
5873
|
+
*/
|
|
5874
|
+
async markRead(id) {
|
|
5875
|
+
return this.request("POST", `/buyer-conversations/${encodeURIComponent(id)}/read`);
|
|
5876
|
+
}
|
|
5877
|
+
/**
|
|
5878
|
+
* Hands the conversation to a team member, to the caller with `me`, or to
|
|
5879
|
+
* nobody with `null`. `POST /buyer-conversations/{id}/assign`
|
|
5880
|
+
*/
|
|
5881
|
+
async assign(id, params) {
|
|
5882
|
+
return this.request("POST", `/buyer-conversations/${encodeURIComponent(id)}/assign`, {
|
|
5883
|
+
body: params
|
|
5884
|
+
});
|
|
5885
|
+
}
|
|
5886
|
+
/**
|
|
5887
|
+
* Closes or reopens the conversation. Closing moves no money and decides
|
|
5888
|
+
* no case; it stops new messages until reopened.
|
|
5889
|
+
* `POST /buyer-conversations/{id}/status`
|
|
5890
|
+
*/
|
|
5891
|
+
async setStatus(id, params) {
|
|
5892
|
+
return this.request("POST", `/buyer-conversations/${encodeURIComponent(id)}/status`, {
|
|
5893
|
+
body: params
|
|
5894
|
+
});
|
|
5895
|
+
}
|
|
5896
|
+
};
|
|
5897
|
+
|
|
5701
5898
|
// src/resources/checkoutRecovery.ts
|
|
5702
5899
|
var CheckoutRecovery = class {
|
|
5703
5900
|
constructor(request) {
|
|
@@ -7246,7 +7443,7 @@ var BuyerAccount = class {
|
|
|
7246
7443
|
constructor(request) {
|
|
7247
7444
|
this.request = request;
|
|
7248
7445
|
}
|
|
7249
|
-
/** Whether buyers can sign in
|
|
7446
|
+
/** Whether buyers can sign in on this platform, and which methods are offered. */
|
|
7250
7447
|
async availability(options) {
|
|
7251
7448
|
return this.request("GET", "/buyer-account/availability", { ...options });
|
|
7252
7449
|
}
|
|
@@ -7283,6 +7480,108 @@ var BuyerAccount = class {
|
|
|
7283
7480
|
...options
|
|
7284
7481
|
});
|
|
7285
7482
|
}
|
|
7483
|
+
/**
|
|
7484
|
+
* The shops the buyer has purchases at, once each and by name. Pass a
|
|
7485
|
+
* shop's `shop` to `listPurchases` to list only that shop's purchases.
|
|
7486
|
+
*/
|
|
7487
|
+
async listShops(options) {
|
|
7488
|
+
return this.request("GET", "/buyer-account/shops", { ...options });
|
|
7489
|
+
}
|
|
7490
|
+
/**
|
|
7491
|
+
* The buyer's subscriptions across shops, newest first. A record the buyer
|
|
7492
|
+
* has not confirmed shows what a receipt carries, without its period or
|
|
7493
|
+
* cancellation.
|
|
7494
|
+
*/
|
|
7495
|
+
async listSubscriptions(query, options) {
|
|
7496
|
+
return this.request("GET", "/buyer-account/subscriptions", {
|
|
7497
|
+
query,
|
|
7498
|
+
...options
|
|
7499
|
+
});
|
|
7500
|
+
}
|
|
7501
|
+
/**
|
|
7502
|
+
* The issued invoices of the records the buyer has confirmed through a
|
|
7503
|
+
* shop's own link, newest first. `unconfirmed_records` says when records
|
|
7504
|
+
* were left out.
|
|
7505
|
+
*/
|
|
7506
|
+
async listInvoices(query, options) {
|
|
7507
|
+
return this.request("GET", "/buyer-account/invoices", {
|
|
7508
|
+
query,
|
|
7509
|
+
...options
|
|
7510
|
+
});
|
|
7511
|
+
}
|
|
7512
|
+
/** The refund requests of the records the buyer has confirmed, newest first, with the shop's decision. */
|
|
7513
|
+
async listRefundRequests(query, options) {
|
|
7514
|
+
return this.request("GET", "/buyer-account/refund-requests", {
|
|
7515
|
+
query,
|
|
7516
|
+
...options
|
|
7517
|
+
});
|
|
7518
|
+
}
|
|
7519
|
+
/**
|
|
7520
|
+
* The cases of the records the buyer has confirmed: the refund requests
|
|
7521
|
+
* they sent and the disputes about their purchases, newest first, with
|
|
7522
|
+
* where each stands, who acts next, the outcome and the recorded steps.
|
|
7523
|
+
*/
|
|
7524
|
+
async listCases(query, options) {
|
|
7525
|
+
return this.request("GET", "/buyer-account/cases", {
|
|
7526
|
+
query,
|
|
7527
|
+
...options
|
|
7528
|
+
});
|
|
7529
|
+
}
|
|
7530
|
+
/**
|
|
7531
|
+
* The conversations of the records the buyer has confirmed, the latest
|
|
7532
|
+
* message first. `unconfirmed_records` says when other records were left out.
|
|
7533
|
+
*/
|
|
7534
|
+
async listConversations(query, options) {
|
|
7535
|
+
return this.request("GET", "/buyer-account/conversations", {
|
|
7536
|
+
query,
|
|
7537
|
+
...options
|
|
7538
|
+
});
|
|
7539
|
+
}
|
|
7540
|
+
/**
|
|
7541
|
+
* The conversation of a confirmed record with one shop, and its newest
|
|
7542
|
+
* messages, oldest first; `before` pages back. `shop` is required here.
|
|
7543
|
+
*/
|
|
7544
|
+
async listRecordMessages(record, query, options) {
|
|
7545
|
+
return this.request("GET", `/buyer-account/records/${encodeURIComponent(record)}/messages`, {
|
|
7546
|
+
query,
|
|
7547
|
+
...options
|
|
7548
|
+
});
|
|
7549
|
+
}
|
|
7550
|
+
/**
|
|
7551
|
+
* A message from a confirmed record to one of its shops. Sending again with
|
|
7552
|
+
* the same `client_message_id` returns the message the first send stored.
|
|
7553
|
+
*/
|
|
7554
|
+
async sendRecordMessage(record, message, options) {
|
|
7555
|
+
return this.request("POST", `/buyer-account/records/${encodeURIComponent(record)}/messages`, {
|
|
7556
|
+
body: message,
|
|
7557
|
+
...options
|
|
7558
|
+
});
|
|
7559
|
+
}
|
|
7560
|
+
/**
|
|
7561
|
+
* The buyer has read a record's conversation with one shop up to its last
|
|
7562
|
+
* accepted message. Answers with the buyer's conversations as they now stand.
|
|
7563
|
+
*/
|
|
7564
|
+
async markRecordMessagesRead(record, query, options) {
|
|
7565
|
+
return this.request(
|
|
7566
|
+
"POST",
|
|
7567
|
+
`/buyer-account/records/${encodeURIComponent(record)}/messages/read`,
|
|
7568
|
+
{
|
|
7569
|
+
query,
|
|
7570
|
+
...options
|
|
7571
|
+
}
|
|
7572
|
+
);
|
|
7573
|
+
}
|
|
7574
|
+
/**
|
|
7575
|
+
* What the buyer spent in a period: paid purchases summed per currency,
|
|
7576
|
+
* never converted, for the whole period, per day, week or month, per shop
|
|
7577
|
+
* and per kind of purchase.
|
|
7578
|
+
*/
|
|
7579
|
+
async analytics(query, options) {
|
|
7580
|
+
return this.request("GET", "/buyer-account/analytics", {
|
|
7581
|
+
query,
|
|
7582
|
+
...options
|
|
7583
|
+
});
|
|
7584
|
+
}
|
|
7286
7585
|
/**
|
|
7287
7586
|
* Confirm the record of a shop's customer portal link for the signed-in
|
|
7288
7587
|
* buyer. The link's customer must carry the address the buyer signed in
|
|
@@ -7311,6 +7610,48 @@ var BuyerPortal = class {
|
|
|
7311
7610
|
async getSession(options) {
|
|
7312
7611
|
return this.request("GET", "/buyer-portal/session", { ...options });
|
|
7313
7612
|
}
|
|
7613
|
+
/**
|
|
7614
|
+
* The buyer's cases at the shop: the refund requests they sent and the
|
|
7615
|
+
* disputes about their purchases, newest first, with where each stands, who
|
|
7616
|
+
* acts next, the outcome and the recorded steps.
|
|
7617
|
+
*/
|
|
7618
|
+
async listCases(options) {
|
|
7619
|
+
return this.request("GET", "/buyer-portal/cases", { ...options });
|
|
7620
|
+
}
|
|
7621
|
+
/**
|
|
7622
|
+
* The buyer's conversations with the shop, the latest message first. A
|
|
7623
|
+
* portal link for the whole merchant lists one per shop and mode.
|
|
7624
|
+
*/
|
|
7625
|
+
async listConversations(options) {
|
|
7626
|
+
return this.request("GET", "/buyer-portal/conversations", { ...options });
|
|
7627
|
+
}
|
|
7628
|
+
/**
|
|
7629
|
+
* The conversation with one shop and its newest messages, oldest first;
|
|
7630
|
+
* `before` pages back. A link issued for one shop may leave `shop` out.
|
|
7631
|
+
*/
|
|
7632
|
+
async listMessages(query, options) {
|
|
7633
|
+
return this.request("GET", "/buyer-portal/messages", {
|
|
7634
|
+
query,
|
|
7635
|
+
...options
|
|
7636
|
+
});
|
|
7637
|
+
}
|
|
7638
|
+
/**
|
|
7639
|
+
* A message to the shop. Sending again with the same `client_message_id`
|
|
7640
|
+
* returns the message the first send stored; a closed conversation refuses it.
|
|
7641
|
+
*/
|
|
7642
|
+
async sendMessage(message, options) {
|
|
7643
|
+
return this.request("POST", "/buyer-portal/messages", { body: message, ...options });
|
|
7644
|
+
}
|
|
7645
|
+
/**
|
|
7646
|
+
* The buyer has read the conversation with the shop up to its last accepted
|
|
7647
|
+
* message. Answers with the buyer's conversations as they now stand.
|
|
7648
|
+
*/
|
|
7649
|
+
async markMessagesRead(query, options) {
|
|
7650
|
+
return this.request("POST", "/buyer-portal/messages/read", {
|
|
7651
|
+
query,
|
|
7652
|
+
...options
|
|
7653
|
+
});
|
|
7654
|
+
}
|
|
7314
7655
|
/** The buyer's contact and billing details, and what they may change. */
|
|
7315
7656
|
async getProfile(options) {
|
|
7316
7657
|
return this.request("GET", "/buyer-portal/profile", { ...options });
|
|
@@ -8438,6 +8779,7 @@ var Delopay = class {
|
|
|
8438
8779
|
this.availabilityOverrides = new AvailabilityOverrides(request);
|
|
8439
8780
|
this.sellToRestrictions = new SellToRestrictions(request);
|
|
8440
8781
|
this.buyerBlocklist = new BuyerBlocklist(request);
|
|
8782
|
+
this.buyerConversations = new BuyerConversations(request);
|
|
8441
8783
|
this.checkoutRecovery = new CheckoutRecovery(request);
|
|
8442
8784
|
this.costRules = new CostRules(request);
|
|
8443
8785
|
this.externalRecords = new ExternalRecords(request);
|
|
@@ -12634,7 +12976,195 @@ var CheckoutSession = class {
|
|
|
12634
12976
|
headers: this.pkHeaders(options?.headers)
|
|
12635
12977
|
});
|
|
12636
12978
|
}
|
|
12979
|
+
/**
|
|
12980
|
+
* This payment's checkout buttons, as the hosted checkout draws them: order,
|
|
12981
|
+
* labels, artwork, and what selecting each one does. The shop, environment,
|
|
12982
|
+
* currency and amount are the payment's. Ask again when the cart changes;
|
|
12983
|
+
* an answer is never reused for another payment.
|
|
12984
|
+
*
|
|
12985
|
+
* `GET /account/payment-methods/presentation` (publishable key + client secret)
|
|
12986
|
+
*
|
|
12987
|
+
* @param params - `country` outranks the billing address and IP
|
|
12988
|
+
* geolocation; `locale` names the language of the labels.
|
|
12989
|
+
*/
|
|
12990
|
+
async paymentMethodPresentation(params, options) {
|
|
12991
|
+
return this.client.request("GET", "/account/payment-methods/presentation", {
|
|
12992
|
+
query: {
|
|
12993
|
+
client_secret: this.requireClientSecret(),
|
|
12994
|
+
country: params?.country,
|
|
12995
|
+
locale: params?.locale,
|
|
12996
|
+
contract_version: params?.contract_version
|
|
12997
|
+
},
|
|
12998
|
+
...options,
|
|
12999
|
+
headers: this.pkHeaders(options?.headers)
|
|
13000
|
+
});
|
|
13001
|
+
}
|
|
13002
|
+
};
|
|
13003
|
+
|
|
13004
|
+
// src/paymentPresentation.ts
|
|
13005
|
+
var PRESENTATION_CONTRACT_VERSION = 1;
|
|
13006
|
+
var BUILTIN_PAYMENT_ICON_KEYS = [
|
|
13007
|
+
"wallet",
|
|
13008
|
+
"card",
|
|
13009
|
+
"bank",
|
|
13010
|
+
"apple",
|
|
13011
|
+
"google",
|
|
13012
|
+
"bnpl",
|
|
13013
|
+
"cash",
|
|
13014
|
+
"paypal",
|
|
13015
|
+
"klarna",
|
|
13016
|
+
"crypto"
|
|
13017
|
+
];
|
|
13018
|
+
var SVG_OPEN = '<svg xmlns="http://www.w3.org/2000/svg"';
|
|
13019
|
+
function glyph(key, color) {
|
|
13020
|
+
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>`;
|
|
13021
|
+
switch (key) {
|
|
13022
|
+
case "card":
|
|
13023
|
+
return line('<rect x="2" y="5" width="20" height="14" rx="2"/><path d="M2 10h20"/>');
|
|
13024
|
+
case "bank":
|
|
13025
|
+
return line(
|
|
13026
|
+
'<path d="M3 10h18"/><path d="m12 3 9 5H3l9-5Z"/><path d="M6 10v7M10 10v7M14 10v7M18 10v7"/><path d="M3 20h18"/>'
|
|
13027
|
+
);
|
|
13028
|
+
case "bnpl":
|
|
13029
|
+
return line(
|
|
13030
|
+
'<rect x="2" y="6" width="20" height="12" rx="2"/><path d="M6 12h4"/><path d="M14 10v4"/><path d="M18 10v4"/>'
|
|
13031
|
+
);
|
|
13032
|
+
case "cash":
|
|
13033
|
+
return line(
|
|
13034
|
+
'<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"/>'
|
|
13035
|
+
);
|
|
13036
|
+
case "apple":
|
|
13037
|
+
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>`;
|
|
13038
|
+
case "google":
|
|
13039
|
+
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>`;
|
|
13040
|
+
case "paypal":
|
|
13041
|
+
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>`;
|
|
13042
|
+
case "klarna":
|
|
13043
|
+
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>`;
|
|
13044
|
+
case "crypto":
|
|
13045
|
+
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>`;
|
|
13046
|
+
case "wallet":
|
|
13047
|
+
return line(
|
|
13048
|
+
'<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"/>'
|
|
13049
|
+
);
|
|
13050
|
+
}
|
|
13051
|
+
}
|
|
13052
|
+
function isBuiltinKey(key) {
|
|
13053
|
+
return BUILTIN_PAYMENT_ICON_KEYS.includes(key);
|
|
13054
|
+
}
|
|
13055
|
+
function builtinPaymentIconSvg(key, color = "#1f2937") {
|
|
13056
|
+
return glyph(isBuiltinKey(key) ? key : "wallet", color);
|
|
13057
|
+
}
|
|
13058
|
+
function builtinPaymentIconDataUri(key, color) {
|
|
13059
|
+
return `data:image/svg+xml;charset=utf-8,${encodeURIComponent(builtinPaymentIconSvg(key, color))}`;
|
|
13060
|
+
}
|
|
13061
|
+
function presentationIconDataUri(icon, color) {
|
|
13062
|
+
return icon.type === "svg" ? icon.data_uri : builtinPaymentIconDataUri(icon.key, color);
|
|
13063
|
+
}
|
|
13064
|
+
function presentationIconSrc(entry, color) {
|
|
13065
|
+
if (entry.icon) return presentationIconDataUri(entry.icon, color);
|
|
13066
|
+
if (entry.fallback_icon) return builtinPaymentIconDataUri(entry.fallback_icon, color);
|
|
13067
|
+
return null;
|
|
13068
|
+
}
|
|
13069
|
+
function isSupportedPresentation(response) {
|
|
13070
|
+
return response.contract_version === PRESENTATION_CONTRACT_VERSION;
|
|
13071
|
+
}
|
|
13072
|
+
function presentationTiers(response) {
|
|
13073
|
+
const out = { express: [], normal: [], alternative: [] };
|
|
13074
|
+
for (const entry of response.entries) {
|
|
13075
|
+
if (entry.tier === "express") {
|
|
13076
|
+
const row = entry.row ?? 0;
|
|
13077
|
+
while (out.express.length <= row) out.express.push([]);
|
|
13078
|
+
out.express[row]?.push(entry);
|
|
13079
|
+
} else {
|
|
13080
|
+
out[entry.tier].push(entry);
|
|
13081
|
+
}
|
|
13082
|
+
}
|
|
13083
|
+
out.express = out.express.filter((row) => row.length > 0);
|
|
13084
|
+
return out;
|
|
13085
|
+
}
|
|
13086
|
+
function selectableEntries(response) {
|
|
13087
|
+
return response.entries.filter((entry) => entry.action !== void 0);
|
|
13088
|
+
}
|
|
13089
|
+
var PresentationCache = class _PresentationCache {
|
|
13090
|
+
constructor(options) {
|
|
13091
|
+
this.slots = /* @__PURE__ */ new Map();
|
|
13092
|
+
this.load = options.load;
|
|
13093
|
+
this.now = options.now ?? Date.now;
|
|
13094
|
+
this.maxEntries = options.maxEntries ?? 500;
|
|
13095
|
+
}
|
|
13096
|
+
/** The key two requests share exactly when DeloPay would answer them alike. */
|
|
13097
|
+
static keyOf(params) {
|
|
13098
|
+
return JSON.stringify([
|
|
13099
|
+
params.profile_id ?? null,
|
|
13100
|
+
params.environment ?? "live",
|
|
13101
|
+
params.locale?.toLowerCase() ?? null,
|
|
13102
|
+
params.country?.toUpperCase() ?? null,
|
|
13103
|
+
params.currency ?? null,
|
|
13104
|
+
params.amount ?? null,
|
|
13105
|
+
params.contract_version ?? PRESENTATION_CONTRACT_VERSION
|
|
13106
|
+
]);
|
|
13107
|
+
}
|
|
13108
|
+
async get(params) {
|
|
13109
|
+
const request = {
|
|
13110
|
+
...params,
|
|
13111
|
+
contract_version: params.contract_version ?? PRESENTATION_CONTRACT_VERSION
|
|
13112
|
+
};
|
|
13113
|
+
if (request.client_secret) {
|
|
13114
|
+
return { response: await this.load(request, {}), stale: false };
|
|
13115
|
+
}
|
|
13116
|
+
const key = _PresentationCache.keyOf(request);
|
|
13117
|
+
const slot = this.slots.get(key);
|
|
13118
|
+
const now = this.now();
|
|
13119
|
+
if (slot && now - slot.fetchedAt < slot.response.cache.max_age_seconds * 1e3) {
|
|
13120
|
+
return { response: slot.response, stale: false };
|
|
13121
|
+
}
|
|
13122
|
+
try {
|
|
13123
|
+
const response = await this.load(
|
|
13124
|
+
request,
|
|
13125
|
+
slot ? { headers: { "If-None-Match": `"${slot.response.revision}"` } } : {}
|
|
13126
|
+
);
|
|
13127
|
+
this.store(key, response, now);
|
|
13128
|
+
return { response, stale: false };
|
|
13129
|
+
} catch (error) {
|
|
13130
|
+
if (slot && error instanceof DelopayError && error.status === 304) {
|
|
13131
|
+
this.store(key, slot.response, now);
|
|
13132
|
+
return { response: slot.response, stale: false };
|
|
13133
|
+
}
|
|
13134
|
+
const policy = slot?.response.cache;
|
|
13135
|
+
const usableUntil = slot ? slot.fetchedAt + ((policy?.max_age_seconds ?? 0) + (policy?.stale_if_error_seconds ?? 0)) * 1e3 : 0;
|
|
13136
|
+
if (slot && isUnavailable(error) && now < usableUntil) {
|
|
13137
|
+
return { response: slot.response, stale: true };
|
|
13138
|
+
}
|
|
13139
|
+
if (slot && isRefusal(error)) this.slots.delete(key);
|
|
13140
|
+
throw error;
|
|
13141
|
+
}
|
|
13142
|
+
}
|
|
13143
|
+
/** Forget every answer, e.g. after the merchant changes the checkout editor. */
|
|
13144
|
+
clear() {
|
|
13145
|
+
this.slots.clear();
|
|
13146
|
+
}
|
|
13147
|
+
store(key, response, now) {
|
|
13148
|
+
if (response.cache.max_age_seconds <= 0) {
|
|
13149
|
+
this.slots.delete(key);
|
|
13150
|
+
return;
|
|
13151
|
+
}
|
|
13152
|
+
this.slots.delete(key);
|
|
13153
|
+
this.slots.set(key, { response, fetchedAt: now });
|
|
13154
|
+
while (this.slots.size > this.maxEntries) {
|
|
13155
|
+
const oldest = this.slots.keys().next().value;
|
|
13156
|
+
if (oldest === void 0) break;
|
|
13157
|
+
this.slots.delete(oldest);
|
|
13158
|
+
}
|
|
13159
|
+
}
|
|
12637
13160
|
};
|
|
13161
|
+
function isRefusal(error) {
|
|
13162
|
+
return error instanceof DelopayError && error.status >= 400 && error.status < 500 && error.status !== 429;
|
|
13163
|
+
}
|
|
13164
|
+
function isUnavailable(error) {
|
|
13165
|
+
if (!(error instanceof DelopayError)) return false;
|
|
13166
|
+
return error.status === 0 || error.status === 429 || error.status >= 500;
|
|
13167
|
+
}
|
|
12638
13168
|
|
|
12639
13169
|
// src/panes.ts
|
|
12640
13170
|
var PANE_VISIBILITIES = ["always", "embedded_only", "external_only"];
|
|
@@ -13064,7 +13594,9 @@ var encodeNativePanes = encodePanes;
|
|
|
13064
13594
|
AvailabilityOverrides,
|
|
13065
13595
|
BRANDING_EXPORT_FORMAT,
|
|
13066
13596
|
BRANDING_EXPORT_VERSION,
|
|
13597
|
+
BUILTIN_PAYMENT_ICON_KEYS,
|
|
13067
13598
|
BuyerBlocklist,
|
|
13599
|
+
BuyerConversations,
|
|
13068
13600
|
CARD_FIELD_CHROMES,
|
|
13069
13601
|
CARD_FIELD_FONT_SIZES,
|
|
13070
13602
|
CARD_FIELD_WEIGHTS,
|
|
@@ -13125,7 +13657,9 @@ var encodeNativePanes = encodePanes;
|
|
|
13125
13657
|
PANE_ICON_KEYS,
|
|
13126
13658
|
PAYPAL_CARD_LAYOUTS,
|
|
13127
13659
|
PAYPAL_LABEL_STYLES,
|
|
13660
|
+
PRESENTATION_CONTRACT_VERSION,
|
|
13128
13661
|
PaypalDisputes,
|
|
13662
|
+
PresentationCache,
|
|
13129
13663
|
ProcessorCosts,
|
|
13130
13664
|
Products,
|
|
13131
13665
|
RTL_CHECKOUT_LOCALES,
|
|
@@ -13179,6 +13713,8 @@ var encodeNativePanes = encodePanes;
|
|
|
13179
13713
|
applyBrandingVariables,
|
|
13180
13714
|
asAirwallexCardPreset,
|
|
13181
13715
|
buildBrandingExport,
|
|
13716
|
+
builtinPaymentIconDataUri,
|
|
13717
|
+
builtinPaymentIconSvg,
|
|
13182
13718
|
buttonPadValue,
|
|
13183
13719
|
canonicalSectionId,
|
|
13184
13720
|
cardFieldFontPx,
|
|
@@ -13236,6 +13772,7 @@ var encodeNativePanes = encodePanes;
|
|
|
13236
13772
|
isNoticeIcon,
|
|
13237
13773
|
isSubscriptionDisputeWebhook,
|
|
13238
13774
|
isSubscriptionLifecycleWebhook,
|
|
13775
|
+
isSupportedPresentation,
|
|
13239
13776
|
knownSectionLabelKey,
|
|
13240
13777
|
leaf,
|
|
13241
13778
|
logoDimensions,
|
|
@@ -13253,6 +13790,9 @@ var encodeNativePanes = encodePanes;
|
|
|
13253
13790
|
parseCustomFieldsLoose,
|
|
13254
13791
|
parseImportedBranding,
|
|
13255
13792
|
parseNoticesLoose,
|
|
13793
|
+
presentationIconDataUri,
|
|
13794
|
+
presentationIconSrc,
|
|
13795
|
+
presentationTiers,
|
|
13256
13796
|
programToTree,
|
|
13257
13797
|
radiusValue,
|
|
13258
13798
|
readableInkOn,
|
|
@@ -13267,6 +13807,7 @@ var encodeNativePanes = encodePanes;
|
|
|
13267
13807
|
sanitizeCustomCss,
|
|
13268
13808
|
sectionLabel,
|
|
13269
13809
|
sectionOrderOf,
|
|
13810
|
+
selectableEntries,
|
|
13270
13811
|
shadowFor,
|
|
13271
13812
|
shownNotices,
|
|
13272
13813
|
stripeSpacingValues,
|