bhl-forms 0.0.14 → 0.0.17

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.
@@ -2,6 +2,58 @@ function merge() {
2
2
  return Object.assign({}, ...arguments)
3
3
  }
4
4
 
5
+ const formPropDefaults = {
6
+ type: 'form',
7
+ id: 'form',
8
+ onSubmit: '$submit("https://httpbin.org/post", $prepData, $getRedirect)',
9
+ plugins: '$plugins',
10
+ actions: false,
11
+ prepop: {
12
+ fromURL: true
13
+ },
14
+ errorCodes: {
15
+ 403: "An Error Occurred",
16
+ 409: { abort: false },
17
+ 429: "An Error Occurred"
18
+ },
19
+ formClass: '!t-max-w-xl'
20
+ };
21
+
22
+ function formProps(updates) {
23
+ return merge(
24
+ formPropDefaults,
25
+ updates
26
+ )
27
+ }
28
+
29
+ const hiddenInputs = [
30
+ {
31
+ $formkit: 'hidden',
32
+ name: "vertical",
33
+ value: "Legal"
34
+ },
35
+ {
36
+ $formkit: 'hidden',
37
+ name: "TCPA_Language",
38
+ value: "$meta.tcpaLanguage"
39
+ },
40
+ {
41
+ $formkit: 'hidden',
42
+ name: "gclid",
43
+ value: null,
44
+ },
45
+ {
46
+ $formkit: 'hidden',
47
+ name: "campaignid",
48
+ value: null,
49
+ },
50
+ {
51
+ $formkit: 'hidden',
52
+ name: "s",
53
+ value: null,
54
+ }
55
+ ];
56
+
5
57
  // ------ Common Base Settings
6
58
 
7
59
  const radio = (updates) => {
@@ -11,26 +63,26 @@ const radio = (updates) => {
11
63
  validationMessages: {
12
64
  required: 'Field is required',
13
65
  },
14
- optionsClass: 'pt-3 pl-1',
66
+ optionsClass: 't-pt-3 t-pl-1',
15
67
  legendClass: 'required'
16
68
  }, updates)
17
69
  };
18
70
 
19
- const sbsRadio = (updates) => {
71
+ const sbs2ColRadio = (updates) => {
20
72
  updates.legendClass = 'legend-left required';
21
73
  updates.fieldsetClass = '$reset side-by-side';
22
- updates.optionsClass = 'pl-1';
23
- updates.innerClass = 'flex items-center';
24
- updates.wrapperClass = 'mb-3';
74
+ updates.optionsClass = 't-grid t-grid-cols-1 md:t-grid-cols-2';
75
+ updates.innerClass = 't-flex t-items-start';
76
+ updates.wrapperClass = '$reset t-flex t-cursor-pointer t-mb-3';
25
77
  return radio(updates)
26
78
  };
27
79
 
28
80
  const sbsYesNoRadio = (updates) => {
29
81
  updates.options = ['Yes', 'No'];
30
82
  updates.legendClass = 'legend-left required';
31
- updates.fieldsetClass = '$reset side-by-side items-center';
32
- updates.optionsClass = 'pl-1 side-by-side items-center';
33
- updates.innerClass = 'flex items-center';
83
+ updates.fieldsetClass = '$reset side-by-side t-items-center';
84
+ updates.optionsClass = 't-pl-1 side-by-side t-items-center';
85
+ updates.innerClass = 't-flex t-items-center';
34
86
  return radio(updates)
35
87
  };
36
88
 
@@ -42,14 +94,14 @@ const select = (updates) => {
42
94
  validationMessages: {
43
95
  required: 'Field is required',
44
96
  },
45
- inputClass: 'bg-white',
97
+ inputClass: 't-bg-white',
46
98
  labelClass: 'required'
47
99
  }, updates)
48
100
  };
49
101
 
50
102
  const sbsSelect = (updates) => {
51
103
  updates.labelClass = 'required';
52
- updates.wrapperClass = 'side-by-side items-center';
104
+ updates.wrapperClass = 'side-by-side t-items-center';
53
105
  updates.innerClass = 'select-height-content';
54
106
  return select(updates)
55
107
  };
