@fayz-ai/plugin-forms 0.1.4 → 0.2.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/dist/config.d.ts +4 -1
- package/dist/config.d.ts.map +1 -1
- package/dist/index.cjs +22 -13
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +25 -16
- package/dist/index.js.map +1 -1
- package/dist/views/CustomFormsSettingsTab.d.ts +1 -3
- package/dist/views/CustomFormsSettingsTab.d.ts.map +1 -1
- package/package.json +7 -9
- package/src/config.ts +5 -1
- package/src/index.ts +20 -3
- package/src/views/CustomFormsSettingsTab.tsx +2 -19
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import type { PluginRegistryDef } from '@fayz-ai/core';
|
|
3
2
|
import type { CustomFormsConfig } from '../config';
|
|
4
3
|
import type { CustomFormsDataProvider } from '../data/types';
|
|
5
4
|
import type { CustomFormsStore } from '../store';
|
|
@@ -7,8 +6,7 @@ interface CustomFormsSettingsTabProps {
|
|
|
7
6
|
config: CustomFormsConfig;
|
|
8
7
|
provider: CustomFormsDataProvider;
|
|
9
8
|
store: CustomFormsStore;
|
|
10
|
-
registries?: PluginRegistryDef[];
|
|
11
9
|
}
|
|
12
|
-
export declare function CustomFormsSettingsTab({ config, provider, store
|
|
10
|
+
export declare function CustomFormsSettingsTab({ config, provider, store }: CustomFormsSettingsTabProps): React.JSX.Element;
|
|
13
11
|
export {};
|
|
14
12
|
//# sourceMappingURL=CustomFormsSettingsTab.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CustomFormsSettingsTab.d.ts","sourceRoot":"","sources":["../../src/views/CustomFormsSettingsTab.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAgC,MAAM,OAAO,CAAA;
|
|
1
|
+
{"version":3,"file":"CustomFormsSettingsTab.d.ts","sourceRoot":"","sources":["../../src/views/CustomFormsSettingsTab.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAgC,MAAM,OAAO,CAAA;AAEpD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAA;AAClD,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,eAAe,CAAA;AAC5D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAA;AAGhD,UAAU,2BAA2B;IACnC,MAAM,EAAE,iBAAiB,CAAA;IACzB,QAAQ,EAAE,uBAAuB,CAAA;IACjC,KAAK,EAAE,gBAAgB,CAAA;CACxB;AAED,wBAAgB,sBAAsB,CAAC,EAAE,MAAM,EAAE,QAAQ,EAAE,KAAK,EAAE,EAAE,2BAA2B,qBA+C9F"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fayz-ai/plugin-forms",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "Fayz SDK — plugin-forms plugin",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.cjs",
|
|
@@ -23,14 +23,15 @@
|
|
|
23
23
|
"react-dom": "^18.0.0 || ^19.0.0"
|
|
24
24
|
},
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"lucide-react": "^0.400.0",
|
|
27
|
-
"zustand": "^4.5.0",
|
|
28
26
|
"@dnd-kit/core": "^6.3.1",
|
|
29
|
-
"@dnd-kit/sortable": "^10.0.0",
|
|
30
27
|
"@dnd-kit/modifiers": "^9.0.0",
|
|
28
|
+
"@dnd-kit/sortable": "^10.0.0",
|
|
31
29
|
"@dnd-kit/utilities": "^3.2.2",
|
|
32
|
-
"
|
|
33
|
-
"
|
|
30
|
+
"lucide-react": "^0.400.0",
|
|
31
|
+
"zustand": "^4.5.0",
|
|
32
|
+
"@fayz-ai/saas": "^0.6.6",
|
|
33
|
+
"@fayz-ai/ui": "^0.6.6",
|
|
34
|
+
"@fayz-ai/core": "^0.6.6"
|
|
34
35
|
},
|
|
35
36
|
"devDependencies": {
|
|
36
37
|
"@types/react": "^18.3.0",
|
|
@@ -45,9 +46,6 @@
|
|
|
45
46
|
"fayz-plugin",
|
|
46
47
|
"fayz-sdk"
|
|
47
48
|
],
|
|
48
|
-
"publishConfig": {
|
|
49
|
-
"access": "public"
|
|
50
|
-
},
|
|
51
49
|
"scripts": {
|
|
52
50
|
"build": "tsup && tsc --emitDeclarationOnly --declaration --declarationMap --noEmit false",
|
|
53
51
|
"dev": "tsup --watch",
|
package/src/config.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { PluginScope, VerticalId } from '@fayz-ai/core'
|
|
1
|
+
import type { PluginRegistryDef, PluginScope, VerticalId } from '@fayz-ai/core'
|
|
2
2
|
import type { CustomFormsDataProvider } from './data/types'
|
|
3
3
|
|
|
4
4
|
export interface CustomFormsPluginOptions {
|
|
@@ -8,11 +8,14 @@ export interface CustomFormsPluginOptions {
|
|
|
8
8
|
navSection?: 'main' | 'secondary' | 'settings'
|
|
9
9
|
navPosition?: number
|
|
10
10
|
labels?: Partial<CustomFormsLabels>
|
|
11
|
+
/** App-owned registries shown inside Forms & Documents settings. */
|
|
12
|
+
settingsRegistries?: PluginRegistryDef[]
|
|
11
13
|
}
|
|
12
14
|
|
|
13
15
|
export interface CustomFormsLabels {
|
|
14
16
|
pageTitle: string
|
|
15
17
|
settingsLabel: string
|
|
18
|
+
settingsSubtitle: string
|
|
16
19
|
templates: string
|
|
17
20
|
documents: string
|
|
18
21
|
newTemplate: string
|
|
@@ -26,6 +29,7 @@ export interface CustomFormsConfig {
|
|
|
26
29
|
const DEFAULT_LABELS: CustomFormsLabels = {
|
|
27
30
|
pageTitle: 'Custom Forms',
|
|
28
31
|
settingsLabel: 'Forms & Documents',
|
|
32
|
+
settingsSubtitle: 'Create and manage custom forms for your business',
|
|
29
33
|
templates: 'Templates',
|
|
30
34
|
documents: 'Documents',
|
|
31
35
|
newTemplate: 'New Template',
|
package/src/index.ts
CHANGED
|
@@ -4,6 +4,7 @@ import type { CustomFormsDataProvider } from './data/types'
|
|
|
4
4
|
import { createMockFormsProvider } from './data/mock'
|
|
5
5
|
import { createSupabaseFormsProvider } from './data/supabase'
|
|
6
6
|
import { createSafeDataProvider, registerTranslations } from '@fayz-ai/core'
|
|
7
|
+
import { PluginSettingsPanel } from '@fayz-ai/saas'
|
|
7
8
|
import { createCustomFormsStore } from './store'
|
|
8
9
|
import { customFormsLocales } from './locales'
|
|
9
10
|
import { resolveConfig } from './config'
|
|
@@ -97,9 +98,25 @@ export function createCustomFormsPlugin(options?: CustomFormsPluginOptions): Plu
|
|
|
97
98
|
},
|
|
98
99
|
]
|
|
99
100
|
|
|
101
|
+
const registries = [...formRegistries, ...(options?.settingsRegistries ?? [])]
|
|
102
|
+
|
|
100
103
|
const SettingsComponent: React.FC = () =>
|
|
101
|
-
React.createElement(
|
|
102
|
-
|
|
104
|
+
React.createElement(PluginSettingsPanel, {
|
|
105
|
+
title: config.labels.settingsLabel,
|
|
106
|
+
subtitle: config.labels.settingsSubtitle,
|
|
107
|
+
customTabs: [
|
|
108
|
+
{
|
|
109
|
+
id: 'forms',
|
|
110
|
+
label: config.labels.pageTitle,
|
|
111
|
+
icon: 'FileText',
|
|
112
|
+
content: React.createElement(CustomFormsSettingsTab, { config, provider, store }),
|
|
113
|
+
},
|
|
114
|
+
],
|
|
115
|
+
registries,
|
|
116
|
+
routeBase: '/settings/custom_forms',
|
|
117
|
+
hostPluginId: 'custom_forms',
|
|
118
|
+
})
|
|
119
|
+
SettingsComponent.displayName = 'CustomFormsSettingsPanel'
|
|
103
120
|
|
|
104
121
|
const PersonDocumentsWidget: React.FC<any> = (props: any) =>
|
|
105
122
|
React.createElement(PersonDocumentsWidgetImpl, { ...props, config, provider, store })
|
|
@@ -141,7 +158,7 @@ export function createCustomFormsPlugin(options?: CustomFormsPluginOptions): Plu
|
|
|
141
158
|
},
|
|
142
159
|
],
|
|
143
160
|
|
|
144
|
-
registries
|
|
161
|
+
registries,
|
|
145
162
|
|
|
146
163
|
aiTools: [
|
|
147
164
|
{
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import React, { useState, useCallback } from 'react'
|
|
2
2
|
import { TemplateListView } from './TemplateListView'
|
|
3
|
-
import { useTranslation } from '@fayz-ai/core'
|
|
4
|
-
import type { PluginRegistryDef } from '@fayz-ai/core'
|
|
5
3
|
import type { CustomFormsConfig } from '../config'
|
|
6
4
|
import type { CustomFormsDataProvider } from '../data/types'
|
|
7
5
|
import type { CustomFormsStore } from '../store'
|
|
@@ -11,11 +9,9 @@ interface CustomFormsSettingsTabProps {
|
|
|
11
9
|
config: CustomFormsConfig
|
|
12
10
|
provider: CustomFormsDataProvider
|
|
13
11
|
store: CustomFormsStore
|
|
14
|
-
registries?: PluginRegistryDef[]
|
|
15
12
|
}
|
|
16
13
|
|
|
17
|
-
export function CustomFormsSettingsTab({ config, provider, store
|
|
18
|
-
const t = useTranslation()
|
|
14
|
+
export function CustomFormsSettingsTab({ config, provider, store }: CustomFormsSettingsTabProps) {
|
|
19
15
|
const [builderTemplateId, setBuilderTemplateId] = useState<string | null>(null)
|
|
20
16
|
|
|
21
17
|
const handleNew = useCallback(() => {
|
|
@@ -46,8 +42,7 @@ export function CustomFormsSettingsTab({ config, provider, store, registries }:
|
|
|
46
42
|
checkHash()
|
|
47
43
|
}, [])
|
|
48
44
|
|
|
49
|
-
|
|
50
|
-
const templatesContent = builderTemplateId ? (
|
|
45
|
+
return builderTemplateId ? (
|
|
51
46
|
<BuilderWrapper
|
|
52
47
|
templateId={builderTemplateId === '__new__' ? undefined : builderTemplateId}
|
|
53
48
|
store={store}
|
|
@@ -63,18 +58,6 @@ export function CustomFormsSettingsTab({ config, provider, store, registries }:
|
|
|
63
58
|
onNew={handleNew}
|
|
64
59
|
/>
|
|
65
60
|
)
|
|
66
|
-
|
|
67
|
-
return (
|
|
68
|
-
<div style={{ padding: '24px' }}>
|
|
69
|
-
<div style={{ marginBottom: '16px' }}>
|
|
70
|
-
<h1 style={{ fontSize: '20px', fontWeight: 600, margin: 0 }}>{t('customForms.settingsTitle')}</h1>
|
|
71
|
-
<p style={{ color: 'var(--muted-foreground, #6b7280)', margin: '4px 0 0', fontSize: '14px' }}>
|
|
72
|
-
{t('customForms.settingsSubtitle')}
|
|
73
|
-
</p>
|
|
74
|
-
</div>
|
|
75
|
-
{templatesContent}
|
|
76
|
-
</div>
|
|
77
|
-
)
|
|
78
61
|
}
|
|
79
62
|
|
|
80
63
|
/** Lazy-loads the FormBuilder to avoid pulling @dnd-kit into the initial bundle */
|