@takeal/cusfront-sdk 0.5.0 → 0.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +49 -2
- package/README.md +168 -3
- package/dist/analytics.cjs +28 -7
- package/dist/analytics.cjs.map +1 -1
- package/dist/analytics.js +28 -7
- package/dist/analytics.js.map +1 -1
- package/dist/{cards-Ba1wZttb.d.ts → cards-CF3-He2x.d.ts} +144 -20
- package/dist/{cards-B_aNY35J.d.cts → cards-qfHz6xZY.d.cts} +144 -20
- package/dist/{deposits-DScyT_D9.d.ts → deposits-B2LBe2k1.d.ts} +71 -8
- package/dist/{deposits-BEc8U80M.d.cts → deposits-ZjT_btgi.d.cts} +71 -8
- package/dist/index.cjs +92 -50
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +6 -6
- package/dist/index.d.ts +6 -6
- package/dist/index.js +92 -50
- package/dist/index.js.map +1 -1
- package/dist/react/index.cjs +2 -8
- package/dist/react/index.cjs.map +1 -1
- package/dist/react/index.d.cts +2 -2
- package/dist/react/index.d.ts +2 -2
- package/dist/react/index.js +2 -8
- package/dist/react/index.js.map +1 -1
- package/dist/resources/attribution.cjs.map +1 -1
- package/dist/resources/attribution.js.map +1 -1
- package/dist/resources/auth.cjs.map +1 -1
- package/dist/resources/auth.js.map +1 -1
- package/dist/resources/cards.cjs +41 -28
- package/dist/resources/cards.cjs.map +1 -1
- package/dist/resources/cards.d.cts +1 -1
- package/dist/resources/cards.d.ts +1 -1
- package/dist/resources/cards.js +41 -28
- package/dist/resources/cards.js.map +1 -1
- package/dist/resources/deposits.cjs +8 -5
- package/dist/resources/deposits.cjs.map +1 -1
- package/dist/resources/deposits.d.cts +2 -2
- package/dist/resources/deposits.d.ts +2 -2
- package/dist/resources/deposits.js +8 -5
- package/dist/resources/deposits.js.map +1 -1
- package/dist/resources/devices.cjs +3 -1
- package/dist/resources/devices.cjs.map +1 -1
- package/dist/resources/devices.js +3 -1
- package/dist/resources/devices.js.map +1 -1
- package/dist/resources/documents.cjs +3 -1
- package/dist/resources/documents.cjs.map +1 -1
- package/dist/resources/documents.js +3 -1
- package/dist/resources/documents.js.map +1 -1
- package/dist/resources/funding-options.cjs.map +1 -1
- package/dist/resources/funding-options.d.cts +2 -2
- package/dist/resources/funding-options.d.ts +2 -2
- package/dist/resources/funding-options.js.map +1 -1
- package/dist/resources/history.cjs +3 -1
- package/dist/resources/history.cjs.map +1 -1
- package/dist/resources/history.js +3 -1
- package/dist/resources/history.js.map +1 -1
- package/dist/resources/push.cjs +3 -1
- package/dist/resources/push.cjs.map +1 -1
- package/dist/resources/push.js +3 -1
- package/dist/resources/push.js.map +1 -1
- package/dist/telegram.cjs +67 -53
- package/dist/telegram.cjs.map +1 -1
- package/dist/telegram.d.cts +2 -2
- package/dist/telegram.d.ts +2 -2
- package/dist/telegram.js +67 -53
- package/dist/telegram.js.map +1 -1
- package/package.json +12 -5
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/resources/history.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"sources":["../../src/resources/history.ts"],"names":[],"mappings":";;;AA8GO,IAAM,kBAAN,MAAsB;AAAA,EAC3B,YAA6B,IAAA,EAAkB;AAAlB,IAAA,IAAA,CAAA,IAAA,GAAA,IAAA;AAAA,EAAmB;AAAA;AAAA,EAGhD,MAAM,IAAA,CAAK,MAAA,GAA4B,EAAC,EAAyB;AAC/D,IAAA,MAAM,CAAA,GAAI,IAAI,eAAA,EAAgB;AAC9B,IAAA,IAAI,OAAO,MAAA,EAAQ,CAAA,CAAE,GAAA,CAAI,SAAA,EAAW,OAAO,MAAM,CAAA;AACjD,IAAA,IAAI,OAAO,MAAA,EAAQ,CAAA,CAAE,GAAA,CAAI,QAAA,EAAU,OAAO,MAAM,CAAA;AAChD,IAAA,IAAI,MAAA,CAAO,UAAU,MAAA,EAAW,CAAA,CAAE,IAAI,OAAA,EAAS,MAAA,CAAO,MAAA,CAAO,KAAK,CAAC,CAAA;AACnE,IAAA,IAAI,OAAO,IAAA,EAAM,CAAA,CAAE,GAAA,CAAI,MAAA,EAAQ,OAAO,IAAI,CAAA;AAC1C,IAAA,MAAM,EAAA,GAAK,EAAE,QAAA,EAAS;AACtB,IAAA,OAAO,IAAA,CAAK,KAAK,GAAA,CAAiB,CAAA,WAAA,EAAc,KAAK,CAAA,CAAA,EAAI,EAAE,CAAA,CAAA,GAAK,EAAE,CAAA,CAAA,EAAI;AAAA,MACpE,QAAQ,MAAA,CAAO;AAAA,KAChB,CAAA;AAAA,EACH;AAAA;AAAA,EAGA,OAAO,GAAA,CAAI,MAAA,GAA4C,EAAC,EAAgC;AACtF,IAAA,IAAI,MAAA;AACJ,IAAA,GAAG;AACD,MAAA,MAAM,IAAA,GAAO,MAAM,IAAA,CAAK,IAAA,CAAK,EAAE,GAAG,MAAA,EAAQ,QAAQ,CAAA;AAClD,MAAA,OAAO,IAAA,CAAK,KAAA;AACZ,MAAA,MAAA,GAAS,KAAK,WAAA,IAAe,MAAA;AAAA,IAC/B,CAAA,QAAS,MAAA;AAAA,EACX;AACF","file":"history.cjs","sourcesContent":["import type { HttpClient } from \"../http.js\";\n\n/**\n * History resource — `client.history.*`: everything that happened to the\n * user's money in one list, newest first.\n *\n * ```ts\n * const page = await client.history.list({ limit: 30 });\n * const more = await client.history.list({ cursor: page.next_cursor! });\n * const oneCard = await client.history.list({ cardId: card.id });\n * for await (const item of client.history.all()) { … }\n * ```\n *\n * New kinds are added over time. Render an unknown `kind` from its `title`,\n * `amount`, `direction` and `status`; don't drop it.\n */\n\nexport type HistoryKind =\n | \"card_purchase\"\n | \"card_refund\"\n | \"card_issued\"\n | \"card_topup\"\n | \"card_transfer\"\n | \"wallet_deposit\"\n | \"deposit_refund\"\n | \"fee\"\n | \"balance_adjustment\"\n | \"bonus\"\n // Any kind added later still type-checks.\n | (string & {});\n\nexport type HistoryStatus =\n \"completed\" | \"pending\" | \"declined\" | \"reversed\" | \"failed\" | (string & {});\n\nexport interface HistoryAmount {\n /** Decimal string, never negative; see `direction`. */\n amount: string;\n /** ISO 4217 code. */\n currency: string;\n}\n\nexport interface HistoryCard {\n id: string;\n name: string | null;\n last4: string | null;\n}\n\nexport interface HistoryItem {\n /** Unique across kinds. */\n id: string;\n kind: HistoryKind;\n occurred_at: string;\n /** `pending` is not finished yet; `reversed` is an authorisation that was released. */\n status: HistoryStatus;\n /** `out` money left the user, `in` it came in, `internal` it moved between the wallet and the user's cards. */\n direction: \"out\" | \"in\" | \"internal\" | (string & {});\n /** The merchant, or what the operation was, in the language asked for. */\n title: string;\n /**\n * In the currency the operation happened in. For `bonus` the currency is\n * `BNS` and the amount is a number of bonuses, not money.\n */\n amount: HistoryAmount;\n /**\n * The other side of a conversion (what the card was billed, what the\n * wallet or card received). For a `bonus` spend: the part of the price\n * the bonuses covered, or what they added to a top-up.\n */\n counter_amount: HistoryAmount | null;\n /** Rate between `amount` and `counter_amount`, decimal string. */\n fx_rate: string | null;\n /** A fee charged with the operation, in the wallet's currency. */\n fee: HistoryAmount | null;\n /** The card; the source card of a transfer. */\n card: HistoryCard | null;\n /** The destination card of a transfer. */\n to_card: HistoryCard | null;\n merchant: { name: string | null; city: string | null; country: string | null } | null;\n /** On a declined payment: a stable code and the reason in plain words. */\n decline_reason: {\n code:\n | \"insufficient_funds\"\n | \"limit_exceeded\"\n | \"card_blocked\"\n | \"card_expired\"\n | \"wrong_details\"\n | \"merchant_not_allowed\"\n | \"other\"\n | (string & {});\n text: string;\n } | null;\n}\n\nexport interface HistoryPage {\n items: HistoryItem[];\n /** Pass as `cursor` for the next, older page; `null` on the last one. */\n next_cursor: string | null;\n}\n\nexport interface ListHistoryParams {\n /** Only this card's operations, transfers to and from it included. */\n cardId?: string;\n cursor?: string;\n /** 1 to 100, default 30. */\n limit?: number;\n /** `en` or `ru` for titles and decline reasons. Defaults to the browser's language header. */\n lang?: \"en\" | \"ru\";\n signal?: AbortSignal;\n}\n\nexport class HistoryResource {\n constructor(private readonly http: HttpClient) {}\n\n /** One page of the history. Errors: 400 bad cursor or limit, 404 `cardId` is not the user's card. */\n async list(params: ListHistoryParams = {}): Promise<HistoryPage> {\n const q = new URLSearchParams();\n if (params.cardId) q.set(\"card_id\", params.cardId);\n if (params.cursor) q.set(\"cursor\", params.cursor);\n if (params.limit !== undefined) q.set(\"limit\", String(params.limit));\n if (params.lang) q.set(\"lang\", params.lang);\n const qs = q.toString();\n return this.http.get<HistoryPage>(`/me/history${qs ? `?${qs}` : \"\"}`, {\n signal: params.signal,\n });\n }\n\n /** Every entry, page after page, newest first. */\n async *all(params: Omit<ListHistoryParams, \"cursor\"> = {}): AsyncGenerator<HistoryItem> {\n let cursor: string | undefined;\n do {\n const page = await this.list({ ...params, cursor });\n yield* page.items;\n cursor = page.next_cursor ?? undefined;\n } while (cursor);\n }\n}\n"]}
|
|
@@ -11,7 +11,9 @@ var HistoryResource = class {
|
|
|
11
11
|
if (params.limit !== void 0) q.set("limit", String(params.limit));
|
|
12
12
|
if (params.lang) q.set("lang", params.lang);
|
|
13
13
|
const qs = q.toString();
|
|
14
|
-
return this.http.get(`/me/history${qs ? `?${qs}` : ""}`, {
|
|
14
|
+
return this.http.get(`/me/history${qs ? `?${qs}` : ""}`, {
|
|
15
|
+
signal: params.signal
|
|
16
|
+
});
|
|
15
17
|
}
|
|
16
18
|
/** Every entry, page after page, newest first. */
|
|
17
19
|
async *all(params = {}) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/resources/history.ts"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"sources":["../../src/resources/history.ts"],"names":[],"mappings":";AA8GO,IAAM,kBAAN,MAAsB;AAAA,EAC3B,YAA6B,IAAA,EAAkB;AAAlB,IAAA,IAAA,CAAA,IAAA,GAAA,IAAA;AAAA,EAAmB;AAAA;AAAA,EAGhD,MAAM,IAAA,CAAK,MAAA,GAA4B,EAAC,EAAyB;AAC/D,IAAA,MAAM,CAAA,GAAI,IAAI,eAAA,EAAgB;AAC9B,IAAA,IAAI,OAAO,MAAA,EAAQ,CAAA,CAAE,GAAA,CAAI,SAAA,EAAW,OAAO,MAAM,CAAA;AACjD,IAAA,IAAI,OAAO,MAAA,EAAQ,CAAA,CAAE,GAAA,CAAI,QAAA,EAAU,OAAO,MAAM,CAAA;AAChD,IAAA,IAAI,MAAA,CAAO,UAAU,MAAA,EAAW,CAAA,CAAE,IAAI,OAAA,EAAS,MAAA,CAAO,MAAA,CAAO,KAAK,CAAC,CAAA;AACnE,IAAA,IAAI,OAAO,IAAA,EAAM,CAAA,CAAE,GAAA,CAAI,MAAA,EAAQ,OAAO,IAAI,CAAA;AAC1C,IAAA,MAAM,EAAA,GAAK,EAAE,QAAA,EAAS;AACtB,IAAA,OAAO,IAAA,CAAK,KAAK,GAAA,CAAiB,CAAA,WAAA,EAAc,KAAK,CAAA,CAAA,EAAI,EAAE,CAAA,CAAA,GAAK,EAAE,CAAA,CAAA,EAAI;AAAA,MACpE,QAAQ,MAAA,CAAO;AAAA,KAChB,CAAA;AAAA,EACH;AAAA;AAAA,EAGA,OAAO,GAAA,CAAI,MAAA,GAA4C,EAAC,EAAgC;AACtF,IAAA,IAAI,MAAA;AACJ,IAAA,GAAG;AACD,MAAA,MAAM,IAAA,GAAO,MAAM,IAAA,CAAK,IAAA,CAAK,EAAE,GAAG,MAAA,EAAQ,QAAQ,CAAA;AAClD,MAAA,OAAO,IAAA,CAAK,KAAA;AACZ,MAAA,MAAA,GAAS,KAAK,WAAA,IAAe,MAAA;AAAA,IAC/B,CAAA,QAAS,MAAA;AAAA,EACX;AACF","file":"history.js","sourcesContent":["import type { HttpClient } from \"../http.js\";\n\n/**\n * History resource — `client.history.*`: everything that happened to the\n * user's money in one list, newest first.\n *\n * ```ts\n * const page = await client.history.list({ limit: 30 });\n * const more = await client.history.list({ cursor: page.next_cursor! });\n * const oneCard = await client.history.list({ cardId: card.id });\n * for await (const item of client.history.all()) { … }\n * ```\n *\n * New kinds are added over time. Render an unknown `kind` from its `title`,\n * `amount`, `direction` and `status`; don't drop it.\n */\n\nexport type HistoryKind =\n | \"card_purchase\"\n | \"card_refund\"\n | \"card_issued\"\n | \"card_topup\"\n | \"card_transfer\"\n | \"wallet_deposit\"\n | \"deposit_refund\"\n | \"fee\"\n | \"balance_adjustment\"\n | \"bonus\"\n // Any kind added later still type-checks.\n | (string & {});\n\nexport type HistoryStatus =\n \"completed\" | \"pending\" | \"declined\" | \"reversed\" | \"failed\" | (string & {});\n\nexport interface HistoryAmount {\n /** Decimal string, never negative; see `direction`. */\n amount: string;\n /** ISO 4217 code. */\n currency: string;\n}\n\nexport interface HistoryCard {\n id: string;\n name: string | null;\n last4: string | null;\n}\n\nexport interface HistoryItem {\n /** Unique across kinds. */\n id: string;\n kind: HistoryKind;\n occurred_at: string;\n /** `pending` is not finished yet; `reversed` is an authorisation that was released. */\n status: HistoryStatus;\n /** `out` money left the user, `in` it came in, `internal` it moved between the wallet and the user's cards. */\n direction: \"out\" | \"in\" | \"internal\" | (string & {});\n /** The merchant, or what the operation was, in the language asked for. */\n title: string;\n /**\n * In the currency the operation happened in. For `bonus` the currency is\n * `BNS` and the amount is a number of bonuses, not money.\n */\n amount: HistoryAmount;\n /**\n * The other side of a conversion (what the card was billed, what the\n * wallet or card received). For a `bonus` spend: the part of the price\n * the bonuses covered, or what they added to a top-up.\n */\n counter_amount: HistoryAmount | null;\n /** Rate between `amount` and `counter_amount`, decimal string. */\n fx_rate: string | null;\n /** A fee charged with the operation, in the wallet's currency. */\n fee: HistoryAmount | null;\n /** The card; the source card of a transfer. */\n card: HistoryCard | null;\n /** The destination card of a transfer. */\n to_card: HistoryCard | null;\n merchant: { name: string | null; city: string | null; country: string | null } | null;\n /** On a declined payment: a stable code and the reason in plain words. */\n decline_reason: {\n code:\n | \"insufficient_funds\"\n | \"limit_exceeded\"\n | \"card_blocked\"\n | \"card_expired\"\n | \"wrong_details\"\n | \"merchant_not_allowed\"\n | \"other\"\n | (string & {});\n text: string;\n } | null;\n}\n\nexport interface HistoryPage {\n items: HistoryItem[];\n /** Pass as `cursor` for the next, older page; `null` on the last one. */\n next_cursor: string | null;\n}\n\nexport interface ListHistoryParams {\n /** Only this card's operations, transfers to and from it included. */\n cardId?: string;\n cursor?: string;\n /** 1 to 100, default 30. */\n limit?: number;\n /** `en` or `ru` for titles and decline reasons. Defaults to the browser's language header. */\n lang?: \"en\" | \"ru\";\n signal?: AbortSignal;\n}\n\nexport class HistoryResource {\n constructor(private readonly http: HttpClient) {}\n\n /** One page of the history. Errors: 400 bad cursor or limit, 404 `cardId` is not the user's card. */\n async list(params: ListHistoryParams = {}): Promise<HistoryPage> {\n const q = new URLSearchParams();\n if (params.cardId) q.set(\"card_id\", params.cardId);\n if (params.cursor) q.set(\"cursor\", params.cursor);\n if (params.limit !== undefined) q.set(\"limit\", String(params.limit));\n if (params.lang) q.set(\"lang\", params.lang);\n const qs = q.toString();\n return this.http.get<HistoryPage>(`/me/history${qs ? `?${qs}` : \"\"}`, {\n signal: params.signal,\n });\n }\n\n /** Every entry, page after page, newest first. */\n async *all(params: Omit<ListHistoryParams, \"cursor\"> = {}): AsyncGenerator<HistoryItem> {\n let cursor: string | undefined;\n do {\n const page = await this.list({ ...params, cursor });\n yield* page.items;\n cursor = page.next_cursor ?? undefined;\n } while (cursor);\n }\n}\n"]}
|
package/dist/resources/push.cjs
CHANGED
|
@@ -27,7 +27,9 @@ var PushResource = class {
|
|
|
27
27
|
async enable(registration) {
|
|
28
28
|
const { vapid_public_key } = await this.status();
|
|
29
29
|
if (!vapid_public_key) {
|
|
30
|
-
throw new Error(
|
|
30
|
+
throw new Error(
|
|
31
|
+
"@takeal/cusfront-sdk: push notifications are not enabled on this deployment"
|
|
32
|
+
);
|
|
31
33
|
}
|
|
32
34
|
const sub = await registration.pushManager.subscribe({
|
|
33
35
|
userVisibleOnly: true,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/resources/push.ts"],"names":[],"m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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, 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(\n \"@takeal/cusfront-sdk: push notifications are not enabled on this deployment\",\n );\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"]}
|
package/dist/resources/push.js
CHANGED
|
@@ -25,7 +25,9 @@ var PushResource = class {
|
|
|
25
25
|
async enable(registration) {
|
|
26
26
|
const { vapid_public_key } = await this.status();
|
|
27
27
|
if (!vapid_public_key) {
|
|
28
|
-
throw new Error(
|
|
28
|
+
throw new Error(
|
|
29
|
+
"@takeal/cusfront-sdk: push notifications are not enabled on this deployment"
|
|
30
|
+
);
|
|
29
31
|
}
|
|
30
32
|
const sub = await registration.pushManager.subscribe({
|
|
31
33
|
userVisibleOnly: true,
|
|
@@ -1 +1 @@
|
|
|
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,gBA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AAK,IAAA,EAAM;AAC3D,MAAA,MAAM,IAAI,MAAM,4EAA4E,CAAA;AAAA,IAC9F;AACA,IAAA,OAAO,KAAK,IAAA,CAAK;AAAA,MACf,UAAU,IAAA,CAAK,QAAA;AAAA,MACf,IAAA,EAAM,EAAE,MAAA,EAAQ,IAAA,CAAK,KAAK,MAAA,EAAQ,IAAA,EAAM,IAAA,CAAK,IAAA,CAAK,IAAA;AAAK,KACxD,CAAA;AAAA,EACH;AAAA;AAAA;AAAA,EAIA,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, 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(\n \"@takeal/cusfront-sdk: push notifications are not enabled on this deployment\",\n );\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"]}
|
package/dist/telegram.cjs
CHANGED
|
@@ -95,10 +95,7 @@ var HttpClient = class {
|
|
|
95
95
|
try {
|
|
96
96
|
resp = await this.fetchImpl(url, init);
|
|
97
97
|
} catch (e) {
|
|
98
|
-
throw new NetworkError(
|
|
99
|
-
e instanceof Error ? e.message : "network error",
|
|
100
|
-
e
|
|
101
|
-
);
|
|
98
|
+
throw new NetworkError(e instanceof Error ? e.message : "network error", e);
|
|
102
99
|
}
|
|
103
100
|
if (resp.status === 401 && !opts.skipAuth && !opts.retried && this.refresher) {
|
|
104
101
|
if (await this.refreshOnce()) {
|
|
@@ -390,9 +387,7 @@ var CardsResource = class {
|
|
|
390
387
|
}
|
|
391
388
|
/** One product from the catalog. 404 when unknown, disabled or hidden. */
|
|
392
389
|
async getProduct(id) {
|
|
393
|
-
return this.http.get(
|
|
394
|
-
`/me/card-products/${encodeURIComponent(id)}`
|
|
395
|
-
);
|
|
390
|
+
return this.http.get(`/me/card-products/${encodeURIComponent(id)}`);
|
|
396
391
|
}
|
|
397
392
|
/**
|
|
398
393
|
* The public catalog: the same products, order and default as
|
|
@@ -431,9 +426,7 @@ var CardsResource = class {
|
|
|
431
426
|
*/
|
|
432
427
|
async balance(id, currency) {
|
|
433
428
|
const q = new URLSearchParams({ currency }).toString();
|
|
434
|
-
return this.http.get(
|
|
435
|
-
`/me/cards/${encodeURIComponent(id)}/balance?${q}`
|
|
436
|
-
);
|
|
429
|
+
return this.http.get(`/me/cards/${encodeURIComponent(id)}/balance?${q}`);
|
|
437
430
|
}
|
|
438
431
|
/**
|
|
439
432
|
* What a top-up of this card can be right now: whether it is possible, the
|
|
@@ -474,21 +467,20 @@ var CardsResource = class {
|
|
|
474
467
|
*/
|
|
475
468
|
async transfer(fromCardId, input) {
|
|
476
469
|
const { toCardId, amount, idempotencyKey } = input;
|
|
477
|
-
return this.http.post(
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
);
|
|
470
|
+
return this.http.post(`/me/cards/${encodeURIComponent(fromCardId)}/transfer`, {
|
|
471
|
+
body: { to_card_id: toCardId, amount },
|
|
472
|
+
idempotencyKey
|
|
473
|
+
});
|
|
481
474
|
}
|
|
482
475
|
/**
|
|
483
|
-
* Freeze the caller's own card. Reversible via {@link unfreeze}
|
|
484
|
-
* `
|
|
485
|
-
*
|
|
476
|
+
* Freeze the caller's own card. Reversible via {@link unfreeze} while
|
|
477
|
+
* `status_source` is `holder` or `operator`. The optional `reason` is
|
|
478
|
+
* recorded on the audit trail. Resolves to the updated card. 404 if the
|
|
479
|
+
* card isn't the caller's; 409 `card_locked` when support holds it; 501 if
|
|
480
|
+
* the issuer can't freeze.
|
|
486
481
|
*/
|
|
487
482
|
async freeze(id, reason) {
|
|
488
|
-
return this.http.post(
|
|
489
|
-
`/me/cards/${encodeURIComponent(id)}/freeze`,
|
|
490
|
-
{ body: { reason } }
|
|
491
|
-
);
|
|
483
|
+
return this.http.post(`/me/cards/${encodeURIComponent(id)}/freeze`, { body: { reason } });
|
|
492
484
|
}
|
|
493
485
|
/**
|
|
494
486
|
* Reveal the FULL PAN + CVV for the caller's own card. The signed-in
|
|
@@ -500,18 +492,37 @@ var CardsResource = class {
|
|
|
500
492
|
* keep the result in volatile memory only, never write it to
|
|
501
493
|
* localStorage / logs, and clear it within `expires_in_seconds`.
|
|
502
494
|
*
|
|
503
|
-
*
|
|
504
|
-
*
|
|
495
|
+
* The result is the numbers, or `reveal_url` with empty `pan` and `cvv`
|
|
496
|
+
* when the issuer shows them on a page of its own: open that page in a
|
|
497
|
+
* frame right away, it is short-lived.
|
|
498
|
+
*
|
|
499
|
+
* 403 not your card · 409 `card_locked` · 429 rate-limited · 501 connector
|
|
500
|
+
* has no sensitive-data endpoint · 503 `provider_unavailable`.
|
|
505
501
|
*/
|
|
506
502
|
async reveal(id, _input) {
|
|
507
503
|
return this.http.post(`/me/cards/${encodeURIComponent(id)}/reveal`);
|
|
508
504
|
}
|
|
509
|
-
/**
|
|
505
|
+
/**
|
|
506
|
+
* Unfreeze a previously-frozen card. Idempotent on an already-active card.
|
|
507
|
+
* A card the issuer froze (`status_source: "provider"`) is not the
|
|
508
|
+
* holder's to unfreeze: the API answers 409 `card_locked`, so hide the
|
|
509
|
+
* button and say the freeze is lifted through the issuer's support.
|
|
510
|
+
*/
|
|
510
511
|
async unfreeze(id) {
|
|
511
|
-
return this.http.post(
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
512
|
+
return this.http.post(`/me/cards/${encodeURIComponent(id)}/unfreeze`, { body: {} });
|
|
513
|
+
}
|
|
514
|
+
/**
|
|
515
|
+
* Set the PIN of the caller's own physical card. The session is enough; the
|
|
516
|
+
* call is rate-limited like {@link reveal} and the PIN is kept nowhere.
|
|
517
|
+
* Resolves to the card; the user also gets a notification that the PIN
|
|
518
|
+
* was set. 400 not four to six digits or the card is not active · 403 not
|
|
519
|
+
* your card · 409 `card_locked`, or `provider_refused` when the issuer did
|
|
520
|
+
* not take it · 429 too many attempts · 501 a virtual card has no PIN.
|
|
521
|
+
*/
|
|
522
|
+
async setPin(id, input) {
|
|
523
|
+
return this.http.post(`/me/cards/${encodeURIComponent(id)}/pin`, {
|
|
524
|
+
body: { pin: input.pin }
|
|
525
|
+
});
|
|
515
526
|
}
|
|
516
527
|
/**
|
|
517
528
|
* Terminate the caller's own card. **One-way** — a terminated card cannot be
|
|
@@ -519,10 +530,9 @@ var CardsResource = class {
|
|
|
519
530
|
* already-terminated card.
|
|
520
531
|
*/
|
|
521
532
|
async terminate(id, reason) {
|
|
522
|
-
return this.http.post(
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
);
|
|
533
|
+
return this.http.post(`/me/cards/${encodeURIComponent(id)}/terminate`, {
|
|
534
|
+
body: { reason }
|
|
535
|
+
});
|
|
526
536
|
}
|
|
527
537
|
};
|
|
528
538
|
|
|
@@ -543,7 +553,10 @@ var DepositsResource = class {
|
|
|
543
553
|
* API answers 400 `no_quote_needed`).
|
|
544
554
|
*/
|
|
545
555
|
async quote(input) {
|
|
546
|
-
|
|
556
|
+
const { connectorSlug, ...rest } = input;
|
|
557
|
+
const body = { ...rest };
|
|
558
|
+
if (connectorSlug !== void 0) body["connector_slug"] = connectorSlug;
|
|
559
|
+
return this.http.post("/me/deposits/quotes", { body });
|
|
547
560
|
}
|
|
548
561
|
async initiate(input) {
|
|
549
562
|
const { idempotencyKey, issue_card, ...rest } = input;
|
|
@@ -569,10 +582,10 @@ var DepositsResource = class {
|
|
|
569
582
|
*/
|
|
570
583
|
async refund(depositId, input) {
|
|
571
584
|
const { idempotencyKey, ...body } = input;
|
|
572
|
-
return this.http.post(
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
);
|
|
585
|
+
return this.http.post(`/me/deposits/${encodeURIComponent(depositId)}/refunds`, {
|
|
586
|
+
body,
|
|
587
|
+
idempotencyKey
|
|
588
|
+
});
|
|
576
589
|
}
|
|
577
590
|
};
|
|
578
591
|
|
|
@@ -767,7 +780,9 @@ var DocumentsResource = class {
|
|
|
767
780
|
}
|
|
768
781
|
/** Every saved text of a document, newest first, with the date each took effect. */
|
|
769
782
|
async versions(slug) {
|
|
770
|
-
return this.http.get(
|
|
783
|
+
return this.http.get(
|
|
784
|
+
`/documents/${encodeURIComponent(slug)}/versions`
|
|
785
|
+
);
|
|
771
786
|
}
|
|
772
787
|
/** The document as it read in one version. */
|
|
773
788
|
async version(slug, version) {
|
|
@@ -851,7 +866,9 @@ var PushResource = class {
|
|
|
851
866
|
async enable(registration) {
|
|
852
867
|
const { vapid_public_key } = await this.status();
|
|
853
868
|
if (!vapid_public_key) {
|
|
854
|
-
throw new Error(
|
|
869
|
+
throw new Error(
|
|
870
|
+
"@takeal/cusfront-sdk: push notifications are not enabled on this deployment"
|
|
871
|
+
);
|
|
855
872
|
}
|
|
856
873
|
const sub = await registration.pushManager.subscribe({
|
|
857
874
|
userVisibleOnly: true,
|
|
@@ -993,7 +1010,9 @@ var DevicesResource = class {
|
|
|
993
1010
|
async registerWebPush(registration, opts = {}) {
|
|
994
1011
|
const key = opts.vapidPublicKey ?? await this.vapidPublicKey();
|
|
995
1012
|
if (!key) {
|
|
996
|
-
throw new Error(
|
|
1013
|
+
throw new Error(
|
|
1014
|
+
"@takeal/cusfront-sdk: push notifications are not enabled on this deployment"
|
|
1015
|
+
);
|
|
997
1016
|
}
|
|
998
1017
|
const sub = await registration.pushManager.subscribe({
|
|
999
1018
|
userVisibleOnly: true,
|
|
@@ -1070,7 +1089,9 @@ var HistoryResource = class {
|
|
|
1070
1089
|
if (params.limit !== void 0) q.set("limit", String(params.limit));
|
|
1071
1090
|
if (params.lang) q.set("lang", params.lang);
|
|
1072
1091
|
const qs = q.toString();
|
|
1073
|
-
return this.http.get(`/me/history${qs ? `?${qs}` : ""}`, {
|
|
1092
|
+
return this.http.get(`/me/history${qs ? `?${qs}` : ""}`, {
|
|
1093
|
+
signal: params.signal
|
|
1094
|
+
});
|
|
1074
1095
|
}
|
|
1075
1096
|
/** Every entry, page after page, newest first. */
|
|
1076
1097
|
async *all(params = {}) {
|
|
@@ -1095,7 +1116,7 @@ var FundingOptionsResource = class {
|
|
|
1095
1116
|
};
|
|
1096
1117
|
|
|
1097
1118
|
// src/version.ts
|
|
1098
|
-
var SDK_VERSION = "0.
|
|
1119
|
+
var SDK_VERSION = "0.6.1";
|
|
1099
1120
|
|
|
1100
1121
|
// src/client-platform.ts
|
|
1101
1122
|
var CLIENT_HEADER = "X-Takeal-Client";
|
|
@@ -1170,7 +1191,7 @@ function isAbsolute(url) {
|
|
|
1170
1191
|
}
|
|
1171
1192
|
|
|
1172
1193
|
// src/compat.ts
|
|
1173
|
-
var SUPPORTED_MEISTER = ">=0.
|
|
1194
|
+
var SUPPORTED_MEISTER = ">=0.6.4, <0.7.0";
|
|
1174
1195
|
var SEMVER = /^v?(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-([0-9A-Za-z.-]+))?(?:\+[0-9A-Za-z.-]+)?$/;
|
|
1175
1196
|
function parse(v) {
|
|
1176
1197
|
const m = SEMVER.exec(v.trim());
|
|
@@ -1331,18 +1352,11 @@ function parseInitData(initData) {
|
|
|
1331
1352
|
function assertWellFormed(initData, opts = {}) {
|
|
1332
1353
|
if (!initData) throw new InitDataError("initData is empty", "empty");
|
|
1333
1354
|
const parsed = parseInitData(initData);
|
|
1334
|
-
if (!parsed.hash)
|
|
1335
|
-
throw new InitDataError("initData is missing `hash`", "missing_hash");
|
|
1355
|
+
if (!parsed.hash) throw new InitDataError("initData is missing `hash`", "missing_hash");
|
|
1336
1356
|
if (parsed.auth_date === void 0)
|
|
1337
|
-
throw new InitDataError(
|
|
1338
|
-
"initData is missing a valid `auth_date`",
|
|
1339
|
-
"missing_auth_date"
|
|
1340
|
-
);
|
|
1357
|
+
throw new InitDataError("initData is missing a valid `auth_date`", "missing_auth_date");
|
|
1341
1358
|
if (!parsed.user || typeof parsed.user.id !== "number")
|
|
1342
|
-
throw new InitDataError(
|
|
1343
|
-
"initData is missing a valid `user`",
|
|
1344
|
-
"bad_user"
|
|
1345
|
-
);
|
|
1359
|
+
throw new InitDataError("initData is missing a valid `user`", "bad_user");
|
|
1346
1360
|
const maxAge = opts.maxAgeSeconds ?? 86400;
|
|
1347
1361
|
if (maxAge > 0) {
|
|
1348
1362
|
const now = opts.nowUnix ?? Math.floor(Date.now() / 1e3);
|