@molecule/app-settings-panel-solid 0.0.0-stage → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (59) hide show
  1. package/LICENSE +202 -0
  2. package/README.md +535 -2
  3. package/dist/AccountSection.d.ts +19 -0
  4. package/dist/AccountSection.d.ts.map +1 -0
  5. package/dist/AccountSection.jsx +147 -0
  6. package/dist/AccountSection.jsx.map +1 -0
  7. package/dist/AppearanceSection.d.ts +17 -0
  8. package/dist/AppearanceSection.d.ts.map +1 -0
  9. package/dist/AppearanceSection.jsx +34 -0
  10. package/dist/AppearanceSection.jsx.map +1 -0
  11. package/dist/AuthSection.d.ts +26 -0
  12. package/dist/AuthSection.d.ts.map +1 -0
  13. package/dist/AuthSection.jsx +252 -0
  14. package/dist/AuthSection.jsx.map +1 -0
  15. package/dist/BillingSection.d.ts +29 -0
  16. package/dist/BillingSection.d.ts.map +1 -0
  17. package/dist/BillingSection.jsx +69 -0
  18. package/dist/BillingSection.jsx.map +1 -0
  19. package/dist/DevicesSection.d.ts +31 -0
  20. package/dist/DevicesSection.d.ts.map +1 -0
  21. package/dist/DevicesSection.jsx +130 -0
  22. package/dist/DevicesSection.jsx.map +1 -0
  23. package/dist/LogOutDeleteSection.d.ts +18 -0
  24. package/dist/LogOutDeleteSection.d.ts.map +1 -0
  25. package/dist/LogOutDeleteSection.jsx +99 -0
  26. package/dist/LogOutDeleteSection.jsx.map +1 -0
  27. package/dist/NotificationsSection.d.ts +23 -0
  28. package/dist/NotificationsSection.d.ts.map +1 -0
  29. package/dist/NotificationsSection.jsx +120 -0
  30. package/dist/NotificationsSection.jsx.map +1 -0
  31. package/dist/SettingsContainer.d.ts +22 -0
  32. package/dist/SettingsContainer.d.ts.map +1 -0
  33. package/dist/SettingsContainer.jsx +30 -0
  34. package/dist/SettingsContainer.jsx.map +1 -0
  35. package/dist/ThisDeviceSection.d.ts +17 -0
  36. package/dist/ThisDeviceSection.d.ts.map +1 -0
  37. package/dist/ThisDeviceSection.jsx +60 -0
  38. package/dist/ThisDeviceSection.jsx.map +1 -0
  39. package/dist/TiersUpgradeSection.d.ts +24 -0
  40. package/dist/TiersUpgradeSection.d.ts.map +1 -0
  41. package/dist/TiersUpgradeSection.jsx +181 -0
  42. package/dist/TiersUpgradeSection.jsx.map +1 -0
  43. package/dist/context.d.ts +17 -0
  44. package/dist/context.d.ts.map +1 -0
  45. package/dist/context.js +24 -0
  46. package/dist/context.js.map +1 -0
  47. package/dist/index.d.ts +88 -0
  48. package/dist/index.d.ts.map +1 -0
  49. package/dist/index.js +88 -0
  50. package/dist/index.js.map +1 -0
  51. package/dist/pushToggle.d.ts +12 -0
  52. package/dist/pushToggle.d.ts.map +1 -0
  53. package/dist/pushToggle.js +11 -0
  54. package/dist/pushToggle.js.map +1 -0
  55. package/dist/types.d.ts +38 -0
  56. package/dist/types.d.ts.map +1 -0
  57. package/dist/types.js +7 -0
  58. package/dist/types.js.map +1 -0
  59. package/package.json +71 -4
