PageSourceSearch

https://www.betterup.com/hubfs/hub_generated/template_assets/1/208…/template_form-region-detect.min.js

js betterup.com collected 2026-10-01 07:43:03 UTC 3,771 bytes, 2 lines download raw bytes

1(()=>{function _typeof(o){return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(o){return typeof o}:function(o){return o&&"function"==typeof Symbol&&o.constructor===Symbol&&o!==Symbol.prototype?"symbol":typeof o},_typeof(o)}var SINGLE_CLICK_COUNTRIES=new Set(["us","ca"]),userCountry=null,countryFetched=!1,pendingForms=[];function initRegionDetection(form,source){var regionField=form.querySelector('input[name="region"]');if(regionField){var countryCode,regionValue=(countryCode=userCountry)&&"null"!==countryCode&&"undefined"!==countryCode&&SINGLE_CLICK_COUNTRIES.has(countryCode)?"us_canada":"rest_of_world";regionField.value=regionValue,regionField.setAttribute("value",regionValue);["input","change","blur","focus"].forEach(function(eventType){regionField.dispatchEvent(new Event(eventType,{bubbles:!0,cancelable:!0}))}),regionField.dispatchEvent(new KeyboardEvent("keyup",{bubbles:!0})),regionField.dispatchEvent(new KeyboardEvent("keydown",{bubbles:!0})),"us_canada"===regionValue&&function(form){if(!form.querySelector(".form-disclosure")){var fieldsets=form.querySelectorAll("fieldset.form-columns-1"),targetElement=null,insertionMethod="append";if(fieldsets.length>0)targetElement=fieldsets[fieldsets.length-1];else{var submitDiv=form.querySelector(".hs_submit, .hs-submit");submitDiv&&(targetElement=submitDiv.parentElement||form,insertionMethod="insertBefore")}if(targetElement){var disclosure=document.createElement("p");if(disclosure.className="form-disclosure",disclosure.innerHTML='By submitting this information, I agree to receiving emails from BetterUp about products, services and events. You can unsubscribe from these communications at any time by clicking the unsubscribe link in the emails. For more information on how BetterUp uses your personal data, see our <a href="https://www.betterup.com/privacy-policy" target="_blank">Privacy Notice</a>.',"append"===insertionMethod)targetElement.appendChild(disclosure);else{var _submitDiv=form.querySelector(".hs_submit, .hs-submit");targetElement.insertBefore(disclosure,_submitDiv)}}}}(form)}}var callback,regionInitializedForms=new WeakSet,formsWaitingForReady=new WeakSet;function handleRegionForm(form,source){if(countryFetched){var formElement=form.jquery?form[0]:form.querySelector?form:null;formElement&&!regionInitializedForms.has(formElement)&&(regionInitializedForms.add(formElement),initRegionDetection(formElement))}else pendingForms.push({form:form,source:source})}window.addEventListener("message",function(event){var _event$data;if("object"===_typeof(event.data)&&null!==(_event$data=event.data)&&void 0!==_event$data&&null!==(_event$data=_event$data.type)&&void 0!==_event$data&&_event$data.includes("hsFormCallback")&&"onFormReady"===event.data.eventName){var form=document.querySelector('form[data-form-id="'.concat(event.data.id,'"]'));form&&(formsWaitingForReady.add(form),handleRegionForm(form,"onFormReady"))}}),setTimeout(function(){document.querySelectorAll("form.hs-form").forEach(function(form){formsWaitingForReady.has(form)||handleRegionForm(form,"fallback-timeout")})},2e3),callback=function(country){userCountry=country,countryFetched=!0,pendingForms.length>0&&(pendingForms.forEach(function(_ref){handleRegionForm(_ref.form,_ref.source)}),pendingForms.length=0)},fetch("/_hcms/api/get-user-country").then(function(response){return response.json()}).then(function(data){callback(data.country.toLowerCase())}).catch(function(error){console.error("Error fetching country:",error),callback(null)}),window.handleRegionForm=function(form,source){handleRegionForm(form,source)}})();
2//# sourceURL=https://9253440.fs1.hubspotusercontent-na1.net/hubfs/9253440/hub_generated/template_assets/1/208173244933/1789502834105/template_form-region-detect.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.