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

@abtasty/cognitivediscountmaker

Package Overview
Dependencies
Maintainers
22
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@abtasty/cognitivediscountmaker - npm Package Compare versions

Comparing version 1.0.8 to 1.0.10

2

dist/main.js

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

!function(){"use strict";var t="https://api-turing-engine.abtasty.com/api/v1",e=function(t){return Object.keys(t).map(function(e){return encodeURIComponent(e)+"="+encodeURIComponent(t[e])}).join("&")},n=function(n,r,i,o){var a=n.map(function(t){return Object.assign(t,{vas:(e=t,n=e.newPrice,r=e.oldPrice,[r-n,Math.round(100*(1-n/r))])});var e,n,r});return Promise.all(a.map(function(n){var a=n.vas,c=n.newPrice,s=n.oldPrice,l=n.discountContainerElem,d=n.conversionElem;return function(n){var r=n.cid,i=n.vas,o=n.vid,a=n.caid,c=n.c;return new Promise(function(n){return fetch(t+"/suggest?"+e({cid:r,vid:o,caid:a,c:c,vas:i}),{method:"GET"}).then(function(t){return n(t.json())})})}({cid:r,vid:i,vas:"perc,value",caid:o,c:s.toString().replace(".","d")+"_"+c.toString().replace(".","d")}).then(function(t){var e=t.va;return{vas:a,newPrice:c,oldPrice:s,va:e,selectedVa:"value"===e?a[0]:a[1]+"%",discountContainerElem:l,conversionElem:d}})}))},r=function(n,r,i){!function(n){var r=n.cid,i=n.vid,o=n.caid,a=n.c,c=n.a;fetch(t+"/convert?"+e({cid:r,vid:i,caid:o,c:a,a:c}),{method:"GET"})}({cid:n,vid:r,c:i,caid:"undefined"!=typeof TEST_ID?TEST_ID:n,a:0})};!function(t,e){void 0===e&&(e={});var n=e.insertAt;if(t&&"undefined"!=typeof document){var r=document.head||document.getElementsByTagName("head")[0],i=document.createElement("style");i.type="text/css","top"===n&&r.firstChild?r.insertBefore(i,r.firstChild):r.appendChild(i),i.styleSheet?i.styleSheet.cssText=t:i.appendChild(document.createTextNode(t))}}("abtasty-modal{display:none;z-index:1000000}abtasty-modal,abtasty-modal__underlay{position:fixed;top:0;left:0;width:100%;height:100%}abtasty-modal__underlay{background-color:rgba(0,0,0,.5);cursor:pointer}.abtasty-modal__area{top:0;left:0;right:0;width:auto;margin:10px!important;max-height:70%;z-index:100;position:relative;background-color:#fff;border:3px solid #fff;box-shadow:0 0 10px #666;-moz-box-shadow:#666 0 0 10px;-webkit-box-shadow:#666 0 0 10px;text-align:left}.abtasty-modal__close{float:right!important;font-size:44px;font-weight:300;background:transparent;border:0;color:#bbb;font-family:Helvetica Neue,Helvetica,Arial,sans-serif!important;line-height:32px!important;margin-right:5px;cursor:pointer}.abtasty-modal__text{padding:20px;font-family:Open Sans,sans-serif!important;color:#000}.abtasty-modal__title{text-align:left;width:auto;font-size:31px!important;font-weight:500;line-height:1.1;margin-bottom:10px}.abtasty-modal__text p{margin:0 0 10px!important;font-size:15px;font-weight:300}@media (min-width:630px){.abtasty-modal__area{width:600px;margin:150px auto!important}}");var i=function(t){var e=Object.prototype.hasOwnProperty;function n(t,r){return Array.isArray(t)?function(t,e){for(var r,i="",o="",c=Array.isArray(e),s=0;s<t.length;s++)(r=n(t[s]))&&(c&&e[s]&&(r=a(r)),i=i+o+r,o=" ");return i}(t,r):t&&"object"==typeof t?function(t){var n="",r="";for(var i in t)i&&t[i]&&e.call(t,i)&&(n=n+r+i,r=" ");return n}(t):t||""}function r(t){if(!t)return"";if("object"==typeof t){var n="";for(var r in t)e.call(t,r)&&(n=n+r+":"+t[r]+";");return n}return t+""}function i(t,e,n,r){if(!1===e||null==e||!e&&("class"===t||"style"===t))return"";if(!0===e)return" "+(r?t:t+'="'+t+'"');var i=typeof e;return"object"!==i&&"function"!==i||"function"!=typeof e.toJSON||(e=e.toJSON()),"string"==typeof e||(e=JSON.stringify(e),n||-1===e.indexOf('"'))?(n&&(e=a(e))," "+t+'="'+e+'"'):" "+t+"='"+e.replace(/'/g,"&#39;")+"'"}t.merge=function t(e,n){if(1===arguments.length){for(var i=e[0],o=1;o<e.length;o++)i=t(i,e[o]);return i}for(var a in n)if("class"===a){var c=e[a]||[];e[a]=(Array.isArray(c)?c:[c]).concat(n[a]||[])}else if("style"===a){var c=r(e[a]);c=c&&";"!==c[c.length-1]?c+";":c;var s=r(n[a]);s=s&&";"!==s[s.length-1]?s+";":s,e[a]=c+s}else e[a]=n[a];return e},t.classes=n,t.style=r,t.attr=i,t.attrs=function(t,o){var a="";for(var c in t)if(e.call(t,c)){var s=t[c];if("class"===c){s=n(s),a=i(c,s,!1,o)+a;continue}"style"===c&&(s=r(s)),a+=i(c,s,!1,o)}return a};var o=/["&<>]/;function a(t){var e=""+t,n=o.exec(e);if(!n)return t;var r,i,a,c="";for(r=n.index,i=0;r<e.length;r++){switch(e.charCodeAt(r)){case 34:a="&quot;";break;case 38:a="&amp;";break;case 60:a="&lt;";break;case 62:a="&gt;";break;default:continue}i!==r&&(c+=e.substring(i,r)),i=r+1,c+=a}return i!==r?c+e.substring(i,r):c}return t.escape=a,t.rethrow=function t(e,n,r,i){if(!(e instanceof Error))throw e;if(!("undefined"==typeof window&&n||i))throw e.message+=" on line "+r,e;try{i=i||require("fs").readFileSync(n,"utf8")}catch(n){t(e,null,r)}var o=3,a=i.split("\n"),c=Math.max(r-o,0),s=Math.min(a.length,r+o);var o=a.slice(c,s).map(function(t,e){var n=e+c+1;return(n==r?" > ":" ")+n+"| "+t}).join("\n");e.path=n;e.message=(n||"Pug")+":"+r+"\n"+o+"\n\n"+e.message;throw e},t}({});function o(t){var e,n="";try{var r={},o=t||{};(function(t,r){n=(n=(n+="<div>")+'<div class="abtasty-price_tag"'+i.attr("style",i.style(r),!0,!0)+">")+i.escape(null==(e=t)?"":e)+"</div></div>"}).call(this,"price"in o?o.price:"undefined"!=typeof price?price:void 0,"style"in o?o.style:"undefined"!=typeof style?style:void 0)}catch(t){i.rethrow(t,void 0,void 0,r[void 0])}return n}var a=function(t){var e=window.document,n=t.getBoundingClientRect();return n.top>=0&&n.left>=0&&n.right<=(window.innerWidth||e.documentElement.clientWidth)&&n.bottom<=(window.innerHeight||e.documentElement.clientHeight)&&null!==t.offsetParent},c=function(t){var e=t.replace(/[^0-9,.€$£¥]+/g,"");return e=e.replace(/[€$£¥,]+/g,"."),parseFloat(e)},s=window.ABTasty&&window.ABTasty.visitor&&window.ABTasty.visitor.id||"noVisitorId",l=window.ABTasty&&window.ABTasty.accountSettings&&window.ABTasty.accountSettings.identifier||"noIdentifier",d=function(t){var e=t.target.dataset.abtastyDiscount||"";e&&r(l,s,e.indexOf("%")>-1?"perc":"value")},u=function(t){var e=t.oldPriceSelector,r=t.newPriceSelector,i=t.discountContainerSelector,u=t.conversionSelector,f=t.displayAction,p=t.styleReplace,y=t.currency,v=t.currencyPosition,m=t.backgroundColor,h=t.textColor,b=t.fontSize,g=t.fontWeight,w=t.borderColor,x=t.borderWidth,S=t.borderRadius,E=t.DEBUG_ALGO_MODE,A=function(t){for(var e=t.oldPriceSelector,n=t.newPriceSelector,r=t.discountContainerSelector,i=t.conversionSelector,o=t.displayAction,s=[],l=document.querySelectorAll(e),d=0;d<l.length;d++){var u=l.item(d);a(u)&&!u.dataset.abtastyDiscountHandled&&s.push(u)}var f=[n,r,i],p=[];return s.forEach(function(t){for(var e=function(t,e){for(var n=t,r=!1;!r&&n.parentElement;)(r=e.every(function(t){return n.querySelector(t)}))||(n=n.parentElement);return n}(t,f),a=[],s=e.querySelectorAll(n),l=0;l<s.length;l++){var d=s.item(l);null!==d.offsetParent&&a.push(d)}if(!(a.length>1||e.querySelector(".abtasty-price_tag"))){var u=e.querySelector(i),y=e.querySelector(r);if(!u.dataset.abtastyDiscount){"replace"===o&&(y.setAttribute("data-abtasty-old-visibility",y.style.visibility),y.style.visibility="hidden"),t.setAttribute("data-abtasty-discount-handled","1");var v=c(t.textContent),m=c(a[0].textContent);Number.isNaN(v)||Number.isNaN(m)||p.push({oldPrice:v,newPrice:m,discountContainerElem:y,conversionElem:u})}}}),p}({oldPriceSelector:e,newPriceSelector:r,discountContainerSelector:i,conversionSelector:u,displayAction:f});return document.querySelectorAll(u).forEach(function(t){t.removeEventListener("click",d),t.addEventListener("click",d)}),function(t,e,r){var i="undefined"!=typeof TEST_ID?TEST_ID:t;return 0===r.length?Promise.resolve([]):n(r,t,e,i)}(l,s,A).then(function(t){return function(t){var e=t.productsArray,n=t.displayAction,r=t.styleReplace,i=t.currency,a=t.currencyPosition,c=t.style;e.forEach(function(t){if(t.selectedVa){var e=t.selectedVa.toString(),s=e.indexOf("%")>-1?"- "+e:"- "+("before"===a?i:"")+(Math.round(100*e)/100).toFixed(0)+("after"===a?i:"");switch(t.conversionElem.setAttribute("data-abtasty-discount",t.oldPrice+"_"+t.newPrice),n){case"replace":if(r){var l=o({price:s,style:c});t.discountContainerElem.innerHTML=l}else t.discountContainerElem.textContent=s;break;case"append":var d=o({price:s,style:c});t.discountContainerElem.innerHTML+=d}void 0!==t.discountContainerElem.dataset.abtastyOldVisibility&&(t.discountContainerElem.style.visibility=t.discountContainerElem.dataset.abtastyOldVisibility||"inherit")}})}({productsArray:t,displayAction:f,styleReplace:p,currency:y,currencyPosition:v,debugDisplay:E,style:{"background-color":m,color:h,"font-size":b+"px","font-weight":g,"border-color":w,"border-width":x+"px","border-radius":S+"px","border-style":"solid",display:"inline-block",padding:"5px"}})})};!function t(){u(DATA).then(function(){window.setTimeout(function(){t()},100)})}()}();
!function(){"use strict";var t="https://api-turing-engine.abtasty.com/api/v1",e=function(t){return Object.keys(t).map(function(e){return encodeURIComponent(e)+"="+encodeURIComponent(t[e])}).join("&")},n=function(n,r,i,o){var a=n.map(function(t){return Object.assign(t,{vas:(e=t,n=e.newPrice,r=e.oldPrice,[r-n,Math.round(100*(1-n/r))])});var e,n,r});return Promise.all(a.map(function(n){var a=n.vas,c=n.newPrice,s=n.oldPrice,l=n.discountContainerElem,d=n.conversionElem;return function(n){var r=n.cid,i=n.vas,o=n.vid,a=n.caid,c=n.c;return new Promise(function(n){return fetch(t+"/suggest?"+e({cid:r,vid:o,caid:a,c:c,vas:i}),{method:"GET"}).then(function(t){return n(t.json())})})}({cid:r,vid:i,vas:"perc,value",caid:o,c:s.toString().replace(".","d")+"_"+c.toString().replace(".","d")}).then(function(t){var e=t.va;return{vas:a,newPrice:c,oldPrice:s,va:e,selectedVa:"value"===e?a[0]:a[1]+"%",discountContainerElem:l,conversionElem:d}})}))},r=function(n,r,i){!function(n){var r=n.cid,i=n.vid,o=n.caid,a=n.c,c=n.a;fetch(t+"/convert?"+e({cid:r,vid:i,caid:o,c:a,a:c}),{method:"GET"})}({cid:n,vid:r,c:i,caid:"undefined"!=typeof TEST_ID?TEST_ID:n,a:0})};!function(t,e){void 0===e&&(e={});var n=e.insertAt;if(t&&"undefined"!=typeof document){var r=document.head||document.getElementsByTagName("head")[0],i=document.createElement("style");i.type="text/css","top"===n&&r.firstChild?r.insertBefore(i,r.firstChild):r.appendChild(i),i.styleSheet?i.styleSheet.cssText=t:i.appendChild(document.createTextNode(t))}}("abtasty-modal{display:none;z-index:1000000}abtasty-modal,abtasty-modal__underlay{position:fixed;top:0;left:0;width:100%;height:100%}abtasty-modal__underlay{background-color:rgba(0,0,0,.5);cursor:pointer}.abtasty-modal__area{top:0;left:0;right:0;width:auto;margin:10px!important;max-height:70%;z-index:100;position:relative;background-color:#fff;border:3px solid #fff;box-shadow:0 0 10px #666;-moz-box-shadow:#666 0 0 10px;-webkit-box-shadow:#666 0 0 10px;text-align:left}.abtasty-modal__close{float:right!important;font-size:44px;font-weight:300;background:transparent;border:0;color:#bbb;font-family:Helvetica Neue,Helvetica,Arial,sans-serif!important;line-height:32px!important;margin-right:5px;cursor:pointer}.abtasty-modal__text{padding:20px;font-family:Open Sans,sans-serif!important;color:#000}.abtasty-modal__title{text-align:left;width:auto;font-size:31px!important;font-weight:500;line-height:1.1;margin-bottom:10px}.abtasty-modal__text p{margin:0 0 10px!important;font-size:15px;font-weight:300}@media (min-width:630px){.abtasty-modal__area{width:600px;margin:150px auto!important}}");var i=function(t){var e=Object.prototype.hasOwnProperty;function n(t,r){return Array.isArray(t)?function(t,e){for(var r,i="",o="",c=Array.isArray(e),s=0;s<t.length;s++)(r=n(t[s]))&&(c&&e[s]&&(r=a(r)),i=i+o+r,o=" ");return i}(t,r):t&&"object"==typeof t?function(t){var n="",r="";for(var i in t)i&&t[i]&&e.call(t,i)&&(n=n+r+i,r=" ");return n}(t):t||""}function r(t){if(!t)return"";if("object"==typeof t){var n="";for(var r in t)e.call(t,r)&&(n=n+r+":"+t[r]+";");return n}return t+""}function i(t,e,n,r){if(!1===e||null==e||!e&&("class"===t||"style"===t))return"";if(!0===e)return" "+(r?t:t+'="'+t+'"');var i=typeof e;return"object"!==i&&"function"!==i||"function"!=typeof e.toJSON||(e=e.toJSON()),"string"==typeof e||(e=JSON.stringify(e),n||-1===e.indexOf('"'))?(n&&(e=a(e))," "+t+'="'+e+'"'):" "+t+"='"+e.replace(/'/g,"&#39;")+"'"}t.merge=function t(e,n){if(1===arguments.length){for(var i=e[0],o=1;o<e.length;o++)i=t(i,e[o]);return i}for(var a in n)if("class"===a){var c=e[a]||[];e[a]=(Array.isArray(c)?c:[c]).concat(n[a]||[])}else if("style"===a){var c=r(e[a]);c=c&&";"!==c[c.length-1]?c+";":c;var s=r(n[a]);s=s&&";"!==s[s.length-1]?s+";":s,e[a]=c+s}else e[a]=n[a];return e},t.classes=n,t.style=r,t.attr=i,t.attrs=function(t,o){var a="";for(var c in t)if(e.call(t,c)){var s=t[c];if("class"===c){s=n(s),a=i(c,s,!1,o)+a;continue}"style"===c&&(s=r(s)),a+=i(c,s,!1,o)}return a};var o=/["&<>]/;function a(t){var e=""+t,n=o.exec(e);if(!n)return t;var r,i,a,c="";for(r=n.index,i=0;r<e.length;r++){switch(e.charCodeAt(r)){case 34:a="&quot;";break;case 38:a="&amp;";break;case 60:a="&lt;";break;case 62:a="&gt;";break;default:continue}i!==r&&(c+=e.substring(i,r)),i=r+1,c+=a}return i!==r?c+e.substring(i,r):c}return t.escape=a,t.rethrow=function t(e,n,r,i){if(!(e instanceof Error))throw e;if(!("undefined"==typeof window&&n||i))throw e.message+=" on line "+r,e;try{i=i||require("fs").readFileSync(n,"utf8")}catch(n){t(e,null,r)}var o=3,a=i.split("\n"),c=Math.max(r-o,0),s=Math.min(a.length,r+o);var o=a.slice(c,s).map(function(t,e){var n=e+c+1;return(n==r?" > ":" ")+n+"| "+t}).join("\n");e.path=n;e.message=(n||"Pug")+":"+r+"\n"+o+"\n\n"+e.message;throw e},t}({});function o(t){var e,n="";try{var r={},o=t||{};(function(t,r){n=(n=(n+="<div>")+'<div class="abtasty-price_tag"'+i.attr("style",i.style(r),!0,!0)+">")+i.escape(null==(e=t)?"":e)+"</div></div>"}).call(this,"price"in o?o.price:"undefined"!=typeof price?price:void 0,"style"in o?o.style:"undefined"!=typeof style?style:void 0)}catch(t){i.rethrow(t,void 0,void 0,r[void 0])}return n}var a=function(t){var e=window.document,n=t.getBoundingClientRect();return n.top>=0&&n.left>=0&&n.right<=(window.innerWidth||e.documentElement.clientWidth)&&n.bottom<=(window.innerHeight||e.documentElement.clientHeight)&&null!==t.offsetParent},c=function(t){var e=t.replace(/[^0-9,.€$£¥]+/g,"");return e=e.replace(/[€$£¥,]+/g,"."),parseFloat(e)},s=window.ABTasty&&window.ABTasty.visitor&&window.ABTasty.visitor.id||"noVisitorId",l=window.ABTasty&&window.ABTasty.accountSettings&&window.ABTasty.accountSettings.identifier||"noIdentifier",d=function(t){var e=t.target.dataset.abtastyDiscount||"";e&&r(l,s,e.indexOf("%")>-1?"perc":"value")},u=function(t){var e=t.oldPriceSelector,r=t.newPriceSelector,i=t.discountContainerSelector,u=t.conversionSelector,f=t.displayAction,p=t.styleReplace,y=t.currency,v=t.currencyPosition,m=t.backgroundColor,h=t.textColor,b=t.fontSize,g=t.fontWeight,w=t.borderColor,x=t.borderWidth,S=t.borderRadius,E=t.DEBUG_ALGO_MODE,A=function(t){for(var e=t.oldPriceSelector,n=t.newPriceSelector,r=t.discountContainerSelector,i=t.conversionSelector,o=t.displayAction,s=[],l=document.querySelectorAll(e),d=0;d<l.length;d++){var u=l.item(d);a(u)&&!u.dataset.abtastyDiscountHandled&&s.push(u)}var f=[n,r,i],p=[];return s.forEach(function(t){for(var e=function(t,e){for(var n=t,r=!1;!r&&n.parentElement;)(r=e.every(function(t){return n.querySelector(t)}))||(n=n.parentElement);return n}(t,f),a=[],s=e.querySelectorAll(n),l=0;l<s.length;l++){var d=s.item(l);null!==d.offsetParent&&a.push(d)}if(!(a.length>1||e.querySelector(".abtasty-price_tag"))){var u=e.querySelector(i),y=e.querySelector(r);if(!u.dataset.abtastyDiscount){"replace"===o&&(y.setAttribute("data-abtasty-old-visibility",y.style.visibility),y.style.visibility="hidden"),t.setAttribute("data-abtasty-discount-handled","1");var v=c(t.textContent),m=c(a[0].textContent);Number.isNaN(v)||Number.isNaN(m)||p.push({oldPrice:v,newPrice:m,discountContainerElem:y,conversionElem:u})}}}),p}({oldPriceSelector:e,newPriceSelector:r,discountContainerSelector:i,conversionSelector:u,displayAction:f});return document.querySelectorAll(u).forEach(function(t){t.removeEventListener("click",d),t.addEventListener("click",d)}),function(t,e,r){var i="undefined"!=typeof TEST_ID?TEST_ID:t;return 0===r.length?Promise.resolve([]):n(r,t,e,i)}(l,s,A).then(function(t){return function(t){var e=t.productsArray,n=t.displayAction,r=t.styleReplace,i=t.currency,a=t.currencyPosition,c=t.style;e.forEach(function(t){if(t.selectedVa){var e=t.selectedVa.toString(),s=e.indexOf("%")>-1?"- "+e:"- "+("before"===a?i:"")+(Math.round(100*e)/100).toFixed(2)+("after"===a?i:"");switch(t.conversionElem.setAttribute("data-abtasty-discount",t.oldPrice+"_"+t.newPrice),n){case"replace":if(r){var l=o({price:s,style:c});t.discountContainerElem.innerHTML=l}else t.discountContainerElem.textContent=s;break;case"append":var d=o({price:s,style:c});t.discountContainerElem.innerHTML+=d}void 0!==t.discountContainerElem.dataset.abtastyOldVisibility&&(t.discountContainerElem.style.visibility=t.discountContainerElem.dataset.abtastyOldVisibility||"inherit")}})}({productsArray:t,displayAction:f,styleReplace:p,currency:y,currencyPosition:v,debugDisplay:E,style:{"background-color":m,color:h,"font-size":b+"px","font-weight":g,"border-color":w,"border-width":x+"px","border-radius":S+"px","border-style":"solid",display:"inline-block",padding:"5px"}})})};!function t(){u(DATA).then(function(){window.setTimeout(function(){t()},100)})}()}();
{
"name": "@abtasty/cognitivediscountmaker",
"description": "A simple widget",
"version": "1.0.8",
"version": "1.0.10",
"main": "dist/main.js",

@@ -6,0 +6,0 @@ "form": "dist/form.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