@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.
- 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,181 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The multi-tier billing section.
|
|
3
|
+
*
|
|
4
|
+
* @module
|
|
5
|
+
*/
|
|
6
|
+
import { createSignal, For, onCleanup, Show } from 'solid-js';
|
|
7
|
+
import { serverErrorMessage } from '@molecule/app-http';
|
|
8
|
+
import { useHttpClient, useTranslation } from '@molecule/app-solid';
|
|
9
|
+
import { getClassMap, molIdProps } from '@molecule/app-ui';
|
|
10
|
+
import { Alert, Button, ConfirmButton, Flex, Modal } from '@molecule/app-ui-solid';
|
|
11
|
+
import { openUrl } from '@molecule/app-utilities';
|
|
12
|
+
/**
|
|
13
|
+
* Billing section with full multi-tier upgrade flow.
|
|
14
|
+
*
|
|
15
|
+
* Replaces the simpler `<BillingSection>` for apps backed by
|
|
16
|
+
* `@molecule/api-payments-stripe` + `@molecule/api-resource-payment`
|
|
17
|
+
* — loads the user's current plan from `/api/billing/status`,
|
|
18
|
+
* loads available tiers from `/api/billing/tiers`, and renders an
|
|
19
|
+
* Upgrade modal with a Subscribe button per tier price. Subscribe
|
|
20
|
+
* POSTs to `/api/billing/checkout` and redirects to the Stripe
|
|
21
|
+
* checkout URL; paid users see a Cancel button that POSTs to
|
|
22
|
+
* `/api/billing/cancel`. A refused request shows the server's message.
|
|
23
|
+
*
|
|
24
|
+
* @param props - Component props.
|
|
25
|
+
* @returns The billing section.
|
|
26
|
+
*/
|
|
27
|
+
export function TiersUpgradeSection(props) {
|
|
28
|
+
const cm = getClassMap();
|
|
29
|
+
const { t } = useTranslation();
|
|
30
|
+
const http = useHttpClient();
|
|
31
|
+
const [plan, setPlan] = createSignal('Free');
|
|
32
|
+
const [planKey, setPlanKey] = createSignal('free');
|
|
33
|
+
const [tiers, setTiers] = createSignal([]);
|
|
34
|
+
const [showUpgrade, setShowUpgrade] = createSignal(false);
|
|
35
|
+
const [upgradeLoading, setUpgradeLoading] = createSignal(null);
|
|
36
|
+
const [upgradeError, setUpgradeError] = createSignal('');
|
|
37
|
+
let cancelled = false;
|
|
38
|
+
onCleanup(() => {
|
|
39
|
+
cancelled = true;
|
|
40
|
+
});
|
|
41
|
+
void Promise.all([
|
|
42
|
+
// Each fetch resolves null on failure; the .then handler then keeps the
|
|
43
|
+
// defaults ('Free', empty tier list) instead of throwing.
|
|
44
|
+
http.get('/api/billing/status').catch((_error) => null),
|
|
45
|
+
http
|
|
46
|
+
.get('/api/billing/tiers')
|
|
47
|
+
.catch((_error) => null),
|
|
48
|
+
])
|
|
49
|
+
.then(([statusRes, tiersRes]) => {
|
|
50
|
+
if (cancelled)
|
|
51
|
+
return;
|
|
52
|
+
const status = statusRes?.data ?? null;
|
|
53
|
+
if (status?.name)
|
|
54
|
+
setPlan(status.name);
|
|
55
|
+
if (status?.planKey)
|
|
56
|
+
setPlanKey(status.planKey);
|
|
57
|
+
const list = tiersRes?.data?.data ?? [];
|
|
58
|
+
if (Array.isArray(list)) {
|
|
59
|
+
setTiers(list.map((tier) => ({
|
|
60
|
+
planKey: tier.key,
|
|
61
|
+
name: tier.name,
|
|
62
|
+
prices: (tier.prices || []).map((p) => ({
|
|
63
|
+
stripePriceId: p.stripePriceId ?? undefined,
|
|
64
|
+
interval: p.period,
|
|
65
|
+
priceLabel: p.price,
|
|
66
|
+
})),
|
|
67
|
+
})));
|
|
68
|
+
}
|
|
69
|
+
})
|
|
70
|
+
.catch((_error) => {
|
|
71
|
+
// Fetch failures already resolve to null above; this only guards the
|
|
72
|
+
// mapping, keeping the section on its defaults rather than throwing.
|
|
73
|
+
});
|
|
74
|
+
// The free tiers and price-less tiers render nothing, so flatten to the
|
|
75
|
+
// subscribe buttons' rows up front (the same list React's map builds).
|
|
76
|
+
const priceRows = () => tiers()
|
|
77
|
+
.filter((tier) => tier.planKey !== 'free')
|
|
78
|
+
.flatMap((tier) => tier.prices.filter((p) => p.stripePriceId).map((price) => ({ tier, price })));
|
|
79
|
+
const handleStartCheckout = async (stripePriceId) => {
|
|
80
|
+
setUpgradeError('');
|
|
81
|
+
setUpgradeLoading(stripePriceId);
|
|
82
|
+
try {
|
|
83
|
+
const res = await http.post('/api/billing/checkout', { priceId: stripePriceId });
|
|
84
|
+
const data = res.data;
|
|
85
|
+
if (data?.checkoutUrl) {
|
|
86
|
+
const leave = props.redirectToCheckout ?? openUrl;
|
|
87
|
+
leave(data.checkoutUrl);
|
|
88
|
+
return;
|
|
89
|
+
}
|
|
90
|
+
if (data?.updated) {
|
|
91
|
+
setShowUpgrade(false);
|
|
92
|
+
return;
|
|
93
|
+
}
|
|
94
|
+
setUpgradeError(t('settings.billing.checkoutFailed', undefined, {
|
|
95
|
+
defaultValue: 'Could not start checkout.',
|
|
96
|
+
}));
|
|
97
|
+
}
|
|
98
|
+
catch (err) {
|
|
99
|
+
setUpgradeError(serverErrorMessage(err) ??
|
|
100
|
+
t('settings.billing.checkoutFailed', undefined, {
|
|
101
|
+
defaultValue: 'Could not start checkout.',
|
|
102
|
+
}));
|
|
103
|
+
}
|
|
104
|
+
finally {
|
|
105
|
+
setUpgradeLoading(null);
|
|
106
|
+
}
|
|
107
|
+
};
|
|
108
|
+
const handleCancelSubscription = async () => {
|
|
109
|
+
setUpgradeError('');
|
|
110
|
+
try {
|
|
111
|
+
await http.post('/api/billing/cancel', {});
|
|
112
|
+
setPlan('Free');
|
|
113
|
+
setPlanKey('free');
|
|
114
|
+
}
|
|
115
|
+
catch (err) {
|
|
116
|
+
setUpgradeError(serverErrorMessage(err) ??
|
|
117
|
+
t('settings.billing.cancelFailed', undefined, {
|
|
118
|
+
defaultValue: 'Could not cancel.',
|
|
119
|
+
}));
|
|
120
|
+
}
|
|
121
|
+
};
|
|
122
|
+
return (<>
|
|
123
|
+
<section>
|
|
124
|
+
<h3 class={cm.cn(cm.sectionHeading, cm.sp('mb', 3))}>
|
|
125
|
+
{t('settings.billing', undefined, { defaultValue: 'Billing' })}
|
|
126
|
+
</h3>
|
|
127
|
+
<Flex align="center" justify="between">
|
|
128
|
+
<span class={cm.textSize('sm')}>
|
|
129
|
+
{t('settings.plan', undefined, { defaultValue: 'Plan: ' })}
|
|
130
|
+
<strong>{plan()}</strong>
|
|
131
|
+
</span>
|
|
132
|
+
<Show when={planKey() === 'free'} fallback={<ConfirmButton variant="outline" size="sm" label={t('settings.billing.cancel', undefined, { defaultValue: 'Cancel' })} confirmLabel={t('settings.billing.cancelConfirm', undefined, {
|
|
133
|
+
defaultValue: 'Cancel your subscription?',
|
|
134
|
+
})} onConfirm={() => handleCancelSubscription()} {...molIdProps('billing-cancel-subscription')}/>}>
|
|
135
|
+
<Button variant="outline" size="sm" onClick={() => setShowUpgrade(true)}>
|
|
136
|
+
{t('settings.upgrade', undefined, { defaultValue: 'Upgrade' })}
|
|
137
|
+
</Button>
|
|
138
|
+
</Show>
|
|
139
|
+
</Flex>
|
|
140
|
+
</section>
|
|
141
|
+
|
|
142
|
+
<Modal open={showUpgrade()} onClose={() => setShowUpgrade(false)} title={t('settings.billing.upgradeTitle', undefined, {
|
|
143
|
+
defaultValue: 'Upgrade your plan',
|
|
144
|
+
})}>
|
|
145
|
+
<Show when={upgradeError()}>
|
|
146
|
+
<Alert status="error" className={cm.sp('mb', 4)}>
|
|
147
|
+
{upgradeError()}
|
|
148
|
+
</Alert>
|
|
149
|
+
</Show>
|
|
150
|
+
<Show when={tiers().length > 0} fallback={<p class={cm.cn(cm.textSize('sm'), cm.textMuted)}>
|
|
151
|
+
{t('settings.billing.noTiers', undefined, {
|
|
152
|
+
defaultValue: 'No paid plans configured.',
|
|
153
|
+
})}
|
|
154
|
+
</p>}>
|
|
155
|
+
<ul class={cm.stack(3)}>
|
|
156
|
+
<For each={priceRows()}>
|
|
157
|
+
{({ tier, price }) => (<li class={cm.sp('p', 4)}>
|
|
158
|
+
<Flex align="center" justify="between">
|
|
159
|
+
<div>
|
|
160
|
+
<p class={cm.fontWeight('semibold')}>
|
|
161
|
+
{tier.name} ({price.interval})
|
|
162
|
+
</p>
|
|
163
|
+
<p class={cm.cn(cm.textSize('xs'), cm.textMuted)}>{price.priceLabel}</p>
|
|
164
|
+
</div>
|
|
165
|
+
<Button size="sm" loading={upgradeLoading() === price.stripePriceId} onClick={() => {
|
|
166
|
+
if (price.stripePriceId)
|
|
167
|
+
void handleStartCheckout(price.stripePriceId);
|
|
168
|
+
}}>
|
|
169
|
+
{t('settings.billing.subscribe', undefined, {
|
|
170
|
+
defaultValue: 'Subscribe',
|
|
171
|
+
})}
|
|
172
|
+
</Button>
|
|
173
|
+
</Flex>
|
|
174
|
+
</li>)}
|
|
175
|
+
</For>
|
|
176
|
+
</ul>
|
|
177
|
+
</Show>
|
|
178
|
+
</Modal>
|
|
179
|
+
</>);
|
|
180
|
+
}
|
|
181
|
+
//# sourceMappingURL=TiersUpgradeSection.jsx.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TiersUpgradeSection.jsx","sourceRoot":"","sources":["../src/TiersUpgradeSection.tsx"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,YAAY,EAAE,GAAG,EAAY,SAAS,EAAE,IAAI,EAAE,MAAM,UAAU,CAAA;AAEvE,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAA;AACvD,OAAO,EAAE,aAAa,EA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AA,EAAE,GAAG,CACL;oBAAA,CAAC,MAAM,CACL,IAAI,CAAC,IAAI,CACT,OAAO,CAAC,CAAC,cAAc,EAAE,KAAK,KAAK,CAAC,aAAa,CAAC,CAClD,OAAO,CAAC,CAAC,GAAG,EAAE;gBACZ,IAAI,KAAK,CAAC,aAAa;oBAAE,KAAK,mBAAmB,CAAC,KAAK,CAAC,aAAa,CAAC,CAAA;YACxE,CAAC,CAAC,CAEF;sBAAA,CAAC,CAAC,CAAC,4BAA4B,EAAE,SAAS,EAAE;gBAC1C,YAAY,EAAE,WAAW;aAC1B,CAAC,CACJ;oBAAA,EAAE,MAAM,CACV;kBAAA,EAAE,IAAI,CACR;gBAAA,EAAE,EAAE,CAAC,CACN,CACH;YAAA,EAAE,GAAG,CACP;UAAA,EAAE,EAAE,CACN;QAAA,EAAE,IAAI,CACR;MAAA,EAAE,KAAK,CACT;IAAA,GAAG,CACJ,CAAA;AACH,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The settings container's context, under React's export names.
|
|
3
|
+
*
|
|
4
|
+
* @module
|
|
5
|
+
*/
|
|
6
|
+
import type { SettingsPanelContextValue } from './types.js';
|
|
7
|
+
/** Solid context object for the settings panel; consume via `useSettingsPanelContext`. */
|
|
8
|
+
export declare const SettingsPanelContext: import("solid-js").Context<SettingsPanelContextValue | null>;
|
|
9
|
+
/**
|
|
10
|
+
* Reads the `onClose` handler exposed by the parent `<SettingsContainer>`.
|
|
11
|
+
* Throws if used outside the container so component misuse is loud.
|
|
12
|
+
*
|
|
13
|
+
* @returns The container's context value.
|
|
14
|
+
* @throws {Error} When rendered outside `<SettingsContainer>`.
|
|
15
|
+
*/
|
|
16
|
+
export declare function useSettingsPanelContext(): SettingsPanelContextValue;
|
|
17
|
+
//# sourceMappingURL=context.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../src/context.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,YAAY,CAAA;AAI3D,0FAA0F;AAC1F,eAAO,MAAM,oBAAoB,8DAAM,CAAA;AAEvC;;;;;;GAMG;AACH,wBAAgB,uBAAuB,IAAI,yBAAyB,CAQnE"}
|
package/dist/context.js
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The settings container's context, under React's export names.
|
|
3
|
+
*
|
|
4
|
+
* @module
|
|
5
|
+
*/
|
|
6
|
+
import { createContext, useContext } from 'solid-js';
|
|
7
|
+
const ctx = createContext(null);
|
|
8
|
+
/** Solid context object for the settings panel; consume via `useSettingsPanelContext`. */
|
|
9
|
+
export const SettingsPanelContext = ctx;
|
|
10
|
+
/**
|
|
11
|
+
* Reads the `onClose` handler exposed by the parent `<SettingsContainer>`.
|
|
12
|
+
* Throws if used outside the container so component misuse is loud.
|
|
13
|
+
*
|
|
14
|
+
* @returns The container's context value.
|
|
15
|
+
* @throws {Error} When rendered outside `<SettingsContainer>`.
|
|
16
|
+
*/
|
|
17
|
+
export function useSettingsPanelContext() {
|
|
18
|
+
const value = useContext(ctx);
|
|
19
|
+
if (!value) {
|
|
20
|
+
throw new Error('Settings panel section components must be rendered inside <SettingsContainer>.');
|
|
21
|
+
}
|
|
22
|
+
return value;
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=context.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"context.js","sourceRoot":"","sources":["../src/context.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,UAAU,CAAA;AAIpD,MAAM,GAAG,GAAG,aAAa,CAAmC,IAAI,CAAC,CAAA;AAEjE,0FAA0F;AAC1F,MAAM,CAAC,MAAM,oBAAoB,GAAG,GAAG,CAAA;AAEvC;;;;;;GAMG;AACH,MAAM,UAAU,uBAAuB;IACrC,MAAM,KAAK,GAAG,UAAU,CAAC,GAAG,CAAC,CAAA;IAC7B,IAAI,CAAC,KAAK,EAAE,CAAC;QACX,MAAM,IAAI,KAAK,CACb,gFAAgF,CACjF,CAAA;IACH,CAAC;IACD,OAAO,KAAK,CAAA;AACd,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `@molecule/app-settings-panel-solid` — the Solid counterpart of
|
|
3
|
+
* `@molecule/app-settings-panel-react`: the same composable, batteries-included
|
|
4
|
+
* settings panel, with the same props, DOM, callbacks, service calls and i18n
|
|
5
|
+
* keys, rendered with Solid.
|
|
6
|
+
*
|
|
7
|
+
* `<SettingsContainer onClose={…}>` owns the layout and publishes `onClose`
|
|
8
|
+
* via context; each section component is independent and loads its own data
|
|
9
|
+
* through hooks:
|
|
10
|
+
* - `<AccountSection>` — name/email edit (`PATCH /api/users/:id`).
|
|
11
|
+
* - `<AppearanceSection>` — dark-mode toggle (`useTheme()`).
|
|
12
|
+
* - `<AuthSection>` — password change + TOTP two-factor
|
|
13
|
+
* (`POST /api/users/:id/verify-two-factor`).
|
|
14
|
+
* - `<NotificationsSection>` — web-push toggle (see the exported
|
|
15
|
+
* `enablePushOnCurrentDevice` / `disablePushOnCurrentDevice` helpers and
|
|
16
|
+
* their documented device-row contract).
|
|
17
|
+
* - `<BillingSection>` — read-only plan display (`GET /api/billing/status`),
|
|
18
|
+
* or `<TiersUpgradeSection>` — full Stripe upgrade/cancel flow
|
|
19
|
+
* (`/api/billing/tiers|checkout|cancel`). Use one or the other, not both.
|
|
20
|
+
* - `<DevicesSection>` / `<ThisDeviceSection>` — device list + current
|
|
21
|
+
* device (`GET/DELETE /api/devices`).
|
|
22
|
+
* - `<LogOutDeleteSection>` — sign out + delete account
|
|
23
|
+
* (`DELETE /api/users/:id`).
|
|
24
|
+
* Apps compose via JSX children — pick sections, order them, and interleave
|
|
25
|
+
* custom sections.
|
|
26
|
+
*
|
|
27
|
+
* @example
|
|
28
|
+
* ```tsx
|
|
29
|
+
* import {
|
|
30
|
+
* AccountSection,
|
|
31
|
+
* AppearanceSection,
|
|
32
|
+
* AuthSection,
|
|
33
|
+
* BillingSection,
|
|
34
|
+
* DevicesSection,
|
|
35
|
+
* LogOutDeleteSection,
|
|
36
|
+
* NotificationsSection,
|
|
37
|
+
* SettingsContainer,
|
|
38
|
+
* ThisDeviceSection,
|
|
39
|
+
* } from '@molecule/app-settings-panel-solid'
|
|
40
|
+
*
|
|
41
|
+
* function SettingsPanel(props: { onClose: () => void }) {
|
|
42
|
+
* return (
|
|
43
|
+
* <SettingsContainer onClose={props.onClose}>
|
|
44
|
+
* <AccountSection />
|
|
45
|
+
* <AppearanceSection />
|
|
46
|
+
* <AuthSection />
|
|
47
|
+
* <NotificationsSection />
|
|
48
|
+
* <BillingSection />
|
|
49
|
+
* <DevicesSection />
|
|
50
|
+
* <ThisDeviceSection />
|
|
51
|
+
* <LogOutDeleteSection />
|
|
52
|
+
* </SettingsContainer>
|
|
53
|
+
* )
|
|
54
|
+
* }
|
|
55
|
+
* ```
|
|
56
|
+
*
|
|
57
|
+
* @remarks
|
|
58
|
+
* - Wiring prereqs: sections need the standard `@molecule/app-solid` provider
|
|
59
|
+
* stack — `MoleculeProvider` with `i18n`, `http` (authenticated client),
|
|
60
|
+
* `auth`, `theme` (AppearanceSection), and the bonded device + push
|
|
61
|
+
* providers (NotificationsSection/ThisDeviceSection) — plus a bonded
|
|
62
|
+
* ClassMap. `<BillingSection>` and `<LogOutDeleteSection>` also navigate
|
|
63
|
+
* through the binding's router (`useRouter()`).
|
|
64
|
+
* - Section components throw if rendered outside `<SettingsContainer>`
|
|
65
|
+
* (they read its context for `onClose`).
|
|
66
|
+
* - Server contract: the molecule API surface from
|
|
67
|
+
* `@molecule/api-resource-user`, `@molecule/api-resource-device`,
|
|
68
|
+
* `@molecule/api-two-factor`, and the billing endpoints
|
|
69
|
+
* (`/api/billing/*`) wired by the payments stack. Missing read endpoints
|
|
70
|
+
* degrade gracefully (sections render empty); the mutating actions do not.
|
|
71
|
+
* - Translations: `@molecule/app-locales-settings-panel` companion bond.
|
|
72
|
+
*
|
|
73
|
+
* @module
|
|
74
|
+
*/
|
|
75
|
+
export * from './AccountSection.jsx';
|
|
76
|
+
export * from './AppearanceSection.jsx';
|
|
77
|
+
export * from './AuthSection.jsx';
|
|
78
|
+
export * from './BillingSection.jsx';
|
|
79
|
+
export * from './context.js';
|
|
80
|
+
export * from './DevicesSection.jsx';
|
|
81
|
+
export * from './LogOutDeleteSection.jsx';
|
|
82
|
+
export * from './NotificationsSection.jsx';
|
|
83
|
+
export * from './pushToggle.js';
|
|
84
|
+
export * from './SettingsContainer.jsx';
|
|
85
|
+
export * from './ThisDeviceSection.jsx';
|
|
86
|
+
export * from './TiersUpgradeSection.jsx';
|
|
87
|
+
export * from './types.js';
|
|
88
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyEG;AAEH,cAAc,sBAAsB,CAAA;AACpC,cAAc,yBAAyB,CAAA;AACvC,cAAc,mBAAmB,CAAA;AACjC,cAAc,sBAAsB,CAAA;AACpC,cAAc,cAAc,CAAA;AAC5B,cAAc,sBAAsB,CAAA;AACpC,cAAc,2BAA2B,CAAA;AACzC,cAAc,4BAA4B,CAAA;AAC1C,cAAc,iBAAiB,CAAA;AAC/B,cAAc,yBAAyB,CAAA;AACvC,cAAc,yBAAyB,CAAA;AACvC,cAAc,2BAA2B,CAAA;AACzC,cAAc,YAAY,CAAA"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `@molecule/app-settings-panel-solid` — the Solid counterpart of
|
|
3
|
+
* `@molecule/app-settings-panel-react`: the same composable, batteries-included
|
|
4
|
+
* settings panel, with the same props, DOM, callbacks, service calls and i18n
|
|
5
|
+
* keys, rendered with Solid.
|
|
6
|
+
*
|
|
7
|
+
* `<SettingsContainer onClose={…}>` owns the layout and publishes `onClose`
|
|
8
|
+
* via context; each section component is independent and loads its own data
|
|
9
|
+
* through hooks:
|
|
10
|
+
* - `<AccountSection>` — name/email edit (`PATCH /api/users/:id`).
|
|
11
|
+
* - `<AppearanceSection>` — dark-mode toggle (`useTheme()`).
|
|
12
|
+
* - `<AuthSection>` — password change + TOTP two-factor
|
|
13
|
+
* (`POST /api/users/:id/verify-two-factor`).
|
|
14
|
+
* - `<NotificationsSection>` — web-push toggle (see the exported
|
|
15
|
+
* `enablePushOnCurrentDevice` / `disablePushOnCurrentDevice` helpers and
|
|
16
|
+
* their documented device-row contract).
|
|
17
|
+
* - `<BillingSection>` — read-only plan display (`GET /api/billing/status`),
|
|
18
|
+
* or `<TiersUpgradeSection>` — full Stripe upgrade/cancel flow
|
|
19
|
+
* (`/api/billing/tiers|checkout|cancel`). Use one or the other, not both.
|
|
20
|
+
* - `<DevicesSection>` / `<ThisDeviceSection>` — device list + current
|
|
21
|
+
* device (`GET/DELETE /api/devices`).
|
|
22
|
+
* - `<LogOutDeleteSection>` — sign out + delete account
|
|
23
|
+
* (`DELETE /api/users/:id`).
|
|
24
|
+
* Apps compose via JSX children — pick sections, order them, and interleave
|
|
25
|
+
* custom sections.
|
|
26
|
+
*
|
|
27
|
+
* @example
|
|
28
|
+
* ```tsx
|
|
29
|
+
* import {
|
|
30
|
+
* AccountSection,
|
|
31
|
+
* AppearanceSection,
|
|
32
|
+
* AuthSection,
|
|
33
|
+
* BillingSection,
|
|
34
|
+
* DevicesSection,
|
|
35
|
+
* LogOutDeleteSection,
|
|
36
|
+
* NotificationsSection,
|
|
37
|
+
* SettingsContainer,
|
|
38
|
+
* ThisDeviceSection,
|
|
39
|
+
* } from '@molecule/app-settings-panel-solid'
|
|
40
|
+
*
|
|
41
|
+
* function SettingsPanel(props: { onClose: () => void }) {
|
|
42
|
+
* return (
|
|
43
|
+
* <SettingsContainer onClose={props.onClose}>
|
|
44
|
+
* <AccountSection />
|
|
45
|
+
* <AppearanceSection />
|
|
46
|
+
* <AuthSection />
|
|
47
|
+
* <NotificationsSection />
|
|
48
|
+
* <BillingSection />
|
|
49
|
+
* <DevicesSection />
|
|
50
|
+
* <ThisDeviceSection />
|
|
51
|
+
* <LogOutDeleteSection />
|
|
52
|
+
* </SettingsContainer>
|
|
53
|
+
* )
|
|
54
|
+
* }
|
|
55
|
+
* ```
|
|
56
|
+
*
|
|
57
|
+
* @remarks
|
|
58
|
+
* - Wiring prereqs: sections need the standard `@molecule/app-solid` provider
|
|
59
|
+
* stack — `MoleculeProvider` with `i18n`, `http` (authenticated client),
|
|
60
|
+
* `auth`, `theme` (AppearanceSection), and the bonded device + push
|
|
61
|
+
* providers (NotificationsSection/ThisDeviceSection) — plus a bonded
|
|
62
|
+
* ClassMap. `<BillingSection>` and `<LogOutDeleteSection>` also navigate
|
|
63
|
+
* through the binding's router (`useRouter()`).
|
|
64
|
+
* - Section components throw if rendered outside `<SettingsContainer>`
|
|
65
|
+
* (they read its context for `onClose`).
|
|
66
|
+
* - Server contract: the molecule API surface from
|
|
67
|
+
* `@molecule/api-resource-user`, `@molecule/api-resource-device`,
|
|
68
|
+
* `@molecule/api-two-factor`, and the billing endpoints
|
|
69
|
+
* (`/api/billing/*`) wired by the payments stack. Missing read endpoints
|
|
70
|
+
* degrade gracefully (sections render empty); the mutating actions do not.
|
|
71
|
+
* - Translations: `@molecule/app-locales-settings-panel` companion bond.
|
|
72
|
+
*
|
|
73
|
+
* @module
|
|
74
|
+
*/
|
|
75
|
+
export * from './AccountSection.jsx';
|
|
76
|
+
export * from './AppearanceSection.jsx';
|
|
77
|
+
export * from './AuthSection.jsx';
|
|
78
|
+
export * from './BillingSection.jsx';
|
|
79
|
+
export * from './context.js';
|
|
80
|
+
export * from './DevicesSection.jsx';
|
|
81
|
+
export * from './LogOutDeleteSection.jsx';
|
|
82
|
+
export * from './NotificationsSection.jsx';
|
|
83
|
+
export * from './pushToggle.js';
|
|
84
|
+
export * from './SettingsContainer.jsx';
|
|
85
|
+
export * from './ThisDeviceSection.jsx';
|
|
86
|
+
export * from './TiersUpgradeSection.jsx';
|
|
87
|
+
export * from './types.js';
|
|
88
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyEG;AAEH,cAAc,sBAAsB,CAAA;AACpC,cAAc,yBAAyB,CAAA;AACvC,cAAc,mBAAmB,CAAA;AACjC,cAAc,sBAAsB,CAAA;AACpC,cAAc,cAAc,CAAA;AAC5B,cAAc,sBAAsB,CAAA;AACpC,cAAc,2BAA2B,CAAA;AACzC,cAAc,4BAA4B,CAAA;AAC1C,cAAc,iBAAiB,CAAA;AAC/B,cAAc,yBAAyB,CAAA;AACvC,cAAc,yBAAyB,CAAA;AACvC,cAAc,2BAA2B,CAAA;AACzC,cAAc,YAAY,CAAA"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The current-device push toggle behind {@link NotificationsSection}: the
|
|
3
|
+
* full enable/disable chain — permission → runtime VAPID key fetch →
|
|
4
|
+
* subscribe → persist on the device row. It lives in `@molecule/app-push`
|
|
5
|
+
* (`device-toggle.ts`, with the server contract) so every framework's
|
|
6
|
+
* settings panel runs the same functions; this package re-exports them.
|
|
7
|
+
*
|
|
8
|
+
* @module
|
|
9
|
+
*/
|
|
10
|
+
export type { PushToggleDevice, PushToggleFailureReason, PushToggleHttp, PushToggleResult, PushToggleToken, } from '@molecule/app-push';
|
|
11
|
+
export { disablePushOnCurrentDevice, enablePushOnCurrentDevice, findCurrentDevice, readCurrentDevicePushEnabled, subscriptionFromToken, } from '@molecule/app-push';
|
|
12
|
+
//# sourceMappingURL=pushToggle.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pushToggle.d.ts","sourceRoot":"","sources":["../src/pushToggle.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,YAAY,EACV,gBAAgB,EAChB,uBAAuB,EACvB,cAAc,EACd,gBAAgB,EAChB,eAAe,GAChB,MAAM,oBAAoB,CAAA;AAC3B,OAAO,EACL,0BAA0B,EAC1B,yBAAyB,EACzB,iBAAiB,EACjB,4BAA4B,EAC5B,qBAAqB,GACtB,MAAM,oBAAoB,CAAA"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The current-device push toggle behind {@link NotificationsSection}: the
|
|
3
|
+
* full enable/disable chain — permission → runtime VAPID key fetch →
|
|
4
|
+
* subscribe → persist on the device row. It lives in `@molecule/app-push`
|
|
5
|
+
* (`device-toggle.ts`, with the server contract) so every framework's
|
|
6
|
+
* settings panel runs the same functions; this package re-exports them.
|
|
7
|
+
*
|
|
8
|
+
* @module
|
|
9
|
+
*/
|
|
10
|
+
export { disablePushOnCurrentDevice, enablePushOnCurrentDevice, findCurrentDevice, readCurrentDevicePushEnabled, subscriptionFromToken, } from '@molecule/app-push';
|
|
11
|
+
//# sourceMappingURL=pushToggle.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pushToggle.js","sourceRoot":"","sources":["../src/pushToggle.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AASH,OAAO,EACL,0BAA0B,EAC1B,yBAAyB,EACzB,iBAAiB,EACjB,4BAA4B,EAC5B,qBAAqB,GACtB,MAAM,oBAAoB,CAAA"}
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared types of `@molecule/app-settings-panel-solid`.
|
|
3
|
+
*
|
|
4
|
+
* @module
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Context published by `<SettingsContainer>` to its children.
|
|
8
|
+
*
|
|
9
|
+
* The container owns the dismiss-the-panel handler; sub-components
|
|
10
|
+
* that need to close after an action (logout, delete account, email
|
|
11
|
+
* error) read it from context rather than threading the prop down.
|
|
12
|
+
*/
|
|
13
|
+
export interface SettingsPanelContextValue {
|
|
14
|
+
/** Dismisses the settings panel (the container's `onClose` prop). */
|
|
15
|
+
onClose: () => void;
|
|
16
|
+
}
|
|
17
|
+
/** A user's registered device (subset rendered in the settings list). */
|
|
18
|
+
export interface Device {
|
|
19
|
+
/** The device's id on the wire (`DELETE /api/devices/:id`). */
|
|
20
|
+
id: string;
|
|
21
|
+
/** The device's display name; may be empty (the platform is shown then). */
|
|
22
|
+
name: string;
|
|
23
|
+
/** The device's platform (`ios`, `linux`, …). */
|
|
24
|
+
platform: string;
|
|
25
|
+
/** When the device was last seen, as the API renders it. */
|
|
26
|
+
lastSeen?: string;
|
|
27
|
+
/** `true` for the device making the current request (the API marks it). */
|
|
28
|
+
isCurrent?: boolean;
|
|
29
|
+
}
|
|
30
|
+
/** Props for {@link TiersUpgradeSection}. */
|
|
31
|
+
export interface TiersUpgradeSectionProps {
|
|
32
|
+
/**
|
|
33
|
+
* How the page leaves for the checkout URL the server returns. Defaults to a
|
|
34
|
+
* full-page navigation (`openUrl` from `@molecule/app-utilities`).
|
|
35
|
+
*/
|
|
36
|
+
redirectToCheckout?: (checkoutUrl: string) => void;
|
|
37
|
+
}
|
|
38
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;;;;;GAMG;AACH,MAAM,WAAW,yBAAyB;IACxC,qEAAqE;IACrE,OAAO,EAAE,MAAM,IAAI,CAAA;CACpB;AAED,yEAAyE;AACzE,MAAM,WAAW,MAAM;IACrB,+DAA+D;IAC/D,EAAE,EAAE,MAAM,CAAA;IACV,4EAA4E;IAC5E,IAAI,EAAE,MAAM,CAAA;IACZ,iDAAiD;IACjD,QAAQ,EAAE,MAAM,CAAA;IAChB,4DAA4D;IAC5D,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,2EAA2E;IAC3E,SAAS,CAAC,EAAE,OAAO,CAAA;CACpB;AAED,6CAA6C;AAC7C,MAAM,WAAW,wBAAwB;IACvC;;;OAGG;IACH,kBAAkB,CAAC,EAAE,CAAC,WAAW,EAAE,MAAM,KAAK,IAAI,CAAA;CACnD"}
|
package/dist/types.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;GAIG"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,73 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@molecule/app-settings-panel-solid",
|
|
3
|
-
"version": "
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "1.1.0",
|
|
4
|
+
"description": "Composable settings panel — a SettingsContainer + family of section sub-components (Account, Auth, Notifications, Billing, Devices, ThisDevice, LogOutDelete). Apps compose via JSX children, picking which sections to include and what order.",
|
|
5
|
+
"homepage": "https://www.molecule.dev/packages/app-settings-panel-solid",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"main": "dist/index.js",
|
|
8
|
+
"types": "dist/index.d.ts",
|
|
9
|
+
"exports": {
|
|
10
|
+
".": {
|
|
11
|
+
"types": "./dist/index.d.ts",
|
|
12
|
+
"import": "./dist/index.js"
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
"files": [
|
|
16
|
+
"dist",
|
|
17
|
+
"README.md"
|
|
18
|
+
],
|
|
19
|
+
"scripts": {
|
|
20
|
+
"build": "tsc",
|
|
21
|
+
"dev": "tsc --watch",
|
|
22
|
+
"test": "vitest run",
|
|
23
|
+
"test:watch": "vitest"
|
|
24
|
+
},
|
|
25
|
+
"keywords": [
|
|
26
|
+
"molecule",
|
|
27
|
+
"settings",
|
|
28
|
+
"panel",
|
|
29
|
+
"solid"
|
|
30
|
+
],
|
|
31
|
+
"author": "Molecule Dev, Inc. (https://molecule.dev)",
|
|
32
|
+
"license": "Apache-2.0",
|
|
33
|
+
"repository": {
|
|
34
|
+
"type": "git",
|
|
35
|
+
"url": "https://github.com/molecule-dev/molecule.git",
|
|
36
|
+
"directory": "packages/app/features/settings-panel-solid"
|
|
37
|
+
},
|
|
38
|
+
"engines": {
|
|
39
|
+
"node": ">=20"
|
|
40
|
+
},
|
|
41
|
+
"bugs": "https://github.com/molecule-dev/molecule/issues",
|
|
42
|
+
"publishConfig": {
|
|
43
|
+
"access": "public"
|
|
44
|
+
},
|
|
45
|
+
"peerDependencies": {
|
|
46
|
+
"@molecule/app-auth": "^3.0.0",
|
|
47
|
+
"@molecule/app-http": "^1.8.0",
|
|
48
|
+
"@molecule/app-push": "^1.1.0",
|
|
49
|
+
"@molecule/app-solid": "^3.5.0",
|
|
50
|
+
"@molecule/app-ui": "^1.0.1",
|
|
51
|
+
"@molecule/app-ui-solid": "^1.1.0",
|
|
52
|
+
"@molecule/app-utilities": "^1.0.6",
|
|
53
|
+
"solid-js": "^1.8.0"
|
|
54
|
+
},
|
|
55
|
+
"devDependencies": {
|
|
56
|
+
"@molecule/app-auth": "3.4.2",
|
|
57
|
+
"@molecule/app-framework-conformance": "0.0.0",
|
|
58
|
+
"@molecule/app-http": "1.8.0",
|
|
59
|
+
"@molecule/app-i18n": "1.2.1",
|
|
60
|
+
"@molecule/app-icons": "1.0.4",
|
|
61
|
+
"@molecule/app-push": "1.1.0",
|
|
62
|
+
"@molecule/app-solid": "3.6.0",
|
|
63
|
+
"@molecule/app-ui": "1.3.11",
|
|
64
|
+
"@molecule/app-ui-solid": "1.1.2",
|
|
65
|
+
"@molecule/app-utilities": "1.0.6",
|
|
66
|
+
"@types/node": "26.6.5",
|
|
67
|
+
"jsdom": "30.1.3",
|
|
68
|
+
"solid-js": "1.9.17",
|
|
69
|
+
"typescript": "6.0.3",
|
|
70
|
+
"vite-plugin-solid": "2.11.15",
|
|
71
|
+
"vitest": "4.1.12"
|
|
72
|
+
}
|
|
73
|
+
}
|