@molecule/app-settings-panel-solid 0.0.0-stage → 0.0.1-stage
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/LICENSE +202 -0
- package/README.md +535 -2
- package/dist/AccountSection.d.ts +19 -0
- package/dist/AccountSection.d.ts.map +1 -0
- package/dist/AccountSection.jsx +147 -0
- package/dist/AccountSection.jsx.map +1 -0
- package/dist/AppearanceSection.d.ts +17 -0
- package/dist/AppearanceSection.d.ts.map +1 -0
- package/dist/AppearanceSection.jsx +34 -0
- package/dist/AppearanceSection.jsx.map +1 -0
- package/dist/AuthSection.d.ts +26 -0
- package/dist/AuthSection.d.ts.map +1 -0
- package/dist/AuthSection.jsx +252 -0
- package/dist/AuthSection.jsx.map +1 -0
- package/dist/BillingSection.d.ts +29 -0
- package/dist/BillingSection.d.ts.map +1 -0
- package/dist/BillingSection.jsx +69 -0
- package/dist/BillingSection.jsx.map +1 -0
- package/dist/DevicesSection.d.ts +31 -0
- package/dist/DevicesSection.d.ts.map +1 -0
- package/dist/DevicesSection.jsx +130 -0
- package/dist/DevicesSection.jsx.map +1 -0
- package/dist/LogOutDeleteSection.d.ts +18 -0
- package/dist/LogOutDeleteSection.d.ts.map +1 -0
- package/dist/LogOutDeleteSection.jsx +99 -0
- package/dist/LogOutDeleteSection.jsx.map +1 -0
- package/dist/NotificationsSection.d.ts +23 -0
- package/dist/NotificationsSection.d.ts.map +1 -0
- package/dist/NotificationsSection.jsx +120 -0
- package/dist/NotificationsSection.jsx.map +1 -0
- package/dist/SettingsContainer.d.ts +22 -0
- package/dist/SettingsContainer.d.ts.map +1 -0
- package/dist/SettingsContainer.jsx +30 -0
- package/dist/SettingsContainer.jsx.map +1 -0
- package/dist/ThisDeviceSection.d.ts +17 -0
- package/dist/ThisDeviceSection.d.ts.map +1 -0
- package/dist/ThisDeviceSection.jsx +60 -0
- package/dist/ThisDeviceSection.jsx.map +1 -0
- package/dist/TiersUpgradeSection.d.ts +24 -0
- package/dist/TiersUpgradeSection.d.ts.map +1 -0
- package/dist/TiersUpgradeSection.jsx +181 -0
- package/dist/TiersUpgradeSection.jsx.map +1 -0
- package/dist/context.d.ts +17 -0
- package/dist/context.d.ts.map +1 -0
- package/dist/context.js +24 -0
- package/dist/context.js.map +1 -0
- package/dist/index.d.ts +88 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +88 -0
- package/dist/index.js.map +1 -0
- package/dist/pushToggle.d.ts +12 -0
- package/dist/pushToggle.d.ts.map +1 -0
- package/dist/pushToggle.js +11 -0
- package/dist/pushToggle.js.map +1 -0
- package/dist/types.d.ts +38 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +7 -0
- package/dist/types.js.map +1 -0
- package/package.json +71 -4
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The account section.
|
|
3
|
+
*
|
|
4
|
+
* @module
|
|
5
|
+
*/
|
|
6
|
+
import { createEffect, onMount, Show } from 'solid-js';
|
|
7
|
+
import { useAuthClient, useProfileForm, useTranslation } from '@molecule/app-solid';
|
|
8
|
+
import { getClassMap } from '@molecule/app-ui';
|
|
9
|
+
import { Flex, Input, Spinner } from '@molecule/app-ui-solid';
|
|
10
|
+
/**
|
|
11
|
+
* Account fields over the shared profile lifecycle. Background validation uses
|
|
12
|
+
* the auth client's configured route, mapping and session ownership guards.
|
|
13
|
+
*
|
|
14
|
+
* `UserProfile.email` is optional (phone/handle accounts have none), so email is
|
|
15
|
+
* validated only when non-empty and a blank email is never sent: clearing the
|
|
16
|
+
* field leaves the stored address untouched, and a name-only account can still
|
|
17
|
+
* save its name.
|
|
18
|
+
*
|
|
19
|
+
* @returns The account settings section.
|
|
20
|
+
*/
|
|
21
|
+
export function AccountSection() {
|
|
22
|
+
const cm = getClassMap();
|
|
23
|
+
const { t } = useTranslation();
|
|
24
|
+
const authClient = useAuthClient();
|
|
25
|
+
const profile = useProfileForm({
|
|
26
|
+
defaultValues: { name: '', email: '' },
|
|
27
|
+
toValues: (user) => ({ name: user.name ?? '', email: user.email ?? '' }),
|
|
28
|
+
toPatch: ({ email, ...changes }) => (email ? { ...changes, email } : changes),
|
|
29
|
+
});
|
|
30
|
+
onMount(() => {
|
|
31
|
+
// The auth client owns the route, response mapping and stale-read guards.
|
|
32
|
+
// An older account read must not publish over a save or a different session.
|
|
33
|
+
void authClient.validateSession?.().catch((_error) => {
|
|
34
|
+
// A provider's background validation must not cause an unhandled rejection:
|
|
35
|
+
// render its auth state while useProfileForm reports mutation failures.
|
|
36
|
+
});
|
|
37
|
+
});
|
|
38
|
+
const name = profile.register('name');
|
|
39
|
+
const email = profile.register('email', { email: true });
|
|
40
|
+
// The field's controlled value. `formState()` is the form's notification
|
|
41
|
+
// stream as an accessor, so the input follows loads, saves and account
|
|
42
|
+
// switches; the registration's own `value` is a one-time snapshot.
|
|
43
|
+
const nameValue = () => profile.formState().values.name;
|
|
44
|
+
const emailValue = () => profile.formState().values.email;
|
|
45
|
+
// Same anchoring for the validation error: `getError` reads the controller
|
|
46
|
+
// directly, so read the tracked state first to subscribe this expression.
|
|
47
|
+
const emailError = () => {
|
|
48
|
+
profile.formState();
|
|
49
|
+
return profile.getError('email');
|
|
50
|
+
};
|
|
51
|
+
// The latest save failure: the Error's own message, or the shared fallback.
|
|
52
|
+
const saveError = () => {
|
|
53
|
+
const failure = profile.error();
|
|
54
|
+
return failure instanceof Error
|
|
55
|
+
? failure.message
|
|
56
|
+
: t('settings.failedToUpdateProfile', undefined, {
|
|
57
|
+
defaultValue: 'Failed to update profile',
|
|
58
|
+
});
|
|
59
|
+
};
|
|
60
|
+
const saveOnBlur = (onBlur) => () => {
|
|
61
|
+
onBlur();
|
|
62
|
+
void profile.submit();
|
|
63
|
+
};
|
|
64
|
+
// React's controlled input re-writes BOTH the attribute and the property on
|
|
65
|
+
// every render, so a save that rewrites a field behind typed text also
|
|
66
|
+
// replaces what the field shows. The Input's `attr:value` covers the
|
|
67
|
+
// attribute; this helper covers the property. It keeps the registration's
|
|
68
|
+
// ref (the form controller needs the element for validation focus) and adds
|
|
69
|
+
// an effect that re-reads the tracked value, React's restore semantics.
|
|
70
|
+
const bindInput = (field, value) => {
|
|
71
|
+
let el;
|
|
72
|
+
return (node) => {
|
|
73
|
+
el = node ?? undefined;
|
|
74
|
+
field.ref?.(node);
|
|
75
|
+
createEffect(() => {
|
|
76
|
+
const input = el;
|
|
77
|
+
const next = value();
|
|
78
|
+
if (input && input.value !== next)
|
|
79
|
+
input.value = next;
|
|
80
|
+
});
|
|
81
|
+
};
|
|
82
|
+
};
|
|
83
|
+
const bindName = bindInput(name, nameValue);
|
|
84
|
+
// The email field's validation state rides the same element: React passes
|
|
85
|
+
// `aria-invalid`/`aria-describedby` through the Input's rest spread, which
|
|
86
|
+
// OVERRIDES the component's internal aria-invalid (absent when there is no
|
|
87
|
+
// error, `true` + a describedby reference when there is). Solid's spread
|
|
88
|
+
// cannot remove an attribute the component already rendered, so the same
|
|
89
|
+
// attributes are managed here against the bound element, re-read whenever
|
|
90
|
+
// the tracked validation error changes.
|
|
91
|
+
const bindEmail = (node) => {
|
|
92
|
+
bindInput(email, emailValue)(node);
|
|
93
|
+
const input = node;
|
|
94
|
+
createEffect(() => {
|
|
95
|
+
if (!input)
|
|
96
|
+
return;
|
|
97
|
+
const error = emailError();
|
|
98
|
+
if (error) {
|
|
99
|
+
input.setAttribute('aria-invalid', 'true');
|
|
100
|
+
input.setAttribute('aria-describedby', 'settings-email-error');
|
|
101
|
+
}
|
|
102
|
+
else {
|
|
103
|
+
input.removeAttribute('aria-invalid');
|
|
104
|
+
input.removeAttribute('aria-describedby');
|
|
105
|
+
}
|
|
106
|
+
});
|
|
107
|
+
};
|
|
108
|
+
return (<section>
|
|
109
|
+
<Flex align="center" gap="sm" className={cm.sp('mb', 3)}>
|
|
110
|
+
<h3 class={cm.sectionHeading}>
|
|
111
|
+
{t('settings.account', undefined, { defaultValue: 'Account' })}
|
|
112
|
+
</h3>
|
|
113
|
+
<Show when={profile.isSubmitting()}>
|
|
114
|
+
<Spinner size="xs"/>
|
|
115
|
+
</Show>
|
|
116
|
+
</Flex>
|
|
117
|
+
<form class={cm.stack(3)} onSubmit={profile.formProps.onSubmit}>
|
|
118
|
+
<div>
|
|
119
|
+
<label for="settings-name" class={cm.formLabelSmall}>
|
|
120
|
+
{t('settings.name', undefined, { defaultValue: 'Name' })}
|
|
121
|
+
</label>
|
|
122
|
+
<Input value={nameValue()} name={name.name} onChange={name.onChange} onBlur={saveOnBlur(name.onBlur)}
|
|
123
|
+
// `ref` is a forwarded prop here (the Input spreads its rest onto
|
|
124
|
+
// the native input), not a component-level Solid ref, so it rides
|
|
125
|
+
// a spread the way every forwarded attribute does.
|
|
126
|
+
{...{ ref: bindName }} id="settings-name" type="text" autoComplete="name" size="sm"/>
|
|
127
|
+
</div>
|
|
128
|
+
<div>
|
|
129
|
+
<label for="settings-email" class={cm.formLabelSmall}>
|
|
130
|
+
{t('settings.email', undefined, { defaultValue: 'Email' })}
|
|
131
|
+
</label>
|
|
132
|
+
<Input value={emailValue()} name={email.name} onChange={email.onChange} onBlur={saveOnBlur(email.onBlur)} {...{ ref: bindEmail }} id="settings-email" type="email" autoComplete="email" size="sm"/>
|
|
133
|
+
<Show when={emailError()}>
|
|
134
|
+
<p id="settings-email-error" role="alert" class={cm.cn(cm.textSize('xs'), cm.textError, cm.sp('mt', 1))}>
|
|
135
|
+
{emailError()}
|
|
136
|
+
</p>
|
|
137
|
+
</Show>
|
|
138
|
+
<Show when={profile.error()}>
|
|
139
|
+
<p role="alert" class={cm.cn(cm.textSize('xs'), cm.textError, cm.sp('mt', 1))}>
|
|
140
|
+
{saveError()}
|
|
141
|
+
</p>
|
|
142
|
+
</Show>
|
|
143
|
+
</div>
|
|
144
|
+
</form>
|
|
145
|
+
</section>);
|
|
146
|
+
}
|
|
147
|
+
//# sourceMappingURL=AccountSection.jsx.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AccountSection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AE,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,EAAE,CAAC,SAAS,EAAE,EAAE,CAAC,EAAE,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC,CAC5E;cAAA,CAAC,SAAS,EAAE,CACd;YAAA,EAAE,CAAC,CACL;UAAA,EAAE,IAAI,CACR;QAAA,EAAE,GAAG,CACP;MAAA,EAAE,IAAI,CACR;IAAA,EAAE,OAAO,CAAC,CACX,CAAA;AACH,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The appearance section.
|
|
3
|
+
*
|
|
4
|
+
* @module
|
|
5
|
+
*/
|
|
6
|
+
import type { JSX } from 'solid-js';
|
|
7
|
+
/**
|
|
8
|
+
* Appearance section — dark-mode toggle wired to the theme bond.
|
|
9
|
+
*
|
|
10
|
+
* Apps that expose other appearance knobs (font size, density, etc.)
|
|
11
|
+
* can either add more sub-components to this package or render their
|
|
12
|
+
* own section in line with `<AppearanceSection>` via children.
|
|
13
|
+
*
|
|
14
|
+
* @returns The appearance settings section.
|
|
15
|
+
*/
|
|
16
|
+
export declare function AppearanceSection(): JSX.Element;
|
|
17
|
+
//# sourceMappingURL=AppearanceSection.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AppearanceSection.d.ts","sourceRoot":"","sources":["../src/AppearanceSection.tsx"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,UAAU,CAAA;AAMnC;;;;;;;;GAQG;AACH,wBAAgB,iBAAiB,IAAI,GAAG,CAAC,OAAO,CAwB/C"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The appearance section.
|
|
3
|
+
*
|
|
4
|
+
* @module
|
|
5
|
+
*/
|
|
6
|
+
import { useTheme, useTranslation } from '@molecule/app-solid';
|
|
7
|
+
import { getClassMap } from '@molecule/app-ui';
|
|
8
|
+
import { Flex, Switch } from '@molecule/app-ui-solid';
|
|
9
|
+
/**
|
|
10
|
+
* Appearance section — dark-mode toggle wired to the theme bond.
|
|
11
|
+
*
|
|
12
|
+
* Apps that expose other appearance knobs (font size, density, etc.)
|
|
13
|
+
* can either add more sub-components to this package or render their
|
|
14
|
+
* own section in line with `<AppearanceSection>` via children.
|
|
15
|
+
*
|
|
16
|
+
* @returns The appearance settings section.
|
|
17
|
+
*/
|
|
18
|
+
export function AppearanceSection() {
|
|
19
|
+
const cm = getClassMap();
|
|
20
|
+
const { t } = useTranslation();
|
|
21
|
+
const { mode, toggleTheme } = useTheme();
|
|
22
|
+
return (<section>
|
|
23
|
+
<h3 class={cm.cn(cm.sectionHeading, cm.sp('mb', 3))}>
|
|
24
|
+
{t('settings.appearance', undefined, { defaultValue: 'Appearance' })}
|
|
25
|
+
</h3>
|
|
26
|
+
<Flex align="center" justify="between">
|
|
27
|
+
<span class={cm.textSize('sm')}>
|
|
28
|
+
{t('settings.darkMode', undefined, { defaultValue: 'Dark mode' })}
|
|
29
|
+
</span>
|
|
30
|
+
<Switch id="settings-theme-toggle" aria-label={t('theme.toggle', undefined, { defaultValue: 'Toggle theme' })} checked={mode() === 'dark'} onChange={() => toggleTheme()} size="sm"/>
|
|
31
|
+
</Flex>
|
|
32
|
+
</section>);
|
|
33
|
+
}
|
|
34
|
+
//# sourceMappingURL=AppearanceSection.jsx.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AppearanceSection.jsx","sourceRoot":"","sources":["../src/AppearanceSection.tsx"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,OAAO,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAA;AAC9D,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAC9C,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAA;AAErD;;;;;;;;GAQG;AACH,MAAM,UAAU,iBAAiB;IAC/B,MAAM,EAA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|
+
import { type JSX } from 'solid-js';
|
|
7
|
+
/**
|
|
8
|
+
* Authentication section — change password (modal) + two-factor (TOTP) setup.
|
|
9
|
+
*
|
|
10
|
+
* Two-factor uses the real enrollment flow against the user resource's
|
|
11
|
+
* `POST /users/:id/verify-two-factor` endpoint (`@molecule/api-two-factor`):
|
|
12
|
+
* - Enable → `{action:'setup'}` returns a QR code + secret to scan into an
|
|
13
|
+
* authenticator app → user enters the 6-digit code → `{action:'enable', token}`.
|
|
14
|
+
* - Disable → user enters a current code → `{action:'disable', token}`.
|
|
15
|
+
* The current status is read from `/users/me`. (This replaces the previous
|
|
16
|
+
* boolean toggle, which PATCHed `twoFactorEnabled` — a field the update
|
|
17
|
+
* handler deliberately ignores — so it never actually enrolled 2FA.)
|
|
18
|
+
*
|
|
19
|
+
* Auto-hides for OAuth-only users (`user.oauthServer` truthy) since
|
|
20
|
+
* password / 2FA wouldn't apply. If the app's API has no two-factor
|
|
21
|
+
* provider bonded, setup fails gracefully with an inline message.
|
|
22
|
+
*
|
|
23
|
+
* @returns The authentication settings section.
|
|
24
|
+
*/
|
|
25
|
+
export declare function AuthSection(): JSX.Element;
|
|
26
|
+
//# sourceMappingURL=AuthSection.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AuthSection.d.ts","sourceRoot":"","sources":["../src/AuthSection.tsx"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAgB,KAAK,GAAG,EAAmB,MAAM,UAAU,CAAA;AAclE;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,WAAW,IAAI,GAAG,CAAC,OAAO,CAoRzC"}
|
|
@@ -0,0 +1,252 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The authentication section: change password and two-factor.
|
|
3
|
+
*
|
|
4
|
+
* @module
|
|
5
|
+
*/
|
|
6
|
+
import { createSignal, onCleanup, Show } from 'solid-js';
|
|
7
|
+
import { serverErrorMessage } from '@molecule/app-http';
|
|
8
|
+
import { useAuth, useChangePassword, useHttpClient, useTranslation } from '@molecule/app-solid';
|
|
9
|
+
import { getClassMap, molIdProps } from '@molecule/app-ui';
|
|
10
|
+
import { Alert, Button, Flex, Input, Modal } from '@molecule/app-ui-solid';
|
|
11
|
+
/**
|
|
12
|
+
* Authentication section — change password (modal) + two-factor (TOTP) setup.
|
|
13
|
+
*
|
|
14
|
+
* Two-factor uses the real enrollment flow against the user resource's
|
|
15
|
+
* `POST /users/:id/verify-two-factor` endpoint (`@molecule/api-two-factor`):
|
|
16
|
+
* - Enable → `{action:'setup'}` returns a QR code + secret to scan into an
|
|
17
|
+
* authenticator app → user enters the 6-digit code → `{action:'enable', token}`.
|
|
18
|
+
* - Disable → user enters a current code → `{action:'disable', token}`.
|
|
19
|
+
* The current status is read from `/users/me`. (This replaces the previous
|
|
20
|
+
* boolean toggle, which PATCHed `twoFactorEnabled` — a field the update
|
|
21
|
+
* handler deliberately ignores — so it never actually enrolled 2FA.)
|
|
22
|
+
*
|
|
23
|
+
* Auto-hides for OAuth-only users (`user.oauthServer` truthy) since
|
|
24
|
+
* password / 2FA wouldn't apply. If the app's API has no two-factor
|
|
25
|
+
* provider bonded, setup fails gracefully with an inline message.
|
|
26
|
+
*
|
|
27
|
+
* @returns The authentication settings section.
|
|
28
|
+
*/
|
|
29
|
+
export function AuthSection() {
|
|
30
|
+
const cm = getClassMap();
|
|
31
|
+
const { t } = useTranslation();
|
|
32
|
+
const { user } = useAuth();
|
|
33
|
+
const http = useHttpClient();
|
|
34
|
+
const { status, error, changePassword, reset } = useChangePassword();
|
|
35
|
+
const [showModal, setShowModal] = createSignal(false);
|
|
36
|
+
const [currentPassword, setCurrentPassword] = createSignal('');
|
|
37
|
+
const [newPassword, setNewPassword] = createSignal('');
|
|
38
|
+
const userId = () => user()?.id;
|
|
39
|
+
const [twoFactorEnabled, setTwoFactorEnabled] = createSignal(false);
|
|
40
|
+
const [tfModal, setTfModal] = createSignal(null);
|
|
41
|
+
const [tfSetup, setTfSetup] = createSignal(null);
|
|
42
|
+
const [tfToken, setTfToken] = createSignal('');
|
|
43
|
+
const [tfLoading, setTfLoading] = createSignal(false);
|
|
44
|
+
const [tfError, setTfError] = createSignal('');
|
|
45
|
+
// Read the persisted 2FA status from /users/me on mount.
|
|
46
|
+
let cancelled = false;
|
|
47
|
+
onCleanup(() => {
|
|
48
|
+
cancelled = true;
|
|
49
|
+
});
|
|
50
|
+
void http
|
|
51
|
+
.get('/api/users/me')
|
|
52
|
+
.then((res) => {
|
|
53
|
+
if (cancelled)
|
|
54
|
+
return;
|
|
55
|
+
const body = res.data ?? res;
|
|
56
|
+
const u = (body.props ?? body);
|
|
57
|
+
setTwoFactorEnabled(Boolean(u?.twoFactorEnabled));
|
|
58
|
+
})
|
|
59
|
+
.catch((_error) => {
|
|
60
|
+
/* status read is best-effort; defaults to disabled */
|
|
61
|
+
});
|
|
62
|
+
const closeTf = () => {
|
|
63
|
+
setTfModal(null);
|
|
64
|
+
setTfSetup(null);
|
|
65
|
+
setTfToken('');
|
|
66
|
+
setTfError('');
|
|
67
|
+
};
|
|
68
|
+
const startEnable = async () => {
|
|
69
|
+
setTfError('');
|
|
70
|
+
setTfLoading(true);
|
|
71
|
+
setTfModal('enable');
|
|
72
|
+
try {
|
|
73
|
+
const res = await http.post(`/api/users/${userId()}/verify-two-factor`, {
|
|
74
|
+
action: 'setup',
|
|
75
|
+
});
|
|
76
|
+
const data = (res.data ?? res);
|
|
77
|
+
setTfSetup(data);
|
|
78
|
+
}
|
|
79
|
+
catch (err) {
|
|
80
|
+
setTfError(serverErrorMessage(err) ??
|
|
81
|
+
t('settings.twoFactorUnavailable', undefined, {
|
|
82
|
+
defaultValue: 'Two-factor authentication is not available for this app.',
|
|
83
|
+
}));
|
|
84
|
+
}
|
|
85
|
+
finally {
|
|
86
|
+
setTfLoading(false);
|
|
87
|
+
}
|
|
88
|
+
};
|
|
89
|
+
const submitTf = async (action) => {
|
|
90
|
+
setTfError('');
|
|
91
|
+
setTfLoading(true);
|
|
92
|
+
try {
|
|
93
|
+
await http.post(`/api/users/${userId()}/verify-two-factor`, { action, token: tfToken() });
|
|
94
|
+
setTwoFactorEnabled(action === 'enable');
|
|
95
|
+
closeTf();
|
|
96
|
+
}
|
|
97
|
+
catch (err) {
|
|
98
|
+
setTfError(serverErrorMessage(err) ??
|
|
99
|
+
t('settings.twoFactorInvalidCode', undefined, { defaultValue: 'Invalid code' }));
|
|
100
|
+
}
|
|
101
|
+
finally {
|
|
102
|
+
setTfLoading(false);
|
|
103
|
+
}
|
|
104
|
+
};
|
|
105
|
+
const handleChangePassword = async (e) => {
|
|
106
|
+
e.preventDefault();
|
|
107
|
+
try {
|
|
108
|
+
await changePassword(currentPassword(), newPassword());
|
|
109
|
+
setShowModal(false);
|
|
110
|
+
setCurrentPassword('');
|
|
111
|
+
setNewPassword('');
|
|
112
|
+
reset();
|
|
113
|
+
}
|
|
114
|
+
catch (_error) {
|
|
115
|
+
// Error tracked in hook state — useChangePassword surfaces it via `error`.
|
|
116
|
+
}
|
|
117
|
+
};
|
|
118
|
+
return (<Show when={!user()?.oauthServer}>
|
|
119
|
+
<section>
|
|
120
|
+
<h3 class={cm.cn(cm.sectionHeading, cm.sp('mb', 3))}>
|
|
121
|
+
{t('settings.authentication', undefined, { defaultValue: 'Authentication' })}
|
|
122
|
+
</h3>
|
|
123
|
+
<div class={cm.stack(3)}>
|
|
124
|
+
<Button variant="outline" size="sm" onClick={() => setShowModal(true)}>
|
|
125
|
+
{t('settings.changePassword', undefined, { defaultValue: 'Change password' })}
|
|
126
|
+
</Button>
|
|
127
|
+
<Flex align="center" justify="between">
|
|
128
|
+
<span class={cm.textSize('sm')}>
|
|
129
|
+
{t('settings.twoFactor', undefined, { defaultValue: 'Two-factor authentication' })}
|
|
130
|
+
<Show when={twoFactorEnabled()}>
|
|
131
|
+
<span class={cm.cn(cm.textSize('xs'), cm.textSubtle, cm.sp('ml', 2))}>
|
|
132
|
+
{t('settings.twoFactorOn', undefined, { defaultValue: 'On' })}
|
|
133
|
+
</span>
|
|
134
|
+
</Show>
|
|
135
|
+
</span>
|
|
136
|
+
<Show when={twoFactorEnabled()} fallback={<Button variant="outline" size="sm" onClick={() => void startEnable()} {...molIdProps('two-factor-enable')}>
|
|
137
|
+
{t('settings.twoFactorEnable', undefined, { defaultValue: 'Enable' })}
|
|
138
|
+
</Button>}>
|
|
139
|
+
<Button variant="outline" size="sm" onClick={() => {
|
|
140
|
+
setTfError('');
|
|
141
|
+
setTfToken('');
|
|
142
|
+
setTfModal('disable');
|
|
143
|
+
}} {...molIdProps('two-factor-disable')}>
|
|
144
|
+
{t('settings.twoFactorDisable', undefined, { defaultValue: 'Disable' })}
|
|
145
|
+
</Button>
|
|
146
|
+
</Show>
|
|
147
|
+
</Flex>
|
|
148
|
+
</div>
|
|
149
|
+
</section>
|
|
150
|
+
|
|
151
|
+
<Modal open={showModal()} onClose={() => {
|
|
152
|
+
setShowModal(false);
|
|
153
|
+
reset();
|
|
154
|
+
}} title={t('settings.changePasswordModal.title', undefined, {
|
|
155
|
+
defaultValue: 'Change Password',
|
|
156
|
+
})}>
|
|
157
|
+
<Show when={error()}>
|
|
158
|
+
<Alert status="error" className={cm.sp('mb', 4)}>
|
|
159
|
+
{errorMessage(error(), t)}
|
|
160
|
+
</Alert>
|
|
161
|
+
</Show>
|
|
162
|
+
<form class={cm.stack(4)} onSubmit={(e) => void handleChangePassword(e)}>
|
|
163
|
+
<div>
|
|
164
|
+
<label for="current-pw" class={cm.formLabel}>
|
|
165
|
+
{t('settings.changePasswordModal.currentPassword', undefined, {
|
|
166
|
+
defaultValue: 'Current Password',
|
|
167
|
+
})}
|
|
168
|
+
</label>
|
|
169
|
+
<Input id="current-pw" type="password" value={currentPassword()} onChange={(e) => setCurrentPassword(e.target.value)} autoComplete="current-password" required/>
|
|
170
|
+
</div>
|
|
171
|
+
<div>
|
|
172
|
+
<label for="new-pw" class={cm.formLabel}>
|
|
173
|
+
{t('settings.changePasswordModal.newPassword', undefined, {
|
|
174
|
+
defaultValue: 'New Password',
|
|
175
|
+
})}
|
|
176
|
+
</label>
|
|
177
|
+
<Input id="new-pw" type="password" value={newPassword()} onChange={(e) => setNewPassword(e.target.value)} autoComplete="new-password" required/>
|
|
178
|
+
</div>
|
|
179
|
+
<Button type="submit" fullWidth loading={status() === 'pending'}>
|
|
180
|
+
{status() === 'pending'
|
|
181
|
+
? t('settings.changePasswordModal.changing', undefined, {
|
|
182
|
+
defaultValue: 'Changing...',
|
|
183
|
+
})
|
|
184
|
+
: t('settings.changePassword', undefined, { defaultValue: 'Change password' })}
|
|
185
|
+
</Button>
|
|
186
|
+
</form>
|
|
187
|
+
</Modal>
|
|
188
|
+
|
|
189
|
+
<Modal open={tfModal() !== null} onClose={closeTf} title={tfModal() === 'disable'
|
|
190
|
+
? t('settings.twoFactorDisableTitle', undefined, {
|
|
191
|
+
defaultValue: 'Disable two-factor authentication',
|
|
192
|
+
})
|
|
193
|
+
: t('settings.twoFactorEnableTitle', undefined, {
|
|
194
|
+
defaultValue: 'Enable two-factor authentication',
|
|
195
|
+
})}>
|
|
196
|
+
<Show when={tfError()}>
|
|
197
|
+
<Alert status="error" className={cm.sp('mb', 4)}>
|
|
198
|
+
{tfError()}
|
|
199
|
+
</Alert>
|
|
200
|
+
</Show>
|
|
201
|
+
<Show when={tfModal() === 'enable' && tfSetup()?.QRImageUrl}>
|
|
202
|
+
<div class={cm.cn(cm.stack(3), cm.sp('mb', 4))}>
|
|
203
|
+
<p class={cm.cn(cm.textSize('sm'), cm.textMuted)}>
|
|
204
|
+
{t('settings.twoFactorScan', undefined, {
|
|
205
|
+
defaultValue: 'Scan this QR code with your authenticator app, then enter the 6-digit code.',
|
|
206
|
+
})}
|
|
207
|
+
</p>
|
|
208
|
+
<img src={tfSetup()?.QRImageUrl} alt={t('settings.twoFactorQrAlt', undefined, { defaultValue: 'Two-factor QR code' })} class={cm.cn(cm.mxAuto, cm.maxW('xs'))}/>
|
|
209
|
+
<Show when={tfSetup()?.secret}>
|
|
210
|
+
<p class={cm.cn(cm.textSize('xs'), cm.textSubtle, cm.settingsPanelTwoFactorSecret)}>
|
|
211
|
+
{tfSetup()?.secret}
|
|
212
|
+
</p>
|
|
213
|
+
</Show>
|
|
214
|
+
</div>
|
|
215
|
+
</Show>
|
|
216
|
+
<Show when={tfModal() === 'disable' || tfSetup()}>
|
|
217
|
+
<form class={cm.stack(4)} onSubmit={(e) => {
|
|
218
|
+
e.preventDefault();
|
|
219
|
+
void submitTf(tfModal() === 'disable' ? 'disable' : 'enable');
|
|
220
|
+
}}>
|
|
221
|
+
<div>
|
|
222
|
+
<label for="tf-token" class={cm.formLabel}>
|
|
223
|
+
{t('settings.twoFactorCode', undefined, { defaultValue: 'Authentication code' })}
|
|
224
|
+
</label>
|
|
225
|
+
<Input id="tf-token" type="text" value={tfToken()} onChange={(e) => setTfToken(e.target.value)} autoComplete="one-time-code" required/>
|
|
226
|
+
</div>
|
|
227
|
+
<Button type="submit" color={tfModal() === 'disable' ? 'error' : undefined} fullWidth loading={tfLoading()}>
|
|
228
|
+
{tfModal() === 'disable'
|
|
229
|
+
? t('settings.twoFactorDisable', undefined, { defaultValue: 'Disable' })
|
|
230
|
+
: t('settings.twoFactorVerify', undefined, { defaultValue: 'Verify & enable' })}
|
|
231
|
+
</Button>
|
|
232
|
+
</form>
|
|
233
|
+
</Show>
|
|
234
|
+
</Modal>
|
|
235
|
+
</Show>);
|
|
236
|
+
}
|
|
237
|
+
/**
|
|
238
|
+
* The change-password failure text: the error's own message, or the shared
|
|
239
|
+
* fallback (the same rendering React's `error.message || t(...)` produces).
|
|
240
|
+
*
|
|
241
|
+
* @param failure - The hook's error value.
|
|
242
|
+
* @param translate - The component's `t` function.
|
|
243
|
+
* @returns The message to render.
|
|
244
|
+
*/
|
|
245
|
+
function errorMessage(failure, translate) {
|
|
246
|
+
const message = failure instanceof Error ? failure.message : '';
|
|
247
|
+
return (message ||
|
|
248
|
+
translate('settings.changePasswordModal.error', undefined, {
|
|
249
|
+
defaultValue: 'Failed to change password.',
|
|
250
|
+
}));
|
|
251
|
+
}
|
|
252
|
+
//# sourceMappingURL=AuthSection.jsx.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AuthSection.jsx","sourceRoot":"","sources":["../src/AuthSection.tsx"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,YAAY,EAAY,SAAS,EAAE,IAAI,EAAE,MAAM,UAAU,CAAA;AAGlE,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAA;AACvD,OAAO,EAAE,OAAO,EAAE,iBAAiB,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAA;AAC/F,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAC1D,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,wBAAwB,CAAA;AAQ1E;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,UAAU,WAAW;IACzB,MAAM,EAAE,GAAG,WAAW,EAAE,CAAA;IACxB,MAAM,EAAE,CAAC,EAAE,GAAG,cAAc,EAAE,CAAA;IAC9B,MAAM,EAAE,IAAI,EAAE,GAAG,OAAO,EAAe,CAAA;IACvC,MAAM,IAAI,GAAG,aAAa,EAAE,CAAA;IAC5B,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,cAAc,EAAE,KAAK,EAAE,GAAG,iBAAiB,EAAE,CAAA;IAEpE,MAAM,CAAC,SAAS,EAAE,YAAY,CAAC,GAAG,YAAY,CAAC,KAAK,CAAC,CAAA;IACrD,MAAM,CAAC,eAAe,EAAE,kBAAkB,CAAC,GAAG,YAAY,CAAC,EAAE,CAAC,CAAA;IAC9D,MAAM,CAAC,WAAW,EAAE,cAAc,CAAC,GAAG,YAAY,CAAC,EAAE,CAAC,CAAA;IAEtD,MAAM,MAAM,GAAG,GAAuB,EAAE,CAAC,IAAI,E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,oCAAoC,EAAE,SAAS,EAAE;YACzD,YAAY,EAAE,4BAA4B;SAC3C,CAAC,CACH,CAAA;AACH,CAAC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The billing section.
|
|
3
|
+
*
|
|
4
|
+
* @module
|
|
5
|
+
*/
|
|
6
|
+
import { type JSX } from 'solid-js';
|
|
7
|
+
/**
|
|
8
|
+
* Billing section — current plan + Upgrade button.
|
|
9
|
+
*
|
|
10
|
+
* Fetches `/api/billing/status` on mount and uses the returned plan
|
|
11
|
+
* name as a more accurate label than the parent-supplied default.
|
|
12
|
+
* The `plan` prop remains a fallback (e.g. for offline rendering or
|
|
13
|
+
* apps that don't expose `/billing/status`).
|
|
14
|
+
*
|
|
15
|
+
* The Upgrade button navigates to `upgradeTo` (default `/settings`).
|
|
16
|
+
* Pass `upgradeTo="/billing"` or `upgradeTo="/pricing"` if your app
|
|
17
|
+
* routes elsewhere. Apps with a multi-tier checkout flow should use
|
|
18
|
+
* `<TiersUpgradeSection>` instead.
|
|
19
|
+
*
|
|
20
|
+
* @param props - Component props.
|
|
21
|
+
* @returns The billing section.
|
|
22
|
+
*/
|
|
23
|
+
export declare function BillingSection(props: {
|
|
24
|
+
/** Fallback plan label until (or unless) `/api/billing/status` answers. */
|
|
25
|
+
plan?: string;
|
|
26
|
+
/** Where the Upgrade button navigates. Defaults to `/settings`. */
|
|
27
|
+
upgradeTo?: string;
|
|
28
|
+
}): JSX.Element;
|
|
29
|
+
//# sourceMappingURL=BillingSection.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BillingSection.d.ts","sourceRoot":"","sources":["../src/BillingSection.tsx"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAgB,KAAK,GAAG,EAAa,MAAM,UAAU,CAAA;AAM5D;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE;IACpC,2EAA2E;IAC3E,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,mEAAmE;IACnE,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB,GAAG,GAAG,CAAC,OAAO,CA8Cd"}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The billing section.
|
|
3
|
+
*
|
|
4
|
+
* @module
|
|
5
|
+
*/
|
|
6
|
+
import { createSignal, onCleanup } from 'solid-js';
|
|
7
|
+
import { useHttpClient, useRouter, useTranslation } from '@molecule/app-solid';
|
|
8
|
+
import { getClassMap } from '@molecule/app-ui';
|
|
9
|
+
import { Button, Flex } from '@molecule/app-ui-solid';
|
|
10
|
+
/**
|
|
11
|
+
* Billing section — current plan + Upgrade button.
|
|
12
|
+
*
|
|
13
|
+
* Fetches `/api/billing/status` on mount and uses the returned plan
|
|
14
|
+
* name as a more accurate label than the parent-supplied default.
|
|
15
|
+
* The `plan` prop remains a fallback (e.g. for offline rendering or
|
|
16
|
+
* apps that don't expose `/billing/status`).
|
|
17
|
+
*
|
|
18
|
+
* The Upgrade button navigates to `upgradeTo` (default `/settings`).
|
|
19
|
+
* Pass `upgradeTo="/billing"` or `upgradeTo="/pricing"` if your app
|
|
20
|
+
* routes elsewhere. Apps with a multi-tier checkout flow should use
|
|
21
|
+
* `<TiersUpgradeSection>` instead.
|
|
22
|
+
*
|
|
23
|
+
* @param props - Component props.
|
|
24
|
+
* @returns The billing section.
|
|
25
|
+
*/
|
|
26
|
+
export function BillingSection(props) {
|
|
27
|
+
const cm = getClassMap();
|
|
28
|
+
const { t } = useTranslation();
|
|
29
|
+
const { navigate } = useRouter();
|
|
30
|
+
const http = useHttpClient();
|
|
31
|
+
const [livePlan, setLivePlan] = createSignal(null);
|
|
32
|
+
const plan = () => props.plan ?? 'Free';
|
|
33
|
+
const upgradeTo = () => props.upgradeTo ?? '/settings';
|
|
34
|
+
// Refresh the current plan from the bonded entitlements/billing
|
|
35
|
+
// status endpoint on mount. Fire-and-forget; the prop-supplied
|
|
36
|
+
// `plan` is the fallback if the fetch fails.
|
|
37
|
+
let cancelled = false;
|
|
38
|
+
onCleanup(() => {
|
|
39
|
+
cancelled = true;
|
|
40
|
+
});
|
|
41
|
+
void http
|
|
42
|
+
.get('/api/billing/status')
|
|
43
|
+
.then((res) => {
|
|
44
|
+
if (cancelled)
|
|
45
|
+
return;
|
|
46
|
+
const body = res.data ?? res;
|
|
47
|
+
const name = body?.name;
|
|
48
|
+
if (typeof name === 'string' && name)
|
|
49
|
+
setLivePlan(name);
|
|
50
|
+
})
|
|
51
|
+
.catch((_error) => {
|
|
52
|
+
/* fallback to the prop-supplied plan label */
|
|
53
|
+
});
|
|
54
|
+
return (<section>
|
|
55
|
+
<h3 class={cm.cn(cm.sectionHeading, cm.sp('mb', 3))}>
|
|
56
|
+
{t('settings.billing', undefined, { defaultValue: 'Billing' })}
|
|
57
|
+
</h3>
|
|
58
|
+
<Flex align="center" justify="between">
|
|
59
|
+
<span class={cm.textSize('sm')}>
|
|
60
|
+
{t('settings.plan', undefined, { defaultValue: 'Plan: ' })}
|
|
61
|
+
<strong>{livePlan() ?? plan()}</strong>
|
|
62
|
+
</span>
|
|
63
|
+
<Button variant="outline" size="sm" onClick={() => navigate(upgradeTo())}>
|
|
64
|
+
{t('settings.upgrade', undefined, { defaultValue: 'Upgrade' })}
|
|
65
|
+
</Button>
|
|
66
|
+
</Flex>
|
|
67
|
+
</section>);
|
|
68
|
+
}
|
|
69
|
+
//# sourceMappingURL=BillingSection.jsx.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BillingSection.jsx","sourceRoot":"","sources":["../src/BillingSection.tsx"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,YAAY,EAAY,SAAS,EAAE,MAAM,UAAU,CAAA;AAE5D,OAAO,EAAE,aAAa,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAA;AAC9E,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAC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