@whop/sdk 0.0.37 → 0.0.38

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.
Files changed (74) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/client.d.mts +16 -3
  3. package/client.d.mts.map +1 -1
  4. package/client.d.ts +16 -3
  5. package/client.d.ts.map +1 -1
  6. package/client.js +7 -1
  7. package/client.js.map +1 -1
  8. package/client.mjs +7 -1
  9. package/client.mjs.map +1 -1
  10. package/lib/verify-user-token.d.mts +1 -0
  11. package/lib/verify-user-token.d.mts.map +1 -1
  12. package/lib/verify-user-token.d.ts +1 -0
  13. package/lib/verify-user-token.d.ts.map +1 -1
  14. package/lib/verify-user-token.js +39 -13
  15. package/lib/verify-user-token.js.map +1 -1
  16. package/lib/verify-user-token.mjs +40 -14
  17. package/lib/verify-user-token.mjs.map +1 -1
  18. package/package.json +1 -1
  19. package/resources/checkout-configurations.d.mts +20 -0
  20. package/resources/checkout-configurations.d.mts.map +1 -1
  21. package/resources/checkout-configurations.d.ts +20 -0
  22. package/resources/checkout-configurations.d.ts.map +1 -1
  23. package/resources/forums.d.mts +5 -0
  24. package/resources/forums.d.mts.map +1 -1
  25. package/resources/forums.d.ts +5 -0
  26. package/resources/forums.d.ts.map +1 -1
  27. package/resources/index.d.mts +1 -1
  28. package/resources/index.d.mts.map +1 -1
  29. package/resources/index.d.ts +1 -1
  30. package/resources/index.d.ts.map +1 -1
  31. package/resources/index.js.map +1 -1
  32. package/resources/index.mjs.map +1 -1
  33. package/resources/invoices.d.mts +23 -7
  34. package/resources/invoices.d.mts.map +1 -1
  35. package/resources/invoices.d.ts +23 -7
  36. package/resources/invoices.d.ts.map +1 -1
  37. package/resources/payments.d.mts +5 -1
  38. package/resources/payments.d.mts.map +1 -1
  39. package/resources/payments.d.ts +5 -1
  40. package/resources/payments.d.ts.map +1 -1
  41. package/resources/plans.d.mts +1 -1
  42. package/resources/plans.d.ts +1 -1
  43. package/resources/shared.d.mts +10 -1
  44. package/resources/shared.d.mts.map +1 -1
  45. package/resources/shared.d.ts +10 -1
  46. package/resources/shared.d.ts.map +1 -1
  47. package/resources/users.d.mts +77 -34
  48. package/resources/users.d.mts.map +1 -1
  49. package/resources/users.d.ts +77 -34
  50. package/resources/users.d.ts.map +1 -1
  51. package/resources/users.js +42 -12
  52. package/resources/users.js.map +1 -1
  53. package/resources/users.mjs +42 -12
  54. package/resources/users.mjs.map +1 -1
  55. package/resources/verifications.d.mts +1 -1
  56. package/resources/verifications.d.mts.map +1 -1
  57. package/resources/verifications.d.ts +1 -1
  58. package/resources/verifications.d.ts.map +1 -1
  59. package/src/client.ts +27 -2
  60. package/src/lib/verify-user-token.ts +49 -16
  61. package/src/resources/checkout-configurations.ts +24 -0
  62. package/src/resources/forums.ts +6 -0
  63. package/src/resources/index.ts +2 -1
  64. package/src/resources/invoices.ts +26 -7
  65. package/src/resources/payments.ts +9 -0
  66. package/src/resources/plans.ts +1 -1
  67. package/src/resources/shared.ts +12 -1
  68. package/src/resources/users.ts +95 -44
  69. package/src/resources/verifications.ts +2 -1
  70. package/src/version.ts +1 -1
  71. package/version.d.mts +1 -1
  72. package/version.d.ts +1 -1
  73. package/version.js +1 -1
  74. package/version.mjs +1 -1
