@molecule/app-settings-panel-vue 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 +781 -2
  3. package/dist/AccountSection.d.ts +23 -0
  4. package/dist/AccountSection.d.ts.map +1 -0
  5. package/dist/AccountSection.js +139 -0
  6. package/dist/AccountSection.js.map +1 -0
  7. package/dist/AppearanceSection.d.ts +20 -0
  8. package/dist/AppearanceSection.d.ts.map +1 -0
  9. package/dist/AppearanceSection.js +47 -0
  10. package/dist/AppearanceSection.js.map +1 -0
  11. package/dist/AuthSection.d.ts +30 -0
  12. package/dist/AuthSection.d.ts.map +1 -0
  13. package/dist/AuthSection.js +320 -0
  14. package/dist/AuthSection.js.map +1 -0
  15. package/dist/BillingSection.d.ts +51 -0
  16. package/dist/BillingSection.d.ts.map +1 -0
  17. package/dist/BillingSection.js +84 -0
  18. package/dist/BillingSection.js.map +1 -0
  19. package/dist/DevicesSection.d.ts +52 -0
  20. package/dist/DevicesSection.d.ts.map +1 -0
  21. package/dist/DevicesSection.js +171 -0
  22. package/dist/DevicesSection.js.map +1 -0
  23. package/dist/LogOutDeleteSection.d.ts +22 -0
  24. package/dist/LogOutDeleteSection.d.ts.map +1 -0
  25. package/dist/LogOutDeleteSection.js +129 -0
  26. package/dist/LogOutDeleteSection.js.map +1 -0
  27. package/dist/NotificationsSection.d.ts +27 -0
  28. package/dist/NotificationsSection.d.ts.map +1 -0
  29. package/dist/NotificationsSection.js +148 -0
  30. package/dist/NotificationsSection.js.map +1 -0
  31. package/dist/SettingsContainer.d.ts +39 -0
  32. package/dist/SettingsContainer.d.ts.map +1 -0
  33. package/dist/SettingsContainer.js +48 -0
  34. package/dist/SettingsContainer.js.map +1 -0
  35. package/dist/ThisDeviceSection.d.ts +21 -0
  36. package/dist/ThisDeviceSection.d.ts.map +1 -0
  37. package/dist/ThisDeviceSection.js +57 -0
  38. package/dist/ThisDeviceSection.js.map +1 -0
  39. package/dist/TiersUpgradeSection.d.ts +56 -0
  40. package/dist/TiersUpgradeSection.d.ts.map +1 -0
  41. package/dist/TiersUpgradeSection.js +218 -0
  42. package/dist/TiersUpgradeSection.js.map +1 -0
  43. package/dist/context.d.ts +25 -0
  44. package/dist/context.d.ts.map +1 -0
  45. package/dist/context.js +20 -0
  46. package/dist/context.js.map +1 -0
  47. package/dist/index.d.ts +95 -0
  48. package/dist/index.d.ts.map +1 -0
  49. package/dist/index.js +95 -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 +27 -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 +72 -4
