@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.
package/dist/index.cjs CHANGED
@@ -525,10 +525,17 @@ var Customers = class {
525
525
  return this.request("DELETE", `/customers/${encodeURIComponent(customerId)}`);
526
526
  }
527
527
  /**
528
- * List customers, optionally filtered by email.
528
+ * List customers, optionally filtered by email, shop (`profile_id`), or
529
+ * project (`project_id`).
529
530
  *
530
531
  * @param params - Optional filter and pagination parameters.
531
532
  * @returns Array of customer objects.
533
+ *
534
+ * @example
535
+ * ```typescript
536
+ * // Customers who have transacted in a specific shop.
537
+ * const customers = await delopay.customers.list({ profile_id: 'pro_abc123' });
538
+ * ```
532
539
  */
533
540
  async list(params) {
534
541
  return this.request("GET", "/customers/list", {
@@ -536,12 +543,38 @@ var Customers = class {
536
543
  });
537
544
  }
538
545
  // --- OLAP extensions (Task 4.6) ---
539
- /** List customers with count. `GET /customers/list-with-count` */
546
+ /**
547
+ * List customers with count. Supports the same `profile_id` / `project_id`
548
+ * shop filters as {@link list}. `GET /customers/list-with-count`
549
+ */
540
550
  async listWithCount(params) {
541
551
  return this.request("GET", "/customers/list-with-count", {
542
552
  query: params
543
553
  });
544
554
  }
555
+ /**
556
+ * List customers scoped to the authenticated dashboard user's shop
557
+ * (business profile). The JWT auto-scopes to its own `profile`; an explicit
558
+ * `profile_id` / `project_id` outside that scope is rejected with
559
+ * `AccessForbidden`. `GET /customers/profile/list`
560
+ *
561
+ * @param params - Optional filter and pagination parameters.
562
+ * @returns Array of customer objects.
563
+ */
564
+ async listByProfile(params) {
565
+ return this.request("GET", "/customers/profile/list", {
566
+ query: params
567
+ });
568
+ }
569
+ /**
570
+ * Profile-scoped variant of {@link listWithCount}.
571
+ * `GET /customers/profile/list-with-count`
572
+ */
573
+ async listByProfileWithCount(params) {
574
+ return this.request("GET", "/customers/profile/list-with-count", {
575
+ query: params
576
+ });
577
+ }
545
578
  /** List mandates for a customer. `GET /customers/{customerId}/mandates` */
546
579
  async listMandates(customerId) {
547
580
  return this.request("GET", `/customers/${encodeURIComponent(customerId)}/mandates`);
@@ -1160,11 +1193,7 @@ var Payments = class {
1160
1193
  * ```
1161
1194
  */
1162
1195
  async listAttempts(paymentId, options) {
1163
- return this.request(
1164
- "GET",
1165
- `/payments/${encodeURIComponent(paymentId)}/attempts`,
1166
- options
1167
- );
1196
+ return this.request("GET", `/payments/${encodeURIComponent(paymentId)}/attempts`, options);
1168
1197
  }
1169
1198
  /**
1170
1199
  * Update an existing payment intent before it is confirmed.
@@ -2321,8 +2350,21 @@ var Users = class {
2321
2350
  async verifyPhoneOtp(params) {
2322
2351
  return this.request("POST", "/user/phone/verify-otp", { body: params });
2323
2352
  }
2324
- async listRoles() {
2325
- return this.request("GET", "/user/role/list");
2353
+ /**
2354
+ * List all roles visible to the caller (predefined + custom).
2355
+ *
2356
+ * `GET /user/role/list`. With `groups: true` the response is the
2357
+ * parent-groups shape: `[{role_id, role_name, entity_type, role_scope,
2358
+ * parent_groups: [{name, description, scopes}]}]`; without it, the
2359
+ * deprecated flat `groups` shape.
2360
+ */
2361
+ async listRoles(params) {
2362
+ if (params === void 0) {
2363
+ return this.request("GET", "/user/role/list");
2364
+ }
2365
+ return this.request("GET", "/user/role/list", {
2366
+ query: { groups: params.groups, entity_type: params.entity_type }
2367
+ });
2326
2368
  }
2327
2369
  async listUserRoles(params) {
2328
2370
  return this.request("POST", "/user/employees", { body: params });
@@ -2446,6 +2488,15 @@ var Users = class {
2446
2488
  async updateRole(roleId, params) {
2447
2489
  return this.request("PUT", `/user/role/${encodeURIComponent(roleId)}`, { body: params });
2448
2490
  }
2491
+ /**
2492
+ * Delete a custom role. Predefined roles and roles still assigned to
2493
+ * team members are rejected by the backend with a 400.
2494
+ *
2495
+ * `DELETE /user/role/{roleId}`
2496
+ */
2497
+ async deleteRole(roleId) {
2498
+ return this.request("DELETE", `/user/role/${encodeURIComponent(roleId)}`);
2499
+ }
2449
2500
  };
2450
2501
 
2451
2502
  // src/resources/verification.ts