@usehercules/sdk 1.3.0 → 1.5.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.
Files changed (114) hide show
  1. package/CHANGELOG.md +20 -0
  2. package/LICENSE +1 -1
  3. package/package.json +1 -1
  4. package/resources/beta/beta.d.mts +4 -0
  5. package/resources/beta/beta.d.mts.map +1 -1
  6. package/resources/beta/beta.d.ts +4 -0
  7. package/resources/beta/beta.d.ts.map +1 -1
  8. package/resources/beta/beta.js +4 -0
  9. package/resources/beta/beta.js.map +1 -1
  10. package/resources/beta/beta.mjs +4 -0
  11. package/resources/beta/beta.mjs.map +1 -1
  12. package/resources/beta/index.d.mts +1 -0
  13. package/resources/beta/index.d.mts.map +1 -1
  14. package/resources/beta/index.d.ts +1 -0
  15. package/resources/beta/index.d.ts.map +1 -1
  16. package/resources/beta/index.js +3 -1
  17. package/resources/beta/index.js.map +1 -1
  18. package/resources/beta/index.mjs +1 -0
  19. package/resources/beta/index.mjs.map +1 -1
  20. package/resources/beta/pay/coupons.d.mts +1 -1
  21. package/resources/beta/pay/coupons.d.ts +1 -1
  22. package/resources/beta/pay/customers.d.mts +1 -1
  23. package/resources/beta/pay/customers.d.ts +1 -1
  24. package/resources/beta/pay/entitlements.d.mts +4 -22
  25. package/resources/beta/pay/entitlements.d.mts.map +1 -1
  26. package/resources/beta/pay/entitlements.d.ts +4 -22
  27. package/resources/beta/pay/entitlements.d.ts.map +1 -1
  28. package/resources/beta/pay/entitlements.js +3 -4
  29. package/resources/beta/pay/entitlements.js.map +1 -1
  30. package/resources/beta/pay/entitlements.mjs +3 -4
  31. package/resources/beta/pay/entitlements.mjs.map +1 -1
  32. package/resources/beta/pay/pay.d.mts +76 -16
  33. package/resources/beta/pay/pay.d.mts.map +1 -1
  34. package/resources/beta/pay/pay.d.ts +76 -16
  35. package/resources/beta/pay/pay.d.ts.map +1 -1
  36. package/resources/beta/pay/pay.js.map +1 -1
  37. package/resources/beta/pay/pay.mjs.map +1 -1
  38. package/resources/beta/pay/products/entitlements.d.mts +1 -1
  39. package/resources/beta/pay/products/entitlements.d.ts +1 -1
  40. package/resources/beta/pay/products/index.d.mts +1 -0
  41. package/resources/beta/pay/products/index.d.mts.map +1 -1
  42. package/resources/beta/pay/products/index.d.ts +1 -0
  43. package/resources/beta/pay/products/index.d.ts.map +1 -1
  44. package/resources/beta/pay/products/index.js +3 -1
  45. package/resources/beta/pay/products/index.js.map +1 -1
  46. package/resources/beta/pay/products/index.mjs +1 -0
  47. package/resources/beta/pay/products/index.mjs.map +1 -1
  48. package/resources/beta/pay/products/products.d.mts +45 -14
  49. package/resources/beta/pay/products/products.d.mts.map +1 -1
  50. package/resources/beta/pay/products/products.d.ts +45 -14
  51. package/resources/beta/pay/products/products.d.ts.map +1 -1
  52. package/resources/beta/pay/products/products.js +4 -0
  53. package/resources/beta/pay/products/products.js.map +1 -1
  54. package/resources/beta/pay/products/products.mjs +4 -0
  55. package/resources/beta/pay/products/products.mjs.map +1 -1
  56. package/resources/beta/pay/products/variants.d.mts +206 -0
  57. package/resources/beta/pay/products/variants.d.mts.map +1 -0
  58. package/resources/beta/pay/products/variants.d.ts +206 -0
  59. package/resources/beta/pay/products/variants.d.ts.map +1 -0
  60. package/resources/beta/pay/products/variants.js +56 -0
  61. package/resources/beta/pay/products/variants.js.map +1 -0
  62. package/resources/beta/pay/products/variants.mjs +52 -0
  63. package/resources/beta/pay/products/variants.mjs.map +1 -0
  64. package/resources/beta/push-notifications/index.d.mts +3 -0
  65. package/resources/beta/push-notifications/index.d.mts.map +1 -0
  66. package/resources/beta/push-notifications/index.d.ts +3 -0
  67. package/resources/beta/push-notifications/index.d.ts.map +1 -0
  68. package/resources/beta/push-notifications/index.js +9 -0
  69. package/resources/beta/push-notifications/index.js.map +1 -0
  70. package/resources/beta/push-notifications/index.mjs +4 -0
  71. package/resources/beta/push-notifications/index.mjs.map +1 -0
  72. package/resources/beta/push-notifications/push-notifications.d.mts +78 -0
  73. package/resources/beta/push-notifications/push-notifications.d.mts.map +1 -0
  74. package/resources/beta/push-notifications/push-notifications.d.ts +78 -0
  75. package/resources/beta/push-notifications/push-notifications.d.ts.map +1 -0
  76. package/resources/beta/push-notifications/push-notifications.js +32 -0
  77. package/resources/beta/push-notifications/push-notifications.js.map +1 -0
  78. package/resources/beta/push-notifications/push-notifications.mjs +27 -0
  79. package/resources/beta/push-notifications/push-notifications.mjs.map +1 -0
  80. package/resources/beta/push-notifications/subscriptions.d.mts +74 -0
  81. package/resources/beta/push-notifications/subscriptions.d.mts.map +1 -0
  82. package/resources/beta/push-notifications/subscriptions.d.ts +74 -0
  83. package/resources/beta/push-notifications/subscriptions.d.ts.map +1 -0
  84. package/resources/beta/push-notifications/subscriptions.js +23 -0
  85. package/resources/beta/push-notifications/subscriptions.js.map +1 -0
  86. package/resources/beta/push-notifications/subscriptions.mjs +19 -0
  87. package/resources/beta/push-notifications/subscriptions.mjs.map +1 -0
  88. package/resources/beta/push-notifications.d.mts +2 -0
  89. package/resources/beta/push-notifications.d.mts.map +1 -0
  90. package/resources/beta/push-notifications.d.ts +2 -0
  91. package/resources/beta/push-notifications.d.ts.map +1 -0
  92. package/resources/beta/push-notifications.js +6 -0
  93. package/resources/beta/push-notifications.js.map +1 -0
  94. package/resources/beta/push-notifications.mjs +3 -0
  95. package/resources/beta/push-notifications.mjs.map +1 -0
  96. package/src/resources/beta/beta.ts +18 -0
  97. package/src/resources/beta/index.ts +6 -0
  98. package/src/resources/beta/pay/coupons.ts +1 -1
  99. package/src/resources/beta/pay/customers.ts +1 -1
  100. package/src/resources/beta/pay/entitlements.ts +4 -26
  101. package/src/resources/beta/pay/pay.ts +87 -17
  102. package/src/resources/beta/pay/products/entitlements.ts +1 -1
  103. package/src/resources/beta/pay/products/index.ts +10 -0
  104. package/src/resources/beta/pay/products/products.ts +70 -14
  105. package/src/resources/beta/pay/products/variants.ts +279 -0
  106. package/src/resources/beta/push-notifications/index.ts +14 -0
  107. package/src/resources/beta/push-notifications/push-notifications.ts +112 -0
  108. package/src/resources/beta/push-notifications/subscriptions.ts +96 -0
  109. package/src/resources/beta/push-notifications.ts +3 -0
  110. package/src/version.ts +1 -1
  111. package/version.d.mts +1 -1
  112. package/version.d.ts +1 -1
  113. package/version.js +1 -1
  114. package/version.mjs +1 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"push-notifications.d.mts","sourceRoot":"","sources":["../../../src/resources/beta/push-notifications/push-notifications.ts"],"names":[],"mappings":"OAEO,EAAE,WAAW,EAAE;OACf,KAAK,gBAAgB;OACrB,EACL,wBAAwB,EACxB,0BAA0B,EAC1B,0BAA0B,EAC1B,aAAa,EACd;OACM,EAAE,UAAU,EAAE;OACd,EAAE,cAAc,EAAE;AAEzB,qBAAa,iBAAkB,SAAQ,WAAW;IAChD,aAAa,EAAE,gBAAgB,CAAC,aAAa,CAAoD;IAEjG;;;;OAIG;IACH,MAAM,CAAC,OAAO,CAAC,EAAE,cAAc,GAAG,UAAU,CAAC,8BAA8B,CAAC;IAI5E;;;OAGG;IACH,IAAI,CAAC,IAAI,EAAE,0BAA0B,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,UAAU,CAAC,4BAA4B,CAAC;CAG3G;AAED;;GAEG;AACH,MAAM,WAAW,8BAA8B;IAC7C;;OAEG;IACH,cAAc,EAAE,MAAM,CAAC;CACxB;AAED;;GAEG;AACH,MAAM,WAAW,4BAA4B;IAC3C;;OAEG;IACH,MAAM,EAAE,MAAM,CAAC;IAEf;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,0BAA0B;IACzC;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IAEd;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IAEd;;OAEG;IACH,IAAI,CAAC,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;KAAE,CAAC;IAElC;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IAEd;;OAEG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC;IAEb;;OAEG;IACH,UAAU,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;CAC5B;AAID,MAAM,CAAC,OAAO,WAAW,iBAAiB,CAAC;IACzC,OAAO,EACL,KAAK,8BAA8B,IAAI,8BAA8B,EACrE,KAAK,4BAA4B,IAAI,4BAA4B,EACjE,KAAK,0BAA0B,IAAI,0BAA0B,GAC9D,CAAC;IAEF,OAAO,EACL,aAAa,IAAI,aAAa,EAC9B,KAAK,0BAA0B,IAAI,0BAA0B,EAC7D,KAAK,0BAA0B,IAAI,0BAA0B,EAC7D,KAAK,wBAAwB,IAAI,wBAAwB,GAC1D,CAAC;CACH"}
