@takeal/cusfront-sdk 0.6.3 → 0.6.4
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 +15 -0
- package/README.md +46 -9
- package/dist/index.cjs +41 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +41 -2
- package/dist/index.js.map +1 -1
- package/dist/resources/auth.cjs +39 -0
- package/dist/resources/auth.cjs.map +1 -1
- package/dist/resources/auth.d.cts +75 -2
- package/dist/resources/auth.d.ts +75 -2
- package/dist/resources/auth.js +39 -0
- package/dist/resources/auth.js.map +1 -1
- package/dist/telegram.cjs +41 -2
- package/dist/telegram.cjs.map +1 -1
- package/dist/telegram.js +41 -2
- package/dist/telegram.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
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, EmailChangeRequested, ExchangeTelegramInput, JwtIssued, LinkTelegramInput, LoginInput, LoginResponse, OtpSentResponse, RegisterInput, Session, TelegramLink, TelegramUnknown, TotpRequired, TotpSetupComplete, TotpSetupRequired, User } from './resources/auth.cjs';
|
|
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
5
|
import { b as DepositsResource, F as FundingOptionsResource, c as CardsResource } from './cards-ofoGRU9v.cjs';
|
|
6
6
|
export { A as Address, B as BillingAddress, a as Card, d as CardBalance, e as CardDesignRef, f as CardForm, g as CardLoadStatus, h as CardOrder, i as CardOrderError, j as CardOrderInput, C as CardProduct, k as CardProductPrice, l as CardStatus, m as CardStatusSource, n as CardTopUp, o as CardTopUpStatus, p as CardTransfer, q as CardType, r as Cardholder, s as CloseBlockedReason, t as CreateCardInput, u as CreateDepositRefundInput, v as CreateQuoteInput, w as CustomerInfo, D as Deposit, x as DepositMethod, y as DepositStatus, z as DepositTarget, E as FeeKind, G as FunderMode, H as FundingOption, I as FundingQuote, J as InitiateDepositInput, K as IssuanceBonus, L as IssueCardInput, M as MethodTerms, R as Refund, N as RevealCardInput, O as RevealedCard, S as SetPinInput, T as TopUpInput, P as TopUpResult, Q as TopUpTerms, U as TransferInput, V as TransferResult, W as UpdateCardInput } from './cards-ofoGRU9v.cjs';
|
|
7
7
|
import { BalanceResource } from './resources/balance.cjs';
|
|
@@ -73,7 +73,7 @@ interface BrandConfig {
|
|
|
73
73
|
* Which platform versions this SDK works with, as a semver range:
|
|
74
74
|
* comparators separated by ", ". Keep this the only definition.
|
|
75
75
|
*/
|
|
76
|
-
declare const SUPPORTED_MEISTER = ">=0.6.
|
|
76
|
+
declare const SUPPORTED_MEISTER = ">=0.6.9, <0.7.0";
|
|
77
77
|
/** What `client.ready()` returns. */
|
|
78
78
|
interface ReadyInfo {
|
|
79
79
|
/** `true` when the platform reported a version inside `supportedMeister`. */
|
|
@@ -179,7 +179,7 @@ declare function isNetworkError(e: unknown): e is NetworkError;
|
|
|
179
179
|
* `define`. `src/version.test.ts` checks it matches `package.json`, so a
|
|
180
180
|
* release bump that forgets this file fails the test run.
|
|
181
181
|
*/
|
|
182
|
-
declare const SDK_VERSION = "0.6.
|
|
182
|
+
declare const SDK_VERSION = "0.6.4";
|
|
183
183
|
|
|
184
184
|
/**
|
|
185
185
|
* `@takeal/cusfront-sdk` — typed client for the Takeal end-user API.
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
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, EmailChangeRequested, ExchangeTelegramInput, JwtIssued, LinkTelegramInput, LoginInput, LoginResponse, OtpSentResponse, RegisterInput, Session, TelegramLink, TelegramUnknown, TotpRequired, TotpSetupComplete, TotpSetupRequired, User } from './resources/auth.js';
|
|
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
5
|
import { b as DepositsResource, F as FundingOptionsResource, c as CardsResource } from './cards-BrqeBqLV.js';
|
|
6
6
|
export { A as Address, B as BillingAddress, a as Card, d as CardBalance, e as CardDesignRef, f as CardForm, g as CardLoadStatus, h as CardOrder, i as CardOrderError, j as CardOrderInput, C as CardProduct, k as CardProductPrice, l as CardStatus, m as CardStatusSource, n as CardTopUp, o as CardTopUpStatus, p as CardTransfer, q as CardType, r as Cardholder, s as CloseBlockedReason, t as CreateCardInput, u as CreateDepositRefundInput, v as CreateQuoteInput, w as CustomerInfo, D as Deposit, x as DepositMethod, y as DepositStatus, z as DepositTarget, E as FeeKind, G as FunderMode, H as FundingOption, I as FundingQuote, J as InitiateDepositInput, K as IssuanceBonus, L as IssueCardInput, M as MethodTerms, R as Refund, N as RevealCardInput, O as RevealedCard, S as SetPinInput, T as TopUpInput, P as TopUpResult, Q as TopUpTerms, U as TransferInput, V as TransferResult, W as UpdateCardInput } from './cards-BrqeBqLV.js';
|
|
7
7
|
import { BalanceResource } from './resources/balance.js';
|
|
@@ -73,7 +73,7 @@ interface BrandConfig {
|
|
|
73
73
|
* Which platform versions this SDK works with, as a semver range:
|
|
74
74
|
* comparators separated by ", ". Keep this the only definition.
|
|
75
75
|
*/
|
|
76
|
-
declare const SUPPORTED_MEISTER = ">=0.6.
|
|
76
|
+
declare const SUPPORTED_MEISTER = ">=0.6.9, <0.7.0";
|
|
77
77
|
/** What `client.ready()` returns. */
|
|
78
78
|
interface ReadyInfo {
|
|
79
79
|
/** `true` when the platform reported a version inside `supportedMeister`. */
|
|
@@ -179,7 +179,7 @@ declare function isNetworkError(e: unknown): e is NetworkError;
|
|
|
179
179
|
* `define`. `src/version.test.ts` checks it matches `package.json`, so a
|
|
180
180
|
* release bump that forgets this file fails the test run.
|
|
181
181
|
*/
|
|
182
|
-
declare const SDK_VERSION = "0.6.
|
|
182
|
+
declare const SDK_VERSION = "0.6.4";
|
|
183
183
|
|
|
184
184
|
/**
|
|
185
185
|
* `@takeal/cusfront-sdk` — typed client for the Takeal end-user API.
|
package/dist/index.js
CHANGED
|
@@ -478,6 +478,45 @@ var AuthResource = class {
|
|
|
478
478
|
await this.keep(resp);
|
|
479
479
|
return resp;
|
|
480
480
|
}
|
|
481
|
+
/** Step one of signing in without a password: a six-digit code goes to
|
|
482
|
+
* the address. It works for an address with an account and for a new one
|
|
483
|
+
* alike, and the answer doesn't say which. The code works for 10 minutes;
|
|
484
|
+
* another can be asked for after `resend_at` and replaces it.
|
|
485
|
+
* Errors: 400 `validation` (not an address), 429 `resend_too_soon` /
|
|
486
|
+
* `too_many_requests` (the message says when to try again), 503
|
|
487
|
+
* `delivery_failed`. */
|
|
488
|
+
async requestEmailCode(input) {
|
|
489
|
+
const body = { email: input.email };
|
|
490
|
+
if (input.locale !== void 0) body["locale"] = input.locale;
|
|
491
|
+
return this.http.post("/auth/email-code", { body, skipAuth: true });
|
|
492
|
+
}
|
|
493
|
+
/** Step two: the code signs in to the account with that address, or
|
|
494
|
+
* creates one (no password) when there is none; `account_created` says
|
|
495
|
+
* which. The JWT is stored. With `cardOrder`, the card is ordered for
|
|
496
|
+
* that account in the same call.
|
|
497
|
+
* Errors: 401 `invalid_code` (wrong, expired or used; after five checks a
|
|
498
|
+
* new code is needed), 400 `consents_required` for a new account, 403
|
|
499
|
+
* `user_disabled` / `second_factor_required` (operator accounts sign in
|
|
500
|
+
* with a password and their authenticator). */
|
|
501
|
+
async verifyEmailCode(input) {
|
|
502
|
+
const body = {
|
|
503
|
+
challenge_id: input.challengeId,
|
|
504
|
+
code: input.code
|
|
505
|
+
};
|
|
506
|
+
if (input.remember) body["remember_me"] = true;
|
|
507
|
+
if (input.walletCurrency !== void 0) body["wallet_currency"] = input.walletCurrency;
|
|
508
|
+
if (input.attribution !== void 0) body["attribution"] = input.attribution;
|
|
509
|
+
if (input.promoCode !== void 0) body["promo_code"] = input.promoCode;
|
|
510
|
+
if (input.consents !== void 0) body["consents"] = input.consents;
|
|
511
|
+
if (input.consentChannel !== void 0) body["consent_channel"] = input.consentChannel;
|
|
512
|
+
if (input.cardOrder !== void 0) body["card_order"] = cardOrderBody(input.cardOrder);
|
|
513
|
+
const resp = await this.http.post("/auth/email-code/verify", {
|
|
514
|
+
body,
|
|
515
|
+
skipAuth: true
|
|
516
|
+
});
|
|
517
|
+
await this.keep(resp);
|
|
518
|
+
return resp;
|
|
519
|
+
}
|
|
481
520
|
/** Finish a `totp_setup_required` login: send the first code from the
|
|
482
521
|
* authenticator app. The JWT is stored. The response carries ten
|
|
483
522
|
* one-time `backup_codes` that are never returned again, so show them to
|
|
@@ -1294,7 +1333,7 @@ var FundingOptionsResource = class {
|
|
|
1294
1333
|
};
|
|
1295
1334
|
|
|
1296
1335
|
// src/version.ts
|
|
1297
|
-
var SDK_VERSION = "0.6.
|
|
1336
|
+
var SDK_VERSION = "0.6.4";
|
|
1298
1337
|
|
|
1299
1338
|
// src/client-platform.ts
|
|
1300
1339
|
var CLIENT_HEADER = "X-Takeal-Client";
|
|
@@ -1369,7 +1408,7 @@ function isAbsolute(url) {
|
|
|
1369
1408
|
}
|
|
1370
1409
|
|
|
1371
1410
|
// src/compat.ts
|
|
1372
|
-
var SUPPORTED_MEISTER = ">=0.6.
|
|
1411
|
+
var SUPPORTED_MEISTER = ">=0.6.9, <0.7.0";
|
|
1373
1412
|
var SEMVER = /^v?(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-([0-9A-Za-z.-]+))?(?:\+[0-9A-Za-z.-]+)?$/;
|
|
1374
1413
|
function parse(v) {
|
|
1375
1414
|
const m = SEMVER.exec(v.trim());
|