flowcore-fn 10.2.4 → 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
@@ -18808,122 +18808,87 @@ function StatusMain() {
18808
18808
 
18809
18809
  // src/components/Sidebar.jsx
18810
18810
  var import_jsx_runtime94 = require("react/jsx-runtime");
18811
- var workflowItems = [
18812
- // Menu Name testing // component or page-Use function name
18813
- {
18814
- name: "Workflow Type",
18815
- component: "workflowType",
18816
- icon: import_react95.RiGitMergeLine
18817
- },
18818
- {
18819
- name: "Workflow",
18820
- component: "workflow",
18821
- icon: import_react95.RiNodeTree
18822
- },
18823
- {
18824
- name: "Workflow Step",
18825
- component: "workflowStep",
18826
- icon: import_react95.RiGitBranchLine
18827
- },
18828
- {
18829
- name: "Workflow Transition",
18830
- component: "workflowTransition",
18831
- icon: import_react95.RiCornerDownRightLine
18832
- },
18833
- {
18834
- name: "Module",
18835
- component: "module",
18836
- icon: import_react95.RiFolder3Line
18837
- },
18838
- {
18839
- name: "Status",
18840
- component: "status",
18841
- icon: import_react95.RiCheckboxCircleLine
18842
- }
18843
- ];
18844
- var permissionItems = [{
18845
- name: "Step Permission",
18846
- component: "step_permission_main",
18847
- icon: import_react95.RiUserSettingsLine
18848
- }, {
18849
- name: "Assignment Rule",
18850
- component: "AssignmentRuleMain",
18851
- icon: import_react95.RiFileShieldLine
18852
- }];
18853
- var hierarchyItems = [
18854
- {
18855
- name: "Hierarchy Node",
18856
- component: "HierarchyNodeMain",
18857
- icon: import_react95.RiNodeTree
18858
- },
18859
- {
18860
- name: "Workflow Hierarchy Node Mapping",
18861
- component: "Workflow_Step_Hierarchy_Mapping_Main",
18862
- icon: import_react95.RiUserSharedLine
18863
- },
18864
- {
18865
- name: "Workflow Step User Mapping",
18866
- component: "User_hierarchy_mapping_main",
18867
- icon: import_react95.RiUserSharedLine
18868
- },
18869
- {
18870
- name: "Workflow Settings",
18871
- component: "WorkflowSettingMain",
18872
- icon: import_react95.RiSettings4Line
18873
- }
18874
- ];
18875
- var documentItems = [{
18876
- name: "Document Configuration",
18877
- component: "DocumentConfigurationmain",
18878
- icon: import_react95.RiFileSettingsLine
18879
- }];
18880
- var fileItems = [{
18881
- name: "Business Entity",
18882
- component: "BusinessEntitymain",
18883
- icon: import_react95.RiFileList3Line
18884
- }, {
18885
- name: "File Instance",
18886
- component: "FileInstanceMain",
18887
- icon: import_react95.RiFileList3Line
18888
- }, {
18889
- name: "File Pool",
18890
- component: "FilePoolMain",
18891
- icon: import_react95.RiDatabase2Line
18892
- }, {
18893
- name: "Uploaded Document",
18894
- component: "UploadedDocumentMain",
18895
- icon: import_react95.RiFileUploadLine
18896
- }];
18897
- var communicationItems = [{
18898
- name: "Notification",
18899
- component: "Notification_main",
18900
- icon: import_react95.RiNotification4Line
18901
- }, {
18902
- name: "Comment",
18903
- component: "Comment_main",
18904
- icon: import_react95.RiChat3Line
18905
- }];
18906
- var taskItems = [{
18907
- name: "Task Instance",
18908
- component: "TaskInstanceMain",
18909
- icon: import_react95.RiCheckboxMultipleLine
18910
- }];
18911
- var trackingItems = [{
18912
- name: "Audit Log",
18913
- component: "AuditLogmain",
18914
- icon: import_react95.RiShieldCheckLine
18915
- }, {
18916
- name: "Movement History",
18917
- component: "MovementHistorymain",
18918
- icon: import_react95.RiHistoryLine
18919
- }];
18920
- function Sidebar({
18921
- isOpen,
18922
- onToggle,
18923
- childrens
18924
- }) {
18811
+ function Sidebar({ isOpen, onToggle, childrens, sidebar, sidebarConfig }) {
18925
18812
  const router = (0, import_router.useRouter)();
18926
- const [activeComponent, setActiveComponent] = (0, import_react94.useState)("workflowType");
18813
+ const resolvedSidebarConfig = sidebar != null ? sidebar : sidebarConfig;
18814
+ const masterWorkflowItems = [
18815
+ { name: "Workflow Type", component: "workflowType", icon: import_react95.RiGitMergeLine, configKey: "isWorkflowType" },
18816
+ { name: "Workflow", component: "workflow", icon: import_react95.RiNodeTree, configKey: "isWorkflow" },
18817
+ { name: "Workflow Step", component: "workflowStep", icon: import_react95.RiGitBranchLine, configKey: "isWorkflowStep" },
18818
+ { name: "Workflow Transition", component: "workflowTransition", icon: import_react95.RiCornerDownRightLine, configKey: "isWorkflowTransition" },
18819
+ { name: "Module", component: "module", icon: import_react95.RiFolder3Line, configKey: "isModule" },
18820
+ { name: "Status", component: "status", icon: import_react95.RiCheckboxCircleLine, configKey: "isStatus" }
18821
+ ];
18822
+ const masterPermissionItems = [
18823
+ { name: "Step Permission", component: "step_permission_main", icon: import_react95.RiUserSettingsLine, configKey: "isStepPermission" },
18824
+ { name: "Assignment Rule", component: "AssignmentRuleMain", icon: import_react95.RiFileShieldLine, configKey: "isAssignmentRule" }
18825
+ ];
18826
+ const masterHierarchyItems = [
18827
+ { name: "Hierarchy Node", component: "HierarchyNodeMain", icon: import_react95.RiNodeTree, configKey: "isHierarchyNode" },
18828
+ { name: "Workflow Hierarchy Node Mapping", component: "Workflow_Step_Hierarchy_Mapping_Main", icon: import_react95.RiUserSharedLine, configKey: "isWorkflowHierarchyMapping" },
18829
+ { name: "Workflow Step User Mapping", component: "User_hierarchy_mapping_main", icon: import_react95.RiUserSharedLine, configKey: "isUserHierarchyMapping" },
18830
+ { name: "Workflow Settings", component: "WorkflowSettingMain", icon: import_react95.RiSettings4Line, configKey: "isWorkflowSettings" }
18831
+ ];
18832
+ const masterDocumentItems = [
18833
+ { name: "Document Configuration", component: "DocumentConfigurationmain", icon: import_react95.RiFileSettingsLine, configKey: "isDocumentConfiguration" }
18834
+ ];
18835
+ const masterFileItems = [
18836
+ { name: "Business Entity", component: "BusinessEntitymain", icon: import_react95.RiFileList3Line, configKey: "isBusinessEntity" },
18837
+ { name: "File Instance", component: "FileInstanceMain", icon: import_react95.RiFileList3Line, configKey: "isFileInstance" },
18838
+ { name: "File Pool", component: "FilePoolMain", icon: import_react95.RiDatabase2Line, configKey: "isFilePool" },
18839
+ { name: "Uploaded Document", component: "UploadedDocumentMain", icon: import_react95.RiFileUploadLine, configKey: "isUploadedDocument" }
18840
+ ];
18841
+ const masterCommunicationItems = [
18842
+ { name: "Notification", component: "Notification_main", icon: import_react95.RiNotification4Line, configKey: "isNotification" },
18843
+ { name: "Comment", component: "Comment_main", icon: import_react95.RiChat3Line, configKey: "isComment" }
18844
+ ];
18845
+ const masterTaskItems = [
18846
+ { name: "Task Instance", component: "TaskInstanceMain", icon: import_react95.RiCheckboxMultipleLine, configKey: "isTaskInstance" }
18847
+ ];
18848
+ const masterTrackingItems = [
18849
+ { name: "Audit Log", component: "AuditLogmain", icon: import_react95.RiShieldCheckLine, configKey: "isAuditLog" },
18850
+ { name: "Movement History", component: "MovementHistorymain", icon: import_react95.RiHistoryLine, configKey: "isMovementHistory" }
18851
+ ];
18852
+ const getConfigObject = () => {
18853
+ if (!resolvedSidebarConfig) return null;
18854
+ return Array.isArray(resolvedSidebarConfig) ? Object.assign({}, ...resolvedSidebarConfig) : resolvedSidebarConfig;
18855
+ };
18856
+ const filterItems = (items) => {
18857
+ const configObj2 = getConfigObject();
18858
+ if (!configObj2) return items;
18859
+ if (Object.keys(configObj2).length === 0) return [];
18860
+ return items.filter((item) => {
18861
+ if (item.configKey && configObj2[item.configKey] === false) {
18862
+ return false;
18863
+ }
18864
+ return true;
18865
+ });
18866
+ };
18867
+ const configObj = getConfigObject();
18868
+ const hasSidebarAccess = !configObj || Object.values(configObj).some((value) => value === true);
18869
+ const workflowItems = filterItems(masterWorkflowItems);
18870
+ const permissionItems = filterItems(masterPermissionItems);
18871
+ const hierarchyItems = filterItems(masterHierarchyItems);
18872
+ const documentItems = filterItems(masterDocumentItems);
18873
+ const fileItems = filterItems(masterFileItems);
18874
+ const communicationItems = filterItems(masterCommunicationItems);
18875
+ const taskItems = filterItems(masterTaskItems);
18876
+ const trackingItems = filterItems(masterTrackingItems);
18877
+ const hasAnyAccess = workflowItems.length > 0 || permissionItems.length > 0 || hierarchyItems.length > 0 || documentItems.length > 0 || fileItems.length > 0 || communicationItems.length > 0 || taskItems.length > 0 || trackingItems.length > 0;
18878
+ const getAllAvailableItems = () => [
18879
+ ...workflowItems,
18880
+ ...permissionItems,
18881
+ ...hierarchyItems,
18882
+ ...documentItems,
18883
+ ...fileItems,
18884
+ ...taskItems,
18885
+ ...trackingItems,
18886
+ ...communicationItems
18887
+ ];
18888
+ const [activeComponent, setActiveComponent] = (0, import_react94.useState)(() => {
18889
+ const all = getAllAvailableItems();
18890
+ return all.length > 0 ? all[0].component : null;
18891
+ });
18927
18892
  const [workflowOpen, setWorkflowOpen] = (0, import_react94.useState)(true);
18928
18893
  const [permissionOpen, setPermissionOpen] = (0, import_react94.useState)(false);
18929
18894
  const [hierarchyOpen, setHierarchyOpen] = (0, import_react94.useState)(false);
@@ -18950,21 +18915,16 @@ function Sidebar({
18950
18915
  } else if (communicationItems.some((item) => item.component === activeComponent)) {
18951
18916
  setCommunicationOpen(true);
18952
18917
  }
18953
- }, [activeComponent]);
18918
+ }, [activeComponent, workflowItems, permissionItems, hierarchyItems, documentItems, fileItems, taskItems, trackingItems, communicationItems]);
18954
18919
  const renderMenuItem = (item) => {
18955
18920
  const Icon = item.icon;
18956
18921
  const handleClick = () => {
18957
18922
  if (item.component) {
18958
- router.push("/flowCore", void 0, {
18959
- shallow: true
18960
- });
18923
+ router.push("/flowCore", void 0, { shallow: true });
18961
18924
  setActiveComponent(item.component);
18962
- } else if (item.path) {
18963
- setActiveComponent(null);
18964
- router.push(item.path);
18965
18925
  }
18966
18926
  };
18967
- const isActive = item.component ? activeComponent === item.component : router.pathname === item.path;
18927
+ const isActive = activeComponent === item.component;
18968
18928
  return /* @__PURE__ */ (0, import_jsx_runtime94.jsxs)(
18969
18929
  "button",
18970
18930
  {
@@ -18987,6 +18947,13 @@ function Sidebar({
18987
18947
  );
18988
18948
  };
18989
18949
  const renderContent = () => {
18950
+ if (!hasAnyAccess) {
18951
+ return /* @__PURE__ */ (0, import_jsx_runtime94.jsxs)("div", { className: "fc:flex fc:flex-col fc:items-center fc:justify-center fc:h-full fc:p-6 fc:text-center", children: [
18952
+ /* @__PURE__ */ (0, import_jsx_runtime94.jsx)("div", { className: "fc:bg-red-50 fc:text-red-500 fc:p-4 fc:rounded-full fc:mb-4", children: /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(import_react95.RiLockPasswordLine, { size: 32 }) }),
18953
+ /* @__PURE__ */ (0, import_jsx_runtime94.jsx)("h2", { className: "fc:text-lg fc:font-bold fc:text-[#101318] fc:mb-1", children: "Access Restricted" }),
18954
+ /* @__PURE__ */ (0, import_jsx_runtime94.jsx)("p", { className: "fc:text-sm fc:text-[#64748B] fc:max-w-md", children: "You do not have permission to access any modules or workflow sections. Please contact your administrator for access rights." })
18955
+ ] });
18956
+ }
18990
18957
  switch (activeComponent) {
18991
18958
  case "module":
18992
18959
  return /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(ModuleMain, {});
@@ -19037,9 +19004,8 @@ function Sidebar({
19037
19004
  }
19038
19005
  };
19039
19006
  const renderDropdown = (title, open, setOpen, items, HeadingIcon) => {
19040
- const hasActiveChild = items.some(
19041
- (item) => item.component ? activeComponent === item.component : router.pathname === item.path
19042
- );
19007
+ if (items.length === 0) return null;
19008
+ const hasActiveChild = items.some((item) => activeComponent === item.component);
19043
19009
  return /* @__PURE__ */ (0, import_jsx_runtime94.jsxs)("div", { className: "fc:mb-1 mb-1", children: [
19044
19010
  /* @__PURE__ */ (0, import_jsx_runtime94.jsxs)(
19045
19011
  "button",
@@ -19056,7 +19022,13 @@ function Sidebar({
19056
19022
  className: `fc:shrink-0 shrink-0 fc:transition-colors transition-colors ${hasActiveChild ? "fc:text-blue-600 text-blue-600" : "fc:text-[#405170] text-[#405170]"}`
19057
19023
  }
19058
19024
  ),
19059
- /* @__PURE__ */ (0, import_jsx_runtime94.jsx)("span", { className: `fc:text-[14px] text-[14px] fc:font-semibold font-semibold fc:truncate truncate ${hasActiveChild && !open ? "fc:text-blue-600 text-blue-600" : "fc:text-[#273657] text-[#273657]"}`, children: title })
19025
+ /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(
19026
+ "span",
19027
+ {
19028
+ className: `fc:text-[14px] text-[14px] fc:font-semibold font-semibold fc:truncate truncate ${hasActiveChild && !open ? "fc:text-blue-600 text-blue-600" : "fc:text-[#273657] text-[#273657]"}`,
19029
+ children: title
19030
+ }
19031
+ )
19060
19032
  ] }),
19061
19033
  /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(
19062
19034
  "span",
@@ -19091,60 +19063,104 @@ function Sidebar({
19091
19063
  )
19092
19064
  ] });
19093
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
+ }
19094
19073
  return /* @__PURE__ */ (0, import_jsx_runtime94.jsxs)(import_jsx_runtime94.Fragment, { children: [
19095
- /* @__PURE__ */ (0, import_jsx_runtime94.jsxs)("aside", { className: `fc:flex fc:h-screen fc:flex-col fc:overflow-hidden fc:border-r fc:border-[#E5E9F1] fc:bg-white fc:font-sans fc:text-[#273657] fc:transition-all fc:duration-300 fc:ease-in-out ${isOpen ? "fc:w-[285px] fc:min-w-[285px] fc:translate-x-0 fc:opacity-100" : "fc:w-0 fc:min-w-0 fc:-translate-x-full fc:opacity-0"}`, children: [
19096
- /* @__PURE__ */ (0, import_jsx_runtime94.jsxs)("header", { className: "fc:flex fc:h-[84px] fc:items-center fc:justify-between fc:border-b fc:border-[#EDF0F5] fc:px-[14px]", children: [
19097
- /* @__PURE__ */ (0, import_jsx_runtime94.jsxs)("div", { className: "fc:flex fc:items-center fc:gap-2", children: [
19098
- /* @__PURE__ */ (0, import_jsx_runtime94.jsxs)("svg", { width: "36", height: "42", viewBox: "0 0 48 56", fill: "none", children: [
19099
- /* @__PURE__ */ (0, import_jsx_runtime94.jsx)("path", { d: "M24 2L45 12.5L24 23L3 12.5L24 2Z", fill: "#356AF3" }),
19100
- /* @__PURE__ */ (0, import_jsx_runtime94.jsx)("path", { d: "M24 8L34 13L24 18L14 13L24 8Z", fill: "white" }),
19101
- /* @__PURE__ */ (0, import_jsx_runtime94.jsx)("path", { d: "M3 20L24 30.5L45 20V27L24 37.5L3 27V20Z", fill: "#356AF3" }),
19102
- /* @__PURE__ */ (0, import_jsx_runtime94.jsx)("path", { d: "M3 33L24 43.5L45 33V40L24 50.5L3 40V33Z", fill: "#356AF3" })
19074
+ /* @__PURE__ */ (0, import_jsx_runtime94.jsxs)(
19075
+ "aside",
19076
+ {
19077
+ className: `fc:flex fc:h-screen fc:flex-col fc:overflow-hidden fc:border-r fc:border-[#E5E9F1] fc:bg-white fc:font-sans fc:text-[#273657] fc:transition-all fc:duration-300 fc:ease-in-out ${isOpen ? "fc:w-[285px] fc:min-w-[285px] fc:translate-x-0 fc:opacity-100" : "fc:w-0 fc:min-w-0 fc:-translate-x-full fc:opacity-0"}`,
19078
+ children: [
19079
+ /* @__PURE__ */ (0, import_jsx_runtime94.jsxs)("header", { className: "fc:flex fc:h-[84px] fc:items-center fc:justify-between fc:border-b fc:border-[#EDF0F5] fc:px-[14px]", children: [
19080
+ /* @__PURE__ */ (0, import_jsx_runtime94.jsxs)("div", { className: "fc:flex fc:items-center fc:gap-2", children: [
19081
+ /* @__PURE__ */ (0, import_jsx_runtime94.jsxs)("svg", { width: "36", height: "42", viewBox: "0 0 48 56", fill: "none", children: [
19082
+ /* @__PURE__ */ (0, import_jsx_runtime94.jsx)("path", { d: "M24 2L45 12.5L24 23L3 12.5L24 2Z", fill: "#356AF3" }),
19083
+ /* @__PURE__ */ (0, import_jsx_runtime94.jsx)("path", { d: "M24 8L34 13L24 18L14 13L24 8Z", fill: "white" }),
19084
+ /* @__PURE__ */ (0, import_jsx_runtime94.jsx)("path", { d: "M3 20L24 30.5L45 20V27L24 37.5L3 27V20Z", fill: "#356AF3" }),
19085
+ /* @__PURE__ */ (0, import_jsx_runtime94.jsx)("path", { d: "M3 33L24 43.5L45 33V40L24 50.5L3 40V33Z", fill: "#356AF3" })
19086
+ ] }),
19087
+ /* @__PURE__ */ (0, import_jsx_runtime94.jsxs)("div", { children: [
19088
+ /* @__PURE__ */ (0, import_jsx_runtime94.jsx)("h1", { className: "fc:text-[18px] fc:font-extrabold fc:text-[#101318]", children: "FLOWCORE" }),
19089
+ /* @__PURE__ */ (0, import_jsx_runtime94.jsx)("p", { className: "fc:text-[12px] fc:text-[#344261]", children: "Workflow Engine" })
19090
+ ] })
19091
+ ] }),
19092
+ /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(
19093
+ "button",
19094
+ {
19095
+ type: "button",
19096
+ onClick: onToggle,
19097
+ className: "fc:flex flex fc:h-8 h-8 fc:w-8 w-8 fc:items-center items-center fc:justify-center justify-center fc:rounded-lg rounded-lg hover:fc:bg-gray-100 hover:bg-gray-100 fc:transition-colors transition-colors",
19098
+ children: /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(import_react95.RiMenuLine, { size: 18 })
19099
+ }
19100
+ )
19103
19101
  ] }),
19104
- /* @__PURE__ */ (0, import_jsx_runtime94.jsxs)("div", { children: [
19105
- /* @__PURE__ */ (0, import_jsx_runtime94.jsx)("h1", { className: "fc:text-[18px] fc:font-extrabold fc:text-[#101318]", children: "FLOWCORE" }),
19106
- /* @__PURE__ */ (0, import_jsx_runtime94.jsx)("p", { className: "fc:text-[12px] fc:text-[#344261]", children: "Workflow Engine" })
19107
- ] })
19108
- ] }),
19109
- /* @__PURE__ */ (0, import_jsx_runtime94.jsx)("button", { type: "button", onClick: onToggle, className: "fc:flex flex fc:h-8 h-8 fc:w-8 w-8 fc:items-center items-center fc:justify-center justify-center fc:rounded-lg rounded-lg hover:fc:bg-gray-100 hover:bg-gray-100 fc:transition-colors transition-colors", children: /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(import_react95.RiMenuLine, { size: 18 }) })
19110
- ] }),
19111
- /* @__PURE__ */ (0, import_jsx_runtime94.jsxs)("div", { className: "fc:min-h-0 min-h-0 fc:flex-1 flex-1 fc:overflow-y-auto overflow-y-auto fc:overflow-x-hidden overflow-x-hidden fc:px-[12px] px-[12px] fc:pb-[24px] pb-[24px] fc:pt-[20px] pt-[20px]", children: [
19112
- /* @__PURE__ */ (0, import_jsx_runtime94.jsx)("p", { className: "fc:mb-[10px] mb-[10px] fc:px-[10px] px-[10px] fc:text-[12px] text-[12px] fc:font-bold font-bold fc:uppercase uppercase fc:leading-[16px] leading-[16px] fc:tracking-[0.5px] tracking-[0.5px] fc:text-[#3C4D74] text-[#3C4D74]", children: "Configuration Masters" }),
19113
- /* @__PURE__ */ (0, import_jsx_runtime94.jsxs)("div", { className: "fc:flex flex fc:flex-col flex-col fc:gap-[2px] gap-[2px]", children: [
19114
- renderDropdown("Workflow", workflowOpen, setWorkflowOpen, workflowItems, import_react95.RiNodeTree),
19115
- renderDropdown("Permissions", permissionOpen, setPermissionOpen, permissionItems, import_react95.RiShieldUserLine),
19116
- renderDropdown("Documents", documentOpen, setDocumentOpen, documentItems, import_react95.RiFileSettingsLine),
19117
- renderDropdown("Hierarchy", hierarchyOpen, setHierarchyOpen, hierarchyItems, import_react95.RiNodeTree)
19118
- ] }),
19119
- /* @__PURE__ */ (0, import_jsx_runtime94.jsx)("p", { className: "fc:mb-[10px] mb-[10px] fc:px-[10px] px-[10px] fc:mt-[24px] mt-[24px] fc:text-[12px] text-[12px] fc:font-bold font-bold fc:uppercase uppercase fc:leading-[16px] leading-[16px] fc:tracking-[0.5px] tracking-[0.5px] fc:text-[#3C4D74] text-[#3C4D74]", children: "Runtime" }),
19120
- /* @__PURE__ */ (0, import_jsx_runtime94.jsxs)("div", { className: "fc:flex flex fc:flex-col flex-col fc:gap-[2px] gap-[2px]", children: [
19121
- renderDropdown("Files", filesOpen, setFilesOpen, fileItems, import_react95.RiFolder3Line),
19122
- renderDropdown("Tasks", tasksOpen, setTasksOpen, taskItems, import_react95.RiCheckboxCircleLine),
19123
- renderDropdown("Tracking", trackingOpen, setTrackingOpen, trackingItems, import_react95.RiRouteLine),
19124
- renderDropdown("Communication", communicationOpen, setCommunicationOpen, communicationItems, import_react95.RiMessage2Line)
19125
- ] })
19126
- ] }),
19127
- /* @__PURE__ */ (0, import_jsx_runtime94.jsx)("div", { className: "fc:shrink-0 shrink-0 fc:bg-white bg-white fc:px-[12px] px-[12px] fc:pb-[20px] pb-[20px] fc:pt-[12px] pt-[12px]", children: /* @__PURE__ */ (0, import_jsx_runtime94.jsxs)("button", { type: "button", className: "fc:flex flex fc:h-[50px] h-[50px] fc:w-full w-full fc:items-center items-center fc:gap-[12px] gap-[12px] fc:rounded-[10px] rounded-[10px] fc:border border fc:border-[#E1E5ED] border-[#E1E5ED] fc:bg-white bg-white fc:px-[14px] px-[14px] fc:text-left text-left fc:text-[15px] text-[15px] fc:font-semibold font-semibold fc:text-[#2D3A58] text-[#2D3A58] fc:shadow-sm shadow-sm hover:fc:bg-[#F7F8FC] hover:bg-[#F7F8FC] fc:transition transition", children: [
19128
- /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(import_react95.RiSettings4Line, { size: 20 }),
19129
- /* @__PURE__ */ (0, import_jsx_runtime94.jsx)("span", { children: "Settings" })
19130
- ] }) })
19131
- ] }),
19102
+ /* @__PURE__ */ (0, import_jsx_runtime94.jsxs)("div", { className: "fc:min-h-0 min-h-0 fc:flex-1 flex-1 fc:overflow-y-auto overflow-y-auto fc:overflow-x-hidden overflow-x-hidden fc:px-[12px] px-[12px] fc:pb-[24px] pb-[24px] fc:pt-[20px] pt-[20px]", children: [
19103
+ (workflowItems.length > 0 || permissionItems.length > 0 || hierarchyItems.length > 0 || documentItems.length > 0) && /* @__PURE__ */ (0, import_jsx_runtime94.jsxs)(import_jsx_runtime94.Fragment, { children: [
19104
+ /* @__PURE__ */ (0, import_jsx_runtime94.jsx)("p", { className: "fc:mb-[10px] mb-[10px] fc:px-[10px] px-[10px] fc:text-[12px] text-[12px] fc:font-bold font-bold fc:uppercase uppercase fc:leading-[16px] leading-[16px] fc:tracking-[0.5px] tracking-[0.5px] fc:text-[#3C4D74] text-[#3C4D74]", children: "Configuration Masters" }),
19105
+ /* @__PURE__ */ (0, import_jsx_runtime94.jsxs)("div", { className: "fc:flex flex fc:flex-col flex-col fc:gap-[2px] gap-[2px]", children: [
19106
+ renderDropdown("Workflow", workflowOpen, setWorkflowOpen, workflowItems, import_react95.RiNodeTree),
19107
+ renderDropdown("Permissions", permissionOpen, setPermissionOpen, permissionItems, import_react95.RiShieldUserLine),
19108
+ renderDropdown("Documents", documentOpen, setDocumentOpen, documentItems, import_react95.RiFileSettingsLine),
19109
+ renderDropdown("Hierarchy", hierarchyOpen, setHierarchyOpen, hierarchyItems, import_react95.RiNodeTree)
19110
+ ] })
19111
+ ] }),
19112
+ (fileItems.length > 0 || taskItems.length > 0 || trackingItems.length > 0 || communicationItems.length > 0) && /* @__PURE__ */ (0, import_jsx_runtime94.jsxs)(import_jsx_runtime94.Fragment, { children: [
19113
+ /* @__PURE__ */ (0, import_jsx_runtime94.jsx)("p", { className: "fc:mb-[10px] mb-[10px] fc:px-[10px] px-[10px] fc:mt-[24px] mt-[24px] fc:text-[12px] text-[12px] fc:font-bold font-bold fc:uppercase uppercase fc:leading-[16px] leading-[16px] fc:tracking-[0.5px] tracking-[0.5px] fc:text-[#3C4D74] text-[#3C4D74]", children: "Runtime" }),
19114
+ /* @__PURE__ */ (0, import_jsx_runtime94.jsxs)("div", { className: "fc:flex flex fc:flex-col flex-col fc:gap-[2px] gap-[2px]", children: [
19115
+ renderDropdown("Files", filesOpen, setFilesOpen, fileItems, import_react95.RiFolder3Line),
19116
+ renderDropdown("Tasks", tasksOpen, setTasksOpen, taskItems, import_react95.RiCheckboxCircleLine),
19117
+ renderDropdown("Tracking", trackingOpen, setTrackingOpen, trackingItems, import_react95.RiRouteLine),
19118
+ renderDropdown("Communication", communicationOpen, setCommunicationOpen, communicationItems, import_react95.RiMessage2Line)
19119
+ ] })
19120
+ ] })
19121
+ ] }),
19122
+ /* @__PURE__ */ (0, import_jsx_runtime94.jsx)("div", { className: "fc:shrink-0 shrink-0 fc:bg-white bg-white fc:px-[12px] px-[12px] fc:pb-[20px] pb-[20px] fc:pt-[12px] pt-[12px]", children: /* @__PURE__ */ (0, import_jsx_runtime94.jsxs)(
19123
+ "button",
19124
+ {
19125
+ type: "button",
19126
+ className: "fc:flex flex fc:h-[50px] h-[50px] fc:w-full w-full fc:items-center items-center fc:gap-[12px] gap-[12px] fc:rounded-[10px] rounded-[10px] fc:border border fc:border-[#E1E5ED] border-[#E1E5ED] fc:bg-white bg-white fc:px-[14px] px-[14px] fc:text-left text-left fc:text-[15px] text-[15px] fc:font-semibold font-semibold fc:text-[#2D3A58] text-[#2D3A58] fc:shadow-sm shadow-sm hover:fc:bg-[#F7F8FC] hover:bg-[#F7F8FC] fc:transition transition",
19127
+ children: [
19128
+ /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(import_react95.RiSettings4Line, { size: 20 }),
19129
+ /* @__PURE__ */ (0, import_jsx_runtime94.jsx)("span", { children: "Settings" })
19130
+ ]
19131
+ }
19132
+ ) })
19133
+ ]
19134
+ }
19135
+ ),
19132
19136
  /* @__PURE__ */ (0, import_jsx_runtime94.jsx)("div", { className: "fc:flex-1 flex-1 fc:overflow-auto overflow-auto fc:bg-[#F5F7FB] bg-[#F5F7FB]", children: renderContent() }),
19133
- !isOpen && /* @__PURE__ */ (0, import_jsx_runtime94.jsx)("button", { type: "button", onClick: onToggle, "aria-label": "Open sidebar", className: "fc:fixed fixed fc:left-[16px] left-[16px] fc:top-[30px] top-[30px] fc:z-[100] z-[100] fc:flex flex fc:h-[46px] h-[46px] fc:w-[46px] w-[46px] fc:items-center items-center fc:justify-center justify-center fc:rounded-[9px] rounded-[9px] fc:border border fc:border-[#E1E5ED] border-[#E1E5ED] fc:bg-white bg-white fc:text-[#344261] text-[#344261] fc:shadow-[0_2px_8px_rgba(0,0,0,0.08)] shadow-[0_2px_8px_rgba(0,0,0,0.08)] fc:transition-colors transition-colors hover:fc:bg-gray-100 hover:bg-gray-100", children: /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(import_react95.RiMenuLine, { size: 18 }) })
19137
+ !isOpen && /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(
19138
+ "button",
19139
+ {
19140
+ type: "button",
19141
+ onClick: onToggle,
19142
+ "aria-label": "Open sidebar",
19143
+ className: "fc:fixed fixed fc:left-[16px] left-[16px] fc:top-[30px] top-[30px] fc:z-[100] z-[100] fc:flex flex fc:h-[46px] h-[46px] fc:w-[46px] w-[46px] fc:items-center items-center fc:justify-center justify-center fc:rounded-[9px] rounded-[9px] fc:border border fc:border-[#E1E5ED] border-[#E1E5ED] fc:bg-white bg-white fc:text-[#344261] text-[#344261] fc:shadow-[0_2px_8px_rgba(0,0,0,0.08)] shadow-[0_2px_8px_rgba(0,0,0,0.08)] fc:transition-colors transition-colors hover:fc:bg-gray-100 hover:bg-gray-100",
19144
+ children: /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(import_react95.RiMenuLine, { size: 18 })
19145
+ }
19146
+ )
19134
19147
  ] });
19135
19148
  }
19136
19149
 
19137
19150
  // src/components/Layout.jsx
19138
19151
  var import_react96 = require("react");
19139
19152
  var import_jsx_runtime95 = require("react/jsx-runtime");
19140
- var Layout = ({ children }) => {
19153
+ var Layout = ({ children, sidebar, sidebarConfig }) => {
19141
19154
  const [isOpen, setIsOpen] = (0, import_react96.useState)(true);
19155
+ const resolvedSidebarConfig = sidebar != null ? sidebar : sidebarConfig;
19142
19156
  return /* @__PURE__ */ (0, import_jsx_runtime95.jsx)("div", { className: "flowcore fc:flex fc:min-h-screen", children: /* @__PURE__ */ (0, import_jsx_runtime95.jsx)(
19143
19157
  Sidebar,
19144
19158
  {
19145
19159
  isOpen,
19146
19160
  onToggle: () => setIsOpen(!isOpen),
19147
- childrens: children
19161
+ childrens: children,
19162
+ sidebar: resolvedSidebarConfig,
19163
+ sidebarConfig: resolvedSidebarConfig
19148
19164
  }
19149
19165
  ) });
19150
19166
  };
@@ -13,7 +13,33 @@ import {
13
13
 
14
14
  // src/components/Sidebar.jsx
15
15
  import { useState as useState70, useEffect as useEffect48 } from "react";
16
- import { RiFlowChart, RiShieldUserLine, RiFolder3Line, RiCheckboxCircleLine, RiRouteLine, RiMessage2Line, RiMenuLine, RiGitMergeLine, RiNodeTree, RiGitBranchLine, RiCornerDownRightLine, RiUserSettingsLine, RiFileShieldLine, RiUserSharedLine, RiSettings4Line, RiFileSettingsLine, RiFileList3Line, RiFileUploadLine, RiNotification4Line, RiDatabase2Line, RiChat3Line, RiCheckboxMultipleLine, RiShieldCheckLine, RiHistoryLine, RiArrowDownSLine, RiArrowRightSLine } from "@remixicon/react";
16
+ import {
17
+ RiShieldUserLine,
18
+ RiFolder3Line,
19
+ RiCheckboxCircleLine,
20
+ RiRouteLine,
21
+ RiMessage2Line,
22
+ RiMenuLine,
23
+ RiGitMergeLine,
24
+ RiNodeTree,
25
+ RiGitBranchLine,
26
+ RiCornerDownRightLine,
27
+ RiUserSettingsLine,
28
+ RiFileShieldLine,
29
+ RiUserSharedLine,
30
+ RiSettings4Line,
31
+ RiFileSettingsLine,
32
+ RiFileList3Line,
33
+ RiFileUploadLine,
34
+ RiNotification4Line,
35
+ RiDatabase2Line,
36
+ RiChat3Line,
37
+ RiCheckboxMultipleLine,
38
+ RiShieldCheckLine,
39
+ RiHistoryLine,
40
+ RiArrowRightSLine,
41
+ RiLockPasswordLine
42
+ } from "@remixicon/react";
17
43
  import { useRouter } from "next/router";
18
44
 
19
45
  // src/components/workflow/WorkflowMain.jsx
@@ -18630,122 +18656,87 @@ function StatusMain() {
18630
18656
 
18631
18657
  // src/components/Sidebar.jsx
18632
18658
  import { Fragment as Fragment5, jsx as jsx94, jsxs as jsxs93 } from "react/jsx-runtime";
18633
- var workflowItems = [
18634
- // Menu Name testing // component or page-Use function name
18635
- {
18636
- name: "Workflow Type",
18637
- component: "workflowType",
18638
- icon: RiGitMergeLine
18639
- },
18640
- {
18641
- name: "Workflow",
18642
- component: "workflow",
18643
- icon: RiNodeTree
18644
- },
18645
- {
18646
- name: "Workflow Step",
18647
- component: "workflowStep",
18648
- icon: RiGitBranchLine
18649
- },
18650
- {
18651
- name: "Workflow Transition",
18652
- component: "workflowTransition",
18653
- icon: RiCornerDownRightLine
18654
- },
18655
- {
18656
- name: "Module",
18657
- component: "module",
18658
- icon: RiFolder3Line
18659
- },
18660
- {
18661
- name: "Status",
18662
- component: "status",
18663
- icon: RiCheckboxCircleLine
18664
- }
18665
- ];
18666
- var permissionItems = [{
18667
- name: "Step Permission",
18668
- component: "step_permission_main",
18669
- icon: RiUserSettingsLine
18670
- }, {
18671
- name: "Assignment Rule",
18672
- component: "AssignmentRuleMain",
18673
- icon: RiFileShieldLine
18674
- }];
18675
- var hierarchyItems = [
18676
- {
18677
- name: "Hierarchy Node",
18678
- component: "HierarchyNodeMain",
18679
- icon: RiNodeTree
18680
- },
18681
- {
18682
- name: "Workflow Hierarchy Node Mapping",
18683
- component: "Workflow_Step_Hierarchy_Mapping_Main",
18684
- icon: RiUserSharedLine
18685
- },
18686
- {
18687
- name: "Workflow Step User Mapping",
18688
- component: "User_hierarchy_mapping_main",
18689
- icon: RiUserSharedLine
18690
- },
18691
- {
18692
- name: "Workflow Settings",
18693
- component: "WorkflowSettingMain",
18694
- icon: RiSettings4Line
18695
- }
18696
- ];
18697
- var documentItems = [{
18698
- name: "Document Configuration",
18699
- component: "DocumentConfigurationmain",
18700
- icon: RiFileSettingsLine
18701
- }];
18702
- var fileItems = [{
18703
- name: "Business Entity",
18704
- component: "BusinessEntitymain",
18705
- icon: RiFileList3Line
18706
- }, {
18707
- name: "File Instance",
18708
- component: "FileInstanceMain",
18709
- icon: RiFileList3Line
18710
- }, {
18711
- name: "File Pool",
18712
- component: "FilePoolMain",
18713
- icon: RiDatabase2Line
18714
- }, {
18715
- name: "Uploaded Document",
18716
- component: "UploadedDocumentMain",
18717
- icon: RiFileUploadLine
18718
- }];
18719
- var communicationItems = [{
18720
- name: "Notification",
18721
- component: "Notification_main",
18722
- icon: RiNotification4Line
18723
- }, {
18724
- name: "Comment",
18725
- component: "Comment_main",
18726
- icon: RiChat3Line
18727
- }];
18728
- var taskItems = [{
18729
- name: "Task Instance",
18730
- component: "TaskInstanceMain",
18731
- icon: RiCheckboxMultipleLine
18732
- }];
18733
- var trackingItems = [{
18734
- name: "Audit Log",
18735
- component: "AuditLogmain",
18736
- icon: RiShieldCheckLine
18737
- }, {
18738
- name: "Movement History",
18739
- component: "MovementHistorymain",
18740
- icon: RiHistoryLine
18741
- }];
18742
- function Sidebar({
18743
- isOpen,
18744
- onToggle,
18745
- childrens
18746
- }) {
18659
+ function Sidebar({ isOpen, onToggle, childrens, sidebar, sidebarConfig }) {
18747
18660
  const router = useRouter();
18748
- const [activeComponent, setActiveComponent] = useState70("workflowType");
18661
+ const resolvedSidebarConfig = sidebar != null ? sidebar : sidebarConfig;
18662
+ const masterWorkflowItems = [
18663
+ { name: "Workflow Type", component: "workflowType", icon: RiGitMergeLine, configKey: "isWorkflowType" },
18664
+ { name: "Workflow", component: "workflow", icon: RiNodeTree, configKey: "isWorkflow" },
18665
+ { name: "Workflow Step", component: "workflowStep", icon: RiGitBranchLine, configKey: "isWorkflowStep" },
18666
+ { name: "Workflow Transition", component: "workflowTransition", icon: RiCornerDownRightLine, configKey: "isWorkflowTransition" },
18667
+ { name: "Module", component: "module", icon: RiFolder3Line, configKey: "isModule" },
18668
+ { name: "Status", component: "status", icon: RiCheckboxCircleLine, configKey: "isStatus" }
18669
+ ];
18670
+ const masterPermissionItems = [
18671
+ { name: "Step Permission", component: "step_permission_main", icon: RiUserSettingsLine, configKey: "isStepPermission" },
18672
+ { name: "Assignment Rule", component: "AssignmentRuleMain", icon: RiFileShieldLine, configKey: "isAssignmentRule" }
18673
+ ];
18674
+ const masterHierarchyItems = [
18675
+ { name: "Hierarchy Node", component: "HierarchyNodeMain", icon: RiNodeTree, configKey: "isHierarchyNode" },
18676
+ { name: "Workflow Hierarchy Node Mapping", component: "Workflow_Step_Hierarchy_Mapping_Main", icon: RiUserSharedLine, configKey: "isWorkflowHierarchyMapping" },
18677
+ { name: "Workflow Step User Mapping", component: "User_hierarchy_mapping_main", icon: RiUserSharedLine, configKey: "isUserHierarchyMapping" },
18678
+ { name: "Workflow Settings", component: "WorkflowSettingMain", icon: RiSettings4Line, configKey: "isWorkflowSettings" }
18679
+ ];
18680
+ const masterDocumentItems = [
18681
+ { name: "Document Configuration", component: "DocumentConfigurationmain", icon: RiFileSettingsLine, configKey: "isDocumentConfiguration" }
18682
+ ];
18683
+ const masterFileItems = [
18684
+ { name: "Business Entity", component: "BusinessEntitymain", icon: RiFileList3Line, configKey: "isBusinessEntity" },
18685
+ { name: "File Instance", component: "FileInstanceMain", icon: RiFileList3Line, configKey: "isFileInstance" },
18686
+ { name: "File Pool", component: "FilePoolMain", icon: RiDatabase2Line, configKey: "isFilePool" },
18687
+ { name: "Uploaded Document", component: "UploadedDocumentMain", icon: RiFileUploadLine, configKey: "isUploadedDocument" }
18688
+ ];
18689
+ const masterCommunicationItems = [
18690
+ { name: "Notification", component: "Notification_main", icon: RiNotification4Line, configKey: "isNotification" },
18691
+ { name: "Comment", component: "Comment_main", icon: RiChat3Line, configKey: "isComment" }
18692
+ ];
18693
+ const masterTaskItems = [
18694
+ { name: "Task Instance", component: "TaskInstanceMain", icon: RiCheckboxMultipleLine, configKey: "isTaskInstance" }
18695
+ ];
18696
+ const masterTrackingItems = [
18697
+ { name: "Audit Log", component: "AuditLogmain", icon: RiShieldCheckLine, configKey: "isAuditLog" },
18698
+ { name: "Movement History", component: "MovementHistorymain", icon: RiHistoryLine, configKey: "isMovementHistory" }
18699
+ ];
18700
+ const getConfigObject = () => {
18701
+ if (!resolvedSidebarConfig) return null;
18702
+ return Array.isArray(resolvedSidebarConfig) ? Object.assign({}, ...resolvedSidebarConfig) : resolvedSidebarConfig;
18703
+ };
18704
+ const filterItems = (items) => {
18705
+ const configObj2 = getConfigObject();
18706
+ if (!configObj2) return items;
18707
+ if (Object.keys(configObj2).length === 0) return [];
18708
+ return items.filter((item) => {
18709
+ if (item.configKey && configObj2[item.configKey] === false) {
18710
+ return false;
18711
+ }
18712
+ return true;
18713
+ });
18714
+ };
18715
+ const configObj = getConfigObject();
18716
+ const hasSidebarAccess = !configObj || Object.values(configObj).some((value) => value === true);
18717
+ const workflowItems = filterItems(masterWorkflowItems);
18718
+ const permissionItems = filterItems(masterPermissionItems);
18719
+ const hierarchyItems = filterItems(masterHierarchyItems);
18720
+ const documentItems = filterItems(masterDocumentItems);
18721
+ const fileItems = filterItems(masterFileItems);
18722
+ const communicationItems = filterItems(masterCommunicationItems);
18723
+ const taskItems = filterItems(masterTaskItems);
18724
+ const trackingItems = filterItems(masterTrackingItems);
18725
+ const hasAnyAccess = workflowItems.length > 0 || permissionItems.length > 0 || hierarchyItems.length > 0 || documentItems.length > 0 || fileItems.length > 0 || communicationItems.length > 0 || taskItems.length > 0 || trackingItems.length > 0;
18726
+ const getAllAvailableItems = () => [
18727
+ ...workflowItems,
18728
+ ...permissionItems,
18729
+ ...hierarchyItems,
18730
+ ...documentItems,
18731
+ ...fileItems,
18732
+ ...taskItems,
18733
+ ...trackingItems,
18734
+ ...communicationItems
18735
+ ];
18736
+ const [activeComponent, setActiveComponent] = useState70(() => {
18737
+ const all = getAllAvailableItems();
18738
+ return all.length > 0 ? all[0].component : null;
18739
+ });
18749
18740
  const [workflowOpen, setWorkflowOpen] = useState70(true);
18750
18741
  const [permissionOpen, setPermissionOpen] = useState70(false);
18751
18742
  const [hierarchyOpen, setHierarchyOpen] = useState70(false);
@@ -18772,21 +18763,16 @@ function Sidebar({
18772
18763
  } else if (communicationItems.some((item) => item.component === activeComponent)) {
18773
18764
  setCommunicationOpen(true);
18774
18765
  }
18775
- }, [activeComponent]);
18766
+ }, [activeComponent, workflowItems, permissionItems, hierarchyItems, documentItems, fileItems, taskItems, trackingItems, communicationItems]);
18776
18767
  const renderMenuItem = (item) => {
18777
18768
  const Icon = item.icon;
18778
18769
  const handleClick = () => {
18779
18770
  if (item.component) {
18780
- router.push("/flowCore", void 0, {
18781
- shallow: true
18782
- });
18771
+ router.push("/flowCore", void 0, { shallow: true });
18783
18772
  setActiveComponent(item.component);
18784
- } else if (item.path) {
18785
- setActiveComponent(null);
18786
- router.push(item.path);
18787
18773
  }
18788
18774
  };
18789
- const isActive = item.component ? activeComponent === item.component : router.pathname === item.path;
18775
+ const isActive = activeComponent === item.component;
18790
18776
  return /* @__PURE__ */ jsxs93(
18791
18777
  "button",
18792
18778
  {
@@ -18809,6 +18795,13 @@ function Sidebar({
18809
18795
  );
18810
18796
  };
18811
18797
  const renderContent = () => {
18798
+ if (!hasAnyAccess) {
18799
+ return /* @__PURE__ */ jsxs93("div", { className: "fc:flex fc:flex-col fc:items-center fc:justify-center fc:h-full fc:p-6 fc:text-center", children: [
18800
+ /* @__PURE__ */ jsx94("div", { className: "fc:bg-red-50 fc:text-red-500 fc:p-4 fc:rounded-full fc:mb-4", children: /* @__PURE__ */ jsx94(RiLockPasswordLine, { size: 32 }) }),
18801
+ /* @__PURE__ */ jsx94("h2", { className: "fc:text-lg fc:font-bold fc:text-[#101318] fc:mb-1", children: "Access Restricted" }),
18802
+ /* @__PURE__ */ jsx94("p", { className: "fc:text-sm fc:text-[#64748B] fc:max-w-md", children: "You do not have permission to access any modules or workflow sections. Please contact your administrator for access rights." })
18803
+ ] });
18804
+ }
18812
18805
  switch (activeComponent) {
18813
18806
  case "module":
18814
18807
  return /* @__PURE__ */ jsx94(ModuleMain, {});
@@ -18859,9 +18852,8 @@ function Sidebar({
18859
18852
  }
18860
18853
  };
18861
18854
  const renderDropdown = (title, open, setOpen, items, HeadingIcon) => {
18862
- const hasActiveChild = items.some(
18863
- (item) => item.component ? activeComponent === item.component : router.pathname === item.path
18864
- );
18855
+ if (items.length === 0) return null;
18856
+ const hasActiveChild = items.some((item) => activeComponent === item.component);
18865
18857
  return /* @__PURE__ */ jsxs93("div", { className: "fc:mb-1 mb-1", children: [
18866
18858
  /* @__PURE__ */ jsxs93(
18867
18859
  "button",
@@ -18878,7 +18870,13 @@ function Sidebar({
18878
18870
  className: `fc:shrink-0 shrink-0 fc:transition-colors transition-colors ${hasActiveChild ? "fc:text-blue-600 text-blue-600" : "fc:text-[#405170] text-[#405170]"}`
18879
18871
  }
18880
18872
  ),
18881
- /* @__PURE__ */ jsx94("span", { className: `fc:text-[14px] text-[14px] fc:font-semibold font-semibold fc:truncate truncate ${hasActiveChild && !open ? "fc:text-blue-600 text-blue-600" : "fc:text-[#273657] text-[#273657]"}`, children: title })
18873
+ /* @__PURE__ */ jsx94(
18874
+ "span",
18875
+ {
18876
+ className: `fc:text-[14px] text-[14px] fc:font-semibold font-semibold fc:truncate truncate ${hasActiveChild && !open ? "fc:text-blue-600 text-blue-600" : "fc:text-[#273657] text-[#273657]"}`,
18877
+ children: title
18878
+ }
18879
+ )
18882
18880
  ] }),
18883
18881
  /* @__PURE__ */ jsx94(
18884
18882
  "span",
@@ -18913,60 +18911,104 @@ function Sidebar({
18913
18911
  )
18914
18912
  ] });
18915
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
+ }
18916
18921
  return /* @__PURE__ */ jsxs93(Fragment5, { children: [
18917
- /* @__PURE__ */ jsxs93("aside", { className: `fc:flex fc:h-screen fc:flex-col fc:overflow-hidden fc:border-r fc:border-[#E5E9F1] fc:bg-white fc:font-sans fc:text-[#273657] fc:transition-all fc:duration-300 fc:ease-in-out ${isOpen ? "fc:w-[285px] fc:min-w-[285px] fc:translate-x-0 fc:opacity-100" : "fc:w-0 fc:min-w-0 fc:-translate-x-full fc:opacity-0"}`, children: [
18918
- /* @__PURE__ */ jsxs93("header", { className: "fc:flex fc:h-[84px] fc:items-center fc:justify-between fc:border-b fc:border-[#EDF0F5] fc:px-[14px]", children: [
18919
- /* @__PURE__ */ jsxs93("div", { className: "fc:flex fc:items-center fc:gap-2", children: [
18920
- /* @__PURE__ */ jsxs93("svg", { width: "36", height: "42", viewBox: "0 0 48 56", fill: "none", children: [
18921
- /* @__PURE__ */ jsx94("path", { d: "M24 2L45 12.5L24 23L3 12.5L24 2Z", fill: "#356AF3" }),
18922
- /* @__PURE__ */ jsx94("path", { d: "M24 8L34 13L24 18L14 13L24 8Z", fill: "white" }),
18923
- /* @__PURE__ */ jsx94("path", { d: "M3 20L24 30.5L45 20V27L24 37.5L3 27V20Z", fill: "#356AF3" }),
18924
- /* @__PURE__ */ jsx94("path", { d: "M3 33L24 43.5L45 33V40L24 50.5L3 40V33Z", fill: "#356AF3" })
18922
+ /* @__PURE__ */ jsxs93(
18923
+ "aside",
18924
+ {
18925
+ className: `fc:flex fc:h-screen fc:flex-col fc:overflow-hidden fc:border-r fc:border-[#E5E9F1] fc:bg-white fc:font-sans fc:text-[#273657] fc:transition-all fc:duration-300 fc:ease-in-out ${isOpen ? "fc:w-[285px] fc:min-w-[285px] fc:translate-x-0 fc:opacity-100" : "fc:w-0 fc:min-w-0 fc:-translate-x-full fc:opacity-0"}`,
18926
+ children: [
18927
+ /* @__PURE__ */ jsxs93("header", { className: "fc:flex fc:h-[84px] fc:items-center fc:justify-between fc:border-b fc:border-[#EDF0F5] fc:px-[14px]", children: [
18928
+ /* @__PURE__ */ jsxs93("div", { className: "fc:flex fc:items-center fc:gap-2", children: [
18929
+ /* @__PURE__ */ jsxs93("svg", { width: "36", height: "42", viewBox: "0 0 48 56", fill: "none", children: [
18930
+ /* @__PURE__ */ jsx94("path", { d: "M24 2L45 12.5L24 23L3 12.5L24 2Z", fill: "#356AF3" }),
18931
+ /* @__PURE__ */ jsx94("path", { d: "M24 8L34 13L24 18L14 13L24 8Z", fill: "white" }),
18932
+ /* @__PURE__ */ jsx94("path", { d: "M3 20L24 30.5L45 20V27L24 37.5L3 27V20Z", fill: "#356AF3" }),
18933
+ /* @__PURE__ */ jsx94("path", { d: "M3 33L24 43.5L45 33V40L24 50.5L3 40V33Z", fill: "#356AF3" })
18934
+ ] }),
18935
+ /* @__PURE__ */ jsxs93("div", { children: [
18936
+ /* @__PURE__ */ jsx94("h1", { className: "fc:text-[18px] fc:font-extrabold fc:text-[#101318]", children: "FLOWCORE" }),
18937
+ /* @__PURE__ */ jsx94("p", { className: "fc:text-[12px] fc:text-[#344261]", children: "Workflow Engine" })
18938
+ ] })
18939
+ ] }),
18940
+ /* @__PURE__ */ jsx94(
18941
+ "button",
18942
+ {
18943
+ type: "button",
18944
+ onClick: onToggle,
18945
+ className: "fc:flex flex fc:h-8 h-8 fc:w-8 w-8 fc:items-center items-center fc:justify-center justify-center fc:rounded-lg rounded-lg hover:fc:bg-gray-100 hover:bg-gray-100 fc:transition-colors transition-colors",
18946
+ children: /* @__PURE__ */ jsx94(RiMenuLine, { size: 18 })
18947
+ }
18948
+ )
18925
18949
  ] }),
18926
- /* @__PURE__ */ jsxs93("div", { children: [
18927
- /* @__PURE__ */ jsx94("h1", { className: "fc:text-[18px] fc:font-extrabold fc:text-[#101318]", children: "FLOWCORE" }),
18928
- /* @__PURE__ */ jsx94("p", { className: "fc:text-[12px] fc:text-[#344261]", children: "Workflow Engine" })
18929
- ] })
18930
- ] }),
18931
- /* @__PURE__ */ jsx94("button", { type: "button", onClick: onToggle, className: "fc:flex flex fc:h-8 h-8 fc:w-8 w-8 fc:items-center items-center fc:justify-center justify-center fc:rounded-lg rounded-lg hover:fc:bg-gray-100 hover:bg-gray-100 fc:transition-colors transition-colors", children: /* @__PURE__ */ jsx94(RiMenuLine, { size: 18 }) })
18932
- ] }),
18933
- /* @__PURE__ */ jsxs93("div", { className: "fc:min-h-0 min-h-0 fc:flex-1 flex-1 fc:overflow-y-auto overflow-y-auto fc:overflow-x-hidden overflow-x-hidden fc:px-[12px] px-[12px] fc:pb-[24px] pb-[24px] fc:pt-[20px] pt-[20px]", children: [
18934
- /* @__PURE__ */ jsx94("p", { className: "fc:mb-[10px] mb-[10px] fc:px-[10px] px-[10px] fc:text-[12px] text-[12px] fc:font-bold font-bold fc:uppercase uppercase fc:leading-[16px] leading-[16px] fc:tracking-[0.5px] tracking-[0.5px] fc:text-[#3C4D74] text-[#3C4D74]", children: "Configuration Masters" }),
18935
- /* @__PURE__ */ jsxs93("div", { className: "fc:flex flex fc:flex-col flex-col fc:gap-[2px] gap-[2px]", children: [
18936
- renderDropdown("Workflow", workflowOpen, setWorkflowOpen, workflowItems, RiNodeTree),
18937
- renderDropdown("Permissions", permissionOpen, setPermissionOpen, permissionItems, RiShieldUserLine),
18938
- renderDropdown("Documents", documentOpen, setDocumentOpen, documentItems, RiFileSettingsLine),
18939
- renderDropdown("Hierarchy", hierarchyOpen, setHierarchyOpen, hierarchyItems, RiNodeTree)
18940
- ] }),
18941
- /* @__PURE__ */ jsx94("p", { className: "fc:mb-[10px] mb-[10px] fc:px-[10px] px-[10px] fc:mt-[24px] mt-[24px] fc:text-[12px] text-[12px] fc:font-bold font-bold fc:uppercase uppercase fc:leading-[16px] leading-[16px] fc:tracking-[0.5px] tracking-[0.5px] fc:text-[#3C4D74] text-[#3C4D74]", children: "Runtime" }),
18942
- /* @__PURE__ */ jsxs93("div", { className: "fc:flex flex fc:flex-col flex-col fc:gap-[2px] gap-[2px]", children: [
18943
- renderDropdown("Files", filesOpen, setFilesOpen, fileItems, RiFolder3Line),
18944
- renderDropdown("Tasks", tasksOpen, setTasksOpen, taskItems, RiCheckboxCircleLine),
18945
- renderDropdown("Tracking", trackingOpen, setTrackingOpen, trackingItems, RiRouteLine),
18946
- renderDropdown("Communication", communicationOpen, setCommunicationOpen, communicationItems, RiMessage2Line)
18947
- ] })
18948
- ] }),
18949
- /* @__PURE__ */ jsx94("div", { className: "fc:shrink-0 shrink-0 fc:bg-white bg-white fc:px-[12px] px-[12px] fc:pb-[20px] pb-[20px] fc:pt-[12px] pt-[12px]", children: /* @__PURE__ */ jsxs93("button", { type: "button", className: "fc:flex flex fc:h-[50px] h-[50px] fc:w-full w-full fc:items-center items-center fc:gap-[12px] gap-[12px] fc:rounded-[10px] rounded-[10px] fc:border border fc:border-[#E1E5ED] border-[#E1E5ED] fc:bg-white bg-white fc:px-[14px] px-[14px] fc:text-left text-left fc:text-[15px] text-[15px] fc:font-semibold font-semibold fc:text-[#2D3A58] text-[#2D3A58] fc:shadow-sm shadow-sm hover:fc:bg-[#F7F8FC] hover:bg-[#F7F8FC] fc:transition transition", children: [
18950
- /* @__PURE__ */ jsx94(RiSettings4Line, { size: 20 }),
18951
- /* @__PURE__ */ jsx94("span", { children: "Settings" })
18952
- ] }) })
18953
- ] }),
18950
+ /* @__PURE__ */ jsxs93("div", { className: "fc:min-h-0 min-h-0 fc:flex-1 flex-1 fc:overflow-y-auto overflow-y-auto fc:overflow-x-hidden overflow-x-hidden fc:px-[12px] px-[12px] fc:pb-[24px] pb-[24px] fc:pt-[20px] pt-[20px]", children: [
18951
+ (workflowItems.length > 0 || permissionItems.length > 0 || hierarchyItems.length > 0 || documentItems.length > 0) && /* @__PURE__ */ jsxs93(Fragment5, { children: [
18952
+ /* @__PURE__ */ jsx94("p", { className: "fc:mb-[10px] mb-[10px] fc:px-[10px] px-[10px] fc:text-[12px] text-[12px] fc:font-bold font-bold fc:uppercase uppercase fc:leading-[16px] leading-[16px] fc:tracking-[0.5px] tracking-[0.5px] fc:text-[#3C4D74] text-[#3C4D74]", children: "Configuration Masters" }),
18953
+ /* @__PURE__ */ jsxs93("div", { className: "fc:flex flex fc:flex-col flex-col fc:gap-[2px] gap-[2px]", children: [
18954
+ renderDropdown("Workflow", workflowOpen, setWorkflowOpen, workflowItems, RiNodeTree),
18955
+ renderDropdown("Permissions", permissionOpen, setPermissionOpen, permissionItems, RiShieldUserLine),
18956
+ renderDropdown("Documents", documentOpen, setDocumentOpen, documentItems, RiFileSettingsLine),
18957
+ renderDropdown("Hierarchy", hierarchyOpen, setHierarchyOpen, hierarchyItems, RiNodeTree)
18958
+ ] })
18959
+ ] }),
18960
+ (fileItems.length > 0 || taskItems.length > 0 || trackingItems.length > 0 || communicationItems.length > 0) && /* @__PURE__ */ jsxs93(Fragment5, { children: [
18961
+ /* @__PURE__ */ jsx94("p", { className: "fc:mb-[10px] mb-[10px] fc:px-[10px] px-[10px] fc:mt-[24px] mt-[24px] fc:text-[12px] text-[12px] fc:font-bold font-bold fc:uppercase uppercase fc:leading-[16px] leading-[16px] fc:tracking-[0.5px] tracking-[0.5px] fc:text-[#3C4D74] text-[#3C4D74]", children: "Runtime" }),
18962
+ /* @__PURE__ */ jsxs93("div", { className: "fc:flex flex fc:flex-col flex-col fc:gap-[2px] gap-[2px]", children: [
18963
+ renderDropdown("Files", filesOpen, setFilesOpen, fileItems, RiFolder3Line),
18964
+ renderDropdown("Tasks", tasksOpen, setTasksOpen, taskItems, RiCheckboxCircleLine),
18965
+ renderDropdown("Tracking", trackingOpen, setTrackingOpen, trackingItems, RiRouteLine),
18966
+ renderDropdown("Communication", communicationOpen, setCommunicationOpen, communicationItems, RiMessage2Line)
18967
+ ] })
18968
+ ] })
18969
+ ] }),
18970
+ /* @__PURE__ */ jsx94("div", { className: "fc:shrink-0 shrink-0 fc:bg-white bg-white fc:px-[12px] px-[12px] fc:pb-[20px] pb-[20px] fc:pt-[12px] pt-[12px]", children: /* @__PURE__ */ jsxs93(
18971
+ "button",
18972
+ {
18973
+ type: "button",
18974
+ className: "fc:flex flex fc:h-[50px] h-[50px] fc:w-full w-full fc:items-center items-center fc:gap-[12px] gap-[12px] fc:rounded-[10px] rounded-[10px] fc:border border fc:border-[#E1E5ED] border-[#E1E5ED] fc:bg-white bg-white fc:px-[14px] px-[14px] fc:text-left text-left fc:text-[15px] text-[15px] fc:font-semibold font-semibold fc:text-[#2D3A58] text-[#2D3A58] fc:shadow-sm shadow-sm hover:fc:bg-[#F7F8FC] hover:bg-[#F7F8FC] fc:transition transition",
18975
+ children: [
18976
+ /* @__PURE__ */ jsx94(RiSettings4Line, { size: 20 }),
18977
+ /* @__PURE__ */ jsx94("span", { children: "Settings" })
18978
+ ]
18979
+ }
18980
+ ) })
18981
+ ]
18982
+ }
18983
+ ),
18954
18984
  /* @__PURE__ */ jsx94("div", { className: "fc:flex-1 flex-1 fc:overflow-auto overflow-auto fc:bg-[#F5F7FB] bg-[#F5F7FB]", children: renderContent() }),
18955
- !isOpen && /* @__PURE__ */ jsx94("button", { type: "button", onClick: onToggle, "aria-label": "Open sidebar", className: "fc:fixed fixed fc:left-[16px] left-[16px] fc:top-[30px] top-[30px] fc:z-[100] z-[100] fc:flex flex fc:h-[46px] h-[46px] fc:w-[46px] w-[46px] fc:items-center items-center fc:justify-center justify-center fc:rounded-[9px] rounded-[9px] fc:border border fc:border-[#E1E5ED] border-[#E1E5ED] fc:bg-white bg-white fc:text-[#344261] text-[#344261] fc:shadow-[0_2px_8px_rgba(0,0,0,0.08)] shadow-[0_2px_8px_rgba(0,0,0,0.08)] fc:transition-colors transition-colors hover:fc:bg-gray-100 hover:bg-gray-100", children: /* @__PURE__ */ jsx94(RiMenuLine, { size: 18 }) })
18985
+ !isOpen && /* @__PURE__ */ jsx94(
18986
+ "button",
18987
+ {
18988
+ type: "button",
18989
+ onClick: onToggle,
18990
+ "aria-label": "Open sidebar",
18991
+ className: "fc:fixed fixed fc:left-[16px] left-[16px] fc:top-[30px] top-[30px] fc:z-[100] z-[100] fc:flex flex fc:h-[46px] h-[46px] fc:w-[46px] w-[46px] fc:items-center items-center fc:justify-center justify-center fc:rounded-[9px] rounded-[9px] fc:border border fc:border-[#E1E5ED] border-[#E1E5ED] fc:bg-white bg-white fc:text-[#344261] text-[#344261] fc:shadow-[0_2px_8px_rgba(0,0,0,0.08)] shadow-[0_2px_8px_rgba(0,0,0,0.08)] fc:transition-colors transition-colors hover:fc:bg-gray-100 hover:bg-gray-100",
18992
+ children: /* @__PURE__ */ jsx94(RiMenuLine, { size: 18 })
18993
+ }
18994
+ )
18956
18995
  ] });
18957
18996
  }
18958
18997
 
18959
18998
  // src/components/Layout.jsx
18960
18999
  import { useState as useState71 } from "react";
18961
19000
  import { jsx as jsx95 } from "react/jsx-runtime";
18962
- var Layout = ({ children }) => {
19001
+ var Layout = ({ children, sidebar, sidebarConfig }) => {
18963
19002
  const [isOpen, setIsOpen] = useState71(true);
19003
+ const resolvedSidebarConfig = sidebar != null ? sidebar : sidebarConfig;
18964
19004
  return /* @__PURE__ */ jsx95("div", { className: "flowcore fc:flex fc:min-h-screen", children: /* @__PURE__ */ jsx95(
18965
19005
  Sidebar,
18966
19006
  {
18967
19007
  isOpen,
18968
19008
  onToggle: () => setIsOpen(!isOpen),
18969
- childrens: children
19009
+ childrens: children,
19010
+ sidebar: resolvedSidebarConfig,
19011
+ sidebarConfig: resolvedSidebarConfig
18970
19012
  }
18971
19013
  ) });
18972
19014
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "flowcore-fn",
3
- "version": "10.2.4",
3
+ "version": "10.2.6",
4
4
  "main": "dist/pkg-index.js",
5
5
  "module": "dist/pkg-index.mjs",
6
6
  "files": [