bhl-forms 0.1.25 → 0.1.27

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.
@@ -119,25 +119,20 @@ const hiddenInputsMechanics = [
119
119
  ...hiddenInputsBase
120
120
  ];
121
121
 
122
- // ------ Common Base Settings
123
-
124
- const checkbox = (updates) => {
122
+ const text = (updates) => {
125
123
  return merge({
126
- $formkit: 'checkbox',
124
+ $formkit: 'text',
127
125
  validation: 'required',
128
126
  validationMessages: {
129
127
  required: 'Field is required'
130
- }
128
+ },
129
+ labelClass: 'required'
131
130
  }, updates)
132
131
  };
133
132
 
134
- const sbsCheckbox = (updates) => {
135
- updates.legendClass = 'legend-left required';
136
- updates.fieldsetClass = '$reset side-by-side';
137
- updates.optionsClass = 't-pl-1';
138
- updates.innerClass = 't-flex t-items-center';
139
- updates.wrapperClass = 't-mb-3';
140
- return checkbox(updates)
133
+ const sbsText = (updates) => {
134
+ updates.wrapperClass = 'side-by-side t-items-center';
135
+ return text(updates)
141
136
  };
142
137
 
143
138
  const textArea = (updates) => {
@@ -154,12 +149,6 @@ const textArea = (updates) => {
154
149
  }, updates)
155
150
  };
156
151
 
157
- const newOrUseAutoInterest = () => sbsCheckbox({
158
- label: "I'm also interested in free quotes for a new or used car",
159
- name: 'New_Or_Used_Auto_Interest',
160
- validation: null,
161
- });
162
-
163
152
  const comments = (updates) => textArea(
164
153
  merge({
165
154
  label: 'Please briefly describe your situation in a few words:',
@@ -168,6 +157,20 @@ const comments = (updates) => textArea(
168
157
  }, updates)
169
158
  );
170
159
 
160
+ const zipcode = () => sbsText({
161
+ label: 'Zip Code:',
162
+ placeholder: '#####',
163
+ name: 'Zip',
164
+ maxlength: 5,
165
+ inputmode: "numeric",
166
+ autocomplete: 'postal-code',
167
+ validation: 'required|matches:/^[0-9]{5}$/',
168
+ validationMessages: {
169
+ required: 'Zip Code is required',
170
+ matches: 'Invalid Zip Code'
171
+ }
172
+ });
173
+
171
174
  const NEXT_ON_ENTER = '$onEnter($setNextStep($fireStepEvent($get(form)), $preStepFunc($get(form))))';
172
175
 
173
176
  const isInput = (n) => { return (n.type !== 'group' && n.type !== 'section' && n.type !== 'form' && n.$formkit !== 'hidden' && !n.children) };
@@ -227,16 +230,16 @@ function step(name, inputs, nextOnEnter = true) {
227
230
  )
228
231
  }
229
232
 
230
- function commentsAndAutoInterest(updates = {}) {
233
+ function zipAndComments(updates = {}) {
231
234
  return step(
232
- 'commentsAndAutoInterest',
235
+ 'zipAndComments',
233
236
  [
237
+ zipcode(),
234
238
  comments({
235
239
  label: updates.label || DEFAULT_COMMENTS_LABEL,
236
240
  placeholder: updates.placeholder || DEFAULT_COMMENTS_PLACEHOLDER_DYNAMIC,
237
241
  inputClass: 't-h-24',
238
- }),
239
- newOrUseAutoInterest()
242
+ })
240
243
  ],
241
244
  updates.nextOnEnter
242
245
  )
