@multivendorx/zyra 1.0.64 → 1.0.65

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 (125) hide show
  1. package/build/index.d.ts +1 -0
  2. package/build/index.js +6770 -6158
  3. package/build/index.js.map +1 -1
  4. package/build/index.mjs +6770 -6158
  5. package/build/index.mjs.map +1 -1
  6. package/build/types/builderform/src/EmailBuilder.d.ts +29 -0
  7. package/build/types/builderform/src/EmailTemplateEditorPopup.d.ts +16 -0
  8. package/build/types/builderform/src/FormBuilder/Builder.d.ts +11 -0
  9. package/build/types/builderform/src/FormBuilder/Canvas.d.ts +23 -0
  10. package/build/types/builderform/src/FormBuilder/FormBuilder.d.ts +13 -0
  11. package/build/types/builderform/src/FormBuilder/FormSettings.d.ts +19 -0
  12. package/build/types/builderform/src/FormBuilder/Inspector.d.ts +14 -0
  13. package/build/types/builderform/src/FormBuilder/Share.d.ts +10 -0
  14. package/build/types/builderform/src/FormBuilder/When.d.ts +20 -0
  15. package/build/types/builderform/src/FormBuilder/extensions.d.ts +97 -0
  16. package/build/types/builderform/src/FormBuilder/fields.d.ts +36 -0
  17. package/build/types/builderform/src/FormBuilder/index.d.ts +5 -0
  18. package/build/types/builderform/src/FormBuilder/route.d.ts +10 -0
  19. package/build/types/builderform/src/FormBuilder/runtime.d.ts +87 -0
  20. package/build/types/builderform/src/FormBuilder/types.d.ts +151 -0
  21. package/build/types/builderform/src/Switch.d.ts +9 -0
  22. package/build/types/builderform/src/emailBlockTypes.d.ts +89 -0
  23. package/build/types/builderform/src/index.d.ts +9 -0
  24. package/build/types/builderform/src/legacyEmailAdapter.d.ts +40 -0
  25. package/build/types/bundle/src/fieldRegistry.d.ts +1 -0
  26. package/build/types/bundle/src/index.d.ts +6 -0
  27. package/build/types/components/src/ActivityListComponent.d.ts +39 -0
  28. package/build/types/components/src/AnalyticsComponent.d.ts +56 -0
  29. package/build/types/components/src/AppShellComponent.d.ts +64 -0
  30. package/build/types/components/src/AuthLayoutComponent.d.ts +26 -0
  31. package/build/types/components/src/AvatarComponent.d.ts +13 -0
  32. package/build/types/components/src/BadgeComponent.d.ts +30 -0
  33. package/build/types/components/src/BrandComponent.d.ts +18 -0
  34. package/build/types/components/src/CardComponent.d.ts +25 -0
  35. package/build/types/components/src/ChartComponent.d.ts +58 -0
  36. package/build/types/components/src/ChoiceCardComponent.d.ts +41 -0
  37. package/build/types/components/src/ClipboardComponent.d.ts +13 -0
  38. package/build/types/components/src/ColumnComponent.d.ts +11 -0
  39. package/build/types/components/src/ContainerComponent.d.ts +11 -0
  40. package/build/types/components/src/CustomRecaptchaComponent.d.ts +2 -0
  41. package/build/types/components/src/EntityCellComponent.d.ts +30 -0
  42. package/build/types/components/src/FilterComponent.d.ts +20 -0
  43. package/build/types/components/src/FormGroupComponent.d.ts +19 -0
  44. package/build/types/components/src/FormGroupWrapperComponent.d.ts +10 -0
  45. package/build/types/components/src/FullPageLoadingComponent.d.ts +14 -0
  46. package/build/types/components/src/HeaderComponent.d.ts +93 -0
  47. package/build/types/components/src/HeaderSearchComponent.d.ts +32 -0
  48. package/build/types/components/src/IconComponent.d.ts +12 -0
  49. package/build/types/components/src/InformationItemComponent.d.ts +38 -0
  50. package/build/types/components/src/LegendComponent.d.ts +52 -0
  51. package/build/types/components/src/ListComponent.d.ts +47 -0
  52. package/build/types/components/src/ListToolbarComponent.d.ts +53 -0
  53. package/build/types/components/src/MapComponent.d.ts +33 -0
  54. package/build/types/components/src/MetricTileComponent.d.ts +174 -0
  55. package/build/types/components/src/ModuleGridComponent.d.ts +74 -0
  56. package/build/types/components/src/ModuleGuardComponent.d.ts +17 -0
  57. package/build/types/components/src/NavigatorComponent.d.ts +111 -0
  58. package/build/types/components/src/NoticeComponent.d.ts +48 -0
  59. package/build/types/components/src/PopupComponent.d.ts +28 -0
  60. package/build/types/components/src/RecaptchaComponent.d.ts +11 -0
  61. package/build/types/components/src/SaveStatusComponent.d.ts +18 -0
  62. package/build/types/components/src/ScoreRingComponent.d.ts +16 -0
  63. package/build/types/components/src/SectionComponent.d.ts +18 -0
  64. package/build/types/components/src/SettingRowComponent.d.ts +134 -0
  65. package/build/types/components/src/SettingsSectionComponent.d.ts +24 -0
  66. package/build/types/components/src/SetupWizardComponent.d.ts +75 -0
  67. package/build/types/components/src/SkeletonComponent.d.ts +11 -0
  68. package/build/types/components/src/SystemInfoComponent.d.ts +11 -0
  69. package/build/types/components/src/TabsComponent.d.ts +34 -0
  70. package/build/types/components/src/ThemeChoiceComponent.d.ts +19 -0
  71. package/build/types/components/src/TooltipComponent.d.ts +12 -0
  72. package/build/types/components/src/TourComponent.d.ts +26 -0
  73. package/build/types/components/src/TrendIndicatorComponent.d.ts +21 -0
  74. package/build/types/components/src/TrendStatComponent.d.ts +34 -0
  75. package/build/types/components/src/TypographyComponent.d.ts +58 -0
  76. package/build/types/components/src/index.d.ts +84 -0
  77. package/build/types/components/src/paletteClass.d.ts +3 -0
  78. package/build/types/core/src/ModuleContext.d.ts +8 -0
  79. package/build/types/core/src/SettingContext.d.ts +17 -0
  80. package/build/types/core/src/ThemeContext.d.ts +20 -0
  81. package/build/types/core/src/apiService.d.ts +38 -0
  82. package/build/types/core/src/blockStyle.d.ts +63 -0
  83. package/build/types/core/src/colorPalette.d.ts +41 -0
  84. package/build/types/core/src/index.d.ts +14 -0
  85. package/build/types/core/src/utils.d.ts +1165 -0
  86. package/build/types/inputs/src/AddressInput.d.ts +24 -0
  87. package/build/types/inputs/src/ButtonInput.d.ts +53 -0
  88. package/build/types/inputs/src/CalendarInput.d.ts +46 -0
  89. package/build/types/inputs/src/DecoratedInput.d.ts +11 -0
  90. package/build/types/inputs/src/DynamicRowInput.d.ts +42 -0
  91. package/build/types/inputs/src/EmailInput.d.ts +15 -0
  92. package/build/types/inputs/src/EndpointInput.d.ts +4 -0
  93. package/build/types/inputs/src/EventCalendarInput.d.ts +25 -0
  94. package/build/types/inputs/src/ExpandablePanelInput.d.ts +116 -0
  95. package/build/types/inputs/src/FileInput.d.ts +39 -0
  96. package/build/types/inputs/src/InputRenderer.d.ts +94 -0
  97. package/build/types/inputs/src/LogViewerInput.d.ts +13 -0
  98. package/build/types/inputs/src/MultiCheckboxInput.d.ts +48 -0
  99. package/build/types/inputs/src/NestedInput.d.ts +54 -0
  100. package/build/types/inputs/src/PhoneInput.d.ts +29 -0
  101. package/build/types/inputs/src/PickerInput.d.ts +77 -0
  102. package/build/types/inputs/src/RandomkeyInput.d.ts +14 -0
  103. package/build/types/inputs/src/RichTextInput.d.ts +30 -0
  104. package/build/types/inputs/src/SelectInput.d.ts +40 -0
  105. package/build/types/inputs/src/SetupWizardInput.d.ts +50 -0
  106. package/build/types/inputs/src/ShortcodeTableInput.d.ts +23 -0
  107. package/build/types/inputs/src/TableInput.d.ts +72 -0
  108. package/build/types/inputs/src/TaskExecutorInput.d.ts +30 -0
  109. package/build/types/inputs/src/TextAreaInput.d.ts +27 -0
  110. package/build/types/inputs/src/TextInput.d.ts +33 -0
  111. package/build/types/inputs/src/ToggleInput.d.ts +37 -0
  112. package/build/types/inputs/src/index.d.ts +53 -0
  113. package/build/types/table/src/Table.d.ts +4 -0
  114. package/build/types/table/src/TableActionButtons.d.ts +16 -0
  115. package/build/types/table/src/TableBulkActions.d.ts +19 -0
  116. package/build/types/table/src/TableCard.d.ts +10 -0
  117. package/build/types/table/src/TableEditable.d.ts +18 -0
  118. package/build/types/table/src/TableFilter.d.ts +19 -0
  119. package/build/types/table/src/TablePagination.d.ts +17 -0
  120. package/build/types/table/src/TableRowActions.d.ts +17 -0
  121. package/build/types/table/src/TableUtils.d.ts +3 -0
  122. package/build/types/table/src/index.d.ts +5 -0
  123. package/build/types/table/src/tableLabels.d.ts +14 -0
  124. package/build/types/table/src/types.d.ts +166 -0
  125. package/package.json +2 -3
