Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@acuityai/acuityai

Package Overview
Dependencies
Maintainers
1
Versions
19
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@acuityai/acuityai - npm Package Compare versions

Comparing version 1.0.6 to 1.0.7

2

dist/index.js

@@ -1,1 +0,1 @@

import t from"url-join";import{env as e}from"process";import o from"event-lite";const n=new class extends o{};var a,r,c;a=window,r="message",c=function(t){try{var e=JSON.parse(t.data),o=e.message?JSON.parse(e.message):e;if(0===String(o.msg).indexOf("seek-to-"))return n.emit(o.msg,o.data);switch(o.msg){case"redirect-to":return n.emit("redirect-to",o);case"add-to-cart":return n.emit("add-to-cart",o);case"close-ad-popup":return n.emit("close-ad-popup",o);case"open-product":return n.emit("open-product",o);case"close-product":return n.emit("close-product");case"close":return n.emit("close");case"open-standalonecart":return n.emit("open-standalonecart");default:return n.emit(o.msg,o.data)}}catch(t){}},a.addEventListener?a.addEventListener(r,c):a.attachEvent&&a.attachEvent("on"+r,c);const{REACT_APP_URL:i,NODE_ENV:s}=e;let d,p;function u(t){return document.getElementById("acuity-cart-iframe").style.display="block",d=t.data.id,n.emit("notify:product-open",{id:d}),e={msg:"open-product",data:t.data},void document.getElementById("acuity-cart-iframe").contentWindow.postMessage(e,"*");var e}function l({company:t}){if(p)return;const e=document.createElement("div");e.innerHTML=`\n <iframe id="acuity-cart-iframe" src="${function(t){if("production"!==s)return i;switch(t){case"proactiv":return"https://shoppable.proactiv.com";case"santaluzia":return"https://www.santaluziamouldings.com/shoppable";case"Coach":return"https://www.coach.com/shop_content.html";case"myft":return"https://www.myft.com.br/shoppable";case"lancaperfume":return"https://www.lancaperfume.com.br/_secure/shoppble";default:return i}}(t)}?type=cart&company=${t}" frameborder="0"></iframe>\n <style>\n #acuity-cart-iframe {\n position: fixed;\n top: 0;\n left: 0;\n z-index: 99999;\n height: 100%;\n width: 100%;\n display: none;\n }\n </style>\n `,document.body.appendChild(e),p=e}n.on("open-product",u),n.on("close-product",(function(){document.getElementById("acuity-cart-iframe").style.display="none",n.emit("notify:product-closed",{id:d})})),n.on("add-to-cart",(function({product:t}){if(!t.id)return;if("examples.acuityai.com"!==window.location.host)return;const e=new XMLHttpRequest;e.open("POST",`${window.location.protocol}//${window.location.host}/cart/add`,!0),e.setRequestHeader("Content-Type","application/x-www-form-urlencoded"),e.onreadystatechange=function(){if(this.readyState===XMLHttpRequest.DONE&&200===this.status){if(console.log("product added to cart!"),"examples.acuityai.com"!==window.location.host)return;const t=document.querySelectorAll(".site-header__cart-count span")[0];t.innerText=Number(t.innerText)+1}},e.send(`id=${t.id}`)}));const m=window.acuityaiLayer||{};export default m;function y({name:t,productId:e}){u({data:{asset:t,product:{id:e},client:window.company}})}function f(t,e){t.contentWindow.postMessage(JSON.stringify(e),"*")}function h(t,e,o){t.addEventListener?t.addEventListener(e,o):t.attachEvent&&t.attachEvent("on"+e,o)}let w;window.acuityaiLayer=m;m.onClickProduct=y,m.openCart=()=>null,m.start=function({selector:e,company:o,asset:a,video:r,disableAutoPause:c}){const i=document.querySelector(e),s=document.createElement("iframe");window.company=o,s.style.border=0,s.style.backgroundColor="rgba(0,0,0,0)",s.height=128,s.width=300,s.src=t("https://graphql.acuityai.com","app",o,a,"productpanel"),function({company:e,asset:o}){const a=document.createElement("iframe"),r=document.querySelector("body");a.style.display="none",a.style.position="fixed",a.style.top=0,a.style.right=0,a.style.border=0,a.style.zIndex=99999,a.style.width="460px",a.style.height="100%",a.style.backgroundColor="rgba(0,0,0,0)",a.src=t("https://graphql.acuityai.com","app",e,"shoppingcart"),r.appendChild(a),m._$cart=a,h(window,"message",(t=>{if("https://graphql.acuityai.com"===t.origin){const e=JSON.parse(t.data);"cart-close"===e.type?a.style.display="none":"redirect-to"===e.type?window.location.href=e.data.location:"cart-update"===e.type&&n.emit("cart-total",e.data.total)}})),m.openCart=()=>{a.style.display="block",setTimeout((()=>{f(m._$cart,{type:"toggle-cart"})}),100)},n.on("add-to-cart",(()=>{setTimeout((()=>{f(m._$cart,{type:"update-session-cart"})}),1e3)})),setTimeout((()=>{f(m._$cart,{type:"start-cart"})}),1e3)}({company:o,asset:a}),i.appendChild(s),h(window,"message",(t=>{if("https://graphql.acuityai.com"===t.origin){const e=JSON.parse(t.data);"open-product"==e.type&&y(e)}})),function(t,e){t.addEventListener("progress",(o=>{f(e,{type:"video-progress",duration:t.duration,currentTime:t.currentTime})})),t.addEventListener("seeked",(o=>{f(e,{type:"video-progress",duration:t.duration,currentTime:t.currentTime})}))}(r,s),l({company:window.company});const d=(p=r,()=>{w=!p.paused,p.pause()});var p;const u=(t=>()=>{w&&t.play(),m._$cart&&f(m._$cart,{type:"update-cart"})})(r);c||(n.on("notify:product-open",d),n.on("notify:product-closed",u)),m.destroy=()=>{s.parentElement.removeChild(s),n.off("notify:product-open",d),n.off("notify:product-closed",u)}},m.events=n,m.destroy=()=>null;
import t from"url-join";import{env as e}from"process";import o from"event-lite";const n=new class extends o{};var a,r,c;a=window,r="message",c=function(t){try{var e=JSON.parse(t.data),o=e.message?JSON.parse(e.message):e;if(0===String(o.msg).indexOf("seek-to-"))return n.emit(o.msg,o.data);switch(o.msg){case"redirect-to":return n.emit("redirect-to",o);case"add-to-cart":return n.emit("add-to-cart",o);case"close-ad-popup":return n.emit("close-ad-popup",o);case"open-product":return n.emit("open-product",o);case"close-product":return n.emit("close-product");case"close":return n.emit("close");case"open-standalonecart":return n.emit("open-standalonecart");default:return n.emit(o.msg,o.data)}}catch(t){}},a.addEventListener?a.addEventListener(r,c):a.attachEvent&&a.attachEvent("on"+r,c);const{REACT_APP_URL:i,NODE_ENV:s}=e;let d,p;function u(t){return document.getElementById("acuity-cart-iframe").style.display="block",d=t.data.id,n.emit("notify:product-open",{id:d}),e={msg:"open-product",data:t.data},void document.getElementById("acuity-cart-iframe").contentWindow.postMessage(e,"*");var e}function l({company:t}){if(p)return;const e=document.createElement("div");e.innerHTML=`\n <iframe id="acuity-cart-iframe" src="${function(t){if("production"!==s)return i;switch(t){case"proactiv":return"https://shoppable.proactiv.com";case"santaluzia":return"https://www.santaluziamouldings.com/shoppable";case"Coach":return"https://www.coach.com/shop_content.html";case"myft":return"https://www.myft.com.br/shoppable";case"lancaperfume":return"https://www.lancaperfume.com.br/_secure/shoppble";default:return i}}(t)}?type=cart&company=${t}" frameborder="0"></iframe>\n <style>\n #acuity-cart-iframe {\n position: fixed;\n top: 0;\n left: 0;\n z-index: 99999;\n height: 100%;\n width: 100%;\n display: none;\n }\n </style>\n `,document.body.appendChild(e),p=e}n.on("open-product",u),n.on("close-product",(function(){document.getElementById("acuity-cart-iframe").style.display="none",n.emit("notify:product-closed",{id:d})})),n.on("add-to-cart",(function({product:t}){if(!t.id)return;if("examples.acuityai.com"!==window.location.host)return;const e=new XMLHttpRequest;e.open("POST",`${window.location.protocol}//${window.location.host}/cart/add`,!0),e.setRequestHeader("Content-Type","application/x-www-form-urlencoded"),e.onreadystatechange=function(){if(this.readyState===XMLHttpRequest.DONE&&200===this.status){if(console.log("product added to cart!"),"examples.acuityai.com"!==window.location.host)return;const t=document.querySelectorAll(".site-header__cart-count span")[0];t.innerText=Number(t.innerText)+1}},e.send(`id=${t.id}`)}));const m=window.acuityaiLayer||{};export default m;function y({name:t,productId:e}){u({data:{asset:t,product:{id:e},client:window.company}})}function f(t,e){t.contentWindow.postMessage(JSON.stringify(e),"*")}function w(t,e,o){t.addEventListener?t.addEventListener(e,o):t.attachEvent&&t.attachEvent("on"+e,o)}let h;window.acuityaiLayer=m;m.onClickProduct=y,m.openCart=()=>null,m.start=function({selector:e,company:o,asset:a,video:r,disableAutoPause:c}){const i=document.querySelector(e),s=document.createElement("iframe");window.company=o,s.style.border=0,s.style.backgroundColor="rgba(0,0,0,0)",s.height=128,s.width=300,s.src=t("https://app.acuityai.com","app",o,a,"productpanel"),function({company:e,asset:o}){const a=document.createElement("iframe"),r=document.querySelector("body");a.style.display="none",a.style.position="fixed",a.style.top=0,a.style.right=0,a.style.border=0,a.style.zIndex=99999,a.style.width="460px",a.style.height="100%",a.style.backgroundColor="rgba(0,0,0,0)",a.src=t("https://app.acuityai.com","app",e,"shoppingcart"),r.appendChild(a),m._$cart=a,w(window,"message",(t=>{if("https://app.acuityai.com"===t.origin){const e=JSON.parse(t.data);"cart-close"===e.type?a.style.display="none":"redirect-to"===e.type?window.location.href=e.data.location:"cart-update"===e.type&&n.emit("cart-total",e.data.total)}})),m.openCart=()=>{a.style.display="block",setTimeout((()=>{f(m._$cart,{type:"toggle-cart"})}),100)},n.on("add-to-cart",(()=>{setTimeout((()=>{f(m._$cart,{type:"update-session-cart"})}),1e3)})),setTimeout((()=>{f(m._$cart,{type:"start-cart"})}),1e3)}({company:o,asset:a}),i.appendChild(s),w(window,"message",(t=>{if("https://app.acuityai.com"===t.origin){const e=JSON.parse(t.data);"open-product"==e.type&&y(e)}})),function(t,e){t.addEventListener("progress",(o=>{f(e,{type:"video-progress",duration:t.duration,currentTime:t.currentTime})})),t.addEventListener("seeked",(o=>{f(e,{type:"video-progress",duration:t.duration,currentTime:t.currentTime})}))}(r,s),l({company:window.company});const d=(p=r,()=>{h=!p.paused,p.pause()});var p;const u=(t=>()=>{h&&t.play(),m._$cart&&f(m._$cart,{type:"update-cart"})})(r);c||(n.on("notify:product-open",d),n.on("notify:product-closed",u)),m.destroy=()=>{s.parentElement.removeChild(s),n.off("notify:product-open",d),n.off("notify:product-closed",u)}},m.events=n,m.destroy=()=>null;
{
"name": "@acuityai/acuityai",
"version": "1.0.6",
"version": "1.0.7",
"description": "The acuityai SDK is library that uses https://acuityai.com com for implement shoppable in video element by utilizing our easy interface.",

@@ -5,0 +5,0 @@ "main": "dist/index.js",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc