@burtson-labs/bandit-engine 2.0.112 → 2.0.114

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.mjs CHANGED
@@ -10,7 +10,7 @@ import {
10
10
  useGatewayHealth,
11
11
  useGatewayMemory,
12
12
  useGatewayModels
13
- } from "./chunk-PIBF62UY.mjs";
13
+ } from "./chunk-H3BUUAHU.mjs";
14
14
  import "./chunk-W2EPDR5G.mjs";
15
15
  import "./chunk-HAUDGBUS.mjs";
16
16
  import "./chunk-BN3D45E2.mjs";
@@ -42243,7 +42243,6 @@ var ProviderTab = () => {
42243
42243
  gatewayUrl: packageSettings?.gatewayApiUrl || "",
42244
42244
  provider: "bandit"
42245
42245
  });
42246
- const [isProviderConfigOpen, setIsProviderConfigOpen] = (0, import_react37.useState)(false);
42247
42246
  const [snackbarMessage, setSnackbarMessage] = (0, import_react37.useState)("");
42248
42247
  const [showSnackbar, setShowSnackbar] = (0, import_react37.useState)(false);
42249
42248
  const [snackbarSeverity, setSnackbarSeverity] = (0, import_react37.useState)("success");
@@ -42464,7 +42463,7 @@ var ProviderTab = () => {
42464
42463
  ] }) : /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_material29.Chip, { label: "No Provider Configured", color: "warning" })
42465
42464
  ] }),
42466
42465
  /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(import_material29.Paper, { sx: { p: { xs: 1.5, sm: 1.75 }, mb: { xs: 1.5, md: 1.75 }, bgcolor: "background.paper", border: "1px solid", borderColor: "divider", borderRadius: 2 }, children: [
42467
- /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
42466
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
42468
42467
  import_material29.Box,
42469
42468
  {
42470
42469
  sx: {
@@ -42475,24 +42474,10 @@ var ProviderTab = () => {
42475
42474
  gap: { xs: 1, sm: 2 },
42476
42475
  mb: 2
42477
42476
  },
42478
- children: [
42479
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_material29.Typography, { variant: "h6", sx: { fontWeight: 600, color: "text.primary" }, children: "Provider Configuration" }),
42480
- /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
42481
- import_material29.Button,
42482
- {
42483
- variant: "outlined",
42484
- onClick: () => setIsProviderConfigOpen(!isProviderConfigOpen),
42485
- size: isMobile ? "small" : "medium",
42486
- children: [
42487
- isProviderConfigOpen ? "Hide" : "Configure",
42488
- " Provider"
42489
- ]
42490
- }
42491
- )
42492
- ]
42477
+ children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_material29.Typography, { variant: "overline", sx: { fontWeight: 700, color: "text.secondary", letterSpacing: 0.6 }, children: "Provider Configuration" })
42493
42478
  }
42494
42479
  ),
42495
- isProviderConfigOpen && /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(import_material29.Box, { sx: { mt: 3 }, children: [
42480
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(import_material29.Box, { sx: { mt: 2 }, children: [
42496
42481
  /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
42497
42482
  import_material29.TextField,
42498
42483
  {
@@ -44244,47 +44229,58 @@ var Management = () => {
44244
44229
  {
44245
44230
  label: "Personalities",
44246
44231
  icon: /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(FaceRetouchingNaturalIcon, {}),
44247
- requiresFeature: "limitedAdminDashboard"
44248
- // Available to premium+
44232
+ requiresFeature: "limitedAdminDashboard",
44233
+ requiresAdmin: true
44249
44234
  },
44250
44235
  {
44251
44236
  label: "Branding",
44252
44237
  icon: /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(BrushIcon, {}),
44253
- requiresFeature: "limitedAdminDashboard"
44254
- // Available to premium+
44238
+ requiresFeature: "limitedAdminDashboard",
44239
+ requiresAdmin: true
44255
44240
  },
44256
44241
  {
44257
44242
  label: "Knowledge",
44258
44243
  icon: /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(MenuBookIcon, {}),
44259
- requiresFeature: "limitedAdminDashboard"
44260
- // Available to premium+
44244
+ requiresFeature: "limitedAdminDashboard",
44245
+ requiresAdmin: true
44261
44246
  },
44262
44247
  {
44263
44248
  label: "Storage",
44264
44249
  icon: /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(StorageIcon, {}),
44265
- requiresFeature: "limitedAdminDashboard"
44266
- // Available to premium+ (changed from adminDashboardEnabled)
44250
+ requiresFeature: "limitedAdminDashboard",
44251
+ requiresAdmin: true
44267
44252
  },
44268
44253
  {
44269
44254
  label: "Preferences",
44270
44255
  icon: /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(TuneIcon, {}),
44271
- requiresFeature: "limitedAdminDashboard"
44272
- // Available to premium+
44256
+ requiresFeature: "limitedAdminDashboard",
44257
+ requiresAdmin: false
44273
44258
  },
44274
44259
  {
44275
44260
  label: "Provider",
44276
44261
  icon: /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(CloudIcon, {}),
44277
- requiresFeature: "advancedSearch"
44278
- // Pro/Team users with advanced features
44262
+ requiresFeature: "advancedSearch",
44263
+ requiresAdmin: true
44279
44264
  },
44280
44265
  {
44281
44266
  label: "Tools",
44282
44267
  icon: /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(BuildIcon, {}),
44283
- requiresFeature: "advancedSearch"
44284
- // Pro/Team users with advanced features
44268
+ requiresFeature: "advancedSearch",
44269
+ requiresAdmin: true
44285
44270
  }
44286
44271
  ];
44272
+ const adminRoleNames = /* @__PURE__ */ new Set([
44273
+ "admin",
44274
+ "super-user",
44275
+ "superuser",
44276
+ "super_admin",
44277
+ "platform_admin",
44278
+ "tenant_admin"
44279
+ ]);
44280
+ const userRoles = (authenticationService.parseJwtClaims(authenticationService.getToken() ?? "")?.roles ?? []).map((r) => r.toLowerCase());
44281
+ const isWorkspaceAdmin = userRoles.some((r) => adminRoleNames.has(r) || r.endsWith("-admin"));
44287
44282
  const navTabs = allNavTabs.filter((tab) => {
44283
+ if (tab.requiresAdmin && !isWorkspaceAdmin) return false;
44288
44284
  if (tab.requiresFeature === "limitedAdminDashboard") {
44289
44285
  return hasLimitedAdminDashboard() || hasAdminDashboard();
44290
44286
  }