@axiom-lattice/react-sdk 2.1.52 → 2.1.54

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
@@ -23,6 +23,10 @@ var useAuth = () => {
23
23
  }
24
24
  return context;
25
25
  };
26
+ var useAuthOptional = () => {
27
+ const context = useContext(AuthContext);
28
+ return context;
29
+ };
26
30
  var AuthProvider = ({
27
31
  children,
28
32
  baseURL,
@@ -18888,6 +18892,7 @@ var Chating = ({
18888
18892
  showSender = true,
18889
18893
  showHITL = true,
18890
18894
  showRefreshButton = false,
18895
+ showEmptyState = true,
18891
18896
  emptyStateGreeting,
18892
18897
  emptyStateQuestion = "Ready to turn data into insightful charts in seconds?",
18893
18898
  welcomePrefix = "Hey"
@@ -18926,9 +18931,13 @@ var Chating = ({
18926
18931
  return () => clearInterval(interval);
18927
18932
  }, [isStreaming]);
18928
18933
  const conversationContext = useConversationContext();
18929
- const [isEmptyState, setIsEmptyState] = useState52(messages.length === 0 && !pendingMessages?.length);
18934
+ const [isEmptyState, setIsEmptyState] = useState52(showEmptyState && messages.length === 0 && !pendingMessages?.length);
18930
18935
  const [isTransitioning, setIsTransitioning] = useState52(false);
18931
18936
  useEffect34(() => {
18937
+ if (!showEmptyState) {
18938
+ setIsEmptyState(false);
18939
+ return;
18940
+ }
18932
18941
  const isEmpty = messages.length === 0 && !pendingMessages?.length;
18933
18942
  if (!isEmpty && isEmptyState) {
18934
18943
  setIsTransitioning(true);
@@ -18939,10 +18948,10 @@ var Chating = ({
18939
18948
  } else if (isEmpty && !isEmptyState) {
18940
18949
  setIsEmptyState(true);
18941
18950
  }
18942
- }, [messages.length, pendingMessages?.length, isEmptyState]);
18951
+ }, [messages.length, pendingMessages?.length, isEmptyState, showEmptyState]);
18943
18952
  const { config } = useLatticeChatShellContext();
18944
18953
  const { baseURL } = config;
18945
- const { user } = useAuth();
18954
+ const user = useAuthOptional()?.user;
18946
18955
  const displayUserName = user?.name || user?.email?.split("@")[0] || "there";
18947
18956
  const workspaceContext = useContext10(WorkspaceContext);
18948
18957
  const listPath = workspaceContext?.listPath ?? (async () => []);
@@ -19150,10 +19159,10 @@ var Chating = ({
19150
19159
  )
19151
19160
  }
19152
19161
  );
19153
- const showDatabaseSlot = config.enableDatabaseSlot !== false;
19154
- const showSkillSlot = config.enableSkillSlot !== false;
19155
- const showAgentSlot = config.enableAgentSlot !== false;
19156
- const showMetricsDataSourceSlot = config.enableMetricsDataSourceSlot !== false;
19162
+ const showDatabaseSlot = config.enableDatabaseSlot;
19163
+ const showSkillSlot = config.enableSkillSlot;
19164
+ const showAgentSlot = config.enableAgentSlot;
19165
+ const showMetricsDataSourceSlot = config.enableMetricsDataSourceSlot;
19157
19166
  const senderFooter = (actionNode) => {
19158
19167
  const hasSlotButtons = showAgentSlot || showDatabaseSlot || showSkillSlot || showMetricsDataSourceSlot;
19159
19168
  return /* @__PURE__ */ jsxs52(Flex5, { justify: "space-between", align: "center", style: { padding: "8px 0" }, children: [
@@ -28622,6 +28631,7 @@ export {
28622
28631
  useApi,
28623
28632
  useAssistantContext,
28624
28633
  useAuth,
28634
+ useAuthOptional,
28625
28635
  useAxiomLattice,
28626
28636
  useAxiomTheme,
28627
28637
  useChat,