@sevenfold/setto-client 0.6.2 → 0.7.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.
@@ -0,0 +1,5 @@
1
+ import type { SettoModule } from './module';
2
+ export type { SettoModule } from './module';
3
+ /** Every module the dashboard shows, in tab order. */
4
+ export declare const SETTO_MODULES: readonly SettoModule[];
5
+ export declare function findModule(id: string | null): SettoModule | undefined;
@@ -0,0 +1,30 @@
1
+ import type { ComponentType } from 'react';
2
+ /**
3
+ * What a Setto module is, from the client's side.
4
+ *
5
+ * A module is a capability a site gets by using the library — forms today;
6
+ * bookings, newsletters, reviews later. Each one is a directory under
7
+ * `src/modules/<id>` that owns its three faces:
8
+ *
9
+ * - a primitive the site renders (`SettoForm`), with edit chrome for the
10
+ * owner and content that lives in the locale so it publishes with the
11
+ * rest of the site;
12
+ * - a panel in the dashboard at `/setto?view=<id>` (`AdminView`), reached
13
+ * from the editor toolbar's settings item;
14
+ * - an api segment (`createFormsApi`) that `createApi` mounts under its id,
15
+ * against routes setto-server keeps under `src/modules/<id>`.
16
+ *
17
+ * Registering the module in `src/modules/index.ts` is what puts its tab in
18
+ * the dashboard. The primitive and the types are exported from the package
19
+ * root like everything else.
20
+ */
21
+ export interface SettoModule {
22
+ /** Stable id — also the dashboard view name and the api segment name. */
23
+ id: string;
24
+ /** Tab label in the dashboard, in Norwegian. */
25
+ label: string;
26
+ /** The dashboard panel for the current site. */
27
+ AdminView: ComponentType<{
28
+ siteId: string;
29
+ }>;
30
+ }