@nebulr-group/bridge-svelte 1.0.0-alpha.0 → 1.0.0-alpha.1
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/dist/components/auth/InviteLanding.svelte +102 -28
- package/dist/components/auth/InviteLanding.svelte.d.ts +1 -1
- package/dist/components/auth/SignInForm.svelte +1 -4
- package/dist/components/auth/SignInForm.svelte.d.ts +0 -2
- package/dist/components/auth/SignUpForm.svelte +44 -13
- package/dist/components/auth/SignUpForm.svelte.d.ts +6 -1
- package/dist/components/auth/VerifyEmail.svelte +21 -1
- package/dist/core/client.d.ts +1 -1
- package/dist/core/client.js +5 -3
- package/dist/core/config.d.ts +16 -0
- package/dist/core/config.js +6 -0
- package/dist/core/link-relay.d.ts +27 -0
- package/dist/core/link-relay.js +64 -0
- package/dist/core/messages.d.ts +1 -1
- package/dist/core/messages.js +120 -0
- package/package.json +2 -2
|
@@ -1,19 +1,27 @@
|
|
|
1
1
|
<!--
|
|
2
|
-
Where an invite email lands. It
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
a
|
|
2
|
+
Where an invite email lands (`#bridge=invite&token=…`). It takes the token
|
|
3
|
+
from the address, clears it, and shows which workspace the invite is for:
|
|
4
|
+
|
|
5
|
+
- a person with no account signs up from the invite: no email to verify,
|
|
6
|
+
and they land signed in, in the workspace;
|
|
7
|
+
- a person with an account signs in, and the invite is accepted at once;
|
|
8
|
+
- someone signed in already accepts with one button.
|
|
9
|
+
|
|
10
|
+
An invite that no longer works says why: revoked, used or expired. One
|
|
11
|
+
sent to another address says so, and offers to sign out. An issuer that
|
|
12
|
+
does not offer invites gets a plain "not offered here yet".
|
|
6
13
|
-->
|
|
7
14
|
<script lang="ts">
|
|
8
15
|
import type { Snippet } from 'svelte';
|
|
9
16
|
import type { HTMLAttributes } from 'svelte/elements';
|
|
10
17
|
import { onMount } from 'svelte';
|
|
18
|
+
import { get } from 'svelte/store';
|
|
11
19
|
import { goto } from '$app/navigation';
|
|
12
|
-
import { isBridgeError } from '@nebulr-group/bridge-auth-core';
|
|
20
|
+
import { isBridgeError, type InvitePreview } from '@nebulr-group/bridge-auth-core';
|
|
13
21
|
import { getBridge, peekConfig } from '../../core/client.js';
|
|
14
22
|
import type { BridgeMessages } from '../../core/config.js';
|
|
15
|
-
import { errorMessage, translator } from '../../core/i18n.js';
|
|
16
|
-
import { signedIn } from '../../core/stores.js';
|
|
23
|
+
import { errorMessage, translator, type BridgeMessageKey } from '../../core/i18n.js';
|
|
24
|
+
import { signedIn, user } from '../../core/stores.js';
|
|
17
25
|
import AuthFormWrapper from '../shared/AuthFormWrapper.svelte';
|
|
18
26
|
import Alert from '../shared/Alert.svelte';
|
|
19
27
|
import Spinner from '../shared/Spinner.svelte';
|
|
@@ -25,7 +33,7 @@
|
|
|
25
33
|
/** The invite's token. @default read from the page's address */
|
|
26
34
|
token?: string;
|
|
27
35
|
headingSnippet?: Snippet;
|
|
28
|
-
/** Called once
|
|
36
|
+
/** Called once the person is in the workspace. Without it, the page goes to `auth.afterSignIn`. */
|
|
29
37
|
onAccepted?: () => void;
|
|
30
38
|
messages?: BridgeMessages;
|
|
31
39
|
}
|
|
@@ -34,21 +42,29 @@
|
|
|
34
42
|
|
|
35
43
|
const t = $derived(translator(messages));
|
|
36
44
|
const config = peekConfig();
|
|
45
|
+
const authBase = config?.authBase ?? '/auth';
|
|
37
46
|
|
|
47
|
+
type Closed = Exclude<InvitePreview['state'], 'open'>;
|
|
38
48
|
type View =
|
|
39
49
|
| { step: 'loading' }
|
|
40
50
|
| { step: 'not-offered' }
|
|
41
51
|
| { step: 'failed'; message: string }
|
|
42
|
-
| { step: '
|
|
52
|
+
| { step: 'closed'; state: Closed }
|
|
53
|
+
| { step: 'open'; token: string; workspace: string };
|
|
43
54
|
let view = $state<View>({ step: 'loading' });
|
|
44
|
-
|
|
55
|
+
/** `auth`: the sign-up or sign-in form. `accept`: signed in, accepting or about to. */
|
|
56
|
+
let phase = $state<'auth' | 'accept'>('auth');
|
|
57
|
+
let mode = $state<'sign-in' | 'sign-up'>('sign-up');
|
|
45
58
|
let accepting = $state(false);
|
|
46
|
-
let failure = $state<string | null>(null);
|
|
59
|
+
let failure = $state<{ message: string; code: string | null } | null>(null);
|
|
60
|
+
let notice = $state<string | null>(null);
|
|
47
61
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
62
|
+
const CLOSED_COPY: Record<Closed, BridgeMessageKey> = {
|
|
63
|
+
revoked: 'invite.state.revoked',
|
|
64
|
+
used: 'invite.state.used',
|
|
65
|
+
expired: 'invite.state.expired',
|
|
66
|
+
};
|
|
67
|
+
const CLOSED_CODES: Record<string, Closed> = { invite_revoked: 'revoked', invite_used: 'used', invite_expired: 'expired' };
|
|
52
68
|
|
|
53
69
|
onMount(() => {
|
|
54
70
|
const found = token ?? takeEmailLink('invite');
|
|
@@ -58,7 +74,15 @@
|
|
|
58
74
|
}
|
|
59
75
|
getBridge()
|
|
60
76
|
.invites.preview(found)
|
|
61
|
-
.then((preview) =>
|
|
77
|
+
.then((preview) => {
|
|
78
|
+
if (preview.state !== 'open') {
|
|
79
|
+
view = { step: 'closed', state: preview.state };
|
|
80
|
+
return;
|
|
81
|
+
}
|
|
82
|
+
view = { step: 'open', token: found, workspace: preview.workspace.name ?? '' };
|
|
83
|
+
mode = preview.account ? 'sign-in' : 'sign-up';
|
|
84
|
+
phase = get(signedIn) ? 'accept' : 'auth';
|
|
85
|
+
})
|
|
62
86
|
.catch((error) => {
|
|
63
87
|
view = isBridgeError(error, 'not-offered') ? { step: 'not-offered' } : { step: 'failed', message: errorMessage(error, t, 'link.error.invalid') };
|
|
64
88
|
});
|
|
@@ -69,19 +93,53 @@
|
|
|
69
93
|
else void goto(config?.afterSignIn ?? '/', { invalidateAll: true });
|
|
70
94
|
}
|
|
71
95
|
|
|
96
|
+
/** What to say about a refused invite call: the server's code first. */
|
|
97
|
+
function refusal(error: unknown): { message: string; code: string | null } {
|
|
98
|
+
const code = isBridgeError(error) ? error.code : null;
|
|
99
|
+
if (code === 'invite_for_another_address') return { message: t('invite.wrongAddress'), code };
|
|
100
|
+
if (code === 'already_member') return { message: t('invite.alreadyMember'), code };
|
|
101
|
+
if (code === 'account_exists') return { message: t('invite.accountExists'), code };
|
|
102
|
+
return { message: errorMessage(error, t, 'link.error.invalid'), code };
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
function closedBy(error: unknown): Closed | null {
|
|
106
|
+
return isBridgeError(error, 'link-invalid') && error.code !== null ? (CLOSED_CODES[error.code] ?? null) : null;
|
|
107
|
+
}
|
|
108
|
+
|
|
72
109
|
async function accept() {
|
|
73
|
-
if (view.step !== '
|
|
110
|
+
if (view.step !== 'open' || accepting) return;
|
|
111
|
+
phase = 'accept';
|
|
74
112
|
accepting = true;
|
|
75
113
|
failure = null;
|
|
76
114
|
try {
|
|
77
115
|
await getBridge().invites.accept(view.token);
|
|
78
116
|
done();
|
|
79
117
|
} catch (error) {
|
|
80
|
-
|
|
118
|
+
const closed = closedBy(error);
|
|
119
|
+
if (closed !== null) view = { step: 'closed', state: closed };
|
|
120
|
+
else failure = refusal(error);
|
|
81
121
|
} finally {
|
|
82
122
|
accepting = false;
|
|
83
123
|
}
|
|
84
124
|
}
|
|
125
|
+
|
|
126
|
+
function signUpFailed(error: unknown) {
|
|
127
|
+
const closed = closedBy(error);
|
|
128
|
+
if (closed !== null) {
|
|
129
|
+
view = { step: 'closed', state: closed };
|
|
130
|
+
} else if (isBridgeError(error) && error.code === 'account_exists') {
|
|
131
|
+
// The address has an account after all: sign in, and the invite is accepted on the way.
|
|
132
|
+
mode = 'sign-in';
|
|
133
|
+
notice = t('invite.accountExists');
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
async function signOut() {
|
|
138
|
+
failure = null;
|
|
139
|
+
await getBridge().signOut().catch(() => undefined);
|
|
140
|
+
phase = 'auth';
|
|
141
|
+
mode = 'sign-in';
|
|
142
|
+
}
|
|
85
143
|
</script>
|
|
86
144
|
|
|
87
145
|
{#if view.step === 'loading'}
|
|
@@ -96,7 +154,14 @@
|
|
|
96
154
|
<AuthFormWrapper heading={null} {headingSnippet} class={className} {style} data-bridge-invite="failed" {...rest}>
|
|
97
155
|
<Alert variant="error">{view.message}</Alert>
|
|
98
156
|
</AuthFormWrapper>
|
|
99
|
-
{:else if
|
|
157
|
+
{:else if view.step === 'closed'}
|
|
158
|
+
<AuthFormWrapper heading={null} {headingSnippet} class={className} {style} data-bridge-invite="closed" data-invite-state={view.state} {...rest}>
|
|
159
|
+
<Alert variant={view.state === 'used' ? 'info' : 'error'}>{t(CLOSED_COPY[view.state])}</Alert>
|
|
160
|
+
<div class="bridge-form-footer">
|
|
161
|
+
<a href={`${authBase}/sign-in`} class="bridge-link">{t('action.backToSignIn')}</a>
|
|
162
|
+
</div>
|
|
163
|
+
</AuthFormWrapper>
|
|
164
|
+
{:else if phase === 'accept'}
|
|
100
165
|
<AuthFormWrapper
|
|
101
166
|
heading={t('invite.heading', { workspace: view.workspace })}
|
|
102
167
|
{headingSnippet}
|
|
@@ -104,36 +169,45 @@
|
|
|
104
169
|
class={className}
|
|
105
170
|
{style}
|
|
106
171
|
data-bridge-invite="accept"
|
|
172
|
+
data-invite-error={failure?.code ?? null}
|
|
107
173
|
{...rest}
|
|
108
174
|
>
|
|
109
|
-
{#if failure}<Alert variant="error">{failure}</Alert>{/if}
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
175
|
+
{#if failure}<Alert variant="error">{failure.message}</Alert>{/if}
|
|
176
|
+
{#if failure?.code === 'invite_for_another_address'}
|
|
177
|
+
<button type="button" class="bridge-btn bridge-btn-primary" onclick={signOut}>{t('action.signOut')}</button>
|
|
178
|
+
{:else if failure?.code === 'already_member'}
|
|
179
|
+
<button type="button" class="bridge-btn bridge-btn-primary" onclick={done}>{t('invite.continue')}</button>
|
|
180
|
+
{:else}
|
|
181
|
+
{#if $user?.email}<p class="bridge-step-desc" data-bridge-invite-as>{t('invite.signedInAs', { email: $user.email })}</p>{/if}
|
|
182
|
+
<button type="button" class="bridge-btn bridge-btn-primary" disabled={accepting} onclick={accept}>
|
|
183
|
+
{#if accepting}<Spinner size={16} />{:else}{t('invite.accept')}{/if}
|
|
184
|
+
</button>
|
|
185
|
+
{/if}
|
|
113
186
|
</AuthFormWrapper>
|
|
114
187
|
{:else}
|
|
115
188
|
<AuthFormWrapper
|
|
116
189
|
heading={t('invite.heading', { workspace: view.workspace })}
|
|
117
190
|
{headingSnippet}
|
|
118
|
-
description={t('invite.signInToAccept')}
|
|
191
|
+
description={mode === 'sign-up' ? t('invite.signUpToAccept') : t('invite.signInToAccept')}
|
|
119
192
|
class={className}
|
|
120
193
|
{style}
|
|
121
194
|
data-bridge-invite={mode}
|
|
122
195
|
{...rest}
|
|
123
196
|
>
|
|
197
|
+
{#if notice}<Alert variant="info">{notice}</Alert>{/if}
|
|
124
198
|
{#if mode === 'sign-in'}
|
|
125
|
-
<SignInForm heading={null}
|
|
199
|
+
<SignInForm heading={null} onSignIn={accept} {messages}>
|
|
126
200
|
{#snippet footer()}
|
|
127
201
|
<div class="bridge-form-footer">
|
|
128
|
-
{t('login.signupPrompt')} <button type="button" class="bridge-link" onclick={() => (mode = 'sign-up')}>{t('login.signupLink')}</button>
|
|
202
|
+
{t('login.signupPrompt')} <button type="button" class="bridge-link" onclick={() => ((mode = 'sign-up'), (notice = null))}>{t('login.signupLink')}</button>
|
|
129
203
|
</div>
|
|
130
204
|
{/snippet}
|
|
131
205
|
</SignInForm>
|
|
132
206
|
{:else}
|
|
133
|
-
<SignUpForm heading={null} invite={view.token} {messages}>
|
|
207
|
+
<SignUpForm heading={null} invite={view.token} onSignIn={done} onError={signUpFailed} {messages}>
|
|
134
208
|
{#snippet footer()}
|
|
135
209
|
<div class="bridge-form-footer">
|
|
136
|
-
{t('signup.loginPrompt')} <button type="button" class="bridge-link" onclick={() => (mode = 'sign-in')}>{t('signup.loginLink')}</button>
|
|
210
|
+
{t('signup.loginPrompt')} <button type="button" class="bridge-link" onclick={() => ((mode = 'sign-in'), (notice = null))}>{t('signup.loginLink')}</button>
|
|
137
211
|
</div>
|
|
138
212
|
{/snippet}
|
|
139
213
|
</SignUpForm>
|
|
@@ -5,7 +5,7 @@ interface Props extends HTMLAttributes<HTMLDivElement> {
|
|
|
5
5
|
/** The invite's token. @default read from the page's address */
|
|
6
6
|
token?: string;
|
|
7
7
|
headingSnippet?: Snippet;
|
|
8
|
-
/** Called once
|
|
8
|
+
/** Called once the person is in the workspace. Without it, the page goes to `auth.afterSignIn`. */
|
|
9
9
|
onAccepted?: () => void;
|
|
10
10
|
messages?: BridgeMessages;
|
|
11
11
|
}
|
|
@@ -37,8 +37,6 @@
|
|
|
37
37
|
forgotPasswordHref?: string;
|
|
38
38
|
/** Sign straight in to this workspace. */
|
|
39
39
|
workspace?: string;
|
|
40
|
-
/** An invite to accept on the way in. */
|
|
41
|
-
invite?: string;
|
|
42
40
|
/** Called once signed in. Without it, the form goes to the return address. */
|
|
43
41
|
onSignIn?: () => void;
|
|
44
42
|
onError?: (error: unknown) => void;
|
|
@@ -55,7 +53,6 @@
|
|
|
55
53
|
showForgotPassword = true,
|
|
56
54
|
forgotPasswordHref = undefined,
|
|
57
55
|
workspace = undefined,
|
|
58
|
-
invite = undefined,
|
|
59
56
|
onSignIn,
|
|
60
57
|
onError,
|
|
61
58
|
footer,
|
|
@@ -123,7 +120,7 @@
|
|
|
123
120
|
notice = null;
|
|
124
121
|
loading = true;
|
|
125
122
|
try {
|
|
126
|
-
await follow(await getBridge().signIn.start({ email: email.trim(), password, ...(workspace ? { workspace } : {})
|
|
123
|
+
await follow(await getBridge().signIn.start({ email: email.trim(), password, ...(workspace ? { workspace } : {}) }));
|
|
127
124
|
} catch (error) {
|
|
128
125
|
fail(error);
|
|
129
126
|
} finally {
|
|
@@ -13,8 +13,6 @@ interface Props extends HTMLAttributes<HTMLDivElement> {
|
|
|
13
13
|
forgotPasswordHref?: string;
|
|
14
14
|
/** Sign straight in to this workspace. */
|
|
15
15
|
workspace?: string;
|
|
16
|
-
/** An invite to accept on the way in. */
|
|
17
|
-
invite?: string;
|
|
18
16
|
/** Called once signed in. Without it, the form goes to the return address. */
|
|
19
17
|
onSignIn?: () => void;
|
|
20
18
|
onError?: (error: unknown) => void;
|
|
@@ -3,15 +3,21 @@
|
|
|
3
3
|
the address: Bridge emails a link to the app's verify-email page, which
|
|
4
4
|
finishes the sign-up on this device. The answer is the same whether or not
|
|
5
5
|
the address already has an account, so the form never says which.
|
|
6
|
+
|
|
7
|
+
With `invite`, it signs the person up from an invite instead: the invite's
|
|
8
|
+
link proved the address, so there is no email field and no email to wait
|
|
9
|
+
for, and the person lands signed in, in the inviting workspace.
|
|
6
10
|
-->
|
|
7
11
|
<script lang="ts">
|
|
8
12
|
import type { Snippet } from 'svelte';
|
|
9
13
|
import type { HTMLAttributes } from 'svelte/elements';
|
|
10
|
-
import { onMount } from 'svelte';
|
|
14
|
+
import { onDestroy, onMount } from 'svelte';
|
|
15
|
+
import { goto } from '$app/navigation';
|
|
11
16
|
import type { SignInOptions } from '@nebulr-group/bridge-auth-core';
|
|
12
17
|
import { getBridge, peekConfig } from '../../core/client.js';
|
|
13
18
|
import type { BridgeMessages } from '../../core/config.js';
|
|
14
19
|
import { errorMessage, translator } from '../../core/i18n.js';
|
|
20
|
+
import { takeSignUpLinks } from '../../core/link-relay.js';
|
|
15
21
|
import AuthFormWrapper from '../shared/AuthFormWrapper.svelte';
|
|
16
22
|
import Alert from '../shared/Alert.svelte';
|
|
17
23
|
import Spinner from '../shared/Spinner.svelte';
|
|
@@ -27,8 +33,13 @@
|
|
|
27
33
|
* `'ask'` asks for its name, `false` makes none. @default true
|
|
28
34
|
*/
|
|
29
35
|
workspace?: boolean | 'ask';
|
|
30
|
-
/**
|
|
36
|
+
/**
|
|
37
|
+
* An invite's token: sign the person up from the invite. The address is
|
|
38
|
+
* the invite's, so no email field is shown and no email is sent.
|
|
39
|
+
*/
|
|
31
40
|
invite?: string;
|
|
41
|
+
/** With `invite`: called once signed in. Without it, the page goes to `auth.afterSignIn`. */
|
|
42
|
+
onSignIn?: () => void;
|
|
32
43
|
showLoginLink?: boolean;
|
|
33
44
|
loginHref?: string;
|
|
34
45
|
/** Called once the email is sent. */
|
|
@@ -44,6 +55,7 @@
|
|
|
44
55
|
showNameFields = true,
|
|
45
56
|
workspace = true,
|
|
46
57
|
invite = undefined,
|
|
58
|
+
onSignIn,
|
|
47
59
|
showLoginLink = true,
|
|
48
60
|
loginHref = undefined,
|
|
49
61
|
onSent,
|
|
@@ -56,7 +68,8 @@
|
|
|
56
68
|
}: Props = $props();
|
|
57
69
|
|
|
58
70
|
const t = $derived(translator(messages));
|
|
59
|
-
const
|
|
71
|
+
const config = peekConfig();
|
|
72
|
+
const authBase = config?.authBase ?? '/auth';
|
|
60
73
|
|
|
61
74
|
let email = $state('');
|
|
62
75
|
let password = $state('');
|
|
@@ -69,7 +82,10 @@
|
|
|
69
82
|
let options = $state<SignInOptions | null>(null);
|
|
70
83
|
|
|
71
84
|
const minLength = $derived(options?.password.minLength ?? 8);
|
|
72
|
-
|
|
85
|
+
// An invite is its own way in, whether or not the app takes sign-ups.
|
|
86
|
+
const closed = $derived(!invite && options !== null && !options.signUp);
|
|
87
|
+
let stopRelay: (() => void) | null = null;
|
|
88
|
+
onDestroy(() => stopRelay?.());
|
|
73
89
|
|
|
74
90
|
onMount(() => {
|
|
75
91
|
getBridge()
|
|
@@ -88,17 +104,30 @@
|
|
|
88
104
|
}
|
|
89
105
|
loading = true;
|
|
90
106
|
const address = email.trim();
|
|
107
|
+
const names = {
|
|
108
|
+
...(firstName.trim() ? { firstName: firstName.trim() } : {}),
|
|
109
|
+
...(lastName.trim() ? { lastName: lastName.trim() } : {}),
|
|
110
|
+
};
|
|
91
111
|
try {
|
|
112
|
+
if (invite) {
|
|
113
|
+
// Signed in at once, in the inviting workspace: the invite's link proved the address.
|
|
114
|
+
await getBridge().invites.signUp({ token: invite, password, ...names });
|
|
115
|
+
if (onSignIn) onSignIn();
|
|
116
|
+
else void goto(config?.afterSignIn ?? '/', { invalidateAll: true });
|
|
117
|
+
return;
|
|
118
|
+
}
|
|
92
119
|
await getBridge().signUp.start({
|
|
93
120
|
email: address,
|
|
94
121
|
password,
|
|
95
|
-
...
|
|
96
|
-
...(lastName.trim() ? { lastName: lastName.trim() } : {}),
|
|
122
|
+
...names,
|
|
97
123
|
...(workspace === 'ask' ? { workspace: workspaceName.trim() || true } : workspace ? { workspace: true } : {}),
|
|
98
|
-
...(invite ? { invite } : {}),
|
|
99
124
|
});
|
|
100
125
|
sentTo = address;
|
|
101
126
|
onSent?.(address);
|
|
127
|
+
// Memory only: this tab holds the sign-up's verifier, and the email link opens in a new tab, which hands it here.
|
|
128
|
+
if (config?.storage === 'memory' && stopRelay === null) {
|
|
129
|
+
stopRelay = takeSignUpLinks(config.issuer, () => void goto(`${authBase}/verify-email`));
|
|
130
|
+
}
|
|
102
131
|
} catch (error) {
|
|
103
132
|
failure = errorMessage(error, t, 'signup.error.create');
|
|
104
133
|
onError?.(error);
|
|
@@ -137,10 +166,12 @@
|
|
|
137
166
|
</div>
|
|
138
167
|
</div>
|
|
139
168
|
{/if}
|
|
140
|
-
|
|
141
|
-
<
|
|
142
|
-
|
|
143
|
-
|
|
169
|
+
{#if !invite}
|
|
170
|
+
<div class="bridge-form-group">
|
|
171
|
+
<label for="signup-email">{t('field.email')}</label>
|
|
172
|
+
<input id="signup-email" type="email" autocomplete="email" placeholder={t('placeholder.email')} required bind:value={email} disabled={loading} />
|
|
173
|
+
</div>
|
|
174
|
+
{/if}
|
|
144
175
|
<div class="bridge-form-group">
|
|
145
176
|
<label for="signup-password">{t('field.password')}</label>
|
|
146
177
|
<PasswordInput
|
|
@@ -155,13 +186,13 @@
|
|
|
155
186
|
hideLabel={t('action.hidePassword')}
|
|
156
187
|
/>
|
|
157
188
|
</div>
|
|
158
|
-
{#if workspace === 'ask'}
|
|
189
|
+
{#if workspace === 'ask' && !invite}
|
|
159
190
|
<div class="bridge-form-group">
|
|
160
191
|
<label for="signup-workspace">{t('field.workspaceName')}</label>
|
|
161
192
|
<input id="signup-workspace" type="text" autocomplete="organization" bind:value={workspaceName} disabled={loading} />
|
|
162
193
|
</div>
|
|
163
194
|
{/if}
|
|
164
|
-
<button type="submit" class="bridge-btn bridge-btn-primary" disabled={loading || !email.trim() || !password}>
|
|
195
|
+
<button type="submit" class="bridge-btn bridge-btn-primary" disabled={loading || (!invite && !email.trim()) || !password}>
|
|
165
196
|
{#if loading}<Spinner size={16} />{:else}{t('signup.submit')}{/if}
|
|
166
197
|
</button>
|
|
167
198
|
</form>
|
|
@@ -11,8 +11,13 @@ interface Props extends HTMLAttributes<HTMLDivElement> {
|
|
|
11
11
|
* `'ask'` asks for its name, `false` makes none. @default true
|
|
12
12
|
*/
|
|
13
13
|
workspace?: boolean | 'ask';
|
|
14
|
-
/**
|
|
14
|
+
/**
|
|
15
|
+
* An invite's token: sign the person up from the invite. The address is
|
|
16
|
+
* the invite's, so no email field is shown and no email is sent.
|
|
17
|
+
*/
|
|
15
18
|
invite?: string;
|
|
19
|
+
/** With `invite`: called once signed in. Without it, the page goes to `auth.afterSignIn`. */
|
|
20
|
+
onSignIn?: () => void;
|
|
16
21
|
showLoginLink?: boolean;
|
|
17
22
|
loginHref?: string;
|
|
18
23
|
/** Called once the email is sent. */
|
|
@@ -2,6 +2,10 @@
|
|
|
2
2
|
Finishes a sign-up from its email link, on the device that started it, and
|
|
3
3
|
signs the person in. Opened on another device it says so, and the link
|
|
4
4
|
still works on the right one.
|
|
5
|
+
|
|
6
|
+
With `storage: 'memory'` the sign-up's verifier lives only in the tab that
|
|
7
|
+
started it, so this page first hands the link to that tab; when one takes
|
|
8
|
+
it, this page says to go on there.
|
|
5
9
|
-->
|
|
6
10
|
<script lang="ts">
|
|
7
11
|
import type { Snippet } from 'svelte';
|
|
@@ -12,6 +16,7 @@
|
|
|
12
16
|
import { getBridge, peekConfig } from '../../core/client.js';
|
|
13
17
|
import type { BridgeMessages } from '../../core/config.js';
|
|
14
18
|
import { errorMessage, translator } from '../../core/i18n.js';
|
|
19
|
+
import { offerSignUpLink, takeRelayedLink } from '../../core/link-relay.js';
|
|
15
20
|
import AuthFormWrapper from '../shared/AuthFormWrapper.svelte';
|
|
16
21
|
import Alert from '../shared/Alert.svelte';
|
|
17
22
|
import Spinner from '../shared/Spinner.svelte';
|
|
@@ -36,6 +41,7 @@
|
|
|
36
41
|
|
|
37
42
|
type State =
|
|
38
43
|
| { step: 'working' }
|
|
44
|
+
| { step: 'continued' }
|
|
39
45
|
| { step: 'workspace'; workspaces: readonly WorkspaceChoice[]; choose: (id: string) => Promise<SignInStep> }
|
|
40
46
|
| { step: 'failed'; message: string; kind: string | null };
|
|
41
47
|
let view = $state<State>({ step: 'working' });
|
|
@@ -56,11 +62,21 @@
|
|
|
56
62
|
}
|
|
57
63
|
|
|
58
64
|
onMount(() => {
|
|
59
|
-
|
|
65
|
+
// A link another tab handed here (memory only), the token given, or the page's own address.
|
|
66
|
+
const relayed = token === undefined ? takeRelayedLink() : null;
|
|
67
|
+
const found = token ?? relayed ?? takeEmailLink('verify-email');
|
|
60
68
|
if (found === null) {
|
|
61
69
|
view = { step: 'failed', message: t('verify.missingLink'), kind: null };
|
|
62
70
|
return;
|
|
63
71
|
}
|
|
72
|
+
if (relayed === null && config?.storage === 'memory') {
|
|
73
|
+
// The verifier is in the tab that started the sign-up: offer it the link first.
|
|
74
|
+
void offerSignUpLink(config.issuer, found).then((taken) => {
|
|
75
|
+
if (taken) view = { step: 'continued' };
|
|
76
|
+
else getBridge().signUp.finish(found).then(follow, fail);
|
|
77
|
+
});
|
|
78
|
+
return;
|
|
79
|
+
}
|
|
64
80
|
getBridge().signUp.finish(found).then(follow, fail);
|
|
65
81
|
});
|
|
66
82
|
|
|
@@ -81,6 +97,10 @@
|
|
|
81
97
|
<span>{t('verify.finishing')}</span>
|
|
82
98
|
</div>
|
|
83
99
|
</AuthFormWrapper>
|
|
100
|
+
{:else if view.step === 'continued'}
|
|
101
|
+
<AuthFormWrapper heading={t('signup.heading')} {headingSnippet} class={className} {style} data-bridge-verify-email="continued" {...rest}>
|
|
102
|
+
<Alert variant="info">{t('verify.continuedElsewhere')}</Alert>
|
|
103
|
+
</AuthFormWrapper>
|
|
84
104
|
{:else if view.step === 'workspace'}
|
|
85
105
|
<AuthFormWrapper heading={t('workspace.chooseHeading')} {headingSnippet} class={className} {style} data-bridge-verify-email="workspace" {...rest}>
|
|
86
106
|
<WorkspaceChooser workspaces={view.workspaces} onChoose={choose} {messages} />
|
package/dist/core/client.d.ts
CHANGED
|
@@ -24,7 +24,7 @@ export declare function peekConfig(): ResolvedConfig | null;
|
|
|
24
24
|
export declare function takeEndedReason(): SignedOutReason | null;
|
|
25
25
|
/**
|
|
26
26
|
* Makes the page's client, or returns the one already made for the same
|
|
27
|
-
* issuer. A new issuer replaces it.
|
|
27
|
+
* issuer and storage. A new issuer or storage replaces it.
|
|
28
28
|
*/
|
|
29
29
|
export declare function startClient(config: ResolvedConfig, extra?: Partial<BridgeOptions>): Bridge;
|
|
30
30
|
/** For tests: forget the client. */
|
package/dist/core/client.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* browser, and every store and component reads it from here. Nothing is made
|
|
4
4
|
* on a server: the server side has its own helpers (`/server`), per request.
|
|
5
5
|
*/
|
|
6
|
-
import { createBridge } from '@nebulr-group/bridge-auth-core';
|
|
6
|
+
import { createBridge, memoryStorage } from '@nebulr-group/bridge-auth-core';
|
|
7
7
|
import { get, writable } from 'svelte/store';
|
|
8
8
|
import { setAppCopy } from './i18n.js';
|
|
9
9
|
const clientStore = writable(null);
|
|
@@ -45,20 +45,22 @@ export function takeEndedReason() {
|
|
|
45
45
|
}
|
|
46
46
|
/**
|
|
47
47
|
* Makes the page's client, or returns the one already made for the same
|
|
48
|
-
* issuer. A new issuer replaces it.
|
|
48
|
+
* issuer and storage. A new issuer or storage replaces it.
|
|
49
49
|
*/
|
|
50
50
|
export function startClient(config, extra) {
|
|
51
51
|
const current = get(clientStore);
|
|
52
52
|
const previous = get(configStore);
|
|
53
53
|
setAppCopy(config.locale, config.messages);
|
|
54
54
|
configStore.set(config);
|
|
55
|
-
if (current !== null && previous?.issuer === config.issuer)
|
|
55
|
+
if (current !== null && previous?.issuer === config.issuer && previous.storage === config.storage)
|
|
56
56
|
return current;
|
|
57
57
|
current?.destroy();
|
|
58
58
|
const client = createBridge({
|
|
59
59
|
issuer: config.issuer,
|
|
60
60
|
tokenOrigins: config.tokenOrigins,
|
|
61
61
|
...(config.live ? {} : { live: false }),
|
|
62
|
+
// Memory only: the refresh token, a sign-up's verifier and the visitor id stay in this page.
|
|
63
|
+
...(config.storage === 'memory' ? { storage: memoryStorage() } : {}),
|
|
62
64
|
...extra,
|
|
63
65
|
});
|
|
64
66
|
client.on('signed-out', ({ reason }) => {
|
package/dist/core/config.d.ts
CHANGED
|
@@ -60,6 +60,21 @@ export interface BridgeConfig {
|
|
|
60
60
|
readonly tokenOrigins?: readonly string[];
|
|
61
61
|
/** Live updates: flags, team and billing refresh within a second of a change. @default true */
|
|
62
62
|
readonly live?: boolean;
|
|
63
|
+
/**
|
|
64
|
+
* Where the session is kept between page loads.
|
|
65
|
+
*
|
|
66
|
+
* - `'local'`: in the browser's localStorage, so a reload and a new tab
|
|
67
|
+
* stay signed in.
|
|
68
|
+
* - `'memory'`: in this page's memory only. Nothing of Bridge's is
|
|
69
|
+
* written to localStorage or sessionStorage: not the refresh token, not
|
|
70
|
+
* a sign-up's verifier, not the visitor id. A reload signs in again. A new
|
|
71
|
+
* tab is signed in by another open tab of the app, passed in memory
|
|
72
|
+
* only; with no other tab open, it signs in again. A sign-up's email link, which opens in a new tab, is handed
|
|
73
|
+
* to the tab that started the sign-up and finishes there.
|
|
74
|
+
*
|
|
75
|
+
* @default 'local'
|
|
76
|
+
*/
|
|
77
|
+
readonly storage?: 'local' | 'memory';
|
|
63
78
|
/** Hints flag rules may read, such as a country or a page. Who the person is always comes from their token. */
|
|
64
79
|
readonly hints?: Readonly<Record<string, Hint>>;
|
|
65
80
|
/**
|
|
@@ -112,6 +127,7 @@ export interface ResolvedConfig {
|
|
|
112
127
|
readonly messages: BridgeMessages;
|
|
113
128
|
readonly tokenOrigins: readonly string[];
|
|
114
129
|
readonly live: boolean;
|
|
130
|
+
readonly storage: 'local' | 'memory';
|
|
115
131
|
readonly hints: Readonly<Record<string, Hint>> | undefined;
|
|
116
132
|
readonly flagKeys: {
|
|
117
133
|
readonly billingManage: string;
|
package/dist/core/config.js
CHANGED
|
@@ -32,6 +32,11 @@ export function checkIssuer(issuer) {
|
|
|
32
32
|
// Passed on exactly as given: the issuer's metadata must name the same string.
|
|
33
33
|
return issuer.trim();
|
|
34
34
|
}
|
|
35
|
+
function storageOf(value) {
|
|
36
|
+
if (value === undefined || value === 'local' || value === 'memory')
|
|
37
|
+
return value ?? 'local';
|
|
38
|
+
throw new Error(`[bridge] storage is 'local' or 'memory'; got "${String(value)}".`);
|
|
39
|
+
}
|
|
35
40
|
export function resolveConfig(config, envIssuer) {
|
|
36
41
|
const authBase = base(config.auth?.base, '/auth');
|
|
37
42
|
const billingBase = base(config.billing?.base, '/subscription');
|
|
@@ -48,6 +53,7 @@ export function resolveConfig(config, envIssuer) {
|
|
|
48
53
|
messages: config.messages ?? {},
|
|
49
54
|
tokenOrigins: config.tokenOrigins ?? [],
|
|
50
55
|
live: config.live ?? true,
|
|
56
|
+
storage: storageOf(config.storage),
|
|
51
57
|
hints: config.hints,
|
|
52
58
|
flagKeys: {
|
|
53
59
|
billingManage: config.flags?.billingManage ?? STANDARD_FLAGS.billingManage,
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A sign-up's email link, handed to the tab that started the sign-up, for
|
|
3
|
+
* apps that keep the session in memory (`storage: 'memory'`).
|
|
4
|
+
*
|
|
5
|
+
* A sign-up finishes only on the device that started it, with the PKCE
|
|
6
|
+
* verifier that tab kept. In memory mode the verifier lives in that tab
|
|
7
|
+
* alone, and the email link opens in a new one. The new tab offers the link
|
|
8
|
+
* on a BroadcastChannel of the page's own origin; the tab that started the
|
|
9
|
+
* sign-up takes it and finishes there, and the new tab says so. When no tab
|
|
10
|
+
* takes it within a moment, the new tab tries itself, and Bridge answers
|
|
11
|
+
* that the link belongs to the device that started the sign-up. The link
|
|
12
|
+
* stays usable either way.
|
|
13
|
+
*
|
|
14
|
+
* Only the token crosses, only between tabs of the same origin, and never
|
|
15
|
+
* through storage or an address.
|
|
16
|
+
*/
|
|
17
|
+
/** How long a new tab waits for the tab that started the sign-up. */
|
|
18
|
+
export declare const OFFER_WAIT_MS = 1500;
|
|
19
|
+
/** Offers a sign-up link's token to the tab that started the sign-up. True when one took it. */
|
|
20
|
+
export declare function offerSignUpLink(issuer: string, token: string, waitMs?: number): Promise<boolean>;
|
|
21
|
+
/**
|
|
22
|
+
* While a sign-up started here waits for its email link: takes the link
|
|
23
|
+
* another tab offers and calls `take` with it. Returns how to stop.
|
|
24
|
+
*/
|
|
25
|
+
export declare function takeSignUpLinks(issuer: string, take: () => void): () => void;
|
|
26
|
+
/** The link token another tab handed to this one, once. */
|
|
27
|
+
export declare function takeRelayedLink(): string | null;
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A sign-up's email link, handed to the tab that started the sign-up, for
|
|
3
|
+
* apps that keep the session in memory (`storage: 'memory'`).
|
|
4
|
+
*
|
|
5
|
+
* A sign-up finishes only on the device that started it, with the PKCE
|
|
6
|
+
* verifier that tab kept. In memory mode the verifier lives in that tab
|
|
7
|
+
* alone, and the email link opens in a new one. The new tab offers the link
|
|
8
|
+
* on a BroadcastChannel of the page's own origin; the tab that started the
|
|
9
|
+
* sign-up takes it and finishes there, and the new tab says so. When no tab
|
|
10
|
+
* takes it within a moment, the new tab tries itself, and Bridge answers
|
|
11
|
+
* that the link belongs to the device that started the sign-up. The link
|
|
12
|
+
* stays usable either way.
|
|
13
|
+
*
|
|
14
|
+
* Only the token crosses, only between tabs of the same origin, and never
|
|
15
|
+
* through storage or an address.
|
|
16
|
+
*/
|
|
17
|
+
/** How long a new tab waits for the tab that started the sign-up. */
|
|
18
|
+
export const OFFER_WAIT_MS = 1_500;
|
|
19
|
+
const channelOf = (issuer) => `bridge:${issuer.replace(/\/+$/, '')}:sign-up-link`;
|
|
20
|
+
let relayed = null;
|
|
21
|
+
/** Offers a sign-up link's token to the tab that started the sign-up. True when one took it. */
|
|
22
|
+
export function offerSignUpLink(issuer, token, waitMs = OFFER_WAIT_MS) {
|
|
23
|
+
if (typeof BroadcastChannel === 'undefined')
|
|
24
|
+
return Promise.resolve(false);
|
|
25
|
+
const channel = new BroadcastChannel(channelOf(issuer));
|
|
26
|
+
const id = crypto.randomUUID();
|
|
27
|
+
return new Promise((done) => {
|
|
28
|
+
const finish = (taken) => {
|
|
29
|
+
clearTimeout(timer);
|
|
30
|
+
channel.close();
|
|
31
|
+
done(taken);
|
|
32
|
+
};
|
|
33
|
+
const timer = setTimeout(() => finish(false), waitMs);
|
|
34
|
+
channel.onmessage = (event) => {
|
|
35
|
+
if (event.data?.type === 'taken' && event.data.id === id)
|
|
36
|
+
finish(true);
|
|
37
|
+
};
|
|
38
|
+
channel.postMessage({ type: 'offer', id, token });
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* While a sign-up started here waits for its email link: takes the link
|
|
43
|
+
* another tab offers and calls `take` with it. Returns how to stop.
|
|
44
|
+
*/
|
|
45
|
+
export function takeSignUpLinks(issuer, take) {
|
|
46
|
+
if (typeof BroadcastChannel === 'undefined')
|
|
47
|
+
return () => undefined;
|
|
48
|
+
const channel = new BroadcastChannel(channelOf(issuer));
|
|
49
|
+
channel.onmessage = (event) => {
|
|
50
|
+
const message = event.data;
|
|
51
|
+
if (message?.type !== 'offer' || typeof message.token !== 'string' || message.token === '')
|
|
52
|
+
return;
|
|
53
|
+
relayed = message.token;
|
|
54
|
+
channel.postMessage({ type: 'taken', id: message.id });
|
|
55
|
+
take();
|
|
56
|
+
};
|
|
57
|
+
return () => channel.close();
|
|
58
|
+
}
|
|
59
|
+
/** The link token another tab handed to this one, once. */
|
|
60
|
+
export function takeRelayedLink() {
|
|
61
|
+
const token = relayed;
|
|
62
|
+
relayed = null;
|
|
63
|
+
return token;
|
|
64
|
+
}
|
package/dist/core/messages.d.ts
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* impersonal errors that end in a full stop, labels and buttons without one,
|
|
5
5
|
* placeholders positioned in the sentence.
|
|
6
6
|
*/
|
|
7
|
-
export type PluginMessageKey = 'signup.closed' | 'field.workspaceName' | 'verify.missingLink' | 'forgot.setDone' | 'invite.description' | 'invite.notOffered' | 'invite.signInToAccept' | 'handoff.invalid' | 'handoff.notOffered' | 'session.ended' | 'session.accessRemoved' | 'error.generic' | 'workspace.empty' | 'workspace.current' | 'password.tooShort' | 'feature.upgrade';
|
|
7
|
+
export type PluginMessageKey = 'signup.closed' | 'field.workspaceName' | 'verify.missingLink' | 'forgot.setDone' | 'invite.description' | 'invite.notOffered' | 'invite.signInToAccept' | 'invite.signUpToAccept' | 'invite.signedInAs' | 'invite.continue' | 'invite.state.revoked' | 'invite.state.used' | 'invite.state.expired' | 'invite.wrongAddress' | 'invite.alreadyMember' | 'invite.accountExists' | 'verify.continuedElsewhere' | 'handoff.invalid' | 'handoff.notOffered' | 'session.ended' | 'session.accessRemoved' | 'error.generic' | 'workspace.empty' | 'workspace.current' | 'password.tooShort' | 'feature.upgrade';
|
|
8
8
|
export type PluginMessages = Record<PluginMessageKey, string>;
|
|
9
9
|
/** The plugin's copy by primary language subtag. */
|
|
10
10
|
export declare const PLUGIN_LOCALES: Readonly<Record<string, PluginMessages>>;
|
package/dist/core/messages.js
CHANGED
|
@@ -6,6 +6,16 @@ const en = {
|
|
|
6
6
|
'invite.description': 'You are invited to join {workspace}.',
|
|
7
7
|
'invite.notOffered': 'Invites cannot be accepted here yet. Ask the person who invited you to try again later.',
|
|
8
8
|
'invite.signInToAccept': 'Sign in or create an account to accept the invite.',
|
|
9
|
+
'invite.signUpToAccept': 'Choose a password to accept the invite.',
|
|
10
|
+
'invite.signedInAs': 'Signed in as {email}.',
|
|
11
|
+
'invite.continue': 'Continue',
|
|
12
|
+
'invite.state.revoked': 'This invite was revoked. Ask the person who invited you for a new one.',
|
|
13
|
+
'invite.state.used': 'This invite was used already. Sign in to open the workspace.',
|
|
14
|
+
'invite.state.expired': 'This invite has expired. Ask the person who invited you for a new one.',
|
|
15
|
+
'invite.wrongAddress': 'This invite is for another email address. Sign out, then sign in with the address it was sent to.',
|
|
16
|
+
'invite.alreadyMember': 'You are a member of this workspace already.',
|
|
17
|
+
'invite.accountExists': 'This address has an account already. Sign in to accept the invite.',
|
|
18
|
+
'verify.continuedElsewhere': 'Your sign-up goes on in the window where you started it. You can close this one.',
|
|
9
19
|
'handoff.invalid': 'This sign-in link is not valid. Start signing in again from {program}.',
|
|
10
20
|
'handoff.notOffered': 'This page does not sign in other programs.',
|
|
11
21
|
'session.ended': 'Your session ended. Please sign in again.',
|
|
@@ -24,6 +34,16 @@ const sv = {
|
|
|
24
34
|
'invite.description': 'Du är inbjuden till {workspace}.',
|
|
25
35
|
'invite.notOffered': 'Inbjudningar kan inte tas emot här än. Be den som bjöd in dig att försöka igen senare.',
|
|
26
36
|
'invite.signInToAccept': 'Logga in eller skapa ett konto för att ta emot inbjudan.',
|
|
37
|
+
'invite.signUpToAccept': 'Välj ett lösenord för att ta emot inbjudan.',
|
|
38
|
+
'invite.signedInAs': 'Inloggad som {email}.',
|
|
39
|
+
'invite.continue': 'Fortsätt',
|
|
40
|
+
'invite.state.revoked': 'Inbjudan har dragits tillbaka. Be den som bjöd in dig om en ny.',
|
|
41
|
+
'invite.state.used': 'Inbjudan har redan använts. Logga in för att öppna arbetsytan.',
|
|
42
|
+
'invite.state.expired': 'Inbjudan har gått ut. Be den som bjöd in dig om en ny.',
|
|
43
|
+
'invite.wrongAddress': 'Inbjudan gäller en annan e-postadress. Logga ut och logga sedan in med adressen den skickades till.',
|
|
44
|
+
'invite.alreadyMember': 'Du är redan medlem i den här arbetsytan.',
|
|
45
|
+
'invite.accountExists': 'Adressen har redan ett konto. Logga in för att ta emot inbjudan.',
|
|
46
|
+
'verify.continuedElsewhere': 'Registreringen fortsätter i fönstret där du började. Du kan stänga det här.',
|
|
27
47
|
'handoff.invalid': 'Inloggningslänken är inte giltig. Börja logga in igen från {program}.',
|
|
28
48
|
'handoff.notOffered': 'Den här sidan loggar inte in andra program.',
|
|
29
49
|
'session.ended': 'Din session har avslutats. Logga in igen.',
|
|
@@ -42,6 +62,16 @@ const da = {
|
|
|
42
62
|
'invite.description': 'Du er inviteret til {workspace}.',
|
|
43
63
|
'invite.notOffered': 'Invitationer kan ikke modtages her endnu. Bed den, der inviterede dig, om at prøve igen senere.',
|
|
44
64
|
'invite.signInToAccept': 'Log ind eller opret en konto for at tage imod invitationen.',
|
|
65
|
+
'invite.signUpToAccept': 'Vælg en adgangskode for at tage imod invitationen.',
|
|
66
|
+
'invite.signedInAs': 'Logget ind som {email}.',
|
|
67
|
+
'invite.continue': 'Fortsæt',
|
|
68
|
+
'invite.state.revoked': 'Invitationen er trukket tilbage. Bed den, der inviterede dig, om en ny.',
|
|
69
|
+
'invite.state.used': 'Invitationen er allerede brugt. Log ind for at åbne arbejdsområdet.',
|
|
70
|
+
'invite.state.expired': 'Invitationen er udløbet. Bed den, der inviterede dig, om en ny.',
|
|
71
|
+
'invite.wrongAddress': 'Invitationen gælder en anden e-mailadresse. Log ud, og log derefter ind med den adresse, den blev sendt til.',
|
|
72
|
+
'invite.alreadyMember': 'Du er allerede medlem af dette arbejdsområde.',
|
|
73
|
+
'invite.accountExists': 'Adressen har allerede en konto. Log ind for at tage imod invitationen.',
|
|
74
|
+
'verify.continuedElsewhere': 'Din tilmelding fortsætter i det vindue, hvor du startede. Du kan lukke dette.',
|
|
45
75
|
'handoff.invalid': 'Login-linket er ikke gyldigt. Start login igen fra {program}.',
|
|
46
76
|
'handoff.notOffered': 'Denne side logger ikke andre programmer ind.',
|
|
47
77
|
'session.ended': 'Din session er afsluttet. Log ind igen.',
|
|
@@ -60,6 +90,16 @@ const nb = {
|
|
|
60
90
|
'invite.description': 'Du er invitert til {workspace}.',
|
|
61
91
|
'invite.notOffered': 'Invitasjoner kan ikke tas imot her ennå. Be den som inviterte deg om å prøve igjen senere.',
|
|
62
92
|
'invite.signInToAccept': 'Logg inn eller opprett en konto for å ta imot invitasjonen.',
|
|
93
|
+
'invite.signUpToAccept': 'Velg et passord for å ta imot invitasjonen.',
|
|
94
|
+
'invite.signedInAs': 'Logget inn som {email}.',
|
|
95
|
+
'invite.continue': 'Fortsett',
|
|
96
|
+
'invite.state.revoked': 'Invitasjonen er trukket tilbake. Be den som inviterte deg om en ny.',
|
|
97
|
+
'invite.state.used': 'Invitasjonen er allerede brukt. Logg inn for å åpne arbeidsområdet.',
|
|
98
|
+
'invite.state.expired': 'Invitasjonen har utløpt. Be den som inviterte deg om en ny.',
|
|
99
|
+
'invite.wrongAddress': 'Invitasjonen gjelder en annen e-postadresse. Logg ut, og logg deretter inn med adressen den ble sendt til.',
|
|
100
|
+
'invite.alreadyMember': 'Du er allerede medlem av dette arbeidsområdet.',
|
|
101
|
+
'invite.accountExists': 'Adressen har allerede en konto. Logg inn for å ta imot invitasjonen.',
|
|
102
|
+
'verify.continuedElsewhere': 'Registreringen fortsetter i vinduet der du startet. Du kan lukke dette.',
|
|
63
103
|
'handoff.invalid': 'Innloggingslenken er ikke gyldig. Start innloggingen på nytt fra {program}.',
|
|
64
104
|
'handoff.notOffered': 'Denne siden logger ikke inn andre programmer.',
|
|
65
105
|
'session.ended': 'Økten din er avsluttet. Logg inn på nytt.',
|
|
@@ -78,6 +118,16 @@ const nl = {
|
|
|
78
118
|
'invite.description': 'Je bent uitgenodigd voor {workspace}.',
|
|
79
119
|
'invite.notOffered': 'Uitnodigingen kunnen hier nog niet worden aangenomen. Vraag degene die je uitnodigde het later opnieuw te proberen.',
|
|
80
120
|
'invite.signInToAccept': 'Log in of maak een account aan om de uitnodiging aan te nemen.',
|
|
121
|
+
'invite.signUpToAccept': 'Kies een wachtwoord om de uitnodiging aan te nemen.',
|
|
122
|
+
'invite.signedInAs': 'Ingelogd als {email}.',
|
|
123
|
+
'invite.continue': 'Doorgaan',
|
|
124
|
+
'invite.state.revoked': 'Deze uitnodiging is ingetrokken. Vraag degene die je uitnodigde om een nieuwe.',
|
|
125
|
+
'invite.state.used': 'Deze uitnodiging is al gebruikt. Log in om de werkruimte te openen.',
|
|
126
|
+
'invite.state.expired': 'Deze uitnodiging is verlopen. Vraag degene die je uitnodigde om een nieuwe.',
|
|
127
|
+
'invite.wrongAddress': 'Deze uitnodiging is voor een ander e-mailadres. Log uit en log daarna in met het adres waarnaar ze is gestuurd.',
|
|
128
|
+
'invite.alreadyMember': 'Je bent al lid van deze werkruimte.',
|
|
129
|
+
'invite.accountExists': 'Dit adres heeft al een account. Log in om de uitnodiging aan te nemen.',
|
|
130
|
+
'verify.continuedElsewhere': 'Je registratie gaat verder in het venster waar je begon. Je kunt dit venster sluiten.',
|
|
81
131
|
'handoff.invalid': 'Deze inloglink is niet geldig. Begin opnieuw met inloggen vanuit {program}.',
|
|
82
132
|
'handoff.notOffered': 'Deze pagina logt geen andere programma\'s in.',
|
|
83
133
|
'session.ended': 'Je sessie is beëindigd. Log opnieuw in.',
|
|
@@ -96,6 +146,16 @@ const de = {
|
|
|
96
146
|
'invite.description': 'Du bist zu {workspace} eingeladen.',
|
|
97
147
|
'invite.notOffered': 'Einladungen können hier noch nicht angenommen werden. Bitte die Person, die dich eingeladen hat, es später erneut zu versuchen.',
|
|
98
148
|
'invite.signInToAccept': 'Melde dich an oder erstelle ein Konto, um die Einladung anzunehmen.',
|
|
149
|
+
'invite.signUpToAccept': 'Wähle ein Passwort, um die Einladung anzunehmen.',
|
|
150
|
+
'invite.signedInAs': 'Angemeldet als {email}.',
|
|
151
|
+
'invite.continue': 'Weiter',
|
|
152
|
+
'invite.state.revoked': 'Diese Einladung wurde zurückgezogen. Bitte die Person, die dich eingeladen hat, um eine neue.',
|
|
153
|
+
'invite.state.used': 'Diese Einladung wurde bereits verwendet. Melde dich an, um den Arbeitsbereich zu öffnen.',
|
|
154
|
+
'invite.state.expired': 'Diese Einladung ist abgelaufen. Bitte die Person, die dich eingeladen hat, um eine neue.',
|
|
155
|
+
'invite.wrongAddress': 'Diese Einladung gilt für eine andere E-Mail-Adresse. Melde dich ab und dann mit der Adresse an, an die sie gesendet wurde.',
|
|
156
|
+
'invite.alreadyMember': 'Du bist bereits Mitglied dieses Arbeitsbereichs.',
|
|
157
|
+
'invite.accountExists': 'Diese Adresse hat bereits ein Konto. Melde dich an, um die Einladung anzunehmen.',
|
|
158
|
+
'verify.continuedElsewhere': 'Deine Registrierung geht in dem Fenster weiter, in dem du sie begonnen hast. Du kannst dieses schließen.',
|
|
99
159
|
'handoff.invalid': 'Dieser Anmeldelink ist ungültig. Starte die Anmeldung erneut über {program}.',
|
|
100
160
|
'handoff.notOffered': 'Diese Seite meldet keine anderen Programme an.',
|
|
101
161
|
'session.ended': 'Deine Sitzung wurde beendet. Bitte melde dich erneut an.',
|
|
@@ -114,6 +174,16 @@ const fi = {
|
|
|
114
174
|
'invite.description': 'Sinut on kutsuttu työtilaan {workspace}.',
|
|
115
175
|
'invite.notOffered': 'Kutsuja ei voi vielä hyväksyä täällä. Pyydä kutsujaa yrittämään myöhemmin uudelleen.',
|
|
116
176
|
'invite.signInToAccept': 'Kirjaudu sisään tai luo tili hyväksyäksesi kutsun.',
|
|
177
|
+
'invite.signUpToAccept': 'Valitse salasana hyväksyäksesi kutsun.',
|
|
178
|
+
'invite.signedInAs': 'Kirjautuneena: {email}.',
|
|
179
|
+
'invite.continue': 'Jatka',
|
|
180
|
+
'invite.state.revoked': 'Kutsu on peruttu. Pyydä kutsujalta uusi.',
|
|
181
|
+
'invite.state.used': 'Kutsu on jo käytetty. Kirjaudu sisään avataksesi työtilan.',
|
|
182
|
+
'invite.state.expired': 'Kutsu on vanhentunut. Pyydä kutsujalta uusi.',
|
|
183
|
+
'invite.wrongAddress': 'Kutsu on lähetetty toiseen sähköpostiosoitteeseen. Kirjaudu ulos ja sitten sisään osoitteella, johon se lähetettiin.',
|
|
184
|
+
'invite.alreadyMember': 'Olet jo tämän työtilan jäsen.',
|
|
185
|
+
'invite.accountExists': 'Osoitteella on jo tili. Kirjaudu sisään hyväksyäksesi kutsun.',
|
|
186
|
+
'verify.continuedElsewhere': 'Rekisteröityminen jatkuu ikkunassa, jossa aloitit sen. Voit sulkea tämän ikkunan.',
|
|
117
187
|
'handoff.invalid': 'Kirjautumislinkki ei ole voimassa. Aloita kirjautuminen uudelleen ohjelmasta {program}.',
|
|
118
188
|
'handoff.notOffered': 'Tämä sivu ei kirjaa sisään muita ohjelmia.',
|
|
119
189
|
'session.ended': 'Istuntosi päättyi. Kirjaudu sisään uudelleen.',
|
|
@@ -132,6 +202,16 @@ const fr = {
|
|
|
132
202
|
'invite.description': 'Tu es invité à rejoindre {workspace}.',
|
|
133
203
|
'invite.notOffered': 'Les invitations ne peuvent pas encore être acceptées ici. Demande à la personne qui t\'a invité de réessayer plus tard.',
|
|
134
204
|
'invite.signInToAccept': 'Connecte-toi ou crée un compte pour accepter l\'invitation.',
|
|
205
|
+
'invite.signUpToAccept': 'Choisis un mot de passe pour accepter l\'invitation.',
|
|
206
|
+
'invite.signedInAs': 'Connecté en tant que {email}.',
|
|
207
|
+
'invite.continue': 'Continuer',
|
|
208
|
+
'invite.state.revoked': 'Cette invitation a été révoquée. Demande-en une nouvelle à la personne qui t\'a invité.',
|
|
209
|
+
'invite.state.used': 'Cette invitation a déjà été utilisée. Connecte-toi pour ouvrir l\'espace de travail.',
|
|
210
|
+
'invite.state.expired': 'Cette invitation a expiré. Demande-en une nouvelle à la personne qui t\'a invité.',
|
|
211
|
+
'invite.wrongAddress': 'Cette invitation est destinée à une autre adresse e-mail. Déconnecte-toi, puis connecte-toi avec l\'adresse à laquelle elle a été envoyée.',
|
|
212
|
+
'invite.alreadyMember': 'Tu es déjà membre de cet espace de travail.',
|
|
213
|
+
'invite.accountExists': 'Cette adresse a déjà un compte. Connecte-toi pour accepter l\'invitation.',
|
|
214
|
+
'verify.continuedElsewhere': 'Ton inscription continue dans la fenêtre où tu l\'as commencée. Tu peux fermer celle-ci.',
|
|
135
215
|
'handoff.invalid': 'Ce lien de connexion n\'est pas valide. Recommence la connexion depuis {program}.',
|
|
136
216
|
'handoff.notOffered': 'Cette page ne connecte pas d\'autres programmes.',
|
|
137
217
|
'session.ended': 'Ta session a pris fin. Connecte-toi à nouveau.',
|
|
@@ -150,6 +230,16 @@ const es = {
|
|
|
150
230
|
'invite.description': 'Te han invitado a {workspace}.',
|
|
151
231
|
'invite.notOffered': 'Aquí todavía no se pueden aceptar invitaciones. Pide a quien te invitó que lo intente más tarde.',
|
|
152
232
|
'invite.signInToAccept': 'Inicia sesión o crea una cuenta para aceptar la invitación.',
|
|
233
|
+
'invite.signUpToAccept': 'Elige una contraseña para aceptar la invitación.',
|
|
234
|
+
'invite.signedInAs': 'Sesión iniciada como {email}.',
|
|
235
|
+
'invite.continue': 'Continuar',
|
|
236
|
+
'invite.state.revoked': 'Esta invitación se ha revocado. Pide una nueva a quien te invitó.',
|
|
237
|
+
'invite.state.used': 'Esta invitación ya se ha usado. Inicia sesión para abrir el espacio de trabajo.',
|
|
238
|
+
'invite.state.expired': 'Esta invitación ha caducado. Pide una nueva a quien te invitó.',
|
|
239
|
+
'invite.wrongAddress': 'Esta invitación es para otra dirección de correo. Cierra sesión y vuelve a iniciarla con la dirección a la que se envió.',
|
|
240
|
+
'invite.alreadyMember': 'Ya eres miembro de este espacio de trabajo.',
|
|
241
|
+
'invite.accountExists': 'Esta dirección ya tiene una cuenta. Inicia sesión para aceptar la invitación.',
|
|
242
|
+
'verify.continuedElsewhere': 'Tu registro continúa en la ventana donde lo empezaste. Puedes cerrar esta.',
|
|
153
243
|
'handoff.invalid': 'Este enlace de inicio de sesión no es válido. Vuelve a iniciar sesión desde {program}.',
|
|
154
244
|
'handoff.notOffered': 'Esta página no inicia sesión en otros programas.',
|
|
155
245
|
'session.ended': 'Tu sesión ha terminado. Vuelve a iniciar sesión.',
|
|
@@ -168,6 +258,16 @@ const it = {
|
|
|
168
258
|
'invite.description': 'Sei stato invitato in {workspace}.',
|
|
169
259
|
'invite.notOffered': 'Gli inviti non possono ancora essere accettati qui. Chiedi a chi ti ha invitato di riprovare più tardi.',
|
|
170
260
|
'invite.signInToAccept': 'Accedi o crea un account per accettare l\'invito.',
|
|
261
|
+
'invite.signUpToAccept': 'Scegli una password per accettare l\'invito.',
|
|
262
|
+
'invite.signedInAs': 'Accesso effettuato come {email}.',
|
|
263
|
+
'invite.continue': 'Continua',
|
|
264
|
+
'invite.state.revoked': 'Questo invito è stato revocato. Chiedine uno nuovo a chi ti ha invitato.',
|
|
265
|
+
'invite.state.used': 'Questo invito è già stato usato. Accedi per aprire lo spazio di lavoro.',
|
|
266
|
+
'invite.state.expired': 'Questo invito è scaduto. Chiedine uno nuovo a chi ti ha invitato.',
|
|
267
|
+
'invite.wrongAddress': 'Questo invito è per un altro indirizzo email. Esci, poi accedi con l\'indirizzo a cui è stato inviato.',
|
|
268
|
+
'invite.alreadyMember': 'Sei già membro di questo spazio di lavoro.',
|
|
269
|
+
'invite.accountExists': 'Questo indirizzo ha già un account. Accedi per accettare l\'invito.',
|
|
270
|
+
'verify.continuedElsewhere': 'La registrazione continua nella finestra in cui l\'hai iniziata. Puoi chiudere questa.',
|
|
171
271
|
'handoff.invalid': 'Questo link di accesso non è valido. Ricomincia l\'accesso da {program}.',
|
|
172
272
|
'handoff.notOffered': 'Questa pagina non fa accedere altri programmi.',
|
|
173
273
|
'session.ended': 'La tua sessione è terminata. Accedi di nuovo.',
|
|
@@ -186,6 +286,16 @@ const pt = {
|
|
|
186
286
|
'invite.description': 'Foste convidado para {workspace}.',
|
|
187
287
|
'invite.notOffered': 'Ainda não é possível aceitar convites aqui. Pede a quem te convidou para tentar mais tarde.',
|
|
188
288
|
'invite.signInToAccept': 'Inicia sessão ou cria uma conta para aceitar o convite.',
|
|
289
|
+
'invite.signUpToAccept': 'Escolhe uma palavra-passe para aceitar o convite.',
|
|
290
|
+
'invite.signedInAs': 'Sessão iniciada como {email}.',
|
|
291
|
+
'invite.continue': 'Continuar',
|
|
292
|
+
'invite.state.revoked': 'Este convite foi revogado. Pede um novo a quem te convidou.',
|
|
293
|
+
'invite.state.used': 'Este convite já foi usado. Inicia sessão para abrir o espaço de trabalho.',
|
|
294
|
+
'invite.state.expired': 'Este convite expirou. Pede um novo a quem te convidou.',
|
|
295
|
+
'invite.wrongAddress': 'Este convite é para outro endereço de email. Termina a sessão e inicia-a com o endereço para onde foi enviado.',
|
|
296
|
+
'invite.alreadyMember': 'Já és membro deste espaço de trabalho.',
|
|
297
|
+
'invite.accountExists': 'Este endereço já tem uma conta. Inicia sessão para aceitar o convite.',
|
|
298
|
+
'verify.continuedElsewhere': 'O teu registo continua na janela onde o começaste. Podes fechar esta.',
|
|
189
299
|
'handoff.invalid': 'Este link de início de sessão não é válido. Começa de novo a partir de {program}.',
|
|
190
300
|
'handoff.notOffered': 'Esta página não inicia sessão noutros programas.',
|
|
191
301
|
'session.ended': 'A tua sessão terminou. Inicia sessão novamente.',
|
|
@@ -204,6 +314,16 @@ const pl = {
|
|
|
204
314
|
'invite.description': 'Masz zaproszenie do {workspace}.',
|
|
205
315
|
'invite.notOffered': 'Zaproszeń nie można jeszcze tu przyjąć. Poproś osobę, która cię zaprosiła, by spróbowała później.',
|
|
206
316
|
'invite.signInToAccept': 'Zaloguj się lub załóż konto, by przyjąć zaproszenie.',
|
|
317
|
+
'invite.signUpToAccept': 'Wybierz hasło, by przyjąć zaproszenie.',
|
|
318
|
+
'invite.signedInAs': 'Zalogowano jako {email}.',
|
|
319
|
+
'invite.continue': 'Dalej',
|
|
320
|
+
'invite.state.revoked': 'To zaproszenie zostało cofnięte. Poproś osobę, która cię zaprosiła, o nowe.',
|
|
321
|
+
'invite.state.used': 'To zaproszenie zostało już użyte. Zaloguj się, by otworzyć przestrzeń roboczą.',
|
|
322
|
+
'invite.state.expired': 'To zaproszenie wygasło. Poproś osobę, która cię zaprosiła, o nowe.',
|
|
323
|
+
'invite.wrongAddress': 'To zaproszenie jest dla innego adresu e-mail. Wyloguj się, a potem zaloguj adresem, na który je wysłano.',
|
|
324
|
+
'invite.alreadyMember': 'Należysz już do tej przestrzeni roboczej.',
|
|
325
|
+
'invite.accountExists': 'Ten adres ma już konto. Zaloguj się, by przyjąć zaproszenie.',
|
|
326
|
+
'verify.continuedElsewhere': 'Rejestracja trwa w oknie, w którym ją zaczęto. Możesz zamknąć to okno.',
|
|
207
327
|
'handoff.invalid': 'Ten link logowania jest nieprawidłowy. Zacznij logowanie od nowa w {program}.',
|
|
208
328
|
'handoff.notOffered': 'Ta strona nie loguje innych programów.',
|
|
209
329
|
'session.ended': 'Twoja sesja wygasła. Zaloguj się ponownie.',
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nebulr-group/bridge-svelte",
|
|
3
|
-
"version": "1.0.0-alpha.
|
|
3
|
+
"version": "1.0.0-alpha.1",
|
|
4
4
|
"description": "The Bridge for SvelteKit: sign-in in your own pages, workspaces, flag-based route guards, plans and checkout, the team panel and live updates, on one setting: the issuer.",
|
|
5
5
|
"author": "Iman Pouya",
|
|
6
6
|
"license": "MIT",
|
|
@@ -60,7 +60,7 @@
|
|
|
60
60
|
"@sveltejs/kit": "^2.0.0"
|
|
61
61
|
},
|
|
62
62
|
"dependencies": {
|
|
63
|
-
"@nebulr-group/bridge-auth-core": "1.0.0-alpha.
|
|
63
|
+
"@nebulr-group/bridge-auth-core": "1.0.0-alpha.2"
|
|
64
64
|
},
|
|
65
65
|
"devDependencies": {
|
|
66
66
|
"@sveltejs/kit": "^2.16.0",
|