@takeal/cusfront-sdk 0.2.8 → 0.3.7

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 (77) hide show
  1. package/CHANGELOG.md +100 -0
  2. package/README.md +367 -5
  3. package/dist/devices-C3JHi2Hi.d.cts +165 -0
  4. package/dist/devices-DP_hxwmW.d.ts +165 -0
  5. package/dist/{http-BkCfOCR0.d.cts → http-B-OQwMYn.d.cts} +9 -1
  6. package/dist/{http-BkCfOCR0.d.ts → http-B-OQwMYn.d.ts} +9 -1
  7. package/dist/index.cjs +284 -20
  8. package/dist/index.cjs.map +1 -1
  9. package/dist/index.d.cts +65 -9
  10. package/dist/index.d.ts +65 -9
  11. package/dist/index.js +280 -21
  12. package/dist/index.js.map +1 -1
  13. package/dist/react/index.cjs +133 -6
  14. package/dist/react/index.cjs.map +1 -1
  15. package/dist/react/index.d.cts +62 -3
  16. package/dist/react/index.d.ts +62 -3
  17. package/dist/react/index.js +131 -8
  18. package/dist/react/index.js.map +1 -1
  19. package/dist/resources/auth.cjs +36 -11
  20. package/dist/resources/auth.cjs.map +1 -1
  21. package/dist/resources/auth.d.cts +57 -5
  22. package/dist/resources/auth.d.ts +57 -5
  23. package/dist/resources/auth.js +36 -11
  24. package/dist/resources/auth.js.map +1 -1
  25. package/dist/resources/balance.d.cts +1 -1
  26. package/dist/resources/balance.d.ts +1 -1
  27. package/dist/resources/blog.d.cts +1 -1
  28. package/dist/resources/blog.d.ts +1 -1
  29. package/dist/resources/branding.d.cts +1 -1
  30. package/dist/resources/branding.d.ts +1 -1
  31. package/dist/resources/cards.cjs +33 -1
  32. package/dist/resources/cards.cjs.map +1 -1
  33. package/dist/resources/cards.d.cts +111 -4
  34. package/dist/resources/cards.d.ts +111 -4
  35. package/dist/resources/cards.js +33 -1
  36. package/dist/resources/cards.js.map +1 -1
  37. package/dist/resources/deposits.d.cts +1 -1
  38. package/dist/resources/deposits.d.ts +1 -1
  39. package/dist/resources/devices.cjs +92 -0
  40. package/dist/resources/devices.cjs.map +1 -0
  41. package/dist/resources/devices.d.cts +3 -0
  42. package/dist/resources/devices.d.ts +3 -0
  43. package/dist/resources/devices.js +89 -0
  44. package/dist/resources/devices.js.map +1 -0
  45. package/dist/resources/me.cjs +32 -0
  46. package/dist/resources/me.cjs.map +1 -0
  47. package/dist/resources/me.d.cts +40 -0
  48. package/dist/resources/me.d.ts +40 -0
  49. package/dist/resources/me.js +30 -0
  50. package/dist/resources/me.js.map +1 -0
  51. package/dist/resources/notifications.cjs +57 -0
  52. package/dist/resources/notifications.cjs.map +1 -0
  53. package/dist/resources/notifications.d.cts +133 -0
  54. package/dist/resources/notifications.d.ts +133 -0
  55. package/dist/resources/notifications.js +54 -0
  56. package/dist/resources/notifications.js.map +1 -0
  57. package/dist/resources/push.cjs +8 -4
  58. package/dist/resources/push.cjs.map +1 -1
  59. package/dist/resources/push.d.cts +14 -17
  60. package/dist/resources/push.d.ts +14 -17
  61. package/dist/resources/push.js +8 -4
  62. package/dist/resources/push.js.map +1 -1
  63. package/dist/resources/sessions.d.cts +1 -1
  64. package/dist/resources/sessions.d.ts +1 -1
  65. package/dist/resources/subscriptions.cjs.map +1 -1
  66. package/dist/resources/subscriptions.d.cts +8 -1
  67. package/dist/resources/subscriptions.d.ts +8 -1
  68. package/dist/resources/subscriptions.js.map +1 -1
  69. package/dist/resources/wallet.d.cts +1 -1
  70. package/dist/resources/wallet.d.ts +1 -1
  71. package/dist/telegram.cjs +321 -23
  72. package/dist/telegram.cjs.map +1 -1
  73. package/dist/telegram.d.cts +62 -7
  74. package/dist/telegram.d.ts +62 -7
  75. package/dist/telegram.js +320 -24
  76. package/dist/telegram.js.map +1 -1
  77. package/package.json +23 -4
