@fayz-ai/plugin-forms 0.1.5 → 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
package/dist/config.d.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
|
export interface CustomFormsPluginOptions {
|
|
4
4
|
scope?: PluginScope;
|
|
@@ -7,10 +7,13 @@ export interface CustomFormsPluginOptions {
|
|
|
7
7
|
navSection?: 'main' | 'secondary' | 'settings';
|
|
8
8
|
navPosition?: number;
|
|
9
9
|
labels?: Partial<CustomFormsLabels>;
|
|
10
|
+
/** App-owned registries shown inside Forms & Documents settings. */
|
|
11
|
+
settingsRegistries?: PluginRegistryDef[];
|
|
10
12
|
}
|
|
11
13
|
export interface CustomFormsLabels {
|
|
12
14
|
pageTitle: string;
|
|
13
15
|
settingsLabel: string;
|
|
16
|
+
settingsSubtitle: string;
|
|
14
17
|
templates: string;
|
|
15
18
|
documents: string;
|
|
16
19
|
newTemplate: string;
|
package/dist/config.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA;
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA;AAC/E,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,cAAc,CAAA;AAE3D,MAAM,WAAW,wBAAwB;IACvC,KAAK,CAAC,EAAE,WAAW,CAAA;IACnB,UAAU,CAAC,EAAE,UAAU,CAAA;IACvB,YAAY,CAAC,EAAE,uBAAuB,CAAA;IACtC,UAAU,CAAC,EAAE,MAAM,GAAG,WAAW,GAAG,UAAU,CAAA;IAC9C,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,MAAM,CAAC,EAAE,OAAO,CAAC,iBAAiB,CAAC,CAAA;IACnC,oEAAoE;IACpE,kBAAkB,CAAC,EAAE,iBAAiB,EAAE,CAAA;CACzC;AAED,MAAM,WAAW,iBAAiB;IAChC,SAAS,EAAE,MAAM,CAAA;IACjB,aAAa,EAAE,MAAM,CAAA;IACrB,gBAAgB,EAAE,MAAM,CAAA;IACxB,SAAS,EAAE,MAAM,CAAA;IACjB,SAAS,EAAE,MAAM,CAAA;IACjB,WAAW,EAAE,MAAM,CAAA;IACnB,WAAW,EAAE,MAAM,CAAA;CACpB;AAED,MAAM,WAAW,iBAAiB;IAChC,MAAM,EAAE,iBAAiB,CAAA;CAC1B;AAYD,wBAAgB,aAAa,CAAC,OAAO,CAAC,EAAE,wBAAwB,GAAG,iBAAiB,CAInF"}
|
package/dist/index.cjs
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
var chunkXLUULIVL_cjs = require('./chunk-XLUULIVL.cjs');
|
|
4
4
|
var React2 = require('react');
|
|
5
5
|
var core = require('@fayz-ai/core');
|
|
6
|
+
var saas = require('@fayz-ai/saas');
|
|
6
7
|
var zustand = require('zustand');
|
|
7
8
|
var lucideReact = require('lucide-react');
|
|
8
9
|
var ui = require('@fayz-ai/ui');
|
|
@@ -700,6 +701,7 @@ var customFormsLocales = {
|
|
|
700
701
|
var DEFAULT_LABELS = {
|
|
701
702
|
pageTitle: "Custom Forms",
|
|
702
703
|
settingsLabel: "Forms & Documents",
|
|
704
|
+
settingsSubtitle: "Create and manage custom forms for your business",
|
|
703
705
|
templates: "Templates",
|
|
704
706
|
documents: "Documents",
|
|
705
707
|
newTemplate: "New Template",
|
|
@@ -821,8 +823,7 @@ function TemplateListView({ store, config, onEdit, onNew }) {
|
|
|
821
823
|
] }) }, i)) })
|
|
822
824
|
] });
|
|
823
825
|
}
|
|
824
|
-
function CustomFormsSettingsTab({ config, provider, store
|
|
825
|
-
const t = core.useTranslation();
|
|
826
|
+
function CustomFormsSettingsTab({ config, provider, store }) {
|
|
826
827
|
const [builderTemplateId, setBuilderTemplateId] = React2.useState(null);
|
|
827
828
|
const handleNew = React2.useCallback(() => {
|
|
828
829
|
setBuilderTemplateId("__new__");
|
|
@@ -846,7 +847,7 @@ function CustomFormsSettingsTab({ config, provider, store, registries }) {
|
|
|
846
847
|
}
|
|
847
848
|
checkHash();
|
|
848
849
|
}, []);
|
|
849
|
-
|
|
850
|
+
return builderTemplateId ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
850
851
|
BuilderWrapper,
|
|
851
852
|
{
|
|
852
853
|
templateId: builderTemplateId === "__new__" ? void 0 : builderTemplateId,
|
|
@@ -864,13 +865,6 @@ function CustomFormsSettingsTab({ config, provider, store, registries }) {
|
|
|
864
865
|
onNew: handleNew
|
|
865
866
|
}
|
|
866
867
|
);
|
|
867
|
-
return /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { padding: "24px" }, children: [
|
|
868
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { style: { marginBottom: "16px" }, children: [
|
|
869
|
-
/* @__PURE__ */ jsxRuntime.jsx("h1", { style: { fontSize: "20px", fontWeight: 600, margin: 0 }, children: t("customForms.settingsTitle") }),
|
|
870
|
-
/* @__PURE__ */ jsxRuntime.jsx("p", { style: { color: "var(--muted-foreground, #6b7280)", margin: "4px 0 0", fontSize: "14px" }, children: t("customForms.settingsSubtitle") })
|
|
871
|
-
] }),
|
|
872
|
-
templatesContent
|
|
873
|
-
] });
|
|
874
868
|
}
|
|
875
869
|
function BuilderWrapper({
|
|
876
870
|
templateId,
|
|
@@ -1520,8 +1514,23 @@ function createCustomFormsPlugin(options) {
|
|
|
1520
1514
|
]
|
|
1521
1515
|
}
|
|
1522
1516
|
];
|
|
1523
|
-
const
|
|
1524
|
-
SettingsComponent
|
|
1517
|
+
const registries = [...formRegistries, ...options?.settingsRegistries ?? []];
|
|
1518
|
+
const SettingsComponent = () => React2__default.default.createElement(saas.PluginSettingsPanel, {
|
|
1519
|
+
title: config.labels.settingsLabel,
|
|
1520
|
+
subtitle: config.labels.settingsSubtitle,
|
|
1521
|
+
customTabs: [
|
|
1522
|
+
{
|
|
1523
|
+
id: "forms",
|
|
1524
|
+
label: config.labels.pageTitle,
|
|
1525
|
+
icon: "FileText",
|
|
1526
|
+
content: React2__default.default.createElement(CustomFormsSettingsTab, { config, provider, store })
|
|
1527
|
+
}
|
|
1528
|
+
],
|
|
1529
|
+
registries,
|
|
1530
|
+
routeBase: "/settings/custom_forms",
|
|
1531
|
+
hostPluginId: "custom_forms"
|
|
1532
|
+
});
|
|
1533
|
+
SettingsComponent.displayName = "CustomFormsSettingsPanel";
|
|
1525
1534
|
const PersonDocumentsWidget2 = (props) => React2__default.default.createElement(PersonDocumentsWidget, { ...props, config, provider, store });
|
|
1526
1535
|
PersonDocumentsWidget2.displayName = "PersonDocumentsWidget";
|
|
1527
1536
|
return {
|
|
@@ -1555,7 +1564,7 @@ function createCustomFormsPlugin(options) {
|
|
|
1555
1564
|
order: 0
|
|
1556
1565
|
}
|
|
1557
1566
|
],
|
|
1558
|
-
registries
|
|
1567
|
+
registries,
|
|
1559
1568
|
aiTools: [
|
|
1560
1569
|
{
|
|
1561
1570
|
id: "custom_forms.list-templates",
|