@takeal/cusfront-sdk 0.3.20 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (121) hide show
  1. package/CHANGELOG.md +127 -0
  2. package/README.md +407 -8
  3. package/dist/analytics.cjs +417 -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 +403 -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 +939 -77
  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 +924 -78
  22. package/dist/index.js.map +1 -1
  23. package/dist/react/index.d.cts +12 -5
  24. package/dist/react/index.d.ts +12 -5
  25. package/dist/resources/attribution.cjs +82 -0
  26. package/dist/resources/attribution.cjs.map +1 -0
  27. package/dist/resources/attribution.d.cts +100 -0
  28. package/dist/resources/attribution.d.ts +100 -0
  29. package/dist/resources/attribution.js +78 -0
  30. package/dist/resources/attribution.js.map +1 -0
  31. package/dist/resources/auth.cjs +81 -15
  32. package/dist/resources/auth.cjs.map +1 -1
  33. package/dist/resources/auth.d.cts +53 -6
  34. package/dist/resources/auth.d.ts +53 -6
  35. package/dist/resources/auth.js +81 -15
  36. package/dist/resources/auth.js.map +1 -1
  37. package/dist/resources/balance.d.cts +1 -1
  38. package/dist/resources/balance.d.ts +1 -1
  39. package/dist/resources/blog.cjs.map +1 -1
  40. package/dist/resources/blog.d.cts +8 -1
  41. package/dist/resources/blog.d.ts +8 -1
  42. package/dist/resources/blog.js.map +1 -1
  43. package/dist/resources/bonus.cjs +28 -0
  44. package/dist/resources/bonus.cjs.map +1 -0
  45. package/dist/resources/bonus.d.cts +121 -0
  46. package/dist/resources/bonus.d.ts +121 -0
  47. package/dist/resources/bonus.js +26 -0
  48. package/dist/resources/bonus.js.map +1 -0
  49. package/dist/resources/branding.d.cts +1 -1
  50. package/dist/resources/branding.d.ts +1 -1
  51. package/dist/resources/cards.cjs +48 -10
  52. package/dist/resources/cards.cjs.map +1 -1
  53. package/dist/resources/cards.d.cts +2 -347
  54. package/dist/resources/cards.d.ts +2 -347
  55. package/dist/resources/cards.js +48 -11
  56. package/dist/resources/cards.js.map +1 -1
  57. package/dist/resources/codes.cjs +20 -0
  58. package/dist/resources/codes.cjs.map +1 -0
  59. package/dist/resources/codes.d.cts +100 -0
  60. package/dist/resources/codes.d.ts +100 -0
  61. package/dist/resources/codes.js +18 -0
  62. package/dist/resources/codes.js.map +1 -0
  63. package/dist/resources/deposits.cjs +28 -3
  64. package/dist/resources/deposits.cjs.map +1 -1
  65. package/dist/resources/deposits.d.cts +3 -176
  66. package/dist/resources/deposits.d.ts +3 -176
  67. package/dist/resources/deposits.js +28 -3
  68. package/dist/resources/deposits.js.map +1 -1
  69. package/dist/resources/devices.d.cts +2 -2
  70. package/dist/resources/devices.d.ts +2 -2
  71. package/dist/resources/documents.cjs +64 -0
  72. package/dist/resources/documents.cjs.map +1 -0
  73. package/dist/resources/documents.d.cts +212 -0
  74. package/dist/resources/documents.d.ts +212 -0
  75. package/dist/resources/documents.js +62 -0
  76. package/dist/resources/documents.js.map +1 -0
  77. package/dist/resources/funding-options.cjs +16 -0
  78. package/dist/resources/funding-options.cjs.map +1 -0
  79. package/dist/resources/funding-options.d.cts +3 -0
  80. package/dist/resources/funding-options.d.ts +3 -0
  81. package/dist/resources/funding-options.js +14 -0
  82. package/dist/resources/funding-options.js.map +1 -0
  83. package/dist/resources/history.cjs +31 -0
  84. package/dist/resources/history.cjs.map +1 -0
  85. package/dist/resources/history.d.cts +95 -0
  86. package/dist/resources/history.d.ts +95 -0
  87. package/dist/resources/history.js +29 -0
  88. package/dist/resources/history.js.map +1 -0
  89. package/dist/resources/me.d.cts +3 -1
  90. package/dist/resources/me.d.ts +3 -1
  91. package/dist/resources/notifications.d.cts +1 -1
  92. package/dist/resources/notifications.d.ts +1 -1
  93. package/dist/resources/push.d.cts +1 -1
  94. package/dist/resources/push.d.ts +1 -1
  95. package/dist/resources/referral.cjs +16 -0
  96. package/dist/resources/referral.cjs.map +1 -0
  97. package/dist/resources/referral.d.cts +58 -0
  98. package/dist/resources/referral.d.ts +58 -0
  99. package/dist/resources/referral.js +14 -0
  100. package/dist/resources/referral.js.map +1 -0
  101. package/dist/resources/sessions.d.cts +1 -1
  102. package/dist/resources/sessions.d.ts +1 -1
  103. package/dist/resources/subscription.cjs +24 -0
  104. package/dist/resources/subscription.cjs.map +1 -0
  105. package/dist/resources/subscription.d.cts +48 -0
  106. package/dist/resources/subscription.d.ts +48 -0
  107. package/dist/resources/subscription.js +22 -0
  108. package/dist/resources/subscription.js.map +1 -0
  109. package/dist/resources/subscriptions.d.cts +1 -1
  110. package/dist/resources/subscriptions.d.ts +1 -1
  111. package/dist/resources/wallet.d.cts +1 -1
  112. package/dist/resources/wallet.d.ts +1 -1
  113. package/dist/telegram.cjs +474 -77
  114. package/dist/telegram.cjs.map +1 -1
  115. package/dist/telegram.d.cts +12 -5
  116. package/dist/telegram.d.ts +12 -5
  117. package/dist/telegram.js +474 -77
  118. package/dist/telegram.js.map +1 -1
  119. package/package.json +46 -1
  120. package/dist/customer-CoxPwe5o.d.cts +0 -32
  121. package/dist/customer-CoxPwe5o.d.ts +0 -32
