@iblai/iblai-js 1.20.10 → 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';
|
|
@@ -222927,74 +222927,89 @@ var minimumMentorAlert = /*#__PURE__*/Object.freeze({
|
|
|
222927
222927
|
MinimumMentorAlert: MinimumMentorAlert
|
|
222928
222928
|
});
|
|
222929
222929
|
|
|
222930
|
-
|
|
222931
|
-
|
|
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 }) {
|
|
222932
222975
|
const [searchQuery, setSearchQuery] = React__default.useState('');
|
|
222933
|
-
const [
|
|
222976
|
+
const [debouncedQuery] = a(searchQuery, debounceMs);
|
|
222934
222977
|
const [currentPage, setCurrentPage] = React__default.useState(1);
|
|
222935
|
-
const [
|
|
222936
|
-
|
|
222937
|
-
offset: 0,
|
|
222938
|
-
query: debouncedSearchQuery,
|
|
222939
|
-
orderBy: 'created_at',
|
|
222940
|
-
orderDirection: 'desc',
|
|
222941
|
-
});
|
|
222942
|
-
const { data: mentors, isLoading: isMentorsLoading, isFetching: isMentorsFetching, error: mentorsError, } = useGetMentorsQuery({
|
|
222943
|
-
org: tenantKey,
|
|
222944
|
-
username: username !== null && username !== void 0 ? username : '',
|
|
222945
|
-
...queryParams,
|
|
222946
|
-
}, {
|
|
222947
|
-
skip: !tenantKey || !username,
|
|
222948
|
-
refetchOnMountOrArgChange: true,
|
|
222949
|
-
});
|
|
222950
|
-
const { data: publicMentors, isLoading: isPublicMentorsLoading, isFetching: isPublicMentorsFetching, error: publicMentorsError, } = useGetPublicMentorsQuery({ ...queryParams }, {
|
|
222951
|
-
skip: !!username,
|
|
222952
|
-
refetchOnMountOrArgChange: true,
|
|
222953
|
-
});
|
|
222954
|
-
// Effect to update offset when page changes
|
|
222955
|
-
React__default.useEffect(() => {
|
|
222956
|
-
setQueryParams((prev) => ({
|
|
222957
|
-
...prev,
|
|
222958
|
-
offset: (currentPage - 1) * itemsPerPage,
|
|
222959
|
-
}));
|
|
222960
|
-
}, [currentPage, itemsPerPage]);
|
|
222961
|
-
// Effect to update query parameter when search changes
|
|
222978
|
+
const [infiniteLimit, setInfiniteLimit] = React__default.useState(itemsPerPage);
|
|
222979
|
+
// Reset pagination when search changes
|
|
222962
222980
|
React__default.useEffect(() => {
|
|
222963
|
-
|
|
222964
|
-
|
|
222965
|
-
|
|
222966
|
-
|
|
222967
|
-
|
|
222968
|
-
|
|
222969
|
-
|
|
222970
|
-
|
|
222971
|
-
|
|
222972
|
-
|
|
222973
|
-
|
|
222974
|
-
|
|
222975
|
-
|
|
222976
|
-
|
|
222977
|
-
const
|
|
222978
|
-
|
|
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]);
|
|
222979
222998
|
return {
|
|
222980
|
-
|
|
222981
|
-
totalCount: username ? (mentors === null || mentors === void 0 ? void 0 : mentors.count) || 0 : (publicMentors === null || publicMentors === void 0 ? void 0 : publicMentors.count) || 0,
|
|
222982
|
-
isLoading: username ? isMentorsLoading : isPublicMentorsLoading,
|
|
222983
|
-
isFetching: username ? isMentorsFetching : isPublicMentorsFetching,
|
|
222984
|
-
error: username ? mentorsError : publicMentorsError,
|
|
222999
|
+
...result,
|
|
222985
223000
|
searchQuery,
|
|
222986
223001
|
setSearchQuery,
|
|
223002
|
+
debouncedQuery,
|
|
222987
223003
|
currentPage,
|
|
222988
223004
|
totalPages,
|
|
222989
223005
|
handlePageChange,
|
|
222990
|
-
|
|
222991
|
-
itemsPerPage,
|
|
223006
|
+
loadMore,
|
|
222992
223007
|
};
|
|
222993
223008
|
}
|
|
222994
223009
|
|
|
222995
223010
|
function MentorSelectionGrid({ selectedMentorIds, onMentorSelect, searchQuery, onSearchChange, tenantKey, itemsPerPage = 8, showSearch = true, minHeight = '400px', }) {
|
|
222996
223011
|
const t = useT();
|
|
222997
|
-
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 });
|
|
222998
223013
|
// Update search query with debounce effect handled by the hook
|
|
222999
223014
|
React__default.useEffect(() => {
|
|
223000
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';
|
|
@@ -225923,74 +225923,127 @@ var minimumMentorAlert = /*#__PURE__*/Object.freeze({
|
|
|
225923
225923
|
MinimumMentorAlert: MinimumMentorAlert
|
|
225924
225924
|
});
|
|
225925
225925
|
|
|
225926
|
-
|
|
225927
|
-
|
|
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 }) {
|
|
225928
225971
|
const [searchQuery, setSearchQuery] = React__default.useState('');
|
|
225929
|
-
const [
|
|
225972
|
+
const [debouncedQuery] = a$3(searchQuery, debounceMs);
|
|
225930
225973
|
const [currentPage, setCurrentPage] = React__default.useState(1);
|
|
225931
|
-
const [
|
|
225932
|
-
|
|
225933
|
-
offset: 0,
|
|
225934
|
-
query: debouncedSearchQuery,
|
|
225935
|
-
orderBy: 'created_at',
|
|
225936
|
-
orderDirection: 'desc',
|
|
225937
|
-
});
|
|
225938
|
-
const { data: mentors, isLoading: isMentorsLoading, isFetching: isMentorsFetching, error: mentorsError, } = useGetMentorsQuery({
|
|
225939
|
-
org: tenantKey,
|
|
225940
|
-
username: username !== null && username !== void 0 ? username : '',
|
|
225941
|
-
...queryParams,
|
|
225942
|
-
}, {
|
|
225943
|
-
skip: !tenantKey || !username,
|
|
225944
|
-
refetchOnMountOrArgChange: true,
|
|
225945
|
-
});
|
|
225946
|
-
const { data: publicMentors, isLoading: isPublicMentorsLoading, isFetching: isPublicMentorsFetching, error: publicMentorsError, } = useGetPublicMentorsQuery({ ...queryParams }, {
|
|
225947
|
-
skip: !!username,
|
|
225948
|
-
refetchOnMountOrArgChange: true,
|
|
225949
|
-
});
|
|
225950
|
-
// Effect to update offset when page changes
|
|
225951
|
-
React__default.useEffect(() => {
|
|
225952
|
-
setQueryParams((prev) => ({
|
|
225953
|
-
...prev,
|
|
225954
|
-
offset: (currentPage - 1) * itemsPerPage,
|
|
225955
|
-
}));
|
|
225956
|
-
}, [currentPage, itemsPerPage]);
|
|
225957
|
-
// Effect to update query parameter when search changes
|
|
225974
|
+
const [infiniteLimit, setInfiniteLimit] = React__default.useState(itemsPerPage);
|
|
225975
|
+
// Reset pagination when search changes
|
|
225958
225976
|
React__default.useEffect(() => {
|
|
225959
|
-
|
|
225960
|
-
|
|
225961
|
-
|
|
225962
|
-
|
|
225963
|
-
|
|
225964
|
-
|
|
225965
|
-
|
|
225966
|
-
|
|
225967
|
-
|
|
225968
|
-
|
|
225969
|
-
|
|
225970
|
-
|
|
225971
|
-
|
|
225972
|
-
|
|
225973
|
-
const
|
|
225974
|
-
|
|
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]);
|
|
225975
225994
|
return {
|
|
225976
|
-
|
|
225977
|
-
totalCount: username ? (mentors === null || mentors === void 0 ? void 0 : mentors.count) || 0 : (publicMentors === null || publicMentors === void 0 ? void 0 : publicMentors.count) || 0,
|
|
225978
|
-
isLoading: username ? isMentorsLoading : isPublicMentorsLoading,
|
|
225979
|
-
isFetching: username ? isMentorsFetching : isPublicMentorsFetching,
|
|
225980
|
-
error: username ? mentorsError : publicMentorsError,
|
|
225995
|
+
...result,
|
|
225981
225996
|
searchQuery,
|
|
225982
225997
|
setSearchQuery,
|
|
225998
|
+
debouncedQuery,
|
|
225983
225999
|
currentPage,
|
|
225984
226000
|
totalPages,
|
|
225985
226001
|
handlePageChange,
|
|
225986
|
-
|
|
225987
|
-
itemsPerPage,
|
|
226002
|
+
loadMore,
|
|
225988
226003
|
};
|
|
225989
226004
|
}
|
|
225990
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
|
+
|
|
225991
226044
|
function MentorSelectionGrid({ selectedMentorIds, onMentorSelect, searchQuery, onSearchChange, tenantKey, itemsPerPage = 8, showSearch = true, minHeight = '400px', }) {
|
|
225992
226045
|
const t = useT();
|
|
225993
|
-
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 });
|
|
225994
226047
|
// Update search query with debounce effect handled by the hook
|
|
225995
226048
|
React__default.useEffect(() => {
|
|
225996
226049
|
setMentorSearch(searchQuery);
|
|
@@ -240295,124 +240348,6 @@ function AgentAccessTab({ labels: labelsProp, onPermissionsLoaded }) {
|
|
|
240295
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 })] })) })] }));
|
|
240296
240349
|
}
|
|
240297
240350
|
|
|
240298
|
-
/**
|
|
240299
|
-
* Core agent search hook — thin wrapper around `useGetAiSearchMentorsQuery`.
|
|
240300
|
-
*
|
|
240301
|
-
* This is the low-level building block. For a higher-level hook that manages
|
|
240302
|
-
* search state, debounce, and pagination controls, use
|
|
240303
|
-
* `useAgentSearchWithPagination`.
|
|
240304
|
-
*/
|
|
240305
|
-
function useAgentSearch({ tenantKey, query, limit = 6, offset, starred, featured, category, subjects, llm, types, includeMainPublicMentors, orderDirection, skip = false, }) {
|
|
240306
|
-
var _a, _b, _c;
|
|
240307
|
-
const { data, isLoading, isFetching, refetch } = useGetAiSearchMentorsQuery({
|
|
240308
|
-
platform_key: tenantKey,
|
|
240309
|
-
query: query || undefined,
|
|
240310
|
-
limit,
|
|
240311
|
-
...(offset !== undefined && { offset }),
|
|
240312
|
-
...(starred !== undefined && { starred }),
|
|
240313
|
-
...(featured !== undefined && { featured }),
|
|
240314
|
-
...(category && { category }),
|
|
240315
|
-
...(subjects && { subjects }),
|
|
240316
|
-
...(llm && { llm }),
|
|
240317
|
-
...(types && { types }),
|
|
240318
|
-
...(includeMainPublicMentors !== undefined && {
|
|
240319
|
-
include_main_public_mentors: includeMainPublicMentors,
|
|
240320
|
-
}),
|
|
240321
|
-
...(orderDirection && { order_direction: orderDirection }),
|
|
240322
|
-
}, { skip: skip || !tenantKey });
|
|
240323
|
-
return {
|
|
240324
|
-
agents: ((_a = data === null || data === void 0 ? void 0 : data.results) !== null && _a !== void 0 ? _a : []),
|
|
240325
|
-
facets: data === null || data === void 0 ? void 0 : data.facets,
|
|
240326
|
-
hasMore: !!(data === null || data === void 0 ? void 0 : data.next),
|
|
240327
|
-
totalCount: (_b = data === null || data === void 0 ? void 0 : data.count) !== null && _b !== void 0 ? _b : 0,
|
|
240328
|
-
totalPages: (_c = data === null || data === void 0 ? void 0 : data.total_pages) !== null && _c !== void 0 ? _c : 0,
|
|
240329
|
-
isLoading,
|
|
240330
|
-
isFetching,
|
|
240331
|
-
refetch,
|
|
240332
|
-
};
|
|
240333
|
-
}
|
|
240334
|
-
|
|
240335
|
-
/**
|
|
240336
|
-
* Higher-level agent search hook that manages search state, debounce, and
|
|
240337
|
-
* pagination controls on top of `useAgentSearch`.
|
|
240338
|
-
*
|
|
240339
|
-
* Use this for simple list/table views (MyMentorsModal, SettingsModal).
|
|
240340
|
-
* For the full explore page with sections, use `useAgentSearch` directly.
|
|
240341
|
-
*/
|
|
240342
|
-
function useAgentSearchWithPagination({ itemsPerPage = 6, paginationMode = 'paginated', debounceMs = 500, ...queryConfig }) {
|
|
240343
|
-
const [searchQuery, setSearchQuery] = React__default.useState('');
|
|
240344
|
-
const [debouncedQuery] = a$3(searchQuery, debounceMs);
|
|
240345
|
-
const [currentPage, setCurrentPage] = React__default.useState(1);
|
|
240346
|
-
const [infiniteLimit, setInfiniteLimit] = React__default.useState(itemsPerPage);
|
|
240347
|
-
// Reset pagination when search changes
|
|
240348
|
-
React__default.useEffect(() => {
|
|
240349
|
-
setCurrentPage(1);
|
|
240350
|
-
setInfiniteLimit(itemsPerPage);
|
|
240351
|
-
}, [debouncedQuery, itemsPerPage]);
|
|
240352
|
-
const isPaginated = paginationMode === 'paginated';
|
|
240353
|
-
const result = useAgentSearch({
|
|
240354
|
-
...queryConfig,
|
|
240355
|
-
query: debouncedQuery,
|
|
240356
|
-
limit: isPaginated ? itemsPerPage : infiniteLimit,
|
|
240357
|
-
offset: isPaginated ? (currentPage - 1) * itemsPerPage : undefined,
|
|
240358
|
-
});
|
|
240359
|
-
const totalPages = Math.ceil(result.totalCount / itemsPerPage);
|
|
240360
|
-
const handlePageChange = React__default.useCallback((page) => {
|
|
240361
|
-
setCurrentPage(page);
|
|
240362
|
-
}, []);
|
|
240363
|
-
const loadMore = React__default.useCallback(() => {
|
|
240364
|
-
setInfiniteLimit((prev) => prev + itemsPerPage);
|
|
240365
|
-
}, [itemsPerPage]);
|
|
240366
|
-
return {
|
|
240367
|
-
...result,
|
|
240368
|
-
searchQuery,
|
|
240369
|
-
setSearchQuery,
|
|
240370
|
-
debouncedQuery,
|
|
240371
|
-
currentPage,
|
|
240372
|
-
totalPages,
|
|
240373
|
-
handlePageChange,
|
|
240374
|
-
loadMore,
|
|
240375
|
-
};
|
|
240376
|
-
}
|
|
240377
|
-
|
|
240378
|
-
/**
|
|
240379
|
-
* Hook for starring / un-starring agents.
|
|
240380
|
-
*
|
|
240381
|
-
* Extracted so the star logic can be shared by any component that renders
|
|
240382
|
-
* agent cards with a favorite toggle.
|
|
240383
|
-
*/
|
|
240384
|
-
function useAgentStar({ tenantKey, username, onUnauthenticatedAction, }) {
|
|
240385
|
-
const [starAgent] = useStarMentorMutation();
|
|
240386
|
-
const [unstarAgent] = useUnstarMentorMutation();
|
|
240387
|
-
const [togglingAgentId, setTogglingAgentId] = React__default.useState(null);
|
|
240388
|
-
const toggleFavorite = React__default.useCallback(async (agent, event) => {
|
|
240389
|
-
event.stopPropagation();
|
|
240390
|
-
if (!username) {
|
|
240391
|
-
onUnauthenticatedAction === null || onUnauthenticatedAction === void 0 ? void 0 : onUnauthenticatedAction();
|
|
240392
|
-
return;
|
|
240393
|
-
}
|
|
240394
|
-
if (!tenantKey)
|
|
240395
|
-
return;
|
|
240396
|
-
setTogglingAgentId(String(agent.id));
|
|
240397
|
-
try {
|
|
240398
|
-
const mutation = agent.starred ? unstarAgent : starAgent;
|
|
240399
|
-
await mutation({
|
|
240400
|
-
org: tenantKey,
|
|
240401
|
-
// @ts-expect-error userId param type mismatch in data-layer
|
|
240402
|
-
userId: username,
|
|
240403
|
-
mentor: agent.unique_id || '',
|
|
240404
|
-
}).unwrap();
|
|
240405
|
-
}
|
|
240406
|
-
catch (error) {
|
|
240407
|
-
console.error('Error toggling favorite:', error);
|
|
240408
|
-
}
|
|
240409
|
-
finally {
|
|
240410
|
-
setTogglingAgentId(null);
|
|
240411
|
-
}
|
|
240412
|
-
}, [username, tenantKey, starAgent, unstarAgent, onUnauthenticatedAction]);
|
|
240413
|
-
return { toggleFavorite, togglingAgentId };
|
|
240414
|
-
}
|
|
240415
|
-
|
|
240416
240351
|
const CUSTOM_AGENTS_LIMIT = 6;
|
|
240417
240352
|
const AgentSearchContext = React__default.createContext(null);
|
|
240418
240353
|
function useAgentSearchContext() {
|
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.5",
|
|
70
|
-
"@iblai/web-containers": "1.10.9",
|
|
71
69
|
"@iblai/data-layer": "1.8.6",
|
|
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": {
|