@iblai/iblai-js 1.17.20 → 1.17.24

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.
@@ -1,7 +1,7 @@
1
1
  import * as React from 'react';
2
2
  import React__default, { useRef, useEffect, useState, useCallback, useLayoutEffect, forwardRef, createElement as createElement$1, useMemo, createContext, useReducer, useImperativeHandle, useContext, useId as useId$2, useDebugValue, isValidElement, Children, PureComponent, cloneElement, Component, lazy, Suspense } from 'react';
3
3
  import { LOCAL_STORAGE_KEYS, TimeTracker, getInitials, useTenantMetadata, WithPermissions, useStripeUpgrade, CHAT_AREA_SIZE, isAlphaNumeric32, checkRbacPermission, getTimeAgo, REQUIRED_ACTIONS_FOR_GROUPS, formatRelativeTime as formatRelativeTime$2, ANONYMOUS_USERNAME, combineCSVData, redirectToAuthSpaJoinTenant, redirectToAuthSpa, getAuthSpaJoinUrl, useOS, selectNumberOfActiveChatMessages, useUsername, selectStreaming, isLoggedIn, TOOLS, isSafariBrowser, useShowAttachment, useShowVoiceCall, useShowVoiceRecorder, useMentorSettings, selectShowingSharedChat, selectRbacPermissions, useShowFreeTrialDialog, useEmbedMode, chatInputSliceSelectors, useResponsive, useAccessingPublicRoute, useVisitingTenant, useModelFileUploadCapabilities, useChatFileUpload, useVoiceChat, selectAttachedFiles, MENTOR_CHAT_DOCUMENTS_EXTENSIONS, removeFile, chatInputSliceActions, chatActions, WithFormPermissions, MENTOR_VISIBILITY } from '@iblai/web-utils';
4
- import { useTimeTrackingMutation, useGetUserMetadataQuery, useGetUserMetadataEdxQuery, useUpdateUserMetadataMutation, useUpdateUserMetadataEdxMutation, useUploadProfileImageMutation, useResetPasswordMutation, useSelfRetireMutation, useCreateUserInstitutionMutation, useGetUserInstitutionsQuery, useCreateUserEducationMutation, useUpdateUserEducationMutation, useDeleteUserEducationMutation, useGetUserEducationQuery, useCreateUserCompanyMutation, useGetUserCompaniesQuery, useCreateUserExperienceMutation, useUpdateUserExperienceMutation, useDeleteUserExperienceMutation, useGetUserExperienceQuery, useGetUserResumeQuery, useCreateUserResumeMutation, useGetMySubscriptionsQuery, useGetItemSubscriptionQuery, useCancelSubscriptionMutation, useCreateGlobalMemoryMutation, useGetMemsearchStatusQuery, useGetUserMemorySettingsQuery, useUpdateUserMemorySettingsMutation, useGetGlobalMemoriesQuery, useDeleteGlobalMemoryMutation, useInviteUserMutation, usePlatformInvitationsQuery, useCreateCatalogInvitationCourseBulkMutation, useGetCatalogInvitationsCourseQuery, useLazyPlatformUsersQuery, useLazyPlatformUserGroupsQuery, useGetPersonnalizedSearchQuery, useCreateCatalogInvitationProgramBulkMutation, useGetCatalogInvitationsProgramQuery, useUpdateUserRoleMutation, useUpdateUserStatusMutation, useUpdatePlatformUserRoleWithPoliciesMutation, usePlatformUsersQuery, isPoliciesResponse, platformApiSlice, featureTags, useLazyGetRbacTeamsAccessListQuery, useCreateRbacTeamsAccessMutation, useGetRbacGroupsQuery, usePlatformUserGroupsQuery, useCreateRbacGroupMutation, useUpdateRbacGroupMutation, useDeleteRbacGroupMutation, useCreatePlatformUserGroupMutation, useUpdatePlatformUserGroupMutation, useDeletePlatformUserGroupMutation, useGetRbacGroupDetailsQuery, useGetPlatformUserGroupDetailsQuery, useGetRbacPermissionsMutation, useGetRbacRolesQuery, useCreateRbacRoleMutation, useUpdateRbacRoleMutation, useDeleteRbacRoleMutation, useGetRbacRoleDetailsQuery, useGetRbacPoliciesQuery, useCreateRbacPolicyMutation, useUpdateRbacPolicyMutation, useDeleteRbacPolicyMutation, useGetRbacPolicyDetailsQuery, useGetWatchedGroupsQuery, useCreateWatchedGroupMutation, useUpdateWatchedGroupMutation, useDeleteWatchedGroupMutation, useAddWatchedUserMutation, useRemoveWatchedUserMutation, useAddWatcherMutation, useUpdateWatcherMutation, useDeleteWatcherMutation, useGetWatchedUsersQuery, useGetWatchersQuery, WATCHER_NOTIFICATION_EVENTS, WATCHER_NOTIFICATION_EVENT_LABELS, useDeleteApiKeyMutation, useGetApiKeysQuery, useCreateApiKeyMutation, useCreateLLMCredentialMutation, useGetCredentialsSchemaQuery, useGetMaskedLLMCredentialsQuery, useGetLlmsQuery, useDeleteIntegrationCredentialMutation, useDeleteCredentialMutation, useCreateIntegrationCredentialMutation, useGetIntegrationCredentialsSchemaQuery, useGetMaskedIntegrationCredentialsQuery, useGetAccountBillingInfoQuery, useUpdateAutoRechargeInfoMutation, useTriggerAutoRechargeMutation, useCreateStripeCustomerPortalMutation, useSetPlatformConfigurationsMutation, useGetPlatformConfigurationsQuery, useUpdatePlatformMembershipMutation, useGetPlatformMembershipQuery, useGetCustomDomainsQuery, useCreateCustomDomainMutation, useDeleteCustomDomainMutation, useGetStudentMentorCreationStatusQuery, useSetStudentMentorCreationStatusMutation, coreApiSlice, recommendationPromptTypeEnum, useGetRecommendedPromptsListQuery, useCreateRecommendedPromptMutation, useUpdateRecommendedPromptMutation, useDeleteRecommendedPromptMutation, useLazyGetPublicPlatformImageAssetFileUrlQuery, useUpdateTenantMetadataMutation, useCreatePlatformImageAssetMutation, useGetProviderConfigQuery, useCreateProviderConfigMutation, useDeleteProviderConfigMutation, useGetExternalMappingQuery, useGetCredentialsListQuery, useCreateExternalMappingMutation, useDeleteExternalMappingMutation, useGetMemsearchConfigQuery, useUpdateMemsearchConfigMutation, useGetCustomMentorsQuery, useGetStripeConnectStatusQuery, useStartStripeConnectOnboardingMutation, useLazyGetStripeConnectDashboardQuery, useGetAiSearchMentorsQuery, useListPaywallsQuery, useListPricesQuery, useCreatePriceMutation, useUpdatePriceMutation, useDeletePriceMutation, useGetPaywallConfigQuery, useEnablePaywallMutation, useUpdatePaywallMutation, useGetNotificationsCountQuery, useLazyGetNotificationsQuery, useMarkAllAsReadMutation, useCreateNotificationPreviewMutation, useSendNotificationMutation, useGetMentorsQuery, useUpdateTemplateMutation, useGetTemplateDetailsQuery, useGetTemplatesQuery, useLazyGetTemplateDetailsQuery, useToggleTemplateMutation, useGetTopicsStatsQuery, useGetUsersStatsQuery, useGetSessionStatsQuery, useGetTopicsDetailsStatsQuery, useGetAccessTimeHeatmapQuery, useGetUserDetailsStatsQuery, useGetTranscriptsConversationHeadlineQuery, useGetAverageRatingQuery, useGetFinancialStatsQuery, useGetDetailedFinancialStatsQuery, useGetTranscriptsMessagesDetailsQuery, useGetTranscriptsMessagesQuery, useGetReportDetailQuery, useLazyGetDownloadReportFromURLQuery, useGetReportsQuery, useCreateReportMutation, useGetMentorPublicSettingsQuery, useGetContentAnalyticsQuery, useGetContentAnalyticsDetailsQuery, useGetRevenueQuery, useListSubscribersQuery, useGetAuditLogsQuery, useLazyGetCourseMetaDataQuery, useLazyGetCourseCompletionOutlinesQuery, useLazyGetCourseEligibilityQuery, useLazyGetUserEnrolledCoursesQuery, useLazyGetUserAssignedCoursesQuery, useLazyGetUserCredentialsQuery, useLazyGetOverTimeActivityQuery, useLazyGetCatalogSearchQuery, useGetUserEarnedSkillsQuery, useGetUserReportedSkillsQuery, useGetUserDesiredSkillsQuery, useCreateOrUpdateUserReportedSkillMutation, useCreateOrUpdateUserDesiredSkillMutation, useLazyGetPathwayListQuery, useLazyGetUserAssignedPathwaysQuery, useLazyGetUserEnrolledPathwaysQuery, useLazyGetPathwayCompletionQuery, useLazyGetProgramListQuery, useLazyGetProgramCompletionQuery, useLazyGetUserEnrolledProgramsQuery, useLazyGetAssignedProgramsQuery, useLazyGetUserSkillsPointsQuery, useLazyGetUserReportedSkillsQuery, useLazyGetUserDesiredSkillsQuery, useLazyGetUserCatalogPathwaysQuery, useLazyGetPerLearnerInfoQuery, useLazyGetEdxSSOTokenQuery, useCreateCourseEnrollmentMutation, useCreateStripeCheckoutSessionMutation, useLazyGetCourseProgressQuery, useLazyGetCourseCompletionQuery, useLazyGetPersonnalizedSearchQuery, useUpdateExamAttemptMutation, useStartExamMutation, useLazyGetExamInfoQuery, useGetClawMentorConfigQuery, useGetClawInstancesQuery, useGetAgentConfigQuery, useUpdateClawMentorConfigMutation, useCreateClawMentorConfigMutation, useDeleteClawMentorConfigMutation, usePushClawConfigMutation, useCreateClawInstanceMutation, useDeleteClawInstanceMutation, useUpdateAgentConfigMutation, useHealthCheckClawInstanceMutation, useTestConnectivityClawInstanceMutation, useUpdateClawInstanceMutation, useGetAgentSkillsQuery, useGetMentorSkillAssignmentsQuery, useCreateMentorSkillAssignmentMutation, useUpdateMentorSkillAssignmentMutation, useDeleteMentorSkillAssignmentMutation, useCreateAgentSkillMutation, useUpdateAgentSkillMutation, useDeleteAgentSkillMutation, useCreateCheckoutMutation, useGetUserProjectsQuery, useUpdateUserProjectMutation, useGetTrainingDocumentsQuery, useGetVectorDocumentsQuery, useGetMentorMemoriesListQuery, useGetMemoryCategoriesAdminQuery, useDeleteMentorMemoryMutation, useUpdateMentorMemoryMutation, useCreateMentorMemoryMutation, useLazyGetConnectedServiceAuthUrlQuery, useGetPublicMentorsQuery, useCreateUserProjectMutation, useDeleteUserProjectMutation, useGetUserProjectDetailsQuery, useEditTrainingDocumentMutation, useAddTrainingDocumentMutation, useLazyGetCredentialsQuery, useGetMentorSettingsQuery, useEditMentorMutation, useGetPromptCategoriesQuery, useCreatePromptMutation, useDeletePromptMutation, useGetPromptsSearchQuery, useUpdatePromptMutation, useDeleteTrainingDocumentMutation, useGetTrainingDocumentRetrainScheduleQuery, useCreateTrainingDocumentRetrainScheduleMutation } from '@iblai/data-layer';
4
+ import { useTimeTrackingMutation, useGetUserMetadataQuery, useGetUserMetadataEdxQuery, useUpdateUserMetadataMutation, useUpdateUserMetadataEdxMutation, useUploadProfileImageMutation, useResetPasswordMutation, useSelfRetireMutation, useCreateUserInstitutionMutation, useGetUserInstitutionsQuery, useCreateUserEducationMutation, useUpdateUserEducationMutation, useDeleteUserEducationMutation, useGetUserEducationQuery, useCreateUserCompanyMutation, useGetUserCompaniesQuery, useCreateUserExperienceMutation, useUpdateUserExperienceMutation, useDeleteUserExperienceMutation, useGetUserExperienceQuery, useGetUserResumeQuery, useCreateUserResumeMutation, useGetMySubscriptionsQuery, useGetItemSubscriptionQuery, useCancelSubscriptionMutation, useCreateGlobalMemoryMutation, useGetMemsearchStatusQuery, useGetUserMemorySettingsQuery, useUpdateUserMemorySettingsMutation, useGetGlobalMemoriesQuery, useDeleteGlobalMemoryMutation, useInviteUserMutation, usePlatformInvitationsQuery, useCreateCatalogInvitationCourseBulkMutation, useGetCatalogInvitationsCourseQuery, useLazyPlatformUsersQuery, useLazyPlatformUserGroupsQuery, useGetPersonnalizedSearchQuery, useCreateCatalogInvitationProgramBulkMutation, useGetCatalogInvitationsProgramQuery, useUpdateUserRoleMutation, useUpdateUserStatusMutation, useUpdatePlatformUserRoleWithPoliciesMutation, usePlatformUsersQuery, isPoliciesResponse, platformApiSlice, featureTags, useLazyGetRbacTeamsAccessListQuery, useCreateRbacTeamsAccessMutation, useGetRbacGroupsQuery, usePlatformUserGroupsQuery, useCreateRbacGroupMutation, useUpdateRbacGroupMutation, useDeleteRbacGroupMutation, useCreatePlatformUserGroupMutation, useUpdatePlatformUserGroupMutation, useDeletePlatformUserGroupMutation, useGetRbacGroupDetailsQuery, useGetPlatformUserGroupDetailsQuery, useGetRbacPermissionsMutation, useGetRbacRolesQuery, useCreateRbacRoleMutation, useUpdateRbacRoleMutation, useDeleteRbacRoleMutation, useGetRbacRoleDetailsQuery, useGetRbacPoliciesQuery, useCreateRbacPolicyMutation, useUpdateRbacPolicyMutation, useDeleteRbacPolicyMutation, useGetRbacPolicyDetailsQuery, useGetWatchedGroupsQuery, useCreateWatchedGroupMutation, useUpdateWatchedGroupMutation, useDeleteWatchedGroupMutation, useAddWatchedUserMutation, useRemoveWatchedUserMutation, useAddWatcherMutation, useUpdateWatcherMutation, useDeleteWatcherMutation, useGetWatchedUsersQuery, useGetWatchersQuery, WATCHER_NOTIFICATION_EVENTS, WATCHER_NOTIFICATION_EVENT_LABELS, useDeleteApiKeyMutation, useGetApiKeysQuery, useCreateApiKeyMutation, useCreateLLMCredentialMutation, useGetCredentialsSchemaQuery, useGetMaskedLLMCredentialsQuery, useGetLlmsQuery, useDeleteIntegrationCredentialMutation, useDeleteCredentialMutation, useCreateIntegrationCredentialMutation, useGetIntegrationCredentialsSchemaQuery, useGetMaskedIntegrationCredentialsQuery, useGetAccountBillingInfoQuery, useUpdateAutoRechargeInfoMutation, useTriggerAutoRechargeMutation, useCreateStripeCustomerPortalMutation, useSetPlatformConfigurationsMutation, useGetPlatformConfigurationsQuery, useUpdatePlatformMembershipMutation, useGetPlatformMembershipQuery, useGetCustomDomainsQuery, useCreateCustomDomainMutation, useDeleteCustomDomainMutation, useGetStudentMentorCreationStatusQuery, useSetStudentMentorCreationStatusMutation, coreApiSlice, recommendationPromptTypeEnum, useGetRecommendedPromptsListQuery, useCreateRecommendedPromptMutation, useUpdateRecommendedPromptMutation, useDeleteRecommendedPromptMutation, useLazyGetPublicPlatformImageAssetFileUrlQuery, useUpdateTenantMetadataMutation, useCreatePlatformImageAssetMutation, useGetProviderConfigQuery, useCreateProviderConfigMutation, useDeleteProviderConfigMutation, useGetExternalMappingQuery, useGetCredentialsListQuery, useCreateExternalMappingMutation, useDeleteExternalMappingMutation, useGetMemsearchConfigQuery, useUpdateMemsearchConfigMutation, useGetCustomMentorsQuery, useGetStripeConnectStatusQuery, useStartStripeConnectOnboardingMutation, useLazyGetStripeConnectDashboardQuery, useGetAiSearchMentorsQuery, useListPaywallsQuery, useListPricesQuery, useCreatePriceMutation, useUpdatePriceMutation, useDeletePriceMutation, useGetPaywallConfigQuery, useEnablePaywallMutation, useUpdatePaywallMutation, useGetNotificationsCountQuery, useLazyGetNotificationsQuery, useMarkAllAsReadMutation, useCreateNotificationPreviewMutation, useSendNotificationMutation, useGetMentorsQuery, useUpdateTemplateMutation, useGetTemplateDetailsQuery, useGetTemplatesQuery, useLazyGetTemplateDetailsQuery, useToggleTemplateMutation, useGetTopicsStatsQuery, useGetUsersStatsQuery, useGetSessionStatsQuery, useGetTopicsDetailsStatsQuery, useGetAccessTimeHeatmapQuery, useGetUserDetailsStatsQuery, useGetTranscriptsConversationHeadlineQuery, useGetAverageRatingQuery, useGetFinancialStatsQuery, useGetDetailedFinancialStatsQuery, useGetTranscriptsMessagesDetailsQuery, useGetTranscriptsMessagesQuery, useGetReportDetailQuery, useLazyGetDownloadReportFromURLQuery, useGetReportsQuery, useCreateReportMutation, useGetMentorPublicSettingsQuery, useGetContentAnalyticsQuery, useGetContentAnalyticsDetailsQuery, useGetRevenueQuery, useListSubscribersQuery, useGetAuditLogsQuery, useLazyGetCourseMetaDataQuery, useLazyGetCourseCompletionOutlinesQuery, useLazyGetCourseEligibilityQuery, useLazyGetUserEnrolledCoursesQuery, useLazyGetUserAssignedCoursesQuery, useLazyGetUserCredentialsQuery, useLazyGetOverTimeActivityQuery, useLazyGetCatalogSearchQuery, useGetUserEarnedSkillsQuery, useGetUserReportedSkillsQuery, useGetUserDesiredSkillsQuery, useCreateOrUpdateUserReportedSkillMutation, useCreateOrUpdateUserDesiredSkillMutation, useLazyGetPathwayListQuery, useLazyGetUserAssignedPathwaysQuery, useLazyGetUserEnrolledPathwaysQuery, useLazyGetPathwayCompletionQuery, useLazyGetProgramListQuery, useLazyGetProgramCompletionQuery, useLazyGetUserEnrolledProgramsQuery, useLazyGetAssignedProgramsQuery, useLazyGetUserSkillsPointsQuery, useLazyGetUserReportedSkillsQuery, useLazyGetUserDesiredSkillsQuery, useLazyGetUserCatalogPathwaysQuery, useLazyGetPerLearnerInfoQuery, useLazyGetEdxSSOTokenQuery, useCreateCourseEnrollmentMutation, useCreateStripeCheckoutSessionMutation, useLazyGetCourseProgressQuery, useLazyGetCourseCompletionQuery, useLazyGetPersonnalizedSearchQuery, useUpdateExamAttemptMutation, useStartExamMutation, useLazyGetExamInfoQuery, useGetClawMentorConfigQuery, useGetClawInstancesQuery, useGetAgentConfigQuery, useUpdateClawMentorConfigMutation, useCreateClawMentorConfigMutation, useDeleteClawMentorConfigMutation, usePushClawConfigMutation, useCreateClawInstanceMutation, useDeleteClawInstanceMutation, useUpdateAgentConfigMutation, useHealthCheckClawInstanceMutation, useTestConnectivityClawInstanceMutation, useUpdateClawInstanceMutation, useGetAgentSkillsQuery, useGetMentorSkillAssignmentsQuery, useCreateMentorSkillAssignmentMutation, useUpdateMentorSkillAssignmentMutation, useDeleteMentorSkillAssignmentMutation, useCreateAgentSkillMutation, useUpdateAgentSkillMutation, useDeleteAgentSkillMutation, useCreateCheckoutMutation, useGetUserProjectsQuery, useUpdateUserProjectMutation, useGetTrainingDocumentsQuery, useGetVectorDocumentsQuery, useGetMentorMemoriesListQuery, useGetMemoryCategoriesAdminQuery, useDeleteMentorMemoryMutation, useUpdateMentorMemoryMutation, useCreateMentorMemoryMutation, useLazyGetConnectedServiceAuthUrlQuery, useGetPublicMentorsQuery, useCreateUserProjectMutation, useDeleteUserProjectMutation, useGetUserProjectDetailsQuery, useEditTrainingDocumentMutation, useAddTrainingDocumentMutation, useLazyGetCredentialsQuery, useGetMentorSettingsQuery, useEditMentorMutation, useGetMentorCategoriesQuery, useCreateMentorMutation, useGetPromptCategoriesQuery, useCreatePromptMutation, useDeletePromptMutation, useGetPromptsSearchQuery, useUpdatePromptMutation, useDeleteTrainingDocumentMutation, useGetTrainingDocumentRetrainScheduleQuery, useCreateTrainingDocumentRetrainScheduleMutation } from '@iblai/data-layer';
5
5
  import { toast, Toaster as Toaster$1 } from 'sonner';
