@axiom-lattice/react-sdk 2.1.87 → 2.1.88

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
@@ -5260,7 +5260,7 @@ var ColumnLayout = ({
5260
5260
  closeTools
5261
5261
  } = useChatUIContext();
5262
5262
  const isMobile = useMediaQuery("(max-width: 768px)");
5263
- const isMenuCollapsed = menuCollapsed ?? (isMobile || detailVisible);
5263
+ const isMenuCollapsed = detailVisible || (menuCollapsed ?? isMobile);
5264
5264
  const isAutoCollapsed = detailVisible && !isMobile;
5265
5265
  const menuStateClass = isMenuCollapsed ? "collapsed" : "expanded";
5266
5266
  const hasSidePanelsOpen = detailVisible || toolsVisible;
@@ -30459,6 +30459,7 @@ var IFRAME_STYLE = {
30459
30459
  };
30460
30460
  var AgentChatWithThread = ({ assistantId }) => {
30461
30461
  const { thread } = useConversationContext();
30462
+ const { menuCollapsed } = useChatUIContext();
30462
30463
  if (!thread) {
30463
30464
  return /* @__PURE__ */ (0, import_jsx_runtime119.jsx)("div", { style: { display: "flex", alignItems: "center", justifyContent: "center", height: "100%" }, children: /* @__PURE__ */ (0, import_jsx_runtime119.jsx)(import_antd91.Spin, { tip: "Creating conversation..." }) });
30464
30465
  }
@@ -30468,7 +30469,7 @@ var AgentChatWithThread = ({ assistantId }) => {
30468
30469
  thread_id: thread.id,
30469
30470
  assistant_id: assistantId,
30470
30471
  showProjectSelector: false,
30471
- menu: /* @__PURE__ */ (0, import_jsx_runtime119.jsx)(AgentConversations, {})
30472
+ menu: menuCollapsed ? void 0 : /* @__PURE__ */ (0, import_jsx_runtime119.jsx)(AgentConversations, {})
30472
30473
  }
30473
30474
  );
30474
30475
  };
@@ -31055,17 +31056,14 @@ var WorkspaceResourceManager = ({
31055
31056
  const { user, logout, tenants, currentTenant, selectTenant, isLoading } = useAuth();
31056
31057
  const { setWorkspace, setProject } = useWorkspaceContext();
31057
31058
  const { config } = useLatticeChatShellContext();
31059
+ const { get } = useApi();
31058
31060
  const [tenantModalOpen, setTenantModalOpen] = (0, import_react103.useState)(false);
31059
31061
  const [changePasswordOpen, setChangePasswordOpen] = (0, import_react103.useState)(false);
31060
31062
  const [fetchedCustomMenuItems, setFetchedCustomMenuItems] = (0, import_react103.useState)([]);
31061
31063
  (0, import_react103.useEffect)(() => {
31062
31064
  const fetchCustomMenu = async () => {
31063
31065
  try {
31064
- const baseUrl = config.baseURL || "";
31065
- const headers = {};
31066
- if (currentTenant?.id) headers["x-tenant-id"] = currentTenant.id;
31067
- const response = await fetch(`${baseUrl}/api/menu-items?menuTarget=workspace`, { headers });
31068
- const json = await response.json();
31066
+ const json = await get("/api/menu-items?menuTarget=workspace");
31069
31067
  if (json.success && json.data?.records) {
31070
31068
  const items = json.data.records.map(menuItemToSideMenuItemConfig);
31071
31069
  setFetchedCustomMenuItems(items);
@@ -31074,7 +31072,7 @@ var WorkspaceResourceManager = ({
31074
31072
  }
31075
31073
  };
31076
31074
  fetchCustomMenu();
31077
- }, [config.baseURL, currentTenant?.id]);
31075
+ }, [get]);
31078
31076
  (0, import_react103.useEffect)(() => {
31079
31077
  for (const item of fetchedCustomMenuItems) {
31080
31078
  regsiterElement(item.id, {
@@ -31651,9 +31649,8 @@ var MODAL_BODY_STYLE = {
31651
31649
  gap: 12
31652
31650
  };
31653
31651
  var PinToMenuButton = ({ assistantId }) => {
31654
- const { currentTenant } = useAuth();
31655
31652
  const workspaceCtx = import_react105.default.useContext(WorkspaceContext);
31656
- const { config } = useLatticeChatShellContext();
31653
+ const { post } = useApi();
31657
31654
  const [open, setOpen] = (0, import_react105.useState)(false);
31658
31655
  const [group, setGroup] = (0, import_react105.useState)("");
31659
31656
  const [name, setName] = (0, import_react105.useState)("");
@@ -31666,9 +31663,6 @@ var PinToMenuButton = ({ assistantId }) => {
31666
31663
  }
31667
31664
  setLoading(true);
31668
31665
  try {
31669
- const baseUrl = config.baseURL || "";
31670
- const headers = { "Content-Type": "application/json" };
31671
- if (currentTenant?.id) headers["x-tenant-id"] = currentTenant.id;
31672
31666
  const body = {
31673
31667
  menuTarget: "workspace",
31674
31668
  contentType: "agent",
@@ -31681,12 +31675,7 @@ var PinToMenuButton = ({ assistantId }) => {
31681
31675
  name: name.trim(),
31682
31676
  sortOrder: 0
31683
31677
  };
31684
- const response = await fetch(`${baseUrl}/api/menu-items`, {
31685
- method: "POST",
31686
- headers,
31687
- body: JSON.stringify(body)
31688
- });
31689
- const json = await response.json();
31678
+ const json = await post("/api/menu-items", body);
31690
31679
  if (json.success) {
31691
31680
  import_antd94.message.success("Pinned to menu");
31692
31681
  setOpen(false);