@@ -0,0 +1,54 @@
1
+ // src/resources/notifications.ts
2
+ function isCardOtp(item) {
3
+ return item.event_type === "card_otp" && typeof item.data?.otp === "string";
4
+ }
5
+ var NotificationsResource = class {
6
+ constructor(http) {
7
+ this.http = http;
8
+ }
9
+ /** One page of the inbox, newest first. */
10
+ async list(params = {}) {
11
+ const q = new URLSearchParams();
12
+ if (params.cursor) q.set("cursor", params.cursor);
13
+ if (params.limit !== void 0) q.set("limit", String(params.limit));
14
+ if (params.unreadOnly) q.set("unread", "true");
15
+ if (params.category) q.set("category", params.category);
16
+ const qs = q.toString();
17
+ return this.http.get(`/me/notifications${qs ? `?${qs}` : ""}`);
18
+ }
19
+ /** How many items are unread. Cheap; fine to poll for a badge. */
20
+ async unreadCount() {
21
+ const { unread } = await this.http.get("/me/notifications/unread-count");
22
+ return unread;
23
+ }
24
+ /** Mark one item read. Returns the item; calling it again is harmless. */
25
+ async markRead(id) {
26
+ return this.http.post(`/me/notifications/${encodeURIComponent(id)}/read`);
27
+ }
28
+ /** Mark every unread item read, or only those created before `before`
29
+ * (ISO timestamp). Returns how many changed. */
30
+ async markAllRead(before) {
31
+ return this.http.post("/me/notifications/read-all", {
32
+ body: before ? { before } : {}
33
+ });
34
+ }
35
+ /** Delete one item. 404 when it isn't the user's. */
36
+ async remove(id) {
37
+ await this.http.delete(`/me/notifications/${encodeURIComponent(id)}`);
38
+ }
39
+ /** The user's channel and language settings. */
40
+ async getPreferences() {
41
+ return this.http.get("/me/notification-preferences");
42
+ }
43
+ /** Change some settings; the rest stay. Returns the stored view.
44
+ * 400 `validation` for an unknown category, channel or locale. */
45
+ async setPreferences(input) {
46
+ return this.http.put("/me/notification-preferences", {
47
+ body: input
48
+ });
49
+ }
50
+ };
51
+
52
+ export { NotificationsResource, isCardOtp };
53
+ //# sourceMappingURL=notifications.js.map
54
+ //# sourceMappingURL=notifications.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/resources/notifications.ts"],"names":[],"mappings":";AAmDO,SAAS,UACd,IAAA,EACmE;AACnE,EAAA,OAAO,KAAK,UAAA,KAAe,UAAA,IAAc,OAAO,IAAA,CAAK,MAAM,GAAA,KAAQ,QAAA;AACrE;AAqEO,IAAM,wBAAN,MAA4B;AAAA,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A,EAA8B;AAAA,MACtE,IAAA,EAAM,MAAA,GAAS,EAAE,MAAA,KAAW;AAAC,KAC9B,CAAA;AAAA,EACH;AAAA;AAAA,EAGA,MAAM,OAAO,EAAA,EAA2B;AACtC,IAAA,MAAM,KAAK,IAAA,CAAK,MAAA,CAAa,qBAAqB,kBAAA,CAAmB,EAAE,CAAC,CAAA,CAAE,CAAA;AAAA,EAC5E;AAAA;AAAA,EAGA,MAAM,cAAA,GAAmD;AACvD,IAAA,OAAO,IAAA,CAAK,IAAA,CAAK,GAAA,CAA6B,8BAA8B,CAAA;AAAA,EAC9E;AAAA;AAAA;AAAA,EAIA,MAAM,eAAe,KAAA,EAAuE;AAC1F,IAAA,OAAO,IAAA,CAAK,IAAA,CAAK,GAAA,CAA6B,8BAAA,EAAgC;AAAA,MAC5E,IAAA,EAAM;AAAA,KACP,CAAA;AAAA,EACH;AACF","file":"notifications.js","sourcesContent":["import type { HttpClient } from \"../http.js\";\n\n/**\n * Notifications resource — `client.notifications.*`.\n *\n * Every notification a user gets is also kept server-side as an inbox item,\n * whatever else was sent (a push, a Telegram message, an email). The inbox\n * is what the app shows; the other channels are the nudge to open it.\n *\n * ```ts\n * const page = await client.notifications.list({ limit: 20 });\n * for (const item of page.items) {\n * render(item.title, item.body, item.href); // href: a path inside your app, or null\n * }\n * await client.notifications.markRead(page.items[0].id);\n * ```\n *\n * Preferences decide where the nudge goes: a primary channel (or automatic\n * when `null`), per-category switches, and the user's language.\n */\n\n/** What an item is about. `security` and `money` can't be switched off\n * completely; `marketing` is off until the user opts in. */\nexport type NotificationCategory = \"money\" | \"card\" | \"security\" | \"account\" | \"marketing\";\n\n/** A way to reach the user outside the inbox. */\nexport type NotificationChannel = \"push\" | \"telegram\" | \"email\" | \"sms\";\n\n/** Language the user reads notifications in. */\nexport type NotificationLocale = \"en\" | \"ru\" | (string & {});\n\n/**\n * `data` of a `card_otp` item: a confirmation code the card issuer sent for a\n * 3-D Secure payment (`purpose: \"payment\"`) or for adding the card to Apple\n * Pay / Google Pay (`purpose: \"wallet\"`). The code is what the user needs\n * right now, so show it prominently with a copy button and a countdown from\n * `expires_in_minutes`; `merchant_name`, `amount` and `currency` are absent\n * for wallet codes. Narrow with `isCardOtp(item)`.\n */\nexport interface CardOtpData {\n otp: string;\n purpose: \"payment\" | \"wallet\";\n merchant_name?: string;\n amount?: string;\n currency?: string;\n last4?: string;\n card_id?: string;\n expires_in_minutes?: number;\n}\n\n/** True when the item carries a card confirmation code (`CardOtpData`). */\nexport function isCardOtp(\n item: InboxItem,\n): item is InboxItem & { event_type: \"card_otp\"; data: CardOtpData } {\n return item.event_type === \"card_otp\" && typeof item.data?.otp === \"string\";\n}\n\nexport interface InboxItem {\n id: string;\n /** What happened, e.g. `deposit_confirmed`, `card_transaction`,\n * `login_new_device`, `card_otp` (see `CardOtpData`). */\n event_type: string;\n category: NotificationCategory;\n title: string;\n body: string;\n /** A path inside the client app to open on tap (`/cards/<id>`,\n * `/deposits/<id>`, `/subscription`, `/settings/sessions`), or `null`. */\n href: string | null;\n /** Event details (amount, currency, card last four and so on); the keys\n * depend on `event_type`. */\n data: Record<string, unknown>;\n /** Language the item was rendered in. */\n locale: string;\n /** When the user read it, or `null` while unread. */\n read_at: string | null;\n created_at: string;\n}\n\nexport interface NotificationPage {\n /** Newest first. */\n items: InboxItem[];\n /** Pass back as `cursor` to get the next page; `null` on the last one. */\n next_cursor: string | null;\n /** Unread items across the whole inbox, not just this page. */\n unread_count: number;\n}\n\nexport interface ListNotificationsParams {\n /** `next_cursor` from the previous page. */\n cursor?: string;\n /** Page size; the server caps it. */\n limit?: number;\n /** Only items without `read_at`. */\n unreadOnly?: boolean;\n category?: NotificationCategory;\n}\n\n/** Per-category channel switches: `{ money: { push: true, email: false } }`.\n * A channel missing from a category keeps its default. */\nexport type NotificationCategoryPreferences = Partial<\n Record<NotificationCategory, Partial<Record<NotificationChannel, boolean>>>\n>;\n\nexport interface NotificationPreferences {\n /** The channel to use first; `null` means automatic (the server picks by\n * the user's devices). */\n primary_channel: NotificationChannel | null;\n categories: NotificationCategoryPreferences;\n /** `null` when unset: the server falls back to the Telegram profile's\n * language, then the deployment default. */\n locale: NotificationLocale | null;\n /** Channels this deployment can deliver on. Render toggles only for\n * these. */\n available_channels: NotificationChannel[];\n}\n\n/** Body of `setPreferences`. Every field is optional; only the given ones\n * change. `primary_channel: null` switches back to automatic. */\nexport interface NotificationPreferencesInput {\n primary_channel?: NotificationChannel | null;\n categories?: NotificationCategoryPreferences;\n locale?: NotificationLocale | null;\n}\n\nexport class NotificationsResource {\n constructor(private readonly http: HttpClient) {}\n\n /** One page of the inbox, newest first. */\n async list(params: ListNotificationsParams = {}): Promise<NotificationPage> {\n const q = new URLSearchParams();\n if (params.cursor) q.set(\"cursor\", params.cursor);\n if (params.limit !== undefined) q.set(\"limit\", String(params.limit));\n if (params.unreadOnly) q.set(\"unread\", \"true\");\n if (params.category) q.set(\"category\", params.category);\n const qs = q.toString();\n return this.http.get<NotificationPage>(`/me/notifications${qs ? `?${qs}` : \"\"}`);\n }\n\n /** How many items are unread. Cheap; fine to poll for a badge. */\n async unreadCount(): Promise<number> {\n const { unread } = await this.http.get<{ unread: number }>(\"/me/notifications/unread-count\");\n return unread;\n }\n\n /** Mark one item read. Returns the item; calling it again is harmless. */\n async markRead(id: string): Promise<InboxItem> {\n return this.http.post<InboxItem>(`/me/notifications/${encodeURIComponent(id)}/read`);\n }\n\n /** Mark every unread item read, or only those created before `before`\n * (ISO timestamp). Returns how many changed. */\n async markAllRead(before?: string): Promise<{ marked: number }> {\n return this.http.post<{ marked: number }>(\"/me/notifications/read-all\", {\n body: before ? { before } : {},\n });\n }\n\n /** Delete one item. 404 when it isn't the user's. */\n async remove(id: string): Promise<void> {\n await this.http.delete<void>(`/me/notifications/${encodeURIComponent(id)}`);\n }\n\n /** The user's channel and language settings. */\n async getPreferences(): Promise<NotificationPreferences> {\n return this.http.get<NotificationPreferences>(\"/me/notification-preferences\");\n }\n\n /** Change some settings; the rest stay. Returns the stored view.\n * 400 `validation` for an unknown category, channel or locale. */\n async setPreferences(input: NotificationPreferencesInput): Promise<NotificationPreferences> {\n return this.http.put<NotificationPreferences>(\"/me/notification-preferences\", {\n body: input,\n });\n }\n}\n"]}
@@ -10,17 +10,20 @@ var PushResource = class {
10
10
  return this.http.get("/me/push-subscription");
11
11
  }
12
12
  /** Store a subscription you created yourself.
13
- * 409 `push_disabled` when the deployment has no VAPID keys. */
13
+ * 409 `push_disabled` when the deployment has no VAPID keys.
14
+ * @deprecated Use `client.devices.register({ kind: "webpush", ... })`. */
14
15
  async save(input) {
15
16
  return this.http.put("/me/push-subscription", { body: input });
16
17
  }
17
- /** Delete the stored subscription. Safe when nothing is stored. */
18
+ /** Delete the stored subscription. Safe when nothing is stored.
19
+ * @deprecated Use `client.devices.remove(id)` or `client.devices.unregisterWebPush(reg)`. */
18
20
  async remove() {
19
21
  await this.http.delete("/me/push-subscription");
20
22
  }
