PageSourceSearch

https://www.getharvest.com/hubfs/hub_generated/template_assets/1/2…/template_contact-sales-manager.min.js

js getharvest.com collected 2026-09-24 06:57:16 UTC 9,003 bytes, 2 lines download raw bytes

1!function(){"use strict";"loading"===document.readyState?document.addEventListener("DOMContentLoaded",init):init();var FREE_EMAIL_DOMAINS=["gmail.com","googlemail.com","yahoo.com","yahoo.co.uk","hotmail.com","outlook.com","live.com","msn.com","aol.com","icloud.com","me.com","mac.com","protonmail.com","proton.me","gmx.com","mail.com","yandex.com"];function init(){var cfg=window.contactSalesConfig||{},PORTAL_ID=cfg.portalId,FORM_ID=cfg.formId,REGION=cfg.region||"na1";if(PORTAL_ID&&FORM_ID){var SUBMIT_URL="https://api.hsforms.com/submissions/v3/integration/submit/"+PORTAL_ID+"/"+FORM_ID;!function(portalId,formId,region){var attempts=0,maxAttempts=50;function tick(){"undefined"!=typeof hbspt&&hbspt.forms?hbspt.forms.create({portalId:portalId,formId:formId,target:"#hs-hidden-form-tracker",region:region}):(attempts+=1)<maxAttempts&&setTimeout(tick,100)}tick()}(PORTAL_ID,FORM_ID,REGION);var helpVals=[],useVals=[],ynVal=null,maxStepReached=0,billingExitTracked=!1;trackStepViewed(1),$("ts-next1").addEventListener("click",function(){var errors=validateStep1();errors.length?track("contact_sales_step_error",{step:1,fields:errors.join(",")}):goToStep(2)}),$("ts-back2").addEventListener("click",function(){goToStep(1)}),$("ts-back3").addEventListener("click",function(){goToStep(2)}),$$("#ts-help .ts-chip").forEach(function(chip){chip.addEventListener("click",function(){!function(el){helpVals=toggleChip("#ts-help",el),$("ts-other-help").hidden=-1===helpVals.indexOf("other"),$("ts-helpError").classList.remove("is-visible");var billingOnly=isBillingOnlySelection();$("ts-billing-exit").classList.toggle("is-active",billingOnly),billingOnly?(billingExitTracked||(billingExitTracked=!0,track("contact_sales_billing_exit",{})),function(){var ctx={pageUri:window.location.href,pageName:document.title},hutk=getHutk();hutk&&(ctx.hutk=hutk);var payload={fields:basePayloadFields().concat([{name:"how_can_we_help",value:helpVals.join(";")}]),context:ctx};fetch(SUBMIT_URL,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(payload)}).catch(function(){})}()):billingExitTracked=!1}(chip)})}),$("ts-next2").addEventListener("click",function(){if(0===helpVals.length)return $("ts-helpError").classList.add("is-visible"),void track("contact_sales_step_error",{step:2,reason:"no_selection"});isBillingOnlySelection()||goToStep(3)}),$$("#ts-use .ts-chip").forEach(function(chip){chip.addEventListener("click",function(){useVals=toggleChip("#ts-use",chip),$("ts-other-use").hidden=-1===useVals.indexOf("other-use"),$("ts-useError").classList.remove("is-visible")})}),$$(".ts-yn .ts-chip").forEach(function(btn){btn.addEventListener("click",function(){$$(".ts-yn .ts-chip").forEach(function(b){b.classList.remove("is-selected")}),btn.classList.add("is-selected"),ynVal=btn.dataset.yn,$("ts-current-tool-wrap").hidden="yes"!==ynVal,"yes"!==ynVal&&($("ts-current-tool").value="")})}),$("ts-submit").addEventListener("click",function(){if(0===helpVals.length)return goToStep(2),$("ts-helpError").classList.add("is-visible"),void track("contact_sales_step_error",{step:2,reason:"no_selection"});if(0===useVals.length)return goToStep(3),$("ts-useError").classList.add("is-visible"),void track("contact_sales_step_error",{step:3,reason:"no_selection"});var btn=$("ts-submit");btn.disabled=!0,btn.textContent="Submitting…";var helpJoined=joinChipValues(helpVals,"other","ts-other-help-input"),useJoined=joinChipValues(useVals,"other-use","ts-other-use-input"),ctx={pageUri:window.location.href,pageName:document.title},hutk=getHutk();hutk&&(ctx.hutk=hutk);var payload={fields:basePayloadFields().concat([{name:"how_can_we_help",value:helpJoined},{name:"how_does_your_team_plan_on_using_harvest",value:useJoined},{name:"currently_using_tool",value:ynVal||""},{name:"current_tool",value:($("ts-current-tool").value||"").trim()},{name:"implementation_timeline",value:$("ts-timeline").value||""},{name:"message",value:buildMessageText(helpJoined,useJoined)}]),context:ctx};fetch(SUBMIT_URL,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(payload)}).then(function(res){return res.ok?res.json():function(res){return res.json().catch(function(){return null}).then(function(body){if(body&&body.errors&&body.errors.length)throw new Error(body.errors.map(function(e){return e.message}).join(" "));throw new Error(res.statusText||"Submit failed")})}(res)}).then(function(){track("contact_sales_submitted",{team_size:parseInt(($("ts-seats").value||"").trim(),10)||0,intents:helpJoined,uses:useJoined,currently_using_tool:ynVal||"",implementation_timeline:$("ts-timeline").value||""}),["ts-p1","ts-p2","ts-p3"].forEach(function(id){$(id).classList.remove("is-active")}),$("ts-billing-exit").classList.remove("is-active"),$$(".ts-stepper-step").forEach(function(el){el.classList.remove("is-current"),el.classList.add("is-done")}),$$(".ts-stepper-line").forEach(function(line){line.classList.add("is-done")}),$("ts-success").classList.add("is-active")}).catch(function(err){track("contact_sales_submit_failed",{error:err&&err.message||"unknown"}),btn.disabled=!1,btn.textContent="Submit request",alert(err&&err.message?err.message:"Something went wrong. Please try again.")})})}else console.error("contact-sales-manager: missing window.contactSalesConfig.portalId or .formId");function $(id){return document.getElementById(id)}function $$(sel,root){return Array.prototype.slice.call((root||document).querySelectorAll(sel))}function track(eventName,params){if(window.PicoX&&"function"==typeof window.PicoX.track){var base={page_path:window.location.pathname,page_name:window.pageData&&window.pageData.pageName||null};window.PicoX.track(eventName,Object.assign(base,params||{}))}}function trackStepViewed(n){n<=maxStepReached||(maxStepReached=n,track("contact_sales_step_viewed",{step:n}))}function getHutk(){var match=document.cookie.match(/(?:^|; )hubspotutk=([^;]*)/);return match?match[1]:null}function goToStep(n){["p1","p2","p3"].forEach(function(p,idx){$("ts-"+p).classList.toggle("is-active",idx+1===n)}),$$(".ts-stepper-step").forEach(function(el){var step=parseInt(el.dataset.step,10);el.classList.toggle("is-current",step===n),el.classList.toggle("is-done",step<n)}),$$(".ts-stepper-line").forEach(function(line){var from=parseInt(line.dataset.line.split("-")[0],10);line.classList.toggle("is-done",from<n)});var target=$("ts-p"+n);target&&target.scrollIntoView&&target.scrollIntoView({behavior:"smooth",block:"nearest"}),trackStepViewed(n)}function validateStep1(){var errors=[];["firstname","lastname","company"].forEach(function(id){var f=$("ts-f-"+id),v=($("ts-"+id).value||"").trim();f.classList.toggle("has-error",!v),v||errors.push(id)});var seats=($("ts-seats").value||"").trim(),seatsNum=parseInt(seats,10),seatsOk=""!==seats&&!isNaN(seatsNum)&&seatsNum>=1;$("ts-f-seats").classList.toggle("has-error",!seatsOk),seatsOk||errors.push("seats");var emailOk=function(email){var m=(email||"").toLowerCase().match(/^[^\s@]+@([^\s@]+\.[^\s@]+)$/);return!!m&&-1===FREE_EMAIL_DOMAINS.indexOf(m[1])}(($("ts-email").value||"").trim());return $("ts-f-email").classList.toggle("has-error",!emailOk),emailOk||errors.push("email"),errors}function toggleChip(groupSel,el){if("true"===el.dataset.exclusive){var wasSel=el.classList.contains("is-selected");$$(groupSel+" .ts-chip").forEach(function(c){c.classList.remove("is-selected")}),wasSel||el.classList.add("is-selected")}else $$(groupSel+' .ts-chip[data-exclusive="true"]').forEach(function(c){c.classList.remove("is-selected")}),el.classList.toggle("is-selected");return $$(groupSel+" .ts-chip.is-selected").map(function(c){return c.dataset.v})}function isBillingOnlySelection(){return 1===helpVals.length&&"billing"===helpVals[0]}function basePayloadFields(){return[{name:"firstname",value:($("ts-firstname").value||"").trim()},{name:"lastname",value:($("ts-lastname").value||"").trim()},{name:"email",value:($("ts-email").value||"").trim()},{name:"company",value:($("ts-company").value||"").trim()},{name:"phone",value:($("ts-phone").value||"").trim()},{name:"team_size",value:String(parseInt(($("ts-seats").value||"").trim(),10)||0)}]}function joinChipValues(vals,otherToken,otherInputId){var joined=val
1s.join(";");return-1!==vals.indexOf(otherToken)&&(joined+="|other:"+($(otherInputId).value||"").trim()),joined}function buildMessageText(helpJoined,useJoined){var custom=($("ts-message").value||"").trim();if(custom)return custom;var lines=[];helpJoined&&lines.push("How we can help: "+helpJoined),useJoined&&lines.push("Planned use: "+useJoined),ynVal&&lines.push("Currently using a tool: "+ynVal);var tool=($("ts-current-tool").value||"").trim();tool&&lines.push("Current tool: "+tool);var timeline=$("ts-timeline").value||"";return timeline&&lines.push("Timeline: "+timeline),lines.length?lines.join("\n"):"No additional message."}}}();
2//# sourceURL=https://19495563.fs1.hubspotusercontent-na1.net/hubfs/19495563/hub_generated/template_assets/1/215074470007/1784275146403/template_contact-sales-manager.js

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.