bhl-forms 0.0.13 → 0.0.16

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: {
@@ -232,10 +285,11 @@ const TCPAConsent = () => ({
232
285
  name: 'TCPA_Opt_In',
233
286
  validation: 'required|accepted',
234
287
  validationMessages: {
288
+ required: 'Consent is required',
235
289
  accepted: 'Consent is required',
236
290
  },
237
291
  classes: {
238
- label: "text-xs text-slate-500 font-normal"
292
+ label: "t-text-xs t-text-slate-500 t-font-normal"
239
293
  }
240
294
  });
241
295
 
@@ -243,6 +297,7 @@ const zipcode = () => sbsText({
243
297
  label: 'Zip Code:',
244
298
  placeholder: '90210',
245
299
  name: 'Zip',
300
+ maxlength: 5,
246
301
  validation: 'required|matches:/^[0-9]{5}$/',
247
302
  validationMessages: {
248
303
  required: 'Zip Code is required',
@@ -295,6 +350,48 @@ const ChildCustodyAndSupportQuestions = () => group(
295
350
  }
296
351
  );
297
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
+
298
395
  const NotSureOrOtherQuestions = () => group(
299
396
  'NotSureOrOtherQuestions',
300
397
  {
@@ -365,7 +462,7 @@ function contactInfo() {
365
462
  $el: 'h3',
366
463
  children: 'Based on your input, you may benefit from speaking with a family lawyer. Please verify your contact information:',
367
464
  attrs: {
368
- 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'
369
466
  }
370
467
  },
371
468
  email(),
@@ -375,7 +472,7 @@ function contactInfo() {
375
472
  $el: 'div',
376
473
  if: '$activeStep === $lastStep()',
377
474
  attrs: {
378
- class: 'flex justify-center'
475
+ class: 't-flex t-justify-center'
379
476
  },
380
477
  children: [
381
478
  {
@@ -415,11 +512,14 @@ function TOLPQuestions() {
415
512
  $el: 'h3',
416
513
  children: 'Please Complete the Following:',
417
514
  attrs: {
418
- 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'
419
516
  }
420
517
  },
421
518
  AdoptionQuestions(),
422
519
  ChildCustodyAndSupportQuestions(),
520
+ FamilyIssuesQuestions(),
521
+ GuardianshipQuestions(),
522
+ DivorceQuestions(),
423
523
  NotSureOrOtherQuestions()
424
524
  ],
425
525
  ...arguments
@@ -445,7 +545,7 @@ const formNavigation = () => ({
445
545
  },
446
546
  {
447
547
  $formkit: 'button',
448
- onClick: '$setNextStep()',
548
+ onClick: '$setNextStep($fireStepEvent($get(form)))',
449
549
  children: 'Next',
450
550
  style: {
451
551
  if: '$activeStep === $lastStep()',
@@ -472,7 +572,7 @@ const formDetails = () => ({
472
572
  $el: 'pre',
473
573
  children: '$stringify( $get(form).value )',
474
574
  attrs: {
475
- class: 'text-xs',
575
+ class: 't-text-xs',
476
576
  style: 'overflow: scroll'
477
577
  }
478
578
  },
@@ -480,7 +580,7 @@ const formDetails = () => ({
480
580
  $el: 'pre',
481
581
  children: ['activeStep: ', '$activeStep'],
482
582
  attrs: {
483
- class: 'text-xs',
583
+ class: 't-text-xs',
484
584
  style: 'overflow: scroll'
485
585
  }
486
586
  },
@@ -488,7 +588,7 @@ const formDetails = () => ({
488
588
  $el: 'pre',
489
589
  children: ['stepHistory: ', '$stepHistory'],
490
590
  attrs: {
491
- class: 'text-xs',
591
+ class: 't-text-xs',
492
592
  style: 'overflow: scroll'
493
593
  }
494
594
  },
@@ -496,7 +596,7 @@ const formDetails = () => ({
496
596
  $el: 'pre',
497
597
  children: ['stepQueue: ', '$stepQueue'],
498
598
  attrs: {
499
- class: 'text-xs',
599
+ class: 't-text-xs',
500
600
  style: 'overflow: scroll'
501
601
  }
502
602
  }
@@ -512,33 +612,25 @@ const schema = [
512
612
  },
513
613
  {
514
614
  $cmp: 'FormKit',
515
- props: {
516
- type: 'form',
517
- id: 'form',
615
+ props: formProps({
616
+ formId: 'childAndFamily',
518
617
  onSubmit: '$submit("https://httpbin.org/post", $prepData, $getRedirect)',
519
618
  // onSubmit: '$submit("http://localhost:8080/api/v1/form_leads_ext", $prepData, $getRedirect)',
520
- plugins: '$plugins',
521
- actions: false,
522
- prepop: {
523
- fromURL: true
524
- },
525
- errorCodes: {
526
- 403: "An Error Occurred",
527
- 409: { abort: false },
528
- 429: "An Error Occurred"
529
- },
530
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}',
531
624
  '*': 'https://justanswer.9pctbx.net/c/2880795/808601/9320?sharedid=${properties.vid}'
532
625
  },
533
- formClass: '!max-w-xl'
534
- },
626
+ }),
535
627
  children: [
536
628
  {
537
629
  $el: 'h1',
538
630
  if: '$activeStep === $firstStep()',
539
631
  children: 'Get Child & Family Help Today',
540
632
  attrs: {
541
- 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'
542
634
  }
543
635
  },
544
636
  {
@@ -546,34 +638,10 @@ const schema = [
546
638
  if: '$activeStep === $firstStep()',
547
639
  children: 'Contact Us Now for Child Support, Custody and Family Issues',
548
640
  attrs: {
549
- 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'
550
642
  }
551
643
  },
552
- {
553
- $formkit: 'hidden',
554
- name: "vertical",
555
- value: "Legal"
556
- },
557
- {
558
- $formkit: 'hidden',
559
- name: "TCPA_Language",
560
- value: "$meta.tcpaLanguage"
561
- },
562
- {
563
- $formkit: 'hidden',
564
- name: "gclid",
565
- value: null,
566
- },
567
- {
568
- $formkit: 'hidden',
569
- name: "campaignid",
570
- value: null,
571
- },
572
- {
573
- $formkit: 'hidden',
574
- name: "s",
575
- value: null,
576
- },
644
+ ...hiddenInputs,
577
645
  {
578
646
  $el: 'div',
579
647
  attrs: {