forked from BuilderIO/demo-editor
-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathgrowsumo.min.js.download
1 lines (1 loc) · 6.45 KB
/
growsumo.min.js.download
1
!function(){"use strict";var o="https://grsm.io",r="https://partnerlinks.io";function n(o){return"string"!=typeof o?"":decodeURIComponent(atob(o).split("").map((function(o){return"%"+("00"+o.charCodeAt(0).toString(16)).slice(-2)})).join(""))}var e,t=(function(o,r){var n;n=function(){function o(){for(var o=0,r={};o<arguments.length;o++){var n=arguments[o];for(var e in n)r[e]=n[e]}return r}function r(o){return o.replace(/(%[0-9A-Z]{2})+/g,decodeURIComponent)}return function n(e){function t(){}function u(r,n,u){if("undefined"!=typeof document){"number"==typeof(u=o({path:"/"},t.defaults,u)).expires&&(u.expires=new Date(1*new Date+864e5*u.expires)),u.expires=u.expires?u.expires.toUTCString():"";try{var i=JSON.stringify(n);/^[\{\[]/.test(i)&&(n=i)}catch(o){}n=e.write?e.write(n,r):encodeURIComponent(String(n)).replace(/%(23|24|26|2B|3A|3C|3E|3D|2F|3F|40|5B|5D|5E|60|7B|7D|7C)/g,decodeURIComponent),r=encodeURIComponent(String(r)).replace(/%(23|24|26|2B|5E|60|7C)/g,decodeURIComponent).replace(/[\(\)]/g,escape);var s="";for(var a in u)u[a]&&(s+="; "+a,!0!==u[a]&&(s+="="+u[a].split(";")[0]));return document.cookie=r+"="+n+s}}function i(o,n){if("undefined"!=typeof document){for(var t={},u=document.cookie?document.cookie.split("; "):[],i=0;i<u.length;i++){var s=u[i].split("="),a=s.slice(1).join("=");n||'"'!==a.charAt(0)||(a=a.slice(1,-1));try{var c=r(s[0]);if(a=(e.read||e)(a,c)||r(a),n)try{a=JSON.parse(a)}catch(o){}if(t[c]=a,o===c)break}catch(o){}}return o?t[o]:t}}return t.set=u,t.get=function(o){return i(o,!1)},t.getJSON=function(o){return i(o,!0)},t.remove=function(r,n){u(r,"",o(n,{expires:-1}))},t.defaults={},t.withConverter=n,t}((function(){}))},o.exports=n()}(e={exports:{}},e.exports),e.exports);function u(o){if(null==o)return null;const r=t.get(o);return null==r||null==r?null:r}function i(o,r,n,e,t,u){t=t||"/",u=u||"Lax";const i=n?`Domain=${n};`:"";document.cookie=`${o}=${r}; ${i} Expires=${e}; Path=${t}; SameSite=${u}`}function s(o,r,n){var e=new Date(Date.now()+7776e6).toUTCString();(new TextEncoder).encode(r).length<=255&&(i(o,r,n,e),u(o)!==r&&i(o,r,location.host,e))}const a="gspk",c="gsxid",m="pscd",g=c,d="growSumoPartnerKey",_=m,p="trackingV1",w="ps_mode",l="ps_xid",f=l,k="ps_partner_key",v=k,x="trackingV2";var y={_b64d:n,_gc:u,_sc:s,domain_v1:o,domain_v2:r,source:null,fallback_domain:null,cookie_domain:location.host,pscd:null,initialized:!1,data:{amount:0,currency:"USD",email:"",name:"",public_key:"",host_domain:""},_rd:function(){growsumo.data.amount=0,growsumo.data.email="",growsumo.data.name="",growsumo.data.currency="USD"},_initialize:function(o){growsumo.cookie_domain=growsumo.cookie_domain.split(":")[0];var r=growsumo.cookie_domain.split(".");r.length>2&&(growsumo.cookie_domain="."+r.slice(1).join(".")),growsumo.data.host_domain=location.host,growsumo.source=growsumo._detect_source(),growsumo.fallback_domain=growsumo._get_fallback_domain(),growsumo.data.public_key=o,growsumo._gpscd(),growsumo._gpk(),growsumo._gxid(),growsumo._pxidrc(),growsumo.initialized=!0},_detect_source:function(){if(growsumo._gpbn(k)||growsumo._gpbn(l))return x;if(growsumo._gpbn(a)||growsumo._gpbn(c))return p;var o=[u(v),u(f)],r=[u(d),u(g)].some(o=>!!o),n=o.some(o=>!!o);if(r&&n){var e=u(w);if(e===p)return p;if(e===x)return x}return r?p:n?x:null},_get_tracking_domain:function(){return null!=growsumo.pscd?"https://"+growsumo.pscd:growsumo.source===x?growsumo.domain_v2:growsumo.domain_v1},_set_source_for_endpoint:function(o){o==growsumo.domain_v1?growsumo.source=p:o==growsumo.domain_v2&&(growsumo.source=x)},_gpk:function(){var o=growsumo._gpbn(a),r=growsumo._gpbn(k);r&&(o=r),o&&(o=n(o));var e=r?x:p;(o=growsumo._spk(o,e))||growsumo._get_pk_primary_cookie_mirror()},_get_fallback_domain:function(){return growsumo.source==x?growsumo.domain_v1:growsumo.domain_v2},_get_pk_primary_cookie_mirror:function(){var o=growsumo._get_tracking_domain(),r=growsumo._ccr("GET",o+"/pr/gpk/"+growsumo.data.public_key);r.onreadystatechange=function(){4==r.readyState&&(200==r.status&&(growsumo._spk(r.responseText,growsumo.source||p),null==growsumo.source&&r.responseText.length>0&&growsumo._set_source_for_endpoint(o)),null==growsumo.source&&growsumo._get_pk_fallback_cookie_mirror())},r.send(null)},_get_pk_fallback_cookie_mirror:function(){var o=growsumo._ccr("GET",growsumo.fallback_domain+"/pr/gpk/"+growsumo.data.public_key);o.onreadystatechange=function(){4==o.readyState&&200==o.status&&o.responseText.length>0&&(growsumo._spk(o.responseText,growsumo.source||x),growsumo._set_source_for_endpoint(otherEndpoint))},o.send(null)},_spk:function(o,r){return r&&s(w,r,growsumo.cookie_domain),o||(o=u(v)||u(d)),o&&(growsumo.data.partner_key=o,s(d,o,growsumo.cookie_domain),s(v,o,growsumo.cookie_domain)),o},_gpscd:function(){var o=growsumo._gpbn(m);o?growsumo._spscd(o):growsumo._spscd()},_spscd:function(o){let r=null!=o?o:u(_);null!=r&&(growsumo.pscd=r,s(_,r,growsumo.cookie_domain))},_gxid:function(){var o=growsumo._gpbn(c),r=growsumo._gpbn(l);r&&(o=r,growsumo.source=x),o?growsumo._sxid(o):growsumo._sxid()},_sxid:function(o){let r=o||u(f);null==r&&(r=u(g)),null!=r&&(growsumo.data.xid=r,s(g,r,growsumo.cookie_domain),s(f,r,growsumo.cookie_domain))},_pxidrc:function(){growsumo.data.xid&&growsumo._mr("POST","/pr/receipt",{location:location.href,referrer:window.frames.top.document.referrer,xid:growsumo.data.xid,partner_key:growsumo.data.partner_key})},_gpbn:function(o){return function(o){o=o.replace(/[\[\]]/g,"\\$&");var r=new RegExp("[?&]"+o+"(=([^&#]*)|&|#|$)"),n=r.exec(location.search);return n||(n=r.exec(location.hash)),n?n[2]?decodeURIComponent(n[2].replace(/\+/g," ")):"":null}(o)},_ccr:function(o,r,n){var e=new XMLHttpRequest;return e.withCredentials=!0,"withCredentials"in e?e.open(o,r,!0):"undefined"!=typeof XDomainRequest?(e=new XDomainRequest).open(o,r):e=null,e},_mr:function(o,r,n,e){var t=growsumo._get_tracking_domain()+r,u=growsumo._ccr(o,t);u?(u.onload=u.onerror=function(o){e&&"function"==typeof e&&e(o)},u.send(JSON.stringify(n))):console.error("CORS not supported")},setData:function(o,r,n,e){growsumo.data.amount=o,growsumo.data.currency=r,growsumo.data.email=n,growsumo.data.name=e},createSignup:function(o){growsumo._spk(),growsumo.data.name=String(growsumo.data.name),growsumo.data.email=String(growsumo.data.email),growsumo.data.currency=String(growsumo.data.currency),growsumo.data.amount=Number(growsumo.data.amount);var r=g,n="/pr/signup";growsumo.source==x&&(r=f,n="/signup");var e=u(r);e&&(growsumo.data.xid=String(e)),growsumo._mr("POST",n,growsumo.data,(function(r){growsumo._rd(),o&&"function"==typeof o&&o(r)}))}};window.growsumo=y}();