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

@uidu/analytics

Package Overview
Dependencies
Maintainers
1
Versions
85
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@uidu/analytics - npm Package Compare versions

Comparing version 0.6.8 to 0.6.9

6

CHANGELOG.md
# @uidu/analytics
## 0.6.9
### Patch Changes
- 24cefc2cb: Bump dependencies
## 0.6.8

@@ -4,0 +10,0 @@

2

dist/package.json
{
"name": "@uidu/analytics",
"version": "0.6.8"
"version": "0.6.9"
}

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

};
var AnalyticsContext = /*#__PURE__*/function (_Component) {
_inherits(AnalyticsContext, _Component);
var _super = _createSuper(AnalyticsContext);
function AnalyticsContext(props) {
var _this;
_classCallCheck(this, AnalyticsContext);
_this = _super.call(this, props);
_defineProperty(_assertThisInitialized(_this), "getChildContext", function () {

@@ -58,3 +52,2 @@ return {

});
_defineProperty(_assertThisInitialized(_this), "getAnalyticsContext", function () {

@@ -66,3 +59,2 @@ var data = _this.props.data;

});
_defineProperty(_assertThisInitialized(_this), "getAnalyticsEventHandlers", function () {

@@ -73,3 +65,2 @@ var getAnalyticsEventHandlers = _this.context.getAnalyticsEventHandlers;

});
_this.state = {

@@ -81,3 +72,2 @@ getAnalyticsContext: _this.getAnalyticsContext,

}
_createClass(AnalyticsContext, [{

@@ -93,8 +83,5 @@ key: "render",

}]);
return AnalyticsContext;
}(React.Component);
_defineProperty(AnalyticsContext, "contextTypes", ContextTypes$1);
_defineProperty(AnalyticsContext, "childContextTypes", ContextTypes$1);

@@ -105,7 +92,4 @@

var _this = this;
_classCallCheck(this, AnalyticsEvent);
_defineProperty(this, "payload", void 0);
_defineProperty(this, "clone", function () {

@@ -120,6 +104,4 @@ // We stringify and parse here to get a hacky "deep clone" of the object.

});
this.payload = props.payload;
}
_createClass(AnalyticsEvent, [{

@@ -131,11 +113,8 @@ key: "update",

}
if (_typeof(updater) === 'object') {
this.payload = _objectSpread(_objectSpread({}, this.payload), updater);
}
return this;
}
}]);
return AnalyticsEvent;

@@ -146,18 +125,10 @@ }();

_inherits(UIAnalyticsEvent, _AnalyticsEvent);
var _super = _createSuper(UIAnalyticsEvent);
function UIAnalyticsEvent(props) {
var _this;
_classCallCheck(this, UIAnalyticsEvent);
_this = _super.call(this, props);
_defineProperty(_assertThisInitialized(_this), "context", void 0);
_defineProperty(_assertThisInitialized(_this), "handlers", void 0);
_defineProperty(_assertThisInitialized(_this), "hasFired", void 0);
_defineProperty(_assertThisInitialized(_this), "clone", function () {

@@ -169,6 +140,5 @@ if (_this.hasFired) {

}
var context = _toConsumableArray(_this.context);
var handlers = _toConsumableArray(_this.handlers);
var handlers = _toConsumableArray(_this.handlers);
/**

@@ -179,4 +149,2 @@ * A hacky "deep clone" of the object. This is limited in that it wont

*/
var payload = JSON.parse(JSON.stringify(_this.payload));

@@ -189,3 +157,2 @@ return new UIAnalyticsEvent({

});
_defineProperty(_assertThisInitialized(_this), "fire", function (channel) {

@@ -197,10 +164,7 @@ if (_this.hasFired) {

}
_this.handlers.forEach(function (handler) {
return handler(_assertThisInitialized(_this), channel);
});
_this.hasFired = true;
});
_this.context = props.context || [];

@@ -211,3 +175,2 @@ _this.handlers = props.handlers || [];

}
_createClass(UIAnalyticsEvent, [{

@@ -221,7 +184,5 @@ key: "update",

}
return _get(_getPrototypeOf(UIAnalyticsEvent.prototype), "update", this).call(this, updater);
}
}]);
return UIAnalyticsEvent;

@@ -237,5 +198,3 @@ }(AnalyticsEvent);