21
23
  /** Subscribe this browser and store the subscription. Ask for
22
24
  * notification permission before calling. Throws when push isn't set up
23
- * on the deployment. */
25
+ * on the deployment.
26
+ * @deprecated Use `client.devices.registerWebPush(registration)`. */
24
27
  async enable(registration) {
25
28
  const { vapid_public_key } = await this.status();
26
29
  if (!vapid_public_key) {
@@ -39,7 +42,8 @@ var PushResource = class {
39
42
  keys: { p256dh: json.keys.p256dh, auth: json.keys.auth }
40
43
  });
41
44
  }
42
- /** Unsubscribe this browser and delete the stored subscription. */
45
+ /** Unsubscribe this browser and delete the stored subscription.
46
+ * @deprecated Use `client.devices.unregisterWebPush(registration)`. */
43
47
  async disable(registration) {
44
48
  const sub = await registration.pushManager.getSubscription();
45
49
  if (sub) await sub.unsubscribe();
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/resources/push.ts"],"names":[],"mappings":";;;AAuDO,IAAM,eAAN,MAAmB;AAAA,EACxB,YAA6B,IAAA,EAAkB;AAAlB,IAAA,IAAA,CAAA,IAAA,GAAA,IAAA;AAAA,EAAmB;AAAA;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GA,MAAM,QAAQ,YAAA,EAAsD;AAClE,IAAA,MAAM,GAAA,GAAM,MAAM,YAAA,CAAa,WAAA,CAAY,eAAA,EAAgB;AAC3D,IAAA,IAAI,GAAA,EAAK,MAAM,GAAA,CAAI,WAAA,EAAY;AAC/B,IAAA,MAAM,KAAK,MAAA,EAAO;AAAA,EACpB;AACF;AAGO,SAAS,iBAAiB,KAAA,EAA2B;AAC1D,EAAA,MAAM,GAAA,GAAM,MAAM,OAAA,CAAQ,IAAA,EAAM,GAAG,CAAA,CAAE,OAAA,CAAQ,MAAM,GAAG,CAAA;AACtD,EAAA,MAAM,MAAA,GAAS,MAAM,GAAA,CAAI,MAAA,CAAA,CAAQ,IAAK,GAAA,CAAI,MAAA,GAAS,KAAM,CAAC,CAAA;AAC1D,EAAA,MAAM,GAAA,GAAM,KAAK,MAAM,CAAA;AACvB,EAAA,MAAM,GAAA,GAAM,IAAI,UAAA,CAAW,GAAA,CAAI,MAAM,CAAA;AACrC,EAAA,KAAA,IAAS,CAAA,GAAI,CAAA,EAAG,CAAA,GAAI,GAAA,CAAI,MAAA,EAAQ,CAAA,EAAA,EAAK,GAAA,CAAI,CAAC,CAAA,GAAI,GAAA,CAAI,UAAA,CAAW,CAAC,CAAA;AAC9D,EAAA,OAAO,GAAA;AACT","file":"push.cjs","sourcesContent":["import type { HttpClient } from \"../http.js\";\n\n/**\n * Push resource — `client.push.*`.\n *\n * Web Push for the signed-in user. The API keeps one subscription per user\n * (the newest wins) and sends a notification for the user's own events:\n * a confirmed deposit, a card transaction and so on.\n *\n * The usual browser flow is one call:\n *\n * ```ts\n * const reg = await navigator.serviceWorker.ready;\n * if ((await Notification.requestPermission()) === \"granted\") {\n * await client.push.enable(reg);\n * }\n * ```\n *\n * Your service worker shows the notification: the payload is JSON with\n * `title`, `body` and `url` (where a click should lead).\n */\n\nexport interface PushStatus {\n /** `true` when a subscription is stored for this user. */\n subscribed: boolean;\n /** Host of the stored endpoint, e.g. `fcm.googleapis.com`. */\n endpoint_host?: string | null;\n /** VAPID public key (URL-safe base64) for `pushManager.subscribe`.\n * `null` when push is not set up on this deployment. */\n vapid_public_key?: string | null;\n}\n\nexport interface PushSubscriptionInput {\n /** `PushSubscription.endpoint`; must be https. */\n endpoint: string;\n keys: {\n /** URL-safe base64. */\n p256dh: string;\n /** URL-safe base64. */\n auth: string;\n };\n}\n\n/** The part of `ServiceWorkerRegistration` the SDK needs. Typed\n * structurally so the core stays free of DOM lib types. */\nexport interface PushCapableRegistration {\n pushManager: {\n getSubscription(): Promise<{ unsubscribe(): Promise<boolean> } | null>;\n subscribe(options: {\n userVisibleOnly: boolean;\n applicationServerKey: Uint8Array;\n }): Promise<{ toJSON(): { endpoint?: string; keys?: Record<string, string> } }>;\n };\n}\n\nexport class PushResource {\n constructor(private readonly http: HttpClient) {}\n\n /** Whether the user is subscribed, plus the VAPID key to subscribe with. */\n async status(): Promise<PushStatus> {\n return this.http.get<PushStatus>(\"/me/push-subscription\");\n }\n\n /** Store a subscription you created yourself.\n * 409 `push_disabled` when the deployment has no VAPID keys. */\n async save(input: PushSubscriptionInput): Promise<PushStatus> {\n return this.http.put<PushStatus>(\"/me/push-subscription\", { body: input });\n }\n\n /** Delete the stored subscription. Safe when nothing is stored. */\n async remove(): Promise<void> {\n await this.http.delete<void>(\"/me/push-subscription\");\n }\n\n /** Subscribe this browser and store the subscription. Ask for\n * notification permission before calling. Throws when push isn't set up\n * on the deployment. */\n async enable(registration: PushCapableRegistration): Promise<PushStatus> {\n const { vapid_public_key } = await this.status();\n if (!vapid_public_key) {\n throw new Error(\"@takeal/cusfront-sdk: push notifications are not enabled on this deployment\");\n }\n const sub = await registration.pushManager.subscribe({\n userVisibleOnly: true,\n applicationServerKey: base64UrlToBytes(vapid_public_key),\n });\n const json = sub.toJSON();\n if (!json.endpoint || !json.keys?.p256dh || !json.keys.auth) {\n throw new Error(\"@takeal/cusfront-sdk: the browser returned an incomplete push subscription\");\n }\n return this.save({\n endpoint: json.endpoint,\n keys: { p256dh: json.keys.p256dh, auth: json.keys.auth },\n });\n }\n\n /** Unsubscribe this browser and delete the stored subscription. */\n async disable(registration: PushCapableRegistration): Promise<void> {\n const sub = await registration.pushManager.getSubscription();\n if (sub) await sub.unsubscribe();\n await this.remove();\n }\n}\n\n/** URL-safe base64 (padding optional) → bytes. */\nexport function base64UrlToBytes(input: string): Uint8Array {\n const b64 = input.replace(/-/g, \"+\").replace(/_/g, \"/\");\n const padded = b64 + \"=\".repeat((4 - (b64.length % 4)) % 4);\n const bin = atob(padded);\n const out = new Uint8Array(bin.length);\n for (let i = 0; i < bin.length; i++) out[i] = bin.charCodeAt(i);\n return out;\n}\n"]}
1
+ {"version":3,"sources":["../../src/resources/push.ts"],"names":[],"mappings":";;;AAgDO,IAAM,eAAN,MAAmB;AAAA,EACxB,YAA6B,IAAA,EAAkB;AAAlB,IAAA,IAAA,CAAA,IAAA,GAAA,IAAA;AAAA,EAAmB;AAAA;AAAA,EAGhD,MAAM,MAAA,GAA8B;AAClC,IAAA,OAAO,IAAA,CAAK,IAAA,CAAK,GAAA,CAAgB,uBAAuB,CAAA;AAAA,EAC1D;AAAA;AAAA;AAAA;AAAA,EAKA,MAAM,KAAK,KAAA,EAAmD;AAC5D,IAAA,OAAO,KAAK,IAAA,CAAK,GAAA,CAAgB,yBAAyB,EAAE,IAAA,EAAM,OAAO,CAAA;AAAA,EAC3E;AAAA;AAAA;AAAA,EAIA,MAAM,MAAA,GAAwB;AAC5B,IAAA,MAAM,IAAA,CAAK,IAAA,CAAK,MAAA,CAAa,uBAAuB,CAAA;AAAA,EACtD;AAAA;AAAA;AAAA;AAAA;AAAA,EAMA,MAAM,OAAO,YAAA,EAA4D;AACvE,IAAA,MAAM,EAAE,gBAAA,EAAiB,GAAI,MAAM,KAAK,MAAA,EAAO;AAC/C,IAAA,IAAI,CAAC,gBAAA,EAAkB;AACrB,MAAA,MAAM,IAAI,MAAM,6EAA6E,CAAA;AAAA,IAC/F;AACA,IAAA,MAAM,GAAA,G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CAAA,GAAI,CAAA,EAAG,CAAA,GAAI,GAAA,CAAI,MAAA,EAAQ,CAAA,EAAA,EAAK,GAAA,CAAI,CAAC,CAAA,GAAI,GAAA,CAAI,UAAA,CAAW,CAAC,CAAA;AAC9D,EAAA,OAAO,GAAA;AACT","file":"push.cjs","sourcesContent":["import type { HttpClient } from \"../http.js\";\n\n/**\n * Push resource — `client.push.*`.\n *\n * Web Push for the signed-in user, through the older single-subscription\n * endpoint. The API now keeps one device per browser (see\n * `client.devices`), and this endpoint is an alias over the Web Push\n * devices: it keeps working, but new code should call\n * `client.devices.registerWebPush(reg)` / `unregisterWebPush(reg)` instead.\n *\n * Your service worker shows the notification: the payload is JSON with\n * `title`, `body` and `url` (where a click should lead).\n */\n\nexport interface PushStatus {\n /** `true` when a subscription is stored for this user. */\n subscribed: boolean;\n /** Host of the stored endpoint, e.g. `fcm.googleapis.com`. */\n endpoint_host?: string | null;\n /** VAPID public key (URL-safe base64) for `pushManager.subscribe`.\n * `null` when push is not set up on this deployment. */\n vapid_public_key?: string | null;\n}\n\nexport interface PushSubscriptionInput {\n /** `PushSubscription.endpoint`; must be https. */\n endpoint: string;\n keys: {\n /** URL-safe base64. */\n p256dh: string;\n /** URL-safe base64. */\n auth: string;\n };\n}\n\n/** The part of `ServiceWorkerRegistration` the SDK needs. Typed\n * structurally so the core stays free of DOM lib types. */\nexport interface PushCapableRegistration {\n pushManager: {\n getSubscription(): Promise<{ unsubscribe(): Promise<boolean> } | null>;\n subscribe(options: {\n userVisibleOnly: boolean;\n applicationServerKey: Uint8Array;\n }): Promise<{ toJSON(): { endpoint?: string; keys?: Record<string, string> } }>;\n };\n}\n\nexport class PushResource {\n constructor(private readonly http: HttpClient) {}\n\n /** Whether the user is subscribed, plus the VAPID key to subscribe with. */\n async status(): Promise<PushStatus> {\n return this.http.get<PushStatus>(\"/me/push-subscription\");\n }\n\n /** Store a subscription you created yourself.\n * 409 `push_disabled` when the deployment has no VAPID keys.\n * @deprecated Use `client.devices.register({ kind: \"webpush\", ... })`. */\n async save(input: PushSubscriptionInput): Promise<PushStatus> {\n return this.http.put<PushStatus>(\"/me/push-subscription\", { body: input });\n }\n\n /** Delete the stored subscription. Safe when nothing is stored.\n * @deprecated Use `client.devices.remove(id)` or `client.devices.unregisterWebPush(reg)`. */\n async remove(): Promise<void> {\n await this.http.delete<void>(\"/me/push-subscription\");\n }\n\n /** Subscribe this browser and store the subscription. Ask for\n * notification permission before calling. Throws when push isn't set up\n * on the deployment.\n * @deprecated Use `client.devices.registerWebPush(registration)`. */\n async enable(registration: PushCapableRegistration): Promise<PushStatus> {\n const { vapid_public_key } = await this.status();\n if (!vapid_public_key) {\n throw new Error(\"@takeal/cusfront-sdk: push notifications are not enabled on this deployment\");\n }\n const sub = await registration.pushManager.subscribe({\n userVisibleOnly: true,\n applicationServerKey: base64UrlToBytes(vapid_public_key),\n });\n const json = sub.toJSON();\n if (!json.endpoint || !json.keys?.p256dh || !json.keys.auth) {\n throw new Error(\"@takeal/cusfront-sdk: the browser returned an incomplete push subscription\");\n }\n return this.save({\n endpoint: json.endpoint,\n keys: { p256dh: json.keys.p256dh, auth: json.keys.auth },\n });\n }\n\n /** Unsubscribe this browser and delete the stored subscription.\n * @deprecated Use `client.devices.unregisterWebPush(registration)`. */\n async disable(registration: PushCapableRegistration): Promise<void> {\n const sub = await registration.pushManager.getSubscription();\n if (sub) await sub.unsubscribe();\n await this.remove();\n }\n}\n\n/** URL-safe base64 (padding optional) → bytes. */\nexport function base64UrlToBytes(input: string): Uint8Array {\n const b64 = input.replace(/-/g, \"+\").replace(/_/g, \"/\");\n const padded = b64 + \"=\".repeat((4 - (b64.length % 4)) % 4);\n const bin = atob(padded);\n const out = new Uint8Array(bin.length);\n for (let i = 0; i < bin.length; i++) out[i] = bin.charCodeAt(i);\n return out;\n}\n"]}
@@ -1,20 +1,13 @@
1
- import { H as HttpClient } from '../http-BkCfOCR0.cjs';
1
+ import { H as HttpClient } from '../http-B-OQwMYn.cjs';
2
2
 
