@takeal/cusfront-sdk 0.6.0 → 0.6.2
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 +67 -0
- package/README.md +221 -1
- package/dist/{cards-B_aNY35J.d.cts → cards-DU2DdhYO.d.cts} +154 -20
- package/dist/{cards-Ba1wZttb.d.ts → cards-DzhPVA9N.d.ts} +154 -20
- package/dist/{deposits-BEc8U80M.d.cts → deposits-BEkNeE-v.d.cts} +71 -8
- package/dist/{deposits-DScyT_D9.d.ts → deposits-Dt6A76MB.d.ts} +71 -8
- package/dist/index.cjs +129 -14
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +16 -8
- package/dist/index.d.ts +16 -8
- package/dist/index.js +129 -14
- package/dist/index.js.map +1 -1
- package/dist/react/index.d.cts +4 -2
- package/dist/react/index.d.ts +4 -2
- package/dist/resources/auth.cjs +25 -4
- package/dist/resources/auth.cjs.map +1 -1
- package/dist/resources/auth.d.cts +40 -5
- package/dist/resources/auth.d.ts +40 -5
- package/dist/resources/auth.js +25 -4
- package/dist/resources/auth.js.map +1 -1
- package/dist/resources/cards.cjs +32 -6
- 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 +32 -6
- package/dist/resources/cards.js.map +1 -1
- package/dist/resources/consents.cjs +91 -0
- package/dist/resources/consents.cjs.map +1 -0
- package/dist/resources/consents.d.cts +83 -0
- package/dist/resources/consents.d.ts +83 -0
- package/dist/resources/consents.js +89 -0
- package/dist/resources/consents.js.map +1 -0
- package/dist/resources/deposits.cjs +6 -1
- package/dist/resources/deposits.cjs.map +1 -1
- package/dist/resources/deposits.d.cts +3 -2
- package/dist/resources/deposits.d.ts +3 -2
- package/dist/resources/deposits.js +6 -1
- package/dist/resources/deposits.js.map +1 -1
- package/dist/resources/funding-options.cjs.map +1 -1
- package/dist/resources/funding-options.d.cts +3 -2
- package/dist/resources/funding-options.d.ts +3 -2
- package/dist/resources/funding-options.js.map +1 -1
- package/dist/resources/me.d.cts +1 -0
- package/dist/resources/me.d.ts +1 -0
- package/dist/resources/receipts.cjs +22 -0
- package/dist/resources/receipts.cjs.map +1 -0
- package/dist/resources/receipts.d.cts +51 -0
- package/dist/resources/receipts.d.ts +51 -0
- package/dist/resources/receipts.js +20 -0
- package/dist/resources/receipts.js.map +1 -0
- package/dist/telegram.cjs +167 -14
- package/dist/telegram.cjs.map +1 -1
- package/dist/telegram.d.cts +4 -2
- package/dist/telegram.d.ts +4 -2
- package/dist/telegram.js +167 -14
- package/dist/telegram.js.map +1 -1
- package/package.json +11 -1
package/dist/index.d.cts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
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
|
-
export { ChangePasswordInput, ExchangeTelegramInput, JwtIssued, LinkTelegramInput, LoginInput, LoginResponse, OtpSentResponse, RegisterInput, Session, TelegramLink, TelegramUnknown, TotpRequired, TotpSetupComplete, TotpSetupRequired, User } from './resources/auth.cjs';
|
|
5
|
-
import { a as DepositsResource, F as FundingOptionsResource } from './deposits-
|
|
6
|
-
export { C as CardLoadStatus, b as CreateDepositRefundInput, c as CreateQuoteInput, D as Deposit, d as DepositMethod, e as DepositStatus, f as DepositTarget, g as
|
|
7
|
-
import { b as CardsResource } from './cards-
|
|
8
|
-
export { A as Address, B as BillingAddress, a as Card, c as CardBalance, d as CardDesignRef, C as CardProduct,
|
|
4
|
+
export { ChangePasswordInput, EmailChangeRequested, ExchangeTelegramInput, JwtIssued, LinkTelegramInput, LoginInput, LoginResponse, OtpSentResponse, RegisterInput, Session, TelegramLink, TelegramUnknown, TotpRequired, TotpSetupComplete, TotpSetupRequired, User } from './resources/auth.cjs';
|
|
5
|
+
import { a as DepositsResource, F as FundingOptionsResource } from './deposits-BEkNeE-v.cjs';
|
|
6
|
+
export { C as CardLoadStatus, b as CreateDepositRefundInput, c as CreateQuoteInput, D as Deposit, d as DepositMethod, e as DepositStatus, f as DepositTarget, g as FeeKind, h as FunderMode, i as FundingOption, j as FundingQuote, I as InitiateDepositInput, k as IssueCardInput, M as MethodTerms, R as Refund } from './deposits-BEkNeE-v.cjs';
|
|
7
|
+
import { b as CardsResource } from './cards-DU2DdhYO.cjs';
|
|
8
|
+
export { A as Address, B as BillingAddress, a as Card, c as CardBalance, d as CardDesignRef, e as CardForm, C as CardProduct, f as CardProductPrice, g as CardStatus, h as CardStatusSource, i as CardTopUp, j as CardTopUpStatus, k as CardTransfer, l as CardType, m as Cardholder, n as CloseBlockedReason, o as CreateCardInput, p as CustomerInfo, I as IssuanceBonus, R as RevealCardInput, q as RevealedCard, S as SetPinInput, T as TopUpInput, r as TopUpResult, s as TopUpTerms, t as TransferInput, u as TransferResult, U as UpdateCardInput } from './cards-DU2DdhYO.cjs';
|
|
9
9
|
import { BalanceResource } from './resources/balance.cjs';
|
|
10
10
|
export { Balance } from './resources/balance.cjs';
|
|
11
11
|
import { BonusResource } from './resources/bonus.cjs';
|
|
@@ -39,6 +39,10 @@ import { AttributionResource } from './resources/attribution.cjs';
|
|
|
39
39
|
export { AnonymousKeyOptions, AttributionStatus, SignupAttribution, SurveyAnswer, TouchFields, TouchInput, TouchResult, anonymousKey, currentTouch } from './resources/attribution.cjs';
|
|
40
40
|
import { HistoryResource } from './resources/history.cjs';
|
|
41
41
|
export { HistoryAmount, HistoryCard, HistoryItem, HistoryKind, HistoryPage, HistoryStatus, ListHistoryParams } from './resources/history.cjs';
|
|
42
|
+
import { ConsentsResource } from './resources/consents.cjs';
|
|
43
|
+
export { ConsentChannel, ConsentDocument, ConsentKind, ConsentState, Consents, CookieChoiceInput } from './resources/consents.cjs';
|
|
44
|
+
import { ReceiptsResource } from './resources/receipts.cjs';
|
|
45
|
+
export { ListReceiptsParams, Receipt, ReceiptKind } from './resources/receipts.cjs';
|
|
42
46
|
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';
|
|
43
47
|
|
|
44
48
|
/**
|
|
@@ -71,7 +75,7 @@ interface BrandConfig {
|
|
|
71
75
|
* Which platform versions this SDK works with, as a semver range:
|
|
72
76
|
* comparators separated by ", ". Keep this the only definition.
|
|
73
77
|
*/
|
|
74
|
-
declare const SUPPORTED_MEISTER = ">=0.
|
|
78
|
+
declare const SUPPORTED_MEISTER = ">=0.6.7, <0.7.0";
|
|
75
79
|
/** What `client.ready()` returns. */
|
|
76
80
|
interface ReadyInfo {
|
|
77
81
|
/** `true` when the platform reported a version inside `supportedMeister`. */
|
|
@@ -177,7 +181,7 @@ declare function isNetworkError(e: unknown): e is NetworkError;
|
|
|
177
181
|
* `define`. `src/version.test.ts` checks it matches `package.json`, so a
|
|
178
182
|
* release bump that forgets this file fails the test run.
|
|
179
183
|
*/
|
|
180
|
-
declare const SDK_VERSION = "0.6.
|
|
184
|
+
declare const SDK_VERSION = "0.6.2";
|
|
181
185
|
|
|
182
186
|
/**
|
|
183
187
|
* `@takeal/cusfront-sdk` — typed client for the Takeal end-user API.
|
|
@@ -273,6 +277,10 @@ interface CusfrontClient {
|
|
|
273
277
|
readonly attribution: AttributionResource;
|
|
274
278
|
/** Everything that happened to the user's money in one list, or one card's part of it. */
|
|
275
279
|
readonly history: HistoryResource;
|
|
280
|
+
/** What the user agreed to; give or withdraw the optional consents. */
|
|
281
|
+
readonly consents: ConsentsResource;
|
|
282
|
+
/** A numbered receipt for every payment. */
|
|
283
|
+
readonly receipts: ReceiptsResource;
|
|
276
284
|
/** Direct access to the token store (e.g. for an explicit sign-out
|
|
277
285
|
* on Capacitor's lifecycle "app pausing" event). */
|
|
278
286
|
readonly tokens: TokenStore;
|
|
@@ -303,4 +311,4 @@ interface CusfrontClient {
|
|
|
303
311
|
*/
|
|
304
312
|
declare function createClient(opts: CreateClientOptions): CusfrontClient;
|
|
305
313
|
|
|
306
|
-
export { ApiError, type BrandConfig, ClientDescriptor, type CreateClientOptions, type CusfrontClient, MeResource, NetworkError, type ReadyBody, type ReadyInfo, ResolvedClientDescriptor, SDK_VERSION, SUPPORTED_MEISTER, TokenStore, createClient, isApiError, isNetworkError, resolveAssetUrl, satisfies };
|
|
314
|
+
export { ApiError, type BrandConfig, ClientDescriptor, ConsentsResource, type CreateClientOptions, type CusfrontClient, MeResource, NetworkError, type ReadyBody, type ReadyInfo, ReceiptsResource, ResolvedClientDescriptor, SDK_VERSION, SUPPORTED_MEISTER, TokenStore, createClient, isApiError, isNetworkError, resolveAssetUrl, satisfies };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
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
|
-
export { ChangePasswordInput, ExchangeTelegramInput, JwtIssued, LinkTelegramInput, LoginInput, LoginResponse, OtpSentResponse, RegisterInput, Session, TelegramLink, TelegramUnknown, TotpRequired, TotpSetupComplete, TotpSetupRequired, User } from './resources/auth.js';
|
|
5
|
-
import { a as DepositsResource, F as FundingOptionsResource } from './deposits-
|
|
6
|
-
export { C as CardLoadStatus, b as CreateDepositRefundInput, c as CreateQuoteInput, D as Deposit, d as DepositMethod, e as DepositStatus, f as DepositTarget, g as
|
|
7
|
-
import { b as CardsResource } from './cards-
|
|
8
|
-
export { A as Address, B as BillingAddress, a as Card, c as CardBalance, d as CardDesignRef, C as CardProduct,
|
|
4
|
+
export { ChangePasswordInput, EmailChangeRequested, ExchangeTelegramInput, JwtIssued, LinkTelegramInput, LoginInput, LoginResponse, OtpSentResponse, RegisterInput, Session, TelegramLink, TelegramUnknown, TotpRequired, TotpSetupComplete, TotpSetupRequired, User } from './resources/auth.js';
|
|
5
|
+
import { a as DepositsResource, F as FundingOptionsResource } from './deposits-Dt6A76MB.js';
|
|
6
|
+
export { C as CardLoadStatus, b as CreateDepositRefundInput, c as CreateQuoteInput, D as Deposit, d as DepositMethod, e as DepositStatus, f as DepositTarget, g as FeeKind, h as FunderMode, i as FundingOption, j as FundingQuote, I as InitiateDepositInput, k as IssueCardInput, M as MethodTerms, R as Refund } from './deposits-Dt6A76MB.js';
|
|
7
|
+
import { b as CardsResource } from './cards-DzhPVA9N.js';
|
|
8
|
+
export { A as Address, B as BillingAddress, a as Card, c as CardBalance, d as CardDesignRef, e as CardForm, C as CardProduct, f as CardProductPrice, g as CardStatus, h as CardStatusSource, i as CardTopUp, j as CardTopUpStatus, k as CardTransfer, l as CardType, m as Cardholder, n as CloseBlockedReason, o as CreateCardInput, p as CustomerInfo, I as IssuanceBonus, R as RevealCardInput, q as RevealedCard, S as SetPinInput, T as TopUpInput, r as TopUpResult, s as TopUpTerms, t as TransferInput, u as TransferResult, U as UpdateCardInput } from './cards-DzhPVA9N.js';
|
|
9
9
|
import { BalanceResource } from './resources/balance.js';
|
|
10
10
|
export { Balance } from './resources/balance.js';
|
|
11
11
|
import { BonusResource } from './resources/bonus.js';
|
|
@@ -39,6 +39,10 @@ import { AttributionResource } from './resources/attribution.js';
|
|
|
39
39
|
export { AnonymousKeyOptions, AttributionStatus, SignupAttribution, SurveyAnswer, TouchFields, TouchInput, TouchResult, anonymousKey, currentTouch } from './resources/attribution.js';
|
|
40
40
|
import { HistoryResource } from './resources/history.js';
|
|
41
41
|
export { HistoryAmount, HistoryCard, HistoryItem, HistoryKind, HistoryPage, HistoryStatus, ListHistoryParams } from './resources/history.js';
|
|
42
|
+
import { ConsentsResource } from './resources/consents.js';
|
|
43
|
+
export { ConsentChannel, ConsentDocument, ConsentKind, ConsentState, Consents, CookieChoiceInput } from './resources/consents.js';
|
|
44
|
+
import { ReceiptsResource } from './resources/receipts.js';
|
|
45
|
+
export { ListReceiptsParams, Receipt, ReceiptKind } from './resources/receipts.js';
|
|
42
46
|
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';
|
|
43
47
|
|
|
44
48
|
/**
|
|
@@ -71,7 +75,7 @@ interface BrandConfig {
|
|
|
71
75
|
* Which platform versions this SDK works with, as a semver range:
|
|
72
76
|
* comparators separated by ", ". Keep this the only definition.
|
|
73
77
|
*/
|
|
74
|
-
declare const SUPPORTED_MEISTER = ">=0.
|
|
78
|
+
declare const SUPPORTED_MEISTER = ">=0.6.7, <0.7.0";
|
|
75
79
|
/** What `client.ready()` returns. */
|
|
76
80
|
interface ReadyInfo {
|
|
77
81
|
/** `true` when the platform reported a version inside `supportedMeister`. */
|
|
@@ -177,7 +181,7 @@ declare function isNetworkError(e: unknown): e is NetworkError;
|
|
|
177
181
|
* `define`. `src/version.test.ts` checks it matches `package.json`, so a
|
|
178
182
|
* release bump that forgets this file fails the test run.
|
|
179
183
|
*/
|
|
180
|
-
declare const SDK_VERSION = "0.6.
|
|
184
|
+
declare const SDK_VERSION = "0.6.2";
|
|
181
185
|
|
|
182
186
|
/**
|
|
183
187
|
* `@takeal/cusfront-sdk` — typed client for the Takeal end-user API.
|
|
@@ -273,6 +277,10 @@ interface CusfrontClient {
|
|
|
273
277
|
readonly attribution: AttributionResource;
|
|
274
278
|
/** Everything that happened to the user's money in one list, or one card's part of it. */
|
|
275
279
|
readonly history: HistoryResource;
|
|
280
|
+
/** What the user agreed to; give or withdraw the optional consents. */
|
|
281
|
+
readonly consents: ConsentsResource;
|
|
282
|
+
/** A numbered receipt for every payment. */
|
|
283
|
+
readonly receipts: ReceiptsResource;
|
|
276
284
|
/** Direct access to the token store (e.g. for an explicit sign-out
|
|
277
285
|
* on Capacitor's lifecycle "app pausing" event). */
|
|
278
286
|
readonly tokens: TokenStore;
|
|
@@ -303,4 +311,4 @@ interface CusfrontClient {
|
|
|
303
311
|
*/
|
|
304
312
|
declare function createClient(opts: CreateClientOptions): CusfrontClient;
|
|
305
313
|
|
|
306
|
-
export { ApiError, type BrandConfig, ClientDescriptor, type CreateClientOptions, type CusfrontClient, MeResource, NetworkError, type ReadyBody, type ReadyInfo, ResolvedClientDescriptor, SDK_VERSION, SUPPORTED_MEISTER, TokenStore, createClient, isApiError, isNetworkError, resolveAssetUrl, satisfies };
|
|
314
|
+
export { ApiError, type BrandConfig, ClientDescriptor, ConsentsResource, type CreateClientOptions, type CusfrontClient, MeResource, NetworkError, type ReadyBody, type ReadyInfo, ReceiptsResource, ResolvedClientDescriptor, SDK_VERSION, SUPPORTED_MEISTER, TokenStore, createClient, isApiError, isNetworkError, resolveAssetUrl, satisfies };
|
package/dist/index.js
CHANGED
|
@@ -230,7 +230,8 @@ var AuthResource = class {
|
|
|
230
230
|
* `wallet_currency` must be one the deployment offers; omit it to take
|
|
231
231
|
* the deployment default (it can be switched later via `client.wallet`
|
|
232
232
|
* while the wallet is empty).
|
|
233
|
-
* Errors: 400 `validation` / `currency_not_allowed
|
|
233
|
+
* Errors: 400 `validation` / `currency_not_allowed` / `consents_required`
|
|
234
|
+
* / `unknown_consent`, 409 email taken. */
|
|
234
235
|
async register(input) {
|
|
235
236
|
const resp = await this.http.post("/auth/register", {
|
|
236
237
|
body: withRemember(input),
|
|
@@ -275,6 +276,8 @@ var AuthResource = class {
|
|
|
275
276
|
if (input.provision !== void 0) body.provision = input.provision;
|
|
276
277
|
if (input.attribution !== void 0) body.attribution = input.attribution;
|
|
277
278
|
if (input.code !== void 0) body.code = input.code;
|
|
279
|
+
if (input.consents !== void 0) body.consents = input.consents;
|
|
280
|
+
if (input.consentChannel !== void 0) body.consent_channel = input.consentChannel;
|
|
278
281
|
let resp;
|
|
279
282
|
try {
|
|
280
283
|
resp = await this.http.post("/auth/telegram/exchange", {
|
|
@@ -309,12 +312,30 @@ var AuthResource = class {
|
|
|
309
312
|
await Promise.resolve(this.tokens.set(resp.access_token));
|
|
310
313
|
return resp;
|
|
311
314
|
}
|
|
312
|
-
/** Attach
|
|
313
|
-
*
|
|
314
|
-
*
|
|
315
|
+
/** Attach the first real email to a Telegram-made account (and clear
|
|
316
|
+
* `email_pending`). 409 if taken. An account that already has a real
|
|
317
|
+
* address gets 409 `email_change_needs_code`: change it with
|
|
318
|
+
* {@link requestEmailChange} and {@link confirmEmailChange}. */
|
|
315
319
|
async linkEmail(input) {
|
|
316
320
|
return this.http.post("/me/email", { body: { email: input.email } });
|
|
317
321
|
}
|
|
322
|
+
/** Step one of an email change: a six-digit code goes to the new address
|
|
323
|
+
* and works for 5 minutes. Nothing changes yet.
|
|
324
|
+
* Errors: 400 `same_email`, 409 address taken, 429 `too_many_requests`
|
|
325
|
+
* (five codes an hour). */
|
|
326
|
+
async requestEmailChange(input) {
|
|
327
|
+
return this.http.post("/me/email/change", {
|
|
328
|
+
body: { email: input.email }
|
|
329
|
+
});
|
|
330
|
+
}
|
|
331
|
+
/** Step two: the code from the e-mail changes the address; the old one
|
|
332
|
+
* gets a notice. Errors: 401 `invalid_code` (after five wrong codes a new
|
|
333
|
+
* request is needed), 409 the address was taken meanwhile. */
|
|
334
|
+
async confirmEmailChange(input) {
|
|
335
|
+
return this.http.post("/me/email/change/confirm", {
|
|
336
|
+
body: { challenge_id: input.challengeId, code: input.code }
|
|
337
|
+
});
|
|
338
|
+
}
|
|
318
339
|
/** Current user — fails 401 when the stored JWT is expired or
|
|
319
340
|
* missing. Useful as a "do I have a session" probe on app boot. */
|
|
320
341
|
async me() {
|
|
@@ -346,6 +367,7 @@ function cardRequestBody(input) {
|
|
|
346
367
|
useBonus,
|
|
347
368
|
bonusAmount,
|
|
348
369
|
promoCode,
|
|
370
|
+
consentChannel,
|
|
349
371
|
initial_amount: _ignored,
|
|
350
372
|
...rest
|
|
351
373
|
} = input;
|
|
@@ -356,6 +378,7 @@ function cardRequestBody(input) {
|
|
|
356
378
|
if (useBonus !== void 0) body["use_bonus"] = useBonus;
|
|
357
379
|
if (bonusAmount !== void 0) body["bonus_amount"] = bonusAmount;
|
|
358
380
|
if (promoCode !== void 0) body["promo_code"] = promoCode;
|
|
381
|
+
if (consentChannel !== void 0) body["consent_channel"] = consentChannel;
|
|
359
382
|
return body;
|
|
360
383
|
}
|
|
361
384
|
var CardsResource = class {
|
|
@@ -474,9 +497,11 @@ var CardsResource = class {
|
|
|
474
497
|
});
|
|
475
498
|
}
|
|
476
499
|
/**
|
|
477
|
-
* Freeze the caller's own card. Reversible via {@link unfreeze}
|
|
478
|
-
* `
|
|
479
|
-
*
|
|
500
|
+
* Freeze the caller's own card. Reversible via {@link unfreeze} while
|
|
501
|
+
* `status_source` is `holder` or `operator`. The optional `reason` is
|
|
502
|
+
* recorded on the audit trail. Resolves to the updated card. 404 if the
|
|
503
|
+
* card isn't the caller's; 409 `card_locked` when support holds it; 501 if
|
|
504
|
+
* the issuer can't freeze.
|
|
480
505
|
*/
|
|
481
506
|
async freeze(id, reason) {
|
|
482
507
|
return this.http.post(`/me/cards/${encodeURIComponent(id)}/freeze`, { body: { reason } });
|
|
@@ -491,16 +516,38 @@ var CardsResource = class {
|
|
|
491
516
|
* keep the result in volatile memory only, never write it to
|
|
492
517
|
* localStorage / logs, and clear it within `expires_in_seconds`.
|
|
493
518
|
*
|
|
494
|
-
*
|
|
495
|
-
*
|
|
519
|
+
* The result is the numbers, or `reveal_url` with empty `pan` and `cvv`
|
|
520
|
+
* when the issuer shows them on a page of its own: open that page in a
|
|
521
|
+
* frame right away, it is short-lived.
|
|
522
|
+
*
|
|
523
|
+
* 403 not your card · 409 `card_locked` · 429 rate-limited · 501 connector
|
|
524
|
+
* has no sensitive-data endpoint · 503 `provider_unavailable`.
|
|
496
525
|
*/
|
|
497
526
|
async reveal(id, _input) {
|
|
498
527
|
return this.http.post(`/me/cards/${encodeURIComponent(id)}/reveal`);
|
|
499
528
|
}
|
|
500
|
-
/**
|
|
529
|
+
/**
|
|
530
|
+
* Unfreeze a previously-frozen card. Idempotent on an already-active card.
|
|
531
|
+
* A card the issuer froze (`status_source: "provider"`) is not the
|
|
532
|
+
* holder's to unfreeze: the API answers 409 `card_locked`, so hide the
|
|
533
|
+
* button and say the freeze is lifted through the issuer's support.
|
|
534
|
+
*/
|
|
501
535
|
async unfreeze(id) {
|
|
502
536
|
return this.http.post(`/me/cards/${encodeURIComponent(id)}/unfreeze`, { body: {} });
|
|
503
537
|
}
|
|
538
|
+
/**
|
|
539
|
+
* Set the PIN of the caller's own physical card. The session is enough; the
|
|
540
|
+
* call is rate-limited like {@link reveal} and the PIN is kept nowhere.
|
|
541
|
+
* Resolves to the card; the user also gets a notification that the PIN
|
|
542
|
+
* was set. 400 not four to six digits or the card is not active · 403 not
|
|
543
|
+
* your card · 409 `card_locked`, or `provider_refused` when the issuer did
|
|
544
|
+
* not take it · 429 too many attempts · 501 a virtual card has no PIN.
|
|
545
|
+
*/
|
|
546
|
+
async setPin(id, input) {
|
|
547
|
+
return this.http.post(`/me/cards/${encodeURIComponent(id)}/pin`, {
|
|
548
|
+
body: { pin: input.pin }
|
|
549
|
+
});
|
|
550
|
+
}
|
|
504
551
|
/**
|
|
505
552
|
* Terminate the caller's own card. **One-way** — a terminated card cannot be
|
|
506
553
|
* reactivated. The optional `reason` is audited. Idempotent on an
|
|
@@ -530,7 +577,10 @@ var DepositsResource = class {
|
|
|
530
577
|
* API answers 400 `no_quote_needed`).
|
|
531
578
|
*/
|
|
532
579
|
async quote(input) {
|
|
533
|
-
|
|
580
|
+
const { connectorSlug, ...rest } = input;
|
|
581
|
+
const body = { ...rest };
|
|
582
|
+
if (connectorSlug !== void 0) body["connector_slug"] = connectorSlug;
|
|
583
|
+
return this.http.post("/me/deposits/quotes", { body });
|
|
534
584
|
}
|
|
535
585
|
async initiate(input) {
|
|
536
586
|
const { idempotencyKey, issue_card, ...rest } = input;
|
|
@@ -1133,6 +1183,69 @@ var HistoryResource = class {
|
|
|
1133
1183
|
}
|
|
1134
1184
|
};
|
|
1135
1185
|
|
|
1186
|
+
// src/resources/consents.ts
|
|
1187
|
+
var ConsentsResource = class {
|
|
1188
|
+
constructor(http) {
|
|
1189
|
+
this.http = http;
|
|
1190
|
+
}
|
|
1191
|
+
/** Where each consent stands. */
|
|
1192
|
+
async get() {
|
|
1193
|
+
return this.http.get("/me/consents");
|
|
1194
|
+
}
|
|
1195
|
+
/**
|
|
1196
|
+
* Give (`true`) or withdraw (`false`) an optional consent: `marketing` or
|
|
1197
|
+
* `cookies_analytics`. Withdrawing `marketing` turns advertising off in
|
|
1198
|
+
* every channel at once; giving it turns on advertising by e-mail. A call
|
|
1199
|
+
* that changes nothing records nothing.
|
|
1200
|
+
*
|
|
1201
|
+
* Errors: 400 `consent_required` for `terms` or `personal_data`,
|
|
1202
|
+
* 400 `unknown_consent`.
|
|
1203
|
+
*/
|
|
1204
|
+
async set(kind, given, channel) {
|
|
1205
|
+
const body = { kind, given };
|
|
1206
|
+
if (channel !== void 0) body.channel = channel;
|
|
1207
|
+
return this.http.post("/me/consents", { body });
|
|
1208
|
+
}
|
|
1209
|
+
/**
|
|
1210
|
+
* Record what the cookie banner or the cookie settings say about
|
|
1211
|
+
* analytics. Works signed in or not: before sign-in the choice is kept
|
|
1212
|
+
* under the anonymous key and moves to the account at sign-up (send the
|
|
1213
|
+
* same key in `register({ attribution })`). Declining deletes the
|
|
1214
|
+
* visitor's recorded visits and analytics ids and stops their conversions
|
|
1215
|
+
* going to Metrica. Call it on every change, not on every page load; the
|
|
1216
|
+
* same answer twice records nothing (`recorded: false`).
|
|
1217
|
+
*
|
|
1218
|
+
* Errors: 400 `invalid_anonymous_key` when not signed in and no key could
|
|
1219
|
+
* be found.
|
|
1220
|
+
*/
|
|
1221
|
+
async setCookies(input) {
|
|
1222
|
+
const body = {
|
|
1223
|
+
analytics: input.analytics
|
|
1224
|
+
};
|
|
1225
|
+
const key = input.anonymousKey ?? anonymousKey();
|
|
1226
|
+
if (key !== void 0) body.anonymous_key = key;
|
|
1227
|
+
if (input.channel !== void 0) body.channel = input.channel;
|
|
1228
|
+
return this.http.post("/consents/cookies", { body });
|
|
1229
|
+
}
|
|
1230
|
+
};
|
|
1231
|
+
|
|
1232
|
+
// src/resources/receipts.ts
|
|
1233
|
+
var ReceiptsResource = class {
|
|
1234
|
+
constructor(http) {
|
|
1235
|
+
this.http = http;
|
|
1236
|
+
}
|
|
1237
|
+
async list(params = {}) {
|
|
1238
|
+
const q = new URLSearchParams();
|
|
1239
|
+
if (params.refId !== void 0) q.set("ref_id", params.refId);
|
|
1240
|
+
if (params.limit !== void 0) q.set("limit", String(params.limit));
|
|
1241
|
+
const qs = q.toString();
|
|
1242
|
+
return this.http.get(`/me/receipts${qs ? `?${qs}` : ""}`);
|
|
1243
|
+
}
|
|
1244
|
+
async get(id) {
|
|
1245
|
+
return this.http.get(`/me/receipts/${encodeURIComponent(id)}`);
|
|
1246
|
+
}
|
|
1247
|
+
};
|
|
1248
|
+
|
|
1136
1249
|
// src/resources/funding-options.ts
|
|
1137
1250
|
var FundingOptionsResource = class {
|
|
1138
1251
|
constructor(http) {
|
|
@@ -1145,7 +1258,7 @@ var FundingOptionsResource = class {
|
|
|
1145
1258
|
};
|
|
1146
1259
|
|
|
1147
1260
|
// src/version.ts
|
|
1148
|
-
var SDK_VERSION = "0.6.
|
|
1261
|
+
var SDK_VERSION = "0.6.2";
|
|
1149
1262
|
|
|
1150
1263
|
// src/client-platform.ts
|
|
1151
1264
|
var CLIENT_HEADER = "X-Takeal-Client";
|
|
@@ -1220,7 +1333,7 @@ function isAbsolute(url) {
|
|
|
1220
1333
|
}
|
|
1221
1334
|
|
|
1222
1335
|
// src/compat.ts
|
|
1223
|
-
var SUPPORTED_MEISTER = ">=0.
|
|
1336
|
+
var SUPPORTED_MEISTER = ">=0.6.7, <0.7.0";
|
|
1224
1337
|
var SEMVER = /^v?(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-([0-9A-Za-z.-]+))?(?:\+[0-9A-Za-z.-]+)?$/;
|
|
1225
1338
|
function parse(v) {
|
|
1226
1339
|
const m = SEMVER.exec(v.trim());
|
|
@@ -1747,7 +1860,9 @@ function createClient(opts) {
|
|
|
1747
1860
|
notifications: new NotificationsResource(http),
|
|
1748
1861
|
devices: new DevicesResource(http, client),
|
|
1749
1862
|
attribution: new AttributionResource(http),
|
|
1750
|
-
history: new HistoryResource(http)
|
|
1863
|
+
history: new HistoryResource(http),
|
|
1864
|
+
consents: new ConsentsResource(http),
|
|
1865
|
+
receipts: new ReceiptsResource(http)
|
|
1751
1866
|
};
|
|
1752
1867
|
}
|
|
1753
1868
|
function pickDefaultStore(key) {
|