@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
package/dist/index.d.cts
CHANGED
|
@@ -2,12 +2,16 @@ import { T as TokenStore, F as FetchLike } from './http-DeANAoTs.cjs';
|
|
|
2
2
|
export { d as defaultBrowserStore, i as inMemoryStore } from './http-DeANAoTs.cjs';
|
|
3
3
|
import { AuthResource } from './resources/auth.cjs';
|
|
4
4
|
export { ChangePasswordInput, EmailChangeRequested, EmailCodeSent, EmailCodeSession, ExchangeTelegramInput, JwtIssued, LinkTelegramInput, LoginInput, LoginResponse, OtpSentResponse, RegisterInput, RequestEmailCodeInput, Session, TelegramLink, TelegramUnknown, TotpRequired, TotpSetupComplete, TotpSetupRequired, User, VerifyEmailCodeInput } from './resources/auth.cjs';
|
|
5
|
-
import { b as DepositsResource, F as FundingOptionsResource, c as CardsResource } from './cards-
|
|
6
|
-
export { A as Address, B as BillingAddress, a as Card, d as CardBalance, e as CardDesignRef, f as CardForm, g as
|
|
5
|
+
import { b as DepositsResource, F as FundingOptionsResource, c as CardsResource } from './cards-CEFKrVkl.cjs';
|
|
6
|
+
export { A as Address, B as BillingAddress, a as Card, d as CardBalance, e as CardDesignRef, f as CardForm, g as CardInTransit, h as CardLoadStatus, i as CardOrder, j as CardOrderError, k as CardOrderInput, C as CardProduct, l as CardProductPrice, m as CardStatus, n as CardStatusSource, o as CardTariff, p as CardTopUp, q as CardTopUpStatus, r as CardTransfer, s as CardType, t as Cardholder, u as CloseBlockedReason, v as CreateCardInput, w as CreateDepositRefundInput, x as CreateQuoteInput, y as CustomerInfo, D as Deposit, z as DepositMethod, E as DepositStatus, G as DepositTarget, H as FeeKind, I as FunderMode, J as FundingOption, K as FundingQuote, L as InitiateDepositInput, M as IssuanceBonus, N as IssueCardInput, O as MethodTerms, R as Refund, P as RevealCardInput, Q as RevealedCard, S as SetPinInput, T as TopUpInput, U as TopUpResult, V as TopUpTerms, W as TransferInput, X as TransferResult, Y as UpdateCardInput } from './cards-CEFKrVkl.cjs';
|
|
7
7
|
import { BalanceResource } from './resources/balance.cjs';
|
|
8
8
|
export { Balance } from './resources/balance.cjs';
|
|
9
9
|
import { BonusResource } from './resources/bonus.cjs';
|
|
10
10
|
export { BonusLot, BonusMovement, BonusPreview, BonusPreviewInput, BonusPurpose, BonusTarget, BonusWallet } from './resources/bonus.cjs';
|
|
11
|
+
import { DebtResource } from './resources/debt.cjs';
|
|
12
|
+
export { CardFeeKind, Debt, DebtAmount, DebtLine } from './resources/debt.cjs';
|
|
13
|
+
import { CloseRequestsResource } from './resources/close-requests.cjs';
|
|
14
|
+
export { CloseAmount, CloseRefund, CloseRequest, CloseRequestError, CloseRequestStatus, PayoutDetailsInput, PayoutDetailsShown } from './resources/close-requests.cjs';
|
|
11
15
|
import { CodesResource } from './resources/codes.cjs';
|
|
12
16
|
export { CodeCheck, CodeDiscount, CodeEffect, CodeEffectOutcome, CodeOperation, CodeRejection, CodeResult, ValidateCodeInput } from './resources/codes.cjs';
|
|
13
17
|
import { ReferralResource } from './resources/referral.cjs';
|
|
@@ -38,7 +42,7 @@ export { AnonymousKeyOptions, AttributionStatus, SignupAttribution, SurveyAnswer
|
|
|
38
42
|
import { HistoryResource } from './resources/history.cjs';
|
|
39
43
|
export { HistoryAmount, HistoryCard, HistoryItem, HistoryKind, HistoryPage, HistoryStatus, ListHistoryParams } from './resources/history.cjs';
|
|
40
44
|
import { ConsentsResource } from './resources/consents.cjs';
|
|
41
|
-
export { ConsentChannel, ConsentDocument, ConsentKind, ConsentState, Consents, CookieChoiceInput } from './resources/consents.cjs';
|
|
45
|
+
export { ConsentChannel, ConsentDocument, ConsentKind, ConsentOptions, ConsentState, Consents, CookieChoiceInput, DISPUTE_DOCUMENTS_CONSENT, HOLDER_DATA_CONSENT } from './resources/consents.cjs';
|
|
42
46
|
import { ReceiptsResource } from './resources/receipts.cjs';
|
|
43
47
|
export { ListReceiptsParams, Receipt, ReceiptKind } from './resources/receipts.cjs';
|
|
44
48
|
export { ANALYTICS_EVENTS, AnalyticsEvent, AnalyticsOptions, AnalyticsProperties, AnalyticsZone, METRIKA_GOALS, MetrikaOptions, NO_CAPTURE_CLASS, PostHogLike, PostHogOptions, identify, initAnalytics, page, posthogDistinctId, resetAnalytics, sanitizeProperties, sanitizeUrl, setAnalyticsZone, track } from './analytics.cjs';
|
|
@@ -73,7 +77,7 @@ interface BrandConfig {
|
|
|
73
77
|
* Which platform versions this SDK works with, as a semver range:
|
|
74
78
|
* comparators separated by ", ". Keep this the only definition.
|
|
75
79
|
*/
|
|
76
|
-
declare const SUPPORTED_MEISTER = ">=0.6.
|
|
80
|
+
declare const SUPPORTED_MEISTER = ">=0.6.11, <0.7.0";
|
|
77
81
|
/** What `client.ready()` returns. */
|
|
78
82
|
interface ReadyInfo {
|
|
79
83
|
/** `true` when the platform reported a version inside `supportedMeister`. */
|
|
@@ -179,7 +183,7 @@ declare function isNetworkError(e: unknown): e is NetworkError;
|
|
|
179
183
|
* `define`. `src/version.test.ts` checks it matches `package.json`, so a
|
|
180
184
|
* release bump that forgets this file fails the test run.
|
|
181
185
|
*/
|
|
182
|
-
declare const SDK_VERSION = "0.6.
|
|
186
|
+
declare const SDK_VERSION = "0.6.5";
|
|
183
187
|
|
|
184
188
|
/**
|
|
185
189
|
* `@takeal/cusfront-sdk` — typed client for the Takeal end-user API.
|
|
@@ -242,6 +246,10 @@ interface CusfrontClient {
|
|
|
242
246
|
readonly balance: BalanceResource;
|
|
243
247
|
/** Bonuses: a discount on the platform's services. Balance, credits, history and a price preview. */
|
|
244
248
|
readonly bonus: BonusResource;
|
|
249
|
+
/** Card fees the user's cards could not cover: paid first from the next top-up. */
|
|
250
|
+
readonly debt: DebtResource;
|
|
251
|
+
/** Close a card that still holds money: the rest goes back the way it was paid. */
|
|
252
|
+
readonly closeRequests: CloseRequestsResource;
|
|
245
253
|
/** Promo and referral codes: check what a code would do before using it. */
|
|
246
254
|
readonly codes: CodesResource;
|
|
247
255
|
/** For referrers: the referral code, the link to share, invited friends and rewards. */
|
package/dist/index.d.ts
CHANGED
|
@@ -2,12 +2,16 @@ import { T as TokenStore, F as FetchLike } from './http-DeANAoTs.js';
|
|
|
2
2
|
export { d as defaultBrowserStore, i as inMemoryStore } from './http-DeANAoTs.js';
|
|
3
3
|
import { AuthResource } from './resources/auth.js';
|
|
4
4
|
export { ChangePasswordInput, EmailChangeRequested, EmailCodeSent, EmailCodeSession, ExchangeTelegramInput, JwtIssued, LinkTelegramInput, LoginInput, LoginResponse, OtpSentResponse, RegisterInput, RequestEmailCodeInput, Session, TelegramLink, TelegramUnknown, TotpRequired, TotpSetupComplete, TotpSetupRequired, User, VerifyEmailCodeInput } from './resources/auth.js';
|
|
5
|
-
import { b as DepositsResource, F as FundingOptionsResource, c as CardsResource } from './cards-
|
|
6
|
-
export { A as Address, B as BillingAddress, a as Card, d as CardBalance, e as CardDesignRef, f as CardForm, g as
|
|
5
|
+
import { b as DepositsResource, F as FundingOptionsResource, c as CardsResource } from './cards-ColpW52n.js';
|
|
6
|
+
export { A as Address, B as BillingAddress, a as Card, d as CardBalance, e as CardDesignRef, f as CardForm, g as CardInTransit, h as CardLoadStatus, i as CardOrder, j as CardOrderError, k as CardOrderInput, C as CardProduct, l as CardProductPrice, m as CardStatus, n as CardStatusSource, o as CardTariff, p as CardTopUp, q as CardTopUpStatus, r as CardTransfer, s as CardType, t as Cardholder, u as CloseBlockedReason, v as CreateCardInput, w as CreateDepositRefundInput, x as CreateQuoteInput, y as CustomerInfo, D as Deposit, z as DepositMethod, E as DepositStatus, G as DepositTarget, H as FeeKind, I as FunderMode, J as FundingOption, K as FundingQuote, L as InitiateDepositInput, M as IssuanceBonus, N as IssueCardInput, O as MethodTerms, R as Refund, P as RevealCardInput, Q as RevealedCard, S as SetPinInput, T as TopUpInput, U as TopUpResult, V as TopUpTerms, W as TransferInput, X as TransferResult, Y as UpdateCardInput } from './cards-ColpW52n.js';
|
|
7
7
|
import { BalanceResource } from './resources/balance.js';
|
|
8
8
|
export { Balance } from './resources/balance.js';
|
|
9
9
|
import { BonusResource } from './resources/bonus.js';
|
|
10
10
|
export { BonusLot, BonusMovement, BonusPreview, BonusPreviewInput, BonusPurpose, BonusTarget, BonusWallet } from './resources/bonus.js';
|
|
11
|
+
import { DebtResource } from './resources/debt.js';
|
|
12
|
+
export { CardFeeKind, Debt, DebtAmount, DebtLine } from './resources/debt.js';
|
|
13
|
+
import { CloseRequestsResource } from './resources/close-requests.js';
|
|
14
|
+
export { CloseAmount, CloseRefund, CloseRequest, CloseRequestError, CloseRequestStatus, PayoutDetailsInput, PayoutDetailsShown } from './resources/close-requests.js';
|
|
11
15
|
import { CodesResource } from './resources/codes.js';
|
|
12
16
|
export { CodeCheck, CodeDiscount, CodeEffect, CodeEffectOutcome, CodeOperation, CodeRejection, CodeResult, ValidateCodeInput } from './resources/codes.js';
|
|
13
17
|
import { ReferralResource } from './resources/referral.js';
|
|
@@ -38,7 +42,7 @@ export { AnonymousKeyOptions, AttributionStatus, SignupAttribution, SurveyAnswer
|
|
|
38
42
|
import { HistoryResource } from './resources/history.js';
|
|
39
43
|
export { HistoryAmount, HistoryCard, HistoryItem, HistoryKind, HistoryPage, HistoryStatus, ListHistoryParams } from './resources/history.js';
|
|
40
44
|
import { ConsentsResource } from './resources/consents.js';
|
|
41
|
-
export { ConsentChannel, ConsentDocument, ConsentKind, ConsentState, Consents, CookieChoiceInput } from './resources/consents.js';
|
|
45
|
+
export { ConsentChannel, ConsentDocument, ConsentKind, ConsentOptions, ConsentState, Consents, CookieChoiceInput, DISPUTE_DOCUMENTS_CONSENT, HOLDER_DATA_CONSENT } from './resources/consents.js';
|
|
42
46
|
import { ReceiptsResource } from './resources/receipts.js';
|
|
43
47
|
export { ListReceiptsParams, Receipt, ReceiptKind } from './resources/receipts.js';
|
|
44
48
|
export { ANALYTICS_EVENTS, AnalyticsEvent, AnalyticsOptions, AnalyticsProperties, AnalyticsZone, METRIKA_GOALS, MetrikaOptions, NO_CAPTURE_CLASS, PostHogLike, PostHogOptions, identify, initAnalytics, page, posthogDistinctId, resetAnalytics, sanitizeProperties, sanitizeUrl, setAnalyticsZone, track } from './analytics.js';
|
|
@@ -73,7 +77,7 @@ interface BrandConfig {
|
|
|
73
77
|
* Which platform versions this SDK works with, as a semver range:
|
|
74
78
|
* comparators separated by ", ". Keep this the only definition.
|
|
75
79
|
*/
|
|
76
|
-
declare const SUPPORTED_MEISTER = ">=0.6.
|
|
80
|
+
declare const SUPPORTED_MEISTER = ">=0.6.11, <0.7.0";
|
|
77
81
|
/** What `client.ready()` returns. */
|
|
78
82
|
interface ReadyInfo {
|
|
79
83
|
/** `true` when the platform reported a version inside `supportedMeister`. */
|
|
@@ -179,7 +183,7 @@ declare function isNetworkError(e: unknown): e is NetworkError;
|
|
|
179
183
|
* `define`. `src/version.test.ts` checks it matches `package.json`, so a
|
|
180
184
|
* release bump that forgets this file fails the test run.
|
|
181
185
|
*/
|
|
182
|
-
declare const SDK_VERSION = "0.6.
|
|
186
|
+
declare const SDK_VERSION = "0.6.5";
|
|
183
187
|
|
|
184
188
|
/**
|
|
185
189
|
* `@takeal/cusfront-sdk` — typed client for the Takeal end-user API.
|
|
@@ -242,6 +246,10 @@ interface CusfrontClient {
|
|
|
242
246
|
readonly balance: BalanceResource;
|
|
243
247
|
/** Bonuses: a discount on the platform's services. Balance, credits, history and a price preview. */
|
|
244
248
|
readonly bonus: BonusResource;
|
|
249
|
+
/** Card fees the user's cards could not cover: paid first from the next top-up. */
|
|
250
|
+
readonly debt: DebtResource;
|
|
251
|
+
/** Close a card that still holds money: the rest goes back the way it was paid. */
|
|
252
|
+
readonly closeRequests: CloseRequestsResource;
|
|
245
253
|
/** Promo and referral codes: check what a code would do before using it. */
|
|
246
254
|
readonly codes: CodesResource;
|
|
247
255
|
/** For referrers: the referral code, the link to share, invited friends and rewards. */
|
package/dist/index.js
CHANGED
|
@@ -184,6 +184,8 @@ var CardsResource = class {
|
|
|
184
184
|
* `Card`. On a ledger failure after provider creation, the Takeal API rolls the row
|
|
185
185
|
* to `failed` (never an orphaned active card); inspect `status` /
|
|
186
186
|
* `failure_reason` on the result.
|
|
187
|
+
* Errors: 409 `holder_data_consent_required` when the product has
|
|
188
|
+
* `holder_data_required` and the user has not agreed to it.
|
|
187
189
|
*/
|
|
188
190
|
async create(input) {
|
|
189
191
|
const { idempotencyKey, ...card } = input;
|
|
@@ -199,7 +201,9 @@ var CardsResource = class {
|
|
|
199
201
|
* `pending_payment` until the payment is confirmed. The same
|
|
200
202
|
* `idempotencyKey` returns the same order.
|
|
201
203
|
* Errors: 400 `unknown_product` / `method_not_available` / a limit of the
|
|
202
|
-
* way of paying,
|
|
204
|
+
* way of paying, 409 `holder_data_consent_required` (the product has
|
|
205
|
+
* `holder_data_required` and the user has not agreed to it), 503 no
|
|
206
|
+
* funding connector or no exchange rate.
|
|
203
207
|
*/
|
|
204
208
|
async order(input) {
|
|
205
209
|
const { idempotencyKey, ...order } = input;
|
|
@@ -361,7 +365,10 @@ var CardsResource = class {
|
|
|
361
365
|
/**
|
|
362
366
|
* Terminate the caller's own card. **One-way** — a terminated card cannot be
|
|
363
367
|
* reactivated. The optional `reason` is audited. Idempotent on an
|
|
364
|
-
* already-terminated card.
|
|
368
|
+
* already-terminated card. A card that still holds money is refused (409
|
|
369
|
+
* `move_balance_first` or `contact_support_to_close`): close it with
|
|
370
|
+
* `client.closeRequests.request(id)` instead, and the money goes back the
|
|
371
|
+
* way it was paid.
|
|
365
372
|
*/
|
|
366
373
|
async terminate(id, reason) {
|
|
367
374
|
return this.http.post(`/me/cards/${encodeURIComponent(id)}/terminate`, {
|
|
@@ -728,6 +735,72 @@ var BonusResource = class {
|
|
|
728
735
|
}
|
|
729
736
|
};
|
|
730
737
|
|
|
738
|
+
// src/resources/debt.ts
|
|
739
|
+
var DebtResource = class {
|
|
740
|
+
constructor(http) {
|
|
741
|
+
this.http = http;
|
|
742
|
+
}
|
|
743
|
+
/** What the user owes in card fees, per currency, and what for. */
|
|
744
|
+
async get(opts = {}) {
|
|
745
|
+
return this.http.get("/me/debt", { signal: opts.signal });
|
|
746
|
+
}
|
|
747
|
+
/** What the user owes in `currency`, decimal string; `"0"` when nothing. */
|
|
748
|
+
async owedIn(currency, opts = {}) {
|
|
749
|
+
const debt = await this.get(opts);
|
|
750
|
+
const want = currency.trim().toUpperCase();
|
|
751
|
+
return debt.total.find((d) => d.currency.toUpperCase() === want)?.amount ?? "0";
|
|
752
|
+
}
|
|
753
|
+
};
|
|
754
|
+
|
|
755
|
+
// src/resources/close-requests.ts
|
|
756
|
+
var CloseRequestsResource = class {
|
|
757
|
+
constructor(http) {
|
|
758
|
+
this.http = http;
|
|
759
|
+
}
|
|
760
|
+
/**
|
|
761
|
+
* Close a card that holds money, the rest going back the way it was paid.
|
|
762
|
+
* Asking again for the same card returns the same request. 404 no such
|
|
763
|
+
* card · 409 {@link CloseRequestError}: `no_balance` means the card holds
|
|
764
|
+
* nothing, close it with `cards.terminate()` · 503 the issuer can't be
|
|
765
|
+
* reached; the card stays as it was.
|
|
766
|
+
*/
|
|
767
|
+
async request(cardId, input = {}) {
|
|
768
|
+
return this.http.post(`/me/cards/${encodeURIComponent(cardId)}/close-request`, {
|
|
769
|
+
body: { reason: input.reason }
|
|
770
|
+
});
|
|
771
|
+
}
|
|
772
|
+
/** Every card close request of the user, newest first. */
|
|
773
|
+
async list(opts = {}) {
|
|
774
|
+
const res = await this.http.get("/me/close-requests", {
|
|
775
|
+
signal: opts.signal
|
|
776
|
+
});
|
|
777
|
+
return res.items;
|
|
778
|
+
}
|
|
779
|
+
/** One close request. 404 when it isn't the user's. */
|
|
780
|
+
async get(id, opts = {}) {
|
|
781
|
+
return this.http.get(`/me/close-requests/${encodeURIComponent(id)}`, {
|
|
782
|
+
signal: opts.signal
|
|
783
|
+
});
|
|
784
|
+
}
|
|
785
|
+
/** The request for this card, if the user made one. */
|
|
786
|
+
async forCard(cardId, opts = {}) {
|
|
787
|
+
const all = await this.list(opts);
|
|
788
|
+
return all.find((r) => r.card_id === cardId) ?? null;
|
|
789
|
+
}
|
|
790
|
+
/**
|
|
791
|
+
* Give a bank account or a card in the user's own name, when the request
|
|
792
|
+
* is `payout_details_required` (or `identity_check`, to correct them). 400
|
|
793
|
+
* `validation`: a name, number or bank code that doesn't look right · 409
|
|
794
|
+
* `details_not_needed`.
|
|
795
|
+
*/
|
|
796
|
+
async submitPayoutDetails(id, details) {
|
|
797
|
+
return this.http.post(
|
|
798
|
+
`/me/close-requests/${encodeURIComponent(id)}/payout-details`,
|
|
799
|
+
{ body: details }
|
|
800
|
+
);
|
|
801
|
+
}
|
|
802
|
+
};
|
|
803
|
+
|
|
731
804
|
// src/resources/codes.ts
|
|
732
805
|
var CodesResource = class {
|
|
733
806
|
constructor(http) {
|
|
@@ -1259,6 +1332,8 @@ var HistoryResource = class {
|
|
|
1259
1332
|
};
|
|
1260
1333
|
|
|
1261
1334
|
// src/resources/consents.ts
|
|
1335
|
+
var HOLDER_DATA_CONSENT = "holder_data_transfer";
|
|
1336
|
+
var DISPUTE_DOCUMENTS_CONSENT = "dispute_documents_transfer";
|
|
1262
1337
|
var ConsentsResource = class {
|
|
1263
1338
|
constructor(http) {
|
|
1264
1339
|
this.http = http;
|
|
@@ -1267,20 +1342,51 @@ var ConsentsResource = class {
|
|
|
1267
1342
|
async get() {
|
|
1268
1343
|
return this.http.get("/me/consents");
|
|
1269
1344
|
}
|
|
1345
|
+
/** Whether `kind` stands now: given and not withdrawn since. */
|
|
1346
|
+
async stands(kind) {
|
|
1347
|
+
const { consents } = await this.get();
|
|
1348
|
+
return consents.some((c) => c.kind === kind && c.given);
|
|
1349
|
+
}
|
|
1270
1350
|
/**
|
|
1271
|
-
* Give (`true`) or withdraw (`false`) an optional consent: `marketing
|
|
1272
|
-
* `cookies_analytics
|
|
1273
|
-
*
|
|
1274
|
-
*
|
|
1351
|
+
* Give (`true`) or withdraw (`false`) an optional consent: `marketing`,
|
|
1352
|
+
* `cookies_analytics`, `holder_data_transfer` or
|
|
1353
|
+
* `dispute_documents_transfer`. Withdrawing `marketing` turns advertising
|
|
1354
|
+
* off in every channel at once; giving it turns on advertising by e-mail.
|
|
1355
|
+
* Withdrawing `holder_data_transfer` leaves the user's cards alone and
|
|
1356
|
+
* stops new cards whose product has `holder_data_required`. A call that
|
|
1357
|
+
* changes nothing records nothing, unless it names a card.
|
|
1358
|
+
*
|
|
1359
|
+
* The third argument is the channel, or {@link ConsentOptions} with the
|
|
1360
|
+
* channel and the card.
|
|
1275
1361
|
*
|
|
1276
1362
|
* Errors: 400 `consent_required` for `terms` or `personal_data`,
|
|
1277
|
-
* 400 `unknown_consent
|
|
1363
|
+
* 400 `unknown_consent`, 400 `card_not_allowed` (a card named with a kind
|
|
1364
|
+
* that takes none), 404 `not_found` (not one of the user's cards).
|
|
1278
1365
|
*/
|
|
1279
|
-
async set(kind, given,
|
|
1366
|
+
async set(kind, given, options) {
|
|
1367
|
+
const opts = typeof options === "string" ? { channel: options } : options ?? {};
|
|
1280
1368
|
const body = { kind, given };
|
|
1281
|
-
if (channel !== void 0) body.channel = channel;
|
|
1369
|
+
if (opts.channel !== void 0) body.channel = opts.channel;
|
|
1370
|
+
if (opts.cardId !== void 0) body.card_id = opts.cardId;
|
|
1282
1371
|
return this.http.post("/me/consents", { body });
|
|
1283
1372
|
}
|
|
1373
|
+
/**
|
|
1374
|
+
* The user agreed on the consent screen that their real personal details
|
|
1375
|
+
* go to the card issuer (`holder_data_transfer`). Needed before ordering a
|
|
1376
|
+
* product with `holder_data_required`, unless the order itself carries the
|
|
1377
|
+
* kind in its `consents`.
|
|
1378
|
+
*/
|
|
1379
|
+
async allowHolderData(options) {
|
|
1380
|
+
return this.set(HOLDER_DATA_CONSENT, true, options);
|
|
1381
|
+
}
|
|
1382
|
+
/**
|
|
1383
|
+
* The user agreed that their documents go to the card issuer for a
|
|
1384
|
+
* dispute (`dispute_documents_transfer`). Name the disputed card with
|
|
1385
|
+
* `cardId`; each call is then recorded on its own.
|
|
1386
|
+
*/
|
|
1387
|
+
async allowDisputeDocuments(options) {
|
|
1388
|
+
return this.set(DISPUTE_DOCUMENTS_CONSENT, true, options);
|
|
1389
|
+
}
|
|
1284
1390
|
/**
|
|
1285
1391
|
* Record what the cookie banner or the cookie settings say about
|
|
1286
1392
|
* analytics. Works signed in or not: before sign-in the choice is kept
|
|
@@ -1333,7 +1439,7 @@ var FundingOptionsResource = class {
|
|
|
1333
1439
|
};
|
|
1334
1440
|
|
|
1335
1441
|
// src/version.ts
|
|
1336
|
-
var SDK_VERSION = "0.6.
|
|
1442
|
+
var SDK_VERSION = "0.6.5";
|
|
1337
1443
|
|
|
1338
1444
|
// src/client-platform.ts
|
|
1339
1445
|
var CLIENT_HEADER = "X-Takeal-Client";
|
|
@@ -1408,7 +1514,7 @@ function isAbsolute(url) {
|
|
|
1408
1514
|
}
|
|
1409
1515
|
|
|
1410
1516
|
// src/compat.ts
|
|
1411
|
-
var SUPPORTED_MEISTER = ">=0.6.
|
|
1517
|
+
var SUPPORTED_MEISTER = ">=0.6.11, <0.7.0";
|
|
1412
1518
|
var SEMVER = /^v?(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-([0-9A-Za-z.-]+))?(?:\+[0-9A-Za-z.-]+)?$/;
|
|
1413
1519
|
function parse(v) {
|
|
1414
1520
|
const m = SEMVER.exec(v.trim());
|
|
@@ -1921,6 +2027,8 @@ function createClient(opts) {
|
|
|
1921
2027
|
cards: new CardsResource(http),
|
|
1922
2028
|
balance: new BalanceResource(http),
|
|
1923
2029
|
bonus: new BonusResource(http),
|
|
2030
|
+
debt: new DebtResource(http),
|
|
2031
|
+
closeRequests: new CloseRequestsResource(http),
|
|
1924
2032
|
codes: new CodesResource(http),
|
|
1925
2033
|
referral: new ReferralResource(http),
|
|
1926
2034
|
subscription: new SubscriptionResource(http),
|
|
@@ -1955,6 +2063,6 @@ function defaultFetch() {
|
|
|
1955
2063
|
);
|
|
1956
2064
|
}
|
|
1957
2065
|
|
|
1958
|
-
export { ANALYTICS_EVENTS, ApiError, CLIENT_HEADER, METRIKA_GOALS, NO_CAPTURE_CLASS, NetworkError, SDK_VERSION, SUPPORTED_MEISTER, anonymousKey, createClient, currentTouch, defaultBrowserStore, detectClientPlatform, identify, inMemoryStore, initAnalytics, isApiError, isCardOtp, isNetworkError, page, posthogDistinctId, resetAnalytics, resolveAssetUrl, sanitizeProperties, sanitizeUrl, satisfies, setAnalyticsZone, track };
|
|
2066
|
+
export { ANALYTICS_EVENTS, ApiError, CLIENT_HEADER, DISPUTE_DOCUMENTS_CONSENT, HOLDER_DATA_CONSENT, METRIKA_GOALS, NO_CAPTURE_CLASS, NetworkError, SDK_VERSION, SUPPORTED_MEISTER, anonymousKey, createClient, currentTouch, defaultBrowserStore, detectClientPlatform, identify, inMemoryStore, initAnalytics, isApiError, isCardOtp, isNetworkError, page, posthogDistinctId, resetAnalytics, resolveAssetUrl, sanitizeProperties, sanitizeUrl, satisfies, setAnalyticsZone, track };
|
|
1959
2067
|
//# sourceMappingURL=index.js.map
|
|
1960
2068
|
//# sourceMappingURL=index.js.map
|