@nextlyhq/plugin-form-builder 0.0.2-alpha.33 → 0.0.2-alpha.35
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/README.md +4 -5
- package/dist/admin/index.d.ts +101 -303
- package/dist/admin/index.js +3583 -3245
- package/dist/admin/index.js.map +1 -1
- package/dist/chunk-I4VFGPNR.js +506 -0
- package/dist/chunk-I4VFGPNR.js.map +1 -0
- package/dist/index.d.ts +4 -4
- package/dist/index.js +422 -573
- package/dist/index.js.map +1 -1
- package/dist/{index-BRumOEsE.d.ts → types-C-DcuYGF.d.ts} +61 -93
- package/package.json +26 -31
- package/dist/CheckboxFieldEditor-K4T6QX52.js +0 -121
- package/dist/CheckboxFieldEditor-K4T6QX52.js.map +0 -1
- package/dist/DateFieldEditor-JFJFAVOH.js +0 -187
- package/dist/DateFieldEditor-JFJFAVOH.js.map +0 -1
- package/dist/EmailFieldEditor-ZZ4VSKKB.js +0 -138
- package/dist/EmailFieldEditor-ZZ4VSKKB.js.map +0 -1
- package/dist/NumberFieldEditor-UISAYR6Z.js +0 -175
- package/dist/NumberFieldEditor-UISAYR6Z.js.map +0 -1
- package/dist/RadioFieldEditor-6UQFH4WT.js +0 -165
- package/dist/RadioFieldEditor-6UQFH4WT.js.map +0 -1
- package/dist/SelectFieldEditor-PSO4KHV4.js +0 -213
- package/dist/SelectFieldEditor-PSO4KHV4.js.map +0 -1
- package/dist/TextFieldEditor-5EU64EA5.js +0 -187
- package/dist/TextFieldEditor-5EU64EA5.js.map +0 -1
- package/dist/TextareaFieldEditor-773G3LNM.js +0 -190
- package/dist/TextareaFieldEditor-773G3LNM.js.map +0 -1
- package/dist/admin/index.css +0 -934
- package/dist/admin/index.css.map +0 -1
- package/dist/chunk-ABNZFTQK.js +0 -586
- package/dist/chunk-ABNZFTQK.js.map +0 -1
- package/dist/chunk-XTCEPJ7B.js +0 -256
- package/dist/chunk-XTCEPJ7B.js.map +0 -1
- package/dist/components/index.d.ts +0 -3
- package/dist/components/index.js +0 -9
- package/dist/components/index.js.map +0 -1
- package/dist/styles/form-builder.css +0 -1150
- package/dist/styles/submissions-filter.css +0 -75
package/README.md
CHANGED
|
@@ -46,15 +46,14 @@ export default defineConfig({
|
|
|
46
46
|
|
|
47
47
|
> A `formBuilderPlugin` default-instance shortcut is also exported for cases where no customization is needed. See [the plugin docs](https://nextlyhq.com/docs/plugins/form-builder) for the full options reference.
|
|
48
48
|
|
|
49
|
-
## Admin
|
|
49
|
+
## Admin components
|
|
50
50
|
|
|
51
|
-
The plugin's admin UI
|
|
51
|
+
The plugin's admin UI needs one import in your admin route page (a side effect
|
|
52
|
+
that registers the builder and submissions views):
|
|
52
53
|
|
|
53
54
|
```tsx
|
|
54
55
|
// app/admin/[[...params]]/page.tsx
|
|
55
56
|
import "@nextlyhq/plugin-form-builder/admin";
|
|
56
|
-
import "@nextlyhq/plugin-form-builder/styles/builder.css";
|
|
57
|
-
import "@nextlyhq/plugin-form-builder/styles/submissions-filter.css";
|
|
58
57
|
```
|
|
59
58
|
|
|
60
59
|
## What this plugin adds
|
|
@@ -94,7 +93,7 @@ See the [Field types reference](https://nextlyhq.com/docs/plugins/form-builder#f
|
|
|
94
93
|
- Server helpers: `submitForm`, `validateSubmission`, `getFormSubmissionStats`, `createFormConfig`, `validateFormConfig`, `assertValidFormConfig`
|
|
95
94
|
- Export utilities: `exportToCSV`, `exportToJSON`, `exportAndDownload`, `downloadFile`, `generateExportFilename`
|
|
96
95
|
- Collections: `formsCollection`, `submissionsCollection`
|
|
97
|
-
- Type exports: `FormDocument`, `SubmissionDocument`, `FormSubmission`, `EmailConfig`, `WebhookConfig`, `WebhookEvent`, `FormFieldOption
|
|
96
|
+
- Type exports: `FormDocument`, `SubmissionDocument`, `FormSubmission`, `FormNotification`, `EmailConfig`, `WebhookConfig`, `WebhookEvent`, `FormFieldOption`
|
|
98
97
|
|
|
99
98
|
## Compatibility
|
|
100
99
|
|
package/dist/admin/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ComponentPath } from '@nextlyhq/plugin-sdk/admin';
|
|
2
2
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
3
|
-
import { i as FormField, p as FormFieldType } from '../
|
|
4
|
-
|
|
3
|
+
import { i as FormField, b as FormSettings, s as FormNotification, p as FormFieldType } from '../types-C-DcuYGF.js';
|
|
4
|
+
import { FormFieldCatalogType, FieldTypeCatalogEntry } from 'nextly/field-catalog';
|
|
5
5
|
import { ReactNode } from 'react';
|
|
6
6
|
import 'nextly';
|
|
7
7
|
|
|
@@ -27,38 +27,69 @@ interface FormBuilderViewProps {
|
|
|
27
27
|
}
|
|
28
28
|
declare function FormBuilderView({ id, entryId, collection, collectionSlug, isCreating, initialData, onSave, onSuccess, onCancel, }: FormBuilderViewProps): react_jsx_runtime.JSX.Element;
|
|
29
29
|
|
|
30
|
-
interface
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
30
|
+
interface SubmissionRow {
|
|
31
|
+
id: string;
|
|
32
|
+
form: string | {
|
|
33
|
+
id: string;
|
|
34
|
+
name?: string;
|
|
35
|
+
};
|
|
36
|
+
data: Record<string, unknown>;
|
|
37
|
+
status: string;
|
|
38
|
+
spamReason?: string | null;
|
|
39
|
+
notes?: string | null;
|
|
40
|
+
ipAddress?: string | null;
|
|
41
|
+
userAgent?: string | null;
|
|
42
|
+
submittedAt?: string | null;
|
|
43
|
+
editedAt?: string | null;
|
|
44
|
+
editedBy?: string | null;
|
|
35
45
|
}
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
46
|
+
interface FormOption {
|
|
47
|
+
id: string;
|
|
48
|
+
name: string;
|
|
49
|
+
fields: FormField[];
|
|
50
|
+
}
|
|
51
|
+
interface SubmissionsViewProps {
|
|
52
|
+
collectionSlug?: string;
|
|
53
|
+
}
|
|
54
|
+
declare function SubmissionsView({ collectionSlug }: SubmissionsViewProps): react_jsx_runtime.JSX.Element;
|
|
43
55
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
declare function
|
|
56
|
+
interface SubmissionSheetProps {
|
|
57
|
+
submission: SubmissionRow;
|
|
58
|
+
form: FormOption;
|
|
59
|
+
canUpdate: boolean;
|
|
60
|
+
onClose: () => void;
|
|
61
|
+
onPrev?: () => void;
|
|
62
|
+
onNext?: () => void;
|
|
63
|
+
onSave: (changes: Record<string, unknown>) => Promise<void>;
|
|
64
|
+
}
|
|
65
|
+
declare function SubmissionSheet({ submission, form, canUpdate, onClose, onPrev, onNext, onSave, }: SubmissionSheetProps): react_jsx_runtime.JSX.Element;
|
|
54
66
|
|
|
55
|
-
interface
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
67
|
+
interface FieldCardsProps {
|
|
68
|
+
/**
|
|
69
|
+
* Form-surface types the host has NOT excluded (the plugin's field
|
|
70
|
+
* enable/disable option). `null` while the host configuration is still
|
|
71
|
+
* loading — the Add dialog waits rather than flashing the unfiltered set.
|
|
72
|
+
* Types outside this set stay renderable on existing fields but cannot be
|
|
73
|
+
* added.
|
|
74
|
+
*/
|
|
75
|
+
enabledTypes: readonly FormFieldCatalogType[] | null;
|
|
76
|
+
/** Creates a field of the given type and returns it (context helper). */
|
|
77
|
+
onAddField: (type: FormFieldCatalogType) => void;
|
|
78
|
+
}
|
|
79
|
+
declare function FieldCards({ enabledTypes, onAddField }: FieldCardsProps): react_jsx_runtime.JSX.Element;
|
|
80
|
+
|
|
81
|
+
interface AddFieldDialogProps {
|
|
82
|
+
open: boolean;
|
|
83
|
+
onOpenChange: (open: boolean) => void;
|
|
84
|
+
/**
|
|
85
|
+
* The form surface's catalog, already filtered by the host's excludes;
|
|
86
|
+
* `null` while the host configuration is still loading.
|
|
87
|
+
*/
|
|
88
|
+
entries: readonly FieldTypeCatalogEntry<FormFieldCatalogType>[] | null;
|
|
89
|
+
/** Called with the chosen type; the parent creates and selects the field. */
|
|
90
|
+
onAdd: (type: FormFieldCatalogType) => void;
|
|
60
91
|
}
|
|
61
|
-
declare function
|
|
92
|
+
declare function AddFieldDialog({ open, onOpenChange, entries, onAdd, }: AddFieldDialogProps): react_jsx_runtime.JSX.Element;
|
|
62
93
|
|
|
63
94
|
interface FieldEditorProps {
|
|
64
95
|
/** The field being edited */
|
|
@@ -67,10 +98,6 @@ interface FieldEditorProps {
|
|
|
67
98
|
allFields: FormField[];
|
|
68
99
|
/** Callback when field is updated */
|
|
69
100
|
onUpdate: (updates: Partial<FormField>) => void;
|
|
70
|
-
/** Callback when field is deleted */
|
|
71
|
-
onDelete: () => void;
|
|
72
|
-
/** Callback when field is duplicated */
|
|
73
|
-
onDuplicate?: () => void;
|
|
74
101
|
}
|
|
75
102
|
/**
|
|
76
103
|
* FieldEditor - Field properties configuration panel
|
|
@@ -91,7 +118,7 @@ interface FieldEditorProps {
|
|
|
91
118
|
* />
|
|
92
119
|
* ```
|
|
93
120
|
*/
|
|
94
|
-
declare function FieldEditor({ field, allFields, onUpdate
|
|
121
|
+
declare function FieldEditor({ field, allFields, onUpdate }: FieldEditorProps): react_jsx_runtime.JSX.Element;
|
|
95
122
|
|
|
96
123
|
interface FormPreviewProps {
|
|
97
124
|
/** Array of form fields to preview */
|
|
@@ -101,255 +128,10 @@ interface FormPreviewProps {
|
|
|
101
128
|
name?: string;
|
|
102
129
|
slug?: string;
|
|
103
130
|
description?: string;
|
|
104
|
-
status?: string;
|
|
105
131
|
};
|
|
106
132
|
}
|
|
107
|
-
/**
|
|
108
|
-
* FormPreview - Visual form preview
|
|
109
|
-
*
|
|
110
|
-
* This is a stub component that shows a preview of the form.
|
|
111
|
-
* The full implementation will include:
|
|
112
|
-
* - Rendered form fields with proper styling
|
|
113
|
-
* - Responsive preview modes (desktop, tablet, mobile)
|
|
114
|
-
* - Theme preview options
|
|
115
|
-
* - Conditional logic simulation
|
|
116
|
-
*
|
|
117
|
-
* @example
|
|
118
|
-
* ```tsx
|
|
119
|
-
* <FormPreview fields={fields} formData={formData} />
|
|
120
|
-
* ```
|
|
121
|
-
*/
|
|
122
133
|
declare function FormPreview({ fields, formData }: FormPreviewProps): react_jsx_runtime.JSX.Element;
|
|
123
134
|
|
|
124
|
-
interface FormFieldListProps {
|
|
125
|
-
/**
|
|
126
|
-
* Array of form fields to display.
|
|
127
|
-
*/
|
|
128
|
-
fields: FormField[];
|
|
129
|
-
/**
|
|
130
|
-
* Callback when fields are reordered via drag-and-drop.
|
|
131
|
-
* Receives the new array with fields in updated order.
|
|
132
|
-
*/
|
|
133
|
-
onFieldsChange: (fields: FormField[]) => void;
|
|
134
|
-
/**
|
|
135
|
-
* Callback when a field is selected for editing.
|
|
136
|
-
* Receives the field name (unique identifier).
|
|
137
|
-
*/
|
|
138
|
-
onEditField: (fieldName: string) => void;
|
|
139
|
-
/**
|
|
140
|
-
* Callback when a field should be deleted.
|
|
141
|
-
* Receives the field name (unique identifier).
|
|
142
|
-
*/
|
|
143
|
-
onDeleteField: (fieldName: string) => void;
|
|
144
|
-
/**
|
|
145
|
-
* Currently selected field name for highlighting.
|
|
146
|
-
*/
|
|
147
|
-
selectedFieldName?: string | null;
|
|
148
|
-
/**
|
|
149
|
-
* Whether the list is disabled (no interactions allowed).
|
|
150
|
-
* @default false
|
|
151
|
-
*/
|
|
152
|
-
disabled?: boolean;
|
|
153
|
-
}
|
|
154
|
-
/**
|
|
155
|
-
* FormFieldList provides a drag-and-drop sortable container for form fields.
|
|
156
|
-
*
|
|
157
|
-
* This component wraps fields with DndContext and SortableContext from @dnd-kit,
|
|
158
|
-
* enabling drag-and-drop reordering with full keyboard accessibility.
|
|
159
|
-
*
|
|
160
|
-
* The component follows the pattern established by ArrayInput.tsx in the
|
|
161
|
-
* Nextly admin package:
|
|
162
|
-
* - PointerSensor with 8px activation distance (prevents accidental drags)
|
|
163
|
-
* - KeyboardSensor with sortableKeyboardCoordinates (arrow key navigation)
|
|
164
|
-
* - closestCenter collision detection
|
|
165
|
-
* - verticalListSortingStrategy for vertical lists
|
|
166
|
-
*
|
|
167
|
-
* @example
|
|
168
|
-
* ```tsx
|
|
169
|
-
* <FormFieldList
|
|
170
|
-
* fields={formFields}
|
|
171
|
-
* onFieldsChange={setFormFields}
|
|
172
|
-
* onEditField={(name) => setSelectedField(name)}
|
|
173
|
-
* onDeleteField={(name) => handleDeleteField(name)}
|
|
174
|
-
* selectedFieldName={selectedField}
|
|
175
|
-
* />
|
|
176
|
-
* ```
|
|
177
|
-
*/
|
|
178
|
-
declare function FormFieldList({ fields, onFieldsChange, onEditField, onDeleteField, selectedFieldName, disabled, }: FormFieldListProps): react_jsx_runtime.JSX.Element;
|
|
179
|
-
|
|
180
|
-
interface SortableFieldRowProps {
|
|
181
|
-
/**
|
|
182
|
-
* The form field to display.
|
|
183
|
-
*/
|
|
184
|
-
field: FormField;
|
|
185
|
-
/**
|
|
186
|
-
* Whether this row is currently selected for editing.
|
|
187
|
-
*/
|
|
188
|
-
isSelected: boolean;
|
|
189
|
-
/**
|
|
190
|
-
* Callback when the row is clicked/selected.
|
|
191
|
-
*/
|
|
192
|
-
onSelect: () => void;
|
|
193
|
-
/**
|
|
194
|
-
* Callback when the delete button is clicked.
|
|
195
|
-
*/
|
|
196
|
-
onDelete: () => void;
|
|
197
|
-
/**
|
|
198
|
-
* Whether the row is disabled (no interactions allowed).
|
|
199
|
-
* @default false
|
|
200
|
-
*/
|
|
201
|
-
disabled?: boolean;
|
|
202
|
-
}
|
|
203
|
-
/**
|
|
204
|
-
* SortableFieldRow renders a single draggable field row in the form builder.
|
|
205
|
-
*
|
|
206
|
-
* Uses @dnd-kit's useSortable hook to enable drag-and-drop reordering.
|
|
207
|
-
* The component displays:
|
|
208
|
-
* - A drag handle (GripVertical icon) for reordering
|
|
209
|
-
* - The field type icon
|
|
210
|
-
* - The field label (or name as fallback) with required indicator
|
|
211
|
-
* - The field type badge
|
|
212
|
-
* - A delete button
|
|
213
|
-
*
|
|
214
|
-
* Visual feedback is provided during drag operations:
|
|
215
|
-
* - Reduced opacity (50%)
|
|
216
|
-
* - Primary color ring (2px)
|
|
217
|
-
* - Elevated shadow
|
|
218
|
-
* - Higher z-index
|
|
219
|
-
*
|
|
220
|
-
* @example
|
|
221
|
-
* ```tsx
|
|
222
|
-
* <SortableFieldRow
|
|
223
|
-
* field={field}
|
|
224
|
-
* isSelected={selectedFieldName === field.name}
|
|
225
|
-
* onSelect={() => setSelectedFieldName(field.name)}
|
|
226
|
-
* onDelete={() => handleDeleteField(field.name)}
|
|
227
|
-
* />
|
|
228
|
-
* ```
|
|
229
|
-
*/
|
|
230
|
-
declare function SortableFieldRow({ field, isSelected, onSelect, onDelete, disabled, }: SortableFieldRowProps): react_jsx_runtime.JSX.Element;
|
|
231
|
-
|
|
232
|
-
interface AddFieldButtonProps {
|
|
233
|
-
/**
|
|
234
|
-
* Callback when a new field is created.
|
|
235
|
-
* Receives the newly created FormField instance.
|
|
236
|
-
*/
|
|
237
|
-
onAddField: (field: FormField) => void;
|
|
238
|
-
/**
|
|
239
|
-
* Whether the button is disabled.
|
|
240
|
-
* @default false
|
|
241
|
-
*/
|
|
242
|
-
disabled?: boolean;
|
|
243
|
-
/**
|
|
244
|
-
* Additional CSS class names for the button.
|
|
245
|
-
*/
|
|
246
|
-
className?: string;
|
|
247
|
-
}
|
|
248
|
-
/**
|
|
249
|
-
* AddFieldButton renders a button that opens a modal for selecting field types.
|
|
250
|
-
*
|
|
251
|
-
* When a field type is selected, a new field instance is created with default
|
|
252
|
-
* configuration and passed to the onAddField callback. The modal automatically
|
|
253
|
-
* closes after selection.
|
|
254
|
-
*
|
|
255
|
-
* @example
|
|
256
|
-
* ```tsx
|
|
257
|
-
* <AddFieldButton
|
|
258
|
-
* onAddField={(field) => {
|
|
259
|
-
* setFields([...fields, field]);
|
|
260
|
-
* }}
|
|
261
|
-
* />
|
|
262
|
-
* ```
|
|
263
|
-
*/
|
|
264
|
-
declare function AddFieldButton({ onAddField, disabled, className, }: AddFieldButtonProps): react_jsx_runtime.JSX.Element;
|
|
265
|
-
|
|
266
|
-
interface FieldEditorPanelProps {
|
|
267
|
-
/**
|
|
268
|
-
* The field being edited.
|
|
269
|
-
*/
|
|
270
|
-
field: FormField;
|
|
271
|
-
/**
|
|
272
|
-
* All fields in the form (for references, e.g., conditional logic).
|
|
273
|
-
*/
|
|
274
|
-
allFields: FormField[];
|
|
275
|
-
/**
|
|
276
|
-
* Callback when field properties are updated.
|
|
277
|
-
* Receives partial updates to merge with current field.
|
|
278
|
-
*/
|
|
279
|
-
onUpdate: (updates: Partial<FormField>) => void;
|
|
280
|
-
/**
|
|
281
|
-
* Callback when the panel should be closed.
|
|
282
|
-
*/
|
|
283
|
-
onClose: () => void;
|
|
284
|
-
}
|
|
285
|
-
/**
|
|
286
|
-
* FieldEditorPanel - Right-side panel for editing field properties
|
|
287
|
-
*
|
|
288
|
-
* This component dynamically loads the appropriate field editor based on
|
|
289
|
-
* the field type. Each field type has its own editor component that handles
|
|
290
|
-
* the specific configuration options for that type.
|
|
291
|
-
*
|
|
292
|
-
* The panel displays:
|
|
293
|
-
* - Header with field type icon, type label, and field label
|
|
294
|
-
* - Close button to dismiss the panel
|
|
295
|
-
* - Lazy-loaded editor content with loading skeleton
|
|
296
|
-
*
|
|
297
|
-
* @example
|
|
298
|
-
* ```tsx
|
|
299
|
-
* <FieldEditorPanel
|
|
300
|
-
* field={selectedField}
|
|
301
|
-
* allFields={allFields}
|
|
302
|
-
* onUpdate={(updates) => updateField(selectedField.name, updates)}
|
|
303
|
-
* onClose={() => setSelectedField(null)}
|
|
304
|
-
* />
|
|
305
|
-
* ```
|
|
306
|
-
*/
|
|
307
|
-
declare function FieldEditorPanel({ field, allFields, onUpdate, onClose, }: FieldEditorPanelProps): react_jsx_runtime.JSX.Element;
|
|
308
|
-
|
|
309
|
-
/** Form settings configuration */
|
|
310
|
-
interface FormSettings {
|
|
311
|
-
/** Submit button text */
|
|
312
|
-
submitButtonText: string;
|
|
313
|
-
/** Show reset button */
|
|
314
|
-
showResetButton: boolean;
|
|
315
|
-
/** Reset button text */
|
|
316
|
-
resetButtonText: string;
|
|
317
|
-
/** Success message after submission */
|
|
318
|
-
confirmationMessage: string;
|
|
319
|
-
/** Redirect URL after submission (optional) */
|
|
320
|
-
redirectUrl?: string;
|
|
321
|
-
/** Enable honeypot spam protection */
|
|
322
|
-
honeypotEnabled: boolean;
|
|
323
|
-
/** Enable CAPTCHA */
|
|
324
|
-
captchaEnabled: boolean;
|
|
325
|
-
/** Store submissions in database */
|
|
326
|
-
storeSubmissions: boolean;
|
|
327
|
-
/** Limit submissions per user/IP */
|
|
328
|
-
submissionLimit?: number;
|
|
329
|
-
}
|
|
330
|
-
/** Email notification configuration */
|
|
331
|
-
interface FormNotification {
|
|
332
|
-
/** Unique ID for this notification */
|
|
333
|
-
id: string;
|
|
334
|
-
/** Notification name */
|
|
335
|
-
name: string;
|
|
336
|
-
/** Whether this notification is enabled */
|
|
337
|
-
enabled: boolean;
|
|
338
|
-
/** ID of the email provider to use; undefined = system default */
|
|
339
|
-
providerId?: string;
|
|
340
|
-
/** Sender email override; undefined = use provider's configured address */
|
|
341
|
-
senderEmail?: string;
|
|
342
|
-
/** How the recipient address is determined */
|
|
343
|
-
recipientType: "static" | "field";
|
|
344
|
-
/** Recipient address: static email or a {{fieldName}} reference */
|
|
345
|
-
to: string;
|
|
346
|
-
/** CC email addresses */
|
|
347
|
-
cc: string[];
|
|
348
|
-
/** BCC email addresses */
|
|
349
|
-
bcc: string[];
|
|
350
|
-
/** Slug of the email template to use */
|
|
351
|
-
templateSlug?: string;
|
|
352
|
-
}
|
|
353
135
|
interface FormBuilderState {
|
|
354
136
|
/** Form fields array */
|
|
355
137
|
fields: FormField[];
|
|
@@ -395,10 +177,14 @@ interface FormBuilderActions {
|
|
|
395
177
|
updateSettings: (updates: Partial<FormSettings>) => void;
|
|
396
178
|
/** Add a notification */
|
|
397
179
|
addNotification: (notification: FormNotification) => void;
|
|
180
|
+
/** Duplicate a notification (the copy starts disabled) */
|
|
181
|
+
duplicateNotification: (id: string) => void;
|
|
398
182
|
/** Update a notification */
|
|
399
183
|
updateNotification: (id: string, updates: Partial<FormNotification>) => void;
|
|
400
184
|
/** Delete a notification */
|
|
401
185
|
deleteNotification: (id: string) => void;
|
|
186
|
+
/** Seed default notifications into an empty list without dirtying the form */
|
|
187
|
+
seedNotifications: (rules: FormNotification[]) => void;
|
|
402
188
|
/** Mark form as saved (clears dirty flag) */
|
|
403
189
|
markAsSaved: () => void;
|
|
404
190
|
}
|
|
@@ -419,22 +205,26 @@ interface FormBuilderProviderProps {
|
|
|
419
205
|
/** Child components */
|
|
420
206
|
children: ReactNode;
|
|
421
207
|
}
|
|
422
|
-
/** Default form settings */
|
|
208
|
+
/** Default form settings (the canonical defaults from the settings reader) */
|
|
423
209
|
declare const DEFAULT_SETTINGS: FormSettings;
|
|
424
|
-
/** Create a new
|
|
210
|
+
/** Create a new notification rule with default values */
|
|
425
211
|
declare function createNotification(): FormNotification;
|
|
426
212
|
/**
|
|
427
|
-
* Generate a unique field name
|
|
213
|
+
* Generate a readable unique field name: the type itself for the first
|
|
214
|
+
* field of that type, then a numeric suffix (`email`, `email_2`, ...).
|
|
215
|
+
* Names key submission data, so they should read like keys a developer
|
|
216
|
+
* would have chosen, not timestamps.
|
|
428
217
|
*/
|
|
429
|
-
declare function generateFieldName(type: FormFieldType): string;
|
|
218
|
+
declare function generateFieldName(type: FormFieldType, existingNames?: readonly string[]): string;
|
|
430
219
|
/**
|
|
431
|
-
* Generate a human-readable label from field type
|
|
220
|
+
* Generate a human-readable label from field type, using the shared catalog
|
|
221
|
+
* so a new field's default label matches what the picker called the type.
|
|
432
222
|
*/
|
|
433
223
|
declare function generateFieldLabel(type: FormFieldType): string;
|
|
434
224
|
/**
|
|
435
225
|
* Create a new field from a field type with default values.
|
|
436
226
|
*/
|
|
437
|
-
declare function createFieldFromType(type: FormFieldType): FormField;
|
|
227
|
+
declare function createFieldFromType(type: FormFieldType, existingNames?: readonly string[]): FormField;
|
|
438
228
|
/**
|
|
439
229
|
* FormBuilderProvider - Provides form builder state to child components
|
|
440
230
|
*
|
|
@@ -487,24 +277,32 @@ declare function useFormBuilder(): FormBuilderContextValue;
|
|
|
487
277
|
*/
|
|
488
278
|
declare function useOptionalFormBuilder(): FormBuilderContextValue | null;
|
|
489
279
|
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
declare function FormSettingsTab(): react_jsx_runtime.JSX.Element;
|
|
280
|
+
interface SpamDefaults {
|
|
281
|
+
honeypot?: boolean;
|
|
282
|
+
recaptchaEnabled?: boolean;
|
|
283
|
+
}
|
|
284
|
+
interface FormSettingsTabProps {
|
|
285
|
+
/** Plugin-level spam defaults (from builder-config); null while loading. */
|
|
286
|
+
spamDefaults: SpamDefaults | null;
|
|
287
|
+
}
|
|
288
|
+
declare function FormSettingsTab({ spamDefaults }: FormSettingsTabProps): react_jsx_runtime.JSX.Element;
|
|
499
289
|
|
|
290
|
+
/** Host-level notification defaults surfaced by the builder-config route. */
|
|
291
|
+
interface NotificationDefaults {
|
|
292
|
+
defaultFrom?: string;
|
|
293
|
+
defaultToEmail?: string;
|
|
294
|
+
}
|
|
295
|
+
interface FormNotificationsTabProps {
|
|
296
|
+
/** `null` while the builder-config request is still settling. */
|
|
297
|
+
defaults: NotificationDefaults | null;
|
|
298
|
+
}
|
|
500
299
|
/**
|
|
501
|
-
* FormNotificationsTab -
|
|
300
|
+
* FormNotificationsTab - the form's notification rules.
|
|
502
301
|
*
|
|
503
|
-
*
|
|
504
|
-
*
|
|
505
|
-
* template rather than duplicating provider credentials.
|
|
302
|
+
* Each rule references an existing email provider and template rather than
|
|
303
|
+
* duplicating provider credentials or embedding a second template editor.
|
|
506
304
|
*/
|
|
507
|
-
declare function FormNotificationsTab(): react_jsx_runtime.JSX.Element;
|
|
305
|
+
declare function FormNotificationsTab({ defaults }: FormNotificationsTabProps): react_jsx_runtime.JSX.Element;
|
|
508
306
|
|
|
509
307
|
/**
|
|
510
308
|
* Form Builder Admin Components
|
|
@@ -526,7 +324,7 @@ declare function FormNotificationsTab(): react_jsx_runtime.JSX.Element;
|
|
|
526
324
|
|
|
527
325
|
/** Component path for FormBuilderView */
|
|
528
326
|
declare const FORM_BUILDER_VIEW_PATH: ComponentPath;
|
|
529
|
-
/** Component path for
|
|
530
|
-
declare const
|
|
327
|
+
/** Component path for SubmissionsView */
|
|
328
|
+
declare const SUBMISSIONS_VIEW_PATH: ComponentPath;
|
|
531
329
|
|
|
532
|
-
export {
|
|
330
|
+
export { AddFieldDialog, type AddFieldDialogProps, DEFAULT_SETTINGS, FORM_BUILDER_VIEW_PATH, FieldCards, type FieldCardsProps, FieldEditor, type FieldEditorProps, type FormBuilderActions, type FormBuilderContextValue, FormBuilderProvider, type FormBuilderProviderProps, type FormBuilderState, FormBuilderView, type FormBuilderViewProps, FormNotification, FormNotificationsTab, FormPreview, type FormPreviewProps, FormSettings, FormSettingsTab, SUBMISSIONS_VIEW_PATH, SubmissionSheet, SubmissionsView, createFieldFromType, createNotification, generateFieldLabel, generateFieldName, useFormBuilder, useOptionalFormBuilder };
|