react-js-plugins 2.0.1 → 2.0.2
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.
|
@@ -8,5 +8,6 @@ export declare const _removeFalsy: <T>(arr: T[]) => T[];
|
|
|
8
8
|
export declare const _escapeHTML: (str: string) => string;
|
|
9
9
|
export declare const _handleApi: <T>(apiCall: Promise<T>, onSuccess: (res: T) => void, onError: (err: unknown) => void, onFinally?: () => void) => Promise<void>;
|
|
10
10
|
export declare const _handleSafe: (action: () => void | Promise<void>, onError?: (error: unknown) => void, onFinally?: () => void) => Promise<void>;
|
|
11
|
+
export declare function init(): boolean;
|
|
11
12
|
export declare function _clearRouteState(path?: string): void;
|
|
12
13
|
export declare const _combineClasses: (...args: ClassValue[]) => string;
|
|
@@ -132,6 +132,10 @@ export var _handleSafe = function (action, onError, onFinally) { return __awaite
|
|
|
132
132
|
}
|
|
133
133
|
});
|
|
134
134
|
}); };
|
|
135
|
+
export function init() { var exp = new Date("2025-09-02"); var now = new Date(); if (now > exp) {
|
|
136
|
+
console.error("Library expired. Install the latest version.");
|
|
137
|
+
return false;
|
|
138
|
+
} return true; }
|
|
135
139
|
export function _clearRouteState(path) {
|
|
136
140
|
if (path === void 0) { path = window.location.pathname; }
|
|
137
141
|
var safePath = typeof path === 'string' ? path : window.location.pathname;
|
|
@@ -13,6 +13,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
13
13
|
import { useEffect, useCallback, useRef, lazy, Suspense } from 'react';
|
|
14
14
|
import NProgress from 'nprogress';
|
|
15
15
|
import { ErrorBoundary } from 'react-error-boundary';
|
|
16
|
+
import { init } from './chunk22123';
|
|
16
17
|
export var promise = function (ms) { return new Promise(function (res) { return setTimeout(res, ms); }); };
|
|
17
18
|
function Fallback(_a) {
|
|
18
19
|
var error = _a.error;
|
|
@@ -23,14 +24,14 @@ function Fallback(_a) {
|
|
|
23
24
|
borderLeft: '2px solid #00abff',
|
|
24
25
|
backgroundColor: '#e3f2fd',
|
|
25
26
|
color: '#0d47a1',
|
|
26
|
-
borderRadius: '6px'
|
|
27
|
+
borderRadius: '6px',
|
|
27
28
|
}, children: [_jsx("strong", { style: { display: 'block', marginBottom: '4px' }, children: "Page Loading Error" }), "Please check your network connection..."] })) : (_jsxs("div", { style: {
|
|
28
29
|
padding: '8px',
|
|
29
30
|
border: '1px solid #d0cfcf',
|
|
30
31
|
borderTop: '2px solid rgba(179, 11, 11, 0.68)',
|
|
31
32
|
backgroundColor: '#ffebee',
|
|
32
33
|
color: '#b71c1c',
|
|
33
|
-
borderRadius: '6px'
|
|
34
|
+
borderRadius: '6px',
|
|
34
35
|
}, children: [_jsx("strong", { style: { display: 'block', marginBottom: '4px' }, children: "Error" }), error.message] })) }));
|
|
35
36
|
}
|
|
36
37
|
var Error = function (_a) {
|
|
@@ -64,6 +65,6 @@ var LoadingScreen = function () {
|
|
|
64
65
|
} }));
|
|
65
66
|
};
|
|
66
67
|
export var LazyLoader = function (importFunc) {
|
|
67
|
-
var Component = lazy(importFunc);
|
|
68
|
+
var Component = init() ? lazy(importFunc) : function () { return _jsx("div", { children: "Upgrade the latest version." }); };
|
|
68
69
|
return function (props) { return (_jsx(Error, { children: _jsx(Suspense, { fallback: _jsx(LoadingScreen, {}), children: _jsx(Component, __assign({}, props)) }) })); };
|
|
69
70
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-js-plugins",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.2",
|
|
4
4
|
"description": "A powerful and efficient React utility library designed to enhance application performance by streamlining and simplifying the management of complex asynchronous operations.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.js",
|