_inherits(AnalyticsContextConsumer, _React$Component);
var _super = _createSuper(AnalyticsContextConsumer);
/**

@@ -245,13 +204,9 @@ * Store references to the original and patched event props so we can

*/
function AnalyticsContextConsumer(_props) {
var _this;
_classCallCheck(this, AnalyticsContextConsumer);
_this = _super.call(this, _props);
_defineProperty(_assertThisInitialized(_this), "originalEventProps", {});
_defineProperty(_assertThisInitialized(_this), "patchedEventProps", {});
_defineProperty(_assertThisInitialized(_this), "updatePatchedEventProps", function (props) {

@@ -261,3 +216,2 @@ var changedPropCallbacks = Object.keys(_this.props.createEventMap).filter(function (p) {

});
if (changedPropCallbacks.length > 0) {

@@ -269,6 +223,4 @@ _this.patchedEventProps = _objectSpread(_objectSpread({}, _this.patchedEventProps), _this.mapCreateEventsToProps(changedPropCallbacks, props));

}
return _this.patchedEventProps;
});
_defineProperty(_assertThisInitialized(_this), "mapCreateEventsToProps", function (changedPropNames, props) {

@@ -278,10 +230,7 @@ return changedPropNames.reduce(function (modified, propCallbackName) {

var providedCallback = props[propCallbackName];
if (!['object', 'function'].includes(_typeof(eventCreator))) {
return modified;
}
var modifiedCallback = function modifiedCallback() {
var analyticsEvent = typeof eventCreator === 'function' ? eventCreator(_this.createAnalyticsEvent, props) : _this.createAnalyticsEvent(eventCreator);
if (providedCallback) {

@@ -291,15 +240,12 @@ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {

}
providedCallback.apply(void 0, args.concat([analyticsEvent]));
}
};
return _objectSpread(_objectSpread({}, modified), {}, _defineProperty({}, propCallbackName, modifiedCallback));
}, {});
});
_defineProperty(_assertThisInitialized(_this), "createAnalyticsEvent", function (payload) {
var _this$context = _this.context,
getAnalyticsEventHandlers = _this$context.getAnalyticsEventHandlers,
getAnalyticsContext = _this$context.getAnalyticsContext;
getAnalyticsEventHandlers = _this$context.getAnalyticsEventHandlers,
getAnalyticsContext = _this$context.getAnalyticsContext;
return new UIAnalyticsEvent({

@@ -311,3 +257,2 @@ context: typeof getAnalyticsContext === 'function' && getAnalyticsContext() || [],

});
Object.keys(_this.props.createEventMap).forEach(function (p) {

@@ -318,5 +263,5 @@ _this.originalEventProps[p] = _props.wrappedComponentProps[p];

return _this;
} // Update patched event props only if the original props have changed
}
// Update patched event props only if the original props have changed
_createClass(AnalyticsContextConsumer, [{

@@ -332,6 +277,4 @@ key: "render",

}]);
return AnalyticsContextConsumer;
}(React__default["default"].Component);
_defineProperty(AnalyticsContextConsumer, "contextTypes", {

@@ -341,3 +284,2 @@ getAnalyticsEventHandlers: PropTypes__default["default"].func,

});
_defineProperty(AnalyticsContextConsumer, "defaultProps", {

@@ -355,3 +297,3 @@ createEventMap: {}

var createAnalyticsEvent = _ref.createAnalyticsEvent,
patchedEventProps = _ref.patchedEventProps;
patchedEventProps = _ref.patchedEventProps;
return /*#__PURE__*/jsxRuntime.jsx(WrappedComponent, _objectSpread(_objectSpread(_objectSpread({}, props), patchedEventProps), {}, {

@@ -363,4 +305,5 @@ createAnalyticsEvent: createAnalyticsEvent,

});
}); // @ts-ignore
});
// @ts-ignore
WithAnalyticsEvents.displayName = "WithAnalyticsEvents(".concat(WrappedComponent.displayName || WrappedComponent.name, ")");

@@ -374,24 +317,17 @@ return WithAnalyticsEvents;

};
var BaseAnalyticsErrorBoundary = /*#__PURE__*/function (_Component) {
_inherits(BaseAnalyticsErrorBoundary, _Component);
var _super = _createSuper(BaseAnalyticsErrorBoundary);
function BaseAnalyticsErrorBoundary() {
var _this;
_classCallCheck(this, BaseAnalyticsErrorBoundary);
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
_this = _super.call.apply(_super, [this].concat(args));
_defineProperty(_assertThisInitialized(_this), "fireAnalytics", function (analyticsErrorPayload) {
var _this$props = _this.props,
createAnalyticsEvent = _this$props.createAnalyticsEvent,
channel = _this$props.channel,
data = _this$props.data;
createAnalyticsEvent = _this$props.createAnalyticsEvent,
channel = _this$props.channel,
data = _this$props.data;
createAnalyticsEvent({

@@ -405,6 +341,4 @@ action: 'UnhandledError',

});
return _this;
}
_createClass(BaseAnalyticsErrorBoundary, [{

@@ -423,4 +357,4 @@ key: "componentDidCatch",

var _this$props2 = this.props,
data = _this$props2.data,
children = _this$props2.children;
data = _this$props2.data,
children = _this$props2.children;
return /*#__PURE__*/jsxRuntime.jsx(AnalyticsContext, {

@@ -432,3 +366,2 @@ data: data,

}]);
return BaseAnalyticsErrorBoundary;

@@ -441,19 +374,12 @@ }(React.Component);

};
var AnalyticsListener = /*#__PURE__*/function (_Component) {
_inherits(AnalyticsListener, _Component);
var _super = _createSuper(AnalyticsListener);
function AnalyticsListener() {
var _this;
_classCallCheck(this, AnalyticsListener);
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
_this = _super.call.apply(_super, [this].concat(args));
_defineProperty(_assertThisInitialized(_this), "getChildContext", function () {

@@ -464,10 +390,8 @@ return {

});
_defineProperty(_assertThisInitialized(_this), "getAnalyticsEventHandlers", function () {
var _this$props = _this.props,
channel = _this$props.channel,
onEvent = _this$props.onEvent;
channel = _this$props.channel,
onEvent = _this$props.onEvent;
var getAnalyticsEventHandlers = _this.context.getAnalyticsEventHandlers;
var parentEventHandlers = typeof getAnalyticsEventHandlers === 'function' && getAnalyticsEventHandlers() || [];
var handler = function handler(event, eventChannel) {

@@ -478,9 +402,6 @@ if (channel === '*' || channel === eventChannel) {

};
return [handler].concat(_toConsumableArray(parentEventHandlers));
});
return _this;
}
_createClass(AnalyticsListener, [{

@@ -490,5 +411,5 @@ key: "render",

var _this$context$getAnal = this.context.getAnalyticsContext,
getAnalyticsContext = _this$context$getAnal === void 0 ? function () {
return [];
} : _this$context$getAnal;
getAnalyticsContext = _this$context$getAnal === void 0 ? function () {
return [];
} : _this$context$getAnal;
var children = this.props.children;

@@ -504,8 +425,5 @@ return /*#__PURE__*/jsxRuntime.jsx(AnalyticsReactContext.Provider, {

}]);
return AnalyticsListener;
}(React.Component);
_defineProperty(AnalyticsListener, "contextTypes", ContextTypes);
_defineProperty(AnalyticsListener, "childContextTypes", ContextTypes);

@@ -516,4 +434,3 @@

props.createAnalyticsEvent;
var cleanedProps = _objectWithoutProperties(props, _excluded$1);
var cleanedProps = _objectWithoutProperties(props, _excluded$1);
return cleanedProps;

@@ -527,7 +444,5 @@ }

var clonedEvent = consumerEvent.clone();
if (clonedEvent) {
clonedEvent.fire(channel);
}
return consumerEvent;

@@ -540,5 +455,4 @@ };

var _useContext = React.useContext(AnalyticsReactContext),
getAnalyticsEventHandlers = _useContext.getAnalyticsEventHandlers,
getAnalyticsContext = _useContext.getAnalyticsContext;
getAnalyticsEventHandlers = _useContext.getAnalyticsEventHandlers,
getAnalyticsContext = _useContext.getAnalyticsContext;
if ((getAnalyticsEventHandlers === null || getAnalyticsContext === null) && process.env.NODE_ENV !== 'production') {

@@ -548,3 +462,2 @@ /* eslint-disable-next-line no-console */

}
var createAnalyticsEvent = React.useCallback(function (payload) {

@@ -564,7 +477,7 @@ return new UIAnalyticsEvent({

var _useAnalyticsEvents = useAnalyticsEvents(),
createAnalyticsEvent = _useAnalyticsEvents.createAnalyticsEvent; // given input might be new function/object each render
createAnalyticsEvent = _useAnalyticsEvents.createAnalyticsEvent;
// given input might be new function/object each render
// we optimise and store in refs so we can memoize the callback
// and at the same time avoid stale values
var methodRef = React.useRef(method);

@@ -599,16 +512,15 @@ var payloadRef = React.useRef(payload);

var fn = _ref.fn,
action = _ref.action,
componentName = _ref.componentName,
actionSubject = _ref.actionSubject,
packageName = _ref.packageName,
packageVersion = _ref.packageVersion,
analyticsData = _ref.analyticsData;
action = _ref.action,
componentName = _ref.componentName,
actionSubject = _ref.actionSubject,
packageName = _ref.packageName,
packageVersion = _ref.packageVersion,
analyticsData = _ref.analyticsData;
var _useAnalyticsEvents = useAnalyticsEvents(),
createAnalyticsEvent = _useAnalyticsEvents.createAnalyticsEvent;
var _useAnalyticsEvents = useAnalyticsEvents(),
createAnalyticsEvent = _useAnalyticsEvents.createAnalyticsEvent; // We put analyticsData and fn in a ref so that we don't need to break
// We put analyticsData and fn in a ref so that we don't need to break
// memoization.
// Generally these could be defined by consumers inline
// and so we do this to avoid breaking memoization of useCallback
var dataRef = useTrackedRef(analyticsData);

@@ -625,6 +537,7 @@ var fnRef = useTrackedRef(fn);

}
}); // To avoid wrapping this component in AnalyticsContext we manually
});
// To avoid wrapping this component in AnalyticsContext we manually
// push the parent context's meta data into the context.
// Note: this new 'context'
var context = _objectSpread({

@@ -635,15 +548,16 @@ componentName: componentName,

}, dataRef.current);
analyticsEvent.context.push(context);
analyticsEvent.context.push(context); // fire an event on the atlaskit channel
// fire an event on the atlaskit channel
var clone = analyticsEvent.clone();
if (clone) {
clone.fire('atlaskit');
}
fnRef.current(value, analyticsEvent);
}, [// These are strings and won't change
action, componentName, actionSubject, packageName, packageVersion, // This function is memoized in the context
createAnalyticsEvent, // these are a stable ref because of the useTrackedRef hook
}, [
// These are strings and won't change
action, componentName, actionSubject, packageName, packageVersion,
// This function is memoized in the context
createAnalyticsEvent,
// these are a stable ref because of the useTrackedRef hook
dataRef, fnRef]);

@@ -661,15 +575,14 @@ return handler;

var fn = _ref.fn,
action = _ref.action,
componentName = _ref.componentName,
packageName = _ref.packageName,
packageVersion = _ref.packageVersion,
analyticsData = _ref.analyticsData;
action = _ref.action,
componentName = _ref.componentName,
packageName = _ref.packageName,
packageVersion = _ref.packageVersion,
analyticsData = _ref.analyticsData;
var _useAnalyticsEvents = useAnalyticsEvents(),
createAnalyticsEvent = _useAnalyticsEvents.createAnalyticsEvent;
var _useAnalyticsEvents = useAnalyticsEvents(),
createAnalyticsEvent = _useAnalyticsEvents.createAnalyticsEvent; // We put analyticsData and fn in a ref so that we don't need to break
// We put analyticsData and fn in a ref so that we don't need to break
// memoization.
// Generally these could be defined by consumers inline
// and so we do this to avoid breaking memoization of useCallback
var dataRef = useTrackedRef(analyticsData);

@@ -686,6 +599,7 @@ var fnRef = useTrackedRef(fn);

}
}); // To avoid wrapping this component in AnalyticsContext we manually
});
// To avoid wrapping this component in AnalyticsContext we manually
// push the parent context's meta data into the context.
// Note: this new 'context'
var context = _objectSpread({

@@ -696,15 +610,16 @@ componentName: componentName,

}, dataRef.current);
analyticsEvent.context.push(context);
analyticsEvent.context.push(context); // fire an event on the atlaskit channel
// fire an event on the atlaskit channel
var clone = analyticsEvent.clone();
if (clone) {
clone.fire('atlaskit');
}
fnRef.current(analyticsEvent);
}, [// These are strings and won't change
action, componentName, packageName, packageVersion, // This function is memoized in the context
createAnalyticsEvent, // these are a stable ref because of the useTrackedRef hook
}, [
// These are strings and won't change
action, componentName, packageName, packageVersion,
// This function is memoized in the context
createAnalyticsEvent,
// these are a stable ref because of the useTrackedRef hook
dataRef, fnRef]);

@@ -715,3 +630,2 @@ return handler;

var _excluded = ["analyticsContext"];
var withAnalyticsContext = function withAnalyticsContext(defaultData) {

@@ -721,7 +635,5 @@ return function (WrappedComponent) {

var _props$analyticsConte = props.analyticsContext,
analyticsContext = _props$analyticsConte === void 0 ? {} : _props$analyticsConte,
rest = _objectWithoutProperties(props, _excluded);
analyticsContext = _props$analyticsConte === void 0 ? {} : _props$analyticsConte,
rest = _objectWithoutProperties(props, _excluded);
var analyticsData = _objectSpread(_objectSpread({}, defaultData), analyticsContext);
return /*#__PURE__*/jsxRuntime.jsx(AnalyticsContext, {

@@ -733,4 +645,5 @@ data: analyticsData,

});
}); // @ts-ignore
});
// @ts-ignore
WithAnalyticsContext.displayName = "WithAnalyticsContext(".concat(WrappedComponent.displayName || WrappedComponent.name, ")");

@@ -737,0 +650,0 @@ return WithAnalyticsContext;

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

};
var AnalyticsContext = /*#__PURE__*/function (_Component) {
_inherits(AnalyticsContext, _Component);
var _super = _createSuper(AnalyticsContext);
function AnalyticsContext(props) {
var _this;
_classCallCheck(this, AnalyticsContext);
_this = _super.call(this, props);
_defineProperty(_assertThisInitialized(_this), "getChildContext", function () {

@@ -58,3 +52,2 @@ return {

});
_defineProperty(_assertThisInitialized(_this), "getAnalyticsContext", function () {

@@ -66,3 +59,2 @@ var data = _this.props.data;

});
_defineProperty(_assertThisInitialized(_this), "getAnalyticsEventHandlers", function () {

@@ -73,3 +65,2 @@ var getAnalyticsEventHandlers = _this.context.getAnalyticsEventHandlers;

});
_this.state = {

@@ -81,3 +72,2 @@ getAnalyticsContext: _this.getAnalyticsContext,

}
_createClass(AnalyticsContext, [{

@@ -93,8 +83,5 @@ key: "render",

}]);
return AnalyticsContext;
}(React.Component);
_defineProperty(AnalyticsContext, "contextTypes", ContextTypes$1);
_defineProperty(AnalyticsContext, "childContextTypes", ContextTypes$1);

@@ -105,7 +92,4 @@

var _this = this;
_classCallCheck(this, AnalyticsEvent);
_defineProperty(this, "payload", void 0);
_defineProperty(this, "clone", function () {

@@ -120,6 +104,4 @@ // We stringify and parse here to get a hacky "deep clone" of the object.

});
this.payload = props.payload;
}
_createClass(AnalyticsEvent, [{

@@ -131,11 +113,8 @@ key: "update",

}
if (_typeof(updater) === 'object') {
this.payload = _objectSpread(_objectSpread({}, this.payload), updater);
}
return this;
}
}]);
return AnalyticsEvent;

@@ -146,18 +125,10 @@ }();

_inherits(UIAnalyticsEvent, _AnalyticsEvent);
var _super = _createSuper(UIAnalyticsEvent);
function UIAnalyticsEvent(props) {
var _this;
_classCallCheck(this, UIAnalyticsEvent);
_this = _super.call(this, props);
_defineProperty(_assertThisInitialized(_this), "context", void 0);
_defineProperty(_assertThisInitialized(_this), "handlers", void 0);
_defineProperty(_assertThisInitialized(_this), "hasFired", void 0);
_defineProperty(_assertThisInitialized(_this), "clone", function () {

@@ -169,6 +140,5 @@ if (_this.hasFired) {

}
var context = _toConsumableArray(_this.context);
var handlers = _toConsumableArray(_this.handlers);
var handlers = _toConsumableArray(_this.handlers);
/**

@@ -179,4 +149,2 @@ * A hacky "deep clone" of the object. This is limited in that it wont

*/
var payload = JSON.parse(JSON.stringify(_this.payload));

@@ -189,3 +157,2 @@ return new UIAnalyticsEvent({

});
_defineProperty(_assertThisInitialized(_this), "fire", function (channel) {

@@ -197,10 +164,7 @@ if (_this.hasFired) {

}
_this.handlers.forEach(function (handler) {
return handler(_assertThisInitialized(_this), channel);
});
_this.hasFired = true;
});
_this.context = props.context || [];

@@ -211,3 +175,2 @@ _this.handlers = props.handlers || [];

}
_createClass(UIAnalyticsEvent, [{

@@ -221,7 +184,5 @@ key: "update",

}
return _get(_getPrototypeOf(UIAnalyticsEvent.prototype), "update", this).call(this, updater);
}
}]);
return UIAnalyticsEvent;

@@ -237,5 +198,3 @@ }(AnalyticsEvent);