3
3
  /**
4
4
  * Push resource — `client.push.*`.
5
5
  *
6
- * Web Push for the signed-in user. The API keeps one subscription per user
7
- * (the newest wins) and sends a notification for the user's own events:
8
- * a confirmed deposit, a card transaction and so on.
9
- *
10
- * The usual browser flow is one call:
11
- *
12
- * ```ts
13
- * const reg = await navigator.serviceWorker.ready;
14
- * if ((await Notification.requestPermission()) === "granted") {
15
- * await client.push.enable(reg);
16
- * }
17
- * ```
6
+ * Web Push for the signed-in user, through the older single-subscription
7
+ * endpoint. The API now keeps one device per browser (see
8
+ * `client.devices`), and this endpoint is an alias over the Web Push
9
+ * devices: it keeps working, but new code should call
10
+ * `client.devices.registerWebPush(reg)` / `unregisterWebPush(reg)` instead.
18
11
  *
19
12
  * Your service worker shows the notification: the payload is JSON with
20
13
  * `title`, `body` and `url` (where a click should lead).
@@ -62,15 +55,19 @@ declare class PushResource {
62
55
  /** Whether the user is subscribed, plus the VAPID key to subscribe with. */
63
56
  status(): Promise<PushStatus>;
64
57
  /** Store a subscription you created yourself.
65
- * 409 `push_disabled` when the deployment has no VAPID keys. */
58
+ * 409 `push_disabled` when the deployment has no VAPID keys.
59
+ * @deprecated Use `client.devices.register({ kind: "webpush", ... })`. */
66
60
  save(input: PushSubscriptionInput): Promise<PushStatus>;
67
- /** Delete the stored subscription. Safe when nothing is stored. */
61
+ /** Delete the stored subscription. Safe when nothing is stored.
62
+ * @deprecated Use `client.devices.remove(id)` or `client.devices.unregisterWebPush(reg)`. */
68
63
  remove(): Promise<void>;
69
64
  /** Subscribe this browser and store the subscription. Ask for
70
65
  * notification permission before calling. Throws when push isn't set up
71
- * on the deployment. */
66
+ * on the deployment.
67
+ * @deprecated Use `client.devices.registerWebPush(registration)`. */
72
68
  enable(registration: PushCapableRegistration): Promise<PushStatus>;
