@iblai/iblai-js 1.20.9 → 1.20.11
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.
|
@@ -3,7 +3,7 @@ import React__default, { useRef, useEffect, useState, useCallback, useLayoutEffe
|
|
|
3
3
|
import { useDispatch, useSelector } from 'react-redux';
|
|
4
4
|
import { selectSessionId, selectActiveChatMessages, useCachedSessionId, chatActions, 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, WithFormPermissions, MENTOR_VISIBILITY } from '@iblai/web-utils';
|
|
5
5
|
import * as dataLayer from '@iblai/data-layer';
|
|
6
|
-
import { useCreateSessionIdMutation, 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, useGetRbacActionsDefinitionQuery, 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, useGetLearnerDetailsQuery, 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,
|
|
6
|
+
import { useCreateSessionIdMutation, 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, useGetRbacActionsDefinitionQuery, 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, useGetLearnerDetailsQuery, 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, useCreateUserProjectMutation, useDeleteUserProjectMutation, useGetUserProjectDetailsQuery, useEditTrainingDocumentMutation, useAddTrainingDocumentMutation, useLazyGetCredentialsQuery, useGetMentorSettingsQuery, useEditMentorMutation, useGetMentorCategoriesQuery, useCreateMentorMutation, useUpdateUserPlatformMetadataMutation, useGetPromptCategoriesQuery, useCreatePromptMutation, useDeletePromptMutation, useGetPromptsSearchQuery, useUpdatePromptMutation, useDeleteTrainingDocumentMutation, useGetTrainingDocumentRetrainScheduleQuery, useCreateTrainingDocumentRetrainScheduleMutation } from '@iblai/data-layer';
|
|
7
7
|
import { toast } from 'sonner';
|
|
8
8
|
import { jsx, Fragment as Fragment$1, jsxs } from 'react/jsx-runtime';
|
|
9
9
|
import * as ReactDOM from 'react-dom';
|
|
@@ -88,7 +88,6 @@ const pick = (name, fallback) => { var _a; return ((_a = read(name)) !== null &&
|
|
|
88
88
|
const CHAT_PRIVACY_SUPPORTED = !!read('ChatPrivacyModeEnum') && !!read('CHAT_PRIVACY_MODES');
|
|
89
89
|
const ChatPrivacyModeEnum = read('ChatPrivacyModeEnum');
|
|
90
90
|
const CHAT_PRIVACY_MODES = ((_a = read('CHAT_PRIVACY_MODES')) !== null && _a !== void 0 ? _a : []);
|
|
91
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
92
91
|
const chatPrivacyApiSlice = read('chatPrivacyApiSlice');
|
|
93
92
|
const useGetTenantChatPrivacyConfigQuery = pick('useGetTenantChatPrivacyConfigQuery', noopQuery);
|
|
94
93
|
const useUpdateTenantChatPrivacyConfigMutation = pick('useUpdateTenantChatPrivacyConfigMutation', noopMutation);
|
|
@@ -222928,74 +222927,89 @@ var minimumMentorAlert = /*#__PURE__*/Object.freeze({
|
|
|
222928
222927
|
MinimumMentorAlert: MinimumMentorAlert
|
|
222929
222928
|
});
|
|
222930
222929
|
|
|
222931
|
-
|
|
222932
|
-
|
|
222930
|
+
/**
|
|
222931
|
+
* Core agent search hook — thin wrapper around `useGetAiSearchMentorsQuery`.
|
|
222932
|
+
*
|
|
222933
|
+
* This is the low-level building block. For a higher-level hook that manages
|
|
222934
|
+
* search state, debounce, and pagination controls, use
|
|
222935
|
+
* `useAgentSearchWithPagination`.
|
|
222936
|
+
*/
|
|
222937
|
+
function useAgentSearch({ tenantKey, query, limit = 6, offset, starred, featured, category, subjects, llm, types, includeMainPublicMentors, orderDirection, skip = false, }) {
|
|
222938
|
+
var _a, _b, _c;
|
|
222939
|
+
const { data, isLoading, isFetching, refetch } = useGetAiSearchMentorsQuery({
|
|
222940
|
+
platform_key: tenantKey,
|
|
222941
|
+
query: query || undefined,
|
|
222942
|
+
limit,
|
|
222943
|
+
...(offset !== undefined && { offset }),
|
|
222944
|
+
...(starred !== undefined && { starred }),
|
|
222945
|
+
...(featured !== undefined && { featured }),
|
|
222946
|
+
...(category && { category }),
|
|
222947
|
+
...(subjects && { subjects }),
|
|
222948
|
+
...(llm && { llm }),
|
|
222949
|
+
...(types && { types }),
|
|
222950
|
+
...(includeMainPublicMentors !== undefined && {
|
|
222951
|
+
include_main_public_mentors: includeMainPublicMentors,
|
|
222952
|
+
}),
|
|
222953
|
+
...(orderDirection && { order_direction: orderDirection }),
|
|
222954
|
+
}, { skip: skip || !tenantKey });
|
|
222955
|
+
return {
|
|
222956
|
+
agents: ((_a = data === null || data === void 0 ? void 0 : data.results) !== null && _a !== void 0 ? _a : []),
|
|
222957
|
+
facets: data === null || data === void 0 ? void 0 : data.facets,
|
|
222958
|
+
hasMore: !!(data === null || data === void 0 ? void 0 : data.next),
|
|
222959
|
+
totalCount: (_b = data === null || data === void 0 ? void 0 : data.count) !== null && _b !== void 0 ? _b : 0,
|
|
222960
|
+
totalPages: (_c = data === null || data === void 0 ? void 0 : data.total_pages) !== null && _c !== void 0 ? _c : 0,
|
|
222961
|
+
isLoading,
|
|
222962
|
+
isFetching,
|
|
222963
|
+
refetch,
|
|
222964
|
+
};
|
|
222965
|
+
}
|
|
222966
|
+
|
|
222967
|
+
/**
|
|
222968
|
+
* Higher-level agent search hook that manages search state, debounce, and
|
|
222969
|
+
* pagination controls on top of `useAgentSearch`.
|
|
222970
|
+
*
|
|
222971
|
+
* Use this for simple list/table views (MyMentorsModal, SettingsModal).
|
|
222972
|
+
* For the full explore page with sections, use `useAgentSearch` directly.
|
|
222973
|
+
*/
|
|
222974
|
+
function useAgentSearchWithPagination({ itemsPerPage = 6, paginationMode = 'paginated', debounceMs = 500, ...queryConfig }) {
|
|
222933
222975
|
const [searchQuery, setSearchQuery] = React__default.useState('');
|
|
222934
|
-
const [
|
|
222976
|
+
const [debouncedQuery] = a(searchQuery, debounceMs);
|
|
222935
222977
|
const [currentPage, setCurrentPage] = React__default.useState(1);
|
|
222936
|
-
const [
|
|
222937
|
-
|
|
222938
|
-
offset: 0,
|
|
222939
|
-
query: debouncedSearchQuery,
|
|
222940
|
-
orderBy: 'created_at',
|
|
222941
|
-
orderDirection: 'desc',
|
|
222942
|
-
});
|
|
222943
|
-
const { data: mentors, isLoading: isMentorsLoading, isFetching: isMentorsFetching, error: mentorsError, } = useGetMentorsQuery({
|
|
222944
|
-
org: tenantKey,
|
|
222945
|
-
username: username !== null && username !== void 0 ? username : '',
|
|
222946
|
-
...queryParams,
|
|
222947
|
-
}, {
|
|
222948
|
-
skip: !tenantKey || !username,
|
|
222949
|
-
refetchOnMountOrArgChange: true,
|
|
222950
|
-
});
|
|
222951
|
-
const { data: publicMentors, isLoading: isPublicMentorsLoading, isFetching: isPublicMentorsFetching, error: publicMentorsError, } = useGetPublicMentorsQuery({ ...queryParams }, {
|
|
222952
|
-
skip: !!username,
|
|
222953
|
-
refetchOnMountOrArgChange: true,
|
|
222954
|
-
});
|
|
222955
|
-
// Effect to update offset when page changes
|
|
222956
|
-
React__default.useEffect(() => {
|
|
222957
|
-
setQueryParams((prev) => ({
|
|
222958
|
-
...prev,
|
|
222959
|
-
offset: (currentPage - 1) * itemsPerPage,
|
|
222960
|
-
}));
|
|
222961
|
-
}, [currentPage, itemsPerPage]);
|
|
222962
|
-
// Effect to update query parameter when search changes
|
|
222978
|
+
const [infiniteLimit, setInfiniteLimit] = React__default.useState(itemsPerPage);
|
|
222979
|
+
// Reset pagination when search changes
|
|
222963
222980
|
React__default.useEffect(() => {
|
|
222964
|
-
|
|
222965
|
-
|
|
222966
|
-
|
|
222967
|
-
|
|
222968
|
-
|
|
222969
|
-
|
|
222970
|
-
|
|
222971
|
-
|
|
222972
|
-
|
|
222973
|
-
|
|
222974
|
-
|
|
222975
|
-
|
|
222976
|
-
|
|
222977
|
-
|
|
222978
|
-
const
|
|
222979
|
-
|
|
222981
|
+
setCurrentPage(1);
|
|
222982
|
+
setInfiniteLimit(itemsPerPage);
|
|
222983
|
+
}, [debouncedQuery, itemsPerPage]);
|
|
222984
|
+
const isPaginated = paginationMode === 'paginated';
|
|
222985
|
+
const result = useAgentSearch({
|
|
222986
|
+
...queryConfig,
|
|
222987
|
+
query: debouncedQuery,
|
|
222988
|
+
limit: isPaginated ? itemsPerPage : infiniteLimit,
|
|
222989
|
+
offset: isPaginated ? (currentPage - 1) * itemsPerPage : undefined,
|
|
222990
|
+
});
|
|
222991
|
+
const totalPages = Math.ceil(result.totalCount / itemsPerPage);
|
|
222992
|
+
const handlePageChange = React__default.useCallback((page) => {
|
|
222993
|
+
setCurrentPage(page);
|
|
222994
|
+
}, []);
|
|
222995
|
+
const loadMore = React__default.useCallback(() => {
|
|
222996
|
+
setInfiniteLimit((prev) => prev + itemsPerPage);
|
|
222997
|
+
}, [itemsPerPage]);
|
|
222980
222998
|
return {
|
|
222981
|
-
|
|
222982
|
-
totalCount: username ? (mentors === null || mentors === void 0 ? void 0 : mentors.count) || 0 : (publicMentors === null || publicMentors === void 0 ? void 0 : publicMentors.count) || 0,
|
|
222983
|
-
isLoading: username ? isMentorsLoading : isPublicMentorsLoading,
|
|
222984
|
-
isFetching: username ? isMentorsFetching : isPublicMentorsFetching,
|
|
222985
|
-
error: username ? mentorsError : publicMentorsError,
|
|
222999
|
+
...result,
|
|
222986
223000
|
searchQuery,
|
|
222987
223001
|
setSearchQuery,
|
|
223002
|
+
debouncedQuery,
|
|
222988
223003
|
currentPage,
|
|
222989
223004
|
totalPages,
|
|
222990
223005
|
handlePageChange,
|
|
222991
|
-
|
|
222992
|
-
itemsPerPage,
|
|
223006
|
+
loadMore,
|
|
222993
223007
|
};
|
|
222994
223008
|
}
|
|
222995
223009
|
|
|
222996
223010
|
function MentorSelectionGrid({ selectedMentorIds, onMentorSelect, searchQuery, onSearchChange, tenantKey, itemsPerPage = 8, showSearch = true, minHeight = '400px', }) {
|
|
222997
223011
|
const t = useT();
|
|
222998
|
-
const { mentors, isLoading: isMentorsLoading, isFetching: isMentorsFetching, currentPage, totalPages, setSearchQuery: setMentorSearch, handlePageChange, } =
|
|
223012
|
+
const { agents: mentors, isLoading: isMentorsLoading, isFetching: isMentorsFetching, currentPage, totalPages, setSearchQuery: setMentorSearch, handlePageChange, } = useAgentSearchWithPagination({ tenantKey, itemsPerPage });
|
|
222999
223013
|
// Update search query with debounce effect handled by the hook
|
|
223000
223014
|
React__default.useEffect(() => {
|
|
223001
223015
|
setMentorSearch(searchQuery);
|
|
@@ -2,7 +2,7 @@ import { jsx, jsxs, Fragment as Fragment$1 } from 'react/jsx-runtime';
|
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
import React__default, { useState, useEffect, forwardRef, createElement as createElement$3, useLayoutEffect, createContext, useContext, useMemo, useCallback, useReducer, useRef, useImperativeHandle, useId as useId$2, useDebugValue, cloneElement, lazy, Suspense, Component as Component$1 } from 'react';
|
|
4
4
|
import * as dataLayer from '@iblai/data-layer';
|
|
5
|
-
import { 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, useGetRbacActionsDefinitionQuery, 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, useLazyGetCourseMetaDataQuery, useLazyGetCourseCompletionOutlinesQuery, useLazyGetCourseEligibilityQuery, useLazyGetEdxSSOTokenQuery, useCreateCourseEnrollmentMutation, useCreateStripeCheckoutSessionMutation, useLazyGetCourseProgressQuery, useLazyGetCourseCompletionQuery, useUpdateExamAttemptMutation, useStartExamMutation, useLazyGetExamInfoQuery, useUpdateUserProjectMutation, useGetTrainingDocumentsQuery, useGetVectorDocumentsQuery, useGetMentorMemoriesListQuery, useGetMemoryCategoriesAdminQuery, useDeleteMentorMemoryMutation, useUpdateMentorMemoryMutation, useCreateMentorMemoryMutation, useLazyGetConnectedServiceAuthUrlQuery,
|
|
5
|
+
import { 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, useGetRbacActionsDefinitionQuery, 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, useLazyGetCourseMetaDataQuery, useLazyGetCourseCompletionOutlinesQuery, useLazyGetCourseEligibilityQuery, useLazyGetEdxSSOTokenQuery, useCreateCourseEnrollmentMutation, useCreateStripeCheckoutSessionMutation, useLazyGetCourseProgressQuery, useLazyGetCourseCompletionQuery, useUpdateExamAttemptMutation, useStartExamMutation, useLazyGetExamInfoQuery, useUpdateUserProjectMutation, useGetTrainingDocumentsQuery, useGetVectorDocumentsQuery, useGetMentorMemoriesListQuery, useGetMemoryCategoriesAdminQuery, useDeleteMentorMemoryMutation, useUpdateMentorMemoryMutation, useCreateMentorMemoryMutation, useLazyGetConnectedServiceAuthUrlQuery, useStarMentorMutation, useUnstarMentorMutation, useCreateUserProjectMutation, useDeleteUserProjectMutation, useGetUserProjectDetailsQuery, useEditTrainingDocumentMutation, useAddTrainingDocumentMutation, useLazyGetCredentialsQuery, useGetMentorSettingsQuery, useEditMentorMutation, useUploadLightLogoMutation, useUploadDarkLogoMutation, useUpdatePlatformInfoMutation, LOGO_ENDPOINTS, useGetUserProjectsQuery, useCreateSessionIdMutation, useGetMentorCategoriesQuery, useDeleteMentorMutation, useForkMentorMutation, useGetToolsQuery, useLazyGetMCPServersQuery, useOauthFindMutation, useLazyStartOAuthFlowQuery, useCreateMCPServerMutation, usePartialUpdateMCPServerMutation, useCreateMCPServerConnectionMutation, usePatchMCPServerConnectionMutation, useGetConnectedServicesQuery, useGetMCPServersQuery, useGetMCPServerConnectionsQuery, useUpdateMCPServerMutation, useDeleteMCPServerMutation, useEditMentorJsonMutation, useDisconnectServiceMutation, useGetPromptCategoriesQuery, PRIVACY_ACTIONS, PRIVACY_ENTITY_TYPES, useGetVoicesQuery, useGetVoiceQuery, useGetCallConfigurationsQuery, useCreateCallConfigurationMutation, useUpdateCallConfigurationMutation, useGetMentorPublicSettingsQuery, useGetChatHistoryFilterQuery, useGetChatHistoryQuery, useGetMentorSummariesQuery, useGetConversationMemoriesQuery, useCreatePromptMutation, useGetPromptsSearchQuery, useUpdatePromptMutation, useCreateRedirectTokenMutation, useGetShareableLinkQuery, useCreateShareableLinkMutation, useUpdateShareableLinkMutation, useCreateDisclaimerMutation, useUpdateDisclaimerMutation, useGetDisclaimersQuery, useUpdateRbacMentorAccessMutation, useGetRbacMentorAccessListQuery, useGetPersonnalizedMentorsQuery, useCreateCallCredentialsMutation, useGetGuidedPromptsQuery, useUpdateChatSessionSharedMutation, useUpdateMessageFeedbackMutation, useLazyGetPromptsSearchQuery, useLazyGetGuidedPromptsQuery, useGetPublicMentorsQuery, useGetPeriodicAgentsQuery, useGetPeriodicAgentLogsListQuery, useCreatePeriodicAgentMutation, useDeletePeriodicAgentMutation, useDeletePromptMutation, useDeleteTrainingDocumentMutation, useGetTrainingDocumentRetrainScheduleQuery, useCreateTrainingDocumentRetrainScheduleMutation, useCreateMemoryCategoryMutation, useUpdateMemoryCategoryMutation, useDeleteMemoryCategoryMutation, useUpdateArtifactMutation, useLazyGetArtifactVersionQuery, useLazyListArtifactVersionsQuery, useSetCurrentVersionMutation, useListArtifactVersionsQuery, useLazyGetArtifactQuery, useLazyListArtifactsQuery, useEditSessionMutation } from '@iblai/data-layer';
|
|
6
6
|
import { getInitials, useTenantMetadata, WithPermissions, useStripeUpgrade, CHAT_AREA_SIZE, isAlphaNumeric32, checkRbacPermission, 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, useTenantContext, TimeTracker, advancedTabsProperties, defaultSessionIds, ANONYMOUS_USERNAME as ANONYMOUS_USERNAME$2, redirectToAuthSpaJoinTenant, selectActiveTab, useAxdToken, useWelcomeMessage, markdownToPlainText, useCachedSessionId, use402ErrorCheck, selectTokenEnabled, selectToken, useServiceWorker, useUserAgreement, useAdvancedChat, sendMessageToParentWebsite, useMentorTools, useFileDragDrop, eventBus, RemoteEvents, selectEnableChatActionsPopup, advancedTabs, isInIframe, getAuthSpaJoinUrl, addMessage, clearFiles, MENTOR_VISIBILITY } from '@iblai/web-utils';
|
|
7
7
|
import { useDispatch, useSelector } from 'react-redux';
|
|
8
8
|
import { toast } from 'sonner';
|
|
@@ -146367,7 +146367,6 @@ const pick = (name, fallback) => { var _a; return ((_a = read(name)) !== null &&
|
|
|
146367
146367
|
const CHAT_PRIVACY_SUPPORTED = !!read('ChatPrivacyModeEnum') && !!read('CHAT_PRIVACY_MODES');
|
|
146368
146368
|
const ChatPrivacyModeEnum = read('ChatPrivacyModeEnum');
|
|
146369
146369
|
const CHAT_PRIVACY_MODES = ((_a$1 = read('CHAT_PRIVACY_MODES')) !== null && _a$1 !== void 0 ? _a$1 : []);
|
|
146370
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
146371
146370
|
read('chatPrivacyApiSlice');
|
|
146372
146371
|
const useGetTenantChatPrivacyConfigQuery = pick('useGetTenantChatPrivacyConfigQuery', noopQuery);
|
|
146373
146372
|
const useUpdateTenantChatPrivacyConfigMutation = pick('useUpdateTenantChatPrivacyConfigMutation', noopMutation);
|
|
@@ -225924,74 +225923,127 @@ var minimumMentorAlert = /*#__PURE__*/Object.freeze({
|
|
|
225924
225923
|
MinimumMentorAlert: MinimumMentorAlert
|
|
225925
225924
|
});
|
|
225926
225925
|
|
|
225927
|
-
|
|
225928
|
-
|
|
225926
|
+
/**
|
|
225927
|
+
* Core agent search hook — thin wrapper around `useGetAiSearchMentorsQuery`.
|
|
225928
|
+
*
|
|
225929
|
+
* This is the low-level building block. For a higher-level hook that manages
|
|
225930
|
+
* search state, debounce, and pagination controls, use
|
|
225931
|
+
* `useAgentSearchWithPagination`.
|
|
225932
|
+
*/
|
|
225933
|
+
function useAgentSearch({ tenantKey, query, limit = 6, offset, starred, featured, category, subjects, llm, types, includeMainPublicMentors, orderDirection, skip = false, }) {
|
|
225934
|
+
var _a, _b, _c;
|
|
225935
|
+
const { data, isLoading, isFetching, refetch } = useGetAiSearchMentorsQuery({
|
|
225936
|
+
platform_key: tenantKey,
|
|
225937
|
+
query: query || undefined,
|
|
225938
|
+
limit,
|
|
225939
|
+
...(offset !== undefined && { offset }),
|
|
225940
|
+
...(starred !== undefined && { starred }),
|
|
225941
|
+
...(featured !== undefined && { featured }),
|
|
225942
|
+
...(category && { category }),
|
|
225943
|
+
...(subjects && { subjects }),
|
|
225944
|
+
...(llm && { llm }),
|
|
225945
|
+
...(types && { types }),
|
|
225946
|
+
...(includeMainPublicMentors !== undefined && {
|
|
225947
|
+
include_main_public_mentors: includeMainPublicMentors,
|
|
225948
|
+
}),
|
|
225949
|
+
...(orderDirection && { order_direction: orderDirection }),
|
|
225950
|
+
}, { skip: skip || !tenantKey });
|
|
225951
|
+
return {
|
|
225952
|
+
agents: ((_a = data === null || data === void 0 ? void 0 : data.results) !== null && _a !== void 0 ? _a : []),
|
|
225953
|
+
facets: data === null || data === void 0 ? void 0 : data.facets,
|
|
225954
|
+
hasMore: !!(data === null || data === void 0 ? void 0 : data.next),
|
|
225955
|
+
totalCount: (_b = data === null || data === void 0 ? void 0 : data.count) !== null && _b !== void 0 ? _b : 0,
|
|
225956
|
+
totalPages: (_c = data === null || data === void 0 ? void 0 : data.total_pages) !== null && _c !== void 0 ? _c : 0,
|
|
225957
|
+
isLoading,
|
|
225958
|
+
isFetching,
|
|
225959
|
+
refetch,
|
|
225960
|
+
};
|
|
225961
|
+
}
|
|
225962
|
+
|
|
225963
|
+
/**
|
|
225964
|
+
* Higher-level agent search hook that manages search state, debounce, and
|
|
225965
|
+
* pagination controls on top of `useAgentSearch`.
|
|
225966
|
+
*
|
|
225967
|
+
* Use this for simple list/table views (MyMentorsModal, SettingsModal).
|
|
225968
|
+
* For the full explore page with sections, use `useAgentSearch` directly.
|
|
225969
|
+
*/
|
|
225970
|
+
function useAgentSearchWithPagination({ itemsPerPage = 6, paginationMode = 'paginated', debounceMs = 500, ...queryConfig }) {
|
|
225929
225971
|
const [searchQuery, setSearchQuery] = React__default.useState('');
|
|
225930
|
-
const [
|
|
225972
|
+
const [debouncedQuery] = a$3(searchQuery, debounceMs);
|
|
225931
225973
|
const [currentPage, setCurrentPage] = React__default.useState(1);
|
|
225932
|
-
const [
|
|
225933
|
-
|
|
225934
|
-
offset: 0,
|
|
225935
|
-
query: debouncedSearchQuery,
|
|
225936
|
-
orderBy: 'created_at',
|
|
225937
|
-
orderDirection: 'desc',
|
|
225938
|
-
});
|
|
225939
|
-
const { data: mentors, isLoading: isMentorsLoading, isFetching: isMentorsFetching, error: mentorsError, } = useGetMentorsQuery({
|
|
225940
|
-
org: tenantKey,
|
|
225941
|
-
username: username !== null && username !== void 0 ? username : '',
|
|
225942
|
-
...queryParams,
|
|
225943
|
-
}, {
|
|
225944
|
-
skip: !tenantKey || !username,
|
|
225945
|
-
refetchOnMountOrArgChange: true,
|
|
225946
|
-
});
|
|
225947
|
-
const { data: publicMentors, isLoading: isPublicMentorsLoading, isFetching: isPublicMentorsFetching, error: publicMentorsError, } = useGetPublicMentorsQuery({ ...queryParams }, {
|
|
225948
|
-
skip: !!username,
|
|
225949
|
-
refetchOnMountOrArgChange: true,
|
|
225950
|
-
});
|
|
225951
|
-
// Effect to update offset when page changes
|
|
225952
|
-
React__default.useEffect(() => {
|
|
225953
|
-
setQueryParams((prev) => ({
|
|
225954
|
-
...prev,
|
|
225955
|
-
offset: (currentPage - 1) * itemsPerPage,
|
|
225956
|
-
}));
|
|
225957
|
-
}, [currentPage, itemsPerPage]);
|
|
225958
|
-
// Effect to update query parameter when search changes
|
|
225974
|
+
const [infiniteLimit, setInfiniteLimit] = React__default.useState(itemsPerPage);
|
|
225975
|
+
// Reset pagination when search changes
|
|
225959
225976
|
React__default.useEffect(() => {
|
|
225960
|
-
|
|
225961
|
-
|
|
225962
|
-
|
|
225963
|
-
|
|
225964
|
-
|
|
225965
|
-
|
|
225966
|
-
|
|
225967
|
-
|
|
225968
|
-
|
|
225969
|
-
|
|
225970
|
-
|
|
225971
|
-
|
|
225972
|
-
|
|
225973
|
-
|
|
225974
|
-
const
|
|
225975
|
-
|
|
225977
|
+
setCurrentPage(1);
|
|
225978
|
+
setInfiniteLimit(itemsPerPage);
|
|
225979
|
+
}, [debouncedQuery, itemsPerPage]);
|
|
225980
|
+
const isPaginated = paginationMode === 'paginated';
|
|
225981
|
+
const result = useAgentSearch({
|
|
225982
|
+
...queryConfig,
|
|
225983
|
+
query: debouncedQuery,
|
|
225984
|
+
limit: isPaginated ? itemsPerPage : infiniteLimit,
|
|
225985
|
+
offset: isPaginated ? (currentPage - 1) * itemsPerPage : undefined,
|
|
225986
|
+
});
|
|
225987
|
+
const totalPages = Math.ceil(result.totalCount / itemsPerPage);
|
|
225988
|
+
const handlePageChange = React__default.useCallback((page) => {
|
|
225989
|
+
setCurrentPage(page);
|
|
225990
|
+
}, []);
|
|
225991
|
+
const loadMore = React__default.useCallback(() => {
|
|
225992
|
+
setInfiniteLimit((prev) => prev + itemsPerPage);
|
|
225993
|
+
}, [itemsPerPage]);
|
|
225976
225994
|
return {
|
|
225977
|
-
|
|
225978
|
-
totalCount: username ? (mentors === null || mentors === void 0 ? void 0 : mentors.count) || 0 : (publicMentors === null || publicMentors === void 0 ? void 0 : publicMentors.count) || 0,
|
|
225979
|
-
isLoading: username ? isMentorsLoading : isPublicMentorsLoading,
|
|
225980
|
-
isFetching: username ? isMentorsFetching : isPublicMentorsFetching,
|
|
225981
|
-
error: username ? mentorsError : publicMentorsError,
|
|
225995
|
+
...result,
|
|
225982
225996
|
searchQuery,
|
|
225983
225997
|
setSearchQuery,
|
|
225998
|
+
debouncedQuery,
|
|
225984
225999
|
currentPage,
|
|
225985
226000
|
totalPages,
|
|
225986
226001
|
handlePageChange,
|
|
225987
|
-
|
|
225988
|
-
itemsPerPage,
|
|
226002
|
+
loadMore,
|
|
225989
226003
|
};
|
|
225990
226004
|
}
|
|
225991
226005
|
|
|
226006
|
+
/**
|
|
226007
|
+
* Hook for starring / un-starring agents.
|
|
226008
|
+
*
|
|
226009
|
+
* Extracted so the star logic can be shared by any component that renders
|
|
226010
|
+
* agent cards with a favorite toggle.
|
|
226011
|
+
*/
|
|
226012
|
+
function useAgentStar({ tenantKey, username, onUnauthenticatedAction, }) {
|
|
226013
|
+
const [starAgent] = useStarMentorMutation();
|
|
226014
|
+
const [unstarAgent] = useUnstarMentorMutation();
|
|
226015
|
+
const [togglingAgentId, setTogglingAgentId] = React__default.useState(null);
|
|
226016
|
+
const toggleFavorite = React__default.useCallback(async (agent, event) => {
|
|
226017
|
+
event.stopPropagation();
|
|
226018
|
+
if (!username) {
|
|
226019
|
+
onUnauthenticatedAction === null || onUnauthenticatedAction === void 0 ? void 0 : onUnauthenticatedAction();
|
|
226020
|
+
return;
|
|
226021
|
+
}
|
|
226022
|
+
if (!tenantKey)
|
|
226023
|
+
return;
|
|
226024
|
+
setTogglingAgentId(String(agent.id));
|
|
226025
|
+
try {
|
|
226026
|
+
const mutation = agent.starred ? unstarAgent : starAgent;
|
|
226027
|
+
await mutation({
|
|
226028
|
+
org: tenantKey,
|
|
226029
|
+
// @ts-expect-error userId param type mismatch in data-layer
|
|
226030
|
+
userId: username,
|
|
226031
|
+
mentor: agent.unique_id || '',
|
|
226032
|
+
}).unwrap();
|
|
226033
|
+
}
|
|
226034
|
+
catch (error) {
|
|
226035
|
+
console.error('Error toggling favorite:', error);
|
|
226036
|
+
}
|
|
226037
|
+
finally {
|
|
226038
|
+
setTogglingAgentId(null);
|
|
226039
|
+
}
|
|
226040
|
+
}, [username, tenantKey, starAgent, unstarAgent, onUnauthenticatedAction]);
|
|
226041
|
+
return { toggleFavorite, togglingAgentId };
|
|
226042
|
+
}
|
|
226043
|
+
|
|
225992
226044
|
function MentorSelectionGrid({ selectedMentorIds, onMentorSelect, searchQuery, onSearchChange, tenantKey, itemsPerPage = 8, showSearch = true, minHeight = '400px', }) {
|
|
225993
226045
|
const t = useT();
|
|
225994
|
-
const { mentors, isLoading: isMentorsLoading, isFetching: isMentorsFetching, currentPage, totalPages, setSearchQuery: setMentorSearch, handlePageChange, } =
|
|
226046
|
+
const { agents: mentors, isLoading: isMentorsLoading, isFetching: isMentorsFetching, currentPage, totalPages, setSearchQuery: setMentorSearch, handlePageChange, } = useAgentSearchWithPagination({ tenantKey, itemsPerPage });
|
|
225995
226047
|
// Update search query with debounce effect handled by the hook
|
|
225996
226048
|
React__default.useEffect(() => {
|
|
225997
226049
|
setMentorSearch(searchQuery);
|
|
@@ -227910,7 +227962,7 @@ var projectInstructionsModal = /*#__PURE__*/Object.freeze({
|
|
|
227910
227962
|
ProjectInstructionsModal: ProjectInstructionsModal
|
|
227911
227963
|
});
|
|
227912
227964
|
|
|
227913
|
-
function OrganizationTab({ platformKey, setOrganizationLogoFromOutside, tenant, onTenantUpdate, defaultSupportPhone = '', }) {
|
|
227965
|
+
function OrganizationTab({ platformKey, setOrganizationLogoFromOutside, tenant, onTenantUpdate, defaultSupportPhone = '', enableSupportPhone, }) {
|
|
227914
227966
|
const t = useT();
|
|
227915
227967
|
const { setMetadata } = useTenantContext();
|
|
227916
227968
|
const [uploadPlatformLogo] = useUploadLightLogoMutation();
|
|
@@ -227955,15 +228007,13 @@ function OrganizationTab({ platformKey, setOrganizationLogoFromOutside, tenant,
|
|
|
227955
228007
|
setTempSupportEmail((metadata === null || metadata === void 0 ? void 0 : metadata.support_email) || defaultSupportEmail);
|
|
227956
228008
|
setSupportPhone((metadata === null || metadata === void 0 ? void 0 : metadata.support_phone) || defaultSupportPhone);
|
|
227957
228009
|
setTempSupportPhone((metadata === null || metadata === void 0 ? void 0 : metadata.support_phone) || defaultSupportPhone);
|
|
227958
|
-
|
|
227959
|
-
setShowSupportPhone((metadata === null || metadata === void 0 ? void 0 : metadata.enable_support_phone) !== false);
|
|
228010
|
+
setShowSupportPhone(enableSupportPhone !== null && enableSupportPhone !== void 0 ? enableSupportPhone : (metadata === null || metadata === void 0 ? void 0 : metadata.enable_support_phone) !== false);
|
|
227960
228011
|
const strippedHelpCenterUrl = stripProtocol((metadata === null || metadata === void 0 ? void 0 : metadata.help_center_url) || DEFAULT_HELP_CENTER_URL);
|
|
227961
228012
|
setHelpCenterUrl(strippedHelpCenterUrl);
|
|
227962
228013
|
setTempHelpCenterUrl(strippedHelpCenterUrl);
|
|
227963
|
-
// show_help is truthy when empty, null, undefined, or true; falsy only when explicitly false
|
|
227964
228014
|
setShowHelp((metadata === null || metadata === void 0 ? void 0 : metadata.show_help) !== false);
|
|
227965
228015
|
}
|
|
227966
|
-
}, [metadataLoaded]);
|
|
228016
|
+
}, [metadataLoaded, enableSupportPhone]);
|
|
227967
228017
|
const handleUploadLogo = async (logo, darkLogo = false) => {
|
|
227968
228018
|
try {
|
|
227969
228019
|
const formData = new FormData();
|
|
@@ -228155,7 +228205,7 @@ function OrganizationTab({ platformKey, setOrganizationLogoFromOutside, tenant,
|
|
|
228155
228205
|
}, className: "hidden" })] })] })] })] }));
|
|
228156
228206
|
}
|
|
228157
228207
|
|
|
228158
|
-
function Account({ tenant, tenants = [], username, onInviteClick, email, mainPlatformKey, userActiveApp = null, showPlatformName = false, isAdmin = false, targetTab = 'basic', currentPlan: _currentPlan = '', currentSPA = '', authURL, onTenantUpdate, currentPlatformBaseDomain = '', enableRbac = false, rbacPermissions = {}, onLoadGroupPermissions, onTabChange, defaultSupportPhone = '', }) {
|
|
228208
|
+
function Account({ tenant, tenants = [], username, onInviteClick, email, mainPlatformKey, userActiveApp = null, showPlatformName = false, isAdmin = false, targetTab = 'basic', currentPlan: _currentPlan = '', currentSPA = '', authURL, onTenantUpdate, currentPlatformBaseDomain = '', enableRbac = false, rbacPermissions = {}, onLoadGroupPermissions, onTabChange, defaultSupportPhone = '', enableSupportPhone, }) {
|
|
228159
228209
|
const t = useT();
|
|
228160
228210
|
const currentTenant = tenants.find((ten) => ten.key === tenant);
|
|
228161
228211
|
const hasMonetizationPermission = checkRbacPermission(rbacPermissions, `/platforms/${tenant}/#can_sell_items`, enableRbac);
|
|
@@ -228251,10 +228301,10 @@ function Account({ tenant, tenants = [], username, onInviteClick, email, mainPla
|
|
|
228251
228301
|
: 'text-gray-600 hover:bg-gray-50'}`, children: [jsx(CreditCard, { className: "h-4 w-4" }), jsx("span", { className: "hidden sm:inline", children: t('profileAccount.tabBilling') }), jsx("span", { className: "sm:hidden", children: t('profileAccount.tabBilling') })] }, 'billing'))] }) }) }), jsxs("div", { className: "flex-1 flex flex-col overflow-hidden", style: { height: '100%' }, children: [jsxs("div", { className: "hidden lg:block flex-shrink-0 p-6 border-b border-gray-200 bg-white dark:bg-gray-900", children: [jsx("h3", { className: "text-lg font-medium text-gray-900 dark:text-gray-100 mb-2 capitalize", children: activeTab }), jsxs("p", { className: "text-gray-600 dark:text-gray-400 text-sm", children: [activeTab === 'management' && t('profileAccount.descManagement'), activeTab === 'organization' && t('profileAccount.descOrganization'), activeTab === 'integrations' && t('profileAccount.descIntegrations'), activeTab === 'billing' && t('profileAccount.descBilling'), activeTab === 'monetization' && t('profileAccount.descMonetization'), activeTab === 'advanced' && t('profileAccount.descAdvanced')] })] }), jsxs("div", { className: "flex-1 p-6 space-y-6", style: {
|
|
228252
228302
|
overflowY: 'auto',
|
|
228253
228303
|
overflowX: 'hidden',
|
|
228254
|
-
}, children: [jsxs("div", { className: "lg:hidden mb-6", children: [jsx("h3", { className: "text-lg font-medium text-gray-900 dark:text-gray-100 mb-2 capitalize", children: activeTab }), jsxs("p", { className: "text-gray-600 dark:text-gray-400 text-sm", children: [activeTab === 'basic' && t('profileAccount.descBasic'), activeTab === 'social' && t('profileAccount.descSocial'), activeTab === 'security' && t('profileAccount.descSecurity'), activeTab === 'management' && t('profileAccount.descManagement'), activeTab === 'organization' && t('profileAccount.descOrganization'), activeTab === 'monetization' && t('profileAccount.descMonetization'), activeTab === 'advanced' && t('profileAccount.descAdvanced')] })] }), activeTab === 'management' && hasManagementPermissions && (jsx(Admin, { onInviteClick: onInviteClick, tenant: tenant, hasUserTabPermission: hasUserTabPermission, hasGroupsTabPermission: hasGroupsTabPermission, hasPoliciesTabPermission: hasPoliciesTabPermission, hasRolesTabPermission: hasRolesTabPermission, hasTeamsTabPermission: hasTeamsTabPermission, hasInviteUserPermission: hasInviteUserPermission, hasCreateTeamPermission: hasCreateTeamPermission, onLoadGroupPermissions: onLoadGroupPermissions, hasAlertsTabPermission: hasAlertsTabPermission, rbacPermissions: rbacPermissions, enableRbac: enableRbac })), activeTab === 'organization' && (jsx(OrganizationTab, { platformKey: tenant, tenant: tenants.find((ten) => ten.key === tenant), onTenantUpdate: onTenantUpdate, setOrganizationLogoFromOutside: setOrganizationLogo, defaultSupportPhone: defaultSupportPhone })), activeTab === 'integrations' && (jsx(IntegrationsTab, { tenantKey: tenant, username: username })), activeTab === 'billing' && (jsx(BillingTab, { tenant: tenant, userActiveApp: userActiveApp, username: username, currentUserEmail: email, mainPlatformKey: mainPlatformKey })), activeTab === 'monetization' && (jsx(MonetizationTab, { platformKey: tenant, authURL: authURL })), activeTab === 'advanced' && (jsx(AdvancedTab, { platformKey: tenant, currentSPA: currentSPA, username: username, authURL: authURL, currentPlatformBaseDomain: currentPlatformBaseDomain }))] })] }), jsx(ToastProvider, {})] }));
|
|
228304
|
+
}, children: [jsxs("div", { className: "lg:hidden mb-6", children: [jsx("h3", { className: "text-lg font-medium text-gray-900 dark:text-gray-100 mb-2 capitalize", children: activeTab }), jsxs("p", { className: "text-gray-600 dark:text-gray-400 text-sm", children: [activeTab === 'basic' && t('profileAccount.descBasic'), activeTab === 'social' && t('profileAccount.descSocial'), activeTab === 'security' && t('profileAccount.descSecurity'), activeTab === 'management' && t('profileAccount.descManagement'), activeTab === 'organization' && t('profileAccount.descOrganization'), activeTab === 'monetization' && t('profileAccount.descMonetization'), activeTab === 'advanced' && t('profileAccount.descAdvanced')] })] }), activeTab === 'management' && hasManagementPermissions && (jsx(Admin, { onInviteClick: onInviteClick, tenant: tenant, hasUserTabPermission: hasUserTabPermission, hasGroupsTabPermission: hasGroupsTabPermission, hasPoliciesTabPermission: hasPoliciesTabPermission, hasRolesTabPermission: hasRolesTabPermission, hasTeamsTabPermission: hasTeamsTabPermission, hasInviteUserPermission: hasInviteUserPermission, hasCreateTeamPermission: hasCreateTeamPermission, onLoadGroupPermissions: onLoadGroupPermissions, hasAlertsTabPermission: hasAlertsTabPermission, rbacPermissions: rbacPermissions, enableRbac: enableRbac })), activeTab === 'organization' && (jsx(OrganizationTab, { platformKey: tenant, tenant: tenants.find((ten) => ten.key === tenant), onTenantUpdate: onTenantUpdate, setOrganizationLogoFromOutside: setOrganizationLogo, defaultSupportPhone: defaultSupportPhone, enableSupportPhone: enableSupportPhone })), activeTab === 'integrations' && (jsx(IntegrationsTab, { tenantKey: tenant, username: username })), activeTab === 'billing' && (jsx(BillingTab, { tenant: tenant, userActiveApp: userActiveApp, username: username, currentUserEmail: email, mainPlatformKey: mainPlatformKey })), activeTab === 'monetization' && (jsx(MonetizationTab, { platformKey: tenant, authURL: authURL })), activeTab === 'advanced' && (jsx(AdvancedTab, { platformKey: tenant, currentSPA: currentSPA, username: username, authURL: authURL, currentPlatformBaseDomain: currentPlatformBaseDomain }))] })] }), jsx(ToastProvider, {})] }));
|
|
228255
228305
|
}
|
|
228256
228306
|
|
|
228257
|
-
function UserProfileModal({ isOpen, onClose, params, email, mainPlatformKey, showMentorAIDisplayCheckbox = false, showLeaderboardDisplayCheckbox = false, showUsernameField = false, showPlatformName = false, useGravatarPicFallback = true, enableCatalogInvite = false, targetTab = 'basic', currentPlan = '', currentSPA = '', userActiveApp = null, authURL, tenants = [], onTenantUpdate, currentPlatformBaseDomain = '', rbacPermissions = {}, enableRbac = false, onLoadGroupPermissions, onTabChange, defaultSupportPhone = '', onBillingTabRequest, onAccountDeleted, enableMemoryTab = false, localLLMProps, systemControlProps, }) {
|
|
228307
|
+
function UserProfileModal({ isOpen, onClose, params, email, mainPlatformKey, showMentorAIDisplayCheckbox = false, showLeaderboardDisplayCheckbox = false, showUsernameField = false, showPlatformName = false, useGravatarPicFallback = true, enableCatalogInvite = false, targetTab = 'basic', currentPlan = '', currentSPA = '', userActiveApp = null, authURL, tenants = [], onTenantUpdate, currentPlatformBaseDomain = '', rbacPermissions = {}, enableRbac = false, onLoadGroupPermissions, onTabChange, defaultSupportPhone = '', onBillingTabRequest, onAccountDeleted, enableMemoryTab = false, localLLMProps, systemControlProps, enableSupportPhone, }) {
|
|
228258
228308
|
const t = useT();
|
|
228259
228309
|
console.log('[UserProfileModal] localLLMProps received:', {
|
|
228260
228310
|
isAvailable: localLLMProps === null || localLLMProps === void 0 ? void 0 : localLLMProps.isAvailable,
|
|
@@ -228319,7 +228369,7 @@ function UserProfileModal({ isOpen, onClose, params, email, mainPlatformKey, sho
|
|
|
228319
228369
|
showUsernameField: showUsernameField,
|
|
228320
228370
|
showPlatformName: showPlatformName,
|
|
228321
228371
|
useGravatarPicFallback: useGravatarPicFallback,
|
|
228322
|
-
}, isAdmin: params.isAdmin, targetTab: targetTab, onClose: onClose, onAccountDeleted: onAccountDeleted, enableMemoryTab: enableMemoryTab, localLLMProps: localLLMProps, systemControlProps: systemControlProps })), ['organization', 'management', 'integrations', 'billing', 'monetization'].includes(targetTab) && (jsxs(Fragment$1, { children: [jsx(Account, { onInviteClick: () => setIsInviteUserDialogOpen(true), tenant: params.tenantKey, tenants: tenants, username: getUserName$1(), email: email, mainPlatformKey: mainPlatformKey, showUsernameField: showUsernameField, showPlatformName: showPlatformName, useGravatarPicFallback: useGravatarPicFallback, onClose: onClose, isAdmin: params.isAdmin, targetTab: targetTab, currentPlan: currentPlan, currentSPA: currentSPA, userActiveApp: userActiveApp, authURL: authURL, onTenantUpdate: onTenantUpdate, currentPlatformBaseDomain: currentPlatformBaseDomain, rbacPermissions: rbacPermissions, enableRbac: enableRbac, onLoadGroupPermissions: onLoadGroupPermissions, onTabChange: onTabChange, defaultSupportPhone: defaultSupportPhone }), isInviteUserDialogOpen && (jsx(InviteUserDialog, { tenant: params.tenantKey, onClose: () => setIsInviteUserDialogOpen(false), isOpen: isInviteUserDialogOpen, enableCatalogInvite: enableCatalogInvite, hasManageUsersPermission: hasManageUsersPermission })), isInvitedUsersDialogOpen && (jsx(InvitedUsersDialog, { onClose: () => setIsInvitedUsersDialogOpen(false), tenant: params.tenantKey }))] }))] }) }) }));
|
|
228372
|
+
}, isAdmin: params.isAdmin, targetTab: targetTab, onClose: onClose, onAccountDeleted: onAccountDeleted, enableMemoryTab: enableMemoryTab, localLLMProps: localLLMProps, systemControlProps: systemControlProps })), ['organization', 'management', 'integrations', 'billing', 'monetization'].includes(targetTab) && (jsxs(Fragment$1, { children: [jsx(Account, { onInviteClick: () => setIsInviteUserDialogOpen(true), tenant: params.tenantKey, tenants: tenants, username: getUserName$1(), email: email, mainPlatformKey: mainPlatformKey, showUsernameField: showUsernameField, showPlatformName: showPlatformName, useGravatarPicFallback: useGravatarPicFallback, onClose: onClose, isAdmin: params.isAdmin, targetTab: targetTab, currentPlan: currentPlan, currentSPA: currentSPA, userActiveApp: userActiveApp, authURL: authURL, onTenantUpdate: onTenantUpdate, currentPlatformBaseDomain: currentPlatformBaseDomain, rbacPermissions: rbacPermissions, enableRbac: enableRbac, onLoadGroupPermissions: onLoadGroupPermissions, onTabChange: onTabChange, defaultSupportPhone: defaultSupportPhone, enableSupportPhone: enableSupportPhone }), isInviteUserDialogOpen && (jsx(InviteUserDialog, { tenant: params.tenantKey, onClose: () => setIsInviteUserDialogOpen(false), isOpen: isInviteUserDialogOpen, enableCatalogInvite: enableCatalogInvite, hasManageUsersPermission: hasManageUsersPermission })), isInvitedUsersDialogOpen && (jsx(InvitedUsersDialog, { onClose: () => setIsInvitedUsersDialogOpen(false), tenant: params.tenantKey }))] }))] }) }) }));
|
|
228323
228373
|
}
|
|
228324
228374
|
|
|
228325
228375
|
const IS_SERVER = typeof window === 'undefined';
|
|
@@ -229070,7 +229120,7 @@ className = '', dropdownClassName = 'mr-4 w-56 bg-white border border-gray-200 s
|
|
|
229070
229120
|
// Additional data
|
|
229071
229121
|
metadata, metadataLoaded = false,
|
|
229072
229122
|
// Customization
|
|
229073
|
-
currentSPA = '', showMentorAIDisplayCheckbox = false, showLeaderboardDisplayCheckbox = false, showUsernameField = false, showPlatformName = false, enableCatalogInvite = false, authURL, onTenantUpdate, currentPlatformBaseDomain = '', rbacPermissions = {}, enableRbac = false, onLoadGroupPermissions, defaultSupportPhone = '',
|
|
229123
|
+
currentSPA = '', showMentorAIDisplayCheckbox = false, showLeaderboardDisplayCheckbox = false, showUsernameField = false, showPlatformName = false, enableCatalogInvite = false, authURL, onTenantUpdate, currentPlatformBaseDomain = '', rbacPermissions = {}, enableRbac = false, onLoadGroupPermissions, defaultSupportPhone = '', enableSupportPhone,
|
|
229074
229124
|
// Local LLM props
|
|
229075
229125
|
localLLMProps,
|
|
229076
229126
|
// System Control props
|
|
@@ -229272,6 +229322,7 @@ isModalOpen, onModalOpenChange, defaultActiveTab, onAccountDeleted, enableMemory
|
|
|
229272
229322
|
onTabChange,
|
|
229273
229323
|
onBillingTabRequest,
|
|
229274
229324
|
defaultSupportPhone,
|
|
229325
|
+
enableSupportPhone,
|
|
229275
229326
|
localLLMProps: {
|
|
229276
229327
|
isAvailable: isLocalLLMAvailable,
|
|
229277
229328
|
state: localLLMState,
|
|
@@ -240297,124 +240348,6 @@ function AgentAccessTab({ labels: labelsProp, onPermissionsLoaded }) {
|
|
|
240297
240348
|
}, children: editingPolicy && (jsxs(DialogContent, { className: "max-w-2xl", children: [jsxs(DialogHeader, { children: [jsx(DialogTitle, { children: labels.editDialog.title.replace('{role}', formatRoleName(editingPolicy.role)) }), jsx(DialogDescription, { children: labels.editDialog.description.replace('{role}', formatRoleName(editingPolicy.role)) })] }), jsx(RoleAccessPanel, { policy: editingPolicy, onAccessUpdated: handleRefetch, hasUsersPermission: hasUsersPermission, hasGroupsPermission: hasGroupsPermission })] })) })] }));
|
|
240298
240349
|
}
|
|
240299
240350
|
|
|
240300
|
-
/**
|
|
240301
|
-
* Core agent search hook — thin wrapper around `useGetAiSearchMentorsQuery`.
|
|
240302
|
-
*
|
|
240303
|
-
* This is the low-level building block. For a higher-level hook that manages
|
|
240304
|
-
* search state, debounce, and pagination controls, use
|
|
240305
|
-
* `useAgentSearchWithPagination`.
|
|
240306
|
-
*/
|
|
240307
|
-
function useAgentSearch({ tenantKey, query, limit = 6, offset, starred, featured, category, subjects, llm, types, includeMainPublicMentors, orderDirection, skip = false, }) {
|
|
240308
|
-
var _a, _b, _c;
|
|
240309
|
-
const { data, isLoading, isFetching, refetch } = useGetAiSearchMentorsQuery({
|
|
240310
|
-
platform_key: tenantKey,
|
|
240311
|
-
query: query || undefined,
|
|
240312
|
-
limit,
|
|
240313
|
-
...(offset !== undefined && { offset }),
|
|
240314
|
-
...(starred !== undefined && { starred }),
|
|
240315
|
-
...(featured !== undefined && { featured }),
|
|
240316
|
-
...(category && { category }),
|
|
240317
|
-
...(subjects && { subjects }),
|
|
240318
|
-
...(llm && { llm }),
|
|
240319
|
-
...(types && { types }),
|
|
240320
|
-
...(includeMainPublicMentors !== undefined && {
|
|
240321
|
-
include_main_public_mentors: includeMainPublicMentors,
|
|
240322
|
-
}),
|
|
240323
|
-
...(orderDirection && { order_direction: orderDirection }),
|
|
240324
|
-
}, { skip: skip || !tenantKey });
|
|
240325
|
-
return {
|
|
240326
|
-
agents: ((_a = data === null || data === void 0 ? void 0 : data.results) !== null && _a !== void 0 ? _a : []),
|
|
240327
|
-
facets: data === null || data === void 0 ? void 0 : data.facets,
|
|
240328
|
-
hasMore: !!(data === null || data === void 0 ? void 0 : data.next),
|
|
240329
|
-
totalCount: (_b = data === null || data === void 0 ? void 0 : data.count) !== null && _b !== void 0 ? _b : 0,
|
|
240330
|
-
totalPages: (_c = data === null || data === void 0 ? void 0 : data.total_pages) !== null && _c !== void 0 ? _c : 0,
|
|
240331
|
-
isLoading,
|
|
240332
|
-
isFetching,
|
|
240333
|
-
refetch,
|
|
240334
|
-
};
|
|
240335
|
-
}
|
|
240336
|
-
|
|
240337
|
-
/**
|
|
240338
|
-
* Higher-level agent search hook that manages search state, debounce, and
|
|
240339
|
-
* pagination controls on top of `useAgentSearch`.
|
|
240340
|
-
*
|
|
240341
|
-
* Use this for simple list/table views (MyMentorsModal, SettingsModal).
|
|
240342
|
-
* For the full explore page with sections, use `useAgentSearch` directly.
|
|
240343
|
-
*/
|
|
240344
|
-
function useAgentSearchWithPagination({ itemsPerPage = 6, paginationMode = 'paginated', debounceMs = 500, ...queryConfig }) {
|
|
240345
|
-
const [searchQuery, setSearchQuery] = React__default.useState('');
|
|
240346
|
-
const [debouncedQuery] = a$3(searchQuery, debounceMs);
|
|
240347
|
-
const [currentPage, setCurrentPage] = React__default.useState(1);
|
|
240348
|
-
const [infiniteLimit, setInfiniteLimit] = React__default.useState(itemsPerPage);
|
|
240349
|
-
// Reset pagination when search changes
|
|
240350
|
-
React__default.useEffect(() => {
|
|
240351
|
-
setCurrentPage(1);
|
|
240352
|
-
setInfiniteLimit(itemsPerPage);
|
|
240353
|
-
}, [debouncedQuery, itemsPerPage]);
|
|
240354
|
-
const isPaginated = paginationMode === 'paginated';
|
|
240355
|
-
const result = useAgentSearch({
|
|
240356
|
-
...queryConfig,
|
|
240357
|
-
query: debouncedQuery,
|
|
240358
|
-
limit: isPaginated ? itemsPerPage : infiniteLimit,
|
|
240359
|
-
offset: isPaginated ? (currentPage - 1) * itemsPerPage : undefined,
|
|
240360
|
-
});
|
|
240361
|
-
const totalPages = Math.ceil(result.totalCount / itemsPerPage);
|
|
240362
|
-
const handlePageChange = React__default.useCallback((page) => {
|
|
240363
|
-
setCurrentPage(page);
|
|
240364
|
-
}, []);
|
|
240365
|
-
const loadMore = React__default.useCallback(() => {
|
|
240366
|
-
setInfiniteLimit((prev) => prev + itemsPerPage);
|
|
240367
|
-
}, [itemsPerPage]);
|
|
240368
|
-
return {
|
|
240369
|
-
...result,
|
|
240370
|
-
searchQuery,
|
|
240371
|
-
setSearchQuery,
|
|
240372
|
-
debouncedQuery,
|
|
240373
|
-
currentPage,
|
|
240374
|
-
totalPages,
|
|
240375
|
-
handlePageChange,
|
|
240376
|
-
loadMore,
|
|
240377
|
-
};
|
|
240378
|
-
}
|
|
240379
|
-
|
|
240380
|
-
/**
|
|
240381
|
-
* Hook for starring / un-starring agents.
|
|
240382
|
-
*
|
|
240383
|
-
* Extracted so the star logic can be shared by any component that renders
|
|
240384
|
-
* agent cards with a favorite toggle.
|
|
240385
|
-
*/
|
|
240386
|
-
function useAgentStar({ tenantKey, username, onUnauthenticatedAction, }) {
|
|
240387
|
-
const [starAgent] = useStarMentorMutation();
|
|
240388
|
-
const [unstarAgent] = useUnstarMentorMutation();
|
|
240389
|
-
const [togglingAgentId, setTogglingAgentId] = React__default.useState(null);
|
|
240390
|
-
const toggleFavorite = React__default.useCallback(async (agent, event) => {
|
|
240391
|
-
event.stopPropagation();
|
|
240392
|
-
if (!username) {
|
|
240393
|
-
onUnauthenticatedAction === null || onUnauthenticatedAction === void 0 ? void 0 : onUnauthenticatedAction();
|
|
240394
|
-
return;
|
|
240395
|
-
}
|
|
240396
|
-
if (!tenantKey)
|
|
240397
|
-
return;
|
|
240398
|
-
setTogglingAgentId(String(agent.id));
|
|
240399
|
-
try {
|
|
240400
|
-
const mutation = agent.starred ? unstarAgent : starAgent;
|
|
240401
|
-
await mutation({
|
|
240402
|
-
org: tenantKey,
|
|
240403
|
-
// @ts-expect-error userId param type mismatch in data-layer
|
|
240404
|
-
userId: username,
|
|
240405
|
-
mentor: agent.unique_id || '',
|
|
240406
|
-
}).unwrap();
|
|
240407
|
-
}
|
|
240408
|
-
catch (error) {
|
|
240409
|
-
console.error('Error toggling favorite:', error);
|
|
240410
|
-
}
|
|
240411
|
-
finally {
|
|
240412
|
-
setTogglingAgentId(null);
|
|
240413
|
-
}
|
|
240414
|
-
}, [username, tenantKey, starAgent, unstarAgent, onUnauthenticatedAction]);
|
|
240415
|
-
return { toggleFavorite, togglingAgentId };
|
|
240416
|
-
}
|
|
240417
|
-
|
|
240418
240351
|
const CUSTOM_AGENTS_LIMIT = 6;
|
|
240419
240352
|
const AgentSearchContext = React__default.createContext(null);
|
|
240420
240353
|
function useAgentSearchContext() {
|
|
@@ -244466,6 +244399,7 @@ function Chat({ mode = 'default', isPreviewMode = false, hasBorder = true, isInC
|
|
|
244466
244399
|
wsUrl: `${config.baseWsUrl()}/ws/langflow/`,
|
|
244467
244400
|
/* istanbul ignore next -- @preserve Tauri offline error handler */
|
|
244468
244401
|
errorHandler: async (message, error) => {
|
|
244402
|
+
var _a, _b;
|
|
244469
244403
|
// Suppress errors when offline in Tauri - these are expected
|
|
244470
244404
|
// Use multiple checks for faster detection:
|
|
244471
244405
|
// 1. React state (isOfflineInTauri) - updated via service worker polling
|
|
@@ -244483,7 +244417,7 @@ function Chat({ mode = 'default', isPreviewMode = false, hasBorder = true, isInC
|
|
|
244483
244417
|
if (error) {
|
|
244484
244418
|
console.error(JSON.stringify({ tenant: tenantKey, error }));
|
|
244485
244419
|
}
|
|
244486
|
-
toast.error(jsx(ToastErrorMessage, { message: message, supportEmail: (metadata === null || metadata === void 0 ? void 0 : metadata.support_email) || config.supportEmail(), supportPhone: metadata === null || metadata === void 0 ? void 0 : metadata.support_phone, useSupportPhone: isSupportPhoneEnabled(), tenantKey: tenantKey }), { closeButton: true, duration: TOAST_DURATION });
|
|
244420
|
+
toast.error(jsx(ToastErrorMessage, { message: message, supportEmail: (metadata === null || metadata === void 0 ? void 0 : metadata.support_email) || config.supportEmail(), supportPhone: metadata === null || metadata === void 0 ? void 0 : metadata.support_phone, useSupportPhone: (_b = (_a = config.enableSupportPhone) === null || _a === void 0 ? void 0 : _a.call(config)) !== null && _b !== void 0 ? _b : isSupportPhoneEnabled(), tenantKey: tenantKey }), { closeButton: true, duration: TOAST_DURATION });
|
|
244487
244421
|
},
|
|
244488
244422
|
redirectToAuthSpa,
|
|
244489
244423
|
sendMessageToParentWebsite,
|
|
@@ -244525,10 +244459,11 @@ function Chat({ mode = 'default', isPreviewMode = false, hasBorder = true, isInC
|
|
|
244525
244459
|
username: username !== null && username !== void 0 ? username : ANONYMOUS_USERNAME$2,
|
|
244526
244460
|
isPublicRoute: isAccessingPublicRoute,
|
|
244527
244461
|
errorHandler: async (message, error) => {
|
|
244462
|
+
var _a, _b;
|
|
244528
244463
|
if (error) {
|
|
244529
244464
|
console.error(JSON.stringify({ tenant: tenantKey, error }));
|
|
244530
244465
|
}
|
|
244531
|
-
toast.error(jsx(ToastErrorMessage, { message: message, supportEmail: (metadata === null || metadata === void 0 ? void 0 : metadata.support_email) || config.supportEmail(), supportPhone: metadata === null || metadata === void 0 ? void 0 : metadata.support_phone, useSupportPhone: isSupportPhoneEnabled(), tenantKey: tenantKey }), { closeButton: true, duration: TOAST_DURATION });
|
|
244466
|
+
toast.error(jsx(ToastErrorMessage, { message: message, supportEmail: (metadata === null || metadata === void 0 ? void 0 : metadata.support_email) || config.supportEmail(), supportPhone: metadata === null || metadata === void 0 ? void 0 : metadata.support_phone, useSupportPhone: (_b = (_a = config.enableSupportPhone) === null || _a === void 0 ? void 0 : _a.call(config)) !== null && _b !== void 0 ? _b : isSupportPhoneEnabled(), tenantKey: tenantKey }), { closeButton: true, duration: TOAST_DURATION });
|
|
244532
244467
|
},
|
|
244533
244468
|
});
|
|
244534
244469
|
const [mentorAccessibilityMessage, setMentorAccessibilityMessage] = useState('');
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@iblai/iblai-js",
|
|
3
|
-
"version": "1.20.
|
|
3
|
+
"version": "1.20.11",
|
|
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,9 +66,9 @@
|
|
|
66
66
|
"axios": "1.13.6",
|
|
67
67
|
"dotenv": "16.6.1",
|
|
68
68
|
"winston": "3.19.0",
|
|
69
|
-
"@iblai/mcp": "1.7.4",
|
|
70
69
|
"@iblai/data-layer": "1.8.6",
|
|
71
|
-
"@iblai/
|
|
70
|
+
"@iblai/mcp": "1.7.5",
|
|
71
|
+
"@iblai/web-containers": "1.10.10",
|
|
72
72
|
"@iblai/web-utils": "1.11.5"
|
|
73
73
|
},
|
|
74
74
|
"peerDependencies": {
|