@axiom-lattice/react-sdk 2.1.69 → 2.1.70

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.mjs CHANGED
@@ -19089,7 +19089,7 @@ var useWorkspaceContext = () => {
19089
19089
  var WorkspaceContextProvider = ({
19090
19090
  children
19091
19091
  }) => {
19092
- const { currentTenant } = useAuth();
19092
+ const { currentTenant, isAuthenticated } = useAuth();
19093
19093
  const tenantId = currentTenant?.id || "";
19094
19094
  const { config } = useLatticeChatShellContext();
19095
19095
  const axiomClient = useClient("__GLOBAL__");
@@ -19122,13 +19122,14 @@ var WorkspaceContextProvider = ({
19122
19122
  const [loading, setLoading] = useState49(false);
19123
19123
  const [error, setError] = useState49(null);
19124
19124
  const client = React38.useMemo(() => {
19125
+ const authApiKey = isAuthenticated ? sessionStorage.getItem("lattice_token") || config.apiKey || "" : config.apiKey || "";
19125
19126
  return new WorkspaceClient({
19126
19127
  baseURL: config.baseURL,
19127
- apiKey: config.apiKey || "",
19128
+ apiKey: authApiKey,
19128
19129
  assistantId: "",
19129
19130
  transport: "sse"
19130
19131
  }, tenantId);
19131
- }, [config.baseURL, config.apiKey, tenantId]);
19132
+ }, [config.baseURL, config.apiKey, tenantId, isAuthenticated]);
19132
19133
  const resetSelectedWorkspace = useCallback26(() => {
19133
19134
  setProjects([]);
19134
19135
  setWorkspaceId(null);