73
- /** Unsubscribe this browser and delete the stored subscription. */
69
+ /** Unsubscribe this browser and delete the stored subscription.
70
+ * @deprecated Use `client.devices.unregisterWebPush(registration)`. */
74
71
  disable(registration: PushCapableRegistration): Promise<void>;
75
72
  }
76
73
  /** URL-safe base64 (padding optional) → bytes. */
@@ -1,20 +1,13 @@
1
- import { H as HttpClient } from '../http-BkCfOCR0.js';
1
+ import { H as HttpClient } from '../http-B-OQwMYn.js';
2
2
 
3
3
  /**
4
4
  * Push resource — `client.push.*`.
5
5
  *
6
- * Web Push for the signed-in user. The API keeps one subscription per user
7
- * (the newest wins) and sends a notification for the user's own events:
8
- * a confirmed deposit, a card transaction and so on.
9
- *
10
- * The usual browser flow is one call:
11
- *
12
- * ```ts
13
- * const reg = await navigator.serviceWorker.ready;
14
- * if ((await Notification.requestPermission()) === "granted") {
15
- * await client.push.enable(reg);
16
- * }
17
- * ```
6
+ * Web Push for the signed-in user, through the older single-subscription
7
+ * endpoint. The API now keeps one device per browser (see
8
+ * `client.devices`), and this endpoint is an alias over the Web Push
9
+ * devices: it keeps working, but new code should call
10
+ * `client.devices.registerWebPush(reg)` / `unregisterWebPush(reg)` instead.
18
11
  *
19
12
  * Your service worker shows the notification: the payload is JSON with
20
13
  * `title`, `body` and `url` (where a click should lead).
@@ -62,15 +55,19 @@ declare class PushResource {
62
55
  /** Whether the user is subscribed, plus the VAPID key to subscribe with. */
63
56
  status(): Promise<PushStatus>;
64
57
  /** Store a subscription you created yourself.
65
- * 409 `push_disabled` when the deployment has no VAPID keys. */
58
+ * 409 `push_disabled` when the deployment has no VAPID keys.
59
+ * @deprecated Use `client.devices.register({ kind: "webpush", ... })`. */
66
60
  save(input: PushSubscriptionInput): Promise<PushStatus>;
67
- /** Delete the stored subscription. Safe when nothing is stored. */
61
+ /** Delete the stored subscription. Safe when nothing is stored.
62
+ * @deprecated Use `client.devices.remove(id)` or `client.devices.unregisterWebPush(reg)`. */
68
63
  remove(): Promise<void>;
69
64
  /** Subscribe this browser and store the subscription. Ask for
70
65
  * notification permission before calling. Throws when push isn't set up
71
- * on the deployment. */
66
+ * on the deployment.
67
+ * @deprecated Use `client.devices.registerWebPush(registration)`. */
72
68
  enable(registration: PushCapableRegistration): Promise<PushStatus>;
73
- /** Unsubscribe this browser and delete the stored subscription. */
69
+ /** Unsubscribe this browser and delete the stored subscription.
70
+ * @deprecated Use `client.devices.unregisterWebPush(registration)`. */
74
71
  disable(registration: PushCapableRegistration): Promise<void>;
75
72
  }
76
73
  /** URL-safe base64 (padding optional) → bytes. */
@@ -8,17 +8,20 @@ var PushResource = class {
8
8
  return this.http.get("/me/push-subscription");
9
9
  }
10
10
  /** Store a subscription you created yourself.
11
- * 409 `push_disabled` when the deployment has no VAPID keys. */
11
+ * 409 `push_disabled` when the deployment has no VAPID keys.
12
+ * @deprecated Use `client.devices.register({ kind: "webpush", ... })`. */
12
13
  async save(input) {
13
14
  return this.http.put("/me/push-subscription", { body: input });
14
15
  }
15
- /** Delete the stored subscription. Safe when nothing is stored. */
16
+ /** Delete the stored subscription. Safe when nothing is stored.
17
+ * @deprecated Use `client.devices.remove(id)` or `client.devices.unregisterWebPush(reg)`. */
16
18
  async remove() {
17
19
  await this.http.delete("/me/push-subscription");
18
20
  }
19
21
  /** Subscribe this browser and store the subscription. Ask for
20
22
  * notification permission before calling. Throws when push isn't set up
21
- * on the deployment. */
23
+ * on the deployment.
24
+ * @deprecated Use `client.devices.registerWebPush(registration)`. */
22
25
  async enable(registration) {
23
26
  const { vapid_public_key } = await this.status();
24
27
  if (!vapid_public_key) {
@@ -37,7 +40,8 @@ var PushResource = class {
37
40
  keys: { p256dh: json.keys.p256dh, auth: json.keys.auth }
38
41
  });
39
42
  }
