@fayz-ai/core 0.1.6

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 (172) hide show
  1. package/dist/app/render.d.ts +16 -0
  2. package/dist/app/render.d.ts.map +1 -0
  3. package/dist/blocks/index.d.ts +25 -0
  4. package/dist/blocks/index.d.ts.map +1 -0
  5. package/dist/chunk-2NTHNWEH.cjs +32 -0
  6. package/dist/chunk-2NTHNWEH.cjs.map +1 -0
  7. package/dist/chunk-5EAZOMVP.js +1609 -0
  8. package/dist/chunk-5EAZOMVP.js.map +1 -0
  9. package/dist/chunk-5TKIZVVJ.cjs +16 -0
  10. package/dist/chunk-5TKIZVVJ.cjs.map +1 -0
  11. package/dist/chunk-7RTUHSKY.js +3 -0
  12. package/dist/chunk-7RTUHSKY.js.map +1 -0
  13. package/dist/chunk-AXTWKF5X.cjs +38 -0
  14. package/dist/chunk-AXTWKF5X.cjs.map +1 -0
  15. package/dist/chunk-EGWWQ7AT.cjs +355 -0
  16. package/dist/chunk-EGWWQ7AT.cjs.map +1 -0
  17. package/dist/chunk-KAYQFSR6.js +298 -0
  18. package/dist/chunk-KAYQFSR6.js.map +1 -0
  19. package/dist/chunk-LSVBDYFQ.cjs +1639 -0
  20. package/dist/chunk-LSVBDYFQ.cjs.map +1 -0
  21. package/dist/chunk-SNQW6TRF.cjs +658 -0
  22. package/dist/chunk-SNQW6TRF.cjs.map +1 -0
  23. package/dist/chunk-WKZVSKEU.js +26 -0
  24. package/dist/chunk-WKZVSKEU.js.map +1 -0
  25. package/dist/chunk-Y2C2FBQP.js +35 -0
  26. package/dist/chunk-Y2C2FBQP.js.map +1 -0
  27. package/dist/chunk-YSBXGHAM.js +643 -0
  28. package/dist/chunk-YSBXGHAM.js.map +1 -0
  29. package/dist/data/archetype.d.ts +13 -0
  30. package/dist/data/archetype.d.ts.map +1 -0
  31. package/dist/data/cached.d.ts +19 -0
  32. package/dist/data/cached.d.ts.map +1 -0
  33. package/dist/data/fayz-api.d.ts +19 -0
  34. package/dist/data/fayz-api.d.ts.map +1 -0
  35. package/dist/data/index.cjs +32 -0
  36. package/dist/data/index.cjs.map +1 -0
  37. package/dist/data/index.d.ts +9 -0
  38. package/dist/data/index.d.ts.map +1 -0
  39. package/dist/data/index.js +3 -0
  40. package/dist/data/index.js.map +1 -0
  41. package/dist/data/mock.d.ts +7 -0
  42. package/dist/data/mock.d.ts.map +1 -0
  43. package/dist/data/resolve.d.ts +22 -0
  44. package/dist/data/resolve.d.ts.map +1 -0
  45. package/dist/data/supabase.d.ts +18 -0
  46. package/dist/data/supabase.d.ts.map +1 -0
  47. package/dist/data/types.d.ts +23 -0
  48. package/dist/data/types.d.ts.map +1 -0
  49. package/dist/entity/index.cjs +28 -0
  50. package/dist/entity/index.cjs.map +1 -0
  51. package/dist/entity/index.d.ts +3 -0
  52. package/dist/entity/index.d.ts.map +1 -0
  53. package/dist/entity/index.js +3 -0
  54. package/dist/entity/index.js.map +1 -0
  55. package/dist/entity/registry.d.ts +20 -0
  56. package/dist/entity/registry.d.ts.map +1 -0
  57. package/dist/events/index.d.ts +16 -0
  58. package/dist/events/index.d.ts.map +1 -0
  59. package/dist/i18n/index.cjs +44 -0
  60. package/dist/i18n/index.cjs.map +1 -0
  61. package/dist/i18n/index.d.ts +21 -0
  62. package/dist/i18n/index.d.ts.map +1 -0
  63. package/dist/i18n/index.js +3 -0
  64. package/dist/i18n/index.js.map +1 -0
  65. package/dist/i18n/shell-translations.d.ts +2 -0
  66. package/dist/i18n/shell-translations.d.ts.map +1 -0
  67. package/dist/index.cjs +911 -0
  68. package/dist/index.cjs.map +1 -0
  69. package/dist/index.d.ts +46 -0
  70. package/dist/index.d.ts.map +1 -0
  71. package/dist/index.js +596 -0
  72. package/dist/index.js.map +1 -0
  73. package/dist/lib/cache.d.ts +21 -0
  74. package/dist/lib/cache.d.ts.map +1 -0
  75. package/dist/lib/csv.d.ts +14 -0
  76. package/dist/lib/csv.d.ts.map +1 -0
  77. package/dist/lib/format.d.ts +7 -0
  78. package/dist/lib/format.d.ts.map +1 -0
  79. package/dist/manifest/index.d.ts +80 -0
  80. package/dist/manifest/index.d.ts.map +1 -0
  81. package/dist/plugin/createSafeDataProvider.d.ts +14 -0
  82. package/dist/plugin/createSafeDataProvider.d.ts.map +1 -0
  83. package/dist/plugin/index.cjs +32 -0
  84. package/dist/plugin/index.cjs.map +1 -0
  85. package/dist/plugin/index.d.ts +2 -0
  86. package/dist/plugin/index.d.ts.map +1 -0
  87. package/dist/plugin/index.js +3 -0
  88. package/dist/plugin/index.js.map +1 -0
  89. package/dist/plugin/runtime.d.ts +31 -0
  90. package/dist/plugin/runtime.d.ts.map +1 -0
  91. package/dist/registry/index.d.ts +88 -0
  92. package/dist/registry/index.d.ts.map +1 -0
  93. package/dist/router/index.cjs +16 -0
  94. package/dist/router/index.cjs.map +1 -0
  95. package/dist/router/index.d.ts +8 -0
  96. package/dist/router/index.d.ts.map +1 -0
  97. package/dist/router/index.js +3 -0
  98. package/dist/router/index.js.map +1 -0
  99. package/dist/runtime/index.cjs +16 -0
  100. package/dist/runtime/index.cjs.map +1 -0
  101. package/dist/runtime/index.d.ts +3 -0
  102. package/dist/runtime/index.d.ts.map +1 -0
  103. package/dist/runtime/index.js +3 -0
  104. package/dist/runtime/index.js.map +1 -0
  105. package/dist/runtime/oauth.d.ts +96 -0
  106. package/dist/runtime/oauth.d.ts.map +1 -0
  107. package/dist/tenant/index.d.ts +3 -0
  108. package/dist/tenant/index.d.ts.map +1 -0
  109. package/dist/types/auth.d.ts +27 -0
  110. package/dist/types/auth.d.ts.map +1 -0
  111. package/dist/types/billing.d.ts +17 -0
  112. package/dist/types/billing.d.ts.map +1 -0
  113. package/dist/types/crud.d.ts +107 -0
  114. package/dist/types/crud.d.ts.map +1 -0
  115. package/dist/types/entities.d.ts +134 -0
  116. package/dist/types/entities.d.ts.map +1 -0
  117. package/dist/types/i18n.d.ts +8 -0
  118. package/dist/types/i18n.d.ts.map +1 -0
  119. package/dist/types/index.cjs +4 -0
  120. package/dist/types/index.cjs.map +1 -0
  121. package/dist/types/index.d.ts +10 -0
  122. package/dist/types/index.d.ts.map +1 -0
  123. package/dist/types/index.js +3 -0
  124. package/dist/types/index.js.map +1 -0
  125. package/dist/types/org.d.ts +96 -0
  126. package/dist/types/org.d.ts.map +1 -0
  127. package/dist/types/permissions.d.ts +25 -0
  128. package/dist/types/permissions.d.ts.map +1 -0
  129. package/dist/types/plugins.d.ts +314 -0
  130. package/dist/types/plugins.d.ts.map +1 -0
  131. package/dist/types/theme.d.ts +16 -0
  132. package/dist/types/theme.d.ts.map +1 -0
  133. package/package.json +98 -0
  134. package/src/app/render.tsx +69 -0
  135. package/src/blocks/index.tsx +68 -0
  136. package/src/data/archetype.ts +210 -0
  137. package/src/data/cached.ts +55 -0
  138. package/src/data/fayz-api.ts +200 -0
  139. package/src/data/index.ts +8 -0
  140. package/src/data/mock.ts +84 -0
  141. package/src/data/resolve.ts +108 -0
  142. package/src/data/supabase.ts +169 -0
  143. package/src/data/types.ts +20 -0
  144. package/src/entity/index.ts +2 -0
  145. package/src/entity/registry.ts +42 -0
  146. package/src/events/index.tsx +82 -0
  147. package/src/i18n/index.ts +250 -0
  148. package/src/i18n/shell-translations.ts +1391 -0
  149. package/src/index.ts +132 -0
  150. package/src/lib/cache.ts +118 -0
  151. package/src/lib/csv.ts +54 -0
  152. package/src/lib/format.ts +58 -0
  153. package/src/manifest/app-manifest.schema.json +103 -0
  154. package/src/manifest/index.ts +394 -0
  155. package/src/plugin/createSafeDataProvider.ts +30 -0
  156. package/src/plugin/index.ts +1 -0
  157. package/src/plugin/runtime.ts +313 -0
  158. package/src/registry/index.ts +163 -0
  159. package/src/router/index.ts +29 -0
  160. package/src/runtime/index.ts +15 -0
  161. package/src/runtime/oauth.ts +219 -0
  162. package/src/tenant/index.ts +18 -0
  163. package/src/types/auth.ts +26 -0
  164. package/src/types/billing.ts +17 -0
  165. package/src/types/crud.ts +108 -0
  166. package/src/types/entities.ts +142 -0
  167. package/src/types/i18n.ts +7 -0
  168. package/src/types/index.ts +10 -0
  169. package/src/types/org.ts +94 -0
  170. package/src/types/permissions.ts +32 -0
  171. package/src/types/plugins.ts +363 -0
  172. package/src/types/theme.ts +17 -0
@@ -0,0 +1,314 @@
1
+ import type React from 'react';
2
+ import type { EntityDef } from './crud';
3
+ import type { FeatureDeclaration, PermissionAction } from './permissions';
4
+ export type VerticalId = 'beauty' | 'food' | 'health' | 'services' | 'retail' | 'education' | (string & {});
5
+ export type PluginScope = 'core' | 'vertical' | 'universal' | 'addon' | 'tenant';
6
+ export type PluginStatus = 'pending_setup' | 'active' | 'disabled' | 'removed';
7
+ /**
8
+ * Scaffold type this plugin targets.
9
+ * Plugins can declare which scaffolds they work with.
10
+ * If omitted, the plugin works with all scaffold types.
11
+ */
12
+ export type ScaffoldType = 'saas' | 'ecommerce' | 'landing_page' | 'website' | (string & {});
13
+ export interface PluginPermissionRequirement {
14
+ feature: string;
15
+ action: PermissionAction;
16
+ }
17
+ export interface PluginNavigationEntry {
18
+ id?: string;
19
+ section: 'main' | 'secondary' | 'settings';
20
+ position: number;
21
+ label: string;
22
+ route: string;
23
+ icon?: string;
24
+ badge?: string | number;
25
+ permission?: PluginPermissionRequirement;
26
+ }
27
+ export interface PluginSettingsTab {
28
+ id: string;
29
+ label: string;
30
+ icon?: string;
31
+ /** Provide the component directly, or reference a registered component by id
32
+ * (resolvePluginComponent resolves componentId → the component registry).
33
+ * Exactly one is required. */
34
+ component?: React.ComponentType<unknown>;
35
+ componentId?: string;
36
+ pluginId?: string;
37
+ order?: number;
38
+ permission?: PluginPermissionRequirement;
39
+ }
40
+ export interface PluginRouteDefinition {
41
+ path: string;
42
+ /** Component or a registered component id — exactly one is required. */
43
+ component?: React.ComponentType<unknown>;
44
+ componentId?: string;
45
+ guard?: 'authenticated' | 'role' | 'public' | 'share-token';
46
+ roles?: string[];
47
+ permission?: PluginPermissionRequirement;
48
+ /** Render edge-to-edge with no page padding/animation wrapper (chat, kanban, canvas). */
49
+ fullBleed?: boolean;
50
+ }
51
+ export type PluginWidgetZone = 'shell.sidebar.before-nav' | 'shell.sidebar.footer' | 'shell.topbar.start' | 'shell.topbar.end' | 'page.before' | 'page.after' | 'settings.before' | 'settings.after' | 'shell.floating' | (string & {});
52
+ export declare const WidgetZone: {
53
+ readonly SIDEBAR_BEFORE_NAV: "shell.sidebar.before-nav";
54
+ readonly SIDEBAR_FOOTER: "shell.sidebar.footer";
55
+ readonly TOPBAR_START: "shell.topbar.start";
56
+ readonly TOPBAR_END: "shell.topbar.end";
57
+ readonly PAGE_BEFORE: "page.before";
58
+ readonly PAGE_AFTER: "page.after";
59
+ readonly SETTINGS_BEFORE: "settings.before";
60
+ readonly SETTINGS_AFTER: "settings.after";
61
+ readonly FLOATING: "shell.floating";
62
+ };
63
+ export interface PluginRuntimeTenant {
64
+ id?: string;
65
+ slug?: string;
66
+ verticalId?: string;
67
+ plan?: string;
68
+ }
69
+ export interface PluginRuntimeUser {
70
+ id?: string;
71
+ role?: string;
72
+ }
73
+ export interface PluginWidgetVisibility {
74
+ routes?: string[];
75
+ excludeRoutes?: string[];
76
+ layouts?: string[];
77
+ roles?: string[];
78
+ plans?: string[];
79
+ permissions?: PluginPermissionRequirement[];
80
+ when?: (context: PluginRuntimeContext) => boolean;
81
+ }
82
+ export interface PluginRuntimeContext {
83
+ tenant: PluginRuntimeTenant | null;
84
+ user: PluginRuntimeUser | null;
85
+ currentPath: string;
86
+ matchedPath?: string;
87
+ layout: string;
88
+ hasPermission?: (req: PluginPermissionRequirement) => boolean;
89
+ }
90
+ export interface PluginWidgetDefinition<TConfig extends Record<string, unknown> = Record<string, unknown>> {
91
+ id: string;
92
+ zone: PluginWidgetZone;
93
+ /** Component or a registered component id — exactly one is required. */
94
+ component?: React.ComponentType<unknown>;
95
+ componentId?: string;
96
+ title?: string;
97
+ order?: number;
98
+ permission?: PluginPermissionRequirement;
99
+ visibility?: PluginWidgetVisibility;
100
+ props?: TConfig;
101
+ }
102
+ export type DashboardWidgetKind = 'kpi' | 'chart' | 'table' | 'onboarding' | 'custom';
103
+ /** Surfaces a widget can appear on. 'home' = global app home; 'plugin-home' =
104
+ * the owning plugin's own overview page. */
105
+ export type DashboardSurface = 'home' | 'plugin-home';
106
+ export interface DashboardWidgetDef<TProps extends Record<string, unknown> = Record<string, unknown>> {
107
+ /** Globally unique id, e.g. 'crm.kpi.total-leads'. */
108
+ id: string;
109
+ /** i18n key or plain label. */
110
+ title: string;
111
+ description?: string;
112
+ icon?: string;
113
+ /** Owning domain used to scope plugin-home vs global home. Defaults to plugin.id. */
114
+ domain?: string;
115
+ kind: DashboardWidgetKind;
116
+ /** Column span on the 4-col grid. Defaults by kind (kpi→1, chart→2, table→4). */
117
+ span?: 1 | 2 | 3 | 4;
118
+ /** Visible before any app/user customization. Default: true. */
119
+ defaultVisible?: boolean;
120
+ /** Default order within the surface (lower = first). */
121
+ defaultOrder?: number;
122
+ /** Surfaces this widget appears on. Default: both. */
123
+ surfaces?: DashboardSurface[];
124
+ verticalId?: VerticalId;
125
+ permission?: PluginPermissionRequirement;
126
+ /** Component or a registered component id — exactly one is required. */
127
+ component?: React.ComponentType<unknown>;
128
+ componentId?: string;
129
+ props?: TProps;
130
+ }
131
+ /** App- or user-level overrides applied on top of the registered defaults. */
132
+ export interface DashboardLayoutConfig {
133
+ widgets?: Array<{
134
+ id: string;
135
+ visible?: boolean;
136
+ order?: number;
137
+ span?: number;
138
+ }>;
139
+ }
140
+ export interface ResolvedDashboardWidget extends DashboardWidgetDef {
141
+ /** Resolved owning domain (plugin.id when not explicitly set). */
142
+ domain: string;
143
+ order: number;
144
+ plugin: ResolvedPluginManifest;
145
+ }
146
+ /** An event a plugin emits onto the event bus — declared for platform
147
+ * introspection and so the AppManifest can bind event→action as data. */
148
+ export interface PluginEventDefinition {
149
+ /** Namespaced event name, e.g. 'agenda.booking.confirmed'. */
150
+ name: string;
151
+ description?: string;
152
+ /** JSON Schema for the payload (editor / AI / validation). */
153
+ payloadSchema?: Record<string, unknown>;
154
+ }
155
+ export interface PluginCapability {
156
+ id: string;
157
+ label: string;
158
+ description?: string;
159
+ kind?: 'page' | 'widget' | 'data' | 'integration';
160
+ }
161
+ export interface PluginQuickAction {
162
+ id: string;
163
+ label: string;
164
+ icon?: string;
165
+ description?: string;
166
+ /** Action handler — typically navigates to a view. */
167
+ action: () => void;
168
+ }
169
+ export type AIToolMode = 'read' | 'persist';
170
+ export interface AIToolParameterProperty {
171
+ type: 'string' | 'number' | 'boolean' | 'array' | 'object';
172
+ description?: string;
173
+ enum?: string[];
174
+ items?: AIToolParameterProperty;
175
+ default?: unknown;
176
+ }
177
+ export interface AIToolParameters {
178
+ type: 'object';
179
+ properties: Record<string, AIToolParameterProperty>;
180
+ required?: string[];
181
+ }
182
+ export interface AIToolSuggestion {
183
+ label: string;
184
+ prompt?: string;
185
+ icon?: string;
186
+ verticalId?: VerticalId;
187
+ }
188
+ export interface PluginAITool {
189
+ id: string;
190
+ name: string;
191
+ description: string;
192
+ icon?: string;
193
+ mode: AIToolMode;
194
+ parameters?: AIToolParameters;
195
+ permission?: PluginPermissionRequirement;
196
+ suggestions?: AIToolSuggestion[];
197
+ category?: string;
198
+ tags?: string[];
199
+ }
200
+ export interface PluginRegistryDef {
201
+ id: string;
202
+ entity: EntityDef;
203
+ icon?: string;
204
+ description?: string;
205
+ display?: 'table' | 'cards' | 'tree';
206
+ seedData?: Record<string, unknown>[];
207
+ mockData?: Record<string, unknown>[];
208
+ readOnly?: boolean;
209
+ }
210
+ export interface PluginMigration {
211
+ id: string;
212
+ version: string;
213
+ sql: string;
214
+ description?: string;
215
+ }
216
+ export interface PluginOnboarding {
217
+ /** Component or a registered component id — exactly one is required. */
218
+ component?: React.ComponentType<{
219
+ onComplete: () => void;
220
+ }>;
221
+ componentId?: string;
222
+ title?: string;
223
+ description?: string;
224
+ }
225
+ export interface PluginManifest {
226
+ id: string;
227
+ name: string;
228
+ icon: string;
229
+ version: string;
230
+ /** Plugin contract version. The runtime refuses plugins built for a newer
231
+ * contract than it supports (see PLUGIN_API_VERSION). Omit = legacy/compatible. */
232
+ apiVersion?: number;
233
+ description?: string;
234
+ scope?: PluginScope;
235
+ verticalId?: VerticalId;
236
+ /** Events this plugin emits onto the bus (declared for introspection/automation). */
237
+ events?: PluginEventDefinition[];
238
+ /** Which scaffold types this plugin targets. Omit for universal plugins. */
239
+ scaffolds?: ScaffoldType[];
240
+ tenantId?: string;
241
+ defaultEnabled?: boolean;
242
+ schema?: string;
243
+ dependencies?: string[];
244
+ navigation: PluginNavigationEntry[];
245
+ settings?: PluginSettingsTab[];
246
+ routes: PluginRouteDefinition[];
247
+ widgets?: PluginWidgetDefinition[];
248
+ /** Dashboard widgets this plugin contributes to the dashboard registry. */
249
+ dashboardWidgets?: DashboardWidgetDef[];
250
+ capabilities?: PluginCapability[];
251
+ aiTools?: PluginAITool[];
252
+ entities?: string[];
253
+ permissions?: string[];
254
+ declaredFeatures?: FeatureDeclaration[];
255
+ registries?: PluginRegistryDef[];
256
+ migrations?: PluginMigration[];
257
+ onboarding?: PluginOnboarding;
258
+ locales?: Record<string, Record<string, string>>;
259
+ /** Marketplace metadata for npm discovery */
260
+ marketplace?: {
261
+ category: string;
262
+ tags: string[];
263
+ author: string;
264
+ license: string;
265
+ repository?: string;
266
+ };
267
+ }
268
+ export interface TenantPluginBinding {
269
+ pluginId: string;
270
+ status: PluginStatus;
271
+ tenantId?: string;
272
+ config?: Record<string, unknown>;
273
+ }
274
+ export interface PluginRuntimeIssue {
275
+ type: 'duplicate_plugin' | 'missing_dependency' | 'circular_dependency' | 'vertical_mismatch' | 'incompatible_api_version';
276
+ pluginId: string;
277
+ dependencyId?: string;
278
+ message: string;
279
+ }
280
+ export interface ResolvedPluginManifest extends PluginManifest {
281
+ status: PluginStatus;
282
+ isActive: boolean;
283
+ activationReason: 'default' | 'tenant' | 'dependency' | 'inactive';
284
+ config: Record<string, unknown>;
285
+ missingDependencies: string[];
286
+ settingsTabs: PluginSettingsTab[];
287
+ widgets: PluginWidgetDefinition[];
288
+ resolvedRegistries: PluginRegistryDef[];
289
+ resolvedAITools: PluginAITool[];
290
+ }
291
+ export interface ResolvedPluginWidget<TConfig extends Record<string, unknown> = Record<string, unknown>> extends PluginWidgetDefinition<TConfig> {
292
+ order: number;
293
+ config: TConfig;
294
+ plugin: ResolvedPluginManifest;
295
+ }
296
+ export interface PluginRuntimeRoute extends PluginRouteDefinition {
297
+ plugin: ResolvedPluginManifest;
298
+ }
299
+ export interface PluginRuntime {
300
+ context: PluginRuntimeContext;
301
+ plugins: ResolvedPluginManifest[];
302
+ activePlugins: ResolvedPluginManifest[];
303
+ routes: PluginRuntimeRoute[];
304
+ navigation: PluginNavigationEntry[];
305
+ settingsTabs: PluginSettingsTab[];
306
+ widgets: ResolvedPluginWidget[];
307
+ dashboardWidgets: ResolvedDashboardWidget[];
308
+ capabilities: PluginCapability[];
309
+ aiTools: PluginAITool[];
310
+ issues: PluginRuntimeIssue[];
311
+ registries: Map<string, PluginRegistryDef[]>;
312
+ pluginFeatures: FeatureDeclaration[];
313
+ }
314
+ //# sourceMappingURL=plugins.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plugins.d.ts","sourceRoot":"","sources":["../../src/types/plugins.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAA;AACvC,OAAO,KAAK,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAA;AAEzE,MAAM,MAAM,UAAU,GAAG,QAAQ,GAAG,MAAM,GAAG,QAAQ,GAAG,UAAU,GAAG,QAAQ,GAAG,WAAW,GAAG,CAAC,MAAM,GAAG,EAAE,CAAC,CAAA;AAC3G,MAAM,MAAM,WAAW,GAAG,MAAM,GAAG,UAAU,GAAG,WAAW,GAAG,OAAO,GAAG,QAAQ,CAAA;AAChF,MAAM,MA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,EAAE,CAAA;IAC3C,YAAY,EAAE,gBAAgB,EAAE,CAAA;IAChC,OAAO,EAAE,YAAY,EAAE,CAAA;IACvB,MAAM,EAAE,kBAAkB,EAAE,CAAA;IAC5B,UAAU,EAAE,GAAG,CAAC,MAAM,EAAE,iBAAiB,EAAE,CAAC,CAAA;IAC5C,cAAc,EAAE,kBAAkB,EAAE,CAAA;CACrC"}
@@ -0,0 +1,16 @@
1
+ export type ThemeBrand = 'blue' | 'violet' | 'green' | 'orange' | 'red' | 'pink' | 'teal' | (string & {});
2
+ export type ThemeRadius = 'none' | 'sm' | 'md' | 'lg' | 'full';
3
+ export type ThemeMode = 'light' | 'dark' | 'system';
4
+ export interface SaasTheme {
5
+ brand?: ThemeBrand;
6
+ radius?: ThemeRadius;
7
+ /** Custom primary color as HSL string, e.g. '220 70% 50%' */
8
+ primaryHsl?: string;
9
+ /** Custom secondary color as HSL string */
10
+ secondaryHsl?: string;
11
+ }
12
+ export interface ThemeConfig {
13
+ theme?: SaasTheme;
14
+ defaultMode?: ThemeMode;
15
+ }
16
+ //# sourceMappingURL=theme.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"theme.d.ts","sourceRoot":"","sources":["../../src/types/theme.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,UAAU,GAAG,MAAM,GAAG,QAAQ,GAAG,OAAO,GAAG,QAAQ,GAAG,KAAK,GAAG,MAAM,GAAG,MAAM,GAAG,CAAC,MAAM,GAAG,EAAE,CAAC,CAAA;AACzG,MAAM,MAAM,WAAW,GAAG,MAAM,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,MAAM,CAAA;AAC9D,MAAM,MAAM,SAAS,GAAG,OAAO,GAAG,MAAM,GAAG,QAAQ,CAAA;AAEnD,MAAM,WAAW,SAAS;IACxB,KAAK,CAAC,EAAE,UAAU,CAAA;IAClB,MAAM,CAAC,EAAE,WAAW,CAAA;IACpB,6DAA6D;IAC7D,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,2CAA2C;IAC3C,YAAY,CAAC,EAAE,MAAM,CAAA;CACtB;AAED,MAAM,WAAW,WAAW;IAC1B,KAAK,CAAC,EAAE,SAAS,CAAA;IACjB,WAAW,CAAC,EAAE,SAAS,CAAA;CACxB"}
package/package.json ADDED
@@ -0,0 +1,98 @@
1
+ {
2
+ "name": "@fayz-ai/core",
3
+ "version": "0.1.6",
4
+ "description": "Fayz SDK core — data providers, entity system, plugin runtime, i18n, routing",
5
+ "type": "module",
6
+ "main": "./dist/index.cjs",
7
+ "module": "./dist/index.js",
8
+ "types": "./dist/index.d.ts",
9
+ "exports": {
10
+ ".": {
11
+ "source": "./src/index.ts",
12
+ "types": "./dist/index.d.ts",
13
+ "import": "./dist/index.js",
14
+ "require": "./dist/index.cjs"
15
+ },
16
+ "./data": {
17
+ "source": "./src/data/index.ts",
18
+ "types": "./dist/data/index.d.ts",
19
+ "import": "./dist/data/index.js",
20
+ "require": "./dist/data/index.cjs"
21
+ },
22
+ "./entity": {
23
+ "source": "./src/entity/index.ts",
24
+ "types": "./dist/entity/index.d.ts",
25
+ "import": "./dist/entity/index.js",
26
+ "require": "./dist/entity/index.cjs"
27
+ },
28
+ "./plugin": {
29
+ "source": "./src/plugin/index.ts",
30
+ "types": "./dist/plugin/index.d.ts",
31
+ "import": "./dist/plugin/index.js",
32
+ "require": "./dist/plugin/index.cjs"
33
+ },
34
+ "./i18n": {
35
+ "source": "./src/i18n/index.ts",
36
+ "types": "./dist/i18n/index.d.ts",
37
+ "import": "./dist/i18n/index.js",
38
+ "require": "./dist/i18n/index.cjs"
39
+ },
40
+ "./router": {
41
+ "source": "./src/router/index.ts",
42
+ "types": "./dist/router/index.d.ts",
43
+ "import": "./dist/router/index.js",
44
+ "require": "./dist/router/index.cjs"
45
+ },
46
+ "./runtime": {
47
+ "source": "./src/runtime/index.ts",
48
+ "types": "./dist/runtime/index.d.ts",
49
+ "import": "./dist/runtime/index.js",
50
+ "require": "./dist/runtime/index.cjs"
51
+ },
52
+ "./types": {
53
+ "source": "./src/types/index.ts",
54
+ "types": "./dist/types/index.d.ts",
55
+ "import": "./dist/types/index.js",
56
+ "require": "./dist/types/index.cjs"
57
+ }
58
+ },
59
+ "files": [
60
+ "dist",
61
+ "src"
62
+ ],
63
+ "peerDependencies": {
64
+ "react": "^18.0.0 || ^19.0.0",
65
+ "react-dom": "^18.0.0 || ^19.0.0"
66
+ },
67
+ "dependencies": {
68
+ "@supabase/supabase-js": "^2.45.0",
69
+ "zustand": "^4.5.0",
70
+ "@fayz-ai/sdk": "^0.1.5"
71
+ },
72
+ "devDependencies": {
73
+ "@types/react": "^18.3.0",
74
+ "@types/react-dom": "^18.3.0",
75
+ "react": "^18.3.0",
76
+ "react-dom": "^18.3.0",
77
+ "tsup": "^8.2.0",
78
+ "typescript": "^5.5.0"
79
+ },
80
+ "license": "MIT",
81
+ "keywords": [
82
+ "fayz",
83
+ "fayz-sdk",
84
+ "plugin-system",
85
+ "data-provider",
86
+ "entity"
87
+ ],
88
+ "publishConfig": {
89
+ "access": "public"
90
+ },
91
+ "scripts": {
92
+ "build": "tsup && tsc --emitDeclarationOnly --declaration --declarationMap --noEmit false",
93
+ "check:manifest": "node ./scripts/check-manifest-contract.mjs",
94
+ "dev": "tsup --watch",
95
+ "typecheck": "tsc --noEmit",
96
+ "clean": "rm -rf dist"
97
+ }
98
+ }
@@ -0,0 +1,69 @@
1
+ import * as React from 'react'
2
+ import { getScaffold } from '../registry'
3
+ import { migrateManifest, validateManifest, CURRENT_MANIFEST_VERSION } from '../manifest'
4
+ import type { AppManifest } from '../manifest'
5
+
6
+ // ---------------------------------------------------------------------------
7
+ // defineApp / renderApp — the entry points that turn an AppManifest into a
8
+ // running app. Scaffolds (admin, storefront, portal) self-register into the
9
+ // scaffold registry when their package is imported, so core never depends on
10
+ // them: a generated app imports the scaffold package(s) it needs, then calls
11
+ // renderApp(manifest). createSaasApp / createStorefrontApp become sugar that
12
+ // builds a manifest and hands it here.
13
+ // ---------------------------------------------------------------------------
14
+
15
+ const ManifestContext = React.createContext<AppManifest | null>(null)
16
+
17
+ /** Access the active app manifest from any component under renderApp. */
18
+ export function useManifest(): AppManifest | null {
19
+ return React.useContext(ManifestContext)
20
+ }
21
+
22
+ /** Stamp + validate a manifest authored in code (the sugar path). */
23
+ export function defineApp(
24
+ manifest: Omit<AppManifest, 'manifestVersion'> & { manifestVersion?: number },
25
+ ): AppManifest {
26
+ const full = {
27
+ ...manifest,
28
+ manifestVersion: manifest.manifestVersion ?? CURRENT_MANIFEST_VERSION,
29
+ } as AppManifest
30
+ const problems = validateManifest(full)
31
+ if (problems.length) {
32
+ throw new Error(`Invalid AppManifest:\n - ${problems.join('\n - ')}`)
33
+ }
34
+ return full
35
+ }
36
+
37
+ export interface RenderAppOptions {
38
+ /** Which surface to mount; defaults to the first declared surface. */
39
+ surface?: string
40
+ }
41
+
42
+ /** Resolve, migrate and validate a manifest, then mount the scaffold for the
43
+ * chosen surface. Accepts a raw object (e.g. parsed app.manifest.json). */
44
+ export function renderApp(
45
+ input: AppManifest | Record<string, unknown>,
46
+ opts: RenderAppOptions = {},
47
+ ): React.ReactElement {
48
+ const manifest = migrateManifest(input as Record<string, unknown>)
49
+ const problems = validateManifest(manifest)
50
+ if (problems.length) {
51
+ throw new Error(`Invalid AppManifest:\n - ${problems.join('\n - ')}`)
52
+ }
53
+ const surfaceName = opts.surface ?? Object.keys(manifest.surfaces)[0]
54
+ const surface = surfaceName ? manifest.surfaces[surfaceName] : undefined
55
+ if (!surface) {
56
+ throw new Error(`Surface "${surfaceName}" not found in manifest.`)
57
+ }
58
+ const Scaffold = getScaffold(surface.scaffold)
59
+ if (!Scaffold) {
60
+ throw new Error(
61
+ `Scaffold "${surface.scaffold}" is not registered. Import the package that provides it (e.g. @fayz-ai/saas or @fayz-ai/shop) before calling renderApp.`,
62
+ )
63
+ }
64
+ return React.createElement(
65
+ ManifestContext.Provider,
66
+ { value: manifest },
67
+ React.createElement(Scaffold, { manifest, surface: surfaceName }),
68
+ )
69
+ }
@@ -0,0 +1,68 @@
1
+ import * as React from 'react'
2
+ import { getBlock } from '../registry'
3
+
4
+ // ---------------------------------------------------------------------------
5
+ // Block tree — the universal page primitive. A page (admin or storefront) is an
6
+ // ordered tree of typed blocks. Block `type`s are resolved against the block
7
+ // registry, so a page is pure data: `{ type, props, children }`. This
8
+ // generalizes the storefront's HomeSection switch to every surface.
9
+ // ---------------------------------------------------------------------------
10
+
11
+ export interface BlockNode {
12
+ /** Registered block id, e.g. 'hero', 'products', 'kpi-grid', 'custom:foo'. */
13
+ type: string
14
+ /** Stable id for keys / editing; optional. */
15
+ id?: string
16
+ props?: Record<string, unknown>
17
+ children?: BlockNode[]
18
+ }
19
+
20
+ /** A block component receives its declared props plus the raw node (so a block
21
+ * can render its own children via <BlockChildren>). */
22
+ export type BlockComponentProps = Record<string, unknown> & {
23
+ node?: BlockNode
24
+ children?: React.ReactNode
25
+ }
26
+
27
+ // Rendered in place of an unresolved block type. Unknown blocks are caught
28
+ // ahead of production by `fayz doctor` / the conformance kit, so this visible
29
+ // marker is a development aid rather than a production concern.
30
+ function UnknownBlock({ type }: { type: string }): React.ReactElement | null {
31
+ return React.createElement(
32
+ 'div',
33
+ {
34
+ style: {
35
+ border: '1px dashed #c026d3',
36
+ color: '#a21caf',
37
+ padding: '8px 12px',
38
+ font: '12px ui-monospace, monospace',
39
+ borderRadius: 6,
40
+ },
41
+ },
42
+ `Unknown block: "${type}"`,
43
+ )
44
+ }
45
+
46
+ export function BlockRenderer({ node }: { node: BlockNode }): React.ReactElement | null {
47
+ const Comp = getBlock(node.type)
48
+ const childEls = node.children?.length
49
+ ? node.children.map((child, i) =>
50
+ React.createElement(BlockRenderer, { key: child.id ?? `${child.type}-${i}`, node: child }),
51
+ )
52
+ : null
53
+ if (!Comp) return React.createElement(UnknownBlock, { type: node.type })
54
+ return React.createElement(Comp, { ...(node.props ?? {}), node }, childEls)
55
+ }
56
+
57
+ /** Render an ordered list of blocks (a page body). */
58
+ export function renderBlocks(nodes: BlockNode[]): React.ReactNode {
59
+ return nodes.map((node, i) =>
60
+ React.createElement(BlockRenderer, { key: node.id ?? `${node.type}-${i}`, node }),
61
+ )
62
+ }
63
+
64
+ /** Convenience for block components that render their own children. */
65
+ export function BlockChildren({ node }: { node?: BlockNode }): React.ReactNode {
66
+ if (!node?.children?.length) return null
67
+ return renderBlocks(node.children)
68
+ }