PageSourceSearch

https://www.persistent.com/wp-content/cache/min/1/wp-content/plugi…/User/assets/js/lead-form.js?ver=1789975042

js persistent.com collected 2026-09-24 08:41:31 UTC 6,078 bytes, 38 lines download raw bytes

1(function(root,factory){if(typeof module==='object'&&module.exports){module.exports=factory()}else{root.wpaeLeadForm=factory()}}(typeof self!=='undefined'?self:this,function(){'use strict';var ENGAGEMENT_THRESHOLD=2;var SUBMITTED_KEY='wpae_lead_submitted';function readSubmitted(store){try{return!!store&&'yes'===store.getItem(SUBMITTED_KEY)}catch(e){return!1}}
2function writeSubmitted(store){try{if(store){store.setItem(SUBMITTED_KEY,'yes')}}catch(e){}}
3function storageFor(opts){if(opts&&Object.prototype.hasOwnProperty.call(opts,'storage')){return opts.storage}
4try{return typeof window!=='undefined'?window.localStorage:null}catch(e){return null}}
5function hasSubmitted(opts){return readSubmitted(storageFor(opts))}
6var QUESTIONS_BEFORE_FORM=2;var STANDARD_FIELD_TYPES={name:'text',email:'email',phone:'tel',company:'text'};function shouldTrigger(rule,state){if(!state||!state.completed){return!1}
7if((state.questionCount||0)<QUESTIONS_BEFORE_FORM){return!1}
8if('before_answer'===rule||'after_answer'===rule){return!0}
9if('engagement_based'===rule){return(state.questionCount||0)>=ENGAGEMENT_THRESHOLD}
10return!1}
11function rendersAbove(rule){return'before_answer'===rule}
12function renderableFields(config){config=config||{};var fields=[];(config.fields||[]).forEach(function(key){if('string'===typeof key&&''!==key){fields.push({key:key,label:key.charAt(0).toUpperCase()+key.slice(1),type:STANDARD_FIELD_TYPES[key]||'text'})}});(config.custom_fields||[]).forEach(function(custom){if(custom&&'object'===typeof custom&&custom.key){fields.push({key:String(custom.key),label:'string'===typeof custom.label?custom.label:String(custom.key),type:'text'})}});return{fields:fields,consent:config.consent_required?{label:'string'===typeof config.consent_label?config.consent_label:''}:null}}
13function harvest(form){var values={};if(!form||'function'!==typeof form.querySelectorAll){return values}
14var controls=form.querySelectorAll('input[name], textarea[name], select[name]');for(var i=0;i<controls.length;i++){var control=controls[i];var name=control.getAttribute('name');if(!name||0===name.indexOf('_wpcf7')){continue}
15if('checkbox'===control.type||'radio'===control.type){if(control.checked){values[name]=control.value||'yes'}
16continue}
17if(control.value){values[name]=control.value}}
18return values}
19function acceptedConsent(form){if(!form||'function'!==typeof form.querySelector){return!1}
20var acceptance=form.querySelector('.wpcf7-acceptance input[type="checkbox"]');return!!(acceptance&&acceptance.checked)}
21function isAcceptedSubmission(detail){var status=detail&&detail.status?String(detail.status):'';return'mail_sent'===status||'mail_failed'===status||'demo_mode'===status}
22function showSubmitted(modal,ctx,detail){if(!ctx||'function'!==typeof modal.submitted){return}
23var response=detail&&detail.apiResponse;modal.submitted(ctx,response&&'string'===typeof response.message?response.message:'')}
24function mount(mountTarget,config,opts){opts=opts||{};var doc=opts.document||(typeof document!=='undefined'?document:null);var fetchImpl=opts.fetch||(typeof window!=='undefined'?window.fetch&&window.fetch.bind(window):null);var modal=opts.formModal||(typeof window!=='undefined'?window.wpaeFormModal:null);if(!doc||!modal||!mountTarget){return null}
25if(hasSubmitted(opts)){return null}
26var i18n=opts.i18n||{};var shape=renderableFields(config);var externalForm=config&&'string'===typeof config.external_form?config.external_form.trim():'';if(''!==externalForm){return mountExternal(mountTarget,externalForm,opts,modal,doc,fetchImpl,i18n)}
27if(0===shape.fields.length){return null}
28return modal.open(mountTarget,{document:doc,variant:'lead',fields:shape.fields.map(function(field){return{key:field.key,label:field.label,type:field.type,required:'email'===field.key}}),i18n:i18n,privacyUrl:opts.privacyUrl,consentLabel:shape.consent?shape.consent.label:'',onClose:opts.onDismiss,submit:function(values,consent){if(!fetchImpl||!opts.leadUrl){return!1}
29var sourcePage=opts.sourcePage||(typeof window!=='undefined'&&window.location?window.location.href:'');return fetchImpl(opts.leadUrl,{method:'POST',credentials:'same-origin',headers:{'Content-Type':'application/json'},body:JSON.stringify({fields:values,consent:consent,source_page:sourcePage,query_id:opts.queryId||null})}).then(function(response){var ok=!!(response&&response.ok);if(ok){writeSubmitted(storageFor(opts))}
30return{ok:ok,rateLimited:429===(response&&response.status)}})}})}
31function mountExternal(mountTarget,html,opts,modal,doc,fetchImpl,i18n){return modal.open(mountTarget,{document:doc,variant:'lead',externalForm:html,i18n:i18n,onClose:opts.onDismiss,submit:function(){return!1},onExternalForm:function(host,ctx){var form=host.querySelector('form.wpcf7-form')||host.querySelector('form');if(!form){return}
32var cf7=typeof window!=='undefined'?window.wpcf7:null;var initialised=!1;if(cf7&&'function'===typeof cf7.init){try{cf7.init(form);
32initialised=!0}catch(e){initialised=!1}}
33if(!initialised){if(typeof console!=='undefined'&&console.warn){console.warn('Answer Engine: Check that Contact Form 7 assets are loaded on this page.')}
34form.addEventListener('submit',function(event){event.preventDefault()})}
35var recorded=!1;form.addEventListener('wpcf7submit',function(event){if(recorded||!isAcceptedSubmission(event.detail)){return}
36recorded=!0;writeSubmitted(storageFor(opts));showSubmitted(modal,ctx,event.detail);if(!fetchImpl||!opts.leadUrl){return}
37var sourcePage=opts.sourcePage||(typeof window!=='undefined'&&window.location?window.location.href:'');fetchImpl(opts.leadUrl,{method:'POST',credentials:'same-origin',headers:{'Content-Type':'application/json'},body:JSON.stringify({fields:harvest(form),consent:acceptedConsent(form),source_page:sourcePage,query_id:opts.queryId||null})}).catch(function(){})})}})}
38return{SUBMITTED_KEY:SUBMITTED_KEY,harvest:harvest,acceptedConsent:acceptedConsent,isAcceptedSubmission:isAcceptedSubmission,hasSubmitted:hasSubmitted,QUESTIONS_BEFORE_FORM:QUESTIONS_BEFORE_FORM,shouldTrigger:shouldTrigger,rendersAbove:rendersAbove,renderableFields:renderableFields,mount:mount}}))

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.