@@ -311,6 +314,7 @@ const schema = [
311
314
  $cmp: 'FormKit',
312
315
  props: formProps({
313
316
  formId: 'mechanics',
317
+ popUnder: RedirectUrl("answers-now.com", "Used Cars"),
314
318
  redirectMap: {
315
319
  '*': RedirectUrlComments('answers-now.com', 'Mechanics')
316
320
  },
@@ -332,7 +336,7 @@ const schema = [
332
336
  class: 'form-body'
333
337
  },
334
338
  children: [
335
- commentsAndAutoInterest({
339
+ zipAndComments({
336
340
  label: 'Please describe your issue in a few words:',
337
341
  placeholder: 'Example: "Need help changing my brake pads and rotors"',
338
342
  nextOnEnter: false
@@ -1 +1 @@
1
- var mechanics=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 s=[{$formkit:"hidden",name:"vertical",value:"Mechanics"},{$formkit:"hidden",name:"gclid",value:null},{$formkit:"hidden",name:"campaignid",value:null},{$formkit:"hidden",name:"s",value:null}],n=t=>(t.legendClass="legend-left required",t.fieldsetClass="$reset side-by-side",t.optionsClass="t-pl-1",t.innerClass="t-flex t-items-center",t.wrapperClass="t-mb-3",(t=>e({$formkit:"checkbox",validation:"required",validationMessages:{required:"Field is required"}},t))(t)),l=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)),a=e=>"group"!==e.type&&"section"!==e.type&&"form"!==e.type&&"hidden"!==e.$formkit&&!e.children,o=e=>{if(a(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(a(r))return r;const i=o(r);if(i)return i}return null};const c=[e({$el:"div",children:[{$el:"div",attrs:{id:"form-anchor",class:"t-absolute",style:{top:"-30px",left:0}}}],attrs:{class:"t-relative"}},m),{$cmp:"FormKit",props:function(r){return e(t,r)}({formId:"mechanics",redirectMap:{"*":(d="answers-now.com",u="Mechanics",function(e,t){return"https://listings."+e+"/api/v1/redirect?zone_id=4&sub_id=${properties.vid}&category="+encodeURIComponent(t)}(d,u)+"&Comments=${properties.Comments}")},formClass:"!t-max-w-[36rem]"}),children:[function(t){return e(r,t)}({children:'$urlParam("hl", "Have Questions for a Mechanic?")',if:"$activeStep === $firstStep()"}),function(t){return e(i,t)}({children:'$urlParam("shl", "Get Answers Within Minutes!")',if:"$activeStep === $firstStep()"}),...s,{$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}]})}("commentsAndAutoInterest",[l({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)',inputClass:"t-h-24"}),n({label:"I'm also interested in free quotes for a new or used car",name:"New_Or_Used_Auto_Interest",validation:null})],t.nextOnEnter)}({label:"Please describe your issue in a few words:",placeholder:'Example: "Need help changing my brake pads and rotors"',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 d,u,m;return c}();
1
+ var mechanics=function(){"use strict";function e(){return Object.assign({},...arguments)}function t(e,t){return"https://listings."+e+"/api/v1/redirect?zone_id=4&sub_id=${properties.vid}&category="+encodeURIComponent(t)}const r={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 i={$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 s={$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:"Mechanics"},{$formkit:"hidden",name:"gclid",value:null},{$formkit:"hidden",name:"campaignid",value:null},{$formkit:"hidden",name:"s",value:null}],l=t=>(t.wrapperClass="side-by-side t-items-center",(t=>e({$formkit:"text",validation:"required",validationMessages:{required:"Field is required"},labelClass:"required"},t))(t)),a=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)),o=e=>"group"!==e.type&&"section"!==e.type&&"form"!==e.type&&"hidden"!==e.$formkit&&!e.children,c=e=>{if(o(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(o(r))return r;const i=c(r);if(i)return i}return null};const d=[e({$el:"div",children:[{$el:"div",attrs:{id:"form-anchor",class:"t-absolute",style:{top:"-30px",left:0}}}],attrs:{class:"t-relative"}},p),{$cmp:"FormKit",props:function(t){return e(r,t)}({formId:"mechanics",popUnder:t("answers-now.com","Used Cars"),redirectMap:{"*":(m="answers-now.com",u="Mechanics",t(m,u)+"&Comments=${properties.Comments}")},formClass:"!t-max-w-[36rem]"}),children:[function(t){return e(i,t)}({children:'$urlParam("hl", "Have Questions for a Mechanic?")',if:"$activeStep === $firstStep()"}),function(t){return e(s,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&&(c(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}]})}("zipAndComments",[l({label:"Zip Code:",placeholder:"#####",name:"Zip",maxlength:5,inputmode:"numeric",autocomplete:"postal-code",validation:"required|matches:/^[0-9]{5}$/",validationMessages:{required:"Zip Code is required",matches:"Invalid Zip Code"}}),a({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)',inputClass:"t-h-24"})],t.nextOnEnter)}({label:"Please describe your issue in a few words:",placeholder:'Example: "Need help changing my brake pads and rotors"',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 m,u,p;return d}();
@@ -1 +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":"mechanics","redirectMap":{"*":"https://listings.answers-now.com/api/v1/redirect?zone_id=4&sub_id=${properties.vid}&category=Mechanics&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 for a Mechanic?\")","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":"Mechanics"},{"$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(\"commentsAndAutoInterest\")","attrs":{"style":{"if":"$activeStep !== \"commentsAndAutoInterest\"","then":"display: none;"}},"children":[{"$formkit":"group","id":"commentsAndAutoInterest","name":"commentsAndAutoInterest","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: \"Need help changing my brake pads and rotors\"","inputClass":"t-h-24"},{"$formkit":"checkbox","validation":null,"validationMessages":{"required":"Field is required"},"label":"I'm also interested in free quotes for a new or used car","name":"New_Or_Used_Auto_Interest","legendClass":"legend-left required","fieldsetClass":"$reset side-by-side","optionsClass":"t-pl-1","innerClass":"t-flex t-items-center","wrapperClass":"t-mb-3"}]}]},{"$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"}}]}]}]}]
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":"mechanics","popUnder":"https://listings.answers-now.com/api/v1/redirect?zone_id=4&sub_id=${properties.vid}&category=Used%20Cars","redirectMap":{"*":"https://listings.answers-now.com/api/v1/redirect?zone_id=4&sub_id=${properties.vid}&category=Mechanics&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 for a Mechanic?\")","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":"Mechanics"},{"$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(\"zipAndComments\")","attrs":{"style":{"if":"$activeStep !== \"zipAndComments\"","then":"display: none;"}},"children":[{"$formkit":"group","id":"zipAndComments","name":"zipAndComments","children":[{"$formkit":"text","validation":"required|matches:/^[0-9]{5}$/","validationMessages":{"required":"Zip Code is required","matches":"Invalid Zip Code"},"labelClass":"required","label":"Zip Code:","placeholder":"#####","name":"Zip","maxlength":5,"inputmode":"numeric","autocomplete":"postal-code","wrapperClass":"side-by-side t-items-center"},{"$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: \"Need help changing my brake pads and rotors\"","inputClass":"t-h-24"}]}]},{"$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.25",
3
+ "version": "0.1.27",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },