bhl-forms 0.11.23 → 0.11.25

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (33) hide show
  1. package/dist/forms/applianceRepair.es.js +1 -1
  2. package/dist/forms/applianceRepair.iife.js +1 -1
  3. package/dist/forms/applianceRepair.json +1 -1
  4. package/dist/forms/applianceRepairMinimal.es.js +1 -1
  5. package/dist/forms/applianceRepairMinimal.iife.js +1 -1
  6. package/dist/forms/applianceRepairMinimal.json +1 -1
  7. package/dist/forms/electrical.es.js +1 -1
  8. package/dist/forms/electrical.iife.js +1 -1
  9. package/dist/forms/electrical.json +1 -1
  10. package/dist/forms/generalContractors.es.js +1 -1
  11. package/dist/forms/generalContractors.iife.js +1 -1
  12. package/dist/forms/generalContractors.json +1 -1
  13. package/dist/forms/generalHomeImprovement.es.js +1 -1
  14. package/dist/forms/generalHomeImprovement.iife.js +1 -1
  15. package/dist/forms/generalHomeImprovement.json +1 -1
  16. package/dist/forms/generalHomeImprovementThankYou.es.js +1 -1
  17. package/dist/forms/generalHomeImprovementThankYou.iife.js +1 -1
  18. package/dist/forms/generalHomeImprovementThankYou.json +1 -1
  19. package/dist/forms/handymanCall.es.js +891 -0
  20. package/dist/forms/handymanCall.iife.js +1 -0
  21. package/dist/forms/handymanCall.json +1 -0
  22. package/dist/forms/plumbing.es.js +1 -1
  23. package/dist/forms/plumbing.iife.js +1 -1
  24. package/dist/forms/plumbing.json +1 -1
  25. package/dist/forms/restorationCall.es.js +1 -1
  26. package/dist/forms/restorationCall.iife.js +1 -1
  27. package/dist/forms/roofing.es.js +1 -1
  28. package/dist/forms/roofing.iife.js +1 -1
  29. package/dist/forms/roofing.json +1 -1
  30. package/dist/forms/windows.es.js +1 -1
  31. package/dist/forms/windows.iife.js +1 -1
  32. package/dist/forms/windows.json +1 -1
  33. package/package.json +1 -1
