@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,112 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ import { APIResource } from '../../../core/resource';
4
+ import * as SubscriptionsAPI from './subscriptions';
5
+ import {
6
+ SubscriptionCreateParams,
7
+ SubscriptionCreateResponse,
8
+ SubscriptionDeleteResponse,
9
+ Subscriptions,
10
+ } from './subscriptions';
11
+ import { APIPromise } from '../../../core/api-promise';
12
+ import { RequestOptions } from '../../../internal/request-options';
13
+
14
+ export class PushNotifications extends APIResource {
15
+ subscriptions: SubscriptionsAPI.Subscriptions = new SubscriptionsAPI.Subscriptions(this._client);
16
+
17
+ /**
18
+ * Enables push notifications for the app by generating VAPID keys. Idempotent -
19
+ * returns existing keys if already enabled. Hercules recommends calling this
20
+ * during app initialization.
21
+ */
22
+ enable(options?: RequestOptions): APIPromise<PushNotificationEnableResponse> {
23
+ return this._client.post('/v1/push-notifications/enable', options);
24
+ }
25
+
26
+ /**
27
+ * Sends push notifications to specified visitors. Omit visitorIds to broadcast to
28
+ * all subscribers. Returns the count of successful and failed deliveries.
29
+ */
30
+ send(body: PushNotificationSendParams, options?: RequestOptions): APIPromise<PushNotificationSendResponse> {
31
+ return this._client.post('/v1/push-notifications/send', { body, ...options });
32
+ }
33
+ }
34
+
35
+ /**
36
+ * Response containing the VAPID public key for push subscriptions.
37
+ */
38
+ export interface PushNotificationEnableResponse {
39
+ /**
40
+ * VAPID public key for push subscription (base64url encoded)
41
+ */
42
+ vapidPublicKey: string;
43
+ }
44
+
45
+ /**
46
+ * Result of the send operation with success and failure counts.
47
+ */
48
+ export interface PushNotificationSendResponse {
49
+ /**
50
+ * Number of notifications that failed to send
51
+ */
52
+ failed: number;
53
+
54
+ /**
55
+ * Number of notifications successfully sent
56
+ */
57
+ sent: number;
58
+ }
59
+
60
+ export interface PushNotificationSendParams {
61
+ /**
62
+ * Notification title
63
+ */
64
+ title: string;
65
+
66
+ /**
67
+ * Badge URL for mobile devices
68
+ */
69
+ badge?: string;
70
+
71
+ /**
72
+ * Notification body text
73
+ */
74
+ body?: string;
75
+
76
+ /**
77
+ * Custom data payload to include with the notification
78
+ */
79
+ data?: { [key: string]: unknown };
80
+
81
+ /**
82
+ * Icon URL
83
+ */
84
+ icon?: string;
85
+
86
+ /**
87
+ * URL to open when notification is clicked
88
+ */
89
+ url?: string;
90
+
91
+ /**
92
+ * Visitor IDs to send to. Omit to broadcast to all subscribers.
93
+ */
94
+ visitorIds?: Array<string>;
95
+ }
96
+
97
+ PushNotifications.Subscriptions = Subscriptions;
98
+
99
+ export declare namespace PushNotifications {
100
+ export {
101
+ type PushNotificationEnableResponse as PushNotificationEnableResponse,
102
+ type PushNotificationSendResponse as PushNotificationSendResponse,
103
+ type PushNotificationSendParams as PushNotificationSendParams,
104
+ };
105
+
106
+ export {
107
+ Subscriptions as Subscriptions,
108
+ type SubscriptionCreateResponse as SubscriptionCreateResponse,
109
+ type SubscriptionDeleteResponse as SubscriptionDeleteResponse,
110
+ type SubscriptionCreateParams as SubscriptionCreateParams,
111
+ };
112
+ }
@@ -0,0 +1,96 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ import { APIResource } from '../../../core/resource';
4
+ import { APIPromise } from '../../../core/api-promise';
5
+ import { RequestOptions } from '../../../internal/request-options';
6
+ import { path } from '../../../internal/utils/path';
7
+
8
+ export class Subscriptions extends APIResource {
9
+ /**
10
+ * Registers a push subscription for a visitor. Upserts by endpoint to handle
11
+ * re-subscriptions gracefully.
12
+ */
13
+ create(body: SubscriptionCreateParams, options?: RequestOptions): APIPromise<SubscriptionCreateResponse> {
14
+ return this._client.post('/v1/push-notifications/subscriptions', { body, ...options });
15
+ }
16
+
17
+ /**
18
+ * Removes a push subscription by ID.
19
+ */
20
+ delete(id: string, options?: RequestOptions): APIPromise<SubscriptionDeleteResponse> {
21
+ return this._client.delete(path`/v1/push-notifications/subscriptions/${id}`, options);
22
+ }
23
+ }
24
+
25
+ /**
26
+ * The created or updated subscription.
27
+ */
28
+ export interface SubscriptionCreateResponse {
29
+ /**
30
+ * Subscription ID
31
+ */
32
+ id: string;
33
+ }
34
+
35
+ /**
36
+ * Result of the unsubscribe operation.
37
+ */
38
+ export interface SubscriptionDeleteResponse {
39
+ /**
40
+ * Whether the subscription was removed
41
+ */
42
+ success: boolean;
43
+ }
44
+
45
+ export interface SubscriptionCreateParams {
46
+ /**
47
+ * Web Push subscription object from pushManager.subscribe()
48
+ */
49
+ subscription: SubscriptionCreateParams.Subscription;
50
+
51
+ /**
52
+ * Unique identifier for the subscriber (e.g., userId)
53
+ */
54
+ visitorId: string;
55
+ }
56
+
57
+ export namespace SubscriptionCreateParams {
58
+ /**
59
+ * Web Push subscription object from pushManager.subscribe()
60
+ */
61
+ export interface Subscription {
62
+ /**
63
+ * Push service endpoint URL
64
+ */
65
+ endpoint: string;
66
+
67
+ keys: Subscription.Keys;
68
+
69
+ /**
70
+ * Subscription expiration timestamp
71
+ */
72
+ expirationTime?: number | null;
73
+ }
74
+
75
+ export namespace Subscription {
76
+ export interface Keys {
77
+ /**
78
+ * Authentication secret (base64url encoded)
79
+ */
80
+ auth: string;
81
+
82
+ /**
83
+ * P-256 Diffie-Hellman public key (base64url encoded)
84
+ */
85
+ p256dh: string;
86
+ }
87
+ }
88
+ }
89
+
90
+ export declare namespace Subscriptions {
91
+ export {
92
+ type SubscriptionCreateResponse as SubscriptionCreateResponse,
93
+ type SubscriptionDeleteResponse as SubscriptionDeleteResponse,
94
+ type SubscriptionCreateParams as SubscriptionCreateParams,
95
+ };
96
+ }
@@ -0,0 +1,3 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ export * from './push-notifications/index';
package/src/version.ts CHANGED
@@ -1 +1 @@
1
- export const VERSION = '1.3.0'; // x-release-please-version
1
+ export const VERSION = '1.5.0'; // x-release-please-version
package/version.d.mts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "1.3.0";
1
+ export declare const VERSION = "1.5.0";
2
2
  //# sourceMappingURL=version.d.mts.map
package/version.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "1.3.0";
1
+ export declare const VERSION = "1.5.0";
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 = '1.3.0'; // x-release-please-version
4
+ exports.VERSION = '1.5.0'; // x-release-please-version
5
5
  //# sourceMappingURL=version.js.map
package/version.mjs CHANGED
@@ -1,2 +1,2 @@
1
- export const VERSION = '1.3.0'; // x-release-please-version
1
+ export const VERSION = '1.5.0'; // x-release-please-version
2
2
  //# sourceMappingURL=version.mjs.map