@@ -0,0 +1,514 @@
1
+ import { H as HttpClient } from './http-DeANAoTs.cjs';
2
+
3
+ /**
4
+ * Structured customer billing details — shared by the deposits and cards
5
+ * resources. Mirrors the Takeal API's `CustomerInfo` / `Address`.
6
+ *
7
+ * Every field is optional at this layer; each provider connector enforces its
8
+ * own required subset and fails the operation if a mandatory field is missing.
9
+ * Real PSPs / card issuers demand a billing address + name + email for
10
+ * compliance, 3DS, or APM redirect flows; crypto / gift rails usually ignore it.
11
+ */
12
+ /** Postal address. ISO 3166 codes recommended where the provider supports them. */
13
+ interface Address {
14
+ line1?: string;
15
+ line2?: string;
16
+ city?: string;
17
+ /** ISO 3166-2 subdivision code, e.g. `"US-CA"`. Free-form fallback accepted. */
18
+ state?: string;
19
+ postal_code?: string;
20
+ /** ISO 3166-1 alpha-2, e.g. `"US"`. */
21
+ country?: string;
22
+ }
23
+ interface CustomerInfo {
24
+ email?: string;
25
+ first_name?: string;
26
+ last_name?: string;
27
+ /** E.164 format, e.g. `"+48..."`. Free-form fallback accepted. */
28
+ phone?: string;
29
+ /** ISO 8601 `YYYY-MM-DD`. KYC-tier issuers may require it. */
30
+ birth_date?: string;
31
+ billing_address?: Address;
32
+ }
33
+
34
+ /**
35
+ * Cards resource — `client.cards.*`.
36
+ *
37
+ * The end-user "money OUT" surface: a user issues themselves a card backed by
38
+ * their wallet balance via an issuer connector. Mirrors the Takeal API's
39
+ * `/me/cards` routes:
40
+ *
41
+ * GET /card-products → catalog (public, before sign-in)
42
+ * GET /me/card-products → listProducts (the catalog, personal price)
43
+ * GET /me/card-products/{id} → getProduct
44
+ * GET /me/cards/{id}/topup → topUpTerms
45
+ * POST /me/cards/{id}/topup → topUp
46
+ * POST /me/cards → create
47
+ * GET /me/cards → list (most recent first)
48
+ * GET /me/cards/{id} → get
49
+ * PATCH /me/cards/{id} → update (name, design)
50
+ * GET /me/cards/{id}/balance → balance (prepaid remaining)
51
+ * POST /me/cards/{id}/freeze → freeze
52
+ * POST /me/cards/{id}/unfreeze → unfreeze
53
+ * POST /me/cards/{id}/transfer → transfer (to another of their cards)
54
+ * POST /me/cards/{id}/terminate → terminate (one-way)
55
+ *
56
+ * The lifecycle actions are ownership-gated server-side: a caller can only
57
+ * freeze / unfreeze / terminate a card that belongs to them (else 404).
58
+ *
59
+ * ## What is intentionally NOT here
60
+ *
61
+ * Card-data reveal (PAN / CVV) is a separate, security-sensitive flow with its
62
+ * own re-auth + rate-limit + audit contract and is intentionally
63
+ * NOT part of this resource (tracked separately).
64
+ *
65
+ * Today only PREPAID is wired end-to-end; CREDIT and GIFT return 400 from
66
+ * the Takeal API until their issuer flows land.
67
+ */
68
+ /** Card product. Only `prepaid` is fully implemented today. */
69
+ type CardType = "credit" | "prepaid" | "gift";
70
+ /**
71
+ * Card lifecycle state.
72
+ *
73
+ * `pending_payment` is a transient state: the row exists but the
74
+ * per-card issuance-fee debit has not yet succeeded; such cards have no
75
+ * provider reference and no user-visible side effects.
76
+ */
77
+ type CardStatus = "pending_payment" | "active" | "frozen" | "terminated" | "redeemed" | "failed";
78
+ /**
79
+ * A card design: the artwork a card is shown with. `image_url` is the front,
80
+ * `image_url_back` the back; both are either absolute URLs or paths relative
81
+ * to the API origin (the deployment's default design is
82
+ * `/card-designs/default.svg`, its back `/card-designs/default.svg?side=back`)
83
+ * — pass them through `client.assetUrl()` before rendering. `image_url_back`
84
+ * is `null` or absent for a one-sided design: show the front on both sides.
85
+ * The picture is in the proportions of a plastic card (1586×1000) and draws
86
+ * no chip or card data; the client renders the number, name and expiry on
87
+ * top. `id` is `null` for the deployment default, which is rendered from the
88
+ * branding settings.
89
+ */
90
+ interface CardDesignRef {
91
+ id: string | null;
92
+ name?: string;
93
+ image_url: string;
94
+ image_url_back?: string | null;
95
+ }
96
+ /**
97
+ * What issuing a card costs the caller. `amount` is the price after the
98
+ * user's subscription discount; `base_amount` is the list price and
99
+ * `discount_bps` the discount in basis points (1000 = 10 %). `label` is the
100
+ * operator's wording for the fee line ("Card issuance").
101
+ */
102
+ interface CardProductPrice {
103
+ /** What the user pays, decimal string, after their subscription discount. */
104
+ amount: string;
105
+ /**
106
+ * ISO 4217 code: the currency the buyer pays in. A signed-in user sees
107
+ * their wallet currency, converted the way issuance will charge it; the
108
+ * public catalog shows the currency the operator priced the card in. It
109
+ * is not necessarily the currency the card is held in (`CardProduct.currency`).
110
+ */
111
+ currency: string;
112
+ /** Wording for the fee line, e.g. "Card issuance". */
113
+ label: string;
114
+ /** The list price before the discount, decimal string, in the same currency. */
115
+ base_amount: string;
116
+ /** Discount applied, in basis points (1000 = 10%). */
117
+ discount_bps: number;
118
+ }
119
+ /**
120
+ * A card the user can order, as listed by `GET /me/card-products`. The id is
121
+ * opaque — it names a product, never a provider. The list comes in the
122
+ * order the operator arranged the storefront; `is_default` marks the
123
+ * product issued when none is chosen, wherever it sits. `designs` is the
124
+ * set the user may pick from (may be empty when only the default applies);
125
+ * `design` is what the card gets when no choice is made. `price` is `null`
126
+ * for a free card. `features` is an operator-defined object (scheme, wallet
127
+ * support, load limits, …) with no fixed keys.
128
+ */
129
+ interface CardProduct {
130
+ id: string;
131
+ name: string;
132
+ /** One line under the name on the tile, or `null`. */
133
+ tagline: string | null;
134
+ description: string | null;
135
+ /** Selling points to list on the product card, in order. May be empty. */
136
+ benefits: string[];
137
+ /**
138
+ * Picture for the product tile, absolute URL, or `null`: show the card
139
+ * design (`design.image_url`) then.
140
+ */
141
+ tile_image_url: string | null;
142
+ card_type: CardType;
143
+ currency: string | null;
144
+ features: Record<string, unknown>;
145
+ design: CardDesignRef;
146
+ designs: CardDesignRef[];
147
+ price: CardProductPrice | null;
148
+ /**
149
+ * The balance a new card comes with, already included in `price`; `null`
150
+ * when the card starts empty and is funded with `topUp()` afterwards.
151
+ */
152
+ starting_balance: CardBalance | null;
153
+ /** True for the product the deployment issues when none is chosen. */
154
+ is_default: boolean;
155
+ }
156
+ /**
157
+ * A card record as the Takeal API returns it. Mirrors the `cards` table. Note the
158
+ * SDK never receives the full PAN or CVV here — only `last4` + expiry. The
159
+ * gift-card `redemption_code` is returned exactly once (on create) and
160
+ * scrubbed from subsequent list/get responses.
161
+ */
162
+ interface Card {
163
+ id: string;
164
+ user_id: string;
165
+ card_type: CardType;
166
+ status: CardStatus;
167
+ /** Last four digits of the PAN — safe to display. */
168
+ last4: string | null;
169
+ expiry_month: number | null;
170
+ expiry_year: number | null;
171
+ /** Gift cards only, present once on create then scrubbed. */
172
+ redemption_code?: string;
173
+ /** The balance the card was issued with, decimal string; `null` or `"0"` for a card issued empty. */
174
+ initial_amount: string | null;
175
+ currency: string;
176
+ failure_reason: string | null;
177
+ /** The name the user gave the card, or `null`. */
178
+ name: string | null;
179
+ /** The artwork the card is shown with. Always present. */
180
+ design: CardDesignRef;
181
+ /** The product the card was issued from; `null` for cards issued without one. */
182
+ product: {
183
+ id: string;
184
+ name: string;
185
+ } | null;
186
+ created_at: string;
187
+ updated_at: string;
188
+ /** Only on the result of `create`, when bonuses paid part of the price. */
189
+ bonus?: IssuanceBonus;
190
+ }
191
+ /** How bonuses changed a new card's price ("was / now"). Decimal strings in `currency`. */
192
+ interface IssuanceBonus {
193
+ /** Bonuses used. */
194
+ units: string;
195
+ /** The price before bonuses ("was"). */
196
+ price: string;
197
+ /** What the bonuses covered. */
198
+ covered: string;
199
+ /** What the wallet paid ("now"). */
200
+ paid: string;
201
+ currency: string;
202
+ }
203
+ interface CreateCardInput {
204
+ /**
205
+ * A product id from {@link CardsResource.listProducts}. Sent as
206
+ * `product_id`. When given, `type` and `issuer_slug` may be omitted; when
207
+ * both are given they must agree with the product (400 `product_mismatch`).
208
+ * Unknown, disabled or hidden product → 400 `unknown_product`.
209
+ */
210
+ productId?: string;
211
+ /** A name for the card, 1–40 characters. Sent as `name`. */
212
+ name?: string;
213
+ /**
214
+ * One of the product's `designs`. Sent as `design_id`. `null` or omitted
215
+ * picks the product's default design; a design outside the product's set →
216
+ * 400 `design_not_allowed`.
217
+ */
218
+ designId?: string | null;
219
+ /**
220
+ * `prepaid` (the only fully-wired type today), `credit`, or `gift`.
221
+ * Optional when `productId` is given, required otherwise.
222
+ */
223
+ type?: CardType;
224
+ /**
225
+ * @deprecated Ignored since 0.3.21. A card is issued for its product price;
226
+ * the balance it starts with, if the product includes one, is part of that
227
+ * price (see `CardProduct.starting_balance`). Money is added afterwards
228
+ * with {@link CardsResource.topUp}. The field is no longer sent.
229
+ */
230
+ initial_amount?: string;
231
+ /** ISO 4217 code, e.g. `"USD"`. */
232
+ currency: string;
233
+ /**
234
+ * Optional. Slug of a specific issuer to mint with. Omit to let
235
+ * the Takeal API pick the first active issuer. Unknown slug → 400; empty issuer
236
+ * list → 503.
237
+ */
238
+ issuer_slug?: string;
239
+ metadata?: Record<string, string>;
240
+ /** Structured billing details — real issuers require these for 3DS / KYC. */
241
+ customer?: CustomerInfo;
242
+ /**
243
+ * Pay part of the price with bonuses. Sent as `use_bonus`. On by default
244
+ * whenever the user has bonuses; `false` pays it all from the wallet.
245
+ */
246
+ useBonus?: boolean;
247
+ /** The most bonuses to use, decimal string. Sent as `bonus_amount`. */
248
+ bonusAmount?: string;
249
+ /**
250
+ * A promo code for the card's price. Sent as `promo_code`. Its discount
251
+ * comes off before bonuses; `client.codes.validate` shows it first. A code
252
+ * that can't be used fails the request with 400 `promo_code_*` and the
253
+ * reason. Without one, the code the user signed up with applies when it
254
+ * covers cards. Ignored inside `deposits.initiate({ issue_card })`: send
255
+ * `promo_code` on the top-up there.
256
+ */
257
+ promoCode?: string;
258
+ /**
259
+ * Required by the Takeal API on this write endpoint. Same key + body replays the
260
+ * original card; same key + different body returns 409.
261
+ */
262
+ idempotencyKey: string;
263
+ }
264
+ /**
265
+ * The wire body of a card request: the camelCase fields renamed to what
266
+ * the API reads. Shared by {@link CardsResource.create} and the
267
+ * `issue_card` block of `deposits.initiate`.
268
+ */
269
+ declare function cardRequestBody(input: Omit<CreateCardInput, "idempotencyKey" | "currency"> & {
270
+ currency?: string;
271
+ }): Record<string, unknown>;
272
+ /** Remaining balance of a prepaid card. */
273
+ interface CardBalance {
274
+ amount: string;
275
+ currency: string;
276
+ }
277
+ /** What a top-up of a card can be right now, from `GET /me/cards/{id}/topup`. */
278
+ interface TopUpTerms {
279
+ /** Whether the card can be topped up at this moment. */
280
+ available: boolean;
281
+ /** Why not, in plain words, when `available` is false. */
282
+ reason: string | null;
283
+ /** Currency top-ups are made in: the card's. */
284
+ currency: string;
285
+ /** What the wallet holds right now, in the wallet's currency. */
286
+ wallet_available: CardBalance;
287
+ /** Smallest single top-up the product allows, or `null` for no floor. */
288
+ min: CardBalance | null;
289
+ /** Largest single top-up the product allows, or `null` for no cap. */
290
+ max: CardBalance | null;
291
+ }
292
+ interface TopUpInput {
293
+ /** Amount to add, decimal string, in the card's currency. */
294
+ amount: string;
295
+ /**
296
+ * Required. Same key + same amount replays the first outcome; same key +
297
+ * different amount is 409. Use a stable UUID per attempt so a retried
298
+ * network call cannot move the money twice.
299
+ */
300
+ idempotencyKey: string;
301
+ }
302
+ /** One top-up attempt as the API records it. */
303
+ interface CardTopUp {
304
+ id: string;
305
+ card_id: string;
306
+ status: "pending" | "confirmed" | "failed";
307
+ /** What landed on the card, decimal string, in `currency`. */
308
+ amount: string;
309
+ currency: string;
310
+ /** What the wallet paid, decimal string, in `wallet_currency`. */
311
+ wallet_amount: string;
312
+ wallet_currency: string;
313
+ failure_reason: string | null;
314
+ created_at: string;
315
+ updated_at: string;
316
+ }
317
+ /** A completed top-up with the state to redraw: card, its balance, the wallet. */
318
+ interface TopUpResult {
319
+ topup: CardTopUp;
320
+ card: Card;
321
+ card_balance: CardBalance;
322
+ wallet: CardBalance;
323
+ }
324
+ /** Fields a user can change on their own card. Omitted fields are left as they are. */
325
+ interface UpdateCardInput {
326
+ /** New name, 1–40 characters. Sent as `name`. */
327
+ name?: string;
328
+ /**
329
+ * New design (one of the product's `designs`), or `null` for the product's
330
+ * default. Sent as `design_id`.
331
+ */
332
+ designId?: string | null;
333
+ }
334
+ /**
335
+ * Kept for callers written against 0.3.x: the API no longer asks for a
336
+ * password or a code on reveal, the session is enough. Both fields are
337
+ * ignored and will be dropped in the next major.
338
+ * @deprecated
339
+ */
340
+ interface RevealCardInput {
341
+ password?: string;
342
+ totpCode?: string;
343
+ }
344
+ /**
345
+ * Full card data from a successful reveal. **Security**: never persist this —
346
+ * keep it in volatile memory only, clear it within `expires_in_seconds`, and
347
+ * never write it to localStorage / logs (the API marks the response no-store).
348
+ */
349
+ interface RevealedCard {
350
+ pan: string;
351
+ cvv: string;
352
+ expiry_month: number;
353
+ expiry_year: number;
354
+ holder_name: string;
355
+ /**
356
+ * The address the card is registered at — what a merchant's checkout asks
357
+ * for, and the postal code some of them decline a payment over. Absent
358
+ * when the deployment has not set one.
359
+ */
360
+ billing_address?: BillingAddress;
361
+ /** Display window before the client should auto-clear the data. */
362
+ expires_in_seconds: number;
363
+ }
364
+ /** Postal address a card is registered at. Which parts exist depends on the country. */
365
+ interface BillingAddress {
366
+ line1?: string;
367
+ line2?: string;
368
+ city?: string;
369
+ state?: string;
370
+ postal_code?: string;
371
+ country?: string;
372
+ }
373
+ /** What to move, and the key that makes a retry safe. */
374
+ interface TransferInput {
375
+ /** The card the money lands on. Must be the caller's, and of the same kind and currency. */
376
+ toCardId: string;
377
+ /** Amount to move, decimal string, in the cards' currency. */
378
+ amount: string;
379
+ /**
380
+ * Required. The same key with the same body replays the first outcome; a
381
+ * different body on the same key is 409.
382
+ */
383
+ idempotencyKey: string;
384
+ }
385
+ /** One transfer attempt as the API records it. */
386
+ interface CardTransfer {
387
+ id: string;
388
+ from_card_id: string;
389
+ to_card_id: string;
390
+ /**
391
+ * `confirmed` — the money is on the other card. `on_wallet` — it came off
392
+ * the first card but the second did not take it, so it is on the wallet
393
+ * and `failure_reason` says so in words. `pending` / `failed` otherwise.
394
+ */
395
+ status: "pending" | "confirmed" | "on_wallet" | "failed";
396
+ amount: string;
397
+ currency: string;
398
+ failure_reason: string | null;
399
+ created_at: string;
400
+ updated_at: string;
401
+ }
402
+ /** A finished transfer with the balances to redraw both cards and the wallet. */
403
+ interface TransferResult {
404
+ transfer: CardTransfer;
405
+ from_balance: CardBalance;
406
+ to_balance: CardBalance;
407
+ /** Holds the money when `transfer.status` is `on_wallet`. */
408
+ wallet: CardBalance;
409
+ }
410
+ declare class CardsResource {
411
+ private readonly http;
412
+ constructor(http: HttpClient);
413
+ /**
414
+ * Issue a card backed by the user's wallet balance. Resolves to the new
415
+ * `Card`. On a ledger failure after provider creation, the Takeal API rolls the row
416
+ * to `failed` (never an orphaned active card); inspect `status` /
417
+ * `failure_reason` on the result.
418
+ */
419
+ create(input: CreateCardInput): Promise<Card>;
420
+ /**
421
+ * The cards the caller can order, in the order the storefront shows them
422
+ * (`is_default` marks the one issued when none is chosen). Each item
423
+ * carries its product card (name, tagline, benefits, tile picture),
424
+ * artwork, and the issuance price after the caller's subscription
425
+ * discount, in the caller's wallet currency. Pass an item's `id` as
426
+ * `productId` to {@link create}.
427
+ */
428
+ listProducts(): Promise<CardProduct[]>;
429
+ /** One product from the catalog. 404 when unknown, disabled or hidden. */
430
+ getProduct(id: string): Promise<CardProduct>;
431
+ /**
432
+ * The public catalog: the same products, order and default as
433
+ * {@link listProducts}, but readable before sign-in, for a landing page or
434
+ * the cabinet's first screen. Prices are list prices (`discount_bps` is
435
+ * always 0); once the user is signed in, {@link listProducts} shows what
436
+ * they pay. The API lets caches keep this response for a minute.
437
+ */
438
+ catalog(): Promise<CardProduct[]>;
439
+ /**
440
+ * Rename the caller's own card or change its design. Resolves to the
441
+ * updated card. 404 if the card isn't the caller's; 400 `invalid_name` /
442
+ * `design_not_allowed` on a bad value.
443
+ */
444
+ update(id: string, input: UpdateCardInput): Promise<Card>;
445
+ /** Fetch one card by id. */
446
+ get(id: string): Promise<Card>;
447
+ /** List the caller's cards, most recent first. */
448
+ list(): Promise<Card[]>;
449
+ /**
450
+ * Remaining balance of a prepaid card. `currency` is required by the Takeal API and
451
+ * forwarded as a query param.
452
+ */
453
+ balance(id: string, currency: string): Promise<CardBalance>;
454
+ /**
455
+ * What a top-up of this card can be right now: whether it is possible, the
456
+ * currency, the wallet balance, and the product's floor and cap for one
457
+ * top-up. Read it before drawing the form. 404 if the card isn't the caller's.
458
+ */
459
+ topUpTerms(id: string): Promise<TopUpTerms>;
460
+ /**
461
+ * Move money from the wallet onto the caller's own card. The wallet is
462
+ * debited first, then the card's provider loads the card; if the provider
463
+ * refuses, the money is back on the wallet and the error says so. Resolves
464
+ * to the card, its new balance and the wallet balance, so no second call
465
+ * is needed. Errors carry a sentence the user can read: 400 outside the
466
+ * floor or cap · 402 not enough in the wallet · 404 not the caller's card ·
467
+ * 409 card frozen, closed or still being issued · 501 provider can't top
468
+ * up · 502/503 provider declined or unreachable (wallet untouched).
469
+ */
470
+ topUp(id: string, input: TopUpInput): Promise<TopUpResult>;
471
+ /**
472
+ * Move money from one of the caller's cards to another. Both must be
473
+ * theirs, active, in the same currency and of the same kind. The money
474
+ * travels through the wallet one leg at a time: when the second leg does
475
+ * not go through, the call still resolves, `transfer.status` is
476
+ * `on_wallet` and the money is on the wallet — never between two cards.
477
+ * Errors carry a sentence the user can read: 400 the same card twice,
478
+ * different currencies or different kinds · 402 the card holds less than
479
+ * that · 404 one of the cards isn't theirs · 409 a card is frozen, closed
480
+ * or still being issued, or the key was reused with a different body ·
481
+ * 501/502/503 the provider cannot or will not move it.
482
+ */
483
+ transfer(fromCardId: string, input: TransferInput): Promise<TransferResult>;
484
+ /**
485
+ * Freeze the caller's own card. Reversible via {@link unfreeze}. The optional
486
+ * `reason` is recorded on the audit trail. Resolves to the updated card.
487
+ * 404 if the card isn't the caller's; 501 if the issuer can't freeze.
488
+ */
489
+ freeze(id: string, reason?: string): Promise<Card>;
490
+ /**
491
+ * Reveal the FULL PAN + CVV for the caller's own card. The signed-in
492
+ * session is all the API asks for; the call is rate-limited and audited
493
+ * server-side. The Takeal API never persists this data and marks the
494
+ * response no-store; the SDK returns it verbatim and holds nothing.
495
+ *
496
+ * **Consumer security duties** (the SDK can't enforce these for you):
497
+ * keep the result in volatile memory only, never write it to
498
+ * localStorage / logs, and clear it within `expires_in_seconds`.
499
+ *
500
+ * 401 bad re-auth · 403 not your card · 429 rate-limited · 501 connector
501
+ * has no sensitive-data endpoint · 503 provider error.
502
+ */
503
+ reveal(id: string, _input?: RevealCardInput): Promise<RevealedCard>;
504
+ /** Unfreeze a previously-frozen card. Idempotent on an already-active card. */
505
+ unfreeze(id: string): Promise<Card>;
506
+ /**
507
+ * Terminate the caller's own card. **One-way** — a terminated card cannot be
508
+ * reactivated. The optional `reason` is audited. Idempotent on an
509
+ * already-terminated card.
510
+ */
511
+ terminate(id: string, reason?: string): Promise<Card>;
512
+ }
513
+
514
+ export { type Address as A, type BillingAddress as B, type CardProduct as C, type IssuanceBonus as I, type RevealCardInput as R, type TopUpInput as T, type UpdateCardInput as U, type Card as a, CardsResource as b, type CardBalance as c, type CardDesignRef as d, type CardProductPrice as e, type CardStatus as f, type CardTopUp as g, type CardTransfer as h, type CardType as i, type CreateCardInput as j, type CustomerInfo as k, type RevealedCard as l, type TopUpResult as m, type TopUpTerms as n, type TransferInput as o, type TransferResult as p, cardRequestBody as q };