@aperture.io/analytics
Advanced tools
Comparing version 0.1.5 to 0.1.6
@@ -1,1 +0,4 @@ | ||
export declare const deepMerge: <TSource1, TSource2>(source1: TSource1, source2: TSource2) => {} & TSource1 & TSource2; | ||
import type { Dispatch, Merge, Middleware } from './types'; | ||
export declare const defaultDispatch: Dispatch; | ||
export declare const defaultMerge: Merge; | ||
export declare const applyMiddleware: (fns: Middleware[]) => Middleware; |
@@ -1,3 +0,3 @@ | ||
export { applyMiddleware } from './applyMiddleware'; | ||
export { applyMiddleware } from './helpers'; | ||
export { useAnalytics } from './useAnalytics'; | ||
export type { Dispatch, Middleware } from './useAnalytics'; | ||
export * from './types'; |
@@ -1,3 +0,9 @@ | ||
// source/applyMiddleware.ts | ||
// source/helpers.ts | ||
var partial = (fn) => (next) => (data) => fn(data, next); | ||
var defaultDispatch = () => { | ||
}; | ||
var defaultMerge = (parentData, localData) => ({ | ||
...parentData, | ||
...localData | ||
}); | ||
var applyMiddleware = (fns) => { | ||
@@ -94,8 +100,2 @@ return (data, dispatch) => { | ||
// ../../common/temp/node_modules/.pnpm/lodash-es@4.17.20/node_modules/lodash-es/identity.js | ||
function identity(value) { | ||
return value; | ||
} | ||
var identity_default = identity; | ||
// ../../common/temp/node_modules/.pnpm/lodash-es@4.17.20/node_modules/lodash-es/isFunction.js | ||
@@ -181,104 +181,2 @@ var asyncTag = "[object AsyncFunction]"; | ||
// ../../common/temp/node_modules/.pnpm/lodash-es@4.17.20/node_modules/lodash-es/_baseCreate.js | ||
var objectCreate = Object.create; | ||
var baseCreate = function() { | ||
function object() { | ||
} | ||
return function(proto) { | ||
if (!isObject_default(proto)) { | ||
return {}; | ||
} | ||
if (objectCreate) { | ||
return objectCreate(proto); | ||
} | ||
object.prototype = proto; | ||
var result = new object(); | ||
object.prototype = void 0; | ||
return result; | ||
}; | ||
}(); | ||
var baseCreate_default = baseCreate; | ||
// ../../common/temp/node_modules/.pnpm/lodash-es@4.17.20/node_modules/lodash-es/_apply.js | ||
function apply(func, thisArg, args) { | ||
switch (args.length) { | ||
case 0: | ||
return func.call(thisArg); | ||
case 1: | ||
return func.call(thisArg, args[0]); | ||
case 2: | ||
return func.call(thisArg, args[0], args[1]); | ||
case 3: | ||
return func.call(thisArg, args[0], args[1], args[2]); | ||
} | ||
return func.apply(thisArg, args); | ||
} | ||
var apply_default = apply; | ||
// ../../common/temp/node_modules/.pnpm/lodash-es@4.17.20/node_modules/lodash-es/_copyArray.js | ||
function copyArray(source, array) { | ||
var index = -1, length = source.length; | ||
array || (array = Array(length)); | ||
while (++index < length) { | ||
array[index] = source[index]; | ||
} | ||
return array; | ||
} | ||
var copyArray_default = copyArray; | ||
// ../../common/temp/node_modules/.pnpm/lodash-es@4.17.20/node_modules/lodash-es/_shortOut.js | ||
var HOT_COUNT = 800; | ||
var HOT_SPAN = 16; | ||
var nativeNow = Date.now; | ||
function shortOut(func) { | ||
var count = 0, lastCalled = 0; | ||
return function() { | ||
var stamp = nativeNow(), remaining = HOT_SPAN - (stamp - lastCalled); | ||
lastCalled = stamp; | ||
if (remaining > 0) { | ||
if (++count >= HOT_COUNT) { | ||
return arguments[0]; | ||
} | ||
} else { | ||
count = 0; | ||
} | ||
return func.apply(void 0, arguments); | ||
}; | ||
} | ||
var shortOut_default = shortOut; | ||
// ../../common/temp/node_modules/.pnpm/lodash-es@4.17.20/node_modules/lodash-es/constant.js | ||
function constant(value) { | ||
return function() { | ||
return value; | ||
}; | ||
} | ||
var constant_default = constant; | ||
// ../../common/temp/node_modules/.pnpm/lodash-es@4.17.20/node_modules/lodash-es/_defineProperty.js | ||
var defineProperty = function() { | ||
try { | ||
var func = getNative_default(Object, "defineProperty"); | ||
func({}, "", {}); | ||
return func; | ||
} catch (e) { | ||
} | ||
}(); | ||
var defineProperty_default = defineProperty; | ||
// ../../common/temp/node_modules/.pnpm/lodash-es@4.17.20/node_modules/lodash-es/_baseSetToString.js | ||
var baseSetToString = !defineProperty_default ? identity_default : function(func, string) { | ||
return defineProperty_default(func, "toString", { | ||
configurable: true, | ||
enumerable: false, | ||
value: constant_default(string), | ||
writable: true | ||
}); | ||
}; | ||
var baseSetToString_default = baseSetToString; | ||
// ../../common/temp/node_modules/.pnpm/lodash-es@4.17.20/node_modules/lodash-es/_setToString.js | ||
var setToString = shortOut_default(baseSetToString_default); | ||
var setToString_default = setToString; | ||
// ../../common/temp/node_modules/.pnpm/lodash-es@4.17.20/node_modules/lodash-es/_isIndex.js | ||
@@ -294,17 +192,2 @@ var MAX_SAFE_INTEGER = 9007199254740991; | ||
// ../../common/temp/node_modules/.pnpm/lodash-es@4.17.20/node_modules/lodash-es/_baseAssignValue.js | ||
function baseAssignValue(object, key, value) { | ||
if (key == "__proto__" && defineProperty_default) { | ||
defineProperty_default(object, key, { | ||
configurable: true, | ||
enumerable: true, | ||
value, | ||
writable: true | ||
}); | ||
} else { | ||
object[key] = value; | ||
} | ||
} | ||
var baseAssignValue_default = baseAssignValue; | ||
// ../../common/temp/node_modules/.pnpm/lodash-es@4.17.20/node_modules/lodash-es/eq.js | ||
@@ -316,60 +199,2 @@ function eq(value, other) { | ||
// ../../common/temp/node_modules/.pnpm/lodash-es@4.17.20/node_modules/lodash-es/_assignValue.js | ||
var objectProto4 = Object.prototype; | ||
var hasOwnProperty3 = objectProto4.hasOwnProperty; | ||
function assignValue(object, key, value) { | ||
var objValue = object[key]; | ||
if (!(hasOwnProperty3.call(object, key) && eq_default(objValue, value)) || value === void 0 && !(key in object)) { | ||
baseAssignValue_default(object, key, value); | ||
} | ||
} | ||
var assignValue_default = assignValue; | ||
// ../../common/temp/node_modules/.pnpm/lodash-es@4.17.20/node_modules/lodash-es/_copyObject.js | ||
function copyObject(source, props, object, customizer) { | ||
var isNew = !object; | ||
object || (object = {}); | ||
var index = -1, length = props.length; | ||
while (++index < length) { | ||
var key = props[index]; | ||
var newValue = customizer ? customizer(object[key], source[key], key, object, source) : void 0; | ||
if (newValue === void 0) { | ||
newValue = source[key]; | ||
} | ||
if (isNew) { | ||
baseAssignValue_default(object, key, newValue); | ||
} else { | ||
assignValue_default(object, key, newValue); | ||
} | ||
} | ||
return object; | ||
} | ||
var copyObject_default = copyObject; | ||
// ../../common/temp/node_modules/.pnpm/lodash-es@4.17.20/node_modules/lodash-es/_overRest.js | ||
var nativeMax = Math.max; | ||
function overRest(func, start, transform) { | ||
start = nativeMax(start === void 0 ? func.length - 1 : start, 0); | ||
return function() { | ||
var args = arguments, index = -1, length = nativeMax(args.length - start, 0), array = Array(length); | ||
while (++index < length) { | ||
array[index] = args[start + index]; | ||
} | ||
index = -1; | ||
var otherArgs = Array(start + 1); | ||
while (++index < start) { | ||
otherArgs[index] = args[index]; | ||
} | ||
otherArgs[start] = transform(array); | ||
return apply_default(func, this, otherArgs); | ||
}; | ||
} | ||
var overRest_default = overRest; | ||
// ../../common/temp/node_modules/.pnpm/lodash-es@4.17.20/node_modules/lodash-es/_baseRest.js | ||
function baseRest(func, start) { | ||
return setToString_default(overRest_default(func, start, identity_default), func + ""); | ||
} | ||
var baseRest_default = baseRest; | ||
// ../../common/temp/node_modules/.pnpm/lodash-es@4.17.20/node_modules/lodash-es/isLength.js | ||
@@ -388,40 +213,6 @@ var MAX_SAFE_INTEGER2 = 9007199254740991; | ||
// ../../common/temp/node_modules/.pnpm/lodash-es@4.17.20/node_modules/lodash-es/_isIterateeCall.js | ||
function isIterateeCall(value, index, object) { | ||
if (!isObject_default(object)) { | ||
return false; | ||
} | ||
var type = typeof index; | ||
if (type == "number" ? isArrayLike_default(object) && isIndex_default(index, object.length) : type == "string" && index in object) { | ||
return eq_default(object[index], value); | ||
} | ||
return false; | ||
} | ||
var isIterateeCall_default = isIterateeCall; | ||
// ../../common/temp/node_modules/.pnpm/lodash-es@4.17.20/node_modules/lodash-es/_createAssigner.js | ||
function createAssigner(assigner) { | ||
return baseRest_default(function(object, sources) { | ||
var index = -1, length = sources.length, customizer = length > 1 ? sources[length - 1] : void 0, guard = length > 2 ? sources[2] : void 0; | ||
customizer = assigner.length > 3 && typeof customizer == "function" ? (length--, customizer) : void 0; | ||
if (guard && isIterateeCall_default(sources[0], sources[1], guard)) { | ||
customizer = length < 3 ? void 0 : customizer; | ||
length = 1; | ||
} | ||
object = Object(object); | ||
while (++index < length) { | ||
var source = sources[index]; | ||
if (source) { | ||
assigner(object, source, index, customizer); | ||
} | ||
} | ||
return object; | ||
}); | ||
} | ||
var createAssigner_default = createAssigner; | ||
// ../../common/temp/node_modules/.pnpm/lodash-es@4.17.20/node_modules/lodash-es/_isPrototype.js | ||
var objectProto5 = Object.prototype; | ||
var objectProto4 = Object.prototype; | ||
function isPrototype(value) { | ||
var Ctor = value && value.constructor, proto = typeof Ctor == "function" && Ctor.prototype || objectProto5; | ||
var Ctor = value && value.constructor, proto = typeof Ctor == "function" && Ctor.prototype || objectProto4; | ||
return value === proto; | ||
@@ -449,9 +240,9 @@ } | ||
// ../../common/temp/node_modules/.pnpm/lodash-es@4.17.20/node_modules/lodash-es/isArguments.js | ||
var objectProto6 = Object.prototype; | ||
var hasOwnProperty4 = objectProto6.hasOwnProperty; | ||
var propertyIsEnumerable = objectProto6.propertyIsEnumerable; | ||
var objectProto5 = Object.prototype; | ||
var hasOwnProperty3 = objectProto5.hasOwnProperty; | ||
var propertyIsEnumerable = objectProto5.propertyIsEnumerable; | ||
var isArguments = baseIsArguments_default(function() { | ||
return arguments; | ||
}()) ? baseIsArguments_default : function(value) { | ||
return isObjectLike_default(value) && hasOwnProperty4.call(value, "callee") && !propertyIsEnumerable.call(value, "callee"); | ||
return isObjectLike_default(value) && hasOwnProperty3.call(value, "callee") && !propertyIsEnumerable.call(value, "callee"); | ||
}; | ||
@@ -539,8 +330,8 @@ var isArguments_default = isArguments; | ||
// ../../common/temp/node_modules/.pnpm/lodash-es@4.17.20/node_modules/lodash-es/_arrayLikeKeys.js | ||
var objectProto7 = Object.prototype; | ||
var hasOwnProperty5 = objectProto7.hasOwnProperty; | ||
var objectProto6 = Object.prototype; | ||
var hasOwnProperty4 = objectProto6.hasOwnProperty; | ||
function arrayLikeKeys(value, inherited) { | ||
var isArr = isArray_default(value), isArg = !isArr && isArguments_default(value), isBuff = !isArr && !isArg && isBuffer_default(value), isType = !isArr && !isArg && !isBuff && isTypedArray_default(value), skipIndexes = isArr || isArg || isBuff || isType, result = skipIndexes ? baseTimes_default(value.length, String) : [], length = result.length; | ||
for (var key in value) { | ||
if ((inherited || hasOwnProperty5.call(value, key)) && !(skipIndexes && (key == "length" || isBuff && (key == "offset" || key == "parent") || isType && (key == "buffer" || key == "byteLength" || key == "byteOffset") || isIndex_default(key, length)))) { | ||
if ((inherited || hasOwnProperty4.call(value, key)) && !(skipIndexes && (key == "length" || isBuff && (key == "offset" || key == "parent") || isType && (key == "buffer" || key == "byteLength" || key == "byteOffset") || isIndex_default(key, length)))) { | ||
result.push(key); | ||
@@ -566,4 +357,4 @@ } | ||
// ../../common/temp/node_modules/.pnpm/lodash-es@4.17.20/node_modules/lodash-es/_baseKeys.js | ||
var objectProto8 = Object.prototype; | ||
var hasOwnProperty6 = objectProto8.hasOwnProperty; | ||
var objectProto7 = Object.prototype; | ||
var hasOwnProperty5 = objectProto7.hasOwnProperty; | ||
function baseKeys(object) { | ||
@@ -575,3 +366,3 @@ if (!isPrototype_default(object)) { | ||
for (var key in Object(object)) { | ||
if (hasOwnProperty6.call(object, key) && key != "constructor") { | ||
if (hasOwnProperty5.call(object, key) && key != "constructor") { | ||
result.push(key); | ||
@@ -590,37 +381,2 @@ } | ||
// ../../common/temp/node_modules/.pnpm/lodash-es@4.17.20/node_modules/lodash-es/_nativeKeysIn.js | ||
function nativeKeysIn(object) { | ||
var result = []; | ||
if (object != null) { | ||
for (var key in Object(object)) { | ||
result.push(key); | ||
} | ||
} | ||
return result; | ||
} | ||
var nativeKeysIn_default = nativeKeysIn; | ||
// ../../common/temp/node_modules/.pnpm/lodash-es@4.17.20/node_modules/lodash-es/_baseKeysIn.js | ||
var objectProto9 = Object.prototype; | ||
var hasOwnProperty7 = objectProto9.hasOwnProperty; | ||
function baseKeysIn(object) { | ||
if (!isObject_default(object)) { | ||
return nativeKeysIn_default(object); | ||
} | ||
var isProto = isPrototype_default(object), result = []; | ||
for (var key in object) { | ||
if (!(key == "constructor" && (isProto || !hasOwnProperty7.call(object, key)))) { | ||
result.push(key); | ||
} | ||
} | ||
return result; | ||
} | ||
var baseKeysIn_default = baseKeysIn; | ||
// ../../common/temp/node_modules/.pnpm/lodash-es@4.17.20/node_modules/lodash-es/keysIn.js | ||
function keysIn(object) { | ||
return isArrayLike_default(object) ? arrayLikeKeys_default(object, true) : baseKeysIn_default(object); | ||
} | ||
var keysIn_default = keysIn; | ||
// ../../common/temp/node_modules/.pnpm/lodash-es@4.17.20/node_modules/lodash-es/_nativeCreate.js | ||
@@ -647,4 +403,4 @@ var nativeCreate = getNative_default(Object, "create"); | ||
var HASH_UNDEFINED = "__lodash_hash_undefined__"; | ||
var objectProto10 = Object.prototype; | ||
var hasOwnProperty8 = objectProto10.hasOwnProperty; | ||
var objectProto8 = Object.prototype; | ||
var hasOwnProperty6 = objectProto8.hasOwnProperty; | ||
function hashGet(key) { | ||
@@ -656,3 +412,3 @@ var data = this.__data__; | ||
} | ||
return hasOwnProperty8.call(data, key) ? data[key] : void 0; | ||
return hasOwnProperty6.call(data, key) ? data[key] : void 0; | ||
} | ||
@@ -662,7 +418,7 @@ var hashGet_default = hashGet; | ||
// ../../common/temp/node_modules/.pnpm/lodash-es@4.17.20/node_modules/lodash-es/_hashHas.js | ||
var objectProto11 = Object.prototype; | ||
var hasOwnProperty9 = objectProto11.hasOwnProperty; | ||
var objectProto9 = Object.prototype; | ||
var hasOwnProperty7 = objectProto9.hasOwnProperty; | ||
function hashHas(key) { | ||
var data = this.__data__; | ||
return nativeCreate_default ? data[key] !== void 0 : hasOwnProperty9.call(data, key); | ||
return nativeCreate_default ? data[key] !== void 0 : hasOwnProperty7.call(data, key); | ||
} | ||
@@ -861,26 +617,2 @@ var hashHas_default = hashHas; | ||
// ../../common/temp/node_modules/.pnpm/lodash-es@4.17.20/node_modules/lodash-es/_getPrototype.js | ||
var getPrototype = overArg_default(Object.getPrototypeOf, Object); | ||
var getPrototype_default = getPrototype; | ||
// ../../common/temp/node_modules/.pnpm/lodash-es@4.17.20/node_modules/lodash-es/isPlainObject.js | ||
var objectTag2 = "[object Object]"; | ||
var funcProto3 = Function.prototype; | ||
var objectProto12 = Object.prototype; | ||
var funcToString3 = funcProto3.toString; | ||
var hasOwnProperty10 = objectProto12.hasOwnProperty; | ||
var objectCtorString = funcToString3.call(Object); | ||
function isPlainObject(value) { | ||
if (!isObjectLike_default(value) || baseGetTag_default(value) != objectTag2) { | ||
return false; | ||
} | ||
var proto = getPrototype_default(value); | ||
if (proto === null) { | ||
return true; | ||
} | ||
var Ctor = hasOwnProperty10.call(proto, "constructor") && proto.constructor; | ||
return typeof Ctor == "function" && Ctor instanceof Ctor && funcToString3.call(Ctor) == objectCtorString; | ||
} | ||
var isPlainObject_default = isPlainObject; | ||
// ../../common/temp/node_modules/.pnpm/lodash-es@4.17.20/node_modules/lodash-es/_stackClear.js | ||
@@ -944,18 +676,2 @@ function stackClear() { | ||
// ../../common/temp/node_modules/.pnpm/lodash-es@4.17.20/node_modules/lodash-es/_cloneBuffer.js | ||
var freeExports3 = typeof exports == "object" && exports && !exports.nodeType && exports; | ||
var freeModule3 = freeExports3 && typeof module == "object" && module && !module.nodeType && module; | ||
var moduleExports3 = freeModule3 && freeModule3.exports === freeExports3; | ||
var Buffer2 = moduleExports3 ? root_default.Buffer : void 0; | ||
var allocUnsafe = Buffer2 ? Buffer2.allocUnsafe : void 0; | ||
function cloneBuffer(buffer, isDeep) { | ||
if (isDeep) { | ||
return buffer.slice(); | ||
} | ||
var length = buffer.length, result = allocUnsafe ? allocUnsafe(length) : new buffer.constructor(length); | ||
buffer.copy(result); | ||
return result; | ||
} | ||
var cloneBuffer_default = cloneBuffer; | ||
// ../../common/temp/node_modules/.pnpm/lodash-es@4.17.20/node_modules/lodash-es/_arrayFilter.js | ||
@@ -981,4 +697,4 @@ function arrayFilter(array, predicate) { | ||
// ../../common/temp/node_modules/.pnpm/lodash-es@4.17.20/node_modules/lodash-es/_getSymbols.js | ||
var objectProto13 = Object.prototype; | ||
var propertyIsEnumerable2 = objectProto13.propertyIsEnumerable; | ||
var objectProto10 = Object.prototype; | ||
var propertyIsEnumerable2 = objectProto10.propertyIsEnumerable; | ||
var nativeGetSymbols = Object.getOwnPropertySymbols; | ||
@@ -1023,3 +739,3 @@ var getSymbols = !nativeGetSymbols ? stubArray_default : function(object) { | ||
var mapTag2 = "[object Map]"; | ||
var objectTag3 = "[object Object]"; | ||
var objectTag2 = "[object Object]"; | ||
var promiseTag = "[object Promise]"; | ||
@@ -1037,3 +753,3 @@ var setTag2 = "[object Set]"; | ||
getTag = function(value) { | ||
var result = baseGetTag_default(value), Ctor = result == objectTag3 ? value.constructor : void 0, ctorString = Ctor ? toSource_default(Ctor) : ""; | ||
var result = baseGetTag_default(value), Ctor = result == objectTag2 ? value.constructor : void 0, ctorString = Ctor ? toSource_default(Ctor) : ""; | ||
if (ctorString) { | ||
@@ -1062,23 +778,2 @@ switch (ctorString) { | ||
// ../../common/temp/node_modules/.pnpm/lodash-es@4.17.20/node_modules/lodash-es/_cloneArrayBuffer.js | ||
function cloneArrayBuffer(arrayBuffer) { | ||
var result = new arrayBuffer.constructor(arrayBuffer.byteLength); | ||
new Uint8Array_default(result).set(new Uint8Array_default(arrayBuffer)); | ||
return result; | ||
} | ||
var cloneArrayBuffer_default = cloneArrayBuffer; | ||
// ../../common/temp/node_modules/.pnpm/lodash-es@4.17.20/node_modules/lodash-es/_cloneTypedArray.js | ||
function cloneTypedArray(typedArray, isDeep) { | ||
var buffer = isDeep ? cloneArrayBuffer_default(typedArray.buffer) : typedArray.buffer; | ||
return new typedArray.constructor(buffer, typedArray.byteOffset, typedArray.length); | ||
} | ||
var cloneTypedArray_default = cloneTypedArray; | ||
// ../../common/temp/node_modules/.pnpm/lodash-es@4.17.20/node_modules/lodash-es/_initCloneObject.js | ||
function initCloneObject(object) { | ||
return typeof object.constructor == "function" && !isPrototype_default(object) ? baseCreate_default(getPrototype_default(object)) : {}; | ||
} | ||
var initCloneObject_default = initCloneObject; | ||
// ../../common/temp/node_modules/.pnpm/lodash-es@4.17.20/node_modules/lodash-es/_setCacheAdd.js | ||
@@ -1262,4 +957,4 @@ var HASH_UNDEFINED3 = "__lodash_hash_undefined__"; | ||
var COMPARE_PARTIAL_FLAG3 = 1; | ||
var objectProto14 = Object.prototype; | ||
var hasOwnProperty11 = objectProto14.hasOwnProperty; | ||
var objectProto11 = Object.prototype; | ||
var hasOwnProperty8 = objectProto11.hasOwnProperty; | ||
function equalObjects(object, other, bitmask, customizer, equalFunc, stack) { | ||
@@ -1273,3 +968,3 @@ var isPartial = bitmask & COMPARE_PARTIAL_FLAG3, objProps = getAllKeys_default(object), objLength = objProps.length, othProps = getAllKeys_default(other), othLength = othProps.length; | ||
var key = objProps[index]; | ||
if (!(isPartial ? key in other : hasOwnProperty11.call(other, key))) { | ||
if (!(isPartial ? key in other : hasOwnProperty8.call(other, key))) { | ||
return false; | ||
@@ -1315,10 +1010,10 @@ } | ||
var arrayTag2 = "[object Array]"; | ||
var objectTag4 = "[object Object]"; | ||
var objectProto15 = Object.prototype; | ||
var hasOwnProperty12 = objectProto15.hasOwnProperty; | ||
var objectTag3 = "[object Object]"; | ||
var objectProto12 = Object.prototype; | ||
var hasOwnProperty9 = objectProto12.hasOwnProperty; | ||
function baseIsEqualDeep(object, other, bitmask, customizer, equalFunc, stack) { | ||
var objIsArr = isArray_default(object), othIsArr = isArray_default(other), objTag = objIsArr ? arrayTag2 : getTag_default(object), othTag = othIsArr ? arrayTag2 : getTag_default(other); | ||
objTag = objTag == argsTag3 ? objectTag4 : objTag; | ||
othTag = othTag == argsTag3 ? objectTag4 : othTag; | ||
var objIsObj = objTag == objectTag4, othIsObj = othTag == objectTag4, isSameTag = objTag == othTag; | ||
objTag = objTag == argsTag3 ? objectTag3 : objTag; | ||
othTag = othTag == argsTag3 ? objectTag3 : othTag; | ||
var objIsObj = objTag == objectTag3, othIsObj = othTag == objectTag3, isSameTag = objTag == othTag; | ||
if (isSameTag && isBuffer_default(object)) { | ||
@@ -1336,3 +1031,3 @@ if (!isBuffer_default(other)) { | ||
if (!(bitmask & COMPARE_PARTIAL_FLAG4)) { | ||
var objIsWrapped = objIsObj && hasOwnProperty12.call(object, "__wrapped__"), othIsWrapped = othIsObj && hasOwnProperty12.call(other, "__wrapped__"); | ||
var objIsWrapped = objIsObj && hasOwnProperty9.call(object, "__wrapped__"), othIsWrapped = othIsObj && hasOwnProperty9.call(other, "__wrapped__"); | ||
if (objIsWrapped || othIsWrapped) { | ||
@@ -1364,125 +1059,2 @@ var objUnwrapped = objIsWrapped ? object.value() : object, othUnwrapped = othIsWrapped ? other.value() : other; | ||
// ../../common/temp/node_modules/.pnpm/lodash-es@4.17.20/node_modules/lodash-es/_createBaseFor.js | ||
function createBaseFor(fromRight) { | ||
return function(object, iteratee, keysFunc) { | ||
var index = -1, iterable = Object(object), props = keysFunc(object), length = props.length; | ||
while (length--) { | ||
var key = props[fromRight ? length : ++index]; | ||
if (iteratee(iterable[key], key, iterable) === false) { | ||
break; | ||
} | ||
} | ||
return object; | ||
}; | ||
} | ||
var createBaseFor_default = createBaseFor; | ||
// ../../common/temp/node_modules/.pnpm/lodash-es@4.17.20/node_modules/lodash-es/_baseFor.js | ||
var baseFor = createBaseFor_default(); | ||
var baseFor_default = baseFor; | ||
// ../../common/temp/node_modules/.pnpm/lodash-es@4.17.20/node_modules/lodash-es/_assignMergeValue.js | ||
function assignMergeValue(object, key, value) { | ||
if (value !== void 0 && !eq_default(object[key], value) || value === void 0 && !(key in object)) { | ||
baseAssignValue_default(object, key, value); | ||
} | ||
} | ||
var assignMergeValue_default = assignMergeValue; | ||
// ../../common/temp/node_modules/.pnpm/lodash-es@4.17.20/node_modules/lodash-es/isArrayLikeObject.js | ||
function isArrayLikeObject(value) { | ||
return isObjectLike_default(value) && isArrayLike_default(value); | ||
} | ||
var isArrayLikeObject_default = isArrayLikeObject; | ||
// ../../common/temp/node_modules/.pnpm/lodash-es@4.17.20/node_modules/lodash-es/_safeGet.js | ||
function safeGet(object, key) { | ||
if (key === "constructor" && typeof object[key] === "function") { | ||
return; | ||
} | ||
if (key == "__proto__") { | ||
return; | ||
} | ||
return object[key]; | ||
} | ||
var safeGet_default = safeGet; | ||
// ../../common/temp/node_modules/.pnpm/lodash-es@4.17.20/node_modules/lodash-es/toPlainObject.js | ||
function toPlainObject(value) { | ||
return copyObject_default(value, keysIn_default(value)); | ||
} | ||
var toPlainObject_default = toPlainObject; | ||
// ../../common/temp/node_modules/.pnpm/lodash-es@4.17.20/node_modules/lodash-es/_baseMergeDeep.js | ||
function baseMergeDeep(object, source, key, srcIndex, mergeFunc, customizer, stack) { | ||
var objValue = safeGet_default(object, key), srcValue = safeGet_default(source, key), stacked = stack.get(srcValue); | ||
if (stacked) { | ||
assignMergeValue_default(object, key, stacked); | ||
return; | ||
} | ||
var newValue = customizer ? customizer(objValue, srcValue, key + "", object, source, stack) : void 0; | ||
var isCommon = newValue === void 0; | ||
if (isCommon) { | ||
var isArr = isArray_default(srcValue), isBuff = !isArr && isBuffer_default(srcValue), isTyped = !isArr && !isBuff && isTypedArray_default(srcValue); | ||
newValue = srcValue; | ||
if (isArr || isBuff || isTyped) { | ||
if (isArray_default(objValue)) { | ||
newValue = objValue; | ||
} else if (isArrayLikeObject_default(objValue)) { | ||
newValue = copyArray_default(objValue); | ||
} else if (isBuff) { | ||
isCommon = false; | ||
newValue = cloneBuffer_default(srcValue, true); | ||
} else if (isTyped) { | ||
isCommon = false; | ||
newValue = cloneTypedArray_default(srcValue, true); | ||
} else { | ||
newValue = []; | ||
} | ||
} else if (isPlainObject_default(srcValue) || isArguments_default(srcValue)) { | ||
newValue = objValue; | ||
if (isArguments_default(objValue)) { | ||
newValue = toPlainObject_default(objValue); | ||
} else if (!isObject_default(objValue) || isFunction_default(objValue)) { | ||
newValue = initCloneObject_default(srcValue); | ||
} | ||
} else { | ||
isCommon = false; | ||
} | ||
} | ||
if (isCommon) { | ||
stack.set(srcValue, newValue); | ||
mergeFunc(newValue, srcValue, srcIndex, customizer, stack); | ||
stack["delete"](srcValue); | ||
} | ||
assignMergeValue_default(object, key, newValue); | ||
} | ||
var baseMergeDeep_default = baseMergeDeep; | ||
// ../../common/temp/node_modules/.pnpm/lodash-es@4.17.20/node_modules/lodash-es/_baseMerge.js | ||
function baseMerge(object, source, srcIndex, customizer, stack) { | ||
if (object === source) { | ||
return; | ||
} | ||
baseFor_default(source, function(srcValue, key) { | ||
stack || (stack = new Stack_default()); | ||
if (isObject_default(srcValue)) { | ||
baseMergeDeep_default(object, source, key, srcIndex, baseMerge, customizer, stack); | ||
} else { | ||
var newValue = customizer ? customizer(safeGet_default(object, key), srcValue, key + "", object, source, stack) : void 0; | ||
if (newValue === void 0) { | ||
newValue = srcValue; | ||
} | ||
assignMergeValue_default(object, key, newValue); | ||
} | ||
}, keysIn_default); | ||
} | ||
var baseMerge_default = baseMerge; | ||
// ../../common/temp/node_modules/.pnpm/lodash-es@4.17.20/node_modules/lodash-es/mergeWith.js | ||
var mergeWith = createAssigner_default(function(object, source, srcIndex, customizer) { | ||
baseMerge_default(object, source, srcIndex, customizer); | ||
}); | ||
var mergeWith_default = mergeWith; | ||
// ../../common/temp/node_modules/.pnpm/lodash-es@4.17.20/node_modules/lodash-es/isEqual.js | ||
@@ -1505,8 +1077,3 @@ function isEqual(value, other) { | ||
// source/helpers.ts | ||
var deepMerge = (source1, source2) => mergeWith_default({}, source1, source2, (parent, child) => Array.isArray(parent) ? parent.concat(child) : void 0); | ||
// source/useAnalytics.tsx | ||
var defaultDispatch = () => { | ||
}; | ||
var defaultContext = {dispatch: defaultDispatch, eventData: {}}; | ||
@@ -1516,2 +1083,3 @@ var AnalyticsContext = createContext(defaultContext); | ||
const context = useContext(AnalyticsContext); | ||
const mergeData = options.mergeData ?? defaultMerge; | ||
const contextDispatch = context.dispatch; | ||
@@ -1526,11 +1094,18 @@ const dispatchOverride = options.dispatch; | ||
}, [contextDispatch, dispatchOverride]); | ||
const mergedEventState = options.localDataOnly ? localEventData : deepMerge(context.eventData, localEventData); | ||
const mergedEventState = options.localDataOnly ? localEventData : mergeData(context.eventData, localEventData); | ||
const [eventData, setEventData] = useState(mergedEventState); | ||
if (!isEqual_default(eventData, mergedEventState)) | ||
setEventData(mergedEventState); | ||
const [dispatchError, setDispatchError] = useState(); | ||
const [hasBeenMounted, setHasBeenMounted] = useState(false); | ||
const dispatchOnMount = options.dispatchOnMount === true; | ||
useEffect(() => { | ||
if (dispatchOnMount && !hasBeenMounted) | ||
dispatch(eventData); | ||
if (dispatchOnMount && !hasBeenMounted) { | ||
try { | ||
dispatch(eventData); | ||
setDispatchError(void 0); | ||
} catch (error) { | ||
setDispatchError(error); | ||
} | ||
} | ||
setHasBeenMounted(true); | ||
@@ -1545,4 +1120,11 @@ }, [dispatch, dispatchOnMount, eventData, hasBeenMounted]); | ||
}, children), [nextContext]); | ||
const trackEvent = useCallback((data) => dispatch({...eventData, ...data}), [dispatch, eventData]); | ||
return {Provider, trackEvent}; | ||
const trackEvent = useCallback((data) => { | ||
try { | ||
dispatch(mergeData(eventData, data)); | ||
setDispatchError(void 0); | ||
} catch (error) { | ||
setDispatchError(error); | ||
} | ||
}, [dispatch, eventData, mergeData]); | ||
return {Provider, trackEvent, error: dispatchError}; | ||
}; | ||
@@ -1549,0 +1131,0 @@ export { |
@@ -1,15 +0,2 @@ | ||
import React from 'react'; | ||
export declare type Dispatch = (data: Object) => void; | ||
export declare type Middleware = (data: Object, next: Dispatch) => void; | ||
export declare type UseAnalytics = (eventData?: Object, options?: { | ||
dispatch?: Middleware; | ||
dispatchOnMount?: boolean; | ||
localDataOnly?: boolean; | ||
}) => { | ||
Provider: ({ children }: { | ||
children: React.ReactNode; | ||
}) => React.ReactElement; | ||
trackEvent: (data: Object) => void; | ||
}; | ||
export declare const defaultDispatch: () => void; | ||
import { UseAnalytics } from './types'; | ||
export declare const useAnalytics: UseAnalytics; |
{ | ||
"private": false, | ||
"name": "@aperture.io/analytics", | ||
"version": "0.1.5", | ||
"version": "0.1.6", | ||
"description": "Declarative React analytics library", | ||
@@ -6,0 +6,0 @@ "author": "Eldar Shamukhamedov", |
Sorry, the diff of this file is not supported yet
175831
1050