@@ -0,0 +1,891 @@
1
+ function merge() {
2
+ return Object.assign({}, ...arguments)
3
+ }
4
+
5
+ // ------ Common Base Settings
6
+
7
+ const ensureIds = (cfg) => {
8
+ if (cfg.name && !cfg.id) {
9
+ cfg.id = cfg.name;
10
+ }
11
+ return cfg
12
+ };
13
+
14
+ const text = (updates) => {
15
+ ensureIds(updates);
16
+ return merge(
17
+ {
18
+ $formkit: "text",
19
+ validation: "required",
20
+ validationMessages: {
21
+ required: "Field is required",
22
+ },
23
+ labelClass: "required",
24
+ },
25
+ updates
26
+ )
27
+ };
28
+
29
+ const sbsText = (updates) => {
30
+ updates.wrapperClass = "side-by-side t-items-center";
31
+ return text(updates)
32
+ };
33
+
34
+ const verticalText = (updates) => {
35
+ updates.wrapperClass = "t-flex t-justify-center";
36
+ updates.messagesClass = "t-flex t-justify-center";
37
+ updates.inputClass = "t-text-center";
38
+ updates.helpClass = "t-mt-2.5 !t-text-sm t-text-center";
39
+ return text(updates)
40
+ };
41
+
42
+ const textArea = (updates) => {
43
+ ensureIds(updates);
44
+ return merge(
45
+ {
46
+ $formkit: "textarea",
47
+ rows: 5,
48
+ maxlength: 500,
49
+ validation: "required",
50
+ validationMessages: {
51
+ required: "Field is required",
52
+ },
53
+ innerClass: "t-max-w-xl",
54
+ labelClass: "required",
55
+ },
56
+ updates
57
+ )
58
+ };
59
+
60
+ const zipcode$1 = (scope, vertical, updates = {}) => {
61
+ const func = vertical ? verticalText : sbsText;
62
+ const label = vertical ? updates.label : "Zip Code:";
63
+ const help = vertical ? updates.help ?? "We try to match you with local help" : null;
64
+ return func({
65
+ label,
66
+ help,
67
+ placeholder: "#####",
68
+ name: scope ? scope + ":" + "Zip" : "Zip",
69
+ maxlength: 5,
70
+ inputmode: "numeric",
71
+ autocomplete: "postal-code",
72
+ validation: "required|matches:/^[0-9]{5}$/",
73
+ validationMessages: {
74
+ required: "Zip Code is required",
75
+ matches: "Invalid Zip Code",
76
+ },
77
+ ...updates,
78
+ })
79
+ };
80
+
81
+ // TODO: vertical not supported yet
82
+ const comments = (scope, vertical, updates) =>
83
+ textArea(
84
+ merge(
85
+ {
86
+ name: scope ? scope + ":" + "Comments" : "Comments",
87
+ label: "Please briefly describe your situation in a few words:",
88
+ placeholder:
89
+ 'For Example: "I would like help with child support payments" or "I need help with visitation rights"',
90
+ },
91
+ updates
92
+ )
93
+ );
94
+
95
+ const NEXT_ON_ENTER = "$onEnter($setNextStep($fireStepEvent($get(form)), $preStepFunc($get(form))))";
96
+ const NEXT_ON_INPUT = "$onInput($setNextStep($fireStepEvent($get(form)), $preStepFunc($get(form))))";
97
+
98
+ const isInput = (n) => {
99
+ return n.type !== "group" && n.type !== "section" && n.type !== "form" && n.$formkit !== "hidden" && !n.children
100
+ };
101
+
102
+ const findLastInput = (n) => {
103
+ if (isInput(n)) {
104
+ return n
105
+ }
106
+ for (var i = n.children.length - 1; i >= 0; i--) {
107
+ if (typeof n.children === "string") {
108
+ continue
109
+ }
110
+ const child = n.children[i];
111
+ if (isInput(child)) {
112
+ return child
113
+ }
114
+ const res = findLastInput(child);
115
+ if (res) {
116
+ return res
117
+ }
118
+ }
119
+ return null
120
+ };
121
+
122
+ function verticalStepHeadline(updates) {
123
+ return {
124
+ $el: "h3",
125
+ children: updates.headline || "Tell Us About Your Situation",
126
+ attrs: {
127
+ class:
128
+ "t-flex t-justify-center t-text-center t-text-lg sm:t-text-xl t-font-bold t-text-dark t-pb-5 t-pt-0 t-px-1" +
129
+ " " +
130
+ (updates.headlineClass || ""),
131
+ },
132
+ }
133
+ }
134
+
135
+ const stepDefaults = (step, stepKey) => ({
136
+ $el: "section",
137
+ if: '$stepEnabled("' + step + '")',
138
+ attrs: {
139
+ hidden: '$activeStep !== "' + step + '"',
140
+ key: stepKey ? stepKey : step,
141
+ },
142
+ });
143
+
144
+ function step(name, inputs, updates = {}) {
145
+ const {
146
+ nextOnEnter = true,
147
+ nextOnInput = false,
148
+ stepKey = undefined,
149
+ nextStepMap = undefined,
150
+ triggerRedirectMap = undefined,
151
+ autoFocus = undefined,
152
+ } = updates;
153
+
154
+ if (inputs && inputs.length && (nextOnEnter || nextOnInput)) {
155
+ const lastInput = findLastInput(inputs[inputs.length - 1]);
156
+ if (lastInput && nextOnEnter === true) {
157
+ lastInput.onKeypress = NEXT_ON_ENTER;
158
+ }
159
+ if (lastInput && nextOnInput === true) {
160
+ lastInput.onInput = NEXT_ON_INPUT;
161
+ }
162
+ }
163
+
164
+ const mergeUpdates = {
165
+ children: [
166
+ {
167
+ $formkit: "group",
168
+ id: name,
169
+ name: name,
170
+ nextStepMap: nextStepMap,
171
+ triggerRedirectMap: triggerRedirectMap,
172
+ autoFocus: autoFocus,
173
+ children: inputs,
174
+ },
175
+ ],
176
+ };
177
+
178
+ if (typeof updates.if !== "undefined") {
179
+ mergeUpdates.if = updates.if;
180
+ }
181
+
182
+ return merge(stepDefaults(name, stepKey), mergeUpdates)
183
+ }
184
+
185
+ // Single question step
186
+ function sqstep(name, input, defaultHeadline, updates = {}) {
187
+ if (typeof updates.nextOnInput === "undefined") {
188
+ updates.nextOnInput = true;
189
+ }
190
+
191
+ return step(
192
+ name,
193
+ [
194
+ verticalStepHeadline({
195
+ headline: updates.headline ?? defaultHeadline,
196
+ headlineClass: updates.headlineClass,
197
+ }),
198
+ ...(Array.isArray(input) ? input : [input]),
199
+ ],
200
+ updates
201
+ )
202
+ }
203
+
204
+ function zipcode(updates = {}) {
205
+ return sqstep("zipcode", zipcode$1(updates.scope, true, updates.input), "Please verify your Zip Code", updates)
206
+ }
207
+
208
+ function handymanFirstStep(updates = {}) {
209
+ return step(
210
+ "handymanFirstStep",
211
+ [
212
+ comments(updates.scope, true, {
213
+ label: null,
214
+ placeholder: updates.placeholder || 'Examples: "I need two rooms painted" or "I need to replace a faucet", etc',
215
+ inputClass: typeof updates.inputClass === "undefined" ? "!t-h-32" : updates.inputClass,
216
+ innerClass: typeof updates.innerClass === "undefined" ? "t-max-w-xl" : updates.innerClass,
217
+ wrapperClass: typeof updates.wrapperClass === "undefined" ? undefined : updates.wrapperClass,
218
+ ...updates.input,
219
+ }),
220
+ ],
221
+ updates
222
+ )
223
+ }
224
+
225
+ const formNavigationNoFinalBack = (updates = {}) => ({
226
+ $el: "div",
227
+ attrs: {
228
+ class: {
229
+ if: "$activeStep === $firstStep()",
230
+ then: "step-nav " + (updates.firstStepButtonClass || "!t-justify-center sm:!t-justify-between"),
231
+ else: {
232
+ if: "$activeStep === $lastStep()",
233
+ then: "step-nav !t-justify-center ",
234
+ else: "step-nav !t-justify-between",
235
+ },
236
+ },
237
+ },
238
+ children: [
239
+ {
240
+ $formkit: "button",
241
+ name: "back_button",
242
+ onClick: "$setPreviousStep($prevStepFunc($get(form)))",
243
+ children: "Back",
244
+ outerClass: {
245
+ if: "$fns.eq($activeStep, $firstStep()) || $fns.eq($activeStep, $lastStep())",
246
+ then: "t-hidden sm:t-block",
247
+ else: "",
248
+ },
249
+ style: {
250
+ if: "$fns.eq($activeStep, $firstStep()) || $fns.eq($activeStep, $lastStep())",
251
+ then: "display: none;",
252
+ },
253
+ classes: {
254
+ input: (updates.inputClass || "") + " f-navigation-input",
255
+ },
256
+ },
257
+ {
258
+ $formkit: "button",
259
+ name: "next_button",
260
+ onClick: "$setNextStep($fireStepEvent($get(form)), $preStepFunc($get(form)))",
261
+ children: {
262
+ if: "$activeStep === $firstStep()",
263
+ then: updates.startText || "Start",
264
+ else: "Next",
265
+ },
266
+ outerClass: {
267
+ if: "$activeStep === $lastStep()",
268
+ then: "t-hidden",
269
+ else: "",
270
+ },
271
+ style: {
272
+ if: "$activeStep === $lastStep()",
273
+ then: "display: none;",
274
+ },
275
+ classes: {
276
+ input: (updates.inputClass || "") + " f-navigation-input",
277
+ },
278
+ },
279
+ {
280
+ $formkit: "submit",
281
+ name: "submit_button",
282
+ label: updates.submitLabel || "Submit",
283
+ if: "$activeStep === $lastStep()",
284
+ style: {
285
+ if: "$activeStep !== $lastStep()",
286
+ then: "display: none;",
287
+ },
288
+ classes: {
289
+ input: (updates.inputClass || "") + " f-navigation-input !t-w-60",
290
+ outer: "!t-mt-0 !t-mb-0",
291
+ },
292
+ },
293
+ ],
294
+ });
295
+
296
+ const formDetails = () => ({
297
+ $el: "pre",
298
+ if: '$urlParam("fdbg", "") == 1',
299
+ children: [
300
+ {
301
+ $el: "pre",
302
+ children: "$stringify( $get(form).value )",
303
+ attrs: {
304
+ class: "t-text-xs",
305
+ style: "overflow: scroll",
306
+ },
307
+ },
308
+ {
309
+ $el: "pre",
310
+ children: ["activeStep: ", "$activeStep"],
311
+ attrs: {
312
+ class: "t-text-xs",
313
+ style: "overflow: scroll",
314
+ },
315
+ },
316
+ {
317
+ $el: "pre",
318
+ children: ["stepHistory: ", "$stepHistory"],
319
+ attrs: {
320
+ class: "t-text-xs",
321
+ style: "overflow: scroll",
322
+ },
323
+ },
324
+ {
325
+ $el: "pre",
326
+ children: ["stepQueue: ", "$stepQueue"],
327
+ attrs: {
328
+ class: "t-text-xs",
329
+ style: "overflow: scroll",
330
+ },
331
+ },
332
+ {
333
+ $el: "pre",
334
+ children: ["steps: ", "$stepKeys()"],
335
+ attrs: {
336
+ class: "t-text-xs",
337
+ style: "overflow: scroll",
338
+ },
339
+ },
340
+ ],
341
+ });
342
+
343
+ const formPropDefaults = {
344
+ type: "form",
345
+ id: "form",
346
+ config: { validationVisibility: "submit" },
347
+ onSubmit: '$submit($submitUrl, $prepData, $handleRedirect, "text/plain; charset=UTF-8")',
348
+ plugins: "$plugins",
349
+ actions: false,
350
+ anchorElement: "form-anchor",
351
+ useLocalStorage: true,
352
+ prepop: {
353
+ fromURL: true,
354
+ },
355
+ errorCodes: {
356
+ 403: { message: "An Error Occurred", abort: false },
357
+ 409: { abort: false },
358
+ 429: "An Error Occurred",
359
+ 504: { message: "An Error Occurred", abort: false },
360
+ },
361
+ formClass: "!t-max-w-[40rem]",
362
+ };
363
+
364
+ // export function filteredNextStepsMapLegal(keyList) {
365
+ // const res = { Type_Of_Legal_Problem: filterMapByKey(nextStepsMapGeneralLegal["Type_Of_Legal_Problem"], keyList) }
366
+ // res["*"] = nextStepsMapGeneralLegal["*"]
367
+ // return res
368
+ // }
369
+
370
+ function formProps(updates) {
371
+ const props = merge(formPropDefaults, updates);
372
+ if (props.formId && !props.name) {
373
+ props.name = props.formId;
374
+ }
375
+ return props
376
+ }
377
+
378
+ const formAnchorDefaults = {
379
+ $el: "div",
380
+ children: [
381
+ {
382
+ $el: "div",
383
+ attrs: {
384
+ id: "form-anchor",
385
+ class: "t-absolute",
386
+ style: { top: "-30px", left: 0 },
387
+ },
388
+ },
389
+ ],
390
+ attrs: {
391
+ class: "t-relative",
392
+ },
393
+ };
394
+
395
+ function formAnchor(updates) {
396
+ return merge(formAnchorDefaults, updates)
397
+ }
398
+
399
+ function headlineDefaults(updates = {}) {
400
+ return {
401
+ $el: "h1",
402
+ attrs: {
403
+ class:
404
+ "t-flex t-justify-center t-text-center t-text-[1.7rem] sm:t-text-[2rem] t-font-semibold t-pt-5 t-px-7 md:t-px-3" +
405
+ " " +
406
+ (updates.headlineClass || "") +
407
+ " f-first-headline",
408
+ },
409
+ }
410
+ }
411
+
412
+ function headline(updates = {}) {
413
+ return merge(headlineDefaults(updates), updates)
414
+ }
415
+
416
+ const nextStepsLegalDefault = [
417
+ "haveAttorney",
418
+ "degreeOfInterest",
419
+ "commentsWithBankruptcy",
420
+ "zipcode",
421
+ "legalCrossSells",
422
+ "firstAndLast",
423
+ "contactInfo",
424
+ ];
425
+
426
+ const nextStepsLegalDefaultLPM = [
427
+ "haveAttorney",
428
+ "degreeOfInterest",
429
+ "lawyerPaymentMethod",
430
+ "commentsWithBankruptcy",
431
+ "zipcode",
432
+ "legalCrossSells",
433
+ "firstAndLast",
434
+ "contactInfo",
435
+ ];
436
+
437
+ const nextStepsLegalNoDOI = [
438
+ "haveAttorney",
439
+ "commentsWithBankruptcy",
440
+ "zipcode",
441
+ "legalCrossSells",
442
+ "firstAndLast",
443
+ "contactInfo",
444
+ ];
445
+
446
+ const nextStepsLegalNoHA = [
447
+ "degreeOfInterest",
448
+ "commentsWithBankruptcy",
449
+ "zipcode",
450
+ "legalCrossSells",
451
+ "firstAndLast",
452
+ "contactInfo",
453
+ ];
454
+
455
+ const nextStepsMapGeneralLegal = {
456
+ values: {
457
+ Type_Of_Legal_Problem: {
458
+ Adoption: ["maritalStatus", "haveChildren", ...nextStepsLegalDefaultLPM],
459
+ "Asbestos and Mesothelioma": ["incidentDate", "doctorTreatment", ...nextStepsLegalDefault],
460
+ "Auto and Car Accidents": [
461
+ "incidentDate",
462
+ "atFault",
463
+ "primaryInjury",
464
+ "doctorTreatment",
465
+ "policeReportFiled",
466
+ ...nextStepsLegalNoDOI,
467
+ ],
468
+ Bankruptcy: ["totalMonthlyIncome", "totalDebt", "ownRealEstate", "valueOfAssets", ...nextStepsLegalDefault],
469
+ "Business Lawyers": ["businessServices", "businessType", "numEmployeesOfBusiness", ...nextStepsLegalDefault],
470
+ "Child Custody": ["childRelationship", "childHome", "childPrimaryCaregiver", ...nextStepsLegalDefaultLPM],
471
+ "Child Support": ["childRelationship", "childHome", "childPrimaryCaregiver", ...nextStepsLegalDefaultLPM],
472
+ "Civil Rights and Discrimination": ["civilRightsType", ...nextStepsLegalDefault],
473
+ "Civil Lawsuit": ["civilDefense", "lawsuitOtherParty", ...nextStepsLegalDefault],
474
+ "File a Lawsuit": ["civilLawsuitTOLPDisplay", "lawsuitOtherParty", ...nextStepsLegalDefault],
475
+ "Defend a Lawsuit": ["lawsuitOtherParty", ...nextStepsLegalDefault],
476
+ "Consumer Lawyers": ["consumerLawyerType", "incidentDate", "lawsuitOtherParty", ...nextStepsLegalDefault],
477
+ "Criminal and Felony": [
478
+ "criminalTOLPDisplay",
479
+ "crimeCommittedDate",
480
+ "roleInMatterCriminal",
481
+ "pendingCharges",
482
+ ...nextStepsLegalDefaultLPM,
483
+ ],
484
+ "Debt and Collections": [
485
+ "totalMonthlyIncome",
486
+ "totalDebt",
487
+ "ownRealEstate",
488
+ "valueOfAssets",
489
+ ...nextStepsLegalDefault,
490
+ ],
491
+ "Divorce and Separation": ["maritalStatus", "haveChildren", ...nextStepsLegalDefaultLPM],
492
+ "DUI and DWI": [
493
+ "incidentDate",
494
+ "priorAlcoholOffenses",
495
+ "typeOfAlcoholTest",
496
+ "bloodContentAlcoholTest",
497
+ "pendingCharges",
498
+ ...nextStepsLegalDefault,
499
+ ],
500
+ "Employment and Workplace": [
501
+ "employmentAndWorkplaceTOLPDisplay",
502
+ "numEmployeesOfBusiness",
503
+ "employerType",
504
+ "employeeAtCompany",
505
+ ...nextStepsLegalDefault,
506
+ ],
507
+ Expungement: ["incidentDate", "criminalChargeType", ...nextStepsLegalDefaultLPM],
508
+ "Family Issues": ["maritalStatus", "haveChildren", ...nextStepsLegalDefaultLPM],
509
+ Foreclosure: [
510
+ "ownRealEstate",
511
+ "typeOfProperty",
512
+ "amountPaymentsPastDue",
513
+ "loanAmount",
514
+ "defaultNotice",
515
+ ...nextStepsLegalDefault,
516
+ ],
517
+ Guardianship: ["maritalStatus", "haveChildren", ...nextStepsLegalDefaultLPM],
518
+ "Immigration and Visas": [
519
+ "countryOfCitizenship",
520
+ "immigrationLocation",
521
+ "immigrationEntry",
522
+ "immigrationType",
523
+ "immigrationStatus",
524
+ "immigrationDetails",
525
+ ...nextStepsLegalDefault,
526
+ ],
527
+ "Landlord and Tenant": ["landlordTenantIssue", "landlordTenantParty", ...nextStepsLegalDefault],
528
+ "Lemon Law": ["incidentDate", "lawsuitOtherParty", ...nextStepsLegalDefault],
529
+ "Long Term Disability": [
530
+ "applicantOccupation",
531
+ "applicantAge",
532
+ "applicantLTDisabilityPolicy",
533
+ "applicantDisabilityHowObtain",
534
+ "applicantPreviouslyAppliedLtdBenefits",
535
+ "applicantReceivedDisabilityBenefits",
536
+ "applicantMonthlySalary",
537
+ ...nextStepsLegalNoDOI,
538
+ ],
539
+ "Medical Malpractice": [
540
+ "incidentDate",
541
+ "claimStatus",
542
+ "doctorTreatment",
543
+ "medicalMalpracticeInjuries",
544
+ ...nextStepsLegalDefault,
545
+ ],
546
+ "Patents and Intellectual Property": ["patentAssistanceType", "patentFor", ...nextStepsLegalDefault],
547
+ "Personal Injury": [
548
+ "incidentDate",
549
+ "claimStatus",
550
+ "atFault",
551
+ "primaryInjury",
552
+ "doctorTreatment",
553
+ ...nextStepsLegalNoDOI,
554
+ ],
555
+ "Probate and Estates": [
556
+ "valueOfAssets",
557
+ "typeOfAssets",
558
+ "roleInMatterProbate",
559
+ "estateLegalServicesNeeded",
560
+ ...nextStepsLegalDefault,
561
+ ],
562
+ "Property Damage": ["wouldLikeLawyerTo", ...nextStepsLegalDefault],
563
+ "Real Estate": ["realEstateTOLPDisplay", "realEstateArea", "wouldLikeLawyerTo", ...nextStepsLegalDefault],
564
+ "Social Security Disability and Insurance": [
565
+ "applicantAge",
566
+ "disabilityConditionStopWork",
567
+ "disabilityWorkHistory",
568
+ "socialSecurityDisabilityReceivingBenefits",
569
+ "doctorTreatment",
570
+ ...nextStepsLegalNoDOI,
571
+ ],
572
+ "Tax and IRS": ["totalDebt", "taxProblemDetails", "taxLevel", "taxIssueType", ...nextStepsLegalDefault],
573
+ "Traffic and Tickets": ["driversLicenseType", "trafficViolations", "haveCourtDate", ...nextStepsLegalDefault],
574
+ Unemployment: ["numEmployeesOfBusiness", "employerType", ...nextStepsLegalNoHA],
575
+ "Victim of a Crime": [
576
+ "crimeCommittedDate",
577
+ "roleInMatterCriminal",
578
+ "pendingCharges",
579
+ ...nextStepsLegalDefaultLPM,
580
+ ],
581
+ "Wills and Trusts": [
582
+ "valueOfAssets",
583
+ "typeOfAssets",
584
+ "roleInMatterProbate",
585
+ "estateLegalServicesNeeded",
586
+ ...nextStepsLegalDefault,
587
+ ],
588
+ "Workers Compensation": [
589
+ "incidentDate",
590
+ "claimStatus",
591
+ "primaryInjury",
592
+ "causeOfInjury",
593
+ "doctorTreatment",
594
+ ...nextStepsLegalNoDOI,
595
+ ],
596
+ "Workplace Harassment": ["numEmployeesOfBusiness", "employerType", "employeeAtCompany", ...nextStepsLegalDefault],
597
+ "Workplace Discrimination": [
598
+ "numEmployeesOfBusiness",
599
+ "employerType",
600
+ "employeeAtCompany",
601
+ ...nextStepsLegalDefault,
602
+ ],
603
+ "Wrongful Death": [
604
+ "incidentDate",
605
+ "relationshipToVictim",
606
+ "criminalChargesFiled",
607
+ "causeOfDeath",
608
+ ...nextStepsLegalNoDOI,
609
+ ],
610
+ "Wrongful Termination": ["numEmployeesOfBusiness", "employerType", ...nextStepsLegalDefault],
611
+ },
612
+ "*": nextStepsLegalDefault,
613
+ },
614
+ };
615
+
616
+ // Helper to take existing map and trim or replace steps
617
+ function filterNextStepsMap(nextStepsMap, removableSteps = [], replaceSteps = {}) {
618
+ const modifiedMap = { ...nextStepsMap };
619
+
620
+ function filterSteps(steps) {
621
+ return steps.filter((step) => !removableSteps.includes(step)).map((step) => replaceSteps[step] || step)
622
+ }
623
+
624
+ function modifyValues(values) {
625
+ const modifiedValues = {};
626
+ for (const key in values) {
627
+ if (Array.isArray(values[key])) {
628
+ modifiedValues[key] = filterSteps(values[key]);
629
+ } else if (typeof values[key] === "object") {
630
+ modifiedValues[key] = modifyValues(values[key]);
631
+ } else {
632
+ modifiedValues[key] = values[key];
633
+ }
634
+ }
635
+ return modifiedValues
636
+ }
637
+
638
+ modifiedMap.values = modifyValues(nextStepsMap.values);
639
+ return modifiedMap
640
+ }
641
+
642
+ filterNextStepsMap(nextStepsMapGeneralLegal, ["legalCrossSells"], {
643
+ commentsWithBankruptcy: "comments",
644
+ });
645
+
646
+ const TOLPNextSteps = nextStepsMapGeneralLegal["values"]["Type_Of_Legal_Problem"];
647
+
648
+ ({
649
+ values: {
650
+ Type_Of_Legal_Problem_Display: {
651
+ "Auto Accident": TOLPNextSteps["Auto and Car Accidents"].filter((step) => step !== "legalCrossSells"),
652
+ "Workplace Injury": TOLPNextSteps["Workers Compensation"].filter((step) => step !== "legalCrossSells"),
653
+ "Dog Bite": TOLPNextSteps["Personal Injury"].filter((step) => step !== "legalCrossSells"),
654
+ "Slip and Fall": TOLPNextSteps["Personal Injury"].filter((step) => step !== "legalCrossSells"),
655
+ "Trucking Accident": TOLPNextSteps["Auto and Car Accidents"].filter((step) => step !== "legalCrossSells"),
656
+ "Motorcycle Accident": TOLPNextSteps["Auto and Car Accidents"].filter((step) => step !== "legalCrossSells"),
657
+ "Other Accidents or Injuries": TOLPNextSteps["Personal Injury"].filter((step) => step !== "legalCrossSells"),
658
+ },
659
+ "*": TOLPNextSteps["Personal Injury"].filter((step) => step !== "legalCrossSells"),
660
+ },
661
+ });
662
+
663
+ ({
664
+ values: {
665
+ Type_Of_Legal_Problem: {
666
+ "Child Custody": TOLPNextSteps["Child Custody"],
667
+ "Child Support": TOLPNextSteps["Child Support"],
668
+ "Not Sure or Other": nextStepsMapGeneralLegal["values"]["*"],
669
+ },
670
+ "*": TOLPNextSteps["Family Issues"],
671
+ },
672
+ });
673
+
674
+ ({
675
+ values: {
676
+ Type_Of_Legal_Problem_Display: {
677
+ "Alimony or Child Support": TOLPNextSteps["Child Support"],
678
+ "Child Custody": TOLPNextSteps["Child Custody"],
679
+ "Not Sure or Other": nextStepsMapGeneralLegal["values"]["*"],
680
+ },
681
+ "*": TOLPNextSteps["Divorce and Separation"],
682
+ },
683
+ });
684
+
685
+ ({
686
+ values: {
687
+ Civil_Defense: {
688
+ Yes: TOLPNextSteps["Defend a Lawsuit"],
689
+ No: TOLPNextSteps["File a Lawsuit"],
690
+ },
691
+ "*": ["lawsuitOtherParty", ...nextStepsLegalDefault],
692
+ },
693
+ });
694
+
695
+ const nextStepsMapCivilTolp = {
696
+ values: {
697
+ Type_Of_Legal_Problem: {
698
+ "Defend a Lawsuit": TOLPNextSteps["Defend a Lawsuit"],
699
+ "File a Lawsuit": TOLPNextSteps["File a Lawsuit"],
700
+ },
701
+ "*": ["lawsuitOtherParty", ...nextStepsLegalDefault],
702
+ },
703
+ };
704
+
705
+ filterNextStepsMap(nextStepsMapCivilTolp, ["legalCrossSells"], {
706
+ commentsWithBankruptcy: "comments",
707
+ });
708
+
709
+ const nextStepsMapCivilTOLPDisplay = {
710
+ values: {
711
+ Type_Of_Legal_Problem_Display: {
712
+ "Automobile Accident": TOLPNextSteps["Auto and Car Accidents"],
713
+ "Contract Disputes": TOLPNextSteps["Business Lawyers"],
714
+ "Dog Bite": TOLPNextSteps["Personal Injury"],
715
+ "Employment and Workplace": TOLPNextSteps["Employment and Workplace"],
716
+ Fraud: TOLPNextSteps["Consumer Lawyers"],
717
+ "Medical Malpractice": TOLPNextSteps["Medical Malpractice"],
718
+ "Personal Injury": TOLPNextSteps["Personal Injury"],
719
+ "Property Damage": TOLPNextSteps["Property Damage"],
720
+ "Real Estate": TOLPNextSteps["Real Estate"],
721
+ "Not Sure or Other": nextStepsMapGeneralLegal["values"]["*"],
722
+ },
723
+ "*": ["lawsuitOtherParty", ...nextStepsLegalDefault],
724
+ },
725
+ };
726
+
727
+ filterNextStepsMap(nextStepsMapCivilTOLPDisplay, ["legalCrossSells"], {
728
+ commentsWithBankruptcy: "comments",
729
+ });
730
+
731
+ const nextStepsMapCriminalTOLPDisplay = {
732
+ values: {
733
+ Type_Of_Legal_Problem_Display: {
734
+ "Victim of a Crime": TOLPNextSteps["Victim of a Crime"],
735
+ "DUI and DWI": TOLPNextSteps["DUI and DWI"],
736
+ Expungement: TOLPNextSteps["Expungement"],
737
+ "Not Sure or Other": nextStepsMapGeneralLegal["values"]["*"],
738
+ },
739
+ "*": ["crimeCommittedDate", "roleInMatterCriminal", "pendingCharges", ...nextStepsLegalDefaultLPM],
740
+ },
741
+ };
742
+
743
+ filterNextStepsMap(
744
+ nextStepsMapCriminalTOLPDisplay,
745
+ ["legalCrossSells"],
746
+ {
747
+ commentsWithBankruptcy: "comments",
748
+ }
749
+ );
750
+
751
+ const nextStepsMapEmploymentAndWorkplaceTOLPDisplay = {
752
+ values: {
753
+ Type_Of_Legal_Problem_Display: {
754
+ "Wrongful Termination": TOLPNextSteps["Wrongful Termination"],
755
+ "Workers Compensation": TOLPNextSteps["Workers Compensation"],
756
+ "Personal Injury": TOLPNextSteps["Personal Injury"],
757
+ Unemployment: TOLPNextSteps["Unemployment"],
758
+ },
759
+ "*": ["numEmployeesOfBusiness", "employerType", "employeeAtCompany", ...nextStepsLegalDefault],
760
+ },
761
+ };
762
+
763
+ filterNextStepsMap(
764
+ nextStepsMapEmploymentAndWorkplaceTOLPDisplay,
765
+ ["legalCrossSells"],
766
+ {
767
+ commentsWithBankruptcy: "comments",
768
+ }
769
+ );
770
+
771
+ ({
772
+ values: {
773
+ // Custom because we ask typeOfProperty on s1
774
+ "*": ["amountPaymentsPastDue", "loanAmount", "defaultNotice", "ownRealEstate", ...nextStepsLegalDefault],
775
+ },
776
+ });
777
+
778
+ ({
779
+ values: {
780
+ Type_Of_Legal_Problem: {
781
+ "Workplace Harassment": TOLPNextSteps["Workplace Harassment"],
782
+ "Workplace Discrimination": TOLPNextSteps["Workplace Discrimination"],
783
+ },
784
+ "*": [...nextStepsLegalDefault],
785
+ },
786
+ });
787
+
788
+ ({
789
+ values: {
790
+ Type_Of_Legal_Problem: {
791
+ "Probate and Estates": TOLPNextSteps["Probate and Estates"],
792
+ "Wills and Trusts": TOLPNextSteps["Wills and Trusts"],
793
+ "Wrongful Death": TOLPNextSteps["Wrongful Death"],
794
+ },
795
+ "*": [...nextStepsLegalDefault],
796
+ },
797
+ });
798
+
799
+ ({
800
+ values: {
801
+ Type_Of_Legal_Problem_Display: {
802
+ Patents: TOLPNextSteps["Patents and Intellectual Property"],
803
+ "Business Lawyers": TOLPNextSteps["Business Lawyers"],
804
+ "Business Consulting": TOLPNextSteps["Business Lawyers"],
805
+ },
806
+ "*": nextStepsMapGeneralLegal["values"]["*"],
807
+ },
808
+ });
809
+
810
+ const nextStepsMapRealEstateTOLPDisplay = {
811
+ values: {
812
+ Type_Of_Legal_Problem_Display: {
813
+ Foreclosure: TOLPNextSteps["Foreclosure"],
814
+ "Landlord and Tenant": TOLPNextSteps["Landlord and Tenant"],
815
+ "Wills, Trusts, and Estates": TOLPNextSteps["Wills and Trusts"],
816
+ "Property Damage": TOLPNextSteps["Property Damage"],
817
+ },
818
+ "*": ["realEstateArea", "wouldLikeLawyerTo", ...nextStepsLegalDefault],
819
+ },
820
+ };
821
+
822
+ filterNextStepsMap(
823
+ nextStepsMapRealEstateTOLPDisplay,
824
+ ["legalCrossSells"],
825
+ {
826
+ commentsWithBankruptcy: "comments",
827
+ }
828
+ );
829
+
830
+ const schema = [
831
+ formAnchor({
832
+ children: [
833
+ {
834
+ $el: "div",
835
+ attrs: {
836
+ id: "form-anchor",
837
+ class: "t-absolute",
838
+ // HACK: account for sticky header on theme
839
+ style: { top: "-80px", left: 0 },
840
+ },
841
+ },
842
+ ],
843
+ }),
844
+ {
845
+ $cmp: "FormKit",
846
+ props: formProps({
847
+ formId: "handymanCall",
848
+ onSubmit: "$hideFormShowOther($prepData)",
849
+ }),
850
+ children: [
851
+ headline({
852
+ children: '$urlParam("hl", "Describe Your Project:")',
853
+ if: "$activeStep === $firstStep()",
854
+ headlineClass: "!t-text-xl sm:!t-text-2xl",
855
+ }),
856
+ {
857
+ $el: "div",
858
+ attrs: {
859
+ class: "form-body",
860
+ },
861
+ children: [
862
+ handymanFirstStep({
863
+ headlineClass: "t-text-lg",
864
+ input: {
865
+ help: null,
866
+ },
867
+ }),
868
+ zipcode({
869
+ nextOnInput: false,
870
+ nextOnEnter: false,
871
+ headlineClass: "!t-mt-5 !t-text-xl sm:!t-text-2xl",
872
+ headline: "Please Verify Your Zip Code:",
873
+ input: {
874
+ outerClass: "!t-mt-6 !t-mb-10",
875
+ help: "We'll match you to the nearest pro.",
876
+ },
877
+ }),
878
+ formNavigationNoFinalBack({
879
+ startText: "Get Quotes Now",
880
+ submitLabel: "Get Free Quote",
881
+ inputClass: "!t-text-black !t-font-extrabold !t-bg-[#ffce51]",
882
+ firstStepButtonClass: "!t-justify-center",
883
+ }),
884
+ formDetails(),
885
+ ],
886
+ },
887
+ ],
888
+ },
889
+ ];
890
+
891
+ export { schema as default };