@iblai/data-layer 1.6.1 → 1.6.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -39826,6 +39826,12 @@ const mentorApiSlice = react.createApi({
39826
39826
  ...buildEndpointFromDmService(AiMentorService.aiMentorOrgsUsersRecentlyAccessedMentorsList),
39827
39827
  providesTags: ['mentors'],
39828
39828
  }),
39829
+ getVoices: builder.query({
39830
+ ...buildEndpointFromDmService(AiMentorService.aiMentorOrgsUsersVoicesList),
39831
+ }),
39832
+ getVoice: builder.query({
39833
+ ...buildEndpointFromDmService(AiMentorService.aiMentorOrgsUsersVoicesRetrieve),
39834
+ }),
39829
39835
  starMentor: builder.mutation({
39830
39836
  ...buildEndpointFromDmService(AiMentorService.aiMentorOrgsUsersMentorsStarCreate),
39831
39837
  invalidatesTags: ['star-mentors'],
@@ -39874,7 +39880,7 @@ const mentorApiSlice = react.createApi({
39874
39880
  }),
39875
39881
  });
39876
39882
  const mentorApiReducer = mentorApiSlice.reducer;
39877
- const { useCreateMentorMutation, useGetMentorsQuery, useLazyGetMentorsQuery, useEditMentorMutation, useSeedMentorsQuery, useLazySeedMentorsQuery, useGetMentorDetailsQuery, useLazyGetMentorDetailsQuery, useGetMentorSettingsQuery, useLazyGetMentorSettingsQuery, useGetMentorPublicSettingsQuery, useLazyGetMentorPublicSettingsQuery, useEditMentorAndRefreshListMutation, useGetFreeUsageCountQuery, useLazyGetFreeUsageCountQuery, useCreateShareableLinkMutation, useGetShareableLinkQuery, useLazyGetShareableLinkQuery, useGetShareableLinkPublicQuery, useLazyGetShareableLinkPublicQuery, useRevokeShareableLinkMutation, useUpdateShareableLinkMutation, useUpdateChatSessionSharedMutation, useDeleteMentorMutation, useForkMentorMutation, useGetPublicMentorsQuery, useLazyGetPublicMentorsQuery, useGetRecentlyAccessedMentorsQuery, useLazyGetRecentlyAccessedMentorsQuery, useStarMentorMutation, useUnstarMentorMutation, useStarredMentorsQuery, useLazyStarredMentorsQuery, useUpdateChatSessionMutation, useGetChatMessagesForSessionQuery, useLazyGetChatMessagesForSessionQuery, } = mentorApiSlice;
39883
+ const { useCreateMentorMutation, useGetMentorsQuery, useLazyGetMentorsQuery, useEditMentorMutation, useSeedMentorsQuery, useLazySeedMentorsQuery, useGetMentorDetailsQuery, useLazyGetMentorDetailsQuery, useGetMentorSettingsQuery, useLazyGetMentorSettingsQuery, useGetMentorPublicSettingsQuery, useLazyGetMentorPublicSettingsQuery, useEditMentorAndRefreshListMutation, useGetFreeUsageCountQuery, useLazyGetFreeUsageCountQuery, useCreateShareableLinkMutation, useGetShareableLinkQuery, useLazyGetShareableLinkQuery, useGetShareableLinkPublicQuery, useLazyGetShareableLinkPublicQuery, useRevokeShareableLinkMutation, useUpdateShareableLinkMutation, useUpdateChatSessionSharedMutation, useDeleteMentorMutation, useForkMentorMutation, useGetPublicMentorsQuery, useLazyGetPublicMentorsQuery, useGetRecentlyAccessedMentorsQuery, useLazyGetRecentlyAccessedMentorsQuery, useStarMentorMutation, useUnstarMentorMutation, useStarredMentorsQuery, useLazyStarredMentorsQuery, useUpdateChatSessionMutation, useGetChatMessagesForSessionQuery, useLazyGetChatMessagesForSessionQuery, useGetVoicesQuery, useLazyGetVoicesQuery, useGetVoiceQuery, useLazyGetVoiceQuery, } = mentorApiSlice;
39878
39884
 