_inherits(AnalyticsContextConsumer, _React$Component);
var _super = _createSuper(AnalyticsContextConsumer);
/**

@@ -245,13 +204,9 @@ * Store references to the original and patched event props so we can

*/
function AnalyticsContextConsumer(_props) {
var _this;
_classCallCheck(this, AnalyticsContextConsumer);
_this = _super.call(this, _props);
_defineProperty(_assertThisInitialized(_this), "originalEventProps", {});
_defineProperty(_assertThisInitialized(_this), "patchedEventProps", {});
_defineProperty(_assertThisInitialized(_this), "updatePatchedEventProps", function (props) {

@@ -261,3 +216,2 @@ var changedPropCallbacks = Object.keys(_this.props.createEventMap).filter(function (p) {

});
if (changedPropCallbacks.length > 0) {

@@ -269,6 +223,4 @@ _this.patchedEventProps = _objectSpread(_objectSpread({}, _this.patchedEventProps), _this.mapCreateEventsToProps(changedPropCallbacks, props));

}
return _this.patchedEventProps;
});
_defineProperty(_assertThisInitialized(_this), "mapCreateEventsToProps", function (changedPropNames, props) {

@@ -278,10 +230,7 @@ return changedPropNames.reduce(function (modified, propCallbackName) {

var providedCallback = props[propCallbackName];
if (!['object', 'function'].includes(_typeof(eventCreator))) {
return modified;
}
var modifiedCallback = function modifiedCallback() {
var analyticsEvent = typeof eventCreator === 'function' ? eventCreator(_this.createAnalyticsEvent, props) : _this.createAnalyticsEvent(eventCreator);
if (providedCallback) {

@@ -291,15 +240,12 @@ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {

}
providedCallback.apply(void 0, args.concat([analyticsEvent]));
}
};
return _objectSpread(_objectSpread({}, modified), {}, _defineProperty({}, propCallbackName, modifiedCallback));
}, {});
});
_defineProperty(_assertThisInitialized(_this), "createAnalyticsEvent", function (payload) {
var _this$context = _this.context,
getAnalyticsEventHandlers = _this$context.getAnalyticsEventHandlers,
getAnalyticsContext = _this$context.getAnalyticsContext;
getAnalyticsEventHandlers = _this$context.getAnalyticsEventHandlers,
getAnalyticsContext = _this$context.getAnalyticsContext;
return new UIAnalyticsEvent({

@@ -311,3 +257,2 @@ context: typeof getAnalyticsContext === 'function' && getAnalyticsContext() || [],

});
Object.keys(_this.props.createEventMap).forEach(function (p) {

@@ -318,5 +263,5 @@ _this.originalEventProps[p] = _props.wrappedComponentProps[p];

return _this;
} // Update patched event props only if the original props have changed
}
// Update patched event props only if the original props have changed
_createClass(AnalyticsContextConsumer, [{

@@ -332,6 +277,4 @@ key: "render",

}]);
return AnalyticsContextConsumer;
}(React__default["default"].Component);
_defineProperty(AnalyticsContextConsumer, "contextTypes", {

@@ -341,3 +284,2 @@ getAnalyticsEventHandlers: PropTypes__default["default"].func,

});
_defineProperty(AnalyticsContextConsumer, "defaultProps", {

@@ -355,3 +297,3 @@ createEventMap: {}

var createAnalyticsEvent = _ref.createAnalyticsEvent,
patchedEventProps = _ref.patchedEventProps;
patchedEventProps = _ref.patchedEventProps;
return /*#__PURE__*/jsxRuntime.jsx(WrappedComponent, _objectSpread(_objectSpread(_objectSpread({}, props), patchedEventProps), {}, {

@@ -363,4 +305,5 @@ createAnalyticsEvent: createAnalyticsEvent,

});
}); // @ts-ignore
});
// @ts-ignore
WithAnalyticsEvents.displayName = "WithAnalyticsEvents(".concat(WrappedComponent.displayName || WrappedComponent.name, ")");

@@ -374,24 +317,17 @@ return WithAnalyticsEvents;

};
var BaseAnalyticsErrorBoundary = /*#__PURE__*/function (_Component) {
_inherits(BaseAnalyticsErrorBoundary, _Component);
var _super = _createSuper(BaseAnalyticsErrorBoundary);
function BaseAnalyticsErrorBoundary() {
var _this;
_classCallCheck(this, BaseAnalyticsErrorBoundary);
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
_this = _super.call.apply(_super, [this].concat(args));
_defineProperty(_assertThisInitialized(_this), "fireAnalytics", function (analyticsErrorPayload) {
var _this$props = _this.props,
createAnalyticsEvent = _this$props.createAnalyticsEvent,
channel = _this$props.channel,
data = _this$props.data;
createAnalyticsEvent = _this$props.createAnalyticsEvent,
channel = _this$props.channel,
data = _this$props.data;
createAnalyticsEvent({

@@ -405,6 +341,4 @@ action: 'UnhandledError',

});
return _this;
}
_createClass(BaseAnalyticsErrorBoundary, [{

@@ -423,4 +357,4 @@ key: "componentDidCatch",

var _this$props2 = this.props,
data = _this$props2.data,
children = _this$props2.children;
data = _this$props2.data,
children = _this$props2.children;
return /*#__PURE__*/jsxRuntime.jsx(AnalyticsContext, {

@@ -432,3 +366,2 @@ data: data,

}]);
return BaseAnalyticsErrorBoundary;

@@ -441,19 +374,12 @@ }(React.Component);

};
var AnalyticsListener = /*#__PURE__*/function (_Component) {
_inherits(AnalyticsListener, _Component);
var _super = _createSuper(AnalyticsListener);
function AnalyticsListener() {
var _this;
_classCallCheck(this, AnalyticsListener);
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
_this = _super.call.apply(_super, [this].concat(args));
_defineProperty(_assertThisInitialized(_this), "getChildContext", function () {

@@ -464,10 +390,8 @@ return {

});
_defineProperty(_assertThisInitialized(_this), "getAnalyticsEventHandlers", function () {
var _this$props = _this.props,
channel = _this$props.channel,
onEvent = _this$props.onEvent;
channel = _this$props.channel,
onEvent = _this$props.onEvent;
var getAnalyticsEventHandlers = _this.context.getAnalyticsEventHandlers;
var parentEventHandlers = typeof getAnalyticsEventHandlers === 'function' && getAnalyticsEventHandlers() || [];
var handler = function handler(event, eventChannel) {

@@ -478,9 +402,6 @@ if (channel === '*' || channel === eventChannel) {

};
return [handler].concat(_toConsumableArray(parentEventHandlers));
});
return _this;
}
_createClass(AnalyticsListener, [{

@@ -490,5 +411,5 @@ key: "render",

var _this$context$getAnal = this.context.getAnalyticsContext,
getAnalyticsContext = _this$context$getAnal === void 0 ? function () {
return [];
} : _this$context$getAnal;
getAnalyticsContext = _this$context$getAnal === void 0 ? function () {
return [];
} : _this$context$getAnal;
var children = this.props.children;

@@ -504,8 +425,5 @@ return /*#__PURE__*/jsxRuntime.jsx(AnalyticsReactContext.Provider, {

}]);
return AnalyticsListener;
}(React.Component);
_defineProperty(AnalyticsListener, "contextTypes", ContextTypes);
_defineProperty(AnalyticsListener, "childContextTypes", ContextTypes);

@@ -516,4 +434,3 @@

props.createAnalyticsEvent;
var cleanedProps = _objectWithoutProperties(props, _excluded$1);
var cleanedProps = _objectWithoutProperties(props, _excluded$1);
return cleanedProps;

@@ -527,7 +444,5 @@ }

var clonedEvent = consumerEvent.clone();
if (clonedEvent) {
clonedEvent.fire(channel);
}
return consumerEvent;

@@ -540,5 +455,4 @@ };

var _useContext = React.useContext(AnalyticsReactContext),
getAnalyticsEventHandlers = _useContext.getAnalyticsEventHandlers,
getAnalyticsContext = _useContext.getAnalyticsContext;
getAnalyticsEventHandlers = _useContext.getAnalyticsEventHandlers,
getAnalyticsContext = _useContext.getAnalyticsContext;
if ((getAnalyticsEventHandlers === null || getAnalyticsContext === null) && "production" !== 'production') {

@@ -548,3 +462,2 @@ /* eslint-disable-next-line no-console */

}
var createAnalyticsEvent = React.useCallback(function (payload) {

@@ -564,7 +477,7 @@ return new UIAnalyticsEvent({

var _useAnalyticsEvents = useAnalyticsEvents(),
createAnalyticsEvent = _useAnalyticsEvents.createAnalyticsEvent; // given input might be new function/object each render
createAnalyticsEvent = _useAnalyticsEvents.createAnalyticsEvent;
// given input might be new function/object each render
// we optimise and store in refs so we can memoize the callback
// and at the same time avoid stale values
var methodRef = React.useRef(method);

@@ -599,16 +512,15 @@ var payloadRef = React.useRef(payload);

var fn = _ref.fn,
action = _ref.action,
componentName = _ref.componentName,
actionSubject = _ref.actionSubject,
packageName = _ref.packageName,
packageVersion = _ref.packageVersion,
analyticsData = _ref.analyticsData;
action = _ref.action,
componentName = _ref.componentName,
actionSubject = _ref.actionSubject,
packageName = _ref.packageName,
packageVersion = _ref.packageVersion,
analyticsData = _ref.analyticsData;
var _useAnalyticsEvents = useAnalyticsEvents(),
createAnalyticsEvent = _useAnalyticsEvents.createAnalyticsEvent;
var _useAnalyticsEvents = useAnalyticsEvents(),
createAnalyticsEvent = _useAnalyticsEvents.createAnalyticsEvent; // We put analyticsData and fn in a ref so that we don't need to break
// We put analyticsData and fn in a ref so that we don't need to break
// memoization.
// Generally these could be defined by consumers inline
// and so we do this to avoid breaking memoization of useCallback
var dataRef = useTrackedRef(analyticsData);

@@ -625,6 +537,7 @@ var fnRef = useTrackedRef(fn);

}
}); // To avoid wrapping this component in AnalyticsContext we manually
});
// To avoid wrapping this component in AnalyticsContext we manually
// push the parent context's meta data into the context.
// Note: this new 'context'
var context = _objectSpread({

@@ -635,15 +548,16 @@ componentName: componentName,

}, dataRef.current);
analyticsEvent.context.push(context);
analyticsEvent.context.push(context); // fire an event on the atlaskit channel
// fire an event on the atlaskit channel
var clone = analyticsEvent.clone();
if (clone) {
clone.fire('atlaskit');
}
fnRef.current(value, analyticsEvent);
}, [// These are strings and won't change
action, componentName, actionSubject, packageName, packageVersion, // This function is memoized in the context
createAnalyticsEvent, // these are a stable ref because of the useTrackedRef hook
}, [
// These are strings and won't change
action, componentName, actionSubject, packageName, packageVersion,
// This function is memoized in the context
createAnalyticsEvent,
// these are a stable ref because of the useTrackedRef hook
dataRef, fnRef]);

@@ -661,15 +575,14 @@ return handler;

var fn = _ref.fn,
action = _ref.action,
componentName = _ref.componentName,
packageName = _ref.packageName,
packageVersion = _ref.packageVersion,
analyticsData = _ref.analyticsData;
action = _ref.action,
componentName = _ref.componentName,
packageName = _ref.packageName,
packageVersion = _ref.packageVersion,
analyticsData = _ref.analyticsData;
var _useAnalyticsEvents = useAnalyticsEvents(),
createAnalyticsEvent = _useAnalyticsEvents.createAnalyticsEvent;
var _useAnalyticsEvents = useAnalyticsEvents(),
createAnalyticsEvent = _useAnalyticsEvents.createAnalyticsEvent; // We put analyticsData and fn in a ref so that we don't need to break
// We put analyticsData and fn in a ref so that we don't need to break
// memoization.
// Generally these could be defined by consumers inline
// and so we do this to avoid breaking memoization of useCallback
var dataRef = useTrackedRef(analyticsData);

@@ -686,6 +599,7 @@ var fnRef = useTrackedRef(fn);

}
}); // To avoid wrapping this component in AnalyticsContext we manually
});
// To avoid wrapping this component in AnalyticsContext we manually
// push the parent context's meta data into the context.
// Note: this new 'context'
var context = _objectSpread({

@@ -696,15 +610,16 @@ componentName: componentName,

}, dataRef.current);
analyticsEvent.context.push(context);
analyticsEvent.context.push(context); // fire an event on the atlaskit channel
// fire an event on the atlaskit channel
var clone = analyticsEvent.clone();
if (clone) {
clone.fire('atlaskit');
}
fnRef.current(analyticsEvent);
}, [// These are strings and won't change
action, componentName, packageName, packageVersion, // This function is memoized in the context
createAnalyticsEvent, // these are a stable ref because of the useTrackedRef hook
}, [
// These are strings and won't change
action, componentName, packageName, packageVersion,
// This function is memoized in the context
createAnalyticsEvent,
// these are a stable ref because of the useTrackedRef hook
dataRef, fnRef]);

