@delopay/sdk 0.52.0 → 0.54.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.
@@ -450,10 +450,17 @@ var Customers = class {
450
450
  return this.request("DELETE", `/customers/${encodeURIComponent(customerId)}`);
451
451
  }
452
452
  /**
453
- * List customers, optionally filtered by email.
453
+ * List customers, optionally filtered by email, shop (`profile_id`), or
454
+ * project (`project_id`).
454
455
  *
455
456
  * @param params - Optional filter and pagination parameters.
456
457
  * @returns Array of customer objects.
458
+ *
459
+ * @example
460
+ * ```typescript
461
+ * // Customers who have transacted in a specific shop.
462
+ * const customers = await delopay.customers.list({ profile_id: 'pro_abc123' });
463
+ * ```
457
464
  */
458
465
  async list(params) {
459
466
  return this.request("GET", "/customers/list", {
@@ -461,12 +468,38 @@ var Customers = class {
461
468
  });
462
469
  }
463
470
  // --- OLAP extensions (Task 4.6) ---
464
- /** List customers with count. `GET /customers/list-with-count` */
471
+ /**
472
+ * List customers with count. Supports the same `profile_id` / `project_id`
473
+ * shop filters as {@link list}. `GET /customers/list-with-count`
474
+ */
465
475
  async listWithCount(params) {
466
476
  return this.request("GET", "/customers/list-with-count", {
467
477
  query: params
468
478
  });
469
479
  }
480
+ /**
481
+ * List customers scoped to the authenticated dashboard user's shop
482
+ * (business profile). The JWT auto-scopes to its own `profile`; an explicit
483
+ * `profile_id` / `project_id` outside that scope is rejected with
484
+ * `AccessForbidden`. `GET /customers/profile/list`
485
+ *
486
+ * @param params - Optional filter and pagination parameters.
487
+ * @returns Array of customer objects.
488
+ */
489
+ async listByProfile(params) {
490
+ return this.request("GET", "/customers/profile/list", {
491
+ query: params
492
+ });
493
+ }
494
+ /**
495
+ * Profile-scoped variant of {@link listWithCount}.
496
+ * `GET /customers/profile/list-with-count`
497
+ */
498
+ async listByProfileWithCount(params) {
499
+ return this.request("GET", "/customers/profile/list-with-count", {
500
+ query: params
501
+ });
502
+ }
470
503
  /** List mandates for a customer. `GET /customers/{customerId}/mandates` */
471
504
  async listMandates(customerId) {
472
505
  return this.request("GET", `/customers/${encodeURIComponent(customerId)}/mandates`);
@@ -1085,11 +1118,7 @@ var Payments = class {
1085
1118
  * ```
1086
1119
  */
1087
1120
  async listAttempts(paymentId, options) {
1088
- return this.request(
1089
- "GET",
1090
- `/payments/${encodeURIComponent(paymentId)}/attempts`,
1091
- options
1092
- );
1121
+ return this.request("GET", `/payments/${encodeURIComponent(paymentId)}/attempts`, options);
1093
1122
  }
1094
1123
  /**
1095
1124
  * Update an existing payment intent before it is confirmed.
@@ -2246,8 +2275,21 @@ var Users = class {
2246
2275
  async verifyPhoneOtp(params) {
2247
2276
  return this.request("POST", "/user/phone/verify-otp", { body: params });
2248
2277
  }
2249
- async listRoles() {
2250
- return this.request("GET", "/user/role/list");
2278
+ /**
2279
+ * List all roles visible to the caller (predefined + custom).
2280
+ *
2281
+ * `GET /user/role/list`. With `groups: true` the response is the
2282
+ * parent-groups shape: `[{role_id, role_name, entity_type, role_scope,
2283
+ * parent_groups: [{name, description, scopes}]}]`; without it, the
2284
+ * deprecated flat `groups` shape.
2285
+ */
2286
+ async listRoles(params) {
2287
+ if (params === void 0) {
2288
+ return this.request("GET", "/user/role/list");
2289
+ }
2290
+ return this.request("GET", "/user/role/list", {
2291
+ query: { groups: params.groups, entity_type: params.entity_type }
2292
+ });
2251
2293
  }
2252
2294
  async listUserRoles(params) {
2253
2295
  return this.request("POST", "/user/employees", { body: params });
@@ -2371,6 +2413,15 @@ var Users = class {
2371
2413
  async updateRole(roleId, params) {
2372
2414
  return this.request("PUT", `/user/role/${encodeURIComponent(roleId)}`, { body: params });
2373
2415
  }
2416
+ /**
2417
+ * Delete a custom role. Predefined roles and roles still assigned to
2418
+ * team members are rejected by the backend with a 400.
2419
+ *
2420
+ * `DELETE /user/role/{roleId}`
2421
+ */
2422
+ async deleteRole(roleId) {
2423
+ return this.request("DELETE", `/user/role/${encodeURIComponent(roleId)}`);
2424
+ }
2374
2425
  };
2375
2426
 
2376
2427
  // src/resources/verification.ts
@@ -4055,4 +4106,4 @@ export {
4055
4106
  applyBrandingVariables,
4056
4107
  shadowFor
4057
4108
  };
4058
- //# sourceMappingURL=chunk-7EHSQIPR.js.map
4109
+ //# sourceMappingURL=chunk-G2TIZ4KS.js.map