react-js-plugins 3.14.1 → 3.14.3
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 +5 -5
- package/dist/chunkautils/chunk65431.d.ts +0 -6
- package/dist/chunkautils/chunk65431.js +61 -59
- package/dist/chunkautils/chunkLicense.d.ts +11 -0
- package/dist/chunkautils/chunkLicense.js +98 -0
- package/dist/index.d.ts +6 -3
- package/dist/index.js +13 -3
- package/dist/licenseGenerator.d.ts +23 -0
- package/dist/licenseGenerator.js +73 -0
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -20,7 +20,7 @@ pnpm add react-js-plugins
|
|
|
20
20
|
|
|
21
21
|
### **Authors**
|
|
22
22
|
|
|
23
|
-
    
|
|
24
24
|
|
|
25
25
|
### **Browser Support**
|
|
26
26
|
|
|
@@ -707,7 +707,7 @@ Decrypts an AES-encrypted string using the provided IV and secret key.
|
|
|
707
707
|
const plainText = _decryptString(ciphertext, iv, "secretKey");
|
|
708
708
|
```
|
|
709
709
|
|
|
710
|
-
### ✅ **_encrypt**
|
|
710
|
+
<!-- ### ✅ **_encrypt**
|
|
711
711
|
|
|
712
712
|
Encrypts a full JSON payload using a **random key and IV**, both of which are **secured by a main secret key**.
|
|
713
713
|
This ensures that each encryption produces a unique ciphertext, even for the same input data.
|
|
@@ -737,9 +737,9 @@ const decryptedPayload = _decrypt(encryptedPayload, "mainSecretKey");
|
|
|
737
737
|
Returns:
|
|
738
738
|
{ userId: 101, role: "admin" }
|
|
739
739
|
*/
|
|
740
|
-
```
|
|
740
|
+
``` -->
|
|
741
741
|
|
|
742
|
-
|
|
742
|
+
### ✅ **_encryptData**
|
|
743
743
|
|
|
744
744
|
Encrypts payload or data using AES encryption with a static IV.
|
|
745
745
|
|
|
@@ -761,7 +761,7 @@ const result = _decryptData({
|
|
|
761
761
|
secretKey: "Base64EncodedSecretKey",
|
|
762
762
|
iv: "Base64EncodedIV"
|
|
763
763
|
});
|
|
764
|
-
```
|
|
764
|
+
```
|
|
765
765
|
|
|
766
766
|
### ✅ **_escapeHTML**
|
|
767
767
|
Escapes special HTML characters to prevent injection or rendering issues.
|
|
@@ -13,12 +13,6 @@ export declare const _encryptString: (text: string, secretKey: string, isRandom?
|
|
|
13
13
|
iv: string;
|
|
14
14
|
};
|
|
15
15
|
export declare const _decryptString: (ciphertext: string, ivBase64: string, secretKey: string) => string;
|
|
16
|
-
export declare const _encrypt: (jsonData: any, secretKey: string) => {
|
|
17
|
-
data: string;
|
|
18
|
-
header: string;
|
|
19
|
-
iv: string;
|
|
20
|
-
} | null;
|
|
21
|
-
export declare const _decrypt: (encryptedPayload: any, secretKey: string) => any;
|
|
22
16
|
export declare const _encryptData: (params: {
|
|
23
17
|
data: any;
|
|
24
18
|
secretKey: string;
|
|
@@ -181,65 +181,67 @@ export var _decryptString = function (ciphertext, ivBase64, secretKey) {
|
|
|
181
181
|
});
|
|
182
182
|
return decryptedText.toString(CryptoJS.enc.Utf8);
|
|
183
183
|
};
|
|
184
|
-
export
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
184
|
+
// export const _encrypt = (jsonData: any, secretKey: string) => {
|
|
185
|
+
// try {
|
|
186
|
+
// if (!jsonData || typeof jsonData !== "object") {
|
|
187
|
+
// throw new Error("Invalid input: jsonData must be a valid JSON object.");
|
|
188
|
+
// }
|
|
189
|
+
// if (!secretKey || typeof secretKey !== "string") {
|
|
190
|
+
// throw new Error("Invalid input: secretKey must be a non-empty string.");
|
|
191
|
+
// }
|
|
192
|
+
// const randomKey = CryptoJS.lib.WordArray.random(16);
|
|
193
|
+
// const randomIv = CryptoJS.lib.WordArray.random(16);
|
|
194
|
+
// const keyIvData = JSON.stringify({
|
|
195
|
+
// key: CryptoJS.enc.Base64.stringify(randomKey),
|
|
196
|
+
// iv: CryptoJS.enc.Base64.stringify(randomIv),
|
|
197
|
+
// });
|
|
198
|
+
// const header = _encryptString(keyIvData, secretKey, false);
|
|
199
|
+
// const encryptedData = CryptoJS.AES.encrypt(
|
|
200
|
+
// JSON.stringify(jsonData),
|
|
201
|
+
// randomKey,
|
|
202
|
+
// {
|
|
203
|
+
// iv: randomIv,
|
|
204
|
+
// mode: CryptoJS.mode.CBC,
|
|
205
|
+
// padding: CryptoJS.pad.Pkcs7,
|
|
206
|
+
// }
|
|
207
|
+
// );
|
|
208
|
+
// return {
|
|
209
|
+
// data: encryptedData.toString(),
|
|
210
|
+
// header: header.ciphertext,
|
|
211
|
+
// iv: header.iv,
|
|
212
|
+
// };
|
|
213
|
+
// } catch (error: any) {
|
|
214
|
+
// console.error("Payload Encryption Error:", error.message);
|
|
215
|
+
// return null;
|
|
216
|
+
// }
|
|
217
|
+
// };
|
|
218
|
+
// export const _decrypt = (encryptedPayload: any, secretKey: string) => {
|
|
219
|
+
// try {
|
|
220
|
+
// if (!encryptedPayload || typeof encryptedPayload !== "object") {
|
|
221
|
+
// throw new Error("Invalid input: 'encryptedPayload' must be a valid object.");
|
|
222
|
+
// }
|
|
223
|
+
// const { data, header, iv } = encryptedPayload;
|
|
224
|
+
// if (!data || !header || !iv) {
|
|
225
|
+
// throw new Error("Invalid encrypted payload: missing data, header, or iv.");
|
|
226
|
+
// }
|
|
227
|
+
// const headerJson = _decryptString(header, iv, secretKey);
|
|
228
|
+
// const { key, iv: dataIv } = JSON.parse(headerJson);
|
|
229
|
+
// const randomKey = CryptoJS.enc.Base64.parse(key);
|
|
230
|
+
// const randomIv = CryptoJS.enc.Base64.parse(dataIv);
|
|
231
|
+
// const decryptedBytes = CryptoJS.AES.decrypt(data, randomKey, {
|
|
232
|
+
// iv: randomIv,
|
|
233
|
+
// mode: CryptoJS.mode.CBC,
|
|
234
|
+
// padding: CryptoJS.pad.Pkcs7,
|
|
235
|
+
// });
|
|
236
|
+
// const decryptedText = decryptedBytes.toString(CryptoJS.enc.Utf8);
|
|
237
|
+
// if (!decryptedText)
|
|
238
|
+
// throw new Error("Decryption failed: invalid key or corrupted data.");
|
|
239
|
+
// return JSON.parse(decryptedText);
|
|
240
|
+
// } catch (error: any) {
|
|
241
|
+
// console.error("Payload Decryption Error:", error.message);
|
|
242
|
+
// return null;
|
|
243
|
+
// }
|
|
244
|
+
// };
|
|
243
245
|
export var _encryptData = function (params) {
|
|
244
246
|
try {
|
|
245
247
|
var data = params.data, secretKey = params.secretKey, iv = params.iv;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export declare const initLicense: (key: string) => {
|
|
2
|
+
success: boolean;
|
|
3
|
+
message: string;
|
|
4
|
+
};
|
|
5
|
+
export declare const isLicensed: () => boolean;
|
|
6
|
+
export declare const getLicenseInfo: () => {
|
|
7
|
+
licensedTo: string;
|
|
8
|
+
expiresAt: string;
|
|
9
|
+
issuedAt: string;
|
|
10
|
+
} | null;
|
|
11
|
+
export declare const _assertLicensed: () => void;
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import CryptoJS from 'crypto-js';
|
|
2
|
+
// ── Obfuscated master secret ─────────────────────────────────────────────────
|
|
3
|
+
// Parts are hex-escaped so they are NOT plain-text searchable in the bundle.
|
|
4
|
+
// IMPORTANT: Change ALL six parts together when rotating your signing secret.
|
|
5
|
+
// Rotating invalidates every existing license key — issue new ones.
|
|
6
|
+
var _P1 = '\x37\x62\x64\x34\x65\x39\x61\x32'; // 7bd4e9a2
|
|
7
|
+
var _P2 = '\x66\x31\x63\x38\x61\x30\x35\x62'; // f1c8a05b
|
|
8
|
+
var _P3 = '\x32\x65\x37\x64\x39\x62\x34\x63'; // 2e7d9b4c
|
|
9
|
+
var _P4 = '\x61\x35\x66\x33\x63\x38\x65\x31'; // a5f3c8e1
|
|
10
|
+
var _P5 = '\x39\x30\x62\x32\x64\x35\x61\x38'; // 90b2d5a8
|
|
11
|
+
var _P6 = '\x63\x36\x65\x31\x66\x34\x39\x62'; // c6e1f49b
|
|
12
|
+
// Interleaved order + null-byte separator makes naive string search harder
|
|
13
|
+
var _ms = function () { return [_P1, _P3, _P5, _P2, _P6, _P4].join('\u0000'); };
|
|
14
|
+
// ── Salts (hex-escaped) ───────────────────────────────────────────────────────
|
|
15
|
+
// rjp_sig_v1
|
|
16
|
+
var _SS = '\x72\x6a\x70\x5f\x73\x69\x67\x5f\x76\x31';
|
|
17
|
+
// rjp_enc_v1
|
|
18
|
+
var _ES = '\x72\x6a\x70\x5f\x65\x6e\x63\x5f\x76\x31';
|
|
19
|
+
// ── Lazy-derived keys (computed once, cached) ─────────────────────────────────
|
|
20
|
+
var _cachedSK = null;
|
|
21
|
+
var _cachedEK = null;
|
|
22
|
+
var _SK = function () {
|
|
23
|
+
if (!_cachedSK)
|
|
24
|
+
_cachedSK = CryptoJS.PBKDF2(_ms(), _SS, { keySize: 8, iterations: 2048 }).toString();
|
|
25
|
+
return _cachedSK;
|
|
26
|
+
};
|
|
27
|
+
var _EK = function () {
|
|
28
|
+
if (!_cachedEK)
|
|
29
|
+
_cachedEK = CryptoJS.PBKDF2(_ms(), _ES, { keySize: 8, iterations: 2048 }).toString();
|
|
30
|
+
return _cachedEK;
|
|
31
|
+
};
|
|
32
|
+
// ── Runtime state ─────────────────────────────────────────────────────────────
|
|
33
|
+
var _active = false;
|
|
34
|
+
var _info = null;
|
|
35
|
+
// ── Timing-safe comparison (prevents timing-oracle attacks) ───────────────────
|
|
36
|
+
var _tsEq = function (a, b) {
|
|
37
|
+
if (a.length !== b.length)
|
|
38
|
+
return false;
|
|
39
|
+
var d = 0;
|
|
40
|
+
for (var i = 0; i < a.length; i++)
|
|
41
|
+
d |= a.charCodeAt(i) ^ b.charCodeAt(i);
|
|
42
|
+
return d === 0;
|
|
43
|
+
};
|
|
44
|
+
// ── Public: activate ──────────────────────────────────────────────────────────
|
|
45
|
+
export var initLicense = function (key) {
|
|
46
|
+
try {
|
|
47
|
+
if (!key || typeof key !== 'string')
|
|
48
|
+
return { success: false, message: 'A license key is required.' };
|
|
49
|
+
var trimmed = key.trim();
|
|
50
|
+
var dot = trimmed.lastIndexOf('.');
|
|
51
|
+
if (dot < 1)
|
|
52
|
+
return { success: false, message: 'Invalid license key format.' };
|
|
53
|
+
var encPayload = trimmed.slice(0, dot);
|
|
54
|
+
var sig = trimmed.slice(dot + 1);
|
|
55
|
+
// ① Verify HMAC-SHA256 signature — prevents forgery & tampering
|
|
56
|
+
var expected = CryptoJS.HmacSHA256(encPayload, _SK()).toString();
|
|
57
|
+
if (!_tsEq(expected, sig))
|
|
58
|
+
return { success: false, message: 'Invalid license key.' };
|
|
59
|
+
// ② Decrypt AES-256 payload
|
|
60
|
+
var raw = CryptoJS.AES.decrypt(encPayload, _EK()).toString(CryptoJS.enc.Utf8);
|
|
61
|
+
if (!raw)
|
|
62
|
+
return { success: false, message: 'Invalid license key.' };
|
|
63
|
+
var payload = JSON.parse(raw);
|
|
64
|
+
// ③ Schema version
|
|
65
|
+
if (payload.v !== 1)
|
|
66
|
+
return { success: false, message: 'Unsupported license version.' };
|
|
67
|
+
// ④ Expiry
|
|
68
|
+
if (Date.now() > payload.exp) {
|
|
69
|
+
var d = new Date(payload.exp).toLocaleDateString();
|
|
70
|
+
return { success: false, message: "License expired on ".concat(d, ". Please renew.") };
|
|
71
|
+
}
|
|
72
|
+
_active = true;
|
|
73
|
+
_info = payload;
|
|
74
|
+
return { success: true, message: "License activated for: ".concat(payload.uid) };
|
|
75
|
+
}
|
|
76
|
+
catch (_a) {
|
|
77
|
+
return { success: false, message: 'Invalid license key.' };
|
|
78
|
+
}
|
|
79
|
+
};
|
|
80
|
+
// ── Public: query ─────────────────────────────────────────────────────────────
|
|
81
|
+
export var isLicensed = function () { return _active; };
|
|
82
|
+
export var getLicenseInfo = function () {
|
|
83
|
+
return _info
|
|
84
|
+
? {
|
|
85
|
+
licensedTo: _info.uid,
|
|
86
|
+
expiresAt: new Date(_info.exp).toISOString(),
|
|
87
|
+
issuedAt: new Date(_info.iat).toISOString(),
|
|
88
|
+
}
|
|
89
|
+
: null;
|
|
90
|
+
};
|
|
91
|
+
// ── Internal guard (used by every export) ─────────────────────────────────────
|
|
92
|
+
export var _assertLicensed = function () {
|
|
93
|
+
if (!_active) {
|
|
94
|
+
throw new Error('[react-js-plugins] No valid license detected.\n' +
|
|
95
|
+
'Call initLicense(key) once at app startup before using this package.\n' +
|
|
96
|
+
'To get a license visit: https://your-website.com/license');
|
|
97
|
+
}
|
|
98
|
+
};
|
package/dist/index.d.ts
CHANGED
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
import 'nprogress/nprogress.css';
|
|
2
|
-
import { LazyLoader } from './chunkautils/chunk23111';
|
|
2
|
+
import { LazyLoader as _LazyLoader } from './chunkautils/chunk23111';
|
|
3
|
+
import { initLicense, isLicensed, getLicenseInfo } from './chunkautils/chunkLicense';
|
|
4
|
+
export { initLicense, isLicensed, getLicenseInfo };
|
|
5
|
+
export declare const LazyLoader: (...args: Parameters<typeof _LazyLoader>) => ReturnType<typeof _LazyLoader>;
|
|
3
6
|
import { _isNotEmpty, _isLeapYear, _isWeekend, _removeFalsy, _escapeHTML, _handleApi, _handleSafe, _clearRouteState, _UUID } from "./chunkautils/chunk22123";
|
|
4
7
|
import { createAxiosInstance } from "./chunkautils/chunk83454";
|
|
5
|
-
import { _alert, _capitalize, _confirm, _convertToCurrency, _decodeURI, _deepClone, _decryptJson, _decryptString, _dynamicReducer, _encodeURI, _encryptJson, _encryptString, _exportExcel, _flattenArray, _flattenArrayByKey, _findExactRoute, _generatePassword, _genericReducer, _getBrowserInfo, _getCookie, _getFinancialYear, _getStartStopTime, _getStorage, _globalizeDateTime, _formatInternationalDate, _hasElement, _hasItem, _importExcel, _isEmptyArray, _isEmptyObject, _isEqual, _isMobile, _mapObject, _mergeObjects, _parseJSON, _sleep, _promise, _setCookie, _stringifyJSON, _thousandSeparator,
|
|
8
|
+
import { _alert, _capitalize, _confirm, _convertToCurrency, _decodeURI, _deepClone, _decryptJson, _decryptString, _dynamicReducer, _encodeURI, _encryptJson, _encryptString, _exportExcel, _flattenArray, _flattenArrayByKey, _findExactRoute, _generatePassword, _genericReducer, _getBrowserInfo, _getCookie, _getFinancialYear, _getStartStopTime, _getStorage, _globalizeDateTime, _formatInternationalDate, _hasElement, _hasItem, _importExcel, _isEmptyArray, _isEmptyObject, _isEqual, _isMobile, _mapObject, _mergeObjects, _parseJSON, _sleep, _promise, _setCookie, _stringifyJSON, _thousandSeparator, _encryptData, _decryptData, _convertLocalToUTC, _convertUTCToLocal } from "./chunkautils/chunk65431";
|
|
6
9
|
import { _addEventListenerToElement, _allowAlphaKeys, _allowAlphaNumericKeys, _allowDecimalKeys, _clearNode, _cloneElement, _copyText, _domSelector, _filterArrayByKeyValue, _filterByMatchedKey, _filterByMatchingKey, _getChildElements, _getElementAttribute, _getElementsByClass, _getElementsByTag, _getParent, _handlePasteAlphabetKeys, _handlePasteDecimalKeys, _hideElement, _insertHTML, _isDocumentLoaded, _isElementInViewport, _isElementPresent, _isValidBase64, _isValidBlob, _isValidBoolean, _isValidCreditCard, _isValidDate, _isValidDateObject, _isValidDateRange, _isValidDateString, _isValidDateTime, _isValidEmail, _isValidEvent, _isValidFile, _isValidFormData, _isValidFunction, _isValidHexColor, _isValidHTMLElement, _isValidIP, _isValidJSON, _isValidMacAddress, _isValidNode, _isValidNodeList, _isValidNumber, _isValidPassword, _isValidPhoneNumber, _isValidPromise, _isValidRegExp, _isValidString, _isValidTime, _isValidURL, _isValidURLSearchParams, _isValidUUID, _log, _pasteText, _reloadAfterLoad, _removeAllChildren, _removeElement, _removeDuplicateByKey, _removeElementAttribute, _removeEventListenerFromElement, _removeNode, _removeSafeElement, _replaceContent, _runOnIframeLoad, _sanitizeArray, _scrollToElement, _setElementAttribute, _setElementDisabled, _setMultipleStyles, _showElement, _snipDecimals, _throwError, _getQueryString, _onDOMLoad, _onFullReload, _onWindowLoad } from "./chunkautils/chunk75342";
|
|
7
10
|
import { _arrayDiff, _arrayIncludesObject, _arrayIntersection, _arrayToObject, _arrayToObjectByKey, _asyncDebounce, _throttle, _asyncMap, _average, _base64ToBlob, _batchProcess, _bytesToSize, _calPercentage, _chunk, _dateFormat, _dateTransformer, _deepCloneArray, _deepCompareArrays, _deepEqual, _deepMerge, _downloadBase64File, _downloadBlob, _downloadFile, _escapeRegExpMatch, _extractUniqueValues, _extractKeyValues, _extractNestedKeyValues, _fileToBase64, _filterDuplicates, _filterObjectByKey, _findObjectById, _flattenObject, _formatDate, _localeDateFormat, _freeze, _getArrayOfObjectsByProperty, _getKeyByValue, _getKeysByValue, _getMaxMinValue, _getNestedProperty, _getObjectValues, _getPriceAfterTax, _getScrollPosition, _getUniqueValues, _getValueByKey, _groupBy, _handleChildrenMenu, _handleParentNode, _handleParentsMenu, _handlePermissions, _initializeFormValues, _isExactMatch, _isFreeze, _isInArray, _isSeal, _isValidForm, _mapAsync, _mergeArrays, _mergeArraysByKey, _objectToArray, _removeDuplicates, _scrollToTop, _seal, _setNestedProperty, _setTouchedFields, _sortByKey, _swapArrayByKey, _swapArrayElements, _toCamelCase, _transformArray, _transformAsyncData, _updateObjectInArray, _validateFormRef, _combineClasses, _octetToBlob, _uint8ArrayToBlob } from './chunkautils/chunk83453';
|
|
8
11
|
import { _disableDevTools, _isTruncate, _toTitleCase, _truncateText } from './chunkautils/chunk21211';
|
|
9
12
|
import { _getCurrentPath, _getCurrentState, _getLocation, _getTypedState, _go, _goBack, _goForward, _navigate } from './chunkautils/chunk22523';
|
|
10
13
|
import { _injectCSS } from './chunkautils/chunk91172';
|
|
11
|
-
export {
|
|
14
|
+
export { createAxiosInstance, _addEventListenerToElement, _alert, _allowAlphaKeys, _allowAlphaNumericKeys, _allowDecimalKeys, _arrayDiff, _arrayIncludesObject, _arrayIntersection, _arrayToObject, _arrayToObjectByKey, _asyncDebounce, _throttle, _asyncMap, _average, _base64ToBlob, _batchProcess, _bytesToSize, _combineClasses, _clearRouteState, _calPercentage, _capitalize, _chunk, _clearNode, _cloneElement, _confirm, _convertToCurrency, _convertLocalToUTC, _convertUTCToLocal, _copyText, _dateFormat, _dateTransformer, _decodeURI, _deepClone, _deepCloneArray, _deepCompareArrays, _deepEqual, _deepMerge, _decryptJson, _decryptString, _decryptData, _domSelector, _disableDevTools, _downloadBase64File, _downloadBlob, _downloadFile, _dynamicReducer, _encodeURI, _encryptJson, _encryptString, _encryptData, _escapeRegExpMatch, _exportExcel, _escapeHTML, _extractUniqueValues, _extractKeyValues, _extractNestedKeyValues, _fileToBase64, _filterArrayByKeyValue, _filterByMatchedKey, _filterByMatchingKey, _filterDuplicates, _filterObjectByKey, _findExactRoute, _findObjectById, _flattenArray, _flattenArrayByKey, _flattenObject, _formatDate, _localeDateFormat, _globalizeDateTime, _formatInternationalDate, _freeze, _generatePassword, _genericReducer, _getArrayOfObjectsByProperty, _getBrowserInfo, _getChildElements, _getCookie, _getElementAttribute, _getElementsByClass, _getElementsByTag, _getFinancialYear, _getKeysByValue, _getKeyByValue, _getMaxMinValue, _getNestedProperty, _getObjectValues, _getParent, _getPriceAfterTax, _getScrollPosition, _getStartStopTime, _getStorage, _getUniqueValues, _getValueByKey, _groupBy, _go, _goBack, _goForward, _getCurrentPath, _getCurrentState, _getLocation, _getTypedState, _handleApi, _handleSafe, _handleChildrenMenu, _handleParentNode, _handleParentsMenu, _handlePasteAlphabetKeys, _handlePasteDecimalKeys, _handlePermissions, _hasElement, _hasItem, _hideElement, _importExcel, _initializeFormValues, _insertHTML, _injectCSS, _isLeapYear, _isWeekend, _isTruncate, _isDocumentLoaded, _isElementInViewport, _isElementPresent, _isNotEmpty, _isEmptyArray, _isEmptyObject, _isEqual, _isExactMatch, _isFreeze, _isInArray, _isMobile, _isSeal, _isValidBase64, _isValidBlob, _isValidBoolean, _isValidCreditCard, _isValidDate, _isValidDateObject, _isValidDateRange, _isValidDateString, _isValidDateTime, _isValidEmail, _isValidEvent, _isValidFile, _isValidForm, _isValidFormData, _isValidFunction, _isValidHTMLElement, _isValidHexColor, _isValidIP, _isValidJSON, _isValidMacAddress, _isValidNode, _isValidNodeList, _isValidNumber, _isValidPassword, _isValidPhoneNumber, _isValidPromise, _isValidRegExp, _isValidString, _isValidTime, _isValidURL, _isValidURLSearchParams, _isValidUUID, _log, _mapAsync, _mapObject, _mergeArrays, _mergeArraysByKey, _mergeObjects, _navigate, _objectToArray, _parseJSON, _pasteText, _promise, _reloadAfterLoad, _removeAllChildren, _removeDuplicates, _removeDuplicateByKey, _removeElement, _removeElementAttribute, _removeEventListenerFromElement, _removeNode, _removeFalsy, _removeSafeElement, _replaceContent, _runOnIframeLoad, _sanitizeArray, _scrollToElement, _scrollToTop, _sleep, _seal, _setCookie, _setElementAttribute, _setElementDisabled, _setMultipleStyles, _setNestedProperty, _setTouchedFields, _showElement, _snipDecimals, _sortByKey, _stringifyJSON, _swapArrayByKey, _swapArrayElements, _thousandSeparator, _throwError, _toCamelCase, _truncateText, _toTitleCase, _transformArray, _transformAsyncData, _uint8ArrayToBlob, _updateObjectInArray, _UUID, _validateFormRef, _getQueryString, _onDOMLoad, _onFullReload, _onWindowLoad, _octetToBlob, };
|
package/dist/index.js
CHANGED
|
@@ -1,11 +1,21 @@
|
|
|
1
1
|
import 'nprogress/nprogress.css';
|
|
2
|
-
import { LazyLoader } from './chunkautils/chunk23111';
|
|
2
|
+
import { LazyLoader as _LazyLoader } from './chunkautils/chunk23111';
|
|
3
|
+
import { initLicense, isLicensed, getLicenseInfo, _assertLicensed } from './chunkautils/chunkLicense';
|
|
4
|
+
export { initLicense, isLicensed, getLicenseInfo };
|
|
5
|
+
export var LazyLoader = function () {
|
|
6
|
+
var args = [];
|
|
7
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
8
|
+
args[_i] = arguments[_i];
|
|
9
|
+
}
|
|
10
|
+
_assertLicensed();
|
|
11
|
+
return _LazyLoader.apply(void 0, args);
|
|
12
|
+
};
|
|
3
13
|
import { _isNotEmpty, _isLeapYear, _isWeekend, _removeFalsy, _escapeHTML, _handleApi, _handleSafe, _clearRouteState, _UUID } from "./chunkautils/chunk22123";
|
|
4
14
|
import { createAxiosInstance } from "./chunkautils/chunk83454";
|
|
5
|
-
import { _alert, _capitalize, _confirm, _convertToCurrency, _decodeURI, _deepClone, _decryptJson, _decryptString, _dynamicReducer, _encodeURI, _encryptJson, _encryptString, _exportExcel, _flattenArray, _flattenArrayByKey, _findExactRoute, _generatePassword, _genericReducer, _getBrowserInfo, _getCookie, _getFinancialYear, _getStartStopTime, _getStorage, _globalizeDateTime, _formatInternationalDate, _hasElement, _hasItem, _importExcel, _isEmptyArray, _isEmptyObject, _isEqual, _isMobile, _mapObject, _mergeObjects, _parseJSON, _sleep, _promise, _setCookie, _stringifyJSON, _thousandSeparator,
|
|
15
|
+
import { _alert, _capitalize, _confirm, _convertToCurrency, _decodeURI, _deepClone, _decryptJson, _decryptString, _dynamicReducer, _encodeURI, _encryptJson, _encryptString, _exportExcel, _flattenArray, _flattenArrayByKey, _findExactRoute, _generatePassword, _genericReducer, _getBrowserInfo, _getCookie, _getFinancialYear, _getStartStopTime, _getStorage, _globalizeDateTime, _formatInternationalDate, _hasElement, _hasItem, _importExcel, _isEmptyArray, _isEmptyObject, _isEqual, _isMobile, _mapObject, _mergeObjects, _parseJSON, _sleep, _promise, _setCookie, _stringifyJSON, _thousandSeparator, _encryptData, _decryptData, _convertLocalToUTC, _convertUTCToLocal } from "./chunkautils/chunk65431";
|
|
6
16
|
import { _addEventListenerToElement, _allowAlphaKeys, _allowAlphaNumericKeys, _allowDecimalKeys, _clearNode, _cloneElement, _copyText, _domSelector, _filterArrayByKeyValue, _filterByMatchedKey, _filterByMatchingKey, _getChildElements, _getElementAttribute, _getElementsByClass, _getElementsByTag, _getParent, _handlePasteAlphabetKeys, _handlePasteDecimalKeys, _hideElement, _insertHTML, _isDocumentLoaded, _isElementInViewport, _isElementPresent, _isValidBase64, _isValidBlob, _isValidBoolean, _isValidCreditCard, _isValidDate, _isValidDateObject, _isValidDateRange, _isValidDateString, _isValidDateTime, _isValidEmail, _isValidEvent, _isValidFile, _isValidFormData, _isValidFunction, _isValidHexColor, _isValidHTMLElement, _isValidIP, _isValidJSON, _isValidMacAddress, _isValidNode, _isValidNodeList, _isValidNumber, _isValidPassword, _isValidPhoneNumber, _isValidPromise, _isValidRegExp, _isValidString, _isValidTime, _isValidURL, _isValidURLSearchParams, _isValidUUID, _log, _pasteText, _reloadAfterLoad, _removeAllChildren, _removeElement, _removeDuplicateByKey, _removeElementAttribute, _removeEventListenerFromElement, _removeNode, _removeSafeElement, _replaceContent, _runOnIframeLoad, _sanitizeArray, _scrollToElement, _setElementAttribute, _setElementDisabled, _setMultipleStyles, _showElement, _snipDecimals, _throwError, _getQueryString, _onDOMLoad, _onFullReload, _onWindowLoad, } from "./chunkautils/chunk75342";
|
|
7
17
|
import { _arrayDiff, _arrayIncludesObject, _arrayIntersection, _arrayToObject, _arrayToObjectByKey, _asyncDebounce, _throttle, _asyncMap, _average, _base64ToBlob, _batchProcess, _bytesToSize, _calPercentage, _chunk, _dateFormat, _dateTransformer, _deepCloneArray, _deepCompareArrays, _deepEqual, _deepMerge, _downloadBase64File, _downloadBlob, _downloadFile, _escapeRegExpMatch, _extractUniqueValues, _extractKeyValues, _extractNestedKeyValues, _fileToBase64, _filterDuplicates, _filterObjectByKey, _findObjectById, _flattenObject, _formatDate, _localeDateFormat, _freeze, _getArrayOfObjectsByProperty, _getKeyByValue, _getKeysByValue, _getMaxMinValue, _getNestedProperty, _getObjectValues, _getPriceAfterTax, _getScrollPosition, _getUniqueValues, _getValueByKey, _groupBy, _handleChildrenMenu, _handleParentNode, _handleParentsMenu, _handlePermissions, _initializeFormValues, _isExactMatch, _isFreeze, _isInArray, _isSeal, _isValidForm, _mapAsync, _mergeArrays, _mergeArraysByKey, _objectToArray, _removeDuplicates, _scrollToTop, _seal, _setNestedProperty, _setTouchedFields, _sortByKey, _swapArrayByKey, _swapArrayElements, _toCamelCase, _transformArray, _transformAsyncData, _updateObjectInArray, _validateFormRef, _combineClasses, _octetToBlob, _uint8ArrayToBlob } from './chunkautils/chunk83453';
|
|
8
18
|
import { _disableDevTools, _isTruncate, _toTitleCase, _truncateText } from './chunkautils/chunk21211';
|
|
9
19
|
import { _getCurrentPath, _getCurrentState, _getLocation, _getTypedState, _go, _goBack, _goForward, _navigate } from './chunkautils/chunk22523';
|
|
10
20
|
import { _injectCSS } from './chunkautils/chunk91172';
|
|
11
|
-
export {
|
|
21
|
+
export { createAxiosInstance, _addEventListenerToElement, _alert, _allowAlphaKeys, _allowAlphaNumericKeys, _allowDecimalKeys, _arrayDiff, _arrayIncludesObject, _arrayIntersection, _arrayToObject, _arrayToObjectByKey, _asyncDebounce, _throttle, _asyncMap, _average, _base64ToBlob, _batchProcess, _bytesToSize, _combineClasses, _clearRouteState, _calPercentage, _capitalize, _chunk, _clearNode, _cloneElement, _confirm, _convertToCurrency, _convertLocalToUTC, _convertUTCToLocal, _copyText, _dateFormat, _dateTransformer, _decodeURI, _deepClone, _deepCloneArray, _deepCompareArrays, _deepEqual, _deepMerge, _decryptJson, _decryptString, _decryptData, _domSelector, _disableDevTools, _downloadBase64File, _downloadBlob, _downloadFile, _dynamicReducer, _encodeURI, _encryptJson, _encryptString, _encryptData, _escapeRegExpMatch, _exportExcel, _escapeHTML, _extractUniqueValues, _extractKeyValues, _extractNestedKeyValues, _fileToBase64, _filterArrayByKeyValue, _filterByMatchedKey, _filterByMatchingKey, _filterDuplicates, _filterObjectByKey, _findExactRoute, _findObjectById, _flattenArray, _flattenArrayByKey, _flattenObject, _formatDate, _localeDateFormat, _globalizeDateTime, _formatInternationalDate, _freeze, _generatePassword, _genericReducer, _getArrayOfObjectsByProperty, _getBrowserInfo, _getChildElements, _getCookie, _getElementAttribute, _getElementsByClass, _getElementsByTag, _getFinancialYear, _getKeysByValue, _getKeyByValue, _getMaxMinValue, _getNestedProperty, _getObjectValues, _getParent, _getPriceAfterTax, _getScrollPosition, _getStartStopTime, _getStorage, _getUniqueValues, _getValueByKey, _groupBy, _go, _goBack, _goForward, _getCurrentPath, _getCurrentState, _getLocation, _getTypedState, _handleApi, _handleSafe, _handleChildrenMenu, _handleParentNode, _handleParentsMenu, _handlePasteAlphabetKeys, _handlePasteDecimalKeys, _handlePermissions, _hasElement, _hasItem, _hideElement, _importExcel, _initializeFormValues, _insertHTML, _injectCSS, _isLeapYear, _isWeekend, _isTruncate, _isDocumentLoaded, _isElementInViewport, _isElementPresent, _isNotEmpty, _isEmptyArray, _isEmptyObject, _isEqual, _isExactMatch, _isFreeze, _isInArray, _isMobile, _isSeal, _isValidBase64, _isValidBlob, _isValidBoolean, _isValidCreditCard, _isValidDate, _isValidDateObject, _isValidDateRange, _isValidDateString, _isValidDateTime, _isValidEmail, _isValidEvent, _isValidFile, _isValidForm, _isValidFormData, _isValidFunction, _isValidHTMLElement, _isValidHexColor, _isValidIP, _isValidJSON, _isValidMacAddress, _isValidNode, _isValidNodeList, _isValidNumber, _isValidPassword, _isValidPhoneNumber, _isValidPromise, _isValidRegExp, _isValidString, _isValidTime, _isValidURL, _isValidURLSearchParams, _isValidUUID, _log, _mapAsync, _mapObject, _mergeArrays, _mergeArraysByKey, _mergeObjects, _navigate, _objectToArray, _parseJSON, _pasteText, _promise, _reloadAfterLoad, _removeAllChildren, _removeDuplicates, _removeDuplicateByKey, _removeElement, _removeElementAttribute, _removeEventListenerFromElement, _removeNode, _removeFalsy, _removeSafeElement, _replaceContent, _runOnIframeLoad, _sanitizeArray, _scrollToElement, _scrollToTop, _sleep, _seal, _setCookie, _setElementAttribute, _setElementDisabled, _setMultipleStyles, _setNestedProperty, _setTouchedFields, _showElement, _snipDecimals, _sortByKey, _stringifyJSON, _swapArrayByKey, _swapArrayElements, _thousandSeparator, _throwError, _toCamelCase, _truncateText, _toTitleCase, _transformArray, _transformAsyncData, _uint8ArrayToBlob, _updateObjectInArray, _UUID, _validateFormRef, _getQueryString, _onDOMLoad, _onFullReload, _onWindowLoad, _octetToBlob, };
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ╔══════════════════════════════════════════════════════════════════════════╗
|
|
3
|
+
* ║ LICENSE KEY GENERATOR — PACKAGE AUTHOR TOOL ║
|
|
4
|
+
* ║ ║
|
|
5
|
+
* ║ ⚠️ DO NOT include this file in the npm bundle. ║
|
|
6
|
+
* ║ ⚠️ Keep this file PRIVATE — it contains the signing secret. ║
|
|
7
|
+
* ║ ║
|
|
8
|
+
* ║ Usage (generate a key): ║
|
|
9
|
+
* ║ npx ts-node src/licenseGenerator.ts <email> <days> ║
|
|
10
|
+
* ║ ║
|
|
11
|
+
* ║ Examples: ║
|
|
12
|
+
* ║ npx ts-node src/licenseGenerator.ts customer@email.com 365 ║
|
|
13
|
+
* ║ npx ts-node src/licenseGenerator.ts company@org.com 30 ║
|
|
14
|
+
* ╚══════════════════════════════════════════════════════════════════════════╝
|
|
15
|
+
*/
|
|
16
|
+
/**
|
|
17
|
+
* Generates a signed, encrypted license key for the given user.
|
|
18
|
+
*
|
|
19
|
+
* @param uid Licensee identifier (email or company name)
|
|
20
|
+
* @param expiryDays Number of days until the license expires
|
|
21
|
+
* @returns Opaque license key string
|
|
22
|
+
*/
|
|
23
|
+
export declare const generateLicenseKey: (uid: string, expiryDays: number) => string;
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ╔══════════════════════════════════════════════════════════════════════════╗
|
|
3
|
+
* ║ LICENSE KEY GENERATOR — PACKAGE AUTHOR TOOL ║
|
|
4
|
+
* ║ ║
|
|
5
|
+
* ║ ⚠️ DO NOT include this file in the npm bundle. ║
|
|
6
|
+
* ║ ⚠️ Keep this file PRIVATE — it contains the signing secret. ║
|
|
7
|
+
* ║ ║
|
|
8
|
+
* ║ Usage (generate a key): ║
|
|
9
|
+
* ║ npx ts-node src/licenseGenerator.ts <email> <days> ║
|
|
10
|
+
* ║ ║
|
|
11
|
+
* ║ Examples: ║
|
|
12
|
+
* ║ npx ts-node src/licenseGenerator.ts customer@email.com 365 ║
|
|
13
|
+
* ║ npx ts-node src/licenseGenerator.ts company@org.com 30 ║
|
|
14
|
+
* ╚══════════════════════════════════════════════════════════════════════════╝
|
|
15
|
+
*/
|
|
16
|
+
import CryptoJS from 'crypto-js';
|
|
17
|
+
// ── MUST exactly match src/chunkautils/chunkLicense.ts ────────────────────────
|
|
18
|
+
var _P1 = '\x37\x62\x64\x34\x65\x39\x61\x32';
|
|
19
|
+
var _P2 = '\x66\x31\x63\x38\x61\x30\x35\x62';
|
|
20
|
+
var _P3 = '\x32\x65\x37\x64\x39\x62\x34\x63';
|
|
21
|
+
var _P4 = '\x61\x35\x66\x33\x63\x38\x65\x31';
|
|
22
|
+
var _P5 = '\x39\x30\x62\x32\x64\x35\x61\x38';
|
|
23
|
+
var _P6 = '\x63\x36\x65\x31\x66\x34\x39\x62';
|
|
24
|
+
var _ms = function () { return [_P1, _P3, _P5, _P2, _P6, _P4].join('\u0000'); };
|
|
25
|
+
var _SS = '\x72\x6a\x70\x5f\x73\x69\x67\x5f\x76\x31'; // rjp_sig_v1
|
|
26
|
+
var _ES = '\x72\x6a\x70\x5f\x65\x6e\x63\x5f\x76\x31'; // rjp_enc_v1
|
|
27
|
+
var _SK = function () { return CryptoJS.PBKDF2(_ms(), _SS, { keySize: 8, iterations: 2048 }).toString(); };
|
|
28
|
+
var _EK = function () { return CryptoJS.PBKDF2(_ms(), _ES, { keySize: 8, iterations: 2048 }).toString(); };
|
|
29
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
30
|
+
/**
|
|
31
|
+
* Generates a signed, encrypted license key for the given user.
|
|
32
|
+
*
|
|
33
|
+
* @param uid Licensee identifier (email or company name)
|
|
34
|
+
* @param expiryDays Number of days until the license expires
|
|
35
|
+
* @returns Opaque license key string
|
|
36
|
+
*/
|
|
37
|
+
export var generateLicenseKey = function (uid, expiryDays) {
|
|
38
|
+
if (!uid || typeof uid !== 'string')
|
|
39
|
+
throw new Error('uid is required.');
|
|
40
|
+
if (!Number.isFinite(expiryDays) || expiryDays <= 0)
|
|
41
|
+
throw new Error('expiryDays must be a positive number.');
|
|
42
|
+
var payload = {
|
|
43
|
+
uid: uid,
|
|
44
|
+
exp: Date.now() + expiryDays * 24 * 60 * 60 * 1000,
|
|
45
|
+
iat: Date.now(),
|
|
46
|
+
v: 1,
|
|
47
|
+
};
|
|
48
|
+
// AES-256 encrypt the payload (hides uid / expiry from end users)
|
|
49
|
+
var encPayload = CryptoJS.AES.encrypt(JSON.stringify(payload), _EK()).toString();
|
|
50
|
+
// HMAC-SHA256 sign the encrypted payload (prevents forgery / tampering)
|
|
51
|
+
var sig = CryptoJS.HmacSHA256(encPayload, _SK()).toString();
|
|
52
|
+
return "".concat(encPayload, ".").concat(sig);
|
|
53
|
+
};
|
|
54
|
+
// ── CLI entry point ───────────────────────────────────────────────────────────
|
|
55
|
+
var _a = process.argv, uid = _a[2], daysArg = _a[3];
|
|
56
|
+
if (!uid) {
|
|
57
|
+
console.error('\nUsage: npx ts-node src/licenseGenerator.ts <email> <days>\n');
|
|
58
|
+
process.exit(1);
|
|
59
|
+
}
|
|
60
|
+
var days = Number(daysArg !== null && daysArg !== void 0 ? daysArg : 365);
|
|
61
|
+
var key = generateLicenseKey(uid, days);
|
|
62
|
+
var expiry = new Date(Date.now() + days * 86400000).toDateString();
|
|
63
|
+
console.log('\n╔══════════════════════════════════════════════╗');
|
|
64
|
+
console.log('║ react-js-plugins License Key ║');
|
|
65
|
+
console.log('╠══════════════════════════════════════════════╣');
|
|
66
|
+
console.log("\u2551 Licensee : ".concat(uid));
|
|
67
|
+
console.log("\u2551 Duration : ".concat(days, " days"));
|
|
68
|
+
console.log("\u2551 Expires : ".concat(expiry));
|
|
69
|
+
console.log('╠══════════════════════════════════════════════╣');
|
|
70
|
+
console.log('║ Key (share this with the customer): ║');
|
|
71
|
+
console.log('╚══════════════════════════════════════════════╝\n');
|
|
72
|
+
console.log(key);
|
|
73
|
+
console.log('');
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-js-plugins",
|
|
3
|
-
"version": "3.14.
|
|
3
|
+
"version": "3.14.3",
|
|
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",
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
"devDependencies": {
|
|
49
49
|
"@types/crypto-js": "^4.2.2",
|
|
50
50
|
"@types/luxon": "^3.6.2",
|
|
51
|
-
"@types/node": "^22.
|
|
51
|
+
"@types/node": "^22.19.17",
|
|
52
52
|
"@types/nprogress": "^0.2.3",
|
|
53
53
|
"@types/react": "^18.3.24",
|
|
54
54
|
"tslib": "^2.6.3",
|