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

@folklore/tracking

Package Overview
Dependencies
Maintainers
6
Versions
19
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@folklore/tracking - npm Package Compare versions

Comparing version 0.0.18 to 0.0.19

58

dist/cjs.js

@@ -22,9 +22,15 @@ 'use strict';

disabled: false,
paused: false,
variables: null,
...opts
};
this.variables = null;
const {
disabled = false,
paused = false,
variables = null
} = this.options;
this.disabled = disabled;
this.paused = paused;
this.variables = null;
this.pending = [];
if (variables !== null) {

@@ -37,3 +43,3 @@ this.setVariables(variables);

if (variables !== null) {
this.push(variables);
this.pushNow(variables);
}

@@ -44,4 +50,27 @@ }

}
setDisabled(disabled) {
this.disabled = disabled;
if (disabled) {
this.pending = [];
}
}
setPaused(paused) {
this.paused = paused;
if (!paused && this.pending.length > 0) {
this.push(...this.pending);
this.pending = [];
}
}
pushNow() {
const {
dataLayer
} = this.options;
if (dataLayer === null || this.disabled) {
return;
}
dataLayer.push(...arguments);
}
push() {
const {
paused = false,
disabled = false,

@@ -53,2 +82,6 @@ dataLayer

}
if (paused) {
this.pending.push(...arguments);
return;
}
dataLayer.push(...arguments);

@@ -104,2 +137,3 @@ }

disabled: PropTypes__default["default"].bool,
paused: PropTypes__default["default"].bool,
children: PropTypes__default["default"].node

@@ -110,13 +144,20 @@ };

disabled: false,
paused: false,
children: null
};
const TrackingContainer = _ref => {
function TrackingContainer(_ref) {
let {
children,
tracking,
disabled
disabled,
paused
} = _ref;
const finalTracking = React.useMemo(() => tracking || new Tracking$1({
disabled
}), [tracking, disabled]);
disabled,
paused
}), [tracking]);
React.useEffect(() => {
finalTracking.setDisabled(disabled);
finalTracking.setPaused(paused);
}, [disabled, paused]);
return /*#__PURE__*/jsxRuntime.jsx(TrackingContext$1.Provider, {

@@ -126,9 +167,8 @@ value: finalTracking,

});
};
}
TrackingContainer.propTypes = propTypes;
TrackingContainer.defaultProps = defaultProps;
var TrackingContainer$1 = TrackingContainer;
exports.Tracking = Tracking$1;
exports.TrackingContainer = TrackingContainer$1;
exports.TrackingContainer = TrackingContainer;
exports.TrackingContext = TrackingContext$1;

@@ -135,0 +175,0 @@ exports["default"] = Tracking$1;

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

import React, { useContext, useMemo } from 'react';
import React, { useContext, useMemo, useEffect } from 'react';
import { jsx } from 'react/jsx-runtime';

@@ -13,9 +13,15 @@ import PropTypes from 'prop-types';

disabled: false,
paused: false,
variables: null,
...opts
};
this.variables = null;
const {
disabled = false,
paused = false,
variables = null
} = this.options;
this.disabled = disabled;
this.paused = paused;
this.variables = null;
this.pending = [];
if (variables !== null) {

@@ -28,3 +34,3 @@ this.setVariables(variables);

if (variables !== null) {
this.push(variables);
this.pushNow(variables);
}

@@ -35,4 +41,27 @@ }

}
setDisabled(disabled) {
this.disabled = disabled;
if (disabled) {
this.pending = [];
}
}
setPaused(paused) {
this.paused = paused;
if (!paused && this.pending.length > 0) {
this.push(...this.pending);
this.pending = [];
}
}
pushNow() {
const {
dataLayer
} = this.options;
if (dataLayer === null || this.disabled) {
return;
}
dataLayer.push(...arguments);
}
push() {
const {
paused = false,
disabled = false,

@@ -44,2 +73,6 @@ dataLayer

}
if (paused) {
this.pending.push(...arguments);
return;
}
dataLayer.push(...arguments);

@@ -95,2 +128,3 @@ }

disabled: PropTypes.bool,
paused: PropTypes.bool,
children: PropTypes.node

@@ -101,13 +135,20 @@ };

disabled: false,
paused: false,
children: null
};
const TrackingContainer = _ref => {
function TrackingContainer(_ref) {
let {
children,
tracking,
disabled
disabled,
paused
} = _ref;
const finalTracking = useMemo(() => tracking || new Tracking$1({
disabled
}), [tracking, disabled]);
disabled,
paused
}), [tracking]);
useEffect(() => {
finalTracking.setDisabled(disabled);
finalTracking.setPaused(paused);
}, [disabled, paused]);
return /*#__PURE__*/jsx(TrackingContext$1.Provider, {

@@ -117,7 +158,6 @@ value: finalTracking,

});
};
}
TrackingContainer.propTypes = propTypes;
TrackingContainer.defaultProps = defaultProps;
var TrackingContainer$1 = TrackingContainer;
export { Tracking$1 as Tracking, TrackingContainer$1 as TrackingContainer, TrackingContext$1 as TrackingContext, Tracking$1 as default, useTracking$1 as useTracking, withTracking$1 as withTracking };
export { Tracking$1 as Tracking, TrackingContainer, TrackingContext$1 as TrackingContext, Tracking$1 as default, useTracking$1 as useTracking, withTracking$1 as withTracking };

4

package.json
{
"name": "@folklore/tracking",
"version": "0.0.18",
"version": "0.0.19",
"description": "Tracking utilities",

@@ -53,3 +53,3 @@ "keywords": [

},
"gitHead": "8ca870e7a04ded6520bb09927ba6c60b0cd80883"
"gitHead": "54de87f37c0aa4d953722261fb1403af9493eb73"
}
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