39879
39885
  const mentorCategoriesApiSlice = react.createApi({
39880
39886
  reducerPath: 'mentorCategoriesApiSlice',
@@ -42846,6 +42852,133 @@ const mentorCustomApiSlice = react.createApi({
42846
42852
  });
42847
42853
  const { useGetCustomMentorsQuery, useLazyGetCustomMentorsQuery, useGetMentorSummariesQuery, useLazyGetMentorSummariesQuery, useGetConversationMemoriesQuery, useLazyGetConversationMemoriesQuery, useEditMentorJsonMutation, } = mentorCustomApiSlice;
42848
42854
 
42855
+ const CALL_CONFIGURATIONS_REDUCER_PATH = 'callConfigurationsApiSlice';
42856
+ const CALL_CONFIGURATIONS_ENDPOINTS = {
42857
+ LIST: {
42858
+ service: exports.SERVICES.DM,
42859
+ path: (org, userId) => `/api/ai-mentor/orgs/${org}/users/${userId}/call-configurations/`,
42860
+ },
42861
+ DETAIL: {
42862
+ service: exports.SERVICES.DM,
42863
+ path: (org, userId, id) => `/api/ai-mentor/orgs/${org}/users/${userId}/call-configurations/${id}/`,
42864
+ },
42865
+ };
42866
+ const CALL_CONFIGURATIONS_TAGS = {
42867
+ LIST: 'callConfigurations',
42868
+ DETAIL: 'callConfiguration',
42869
+ };
42870
+
42871
+ /**
42872
+ * The mentor settings endpoint embeds the current call configuration in
42873
+ * its response (`mentorSettings.call_configuration`). When we
42874
+ * create/update a CallConfiguration we therefore need to also bust the
42875
+ * `mentorSettings` cache in the sibling `mentorApiSlice`, otherwise the
42876
+ * edit-mentor modal will keep showing the pre-save snapshot.
42877
+ */
42878
+ async function invalidateMentorSettingsAfterCallConfigChange(arg, { dispatch, queryFulfilled }) {
42879
+ try {
42880
+ await queryFulfilled;
42881
+ if (arg.mentorId) {
42882
+ dispatch(mentorApiSlice.util.invalidateTags([
42883
+ { type: 'mentorSettings', id: arg.mentorId },
42884
+ { type: 'mentor', id: arg.mentorId },
42885
+ ]));
42886
+ }
42887
+ }
42888
+ catch (error) {
42889
+ console.error('Failed to invalidate mentor settings after call-config change:', error);
42890
+ }
42891
+ }
42892
+ const callConfigurationsApiSlice = react.createApi({
42893
+ reducerPath: CALL_CONFIGURATIONS_REDUCER_PATH,
42894
+ baseQuery: iblFetchBaseQuery,
42895
+ tagTypes: [CALL_CONFIGURATIONS_TAGS.LIST, CALL_CONFIGURATIONS_TAGS.DETAIL],
42896
+ endpoints: (builder) => ({
42897
+ getCallConfigurations: builder.query({
42898
+ query: ({ org, userId, mentor, mode, search }) => ({
42899
+ url: CALL_CONFIGURATIONS_ENDPOINTS.LIST.path(org, userId),
42900
+ service: CALL_CONFIGURATIONS_ENDPOINTS.LIST.service,
42901
+ params: {
42902
+ ...(mentor ? { mentor } : {}),
42903
+ ...(mode ? { mode } : {}),
42904
+ ...(search ? { search } : {}),
42905
+ },
42906
+ }),
42907
+ providesTags: (result, _error, arg) => {
42908
+ var _a, _b;
42909
+ return result
42910
+ ? [
42911
+ { type: CALL_CONFIGURATIONS_TAGS.LIST, id: (_a = arg.mentor) !== null && _a !== void 0 ? _a : 'ALL' },
42912
+ ...result.map((c) => ({ type: CALL_CONFIGURATIONS_TAGS.DETAIL, id: c.id })),
42913
+ ]
42914
+ : [{ type: CALL_CONFIGURATIONS_TAGS.LIST, id: (_b = arg.mentor) !== null && _b !== void 0 ? _b : 'ALL' }];
42915
+ },
42916
+ }),
42917
+ getCallConfiguration: builder.query({
42918
+ query: ({ org, userId, id }) => ({
42919
+ url: CALL_CONFIGURATIONS_ENDPOINTS.DETAIL.path(org, userId, id),
42920
+ service: CALL_CONFIGURATIONS_ENDPOINTS.DETAIL.service,
42921
+ }),
42922
+ providesTags: (_result, _error, arg) => [
42923
+ { type: CALL_CONFIGURATIONS_TAGS.DETAIL, id: arg.id },
42924
+ ],
42925
+ }),
42926
+ createCallConfiguration: builder.mutation({
42927
+ query: ({ org, userId, requestBody }) => ({
42928
+ url: CALL_CONFIGURATIONS_ENDPOINTS.LIST.path(org, userId),
42929
+ service: CALL_CONFIGURATIONS_ENDPOINTS.LIST.service,
42930
+ method: 'POST',
42931
+ body: requestBody,
42932
+ }),
42933
+ invalidatesTags: (_result, _error, arg) => {
42934
+ var _a;
42935
+ return [
42936
+ { type: CALL_CONFIGURATIONS_TAGS.LIST, id: (_a = arg.requestBody.mentor) !== null && _a !== void 0 ? _a : 'ALL' },
42937
+ { type: CALL_CONFIGURATIONS_TAGS.LIST, id: 'ALL' },
42938
+ ];
42939
+ },
42940
+ async onQueryStarted(arg, api) {
42941
+ var _a;
42942
+ await invalidateMentorSettingsAfterCallConfigChange({ mentorId: (_a = arg.requestBody) === null || _a === void 0 ? void 0 : _a.mentor }, api);
42943
+ },
42944
+ }),
42945
+ updateCallConfiguration: builder.mutation({
42946
+ query: ({ org, userId, id, requestBody }) => ({
42947
+ url: CALL_CONFIGURATIONS_ENDPOINTS.DETAIL.path(org, userId, id),
42948
+ service: CALL_CONFIGURATIONS_ENDPOINTS.DETAIL.service,
42949
+ method: 'PATCH',
42950
+ body: requestBody,
42951
+ }),
42952
+ invalidatesTags: (_result, _error, arg) => [
42953
+ { type: CALL_CONFIGURATIONS_TAGS.DETAIL, id: arg.id },
42954
+ { type: CALL_CONFIGURATIONS_TAGS.LIST, id: 'ALL' },
42955
+ ],
42956
+ async onQueryStarted(arg, api) {
42957
+ var _a, _b;
42958
+ // The PATCH response carries the mentor on `result.data.mentor`.
42959
+ // Fall back to `arg.requestBody.mentor` if the partial-update
42960
+ // doesn't echo `mentor` back, and finally to undefined (no-op).
42961
+ let mentorId = (_a = arg.requestBody) === null || _a === void 0 ? void 0 : _a.mentor;
42962
+ try {
42963
+ const { data } = await api.queryFulfilled;
42964
+ mentorId = (_b = data === null || data === void 0 ? void 0 : data.mentor) !== null && _b !== void 0 ? _b : mentorId;
42965
+ }
42966
+ catch (_c) {
42967
+ return;
42968
+ }
42969
+ if (mentorId) {
42970
+ api.dispatch(mentorApiSlice.util.invalidateTags([
42971
+ { type: 'mentorSettings', id: mentorId },
42972
+ { type: 'mentor', id: mentorId },
42973
+ ]));
42974
+ }
42975
+ },
42976
+ }),
42977
+ }),
42978
+ });
42979
+ const callConfigurationsApiReducer = callConfigurationsApiSlice.reducer;
42980
+ const { useGetCallConfigurationsQuery, useLazyGetCallConfigurationsQuery, useGetCallConfigurationQuery, useLazyGetCallConfigurationQuery, useCreateCallConfigurationMutation, useUpdateCallConfigurationMutation, } = callConfigurationsApiSlice;
42981
+
42849
42982
  const moderationLogsApiSlice = react.createApi({
42850
42983
  reducerPath: 'moderationLogsApiSlice',
42851
42984
  baseQuery: react.fakeBaseQuery(),
@@ -45146,6 +45279,7 @@ const mentorReducer = {
45146
45279
  [notificationsApiSlice.reducerPath]: notificationsApiSlice.reducer,
45147
45280
  [notificationsCustomApiSlice.reducerPath]: notificationsCustomApiSlice.reducer,
45148
45281
  [mentorCustomApiSlice.reducerPath]: mentorCustomApiSlice.reducer,
45282
+ [callConfigurationsApiSlice.reducerPath]: callConfigurationsApiSlice.reducer,
45149
45283
  [moderationLogsApiSlice.reducerPath]: moderationLogsApiSlice.reducer,
45150
45284
  [catalogApiSlice.reducerPath]: catalogApiSlice.reducer,
45151
45285
  [searchApiSlice.reducerPath]: searchApiSlice.reducer,
@@ -45200,6 +45334,7 @@ const mentorMiddleware = [
45200
45334
  notificationsApiSlice.middleware,
45201
45335
  notificationsCustomApiSlice.middleware,
45202
45336
  mentorCustomApiSlice.middleware,
45337
+ callConfigurationsApiSlice.middleware,
45203
45338
  moderationLogsApiSlice.middleware,
45204
45339
  catalogApiSlice.middleware,
45205
45340
  searchApiSlice.middleware,
@@ -45247,6 +45382,7 @@ const skillsReducer = {
45247
45382
  [notificationsApiSlice.reducerPath]: notificationsApiSlice.reducer,
45248
45383
  [notificationsCustomApiSlice.reducerPath]: notificationsCustomApiSlice.reducer,
45249
45384
  [mentorCustomApiSlice.reducerPath]: mentorCustomApiSlice.reducer,
45385
+ [callConfigurationsApiSlice.reducerPath]: callConfigurationsApiSlice.reducer,
45250
45386
  [platformCustomApiSlice.reducerPath]: platformCustomApiSlice.reducer,
45251
45387
  [coreCustomApiSlice.reducerPath]: coreCustomApiSlice.reducer,
45252
45388
  [edxProctoringApiSlice.reducerPath]: edxProctoringApiSlice.reducer,
@@ -45287,6 +45423,7 @@ const skillsMiddleware = [
45287
45423
  notificationsApiSlice.middleware,
45288
45424
  notificationsCustomApiSlice.middleware,
45289
45425
  mentorCustomApiSlice.middleware,
45426
+ callConfigurationsApiSlice.middleware,
45290
45427
  platformCustomApiSlice.middleware,
45291
45428
  coreCustomApiSlice.middleware,
45292
45429
  edxProctoringApiSlice.middleware,
@@ -45321,6 +45458,9 @@ exports.APP_IDENTIFIERS = APP_IDENTIFIERS;
45321
45458
  exports.AUDIT_LOGS_ENDPOINTS = AUDIT_LOGS_ENDPOINTS;
45322
45459
  exports.AUDIT_LOGS_QUERY_KEYS = AUDIT_LOGS_QUERY_KEYS;
45323
45460
  exports.AUDIT_LOGS_REDUCER_PATH = AUDIT_LOGS_REDUCER_PATH;
45461
+ exports.CALL_CONFIGURATIONS_ENDPOINTS = CALL_CONFIGURATIONS_ENDPOINTS;
45462
+ exports.CALL_CONFIGURATIONS_REDUCER_PATH = CALL_CONFIGURATIONS_REDUCER_PATH;
45463
+ exports.CALL_CONFIGURATIONS_TAGS = CALL_CONFIGURATIONS_TAGS;
45324
45464
  exports.CLAW_ENDPOINTS = CLAW_ENDPOINTS;
45325
45465
  exports.CLAW_REDUCER_PATH = CLAW_REDUCER_PATH;
45326
45466
  exports.CLAW_TAG_TYPES = CLAW_TAG_TYPES;
@@ -45397,6 +45537,8 @@ exports.auditLogsApiSlice = auditLogsApiSlice;
45397
45537
  exports.authApiSlice = authApiSlice;
45398
45538
  exports.billingApiSlice = billingApiSlice;
45399
45539
  exports.billingCustomSlice = billingCustomSlice;
45540
+ exports.callConfigurationsApiReducer = callConfigurationsApiReducer;
45541
+ exports.callConfigurationsApiSlice = callConfigurationsApiSlice;
45400
45542
  exports.careerApiSlice = careerApiSlice;
45401
45543
  exports.catalogApiSlice = catalogApiSlice;
45402
45544
  exports.chatApiSlice = chatApiSlice;
@@ -45473,6 +45615,7 @@ exports.useCreateAdminProjectMutation = useCreateAdminProjectMutation;
45473
45615
  exports.useCreateAgentSkillMutation = useCreateAgentSkillMutation;
45474
45616
  exports.useCreateAgentSkillResourceMutation = useCreateAgentSkillResourceMutation;
45475
45617
  exports.useCreateApiKeyMutation = useCreateApiKeyMutation;
45618
+ exports.useCreateCallConfigurationMutation = useCreateCallConfigurationMutation;
45476
45619
  exports.useCreateCallCredentialsMutation = useCreateCallCredentialsMutation;
45477
45620
  exports.useCreateCatalogInvitationBulkMutation = useCreateCatalogInvitationBulkMutation;
45478
45621
  exports.useCreateCatalogInvitationCourseBulkMutation = useCreateCatalogInvitationCourseBulkMutation;
@@ -45602,6 +45745,8 @@ exports.useGetAssignedProgramsQuery = useGetAssignedProgramsQuery;
45602
45745
  exports.useGetAuditLogsQuery = useGetAuditLogsQuery;
45603
45746
  exports.useGetAverageMessagesPerSessionQuery = useGetAverageMessagesPerSessionQuery;
45604
45747
  exports.useGetAverageRatingQuery = useGetAverageRatingQuery;
45748
+ exports.useGetCallConfigurationQuery = useGetCallConfigurationQuery;
45749
+ exports.useGetCallConfigurationsQuery = useGetCallConfigurationsQuery;
45605
45750
  exports.useGetCatalogInvitationsCourseQuery = useGetCatalogInvitationsCourseQuery;
45606
45751
  exports.useGetCatalogInvitationsProgramQuery = useGetCatalogInvitationsProgramQuery;
45607
45752
  exports.useGetCatalogSearchQuery = useGetCatalogSearchQuery;
@@ -45783,6 +45928,8 @@ exports.useGetUserTenantsQuery = useGetUserTenantsQuery;
45783
45928
  exports.useGetUsersAsAssertionsQuery = useGetUsersAsAssertionsQuery;
45784
45929
  exports.useGetUsersStatsQuery = useGetUsersStatsQuery;
45785
45930
  exports.useGetVectorDocumentsQuery = useGetVectorDocumentsQuery;
45931
+ exports.useGetVoiceQuery = useGetVoiceQuery;
45932
+ exports.useGetVoicesQuery = useGetVoicesQuery;
45786
45933
  exports.useGetWatchedGroupQuery = useGetWatchedGroupQuery;
45787
45934
  exports.useGetWatchedGroupsQuery = useGetWatchedGroupsQuery;
45788
45935
  exports.useGetWatchedUsersQuery = useGetWatchedUsersQuery;
@@ -45807,6 +45954,8 @@ exports.useLazyGetArtifactQuery = useLazyGetArtifactQuery;
45807
45954
  exports.useLazyGetArtifactVersionQuery = useLazyGetArtifactVersionQuery;
45808
45955
  exports.useLazyGetAssignedProgramsQuery = useLazyGetAssignedProgramsQuery;
45809
45956
  exports.useLazyGetAuditLogsQuery = useLazyGetAuditLogsQuery;
45957
+ exports.useLazyGetCallConfigurationQuery = useLazyGetCallConfigurationQuery;
45958
+ exports.useLazyGetCallConfigurationsQuery = useLazyGetCallConfigurationsQuery;
45810
45959
  exports.useLazyGetCatalogInvitationsCourseQuery = useLazyGetCatalogInvitationsCourseQuery;
45811
45960
  exports.useLazyGetCatalogInvitationsProgramQuery = useLazyGetCatalogInvitationsProgramQuery;
45812
45961
  exports.useLazyGetCatalogSearchQuery = useLazyGetCatalogSearchQuery;
@@ -45947,6 +46096,8 @@ exports.useLazyGetUserSkillsPointsQuery = useLazyGetUserSkillsPointsQuery;
45947
46096
  exports.useLazyGetUserTenantsQuery = useLazyGetUserTenantsQuery;
45948
46097
  exports.useLazyGetUsersAsAssertionsQuery = useLazyGetUsersAsAssertionsQuery;
45949
46098
  exports.useLazyGetVectorDocumentsQuery = useLazyGetVectorDocumentsQuery;
46099
+ exports.useLazyGetVoiceQuery = useLazyGetVoiceQuery;
46100
+ exports.useLazyGetVoicesQuery = useLazyGetVoicesQuery;
45950
46101
  exports.useLazyGetWatchedGroupQuery = useLazyGetWatchedGroupQuery;
45951
46102
  exports.useLazyGetWatchedGroupsQuery = useLazyGetWatchedGroupsQuery;
45952
46103
  exports.useLazyGetWatchedUsersQuery = useLazyGetWatchedUsersQuery;
@@ -46012,6 +46163,7 @@ exports.useUpdateAgentSkillMutation = useUpdateAgentSkillMutation;
46012
46163
  exports.useUpdateAgentSkillResourceMutation = useUpdateAgentSkillResourceMutation;
46013
46164
  exports.useUpdateArtifactMutation = useUpdateArtifactMutation;
46014
46165
  exports.useUpdateAutoRechargeInfoMutation = useUpdateAutoRechargeInfoMutation;
46166
+ exports.useUpdateCallConfigurationMutation = useUpdateCallConfigurationMutation;
46015
46167
  exports.useUpdateChatSessionMutation = useUpdateChatSessionMutation;
46016
46168
  exports.useUpdateChatSessionSharedMutation = useUpdateChatSessionSharedMutation;
46017
46169
  exports.useUpdateClawInstanceMutation = useUpdateClawInstanceMutation;