@takeal/cusfront-sdk 0.3.20 → 0.6.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 (133) hide show
  1. package/CHANGELOG.md +137 -2
  2. package/README.md +407 -8
  3. package/dist/analytics.cjs +438 -0
  4. package/dist/analytics.cjs.map +1 -0
  5. package/dist/analytics.d.cts +129 -0
  6. package/dist/analytics.d.ts +129 -0
  7. package/dist/analytics.js +424 -0
  8. package/dist/analytics.js.map +1 -0
  9. package/dist/cards-B_aNY35J.d.cts +514 -0
  10. package/dist/cards-Ba1wZttb.d.ts +514 -0
  11. package/dist/deposits-BEc8U80M.d.cts +310 -0
  12. package/dist/deposits-DScyT_D9.d.ts +310 -0
  13. package/dist/{devices-DP_hxwmW.d.ts → devices-B_YveTl9.d.ts} +1 -1
  14. package/dist/{devices-C3JHi2Hi.d.cts → devices-a5Z45Mx_.d.cts} +1 -1
  15. package/dist/{http-B-OQwMYn.d.cts → http-DeANAoTs.d.cts} +11 -3
  16. package/dist/{http-B-OQwMYn.d.ts → http-DeANAoTs.d.ts} +11 -3
  17. package/dist/index.cjs +978 -101
  18. package/dist/index.cjs.map +1 -1
  19. package/dist/index.d.cts +101 -13
  20. package/dist/index.d.ts +101 -13
  21. package/dist/index.js +963 -102
  22. package/dist/index.js.map +1 -1
  23. package/dist/react/index.cjs +2 -8
  24. package/dist/react/index.cjs.map +1 -1
  25. package/dist/react/index.d.cts +12 -5
  26. package/dist/react/index.d.ts +12 -5
  27. package/dist/react/index.js +2 -8
  28. package/dist/react/index.js.map +1 -1
  29. package/dist/resources/attribution.cjs +82 -0
  30. package/dist/resources/attribution.cjs.map +1 -0
  31. package/dist/resources/attribution.d.cts +100 -0
  32. package/dist/resources/attribution.d.ts +100 -0
  33. package/dist/resources/attribution.js +78 -0
  34. package/dist/resources/attribution.js.map +1 -0
  35. package/dist/resources/auth.cjs +81 -15
  36. package/dist/resources/auth.cjs.map +1 -1
  37. package/dist/resources/auth.d.cts +53 -6
  38. package/dist/resources/auth.d.ts +53 -6
  39. package/dist/resources/auth.js +81 -15
  40. package/dist/resources/auth.js.map +1 -1
  41. package/dist/resources/balance.d.cts +1 -1
  42. package/dist/resources/balance.d.ts +1 -1
  43. package/dist/resources/blog.cjs.map +1 -1
  44. package/dist/resources/blog.d.cts +8 -1
  45. package/dist/resources/blog.d.ts +8 -1
  46. package/dist/resources/blog.js.map +1 -1
  47. package/dist/resources/bonus.cjs +28 -0
  48. package/dist/resources/bonus.cjs.map +1 -0
  49. package/dist/resources/bonus.d.cts +121 -0
  50. package/dist/resources/bonus.d.ts +121 -0
  51. package/dist/resources/bonus.js +26 -0
  52. package/dist/resources/bonus.js.map +1 -0
  53. package/dist/resources/branding.d.cts +1 -1
  54. package/dist/resources/branding.d.ts +1 -1
  55. package/dist/resources/cards.cjs +55 -28
  56. package/dist/resources/cards.cjs.map +1 -1
  57. package/dist/resources/cards.d.cts +2 -347
  58. package/dist/resources/cards.d.ts +2 -347
  59. package/dist/resources/cards.js +55 -29
  60. package/dist/resources/cards.js.map +1 -1
  61. package/dist/resources/codes.cjs +20 -0
  62. package/dist/resources/codes.cjs.map +1 -0
  63. package/dist/resources/codes.d.cts +100 -0
  64. package/dist/resources/codes.d.ts +100 -0
  65. package/dist/resources/codes.js +18 -0
  66. package/dist/resources/codes.js.map +1 -0
  67. package/dist/resources/deposits.cjs +32 -7
  68. package/dist/resources/deposits.cjs.map +1 -1
  69. package/dist/resources/deposits.d.cts +3 -176
  70. package/dist/resources/deposits.d.ts +3 -176
  71. package/dist/resources/deposits.js +32 -7
  72. package/dist/resources/deposits.js.map +1 -1
  73. package/dist/resources/devices.cjs +3 -1
  74. package/dist/resources/devices.cjs.map +1 -1
  75. package/dist/resources/devices.d.cts +2 -2
  76. package/dist/resources/devices.d.ts +2 -2
  77. package/dist/resources/devices.js +3 -1
  78. package/dist/resources/devices.js.map +1 -1
  79. package/dist/resources/documents.cjs +66 -0
  80. package/dist/resources/documents.cjs.map +1 -0
  81. package/dist/resources/documents.d.cts +212 -0
  82. package/dist/resources/documents.d.ts +212 -0
  83. package/dist/resources/documents.js +64 -0
  84. package/dist/resources/documents.js.map +1 -0
  85. package/dist/resources/funding-options.cjs +16 -0
  86. package/dist/resources/funding-options.cjs.map +1 -0
  87. package/dist/resources/funding-options.d.cts +3 -0
  88. package/dist/resources/funding-options.d.ts +3 -0
  89. package/dist/resources/funding-options.js +14 -0
  90. package/dist/resources/funding-options.js.map +1 -0
  91. package/dist/resources/history.cjs +33 -0
  92. package/dist/resources/history.cjs.map +1 -0
  93. package/dist/resources/history.d.cts +95 -0
  94. package/dist/resources/history.d.ts +95 -0
  95. package/dist/resources/history.js +31 -0
  96. package/dist/resources/history.js.map +1 -0
  97. package/dist/resources/me.d.cts +3 -1
  98. package/dist/resources/me.d.ts +3 -1
  99. package/dist/resources/notifications.d.cts +1 -1
  100. package/dist/resources/notifications.d.ts +1 -1
  101. package/dist/resources/push.cjs +3 -1
  102. package/dist/resources/push.cjs.map +1 -1
  103. package/dist/resources/push.d.cts +1 -1
  104. package/dist/resources/push.d.ts +1 -1
  105. package/dist/resources/push.js +3 -1
  106. package/dist/resources/push.js.map +1 -1
  107. package/dist/resources/referral.cjs +16 -0
  108. package/dist/resources/referral.cjs.map +1 -0
  109. package/dist/resources/referral.d.cts +58 -0
  110. package/dist/resources/referral.d.ts +58 -0
  111. package/dist/resources/referral.js +14 -0
  112. package/dist/resources/referral.js.map +1 -0
  113. package/dist/resources/sessions.d.cts +1 -1
  114. package/dist/resources/sessions.d.ts +1 -1
  115. package/dist/resources/subscription.cjs +24 -0
  116. package/dist/resources/subscription.cjs.map +1 -0
  117. package/dist/resources/subscription.d.cts +48 -0
  118. package/dist/resources/subscription.d.ts +48 -0
  119. package/dist/resources/subscription.js +22 -0
  120. package/dist/resources/subscription.js.map +1 -0
  121. package/dist/resources/subscriptions.d.cts +1 -1
  122. package/dist/resources/subscriptions.d.ts +1 -1
  123. package/dist/resources/wallet.d.cts +1 -1
  124. package/dist/resources/wallet.d.ts +1 -1
  125. package/dist/telegram.cjs +495 -111
  126. package/dist/telegram.cjs.map +1 -1
  127. package/dist/telegram.d.cts +12 -5
  128. package/dist/telegram.d.ts +12 -5
  129. package/dist/telegram.js +495 -111
  130. package/dist/telegram.js.map +1 -1
  131. package/package.json +57 -5
  132. package/dist/customer-CoxPwe5o.d.cts +0 -32
  133. package/dist/customer-CoxPwe5o.d.ts +0 -32
