@takeal/cusfront-sdk 0.6.6 → 0.6.11
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 +75 -2
- package/README.md +60 -7
- package/dist/{cards-DwmzjKDC.d.ts → cards-CuUdrQ0H.d.ts} +65 -7
- package/dist/{cards-BiXmrz7h.d.cts → cards-nXmDP0ei.d.cts} +65 -7
- package/dist/index.cjs +80 -6
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +10 -6
- package/dist/index.d.ts +10 -6
- package/dist/index.js +80 -7
- package/dist/index.js.map +1 -1
- package/dist/react/index.d.cts +2 -1
- package/dist/react/index.d.ts +2 -1
- package/dist/resources/auth.cjs.map +1 -1
- package/dist/resources/auth.d.cts +2 -1
- package/dist/resources/auth.d.ts +2 -1
- package/dist/resources/auth.js.map +1 -1
- package/dist/resources/cards.cjs +33 -4
- package/dist/resources/cards.cjs.map +1 -1
- package/dist/resources/cards.d.cts +2 -1
- package/dist/resources/cards.d.ts +2 -1
- package/dist/resources/cards.js +33 -5
- package/dist/resources/cards.js.map +1 -1
- package/dist/resources/claims.cjs +40 -0
- package/dist/resources/claims.cjs.map +1 -0
- package/dist/resources/claims.d.cts +114 -0
- package/dist/resources/claims.d.ts +114 -0
- package/dist/resources/claims.js +38 -0
- package/dist/resources/claims.js.map +1 -0
- package/dist/resources/deposits.cjs.map +1 -1
- package/dist/resources/deposits.d.cts +2 -1
- package/dist/resources/deposits.d.ts +2 -1
- package/dist/resources/deposits.js.map +1 -1
- package/dist/resources/funding-options.d.cts +2 -1
- package/dist/resources/funding-options.d.ts +2 -1
- package/dist/resources/me.d.cts +2 -1
- package/dist/resources/me.d.ts +2 -1
- package/dist/resources/subscription.cjs +9 -0
- package/dist/resources/subscription.cjs.map +1 -1
- package/dist/resources/subscription.d.cts +19 -2
- package/dist/resources/subscription.d.ts +19 -2
- package/dist/resources/subscription.js +9 -0
- package/dist/resources/subscription.js.map +1 -1
- package/dist/resources/support.cjs.map +1 -1
- package/dist/resources/support.d.cts +8 -3
- package/dist/resources/support.d.ts +8 -3
- package/dist/resources/support.js.map +1 -1
- package/dist/telegram.cjs +79 -6
- package/dist/telegram.cjs.map +1 -1
- package/dist/telegram.d.cts +2 -1
- package/dist/telegram.d.ts +2 -1
- package/dist/telegram.js +79 -6
- package/dist/telegram.js.map +1 -1
- package/package.json +9 -4
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,79 @@ All notable changes to `@takeal/cusfront-sdk` are documented here. The format
|
|
|
4
4
|
follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/) and the project
|
|
5
5
|
adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
6
6
|
|
|
7
|
+
## [0.6.11] — 2026-11-13
|
|
8
|
+
|
|
9
|
+
### Added
|
|
10
|
+
|
|
11
|
+
- A card's details can be "being prepared" right after issuance, for issuers
|
|
12
|
+
that show them only on their own page. `cards.reveal()` answers with
|
|
13
|
+
`state`: `numbers`, `page` (`reveal_url`) or `pending`, and `Card.details_pending`
|
|
14
|
+
says it on the card itself, so a client can show "Details are being
|
|
15
|
+
prepared" without calling reveal. A pending reveal doesn't count against the
|
|
16
|
+
reveal limit. Once the details are ready, reveals give the numbers as text
|
|
17
|
+
again. `revealState()` tells the three answers apart for a raw response.
|
|
18
|
+
|
|
19
|
+
### Changed
|
|
20
|
+
|
|
21
|
+
- `SUPPORTED_MEISTER` is `>=0.7.6, <1.0.0`: platform 0.7.6 is where details can
|
|
22
|
+
be "being prepared".
|
|
23
|
+
|
|
24
|
+
## [0.6.10] — 2026-11-13
|
|
25
|
+
|
|
26
|
+
### Added
|
|
27
|
+
|
|
28
|
+
- `cards.balance()` answers `pending` as well: top-ups the issuer has
|
|
29
|
+
accepted and not confirmed yet. That money is never in `amount`, even
|
|
30
|
+
when the issuer already shows it in its own balance, so show it next to
|
|
31
|
+
the balance as on its way. Needs platform 0.7.5; an older
|
|
32
|
+
platform leaves it out.
|
|
33
|
+
|
|
34
|
+
### Changed
|
|
35
|
+
|
|
36
|
+
- `Card.topups_pending` and `Card.topups_held` count top-ups paid straight to
|
|
37
|
+
the card as well as top-ups from the wallet (platform 0.7.5).
|
|
38
|
+
|
|
39
|
+
## [0.6.9] — 2026-11-10
|
|
40
|
+
|
|
41
|
+
The package's links (repository, issues, changelog) point at the public mirror on GitHub,
|
|
42
|
+
https://github.com/TakealGroup/cusfront-sdk. No code changes.
|
|
43
|
+
|
|
44
|
+
## [0.6.8] — 2026-10-27
|
|
45
|
+
|
|
46
|
+
Works with platform (TKL) 0.6.13 up to, not including, 1.0.0: `SUPPORTED_MEISTER` is
|
|
47
|
+
`>=0.6.13, <1.0.0`, so the SDK keeps working with platform 0.7.0.
|
|
48
|
+
|
|
49
|
+
## [0.6.7] — 2026-10-27
|
|
50
|
+
|
|
51
|
+
Needs platform (TKL) 0.6.13 or newer: `SUPPORTED_MEISTER` is `>=0.6.13, <0.7.0`.
|
|
52
|
+
|
|
53
|
+
### Added
|
|
54
|
+
|
|
55
|
+
- `subscription.cancel()`: the person cancels their subscription in one
|
|
56
|
+
step. What they paid for the current period comes back to the balance
|
|
57
|
+
for the days not used; the answer says how much. Needs the platform's
|
|
58
|
+
next release.
|
|
59
|
+
- `cards.reportLost(id, { kind, details })`: the user reports a card lost
|
|
60
|
+
or stolen, at any time. The report is recorded with the server's time,
|
|
61
|
+
which decides who pays for operations someone else made, and the card is
|
|
62
|
+
frozen at its issuer; only support can unfreeze it. Resolves to a
|
|
63
|
+
`Claim`. When the issuer can't be reached, `card_freeze` is `"pending"`
|
|
64
|
+
and the report counts all the same. Needs the platform's next release.
|
|
65
|
+
- `claims`: dispute a card operation or complain with `create({ kind,
|
|
66
|
+
description, cardId, transactionId })`, and follow every claim, lost and
|
|
67
|
+
stolen cards included, with `list()` and `get(id)`: a `number` such as
|
|
68
|
+
`C-000123`, a `status` (`open`, `in_review`, `resolved`, `rejected`) and
|
|
69
|
+
support's answer in `resolution`. Needs the platform's next release.
|
|
70
|
+
|
|
71
|
+
### Changed
|
|
72
|
+
|
|
73
|
+
- `support`: a message the person wrote in Telegram keeps its formatting.
|
|
74
|
+
Its `html` now carries it (bold, italic, code, links with their
|
|
75
|
+
addresses), and `text` the plain words. An answer sent to the person's
|
|
76
|
+
Telegram is `queued` until all of it got there and `failed` if it could
|
|
77
|
+
not; it used to be `delivered` at once. Needs the platform's next
|
|
78
|
+
release.
|
|
79
|
+
|
|
7
80
|
## [0.6.6] — 2026-10-23
|
|
8
81
|
|
|
9
82
|
### Added
|
|
@@ -510,5 +583,5 @@ Initial release of the typed client for the Takeal end-user API.
|
|
|
510
583
|
- Dual ESM + CJS builds with `.d.ts` types; per-resource sub-entrypoints for
|
|
511
584
|
tree-shaking.
|
|
512
585
|
|
|
513
|
-
[Unreleased]: https://
|
|
514
|
-
[0.1.0]: https://
|
|
586
|
+
[Unreleased]: https://github.com/TakealGroup/cusfront-sdk/compare/v0.1.0...HEAD
|
|
587
|
+
[0.1.0]: https://github.com/TakealGroup/cusfront-sdk/releases/tag/v0.1.0
|
package/README.md
CHANGED
|
@@ -411,19 +411,35 @@ keeps one, the `cardholder` (name, phone, address) a checkout asks for. No
|
|
|
411
411
|
password or code is asked again; the API rate-limits and logs every call.
|
|
412
412
|
Keep the result in memory only and clear it after `expires_in_seconds`.
|
|
413
413
|
|
|
414
|
-
|
|
415
|
-
|
|
414
|
+
A reveal gives one of three answers, and `r.state` says which:
|
|
415
|
+
|
|
416
|
+
- `numbers`: `pan`, `cvv` and the expiry are filled in.
|
|
417
|
+
- `page`: the issuer shows the numbers on a page of its own. `reveal_url` is
|
|
418
|
+
set and `pan` and `cvv` are empty.
|
|
419
|
+
- `pending`: the card's details are still being prepared. Some issuers show
|
|
420
|
+
the details only on their own page, and the platform reads them from there
|
|
421
|
+
shortly after the card is issued. Nothing else is filled in, and the
|
|
422
|
+
attempt doesn't count against the reveal limit.
|
|
416
423
|
|
|
417
424
|
```tsx
|
|
418
425
|
const r = await client.cards.reveal(card.id);
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
426
|
+
switch (r.state) {
|
|
427
|
+
case "pending":
|
|
428
|
+
return <p>Details are being prepared. Check back in a minute.</p>;
|
|
429
|
+
case "page":
|
|
430
|
+
// The issuer's page. Open it at once: the address is short-lived and
|
|
431
|
+
// often good for one opening. Never store or log it.
|
|
432
|
+
return <iframe src={r.reveal_url} sandbox="allow-scripts allow-same-origin" title="Card details" />;
|
|
433
|
+
case "numbers":
|
|
434
|
+
return showNumbers(r.pan, r.cvv, r.expiry_month, r.expiry_year);
|
|
423
435
|
}
|
|
424
|
-
showNumbers(r.pan, r.cvv, r.expiry_month, r.expiry_year);
|
|
425
436
|
```
|
|
426
437
|
|
|
438
|
+
The card says it before you ask: `card.details_pending` is `true` while its
|
|
439
|
+
details are being prepared. Show "Details are being prepared" instead of the
|
|
440
|
+
reveal button, and refresh the card later; no reveal call is needed for that.
|
|
441
|
+
Once the details are ready, reveals return the numbers again, as text.
|
|
442
|
+
|
|
427
443
|
A physical card takes a PIN from the user. Send it once; neither the SDK nor
|
|
428
444
|
the API keeps it, and the user gets a notification that it was set:
|
|
429
445
|
|
|
@@ -712,6 +728,43 @@ Only the last four digits come back (`payout_details.masked`). 409 codes of
|
|
|
712
728
|
`topup_in_progress`, `card_closing`, `no_balance` (the card holds nothing:
|
|
713
729
|
`cards.terminate()` it), `provider_refused`.
|
|
714
730
|
|
|
731
|
+
## A lost or stolen card, disputes and complaints
|
|
732
|
+
|
|
733
|
+
The user can report a card lost or stolen at any time. The report is
|
|
734
|
+
recorded first, with the server's time: that time decides who pays for
|
|
735
|
+
operations someone else made with the card, so show it. Then the card is
|
|
736
|
+
frozen at its issuer, and from then on only support can unfreeze it
|
|
737
|
+
(`cards.unfreeze()` answers 409 `card_locked`).
|
|
738
|
+
|
|
739
|
+
```ts
|
|
740
|
+
const claim = await client.cards.reportLost(cardId, { kind: "stolen", details: "Taken with my bag" });
|
|
741
|
+
// claim.number: "C-000123", to quote to support
|
|
742
|
+
// claim.reported_at: when the report counts from
|
|
743
|
+
// claim.card_freeze: "frozen", or "pending" when the issuer couldn't be reached;
|
|
744
|
+
// the report counts all the same and support freezes the card by hand
|
|
745
|
+
```
|
|
746
|
+
|
|
747
|
+
Reporting the same card again while its report is open returns that claim.
|
|
748
|
+
409 `card_not_open`: the card is closed or was never issued.
|
|
749
|
+
|
|
750
|
+
A card operation the user doesn't agree with, or anything else, is a claim
|
|
751
|
+
too. Name the operation as `client.history` does (`txn_<id>`); its card is
|
|
752
|
+
found from it.
|
|
753
|
+
|
|
754
|
+
```ts
|
|
755
|
+
await client.claims.create({
|
|
756
|
+
kind: "dispute", // or "complaint"
|
|
757
|
+
transactionId: entry.id,
|
|
758
|
+
description: "I didn't make this payment and don't know the shop.",
|
|
759
|
+
});
|
|
760
|
+
const { items, total } = await client.claims.list(); // newest first, every kind
|
|
761
|
+
const one = await client.claims.get(claimId);
|
|
762
|
+
// status: "open" → "in_review" → "resolved" | "rejected", with support's answer in `resolution`
|
|
763
|
+
```
|
|
764
|
+
|
|
765
|
+
The user is notified when a claim comes in and each time its status
|
|
766
|
+
changes. 409 `too_many_claims`: 20 claims are waiting for an answer already.
|
|
767
|
+
|
|
715
768
|
## Promo and referral codes
|
|
716
769
|
|
|
717
770
|
A code goes with the operation it is for. At sign-up an unknown or expired
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { Claim } from './resources/claims.js';
|
|
1
2
|
import { ConsentKind, ConsentChannel } from './resources/consents.js';
|
|
2
3
|
import { H as HttpClient } from './http-CL97TjMO.js';
|
|
3
4
|
|
|
@@ -444,6 +445,7 @@ declare class DepositsResource {
|
|
|
444
445
|
* GET /me/cards/{id}/balance → balance (prepaid remaining)
|
|
445
446
|
* POST /me/cards/{id}/freeze → freeze
|
|
446
447
|
* POST /me/cards/{id}/unfreeze → unfreeze
|
|
448
|
+
* POST /me/cards/{id}/report-lost → reportLost (lost or stolen: frozen at once)
|
|
447
449
|
* POST /me/cards/{id}/transfer → transfer (to another of their cards)
|
|
448
450
|
* POST /me/cards/{id}/terminate → terminate (one-way)
|
|
449
451
|
* POST /me/cards/{id}/reveal → reveal (the numbers, or a provider page)
|
|
@@ -636,10 +638,19 @@ interface Card {
|
|
|
636
638
|
close_blocked: CloseBlockedReason | null;
|
|
637
639
|
/**
|
|
638
640
|
* Top-ups the issuer has accepted and not loaded yet, summed, decimal
|
|
639
|
-
* string in `currency`; `null` when there are none.
|
|
641
|
+
* string in `currency`; `null` when there are none. It counts top-ups from
|
|
642
|
+
* the wallet and top-ups paid straight to the card. Show it next to the
|
|
640
643
|
* balance as money on its way to the card.
|
|
641
644
|
*/
|
|
642
645
|
topups_pending: string | null;
|
|
646
|
+
/**
|
|
647
|
+
* `true` while the card's details are being prepared: the card can be
|
|
648
|
+
* used and topped up, but its number can't be shown yet. Show "Details
|
|
649
|
+
* are being prepared" instead of the reveal button and refresh the card
|
|
650
|
+
* later; it turns `false` on its own, usually within minutes. Absent
|
|
651
|
+
* from platforms before 0.7.6.
|
|
652
|
+
*/
|
|
653
|
+
details_pending?: boolean;
|
|
643
654
|
/**
|
|
644
655
|
* Top-ups the issuer has held for too long, summed, decimal string in
|
|
645
656
|
* `currency`; `null` when there are none. The money is safe and waits for
|
|
@@ -842,6 +853,13 @@ declare function cardOrderBody(input: CardOrderInput): Record<string, unknown>;
|
|
|
842
853
|
interface CardBalance {
|
|
843
854
|
amount: string;
|
|
844
855
|
currency: string;
|
|
856
|
+
/**
|
|
857
|
+
* From `cards.balance()` only: top-ups the issuer has accepted and not
|
|
858
|
+
* confirmed yet, summed, decimal string in `currency`; `null` when there
|
|
859
|
+
* are none. Not part of `amount`, even when the issuer already shows the
|
|
860
|
+
* money: show it next to the balance as on its way.
|
|
861
|
+
*/
|
|
862
|
+
pending?: string | null;
|
|
845
863
|
}
|
|
846
864
|
/** What a top-up of a card can be right now, from `GET /me/cards/{id}/topup`. */
|
|
847
865
|
interface TopUpTerms {
|
|
@@ -938,16 +956,30 @@ interface RevealCardInput {
|
|
|
938
956
|
password?: string;
|
|
939
957
|
totpCode?: string;
|
|
940
958
|
}
|
|
959
|
+
/**
|
|
960
|
+
* What a reveal gave, so a client can switch on one field:
|
|
961
|
+
*
|
|
962
|
+
* - `numbers`: `pan`, `cvv` and the expiry are filled in;
|
|
963
|
+
* - `page`: the issuer shows the numbers on a page of its own, `reveal_url`
|
|
964
|
+
* is set and `pan` and `cvv` are empty;
|
|
965
|
+
* - `pending`: the card's details are still being prepared, nothing else
|
|
966
|
+
* is filled in. Show "Details are being prepared" and try again in a
|
|
967
|
+
* minute or two; the attempt didn't count against the reveal limit.
|
|
968
|
+
*/
|
|
969
|
+
type RevealState = "numbers" | "page" | "pending";
|
|
941
970
|
/**
|
|
942
971
|
* Full card data from a successful reveal. **Security**: never persist this,
|
|
943
972
|
* keep it in volatile memory only, clear it within `expires_in_seconds`, and
|
|
944
973
|
* never write it to localStorage / logs (the API marks the response no-store).
|
|
945
974
|
*
|
|
975
|
+
* `state` says which of three answers this is (see {@link RevealState}).
|
|
946
976
|
* Some issuers hand out a page that shows the numbers instead of the
|
|
947
|
-
* numbers themselves
|
|
948
|
-
*
|
|
977
|
+
* numbers themselves; for some cards the details are still being prepared
|
|
978
|
+
* right after issuance.
|
|
949
979
|
*/
|
|
950
980
|
interface RevealedCard {
|
|
981
|
+
/** Which answer this is; set by the SDK from the fields below. */
|
|
982
|
+
state: RevealState;
|
|
951
983
|
/** The card number; empty when `reveal_url` is set. */
|
|
952
984
|
pan: string;
|
|
953
985
|
/** The security code; empty when `reveal_url` is set. */
|
|
@@ -974,7 +1006,14 @@ interface RevealedCard {
|
|
|
974
1006
|
billing_address?: BillingAddress;
|
|
975
1007
|
/** Display window before the client should auto-clear the data. */
|
|
976
1008
|
expires_in_seconds: number;
|
|
1009
|
+
/**
|
|
1010
|
+
* `true` when the details are still being prepared (`state: "pending"`).
|
|
1011
|
+
* Absent from platforms before 0.7.6.
|
|
1012
|
+
*/
|
|
1013
|
+
details_pending?: boolean;
|
|
977
1014
|
}
|
|
1015
|
+
/** The three answers of a reveal told apart; see {@link RevealState}. */
|
|
1016
|
+
declare function revealState(r: Omit<RevealedCard, "state">): RevealState;
|
|
978
1017
|
/** Postal address a card is registered at. Which parts exist depends on the country. */
|
|
979
1018
|
interface BillingAddress {
|
|
980
1019
|
line1?: string;
|
|
@@ -1156,9 +1195,13 @@ declare class CardsResource {
|
|
|
1156
1195
|
* keep the result in volatile memory only, never write it to
|
|
1157
1196
|
* localStorage / logs, and clear it within `expires_in_seconds`.
|
|
1158
1197
|
*
|
|
1159
|
-
*
|
|
1160
|
-
* when the issuer shows them on a
|
|
1161
|
-
* frame right away, it is
|
|
1198
|
+
* `state` tells the three answers apart: `numbers`; `page`, with
|
|
1199
|
+
* `reveal_url` and empty `pan` and `cvv` when the issuer shows them on a
|
|
1200
|
+
* page of its own (open that page in a frame right away, it is
|
|
1201
|
+
* short-lived); or `pending` while the card's details are still being
|
|
1202
|
+
* prepared, which doesn't count against the limit. A card says the same
|
|
1203
|
+
* in {@link Card.details_pending}, so there is no need to call this just
|
|
1204
|
+
* to find out.
|
|
1162
1205
|
*
|
|
1163
1206
|
* 403 not your card · 409 `card_locked` · 429 rate-limited · 501 connector
|
|
1164
1207
|
* has no sensitive-data endpoint · 503 `provider_unavailable`.
|
|
@@ -1171,6 +1214,21 @@ declare class CardsResource {
|
|
|
1171
1214
|
* button and say the freeze is lifted through the issuer's support.
|
|
1172
1215
|
*/
|
|
1173
1216
|
unfreeze(id: string): Promise<Card>;
|
|
1217
|
+
/**
|
|
1218
|
+
* Report the card lost or stolen. Works at any time, on an active or a
|
|
1219
|
+
* frozen card. The report is recorded first with the server's time, which
|
|
1220
|
+
* decides who pays for operations someone else made; then the card is
|
|
1221
|
+
* frozen at its issuer and only support can unfreeze it. Resolves to the
|
|
1222
|
+
* claim (`client.claims`): show its `number` and `reported_at`. When the
|
|
1223
|
+
* issuer can't be reached, `card_freeze` is `"pending"`: the report still
|
|
1224
|
+
* counts and support freezes the card by hand. Reporting again while the
|
|
1225
|
+
* report is open returns the same claim. 404 / 403 not the user's card ·
|
|
1226
|
+
* 409 `card_not_open`: the card is closed or was never issued.
|
|
1227
|
+
*/
|
|
1228
|
+
reportLost(id: string, input: {
|
|
1229
|
+
kind: "lost" | "stolen";
|
|
1230
|
+
details?: string;
|
|
1231
|
+
}): Promise<Claim>;
|
|
1174
1232
|
/**
|
|
1175
1233
|
* Set the PIN of the caller's own physical card. The session is enough; the
|
|
1176
1234
|
* call is rate-limited like {@link reveal} and the PIN is kept nowhere.
|
|
@@ -1191,4 +1249,4 @@ declare class CardsResource {
|
|
|
1191
1249
|
terminate(id: string, reason?: string): Promise<Card>;
|
|
1192
1250
|
}
|
|
1193
1251
|
|
|
1194
|
-
export { type Address as A, type BillingAddress as B, type CardProduct as C, type Deposit as D, type DepositStatus as E, FundingOptionsResource as F, type DepositTarget as G, type FeeKind as H, type FunderMode as I, type FundingOption as J, type FundingQuote as K, type InitiateDepositInput as L, type IssuanceBonus as M, type IssueCardInput as N, type MethodTerms as O, type RevealCardInput as P, type
|
|
1252
|
+
export { cardOrderBody as $, type Address as A, type BillingAddress as B, type CardProduct as C, type Deposit as D, type DepositStatus as E, FundingOptionsResource as F, type DepositTarget as G, type FeeKind as H, type FunderMode as I, type FundingOption as J, type FundingQuote as K, type InitiateDepositInput as L, type IssuanceBonus as M, type IssueCardInput as N, type MethodTerms as O, type RevealCardInput as P, type RevealState as Q, type Refund as R, type RevealedCard as S, type SetPinInput as T, type TopUpInput as U, type TopUpResult as V, type TopUpTerms as W, type TransferInput as X, type TransferResult as Y, type UpdateCardInput as Z, revealState as _, type Card as a, cardRequestBody as a0, DepositsResource as b, CardsResource as c, type CardBalance as d, type CardDesignRef as e, type CardForm as f, type CardInTransit as g, type CardLoadStatus as h, type CardOrder as i, type CardOrderError as j, type CardOrderInput as k, type CardProductPrice as l, type CardStatus as m, type CardStatusSource as n, type CardTariff as o, type CardTopUp as p, type CardTopUpStatus as q, type CardTransfer as r, type CardType as s, type Cardholder as t, type CloseBlockedReason as u, type CreateCardInput as v, type CreateDepositRefundInput as w, type CreateQuoteInput as x, type CustomerInfo as y, type DepositMethod as z };
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { Claim } from './resources/claims.cjs';
|
|
1
2
|
import { ConsentKind, ConsentChannel } from './resources/consents.cjs';
|
|
2
3
|
import { H as HttpClient } from './http-CL97TjMO.cjs';
|
|
3
4
|
|
|
@@ -444,6 +445,7 @@ declare class DepositsResource {
|
|
|
444
445
|
* GET /me/cards/{id}/balance → balance (prepaid remaining)
|
|
445
446
|
* POST /me/cards/{id}/freeze → freeze
|
|
446
447
|
* POST /me/cards/{id}/unfreeze → unfreeze
|
|
448
|
+
* POST /me/cards/{id}/report-lost → reportLost (lost or stolen: frozen at once)
|
|
447
449
|
* POST /me/cards/{id}/transfer → transfer (to another of their cards)
|
|
448
450
|
* POST /me/cards/{id}/terminate → terminate (one-way)
|
|
449
451
|
* POST /me/cards/{id}/reveal → reveal (the numbers, or a provider page)
|
|
@@ -636,10 +638,19 @@ interface Card {
|
|
|
636
638
|
close_blocked: CloseBlockedReason | null;
|
|
637
639
|
/**
|
|
638
640
|
* Top-ups the issuer has accepted and not loaded yet, summed, decimal
|
|
639
|
-
* string in `currency`; `null` when there are none.
|
|
641
|
+
* string in `currency`; `null` when there are none. It counts top-ups from
|
|
642
|
+
* the wallet and top-ups paid straight to the card. Show it next to the
|
|
640
643
|
* balance as money on its way to the card.
|
|
641
644
|
*/
|
|
642
645
|
topups_pending: string | null;
|
|
646
|
+
/**
|
|
647
|
+
* `true` while the card's details are being prepared: the card can be
|
|
648
|
+
* used and topped up, but its number can't be shown yet. Show "Details
|
|
649
|
+
* are being prepared" instead of the reveal button and refresh the card
|
|
650
|
+
* later; it turns `false` on its own, usually within minutes. Absent
|
|
651
|
+
* from platforms before 0.7.6.
|
|
652
|
+
*/
|
|
653
|
+
details_pending?: boolean;
|
|
643
654
|
/**
|
|
644
655
|
* Top-ups the issuer has held for too long, summed, decimal string in
|
|
645
656
|
* `currency`; `null` when there are none. The money is safe and waits for
|
|
@@ -842,6 +853,13 @@ declare function cardOrderBody(input: CardOrderInput): Record<string, unknown>;
|
|
|
842
853
|
interface CardBalance {
|
|
843
854
|
amount: string;
|
|
844
855
|
currency: string;
|
|
856
|
+
/**
|
|
857
|
+
* From `cards.balance()` only: top-ups the issuer has accepted and not
|
|
858
|
+
* confirmed yet, summed, decimal string in `currency`; `null` when there
|
|
859
|
+
* are none. Not part of `amount`, even when the issuer already shows the
|
|
860
|
+
* money: show it next to the balance as on its way.
|
|
861
|
+
*/
|
|
862
|
+
pending?: string | null;
|
|
845
863
|
}
|
|
846
864
|
/** What a top-up of a card can be right now, from `GET /me/cards/{id}/topup`. */
|
|
847
865
|
interface TopUpTerms {
|
|
@@ -938,16 +956,30 @@ interface RevealCardInput {
|
|
|
938
956
|
password?: string;
|
|
939
957
|
totpCode?: string;
|
|
940
958
|
}
|
|
959
|
+
/**
|
|
960
|
+
* What a reveal gave, so a client can switch on one field:
|
|
961
|
+
*
|
|
962
|
+
* - `numbers`: `pan`, `cvv` and the expiry are filled in;
|
|
963
|
+
* - `page`: the issuer shows the numbers on a page of its own, `reveal_url`
|
|
964
|
+
* is set and `pan` and `cvv` are empty;
|
|
965
|
+
* - `pending`: the card's details are still being prepared, nothing else
|
|
966
|
+
* is filled in. Show "Details are being prepared" and try again in a
|
|
967
|
+
* minute or two; the attempt didn't count against the reveal limit.
|
|
968
|
+
*/
|
|
969
|
+
type RevealState = "numbers" | "page" | "pending";
|
|
941
970
|
/**
|
|
942
971
|
* Full card data from a successful reveal. **Security**: never persist this,
|
|
943
972
|
* keep it in volatile memory only, clear it within `expires_in_seconds`, and
|
|
944
973
|
* never write it to localStorage / logs (the API marks the response no-store).
|
|
945
974
|
*
|
|
975
|
+
* `state` says which of three answers this is (see {@link RevealState}).
|
|
946
976
|
* Some issuers hand out a page that shows the numbers instead of the
|
|
947
|
-
* numbers themselves
|
|
948
|
-
*
|
|
977
|
+
* numbers themselves; for some cards the details are still being prepared
|
|
978
|
+
* right after issuance.
|
|
949
979
|
*/
|
|
950
980
|
interface RevealedCard {
|
|
981
|
+
/** Which answer this is; set by the SDK from the fields below. */
|
|
982
|
+
state: RevealState;
|
|
951
983
|
/** The card number; empty when `reveal_url` is set. */
|
|
952
984
|
pan: string;
|
|
953
985
|
/** The security code; empty when `reveal_url` is set. */
|
|
@@ -974,7 +1006,14 @@ interface RevealedCard {
|
|
|
974
1006
|
billing_address?: BillingAddress;
|
|
975
1007
|
/** Display window before the client should auto-clear the data. */
|
|
976
1008
|
expires_in_seconds: number;
|
|
1009
|
+
/**
|
|
1010
|
+
* `true` when the details are still being prepared (`state: "pending"`).
|
|
1011
|
+
* Absent from platforms before 0.7.6.
|
|
1012
|
+
*/
|
|
1013
|
+
details_pending?: boolean;
|
|
977
1014
|
}
|
|
1015
|
+
/** The three answers of a reveal told apart; see {@link RevealState}. */
|
|
1016
|
+
declare function revealState(r: Omit<RevealedCard, "state">): RevealState;
|
|
978
1017
|
/** Postal address a card is registered at. Which parts exist depends on the country. */
|
|
979
1018
|
interface BillingAddress {
|
|
980
1019
|
line1?: string;
|
|
@@ -1156,9 +1195,13 @@ declare class CardsResource {
|
|
|
1156
1195
|
* keep the result in volatile memory only, never write it to
|
|
1157
1196
|
* localStorage / logs, and clear it within `expires_in_seconds`.
|
|
1158
1197
|
*
|
|
1159
|
-
*
|
|
1160
|
-
* when the issuer shows them on a
|
|
1161
|
-
* frame right away, it is
|
|
1198
|
+
* `state` tells the three answers apart: `numbers`; `page`, with
|
|
1199
|
+
* `reveal_url` and empty `pan` and `cvv` when the issuer shows them on a
|
|
1200
|
+
* page of its own (open that page in a frame right away, it is
|
|
1201
|
+
* short-lived); or `pending` while the card's details are still being
|
|
1202
|
+
* prepared, which doesn't count against the limit. A card says the same
|
|
1203
|
+
* in {@link Card.details_pending}, so there is no need to call this just
|
|
1204
|
+
* to find out.
|
|
1162
1205
|
*
|
|
1163
1206
|
* 403 not your card · 409 `card_locked` · 429 rate-limited · 501 connector
|
|
1164
1207
|
* has no sensitive-data endpoint · 503 `provider_unavailable`.
|
|
@@ -1171,6 +1214,21 @@ declare class CardsResource {
|
|
|
1171
1214
|
* button and say the freeze is lifted through the issuer's support.
|
|
1172
1215
|
*/
|
|
1173
1216
|
unfreeze(id: string): Promise<Card>;
|
|
1217
|
+
/**
|
|
1218
|
+
* Report the card lost or stolen. Works at any time, on an active or a
|
|
1219
|
+
* frozen card. The report is recorded first with the server's time, which
|
|
1220
|
+
* decides who pays for operations someone else made; then the card is
|
|
1221
|
+
* frozen at its issuer and only support can unfreeze it. Resolves to the
|
|
1222
|
+
* claim (`client.claims`): show its `number` and `reported_at`. When the
|
|
1223
|
+
* issuer can't be reached, `card_freeze` is `"pending"`: the report still
|
|
1224
|
+
* counts and support freezes the card by hand. Reporting again while the
|
|
1225
|
+
* report is open returns the same claim. 404 / 403 not the user's card ·
|
|
1226
|
+
* 409 `card_not_open`: the card is closed or was never issued.
|
|
1227
|
+
*/
|
|
1228
|
+
reportLost(id: string, input: {
|
|
1229
|
+
kind: "lost" | "stolen";
|
|
1230
|
+
details?: string;
|
|
1231
|
+
}): Promise<Claim>;
|
|
1174
1232
|
/**
|
|
1175
1233
|
* Set the PIN of the caller's own physical card. The session is enough; the
|
|
1176
1234
|
* call is rate-limited like {@link reveal} and the PIN is kept nowhere.
|
|
@@ -1191,4 +1249,4 @@ declare class CardsResource {
|
|
|
1191
1249
|
terminate(id: string, reason?: string): Promise<Card>;
|
|
1192
1250
|
}
|
|
1193
1251
|
|
|
1194
|
-
export { type Address as A, type BillingAddress as B, type CardProduct as C, type Deposit as D, type DepositStatus as E, FundingOptionsResource as F, type DepositTarget as G, type FeeKind as H, type FunderMode as I, type FundingOption as J, type FundingQuote as K, type InitiateDepositInput as L, type IssuanceBonus as M, type IssueCardInput as N, type MethodTerms as O, type RevealCardInput as P, type
|
|
1252
|
+
export { cardOrderBody as $, type Address as A, type BillingAddress as B, type CardProduct as C, type Deposit as D, type DepositStatus as E, FundingOptionsResource as F, type DepositTarget as G, type FeeKind as H, type FunderMode as I, type FundingOption as J, type FundingQuote as K, type InitiateDepositInput as L, type IssuanceBonus as M, type IssueCardInput as N, type MethodTerms as O, type RevealCardInput as P, type RevealState as Q, type Refund as R, type RevealedCard as S, type SetPinInput as T, type TopUpInput as U, type TopUpResult as V, type TopUpTerms as W, type TransferInput as X, type TransferResult as Y, type UpdateCardInput as Z, revealState as _, type Card as a, cardRequestBody as a0, DepositsResource as b, CardsResource as c, type CardBalance as d, type CardDesignRef as e, type CardForm as f, type CardInTransit as g, type CardLoadStatus as h, type CardOrder as i, type CardOrderError as j, type CardOrderInput as k, type CardProductPrice as l, type CardStatus as m, type CardStatusSource as n, type CardTariff as o, type CardTopUp as p, type CardTopUpStatus as q, type CardTransfer as r, type CardType as s, type Cardholder as t, type CloseBlockedReason as u, type CreateCardInput as v, type CreateDepositRefundInput as w, type CreateQuoteInput as x, type CustomerInfo as y, type DepositMethod as z };
|
package/dist/index.cjs
CHANGED
|
@@ -187,6 +187,11 @@ function cardOrderBody(input) {
|
|
|
187
187
|
if (input.metadata !== void 0) body["metadata"] = input.metadata;
|
|
188
188
|
return body;
|
|
189
189
|
}
|
|
190
|
+
function revealState(r) {
|
|
191
|
+
if (r.details_pending) return "pending";
|
|
192
|
+
if (r.reveal_url) return "page";
|
|
193
|
+
return "numbers";
|
|
194
|
+
}
|
|
190
195
|
var CardsResource = class {
|
|
191
196
|
constructor(http) {
|
|
192
197
|
this.http = http;
|
|
@@ -342,15 +347,22 @@ var CardsResource = class {
|
|
|
342
347
|
* keep the result in volatile memory only, never write it to
|
|
343
348
|
* localStorage / logs, and clear it within `expires_in_seconds`.
|
|
344
349
|
*
|
|
345
|
-
*
|
|
346
|
-
* when the issuer shows them on a
|
|
347
|
-
* frame right away, it is
|
|
350
|
+
* `state` tells the three answers apart: `numbers`; `page`, with
|
|
351
|
+
* `reveal_url` and empty `pan` and `cvv` when the issuer shows them on a
|
|
352
|
+
* page of its own (open that page in a frame right away, it is
|
|
353
|
+
* short-lived); or `pending` while the card's details are still being
|
|
354
|
+
* prepared, which doesn't count against the limit. A card says the same
|
|
355
|
+
* in {@link Card.details_pending}, so there is no need to call this just
|
|
356
|
+
* to find out.
|
|
348
357
|
*
|
|
349
358
|
* 403 not your card · 409 `card_locked` · 429 rate-limited · 501 connector
|
|
350
359
|
* has no sensitive-data endpoint · 503 `provider_unavailable`.
|
|
351
360
|
*/
|
|
352
361
|
async reveal(id, _input) {
|
|
353
|
-
|
|
362
|
+
const r = await this.http.post(
|
|
363
|
+
`/me/cards/${encodeURIComponent(id)}/reveal`
|
|
364
|
+
);
|
|
365
|
+
return { ...r, state: revealState(r) };
|
|
354
366
|
}
|
|
355
367
|
/**
|
|
356
368
|
* Unfreeze a previously-frozen card. Idempotent on an already-active card.
|
|
@@ -361,6 +373,22 @@ var CardsResource = class {
|
|
|
361
373
|
async unfreeze(id) {
|
|
362
374
|
return this.http.post(`/me/cards/${encodeURIComponent(id)}/unfreeze`, { body: {} });
|
|
363
375
|
}
|
|
376
|
+
/**
|
|
377
|
+
* Report the card lost or stolen. Works at any time, on an active or a
|
|
378
|
+
* frozen card. The report is recorded first with the server's time, which
|
|
379
|
+
* decides who pays for operations someone else made; then the card is
|
|
380
|
+
* frozen at its issuer and only support can unfreeze it. Resolves to the
|
|
381
|
+
* claim (`client.claims`): show its `number` and `reported_at`. When the
|
|
382
|
+
* issuer can't be reached, `card_freeze` is `"pending"`: the report still
|
|
383
|
+
* counts and support freezes the card by hand. Reporting again while the
|
|
384
|
+
* report is open returns the same claim. 404 / 403 not the user's card ·
|
|
385
|
+
* 409 `card_not_open`: the card is closed or was never issued.
|
|
386
|
+
*/
|
|
387
|
+
async reportLost(id, input) {
|
|
388
|
+
return this.http.post(`/me/cards/${encodeURIComponent(id)}/report-lost`, {
|
|
389
|
+
body: { kind: input.kind, details: input.details }
|
|
390
|
+
});
|
|
391
|
+
}
|
|
364
392
|
/**
|
|
365
393
|
* Set the PIN of the caller's own physical card. The session is enough; the
|
|
366
394
|
* call is rate-limited like {@link reveal} and the PIN is kept nowhere.
|
|
@@ -813,6 +841,41 @@ var CloseRequestsResource = class {
|
|
|
813
841
|
}
|
|
814
842
|
};
|
|
815
843
|
|
|
844
|
+
// src/resources/claims.ts
|
|
845
|
+
var ClaimsResource = class {
|
|
846
|
+
constructor(http) {
|
|
847
|
+
this.http = http;
|
|
848
|
+
}
|
|
849
|
+
/**
|
|
850
|
+
* Dispute a card operation, or complain. 400 `validation`: a description
|
|
851
|
+
* that is too short or too long, an operation that isn't on the user's
|
|
852
|
+
* cards, or a lost or stolen card (use `cards.reportLost()`) · 404 no
|
|
853
|
+
* such card · 409 `too_many_claims`: 20 claims are waiting for an answer.
|
|
854
|
+
*/
|
|
855
|
+
async create(input) {
|
|
856
|
+
return this.http.post("/me/claims", {
|
|
857
|
+
body: {
|
|
858
|
+
kind: input.kind,
|
|
859
|
+
description: input.description,
|
|
860
|
+
card_id: input.cardId,
|
|
861
|
+
transaction_id: input.transactionId
|
|
862
|
+
}
|
|
863
|
+
});
|
|
864
|
+
}
|
|
865
|
+
/** The user's claims, lost and stolen cards included, newest first. */
|
|
866
|
+
async list(opts = {}) {
|
|
867
|
+
const qs = new URLSearchParams();
|
|
868
|
+
if (opts.limit != null) qs.set("limit", String(opts.limit));
|
|
869
|
+
if (opts.offset != null) qs.set("offset", String(opts.offset));
|
|
870
|
+
const q = qs.toString();
|
|
871
|
+
return this.http.get(`/me/claims${q ? `?${q}` : ""}`, { signal: opts.signal });
|
|
872
|
+
}
|
|
873
|
+
/** One claim. 404 when it isn't the user's. */
|
|
874
|
+
async get(id, opts = {}) {
|
|
875
|
+
return this.http.get(`/me/claims/${encodeURIComponent(id)}`, { signal: opts.signal });
|
|
876
|
+
}
|
|
877
|
+
};
|
|
878
|
+
|
|
816
879
|
// src/resources/codes.ts
|
|
817
880
|
var CodesResource = class {
|
|
818
881
|
constructor(http) {
|
|
@@ -856,6 +919,15 @@ var SubscriptionResource = class {
|
|
|
856
919
|
async setPromoCode(code) {
|
|
857
920
|
return this.http.put("/me/subscription/promo-code", { body: { code } });
|
|
858
921
|
}
|
|
922
|
+
/**
|
|
923
|
+
* Cancel the subscription now, in one step. What was paid for the current
|
|
924
|
+
* period comes back to the balance for the days not used. No subscription
|
|
925
|
+
* running → 404; 503 `refund_unavailable` when the refund can't be made
|
|
926
|
+
* right now (the subscription keeps running; try again).
|
|
927
|
+
*/
|
|
928
|
+
async cancel() {
|
|
929
|
+
return this.http.post("/me/subscription/cancel", {});
|
|
930
|
+
}
|
|
859
931
|
};
|
|
860
932
|
|
|
861
933
|
// src/resources/branding.ts
|
|
@@ -1515,7 +1587,7 @@ var FundingOptionsResource = class {
|
|
|
1515
1587
|
};
|
|
1516
1588
|
|
|
1517
1589
|
// src/version.ts
|
|
1518
|
-
var SDK_VERSION = "0.6.
|
|
1590
|
+
var SDK_VERSION = "0.6.11";
|
|
1519
1591
|
|
|
1520
1592
|
// src/client-platform.ts
|
|
1521
1593
|
var CLIENT_HEADER = "X-Takeal-Client";
|
|
@@ -1590,7 +1662,7 @@ function isAbsolute(url) {
|
|
|
1590
1662
|
}
|
|
1591
1663
|
|
|
1592
1664
|
// src/compat.ts
|
|
1593
|
-
var SUPPORTED_MEISTER = ">=0.6
|
|
1665
|
+
var SUPPORTED_MEISTER = ">=0.7.6, <1.0.0";
|
|
1594
1666
|
var SEMVER = /^v?(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-([0-9A-Za-z.-]+))?(?:\+[0-9A-Za-z.-]+)?$/;
|
|
1595
1667
|
function parse(v) {
|
|
1596
1668
|
const m = SEMVER.exec(v.trim());
|
|
@@ -2105,6 +2177,7 @@ function createClient(opts) {
|
|
|
2105
2177
|
bonus: new BonusResource(http),
|
|
2106
2178
|
debt: new DebtResource(http),
|
|
2107
2179
|
closeRequests: new CloseRequestsResource(http),
|
|
2180
|
+
claims: new ClaimsResource(http),
|
|
2108
2181
|
codes: new CodesResource(http),
|
|
2109
2182
|
referral: new ReferralResource(http),
|
|
2110
2183
|
subscription: new SubscriptionResource(http),
|
|
@@ -2165,6 +2238,7 @@ exports.page = page;
|
|
|
2165
2238
|
exports.posthogDistinctId = posthogDistinctId;
|
|
2166
2239
|
exports.resetAnalytics = resetAnalytics;
|
|
2167
2240
|
exports.resolveAssetUrl = resolveAssetUrl;
|
|
2241
|
+
exports.revealState = revealState;
|
|
2168
2242
|
exports.sanitizeProperties = sanitizeProperties;
|
|
2169
2243
|
exports.sanitizeUrl = sanitizeUrl;
|
|
2170
2244
|
exports.satisfies = satisfies;
|