@delopay/sdk 0.52.0 → 0.53.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
  }
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
  }
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-QH5ESES3.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.