@@ -0,0 +1,78 @@
1
+ import { APIResource } from "../../../core/resource.js";
2
+ import * as SubscriptionsAPI from "./subscriptions.js";
3
+ import { SubscriptionCreateParams, SubscriptionCreateResponse, SubscriptionDeleteResponse, Subscriptions } from "./subscriptions.js";
4
+ import { APIPromise } from "../../../core/api-promise.js";
5
+ import { RequestOptions } from "../../../internal/request-options.js";
6
+ export declare class PushNotifications extends APIResource {
7
+ subscriptions: SubscriptionsAPI.Subscriptions;
8
+ /**
9
+ * Enables push notifications for the app by generating VAPID keys. Idempotent -
10
+ * returns existing keys if already enabled. Hercules recommends calling this
11
+ * during app initialization.
12
+ */
13
+ enable(options?: RequestOptions): APIPromise<PushNotificationEnableResponse>;
14
+ /**
15
+ * Sends push notifications to specified visitors. Omit visitorIds to broadcast to
16
+ * all subscribers. Returns the count of successful and failed deliveries.
17
+ */
18
+ send(body: PushNotificationSendParams, options?: RequestOptions): APIPromise<PushNotificationSendResponse>;
19
+ }
20
+ /**
21
+ * Response containing the VAPID public key for push subscriptions.
22
+ */
23
+ export interface PushNotificationEnableResponse {
24
+ /**
25
+ * VAPID public key for push subscription (base64url encoded)
26
+ */
27
+ vapidPublicKey: string;
28
+ }
29
+ /**
30
+ * Result of the send operation with success and failure counts.
31
+ */
32
+ export interface PushNotificationSendResponse {
33
+ /**
34
+ * Number of notifications that failed to send
35
+ */
36
+ failed: number;
37
+ /**
38
+ * Number of notifications successfully sent
39
+ */
40
+ sent: number;
41
+ }
42
+ export interface PushNotificationSendParams {
43
+ /**
44
+ * Notification title
45
+ */
46
+ title: string;
47
+ /**
48
+ * Badge URL for mobile devices
49
+ */
50
+ badge?: string;
51
+ /**
52
+ * Notification body text
53
+ */
54
+ body?: string;
55
+ /**
56
+ * Custom data payload to include with the notification
57
+ */
58
+ data?: {
59
+ [key: string]: unknown;
60
+ };
61
+ /**
62
+ * Icon URL
63
+ */
64
+ icon?: string;
65
+ /**
66
+ * URL to open when notification is clicked
67
+ */
68
+ url?: string;
69
+ /**
70
+ * Visitor IDs to send to. Omit to broadcast to all subscribers.
71
+ */
72
+ visitorIds?: Array<string>;
73
+ }
74
+ export declare namespace PushNotifications {
75
+ export { type PushNotificationEnableResponse as PushNotificationEnableResponse, type PushNotificationSendResponse as PushNotificationSendResponse, type PushNotificationSendParams as PushNotificationSendParams, };
76
+ export { Subscriptions as Subscriptions, type SubscriptionCreateResponse as SubscriptionCreateResponse, type SubscriptionDeleteResponse as SubscriptionDeleteResponse, type SubscriptionCreateParams as SubscriptionCreateParams, };
77
+ }
78
+ //# sourceMappingURL=push-notifications.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"push-notifications.d.ts","sourceRoot":"","sources":["../../../src/resources/beta/push-notifications/push-notifications.ts"],"names":[],"mappings":"OAEO,EAAE,WAAW,EAAE;OACf,KAAK,gBAAgB;OACrB,EACL,wBAAwB,EACxB,0BAA0B,EAC1B,0BAA0B,EAC1B,aAAa,EACd;OACM,EAAE,UAAU,EAAE;OACd,EAAE,cAAc,EAAE;AAEzB,qBAAa,iBAAkB,SAAQ,WAAW;IAChD,aAAa,EAAE,gBAAgB,CAAC,aAAa,CAAoD;IAEjG;;;;OAIG;IACH,MAAM,CAAC,OAAO,CAAC,EAAE,cAAc,GAAG,UAAU,CAAC,8BAA8B,CAAC;IAI5E;;;OAGG;IACH,IAAI,CAAC,IAAI,EAAE,0BAA0B,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,UAAU,CAAC,4BAA4B,CAAC;CAG3G;AAED;;GAEG;AACH,MAAM,WAAW,8BAA8B;IAC7C;;OAEG;IACH,cAAc,EAAE,MAAM,CAAC;CACxB;AAED;;GAEG;AACH,MAAM,WAAW,4BAA4B;IAC3C;;OAEG;IACH,MAAM,EAAE,MAAM,CAAC;IAEf;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,0BAA0B;IACzC;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IAEd;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IAEd;;OAEG;IACH,IAAI,CAAC,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;KAAE,CAAC;IAElC;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IAEd;;OAEG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC;IAEb;;OAEG;IACH,UAAU,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;CAC5B;AAID,MAAM,CAAC,OAAO,WAAW,iBAAiB,CAAC;IACzC,OAAO,EACL,KAAK,8BAA8B,IAAI,8BAA8B,EACrE,KAAK,4BAA4B,IAAI,4BAA4B,EACjE,KAAK,0BAA0B,IAAI,0BAA0B,GAC9D,CAAC;IAEF,OAAO,EACL,aAAa,IAAI,aAAa,EAC9B,KAAK,0BAA0B,IAAI,0BAA0B,EAC7D,KAAK,0BAA0B,IAAI,0BAA0B,EAC7D,KAAK,wBAAwB,IAAI,wBAAwB,GAC1D,CAAC;CACH"}
@@ -0,0 +1,32 @@
1
+ "use strict";
2
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.PushNotifications = void 0;
5
+ const tslib_1 = require("../../../internal/tslib.js");
6
+ const resource_1 = require("../../../core/resource.js");
7
+ const SubscriptionsAPI = tslib_1.__importStar(require("./subscriptions.js"));
8
+ const subscriptions_1 = require("./subscriptions.js");
9
+ class PushNotifications extends resource_1.APIResource {
10
+ constructor() {
11
+ super(...arguments);
12
+ this.subscriptions = new SubscriptionsAPI.Subscriptions(this._client);
13
+ }
14
+ /**
15
+ * Enables push notifications for the app by generating VAPID keys. Idempotent -
16
+ * returns existing keys if already enabled. Hercules recommends calling this
17
+ * during app initialization.
18
+ */
19
+ enable(options) {
20
+ return this._client.post('/v1/push-notifications/enable', options);
21
+ }
22
+ /**
23
+ * Sends push notifications to specified visitors. Omit visitorIds to broadcast to
24
+ * all subscribers. Returns the count of successful and failed deliveries.
25
+ */
26
+ send(body, options) {
27
+ return this._client.post('/v1/push-notifications/send', { body, ...options });
28
+ }
29
+ }
30
+ exports.PushNotifications = PushNotifications;
31
+ PushNotifications.Subscriptions = subscriptions_1.Subscriptions;
32
+ //# sourceMappingURL=push-notifications.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"push-notifications.js","sourceRoot":"","sources":["../../../src/resources/beta/push-notifications/push-notifications.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;;AAEtF,wDAAqD;AACrD,6EAAoD;AACpD,sDAKyB;AAIzB,MAAa,iBAAkB,SAAQ,sBAAW;IAAlD;;QACE,kBAAa,GAAmC,IAAI,gBAAgB,CAAC,aAAa,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IAkBnG,CAAC;IAhBC;;;;OAIG;IACH,MAAM,CAAC,OAAwB;QAC7B,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,+BAA+B,EAAE,OAAO,CAAC,CAAC;IACrE,CAAC;IAED;;;OAGG;IACH,IAAI,CAAC,IAAgC,EAAE,OAAwB;QAC7D,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,6BAA6B,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IAChF,CAAC;CACF;AAnBD,8CAmBC;AAgED,iBAAiB,CAAC,aAAa,GAAG,6BAAa,CAAC"}
@@ -0,0 +1,27 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+ import { APIResource } from "../../../core/resource.mjs";
3
+ import * as SubscriptionsAPI from "./subscriptions.mjs";
4
+ import { Subscriptions, } from "./subscriptions.mjs";
5
+ export class PushNotifications extends APIResource {
6
+ constructor() {
7
+ super(...arguments);
8
+ this.subscriptions = new SubscriptionsAPI.Subscriptions(this._client);
9
+ }
10
+ /**
11
+ * Enables push notifications for the app by generating VAPID keys. Idempotent -
12
+ * returns existing keys if already enabled. Hercules recommends calling this
13
+ * during app initialization.
14
+ */
15
+ enable(options) {
16
+ return this._client.post('/v1/push-notifications/enable', options);
17
+ }
18
+ /**
19
+ * Sends push notifications to specified visitors. Omit visitorIds to broadcast to
20
+ * all subscribers. Returns the count of successful and failed deliveries.
21
+ */
22
+ send(body, options) {
23
+ return this._client.post('/v1/push-notifications/send', { body, ...options });
24
+ }
25
+ }
26
+ PushNotifications.Subscriptions = Subscriptions;
27
+ //# sourceMappingURL=push-notifications.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"push-notifications.mjs","sourceRoot":"","sources":["../../../src/resources/beta/push-notifications/push-notifications.ts"],"names":[],"mappings":"AAAA,sFAAsF;OAE/E,EAAE,WAAW,EAAE;OACf,KAAK,gBAAgB;OACrB,EAIL,aAAa,GACd;AAID,MAAM,OAAO,iBAAkB,SAAQ,WAAW;IAAlD;;QACE,kBAAa,GAAmC,IAAI,gBAAgB,CAAC,aAAa,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IAkBnG,CAAC;IAhBC;;;;OAIG;IACH,MAAM,CAAC,OAAwB;QAC7B,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,+BAA+B,EAAE,OAAO,CAAC,CAAC;IACrE,CAAC;IAED;;;OAGG;IACH,IAAI,CAAC,IAAgC,EAAE,OAAwB;QAC7D,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,6BAA6B,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IAChF,CAAC;CACF;AAgED,iBAAiB,CAAC,aAAa,GAAG,aAAa,CAAC"}
@@ -0,0 +1,74 @@
1
+ import { APIResource } from "../../../core/resource.mjs";
2
+ import { APIPromise } from "../../../core/api-promise.mjs";
3
+ import { RequestOptions } from "../../../internal/request-options.mjs";
4
+ export declare class Subscriptions extends APIResource {
5
+ /**
6
+ * Registers a push subscription for a visitor. Upserts by endpoint to handle
7
+ * re-subscriptions gracefully.
8
+ */
9
+ create(body: SubscriptionCreateParams, options?: RequestOptions): APIPromise<SubscriptionCreateResponse>;
10
+ /**
11
+ * Removes a push subscription by ID.
12
+ */
13
+ delete(id: string, options?: RequestOptions): APIPromise<SubscriptionDeleteResponse>;
14
+ }
15
+ /**
16
+ * The created or updated subscription.
17
+ */
18
+ export interface SubscriptionCreateResponse {
19
+ /**
20
+ * Subscription ID
21
+ */
22
+ id: string;
23
+ }
24
+ /**
25
+ * Result of the unsubscribe operation.
26
+ */
27
+ export interface SubscriptionDeleteResponse {
28
+ /**
29
+ * Whether the subscription was removed
30
+ */
31
+ success: boolean;
32
+ }
33
+ export interface SubscriptionCreateParams {
34
+ /**
35
+ * Web Push subscription object from pushManager.subscribe()
36
+ */
37
+ subscription: SubscriptionCreateParams.Subscription;
38
+ /**
39
+ * Unique identifier for the subscriber (e.g., userId)
40
+ */
41
+ visitorId: string;
42
+ }
43
+ export declare namespace SubscriptionCreateParams {
44
+ /**
45
+ * Web Push subscription object from pushManager.subscribe()
46
+ */
47
+ interface Subscription {
48
+ /**
49
+ * Push service endpoint URL
50
+ */
51
+ endpoint: string;
52
+ keys: Subscription.Keys;
53
+ /**
54
+ * Subscription expiration timestamp
55
+ */
56
+ expirationTime?: number | null;
57
+ }
58
+ namespace Subscription {
59
+ interface Keys {
60
+ /**
61
+ * Authentication secret (base64url encoded)
62
+ */
63
+ auth: string;
64
+ /**
65
+ * P-256 Diffie-Hellman public key (base64url encoded)
66
+ */
67
+ p256dh: string;
68
+ }
69
+ }
70
+ }
71
+ export declare namespace Subscriptions {
72
+ export { type SubscriptionCreateResponse as SubscriptionCreateResponse, type SubscriptionDeleteResponse as SubscriptionDeleteResponse, type SubscriptionCreateParams as SubscriptionCreateParams, };
73
+ }
74
+ //# sourceMappingURL=subscriptions.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"subscriptions.d.mts","sourceRoot":"","sources":["../../../src/resources/beta/push-notifications/subscriptions.ts"],"names":[],"mappings":"OAEO,EAAE,WAAW,EAAE;OACf,EAAE,UAAU,EAAE;OACd,EAAE,cAAc,EAAE;AAGzB,qBAAa,aAAc,SAAQ,WAAW;IAC5C;;;OAGG;IACH,MAAM,CAAC,IAAI,EAAE,wBAAwB,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,UAAU,CAAC,0BAA0B,CAAC;IAIxG;;OAEG;IACH,MAAM,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,UAAU,CAAC,0BAA0B,CAAC;CAGrF;AAED;;GAEG;AACH,MAAM,WAAW,0BAA0B;IACzC;;OAEG;IACH,EAAE,EAAE,MAAM,CAAC;CACZ;AAED;;GAEG;AACH,MAAM,WAAW,0BAA0B;IACzC;;OAEG;IACH,OAAO,EAAE,OAAO,CAAC;CAClB;AAED,MAAM,WAAW,wBAAwB;IACvC;;OAEG;IACH,YAAY,EAAE,wBAAwB,CAAC,YAAY,CAAC;IAEpD;;OAEG;IACH,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,yBAAiB,wBAAwB,CAAC;IACxC;;OAEG;IACH,UAAiB,YAAY;QAC3B;;WAEG;QACH,QAAQ,EAAE,MAAM,CAAC;QAEjB,IAAI,EAAE,YAAY,CAAC,IAAI,CAAC;QAExB;;WAEG;QACH,cAAc,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;KAChC;IAED,UAAiB,YAAY,CAAC;QAC5B,UAAiB,IAAI;YACnB;;eAEG;YACH,IAAI,EAAE,MAAM,CAAC;YAEb;;eAEG;YACH,MAAM,EAAE,MAAM,CAAC;SAChB;KACF;CACF;AAED,MAAM,CAAC,OAAO,WAAW,aAAa,CAAC;IACrC,OAAO,EACL,KAAK,0BAA0B,IAAI,0BAA0B,EAC7D,KAAK,0BAA0B,IAAI,0BAA0B,EAC7D,KAAK,wBAAwB,IAAI,wBAAwB,GAC1D,CAAC;CACH"}
@@ -0,0 +1,74 @@
1
+ import { APIResource } from "../../../core/resource.js";
2
+ import { APIPromise } from "../../../core/api-promise.js";
3
+ import { RequestOptions } from "../../../internal/request-options.js";
4
+ export declare class Subscriptions extends APIResource {
5
+ /**
6
+ * Registers a push subscription for a visitor. Upserts by endpoint to handle
7
+ * re-subscriptions gracefully.
8
+ */
9
+ create(body: SubscriptionCreateParams, options?: RequestOptions): APIPromise<SubscriptionCreateResponse>;
10
+ /**
11
+ * Removes a push subscription by ID.
12
+ */
13
+ delete(id: string, options?: RequestOptions): APIPromise<SubscriptionDeleteResponse>;
14
+ }
15
+ /**
16
+ * The created or updated subscription.
17
+ */
18
+ export interface SubscriptionCreateResponse {
19
+ /**
20
+ * Subscription ID
21
+ */
22
+ id: string;
23
+ }
24
+ /**
25
+ * Result of the unsubscribe operation.
26
+ */
27
+ export interface SubscriptionDeleteResponse {
28
+ /**
29
+ * Whether the subscription was removed
30
+ */
31
+ success: boolean;
32
+ }
33
+ export interface SubscriptionCreateParams {
34
+ /**
35
+ * Web Push subscription object from pushManager.subscribe()
36
+ */
37
+ subscription: SubscriptionCreateParams.Subscription;
38
+ /**
39
+ * Unique identifier for the subscriber (e.g., userId)
40
+ */
41
+ visitorId: string;
42
+ }
43
+ export declare namespace SubscriptionCreateParams {
44
+ /**
45
+ * Web Push subscription object from pushManager.subscribe()
46
+ */
47
+ interface Subscription {
48
+ /**
49
+ * Push service endpoint URL
50
+ */
51
+ endpoint: string;
52
+ keys: Subscription.Keys;
53
+ /**
54
+ * Subscription expiration timestamp
55
+ */
56
+ expirationTime?: number | null;
57
+ }
58
+ namespace Subscription {
59
+ interface Keys {
60
+ /**
61
+ * Authentication secret (base64url encoded)
62
+ */
63
+ auth: string;
64
+ /**
65
+ * P-256 Diffie-Hellman public key (base64url encoded)
66
+ */
67
+ p256dh: string;
68
+ }
69
+ }
70
+ }
71
+ export declare namespace Subscriptions {
72
+ export { type SubscriptionCreateResponse as SubscriptionCreateResponse, type SubscriptionDeleteResponse as SubscriptionDeleteResponse, type SubscriptionCreateParams as SubscriptionCreateParams, };
73
+ }
74
+ //# sourceMappingURL=subscriptions.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"subscriptions.d.ts","sourceRoot":"","sources":["../../../src/resources/beta/push-notifications/subscriptions.ts"],"names":[],"mappings":"OAEO,EAAE,WAAW,EAAE;OACf,EAAE,UAAU,EAAE;OACd,EAAE,cAAc,EAAE;AAGzB,qBAAa,aAAc,SAAQ,WAAW;IAC5C;;;OAGG;IACH,MAAM,CAAC,IAAI,EAAE,wBAAwB,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,UAAU,CAAC,0BAA0B,CAAC;IAIxG;;OAEG;IACH,MAAM,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,UAAU,CAAC,0BAA0B,CAAC;CAGrF;AAED;;GAEG;AACH,MAAM,WAAW,0BAA0B;IACzC;;OAEG;IACH,EAAE,EAAE,MAAM,CAAC;CACZ;AAED;;GAEG;AACH,MAAM,WAAW,0BAA0B;IACzC;;OAEG;IACH,OAAO,EAAE,OAAO,CAAC;CAClB;AAED,MAAM,WAAW,wBAAwB;IACvC;;OAEG;IACH,YAAY,EAAE,wBAAwB,CAAC,YAAY,CAAC;IAEpD;;OAEG;IACH,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,yBAAiB,wBAAwB,CAAC;IACxC;;OAEG;IACH,UAAiB,YAAY;QAC3B;;WAEG;QACH,QAAQ,EAAE,MAAM,CAAC;QAEjB,IAAI,EAAE,YAAY,CAAC,IAAI,CAAC;QAExB;;WAEG;QACH,cAAc,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;KAChC;IAED,UAAiB,YAAY,CAAC;QAC5B,UAAiB,IAAI;YACnB;;eAEG;YACH,IAAI,EAAE,MAAM,CAAC;YAEb;;eAEG;YACH,MAAM,EAAE,MAAM,CAAC;SAChB;KACF;CACF;AAED,MAAM,CAAC,OAAO,WAAW,aAAa,CAAC;IACrC,OAAO,EACL,KAAK,0BAA0B,IAAI,0BAA0B,EAC7D,KAAK,0BAA0B,IAAI,0BAA0B,EAC7D,KAAK,wBAAwB,IAAI,wBAAwB,GAC1D,CAAC;CACH"}
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.Subscriptions = void 0;
5
+ const resource_1 = require("../../../core/resource.js");
6
+ const path_1 = require("../../../internal/utils/path.js");
7
+ class Subscriptions extends resource_1.APIResource {
8
+ /**
9
+ * Registers a push subscription for a visitor. Upserts by endpoint to handle
10
+ * re-subscriptions gracefully.
11
+ */
12
+ create(body, options) {
13
+ return this._client.post('/v1/push-notifications/subscriptions', { body, ...options });
14
+ }
15
+ /**
16
+ * Removes a push subscription by ID.
17
+ */
18
+ delete(id, options) {
19
+ return this._client.delete((0, path_1.path) `/v1/push-notifications/subscriptions/${id}`, options);
20
+ }
21
+ }
22
+ exports.Subscriptions = Subscriptions;
23
+ //# sourceMappingURL=subscriptions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"subscriptions.js","sourceRoot":"","sources":["../../../src/resources/beta/push-notifications/subscriptions.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;AAEtF,wDAAqD;AAGrD,0DAAoD;AAEpD,MAAa,aAAc,SAAQ,sBAAW;IAC5C;;;OAGG;IACH,MAAM,CAAC,IAA8B,EAAE,OAAwB;QAC7D,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,sCAAsC,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IACzF,CAAC;IAED;;OAEG;IACH,MAAM,CAAC,EAAU,EAAE,OAAwB;QACzC,OAAO,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,IAAA,WAAI,EAAA,wCAAwC,EAAE,EAAE,EAAE,OAAO,CAAC,CAAC;IACxF,CAAC;CACF;AAfD,sCAeC"}
@@ -0,0 +1,19 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+ import { APIResource } from "../../../core/resource.mjs";
3
+ import { path } from "../../../internal/utils/path.mjs";
4
+ export class Subscriptions extends APIResource {
5
+ /**
6
+ * Registers a push subscription for a visitor. Upserts by endpoint to handle
7
+ * re-subscriptions gracefully.
8
+ */
9
+ create(body, options) {
10
+ return this._client.post('/v1/push-notifications/subscriptions', { body, ...options });
11
+ }
12
+ /**
13
+ * Removes a push subscription by ID.
14
+ */
15
+ delete(id, options) {
16
+ return this._client.delete(path `/v1/push-notifications/subscriptions/${id}`, options);
17
+ }
18
+ }
19
+ //# sourceMappingURL=subscriptions.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"subscriptions.mjs","sourceRoot":"","sources":["../../../src/resources/beta/push-notifications/subscriptions.ts"],"names":[],"mappings":"AAAA,sFAAsF;OAE/E,EAAE,WAAW,EAAE;OAGf,EAAE,IAAI,EAAE;AAEf,MAAM,OAAO,aAAc,SAAQ,WAAW;IAC5C;;;OAGG;IACH,MAAM,CAAC,IAA8B,EAAE,OAAwB;QAC7D,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,sCAAsC,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IACzF,CAAC;IAED;;OAEG;IACH,MAAM,CAAC,EAAU,EAAE,OAAwB;QACzC,OAAO,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,CAAA,wCAAwC,EAAE,EAAE,EAAE,OAAO,CAAC,CAAC;IACxF,CAAC;CACF"}
@@ -0,0 +1,2 @@
1
+ export * from "./push-notifications/index.mjs";
2
+ //# sourceMappingURL=push-notifications.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"push-notifications.d.mts","sourceRoot":"","sources":["../../src/resources/beta/push-notifications.ts"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export * from "./push-notifications/index.js";
2
+ //# sourceMappingURL=push-notifications.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"push-notifications.d.ts","sourceRoot":"","sources":["../../src/resources/beta/push-notifications.ts"],"names":[],"mappings":""}
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ const tslib_1 = require("../../internal/tslib.js");
5
+ tslib_1.__exportStar(require("./push-notifications/index.js"), exports);
6
+ //# sourceMappingURL=push-notifications.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"push-notifications.js","sourceRoot":"","sources":["../../src/resources/beta/push-notifications.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;AAEtF,wEAA2C"}
@@ -0,0 +1,3 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+ export * from "./push-notifications/index.mjs";
3
+ //# sourceMappingURL=push-notifications.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"push-notifications.mjs","sourceRoot":"","sources":["../../src/resources/beta/push-notifications.ts"],"names":[],"mappings":"AAAA,sFAAsF"}
@@ -11,12 +11,23 @@ import {
11
11
  PayCheckoutParams,
12
12
  PayCheckoutResponse,
13
13
  } from './pay/pay';
14
+ import * as PushNotificationsAPI from './push-notifications/push-notifications';
15
+ import {
16
+ PushNotificationEnableResponse,
17
+ PushNotificationSendParams,
18
+ PushNotificationSendResponse,
19
+ PushNotifications,
20
+ } from './push-notifications/push-notifications';
14
21
 
15
22
  export class Beta extends APIResource {
16
23
  pay: PayAPI.Pay = new PayAPI.Pay(this._client);
24
+ pushNotifications: PushNotificationsAPI.PushNotifications = new PushNotificationsAPI.PushNotifications(
25
+ this._client,
26
+ );
17
27
  }
18
28
 
19
29
  Beta.Pay = Pay;
30
+ Beta.PushNotifications = PushNotifications;
20
31
 
21
32
  export declare namespace Beta {
22
33
  export {
@@ -28,4 +39,11 @@ export declare namespace Beta {
28
39
  type PayCheckParams as PayCheckParams,
29
40
  type PayCheckoutParams as PayCheckoutParams,
30
41
  };
42
+
43
+ export {
44
+ PushNotifications as PushNotifications,
45
+ type PushNotificationEnableResponse as PushNotificationEnableResponse,
46
+ type PushNotificationSendResponse as PushNotificationSendResponse,
47
+ type PushNotificationSendParams as PushNotificationSendParams,
48
+ };
31
49
  }
@@ -10,3 +10,9 @@ export {
10
10
  type PayCheckParams,
11
11
  type PayCheckoutParams,
12
12
  } from './pay/index';
13
+ export {
14
+ PushNotifications,
15
+ type PushNotificationEnableResponse,
16
+ type PushNotificationSendResponse,
17
+ type PushNotificationSendParams,
18
+ } from './push-notifications/index';
@@ -67,7 +67,7 @@ export type CouponsCursorIDPage = CursorIDPage<Coupon>;
67
67
  */
68
68
  export interface Coupon {
69
69
  /**
70
- * Unique identifier for the entitlement
70
+ * Unique identifier for the price
71
71
  */
72
72
  id: string;
73
73
 
@@ -82,7 +82,7 @@ export type CustomersCursorIDPage = CursorIDPage<Customer>;
82
82
  */
83
83
  export interface Customer {
84
84
  /**
85
- * Unique identifier for the entitlement
85
+ * Unique identifier for the price
86
86
  */
87
87
  id: string;
88
88
 
@@ -19,7 +19,7 @@ export class Entitlements extends APIResource {
19
19
 
20
20
  /**
21
21
  * Updates an existing entitlement. Use this to modify the name or deactivate the
22
- * entitlement. The key cannot be changed after creation.
22
+ * entitlement.
23
23
  */
24
24
  update(
25
25
  entitlementID: string,
@@ -31,8 +31,7 @@ export class Entitlements extends APIResource {
31
31
 
32
32
  /**
33
33
  * Retrieves a paginated list of all entitlements. Entitlements represent features
34
- * or capabilities in your app that can be gated by subscription. Use the key
35
- * filter to find a specific entitlement by its key.
34
+ * or capabilities in your app that can be gated by subscription.
36
35
  */
37
36
  list(
38
37
  query: EntitlementListParams | null | undefined = {},
@@ -43,7 +42,7 @@ export class Entitlements extends APIResource {
43
42
 
44
43
  /**
45
44
  * Retrieves an entitlement by ID. Returns the entitlement object including its
46
- * lookup key and active status.
45
+ * active status.
47
46
  */
48
47
  get(entitlementID: string, options?: RequestOptions): APIPromise<Entitlement> {
49
48
  return this._client.get(path`/v1/pay/entitlements/${entitlementID}`, options);
@@ -57,7 +56,7 @@ export type EntitlementsCursorIDPage = CursorIDPage<Entitlement>;
57
56
  */
58
57
  export interface Entitlement {
59
58
  /**
60
- * Unique identifier for the entitlement
59
+ * Unique identifier for the price
61
60
  */
62
61
  id: string;
63
62
 
@@ -66,16 +65,6 @@ export interface Entitlement {
66
65
  */
67
66
  active: boolean;
68
67
 
69
- /**
70
- * Unique key to identify the entitlement when checking access in your app
71
- */
72
- key: string;
73
-
74
- /**
75
- * Whether this is a live mode entitlement (vs test mode)
76
- */
77
- livemode: boolean;
78
-
79
68
  /**
80
69
  * Display name for the entitlement (e.g., API Access, Premium Support)
81
70
  */
@@ -83,12 +72,6 @@ export interface Entitlement {
83
72
  }
84
73
 
85
74
  export interface EntitlementCreateParams {
86
- /**
87
- * Unique key to identify the entitlement when checking access. Use a descriptive,
88
- * stable key (e.g., api_access, premium_support).
89
- */
90
- key: string;
91
-
92
75
  /**
93
76
  * Display name for the entitlement (e.g., API Access, Premium Support)
94
77
  */
@@ -117,11 +100,6 @@ export interface EntitlementListParams extends CursorIDPageParams {
117
100
  * Filter by archived status
118
101
  */
119
102
  archived?: 'true' | 'false';
120
-
121
- /**
122
- * Filter by exact key match
123
- */
124
- key?: string;
125
103
  }
126
104
 
127
105
  export declare namespace Entitlements {