@prenta/plugin-forms 0.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 (44) hide show
  1. package/CHANGELOG.md +246 -0
  2. package/LICENSE +21 -0
  3. package/README.md +32 -0
  4. package/dist/__tests__/hooks-default-email.test.d.ts +2 -0
  5. package/dist/__tests__/hooks-default-email.test.d.ts.map +1 -0
  6. package/dist/__tests__/hooks-default-email.test.js +52 -0
  7. package/dist/__tests__/hooks-default-email.test.js.map +1 -0
  8. package/dist/__tests__/hooks.test.d.ts +2 -0
  9. package/dist/__tests__/hooks.test.d.ts.map +1 -0
  10. package/dist/__tests__/hooks.test.js +65 -0
  11. package/dist/__tests__/hooks.test.js.map +1 -0
  12. package/dist/__tests__/index.test.d.ts +2 -0
  13. package/dist/__tests__/index.test.d.ts.map +1 -0
  14. package/dist/__tests__/index.test.js +31 -0
  15. package/dist/__tests__/index.test.js.map +1 -0
  16. package/dist/admin/FormBuilder.d.ts +8 -0
  17. package/dist/admin/FormBuilder.d.ts.map +1 -0
  18. package/dist/admin/FormBuilder.js +106 -0
  19. package/dist/admin/FormBuilder.js.map +1 -0
  20. package/dist/admin/SubmissionDetail.d.ts +13 -0
  21. package/dist/admin/SubmissionDetail.d.ts.map +1 -0
  22. package/dist/admin/SubmissionDetail.js +32 -0
  23. package/dist/admin/SubmissionDetail.js.map +1 -0
  24. package/dist/admin/SubmissionList.d.ts +15 -0
  25. package/dist/admin/SubmissionList.d.ts.map +1 -0
  26. package/dist/admin/SubmissionList.js +28 -0
  27. package/dist/admin/SubmissionList.js.map +1 -0
  28. package/dist/collections.d.ts +3 -0
  29. package/dist/collections.d.ts.map +1 -0
  30. package/dist/collections.js +153 -0
  31. package/dist/collections.js.map +1 -0
  32. package/dist/fields.d.ts +3 -0
  33. package/dist/fields.d.ts.map +1 -0
  34. package/dist/fields.js +2 -0
  35. package/dist/fields.js.map +1 -0
  36. package/dist/hooks.d.ts +15 -0
  37. package/dist/hooks.d.ts.map +1 -0
  38. package/dist/hooks.js +56 -0
  39. package/dist/hooks.js.map +1 -0
  40. package/dist/index.d.ts +14 -0
  41. package/dist/index.d.ts.map +1 -0
  42. package/dist/index.js +23 -0
  43. package/dist/index.js.map +1 -0
  44. package/package.json +47 -0
