@vulcantech/forms 0.2.0 → 0.4.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.
- package/README.md +132 -6
- package/dist/index.d.mts +870 -35
- package/dist/index.d.ts +870 -35
- package/dist/index.js +1055 -229
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1016 -233
- package/dist/index.mjs.map +1 -1
- package/fingerprint.json +4 -0
- package/package.json +12 -4
package/dist/index.d.ts
CHANGED
|
@@ -14,6 +14,15 @@ interface FieldOption {
|
|
|
14
14
|
value: string;
|
|
15
15
|
}
|
|
16
16
|
type FieldWidth = "full" | "half" | "third";
|
|
17
|
+
/** A blocked window inside one calendar day. Times are local "HH:mm". */
|
|
18
|
+
interface ExcludedTimeRange {
|
|
19
|
+
/** The day this range applies to, "yyyy-MM-dd". */
|
|
20
|
+
date: string;
|
|
21
|
+
/** Start of the closed window, inclusive. */
|
|
22
|
+
from: string;
|
|
23
|
+
/** End of the closed window, exclusive. */
|
|
24
|
+
to: string;
|
|
25
|
+
}
|
|
17
26
|
interface DatetimeConfig {
|
|
18
27
|
showTimeSelect?: boolean;
|
|
19
28
|
timeIntervals?: number;
|
|
@@ -30,6 +39,30 @@ interface DatetimeConfig {
|
|
|
30
39
|
* non-weekend day after today — on a Friday or Saturday that's Monday).
|
|
31
40
|
*/
|
|
32
41
|
excludeNextBusinessDay?: boolean;
|
|
42
|
+
/**
|
|
43
|
+
* Specific calendar days to block, as `"yyyy-MM-dd"` strings — holidays,
|
|
44
|
+
* shop closures, vacations. Unlike the rule-based exclusions above these
|
|
45
|
+
* name individual dates, so they are the mechanism a CMS closure calendar
|
|
46
|
+
* uses: `/api/forms` merges the project's booking closures into this list
|
|
47
|
+
* on every booking form's date fields before serving the definition.
|
|
48
|
+
*
|
|
49
|
+
* Dates are compared as local calendar days, so a viewer in any timezone
|
|
50
|
+
* sees the same day blocked.
|
|
51
|
+
*/
|
|
52
|
+
excludeDates?: string[];
|
|
53
|
+
/**
|
|
54
|
+
* Parts of a day to block, for days that are only partly closed — closing
|
|
55
|
+
* early, opening late, an afternoon off. Written by the same CMS closure
|
|
56
|
+
* calendar as {@link DatetimeConfig.excludeDates}; a day listed there is
|
|
57
|
+
* closed outright and needs no ranges here.
|
|
58
|
+
*
|
|
59
|
+
* A day may carry several ranges. `from` is inclusive and `to` is
|
|
60
|
+
* exclusive, so 12:00–18:00 blocks the 12:00 slot and leaves an 18:00 one
|
|
61
|
+
* bookable — the shape a "closed from noon" instruction actually means.
|
|
62
|
+
* Ranges only affect fields that offer a time; a date-only field ignores
|
|
63
|
+
* them, since half a day is still that day.
|
|
64
|
+
*/
|
|
65
|
+
excludeTimeRanges?: ExcludedTimeRange[];
|
|
33
66
|
filterPastTimes?: boolean;
|
|
34
67
|
dateFormat?: string;
|
|
35
68
|
placeholderText?: string;
|
|
@@ -74,17 +107,17 @@ interface SensitiveFieldConfig {
|
|
|
74
107
|
}
|
|
75
108
|
declare const DEFAULT_SENSITIVE_FIELD_CONFIG: SensitiveFieldConfig;
|
|
76
109
|
/**
|
|
77
|
-
* Configuration for the `file` field type. Files are uploaded
|
|
78
|
-
*
|
|
79
|
-
*
|
|
80
|
-
*
|
|
81
|
-
*
|
|
110
|
+
* Configuration for the `file` field type. Files are uploaded by the
|
|
111
|
+
* consuming app before submit; the form submission receives the resulting
|
|
112
|
+
* URL(s) rather than raw file data — a string, or an array of strings when
|
|
113
|
+
* `multiple`. The CMS stores whatever string arrives and does nothing
|
|
114
|
+
* file-specific with it.
|
|
82
115
|
*
|
|
83
|
-
*
|
|
84
|
-
*
|
|
85
|
-
*
|
|
86
|
-
*
|
|
87
|
-
*
|
|
116
|
+
* Uploads are NOT automatic: a form containing a `file` field must be given
|
|
117
|
+
* an upload path via `DynamicForm`'s `onFileUpload` or `fileUploadRoute`
|
|
118
|
+
* prop (see {@link FormFileUploadHandler}). Without one the picker renders
|
|
119
|
+
* disabled with an explanatory message rather than silently submitting a
|
|
120
|
+
* throwaway `blob:` URL.
|
|
88
121
|
*/
|
|
89
122
|
interface FileFieldConfig {
|
|
90
123
|
/** Accepted MIME types. Default: "image/*" */
|
|
@@ -96,14 +129,48 @@ interface FileFieldConfig {
|
|
|
96
129
|
/** Max number of files when multiple=true. Default: 5. */
|
|
97
130
|
maxFiles?: number;
|
|
98
131
|
/**
|
|
99
|
-
*
|
|
100
|
-
*
|
|
132
|
+
* Downscale images in the browser before handing them to the upload
|
|
133
|
+
* handler. Default: true.
|
|
134
|
+
*
|
|
135
|
+
* Applies only to JPEG, PNG and WebP, and only when the image is wider
|
|
136
|
+
* than {@link FileFieldConfig.maxImageWidth}; the format is preserved and
|
|
137
|
+
* anything that can't be re-encoded (GIF — a canvas round-trip would drop
|
|
138
|
+
* the animation, HEIC/HEIF, SVG, a file this browser can't decode) is
|
|
139
|
+
* uploaded untouched. `maxSizeBytes` is checked against the resized file,
|
|
140
|
+
* so a large photo that fits once downscaled is accepted.
|
|
101
141
|
*/
|
|
102
142
|
resizeImages?: boolean;
|
|
103
|
-
/** Max image width
|
|
143
|
+
/** Max image width in pixels when `resizeImages`. Default: 1600. */
|
|
104
144
|
maxImageWidth?: number;
|
|
105
145
|
}
|
|
106
146
|
declare const DEFAULT_FILE_FIELD_CONFIG: FileFieldConfig;
|
|
147
|
+
/**
|
|
148
|
+
* A file that has finished uploading. `url` is the value the form submits
|
|
149
|
+
* for the field (or one entry of the array, when `multiple`), so it must be
|
|
150
|
+
* durable and reachable outside the submitting browser tab — never a
|
|
151
|
+
* `blob:` or `data:` URL.
|
|
152
|
+
*/
|
|
153
|
+
interface UploadedFormFile {
|
|
154
|
+
/** Stored, publicly reachable URL. */
|
|
155
|
+
url: string;
|
|
156
|
+
/** Display name, shown in the field's file list. */
|
|
157
|
+
name: string;
|
|
158
|
+
/** Size in bytes, shown in the field's file list. */
|
|
159
|
+
size: number;
|
|
160
|
+
}
|
|
161
|
+
/**
|
|
162
|
+
* Uploads one picked file and resolves with its stored location.
|
|
163
|
+
*
|
|
164
|
+
* Supplied by the consuming app — this package deliberately ships no
|
|
165
|
+
* default implementation, because a public form submitter holds no CMS
|
|
166
|
+
* credentials. The usual shape mirrors `DynamicForm`'s `apiRoute`: POST the
|
|
167
|
+
* file to a server-side route in your own app, which holds the credentials
|
|
168
|
+
* and writes to storage, then return the stored URL.
|
|
169
|
+
*
|
|
170
|
+
* Called once per file, sequentially. Throw to fail the file — the message
|
|
171
|
+
* is shown inline under the picker and no value is recorded.
|
|
172
|
+
*/
|
|
173
|
+
type FormFileUploadHandler = (file: File, config: FileFieldConfig) => Promise<UploadedFormFile>;
|
|
107
174
|
interface FormFieldDefinition {
|
|
108
175
|
id: string;
|
|
109
176
|
type: FieldType;
|
|
@@ -155,6 +222,13 @@ interface FormSection {
|
|
|
155
222
|
* from the surrounding CSS cascade.
|
|
156
223
|
*/
|
|
157
224
|
textColor?: string;
|
|
225
|
+
/**
|
|
226
|
+
* Dark-mode counterpart of `textColor`. In dark mode the dark chain is
|
|
227
|
+
* consulted first (this, then the form's `defaultTextColorDark`) and only
|
|
228
|
+
* then the light chain — so one form-level dark color re-themes every
|
|
229
|
+
* section header, even ones that pinned a light `textColor`.
|
|
230
|
+
*/
|
|
231
|
+
textColorDark?: string;
|
|
158
232
|
/** When set, this section mirrors fields from an earlier section. */
|
|
159
233
|
sameAs?: SectionSameAsConfig;
|
|
160
234
|
}
|
|
@@ -165,9 +239,33 @@ interface FormSpamProtectionConfig {
|
|
|
165
239
|
/** Minimum seconds between mount and submit. Set to 0 to disable. Defaults to 3. */
|
|
166
240
|
minSubmitTime?: number;
|
|
167
241
|
}
|
|
242
|
+
/**
|
|
243
|
+
* Google Ads conversion settings for a single form.
|
|
244
|
+
*
|
|
245
|
+
* The `form_submit_success` dataLayer event fires on every successful submit
|
|
246
|
+
* regardless of this config; these settings only control the *direct*
|
|
247
|
+
* `gtag('event', 'conversion', …)` call, which sites without a GTM container
|
|
248
|
+
* need. Leave unset to inherit the project-wide `formConversionSendTo`
|
|
249
|
+
* tracking tag that `@vulcantech/analytics`'s `CMSTags` publishes.
|
|
250
|
+
*/
|
|
251
|
+
interface FormConversionConfig {
|
|
252
|
+
/**
|
|
253
|
+
* Google Ads conversion label in `AW-<id>/<label>` form, e.g.
|
|
254
|
+
* `"AW-18321257894/AbC-D3fGhIjKlmNoP"`. Copy it from Google Ads → Goals →
|
|
255
|
+
* the conversion action → Tag setup → "Install the tag yourself".
|
|
256
|
+
*/
|
|
257
|
+
sendTo?: string;
|
|
258
|
+
}
|
|
168
259
|
interface FormSubmitConfig {
|
|
169
260
|
buttonText: string;
|
|
170
261
|
submittingText?: string;
|
|
262
|
+
/**
|
|
263
|
+
* Terminal label the submit button shows after a successful submission,
|
|
264
|
+
* for as long as no field has been edited since. Defaults to `"Sent"` —
|
|
265
|
+
* `buttonText` returning makes a submitted form look unsubmitted, which is
|
|
266
|
+
* what drove customers to click Submit twice.
|
|
267
|
+
*/
|
|
268
|
+
submittedText?: string;
|
|
171
269
|
successMessage: string;
|
|
172
270
|
errorMessage: string;
|
|
173
271
|
successBehavior?: FormSuccessBehavior;
|
|
@@ -180,6 +278,11 @@ interface FormSubmitConfig {
|
|
|
180
278
|
*/
|
|
181
279
|
redirectUrl?: string;
|
|
182
280
|
spamProtection?: FormSpamProtectionConfig;
|
|
281
|
+
/**
|
|
282
|
+
* Per-form Google Ads conversion override. Optional — see
|
|
283
|
+
* {@link FormConversionConfig}.
|
|
284
|
+
*/
|
|
285
|
+
conversion?: FormConversionConfig;
|
|
183
286
|
}
|
|
184
287
|
/** Field name used for the honeypot. Bots tend to fill anything called "website". */
|
|
185
288
|
declare const HONEYPOT_FIELD_NAME = "_hp_website";
|
|
@@ -190,6 +293,11 @@ declare const sameAsToggleKey: (sectionId: string) => string;
|
|
|
190
293
|
declare const DEFAULT_SPAM_PROTECTION: Required<FormSpamProtectionConfig>;
|
|
191
294
|
type FormStylePreset = "default" | "minimal" | "bordered" | "shadow" | "card" | "dark";
|
|
192
295
|
type InputVariant = "outlined" | "filled" | "underlined" | "stacked";
|
|
296
|
+
/**
|
|
297
|
+
* The two palettes a form can carry. "light" is the base set of colors every
|
|
298
|
+
* form has always had; "dark" is the optional override set in `FormStyle.dark`.
|
|
299
|
+
*/
|
|
300
|
+
type FormColorScheme = "light" | "dark";
|
|
193
301
|
/**
|
|
194
302
|
* Theme overrides for a form. Every color is OPTIONAL — when unset, the
|
|
195
303
|
* renderer falls back to a baked-in default via CSS `var()` fallbacks. This
|
|
@@ -204,7 +312,33 @@ type InputVariant = "outlined" | "filled" | "underlined" | "stacked";
|
|
|
204
312
|
interface FormStyle {
|
|
205
313
|
preset: FormStylePreset;
|
|
206
314
|
borderRadius: "none" | "sm" | "md" | "lg" | "full";
|
|
207
|
-
|
|
315
|
+
/**
|
|
316
|
+
* Arbitrary CSS length overriding the `borderRadius` step, e.g. `"3px"`.
|
|
317
|
+
*
|
|
318
|
+
* The five named steps are Tailwind classes, which a consumer site cannot
|
|
319
|
+
* override from its own stylesheet — that is what forced sites onto
|
|
320
|
+
* `.eg-form-dark input { border-radius: 3px }`-style patches. When this is
|
|
321
|
+
* set the renderer drops the `rounded-*` class and drives corners through
|
|
322
|
+
* the `--form-radius` custom property instead, reaching the form root, the
|
|
323
|
+
* inputs AND the submit button. (The named steps never reached inputs at
|
|
324
|
+
* all — input geometry is baked per `inputVariant`.)
|
|
325
|
+
*
|
|
326
|
+
* Unset — the default — leaves the class-based behaviour exactly as it was.
|
|
327
|
+
*/
|
|
328
|
+
borderRadiusValue?: string;
|
|
329
|
+
spacing: "none" | "compact" | "normal" | "relaxed";
|
|
330
|
+
/**
|
|
331
|
+
* Arbitrary CSS length for the gap BETWEEN fields, e.g. `"1.5rem"`.
|
|
332
|
+
*
|
|
333
|
+
* `spacing` drives two different things — the form root's padding and the
|
|
334
|
+
* field grid's gap — which is fine for the three graded steps but breaks down
|
|
335
|
+
* at `"none"`: a form wanting zero padding almost never wants its fields
|
|
336
|
+
* glued together. This overrides the gap independently, leaving `spacing` to
|
|
337
|
+
* mean padding.
|
|
338
|
+
*
|
|
339
|
+
* Unset — the default — keeps the gap `spacing` implies.
|
|
340
|
+
*/
|
|
341
|
+
fieldGapValue?: string;
|
|
208
342
|
buttonVariant: "filled" | "outline" | "ghost";
|
|
209
343
|
/**
|
|
210
344
|
* Where the submit button renders. "below" (default) spans the full form
|
|
@@ -222,6 +356,17 @@ interface FormStyle {
|
|
|
222
356
|
inputBorderColor?: string;
|
|
223
357
|
/** Input border color on focus. Default: #2563eb. */
|
|
224
358
|
inputFocusColor?: string;
|
|
359
|
+
/**
|
|
360
|
+
* Arbitrary CSS length overriding the bottom-border thickness on focus and
|
|
361
|
+
* on validation error, e.g. `"3px"`. Only affects the `filled` and
|
|
362
|
+
* `underlined` variants — a full-border ring (`outlined`/`stacked`) already
|
|
363
|
+
* reads as focused/errored from color alone, so a bare color change on
|
|
364
|
+
* `filled`/`underlined` can be too subtle; thickening the underline is the
|
|
365
|
+
* variant-appropriate substitute for those two.
|
|
366
|
+
*
|
|
367
|
+
* Unset — the default — keeps the idle 2px bottom border on focus/error.
|
|
368
|
+
*/
|
|
369
|
+
inputFocusBorderWidth?: string;
|
|
225
370
|
/** Color of the text typed into inputs. Default: inherit from the page. */
|
|
226
371
|
inputTextColor?: string;
|
|
227
372
|
/** Placeholder text color. Default: #9ca3af. */
|
|
@@ -234,7 +379,28 @@ interface FormStyle {
|
|
|
234
379
|
buttonColor?: string;
|
|
235
380
|
/** Submit button text color (filled variant only — outline/ghost use buttonColor). Default: #ffffff. */
|
|
236
381
|
buttonTextColor?: string;
|
|
382
|
+
/**
|
|
383
|
+
* Dark-mode overrides for the color slots above. They apply only while
|
|
384
|
+
* the host page is in dark mode — an ancestor matching `.dark`, the class
|
|
385
|
+
* next-themes puts on `<html>` in every VulcanTech site that has a theme
|
|
386
|
+
* toggle (`DynamicForm`'s `darkModeSelector` prop changes the selector).
|
|
387
|
+
* A light-only site never has that class and never sees these.
|
|
388
|
+
*
|
|
389
|
+
* Each slot falls back to its LIGHT value, so an unset dark slot means
|
|
390
|
+
* "same as light", never "package default". Absent — the default — the
|
|
391
|
+
* renderer emits exactly what it did before this existed.
|
|
392
|
+
*/
|
|
393
|
+
dark?: FormStyleColors;
|
|
237
394
|
}
|
|
395
|
+
/**
|
|
396
|
+
* The keys of `FormStyle` that carry a color, in the order the renderer
|
|
397
|
+
* publishes them. Shared by the scheme resolver and the builder's color rows,
|
|
398
|
+
* so a new color slot is added in exactly one place.
|
|
399
|
+
*/
|
|
400
|
+
declare const FORM_STYLE_COLOR_KEYS: readonly ["formBackgroundColor", "inputBgColor", "inputBorderColor", "inputFocusColor", "inputTextColor", "placeholderColor", "labelColor", "errorColor", "buttonColor", "buttonTextColor"];
|
|
401
|
+
type FormStyleColorKey = (typeof FORM_STYLE_COLOR_KEYS)[number];
|
|
402
|
+
/** Just the color slots of a `FormStyle`, every one optional. */
|
|
403
|
+
type FormStyleColors = Pick<FormStyle, FormStyleColorKey>;
|
|
238
404
|
/**
|
|
239
405
|
* Structural defaults only. Colors are intentionally absent — they resolve
|
|
240
406
|
* via the renderer's CSS var fallbacks (see `cssVars.ts`) when the form
|
|
@@ -277,7 +443,20 @@ type FormStatus = "draft" | "published" | "archived";
|
|
|
277
443
|
* Only the routing changes — spam protection, sensitive field handling,
|
|
278
444
|
* notification emails, and integrations behave identically.
|
|
279
445
|
*/
|
|
280
|
-
type FormSubmissionType = "contact" | "application" | "newsletter" | "booking"
|
|
446
|
+
type FormSubmissionType = "contact" | "application" | "newsletter" | "booking"
|
|
447
|
+
/**
|
|
448
|
+
* A checklist run compiled from an SOP. Never submitted through the public
|
|
449
|
+
* `/api/contact` path — runs are filled in by signed-in members inside the
|
|
450
|
+
* CMS and go to the SOP runs API, so the contact route treats an unknown
|
|
451
|
+
* type as `"contact"` exactly as before.
|
|
452
|
+
*/
|
|
453
|
+
| "sop"
|
|
454
|
+
/**
|
|
455
|
+
* A public form compiled from a public-forms document. Filled in by
|
|
456
|
+
* anyone holding the share link and submitted to the CMS public-forms
|
|
457
|
+
* responses API, never to `/api/contact`.
|
|
458
|
+
*/
|
|
459
|
+
| "public-form";
|
|
281
460
|
/**
|
|
282
461
|
* Booking settings for a form with `submissionType: "booking"`. The renderer
|
|
283
462
|
* is unaffected — booking forms submit exactly like any other form; the CMS
|
|
@@ -416,6 +595,11 @@ interface FormDefinition {
|
|
|
416
595
|
* the form is embedded on a page with its own typography).
|
|
417
596
|
*/
|
|
418
597
|
defaultTextColor?: string;
|
|
598
|
+
/**
|
|
599
|
+
* Dark-mode counterpart of `defaultTextColor`, applied under the same
|
|
600
|
+
* conditions as `FormStyle.dark`. Per-section `textColorDark` overrides it.
|
|
601
|
+
*/
|
|
602
|
+
defaultTextColorDark?: string;
|
|
419
603
|
metadata?: {
|
|
420
604
|
trackAdReferral?: boolean;
|
|
421
605
|
customFields?: Record<string, unknown>;
|
|
@@ -497,6 +681,8 @@ interface FormFieldDefinitionJSON {
|
|
|
497
681
|
datetimeConfig?: DatetimeConfig;
|
|
498
682
|
showWhen?: FieldVisibilityCondition;
|
|
499
683
|
sensitiveConfig?: SensitiveFieldConfigJSON;
|
|
684
|
+
/** No narrowed unions, so the strict type is reused. */
|
|
685
|
+
fileConfig?: FileFieldConfig;
|
|
500
686
|
}
|
|
501
687
|
interface FormSectionJSON {
|
|
502
688
|
id: string;
|
|
@@ -505,6 +691,7 @@ interface FormSectionJSON {
|
|
|
505
691
|
fields: FormFieldDefinitionJSON[];
|
|
506
692
|
order: number;
|
|
507
693
|
textColor?: string;
|
|
694
|
+
textColorDark?: string;
|
|
508
695
|
sameAs?: SectionSameAsConfig;
|
|
509
696
|
}
|
|
510
697
|
interface FormStyleJSON {
|
|
@@ -515,6 +702,22 @@ interface FormStyleJSON {
|
|
|
515
702
|
buttonPlacement?: string;
|
|
516
703
|
sectionDividers: boolean;
|
|
517
704
|
inputVariant: string;
|
|
705
|
+
formBackgroundColor?: string;
|
|
706
|
+
inputBgColor?: string;
|
|
707
|
+
inputBorderColor?: string;
|
|
708
|
+
inputFocusColor?: string;
|
|
709
|
+
inputFocusBorderWidth?: string;
|
|
710
|
+
inputTextColor?: string;
|
|
711
|
+
placeholderColor?: string;
|
|
712
|
+
labelColor?: string;
|
|
713
|
+
errorColor?: string;
|
|
714
|
+
buttonColor?: string;
|
|
715
|
+
buttonTextColor?: string;
|
|
716
|
+
/** Dark-mode overrides; same optional color keys as the light set. */
|
|
717
|
+
dark?: FormStyleColorsJSON;
|
|
718
|
+
}
|
|
719
|
+
/** JSON mirror of {@link FormStyleColors}. */
|
|
720
|
+
interface FormStyleColorsJSON {
|
|
518
721
|
formBackgroundColor?: string;
|
|
519
722
|
inputBgColor?: string;
|
|
520
723
|
inputBorderColor?: string;
|
|
@@ -529,11 +732,14 @@ interface FormStyleJSON {
|
|
|
529
732
|
interface FormSubmitConfigJSON {
|
|
530
733
|
buttonText: string;
|
|
531
734
|
submittingText?: string;
|
|
735
|
+
submittedText?: string;
|
|
532
736
|
successMessage: string;
|
|
533
737
|
errorMessage: string;
|
|
534
738
|
successBehavior?: string;
|
|
535
739
|
redirectUrl?: string;
|
|
536
740
|
spamProtection?: FormSpamProtectionConfig;
|
|
741
|
+
/** See {@link FormSubmitConfig.conversion} — no narrowed unions, so the strict type is reused. */
|
|
742
|
+
conversion?: FormConversionConfig;
|
|
537
743
|
}
|
|
538
744
|
interface IntegrationFieldMappingEntryJSON {
|
|
539
745
|
field: string;
|
|
@@ -560,6 +766,7 @@ interface FormDefinitionJSON {
|
|
|
560
766
|
submitConfig: FormSubmitConfigJSON;
|
|
561
767
|
style?: FormStyleJSON;
|
|
562
768
|
defaultTextColor?: string;
|
|
769
|
+
defaultTextColorDark?: string;
|
|
563
770
|
metadata?: {
|
|
564
771
|
trackAdReferral?: boolean;
|
|
565
772
|
customFields?: Record<string, unknown>;
|
|
@@ -638,6 +845,169 @@ declare function applyTransform(value: string, transform?: FieldTransform): stri
|
|
|
638
845
|
*/
|
|
639
846
|
declare function getSafeRedirectUrl(raw: string | null | undefined): string | null;
|
|
640
847
|
|
|
848
|
+
/**
|
|
849
|
+
* Google conversion signalling for successful form submissions.
|
|
850
|
+
*
|
|
851
|
+
* Two independent signals, both fired once per genuine success by
|
|
852
|
+
* `DynamicForm` (see `trackFormConversion`):
|
|
853
|
+
*
|
|
854
|
+
* 1. A `dataLayer` push of `form_submit_success`. Works with BOTH plain
|
|
855
|
+
* gtag.js (which creates `window.dataLayer` — `@vulcantech/analytics`'s
|
|
856
|
+
* `CMSTags` bootstraps it) and Google Tag Manager, where it can drive a
|
|
857
|
+
* Custom Event trigger. Always fired; costs nothing when nobody listens.
|
|
858
|
+
* 2. An optional direct `gtag('event', 'conversion', { send_to })` for sites
|
|
859
|
+
* with a Google Ads conversion action but no GTM container. Fired only
|
|
860
|
+
* when a `send_to` label is configured — never hardcoded in a consumer app.
|
|
861
|
+
* Carries a `transaction_id` so Google dedupes a double-fired submission,
|
|
862
|
+
* and — only on sites that opted into enhanced conversions — is preceded
|
|
863
|
+
* by `gtag('set', 'user_data', …)` with the lead's email and phone.
|
|
864
|
+
* 3. A GA4 `generate_lead` event whenever `gtag` is on the page.
|
|
865
|
+
*
|
|
866
|
+
* Everything here is defensive by design: these are analytics side effects on
|
|
867
|
+
* the lead-capture happy path, so a missing global, a hostile `dataLayer`
|
|
868
|
+
* stub, or a throwing `gtag` must never turn a stored lead into an error
|
|
869
|
+
* banner. Every function swallows its own failures and reports success as a
|
|
870
|
+
* boolean instead.
|
|
871
|
+
*
|
|
872
|
+
* PII: the `dataLayer` push and `generate_lead` carry only the form's own
|
|
873
|
+
* identity (id, name, type), never submitted values. The single exception is
|
|
874
|
+
* enhanced conversions: when the site publishes
|
|
875
|
+
* {@link ENHANCED_CONVERSIONS_GLOBAL} (`CMSTags`' `enhancedConversions` tag),
|
|
876
|
+
* the submitted email and phone go to `gtag('set', 'user_data')`, which
|
|
877
|
+
* hashes them before they leave the browser. Sites that enable it must say so
|
|
878
|
+
* in their privacy policy.
|
|
879
|
+
*/
|
|
880
|
+
/** `dataLayer` event name pushed after every successful form submission. */
|
|
881
|
+
declare const FORM_SUBMIT_SUCCESS_EVENT = "form_submit_success";
|
|
882
|
+
/**
|
|
883
|
+
* `window` key a site-wide Google Ads `send_to` label can be published on.
|
|
884
|
+
*
|
|
885
|
+
* `@vulcantech/analytics`'s `CMSTags` writes the project's
|
|
886
|
+
* `formConversionSendTo` tracking tag here, which lets every form on the site
|
|
887
|
+
* fire the Ads conversion with no per-form and no per-app configuration. A
|
|
888
|
+
* form's own `submitConfig.conversion.sendTo` overrides it.
|
|
889
|
+
*/
|
|
890
|
+
declare const FORM_CONVERSION_SEND_TO_GLOBAL = "__vtFormConversionSendTo";
|
|
891
|
+
/**
|
|
892
|
+
* `window` key `CMSTags` sets to `true` when the project opted into Google
|
|
893
|
+
* Ads enhanced conversions. Mirrored in `@vulcantech/analytics` (the two
|
|
894
|
+
* packages are independent, so it is a constant, not an import).
|
|
895
|
+
*/
|
|
896
|
+
declare const ENHANCED_CONVERSIONS_GLOBAL = "__vtEnhancedConversions";
|
|
897
|
+
/** Identity of the submitted form. Deliberately free of submitted values. */
|
|
898
|
+
interface FormConversionContext {
|
|
899
|
+
/** The CMS form definition id. */
|
|
900
|
+
formId: string;
|
|
901
|
+
/** Human-readable form name, as authored in the CMS. */
|
|
902
|
+
formName: string;
|
|
903
|
+
/** Submission type — "contact", "application", "newsletter", "booking". */
|
|
904
|
+
formType: string;
|
|
905
|
+
}
|
|
906
|
+
/** Lead contact details for enhanced conversions, as submitted. */
|
|
907
|
+
interface ConversionUserData {
|
|
908
|
+
email?: unknown;
|
|
909
|
+
phone?: unknown;
|
|
910
|
+
}
|
|
911
|
+
/** Per-submission extras for the Ads conversion. */
|
|
912
|
+
interface ConversionExtras {
|
|
913
|
+
/** Unique id for this submission — Google dedupes conversions on it. */
|
|
914
|
+
transactionId?: string;
|
|
915
|
+
/** Submitted email/phone; only sent when enhanced conversions is on. */
|
|
916
|
+
userData?: ConversionUserData;
|
|
917
|
+
}
|
|
918
|
+
/**
|
|
919
|
+
* Normalize a North American phone number to E.164 (`+1XXXXXXXXXX`), the
|
|
920
|
+
* format Google requires for `user_data.phone_number`.
|
|
921
|
+
*
|
|
922
|
+
* @param raw The phone number as the visitor typed it.
|
|
923
|
+
* @returns The E.164 string, or `undefined` when it is not a 10-digit NANP
|
|
924
|
+
* number (with or without the leading 1) — an unparseable number is left
|
|
925
|
+
* out rather than sent malformed.
|
|
926
|
+
*/
|
|
927
|
+
declare function toE164(raw: unknown): string | undefined;
|
|
928
|
+
/**
|
|
929
|
+
* Build the `user_data` object for enhanced conversions, omitting any field
|
|
930
|
+
* the visitor did not supply (Google wants absent fields left out, not empty).
|
|
931
|
+
*
|
|
932
|
+
* @returns The object, or `undefined` when neither email nor phone is usable.
|
|
933
|
+
*/
|
|
934
|
+
declare function buildUserData(input: ConversionUserData | undefined): {
|
|
935
|
+
email?: string;
|
|
936
|
+
phone_number?: string;
|
|
937
|
+
} | undefined;
|
|
938
|
+
/**
|
|
939
|
+
* A unique id for one submission, used as the Ads `transaction_id`.
|
|
940
|
+
* `crypto.randomUUID` needs a secure context, so a timestamp+random id is the
|
|
941
|
+
* fallback on plain-http dev hosts.
|
|
942
|
+
*/
|
|
943
|
+
declare function newTransactionId(): string;
|
|
944
|
+
/**
|
|
945
|
+
* Push the `form_submit_success` event onto `window.dataLayer`.
|
|
946
|
+
*
|
|
947
|
+
* Creates `dataLayer` when it does not exist yet, so the event is not lost
|
|
948
|
+
* when a form succeeds before gtag.js/GTM has finished loading — both replay
|
|
949
|
+
* the pre-existing array on init.
|
|
950
|
+
*
|
|
951
|
+
* @param context Form identity to attach to the event. No submitted values.
|
|
952
|
+
* @returns `true` when the event was pushed, `false` on the server or when
|
|
953
|
+
* `dataLayer` is present but unusable (e.g. not an array-like with `push`).
|
|
954
|
+
*/
|
|
955
|
+
declare function pushFormSubmitSuccess(context: FormConversionContext): boolean;
|
|
956
|
+
/**
|
|
957
|
+
* Fire a Google Ads conversion via the page's `gtag`.
|
|
958
|
+
*
|
|
959
|
+
* When the site opted into enhanced conversions and `extras.userData` holds a
|
|
960
|
+
* usable email or phone, `gtag('set', 'user_data', …)` runs first — Google
|
|
961
|
+
* requires it before the conversion event.
|
|
962
|
+
*
|
|
963
|
+
* @param sendTo The Ads conversion label, e.g.
|
|
964
|
+
* `"AW-18321257894/AbC-D3fGhIjKlmNoP"`. Anything empty or non-string is a
|
|
965
|
+
* no-op — an unconfigured site simply does not fire a conversion.
|
|
966
|
+
* @param extras Optional `transactionId` and `userData` for this submission.
|
|
967
|
+
* @returns `true` when the conversion was sent, `false` otherwise.
|
|
968
|
+
*/
|
|
969
|
+
declare function fireAdsConversion(sendTo: unknown, extras?: ConversionExtras): boolean;
|
|
970
|
+
/**
|
|
971
|
+
* Send GA4's recommended `generate_lead` event for a successful submission.
|
|
972
|
+
* Form identity only — no submitted values.
|
|
973
|
+
*
|
|
974
|
+
* @returns `true` when `gtag` was called, `false` otherwise.
|
|
975
|
+
*/
|
|
976
|
+
declare function fireGenerateLead(context: FormConversionContext): boolean;
|
|
977
|
+
/**
|
|
978
|
+
* Resolve the Ads `send_to` label for a form: the form's own config first,
|
|
979
|
+
* then the site-wide value published by `CMSTags` on
|
|
980
|
+
* {@link FORM_CONVERSION_SEND_TO_GLOBAL}.
|
|
981
|
+
*
|
|
982
|
+
* @param formSendTo `submitConfig.conversion.sendTo` for this form, if any.
|
|
983
|
+
* @returns The trimmed label, or `undefined` when neither source supplies one.
|
|
984
|
+
*/
|
|
985
|
+
declare function resolveConversionSendTo(formSendTo?: string): string | undefined;
|
|
986
|
+
/**
|
|
987
|
+
* The single call `DynamicForm` makes on a genuine submission success: push
|
|
988
|
+
* the `dataLayer` event, then fire the Ads conversion when a label resolves.
|
|
989
|
+
*
|
|
990
|
+
* Called exactly once per successful submit — after the `/api/contact`
|
|
991
|
+
* response is accepted and before any success UI or redirect. Deliberately
|
|
992
|
+
* NOT called on the spam short-circuit (honeypot/timer), which fakes a
|
|
993
|
+
* success without ever reaching the server: counting caught bots as
|
|
994
|
+
* conversions is precisely the pollution the short-circuit exists to prevent,
|
|
995
|
+
* and it matches the existing rule that the spam path never reaches
|
|
996
|
+
* `redirectUrl` (typically a conversion thank-you page).
|
|
997
|
+
*
|
|
998
|
+
* @param context Form identity for the `dataLayer` payload.
|
|
999
|
+
* @param formSendTo Per-form Ads label override from
|
|
1000
|
+
* `submitConfig.conversion.sendTo`.
|
|
1001
|
+
* @param extras `transactionId` and enhanced-conversion `userData`.
|
|
1002
|
+
* @returns Which signals actually fired — useful in tests; callers in the
|
|
1003
|
+
* renderer ignore it.
|
|
1004
|
+
*/
|
|
1005
|
+
declare function trackFormConversion(context: FormConversionContext, formSendTo?: string, extras?: ConversionExtras): {
|
|
1006
|
+
pushed: boolean;
|
|
1007
|
+
conversionFired: boolean;
|
|
1008
|
+
leadFired: boolean;
|
|
1009
|
+
};
|
|
1010
|
+
|
|
641
1011
|
/**
|
|
642
1012
|
* Formats raw digits as a US Social Security number (NNN-NN-NNNN).
|
|
643
1013
|
* Truncates anything past 9 digits.
|
|
@@ -723,6 +1093,42 @@ declare function renderNotificationEmail(template: NotificationEmailTemplate, va
|
|
|
723
1093
|
html: string;
|
|
724
1094
|
};
|
|
725
1095
|
|
|
1096
|
+
/**
|
|
1097
|
+
* Client-side image downscaling for `file` fields.
|
|
1098
|
+
*
|
|
1099
|
+
* A phone camera hands the picker a 4000px, several-megabyte photo for what
|
|
1100
|
+
* is almost always displayed as a thumbnail on a lead. Downscaling in the
|
|
1101
|
+
* browser — before the bytes leave it — is the only place that saves the
|
|
1102
|
+
* submitter's upload time as well as our storage.
|
|
1103
|
+
*
|
|
1104
|
+
* The rule this module follows everywhere: **never lose a file to an
|
|
1105
|
+
* optimisation.** Every failure path (an undecodable file, a browser without
|
|
1106
|
+
* the APIs, an encoder that returns nothing, a re-encode that came out
|
|
1107
|
+
* bigger) returns the original `File` unchanged, so the worst case is the
|
|
1108
|
+
* behaviour we had before resizing existed.
|
|
1109
|
+
*/
|
|
1110
|
+
/**
|
|
1111
|
+
* Scale an image file down so it is at most `maxWidth` pixels wide,
|
|
1112
|
+
* re-encoding it in its original format.
|
|
1113
|
+
*
|
|
1114
|
+
* Only images narrower-or-equal to the limit, unsupported formats, and files
|
|
1115
|
+
* this environment cannot decode are left alone — everything else comes back
|
|
1116
|
+
* as a new `File` carrying the same name, type and `lastModified`, so the
|
|
1117
|
+
* upload handler and the CMS's magic-byte check see an ordinary picked file.
|
|
1118
|
+
*
|
|
1119
|
+
* EXIF orientation is baked into the pixels (`imageOrientation: "from-image"`),
|
|
1120
|
+
* which is what a browser would have rendered anyway; the resized copy carries
|
|
1121
|
+
* no EXIF of its own, so a rotated photo stays upright without the metadata
|
|
1122
|
+
* that made it so.
|
|
1123
|
+
*
|
|
1124
|
+
* @param file - The picked file.
|
|
1125
|
+
* @param maxWidth - Maximum width in pixels. Non-positive or non-finite
|
|
1126
|
+
* values disable resizing.
|
|
1127
|
+
* @returns The downscaled file, or the original when resizing was skipped or
|
|
1128
|
+
* failed. Never rejects.
|
|
1129
|
+
*/
|
|
1130
|
+
declare function resizeImageFile(file: File, maxWidth: number): Promise<File>;
|
|
1131
|
+
|
|
726
1132
|
/**
|
|
727
1133
|
* Client-side encryption utilities for sensitive form fields.
|
|
728
1134
|
*
|
|
@@ -791,10 +1197,12 @@ interface DynamicFormProps {
|
|
|
791
1197
|
* `POST /api/contact`.
|
|
792
1198
|
*
|
|
793
1199
|
* The body is a FLAT JSON object: the definition's field ids as top-level
|
|
794
|
-
* keys, plus `extraData`, plus `formId
|
|
795
|
-
*
|
|
796
|
-
*
|
|
797
|
-
*
|
|
1200
|
+
* keys, plus `extraData`, plus `formId`, plus `adReferral` when this site
|
|
1201
|
+
* mounts an `AdReferralTracker` and the visitor arrived on a tagged ad
|
|
1202
|
+
* click. There is no `data`/`values` wrapper. The honeypot, fields hidden
|
|
1203
|
+
* by an unmet `showWhen`, and the synthetic `_sameAs_*` toggles are
|
|
1204
|
+
* stripped before sending. The renderer never sends
|
|
1205
|
+
* `projectId` / `apiKey` / `url` — the proxy must add those,
|
|
798
1206
|
* and must forward the browser's body WHOLE (hand-picking fields into a
|
|
799
1207
|
* new object drops values the CMS then rejects as required).
|
|
800
1208
|
*
|
|
@@ -803,6 +1211,31 @@ interface DynamicFormProps {
|
|
|
803
1211
|
* a top-level `email` key is required on every submission type.
|
|
804
1212
|
*/
|
|
805
1213
|
apiRoute: string;
|
|
1214
|
+
/**
|
|
1215
|
+
* Bring-your-own transport. When set, the form hands the finished payload
|
|
1216
|
+
* (the same flat object it would have POSTed to {@link DynamicFormProps.apiRoute})
|
|
1217
|
+
* to this function instead of calling `fetch` itself, and treats whatever it
|
|
1218
|
+
* resolves with as the server response. Reject (throw) to land on the error
|
|
1219
|
+
* path with the thrown message.
|
|
1220
|
+
*
|
|
1221
|
+
* Exists for surfaces where a plain POST cannot work — dashboard pages whose
|
|
1222
|
+
* API needs a Bearer token the renderer never holds, or a preview that wants
|
|
1223
|
+
* the values without a network round-trip. `apiRoute` is ignored while this
|
|
1224
|
+
* is set.
|
|
1225
|
+
*/
|
|
1226
|
+
submit?: (payload: Record<string, unknown>) => Promise<unknown>;
|
|
1227
|
+
/**
|
|
1228
|
+
* Values to start from, merged over the definition's own defaults — the
|
|
1229
|
+
* way a saved draft is resumed. Keys that are not fields of the definition
|
|
1230
|
+
* are ignored. Read once, on mount: changing it later does not reset the
|
|
1231
|
+
* form (remount with a `key` for that).
|
|
1232
|
+
*/
|
|
1233
|
+
initialValues?: Partial<FormValues>;
|
|
1234
|
+
/**
|
|
1235
|
+
* Fired with the full value set after every edit (not on mount). The hook
|
|
1236
|
+
* for autosaving a long form; debounce on the consuming side.
|
|
1237
|
+
*/
|
|
1238
|
+
onValuesChange?: (values: FormValues) => void;
|
|
806
1239
|
/**
|
|
807
1240
|
* Called after a successful submission. The argument is the parsed JSON
|
|
808
1241
|
* response body, when one was returned — application submissions echo
|
|
@@ -824,6 +1257,35 @@ interface DynamicFormProps {
|
|
|
824
1257
|
onError?: (error: Error) => void;
|
|
825
1258
|
/** Extra top-level keys merged into the payload alongside the field values. */
|
|
826
1259
|
extraData?: Record<string, unknown>;
|
|
1260
|
+
/**
|
|
1261
|
+
* Upload path for `file` fields. Called once per picked file; resolve with
|
|
1262
|
+
* the stored URL, which becomes the field's submitted value.
|
|
1263
|
+
*
|
|
1264
|
+
* There is no default — a public form submitter holds no CMS credentials,
|
|
1265
|
+
* so the upload has to go through a route in the consuming app, exactly
|
|
1266
|
+
* like {@link DynamicFormProps.apiRoute}. Use {@link DynamicFormProps.fileUploadRoute}
|
|
1267
|
+
* for the standard multipart wiring, or this prop for full control.
|
|
1268
|
+
*
|
|
1269
|
+
* A definition containing a `file` field with neither prop set renders the
|
|
1270
|
+
* picker disabled with an explanatory message — it will NOT fall back to a
|
|
1271
|
+
* throwaway `blob:` URL, which used to look like a successful upload and
|
|
1272
|
+
* arrive as an unopenable attachment on the lead.
|
|
1273
|
+
*/
|
|
1274
|
+
onFileUpload?: FormFileUploadHandler;
|
|
1275
|
+
/**
|
|
1276
|
+
* Convenience alternative to {@link DynamicFormProps.onFileUpload}: an
|
|
1277
|
+
* endpoint in the consuming app that accepts one file and returns its
|
|
1278
|
+
* stored location.
|
|
1279
|
+
*
|
|
1280
|
+
* Request: `POST <fileUploadRoute>` with `multipart/form-data` carrying
|
|
1281
|
+
* `file` (the File) and `formId` (the definition id).
|
|
1282
|
+
* Response: `200` with JSON `{ url: string, name?: string, size?: number }`.
|
|
1283
|
+
* `url` must be durable — a `blob:`/`data:` URL is rejected. On failure,
|
|
1284
|
+
* answer non-2xx with `{ error }` and the message is shown under the field.
|
|
1285
|
+
*
|
|
1286
|
+
* Ignored when `onFileUpload` is set.
|
|
1287
|
+
*/
|
|
1288
|
+
fileUploadRoute?: string;
|
|
827
1289
|
className?: string;
|
|
828
1290
|
/**
|
|
829
1291
|
* Endpoint that returns the RSA-OAEP transport public key used to wrap the
|
|
@@ -861,18 +1323,40 @@ interface DynamicFormProps {
|
|
|
861
1323
|
*/
|
|
862
1324
|
previewUntouchAllSignal?: number;
|
|
863
1325
|
/**
|
|
864
|
-
* Editor-only
|
|
865
|
-
*
|
|
866
|
-
* preview. Never persisted.
|
|
1326
|
+
* Editor-only: the canvas color the builder shows the form on. Fills the
|
|
1327
|
+
* form background only when the record sets none of its own, so the
|
|
1328
|
+
* preview shows what the record will render. Never persisted.
|
|
867
1329
|
*/
|
|
868
1330
|
previewBg?: string;
|
|
869
1331
|
/**
|
|
870
|
-
* Editor-only
|
|
871
|
-
*
|
|
872
|
-
* persisted.
|
|
1332
|
+
* Editor-only: the canvas text color, set on the form root so headers
|
|
1333
|
+
* with no record color inherit something readable against `previewBg`.
|
|
1334
|
+
* A record color always wins over it. Never persisted.
|
|
873
1335
|
*/
|
|
874
1336
|
previewTextColor?: string;
|
|
1337
|
+
/**
|
|
1338
|
+
* Editor-only: render the record's colors for one scheme regardless of
|
|
1339
|
+
* the host page. The builder passes the scheme its Light/Dark toggle is
|
|
1340
|
+
* on; the renderer then emits that palette inline and none of the
|
|
1341
|
+
* dark-mode hooks, so the preview never depends on the CMS's own theme.
|
|
1342
|
+
* Consumer sites leave this unset and get the automatic behaviour.
|
|
1343
|
+
*/
|
|
1344
|
+
previewColorScheme?: FormColorScheme;
|
|
1345
|
+
/**
|
|
1346
|
+
* Ancestor selector under which the record's dark palette (`style.dark`,
|
|
1347
|
+
* `defaultTextColorDark`, section `textColorDark`) applies. Defaults to
|
|
1348
|
+
* `.dark`, the class next-themes puts on `<html>` in every VulcanTech
|
|
1349
|
+
* site with a theme toggle. Only read when the definition carries dark
|
|
1350
|
+
* colors; a record without them emits nothing dark-related at all.
|
|
1351
|
+
*
|
|
1352
|
+
* Must match an ancestor of `<body>`'s children — `<html>` or `<body>`
|
|
1353
|
+
* itself — because the select popover is portaled to `<body>` and has to
|
|
1354
|
+
* fall under the same selector as the form root.
|
|
1355
|
+
*/
|
|
1356
|
+
darkModeSelector?: string;
|
|
875
1357
|
}
|
|
1358
|
+
/** The value set Formik holds for a rendered definition. */
|
|
1359
|
+
type FormValues = Record<string, string | boolean | string[]>;
|
|
876
1360
|
/**
|
|
877
1361
|
* Render a CMS-authored {@link FormDefinition} as a working form.
|
|
878
1362
|
*
|
|
@@ -887,7 +1371,187 @@ interface DynamicFormProps {
|
|
|
887
1371
|
* and a server-side spam catch both answer `200` and are indistinguishable
|
|
888
1372
|
* from a stored lead by design.
|
|
889
1373
|
*/
|
|
890
|
-
declare const DynamicForm: ({ definition, apiRoute, onSuccess, onError, extraData, className, onFormView, onFormSubmit: onFormSubmitCallback, transportKeyEndpoint, previewState, previewTouchAllSignal, previewUntouchAllSignal, previewBg, previewTextColor, }: DynamicFormProps) => react.JSX.Element;
|
|
1374
|
+
declare const DynamicForm: ({ definition, apiRoute, submit, initialValues: initialValueOverrides, onValuesChange, onSuccess, onError, extraData, onFileUpload, fileUploadRoute, className, onFormView, onFormSubmit: onFormSubmitCallback, transportKeyEndpoint, previewState, previewTouchAllSignal, previewUntouchAllSignal, previewBg, previewTextColor, previewColorScheme, darkModeSelector, }: DynamicFormProps) => react.JSX.Element;
|
|
1375
|
+
|
|
1376
|
+
/**
|
|
1377
|
+
* Ad-referral attribution — capture the campaign that brought a visitor to
|
|
1378
|
+
* the site, so a lead they submit later can be traced back to it.
|
|
1379
|
+
*
|
|
1380
|
+
* The flow has two halves that are deliberately separable:
|
|
1381
|
+
*
|
|
1382
|
+
* 1. {@link AdReferralTracker} (mounted once, in a site's root layout)
|
|
1383
|
+
* writes a 30-day cookie when the entry URL carries ad signal.
|
|
1384
|
+
* 2. `DynamicForm` reads that cookie at submit time and attaches it to the
|
|
1385
|
+
* payload as `adReferral`.
|
|
1386
|
+
*
|
|
1387
|
+
* Half 2 is inert without half 1: a site that never mounts the tracker has
|
|
1388
|
+
* no cookie, so its submissions are byte-identical to what they were before.
|
|
1389
|
+
* That is what makes the renderer-side read safe to ship to every consumer
|
|
1390
|
+
* at once — attribution turns on per site, by adding the tracker, not by
|
|
1391
|
+
* redeploying.
|
|
1392
|
+
*
|
|
1393
|
+
* The CMS normalizes the `adReferral` blob into a single groupable
|
|
1394
|
+
* `leadSource` bucket at ingestion (`lib/contacts/leadSource.ts`), which is
|
|
1395
|
+
* what the Contacts table and the lead-source breakdown chart read.
|
|
1396
|
+
*
|
|
1397
|
+
* Pure module — no React, no imports. Every function is a no-op on the
|
|
1398
|
+
* server, so it can be called from anywhere without a `typeof window` guard
|
|
1399
|
+
* at the call site.
|
|
1400
|
+
*/
|
|
1401
|
+
/** Cookie the tracker writes and the renderer reads. */
|
|
1402
|
+
declare const AD_REFERRAL_COOKIE = "vt_ad_ref";
|
|
1403
|
+
/** How long an ad click stays credited for a later conversion. */
|
|
1404
|
+
declare const AD_REFERRAL_TTL_DAYS = 30;
|
|
1405
|
+
/**
|
|
1406
|
+
* Campaign context for a visit, as stored in the cookie and sent with a
|
|
1407
|
+
* submission.
|
|
1408
|
+
*
|
|
1409
|
+
* `source` / `medium` are the two the CMS actually classifies on; everything
|
|
1410
|
+
* else rides along for reporting.
|
|
1411
|
+
*/
|
|
1412
|
+
interface AdReferral {
|
|
1413
|
+
/** `utm_source`, or "google" when inferred from a Google click id. */
|
|
1414
|
+
source: string;
|
|
1415
|
+
/** `utm_medium`, or "cpc" when inferred from a Google click id. */
|
|
1416
|
+
medium: string;
|
|
1417
|
+
/** `utm_campaign`, or "(not set)" when auto-tagging supplied no campaign. */
|
|
1418
|
+
campaign: string;
|
|
1419
|
+
/** `utm_term` — the keyword, when the campaign tags one. */
|
|
1420
|
+
term?: string;
|
|
1421
|
+
/** `utm_content` — the ad variant, when the campaign tags one. */
|
|
1422
|
+
content?: string;
|
|
1423
|
+
/**
|
|
1424
|
+
* The raw Google click id (`gclid`, `gbraid` or `wbraid`) when the visit
|
|
1425
|
+
* was auto-tagged. Kept so a lead can be reconciled against Google Ads
|
|
1426
|
+
* reporting, which joins on this and not on UTMs.
|
|
1427
|
+
*/
|
|
1428
|
+
clickId?: string;
|
|
1429
|
+
/**
|
|
1430
|
+
* Which param {@link AdReferral.clickId} came from. Google's offline
|
|
1431
|
+
* conversion upload takes `gclid`, `gbraid` and `wbraid` in separate
|
|
1432
|
+
* columns, and the value alone can't reliably tell them apart, so a lead
|
|
1433
|
+
* without this can't be uploaded back to Google Ads. Absent on cookies
|
|
1434
|
+
* written before it existed.
|
|
1435
|
+
*/
|
|
1436
|
+
clickIdType?: ClickIdType;
|
|
1437
|
+
/**
|
|
1438
|
+
* Path the visitor landed on (pathname only — the query string is already
|
|
1439
|
+
* captured as UTMs/click id, and dropping it keeps anything else a URL
|
|
1440
|
+
* might carry off the lead). Absent on cookies written before it existed.
|
|
1441
|
+
*/
|
|
1442
|
+
landingPage?: string;
|
|
1443
|
+
/** When the visitor arrived, ISO 8601. */
|
|
1444
|
+
landedAt: string;
|
|
1445
|
+
}
|
|
1446
|
+
/**
|
|
1447
|
+
* Click-id params Google Ads auto-tagging appends.
|
|
1448
|
+
*
|
|
1449
|
+
* Auto-tagging is ON by default in Google Ads and does NOT add UTMs, so a
|
|
1450
|
+
* great many real ad clicks arrive carrying nothing but one of these. Reading
|
|
1451
|
+
* them is the difference between attributing most paid traffic and
|
|
1452
|
+
* attributing only the campaigns someone remembered to hand-tag.
|
|
1453
|
+
*
|
|
1454
|
+
* `gbraid` / `wbraid` are the iOS privacy-preserving variants of `gclid`.
|
|
1455
|
+
*/
|
|
1456
|
+
declare const CLICK_ID_PARAMS: readonly ["gclid", "gbraid", "wbraid"];
|
|
1457
|
+
/** One of the Google click-id params, as recorded in `clickIdType`. */
|
|
1458
|
+
type ClickIdType = (typeof CLICK_ID_PARAMS)[number];
|
|
1459
|
+
/**
|
|
1460
|
+
* Defaults applied on a page that only ever receives ad traffic.
|
|
1461
|
+
*
|
|
1462
|
+
* Used for a dedicated paid-search landing page that is `noindex` and
|
|
1463
|
+
* unlinked from the rest of the site: everyone there came from an ad, so a
|
|
1464
|
+
* visit with no tagging at all is still an ad visit. Supplying this on a
|
|
1465
|
+
* normal page would label organic visitors as paid, which is why it is
|
|
1466
|
+
* opt-in per page rather than a built-in default.
|
|
1467
|
+
*/
|
|
1468
|
+
interface AdReferralFallback {
|
|
1469
|
+
source: string;
|
|
1470
|
+
medium: string;
|
|
1471
|
+
campaign: string;
|
|
1472
|
+
}
|
|
1473
|
+
/**
|
|
1474
|
+
* Build an {@link AdReferral} from a URL's query string.
|
|
1475
|
+
*
|
|
1476
|
+
* Returns `null` when the URL carries no ad signal and no `fallback` is
|
|
1477
|
+
* given — the gate that keeps organic, direct and internal traffic out of
|
|
1478
|
+
* the paid bucket. "Ad signal" means any `utm_*` param or any Google click
|
|
1479
|
+
* id; a click id alone is read as `google` / `cpc`, matching how the CMS's
|
|
1480
|
+
* own realtime analytics classifies `gclid`.
|
|
1481
|
+
*
|
|
1482
|
+
* @param search The URL query string (`window.location.search`).
|
|
1483
|
+
* @param fallback Applied only when the URL carries no signal at all.
|
|
1484
|
+
* @param now Injectable clock, for tests.
|
|
1485
|
+
* @param pathname The landing path (`window.location.pathname`), stored as
|
|
1486
|
+
* `landingPage`. Optional so older callers keep working.
|
|
1487
|
+
* @returns The referral to store, or `null` to leave any existing cookie alone.
|
|
1488
|
+
*/
|
|
1489
|
+
declare function captureAdReferral(search: string, fallback?: AdReferralFallback, now?: Date, pathname?: string): AdReferral | null;
|
|
1490
|
+
/**
|
|
1491
|
+
* Read the stored referral for this browser.
|
|
1492
|
+
*
|
|
1493
|
+
* @param cookieName Override for a site still on a legacy cookie name.
|
|
1494
|
+
* @returns The stored referral, or `null` when absent, unreadable or malformed.
|
|
1495
|
+
*/
|
|
1496
|
+
declare function readAdReferral(cookieName?: string): AdReferral | null;
|
|
1497
|
+
/**
|
|
1498
|
+
* Whether two referrals record the same touch: every field equal except
|
|
1499
|
+
* `landedAt`, which is just when it was stamped.
|
|
1500
|
+
*
|
|
1501
|
+
* The client tracker uses this to leave alone a cookie the server already
|
|
1502
|
+
* wrote for this landing (`adReferralServer.ts`). Rewriting identical content
|
|
1503
|
+
* from JavaScript would turn an uncapped HTTP cookie into a script-written one,
|
|
1504
|
+
* and Safari caps those to 7 days, or 24 hours after a gclid landing.
|
|
1505
|
+
*
|
|
1506
|
+
* @returns `true` when the two differ in nothing but `landedAt`.
|
|
1507
|
+
*/
|
|
1508
|
+
declare function isSameAdReferralTouch(a: AdReferral, b: AdReferral): boolean;
|
|
1509
|
+
/**
|
|
1510
|
+
* Store a referral, replacing any previous one.
|
|
1511
|
+
*
|
|
1512
|
+
* Overwriting is last-touch attribution on purpose: when a visitor arrives
|
|
1513
|
+
* on a fresh ad click, that click is what earned the conversion, not one
|
|
1514
|
+
* from three weeks ago. Visits with no ad signal never reach here (see
|
|
1515
|
+
* {@link captureAdReferral}), so ordinary browsing can't erase a credit.
|
|
1516
|
+
*
|
|
1517
|
+
* @param referral What to store.
|
|
1518
|
+
* @param cookieName Override for a site still on a legacy cookie name.
|
|
1519
|
+
* @param ttlDays How long the credit survives.
|
|
1520
|
+
*/
|
|
1521
|
+
declare function writeAdReferral(referral: AdReferral, cookieName?: string, ttlDays?: number): void;
|
|
1522
|
+
|
|
1523
|
+
interface AdReferralTrackerProps {
|
|
1524
|
+
/**
|
|
1525
|
+
* Applied only on a page that receives nothing but ad traffic — a
|
|
1526
|
+
* `noindex`, unlinked paid-search landing page — so an untagged ad click
|
|
1527
|
+
* there is still credited. Omit it everywhere else: on a normal page it
|
|
1528
|
+
* would label every organic visitor as paid.
|
|
1529
|
+
*/
|
|
1530
|
+
fallback?: AdReferralFallback;
|
|
1531
|
+
/** Override for a site still on a legacy cookie name. */
|
|
1532
|
+
cookieName?: string;
|
|
1533
|
+
/** How long an ad click stays credited for a later conversion. */
|
|
1534
|
+
ttlDays?: number;
|
|
1535
|
+
}
|
|
1536
|
+
/**
|
|
1537
|
+
* Records the campaign that brought this visitor to the site, in a cookie
|
|
1538
|
+
* `DynamicForm` attaches to any form they later submit.
|
|
1539
|
+
*
|
|
1540
|
+
* Mount once, in the root layout, so a click is captured wherever it lands —
|
|
1541
|
+
* ads point at homepages, service pages and city pages, not only at
|
|
1542
|
+
* purpose-built landing pages, and a form on any of them can be the
|
|
1543
|
+
* conversion.
|
|
1544
|
+
*
|
|
1545
|
+
* Writing is gated on the entry URL actually carrying ad signal (`utm_*` or
|
|
1546
|
+
* a Google click id), so mounting it site-wide does not make every visitor
|
|
1547
|
+
* look like paid traffic. A visit with no signal leaves any existing cookie
|
|
1548
|
+
* untouched.
|
|
1549
|
+
*
|
|
1550
|
+
* Renders nothing — it exists purely to keep the `window`-dependent effect
|
|
1551
|
+
* in a leaf client component, so the layout around it can stay a server
|
|
1552
|
+
* component.
|
|
1553
|
+
*/
|
|
1554
|
+
declare function AdReferralTracker({ fallback, cookieName, ttlDays, }?: AdReferralTrackerProps): null;
|
|
891
1555
|
|
|
892
1556
|
/**
|
|
893
1557
|
* Single source of truth for the CSS custom properties the renderer publishes
|
|
@@ -915,6 +1579,38 @@ declare const FORM_CSS_VAR: {
|
|
|
915
1579
|
readonly buttonBg: "--form-button-bg";
|
|
916
1580
|
readonly buttonText: "--form-button-text";
|
|
917
1581
|
};
|
|
1582
|
+
/**
|
|
1583
|
+
* Structural custom properties. Unlike the colors these are NOT always
|
|
1584
|
+
* available: `--form-radius` is published only when the form opts into a
|
|
1585
|
+
* custom corner via `FormStyle.borderRadiusValue`, because the default path
|
|
1586
|
+
* still uses Tailwind `rounded-*` classes and must keep emitting byte-identical
|
|
1587
|
+
* markup for every form authored before this existed.
|
|
1588
|
+
*/
|
|
1589
|
+
declare const FORM_STRUCT_VAR: {
|
|
1590
|
+
readonly radius: "--form-radius";
|
|
1591
|
+
readonly gap: "--form-gap";
|
|
1592
|
+
readonly focusBorderWidth: "--form-focus-border-width";
|
|
1593
|
+
};
|
|
1594
|
+
/** Fallback used inside `var(--form-radius, ...)` if the var goes missing. */
|
|
1595
|
+
declare const FORM_DEFAULT_RADIUS = "0.375rem";
|
|
1596
|
+
/**
|
|
1597
|
+
* `var(--form-radius, 0.375rem)` — the reference the form root, inputs and
|
|
1598
|
+
* submit button all share, so one control moves every corner at once.
|
|
1599
|
+
*/
|
|
1600
|
+
declare const FORM_RADIUS_VAR: string;
|
|
1601
|
+
/** `var(--form-gap, 1rem)` — the gap between fields when overridden. */
|
|
1602
|
+
declare const FORM_GAP_VAR: string;
|
|
1603
|
+
/**
|
|
1604
|
+
* The custom field gap a form has opted into, or `null` when the gap should
|
|
1605
|
+
* keep following `style.spacing`.
|
|
1606
|
+
*/
|
|
1607
|
+
declare function resolveCustomGap(style: FormStyle): string | null;
|
|
1608
|
+
/**
|
|
1609
|
+
* The custom corner length a form has opted into, or `null` when it is still
|
|
1610
|
+
* on the named `borderRadius` steps. Every radius decision in the renderer
|
|
1611
|
+
* branches on this one helper so the opt-in stays in a single place.
|
|
1612
|
+
*/
|
|
1613
|
+
declare function resolveCustomRadius(style: FormStyle): string | null;
|
|
918
1614
|
/**
|
|
919
1615
|
* Baked-in defaults used when the FormStyle doesn't override a color. These
|
|
920
1616
|
* are the fallbacks inside the `var(--name, fallback)` references that the
|
|
@@ -951,23 +1647,162 @@ declare const FORM_VAR: {
|
|
|
951
1647
|
readonly buttonText: string;
|
|
952
1648
|
};
|
|
953
1649
|
/**
|
|
954
|
-
*
|
|
955
|
-
*
|
|
956
|
-
*
|
|
957
|
-
*
|
|
958
|
-
|
|
1650
|
+
* Attribute the renderer puts on a form root that carries a dark palette —
|
|
1651
|
+
* and on the select popover, which is portaled out of the root's subtree.
|
|
1652
|
+
* The dark-mode stylesheet keys off it, so a form without dark colors is
|
|
1653
|
+
* never touched by that stylesheet, even on a page that has the class.
|
|
1654
|
+
*/
|
|
1655
|
+
declare const FORM_DARK_SCOPE_ATTR = "data-vt-form-dark";
|
|
1656
|
+
/** Attribute on a section title/description that publishes `--form-text-dark`. */
|
|
1657
|
+
declare const FORM_DARK_TEXT_ATTR = "data-vt-text-dark";
|
|
1658
|
+
/** Dark-mode header text color, published on the header element itself. */
|
|
1659
|
+
declare const FORM_DARK_TEXT_VAR = "--form-text-dark";
|
|
1660
|
+
/**
|
|
1661
|
+
* Ancestor selector under which a form's dark palette applies. `.dark` is
|
|
1662
|
+
* the class next-themes puts on `<html>` in every VulcanTech site with a
|
|
1663
|
+
* theme toggle. It is deliberately NOT `prefers-color-scheme`, which would
|
|
1664
|
+
* flip a form on a light-only site whenever the visitor's OS is dark — the
|
|
1665
|
+
* exact bug BL-553 removed from this package.
|
|
1666
|
+
*/
|
|
1667
|
+
declare const FORM_DEFAULT_DARK_SELECTOR = ".dark";
|
|
1668
|
+
/**
|
|
1669
|
+
* `var(--form-bg, inherit)` — what the root's own `background-color` reads
|
|
1670
|
+
* once a form carries a dark palette. The `inherit` fallback matches the
|
|
1671
|
+
* `bg-inherit` class the root always has, so a form with no background in
|
|
1672
|
+
* either scheme keeps flowing the consumer's container color down to the
|
|
1673
|
+
* inputs and floating labels.
|
|
1674
|
+
*/
|
|
1675
|
+
declare const FORM_ROOT_BG_VAR: string;
|
|
1676
|
+
/** The dark-mode counterpart of a color custom property: `--form-bg` → `--form-bg-dark`. */
|
|
1677
|
+
declare function darkVarName(name: string): string;
|
|
1678
|
+
/**
|
|
1679
|
+
* Inline custom properties for the given color slots: light values under
|
|
1680
|
+
* their usual names, or the resolved dark values under the `-dark` names.
|
|
1681
|
+
* Unset slots are omitted so the renderer's `var()` fallbacks still apply.
|
|
1682
|
+
*/
|
|
1683
|
+
declare function buildColorVars(style: FormStyle, scheme: FormColorScheme, keys?: readonly FormStyleColorKey[]): Record<string, string>;
|
|
1684
|
+
/**
|
|
1685
|
+
* Build the inline `style` object the form root should receive: a CSS
|
|
1686
|
+
* variable for each color the FormStyle overrides, leaving the rest to fall
|
|
1687
|
+
* back via `FORM_VAR.*`, plus the structural custom properties the form has
|
|
1688
|
+
* opted into. `previewBg` (editor-only) is the canvas the builder shows the
|
|
1689
|
+
* form on; it fills `--form-bg` only when the record sets no background of
|
|
1690
|
+
* its own, so what the builder shows is what the record will render.
|
|
959
1691
|
*/
|
|
960
1692
|
declare function buildFormCssVars(style: FormStyle, previewBg?: string): CSSProperties;
|
|
1693
|
+
/**
|
|
1694
|
+
* The `-dark` custom properties a form root (or the select popover)
|
|
1695
|
+
* publishes when the record carries a dark palette. Every slot with a value
|
|
1696
|
+
* in EITHER scheme gets one — the light value stands in where no dark value
|
|
1697
|
+
* is set — so the dark stylesheet's `var(--x-dark)` swap never drops a color
|
|
1698
|
+
* the light palette had.
|
|
1699
|
+
*/
|
|
1700
|
+
declare function buildFormDarkCssVars(style: FormStyle, keys?: readonly FormStyleColorKey[]): CSSProperties;
|
|
1701
|
+
/**
|
|
1702
|
+
* The stylesheet that turns a dark palette on. It is one constant rule set,
|
|
1703
|
+
* independent of any record: under `darkSelector`, every color custom
|
|
1704
|
+
* property on a scoped element is replaced by its `-dark` counterpart, and a
|
|
1705
|
+
* scoped header takes `--form-text-dark`.
|
|
1706
|
+
*
|
|
1707
|
+
* `!important` is the point, not a shortcut. The light palette is inline on
|
|
1708
|
+
* the form root — that is what lets a record's colors beat any consumer
|
|
1709
|
+
* stylesheet — and an important author declaration is the one cascade level
|
|
1710
|
+
* that outranks an inline style without touching the markup light mode
|
|
1711
|
+
* renders. A slot with no `-dark` value computes to invalid and falls to the
|
|
1712
|
+
* same `var()` fallback light mode uses.
|
|
1713
|
+
*/
|
|
1714
|
+
declare function buildDarkSchemeCss(darkSelector?: string): string;
|
|
1715
|
+
|
|
1716
|
+
/** True when at least one dark color slot is set on the style. */
|
|
1717
|
+
declare function hasDarkColors(style: FormStyle | undefined): boolean;
|
|
1718
|
+
/**
|
|
1719
|
+
* True when the definition carries any dark-mode color at all — a style
|
|
1720
|
+
* slot, the form-level header text, or one section's header text. This is
|
|
1721
|
+
* what decides whether the renderer emits its dark-mode hooks; a record
|
|
1722
|
+
* with none renders byte-identical markup to one authored before dark mode
|
|
1723
|
+
* existed.
|
|
1724
|
+
*/
|
|
1725
|
+
declare function definitionHasDarkColors(definition: Pick<FormDefinition, "style" | "defaultTextColorDark" | "sections">): boolean;
|
|
1726
|
+
/**
|
|
1727
|
+
* The color slots a form shows in `scheme`. For "dark", each slot takes its
|
|
1728
|
+
* dark value when set and its light value otherwise — an unset dark slot
|
|
1729
|
+
* means "same as light", never "package default". Slots unset in both
|
|
1730
|
+
* schemes are omitted so the renderer's `var()` fallbacks still apply.
|
|
1731
|
+
*/
|
|
1732
|
+
declare function resolveSchemeColors(style: FormStyle, scheme: FormColorScheme): FormStyleColors;
|
|
1733
|
+
/**
|
|
1734
|
+
* A `FormStyle` whose color slots are already resolved for `scheme`, with
|
|
1735
|
+
* no `dark` key left on it. This is what the builder preview renders when
|
|
1736
|
+
* it is pinned to one scheme.
|
|
1737
|
+
*/
|
|
1738
|
+
declare function resolveSchemeStyle(style: FormStyle, scheme: FormColorScheme): FormStyle;
|
|
1739
|
+
/**
|
|
1740
|
+
* Section header text color for `scheme`. Dark mode consults the dark chain
|
|
1741
|
+
* first (the section, then the form default) and only then the light chain,
|
|
1742
|
+
* so a single form-level dark color re-themes every header — including
|
|
1743
|
+
* sections that pinned a light `textColor` before dark mode existed. Light
|
|
1744
|
+
* mode is the chain it always was: the section, then the form default.
|
|
1745
|
+
*/
|
|
1746
|
+
declare function resolveSectionTextColor(section: Pick<FormSection, "textColor" | "textColorDark">, formDefaults: {
|
|
1747
|
+
light?: string;
|
|
1748
|
+
dark?: string;
|
|
1749
|
+
}, scheme: FormColorScheme): string | undefined;
|
|
1750
|
+
|
|
1751
|
+
/**
|
|
1752
|
+
* The upload path `DynamicForm` publishes to the `file` fields beneath it.
|
|
1753
|
+
*
|
|
1754
|
+
* Threaded by context rather than by prop because `FileField` sits two
|
|
1755
|
+
* levels down (section → field) and no intermediate component has any other
|
|
1756
|
+
* reason to know about uploads.
|
|
1757
|
+
*/
|
|
1758
|
+
interface FormFileUploadContextValue {
|
|
1759
|
+
/**
|
|
1760
|
+
* Uploads a picked file and returns its stored URL. Undefined means the
|
|
1761
|
+
* consuming app wired no upload path — file fields then render disabled
|
|
1762
|
+
* instead of submitting an unusable value.
|
|
1763
|
+
*/
|
|
1764
|
+
upload?: FormFileUploadHandler;
|
|
1765
|
+
/**
|
|
1766
|
+
* Builder-preview escape hatch: allows `FileField` to stand in a local
|
|
1767
|
+
* `URL.createObjectURL` value when no `upload` is set. Only ever true in
|
|
1768
|
+
* the CMS form builder, where submissions are short-circuited and the
|
|
1769
|
+
* throwaway URL can't reach a lead.
|
|
1770
|
+
*/
|
|
1771
|
+
allowObjectUrlFallback?: boolean;
|
|
1772
|
+
}
|
|
1773
|
+
declare const useFormFileUpload: () => FormFileUploadContextValue;
|
|
1774
|
+
declare const FormFileUploadProvider: react.Provider<FormFileUploadContextValue>;
|
|
1775
|
+
|
|
1776
|
+
interface Props$2 {
|
|
1777
|
+
field: FormFieldDefinition;
|
|
1778
|
+
/** Project ID for storage path. Passed from the form renderer. */
|
|
1779
|
+
projectId?: string;
|
|
1780
|
+
/**
|
|
1781
|
+
* Upload handler. Normally supplied through `DynamicForm`'s
|
|
1782
|
+
* `onFileUpload` / `fileUploadRoute` prop (delivered by context); pass it
|
|
1783
|
+
* here when rendering `FileField` outside a `DynamicForm`. This prop wins
|
|
1784
|
+
* over the context value.
|
|
1785
|
+
*/
|
|
1786
|
+
onUpload?: FormFileUploadHandler;
|
|
1787
|
+
/** When true (mirrored/locked), the picker is read-only. */
|
|
1788
|
+
disabled?: boolean;
|
|
1789
|
+
}
|
|
1790
|
+
declare const FileField: ({ field: fieldDef, onUpload, disabled }: Props$2) => react.JSX.Element;
|
|
961
1791
|
|
|
962
1792
|
interface Props$1 {
|
|
963
1793
|
section: FormSection;
|
|
964
1794
|
isLast?: boolean;
|
|
965
1795
|
/**
|
|
966
1796
|
* Form-level default header text color from `FormDefinition.defaultTextColor`.
|
|
967
|
-
* Per-section `textColor` overrides this
|
|
968
|
-
* (when set) overrides both.
|
|
1797
|
+
* Per-section `textColor` overrides this.
|
|
969
1798
|
*/
|
|
970
1799
|
formDefaultTextColor?: string;
|
|
1800
|
+
/**
|
|
1801
|
+
* Dark-mode counterpart from `FormDefinition.defaultTextColorDark`.
|
|
1802
|
+
* Per-section `textColorDark` overrides this; see `resolveSectionTextColor`
|
|
1803
|
+
* for how the two chains combine.
|
|
1804
|
+
*/
|
|
1805
|
+
formDefaultTextColorDark?: string;
|
|
971
1806
|
/**
|
|
972
1807
|
* Submit button rendered beside this section's fields grid (inline
|
|
973
1808
|
* `buttonPlacement`). The section title/description stay full-width above
|
|
@@ -975,7 +1810,7 @@ interface Props$1 {
|
|
|
975
1810
|
*/
|
|
976
1811
|
inlineSubmit?: React.ReactNode;
|
|
977
1812
|
}
|
|
978
|
-
declare const DynamicFormSection: ({ section, isLast, formDefaultTextColor, inlineSubmit, }: Props$1) => react.JSX.Element;
|
|
1813
|
+
declare const DynamicFormSection: ({ section, isLast, formDefaultTextColor, formDefaultTextColorDark, inlineSubmit, }: Props$1) => react.JSX.Element;
|
|
979
1814
|
|
|
980
1815
|
interface Props {
|
|
981
1816
|
field: FormFieldDefinition;
|
|
@@ -1107,4 +1942,4 @@ interface UseDragReorderResult extends DragReorderState {
|
|
|
1107
1942
|
*/
|
|
1108
1943
|
declare function useDragReorder<T>({ items, getId, onReorder, dragType, }: UseDragReorderOptions<T>): UseDragReorderResult;
|
|
1109
1944
|
|
|
1110
|
-
export { APPLICATION_STATUS_KEYS, type ApplicationStatusEmailTemplates, type ApplicationStatusKey, CORE_EMAIL_TEMPLATE_VARIABLES, DEFAULT_APPLICATION_STATUS_EMAIL_TEMPLATES, DEFAULT_FILE_FIELD_CONFIG, DEFAULT_FORM_STYLE, DEFAULT_NOTIFICATION_EMAIL_HTML, DEFAULT_NOTIFICATION_EMAIL_SUBJECT, DEFAULT_NOTIFICATION_EMAIL_TEMPLATE, DEFAULT_SENSITIVE_FIELD_CONFIG, DEFAULT_SPAM_PROTECTION, type DatetimeConfig, type DragReorderItemHandlers, type DragReorderState, type DropPosition, DynamicForm, DynamicFormField, DynamicFormSection, type EmailTemplateVariableDescriptor, type EmailTemplateVariables, type EncryptedSensitiveValue, FORM_CSS_VAR, FORM_DEFAULT_COLOR, FORM_VAR, type FieldOption, type FieldTransform, type FieldType, type FieldVisibilityCondition, type FieldWidth, type FileFieldConfig, type FormBookingConfig, type FormDefinition, type FormDefinitionJSON, type FormFieldDefinition, type FormFieldDefinitionJSON, type FormIdentifier, type FormIntegrationConfig, type FormIntegrationConfigJSON, type FormIntegrations, type FormIntegrationsJSON, type FormSection, type FormSectionJSON, type FormSpamProtectionConfig, type FormStatus, type FormStyle, type FormStyleJSON, type FormStylePreset, type FormSubmissionType, type FormSubmitConfig, type FormSubmitConfigJSON, type FormSuccessBehavior, HONEYPOT_FIELD_NAME, type InputVariant, type IntegrationFieldMappingEntry, type IntegrationFieldMappingEntryJSON, NEWSLETTER_ALLOWED_FIELD_TYPES, type NotificationEmailTemplate, SAME_AS_TOGGLE_PREFIX, SAMPLE_EMAIL_TEMPLATE_VARIABLES, type SectionSameAsConfig, type SensitiveFieldConfig, type SensitiveFieldConfigJSON, type SetStateUpdater, type TextTransform, type TransportPublicKey, type UseDragReorderOptions, type UseDragReorderResult, type UseFormDefinitionOptions, type UseUndoRedoControls, type UseUndoRedoOptions, type UseUndoRedoReturn, type ValidationRule, type ValidationRuleJSON, type VisibilityOperator, applyTextTransform, applyTransform, base64ToBuffer, bufferToBase64, buildEmailTemplateVariables, buildFormCssVars, buildInitialValues, buildYupSchema, deriveLast4, encryptSensitiveValue, formatSsn, formatUsPhone, getFormDefinition, getSafeRedirectUrl, isVisibilityConditionMet, parseFormDefinition, renderEmailTemplate, renderNotificationEmail, sameAsToggleKey, useDragReorder, useFormDefinition, useUndoRedo, useUndoRedoShortcuts };
|
|
1945
|
+
export { AD_REFERRAL_COOKIE, AD_REFERRAL_TTL_DAYS, APPLICATION_STATUS_KEYS, type AdReferral, type AdReferralFallback, AdReferralTracker, type ApplicationStatusEmailTemplates, type ApplicationStatusKey, CORE_EMAIL_TEMPLATE_VARIABLES, type ClickIdType, type ConversionExtras, type ConversionUserData, DEFAULT_APPLICATION_STATUS_EMAIL_TEMPLATES, DEFAULT_FILE_FIELD_CONFIG, DEFAULT_FORM_STYLE, DEFAULT_NOTIFICATION_EMAIL_HTML, DEFAULT_NOTIFICATION_EMAIL_SUBJECT, DEFAULT_NOTIFICATION_EMAIL_TEMPLATE, DEFAULT_SENSITIVE_FIELD_CONFIG, DEFAULT_SPAM_PROTECTION, type DatetimeConfig, type DragReorderItemHandlers, type DragReorderState, type DropPosition, DynamicForm, DynamicFormField, DynamicFormSection, ENHANCED_CONVERSIONS_GLOBAL, type EmailTemplateVariableDescriptor, type EmailTemplateVariables, type EncryptedSensitiveValue, type ExcludedTimeRange, FORM_CONVERSION_SEND_TO_GLOBAL, FORM_CSS_VAR, FORM_DARK_SCOPE_ATTR, FORM_DARK_TEXT_ATTR, FORM_DARK_TEXT_VAR, FORM_DEFAULT_COLOR, FORM_DEFAULT_DARK_SELECTOR, FORM_DEFAULT_RADIUS, FORM_GAP_VAR, FORM_RADIUS_VAR, FORM_ROOT_BG_VAR, FORM_STRUCT_VAR, FORM_STYLE_COLOR_KEYS, FORM_SUBMIT_SUCCESS_EVENT, FORM_VAR, type FieldOption, type FieldTransform, type FieldType, type FieldVisibilityCondition, type FieldWidth, FileField, type FileFieldConfig, type FormBookingConfig, type FormColorScheme, type FormConversionConfig, type FormConversionContext, type FormDefinition, type FormDefinitionJSON, type FormFieldDefinition, type FormFieldDefinitionJSON, type FormFileUploadContextValue, type FormFileUploadHandler, FormFileUploadProvider, type FormIdentifier, type FormIntegrationConfig, type FormIntegrationConfigJSON, type FormIntegrations, type FormIntegrationsJSON, type FormSection, type FormSectionJSON, type FormSpamProtectionConfig, type FormStatus, type FormStyle, type FormStyleColorKey, type FormStyleColors, type FormStyleColorsJSON, type FormStyleJSON, type FormStylePreset, type FormSubmissionType, type FormSubmitConfig, type FormSubmitConfigJSON, type FormSuccessBehavior, type FormValues, HONEYPOT_FIELD_NAME, type InputVariant, type IntegrationFieldMappingEntry, type IntegrationFieldMappingEntryJSON, NEWSLETTER_ALLOWED_FIELD_TYPES, type NotificationEmailTemplate, SAME_AS_TOGGLE_PREFIX, SAMPLE_EMAIL_TEMPLATE_VARIABLES, type SectionSameAsConfig, type SensitiveFieldConfig, type SensitiveFieldConfigJSON, type SetStateUpdater, type TextTransform, type TransportPublicKey, type UploadedFormFile, type UseDragReorderOptions, type UseDragReorderResult, type UseFormDefinitionOptions, type UseUndoRedoControls, type UseUndoRedoOptions, type UseUndoRedoReturn, type ValidationRule, type ValidationRuleJSON, type VisibilityOperator, applyTextTransform, applyTransform, base64ToBuffer, bufferToBase64, buildColorVars, buildDarkSchemeCss, buildEmailTemplateVariables, buildFormCssVars, buildFormDarkCssVars, buildInitialValues, buildUserData, buildYupSchema, captureAdReferral, darkVarName, definitionHasDarkColors, deriveLast4, encryptSensitiveValue, fireAdsConversion, fireGenerateLead, formatSsn, formatUsPhone, getFormDefinition, getSafeRedirectUrl, hasDarkColors, isSameAdReferralTouch, isVisibilityConditionMet, newTransactionId, parseFormDefinition, pushFormSubmitSuccess, readAdReferral, renderEmailTemplate, renderNotificationEmail, resizeImageFile, resolveConversionSendTo, resolveCustomGap, resolveCustomRadius, resolveSchemeColors, resolveSchemeStyle, resolveSectionTextColor, sameAsToggleKey, toE164, trackFormConversion, useDragReorder, useFormDefinition, useFormFileUpload, useUndoRedo, useUndoRedoShortcuts, writeAdReferral };
|