@iblai/web-utils 1.1.16 → 1.1.17

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.esm.js CHANGED
@@ -1311,7 +1311,7 @@ const useSubscriptionHandlerV2 = (subscriptionFlow) => {
1311
1311
  const [getUserApps] = useLazyGetUserAppsQuery();
1312
1312
  const CREDIT_INTERVAL_CHECK_COUNTER = 60 * 60 * 1000; // 1 hour
1313
1313
  const { getSupportEmail } = useTenantMetadata({
1314
- org: subscriptionFlow.getCurrentTenantOrg(),
1314
+ org: subscriptionFlow.getCurrentTenantKey(),
1315
1315
  });
1316
1316
  /**
1317
1317
  * Checks if user is currently on the main tenant
@@ -3431,13 +3431,6 @@ function TenantProvider({ children, fallback, onAuthSuccess, onAuthFailure, curr
3431
3431
  // user is not authenticated so we don't need to do anything that concerns an authenticated user
3432
3432
  return;
3433
3433
  }
3434
- // Logged-in user on a public route (e.g. shareable link) visiting another tenant
3435
- // — treat as visitor, skip tenant join/token/RBAC calls that will 403
3436
- if (userIsAccessingPublicRoute) {
3437
- saveVisitingTenant === null || saveVisitingTenant === void 0 ? void 0 : saveVisitingTenant(newCurrentTenant);
3438
- setIsLoading(false);
3439
- return;
3440
- }
3441
3434
  const { data: tenants } = await fetchUserTenants();
3442
3435
  const enhancedTenants = await enhanceTenants(tenants, data);
3443
3436
  saveUserTenants(enhancedTenants);
@@ -7080,7 +7073,6 @@ const useChat = ({ wsUrl, wsToken, flowConfig, sessionId, stopGenerationWsUrl, e
7080
7073
  MAX_INITIAL_WEBSOCKET_CONNECTION_ATTEMPTS;
7081
7074
  if (shouldShowError) {
7082
7075
  console.error("[ws-error] WebSocket connection error exceeded max attempts", {
7083
- error,
7084
7076
  wsUrl,
7085
7077
  tenant: flowConfig === null || flowConfig === void 0 ? void 0 : flowConfig.tenant,
7086
7078
  mentorId: flowConfig === null || flowConfig === void 0 ? void 0 : flowConfig.name,
@@ -7783,7 +7775,6 @@ const useChat = ({ wsUrl, wsToken, flowConfig, sessionId, stopGenerationWsUrl, e
7783
7775
  return;
7784
7776
  }
7785
7777
  console.error("[ws-error] WebSocket error on active connection", {
7786
- error,
7787
7778
  wsUrl,
7788
7779
  tenant: flowConfig === null || flowConfig === void 0 ? void 0 : flowConfig.tenant,
7789
7780
  mentorId: flowConfig === null || flowConfig === void 0 ? void 0 : flowConfig.name,
@@ -7798,7 +7789,7 @@ const useChat = ({ wsUrl, wsToken, flowConfig, sessionId, stopGenerationWsUrl, e
7798
7789
  onStreamingChange === null || onStreamingChange === void 0 ? void 0 : onStreamingChange(false);
7799
7790
  onStatusChange("error");
7800
7791
  });
7801
- socket.addEventListener("close", () => {
7792
+ socket.addEventListener("close", (event) => {
7802
7793
  isConnected.current = false;
7803
7794
  onStreamingChange === null || onStreamingChange === void 0 ? void 0 : onStreamingChange(false);
7804
7795
  // Don't retry or show error if we're offline in Tauri - this is expected
@@ -7812,7 +7803,11 @@ const useChat = ({ wsUrl, wsToken, flowConfig, sessionId, stopGenerationWsUrl, e
7812
7803
  // If this is an initial connection failure and we haven't exceeded max attempts
7813
7804
  if (isInitialConnection.current &&
7814
7805
  connectionAttempts.current < MAX_INITIAL_WEBSOCKET_CONNECTION_ATTEMPTS) {
7815
- console.log(`Initial connection closed, attempting retry ${connectionAttempts.current + 1}/${MAX_INITIAL_WEBSOCKET_CONNECTION_ATTEMPTS}`);
7806
+ console.log(`Initial connection closed, attempting retry ${connectionAttempts.current + 1}/${MAX_INITIAL_WEBSOCKET_CONNECTION_ATTEMPTS}`, {
7807
+ code: event === null || event === void 0 ? void 0 : event.code,
7808
+ reason: event === null || event === void 0 ? void 0 : event.reason,
7809
+ wasClean: event === null || event === void 0 ? void 0 : event.wasClean,
7810
+ });
7816
7811
  // Retry with exponential backoff
7817
7812
  const backoffDelay = Math.min(1000 * Math.pow(2, connectionAttempts.current), 5000);
7818
7813
  setTimeout(() => {
@@ -7828,6 +7823,9 @@ const useChat = ({ wsUrl, wsToken, flowConfig, sessionId, stopGenerationWsUrl, e
7828
7823
  connectionAttempts.current >=
7829
7824
  MAX_INITIAL_WEBSOCKET_CONNECTION_ATTEMPTS) {
7830
7825
  console.error("[ws-close] Failed to connect to the mentor after multiple attempts", {
7826
+ code: event === null || event === void 0 ? void 0 : event.code,
7827
+ reason: event === null || event === void 0 ? void 0 : event.reason,
7828
+ wasClean: event === null || event === void 0 ? void 0 : event.wasClean,
7831
7829
  wsUrl,
7832
7830
  tenant: flowConfig === null || flowConfig === void 0 ? void 0 : flowConfig.tenant,
7833
7831
  mentorId: flowConfig === null || flowConfig === void 0 ? void 0 : flowConfig.name,