package/README.md CHANGED
@@ -1,3 +1,782 @@
1
- # Temporary Holding Version
1
+ <!--
2
+ AUTO-GENERATED — DO NOT EDIT THIS FILE.
3
+ Generated by `mlcl sync-docs` from the package's src/index.ts JSDoc + mlcl/registry.json.
4
+ Edits here are overwritten on the next commit (molecule's pre-commit hook regenerates).
5
+ To change this document, edit the module-level JSDoc in src/index.ts.
6
+ Generated: 2026-11-14T15:07:16.914Z
7
+ -->
2
8
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
9
+ # @molecule/app-settings-panel-vue
10
+
11
+ `@molecule/app-settings-panel-vue` — the Vue counterpart of
12
+ `@molecule/app-settings-panel-react`: a composable, batteries-included
13
+ settings panel with the same props (React names), the same DOM for the
14
+ same input, and the same callbacks and service calls.
15
+
16
+ `<SettingsContainer onClose={…}>` owns the layout and publishes `onClose`
17
+ via Vue injection; each section component is independent and loads its own
18
+ data through `@molecule/app-vue` composables:
19
+
20
+ - `<AccountSection>` — name/email edit (`PATCH /api/users/:id`).
21
+ - `<AppearanceSection>` — dark-mode toggle (`useTheme()`).
22
+ - `<AuthSection>` — password change + TOTP two-factor
23
+ (`POST /api/users/:id/verify-two-factor`).
24
+ - `<NotificationsSection>` — web-push toggle (see the exported
25
+ `enablePushOnCurrentDevice` / `disablePushOnCurrentDevice` helpers and
26
+ their documented device-row contract).
27
+ - `<BillingSection>` — read-only plan display (`GET /api/billing/status`),
28
+ or `<TiersUpgradeSection>` — full Stripe upgrade/cancel flow
29
+ (`/api/billing/tiers|checkout|cancel`). Use one or the other, not both.
30
+ - `<DevicesSection>` / `<ThisDeviceSection>` — device list + current
31
+ device (`GET/DELETE /api/devices`).
32
+ - `<LogOutDeleteSection>` — sign out + delete account
33
+ (`DELETE /api/users/:id`).
34
+
35
+ > **Auto-generated, AI-first package reference** for the [molecule.dev](https://molecule.dev) ecosystem.
36
+ > It is written to be read by coding agents as much as by people, and is generated from this
37
+ > package's source — edit `src/index.ts` JSDoc, not this file.
38
+
39
+ ## Quick Start
40
+
41
+ ```ts
42
+ import { createApp, defineComponent, h } from 'vue'
43
+ import {
44
+ AccountSection,
45
+ AppearanceSection,
46
+ AuthSection,
47
+ BillingSection,
48
+ DevicesSection,
49
+ LogOutDeleteSection,
50
+ NotificationsSection,
51
+ SettingsContainer,
52
+ ThisDeviceSection,
53
+ TiersUpgradeSection,
54
+ } from '@molecule/app-settings-panel-vue'
55
+
56
+ const SettingsPanel = defineComponent({
57
+ props: { onClose: { type: Function, required: true } },
58
+ setup(props) {
59
+ return () =>
60
+ h(
61
+ SettingsContainer,
62
+ { onClose: props.onClose },
63
+ {
64
+ default: () => [
65
+ h(AccountSection),
66
+ h(AppearanceSection),
67
+ h(AuthSection),
68
+ h(NotificationsSection),
69
+ h(BillingSection),
70
+ h(DevicesSection),
71
+ h(ThisDeviceSection),
72
+ h(LogOutDeleteSection),
73
+ ],
74
+ },
75
+ )
76
+ },
77
+ })
78
+
79
+ createApp(SettingsPanel).mount('#app')
80
+ ```
81
+
82
+ ## Type
83
+
84
+ `feature`
85
+
86
+ ## Installation
87
+
88
+ ```bash
89
+ npm install @molecule/app-settings-panel-vue @molecule/app-auth @molecule/app-http @molecule/app-push @molecule/app-ui @molecule/app-ui-vue @molecule/app-utilities @molecule/app-vue vue
90
+ ```
91
+
92
+ ## API
93
+
94
+ ### Interfaces
95
+
96
+ #### `SettingsPanelContextValue`
97
+
98
+ Context published by `<SettingsContainer>` to its children.
99
+
100
+ The container owns the dismiss-the-panel handler; sub-components
101
+ that need to close after an action (logout, delete account, email
102
+ error) read it from context rather than threading the prop down.
103
+
104
+ ```typescript
105
+ interface SettingsPanelContextValue {
106
+ /** Dismisses the settings panel; `<SettingsContainer>` receives it as a prop. */
107
+ onClose: () => void
108
+ }
109
+ ```
110
+
111
+ #### `Device`
112
+
113
+ A user's registered device (subset rendered in the settings list).
114
+
115
+ ```typescript
116
+ interface Device {
117
+ /** The device row's id (names the revoke request URL). */
118
+ id: string
119
+ /** The device's display name (a blank name falls back to the platform). */
120
+ name: string
121
+ /** The device's platform label. */
122
+ platform: string
123
+ /** When the device was last seen, as the API renders it. */
124
+ lastSeen?: string
125
+ /** `true` for the device making the current request (the API marks it). */
126
+ isCurrent?: boolean
127
+ }
128
+ ```
129
+
130
+ #### `TiersUpgradeSectionProps`
131
+
132
+ Props for the {@link TiersUpgradeSection} component.
133
+
134
+ ```typescript
135
+ interface TiersUpgradeSectionProps {
136
+ /**
137
+ * How the page leaves for the checkout URL the server returns. Defaults to a
138
+ * full-page navigation (`openUrl` from `@molecule/app-utilities`).
139
+ */
140
+ redirectToCheckout?: (checkoutUrl: string) => void
141
+ }
142
+ ```
143
+
144
+ #### `PushToggleHttp`
145
+
146
+ Minimal structural slice of `@molecule/app-http`'s HttpClient used here.
147
+
148
+ ```typescript
149
+ interface PushToggleHttp {
150
+ get<T = unknown>(url: string): Promise<{ data: T }>
151
+ patch<T = unknown>(url: string, data?: unknown): Promise<{ data: T }>
152
+ }
153
+ ```
154
+
155
+ #### `PushToggleDevice`
156
+
157
+ Device row slice returned by `GET /api/devices`.
158
+
159
+ ```typescript
160
+ interface PushToggleDevice {
161
+ id: string
162
+ isCurrent?: boolean
163
+ hasPushSubscription?: boolean
164
+ }
165
+ ```
166
+
167
+ #### `PushToggleToken`
168
+
169
+ Push token slice returned by `@molecule/app-push` `register()`.
170
+
171
+ ```typescript
172
+ interface PushToggleToken {
173
+ value: string
174
+ platform: 'web' | 'ios' | 'android'
175
+ }
176
+ ```
177
+
178
+ ### Types
179
+
180
+ #### `PushToggleFailureReason`
181
+
182
+ Why an enable/disable attempt failed (mapped to i18n by the component).
183
+
184
+ ```typescript
185
+ type PushToggleFailureReason =
186
+ 'permission-denied' | 'server-unconfigured' | 'register-failed' | 'persist-failed'
187
+ ```
188
+
189
+ #### `PushToggleResult`
190
+
191
+ Result of an enable/disable attempt.
192
+
193
+ ```typescript
194
+ type PushToggleResult =
195
+ { ok: true } | { ok: false; reason: PushToggleFailureReason; message?: string }
196
+ ```
197
+
198
+ ### Functions
199
+
200
+ #### `useSettingsPanelContext()`
201
+
202
+ Reads the `onClose` handler exposed by the parent `<SettingsContainer>`.
203
+ Throws if used outside the container so component misuse is loud.
204
+
205
+ ```typescript
206
+ function useSettingsPanelContext(): SettingsPanelContextValue
207
+ ```
208
+
209
+ **Returns:** The container's context value.
210
+
211
+ #### `findCurrentDevice(devices)`
212
+
213
+ Picks the caller's own device row: the api flags the session device
214
+ `isCurrent`; fall back to the first row for sessions predating the flag.
215
+
216
+ ```typescript
217
+ function findCurrentDevice(devices: PushToggleDevice[] | undefined): PushToggleDevice | undefined
218
+ ```
219
+
220
+ - `devices` — Rows from `GET /api/devices`.
221
+
222
+ **Returns:** The current device row, or `undefined` when the user has none.
223
+
224
+ #### `subscriptionFromToken(token)`
225
+
226
+ Converts an `@molecule/app-push` token into the device resource's
227
+ `pushSubscription` shape (web PushSubscription JSON, FCM registration for
228
+ Android, APNs registration for iOS).
229
+
230
+ ```typescript
231
+ function subscriptionFromToken(token: PushToggleToken): unknown
232
+ ```
233
+
234
+ - `token` — The push token returned by `register()`.
235
+
236
+ **Returns:** The `pushSubscription` value to PATCH onto the device row.
237
+
238
+ #### `enablePushOnCurrentDevice(deps)`
239
+
240
+ Runs the full enable chain: browser permission → runtime VAPID public key
241
+ (`GET /api/devices/push/public-key`) → `register({ vapidPublicKey })` →
242
+ persist the subscription on the current device row.
243
+
244
+ Every failure is returned as a typed reason (never thrown) so the UI can
245
+ show an honest, specific message instead of hanging or silently reverting.
246
+
247
+ ```typescript
248
+ function enablePushOnCurrentDevice(deps: {
249
+ http: PushToggleHttp
250
+ requestPermission: () => Promise<string>
251
+ register: (options?: { vapidPublicKey?: string }) => Promise<PushToggleToken>
252
+ }): Promise<PushToggleResult>
253
+ ```
254
+
255
+ - `deps` — The http client + push actions from `usePush()`.
256
+ - `deps.http` — Authenticated http client (`useHttpClient()`).
257
+ - `deps.requestPermission` — `usePush().requestPermission`.
258
+ - `deps.register` — `usePush().register`.
259
+
260
+ **Returns:** `{ ok: true }` or a typed failure.
261
+
262
+ #### `disablePushOnCurrentDevice(deps)`
263
+
264
+ Disables push: unsubscribes the browser (best-effort — a dev build without
265
+ a service worker has nothing to unsubscribe) and ALWAYS clears the server
266
+ state so no further pushes target this device.
267
+
268
+ ```typescript
269
+ function disablePushOnCurrentDevice(deps: {
270
+ http: PushToggleHttp
271
+ unregister: () => Promise<void>
272
+ }): Promise<PushToggleResult>
273
+ ```
274
+
275
+ - `deps` — The http client + push action from `usePush()`.
276
+ - `deps.http` — Authenticated http client (`useHttpClient()`).
277
+ - `deps.unregister` — `usePush().unregister`.
278
+
279
+ **Returns:** `{ ok: true }` or a typed failure (server state not cleared).
280
+
281
+ #### `readCurrentDevicePushEnabled(http)`
282
+
283
+ Reads whether push is currently enabled for THIS device (server truth:
284
+ the current device row's `hasPushSubscription`).
285
+
286
+ ```typescript
287
+ function readCurrentDevicePushEnabled(http: PushToggleHttp): Promise<boolean>
288
+ ```
289
+
290
+ - `http` — Authenticated http client (`useHttpClient()`).
291
+
292
+ **Returns:** `true` when the current device has a stored subscription.
293
+
294
+ ### Constants
295
+
296
+ #### `AccountSection`
297
+
298
+ Account fields over the shared profile lifecycle. Background validation uses
299
+ the auth client's configured route, mapping and session ownership guards.
300
+
301
+ `UserProfile.email` is optional (phone/handle accounts have none), so email is
302
+ validated only when non-empty and a blank email is never sent: clearing the
303
+ field leaves the stored address untouched, and a name-only account can still
304
+ save its name.
305
+
306
+ ```typescript
307
+ const AccountSection: DefineComponent<
308
+ {},
309
+ () => VNodeChild,
310
+ {},
311
+ {},
312
+ {},
313
+ ComponentOptionsMixin,
314
+ ComponentOptionsMixin,
315
+ {},
316
+ string,
317
+ PublicProps,
318
+ Readonly<{}> & Readonly<{}>,
319
+ {},
320
+ {},
321
+ {},
322
+ {},
323
+ string,
324
+ ComponentProvideOptions,
325
+ true,
326
+ {},
327
+ any
328
+ >
329
+ ```
330
+
331
+ **Returns:** The account settings section component.
332
+
333
+ #### `AppearanceSection`
334
+
335
+ Appearance section — dark-mode toggle wired to the theme bond.
336
+
337
+ Apps that expose other appearance knobs (font size, density, etc.)
338
+ can either add more sub-components to this package or render their
339
+ own section in line with `<AppearanceSection>` via slots.
340
+
341
+ ```typescript
342
+ const AppearanceSection: DefineComponent<
343
+ {},
344
+ () => VNodeChild,
345
+ {},
346
+ {},
347
+ {},
348
+ ComponentOptionsMixin,
349
+ ComponentOptionsMixin,
350
+ {},
351
+ string,
352
+ PublicProps,
353
+ Readonly<{}> & Readonly<{}>,
354
+ {},
355
+ {},
356
+ {},
357
+ {},
358
+ string,
359
+ ComponentProvideOptions,
360
+ true,
361
+ {},
362
+ any
363
+ >
364
+ ```
365
+
366
+ **Returns:** The appearance section component.
367
+
368
+ #### `AuthSection`
369
+
370
+ Authentication section — change password (modal) + two-factor (TOTP) setup.
371
+
372
+ Two-factor uses the real enrollment flow against the user resource's
373
+ `POST /users/:id/verify-two-factor` endpoint (`@molecule/api-two-factor`):
374
+
375
+ - Enable → `{action:'setup'}` returns a QR code + secret to scan into an
376
+ authenticator app → user enters the 6-digit code → `{action:'enable', token}`.
377
+ - Disable → user enters a current code → `{action:'disable', token}`.
378
+ The current status is read from `/users/me`. (This replaces the previous
379
+ boolean toggle, which PATCHed `twoFactorEnabled` — a field the update
380
+ handler deliberately ignores — so it never actually enrolled 2FA.)
381
+
382
+ Auto-hides for OAuth-only users (`user.oauthServer` truthy) since
383
+ password / 2FA wouldn't apply. If the app's API has no two-factor
384
+ provider bonded, setup fails gracefully with an inline message.
385
+
386
+ ```typescript
387
+ const AuthSection: DefineComponent<
388
+ {},
389
+ () => VNodeChild,
390
+ {},
391
+ {},
392
+ {},
393
+ ComponentOptionsMixin,
394
+ ComponentOptionsMixin,
395
+ {},
396
+ string,
397
+ PublicProps,
398
+ Readonly<{}> & Readonly<{}>,
399
+ {},
400
+ {},
401
+ {},
402
+ {},
403
+ string,
404
+ ComponentProvideOptions,
405
+ true,
406
+ {},
407
+ any
408
+ >
409
+ ```
410
+
411
+ **Returns:** The authentication section component.
412
+
413
+ #### `BillingSection`
414
+
415
+ Billing section — current plan + Upgrade button.
416
+
417
+ Fetches `/api/billing/status` on mount and uses the returned plan
418
+ name as a more accurate label than the parent-supplied default.
419
+ The `plan` prop remains a fallback (e.g. for offline rendering or
420
+ apps that don't expose `/billing/status`).
421
+
422
+ The Upgrade button navigates to `upgradeTo` (default `/settings`).
423
+ Pass `upgradeTo="/billing"` or `upgradeTo="/pricing"` if your app
424
+ routes elsewhere. Apps with a multi-tier checkout flow should use
425
+ `<TiersUpgradeSection>` instead.
426
+
427
+ ```typescript
428
+ const BillingSection: DefineComponent<
429
+ ExtractPropTypes<{
430
+ plan: { type: StringConstructor; default: string }
431
+ upgradeTo: { type: StringConstructor; default: string }
432
+ }>,
433
+ () => VNodeChild,
434
+ {},
435
+ {},
436
+ {},
437
+ ComponentOptionsMixin,
438
+ ComponentOptionsMixin,
439
+ {},
440
+ string,
441
+ PublicProps,
442
+ Readonly<
443
+ ExtractPropTypes<{
444
+ plan: { type: StringConstructor; default: string }
445
+ upgradeTo: { type: StringConstructor; default: string }
446
+ }>
447
+ > &
448
+ Readonly<{}>,
449
+ { plan: string; upgradeTo: string },
450
+ {},
451
+ {},
452
+ {},
453
+ string,
454
+ ComponentProvideOptions,
455
+ true,
456
+ {},
457
+ any
458
+ >
459
+ ```
460
+
461
+ **Returns:** The billing section component.
462
+
463
+ #### `DevicesSection`
464
+
465
+ Devices section — lists the user's registered devices and lets them
466
+ revoke (sign out) any device other than the one they're currently using.
467
+
468
+ Revoking deletes the device row (`DELETE /api/devices/:id`). The API's
469
+ authorization layer enforces server-side revocation: it rejects that
470
+ device's session the next time it makes a request (within the
471
+ device-exists cache TTL), so the removed device is actually signed out —
472
+ not just hidden from the list. The current device is labelled
473
+ "This device" and is not revocable here (use Sign out for the current
474
+ session). Recreates molecule v1's device-revocation behaviour.
475
+
476
+ Apps that want a different trailing element per row can pass a
477
+ `renderRowIcon` callback (which then replaces the built-in revoke
478
+ control); pass `() => null` to suppress it entirely.
479
+
480
+ ```typescript
481
+ const DevicesSection: DefineComponent<
482
+ ExtractPropTypes<{
483
+ renderRowIcon: {
484
+ type: PropType<(device: Device) => VNodeChild>
485
+ required: false
486
+ default: undefined
487
+ }
488
+ }>,
489
+ () => VNodeChild,
490
+ {},
491
+ {},
492
+ {},
493
+ ComponentOptionsMixin,
494
+ ComponentOptionsMixin,
495
+ {},
496
+ string,
497
+ PublicProps,
498
+ Readonly<
499
+ ExtractPropTypes<{
500
+ renderRowIcon: {
501
+ type: PropType<(device: Device) => VNodeChild>
502
+ required: false
503
+ default: undefined
504
+ }
505
+ }>
506
+ > &
507
+ Readonly<{}>,
508
+ { renderRowIcon: (device: Device) => VNodeChild },
509
+ {},
510
+ {},
511
+ {},
512
+ string,
513
+ ComponentProvideOptions,
514
+ true,
515
+ {},
516
+ any
517
+ >
518
+ ```
519
+
520
+ **Returns:** The devices section component.
521
+
522
+ #### `LogOutDeleteSection`
523
+
524
+ Bottom actions section — Log out + Delete account.
525
+
526
+ Owns the delete-account modal internally (the trigger lives in the
527
+ same section so the modal lives here too). Reads `onClose` from
528
+ the `<SettingsContainer>` context to dismiss the panel after either
529
+ action and navigates to `/login`.
530
+
531
+ ```typescript
532
+ const LogOutDeleteSection: DefineComponent<
533
+ {},
534
+ () => VNodeChild,
535
+ {},
536
+ {},
537
+ {},
538
+ ComponentOptionsMixin,
539
+ ComponentOptionsMixin,
540
+ {},
541
+ string,
542
+ PublicProps,
543
+ Readonly<{}> & Readonly<{}>,
544
+ {},
545
+ {},
546
+ {},
547
+ {},
548
+ string,
549
+ ComponentProvideOptions,
550
+ true,
551
+ {},
552
+ any
553
+ >
554
+ ```
555
+
556
+ **Returns:** The log out / delete account section component.
557
+
558
+ #### `NotificationsSection`
559
+
560
+ Push-notification toggle section — the full receive-side enable chain:
561
+ browser permission → runtime VAPID public key
562
+ (`GET /api/devices/push/public-key`) → `pushManager.subscribe` with
563
+ `applicationServerKey` → PATCH the subscription onto the current device
564
+ row (`/api/devices/:id { pushSubscription, hasPushSubscription }`), which
565
+ is where the api-side push fan-outs look for it.
566
+
567
+ Initial state reflects SERVER truth (the current device row's
568
+ `hasPushSubscription`), and every failure surfaces as an honest inline
569
+ message — a dev build without a service worker fails fast instead of
570
+ hanging the switch.
571
+
572
+ ```typescript
573
+ const NotificationsSection: DefineComponent<
574
+ {},
575
+ () => VNodeChild,
576
+ {},
577
+ {},
578
+ {},
579
+ ComponentOptionsMixin,
580
+ ComponentOptionsMixin,
581
+ {},
582
+ string,
583
+ PublicProps,
584
+ Readonly<{}> & Readonly<{}>,
585
+ {},
586
+ {},
587
+ {},
588
+ {},
589
+ string,
590
+ ComponentProvideOptions,
591
+ true,
592
+ {},
593
+ any
594
+ >
595
+ ```
596
+
597
+ **Returns:** The notifications section component.
598
+
599
+ #### `SettingsContainer`
600
+
601
+ Outer settings-panel layout: padded vertical stack that hosts the
602
+ section sub-components. Publishes `onClose` to descendants via
603
+ context so `<LogOutDeleteSection>` etc. can dismiss the panel
604
+ after an action without explicit prop threading.
605
+
606
+ Children go through the default slot; `onClose` is passed as the
607
+ `onClose` prop or bound as `@close` — both reach the same listener.
608
+
609
+ ```typescript
610
+ const SettingsContainer: DefineComponent<
611
+ ExtractPropTypes<{ onClose: { type: PropType<() => void>; required: true } }>,
612
+ () => VNodeChild,
613
+ {},
614
+ {},
615
+ {},
616
+ ComponentOptionsMixin,
617
+ ComponentOptionsMixin,
618
+ 'close'[],
619
+ 'close',
620
+ PublicProps,
621
+ Readonly<ExtractPropTypes<{ onClose: { type: PropType<() => void>; required: true } }>> &
622
+ Readonly<{ onClose?: ((...args: any[]) => any) | undefined }>,
623
+ {},
624
+ {},
625
+ {},
626
+ {},
627
+ string,
628
+ ComponentProvideOptions,
629
+ true,
630
+ {},
631
+ any
632
+ >
633
+ ```
634
+
635
+ - `props` — Component props.
636
+
637
+ **Returns:** The container component.
638
+
639
+ #### `ThisDeviceSection`
640
+
641
+ "This device" detail strip — OS, browser, online/offline.
642
+
643
+ Reads everything from `@molecule/app-device` through the `useDevice`
644
+ composable (`deviceInfo` and `isOnline()`), so the bonded device provider
645
+ decides what it shows. No side effects, no app-specific state.
646
+
647
+ ```typescript
648
+ const ThisDeviceSection: DefineComponent<
649
+ {},
650
+ () => VNodeChild,
651
+ {},
652
+ {},
653
+ {},
654
+ ComponentOptionsMixin,
655
+ ComponentOptionsMixin,
656
+ {},
657
+ string,
658
+ PublicProps,
659
+ Readonly<{}> & Readonly<{}>,
660
+ {},
661
+ {},
662
+ {},
663
+ {},
664
+ string,
665
+ ComponentProvideOptions,
666
+ true,
667
+ {},
668
+ any
669
+ >
670
+ ```
671
+
672
+ **Returns:** The this-device section component.
673
+
674
+ #### `TiersUpgradeSection`
675
+
676
+ Billing section with full multi-tier upgrade flow.
677
+
678
+ Replaces the simpler `<BillingSection>` for apps backed by
679
+ `@molecule/api-payments-stripe` + `@molecule/api-resource-payment`
680
+ — loads the user's current plan from `/api/billing/status`,
681
+ loads available tiers from `/api/billing/tiers`, and renders an
682
+ Upgrade modal with a Subscribe button per tier price. Subscribe
683
+ POSTs to `/api/billing/checkout` and redirects to the Stripe
684
+ checkout URL; paid users see a Cancel button that POSTs to
685
+ `/api/billing/cancel`. A refused request shows the server's message.
686
+
687
+ ```typescript
688
+ const TiersUpgradeSection: DefineComponent<
689
+ ExtractPropTypes<{
690
+ redirectToCheckout: {
691
+ type: PropType<TiersUpgradeSectionProps['redirectToCheckout']>
692
+ required: false
693
+ default: (url: string, options?: { newWindow?: boolean; target?: string }) => void
694
+ }
695
+ }>,
696
+ () => VNodeChild,
697
+ {},
698
+ {},
699
+ {},
700
+ ComponentOptionsMixin,
701
+ ComponentOptionsMixin,
702
+ {},
703
+ string,
704
+ PublicProps,
705
+ Readonly<
706
+ ExtractPropTypes<{
707
+ redirectToCheckout: {
708
+ type: PropType<TiersUpgradeSectionProps['redirectToCheckout']>
709
+ required: false
710
+ default: (url: string, options?: { newWindow?: boolean; target?: string }) => void
711
+ }
712
+ }>
713
+ > &
714
+ Readonly<{}>,
715
+ { redirectToCheckout: ((checkoutUrl: string) => void) | undefined },
716
+ {},
717
+ {},
718
+ {},
719
+ string,
720
+ ComponentProvideOptions,
721
+ true,
722
+ {},
723
+ any
724
+ >
725
+ ```
726
+
727
+ **Returns:** The multi-tier billing section component.
728
+
729
+ #### `SettingsPanelContext`
730
+
731
+ Vue injection key for the settings panel context, published by
732
+ `<SettingsContainer>`; consume via `useSettingsPanelContext`.
733
+
734
+ ```typescript
735
+ const SettingsPanelContext: InjectionKey<SettingsPanelContextValue>
736
+ ```
737
+
738
+ ## Injection Notes
739
+
740
+ ### Requirements
741
+
742
+ Peer dependencies:
743
+
744
+ - `@molecule/app-auth` ^3.0.0
745
+ - `@molecule/app-http` ^1.8.0
746
+ - `@molecule/app-push` ^1.1.0
747
+ - `@molecule/app-ui` ^1.0.1
748
+ - `@molecule/app-ui-vue` ^1.1.0
749
+ - `@molecule/app-utilities` ^1.0.6
750
+ - `@molecule/app-vue` ^3.5.0
751
+ - `vue` ^3.4.0
752
+
753
+ ### Runtime Dependencies
754
+
755
+ - `@molecule/app-auth`
756
+ - `@molecule/app-http`
757
+ - `@molecule/app-push`
758
+ - `@molecule/app-ui`
759
+ - `@molecule/app-ui-vue`
760
+ - `@molecule/app-utilities`
761
+ - `@molecule/app-vue`
762
+ - `vue`
763
+
764
+ - Wiring prereqs: sections need the standard `@molecule/app-vue` plugin
765
+ stack — `moleculePlugin` installed with `i18n`, `http` (authenticated
766
+ client), `auth`, `theme` (AppearanceSection), and the push + device
767
+ providers bonded (`@molecule/app-push` / `@molecule/app-device`,
768
+ NotificationsSection/ThisDeviceSection) — plus a bonded ClassMap.
769
+ `<BillingSection>` and `<LogOutDeleteSection>` also navigate through the
770
+ binding's `useRouter()` and throw outside it.
771
+ - Section components throw if rendered outside `<SettingsContainer>`
772
+ (they read its injection for `onClose`).
773
+ - Server contract: the molecule API surface from
774
+ `@molecule/api-resource-user`, `@molecule/api-resource-device`,
775
+ `@molecule/api-two-factor`, and the billing endpoints
776
+ (`/api/billing/*`) wired by the payments stack. Missing read endpoints
777
+ degrade gracefully (sections render empty); the mutating actions do not.
778
+ - Translations: `@molecule/app-locales-settings-panel` companion bond.
779
+
780
+ ## Translations
781
+
782
+ Translation strings are provided by `@molecule/app-locales-settings-panel`.