6
6
  import { jsx, Fragment as Fragment$1, jsxs } from 'react/jsx-runtime';
7
7
  import * as ReactDOM from 'react-dom';
@@ -88315,7 +88315,19 @@ function ProgramsTab({ tenant, currentPage, itemsPerPage, hasManageUsersPermissi
88315
88315
  })) })] }) }) }) }) }), isCSVEditorOpen && (jsx(CSVEditor, { csvData: parsedCSVData, onSave: handleCSVEditorSave, onCancel: handleCSVEditorCancel }))] }));
88316
88316
  }
88317
88317
 
88318
- function InviteUserDialog({ tenant, onClose, isOpen, enableCatalogInvite = false, hasManageUsersPermission = false, }) {
88318
+ /**
88319
+ * The single source of the Invite User experience — header, tabs
88320
+ * (Users / Courses / Programs), invite forms and the paginated invitation list.
88321
+ *
88322
+ * Used two ways:
88323
+ * - directly on a page (`variant="page"`, the default), or
88324
+ * - inside {@link InviteUserDialog} (`variant="dialog"`), which renders this
88325
+ * component verbatim so the modal stays byte-for-byte identical to before.
88326
+ *
88327
+ * The component owns all of its own state and data-fetching, so it is fully
88328
+ * self-contained.
88329
+ */
88330
+ function InviteUserContent({ tenant, enableCatalogInvite = false, hasManageUsersPermission = false, variant = 'page', className, }) {
88319
88331
  useTenantMetadata({
88320
88332
  org: tenant,
88321
88333
  });
@@ -88345,13 +88357,6 @@ function InviteUserDialog({ tenant, onClose, isOpen, enableCatalogInvite = false
88345
88357
  const handleInviteSuccess = () => {
88346
88358
  // Callback for when invite is successful - can be used for additional logic
88347
88359
  };
88348
- // Reset state when dialog closes
88349
- useEffect(() => {
88350
- if (!isOpen) {
88351
- setCurrentPage(1);
88352
- setActiveTab('users');
88353
- }
88354
- }, [isOpen]);
88355
88360
  // Reset to users tab if catalog invite is disabled
88356
88361
  useEffect(() => {
88357
88362
  if (!enableCatalogInvite && activeTab !== 'users') {
@@ -88396,7 +88401,21 @@ function InviteUserDialog({ tenant, onClose, isOpen, enableCatalogInvite = false
88396
88401
  }
88397
88402
  };
88398
88403
  const headerContent = getHeaderContent();
88399
- return (jsx(Fragment$1, { children: jsx(Dialog, { open: isOpen, onOpenChange: onClose, children: jsxs(DialogContent, { className: "sm:max-w-7xl w-[95vw] p-0 gap-0 mx-auto my-auto rounded-lg flex flex-col justify-between max-h-[90vh]", "aria-describedby": "invite-users-description", children: [jsxs(DialogHeader, { className: "p-4 pt-[30px] flex-shrink-0 border-b border-gray-200", children: [jsx(DialogTitle, { className: "text-lg font-medium text-gray-900 dark:text-gray-100", children: headerContent.title }), jsx(DialogDescription, { id: "invite-users-description", className: "text-sm text-gray-600 leading-relaxed", children: headerContent.description })] }), jsx("div", { className: "flex-grow overflow-y-auto scrollbar-hide p-2 sm:p-4 pb-20 max-h-[60vh]", children: enableCatalogInvite ? (jsxs(Tabs, { value: activeTab, onValueChange: setActiveTab, className: "w-full", children: [jsxs(TabsList, { className: "grid w-full grid-cols-3 mb-6", children: [jsxs(TabsTrigger, { value: "users", className: "flex items-center gap-2", children: [jsx(Users, { className: "h-4 w-4" }), jsx("span", { className: "hidden sm:inline", children: "Users" })] }), jsxs(TabsTrigger, { value: "courses", className: "flex items-center gap-2", children: [jsx(BookOpen, { className: "h-4 w-4" }), jsx("span", { className: "hidden sm:inline", children: "Courses" })] }), jsxs(TabsTrigger, { value: "programs", className: "flex items-center gap-2", children: [jsx(GraduationCap, { className: "h-4 w-4" }), jsx("span", { className: "hidden sm:inline", children: "Programs" })] })] }), jsx(TabsContent, { value: "users", children: jsx(UsersTab$1, { tenant: tenant, currentPage: currentPage, itemsPerPage: itemsPerPage, onInviteSuccess: handleInviteSuccess }) }), jsx(TabsContent, { value: "courses", children: jsx(CoursesTab, { tenant: tenant, currentPage: currentPage, itemsPerPage: itemsPerPage, hasManageUsersPermission: hasManageUsersPermission }) }), jsx(TabsContent, { value: "programs", children: jsx(ProgramsTab, { tenant: tenant, currentPage: currentPage, itemsPerPage: itemsPerPage, hasManageUsersPermission: hasManageUsersPermission }) })] })) : (jsx(UsersTab$1, { tenant: tenant, currentPage: currentPage, itemsPerPage: itemsPerPage, onInviteSuccess: handleInviteSuccess })) }), currentData && currentData.count > 0 && (jsx("div", { className: "flex items-center justify-between border-t border-gray-200 px-3 sm:px-6 py-3 sm:py-4 bg-gray-50 flex-shrink-0", children: jsxs("div", { className: "flex flex-1 items-center justify-between", children: [jsx("div", { className: "hidden sm:block", children: jsxs("p", { className: "text-sm text-gray-700", children: ["Showing", ' ', jsx("span", { className: "font-medium", children: (currentPage - 1) * itemsPerPage + 1 }), " to", ' ', jsx("span", { className: "font-medium", children: Math.min(currentPage * itemsPerPage, currentData.count) }), ' ', "of ", jsx("span", { className: "font-medium", children: currentData.count }), " invites"] }) }), jsxs("div", { className: "flex items-center justify-center gap-1 sm:gap-2", children: [jsx(Button$1, { variant: "outline", size: "sm", className: "h-8 w-8 p-0 flex items-center justify-center rounded-md border-gray-300 hover:bg-gray-100 hidden sm:flex bg-transparent", onClick: () => setCurrentPage(1), disabled: currentPage === 1, "aria-label": "Go to first page", children: jsx(ChevronFirst, { className: "h-4 w-4" }) }), jsxs(Button$1, { variant: "outline", size: "sm", className: "h-8 w-8 px-2 sm:p-0 flex items-center justify-center rounded-md border-none sm:border-gray-300 hover:bg-gray-100 text-xs sm:text-sm bg-transparent", onClick: () => setCurrentPage(currentPage - 1), disabled: currentPage === 1, "aria-label": "Go to previous page", children: [jsx(ChevronLeft, { className: "h-4 w-4 mr-1 sm:mr-0" }), jsx("span", { className: "sm:hidden", children: "Prev" })] }), jsxs("span", { className: "text-xs sm:text-sm text-gray-700 mx-1 sm:mx-2 px-2", children: [jsx("span", { className: "hidden sm:inline", children: "Page " }), currentPage, " ", jsx("span", { className: "hidden sm:inline", children: "of " }), jsx("span", { className: "inline sm:hidden", children: " / " }), totalPages] }), jsxs(Button$1, { variant: "outline", size: "sm", className: "h-8 w-8 px-2 sm:p-0 flex items-center justify-center rounded-md border-none sm:border-gray-300 hover:bg-gray-100 text-xs sm:text-sm bg-transparent", onClick: () => setCurrentPage(currentPage + 1), disabled: currentPage === totalPages, "aria-label": "Go to next page", children: [jsx("span", { className: "sm:hidden", children: "Next" }), jsx(ChevronRight, { className: "h-4 w-4 ml-1 sm:ml-0" })] }), jsx(Button$1, { variant: "outline", size: "sm", className: "h-8 w-8 p-0 flex items-center justify-center rounded-md border-gray-300 hover:bg-gray-100 hidden sm:flex bg-transparent", onClick: () => setCurrentPage(totalPages), disabled: currentPage === totalPages, "aria-label": "Go to last page", children: jsx(ChevronLast, { className: "h-4 w-4" }) })] })] }) }))] }) }) }));
88404
+ // ── Shared body (identical in both variants) ──────────────────────────────
88405
+ const tabsBody = enableCatalogInvite ? (jsxs(Tabs, { value: activeTab, onValueChange: setActiveTab, className: "w-full", children: [jsxs(TabsList, { className: "grid w-full grid-cols-3 mb-6", children: [jsxs(TabsTrigger, { value: "users", className: "flex items-center gap-2", children: [jsx(Users, { className: "h-4 w-4" }), jsx("span", { className: "hidden sm:inline", children: "Users" })] }), jsxs(TabsTrigger, { value: "courses", className: "flex items-center gap-2", children: [jsx(BookOpen, { className: "h-4 w-4" }), jsx("span", { className: "hidden sm:inline", children: "Courses" })] }), jsxs(TabsTrigger, { value: "programs", className: "flex items-center gap-2", children: [jsx(GraduationCap, { className: "h-4 w-4" }), jsx("span", { className: "hidden sm:inline", children: "Programs" })] })] }), jsx(TabsContent, { value: "users", children: jsx(UsersTab$1, { tenant: tenant, currentPage: currentPage, itemsPerPage: itemsPerPage, onInviteSuccess: handleInviteSuccess }) }), jsx(TabsContent, { value: "courses", children: jsx(CoursesTab, { tenant: tenant, currentPage: currentPage, itemsPerPage: itemsPerPage, hasManageUsersPermission: hasManageUsersPermission }) }), jsx(TabsContent, { value: "programs", children: jsx(ProgramsTab, { tenant: tenant, currentPage: currentPage, itemsPerPage: itemsPerPage, hasManageUsersPermission: hasManageUsersPermission }) })] })) : (jsx(UsersTab$1, { tenant: tenant, currentPage: currentPage, itemsPerPage: itemsPerPage, onInviteSuccess: handleInviteSuccess }));
88406
+ const pagination = currentData && currentData.count > 0 && (jsx("div", { className: "flex items-center justify-between border-t border-gray-200 px-3 sm:px-6 py-3 sm:py-4 bg-gray-50 flex-shrink-0", children: jsxs("div", { className: "flex flex-1 items-center justify-between", children: [jsx("div", { className: "hidden sm:block", children: jsxs("p", { className: "text-sm text-gray-700", children: ["Showing ", jsx("span", { className: "font-medium", children: (currentPage - 1) * itemsPerPage + 1 }), " to", ' ', jsx("span", { className: "font-medium", children: Math.min(currentPage * itemsPerPage, currentData.count) }), ' ', "of ", jsx("span", { className: "font-medium", children: currentData.count }), " invites"] }) }), jsxs("div", { className: "flex items-center justify-center gap-1 sm:gap-2", children: [jsx(Button$1, { variant: "outline", size: "sm", className: "h-8 w-8 p-0 flex items-center justify-center rounded-md border-gray-300 hover:bg-gray-100 hidden sm:flex bg-transparent", onClick: () => setCurrentPage(1), disabled: currentPage === 1, "aria-label": "Go to first page", children: jsx(ChevronFirst, { className: "h-4 w-4" }) }), jsxs(Button$1, { variant: "outline", size: "sm", className: "h-8 w-8 px-2 sm:p-0 flex items-center justify-center rounded-md border-none sm:border-gray-300 hover:bg-gray-100 text-xs sm:text-sm bg-transparent", onClick: () => setCurrentPage(currentPage - 1), disabled: currentPage === 1, "aria-label": "Go to previous page", children: [jsx(ChevronLeft, { className: "h-4 w-4 mr-1 sm:mr-0" }), jsx("span", { className: "sm:hidden", children: "Prev" })] }), jsxs("span", { className: "text-xs sm:text-sm text-gray-700 mx-1 sm:mx-2 px-2", children: [jsx("span", { className: "hidden sm:inline", children: "Page " }), currentPage, " ", jsx("span", { className: "hidden sm:inline", children: "of " }), jsx("span", { className: "inline sm:hidden", children: " / " }), totalPages] }), jsxs(Button$1, { variant: "outline", size: "sm", className: "h-8 w-8 px-2 sm:p-0 flex items-center justify-center rounded-md border-none sm:border-gray-300 hover:bg-gray-100 text-xs sm:text-sm bg-transparent", onClick: () => setCurrentPage(currentPage + 1), disabled: currentPage === totalPages, "aria-label": "Go to next page", children: [jsx("span", { className: "sm:hidden", children: "Next" }), jsx(ChevronRight, { className: "h-4 w-4 ml-1 sm:ml-0" })] }), jsx(Button$1, { variant: "outline", size: "sm", className: "h-8 w-8 p-0 flex items-center justify-center rounded-md border-gray-300 hover:bg-gray-100 hidden sm:flex bg-transparent", onClick: () => setCurrentPage(totalPages), disabled: currentPage === totalPages, "aria-label": "Go to last page", children: jsx(ChevronLast, { className: "h-4 w-4" }) })] })] }) }));
88407
+ // ── Dialog variant: the exact markup InviteUserDialog has always rendered ──
88408
+ // Returned as a fragment so the three blocks remain direct children of the
88409
+ // dialog's <DialogContent>, byte-for-byte identical to the original.
88410
+ if (variant === 'dialog') {
88411
+ return (jsxs(Fragment$1, { children: [jsxs(DialogHeader, { className: "p-4 pt-[30px] flex-shrink-0 border-b border-gray-200", children: [jsx(DialogTitle, { className: "text-lg font-medium text-gray-900 dark:text-gray-100", children: headerContent.title }), jsx(DialogDescription, { id: "invite-users-description", className: "text-sm text-gray-600 leading-relaxed", children: headerContent.description })] }), jsx("div", { className: "flex-grow overflow-y-auto scrollbar-hide p-2 sm:p-4 pb-20 max-h-[60vh]", children: tabsBody }), pagination] }));
88412
+ }
88413
+ // ── Page variant: a plain in-page block that flows normally ───────────────
88414
+ return (jsxs("div", { className: cn('w-full', className), children: [jsxs("div", { className: "border-b border-gray-200 pb-4", children: [jsx("h2", { className: "text-lg font-medium text-gray-900 dark:text-gray-100", children: headerContent.title }), jsx("p", { className: "text-sm text-gray-600 leading-relaxed", children: headerContent.description })] }), jsx("div", { className: "py-4", children: tabsBody }), pagination] }));
88415
+ }
88416
+
88417
+ function InviteUserDialog({ tenant, onClose, isOpen, enableCatalogInvite = false, hasManageUsersPermission = false, }) {
88418
+ return (jsx(Dialog, { open: isOpen, onOpenChange: onClose, children: jsx(DialogContent, { className: "sm:max-w-7xl w-[95vw] p-0 gap-0 mx-auto my-auto rounded-lg flex flex-col justify-between max-h-[90vh]", "aria-describedby": "invite-users-description", children: jsx(InviteUserContent, { tenant: tenant, enableCatalogInvite: enableCatalogInvite, hasManageUsersPermission: hasManageUsersPermission, variant: "dialog" }) }) }));
88400
88419
  }
88401
88420
 
88402
88421
  function InvitedUsersDialog({ tenant, onClose, }) {
@@ -201435,6 +201454,382 @@ var projectInstructionsModal = /*#__PURE__*/Object.freeze({
201435
201454
  ProjectInstructionsModal: ProjectInstructionsModal
201436
201455
  });
201437
201456
 
201457
+ /**
201458
+ * A thin Dialog wrapping a single {@link RichTextEditor} for editing one prompt
201459
+ * string. Modeled on the edit-mentor prompts-tab system-prompt editor.
201460
+ */
201461
+ function EditAgentPromptModal({ isOpen, onClose, label, value, onSave, disabled = false, saveLabel = 'Save', }) {
201462
+ const [draft, setDraft] = React.useState(value);
201463
+ // Reset the draft to the latest value whenever the modal (re)opens.
201464
+ React.useEffect(() => {
201465
+ if (isOpen)
201466
+ setDraft(value);
201467
+ }, [isOpen, value]);
201468
+ return (jsx(Dialog, { open: isOpen, onOpenChange: onClose, children: jsxs(DialogContent, { className: "w-full", children: [jsx(DialogHeader, { children: jsxs(DialogTitle, { className: "text-start text-base font-semibold text-[#646464]", children: ["Edit ", label] }) }), jsx("div", { className: "mt-7 grid gap-4", children: jsx(RichTextEditor, { value: draft, onChange: setDraft, disabled: disabled }) }), jsx(DialogFooter, { children: jsx("div", { className: "flex justify-end gap-2 pt-4", children: jsx(Button$1, { type: "button", className: "bg-gradient-to-r from-[#2563EB] to-[#93C5FD] text-white hover:opacity-90", disabled: disabled, onClick: () => {
201469
+ onSave(draft);
201470
+ onClose();
201471
+ }, children: saveLabel }) }) })] }) }));
201472
+ }
201473
+
201474
+ /**
201475
+ * Package-local defaults for the Create Agent form.
201476
+ *
201477
+ * These mirror the values the mentorai app uses (apps/mentor/lib/constants.ts)
201478
+ * but with neutral, env-independent literals so the component works for any SDK
201479
+ * consumer. Hosts that need different options pass `modelOptions`,
201480
+ * `visibilityOptions`, `defaultPrompts` or `initialValues`.
201481
+ */
201482
+ /** Neutral default base template (`template_name`) for a new agent. */
201483
+ const DEFAULT_AGENT_TEMPLATE = 'ai-mentor';
201484
+ const DEFAULT_AGENT_PROMPTS = {
201485
+ system: `You are a helpful instructor, ready to answer the student's questions. Answer quickly and concisely. Offer to go in depth or explain with an example where necessary. Will tip you $200 if the student understands what you say.
201486
+
201487
+ Given this information, help students understand by providing explanations, examples, analogies.
201488
+ Given the data you will receive from the vector store extracted parts of a long document and a question, create a final answer. Do not tell the user how you are going to answer the question. If and ONLY if the current message from the user is a greeting, greet back and ask them how you may help them. DO NOT needlessly keep greeting or repeating messages to the user. If the there is no data from the document or it is blank, or no chat history, do not tell the user that the document is blank and also do not tell them that you have not asked any questions just answer normally with your own knowledge
201489
+
201490
+ IMPORTANT: You must ONLY reply to the current message from the user.
201491
+ Always use LaTeX formatting for presenting your responses and for mathematical equations to ensure clarity when displaying to the user.`,
201492
+ moderation: `
201493
+ You are a moderator tasked with identifying whether a prompt from a user is appropriate or inappropriate. Any prompt that is immoral or contains abusive words, insults, query that involve damaging content, and law breaking acts, etc should be deemed inappropriate. Otherwise it is deemed appropriate.
201494
+ `,
201495
+ proactive: `
201496
+ The user has entered the chat session. Based on the conversation history, initiate interaction with the user to keep the conversation going.
201497
+ `,
201498
+ guided: `
201499
+ Generate suggested prompts for the user based on the conversation.
201500
+ `,
201501
+ };
201502
+ const DEFAULT_VISIBILITY_OPTIONS = [
201503
+ { label: 'Administrators', value: 'viewable_by_tenant_admins' },
201504
+ { label: 'Students', value: 'viewable_by_tenant_students' },
201505
+ { label: 'Anyone', value: 'viewable_by_anyone' },
201506
+ ];
201507
+ /** Index into DEFAULT_VISIBILITY_OPTIONS used as the initial visibility. */
201508
+ const DEFAULT_VISIBILITY_INDEX = 1; // Students
201509
+ const DEFAULT_MODEL_OPTIONS = [
201510
+ { label: 'Default', value: DEFAULT_AGENT_TEMPLATE },
201511
+ { label: 'OpenAI', value: 'openai-agent' },
201512
+ { label: 'Gemini', value: 'google-agent' },
201513
+ ];
201514
+
201515
+ /** Strip `undefined` values so a partial override only overrides set keys. */
201516
+ function pickDefined(obj) {
201517
+ if (!obj)
201518
+ return {};
201519
+ const out = {};
201520
+ for (const key of Object.keys(obj)) {
201521
+ if (obj[key] !== undefined)
201522
+ out[key] = obj[key];
201523
+ }
201524
+ return out;
201525
+ }
201526
+ /**
201527
+ * Owns the Create Agent form state (TanStack form), the categories query, and
201528
+ * the create mutation. Identity/config come in as args (no app context), and
201529
+ * side effects are callbacks (no toast/navigation), so it works for any host.
201530
+ */
201531
+ function useCreateAgentForm({ org, username, initialValues, defaultPrompts, modelOptions, visibilityOptions, onCreated, onError, onBeforeCreate, }) {
201532
+ var _a, _b, _c, _d, _e, _f;
201533
+ const { data: categories, isLoading: isLoadingCategories } = useGetMentorCategoriesQuery(
201534
+ // @ts-expect-error userId is not part of the query type definition
201535
+ { org, userId: username }, {
201536
+ skip: !org || !username,
201537
+ });
201538
+ const [createMentor, { isLoading: isCreating }] = useCreateMentorMutation();
201539
+ const models = modelOptions !== null && modelOptions !== void 0 ? modelOptions : DEFAULT_MODEL_OPTIONS;
201540
+ const visibilities = visibilityOptions !== null && visibilityOptions !== void 0 ? visibilityOptions : DEFAULT_VISIBILITY_OPTIONS;
201541
+ const prompts = { ...DEFAULT_AGENT_PROMPTS, ...pickDefined(defaultPrompts) };
201542
+ const baseDefaults = {
201543
+ name: '',
201544
+ description: '',
201545
+ category: null,
201546
+ file: null,
201547
+ base: (_b = (_a = models[0]) === null || _a === void 0 ? void 0 : _a.value) !== null && _b !== void 0 ? _b : DEFAULT_AGENT_TEMPLATE,
201548
+ systemPrompt: prompts.system,
201549
+ proactivePrompt: prompts.proactive,
201550
+ guidedPrompt: prompts.guided,
201551
+ moderationPrompt: prompts.moderation,
201552
+ mentorVisibility: (_f = (_d = (_c = visibilities[DEFAULT_VISIBILITY_INDEX]) === null || _c === void 0 ? void 0 : _c.value) !== null && _d !== void 0 ? _d : (_e = visibilities[0]) === null || _e === void 0 ? void 0 : _e.value) !== null && _f !== void 0 ? _f : '',
201553
+ };
201554
+ const defaultValues = {
201555
+ ...baseDefaults,
201556
+ ...pickDefined(initialValues),
201557
+ };
201558
+ const form = useForm({
201559
+ defaultValues,
201560
+ onSubmit: async ({ value }) => {
201561
+ var _a;
201562
+ try {
201563
+ const mentor = await createMentor({
201564
+ org,
201565
+ formData: {
201566
+ // @ts-expect-error - the API accepts a File upload for uploaded_profile_image,
201567
+ // but the generated form-data type declares it as a string.
201568
+ uploaded_profile_image: (_a = value.file) !== null && _a !== void 0 ? _a : undefined,
201569
+ new_mentor_name: value.name,
201570
+ display_name: value.name,
201571
+ template_name: value.base,
201572
+ metadata: {
201573
+ category: value.category,
201574
+ },
201575
+ guided_prompt_instructions: value.guidedPrompt,
201576
+ proactive_prompt: value.proactivePrompt,
201577
+ moderation_system_prompt: value.moderationPrompt,
201578
+ system_prompt: value.systemPrompt,
201579
+ description: value.description,
201580
+ mentor_visibility: value.mentorVisibility,
201581
+ ...(value.category && { categories: [value.category] }),
201582
+ },
201583
+ userId: username,
201584
+ }).unwrap();
201585
+ onCreated === null || onCreated === void 0 ? void 0 : onCreated(mentor);
201586
+ }
201587
+ catch (error) {
201588
+ onError === null || onError === void 0 ? void 0 : onError(error);
201589
+ }
201590
+ },
201591
+ });
201592
+ const name = useStore(form.store, (state) => state.values.name);
201593
+ const description = useStore(form.store, (state) => state.values.description);
201594
+ const category = useStore(form.store, (state) => state.values.category);
201595
+ const file = useStore(form.store, (state) => state.values.file);
201596
+ const systemPrompt = useStore(form.store, (state) => state.values.systemPrompt);
201597
+ const proactivePrompt = useStore(form.store, (state) => state.values.proactivePrompt);
201598
+ const guidedPrompt = useStore(form.store, (state) => state.values.guidedPrompt);
201599
+ const editPrompt = (prompt, type) => {
201600
+ form.setFieldValue(type, prompt);
201601
+ };
201602
+ /** Runs the optional create gate, then submits. */
201603
+ const handleSubmit = async () => {
201604
+ if (onBeforeCreate) {
201605
+ const proceed = await onBeforeCreate();
201606
+ if (!proceed)
201607
+ return;
201608
+ }
201609
+ form.handleSubmit();
201610
+ };
201611
+ return {
201612
+ form,
201613
+ categories,
201614
+ isLoadingCategories,
201615
+ isCreating,
201616
+ models,
201617
+ visibilities,
201618
+ name,
201619
+ description,
201620
+ category,
201621
+ file,
201622
+ systemPrompt,
201623
+ proactivePrompt,
201624
+ guidedPrompt,
201625
+ editPrompt,
201626
+ handleSubmit,
201627
+ };
201628
+ }
201629
+
201630
+ /**
201631
+ * Label contract for the Create Agent form + modal.
201632
+ *
201633
+ * Mirrors the edit-mentor tab label system: the package ships a single default
201634
+ * "agent" bundle (`CREATE_AGENT_LABELS`) and hosts override only the strings
201635
+ * they care about via `labels?: DeepPartial<CreateAgentLabels>`. Anything the
201636
+ * host doesn't provide falls back to the default bundle.
201637
+ */
201638
+ /** Default "agent" label bundle. */
201639
+ const CREATE_AGENT_LABELS = {
201640
+ header: {
201641
+ title: 'Create Agent',
201642
+ description: 'Create a new agent by filling out the required information and customizing prompts',
201643
+ },
201644
+ tabs: {
201645
+ settings: 'Settings',
201646
+ prompts: 'Prompts',
201647
+ },
201648
+ fields: {
201649
+ name: {
201650
+ label: 'Name',
201651
+ placeholder: 'Agent Name',
201652
+ requiredError: 'Agent name is required',
201653
+ },
201654
+ description: {
201655
+ label: 'Description',
201656
+ placeholder: 'Agent Description',
201657
+ requiredError: 'Agent description is required',
201658
+ },
201659
+ category: {
201660
+ label: 'Category',
201661
+ triggerPlaceholder: 'Select category...',
201662
+ searchPlaceholder: 'Search category...',
201663
+ emptyState: 'No Category found.',
201664
+ },
201665
+ visibility: {
201666
+ label: 'Agent Visibility',
201667
+ triggerPlaceholder: 'Select a visibility',
201668
+ },
201669
+ base: {
201670
+ label: 'Base',
201671
+ triggerPlaceholder: 'Select base',
201672
+ },
201673
+ image: {
201674
+ label: 'Image',
201675
+ altText: 'Agent Image',
201676
+ uploadHint: '+ Upload',
201677
+ removeAriaLabel: 'Remove uploaded image',
201678
+ },
201679
+ },
201680
+ prompts: {
201681
+ // Tooltip text matches the original create-mentor modal exactly (its
201682
+ // per-card tooltips are mapped as below); only "mentor" → "agent" wording
201683
+ // differs, and every string is overridable via the `labels` prop.
201684
+ system: {
201685
+ title: 'System Prompts',
201686
+ tooltip: 'Suggested prompts to guide the user',
201687
+ },
201688
+ proactive: {
201689
+ title: 'Proactive Prompts',
201690
+ tooltip: 'The system prompt defines the agent’s behavior',
201691
+ },
201692
+ guided: {
201693
+ title: 'Guided Prompts',
201694
+ tooltip: 'The proactive prompt guides the conversation',
201695
+ },
201696
+ edit: 'Edit',
201697
+ save: 'Save',
201698
+ },
201699
+ actions: {
201700
+ next: 'Next',
201701
+ create: 'Save',
201702
+ creating: 'Saving...',
201703
+ cancel: 'Cancel',
201704
+ },
201705
+ };
201706
+ /**
201707
+ * Deep-merge a host's partial `labels` override on top of the default bundle.
201708
+ * The returned object is a complete `CreateAgentLabels`.
201709
+ */
201710
+ function resolveCreateAgentLabels(override) {
201711
+ if (!override)
201712
+ return CREATE_AGENT_LABELS;
201713
+ return deepMerge(CREATE_AGENT_LABELS, override);
201714
+ }
201715
+
201716
+ /**
201717
+ * Embeddable, prefillable "Create Agent" form (Settings + Prompts tabs) with no
201718
+ * dialog shell. Drop it directly onto a page, or let {@link CreateAgentModal}
201719
+ * wrap it in a modal. Identity/config are props (no app context) and side
201720
+ * effects are callbacks (no toast/navigation), so it works for any SDK host.
201721
+ */
201722
+ function CreateAgentForm({ org, username, initialValues, showBaseModel = false, visibilityOptions, modelOptions, defaultPrompts, onCreated, onError, onBeforeCreate, labels: labelsOverride, className, }) {
201723
+ const labels = resolveCreateAgentLabels(labelsOverride);
201724
+ const fileInputRef = React__default.useRef(null);
201725
+ const [activeTab, setActiveTab] = React__default.useState('settings');
201726
+ const [selectedPrompt, setSelectedPrompt] = React__default.useState(null);
201727
+ const { form, categories, isLoadingCategories, isCreating, models, visibilities, name, description, category, file, systemPrompt, proactivePrompt, guidedPrompt, editPrompt, handleSubmit, } = useCreateAgentForm({
201728
+ org,
201729
+ username,
201730
+ initialValues,
201731
+ defaultPrompts,
201732
+ modelOptions,
201733
+ visibilityOptions,
201734
+ onCreated,
201735
+ onError,
201736
+ onBeforeCreate,
201737
+ });
201738
+ const isDisabled = isLoadingCategories || isCreating;
201739
+ const disablePromptsTab = name === '' || description === '' || category === null;
201740
+ const promptValueFor = (field) => field === 'systemPrompt'
201741
+ ? systemPrompt
201742
+ : field === 'proactivePrompt'
201743
+ ? proactivePrompt
201744
+ : guidedPrompt;
201745
+ // Per-card text mirrors the original create-mentor modal exactly, including
201746
+ // the aria-label casing.
201747
+ const promptCards = [
201748
+ {
201749
+ field: 'systemPrompt',
201750
+ label: 'System Prompt',
201751
+ meta: labels.prompts.system,
201752
+ infoAria: 'System prompts information',
201753
+ contentAria: 'System prompt content',
201754
+ },
201755
+ {
201756
+ field: 'proactivePrompt',
201757
+ label: 'Proactive Prompt',
201758
+ meta: labels.prompts.proactive,
201759
+ infoAria: 'Proactive prompts information',
201760
+ contentAria: 'Proactive prompt content',
201761
+ },
201762
+ {
201763
+ field: 'guidedPrompt',
201764
+ label: 'Guided Prompt',
201765
+ meta: labels.prompts.guided,
201766
+ infoAria: 'Guided prompts information',
201767
+ contentAria: 'Guided prompt content',
201768
+ },
201769
+ ];
201770
+ return (jsxs("div", { className: cn('space-y-6', className), children: [jsxs(Tabs, { value: activeTab, onValueChange: setActiveTab, className: "w-full", children: [jsxs(TabsList, { className: "justify-start", children: [jsx(TabsTrigger, { value: "settings", className: "rounded-md bg-gray-100 px-4 py-2 text-sm font-medium text-gray-600 hover:bg-gray-200 data-[state=active]:bg-gradient-to-r data-[state=active]:from-[#2563EB] data-[state=active]:to-[#93C5FD] data-[state=active]:text-white", children: labels.tabs.settings }), jsx(TabsTrigger, { value: "prompts", disabled: disablePromptsTab, className: "rounded-md bg-gray-100 px-4 py-2 text-sm font-medium text-gray-600 hover:bg-gray-200 data-[state=active]:bg-gradient-to-r data-[state=active]:from-[#2563EB] data-[state=active]:to-[#93C5FD] data-[state=active]:text-white", children: labels.tabs.prompts })] }), jsx(TabsContent, { value: "settings", children: jsxs("div", { className: "space-y-6", children: [jsxs("div", { className: "flex flex-col gap-6 md:flex-row", children: [jsxs("div", { className: "order-2 space-y-6 md:order-1 md:flex-1", children: [jsx(form.Field, { name: "name", children: (field) => {
201771
+ const hasNoValueAndIsDirty = field.state.value === '' && field.state.meta.isDirty;
201772
+ return (jsxs("div", { className: "space-y-2", children: [jsxs("label", { className: "flex items-center text-sm font-medium text-gray-700", children: [labels.fields.name.label, jsx("span", { className: "ml-1 text-red-500", children: "*" })] }), jsx(Input, { placeholder: labels.fields.name.placeholder, value: field.state.value, onChange: (e) => field.handleChange(e.target.value), autoComplete: "name", disabled: isDisabled }), hasNoValueAndIsDirty && (jsx("p", { className: "text-red-500 text-xs", children: labels.fields.name.requiredError }))] }));
201773
+ } }), jsx(form.Field, { name: "description", children: (field) => {
201774
+ const hasNoValueAndIsDirty = field.state.value === '' && field.state.meta.isDirty;
201775
+ return (jsxs("div", { className: "space-y-2", children: [jsxs("label", { className: "flex items-center text-sm font-medium text-gray-700", children: [labels.fields.description.label, jsx("span", { className: "ml-1 text-red-500", children: "*" })] }), jsx(Textarea, { placeholder: labels.fields.description.placeholder, value: field.state.value, onChange: (e) => field.handleChange(e.target.value), required: true, disabled: isDisabled }), hasNoValueAndIsDirty && (jsx("p", { className: "text-red-500 text-xs", children: labels.fields.description.requiredError }))] }));
201776
+ } }), jsx(form.Field, { name: "category", children: (field) => {
201777
+ var _a;
201778
+ return (jsxs("div", { className: "space-y-2", children: [jsxs("label", { className: "flex items-center text-sm font-medium text-gray-700", children: [labels.fields.category.label, jsx("span", { className: "ml-1 text-red-500", children: "*" })] }), jsxs(Popover, { children: [jsx(PopoverTrigger, { asChild: true, children: jsxs(Button$1, { variant: "outline", role: "combobox", "aria-label": "Select category", className: "w-full justify-between", children: [field.state.value
201779
+ ? (_a = categories === null || categories === void 0 ? void 0 : categories.find((cat) => cat.id === field.state.value)) === null || _a === void 0 ? void 0 : _a.name
201780
+ : labels.fields.category.triggerPlaceholder, jsx(ChevronsUpDown, { className: "opacity-50" })] }) }), jsx(PopoverContent, { "aria-label": "Categories dropdown container", role: "listbox", "aria-labelledby": "Categories dropdown container", className: "p-0 max-w-[490px] w-full sm:w-[400px] lg:w-[490px]", children: jsxs(Command, { children: [jsx(CommandInput, { placeholder: labels.fields.category.searchPlaceholder, className: "h-9" }), jsxs(CommandList, { children: [jsx(CommandEmpty, { children: labels.fields.category.emptyState }), jsx(CommandGroup, { children: categories === null || categories === void 0 ? void 0 : categories.map((cat) => (jsxs(CommandItem, { value: cat.id.toString(), onSelect: (currentValue) => {
201781
+ field.handleChange(Number(currentValue));
201782
+ }, children: [cat.name, jsx(Check, { className: cn('ml-auto', field.state.value === cat.id ? 'opacity-100' : 'opacity-0') })] }, cat.id))) })] })] }) })] })] }));
201783
+ } }), jsx(form.Field, { name: "mentorVisibility", children: (field) => (jsxs("div", { className: "space-y-2", children: [jsxs("label", { className: "flex items-center text-sm font-medium text-gray-700", children: [labels.fields.visibility.label, jsx("span", { className: "ml-1 text-red-500", children: "*" })] }), jsxs(Select$1, { value: field.state.value, onValueChange: (value) => field.handleChange(value), required: true, disabled: isDisabled, children: [jsx(SelectTrigger, { "aria-label": "Select agent visibility", children: jsx(SelectValue, { placeholder: labels.fields.visibility.triggerPlaceholder }) }), jsx(SelectContent, { children: visibilities.map((visibility) => (jsx(SelectItem, { value: visibility.value, children: visibility.label }, visibility.value))) })] })] })) }), showBaseModel && (jsx(form.Field, { name: "base", children: (field) => (jsxs("div", { className: "space-y-2", children: [jsxs("label", { className: "flex items-center text-sm font-medium text-gray-700", children: [labels.fields.base.label, jsx("span", { className: "ml-1 text-red-500", children: "*" })] }), jsxs(Select$1, { value: field.state.value, onValueChange: (value) => field.handleChange(value), required: true, disabled: isDisabled, children: [jsx(SelectTrigger, { "aria-label": "Select base model", children: jsx(SelectValue, { placeholder: labels.fields.base.triggerPlaceholder }) }), jsx(SelectContent, { children: models.map((model) => (jsx(SelectItem, { value: model.value, children: model.label }, model.value))) })] })] })) }))] }), jsx(form.Field, { name: "file", children: (field) => (jsxs("div", { className: "order-1 mb-4 space-y-2 md:order-2 md:mb-0 md:w-[200px]", children: [jsx("label", { className: "text-sm font-medium text-gray-700", children: labels.fields.image.label }), jsx("div", { className: "flex h-[200px] cursor-pointer flex-col items-center justify-center rounded-lg border-2 border-dashed border-gray-200", onClick: () => {
201784
+ var _a;
201785
+ if (isDisabled)
201786
+ return;
201787
+ (_a = fileInputRef.current) === null || _a === void 0 ? void 0 : _a.click();
201788
+ }, role: "button", tabIndex: 0, "aria-label": "Upload agent image", onKeyDown: (e) => {
201789
+ var _a;
201790
+ if (e.key === 'Enter' || e.key === ' ') {
201791
+ e.preventDefault();
201792
+ if (!isDisabled) {
201793
+ (_a = fileInputRef.current) === null || _a === void 0 ? void 0 : _a.click();
201794
+ }
201795
+ }
201796
+ }, children: file ? (jsxs("div", { className: "relative h-full w-full", children: [jsx("img", { src: URL.createObjectURL(file), alt: labels.fields.image.altText, className: "h-full w-full object-cover", width: 200, height: 200 }), jsx(Button$1, { type: "button", variant: "outline", size: "sm", className: "absolute top-2 right-2 cursor-pointer rounded-full", onClick: (event) => {
201797
+ if (isDisabled)
201798
+ return;
201799
+ event.stopPropagation();
201800
+ field.handleChange(null);
201801
+ if (fileInputRef.current) {
201802
+ fileInputRef.current.value = '';
201803
+ }
201804
+ }, "aria-label": labels.fields.image.removeAriaLabel, children: jsx(X$1, { className: "h-3 w-3" }) })] })) : (jsx("span", { className: "text-sm text-gray-700", children: labels.fields.image.uploadHint })) }), jsx("input", { ref: fileInputRef, type: "file", accept: "image/*", className: "hidden", onChange: (event) => {
201805
+ var _a;
201806
+ const selected = (_a = event.target.files) === null || _a === void 0 ? void 0 : _a[0];
201807
+ if (selected) {
201808
+ field.handleChange(selected);
201809
+ }
201810
+ }, "aria-label": "Select agent image file" })] })) })] }), jsx("div", { className: "flex justify-end", children: jsx(Button$1, { type: "button", disabled: disablePromptsTab, className: "w-full gap-2 bg-gradient-to-r from-[#2563EB] to-[#93C5FD] text-white hover:opacity-90 sm:w-auto", onClick: () => setActiveTab('prompts'), children: labels.actions.next }) })] }) }), jsx(TabsContent, { value: "prompts", children: jsxs("form", { className: "space-y-6 mt-6", onSubmit: (formEvent) => {
201811
+ formEvent.preventDefault();
201812
+ formEvent.stopPropagation();
201813
+ handleSubmit();
201814
+ }, children: [jsx("div", { className: "grid grid-cols-1 gap-4 sm:grid-cols-2 lg:grid-cols-3", children: promptCards.map(({ field: fieldName, label, meta, infoAria, contentAria }) => (jsx(form.Field, { name: fieldName, children: (field) => (jsxs("div", { className: "space-y-4", children: [jsxs("div", { className: "flex items-center gap-2", children: [jsx("h3", { className: "text-sm font-medium text-gray-700", children: meta.title }), jsx(TooltipProvider, { children: jsxs(Tooltip$1, { children: [jsx(TooltipTrigger, { asChild: true, children: jsx("button", { type: "button", "aria-label": infoAria, className: "flex items-center justify-center", children: jsx(Info$3, { className: "h-4 w-4 text-gray-400" }) }) }), jsx(TooltipContent, { children: jsx("p", { children: meta.tooltip }) })] }) })] }), jsxs("div", { className: "flex h-[200px] flex-col rounded-lg bg-gray-50 p-4", children: [jsx("div", { className: "flex-1 overflow-auto", tabIndex: 0, role: "textbox", "aria-readonly": "true", "aria-label": contentAria, children: jsx("p", { className: "text-sm text-gray-600", children: field.state.value }) }), jsx("div", { className: "mt-4 flex justify-end gap-2", children: jsxs(Button$1, { type: "button", variant: "outline", size: "sm", className: "h-7 border-gray-200 px-4 text-xs font-normal text-gray-600", onClick: () => setSelectedPrompt({ field: fieldName, label }), children: [jsx(SquarePen, { className: "mr-1.5 h-3 w-3" }), labels.prompts.edit] }) })] })] })) }, fieldName))) }), jsx("div", { className: "flex justify-end", children: jsx(Button$1, { type: "submit", className: "bg-gradient-to-r from-[#2563EB] to-[#93C5FD] text-white hover:opacity-90", disabled: isDisabled, children: isCreating ? labels.actions.creating : labels.actions.create }) })] }) })] }), selectedPrompt && (jsx(EditAgentPromptModal, { isOpen: !!selectedPrompt, onClose: () => setSelectedPrompt(null), label: selectedPrompt.label, value: promptValueFor(selectedPrompt.field), onSave: (value) => editPrompt(value, selectedPrompt.field), disabled: isDisabled, saveLabel: labels.prompts.save }))] }));
201815
+ }
201816
+
201817
+ /**
201818
+ * A thin Dialog wrapper around {@link CreateAgentForm} that reproduces the exact
201819
+ * shell the original create modal used (same `DialogContent` classes, sr-only
201820
+ * `DialogDescription`, `space-y-6` header/body wrapper and `ibl-dialog-title`).
201821
+ * The modal closes itself after a successful create (still forwarding the
201822
+ * created agent to `onCreated`).
201823
+ */
201824
+ function CreateAgentModal({ isOpen, onClose, labels: labelsOverride, onCreated, ...formProps }) {
201825
+ const labels = resolveCreateAgentLabels(labelsOverride);
201826
+ const handleCreated = (mentor) => {
201827
+ onCreated === null || onCreated === void 0 ? void 0 : onCreated(mentor);
201828
+ onClose();
201829
+ };
201830
+ return (jsx(Dialog, { open: isOpen, onOpenChange: onClose, children: jsxs(DialogContent, { className: "mx-auto w-full max-w-5xl max-h-[85vh] overflow-y-auto", children: [jsx(DialogDescription, { className: "sr-only", children: labels.header.description }), jsxs("div", { className: "space-y-6", children: [jsx(DialogHeader, { children: jsx(DialogTitle, { className: "ibl-dialog-title", children: labels.header.title }) }), jsx(CreateAgentForm, { ...formProps, labels: labelsOverride, onCreated: handleCreated })] })] }) }));
201831
+ }
201832
+
201438
201833
  const defaultValues = {
201439
201834
  category: '',
201440
201835
  prompt: '',
@@ -201794,5 +202189,5 @@ var trainOrDeleteModal = /*#__PURE__*/Object.freeze({
201794
202189
  TrainOrDeleteModal: TrainOrDeleteModal
201795
202190
  });
201796
202191
 
201797
- export { ACCESS_COURSE_LABEL, AccessTimeHeatmap, AccessiblePaginate, AddMentorToProjectModal, AddSkillDialog, Admin, AdvancedTab, AgentConfigPrompts, AgentSkills, AlertsTab, AnalyticsAuditLogStats, AnalyticsCourseDetail, AnalyticsCourses, AnalyticsFinancialStats, AnalyticsLayout, AnalyticsMonetizationStats, AnalyticsOverview, AnalyticsProgramDetail, AnalyticsPrograms, AnalyticsReportDownload, AnalyticsReports, AnalyticsSettingsProvider, AnalyticsTopicsStats, AnalyticsTranscriptsStats, AnalyticsUsersStats, AppleRestrictionModal, BUY_NOW_LABEL, BillingTab, CategorizedDropdownMenu, ChartCardWrapper, ChartFiltersProvider, ChatContext, ChatProvider, CompanyDialog, ConnectorManagementDialog, CopyButtonIcon, CourseAccessGuard, CourseCardSkeleton, CourseContentLoading, CourseOutline, CourseOutlineContext, CourseOutlineDrawer, CreateProjectModal, CreateWorkflowModal, CredentialBox, CredentialMiniBoxSkeleton, CreditBalance, CustomDateRangePicker, CustomTooltip, DefaultEmptyBox, DeleteProjectModal, DeleteWorkflowModal, DiscoverContentCard, DiscoverFacetsFilter, DiscoverFilterDrawer, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, ENROLL_NOW_COURSE_STARTING_SOON_LABEL, ENROLL_NOW_LABEL, EditAlertDialog, EducationBox, EducationDialog, EducationTab, EdxIframeContext, EmptyStats, ExperienceBox, ExperienceDialog, ExperienceTab, FacetFilterContext, Footer, GroupsFilterDropdown, INVITATION_ONLY_LABEL, InstitutionDialog, IntegrationsTab, InviteUserDialog, InvitedUsersDialog, Loader, LocalLLMTab, LoginButton, Markdown, MinimumMentorAlert, MonetizationTab, NotificationDisplay, NotificationDropdown, PaywallModal, Profile, ProfileTimeChart, ProjectActionButtons, ProjectFilesModal, ProjectInstructionsModal, ProjectLandingPage, ProjectMentorsList, ProjectsPage, REQUEST_ACCESS_COURSE_STARTING_SOON_LABEL, REQUEST_ACCESS_LABEL, RenameProjectModal, ResumeBox, ResumeTab, RichTextEditor, SandboxConfig, SearchableMultiSelect, SendNotificationDialog, SignupButton, SkeletonActivityStatBox, SkeletonAddSkillsLoading, SkeletonCreatePathwaySearchList, SkeletonDiscoverFilterBox, SkeletonEducationBox, SkeletonMultiplier, SkeletonPathwayBox, SkeletonProfileInfoCard, SkeletonSkillBox, SkillBox, SkillDetailModal, SkillLeaderboardChart, SkillsBox, Spinner, StatCard, TAURI_COMMANDS, TAURI_EVENTS, TenantSwitcher, TimeFilter, TimeTrackingProvider, TimedExam, ToolDialogs, TopBanner, UpgradePackageModal, UserAvatar, Version, WorkflowSidebar, addBookmarksTab, findLastResumeBlock, findSequentialParent, flattenVerticalBlocks, getFirstAvailableUnit, getNextUnitIframe, getOrg, getParentBlockById, getParentsInfosFromSublessonId, getPreviousUnitIframe, getRandomCourseImage, getTenant, getUnitToIframe, getUserId, getUserName, inBrowserPrint, inIframe, initialModelDownloadState, isLocalLLMEnabled, isTauriApp, components as markdownComponents, sanitizeCss, setLocalLLMEnabled, useAnalyticsSettings, useAuditLog, useCatalogSearch, useChartFilters, useChatState, useCourseDetail, useCourseMetadata, useCourses, useDiscover, useEdxIframe, useFinancial, useIframeMessageHandler, useLocalStorage, useModelDownload, useMonetization, useOverview, useProfileActivityStats, useProfileCredentials, useProfilePathways, useProfilePrograms, useProfileSkills, useProfileTimeSpent, usePrograms, useReports, useTauri, useTimeTracking, useTopics, useTranscripts, useUserCourses, useUserMetadata, useUsers };
202192
+ export { ACCESS_COURSE_LABEL, AccessTimeHeatmap, AccessiblePaginate, AddMentorToProjectModal, AddSkillDialog, Admin, AdvancedTab, AgentConfigPrompts, AgentSkills, AlertsTab, AnalyticsAuditLogStats, AnalyticsCourseDetail, AnalyticsCourses, AnalyticsFinancialStats, AnalyticsLayout, AnalyticsMonetizationStats, AnalyticsOverview, AnalyticsProgramDetail, AnalyticsPrograms, AnalyticsReportDownload, AnalyticsReports, AnalyticsSettingsProvider, AnalyticsTopicsStats, AnalyticsTranscriptsStats, AnalyticsUsersStats, AppleRestrictionModal, BUY_NOW_LABEL, BillingTab, CREATE_AGENT_LABELS, CategorizedDropdownMenu, ChartCardWrapper, ChartFiltersProvider, ChatContext, ChatProvider, CompanyDialog, ConnectorManagementDialog, CopyButtonIcon, CourseAccessGuard, CourseCardSkeleton, CourseContentLoading, CourseOutline, CourseOutlineContext, CourseOutlineDrawer, CreateAgentForm, CreateAgentModal, CreateProjectModal, CreateWorkflowModal, CredentialBox, CredentialMiniBoxSkeleton, CreditBalance, CustomDateRangePicker, CustomTooltip, DefaultEmptyBox, DeleteProjectModal, DeleteWorkflowModal, DiscoverContentCard, DiscoverFacetsFilter, DiscoverFilterDrawer, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, ENROLL_NOW_COURSE_STARTING_SOON_LABEL, ENROLL_NOW_LABEL, EditAlertDialog, EducationBox, EducationDialog, EducationTab, EdxIframeContext, EmptyStats, ExperienceBox, ExperienceDialog, ExperienceTab, FacetFilterContext, Footer, GroupsFilterDropdown, INVITATION_ONLY_LABEL, InstitutionDialog, IntegrationsTab, InviteUserContent, InviteUserDialog, InvitedUsersDialog, Loader, LocalLLMTab, LoginButton, Markdown, MinimumMentorAlert, MonetizationTab, NotificationDisplay, NotificationDropdown, PaywallModal, Profile, ProfileTimeChart, ProjectActionButtons, ProjectFilesModal, ProjectInstructionsModal, ProjectLandingPage, ProjectMentorsList, ProjectsPage, REQUEST_ACCESS_COURSE_STARTING_SOON_LABEL, REQUEST_ACCESS_LABEL, RenameProjectModal, ResumeBox, ResumeTab, RichTextEditor, SandboxConfig, SearchableMultiSelect, SendNotificationDialog, SignupButton, SkeletonActivityStatBox, SkeletonAddSkillsLoading, SkeletonCreatePathwaySearchList, SkeletonDiscoverFilterBox, SkeletonEducationBox, SkeletonMultiplier, SkeletonPathwayBox, SkeletonProfileInfoCard, SkeletonSkillBox, SkillBox, SkillDetailModal, SkillLeaderboardChart, SkillsBox, Spinner, StatCard, TAURI_COMMANDS, TAURI_EVENTS, TenantSwitcher, TimeFilter, TimeTrackingProvider, TimedExam, ToolDialogs, TopBanner, UpgradePackageModal, UserAvatar, Version, WorkflowSidebar, addBookmarksTab, findLastResumeBlock, findSequentialParent, flattenVerticalBlocks, getFirstAvailableUnit, getNextUnitIframe, getOrg, getParentBlockById, getParentsInfosFromSublessonId, getPreviousUnitIframe, getRandomCourseImage, getTenant, getUnitToIframe, getUserId, getUserName, inBrowserPrint, inIframe, initialModelDownloadState, isLocalLLMEnabled, isTauriApp, components as markdownComponents, resolveCreateAgentLabels, sanitizeCss, setLocalLLMEnabled, useAnalyticsSettings, useAuditLog, useCatalogSearch, useChartFilters, useChatState, useCourseDetail, useCourseMetadata, useCourses, useDiscover, useEdxIframe, useFinancial, useIframeMessageHandler, useLocalStorage, useModelDownload, useMonetization, useOverview, useProfileActivityStats, useProfileCredentials, useProfilePathways, useProfilePrograms, useProfileSkills, useProfileTimeSpent, usePrograms, useReports, useTauri, useTimeTracking, useTopics, useTranscripts, useUserCourses, useUserMetadata, useUsers };
201798
202193
  //# sourceMappingURL=index.esm.js.map
@@ -125542,7 +125542,19 @@ function ProgramsTab({ tenant, currentPage, itemsPerPage, hasManageUsersPermissi
125542
125542
  })) })] }) }) }) }) }), isCSVEditorOpen && (jsx(CSVEditor, { csvData: parsedCSVData, onSave: handleCSVEditorSave, onCancel: handleCSVEditorCancel }))] }));