40
- /** Unsubscribe this browser and delete the stored subscription. */
43
+ /** Unsubscribe this browser and delete the stored subscription.
44
+ * @deprecated Use `client.devices.unregisterWebPush(registration)`. */
41
45
  async disable(registration) {
42
46
  const sub = await registration.pushManager.getSubscription();
43
47
  if (sub) await sub.unsubscribe();
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/resources/push.ts"],"names":[],"mappings":";AAuDO,IAAM,eAAN,MAAmB;AAAA,EACxB,YAA6B,IAAA,EAAkB;AAAlB,IAAA,IA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AA;AAAK,KACxD,CAAA;AAAA,EACH;AAAA;AAAA,EAGA,MAAM,QAAQ,YAAA,EAAsD;AAClE,IAAA,MAAM,GAAA,GAAM,MAAM,YAAA,CAAa,WAAA,CAAY,eAAA,EAAgB;AAC3D,IAAA,IAAI,GAAA,EAAK,MAAM,GAAA,CAAI,WAAA,EAAY;AAC/B,IAAA,MAAM,KAAK,MAAA,EAAO;AAAA,EACpB;AACF;AAGO,SAAS,iBAAiB,KAAA,EAA2B;AAC1D,EAAA,MAAM,GAAA,GAAM,MAAM,OAAA,CAAQ,IAAA,EAAM,GAAG,CAAA,CAAE,OAAA,CAAQ,MAAM,GAAG,CAAA;AACtD,EAAA,MAAM,MAAA,GAAS,MAAM,GAAA,CAAI,MAAA,CAAA,CAAQ,IAAK,GAAA,CAAI,MAAA,GAAS,KAAM,CAAC,CAAA;AAC1D,EAAA,MAAM,GAAA,GAAM,KAAK,MAAM,CAAA;AACvB,EAAA,MAAM,GAAA,GAAM,IAAI,UAAA,CAAW,GAAA,CAAI,MAAM,CAAA;AACrC,EAAA,KAAA,IAAS,CAAA,GAAI,CAAA,EAAG,CAAA,GAAI,GAAA,CAAI,MAAA,EAAQ,CAAA,EAAA,EAAK,GAAA,CAAI,CAAC,CAAA,GAAI,GAAA,CAAI,UAAA,CAAW,CAAC,CAAA;AAC9D,EAAA,OAAO,GAAA;AACT","file":"push.js","sourcesContent":["import type { HttpClient } from \"../http.js\";\n\n/**\n * Push resource — `client.push.*`.\n *\n * Web Push for the signed-in user. The API keeps one subscription per user\n * (the newest wins) and sends a notification for the user's own events:\n * a confirmed deposit, a card transaction and so on.\n *\n * The usual browser flow is one call:\n *\n * ```ts\n * const reg = await navigator.serviceWorker.ready;\n * if ((await Notification.requestPermission()) === \"granted\") {\n * await client.push.enable(reg);\n * }\n * ```\n *\n * Your service worker shows the notification: the payload is JSON with\n * `title`, `body` and `url` (where a click should lead).\n */\n\nexport interface PushStatus {\n /** `true` when a subscription is stored for this user. */\n subscribed: boolean;\n /** Host of the stored endpoint, e.g. `fcm.googleapis.com`. */\n endpoint_host?: string | null;\n /** VAPID public key (URL-safe base64) for `pushManager.subscribe`.\n * `null` when push is not set up on this deployment. */\n vapid_public_key?: string | null;\n}\n\nexport interface PushSubscriptionInput {\n /** `PushSubscription.endpoint`; must be https. */\n endpoint: string;\n keys: {\n /** URL-safe base64. */\n p256dh: string;\n /** URL-safe base64. */\n auth: string;\n };\n}\n\n/** The part of `ServiceWorkerRegistration` the SDK needs. Typed\n * structurally so the core stays free of DOM lib types. */\nexport interface PushCapableRegistration {\n pushManager: {\n getSubscription(): Promise<{ unsubscribe(): Promise<boolean> } | null>;\n subscribe(options: {\n userVisibleOnly: boolean;\n applicationServerKey: Uint8Array;\n }): Promise<{ toJSON(): { endpoint?: string; keys?: Record<string, string> } }>;\n };\n}\n\nexport class PushResource {\n constructor(private readonly http: HttpClient) {}\n\n /** Whether the user is subscribed, plus the VAPID key to subscribe with. */\n async status(): Promise<PushStatus> {\n return this.http.get<PushStatus>(\"/me/push-subscription\");\n }\n\n /** Store a subscription you created yourself.\n * 409 `push_disabled` when the deployment has no VAPID keys. */\n async save(input: PushSubscriptionInput): Promise<PushStatus> {\n return this.http.put<PushStatus>(\"/me/push-subscription\", { body: input });\n }\n\n /** Delete the stored subscription. Safe when nothing is stored. */\n async remove(): Promise<void> {\n await this.http.delete<void>(\"/me/push-subscription\");\n }\n\n /** Subscribe this browser and store the subscription. Ask for\n * notification permission before calling. Throws when push isn't set up\n * on the deployment. */\n async enable(registration: PushCapableRegistration): Promise<PushStatus> {\n const { vapid_public_key } = await this.status();\n if (!vapid_public_key) {\n throw new Error(\"@takeal/cusfront-sdk: push notifications are not enabled on this deployment\");\n }\n const sub = await registration.pushManager.subscribe({\n userVisibleOnly: true,\n applicationServerKey: base64UrlToBytes(vapid_public_key),\n });\n const json = sub.toJSON();\n if (!json.endpoint || !json.keys?.p256dh || !json.keys.auth) {\n throw new Error(\"@takeal/cusfront-sdk: the browser returned an incomplete push subscription\");\n }\n return this.save({\n endpoint: json.endpoint,\n keys: { p256dh: json.keys.p256dh, auth: json.keys.auth },\n });\n }\n\n /** Unsubscribe this browser and delete the stored subscription. */\n async disable(registration: PushCapableRegistration): Promise<void> {\n const sub = await registration.pushManager.getSubscription();\n if (sub) await sub.unsubscribe();\n await this.remove();\n }\n}\n\n/** URL-safe base64 (padding optional) → bytes. */\nexport function base64UrlToBytes(input: string): Uint8Array {\n const b64 = input.replace(/-/g, \"+\").replace(/_/g, \"/\");\n const padded = b64 + \"=\".repeat((4 - (b64.length % 4)) % 4);\n const bin = atob(padded);\n const out = new Uint8Array(bin.length);\n for (let i = 0; i < bin.length; i++) out[i] = bin.charCodeAt(i);\n return out;\n}\n"]}
1
+ {"version":3,"sources":["../../src/resources/push.ts"],"names":[],"mappings":";AAgDO,IAAM,eAAN,MAAmB;AAAA,EACxB,YAA6B,IAAA,EAAkB;AAAlB,IAAA,IAAA,CAAA,IAAA,GAAA,IAAA;AAAA,EAAmB;AAAA;AAAA,EAGhD,MAAM,MAAA,GAA8B;AAClC,IAAA,OAAO,IAAA,CAAK,IAAA,CAAK,GAAA,CAAgB,uBAAuB,CAAA;AAAA,EAC1D;AAAA;AAAA;AAAA;AAAA,EAKA,MAAM,KAAK,KAAA,EAAmD;AAC5D,IAAA,OAAO,KAAK,IAAA,CAAK,GAAA,CAAgB,yBAAyB,EAAE,IAAA,EAAM,OAAO,CAAA;AAAA,EAC3E;AAAA;AAAA;AAAA,EAIA,MAAM,MAAA,GAAwB;AAC5B,IAAA,MAAM,IAAA,CAAK,IAAA,CAAK,MAAA,CAAa,uBAAuB,CAAA;AAAA,EACtD;AAAA;AAAA;AAAA;AAAA;AAAA,EAMA,MAAM,OAAO,YAAA,EAA4D;AACvE,IAAA,MAAM,EAAE,gBAAA,EAAiB,GAAI,MAAM,KAAK,MAAA,EAAO;AAC/C,IAAA,IAAI,CAAC,gBAAA,EAAkB;AACrB,MAAA,MAAM,IAAI,MAAM,6EAA6E,C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CAAI,MAAM,CAAA;AACrC,EAAA,KAAA,IAAS,CAAA,GAAI,CAAA,EAAG,CAAA,GAAI,GAAA,CAAI,MAAA,EAAQ,CAAA,EAAA,EAAK,GAAA,CAAI,CAAC,CAAA,GAAI,GAAA,CAAI,UAAA,CAAW,CAAC,CAAA;AAC9D,EAAA,OAAO,GAAA;AACT","file":"push.js","sourcesContent":["import type { HttpClient } from \"../http.js\";\n\n/**\n * Push resource — `client.push.*`.\n *\n * Web Push for the signed-in user, through the older single-subscription\n * endpoint. The API now keeps one device per browser (see\n * `client.devices`), and this endpoint is an alias over the Web Push\n * devices: it keeps working, but new code should call\n * `client.devices.registerWebPush(reg)` / `unregisterWebPush(reg)` instead.\n *\n * Your service worker shows the notification: the payload is JSON with\n * `title`, `body` and `url` (where a click should lead).\n */\n\nexport interface PushStatus {\n /** `true` when a subscription is stored for this user. */\n subscribed: boolean;\n /** Host of the stored endpoint, e.g. `fcm.googleapis.com`. */\n endpoint_host?: string | null;\n /** VAPID public key (URL-safe base64) for `pushManager.subscribe`.\n * `null` when push is not set up on this deployment. */\n vapid_public_key?: string | null;\n}\n\nexport interface PushSubscriptionInput {\n /** `PushSubscription.endpoint`; must be https. */\n endpoint: string;\n keys: {\n /** URL-safe base64. */\n p256dh: string;\n /** URL-safe base64. */\n auth: string;\n };\n}\n\n/** The part of `ServiceWorkerRegistration` the SDK needs. Typed\n * structurally so the core stays free of DOM lib types. */\nexport interface PushCapableRegistration {\n pushManager: {\n getSubscription(): Promise<{ unsubscribe(): Promise<boolean> } | null>;\n subscribe(options: {\n userVisibleOnly: boolean;\n applicationServerKey: Uint8Array;\n }): Promise<{ toJSON(): { endpoint?: string; keys?: Record<string, string> } }>;\n };\n}\n\nexport class PushResource {\n constructor(private readonly http: HttpClient) {}\n\n /** Whether the user is subscribed, plus the VAPID key to subscribe with. */\n async status(): Promise<PushStatus> {\n return this.http.get<PushStatus>(\"/me/push-subscription\");\n }\n\n /** Store a subscription you created yourself.\n * 409 `push_disabled` when the deployment has no VAPID keys.\n * @deprecated Use `client.devices.register({ kind: \"webpush\", ... })`. */\n async save(input: PushSubscriptionInput): Promise<PushStatus> {\n return this.http.put<PushStatus>(\"/me/push-subscription\", { body: input });\n }\n\n /** Delete the stored subscription. Safe when nothing is stored.\n * @deprecated Use `client.devices.remove(id)` or `client.devices.unregisterWebPush(reg)`. */\n async remove(): Promise<void> {\n await this.http.delete<void>(\"/me/push-subscription\");\n }\n\n /** Subscribe this browser and store the subscription. Ask for\n * notification permission before calling. Throws when push isn't set up\n * on the deployment.\n * @deprecated Use `client.devices.registerWebPush(registration)`. */\n async enable(registration: PushCapableRegistration): Promise<PushStatus> {\n const { vapid_public_key } = await this.status();\n if (!vapid_public_key) {\n throw new Error(\"@takeal/cusfront-sdk: push notifications are not enabled on this deployment\");\n }\n const sub = await registration.pushManager.subscribe({\n userVisibleOnly: true,\n applicationServerKey: base64UrlToBytes(vapid_public_key),\n });\n const json = sub.toJSON();\n if (!json.endpoint || !json.keys?.p256dh || !json.keys.auth) {\n throw new Error(\"@takeal/cusfront-sdk: the browser returned an incomplete push subscription\");\n }\n return this.save({\n endpoint: json.endpoint,\n keys: { p256dh: json.keys.p256dh, auth: json.keys.auth },\n });\n }\n\n /** Unsubscribe this browser and delete the stored subscription.\n * @deprecated Use `client.devices.unregisterWebPush(registration)`. */\n async disable(registration: PushCapableRegistration): Promise<void> {\n const sub = await registration.pushManager.getSubscription();\n if (sub) await sub.unsubscribe();\n await this.remove();\n }\n}\n\n/** URL-safe base64 (padding optional) → bytes. */\nexport function base64UrlToBytes(input: string): Uint8Array {\n const b64 = input.replace(/-/g, \"+\").replace(/_/g, \"/\");\n const padded = b64 + \"=\".repeat((4 - (b64.length % 4)) % 4);\n const bin = atob(padded);\n const out = new Uint8Array(bin.length);\n for (let i = 0; i < bin.length; i++) out[i] = bin.charCodeAt(i);\n return out;\n}\n"]}
@@ -1,4 +1,4 @@
1
- import { H as HttpClient } from '../http-BkCfOCR0.cjs';
1
+ import { H as HttpClient } from '../http-B-OQwMYn.cjs';
2
2
 
