@squaredr/fieldcraft-pro 1.6.4 → 1.7.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.
@@ -0,0 +1 @@
1
+ export { consultationBooking, consultationBookingMeta, consultationBookingSchema, ecommerceCheckout, ecommerceCheckoutMeta, ecommerceCheckoutSchema, proTemplates } from '../chunk-VEP3DOCQ.mjs';
@@ -5,27 +5,6 @@ var jsxRuntime = require('react/jsx-runtime');
5
5
  var fieldcraftReact = require('@squaredr/fieldcraft-react');
6
6
 
7
7
  // ../license/dist/index.mjs
8
- var PRO_FEATURES = [
9
- "SchemaEditor",
10
- "ResponseViewer",
11
- "ThemeEditor",
12
- "FormBuilder",
13
- "ApiManager",
14
- "Analytics"
15
- ];
16
- var ALL_FEATURES = [
17
- ...PRO_FEATURES,
18
- "Telehealth"
19
- ];
20
- var TIER_FEATURES = {
21
- starter: ["SchemaEditor", "ResponseViewer"],
22
- pro: PRO_FEATURES,
23
- business: ALL_FEATURES,
24
- enterprise: ALL_FEATURES
25
- };
26
- function tierHasFeature(tier, featureName) {
27
- return TIER_FEATURES[tier]?.includes(featureName) ?? false;
28
- }
29
8
  var DEV_HOSTNAMES = /* @__PURE__ */ new Set([
30
9
  "localhost",
31
10
  "127.0.0.1",
@@ -97,7 +76,8 @@ function isProductionEnvironment() {
97
76
  }
98
77
  return false;
99
78
  }
100
- var defaultContext = { status: "validating", tier: null };
79
+ typeof process !== "undefined" && process.env?.NEXT_PUBLIC_FCPRO_PING_URL || "https://fieldcraft.dev/api/license/ping";
80
+ var defaultContext = { status: "validating" };
101
81
  var LicenseCtx = react.createContext(defaultContext);
102
82
  function useLicense() {
103
83
  return react.useContext(LicenseCtx);
@@ -297,7 +277,7 @@ function UnlicensedOverlay({ featureName, reason, children }) {
297
277
  }
298
278
  function requireLicense(Component, featureName) {
299
279
  function LicenseGated(props) {
300
- const { status, tier } = useLicense();
280
+ const { status } = useLicense();
301
281
  const isProduction = isProductionEnvironment();
302
282
  if (!isProduction) {
303
283
  return /* @__PURE__ */ jsxRuntime.jsx(Component, { ...props });
@@ -305,8 +285,7 @@ function requireLicense(Component, featureName) {
305
285
  if (status === "validating") {
306
286
  return null;
307
287
  }
308
- const isLicensed = status === "valid" && tier != null && tierHasFeature(tier, featureName);
309
- if (isLicensed) {
288
+ if (status === "valid") {
310
289
  return /* @__PURE__ */ jsxRuntime.jsx(Component, { ...props });
311
290
  }
312
291
  let reason = "A valid license is required for production use.";
@@ -318,8 +297,6 @@ function requireLicense(Component, featureName) {
318
297
  reason = "This license key has been revoked. Please contact support or purchase a new license.";
319
298
  } else if (status === "domain_mismatch") {
320
299
  reason = "This license key is registered to a different domain. Each key can only be used on one production domain. Please purchase a new license for this domain.";
321
- } else if (!tier || !tierHasFeature(tier, featureName)) {
322
- reason = "Your license does not include this feature. Please upgrade your plan.";
323
300
  }
324
301
  return /* @__PURE__ */ jsxRuntime.jsx(UnlicensedOverlay, { featureName, reason, children: /* @__PURE__ */ jsxRuntime.jsx(Component, { ...props }) });
325
302
  }
@@ -1,2 +1,2 @@
1
- export { PRESET_FAMILIES, PREVIEW_SCHEMA, ThemeEditor, ThemeEditorThemeProvider, resolveThemeFromDOM, themeEditorDarkPreset, themeEditorLightPreset, useEditorTheme } from '../chunk-CFVT2R42.mjs';
2
- import '../chunk-VECQKSWS.mjs';
1
+ export { PRESET_FAMILIES, PREVIEW_SCHEMA, ThemeEditor, ThemeEditorThemeProvider, resolveThemeFromDOM, themeEditorDarkPreset, themeEditorLightPreset, useEditorTheme } from '../chunk-4TN6YJDF.mjs';
2
+ import '../chunk-4MMKB2EW.mjs';
@@ -0,0 +1,217 @@
1
+ import { ReactNode } from 'react';
2
+ import { FormEngineSchema, QuestionType, FormEngineTheme, FormEngine, FormResponse, Section, Question, Option } from '@squaredr/fieldcraft-core';
3
+ import { FieldRegistry } from '@squaredr/fieldcraft-react';
4
+
5
+ /**
6
+ * FormBuilder theme configuration.
7
+ * All values are CSS color strings (hex, oklch, hsl, etc.).
8
+ * Set these to customize the builder's appearance.
9
+ */
10
+ type FormBuilderTheme = {
11
+ /** Main background of the entire builder */
12
+ background?: string;
13
+ /** Primary text color */
14
+ foreground?: string;
15
+ /** Card/panel background */
16
+ card?: string;
17
+ /** Primary accent color (buttons, selection, focus rings) */
18
+ primary?: string;
19
+ /** Text color on primary backgrounds */
20
+ primaryForeground?: string;
21
+ /** Secondary surfaces */
22
+ secondary?: string;
23
+ /** Text on secondary surfaces */
24
+ secondaryForeground?: string;
25
+ /** Muted background (disabled, subtle areas) */
26
+ muted?: string;
27
+ /** Muted text (labels, placeholders) */
28
+ mutedForeground?: string;
29
+ /** Hover/accent background */
30
+ accent?: string;
31
+ /** Text on accent background */
32
+ accentForeground?: string;
33
+ /** Destructive action color */
34
+ destructive?: string;
35
+ /** Text on destructive backgrounds */
36
+ destructiveForeground?: string;
37
+ /** Default border color */
38
+ border?: string;
39
+ /** Input border color */
40
+ input?: string;
41
+ /** Focus ring color */
42
+ ring?: string;
43
+ /** Border radius base (e.g. "6px", "0.375rem") */
44
+ radius?: string;
45
+ /** Surface color for panels/sidebars */
46
+ surface?: string;
47
+ /** Surface hover state */
48
+ surfaceHover?: string;
49
+ /** Main canvas background */
50
+ canvas?: string;
51
+ /** Panel background (palette, property panel) */
52
+ panel?: string;
53
+ /** Strong border color (for emphasis) */
54
+ borderStrong?: string;
55
+ /** Dim text color (secondary labels) */
56
+ textDim?: string;
57
+ };
58
+
59
+ type FormBuilderProps = {
60
+ /** Initial schema to load. If not provided, uses a default empty schema */
61
+ initialSchema?: FormEngineSchema;
62
+ /** URL to fetch schema JSON from on mount. Overrides initialSchema when provided and fetch succeeds. */
63
+ schemaUrl?: string;
64
+ /** Callback when schema changes */
65
+ onChange?: (schema: FormEngineSchema) => void;
66
+ /** Callback when user clicks "Save" */
67
+ onSave?: (schema: FormEngineSchema) => void;
68
+ /** Height of the builder container */
69
+ height?: string | number;
70
+ /** Theme customization — overrides CSS variables for all builder components */
71
+ theme?: FormBuilderTheme;
72
+ /** Additional CSS class name on the root element */
73
+ className?: string;
74
+ /** Extra content rendered in the toolbar, after the Save button */
75
+ toolbarExtra?: ReactNode;
76
+ /** Additional question type metadata — merged with built-in defaults (e.g. telehealth fields) */
77
+ questionTypes?: Record<string, QuestionTypeInfo>;
78
+ /** Additional palette categories — appended to built-in palette (e.g. telehealth categories) */
79
+ palette?: PaletteCategory[];
80
+ /** Configuration for the built-in preview mode renderer */
81
+ preview?: FormBuilderPreviewProps;
82
+ /** Templates to show in the template gallery */
83
+ templates?: FormBuilderTemplate[];
84
+ };
85
+ type FormBuilderPreviewProps = {
86
+ /** Theme passed to FormEngineRenderer in preview mode */
87
+ theme?: FormEngineTheme;
88
+ /** Custom field components for preview (e.g. telehealth fields) */
89
+ components?: FieldRegistry;
90
+ /** Callback when FormEngine is ready in preview mode */
91
+ onReady?: (engine: FormEngine) => void;
92
+ /** Callback when a field value changes in preview mode */
93
+ onFieldChange?: (fieldId: string, value: unknown) => void;
94
+ /** Callback when the preview form is submitted */
95
+ onSubmit?: (response: FormResponse) => void | Promise<void>;
96
+ };
97
+ type FormBuilderTemplate = {
98
+ meta: {
99
+ id: string;
100
+ name: string;
101
+ description: string;
102
+ category: string;
103
+ fieldCount: number;
104
+ sectionCount: number;
105
+ tags?: string[];
106
+ };
107
+ schema: FormEngineSchema;
108
+ };
109
+ type BuilderState = {
110
+ schema: FormEngineSchema;
111
+ selectedItem: SelectedItem | null;
112
+ isDirty: boolean;
113
+ };
114
+ type SelectedItem = {
115
+ type: "question";
116
+ sectionId: string;
117
+ questionId: string;
118
+ } | {
119
+ type: "section";
120
+ sectionId: string;
121
+ };
122
+ type DragItem = {
123
+ type: "palette-item";
124
+ questionType: QuestionType;
125
+ } | {
126
+ type: "question";
127
+ sectionId: string;
128
+ questionId: string;
129
+ questionIndex: number;
130
+ } | {
131
+ type: "section";
132
+ sectionId: string;
133
+ sectionIndex: number;
134
+ };
135
+ type DropTarget = {
136
+ type: "section";
137
+ sectionId: string;
138
+ index: number;
139
+ } | {
140
+ type: "canvas";
141
+ index: number;
142
+ };
143
+ type QuestionTypeCategory = "text" | "numeric" | "selection" | "datetime" | "media" | "advanced" | "structural" | "content" | (string & {});
144
+ type PaletteCategory = {
145
+ category: string;
146
+ label: string;
147
+ types: string[];
148
+ };
149
+ type QuestionTypeInfo = {
150
+ type: QuestionType;
151
+ label: string;
152
+ category: QuestionTypeCategory;
153
+ icon: string;
154
+ description: string;
155
+ defaultConfig?: Record<string, unknown>;
156
+ requiresOptions?: boolean;
157
+ };
158
+ type PropertyPanelTab = "basic" | "validation" | "logic" | "advanced" | "options";
159
+ type MutationAction = {
160
+ type: "add-section";
161
+ section: Section;
162
+ index: number;
163
+ } | {
164
+ type: "remove-section";
165
+ sectionId: string;
166
+ } | {
167
+ type: "update-section";
168
+ sectionId: string;
169
+ updates: Partial<Section>;
170
+ } | {
171
+ type: "move-section";
172
+ sectionId: string;
173
+ newIndex: number;
174
+ } | {
175
+ type: "add-question";
176
+ sectionId: string;
177
+ question: Question;
178
+ index: number;
179
+ } | {
180
+ type: "remove-question";
181
+ sectionId: string;
182
+ questionId: string;
183
+ } | {
184
+ type: "update-question";
185
+ sectionId: string;
186
+ questionId: string;
187
+ updates: Partial<Question>;
188
+ } | {
189
+ type: "move-question";
190
+ sectionId: string;
191
+ questionId: string;
192
+ targetSectionId: string;
193
+ newIndex: number;
194
+ } | {
195
+ type: "duplicate-question";
196
+ sectionId: string;
197
+ questionId: string;
198
+ } | {
199
+ type: "add-option";
200
+ sectionId: string;
201
+ questionId: string;
202
+ option: Option;
203
+ index: number;
204
+ } | {
205
+ type: "remove-option";
206
+ sectionId: string;
207
+ questionId: string;
208
+ optionIndex: number;
209
+ } | {
210
+ type: "update-option";
211
+ sectionId: string;
212
+ questionId: string;
213
+ optionIndex: number;
214
+ updates: Partial<Option>;
215
+ };
216
+
217
+ export type { BuilderState as B, DragItem as D, FormBuilderPreviewProps as F, MutationAction as M, PaletteCategory as P, QuestionTypeCategory as Q, SelectedItem as S, DropTarget as a, FormBuilderProps as b, FormBuilderTemplate as c, FormBuilderTheme as d, PropertyPanelTab as e, QuestionTypeInfo as f };
@@ -0,0 +1,217 @@
1
+ import { ReactNode } from 'react';
2
+ import { FormEngineSchema, QuestionType, FormEngineTheme, FormEngine, FormResponse, Section, Question, Option } from '@squaredr/fieldcraft-core';
3
+ import { FieldRegistry } from '@squaredr/fieldcraft-react';
4
+
5
+ /**
6
+ * FormBuilder theme configuration.
7
+ * All values are CSS color strings (hex, oklch, hsl, etc.).
8
+ * Set these to customize the builder's appearance.
9
+ */
10
+ type FormBuilderTheme = {
11
+ /** Main background of the entire builder */
12
+ background?: string;
13
+ /** Primary text color */
14
+ foreground?: string;
15
+ /** Card/panel background */
16
+ card?: string;
17
+ /** Primary accent color (buttons, selection, focus rings) */
18
+ primary?: string;
19
+ /** Text color on primary backgrounds */
20
+ primaryForeground?: string;
21
+ /** Secondary surfaces */
22
+ secondary?: string;
23
+ /** Text on secondary surfaces */
24
+ secondaryForeground?: string;
25
+ /** Muted background (disabled, subtle areas) */
26
+ muted?: string;
27
+ /** Muted text (labels, placeholders) */
28
+ mutedForeground?: string;
29
+ /** Hover/accent background */
30
+ accent?: string;
31
+ /** Text on accent background */
32
+ accentForeground?: string;
33
+ /** Destructive action color */
34
+ destructive?: string;
35
+ /** Text on destructive backgrounds */
36
+ destructiveForeground?: string;
37
+ /** Default border color */
38
+ border?: string;
39
+ /** Input border color */
40
+ input?: string;
41
+ /** Focus ring color */
42
+ ring?: string;
43
+ /** Border radius base (e.g. "6px", "0.375rem") */
44
+ radius?: string;
45
+ /** Surface color for panels/sidebars */
46
+ surface?: string;
47
+ /** Surface hover state */
48
+ surfaceHover?: string;
49
+ /** Main canvas background */
50
+ canvas?: string;
51
+ /** Panel background (palette, property panel) */
52
+ panel?: string;
53
+ /** Strong border color (for emphasis) */
54
+ borderStrong?: string;
55
+ /** Dim text color (secondary labels) */
56
+ textDim?: string;
57
+ };
58
+
59
+ type FormBuilderProps = {
60
+ /** Initial schema to load. If not provided, uses a default empty schema */
61
+ initialSchema?: FormEngineSchema;
62
+ /** URL to fetch schema JSON from on mount. Overrides initialSchema when provided and fetch succeeds. */
63
+ schemaUrl?: string;
64
+ /** Callback when schema changes */
65
+ onChange?: (schema: FormEngineSchema) => void;
66
+ /** Callback when user clicks "Save" */
67
+ onSave?: (schema: FormEngineSchema) => void;
68
+ /** Height of the builder container */
69
+ height?: string | number;
70
+ /** Theme customization — overrides CSS variables for all builder components */
71
+ theme?: FormBuilderTheme;
72
+ /** Additional CSS class name on the root element */
73
+ className?: string;
74
+ /** Extra content rendered in the toolbar, after the Save button */
75
+ toolbarExtra?: ReactNode;
76
+ /** Additional question type metadata — merged with built-in defaults (e.g. telehealth fields) */
77
+ questionTypes?: Record<string, QuestionTypeInfo>;
78
+ /** Additional palette categories — appended to built-in palette (e.g. telehealth categories) */
79
+ palette?: PaletteCategory[];
80
+ /** Configuration for the built-in preview mode renderer */
81
+ preview?: FormBuilderPreviewProps;
82
+ /** Templates to show in the template gallery */
83
+ templates?: FormBuilderTemplate[];
84
+ };
85
+ type FormBuilderPreviewProps = {
86
+ /** Theme passed to FormEngineRenderer in preview mode */
87
+ theme?: FormEngineTheme;
88
+ /** Custom field components for preview (e.g. telehealth fields) */
89
+ components?: FieldRegistry;
90
+ /** Callback when FormEngine is ready in preview mode */
91
+ onReady?: (engine: FormEngine) => void;
92
+ /** Callback when a field value changes in preview mode */
93
+ onFieldChange?: (fieldId: string, value: unknown) => void;
94
+ /** Callback when the preview form is submitted */
95
+ onSubmit?: (response: FormResponse) => void | Promise<void>;
96
+ };
97
+ type FormBuilderTemplate = {
98
+ meta: {
99
+ id: string;
100
+ name: string;
101
+ description: string;
102
+ category: string;
103
+ fieldCount: number;
104
+ sectionCount: number;
105
+ tags?: string[];
106
+ };
107
+ schema: FormEngineSchema;
108
+ };
109
+ type BuilderState = {
110
+ schema: FormEngineSchema;
111
+ selectedItem: SelectedItem | null;
112
+ isDirty: boolean;
113
+ };
114
+ type SelectedItem = {
115
+ type: "question";
116
+ sectionId: string;
117
+ questionId: string;
118
+ } | {
119
+ type: "section";
120
+ sectionId: string;
121
+ };
122
+ type DragItem = {
123
+ type: "palette-item";
124
+ questionType: QuestionType;
125
+ } | {
126
+ type: "question";
127
+ sectionId: string;
128
+ questionId: string;
129
+ questionIndex: number;
130
+ } | {
131
+ type: "section";
132
+ sectionId: string;
133
+ sectionIndex: number;
134
+ };
135
+ type DropTarget = {
136
+ type: "section";
137
+ sectionId: string;
138
+ index: number;
139
+ } | {
140
+ type: "canvas";
141
+ index: number;
142
+ };
143
+ type QuestionTypeCategory = "text" | "numeric" | "selection" | "datetime" | "media" | "advanced" | "structural" | "content" | (string & {});
144
+ type PaletteCategory = {
145
+ category: string;
146
+ label: string;
147
+ types: string[];
148
+ };
149
+ type QuestionTypeInfo = {
150
+ type: QuestionType;
151
+ label: string;
152
+ category: QuestionTypeCategory;
153
+ icon: string;
154
+ description: string;
155
+ defaultConfig?: Record<string, unknown>;
156
+ requiresOptions?: boolean;
157
+ };
158
+ type PropertyPanelTab = "basic" | "validation" | "logic" | "advanced" | "options";
159
+ type MutationAction = {
160
+ type: "add-section";
161
+ section: Section;
162
+ index: number;
163
+ } | {
164
+ type: "remove-section";
165
+ sectionId: string;
166
+ } | {
167
+ type: "update-section";
168
+ sectionId: string;
169
+ updates: Partial<Section>;
170
+ } | {
171
+ type: "move-section";
172
+ sectionId: string;
173
+ newIndex: number;
174
+ } | {
175
+ type: "add-question";
176
+ sectionId: string;
177
+ question: Question;
178
+ index: number;
179
+ } | {
180
+ type: "remove-question";
181
+ sectionId: string;
182
+ questionId: string;
183
+ } | {
184
+ type: "update-question";
185
+ sectionId: string;
186
+ questionId: string;
187
+ updates: Partial<Question>;
188
+ } | {
189
+ type: "move-question";
190
+ sectionId: string;
191
+ questionId: string;
192
+ targetSectionId: string;
193
+ newIndex: number;
194
+ } | {
195
+ type: "duplicate-question";
196
+ sectionId: string;
197
+ questionId: string;
198
+ } | {
199
+ type: "add-option";
200
+ sectionId: string;
201
+ questionId: string;
202
+ option: Option;
203
+ index: number;
204
+ } | {
205
+ type: "remove-option";
206
+ sectionId: string;
207
+ questionId: string;
208
+ optionIndex: number;
209
+ } | {
210
+ type: "update-option";
211
+ sectionId: string;
212
+ questionId: string;
213
+ optionIndex: number;
214
+ updates: Partial<Option>;
215
+ };
216
+
217
+ export type { BuilderState as B, DragItem as D, FormBuilderPreviewProps as F, MutationAction as M, PaletteCategory as P, QuestionTypeCategory as Q, SelectedItem as S, DropTarget as a, FormBuilderProps as b, FormBuilderTemplate as c, FormBuilderTheme as d, PropertyPanelTab as e, QuestionTypeInfo as f };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@squaredr/fieldcraft-pro",
3
- "version": "1.6.4",
3
+ "version": "1.7.0",
4
4
  "description": "Pro components for FieldCraft — visual drag-and-drop Form Builder, Response Viewer, and Theme Editor for React",
5
5
  "keywords": [
6
6
  "fieldcraft",
@@ -40,6 +40,11 @@
40
40
  "import": "./dist/theme-editor/index.mjs",
41
41
  "require": "./dist/theme-editor/index.js"
42
42
  },
43
+ "./templates": {
44
+ "types": "./dist/templates/index.d.ts",
45
+ "import": "./dist/templates/index.mjs",
46
+ "require": "./dist/templates/index.js"
47
+ },
43
48
  "./styles.css": "./dist/styles.css",
44
49
  "./theme-editor/styles.css": "./theme-editor/styles.css"
45
50
  },
@@ -67,16 +72,12 @@
67
72
  "@squaredr/fieldcraft-core": "^1.6.0",
68
73
  "@squaredr/fieldcraft-react": "^1.6.0",
69
74
  "@squaredr/paykit-react": "^1.0.0",
70
- "@squaredr/paykit-stripe": "^1.0.0",
71
75
  "react": "^18 || ^19",
72
76
  "react-dom": "^18 || ^19"
73
77
  },
74
78
  "peerDependenciesMeta": {
75
79
  "@squaredr/paykit-react": {
76
80
  "optional": true
77
- },
78
- "@squaredr/paykit-stripe": {
79
- "optional": true
80
81
  }
81
82
  },
82
83
  "devDependencies": {
@@ -91,12 +92,12 @@
91
92
  "tsup": "^8.0",
92
93
  "typescript": "^5.5",
93
94
  "vitest": "^2.0",
94
- "@squaredr/fieldcraft-pro-license": "1.2.0",
95
+ "@squaredr/fieldcraft-pro-license": "1.4.0",
95
96
  "@squaredr/fieldcraft-pro-tsconfig": "0.0.1"
96
97
  },
97
98
  "license": "SEE LICENSE IN LICENSE.txt",
98
99
  "author": "SquaredR",
99
- "homepage": "https://squaredr.tech/products/fieldcraft/admin-pro",
100
+ "homepage": "https://fieldcraft.squaredr.tech/pro",
100
101
  "repository": {
101
102
  "type": "git",
102
103
  "url": "https://github.com/SquaredR98/fieldcraft-pro.git",