@axiom-lattice/react-sdk 2.1.69 → 2.1.71

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
@@ -18925,7 +18925,7 @@ var useWorkspaceContext = () => {
18925
18925
  var WorkspaceContextProvider = ({
18926
18926
  children
18927
18927
  }) => {
18928
- const { currentTenant } = useAuth();
18928
+ const { currentTenant, isAuthenticated } = useAuth();
18929
18929
  const tenantId = currentTenant?.id || "";
18930
18930
  const { config } = useLatticeChatShellContext();
18931
18931
  const axiomClient = useClient("__GLOBAL__");
@@ -18958,13 +18958,14 @@ var WorkspaceContextProvider = ({
18958
18958
  const [loading, setLoading] = (0, import_react61.useState)(false);
18959
18959
  const [error, setError] = (0, import_react61.useState)(null);
18960
18960
  const client = import_react61.default.useMemo(() => {
18961
+ const authApiKey = isAuthenticated ? sessionStorage.getItem("lattice_token") || config.apiKey || "" : config.apiKey || "";
18961
18962
  return new import_client_sdk6.WorkspaceClient({
18962
18963
  baseURL: config.baseURL,
18963
- apiKey: config.apiKey || "",
18964
+ apiKey: authApiKey,
18964
18965
  assistantId: "",
18965
18966
  transport: "sse"
18966
18967
  }, tenantId);
18967
- }, [config.baseURL, config.apiKey, tenantId]);
18968
+ }, [config.baseURL, config.apiKey, tenantId, isAuthenticated]);
18968
18969
  const resetSelectedWorkspace = (0, import_react61.useCallback)(() => {
18969
18970
  setProjects([]);
18970
18971
  setWorkspaceId(null);