New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

shopify-google-analytics-helper

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

shopify-google-analytics-helper - npm Package Compare versions

Comparing version 0.1.0 to 0.1.1

2

dist/bundle.es.js

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

function t(){return t=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},t.apply(this,arguments)}var e=function(t){var e=t;return String(t).match(/^\d+$/)?t:(t.match(/^gid:\/\//)||(e=window.atob(t)),(e=e.match(/\/([^\/]+)$/))?e[1]:void 0)};function r(r){var n=r.storeUrl,i=void 0===n?"shops.myshopify.com":n,o=r.storefrontToken,c=void 0===o?"":o,a=r.currencyCode,u=void 0===a?"USD":a,s=r.debug,d=void 0!==s&&s,m=function(e,r){return d&&console.log("'"+e+"'",r),window.dataLayer||(window.dataLayer=[]),r.ecommerce&&window.dataLayer.push({ecommerce:null}),window.dataLayer.push(t({event:e},r))},l=function(t){try{return t?Promise.resolve(function(t){try{return Promise.resolve(fetch("https://"+i+"/api/2022-07/graphql",{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json","X-Shopify-Storefront-Access-Token":c},body:JSON.stringify(t)})).then(function(e){return Promise.resolve(e.json()).then(function(e){var r=e.data,n=e.errors;if(n){var i=new Error(JSON.stringify(n));throw i.metadata=t,i}return r})})}catch(t){return Promise.reject(t)}}({variables:{id:window.btoa("gid://shopify/ProductVariant/"+t)},query:"query($id: ID!) {\n\tnode(id: $id) {\n\t\t...variant\n\t}\n}\nfragment variant on ProductVariant {\n\tid\n\tsku\n\ttitle\n\tprice\n\tcompareAtPrice\n\timage { originalSrc }\n\tproduct {\n\t\tid\n\t\ttitle\n\t\thandle\n\t\tproductType\n\t\tvendor\n\t}\n}"})).then(function(t){return t.node}):Promise.resolve(void 0)}catch(t){return Promise.reject(t)}},p=function(t){try{var r=function(r){return r?function(t){var r=t.product,n="https://"+i+"/products/"+r.handle,o=t.image,c=e(t.id);return{productId:e(r.id),productTitle:r.title,productVariantTitle:r.title+" - "+t.title,productType:r.productType,productVendor:r.vendor,productUrl:n,sku:t.sku,price:t.price,compareAtPrice:t.compareAtPrice,variantId:c,variantTitle:t.title,variantImage:o.originalSrc||t.image,variantUrl:n+"?variant="+c}}(r):console.error("Variant not found",t)};return Promise.resolve("object"==typeof t?r("object"==typeof t?t:l(t)):Promise.resolve("object"==typeof t?t:l(t)).then(r))}catch(t){return Promise.reject(t)}},v=function(t){return{currency:u,item_id:t.sku||t.variantId,item_name:t.productVariantTitle,item_brand:t.productVendor,item_category:t.productType,item_variant:t.variantTitle,price:t.price}},f=function(e){return function(r,n){var i=void 0===n?{}:n,o=i.el,c=i.list,a=i.position;return Promise.resolve(p(r)).then(function(r){var n=a||function(t){var e=t,r=0;if(e)for(e=t.previousElementSibling;e;)r+=1;return r}(o);if(!r)return null;var i=t({},v(r),{index:n});return c&&(i.item_list_name=c),m(e,{ecommerce:{items:[i]}})})}},h=function(e){return function(r){if(r)return m(e,{ecommerce:t({},r)})}},y=function(e,r,n){return Promise.resolve(p(e)).then(function(e){return e?m(n,{ecommerce:{items:[t({},v(e),{quantity:r})]}}):void 0})};return{viewItem:function(t,e){var r=void 0===e?{}:e,n=r.el,i=r.list,o=r.position;return f("view_item")(t,{el:n,list:i,position:o})},selectItem:function(t,e){var r=void 0===e?{}:e,n=r.el,i=r.list,o=r.position;return f("select_item")(t,{el:n,list:i,position:o})},viewItemList:function(t){if(t)return m("view_item_list",{ecommerce:{items:[].concat(t)}})},addToCart:function(t,e){return y(t,e,"add_to_cart")},removeFromCart:function(t,e){return y(t,e,"remove_from_cart")},viewCart:function(e){try{return Promise.resolve(e?m("view_cart",{ecommerce:t({},e)}):void 0)}catch(t){return Promise.reject(t)}},beginCheckout:function(t){return h("begin_checkout")(t)},purchase:function(t){return h("purchase")(t)}}}export{r as default};
function t(){return t=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},t.apply(this,arguments)}var e=function(t){var e=t;return String(t).match(/^\d+$/)?t:(t.match(/^gid:\/\//)||(e=window.atob(t)),(e=e.match(/\/([^\/]+)$/))?e[1]:void 0)};function r(r){var n=r.storeUrl,i=void 0===n?"shops.myshopify.com":n,o=r.storefrontToken,c=void 0===o?"":o,a=r.currencyCode,u=void 0===a?"USD":a,s=r.debug,d=void 0!==s&&s,m=function(e,r){return d&&console.log("'"+e+"'",r),window.dataLayer||(window.dataLayer=[]),r.ecommerce&&window.dataLayer.push({ecommerce:null}),window.dataLayer.push(t({event:e},r))},l=function(t){try{return t?Promise.resolve(function(t){try{return Promise.resolve(fetch("https://"+i+"/api/2022-07/graphql",{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json","X-Shopify-Storefront-Access-Token":c},body:JSON.stringify(t)})).then(function(e){return Promise.resolve(e.json()).then(function(e){var r=e.data,n=e.errors;if(n){var i=new Error(JSON.stringify(n));throw i.metadata=t,i}return r})})}catch(t){return Promise.reject(t)}}({variables:{id:window.btoa("gid://shopify/ProductVariant/"+t)},query:"query($id: ID!) {\n\tnode(id: $id) {\n\t\t...variant\n\t}\n}\nfragment variant on ProductVariant {\n\tid\n\tsku\n\ttitle\n\tprice\n\tcompareAtPrice\n\timage { originalSrc }\n\tproduct {\n\t\tid\n\t\ttitle\n\t\thandle\n\t\tproductType\n\t\tvendor\n\t}\n}"})).then(function(t){return t.node}):Promise.resolve(void 0)}catch(t){return Promise.reject(t)}},p=function(t){try{var r=function(r){return r?function(t){var r=t.product,n="https://"+i+"/products/"+r.handle,o=t.image,c=e(t.id);return{productId:e(r.id),productTitle:r.title,productVariantTitle:r.title+" - "+t.title,productType:r.productType,productVendor:r.vendor,productUrl:n,sku:t.sku,price:t.price,compareAtPrice:t.compareAtPrice,variantId:c,variantTitle:t.title,variantImage:o.originalSrc||t.image,variantUrl:n+"?variant="+c}}(r):console.error("Variant not found",t)};return Promise.resolve("object"==typeof t?r("object"==typeof t?t:l(t)):Promise.resolve("object"==typeof t?t:l(t)).then(r))}catch(t){return Promise.reject(t)}},v=function(t){return{currency:u,item_id:t.sku||t.variantId,item_name:t.productVariantTitle,item_brand:t.productVendor,item_category:t.productType,item_variant:t.variantTitle,price:t.price}},f=function(e){return function(r,n){var i=void 0===n?{}:n,o=i.el,c=i.list,a=i.position;return Promise.resolve(p(r)).then(function(r){var n=a||function(t){var e=t,r=0;if(e)for(e=t.previousElementSibling;e;)r+=1;return r}(o);if(!r)return null;var i=t({},v(r),{index:n});return c&&(i.item_list_name=c),m(e,{ecommerce:{items:[i]}})})}},h=function(e){return function(r){if(r)return m(e,{ecommerce:t({},r)})}},y=function(e,r,n){return Promise.resolve(p(e)).then(function(e){return e?m(n,{ecommerce:{items:[t({},v(e),{quantity:r})]}}):void 0})};return{viewItem:function(t,e){var r=void 0===e?{}:e,n=r.el,i=r.list,o=r.position;return f("view_item")(t,{el:n,list:i,position:o})},selectItem:function(t,e){var r=void 0===e?{}:e,n=r.el,i=r.list,o=r.position;return f("select_item")(t,{el:n,list:i,position:o})},viewItemList:function(t){if(t)return m("view_item_list",{ecommerce:{items:[].concat(t)}})},addToCart:function(t,e){return y(t,e,"add_to_cart")},removeFromCart:function(t,e){return y(t,e,"remove_from_cart")},viewCart:function(t){try{var e=h("view_cart");return Promise.resolve(e(t))}catch(t){return Promise.reject(t)}},beginCheckout:function(t){return h("begin_checkout")(t)},purchase:function(t){return h("purchase")(t)}}}export{r as default};
//# sourceMappingURL=bundle.es.js.map

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

function t(){return t=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},t.apply(this,arguments)}var e=function(t){var e=t;return String(t).match(/^\d+$/)?t:(t.match(/^gid:\/\//)||(e=window.atob(t)),(e=e.match(/\/([^\/]+)$/))?e[1]:void 0)};module.exports=function(r){var n=r.storeUrl,i=void 0===n?"shops.myshopify.com":n,o=r.storefrontToken,c=void 0===o?"":o,a=r.currencyCode,u=void 0===a?"USD":a,s=r.debug,d=void 0!==s&&s,m=function(e,r){return d&&console.log("'"+e+"'",r),window.dataLayer||(window.dataLayer=[]),r.ecommerce&&window.dataLayer.push({ecommerce:null}),window.dataLayer.push(t({event:e},r))},l=function(t){try{return t?Promise.resolve(function(t){try{return Promise.resolve(fetch("https://"+i+"/api/2022-07/graphql",{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json","X-Shopify-Storefront-Access-Token":c},body:JSON.stringify(t)})).then(function(e){return Promise.resolve(e.json()).then(function(e){var r=e.data,n=e.errors;if(n){var i=new Error(JSON.stringify(n));throw i.metadata=t,i}return r})})}catch(t){return Promise.reject(t)}}({variables:{id:window.btoa("gid://shopify/ProductVariant/"+t)},query:"query($id: ID!) {\n\tnode(id: $id) {\n\t\t...variant\n\t}\n}\nfragment variant on ProductVariant {\n\tid\n\tsku\n\ttitle\n\tprice\n\tcompareAtPrice\n\timage { originalSrc }\n\tproduct {\n\t\tid\n\t\ttitle\n\t\thandle\n\t\tproductType\n\t\tvendor\n\t}\n}"})).then(function(t){return t.node}):Promise.resolve(void 0)}catch(t){return Promise.reject(t)}},p=function(t){try{var r=function(r){return r?function(t){var r=t.product,n="https://"+i+"/products/"+r.handle,o=t.image,c=e(t.id);return{productId:e(r.id),productTitle:r.title,productVariantTitle:r.title+" - "+t.title,productType:r.productType,productVendor:r.vendor,productUrl:n,sku:t.sku,price:t.price,compareAtPrice:t.compareAtPrice,variantId:c,variantTitle:t.title,variantImage:o.originalSrc||t.image,variantUrl:n+"?variant="+c}}(r):console.error("Variant not found",t)};return Promise.resolve("object"==typeof t?r("object"==typeof t?t:l(t)):Promise.resolve("object"==typeof t?t:l(t)).then(r))}catch(t){return Promise.reject(t)}},v=function(t){return{currency:u,item_id:t.sku||t.variantId,item_name:t.productVariantTitle,item_brand:t.productVendor,item_category:t.productType,item_variant:t.variantTitle,price:t.price}},f=function(e){return function(r,n){var i=void 0===n?{}:n,o=i.el,c=i.list,a=i.position;return Promise.resolve(p(r)).then(function(r){var n=a||function(t){var e=t,r=0;if(e)for(e=t.previousElementSibling;e;)r+=1;return r}(o);if(!r)return null;var i=t({},v(r),{index:n});return c&&(i.item_list_name=c),m(e,{ecommerce:{items:[i]}})})}},h=function(e){return function(r){if(r)return m(e,{ecommerce:t({},r)})}},y=function(e,r,n){return Promise.resolve(p(e)).then(function(e){return e?m(n,{ecommerce:{items:[t({},v(e),{quantity:r})]}}):void 0})};return{viewItem:function(t,e){var r=void 0===e?{}:e,n=r.el,i=r.list,o=r.position;return f("view_item")(t,{el:n,list:i,position:o})},selectItem:function(t,e){var r=void 0===e?{}:e,n=r.el,i=r.list,o=r.position;return f("select_item")(t,{el:n,list:i,position:o})},viewItemList:function(t){if(t)return m("view_item_list",{ecommerce:{items:[].concat(t)}})},addToCart:function(t,e){return y(t,e,"add_to_cart")},removeFromCart:function(t,e){return y(t,e,"remove_from_cart")},viewCart:function(e){try{return Promise.resolve(e?m("view_cart",{ecommerce:t({},e)}):void 0)}catch(t){return Promise.reject(t)}},beginCheckout:function(t){return h("begin_checkout")(t)},purchase:function(t){return h("purchase")(t)}}};
function t(){return t=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},t.apply(this,arguments)}var e=function(t){var e=t;return String(t).match(/^\d+$/)?t:(t.match(/^gid:\/\//)||(e=window.atob(t)),(e=e.match(/\/([^\/]+)$/))?e[1]:void 0)};module.exports=function(r){var n=r.storeUrl,i=void 0===n?"shops.myshopify.com":n,o=r.storefrontToken,c=void 0===o?"":o,a=r.currencyCode,u=void 0===a?"USD":a,s=r.debug,d=void 0!==s&&s,m=function(e,r){return d&&console.log("'"+e+"'",r),window.dataLayer||(window.dataLayer=[]),r.ecommerce&&window.dataLayer.push({ecommerce:null}),window.dataLayer.push(t({event:e},r))},l=function(t){try{return t?Promise.resolve(function(t){try{return Promise.resolve(fetch("https://"+i+"/api/2022-07/graphql",{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json","X-Shopify-Storefront-Access-Token":c},body:JSON.stringify(t)})).then(function(e){return Promise.resolve(e.json()).then(function(e){var r=e.data,n=e.errors;if(n){var i=new Error(JSON.stringify(n));throw i.metadata=t,i}return r})})}catch(t){return Promise.reject(t)}}({variables:{id:window.btoa("gid://shopify/ProductVariant/"+t)},query:"query($id: ID!) {\n\tnode(id: $id) {\n\t\t...variant\n\t}\n}\nfragment variant on ProductVariant {\n\tid\n\tsku\n\ttitle\n\tprice\n\tcompareAtPrice\n\timage { originalSrc }\n\tproduct {\n\t\tid\n\t\ttitle\n\t\thandle\n\t\tproductType\n\t\tvendor\n\t}\n}"})).then(function(t){return t.node}):Promise.resolve(void 0)}catch(t){return Promise.reject(t)}},p=function(t){try{var r=function(r){return r?function(t){var r=t.product,n="https://"+i+"/products/"+r.handle,o=t.image,c=e(t.id);return{productId:e(r.id),productTitle:r.title,productVariantTitle:r.title+" - "+t.title,productType:r.productType,productVendor:r.vendor,productUrl:n,sku:t.sku,price:t.price,compareAtPrice:t.compareAtPrice,variantId:c,variantTitle:t.title,variantImage:o.originalSrc||t.image,variantUrl:n+"?variant="+c}}(r):console.error("Variant not found",t)};return Promise.resolve("object"==typeof t?r("object"==typeof t?t:l(t)):Promise.resolve("object"==typeof t?t:l(t)).then(r))}catch(t){return Promise.reject(t)}},v=function(t){return{currency:u,item_id:t.sku||t.variantId,item_name:t.productVariantTitle,item_brand:t.productVendor,item_category:t.productType,item_variant:t.variantTitle,price:t.price}},f=function(e){return function(r,n){var i=void 0===n?{}:n,o=i.el,c=i.list,a=i.position;return Promise.resolve(p(r)).then(function(r){var n=a||function(t){var e=t,r=0;if(e)for(e=t.previousElementSibling;e;)r+=1;return r}(o);if(!r)return null;var i=t({},v(r),{index:n});return c&&(i.item_list_name=c),m(e,{ecommerce:{items:[i]}})})}},h=function(e){return function(r){if(r)return m(e,{ecommerce:t({},r)})}},y=function(e,r,n){return Promise.resolve(p(e)).then(function(e){return e?m(n,{ecommerce:{items:[t({},v(e),{quantity:r})]}}):void 0})};return{viewItem:function(t,e){var r=void 0===e?{}:e,n=r.el,i=r.list,o=r.position;return f("view_item")(t,{el:n,list:i,position:o})},selectItem:function(t,e){var r=void 0===e?{}:e,n=r.el,i=r.list,o=r.position;return f("select_item")(t,{el:n,list:i,position:o})},viewItemList:function(t){if(t)return m("view_item_list",{ecommerce:{items:[].concat(t)}})},addToCart:function(t,e){return y(t,e,"add_to_cart")},removeFromCart:function(t,e){return y(t,e,"remove_from_cart")},viewCart:function(t){try{var e=h("view_cart");return Promise.resolve(e(t))}catch(t){return Promise.reject(t)}},beginCheckout:function(t){return h("begin_checkout")(t)},purchase:function(t){return h("purchase")(t)}}};
//# sourceMappingURL=bundle.js.map

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

!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t||self).shopifyGoogleAnalyticsHelper=e()}(this,function(){function t(){return t=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},t.apply(this,arguments)}var e=function(t){var e=t;return String(t).match(/^\d+$/)?t:(t.match(/^gid:\/\//)||(e=window.atob(t)),(e=e.match(/\/([^\/]+)$/))?e[1]:void 0)};return function(r){var n=r.storeUrl,i=void 0===n?"shops.myshopify.com":n,o=r.storefrontToken,c=void 0===o?"":o,a=r.currencyCode,u=void 0===a?"USD":a,d=r.debug,s=void 0!==d&&d,l=function(e,r){return s&&console.log("'"+e+"'",r),window.dataLayer||(window.dataLayer=[]),r.ecommerce&&window.dataLayer.push({ecommerce:null}),window.dataLayer.push(t({event:e},r))},m=function(t){try{return t?Promise.resolve(function(t){try{return Promise.resolve(fetch("https://"+i+"/api/2022-07/graphql",{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json","X-Shopify-Storefront-Access-Token":c},body:JSON.stringify(t)})).then(function(e){return Promise.resolve(e.json()).then(function(e){var r=e.data,n=e.errors;if(n){var i=new Error(JSON.stringify(n));throw i.metadata=t,i}return r})})}catch(t){return Promise.reject(t)}}({variables:{id:window.btoa("gid://shopify/ProductVariant/"+t)},query:"query($id: ID!) {\n\tnode(id: $id) {\n\t\t...variant\n\t}\n}\nfragment variant on ProductVariant {\n\tid\n\tsku\n\ttitle\n\tprice\n\tcompareAtPrice\n\timage { originalSrc }\n\tproduct {\n\t\tid\n\t\ttitle\n\t\thandle\n\t\tproductType\n\t\tvendor\n\t}\n}"})).then(function(t){return t.node}):Promise.resolve(void 0)}catch(t){return Promise.reject(t)}},f=function(t){try{var r=function(r){return r?function(t){var r=t.product,n="https://"+i+"/products/"+r.handle,o=t.image,c=e(t.id);return{productId:e(r.id),productTitle:r.title,productVariantTitle:r.title+" - "+t.title,productType:r.productType,productVendor:r.vendor,productUrl:n,sku:t.sku,price:t.price,compareAtPrice:t.compareAtPrice,variantId:c,variantTitle:t.title,variantImage:o.originalSrc||t.image,variantUrl:n+"?variant="+c}}(r):console.error("Variant not found",t)};return Promise.resolve("object"==typeof t?r("object"==typeof t?t:m(t)):Promise.resolve("object"==typeof t?t:m(t)).then(r))}catch(t){return Promise.reject(t)}},p=function(t){return{currency:u,item_id:t.sku||t.variantId,item_name:t.productVariantTitle,item_brand:t.productVendor,item_category:t.productType,item_variant:t.variantTitle,price:t.price}},v=function(e){return function(r,n){var i=void 0===n?{}:n,o=i.el,c=i.list,a=i.position;return Promise.resolve(f(r)).then(function(r){var n=a||function(t){var e=t,r=0;if(e)for(e=t.previousElementSibling;e;)r+=1;return r}(o);if(!r)return null;var i=t({},p(r),{index:n});return c&&(i.item_list_name=c),l(e,{ecommerce:{items:[i]}})})}},h=function(e){return function(r){if(r)return l(e,{ecommerce:t({},r)})}},y=function(e,r,n){return Promise.resolve(f(e)).then(function(e){return e?l(n,{ecommerce:{items:[t({},p(e),{quantity:r})]}}):void 0})};return{viewItem:function(t,e){var r=void 0===e?{}:e,n=r.el,i=r.list,o=r.position;return v("view_item")(t,{el:n,list:i,position:o})},selectItem:function(t,e){var r=void 0===e?{}:e,n=r.el,i=r.list,o=r.position;return v("select_item")(t,{el:n,list:i,position:o})},viewItemList:function(t){if(t)return l("view_item_list",{ecommerce:{items:[].concat(t)}})},addToCart:function(t,e){return y(t,e,"add_to_cart")},removeFromCart:function(t,e){return y(t,e,"remove_from_cart")},viewCart:function(e){try{return Promise.resolve(e?l("view_cart",{ecommerce:t({},e)}):void 0)}catch(t){return Promise.reject(t)}},beginCheckout:function(t){return h("begin_checkout")(t)},purchase:function(t){return h("purchase")(t)}}}});
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t||self).shopifyGoogleAnalyticsHelper=e()}(this,function(){function t(){return t=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},t.apply(this,arguments)}var e=function(t){var e=t;return String(t).match(/^\d+$/)?t:(t.match(/^gid:\/\//)||(e=window.atob(t)),(e=e.match(/\/([^\/]+)$/))?e[1]:void 0)};return function(r){var n=r.storeUrl,i=void 0===n?"shops.myshopify.com":n,o=r.storefrontToken,c=void 0===o?"":o,a=r.currencyCode,u=void 0===a?"USD":a,d=r.debug,s=void 0!==d&&d,l=function(e,r){return s&&console.log("'"+e+"'",r),window.dataLayer||(window.dataLayer=[]),r.ecommerce&&window.dataLayer.push({ecommerce:null}),window.dataLayer.push(t({event:e},r))},f=function(t){try{return t?Promise.resolve(function(t){try{return Promise.resolve(fetch("https://"+i+"/api/2022-07/graphql",{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json","X-Shopify-Storefront-Access-Token":c},body:JSON.stringify(t)})).then(function(e){return Promise.resolve(e.json()).then(function(e){var r=e.data,n=e.errors;if(n){var i=new Error(JSON.stringify(n));throw i.metadata=t,i}return r})})}catch(t){return Promise.reject(t)}}({variables:{id:window.btoa("gid://shopify/ProductVariant/"+t)},query:"query($id: ID!) {\n\tnode(id: $id) {\n\t\t...variant\n\t}\n}\nfragment variant on ProductVariant {\n\tid\n\tsku\n\ttitle\n\tprice\n\tcompareAtPrice\n\timage { originalSrc }\n\tproduct {\n\t\tid\n\t\ttitle\n\t\thandle\n\t\tproductType\n\t\tvendor\n\t}\n}"})).then(function(t){return t.node}):Promise.resolve(void 0)}catch(t){return Promise.reject(t)}},p=function(t){try{var r=function(r){return r?function(t){var r=t.product,n="https://"+i+"/products/"+r.handle,o=t.image,c=e(t.id);return{productId:e(r.id),productTitle:r.title,productVariantTitle:r.title+" - "+t.title,productType:r.productType,productVendor:r.vendor,productUrl:n,sku:t.sku,price:t.price,compareAtPrice:t.compareAtPrice,variantId:c,variantTitle:t.title,variantImage:o.originalSrc||t.image,variantUrl:n+"?variant="+c}}(r):console.error("Variant not found",t)};return Promise.resolve("object"==typeof t?r("object"==typeof t?t:f(t)):Promise.resolve("object"==typeof t?t:f(t)).then(r))}catch(t){return Promise.reject(t)}},m=function(t){return{currency:u,item_id:t.sku||t.variantId,item_name:t.productVariantTitle,item_brand:t.productVendor,item_category:t.productType,item_variant:t.variantTitle,price:t.price}},v=function(e){return function(r,n){var i=void 0===n?{}:n,o=i.el,c=i.list,a=i.position;return Promise.resolve(p(r)).then(function(r){var n=a||function(t){var e=t,r=0;if(e)for(e=t.previousElementSibling;e;)r+=1;return r}(o);if(!r)return null;var i=t({},m(r),{index:n});return c&&(i.item_list_name=c),l(e,{ecommerce:{items:[i]}})})}},h=function(e){return function(r){if(r)return l(e,{ecommerce:t({},r)})}},y=function(e,r,n){return Promise.resolve(p(e)).then(function(e){return e?l(n,{ecommerce:{items:[t({},m(e),{quantity:r})]}}):void 0})};return{viewItem:function(t,e){var r=void 0===e?{}:e,n=r.el,i=r.list,o=r.position;return v("view_item")(t,{el:n,list:i,position:o})},selectItem:function(t,e){var r=void 0===e?{}:e,n=r.el,i=r.list,o=r.position;return v("select_item")(t,{el:n,list:i,position:o})},viewItemList:function(t){if(t)return l("view_item_list",{ecommerce:{items:[].concat(t)}})},addToCart:function(t,e){return y(t,e,"add_to_cart")},removeFromCart:function(t,e){return y(t,e,"remove_from_cart")},viewCart:function(t){try{var e=h("view_cart");return Promise.resolve(e(t))}catch(t){return Promise.reject(t)}},beginCheckout:function(t){return h("begin_checkout")(t)},purchase:function(t){return h("purchase")(t)}}}});
//# sourceMappingURL=bundle.umd.js.map
{
"name": "shopify-google-analytics-helper",
"version": "0.1.0",
"version": "0.1.1",
"description": "",

@@ -5,0 +5,0 @@ "license": "MIT",

@@ -158,5 +158,5 @@ import { fetchVariantQuery } from "./queries"

const viewCart = async (checkoutOrCartPayload) => {
const checkoutOrCart = (gtmEvent) => (checkoutOrCartPayload) => {
if (checkoutOrCartPayload) {
return pushDataLayerEvent("view_cart", {
return pushDataLayerEvent(gtmEvent, {
ecommerce: {

@@ -171,12 +171,6 @@ ...checkoutOrCartPayload,

const checkoutOrCart = (gtmEvent) => (checkoutOrCartPayload) => {
if (checkoutOrCartPayload) {
return pushDataLayerEvent(gtmEvent, {
ecommerce: {
...checkoutOrCartPayload,
},
})
}
const viewCart = async (checkoutOrCartPayload) => {
const pushEvent = checkoutOrCart("view_cart")
return undefined
return pushEvent(checkoutOrCartPayload)
}

@@ -183,0 +177,0 @@

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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