@atlasauth/react 0.4.1 → 0.6.0
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 +217 -0
- package/dist/AtlasProvider.d.ts +48 -7
- package/dist/AtlasProvider.js +158 -24
- package/dist/AtlasProvider.js.map +1 -1
- package/dist/api-keys.d.ts +63 -0
- package/dist/api-keys.js +227 -0
- package/dist/api-keys.js.map +1 -0
- package/dist/appearance.d.ts +27 -0
- package/dist/appearance.js +58 -1
- package/dist/appearance.js.map +1 -1
- package/dist/captcha.d.ts +43 -0
- package/dist/captcha.js +109 -0
- package/dist/captcha.js.map +1 -0
- package/dist/components.d.ts +2 -0
- package/dist/components.js +4 -1
- package/dist/components.js.map +1 -1
- package/dist/contrast.d.ts +24 -0
- package/dist/contrast.js +76 -0
- package/dist/contrast.js.map +1 -0
- package/dist/flow.d.ts +17 -2
- package/dist/flow.js +88 -9
- package/dist/flow.js.map +1 -1
- package/dist/hooks.d.ts +7 -2
- package/dist/hooks.js.map +1 -1
- package/dist/i18n.js +44 -0
- package/dist/i18n.js.map +1 -1
- package/dist/index.d.ts +6 -0
- package/dist/index.js +12 -1
- package/dist/index.js.map +1 -1
- package/dist/instance-settings.d.ts +7 -0
- package/dist/instance-settings.js +12 -0
- package/dist/instance-settings.js.map +1 -0
- package/dist/sign-in.d.ts +2 -0
- package/dist/sign-in.js +8 -3
- package/dist/sign-in.js.map +1 -1
- package/dist/sign-up.d.ts +13 -0
- package/dist/sign-up.js +120 -2
- package/dist/sign-up.js.map +1 -1
- package/dist/styles.d.ts +14 -2
- package/dist/styles.js +30 -13
- package/dist/styles.js.map +1 -1
- package/package.json +4 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,104 @@
|
|
|
1
1
|
# @atlasauth/react changelog
|
|
2
2
|
|
|
3
|
+
## 0.6.0
|
|
4
|
+
- **Popup sign-in works when your page sends `Cross-Origin-Opener-Policy: same-origin`.** `<AtlasProvider>`
|
|
5
|
+
now finishes a popup that was severed from its opener: when the popup lands back on your page with
|
|
6
|
+
`#atlas_popup_result=…`, the provider relays the result to the opener (which completes the sign-in) and
|
|
7
|
+
closes the popup; if no opener takes it (its tab was closed), it completes the sign-in in that window like a
|
|
8
|
+
redirect. The fragment is removed from the URL first. Social buttons in popup mode keep waiting (up to
|
|
9
|
+
5 minutes) for a severed popup instead of treating it as cancelled.
|
|
10
|
+
- **A sign-in completed inside the Atlas popup closes the popup** once it has told the waiting opener.
|
|
11
|
+
- **Changed `startOauth({ mode: 'popup' })`** (from `useSignIn()`): accepts `signal?: AbortSignal` and
|
|
12
|
+
re-boots signed-in when the popup finished the sign-in itself (`sessionDetected`).
|
|
13
|
+
- **A tab opened after a failed sign-out stays signed out.** Sign-out tombstones are now kept in
|
|
14
|
+
`localStorage` per Frontend API (shared by all tabs, 30 days, at most 20) instead of per-tab
|
|
15
|
+
`sessionStorage`. A later successful background revoke clears the tombstone, and a new sign-in (new
|
|
16
|
+
session id) is adopted normally. A tombstone another tab adds for the current session drops this tab's
|
|
17
|
+
token.
|
|
18
|
+
- **The default focus ring has at least 3:1 contrast against `colorBackground`.** `colorFocusRing` used to
|
|
19
|
+
default to `colorPrimary` unchecked (mint `#22f79a` on white is ~1.4:1). It is now the primary when that
|
|
20
|
+
clears 3:1, otherwise the primary's hue darkened (light backgrounds) or lightened (dark backgrounds) until
|
|
21
|
+
it does. An explicit `colorFocusRing` still wins. With a design active, the focus outline uses the design's
|
|
22
|
+
new `--atlas-focus-outline-color` (same rule).
|
|
23
|
+
|
|
24
|
+
## 0.5.0
|
|
25
|
+
- **`<SignUp>` now creates accounts.** Its first step is a create-account form (the instance's
|
|
26
|
+
configured sign-up fields, email, password and the legal-consent row) that posts
|
|
27
|
+
`POST /v1/client/sign_ups`; the emailed-code step and completion then run through the shared flow.
|
|
28
|
+
Previously `<SignUp>` rendered the sign-in identifier step and could not create an account.
|
|
29
|
+
- **Captcha renders automatically.** When the instance turns captcha on for a flow, `<SignUp>` and
|
|
30
|
+
`<SignIn>` show the provider's widget (Turnstile, hCaptcha, reCAPTCHA v2/v3/Enterprise) in the
|
|
31
|
+
configured mode (`visible`, `managed`, or `invisible` — run on submit), send its token as
|
|
32
|
+
`captcha_token`, answer the sign-in `needs_captcha` step (continuing as soon as it is solved), and on
|
|
33
|
+
`CAPTCHA_REQUIRED` / `CAPTCHA_FAILED` show a localized message and a fresh widget.
|
|
34
|
+
- **Added** `useAtlas().instanceSettings: InstanceSettings | null` — the instance's public
|
|
35
|
+
`captchaFlows`, `signUpFields` and `legal` settings from `GET /v1/appearance`. The provider now
|
|
36
|
+
fetches `/v1/appearance` even with `appearance.instanceDesign: false` (the design is still not
|
|
37
|
+
applied then).
|
|
38
|
+
- **Added types** `InstanceSettings`, `PublicSignUpField`, and re-exported `FlowCaptcha`,
|
|
39
|
+
`CaptchaFlowKey`, `CaptchaWidgetMode` from `@atlasauth/js`.
|
|
40
|
+
- **Added catalog keys** (en-US): `signUp.emailLabel`, `signUp.passwordLabel`, `signUp.optionalField`,
|
|
41
|
+
`signUp.selectPlaceholder`, `signUp.consentAgree`, `signUp.consentNotice`, `signUp.terms`,
|
|
42
|
+
`signUp.privacy`, `signUp.and`, `captcha.prompt`, `captcha.required`, `captcha.failed`.
|
|
43
|
+
- `InstanceSettings`, `PublicSignUpField` and `localizeCaptchaErrors` now come from `@atlasauth/js`
|
|
44
|
+
(same shapes; one implementation shared with the other framework SDKs).
|
|
45
|
+
- **Added base classes** `atlas-captcha`, `atlas-consent`, `atlas-choices`, `atlas-choice` (new `ATLAS_FLOW_CSS` export, appended to `ATLAS_STYLES_CSS`; `ATLAS_BASE_CSS` is unchanged). The flow's inputs now carry `name` attributes.
|
|
46
|
+
- **Added base classes** `atlas-captcha`, `atlas-consent`, `atlas-choices`, `atlas-choice` (new `ATLAS_FLOW_CSS` export, appended to `ATLAS_STYLES_CSS`). The flow's inputs now carry `name` attributes.
|
|
47
|
+
- **`frontendApi` is validated at render.** A missing (`undefined`/`null`), non-string, blank or malformed value now
|
|
48
|
+
throws an **`AtlasConfigError`** (exported; `code: 'FRONTEND_API_REQUIRED' | 'FRONTEND_API_INVALID'`, type
|
|
49
|
+
`AtlasConfigErrorCode`) instead of silently sending every request to relative URLs on the app's own
|
|
50
|
+
origin. Accepted: an absolute `https:` URL (`http:` only for localhost / local development hosts), or
|
|
51
|
+
`"same-origin"` (exported as `SAME_ORIGIN_FRONTEND_API`) / a root-relative path such as `"/atlas"` for a
|
|
52
|
+
reverse proxy.
|
|
53
|
+
- **Deprecated:** `frontendApi=""` (the original same-origin spelling) still works as same-origin, with a one-time
|
|
54
|
+
console warning; use `"same-origin"` instead.
|
|
55
|
+
- **`signOut()` now resolves `SignOutResult`** — `{ revoked: boolean; activeSessionId?: string }` (was
|
|
56
|
+
`Promise<void>`; `await signOut()` keeps working). Changed on both `useAtlas()` and `useAuth()`
|
|
57
|
+
(`UseAuthReturn.signOut`).
|
|
58
|
+
- The revoke is retried once. If it still fails, the user is signed out locally anyway and the session id
|
|
59
|
+
is remembered (this tab + sibling tabs via the session broadcast), so focus, a sibling tab's signal or a
|
|
60
|
+
failed token refresh never re-adopt it from the still-valid refresh cookie; the next re-check retries the
|
|
61
|
+
revoke in the background.
|
|
62
|
+
- The revoke runs even when no token is cached (it falls back to the booted session, or asks the Frontend
|
|
63
|
+
API which session the browser's cookies carry).
|
|
64
|
+
- When the server promotes another account signed in on this browser, the provider adopts it and
|
|
65
|
+
`activeSessionId` names it.
|
|
66
|
+
- **New option `signOut({ strict: true })`** rejects with a **`SignOutError`** (exported;
|
|
67
|
+
`code: 'SIGN_OUT_REVOKE_FAILED'`, `sessionId`, `status`) after the local sign-out when the revoke fails.
|
|
68
|
+
- `sessions` is now cleared on sign-out too.
|
|
69
|
+
- **New `locale` prop on `<AtlasProvider>`** (`SupportedLocale | string`): `'en'`, `'en-US'`, `'es'`, `'es-ES'`,
|
|
70
|
+
`'fr'`, `'fr-FR'`, `'de'`, `'de-DE'`, `'pt'`, `'pt-BR'`, `'ja'`, `'ja-JP'`, `'nl'`, `'nl-NL'`, and regional
|
|
71
|
+
variants that fall back to their language. Unknown → English with a console warning. `localization` still
|
|
72
|
+
overrides key by key on top. Re-exported from `@atlasauth/localizations`: `resolveLocale`,
|
|
73
|
+
`LOCALIZATION_KEYS`, `missingKeys`, type `SupportedLocale`. New dependency: `@atlasauth/localizations`
|
|
74
|
+
(bundled statically: the catalogs are small, and a synchronous lookup means no English flash and identical
|
|
75
|
+
SSR output).
|
|
76
|
+
- **New context method `broadcastSessionChange()`** on `useAtlas()`: tells sibling tabs to re-check. The
|
|
77
|
+
built-in flows call it after completing a sign-in, so other tabs update immediately instead of on focus.
|
|
78
|
+
- **Popup OAuth:** a popup that closes without posting back but left a session behind (the browser severed
|
|
79
|
+
`window.opener`) now completes the sign-in in the opener (re-boot, `afterUrl`, sibling tabs) instead of
|
|
80
|
+
being treated as a cancel.
|
|
81
|
+
- **Accessibility / appearance:**
|
|
82
|
+
- New `appearance.variables.colorTextOnPrimary` (→ `--atlas-color-text-on-primary`): primary button and avatar
|
|
83
|
+
text. Defaults to white or near-black, whichever contrasts more with the resolved `colorPrimary` (was a
|
|
84
|
+
fixed `#fff`). The `dark` and `neobrutalist` themes now get dark button text.
|
|
85
|
+
- New `appearance.variables.colorFocusRing` (→ `--atlas-color-focus-ring`): a solid 2px `:focus-visible`
|
|
86
|
+
outline (2px offset) on inputs, buttons, social buttons, menu items, tabs and the avatar, replacing the
|
|
87
|
+
translucent glow. Defaults to the primary (`neobrutalist`: black).
|
|
88
|
+
- With a design active, explicit `colorTextOnPrimary` / `colorFocusRing` still win over the design's ink
|
|
89
|
+
and ring; design-mode focus is a solid outline too.
|
|
90
|
+
- Inputs are at least 16px (base and design mode), so iOS Safari no longer zooms on focus.
|
|
91
|
+
- `DesignTokens`, `DEFAULT_TOKENS` and `THEMES` gain both keys. The base stylesheet (`ATLAS_BASE_CSS`)
|
|
92
|
+
changed deliberately for these fixes.
|
|
93
|
+
- **`<ApiKeys/>` and `useApiKeys()`.** Let signed-in users manage their own API keys: list, create
|
|
94
|
+
(prompts for the password and retries when the server asks for a recent sign-in), show the new
|
|
95
|
+
secret once with a copy button, rename, and revoke after a confirmation. Props: `organizationId`,
|
|
96
|
+
`renderClaimsFields` (alias `claimsForm`) for extra fields that go into the key's `claims`,
|
|
97
|
+
`onCreate`, and `expiryOptionsDays`. Shows a key's `limits` when present.
|
|
98
|
+
- New exported types: `ApiKeysProps`, `ApiKeysStatus`, `ApiKeyClaimsFieldsContext`,
|
|
99
|
+
`UseApiKeysResult`, and re-exports of `UserApiKey`, `CreatedUserApiKey`, `CreateUserApiKeyInput`.
|
|
100
|
+
- New en-US catalog keys under `apiKeys.*` (32 keys).
|
|
101
|
+
|
|
3
102
|
## 0.4.1
|
|
4
103
|
- **Front-channel logout on sign-out.** `signOut()` now loads the `frontchannel_logout_urls` the
|
|
5
104
|
Frontend API returns (apps signed in with "Sign in with Atlas" through this session) in hidden,
|
|
@@ -33,6 +132,16 @@
|
|
|
33
132
|
- `useAuth()` has an exported return type, `UseAuthReturn`; annotate with it and TypeScript
|
|
34
133
|
rejects fields that don't exist.
|
|
35
134
|
|
|
135
|
+
## 0.3.0
|
|
136
|
+
- **Popup sign-in for "Sign in with Atlas".** New `signInWithAtlasPopup(opts)` signs in from a
|
|
137
|
+
popup with no full-page redirect and no callback page; the code is exchanged in the page with
|
|
138
|
+
PKCE. It rejects with `popup_closed` if the user closes the popup, and falls back to the
|
|
139
|
+
redirect flow when the popup is blocked.
|
|
140
|
+
- `<SignInWithAtlasButton>` accepts `uxMode: 'redirect' | 'popup'` (default `'redirect'`) and
|
|
141
|
+
`onSuccess(result)` for popup mode.
|
|
142
|
+
- The sign-in result (`AtlasIdResult`) now also includes `credential` (the id_token).
|
|
143
|
+
- Changed: the default issuer is `https://atlasauth.net`.
|
|
144
|
+
|
|
36
145
|
## 0.2.0
|
|
37
146
|
- **New: `<SignInWithAtlasButton>` + `completeSignInWithAtlas()`** — "Sign in with Atlas" for any
|
|
38
147
|
website via OIDC authorization-code + PKCE against `https://atlasauth.net`. Standalone: no
|
|
@@ -60,6 +169,9 @@
|
|
|
60
169
|
but never read; it now redirects after the session is established. No-op when unset.
|
|
61
170
|
- **Provider icons render at a real size** (D12). Brand marks (GitHub especially) carried only a
|
|
62
171
|
`viewBox` and collapsed to 0×0 in the SDK; they now have an intrinsic size plus a CSS rule.
|
|
172
|
+
- **`frontendApi` is now a REQUIRED prop on `<AtlasProvider>`**. It was silently
|
|
173
|
+
- **`<SignIn afterUrl>` / `<SignUp afterUrl>` now navigate** on completion. It was typed
|
|
174
|
+
- **Provider icons render at a real size**. Brand marks (GitHub especially) carried only a
|
|
63
175
|
|
|
64
176
|
## 0.1.29
|
|
65
177
|
- **Fix — the invisible Google overlay is no longer rendered at exactly `opacity:0`.** GSI's
|
|
@@ -124,6 +236,35 @@
|
|
|
124
236
|
Redirect for Google requires a `client_secret` to be configured on the provider.
|
|
125
237
|
- **Add `hideTitle` prop** to `<SignIn>` / `<SignUp>`. Set it when your page already renders its own "Sign in" heading above the panel, so the title doesn't appear twice.
|
|
126
238
|
|
|
239
|
+
## 0.1.23
|
|
240
|
+
- The headless `<SocialSignInButton provider="google">` (and `useSignIn()`) now use the same
|
|
241
|
+
in-page Google button as the built-in `<SignIn>`, so Google sign-in completes without a
|
|
242
|
+
redirect or a stranded tab. Other providers keep the popup / redirect flow.
|
|
243
|
+
|
|
244
|
+
## 0.1.22
|
|
245
|
+
- Social buttons in `<SignIn>` now show a provider icon: the built-in brand mark, or a custom
|
|
246
|
+
icon URL configured for the provider in the dashboard.
|
|
247
|
+
|
|
248
|
+
## 0.1.21
|
|
249
|
+
- Added: `onSignedIn(user)` prop on `<AtlasProvider>`. Fires once on a real signed-out →
|
|
250
|
+
signed-in transition (including after a popup sign-in), never when a session is restored on
|
|
251
|
+
page load.
|
|
252
|
+
|
|
253
|
+
## 0.1.20
|
|
254
|
+
- Social buttons in `<SignIn>` now use the per-instance button label configured in the
|
|
255
|
+
dashboard when one is set, instead of always "Continue with {provider}".
|
|
256
|
+
|
|
257
|
+
## 0.1.19
|
|
258
|
+
- Added: popup-mode social / OIDC sign-in. Set `oauthMode: 'popup' | 'redirect'` on
|
|
259
|
+
`<AtlasProvider>` as the app default or on `<SignIn>` to override; the default stays
|
|
260
|
+
`'redirect'`. A blocked popup falls back to redirect.
|
|
261
|
+
- Added: `useSignIn().startOauth({ provider, mode })` and a headless `<SocialSignInButton>`
|
|
262
|
+
with `onOpen`, `onError` and `onBlockedFallback` callbacks.
|
|
263
|
+
|
|
264
|
+
## 0.1.18
|
|
265
|
+
- Added: `hideTitle` prop on `<SignIn>` / `<SignUp>` to hide the panel's own heading when the
|
|
266
|
+
page already shows one.
|
|
267
|
+
|
|
127
268
|
## 0.1.17
|
|
128
269
|
- **Fix — SSR-safe base styles.** The base stylesheet is now rendered as a `<style id="atlas-base-styles">` in `AtlasProvider`'s own output, so prebuilt components are styled in server-rendered HTML **and** on the client (no flash of unstyled content on SSR/Next.js). `ATLAS_BASE_CSS` and `injectAtlasStyles` are exported for manual/advanced use.
|
|
129
270
|
- **Use `>= 0.1.17`** if you rely on the prebuilt components styling themselves. 0.1.15/0.1.16 did not ship usable CSS (see below).
|
|
@@ -137,3 +278,79 @@
|
|
|
137
278
|
---
|
|
138
279
|
|
|
139
280
|
Components are styled out of the box from 0.1.17 with no CSS import — see the guide: https://atlasauth.net/docs/react-appearance-and-styling
|
|
281
|
+
## 0.1.14
|
|
282
|
+
- Added: billing hooks `useBilling()`, `useCheckout()` and `useSubscription()` (user- or
|
|
283
|
+
organization-scoped via `{ orgId }`) and a `<PricingTable>` component; checkout and the billing
|
|
284
|
+
portal open on Stripe-hosted pages. New `CheckoutParams`, `AtlasBillingPlan` and
|
|
285
|
+
`AtlasBillingSubscription` types.
|
|
286
|
+
|
|
287
|
+
## 0.1.13
|
|
288
|
+
- Added: multiple signed-in accounts per browser. `useSessionList()` lists them and
|
|
289
|
+
`setActive({ session })` switches; `<UserButton>` lists other accounts for one-click
|
|
290
|
+
switching; `<MultisessionAppSupport>` remounts its children on a switch. New
|
|
291
|
+
`AtlasSessionResource` type.
|
|
292
|
+
- Added: extension points for prebuilt components — `<UserButton.MenuItems>` with
|
|
293
|
+
`<UserButton.Action>` / `<UserButton.Link>`, and `<UserProfile.Page>` / `<UserProfile.Link>`.
|
|
294
|
+
|
|
295
|
+
## 0.1.12
|
|
296
|
+
- Added: `useOrganizationList()`, `<CreateOrganization>` and `<OrganizationList>`.
|
|
297
|
+
- Added: `<Waitlist>` and `useWaitlist()`.
|
|
298
|
+
- Added: `useReverification()` — headless wrapper for step-up re-authentication.
|
|
299
|
+
|
|
300
|
+
## 0.1.11
|
|
301
|
+
- Added: `<SignInButton>`, `<SignUpButton>` and `<SignOutButton>` (new `AuthButtonProps` type),
|
|
302
|
+
`<RedirectToSignIn>` / `<RedirectToSignUp>`, `<UserAvatar>`, and the headless `useSignUp()`.
|
|
303
|
+
|
|
304
|
+
## 0.1.10
|
|
305
|
+
- Fixed: republished with resolved dependency versions; 0.1.9 was published with unresolved
|
|
306
|
+
workspace dependencies and could not be installed (deprecated on npm).
|
|
307
|
+
|
|
308
|
+
## 0.1.9
|
|
309
|
+
- Added: `<ManagePasskeys>` — list, add and remove passkeys; included in `<UserProfile>`. Shows a
|
|
310
|
+
"not supported" note when the browser has no WebAuthn.
|
|
311
|
+
|
|
312
|
+
## 0.1.8
|
|
313
|
+
- Added: `<ManageMfa>` — enrol an authenticator app (TOTP), verify, show backup codes and turn
|
|
314
|
+
2FA off; included in `<UserProfile>`.
|
|
315
|
+
|
|
316
|
+
## 0.1.7
|
|
317
|
+
- Added: `<ProfileCard>` (editable name, email addresses) and `<ActiveSessions>` (devices with
|
|
318
|
+
per-device sign-out and "sign out of all other devices"). `<UserProfile>` now composes them.
|
|
319
|
+
|
|
320
|
+
## 0.1.6
|
|
321
|
+
- `<SignIn>` now shows a button for every enabled social provider: Google in-page, the others
|
|
322
|
+
via redirect back to the current page.
|
|
323
|
+
|
|
324
|
+
## 0.1.5
|
|
325
|
+
- Sign-in, sign-out and organization switches now propagate to other open tabs, and a tab
|
|
326
|
+
re-checks the session on focus, so a tab that started a sign-in elsewhere updates itself.
|
|
327
|
+
|
|
328
|
+
## 0.1.4
|
|
329
|
+
- The Google button in `<SignIn>` now has default styling from the `--atlas-*` appearance
|
|
330
|
+
variables, so it looks like a button without any custom CSS.
|
|
331
|
+
|
|
332
|
+
## 0.1.3
|
|
333
|
+
- Changed: the Google button in `<SignIn>` is now your themed button (the `socialButton`
|
|
334
|
+
appearance element) with Google's real button overlaid invisibly, instead of Google's own
|
|
335
|
+
fixed-style button.
|
|
336
|
+
|
|
337
|
+
## 0.1.2
|
|
338
|
+
- Added: `<SignIn>` shows a native in-page Google button when the Google connection is enabled
|
|
339
|
+
with a client id; One Tap is opt-in via `googleOneTap`.
|
|
340
|
+
- Added: headless `useSignIn()` for apps that render their own Google button.
|
|
341
|
+
|
|
342
|
+
## 0.1.1
|
|
343
|
+
- First published release.
|
|
344
|
+
- `<AtlasProvider>` with `useAtlas()`, `useAuth()`, `useUser()`, `useSession()`,
|
|
345
|
+
`useOrganization()`.
|
|
346
|
+
- Components: `<SignIn>`, `<SignUp>`, `<UserButton>`, `<UserProfile>`,
|
|
347
|
+
`<OrganizationSwitcher>`, `<OrganizationProfile>`, `<SignedIn>`, `<SignedOut>`, `<Protect>`,
|
|
348
|
+
`<AtlasLoading>`, `<AtlasLoaded>`.
|
|
349
|
+
- Theming via `appearance` (design tokens, themes, per-element classes) and i18n.
|
|
350
|
+
- Silent cross-site session check: `useSilentAuth()`, plus `checkSession` /
|
|
351
|
+
`handleSilentCallback` re-exported from `@atlasauth/js`.
|
|
352
|
+
|
|
353
|
+
---
|
|
354
|
+
|
|
355
|
+
Components are styled out of the box from 0.1.17 with no CSS import — see the guide: https://atlasauth.net/docs/react-appearance-and-styling
|
|
356
|
+
|
package/dist/AtlasProvider.d.ts
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { type ReactNode } from 'react';
|
|
2
|
-
import { type ProviderToken, type SignOutOptions } from '@atlasauth/js';
|
|
2
|
+
import { type ProviderToken, type SignOutOptions, type SignOutResult } from '@atlasauth/js';
|
|
3
|
+
import { type SupportedLocale } from '@atlasauth/localizations';
|
|
3
4
|
import { type Appearance } from './appearance';
|
|
4
5
|
import { type Catalog } from './i18n';
|
|
6
|
+
import { type InstanceSettings } from './instance-settings';
|
|
5
7
|
import type { AtlasOrganizationMembership, AtlasSession, AtlasSessionResource, AtlasUser, SessionClaims } from './types';
|
|
6
8
|
/**
|
|
7
9
|
* §10.1 `<AtlasProvider publishableKey>`.
|
|
@@ -27,6 +29,13 @@ interface AtlasContextValue {
|
|
|
27
29
|
claims: SessionClaims | null;
|
|
28
30
|
memberships: AtlasOrganizationMembership[];
|
|
29
31
|
appearance?: Appearance;
|
|
32
|
+
/**
|
|
33
|
+
* The instance's public sign-in / sign-up settings (per-flow captcha, sign-up
|
|
34
|
+
* fields, legal consent) from `GET /v1/appearance`. Null until loaded, or when
|
|
35
|
+
* the server could not be reached — the components then fall back to their
|
|
36
|
+
* defaults and the server still enforces every gate.
|
|
37
|
+
*/
|
|
38
|
+
instanceSettings: InstanceSettings | null;
|
|
30
39
|
/** §oauth popup mode — app-wide default for social/OIDC sign-in (see AtlasProviderProps). */
|
|
31
40
|
oauthMode?: 'popup' | 'redirect';
|
|
32
41
|
catalog: Catalog;
|
|
@@ -48,7 +57,24 @@ interface AtlasContextValue {
|
|
|
48
57
|
* server refreshes a stale token on read; the refresh token is never exposed.
|
|
49
58
|
*/
|
|
50
59
|
getProviderToken(provider: string): Promise<ProviderToken | null>;
|
|
51
|
-
|
|
60
|
+
/**
|
|
61
|
+
* Sign out of the active session: revoke it on the Frontend API (retried
|
|
62
|
+
* once), run front-channel logout, drop local state and sign sibling tabs out.
|
|
63
|
+
*
|
|
64
|
+
* Resolves `{ revoked, activeSessionId? }`. `revoked: false` means the server
|
|
65
|
+
* could not confirm the revoke; the user is still signed out locally and this
|
|
66
|
+
* browser never re-adopts that session. `activeSessionId` is set when another
|
|
67
|
+
* account signed in on this browser was promoted (multi-session) — the
|
|
68
|
+
* provider adopts it. With `{ strict: true }` a failed revoke rejects with a
|
|
69
|
+
* `SignOutError` (after the local sign-out).
|
|
70
|
+
*/
|
|
71
|
+
signOut(options?: SignOutOptions): Promise<SignOutResult>;
|
|
72
|
+
/**
|
|
73
|
+
* Tell other tabs of this app that auth changed here, so they re-check.
|
|
74
|
+
* `reload()` deliberately does not do this (a received signal must not loop);
|
|
75
|
+
* call it after completing a sign-in yourself.
|
|
76
|
+
*/
|
|
77
|
+
broadcastSessionChange(): void;
|
|
52
78
|
setActiveOrganization(organizationId: string | null): Promise<void>;
|
|
53
79
|
/**
|
|
54
80
|
* §L1 switch which signed-in account is active on this browser (Clerk
|
|
@@ -74,15 +100,30 @@ export interface AtlasProviderProps {
|
|
|
74
100
|
* - on the hosted fleet, before you verify a custom domain, the shared host
|
|
75
101
|
* `https://atlasauth.net` (FAPI resolves the instance from the key);
|
|
76
102
|
* - once a custom domain is verified, that host, e.g. `https://auth.acme.com`;
|
|
77
|
-
* - `""`
|
|
78
|
-
* your own origin (requests then go to
|
|
103
|
+
* - `"same-origin"` (or a path such as `"/atlas"`) for a reverse-proxy setup
|
|
104
|
+
* where you serve FAPI under your own origin (requests then go to
|
|
105
|
+
* relative paths).
|
|
79
106
|
*
|
|
80
|
-
*
|
|
81
|
-
*
|
|
82
|
-
*
|
|
107
|
+
* `""` is the deprecated same-origin spelling: it still works, with a
|
|
108
|
+
* one-time console warning. Missing or malformed values throw an `AtlasConfigError`
|
|
109
|
+
* (`code: 'FRONTEND_API_REQUIRED'` / `'FRONTEND_API_INVALID'`) when the
|
|
110
|
+
* provider renders, instead of silently sending requests to the app's own
|
|
111
|
+
* origin. Plain `http:` is accepted only for localhost and local development
|
|
112
|
+
* hosts.
|
|
83
113
|
*/
|
|
84
114
|
frontendApi: string;
|
|
85
115
|
appearance?: Appearance;
|
|
116
|
+
/**
|
|
117
|
+
* The UI language, as a BCP-47 tag: `"en"`, `"en-US"`, `"es"`, `"es-ES"`,
|
|
118
|
+
* `"fr"`, `"fr-FR"`, `"de"`, `"de-DE"`, `"pt-BR"`, `"ja"`, `"nl"`, … A region
|
|
119
|
+
* the catalogs don't have falls back to its language (`"es-MX"` → Spanish);
|
|
120
|
+
* an unknown language falls back to English. Defaults to English.
|
|
121
|
+
*/
|
|
122
|
+
locale?: SupportedLocale | (string & {});
|
|
123
|
+
/**
|
|
124
|
+
* String overrides, key by key (`{ 'signIn.title': 'Welcome back' }`), or a
|
|
125
|
+
* whole bundle from `@atlasauth/localizations`. Applied on top of `locale`.
|
|
126
|
+
*/
|
|
86
127
|
localization?: Catalog;
|
|
87
128
|
/**
|
|
88
129
|
* §oauth popup mode — the app-wide default for social/OIDC sign-in. `"popup"`
|