@@ -0,0 +1,31 @@
1
+ /**
2
+ * The devices section.
3
+ *
4
+ * @module
5
+ */
6
+ import { type JSX } from 'solid-js';
7
+ import type { Device } from './types.js';
8
+ /**
9
+ * Devices section — lists the user's registered devices and lets them
10
+ * revoke (sign out) any device other than the one they're currently using.
11
+ *
12
+ * Revoking deletes the device row (`DELETE /api/devices/:id`). The API's
13
+ * authorization layer enforces server-side revocation: it rejects that
14
+ * device's session the next time it makes a request (within the
15
+ * device-exists cache TTL), so the removed device is actually signed out —
16
+ * not just hidden from the list. The current device is labelled
17
+ * "This device" and is not revocable here (use Sign out for the current
18
+ * session). Recreates molecule v1's device-revocation behaviour.
19
+ *
20
+ * Apps that want a different trailing element per row can pass a
21
+ * `renderRowIcon` callback (which then replaces the built-in revoke
22
+ * control); pass `() => null` to suppress it entirely.
23
+ *
24
+ * @param props - Component props.
25
+ * @returns The devices settings section.
26
+ */
27
+ export declare function DevicesSection(props: {
28
+ /** Replaces the built-in revoke control per row; `() => null` suppresses it. */
29
+ renderRowIcon?: (device: Device) => JSX.Element;
30
+ }): JSX.Element;
31
+ //# sourceMappingURL=DevicesSection.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DevicesSection.d.ts","sourceRoot":"","sources":["../src/DevicesSection.tsx"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAqB,KAAK,GAAG,EAAiB,MAAM,UAAU,CAAA;AAMrE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,YAAY,CAAA;AAExC;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE;IACpC,gFAAgF;IAChF,aAAa,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,GAAG,CAAC,OAAO,CAAA;CAChD,GAAG,GAAG,CAAC,OAAO,CAoId"}
@@ -0,0 +1,130 @@
1
+ /**
2
+ * The devices section.
3
+ *
4
+ * @module
5
+ */
6
+ import { createSignal, For, onMount, Show } from 'solid-js';
7
+ import { useHttpClient, useTranslation } from '@molecule/app-solid';
8
+ import { getClassMap, molIdProps } from '@molecule/app-ui';
9
+ import { Button, Flex, Icon, Spinner } from '@molecule/app-ui-solid';
10
+ /**
11
+ * Devices section — lists the user's registered devices and lets them
12
+ * revoke (sign out) any device other than the one they're currently using.
13
+ *
14
+ * Revoking deletes the device row (`DELETE /api/devices/:id`). The API's
15
+ * authorization layer enforces server-side revocation: it rejects that
16
+ * device's session the next time it makes a request (within the
17
+ * device-exists cache TTL), so the removed device is actually signed out —
18
+ * not just hidden from the list. The current device is labelled
19
+ * "This device" and is not revocable here (use Sign out for the current
20
+ * session). Recreates molecule v1's device-revocation behaviour.
21
+ *
22
+ * Apps that want a different trailing element per row can pass a
23
+ * `renderRowIcon` callback (which then replaces the built-in revoke
24
+ * control); pass `() => null` to suppress it entirely.
25
+ *
26
+ * @param props - Component props.
27
+ * @returns The devices settings section.
28
+ */
29
+ export function DevicesSection(props) {
30
+ const cm = getClassMap();
31
+ const { t } = useTranslation();
32
+ const http = useHttpClient();
33
+ const [devices, setDevices] = createSignal([]);
34
+ const [loading, setLoading] = createSignal(true);
35
+ const [confirmingId, setConfirmingId] = createSignal(null);
36
+ const [revokingId, setRevokingId] = createSignal(null);
37
+ const load = async () => {
38
+ try {
39
+ // GET /api/devices responds with the ARRAY itself (see the device
40
+ // resource's query handler) — response.data IS the rows. This used to
41
+ // read `response.data.data`, which is always undefined for that shape,
42
+ // so the section rendered "No devices" for everyone.
43
+ const response = await http.get('/api/devices');
44
+ setDevices(Array.isArray(response.data) ? response.data : []);
45
+ }
46
+ catch (_error) {
47
+ // Devices endpoint is optional; the section renders empty when unavailable.
48
+ }
49
+ finally {
50
+ setLoading(false);
51
+ }
52
+ };
53
+ onMount(() => {
54
+ void load();
55
+ });
56
+ const revoke = async (id) => {
57
+ setRevokingId(id);
58
+ try {
59
+ await http.delete(`/api/devices/${id}`);
60
+ setConfirmingId(null);
61
+ await load();
62
+ }
63
+ catch (_error) {
64
+ // Best-effort — keep the row so the user can retry the revoke.
65
+ }
66
+ finally {
67
+ setRevokingId(null);
68
+ }
69
+ };
70
+ const trailing = (device) => {
71
+ if (props.renderRowIcon)
72
+ return props.renderRowIcon(device);
73
+ if (device.isCurrent)
74
+ return <Icon name="chevron-right" size={16} className={cm.textSubtle}/>;
75
+ if (confirmingId() === device.id) {
76
+ return (<Flex align="center" gap="sm">
77
+ <Button variant="ghost" size="sm" disabled={revokingId() === device.id} onClick={() => setConfirmingId(null)}>
78
+ {t('common.cancel', undefined, { defaultValue: 'Cancel' })}
79
+ </Button>
80
+ <Button color="error" size="sm" loading={revokingId() === device.id} onClick={() => void revoke(device.id)} {...molIdProps('device-revoke-confirm')}>
81
+ {t('settings.signOutDevice', undefined, { defaultValue: 'Sign out' })}
82
+ </Button>
83
+ </Flex>);
84
+ }
85
+ return (<Button variant="ghost" size="sm" onClick={() => setConfirmingId(device.id)} {...molIdProps('device-revoke')}>
86
+ {t('settings.signOutDevice', undefined, { defaultValue: 'Sign out' })}
87
+ </Button>);
88
+ };
89
+ return (<section>
90
+ <Flex align="center" gap="sm" className={cm.sp('mb', 3)}>
91
+ <h3 class={cm.sectionHeading}>
92
+ {t('settings.devices', undefined, { defaultValue: 'Devices' })}
93
+ </h3>
94
+ <Show when={loading()}>
95
+ <Spinner size="xs"/>
96
+ </Show>
97
+ </Flex>
98
+ <Show when={devices().length > 0} fallback={<Show when={!loading()}>
99
+ <p class={cm.cn(cm.textSize('sm'), cm.textMuted)}>
100
+ {t('settings.noDevices', undefined, { defaultValue: 'No devices found' })}
101
+ </p>
102
+ </Show>}>
103
+ <ul class={cm.stack(2)}>
104
+ <For each={devices()}>
105
+ {(device) => (<li>
106
+ <Flex align="center" justify="between" className={cm.cn(cm.textSize('sm'), cm.sp('py', 1))}>
107
+ <span>
108
+ {device.name || device.platform}
109
+ <Show when={device.isCurrent}>
110
+ <span class={cm.cn(cm.textSize('xs'), cm.textSubtle, cm.sp('ml', 2))}>
111
+ {t('settings.thisDevice', undefined, { defaultValue: 'This Device' })}
112
+ </span>
113
+ </Show>
114
+ </span>
115
+ {trailing(device)}
116
+ </Flex>
117
+ <Show when={confirmingId() === device.id}>
118
+ <p class={cm.cn(cm.textSize('xs'), cm.textMuted, cm.sp('mt', 1))}>
119
+ {t('settings.revokeDeviceWarning', undefined, {
120
+ defaultValue: "This device's access will be revoked shortly. Sign it out?",
121
+ })}
122
+ </p>
123
+ </Show>
124
+ </li>)}
125
+ </For>
126
+ </ul>
127
+ </Show>
128
+ </section>);
129
+ }
130
+ //# sourceMappingURL=DevicesSection.jsx.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DevicesSection.jsx","sourceRoot":"","sources":["../src/DevicesSection.tsx"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,YAAY,EAAE,GAAG,EAAY,OAAO,EAAE,IAAI,EAAE,MAAM,UAAU,CAAA;AAErE,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE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EAAE,EAAE,CAAC,UAAU,EAAE,EAAE,CAAC,EAAE,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC,CACnE;wBAAA,CAAC,CAAC,CAAC,qBAAqB,EAAE,SAAS,EAAE,EAAE,YAAY,EAAE,aAAa,EAAE,CAAC,CACvE;sBAAA,EAAE,IAAI,CACR;oBAAA,EAAE,IAAI,CACR;kBAAA,EAAE,IAAI,CACN;kBAAA,CAAC,QAAQ,CAAC,MAAM,CAAC,CACnB;gBAAA,EAAE,IAAI,CACN;gBAAA,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,YAAY,EAAE,KAAK,MAAM,CAAC,EAAE,CAAC,CACvC;kBAAA,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,EAAE,CAAC,SAAS,EAAE,EAAE,CAAC,EAAE,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC,CAC/D;oBAAA,CAAC,CAAC,CAAC,8BAA8B,EAAE,SAAS,EAAE;gBAC5C,YAAY,EAAE,4DAA4D;aAC3E,CAAC,CACJ;kBAAA,EAAE,CAAC,CACL;gBAAA,EAAE,IAAI,CACR;cAAA,EAAE,EAAE,CAAC,CACN,CACH;UAAA,EAAE,GAAG,CACP;QAAA,EAAE,EAAE,CACN;MAAA,EAAE,IAAI,CACR;IAAA,EAAE,OAAO,CAAC,CACX,CAAA;AACH,CAAC"}
@@ -0,0 +1,18 @@
1
+ /**
2
+ * The bottom actions section: sign out and delete account.
3
+ *
4
+ * @module
5
+ */
6
+ import { type JSX } from 'solid-js';
7
+ /**
8
+ * Bottom actions section — Log out + Delete account.
9
+ *
10
+ * Owns the delete-account modal internally (the trigger lives in the
11
+ * same section so the modal lives here too). Reads `onClose` from
12
+ * the `<SettingsContainer>` context to dismiss the panel after either
13
+ * action and navigates to `/login`.
14
+ *
15
+ * @returns The bottom actions section.
16
+ */
17
+ export declare function LogOutDeleteSection(): JSX.Element;
18
+ //# sourceMappingURL=LogOutDeleteSection.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"LogOutDeleteSection.d.ts","sourceRoot":"","sources":["../src/LogOutDeleteSection.tsx"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAgB,KAAK,GAAG,EAAQ,MAAM,UAAU,CAAA;AAUvD;;;;;;;;;GASG;AACH,wBAAgB,mBAAmB,IAAI,GAAG,CAAC,OAAO,CAsGjD"}
@@ -0,0 +1,99 @@
1
+ /**
2
+ * The bottom actions section: sign out and delete account.
3
+ *
4
+ * @module
5
+ */
6
+ import { createSignal, Show } from 'solid-js';
7
+ import { serverErrorMessage } from '@molecule/app-http';
8
+ import { useAuth, useHttpClient, useRouter, useTranslation } from '@molecule/app-solid';
9
+ import { getClassMap, molIdProps } from '@molecule/app-ui';
10
+ import { Alert, Button, Input, Modal } from '@molecule/app-ui-solid';
11
+ import { useSettingsPanelContext } from './context.js';
12
+ /**
13
+ * Bottom actions section — Log out + Delete account.
14
+ *
15
+ * Owns the delete-account modal internally (the trigger lives in the
16
+ * same section so the modal lives here too). Reads `onClose` from
17
+ * the `<SettingsContainer>` context to dismiss the panel after either
18
+ * action and navigates to `/login`.
19
+ *
20
+ * @returns The bottom actions section.
21
+ */
22
+ export function LogOutDeleteSection() {
23
+ const cm = getClassMap();
24
+ const { t } = useTranslation();
25
+ const { navigate } = useRouter();
26
+ const { user, logout } = useAuth();
27
+ const http = useHttpClient();
28
+ const { onClose } = useSettingsPanelContext();
29
+ const [showModal, setShowModal] = createSignal(false);
30
+ const [password, setPassword] = createSignal('');
31
+ const [loading, setLoading] = createSignal(false);
32
+ const [error, setError] = createSignal('');
33
+ const handleLogout = async () => {
34
+ await logout();
35
+ onClose();
36
+ navigate('/login');
37
+ };
38
+ const handleDelete = async (e) => {
39
+ e.preventDefault();
40
+ setLoading(true);
41
+ setError('');
42
+ try {
43
+ await http.delete(`/api/users/${user()?.id}`, { data: { password: password() } });
44
+ await logout();
45
+ onClose();
46
+ navigate('/login');
47
+ }
48
+ catch (err) {
49
+ setError(serverErrorMessage(err) ??
50
+ t('settings.failedToDeleteAccount', undefined, {
51
+ defaultValue: 'Failed to delete account.',
52
+ }));
53
+ }
54
+ finally {
55
+ setLoading(false);
56
+ }
57
+ };
58
+ return (<>
59
+ <section class={cm.stack(3)}>
60
+ <Button color="error" fullWidth onClick={() => void handleLogout()} {...molIdProps('user-menu-logout')}>
61
+ {t('settings.logOut', undefined, { defaultValue: 'Sign out' })}
62
+ </Button>
63
+ <Button variant="ghost" fullWidth onClick={() => setShowModal(true)} {...molIdProps('user-menu-delete-account')}>
64
+ {t('settings.deleteAccount', undefined, { defaultValue: 'Delete account' })}
65
+ </Button>
66
+ </section>
67
+
68
+ <Modal open={showModal()} onClose={() => setShowModal(false)} title={t('settings.deleteAccountModal.title', undefined, {
69
+ defaultValue: 'Delete Account',
70
+ })}>
71
+ <p class={cm.cn(cm.textSize('sm'), cm.textMuted, cm.sp('mb', 4))}>
72
+ {t('settings.deleteAccountModal.warning', undefined, {
73
+ defaultValue: 'This action cannot be undone. Please enter your password to confirm.',
74
+ })}
75
+ </p>
76
+ <Show when={error()}>
77
+ <Alert status="error" className={cm.sp('mb', 4)}>
78
+ {error()}
79
+ </Alert>
80
+ </Show>
81
+ <form class={cm.stack(4)} onSubmit={(e) => void handleDelete(e)}>
82
+ <div>
83
+ <label for="delete-pw" class={cm.formLabel}>
84
+ {t('settings.deleteAccountModal.password', undefined, { defaultValue: 'Password' })}
85
+ </label>
86
+ <Input id="delete-pw" type="password" value={password()} onChange={(e) => setPassword(e.target.value)} required/>
87
+ </div>
88
+ <Button type="submit" color="error" fullWidth loading={loading()}>
89
+ {loading()
90
+ ? t('settings.deleteAccountModal.deleting', undefined, {
91
+ defaultValue: 'Deleting...',
92
+ })
93
+ : t('settings.deleteAccount', undefined, { defaultValue: 'Delete account' })}
94
+ </Button>
95
+ </form>
96
+ </Modal>
97
+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,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,KAAK,YAAY,CAAC,CAAC,CAAC,CAAC,CAC9D;UAAA,CAAC,GAAG,CACF;YAAA,CAAC,KAAK,CAAC,GAAG,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,SAAS,CAAC,CACzC;cAAA,CAAC,CAAC,CAAC,sCAAsC,EAAE,SAAS,EAAE,EAAE,YAAY,EAAE,UAAU,EAAE,CAAC,CACrF;YAAA,EAAE,KAAK,CACP;YAAA,CAAC,KAAK,CACJ,EAAE,CAAC,WAAW,CACd,IAAI,CAAC,UAAU,CACf,KAAK,CAAC,CAAC,QAAQ,EAAE,CAAC,CAClB,QAAQ,CAAC,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,WAAW,CAAE,CAAC,CAAC,MAA2B,CAAC,KAAK,CAAC,CAAC,CACnE,QAAQ,EAEZ;UAAA,EAAE,GAAG,CACL;UAAA,CAAC,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,OAAO,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,OAAO,EAAE,CAAC,CAC/D;YAAA,CAAC,OAAO,EAAE;YACR,CAAC,CAAC,CAAC,CAAC,sCAAsC,EAAE,SAAS,EAAE;gBACnD,YAAY,EAAE,aAAa;aAC5B,CAAC;YACJ,CAAC,CAAC,CAAC,CAAC,wBAAwB,EAAE,SAAS,EAAE,EAAE,YAAY,EAAE,gBAAgB,EAAE,CAAC,CAChF;UAAA,EAAE,MAAM,CACV;QAAA,EAAE,IAAI,CACR;MAAA,EAAE,KAAK,CACT;IAAA,GAAG,CACJ,CAAA;AACH,CAAC"}
@@ -0,0 +1,23 @@
1
+ /**
2
+ * The push-notification section.
3
+ *
4
+ * @module
5
+ */
6
+ import { type JSX } from 'solid-js';
7
+ /**
8
+ * Push-notification toggle section — the full receive-side enable chain:
9
+ * browser permission → runtime VAPID public key
10
+ * (`GET /api/devices/push/public-key`) → `pushManager.subscribe` with
11
+ * `applicationServerKey` → PATCH the subscription onto the current device
12
+ * row (`/api/devices/:id { pushSubscription, hasPushSubscription }`), which
13
+ * is where the api-side push fan-outs look for it.
14
+ *
15
+ * Initial state reflects SERVER truth (the current device row's
16
+ * `hasPushSubscription`), and every failure surfaces as an honest inline
17
+ * message — a dev build without a service worker fails fast instead of
18
+ * hanging the switch.
19
+ *
20
+ * @returns The notifications settings section.
21
+ */
22
+ export declare function NotificationsSection(): JSX.Element;
23
+ //# sourceMappingURL=NotificationsSection.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"NotificationsSection.d.ts","sourceRoot":"","sources":["../src/NotificationsSection.tsx"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAgB,KAAK,GAAG,EAAmB,MAAM,UAAU,CAAA;AAYlE;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,oBAAoB,IAAI,GAAG,CAAC,OAAO,CA0GlD"}
@@ -0,0 +1,120 @@
1
+ /**
2
+ * The push-notification section.
3
+ *
4
+ * @module
5
+ */
6
+ import { createSignal, onCleanup, Show } from 'solid-js';
7
+ import { disablePushOnCurrentDevice, enablePushOnCurrentDevice, readCurrentDevicePushEnabled, } from '@molecule/app-push';
8
+ import { useHttpClient, usePush, useTranslation } from '@molecule/app-solid';
9
+ import { getClassMap, molIdProps } from '@molecule/app-ui';
10
+ import { Flex, Switch } from '@molecule/app-ui-solid';
11
+ /**
12
+ * Push-notification toggle section — the full receive-side enable chain:
13
+ * browser permission → runtime VAPID public key
14
+ * (`GET /api/devices/push/public-key`) → `pushManager.subscribe` with
15
+ * `applicationServerKey` → PATCH the subscription onto the current device
16
+ * row (`/api/devices/:id { pushSubscription, hasPushSubscription }`), which
17
+ * is where the api-side push fan-outs look for it.
18
+ *
19
+ * Initial state reflects SERVER truth (the current device row's
20
+ * `hasPushSubscription`), and every failure surfaces as an honest inline
21
+ * message — a dev build without a service worker fails fast instead of
22
+ * hanging the switch.
23
+ *
24
+ * @returns The notifications settings section.
25
+ */
26
+ export function NotificationsSection() {
27
+ const cm = getClassMap();
28
+ const { t } = useTranslation();
29
+ const http = useHttpClient();
30
+ const { requestPermission, register, unregister } = usePush();
31
+ const [enabled, setEnabled] = createSignal(false);
32
+ const [busy, setBusy] = createSignal(false);
33
+ const [error, setError] = createSignal(null);
34
+ let cancelled = false;
35
+ onCleanup(() => {
36
+ cancelled = true;
37
+ });
38
+ // Server truth for THIS device; resolves false (never throws) when the
39
+ // devices endpoint is unavailable.
40
+ void readCurrentDevicePushEnabled(http).then((serverEnabled) => {
41
+ if (!cancelled && serverEnabled)
42
+ setEnabled(true);
43
+ });
44
+ const failureMessage = (result) => {
45
+ switch (result.reason) {
46
+ case 'permission-denied':
47
+ return t('settings.pushPermissionDenied', undefined, {
48
+ defaultValue: 'Notification permission was denied.',
49
+ });
50
+ case 'server-unconfigured':
51
+ return t('settings.pushServerUnavailable', undefined, {
52
+ defaultValue: 'Push notifications are not configured on this server.',
53
+ });
54
+ case 'register-failed':
55
+ // The push provider throws already-localized messages (not supported /
56
+ // no service worker in a dev build / push-service rejection).
57
+ return (result.message ||
58
+ t('settings.pushUpdateFailed', undefined, {
59
+ defaultValue: 'Could not update push notification settings.',
60
+ }));
61
+ case 'persist-failed':
62
+ // `result.message` here is the HTTP client's error (a status line or a
63
+ // network error), not text written for the user, so it is not shown.
64
+ return t('settings.pushUpdateFailed', undefined, {
65
+ defaultValue: 'Could not update push notification settings.',
66
+ });
67
+ }
68
+ };
69
+ const handleToggle = async (next) => {
70
+ if (busy())
71
+ return;
72
+ setBusy(true);
73
+ setError(null);
74
+ try {
75
+ if (next) {
76
+ const result = await enablePushOnCurrentDevice({ http, requestPermission, register });
77
+ if (result.ok) {
78
+ setEnabled(true);
79
+ }
80
+ else {
81
+ setError(failureMessage(result));
82
+ }
83
+ }
84
+ else {
85
+ const result = await disablePushOnCurrentDevice({ http, unregister });
86
+ // The switch goes off locally either way; a failed server clear is
87
+ // still reported so the user knows sends may continue.
88
+ setEnabled(false);
89
+ if (!result.ok) {
90
+ setError(failureMessage(result));
91
+ }
92
+ }
93
+ }
94
+ finally {
95
+ setBusy(false);
96
+ }
97
+ };
98
+ return (<section>
99
+ <h3 class={cm.cn(cm.sectionHeading, cm.sp('mb', 3))}>
100
+ {t('settings.notifications', undefined, { defaultValue: 'Notifications' })}
101
+ </h3>
102
+ <Flex align="center" justify="between">
103
+ <span class={cm.textSize('sm')}>
104
+ {t('settings.pushNotifications', undefined, { defaultValue: 'Push notifications' })}
105
+ </span>
106
+ <Switch checked={enabled()} disabled={busy()}
107
+ // The visible text is a SIBLING span, not the Switch's label —
108
+ // without aria-label the control is announced as just "switch".
109
+ aria-label={t('settings.pushNotifications', undefined, {
110
+ defaultValue: 'Push notifications',
111
+ })} onChange={(e) => void handleToggle(e.target.checked)} size="sm" {...molIdProps('settings-push-toggle')}/>
112
+ </Flex>
113
+ <Show when={error()}>
114
+ <p class={cm.cn(cm.textSize('xs'), cm.textError, cm.sp('mt', 1))} role="alert" data-mol-id="settings-push-error">
115
+ {error()}
116
+ </p>
117
+ </Show>
118
+ </section>);
119
+ }
120
+ //# sourceMappingURL=NotificationsSection.jsx.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"NotificationsSection.jsx","sourceRoot":"","sources":["../src/NotificationsSection.tsx"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,YAAY,EAAY,SAAS,EAAE,IAAI,EAAE,MAAM,UAAU,CAAA;AAGlE,OAAO,EACL,0BAA0B,EAC1B,yBAAyB,EACzB,4BAA4B,GAC7B,MAAM,oBAAoB,CAAA;AAC3B,OAAO,EAAE,aAAa,EAAE,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAA;AAC5E,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAC1D,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,M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AE,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC,CAC9D,IAAI,CAAC,OAAO,CACZ,WAAW,CAAC,qBAAqB,CAEjC;UAAA,CAAC,KAAK,EAAE,CACV;QAAA,EAAE,CAAC,CACL;MAAA,EAAE,IAAI,CACR;IAAA,EAAE,OAAO,CAAC,CACX,CAAA;AACH,CAAC"}
@@ -0,0 +1,22 @@
1
+ /**
2
+ * The settings container.
3
+ *
4
+ * @module
5
+ */
6
+ import type { JSX } from 'solid-js';
7
+ /**
8
+ * Outer settings-panel layout: padded vertical stack that hosts the
9
+ * section sub-components. Publishes `onClose` to descendants via
10
+ * context so `<LogOutDeleteSection>` etc. can dismiss the panel
11
+ * after an action without explicit prop threading.
12
+ *
13
+ * @param props - The component props.
14
+ * @returns The settings panel container.
15
+ */
16
+ export declare function SettingsContainer(props: {
17
+ /** The handler published to descendants through the container context. */
18
+ onClose: () => void;
19
+ /** The section sub-components the panel hosts. */
20
+ children?: JSX.Element;
21
+ }): JSX.Element;
22
+ //# sourceMappingURL=SettingsContainer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SettingsContainer.d.ts","sourceRoot":"","sources":["../src/SettingsContainer.tsx"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,UAAU,CAAA;AAOnC;;;;;;;;GAQG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE;IACvC,0EAA0E;IAC1E,OAAO,EAAE,MAAM,IAAI,CAAA;IACnB,kDAAkD;IAClD,QAAQ,CAAC,EAAE,GAAG,CAAC,OAAO,CAAA;CACvB,GAAG,GAAG,CAAC,OAAO,CAcd"}
@@ -0,0 +1,30 @@
1
+ /**
2
+ * The settings container.
3
+ *
4
+ * @module
5
+ */
6
+ import { getClassMap } from '@molecule/app-ui';
7
+ import { SettingsPanelContext } from './context.js';
8
+ /**
9
+ * Outer settings-panel layout: padded vertical stack that hosts the
10
+ * section sub-components. Publishes `onClose` to descendants via
11
+ * context so `<LogOutDeleteSection>` etc. can dismiss the panel
12
+ * after an action without explicit prop threading.
13
+ *
14
+ * @param props - The component props.
15
+ * @returns The settings panel container.
16
+ */
17
+ export function SettingsContainer(props) {
18
+ const cm = getClassMap();
19
+ // Read the CURRENT prop, so a changed handler reaches descendants the way
20
+ // React's memoized context value does after a re-render.
21
+ const value = {
22
+ get onClose() {
23
+ return props.onClose;
24
+ },
25
+ };
26
+ return (<SettingsPanelContext.Provider value={value}>
27
+ <div class={cm.cn(cm.sp('p', 6), cm.stack(6))}>{props.children}</div>
28
+ </SettingsPanelContext.Provider>);
29
+ }
30
+ //# sourceMappingURL=SettingsContainer.jsx.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SettingsContainer.jsx","sourceRoot":"","sources":["../src/SettingsContainer.tsx"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAE9C,OAAO,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAA;AAGnD;;;;;;;;GAQG;AACH,MAAM,UAAU,iBAAiB,CAAC,KAKjC;IACC,MAAM,EAAE,GAAG,WAAW,EAAE,CAAA;IACxB,0EAA0E;IAC1E,yDAAyD;IACzD,MAAM,KAAK,GAA8B;QACvC,IAAI,OAAO;YACT,OAAO,KAAK,CAAC,OAAO,CAAA;QACtB,CAAC;KACF,CAAA;IACD,OAAO,CACL,CAAC,oBAAoB,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,CAC1C;MAAA,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,GAAG,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,QAAQ,CAAC,EAAE,GAAG,CACtE;IAAA,EAAE,oBAAoB,CAAC,QAAQ,CAAC,CACjC,CAAA;AACH,CAAC"}
@@ -0,0 +1,17 @@
1
+ /**
2
+ * The this-device section.
3
+ *
4
+ * @module
5
+ */
6
+ import type { JSX } from 'solid-js';
7
+ /**
8
+ * "This device" detail strip — OS, browser, online/offline.
9
+ *
10
+ * Reads everything from `@molecule/app-device` through the `useDevice` hook
11
+ * (`deviceInfo` and `isOnline()`), so the bonded device provider decides what
12
+ * it shows. No side effects, no app-specific state.
13
+ *
14
+ * @returns The this-device settings section.
15
+ */
16
+ export declare function ThisDeviceSection(): JSX.Element;
17
+ //# sourceMappingURL=ThisDeviceSection.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ThisDeviceSection.d.ts","sourceRoot":"","sources":["../src/ThisDeviceSection.tsx"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,UAAU,CAAA;AAMnC;;;;;;;;GAQG;AACH,wBAAgB,iBAAiB,IAAI,GAAG,CAAC,OAAO,CA4C/C"}
@@ -0,0 +1,60 @@
1
+ /**
2
+ * The this-device section.
3
+ *
4
+ * @module
5
+ */
6
+ import { useDevice, useTranslation } from '@molecule/app-solid';
7
+ import { getClassMap } from '@molecule/app-ui';
8
+ import { Flex } from '@molecule/app-ui-solid';
9
+ /**
10
+ * "This device" detail strip — OS, browser, online/offline.
11
+ *
12
+ * Reads everything from `@molecule/app-device` through the `useDevice` hook
13
+ * (`deviceInfo` and `isOnline()`), so the bonded device provider decides what
14
+ * it shows. No side effects, no app-specific state.
15
+ *
16
+ * @returns The this-device settings section.
17
+ */
18
+ export function ThisDeviceSection() {
19
+ const cm = getClassMap();
20
+ const { t } = useTranslation();
21
+ const { deviceInfo, isOnline } = useDevice();
22
+ // The provider call must sit INSIDE the accessor: a ternary condition in
23
+ // JSX children is memoized by Solid's compiler, which would cache the
24
+ // provider call and stop re-reading it on re-renders (React re-reads it
25
+ // on every render).
26
+ const network = () => isOnline()
27
+ ? t('settings.online', undefined, { defaultValue: 'Online' })
28
+ : t('settings.offline', undefined, { defaultValue: 'Offline' });
29
+ return (<section>
30
+ <h3 class={cm.cn(cm.sectionHeading, cm.sp('mb', 3))}>
31
+ {t('settings.thisDevice', undefined, { defaultValue: 'This Device' })}
32
+ </h3>
33
+ <dl class={cm.cn(cm.stack(1), cm.textSize('sm'))}>
34
+ <Flex justify="between">
35
+ <dt class={cm.textMuted}>
36
+ {t('settings.platform', undefined, { defaultValue: 'Platform' })}
37
+ </dt>
38
+ <dd>
39
+ {deviceInfo.os.name || t('settings.unknown', undefined, { defaultValue: 'Unknown' })}
40
+ </dd>
41
+ </Flex>
42
+ <Flex justify="between">
43
+ <dt class={cm.textMuted}>
44
+ {t('settings.browser', undefined, { defaultValue: 'Browser' })}
45
+ </dt>
46
+ <dd>
47
+ {deviceInfo.browser.name ||
48
+ t('settings.unknown', undefined, { defaultValue: 'Unknown' })}
49
+ </dd>
50
+ </Flex>
51
+ <Flex justify="between">
52
+ <dt class={cm.textMuted}>
53
+ {t('settings.network', undefined, { defaultValue: 'Network' })}
54
+ </dt>
55
+ <dd>{network()}</dd>
56
+ </Flex>
57
+ </dl>
58
+ </section>);
59
+ }
60
+ //# sourceMappingURL=ThisDeviceSection.jsx.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ThisDeviceSection.jsx","sourceRoot":"","sources":["../src/ThisDeviceSection.tsx"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAA;AAC/D,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAC9C,OAAO,EAAE,IAAI,EAAE,MAAM,wBAAwB,CAAA;AAE7C;;;;;;;;GAQG;AACH,MAAM,UAAU,iBAAiB;IAC/B,MAAM,EAAE,GAAG,WAAW,EAAE,CAAA;IACxB,MAAM,EAAE,CAAC,EAAE,GAAG,cAAc,EAAE,CAAA;IAC9B,MAAM,EAAE,UAAU,EAAE,QAAQ,EAAE,GAAG,S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AAA,CAAC,IAAI,CAAC,OAAO,CAAC,SAAS,CACrB;UAAA,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,SAAS,CAAC,CACtB;YAAA,CAAC,CAAC,CAAC,kBAAkB,EAAE,SAAS,EAAE,EAAE,YAAY,EAAE,SAAS,EAAE,CAAC,CAChE;UAAA,EAAE,EAAE,CACJ;UAAA,CAAC,EAAE,CACD;YAAA,CAAC,UAAU,CAAC,OAAO,CAAC,IAAI;YACtB,CAAC,CAAC,kBAAkB,EAAE,SAAS,EAAE,EAAE,YAAY,EAAE,SAAS,EAAE,CAAC,CACjE;UAAA,EAAE,EAAE,CACN;QAAA,EAAE,IAAI,CACN;QAAA,CAAC,IAAI,CAAC,OAAO,CAAC,SAAS,CACrB;UAAA,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,SAAS,CAAC,CACtB;YAAA,CAAC,CAAC,CAAC,kBAAkB,EAAE,SAAS,EAAE,EAAE,YAAY,EAAE,SAAS,EAAE,CAAC,CAChE;UAAA,EAAE,EAAE,CACJ;UAAA,CAAC,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,EAAE,EAAE,CACrB;QAAA,EAAE,IAAI,CACR;MAAA,EAAE,EAAE,CACN;IAAA,EAAE,OAAO,CAAC,CACX,CAAA;AACH,CAAC"}
@@ -0,0 +1,24 @@
1
+ /**
2
+ * The multi-tier billing section.
3
+ *
4
+ * @module
5
+ */
6
+ import { type JSX } from 'solid-js';
7
+ import type { TiersUpgradeSectionProps } from './types.js';
8
+ /**
9
+ * Billing section with full multi-tier upgrade flow.
10
+ *
11
+ * Replaces the simpler `<BillingSection>` for apps backed by
12
+ * `@molecule/api-payments-stripe` + `@molecule/api-resource-payment`
13
+ * — loads the user's current plan from `/api/billing/status`,
14
+ * loads available tiers from `/api/billing/tiers`, and renders an
15
+ * Upgrade modal with a Subscribe button per tier price. Subscribe
16
+ * POSTs to `/api/billing/checkout` and redirects to the Stripe
17
+ * checkout URL; paid users see a Cancel button that POSTs to
18
+ * `/api/billing/cancel`. A refused request shows the server's message.
19
+ *
20
+ * @param props - Component props.
21
+ * @returns The billing section.
22
+ */
23
+ export declare function TiersUpgradeSection(props: TiersUpgradeSectionProps): JSX.Element;
24
+ //# sourceMappingURL=TiersUpgradeSection.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TiersUpgradeSection.d.ts","sourceRoot":"","sources":["../src/TiersUpgradeSection.tsx"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAqB,KAAK,GAAG,EAAmB,MAAM,UAAU,CAAA;AAQvE,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,YAAY,CAAA;AAc1D;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,wBAAwB,GAAG,GAAG,CAAC,OAAO,CAyMhF"}