3
3
  /**
4
4
  * Sessions resource — `client.sessions.*`.
@@ -1,4 +1,4 @@
1
- import { H as HttpClient } from '../http-BkCfOCR0.js';
1
+ import { H as HttpClient } from '../http-B-OQwMYn.js';
2
2
 
3
3
  /**
4
4
  * Sessions resource — `client.sessions.*`.
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/resources/subscriptions.ts"],"names":[],"mappings":";;;AA2BO,IAAM,wBAAN,MAA4B;AAAA,EACjC,YAA6B,IAAA,EAAkB;AAAlB,IAAA,IAAA,CAAA,IAAA,GAAA,IAAA;AAAA,EAAmB;AAAA,EAEhD,MAAM,GAAA,GAA8B;AAClC,IAAA,OAAO,IAAA,CAAK,IAAA,CAAK,GAAA,CAAmB,mBAAmB,CAAA;AAAA,EACzD;AAAA;AAAA;AAAA;AAAA;AAAA,EAMA,MAAM,IAAI,QAAA,EAAsD;AAC9D,IAAA,OAAO,IAAA,CAAK,IAAA,CAAK,GAAA,CAAmB,mBAAA,EAAqB;AAAA,MACvD,IAAA,EAAM,EAAE,QAAA;AAAS,KAClB,CAAA;AAAA,EACH;AACF","file":"subscriptions.cjs","sourcesContent":["import type { HttpClient } from \"../http.js\";\n\n/**\n * Subscriptions resource — `client.subscriptions.*`.\n *\n * Which channels the signed-in user agreed to receive announcements on.\n * `available` tells you which toggles to render: a deployment with no\n * Telegram bot configured can't deliver there, so offering the switch would\n * be a lie.\n *\n * ```ts\n * const { channels, available } = await client.subscriptions.get();\n * await client.subscriptions.set([...channels, \"telegram\"]);\n * ```\n *\n * Unrelated to paid/VIP tiers — this is only about announcements.\n */\n\nexport type BroadcastChannel = \"email\" | \"telegram\" | (string & {});\n\nexport interface Subscriptions {\n /** Channels the user currently receives announcements on. */\n channels: BroadcastChannel[];\n /** Channels this deployment can actually deliver on. */\n available: BroadcastChannel[];\n}\n\nexport class SubscriptionsResource {\n constructor(private readonly http: HttpClient) {}\n\n async get(): Promise<Subscriptions> {\n return this.http.get<Subscriptions>(\"/me/subscriptions\");\n }\n\n /**\n * Replace the whole set — this is a PUT, not a merge. Pass `[]` to opt out\n * of everything.\n */\n async set(channels: BroadcastChannel[]): Promise<Subscriptions> {\n return this.http.put<Subscriptions>(\"/me/subscriptions\", {\n body: { channels },\n });\n }\n}\n"]}
1
+ {"version":3,"sources":["../../src/resources/subscriptions.ts"],"names":[],"mappings":";;;AAkCO,IAAM,wBAAN,MAA4B;AAAA,EACjC,YAA6B,IAAA,EAAkB;AAAlB,IAAA,IAAA,CAAA,IAAA,GAAA,IAAA;AAAA,EAAmB;AAAA,EAEhD,MAAM,GAAA,GAA8B;AAClC,IAAA,OAAO,IAAA,CAAK,IAAA,CAAK,GAAA,CAAmB,mBAAmB,CAAA;AAAA,EACzD;AAAA;AAAA;AAAA;AAAA;AAAA,EAMA,MAAM,IAAI,QAAA,EAAsD;AAC9D,IAAA,OAAO,IAAA,CAAK,IAAA,CAAK,GAAA,CAAmB,mBAAA,EAAqB;AAAA,MACvD,IAAA,EAAM,EAAE,QAAA;AAAS,KAClB,CAAA;AAAA,EACH;AACF","file":"subscriptions.cjs","sourcesContent":["import type { HttpClient } from \"../http.js\";\n\n/**\n * Subscriptions resource — `client.subscriptions.*`.\n *\n * Which channels the signed-in user agreed to receive announcements on.\n * `available` tells you which toggles to render: a deployment with no\n * Telegram bot configured can't deliver there, so offering the switch would\n * be a lie.\n *\n * ```ts\n * const { channels, available } = await client.subscriptions.get();\n * await client.subscriptions.set([...channels, \"telegram\"]);\n * ```\n *\n * Unrelated to paid/VIP tiers — this is only about announcements.\n *\n * @deprecated Announcements are now the `marketing` category of the\n * notification preferences. Read them with\n * `client.notifications.getPreferences()` and change them with\n * `client.notifications.setPreferences({ categories: { marketing: { email: true, telegram: false } } })`.\n * This endpoint keeps working as an alias over that setting.\n */\n\nexport type BroadcastChannel = \"email\" | \"telegram\" | (string & {});\n\nexport interface Subscriptions {\n /** Channels the user currently receives announcements on. */\n channels: BroadcastChannel[];\n /** Channels this deployment can actually deliver on. */\n available: BroadcastChannel[];\n}\n\n/** @deprecated See the note at the top of this module. */\nexport class SubscriptionsResource {\n constructor(private readonly http: HttpClient) {}\n\n async get(): Promise<Subscriptions> {\n return this.http.get<Subscriptions>(\"/me/subscriptions\");\n }\n\n /**\n * Replace the whole set — this is a PUT, not a merge. Pass `[]` to opt out\n * of everything.\n */\n async set(channels: BroadcastChannel[]): Promise<Subscriptions> {\n return this.http.put<Subscriptions>(\"/me/subscriptions\", {\n body: { channels },\n });\n }\n}\n"]}
@@ -1,4 +1,4 @@
1
- import { H as HttpClient } from '../http-BkCfOCR0.cjs';
1
+ import { H as HttpClient } from '../http-B-OQwMYn.cjs';
2
2
 