@@ -1,347 +1,2 @@
1
- import { H as HttpClient } from '../http-B-OQwMYn.cjs';
2
- import { C as CustomerInfo } from '../customer-CoxPwe5o.cjs';
3
-
4
- /**
5
- * Cards resource — `client.cards.*`.
6
- *
7
- * The end-user "money OUT" surface: a user issues themselves a card backed by
8
- * their wallet balance via an issuer connector. Mirrors the Takeal API's
9
- * `/me/cards` routes:
10
- *
11
- * GET /card-products → catalog (public, before sign-in)
12
- * GET /me/card-products → listProducts (the catalog, personal price)
13
- * GET /me/card-products/{id} → getProduct
14
- * GET /me/cards/{id}/topup → topUpTerms
15
- * POST /me/cards/{id}/topup → topUp
16
- * POST /me/cards → create
17
- * GET /me/cards → list (most recent first)
18
- * GET /me/cards/{id} → get
19
- * PATCH /me/cards/{id} → update (name, design)
20
- * GET /me/cards/{id}/balance → balance (prepaid remaining)
21
- * POST /me/cards/{id}/freeze → freeze
22
- * POST /me/cards/{id}/unfreeze → unfreeze
23
- * POST /me/cards/{id}/terminate → terminate (one-way)
24
- *
25
- * The lifecycle actions are ownership-gated server-side: a caller can only
26
- * freeze / unfreeze / terminate a card that belongs to them (else 404).
27
- *
28
- * ## What is intentionally NOT here
29
- *
30
- * Card-data reveal (PAN / CVV) is a separate, security-sensitive flow with its
31
- * own re-auth + rate-limit + audit contract and is intentionally
32
- * NOT part of this resource (tracked separately).
33
- *
34
- * Today only PREPAID is wired end-to-end; CREDIT and GIFT return 400 from
35
- * the Takeal API until their issuer flows land.
36
- */
37
- /** Card product. Only `prepaid` is fully implemented today. */
38
- type CardType = "credit" | "prepaid" | "gift";
39
- /**
40
- * Card lifecycle state.
41
- *
42
- * `pending_payment` is a transient state: the row exists but the
43
- * per-card issuance-fee debit has not yet succeeded; such cards have no
44
- * provider reference and no user-visible side effects.
45
- */
46
- type CardStatus = "pending_payment" | "active" | "frozen" | "terminated" | "redeemed" | "failed";
47
- /**
48
- * A card design: the artwork a card is shown with. `image_url` is the front,
49
- * `image_url_back` the back; both are either absolute URLs or paths relative
50
- * to the API origin (the deployment's default design is
51
- * `/card-designs/default.svg`, its back `/card-designs/default.svg?side=back`)
52
- * — pass them through `client.assetUrl()` before rendering. `image_url_back`
53
- * is `null` or absent for a one-sided design: show the front on both sides.
54
- * The picture is in the proportions of a plastic card (1586×1000) and draws
55
- * no chip or card data; the client renders the number, name and expiry on
56
- * top. `id` is `null` for the deployment default, which is rendered from the
57
- * branding settings.
58
- */
59
- interface CardDesignRef {
60
- id: string | null;
61
- name?: string;
62
- image_url: string;
63
- image_url_back?: string | null;
64
- }
65
- /**
66
- * What issuing a card costs the caller. `amount` is the price after the
67
- * user's subscription discount; `base_amount` is the list price and
68
- * `discount_bps` the discount in basis points (1000 = 10 %). `label` is the
69
- * operator's wording for the fee line ("Card issuance").
70
- */
71
- interface CardProductPrice {
72
- amount: string;
73
- currency: string;
74
- label: string;
75
- base_amount: string;
76
- discount_bps: number;
77
- }
78
- /**
79
- * A card the user can order, as listed by `GET /me/card-products`. The id is
80
- * opaque — it names a product, never a provider. `designs` is the set the
81
- * user may pick from (may be empty when only the default applies); `design`
82
- * is what the card gets when no choice is made. `price` is `null` for a
83
- * free card. `features` is an operator-defined object (scheme, wallet
84
- * support, load limits, …) with no fixed keys.
85
- */
86
- interface CardProduct {
87
- id: string;
88
- name: string;
89
- description: string | null;
90
- card_type: CardType;
91
- currency: string | null;
92
- features: Record<string, unknown>;
93
- design: CardDesignRef;
94
- designs: CardDesignRef[];
95
- price: CardProductPrice | null;
96
- /** True for the product the deployment issues when none is chosen. */
97
- is_default: boolean;
98
- }
99
- /**
100
- * A card record as the Takeal API returns it. Mirrors the `cards` table. Note the
101
- * SDK never receives the full PAN or CVV here — only `last4` + expiry. The
102
- * gift-card `redemption_code` is returned exactly once (on create) and
103
- * scrubbed from subsequent list/get responses.
104
- */
105
- interface Card {
106
- id: string;
107
- user_id: string;
108
- card_type: CardType;
109
- status: CardStatus;
110
- /** Last four digits of the PAN — safe to display. */
111
- last4: string | null;
112
- expiry_month: number | null;
113
- expiry_year: number | null;
114
- /** Gift cards only, present once on create then scrubbed. */
115
- redemption_code?: string;
116
- /** Decimal as a string. */
117
- initial_amount: string | null;
118
- currency: string;
119
- failure_reason: string | null;
120
- /** The name the user gave the card, or `null`. */
121
- name: string | null;
122
- /** The artwork the card is shown with. Always present. */
123
- design: CardDesignRef;
124
- /** The product the card was issued from; `null` for cards issued without one. */
125
- product: {
126
- id: string;
127
- name: string;
128
- } | null;
129
- created_at: string;
130
- updated_at: string;
131
- }
132
- interface CreateCardInput {
133
- /**
134
- * A product id from {@link CardsResource.listProducts}. Sent as
135
- * `product_id`. When given, `type` and `issuer_slug` may be omitted; when
136
- * both are given they must agree with the product (400 `product_mismatch`).
137
- * Unknown, disabled or hidden product → 400 `unknown_product`.
138
- */
139
- productId?: string;
140
- /** A name for the card, 1–40 characters. Sent as `name`. */
141
- name?: string;
142
- /**
143
- * One of the product's `designs`. Sent as `design_id`. `null` or omitted
144
- * picks the product's default design; a design outside the product's set →
145
- * 400 `design_not_allowed`.
146
- */
147
- designId?: string | null;
148
- /**
149
- * `prepaid` (the only fully-wired type today), `credit`, or `gift`.
150
- * Optional when `productId` is given, required otherwise.
151
- */
152
- type?: CardType;
153
- /** Decimal as a string. The prepaid load amount drained from wallet balance. */
154
- initial_amount?: string;
155
- /** ISO 4217 code, e.g. `"USD"`. */
156
- currency: string;
157
- /**
158
- * Optional. Slug of a specific issuer to mint with. Omit to let
159
- * the Takeal API pick the first active issuer. Unknown slug → 400; empty issuer
160
- * list → 503.
161
- */
162
- issuer_slug?: string;
163
- metadata?: Record<string, string>;
164
- /** Structured billing details — real issuers require these for 3DS / KYC. */
165
- customer?: CustomerInfo;
166
- /**
167
- * Required by the Takeal API on this write endpoint. Same key + body replays the
168
- * original card; same key + different body returns 409.
169
- */
170
- idempotencyKey: string;
171
- }
172
- /** Remaining balance of a prepaid card. */
173
- interface CardBalance {
174
- amount: string;
175
- currency: string;
176
- }
177
- /** What a top-up of a card can be right now, from `GET /me/cards/{id}/topup`. */
178
- interface TopUpTerms {
179
- /** Whether the card can be topped up at this moment. */
180
- available: boolean;
181
- /** Why not, in plain words, when `available` is false. */
182
- reason: string | null;
183
- /** Currency top-ups are made in: the card's. */
184
- currency: string;
185
- /** What the wallet holds right now, in the wallet's currency. */
186
- wallet_available: CardBalance;
187
- /** Smallest single top-up the product allows, or `null` for no floor. */
188
- min: CardBalance | null;
189
- /** Largest single top-up the product allows, or `null` for no cap. */
190
- max: CardBalance | null;
191
- }
192
- interface TopUpInput {
193
- /** Amount to add, decimal string, in the card's currency. */
194
- amount: string;
195
- /**
196
- * Required. Same key + same amount replays the first outcome; same key +
197
- * different amount is 409. Use a stable UUID per attempt so a retried
198
- * network call cannot move the money twice.
199
- */
200
- idempotencyKey: string;
201
- }
202
- /** One top-up attempt as the API records it. */
203
- interface CardTopUp {
204
- id: string;
205
- card_id: string;
206
- status: "pending" | "confirmed" | "failed";
207
- /** What landed on the card, decimal string, in `currency`. */
208
- amount: string;
209
- currency: string;
210
- /** What the wallet paid, decimal string, in `wallet_currency`. */
211
- wallet_amount: string;
212
- wallet_currency: string;
213
- failure_reason: string | null;
214
- created_at: string;
215
- updated_at: string;
216
- }
217
- /** A completed top-up with the state to redraw: card, its balance, the wallet. */
218
- interface TopUpResult {
219
- topup: CardTopUp;
220
- card: Card;
221
- card_balance: CardBalance;
222
- wallet: CardBalance;
223
- }
224
- /** Fields a user can change on their own card. Omitted fields are left as they are. */
225
- interface UpdateCardInput {
226
- /** New name, 1–40 characters. Sent as `name`. */
227
- name?: string;
228
- /**
229
- * New design (one of the product's `designs`), or `null` for the product's
230
- * default. Sent as `design_id`.
231
- */
232
- designId?: string | null;
233
- }
234
- /**
235
- * Kept for callers written against 0.3.x: the API no longer asks for a
236
- * password or a code on reveal, the session is enough. Both fields are
237
- * ignored and will be dropped in the next major.
238
- * @deprecated
239
- */
240
- interface RevealCardInput {
241
- password?: string;
242
- totpCode?: string;
243
- }
244
- /**
245
- * Full card data from a successful reveal. **Security**: never persist this —
246
- * keep it in volatile memory only, clear it within `expires_in_seconds`, and
247
- * never write it to localStorage / logs (the API marks the response no-store).
248
- */
249
- interface RevealedCard {
250
- pan: string;
251
- cvv: string;
252
- expiry_month: number;
253
- expiry_year: number;
254
- holder_name: string;
255
- /** Display window before the client should auto-clear the data. */
256
- expires_in_seconds: number;
257
- }
258
- declare class CardsResource {
259
- private readonly http;
260
- constructor(http: HttpClient);
261
- /**
262
- * Issue a card backed by the user's wallet balance. Resolves to the new
263
- * `Card`. On a ledger failure after provider creation, the Takeal API rolls the row
264
- * to `failed` (never an orphaned active card); inspect `status` /
265
- * `failure_reason` on the result.
266
- */
267
- create(input: CreateCardInput): Promise<Card>;
268
- /**
269
- * The cards the caller can order, in the order the deployment offers them
270
- * (the default product first). Each item carries its name, description,
271
- * artwork, the issuance price after the caller's subscription discount,
272
- * and the currency. Pass an item's `id` as `productId` to {@link create}.
273
- */
274
- listProducts(): Promise<CardProduct[]>;
275
- /** One product from the catalog. 404 when unknown, disabled or hidden. */
276
- getProduct(id: string): Promise<CardProduct>;
277
- /**
278
- * The public catalog: the same products, order and default as
279
- * {@link listProducts}, but readable before sign-in, for a landing page or
280
- * the cabinet's first screen. Prices are list prices (`discount_bps` is
281
- * always 0); once the user is signed in, {@link listProducts} shows what
282
- * they pay. The API lets caches keep this response for a minute.
283
- */
284
- catalog(): Promise<CardProduct[]>;
285
- /**
286
- * Rename the caller's own card or change its design. Resolves to the
287
- * updated card. 404 if the card isn't the caller's; 400 `invalid_name` /
288
- * `design_not_allowed` on a bad value.
289
- */
290
- update(id: string, input: UpdateCardInput): Promise<Card>;
291
- /** Fetch one card by id. */
292
- get(id: string): Promise<Card>;
293
- /** List the caller's cards, most recent first. */
294
- list(): Promise<Card[]>;
295
- /**
296
- * Remaining balance of a prepaid card. `currency` is required by the Takeal API and
297
- * forwarded as a query param.
298
- */
299
- balance(id: string, currency: string): Promise<CardBalance>;
300
- /**
301
- * What a top-up of this card can be right now: whether it is possible, the
302
- * currency, the wallet balance, and the product's floor and cap for one
303
- * top-up. Read it before drawing the form. 404 if the card isn't the caller's.
304
- */
305
- topUpTerms(id: string): Promise<TopUpTerms>;
306
- /**
307
- * Move money from the wallet onto the caller's own card. The wallet is
308
- * debited first, then the card's provider loads the card; if the provider
309
- * refuses, the money is back on the wallet and the error says so. Resolves
310
- * to the card, its new balance and the wallet balance, so no second call
311
- * is needed. Errors carry a sentence the user can read: 400 outside the
312
- * floor or cap · 402 not enough in the wallet · 404 not the caller's card ·
313
- * 409 card frozen, closed or still being issued · 501 provider can't top
314
- * up · 502/503 provider declined or unreachable (wallet untouched).
315
- */
316
- topUp(id: string, input: TopUpInput): Promise<TopUpResult>;
317
- /**
318
- * Freeze the caller's own card. Reversible via {@link unfreeze}. The optional
319
- * `reason` is recorded on the audit trail. Resolves to the updated card.
320
- * 404 if the card isn't the caller's; 501 if the issuer can't freeze.
321
- */
322
- freeze(id: string, reason?: string): Promise<Card>;
323
- /**
324
- * Reveal the FULL PAN + CVV for the caller's own card. The signed-in
325
- * session is all the API asks for; the call is rate-limited and audited
326
- * server-side. The Takeal API never persists this data and marks the
327
- * response no-store; the SDK returns it verbatim and holds nothing.
328
- *
329
- * **Consumer security duties** (the SDK can't enforce these for you):
330
- * keep the result in volatile memory only, never write it to
331
- * localStorage / logs, and clear it within `expires_in_seconds`.
332
- *
333
- * 401 bad re-auth · 403 not your card · 429 rate-limited · 501 connector
334
- * has no sensitive-data endpoint · 503 provider error.
335
- */
336
- reveal(id: string, _input?: RevealCardInput): Promise<RevealedCard>;
337
- /** Unfreeze a previously-frozen card. Idempotent on an already-active card. */
338
- unfreeze(id: string): Promise<Card>;
339
- /**
340
- * Terminate the caller's own card. **One-way** — a terminated card cannot be
341
- * reactivated. The optional `reason` is audited. Idempotent on an
342
- * already-terminated card.
343
- */
344
- terminate(id: string, reason?: string): Promise<Card>;
345
- }
346
-
347
- export { type Card, type CardBalance, type CardDesignRef, type CardProduct, type CardProductPrice, type CardStatus, type CardTopUp, type CardType, CardsResource, type CreateCardInput, type RevealCardInput, type RevealedCard, type TopUpInput, type TopUpResult, type TopUpTerms, type UpdateCardInput };
1
+ import '../http-DeANAoTs.cjs';
2
+ export { B as BillingAddress, a as Card, c as CardBalance, d as CardDesignRef, C as CardProduct, e as CardProductPrice, f as CardStatus, g as CardTopUp, h as CardTransfer, i as CardType, b as CardsResource, j as CreateCardInput, I as IssuanceBonus, R as RevealCardInput, l as RevealedCard, T as TopUpInput, m as TopUpResult, n as TopUpTerms, o as TransferInput, p as TransferResult, U as UpdateCardInput, q as cardRequestBody } from '../cards-B_aNY35J.cjs';