@delopay/sdk 0.151.0 → 0.152.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-U4LI2HSJ.js → chunk-ZLD3ZEMZ.js} +52 -6
- package/dist/chunk-ZLD3ZEMZ.js.map +1 -0
- package/dist/index.cjs +52 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +165 -9
- package/dist/index.d.ts +165 -9
- package/dist/index.js +3 -1
- package/dist/internal.cjs +52 -5
- 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 +3 -1
- package/dist/internal.js.map +1 -1
- package/package.json +1 -1
- package/dist/chunk-U4LI2HSJ.js.map +0 -1
package/dist/index.cjs
CHANGED
|
@@ -50,6 +50,7 @@ __export(index_exports, {
|
|
|
50
50
|
CUSTOM_FIELD_OPERATORS_BY_SOURCE: () => CUSTOM_FIELD_OPERATORS_BY_SOURCE,
|
|
51
51
|
CUSTOM_FIELD_VALUELESS_OPERATORS: () => CUSTOM_FIELD_VALUELESS_OPERATORS,
|
|
52
52
|
Cards: () => Cards,
|
|
53
|
+
CheckoutMethods: () => CheckoutMethods,
|
|
53
54
|
CheckoutSession: () => CheckoutSession,
|
|
54
55
|
DEFAULT_BADGES: () => DEFAULT_BADGES,
|
|
55
56
|
DEFAULT_BADGES_DARK: () => DEFAULT_BADGES_DARK,
|
|
@@ -4493,6 +4494,43 @@ var AvailabilityOverrides = class {
|
|
|
4493
4494
|
}
|
|
4494
4495
|
};
|
|
4495
4496
|
|
|
4497
|
+
// src/resources/checkoutMethods.ts
|
|
4498
|
+
var CheckoutMethods = class {
|
|
4499
|
+
constructor(request) {
|
|
4500
|
+
this.request = request;
|
|
4501
|
+
}
|
|
4502
|
+
/**
|
|
4503
|
+
* The shop's layout (stored, or derived from its accounts) and every item
|
|
4504
|
+
* it may place. `GET /checkout-methods/{profile_id}`
|
|
4505
|
+
*/
|
|
4506
|
+
async retrieve(merchantId, profileId) {
|
|
4507
|
+
return this.request("GET", `/checkout-methods/${encodeURIComponent(profileId)}`, {
|
|
4508
|
+
query: { merchant_id: merchantId }
|
|
4509
|
+
});
|
|
4510
|
+
}
|
|
4511
|
+
/**
|
|
4512
|
+
* Replace the shop's layout. The router refuses an express item that does
|
|
4513
|
+
* not draw its own button, more than two rows of two in the express strip,
|
|
4514
|
+
* a title without text, or an item no account of the shop offers.
|
|
4515
|
+
* `PUT /checkout-methods/{profile_id}`
|
|
4516
|
+
*/
|
|
4517
|
+
async update(merchantId, profileId, body) {
|
|
4518
|
+
return this.request("PUT", `/checkout-methods/${encodeURIComponent(profileId)}`, {
|
|
4519
|
+
query: { merchant_id: merchantId },
|
|
4520
|
+
body
|
|
4521
|
+
});
|
|
4522
|
+
}
|
|
4523
|
+
/**
|
|
4524
|
+
* Delete the stored layout; the shop is back on the derived one.
|
|
4525
|
+
* `DELETE /checkout-methods/{profile_id}`
|
|
4526
|
+
*/
|
|
4527
|
+
async reset(merchantId, profileId) {
|
|
4528
|
+
return this.request("DELETE", `/checkout-methods/${encodeURIComponent(profileId)}`, {
|
|
4529
|
+
query: { merchant_id: merchantId }
|
|
4530
|
+
});
|
|
4531
|
+
}
|
|
4532
|
+
};
|
|
4533
|
+
|
|
4496
4534
|
// src/resources/subscriptions.ts
|
|
4497
4535
|
var Subscriptions = class {
|
|
4498
4536
|
constructor(request) {
|
|
@@ -5375,6 +5413,7 @@ var Delopay = class {
|
|
|
5375
5413
|
this.forex = new Forex(request);
|
|
5376
5414
|
this.regions = new Regions(request);
|
|
5377
5415
|
this.availabilityOverrides = new AvailabilityOverrides(request);
|
|
5416
|
+
this.checkoutMethods = new CheckoutMethods(request);
|
|
5378
5417
|
this.analytics = new Analytics(request);
|
|
5379
5418
|
this.analyticsDashboard = new AnalyticsDashboard(request);
|
|
5380
5419
|
this.featureMatrix = new FeatureMatrix(request);
|
|
@@ -7771,19 +7810,23 @@ var CheckoutSession = class {
|
|
|
7771
7810
|
* discriminated union owned by the consuming checkout, which keeps its
|
|
7772
7811
|
* own types and runtime gates — hence the loose return type.
|
|
7773
7812
|
*
|
|
7774
|
-
* `theme`
|
|
7775
|
-
*
|
|
7813
|
+
* `theme` (a named checkout variant) and `country` are the route's declared
|
|
7814
|
+
* query parameters. `country` is a manual override of the buyer country the
|
|
7815
|
+
* router otherwise resolves from the client IP — it decides which payment
|
|
7816
|
+
* methods the layout shows — as an ISO 3166-1 alpha-2 code, sent uppercased
|
|
7817
|
+
* and omitted when empty. `locale` travels as `Accept-Language` — the only
|
|
7776
7818
|
* channel the backend's locale resolution reads; a `?locale=` query is
|
|
7777
7819
|
* silently ignored by this route.
|
|
7778
7820
|
*
|
|
7779
7821
|
* `GET /payment-link/data/{merchantId}/{paymentId}`
|
|
7780
7822
|
*/
|
|
7781
7823
|
async fetchCheckoutData(params, options) {
|
|
7824
|
+
const country = params?.country?.trim().toUpperCase();
|
|
7782
7825
|
return this.client.request(
|
|
7783
7826
|
"GET",
|
|
7784
7827
|
`/payment-link/data/${encodeURIComponent(this.merchantId)}/${encodeURIComponent(this.paymentId)}`,
|
|
7785
7828
|
{
|
|
7786
|
-
query: { theme: params?.theme },
|
|
7829
|
+
query: { theme: params?.theme, country: country || void 0 },
|
|
7787
7830
|
...options,
|
|
7788
7831
|
headers: {
|
|
7789
7832
|
...params?.locale ? {
|
|
@@ -8091,6 +8134,9 @@ var CheckoutSession = class {
|
|
|
8091
8134
|
|
|
8092
8135
|
// src/panes.ts
|
|
8093
8136
|
var PANE_VISIBILITIES = ["always", "embedded_only", "external_only"];
|
|
8137
|
+
function parseOpenTarget(raw) {
|
|
8138
|
+
return raw === "popup" || raw === "same_page" ? raw : "tab";
|
|
8139
|
+
}
|
|
8094
8140
|
function parseVisibility(raw) {
|
|
8095
8141
|
return PANE_VISIBILITIES.find((value) => value === raw) ?? "always";
|
|
8096
8142
|
}
|
|
@@ -8382,7 +8428,7 @@ function decodePanes(raw) {
|
|
|
8382
8428
|
// Anything unrecognised degrades to `always` rather than dropping the row.
|
|
8383
8429
|
visibility: parseVisibility(entry["visibility"]),
|
|
8384
8430
|
// Same tolerance: an unknown value degrades to the default `tab`.
|
|
8385
|
-
openIn: entry["open_in"]
|
|
8431
|
+
openIn: parseOpenTarget(entry["open_in"]),
|
|
8386
8432
|
nativeElement: parseNativeElement(entry["native_element"]),
|
|
8387
8433
|
preset: str(entry["preset"]),
|
|
8388
8434
|
style: str(entry["style"])
|
|
@@ -8437,7 +8483,7 @@ function encodePanes(panes) {
|
|
|
8437
8483
|
// never went through `decodePanes`. A decoded pane always holds a valid
|
|
8438
8484
|
// value, so this is a no-op on the round-trip path.
|
|
8439
8485
|
visibility: parseVisibility(pane.visibility),
|
|
8440
|
-
open_in: pane.openIn
|
|
8486
|
+
open_in: parseOpenTarget(pane.openIn),
|
|
8441
8487
|
// Omitted at the default: `everywhere` is what the router decodes an
|
|
8442
8488
|
// absent key to, so leaving it out changes nothing — and keeps a blob
|
|
8443
8489
|
// stored before the field existed byte-identical on re-encode, which
|
|
@@ -8521,6 +8567,7 @@ var encodeNativePanes = encodePanes;
|
|
|
8521
8567
|
CUSTOM_FIELD_OPERATORS_BY_SOURCE,
|
|
8522
8568
|
CUSTOM_FIELD_VALUELESS_OPERATORS,
|
|
8523
8569
|
Cards,
|
|
8570
|
+
CheckoutMethods,
|
|
8524
8571
|
CheckoutSession,
|
|
8525
8572
|
DEFAULT_BADGES,
|
|
8526
8573
|
DEFAULT_BADGES_DARK,
|