@faststats/react 0.6.0 → 0.7.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/dist/index.js +6 -4
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -20,7 +20,7 @@ function setInstance(wa) {
|
|
|
20
20
|
//#endregion
|
|
21
21
|
//#region src/analytics.tsx
|
|
22
22
|
const SDK_NAME = "@faststats/react";
|
|
23
|
-
const SDK_VERSION = "0.
|
|
23
|
+
const SDK_VERSION = "0.7.0";
|
|
24
24
|
function Analytics(props) {
|
|
25
25
|
const ownedRef = useRef(null);
|
|
26
26
|
const propsRef = useRef(props);
|
|
@@ -28,7 +28,11 @@ function Analytics(props) {
|
|
|
28
28
|
useEffect(() => {
|
|
29
29
|
if (typeof window === "undefined") return;
|
|
30
30
|
if (ownedRef.current) return;
|
|
31
|
-
getInstance$1()
|
|
31
|
+
const existing = getInstance$1();
|
|
32
|
+
if (existing) {
|
|
33
|
+
setInstance(existing);
|
|
34
|
+
return () => setInstance(null);
|
|
35
|
+
}
|
|
32
36
|
const wa = new WebAnalytics({
|
|
33
37
|
...propsRef.current,
|
|
34
38
|
sdkName: SDK_NAME,
|
|
@@ -36,14 +40,12 @@ function Analytics(props) {
|
|
|
36
40
|
});
|
|
37
41
|
ownedRef.current = wa;
|
|
38
42
|
setInstance(wa);
|
|
39
|
-
window.__faststats = { getInstance: getInstance$1 };
|
|
40
43
|
return () => {
|
|
41
44
|
if (ownedRef.current === wa) {
|
|
42
45
|
wa.destroy();
|
|
43
46
|
ownedRef.current = null;
|
|
44
47
|
}
|
|
45
48
|
setInstance(null);
|
|
46
|
-
window.__faststats = void 0;
|
|
47
49
|
};
|
|
48
50
|
}, []);
|
|
49
51
|
useEffect(() => {
|
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"type": "git",
|
|
5
5
|
"url": "https://github.com/faststats-dev/faststats-javascript.git"
|
|
6
6
|
},
|
|
7
|
-
"version": "0.
|
|
7
|
+
"version": "0.7.0",
|
|
8
8
|
"type": "module",
|
|
9
9
|
"main": "./dist/index.js",
|
|
10
10
|
"module": "./dist/index.js",
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"react": ">=18"
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"@faststats/web": "^0.
|
|
34
|
+
"@faststats/web": "^0.7.0"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
37
37
|
"@types/node": "^25.9.3",
|