@takeal/cusfront-sdk 0.8.1 → 0.8.3

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 CHANGED
@@ -6,6 +6,43 @@ adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
6
6
 
7
7
  ## [Unreleased]
8
8
 
9
+ ## [0.8.3] — 2026-11-24
10
+
11
+ ### Fixed
12
+
13
+ - The SDK reports its own version again. 0.8.2 was tagged with the version
14
+ constant still saying 0.8.1, so it was never published; 0.8.3 is the first
15
+ published build with everything listed under 0.8.2.
16
+
17
+ ## [0.8.2] — 2026-11-24
18
+
19
+ ### Added
20
+
21
+ - `auth.requestPasswordSetup()` and `auth.confirmPasswordSetup({ challengeId,
22
+ code, newPassword })`: an account that signs in with an e-mail code sets its
23
+ first password. The first call sends a six-digit code to the account's
24
+ address, the second sets the password with it. `User.has_password` says
25
+ which form to show: "set a password" or "change the password". Needs
26
+ platform 0.8.2.
27
+
28
+ ### Changed
29
+
30
+ - On platform 0.8.2 a few calls can answer in ways they did not before:
31
+ - `POST /me/cards/{id}/topup` and a card order paid from the wallet answer
32
+ 409 `payments_on_hold` while the account's payments are on hold, like new
33
+ top-ups already do;
34
+ - a transfer from an organization's card, and closing such a card with money
35
+ on it, answer 409 `organization_card`;
36
+ - a transfer between cards can return `transfer.status: "pending"` with
37
+ HTTP 200: it finishes by itself, the money on the first card is set aside
38
+ meanwhile;
39
+ - a top-up quote made without `connector_slug` and `method` is refused when
40
+ the chosen method has a price of its own. Ask for the quote with both.
41
+ `metadata.expires_at` sent with a top-up is ignored.
42
+ - The generated types follow the platform 0.8.2 contract. `Readiness` now has
43
+ the checks the platform has published since 0.8.1: `database`, `cache`,
44
+ `ledger`, `queue`.
45
+
9
46
  ## [0.8.1] — 2026-11-23
10
47
 
11
48
  ### Changed
package/README.md CHANGED
@@ -916,6 +916,31 @@ const user = await client.auth.confirmEmailChange({ challengeId: challenge_id, c
916
916
 
917
917
  `linkEmail` is only for the first address of an account made in the Mini App.
918
918
 
919
+ ### Setting or changing the password
920
+
921
+ An account made by signing in with a code from an e-mail has no password.
922
+ `user.has_password` (from `auth.me()`) says which form to show. With a
923
+ password, the user changes it with the current one. Without one, a code goes
924
+ to the account's address first, so a session left open on someone else's
925
+ device is not enough to set a password.
926
+
927
+ ```ts
928
+ const user = await client.auth.me();
929
+ if (user.has_password) {
930
+ await client.auth.changePassword({ current_password, new_password });
931
+ } else {
932
+ const { challenge_id, destination_hint } = await client.auth.requestPasswordSetup();
933
+ // "We sent a code to al***@example.com"
934
+ await client.auth.confirmPasswordSetup({ challengeId: challenge_id, code, newPassword });
935
+ }
936
+ ```
937
+
938
+ Signing in with a code keeps working after a password is set. Errors to
939
+ handle: `weak_password` (400, fix the password, the code still works),
940
+ `invalid_code` (401), `too_many_requests` (429), `email_required` (409, a
941
+ Telegram account adds an address first), `email_not_proven` (409, sign in
942
+ with a code first).
943
+
919
944
  ### Receipts
920
945
 
921
946
  Every payment gets a numbered receipt within a minute: a wallet top-up, a
package/dist/index.cjs CHANGED
@@ -808,13 +808,41 @@ var AuthResource = class {
808
808
  }
809
809
  /** Change the signed-in user's password. Every other session of the
810
810
  * account is signed out; this one stays valid.
811
- * Errors: 400 when the new password fails the policy, 401 when the
812
- * current one is wrong. */
811
+ * Errors: 400 `weak_password` when the new password fails the policy,
812
+ * 400 `no_password` when the account has none yet (use
813
+ * {@link requestPasswordSetup}), 401 when the current one is wrong. */
813
814
  async changePassword(input) {
814
815
  return this.http.post("/auth/password", {
815
816
  body: input
816
817
  });
817
818
  }
819
+ /** Step one of setting the first password of an account that has none
820
+ * (`user.has_password === false`, e.g. made by signing in with an e-mail
821
+ * code): a six-digit code goes to the account's address and works for 5
822
+ * minutes. Nothing changes yet.
823
+ * Errors: 409 `password_exists` (use {@link changePassword}),
824
+ * `email_required` (a Telegram account with no address yet: attach one
825
+ * with {@link requestEmailChange} first), `email_not_proven` (sign in
826
+ * with an e-mail code first); 429 `too_many_requests` (five codes an
827
+ * hour); 503 `delivery_failed`. Platform 0.8.2 and newer. */
828
+ async requestPasswordSetup() {
829
+ return this.http.post("/auth/password/setup", {});
830
+ }
831
+ /** Step two: the code from the e-mail and the new password set the
832
+ * account's first password. Every other session of the account is signed
833
+ * out; this one stays valid, and signing in with a code keeps working.
834
+ * Errors: 400 `weak_password` (the code is not used up, fix the password
835
+ * and send again), 401 `invalid_code` (after five wrong codes ask for a
836
+ * new one), 409 `password_exists`. */
837
+ async confirmPasswordSetup(input) {
838
+ return this.http.post("/auth/password/setup/confirm", {
839
+ body: {
840
+ challenge_id: input.challengeId,
841
+ code: input.code,
842
+ new_password: input.newPassword
843
+ }
844
+ });
845
+ }
818
846
  /** Swap the 2FA method mid-flow. Resolves to `otp_sent` for
819
847
  * telegram/email; for TOTP it short-circuits back to the challenge. */
820
848
  async switchMethod(input) {
@@ -1753,7 +1781,7 @@ var FundingOptionsResource = class {
1753
1781
  };
1754
1782
 
1755
1783
  // src/version.ts
1756
- var SDK_VERSION = "0.8.1";
1784
+ var SDK_VERSION = "0.8.3";
1757
1785
 
1758
1786
  // src/client-platform.ts
1759
1787
  var CLIENT_HEADER = "X-Takeal-Client";