@@ -67,20 +119,20 @@ const text = (updates) => {
67
119
 
68
120
  const sbsText = (updates) => {
69
121
  updates.labelClass = 'required';
70
- updates.wrapperClass = 'side-by-side items-center';
122
+ updates.wrapperClass = 'side-by-side t-items-center';
71
123
  return text(updates)
72
124
  };
73
125
 
74
- const childAndFamilyTOLP = () => sbsRadio({
126
+ const childAndFamilyTOLP = () => sbs2ColRadio({
75
127
  label: 'Type of Help Needed:',
76
128
  name: 'Type_Of_Legal_Problem',
77
129
  id: 'Type_Of_Legal_Problem',
78
130
  options: [
79
131
  'Adoption',
80
132
  'Child Custody and Support',
81
- // 'Family Issues',
82
- // 'Guardianship',
83
- // 'Divorce and Separation',
133
+ 'Family Issues',
134
+ 'Guardianship',
135
+ 'Divorce and Separation',
84
136
  'Not Sure or Other'
85
137
  ]
86
138
  });
@@ -218,6 +270,7 @@ const phone = () => sbsText({
218
270
  name: 'Primary_Phone',
219
271
  label: 'Phone Number:',
220
272
  placeholder: 'xxx-xxx-xxxx',
273
+ maxlength: 12,
221
274
  // help: '10-digit US phone number, hyphens optional.',
222
275
  validation: 'required|matches:/^[0-9]{3}-?[0-9]{3}-?[0-9]{4}$/',
223
276
  validationMessages: {
@@ -236,7 +289,7 @@ const TCPAConsent = () => ({
236
289
  accepted: 'Consent is required',
237
290
  },
238
291
  classes: {
239
- label: "text-xs text-slate-500 font-normal"
292
+ label: "t-text-xs t-text-slate-500 t-font-normal"
240
293
  }
241
294
  });
242
295
 
@@ -244,6 +297,7 @@ const zipcode = () => sbsText({
244
297
  label: 'Zip Code:',
245
298
  placeholder: '90210',
246
299
  name: 'Zip',
300
+ maxlength: 5,
247
301
  validation: 'required|matches:/^[0-9]{5}$/',
248
302
  validationMessages: {
249
303
  required: 'Zip Code is required',
@@ -296,6 +350,48 @@ const ChildCustodyAndSupportQuestions = () => group(
296
350
  }
297
351
  );
298
352
 
353
+ const FamilyIssuesQuestions = () => group(
354
+ 'FamilyIssuesQuestions',
355
+ {
356
+ if: '$get(Type_Of_Legal_Problem).value == "Family Issues"',
357
+ children: [
358
+ haveAttorney(),
359
+ maritalStatus(),
360
+ haveChildren(),
361
+ degreeOfInterest(),
362
+ lawyerPaymentMethod()
363
+ ]
364
+ }
365
+ );
366
+
367
+ const GuardianshipQuestions = () => group(
368
+ 'GuardianshipQuestions',
369
+ {
370
+ if: '$get(Type_Of_Legal_Problem).value == "Guardianship"',
371
+ children: [
372
+ haveAttorney(),
373
+ maritalStatus(),
374
+ haveChildren(),
375
+ degreeOfInterest(),
376
+ lawyerPaymentMethod()
377
+ ]
378
+ }
379
+ );
380
+
381
+ const DivorceQuestions = () => group(
382
+ 'DivorceQuestions',
383
+ {
384
+ if: '$get(Type_Of_Legal_Problem).value == "Divorce and Separation"',
385
+ children: [
386
+ haveAttorney(),
387
+ maritalStatus(),
388
+ haveChildren(),
389
+ degreeOfInterest(),
390
+ lawyerPaymentMethod()
391
+ ]
392
+ }
393
+ );
394
+
299
395
  const NotSureOrOtherQuestions = () => group(
300
396
  'NotSureOrOtherQuestions',
301
397
  {
@@ -366,7 +462,7 @@ function contactInfo() {
366
462
  $el: 'h3',
367
463
  children: 'Based on your input, you may benefit from speaking with a family lawyer. Please verify your contact information:',
368
464
  attrs: {
369
- class: 'flex justify-center text-center text-lg font-bold pb-5 pt-0 px-3'
465
+ class: 't-flex t-justify-center t-text-center t-text-lg t-font-bold t-pb-5 t-pt-0 t-px-3'
370
466
  }
371
467
  },
372
468
  email(),
@@ -376,7 +472,7 @@ function contactInfo() {
376
472
  $el: 'div',
377
473
  if: '$activeStep === $lastStep()',
378
474
  attrs: {
379
- class: 'flex justify-center'
475
+ class: 't-flex t-justify-center'
380
476
  },
381
477
  children: [
382
478
  {
@@ -416,11 +512,14 @@ function TOLPQuestions() {
416
512
  $el: 'h3',
417
513
  children: 'Please Complete the Following:',
418
514
  attrs: {
419
- class: 'flex justify-center text-center text-2xl font-bold text-blue-500 pb-5 pt-0 px-3'
515
+ class: '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-3'
420
516
  }
421
517
  },
422
518
  AdoptionQuestions(),
423
519
  ChildCustodyAndSupportQuestions(),
520
+ FamilyIssuesQuestions(),
521
+ GuardianshipQuestions(),
522
+ DivorceQuestions(),
424
523
  NotSureOrOtherQuestions()
425
524
  ],
426
525
  ...arguments
@@ -446,7 +545,7 @@ const formNavigation = () => ({
446
545
  },
447
546
  {
448
547
  $formkit: 'button',
449
- onClick: '$setNextStep()',
548
+ onClick: '$setNextStep($fireStepEvent($get(form)))',
450
549
  children: 'Next',
451
550
  style: {
452
551
  if: '$activeStep === $lastStep()',
@@ -473,7 +572,7 @@ const formDetails = () => ({
473
572
  $el: 'pre',
474
573
  children: '$stringify( $get(form).value )',
475
574
  attrs: {
476
- class: 'text-xs',
575
+ class: 't-text-xs',
477
576
  style: 'overflow: scroll'
478
577
  }
479
578
  },
@@ -481,7 +580,7 @@ const formDetails = () => ({
481
580
  $el: 'pre',
482
581
  children: ['activeStep: ', '$activeStep'],
483
582
  attrs: {
484
- class: 'text-xs',
583
+ class: 't-text-xs',
485
584
  style: 'overflow: scroll'
486
585
  }
487
586
  },
@@ -489,7 +588,7 @@ const formDetails = () => ({
489
588
  $el: 'pre',
490
589
  children: ['stepHistory: ', '$stepHistory'],
491
590
  attrs: {
492
- class: 'text-xs',
591
+ class: 't-text-xs',
493
592
  style: 'overflow: scroll'
494
593
  }
495
594
  },
@@ -497,7 +596,7 @@ const formDetails = () => ({
497
596
  $el: 'pre',
498
597
  children: ['stepQueue: ', '$stepQueue'],
499
598
  attrs: {
500
- class: 'text-xs',
599
+ class: 't-text-xs',
501
600
  style: 'overflow: scroll'
502
601
  }
503
602
  }
@@ -513,33 +612,25 @@ const schema = [
513
612
  },
514
613
  {
515
614
  $cmp: 'FormKit',
516
- props: {
517
- type: 'form',
518
- id: 'form',
615
+ props: formProps({
616
+ formId: 'childAndFamily',
519
617
  onSubmit: '$submit("https://httpbin.org/post", $prepData, $getRedirect)',
520
618
  // onSubmit: '$submit("http://localhost:8080/api/v1/form_leads_ext", $prepData, $getRedirect)',
521
- plugins: '$plugins',
522
- actions: false,
523
- prepop: {
524
- fromURL: true
525
- },
526
- errorCodes: {
527
- 403: "An Error Occurred",
528
- 409: { abort: false },
529
- 429: "An Error Occurred"
530
- },
531
619
  redirectMap: {
620
+ 'Adoption': 'https://justanswer.9pctbx.net/c/2880795/565949/9320?sharedid=${properties.vid}',
621
+ 'Child Custody and Support': 'https://justanswer.9pctbx.net/c/2880795/565949/9320?sharedid=${properties.vid}',
622
+ 'Divorce and Separation': 'https://justanswer.9pctbx.net/c/2880795/966410/9320?sharedid=${properties.vid}',
623
+ 'Guardianship': 'https://justanswer.9pctbx.net/c/2880795/565949/9320?sharedid=${properties.vid}',
532
624
  '*': 'https://justanswer.9pctbx.net/c/2880795/808601/9320?sharedid=${properties.vid}'
533
625
  },
534
- formClass: '!max-w-xl'
535
- },
626
+ }),
536
627
  children: [
537
628
  {
538
629
  $el: 'h1',
539
630
  if: '$activeStep === $firstStep()',
540
631
  children: 'Get Child & Family Help Today',
541
632
  attrs: {
542
- class: 'flex justify-center text-center text-3xl font-bold pt-5 px-3'
633
+ class: 't-flex t-justify-center t-text-center t-text-3xl t-font-bold t-pt-5 t-px-3'
543
634
  }
544
635
  },
545
636
  {
@@ -547,34 +638,10 @@ const schema = [
547
638
  if: '$activeStep === $firstStep()',
548
639
  children: 'Contact Us Now for Child Support, Custody and Family Issues',
549
640
  attrs: {
550
- class: 'flex justify-center text-center text-md font-medium text-blue-500 px-3'
641
+ class: 't-flex t-justify-center t-text-center t-text-md t-font-medium t-text-blue-500 t-px-3'
551
642
  }
552
643
  },
553
- {
554
- $formkit: 'hidden',
555
- name: "vertical",
556
- value: "Legal"
557
- },
558
- {
559
- $formkit: 'hidden',
560
- name: "TCPA_Language",
561
- value: "$meta.tcpaLanguage"
562
- },
563
- {
564
- $formkit: 'hidden',
565
- name: "gclid",
566
- value: null,
567
- },
568
- {
569
- $formkit: 'hidden',
570
- name: "campaignid",
571
- value: null,
572
- },
573
- {
574
- $formkit: 'hidden',
575
- name: "s",
576
- value: null,
577
- },
644
+ ...hiddenInputs,
578
645
  {
579
646
  $el: 'div',
580
647
  attrs: {