@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.d.cts CHANGED
@@ -582,6 +582,17 @@ interface CustomerListParams {
582
582
  limit?: number | null;
583
583
  offset?: number | null;
584
584
  email?: string | null;
585
+ /**
586
+ * Filter customers by the shop (business profile) they have transacted in.
587
+ * Membership is derived from `payment_intent` — a customer who never
588
+ * transacted appears under no shop.
589
+ */
590
+ profile_id?: string | null;
591
+ /**
592
+ * Filter customers by project; expands to all shops (business profiles)
593
+ * under that project.
594
+ */
595
+ project_id?: string | null;
585
596
  }
586
597
  interface PaymentMethodCreateRequest {
587
598
  payment_method: PaymentMethod;
@@ -2910,18 +2921,47 @@ declare class Customers {
2910
2921
  */
2911
2922
  delete(customerId: string): Promise<CustomerResponse>;
2912
2923
  /**
2913
- * List customers, optionally filtered by email.
2924
+ * List customers, optionally filtered by email, shop (`profile_id`), or
2925
+ * project (`project_id`).
2914
2926
  *
2915
2927
  * @param params - Optional filter and pagination parameters.
2916
2928
  * @returns Array of customer objects.
2929
+ *
2930
+ * @example
2931
+ * ```typescript
2932
+ * // Customers who have transacted in a specific shop.
2933
+ * const customers = await delopay.customers.list({ profile_id: 'pro_abc123' });
2934
+ * ```
2917
2935
  */
2918
2936
  list(params?: CustomerListParams): Promise<CustomerResponse[]>;
2919
- /** List customers with count. `GET /customers/list-with-count` */
2937
+ /**
2938
+ * List customers with count. Supports the same `profile_id` / `project_id`
2939
+ * shop filters as {@link list}. `GET /customers/list-with-count`
2940
+ */
2920
2941
  listWithCount(params?: CustomerListParams): Promise<{
2921
2942
  count: number;
2922
2943
  total_count: number;
2923
2944
  data: CustomerResponse[];
2924
2945
  }>;
2946
+ /**
2947
+ * List customers scoped to the authenticated dashboard user's shop
2948
+ * (business profile). The JWT auto-scopes to its own `profile`; an explicit
2949
+ * `profile_id` / `project_id` outside that scope is rejected with
2950
+ * `AccessForbidden`. `GET /customers/profile/list`
2951
+ *
2952
+ * @param params - Optional filter and pagination parameters.
2953
+ * @returns Array of customer objects.
2954
+ */
2955
+ listByProfile(params?: CustomerListParams): Promise<CustomerResponse[]>;
2956
+ /**
2957
+ * Profile-scoped variant of {@link listWithCount}.
2958
+ * `GET /customers/profile/list-with-count`
2959
+ */
2960
+ listByProfileWithCount(params?: CustomerListParams): Promise<{
2961
+ count: number;
2962
+ total_count: number;
2963
+ data: CustomerResponse[];
2964
+ }>;
2925
2965
  /** List mandates for a customer. `GET /customers/{customerId}/mandates` */
2926
2966
  listMandates(customerId: string): Promise<Record<string, unknown>[]>;
2927
2967
  }
@@ -4128,7 +4168,18 @@ declare class Users {
4128
4168
  verifyRecoveryCode(params: Record<string, unknown>): Promise<AuthResponse>;
4129
4169
  sendPhoneOtp(params: PhoneOtpRequest): Promise<PhoneOtpResponse>;
4130
4170
  verifyPhoneOtp(params: PhoneOtpVerifyRequest): Promise<PhoneOtpVerifyResponse>;
4131
- listRoles(): Promise<Record<string, unknown>[]>;
4171
+ /**
4172
+ * List all roles visible to the caller (predefined + custom).
4173
+ *
4174
+ * `GET /user/role/list`. With `groups: true` the response is the
4175
+ * parent-groups shape: `[{role_id, role_name, entity_type, role_scope,
4176
+ * parent_groups: [{name, description, scopes}]}]`; without it, the
4177
+ * deprecated flat `groups` shape.
4178
+ */
4179
+ listRoles(params?: {
4180
+ groups?: boolean;
4181
+ entity_type?: string;
4182
+ }): Promise<Record<string, unknown>[]>;
4132
4183
  listUserRoles(params?: Record<string, unknown>): Promise<Record<string, unknown>[]>;
4133
4184
  updateUserRole(params: Record<string, unknown>): Promise<Record<string, unknown>>;
4134
4185
  deleteUserRole(params: Record<string, unknown>): Promise<Record<string, unknown>>;
@@ -4195,6 +4246,13 @@ declare class Users {
4195
4246
  getRoleById(roleId: string): Promise<Record<string, unknown>>;
4196
4247
  /** Update role by ID. `PUT /user/role/{roleId}` */
4197
4248
  updateRole(roleId: string, params: Record<string, unknown>): Promise<Record<string, unknown>>;
4249
+ /**
4250
+ * Delete a custom role. Predefined roles and roles still assigned to
4251
+ * team members are rejected by the backend with a 400.
4252
+ *
4253
+ * `DELETE /user/role/{roleId}`
4254
+ */
4255
+ deleteRole(roleId: string): Promise<Record<string, unknown>>;
4198
4256
  }
4199
4257
 
4200
4258
  declare class Verification {
package/dist/index.d.ts CHANGED
@@ -582,6 +582,17 @@ interface CustomerListParams {
582
582
  limit?: number | null;
583
583
  offset?: number | null;
584
584
  email?: string | null;
585
+ /**
586
+ * Filter customers by the shop (business profile) they have transacted in.
587
+ * Membership is derived from `payment_intent` — a customer who never
588
+ * transacted appears under no shop.
589
+ */
590
+ profile_id?: string | null;
591
+ /**
592
+ * Filter customers by project; expands to all shops (business profiles)
593
+ * under that project.
594
+ */
595
+ project_id?: string | null;
585
596
  }
586
597
  interface PaymentMethodCreateRequest {
587
598
  payment_method: PaymentMethod;
@@ -2910,18 +2921,47 @@ declare class Customers {
2910
2921
  */
2911
2922
  delete(customerId: string): Promise<CustomerResponse>;
2912
2923
  /**
2913
- * List customers, optionally filtered by email.
2924
+ * List customers, optionally filtered by email, shop (`profile_id`), or
2925
+ * project (`project_id`).
2914
2926
  *
2915
2927
  * @param params - Optional filter and pagination parameters.
2916
2928
  * @returns Array of customer objects.
2929
+ *
2930
+ * @example
2931
+ * ```typescript
2932
+ * // Customers who have transacted in a specific shop.
2933
+ * const customers = await delopay.customers.list({ profile_id: 'pro_abc123' });
2934
+ * ```
2917
2935
  */
2918
2936
  list(params?: CustomerListParams): Promise<CustomerResponse[]>;
2919
- /** List customers with count. `GET /customers/list-with-count` */
2937
+ /**
2938
+ * List customers with count. Supports the same `profile_id` / `project_id`
2939
+ * shop filters as {@link list}. `GET /customers/list-with-count`
2940
+ */
2920
2941
  listWithCount(params?: CustomerListParams): Promise<{
2921
2942
  count: number;
2922
2943
  total_count: number;
2923
2944
  data: CustomerResponse[];
2924
2945
  }>;
2946
+ /**
2947
+ * List customers scoped to the authenticated dashboard user's shop
2948
+ * (business profile). The JWT auto-scopes to its own `profile`; an explicit
2949
+ * `profile_id` / `project_id` outside that scope is rejected with
2950
+ * `AccessForbidden`. `GET /customers/profile/list`
2951
+ *
2952
+ * @param params - Optional filter and pagination parameters.
2953
+ * @returns Array of customer objects.
2954
+ */
2955
+ listByProfile(params?: CustomerListParams): Promise<CustomerResponse[]>;
2956
+ /**
2957
+ * Profile-scoped variant of {@link listWithCount}.
2958
+ * `GET /customers/profile/list-with-count`
2959
+ */
2960
+ listByProfileWithCount(params?: CustomerListParams): Promise<{
2961
+ count: number;
2962
+ total_count: number;
2963
+ data: CustomerResponse[];
2964
+ }>;
2925
2965
  /** List mandates for a customer. `GET /customers/{customerId}/mandates` */
2926
2966
  listMandates(customerId: string): Promise<Record<string, unknown>[]>;
2927
2967
  }
@@ -4128,7 +4168,18 @@ declare class Users {
4128
4168
  verifyRecoveryCode(params: Record<string, unknown>): Promise<AuthResponse>;
4129
4169
  sendPhoneOtp(params: PhoneOtpRequest): Promise<PhoneOtpResponse>;
4130
4170
  verifyPhoneOtp(params: PhoneOtpVerifyRequest): Promise<PhoneOtpVerifyResponse>;
4131
- listRoles(): Promise<Record<string, unknown>[]>;
4171
+ /**
4172
+ * List all roles visible to the caller (predefined + custom).
4173
+ *
4174
+ * `GET /user/role/list`. With `groups: true` the response is the
4175
+ * parent-groups shape: `[{role_id, role_name, entity_type, role_scope,
4176
+ * parent_groups: [{name, description, scopes}]}]`; without it, the
4177
+ * deprecated flat `groups` shape.
4178
+ */
4179
+ listRoles(params?: {
4180
+ groups?: boolean;
4181
+ entity_type?: string;
4182
+ }): Promise<Record<string, unknown>[]>;
4132
4183
  listUserRoles(params?: Record<string, unknown>): Promise<Record<string, unknown>[]>;
4133
4184
  updateUserRole(params: Record<string, unknown>): Promise<Record<string, unknown>>;
4134
4185
  deleteUserRole(params: Record<string, unknown>): Promise<Record<string, unknown>>;
@@ -4195,6 +4246,13 @@ declare class Users {
4195
4246
  getRoleById(roleId: string): Promise<Record<string, unknown>>;
4196
4247
  /** Update role by ID. `PUT /user/role/{roleId}` */
4197
4248
  updateRole(roleId: string, params: Record<string, unknown>): Promise<Record<string, unknown>>;
4249
+ /**
4250
+ * Delete a custom role. Predefined roles and roles still assigned to
4251
+ * team members are rejected by the backend with a 400.
4252
+ *
4253
+ * `DELETE /user/role/{roleId}`
4254
+ */
4255
+ deleteRole(roleId: string): Promise<Record<string, unknown>>;
4198
4256
  }
4199
4257
 
4200
4258
  declare class Verification {
package/dist/index.js CHANGED
@@ -49,7 +49,7 @@ import {
49
49
  shadowFor,
50
50
  surfacePadValue,
51
51
  verticalGapValue
52
- } from "./chunk-7EHSQIPR.js";
52
+ } from "./chunk-G2TIZ4KS.js";
53
53
  export {
54
54
  Analytics,
55
55
  AnalyticsDashboard,
package/dist/internal.cjs CHANGED
@@ -537,10 +537,17 @@ var Customers = class {
537
537
  return this.request("DELETE", `/customers/${encodeURIComponent(customerId)}`);
538
538
  }
539
539
  /**
540
- * List customers, optionally filtered by email.
540
+ * List customers, optionally filtered by email, shop (`profile_id`), or
541
+ * project (`project_id`).
541
542
  *
542
543
  * @param params - Optional filter and pagination parameters.
543
544
  * @returns Array of customer objects.
545
+ *
546
+ * @example
547
+ * ```typescript
548
+ * // Customers who have transacted in a specific shop.
549
+ * const customers = await delopay.customers.list({ profile_id: 'pro_abc123' });
550
+ * ```
544
551
  */
545
552
  async list(params) {
546
553
  return this.request("GET", "/customers/list", {
@@ -548,12 +555,38 @@ var Customers = class {
548
555
  });
549
556
  }
550
557
  // --- OLAP extensions (Task 4.6) ---
551
- /** List customers with count. `GET /customers/list-with-count` */
558
+ /**
559
+ * List customers with count. Supports the same `profile_id` / `project_id`
560
+ * shop filters as {@link list}. `GET /customers/list-with-count`
561
+ */
552
562
  async listWithCount(params) {
553
563
  return this.request("GET", "/customers/list-with-count", {
554
564
  query: params
555
565
  });
556
566
  }
567
+ /**
568
+ * List customers scoped to the authenticated dashboard user's shop
569
+ * (business profile). The JWT auto-scopes to its own `profile`; an explicit
570
+ * `profile_id` / `project_id` outside that scope is rejected with
571
+ * `AccessForbidden`. `GET /customers/profile/list`
572
+ *
573
+ * @param params - Optional filter and pagination parameters.
574
+ * @returns Array of customer objects.
575
+ */
576
+ async listByProfile(params) {
577
+ return this.request("GET", "/customers/profile/list", {
578
+ query: params
579
+ });
580
+ }
581
+ /**
582
+ * Profile-scoped variant of {@link listWithCount}.
583
+ * `GET /customers/profile/list-with-count`
584
+ */
585
+ async listByProfileWithCount(params) {
586
+ return this.request("GET", "/customers/profile/list-with-count", {
587
+ query: params
588
+ });
589
+ }
557
590
  /** List mandates for a customer. `GET /customers/{customerId}/mandates` */
558
591
  async listMandates(customerId) {
559
592
  return this.request("GET", `/customers/${encodeURIComponent(customerId)}/mandates`);
@@ -1172,11 +1205,7 @@ var Payments = class {
1172
1205
  * ```
1173
1206
  */
1174
1207
  async listAttempts(paymentId, options) {
1175
- return this.request(
1176
- "GET",
1177
- `/payments/${encodeURIComponent(paymentId)}/attempts`,
1178
- options
1179
- );
1208
+ return this.request("GET", `/payments/${encodeURIComponent(paymentId)}/attempts`, options);
1180
1209
  }
1181
1210
  /**
1182
1211
  * Update an existing payment intent before it is confirmed.
@@ -2333,8 +2362,21 @@ var Users = class {
2333
2362
  async verifyPhoneOtp(params) {
2334
2363
  return this.request("POST", "/user/phone/verify-otp", { body: params });
2335
2364
  }
2336
- async listRoles() {
2337
- return this.request("GET", "/user/role/list");
2365
+ /**
2366
+ * List all roles visible to the caller (predefined + custom).
2367
+ *
2368
+ * `GET /user/role/list`. With `groups: true` the response is the
2369
+ * parent-groups shape: `[{role_id, role_name, entity_type, role_scope,
2370
+ * parent_groups: [{name, description, scopes}]}]`; without it, the
2371
+ * deprecated flat `groups` shape.
2372
+ */
2373
+ async listRoles(params) {
2374
+ if (params === void 0) {
2375
+ return this.request("GET", "/user/role/list");
2376
+ }
2377
+ return this.request("GET", "/user/role/list", {
2378
+ query: { groups: params.groups, entity_type: params.entity_type }
2379
+ });
2338
2380
  }
2339
2381
  async listUserRoles(params) {
2340
2382
  return this.request("POST", "/user/employees", { body: params });
@@ -2458,6 +2500,15 @@ var Users = class {
2458
2500
  async updateRole(roleId, params) {
2459
2501
  return this.request("PUT", `/user/role/${encodeURIComponent(roleId)}`, { body: params });
2460
2502
  }
2503
+ /**
2504
+ * Delete a custom role. Predefined roles and roles still assigned to
2505
+ * team members are rejected by the backend with a 400.
2506
+ *
2507
+ * `DELETE /user/role/{roleId}`
2508
+ */
2509
+ async deleteRole(roleId) {
2510
+ return this.request("DELETE", `/user/role/${encodeURIComponent(roleId)}`);
2511
+ }
2461
2512
  };
2462
2513
 
2463
2514
  // src/resources/verification.ts