@takeal/cusfront-sdk 0.8.3 → 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.
Files changed (39) hide show
  1. package/CHANGELOG.md +31 -1
  2. package/README.md +24 -7
  3. package/dist/{cards-BPu8Ill7.d.cts → cards-DwxkVJUB.d.cts} +36 -3
  4. package/dist/{cards-DP1fJc_c.d.ts → cards-VkS_2lPe.d.ts} +36 -3
  5. package/dist/index.cjs +29 -2
  6. package/dist/index.cjs.map +1 -1
  7. package/dist/index.d.cts +4 -4
  8. package/dist/index.d.ts +4 -4
  9. package/dist/index.js +29 -2
  10. package/dist/index.js.map +1 -1
  11. package/dist/react/index.d.cts +1 -1
  12. package/dist/react/index.d.ts +1 -1
  13. package/dist/resources/auth.cjs +28 -1
  14. package/dist/resources/auth.cjs.map +1 -1
  15. package/dist/resources/auth.d.cts +57 -5
  16. package/dist/resources/auth.d.ts +57 -5
  17. package/dist/resources/auth.js +28 -1
  18. package/dist/resources/auth.js.map +1 -1
  19. package/dist/resources/cards.d.cts +1 -1
  20. package/dist/resources/cards.d.ts +1 -1
  21. package/dist/resources/deposits.cjs.map +1 -1
  22. package/dist/resources/deposits.d.cts +1 -1
  23. package/dist/resources/deposits.d.ts +1 -1
  24. package/dist/resources/deposits.js.map +1 -1
  25. package/dist/resources/funding-options.d.cts +1 -1
  26. package/dist/resources/funding-options.d.ts +1 -1
  27. package/dist/resources/me.d.cts +1 -1
  28. package/dist/resources/me.d.ts +1 -1
  29. package/dist/resources/subscription.cjs.map +1 -1
  30. package/dist/resources/subscription.d.cts +4 -0
  31. package/dist/resources/subscription.d.ts +4 -0
  32. package/dist/resources/subscription.js.map +1 -1
  33. package/dist/telegram.cjs +29 -2
  34. package/dist/telegram.cjs.map +1 -1
  35. package/dist/telegram.d.cts +1 -1
  36. package/dist/telegram.d.ts +1 -1
  37. package/dist/telegram.js +29 -2
  38. package/dist/telegram.js.map +1 -1
  39. 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, ConfirmPasswordSetupInput, EmailChangeRequested, EmailCodeSent, EmailCodeSession, ExchangeTelegramInput, JwtIssued, LinkTelegramInput, LoginInput, LoginResponse, OtpSentResponse, PasswordSetupRequested, 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-BPu8Ill7.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-BPu8Ill7.cjs';
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.3";
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, ConfirmPasswordSetupInput, EmailChangeRequested, EmailCodeSent, EmailCodeSession, ExchangeTelegramInput, JwtIssued, LinkTelegramInput, LoginInput, LoginResponse, OtpSentResponse, PasswordSetupRequested, 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-DP1fJc_c.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-DP1fJc_c.js';
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.3";
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
@@ -1779,7 +1806,7 @@ var FundingOptionsResource = class {
1779
1806
  };
1780
1807
 
1781
1808
  // src/version.ts
1782
- var SDK_VERSION = "0.8.3";
1809
+ var SDK_VERSION = "0.8.4";
1783
1810
 
1784
1811
  // src/client-platform.ts
1785
1812
  var CLIENT_HEADER = "X-Takeal-Client";