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

@abtasty/scroll-tracking

Package Overview
Dependencies
Maintainers
31
Versions
56
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@abtasty/scroll-tracking - npm Package Compare versions

Comparing version 3.4.0-2 to 3.4.0-3

2

dist/main.js

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

!function(){"use strict";const e=()=>Object.prototype.hasOwnProperty.call(window,"ABTastyEditor"),t=()=>{const e=!!document.getElementById("ABTastyPreviewBar"),t=location.href.includes("ab_project=preview");return e||t},r=()=>!e()&&(t()||!!window.ABTasty.getTestsOnPage()[TEST_ID]),n="abtasty_resetActionTracking",s="remove",i="rebuild",c=r=>{if((()=>{if(e()||t())return!1;const r=ABTasty.getTestsOnPage()[TEST_ID];return!!r&&Object.keys(r.targetings.qaParameters).length>0})()){const e=(()=>{const e=(()=>{const{type:e}=DATA;return`${PACKAGE.replace("@abtasty/","")}${e?`_${e}`:""}`})();return`${e.charAt(0).toUpperCase()}${e.slice(1)}`.split("-").join(" ")})();window.console.log(`%c${e} - QA Mode for campaign ${TEST_ID}\n${r}`,"background-color: rgba(0, 127, 145, 1); color: rgba(247, 247, 247, 1)")}};class o{constructor(e,t,r,s){this.recurrence=e,this.isWidgetApplied=t,this.callback=r,this.shouldUpdate=s,this.observer=new MutationObserver(this.observerHandler.bind(this)),this.eventListenerParams=[n,this.eventHandler.bind(this),{passive:!0}],this.elementsWaiters=[]}recurrenceIsDone(){return!this.recurrence||this.recurrence.isOver()}decisionHandler(e){const t=r(),{type:n}=this.recurrence?this.recurrence.getCurrentRecurrence():{type:!1};let c;const o=this.isWidgetApplied(),a=(()=>{const t=this.recurrenceIsDone();return e&&"display"===n||t})(),l=!o&&t&&a,u=o&&(!t||!a),d=!o&&!t;return this.shouldUpdate&&!e&&t&&a?c="update":l?c=i:(u||d)&&(c=s),"string"==typeof c&&(this.clearWatcher(),this.callback(c,e),this.watch()),this}eventHandler(){let e=r();return[250,500].forEach(t=>{setTimeout(()=>{const n=r();return 500===t&&n===e?this:(e=n,this.decisionHandler(!1))},t)}),this}observerHandler(e){return e.some(e=>["removedNodes","addedNodes"].some(t=>e[t]&&e[t].length))?this.decisionHandler(!0):this}watch(){if(e())return this;this.clearWatcher(),document.addEventListener(...this.eventListenerParams);const t=()=>{const e=[document.body,{childList:!0,subtree:!0}];this.observer.observe(...e)};return document.body?t():(()=>{const e=((e,t)=>{const r=()=>{try{return document.querySelector(e)}catch(e){return null}};let n=r();const s=[document.body||document.documentElement,{childList:!0,subtree:!0,attributes:!0}],i=()=>o.disconnect(),c=()=>o.observe(...s),o=new MutationObserver(()=>(n=r(),n&&!i()&&t()));return n?setTimeout(()=>t(),0):c(),{selector:e,clear:i,observe:c}})("body",()=>{t(),this.elementsWaiters=this.elementsWaiters.filter(t=>t!==e)});this.elementsWaiters.push(e)})(),this}clearWatcher(){return document.removeEventListener(...this.eventListenerParams),this.elementsWaiters.length&&(this.elementsWaiters.forEach(e=>e.clear()),this.elementsWaiters=[]),this.observer.disconnect(),this}}var a,l,u=!1,d=DATA,h=d.engagementGoal,m=d.customTarget,g=function(){return h.sort(function(e,t){return e.percentage-t.percentage})},v=["scroll",function(){return f()},{passive:!0}],p=[n,function(){l=g()},{passive:!0}],b=function(){(a=a||new o(!1,function(){return u},w)).watch()},y=function(){var e;u=!1;var t=m?document.querySelector(DATA.scrollTarget):window;t.removeEventListener.apply(t,v),(e=document).removeEventListener.apply(e,p),b()},T=function(){var e;u=!0,l=g();var t=m?document.querySelector(DATA.scrollTarget):window;t.addEventListener.apply(t,v),(e=document).addEventListener.apply(e,p),b()},f=function(){var e,t=100*(e=m?document.querySelector(DATA.scrollTarget):document.body).scrollTop/(Math.max(e.scrollHeight,e.offsetHeight,e.clientHeight)-(m?e.innerHeight:window.innerHeight));(l=l.filter(function(e){var r=e.percentage,n=e.name;return!(t>=r&&(ABTastyEvent(n,null,TEST_ID),c('Engagement goal "'.concat(n,'" sent to campaign ').concat(TEST_ID,".")),1))})).length||y()},w=function(e,t){switch(e){case s:y();break;case i:t?b():T()}};e()||(T(),b(),c("Widget launch"))}();
!function(){"use strict";const e=()=>Object.prototype.hasOwnProperty.call(window,"ABTastyEditor"),t=()=>{const e=!!document.getElementById("ABTastyPreviewBar"),t=location.href.includes("ab_project=preview");return e||t},r=()=>!e()&&(t()||!!window.ABTasty.getTestsOnPage()[TEST_ID]),n=(e,t)=>{const r=()=>{try{return document.querySelector(e)}catch(e){return null}};let n=r();const s=[document.body||document.documentElement,{childList:!0,subtree:!0,attributes:!0}],c=()=>o.disconnect(),i=()=>o.observe(...s),o=new MutationObserver(()=>(n=r(),n&&!c()&&t(n)));return n?setTimeout(()=>t(n),0):i(),{selector:e,clear:c,observe:i}},s="abtasty_resetActionTracking",c="remove",i="rebuild",o=r=>{if((()=>{if(e()||t())return!1;const r=ABTasty.getTestsOnPage()[TEST_ID];return!!r&&Object.keys(r.targetings.qaParameters).length>0})()){const e=(()=>{const e=(()=>{const{type:e}=DATA;return`${PACKAGE.replace("@abtasty/","")}${e?`_${e}`:""}`})();return`${e.charAt(0).toUpperCase()}${e.slice(1)}`.split("-").join(" ")})();window.console.log(`%c${e} - QA Mode for campaign ${TEST_ID}\n${r}`,"background-color: rgba(0, 127, 145, 1); color: rgba(247, 247, 247, 1)")}};class a{constructor(e,t,r,n){this.recurrence=e,this.isWidgetApplied=t,this.callback=r,this.shouldUpdate=n,this.observer=new MutationObserver(this.observerHandler.bind(this)),this.eventListenerParams=[s,this.eventHandler.bind(this),{passive:!0}],this.elementsWaiters=[]}recurrenceIsDone(){return!this.recurrence||this.recurrence.isOver()}decisionHandler(e){const t=r(),{type:n}=this.recurrence?this.recurrence.getCurrentRecurrence():{type:!1};let s;const o=this.isWidgetApplied(),a=(()=>{const t=this.recurrenceIsDone();return e&&"display"===n||t})(),l=!o&&t&&a,u=o&&(!t||!a),d=!o&&!t;return this.shouldUpdate&&!e&&t&&a?s="update":l?s=i:(u||d)&&(s=c),"string"==typeof s&&(this.clearWatcher(),this.callback(s,e),this.watch()),this}eventHandler(){let e=r();return[250,500].forEach(t=>{setTimeout(()=>{const n=r();return 500===t&&n===e?this:(e=n,this.decisionHandler(!1))},t)}),this}observerHandler(e){return e.some(e=>["removedNodes","addedNodes"].some(t=>e[t]&&e[t].length))?this.decisionHandler(!0):this}watch(){if(e())return this;this.clearWatcher(),document.addEventListener(...this.eventListenerParams);const t=()=>{const e=[document.body,{childList:!0,subtree:!0}];this.observer.observe(...e)};return document.body?t():(()=>{const e=n("body",()=>{t(),this.elementsWaiters=this.elementsWaiters.filter(t=>t!==e)});this.elementsWaiters.push(e)})(),this}clearWatcher(){return document.removeEventListener(...this.eventListenerParams),this.elementsWaiters.length&&(this.elementsWaiters.forEach(e=>e.clear()),this.elementsWaiters=[]),this.observer.disconnect(),this}}var l,u,d=!1,h=function(){return null},m=DATA,g=m.engagementGoal,v=m.customTarget,p=function(){return g.sort(function(e,t){return e.percentage-t.percentage})},b=["scroll",function(){return w()},{passive:!0}],T=[s,function(){u=p()},{passive:!0}],y=function(){(l=l||new a(!1,function(){return d},E)).watch()},f=function(){var e;d=!1;var t=v?document.querySelector(DATA.scrollTarget):window;t.removeEventListener.apply(t,b),(e=document).removeEventListener.apply(e,T),y()},A=function(){var e;o("Widget launch"),d=!0,u=p();var t=v?document.querySelector(DATA.scrollTarget):window;t.addEventListener.apply(t,b),(e=document).addEventListener.apply(e,T),y()},w=function(){var e,t=100*(e=v?document.querySelector(DATA.scrollTarget):document.body.scrollTop>0?document.body:document.documentElement).scrollTop/(Math.max(e.scrollHeight,e.offsetHeight,e.clientHeight)-(v?e.innerHeight:window.innerHeight));(u=u.filter(function(e){var r=e.percentage,n=e.name;return!(t>=r&&(ABTastyEvent(n,null,TEST_ID),o('Engagement goal "'.concat(n,'" sent to campaign ').concat(TEST_ID,".")),1))})).length||f()},E=function(e,t){switch(e){case c:f(),h();break;case i:if(t)y();else{var r=n(v?DATA.scrollTarget:"body",A);h=r.clear}}};if(!e()){var D=n(v?DATA.scrollTarget:"body",A);h=D.clear,y()}}();
{
"name": "@abtasty/scroll-tracking",
"description": "AB Tasty Widget",
"version": "3.4.0-2",
"version": "3.4.0-3",
"form": "dist/form.js",

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