@delopay/sdk 0.186.0 → 0.188.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.
@@ -3889,9 +3889,19 @@ var Users = class {
3889
3889
  * Mints a session token **as** the given member, so the dashboard renders
3890
3890
  * exactly what they see (useful for support and role verification). The
3891
3891
  * caller needs the *Impersonation* permission, and the member's role must
3892
- * rank **strictly below** the caller's (`Profile < Merchant < Organization`);
3893
- * the server rejects self-impersonation, cross-merchant targets, and
3894
- * equal/higher roles.
3892
+ * either rank **strictly below** the caller's
3893
+ * (`Profile < Merchant < Organization`), or sit at the caller's own
3894
+ * merchant-or-higher level and be **strictly narrower** than the caller's
3895
+ * role (grant nothing the caller's role does not, and less in total). The
3896
+ * server rejects self-impersonation and cross-merchant targets.
3897
+ * `MinimalRoleInfo.can_impersonate` in `listUsersInLineage` answers the same rule
3898
+ * per binding, so a UI can offer the action only where it will succeed.
3899
+ *
3900
+ * A role refusal is a `UR_33` error whose `data.reason` names the rule:
3901
+ * `impersonation_target_not_narrower` (the member's role is above, equal to,
3902
+ * or not contained in the caller's), or `act_as_token_cannot_impersonate`
3903
+ * (the caller is itself signed in as another member — start from your own
3904
+ * session).
3895
3905
  *
3896
3906
  * The returned token is tab-scoped by design: open it in a fresh tab (e.g.
3897
3907
  * `/auth/impersonate?token=…`) rather than replacing the caller's own
@@ -5067,6 +5077,20 @@ var Products = class {
5067
5077
  ...this.scoped(profileId, options)
5068
5078
  });
5069
5079
  }
5080
+ /**
5081
+ * Delete an archived product, then carry out the chosen action at each
5082
+ * connected account it is tied to. An account not named in
5083
+ * `provider_actions` is kept as it is. A failed provider action does not
5084
+ * undo the delete: it is listed by {@link providerCleanups} and retried
5085
+ * with {@link providerArchive}.
5086
+ * `POST /products/{product_id}/delete`
5087
+ */
5088
+ async deleteWithProviders(productId, request, profileId, options) {
5089
+ return this.request("POST", `/products/${encodeURIComponent(productId)}/delete`, {
5090
+ body: request,
5091
+ ...this.scoped(profileId, options)
5092
+ });
5093
+ }
5070
5094
  /**
5071
5095
  * Add a price to an existing product.
5072
5096
  * `POST /products/{product_id}/prices`
@@ -5308,9 +5332,12 @@ var Products = class {
5308
5332
  }
5309
5333
  /**
5310
5334
  * Create a product for every new item and add the new prices of every
5311
- * changed one, tied to the provider's ids. Nothing is edited or removed, and
5312
- * nothing is written to the provider. A failed item is reported with its
5313
- * reason and can be retried by naming it in `connector_product_ids`.
5335
+ * changed one, tied to the provider's ids. Nothing else is edited or
5336
+ * removed, except that `options.archived: 'archive'` archives the catalog
5337
+ * product of every item the provider no longer offers (by default it is
5338
+ * left as it is). Nothing is written to the provider. A failed item is
5339
+ * reported with its reason and can be retried by naming it in
5340
+ * `connector_product_ids`.
5314
5341
  * `POST /products/import/apply`
5315
5342
  */
5316
5343
  async importApply(request, profileId, options) {
@@ -5367,6 +5394,53 @@ var Products = class {
5367
5394
  ...this.scoped(profileId, options)
5368
5395
  });
5369
5396
  }
5397
+ // --- provider lifecycle -----------------------------------------
5398
+ /**
5399
+ * The shop's connected accounts the catalog works with, and what each can
5400
+ * do: read, create, push, and how a delete can clean up there.
5401
+ * `GET /products/provider-accounts`
5402
+ */
5403
+ async providerAccounts(profileId, options) {
5404
+ return this.request("GET", "/products/provider-accounts", {
5405
+ ...this.scoped(profileId, options)
5406
+ });
5407
+ }
5408
+ /**
5409
+ * Provider clean-ups still to be carried out: deletes whose action at a
5410
+ * provider failed, or was recorded and never reached.
5411
+ * `GET /products/provider-cleanups`
5412
+ */
5413
+ async providerCleanups(profileId, options) {
5414
+ return this.request("GET", "/products/provider-cleanups", {
5415
+ ...this.scoped(profileId, options)
5416
+ });
5417
+ }
5418
+ /**
5419
+ * Create the product at a connected account it is not at yet. Without
5420
+ * `confirmed` nothing is written and the answer holds the plan to review;
5421
+ * send the plan's `fingerprint` back as `confirmed` to carry it out. When
5422
+ * the plan changed since, nothing is written and the answer carries
5423
+ * `confirmation_outdated: true` with the current plan.
5424
+ * `POST /products/{product_id}/provider-sync/create`
5425
+ */
5426
+ async providerCreate(productId, request, profileId, options) {
5427
+ return this.request("POST", `/products/${encodeURIComponent(productId)}/provider-sync/create`, {
5428
+ body: request,
5429
+ ...this.scoped(profileId, options)
5430
+ });
5431
+ }
5432
+ /**
5433
+ * Archive the product at one connected account, or retry a clean-up that
5434
+ * failed after the product was deleted. Existing subscriptions there keep
5435
+ * billing; the catalog is not changed.
5436
+ * `POST /products/{product_id}/provider-archive`
5437
+ */
5438
+ async providerArchive(productId, request, profileId, options) {
5439
+ return this.request("POST", `/products/${encodeURIComponent(productId)}/provider-archive`, {
5440
+ body: request,
5441
+ ...this.scoped(profileId, options)
5442
+ });
5443
+ }
5370
5444
  };
