@owlmeans/web-auth-email 0.0.0-stage → 0.1.19
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +116 -2
- package/THIRD-PARTY-NOTICES.txt +24 -0
- package/agent-meta/manifest.json +16 -0
- package/agent-meta/skills/web-auth-email/SKILL.md +119 -0
- package/build/@/components/ui/alert.d.ts +10 -0
- package/build/@/components/ui/alert.d.ts.map +1 -0
- package/build/@/components/ui/alert.js +26 -0
- package/build/@/components/ui/alert.js.map +1 -0
- package/build/@/components/ui/button.d.ts +11 -0
- package/build/@/components/ui/button.d.ts.map +1 -0
- package/build/@/components/ui/button.js +32 -0
- package/build/@/components/ui/button.js.map +1 -0
- package/build/@/components/ui/card.d.ts +10 -0
- package/build/@/components/ui/card.d.ts.map +1 -0
- package/build/@/components/ui/card.js +25 -0
- package/build/@/components/ui/card.js.map +1 -0
- package/build/@/components/ui/input.d.ts +4 -0
- package/build/@/components/ui/input.d.ts.map +1 -0
- package/build/@/components/ui/input.js +7 -0
- package/build/@/components/ui/input.js.map +1 -0
- package/build/@/components/ui/label.d.ts +5 -0
- package/build/@/components/ui/label.d.ts.map +1 -0
- package/build/@/components/ui/label.js +8 -0
- package/build/@/components/ui/label.js.map +1 -0
- package/build/@/lib/utils.d.ts +3 -0
- package/build/@/lib/utils.d.ts.map +1 -0
- package/build/@/lib/utils.js +6 -0
- package/build/@/lib/utils.js.map +1 -0
- package/build/append.d.ts +23 -0
- package/build/append.d.ts.map +1 -0
- package/build/append.js +49 -0
- package/build/append.js.map +1 -0
- package/build/components/connected.d.ts +8 -0
- package/build/components/connected.d.ts.map +1 -0
- package/build/components/connected.js +16 -0
- package/build/components/connected.js.map +1 -0
- package/build/components/credit.d.ts +5 -0
- package/build/components/credit.d.ts.map +1 -0
- package/build/components/credit.js +16 -0
- package/build/components/credit.js.map +1 -0
- package/build/components/fields.d.ts +23 -0
- package/build/components/fields.d.ts.map +1 -0
- package/build/components/fields.js +39 -0
- package/build/components/fields.js.map +1 -0
- package/build/components/index.d.ts +9 -0
- package/build/components/index.d.ts.map +1 -0
- package/build/components/index.js +8 -0
- package/build/components/index.js.map +1 -0
- package/build/components/offer.d.ts +9 -0
- package/build/components/offer.d.ts.map +1 -0
- package/build/components/offer.js +99 -0
- package/build/components/offer.js.map +1 -0
- package/build/components/panel.d.ts +12 -0
- package/build/components/panel.d.ts.map +1 -0
- package/build/components/panel.js +129 -0
- package/build/components/panel.js.map +1 -0
- package/build/components/route.d.ts +9 -0
- package/build/components/route.d.ts.map +1 -0
- package/build/components/route.js +17 -0
- package/build/components/route.js.map +1 -0
- package/build/components/screen.d.ts +17 -0
- package/build/components/screen.d.ts.map +1 -0
- package/build/components/screen.js +79 -0
- package/build/components/screen.js.map +1 -0
- package/build/components/types.d.ts +81 -0
- package/build/components/types.d.ts.map +1 -0
- package/build/components/types.js +2 -0
- package/build/components/types.js.map +1 -0
- package/build/consts.d.ts +37 -0
- package/build/consts.d.ts.map +1 -0
- package/build/consts.js +43 -0
- package/build/consts.js.map +1 -0
- package/build/entrypoints.d.ts +10 -0
- package/build/entrypoints.d.ts.map +1 -0
- package/build/entrypoints.js +14 -0
- package/build/entrypoints.js.map +1 -0
- package/build/hooks/consts.local.d.ts +4 -0
- package/build/hooks/consts.local.d.ts.map +1 -0
- package/build/hooks/consts.local.js +9 -0
- package/build/hooks/consts.local.js.map +1 -0
- package/build/hooks/types.d.ts +78 -0
- package/build/hooks/types.d.ts.map +1 -0
- package/build/hooks/types.js +2 -0
- package/build/hooks/types.js.map +1 -0
- package/build/hooks/use-email-login.d.ts +13 -0
- package/build/hooks/use-email-login.d.ts.map +1 -0
- package/build/hooks/use-email-login.js +208 -0
- package/build/hooks/use-email-login.js.map +1 -0
- package/build/hooks/use-password.d.ts +13 -0
- package/build/hooks/use-password.d.ts.map +1 -0
- package/build/hooks/use-password.js +118 -0
- package/build/hooks/use-password.js.map +1 -0
- package/build/hooks/use-translate.d.ts +7 -0
- package/build/hooks/use-translate.d.ts.map +1 -0
- package/build/hooks/use-translate.js +12 -0
- package/build/hooks/use-translate.js.map +1 -0
- package/build/i18n/auth/be.json +7 -0
- package/build/i18n/auth/de.json +7 -0
- package/build/i18n/auth/en.json +7 -0
- package/build/i18n/auth/es.json +7 -0
- package/build/i18n/auth/fr.json +7 -0
- package/build/i18n/auth/pl.json +7 -0
- package/build/i18n/auth/ru.json +7 -0
- package/build/i18n/auth/uk.json +7 -0
- package/build/i18n/be.json +100 -0
- package/build/i18n/de.json +100 -0
- package/build/i18n/en.json +100 -0
- package/build/i18n/es.json +100 -0
- package/build/i18n/fr.json +100 -0
- package/build/i18n/pl.json +100 -0
- package/build/i18n/ru.json +100 -0
- package/build/i18n/uk.json +100 -0
- package/build/i18n.d.ts +2 -0
- package/build/i18n.d.ts.map +1 -0
- package/build/i18n.js +40 -0
- package/build/i18n.js.map +1 -0
- package/build/index.d.ts +23 -0
- package/build/index.d.ts.map +1 -0
- package/build/index.js +17 -0
- package/build/index.js.map +1 -0
- package/build/password/types.d.ts +39 -0
- package/build/password/types.d.ts.map +1 -0
- package/build/password/types.js +2 -0
- package/build/password/types.js.map +1 -0
- package/build/password.d.ts +4 -0
- package/build/password.d.ts.map +1 -0
- package/build/password.js +45 -0
- package/build/password.js.map +1 -0
- package/build/plugin.d.ts +10 -0
- package/build/plugin.d.ts.map +1 -0
- package/build/plugin.js +21 -0
- package/build/plugin.js.map +1 -0
- package/build/refusal/consts.local.d.ts +3 -0
- package/build/refusal/consts.local.d.ts.map +1 -0
- package/build/refusal/consts.local.js +3 -0
- package/build/refusal/consts.local.js.map +1 -0
- package/build/refusal/types.d.ts +38 -0
- package/build/refusal/types.d.ts.map +1 -0
- package/build/refusal/types.js +2 -0
- package/build/refusal/types.js.map +1 -0
- package/build/refusal.d.ts +4 -0
- package/build/refusal.d.ts.map +1 -0
- package/build/refusal.js +131 -0
- package/build/refusal.js.map +1 -0
- package/build/service.d.ts +12 -0
- package/build/service.d.ts.map +1 -0
- package/build/service.js +66 -0
- package/build/service.js.map +1 -0
- package/build/state/types.d.ts +90 -0
- package/build/state/types.d.ts.map +1 -0
- package/build/state/types.js +2 -0
- package/build/state/types.js.map +1 -0
- package/build/state.d.ts +4 -0
- package/build/state.d.ts.map +1 -0
- package/build/state.js +98 -0
- package/build/state.js.map +1 -0
- package/build/step.d.ts +16 -0
- package/build/step.d.ts.map +1 -0
- package/build/step.js +31 -0
- package/build/step.js.map +1 -0
- package/build/storage/types.d.ts +42 -0
- package/build/storage/types.d.ts.map +1 -0
- package/build/storage/types.js +2 -0
- package/build/storage/types.js.map +1 -0
- package/build/storage.d.ts +4 -0
- package/build/storage.d.ts.map +1 -0
- package/build/storage.js +100 -0
- package/build/storage.js.map +1 -0
- package/build/types.d.ts +102 -0
- package/build/types.d.ts.map +1 -0
- package/build/types.js +2 -0
- package/build/types.js.map +1 -0
- package/build/utils/account.d.ts +4 -0
- package/build/utils/account.d.ts.map +1 -0
- package/build/utils/account.js +11 -0
- package/build/utils/account.js.map +1 -0
- package/build/utils/locale.d.ts +6 -0
- package/build/utils/locale.d.ts.map +1 -0
- package/build/utils/locale.js +10 -0
- package/build/utils/locale.js.map +1 -0
- package/build/utils/text/types.d.ts +23 -0
- package/build/utils/text/types.d.ts.map +1 -0
- package/build/utils/text/types.js +2 -0
- package/build/utils/text/types.js.map +1 -0
- package/build/utils/text.d.ts +4 -0
- package/build/utils/text.d.ts.map +1 -0
- package/build/utils/text.js +26 -0
- package/build/utils/text.js.map +1 -0
- package/build/utils.d.ts +8 -0
- package/build/utils.d.ts.map +1 -0
- package/build/utils.js +9 -0
- package/build/utils.js.map +1 -0
- package/components.json +21 -0
- package/package.json +71 -4
- package/src/@/components/ui/alert.tsx +70 -0
- package/src/@/components/ui/button.tsx +60 -0
- package/src/@/components/ui/card.tsx +93 -0
- package/src/@/components/ui/input.tsx +22 -0
- package/src/@/components/ui/label.tsx +23 -0
- package/src/@/globals.css +57 -0
- package/src/@/lib/utils.ts +6 -0
- package/src/append.ts +65 -0
- package/src/components/connected.tsx +36 -0
- package/src/components/credit.tsx +30 -0
- package/src/components/fields.tsx +112 -0
- package/src/components/index.ts +8 -0
- package/src/components/offer.tsx +197 -0
- package/src/components/panel.tsx +299 -0
- package/src/components/route.tsx +20 -0
- package/src/components/screen.tsx +253 -0
- package/src/components/types.ts +85 -0
- package/src/consts.ts +53 -0
- package/src/entrypoints.ts +15 -0
- package/src/hooks/consts.local.ts +12 -0
- package/src/hooks/types.ts +79 -0
- package/src/hooks/use-email-login.ts +234 -0
- package/src/hooks/use-password.ts +137 -0
- package/src/hooks/use-translate.ts +14 -0
- package/src/i18n/auth/be.json +7 -0
- package/src/i18n/auth/de.json +7 -0
- package/src/i18n/auth/en.json +7 -0
- package/src/i18n/auth/es.json +7 -0
- package/src/i18n/auth/fr.json +7 -0
- package/src/i18n/auth/pl.json +7 -0
- package/src/i18n/auth/ru.json +7 -0
- package/src/i18n/auth/uk.json +7 -0
- package/src/i18n/be.json +100 -0
- package/src/i18n/de.json +100 -0
- package/src/i18n/en.json +100 -0
- package/src/i18n/es.json +100 -0
- package/src/i18n/fr.json +100 -0
- package/src/i18n/pl.json +100 -0
- package/src/i18n/ru.json +100 -0
- package/src/i18n/uk.json +100 -0
- package/src/i18n.ts +43 -0
- package/src/index.ts +22 -0
- package/src/password/types.ts +43 -0
- package/src/password.ts +65 -0
- package/src/plugin.ts +22 -0
- package/src/refusal/consts.local.ts +2 -0
- package/src/refusal/types.ts +64 -0
- package/src/refusal.ts +145 -0
- package/src/service.ts +95 -0
- package/src/state/types.ts +72 -0
- package/src/state.ts +115 -0
- package/src/step.ts +38 -0
- package/src/storage/types.ts +43 -0
- package/src/storage.ts +113 -0
- package/src/types.ts +111 -0
- package/src/utils/account.ts +12 -0
- package/src/utils/locale.ts +11 -0
- package/src/utils/text/types.ts +24 -0
- package/src/utils/text.ts +34 -0
- package/src/utils.ts +9 -0
- package/tests/helpers.ts +22 -0
- package/tests/i18n.spec.ts +94 -0
- package/tests/package-boundary.spec.ts +35 -0
- package/tests/password.spec.ts +56 -0
- package/tests/refusal.spec.ts +91 -0
- package/tests/state.spec.ts +99 -0
- package/tests/step.spec.ts +82 -0
- package/tests/storage.spec.ts +83 -0
- package/tsconfig.json +21 -0
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { isValidElement, useId } from 'react';
|
|
3
|
+
import { Loader2 } from 'lucide-react';
|
|
4
|
+
import { useLanguage } from '@owlmeans/client-i18n';
|
|
5
|
+
import { EMAIL_ADDRESS_MAX_LENGTH } from '@owlmeans/auth-email';
|
|
6
|
+
import { Button } from '../@/components/ui/button.js';
|
|
7
|
+
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from '../@/components/ui/card.js';
|
|
8
|
+
import { Input } from '../@/components/ui/input.js';
|
|
9
|
+
import { Label } from '../@/components/ui/label.js';
|
|
10
|
+
import { cn } from '../@/lib/utils.js';
|
|
11
|
+
import { useEmailLogin } from '../hooks/use-email-login.js';
|
|
12
|
+
import { useEmailAuthTranslate } from '../hooks/use-translate.js';
|
|
13
|
+
import { emailLoginStateHelper } from '../state.js';
|
|
14
|
+
import { textUtils } from '../utils/text.js';
|
|
15
|
+
import { CaptchaNotice, PasswordInput, PinInput, RefusalAlert, SubmitButton } from './fields.js';
|
|
16
|
+
import { EmailLoginCredit } from './credit.js';
|
|
17
|
+
const english = (_key, defaultValue) => defaultValue;
|
|
18
|
+
/**
|
|
19
|
+
* The e-mail sign-in card — the chooser card's twin (`@owlmeans/web-panel`'s `LoginScreen`): the
|
|
20
|
+
* same centred card, logo, title, subtitle and footer slot, the same inline viewport height.
|
|
21
|
+
*
|
|
22
|
+
* Three steps share it: the address ("Receive authentication PIN code"), the mailed PIN, and — only
|
|
23
|
+
* where the deployment offers passwords — the address with a password. Enter submits the step on
|
|
24
|
+
* screen. Nothing on it is ever natively `disabled`.
|
|
25
|
+
*
|
|
26
|
+
* Pure with respect to i18n: `translate` is a prop (English without it), `locale` too.
|
|
27
|
+
* `LocalizedEmailLoginScreen` binds both to the application's own.
|
|
28
|
+
*/
|
|
29
|
+
export const EmailLoginScreen = props => {
|
|
30
|
+
const t = props.translate ?? english;
|
|
31
|
+
const model = useEmailLogin({ locale: props.locale });
|
|
32
|
+
const { state } = model;
|
|
33
|
+
const id = useId();
|
|
34
|
+
const busy = state.busy != null;
|
|
35
|
+
const Logo = props.Logo;
|
|
36
|
+
const onSubmit = (event) => {
|
|
37
|
+
event.preventDefault();
|
|
38
|
+
void model.submit();
|
|
39
|
+
};
|
|
40
|
+
const subtitle = props.subtitle ?? (state.step === 'password'
|
|
41
|
+
? t('login.password-subtitle', 'Sign in with your email and password.')
|
|
42
|
+
: state.step === 'pin'
|
|
43
|
+
? t('login.pin-subtitle', 'Check your inbox for the code.')
|
|
44
|
+
: t('login.subtitle', "We'll email you a code to sign in. New here? The same code creates your account."));
|
|
45
|
+
const emailField = (autoFocus) => _jsxs("div", { className: "flex flex-col gap-2 text-left", children: [_jsx(Label, { htmlFor: `${id}-email`, children: t('login.email-label', 'Email') }), _jsx(Input, { id: `${id}-email`, name: "email", "data-email-login-email": true, type: "email", inputMode: "email", autoComplete: "username", autoCapitalize: "none", autoCorrect: "off", spellCheck: false, maxLength: EMAIL_ADDRESS_MAX_LENGTH, placeholder: t('login.email-placeholder', 'you@example.com'), value: state.email, readOnly: busy, autoFocus: autoFocus, "aria-invalid": state.refusal?.kind === 'email' || undefined, className: "h-11 text-base", onChange: event => model.setEmail(event.target.value) })] });
|
|
46
|
+
const link = 'h-11 px-2 text-sm';
|
|
47
|
+
// A tertiary button: no fill and no visible border until hovered, the primary text colour kept.
|
|
48
|
+
const tertiary = 'h-11 px-3 text-sm text-primary border border-transparent hover:border-border hover:text-primary';
|
|
49
|
+
const step = (() => {
|
|
50
|
+
switch (state.step) {
|
|
51
|
+
case 'pin':
|
|
52
|
+
return _jsxs("form", { noValidate: true, onSubmit: onSubmit, "data-email-login-form": "pin", className: "flex flex-col gap-4", children: [_jsx("p", { role: "status", "data-email-login-notice": state.notice ?? 'sent', className: "text-center text-sm", children: state.notice === 'device'
|
|
53
|
+
? t('login.device', "We don't recognise this device. Enter the code we sent to your email.")
|
|
54
|
+
: textUtils.fill(t('login.sent', 'We sent a sign-in code to {{email}}.'), {
|
|
55
|
+
email: emailLoginStateHelper.normalizeEmail(state.email),
|
|
56
|
+
}) }), _jsxs("div", { className: "flex flex-col gap-2 text-left", children: [_jsx(Label, { htmlFor: `${id}-pin`, children: t('login.pin-label', 'Code from the email') }), _jsx(PinInput, { id: `${id}-pin`, name: "pin", "data-email-login-pin": true, length: model.pinLength, value: state.pin, readOnly: busy, autoFocus: true, "aria-invalid": state.refusal?.kind === 'code' || state.refusal?.kind === 'pin-format' || undefined, onChange: event => model.setPin(event.target.value) })] }), _jsx(SubmitButton, { "data-email-login-submit": true, "data-mode": "pin", busy: state.busy === 'sign-in', blocked: emailLoginStateHelper.verifyBlock(state) != null, children: state.busy === 'sign-in' ? t('login.verifying', 'Signing in…') : t('login.verify', 'Sign in') }), _jsxs("div", { className: "flex flex-col items-center justify-center gap-1 sm:flex-row sm:gap-4", children: [_jsx(Button, { type: "button", variant: "link", "data-email-login-resend": true, "aria-busy": state.busy === 'send' || undefined, className: link, onClick: () => void model.send(), children: state.busy === 'send' ? t('login.sending', 'Sending…') : t('login.resend', 'Send a new code') }), _jsx(Button, { type: "button", variant: "link", "data-email-login-change": true, className: link, onClick: model.changeEmail, children: t('login.change-email', 'Change email') })] })] });
|
|
57
|
+
case 'password':
|
|
58
|
+
return _jsxs("form", { noValidate: true, onSubmit: onSubmit, "data-email-login-form": "password", className: "flex flex-col gap-4", children: [emailField(false), _jsxs("div", { className: "flex flex-col gap-2 text-left", children: [_jsx(Label, { htmlFor: `${id}-password`, children: t('login.password-label', 'Password') }), _jsx(PasswordInput, { id: `${id}-password`, name: "password", "data-email-login-password": true, autoComplete: "current-password", value: state.password, readOnly: busy, autoFocus: true, "aria-invalid": state.refusal?.kind === 'credentials' || state.refusal?.kind === 'password-empty'
|
|
59
|
+
|| undefined, reveal: state.reveal, onReveal: model.setReveal, showLabel: t('login.show-password', 'Show password'), hideLabel: t('login.hide-password', 'Hide password'), toggleProps: { 'data-email-login-password-toggle': '' }, onChange: event => model.setPassword(event.target.value) })] }), _jsx(SubmitButton, { "data-email-login-submit": true, "data-mode": "password", busy: state.busy === 'sign-in', blocked: emailLoginStateHelper.signInBlock(state) != null, children: state.busy === 'sign-in' ? t('login.verifying', 'Signing in…') : t('login.password-submit', 'Sign in') }), _jsx(Button, { type: "button", variant: "link", "data-email-login-use-pin": true, className: link, onClick: model.choosePin, children: t('login.use-pin', 'Sign in with a code instead') })] });
|
|
60
|
+
case 'done':
|
|
61
|
+
return _jsxs("p", { role: "status", "data-email-login-done": true, className: "flex items-center justify-center gap-2 text-sm", children: [_jsx(Loader2, { className: "size-4 animate-spin", "aria-hidden": true }), t('login.done', 'Signing you in…')] });
|
|
62
|
+
default:
|
|
63
|
+
return _jsxs("form", { noValidate: true, onSubmit: onSubmit, "data-email-login-form": "email", className: "flex flex-col gap-4", children: [emailField(true), _jsx(SubmitButton, { "data-email-login-send": true, busy: state.busy === 'send', blocked: emailLoginStateHelper.sendBlock(state) != null, children: state.busy === 'send' ? t('login.sending', 'Sending…') : t('login.send', 'Receive authentication PIN code') }), model.passwordOffered && _jsx(Button, { type: "button", variant: "ghost", "data-email-login-use-password": true, className: tertiary, onClick: model.choosePassword, children: t('login.use-password', 'Already set a password? Use it') })] });
|
|
64
|
+
}
|
|
65
|
+
})();
|
|
66
|
+
const card = _jsxs(Card, { "data-email-login-card": true, className: cn('w-full max-w-sm', props.containerClassName), children: [_jsxs(CardHeader, { className: "items-center gap-2 text-center", children: [Logo != null && _jsx("div", { className: "flex justify-center pb-2", children: isValidElement(Logo) ? Logo : typeof Logo === 'function' ? _jsx(Logo, { className: "h-10 w-auto" }) : Logo }), _jsx(CardTitle, { className: "text-xl", children: props.title ?? t('login.title', 'Sign in with email') }), _jsx(CardDescription, { children: subtitle })] }), _jsxs(CardContent, { className: "flex flex-col gap-4", children: [step, _jsx(RefusalAlert, { refusal: state.refusal, t: t, locale: props.locale, marker: "data-email-login-error" }), state.optionsFailed && state.options == null && state.refusal == null
|
|
67
|
+
&& _jsxs("div", { "data-email-login-options-error": true, className: "flex flex-col items-center gap-1 text-center text-sm", children: [_jsx("p", { role: "alert", className: "text-destructive", children: t('login.options-failed', "We couldn't load the sign-in settings.") }), _jsx(Button, { type: "button", variant: "link", "data-email-login-retry": true, className: link, onClick: () => void model.retryOptions(), children: t('login.retry', 'Try again') })] }), model.captcha && state.step !== 'pin' && state.step !== 'done' && _jsx(CaptchaNotice, { t: t }), model.otherOptions != null && state.step !== 'done' && _jsx("a", { href: model.otherOptions.href, "data-email-login-other": true, className: "inline-flex h-11 items-center justify-center text-sm text-muted-foreground underline-offset-4 hover:text-foreground hover:underline", onClick: model.otherOptions.go, children: t('login.other', 'Other sign-in options') })] }), _jsx("div", { className: "px-6", children: props.footer ?? _jsx(EmailLoginCredit, { t: t }) })] });
|
|
68
|
+
// The viewport height is INLINE, like the chooser's: this screen is rendered straight out of the
|
|
69
|
+
// authentication route into a chain that carries no height, and a utility class new to the
|
|
70
|
+
// consumer's stylesheet is exactly what a stale `@source` scan drops. `props.style` still wins.
|
|
71
|
+
return _jsx("div", { "data-email-login-screen": true, "data-step": state.step, "data-busy": state.busy ?? undefined, style: { minHeight: '100dvh', ...props.style }, className: cn('flex w-full items-center justify-center p-4', props.className), children: card });
|
|
72
|
+
};
|
|
73
|
+
/** {@link EmailLoginScreen} bound to the application's own translations and language. */
|
|
74
|
+
export const LocalizedEmailLoginScreen = props => {
|
|
75
|
+
const t = useEmailAuthTranslate();
|
|
76
|
+
const [lng] = useLanguage();
|
|
77
|
+
return _jsx(EmailLoginScreen, { ...props, translate: props.translate ?? t, locale: props.locale ?? lng });
|
|
78
|
+
};
|
|
79
|
+
//# sourceMappingUR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C,IAAI,kCAE7B,SAAS,EAAC,qIAAqI,EAC/I,OAAO,EAAE,KAAK,CAAC,YAAY,CAAC,EAAE,YAE7B,CAAC,CAAC,aAAa,EAAE,uBAAuB,CAAC,GACxC,IACQ,EAEd,cAAK,SAAS,EAAC,MAAM,YAClB,KAAK,CAAC,MAAM,IAAI,KAAC,gBAAgB,IAAC,CAAC,EAAE,CAAC,GAAI,GACvC,IACD,CAAA;IAEP,iGAAiG;IACjG,2FAA2F;IAC3F,gGAAgG;IAChG,OAAO,4DAEM,KAAK,CAAC,IAAI,eACV,KAAK,CAAC,IAAI,IAAI,SAAS,EAClC,KAAK,EAAE,EAAE,SAAS,EAAE,QAAQ,EAAE,GAAG,KAAK,CAAC,KAAK,EAAE,EAC9C,SAAS,EAAE,EAAE,CAAC,6CAA6C,EAAE,KAAK,CAAC,SAAS,CAAC,YAE5E,IAAI,GACD,CAAA;AACR,CAAC,CAAA;AAED,yFAAyF;AACzF,MAAM,CAAC,MAAM,yBAAyB,GAA8B,KAAK,CAAC,EAAE;IAC1E,MAAM,CAAC,GAAG,qBAAqB,EAAE,CAAA;IACjC,MAAM,CAAC,GAAG,CAAC,GAAG,WAAW,EAAE,CAAA;IAE3B,OAAO,KAAC,gBAAgB,OAAK,KAAK,EAAE,SAAS,EAAE,KAAK,CAAC,SAAS,IAAI,CAAC,EAAE,MAAM,EAAE,KAAK,CAAC,MAAM,IAAI,GAAG,GAAI,CAAA;AACtG,CAAC,CAAA"}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import type { ComponentProps, ReactNode } from 'react';
|
|
2
|
+
import type { EmailPasswordPurpose, EmailPasswordStatusView } from '@owlmeans/auth-email';
|
|
3
|
+
import type { EmailRefusal } from '../refusal/types.js';
|
|
4
|
+
import type { EmailPasswordAction } from '../password/types.js';
|
|
5
|
+
import type { EmailPasswordAliases, Translate } from '../types.js';
|
|
6
|
+
/** A password field with a show/hide toggle; every other prop goes to the `<input>`. */
|
|
7
|
+
export interface PasswordInputProps extends Omit<ComponentProps<'input'>, 'type'> {
|
|
8
|
+
reveal: boolean;
|
|
9
|
+
onReveal: (value: boolean) => void;
|
|
10
|
+
/** The toggle's accessible name while the password is hidden. */
|
|
11
|
+
showLabel: string;
|
|
12
|
+
/** The toggle's accessible name while the password is shown. */
|
|
13
|
+
hideLabel: string;
|
|
14
|
+
/** `data-*` hooks for the toggle button. */
|
|
15
|
+
toggleProps?: Record<`data-${string}`, string>;
|
|
16
|
+
}
|
|
17
|
+
/** A PIN field: digits only, the one-time-code autofill, as many characters as the PIN has. */
|
|
18
|
+
export interface PinInputProps extends Omit<ComponentProps<'input'>, 'type' | 'inputMode' | 'autoComplete' | 'maxLength'> {
|
|
19
|
+
length: number;
|
|
20
|
+
}
|
|
21
|
+
/** A primary submit button that is never natively `disabled` — see the screen. */
|
|
22
|
+
export interface SubmitButtonProps extends ComponentProps<'button'> {
|
|
23
|
+
busy: boolean;
|
|
24
|
+
/** The action cannot go yet; pressing it says why (`aria-disabled`, never `disabled`). */
|
|
25
|
+
blocked?: boolean;
|
|
26
|
+
}
|
|
27
|
+
export interface RefusalAlertProps {
|
|
28
|
+
refusal: EmailRefusal | null;
|
|
29
|
+
t: Translate;
|
|
30
|
+
locale?: string;
|
|
31
|
+
/** The `data-*` attribute that marks this alert for tests (`data-email-login-error`, …). */
|
|
32
|
+
marker: `data-${string}`;
|
|
33
|
+
className?: string;
|
|
34
|
+
}
|
|
35
|
+
export interface CaptchaNoticeProps {
|
|
36
|
+
t: Translate;
|
|
37
|
+
className?: string;
|
|
38
|
+
}
|
|
39
|
+
export interface EmailLoginCreditProps {
|
|
40
|
+
t: Translate;
|
|
41
|
+
className?: string;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* The password surface, as a function of what it is given — no I/O: it renders what it is handed
|
|
45
|
+
* and reports what was pressed. `ConnectedPasswordPanel` is this panel wired to `usePassword`.
|
|
46
|
+
*/
|
|
47
|
+
export interface PasswordPanelProps {
|
|
48
|
+
status: EmailPasswordStatusView | null;
|
|
49
|
+
loading?: boolean;
|
|
50
|
+
/** A PIN request or a confirmation is in flight. */
|
|
51
|
+
busy?: boolean;
|
|
52
|
+
/** The purpose a confirmation PIN was mailed for; the panel shows the PIN step while it is set. */
|
|
53
|
+
pending?: EmailPasswordPurpose | null;
|
|
54
|
+
refusal?: EmailRefusal | null;
|
|
55
|
+
/** The last action that went through. */
|
|
56
|
+
done?: EmailPasswordAction | null;
|
|
57
|
+
/** Mail a confirmation PIN. Resolves whether it was sent. */
|
|
58
|
+
onSendPin: (purpose: EmailPasswordPurpose) => Promise<boolean>;
|
|
59
|
+
/** Confirm the open action. Resolves whether it went through; the panel closes the action then. */
|
|
60
|
+
onConfirm: (action: EmailPasswordAction, input: {
|
|
61
|
+
pin: string;
|
|
62
|
+
password?: string;
|
|
63
|
+
}) => Promise<boolean>;
|
|
64
|
+
/** The open action was abandoned. */
|
|
65
|
+
onCancel: () => void;
|
|
66
|
+
/** Read the status again after it could not be read. */
|
|
67
|
+
onReload?: () => Promise<void> | void;
|
|
68
|
+
/** Already-translated header copy; the package's own by default. */
|
|
69
|
+
title?: ReactNode;
|
|
70
|
+
description?: ReactNode;
|
|
71
|
+
translate?: Translate;
|
|
72
|
+
locale?: string;
|
|
73
|
+
className?: string;
|
|
74
|
+
}
|
|
75
|
+
export interface ConnectedPasswordPanelProps extends Pick<PasswordPanelProps, 'title' | 'description' | 'className'> {
|
|
76
|
+
/** Where the password routes are mounted; see `EmailPasswordAliases`. */
|
|
77
|
+
aliases?: EmailPasswordAliases;
|
|
78
|
+
/** Overrides the package's own translator. */
|
|
79
|
+
translate?: Translate;
|
|
80
|
+
}
|
|
81
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/components/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;A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AC;IAClH,yEAAyE;IACzE,OAAO,CAAC,EAAE,oBAAoB,CAAA;IAC9B,8CAA8C;IAC9C,SAAS,CAAC,EAAE,SAAS,CAAA;CACtB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/components/types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import type { AuthMethodMeta } from '@owlmeans/client-auth/manager/plugins';
|
|
2
|
+
/**
|
|
3
|
+
* The library-tier i18n resource this package's own strings live in (`lib : auth-email.*`).
|
|
4
|
+
*
|
|
5
|
+
* An application overrides any of them by registering the same resource at the app tier, in the
|
|
6
|
+
* library namespace — see the README.
|
|
7
|
+
*/
|
|
8
|
+
export declare const EMAIL_AUTH_I18N = "auth-email";
|
|
9
|
+
/**
|
|
10
|
+
* The library resource `@owlmeans/client-auth/login` fills with the sign-in screen's copy. This
|
|
11
|
+
* package adds one key to it — `login.method.email`, the chooser button's label.
|
|
12
|
+
*/
|
|
13
|
+
export declare const AUTH_I18N = "auth";
|
|
14
|
+
/** Where the browser keeps its e-mail sign-in device id (`localStorage`). */
|
|
15
|
+
export declare const EMAIL_DEVICE_STORAGE = "owlmeans:auth-email:device";
|
|
16
|
+
/** Where a PIN sign-in's one-use "set a password" offer ticket waits for the offer step (`sessionStorage`). */
|
|
17
|
+
export declare const EMAIL_OFFER_STORAGE = "owlmeans:auth-email:offer";
|
|
18
|
+
/** Random bytes in a device id: 16 bytes are 22 base64url characters (`EMAIL_DEVICE_ID_PATTERN`). */
|
|
19
|
+
export declare const EMAIL_DEVICE_ID_BYTES = 16;
|
|
20
|
+
/** `LoginStep.alias` of the post-sign-in password offer — the same name as its screen's route. */
|
|
21
|
+
export declare const EMAIL_OFFER_LOGIN_STEP = "auth-email:offer";
|
|
22
|
+
/**
|
|
23
|
+
* Below the marketing-consent step (which declares none, so `0`): a Terms confirmation and the
|
|
24
|
+
* consent choices come first, the optional password offer last.
|
|
25
|
+
*/
|
|
26
|
+
export declare const EMAIL_OFFER_STEP_PRIORITY = -10;
|
|
27
|
+
/**
|
|
28
|
+
* How the e-mail method presents itself on the sign-in chooser. `appendEmailLogin({ method })`
|
|
29
|
+
* merges over it, and `cfg.security.auth.login.overrides.email` over both.
|
|
30
|
+
*/
|
|
31
|
+
export declare const EMAIL_LOGIN_METHOD_META: Readonly<AuthMethodMeta>;
|
|
32
|
+
/** Google's documents the reCAPTCHA notice links to (the badge itself is hidden). */
|
|
33
|
+
export declare const RECAPTCHA_PRIVACY_URL = "https://policies.google.com/privacy";
|
|
34
|
+
export declare const RECAPTCHA_TERMS_URL = "https://policies.google.com/terms";
|
|
35
|
+
/** Where "Powered by OwlMeans" leads, as on the chooser card. */
|
|
36
|
+
export declare const OWLMEANS_URL = "https://owlmeans.com";
|
|
37
|
+
//# sourceMappingURL=consts.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"consts.d.ts","sourceRoot":"","sources":["../src/consts.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uCAAuC,CAAA;AAE3E;;;;;GAKG;AACH,eAAO,MAAM,eAAe,eAAe,CAAA;AAE3C;;;GAGG;AACH,eAAO,MAAM,SAAS,SAAS,CAAA;AAE/B,6EAA6E;AAC7E,eAAO,MAAM,oBAAoB,+BAA+B,CAAA;AAEhE,+GAA+G;AAC/G,eAAO,MAAM,mBAAmB,8BAA8B,CAAA;AAE9D,qGAAqG;AACrG,eAAO,MAAM,qBAAqB,KAAK,CAAA;AAEvC,kGAAkG;AAClG,eAAO,MAAM,sBAAsB,qBAAmB,CAAA;AAEtD;;;GAGG;AACH,eAAO,MAAM,yBAAyB,MAAM,CAAA;AAE5C;;;GAGG;AACH,eAAO,MAAM,uBAAuB,EAAE,QAAQ,CAAC,cAAc,CAM3D,CAAA;AAEF,qFAAqF;AACrF,eAAO,MAAM,qBAAqB,wCAAwC,CAAA;AAC1E,eAAO,MAAM,mBAAmB,sCAAsC,CAAA;AAEtE,iEAAiE;AACjE,eAAO,MAAM,YAAY,yBAAyB,CAAA"}
|
package/build/consts.js
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { EMAIL_AUTH_OFFER, EMAIL_LOGIN_METHOD } from '@owlmeans/auth-email';
|
|
2
|
+
/**
|
|
3
|
+
* The library-tier i18n resource this package's own strings live in (`lib : auth-email.*`).
|
|
4
|
+
*
|
|
5
|
+
* An application overrides any of them by registering the same resource at the app tier, in the
|
|
6
|
+
* library namespace — see the README.
|
|
7
|
+
*/
|
|
8
|
+
export const EMAIL_AUTH_I18N = 'auth-email';
|
|
9
|
+
/**
|
|
10
|
+
* The library resource `@owlmeans/client-auth/login` fills with the sign-in screen's copy. This
|
|
11
|
+
* package adds one key to it — `login.method.email`, the chooser button's label.
|
|
12
|
+
*/
|
|
13
|
+
export const AUTH_I18N = 'auth';
|
|
14
|
+
/** Where the browser keeps its e-mail sign-in device id (`localStorage`). */
|
|
15
|
+
export const EMAIL_DEVICE_STORAGE = 'owlmeans:auth-email:device';
|
|
16
|
+
/** Where a PIN sign-in's one-use "set a password" offer ticket waits for the offer step (`sessionStorage`). */
|
|
17
|
+
export const EMAIL_OFFER_STORAGE = 'owlmeans:auth-email:offer';
|
|
18
|
+
/** Random bytes in a device id: 16 bytes are 22 base64url characters (`EMAIL_DEVICE_ID_PATTERN`). */
|
|
19
|
+
export const EMAIL_DEVICE_ID_BYTES = 16;
|
|
20
|
+
/** `LoginStep.alias` of the post-sign-in password offer — the same name as its screen's route. */
|
|
21
|
+
export const EMAIL_OFFER_LOGIN_STEP = EMAIL_AUTH_OFFER;
|
|
22
|
+
/**
|
|
23
|
+
* Below the marketing-consent step (which declares none, so `0`): a Terms confirmation and the
|
|
24
|
+
* consent choices come first, the optional password offer last.
|
|
25
|
+
*/
|
|
26
|
+
export const EMAIL_OFFER_STEP_PRIORITY = -10;
|
|
27
|
+
/**
|
|
28
|
+
* How the e-mail method presents itself on the sign-in chooser. `appendEmailLogin({ method })`
|
|
29
|
+
* merges over it, and `cfg.security.auth.login.overrides.email` over both.
|
|
30
|
+
*/
|
|
31
|
+
export const EMAIL_LOGIN_METHOD_META = Object.freeze({
|
|
32
|
+
id: EMAIL_LOGIN_METHOD,
|
|
33
|
+
i18nKey: EMAIL_LOGIN_METHOD,
|
|
34
|
+
icon: 'mail',
|
|
35
|
+
order: 20,
|
|
36
|
+
emphasis: 'secondary',
|
|
37
|
+
});
|
|
38
|
+
/** Google's documents the reCAPTCHA notice links to (the badge itself is hidden). */
|
|
39
|
+
export const RECAPTCHA_PRIVACY_URL = 'https://policies.google.com/privacy';
|
|
40
|
+
export const RECAPTCHA_TERMS_URL = 'https://policies.google.com/terms';
|
|
41
|
+
/** Where "Powered by OwlMeans" leads, as on the chooser card. */
|
|
42
|
+
export const OWLMEANS_URL = 'https://owlmeans.com';
|
|
43
|
+
//# sourceMappingURL=consts.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"consts.js","sourceRoot":"","sources":["../src/consts.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAA;AAG3E;;;;;GAKG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,YAAY,CAAA;AAE3C;;;GAGG;AACH,MAAM,CAAC,MAAM,SAAS,GAAG,MAAM,CAAA;AAE/B,6EAA6E;AAC7E,MAAM,CAAC,MAAM,oBAAoB,GAAG,4BAA4B,CAAA;AAEhE,+GAA+G;AAC/G,MAAM,CAAC,MAAM,mBAAmB,GAAG,2BAA2B,CAAA;AAE9D,qGAAqG;AACrG,MAAM,CAAC,MAAM,qBAAqB,GAAG,EAAE,CAAA;AAEvC,kGAAkG;AAClG,MAAM,CAAC,MAAM,sBAAsB,GAAG,gBAAgB,CAAA;AAEtD;;;GAGG;AACH,MAAM,CAAC,MAAM,yBAAyB,GAAG,CAAC,EAAE,CAAA;AAE5C;;;GAGG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAA6B,MAAM,CAAC,MAAM,CAAC;IAC7E,EAAE,EAAE,kBAAkB;IACtB,OAAO,EAAE,kBAAkB;IAC3B,IAAI,EAAE,MAAM;IACZ,KAAK,EAAE,EAAE;IACT,QAAQ,EAAE,WAAW;CACtB,CAAC,CAAA;AAEF,qFAAqF;AACrF,MAAM,CAAC,MAAM,qBAAqB,GAAG,qCAAqC,CAAA;AAC1E,MAAM,CAAC,MAAM,mBAAmB,GAAG,mCAAmC,CAAA;AAEtE,iEAAiE;AACjE,MAAM,CAAC,MAAM,YAAY,GAAG,sBAAsB,CAAA"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { EmailAuthEntrypoints } from '@owlmeans/auth-email';
|
|
2
|
+
/**
|
|
3
|
+
* The offer screen, bound and ready to spread into an application's entrypoint list.
|
|
4
|
+
*
|
|
5
|
+
* The API routes are NOT bound here: they are ordinary backend routes the application binds with
|
|
6
|
+
* its own `bindAll(protocols)`, beside the server's `serveEmailAuthEntrypoints` — the same split as
|
|
7
|
+
* `marketingConsentEntrypoints`.
|
|
8
|
+
*/
|
|
9
|
+
export declare const emailAuthEntrypoints: (protocols: EmailAuthEntrypoints) => import("@owlmeans/client-entrypoint").ClientProtocolEntrypoint<import("@owlmeans/entrypoint").EntrypointProtocol<import("@owlmeans/entrypoint").OpenRequest, import("@owlmeans/entrypoint").OpenValue>>[];
|
|
10
|
+
//# sourceMappingURL=entrypoints.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"entrypoints.d.ts","sourceRoot":"","sources":["../src/entrypoints.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAA;AAGhE;;;;;;GAMG;AACH,eAAO,MAAM,oBAAoB,cAAe,oBAAoB,8MAEnE,CAAA"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { handler } from '@owlmeans/client';
|
|
2
|
+
import { bindScreen } from '@owlmeans/client-entrypoint';
|
|
3
|
+
import { PasswordOfferScreen } from './components/offer.js';
|
|
4
|
+
/**
|
|
5
|
+
* The offer screen, bound and ready to spread into an application's entrypoint list.
|
|
6
|
+
*
|
|
7
|
+
* The API routes are NOT bound here: they are ordinary backend routes the application binds with
|
|
8
|
+
* its own `bindAll(protocols)`, beside the server's `serveEmailAuthEntrypoints` — the same split as
|
|
9
|
+
* `marketingConsentEntrypoints`.
|
|
10
|
+
*/
|
|
11
|
+
export const emailAuthEntrypoints = (protocols) => [
|
|
12
|
+
bindScreen(protocols.offer, handler(PasswordOfferScreen)),
|
|
13
|
+
];
|
|
14
|
+
//# sourceMappingURL=entrypoints.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"entrypoints.js","sourceRoot":"","sources":["../src/entrypoints.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAA;AAC1C,OAAO,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAA;AAExD,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAA;AAE3D;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,SAA+B,EAAE,EAAE,CAAC;IACvE,UAAU,CAAC,SAAS,CAAC,KAAK,EAAE,OAAO,CAAC,mBAAmB,CAAC,CAAC;CAC1D,CAAA"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { EmailPasswordAliases } from '../types.js';
|
|
2
|
+
/** The aliases `makeEmailAuthProtocols` declares — what an application without the client service mounts. */
|
|
3
|
+
export declare const DEFAULT_PASSWORD_ALIASES: EmailPasswordAliases;
|
|
4
|
+
//# sourceMappingURL=consts.local.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"consts.local.d.ts","sourceRoot":"","sources":["../../src/hooks/consts.local.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAA;AAEvD,6GAA6G;AAC7G,eAAO,MAAM,wBAAwB,EAAE,oBAKtC,CAAA"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { EMAIL_AUTH_PASSWORD_PIN, EMAIL_AUTH_PASSWORD_REMOVE, EMAIL_AUTH_PASSWORD_SET, EMAIL_AUTH_PASSWORD_STATUS, } from '@owlmeans/auth-email';
|
|
2
|
+
/** The aliases `makeEmailAuthProtocols` declares — what an application without the client service mounts. */
|
|
3
|
+
export const DEFAULT_PASSWORD_ALIASES = {
|
|
4
|
+
status: EMAIL_AUTH_PASSWORD_STATUS,
|
|
5
|
+
pin: EMAIL_AUTH_PASSWORD_PIN,
|
|
6
|
+
set: EMAIL_AUTH_PASSWORD_SET,
|
|
7
|
+
remove: EMAIL_AUTH_PASSWORD_REMOVE,
|
|
8
|
+
};
|
|
9
|
+
//# sourceMappingURL=consts.local.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"consts.local.js","sourceRoot":"","sources":["../../src/hooks/consts.local.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,uBAAuB,EAAE,0BAA0B,EAAE,uBAAuB,EAAE,0BAA0B,GACzG,MAAM,sBAAsB,CAAA;AAG7B,6GAA6G;AAC7G,MAAM,CAAC,MAAM,wBAAwB,GAAyB;IAC5D,MAAM,EAAE,0BAA0B;IAClC,GAAG,EAAE,uBAAuB;IAC5B,GAAG,EAAE,uBAAuB;IAC5B,MAAM,EAAE,0BAA0B;CACnC,CAAA"}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import type { MouseEvent } from 'react';
|
|
2
|
+
import type { EmailPasswordPurpose, EmailPasswordStatusView } from '@owlmeans/auth-email';
|
|
3
|
+
import type { EmailLoginState } from '../state/types.js';
|
|
4
|
+
import type { EmailRefusal } from '../refusal/types.js';
|
|
5
|
+
import type { EmailPasswordAction } from '../password/types.js';
|
|
6
|
+
export interface UseEmailLoginOptions {
|
|
7
|
+
/** The interface language; its base language travels with send-PIN and sign-in, for the mail. */
|
|
8
|
+
locale?: string;
|
|
9
|
+
/** Pre-fill the address. */
|
|
10
|
+
email?: string;
|
|
11
|
+
}
|
|
12
|
+
/** The "Other sign-in options" link back to the chooser. */
|
|
13
|
+
export interface EmailLoginOtherOptions {
|
|
14
|
+
href: string;
|
|
15
|
+
go: (event?: MouseEvent) => void;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* The headless e-mail sign-in form — everything `EmailLoginScreen` renders from, for a replacement
|
|
19
|
+
* screen to render its own way (`registerEmailLoginScreen`).
|
|
20
|
+
*
|
|
21
|
+
* Every action is safe to call at any time: a call while another is in flight does nothing, and a
|
|
22
|
+
* call the form cannot make yet sets `state.refusal` (an invalid address, an incomplete code)
|
|
23
|
+
* instead of sending anything.
|
|
24
|
+
*/
|
|
25
|
+
export interface EmailLoginModel {
|
|
26
|
+
state: EmailLoginState;
|
|
27
|
+
/** The deployment asked for a captcha — show Google's notice. */
|
|
28
|
+
captcha: boolean;
|
|
29
|
+
/** Password sign-in is offered — show "Already set a password? Use it". */
|
|
30
|
+
passwordOffered: boolean;
|
|
31
|
+
pinLength: number;
|
|
32
|
+
setEmail: (value: string) => void;
|
|
33
|
+
setPin: (value: string) => void;
|
|
34
|
+
setPassword: (value: string) => void;
|
|
35
|
+
setReveal: (value: boolean) => void;
|
|
36
|
+
/** Mail a PIN (from the e-mail step) or a new one (from the PIN step). */
|
|
37
|
+
send: () => Promise<void>;
|
|
38
|
+
/** Sign in with the typed PIN. */
|
|
39
|
+
verify: () => Promise<void>;
|
|
40
|
+
/** Sign in with the password; an unknown device answers with a mailed PIN instead. */
|
|
41
|
+
signIn: () => Promise<void>;
|
|
42
|
+
/** What Enter does on the current step. */
|
|
43
|
+
submit: () => Promise<void>;
|
|
44
|
+
choosePassword: () => void;
|
|
45
|
+
choosePin: () => void;
|
|
46
|
+
changeEmail: () => void;
|
|
47
|
+
/** Ask for the options again after they failed to load. */
|
|
48
|
+
retryOptions: () => Promise<void>;
|
|
49
|
+
/** Null where the chooser is not bound in this application. */
|
|
50
|
+
otherOptions: EmailLoginOtherOptions | null;
|
|
51
|
+
}
|
|
52
|
+
export interface UsePasswordOptions {
|
|
53
|
+
/** The interface language; its base language travels with the confirmation-PIN request. */
|
|
54
|
+
locale?: string;
|
|
55
|
+
}
|
|
56
|
+
/** The I/O half of the password panel. Nothing thrown reaches the caller — it lands in `refusal`. */
|
|
57
|
+
export interface UsePassword {
|
|
58
|
+
status: EmailPasswordStatusView | null;
|
|
59
|
+
loading: boolean;
|
|
60
|
+
/** A PIN request or a confirmation is in flight. */
|
|
61
|
+
busy: boolean;
|
|
62
|
+
/** The purpose a confirmation PIN was mailed for; null while none waits. */
|
|
63
|
+
pending: EmailPasswordPurpose | null;
|
|
64
|
+
refusal: EmailRefusal | null;
|
|
65
|
+
/** The last action that went through, for a short confirmation. */
|
|
66
|
+
done: EmailPasswordAction | null;
|
|
67
|
+
reload: () => Promise<void>;
|
|
68
|
+
/** Mail a confirmation PIN to the account's own address. Resolves whether it was sent. */
|
|
69
|
+
sendPin: (purpose: EmailPasswordPurpose) => Promise<boolean>;
|
|
70
|
+
/** Confirm an action with the mailed PIN (and the new password for set/change). Resolves whether it went through. */
|
|
71
|
+
confirm: (action: EmailPasswordAction, input: {
|
|
72
|
+
pin: string;
|
|
73
|
+
password?: string;
|
|
74
|
+
}) => Promise<boolean>;
|
|
75
|
+
/** Abandon a pending confirmation. */
|
|
76
|
+
cancel: () => void;
|
|
77
|
+
}
|
|
78
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/hooks/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,OAAO,CAAA;AACvC,OAAO,KAAK,EAAE,oBAAoB,EAAE,uBAAuB,EAAE,MAAM,sBAAsB,CAA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I,CAAA;IACrB,WAAW,EAAE,MAAM,IAAI,CAAA;IACvB,2DAA2D;IAC3D,YAAY,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAA;IACjC,+DAA+D;IAC/D,YAAY,EAAE,sBAAsB,GAAG,IAAI,CAAA;CAC5C;AAED,MAAM,WAAW,kBAAkB;IACjC,2FAA2F;IAC3F,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB;AAED,qGAAqG;AACrG,MAAM,WAAW,WAAW;IAC1B,MAAM,EAAE,uBAAuB,GAAG,IAAI,CAAA;IACtC,OAAO,EAAE,OAAO,CAAA;IAChB,oDAAoD;IACpD,IAAI,EAAE,OAAO,CAAA;IACb,4EAA4E;IAC5E,OAAO,EAAE,oBAAoB,GAAG,IAAI,CAAA;IACpC,OAAO,EAAE,YAAY,GAAG,IAAI,CAAA;IAC5B,mEAAmE;IACnE,IAAI,EAAE,mBAAmB,GAAG,IAAI,CAAA;IAChC,MAAM,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAA;IAC3B,0FAA0F;IAC1F,OAAO,EAAE,CAAC,OAAO,EAAE,oBAAoB,KAAK,OAAO,CAAC,OAAO,CAAC,CAAA;IAC5D,qHAAqH;IACrH,OAAO,EAAE,CAAC,MAAM,EAAE,mBAAmB,EAAE,KAAK,EAAE;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,EAAE,MAAM,CAAA;KAAE,KAAK,OAAO,CAAC,OAAO,CAAC,CAAA;IACrG,sCAAsC;IACtC,MAAM,EAAE,MAAM,IAAI,CAAA;CACnB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/hooks/types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { EmailLoginModel, UseEmailLoginOptions } from './types.js';
|
|
2
|
+
/**
|
|
3
|
+
* The e-mail sign-in form: an address, then a mailed PIN — or, where the deployment offers
|
|
4
|
+
* passwords, the address and a password, which on a device the account does not know turns into a
|
|
5
|
+
* mailed PIN as well. A captcha token is fetched right before each send-PIN and password sign-in
|
|
6
|
+
* when the deployment asks for one; the PIN step needs none.
|
|
7
|
+
*
|
|
8
|
+
* Every transition is `emailLoginStateHelper.reduce`; this hook only performs the calls and
|
|
9
|
+
* dispatches what they answered. A successful answer is finished by the client service
|
|
10
|
+
* (`complete`), which leaves the page.
|
|
11
|
+
*/
|
|
12
|
+
export declare const useEmailLogin: (opts?: UseEmailLoginOptions) => EmailLoginModel;
|
|
13
|
+
//# sourceMappingURL=use-email-login.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-email-login.d.ts","sourceRoot":"","sources":["../../src/hooks/use-email-login.ts"],"names":[],"mappings":"AAkBA,OAAO,KAAK,EAAE,eAAe,EAA0B,oBAAoB,EAAE,MAAM,YAAY,CAAA;AAI/F;;;;;;;;;GASG;AACH,eAAO,MAAM,aAAa,UAAU,oBAAoB,KAAQ,eAyM/D,CAAA"}
|