flowcore-fn 10.2.5 → 10.2.6

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/pkg-index.js CHANGED
@@ -18849,16 +18849,23 @@ function Sidebar({ isOpen, onToggle, childrens, sidebar, sidebarConfig }) {
18849
18849
  { name: "Audit Log", component: "AuditLogmain", icon: import_react95.RiShieldCheckLine, configKey: "isAuditLog" },
18850
18850
  { name: "Movement History", component: "MovementHistorymain", icon: import_react95.RiHistoryLine, configKey: "isMovementHistory" }
18851
18851
  ];
18852
+ const getConfigObject = () => {
18853
+ if (!resolvedSidebarConfig) return null;
18854
+ return Array.isArray(resolvedSidebarConfig) ? Object.assign({}, ...resolvedSidebarConfig) : resolvedSidebarConfig;
18855
+ };
18852
18856
  const filterItems = (items) => {
18853
- if (!resolvedSidebarConfig) return items;
18854
- const configObj = Array.isArray(resolvedSidebarConfig) ? Object.assign({}, ...resolvedSidebarConfig) : resolvedSidebarConfig;
18857
+ const configObj2 = getConfigObject();
18858
+ if (!configObj2) return items;
18859
+ if (Object.keys(configObj2).length === 0) return [];
18855
18860
  return items.filter((item) => {
18856
- if (item.configKey && configObj[item.configKey] === false) {
18861
+ if (item.configKey && configObj2[item.configKey] === false) {
18857
18862
  return false;
18858
18863
  }
18859
18864
  return true;
18860
18865
  });
18861
18866
  };
18867
+ const configObj = getConfigObject();
18868
+ const hasSidebarAccess = !configObj || Object.values(configObj).some((value) => value === true);
18862
18869
  const workflowItems = filterItems(masterWorkflowItems);
18863
18870
  const permissionItems = filterItems(masterPermissionItems);
18864
18871
  const hierarchyItems = filterItems(masterHierarchyItems);
@@ -19056,6 +19063,13 @@ function Sidebar({ isOpen, onToggle, childrens, sidebar, sidebarConfig }) {
19056
19063
  )
19057
19064
  ] });
19058
19065
  };
