@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.
@@ -4298,6 +4298,43 @@ var AvailabilityOverrides = class {
4298
4298
  }
4299
4299
  };
4300
4300
 
4301
+ // src/resources/checkoutMethods.ts
4302
+ var CheckoutMethods = class {
4303
+ constructor(request) {
4304
+ this.request = request;
4305
+ }
4306
+ /**
4307
+ * The shop's layout (stored, or derived from its accounts) and every item
4308
+ * it may place. `GET /checkout-methods/{profile_id}`
4309
+ */
4310
+ async retrieve(merchantId, profileId) {
4311
+ return this.request("GET", `/checkout-methods/${encodeURIComponent(profileId)}`, {
4312
+ query: { merchant_id: merchantId }
4313
+ });
4314
+ }
4315
+ /**
4316
+ * Replace the shop's layout. The router refuses an express item that does
4317
+ * not draw its own button, more than two rows of two in the express strip,
4318
+ * a title without text, or an item no account of the shop offers.
4319
+ * `PUT /checkout-methods/{profile_id}`
4320
+ */
4321
+ async update(merchantId, profileId, body) {
4322
+ return this.request("PUT", `/checkout-methods/${encodeURIComponent(profileId)}`, {
4323
+ query: { merchant_id: merchantId },
4324
+ body
4325
+ });
4326
+ }
4327
+ /**
4328
+ * Delete the stored layout; the shop is back on the derived one.
4329
+ * `DELETE /checkout-methods/{profile_id}`
4330
+ */
4331
+ async reset(merchantId, profileId) {
4332
+ return this.request("DELETE", `/checkout-methods/${encodeURIComponent(profileId)}`, {
4333
+ query: { merchant_id: merchantId }
4334
+ });
4335
+ }
4336
+ };
4337
+
4301
4338
  // src/resources/subscriptions.ts
4302
4339
  var Subscriptions = class {
4303
4340
  constructor(request) {
@@ -5180,6 +5217,7 @@ var Delopay = class {
5180
5217
  this.forex = new Forex(request);
5181
5218
  this.regions = new Regions(request);
5182
5219
  this.availabilityOverrides = new AvailabilityOverrides(request);
5220
+ this.checkoutMethods = new CheckoutMethods(request);
5183
5221
  this.analytics = new Analytics(request);
5184
5222
  this.analyticsDashboard = new AnalyticsDashboard(request);
5185
5223
  this.featureMatrix = new FeatureMatrix(request);
@@ -7576,19 +7614,23 @@ var CheckoutSession = class {
7576
7614
  * discriminated union owned by the consuming checkout, which keeps its
7577
7615
  * own types and runtime gates — hence the loose return type.
7578
7616
  *
7579
- * `theme` is the route's one declared query parameter (a named checkout
7580
- * variant). `locale` travels as `Accept-Language` — the only
7617
+ * `theme` (a named checkout variant) and `country` are the route's declared
7618
+ * query parameters. `country` is a manual override of the buyer country the
7619
+ * router otherwise resolves from the client IP — it decides which payment
7620
+ * methods the layout shows — as an ISO 3166-1 alpha-2 code, sent uppercased
7621
+ * and omitted when empty. `locale` travels as `Accept-Language` — the only
7581
7622
  * channel the backend's locale resolution reads; a `?locale=` query is
7582
7623
  * silently ignored by this route.
7583
7624
  *
7584
7625
  * `GET /payment-link/data/{merchantId}/{paymentId}`
7585
7626
  */
7586
7627
  async fetchCheckoutData(params, options) {
7628
+ const country = params?.country?.trim().toUpperCase();
7587
7629
  return this.client.request(
7588
7630
  "GET",
7589
7631
  `/payment-link/data/${encodeURIComponent(this.merchantId)}/${encodeURIComponent(this.paymentId)}`,
7590
7632
  {
7591
- query: { theme: params?.theme },
7633
+ query: { theme: params?.theme, country: country || void 0 },
7592
7634
  ...options,
7593
7635
  headers: {
7594
7636
  ...params?.locale ? {
@@ -7896,6 +7938,9 @@ var CheckoutSession = class {
7896
7938
 
7897
7939
  // src/panes.ts
7898
7940
  var PANE_VISIBILITIES = ["always", "embedded_only", "external_only"];
7941
+ function parseOpenTarget(raw) {
7942
+ return raw === "popup" || raw === "same_page" ? raw : "tab";
7943
+ }
7899
7944
  function parseVisibility(raw) {
7900
7945
  return PANE_VISIBILITIES.find((value) => value === raw) ?? "always";
7901
7946
  }
@@ -8187,7 +8232,7 @@ function decodePanes(raw) {
8187
8232
  // Anything unrecognised degrades to `always` rather than dropping the row.
8188
8233
  visibility: parseVisibility(entry["visibility"]),
8189
8234
  // Same tolerance: an unknown value degrades to the default `tab`.
8190
- openIn: entry["open_in"] === "popup" ? "popup" : "tab",
8235
+ openIn: parseOpenTarget(entry["open_in"]),
8191
8236
  nativeElement: parseNativeElement(entry["native_element"]),
8192
8237
  preset: str(entry["preset"]),
8193
8238
  style: str(entry["style"])
@@ -8242,7 +8287,7 @@ function encodePanes(panes) {
8242
8287
  // never went through `decodePanes`. A decoded pane always holds a valid
8243
8288
  // value, so this is a no-op on the round-trip path.
8244
8289
  visibility: parseVisibility(pane.visibility),
8245
- open_in: pane.openIn === "popup" ? "popup" : "tab",
8290
+ open_in: parseOpenTarget(pane.openIn),
8246
8291
  // Omitted at the default: `everywhere` is what the router decodes an
8247
8292
  // absent key to, so leaving it out changes nothing — and keeps a blob
8248
8293
  // stored before the field existed byte-identical on re-encode, which
@@ -8311,6 +8356,7 @@ export {
8311
8356
  Forex,
8312
8357
  Regions,
8313
8358
  AvailabilityOverrides,
8359
+ CheckoutMethods,
8314
8360
  Subscriptions,
8315
8361
  Audit,
8316
8362
  Settlement,
@@ -8467,4 +8513,4 @@ export {
8467
8513
  decodeNativePanes,
8468
8514
  encodeNativePanes
8469
8515
  };
8470
- //# sourceMappingURL=chunk-U4LI2HSJ.js.map
8516
+ //# sourceMappingURL=chunk-ZLD3ZEMZ.js.map