@iblai/data-layer 1.8.3 → 1.8.5

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
@@ -39241,6 +39241,13 @@ const buildEndpointFromDmService = (serviceFn, options) => buildEndpointFromServ
39241
39241
  * Shortcut for building an endpoint using the AXD service.
39242
39242
  */
39243
39243
  const buildEndpointFromAxdService = (serviceFn, options) => buildEndpointFromService(exports.SERVICES.AXD, serviceFn, options);
39244
+ /**
39245
+ * Build an endpoint from a hand-assembled URL (rather than a generated service
39246
+ * method), routed through `iblFetchBaseQuery`. Defaults to the DM service.
39247
+ */
39248
+ const buildEndpointFromDmUrl = (buildUrl, service = exports.SERVICES.DM) => ({
39249
+ queryFn: async (args, api, extraOptions) => iblFetchBaseQuery({ url: buildUrl(args), service }, api, extraOptions),
39250
+ });
39244
39251
  const isErrorObject = (data) => {
39245
39252
  return (typeof data === 'object' &&
39246
39253
  data !== null &&
@@ -41703,6 +41710,23 @@ const stripeApiSlice = react.createApi({
41703
41710
  });
41704
41711
  const { useGetStripeContextQuery, useLazyGetStripeContextQuery, useGetStripePricingPageSessionQuery, useLazyGetStripePricingPageSessionQuery, useCreateStripeCheckoutSessionMutation, } = stripeApiSlice;
41705
41712
 
41713
+ const CHAT_HISTORY_PAGE_SIZE = 10;
41714
+ const CHAT_HISTORY_PAGE_PARAM = 'page';
41715
+ const CHAT_HISTORY_PAGE_SIZE_PARAM = 'page_size';
41716
+
41717
+ const buildChatHistoryQuery = (page, pageSize) => {
41718
+ const params = new URLSearchParams();
41719
+ if (page !== undefined)
41720
+ params.append(CHAT_HISTORY_PAGE_PARAM, page.toString());
41721
+ if (pageSize !== undefined) {
41722
+ params.append(CHAT_HISTORY_PAGE_SIZE_PARAM, pageSize.toString());
41723
+ }
41724
+ const queryString = params.toString();
41725
+ return queryString ? `?${queryString}` : '';
41726
+ };
41727
+ const buildSessionRetrieveUrl = ({ org, sessionId, userId, page, pageSize, }) => `/api/ai-mentor/orgs/${org}/users/${userId !== null && userId !== void 0 ? userId : ''}/sessions/${sessionId}/${buildChatHistoryQuery(page, pageSize)}`;
41728
+ const buildSharedSessionRetrieveUrl = ({ org, sessionId, userId, page, pageSize, }) => `/api/ai-mentor/orgs/${org}/users/${userId}/sessions/${sessionId}/shared/${buildChatHistoryQuery(page, pageSize)}`;
41729
+
41706
41730
  const sessionApiSlice = react.createApi({
41707
41731
  reducerPath: 'sessionApiSlice',
41708
41732
  baseQuery: iblFakeBaseQuery,
@@ -41713,11 +41737,11 @@ const sessionApiSlice = react.createApi({
41713
41737
  invalidatesTags: ['sessionId'],
41714
41738
  }),
41715
41739
  getSessionId: builder.query({
41716
- ...buildEndpointFromDmService(AiMentorService.aiMentorOrgsUsersSessionsRetrieve),
41740
+ ...buildEndpointFromDmUrl(buildSessionRetrieveUrl),
41717
41741
  providesTags: ['sessionId'],
41718
41742
  }),
41719
41743
  getSharedSessionId: builder.query({
41720
- ...buildEndpointFromDmService(AiMentorService.aiMentorOrgsUsersSessionsSharedRetrieve),
41744
+ ...buildEndpointFromDmUrl(buildSharedSessionRetrieveUrl),
41721
41745
  providesTags: ['sessionId'],
41722
41746
  }),
41723
41747
  editSession: builder.mutation({
@@ -45740,6 +45764,9 @@ exports.AUDIT_LOGS_REDUCER_PATH = AUDIT_LOGS_REDUCER_PATH;
45740
45764
  exports.CALL_CONFIGURATIONS_ENDPOINTS = CALL_CONFIGURATIONS_ENDPOINTS;
45741
45765
  exports.CALL_CONFIGURATIONS_REDUCER_PATH = CALL_CONFIGURATIONS_REDUCER_PATH;
45742
45766
  exports.CALL_CONFIGURATIONS_TAGS = CALL_CONFIGURATIONS_TAGS;
45767
+ exports.CHAT_HISTORY_PAGE_PARAM = CHAT_HISTORY_PAGE_PARAM;
45768
+ exports.CHAT_HISTORY_PAGE_SIZE = CHAT_HISTORY_PAGE_SIZE;
45769
+ exports.CHAT_HISTORY_PAGE_SIZE_PARAM = CHAT_HISTORY_PAGE_SIZE_PARAM;
45743
45770
  exports.CHAT_PRIVACY_MODES = CHAT_PRIVACY_MODES;
45744
45771
  exports.CLAW_ENDPOINTS = CLAW_ENDPOINTS;
45745
45772
  exports.CLAW_REDUCER_PATH = CLAW_REDUCER_PATH;
@@ -45818,6 +45845,8 @@ exports.auditLogsApiSlice = auditLogsApiSlice;
45818
45845
  exports.authApiSlice = authApiSlice;
45819
45846
  exports.billingApiSlice = billingApiSlice;
45820
45847
  exports.billingCustomSlice = billingCustomSlice;
45848
+ exports.buildSessionRetrieveUrl = buildSessionRetrieveUrl;
45849
+ exports.buildSharedSessionRetrieveUrl = buildSharedSessionRetrieveUrl;
45821
45850
  exports.callConfigurationsApiReducer = callConfigurationsApiReducer;
45822
45851
  exports.callConfigurationsApiSlice = callConfigurationsApiSlice;
45823
45852
  exports.careerApiSlice = careerApiSlice;