@@ -715,3 +630,2 @@ return handler;

var _excluded = ["analyticsContext"];
var withAnalyticsContext = function withAnalyticsContext(defaultData) {

@@ -721,7 +635,5 @@ return function (WrappedComponent) {

var _props$analyticsConte = props.analyticsContext,
analyticsContext = _props$analyticsConte === void 0 ? {} : _props$analyticsConte,
rest = _objectWithoutProperties(props, _excluded);
analyticsContext = _props$analyticsConte === void 0 ? {} : _props$analyticsConte,
rest = _objectWithoutProperties(props, _excluded);
var analyticsData = _objectSpread(_objectSpread({}, defaultData), analyticsContext);
return /*#__PURE__*/jsxRuntime.jsx(AnalyticsContext, {

@@ -733,4 +645,5 @@ data: analyticsData,

});
}); // @ts-ignore
});
// @ts-ignore
WithAnalyticsContext.displayName = "WithAnalyticsContext(".concat(WrappedComponent.displayName || WrappedComponent.name, ")");

@@ -737,0 +650,0 @@ return WithAnalyticsContext;

@@ -30,15 +30,9 @@ import _toConsumableArray from '@babel/runtime/helpers/esm/toConsumableArray';

};
var AnalyticsContext = /*#__PURE__*/function (_Component) {
_inherits(AnalyticsContext, _Component);
var _super = _createSuper(AnalyticsContext);
function AnalyticsContext(props) {
var _this;
_classCallCheck(this, AnalyticsContext);
_this = _super.call(this, props);
_defineProperty(_assertThisInitialized(_this), "getChildContext", function () {

@@ -49,3 +43,2 @@ return {

});
_defineProperty(_assertThisInitialized(_this), "getAnalyticsContext", function () {

@@ -57,3 +50,2 @@ var data = _this.props.data;

});
_defineProperty(_assertThisInitialized(_this), "getAnalyticsEventHandlers", function () {

@@ -64,3 +56,2 @@ var getAnalyticsEventHandlers = _this.context.getAnalyticsEventHandlers;

});
_this.state = {

@@ -72,3 +63,2 @@ getAnalyticsContext: _this.getAnalyticsContext,

}
_createClass(AnalyticsContext, [{

@@ -84,8 +74,5 @@ key: "render",

}]);
return AnalyticsContext;
}(Component);
_defineProperty(AnalyticsContext, "contextTypes", ContextTypes$1);
_defineProperty(AnalyticsContext, "childContextTypes", ContextTypes$1);

@@ -96,7 +83,4 @@

var _this = this;
_classCallCheck(this, AnalyticsEvent);
_defineProperty(this, "payload", void 0);
_defineProperty(this, "clone", function () {

@@ -111,6 +95,4 @@ // We stringify and parse here to get a hacky "deep clone" of the object.

});
this.payload = props.payload;
}
_createClass(AnalyticsEvent, [{

@@ -122,11 +104,8 @@ key: "update",

}
if (_typeof(updater) === 'object') {
this.payload = _objectSpread(_objectSpread({}, this.payload), updater);
}
return this;
}
}]);
return AnalyticsEvent;

@@ -137,18 +116,10 @@ }();

_inherits(UIAnalyticsEvent, _AnalyticsEvent);
var _super = _createSuper(UIAnalyticsEvent);
function UIAnalyticsEvent(props) {
var _this;
_classCallCheck(this, UIAnalyticsEvent);
_this = _super.call(this, props);
_defineProperty(_assertThisInitialized(_this), "context", void 0);
_defineProperty(_assertThisInitialized(_this), "handlers", void 0);
_defineProperty(_assertThisInitialized(_this), "hasFired", void 0);
_defineProperty(_assertThisInitialized(_this), "clone", function () {

@@ -160,6 +131,5 @@ if (_this.hasFired) {

}
var context = _toConsumableArray(_this.context);
var handlers = _toConsumableArray(_this.handlers);
var handlers = _toConsumableArray(_this.handlers);
/**

@@ -170,4 +140,2 @@ * A hacky "deep clone" of the object. This is limited in that it wont

*/
var payload = JSON.parse(JSON.stringify(_this.payload));

@@ -180,3 +148,2 @@ return new UIAnalyticsEvent({

});
_defineProperty(_assertThisInitialized(_this), "fire", function (channel) {

@@ -188,10 +155,7 @@ if (_this.hasFired) {

}
_this.handlers.forEach(function (handler) {
return handler(_assertThisInitialized(_this), channel);
});
_this.hasFired = true;
});
_this.context = props.context || [];

@@ -202,3 +166,2 @@ _this.handlers = props.handlers || [];

}
_createClass(UIAnalyticsEvent, [{

@@ -212,7 +175,5 @@ key: "update",

}
return _get(_getPrototypeOf(UIAnalyticsEvent.prototype), "update", this).call(this, updater);
}
}]);
return UIAnalyticsEvent;

@@ -228,5 +189,3 @@ }(AnalyticsEvent);

