@uxf/analytics 14.0.0 → 14.1.0
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/package.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@uxf/analytics",
|
|
3
|
-
"version": "14.
|
|
3
|
+
"version": "14.1.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"scripts": {
|
|
6
|
-
"build": "tsc -P tsconfig.json",
|
|
6
|
+
"build": "tsc -P tsconfig.json && node ../../scripts/build-react-package.mjs",
|
|
7
7
|
"typecheck": "tsc --noEmit"
|
|
8
8
|
},
|
|
9
9
|
"publishConfig": {
|
|
@@ -15,14 +15,14 @@
|
|
|
15
15
|
"author": "",
|
|
16
16
|
"license": "ISC",
|
|
17
17
|
"peerDependencies": {
|
|
18
|
-
"@uxf/core": "14.
|
|
19
|
-
"@uxf/core-react": "14.
|
|
18
|
+
"@uxf/core": "14.1.0",
|
|
19
|
+
"@uxf/core-react": "14.1.0",
|
|
20
20
|
"react": "^19.3.0"
|
|
21
21
|
},
|
|
22
22
|
"devDependencies": {
|
|
23
23
|
"@types/react": "19.3.0",
|
|
24
|
-
"@uxf/core": "14.
|
|
25
|
-
"@uxf/core-react": "14.
|
|
24
|
+
"@uxf/core": "14.1.0",
|
|
25
|
+
"@uxf/core-react": "14.1.0",
|
|
26
26
|
"react": "19.3.0"
|
|
27
27
|
}
|
|
28
28
|
}
|
|
@@ -37,23 +37,84 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
37
37
|
exports.ABTestingProvider = ABTestingProvider;
|
|
38
38
|
exports.useABTesting = useABTesting;
|
|
39
39
|
exports.useABTestingVariant = useABTestingVariant;
|
|
40
|
+
const compiler_runtime_1 = require("react/compiler-runtime");
|
|
40
41
|
const global_context_1 = require("@uxf/core-react/global-context");
|
|
41
42
|
const react_1 = __importStar(require("react"));
|
|
42
43
|
const ab_testing_1 = require("./ab-testing");
|
|
43
44
|
const ABTestingContext = (0, global_context_1.createGlobalContext)("analytics/ab-testing", []);
|
|
44
45
|
function ABTestingProvider(props) {
|
|
45
|
-
(0,
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
46
|
+
const $ = (0, compiler_runtime_1.c)(8);
|
|
47
|
+
let t0;
|
|
48
|
+
if ($[0] !== props.getExpVariantString) {
|
|
49
|
+
t0 = () => (0, ab_testing_1.sendABTestingEvent)(props.getExpVariantString);
|
|
50
|
+
$[0] = props.getExpVariantString;
|
|
51
|
+
$[1] = t0;
|
|
52
|
+
}
|
|
53
|
+
else {
|
|
54
|
+
t0 = $[1];
|
|
55
|
+
}
|
|
56
|
+
const sendEvent = (0, react_1.useEffectEvent)(t0);
|
|
57
|
+
let t1;
|
|
58
|
+
if ($[2] !== sendEvent) {
|
|
59
|
+
t1 = () => {
|
|
60
|
+
sendEvent();
|
|
61
|
+
};
|
|
62
|
+
$[2] = sendEvent;
|
|
63
|
+
$[3] = t1;
|
|
64
|
+
}
|
|
65
|
+
else {
|
|
66
|
+
t1 = $[3];
|
|
67
|
+
}
|
|
68
|
+
let t2;
|
|
69
|
+
if ($[4] === Symbol.for("react.memo_cache_sentinel")) {
|
|
70
|
+
t2 = [];
|
|
71
|
+
$[4] = t2;
|
|
72
|
+
}
|
|
73
|
+
else {
|
|
74
|
+
t2 = $[4];
|
|
75
|
+
}
|
|
76
|
+
(0, react_1.useEffect)(t1, t2);
|
|
77
|
+
let t3;
|
|
78
|
+
if ($[5] !== props.children || $[6] !== props.experiments) {
|
|
79
|
+
t3 = react_1.default.createElement(ABTestingContext, { value: props.experiments }, props.children);
|
|
80
|
+
$[5] = props.children;
|
|
81
|
+
$[6] = props.experiments;
|
|
82
|
+
$[7] = t3;
|
|
83
|
+
}
|
|
84
|
+
else {
|
|
85
|
+
t3 = $[7];
|
|
86
|
+
}
|
|
87
|
+
return t3;
|
|
50
88
|
}
|
|
51
89
|
function useABTesting() {
|
|
52
90
|
return (0, react_1.useContext)(ABTestingContext);
|
|
53
91
|
}
|
|
54
92
|
function useABTestingVariant(experimentId) {
|
|
55
93
|
var _a;
|
|
94
|
+
const $ = (0, compiler_runtime_1.c)(5);
|
|
56
95
|
const experiments = useABTesting();
|
|
57
|
-
|
|
58
|
-
|
|
96
|
+
let t0;
|
|
97
|
+
if ($[0] !== experimentId || $[1] !== experiments) {
|
|
98
|
+
let t1;
|
|
99
|
+
if ($[3] !== experimentId) {
|
|
100
|
+
t1 = t2 => {
|
|
101
|
+
const [name] = t2;
|
|
102
|
+
return name === experimentId;
|
|
103
|
+
};
|
|
104
|
+
$[3] = experimentId;
|
|
105
|
+
$[4] = t1;
|
|
106
|
+
}
|
|
107
|
+
else {
|
|
108
|
+
t1 = $[4];
|
|
109
|
+
}
|
|
110
|
+
const experiment = experiments.find(t1);
|
|
111
|
+
t0 = (_a = experiment === null || experiment === void 0 ? void 0 : experiment.at(1)) !== null && _a !== void 0 ? _a : null;
|
|
112
|
+
$[0] = experimentId;
|
|
113
|
+
$[1] = experiments;
|
|
114
|
+
$[2] = t0;
|
|
115
|
+
}
|
|
116
|
+
else {
|
|
117
|
+
t0 = $[2];
|
|
118
|
+
}
|
|
119
|
+
return t0;
|
|
59
120
|
}
|
package/src/gtm/gtm-script.js
CHANGED
|
@@ -4,10 +4,32 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.GtmScript = GtmScript;
|
|
7
|
+
const compiler_runtime_1 = require("react/compiler-runtime");
|
|
7
8
|
const is_server_1 = require("@uxf/core/utils/is-server");
|
|
8
9
|
const react_1 = __importDefault(require("react"));
|
|
9
10
|
const use_gtm_script_1 = require("./use-gtm-script");
|
|
10
11
|
function GtmScript(props) {
|
|
12
|
+
const $ = (0, compiler_runtime_1.c)(4);
|
|
11
13
|
const gtmScript = (0, use_gtm_script_1.useGtmScript)(props.gtmId);
|
|
12
|
-
|
|
14
|
+
let t0;
|
|
15
|
+
if ($[0] !== gtmScript) {
|
|
16
|
+
t0 = !is_server_1.isServer && react_1.default.createElement("script", { dangerouslySetInnerHTML: {
|
|
17
|
+
__html: gtmScript
|
|
18
|
+
} });
|
|
19
|
+
$[0] = gtmScript;
|
|
20
|
+
$[1] = t0;
|
|
21
|
+
}
|
|
22
|
+
else {
|
|
23
|
+
t0 = $[1];
|
|
24
|
+
}
|
|
25
|
+
let t1;
|
|
26
|
+
if ($[2] !== t0) {
|
|
27
|
+
t1 = react_1.default.createElement(react_1.default.Fragment, null, t0);
|
|
28
|
+
$[2] = t0;
|
|
29
|
+
$[3] = t1;
|
|
30
|
+
}
|
|
31
|
+
else {
|
|
32
|
+
t1 = $[3];
|
|
33
|
+
}
|
|
34
|
+
return t1;
|
|
13
35
|
}
|