package/CHANGELOG.md ADDED
@@ -0,0 +1,246 @@
1
+ # @actuate-media/plugin-forms
2
+
3
+ ## 0.1.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 5eea995: Product rename: ActuateCMS is now **Prenta**. Every package moves from the
8
+ `@actuate-media/*` scope to `@prenta/*` with simplified names (`@prenta/core`,
9
+ `@prenta/admin`, `create-prenta`), and version numbers continue from where the
10
+ old scope left off.
11
+
12
+ This is a clean break — no backwards-compat aliases:
13
+ - **npm packages**: `@actuate-media/cms-core` → `@prenta/core`,
14
+ `@actuate-media/cms-admin` → `@prenta/admin`, all other packages keep their
15
+ suffix under `@prenta/*`. `create-actuate-cms` → `create-prenta`
16
+ (`npm create prenta`), `create-actuate-astro` → `create-prenta-astro`.
17
+ CLI bins: `actuate`/`actuate-cms` → `prenta`/`prenta-cms`; `actuate-mcp` →
18
+ `prenta-mcp`.
19
+ - **Database**: migration `0012_rename_to_prenta` renames all 36 `actuate_*`
20
+ tables to `prenta_*` in place (plus prefixed constraints, indexes, and
21
+ sequences). Run `prisma migrate deploy` when upgrading.
22
+ - **Runtime identifiers**: `getActuateConfig` → `getPrentaConfig`,
23
+ `handleActuateAPI` → `handlePrentaAPI`, `ActuateClient` → `PrentaClient`,
24
+ `ActuateDB` → `PrentaDB`, config file `actuate.config.ts` →
25
+ `prenta.config.ts`, CSS scopes `.actuate-admin`/`.actuate-canvas` →
26
+ `.prenta-admin`/`.prenta-canvas`, preview protocol `actuate-preview:*` →
27
+ `prenta-preview:*`, webhook headers `X-Actuate-*` → `X-Prenta-*`, session
28
+ cookie `actuate_session` → `prenta_session`, env vars `ACTUATE_*` →
29
+ `PRENTA_*`, purge route `/api/actuate/purge` → `/api/prenta/purge`.
30
+ - **Sessions and webhooks**: all sessions reset on upgrade (cookie + JWT issuer
31
+ changed); webhook consumers must re-verify signatures against the new
32
+ `X-Prenta-*` headers.
33
+
34
+ The old `@actuate-media/*` packages are deprecated on npm and will receive no
35
+ further releases.
36
+
37
+ ## 0.0.18
38
+
39
+ ### Patch Changes
40
+
41
+ - cc6ad93: Form notification defaults and shortcode glossary: Reply-To defaults to submitter email, subject includes site name, emails include attribution, Vercel adapter preserves replyTo, and the admin Notifications panel ships a copy-paste shortcode glossary plus Send test.
42
+
43
+ ## 0.0.17
44
+
45
+ ### Patch Changes
46
+
47
+ - 21aa417: Consolidate the two form-editing surfaces onto the typed Forms API and make GA4 form analytics work end-to-end.
48
+
49
+ **cms-admin** — The Edit Form page is rebuilt as the canonical full-page form editor, backed by the same typed Forms API as the Forms list's inline Schema pane (no more legacy `/collections/forms` writes that bypassed schema versioning). It now covers everything in one place: Details (name/description/status + post-submit confirmation), Fields (versioned schema editor), **Notifications** (previously only reachable from the Schema pane), Analytics (GA4), Embed, and Integrations (webhooks). Confirmation settings now persist to `successMessage` / `redirectUrl` — the fields the public submission pipeline actually reads (the old editor wrote a `confirmation` object the runtime ignored). New forms are created through `POST /forms`, gaining slug generation, an initial schema version, and notification defaults, then route into the full editor.
50
+
51
+ **cms-core** — `FormDefinition` gains a sanitized `analytics` (GA4) config, persisted via the forms service (`createForm` / `updateForm` / `duplicateForm`) and exposed on the public form schema only when tracking is enabled. New `normalizeAnalyticsConfig` export and a client-safe `@actuate-media/cms-core/forms/analytics` subpath export.
52
+
53
+ **sections-react** — `<ActuateForm>` now fires GA4 `form_start` / `form_submit` / `form_error` events (with optional conversion value) when the form has analytics enabled. Also fixes the success state to read the submit endpoint's `confirmation` _object_ (`{ type, message, redirectUrl }`) — previously it was treated as a string, which broke the success message and ignored server-driven redirects. New `resolveSubmitOutcome` helper with regression coverage.
54
+
55
+ **plugin-forms** — The `forms` collection field map now declares every key the typed forms service persists (`description`, `notificationSettings`, `embedSettings`, `spamSettings`, `successMessage`, `redirectUrl`, `analytics`, `activeSchemaVersionId`, …). The data layer strips undeclared keys on write, so consumer apps registering this plugin would previously drop notification/embed/spam settings silently. Status options now match the typed `FormStatus` (`active` / `draft` / `archived`).
56
+
57
+ ## 0.0.16
58
+
59
+ ### Patch Changes
60
+
61
+ - e25cd48: Standardize React peer ranges to `^18.0.0 || ^19.0.0`.
62
+
63
+ Plugin React peer ranges were inconsistent: `plugin-ai`, `plugin-commerce`, and
64
+ `plugin-seo` pinned `react: ^19.2.0` (excluding React 18, which `cms-core`
65
+ supports via `react >=18.0.0`), while the others used `^18.0.0 || ^19.2.0`
66
+ (excluding React 19.0/19.1). Either produced an `ERESOLVE` install failure for
67
+ consumers on the excluded versions. All bundled plugins now declare `react`
68
+ (and `react-dom` where already peered) as `^18.0.0 || ^19.0.0`.
69
+
70
+ ## 0.0.15
71
+
72
+ ### Patch Changes
73
+
74
+ - e86e3f8: Remove the dead "Submissions" and "Redirects" sidebar links.
75
+
76
+ Both pointed at routes the admin doesn't have — clicking them 404'd — and both
77
+ features are already reachable elsewhere: submissions via Forms → All Entries,
78
+ redirects via the SEO Operations Center's Redirects tab (the standalone
79
+ Redirects view is deprecated).
80
+ - plugin-forms: drop the `Submissions` nav item; mark the `form-submissions`
81
+ collection `admin.hidden` so it doesn't resurface as grouped collection nav.
82
+ - plugin-redirects: drop the `Redirects` nav item; mark the `redirects`
83
+ collection `admin.hidden` likewise.
84
+
85
+ Net: the sidebar Content section is Pages · Posts · Templates · Media · Forms ·
86
+ SEO · Script Tags — no dead links, no stray "Forms"/"SEO" collection groups.
87
+
88
+ ## 0.0.14
89
+
90
+ ### Patch Changes
91
+
92
+ - c231dd0: Add `definePlugin` and migrate all 10 plugins onto the canonical `PluginDefinition` contract.
93
+
94
+ cms-core already exported `PluginDefinition`, but every plugin hand-rolled a
95
+ local `ActuatePlugin` interface — a lossy subset that dropped `version`/`init`
96
+ and, in blocks/email/ai, widened hook payloads to `unknown[]`/`event: string`.
97
+ That's copy-paste drift with no shared source of truth.
98
+
99
+ `cms-core` now exports `definePlugin(plugin: PluginDefinition)` (an identity
100
+ helper like `defineConfig`), and each plugin imports the canonical type instead
101
+ of its own: the local `ActuatePlugin` interfaces are deleted, factory return
102
+ types are `PluginDefinition`, and the widened `hooks.ts` types are retyped as
103
+ `PluginHook[]`. Type-only change — no runtime behavior, plugin `name`, or config
104
+ options changed. Net −69 lines.
105
+
106
+ - 325694f: Import `definePlugin` from the lightweight `@actuate-media/cms-core/config`
107
+ entry instead of the barrel.
108
+
109
+ The plugin-definition migration imported the `definePlugin` **value** from
110
+ `@actuate-media/cms-core`, which pulls the entire cms-core barrel (graphql,
111
+ sharp, sentry, codegen) into every plugin's runtime — bundle bloat for
112
+ consumers and, under parallel test load, a timeout. The `/config` subpath exists
113
+ precisely to avoid the barrel. Types stay as erased `import type`, so nothing
114
+ heavy is loaded. No API or behavior change.
115
+
116
+ ## 0.0.13
117
+
118
+ ### Patch Changes
119
+
120
+ - 041a228: Add the MIT `license` field to every published package (previously missing) and correct `repository.url` to `github.com/actuate-media/actuatecms` (13 packages carried the wrong org).
121
+ - de419f2: Give plugin hooks a frozen, typed event contract. cms-core now exports
122
+ `PluginHook`, `PluginHookEvent`, and `PluginHookPayload` (document + upload
123
+ variants) as the single source of truth, and dispatches a complete, consistent
124
+ set of events: `afterCreate` / `afterUpdate` / `afterDelete` — each also in a
125
+ collection-namespaced form (`afterUpdate:navigations`, `afterCreate:orders`) —
126
+ plus `afterUpload` (fired post-upload from the media route). Every handler now
127
+ receives one typed payload; document field values live on `payload.data`.
128
+
129
+ Previously core fired only bare `afterCreate`/`afterUpdate` with the raw row, so
130
+ several shipped plugins' hooks were dead: `plugin-media`'s `afterUpload` never
131
+ fired, `plugin-navigation` read fields that didn't exist, and the namespaced
132
+ events `plugin-forms`/`plugin-commerce` declared were never dispatched. Each
133
+ plugin has been aligned to the shared type and dispatched events (and
134
+ `plugin-redirects`' request-time `onRedirectMatch` hook — which the lifecycle
135
+ bus never dispatched — was removed). Undispatched event names are now a
136
+ compile-time error.
137
+
138
+ ## 0.0.12
139
+
140
+ ### Patch Changes
141
+
142
+ - 854152d: Developer experience improvements from external-consumer feedback:
143
+ - Every published package now ships its `CHANGELOG.md` in the npm tarball, and packages that were missing a `README.md` (cli, cms-admin, cms-core, import, platform-vercel, all plugins, sections-react) now have one — so release notes and usage docs are visible on npmjs.com and in `node_modules`.
144
+ - New client-safe form validation entry point: `@actuate-media/cms-core/forms/client` exports `validateFormFieldClient()`, `validateFormValuesClient()`, visibility/conditional helpers, and the exact `FORM_EMAIL_RE` / `FORM_PHONE_RE` regexes the server enforces — zero Node dependencies, so public-site forms can mirror server rules without reimplementing them. The server validator now imports the same primitives, so client and server can never drift.
145
+
146
+ ## 0.0.11
147
+
148
+ ### Patch Changes
149
+
150
+ - b5de8dd: Fix ESM module resolution and dependency duplication issues reported during consumer integration.
151
+ - Add "default" export condition to all platform and plugin packages so they resolve correctly from require() contexts (fixes ERR_PACKAGE_PATH_NOT_EXPORTED in next.config.ts and serverless functions).
152
+ - Move @actuate-media/cms-core from direct dependencies to peerDependencies across all packages to prevent duplicate installations when consumer version ranges don't exactly match the pinned version.
153
+ - Add "prepack" lifecycle script to create-actuate-cms to guarantee dist/ is built before npm publishes the package (fixes empty dist/ in v0.4.0).
154
+
155
+ ## 0.0.10
156
+
157
+ ### Patch Changes
158
+
159
+ - Updated dependencies [54c7a3b]
160
+ - @actuate-media/cms-core@0.6.0
161
+
162
+ ## 0.0.9
163
+
164
+ ### Patch Changes
165
+
166
+ - Updated dependencies [c08cf8b]
167
+ - Updated dependencies [80aa939]
168
+ - @actuate-media/cms-core@0.5.0
169
+
170
+ ## 0.0.8
171
+
172
+ ### Patch Changes
173
+
174
+ - Updated dependencies [f2cf7d7]
175
+ - @actuate-media/cms-core@0.4.0
176
+
177
+ ## 0.0.7
178
+
179
+ ### Patch Changes
180
+
181
+ - Updated dependencies [0621037]
182
+ - @actuate-media/cms-core@0.3.1
183
+
184
+ ## 0.0.6
185
+
186
+ ### Patch Changes
187
+
188
+ - Updated dependencies [4e3a5eb]
189
+ - @actuate-media/cms-core@0.3.0
190
+
191
+ ## 0.0.5
192
+
193
+ ### Patch Changes
194
+
195
+ - Updated dependencies
196
+ - @actuate-media/cms-core@0.2.3
197
+
198
+ ## 0.0.4
199
+
200
+ ### Patch Changes
201
+
202
+ - Updated dependencies
203
+ - @actuate-media/cms-core@0.2.2
204
+
205
+ ## 0.0.3
206
+
207
+ ### Patch Changes
208
+
209
+ - Updated dependencies
210
+ - @actuate-media/cms-core@0.2.1
211
+
212
+ ## 0.0.2
213
+
214
+ ### Patch Changes
215
+
216
+ - 3fd38a2: Fix all 13 integration issues discovered during MaidPro.co deployment
217
+
218
+ **cms-core:**
219
+ - Add .js extensions to all ESM relative imports (58 files)
220
+ - Replace workspace:\* with versioned deps in all packages
221
+ - Add sideEffects:false for proper tree-shaking
222
+ - Subpath exports (/config, /api, /middleware, /next) avoid barrel side effects
223
+ - Stats/search routes use safeCount/safeFindMany for missing Prisma models
224
+ - Ship prisma/cms-schema.prisma with all required CMS models
225
+ - Accept both CMS_SECRET and CMS_SESSION_SECRET with clear error messages
226
+ - Fix hardcoded /admin paths in OAuth flow (now uses getAdminPath())
227
+ - Loosen withActuateCMS and createCMSMiddleware parameter types
228
+ - Auto-inject transpilePackages and serverExternalPackages in withActuateCMS
229
+ - Unify PluginDefinition with ActuatePlugin interface
230
+
231
+ **cms-admin:**
232
+ - Scope all 40+ CSS theme variables to .actuate-admin instead of :root
233
+ - ThemeProvider applies dark class to .actuate-admin, not document.documentElement
234
+ - Scaffold uses (admin)/(site) route groups for full CSS/script isolation
235
+ - Sidebar branding supports custom logo via config.admin.branding
236
+
237
+ **platform-vercel:**
238
+ - Email adapter accepts both `from` and `defaultFrom`
239
+
240
+ **All plugin/platform packages:**
241
+ - Fix ESM .js extensions in compiled output
242
+ - Replace workspace:\* with ^0.1.0 for publishable deps
243
+
244
+ - Updated dependencies [682dac7]
245
+ - Updated dependencies [3fd38a2]
246
+ - @actuate-media/cms-core@0.2.0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Actuate Media
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,32 @@
1
+ # @prenta/plugin-forms
2
+
3
+ Forms for [Prenta CMS](https://github.com/actuate-media/prenta) —
4
+ schema-versioned form definitions, public submission API, spam protection,
5
+ submissions inbox, notifications, and webhooks.
6
+
7
+ ```bash
8
+ npm install @prenta/plugin-forms
9
+ ```
10
+
11
+ ## Usage
12
+
13
+ ```ts
14
+ import { formsPlugin } from '@prenta/plugin-forms'
15
+
16
+ export default defineConfig({
17
+ plugins: [formsPlugin()],
18
+ // ...
19
+ })
20
+ ```
21
+
22
+ For client-side validation that mirrors the server's rules, see
23
+ `@prenta/core/forms/client`.
24
+
25
+ ## Release notes
26
+
27
+ See [CHANGELOG.md](./CHANGELOG.md) (shipped with the package) or the
28
+ [GitHub releases](https://github.com/actuate-media/prenta/releases).
29
+
30
+ ## License
31
+
32
+ MIT
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=hooks-default-email.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hooks-default-email.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/hooks-default-email.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,52 @@
1
+ import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest';
2
+ /**
3
+ * Confirms the hook no longer depends on the optional plugin-email peer —
4
+ * webhook dispatch still works when that package is absent.
5
+ */
6
+ const hb = vi.hoisted(() => ({
7
+ dispatchWebhook: vi.fn(async (_event, _payload) => { }),
8
+ }));
9
+ vi.mock('@prenta/core', () => ({
10
+ dispatchWebhook: hb.dispatchWebhook,
11
+ }));
12
+ import { formsHooks } from '../hooks.js';
13
+ import { formsCollections } from '../collections.js';
14
+ function docPayload(overrides = {}) {
15
+ return {
16
+ id: 'sub_1',
17
+ collection: 'form-submissions',
18
+ slug: 'form-submissions',
19
+ status: 'published',
20
+ data: { formId: 'f1', data: {} },
21
+ ...overrides,
22
+ };
23
+ }
24
+ function submissionPayload(formId, submissionData = {}) {
25
+ return docPayload({ data: { formId, data: submissionData } });
26
+ }
27
+ beforeEach(() => {
28
+ vi.clearAllMocks();
29
+ hb.dispatchWebhook.mockResolvedValue(undefined);
30
+ });
31
+ afterEach(() => {
32
+ vi.restoreAllMocks();
33
+ });
34
+ describe('formsHooks without plugin-email', () => {
35
+ it('event equals afterCreate:<formSubmissions slug>', () => {
36
+ expect(formsHooks[0].event).toBe(`afterCreate:${formsCollections.formSubmissions.slug}`);
37
+ });
38
+ it('dispatches the webhook without importing plugin-email', async () => {
39
+ const result = await formsHooks[0].handler(submissionPayload('f1', { a: 1 }));
40
+ expect(result).toBeUndefined();
41
+ expect(hb.dispatchWebhook).toHaveBeenCalledTimes(1);
42
+ expect(hb.dispatchWebhook).toHaveBeenCalledWith('form.submitted', {
43
+ formId: 'f1',
44
+ data: { a: 1 },
45
+ });
46
+ });
47
+ it('is a no-op when payload.data is null', async () => {
48
+ await expect(formsHooks[0].handler(docPayload({ data: null }))).resolves.toBeUndefined();
49
+ expect(hb.dispatchWebhook).not.toHaveBeenCalled();
50
+ });
51
+ });
52
+ //# sourceMappingURL=hooks-default-email.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hooks-default-email.test.js","sourceRoot":"","sources":["../../src/__tests__/hooks-default-email.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAA;AAGxE;;;GAGG;AACH,MAAM,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC;IAC3B,eAAe,EAAE,EAAE,CAAC,EAAE,CAAC,KAAK,EAAE,MAAc,EAAE,QAAiB,EAAiB,EAAE,GAAE,CAAC,CAAC;CACvF,CAAC,CAAC,CAAA;AAEH,EAAE,CAAC,IAAI,CAAC,cAAc,EAAE,GAAG,EAAE,CAAC,CAAC;IAC7B,eAAe,EAAE,EAAE,CAAC,eAAe;CACpC,CAAC,CAAC,CAAA;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AACxC,OAAO,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAA;AAEpD,SAAS,UAAU,CAAC,YAAgD,EAAE;IACpE,OAAO;QACL,EAAE,EAAE,OAAO;QACX,UAAU,EAAE,kBAAkB;QAC9B,IAAI,EAAE,kBAAkB;QACxB,MAAM,EAAE,WAAW;QACnB,IAAI,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,EAAE,EAAE;QAChC,GAAG,SAAS;KACb,CAAA;AACH,CAAC;AAED,SAAS,iBAAiB,CACxB,MAAc,EACd,iBAA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AC,CAAE,CAAC,OAAO,CAAC,UAAU,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,aAAa,EAAE,CAAA;QACzF,MAAM,CAAC,EAAE,CAAC,eAAe,CAAC,CAAC,GAAG,CAAC,gBAAgB,EAAE,CAAA;IACnD,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=hooks.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hooks.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/hooks.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,65 @@
1
+ import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest';
2
+ /**
3
+ * Email notifications are owned by cms-core `sendFormNotifications`. This hook
4
+ * only dispatches the legacy global `form.submitted` webhook.
5
+ */
6
+ const h = vi.hoisted(() => ({
7
+ dispatchWebhook: vi.fn(async (_event, _payload) => { }),
8
+ }));
9
+ vi.mock('@prenta/core', () => ({
10
+ dispatchWebhook: h.dispatchWebhook,
11
+ }));
12
+ import { formsHooks } from '../hooks.js';
13
+ import { formsCollections } from '../collections.js';
14
+ function docPayload(overrides = {}) {
15
+ return {
16
+ id: 'sub_1',
17
+ collection: 'form-submissions',
18
+ slug: 'form-submissions',
19
+ status: 'published',
20
+ data: { formId: 'f1', data: {} },
21
+ ...overrides,
22
+ };
23
+ }
24
+ function submissionPayload(formId, submissionData = {}) {
25
+ return docPayload({ data: { formId, data: submissionData } });
26
+ }
27
+ beforeEach(() => {
28
+ vi.clearAllMocks();
29
+ h.dispatchWebhook.mockResolvedValue(undefined);
30
+ });
31
+ afterEach(() => {
32
+ vi.restoreAllMocks();
33
+ });
34
+ describe('formsHooks afterCreate:form-submissions', () => {
35
+ it('registers for afterCreate:<formSubmissions.slug> so the two cannot drift', () => {
36
+ expect(formsHooks[0].event).toBe(`afterCreate:${formsCollections.formSubmissions.slug}`);
37
+ });
38
+ it('dispatches form.submitted for legacy document payloads', async () => {
39
+ const data = { email: 'a@b.com', msg: 'hi' };
40
+ await formsHooks[0].handler(submissionPayload('f1', data));
41
+ expect(h.dispatchWebhook).toHaveBeenCalledTimes(1);
42
+ expect(h.dispatchWebhook).toHaveBeenCalledWith('form.submitted', { formId: 'f1', data });
43
+ });
44
+ it('dispatches form.submitted for modern { formId, data } side-effect payloads', async () => {
45
+ const data = { name: 'Ada' };
46
+ await formsHooks[0].handler({ formId: 'f1', data });
47
+ expect(h.dispatchWebhook).toHaveBeenCalledWith('form.submitted', { formId: 'f1', data });
48
+ });
49
+ it('no-ops when payload.data is null/undefined', async () => {
50
+ await expect(formsHooks[0].handler(docPayload({ data: null }))).resolves.toBeUndefined();
51
+ await expect(formsHooks[0].handler(docPayload({ data: undefined }))).resolves.toBeUndefined();
52
+ expect(h.dispatchWebhook).not.toHaveBeenCalled();
53
+ });
54
+ it('swallows a synchronously throwing dispatchWebhook without rejecting', async () => {
55
+ h.dispatchWebhook.mockImplementation(() => {
56
+ throw new Error('sync boom');
57
+ });
58
+ await expect(formsHooks[0].handler(submissionPayload('f1', { a: 1 }))).resolves.toBeUndefined();
59
+ });
60
+ it('swallows a rejecting dispatchWebhook without rejecting', async () => {
61
+ h.dispatchWebhook.mockRejectedValue(new Error('async boom'));
62
+ await expect(formsHooks[0].handler(submissionPayload('f1', { a: 1 }))).resolves.toBeUndefined();
63
+ });
64
+ });
65
+ //# sourceMappingURL=hooks.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hooks.test.js","sourceRoot":"","sources":["../../src/__tests__/hooks.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAA;AAGxE;;;GAGG;AACH,MAAM,CAAC,GAAG,EAAE,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC;IAC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AAC,CAC3E,CAAC,QAAQ,CAAC,aAAa,EAAE,CAAA;QAE1B,MAAM,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC,GAAG,CAAC,gBAAgB,EAAE,CAAA;IAClD,CAAC,CAAC,CAAA;IAEF,EAAE,CAAC,qEAAqE,EAAE,KAAK,IAAI,EAAE;QACnF,CAAC,CAAC,eAAe,CAAC,kBAAkB,CAAC,GAAG,EAAE;YACxC,MAAM,IAAI,KAAK,CAAC,WAAW,CAAC,CAAA;QAC9B,CAAC,CAAC,CAAA;QAEF,MAAM,MAAM,CAAC,UAAU,CAAC,CAAC,CAAE,CAAC,OAAO,CAAC,iBAAiB,CAAC,IAAI,EAAE,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,aAAa,EAAE,CAAA;IAClG,CAAC,CAAC,CAAA;IAEF,EAAE,CAAC,wDAAwD,EAAE,KAAK,IAAI,EAAE;QACtE,CAAC,CAAC,eAAe,CAAC,iBAAiB,CAAC,IAAI,KAAK,CAAC,YAAY,CAAC,CAAC,CAAA;QAE5D,MAAM,MAAM,CAAC,UAAU,CAAC,CAAC,CAAE,CAAC,OAAO,CAAC,iBAAiB,CAAC,IAAI,EAAE,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,aAAa,EAAE,CAAA;IAClG,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=index.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/index.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,31 @@
1
+ import { describe, it, expect } from 'vitest';
2
+ import { formsPlugin } from '../index.js';
3
+ import { formsHooks } from '../hooks.js';
4
+ describe('plugin-forms', () => {
5
+ describe('structure', () => {
6
+ it('returns name plugin-forms', () => {
7
+ expect(formsPlugin().name).toBe('plugin-forms');
8
+ });
9
+ it('exposes fields, collections, and admin nav', () => {
10
+ const plugin = formsPlugin();
11
+ expect(plugin.fields).toBeDefined();
12
+ expect(typeof plugin.fields).toBe('object');
13
+ expect(plugin.collections).toBeDefined();
14
+ expect(Object.keys(plugin.collections ?? {}).length).toBeGreaterThan(0);
15
+ // Just "Forms" — submissions are Forms → All Entries, not a separate
16
+ // /form-submissions route (that path 404'd).
17
+ expect(plugin.adminNavItems).toEqual([{ label: 'Forms', icon: 'FileText', path: '/forms' }]);
18
+ });
19
+ });
20
+ describe('configuration', () => {
21
+ it('includes hooks when notifications are enabled by default', () => {
22
+ const plugin = formsPlugin();
23
+ expect(plugin.hooks?.length).toBe(formsHooks.length);
24
+ });
25
+ it('returns empty hooks when notifications are disabled', () => {
26
+ const plugin = formsPlugin({ notifications: { enabled: false } });
27
+ expect(plugin.hooks).toEqual([]);
28
+ });
29
+ });
30
+ });
31
+ //# sourceMappingURL=index.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.test.js","sourceRoot":"","sources":["../../src/__tests__/index.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AAC7C,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAA;AACzC,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AAExC,QAAQ,CAAC,cAAc,EAAE,GAAG,EAAE;IAC5B,QAAQ,CAAC,WAAW,EAAE,GAAG,EAAE;QACzB,EAAE,CAAC,2BAA2B,EAAE,GAAG,EAAE;YACnC,MAAM,CAAC,WAAW,EAAE,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,cAAc,CAAC,CAAA;QACjD,CAAC,CAAC,CAAA;QAEF,EAAE,CAAC,4CAA4C,EAAE,GAAG,EAAE;YACpD,MAAM,MAAM,GAAG,WAAW,EAAE,CAAA;YAC5B,MAAM,CAAC,MAAM,CAAC,M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submission forms. */
6
+ export declare function FormBuilder({ formId, onSave }: FormBuilderProps): import("react/jsx-runtime").JSX.Element;
7
+ export {};
8
+ //# sourceMappingURL=FormBuilder.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FormBuilder.d.ts","sourceRoot":"","sources":["../../src/admin/FormBuilder.tsx"],"names":[],"mappings":"AAWA,UAAU,gBAAgB;IACxB,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,MAAM,EAAE,CAAC,MAAM,EAAE,OAAO,EAAE,KAAK,IAAI,CAAA;CACpC;AAYD,gEAAgE;AAChE,wBAAgB,WAAW,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,EAAE,gBAAgB,2CA4L/D"}
@@ -0,0 +1,106 @@
1
+ 'use client';
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { useState, useCallback } from 'react';
4
+ const FIELD_TYPES = [
5
+ { value: 'text', label: 'Text' },
6
+ { value: 'email', label: 'Email' },
7
+ { value: 'textarea', label: 'Textarea' },
8
+ { value: 'select', label: 'Select' },
9
+ { value: 'checkbox', label: 'Checkbox' },
10
+ { value: 'number', label: 'Number' },
11
+ { value: 'date', label: 'Date' },
12
+ ];
13
+ /** Drag-and-drop form builder for creating submission forms. */
14
+ export function FormBuilder({ formId, onSave }) {
15
+ const [fields, setFields] = useState([]);
16
+ const addField = useCallback((type) => {
17
+ setFields((prev) => [
18
+ ...prev,
19
+ {
20
+ id: crypto.randomUUID(),
21
+ type,
22
+ label: `New ${type} field`,
23
+ required: false,
24
+ },
25
+ ]);
26
+ }, []);
27
+ const removeField = useCallback((id) => {
28
+ setFields((prev) => prev.filter((f) => f.id !== id));
29
+ }, []);
30
+ const updateField = useCallback((id, updates) => {
31
+ setFields((prev) => prev.map((f) => (f.id === id ? { ...f, ...updates } : f)));
32
+ }, []);
33
+ const moveField = useCallback((fromIndex, toIndex) => {
34
+ setFields((prev) => {
35
+ const next = [...prev];
36
+ const [moved] = next.splice(fromIndex, 1);
37
+ next.splice(toIndex, 0, moved);
38
+ return next;
39
+ });
40
+ }, []);
41
+ const handleSave = () => onSave(fields);
42
+ return (_jsxs("div", { style: { display: 'flex', gap: '1.5rem', padding: '1rem' }, children: [_jsxs("aside", { style: {
43
+ width: 200,
44
+ borderRight: '1px solid #e5e7eb',
45
+ paddingRight: '1rem',
46
+ }, children: [_jsx("h3", { style: { fontSize: '0.875rem', fontWeight: 600, marginBottom: '0.75rem' }, children: "Add Field" }), FIELD_TYPES.map((ft) => (_jsx("button", { type: "button", onClick: () => addField(ft.value), style: {
47
+ display: 'block',
48
+ width: '100%',
49
+ textAlign: 'left',
50
+ padding: '0.5rem 0.75rem',
51
+ marginBottom: '0.25rem',
52
+ border: '1px solid #e5e7eb',
53
+ borderRadius: '0.375rem',
54
+ background: '#fff',
55
+ cursor: 'pointer',
56
+ fontSize: '0.8125rem',
57
+ }, children: ft.label }, ft.value)))] }), _jsxs("main", { style: { flex: 1 }, children: [_jsxs("div", { style: {
58
+ display: 'flex',
59
+ justifyContent: 'space-between',
60
+ alignItems: 'center',
61
+ marginBottom: '1rem',
62
+ }, children: [_jsx("h2", { style: { fontSize: '1.125rem', fontWeight: 600 }, children: formId ? `Edit Form` : 'New Form' }), _jsx("button", { type: "button", onClick: handleSave, style: {
63
+ padding: '0.5rem 1rem',
64
+ background: '#3b82f6',
65
+ color: '#fff',
66
+ border: 'none',
67
+ borderRadius: '0.375rem',
68
+ cursor: 'pointer',
69
+ fontWeight: 500,
70
+ }, children: "Save" })] }), fields.length === 0 && (_jsx("p", { style: { color: '#9ca3af', textAlign: 'center', padding: '3rem 0' }, children: "Add fields from the sidebar to start building your form." })), _jsx("div", { style: { display: 'flex', flexDirection: 'column', gap: '0.5rem' }, children: fields.map((field, index) => (_jsxs("div", { draggable: true, onDragStart: (e) => e.dataTransfer.setData('text/plain', String(index)), onDragOver: (e) => e.preventDefault(), onDrop: (e) => {
71
+ const from = Number(e.dataTransfer.getData('text/plain'));
72
+ moveField(from, index);
73
+ }, style: {
74
+ display: 'flex',
75
+ alignItems: 'center',
76
+ gap: '0.75rem',
77
+ padding: '0.75rem',
78
+ border: '1px solid #e5e7eb',
79
+ borderRadius: '0.375rem',
80
+ background: '#fafafa',
81
+ }, children: [_jsx("span", { style: { cursor: 'grab', color: '#9ca3af' }, children: "\u283F" }), _jsx("input", { type: "text", value: field.label, onChange: (e) => updateField(field.id, { label: e.target.value }), style: {
82
+ flex: 1,
83
+ padding: '0.25rem 0.5rem',
84
+ border: '1px solid #d1d5db',
85
+ borderRadius: '0.25rem',
86
+ fontSize: '0.875rem',
87
+ } }), _jsx("span", { style: {
88
+ fontSize: '0.75rem',
89
+ color: '#6b7280',
90
+ background: '#f3f4f6',
91
+ padding: '0.125rem 0.5rem',
92
+ borderRadius: '0.25rem',
93
+ }, children: field.type }), _jsxs("label", { style: {
94
+ fontSize: '0.75rem',
95
+ display: 'flex',
96
+ alignItems: 'center',
97
+ gap: '0.25rem',
98
+ }, children: [_jsx("input", { type: "checkbox", checked: field.required, onChange: (e) => updateField(field.id, { required: e.target.checked }) }), "Required"] }), _jsx("button", { type: "button", onClick: () => removeField(field.id), style: {
99
+ background: 'none',
100
+ border: 'none',
101
+ color: '#ef4444',
102
+ cursor: 'pointer',
103
+ fontSize: '1rem',
104
+ }, "aria-label": `Remove ${field.label}`, children: "\u00D7" })] }, field.id))) })] })] }));
105
+ }
106
+ //# sourceMappingURL=FormBuilder.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FormBuilder.js","sourceRoot":"","sources":["../../src/admin/FormBuilder.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAA;;AAEZ,OAAc,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,OAAO,CAAA;AAcpD,MAAM,WAAW,GAAG;IAClB,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE;IAChC,EAAE,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE;IAClC,EAAE,KA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ACE,KAAK,EAAE;wCACL,QAAQ,EAAE,SAAS;wCACnB,OAAO,EAAE,MAAM;wCACf,UAAU,EAAE,QAAQ;wCACpB,GAAG,EAAE,SAAS;qCACf,aAED,gBACE,IAAI,EAAC,UAAU,EACf,OAAO,EAAE,KAAK,CAAC,QAAQ,EACvB,QAAQ,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,WAAW,CAAC,KAAK,CAAC,EAAE,EAAE,EAAE,QAAQ,EAAE,CAAC,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC,GACtE,gBAEI,EAER,iBACE,IAAI,EAAC,QAAQ,EACb,OAAO,EAAE,GAAG,EAAE,CAAC,WAAW,CAAC,KAAK,CAAC,EAAE,CAAC,EACpC,KAAK,EAAE;wCACL,UAAU,EAAE,MAAM;wCAClB,MAAM,EAAE,MAAM;wCACd,KAAK,EAAE,SAAS;wCAChB,MAAM,EAAE,SAAS;wCACjB,QAAQ,EAAE,MAAM;qCACjB,gBACW,UAAU,KAAK,CAAC,KAAK,EAAE,uBAG5B,KA1EJ,KAAK,CAAC,EAAE,CA2ET,CACP,CAAC,GACE,IACD,IACH,CACP,CAAA;AACH,CAAC"}
@@ -0,0 +1,13 @@
1
+ interface SubmissionDetailProps {
2
+ submission: {
3
+ id: string;
4
+ formId: string;
5
+ data: Record<string, unknown>;
6
+ submittedAt: string;
7
+ read: boolean;
8
+ };
9
+ }
10
+ /** Detailed view of a single form submission's data. */
11
+ export declare function SubmissionDetail({ submission }: SubmissionDetailProps): import("react/jsx-runtime").JSX.Element;
12
+ export {};
13
+ //# sourceMappingURL=SubmissionDetail.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SubmissionDetail.d.ts","sourceRoot":"","sources":["../../src/admin/SubmissionDetail.tsx"],"names":[],"mappings":"AAIA,UAAU,qBAAqB;IAC7B,UAAU,EAAE;QACV,EAAE,EAAE,MAAM,CAAA;QACV,MAAM,EAAE,MAAM,CAAA;QACd,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;QAC7B,WAAW,EAAE,MAAM,CAAA;QACnB,IAAI,EAAE,OAAO,CAAA;KACd,CAAA;CACF;AAED,wDAAwD;AACxD,wBAAgB,gBAAgB,CAAC,EAAE,UAAU,EAAE,EAAE,qBAAqB,2CAsErE"}
@@ -0,0 +1,32 @@
1
+ 'use client';
2
+ import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
3
+ /** Detailed view of a single form submission's data. */
4
+ export function SubmissionDetail({ submission }) {
5
+ const fields = Object.entries(submission.data);
6
+ return (_jsxs("div", { style: { padding: '1rem', maxWidth: 640 }, children: [_jsxs("header", { style: {
7
+ display: 'flex',
8
+ justifyContent: 'space-between',
9
+ alignItems: 'center',
10
+ marginBottom: '1.5rem',
11
+ }, children: [_jsxs("div", { children: [_jsxs("h2", { style: { fontSize: '1.125rem', fontWeight: 600 }, children: ["Submission ", submission.id] }), _jsxs("p", { style: { fontSize: '0.8125rem', color: '#6b7280', marginTop: '0.25rem' }, children: ["Form: ", submission.formId, " \u00B7 ", new Date(submission.submittedAt).toLocaleString()] })] }), _jsx("span", { style: {
12
+ fontSize: '0.75rem',
13
+ fontWeight: 500,
14
+ padding: '0.25rem 0.75rem',
15
+ borderRadius: '9999px',
16
+ background: submission.read ? '#f3f4f6' : '#dbeafe',
17
+ color: submission.read ? '#6b7280' : '#1d4ed8',
18
+ }, children: submission.read ? 'Read' : 'Unread' })] }), _jsx("dl", { style: { display: 'grid', gap: '1rem' }, children: fields.map(([key, value]) => (_jsxs("div", { style: {
19
+ padding: '0.75rem',
20
+ background: '#fafafa',
21
+ borderRadius: '0.375rem',
22
+ border: '1px solid #f3f4f6',
23
+ }, children: [_jsx("dt", { style: {
24
+ fontSize: '0.75rem',
25
+ fontWeight: 600,
26
+ color: '#374151',
27
+ textTransform: 'uppercase',
28
+ letterSpacing: '0.05em',
29
+ marginBottom: '0.25rem',
30
+ }, children: key }), _jsx("dd", { style: { fontSize: '0.875rem', color: '#111827', margin: 0 }, children: typeof value === 'object' ? JSON.stringify(value, null, 2) : String(value) })] }, key))) }), fields.length === 0 && (_jsx("p", { style: { color: '#9ca3af', textAlign: 'center', padding: '2rem 0' }, children: "This submission contains no data." }))] }));
31
+ }
32
+ //# sourceMappingURL=SubmissionDetail.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SubmissionDetail.js","sourceRoot":"","sources":["../../src/admin/SubmissionDetail.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAA;;AAcZ,wDAAwD;AACxD,MAAM,UAAU,gBAAgB,CAAC,EAAE,UAAU,EAAyB;IACpE,MAAM,MAAM,GAAG,MAAM,CAAC,OAAO,CAAC,UAAU,CAAC,IAAI,CAAC,CAAA;IAE9C,OAAO,CACL,eAAK,KAAK,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,GAAG,EAAE,aAC5C,kBACE,KAAK,EAAE;oBACL,OAAO,EAAE,MAAM;oBACf,cAAc,EAAE,eAAe;oBAC/B,UAAU,EAAE,QAAQ;oBACpB,YAAY,EAAE,QAAQ;iBACvB,aAED,0BACE,cAAI,KAAK,EAAE,EAAE,QAAQ,EAAE,UAAU,EAAE,UAAU,EAAE,GAAG,EAAE,4BAAc,UAAU,CAAC,EAAE,IAAM,EACrF,aAAG,KAAK,EAAE,EAAE,QAAQ,EAAE,WAAW,EAAE,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,uBAClE,UAAU,CAAC,MAAM,cAAY,IAAI,IAAI,CAAC,UAAU,CAAC,WAAW,CAAC,CAAC,cAAc,EAAE,IACnF,IACA,EACN,eACE,KAAK,EAAE;4BACL,QAAQ,EAAE,SAAS;4BACnB,UAAU,EAAE,GAAG;4BACf,OAAO,EAAE,iBAAiB;4BAC1B,YAAY,EAAE,QAAQ;4BACtB,UAAU,EAAE,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,SAAS;4BACnD,KAAK,EAA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ean;
6
+ data: Record<string, unknown>;
7
+ }
8
+ interface SubmissionListProps {
9
+ formId: string;
10
+ submissions: SubmissionRow[];
11
+ }
12
+ /** Tabular view of form submissions with read-status indicators. */
13
+ export declare function SubmissionList({ formId, submissions }: SubmissionListProps): import("react/jsx-runtime").JSX.Element;
14
+ export {};
15
+ //# sourceMappingURL=SubmissionList.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SubmissionList.d.ts","sourceRoot":"","sources":["../../src/admin/SubmissionList.tsx"],"names":[],"mappings":"AAIA,MAAM,WAAW,aAAa;IAC5B,EAAE,EAAE,MAAM,CAAA;IACV,MAAM,EAAE,MAAM,CAAA;IACd,WAAW,EAAE,MAAM,CAAA;IACnB,IAAI,EAAE,OAAO,CAAA;IACb,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;CAC9B;AAED,UAAU,mBAAmB;IAC3B,MAAM,EAAE,MAAM,CAAA;IACd,WAAW,EAAE,aAAa,EAAE,CAAA;CAC7B;AAED,oEAAoE;AACpE,wBAAgB,cAAc,CAAC,EAAE,MAAM,EAAE,WAAW,EAAE,EAAE,mBAAmB,2CAwE1E"}
@@ -0,0 +1,28 @@
1
+ 'use client';
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ /** Tabular view of form submissions with read-status indicators. */
4
+ export function SubmissionList({ formId, submissions }) {
5
+ return (_jsxs("div", { style: { padding: '1rem' }, children: [_jsxs("h2", { style: { fontSize: '1.125rem', fontWeight: 600, marginBottom: '1rem' }, children: ["Submissions for ", _jsx("code", { children: formId })] }), submissions.length === 0 ? (_jsx("p", { style: { color: '#9ca3af', textAlign: 'center', padding: '2rem 0' }, children: "No submissions yet." })) : (_jsxs("table", { style: {
6
+ width: '100%',
7
+ borderCollapse: 'collapse',
8
+ fontSize: '0.875rem',
9
+ }, children: [_jsx("thead", { children: _jsxs("tr", { style: { borderBottom: '2px solid #e5e7eb', textAlign: 'left' }, children: [_jsx("th", { style: { padding: '0.5rem 0.75rem' }, children: "ID" }), _jsx("th", { style: { padding: '0.5rem 0.75rem' }, children: "Submitted At" }), _jsx("th", { style: { padding: '0.5rem 0.75rem' }, children: "Status" }), _jsx("th", { style: { padding: '0.5rem 0.75rem' }, children: "Preview" })] }) }), _jsx("tbody", { children: submissions.map((row) => (_jsxs("tr", { style: {
10
+ borderBottom: '1px solid #f3f4f6',
11
+ fontWeight: row.read ? 400 : 600,
12
+ }, children: [_jsx("td", { style: { padding: '0.5rem 0.75rem' }, children: row.id }), _jsx("td", { style: { padding: '0.5rem 0.75rem' }, children: new Date(row.submittedAt).toLocaleString() }), _jsxs("td", { style: { padding: '0.5rem 0.75rem' }, children: [_jsx("span", { style: {
13
+ display: 'inline-block',
14
+ width: 8,
15
+ height: 8,
16
+ borderRadius: '50%',
17
+ background: row.read ? '#d1d5db' : '#3b82f6',
18
+ marginRight: '0.5rem',
19
+ } }), row.read ? 'Read' : 'Unread'] }), _jsx("td", { style: {
20
+ padding: '0.5rem 0.75rem',
21
+ color: '#6b7280',
22
+ maxWidth: 300,
23
+ overflow: 'hidden',
24
+ textOverflow: 'ellipsis',
25
+ whiteSpace: 'nowrap',
26
+ }, children: JSON.stringify(row.data).slice(0, 80) })] }, row.id))) })] }))] }));
27
+ }
28
+ //# sourceMappingURL=SubmissionList.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SubmissionList.js","sourceRoot":"","sources":["../../src/admin/SubmissionList.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAA;;AAiBZ,oEAAoE;AACpE,MAAM,UAAU,cAAc,CAAC,EAAE,MAAM,EAAE,WAAW,EAAuB;IACzE,OAAO,CACL,eAAK,KAAK,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE,aAC7B,cAAI,KAAK,EAAE,EAAE,QAAQ,EAAE,UAAU,EAAE,UAAU,EAAE,GAAG,EAAE,YAAY,EAAE,MAAM,EAAE,iCACxD,yBAAO,MAAM,GAAQ,IAClC,EAEJ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AAE,KAAK;gDACnB,UAAU,EAAE,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,SAAS;gDAC5C,WAAW,EAAE,QAAQ;6CACtB,GACD,EACD,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,QAAQ,IAC1B,EACL,aACE,KAAK,EAAE;wCACL,OAAO,EAAE,gBAAgB;wCACzB,KAAK,EAAE,SAAS;wCAChB,QAAQ,EAAE,GAAG;wCACb,QAAQ,EAAE,QAAQ;wCAClB,YAAY,EAAE,UAAU;wCACxB,UAAU,EAAE,QAAQ;qCACrB,YAEA,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,GACnC,KAlCA,GAAG,CAAC,EAAE,CAmCR,CACN,CAAC,GACI,IACF,CACT,IACG,CACP,CAAA;AACH,CAAC"}
@@ -0,0 +1,3 @@
1
+ import type { CollectionDefinition } from '@prenta/core';
2
+ export declare const formsCollections: Record<string, CollectionDefinition>;
3
+ //# sourceMappingURL=collections.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"collections.d.ts","sourceRoot":"","sources":["../src/collections.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAA;AAExD,eAAO,MAAM,gBAAgB,EAAE,MAAM,CAAC,MAAM,EAAE,oBAAoB,CAuJjE,CAAA"}
@@ -0,0 +1,153 @@
1
+ export const formsCollections = {
2
+ forms: {
3
+ slug: 'forms',
4
+ labels: { singular: 'Form', plural: 'Forms' },
5
+ // The field map must cover every key the typed forms service persists
6
+ // (cms-core `FormDefinition` / `forms/service.ts`): `updateDocument`
7
+ // strips undeclared keys on write, so a missing entry here would silently
8
+ // drop that setting on consumer apps that register this plugin.
9
+ fields: {
10
+ name: {
11
+ type: 'text',
12
+ label: 'Name',
13
+ required: true,
14
+ admin: { description: 'Internal name for this form' },
15
+ },
16
+ description: {
17
+ type: 'text',
18
+ label: 'Description',
19
+ admin: { description: 'Internal description shown in the forms list' },
20
+ },
21
+ fields: {
22
+ type: 'json',
23
+ label: 'Form Fields',
24
+ admin: {
25
+ description: 'JSON schema defining the form fields and their validation rules',
26
+ },
27
+ },
28
+ activeSchemaVersionId: {
29
+ type: 'text',
30
+ label: 'Active Schema Version',
31
+ admin: {
32
+ readOnly: true,
33
+ description: 'Versioned field-schema snapshot submissions are validated against',
34
+ },
35
+ },
36
+ successMessage: {
37
+ type: 'text',
38
+ label: 'Success Message',
39
+ admin: { description: 'Message shown after a successful submission' },
40
+ },
41
+ redirectUrl: {
42
+ type: 'url',
43
+ label: 'Redirect URL',
44
+ admin: { description: 'When set, redirect here after submission instead of a message' },
45
+ },
46
+ analytics: {
47
+ type: 'json',
48
+ label: 'Analytics Settings',
49
+ admin: {
50
+ description: 'GA4 event tracking configuration',
51
+ },
52
+ },
53
+ notificationSettings: {
54
+ type: 'json',
55
+ label: 'Notification Settings',
56
+ admin: {
57
+ description: 'Email notifications and autoresponder triggered on submission',
58
+ },
59
+ },
60
+ notifyEnabled: {
61
+ type: 'boolean',
62
+ label: 'Notifications Enabled',
63
+ defaultValue: false,
64
+ },
65
+ embedSettings: {
66
+ type: 'json',
67
+ label: 'Embed Settings',
68
+ admin: { description: 'Allowed embed origins and embed token' },
69
+ },
70
+ spamSettings: {
71
+ type: 'json',
72
+ label: 'Spam Protection',
73
+ admin: { description: 'Honeypot, time-trap, blocklist, and captcha configuration' },
74
+ },
75
+ // Legacy keys written by the pre-consolidation form editor. Declared so
76
+ // existing documents don't lose them on the next merge-write; the
77
+ // runtime reads successMessage/redirectUrl/notificationSettings instead.
78
+ confirmation: {
79
+ type: 'json',
80
+ label: 'Confirmation Settings (legacy)',
81
+ hidden: true,
82
+ },
83
+ notifications: {
84
+ type: 'json',
85
+ label: 'Notification Settings (legacy)',
86
+ hidden: true,
87
+ },
88
+ archivedAt: {
89
+ type: 'date',
90
+ label: 'Archived At',
91
+ admin: { readOnly: true },
92
+ },
93
+ status: {
94
+ type: 'select',
95
+ label: 'Status',
96
+ options: [
97
+ { label: 'Active', value: 'active' },
98
+ { label: 'Draft', value: 'draft' },
99
+ { label: 'Archived', value: 'archived' },
100
+ ],
101
+ defaultValue: 'active',
102
+ required: true,
103
+ },
104
+ },
105
+ timestamps: true,
106
+ admin: {
107
+ useAsTitle: 'name',
108
+ group: 'Forms',
109
+ defaultColumns: ['name', 'status'],
110
+ description: 'Create and manage forms for data collection',
111
+ },
112
+ },
113
+ formSubmissions: {
114
+ slug: 'form-submissions',
115
+ labels: { singular: 'Form Submission', plural: 'Form Submissions' },
116
+ fields: {
117
+ formId: {
118
+ type: 'relationship',
119
+ label: 'Form',
120
+ relationTo: 'forms',
121
+ required: true,
122
+ },
123
+ data: {
124
+ type: 'json',
125
+ label: 'Submission Data',
126
+ admin: { readOnly: true },
127
+ },
128
+ read: {
129
+ type: 'boolean',
130
+ label: 'Read',
131
+ defaultValue: false,
132
+ },
133
+ submittedAt: {
134
+ type: 'date',
135
+ label: 'Submitted At',
136
+ includeTime: true,
137
+ admin: { readOnly: true },
138
+ },
139
+ },
140
+ timestamps: true,
141
+ admin: {
142
+ useAsTitle: 'formId',
143
+ // Hidden from the sidebar: submissions are managed through Forms → All
144
+ // Entries (/forms/entries) + per-form submissions, not as a raw
145
+ // collection. A `group` here surfaced a "/form-submissions" nav entry that
146
+ // the admin doesn't route (404).
147
+ hidden: true,
148
+ defaultColumns: ['formId', 'submittedAt', 'read'],
149
+ description: 'View and manage form submission data',
150
+ },
151
+ },
152
+ };
153
+ //# sourceMappingURL=collections.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"collections.js","sourceRoot":"","sources":["../src/collections.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,gBAAgB,GAAyC;IACpE,KAAK,EAAE;QACL,IAAI,EAAE,OAAO;QACb,MAAM,EAAE,EAAE,QAAQ,EAAE,MAAM,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,EAAE,QAAQ,EAAE,iBAAiB,EAAE,MAAM,EAAE,kBAAkB,EAAE;QACnE,MAAM,EAAE;YACN,MAAM,EAAE;gBACN,IAAI,EAAE,cAAc;gBACpB,KAAK,EAAE,MAAM;gBACb,UAAU,EAAE,OAAO;gBACnB,QAAQ,EAAE,IAAI;aACf;YACD,IAAI,EAAE;gBACJ,IAAI,EAAE,MAAM;gBACZ,KAAK,EAAE,iBAAiB;gBACxB,KAAK,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE;aAC1B;YACD,IAAI,EAAE;gBACJ,IAAI,EAAE,SAAS;gBACf,KAAK,EAAE,MAAM;gBACb,YAAY,EAAE,KAAK;aACpB;YACD,WAAW,EAAE;gBACX,IAAI,EAAE,MAAM;gBACZ,KAAK,EAAE,cAAc;gBACrB,WAAW,EAAE,IAAI;gBACjB,KAAK,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE;aAC1B;SACF;QACD,UAAU,EAAE,IAAI;QAChB,KAAK,EAAE;YACL,UAAU,EAAE,QAAQ;YACpB,uEAAuE;YACvE,gEAAgE;YAChE,2EAA2E;YAC3E,iCAAiC;YACjC,MAAM,EAAE,IAAI;YACZ,cAAc,EAAE,CAAC,QAAQ,EAAE,aAAa,EAAE,MAAM,CAAC;YACjD,WAAW,EAAE,sCAAsC;SACpD;KACF;CACF,CAAA"}
@@ -0,0 +1,3 @@
1
+ import type { FieldDefinition } from '@prenta/core';
2
+ export declare const formsFields: Record<string, FieldDefinition>;
3
+ //# sourceMappingURL=fields.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fields.d.ts","sourceRoot":"","sources":["../src/fields.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,cAAc,CAAA;AAEnD,eAAO,MAAM,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,eAAe,CAAM,CAAA"}
package/dist/fields.js ADDED
@@ -0,0 +1,2 @@
1
+ export const formsFields = {};
2
+ //# sourceMappingURL=fields.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fields.js","sourceRoot":"","sources":["../src/fields.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,WAAW,GAAoC,EAAE,CAAA"}
@@ -0,0 +1,15 @@
1
+ import { type PluginHook } from '@prenta/core';
2
+ /**
3
+ * Legacy document-lifecycle hook for `form-submissions`.
4
+ *
5
+ * Admin notification + autoresponder email is owned by cms-core
6
+ * `sendFormNotifications` (forms/notify.ts) via the public submission
7
+ * pipeline. This hook only dispatches the global `form.submitted` webhook for
8
+ * backwards compatibility with `dispatchWebhook` listeners.
9
+ *
10
+ * Payload shapes supported:
11
+ * - Modern side-effect hook: `{ formId, data }`
12
+ * - Document lifecycle: `{ data: { formId, data } }`
13
+ */
14
+ export declare const formsHooks: PluginHook[];
15
+ //# sourceMappingURL=hooks.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hooks.d.ts","sourceRoot":"","sources":["../src/hooks.ts"],"names":[],"mappings":"AAAA,OAAO,EAAmB,KAAK,UAAU,EAAkC,MAAM,cAAc,CAAA;AAE/F;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,UAAU,EAAE,UAAU,EAiBlC,CAAA"}
package/dist/hooks.js ADDED
@@ -0,0 +1,56 @@
1
+ import { dispatchWebhook } from '@prenta/core';
2
+ /**
3
+ * Legacy document-lifecycle hook for `form-submissions`.
4
+ *
5
+ * Admin notification + autoresponder email is owned by cms-core
6
+ * `sendFormNotifications` (forms/notify.ts) via the public submission
7
+ * pipeline. This hook only dispatches the global `form.submitted` webhook for
8
+ * backwards compatibility with `dispatchWebhook` listeners.
9
+ *
10
+ * Payload shapes supported:
11
+ * - Modern side-effect hook: `{ formId, data }`
12
+ * - Document lifecycle: `{ data: { formId, data } }`
13
+ */
14
+ export const formsHooks = [
15
+ {
16
+ event: 'afterCreate:form-submissions',
17
+ handler: async (payload) => {
18
+ const { formId, submissionData } = resolveSubmissionPayload(payload);
19
+ if (!formId)
20
+ return;
21
+ try {
22
+ void dispatchWebhook('form.submitted', {
23
+ formId,
24
+ data: submissionData,
25
+ }).catch(() => { });
26
+ }
27
+ catch {
28
+ // dispatch is best-effort; never let a webhook failure break the write.
29
+ }
30
+ },
31
+ },
32
+ ];
33
+ function resolveSubmissionPayload(payload) {
34
+ if (!payload || typeof payload !== 'object') {
35
+ return { formId: '', submissionData: {} };
36
+ }
37
+ const raw = payload;
38
+ // Modern fireSubmissionHooks shape: { formId, data }
39
+ if (typeof raw.formId === 'string' && raw.data && typeof raw.data === 'object') {
40
+ return {
41
+ formId: raw.formId,
42
+ submissionData: raw.data,
43
+ };
44
+ }
45
+ // Document-lifecycle payload: submission fields live under `data`.
46
+ const doc = payload;
47
+ const fieldValues = doc.data;
48
+ if (!fieldValues || typeof fieldValues !== 'object') {
49
+ return { formId: '', submissionData: {} };
50
+ }
51
+ const formId = typeof fieldValues.formId === 'string' ? fieldValues.formId : '';
52
+ const submissionData = fieldValues.data ??
53
+ fieldValues;
54
+ return { formId, submissionData };
55
+ }
56
+ //# sourceMappingURL=hooks.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hooks.js","sourceRoot":"","sources":["../src/hooks.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAmD,MAAM,cAAc,CAAA;AAE/F;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,MAAM,UAAU,GAAiB;IACtC;QACE,KAAK,EAAE,8BAA8B;QACrC,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE;YACzB,MAAM,EAAE,MAAM,EAAE,cAAc,EAAE,GAAG,wBAAwB,CAAC,OAAO,CAAC,CAAA;YACpE,IAAI,CAAC,MAAM;gBAAE,OAAM;YAEnB,IAAI,CAAC;gBACH,KAAK,eAAe,CAAC,gBAAgB,EAAE;oBACrC,MAAM;oBACN,IAAI,EAAE,cAAc;iBACrB,CAAC,CAAC,KAAK,CAAC,GAAG,EAAE,GAAE,CAAC,CAAC,CAAA;YACpB,CAAC;YAAC,MAAM,CAAC;gBACP,wEAAwE;YAC1E,CAAC;QACH,CAAC;KACF;CACF,CAAA;AAED,SAAS,wBAAwB,CAAC,OAAgB;IAIhD,IAAI,CAAC,OAAO,IAAI,OAAO,OAAO,KAAK,QAAQ,EAAE,CAAC;QAC5C,OAAO,EAAE,MAAM,EAAE,EAAE,EAAE,cAAc,EAAE,EAAE,EAAE,CAAA;IAC3C,CAAC;IAED,MAAM,GAAG,GAAG,OAAkC,CAAA;IAE9C,qDAAqD;IACrD,IAAI,OAAO,GAAG,CAAC,MAAM,KAAK,QAAQ,IAAI,GAAG,CAAC,IAAI,IAAI,OAAO,GAAG,CAAC,IAAI,KAAK,QAAQ,EAAE,CAAC;QAC/E,OAAO;YACL,MAAM,EAAE,GAAG,CAAC,MAAM;YAClB,cAAc,EAAE,GAAG,CAAC,IAA+B;SACpD,CAAA;IACH,CAAC;IAED,mEAAmE;IACnE,MAAM,GAAG,GAAG,OAAoC,CAAA;IAChD,MAAM,WAAW,GAAG,GAAG,CAAC,IAAI,CAAA;IAC5B,IAAI,CAAC,WAAW,IAAI,OAAO,WAAW,KAAK,QAAQ,EAAE,CAAC;QACpD,OAAO,EAAE,MAAM,EAAE,EAAE,EAAE,cAAc,EAAE,EAAE,EAAE,CAAA;IAC3C,CAAC;IAED,MAAM,MAAM,GAAG,OAAO,WAAW,CAAC,MAAM,KAAK,QAAQ,CAAC,CAAC,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAA;IAC/E,MAAM,cAAc,GACjB,WAAW,CAAC,IAAmD;QAC/D,WAAuC,CAAA;IAE1C,OAAO,EAAE,MAAM,EAAE,cAAc,EAAE,CAAA;AACnC,CAAC"}
@@ -0,0 +1,14 @@
1
+ import { type PluginDefinition } from '@prenta/core/config';
2
+ export interface FormsPluginConfig {
3
+ notifications?: {
4
+ enabled: boolean;
5
+ defaultRecipient?: string;
6
+ };
7
+ storageAdapter?: 'database' | 'custom';
8
+ }
9
+ /** Factory that creates the forms plugin with optional notification and storage settings. */
10
+ export declare function formsPlugin(config?: FormsPluginConfig): PluginDefinition;
11
+ export { FormBuilder } from './admin/FormBuilder.js';
12
+ export { SubmissionList } from './admin/SubmissionList.js';
13
+ export { SubmissionDetail } from './admin/SubmissionDetail.js';
14
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgB,KAAK,gBAAgB,EAAE,MAAM,qBAAqB,CAAA;AAKzE,MAAM,WAAW,iBAAiB;IAChC,aAAa,CAAC,EAAE;QACd,OAAO,EAAE,OAAO,CAAA;QAChB,gBAAgB,CAAC,EAAE,MAAM,CAAA;KAC1B,CAAA;IACD,cAAc,CAAC,EAAE,UAAU,GAAG,QAAQ,CAAA;CACvC;AAED,6FAA6F;AAC7F,wBAAgB,WAAW,CAAC,MAAM,CAAC,EAAE,iBAAiB,GAAG,gBAAgB,CAcxE;AAED,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAA;AACpD,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAA;AAC1D,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAA"}
package/dist/index.js ADDED
@@ -0,0 +1,23 @@
1
+ import { definePlugin } from '@prenta/core/config';
2
+ import { formsFields } from './fields.js';
3
+ import { formsCollections } from './collections.js';
4
+ import { formsHooks } from './hooks.js';
5
+ /** Factory that creates the forms plugin with optional notification and storage settings. */
6
+ export function formsPlugin(config) {
7
+ const hooks = config?.notifications?.enabled !== false ? formsHooks : [];
8
+ return definePlugin({
9
+ name: 'plugin-forms',
10
+ fields: formsFields,
11
+ collections: formsCollections,
12
+ // Just "Forms" — its submenu already exposes All Entries (/forms/entries)
13
+ // and per-form submissions. The old 'Submissions' item pointed at
14
+ // /form-submissions, a route the admin doesn't have (it 404'd), and simply
15
+ // duplicated Forms → All Entries.
16
+ adminNavItems: [{ label: 'Forms', icon: 'FileText', path: '/forms' }],
17
+ hooks,
18
+ });
19
+ }
20
+ export { FormBuilder } from './admin/FormBuilder.js';
21
+ export { SubmissionList } from './admin/SubmissionList.js';
22
+ export { SubmissionDetail } from './admin/SubmissionDetail.js';
23
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAyB,MAAM,qBAAqB,CAAA;AACzE,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAA;AACzC,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAA;AACnD,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAA;AAUvC,6FAA6F;AAC7F,MAAM,UAAU,WAAW,CAAC,MAA0B;IACpD,MAAM,KAAK,GAAG,MAAM,EAAE,aAAa,EAAE,OAAO,KAAK,KAAK,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,EAAE,CAAA;IAExE,OAAO,YAAY,CAAC;QAClB,IAAI,EAAE,cAAc;QACpB,MAAM,EAAE,WAAW;QACnB,WAAW,EAAE,gBAAgB;QAC7B,0EAA0E;QAC1E,kEAAkE;QAClE,2EAA2E;QAC3E,kCAAkC;QAClC,aAAa,EAAE,CAAC,EAAE,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC;QACrE,KAAK;KACN,CAAC,CAAA;AACJ,CAAC;AAED,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAA;AACpD,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAA;AAC1D,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAA"}
package/package.json ADDED
@@ -0,0 +1,47 @@
1
+ {
2
+ "name": "@prenta/plugin-forms",
3
+ "version": "0.1.0",
4
+ "license": "MIT",
5
+ "repository": {
6
+ "type": "git",
7
+ "url": "https://github.com/actuate-media/prenta.git",
8
+ "directory": "packages/plugin-forms"
9
+ },
10
+ "publishConfig": {
11
+ "access": "public"
12
+ },
13
+ "type": "module",
14
+ "exports": {
15
+ ".": {
16
+ "types": "./dist/index.d.ts",
17
+ "import": "./dist/index.js",
18
+ "default": "./dist/index.js"
19
+ }
20
+ },
21
+ "main": "./dist/index.js",
22
+ "types": "./dist/index.d.ts",
23
+ "files": [
24
+ "dist",
25
+ "CHANGELOG.md"
26
+ ],
27
+ "peerDependencies": {
28
+ "@prenta/core": ">=0.1.0",
29
+ "react": "^18.0.0 || ^19.0.0",
30
+ "react-dom": "^18.0.0 || ^19.0.0"
31
+ },
32
+ "devDependencies": {
33
+ "@types/react": "^19.0.0",
34
+ "@types/react-dom": "^19.0.0",
35
+ "react": "^19.2.0",
36
+ "react-dom": "^19.2.0",
37
+ "typescript": "^5.7.0",
38
+ "vitest": "^4.1.0",
39
+ "@prenta/core": "0.118.0"
40
+ },
41
+ "scripts": {
42
+ "build": "tsc --project tsconfig.json",
43
+ "type-check": "tsc --noEmit",
44
+ "test": "vitest run",
45
+ "clean": "rm -rf dist .turbo"
46
+ }
47
+ }