@lincros-ui/components 0.2.18 → 0.2.20
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/index.cjs +41 -26
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +42 -28
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -4820,6 +4820,15 @@ var SSOLoadingOverlay = React37.memo(({
|
|
|
4820
4820
|
});
|
|
4821
4821
|
var SSOLoadingOverlay_default = SSOLoadingOverlay;
|
|
4822
4822
|
SSOLoadingOverlay.displayName = "SSOLoadingOverlay";
|
|
4823
|
+
|
|
4824
|
+
// src/menu-permissions.ts
|
|
4825
|
+
var MenuPermissionLevel = /* @__PURE__ */ ((MenuPermissionLevel2) => {
|
|
4826
|
+
MenuPermissionLevel2["ALL"] = "ALL";
|
|
4827
|
+
MenuPermissionLevel2["ADMIN_ONLY"] = "ADMIN_ONLY";
|
|
4828
|
+
MenuPermissionLevel2["MANAGER_OR_ADMIN"] = "MANAGER_OR_ADMIN";
|
|
4829
|
+
MenuPermissionLevel2["MASTER_TENANT_ONLY"] = "MASTER_TENANT_ONLY";
|
|
4830
|
+
return MenuPermissionLevel2;
|
|
4831
|
+
})(MenuPermissionLevel || {});
|
|
4823
4832
|
var STORAGE_KEY = "sidebar-expanded-menus";
|
|
4824
4833
|
function useSidebarState(routePaths) {
|
|
4825
4834
|
const location = reactRouterDom.useLocation();
|
|
@@ -5152,7 +5161,8 @@ function ControlSidebar({
|
|
|
5152
5161
|
logoUrl = "/lovable-uploads/632ebc32-3ae3-4944-8e70-0e9c2539494a.png",
|
|
5153
5162
|
faviconUrl,
|
|
5154
5163
|
appName = "App",
|
|
5155
|
-
appSubtitle = "Sistema"
|
|
5164
|
+
appSubtitle = "Sistema",
|
|
5165
|
+
menuItems: menuItemsProp
|
|
5156
5166
|
}) {
|
|
5157
5167
|
const {
|
|
5158
5168
|
toggleSubmenu,
|
|
@@ -5175,64 +5185,64 @@ function ControlSidebar({
|
|
|
5175
5185
|
}
|
|
5176
5186
|
}
|
|
5177
5187
|
};
|
|
5178
|
-
const
|
|
5188
|
+
const defaultMenuItems = [
|
|
5179
5189
|
{
|
|
5180
5190
|
title: "Dashboard",
|
|
5181
5191
|
url: routePaths.DASHBOARD,
|
|
5182
5192
|
icon: lucideReact.Monitor,
|
|
5183
|
-
permission:
|
|
5193
|
+
permission: "ALL" /* ALL */
|
|
5184
5194
|
},
|
|
5185
5195
|
{
|
|
5186
5196
|
title: "Monitoramento de Rotas",
|
|
5187
5197
|
url: routePaths.ROUTE_MONITORING,
|
|
5188
5198
|
icon: lucideReact.Navigation,
|
|
5189
|
-
permission:
|
|
5199
|
+
permission: "ADMIN_ONLY" /* ADMIN_ONLY */
|
|
5190
5200
|
},
|
|
5191
5201
|
{
|
|
5192
5202
|
title: "Alertas",
|
|
5193
5203
|
url: routePaths.ALERTS,
|
|
5194
5204
|
icon: lucideReact.Bell,
|
|
5195
|
-
permission:
|
|
5205
|
+
permission: "ALL" /* ALL */
|
|
5196
5206
|
},
|
|
5197
5207
|
{
|
|
5198
5208
|
title: "Relat\xF3rios",
|
|
5199
5209
|
url: routePaths.REPORTS,
|
|
5200
5210
|
icon: lucideReact.BarChart3,
|
|
5201
|
-
permission:
|
|
5211
|
+
permission: "ALL" /* ALL */
|
|
5202
5212
|
},
|
|
5203
5213
|
{
|
|
5204
5214
|
title: "Configura\xE7\xF5es",
|
|
5205
5215
|
icon: lucideReact.Settings,
|
|
5206
|
-
permission:
|
|
5216
|
+
permission: "ADMIN_ONLY" /* ADMIN_ONLY */,
|
|
5207
5217
|
subItems: [
|
|
5208
5218
|
{
|
|
5209
5219
|
title: "Configura\xE7\xF5es Gerais",
|
|
5210
5220
|
url: routePaths.SETTINGS,
|
|
5211
5221
|
icon: lucideReact.Settings,
|
|
5212
|
-
permission:
|
|
5222
|
+
permission: "ALL" /* ALL */
|
|
5213
5223
|
},
|
|
5214
5224
|
{
|
|
5215
5225
|
title: "Usu\xE1rios",
|
|
5216
5226
|
icon: lucideReact.Users,
|
|
5217
|
-
permission:
|
|
5227
|
+
permission: "MANAGER_OR_ADMIN" /* MANAGER_OR_ADMIN */,
|
|
5218
5228
|
subItems: [
|
|
5219
5229
|
{
|
|
5220
5230
|
title: "Gest\xE3o de Usu\xE1rios",
|
|
5221
5231
|
url: routePaths.USER_MANAGEMENT,
|
|
5222
5232
|
icon: lucideReact.UserCheck,
|
|
5223
|
-
permission:
|
|
5233
|
+
permission: "MANAGER_OR_ADMIN" /* MANAGER_OR_ADMIN */
|
|
5224
5234
|
},
|
|
5225
5235
|
{
|
|
5226
5236
|
title: "Perfis de Usu\xE1rio",
|
|
5227
5237
|
url: routePaths.USER_PROFILES,
|
|
5228
5238
|
icon: lucideReact.UserCog,
|
|
5229
|
-
permission:
|
|
5239
|
+
permission: "MANAGER_OR_ADMIN" /* MANAGER_OR_ADMIN */
|
|
5230
5240
|
},
|
|
5231
5241
|
{
|
|
5232
5242
|
title: "Permiss\xF5es",
|
|
5233
5243
|
url: routePaths.PERMISSIONS_MANAGEMENT,
|
|
5234
5244
|
icon: lucideReact.Shield,
|
|
5235
|
-
permission:
|
|
5245
|
+
permission: "ADMIN_ONLY" /* ADMIN_ONLY */
|
|
5236
5246
|
}
|
|
5237
5247
|
]
|
|
5238
5248
|
},
|
|
@@ -5240,30 +5250,30 @@ function ControlSidebar({
|
|
|
5240
5250
|
title: "Motoristas",
|
|
5241
5251
|
url: routePaths.MOTORISTAS,
|
|
5242
5252
|
icon: lucideReact.Car,
|
|
5243
|
-
permission:
|
|
5253
|
+
permission: "MANAGER_OR_ADMIN" /* MANAGER_OR_ADMIN */
|
|
5244
5254
|
},
|
|
5245
5255
|
{
|
|
5246
5256
|
title: "WhatsApp",
|
|
5247
5257
|
icon: lucideReact.MessageCircle,
|
|
5248
|
-
permission:
|
|
5258
|
+
permission: "MANAGER_OR_ADMIN" /* MANAGER_OR_ADMIN */,
|
|
5249
5259
|
subItems: [
|
|
5250
5260
|
{
|
|
5251
5261
|
title: "Configura\xE7\xF5es",
|
|
5252
5262
|
url: routePaths.WHATSAPP_CONFIG,
|
|
5253
5263
|
icon: lucideReact.Settings,
|
|
5254
|
-
permission:
|
|
5264
|
+
permission: "MANAGER_OR_ADMIN" /* MANAGER_OR_ADMIN */
|
|
5255
5265
|
},
|
|
5256
5266
|
{
|
|
5257
5267
|
title: "Triggers de Fluxo",
|
|
5258
5268
|
url: routePaths.WHATSAPP_TRIGGERS,
|
|
5259
5269
|
icon: lucideReact.Workflow,
|
|
5260
|
-
permission:
|
|
5270
|
+
permission: "MANAGER_OR_ADMIN" /* MANAGER_OR_ADMIN */
|
|
5261
5271
|
},
|
|
5262
5272
|
{
|
|
5263
5273
|
title: "Monitoramento",
|
|
5264
5274
|
url: routePaths.WHATSAPP_MONITORING,
|
|
5265
5275
|
icon: lucideReact.Monitor,
|
|
5266
|
-
permission:
|
|
5276
|
+
permission: "MANAGER_OR_ADMIN" /* MANAGER_OR_ADMIN */
|
|
5267
5277
|
}
|
|
5268
5278
|
]
|
|
5269
5279
|
},
|
|
@@ -5272,7 +5282,7 @@ function ControlSidebar({
|
|
|
5272
5282
|
title: "Unidades de Neg\xF3cio",
|
|
5273
5283
|
url: routePaths.UNIDADES_NEGOCIO,
|
|
5274
5284
|
icon: lucideReact.Building2,
|
|
5275
|
-
permission:
|
|
5285
|
+
permission: "MANAGER_OR_ADMIN" /* MANAGER_OR_ADMIN */
|
|
5276
5286
|
}
|
|
5277
5287
|
],
|
|
5278
5288
|
...isMasterTenant ? [
|
|
@@ -5280,7 +5290,7 @@ function ControlSidebar({
|
|
|
5280
5290
|
title: "Tenants",
|
|
5281
5291
|
url: routePaths.TENANT_MANAGEMENT,
|
|
5282
5292
|
icon: lucideReact.Database,
|
|
5283
|
-
permission:
|
|
5293
|
+
permission: "ADMIN_ONLY" /* ADMIN_ONLY */
|
|
5284
5294
|
}
|
|
5285
5295
|
] : []
|
|
5286
5296
|
]
|
|
@@ -5288,19 +5298,19 @@ function ControlSidebar({
|
|
|
5288
5298
|
{
|
|
5289
5299
|
title: "Automa\xE7\xE3o",
|
|
5290
5300
|
icon: lucideReact.Bot,
|
|
5291
|
-
permission:
|
|
5301
|
+
permission: "MANAGER_OR_ADMIN" /* MANAGER_OR_ADMIN */,
|
|
5292
5302
|
subItems: [
|
|
5293
5303
|
{
|
|
5294
5304
|
title: "Fluxos de Automa\xE7\xE3o",
|
|
5295
5305
|
url: routePaths.FLOWS,
|
|
5296
5306
|
icon: lucideReact.Workflow,
|
|
5297
|
-
permission:
|
|
5307
|
+
permission: "MANAGER_OR_ADMIN" /* MANAGER_OR_ADMIN */
|
|
5298
5308
|
},
|
|
5299
5309
|
{
|
|
5300
5310
|
title: "Credenciais",
|
|
5301
5311
|
url: routePaths.CREDENTIALS,
|
|
5302
5312
|
icon: lucideReact.Key,
|
|
5303
|
-
permission:
|
|
5313
|
+
permission: "MANAGER_OR_ADMIN" /* MANAGER_OR_ADMIN */
|
|
5304
5314
|
}
|
|
5305
5315
|
]
|
|
5306
5316
|
}
|
|
@@ -5313,8 +5323,9 @@ function ControlSidebar({
|
|
|
5313
5323
|
return () => clearInterval(timer);
|
|
5314
5324
|
}
|
|
5315
5325
|
}, [currentTime]);
|
|
5326
|
+
const resolvedMenuItems = menuItemsProp ?? defaultMenuItems;
|
|
5316
5327
|
const displayTime = currentTime || internalTime;
|
|
5317
|
-
const filteredMenuItems = filterMenuItems(
|
|
5328
|
+
const filteredMenuItems = filterMenuItems(resolvedMenuItems, user);
|
|
5318
5329
|
return /* @__PURE__ */ jsxRuntime.jsxs(Sidebar, { className: "border-r border-gray-200", collapsible: "icon", children: [
|
|
5319
5330
|
/* @__PURE__ */ jsxRuntime.jsxs(SidebarHeader, { className: "border-b border-gray-200", children: [
|
|
5320
5331
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex items-center justify-between px-2 py-2", children: /* @__PURE__ */ jsxRuntime.jsx(SidebarTrigger, { className: "ml-auto" }) }),
|
|
@@ -5500,7 +5511,8 @@ function MainLayout({
|
|
|
5500
5511
|
appSubtitle,
|
|
5501
5512
|
logoUrl,
|
|
5502
5513
|
faviconUrl,
|
|
5503
|
-
sidebarDefaultOpen
|
|
5514
|
+
sidebarDefaultOpen,
|
|
5515
|
+
menuItems
|
|
5504
5516
|
}) {
|
|
5505
5517
|
return /* @__PURE__ */ jsxRuntime.jsx(SidebarProvider, { defaultOpen: sidebarDefaultOpen, children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "h-screen w-full flex", children: [
|
|
5506
5518
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -5517,13 +5529,14 @@ function MainLayout({
|
|
|
5517
5529
|
appName,
|
|
5518
5530
|
appSubtitle,
|
|
5519
5531
|
logoUrl,
|
|
5520
|
-
faviconUrl
|
|
5532
|
+
faviconUrl,
|
|
5533
|
+
menuItems
|
|
5521
5534
|
}
|
|
5522
5535
|
),
|
|
5523
5536
|
/* @__PURE__ */ jsxRuntime.jsx("main", { className: "flex-1 overflow-hidden", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "h-full overflow-y-auto", children }) })
|
|
5524
5537
|
] }) });
|
|
5525
5538
|
}
|
|
5526
|
-
function ProtectedRoute({ children, useAuthContext, tenantId, useSSO, routePaths, useTenant, tenantService, onResetPassword, resetPasswordLoading, resetPasswordError, appName, appSubtitle, logoUrl, faviconUrl, sidebarDefaultOpen }) {
|
|
5539
|
+
function ProtectedRoute({ children, useAuthContext, tenantId, useSSO, routePaths, useTenant, tenantService, onResetPassword, resetPasswordLoading, resetPasswordError, appName, appSubtitle, logoUrl, faviconUrl, sidebarDefaultOpen, menuItems }) {
|
|
5527
5540
|
const { isAuthenticated, isLoading, logout, user, getCurrentTenantId } = useAuthContext();
|
|
5528
5541
|
const location = reactRouterDom.useLocation();
|
|
5529
5542
|
const sso = useSSO(tenantId || void 0);
|
|
@@ -5572,6 +5585,7 @@ function ProtectedRoute({ children, useAuthContext, tenantId, useSSO, routePaths
|
|
|
5572
5585
|
logoUrl,
|
|
5573
5586
|
faviconUrl,
|
|
5574
5587
|
sidebarDefaultOpen,
|
|
5588
|
+
menuItems,
|
|
5575
5589
|
children: /* @__PURE__ */ jsxRuntime.jsx(EnsureTenant, { useTenant, tenantService, children })
|
|
5576
5590
|
}
|
|
5577
5591
|
);
|
|
@@ -11993,6 +12007,7 @@ exports.Loading = Loading;
|
|
|
11993
12007
|
exports.MCPCategoryToNodeType = MCPCategoryToNodeType;
|
|
11994
12008
|
exports.MCPSubtypeToIcon = MCPSubtypeToIcon;
|
|
11995
12009
|
exports.MainLayout = MainLayout;
|
|
12010
|
+
exports.MenuPermissionLevel = MenuPermissionLevel;
|
|
11996
12011
|
exports.Menubar = Menubar;
|
|
11997
12012
|
exports.MenubarCheckboxItem = MenubarCheckboxItem;
|
|
11998
12013
|
exports.MenubarContent = MenubarContent;
|