@delopay/sdk 0.366.0 → 0.368.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-ESYKTYJA.js → chunk-RD3HP3EY.js} +136 -41
- package/dist/chunk-RD3HP3EY.js.map +1 -0
- package/dist/{index-C2-7sIZx.d.cts → index-DW1C5mFq.d.cts} +234 -4
- package/dist/{index-C2-7sIZx.d.ts → index-DW1C5mFq.d.ts} +234 -4
- package/dist/index.cjs +136 -40
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +3 -1
- package/dist/internal.cjs +207 -40
- package/dist/internal.cjs.map +1 -1
- package/dist/internal.d.cts +114 -3
- package/dist/internal.d.ts +114 -3
- package/dist/internal.js +73 -1
- package/dist/internal.js.map +1 -1
- package/package.json +1 -1
- package/dist/chunk-ESYKTYJA.js.map +0 -1
|
@@ -935,9 +935,9 @@ var Connectors = class {
|
|
|
935
935
|
* to a single event.
|
|
936
936
|
*/
|
|
937
937
|
async registerWebhook(merchantId, connectorId, params) {
|
|
938
|
-
const
|
|
939
|
-
if (params === void 0) return this.request("POST",
|
|
940
|
-
return this.request("POST",
|
|
938
|
+
const path2 = `/account/${encodeURIComponent(merchantId)}/connectors/webhooks/${encodeURIComponent(connectorId)}`;
|
|
939
|
+
if (params === void 0) return this.request("POST", path2);
|
|
940
|
+
return this.request("POST", path2, { body: params });
|
|
941
941
|
}
|
|
942
942
|
/**
|
|
943
943
|
* Register checkout/shop domains as Stripe payment method domains, so Apple
|
|
@@ -1735,11 +1735,11 @@ function negotiated(options, format, presentation) {
|
|
|
1735
1735
|
}
|
|
1736
1736
|
return format === "json" ? { ...options, headers } : { ...options, headers, responseType: "blob" };
|
|
1737
1737
|
}
|
|
1738
|
-
function runExport(request, method,
|
|
1738
|
+
function runExport(request, method, path2, base, options) {
|
|
1739
1739
|
const format = options?.format ?? "json";
|
|
1740
1740
|
return downloadExport(
|
|
1741
1741
|
request,
|
|
1742
|
-
{ method, path, request: negotiated(base, format, options?.presentation), format },
|
|
1742
|
+
{ method, path: path2, request: negotiated(base, format, options?.presentation), format },
|
|
1743
1743
|
options
|
|
1744
1744
|
);
|
|
1745
1745
|
}
|
|
@@ -2740,15 +2740,15 @@ var Payments = class {
|
|
|
2740
2740
|
* ```
|
|
2741
2741
|
*/
|
|
2742
2742
|
async retrieve(paymentId, options) {
|
|
2743
|
-
const
|
|
2744
|
-
if (options === void 0) return this.request("GET",
|
|
2743
|
+
const path2 = `/payments/${encodeURIComponent(paymentId)}`;
|
|
2744
|
+
if (options === void 0) return this.request("GET", path2);
|
|
2745
2745
|
const query = {};
|
|
2746
2746
|
if (options.force_sync !== void 0) query["force_sync"] = options.force_sync;
|
|
2747
2747
|
if (options.all_keys_required !== void 0) {
|
|
2748
2748
|
query["all_keys_required"] = options.all_keys_required;
|
|
2749
2749
|
}
|
|
2750
|
-
if (Object.keys(query).length === 0) return this.request("GET",
|
|
2751
|
-
return this.request("GET",
|
|
2750
|
+
if (Object.keys(query).length === 0) return this.request("GET", path2);
|
|
2751
|
+
return this.request("GET", path2, { query });
|
|
2752
2752
|
}
|
|
2753
2753
|
/**
|
|
2754
2754
|
* The payment's buyer risk evaluations, newest first (at most 50): each
|
|
@@ -3103,6 +3103,36 @@ var Payments = class {
|
|
|
3103
3103
|
options
|
|
3104
3104
|
);
|
|
3105
3105
|
}
|
|
3106
|
+
/**
|
|
3107
|
+
* The statement name and suffix each attempt of a payment asked for and was
|
|
3108
|
+
* sent to its provider with. A name the merchant, the shop or the connector
|
|
3109
|
+
* account configures replaces the payment's own: `name_ignored` /
|
|
3110
|
+
* `suffix_ignored` say the payment's value was not used, and a `null` sent
|
|
3111
|
+
* value leaves the provider account's own default.
|
|
3112
|
+
*
|
|
3113
|
+
* Only attempts with a record are listed: one that carried no name and was
|
|
3114
|
+
* sent none, or ran before the record existed, is absent.
|
|
3115
|
+
*
|
|
3116
|
+
* `GET /payments/{paymentId}/statement-descriptors`
|
|
3117
|
+
*
|
|
3118
|
+
* @param paymentId - The payment intent ID.
|
|
3119
|
+
* @param options - Optional per-call extras: extra `headers`, a `timeout`
|
|
3120
|
+
* override, and an `AbortSignal`.
|
|
3121
|
+
*
|
|
3122
|
+
* @example
|
|
3123
|
+
* ```typescript
|
|
3124
|
+
* const { attempts } = await delopay.payments.statementDescriptors('pay_abc123');
|
|
3125
|
+
* const last = attempts.at(-1);
|
|
3126
|
+
* if (last?.name_ignored) console.log(`Sent as ${last.sent_name}`);
|
|
3127
|
+
* ```
|
|
3128
|
+
*/
|
|
3129
|
+
async statementDescriptors(paymentId, options) {
|
|
3130
|
+
return this.request(
|
|
3131
|
+
"GET",
|
|
3132
|
+
`/payments/${encodeURIComponent(paymentId)}/statement-descriptors`,
|
|
3133
|
+
options
|
|
3134
|
+
);
|
|
3135
|
+
}
|
|
3106
3136
|
/**
|
|
3107
3137
|
* Open a playback of the payment's stored checkout recording: the audited
|
|
3108
3138
|
* act of watching. Answers the manifest — which slices exist, how long the
|
|
@@ -3628,9 +3658,9 @@ var Projects = class {
|
|
|
3628
3658
|
* @returns The project.
|
|
3629
3659
|
*/
|
|
3630
3660
|
async retrieve(projectId, merchantId) {
|
|
3631
|
-
const
|
|
3632
|
-
if (merchantId === void 0) return this.request("GET",
|
|
3633
|
-
return this.request("GET",
|
|
3661
|
+
const path2 = `/projects/${encodeURIComponent(projectId)}`;
|
|
3662
|
+
if (merchantId === void 0) return this.request("GET", path2);
|
|
3663
|
+
return this.request("GET", path2, { query: { merchant_id: merchantId } });
|
|
3634
3664
|
}
|
|
3635
3665
|
/**
|
|
3636
3666
|
* Update a project's details, or move it with `parent_id` (omitted keeps the
|
|
@@ -3648,9 +3678,9 @@ var Projects = class {
|
|
|
3648
3678
|
* @returns The updated project.
|
|
3649
3679
|
*/
|
|
3650
3680
|
async update(projectId, params, merchantId, options) {
|
|
3651
|
-
const
|
|
3652
|
-
if (merchantId === void 0) return this.request("PUT",
|
|
3653
|
-
return this.request("PUT",
|
|
3681
|
+
const path2 = `/projects/${encodeURIComponent(projectId)}`;
|
|
3682
|
+
if (merchantId === void 0) return this.request("PUT", path2, { body: params, ...options });
|
|
3683
|
+
return this.request("PUT", path2, {
|
|
3654
3684
|
body: params,
|
|
3655
3685
|
query: { merchant_id: merchantId },
|
|
3656
3686
|
...options
|
|
@@ -3667,9 +3697,9 @@ var Projects = class {
|
|
|
3667
3697
|
* @returns The deleted project object.
|
|
3668
3698
|
*/
|
|
3669
3699
|
async delete(projectId, merchantId) {
|
|
3670
|
-
const
|
|
3671
|
-
if (merchantId === void 0) return this.request("DELETE",
|
|
3672
|
-
return this.request("DELETE",
|
|
3700
|
+
const path2 = `/projects/${encodeURIComponent(projectId)}`;
|
|
3701
|
+
if (merchantId === void 0) return this.request("DELETE", path2);
|
|
3702
|
+
return this.request("DELETE", path2, { query: { merchant_id: merchantId } });
|
|
3673
3703
|
}
|
|
3674
3704
|
/**
|
|
3675
3705
|
* List all projects for a merchant, at every level, as a flat array. Rebuild
|
|
@@ -4674,9 +4704,9 @@ var Shops = class {
|
|
|
4674
4704
|
* ```
|
|
4675
4705
|
*/
|
|
4676
4706
|
async stats(merchantId, shopId, period) {
|
|
4677
|
-
const
|
|
4678
|
-
if (period === void 0) return this.request("GET",
|
|
4679
|
-
return this.request("GET",
|
|
4707
|
+
const path2 = `/shops/${encodeURIComponent(merchantId)}/${encodeURIComponent(shopId)}/stats`;
|
|
4708
|
+
if (period === void 0) return this.request("GET", path2);
|
|
4709
|
+
return this.request("GET", path2, { query: { period: String(period) } });
|
|
4680
4710
|
}
|
|
4681
4711
|
/**
|
|
4682
4712
|
* Upload a logo file for a shop. The file is stored in Delopay's configured
|
|
@@ -7961,6 +7991,69 @@ var Products = class {
|
|
|
7961
7991
|
}
|
|
7962
7992
|
};
|
|
7963
7993
|
|
|
7994
|
+
// src/resources/support.ts
|
|
7995
|
+
var path = (id) => `/support/conversations/${encodeURIComponent(id)}`;
|
|
7996
|
+
var Support = class {
|
|
7997
|
+
constructor(request) {
|
|
7998
|
+
this.request = request;
|
|
7999
|
+
}
|
|
8000
|
+
/** Start a conversation with its first message. `POST /support/conversations` */
|
|
8001
|
+
async create(body) {
|
|
8002
|
+
return this.request("POST", "/support/conversations", { body });
|
|
8003
|
+
}
|
|
8004
|
+
/** The conversations the caller may read. `GET /support/conversations` */
|
|
8005
|
+
async list(query) {
|
|
8006
|
+
return this.request("GET", "/support/conversations", {
|
|
8007
|
+
query: query === void 0 ? void 0 : { ...query }
|
|
8008
|
+
});
|
|
8009
|
+
}
|
|
8010
|
+
/** One conversation. `GET /support/conversations/{id}` */
|
|
8011
|
+
async retrieve(id) {
|
|
8012
|
+
return this.request("GET", path(id));
|
|
8013
|
+
}
|
|
8014
|
+
/** A conversation's messages. `GET /support/conversations/{id}/messages` */
|
|
8015
|
+
async messages(id, query) {
|
|
8016
|
+
return this.request("GET", `${path(id)}/messages`, {
|
|
8017
|
+
query: query === void 0 ? void 0 : { ...query }
|
|
8018
|
+
});
|
|
8019
|
+
}
|
|
8020
|
+
/** Answer in a conversation. `POST /support/conversations/{id}/messages` */
|
|
8021
|
+
async reply(id, body) {
|
|
8022
|
+
return this.request("POST", `${path(id)}/messages`, { body });
|
|
8023
|
+
}
|
|
8024
|
+
/**
|
|
8025
|
+
* Upload a file for a message. PNG, JPEG, WebP, PDF, text, MP4 or WebM, read from the
|
|
8026
|
+
* content; 10 MB, a video 25 MB. It belongs to the caller until a message names it in
|
|
8027
|
+
* `attachments`. Uploading again with the same `clientUploadId` returns the same file.
|
|
8028
|
+
* `POST /support/conversations/{id}/attachments`
|
|
8029
|
+
*/
|
|
8030
|
+
async uploadAttachment(id, file, clientUploadId, fileName) {
|
|
8031
|
+
const form = new FormData();
|
|
8032
|
+
form.append("client_upload_id", clientUploadId);
|
|
8033
|
+
if (fileName === void 0) form.append("file", file);
|
|
8034
|
+
else form.append("file", file, fileName);
|
|
8035
|
+
return this.request("POST", `${path(id)}/attachments`, { body: form });
|
|
8036
|
+
}
|
|
8037
|
+
/**
|
|
8038
|
+
* Fetch a file once its scan is clean. Refused with `support_attachment_checking` while
|
|
8039
|
+
* the scan runs, and `support_attachment_blocked` after a block.
|
|
8040
|
+
* `GET /support/conversations/{id}/attachments/{fileId}`
|
|
8041
|
+
*/
|
|
8042
|
+
async downloadAttachment(id, fileId) {
|
|
8043
|
+
return this.request("GET", `${path(id)}/attachments/${encodeURIComponent(fileId)}`, {
|
|
8044
|
+
responseType: "blob"
|
|
8045
|
+
});
|
|
8046
|
+
}
|
|
8047
|
+
/**
|
|
8048
|
+
* Clear the merchant's unread mark and read the conversation as it is now.
|
|
8049
|
+
* Someone acting as somebody else leaves the mark in place.
|
|
8050
|
+
* `POST /support/conversations/{id}/read`
|
|
8051
|
+
*/
|
|
8052
|
+
async markRead(id) {
|
|
8053
|
+
return this.request("POST", `${path(id)}/read`);
|
|
8054
|
+
}
|
|
8055
|
+
};
|
|
8056
|
+
|
|
7964
8057
|
// src/resources/invoices.ts
|
|
7965
8058
|
var Invoices = class {
|
|
7966
8059
|
constructor(request) {
|
|
@@ -10429,8 +10522,8 @@ var LiveEventStream = class {
|
|
|
10429
10522
|
return toLiveStreamEvent(dispatch.event, this._lastEventId, this._retry);
|
|
10430
10523
|
}
|
|
10431
10524
|
};
|
|
10432
|
-
async function openLiveStream(openStream,
|
|
10433
|
-
const connection = await openStream(
|
|
10525
|
+
async function openLiveStream(openStream, path2, options = {}) {
|
|
10526
|
+
const connection = await openStream(path2, {
|
|
10434
10527
|
...options.lastEventId ? { lastEventId: options.lastEventId } : {},
|
|
10435
10528
|
...options.signal ? { signal: options.signal } : {},
|
|
10436
10529
|
...options.idleTimeoutMs !== void 0 ? { idleTimeoutMs: options.idleTimeoutMs } : {},
|
|
@@ -10617,8 +10710,8 @@ var ProcessorImports = class {
|
|
|
10617
10710
|
|
|
10618
10711
|
// src/resources/deploymentBranding.ts
|
|
10619
10712
|
function brandingAssetPath(asset, version) {
|
|
10620
|
-
const
|
|
10621
|
-
return version ? `${
|
|
10713
|
+
const path2 = `/branding/assets/${encodeURIComponent(asset)}`;
|
|
10714
|
+
return version ? `${path2}?v=${encodeURIComponent(version)}` : path2;
|
|
10622
10715
|
}
|
|
10623
10716
|
var Branding = class {
|
|
10624
10717
|
constructor(request, baseUrl) {
|
|
@@ -10952,6 +11045,7 @@ var Delopay = class {
|
|
|
10952
11045
|
this.costRules = new CostRules(request);
|
|
10953
11046
|
this.externalRecords = new ExternalRecords(request);
|
|
10954
11047
|
this.products = new Products(request);
|
|
11048
|
+
this.support = new Support(request);
|
|
10955
11049
|
this.invoices = new Invoices(request);
|
|
10956
11050
|
this.invoiceSettings = new InvoiceSettingsResource(request);
|
|
10957
11051
|
this.processorCosts = new ProcessorCosts(request);
|
|
@@ -11012,8 +11106,8 @@ var Delopay = class {
|
|
|
11012
11106
|
return response;
|
|
11013
11107
|
}
|
|
11014
11108
|
/** `path` on the base URL, with the query string `query` makes. */
|
|
11015
|
-
buildUrl(
|
|
11016
|
-
let url = `${this.baseUrl}${
|
|
11109
|
+
buildUrl(path2, query) {
|
|
11110
|
+
let url = `${this.baseUrl}${path2}`;
|
|
11017
11111
|
if (query) {
|
|
11018
11112
|
const params = new URLSearchParams();
|
|
11019
11113
|
for (const [key, value] of Object.entries(query)) {
|
|
@@ -11083,8 +11177,8 @@ var Delopay = class {
|
|
|
11083
11177
|
* on a 2xx that is not `text/event-stream` (code `NOT_EVENT_STREAM`), and
|
|
11084
11178
|
* with `TIMEOUT`, `NETWORK` or `ABORTED` like `request()`.
|
|
11085
11179
|
*/
|
|
11086
|
-
async openEventStream(
|
|
11087
|
-
const url = this.buildUrl(
|
|
11180
|
+
async openEventStream(path2, options = {}) {
|
|
11181
|
+
const url = this.buildUrl(path2, options.query);
|
|
11088
11182
|
const lastEventId = options.lastEventId ?? "";
|
|
11089
11183
|
const headers = {
|
|
11090
11184
|
...this.authHeaders(),
|
|
@@ -11124,7 +11218,7 @@ var Delopay = class {
|
|
|
11124
11218
|
`Network error: ${cause instanceof Error ? cause.message : String(cause ?? "stream failed")}`,
|
|
11125
11219
|
{ status: 0, code: "NETWORK", type: "network_error" }
|
|
11126
11220
|
);
|
|
11127
|
-
this.log("request", { method: "GET", url: redactUrlForLogging(url), path });
|
|
11221
|
+
this.log("request", { method: "GET", url: redactUrlForLogging(url), path: path2 });
|
|
11128
11222
|
startIdleTimer();
|
|
11129
11223
|
let response;
|
|
11130
11224
|
try {
|
|
@@ -11136,7 +11230,7 @@ var Delopay = class {
|
|
|
11136
11230
|
throw network(err);
|
|
11137
11231
|
}
|
|
11138
11232
|
const requestId = response.headers?.get("x-request-id") ?? response.headers?.get("x-trace-id") ?? void 0;
|
|
11139
|
-
this.log("response", { status: response.status, method: "GET", path, requestId });
|
|
11233
|
+
this.log("response", { status: response.status, method: "GET", path: path2, requestId });
|
|
11140
11234
|
if (!response.ok) {
|
|
11141
11235
|
const error = await errorFromResponse(response, requestId);
|
|
11142
11236
|
release();
|
|
@@ -11222,8 +11316,8 @@ var Delopay = class {
|
|
|
11222
11316
|
* @throws {DelopayAuthenticationError} On 401 responses.
|
|
11223
11317
|
* @throws {DelopayError} On all other non-2xx responses, timeouts, and network errors.
|
|
11224
11318
|
*/
|
|
11225
|
-
async request(method,
|
|
11226
|
-
const url = this.buildUrl(
|
|
11319
|
+
async request(method, path2, options) {
|
|
11320
|
+
const url = this.buildUrl(path2, options?.query);
|
|
11227
11321
|
let headers = {
|
|
11228
11322
|
...this.authHeaders(),
|
|
11229
11323
|
...this.profileHeaders(options?.headers),
|
|
@@ -11287,7 +11381,7 @@ var Delopay = class {
|
|
|
11287
11381
|
const delay = Math.max(retryAfterOverrideMs ?? 0, jittered);
|
|
11288
11382
|
retryAfterOverrideMs = null;
|
|
11289
11383
|
await new Promise((resolve) => setTimeout(resolve, delay));
|
|
11290
|
-
emit("retry", { attempt, maxRetries: this.maxRetries, method, path });
|
|
11384
|
+
emit("retry", { attempt, maxRetries: this.maxRetries, method, path: path2 });
|
|
11291
11385
|
}
|
|
11292
11386
|
const timeoutCtrl = new AbortController();
|
|
11293
11387
|
let timeoutId = setTimeout(() => timeoutCtrl.abort(), timeoutMs);
|
|
@@ -11300,7 +11394,7 @@ var Delopay = class {
|
|
|
11300
11394
|
callerSignal ? [timeoutCtrl.signal, callerSignal] : [timeoutCtrl.signal]
|
|
11301
11395
|
);
|
|
11302
11396
|
try {
|
|
11303
|
-
emit("request", { method, url: safeUrl(), path });
|
|
11397
|
+
emit("request", { method, url: safeUrl(), path: path2 });
|
|
11304
11398
|
const response = await fetch(url, {
|
|
11305
11399
|
method,
|
|
11306
11400
|
headers,
|
|
@@ -11309,7 +11403,7 @@ var Delopay = class {
|
|
|
11309
11403
|
...options?.keepalive !== void 0 ? { keepalive: options.keepalive } : {}
|
|
11310
11404
|
});
|
|
11311
11405
|
const requestId = response.headers?.get("x-request-id") ?? response.headers?.get("x-trace-id") ?? void 0;
|
|
11312
|
-
emit("response", { status: response.status, method, path, requestId });
|
|
11406
|
+
emit("response", { status: response.status, method, path: path2, requestId });
|
|
11313
11407
|
if (!response.ok) {
|
|
11314
11408
|
const error = await errorFromResponse(response, requestId);
|
|
11315
11409
|
const isTransientStatus = response.status >= 500 || response.status === 429;
|
|
@@ -16641,7 +16735,7 @@ function encodePanes(panes) {
|
|
|
16641
16735
|
var OPAQUE_PAYMENT_LINK_ID = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/;
|
|
16642
16736
|
function focusedCheckoutUrl(params) {
|
|
16643
16737
|
const base = params.checkoutBaseUrl.replace(/\/+$/, "");
|
|
16644
|
-
const
|
|
16738
|
+
const path2 = params.paymentLinkId && OPAQUE_PAYMENT_LINK_ID.test(params.paymentLinkId) ? `${base}/pay/${params.paymentLinkId}` : `${base}/pay/${encodeURIComponent(params.merchantId)}/${encodeURIComponent(
|
|
16645
16739
|
params.paymentId
|
|
16646
16740
|
)}`;
|
|
16647
16741
|
const query = new URLSearchParams({ pane: params.method });
|
|
@@ -16651,16 +16745,16 @@ function focusedCheckoutUrl(params) {
|
|
|
16651
16745
|
if (merchantConnectorId) query.set("mca", merchantConnectorId);
|
|
16652
16746
|
if (params.locale) query.set("locale", params.locale);
|
|
16653
16747
|
if (params.customFieldsCollected) query.set("cf", "1");
|
|
16654
|
-
return `${
|
|
16748
|
+
return `${path2}?${query.toString()}`;
|
|
16655
16749
|
}
|
|
16656
16750
|
function checkoutEntryUrl(params) {
|
|
16657
16751
|
const base = params.checkoutBaseUrl.replace(/\/+$/, "");
|
|
16658
|
-
const
|
|
16752
|
+
const path2 = params.paymentLinkId && OPAQUE_PAYMENT_LINK_ID.test(params.paymentLinkId) ? `${base}/pay/${params.paymentLinkId}` : `${base}/pay/${encodeURIComponent(params.merchantId)}/${encodeURIComponent(
|
|
16659
16753
|
params.paymentId
|
|
16660
16754
|
)}`;
|
|
16661
16755
|
const query = new URLSearchParams({ entry: params.entry.trim() });
|
|
16662
16756
|
if (params.locale) query.set("locale", params.locale);
|
|
16663
|
-
return `${
|
|
16757
|
+
return `${path2}?${query.toString()}`;
|
|
16664
16758
|
}
|
|
16665
16759
|
function isCheckoutOpenEntryMessage(data) {
|
|
16666
16760
|
if (typeof data !== "object" || data === null) return false;
|
|
@@ -16726,6 +16820,7 @@ export {
|
|
|
16726
16820
|
CostRules,
|
|
16727
16821
|
ExternalRecords,
|
|
16728
16822
|
Products,
|
|
16823
|
+
Support,
|
|
16729
16824
|
Invoices,
|
|
16730
16825
|
InvoiceSettingsResource,
|
|
16731
16826
|
ProcessorCosts,
|
|
@@ -16995,4 +17090,4 @@ export {
|
|
|
16995
17090
|
decodeNativePanes,
|
|
16996
17091
|
encodeNativePanes
|
|
16997
17092
|
};
|
|
16998
|
-
//# sourceMappingURL=chunk-
|
|
17093
|
+
//# sourceMappingURL=chunk-RD3HP3EY.js.map
|