@@ -0,0 +1,29 @@
1
+ import React from 'react';
2
+ import './EmailBuilder.scss';
3
+ import { type EmailBlock } from './emailBlockTypes';
4
+ export interface EmailTemplate {
5
+ id: string;
6
+ name: string;
7
+ previewText?: string;
8
+ blocks: EmailBlock[];
9
+ }
10
+ export interface EmailBuilderProps {
11
+ value?: EmailBlock[];
12
+ onChange?: (blocks: EmailBlock[]) => void;
13
+ /** Optional — when supplied, the palette head gets a "Blocks /
14
+ * Templates" tab switcher and the Templates tab lists these for
15
+ * picking a starting point. Omit to show the block palette only. */
16
+ templates?: EmailTemplate[];
17
+ activeTemplateId?: string;
18
+ onTemplateSelect?: (id: string) => void;
19
+ /** Overrides the "Insert a tag" list, e.g. `[store_name]`-style tokens
20
+ * for a consumer whose backend uses a different placeholder syntax. */
21
+ mergeTags?: {
22
+ token: string;
23
+ label: string;
24
+ }[];
25
+ /** Translations of the builder's own texts, keyed by the English text (e.g. `{ 'Add a block': '…' }`); any text not listed stays English. */
26
+ labels?: Record<string, string>;
27
+ }
28
+ export declare const EmailBuilder: React.FC<EmailBuilderProps>;
29
+ export default EmailBuilder;
@@ -0,0 +1,16 @@
1
+ import React from 'react';
2
+ import { type EmailBuilderProps } from './EmailBuilder';
3
+ export interface EmailTemplateEditorPopupProps {
4
+ open: boolean;
5
+ onClose: () => void;
6
+ title: string;
7
+ icon?: string;
8
+ value: EmailBuilderProps['value'];
9
+ onChange: EmailBuilderProps['onChange'];
10
+ templates?: EmailBuilderProps['templates'];
11
+ activeTemplateId?: EmailBuilderProps['activeTemplateId'];
12
+ onTemplateSelect?: EmailBuilderProps['onTemplateSelect'];
13
+ mergeTags?: EmailBuilderProps['mergeTags'];
14
+ }
15
+ export declare const EmailTemplateEditorPopup: React.FC<EmailTemplateEditorPopupProps>;
16
+ export default EmailTemplateEditorPopup;
@@ -0,0 +1,11 @@
1
+ /**
2
+ * The form builder.
3
+ *
4
+ * One snapshot (title, fields, settings) is the source of truth; the palette, canvas, field
5
+ * settings and form settings all read from it and report changes back here. Every change goes
6
+ * through commit(), which is what makes the unsaved-changes warning work.
7
+ */
8
+ declare const Builder: ({ formId }: {
9
+ formId: number;
10
+ }) => import("react").JSX.Element;
11
+ export default Builder;
@@ -0,0 +1,23 @@
1
+ import type { ReactNode } from 'react';
2
+ import type { Field } from './types';
3
+ interface CanvasProps {
4
+ fields: Field[];
5
+ selectedId: string;
6
+ onChange: (fields: Field[], selectId?: string) => void;
7
+ onSelect: (id: string) => void;
8
+ onDuplicate: (id: string) => void;
9
+ onDelete: (id: string) => void;
10
+ /** Id of the form's template, which can have a field library of its own. */
11
+ template?: string;
12
+ /** Shown under the fields: what belongs to the form as a whole but is managed alongside them. */
13
+ footer?: ReactNode;
14
+ }
15
+ /**
16
+ * The field library and the form canvas.
17
+ *
18
+ * A field is added by dragging its type onto the canvas, or by clicking it (or pressing Enter on
19
+ * it), which appends it after the selected field. Fields are reordered by dragging their handle or
20
+ * with the Move up / Move down buttons, so everything works without a pointer.
21
+ */
22
+ declare const Canvas: ({ fields, selectedId, onChange, onSelect, onDuplicate, onDelete, template, footer }: CanvasProps) => import("react").JSX.Element;
23
+ export default Canvas;
@@ -0,0 +1,13 @@
1
+ import './FormBuilder.scss';
2
+ import type { FormBuilderConfig } from './runtime';
3
+ export interface FormBuilderProps extends FormBuilderConfig {
4
+ /** The form to open. */
5
+ formId: number;
6
+ }
7
+ /**
8
+ * A drag-and-drop form builder: a field library, the form being built, the settings of the selected
9
+ * field, and the form's own settings, with autosave. It holds nothing of any one product: the host
10
+ * gives it the REST client, translations, notices, URL scheme, localized data and extension points.
11
+ */
12
+ export declare const FormBuilder: ({ formId, ...config }: FormBuilderProps) => import("react").JSX.Element;
13
+ export default FormBuilder;
@@ -0,0 +1,19 @@
1
+ import type { Field, FormSettings as Settings } from './types';
2
+ interface FormSettingsProps {
3
+ settings: Settings;
4
+ fields: Field[];
5
+ onChange: (settings: Settings) => void;
6
+ /** Changes the settings and adds an Email field to the form, as one step. */
7
+ onChangeWithEmailField?: (settings: (emailKey: string) => Settings) => void;
8
+ }
9
+ /** The group to return to when the Settings tab is opened again, as named in the URL. */
10
+ export declare const lastSection: () => string;
11
+ /** Opens a group of the Settings tab, by its id (`webhooks`) or its name in the URL. */
12
+ export declare const openSettingsGroup: (id: string) => void;
13
+ /**
14
+ * Everything about a form that isn't a field, in the order people need it: who is told, what the
15
+ * visitor sees, how the form looks, spam, and connections to other services. One group at a time,
16
+ * each laid out like the other VuloLabs settings screens.
17
+ */
18
+ declare const FormSettings: ({ settings, fields, onChange, onChangeWithEmailField }: FormSettingsProps) => import("react").JSX.Element;
19
+ export default FormSettings;
@@ -0,0 +1,14 @@
1
+ import type { Field } from './types';
2
+ interface InspectorProps {
3
+ template?: string;
4
+ field: Field | undefined;
5
+ fields: Field[];
6
+ onChange: (field: Field) => void;
7
+ /** Adds a field just before the selected one and changes the selected one, as a single step. */
8
+ onAddField?: (type: string, label: string, key: string, patch: Partial<Field>) => void;
9
+ }
10
+ /**
11
+ * Settings for the selected field. Only the controls that apply to its type are shown.
12
+ */
13
+ declare const Inspector: ({ template, field, fields, onChange, onAddField }: InspectorProps) => import("react").JSX.Element;
14
+ export default Inspector;
@@ -0,0 +1,10 @@
1
+ import type { Form } from './types';
2
+ /**
3
+ * How to put the form in front of people: on this site, on another site, or moved to another
4
+ * WordPress altogether.
5
+ */
6
+ declare const Share: ({ form, exportJson }: {
7
+ form: Form;
8
+ exportJson: () => void;
9
+ }) => import("react").JSX.Element;
10
+ export default Share;
@@ -0,0 +1,20 @@
1
+ import type { Field, When as WhenValue } from './types';
2
+ export declare const getOperators: () => {
3
+ value: string;
4
+ label: string;
5
+ }[];
6
+ export declare const NO_CONDITIONS: WhenValue;
7
+ interface WhenProps {
8
+ /** Unique within the screen; prefixes the inputs' names. */
9
+ name: string;
10
+ value: WhenValue | undefined;
11
+ fields: Field[];
12
+ onChange: (value: WhenValue) => void;
13
+ }
14
+ /**
15
+ * The rules that decide whether a notification, a webhook or an alternative confirmation applies
16
+ * to a submission: one or more "this answer is that" lines. The server evaluates them
17
+ * (classes/Forms/Conditions.php); a field hidden by its own conditional logic counts as empty.
18
+ */
19
+ declare const When: ({ name, value, fields, onChange }: WhenProps) => import("react").JSX.Element;
20
+ export default When;
@@ -0,0 +1,97 @@
1
+ import type { ComponentType, ReactNode } from 'react';
2
+ import type { Field, FormSettings } from './types';
3
+ /**
4
+ * Extension points of the form builder: what a host plugin can add to the settings of a field and
5
+ * to the form's settings. The host supplies them through `<FormBuilder slots={…}>`.
6
+ */
7
+ /** Layout pieces handed to a form-settings section, so it looks like the built-in ones. */
8
+ export interface SectionKit {
9
+ Section: ComponentType<{
10
+ icon: string;
11
+ title: string;
12
+ desc?: ReactNode;
13
+ action?: ReactNode;
14
+ children: ReactNode;
15
+ }>;
16
+ Row: ComponentType<{
17
+ label?: string;
18
+ desc?: ReactNode;
19
+ children: ReactNode;
20
+ }>;
21
+ Wide: ComponentType<{
22
+ children: ReactNode;
23
+ }>;
24
+ /** One collapsible line of a list, as notifications and webhooks use. */
25
+ Item: ComponentType<{
26
+ icon: string;
27
+ name: string;
28
+ fallbackName: string;
29
+ onRename: (name: string) => void;
30
+ summary: string;
31
+ enabled: boolean;
32
+ isOpen: boolean;
33
+ onToggleOpen: () => void;
34
+ onEnabled: (enabled: boolean) => void;
35
+ onRemove: () => void;
36
+ children: ReactNode;
37
+ }>;
38
+ Segmented: ComponentType<{
39
+ label: string;
40
+ value: string;
41
+ options: {
42
+ value: string;
43
+ label: string;
44
+ }[];
45
+ onChange: (value: string) => void;
46
+ }>;
47
+ Switch: ComponentType<{
48
+ name: string;
49
+ label: string;
50
+ desc?: string;
51
+ checked: boolean;
52
+ onChange: (checked: boolean) => void;
53
+ }>;
54
+ }
55
+ /** `vuloform_form_settings_sections`: a sub-tab on the Settings tab of the builder. */
56
+ export interface FormSettingsSection {
57
+ /** The extension id: the key its value is stored under in `settings.extensions`. */
58
+ id: string;
59
+ title: string;
60
+ icon: string;
61
+ /**
62
+ * `integrations` puts it inside the Integrations group, above the webhooks, instead of giving it
63
+ * a sub-tab. Its stored value should then keep its entries in an `items` array, which is what the
64
+ * count on the Integrations tab adds up.
65
+ */
66
+ placement?: 'integrations';
67
+ /**
68
+ * For `placement: 'integrations'`: what this extension adds to the form's one "Add integration"
69
+ * chooser, and how to add one. `add` returns the extension's new value; it must not change
70
+ * anything else. The component then draws the extension's entries and nothing around them.
71
+ */
72
+ connectors?: {
73
+ id: string;
74
+ label: string;
75
+ desc: string;
76
+ icon?: string;
77
+ }[];
78
+ add?: (connector: string, value: Record<string, unknown>, fields: Field[]) => Record<string, unknown>;
79
+ Component: ComponentType<{
80
+ ui: SectionKit;
81
+ /** This extension's stored settings for the form (`settings.extensions[id]`). */
82
+ value: Record<string, unknown>;
83
+ onChange: (value: Record<string, unknown>) => void;
84
+ settings: FormSettings;
85
+ fields: Field[];
86
+ }>;
87
+ }
88
+ /** `vuloform_inspector_sections`: a section in the settings of the selected field. */
89
+ export interface InspectorSection {
90
+ id: string;
91
+ applies: (field: Field) => boolean;
92
+ Component: ComponentType<{
93
+ field: Field;
94
+ fields: Field[];
95
+ onChange: (patch: Partial<Field>) => void;
96
+ }>;
97
+ }
@@ -0,0 +1,36 @@
1
+ import type { Field, FieldType, PaletteItem } from './types';
2
+ export declare const fieldTypes: () => FieldType[];
3
+ export declare const fieldType: (id: string) => FieldType | undefined;
4
+ export declare const supports: (field: Field, feature: string) => boolean;
5
+ /** Turns a label into a field key: lower case letters, digits and underscores. */
6
+ export declare const slug: (text: string) => string;
7
+ /** A key no other field uses. */
8
+ export declare const uniqueKey: (wanted: string, fields: Field[], ownId?: string) => string;
9
+ export declare const paletteGroups: (template: string | undefined, standard: {
10
+ id: string;
11
+ label: string;
12
+ }[]) => {
13
+ id: string;
14
+ label: string;
15
+ items: PaletteItem[];
16
+ }[];
17
+ /** What the form's template locks about a field: it is always required, and/or can't be deleted. */
18
+ export declare const lockOf: (template: string | undefined, field: Field) => {
19
+ required?: boolean;
20
+ delete?: boolean;
21
+ };
22
+ /** A new field of the given type, with sensible starting values. A preset also sets its own label, key and placeholder. */
23
+ export declare const createField: (type: string, fields: Field[], preset?: PaletteItem) => Field;
24
+ /** A copy of a field with its own id and key. */
25
+ export declare const duplicateField: (field: Field, fields: Field[]) => Field;
26
+ /**
27
+ * Checks a calculation the way the server will (numbers, `{field}` names, + - * /, brackets) and
28
+ * says it back in words, so a formula can be read by someone who would never write one.
29
+ *
30
+ * @param formula What was typed, such as `{qty} * 12.5`.
31
+ * @param names Field key => label, for the number fields of the form.
32
+ */
33
+ export declare const explainFormula: (formula: string, names: Record<string, string>) => {
34
+ ok: boolean;
35
+ text: string;
36
+ };
@@ -0,0 +1,5 @@
1
+ export { FormBuilder, default } from './FormBuilder';
2
+ export type { FormBuilderProps } from './FormBuilder';
3
+ export type { FormBuilderApi, FormBuilderConfig, FormBuilderData, FormBuilderI18n, FormBuilderRoute, FormBuilderSlots, } from './runtime';
4
+ export type { FormSettingsSection, InspectorSection, SectionKit } from './extensions';
5
+ export type { ConfirmationRule, Conditions, Field, FieldType, Form, FormSettings, Notification, Option, PaletteGroup, PaletteItem, Rule, Schema, Webhook, When, } from './types';
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Where in a form's builder the admin is, kept in the URL hash so a place can be linked to,
3
+ * reloaded and reached with the browser's Back button:
4
+ * `subtab=settings&section=integrations`.
5
+ */
6
+ export type BuilderTab = 'fields' | 'settings' | 'share';
7
+ /** The builder tab a URL hash asks for; Fields when it names none. */
8
+ export declare const tabFromHash: (hash: string) => BuilderTab;
9
+ /** The settings group a URL hash asks for, as written in the URL, or ''. */
10
+ export declare const sectionFromHash: (hash: string) => string;
@@ -0,0 +1,87 @@
1
+ import type { ComponentType, ElementType, ReactNode } from 'react';
2
+ import type { FieldType, PaletteGroup } from './types';
3
+ import type { FormSettingsSection, InspectorSection } from './extensions';
4
+ /**
5
+ * Everything the form builder takes from the app around it, so it holds nothing of any one product:
6
+ * translations, the REST client, notices, the URL scheme, the data the server localizes and the
7
+ * extension points. `<FormBuilder>` binds it before anything renders.
8
+ */
9
+ export interface FormBuilderI18n {
10
+ /** Translates a string. The English text is the key. */
11
+ __: (text: string) => string;
12
+ /** Translates a singular/plural pair. */
13
+ _n: (single: string, plural: string, count: number) => string;
14
+ }
15
+ export interface FormBuilderApi {
16
+ get: <T>(endpoint: string, params?: Record<string, string | number | undefined>) => Promise<T>;
17
+ post: <T>(endpoint: string, data?: unknown) => Promise<T>;
18
+ }
19
+ export interface FormBuilderRoute {
20
+ /** A hook returning the current location hash, so the builder re-renders when it changes. */
21
+ useHash: () => string;
22
+ /** The hash for a place in the open form's builder, without the leading `#`. */
23
+ hashFor: (tab: 'fields' | 'settings' | 'share', section?: string) => string;
24
+ /** The full address for the same place, for links. */
25
+ urlFor: (tab: 'fields' | 'settings' | 'share', section?: string) => string;
26
+ /** Goes to a place in the open form's builder. */
27
+ go: (tab: 'fields' | 'settings' | 'share', section?: string) => void;
28
+ /** Sets the location hash as it is given, without the leading `#`. */
29
+ setHash: (hash: string) => void;
30
+ /** Back to the list of forms. */
31
+ goToList: () => void;
32
+ /** Address of the list of forms. */
33
+ listHref: string;
34
+ /** Where the spam-protection settings are. */
35
+ spamSettingsHref: string;
36
+ /** The router's link component, for the navigators. */
37
+ Link: ElementType;
38
+ }
39
+ /** What the server localizes for the builder. */
40
+ export interface FormBuilderData {
41
+ admin_email: string;
42
+ field_types: FieldType[];
43
+ palettes: Record<string, PaletteGroup[]>;
44
+ /** Template id => field key => what is locked about that field. */
45
+ locked: Record<string, Record<string, {
46
+ required?: boolean;
47
+ delete?: boolean;
48
+ }>>;
49
+ file_types: string[];
50
+ name_parts: Record<string, string>;
51
+ address_parts: Record<string, string>;
52
+ /** Whether email goes through a mailer plugin, and whether text messages can be sent at all. */
53
+ has_vulomail: boolean;
54
+ sms_available: boolean;
55
+ /** Where that mailer is set up. */
56
+ vulomail_url: string;
57
+ recaptcha_ready: boolean;
58
+ }
59
+ export interface FormBuilderSlots {
60
+ inspectorSections: () => InspectorSection[];
61
+ formSettingsSections: () => FormSettingsSection[];
62
+ }
63
+ export interface FormBuilderConfig {
64
+ /** Translates the builder's text. Leave out to show it in English. */
65
+ i18n?: FormBuilderI18n;
66
+ api: FormBuilderApi;
67
+ /** A floating notice. */
68
+ notify: (type: 'success' | 'error' | 'info', message: string) => void;
69
+ route: FormBuilderRoute;
70
+ data: FormBuilderData;
71
+ slots: FormBuilderSlots;
72
+ /** Starts the public form script on the preview once its HTML is in the page. */
73
+ onPreviewReady?: (root: Element) => void;
74
+ }
75
+ export declare const runtime: FormBuilderConfig & {
76
+ i18n: FormBuilderI18n;
77
+ errorMessage: (error: unknown) => string;
78
+ };
79
+ /** Binds the builder to its host. Called by `<FormBuilder>` before it renders. */
80
+ export declare const bindRuntime: (config: FormBuilderConfig) => void;
81
+ export declare const __: (text: string) => string;
82
+ export declare const _n: (single: string, plural: string, count: number) => string;
83
+ /** `%s`, `%d`, `%1$s` and `%%`, as WordPress's own sprintf. */
84
+ export declare const sprintf: (format: string, ...args: unknown[]) => string;
85
+ /** Turns the part of a sentence between `<a>` and `</a>` into a link. */
86
+ export declare const interpolateLink: (text: string, href: string) => ReactNode;
87
+ export type { ComponentType };
@@ -0,0 +1,151 @@
1
+ export interface FieldType {
2
+ id: string;
3
+ label: string;
4
+ icon: string;
5
+ group: 'basic' | 'layout' | 'advanced';
6
+ input: boolean;
7
+ supports: string[];
8
+ }
9
+ /** A ready-made field in a template's field library. */
10
+ export interface PaletteItem {
11
+ id: string;
12
+ type: string;
13
+ label: string;
14
+ icon: string;
15
+ key?: string;
16
+ placeholder?: string;
17
+ /** Can be added only once. */
18
+ unique?: boolean;
19
+ /** Added as a required field. */
20
+ required?: boolean;
21
+ /** Kept at the top or bottom of the form, and not movable. Needs `key`. */
22
+ pin?: 'top' | 'bottom';
23
+ }
24
+ export interface PaletteGroup {
25
+ id: string;
26
+ label: string;
27
+ items: (PaletteItem | string)[];
28
+ }
29
+ export interface Option {
30
+ label: string;
31
+ value: string;
32
+ }
33
+ export interface Rule {
34
+ field: string;
35
+ operator: string;
36
+ value: string;
37
+ }
38
+ export interface Conditions {
39
+ enabled: boolean;
40
+ action: 'show' | 'hide' | 'require';
41
+ match: 'all' | 'any';
42
+ rules: Rule[];
43
+ }
44
+ /** One field of a form. Mirrors what Forms\Schema stores; the server rebuilds it on save. */
45
+ export interface Field {
46
+ id: string;
47
+ key: string;
48
+ type: string;
49
+ label: string;
50
+ description: string;
51
+ placeholder: string;
52
+ required: boolean;
53
+ default: string;
54
+ width: number;
55
+ css_class: string;
56
+ hide_label: boolean;
57
+ options: Option[];
58
+ conditions: Conditions;
59
+ [extra: string]: unknown;
60
+ }
61
+ /** Rules that limit a notification, a webhook or an alternative confirmation to certain answers. */
62
+ export interface When {
63
+ enabled: boolean;
64
+ match: 'all' | 'any';
65
+ rules: Rule[];
66
+ }
67
+ /** A confirmation used instead of the form's usual one when its rules match. */
68
+ export interface ConfirmationRule {
69
+ id: string;
70
+ type: string;
71
+ message: string;
72
+ redirect_url: string;
73
+ conditions: When;
74
+ }
75
+ export interface Notification {
76
+ id: string;
77
+ name: string;
78
+ enabled: boolean;
79
+ channel: 'email' | 'sms' | 'both';
80
+ to: string;
81
+ subject: string;
82
+ message: string;
83
+ reply_to: string;
84
+ /** For `both`: the number and text of the text message; `to` and `message` are the email's. */
85
+ sms_to?: string;
86
+ sms_message?: string;
87
+ /** Sent only when these match; always, when absent or switched off. */
88
+ conditions?: When;
89
+ }
90
+ export interface Webhook {
91
+ id: string;
92
+ name: string;
93
+ enabled: boolean;
94
+ url: string;
95
+ secret: string;
96
+ fields: string[];
97
+ /** Sent only when these match; always, when absent or switched off. */
98
+ conditions?: When;
99
+ }
100
+ export interface FormSettings {
101
+ /** Id of the template the form was started from; picks the field library. */
102
+ template?: string;
103
+ submit_label: string;
104
+ next_label: string;
105
+ previous_label: string;
106
+ progress: string;
107
+ store_submissions: boolean;
108
+ confirmation: {
109
+ type: string;
110
+ message: string;
111
+ redirect_url: string;
112
+ rules?: ConfirmationRule[];
113
+ };
114
+ messages: {
115
+ required: string;
116
+ invalid: string;
117
+ error: string;
118
+ };
119
+ style: Record<string, string>;
120
+ spam: {
121
+ recaptcha?: boolean;
122
+ };
123
+ notifications: Notification[];
124
+ webhooks: Webhook[];
125
+ /** Per-form settings of extensions, keyed by extension id. */
126
+ extensions?: Record<string, Record<string, unknown>>;
127
+ }
128
+ export interface Schema {
129
+ version: number;
130
+ fields: Field[];
131
+ settings: FormSettings;
132
+ }
133
+ export interface Form {
134
+ id: number;
135
+ title: string;
136
+ status: 'draft' | 'published';
137
+ schema: Schema;
138
+ shortcode: string;
139
+ embed: string;
140
+ problems?: string[];
141
+ /** The problems with where to fix each: a field id, or a group of the form's settings. */
142
+ issues?: {
143
+ message: string;
144
+ field: string;
145
+ group: string;
146
+ }[];
147
+ }
148
+ /** A short random id. Final ids are checked for uniqueness by the server. */
149
+ export declare const makeId: (prefix: string) => string;
150
+ /** Escapes text for a zyra prop that is rendered as HTML. */
151
+ export declare const escapeHtml: (value: string) => string;
@@ -0,0 +1,9 @@
1
+ import React from 'react';
2
+ interface SwitchProps {
3
+ label: string;
4
+ description?: string;
5
+ checked: boolean;
6
+ onChange: (checked: boolean) => void;
7
+ }
8
+ export declare const Switch: React.FC<SwitchProps>;
9
+ export default Switch;
@@ -0,0 +1,89 @@
1
+ export type EmailBlockType = 'heading' | 'text' | 'image' | 'button' | 'divider' | 'spacer' | 'social' | 'code' | 'columns';
2
+ export type ColumnLayout = '1' | '2' | '3' | '4' | '1:2' | '2:1';
3
+ export interface EmailBlockStyle {
4
+ backgroundColor?: string;
5
+ borderStyle?: 'none' | 'solid' | 'dashed' | 'dotted';
6
+ borderColor?: string;
7
+ roundedCorners?: number;
8
+ paddingTop?: number;
9
+ paddingRight?: number;
10
+ paddingBottom?: number;
11
+ paddingLeft?: number;
12
+ paddingLinked?: boolean;
13
+ /** @deprecated use `marginTop`/`marginRight`/`marginBottom`/`marginLeft` — kept only so old saved data still renders. */
14
+ margin?: number;
15
+ marginTop?: number;
16
+ marginRight?: number;
17
+ marginBottom?: number;
18
+ marginLeft?: number;
19
+ marginLinked?: boolean;
20
+ }
21
+ export type SocialPlatform = 'facebook' | 'instagram' | 'x' | 'linkedin' | 'youtube' | 'pinterest' | 'tiktok' | 'whatsapp' | 'telegram' | 'snapchat' | 'reddit' | 'discord' | 'threads' | 'website';
22
+ export interface SocialLink {
23
+ id: string;
24
+ platform: SocialPlatform;
25
+ url: string;
26
+ label?: string;
27
+ }
28
+ export declare const SOCIAL_PLATFORM_META: Record<SocialPlatform, {
29
+ label: string;
30
+ icon: string;
31
+ baseUrl: string;
32
+ }>;
33
+ export interface EmailBlock extends EmailBlockStyle {
34
+ id: string;
35
+ type: EmailBlockType;
36
+ text?: string;
37
+ html?: string;
38
+ level?: 1 | 2 | 3 | 4 | 5 | 6;
39
+ align?: 'left' | 'center' | 'right';
40
+ src?: string;
41
+ alt?: string;
42
+ link?: string;
43
+ url?: string;
44
+ color?: string;
45
+ height?: number;
46
+ size?: 'small' | 'medium' | 'large';
47
+ layout?: ColumnLayout;
48
+ columns?: EmailBlock[][];
49
+ shape?: 'square' | 'round' | 'pill';
50
+ textColor?: string;
51
+ borderWidth?: number;
52
+ fontSize?: number;
53
+ lineHeight?: number;
54
+ fontWeight?: 400 | 500 | 600 | 700 | 800;
55
+ textDecoration?: 'none' | 'underline' | 'line-through';
56
+ socialType?: 'follow' | 'share';
57
+ socialLinks?: SocialLink[];
58
+ socialLayout?: 'horizontal' | 'vertical';
59
+ iconDisplay?: 'icon' | 'icon-text';
60
+ iconStyle?: 1 | 2 | 3;
61
+ iconColor?: 'gray' | 'brand' | 'black' | 'white';
62
+ spacing?: number;
63
+ lineColor?: string;
64
+ lineStyle?: 'solid' | 'dashed' | 'dotted';
65
+ thickness?: number;
66
+ /** Extra CSS class(es) a developer can attach to this block's own
67
+ * wrapper, applied verbatim wherever the block is rendered. Purely a
68
+ * hook for custom CSS — carries no other meaning. */
69
+ cssClass?: string;
70
+ }
71
+ export interface EmailBlockTypeDef {
72
+ type: EmailBlockType;
73
+ label: string;
74
+ icon: string;
75
+ group: 'content' | 'columns';
76
+ defaults: Partial<EmailBlock>;
77
+ }
78
+ export declare const EMAIL_BLOCK_GROUPS: {
79
+ id: 'content' | 'columns';
80
+ label: string;
81
+ hint?: string;
82
+ }[];
83
+ export declare const EMAIL_BLOCK_TYPES: EmailBlockTypeDef[];
84
+ export declare const COLUMN_LAYOUT_PRESETS: {
85
+ layout: ColumnLayout;
86
+ label: string;
87
+ count: number;
88
+ }[];
89
+ export declare const EMAIL_BLOCK_TYPE_MAP: Record<string, EmailBlockTypeDef>;
@@ -0,0 +1,9 @@
1
+ export { default as EmailBuilder } from './EmailBuilder';
2
+ export type { EmailBuilderProps, EmailTemplate } from './EmailBuilder';
3
+ export { default as EmailTemplateEditorPopup } from './EmailTemplateEditorPopup';
4
+ export type { EmailTemplateEditorPopupProps } from './EmailTemplateEditorPopup';
5
+ export { EMAIL_BLOCK_TYPES, EMAIL_BLOCK_GROUPS, EMAIL_BLOCK_TYPE_MAP, } from './emailBlockTypes';
6
+ export type { EmailBlock, EmailBlockType, EmailBlockTypeDef } from './emailBlockTypes';
7
+ export { legacyEmailBlocksToEmailBlocks, emailBlocksToLegacyEmailBlocks, legacyEmailBlockToEmailBlock, emailBlockToLegacyEmailBlock, } from './legacyEmailAdapter';
8
+ export type { LegacyEmailBlock, LegacyEmailBlockStyle, } from './legacyEmailAdapter';
9
+ export * from './FormBuilder';