@delopay/sdk 0.177.0 → 0.179.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/index.cjs CHANGED
@@ -1060,8 +1060,8 @@ var Customers = class {
1060
1060
  return this.request("DELETE", `/customers/${encodeURIComponent(customerId)}`);
1061
1061
  }
1062
1062
  /**
1063
- * List customers, optionally filtered by email, shop (`profile_id`), or
1064
- * project (`project_id`).
1063
+ * List customers, optionally filtered by customer id/name/email prefix,
1064
+ * shop (`profile_id`), or project (`project_id`).
1065
1065
  *
1066
1066
  * @param params - Optional filter and pagination parameters.
1067
1067
  * @returns Array of customer objects.
@@ -3972,7 +3972,8 @@ var Users = class {
3972
3972
  return this.request("GET", `/user/preferences/${encodeURIComponent(key)}`);
3973
3973
  }
3974
3974
  /**
3975
- * Atomically replace one own preference (last write wins). The JSON object is
3975
+ * Save one own preference: omitted/false if_absent replaces it (last write wins);
3976
+ * true preserves an existing object and returns the winner. The JSON object is
3976
3977
  * limited to 16 KiB of compact UTF-8 JSON. For layouts, use one namespaced key
3977
3978
  * per page (e.g. merchant.analytics.payments) and ordered widget IDs per region,
3978
3979
  * without titles, fetched metrics or rendered state. Requires a login JWT.
@@ -3980,7 +3981,25 @@ var Users = class {
3980
3981
  async setPreference(key, params) {
3981
3982
  return this.request("PUT", `/user/preferences/${encodeURIComponent(key)}`, { body: params });
3982
3983
  }
3983
- /** Reset an own preference to defaults. Idempotent; returns value null. Login JWT only. */
3984
+ /**
3985
+ * Initialize only a missing preference. Existing objects, including a client
3986
+ * reset marker saved with setPreference (for example { reset: true }), win. Render/cache the returned value, which may differ from
3987
+ * the proposed value. Safe for migration retries after a lost response.
3988
+ * Explicit edits and reset markers use setPreference with no if_absent flag.
3989
+ * DELETE removes the key; it leaves no marker and permits initialization again.
3990
+ * Requires a login JWT and the same key/object limits as setPreference.
3991
+ */
3992
+ async initializePreference(key, value) {
3993
+ return this.request("PUT", `/user/preferences/${encodeURIComponent(key)}`, {
3994
+ body: { value, if_absent: true }
3995
+ });
3996
+ }
3997
+ /**
3998
+ * Remove an own preference. Idempotent; returns value null, without storing a
3999
+ * tombstone. Later initialization may import a value again. To suppress legacy
4000
+ * migration after a reset, save a client reset-marker object with setPreference.
4001
+ * Login JWT only.
4002
+ */
3984
4003
  async deletePreference(key) {
3985
4004
  return this.request("DELETE", `/user/preferences/${encodeURIComponent(key)}`);
3986
4005
  }
@@ -4628,6 +4647,49 @@ var Analytics = class {
4628
4647
  query: params
4629
4648
  });
4630
4649
  }
4650
+ /**
4651
+ * Every analytics exclusion of the merchant, with the payments each one
4652
+ * matched in the lookback window (todos#184).
4653
+ *
4654
+ * These rules change what the merchant's own dashboards count. Financial
4655
+ * records and transaction lists are never filtered by them.
4656
+ *
4657
+ * ⚠️ `matched_payments` **overlaps between rules and must not be summed**:
4658
+ * a payment matched by three rules is counted once by each. The envelope's
4659
+ * `best_effort` and `lookback_days` qualify every row — matching runs on
4660
+ * client signals that may be absent or expired, within that window.
4661
+ * `GET /analytics/exclusions`
4662
+ */
4663
+ async listExclusions() {
4664
+ return this.request("GET", "/analytics/exclusions");
4665
+ }
4666
+ /**
4667
+ * Write a new exclusion. A shop-scoped user must name their own shop in
4668
+ * `profile_id`; omitting it applies the rule to every shop of the merchant.
4669
+ * Omitting `surfaces` means **all five**, not none.
4670
+ * `POST /analytics/exclusions`
4671
+ */
4672
+ async createExclusion(rule) {
4673
+ return this.request("POST", "/analytics/exclusions", { body: rule });
4674
+ }
4675
+ /**
4676
+ * Replace a stored exclusion **completely**. This is not a patch: every
4677
+ * field you leave out reverts to its default rather than keeping its stored
4678
+ * value, so send the whole rule — including an explicit `null` for a
4679
+ * `profile_id`, `value`, `valid_from`, `valid_until` or `note` you mean to
4680
+ * clear, and the full `surfaces` list you mean to keep.
4681
+ * `PUT /analytics/exclusions/{id}`
4682
+ */
4683
+ async updateExclusion(id, rule) {
4684
+ return this.request("PUT", `/analytics/exclusions/${encodeURIComponent(id)}`, { body: rule });
4685
+ }
4686
+ /**
4687
+ * Delete a stored exclusion. Returns the rule as it was, so a caller can
4688
+ * say what it removed. `DELETE /analytics/exclusions/{id}`
4689
+ */
4690
+ async deleteExclusion(id) {
4691
+ return this.request("DELETE", `/analytics/exclusions/${encodeURIComponent(id)}`);
4692
+ }
4631
4693
  /** Global search. `POST /analytics/search` */
4632
4694
  async search(params) {
4633
4695
  return this.request("POST", "/analytics/search", { body: params });