@takeal/cusfront-sdk 0.6.4 → 0.6.5
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 +33 -0
- package/README.md +129 -3
- package/dist/{cards-ofoGRU9v.d.cts → cards-CEFKrVkl.d.cts} +125 -10
- package/dist/{cards-BrqeBqLV.d.ts → cards-ColpW52n.d.ts} +125 -10
- package/dist/index.cjs +121 -11
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +13 -5
- package/dist/index.d.ts +13 -5
- package/dist/index.js +120 -12
- package/dist/index.js.map +1 -1
- package/dist/react/index.d.cts +3 -1
- package/dist/react/index.d.ts +3 -1
- package/dist/resources/auth.cjs.map +1 -1
- package/dist/resources/auth.d.cts +1 -1
- package/dist/resources/auth.d.ts +1 -1
- package/dist/resources/auth.js.map +1 -1
- package/dist/resources/cards.cjs +9 -2
- 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 +9 -2
- package/dist/resources/cards.js.map +1 -1
- package/dist/resources/close-requests.cjs +54 -0
- package/dist/resources/close-requests.cjs.map +1 -0
- package/dist/resources/close-requests.d.cts +155 -0
- package/dist/resources/close-requests.d.ts +155 -0
- package/dist/resources/close-requests.js +52 -0
- package/dist/resources/close-requests.js.map +1 -0
- package/dist/resources/consents.cjs +42 -7
- package/dist/resources/consents.cjs.map +1 -1
- package/dist/resources/consents.d.cts +58 -8
- package/dist/resources/consents.d.ts +58 -8
- package/dist/resources/consents.js +41 -8
- package/dist/resources/consents.js.map +1 -1
- package/dist/resources/debt.cjs +22 -0
- package/dist/resources/debt.cjs.map +1 -0
- package/dist/resources/debt.d.cts +76 -0
- package/dist/resources/debt.d.ts +76 -0
- package/dist/resources/debt.js +20 -0
- package/dist/resources/debt.js.map +1 -0
- package/dist/resources/deposits.cjs.map +1 -1
- package/dist/resources/deposits.d.cts +1 -1
- package/dist/resources/deposits.d.ts +1 -1
- package/dist/resources/deposits.js.map +1 -1
- package/dist/resources/funding-options.d.cts +1 -1
- package/dist/resources/funding-options.d.ts +1 -1
- package/dist/resources/history.cjs.map +1 -1
- package/dist/resources/history.d.cts +12 -1
- package/dist/resources/history.d.ts +12 -1
- package/dist/resources/history.js.map +1 -1
- package/dist/resources/me.d.cts +1 -1
- package/dist/resources/me.d.ts +1 -1
- package/dist/telegram.cjs +119 -11
- package/dist/telegram.cjs.map +1 -1
- package/dist/telegram.d.cts +3 -1
- package/dist/telegram.d.ts +3 -1
- package/dist/telegram.js +119 -11
- package/dist/telegram.js.map +1 -1
- package/package.json +11 -1
|
@@ -164,8 +164,13 @@ interface CreateQuoteInput {
|
|
|
164
164
|
* a line of its own on the credited amount.
|
|
165
165
|
*/
|
|
166
166
|
type FeeKind = "spread" | "markup" | "commission";
|
|
167
|
-
/**
|
|
168
|
-
|
|
167
|
+
/**
|
|
168
|
+
* How far a top-up meant for a card has got. `waiting`: the card's provider
|
|
169
|
+
* took the load and hasn't done it yet. `stalled`: it has taken longer than
|
|
170
|
+
* the platform waits. `refunding` / `refunded`: the card never got the money,
|
|
171
|
+
* and the payment is going back, or has gone back, to where it was paid from.
|
|
172
|
+
*/
|
|
173
|
+
type CardLoadStatus = "pending" | "waiting" | "stalled" | "succeeded" | "failed" | "refunding" | "refunded";
|
|
169
174
|
/**
|
|
170
175
|
* A card to issue with the top-up: the fields of `cards.create` without
|
|
171
176
|
* its idempotency key (the deposit's covers both). The card's price is
|
|
@@ -205,6 +210,13 @@ interface FundingQuote {
|
|
|
205
210
|
method?: DepositMethod;
|
|
206
211
|
/** The rate is locked until then; the deposit made with it waits for its payment as long. */
|
|
207
212
|
expires_at: string;
|
|
213
|
+
/**
|
|
214
|
+
* What the user owes in card fees, in `credited_currency`, that this
|
|
215
|
+
* top-up pays first: it comes off `credited_amount` and the rest is
|
|
216
|
+
* credited. `"0"` when nothing is owed. Show it before the payment. Older
|
|
217
|
+
* platforms leave it out.
|
|
218
|
+
*/
|
|
219
|
+
debt_withheld?: string;
|
|
208
220
|
}
|
|
209
221
|
interface Deposit {
|
|
210
222
|
id: string;
|
|
@@ -274,6 +286,17 @@ interface Deposit {
|
|
|
274
286
|
* wallet instead (funding connectors in `mixed` mode). The user is told.
|
|
275
287
|
*/
|
|
276
288
|
returned_to_wallet_at?: string | null;
|
|
289
|
+
/**
|
|
290
|
+
* The user's debt in card fees shown before the payment, in the credited
|
|
291
|
+
* currency: the most this top-up pays towards it before the rest is
|
|
292
|
+
* credited. Absent when nothing was owed.
|
|
293
|
+
*/
|
|
294
|
+
debt_quoted?: string | null;
|
|
295
|
+
/**
|
|
296
|
+
* What the top-up did pay towards the debt. For a top-up onto a card,
|
|
297
|
+
* `card_amount` is already net of it.
|
|
298
|
+
*/
|
|
299
|
+
debt_withheld?: string | null;
|
|
277
300
|
created_at: string;
|
|
278
301
|
updated_at: string;
|
|
279
302
|
}
|
|
@@ -368,6 +391,7 @@ interface Refund {
|
|
|
368
391
|
status: string;
|
|
369
392
|
provider_refund_reference?: string;
|
|
370
393
|
failure_reason?: string;
|
|
394
|
+
/** `user`, `operator`, or `system` when the platform refunded by itself. */
|
|
371
395
|
requestor_type: string;
|
|
372
396
|
requestor_id: string;
|
|
373
397
|
created_at: string;
|
|
@@ -543,6 +567,45 @@ interface CardProduct {
|
|
|
543
567
|
starting_balance: CardBalance | null;
|
|
544
568
|
/** True for the product the deployment issues when none is chosen. */
|
|
545
569
|
is_default: boolean;
|
|
570
|
+
/**
|
|
571
|
+
* Issuing this card sends the user's real personal details to the card
|
|
572
|
+
* issuer. Show the consent screen before the order and send
|
|
573
|
+
* `holder_data_transfer` in its `consents` (or give it once with
|
|
574
|
+
* `client.consents.allowHolderData()`); without it the order fails with
|
|
575
|
+
* 409 `holder_data_consent_required`. `false`: the issuer gets no real
|
|
576
|
+
* details and no extra consent is asked.
|
|
577
|
+
*/
|
|
578
|
+
holder_data_required: boolean;
|
|
579
|
+
/**
|
|
580
|
+
* What a card on this product costs to use, on top of the payments
|
|
581
|
+
* themselves. A fee the card can't cover is owed and paid from the next
|
|
582
|
+
* top-up (see `client.debt`). Every line is `"0"` when the product
|
|
583
|
+
* charges nothing for it.
|
|
584
|
+
*/
|
|
585
|
+
tariff: CardTariff;
|
|
586
|
+
}
|
|
587
|
+
/**
|
|
588
|
+
* A card product's fees for using the card. Decimal strings: the fixed
|
|
589
|
+
* amounts are in `currency` (the card's), the shares in percent of the
|
|
590
|
+
* operation's amount.
|
|
591
|
+
*/
|
|
592
|
+
interface CardTariff {
|
|
593
|
+
/** `null` for a product held in several currencies: the card's own then. */
|
|
594
|
+
currency: string | null;
|
|
595
|
+
/** Per settled card payment, fixed. */
|
|
596
|
+
operation_fixed: string;
|
|
597
|
+
/** Per settled card payment, percent of its amount. */
|
|
598
|
+
operation_percent: string;
|
|
599
|
+
/**
|
|
600
|
+
* Per payment declined through the user's own doing: not enough money,
|
|
601
|
+
* wrong card details, a frozen card, a subscription not cancelled with the
|
|
602
|
+
* merchant. A decline caused by the issuer or the platform costs nothing.
|
|
603
|
+
*/
|
|
604
|
+
decline: string;
|
|
605
|
+
/** Per cash withdrawal, fixed; charged instead of the payment fee. */
|
|
606
|
+
cash_withdrawal_fixed: string;
|
|
607
|
+
/** Per cash withdrawal, percent of its amount. */
|
|
608
|
+
cash_withdrawal_percent: string;
|
|
546
609
|
}
|
|
547
610
|
/**
|
|
548
611
|
* A card record as the Takeal API returns it. Mirrors the `cards` table. Note the
|
|
@@ -583,6 +646,19 @@ interface Card {
|
|
|
583
646
|
* support to settle it; say so instead of offering a retry.
|
|
584
647
|
*/
|
|
585
648
|
topups_held: string | null;
|
|
649
|
+
/**
|
|
650
|
+
* The card this one replaced: support reissued it for free because that
|
|
651
|
+
* card stopped working before its term. `null` otherwise.
|
|
652
|
+
*/
|
|
653
|
+
reissued_from_card_id?: string | null;
|
|
654
|
+
/** The card support issued to replace this one, or `null`. */
|
|
655
|
+
reissued_to_card_id?: string | null;
|
|
656
|
+
/**
|
|
657
|
+
* What was left on the card this one replaced, on its way here. Show it as
|
|
658
|
+
* money in transit next to the balance, not as part of it. `null` when
|
|
659
|
+
* nothing is on its way.
|
|
660
|
+
*/
|
|
661
|
+
in_transit?: CardInTransit | null;
|
|
586
662
|
/** The name the user gave the card, or `null`. */
|
|
587
663
|
name: string | null;
|
|
588
664
|
/** The artwork the card is shown with. Always present. */
|
|
@@ -597,6 +673,21 @@ interface Card {
|
|
|
597
673
|
/** Only on the result of `create`, when bonuses paid part of the price. */
|
|
598
674
|
bonus?: IssuanceBonus;
|
|
599
675
|
}
|
|
676
|
+
/**
|
|
677
|
+
* The balance of a closed card on its way to the card that replaced it. It
|
|
678
|
+
* waits for the old card's issuer to return the money (`stage: "issuer"`),
|
|
679
|
+
* then it is loaded onto this card (`stage: "loading"`); once it is there,
|
|
680
|
+
* `in_transit` is `null` and the card's balance has it. The move is in the
|
|
681
|
+
* history as a `closed_card_balance` entry.
|
|
682
|
+
*/
|
|
683
|
+
interface CardInTransit {
|
|
684
|
+
/** Decimal string in `currency`. What the issuer returned once it did; before that, what the old card held. */
|
|
685
|
+
amount: string;
|
|
686
|
+
currency: string;
|
|
687
|
+
/** The closed card the money comes from. */
|
|
688
|
+
from_card_id: string;
|
|
689
|
+
stage: "issuer" | "loading" | (string & {});
|
|
690
|
+
}
|
|
600
691
|
/** How bonuses changed a new card's price ("was / now"). Decimal strings in `currency`. */
|
|
601
692
|
interface IssuanceBonus {
|
|
602
693
|
/** Bonuses used. */
|
|
@@ -666,9 +757,10 @@ interface CreateCardInput {
|
|
|
666
757
|
promoCode?: string;
|
|
667
758
|
/**
|
|
668
759
|
* Consents the user gave with the order (`terms`, `personal_data`,
|
|
669
|
-
* `marketing`). Recorded with the card, or with the
|
|
670
|
-
* `deposits.initiate({ issue_card })`, at the version of
|
|
671
|
-
* in force now.
|
|
760
|
+
* `marketing`, `holder_data_transfer`). Recorded with the card, or with the
|
|
761
|
+
* top-up inside `deposits.initiate({ issue_card })`, at the version of
|
|
762
|
+
* their documents in force now. A product with `holder_data_required`
|
|
763
|
+
* needs `holder_data_transfer` here unless it was given before.
|
|
672
764
|
*/
|
|
673
765
|
consents?: ConsentKind[];
|
|
674
766
|
/** Where they were given. Sent as `consent_channel`. */
|
|
@@ -712,7 +804,10 @@ interface CardOrderInput {
|
|
|
712
804
|
promoCode?: string;
|
|
713
805
|
/** Pay part of the price with bonuses; on by default. Sent as `use_bonus`. */
|
|
714
806
|
useBonus?: boolean;
|
|
715
|
-
/**
|
|
807
|
+
/**
|
|
808
|
+
* Consents given with the order. A product with `holder_data_required`
|
|
809
|
+
* needs `holder_data_transfer` here unless it was given before.
|
|
810
|
+
*/
|
|
716
811
|
consents?: ConsentKind[];
|
|
717
812
|
/** Where they were given. Sent as `consent_channel`. */
|
|
718
813
|
consentChannel?: ConsentChannel;
|
|
@@ -726,9 +821,15 @@ interface CardOrder {
|
|
|
726
821
|
/** What the user pays, decimal string, in `currency`. */
|
|
727
822
|
amount: string;
|
|
728
823
|
currency: string;
|
|
729
|
-
/** What
|
|
824
|
+
/** What the payment brings: the card's price, its starting balance and `debt_withheld`, in `card_currency`. */
|
|
730
825
|
card_amount: string;
|
|
731
826
|
card_currency: string;
|
|
827
|
+
/**
|
|
828
|
+
* What the user owes in card fees, in `card_currency`: included in
|
|
829
|
+
* `card_amount` and paid from it first. `"0"` when nothing is owed. Show
|
|
830
|
+
* it before the payment. Older platforms leave it out.
|
|
831
|
+
*/
|
|
832
|
+
debt_withheld?: string;
|
|
732
833
|
}
|
|
733
834
|
/** Why a card ordered with the sign-up was not placed. The account exists all the same. */
|
|
734
835
|
interface CardOrderError {
|
|
@@ -756,6 +857,13 @@ interface TopUpTerms {
|
|
|
756
857
|
min: CardBalance | null;
|
|
757
858
|
/** Largest single top-up the product allows, or `null` for no cap. */
|
|
758
859
|
max: CardBalance | null;
|
|
860
|
+
/**
|
|
861
|
+
* What the user owes in card fees, in the card's currency, or `null` when
|
|
862
|
+
* nothing is. A top-up from a wallet in the same currency pays it first
|
|
863
|
+
* and the card gets the rest: show it before the top-up. Older platforms
|
|
864
|
+
* leave it out.
|
|
865
|
+
*/
|
|
866
|
+
debt?: CardBalance | null;
|
|
759
867
|
}
|
|
760
868
|
interface TopUpInput {
|
|
761
869
|
/** Amount to add, decimal string, in the card's currency. */
|
|
@@ -948,6 +1056,8 @@ declare class CardsResource {
|
|
|
948
1056
|
* `Card`. On a ledger failure after provider creation, the Takeal API rolls the row
|
|
949
1057
|
* to `failed` (never an orphaned active card); inspect `status` /
|
|
950
1058
|
* `failure_reason` on the result.
|
|
1059
|
+
* Errors: 409 `holder_data_consent_required` when the product has
|
|
1060
|
+
* `holder_data_required` and the user has not agreed to it.
|
|
951
1061
|
*/
|
|
952
1062
|
create(input: CreateCardInput): Promise<Card>;
|
|
953
1063
|
/**
|
|
@@ -957,7 +1067,9 @@ declare class CardsResource {
|
|
|
957
1067
|
* `pending_payment` until the payment is confirmed. The same
|
|
958
1068
|
* `idempotencyKey` returns the same order.
|
|
959
1069
|
* Errors: 400 `unknown_product` / `method_not_available` / a limit of the
|
|
960
|
-
* way of paying,
|
|
1070
|
+
* way of paying, 409 `holder_data_consent_required` (the product has
|
|
1071
|
+
* `holder_data_required` and the user has not agreed to it), 503 no
|
|
1072
|
+
* funding connector or no exchange rate.
|
|
961
1073
|
*/
|
|
962
1074
|
order(input: CardOrderInput & {
|
|
963
1075
|
idempotencyKey: string;
|
|
@@ -1071,9 +1183,12 @@ declare class CardsResource {
|
|
|
1071
1183
|
/**
|
|
1072
1184
|
* Terminate the caller's own card. **One-way** — a terminated card cannot be
|
|
1073
1185
|
* reactivated. The optional `reason` is audited. Idempotent on an
|
|
1074
|
-
* already-terminated card.
|
|
1186
|
+
* already-terminated card. A card that still holds money is refused (409
|
|
1187
|
+
* `move_balance_first` or `contact_support_to_close`): close it with
|
|
1188
|
+
* `client.closeRequests.request(id)` instead, and the money goes back the
|
|
1189
|
+
* way it was paid.
|
|
1075
1190
|
*/
|
|
1076
1191
|
terminate(id: string, reason?: string): Promise<Card>;
|
|
1077
1192
|
}
|
|
1078
1193
|
|
|
1079
|
-
export { type Address as A, type BillingAddress as B, type CardProduct as C, type Deposit as D, type
|
|
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 RevealedCard as Q, type Refund as R, type SetPinInput as S, type TopUpInput as T, type TopUpResult as U, type TopUpTerms as V, type TransferInput as W, type TransferResult as X, type UpdateCardInput as Y, cardOrderBody as Z, cardRequestBody as _, type Card as a, 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
|
@@ -186,6 +186,8 @@ var CardsResource = class {
|
|
|
186
186
|
* `Card`. On a ledger failure after provider creation, the Takeal API rolls the row
|
|
187
187
|
* to `failed` (never an orphaned active card); inspect `status` /
|
|
188
188
|
* `failure_reason` on the result.
|
|
189
|
+
* Errors: 409 `holder_data_consent_required` when the product has
|
|
190
|
+
* `holder_data_required` and the user has not agreed to it.
|
|
189
191
|
*/
|
|
190
192
|
async create(input) {
|
|
191
193
|
const { idempotencyKey, ...card } = input;
|
|
@@ -201,7 +203,9 @@ var CardsResource = class {
|
|
|
201
203
|
* `pending_payment` until the payment is confirmed. The same
|
|
202
204
|
* `idempotencyKey` returns the same order.
|
|
203
205
|
* Errors: 400 `unknown_product` / `method_not_available` / a limit of the
|
|
204
|
-
* way of paying,
|
|
206
|
+
* way of paying, 409 `holder_data_consent_required` (the product has
|
|
207
|
+
* `holder_data_required` and the user has not agreed to it), 503 no
|
|
208
|
+
* funding connector or no exchange rate.
|
|
205
209
|
*/
|
|
206
210
|
async order(input) {
|
|
207
211
|
const { idempotencyKey, ...order } = input;
|
|
@@ -363,7 +367,10 @@ var CardsResource = class {
|
|
|
363
367
|
/**
|
|
364
368
|
* Terminate the caller's own card. **One-way** — a terminated card cannot be
|
|
365
369
|
* reactivated. The optional `reason` is audited. Idempotent on an
|
|
366
|
-
* already-terminated card.
|
|
370
|
+
* already-terminated card. A card that still holds money is refused (409
|
|
371
|
+
* `move_balance_first` or `contact_support_to_close`): close it with
|
|
372
|
+
* `client.closeRequests.request(id)` instead, and the money goes back the
|
|
373
|
+
* way it was paid.
|
|
367
374
|
*/
|
|
368
375
|
async terminate(id, reason) {
|
|
369
376
|
return this.http.post(`/me/cards/${encodeURIComponent(id)}/terminate`, {
|
|
@@ -730,6 +737,72 @@ var BonusResource = class {
|
|
|
730
737
|
}
|
|
731
738
|
};
|
|
732
739
|
|
|
740
|
+
// src/resources/debt.ts
|
|
741
|
+
var DebtResource = class {
|
|
742
|
+
constructor(http) {
|
|
743
|
+
this.http = http;
|
|
744
|
+
}
|
|
745
|
+
/** What the user owes in card fees, per currency, and what for. */
|
|
746
|
+
async get(opts = {}) {
|
|
747
|
+
return this.http.get("/me/debt", { signal: opts.signal });
|
|
748
|
+
}
|
|
749
|
+
/** What the user owes in `currency`, decimal string; `"0"` when nothing. */
|
|
750
|
+
async owedIn(currency, opts = {}) {
|
|
751
|
+
const debt = await this.get(opts);
|
|
752
|
+
const want = currency.trim().toUpperCase();
|
|
753
|
+
return debt.total.find((d) => d.currency.toUpperCase() === want)?.amount ?? "0";
|
|
754
|
+
}
|
|
755
|
+
};
|
|
756
|
+
|
|
757
|
+
// src/resources/close-requests.ts
|
|
758
|
+
var CloseRequestsResource = class {
|
|
759
|
+
constructor(http) {
|
|
760
|
+
this.http = http;
|
|
761
|
+
}
|
|
762
|
+
/**
|
|
763
|
+
* Close a card that holds money, the rest going back the way it was paid.
|
|
764
|
+
* Asking again for the same card returns the same request. 404 no such
|
|
765
|
+
* card · 409 {@link CloseRequestError}: `no_balance` means the card holds
|
|
766
|
+
* nothing, close it with `cards.terminate()` · 503 the issuer can't be
|
|
767
|
+
* reached; the card stays as it was.
|
|
768
|
+
*/
|
|
769
|
+
async request(cardId, input = {}) {
|
|
770
|
+
return this.http.post(`/me/cards/${encodeURIComponent(cardId)}/close-request`, {
|
|
771
|
+
body: { reason: input.reason }
|
|
772
|
+
});
|
|
773
|
+
}
|
|
774
|
+
/** Every card close request of the user, newest first. */
|
|
775
|
+
async list(opts = {}) {
|
|
776
|
+
const res = await this.http.get("/me/close-requests", {
|
|
777
|
+
signal: opts.signal
|
|
778
|
+
});
|
|
779
|
+
return res.items;
|
|
780
|
+
}
|
|
781
|
+
/** One close request. 404 when it isn't the user's. */
|
|
782
|
+
async get(id, opts = {}) {
|
|
783
|
+
return this.http.get(`/me/close-requests/${encodeURIComponent(id)}`, {
|
|
784
|
+
signal: opts.signal
|
|
785
|
+
});
|
|
786
|
+
}
|
|
787
|
+
/** The request for this card, if the user made one. */
|
|
788
|
+
async forCard(cardId, opts = {}) {
|
|
789
|
+
const all = await this.list(opts);
|
|
790
|
+
return all.find((r) => r.card_id === cardId) ?? null;
|
|
791
|
+
}
|
|
792
|
+
/**
|
|
793
|
+
* Give a bank account or a card in the user's own name, when the request
|
|
794
|
+
* is `payout_details_required` (or `identity_check`, to correct them). 400
|
|
795
|
+
* `validation`: a name, number or bank code that doesn't look right · 409
|
|
796
|
+
* `details_not_needed`.
|
|
797
|
+
*/
|
|
798
|
+
async submitPayoutDetails(id, details) {
|
|
799
|
+
return this.http.post(
|
|
800
|
+
`/me/close-requests/${encodeURIComponent(id)}/payout-details`,
|
|
801
|
+
{ body: details }
|
|
802
|
+
);
|
|
803
|
+
}
|
|
804
|
+
};
|
|
805
|
+
|
|
733
806
|
// src/resources/codes.ts
|
|
734
807
|
var CodesResource = class {
|
|
735
808
|
constructor(http) {
|
|
@@ -1261,6 +1334,8 @@ var HistoryResource = class {
|
|
|
1261
1334
|
};
|
|
1262
1335
|
|
|
1263
1336
|
// src/resources/consents.ts
|
|
1337
|
+
var HOLDER_DATA_CONSENT = "holder_data_transfer";
|
|
1338
|
+
var DISPUTE_DOCUMENTS_CONSENT = "dispute_documents_transfer";
|
|
1264
1339
|
var ConsentsResource = class {
|
|
1265
1340
|
constructor(http) {
|
|
1266
1341
|
this.http = http;
|
|
@@ -1269,20 +1344,51 @@ var ConsentsResource = class {
|
|
|
1269
1344
|
async get() {
|
|
1270
1345
|
return this.http.get("/me/consents");
|
|
1271
1346
|
}
|
|
1347
|
+
/** Whether `kind` stands now: given and not withdrawn since. */
|
|
1348
|
+
async stands(kind) {
|
|
1349
|
+
const { consents } = await this.get();
|
|
1350
|
+
return consents.some((c) => c.kind === kind && c.given);
|
|
1351
|
+
}
|
|
1272
1352
|
/**
|
|
1273
|
-
* Give (`true`) or withdraw (`false`) an optional consent: `marketing
|
|
1274
|
-
* `cookies_analytics
|
|
1275
|
-
*
|
|
1276
|
-
*
|
|
1353
|
+
* Give (`true`) or withdraw (`false`) an optional consent: `marketing`,
|
|
1354
|
+
* `cookies_analytics`, `holder_data_transfer` or
|
|
1355
|
+
* `dispute_documents_transfer`. Withdrawing `marketing` turns advertising
|
|
1356
|
+
* off in every channel at once; giving it turns on advertising by e-mail.
|
|
1357
|
+
* Withdrawing `holder_data_transfer` leaves the user's cards alone and
|
|
1358
|
+
* stops new cards whose product has `holder_data_required`. A call that
|
|
1359
|
+
* changes nothing records nothing, unless it names a card.
|
|
1360
|
+
*
|
|
1361
|
+
* The third argument is the channel, or {@link ConsentOptions} with the
|
|
1362
|
+
* channel and the card.
|
|
1277
1363
|
*
|
|
1278
1364
|
* Errors: 400 `consent_required` for `terms` or `personal_data`,
|
|
1279
|
-
* 400 `unknown_consent
|
|
1365
|
+
* 400 `unknown_consent`, 400 `card_not_allowed` (a card named with a kind
|
|
1366
|
+
* that takes none), 404 `not_found` (not one of the user's cards).
|
|
1280
1367
|
*/
|
|
1281
|
-
async set(kind, given,
|
|
1368
|
+
async set(kind, given, options) {
|
|
1369
|
+
const opts = typeof options === "string" ? { channel: options } : options ?? {};
|
|
1282
1370
|
const body = { kind, given };
|
|
1283
|
-
if (channel !== void 0) body.channel = channel;
|
|
1371
|
+
if (opts.channel !== void 0) body.channel = opts.channel;
|
|
1372
|
+
if (opts.cardId !== void 0) body.card_id = opts.cardId;
|
|
1284
1373
|
return this.http.post("/me/consents", { body });
|
|
1285
1374
|
}
|
|
1375
|
+
/**
|
|
1376
|
+
* The user agreed on the consent screen that their real personal details
|
|
1377
|
+
* go to the card issuer (`holder_data_transfer`). Needed before ordering a
|
|
1378
|
+
* product with `holder_data_required`, unless the order itself carries the
|
|
1379
|
+
* kind in its `consents`.
|
|
1380
|
+
*/
|
|
1381
|
+
async allowHolderData(options) {
|
|
1382
|
+
return this.set(HOLDER_DATA_CONSENT, true, options);
|
|
1383
|
+
}
|
|
1384
|
+
/**
|
|
1385
|
+
* The user agreed that their documents go to the card issuer for a
|
|
1386
|
+
* dispute (`dispute_documents_transfer`). Name the disputed card with
|
|
1387
|
+
* `cardId`; each call is then recorded on its own.
|
|
1388
|
+
*/
|
|
1389
|
+
async allowDisputeDocuments(options) {
|
|
1390
|
+
return this.set(DISPUTE_DOCUMENTS_CONSENT, true, options);
|
|
1391
|
+
}
|
|
1286
1392
|
/**
|
|
1287
1393
|
* Record what the cookie banner or the cookie settings say about
|
|
1288
1394
|
* analytics. Works signed in or not: before sign-in the choice is kept
|
|
@@ -1335,7 +1441,7 @@ var FundingOptionsResource = class {
|
|
|
1335
1441
|
};
|
|
1336
1442
|
|
|
1337
1443
|
// src/version.ts
|
|
1338
|
-
var SDK_VERSION = "0.6.
|
|
1444
|
+
var SDK_VERSION = "0.6.5";
|
|
1339
1445
|
|
|
1340
1446
|
// src/client-platform.ts
|
|
1341
1447
|
var CLIENT_HEADER = "X-Takeal-Client";
|
|
@@ -1410,7 +1516,7 @@ function isAbsolute(url) {
|
|
|
1410
1516
|
}
|
|
1411
1517
|
|
|
1412
1518
|
// src/compat.ts
|
|
1413
|
-
var SUPPORTED_MEISTER = ">=0.6.
|
|
1519
|
+
var SUPPORTED_MEISTER = ">=0.6.11, <0.7.0";
|
|
1414
1520
|
var SEMVER = /^v?(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-([0-9A-Za-z.-]+))?(?:\+[0-9A-Za-z.-]+)?$/;
|
|
1415
1521
|
function parse(v) {
|
|
1416
1522
|
const m = SEMVER.exec(v.trim());
|
|
@@ -1923,6 +2029,8 @@ function createClient(opts) {
|
|
|
1923
2029
|
cards: new CardsResource(http),
|
|
1924
2030
|
balance: new BalanceResource(http),
|
|
1925
2031
|
bonus: new BonusResource(http),
|
|
2032
|
+
debt: new DebtResource(http),
|
|
2033
|
+
closeRequests: new CloseRequestsResource(http),
|
|
1926
2034
|
codes: new CodesResource(http),
|
|
1927
2035
|
referral: new ReferralResource(http),
|
|
1928
2036
|
subscription: new SubscriptionResource(http),
|
|
@@ -1960,6 +2068,8 @@ function defaultFetch() {
|
|
|
1960
2068
|
exports.ANALYTICS_EVENTS = ANALYTICS_EVENTS;
|
|
1961
2069
|
exports.ApiError = ApiError;
|
|
1962
2070
|
exports.CLIENT_HEADER = CLIENT_HEADER;
|
|
2071
|
+
exports.DISPUTE_DOCUMENTS_CONSENT = DISPUTE_DOCUMENTS_CONSENT;
|
|
2072
|
+
exports.HOLDER_DATA_CONSENT = HOLDER_DATA_CONSENT;
|
|
1963
2073
|
exports.METRIKA_GOALS = METRIKA_GOALS;
|
|
1964
2074
|
exports.NO_CAPTURE_CLASS = NO_CAPTURE_CLASS;
|
|
1965
2075
|
exports.NetworkError = NetworkError;
|