bhl-forms 0.8.9 → 0.8.11

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,1037 @@
1
+ const DEFAULT_COMMENTS_LABEL = "Please briefly describe your issue in a few words:";
2
+ const DEFAULT_COMMENTS_PLACEHOLDER_DYNAMIC =
3
+ '$getKey($meta, "commentsPlaceholders." + $get(Category).value, $meta.defaultCommentsPlaceholder)';
4
+ const DEFAULT_FINAL_HEADLINE_DYNAMIC_LEGAL =
5
+ '$getKey($meta, "finalHeadlines." + $get(Type_Of_Legal_Problem).value, $meta.defaultFinalHeadline)';
6
+ const DEFAULT_FINAL_SUBHEADLINE_DYNAMIC_LEGAL =
7
+ '$getKey($meta, "finalSubHeadlines." + $get(Type_Of_Legal_Problem).value, $meta.defaultFinalSubHeadline)';
8
+
9
+ const DEFAULT_COMMENTS_PLACEHOLDER_DYNAMIC_HOME_IMPROVEMENT = DEFAULT_COMMENTS_PLACEHOLDER_DYNAMIC;
10
+ const DEFAULT_FINAL_HEADLINE_HOME_IMPROVEMENT = "We Found Contractors!";
11
+ const DEFAULT_FINAL_HEADLINE_DYNAMIC_HOME_IMPROVEMENT =
12
+ '$getKey($meta, "finalHeadlines." + $get(Category).value, $meta.defaultFinalHeadline)';
13
+ const DEFAULT_FINAL_SUBHEADLINE_HOME_IMPROVEMENT = "Compare quotes and save. Verify contact info:";
14
+ const DEFAULT_FINAL_SUBHEADLINE_DYNAMIC_HOME_IMPROVEMENT =
15
+ '$getKey($meta, "finalSubHeadlines." + $get(Category).value, $meta.defaultFinalSubHeadline)';
16
+ const TCPA_LANGUAGE_HOME_IMPROVEMENT =
17
+ 'By checking this box, I a) agree to the Terms of Use, and b) consent to be contacted by <a href="/providers" target="_blank" class="t-text-blue-600 t-underline">contractors and partners</a> of this website using live, autodialed, pre-recorded, or artificial voice calls, as well as text messages. Your consent is not required as a condition of purchasing any goods or services.';
18
+
19
+ function merge() {
20
+ return Object.assign({}, ...arguments)
21
+ }
22
+
23
+ function HomeImprovementRedirectUrl() {
24
+ return 'https://listings.zipcontractor.com/api/v1/redirect?zone_id=4&vertical=HomeImprovement&category=${properties.Category}&zip_code=${properties.Zip}&sub_id=${properties.vid}'
25
+ }
26
+
27
+ const text = (updates) => {
28
+ if (updates.name && !updates.id) {
29
+ updates.id = updates.name;
30
+ }
31
+ return merge(
32
+ {
33
+ $formkit: "text",
34
+ validation: "required",
35
+ validationMessages: {
36
+ required: "Field is required",
37
+ },
38
+ labelClass: "required",
39
+ },
40
+ updates
41
+ )
42
+ };
43
+
44
+ const sbsText = (updates) => {
45
+ updates.wrapperClass = "side-by-side t-items-center";
46
+ return text(updates)
47
+ };
48
+
49
+ const verticalText = (updates) => {
50
+ updates.wrapperClass = "t-flex t-justify-center";
51
+ updates.messagesClass = "t-flex t-justify-center";
52
+ updates.inputClass = "t-text-center";
53
+ updates.helpClass = "t-mt-2.5 !t-text-sm t-text-center";
54
+ return text(updates)
55
+ };
56
+
57
+ const textArea = (updates) => {
58
+ if (updates.name && !updates.id) {
59
+ updates.id = updates.name;
60
+ }
61
+ return merge(
62
+ {
63
+ $formkit: "textarea",
64
+ rows: 5,
65
+ maxlength: 500,
66
+ validation: "required",
67
+ validationMessages: {
68
+ required: "Field is required",
69
+ },
70
+ innerClass: "t-max-w-xl",
71
+ labelClass: "required",
72
+ },
73
+ updates
74
+ )
75
+ };
76
+
77
+ const firstName = (scope, vertical, updates = {}) => {
78
+ const func = vertical ? verticalText : sbsText;
79
+ const label = vertical ? updates.label : "First Name:";
80
+ return func({
81
+ label,
82
+ placeholder: "First",
83
+ name: scope ? scope + ":" + "First_Name" : "First_Name",
84
+ autocomplete: "given-name",
85
+ validationMessages: {
86
+ required: "First Name is required",
87
+ },
88
+ ...updates,
89
+ })
90
+ };
91
+
92
+ const lastName = (scope, vertical, updates = {}) => {
93
+ const func = vertical ? verticalText : sbsText;
94
+ const label = vertical ? updates.label : "Last Name:";
95
+ return func({
96
+ label,
97
+ placeholder: "Last",
98
+ name: scope ? scope + ":" + "Last_Name" : "Last_Name",
99
+ autocomplete: "family-name",
100
+ validationMessages: {
101
+ required: "Last Name is required",
102
+ },
103
+ ...updates,
104
+ })
105
+ };
106
+
107
+ const phone = (scope, vertical, updates = {}) => {
108
+ const func = vertical ? verticalText : sbsText;
109
+ const label = vertical ? updates.label : "Phone Number:";
110
+ return func({
111
+ $formkit: "tel",
112
+ name: scope ? scope + ":" + "Primary_Phone" : "Primary_Phone",
113
+ label,
114
+ placeholder: "###-###-####",
115
+ maxlength: 12,
116
+ help: "10-digit phone number, hyphens optional",
117
+ autocomplete: "tel-national",
118
+ "data-tf-sensitive": "false",
119
+ validation: "required|matches:/^[0-9]{3}-?[0-9]{3}-?[0-9]{4}$/|valid_phone",
120
+ validationMessages: {
121
+ required: "Phone Number is required",
122
+ matches: "Invalid Phone Format, use ###-###-####",
123
+ valid_phone: "Invalid Phone Number",
124
+ },
125
+ helpClass: "t-mt-2.5 md:t-text-right md:t-mt-[-2px]",
126
+ ...updates,
127
+ })
128
+ };
129
+
130
+ const zipcode = (scope, vertical, updates = {}) => {
131
+ const func = vertical ? verticalText : sbsText;
132
+ const label = vertical ? updates.label : "Zip Code:";
133
+ const help = vertical ? updates.help ?? "We try to match you with local help" : null;
134
+ return func({
135
+ label,
136
+ help,
137
+ placeholder: "#####",
138
+ name: scope ? scope + ":" + "Zip" : "Zip",
139
+ maxlength: 5,
140
+ inputmode: "numeric",
141
+ autocomplete: "postal-code",
142
+ validation: "required|matches:/^[0-9]{5}$/",
143
+ validationMessages: {
144
+ required: "Zip Code is required",
145
+ matches: "Invalid Zip Code",
146
+ },
147
+ ...updates,
148
+ })
149
+ };
150
+
151
+ // TODO: vertical not supported yet
152
+ const comments = (scope, vertical, updates) =>
153
+ textArea(
154
+ merge(
155
+ {
156
+ name: scope ? scope + ":" + "Comments" : "Comments",
157
+ label: "Please briefly describe your situation in a few words:",
158
+ placeholder:
159
+ 'For Example: "I would like help with child support payments" or "I need help with visitation rights"',
160
+ },
161
+ updates
162
+ )
163
+ );
164
+
165
+ const TCPAConsent = (scope) => ({
166
+ $formkit: "checkbox",
167
+ label: "$meta.tcpaLanguage",
168
+ // Necessary to get links to work in the tcpa language
169
+ __raw__sectionsSchema: {
170
+ label: { attrs: { innerHTML: "$label" } },
171
+ },
172
+ name: scope ? scope + ":" + "TCPA_Opt_In" : "TCPA_Opt_In",
173
+ "data-tf-sensitive": "false",
174
+ validation: "required|accepted",
175
+ validationMessages: {
176
+ required: "Consent is required",
177
+ accepted: "Consent is required",
178
+ },
179
+ classes: {
180
+ label: "t-text-xs t-text-slate-500 t-font-normal !t-leading-[0.9rem]",
181
+ },
182
+ });
183
+
184
+ const NEXT_ON_ENTER = "$onEnter($setNextStep($fireStepEvent($get(form)), $preStepFunc($get(form))))";
185
+ const NEXT_ON_INPUT = "$onInput($setNextStep($fireStepEvent($get(form)), $preStepFunc($get(form))))";
186
+
187
+ const isInput = (n) => {
188
+ return n.type !== "group" && n.type !== "section" && n.type !== "form" && n.$formkit !== "hidden" && !n.children
189
+ };
190
+
191
+ const findLastInput = (n) => {
192
+ if (isInput(n)) {
193
+ return n
194
+ }
195
+ for (var i = n.children.length - 1; i >= 0; i--) {
196
+ if (typeof n.children === "string") {
197
+ continue
198
+ }
199
+ const child = n.children[i];
200
+ if (isInput(child)) {
201
+ return child
202
+ }
203
+ const res = findLastInput(child);
204
+ if (res) {
205
+ return res
206
+ }
207
+ }
208
+ return null
209
+ };
210
+
211
+ const secureIconDefault = {
212
+ $el: "div",
213
+ if: "$activeStep === $lastStep()",
214
+ attrs: {
215
+ class: "t-flex t-justify-center t-items-center t-text-sm t-text-gray-500",
216
+ },
217
+ children: [
218
+ {
219
+ $el: "img",
220
+ attrs: {
221
+ loading: "lazy",
222
+ alt: "",
223
+ style: {
224
+ border: 0,
225
+ },
226
+ width: "25",
227
+ height: "25",
228
+ src: "https://d27hmee62k45vz.cloudfront.net/lock_icon_1.jpeg",
229
+ },
230
+ },
231
+ {
232
+ $el: "span",
233
+ children: "Secure & Encrypted",
234
+ attrs: {
235
+ class: "t-pl-2 t-pt-1 t-font-medium",
236
+ },
237
+ },
238
+ ],
239
+ };
240
+
241
+ function secureIcon(updates) {
242
+ return merge(secureIconDefault, updates)
243
+ }
244
+
245
+ function verticalStepSubHeadline(updates) {
246
+ return {
247
+ $el: "h5",
248
+ children: updates.subheadline || "",
249
+ attrs: {
250
+ class:
251
+ "t-flex t-justify-center t-text-center !t-text-lg t-font-normal t-text-dark t-pb-5 t-pt-0 t-px-1" +
252
+ " " +
253
+ (updates.subheadlineClass || ""),
254
+ },
255
+ }
256
+ }
257
+
258
+ function commentsStepHeadline(updates) {
259
+ return {
260
+ $el: "h3",
261
+ children: updates.headline || "Additional Details",
262
+ attrs: {
263
+ class:
264
+ "t-flex t-justify-center t-text-center t-text-2xl t-font-bold t-text-blue-500 t-pb-5 t-pt-0 t-px-1" +
265
+ " " +
266
+ (updates.headlineClass || ""),
267
+ },
268
+ }
269
+ }
270
+
271
+ function firstAndLastStepHeadline(updates) {
272
+ return {
273
+ $el: "h3",
274
+ children: updates.headline || "Please Provide a Contact Name",
275
+ attrs: {
276
+ class:
277
+ "t-flex t-justify-center t-text-center t-text-2xl t-font-bold t-text-blue-500 t-pb-5 t-pt-0 t-px-1" +
278
+ " " +
279
+ (updates.headlineClass || ""),
280
+ },
281
+ }
282
+ }
283
+
284
+ function contactStepHeadline(updates) {
285
+ return {
286
+ $el: "h3",
287
+ children: updates.headline || DEFAULT_FINAL_HEADLINE_DYNAMIC_LEGAL,
288
+ attrs: {
289
+ class:
290
+ "t-flex t-justify-center t-text-center t-text-2xl t-font-bold t-text-blue-500 t-pb-3 t-pt-0 t-px-1" +
291
+ " " +
292
+ (updates.headlineClass || "") +
293
+ " f-contact-info-headline",
294
+ },
295
+ }
296
+ }
297
+
298
+ function contactStepSubHeadline(updates) {
299
+ return {
300
+ $el: "h5",
301
+ children: updates.subheadline || DEFAULT_FINAL_SUBHEADLINE_DYNAMIC_LEGAL,
302
+ attrs: {
303
+ class:
304
+ "t-flex t-justify-center t-text-center !t-text-lg t-font-semibold t-pb-7 t-pt-0 t-px-3" +
305
+ " " +
306
+ (updates.subheadlineClass || "") +
307
+ " f-contact-info-subheadline",
308
+ },
309
+ }
310
+ }
311
+
312
+ const TRUSTED_FORM_JS = `(function() {
313
+ if (window.xxTrustedFormLoaded) {
314
+ return
315
+ }
316
+ var vid = '';
317
+ if (typeof window.zar !== 'undefined') {
318
+ vid = window.zar.getVID();
319
+ }
320
+ window.xxTrustedFormLoaded = true;
321
+ var sandbox = document.location.hostname.indexOf('localhost') > -1 ? 'true' : 'false'
322
+ var tf = document.createElement('script');
323
+ tf.type = 'text/javascript'; tf.async = true;
324
+ tf.src = ("https:" == document.location.protocol ? 'https' : 'http') + "://api.trustedform.com/trustedform.js?field=xxTrustedFormCertUrl&identifier=" + vid + "&ping_field=xxTrustedFormPingUrl&provideReferrer=false&invert_field_sensitivity=true&sandbox=" + sandbox + "&l=" + new Date().getTime() + Math.random();
325
+ var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(tf, s);
326
+ })();`;
327
+
328
+ function trustedFormScript() {
329
+ return {
330
+ $el: "script",
331
+ if: "$activeStep === $lastStep()",
332
+ children: TRUSTED_FORM_JS,
333
+ }
334
+ }
335
+
336
+ const stepDefaults = (step, stepKey) => ({
337
+ $el: "section",
338
+ if: '$stepEnabled("' + step + '")',
339
+ attrs: {
340
+ hidden: '$activeStep !== "' + step + '"',
341
+ key: stepKey ? stepKey : step,
342
+ },
343
+ });
344
+
345
+ function step(name, inputs, updates = {}) {
346
+ const {
347
+ nextOnEnter = true,
348
+ nextOnInput = false,
349
+ stepKey = undefined,
350
+ nextStepMap = undefined,
351
+ triggerRedirectMap = undefined,
352
+ autoFocus = undefined,
353
+ } = updates;
354
+
355
+ if (inputs && inputs.length && (nextOnEnter || nextOnInput)) {
356
+ const lastInput = findLastInput(inputs[inputs.length - 1]);
357
+ if (lastInput && nextOnEnter === true) {
358
+ lastInput.onKeypress = NEXT_ON_ENTER;
359
+ }
360
+ if (lastInput && nextOnInput === true) {
361
+ lastInput.onInput = NEXT_ON_INPUT;
362
+ }
363
+ }
364
+
365
+ return merge(stepDefaults(name, stepKey), {
366
+ children: [
367
+ {
368
+ $formkit: "group",
369
+ id: name,
370
+ name: name,
371
+ nextStepMap: nextStepMap,
372
+ triggerRedirectMap: triggerRedirectMap,
373
+ autoFocus: autoFocus,
374
+ children: inputs,
375
+ },
376
+ ],
377
+ })
378
+ }
379
+
380
+ function commentsHeadline(updates = {}) {
381
+ const mergedUpdates = { ...updates, nextOnEnter: false };
382
+
383
+ return step(
384
+ "comments",
385
+ [
386
+ commentsStepHeadline(updates),
387
+ comments(updates.scope, false, {
388
+ label: typeof updates.label === "undefined" ? DEFAULT_COMMENTS_LABEL : updates.label,
389
+ placeholder: updates.placeholder || DEFAULT_COMMENTS_PLACEHOLDER_DYNAMIC,
390
+ inputClass: typeof updates.inputClass === "undefined" ? "!t-h-32" : updates.inputClass,
391
+ }),
392
+ ],
393
+ mergedUpdates
394
+ )
395
+ }
396
+
397
+ function contactInfoNoEmail(updates = {}) {
398
+ return step(
399
+ "contactInfo",
400
+ [
401
+ contactStepHeadline(updates),
402
+ contactStepSubHeadline(updates),
403
+ trustedFormScript(),
404
+ phone(updates.scope, true),
405
+ TCPAConsent(updates.scope),
406
+ secureIcon(),
407
+ ],
408
+ { nextOnEnter: false }
409
+ )
410
+ }
411
+
412
+ function firstAndLastV3(updates = {}) {
413
+ return step(
414
+ "firstAndLast",
415
+ [
416
+ firstAndLastStepHeadline({
417
+ headline: updates.headline ?? "Who is looking for help?",
418
+ headlineClass: updates.headlineClass,
419
+ }),
420
+ verticalStepSubHeadline({
421
+ subheadline: updates.subheadline ?? "Note: we never share info without consent",
422
+ subheadlineClass: "!t-text-sm !t-text-gray-500",
423
+ }),
424
+ firstName(updates.scope),
425
+ lastName(updates.scope),
426
+ ],
427
+ updates
428
+ )
429
+ }
430
+
431
+ function applianceRepairFirstStep(updates = {}) {
432
+ return step(
433
+ "applianceRepairFirstStep",
434
+ [
435
+ {
436
+ $formkit: "hidden",
437
+ name: "Category",
438
+ id: "Category",
439
+ value: "Appliances",
440
+ },
441
+ zipcode(updates.scope, true, updates.input),
442
+ ],
443
+ updates
444
+ )
445
+ }
446
+
447
+ const formNavigation = (updates = {}) => ({
448
+ $el: "div",
449
+ attrs: {
450
+ class: {
451
+ if: "$activeStep === $firstStep()",
452
+ then: "step-nav !t-justify-center sm:!t-justify-between",
453
+ else: "step-nav !t-justify-between",
454
+ },
455
+ },
456
+ children: [
457
+ {
458
+ $formkit: "button",
459
+ name: "back_button",
460
+ onClick: "$setPreviousStep($prevStepFunc($get(form)))",
461
+ children: "Back",
462
+ outerClass: {
463
+ if: "$activeStep === $firstStep()",
464
+ then: "t-hidden sm:t-block",
465
+ else: "",
466
+ },
467
+ style: {
468
+ if: "$activeStep === $firstStep()",
469
+ then: "display: none;",
470
+ },
471
+ classes: {
472
+ input: (updates.inputClass || "") + " f-navigation-input",
473
+ },
474
+ },
475
+ {
476
+ $formkit: "button",
477
+ name: "next_button",
478
+ onClick: "$setNextStep($fireStepEvent($get(form)), $preStepFunc($get(form)))",
479
+ children: {
480
+ if: "$activeStep === $firstStep()",
481
+ then: updates.startText || "Start",
482
+ else: "Next",
483
+ },
484
+ outerClass: {
485
+ if: "$activeStep === $lastStep()",
486
+ then: "t-hidden",
487
+ else: "",
488
+ },
489
+ style: {
490
+ if: "$activeStep === $lastStep()",
491
+ then: "display: none;",
492
+ },
493
+ classes: {
494
+ input: (updates.inputClass || "") + " f-navigation-input",
495
+ },
496
+ },
497
+ {
498
+ $formkit: "submit",
499
+ name: "submit_button",
500
+ label: updates.submitLabel || "Submit",
501
+ if: "$activeStep === $lastStep()",
502
+ style: {
503
+ if: "$activeStep !== $lastStep()",
504
+ then: "display: none;",
505
+ },
506
+ classes: {
507
+ input: (updates.inputClass || "") + " !t-ml-2 sm:!t-ml-auto f-navigation-input",
508
+ },
509
+ },
510
+ ],
511
+ });
512
+
513
+ const formDetails = () => ({
514
+ $el: "pre",
515
+ if: '$urlParam("fdbg", "") == 1',
516
+ children: [
517
+ {
518
+ $el: "pre",
519
+ children: "$stringify( $get(form).value )",
520
+ attrs: {
521
+ class: "t-text-xs",
522
+ style: "overflow: scroll",
523
+ },
524
+ },
525
+ {
526
+ $el: "pre",
527
+ children: ["activeStep: ", "$activeStep"],
528
+ attrs: {
529
+ class: "t-text-xs",
530
+ style: "overflow: scroll",
531
+ },
532
+ },
533
+ {
534
+ $el: "pre",
535
+ children: ["stepHistory: ", "$stepHistory"],
536
+ attrs: {
537
+ class: "t-text-xs",
538
+ style: "overflow: scroll",
539
+ },
540
+ },
541
+ {
542
+ $el: "pre",
543
+ children: ["stepQueue: ", "$stepQueue"],
544
+ attrs: {
545
+ class: "t-text-xs",
546
+ style: "overflow: scroll",
547
+ },
548
+ },
549
+ {
550
+ $el: "pre",
551
+ children: ["steps: ", "$stepKeys()"],
552
+ attrs: {
553
+ class: "t-text-xs",
554
+ style: "overflow: scroll",
555
+ },
556
+ },
557
+ ],
558
+ });
559
+
560
+ const formPropDefaults = {
561
+ type: "form",
562
+ id: "form",
563
+ config: { validationVisibility: "submit" },
564
+ onSubmit: '$submit($submitUrl, $prepData, $handleRedirect, "text/plain; charset=UTF-8")',
565
+ plugins: "$plugins",
566
+ actions: false,
567
+ anchorElement: "form-anchor",
568
+ useLocalStorage: true,
569
+ prepop: {
570
+ fromURL: true,
571
+ },
572
+ errorCodes: {
573
+ 403: { message: "An Error Occurred", abort: false },
574
+ 409: { abort: false },
575
+ 429: "An Error Occurred",
576
+ 504: { message: "An Error Occurred", abort: false },
577
+ },
578
+ formClass: "!t-max-w-[40rem]",
579
+ };
580
+
581
+ function filterMapByKey(obj, keyList) {
582
+ return Object.fromEntries(Object.entries(obj).filter(([key]) => keyList.includes(key)))
583
+ }
584
+
585
+ // export function filteredNextStepsMapLegal(keyList) {
586
+ // const res = { Type_Of_Legal_Problem: filterMapByKey(nextStepsMapGeneralLegal["Type_Of_Legal_Problem"], keyList) }
587
+ // res["*"] = nextStepsMapGeneralLegal["*"]
588
+ // return res
589
+ // }
590
+
591
+ function formProps(updates) {
592
+ const props = merge(formPropDefaults, updates);
593
+ if (props.formId && !props.name) {
594
+ props.name = props.formId;
595
+ }
596
+ return props
597
+ }
598
+
599
+ const metaDefaults = {};
600
+
601
+ function metaProps(updates) {
602
+ const data = merge(metaDefaults, updates);
603
+ return {
604
+ type: "meta",
605
+ data,
606
+ }
607
+ }
608
+
609
+ function defaultMetaPropsHomeImprovement(category = null) {
610
+ let commentsPlaceholders = HomeImprovementCommentsPlaceholders;
611
+ let finalHeadlines = HomeImprovementFinalHeadlines;
612
+ let finalSubHeadlines = HomeImprovementFinalSubHeadlines;
613
+ if (category) {
614
+ commentsPlaceholders = filterMapByKey(HomeImprovementCommentsPlaceholders, category);
615
+ finalHeadlines = filterMapByKey(HomeImprovementFinalHeadlines, category);
616
+ finalSubHeadlines = filterMapByKey(HomeImprovementFinalSubHeadlines, category);
617
+ }
618
+ return metaProps({
619
+ tcpaLanguage: TCPA_LANGUAGE_HOME_IMPROVEMENT,
620
+ defaultCommentsPlaceholder: DEFAULT_COMMENTS_PLACEHOLDER_DYNAMIC_HOME_IMPROVEMENT,
621
+ commentsPlaceholders: commentsPlaceholders,
622
+ defaultFinalHeadline: DEFAULT_FINAL_HEADLINE_HOME_IMPROVEMENT,
623
+ finalHeadlines: finalHeadlines,
624
+ defaultFinalSubHeadline: DEFAULT_FINAL_SUBHEADLINE_HOME_IMPROVEMENT,
625
+ finalSubHeadlines: finalSubHeadlines,
626
+ })
627
+ }
628
+
629
+ function dynamicSchemaNode(field = "Type_Of_Legal_Problem") {
630
+ return {
631
+ $cmp: "FormKitSchema",
632
+ if: "$get(" + field + ").value",
633
+ props: {
634
+ schema: "$meta.dynamicSchema",
635
+ data: "$buildData($meta)",
636
+ },
637
+ }
638
+ }
639
+
640
+ const formAnchorDefaults = {
641
+ $el: "div",
642
+ children: [
643
+ {
644
+ $el: "div",
645
+ attrs: {
646
+ id: "form-anchor",
647
+ class: "t-absolute",
648
+ style: { top: "-30px", left: 0 },
649
+ },
650
+ },
651
+ ],
652
+ attrs: {
653
+ class: "t-relative",
654
+ },
655
+ };
656
+
657
+ function formAnchor(updates) {
658
+ return merge(formAnchorDefaults, updates)
659
+ }
660
+
661
+ const progressBarDefaults = {
662
+ $el: "div",
663
+ attrs: {
664
+ class: "t-mt-7 t-mb-5 t-w-full t-flex t-flex-col t-justify-center t-items-center",
665
+ style: {
666
+ if: "$fns.eq($activeStep, $firstStep()) || $fns.eq($activeStep, $lastStep())",
667
+ then: "display: none",
668
+ },
669
+ },
670
+ children: [
671
+ {
672
+ $el: "div",
673
+ attrs: {
674
+ class: "t-flex t-justify-center",
675
+ },
676
+ children: [
677
+ {
678
+ $el: "span",
679
+ attrs: {
680
+ id: "progress-bar-text",
681
+ class: "t-text-sm t-mb-1",
682
+ },
683
+ children: ["0% Complete"],
684
+ },
685
+ ],
686
+ },
687
+ {
688
+ $el: "div",
689
+ attrs: {
690
+ class: "t-bg-gray-100 t-w-9/12 t-rounded",
691
+ },
692
+ children: [
693
+ {
694
+ $el: "div",
695
+ attrs: {
696
+ id: "progress-bar",
697
+ class:
698
+ "t-flex t-flex-col t-justify-center t-text-center t-whitespace-nowrap t-w-[10%] t-h-1.5 t-rounded t-text-white t-bg-[#007bff]",
699
+ style: {
700
+ transition: "width 0.5s ease",
701
+ },
702
+ },
703
+ },
704
+ ],
705
+ },
706
+ ],
707
+ };
708
+
709
+ function progressBar(updates) {
710
+ return merge(progressBarDefaults, updates)
711
+ }
712
+
713
+ function headlineDefaults(updates = {}) {
714
+ return {
715
+ $el: "h1",
716
+ attrs: {
717
+ class:
718
+ "t-flex t-justify-center t-text-center t-text-[2rem] t-font-semibold t-pt-5 t-px-7 md:t-px-3" +
719
+ " " +
720
+ (updates.headlineClass || "") +
721
+ " f-first-headline",
722
+ },
723
+ }
724
+ }
725
+
726
+ function headline(updates = {}) {
727
+ return merge(headlineDefaults(updates), updates)
728
+ }
729
+
730
+ function subHeadlineDefaults(updates = {}) {
731
+ return {
732
+ $el: "h3",
733
+ attrs: {
734
+ class:
735
+ "t-flex t-justify-center t-text-center !t-text-[1.2rem] t-font-medium t-text-blue-500 t-px-10" +
736
+ " " +
737
+ (updates.subheadlineClass || "") +
738
+ " f-first-subheadline",
739
+ },
740
+ }
741
+ }
742
+
743
+ function subHeadline(updates = {}) {
744
+ return merge(subHeadlineDefaults(updates), updates)
745
+ }
746
+
747
+ const hiddenInputsBase = [
748
+ {
749
+ $formkit: "hidden",
750
+ name: "gclid",
751
+ value: null,
752
+ },
753
+ {
754
+ $formkit: "hidden",
755
+ name: "campaignid",
756
+ value: null,
757
+ },
758
+ {
759
+ $formkit: "hidden",
760
+ name: "s",
761
+ value: null,
762
+ },
763
+ ];
764
+
765
+ const hiddenInputsHomeImprovement = [
766
+ {
767
+ $formkit: "hidden",
768
+ name: "vertical",
769
+ value: "HomeImprovement",
770
+ },
771
+ {
772
+ $formkit: "hidden",
773
+ name: "TCPA_Language",
774
+ value: "$meta.tcpaLanguage",
775
+ },
776
+ ...hiddenInputsBase,
777
+ ];
778
+
779
+ const homeImprovementRedirectMapDefaults = {
780
+ "*": HomeImprovementRedirectUrl(),
781
+ };
782
+
783
+ function homeImprovementRedirectMap(updates) {
784
+ return merge(homeImprovementRedirectMapDefaults, updates)
785
+ }
786
+
787
+ // ------ Home Improvement
788
+
789
+ const HomeImprovementCommentsPlaceholders = {
790
+ Additions: 'Example: "I would like to add a sunroom to my home"',
791
+ Appliances: 'Example: "I need to repair a dishwasher"',
792
+ Appraisals: 'Example: "I need to get my home appraised"',
793
+ Cabinets: 'Example: "I want to install new kitchen cabinets"',
794
+ Carpentry: 'Example: "I need someone to build custom shelves"',
795
+ Carpets: 'Example: "I want to replace the carpets in my living room"',
796
+ Cleaning: 'Example: "I need a professional cleaning service for my home"',
797
+ Countertops: 'Example: "I want to install granite countertops in my kitchen"',
798
+ "Decks and Porches": 'Example: "I want to build a new deck in my backyard"',
799
+ Demolition: 'Example: "I need to demolish a wall in my home"',
800
+ Doors: 'Example: "I want to replace the front door of my house"',
801
+ Driveways: 'Example: "I need to repair my driveway"',
802
+ "Drywall and Plaster": 'Example: "I need to repair a hole in my drywall"',
803
+ Electrical: 'Example: "I need an electrician to install new light fixtures"',
804
+ Fencing: 'Example: "I want to install a privacy fence in my backyard"',
805
+ Flooring: 'Example: "I want to install hardwood flooring in my living room"',
806
+ Foundations: 'Example: "I need to repair the foundation of my house"',
807
+ "Garage Doors": 'Example: "I want to replace my garage door"',
808
+ "General Contractors": 'Example: "I need a general contractor for a home renovation"',
809
+ Gutters: 'Example: "I need to clean and repair my gutters"',
810
+ Handyman: 'Example: "I need a handyman to fix various things around my house"',
811
+ "Holiday Decorators": 'Example: "I want to hire someone to decorate my home for the holidays"',
812
+ "Smart Home": 'Example: "I want to install a smart home automation system"',
813
+ "Home Builders": 'Example: "I want to build a custom home"',
814
+ "Home Inspection": 'Example: "I need a home inspection before buying a house"',
815
+ "Home Organization": 'Example: "I need help organizing my closets and storage"',
816
+ "Home Security": 'Example: "I want to install a home security system"',
817
+ "Home Staging": 'Example: "I need a home staging service to prepare my house for sale"',
818
+ "Home Theater": 'Example: "I want to set up a home theater system"',
819
+ "Home Warranties": 'Example: "I want to purchase a home warranty"',
820
+ "Hot Tubs": 'Example: "I want to install a hot tub in my backyard"',
821
+ "Heating and Cooling": 'Example: "I need to repair my air conditioning unit"',
822
+ Insulation: 'Example: "I want to improve the insulation in my home"',
823
+ "Junk Removal": 'Example: "I need a service to remove junk and debris from my property"',
824
+ Landscaping: 'Example: "I want to redesign my backyard landscaping"',
825
+ Locksmiths: 'Example: "I need a locksmith to change the locks on my doors"',
826
+ "Masonry and Concrete": 'Example: "I need to repair a cracked concrete driveway"',
827
+ Restoration: 'Example: "I need water damage restoration services"',
828
+ Moving: 'Example: "I need a moving company to help me relocate"',
829
+ Painting: 'Example: "I want to paint the interior walls of my house"',
830
+ "Pest Control": 'Example: "I need pest control services for my home"',
831
+ Pools: 'Example: "I want to install a swimming pool in my backyard"',
832
+ Plumbing: 'Example: "I need a plumber to fix a leaky faucet"',
833
+ "Pressure Washing": 'Example: "I want to pressure wash the exterior of my house"',
834
+ Remodeling: 'Example: "I want to remodel my kitchen"',
835
+ Roofing: 'Example: "I need to repair a leaky roof"',
836
+ Sheds: 'Example: "I want to build a storage shed in my backyard"',
837
+ Siding: 'Example: "I want to replace the siding on my house"',
838
+ Solar: 'Example: "I want to install solar panels on my roof"',
839
+ Tiling: 'Example: "I want to install new tiles in my bathroom"',
840
+ "Tree Services": 'Example: "I need a large tree removed"',
841
+ "Walk-in Tubs": 'Example: "I want to install a walk-in tub in my bathroom"',
842
+ Waterproofing: 'Example: "I need to waterproof my basement"',
843
+ "Window Cleaning": 'Example: "I need a professional window cleaning service"',
844
+ Windows: 'Example: "I want to replace 3 windows in my house"',
845
+ "Not Sure or Other": 'Example: "I need general handyman services"',
846
+ };
847
+
848
+ const HomeImprovementFinalHeadlines = {
849
+ // 'Additions': '',
850
+ Appliances: "We Have Appliance Pros Standing By!",
851
+ // 'Appraisals': '',
852
+ // 'Cabinets': '',
853
+ // 'Carpentry': '',
854
+ // 'Carpets': '',
855
+ // 'Cleaning': '',
856
+ // 'Countertops': '',
857
+ // 'Decks and Porches': '',
858
+ // 'Demolition': '',
859
+ // 'Doors': '',
860
+ // 'Driveways': '',
861
+ // 'Drywall and Plaster': '',
862
+ // 'Electrical': '',
863
+ // 'Fencing': '',
864
+ // 'Flooring': '',
865
+ // 'Foundations': '',
866
+ // 'Garage Doors': '',
867
+ // 'General Contractors': '',
868
+ // 'Gutters': '',
869
+ // 'Handyman': '',
870
+ // 'Holiday Decorators': '',
871
+ // 'Smart Home': '',
872
+ // 'Home Builders': '',
873
+ // 'Home Inspection': '',
874
+ // 'Home Organization': '',
875
+ // 'Home Security': '',
876
+ // 'Home Staging': '',
877
+ // 'Home Theater': '',
878
+ // 'Home Warranties': '',
879
+ // 'Hot Tubs': '',
880
+ // 'Heating and Cooling': '',
881
+ // 'Insulation': '',
882
+ // 'Junk Removal': '',
883
+ // 'Landscaping': '',
884
+ // 'Locksmiths': '',
885
+ // 'Masonry and Concrete': '',
886
+ // 'Restoration': '',
887
+ // 'Moving': '',
888
+ // 'Painting': '',
889
+ // 'Pest Control': '',
890
+ // 'Pools': '',
891
+ // 'Plumbing': '',
892
+ // 'Pressure Washing': '',
893
+ // 'Remodeling': '',
894
+ // 'Roofing': '',
895
+ // 'Sheds': '',
896
+ // 'Siding': '',
897
+ // 'Solar': '',
898
+ // 'Tiling': '',
899
+ // 'Walk-in Tubs': '',
900
+ // 'Waterproofing': '',
901
+ // 'Window Cleaning': '',
902
+ // 'Windows': '',
903
+ };
904
+
905
+ const HomeImprovementFinalSubHeadlines = {
906
+ // 'Additions': '',
907
+ Appliances: "What is the best number to reach you?",
908
+ // 'Appraisals': '',
909
+ // 'Cabinets': '',
910
+ // 'Carpentry': '',
911
+ // 'Carpets': '',
912
+ // 'Cleaning': '',
913
+ // 'Countertops': '',
914
+ // 'Decks and Porches': '',
915
+ // 'Demolition': '',
916
+ // 'Doors': '',
917
+ // 'Driveways': '',
918
+ // 'Drywall and Plaster': '',
919
+ // 'Electrical': '',
920
+ // 'Fencing': '',
921
+ // 'Flooring': '',
922
+ // 'Foundations': '',
923
+ // 'Garage Doors': '',
924
+ // 'General Contractors': '',
925
+ // 'Gutters': '',
926
+ // 'Handyman': '',
927
+ // 'Holiday Decorators': '',
928
+ // 'Smart Home': '',
929
+ // 'Home Builders': '',
930
+ // 'Home Inspection': '',
931
+ // 'Home Organization': '',
932
+ // 'Home Security': '',
933
+ // 'Home Staging': '',
934
+ // 'Home Theater': '',
935
+ // 'Home Warranties': '',
936
+ // 'Hot Tubs': '',
937
+ // 'Heating and Cooling': '',
938
+ // 'Insulation': '',
939
+ // 'Junk Removal': '',
940
+ // 'Landscaping': '',
941
+ // 'Locksmiths': '',
942
+ // 'Masonry and Concrete': '',
943
+ // 'Restoration': '',
944
+ // 'Moving': '',
945
+ // 'Painting': '',
946
+ // 'Pest Control': '',
947
+ // 'Pools': '',
948
+ // 'Plumbing': '',
949
+ // 'Pressure Washing': '',
950
+ // 'Remodeling': '',
951
+ // 'Roofing': '',
952
+ // 'Sheds': '',
953
+ // 'Siding': '',
954
+ // 'Solar': '',
955
+ // 'Tiling': '',
956
+ // 'Walk-in Tubs': '',
957
+ // 'Waterproofing': '',
958
+ // 'Window Cleaning': '',
959
+ // 'Windows': '',
960
+ };
961
+
962
+ const nextStepsMapApplianceRepairMinimal = {
963
+ values: {
964
+ // Custom because we ask zip on s1
965
+ "*": ["comments", "firstAndLast", "contactInfo"],
966
+ },
967
+ };
968
+
969
+ const meta = defaultMetaPropsHomeImprovement();
970
+
971
+ meta.data.dynamicSchema = [
972
+ commentsHeadline({
973
+ label: null,
974
+ headline: "Please describe your appliance issue:",
975
+ headlineClass: "!t-text-dark",
976
+ }),
977
+ firstAndLastV3({
978
+ headline: "Who needs appliance help?",
979
+ headlineClass: "!t-text-dark",
980
+ subheadline: "",
981
+ }),
982
+ ];
983
+
984
+ const schema = [
985
+ meta,
986
+ formAnchor(),
987
+ {
988
+ $cmp: "FormKit",
989
+ props: formProps({
990
+ formId: "applianceRepairMinimal",
991
+ redirectMap: homeImprovementRedirectMap(),
992
+ }),
993
+ children: [
994
+ progressBar(),
995
+ headline({
996
+ children: '$urlParam("hl", "Get Started Here!")',
997
+ if: "$activeStep === $firstStep()",
998
+ }),
999
+ subHeadline({
1000
+ children: '$urlParam("shl", "Please Enter Your Zip Code:")',
1001
+ if: "$activeStep === $firstStep()",
1002
+ subheadlineClass: "!t-font-bold !t-text-[#465f87]",
1003
+ }),
1004
+ ...hiddenInputsHomeImprovement,
1005
+ {
1006
+ $el: "div",
1007
+ attrs: {
1008
+ class: "form-body",
1009
+ },
1010
+ children: [
1011
+ applianceRepairFirstStep({
1012
+ nextOnInput: false,
1013
+ headlineClass: "t-text-lg",
1014
+ nextStepMap: nextStepsMapApplianceRepairMinimal,
1015
+ input: {
1016
+ help: null,
1017
+ },
1018
+ }),
1019
+ dynamicSchemaNode("Category"),
1020
+ contactInfoNoEmail({
1021
+ headlineClass: "!t-text-[#465f87]",
1022
+ subheadlineClass: "!t-text-[#353739]",
1023
+ headline: DEFAULT_FINAL_HEADLINE_DYNAMIC_HOME_IMPROVEMENT,
1024
+ subheadline: DEFAULT_FINAL_SUBHEADLINE_DYNAMIC_HOME_IMPROVEMENT,
1025
+ }),
1026
+ formNavigation({
1027
+ startText: "Schedule Now",
1028
+ inputClass: "!t-text-black !t-font-extrabold !t-bg-[#ffce51]",
1029
+ }),
1030
+ formDetails(),
1031
+ ],
1032
+ },
1033
+ ],
1034
+ },
1035
+ ];
1036
+
1037
+ export { schema as default };