@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.js CHANGED
@@ -42903,7 +42903,6 @@ var ProviderTab = () => {
42903
42903
  gatewayUrl: packageSettings?.gatewayApiUrl || "",
42904
42904
  provider: "bandit"
42905
42905
  });
42906
- const [isProviderConfigOpen, setIsProviderConfigOpen] = (0, import_react59.useState)(false);
42907
42906
  const [snackbarMessage, setSnackbarMessage] = (0, import_react59.useState)("");
42908
42907
  const [showSnackbar, setShowSnackbar] = (0, import_react59.useState)(false);
42909
42908
  const [snackbarSeverity, setSnackbarSeverity] = (0, import_react59.useState)("success");
@@ -43124,7 +43123,7 @@ var ProviderTab = () => {
43124
43123
  ] }) : /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(import_material49.Chip, { label: "No Provider Configured", color: "warning" })
43125
43124
  ] }),
43126
43125
  /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)(import_material49.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: [
43127
- /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)(
43126
+ /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
43128
43127
  import_material49.Box,
43129
43128
  {
43130
43129
  sx: {
@@ -43135,24 +43134,10 @@ var ProviderTab = () => {
43135
43134
  gap: { xs: 1, sm: 2 },
43136
43135
  mb: 2
43137
43136
  },
43138
- children: [
43139
- /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(import_material49.Typography, { variant: "h6", sx: { fontWeight: 600, color: "text.primary" }, children: "Provider Configuration" }),
43140
- /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)(
43141
- import_material49.Button,
43142
- {
43143
- variant: "outlined",
43144
- onClick: () => setIsProviderConfigOpen(!isProviderConfigOpen),
43145
- size: isMobile ? "small" : "medium",
43146
- children: [
43147
- isProviderConfigOpen ? "Hide" : "Configure",
43148
- " Provider"
43149
- ]
43150
- }
43151
- )
43152
- ]
43137
+ children: /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(import_material49.Typography, { variant: "overline", sx: { fontWeight: 700, color: "text.secondary", letterSpacing: 0.6 }, children: "Provider Configuration" })
43153
43138
  }
43154
43139
  ),
43155
- isProviderConfigOpen && /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)(import_material49.Box, { sx: { mt: 3 }, children: [
43140
+ /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)(import_material49.Box, { sx: { mt: 2 }, children: [
43156
43141
  /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)(
43157
43142
  import_material49.TextField,
43158
43143
  {
@@ -44904,47 +44889,58 @@ var Management = () => {
44904
44889
  {
44905
44890
  label: "Personalities",
44906
44891
  icon: /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(FaceRetouchingNaturalIcon, {}),
44907
- requiresFeature: "limitedAdminDashboard"
44908
- // Available to premium+
44892
+ requiresFeature: "limitedAdminDashboard",
44893
+ requiresAdmin: true
44909
44894
  },
44910
44895
  {
44911
44896
  label: "Branding",
44912
44897
  icon: /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(BrushIcon, {}),
44913
- requiresFeature: "limitedAdminDashboard"
44914
- // Available to premium+
44898
+ requiresFeature: "limitedAdminDashboard",
44899
+ requiresAdmin: true
44915
44900
  },
44916
44901
  {
44917
44902
  label: "Knowledge",
44918
44903
  icon: /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(MenuBookIcon, {}),
44919
- requiresFeature: "limitedAdminDashboard"
44920
- // Available to premium+
44904
+ requiresFeature: "limitedAdminDashboard",
44905
+ requiresAdmin: true
44921
44906
  },
44922
44907
  {
44923
44908
  label: "Storage",
44924
44909
  icon: /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(StorageIcon, {}),
44925
- requiresFeature: "limitedAdminDashboard"
44926
- // Available to premium+ (changed from adminDashboardEnabled)
44910
+ requiresFeature: "limitedAdminDashboard",
44911
+ requiresAdmin: true
44927
44912
  },
44928
44913
  {
44929
44914
  label: "Preferences",
44930
44915
  icon: /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(TuneIcon, {}),
44931
- requiresFeature: "limitedAdminDashboard"
44932
- // Available to premium+
44916
+ requiresFeature: "limitedAdminDashboard",
44917
+ requiresAdmin: false
44933
44918
  },
44934
44919
  {
44935
44920
  label: "Provider",
44936
44921
  icon: /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(CloudIcon, {}),
44937
- requiresFeature: "advancedSearch"
44938
- // Pro/Team users with advanced features
44922
+ requiresFeature: "advancedSearch",
44923
+ requiresAdmin: true
44939
44924
  },
44940
44925
  {
44941
44926
  label: "Tools",
44942
44927
  icon: /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(BuildIcon, {}),
44943
- requiresFeature: "advancedSearch"
44944
- // Pro/Team users with advanced features
44928
+ requiresFeature: "advancedSearch",
44929
+ requiresAdmin: true
44945
44930
  }
44946
44931
  ];
44932
+ const adminRoleNames = /* @__PURE__ */ new Set([
44933
+ "admin",
44934
+ "super-user",
44935
+ "superuser",
44936
+ "super_admin",
44937
+ "platform_admin",
44938
+ "tenant_admin"
44939
+ ]);
44940
+ const userRoles = (authenticationService.parseJwtClaims(authenticationService.getToken() ?? "")?.roles ?? []).map((r) => r.toLowerCase());
44941
+ const isWorkspaceAdmin = userRoles.some((r) => adminRoleNames.has(r) || r.endsWith("-admin"));
44947
44942
  const navTabs = allNavTabs.filter((tab) => {
44943
+ if (tab.requiresAdmin && !isWorkspaceAdmin) return false;
44948
44944
  if (tab.requiresFeature === "limitedAdminDashboard") {
44949
44945
  return hasLimitedAdminDashboard() || hasAdminDashboard();
44950
44946
  }