@squaredr/fieldcraft-pro 1.8.0 → 1.9.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.
@@ -1,3 +1,3 @@
1
- export { DEFAULT_PALETTE, DEFAULT_SCHEMA, FormBuilder, FormBuilderThemeProvider, QUESTION_TYPE_INFO, addOption, addQuestion, addSection, duplicateQuestion, duplicateSection, findQuestion, findSection, generateId, generateOptionId, generateQuestionId, generateSectionId, moveOption, moveQuestion, moveSection, removeOption, removeQuestion, removeSection, updateOption, updateQuestion, updateSection, useBuilderState, useBuilderTheme, useDragDrop, useUndoRedo } from '../chunk-GXKQCXIB.mjs';
1
+ export { DEFAULT_PALETTE, DEFAULT_SCHEMA, FormBuilder, FormBuilderThemeProvider, QUESTION_TYPE_INFO, addOption, addQuestion, addSection, cleanPreset, duplicateQuestion, duplicateSection, findQuestion, findSection, generateId, generateOptionId, generateQuestionId, generateSectionId, moveOption, moveQuestion, moveSection, removeOption, removeQuestion, removeSection, squaredrDarkPreset, updateOption, updateQuestion, updateSection, useBuilderState, useBuilderTheme, useDragDrop, useUndoRedo } from '../chunk-DWRLPGX5.mjs';
2
2
  export { cn } from '../chunk-QQ4JZGTD.mjs';
3
3
  import '../chunk-4MMKB2EW.mjs';
package/dist/index.d.mts CHANGED
@@ -1,7 +1,7 @@
1
- import * as react_jsx_runtime from 'react/jsx-runtime';
1
+ import * as react from 'react';
2
2
  import { ReactNode, ComponentType } from 'react';
3
- export { BuilderStateHook, DEFAULT_PALETTE, DEFAULT_SCHEMA, FormBuilder, FormBuilderThemeProvider, QUESTION_TYPE_INFO, UndoRedoState, addOption, addQuestion, addSection, cn, duplicateQuestion, duplicateSection, findQuestion, findSection, generateId, generateOptionId, generateQuestionId, generateSectionId, moveOption, moveQuestion, moveSection, removeOption, removeQuestion, removeSection, updateOption, updateQuestion, updateSection, useBuilderState, useBuilderTheme, useDragDrop, useUndoRedo } from './form-builder/index.mjs';
4
- export { B as BuilderState, D as DragItem, a as DropTarget, F as FormBuilderPreviewProps, b as FormBuilderProps, c as FormBuilderTemplate, d as FormBuilderTheme, M as MutationAction, P as PaletteCategory, e as PropertyPanelTab, Q as QuestionTypeCategory, f as QuestionTypeInfo, S as SelectedItem } from './types-bFHsZT1n.mjs';
3
+ export { B as BuilderStateHook, D as DEFAULT_PALETTE, a as DEFAULT_SCHEMA, F as FormBuilder, b as FormBuilderThemeProvider, Q as QUESTION_TYPE_INFO, U as UndoRedoState, c as addOption, d as addQuestion, e as addSection, f as cn, g as duplicateQuestion, h as duplicateSection, i as findQuestion, j as findSection, k as generateId, l as generateOptionId, m as generateQuestionId, n as generateSectionId, o as moveOption, p as moveQuestion, q as moveSection, r as removeOption, s as removeQuestion, t as removeSection, u as updateOption, v as updateQuestion, w as updateSection, x as useBuilderState, y as useBuilderTheme, z as useDragDrop, A as useUndoRedo } from './default-schema-Bwq8FATF.mjs';
4
+ export { B as BuilderState, D as DragItem, a as DropTarget, b as FormBuilderPreviewProps, c as FormBuilderProps, f as FormBuilderTemplate, F as FormBuilderTheme, M as MutationAction, P as PaletteCategory, d as PropertyPanelTab, Q as QuestionTypeCategory, e as QuestionTypeInfo, S as SelectedItem } from './types-BQOeI3LX.mjs';
5
5
  import { FieldComponent, FieldProps } from '@squaredr/fieldcraft-react';
6
6
  export { FieldRenderer, ResponseField, ResponseViewer, ResponseViewerProps, ViewMode } from './response-viewer/index.mjs';
7
7
  export { PRESET_FAMILIES, PREVIEW_SCHEMA, PresetFamily, ThemeEditor, ThemeEditorProps, ThemeEditorTheme, ThemeEditorThemeProvider, resolveThemeFromDOM, themeEditorDarkPreset, themeEditorLightPreset, useEditorTheme } from './theme-editor/index.mjs';
