bhl-forms 0.1.27 → 0.1.28

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 (34) hide show
  1. package/dist/forms/accidentsAndInjuries.es.js +25 -0
  2. package/dist/forms/accidentsAndInjuries.iife.js +1 -1
  3. package/dist/forms/accidentsAndInjuries.json +1 -1
  4. package/dist/forms/civilLawsuit.es.js +26 -0
  5. package/dist/forms/civilLawsuit.iife.js +1 -1
  6. package/dist/forms/civilLawsuit.json +1 -1
  7. package/dist/forms/contracts.es.js +1005 -0
  8. package/dist/forms/contracts.iife.js +1 -0
  9. package/dist/forms/contracts.json +1 -0
  10. package/dist/forms/criminal.es.js +26 -0
  11. package/dist/forms/criminal.iife.js +1 -1
  12. package/dist/forms/criminal.json +1 -1
  13. package/dist/forms/employmentAndWorkplace.es.js +25 -0
  14. package/dist/forms/employmentAndWorkplace.iife.js +1 -1
  15. package/dist/forms/employmentAndWorkplace.json +1 -1
  16. package/dist/forms/generalLegal.es.js +26 -0
  17. package/dist/forms/generalLegal.iife.js +1 -1
  18. package/dist/forms/generalLegal.json +1 -1
  19. package/dist/forms/generalLegalPopUnder.es.js +26 -0
  20. package/dist/forms/generalLegalPopUnder.iife.js +1 -1
  21. package/dist/forms/generalLegalPopUnder.json +1 -1
  22. package/dist/forms/generalLegalPopUnderTF.es.js +26 -0
  23. package/dist/forms/generalLegalPopUnderTF.iife.js +1 -1
  24. package/dist/forms/generalLegalPopUnderTF.json +1 -1
  25. package/dist/forms/generalLegalThankYou.es.js +26 -0
  26. package/dist/forms/generalLegalThankYou.iife.js +1 -1
  27. package/dist/forms/generalLegalThankYou.json +1 -1
  28. package/dist/forms/realEstate.es.js +26 -0
  29. package/dist/forms/realEstate.iife.js +1 -1
  30. package/dist/forms/realEstate.json +1 -1
  31. package/dist/forms/vets.es.js +319 -0
  32. package/dist/forms/vets.iife.js +1 -0
  33. package/dist/forms/vets.json +1 -0
  34. package/package.json +1 -1
