Update hivegrid-cloud reference to latest main

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
davidandClaude Fable 5 committed 2026-07-08 16:15:37 +02:00
1 parent e98d38e716
commit 7b21524c86
3781 files changed
+373484 -225607

No files matched your search

@@ -1,4 +1,4 @@
/* toolctrl marketing-funnel SDK (Phase 05 #78). Single-file <3KB gz mini-snippet
/* hivegrid marketing-funnel SDK (Phase 05 #78). Single-file <3KB gz mini-snippet
for marketing landing-pages. Auto-captures UTMs+gclid+fbclid+referrer on page
load, stores first-touch attribution in localStorage so multi-page visits
attribute the same source, and POSTs to /api/leads/capture on demand or via
@@ -6,9 +6,9 @@
<script src="https://cdn.example.com/embed/marketing.js"
data-api-url="https://app.example.com" defer></script>
<script>
toolctrlMarketing.bindFormById('lead-form');
hivegridMarketing.bindFormById('lead-form');
// or imperative:
toolctrlMarketing.captureLead({ email: 'a@b.co', source: 'blog-cta' });
hivegridMarketing.captureLead({ email: 'a@b.co', source: 'blog-cta' });
</script>
*/
(function(){if(typeof window==="undefined"||typeof document==="undefined")return;
@@ -24,9 +24,9 @@ var attr=mergeAttr();
function postCapture(payload){if(!apiUrl)return Promise.reject(new Error("api-url missing"));return fetch(apiUrl.replace(/\/$/,"")+"/api/leads/capture",{method:"POST",headers:{"content-type":"application/json"},credentials:"omit",mode:"cors",body:JSON.stringify(payload)});}
function captureLead(input){if(!input||typeof input.email!=="string")return Promise.reject(new Error("email required"));var body={email:input.email,attribution:attr};for(var k in input){if(k==="email"||k==="attribution")continue;body[k]=input[k];}if(input.attribution){for(var k3 in input.attribution){body.attribution[k3]=input.attribution[k3];}}return postCapture(body).then(function(r){return{ok:r.ok,status:r.status};});}
function readForm(f){var d={},els=f.elements;for(var i=0;i<els.length;i++){var el=els[i];if(!el.name)continue;var n=el.name;if(el.type==="checkbox"||el.type==="radio"){if(!el.checked)continue;d[n]=el.value;}else{d[n]=el.value;}}return d;}
function bindForm(f){if(!f||f.__tcm_bound)return;f.__tcm_bound=true;f.addEventListener("submit",function(e){var d=readForm(f);if(!d.email){return;}e.preventDefault();var src=f.getAttribute("data-source")||sc&&sc.getAttribute("data-source")||null;var p={email:d.email,firstName:d.firstName||d.first_name||null,lastName:d.lastName||d.last_name||null,phone:d.phone||null,company:d.company||null,source:src,website_url:d.website_url||""};if(d.turnstileToken||d["cf-turnstile-response"])p.turnstileToken=d.turnstileToken||d["cf-turnstile-response"];captureLead(p).then(function(res){f.dispatchEvent(new CustomEvent("tcm:captured",{detail:res}));if(res.ok)f.reset();}).catch(function(err){f.dispatchEvent(new CustomEvent("tcm:error",{detail:{error:String(err&&err.message||err)}}));});});}
function bindForm(f){if(!f||f.__tcm_bound)return;f.__tcm_bound=true;f.addEventListener("submit",function(e){var d=readForm(f);if(!d.email){return;}e.preventDefault();var src=f.getAttribute("data-source")||sc&&sc.getAttribute("data-source")||null;var p={email:d.email,firstName:d.firstName||d.first_name||null,lastName:d.lastName||d.last_name||null,phone:d.phone||null,company:d.company||null,source:src,website_url:d.website_url||""};if(d["cap-token"]||d.captchaToken)p.captchaToken=d["cap-token"]||d.captchaToken;if(d.turnstileToken||d["cf-turnstile-response"])p.turnstileToken=d.turnstileToken||d["cf-turnstile-response"];captureLead(p).then(function(res){f.dispatchEvent(new CustomEvent("tcm:captured",{detail:res}));if(res.ok)f.reset();}).catch(function(err){f.dispatchEvent(new CustomEvent("tcm:error",{detail:{error:String(err&&err.message||err)}}));});});}
function bindFormById(id){var f=document.getElementById(id);bindForm(f);return!!f;}
function bindFormsByAttr(){var ns=document.querySelectorAll("form[data-toolctrl-lead]");for(var i=0;i<ns.length;i++)bindForm(ns[i]);}
function bindFormsByAttr(){var ns=document.querySelectorAll("form[data-hivegrid-lead]");for(var i=0;i<ns.length;i++)bindForm(ns[i]);}
if(document.readyState==="loading"){document.addEventListener("DOMContentLoaded",bindFormsByAttr);}else{bindFormsByAttr();}
window.toolctrlMarketing={captureLead:captureLead,bindFormById:bindFormById,bindFormsByAttr:bindFormsByAttr,getAttribution:function(){return Object.assign({},attr);},resetAttribution:function(){try{localStorage.removeItem(ATTR_KEY);}catch(e){}attr={};}};
window.hivegridMarketing={captureLead:captureLead,bindFormById:bindFormById,bindFormsByAttr:bindFormsByAttr,getAttribution:function(){return Object.assign({},attr);},resetAttribution:function(){try{localStorage.removeItem(ATTR_KEY);}catch(e){}attr={};}};
})();