@iblai/data-layer 1.25.1 → 1.27.0
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.d.ts +84 -130
- package/dist/index.esm.js +29 -6
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +29 -5
- package/dist/index.js.map +1 -1
- package/dist/package.json +1 -1
- package/dist/src/features/chat/api-slice.d.ts +72 -127
- package/dist/src/features/core/types.d.ts +10 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -39918,6 +39918,12 @@ const CHAT_CUSTOM_ENDPOINTS = {
|
|
|
39918
39918
|
const getNextRecentMessagesPageParam = (lastPage, lastPageParam) => lastPage && !Array.isArray(lastPage) && lastPage.next
|
|
39919
39919
|
? lastPageParam + RECENT_MESSAGES_PAGE_SIZE
|
|
39920
39920
|
: undefined;
|
|
39921
|
+
const appendChatFilterParams = (params, { mentor, search }) => {
|
|
39922
|
+
if (mentor)
|
|
39923
|
+
params.append('mentor', mentor);
|
|
39924
|
+
if (search && search.trim() !== '')
|
|
39925
|
+
params.append('search', search.trim());
|
|
39926
|
+
};
|
|
39921
39927
|
/**
|
|
39922
39928
|
* Build the recent-messages URL for a given row offset. The endpoint uses DRF
|
|
39923
39929
|
* LimitOffsetPagination (`limit`/`offset`), not page numbers.
|
|
@@ -39926,19 +39932,36 @@ const buildRecentMessagesUrl = (args, pageParam) => {
|
|
|
39926
39932
|
const params = new URLSearchParams();
|
|
39927
39933
|
params.append(RECENT_MESSAGES_LIMIT_PARAM, String(RECENT_MESSAGES_PAGE_SIZE));
|
|
39928
39934
|
params.append(RECENT_MESSAGES_OFFSET_PARAM, String(pageParam));
|
|
39929
|
-
|
|
39930
|
-
params.append('mentor', args.mentor);
|
|
39931
|
-
if (args.search && args.search.trim() !== '')
|
|
39932
|
-
params.append('search', args.search.trim());
|
|
39935
|
+
appendChatFilterParams(params, args);
|
|
39933
39936
|
return `/api/ai-mentor/orgs/${args.org}/users/${args.userId}/recent-messages/?${params.toString()}`;
|
|
39934
39937
|
};
|
|
39938
|
+
/**
|
|
39939
|
+
* Build the user-wide pin-message list URL. Never carries `session_id` (the
|
|
39940
|
+
* endpoint does not accept it); `mentor`/`search` are appended only when non-empty.
|
|
39941
|
+
*/
|
|
39942
|
+
const buildPinnedMessagesUrl = (args) => {
|
|
39943
|
+
const params = new URLSearchParams();
|
|
39944
|
+
appendChatFilterParams(params, args);
|
|
39945
|
+
const query = params.toString();
|
|
39946
|
+
return `/api/ai-mentor/orgs/${args.org}/users/${args.userId}/pin-message/${query ? `?${query}` : ''}`;
|
|
39947
|
+
};
|
|
39935
39948
|
const chatApiSlice = react.createApi({
|
|
39936
39949
|
reducerPath: 'chatApiSlice',
|
|
39937
39950
|
baseQuery: iblFakeBaseQuery,
|
|
39938
39951
|
tagTypes: ['pinnedMessages', 'recentMessages', 'messageFeedback'],
|
|
39939
39952
|
endpoints: (builder) => ({
|
|
39940
39953
|
getPinnedMessages: builder.query({
|
|
39941
|
-
|
|
39954
|
+
// The generated `aiMentorOrgsUsersPinMessageList` sends a `session_id`
|
|
39955
|
+
// query param the endpoint does not accept; the list is user-wide, so a
|
|
39956
|
+
// session in the cache key would refetch it on every chat switch.
|
|
39957
|
+
queryFn: async (args, api, extraOptions) => {
|
|
39958
|
+
const url = buildPinnedMessagesUrl(args);
|
|
39959
|
+
return iblFetchBaseQuery({
|
|
39960
|
+
url,
|
|
39961
|
+
method: 'GET',
|
|
39962
|
+
service: exports.SERVICES.DM,
|
|
39963
|
+
}, api, extraOptions);
|
|
39964
|
+
},
|
|
39942
39965
|
providesTags: ['pinnedMessages'],
|
|
39943
39966
|
}),
|
|
39944
39967
|
unPinMessage: builder.mutation({
|
|
@@ -49861,6 +49884,7 @@ exports.billingApiSlice = billingApiSlice;
|
|
|
49861
49884
|
exports.billingCustomSlice = billingCustomSlice;
|
|
49862
49885
|
exports.buildGlobalSearchUrl = buildGlobalSearchUrl;
|
|
49863
49886
|
exports.buildLearnerCompletionUrl = buildLearnerCompletionUrl;
|
|
49887
|
+
exports.buildPinnedMessagesUrl = buildPinnedMessagesUrl;
|
|
49864
49888
|
exports.buildRecentMessagesUrl = buildRecentMessagesUrl;
|
|
49865
49889
|
exports.buildSessionRetrieveUrl = buildSessionRetrieveUrl;
|
|
49866
49890
|
exports.buildSharedSessionRetrieveUrl = buildSharedSessionRetrieveUrl;
|