@@ -0,0 +1,319 @@
1
+ function merge() {
2
+ return Object.assign({}, ...arguments)
3
+ }
4
+
5
+ function RedirectUrl(domain, category) {
6
+ return 'https://listings.' + domain + '/api/v1/redirect?zone_id=4&sub_id=${properties.vid}&category=' + encodeURIComponent(category)
7
+ }
8
+
9
+ function RedirectUrlComments(domain, category) {
10
+ return RedirectUrl(domain, category) + '&Comments=${properties.Comments}'
11
+ }
12
+
13
+ const DEFAULT_COMMENTS_PLACEHOLDER_DYNAMIC = '$getKey($meta, "commentsPlaceholders." + $get(Type_Of_Legal_Problem).value, $meta.defaultCommentsPlaceholder)';
14
+ const DEFAULT_COMMENTS_LABEL = 'Please briefly describe your legal issue in a few words:';
15
+
16
+ const formPropDefaults = {
17
+ type: 'form',
18
+ id: 'form',
19
+ config: { validationVisibility: 'submit' },
20
+ onSubmit: '$submit($submitUrl, $prepData, $handleRedirect, "text/plain; charset=UTF-8")',
21
+ plugins: '$plugins',
22
+ actions: false,
23
+ anchorElement: 'form-anchor',
24
+ prepop: {
25
+ fromURL: true
26
+ },
27
+ errorCodes: {
28
+ 403: { message: "An Error Occurred", abort: false },
29
+ 409: { abort: false },
30
+ 429: "An Error Occurred",
31
+ 504: { message: "An Error Occurred", abort: false },
32
+ },
33
+ formClass: '!t-max-w-[40rem]'
34
+ };
35
+
36
+ function formProps(updates) {
37
+ return merge(
38
+ formPropDefaults,
39
+ updates
40
+ )
41
+ }
42
+
43
+ const formAnchorDefaults = {
44
+ $el: 'div',
45
+ children: [
46
+ {
47
+ $el: 'div',
48
+ attrs: {
49
+ id: 'form-anchor',
50
+ class: 't-absolute',
51
+ style: { top: '-30px', left: 0 }
52
+ }
53
+ }
54
+ ],
55
+ attrs: {
56
+ class: 't-relative'
57
+ }
58
+ };
59
+
60
+ function formAnchor(updates) {
61
+ return merge(
62
+ formAnchorDefaults,
63
+ updates
64
+ )
65
+ }
66
+
67
+ const headlineDefaults = {
68
+ $el: 'h1',
69
+ attrs: {
70
+ class: 't-flex t-justify-center t-text-center !t-text-[2rem] t-font-semibold t-pt-5 t-px-7 md:t-px-3'
71
+ }
72
+ };
73
+
74
+ function headline(updates) {
75
+ return merge(
76
+ headlineDefaults,
77
+ updates
78
+ )
79
+ }
80
+
81
+ const subHeadlineDefaults = {
82
+ $el: 'h3',
83
+ attrs: {
84
+ class: 't-flex t-justify-center t-text-center !t-text-[1.2rem] t-font-medium t-text-blue-500 t-px-10'
85
+ }
86
+ };
87
+
88
+ function subHeadline(updates) {
89
+ return merge(
90
+ subHeadlineDefaults,
91
+ updates
92
+ )
93
+ }
94
+
95
+ const hiddenInputsBase = [
96
+ {
97
+ $formkit: 'hidden',
98
+ name: "gclid",
99
+ value: null
100
+ },
101
+ {
102
+ $formkit: 'hidden',
103
+ name: "campaignid",
104
+ value: null
105
+ },
106
+ {
107
+ $formkit: 'hidden',
108
+ name: "s",
109
+ value: null
110
+ }
111
+ ];
112
+
113
+ const hiddenInputsVets = [
114
+ {
115
+ $formkit: 'hidden',
116
+ name: "vertical",
117
+ value: "Veterinarians"
118
+ },
119
+ ...hiddenInputsBase
120
+ ];
121
+
122
+ const textArea = (updates) => {
123
+ return merge({
124
+ $formkit: 'textarea',
125
+ rows: 5,
126
+ maxlength: 500,
127
+ validation: 'required',
128
+ validationMessages: {
129
+ required: 'Field is required'
130
+ },
131
+ innerClass: 't-max-w-xl',
132
+ labelClass: 'required'
133
+ }, updates)
134
+ };
135
+
136
+ const comments$1 = (updates) => textArea(
137
+ merge({
138
+ label: 'Please briefly describe your situation in a few words:',
139
+ name: 'Comments',
140
+ placeholder: 'For Example: "I would like help with child support payments" or "I need help with visitation rights"'
141
+ }, updates)
142
+ );
143
+
144
+ const NEXT_ON_ENTER = '$onEnter($setNextStep($fireStepEvent($get(form)), $preStepFunc($get(form))))';
145
+
146
+ const isInput = (n) => { return (n.type !== 'group' && n.type !== 'section' && n.type !== 'form' && n.$formkit !== 'hidden' && !n.children) };
147
+
148
+ const findLastInput = (n) => {
149
+ if (isInput(n)) {
150
+ return n
151
+ }
152
+ for (var i = n.children.length - 1; i >= 0; i--) {
153
+ if (typeof n.children === 'string') {
154
+ continue
155
+ }
156
+ const child = n.children[i];
157
+ if (isInput(child)) {
158
+ return child
159
+ }
160
+ const res = findLastInput(child);
161
+ if (res) {
162
+ return res
163
+ }
164
+ }
165
+ return null
166
+ };
167
+
168
+ const stepDefaults = (step) => ({
169
+ $el: 'section',
170
+ if: '$stepIsEnabled("' + step + '")',
171
+ attrs: {
172
+ style: {
173
+ if: '$activeStep !== "' + step + '"',
174
+ then: 'display: none;'
175
+ }
176
+ }
177
+ });
178
+
179
+ function step(name, inputs, nextOnEnter = true) {
180
+ if (typeof nextOnEnter === 'undefined') {
181
+ nextOnEnter = true;
182
+ }
183
+ if (inputs && inputs.length && nextOnEnter) {
184
+ const lastInput = findLastInput(inputs[inputs.length - 1]);
185
+ lastInput.onKeypress = NEXT_ON_ENTER;
186
+ }
187
+
188
+ return merge(
189
+ stepDefaults(name),
190
+ {
191
+ children: [
192
+ {
193
+ $formkit: 'group',
194
+ id: name,
195
+ name: name,
196
+ children: inputs
197
+ }
198
+ ]
199
+ }
200
+ )
201
+ }
202
+
203
+ function comments(updates = {}) {
204
+ return step(
205
+ 'comments',
206
+ [
207
+ comments$1({
208
+ label: updates.label || DEFAULT_COMMENTS_LABEL,
209
+ placeholder: updates.placeholder || DEFAULT_COMMENTS_PLACEHOLDER_DYNAMIC
210
+ })
211
+ ],
212
+ updates.nextOnEnter
213
+ )
214
+ }
215
+
216
+ const formNavigationOnlySubmit = () => ({
217
+ $el: 'div',
218
+ attrs: {
219
+ class: 'step-nav'
220
+ },
221
+ children: [
222
+ {
223
+ $formkit: 'button',
224
+ name: 'hidden_button',
225
+ children: 'Hidden',
226
+ style: {
227
+ if: '$activeStep === $firstStep()',
228
+ then: 'visibility: hidden;'
229
+ }
230
+ },
231
+ {
232
+ $formkit: 'submit',
233
+ name: 'submit_button',
234
+ // TODO ability to customize this
235
+ label: 'Chat Now'
236
+ }
237
+ ]
238
+ });
239
+
240
+ const formDetails = () => ({
241
+ $el: 'pre',
242
+ if: '$urlParam("fdbg", "") == 1',
243
+ children: [
244
+ {
245
+ $el: 'pre',
246
+ children: '$stringify( $get(form).value )',
247
+ attrs: {
248
+ class: 't-text-xs',
249
+ style: 'overflow: scroll'
250
+ }
251
+ },
252
+ {
253
+ $el: 'pre',
254
+ children: ['activeStep: ', '$activeStep'],
255
+ attrs: {
256
+ class: 't-text-xs',
257
+ style: 'overflow: scroll'
258
+ }
259
+ },
260
+ {
261
+ $el: 'pre',
262
+ children: ['stepHistory: ', '$stepHistory'],
263
+ attrs: {
264
+ class: 't-text-xs',
265
+ style: 'overflow: scroll'
266
+ }
267
+ },
268
+ {
269
+ $el: 'pre',
270
+ children: ['stepQueue: ', '$stepQueue'],
271
+ attrs: {
272
+ class: 't-text-xs',
273
+ style: 'overflow: scroll'
274
+ }
275
+ }
276
+ ]
277
+ });
278
+
279
+ const schema = [
280
+ formAnchor(),
281
+ {
282
+ $cmp: 'FormKit',
283
+ props: formProps({
284
+ formId: 'vets',
285
+ redirectMap: {
286
+ '*': RedirectUrlComments('answers-now.com', 'Veterinarians')
287
+ },
288
+ formClass: '!t-max-w-[36rem]'
289
+ }),
290
+ children: [
291
+ headline({
292
+ children: '$urlParam("hl", "Have Questions About Your Pet?")',
293
+ if: '$activeStep === $firstStep()'
294
+ }),
295
+ subHeadline({
296
+ children: '$urlParam("shl", "Get Answers Within Minutes!")',
297
+ if: '$activeStep === $firstStep()'
298
+ }),
299
+ ...hiddenInputsVets,
300
+ {
301
+ $el: 'div',
302
+ attrs: {
303
+ class: 'form-body'
304
+ },
305
+ children: [
306
+ comments({
307
+ label: 'Please describe your issue in a few words:',
308
+ placeholder: 'Example: "My dog is limping and I need to know if I should take him to the vet"',
309
+ nextOnEnter: false
310
+ }),
311
+ formNavigationOnlySubmit(),
312
+ formDetails()
313
+ ]
314
+ }
315
+ ]
316
+ }
317
+ ];
318
+
319
+ export { schema as default };
@@ -0,0 +1 @@
1
+ var vets=function(){"use strict";function e(){return Object.assign({},...arguments)}const t={type:"form",id:"form",config:{validationVisibility:"submit"},onSubmit:'$submit($submitUrl, $prepData, $handleRedirect, "text/plain; charset=UTF-8")',plugins:"$plugins",actions:!1,anchorElement:"form-anchor",prepop:{fromURL:!0},errorCodes:{403:{message:"An Error Occurred",abort:!1},409:{abort:!1},429:"An Error Occurred",504:{message:"An Error Occurred",abort:!1}},formClass:"!t-max-w-[40rem]"};const r={$el:"h1",attrs:{class:"t-flex t-justify-center t-text-center !t-text-[2rem] t-font-semibold t-pt-5 t-px-7 md:t-px-3"}};const i={$el:"h3",attrs:{class:"t-flex t-justify-center t-text-center !t-text-[1.2rem] t-font-medium t-text-blue-500 t-px-10"}};const n=[{$formkit:"hidden",name:"vertical",value:"Veterinarians"},{$formkit:"hidden",name:"gclid",value:null},{$formkit:"hidden",name:"campaignid",value:null},{$formkit:"hidden",name:"s",value:null}],s=t=>(t=>e({$formkit:"textarea",rows:5,maxlength:500,validation:"required",validationMessages:{required:"Field is required"},innerClass:"t-max-w-xl",labelClass:"required"},t))(e({label:"Please briefly describe your situation in a few words:",name:"Comments",placeholder:'For Example: "I would like help with child support payments" or "I need help with visitation rights"'},t)),l=e=>"group"!==e.type&&"section"!==e.type&&"form"!==e.type&&"hidden"!==e.$formkit&&!e.children,o=e=>{if(l(e))return e;for(var t=e.children.length-1;t>=0;t--){if("string"==typeof e.children)continue;const r=e.children[t];if(l(r))return r;const i=o(r);if(i)return i}return null};const a=[e({$el:"div",children:[{$el:"div",attrs:{id:"form-anchor",class:"t-absolute",style:{top:"-30px",left:0}}}],attrs:{class:"t-relative"}},u),{$cmp:"FormKit",props:function(r){return e(t,r)}({formId:"vets",redirectMap:{"*":(c="answers-now.com",d="Veterinarians",function(e,t){return"https://listings."+e+"/api/v1/redirect?zone_id=4&sub_id=${properties.vid}&category="+encodeURIComponent(t)}(c,d)+"&Comments=${properties.Comments}")},formClass:"!t-max-w-[36rem]"}),children:[function(t){return e(r,t)}({children:'$urlParam("hl", "Have Questions About Your Pet?")',if:"$activeStep === $firstStep()"}),function(t){return e(i,t)}({children:'$urlParam("shl", "Get Answers Within Minutes!")',if:"$activeStep === $firstStep()"}),...n,{$el:"div",attrs:{class:"form-body"},children:[function(t={}){return function(t,r,i=!0){void 0===i&&(i=!0),r&&r.length&&i&&(o(r[r.length-1]).onKeypress="$onEnter($setNextStep($fireStepEvent($get(form)), $preStepFunc($get(form))))");return e((e=>({$el:"section",if:'$stepIsEnabled("'+e+'")',attrs:{style:{if:'$activeStep !== "'+e+'"',then:"display: none;"}}}))(t),{children:[{$formkit:"group",id:t,name:t,children:r}]})}("comments",[s({label:t.label||"Please briefly describe your legal issue in a few words:",placeholder:t.placeholder||'$getKey($meta, "commentsPlaceholders." + $get(Type_Of_Legal_Problem).value, $meta.defaultCommentsPlaceholder)'})],t.nextOnEnter)}({label:"Please describe your issue in a few words:",placeholder:'Example: "My dog is limping and I need to know if I should take him to the vet"',nextOnEnter:!1}),{$el:"div",attrs:{class:"step-nav"},children:[{$formkit:"button",name:"hidden_button",children:"Hidden",style:{if:"$activeStep === $firstStep()",then:"visibility: hidden;"}},{$formkit:"submit",name:"submit_button",label:"Chat Now"}]},{$el:"pre",if:'$urlParam("fdbg", "") == 1',children:[{$el:"pre",children:"$stringify( $get(form).value )",attrs:{class:"t-text-xs",style:"overflow: scroll"}},{$el:"pre",children:["activeStep: ","$activeStep"],attrs:{class:"t-text-xs",style:"overflow: scroll"}},{$el:"pre",children:["stepHistory: ","$stepHistory"],attrs:{class:"t-text-xs",style:"overflow: scroll"}},{$el:"pre",children:["stepQueue: ","$stepQueue"],attrs:{class:"t-text-xs",style:"overflow: scroll"}}]}]}]}];var c,d,u;return a}();
@@ -0,0 +1 @@
1
+ [{"$el":"div","children":[{"$el":"div","attrs":{"id":"form-anchor","class":"t-absolute","style":{"top":"-30px","left":0}}}],"attrs":{"class":"t-relative"}},{"$cmp":"FormKit","props":{"type":"form","id":"form","config":{"validationVisibility":"submit"},"onSubmit":"$submit($submitUrl, $prepData, $handleRedirect, \"text/plain; charset=UTF-8\")","plugins":"$plugins","actions":false,"anchorElement":"form-anchor","prepop":{"fromURL":true},"errorCodes":{"403":{"message":"An Error Occurred","abort":false},"409":{"abort":false},"429":"An Error Occurred","504":{"message":"An Error Occurred","abort":false}},"formClass":"!t-max-w-[36rem]","formId":"vets","redirectMap":{"*":"https://listings.answers-now.com/api/v1/redirect?zone_id=4&sub_id=${properties.vid}&category=Veterinarians&Comments=${properties.Comments}"}},"children":[{"$el":"h1","attrs":{"class":"t-flex t-justify-center t-text-center !t-text-[2rem] t-font-semibold t-pt-5 t-px-7 md:t-px-3"},"children":"$urlParam(\"hl\", \"Have Questions About Your Pet?\")","if":"$activeStep === $firstStep()"},{"$el":"h3","attrs":{"class":"t-flex t-justify-center t-text-center !t-text-[1.2rem] t-font-medium t-text-blue-500 t-px-10"},"children":"$urlParam(\"shl\", \"Get Answers Within Minutes!\")","if":"$activeStep === $firstStep()"},{"$formkit":"hidden","name":"vertical","value":"Veterinarians"},{"$formkit":"hidden","name":"gclid","value":null},{"$formkit":"hidden","name":"campaignid","value":null},{"$formkit":"hidden","name":"s","value":null},{"$el":"div","attrs":{"class":"form-body"},"children":[{"$el":"section","if":"$stepIsEnabled(\"comments\")","attrs":{"style":{"if":"$activeStep !== \"comments\"","then":"display: none;"}},"children":[{"$formkit":"group","id":"comments","name":"comments","children":[{"$formkit":"textarea","rows":5,"maxlength":500,"validation":"required","validationMessages":{"required":"Field is required"},"innerClass":"t-max-w-xl","labelClass":"required","label":"Please describe your issue in a few words:","name":"Comments","placeholder":"Example: \"My dog is limping and I need to know if I should take him to the vet\""}]}]},{"$el":"div","attrs":{"class":"step-nav"},"children":[{"$formkit":"button","name":"hidden_button","children":"Hidden","style":{"if":"$activeStep === $firstStep()","then":"visibility: hidden;"}},{"$formkit":"submit","name":"submit_button","label":"Chat Now"}]},{"$el":"pre","if":"$urlParam(\"fdbg\", \"\") == 1","children":[{"$el":"pre","children":"$stringify( $get(form).value )","attrs":{"class":"t-text-xs","style":"overflow: scroll"}},{"$el":"pre","children":["activeStep: ","$activeStep"],"attrs":{"class":"t-text-xs","style":"overflow: scroll"}},{"$el":"pre","children":["stepHistory: ","$stepHistory"],"attrs":{"class":"t-text-xs","style":"overflow: scroll"}},{"$el":"pre","children":["stepQueue: ","$stepQueue"],"attrs":{"class":"t-text-xs","style":"overflow: scroll"}}]}]}]}]
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bhl-forms",
3
- "version": "0.1.27",
3
+ "version": "0.1.28",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },