@qlibs/utils 1.7.5 → 1.8.1
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/utils/index.d.ts
CHANGED
package/dist/utils/index.js
CHANGED
@@ -29,3 +29,5 @@ __exportStar(require("./price"), exports);
|
|
29
29
|
__exportStar(require("./text"), exports);
|
30
30
|
__exportStar(require("./formHandler"), exports);
|
31
31
|
__exportStar(require("./browser"), exports);
|
32
|
+
__exportStar(require("./permissionGenerator"), exports);
|
33
|
+
__exportStar(require("./passwordExpiry"), exports);
|
@@ -0,0 +1,26 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.getPasswordExpiry = exports.savePasswordExpiry = void 0;
|
4
|
+
const exp = "passwordExpiry";
|
5
|
+
const expiredAt = "passwordExpiredAt";
|
6
|
+
const expiredStatus = "isPasswordExpired";
|
7
|
+
const savePasswordExpiry = (expiryDate, isExpired) => {
|
8
|
+
const data = {
|
9
|
+
[expiredAt]: expiryDate,
|
10
|
+
[expiredStatus]: isExpired,
|
11
|
+
};
|
12
|
+
localStorage.setItem(exp, JSON.stringify(data));
|
13
|
+
};
|
14
|
+
exports.savePasswordExpiry = savePasswordExpiry;
|
15
|
+
const getPasswordExpiry = () => {
|
16
|
+
const data = localStorage.getItem(exp);
|
17
|
+
if (data) {
|
18
|
+
const parsedData = JSON.parse(data);
|
19
|
+
return {
|
20
|
+
[expiredAt]: new Date(parsedData[expiredAt]),
|
21
|
+
[expiredStatus]: Boolean(parsedData[expiredStatus]),
|
22
|
+
};
|
23
|
+
}
|
24
|
+
return null;
|
25
|
+
};
|
26
|
+
exports.getPasswordExpiry = getPasswordExpiry;
|
@@ -0,0 +1,22 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.generateArchivePermissions = generateArchivePermissions;
|
4
|
+
function generateArchivePermissions(feature) {
|
5
|
+
return [
|
6
|
+
{
|
7
|
+
key: 'ARCHIVE',
|
8
|
+
checked: true,
|
9
|
+
permissions: [feature + '.ARCHIVE', feature + '.DELETE', feature + '.FORCE_DELETE'],
|
10
|
+
},
|
11
|
+
{
|
12
|
+
key: 'RESTORE',
|
13
|
+
checked: true,
|
14
|
+
permissions: [feature + '.RESTORE'],
|
15
|
+
},
|
16
|
+
{
|
17
|
+
key: 'FORCE_DELETE',
|
18
|
+
checked: true,
|
19
|
+
permissions: [feature + '.DELETE', feature + '.FORCE_DELETE'],
|
20
|
+
},
|
21
|
+
];
|
22
|
+
}
|