_inherits(AnalyticsContextConsumer, _React$Component);
var _super = _createSuper(AnalyticsContextConsumer);
/**

@@ -236,13 +195,9 @@ * Store references to the original and patched event props so we can

*/
function AnalyticsContextConsumer(_props) {
var _this;
_classCallCheck(this, AnalyticsContextConsumer);
_this = _super.call(this, _props);
_defineProperty(_assertThisInitialized(_this), "originalEventProps", {});
_defineProperty(_assertThisInitialized(_this), "patchedEventProps", {});
_defineProperty(_assertThisInitialized(_this), "updatePatchedEventProps", function (props) {

@@ -252,3 +207,2 @@ var changedPropCallbacks = Object.keys(_this.props.createEventMap).filter(function (p) {

});
if (changedPropCallbacks.length > 0) {

@@ -260,6 +214,4 @@ _this.patchedEventProps = _objectSpread(_objectSpread({}, _this.patchedEventProps), _this.mapCreateEventsToProps(changedPropCallbacks, props));

}
return _this.patchedEventProps;
});
_defineProperty(_assertThisInitialized(_this), "mapCreateEventsToProps", function (changedPropNames, props) {

@@ -269,10 +221,7 @@ return changedPropNames.reduce(function (modified, propCallbackName) {

var providedCallback = props[propCallbackName];
if (!['object', 'function'].includes(_typeof(eventCreator))) {
return modified;
}
var modifiedCallback = function modifiedCallback() {
var analyticsEvent = typeof eventCreator === 'function' ? eventCreator(_this.createAnalyticsEvent, props) : _this.createAnalyticsEvent(eventCreator);
if (providedCallback) {

@@ -282,15 +231,12 @@ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {

}
providedCallback.apply(void 0, args.concat([analyticsEvent]));
}
};
return _objectSpread(_objectSpread({}, modified), {}, _defineProperty({}, propCallbackName, modifiedCallback));
}, {});
});
_defineProperty(_assertThisInitialized(_this), "createAnalyticsEvent", function (payload) {
var _this$context = _this.context,
getAnalyticsEventHandlers = _this$context.getAnalyticsEventHandlers,
getAnalyticsContext = _this$context.getAnalyticsContext;
getAnalyticsEventHandlers = _this$context.getAnalyticsEventHandlers,
getAnalyticsContext = _this$context.getAnalyticsContext;
return new UIAnalyticsEvent({

@@ -302,3 +248,2 @@ context: typeof getAnalyticsContext === 'function' && getAnalyticsContext() || [],

});
Object.keys(_this.props.createEventMap).forEach(function (p) {

@@ -309,5 +254,5 @@ _this.originalEventProps[p] = _props.wrappedComponentProps[p];

return _this;
} // Update patched event props only if the original props have changed
}
// Update patched event props only if the original props have changed
_createClass(AnalyticsContextConsumer, [{

@@ -323,6 +268,4 @@ key: "render",

}]);
return AnalyticsContextConsumer;
}(React.Component);
_defineProperty(AnalyticsContextConsumer, "contextTypes", {

@@ -332,3 +275,2 @@ getAnalyticsEventHandlers: PropTypes.func,

});
_defineProperty(AnalyticsContextConsumer, "defaultProps", {

@@ -346,3 +288,3 @@ createEventMap: {}

var createAnalyticsEvent = _ref.createAnalyticsEvent,
patchedEventProps = _ref.patchedEventProps;
patchedEventProps = _ref.patchedEventProps;
return /*#__PURE__*/jsx(WrappedComponent, _objectSpread(_objectSpread(_objectSpread({}, props), patchedEventProps), {}, {

@@ -354,4 +296,5 @@ createAnalyticsEvent: createAnalyticsEvent,

});
}); // @ts-ignore
});
// @ts-ignore
WithAnalyticsEvents.displayName = "WithAnalyticsEvents(".concat(WrappedComponent.displayName || WrappedComponent.name, ")");

@@ -365,24 +308,17 @@ return WithAnalyticsEvents;

};
var BaseAnalyticsErrorBoundary = /*#__PURE__*/function (_Component) {
_inherits(BaseAnalyticsErrorBoundary, _Component);
var _super = _createSuper(BaseAnalyticsErrorBoundary);
function BaseAnalyticsErrorBoundary() {
var _this;
_classCallCheck(this, BaseAnalyticsErrorBoundary);
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
_this = _super.call.apply(_super, [this].concat(args));
_defineProperty(_assertThisInitialized(_this), "fireAnalytics", function (analyticsErrorPayload) {
var _this$props = _this.props,
createAnalyticsEvent = _this$props.createAnalyticsEvent,
channel = _this$props.channel,
data = _this$props.data;
createAnalyticsEvent = _this$props.createAnalyticsEvent,
channel = _this$props.channel,
data = _this$props.data;
createAnalyticsEvent({

@@ -396,6 +332,4 @@ action: 'UnhandledError',

});
return _this;
}
_createClass(BaseAnalyticsErrorBoundary, [{

@@ -414,4 +348,4 @@ key: "componentDidCatch",

var _this$props2 = this.props,
data = _this$props2.data,
children = _this$props2.children;
data = _this$props2.data,
children = _this$props2.children;
return /*#__PURE__*/jsx(AnalyticsContext, {

@@ -423,3 +357,2 @@ data: data,

}]);
return BaseAnalyticsErrorBoundary;

@@ -432,19 +365,12 @@ }(Component);

};
var AnalyticsListener = /*#__PURE__*/function (_Component) {
_inherits(AnalyticsListener, _Component);
var _super = _createSuper(AnalyticsListener);
function AnalyticsListener() {
var _this;
_classCallCheck(this, AnalyticsListener);
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
_this = _super.call.apply(_super, [this].concat(args));
_defineProperty(_assertThisInitialized(_this), "getChildContext", function () {

@@ -455,10 +381,8 @@ return {

});
_defineProperty(_assertThisInitialized(_this), "getAnalyticsEventHandlers", function () {
var _this$props = _this.props,
channel = _this$props.channel,
onEvent = _this$props.onEvent;
channel = _this$props.channel,
onEvent = _this$props.onEvent;
var getAnalyticsEventHandlers = _this.context.getAnalyticsEventHandlers;
var parentEventHandlers = typeof getAnalyticsEventHandlers === 'function' && getAnalyticsEventHandlers() || [];
var handler = function handler(event, eventChannel) {

@@ -469,9 +393,6 @@ if (channel === '*' || channel === eventChannel) {

};
return [handler].concat(_toConsumableArray(parentEventHandlers));
});
return _this;
}
_createClass(AnalyticsListener, [{

@@ -481,5 +402,5 @@ key: "render",

var _this$context$getAnal = this.context.getAnalyticsContext,
getAnalyticsContext = _this$context$getAnal === void 0 ? function () {
return [];
} : _this$context$getAnal;
getAnalyticsContext = _this$context$getAnal === void 0 ? function () {
return [];
} : _this$context$getAnal;
var children = this.props.children;

@@ -495,8 +416,5 @@ return /*#__PURE__*/jsx(AnalyticsReactContext.Provider, {

}]);
return AnalyticsListener;
}(Component);
_defineProperty(AnalyticsListener, "contextTypes", ContextTypes);
_defineProperty(AnalyticsListener, "childContextTypes", ContextTypes);

@@ -507,4 +425,3 @@

props.createAnalyticsEvent;
var cleanedProps = _objectWithoutProperties(props, _excluded$1);
var cleanedProps = _objectWithoutProperties(props, _excluded$1);
return cleanedProps;

@@ -518,7 +435,5 @@ }

var clonedEvent = consumerEvent.clone();
if (clonedEvent) {
clonedEvent.fire(channel);
}
return consumerEvent;

@@ -531,5 +446,4 @@ };

var _useContext = useContext(AnalyticsReactContext),
getAnalyticsEventHandlers = _useContext.getAnalyticsEventHandlers,
getAnalyticsContext = _useContext.getAnalyticsContext;
getAnalyticsEventHandlers = _useContext.getAnalyticsEventHandlers,
getAnalyticsContext = _useContext.getAnalyticsContext;
if ((getAnalyticsEventHandlers === null || getAnalyticsContext === null) && process.env.NODE_ENV !== 'production') {

@@ -539,3 +453,2 @@ /* eslint-disable-next-line no-console */

}
var createAnalyticsEvent = useCallback(function (payload) {

@@ -555,7 +468,7 @@ return new UIAnalyticsEvent({

var _useAnalyticsEvents = useAnalyticsEvents(),
createAnalyticsEvent = _useAnalyticsEvents.createAnalyticsEvent; // given input might be new function/object each render
createAnalyticsEvent = _useAnalyticsEvents.createAnalyticsEvent;
// given input might be new function/object each render
// we optimise and store in refs so we can memoize the callback
// and at the same time avoid stale values
var methodRef = useRef(method);

@@ -590,16 +503,15 @@ var payloadRef = useRef(payload);

var fn = _ref.fn,
action = _ref.action,
componentName = _ref.componentName,
actionSubject = _ref.actionSubject,
packageName = _ref.packageName,
packageVersion = _ref.packageVersion,
analyticsData = _ref.analyticsData;
action = _ref.action,
componentName = _ref.componentName,
actionSubject = _ref.actionSubject,
packageName = _ref.packageName,
packageVersion = _ref.packageVersion,
analyticsData = _ref.analyticsData;
var _useAnalyticsEvents = useAnalyticsEvents(),
createAnalyticsEvent = _useAnalyticsEvents.createAnalyticsEvent;
var _useAnalyticsEvents = useAnalyticsEvents(),
createAnalyticsEvent = _useAnalyticsEvents.createAnalyticsEvent; // We put analyticsData and fn in a ref so that we don't need to break
// We put analyticsData and fn in a ref so that we don't need to break
// memoization.
// Generally these could be defined by consumers inline
// and so we do this to avoid breaking memoization of useCallback
var dataRef = useTrackedRef(analyticsData);

@@ -616,6 +528,7 @@ var fnRef = useTrackedRef(fn);

}
}); // To avoid wrapping this component in AnalyticsContext we manually
});
// To avoid wrapping this component in AnalyticsContext we manually
// push the parent context's meta data into the context.
// Note: this new 'context'
var context = _objectSpread({

@@ -626,15 +539,16 @@ componentName: componentName,

}, dataRef.current);
analyticsEvent.context.push(context);
analyticsEvent.context.push(context); // fire an event on the atlaskit channel
// fire an event on the atlaskit channel
var clone = analyticsEvent.clone();
if (clone) {
clone.fire('atlaskit');
}
fnRef.current(value, analyticsEvent);
}, [// These are strings and won't change
action, componentName, actionSubject, packageName, packageVersion, // This function is memoized in the context
createAnalyticsEvent, // these are a stable ref because of the useTrackedRef hook
}, [
// These are strings and won't change
action, componentName, actionSubject, packageName, packageVersion,
// This function is memoized in the context
createAnalyticsEvent,
// these are a stable ref because of the useTrackedRef hook
dataRef, fnRef]);

@@ -652,15 +566,14 @@ return handler;

var fn = _ref.fn,
action = _ref.action,
componentName = _ref.componentName,
packageName = _ref.packageName,
packageVersion = _ref.packageVersion,
analyticsData = _ref.analyticsData;
action = _ref.action,
componentName = _ref.componentName,
packageName = _ref.packageName,
packageVersion = _ref.packageVersion,
analyticsData = _ref.analyticsData;
var _useAnalyticsEvents = useAnalyticsEvents(),
createAnalyticsEvent = _useAnalyticsEvents.createAnalyticsEvent;
var _useAnalyticsEvents = useAnalyticsEvents(),
createAnalyticsEvent = _useAnalyticsEvents.createAnalyticsEvent; // We put analyticsData and fn in a ref so that we don't need to break
// We put analyticsData and fn in a ref so that we don't need to break
// memoization.
// Generally these could be defined by consumers inline
// and so we do this to avoid breaking memoization of useCallback
var dataRef = useTrackedRef(analyticsData);

@@ -677,6 +590,7 @@ var fnRef = useTrackedRef(fn);

}
}); // To avoid wrapping this component in AnalyticsContext we manually
});
// To avoid wrapping this component in AnalyticsContext we manually
// push the parent context's meta data into the context.
// Note: this new 'context'
var context = _objectSpread({

@@ -687,15 +601,16 @@ componentName: componentName,

}, dataRef.current);
analyticsEvent.context.push(context);
analyticsEvent.context.push(context); // fire an event on the atlaskit channel
// fire an event on the atlaskit channel
var clone = analyticsEvent.clone();
if (clone) {
clone.fire('atlaskit');
}
fnRef.current(analyticsEvent);
}, [// These are strings and won't change
action, componentName, packageName, packageVersion, // This function is memoized in the context
createAnalyticsEvent, // these are a stable ref because of the useTrackedRef hook
}, [
// These are strings and won't change
action, componentName, packageName, packageVersion,
// This function is memoized in the context
createAnalyticsEvent,
// these are a stable ref because of the useTrackedRef hook
dataRef, fnRef]);