@@ -19,7 +19,7 @@ type FieldCraftProProviderProps = {
19
19
  licenseKey: string;
20
20
  children: ReactNode;
21
21
  };
22
- declare function FieldCraftProProvider({ licenseKey, children }: FieldCraftProProviderProps): react_jsx_runtime.JSX.Element;
22
+ declare function FieldCraftProProvider({ licenseKey, children }: FieldCraftProProviderProps): react.JSX.Element;
23
23
 
24
24
  declare function useLicense(): LicenseContext;
25
25
 
@@ -37,7 +37,7 @@ type UnlicensedOverlayProps = {
37
37
  * unmissable overlay on top. The component is visible underneath
38
38
  * but completely unusable — forcing a license purchase for production.
39
39
  */
40
- declare function UnlicensedOverlay({ featureName, reason, children }: UnlicensedOverlayProps): react_jsx_runtime.JSX.Element;
40
+ declare function UnlicensedOverlay({ featureName, reason, children }: UnlicensedOverlayProps): react.JSX.Element;
41
41
 
42
42
  /**
43
43
  * Detects whether the current environment is a production deployment.
@@ -67,11 +67,11 @@ declare function isProductionEnvironment(): boolean;
67
67
  *
68
68
  * Requires `@squaredr/paykit-react` and `@squaredr/paykit/stripe/client` as peer deps.
69
69
  */
70
- declare function ProPaymentField(props: FieldProps): react_jsx_runtime.JSX.Element;
70
+ declare function ProPaymentField(props: FieldProps): react.JSX.Element;
71
71
 
72
72
  /**
73
73
  * PRO_FIELD_OVERRIDES registry — maps field types to Pro-enhanced components.
74
- * Pass this to FormEngineRenderer's `components` prop to enable Pro payment:
74
+ * Pass this to FormEngineRenderer's `components` prop to enable Pro features:
75
75
  *
76
76
  * ```tsx
77
77
  * import { PRO_FIELD_OVERRIDES } from "@squaredr/fieldcraft-pro";
@@ -80,6 +80,107 @@ declare function ProPaymentField(props: FieldProps): react_jsx_runtime.JSX.Eleme
80
80
  */
81
81
  declare const PRO_FIELD_OVERRIDES: {
82
82
  readonly payment: FieldComponent;
83
+ readonly file_upload: FieldComponent;
84
+ readonly appointment: FieldComponent;
83
85
  };
84
86
 
85
- export { FieldCraftProProvider, type LicenseContext, type LicenseStatus, PRO_FIELD_OVERRIDES, ProPaymentField, UnlicensedOverlay, isProductionEnvironment, requireLicense, useLicense, validateLicense };
87
+ type UploadedFileItem = {
88
+ name: string;
89
+ size: number;
90
+ type: string;
91
+ url: string;
92
+ key?: string;
93
+ uploadedAt?: string;
94
+ etag?: string;
95
+ };
96
+ type ProFileUploadConfig = {
97
+ uploadUrl?: string;
98
+ publicKey?: string;
99
+ storageProvider?: "s3" | "r2" | "cloudinary" | "supabase" | "custom";
100
+ accept?: string[];
101
+ maxSizeMb?: number;
102
+ maxFiles?: number;
103
+ headers?: Record<string, string>;
104
+ };
105
+ /**
106
+ * Deciphers an AES-GCM (256-bit) encrypted presign response payload in browser memory.
107
+ *
108
+ * @param encryptedHex Hex-encoded ciphertext with appended GCM authentication tag
109
+ * @param ivHex Hex-encoded 12-byte initialization vector / nonce
110
+ * @param secretKeyStr Public or shared key string (derived to 256-bit key)
111
+ */
112
+ declare function decipherPresignPayload(encryptedHex: string, ivHex: string, secretKeyStr: string): Promise<any>;
113
+ /**
114
+ * Generates an ephemeral RSA-OAEP (2048-bit) key pair in browser memory.
115
+ * Used for dynamic, per-upload End-to-End Encryption (E2EE Chat App style).
116
+ */
117
+ declare function generateEphemeralKeyPair(): Promise<CryptoKeyPair>;
118
+ /**
119
+ * Exports an RSA Public Key to Base64 SPKI format (for sending to the presign API).
120
+ */
121
+ declare function exportPublicKeySpki(publicKey: CryptoKey): Promise<string>;
122
+ /**
123
+ * Decrypts an encrypted payload using the browser's ephemeral private key.
124
+ * Supports both pure RSA-OAEP and Hybrid RSA-OAEP + AES-GCM payloads.
125
+ */
126
+ declare function decryptEphemeralPayload(payload: {
127
+ encryptedPayload?: string;
128
+ ciphertext?: string;
129
+ encryptedKey?: string;
130
+ iv?: string;
131
+ format?: string;
132
+ }, privateKey: CryptoKey): Promise<any>;
133
+ /**
134
+ * Helper to encrypt a presign payload using AES-GCM 256-bit (used for testing or client-side generation)
135
+ */
136
+ declare function encryptPresignPayload(data: Record<string, any>, secretKeyStr: string): Promise<{
137
+ encryptedPayload: string;
138
+ iv: string;
139
+ }>;
140
+ /**
141
+ * ProFileUploadField — Zero-Knowledge Direct Cloud Upload Field.
142
+ *
143
+ * Streams files directly to AWS S3, Cloudflare R2, Cloudinary, or Supabase Storage
144
+ * using client-managed presigned URLs. Supports both plaintext and AES-GCM encrypted payloads.
145
+ */
146
+ declare function ProFileUploadField(props: FieldProps): react.JSX.Element;
147
+
148
+ type AppointmentSlot = {
149
+ date: string;
150
+ times: string[];
151
+ };
152
+ type ProAppointmentConfig = {
153
+ embedUrl?: string;
154
+ embedProvider?: "cal_com" | "calendly" | "custom";
155
+ slotsUrl?: string;
156
+ slots?: AppointmentSlot[];
157
+ duration?: number;
158
+ timezone?: string;
159
+ timezoneField?: string;
160
+ dateFormat?: string;
161
+ autoAdvance?: boolean;
162
+ };
163
+ type AppointmentBookingValue = {
164
+ provider: "cal_com" | "calendly" | "slots" | "custom";
165
+ status: "confirmed" | "cancelled" | "pending";
166
+ date?: string;
167
+ time?: string;
168
+ timezone?: string;
169
+ duration?: number;
170
+ bookingId?: string;
171
+ eventUri?: string;
172
+ inviteeUri?: string;
173
+ eventTitle?: string;
174
+ attendeeName?: string;
175
+ attendeeEmail?: string;
176
+ confirmedAt?: string;
177
+ };
178
+ /**
179
+ * ProAppointmentField — Multi-Provider Booking Engine with Cal.com, Calendly & Interactive Slots.
180
+ *
181
+ * Supports inline embeds with postMessage event listeners to capture booking details
182
+ * and auto-advance, as well as standalone interactive slot picking with dynamic timezone mapping.
183
+ */
184
+ declare function ProAppointmentField(props: FieldProps): react.JSX.Element;
185
+
186
+ export { type AppointmentBookingValue, type AppointmentSlot, FieldCraftProProvider, type LicenseContext, type LicenseStatus, PRO_FIELD_OVERRIDES, type ProAppointmentConfig, ProAppointmentField, type ProFileUploadConfig, ProFileUploadField, ProPaymentField, UnlicensedOverlay, type UploadedFileItem, decipherPresignPayload, decryptEphemeralPayload, encryptPresignPayload, exportPublicKeySpki, generateEphemeralKeyPair, isProductionEnvironment, requireLicense, useLicense, validateLicense };
package/dist/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
- import * as react_jsx_runtime from 'react/jsx-runtime';
1
+ import * as react from 'react';
2
2
  import { ReactNode, ComponentType } from 'react';
3
- export { BuilderStateHook, DEFAULT_PALETTE, DEFAULT_SCHEMA, FormBuilder, FormBuilderThemeProvider, QUESTION_TYPE_INFO, UndoRedoState, addOption, addQuestion, addSection, cn, duplicateQuestion, duplicateSection, findQuestion, findSection, generateId, generateOptionId, generateQuestionId, generateSectionId, moveOption, moveQuestion, moveSection, removeOption, removeQuestion, removeSection, updateOption, updateQuestion, updateSection, useBuilderState, useBuilderTheme, useDragDrop, useUndoRedo } from './form-builder/index.js';
4
- export { B as BuilderState, D as DragItem, a as DropTarget, F as FormBuilderPreviewProps, b as FormBuilderProps, c as FormBuilderTemplate, d as FormBuilderTheme, M as MutationAction, P as PaletteCategory, e as PropertyPanelTab, Q as QuestionTypeCategory, f as QuestionTypeInfo, S as SelectedItem } from './types-bFHsZT1n.js';
3
+ export { B as BuilderStateHook, D as DEFAULT_PALETTE, a as DEFAULT_SCHEMA, F as FormBuilder, b as FormBuilderThemeProvider, Q as QUESTION_TYPE_INFO, U as UndoRedoState, c as addOption, d as addQuestion, e as addSection, f as cn, g as duplicateQuestion, h as duplicateSection, i as findQuestion, j as findSection, k as generateId, l as generateOptionId, m as generateQuestionId, n as generateSectionId, o as moveOption, p as moveQuestion, q as moveSection, r as removeOption, s as removeQuestion, t as removeSection, u as updateOption, v as updateQuestion, w as updateSection, x as useBuilderState, y as useBuilderTheme, z as useDragDrop, A as useUndoRedo } from './default-schema-BGxf9Jrg.js';
4
+ export { B as BuilderState, D as DragItem, a as DropTarget, b as FormBuilderPreviewProps, c as FormBuilderProps, f as FormBuilderTemplate, F as FormBuilderTheme, M as MutationAction, P as PaletteCategory, d as PropertyPanelTab, Q as QuestionTypeCategory, e as QuestionTypeInfo, S as SelectedItem } from './types-BQOeI3LX.js';
5
5
  import { FieldComponent, FieldProps } from '@squaredr/fieldcraft-react';
6
6
  export { FieldRenderer, ResponseField, ResponseViewer, ResponseViewerProps, ViewMode } from './response-viewer/index.js';
7
7
  export { PRESET_FAMILIES, PREVIEW_SCHEMA, PresetFamily, ThemeEditor, ThemeEditorProps, ThemeEditorTheme, ThemeEditorThemeProvider, resolveThemeFromDOM, themeEditorDarkPreset, themeEditorLightPreset, useEditorTheme } from './theme-editor/index.js';
@@ -19,7 +19,7 @@ type FieldCraftProProviderProps = {
19
19
  licenseKey: string;
20
20
  children: ReactNode;
21
21
  };
22
- declare function FieldCraftProProvider({ licenseKey, children }: FieldCraftProProviderProps): react_jsx_runtime.JSX.Element;
22
+ declare function FieldCraftProProvider({ licenseKey, children }: FieldCraftProProviderProps): react.JSX.Element;
23
23
 
24
24
  declare function useLicense(): LicenseContext;
25
25
 
@@ -37,7 +37,7 @@ type UnlicensedOverlayProps = {
37
37
  * unmissable overlay on top. The component is visible underneath
38
38
  * but completely unusable — forcing a license purchase for production.
39
39
  */
40
- declare function UnlicensedOverlay({ featureName, reason, children }: UnlicensedOverlayProps): react_jsx_runtime.JSX.Element;
40
+ declare function UnlicensedOverlay({ featureName, reason, children }: UnlicensedOverlayProps): react.JSX.Element;
41
41
 
42
42
  /**
43
43
  * Detects whether the current environment is a production deployment.
@@ -67,11 +67,11 @@ declare function isProductionEnvironment(): boolean;
67
67
  *
68
68
  * Requires `@squaredr/paykit-react` and `@squaredr/paykit/stripe/client` as peer deps.
69
69
  */
70
- declare function ProPaymentField(props: FieldProps): react_jsx_runtime.JSX.Element;
70
+ declare function ProPaymentField(props: FieldProps): react.JSX.Element;
71
71
 
72
72
  /**
73
73
  * PRO_FIELD_OVERRIDES registry — maps field types to Pro-enhanced components.
74
- * Pass this to FormEngineRenderer's `components` prop to enable Pro payment:
74
+ * Pass this to FormEngineRenderer's `components` prop to enable Pro features:
75
75
  *
76
76
  * ```tsx
77
77
  * import { PRO_FIELD_OVERRIDES } from "@squaredr/fieldcraft-pro";
@@ -80,6 +80,107 @@ declare function ProPaymentField(props: FieldProps): react_jsx_runtime.JSX.Eleme
80
80
  */
81
81
  declare const PRO_FIELD_OVERRIDES: {
82
82
  readonly payment: FieldComponent;
83
+ readonly file_upload: FieldComponent;
84
+ readonly appointment: FieldComponent;
83
85
  };
84
86
 
85
- export { FieldCraftProProvider, type LicenseContext, type LicenseStatus, PRO_FIELD_OVERRIDES, ProPaymentField, UnlicensedOverlay, isProductionEnvironment, requireLicense, useLicense, validateLicense };
87
+ type UploadedFileItem = {
88
+ name: string;
89
+ size: number;
90
+ type: string;
91
+ url: string;
92
+ key?: string;
93
+ uploadedAt?: string;
94
+ etag?: string;
95
+ };
96
+ type ProFileUploadConfig = {
97
+ uploadUrl?: string;
98
+ publicKey?: string;
99
+ storageProvider?: "s3" | "r2" | "cloudinary" | "supabase" | "custom";
100
+ accept?: string[];
101
+ maxSizeMb?: number;
102
+ maxFiles?: number;
103
+ headers?: Record<string, string>;
104
+ };
105
+ /**
106
+ * Deciphers an AES-GCM (256-bit) encrypted presign response payload in browser memory.
107
+ *
108
+ * @param encryptedHex Hex-encoded ciphertext with appended GCM authentication tag
109
+ * @param ivHex Hex-encoded 12-byte initialization vector / nonce
110
+ * @param secretKeyStr Public or shared key string (derived to 256-bit key)
111
+ */
112
+ declare function decipherPresignPayload(encryptedHex: string, ivHex: string, secretKeyStr: string): Promise<any>;
113
+ /**
114
+ * Generates an ephemeral RSA-OAEP (2048-bit) key pair in browser memory.
115
+ * Used for dynamic, per-upload End-to-End Encryption (E2EE Chat App style).
116
+ */
117
+ declare function generateEphemeralKeyPair(): Promise<CryptoKeyPair>;
118
+ /**
119
+ * Exports an RSA Public Key to Base64 SPKI format (for sending to the presign API).
120
+ */
121
+ declare function exportPublicKeySpki(publicKey: CryptoKey): Promise<string>;
122
+ /**
123
+ * Decrypts an encrypted payload using the browser's ephemeral private key.
124
+ * Supports both pure RSA-OAEP and Hybrid RSA-OAEP + AES-GCM payloads.
125
+ */
126
+ declare function decryptEphemeralPayload(payload: {
127
+ encryptedPayload?: string;
128
+ ciphertext?: string;
129
+ encryptedKey?: string;
130
+ iv?: string;
131
+ format?: string;
132
+ }, privateKey: CryptoKey): Promise<any>;
133
+ /**
134
+ * Helper to encrypt a presign payload using AES-GCM 256-bit (used for testing or client-side generation)
135
+ */
136
+ declare function encryptPresignPayload(data: Record<string, any>, secretKeyStr: string): Promise<{
137
+ encryptedPayload: string;
138
+ iv: string;
139
+ }>;
140
+ /**
141
+ * ProFileUploadField — Zero-Knowledge Direct Cloud Upload Field.
142
+ *
143
+ * Streams files directly to AWS S3, Cloudflare R2, Cloudinary, or Supabase Storage
144
+ * using client-managed presigned URLs. Supports both plaintext and AES-GCM encrypted payloads.
145
+ */
146
+ declare function ProFileUploadField(props: FieldProps): react.JSX.Element;
147
+
148
+ type AppointmentSlot = {
149
+ date: string;
150
+ times: string[];
151
+ };
152
+ type ProAppointmentConfig = {
153
+ embedUrl?: string;
154
+ embedProvider?: "cal_com" | "calendly" | "custom";
155
+ slotsUrl?: string;
156
+ slots?: AppointmentSlot[];
157
+ duration?: number;
158
+ timezone?: string;
159
+ timezoneField?: string;
160
+ dateFormat?: string;
161
+ autoAdvance?: boolean;
162
+ };
163
+ type AppointmentBookingValue = {
164
+ provider: "cal_com" | "calendly" | "slots" | "custom";
165
+ status: "confirmed" | "cancelled" | "pending";
166
+ date?: string;
167
+ time?: string;
168
+ timezone?: string;
169
+ duration?: number;
170
+ bookingId?: string;
171
+ eventUri?: string;
172
+ inviteeUri?: string;
173
+ eventTitle?: string;
174
+ attendeeName?: string;
175
+ attendeeEmail?: string;
176
+ confirmedAt?: string;
177
+ };
178
+ /**
179
+ * ProAppointmentField — Multi-Provider Booking Engine with Cal.com, Calendly & Interactive Slots.
180
+ *
181
+ * Supports inline embeds with postMessage event listeners to capture booking details
182
+ * and auto-advance, as well as standalone interactive slot picking with dynamic timezone mapping.
183
+ */
184
+ declare function ProAppointmentField(props: FieldProps): react.JSX.Element;
185
+
186
+ export { type AppointmentBookingValue, type AppointmentSlot, FieldCraftProProvider, type LicenseContext, type LicenseStatus, PRO_FIELD_OVERRIDES, type ProAppointmentConfig, ProAppointmentField, type ProFileUploadConfig, ProFileUploadField, ProPaymentField, UnlicensedOverlay, type UploadedFileItem, decipherPresignPayload, decryptEphemeralPayload, encryptPresignPayload, exportPublicKeySpki, generateEphemeralKeyPair, isProductionEnvironment, requireLicense, useLicense, validateLicense };