@iblai/web-utils 1.1.11 → 1.1.13

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
@@ -7090,21 +7090,30 @@ const useChat = ({ wsUrl, wsToken, flowConfig, sessionId, stopGenerationWsUrl, e
7090
7090
  connectionAttempts.current >
7091
7091
  MAX_INITIAL_WEBSOCKET_CONNECTION_ATTEMPTS;
7092
7092
  if (shouldShowError) {
7093
- console.error(JSON.stringify({
7093
+ console.error("[ws-error] WebSocket connection error exceeded max attempts", {
7094
+ error,
7095
+ wsUrl,
7094
7096
  tenant: flowConfig === null || flowConfig === void 0 ? void 0 : flowConfig.tenant,
7095
7097
  mentorId: flowConfig === null || flowConfig === void 0 ? void 0 : flowConfig.name,
7096
7098
  username: flowConfig === null || flowConfig === void 0 ? void 0 : flowConfig.username,
7099
+ sessionId: sessionIdRef.current,
7100
+ isInitialConnection: isInitialConnection.current,
7097
7101
  connectionAttempts: connectionAttempts.current,
7098
7102
  maxAttempts: MAX_INITIAL_WEBSOCKET_CONNECTION_ATTEMPTS,
7099
- shouldShowError,
7100
- error,
7101
- }));
7102
- errorHandler === null || errorHandler === void 0 ? void 0 : errorHandler("Failed to connect to the mentor", error);
7103
+ readyState: socket.readyState,
7104
+ timestamp: new Date().toISOString(),
7105
+ });
7103
7106
  onStatusChange("error");
7104
7107
  reject(error);
7105
7108
  }
7106
7109
  else {
7107
- console.warn("Initial connection attempt failed, will retry...");
7110
+ console.warn(`[ws-error] Initial connection attempt ${connectionAttempts.current}/${MAX_INITIAL_WEBSOCKET_CONNECTION_ATTEMPTS} failed, will retry...`, {
7111
+ wsUrl,
7112
+ tenant: flowConfig === null || flowConfig === void 0 ? void 0 : flowConfig.tenant,
7113
+ mentorId: flowConfig === null || flowConfig === void 0 ? void 0 : flowConfig.name,
7114
+ readyState: socket.readyState,
7115
+ timestamp: new Date().toISOString(),
7116
+ });
7108
7117
  }
7109
7118
  onStreamingChange === null || onStreamingChange === void 0 ? void 0 : onStreamingChange(false);
7110
7119
  });
@@ -7784,7 +7793,19 @@ const useChat = ({ wsUrl, wsToken, flowConfig, sessionId, stopGenerationWsUrl, e
7784
7793
  onStreamingChange === null || onStreamingChange === void 0 ? void 0 : onStreamingChange(false);
7785
7794
  return;
7786
7795
  }
7787
- errorHandler === null || errorHandler === void 0 ? void 0 : errorHandler("WebSocket error", error);
7796
+ console.error("[ws-error] WebSocket error on active connection", {
7797
+ error,
7798
+ wsUrl,
7799
+ tenant: flowConfig === null || flowConfig === void 0 ? void 0 : flowConfig.tenant,
7800
+ mentorId: flowConfig === null || flowConfig === void 0 ? void 0 : flowConfig.name,
7801
+ username: flowConfig === null || flowConfig === void 0 ? void 0 : flowConfig.username,
7802
+ sessionId: sessionIdRef.current,
7803
+ isInitialConnection: isInitialConnection.current,
7804
+ connectionAttempts: connectionAttempts.current,
7805
+ readyState: socket.readyState,
7806
+ isConnected: isConnected.current,
7807
+ timestamp: new Date().toISOString(),
7808
+ });
7788
7809
  onStreamingChange === null || onStreamingChange === void 0 ? void 0 : onStreamingChange(false);
7789
7810
  onStatusChange("error");
7790
7811
  });
@@ -7817,7 +7838,16 @@ const useChat = ({ wsUrl, wsToken, flowConfig, sessionId, stopGenerationWsUrl, e
7817
7838
  if (isInitialConnection.current &&
7818
7839
  connectionAttempts.current >=
7819
7840
  MAX_INITIAL_WEBSOCKET_CONNECTION_ATTEMPTS) {
7820
- errorHandler === null || errorHandler === void 0 ? void 0 : errorHandler("Failed to connect to the mentor after multiple attempts");
7841
+ console.error("[ws-close] Failed to connect to the mentor after multiple attempts", {
7842
+ wsUrl,
7843
+ tenant: flowConfig === null || flowConfig === void 0 ? void 0 : flowConfig.tenant,
7844
+ mentorId: flowConfig === null || flowConfig === void 0 ? void 0 : flowConfig.name,
7845
+ username: flowConfig === null || flowConfig === void 0 ? void 0 : flowConfig.username,
7846
+ sessionId: sessionIdRef.current,
7847
+ connectionAttempts: connectionAttempts.current,
7848
+ maxAttempts: MAX_INITIAL_WEBSOCKET_CONNECTION_ATTEMPTS,
7849
+ timestamp: new Date().toISOString(),
7850
+ });
7821
7851
  onStatusChange("error");
7822
7852
  isInitialConnection.current = false;
7823
7853
  }
@@ -13989,7 +14019,7 @@ const mentorApiSlice = createApi({
13989
14019
  dispatch(mentorApiSlice.util.updateQueryData('getShareableLink', {
13990
14020
  mentor: updateData.mentor,
13991
14021
  org: updateData.org,
13992
- // @ts-ignore
14022
+ // @ts-expect-error userId may not be in the type
13993
14023
  userId: updateData.userId,
13994
14024
  }, (draft) => {
13995
14025
  var _a;
@@ -17121,6 +17151,28 @@ createApi({
17121
17151
  }),
17122
17152
  });
17123
17153
 
17154
+ const RETIREMENT_ENDPOINTS = {
17155
+ SELF_RETIRE: {
17156
+ service: SERVICES.LMS,
17157
+ path: () => `/api/ibl/retirements/self_retire/`,
17158
+ },
17159
+ };
17160
+
17161
+ createApi({
17162
+ reducerPath: 'retirementApiSlice',
17163
+ baseQuery: iblFetchBaseQuery,
17164
+ endpoints: (builder) => ({
17165
+ selfRetire: builder.mutation({
17166
+ query: () => ({
17167
+ url: RETIREMENT_ENDPOINTS.SELF_RETIRE.path(),
17168
+ service: RETIREMENT_ENDPOINTS.SELF_RETIRE.service,
17169
+ method: 'POST',
17170
+ isJson: true,
17171
+ }),
17172
+ }),
17173
+ }),
17174
+ });
17175
+
17124
17176
  const DISCLAIMERS_REDUCER_PATH = 'disclaimersApiSlice';
17125
17177
  const DISCLAIMERS_ENDPOINTS = {
17126
17178
  GET_DISCLAIMERS: {