@iblai/iblai-js 1.0.34 → 1.0.35

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.
@@ -81486,7 +81486,7 @@ const renderLucideIcon = (Icon) => function RenderedIcon(props) {
81486
81486
  return jsx(Icon, { ...props });
81487
81487
  };
81488
81488
  function Profile({ tenant, username, onClose, customization = {}, isAdmin = false, targetTab = 'basic', onAccountDeleted, localLLMProps, }) {
81489
- var _a, _b;
81489
+ var _a, _b, _c;
81490
81490
  console.log('[Profile] localLLMProps received:', {
81491
81491
  isAvailable: localLLMProps === null || localLLMProps === void 0 ? void 0 : localLLMProps.isAvailable,
81492
81492
  foundryStatus: localLLMProps === null || localLLMProps === void 0 ? void 0 : localLLMProps.foundryStatus,
@@ -81549,7 +81549,10 @@ function Profile({ tenant, username, onClose, customization = {}, isAdmin = fals
81549
81549
  return (jsxs("div", { className: "flex flex-col lg:flex-row h-full", children: [jsx("div", { className: "lg:hidden", children: jsx("div", { className: "px-6 py-4 border-b border-gray-200", children: jsx("h2", { className: "text-lg font-semibold text-gray-900", children: "Profile" }) }) }), jsxs("div", { className: "hidden lg:flex bg-white border-r border-gray-200 dark:border-gray-700 flex-col overflow-hidden", style: {
81550
81550
  width: '320px',
81551
81551
  height: '100%',
81552
- }, children: [jsxs("div", { className: "flex flex-col items-center justify-center py-8 px-6 border-b border-gray-200 dark:border-gray-700 flex-shrink-0", children: [isUserMetadataEdxLoading || isUploadingProfileImage ? (jsx(Skeleton, { className: "h-20 w-20 mb-6 rounded-full", "aria-label": "Loading profile image" })) : (jsxs("button", { type: "button", className: "relative w-20 h-20 mb-6 cursor-pointer group rounded-full focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2", onMouseEnter: () => setIsHovering(true), onMouseLeave: () => setIsHovering(false), onClick: handleAvatarClick, "aria-label": "Upload profile picture", children: [jsxs(Avatar, { className: "h-20 w-20", children: [((_a = userMetadataEdx === null || userMetadataEdx === void 0 ? void 0 : userMetadataEdx.profile_image) === null || _a === void 0 ? void 0 : _a.has_image) ? (jsx(AvatarImage, { src: (_b = userMetadataEdx === null || userMetadataEdx === void 0 ? void 0 : userMetadataEdx.profile_image) === null || _b === void 0 ? void 0 : _b.image_url_full, alt: "Profile picture", className: "rounded-full object-cover w-full h-full group-hover:opacity-80 transition-opacity" })) : customization.useGravatarPicFallback ? (jsx(Gravatar$1, { className: "w-full h-full rounded-full object-cover group-hover:opacity-80 transition-opacity", email: userMetadata === null || userMetadata === void 0 ? void 0 : userMetadata.email, size: 80, alt: "Profile picture from Gravatar" })) : (jsx(Fragment$1, {})), jsx(AvatarFallback, { className: "bg-blue-800 text-white text-xl rounded-full", children: getInitials((userMetadata === null || userMetadata === void 0 ? void 0 : userMetadata.name) || (userMetadata === null || userMetadata === void 0 ? void 0 : userMetadata.username) || (userMetadata === null || userMetadata === void 0 ? void 0 : userMetadata.email) || '') })] }), isHovering && (jsx("div", { className: "absolute inset-0 flex items-center justify-center bg-blue-800 rounded-full border-4 border-white/20", "aria-hidden": "true", children: jsx("span", { className: "text-white text-xs font-medium text-center px-2", children: "Upload" }) })), jsx("input", { ref: fileInputRef, type: "file", accept: "image/*", onChange: handleFileUpload, className: "hidden", "aria-label": "Choose profile picture to upload", tabIndex: -1 })] })), jsxs("h2", { className: "text-xl font-semibold text-gray-900 dark:text-gray-100 text-center mb-4", children: [userMetadata === null || userMetadata === void 0 ? void 0 : userMetadata.name, customization.showUsernameField && `, ${userMetadata === null || userMetadata === void 0 ? void 0 : userMetadata.username}`] }), jsxs("div", { className: "flex justify-center space-x-3", children: [jsxs("div", { className: "bg-blue-100 text-blue-700 px-2 py-1 rounded font-medium flex items-center text-sm", children: [jsx(RoleIcon, { className: "h-4 w-4 mr-2", "aria-hidden": "true" }), jsx("span", { children: isAdmin ? 'Admin' : 'Student' })] }), customization.showPlatformName && (jsx("div", { className: "bg-gray-100 text-gray-600 px-4 py-2 rounded text-xs font-medium", children: tenant.toUpperCase() }))] })] }), jsx("nav", { className: "flex-1 overflow-y-auto", style: { minHeight: 0 }, "aria-label": "Profile tabs", children: jsx("div", { className: "p-4", children: jsx("div", { className: "flex flex-col space-y-2", role: "tablist", "aria-orientation": "vertical", children: TABS.map((tab) => (jsxs("button", { role: "tab", "aria-selected": activeTab === tab.id, "aria-controls": `${tab.id}-tabpanel`, id: `${tab.id}-tab`, onClick: () => setActiveTab(tab.id), className: `w-full justify-start px-4 py-3 text-left rounded-lg transition-all flex items-center text-base ${activeTab === tab.id
81552
+ }, children: [jsxs("div", { className: "flex flex-col items-center justify-center py-8 px-6 border-b border-gray-200 dark:border-gray-700 flex-shrink-0", children: [isUserMetadataEdxLoading || isUploadingProfileImage ? (jsx(Skeleton, { className: "h-20 w-20 mb-6 rounded-full", "aria-label": "Loading profile image" })) : (jsxs("button", { type: "button", className: "relative w-20 h-20 mb-6 cursor-pointer group rounded-full focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2", onMouseEnter: () => setIsHovering(true), onMouseLeave: () => setIsHovering(false), onClick: handleAvatarClick, "aria-label": "Upload profile picture", children: [jsxs(Avatar, { className: "h-20 w-20", children: [((_a = userMetadataEdx === null || userMetadataEdx === void 0 ? void 0 : userMetadataEdx.profile_image) === null || _a === void 0 ? void 0 : _a.has_image) ? (jsx(AvatarImage, { src: (_b = userMetadataEdx === null || userMetadataEdx === void 0 ? void 0 : userMetadataEdx.profile_image) === null || _b === void 0 ? void 0 : _b.image_url_full, alt: "Profile picture", className: "rounded-full object-cover w-full h-full group-hover:opacity-80 transition-opacity" })) : customization.useGravatarPicFallback ? (jsx(Gravatar$1, { className: "w-full h-full rounded-full object-cover group-hover:opacity-80 transition-opacity", email: userMetadata === null || userMetadata === void 0 ? void 0 : userMetadata.email, size: 80, alt: "Profile picture from Gravatar" })) : (jsx(Fragment$1, {})), jsx(AvatarFallback, { className: cn('bg-blue-800 text-white text-xl rounded-full', customization.useGravatarPicFallback &&
81553
+ !((_c = userMetadataEdx === null || userMetadataEdx === void 0 ? void 0 : userMetadataEdx.profile_image) === null || _c === void 0 ? void 0 : _c.image_url_full)
81554
+ ? 'hidden'
81555
+ : ''), children: getInitials((userMetadata === null || userMetadata === void 0 ? void 0 : userMetadata.name) || (userMetadata === null || userMetadata === void 0 ? void 0 : userMetadata.username) || (userMetadata === null || userMetadata === void 0 ? void 0 : userMetadata.email) || '') })] }), isHovering && (jsx("div", { className: "absolute inset-0 flex items-center justify-center bg-blue-800 rounded-full border-4 border-white/20", "aria-hidden": "true", children: jsx("span", { className: "text-white text-xs font-medium text-center px-2", children: "Upload" }) })), jsx("input", { ref: fileInputRef, type: "file", accept: "image/*", onChange: handleFileUpload, className: "hidden", "aria-label": "Choose profile picture to upload", tabIndex: -1 })] })), jsxs("h2", { className: "text-xl font-semibold text-gray-900 dark:text-gray-100 text-center mb-4", children: [userMetadata === null || userMetadata === void 0 ? void 0 : userMetadata.name, customization.showUsernameField && `, ${userMetadata === null || userMetadata === void 0 ? void 0 : userMetadata.username}`] }), jsxs("div", { className: "flex justify-center space-x-3", children: [jsxs("div", { className: "bg-blue-100 text-blue-700 px-2 py-1 rounded font-medium flex items-center text-sm", children: [jsx(RoleIcon, { className: "h-4 w-4 mr-2", "aria-hidden": "true" }), jsx("span", { children: isAdmin ? 'Admin' : 'Student' })] }), customization.showPlatformName && (jsx("div", { className: "bg-gray-100 text-gray-600 px-4 py-2 rounded text-xs font-medium", children: tenant.toUpperCase() }))] })] }), jsx("nav", { className: "flex-1 overflow-y-auto", style: { minHeight: 0 }, "aria-label": "Profile tabs", children: jsx("div", { className: "p-4", children: jsx("div", { className: "flex flex-col space-y-2", role: "tablist", "aria-orientation": "vertical", children: TABS.map((tab) => (jsxs("button", { role: "tab", "aria-selected": activeTab === tab.id, "aria-controls": `${tab.id}-tabpanel`, id: `${tab.id}-tab`, onClick: () => setActiveTab(tab.id), className: `w-full justify-start px-4 py-3 text-left rounded-lg transition-all flex items-center text-base ${activeTab === tab.id
81553
81556
  ? 'bg-blue-50 text-blue-700 font-medium'
81554
81557
  : 'hover:bg-gray-50 text-gray-700 dark:text-gray-300 hover:text-gray-900 dark:hover:text-gray-100'}`, children: [jsx(tab.renderIcon, { className: "h-5 w-5 mr-3 flex-shrink-0", "aria-hidden": "true" }), jsx("span", { className: "truncate", children: tab.label })] }, tab.id))) }) }) })] }), jsx("nav", { className: "lg:hidden", "aria-label": "Profile tabs mobile", children: jsx("div", { className: "w-full justify-start px-6 py-2 bg-white border-b border-gray-200 rounded-none h-auto overflow-x-auto", children: jsx("div", { className: "flex space-x-2", role: "tablist", "aria-orientation": "horizontal", children: TABS.map((tab) => (jsxs("button", { role: "tab", "aria-selected": activeTab === tab.id, "aria-controls": `${tab.id}-tabpanel`, id: `${tab.id}-tab-mobile`, onClick: () => setActiveTab(tab.id), className: `flex items-center gap-2 px-3 py-2 rounded-lg whitespace-nowrap text-sm transition-all ${activeTab === tab.id
81555
81558
  ? 'bg-blue-50 text-blue-600 font-medium'
@@ -81626,7 +81626,7 @@ const renderLucideIcon = (Icon) => function RenderedIcon(props) {
81626
81626
  return jsx(Icon, { ...props });
81627
81627
  };
81628
81628
  function Profile({ tenant, username, onClose, customization = {}, isAdmin = false, targetTab = 'basic', onAccountDeleted, localLLMProps, }) {
81629
- var _a, _b;
81629
+ var _a, _b, _c;
81630
81630
  console.log('[Profile] localLLMProps received:', {
81631
81631
  isAvailable: localLLMProps === null || localLLMProps === void 0 ? void 0 : localLLMProps.isAvailable,
81632
81632
  foundryStatus: localLLMProps === null || localLLMProps === void 0 ? void 0 : localLLMProps.foundryStatus,
@@ -81689,7 +81689,10 @@ function Profile({ tenant, username, onClose, customization = {}, isAdmin = fals
81689
81689
  return (jsxs("div", { className: "flex flex-col lg:flex-row h-full", children: [jsx("div", { className: "lg:hidden", children: jsx("div", { className: "px-6 py-4 border-b border-gray-200", children: jsx("h2", { className: "text-lg font-semibold text-gray-900", children: "Profile" }) }) }), jsxs("div", { className: "hidden lg:flex bg-white border-r border-gray-200 dark:border-gray-700 flex-col overflow-hidden", style: {
81690
81690
  width: '320px',
81691
81691
  height: '100%',
81692
- }, children: [jsxs("div", { className: "flex flex-col items-center justify-center py-8 px-6 border-b border-gray-200 dark:border-gray-700 flex-shrink-0", children: [isUserMetadataEdxLoading || isUploadingProfileImage ? (jsx(Skeleton, { className: "h-20 w-20 mb-6 rounded-full", "aria-label": "Loading profile image" })) : (jsxs("button", { type: "button", className: "relative w-20 h-20 mb-6 cursor-pointer group rounded-full focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2", onMouseEnter: () => setIsHovering(true), onMouseLeave: () => setIsHovering(false), onClick: handleAvatarClick, "aria-label": "Upload profile picture", children: [jsxs(Avatar, { className: "h-20 w-20", children: [((_a = userMetadataEdx === null || userMetadataEdx === void 0 ? void 0 : userMetadataEdx.profile_image) === null || _a === void 0 ? void 0 : _a.has_image) ? (jsx(AvatarImage, { src: (_b = userMetadataEdx === null || userMetadataEdx === void 0 ? void 0 : userMetadataEdx.profile_image) === null || _b === void 0 ? void 0 : _b.image_url_full, alt: "Profile picture", className: "rounded-full object-cover w-full h-full group-hover:opacity-80 transition-opacity" })) : customization.useGravatarPicFallback ? (jsx(Gravatar$1, { className: "w-full h-full rounded-full object-cover group-hover:opacity-80 transition-opacity", email: userMetadata === null || userMetadata === void 0 ? void 0 : userMetadata.email, size: 80, alt: "Profile picture from Gravatar" })) : (jsx(Fragment$1, {})), jsx(AvatarFallback, { className: "bg-blue-800 text-white text-xl rounded-full", children: getInitials((userMetadata === null || userMetadata === void 0 ? void 0 : userMetadata.name) || (userMetadata === null || userMetadata === void 0 ? void 0 : userMetadata.username) || (userMetadata === null || userMetadata === void 0 ? void 0 : userMetadata.email) || '') })] }), isHovering && (jsx("div", { className: "absolute inset-0 flex items-center justify-center bg-blue-800 rounded-full border-4 border-white/20", "aria-hidden": "true", children: jsx("span", { className: "text-white text-xs font-medium text-center px-2", children: "Upload" }) })), jsx("input", { ref: fileInputRef, type: "file", accept: "image/*", onChange: handleFileUpload, className: "hidden", "aria-label": "Choose profile picture to upload", tabIndex: -1 })] })), jsxs("h2", { className: "text-xl font-semibold text-gray-900 dark:text-gray-100 text-center mb-4", children: [userMetadata === null || userMetadata === void 0 ? void 0 : userMetadata.name, customization.showUsernameField && `, ${userMetadata === null || userMetadata === void 0 ? void 0 : userMetadata.username}`] }), jsxs("div", { className: "flex justify-center space-x-3", children: [jsxs("div", { className: "bg-blue-100 text-blue-700 px-2 py-1 rounded font-medium flex items-center text-sm", children: [jsx(RoleIcon, { className: "h-4 w-4 mr-2", "aria-hidden": "true" }), jsx("span", { children: isAdmin ? 'Admin' : 'Student' })] }), customization.showPlatformName && (jsx("div", { className: "bg-gray-100 text-gray-600 px-4 py-2 rounded text-xs font-medium", children: tenant.toUpperCase() }))] })] }), jsx("nav", { className: "flex-1 overflow-y-auto", style: { minHeight: 0 }, "aria-label": "Profile tabs", children: jsx("div", { className: "p-4", children: jsx("div", { className: "flex flex-col space-y-2", role: "tablist", "aria-orientation": "vertical", children: TABS.map((tab) => (jsxs("button", { role: "tab", "aria-selected": activeTab === tab.id, "aria-controls": `${tab.id}-tabpanel`, id: `${tab.id}-tab`, onClick: () => setActiveTab(tab.id), className: `w-full justify-start px-4 py-3 text-left rounded-lg transition-all flex items-center text-base ${activeTab === tab.id
81692
+ }, children: [jsxs("div", { className: "flex flex-col items-center justify-center py-8 px-6 border-b border-gray-200 dark:border-gray-700 flex-shrink-0", children: [isUserMetadataEdxLoading || isUploadingProfileImage ? (jsx(Skeleton, { className: "h-20 w-20 mb-6 rounded-full", "aria-label": "Loading profile image" })) : (jsxs("button", { type: "button", className: "relative w-20 h-20 mb-6 cursor-pointer group rounded-full focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2", onMouseEnter: () => setIsHovering(true), onMouseLeave: () => setIsHovering(false), onClick: handleAvatarClick, "aria-label": "Upload profile picture", children: [jsxs(Avatar, { className: "h-20 w-20", children: [((_a = userMetadataEdx === null || userMetadataEdx === void 0 ? void 0 : userMetadataEdx.profile_image) === null || _a === void 0 ? void 0 : _a.has_image) ? (jsx(AvatarImage, { src: (_b = userMetadataEdx === null || userMetadataEdx === void 0 ? void 0 : userMetadataEdx.profile_image) === null || _b === void 0 ? void 0 : _b.image_url_full, alt: "Profile picture", className: "rounded-full object-cover w-full h-full group-hover:opacity-80 transition-opacity" })) : customization.useGravatarPicFallback ? (jsx(Gravatar$1, { className: "w-full h-full rounded-full object-cover group-hover:opacity-80 transition-opacity", email: userMetadata === null || userMetadata === void 0 ? void 0 : userMetadata.email, size: 80, alt: "Profile picture from Gravatar" })) : (jsx(Fragment$1, {})), jsx(AvatarFallback, { className: cn('bg-blue-800 text-white text-xl rounded-full', customization.useGravatarPicFallback &&
81693
+ !((_c = userMetadataEdx === null || userMetadataEdx === void 0 ? void 0 : userMetadataEdx.profile_image) === null || _c === void 0 ? void 0 : _c.image_url_full)
81694
+ ? 'hidden'
81695
+ : ''), children: getInitials((userMetadata === null || userMetadata === void 0 ? void 0 : userMetadata.name) || (userMetadata === null || userMetadata === void 0 ? void 0 : userMetadata.username) || (userMetadata === null || userMetadata === void 0 ? void 0 : userMetadata.email) || '') })] }), isHovering && (jsx("div", { className: "absolute inset-0 flex items-center justify-center bg-blue-800 rounded-full border-4 border-white/20", "aria-hidden": "true", children: jsx("span", { className: "text-white text-xs font-medium text-center px-2", children: "Upload" }) })), jsx("input", { ref: fileInputRef, type: "file", accept: "image/*", onChange: handleFileUpload, className: "hidden", "aria-label": "Choose profile picture to upload", tabIndex: -1 })] })), jsxs("h2", { className: "text-xl font-semibold text-gray-900 dark:text-gray-100 text-center mb-4", children: [userMetadata === null || userMetadata === void 0 ? void 0 : userMetadata.name, customization.showUsernameField && `, ${userMetadata === null || userMetadata === void 0 ? void 0 : userMetadata.username}`] }), jsxs("div", { className: "flex justify-center space-x-3", children: [jsxs("div", { className: "bg-blue-100 text-blue-700 px-2 py-1 rounded font-medium flex items-center text-sm", children: [jsx(RoleIcon, { className: "h-4 w-4 mr-2", "aria-hidden": "true" }), jsx("span", { children: isAdmin ? 'Admin' : 'Student' })] }), customization.showPlatformName && (jsx("div", { className: "bg-gray-100 text-gray-600 px-4 py-2 rounded text-xs font-medium", children: tenant.toUpperCase() }))] })] }), jsx("nav", { className: "flex-1 overflow-y-auto", style: { minHeight: 0 }, "aria-label": "Profile tabs", children: jsx("div", { className: "p-4", children: jsx("div", { className: "flex flex-col space-y-2", role: "tablist", "aria-orientation": "vertical", children: TABS.map((tab) => (jsxs("button", { role: "tab", "aria-selected": activeTab === tab.id, "aria-controls": `${tab.id}-tabpanel`, id: `${tab.id}-tab`, onClick: () => setActiveTab(tab.id), className: `w-full justify-start px-4 py-3 text-left rounded-lg transition-all flex items-center text-base ${activeTab === tab.id
81693
81696
  ? 'bg-blue-50 text-blue-700 font-medium'
81694
81697
  : 'hover:bg-gray-50 text-gray-700 dark:text-gray-300 hover:text-gray-900 dark:hover:text-gray-100'}`, children: [jsx(tab.renderIcon, { className: "h-5 w-5 mr-3 flex-shrink-0", "aria-hidden": "true" }), jsx("span", { className: "truncate", children: tab.label })] }, tab.id))) }) }) })] }), jsx("nav", { className: "lg:hidden", "aria-label": "Profile tabs mobile", children: jsx("div", { className: "w-full justify-start px-6 py-2 bg-white border-b border-gray-200 rounded-none h-auto overflow-x-auto", children: jsx("div", { className: "flex space-x-2", role: "tablist", "aria-orientation": "horizontal", children: TABS.map((tab) => (jsxs("button", { role: "tab", "aria-selected": activeTab === tab.id, "aria-controls": `${tab.id}-tabpanel`, id: `${tab.id}-tab-mobile`, onClick: () => setActiveTab(tab.id), className: `flex items-center gap-2 px-3 py-2 rounded-lg whitespace-nowrap text-sm transition-all ${activeTab === tab.id
81695
81698
  ? 'bg-blue-50 text-blue-600 font-medium'
@@ -113573,14 +113576,14 @@ function UsersTab({ tenant, onInviteClick }) {
113573
113576
  const userData = isResultsWithPolicies
113574
113577
  ? (users === null || users === void 0 ? void 0 : users.results).data
113575
113578
  : [];
113576
- return (jsxs("div", { className: "mt-4", children: [jsxs("div", { className: "flex justify-between items-center gap-1", children: [jsxs("div", { className: "relative mb-6 max-w-sm", children: [jsx(Search, { className: "absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-gray-400" }), jsx(Input, { type: "text", value: searchQuery, onChange: (event) => setQuerySearch(event.target.value), placeholder: "Search Users", className: "pl-10 pr-10 focus:ring-blue-500 focus:border-blue-500 h-[35px]", "aria-label": "Search users" }), searchQuery.length > 0 && (searchQuery !== debouncedSearchQuery || isLoading) && (jsx(LoaderCircle, { "data-testid": "search-spinner", className: "absolute right-3 top-1/2 -translate-y-1/2 h-4 w-4 text-gray-400 animate-spin", "aria-hidden": "true" }))] }), jsx("div", { className: "mb-6", children: jsx(Button$1, { className: "bg-gradient-to-r from-[#2563EB] to-[#93C5FD] hover:opacity-90 text-white h-[35px]", onClick: onInviteClick, children: "Invite" }) })] }), isLoading ? (jsx("div", { className: "flex justify-center items-center h-64", children: jsx(Spinner, {}) })) : (jsxs(Fragment$1, { children: [jsxs("div", { className: "bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg overflow-hidden", children: [jsxs("div", { className: "hidden lg:grid grid-cols-12 bg-gray-50 dark:bg-gray-700 px-6 py-3 text-sm font-medium text-gray-500 dark:text-gray-400 border-b border-gray-200 dark:border-gray-600 gap-4", children: [jsx("div", { className: "col-span-2", children: "Name" }), jsx("div", { className: "col-span-3", children: "Email" }), jsx("div", { className: "col-span-2", children: "Role" }), jsx("div", { className: "col-span-3", children: "Policies" }), jsx("div", { className: "col-span-2" })] }), jsxs("div", { className: "divide-y divide-gray-200 dark:divide-gray-600", children: [userData.map((user, index) => (jsxs("div", { className: "grid grid-cols-1 lg:grid-cols-12 px-6 py-4 gap-2 lg:gap-4 lg:items-center", children: [jsx("div", { className: "lg:hidden text-xs text-gray-500 dark:text-gray-400 font-medium", children: "Name" }), jsx("div", { "aria-label": 'user-management-name-column', className: "text-gray-900 dark:text-gray-100 font-medium lg:font-normal text-sm whitespace-nowrap overflow-hidden text-ellipsis lg:col-span-2", children: user.name }), jsx("div", { className: "lg:hidden text-xs text-gray-500 dark:text-gray-400 font-medium mt-2", children: "Email" }), jsx("div", { "aria-label": 'user-management-email-column', className: "text-gray-600 dark:text-gray-300 text-sm whitespace-nowrap overflow-hidden text-ellipsis lg:col-span-3", children: user.email }), jsxs("div", { className: "flex justify-between items-center mt-2 lg:mt-0 lg:justify-end lg:col-span-2", children: [jsx("div", { className: "lg:hidden text-xs text-gray-500 dark:text-gray-400 font-medium", children: "Role" }), jsxs(Select$1, { value: user.is_admin ? 'admin' : 'student', onValueChange: () => handleUserRoleChange(user), children: [jsx(SelectTrigger, { className: "w-32 sm:w-full text-sm", children: jsx(SelectValue, {}) }), jsxs(SelectContent, { className: "text-sm", children: [jsx(SelectItem, { value: "admin", children: "Admin" }), jsx(SelectItem, { value: "student", children: "Student" })] })] })] }), jsxs("div", { className: "flex justify-between items-center mt-2 lg:mt-0 lg:col-span-3", children: [jsx("div", { className: "lg:hidden text-xs text-gray-500 dark:text-gray-400 font-medium", children: "Policies" }), jsxs(Popover, { modal: true, open: openPolicyPopover === user.user_id, onOpenChange: (open) => setOpenPolicyPopover(open ? user.user_id : null), children: [jsx(PopoverTrigger, { asChild: true, children: jsxs(Button$1, { variant: "outline", role: "combobox", "aria-expanded": openPolicyPopover === user.user_id, "aria-label": `Select policies for ${user.name}`, className: "w-full justify-between text-sm h-9 font-normal", disabled: updatingUserIds.has(user === null || user === void 0 ? void 0 : user.user_id), children: [jsx("span", { className: "truncate", children: user.is_admin
113579
+ return (jsxs("div", { className: "mt-4", children: [jsxs("div", { className: "flex justify-between items-center gap-1", children: [jsxs("div", { className: "relative mb-6 max-w-sm", children: [jsx(Search, { className: "absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-gray-400" }), jsx(Input, { type: "text", value: searchQuery, onChange: (event) => setQuerySearch(event.target.value), placeholder: "Search Users", className: "pl-10 pr-10 focus:ring-blue-500 focus:border-blue-500 h-[35px]", "aria-label": "Search users" }), searchQuery.length > 0 && (searchQuery !== debouncedSearchQuery || isLoading) && (jsx(LoaderCircle, { "data-testid": "search-spinner", className: "absolute right-3 top-1/2 -translate-y-1/2 h-4 w-4 text-gray-400 animate-spin", "aria-hidden": "true" }))] }), jsx("div", { className: "mb-6", children: jsx(Button$1, { className: "bg-gradient-to-r from-[#2563EB] to-[#93C5FD] hover:opacity-90 text-white h-[35px]", onClick: onInviteClick, children: "Invite" }) })] }), isLoading ? (jsx("div", { className: "flex justify-center items-center h-64", children: jsx(Spinner, {}) })) : (jsxs(Fragment$1, { children: [jsx("div", { className: "bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg overflow-x-auto", children: jsxs("table", { className: "w-full text-sm", children: [jsx("thead", { className: "bg-gray-50 dark:bg-gray-700 border-b border-gray-200 dark:border-gray-600", children: jsxs("tr", { children: [jsx("th", { className: "px-6 py-3 text-left font-medium text-gray-500 dark:text-gray-400 w-[16%]", children: "Name" }), jsx("th", { className: "px-6 py-3 text-left font-medium text-gray-500 dark:text-gray-400 w-[25%]", children: "Email" }), jsx("th", { className: "px-6 py-3 text-left font-medium text-gray-500 dark:text-gray-400 w-[16%]", children: "Role" }), jsx("th", { className: "px-6 py-3 text-left font-medium text-gray-500 dark:text-gray-400 w-[25%]", children: "Policies" }), jsx("th", { className: "px-6 py-3 text-left font-medium text-gray-500 dark:text-gray-400 w-[18%]", children: "Status" })] }) }), jsxs("tbody", { className: "divide-y divide-gray-200 dark:divide-gray-600", children: [userData.map((user, index) => (jsxs("tr", { children: [jsx("td", { "aria-label": 'user-management-name-column', className: "px-6 py-4 text-gray-900 dark:text-gray-100 text-sm whitespace-nowrap overflow-hidden text-ellipsis max-w-0", children: jsx("div", { className: "truncate", children: user.name }) }), jsx("td", { "aria-label": 'user-management-email-column', className: "px-6 py-4 text-gray-600 dark:text-gray-300 text-sm max-w-0", children: jsx("div", { className: "truncate", children: user.email }) }), jsx("td", { className: "px-6 py-4", children: jsxs(Select$1, { value: user.is_admin ? 'admin' : 'student', onValueChange: () => handleUserRoleChange(user), children: [jsx(SelectTrigger, { className: "w-full text-sm", children: jsx(SelectValue, {}) }), jsxs(SelectContent, { className: "text-sm", children: [jsx(SelectItem, { value: "admin", children: "Admin" }), jsx(SelectItem, { value: "student", children: "Student" })] })] }) }), jsx("td", { className: "px-6 py-4", children: jsxs(Popover, { modal: true, open: openPolicyPopover === user.user_id, onOpenChange: (open) => setOpenPolicyPopover(open ? user.user_id : null), children: [jsx(PopoverTrigger, { asChild: true, children: jsxs(Button$1, { variant: "outline", role: "combobox", "aria-expanded": openPolicyPopover === user.user_id, "aria-label": `Select policies for ${user.name}`, className: "w-full justify-between text-sm h-9 font-normal", disabled: updatingUserIds.has(user === null || user === void 0 ? void 0 : user.user_id), children: [jsx("span", { className: "truncate", children: user.is_admin
113577
113580
  ? `All (${allowedPolicies.length}) selected`
113578
113581
  : user.policies && user.policies.length > 0
113579
113582
  ? `${user.policies.length} selected`
113580
113583
  : 'No policies' }), openPolicyPopover === user.user_id ? (jsx(ChevronUp, { className: "ml-2 h-4 w-4 shrink-0 opacity-50" })) : (jsx(ChevronDown, { className: "ml-2 h-4 w-4 shrink-0 opacity-50" }))] }) }), jsx(PopoverContent, { className: "w-64 p-3", align: "start", children: jsxs("div", { className: "space-y-2", children: [jsx("div", { className: "text-sm font-medium mb-2", children: "Select Policies" }), allowedPolicies.map((policy) => {
113581
113584
  var _a;
113582
113585
  return (jsxs("div", { className: "flex items-center space-x-2", children: [jsx(Checkbox, { id: `${user.user_id}-${policy}`, checked: user.is_admin || ((_a = user.policies) === null || _a === void 0 ? void 0 : _a.includes(policy)), onCheckedChange: (checked) => handlePolicyChange(user, policy, checked), disabled: user.is_admin || updatingUserIds.has(user === null || user === void 0 ? void 0 : user.user_id), "aria-label": `Toggle ${policy} for ${user.name}` }), jsx("label", { htmlFor: `${user.user_id}-${policy}`, className: `text-sm font-normal ${user.is_admin ? 'cursor-default' : 'cursor-pointer'}`, children: policy })] }, policy));
113583
- })] }) })] })] }), jsxs("div", { className: "flex justify-between items-center mt-2 lg:mt-0 lg:justify-end lg:col-span-2", children: [jsx("div", { className: "lg:hidden text-xs text-gray-500 dark:text-gray-400 font-medium", children: "Status" }), jsx(Switch, { checked: user.active, onCheckedChange: (checked) => handleUserStatusChange(user, checked), disabled: updatingUserIds.has(user === null || user === void 0 ? void 0 : user.user_id), "aria-label": `Toggle user status for ${user.name}`, className: "cursor-pointer data-[state=checked]:bg-blue-500 disabled:cursor-not-allowed disabled:opacity-50" })] })] }, index))), (!userData || userData.length === 0) && (jsx("div", { className: "px-6 py-8 text-center text-gray-500 dark:text-gray-400", children: "No users found" }))] })] }), jsx("div", { className: "mt-6", children: jsx(AdvancedPagination, { totalPages: totalPages, currentPage: page, onPageChange: (_page) => handlePageChange(_page) }) })] }))] }));
113586
+ })] }) })] }) }), jsx("td", { className: "px-6 py-4", children: jsx(Switch, { checked: user.active, onCheckedChange: (checked) => handleUserStatusChange(user, checked), disabled: updatingUserIds.has(user === null || user === void 0 ? void 0 : user.user_id), "aria-label": `Toggle user status for ${user.name}`, className: "cursor-pointer data-[state=checked]:bg-blue-500 disabled:cursor-not-allowed disabled:opacity-50" }) })] }, index))), (!userData || userData.length === 0) && (jsx("tr", { children: jsx("td", { colSpan: 5, className: "px-6 py-8 text-center text-gray-500 dark:text-gray-400", children: "No users found" }) }))] })] }) }), jsx("div", { className: "mt-6", children: jsx(AdvancedPagination, { totalPages: totalPages, currentPage: page, onPageChange: (_page) => handlePageChange(_page) }) })] }))] }));
113584
113587
  }
113585
113588
 
113586
113589
  // Permission options for teams access
@@ -114157,9 +114160,9 @@ function GroupsTab({ tenant, isTeam = false, hasInviteUserPermission = false, ha
114157
114160
  setShareTeamName(g.name);
114158
114161
  setIsSharePanelOpen(true);
114159
114162
  }
114160
- return (jsxs("div", { className: "mt-4", children: [jsxs("div", { className: "flex justify-between items-center gap-1 mb-6", children: [jsxs("div", { className: "relative max-w-sm", children: [jsx(Search, { className: "absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-gray-400" }), jsx(Input, { value: searchQuery, onChange: (e) => setSearchQuery(e.target.value), placeholder: isTeam ? 'Search teams' : 'Search groups', "aria-label": isTeam ? 'Search teams' : 'Search groups', className: "pl-10 pr-10 focus:ring-blue-500 focus:border-blue-500 h-[35px]" }), isLoading && (jsx(LoaderCircle, { "data-testid": "search-spinner", className: "absolute right-3 top-1/2 -translate-y-1/2 h-4 w-4 text-gray-400 animate-spin", "aria-hidden": "true" }))] }), jsxs("div", { className: "flex gap-2", children: [isTeam && hasInviteUserPermission && onInviteClick && (jsx(Button$1, { onClick: onInviteClick, "aria-label": "Invite users", className: "bg-gradient-to-r from-[#2563EB] to-[#93C5FD] hover:opacity-90 text-white h-[35px]", children: "Invite" })), isTeam ? (hasCreateTeamPermission && (jsx(Button$1, { onClick: openNew, "aria-label": "New team", className: "bg-gradient-to-r from-[#2563EB] to-[#93C5FD] hover:opacity-90 text-white h-[35px]", children: "New Team" }))) : (jsx(Button$1, { onClick: openNew, "aria-label": "New group", className: "bg-gradient-to-r from-[#2563EB] to-[#93C5FD] hover:opacity-90 text-white h-[35px]", children: "New Group" }))] })] }), isLoading && (jsx("div", { className: "flex justify-center items-center h-64", children: jsx("div", { className: "py-8 text-center text-sm text-gray-500 dark:text-gray-400", children: "Loading\u2026" }) })), isError && (jsx("div", { className: "py-8 text-center text-sm text-red-500", children: isTeam ? 'Failed to load teams' : 'Failed to load groups' })), !isLoading && !isError && (jsxs("div", { className: "bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg overflow-hidden", children: [jsxs("div", { className: "hidden lg:grid grid-cols-12 bg-gray-50 dark:bg-gray-700 px-6 py-3 text-sm font-medium text-gray-500 dark:text-gray-400 border-b border-gray-200 dark:border-gray-600 gap-4", children: [jsx("div", { className: isTeam ? 'col-span-3' : 'col-span-3', children: isTeam ? 'Team Name' : 'Group Name' }), !isTeam && jsx("div", { className: "col-span-3", children: "Unique ID" }), jsx("div", { className: isTeam ? 'col-span-8' : 'col-span-5', children: "Description" }), jsx("div", { className: "col-span-1 text-right" })] }), jsxs("div", { className: "divide-y divide-gray-200 dark:divide-gray-600", children: [groups.map((g) => (jsxs("div", { className: "grid grid-cols-1 lg:grid-cols-12 px-6 py-4 gap-2 lg:gap-4 lg:items-center", children: [jsx("div", { className: "lg:hidden text-xs text-gray-500 dark:text-gray-400 font-medium", children: isTeam ? 'Team Name' : 'Group Name' }), jsx("div", { className: "text-gray-900 dark:text-gray-100 font-medium lg:font-normal text-sm lg:col-span-3", children: g.name }), !isTeam && (jsxs(Fragment$1, { children: [jsx("div", { className: "lg:hidden text-xs text-gray-500 dark:text-gray-400 font-medium mt-2", children: "Unique ID" }), jsx("div", { className: "text-gray-600 dark:text-gray-300 text-sm lg:col-span-3", children: g.unique_id })] })), jsx("div", { className: "lg:hidden text-xs text-gray-500 dark:text-gray-400 font-medium mt-2", children: "Description" }), jsx("div", { className: `text-gray-600 dark:text-gray-300 text-sm ${isTeam ? 'lg:col-span-8' : 'lg:col-span-5'}`, children: g.description }), jsxs("div", { className: "mt-2 lg:mt-0 lg:col-span-1 flex gap-2 lg:justify-end", children: [isTeam && (jsx(WithPermissions, { rbacResource: `/platforms/${tenant}/usergroups/${g.id}/#share_usergroup`, rbacPermissions: rbacPermissions, children: ({ hasPermission }) => (hasPermission || !enableRbac) && (jsx(Button$1, { variant: "ghost", size: "sm", onClick: () => openSharePanel(g), disabled: deletingGroupId === g.id, "aria-label": `Share team ${g.name}`, children: jsx(Share2, { className: "h-4 w-4", "aria-hidden": "true" }) })) })), jsx(Button$1, { variant: "ghost", size: "sm", onClick: () => openEdit(g), disabled: deletingGroupId === g.id, "aria-label": `Edit ${isTeam ? 'team' : 'group'} ${g.name}`, children: jsx(Pencil, { className: "h-4 w-4", "aria-hidden": "true" }) }), jsx(TooltipProvider, { children: jsxs(Tooltip, { children: [jsx(TooltipTrigger, { asChild: true, children: jsx("span", { tabIndex: 0, children: jsx(Button$1, { variant: "ghost", size: "sm", onClick: () => onDelete(g), className: "text-red-600 hover:text-red-700", disabled: deletingGroupId === g.id ||
114161
- g.is_internal ||
114162
- !g.permissions.object.delete, "aria-label": `Delete ${isTeam ? 'team' : 'group'} ${g.name}`, children: deletingGroupId === g.id ? (jsx(LoaderCircle, { className: "h-4 w-4 animate-spin", "aria-hidden": "true" })) : (jsx(Trash2, { className: "h-4 w-4", "aria-hidden": "true" })) }) }) }), g.is_internal && (jsx(TooltipContent, { children: jsxs("p", { children: ["Cannot delete internal ", isTeam ? 'teams' : 'groups'] }) })), !g.permissions.object.delete && (jsx(TooltipContent, { children: jsxs("p", { children: ["Cannot delete ", isTeam ? 'teams' : 'groups'] }) }))] }) })] })] }, g.id))), groups.length === 0 && (jsx("div", { className: "px-6 py-8 text-center text-gray-500 dark:text-gray-400", children: isTeam ? 'No teams found' : 'No groups found' }))] })] })), !isLoading && !isError && (jsx("div", { className: "mt-6", children: jsx(AdvancedPagination, { totalPages: totalPages, currentPage: page, onPageChange: (newPage) => handlePageChange(newPage) }) })), jsx(Dialog, { open: isOpen, onOpenChange: setIsOpen, children: jsxs(DialogContent, { "aria-describedby": undefined, className: "max-w-2xl max-h-[90vh] overflow-y-auto", children: [jsx(DialogHeader, { children: jsx(DialogTitle, { children: editing ? (isTeam ? 'Edit Team' : 'Edit Group') : isTeam ? 'New Team' : 'New Group' }) }), jsxs("div", { className: "space-y-4", children: [jsxs("div", { className: "grid gap-1.5", children: [jsx(Label, { htmlFor: "g-name", children: isTeam ? 'Team Name' : 'Group Name' }), jsx(Input, { id: "g-name", value: form.name, onChange: (e) => setForm({ ...form, name: e.target.value }), placeholder: isTeam ? 'Enter team name' : 'Enter group name', required: true })] }), jsxs("div", { className: "grid gap-1.5", children: [jsx(Label, { htmlFor: "g-desc", children: "Description" }), jsx(Input, { id: "g-desc", value: form.description, onChange: (e) => setForm({ ...form, description: e.target.value }), placeholder: isTeam ? 'Enter team description' : 'Enter group description' })] }), jsxs("div", { className: "grid gap-1.5", children: [jsx(Label, { children: isTeam ? 'Team Members' : 'Group Members' }), jsx("div", { className: "space-y-2", children: members.length > 0 ? (jsx("div", { className: "space-y-2 max-h-48 overflow-y-auto border border-gray-200 dark:border-gray-700 rounded-md p-2", children: members.map((member) => (jsxs("div", { className: "flex items-center justify-between bg-gray-50 dark:bg-gray-800 p-2 rounded-md", children: [jsxs("div", { className: "flex flex-col", children: [jsx("span", { className: "text-sm font-medium text-gray-900 dark:text-gray-100", children: member.name || member.username }), member.email && (jsx("span", { className: "text-xs text-gray-500 dark:text-gray-400", children: member.email }))] }), jsx(Button$1, { type: "button", variant: "ghost", size: "sm", onClick: () => removeMember(member.id), className: "h-8 w-8 p-0 text-red-600 hover:text-red-700 hover:bg-red-50 dark:hover:bg-red-900/20", "aria-label": `Remove ${member.name}`, children: jsx(X, { className: "h-4 w-4" }) })] }, member.id))) })) : (jsx("div", { className: "text-sm text-gray-500 dark:text-gray-400 p-4 text-center border border-dashed border-gray-300 dark:border-gray-600 rounded-md", children: "No members added yet" })) })] }), jsxs("div", { className: "grid gap-1.5", children: [jsx(Label, { htmlFor: "user-search", children: "Add Members" }), jsxs("div", { className: "relative", children: [jsx(Input, { id: "user-search", value: userSearch, onChange: (e) => {
114163
+ return (jsxs("div", { className: "mt-4", children: [jsxs("div", { className: `flex mb-6 gap-2 ${isTeam ? 'flex-col sm:flex-row sm:items-center sm:justify-between' : 'flex-row items-center justify-between'}`, children: [jsxs("div", { className: "relative max-w-sm w-full sm:w-auto", children: [jsx(Search, { className: "absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-gray-400" }), jsx(Input, { value: searchQuery, onChange: (e) => setSearchQuery(e.target.value), placeholder: isTeam ? 'Search teams' : 'Search groups', "aria-label": isTeam ? 'Search teams' : 'Search groups', className: "pl-10 pr-10 focus:ring-blue-500 focus:border-blue-500 h-[35px]" }), isLoading && (jsx(LoaderCircle, { "data-testid": "search-spinner", className: "absolute right-3 top-1/2 -translate-y-1/2 h-4 w-4 text-gray-400 animate-spin", "aria-hidden": "true" }))] }), jsxs("div", { className: "flex gap-2", children: [isTeam && hasInviteUserPermission && onInviteClick && (jsx(Button$1, { onClick: onInviteClick, "aria-label": "Invite users", className: "bg-gradient-to-r from-[#2563EB] to-[#93C5FD] hover:opacity-90 text-white h-[35px]", children: "Invite" })), isTeam ? (hasCreateTeamPermission && (jsx(Button$1, { onClick: openNew, "aria-label": "New team", className: "bg-gradient-to-r from-[#2563EB] to-[#93C5FD] hover:opacity-90 text-white h-[35px]", children: "New Team" }))) : (jsx(Button$1, { onClick: openNew, "aria-label": "New group", className: "bg-gradient-to-r from-[#2563EB] to-[#93C5FD] hover:opacity-90 text-white h-[35px]", children: "New Group" }))] })] }), isLoading && (jsx("div", { className: "flex justify-center items-center h-64", children: jsx("div", { className: "py-8 text-center text-sm text-gray-500 dark:text-gray-400", children: "Loading\u2026" }) })), isError && (jsx("div", { className: "py-8 text-center text-sm text-red-500", children: isTeam ? 'Failed to load teams' : 'Failed to load groups' })), !isLoading && !isError && (jsx("div", { className: "bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg overflow-x-auto", children: jsxs("table", { className: "w-full text-sm", children: [jsx("thead", { className: "bg-gray-50 dark:bg-gray-700 border-b border-gray-200 dark:border-gray-600", children: jsxs("tr", { children: [jsx("th", { className: "px-6 py-3 text-left font-medium text-gray-500 dark:text-gray-400", children: isTeam ? 'Team Name' : 'Group Name' }), !isTeam && (jsx("th", { className: "px-6 py-3 text-left font-medium text-gray-500 dark:text-gray-400", children: "Unique ID" })), jsx("th", { className: "px-6 py-3 text-left font-medium text-gray-500 dark:text-gray-400", children: "Description" }), jsx("th", { className: "px-6 py-3 text-right font-medium text-gray-500 dark:text-gray-400 w-[120px]" })] }) }), jsxs("tbody", { className: "divide-y divide-gray-200 dark:divide-gray-600", children: [groups.map((g) => (jsxs("tr", { children: [jsx("td", { className: "px-6 py-4 text-gray-900 dark:text-gray-100 text-sm", children: g.name }), !isTeam && (jsx("td", { className: "px-6 py-4 text-gray-600 dark:text-gray-300 text-sm", children: g.unique_id })), jsx("td", { className: "px-6 py-4 text-gray-600 dark:text-gray-300 text-sm", children: g.description }), jsx("td", { className: "px-6 py-4", children: jsxs("div", { className: "flex gap-2 justify-end", children: [isTeam && (jsx(WithPermissions, { rbacResource: `/platforms/${tenant}/usergroups/${g.id}/#share_usergroup`, rbacPermissions: rbacPermissions, children: ({ hasPermission }) => (hasPermission || !enableRbac) && (jsx(Button$1, { variant: "ghost", size: "sm", onClick: () => openSharePanel(g), disabled: deletingGroupId === g.id, "aria-label": `Share team ${g.name}`, children: jsx(Share2, { className: "h-4 w-4", "aria-hidden": "true" }) })) })), jsx(Button$1, { variant: "ghost", size: "sm", onClick: () => openEdit(g), disabled: deletingGroupId === g.id, "aria-label": `Edit ${isTeam ? 'team' : 'group'} ${g.name}`, children: jsx(Pencil, { className: "h-4 w-4", "aria-hidden": "true" }) }), jsx(TooltipProvider, { children: jsxs(Tooltip, { children: [jsx(TooltipTrigger, { asChild: true, children: jsx("span", { tabIndex: 0, children: jsx(Button$1, { variant: "ghost", size: "sm", onClick: () => onDelete(g), className: "text-red-600 hover:text-red-700", disabled: deletingGroupId === g.id ||
114164
+ g.is_internal ||
114165
+ !g.permissions.object.delete, "aria-label": `Delete ${isTeam ? 'team' : 'group'} ${g.name}`, children: deletingGroupId === g.id ? (jsx(LoaderCircle, { className: "h-4 w-4 animate-spin", "aria-hidden": "true" })) : (jsx(Trash2, { className: "h-4 w-4", "aria-hidden": "true" })) }) }) }), g.is_internal && (jsx(TooltipContent, { children: jsxs("p", { children: ["Cannot delete internal ", isTeam ? 'teams' : 'groups'] }) })), !g.permissions.object.delete && (jsx(TooltipContent, { children: jsxs("p", { children: ["Cannot delete ", isTeam ? 'teams' : 'groups'] }) }))] }) })] }) })] }, g.id))), groups.length === 0 && (jsx("tr", { children: jsx("td", { colSpan: isTeam ? 3 : 4, className: "px-6 py-8 text-center text-gray-500 dark:text-gray-400", children: isTeam ? 'No teams found' : 'No groups found' }) }))] })] }) })), !isLoading && !isError && (jsx("div", { className: "mt-6", children: jsx(AdvancedPagination, { totalPages: totalPages, currentPage: page, onPageChange: (newPage) => handlePageChange(newPage) }) })), jsx(Dialog, { open: isOpen, onOpenChange: setIsOpen, children: jsxs(DialogContent, { "aria-describedby": undefined, className: "max-w-2xl max-h-[90vh] overflow-y-auto", children: [jsx(DialogHeader, { children: jsx(DialogTitle, { children: editing ? (isTeam ? 'Edit Team' : 'Edit Group') : isTeam ? 'New Team' : 'New Group' }) }), jsxs("div", { className: "space-y-4", children: [jsxs("div", { className: "grid gap-1.5", children: [jsx(Label, { htmlFor: "g-name", children: isTeam ? 'Team Name' : 'Group Name' }), jsx(Input, { id: "g-name", value: form.name, onChange: (e) => setForm({ ...form, name: e.target.value }), placeholder: isTeam ? 'Enter team name' : 'Enter group name', required: true })] }), jsxs("div", { className: "grid gap-1.5", children: [jsx(Label, { htmlFor: "g-desc", children: "Description" }), jsx(Input, { id: "g-desc", value: form.description, onChange: (e) => setForm({ ...form, description: e.target.value }), placeholder: isTeam ? 'Enter team description' : 'Enter group description' })] }), jsxs("div", { className: "grid gap-1.5", children: [jsx(Label, { children: isTeam ? 'Team Members' : 'Group Members' }), jsx("div", { className: "space-y-2", children: members.length > 0 ? (jsx("div", { className: "space-y-2 max-h-48 overflow-y-auto border border-gray-200 dark:border-gray-700 rounded-md p-2", children: members.map((member) => (jsxs("div", { className: "flex items-center justify-between bg-gray-50 dark:bg-gray-800 p-2 rounded-md", children: [jsxs("div", { className: "flex flex-col", children: [jsx("span", { className: "text-sm font-medium text-gray-900 dark:text-gray-100", children: member.name || member.username }), member.email && (jsx("span", { className: "text-xs text-gray-500 dark:text-gray-400", children: member.email }))] }), jsx(Button$1, { type: "button", variant: "ghost", size: "sm", onClick: () => removeMember(member.id), className: "h-8 w-8 p-0 text-red-600 hover:text-red-700 hover:bg-red-50 dark:hover:bg-red-900/20", "aria-label": `Remove ${member.name}`, children: jsx(X, { className: "h-4 w-4" }) })] }, member.id))) })) : (jsx("div", { className: "text-sm text-gray-500 dark:text-gray-400 p-4 text-center border border-dashed border-gray-300 dark:border-gray-600 rounded-md", children: "No members added yet" })) })] }), jsxs("div", { className: "grid gap-1.5", children: [jsx(Label, { htmlFor: "user-search", children: "Add Members" }), jsxs("div", { className: "relative", children: [jsx(Input, { id: "user-search", value: userSearch, onChange: (e) => {
114163
114166
  setUserSearch(e.target.value);
114164
114167
  setShowUserSearch(e.target.value.length > 0);
114165
114168
  }, onFocus: () => setShowUserSearch(userSearch.length > 0), placeholder: "Type to search users...", className: "w-full" }), showUserSearch && availableUsers.length > 0 && (jsx("div", { className: "absolute top-full left-0 right-0 mt-1 bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-md shadow-lg max-h-48 overflow-y-auto z-50", children: availableUsers.map((user) => (jsxs("button", { type: "button", onClick: () => {
@@ -114330,7 +114333,7 @@ function RolesTab({ tenant }) {
114330
114333
  setDeletingRoleId(null);
114331
114334
  }
114332
114335
  }
114333
- return (jsxs("div", { className: "mt-4", children: [jsxs("div", { className: "flex justify-between items-center gap-1 mb-6", children: [jsxs("div", { className: "relative max-w-sm", children: [jsx(Search, { className: "absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-gray-400" }), jsx(Input, { value: searchQuery, onChange: (e) => setSearchQuery(e.target.value), placeholder: "Search roles", "aria-label": "Search roles", className: "pl-10 pr-10 focus:ring-blue-500 focus:border-blue-500 h-[35px]" }), isLoading && (jsx(LoaderCircle, { "data-testid": "search-spinner", className: "absolute right-3 top-1/2 -translate-y-1/2 h-4 w-4 text-gray-400 animate-spin", "aria-hidden": "true" }))] }), jsx(Button$1, { onClick: openNew, "aria-label": "New role", className: "bg-gradient-to-r from-[#2563EB] to-[#93C5FD] hover:opacity-90 text-white h-[35px]", children: "New Role" })] }), isLoading && (jsx("div", { className: "flex justify-center items-center h-64", children: jsx("div", { className: "py-8 text-center text-sm text-gray-500 dark:text-gray-400", children: "Loading\u2026" }) })), isError && jsx("div", { className: "py-8 text-center text-sm text-red-500", children: "Failed to load roles" }), !isLoading && !isError && (jsxs("div", { className: "bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg overflow-hidden", children: [jsxs("div", { className: "hidden lg:grid grid-cols-12 bg-gray-50 dark:bg-gray-700 px-6 py-3 text-sm font-medium text-gray-500 dark:text-gray-400 border-b border-gray-200 dark:border-gray-600 gap-4", children: [jsx("div", { className: "col-span-10", children: "Name" }), jsx("div", { className: "col-span-2 text-right" })] }), jsxs("div", { className: "divide-y divide-gray-200 dark:divide-gray-600", children: [roles.map((r) => (jsxs("div", { className: "grid grid-cols-1 lg:grid-cols-12 px-6 py-4 gap-2 lg:gap-4 lg:items-center", children: [jsx("div", { className: "lg:hidden text-xs text-gray-500 dark:text-gray-400 font-medium", children: "Name" }), jsx("div", { className: "text-gray-900 dark:text-gray-100 font-medium lg:font-normal text-sm lg:col-span-10", children: r.name }), jsxs("div", { className: "mt-2 lg:mt-0 lg:col-span-2 flex gap-2 lg:justify-end", children: [jsx(Button$1, { variant: "ghost", size: "sm", onClick: () => openEdit(r), disabled: deletingRoleId === r.id, "aria-label": `Edit role ${r.name}`, children: jsx(Pencil, { className: "h-4 w-4", "aria-hidden": "true" }) }), jsx(TooltipProvider, { children: jsxs(Tooltip, { children: [jsx(TooltipTrigger, { asChild: true, children: jsx("span", { tabIndex: 0, children: jsx(Button$1, { variant: "ghost", size: "sm", onClick: () => onDelete(r), className: "text-red-600 hover:text-red-700", disabled: deletingRoleId === r.id || r.is_internal, "aria-label": `Delete role ${r.name}`, children: deletingRoleId === r.id ? (jsx(LoaderCircle, { className: "h-4 w-4 animate-spin", "aria-hidden": "true" })) : (jsx(Trash2, { className: "h-4 w-4", "aria-hidden": "true" })) }) }) }), r.is_internal && (jsx(TooltipContent, { children: jsx("p", { children: "Cannot delete internal roles" }) }))] }) })] })] }, r.id))), roles.length === 0 && (jsx("div", { className: "px-6 py-8 text-center text-gray-500 dark:text-gray-400", children: "No roles found" }))] })] })), !isLoading && !isError && (jsx("div", { className: "mt-6", children: jsx(AdvancedPagination, { totalPages: totalPages, currentPage: page, onPageChange: (newPage) => handlePageChange(newPage) }) })), jsx(Dialog, { open: isOpen, onOpenChange: setIsOpen, children: jsxs(DialogContent, { "aria-describedby": undefined, className: "max-w-2xl max-h-[90vh] overflow-y-auto", children: [jsx(DialogHeader, { children: jsx(DialogTitle, { children: editing ? 'Edit Role' : 'New Role' }) }), jsxs("div", { className: "space-y-4", children: [jsxs("div", { className: "grid gap-1.5", children: [jsx(Label, { htmlFor: "r-name", children: "Role Name" }), jsx(Input, { id: "r-name", value: form.name, onChange: (e) => setForm({ ...form, name: e.target.value }), placeholder: "Enter role name", required: true })] }), jsxs("div", { className: "grid gap-1.5", children: [jsx(Label, { htmlFor: "r-actions", children: "Actions" }), jsxs("div", { className: "space-y-2", children: [actions.length > 0 && (jsx("div", { className: "flex flex-wrap gap-2 p-2 border border-gray-200 dark:border-gray-700 rounded-md bg-gray-50 dark:bg-gray-800", children: actions.map((action, index) => (jsxs(Badge, { variant: "secondary", className: "px-2 py-1 flex items-center gap-1 font-mono text-xs", children: [jsx("span", { children: action }), jsx("button", { type: "button", onClick: () => removeAction(action), className: "ml-1 hover:text-red-600", "aria-label": `Remove action ${action}`, children: jsx(X, { className: "h-3 w-3" }) })] }, index))) })), jsxs("div", { className: "flex gap-2", children: [jsx(Input, { id: "r-actions", value: actionInput, onChange: (e) => setActionInput(e.target.value), onKeyDown: handleActionKeyDown, placeholder: "e.g., Ibl.Mentor/Settings/read, Ibl.Mentor/*/write", className: "flex-1 font-mono text-sm" }), jsx(Button$1, { type: "button", variant: "outline", size: "sm", onClick: addAction, disabled: !actionInput.trim(), "aria-label": "Add action", children: jsx(Plus, { className: "h-4 w-4" }) })] }), jsx("p", { className: "text-xs text-gray-500 dark:text-gray-400", children: "Press Enter or click + to add. Supports wildcards (e.g., Ibl.Mentor/*/read)" })] })] }), jsxs("div", { className: "grid gap-1.5", children: [jsx(Label, { htmlFor: "r-data-actions", children: "Data Actions" }), jsxs("div", { className: "space-y-2", children: [dataActions.length > 0 && (jsx("div", { className: "flex flex-wrap gap-2 p-2 border border-gray-200 dark:border-gray-700 rounded-md bg-gray-50 dark:bg-gray-800", children: dataActions.map((action, index) => (jsxs(Badge, { variant: "secondary", className: "px-2 py-1 flex items-center gap-1 font-mono text-xs", children: [jsx("span", { children: action }), jsx("button", { type: "button", onClick: () => removeDataAction(action), className: "ml-1 hover:text-red-600", "aria-label": `Remove data action ${action}`, children: jsx(X, { className: "h-3 w-3" }) })] }, index))) })), jsxs("div", { className: "flex gap-2", children: [jsx(Input, { id: "r-data-actions", value: dataActionInput, onChange: (e) => setDataActionInput(e.target.value), onKeyDown: handleDataActionKeyDown, placeholder: "e.g., Ibl.Mentor/Settings/email/read, Ibl.Core/*/name/write", className: "flex-1 font-mono text-sm" }), jsx(Button$1, { type: "button", variant: "outline", size: "sm", onClick: addDataAction, disabled: !dataActionInput.trim(), "aria-label": "Add data action", children: jsx(Plus, { className: "h-4 w-4" }) })] }), jsx("p", { className: "text-xs text-gray-500 dark:text-gray-400", children: "Press Enter or click + to add. Field-level access (e.g., Ibl.Mentor/Settings/email/read)" })] })] })] }), jsxs(DialogFooter, { className: "mt-6", children: [jsx(Button$1, { variant: "outline", onClick: () => setIsOpen(false), children: "Cancel" }), jsx(TooltipProvider, { children: jsxs(Tooltip, { children: [jsx(TooltipTrigger, { asChild: true, children: jsx("span", { tabIndex: 0, children: jsx(Button$1, { onClick: onSubmit, disabled: !!editing && (roleDetails === null || roleDetails === void 0 ? void 0 : roleDetails.is_internal), className: "bg-gradient-to-r from-[#2563EB] to-[#93C5FD] hover:opacity-90 text-white", children: editing ? 'Save Role' : 'Create Role' }) }) }), editing && (roleDetails === null || roleDetails === void 0 ? void 0 : roleDetails.is_internal) && (jsx(TooltipContent, { children: jsx("p", { children: "Cannot edit internal roles" }) }))] }) })] })] }) })] }));
114336
+ return (jsxs("div", { className: "mt-4", children: [jsxs("div", { className: "flex justify-between items-center gap-1 mb-6", children: [jsxs("div", { className: "relative max-w-sm", children: [jsx(Search, { className: "absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-gray-400" }), jsx(Input, { value: searchQuery, onChange: (e) => setSearchQuery(e.target.value), placeholder: "Search roles", "aria-label": "Search roles", className: "pl-10 pr-10 focus:ring-blue-500 focus:border-blue-500 h-[35px]" }), isLoading && (jsx(LoaderCircle, { "data-testid": "search-spinner", className: "absolute right-3 top-1/2 -translate-y-1/2 h-4 w-4 text-gray-400 animate-spin", "aria-hidden": "true" }))] }), jsx(Button$1, { onClick: openNew, "aria-label": "New role", className: "bg-gradient-to-r from-[#2563EB] to-[#93C5FD] hover:opacity-90 text-white h-[35px]", children: "New Role" })] }), isLoading && (jsx("div", { className: "flex justify-center items-center h-64", children: jsx("div", { className: "py-8 text-center text-sm text-gray-500 dark:text-gray-400", children: "Loading\u2026" }) })), isError && jsx("div", { className: "py-8 text-center text-sm text-red-500", children: "Failed to load roles" }), !isLoading && !isError && (jsx("div", { className: "bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg overflow-x-auto", children: jsxs("table", { className: "w-full text-sm", children: [jsx("thead", { className: "bg-gray-50 dark:bg-gray-700 border-b border-gray-200 dark:border-gray-600", children: jsxs("tr", { children: [jsx("th", { className: "px-6 py-3 text-left font-medium text-gray-500 dark:text-gray-400", children: "Name" }), jsx("th", { className: "px-6 py-3 text-right font-medium text-gray-500 dark:text-gray-400 w-[100px]" })] }) }), jsxs("tbody", { className: "divide-y divide-gray-200 dark:divide-gray-600", children: [roles.map((r) => (jsxs("tr", { children: [jsx("td", { className: "px-6 py-4 text-gray-900 dark:text-gray-100 text-sm", children: r.name }), jsx("td", { className: "px-6 py-4", children: jsxs("div", { className: "flex gap-2 justify-end", children: [jsx(Button$1, { variant: "ghost", size: "sm", onClick: () => openEdit(r), disabled: deletingRoleId === r.id, "aria-label": `Edit role ${r.name}`, children: jsx(Pencil, { className: "h-4 w-4", "aria-hidden": "true" }) }), jsx(TooltipProvider, { children: jsxs(Tooltip, { children: [jsx(TooltipTrigger, { asChild: true, children: jsx("span", { tabIndex: 0, children: jsx(Button$1, { variant: "ghost", size: "sm", onClick: () => onDelete(r), className: "text-red-600 hover:text-red-700", disabled: deletingRoleId === r.id || r.is_internal, "aria-label": `Delete role ${r.name}`, children: deletingRoleId === r.id ? (jsx(LoaderCircle, { className: "h-4 w-4 animate-spin", "aria-hidden": "true" })) : (jsx(Trash2, { className: "h-4 w-4", "aria-hidden": "true" })) }) }) }), r.is_internal && (jsx(TooltipContent, { children: jsx("p", { children: "Cannot delete internal roles" }) }))] }) })] }) })] }, r.id))), roles.length === 0 && (jsx("tr", { children: jsx("td", { colSpan: 2, className: "px-6 py-8 text-center text-gray-500 dark:text-gray-400", children: "No roles found" }) }))] })] }) })), !isLoading && !isError && (jsx("div", { className: "mt-6", children: jsx(AdvancedPagination, { totalPages: totalPages, currentPage: page, onPageChange: (newPage) => handlePageChange(newPage) }) })), jsx(Dialog, { open: isOpen, onOpenChange: setIsOpen, children: jsxs(DialogContent, { "aria-describedby": undefined, className: "max-w-2xl max-h-[90vh] overflow-y-auto", children: [jsx(DialogHeader, { children: jsx(DialogTitle, { children: editing ? 'Edit Role' : 'New Role' }) }), jsxs("div", { className: "space-y-4", children: [jsxs("div", { className: "grid gap-1.5", children: [jsx(Label, { htmlFor: "r-name", children: "Role Name" }), jsx(Input, { id: "r-name", value: form.name, onChange: (e) => setForm({ ...form, name: e.target.value }), placeholder: "Enter role name", required: true })] }), jsxs("div", { className: "grid gap-1.5", children: [jsx(Label, { htmlFor: "r-actions", children: "Actions" }), jsxs("div", { className: "space-y-2", children: [actions.length > 0 && (jsx("div", { className: "flex flex-wrap gap-2 p-2 border border-gray-200 dark:border-gray-700 rounded-md bg-gray-50 dark:bg-gray-800", children: actions.map((action, index) => (jsxs(Badge, { variant: "secondary", className: "px-2 py-1 flex items-center gap-1 font-mono text-xs", children: [jsx("span", { children: action }), jsx("button", { type: "button", onClick: () => removeAction(action), className: "ml-1 hover:text-red-600", "aria-label": `Remove action ${action}`, children: jsx(X, { className: "h-3 w-3" }) })] }, index))) })), jsxs("div", { className: "flex gap-2", children: [jsx(Input, { id: "r-actions", value: actionInput, onChange: (e) => setActionInput(e.target.value), onKeyDown: handleActionKeyDown, placeholder: "e.g., Ibl.Mentor/Settings/read, Ibl.Mentor/*/write", className: "flex-1 font-mono text-sm" }), jsx(Button$1, { type: "button", variant: "outline", size: "sm", onClick: addAction, disabled: !actionInput.trim(), "aria-label": "Add action", children: jsx(Plus, { className: "h-4 w-4" }) })] }), jsx("p", { className: "text-xs text-gray-500 dark:text-gray-400", children: "Press Enter or click + to add. Supports wildcards (e.g., Ibl.Mentor/*/read)" })] })] }), jsxs("div", { className: "grid gap-1.5", children: [jsx(Label, { htmlFor: "r-data-actions", children: "Data Actions" }), jsxs("div", { className: "space-y-2", children: [dataActions.length > 0 && (jsx("div", { className: "flex flex-wrap gap-2 p-2 border border-gray-200 dark:border-gray-700 rounded-md bg-gray-50 dark:bg-gray-800", children: dataActions.map((action, index) => (jsxs(Badge, { variant: "secondary", className: "px-2 py-1 flex items-center gap-1 font-mono text-xs", children: [jsx("span", { children: action }), jsx("button", { type: "button", onClick: () => removeDataAction(action), className: "ml-1 hover:text-red-600", "aria-label": `Remove data action ${action}`, children: jsx(X, { className: "h-3 w-3" }) })] }, index))) })), jsxs("div", { className: "flex gap-2", children: [jsx(Input, { id: "r-data-actions", value: dataActionInput, onChange: (e) => setDataActionInput(e.target.value), onKeyDown: handleDataActionKeyDown, placeholder: "e.g., Ibl.Mentor/Settings/email/read, Ibl.Core/*/name/write", className: "flex-1 font-mono text-sm" }), jsx(Button$1, { type: "button", variant: "outline", size: "sm", onClick: addDataAction, disabled: !dataActionInput.trim(), "aria-label": "Add data action", children: jsx(Plus, { className: "h-4 w-4" }) })] }), jsx("p", { className: "text-xs text-gray-500 dark:text-gray-400", children: "Press Enter or click + to add. Field-level access (e.g., Ibl.Mentor/Settings/email/read)" })] })] })] }), jsxs(DialogFooter, { className: "mt-6", children: [jsx(Button$1, { variant: "outline", onClick: () => setIsOpen(false), children: "Cancel" }), jsx(TooltipProvider, { children: jsxs(Tooltip, { children: [jsx(TooltipTrigger, { asChild: true, children: jsx("span", { tabIndex: 0, children: jsx(Button$1, { onClick: onSubmit, disabled: !!editing && (roleDetails === null || roleDetails === void 0 ? void 0 : roleDetails.is_internal), className: "bg-gradient-to-r from-[#2563EB] to-[#93C5FD] hover:opacity-90 text-white", children: editing ? 'Save Role' : 'Create Role' }) }) }), editing && (roleDetails === null || roleDetails === void 0 ? void 0 : roleDetails.is_internal) && (jsx(TooltipContent, { children: jsx("p", { children: "Cannot edit internal roles" }) }))] }) })] })] }) })] }));
114334
114337
  }
114335
114338
 
114336
114339
  function PoliciesTab({ tenant }) {
@@ -114596,10 +114599,10 @@ function PoliciesTab({ tenant }) {
114596
114599
  setDeletingPolicyId(null);
114597
114600
  }
114598
114601
  }
114599
- return (jsxs("div", { className: "mt-4", children: [jsxs("div", { className: "flex justify-between items-center gap-1 mb-6", children: [jsxs("div", { className: "relative max-w-sm", children: [jsx(Search, { className: "absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-gray-400" }), jsx(Input, { value: searchQuery, onChange: (e) => setSearchQuery(e.target.value), placeholder: "Search policies", "aria-label": "Search policies", className: "pl-10 pr-10 focus:ring-blue-500 focus:border-blue-500 h-[35px]" }), isLoading && (jsx(LoaderCircle, { "data-testid": "search-spinner", className: "absolute right-3 top-1/2 -translate-y-1/2 h-4 w-4 text-gray-400 animate-spin", "aria-hidden": "true" }))] }), jsx(Button$1, { onClick: openNew, "aria-label": "New policy", className: "bg-gradient-to-r from-[#2563EB] to-[#93C5FD] hover:opacity-90 text-white h-[35px]", children: "New Policy" })] }), isLoading && (jsx("div", { className: "flex justify-center items-center h-64", children: jsx("div", { className: "py-8 text-center text-sm text-gray-500 dark:text-gray-400", children: "Loading\u2026" }) })), isError && (jsx("div", { className: "py-8 text-center text-sm text-red-500", children: "Failed to load policies" })), !isLoading && !isError && (jsxs("div", { className: "bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg overflow-hidden", children: [jsxs("div", { className: "hidden lg:grid grid-cols-12 bg-gray-50 dark:bg-gray-700 px-6 py-3 text-sm font-medium text-gray-500 dark:text-gray-400 border-b border-gray-200 dark:border-gray-600 gap-4", children: [jsx("div", { className: "col-span-5", children: "Policy Name" }), jsx("div", { className: "col-span-5", children: "Role" }), jsx("div", { className: "col-span-2 text-right" })] }), jsxs("div", { className: "divide-y divide-gray-200 dark:divide-gray-600", children: [policies.map((p) => {
114600
- var _a, _b;
114601
- return (jsxs("div", { className: "grid grid-cols-1 lg:grid-cols-12 px-6 py-4 gap-2 lg:gap-4 lg:items-center", children: [jsx("div", { className: "lg:hidden text-xs text-gray-500 dark:text-gray-400 font-medium", children: "Policy Name" }), jsx("div", { className: "text-gray-900 dark:text-gray-100 font-medium lg:font-normal text-sm lg:col-span-5", children: p.name }), jsx("div", { className: "lg:hidden text-xs text-gray-500 dark:text-gray-400 font-medium mt-2", children: "Role" }), jsx("div", { className: "text-gray-600 dark:text-gray-300 text-sm lg:col-span-5", children: (_b = (_a = p.role) === null || _a === void 0 ? void 0 : _a.name) !== null && _b !== void 0 ? _b : 'N/A' }), jsxs("div", { className: "mt-2 lg:mt-0 lg:col-span-2 flex gap-2 lg:justify-end", children: [jsx(Button$1, { variant: "ghost", size: "sm", onClick: () => openEdit(p), disabled: deletingPolicyId === p.id, "aria-label": `Edit policy ${p.name}`, children: jsx(Pencil, { className: "h-4 w-4", "aria-hidden": "true" }) }), jsx(TooltipProvider, { children: jsxs(Tooltip, { children: [jsx(TooltipTrigger, { asChild: true, children: jsx("span", { tabIndex: 0, children: jsx(Button$1, { variant: "ghost", size: "sm", onClick: () => onDelete(p), className: "text-red-600 hover:text-red-700", disabled: deletingPolicyId === p.id || p.is_internal, "aria-label": `Delete policy ${p.name}`, children: deletingPolicyId === p.id ? (jsx(LoaderCircle, { className: "h-4 w-4 animate-spin", "aria-hidden": "true" })) : (jsx(Trash2, { className: "h-4 w-4", "aria-hidden": "true" })) }) }) }), p.is_internal && (jsx(TooltipContent, { children: jsx("p", { children: "Cannot delete internal policies" }) }))] }) })] })] }, p.id));
114602
- }), policies.length === 0 && (jsx("div", { className: "px-6 py-8 text-center text-gray-500 dark:text-gray-400", children: "No policies found" }))] })] })), !isLoading && !isError && (jsx("div", { className: "mt-6", children: jsx(AdvancedPagination, { totalPages: totalPages, currentPage: page, onPageChange: (newPage) => handlePageChange(newPage) }) })), jsx(Dialog, { open: isOpen, onOpenChange: setIsOpen, children: jsxs(DialogContent, { "aria-describedby": undefined, className: "max-w-3xl max-h-[90vh] overflow-y-auto", children: [jsx(DialogHeader, { children: jsx(DialogTitle, { children: editing ? 'Edit Policy' : 'New Policy' }) }), jsxs("div", { className: "space-y-4", children: [jsxs("div", { className: "grid gap-1.5", children: [jsx(Label, { htmlFor: "p-name", children: "Policy Name" }), jsx(Input, { id: "p-name", value: form.name, onChange: (e) => setForm({ ...form, name: e.target.value }), placeholder: "Enter policy name", required: true })] }), jsxs("div", { className: "grid gap-1.5", children: [jsx(Label, { htmlFor: "p-role", children: "Role" }), jsxs("div", { className: "relative", children: [jsx(Input, { id: "p-role", value: form.roleName || roleSearch, onChange: (e) => {
114602
+ return (jsxs("div", { className: "mt-4", children: [jsxs("div", { className: "flex justify-between items-center gap-1 mb-6", children: [jsxs("div", { className: "relative max-w-sm", children: [jsx(Search, { className: "absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-gray-400" }), jsx(Input, { value: searchQuery, onChange: (e) => setSearchQuery(e.target.value), placeholder: "Search policies", "aria-label": "Search policies", className: "pl-10 pr-10 focus:ring-blue-500 focus:border-blue-500 h-[35px]" }), isLoading && (jsx(LoaderCircle, { "data-testid": "search-spinner", className: "absolute right-3 top-1/2 -translate-y-1/2 h-4 w-4 text-gray-400 animate-spin", "aria-hidden": "true" }))] }), jsx(Button$1, { onClick: openNew, "aria-label": "New policy", className: "bg-gradient-to-r from-[#2563EB] to-[#93C5FD] hover:opacity-90 text-white h-[35px]", children: "New Policy" })] }), isLoading && (jsx("div", { className: "flex justify-center items-center h-64", children: jsx("div", { className: "py-8 text-center text-sm text-gray-500 dark:text-gray-400", children: "Loading\u2026" }) })), isError && (jsx("div", { className: "py-8 text-center text-sm text-red-500", children: "Failed to load policies" })), !isLoading && !isError && (jsx("div", { className: "bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg overflow-x-auto", children: jsxs("table", { className: "w-full text-sm", children: [jsx("thead", { className: "bg-gray-50 dark:bg-gray-700 border-b border-gray-200 dark:border-gray-600", children: jsxs("tr", { children: [jsx("th", { className: "px-6 py-3 text-left font-medium text-gray-500 dark:text-gray-400", children: "Policy Name" }), jsx("th", { className: "px-6 py-3 text-left font-medium text-gray-500 dark:text-gray-400", children: "Role" }), jsx("th", { className: "px-6 py-3 text-right font-medium text-gray-500 dark:text-gray-400 w-[100px]" })] }) }), jsxs("tbody", { className: "divide-y divide-gray-200 dark:divide-gray-600", children: [policies.map((p) => {
114603
+ var _a, _b;
114604
+ return (jsxs("tr", { children: [jsx("td", { className: "px-6 py-4 text-gray-900 dark:text-gray-100 text-sm", children: p.name }), jsx("td", { className: "px-6 py-4 text-gray-600 dark:text-gray-300 text-sm", children: (_b = (_a = p.role) === null || _a === void 0 ? void 0 : _a.name) !== null && _b !== void 0 ? _b : 'N/A' }), jsx("td", { className: "px-6 py-4", children: jsxs("div", { className: "flex gap-2 justify-end", children: [jsx(Button$1, { variant: "ghost", size: "sm", onClick: () => openEdit(p), disabled: deletingPolicyId === p.id, "aria-label": `Edit policy ${p.name}`, children: jsx(Pencil, { className: "h-4 w-4", "aria-hidden": "true" }) }), jsx(TooltipProvider, { children: jsxs(Tooltip, { children: [jsx(TooltipTrigger, { asChild: true, children: jsx("span", { tabIndex: 0, children: jsx(Button$1, { variant: "ghost", size: "sm", onClick: () => onDelete(p), className: "text-red-600 hover:text-red-700", disabled: deletingPolicyId === p.id || p.is_internal, "aria-label": `Delete policy ${p.name}`, children: deletingPolicyId === p.id ? (jsx(LoaderCircle, { className: "h-4 w-4 animate-spin", "aria-hidden": "true" })) : (jsx(Trash2, { className: "h-4 w-4", "aria-hidden": "true" })) }) }) }), p.is_internal && (jsx(TooltipContent, { children: jsx("p", { children: "Cannot delete internal policies" }) }))] }) })] }) })] }, p.id));
114605
+ }), policies.length === 0 && (jsx("tr", { children: jsx("td", { colSpan: 3, className: "px-6 py-8 text-center text-gray-500 dark:text-gray-400", children: "No policies found" }) }))] })] }) })), !isLoading && !isError && (jsx("div", { className: "mt-6", children: jsx(AdvancedPagination, { totalPages: totalPages, currentPage: page, onPageChange: (newPage) => handlePageChange(newPage) }) })), jsx(Dialog, { open: isOpen, onOpenChange: setIsOpen, children: jsxs(DialogContent, { "aria-describedby": undefined, className: "max-w-3xl max-h-[90vh] overflow-y-auto", children: [jsx(DialogHeader, { children: jsx(DialogTitle, { children: editing ? 'Edit Policy' : 'New Policy' }) }), jsxs("div", { className: "space-y-4", children: [jsxs("div", { className: "grid gap-1.5", children: [jsx(Label, { htmlFor: "p-name", children: "Policy Name" }), jsx(Input, { id: "p-name", value: form.name, onChange: (e) => setForm({ ...form, name: e.target.value }), placeholder: "Enter policy name", required: true })] }), jsxs("div", { className: "grid gap-1.5", children: [jsx(Label, { htmlFor: "p-role", children: "Role" }), jsxs("div", { className: "relative", children: [jsx(Input, { id: "p-role", value: form.roleName || roleSearch, onChange: (e) => {
114603
114606
  setRoleSearch(e.target.value);
114604
114607
  setForm({ ...form, roleId: 0, roleName: '' });
114605
114608
  setShowRoleSearch(e.target.value.length > 0);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@iblai/iblai-js",
3
- "version": "1.0.34",
3
+ "version": "1.0.35",
4
4
  "description": "Unified JavaScript SDK for IBL.ai — re-exports data-layer, web-containers, and web-utils under a single package",
5
5
  "type": "module",
6
6
  "engines": {
@@ -60,9 +60,9 @@
60
60
  "axios": "^1.13.5",
61
61
  "dotenv": "^16.5.0",
62
62
  "winston": "^3.19.0",
63
- "@iblai/data-layer": "1.1.13",
64
63
  "@iblai/mcp": "1.1.0",
65
- "@iblai/web-containers": "1.1.21",
64
+ "@iblai/data-layer": "1.1.13",
65
+ "@iblai/web-containers": "1.1.22",
66
66
  "@iblai/web-utils": "1.1.15"
67
67
  },
68
68
  "peerDependencies": {