bhl-forms 0.0.3 → 0.0.4
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/dist/bhl-forms.es.js +269 -123
- package/dist/bhl-forms.iife.js +2 -2
- package/dist/bhl-forms.umd.js +2 -2
- package/dist/forms/childAndFamily.es.js +570 -0
- package/dist/forms/childAndFamily.iife.js +575 -0
- package/dist/forms/childAndFamily.json +1 -0
- package/dist/forms/testForm.es.js +199 -71
- package/dist/forms/testForm.iife.js +199 -71
- package/dist/forms/testForm.json +1 -1
- package/dist/style.css +1 -1
- package/package.json +8 -6
|
@@ -1,6 +1,50 @@
|
|
|
1
|
+
function merge() {
|
|
2
|
+
return Object.assign({}, ...arguments)
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
const text = (updates) => {
|
|
6
|
+
return merge({
|
|
7
|
+
$formkit: 'text',
|
|
8
|
+
validation: 'required',
|
|
9
|
+
validationMessages: {
|
|
10
|
+
required: 'Field is required',
|
|
11
|
+
},
|
|
12
|
+
}, updates)
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
const sbsText = (updates) => {
|
|
16
|
+
updates.labelClass = 'center-label';
|
|
17
|
+
updates.wrapperClass = 'side-by-side';
|
|
18
|
+
return text(updates)
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
// ------ Inputs
|
|
22
|
+
|
|
23
|
+
const category = () => ({
|
|
24
|
+
$formkit: 'select',
|
|
25
|
+
label: 'Category *',
|
|
26
|
+
name: 'category',
|
|
27
|
+
id: 'category',
|
|
28
|
+
validation: 'required',
|
|
29
|
+
options: [
|
|
30
|
+
'Fruits',
|
|
31
|
+
'Vegetables'
|
|
32
|
+
]
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
const firstName = () => ({
|
|
36
|
+
$formkit: 'text',
|
|
37
|
+
label: 'First Name *',
|
|
38
|
+
name: 'First_Name',
|
|
39
|
+
validation: 'required',
|
|
40
|
+
validationMessages: {
|
|
41
|
+
required: 'First Name is required'
|
|
42
|
+
},
|
|
43
|
+
});
|
|
44
|
+
|
|
1
45
|
const email = () => ({
|
|
2
46
|
$formkit: 'email',
|
|
3
|
-
name: '
|
|
47
|
+
name: 'Email',
|
|
4
48
|
label: 'Email Address *',
|
|
5
49
|
placeholder: 'email@domain.com',
|
|
6
50
|
validation: 'required|email',
|
|
@@ -10,34 +54,46 @@ const email = () => ({
|
|
|
10
54
|
},
|
|
11
55
|
});
|
|
12
56
|
|
|
57
|
+
const lastName = () => ({
|
|
58
|
+
$formkit: 'text',
|
|
59
|
+
label: 'Last Name *',
|
|
60
|
+
name: 'Last_Name',
|
|
61
|
+
validation: 'required',
|
|
62
|
+
validationMessages: {
|
|
63
|
+
required: 'Last Name is required'
|
|
64
|
+
},
|
|
65
|
+
});
|
|
66
|
+
|
|
13
67
|
const phone = () => ({
|
|
14
68
|
$formkit: 'tel',
|
|
15
|
-
name: '
|
|
69
|
+
name: 'Primary_Phone',
|
|
16
70
|
label: 'Phone Number *',
|
|
17
71
|
placeholder: 'xxx-xxx-xxxx',
|
|
18
|
-
|
|
19
|
-
validation: 'required|matches:/^[0-9]{3}
|
|
72
|
+
help: '10-digit US phone number, hyphens optional.',
|
|
73
|
+
validation: 'required|matches:/^[0-9]{3}-?[0-9]{3}-?[0-9]{4}$/',
|
|
20
74
|
validationMessages: {
|
|
21
75
|
required: 'Phone Number is required',
|
|
22
76
|
matches: 'Invalid Phone Number',
|
|
23
77
|
},
|
|
24
78
|
});
|
|
25
79
|
|
|
26
|
-
const
|
|
27
|
-
$formkit: '
|
|
28
|
-
label: '
|
|
29
|
-
name: '
|
|
30
|
-
validation: 'required',
|
|
80
|
+
const TCPAConsent = () => ({
|
|
81
|
+
$formkit: 'checkbox',
|
|
82
|
+
label: '$meta.tcpaLanguage',
|
|
83
|
+
name: 'TCPA_Opt_In',
|
|
84
|
+
validation: 'required|accepted',
|
|
31
85
|
validationMessages: {
|
|
32
|
-
|
|
86
|
+
accepted: 'Consent is required',
|
|
33
87
|
},
|
|
88
|
+
classes: {
|
|
89
|
+
label: "text-xs text-slate-500"
|
|
90
|
+
}
|
|
34
91
|
});
|
|
35
92
|
|
|
36
|
-
const zipcode = () => ({
|
|
37
|
-
$formkit: 'text',
|
|
93
|
+
const zipcode = () => sbsText({
|
|
38
94
|
label: 'Zip Code *',
|
|
39
95
|
placeholder: '90210',
|
|
40
|
-
name: '
|
|
96
|
+
name: 'Zip',
|
|
41
97
|
validation: 'required|matches:/^[0-9]{5}$/',
|
|
42
98
|
validationMessages: {
|
|
43
99
|
required: 'Zip Code is required',
|
|
@@ -45,61 +101,80 @@ const zipcode = () => ({
|
|
|
45
101
|
},
|
|
46
102
|
});
|
|
47
103
|
|
|
48
|
-
const
|
|
49
|
-
$formkit: 'checkbox',
|
|
50
|
-
label: 'By checking this box, I agree to the Terms of Use.',
|
|
51
|
-
name: 'consent',
|
|
52
|
-
validation: 'required|accepted',
|
|
53
|
-
validationMessages: {
|
|
54
|
-
accepted: 'You must agree!',
|
|
55
|
-
},
|
|
56
|
-
classes: {
|
|
57
|
-
label: "text-xs text-slate-500"
|
|
58
|
-
}
|
|
59
|
-
});
|
|
60
|
-
|
|
61
|
-
const dateAndZip = () => ({
|
|
104
|
+
const stepDefaults = (step) => ({
|
|
62
105
|
$el: 'section',
|
|
106
|
+
if: '$stepIsEnabled("' + step + '")',
|
|
63
107
|
attrs: {
|
|
64
108
|
style: {
|
|
65
|
-
if: '$activeStep !== "
|
|
109
|
+
if: '$activeStep !== "' + step + '"',
|
|
66
110
|
then: 'display: none;'
|
|
67
111
|
}
|
|
68
|
-
}
|
|
69
|
-
children: [
|
|
70
|
-
{
|
|
71
|
-
$formkit: 'group',
|
|
72
|
-
id: 'dateAndZip',
|
|
73
|
-
name: 'dateAndZip',
|
|
74
|
-
children: [
|
|
75
|
-
zipcode(),
|
|
76
|
-
date(),
|
|
77
|
-
]
|
|
78
|
-
}
|
|
79
|
-
]
|
|
112
|
+
}
|
|
80
113
|
});
|
|
81
114
|
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
then: 'display: none;'
|
|
88
|
-
}
|
|
89
|
-
},
|
|
90
|
-
children: [
|
|
115
|
+
// ...args get merged onto the group since the 'section' node basically
|
|
116
|
+
// disappears in the formkit hierarchy
|
|
117
|
+
function step(name, inputs, ...args) {
|
|
118
|
+
return merge(
|
|
119
|
+
stepDefaults(name),
|
|
91
120
|
{
|
|
92
|
-
$formkit: 'group',
|
|
93
|
-
id: 'contactInfo',
|
|
94
|
-
name: 'contactInfo',
|
|
95
121
|
children: [
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
122
|
+
merge({
|
|
123
|
+
$formkit: 'group',
|
|
124
|
+
id: name,
|
|
125
|
+
name: name,
|
|
126
|
+
children: inputs
|
|
127
|
+
}, ...args)
|
|
128
|
+
],
|
|
100
129
|
}
|
|
101
|
-
|
|
102
|
-
}
|
|
130
|
+
)
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
function categoryAndZip() {
|
|
134
|
+
return step(
|
|
135
|
+
'categoryAndZip',
|
|
136
|
+
[
|
|
137
|
+
zipcode(),
|
|
138
|
+
category(),
|
|
139
|
+
],
|
|
140
|
+
...arguments
|
|
141
|
+
)
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
function contactInfo() {
|
|
145
|
+
return step(
|
|
146
|
+
'contactInfo',
|
|
147
|
+
[
|
|
148
|
+
email(),
|
|
149
|
+
phone(),
|
|
150
|
+
TCPAConsent(),
|
|
151
|
+
{
|
|
152
|
+
$el: 'img',
|
|
153
|
+
if: '$activeStep === $lastStep()',
|
|
154
|
+
attrs: {
|
|
155
|
+
loading: 'lazy',
|
|
156
|
+
alt: '',
|
|
157
|
+
style: { border: 0 },
|
|
158
|
+
src: 'https://www.jotform.com/uploads/bunker_hill/form_files/SecurePrivacy.61e1c17c976f80.61736956.png',
|
|
159
|
+
width: '320',
|
|
160
|
+
height: '100'
|
|
161
|
+
}
|
|
162
|
+
},
|
|
163
|
+
],
|
|
164
|
+
...arguments
|
|
165
|
+
)
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
function firstAndLast() {
|
|
169
|
+
return step(
|
|
170
|
+
'firstAndLast',
|
|
171
|
+
[
|
|
172
|
+
firstName(),
|
|
173
|
+
lastName(),
|
|
174
|
+
],
|
|
175
|
+
...arguments
|
|
176
|
+
)
|
|
177
|
+
}
|
|
103
178
|
|
|
104
179
|
const formNavigation = () => ({
|
|
105
180
|
$el: 'div',
|
|
@@ -113,7 +188,7 @@ const formNavigation = () => ({
|
|
|
113
188
|
children: 'Previous Step',
|
|
114
189
|
style: {
|
|
115
190
|
if: '$activeStep === $firstStep()',
|
|
116
|
-
then: '
|
|
191
|
+
then: 'visibility: hidden;'
|
|
117
192
|
}
|
|
118
193
|
},
|
|
119
194
|
{
|
|
@@ -128,6 +203,7 @@ const formNavigation = () => ({
|
|
|
128
203
|
{
|
|
129
204
|
$formkit: 'submit',
|
|
130
205
|
label: 'Submit Application',
|
|
206
|
+
if: '$activeStep === $lastStep()',
|
|
131
207
|
style: {
|
|
132
208
|
if: '$activeStep !== $lastStep()',
|
|
133
209
|
then: 'display: none;'
|
|
@@ -137,38 +213,69 @@ const formNavigation = () => ({
|
|
|
137
213
|
});
|
|
138
214
|
|
|
139
215
|
const formDetails = () => ({
|
|
140
|
-
$el: '
|
|
216
|
+
$el: 'pre',
|
|
217
|
+
if: '$urlParam("fdbg", "") == 1',
|
|
141
218
|
children: [
|
|
142
219
|
{
|
|
143
|
-
$el: '
|
|
144
|
-
children: '
|
|
220
|
+
$el: 'pre',
|
|
221
|
+
children: '$stringify( $get(form).value )',
|
|
222
|
+
attrs: {
|
|
223
|
+
class: 'text-xs',
|
|
224
|
+
style: 'overflow: scroll'
|
|
225
|
+
}
|
|
145
226
|
},
|
|
146
227
|
{
|
|
147
228
|
$el: 'pre',
|
|
148
|
-
children: '
|
|
229
|
+
children: ['activeStep: ', '$activeStep'],
|
|
230
|
+
attrs: {
|
|
231
|
+
class: 'text-xs',
|
|
232
|
+
style: 'overflow: scroll'
|
|
233
|
+
}
|
|
149
234
|
},
|
|
150
235
|
{
|
|
151
236
|
$el: 'pre',
|
|
152
|
-
children: ['
|
|
237
|
+
children: ['stepHistory: ', '$stepHistory'],
|
|
238
|
+
attrs: {
|
|
239
|
+
class: 'text-xs',
|
|
240
|
+
style: 'overflow: scroll'
|
|
241
|
+
}
|
|
153
242
|
},
|
|
154
243
|
{
|
|
155
244
|
$el: 'pre',
|
|
156
|
-
children: ['
|
|
245
|
+
children: ['stepQueue: ', '$stepQueue'],
|
|
246
|
+
attrs: {
|
|
247
|
+
class: 'text-xs',
|
|
248
|
+
style: 'overflow: scroll'
|
|
249
|
+
}
|
|
157
250
|
}
|
|
158
251
|
]
|
|
159
252
|
});
|
|
160
253
|
|
|
161
254
|
const schema = [
|
|
255
|
+
{
|
|
256
|
+
type: 'meta',
|
|
257
|
+
data: {
|
|
258
|
+
tcpaLanguage: "By checking this box, I a) agree to the Terms of Use, and b) consent to be contacted by lawyers, lawyer networks, and partners 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. To submit this request without this consent, call 855-506-0847."
|
|
259
|
+
}
|
|
260
|
+
},
|
|
162
261
|
{
|
|
163
262
|
$cmp: 'FormKit',
|
|
164
263
|
props: {
|
|
165
264
|
type: 'form',
|
|
166
265
|
id: 'form',
|
|
167
|
-
onSubmit: '$submit("https://httpbin.org/post")',
|
|
168
|
-
// onSubmit: '$submit("https://httpbin.org/post", "https://www.google.com?x=${
|
|
169
|
-
|
|
266
|
+
// onSubmit: '$submit("https://httpbin.org/post")',
|
|
267
|
+
// onSubmit: '$submit("https://httpbin.org/post", "https://www.google.com?x=${vertical}")',
|
|
268
|
+
onSubmit: '$submit("http://localhost:8080/api/v1/form_leads_ext", $prepData)',
|
|
170
269
|
plugins: '$plugins',
|
|
171
270
|
actions: false,
|
|
271
|
+
prepop: {
|
|
272
|
+
fromURL: true
|
|
273
|
+
},
|
|
274
|
+
errorCodes: {
|
|
275
|
+
403: "An Error Occurred",
|
|
276
|
+
409: { abort: false },
|
|
277
|
+
429: "An Error Occurred"
|
|
278
|
+
}
|
|
172
279
|
},
|
|
173
280
|
children: [
|
|
174
281
|
{
|
|
@@ -187,8 +294,28 @@ const schema = [
|
|
|
187
294
|
},
|
|
188
295
|
{
|
|
189
296
|
$formkit: 'hidden',
|
|
190
|
-
name: "
|
|
191
|
-
value: "
|
|
297
|
+
name: "vertical",
|
|
298
|
+
value: "Legal"
|
|
299
|
+
},
|
|
300
|
+
{
|
|
301
|
+
$formkit: 'hidden',
|
|
302
|
+
name: "TCPA_Language",
|
|
303
|
+
value: "$meta.tcpaLanguage"
|
|
304
|
+
},
|
|
305
|
+
{
|
|
306
|
+
$formkit: 'hidden',
|
|
307
|
+
name: "gclid",
|
|
308
|
+
value: null,
|
|
309
|
+
},
|
|
310
|
+
{
|
|
311
|
+
$formkit: 'hidden',
|
|
312
|
+
name: "campaignid",
|
|
313
|
+
value: null,
|
|
314
|
+
},
|
|
315
|
+
{
|
|
316
|
+
$formkit: 'hidden',
|
|
317
|
+
name: "s",
|
|
318
|
+
value: null,
|
|
192
319
|
},
|
|
193
320
|
{
|
|
194
321
|
$el: 'div',
|
|
@@ -196,7 +323,8 @@ const schema = [
|
|
|
196
323
|
class: 'form-body'
|
|
197
324
|
},
|
|
198
325
|
children: [
|
|
199
|
-
|
|
326
|
+
categoryAndZip(),
|
|
327
|
+
firstAndLast(),
|
|
200
328
|
contactInfo(),
|
|
201
329
|
formNavigation(),
|
|
202
330
|
formDetails(),
|