@atlasauth/svelte 0.13.0 → 0.14.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 CHANGED
@@ -1,5 +1,15 @@
1
1
  # @atlasauth/svelte changelog
2
2
 
3
+ ## 0.14.0 — 2026-11-05
4
+
5
+ ### Added
6
+
7
+ - Sign-in offers the emailed proof when a password is on hold, even with email code sign-in off, and shows the password field with a confirmation once it is proven.
8
+
9
+ ### Also
10
+
11
+ - The existing-account notice after a sign-up reaches an account on hold (`FlowState.existingAccount`), and the `account_deleted` error reason.
12
+
3
13
  ## 0.13.0 — 2026-10-30
4
14
 
5
15
  - `<SignIn>` offers "Sign in with a passkey" and passkey autofill on the identifier field when the instance enables passkeys.
@@ -142,6 +142,8 @@ export interface FlowController {
142
142
  * for this before exchanging the ticket and finishing the sign-in.
143
143
  */
144
144
  saveRecoveryCodes(): void;
145
+ /** With `holdExistingAccountNotice`: the user read `pendingExistingAccountNotice($state)`; finish the sign-up. */
146
+ continueAfterExistingAccount(): void;
145
147
  /** Resend a sign-up's emailed code / link (the earlier one stops working). Resolves whether it was sent. */
146
148
  resendSignUp(): Promise<boolean>;
147
149
  /**
@@ -198,4 +200,6 @@ export declare function signIn(): FlowController;
198
200
  * `create(values)` posts `/v1/client/sign_ups` (the account is created there),
199
201
  * then `submit({ code })` verifies the emailed code and completes the session.
200
202
  */
201
- export declare function signUp(): FlowController;
203
+ export declare function signUp(options?: {
204
+ holdExistingAccountNotice?: boolean;
205
+ }): FlowController;
package/dist/accessors.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { derived, get, readable, writable } from 'svelte/store';
2
- import { FapiClient, advanceWithCaptcha, atlasCaptchaLabels, createCaptchaController, createPasskeySignInController, createPasskeySignUp, createSignUp, finishPasskeySignUp, fetchInstanceSettings, fetchLastSignInMethod, startSignInWithAtlas, flowNeedsCaptcha, signInCaptchaOptions, flowFromPending, pollAttempt, prepareFactor, shouldKeepPolling, createOrganizationAuditLog, createMfaEnrollment, acknowledgeRecoveryCodes, pendingRecoveryCodes, mfaChoicesFrom, prepareSecondFactorCode, resendSignUpVerification, PolicyAcceptanceController, loadPolicies as loadPolicyList, initialFlow as emptyFlow, } from '@atlasauth/js';
2
+ import { FapiClient, advanceWithCaptcha, atlasCaptchaLabels, attemptPasswordHoldProof, preparePasswordHoldProof, createCaptchaController, createPasskeySignInController, createPasskeySignUp, createSignUp, finishPasskeySignUp, fetchInstanceSettings, fetchLastSignInMethod, startSignInWithAtlas, flowNeedsCaptcha, signInCaptchaOptions, flowFromPending, pollAttempt, prepareFactor, shouldKeepPolling, createOrganizationAuditLog, createMfaEnrollment, acknowledgeExistingAccount, acknowledgeRecoveryCodes, pendingExistingAccountNotice, pendingRecoveryCodes, mfaChoicesFrom, prepareSecondFactorCode, resendSignUpVerification, PolicyAcceptanceController, loadPolicies as loadPolicyList, initialFlow as emptyFlow, } from '@atlasauth/js';
3
3
  import { useAtlas } from './context';
4
4
  import { translate } from './i18n';
5
5
  import { evaluate } from './protect';
@@ -89,7 +89,7 @@ export function getToken() {
89
89
  export function signOut(options) {
90
90
  return useAtlas().signOut(options);
91
91
  }
92
- function createFlow() {
92
+ function createFlow(options = {}) {
93
93
  const atlas = useAtlas();
94
94
  const client = new FapiClient({
95
95
  publishableKey: atlas.publishableKey,
@@ -176,6 +176,10 @@ function createFlow() {
176
176
  });
177
177
  exchanged = res.ok;
178
178
  }
179
+ if (exchanged && options.holdExistingAccountNotice && pendingExistingAccountNotice(next)) {
180
+ state.set({ ...next, ticket: null, busy: false });
181
+ return;
182
+ }
179
183
  const kept = exchanged && (await atlas.reload());
180
184
  state.set({ ...next, busy: false, sessionKept: kept });
181
185
  return;
@@ -183,9 +187,23 @@ function createFlow() {
183
187
  state.set(next);
184
188
  maybeStartPolling();
185
189
  }
190
+ // What lifts a password hold on this instance: the emailed code, or a link where it verifies by link only.
191
+ const holdProof = () => get(settings)?.account.emailVerification === 'link' ? 'email_link' : 'email_code';
186
192
  function submit(values) {
187
193
  void (async () => {
188
194
  state.update((current) => ({ ...current, busy: true, errors: [] }));
195
+ const { attempt, passwordHold, prepared } = get(state);
196
+ // A code that lifts a password hold goes to its own attempt, not this sign-in.
197
+ // `values.code`: "Use your password instead" leaves `prepared` set.
198
+ if (attempt?.status === 'needs_first_factor' &&
199
+ passwordHold &&
200
+ !passwordHold.released &&
201
+ prepared === 'email_code' &&
202
+ holdProof() === 'email_code' &&
203
+ values.code !== undefined) {
204
+ state.set(await attemptPasswordHoldProof(client, get(state), values.code));
205
+ return;
206
+ }
189
207
  const out = await advanceWithCaptcha(client, get(state), values, { captcha, identifier, t });
190
208
  identifier = out.identifier;
191
209
  await finish(out.state);
@@ -242,6 +260,9 @@ function createFlow() {
242
260
  function saveRecoveryCodes() {
243
261
  void finish(acknowledgeRecoveryCodes(get(state)));
244
262
  }
263
+ function continueAfterExistingAccount() {
264
+ void finish(acknowledgeExistingAccount(get(state)));
265
+ }
245
266
  async function resendSignUp() {
246
267
  state.update((current) => ({ ...current, busy: true, errors: [] }));
247
268
  const next = await resendSignUpVerification(client, get(state));
@@ -256,7 +277,11 @@ function createFlow() {
256
277
  }
257
278
  async function prepare(strategy) {
258
279
  state.update((current) => ({ ...current, busy: true, errors: [] }));
259
- const next = await prepareFactor(client, get(state), strategy);
280
+ const hold = get(state).passwordHold;
281
+ const proof = holdProof();
282
+ const next = hold && !hold.released && strategy === proof
283
+ ? await preparePasswordHoldProof(client, get(state), proof)
284
+ : await prepareFactor(client, get(state), strategy);
260
285
  state.set({ ...next, busy: false });
261
286
  maybeStartPolling();
262
287
  return next.errors.length === 0;
@@ -299,6 +324,7 @@ function createFlow() {
299
324
  enrollment,
300
325
  enrollmentState: { subscribe: enrollmentState.subscribe },
301
326
  saveRecoveryCodes,
327
+ continueAfterExistingAccount,
302
328
  resendSignUp,
303
329
  prepare,
304
330
  settings: { subscribe: settings.subscribe },
@@ -322,6 +348,6 @@ export function signIn() {
322
348
  * `create(values)` posts `/v1/client/sign_ups` (the account is created there),
323
349
  * then `submit({ code })` verifies the emailed code and completes the session.
324
350
  */
325
- export function signUp() {
326
- return createFlow();
351
+ export function signUp(options = {}) {
352
+ return createFlow(options);
327
353
  }
@@ -28,6 +28,7 @@ export let enrollmentState = null;
28
28
  export let emailVerification = "code";
29
29
  export let onResend = null;
30
30
  export let onPolicyDecline = null;
31
+ export let passwordHold = null;
31
32
  const atlas = useAtlas();
32
33
  const cls = (key, base) => classFor(key, atlas.appearance, base);
33
34
  const t = (key, vars) => translate(atlas.catalog, key, vars);
@@ -36,10 +37,22 @@ let values = {};
36
37
  $: step = attempt ? nextStep(attempt) : { kind: "collect_identifier" };
37
38
  const strategyName = (s) => typeof s === "string" ? s : String(s?.strategy ?? "");
38
39
  $: offered = step.kind === "collect_first_factor" ? offeredFirstFactors(step.strategies.map(strategyName), emailDelivery) : [];
39
- $: emailOptions = onPrepare ? offered.filter((s) => s === "email_code" || s === "email_link") : [];
40
+ let holdOption = null;
41
+ $: holdOption = passwordHold && !passwordHold.released && emailDelivery?.available !== false ? emailVerification === "link" ? "email_link" : "email_code" : null;
42
+ let emailOptions = [];
43
+ $: {
44
+ const listed = offered.filter((s) => s === "email_code" || s === "email_link");
45
+ emailOptions = !onPrepare ? [] : holdOption && !listed.includes(holdOption) ? [...listed, holdOption] : listed;
46
+ }
47
+ $: provedSignUp = step.kind === "collect_first_factor" && attempt?.object === "sign_up_attempt" && !(attempt.supported_first_factors ?? []).includes("passkey");
40
48
  $: plan = planFirstFactor(offered);
41
49
  $: showPassword = offered.includes("password") || emailOptions.length === 0;
42
50
  let prepared = null;
51
+ $: released = passwordHold?.released === true;
52
+ $: if (released) {
53
+ prepared = null;
54
+ values = {};
55
+ }
43
56
  $: sent = prepared && prepared.attemptId === (attempt?.id ?? null) ? prepared.strategy : null;
44
57
  async function prepare(strategy) {
45
58
  if (!onPrepare) return;
@@ -52,7 +65,7 @@ $: if (step.kind === "collect_first_factor" && onPrepare && plan.autoSend && att
52
65
  void prepare(plan.autoSend);
53
66
  }
54
67
  $: sending = step.kind === "collect_first_factor" && sent === null && !!onPrepare && !plan.password && emailOptions.length > 0;
55
- $: identifier = attempt?.identifier ?? "";
68
+ $: identifier = passwordHold?.email ?? attempt?.identifier ?? "";
56
69
  let emailed = null;
57
70
  $: emailedNow = emailed && emailed.attemptId === (attempt?.id ?? null) ? emailed : null;
58
71
  async function emailSecondFactor() {
@@ -87,6 +100,7 @@ $: fields = (() => {
87
100
  case "collect_identifier":
88
101
  return [{ name: "identifier", labelKey: "signIn.identifierLabel", type: "email", autocomplete: "username webauthn" }];
89
102
  case "collect_first_factor":
103
+ if (provedSignUp) return [];
90
104
  if (sent === "email_code") {
91
105
  return [{ name: "code", labelKey: "signIn.emailCodeLabel", type: "text" }];
92
106
  }
@@ -185,6 +199,9 @@ function handleSubmit(event) {
185
199
  {#if sending}
186
200
  <p class="atlas-text" aria-live="polite">{t('signIn.sending')}</p>
187
201
  {/if}
202
+ {#if provedSignUp || (step.kind === 'collect_first_factor' && released && sent === null)}
203
+ <p class="atlas-text" data-atlas-password-released="">{t('signIn.passwordHoldReleased')}</p>
204
+ {/if}
188
205
  {#if linkOnly}
189
206
  <p class="atlas-text" data-atlas-link-sent aria-live="polite">{t('signUp.linkSentTo', { email: identifier })}</p>
190
207
  {#if onResend}
@@ -1,5 +1,5 @@
1
1
  import { SvelteComponent } from "svelte";
2
- import { type AttemptView, type CaptchaController, type EmailDelivery, type FieldError, type MfaEnrollmentController, type MfaEnrollmentState } from '@atlasauth/js';
2
+ import { type AttemptView, type CaptchaController, type EmailDelivery, type FieldError, type FlowState, type MfaEnrollmentController, type MfaEnrollmentState } from '@atlasauth/js';
3
3
  declare const __propDef: {
4
4
  props: {
5
5
  /**
@@ -55,6 +55,7 @@ declare const __propDef: {
55
55
  */ emailVerification?: string;
56
56
  onResend?: (() => Promise<boolean>) | null;
57
57
  /** The user declined a policy the sign-in was waiting on (`needs_policy_acceptance`): cancel the attempt. */ onPolicyDecline?: ((title: string) => void) | null;
58
+ /** `FlowState.passwordHold`: offers the emailed proof, whichever factors the instance signs in with. */ passwordHold?: FlowState["passwordHold"];
58
59
  };
59
60
  events: {
60
61
  [evt: string]: CustomEvent<any>;
@@ -85,6 +85,8 @@ function submitIdentifier(values) {
85
85
  titleKey="signIn.title"
86
86
  onSubmit={submitIdentifier}
87
87
  onPrepare={flow.prepare}
88
+ passwordHold={$flowState.passwordHold ?? null}
89
+ emailVerification={$settings?.account.emailVerification ?? 'code'}
88
90
  onEmailSecondFactor={$settings?.account.emailSecondFactor ? flow.sendEmailSecondFactor : null}
89
91
  onSmsSecondFactor={$settings && flow.mfaChoices().sms ? flow.sendSmsSecondFactor : null}
90
92
  enrollment={flow.enrollment}
@@ -1,11 +1,18 @@
1
1
  <script>import { onDestroy, onMount } from "svelte";
2
- import { awaitingPasskey, passkeysSupported } from "@atlasauth/js";
2
+ import { awaitingPasskey, existingAccountResetUrl, passkeysSupported, pendingExistingAccountNotice } from "@atlasauth/js";
3
3
  import { signUp } from "../accessors";
4
+ import { classFor } from "../appearance";
5
+ import { useAtlas } from "../context";
6
+ import { translate } from "../i18n";
4
7
  import AttemptFlow from "./AttemptFlow.svelte";
5
8
  import PasskeySignUpStep from "./PasskeySignUpStep.svelte";
6
9
  import SignUpForm from "./SignUpForm.svelte";
7
10
  export let afterUrl = void 0;
8
- const flow = signUp();
11
+ export let resetPasswordUrl = void 0;
12
+ const atlas = useAtlas();
13
+ const cls = (key, base) => classFor(key, atlas.appearance, base);
14
+ const t = (key) => translate(atlas.catalog, key);
15
+ const flow = signUp({ holdExistingAccountNotice: true });
9
16
  const flowState = flow.state;
10
17
  const settings = flow.settings;
11
18
  onDestroy(() => flow.destroy());
@@ -23,7 +30,19 @@ function switchMode() {
23
30
  }
24
31
  </script>
25
32
 
26
- {#if $flowState.attempt && awaitingPasskey($flowState.attempt)}
33
+ {#if pendingExistingAccountNotice($flowState)}
34
+ {@const resetHref = existingAccountResetUrl({ url: resetPasswordUrl, frontendApi: atlas.frontendApi, redirectUrl: afterUrl })}
35
+ <div class={cls('card', 'atlas-card')} data-atlas-existing-account="">
36
+ <h1 class={cls('headerTitle', 'atlas-title')}>{t('signUp.title')}</h1>
37
+ <p class="atlas-text">{t('signUp.existingAccount')}</p>
38
+ {#if resetHref}
39
+ <p class="atlas-text"><a class="atlas-link" href={resetHref}>{t('signIn.forgotPassword')}</a></p>
40
+ {/if}
41
+ <button class={cls('formButtonPrimary', 'atlas-button')} type="button" disabled={$flowState.busy} on:click={() => flow.continueAfterExistingAccount()}>
42
+ {t('signUp.submit')}
43
+ </button>
44
+ </div>
45
+ {:else if $flowState.attempt && awaitingPasskey($flowState.attempt)}
27
46
  <PasskeySignUpStep busy={$flowState.busy} errors={$flowState.errors} onCreate={flow.createPasskey} />
28
47
  {:else if $flowState.attempt}
29
48
  <AttemptFlow
@@ -8,6 +8,7 @@ declare const __propDef: {
8
8
  * `/v1/client/sign_ups`; from there the flow is server-driven exactly like
9
9
  * `<SignIn/>` (the emailed-code step, then the ticket exchange).
10
10
  */ afterUrl?: string | undefined;
11
+ /** Where the existing-account notice's "Forgot password?" goes. Default: the hosted sign-in page; `null` hides it. */ resetPasswordUrl?: string | null | undefined;
11
12
  };
12
13
  events: {
13
14
  [evt: string]: CustomEvent<any>;
package/dist/i18n.js CHANGED
@@ -33,6 +33,8 @@ export const EN_US = {
33
33
  'signIn.resendCode': 'Resend code',
34
34
  'signIn.resendLink': 'Resend link',
35
35
  'signIn.passwordOption': 'Use your password instead',
36
+ 'signIn.passwordHoldReleased': 'Your email is verified. Enter your password to sign in.',
37
+ 'signUp.existingAccount': 'You already had an account. Your existing password still applies.',
36
38
  'signIn.passkeyButton': 'Sign in with a passkey',
37
39
  'signIn.passkeyCancelled': "Passkey sign-in didn't finish. Try again, or use another way to sign in.",
38
40
  'signIn.signedIn': 'You\'re signed in.',
@@ -187,6 +189,9 @@ export const EN_US = {
187
189
  'error.email_delivery_unavailable': "This app can't send email right now. Try another sign-in method or contact the app owner.",
188
190
  'error.strategy_disabled': 'This sign-in method is not available for this app.',
189
191
  'error.sign_up_restricted': 'Sign-up on this app is by invitation only.',
192
+ 'error.sign_up_denied': 'Sign-up is not available for this account.',
193
+ 'error.password_not_yet_usable': 'Verify your email address before signing in with this password.',
194
+ 'error.account_deleted': 'The account for this address was deleted, so it can’t be used to sign up again.',
190
195
  'error.waitlisted': "You're on the waitlist. We'll email you when a place opens up.",
191
196
  'error.identifier_not_allowed': 'This email or phone number is not allowed on this app.',
192
197
  'error.disposable_email_blocked': 'Sign-up with a disposable or temporary email address is not allowed.',
@@ -195,6 +200,7 @@ export const EN_US = {
195
200
  'error.sign_ups_disabled': 'Sign-ups are temporarily disabled.',
196
201
  'error.high_risk_blocked': 'This sign-in was blocked because it looked unusual.',
197
202
  'error.sms_region_blocked': 'Text messages are not available for this phone number.',
203
+ 'error.github_team_required': 'Your GitHub account is not a member of a GitHub organization or team allowed to sign in here.',
198
204
  };
199
205
  /**
200
206
  * Look up a key and interpolate `{placeholders}`.
package/dist/version.d.ts CHANGED
@@ -1,4 +1,4 @@
1
1
  import type { AtlasSdkInfo } from '@atlasauth/js';
2
2
  /** This package's version, sent as `X-Atlas-SDK` (kept in step with package.json by a test). */
3
- export declare const ATLAS_SVELTE_VERSION = "0.13.0";
3
+ export declare const ATLAS_SVELTE_VERSION = "0.14.0";
4
4
  export declare const ATLAS_SVELTE_SDK: AtlasSdkInfo;
package/dist/version.js CHANGED
@@ -1,3 +1,3 @@
1
1
  /** This package's version, sent as `X-Atlas-SDK` (kept in step with package.json by a test). */
2
- export const ATLAS_SVELTE_VERSION = '0.13.0';
2
+ export const ATLAS_SVELTE_VERSION = '0.14.0';
3
3
  export const ATLAS_SVELTE_SDK = { name: '@atlasauth/svelte', version: ATLAS_SVELTE_VERSION };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlasauth/svelte",
3
- "version": "0.13.0",
3
+ "version": "0.14.0",
4
4
  "type": "module",
5
5
  "svelte": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
@@ -23,9 +23,9 @@
23
23
  },
24
24
  "dependencies": {
25
25
  "@atlasauth/design": "0.3.0",
26
- "@atlasauth/js": "0.27.0",
26
+ "@atlasauth/js": "0.32.0",
27
27
  "@atlasauth/authz": "0.3.0",
28
- "@atlasauth/backend": "0.28.0"
28
+ "@atlasauth/backend": "0.38.0"
29
29
  },
30
30
  "peerDependencies": {
31
31
  "svelte": ">=4",