@artisan-commerce/analytics-rn 0.3.0-canary.79 → 0.3.0-canary.80
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bundle.cjs.js +119 -10
- package/dist/bundle.cjs.js.map +1 -1
- package/dist/bundle.esm.js +115 -6
- package/dist/bundle.esm.js.map +1 -1
- package/package.json +4 -4
package/dist/bundle.cjs.js
CHANGED
|
@@ -4,9 +4,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
4
4
|
|
|
5
5
|
var reactNativeFbsdkNext = require('react-native-fbsdk-next');
|
|
6
6
|
var reactNative = require('react-native');
|
|
7
|
-
var state = require('@artisan-commerce/state');
|
|
8
7
|
var analytics = require('@segment/analytics-react-native');
|
|
9
|
-
var snakeCase = require('snake-case');
|
|
10
8
|
var analytics$1 = require('@react-native-firebase/analytics');
|
|
11
9
|
var shoppingCartCore = require('@artisan-commerce/shopping-cart-core');
|
|
12
10
|
var products = require('@artisan-commerce/products');
|
|
@@ -16,9 +14,44 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'defau
|
|
|
16
14
|
var analytics__default = /*#__PURE__*/_interopDefaultLegacy(analytics);
|
|
17
15
|
var analytics__default$1 = /*#__PURE__*/_interopDefaultLegacy(analytics$1);
|
|
18
16
|
|
|
17
|
+
var __defProp$41 = Object.defineProperty;
|
|
18
|
+
var __getOwnPropSymbols$41 = Object.getOwnPropertySymbols;
|
|
19
|
+
var __hasOwnProp$41 = Object.prototype.hasOwnProperty;
|
|
20
|
+
var __propIsEnum$41 = Object.prototype.propertyIsEnumerable;
|
|
21
|
+
var __defNormalProp$41 = (obj, key, value) => key in obj ? __defProp$41(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
22
|
+
var __spreadValues$41 = (a, b) => {
|
|
23
|
+
for (var prop in b || (b = {}))
|
|
24
|
+
if (__hasOwnProp$41.call(b, prop))
|
|
25
|
+
__defNormalProp$41(a, prop, b[prop]);
|
|
26
|
+
if (__getOwnPropSymbols$41)
|
|
27
|
+
for (var prop of __getOwnPropSymbols$41(b)) {
|
|
28
|
+
if (__propIsEnum$41.call(b, prop))
|
|
29
|
+
__defNormalProp$41(a, prop, b[prop]);
|
|
30
|
+
}
|
|
31
|
+
return a;
|
|
32
|
+
};
|
|
33
|
+
let state = null;
|
|
34
|
+
const initState = (initialState) => {
|
|
35
|
+
Object.freeze(initialState);
|
|
36
|
+
state = __spreadValues$41({}, initialState);
|
|
37
|
+
Object.seal(state);
|
|
38
|
+
};
|
|
39
|
+
const setState$1 = (overrides) => {
|
|
40
|
+
const tempState = state ? __spreadValues$41({}, state) : {};
|
|
41
|
+
state = null;
|
|
42
|
+
state = __spreadValues$41(__spreadValues$41({}, tempState), overrides);
|
|
43
|
+
Object.seal(state);
|
|
44
|
+
};
|
|
45
|
+
const getState$1 = () => {
|
|
46
|
+
if (state === null) {
|
|
47
|
+
throw new Error("The state has not been initialized, make sure to call initState beforehand");
|
|
48
|
+
}
|
|
49
|
+
return __spreadValues$41({}, state);
|
|
50
|
+
};
|
|
51
|
+
|
|
19
52
|
var name = "@artisan-commerce/analytics-rn";
|
|
20
53
|
var description = "Artisn commerce analytics react native library";
|
|
21
|
-
var version = "0.3.0-canary.
|
|
54
|
+
var version = "0.3.0-canary.80";
|
|
22
55
|
var main = "./dist/bundle.cjs.js";
|
|
23
56
|
var module$1 = "./dist/bundle.esm.js";
|
|
24
57
|
var types = "./dist/bundle.d.ts";
|
|
@@ -52,8 +85,8 @@ var dependencies = {
|
|
|
52
85
|
"snake-case": "^3.0.4"
|
|
53
86
|
};
|
|
54
87
|
var devDependencies = {
|
|
55
|
-
"@artisan-commerce/products": "0.9.0-canary.
|
|
56
|
-
"@artisan-commerce/shopping-cart-core": "0.12.0-canary.
|
|
88
|
+
"@artisan-commerce/products": "0.9.0-canary.52",
|
|
89
|
+
"@artisan-commerce/shopping-cart-core": "0.12.0-canary.75",
|
|
57
90
|
"@artisan-commerce/state": "0.3.0-canary.9",
|
|
58
91
|
"@artisan-commerce/types": "0.14.0-canary.38",
|
|
59
92
|
"@babel/core": "^7.13.15",
|
|
@@ -96,7 +129,7 @@ var nx = {
|
|
|
96
129
|
}
|
|
97
130
|
}
|
|
98
131
|
};
|
|
99
|
-
var gitHead = "
|
|
132
|
+
var gitHead = "c60bd898df04ba5628d0a4fb9623ad1b67e9e045";
|
|
100
133
|
var packageJSON = {
|
|
101
134
|
name: name,
|
|
102
135
|
description: description,
|
|
@@ -136,10 +169,10 @@ const initialState = {
|
|
|
136
169
|
}
|
|
137
170
|
};
|
|
138
171
|
const setInitialState = () => {
|
|
139
|
-
|
|
172
|
+
initState(initialState);
|
|
140
173
|
};
|
|
141
|
-
const getState = () =>
|
|
142
|
-
const setState = (state
|
|
174
|
+
const getState = () => getState$1();
|
|
175
|
+
const setState = (state) => setState$1(state);
|
|
143
176
|
|
|
144
177
|
var __defProp$40 = Object.defineProperty;
|
|
145
178
|
var __defProps$2s = Object.defineProperties;
|
|
@@ -498,6 +531,82 @@ const initAnalytics = (config) => {
|
|
|
498
531
|
});
|
|
499
532
|
};
|
|
500
533
|
|
|
534
|
+
/******************************************************************************
|
|
535
|
+
Copyright (c) Microsoft Corporation.
|
|
536
|
+
|
|
537
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
|
538
|
+
purpose with or without fee is hereby granted.
|
|
539
|
+
|
|
540
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
541
|
+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
542
|
+
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
543
|
+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
544
|
+
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
545
|
+
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
546
|
+
PERFORMANCE OF THIS SOFTWARE.
|
|
547
|
+
***************************************************************************** */
|
|
548
|
+
|
|
549
|
+
var __assign = function() {
|
|
550
|
+
__assign = Object.assign || function __assign(t) {
|
|
551
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
552
|
+
s = arguments[i];
|
|
553
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
|
554
|
+
}
|
|
555
|
+
return t;
|
|
556
|
+
};
|
|
557
|
+
return __assign.apply(this, arguments);
|
|
558
|
+
};
|
|
559
|
+
|
|
560
|
+
/**
|
|
561
|
+
* Source: ftp://ftp.unicode.org/Public/UCD/latest/ucd/SpecialCasing.txt
|
|
562
|
+
*/
|
|
563
|
+
/**
|
|
564
|
+
* Lower case as a function.
|
|
565
|
+
*/
|
|
566
|
+
function lowerCase(str) {
|
|
567
|
+
return str.toLowerCase();
|
|
568
|
+
}
|
|
569
|
+
|
|
570
|
+
// Support camel case ("camelCase" -> "camel Case" and "CAMELCase" -> "CAMEL Case").
|
|
571
|
+
var DEFAULT_SPLIT_REGEXP = [/([a-z0-9])([A-Z])/g, /([A-Z])([A-Z][a-z])/g];
|
|
572
|
+
// Remove all non-word characters.
|
|
573
|
+
var DEFAULT_STRIP_REGEXP = /[^A-Z0-9]+/gi;
|
|
574
|
+
/**
|
|
575
|
+
* Normalize the string into something other libraries can manipulate easier.
|
|
576
|
+
*/
|
|
577
|
+
function noCase(input, options) {
|
|
578
|
+
if (options === void 0) { options = {}; }
|
|
579
|
+
var _a = options.splitRegexp, splitRegexp = _a === void 0 ? DEFAULT_SPLIT_REGEXP : _a, _b = options.stripRegexp, stripRegexp = _b === void 0 ? DEFAULT_STRIP_REGEXP : _b, _c = options.transform, transform = _c === void 0 ? lowerCase : _c, _d = options.delimiter, delimiter = _d === void 0 ? " " : _d;
|
|
580
|
+
var result = replace(replace(input, splitRegexp, "$1\0$2"), stripRegexp, "\0");
|
|
581
|
+
var start = 0;
|
|
582
|
+
var end = result.length;
|
|
583
|
+
// Trim the delimiter from around the output string.
|
|
584
|
+
while (result.charAt(start) === "\0")
|
|
585
|
+
start++;
|
|
586
|
+
while (result.charAt(end - 1) === "\0")
|
|
587
|
+
end--;
|
|
588
|
+
// Transform each token independently.
|
|
589
|
+
return result.slice(start, end).split("\0").map(transform).join(delimiter);
|
|
590
|
+
}
|
|
591
|
+
/**
|
|
592
|
+
* Replace `re` in the input string with the replacement value.
|
|
593
|
+
*/
|
|
594
|
+
function replace(input, re, value) {
|
|
595
|
+
if (re instanceof RegExp)
|
|
596
|
+
return input.replace(re, value);
|
|
597
|
+
return re.reduce(function (input, re) { return input.replace(re, value); }, input);
|
|
598
|
+
}
|
|
599
|
+
|
|
600
|
+
function dotCase(input, options) {
|
|
601
|
+
if (options === void 0) { options = {}; }
|
|
602
|
+
return noCase(input, __assign({ delimiter: "." }, options));
|
|
603
|
+
}
|
|
604
|
+
|
|
605
|
+
function snakeCase(input, options) {
|
|
606
|
+
if (options === void 0) { options = {}; }
|
|
607
|
+
return dotCase(input, __assign({ delimiter: "_" }, options));
|
|
608
|
+
}
|
|
609
|
+
|
|
501
610
|
var __defProp$3X = Object.defineProperty;
|
|
502
611
|
var __defProps$2n = Object.defineProperties;
|
|
503
612
|
var __getOwnPropDescs$2n = Object.getOwnPropertyDescriptors;
|
|
@@ -520,7 +629,7 @@ var __spreadProps$2n = (a, b) => __defProps$2n(a, __getOwnPropDescs$2n(b));
|
|
|
520
629
|
const eventParamsToSnakeCase = (params) => {
|
|
521
630
|
return Object.entries(params).reduce((acc, params2) => {
|
|
522
631
|
const [key, value] = params2;
|
|
523
|
-
const newKey = snakeCase
|
|
632
|
+
const newKey = snakeCase(key);
|
|
524
633
|
return __spreadProps$2n(__spreadValues$3X({}, acc), {
|
|
525
634
|
[newKey]: value
|
|
526
635
|
});
|