19066
+ if (configObj && !hasSidebarAccess) {
19067
+ return /* @__PURE__ */ (0, import_jsx_runtime94.jsx)("div", { className: "fc:flex fc:min-h-screen fc:w-full fc:items-center fc:justify-center fc:bg-[#F5F7FB] fc:p-6", children: /* @__PURE__ */ (0, import_jsx_runtime94.jsxs)("div", { className: "fc:max-w-md fc:rounded-2xl fc:border fc:border-red-200 fc:bg-red-50 fc:p-6 fc:text-center fc:shadow-sm", children: [
19068
+ /* @__PURE__ */ (0, import_jsx_runtime94.jsx)("div", { className: "fc:mb-4 fc:flex fc:justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime94.jsx)("div", { className: "fc:flex fc:h-14 fc:w-14 fc:items-center fc:justify-center fc:rounded-full fc:bg-red-100 fc:text-red-500", children: /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(import_react95.RiLockPasswordLine, { size: 28 }) }) }),
19069
+ /* @__PURE__ */ (0, import_jsx_runtime94.jsx)("h2", { className: "fc:mb-2 fc:text-lg fc:font-bold fc:text-red-600", children: "Access Restricted" }),
19070
+ /* @__PURE__ */ (0, import_jsx_runtime94.jsx)("p", { className: "fc:text-sm fc:text-[#405170]", children: "You do not have permission to access FlowCore. Please contact your administrator." })
19071
+ ] }) });
19072
+ }
19059
19073
  return /* @__PURE__ */ (0, import_jsx_runtime94.jsxs)(import_jsx_runtime94.Fragment, { children: [
19060
19074
  /* @__PURE__ */ (0, import_jsx_runtime94.jsxs)(
19061
19075
  "aside",
@@ -18697,16 +18697,23 @@ function Sidebar({ isOpen, onToggle, childrens, sidebar, sidebarConfig }) {
18697
18697
  { name: "Audit Log", component: "AuditLogmain", icon: RiShieldCheckLine, configKey: "isAuditLog" },
18698
18698
  { name: "Movement History", component: "MovementHistorymain", icon: RiHistoryLine, configKey: "isMovementHistory" }
18699
18699
  ];
18700
+ const getConfigObject = () => {
18701
+ if (!resolvedSidebarConfig) return null;
18702
+ return Array.isArray(resolvedSidebarConfig) ? Object.assign({}, ...resolvedSidebarConfig) : resolvedSidebarConfig;
18703
+ };
18700
18704
  const filterItems = (items) => {
18701
- if (!resolvedSidebarConfig) return items;
18702
- const configObj = Array.isArray(resolvedSidebarConfig) ? Object.assign({}, ...resolvedSidebarConfig) : resolvedSidebarConfig;
18705
+ const configObj2 = getConfigObject();
18706
+ if (!configObj2) return items;
18707
+ if (Object.keys(configObj2).length === 0) return [];
18703
18708
  return items.filter((item) => {
18704
- if (item.configKey && configObj[item.configKey] === false) {
18709
+ if (item.configKey && configObj2[item.configKey] === false) {
18705
18710
  return false;
18706
18711
  }
18707
18712
  return true;
18708
18713
  });
18709
18714
  };
18715
+ const configObj = getConfigObject();
18716
+ const hasSidebarAccess = !configObj || Object.values(configObj).some((value) => value === true);
18710
18717
  const workflowItems = filterItems(masterWorkflowItems);
18711
18718
  const permissionItems = filterItems(masterPermissionItems);
18712
18719
  const hierarchyItems = filterItems(masterHierarchyItems);
@@ -18904,6 +18911,13 @@ function Sidebar({ isOpen, onToggle, childrens, sidebar, sidebarConfig }) {
18904
18911
  )
18905
18912
  ] });
18906
18913
  };
18914
+ if (configObj && !hasSidebarAccess) {
18915
+ return /* @__PURE__ */ jsx94("div", { className: "fc:flex fc:min-h-screen fc:w-full fc:items-center fc:justify-center fc:bg-[#F5F7FB] fc:p-6", children: /* @__PURE__ */ jsxs93("div", { className: "fc:max-w-md fc:rounded-2xl fc:border fc:border-red-200 fc:bg-red-50 fc:p-6 fc:text-center fc:shadow-sm", children: [
18916
+ /* @__PURE__ */ jsx94("div", { className: "fc:mb-4 fc:flex fc:justify-center", children: /* @__PURE__ */ jsx94("div", { className: "fc:flex fc:h-14 fc:w-14 fc:items-center fc:justify-center fc:rounded-full fc:bg-red-100 fc:text-red-500", children: /* @__PURE__ */ jsx94(RiLockPasswordLine, { size: 28 }) }) }),
18917
+ /* @__PURE__ */ jsx94("h2", { className: "fc:mb-2 fc:text-lg fc:font-bold fc:text-red-600", children: "Access Restricted" }),
18918
+ /* @__PURE__ */ jsx94("p", { className: "fc:text-sm fc:text-[#405170]", children: "You do not have permission to access FlowCore. Please contact your administrator." })
18919
+ ] }) });
18920
+ }
18907
18921
  return /* @__PURE__ */ jsxs93(Fragment5, { children: [
18908
18922
  /* @__PURE__ */ jsxs93(
18909
18923
  "aside",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "flowcore-fn",
3
- "version": "10.2.5",
3
+ "version": "10.2.6",
4
4
  "main": "dist/pkg-index.js",
5
5
  "module": "dist/pkg-index.mjs",
6
6
  "files": [