@nudgem/nudgem-helper
Advanced tools
Comparing version 0.0.2 to 0.0.3
@@ -1,1 +0,1 @@ | ||
var m="nudgemmall.myshopify.com";var u="https://nudgem-dashboard.herokuapp.com/survey-iframe";var d="https://nudgem-backend-staging.herokuapp.com/public/api/v1/surveys/init";var c="survey_id",h="nudgem-app-survey",T={margin:"1.25rem"},R=e=>{let n=e.getAttribute("data-survey-id");if(n)return n;let{searchParams:r}=new URL(e==null?void 0:e.src);return r.has(c)?r.get(c):null},I=async(e,n)=>{var r;try{let t=(r=e==null?void 0:e.Shopify)==null?void 0:r.shop,i=`${e.crypto.randomUUID()}@${t||m}`,a=await e.fetch(n||d,{headers:{Accept:"application/json, text/plain, */*","Content-Type":"application/json; charset=utf-8"},method:"POST",body:JSON.stringify({shop_name:t,checkout_attributes:{email:i}})});if(a.status!==200)return null;let _=await a.json();return(_==null?void 0:_.iframe)||null}catch(t){console.error(t)}return null},O=(e,n)=>`${n||u}?${c}=${e}`,N=async e=>{var a;let n=e==null?void 0:e.document,r=n==null?void 0:n.currentScript,t=R(r),i=t?O(t,r.getAttribute("data-survey-url")):await I(e,r.getAttribute("data-survey-api-url"));if(!!i)try{let _=n.createElement("div");_.className=h,Object.entries(T).forEach(([o,E])=>{_.style.setProperty(o,E)});let s=n.createElement("iframe");s.src=i,s.allowFullscreen=!1,s.frameBorder="0",s.scrolling="no",s.width="100%",s.height="200px",e.addEventListener("message",({data:o})=>{(o==null?void 0:o.source)==="nudgem"&&(o==null?void 0:o.type)==="heightChange"&&(s.height=o.payload.height,_.style.backgroundSize="0")});let[l]=n.querySelectorAll('script[src*="nudgem-helper"]');l&&((a=l.parentNode)==null||a.appendChild(_),_.appendChild(s))}catch(_){console.log(_)}},g=N;(e=>{g(e).catch(n=>{console.error(n)})})(globalThis); | ||
var m="nudgemmall.myshopify.com";var u="https://nudgem-dashboard.herokuapp.com/survey-iframe";var d="https://nudgem-backend-staging.herokuapp.com/public/api/v1/surveys/init";var c="survey_id",T="nudgem-app-survey",g={margin:"1.25rem",maxHeight:"200px",overflowY:"auto"},b=e=>{let n=e.getAttribute("data-survey-id");if(n)return n;let{searchParams:_}=new URL(e==null?void 0:e.src);return _.has(c)?_.get(c):null},I=async(e,n)=>{var _;try{let t=(_=e==null?void 0:e.Shopify)==null?void 0:_.shop,a=`${e.crypto.randomUUID()}@${t||m}`,i=await e.fetch(n||d,{headers:{Accept:"application/json, text/plain, */*","Content-Type":"application/json; charset=utf-8"},method:"POST",body:JSON.stringify({shop_name:t,checkout_attributes:{email:a}})});if(i.status!==200)return null;let r=await i.json();return(r==null?void 0:r.iframe)||null}catch(t){console.error(t)}return null},R=(e,n)=>`${n||u}?${c}=${e}`,O=async e=>{var i;let n=e==null?void 0:e.document,_=n==null?void 0:n.currentScript,t=b(_),a=t?R(t,_.getAttribute("data-survey-url")):await I(e,_.getAttribute("data-survey-api-url"));if(!!a)try{let r=n.createElement("div");r.className=T,Object.entries(g).forEach(([o,h])=>{r.style[o]=h});let s=n.createElement("iframe");s.src=a,s.allowFullscreen=!1,s.frameBorder="0",s.scrolling="no",s.width="100%",s.height=g.maxHeight,e.addEventListener("message",({data:o})=>{(o==null?void 0:o.source)==="nudgem"&&(o==null?void 0:o.type)==="heightChange"&&(s.height=o.payload.height,r.style.backgroundSize="0")});let[l]=n.querySelectorAll('script[src*="nudgem-helper"]');l&&((i=l.parentNode)==null||i.appendChild(r),r.appendChild(s))}catch(r){console.log(r)}},E=O;(e=>{E(e).catch(n=>{console.error(n)})})(globalThis); |
{ | ||
"name": "@nudgem/nudgem-helper", | ||
"version": "0.0.2", | ||
"version": "0.0.3", | ||
"description": "nudgem-helper", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
25721