react-session.manager.sk 2.0.6 → 2.0.7
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/README.md +54 -0
- package/dist/index.js +1 -1
- package/package.json +14 -2
- package/.babelrc +0 -5
- package/.gitattributes +0 -2
- package/.github/workflows/npm-publish.yml +0 -32
- package/dist/index.js.LICENSE.txt +0 -28
- package/src/components/ErrorBoundary.js +0 -142
- package/src/components/FingerPrint.js +0 -11
- package/src/components/versionCompare.js +0 -39
- package/src/index.js +0 -467
- package/src/styling/toast.css +0 -56
- package/webpack.config.js +0 -36
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
# This workflow will run tests using node and then publish a package to GitHub Packages when a release is created
|
|
2
|
-
# For more information see: https://docs.github.com/en/actions/publishing-packages/publishing-nodejs-packages
|
|
3
|
-
|
|
4
|
-
name: Node.js Package
|
|
5
|
-
|
|
6
|
-
on:
|
|
7
|
-
release:
|
|
8
|
-
types: [created]
|
|
9
|
-
|
|
10
|
-
jobs:
|
|
11
|
-
build:
|
|
12
|
-
runs-on: ubuntu-latest
|
|
13
|
-
steps:
|
|
14
|
-
- uses: actions/checkout@v4
|
|
15
|
-
- uses: actions/setup-node@v4
|
|
16
|
-
with:
|
|
17
|
-
node-version: 20
|
|
18
|
-
- run: npm ci
|
|
19
|
-
|
|
20
|
-
publish-npm:
|
|
21
|
-
needs: build
|
|
22
|
-
runs-on: ubuntu-latest
|
|
23
|
-
steps:
|
|
24
|
-
- uses: actions/checkout@v4
|
|
25
|
-
- uses: actions/setup-node@v4
|
|
26
|
-
with:
|
|
27
|
-
node-version: 20
|
|
28
|
-
registry-url: https://registry.npmjs.org/
|
|
29
|
-
- run: npm ci
|
|
30
|
-
- run: npm publish --access public
|
|
31
|
-
env:
|
|
32
|
-
NODE_AUTH_TOKEN: ${{secrets.npm_token}}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license React
|
|
3
|
-
* react-is.production.js
|
|
4
|
-
*
|
|
5
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
6
|
-
*
|
|
7
|
-
* This source code is licensed under the MIT license found in the
|
|
8
|
-
* LICENSE file in the root directory of this source tree.
|
|
9
|
-
*/
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* @license React
|
|
13
|
-
* react-jsx-runtime.production.min.js
|
|
14
|
-
*
|
|
15
|
-
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
16
|
-
*
|
|
17
|
-
* This source code is licensed under the MIT license found in the
|
|
18
|
-
* LICENSE file in the root directory of this source tree.
|
|
19
|
-
*/
|
|
20
|
-
|
|
21
|
-
/** @license React v16.13.1
|
|
22
|
-
* react-is.production.min.js
|
|
23
|
-
*
|
|
24
|
-
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
25
|
-
*
|
|
26
|
-
* This source code is licensed under the MIT license found in the
|
|
27
|
-
* LICENSE file in the root directory of this source tree.
|
|
28
|
-
*/
|
|
@@ -1,142 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import { toast } from "react-toastify";
|
|
3
|
-
|
|
4
|
-
class ErrorBoundary extends React.Component {
|
|
5
|
-
constructor(props) {
|
|
6
|
-
super(props);
|
|
7
|
-
this.state = { hasError: false, error: null, errorInfo: null };
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
static getDerivedStateFromError(error) {
|
|
11
|
-
// Update state so the next render will show the fallback UI
|
|
12
|
-
return { hasError: true };
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
componentDidCatch(error, errorInfo) {
|
|
16
|
-
console.error("ErrorBoundary caught an error:", error, errorInfo);
|
|
17
|
-
|
|
18
|
-
this.setState({
|
|
19
|
-
error: error,
|
|
20
|
-
errorInfo: errorInfo,
|
|
21
|
-
});
|
|
22
|
-
|
|
23
|
-
// Check if this is a theme-related error
|
|
24
|
-
const isThemeError =
|
|
25
|
-
error?.message?.includes("Cannot convert undefined or null to object") &&
|
|
26
|
-
(error?.stack?.includes("Object.entries") ||
|
|
27
|
-
error?.stack?.includes("theme") ||
|
|
28
|
-
error?.stack?.includes("Styled"));
|
|
29
|
-
|
|
30
|
-
const errorMessage = isThemeError
|
|
31
|
-
? "A theme error occurred. This might be due to connection issues. Please refresh the page."
|
|
32
|
-
: "Something went wrong. Please refresh the page or try again later.";
|
|
33
|
-
|
|
34
|
-
// Show a toast notification for the error
|
|
35
|
-
toast.error(errorMessage, {
|
|
36
|
-
toastId: "error-boundary",
|
|
37
|
-
icon: "❌",
|
|
38
|
-
autoClose: 10000,
|
|
39
|
-
});
|
|
40
|
-
|
|
41
|
-
// Log error to external service if needed
|
|
42
|
-
if (this.props.onError) {
|
|
43
|
-
this.props.onError(error, errorInfo);
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
handleRetry = () => {
|
|
48
|
-
this.setState({ hasError: false, error: null, errorInfo: null });
|
|
49
|
-
};
|
|
50
|
-
|
|
51
|
-
render() {
|
|
52
|
-
if (this.state.hasError) {
|
|
53
|
-
// Custom error UI
|
|
54
|
-
if (this.props.fallback) {
|
|
55
|
-
return this.props.fallback;
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
return (
|
|
59
|
-
<div
|
|
60
|
-
style={{
|
|
61
|
-
padding: "20px",
|
|
62
|
-
textAlign: "center",
|
|
63
|
-
backgroundColor: "#f8f9fa",
|
|
64
|
-
border: "1px solid #dee2e6",
|
|
65
|
-
borderRadius: "8px",
|
|
66
|
-
margin: "20px",
|
|
67
|
-
minHeight: "200px",
|
|
68
|
-
display: "flex",
|
|
69
|
-
flexDirection: "column",
|
|
70
|
-
justifyContent: "center",
|
|
71
|
-
alignItems: "center",
|
|
72
|
-
}}
|
|
73
|
-
>
|
|
74
|
-
<div style={{ fontSize: "48px", marginBottom: "16px" }}>⚠️</div>
|
|
75
|
-
<h2 style={{ color: "#343a40", marginBottom: "16px" }}>
|
|
76
|
-
Something went wrong
|
|
77
|
-
</h2>
|
|
78
|
-
<p style={{ color: "#6c757d", marginBottom: "20px" }}>
|
|
79
|
-
An unexpected error occurred. Please try refreshing the page.
|
|
80
|
-
</p>
|
|
81
|
-
<button
|
|
82
|
-
onClick={this.handleRetry}
|
|
83
|
-
style={{
|
|
84
|
-
backgroundColor: "#007bff",
|
|
85
|
-
color: "white",
|
|
86
|
-
border: "none",
|
|
87
|
-
padding: "10px 20px",
|
|
88
|
-
borderRadius: "4px",
|
|
89
|
-
cursor: "pointer",
|
|
90
|
-
marginRight: "10px",
|
|
91
|
-
}}
|
|
92
|
-
>
|
|
93
|
-
Try Again
|
|
94
|
-
</button>
|
|
95
|
-
<button
|
|
96
|
-
onClick={() => window.location.reload()}
|
|
97
|
-
style={{
|
|
98
|
-
backgroundColor: "#28a745",
|
|
99
|
-
color: "white",
|
|
100
|
-
border: "none",
|
|
101
|
-
padding: "10px 20px",
|
|
102
|
-
borderRadius: "4px",
|
|
103
|
-
cursor: "pointer",
|
|
104
|
-
}}
|
|
105
|
-
>
|
|
106
|
-
Refresh Page
|
|
107
|
-
</button>
|
|
108
|
-
|
|
109
|
-
{process.env.NODE_ENV === "development" && this.state.error && (
|
|
110
|
-
<details
|
|
111
|
-
style={{ marginTop: "20px", textAlign: "left", width: "100%" }}
|
|
112
|
-
>
|
|
113
|
-
<summary style={{ cursor: "pointer", fontWeight: "bold" }}>
|
|
114
|
-
Error Details (Development)
|
|
115
|
-
</summary>
|
|
116
|
-
<pre
|
|
117
|
-
style={{
|
|
118
|
-
backgroundColor: "#f8f9fa",
|
|
119
|
-
padding: "10px",
|
|
120
|
-
borderRadius: "4px",
|
|
121
|
-
overflow: "auto",
|
|
122
|
-
fontSize: "12px",
|
|
123
|
-
marginTop: "10px",
|
|
124
|
-
maxHeight: "300px",
|
|
125
|
-
textAlign: "left",
|
|
126
|
-
}}
|
|
127
|
-
>
|
|
128
|
-
{this.state.error && this.state.error.toString()}
|
|
129
|
-
<br />
|
|
130
|
-
{this.state.errorInfo?.componentStack}
|
|
131
|
-
</pre>
|
|
132
|
-
</details>
|
|
133
|
-
)}
|
|
134
|
-
</div>
|
|
135
|
-
);
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
return this.props.children;
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
export default ErrorBoundary;
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { ClientJS } from "clientjs";
|
|
2
|
-
|
|
3
|
-
export default function getDeviceFingerprint() {
|
|
4
|
-
if (localStorage.getItem("deviceFingerprint"))
|
|
5
|
-
return localStorage.getItem("deviceFingerprint");
|
|
6
|
-
|
|
7
|
-
const client = new ClientJS();
|
|
8
|
-
const fingerprint = client.getFingerprint();
|
|
9
|
-
localStorage.setItem("deviceFingerprint", fingerprint);
|
|
10
|
-
return fingerprint;
|
|
11
|
-
}
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
// Javascript implementation
|
|
2
|
-
|
|
3
|
-
// Method to compare two versions.
|
|
4
|
-
// Returns 1 if v2 is smaller, -1
|
|
5
|
-
// if v1 is smaller, 0 if equal
|
|
6
|
-
export default function versionCompare(v1, v2) {
|
|
7
|
-
// vnum stores each numeric
|
|
8
|
-
// part of version
|
|
9
|
-
var vnum1 = 0,
|
|
10
|
-
vnum2 = 0;
|
|
11
|
-
|
|
12
|
-
// loop until both string are
|
|
13
|
-
// processed
|
|
14
|
-
for (var i = 0, j = 0; i < v1.length || j < v2.length; ) {
|
|
15
|
-
// storing numeric part of
|
|
16
|
-
// version 1 in vnum1
|
|
17
|
-
while (i < v1.length && v1[i] !== ".") {
|
|
18
|
-
vnum1 = vnum1 * 10 + (v1[i] - "0");
|
|
19
|
-
i++;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
// storing numeric part of
|
|
23
|
-
// version 2 in vnum2
|
|
24
|
-
while (j < v2.length && v2[j] !== ".") {
|
|
25
|
-
vnum2 = vnum2 * 10 + (v2[j] - "0");
|
|
26
|
-
j++;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
if (vnum1 > vnum2) return true;
|
|
30
|
-
if (vnum2 > vnum1) return false;
|
|
31
|
-
|
|
32
|
-
// if equal, reset variables and
|
|
33
|
-
// go for next numeric part
|
|
34
|
-
vnum1 = vnum2 = 0;
|
|
35
|
-
i++;
|
|
36
|
-
j++;
|
|
37
|
-
}
|
|
38
|
-
return true;
|
|
39
|
-
}
|