@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.js CHANGED
@@ -1331,7 +1331,7 @@ const useSubscriptionHandlerV2 = (subscriptionFlow) => {
1331
1331
  const [getUserApps] = dataLayer.useLazyGetUserAppsQuery();
1332
1332
  const CREDIT_INTERVAL_CHECK_COUNTER = 60 * 60 * 1000; // 1 hour
1333
1333
  const { getSupportEmail } = useTenantMetadata({
1334
- org: subscriptionFlow.getCurrentTenantOrg(),
1334
+ org: subscriptionFlow.getCurrentTenantKey(),
1335
1335
  });
1336
1336
  /**
1337
1337
  * Checks if user is currently on the main tenant
@@ -3451,13 +3451,6 @@ function TenantProvider({ children, fallback, onAuthSuccess, onAuthFailure, curr
3451
3451
  // user is not authenticated so we don't need to do anything that concerns an authenticated user
3452
3452
  return;
3453
3453
  }
3454
- // Logged-in user on a public route (e.g. shareable link) visiting another tenant
3455
- // — treat as visitor, skip tenant join/token/RBAC calls that will 403
3456
- if (userIsAccessingPublicRoute) {
3457
- saveVisitingTenant === null || saveVisitingTenant === void 0 ? void 0 : saveVisitingTenant(newCurrentTenant);
3458
- setIsLoading(false);
3459
- return;
3460
- }
3461
3454
  const { data: tenants } = await fetchUserTenants();
3462
3455
  const enhancedTenants = await enhanceTenants(tenants, data);
3463
3456
  saveUserTenants(enhancedTenants);
@@ -7100,7 +7093,6 @@ const useChat = ({ wsUrl, wsToken, flowConfig, sessionId, stopGenerationWsUrl, e
7100
7093
  MAX_INITIAL_WEBSOCKET_CONNECTION_ATTEMPTS;
7101
7094
  if (shouldShowError) {
7102
7095
  console.error("[ws-error] WebSocket connection error exceeded max attempts", {
7103
- error,
7104
7096
  wsUrl,
7105
7097
  tenant: flowConfig === null || flowConfig === void 0 ? void 0 : flowConfig.tenant,
7106
7098
  mentorId: flowConfig === null || flowConfig === void 0 ? void 0 : flowConfig.name,
@@ -7803,7 +7795,6 @@ const useChat = ({ wsUrl, wsToken, flowConfig, sessionId, stopGenerationWsUrl, e
7803
7795
  return;
7804
7796
  }
7805
7797
  console.error("[ws-error] WebSocket error on active connection", {
7806
- error,
7807
7798
  wsUrl,
7808
7799
  tenant: flowConfig === null || flowConfig === void 0 ? void 0 : flowConfig.tenant,
7809
7800
  mentorId: flowConfig === null || flowConfig === void 0 ? void 0 : flowConfig.name,
@@ -7818,7 +7809,7 @@ const useChat = ({ wsUrl, wsToken, flowConfig, sessionId, stopGenerationWsUrl, e
7818
7809
  onStreamingChange === null || onStreamingChange === void 0 ? void 0 : onStreamingChange(false);
7819
7810
  onStatusChange("error");
7820
7811
  });
7821
- socket.addEventListener("close", () => {
7812
+ socket.addEventListener("close", (event) => {
7822
7813
  isConnected.current = false;
7823
7814
  onStreamingChange === null || onStreamingChange === void 0 ? void 0 : onStreamingChange(false);
7824
7815
  // Don't retry or show error if we're offline in Tauri - this is expected
@@ -7832,7 +7823,11 @@ const useChat = ({ wsUrl, wsToken, flowConfig, sessionId, stopGenerationWsUrl, e
7832
7823
  // If this is an initial connection failure and we haven't exceeded max attempts
7833
7824
  if (isInitialConnection.current &&
7834
7825
  connectionAttempts.current < MAX_INITIAL_WEBSOCKET_CONNECTION_ATTEMPTS) {
7835
- console.log(`Initial connection closed, attempting retry ${connectionAttempts.current + 1}/${MAX_INITIAL_WEBSOCKET_CONNECTION_ATTEMPTS}`);
7826
+ console.log(`Initial connection closed, attempting retry ${connectionAttempts.current + 1}/${MAX_INITIAL_WEBSOCKET_CONNECTION_ATTEMPTS}`, {
7827
+ code: event === null || event === void 0 ? void 0 : event.code,
7828
+ reason: event === null || event === void 0 ? void 0 : event.reason,
7829
+ wasClean: event === null || event === void 0 ? void 0 : event.wasClean,
7830
+ });
7836
7831
  // Retry with exponential backoff
7837
7832
  const backoffDelay = Math.min(1000 * Math.pow(2, connectionAttempts.current), 5000);
7838
7833
  setTimeout(() => {
@@ -7848,6 +7843,9 @@ const useChat = ({ wsUrl, wsToken, flowConfig, sessionId, stopGenerationWsUrl, e
7848
7843
  connectionAttempts.current >=
7849
7844
  MAX_INITIAL_WEBSOCKET_CONNECTION_ATTEMPTS) {
7850
7845
  console.error("[ws-close] Failed to connect to the mentor after multiple attempts", {
7846
+ code: event === null || event === void 0 ? void 0 : event.code,
7847
+ reason: event === null || event === void 0 ? void 0 : event.reason,
7848
+ wasClean: event === null || event === void 0 ? void 0 : event.wasClean,
7851
7849
  wsUrl,
7852
7850
  tenant: flowConfig === null || flowConfig === void 0 ? void 0 : flowConfig.tenant,
7853
7851
  mentorId: flowConfig === null || flowConfig === void 0 ? void 0 : flowConfig.name,