@natoora-libs/core 0.1.9-dev-doug-2 → 0.1.10
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/components/index.cjs +758 -1038
- package/dist/components/index.cjs.map +1 -1
- package/dist/components/index.d.cts +14 -67
- package/dist/components/index.d.ts +14 -67
- package/dist/components/index.js +757 -1036
- package/dist/components/index.js.map +1 -1
- package/dist/hooks/index.cjs +2 -41
- package/dist/hooks/index.cjs.map +1 -1
- package/dist/hooks/index.d.cts +2 -6
- package/dist/hooks/index.d.ts +2 -6
- package/dist/hooks/index.js +3 -36
- package/dist/hooks/index.js.map +1 -1
- package/package.json +9 -5
package/dist/hooks/index.cjs
CHANGED
|
@@ -19,47 +19,8 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
19
19
|
// src/hooks/index.ts
|
|
20
20
|
var hooks_exports = {};
|
|
21
21
|
__export(hooks_exports, {
|
|
22
|
-
|
|
22
|
+
default: () => hooks_default
|
|
23
23
|
});
|
|
24
24
|
module.exports = __toCommonJS(hooks_exports);
|
|
25
|
-
|
|
26
|
-
// src/hooks/useCheckPermissionToAccess/useCheckPermissionToAccess.ts
|
|
27
|
-
function featuresAreEnabled({
|
|
28
|
-
enabledFeatures,
|
|
29
|
-
featureNames,
|
|
30
|
-
requireAll = true
|
|
31
|
-
}) {
|
|
32
|
-
const storedPermissions = localStorage.getItem("permissions") || "";
|
|
33
|
-
let enabled = false;
|
|
34
|
-
if (requireAll) {
|
|
35
|
-
enabled = featureNames.every(
|
|
36
|
-
(feature) => enabledFeatures.includes(feature) && storedPermissions.includes(`${feature}_read`)
|
|
37
|
-
);
|
|
38
|
-
} else {
|
|
39
|
-
enabled = featureNames.some(
|
|
40
|
-
(feature) => enabledFeatures.includes(feature) && storedPermissions.includes(`${feature}_read`)
|
|
41
|
-
);
|
|
42
|
-
}
|
|
43
|
-
return enabled;
|
|
44
|
-
}
|
|
45
|
-
var useCheckPermissionToAccess = ({
|
|
46
|
-
featureSettings,
|
|
47
|
-
pageName,
|
|
48
|
-
requireAll = false
|
|
49
|
-
}) => {
|
|
50
|
-
let hasPermission = false;
|
|
51
|
-
if (featuresAreEnabled({
|
|
52
|
-
enabledFeatures: featureSettings,
|
|
53
|
-
featureNames: [pageName],
|
|
54
|
-
requireAll
|
|
55
|
-
})) {
|
|
56
|
-
hasPermission = true;
|
|
57
|
-
}
|
|
58
|
-
return hasPermission;
|
|
59
|
-
};
|
|
60
|
-
var useCheckPermissionToAccess_default = useCheckPermissionToAccess;
|
|
61
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
62
|
-
0 && (module.exports = {
|
|
63
|
-
useCheckPermissionToAccess
|
|
64
|
-
});
|
|
25
|
+
var hooks_default = "@natoora-libs/core/hooks";
|
|
65
26
|
//# sourceMappingURL=index.cjs.map
|
package/dist/hooks/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/hooks/index.ts"
|
|
1
|
+
{"version":3,"sources":["../../src/hooks/index.ts"],"sourcesContent":["export default '@natoora-libs/core/hooks';\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAAO,gBAAQ;","names":[]}
|
package/dist/hooks/index.d.cts
CHANGED
|
@@ -1,7 +1,3 @@
|
|
|
1
|
-
declare const
|
|
2
|
-
featureSettings: any;
|
|
3
|
-
pageName: any;
|
|
4
|
-
requireAll?: boolean | undefined;
|
|
5
|
-
}) => boolean;
|
|
1
|
+
declare const _default: "@natoora-libs/core/hooks";
|
|
6
2
|
|
|
7
|
-
export {
|
|
3
|
+
export { _default as default };
|
package/dist/hooks/index.d.ts
CHANGED
|
@@ -1,7 +1,3 @@
|
|
|
1
|
-
declare const
|
|
2
|
-
featureSettings: any;
|
|
3
|
-
pageName: any;
|
|
4
|
-
requireAll?: boolean | undefined;
|
|
5
|
-
}) => boolean;
|
|
1
|
+
declare const _default: "@natoora-libs/core/hooks";
|
|
6
2
|
|
|
7
|
-
export {
|
|
3
|
+
export { _default as default };
|
package/dist/hooks/index.js
CHANGED
|
@@ -1,41 +1,8 @@
|
|
|
1
1
|
import "../chunk-5WRI5ZAA.js";
|
|
2
2
|
|
|
3
|
-
// src/hooks/
|
|
4
|
-
|
|
5
|
-
enabledFeatures,
|
|
6
|
-
featureNames,
|
|
7
|
-
requireAll = true
|
|
8
|
-
}) {
|
|
9
|
-
const storedPermissions = localStorage.getItem("permissions") || "";
|
|
10
|
-
let enabled = false;
|
|
11
|
-
if (requireAll) {
|
|
12
|
-
enabled = featureNames.every(
|
|
13
|
-
(feature) => enabledFeatures.includes(feature) && storedPermissions.includes(`${feature}_read`)
|
|
14
|
-
);
|
|
15
|
-
} else {
|
|
16
|
-
enabled = featureNames.some(
|
|
17
|
-
(feature) => enabledFeatures.includes(feature) && storedPermissions.includes(`${feature}_read`)
|
|
18
|
-
);
|
|
19
|
-
}
|
|
20
|
-
return enabled;
|
|
21
|
-
}
|
|
22
|
-
var useCheckPermissionToAccess = ({
|
|
23
|
-
featureSettings,
|
|
24
|
-
pageName,
|
|
25
|
-
requireAll = false
|
|
26
|
-
}) => {
|
|
27
|
-
let hasPermission = false;
|
|
28
|
-
if (featuresAreEnabled({
|
|
29
|
-
enabledFeatures: featureSettings,
|
|
30
|
-
featureNames: [pageName],
|
|
31
|
-
requireAll
|
|
32
|
-
})) {
|
|
33
|
-
hasPermission = true;
|
|
34
|
-
}
|
|
35
|
-
return hasPermission;
|
|
36
|
-
};
|
|
37
|
-
var useCheckPermissionToAccess_default = useCheckPermissionToAccess;
|
|
3
|
+
// src/hooks/index.ts
|
|
4
|
+
var hooks_default = "@natoora-libs/core/hooks";
|
|
38
5
|
export {
|
|
39
|
-
|
|
6
|
+
hooks_default as default
|
|
40
7
|
};
|
|
41
8
|
//# sourceMappingURL=index.js.map
|
package/dist/hooks/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/hooks/
|
|
1
|
+
{"version":3,"sources":["../../src/hooks/index.ts"],"sourcesContent":["export default '@natoora-libs/core/hooks';\n"],"mappings":";;;AAAA,IAAO,gBAAQ;","names":[]}
|
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@natoora-libs/core",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.10",
|
|
4
4
|
"private": false,
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
7
7
|
},
|
|
8
8
|
"type": "module",
|
|
9
9
|
"files": [
|
|
10
|
-
"dist"
|
|
10
|
+
"dist/**/*"
|
|
11
11
|
],
|
|
12
12
|
"main": "dist/index.cjs",
|
|
13
13
|
"types": "dist/index.d.ts",
|
|
@@ -29,15 +29,19 @@
|
|
|
29
29
|
"require": "./dist/hooks/index.cjs"
|
|
30
30
|
}
|
|
31
31
|
},
|
|
32
|
+
"engines": {
|
|
33
|
+
"pnpm": ">=10.0.0"
|
|
34
|
+
},
|
|
35
|
+
"packageManager": "pnpm@10.14.0",
|
|
32
36
|
"scripts": {
|
|
33
37
|
"dev": "yalc publish && tsup --watch --onSuccess 'yalc push --changed'",
|
|
34
38
|
"build": "tsup",
|
|
35
39
|
"build-storybook": "storybook build",
|
|
36
40
|
"storybook": "storybook dev -p 6006",
|
|
37
|
-
"fix:all": "
|
|
38
|
-
"format": "prettier --config ./.prettierrc --write \"./src/**/*.{js,ts,tsx}\"",
|
|
41
|
+
"fix:all": "pnpm run format && pnpm run lint:fix",
|
|
42
|
+
"format": "prettier --config ./.prettierrc.cjs --write \"./src/**/*.{js,ts,tsx}\"",
|
|
39
43
|
"lint": "eslint --config ./eslint.config.js \"./src/**/*.{js,ts,tsx}\"",
|
|
40
|
-
"lint:fix": "
|
|
44
|
+
"lint:fix": "pnpm run lint --fix",
|
|
41
45
|
"test": "jest",
|
|
42
46
|
"test:watch": "jest --watch",
|
|
43
47
|
"test:coverage": "jest --coverage"
|