@@ -339,9 +339,9 @@ export declare namespace InvoiceCreateParams {
339
339
  product: CreateInvoiceInputWithProduct.Product;
340
340
 
341
341
  /**
342
- * The date and time when the invoice will be automatically finalized and charged.
343
- * Only valid when collection_method is charge_automatically. If not provided, the
344
- * charge will be processed immediately.
342
+ * The date and time when the invoice will be automatically finalized. For
343
+ * charge_automatically, triggers an automatic charge. For send_invoice, sends the
344
+ * invoice email to the customer at the specified time.
345
345
  */
346
346
  automatically_finalizes_at?: string | null;
347
347
 
@@ -409,6 +409,12 @@ export declare namespace InvoiceCreateParams {
409
409
  * customer and due date requirements.
410
410
  */
411
411
  save_as_draft?: boolean | null;
412
+
413
+ /**
414
+ * The date that defines when the subscription billing cycle should start. When set
415
+ * on a renewal plan invoice, this anchors all future billing periods to this date.
416
+ */
417
+ subscription_billing_anchor_at?: string | null;
412
418
  }
413
419
 
414
420
  export namespace CreateInvoiceInputWithProduct {
@@ -679,9 +685,9 @@ export declare namespace InvoiceCreateParams {
679
685
  product_id: string;
680
686
 
681
687
  /**
682
- * The date and time when the invoice will be automatically finalized and charged.
683
- * Only valid when collection_method is charge_automatically. If not provided, the
684
- * charge will be processed immediately.
688
+ * The date and time when the invoice will be automatically finalized. For
689
+ * charge_automatically, triggers an automatic charge. For send_invoice, sends the
690
+ * invoice email to the customer at the specified time.
685
691
  */
686
692
  automatically_finalizes_at?: string | null;
687
693
 
@@ -749,6 +755,12 @@ export declare namespace InvoiceCreateParams {
749
755
  * customer and due date requirements.
750
756
  */
751
757
  save_as_draft?: boolean | null;
758
+
759
+ /**
760
+ * The date that defines when the subscription billing cycle should start. When set
761
+ * on a renewal plan invoice, this anchors all future billing periods to this date.
762
+ */
763
+ subscription_billing_anchor_at?: string | null;
752
764
  }
753
765
 
754
766
  export namespace CreateInvoiceInputWithProductID {
@@ -982,7 +994,9 @@ export declare namespace InvoiceCreateParams {
982
994
 
983
995
  export interface InvoiceUpdateParams {
984
996
  /**
985
- * The date and time when the invoice will be automatically finalized and charged.
997
+ * The date and time when the invoice will be automatically finalized. For
998
+ * charge_automatically, triggers an automatic charge. For send_invoice, sends the
999
+ * invoice email at the specified time.
986
1000
  */
987
1001
  automatically_finalizes_at?: string | null;
988
1002
 
@@ -1040,6 +1054,11 @@ export interface InvoiceUpdateParams {
1040
1054
  * Updated plan attributes.
1041
1055
  */
1042
1056
  plan?: InvoiceUpdateParams.Plan | null;
1057
+
1058
+ /**
1059
+ * The date that defines when the subscription billing cycle should start.
1060
+ */
1061
+ subscription_billing_anchor_at?: string | null;
1043
1062
  }
1044
1063
 
1045
1064
  export namespace InvoiceUpdateParams {
@@ -290,6 +290,7 @@ export type PaymentMethodTypes =
290
290
  | 'amazon_pay'
291
291
  | 'apple'
292
292
  | 'apple_pay'
293
+ | 'au_bank_transfer'
293
294
  | 'au_becs_debit'
294
295
  | 'bacs_debit'
295
296
  | 'bancolombia'
@@ -311,6 +312,7 @@ export type PaymentMethodTypes =
311
312
  | 'eps'
312
313
  | 'eu_bank_transfer'
313
314
  | 'fpx'
315
+ | 'gb_bank_transfer'
314
316
  | 'giropay'
315
317
  | 'google_pay'
316
318
  | 'gopay'
@@ -326,6 +328,7 @@ export type PaymentMethodTypes =
326
328
  | 'kriya'
327
329
  | 'link'
328
330
  | 'mb_way'
331
+ | 'm_pesa'
329
332
  | 'mercado_pago'
330
333
  | 'mobilepay'
331
334
  | 'mondu'
@@ -373,6 +376,7 @@ export type PaymentMethodTypes =
373
376
  | 'twint'
374
377
  | 'upi'
375
378
  | 'us_bank_account'
379
+ | 'us_bank_transfer'
376
380
  | 'venmo'
377
381
  | 'vipps'
378
382
  | 'wechat_pay'
@@ -784,6 +788,11 @@ export namespace PaymentListResponse {
784
788
  * The unique identifier for the plan.
785
789
  */
786
790
  id: string;
791
+
792
+ /**
793
+ * A personal description or notes section for the business.
794
+ */
795
+ internal_notes: string | null;
787
796
  }
788
797
 
789
798
  /**
@@ -170,7 +170,7 @@ export interface PlanListResponse {
170
170
  currency: Shared.Currency;
171
171
 
172
172
  /**
173
- * A text description of the plan visible to customers. Maximum 500 characters.
173
+ * A text description of the plan visible to customers. Maximum 1000 characters.
174
174
  * Null if no description is set.
175
175
  */
176
176
  description: string | null;
@@ -461,6 +461,12 @@ export interface CheckoutConfiguration {
461
461
  */
462
462
  affiliate_code: string | null;
463
463
 
464
+ /**
465
+ * Whether the checkout configuration allows promo codes. When false, the promo
466
+ * code input is hidden and promo codes are rejected.
467
+ */
468
+ allow_promo_codes: boolean;
469
+
464
470
  /**
465
471
  * The ID of the company to use for the checkout configuration
466
472
  */
@@ -2818,6 +2824,11 @@ export namespace Payment {
2818
2824
  * The unique identifier for the plan.
2819
2825
  */
2820
2826
  id: string;
2827
+
2828
+ /**
2829
+ * A personal description or notes section for the business.
2830
+ */
2831
+ internal_notes: string | null;
2821
2832
  }
2822
2833
 
2823
2834
  /**
@@ -3007,7 +3018,7 @@ export interface Plan {
3007
3018
  custom_fields: Array<Plan.CustomField>;
3008
3019
 
3009
3020
  /**
3010
- * A text description of the plan visible to customers. Maximum 500 characters.
3021
+ * A text description of the plan visible to customers. Maximum 1000 characters.
3011
3022
  * Null if no description is set.
3012
3023
  */
3013
3024
  description: string | null;
@@ -13,14 +13,55 @@ import { path } from '../internal/utils/path';
13
13
  export class Users extends APIResource {
14
14
  /**
15
15
  * Retrieves the details of an existing user.
16
+ *
17
+ * @example
18
+ * ```ts
19
+ * const user = await client.users.retrieve(
20
+ * 'user_xxxxxxxxxxxxx',
21
+ * );
22
+ * ```
16
23
  */
17
- retrieve(id: string, options?: RequestOptions): APIPromise<User> {
18
- return this._client.get(path`/users/${id}`, options);
24
+ retrieve(
25
+ id: string,
26
+ query: UserRetrieveParams | null | undefined = {},
27
+ options?: RequestOptions,
28
+ ): APIPromise<User> {
29
+ return this._client.get(path`/users/${id}`, { query, ...options });
30
+ }
31
+
32
+ /**
33
+ * Update a user's profile by their ID.
34
+ *
35
+ * Required permissions:
36
+ *
37
+ * - `user:profile:update`
38
+ *
39
+ * @example
40
+ * ```ts
41
+ * const user = await client.users.update(
42
+ * 'user_xxxxxxxxxxxxx',
43
+ * );
44
+ * ```
45
+ */
46
+ update(
47
+ id: string,
48
+ body: UserUpdateParams | null | undefined = {},
49
+ options?: RequestOptions,
50
+ ): APIPromise<User> {
51
+ return this._client.patch(path`/users/${id}`, { body, ...options });
19
52
  }
20
53
 
21
54
  /**
22
55
  * Search for users by name or username, ranked by social proximity to the
23
56
  * authenticated user.
57
+ *
58
+ * @example
59
+ * ```ts
60
+ * // Automatically fetches more pages as needed.
61
+ * for await (const userListResponse of client.users.list()) {
62
+ * // ...
63
+ * }
64
+ * ```
24
65
  */
25
66
  list(
26
67
  query: UserListParams | null | undefined = {},
@@ -32,6 +73,14 @@ export class Users extends APIResource {
32
73
  /**
33
74
  * Check whether a user has access to a specific resource, and return their access
34
75
  * level.
76
+ *
77
+ * @example
78
+ * ```ts
79
+ * const response = await client.users.checkAccess(
80
+ * 'resource_id',
81
+ * { id: 'user_xxxxxxxxxxxxx' },
82
+ * );
83
+ * ```
35
84
  */
36
85
  checkAccess(
37
86
  resourceID: string,
@@ -41,20 +90,6 @@ export class Users extends APIResource {
41
90
  const { id } = params;
42
91
  return this._client.get(path`/users/${id}/access/${resourceID}`, options);
43
92
  }
44
-
45
- /**
46
- * Update the currently authenticated user's profile.
47
- *
48
- * Required permissions:
49
- *
50
- * - `user:profile:update`
51
- */
52
- updateProfile(
53
- body: UserUpdateProfileParams | null | undefined = {},
54
- options?: RequestOptions,
55
- ): APIPromise<User> {
56
- return this._client.patch('/users/me', { body, ...options });
57
- }
58
93
  }
59
94
 
60
95
  export type UserListResponsesCursorPage = CursorPage<UserListResponse>;
@@ -176,40 +211,26 @@ export interface UserCheckAccessResponse {
176
211
  has_access: boolean;
177
212
  }
178
213
 
179
- export interface UserListParams extends CursorPageParams {
180
- /**
181
- * Returns the elements in the list that come before the specified cursor.
182
- */
183
- before?: string | null;
184
-
185
- /**
186
- * Returns the first _n_ elements from the list.
187
- */
188
- first?: number | null;
189
-
214
+ export interface UserRetrieveParams {
190
215
  /**
191
- * Returns the last _n_ elements from the list.
216
+ * When provided, returns the user's company-specific profile overrides (name,
217
+ * profile picture) instead of their global profile.
192
218
  */
193
- last?: number | null;
194
-
195
- /**
196
- * Search term to filter by name or username.
197
- */
198
- query?: string | null;
219
+ company_id?: string | null;
199
220
  }
200
221
 
201
- export interface UserCheckAccessParams {
222
+ export interface UserUpdateParams {
202
223
  /**
203
- * The unique identifier or username of the user.
224
+ * A short biography displayed on the user's public profile.
204
225
  */
205
- id: string;
206
- }
226
+ bio?: string | null;
207
227
 
208
- export interface UserUpdateProfileParams {
209
228
  /**
210
- * A short biography displayed on the user's public profile.
229
+ * When provided, updates the user's profile overrides for this company instead of
230
+ * the global profile. Pass name and profile_picture to set overrides, or null to
231
+ * clear them.
211
232
  */
212
- bio?: string | null;
233
+ company_id?: string | null;
213
234
 
214
235
  /**
215
236
  * The user's display name shown on their public profile. Maximum 100 characters.
@@ -219,7 +240,7 @@ export interface UserUpdateProfileParams {
219
240
  /**
220
241
  * The user's profile picture image attachment.
221
242
  */
222
- profile_picture?: UserUpdateProfileParams.ProfilePicture | null;
243
+ profile_picture?: UserUpdateParams.ProfilePicture | null;
223
244
 
224
245
  /**
225
246
  * The user's unique username. Alphanumeric characters and hyphens only. Maximum 42
@@ -228,7 +249,7 @@ export interface UserUpdateProfileParams {
228
249
  username?: string | null;
229
250
  }
230
251
 
231
- export namespace UserUpdateProfileParams {
252
+ export namespace UserUpdateParams {
232
253
  /**
233
254
  * The user's profile picture image attachment.
234
255
  */
@@ -240,14 +261,44 @@ export namespace UserUpdateProfileParams {
240
261
  }
241
262
  }
242
263
 
264
+ export interface UserListParams extends CursorPageParams {
265
+ /**
266
+ * Returns the elements in the list that come before the specified cursor.
267
+ */
268
+ before?: string | null;
269
+
270
+ /**
271
+ * Returns the first _n_ elements from the list.
272
+ */
273
+ first?: number | null;
274
+
275
+ /**
276
+ * Returns the last _n_ elements from the list.
277
+ */
278
+ last?: number | null;
279
+
280
+ /**
281
+ * Search term to filter by name or username.
282
+ */
283
+ query?: string | null;
284
+ }
285
+
286
+ export interface UserCheckAccessParams {
287
+ /**
288
+ * The unique identifier or username of the user.
289
+ */
290
+ id: string;
291
+ }
292
+
243
293
  export declare namespace Users {
244
294
  export {
245
295
  type User as User,
246
296
  type UserListResponse as UserListResponse,
247
297
  type UserCheckAccessResponse as UserCheckAccessResponse,
248
298
  type UserListResponsesCursorPage as UserListResponsesCursorPage,
299
+ type UserRetrieveParams as UserRetrieveParams,
300
+ type UserUpdateParams as UserUpdateParams,
249
301
  type UserListParams as UserListParams,
250
302
  type UserCheckAccessParams as UserCheckAccessParams,
251
- type UserUpdateProfileParams as UserUpdateProfileParams,
252
303
  };
253
304
  }
@@ -82,7 +82,8 @@ export type VerificationStatus =
82
82
  | 'resubmission_requested'
83
83
  | 'expired'
84
84
  | 'abandoned'
85
- | 'review';
85
+ | 'review'
86
+ | 'action_required';
86
87
 
87
88
  /**
88
89
  * An identity verification session used to confirm a person or entity's identity
package/src/version.ts CHANGED
@@ -1 +1 @@
1
- export const VERSION = '0.0.37'; // x-release-please-version
1
+ export const VERSION = '0.0.38'; // x-release-please-version
package/version.d.mts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "0.0.37";
1
+ export declare const VERSION = "0.0.38";
2
2
  //# sourceMappingURL=version.d.mts.map
package/version.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "0.0.37";
1
+ export declare const VERSION = "0.0.38";
2
2
  //# sourceMappingURL=version.d.ts.map
package/version.js CHANGED
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.VERSION = void 0;
4
- exports.VERSION = '0.0.37'; // x-release-please-version
4
+ exports.VERSION = '0.0.38'; // x-release-please-version
5
5
  //# sourceMappingURL=version.js.map
package/version.mjs CHANGED
@@ -1,2 +1,2 @@
1
- export const VERSION = '0.0.37'; // x-release-please-version
1
+ export const VERSION = '0.0.38'; // x-release-please-version
2
2
  //# sourceMappingURL=version.mjs.map