3
3
  /**
4
4
  * Subscriptions resource — `client.subscriptions.*`.
@@ -14,6 +14,12 @@ import { H as HttpClient } from '../http-BkCfOCR0.cjs';
14
14
  * ```
15
15
  *
16
16
  * Unrelated to paid/VIP tiers — this is only about announcements.
17
+ *
18
+ * @deprecated Announcements are now the `marketing` category of the
19
+ * notification preferences. Read them with
20
+ * `client.notifications.getPreferences()` and change them with
21
+ * `client.notifications.setPreferences({ categories: { marketing: { email: true, telegram: false } } })`.
22
+ * This endpoint keeps working as an alias over that setting.
17
23
  */
18
24
  type BroadcastChannel = "email" | "telegram" | (string & {});
19
25
  interface Subscriptions {
@@ -22,6 +28,7 @@ interface Subscriptions {
22
28
  /** Channels this deployment can actually deliver on. */
23
29
  available: BroadcastChannel[];
24
30
  }
31
+ /** @deprecated See the note at the top of this module. */
25
32
  declare class SubscriptionsResource {
26
33
  private readonly http;
27
34
  constructor(http: HttpClient);
@@ -1,4 +1,4 @@
1
- import { H as HttpClient } from '../http-BkCfOCR0.js';
1
+ import { H as HttpClient } from '../http-B-OQwMYn.js';
2
2
 
3
3
  /**
4
4
  * Subscriptions resource — `client.subscriptions.*`.
@@ -14,6 +14,12 @@ import { H as HttpClient } from '../http-BkCfOCR0.js';
14
14
  * ```
15
15
  *
16
16
  * Unrelated to paid/VIP tiers — this is only about announcements.
17
+ *
18
+ * @deprecated Announcements are now the `marketing` category of the
19
+ * notification preferences. Read them with
20
+ * `client.notifications.getPreferences()` and change them with
21
+ * `client.notifications.setPreferences({ categories: { marketing: { email: true, telegram: false } } })`.
22
+ * This endpoint keeps working as an alias over that setting.
17
23
  */
18
24
  type BroadcastChannel = "email" | "telegram" | (string & {});
19
25
  interface Subscriptions {
@@ -22,6 +28,7 @@ interface Subscriptions {
22
28
  /** Channels this deployment can actually deliver on. */
23
29
  available: BroadcastChannel[];
24
30
  }
31
+ /** @deprecated See the note at the top of this module. */
25
32
  declare class SubscriptionsResource {
26
33
  private readonly http;
27
34
  constructor(http: HttpClient);
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/resources/subscriptions.ts"],"names":[],"mappings":";AA2BO,IAAM,wBAAN,MAA4B;AAAA,EACjC,YAA6B,IAAA,EAAkB;AAAlB,IAAA,IAAA,CAAA,IAAA,GAAA,IAAA;AAAA,EAAmB;AAAA,EAEhD,MAAM,GAAA,GAA8B;AAClC,IAAA,OAAO,IAAA,CAAK,IAAA,CAAK,GAAA,CAAmB,mBAAmB,CAAA;AAAA,EACzD;AAAA;AAAA;AAAA;AAAA;AAAA,EAMA,MAAM,IAAI,QAAA,EAAsD;AAC9D,IAAA,OAAO,IAAA,CAAK,IAAA,CAAK,GAAA,CAAmB,mBAAA,EAAqB;AAAA,MACvD,IAAA,EAAM,EAAE,QAAA;AAAS,KAClB,CAAA;AAAA,EACH;AACF","file":"subscriptions.js","sourcesContent":["import type { HttpClient } from \"../http.js\";\n\n/**\n * Subscriptions resource — `client.subscriptions.*`.\n *\n * Which channels the signed-in user agreed to receive announcements on.\n * `available` tells you which toggles to render: a deployment with no\n * Telegram bot configured can't deliver there, so offering the switch would\n * be a lie.\n *\n * ```ts\n * const { channels, available } = await client.subscriptions.get();\n * await client.subscriptions.set([...channels, \"telegram\"]);\n * ```\n *\n * Unrelated to paid/VIP tiers — this is only about announcements.\n */\n\nexport type BroadcastChannel = \"email\" | \"telegram\" | (string & {});\n\nexport interface Subscriptions {\n /** Channels the user currently receives announcements on. */\n channels: BroadcastChannel[];\n /** Channels this deployment can actually deliver on. */\n available: BroadcastChannel[];\n}\n\nexport class SubscriptionsResource {\n constructor(private readonly http: HttpClient) {}\n\n async get(): Promise<Subscriptions> {\n return this.http.get<Subscriptions>(\"/me/subscriptions\");\n }\n\n /**\n * Replace the whole set — this is a PUT, not a merge. Pass `[]` to opt out\n * of everything.\n */\n async set(channels: BroadcastChannel[]): Promise<Subscriptions> {\n return this.http.put<Subscriptions>(\"/me/subscriptions\", {\n body: { channels },\n });\n }\n}\n"]}
1
+ {"version":3,"sources":["../../src/resources/subscriptions.ts"],"names":[],"mappings":";AAkCO,IAAM,wBAAN,MAA4B;AAAA,EACjC,YAA6B,IAAA,EAAkB;AAAlB,IAAA,IAAA,CAAA,IAAA,GAAA,IAAA;AAAA,EAAmB;AAAA,EAEhD,MAAM,GAAA,GAA8B;AAClC,IAAA,OAAO,IAAA,CAAK,IAAA,CAAK,GAAA,CAAmB,mBAAmB,CAAA;AAAA,EACzD;AAAA;AAAA;AAAA;AAAA;AAAA,EAMA,MAAM,IAAI,QAAA,EAAsD;AAC9D,IAAA,OAAO,IAAA,CAAK,IAAA,CAAK,GAAA,CAAmB,mBAAA,EAAqB;AAAA,MACvD,IAAA,EAAM,EAAE,QAAA;AAAS,KAClB,CAAA;AAAA,EACH;AACF","file":"subscriptions.js","sourcesContent":["import type { HttpClient } from \"../http.js\";\n\n/**\n * Subscriptions resource — `client.subscriptions.*`.\n *\n * Which channels the signed-in user agreed to receive announcements on.\n * `available` tells you which toggles to render: a deployment with no\n * Telegram bot configured can't deliver there, so offering the switch would\n * be a lie.\n *\n * ```ts\n * const { channels, available } = await client.subscriptions.get();\n * await client.subscriptions.set([...channels, \"telegram\"]);\n * ```\n *\n * Unrelated to paid/VIP tiers — this is only about announcements.\n *\n * @deprecated Announcements are now the `marketing` category of the\n * notification preferences. Read them with\n * `client.notifications.getPreferences()` and change them with\n * `client.notifications.setPreferences({ categories: { marketing: { email: true, telegram: false } } })`.\n * This endpoint keeps working as an alias over that setting.\n */\n\nexport type BroadcastChannel = \"email\" | \"telegram\" | (string & {});\n\nexport interface Subscriptions {\n /** Channels the user currently receives announcements on. */\n channels: BroadcastChannel[];\n /** Channels this deployment can actually deliver on. */\n available: BroadcastChannel[];\n}\n\n/** @deprecated See the note at the top of this module. */\nexport class SubscriptionsResource {\n constructor(private readonly http: HttpClient) {}\n\n async get(): Promise<Subscriptions> {\n return this.http.get<Subscriptions>(\"/me/subscriptions\");\n }\n\n /**\n * Replace the whole set — this is a PUT, not a merge. Pass `[]` to opt out\n * of everything.\n */\n async set(channels: BroadcastChannel[]): Promise<Subscriptions> {\n return this.http.put<Subscriptions>(\"/me/subscriptions\", {\n body: { channels },\n });\n }\n}\n"]}
@@ -1,4 +1,4 @@
1
- import { H as HttpClient } from '../http-BkCfOCR0.cjs';
1
+ import { H as HttpClient } from '../http-B-OQwMYn.cjs';
2
2
 
3
3
  /**
4
4
  * Wallet resource — `client.wallet.*`.
@@ -1,4 +1,4 @@
1
- import { H as HttpClient } from '../http-BkCfOCR0.js';
1
+ import { H as HttpClient } from '../http-B-OQwMYn.js';
2
2
 
3
3
  /**
4
4
  * Wallet resource — `client.wallet.*`.