125543
125543
  }
125544
125544
 
125545
- function InviteUserDialog({ tenant, onClose, isOpen, enableCatalogInvite = false, hasManageUsersPermission = false, }) {
125545
+ /**
125546
+ * The single source of the Invite User experience — header, tabs
125547
+ * (Users / Courses / Programs), invite forms and the paginated invitation list.
125548
+ *
125549
+ * Used two ways:
125550
+ * - directly on a page (`variant="page"`, the default), or
125551
+ * - inside {@link InviteUserDialog} (`variant="dialog"`), which renders this
125552
+ * component verbatim so the modal stays byte-for-byte identical to before.
125553
+ *
125554
+ * The component owns all of its own state and data-fetching, so it is fully
125555
+ * self-contained.
125556
+ */
125557
+ function InviteUserContent({ tenant, enableCatalogInvite = false, hasManageUsersPermission = false, variant = 'page', className, }) {
125546
125558
  useTenantMetadata({
125547
125559
  org: tenant,
125548
125560
  });
@@ -125572,13 +125584,6 @@ function InviteUserDialog({ tenant, onClose, isOpen, enableCatalogInvite = false
125572
125584
  const handleInviteSuccess = () => {
125573
125585
  // Callback for when invite is successful - can be used for additional logic
125574
125586
  };
125575
- // Reset state when dialog closes
125576
- useEffect(() => {
125577
- if (!isOpen) {
125578
- setCurrentPage(1);
125579
- setActiveTab('users');
125580
- }
125581
- }, [isOpen]);
125582
125587
  // Reset to users tab if catalog invite is disabled
125583
125588
  useEffect(() => {
125584
125589
  if (!enableCatalogInvite && activeTab !== 'users') {
@@ -125623,7 +125628,21 @@ function InviteUserDialog({ tenant, onClose, isOpen, enableCatalogInvite = false
125623
125628
  }
125624
125629
  };
125625
125630
  const headerContent = getHeaderContent();
125626
- return (jsx(Fragment$1, { children: jsx(Dialog, { open: isOpen, onOpenChange: onClose, children: jsxs(DialogContent, { className: "sm:max-w-7xl w-[95vw] p-0 gap-0 mx-auto my-auto rounded-lg flex flex-col justify-between max-h-[90vh]", "aria-describedby": "invite-users-description", children: [jsxs(DialogHeader, { className: "p-4 pt-[30px] flex-shrink-0 border-b border-gray-200", children: [jsx(DialogTitle, { className: "text-lg font-medium text-gray-900 dark:text-gray-100", children: headerContent.title }), jsx(DialogDescription, { id: "invite-users-description", className: "text-sm text-gray-600 leading-relaxed", children: headerContent.description })] }), jsx("div", { className: "flex-grow overflow-y-auto scrollbar-hide p-2 sm:p-4 pb-20 max-h-[60vh]", children: enableCatalogInvite ? (jsxs(Tabs, { value: activeTab, onValueChange: setActiveTab, className: "w-full", children: [jsxs(TabsList, { className: "grid w-full grid-cols-3 mb-6", children: [jsxs(TabsTrigger, { value: "users", className: "flex items-center gap-2", children: [jsx(Users, { className: "h-4 w-4" }), jsx("span", { className: "hidden sm:inline", children: "Users" })] }), jsxs(TabsTrigger, { value: "courses", className: "flex items-center gap-2", children: [jsx(BookOpen, { className: "h-4 w-4" }), jsx("span", { className: "hidden sm:inline", children: "Courses" })] }), jsxs(TabsTrigger, { value: "programs", className: "flex items-center gap-2", children: [jsx(GraduationCap, { className: "h-4 w-4" }), jsx("span", { className: "hidden sm:inline", children: "Programs" })] })] }), jsx(TabsContent, { value: "users", children: jsx(UsersTab$1, { tenant: tenant, currentPage: currentPage, itemsPerPage: itemsPerPage, onInviteSuccess: handleInviteSuccess }) }), jsx(TabsContent, { value: "courses", children: jsx(CoursesTab, { tenant: tenant, currentPage: currentPage, itemsPerPage: itemsPerPage, hasManageUsersPermission: hasManageUsersPermission }) }), jsx(TabsContent, { value: "programs", children: jsx(ProgramsTab, { tenant: tenant, currentPage: currentPage, itemsPerPage: itemsPerPage, hasManageUsersPermission: hasManageUsersPermission }) })] })) : (jsx(UsersTab$1, { tenant: tenant, currentPage: currentPage, itemsPerPage: itemsPerPage, onInviteSuccess: handleInviteSuccess })) }), currentData && currentData.count > 0 && (jsx("div", { className: "flex items-center justify-between border-t border-gray-200 px-3 sm:px-6 py-3 sm:py-4 bg-gray-50 flex-shrink-0", children: jsxs("div", { className: "flex flex-1 items-center justify-between", children: [jsx("div", { className: "hidden sm:block", children: jsxs("p", { className: "text-sm text-gray-700", children: ["Showing", ' ', jsx("span", { className: "font-medium", children: (currentPage - 1) * itemsPerPage + 1 }), " to", ' ', jsx("span", { className: "font-medium", children: Math.min(currentPage * itemsPerPage, currentData.count) }), ' ', "of ", jsx("span", { className: "font-medium", children: currentData.count }), " invites"] }) }), jsxs("div", { className: "flex items-center justify-center gap-1 sm:gap-2", children: [jsx(Button$1, { variant: "outline", size: "sm", className: "h-8 w-8 p-0 flex items-center justify-center rounded-md border-gray-300 hover:bg-gray-100 hidden sm:flex bg-transparent", onClick: () => setCurrentPage(1), disabled: currentPage === 1, "aria-label": "Go to first page", children: jsx(ChevronFirst, { className: "h-4 w-4" }) }), jsxs(Button$1, { variant: "outline", size: "sm", className: "h-8 w-8 px-2 sm:p-0 flex items-center justify-center rounded-md border-none sm:border-gray-300 hover:bg-gray-100 text-xs sm:text-sm bg-transparent", onClick: () => setCurrentPage(currentPage - 1), disabled: currentPage === 1, "aria-label": "Go to previous page", children: [jsx(ChevronLeft, { className: "h-4 w-4 mr-1 sm:mr-0" }), jsx("span", { className: "sm:hidden", children: "Prev" })] }), jsxs("span", { className: "text-xs sm:text-sm text-gray-700 mx-1 sm:mx-2 px-2", children: [jsx("span", { className: "hidden sm:inline", children: "Page " }), currentPage, " ", jsx("span", { className: "hidden sm:inline", children: "of " }), jsx("span", { className: "inline sm:hidden", children: " / " }), totalPages] }), jsxs(Button$1, { variant: "outline", size: "sm", className: "h-8 w-8 px-2 sm:p-0 flex items-center justify-center rounded-md border-none sm:border-gray-300 hover:bg-gray-100 text-xs sm:text-sm bg-transparent", onClick: () => setCurrentPage(currentPage + 1), disabled: currentPage === totalPages, "aria-label": "Go to next page", children: [jsx("span", { className: "sm:hidden", children: "Next" }), jsx(ChevronRight, { className: "h-4 w-4 ml-1 sm:ml-0" })] }), jsx(Button$1, { variant: "outline", size: "sm", className: "h-8 w-8 p-0 flex items-center justify-center rounded-md border-gray-300 hover:bg-gray-100 hidden sm:flex bg-transparent", onClick: () => setCurrentPage(totalPages), disabled: currentPage === totalPages, "aria-label": "Go to last page", children: jsx(ChevronLast, { className: "h-4 w-4" }) })] })] }) }))] }) }) }));
125631
+ // ── Shared body (identical in both variants) ──────────────────────────────
125632
+ const tabsBody = enableCatalogInvite ? (jsxs(Tabs, { value: activeTab, onValueChange: setActiveTab, className: "w-full", children: [jsxs(TabsList, { className: "grid w-full grid-cols-3 mb-6", children: [jsxs(TabsTrigger, { value: "users", className: "flex items-center gap-2", children: [jsx(Users, { className: "h-4 w-4" }), jsx("span", { className: "hidden sm:inline", children: "Users" })] }), jsxs(TabsTrigger, { value: "courses", className: "flex items-center gap-2", children: [jsx(BookOpen, { className: "h-4 w-4" }), jsx("span", { className: "hidden sm:inline", children: "Courses" })] }), jsxs(TabsTrigger, { value: "programs", className: "flex items-center gap-2", children: [jsx(GraduationCap, { className: "h-4 w-4" }), jsx("span", { className: "hidden sm:inline", children: "Programs" })] })] }), jsx(TabsContent, { value: "users", children: jsx(UsersTab$1, { tenant: tenant, currentPage: currentPage, itemsPerPage: itemsPerPage, onInviteSuccess: handleInviteSuccess }) }), jsx(TabsContent, { value: "courses", children: jsx(CoursesTab, { tenant: tenant, currentPage: currentPage, itemsPerPage: itemsPerPage, hasManageUsersPermission: hasManageUsersPermission }) }), jsx(TabsContent, { value: "programs", children: jsx(ProgramsTab, { tenant: tenant, currentPage: currentPage, itemsPerPage: itemsPerPage, hasManageUsersPermission: hasManageUsersPermission }) })] })) : (jsx(UsersTab$1, { tenant: tenant, currentPage: currentPage, itemsPerPage: itemsPerPage, onInviteSuccess: handleInviteSuccess }));
125633
+ const pagination = currentData && currentData.count > 0 && (jsx("div", { className: "flex items-center justify-between border-t border-gray-200 px-3 sm:px-6 py-3 sm:py-4 bg-gray-50 flex-shrink-0", children: jsxs("div", { className: "flex flex-1 items-center justify-between", children: [jsx("div", { className: "hidden sm:block", children: jsxs("p", { className: "text-sm text-gray-700", children: ["Showing ", jsx("span", { className: "font-medium", children: (currentPage - 1) * itemsPerPage + 1 }), " to", ' ', jsx("span", { className: "font-medium", children: Math.min(currentPage * itemsPerPage, currentData.count) }), ' ', "of ", jsx("span", { className: "font-medium", children: currentData.count }), " invites"] }) }), jsxs("div", { className: "flex items-center justify-center gap-1 sm:gap-2", children: [jsx(Button$1, { variant: "outline", size: "sm", className: "h-8 w-8 p-0 flex items-center justify-center rounded-md border-gray-300 hover:bg-gray-100 hidden sm:flex bg-transparent", onClick: () => setCurrentPage(1), disabled: currentPage === 1, "aria-label": "Go to first page", children: jsx(ChevronFirst, { className: "h-4 w-4" }) }), jsxs(Button$1, { variant: "outline", size: "sm", className: "h-8 w-8 px-2 sm:p-0 flex items-center justify-center rounded-md border-none sm:border-gray-300 hover:bg-gray-100 text-xs sm:text-sm bg-transparent", onClick: () => setCurrentPage(currentPage - 1), disabled: currentPage === 1, "aria-label": "Go to previous page", children: [jsx(ChevronLeft, { className: "h-4 w-4 mr-1 sm:mr-0" }), jsx("span", { className: "sm:hidden", children: "Prev" })] }), jsxs("span", { className: "text-xs sm:text-sm text-gray-700 mx-1 sm:mx-2 px-2", children: [jsx("span", { className: "hidden sm:inline", children: "Page " }), currentPage, " ", jsx("span", { className: "hidden sm:inline", children: "of " }), jsx("span", { className: "inline sm:hidden", children: " / " }), totalPages] }), jsxs(Button$1, { variant: "outline", size: "sm", className: "h-8 w-8 px-2 sm:p-0 flex items-center justify-center rounded-md border-none sm:border-gray-300 hover:bg-gray-100 text-xs sm:text-sm bg-transparent", onClick: () => setCurrentPage(currentPage + 1), disabled: currentPage === totalPages, "aria-label": "Go to next page", children: [jsx("span", { className: "sm:hidden", children: "Next" }), jsx(ChevronRight, { className: "h-4 w-4 ml-1 sm:ml-0" })] }), jsx(Button$1, { variant: "outline", size: "sm", className: "h-8 w-8 p-0 flex items-center justify-center rounded-md border-gray-300 hover:bg-gray-100 hidden sm:flex bg-transparent", onClick: () => setCurrentPage(totalPages), disabled: currentPage === totalPages, "aria-label": "Go to last page", children: jsx(ChevronLast, { className: "h-4 w-4" }) })] })] }) }));
125634
+ // ── Dialog variant: the exact markup InviteUserDialog has always rendered ──
125635
+ // Returned as a fragment so the three blocks remain direct children of the
125636
+ // dialog's <DialogContent>, byte-for-byte identical to the original.
125637
+ if (variant === 'dialog') {
125638
+ return (jsxs(Fragment$1, { children: [jsxs(DialogHeader, { className: "p-4 pt-[30px] flex-shrink-0 border-b border-gray-200", children: [jsx(DialogTitle, { className: "text-lg font-medium text-gray-900 dark:text-gray-100", children: headerContent.title }), jsx(DialogDescription, { id: "invite-users-description", className: "text-sm text-gray-600 leading-relaxed", children: headerContent.description })] }), jsx("div", { className: "flex-grow overflow-y-auto scrollbar-hide p-2 sm:p-4 pb-20 max-h-[60vh]", children: tabsBody }), pagination] }));
125639
+ }
125640
+ // ── Page variant: a plain in-page block that flows normally ───────────────
125641
+ return (jsxs("div", { className: cn('w-full', className), children: [jsxs("div", { className: "border-b border-gray-200 pb-4", children: [jsx("h2", { className: "text-lg font-medium text-gray-900 dark:text-gray-100", children: headerContent.title }), jsx("p", { className: "text-sm text-gray-600 leading-relaxed", children: headerContent.description })] }), jsx("div", { className: "py-4", children: tabsBody }), pagination] }));
125642
+ }
125643
+
125644
+ function InviteUserDialog({ tenant, onClose, isOpen, enableCatalogInvite = false, hasManageUsersPermission = false, }) {
125645
+ return (jsx(Dialog, { open: isOpen, onOpenChange: onClose, children: jsx(DialogContent, { className: "sm:max-w-7xl w-[95vw] p-0 gap-0 mx-auto my-auto rounded-lg flex flex-col justify-between max-h-[90vh]", "aria-describedby": "invite-users-description", children: jsx(InviteUserContent, { tenant: tenant, enableCatalogInvite: enableCatalogInvite, hasManageUsersPermission: hasManageUsersPermission, variant: "dialog" }) }) }));
125627
125646
  }
125628
125647
 
125629
125648
  function InvitedUsersDialog({ tenant, onClose, }) {
@@ -221350,7 +221369,7 @@ function Chat({ mode = 'default', isPreviewMode = false, hasBorder = true, isInC
221350
221369
  }
221351
221370
 
221352
221371
  function TasksTabToolbar({ taskDate, setTaskDate, setIsScheduleTaskDialogOpen, searchQuery, setSearchQuery, labels, }) {
221353
- return (jsxs("div", { className: "flex flex-col sm:flex-row items-center gap-4", children: [jsxs("div", { className: "relative flex-1 w-full", children: [jsx(Search, { className: "absolute left-3 top-1/2 transform -translate-y-1/2 h-4 w-4 text-gray-500" }), jsx(Input, { className: "pl-10 w-full", placeholder: labels.toolbar.searchPlaceholder, value: searchQuery, onChange: (e) => setSearchQuery(e.target.value) })] }), jsxs(Popover, { children: [jsx(PopoverTrigger, { asChild: true, children: jsxs(Button$1, { variant: "outline", className: "flex items-center gap-2 justify-start w-full sm:w-auto bg-transparent border-[#2563EB] text-[#2563EB]", children: [jsx(Calendar$1, { className: "h-4 w-4" }), jsx("span", { children: taskDate ? format(taskDate, 'MM/dd/yyyy') : labels.toolbar.selectDate })] }) }), jsx(PopoverContent, { className: "w-auto p-0", align: "start", portalled: false, children: jsx(Calendar, { mode: "single", selected: taskDate, onSelect: setTaskDate, classNames: {
221372
+ return (jsxs("div", { className: "flex flex-col sm:flex-row items-center gap-4", children: [jsxs("div", { className: "relative flex-1 w-full", children: [jsx(Search, { className: "absolute left-3 top-1/2 transform -translate-y-1/2 h-4 w-4 text-gray-500" }), jsx(Input, { className: "pl-10 w-full", placeholder: labels.toolbar.searchPlaceholder, value: searchQuery, onChange: (e) => setSearchQuery(e.target.value) })] }), jsxs(Popover, { children: [jsx(PopoverTrigger, { asChild: true, children: jsxs(Button$1, { variant: "outline", className: "flex items-center gap-2 justify-start w-full sm:w-auto bg-transparent", children: [jsx(Calendar$1, { className: "h-4 w-4" }), jsx("span", { children: taskDate ? format(taskDate, 'MM/dd/yyyy') : labels.toolbar.selectDate })] }) }), jsx(PopoverContent, { className: "w-auto p-0", align: "start", portalled: false, children: jsx(Calendar, { mode: "single", selected: taskDate, onSelect: setTaskDate, classNames: {
221354
221373
  day_button: 'data-[selected-single=true]:bg-[#2563EB] data-[selected-single=true]:text-white data-[range-start=true]:bg-[#2563EB] data-[range-start=true]:text-white data-[range-end=true]:bg-[#2563EB] data-[range-end=true]:text-white',
221355
221374
  today: 'bg-blue-50 text-[#2563EB] data-[selected=true]:bg-[#2563EB] data-[selected=true]:text-white',
221356
221375
  }, initialFocus: true }) })] }), jsxs(Button$1, { className: "bg-gradient-to-r from-[#2563EB] to-[#93C5FD] hover:opacity-90 text-white font-medium w-full sm:w-auto", onClick: () => setIsScheduleTaskDialogOpen(true), children: [jsx(Plus, { className: "h-4 w-4 mr-2" }), labels.toolbar.scheduleTask] })] }));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@iblai/iblai-js",
3
- "version": "1.17.20",
3
+ "version": "1.17.24",
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": {
@@ -66,8 +66,8 @@
66
66
  "axios": "1.13.6",
67
67
  "dotenv": "16.6.1",
68
68
  "winston": "3.19.0",
69
- "@iblai/mcp": "1.5.6",
70
- "@iblai/web-containers": "1.8.15",
69
+ "@iblai/mcp": "1.5.8",
70
+ "@iblai/web-containers": "1.8.18",
71
71
  "@iblai/data-layer": "1.7.5",
72
72
  "@iblai/web-utils": "1.10.10"
73
73
  },