5371
5445
 
5372
5446
  // src/resources/processorCosts.ts
@@ -6262,6 +6336,23 @@ var OperationLimits = class {
6262
6336
  async retrieveSettings(options) {
6263
6337
  return this.request("GET", "/operation-limits/settings", options);
6264
6338
  }
6339
+ /**
6340
+ * The caller's own usage against the limit on one operation: the rule that
6341
+ * applies to them, what they have used in the current window and what
6342
+ * remains.
6343
+ *
6344
+ * Refund usage needs merchant-wide refund read and is refused to a role
6345
+ * restricted to some connectors: the totals span every shop and connector,
6346
+ * as the budget does. Settlement usage needs merchant settlement read.
6347
+ *
6348
+ * `GET /operation-limits/usage`
6349
+ */
6350
+ async retrieveUsage(params, options) {
6351
+ return this.request("GET", "/operation-limits/usage", {
6352
+ query: { operation: params.operation },
6353
+ ...options
6354
+ });
6355
+ }
6265
6356
  /**
6266
6357
  * Update the enforcement settings. Only provided fields change.
6267
6358
  *
@@ -6299,7 +6390,10 @@ var OperationLimits = class {
6299
6390
  *
6300
6391
  * Refused for the user who requested it, and for an approver whose own
6301
6392
  * limit would not have covered the operation — the permission is necessary
6302
- * and not sufficient.
6393
+ * and not sufficient. The requester stays refused while signed in as
6394
+ * another team member: that is a `DE_12` error (`approval_decision_refused`)
6395
+ * whose `data.reason` is `requester_acting_as_another_member`, and
6396
+ * {@link reject} refuses the same way.
6303
6397
  *
6304
6398
  * Approval and execution are two facts. A request that was approved but
6305
6399
  * whose operation then failed comes back `approved` with `execution_error`
@@ -9849,19 +9943,26 @@ var CheckoutSession = class {
9849
9943
  * is what a recorder should do: every ordinary slice compresses, and the last
9850
9944
  * one is sent the way that actually arrives.
9851
9945
  *
9946
+ * For a precompressed event array, pass `compressed_events` and `gzipBody`.
9947
+ * The latter receives the complete JSON request (including the session's
9948
+ * client secret) and must return gzip bytes synchronously. Fetch then starts
9949
+ * before this method yields, including on a page-navigation slice. A
9950
+ * keepalive request is used only when that prepared body is at most 60 KiB.
9951
+ *
9852
9952
  * `POST /payments/{paymentId}/replay/slice` (publishable key)
9853
9953
  */
9854
9954
  async storeReplaySlice(params, options) {
9855
- const { keepalive, compress, ...extras } = options ?? {};
9955
+ const { keepalive, compress, gzipBody, ...extras } = options ?? {};
9856
9956
  const body = { ...params, client_secret: this.requireClientSecret() };
9857
9957
  const headers = this.pkHeaders(extras.headers);
9858
- const gzipped = compress === true && keepalive !== true ? await gzipJson(body) : null;
9958
+ const encoded = gzipBody?.(new TextEncoder().encode(JSON.stringify(body)));
9959
+ const gzipped = encoded ? Uint8Array.from(encoded).buffer : compress === true && keepalive !== true ? await gzipJson(body) : null;
9859
9960
  return this.client.request(
9860
9961
  "POST",
9861
9962
  `/payments/${encodeURIComponent(this.paymentId)}/replay/slice`,
9862
9963
  {
9863
9964
  body: gzipped ?? body,
9864
- ...keepalive !== void 0 ? { keepalive } : {},
9965
+ ...keepalive !== void 0 ? { keepalive: encoded ? keepalive && encoded.byteLength <= 60 * 1024 : keepalive } : {},
9865
9966
  ...extras,
9866
9967
  // `Content-Type` has to be stated for the compressed body: the client
9867
9968
  // only sets it for a body it serialises itself, and the bytes are
@@ -10062,6 +10163,27 @@ var CheckoutSession = class {
10062
10163
  headers: this.bearerHeaders(options?.headers)
10063
10164
  });
10064
10165
  }
10166
+ /**
10167
+ * Make the buyer's add-on choice while the checkout data answers
10168
+ * `type: 'addon_choice'`.
10169
+ *
10170
+ * Only price ids and quantities are sent; the router prices them from the
10171
+ * catalog and judges every selection group's bounds. The payment's lines and
10172
+ * amount change together, once: the choice is final afterwards, the same
10173
+ * choice sent again answers the same result, and another is refused with
10174
+ * `IR_16` — as is a choice once anything could have been charged at the
10175
+ * previous amount. Fetch the checkout data again afterwards for the payment
10176
+ * methods at the final amount.
10177
+ *
10178
+ * `POST /payment-link/{merchantId}/{paymentId}/addons`
10179
+ */
10180
+ async chooseAddons(params, options) {
10181
+ return this.client.request("POST", `${this.linkBase}/addons`, {
10182
+ body: params,
10183
+ ...options,
10184
+ headers: this.bearerHeaders(options?.headers)
10185
+ });
10186
+ }
10065
10187
  /**
10066
10188
  * Ask whether NomuPay's COPYandPAY widget may submit a card, from the
10067
10189
  * form's pre-submit hook.
@@ -10816,4 +10938,4 @@ export {
10816
10938
  decodeNativePanes,
10817
10939
  encodeNativePanes
10818
10940
  };
10819
- //# sourceMappingURL=chunk-FRMLBRHG.js.map
10941
+ //# sourceMappingURL=chunk-7M6HDH2Q.js.map