@@ -706,3 +621,2 @@ return handler;

var _excluded = ["analyticsContext"];
var withAnalyticsContext = function withAnalyticsContext(defaultData) {

@@ -712,7 +626,5 @@ return function (WrappedComponent) {

var _props$analyticsConte = props.analyticsContext,
analyticsContext = _props$analyticsConte === void 0 ? {} : _props$analyticsConte,
rest = _objectWithoutProperties(props, _excluded);
analyticsContext = _props$analyticsConte === void 0 ? {} : _props$analyticsConte,
rest = _objectWithoutProperties(props, _excluded);
var analyticsData = _objectSpread(_objectSpread({}, defaultData), analyticsContext);
return /*#__PURE__*/jsx(AnalyticsContext, {

@@ -724,4 +636,5 @@ data: analyticsData,

});
}); // @ts-ignore
});
// @ts-ignore
WithAnalyticsContext.displayName = "WithAnalyticsContext(".concat(WrappedComponent.displayName || WrappedComponent.name, ")");

@@ -728,0 +641,0 @@ return WithAnalyticsContext;

{
"name": "@uidu/analytics",
"version": "0.6.8",
"version": "0.6.9",
"description": "The uidu component analytics framework",

@@ -12,11 +12,11 @@ "repository": "https://github.com/uidu-org/guidu/tree/main/packages/core/analytics",

"dependencies": {
"@babel/runtime": "^7.19.4",
"@babel/runtime": "^7.20.1",
"prop-types": "^15.8.1",
"tslib": "^2.4.0"
"tslib": "^2.4.1"
},
"devDependencies": {
"@uidu/button": "^1.3.32",
"@uidu/docs": "^0.5.21",
"@uidu/field-text": "^2.0.4",
"@uidu/form": "^2.1.9",
"@uidu/button": "^1.3.33",
"@uidu/docs": "^0.5.22",
"@uidu/field-text": "^2.0.5",
"@uidu/form": "^2.1.11",
"lodash.isequal": "^4.5.0",

@@ -23,0 +23,0 @@ "react": "^18.2.0",

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