@takeal/cusfront-sdk 0.8.1 → 0.8.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 +68 -1
- package/README.md +49 -7
- package/dist/{cards-BPu8Ill7.d.cts → cards-DwxkVJUB.d.cts} +36 -3
- package/dist/{cards-DP1fJc_c.d.ts → cards-VkS_2lPe.d.ts} +36 -3
- package/dist/index.cjs +59 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +4 -4
- package/dist/index.d.ts +4 -4
- package/dist/index.js +59 -4
- package/dist/index.js.map +1 -1
- package/dist/react/index.d.cts +1 -1
- package/dist/react/index.d.ts +1 -1
- package/dist/resources/auth.cjs +58 -3
- package/dist/resources/auth.cjs.map +1 -1
- package/dist/resources/auth.d.cts +102 -7
- package/dist/resources/auth.d.ts +102 -7
- package/dist/resources/auth.js +58 -3
- package/dist/resources/auth.js.map +1 -1
- package/dist/resources/cards.d.cts +1 -1
- package/dist/resources/cards.d.ts +1 -1
- 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/me.d.cts +1 -1
- package/dist/resources/me.d.ts +1 -1
- package/dist/resources/subscription.cjs.map +1 -1
- package/dist/resources/subscription.d.cts +4 -0
- package/dist/resources/subscription.d.ts +4 -0
- package/dist/resources/subscription.js.map +1 -1
- package/dist/telegram.cjs +59 -4
- package/dist/telegram.cjs.map +1 -1
- package/dist/telegram.d.cts +1 -1
- package/dist/telegram.d.ts +1 -1
- package/dist/telegram.js +59 -4
- package/dist/telegram.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { T as TokenStore, F as FetchLike } from './http-CL97TjMO.cjs';
|
|
2
2
|
export { d as defaultBrowserStore, i as inMemoryStore } from './http-CL97TjMO.cjs';
|
|
3
3
|
import { AuthResource } 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
|
-
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 CardInTransit, h as CardLoadStatus, i as CardOrder, j as CardOrderError, k as CardOrderInput, l as CardOrderQuote, m as CardOrderQuoteInput, C as CardProduct, n as CardProductPrice, o as CardStatus, p as CardStatusSource, q as CardTariff, r as CardTopUp, s as CardTopUpStatus, t as CardTransfer, u as CardType, v as Cardholder, w as CloseBlockedReason, x as CreateCardInput, y as CreateDepositRefundInput, z as CreateQuoteInput, E as CustomerInfo, D as Deposit, G as DepositMethod, H as DepositStatus, I as DepositTarget, J as FeeKind, K as FunderMode, L as FundingOption, M as FundingQuote, N as InitiateDepositInput, O as IssuanceBonus, P as IssueCardInput, Q as MethodTerms, R as PromoCodeQuote, S as PromoCodeStatus, T as Refund, U as RevealCardInput, V as RevealState, W as RevealedCard, X as SetPinInput, Y as TopUpInput, Z as TopUpResult, _ as TopUpTerms, $ as TransferInput, a0 as TransferResult, a1 as UpdateCardInput, a2 as priceChangedQuote, a3 as revealState } from './cards-
|
|
4
|
+
export { ChangePasswordInput, ConfirmPasswordSetupInput, EmailChangeRequested, EmailCodeSent, EmailCodeSession, ExchangeTelegramInput, JwtIssued, LinkTelegramInput, LoginInput, LoginResponse, OtpSentResponse, PasswordSetupRequested, RegisterInput, RequestEmailCodeInput, Session, TelegramLink, TelegramUnknown, TotpRequired, TotpSetupComplete, TotpSetupEmailErrorCode, TotpSetupEmailInput, TotpSetupEmailRequired, TotpSetupRequired, User, VerifyEmailCodeInput } from './resources/auth.cjs';
|
|
5
|
+
import { b as DepositsResource, F as FundingOptionsResource, c as CardsResource } from './cards-DwxkVJUB.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, l as CardOrderQuote, m as CardOrderQuoteInput, C as CardProduct, n as CardProductPrice, o as CardStatus, p as CardStatusSource, q as CardTariff, r as CardTopUp, s as CardTopUpStatus, t as CardTransfer, u as CardType, v as Cardholder, w as CloseBlockedReason, x as CreateCardInput, y as CreateDepositRefundInput, z as CreateQuoteInput, E as CustomerInfo, D as Deposit, G as DepositMethod, H as DepositStatus, I as DepositTarget, J as FeeKind, K as FunderMode, L as FundingOption, M as FundingQuote, N as InitiateDepositInput, O as IssuanceBonus, P as IssueCardInput, Q as MethodTerms, R as PromoCodeQuote, S as PromoCodeStatus, T as Refund, U as RevealCardInput, V as RevealState, W as RevealedCard, X as SetPinInput, Y as TopUpInput, Z as TopUpResult, _ as TopUpTerms, $ as TransferInput, a0 as TransferResult, a1 as UpdateCardInput, a2 as priceChangedQuote, a3 as revealState } from './cards-DwxkVJUB.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';
|
|
@@ -187,7 +187,7 @@ declare function isNetworkError(e: unknown): e is NetworkError;
|
|
|
187
187
|
* `define`. `src/version.test.ts` checks it matches `package.json`, so a
|
|
188
188
|
* release bump that forgets this file fails the test run.
|
|
189
189
|
*/
|
|
190
|
-
declare const SDK_VERSION = "0.8.
|
|
190
|
+
declare const SDK_VERSION = "0.8.4";
|
|
191
191
|
|
|
192
192
|
/**
|
|
193
193
|
* `@takeal/cusfront-sdk` — typed client for the Takeal end-user API.
|
package/dist/index.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { T as TokenStore, F as FetchLike } from './http-CL97TjMO.js';
|
|
2
2
|
export { d as defaultBrowserStore, i as inMemoryStore } from './http-CL97TjMO.js';
|
|
3
3
|
import { AuthResource } 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
|
-
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 CardInTransit, h as CardLoadStatus, i as CardOrder, j as CardOrderError, k as CardOrderInput, l as CardOrderQuote, m as CardOrderQuoteInput, C as CardProduct, n as CardProductPrice, o as CardStatus, p as CardStatusSource, q as CardTariff, r as CardTopUp, s as CardTopUpStatus, t as CardTransfer, u as CardType, v as Cardholder, w as CloseBlockedReason, x as CreateCardInput, y as CreateDepositRefundInput, z as CreateQuoteInput, E as CustomerInfo, D as Deposit, G as DepositMethod, H as DepositStatus, I as DepositTarget, J as FeeKind, K as FunderMode, L as FundingOption, M as FundingQuote, N as InitiateDepositInput, O as IssuanceBonus, P as IssueCardInput, Q as MethodTerms, R as PromoCodeQuote, S as PromoCodeStatus, T as Refund, U as RevealCardInput, V as RevealState, W as RevealedCard, X as SetPinInput, Y as TopUpInput, Z as TopUpResult, _ as TopUpTerms, $ as TransferInput, a0 as TransferResult, a1 as UpdateCardInput, a2 as priceChangedQuote, a3 as revealState } from './cards-
|
|
4
|
+
export { ChangePasswordInput, ConfirmPasswordSetupInput, EmailChangeRequested, EmailCodeSent, EmailCodeSession, ExchangeTelegramInput, JwtIssued, LinkTelegramInput, LoginInput, LoginResponse, OtpSentResponse, PasswordSetupRequested, RegisterInput, RequestEmailCodeInput, Session, TelegramLink, TelegramUnknown, TotpRequired, TotpSetupComplete, TotpSetupEmailErrorCode, TotpSetupEmailInput, TotpSetupEmailRequired, TotpSetupRequired, User, VerifyEmailCodeInput } from './resources/auth.js';
|
|
5
|
+
import { b as DepositsResource, F as FundingOptionsResource, c as CardsResource } from './cards-VkS_2lPe.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, l as CardOrderQuote, m as CardOrderQuoteInput, C as CardProduct, n as CardProductPrice, o as CardStatus, p as CardStatusSource, q as CardTariff, r as CardTopUp, s as CardTopUpStatus, t as CardTransfer, u as CardType, v as Cardholder, w as CloseBlockedReason, x as CreateCardInput, y as CreateDepositRefundInput, z as CreateQuoteInput, E as CustomerInfo, D as Deposit, G as DepositMethod, H as DepositStatus, I as DepositTarget, J as FeeKind, K as FunderMode, L as FundingOption, M as FundingQuote, N as InitiateDepositInput, O as IssuanceBonus, P as IssueCardInput, Q as MethodTerms, R as PromoCodeQuote, S as PromoCodeStatus, T as Refund, U as RevealCardInput, V as RevealState, W as RevealedCard, X as SetPinInput, Y as TopUpInput, Z as TopUpResult, _ as TopUpTerms, $ as TransferInput, a0 as TransferResult, a1 as UpdateCardInput, a2 as priceChangedQuote, a3 as revealState } from './cards-VkS_2lPe.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';
|
|
@@ -187,7 +187,7 @@ declare function isNetworkError(e: unknown): e is NetworkError;
|
|
|
187
187
|
* `define`. `src/version.test.ts` checks it matches `package.json`, so a
|
|
188
188
|
* release bump that forgets this file fails the test run.
|
|
189
189
|
*/
|
|
190
|
-
declare const SDK_VERSION = "0.8.
|
|
190
|
+
declare const SDK_VERSION = "0.8.4";
|
|
191
191
|
|
|
192
192
|
/**
|
|
193
193
|
* `@takeal/cusfront-sdk` — typed client for the Takeal end-user API.
|
package/dist/index.js
CHANGED
|
@@ -714,12 +714,17 @@ var AuthResource = class {
|
|
|
714
714
|
return resp;
|
|
715
715
|
}
|
|
716
716
|
/** Verify a TOTP code (or XXXX-XXXX backup code) against a
|
|
717
|
-
* `totp_required` challenge. On success the JWT is stored.
|
|
717
|
+
* `totp_required` challenge. On success the JWT is stored. A backup code
|
|
718
|
+
* signs nobody in: it is used up and the answer is
|
|
719
|
+
* `totp_setup_email_required`, the start of connecting a new
|
|
720
|
+
* authenticator ({@link confirmTotpSetupEmail}). Nothing is stored then.
|
|
721
|
+
* Errors after a backup code: see {@link TotpSetupEmailErrorCode}. */
|
|
718
722
|
async verifyTotp(input) {
|
|
719
723
|
const resp = await this.http.post("/auth/login/totp", {
|
|
720
724
|
body: withRemember(input),
|
|
721
725
|
skipAuth: true
|
|
722
726
|
});
|
|
727
|
+
if (resp.stage === "totp_setup_email_required") return resp;
|
|
723
728
|
await this.keep(resp);
|
|
724
729
|
return resp;
|
|
725
730
|
}
|
|
@@ -792,6 +797,28 @@ var AuthResource = class {
|
|
|
792
797
|
await this.keep(resp);
|
|
793
798
|
return resp;
|
|
794
799
|
}
|
|
800
|
+
/** Send the code from the e-mail of a `totp_setup_email_required`
|
|
801
|
+
* answer. A right code answers `totp_setup_required`: show its
|
|
802
|
+
* `otpauth_url` as a QR, then finish with {@link completeTotpSetup}.
|
|
803
|
+
* Each code works for 5 minutes and takes five tries; only the newest
|
|
804
|
+
* one works. Nothing is stored. Errors: {@link TotpSetupEmailErrorCode}. */
|
|
805
|
+
async confirmTotpSetupEmail(input) {
|
|
806
|
+
return this.http.post("/auth/login/totp-setup/email", {
|
|
807
|
+
body: { challenge_token: input.challenge_token, code: input.code },
|
|
808
|
+
skipAuth: true
|
|
809
|
+
});
|
|
810
|
+
}
|
|
811
|
+
/** A new e-mail code for the same `totp_setup_email_required` sign-in;
|
|
812
|
+
* the one before it stops working. Use the `challenge_token` of the
|
|
813
|
+
* answer from now on. Five codes an hour at most.
|
|
814
|
+
* Errors: {@link TotpSetupEmailErrorCode}; 401 means the sign-in is over,
|
|
815
|
+
* so start again with {@link login}. */
|
|
816
|
+
async resendTotpSetupEmail(input) {
|
|
817
|
+
return this.http.post("/auth/login/totp-setup/email/resend", {
|
|
818
|
+
body: { challenge_token: input.challenge_token },
|
|
819
|
+
skipAuth: true
|
|
820
|
+
});
|
|
821
|
+
}
|
|
795
822
|
/** Finish a `totp_setup_required` login: send the first code from the
|
|
796
823
|
* authenticator app. The JWT is stored. The response carries ten
|
|
797
824
|
* one-time `backup_codes` that are never returned again, so show them to
|
|
@@ -806,13 +833,41 @@ var AuthResource = class {
|
|
|
806
833
|
}
|
|
807
834
|
/** Change the signed-in user's password. Every other session of the
|
|
808
835
|
* account is signed out; this one stays valid.
|
|
809
|
-
* Errors: 400 when the new password fails the policy,
|
|
810
|
-
*
|
|
836
|
+
* Errors: 400 `weak_password` when the new password fails the policy,
|
|
837
|
+
* 400 `no_password` when the account has none yet (use
|
|
838
|
+
* {@link requestPasswordSetup}), 401 when the current one is wrong. */
|
|
811
839
|
async changePassword(input) {
|
|
812
840
|
return this.http.post("/auth/password", {
|
|
813
841
|
body: input
|
|
814
842
|
});
|
|
815
843
|
}
|
|
844
|
+
/** Step one of setting the first password of an account that has none
|
|
845
|
+
* (`user.has_password === false`, e.g. made by signing in with an e-mail
|
|
846
|
+
* code): a six-digit code goes to the account's address and works for 5
|
|
847
|
+
* minutes. Nothing changes yet.
|
|
848
|
+
* Errors: 409 `password_exists` (use {@link changePassword}),
|
|
849
|
+
* `email_required` (a Telegram account with no address yet: attach one
|
|
850
|
+
* with {@link requestEmailChange} first), `email_not_proven` (sign in
|
|
851
|
+
* with an e-mail code first); 429 `too_many_requests` (five codes an
|
|
852
|
+
* hour); 503 `delivery_failed`. Platform 0.8.2 and newer. */
|
|
853
|
+
async requestPasswordSetup() {
|
|
854
|
+
return this.http.post("/auth/password/setup", {});
|
|
855
|
+
}
|
|
856
|
+
/** Step two: the code from the e-mail and the new password set the
|
|
857
|
+
* account's first password. Every other session of the account is signed
|
|
858
|
+
* out; this one stays valid, and signing in with a code keeps working.
|
|
859
|
+
* Errors: 400 `weak_password` (the code is not used up, fix the password
|
|
860
|
+
* and send again), 401 `invalid_code` (after five wrong codes ask for a
|
|
861
|
+
* new one), 409 `password_exists`. */
|
|
862
|
+
async confirmPasswordSetup(input) {
|
|
863
|
+
return this.http.post("/auth/password/setup/confirm", {
|
|
864
|
+
body: {
|
|
865
|
+
challenge_id: input.challengeId,
|
|
866
|
+
code: input.code,
|
|
867
|
+
new_password: input.newPassword
|
|
868
|
+
}
|
|
869
|
+
});
|
|
870
|
+
}
|
|
816
871
|
/** Swap the 2FA method mid-flow. Resolves to `otp_sent` for
|
|
817
872
|
* telegram/email; for TOTP it short-circuits back to the challenge. */
|
|
818
873
|
async switchMethod(input) {
|
|
@@ -1751,7 +1806,7 @@ var FundingOptionsResource = class {
|
|
|
1751
1806
|
};
|
|
1752
1807
|
|
|
1753
1808
|
// src/version.ts
|
|
1754
|
-
var SDK_VERSION = "0.8.
|
|
1809
|
+
var SDK_VERSION = "0.8.4";
|
|
1755
1810
|
|
|
1756
1811
|
// src/client-platform.ts
|
|
1757
1812
|
var CLIENT_HEADER = "X-Takeal-Client";
|