@atlasauth/svelte 0.14.0 → 0.15.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 +4 -0
- package/dist/accessors.js +7 -1
- package/dist/components/AttemptFlow.svelte +1 -3
- package/dist/components/SignUp.svelte +23 -2
- package/dist/components/SignUp.svelte.d.ts +1 -0
- package/dist/i18n.js +1 -0
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
package/dist/accessors.js
CHANGED
|
@@ -163,7 +163,13 @@ function createFlow(options = {}) {
|
|
|
163
163
|
async function finish(next) {
|
|
164
164
|
// An enrolment's recovery codes are shown first; `saveRecoveryCodes` finishes.
|
|
165
165
|
if (pendingRecoveryCodes(next)) {
|
|
166
|
-
|
|
166
|
+
// The ticket dies in 60 seconds and saving the codes can take longer: redeem it now,
|
|
167
|
+
// and `saveRecoveryCodes` finishes. A refused exchange keeps the ticket, so the save reports it.
|
|
168
|
+
state.set({ ...next, busy: true });
|
|
169
|
+
const res = next.ticket
|
|
170
|
+
? await client.post('/v1/client/tickets/exchange', { attempt_id: next.attempt.id, ticket: next.ticket })
|
|
171
|
+
: null;
|
|
172
|
+
state.set({ ...next, busy: false, ticket: res?.ok ? null : next.ticket });
|
|
167
173
|
return;
|
|
168
174
|
}
|
|
169
175
|
if (next.attempt?.status === 'complete') {
|
|
@@ -44,7 +44,6 @@ $: {
|
|
|
44
44
|
const listed = offered.filter((s) => s === "email_code" || s === "email_link");
|
|
45
45
|
emailOptions = !onPrepare ? [] : holdOption && !listed.includes(holdOption) ? [...listed, holdOption] : listed;
|
|
46
46
|
}
|
|
47
|
-
$: provedSignUp = step.kind === "collect_first_factor" && attempt?.object === "sign_up_attempt" && !(attempt.supported_first_factors ?? []).includes("passkey");
|
|
48
47
|
$: plan = planFirstFactor(offered);
|
|
49
48
|
$: showPassword = offered.includes("password") || emailOptions.length === 0;
|
|
50
49
|
let prepared = null;
|
|
@@ -100,7 +99,6 @@ $: fields = (() => {
|
|
|
100
99
|
case "collect_identifier":
|
|
101
100
|
return [{ name: "identifier", labelKey: "signIn.identifierLabel", type: "email", autocomplete: "username webauthn" }];
|
|
102
101
|
case "collect_first_factor":
|
|
103
|
-
if (provedSignUp) return [];
|
|
104
102
|
if (sent === "email_code") {
|
|
105
103
|
return [{ name: "code", labelKey: "signIn.emailCodeLabel", type: "text" }];
|
|
106
104
|
}
|
|
@@ -199,7 +197,7 @@ function handleSubmit(event) {
|
|
|
199
197
|
{#if sending}
|
|
200
198
|
<p class="atlas-text" aria-live="polite">{t('signIn.sending')}</p>
|
|
201
199
|
{/if}
|
|
202
|
-
{#if
|
|
200
|
+
{#if step.kind === 'collect_first_factor' && released && sent === null}
|
|
203
201
|
<p class="atlas-text" data-atlas-password-released="">{t('signIn.passwordHoldReleased')}</p>
|
|
204
202
|
{/if}
|
|
205
203
|
{#if linkOnly}
|
|
@@ -1,20 +1,23 @@
|
|
|
1
1
|
<script>import { onDestroy, onMount } from "svelte";
|
|
2
|
-
import { awaitingPasskey, existingAccountResetUrl, passkeysSupported, pendingExistingAccountNotice } from "@atlasauth/js";
|
|
2
|
+
import { awaitingPasskey, existingAccountResetUrl, passkeysSupported, pendingExistingAccountNotice, pendingRecoveryCodes, signInAfterProofUrl, signUpProvedByLink } from "@atlasauth/js";
|
|
3
3
|
import { signUp } from "../accessors";
|
|
4
4
|
import { classFor } from "../appearance";
|
|
5
5
|
import { useAtlas } from "../context";
|
|
6
6
|
import { translate } from "../i18n";
|
|
7
7
|
import AttemptFlow from "./AttemptFlow.svelte";
|
|
8
8
|
import PasskeySignUpStep from "./PasskeySignUpStep.svelte";
|
|
9
|
+
import RecoveryCodes from "./RecoveryCodes.svelte";
|
|
9
10
|
import SignUpForm from "./SignUpForm.svelte";
|
|
10
11
|
export let afterUrl = void 0;
|
|
11
12
|
export let resetPasswordUrl = void 0;
|
|
13
|
+
export let signInUrl = void 0;
|
|
12
14
|
const atlas = useAtlas();
|
|
13
15
|
const cls = (key, base) => classFor(key, atlas.appearance, base);
|
|
14
16
|
const t = (key) => translate(atlas.catalog, key);
|
|
15
17
|
const flow = signUp({ holdExistingAccountNotice: true });
|
|
16
18
|
const flowState = flow.state;
|
|
17
19
|
const settings = flow.settings;
|
|
20
|
+
const enrollmentState = flow.enrollmentState;
|
|
18
21
|
onDestroy(() => flow.destroy());
|
|
19
22
|
onMount(() => {
|
|
20
23
|
void flow.loadPolicies();
|
|
@@ -25,12 +28,15 @@ let mode = "password";
|
|
|
25
28
|
$: offer = $settings?.account.passkeySignUp ?? null;
|
|
26
29
|
$: canPasskey = !!offer && passkeysSupported();
|
|
27
30
|
$: usingPasskey = mode === "passkey" && canPasskey;
|
|
31
|
+
$: recoveryCodes = pendingRecoveryCodes($flowState);
|
|
28
32
|
function switchMode() {
|
|
29
33
|
mode = usingPasskey ? "password" : "passkey";
|
|
30
34
|
}
|
|
31
35
|
</script>
|
|
32
36
|
|
|
33
|
-
{#if
|
|
37
|
+
{#if recoveryCodes}
|
|
38
|
+
<RecoveryCodes codes={recoveryCodes} busy={$flowState.busy} onSaved={flow.saveRecoveryCodes} />
|
|
39
|
+
{:else if pendingExistingAccountNotice($flowState)}
|
|
34
40
|
{@const resetHref = existingAccountResetUrl({ url: resetPasswordUrl, frontendApi: atlas.frontendApi, redirectUrl: afterUrl })}
|
|
35
41
|
<div class={cls('card', 'atlas-card')} data-atlas-existing-account="">
|
|
36
42
|
<h1 class={cls('headerTitle', 'atlas-title')}>{t('signUp.title')}</h1>
|
|
@@ -44,6 +50,16 @@ function switchMode() {
|
|
|
44
50
|
</div>
|
|
45
51
|
{:else if $flowState.attempt && awaitingPasskey($flowState.attempt)}
|
|
46
52
|
<PasskeySignUpStep busy={$flowState.busy} errors={$flowState.errors} onCreate={flow.createPasskey} />
|
|
53
|
+
{:else if signUpProvedByLink($flowState.attempt)}
|
|
54
|
+
<!-- A link confirmed the address and made no session here. Says the same for any address. -->
|
|
55
|
+
{@const signInHref = signInAfterProofUrl({ url: signInUrl, frontendApi: atlas.frontendApi, redirectUrl: afterUrl })}
|
|
56
|
+
<div class={cls('card', 'atlas-card')} data-atlas-email-confirmed="">
|
|
57
|
+
<h1 class={cls('headerTitle', 'atlas-title')}>{t('signUp.title')}</h1>
|
|
58
|
+
<p class="atlas-text" role="status">{t('signUp.emailConfirmed')}</p>
|
|
59
|
+
{#if signInHref}
|
|
60
|
+
<a class={cls('formButtonPrimary', 'atlas-button')} href={signInHref}>{t('signIn.title')}</a>
|
|
61
|
+
{/if}
|
|
62
|
+
</div>
|
|
47
63
|
{:else if $flowState.attempt}
|
|
48
64
|
<AttemptFlow
|
|
49
65
|
attempt={$flowState.attempt}
|
|
@@ -54,6 +70,11 @@ function switchMode() {
|
|
|
54
70
|
onSubmit={flow.submit}
|
|
55
71
|
emailVerification={$settings?.account.emailVerification ?? 'code'}
|
|
56
72
|
onResend={flow.resendSignUp}
|
|
73
|
+
onEmailSecondFactor={$settings?.account.emailSecondFactor ? flow.sendEmailSecondFactor : null}
|
|
74
|
+
onSmsSecondFactor={$settings && flow.mfaChoices().sms ? flow.sendSmsSecondFactor : null}
|
|
75
|
+
enrollment={flow.enrollment}
|
|
76
|
+
enrollmentState={$enrollmentState}
|
|
77
|
+
onPolicyDecline={flow.declinePolicy}
|
|
57
78
|
/>
|
|
58
79
|
{:else}
|
|
59
80
|
<SignUpForm
|
|
@@ -9,6 +9,7 @@ declare const __propDef: {
|
|
|
9
9
|
* `<SignIn/>` (the emailed-code step, then the ticket exchange).
|
|
10
10
|
*/ afterUrl?: string | undefined;
|
|
11
11
|
/** Where the existing-account notice's "Forgot password?" goes. Default: the hosted sign-in page; `null` hides it. */ resetPasswordUrl?: string | null | undefined;
|
|
12
|
+
/** Where "Sign in" goes once an emailed link confirmed the address and made no session here. Default: the hosted sign-in page; `null` hides it. */ signInUrl?: string | null | undefined;
|
|
12
13
|
};
|
|
13
14
|
events: {
|
|
14
15
|
[evt: string]: CustomEvent<any>;
|
package/dist/i18n.js
CHANGED
|
@@ -35,6 +35,7 @@ export const EN_US = {
|
|
|
35
35
|
'signIn.passwordOption': 'Use your password instead',
|
|
36
36
|
'signIn.passwordHoldReleased': 'Your email is verified. Enter your password to sign in.',
|
|
37
37
|
'signUp.existingAccount': 'You already had an account. Your existing password still applies.',
|
|
38
|
+
'signUp.emailConfirmed': 'Your email is confirmed. Sign in to continue.',
|
|
38
39
|
'signIn.passkeyButton': 'Sign in with a passkey',
|
|
39
40
|
'signIn.passkeyCancelled': "Passkey sign-in didn't finish. Try again, or use another way to sign in.",
|
|
40
41
|
'signIn.signedIn': 'You\'re signed in.',
|
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.
|
|
3
|
+
export declare const ATLAS_SVELTE_VERSION = "0.15.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.
|
|
2
|
+
export const ATLAS_SVELTE_VERSION = '0.15.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.
|
|
3
|
+
"version": "0.15.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.
|
|
26
|
+
"@atlasauth/js": "0.33.0",
|
|
27
27
|
"@atlasauth/authz": "0.3.0",
|
|
28
|
-
"@atlasauth/backend": "0.
|
|
28
|
+
"@atlasauth/backend": "0.39.0"
|
|
29
29
|
},
|
|
30
30
|
"peerDependencies": {
|
|
31
31
|
"svelte": ">=4",
|