ab-ecosystem-sso 0.1.17 → 0.1.18

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/README.md CHANGED
@@ -97,6 +97,41 @@ import { Signup, ForgotPassword } from "ab-ecosystem-sso";
97
97
  <ForgotPassword projectId="…" onBackToLogin={() => navigate("/login")} />
98
98
  ```
99
99
 
100
+ `Signup` loads the project's currencies from `GET /currency` and offers only those. Its country dropdown uses a bundled default list; pass **`countries`** (an array of `{ code, name }`) to replace it:
101
+
102
+ ```tsx
103
+ <Signup
104
+ projectId="…"
105
+ countries={[
106
+ { code: "US", name: "United States" },
107
+ { code: "IN", name: "India" },
108
+ ]}
109
+ onSuccess={handleAuth}
110
+ />
111
+ ```
112
+
113
+ **Password reset.** `ForgotPassword` has two steps. With no token it shows the request-a-link form (emails a reset link). When the user returns via that link, extract the token from the URL and pass it as **`resetToken`** — the component then renders the reset step (new password + confirm + captcha) and POSTs to `/auth/reset-password`:
114
+
115
+ ```tsx
116
+ // e.g. reset link is /reset-password?token=abc123
117
+ const token = new URLSearchParams(location.search).get("token") ?? undefined;
118
+
119
+ <ForgotPassword
120
+ projectId="…"
121
+ resetToken={token}
122
+ onResetSuccess={() => navigate("/login")}
123
+ onBackToLogin={() => navigate("/login")}
124
+ />
125
+ ```
126
+
127
+ The new password must be at least 8 characters and match the confirmation. On success it shows a confirmation and calls `onResetSuccess`. Extracting the token is the host's responsibility (the link format is yours to define).
128
+
129
+ | `ForgotPassword` prop | Type | Notes |
130
+ | --- | --- | --- |
131
+ | `resetToken` | `string` | Present ⇒ render the reset-password step instead of request-a-link. |
132
+ | `onResetSuccess` | `() => void` | Fires after the password is reset. |
133
+ | `onBackToLogin` | `() => void` | Back-to-login link (both steps). |
134
+
100
135
  ### `VerifyEmail`
101
136
 
102
137
  The email-verification screen for a `/verify/:token` route — the link you email to new users. It shows a captcha (site key from the project's auth-config), then posts the captcha + token to `/auth/verify-email`.
@@ -143,7 +178,7 @@ On success it calls `onVerified` (send the user to login) and shows a **Continue
143
178
  | `onError` | `(error: Error) => void` | On failure. |
144
179
  | `classNames` | `AuthClassNames` | Per-element class overrides: `card`, `input`, `label`, `button`, `link`, `captcha`, `error`, … |
145
180
 
146
- Per-screen extras: `Login` adds `onForgotPassword` / `onSignupClick`; `Signup` adds `onLoginClick`; `ForgotPassword` adds `onBackToLogin`; `VerifyEmail` adds `token` / `onVerified` / `onLoginClick` / `onSignupClick` (and has no `onSuccess`, since no session is created).
181
+ Per-screen extras: `Login` adds `onForgotPassword` / `onSignupClick`; `Signup` adds `onLoginClick` / `countries`; `ForgotPassword` adds `onBackToLogin` / `resetToken` / `onResetSuccess`; `VerifyEmail` adds `token` / `onVerified` / `onLoginClick` / `onSignupClick` (and has no `onSuccess`, since no session is created).
147
182
 
148
183
  ---
149
184
 
@@ -401,6 +436,8 @@ Beyond the components, these functions are exported for building custom UIs:
401
436
  | --- | --- |
402
437
  | `getAuthConfig(projectId, apiBaseUrl?)` | `GET /auth-config` → `AuthConfig` (captcha, branding, card layout; no token) |
403
438
  | `verifyEmailApi(projectId, { token, captchaToken }, apiBaseUrl?)` | `POST /auth/verify-email` |
439
+ | `resetPasswordApi(projectId, { token, password, captchaToken }, apiBaseUrl?)` | `POST /auth/reset-password` |
440
+ | `getCurrenciesApi(projectId, apiBaseUrl?)` | `GET /currency` → `ProjectCurrency[]` |
404
441
  | `getUser(projectId, token, apiBaseUrl?)` | `GET /me` (raw envelope) |
405
442
  | `getUserProfile(projectId, token, apiBaseUrl?)` | `GET /me` → `MappedProfile` |
406
443
  | `getUserWallet(projectId, token, apiBaseUrl?)` | `GET /me` → `UserWallets` |