@fluid-app/portal-sdk 0.1.755 → 0.1.757

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.
Files changed (52) hide show
  1. package/dist/{FluidProvider-roDWPHfR.mjs → FluidProvider-BgUZ2Zeq.mjs} +2 -2
  2. package/dist/{FluidProvider-roDWPHfR.mjs.map → FluidProvider-BgUZ2Zeq.mjs.map} +1 -1
  3. package/dist/{FluidProvider-C0t5JIXa.cjs → FluidProvider-OS9My8xd.cjs} +2 -2
  4. package/dist/{FluidProvider-C0t5JIXa.cjs.map → FluidProvider-OS9My8xd.cjs.map} +1 -1
  5. package/dist/{MessagingScreen-NWNa14aM.mjs → MessagingScreen-02gtaS2n.mjs} +3 -3
  6. package/dist/{MessagingScreen-Bv8A4A3H.cjs → MessagingScreen-Bg6b4oU5.cjs} +2 -2
  7. package/dist/{MessagingScreen-Bv8A4A3H.cjs.map → MessagingScreen-Bg6b4oU5.cjs.map} +1 -1
  8. package/dist/{MessagingScreen-CCDcfckz.mjs → MessagingScreen-CnwSwV_P.mjs} +2 -2
  9. package/dist/{MessagingScreen-CCDcfckz.mjs.map → MessagingScreen-CnwSwV_P.mjs.map} +1 -1
  10. package/dist/{MessagingScreen-CixARTag.cjs → MessagingScreen-CxX8SKBi.cjs} +3 -3
  11. package/dist/{OrdersScreen-Bm2FPBzc.mjs → OrdersScreen-CIQgu0mm.mjs} +3 -3
  12. package/dist/{OrdersScreen-Bm2FPBzc.mjs.map → OrdersScreen-CIQgu0mm.mjs.map} +1 -1
  13. package/dist/{OrdersScreen-CxO-9ZQm.mjs → OrdersScreen-D3ZCCBFS.mjs} +3 -3
  14. package/dist/{OrdersScreen-BYzYw-1c.cjs → OrdersScreen-DHNd4AdM.cjs} +3 -3
  15. package/dist/{OrdersScreen-BYzYw-1c.cjs.map → OrdersScreen-DHNd4AdM.cjs.map} +1 -1
  16. package/dist/{OrdersScreen-CwknCE8D.cjs → OrdersScreen-DNZi4pqX.cjs} +3 -3
  17. package/dist/{ProfileScreen-Bcj6y4w0.cjs → ProfileScreen-BmQXLvco.cjs} +4 -4
  18. package/dist/{ProfileScreen-Ccl8RKvr.cjs → ProfileScreen-C8Hw772k.cjs} +3 -3
  19. package/dist/{ProfileScreen-Ccl8RKvr.cjs.map → ProfileScreen-C8Hw772k.cjs.map} +1 -1
  20. package/dist/{ProfileScreen-Co9cZ64C.mjs → ProfileScreen-D3TcBFVz.mjs} +3 -3
  21. package/dist/{ProfileScreen-Co9cZ64C.mjs.map → ProfileScreen-D3TcBFVz.mjs.map} +1 -1
  22. package/dist/{ProfileScreen-hKWBMMfq.mjs → ProfileScreen-DhUgEkY_.mjs} +4 -4
  23. package/dist/{SubscriptionsScreen-N8fPasLD.mjs → SubscriptionsScreen-CIiwoJ7N.mjs} +4 -4
  24. package/dist/{SubscriptionsScreen-Bju88wd6.cjs → SubscriptionsScreen-Cy6i7zci.cjs} +4 -4
  25. package/dist/{SubscriptionsScreen-Bju88wd6.cjs.map → SubscriptionsScreen-Cy6i7zci.cjs.map} +1 -1
  26. package/dist/{SubscriptionsScreen-Bf6rFFC7.mjs → SubscriptionsScreen-DSzlGZUy.mjs} +4 -4
  27. package/dist/{SubscriptionsScreen-Bf6rFFC7.mjs.map → SubscriptionsScreen-DSzlGZUy.mjs.map} +1 -1
  28. package/dist/{SubscriptionsScreen-DDLOLgpn.cjs → SubscriptionsScreen-bUnvHm8y.cjs} +4 -4
  29. package/dist/{build-widget-registry-CuBfK5ZQ.mjs → build-widget-registry-C7FvTNjh.mjs} +2 -1
  30. package/dist/build-widget-registry-C7FvTNjh.mjs.map +1 -0
  31. package/dist/{build-widget-registry-DDrEy2rk.cjs → build-widget-registry-D_oKisZM.cjs} +2 -1
  32. package/dist/build-widget-registry-D_oKisZM.cjs.map +1 -0
  33. package/dist/index.cjs +115 -45
  34. package/dist/index.cjs.map +1 -1
  35. package/dist/index.d.cts +2 -0
  36. package/dist/index.d.cts.map +1 -1
  37. package/dist/index.d.mts +2 -0
  38. package/dist/index.d.mts.map +1 -1
  39. package/dist/index.mjs +116 -46
  40. package/dist/index.mjs.map +1 -1
  41. package/dist/styles/remote-widget-shadow.css +2 -2
  42. package/dist/{use-portal-card-add-3ds-flow-Cz0iMmsZ.mjs → use-portal-card-add-3ds-flow-BEgDKY5T.mjs} +3 -3
  43. package/dist/{use-portal-card-add-3ds-flow-Cz0iMmsZ.mjs.map → use-portal-card-add-3ds-flow-BEgDKY5T.mjs.map} +1 -1
  44. package/dist/{use-portal-card-add-3ds-flow-CrQ40crw.cjs → use-portal-card-add-3ds-flow-BrZxvk8f.cjs} +3 -3
  45. package/dist/{use-portal-card-add-3ds-flow-CrQ40crw.cjs.map → use-portal-card-add-3ds-flow-BrZxvk8f.cjs.map} +1 -1
  46. package/dist/utils/build-remote-widget-plugin-manifests.cjs +1 -1
  47. package/dist/utils/build-remote-widget-plugin-manifests.mjs +1 -1
  48. package/dist/utils/build-widget-registry.cjs +1 -1
  49. package/dist/utils/build-widget-registry.mjs +1 -1
  50. package/package.json +3 -3
  51. package/dist/build-widget-registry-CuBfK5ZQ.mjs.map +0 -1
  52. package/dist/build-widget-registry-DDrEy2rk.cjs.map +0 -1
package/dist/index.cjs CHANGED
@@ -1,9 +1,9 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
2
  const require_chunk = require("./chunk-9hOWP6kD.cjs");
3
- const require_build_widget_registry = require("./build-widget-registry-DDrEy2rk.cjs");
3
+ const require_build_widget_registry = require("./build-widget-registry-D_oKisZM.cjs");
4
4
  const require_ContactsScreen = require("./ContactsScreen-CuuGPFIj.cjs");
5
5
  const require_ContactsTranslationBridge = require("./ContactsTranslationBridge-FyqcnCwN.cjs");
6
- const require_FluidProvider = require("./FluidProvider-C0t5JIXa.cjs");
6
+ const require_FluidProvider = require("./FluidProvider-OS9My8xd.cjs");
7
7
  const require_ScreenRenderer = require("./ScreenRenderer-CLT0DgZh.cjs");
8
8
  require("./account-api-context-BAC-rNdx.cjs");
9
9
  const require_use_optional_store = require("./use-optional-store-DiiiefyO.cjs");
@@ -76,19 +76,19 @@ const require_AppNavigationContext = require("./AppNavigationContext-WjLfoRRa.cj
76
76
  const require_self = require("./self-tqHX6Y6b.cjs");
77
77
  const require_use_store = require("./use-store-DFwGIM83.cjs");
78
78
  const require_sidebar = require("./sidebar-BnZL8dM6.cjs");
79
- const require_MessagingScreen = require("./MessagingScreen-Bv8A4A3H.cjs");
79
+ const require_MessagingScreen = require("./MessagingScreen-Bg6b4oU5.cjs");
80
80
  const require_use_navigation_parent = require("./use-navigation-parent-CuoRPElx.cjs");
81
81
  const require_ScreenHeaderContext = require("./ScreenHeaderContext-fJKG4BUl.cjs");
82
82
  const require_ShopScreen = require("./ShopScreen-Uc5SeGyb.cjs");
83
83
  const require_CustomersScreen = require("./CustomersScreen-CkPAbEDY.cjs");
84
84
  const require_ActivityScreen = require("./ActivityScreen-D2lUighL.cjs");
85
- require("./use-portal-card-add-3ds-flow-CrQ40crw.cjs");
86
- const require_ProfileScreen = require("./ProfileScreen-Ccl8RKvr.cjs");
87
- const require_SubscriptionsScreen = require("./SubscriptionsScreen-Bju88wd6.cjs");
85
+ require("./use-portal-card-add-3ds-flow-BrZxvk8f.cjs");
86
+ const require_ProfileScreen = require("./ProfileScreen-C8Hw772k.cjs");
87
+ const require_SubscriptionsScreen = require("./SubscriptionsScreen-Cy6i7zci.cjs");
88
88
  require("./dist-CJZYdYE0.cjs");
89
89
  require("./es-CX93V_6s.cjs");
90
90
  require("./dist-Bt-Aixnl.cjs");
91
- const require_OrdersScreen = require("./OrdersScreen-BYzYw-1c.cjs");
91
+ const require_OrdersScreen = require("./OrdersScreen-DHNd4AdM.cjs");
92
92
  const require_MySiteScreen = require("./MySiteScreen-VWUklQkz.cjs");
93
93
  require("./dist-COlBA6rn.cjs");
94
94
  require("./AppDownloadScreen-DIn7d0a4.cjs");
@@ -1398,7 +1398,7 @@ function getInitials(name) {
1398
1398
  if (parts.length >= 2) return ((parts[0]?.[0] ?? "") + (parts[parts.length - 1]?.[0] ?? "")).toUpperCase();
1399
1399
  return (name[0] ?? "U").toUpperCase();
1400
1400
  }
1401
- function SdkMobileProfileMenu({ onNavigate, onLogout }) {
1401
+ function SdkMobileProfileMenu({ onNavigate, onLogout, onSwitchCompany }) {
1402
1402
  const { isMobile, useBottomNav } = require_sidebar.useSidebar();
1403
1403
  const [isOpen, setIsOpen] = (0, react.useState)(false);
1404
1404
  const [view, setView] = (0, react.useState)("main");
@@ -1422,6 +1422,7 @@ function SdkMobileProfileMenu({ onNavigate, onLogout }) {
1422
1422
  const handleAppDownload = require_FluidProvider.useHapticCallback("tap", () => handleNavigate("app-download"));
1423
1423
  const handleCycleTheme = require_FluidProvider.useHapticCallback("select", themeMode.cycleMode);
1424
1424
  const handleLogout = require_FluidProvider.useHapticCallback("tap", onLogout);
1425
+ const handleSwitchCompany = require_FluidProvider.useHapticCallback("tap", onSwitchCompany);
1425
1426
  if (!isMobile || !useBottomNav) return null;
1426
1427
  const initials = getInitials(user?.name);
1427
1428
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
@@ -1521,6 +1522,12 @@ function SdkMobileProfileMenu({ onNavigate, onLogout }) {
1521
1522
  className: "text-sidebar-foreground hover:bg-sidebar-accent hover:text-sidebar-accent-foreground flex w-full items-center gap-3 rounded-lg px-3 py-2.5 text-sm font-medium",
1522
1523
  children: [themeMode.mode === "dark" ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.Moon, { className: "size-5" }) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.Sun, { className: "size-5" }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: themeMode.mode === "light" ? t("theme_light") : t("theme_dark") })]
1523
1524
  }),
1525
+ onSwitchCompany && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
1526
+ type: "button",
1527
+ onClick: handleSwitchCompany,
1528
+ className: "text-sidebar-foreground hover:bg-sidebar-accent hover:text-sidebar-accent-foreground flex w-full items-center gap-3 rounded-lg px-3 py-2.5 text-sm font-medium",
1529
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.ArrowLeftRight, { className: "size-5" }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: t("switch_company") })]
1530
+ }),
1524
1531
  onLogout && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
1525
1532
  type: "button",
1526
1533
  onClick: handleLogout,
@@ -1534,7 +1541,7 @@ function SdkMobileProfileMenu({ onNavigate, onLogout }) {
1534
1541
  }
1535
1542
  //#endregion
1536
1543
  //#region src/shell/SdkHeader.tsx
1537
- function SdkHeader({ mobileTabs, currentSlug, title, onBack, onNavigate, onTabNavigate, onLogout, persistentActions }) {
1544
+ function SdkHeader({ mobileTabs, currentSlug, title, onBack, onNavigate, onTabNavigate, onLogout, onSwitchCompany, persistentActions }) {
1538
1545
  const navigateToTab = onTabNavigate ?? onNavigate;
1539
1546
  const sidebar = require_sidebar.useSidebar();
1540
1547
  const shellApi = require_shell_translation_api_context.useShellTranslation();
@@ -1565,7 +1572,8 @@ function SdkHeader({ mobileTabs, currentSlug, title, onBack, onNavigate, onTabNa
1565
1572
  persistentActions,
1566
1573
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SdkMobileProfileMenu, {
1567
1574
  onNavigate,
1568
- onLogout
1575
+ onLogout,
1576
+ onSwitchCompany
1569
1577
  })
1570
1578
  ]
1571
1579
  })
@@ -2143,10 +2151,10 @@ function resolveMemberTypePage(registry, memberTypeSlug, currentSlug, baseSlug)
2143
2151
  }
2144
2152
  //#endregion
2145
2153
  //#region src/shell/system-screen-map.ts
2146
- const ProfileScreen$1 = (0, react.lazy)(() => Promise.resolve().then(() => require("./ProfileScreen-Bcj6y4w0.cjs")).then((m) => ({ default: m.ProfileScreen })));
2147
- const OrdersScreen$1 = (0, react.lazy)(() => Promise.resolve().then(() => require("./OrdersScreen-CwknCE8D.cjs")).then((m) => ({ default: m.OrdersScreen })));
2148
- const SubscriptionsScreen$1 = (0, react.lazy)(() => Promise.resolve().then(() => require("./SubscriptionsScreen-DDLOLgpn.cjs")).then((m) => ({ default: m.SubscriptionsScreen })));
2149
- const MessagingScreen$1 = (0, react.lazy)(() => Promise.resolve().then(() => require("./MessagingScreen-CixARTag.cjs")).then((m) => ({ default: m.MessagingScreen })));
2154
+ const ProfileScreen$1 = (0, react.lazy)(() => Promise.resolve().then(() => require("./ProfileScreen-BmQXLvco.cjs")).then((m) => ({ default: m.ProfileScreen })));
2155
+ const OrdersScreen$1 = (0, react.lazy)(() => Promise.resolve().then(() => require("./OrdersScreen-DNZi4pqX.cjs")).then((m) => ({ default: m.OrdersScreen })));
2156
+ const SubscriptionsScreen$1 = (0, react.lazy)(() => Promise.resolve().then(() => require("./SubscriptionsScreen-bUnvHm8y.cjs")).then((m) => ({ default: m.SubscriptionsScreen })));
2157
+ const MessagingScreen$1 = (0, react.lazy)(() => Promise.resolve().then(() => require("./MessagingScreen-CxX8SKBi.cjs")).then((m) => ({ default: m.MessagingScreen })));
2150
2158
  const ContactsScreen$1 = (0, react.lazy)(() => Promise.resolve().then(() => require("./ContactsScreen-J8cS9Y97.cjs")).then((m) => ({ default: m.ContactsScreen })));
2151
2159
  const ShopScreen$1 = (0, react.lazy)(() => Promise.resolve().then(() => require("./ShopScreen-BY0IkRGH.cjs")).then((m) => ({ default: m.ShopScreen })));
2152
2160
  const CustomersScreen$1 = (0, react.lazy)(() => Promise.resolve().then(() => require("./CustomersScreen-Bs8sOzV-.cjs")).then((m) => ({ default: m.CustomersScreen })));
@@ -2440,8 +2448,45 @@ function resetFairShareSdk() {
2440
2448
  *
2441
2449
  * Provides a complete logout function that:
2442
2450
  * 1. Clears all client-side state (query cache, IndexedDB, sessionStorage)
2443
- * 2. Navigates to GET /logout — Rails clears the session and redirects to the Hub
2451
+ * 2. Submits a CSRF-checked DELETE /logout (GET /logout, which only clears the
2452
+ * tenant session, when the page has no csrf-token meta tag)
2444
2453
  */
2454
+ function submitDeleteLogout(csrfToken) {
2455
+ const form = document.createElement("form");
2456
+ form.method = "POST";
2457
+ form.action = "/logout";
2458
+ form.style.display = "none";
2459
+ for (const [name, value] of [["_method", "delete"], ["authenticity_token", csrfToken]]) {
2460
+ const input = document.createElement("input");
2461
+ input.type = "hidden";
2462
+ input.name = name;
2463
+ input.value = value;
2464
+ form.appendChild(input);
2465
+ }
2466
+ document.body.appendChild(form);
2467
+ form.submit();
2468
+ }
2469
+ /**
2470
+ * Hook that returns a function clearing all client-side state: the query
2471
+ * cache, the IndexedDB persisted cache, sessionStorage and the FairShare SDK
2472
+ * identity.
2473
+ */
2474
+ function useClearClientState() {
2475
+ const queryClient = (0, _tanstack_react_query.useQueryClient)();
2476
+ return (0, react.useCallback)(async () => {
2477
+ await queryClient.cancelQueries();
2478
+ queryClient.clear();
2479
+ try {
2480
+ await require_build_widget_registry.deleteDatabase();
2481
+ } catch (error) {
2482
+ console.error("[useLogout] Failed to clear IndexedDB cache:", error);
2483
+ }
2484
+ try {
2485
+ sessionStorage.clear();
2486
+ } catch {}
2487
+ resetFairShareSdk();
2488
+ }, [queryClient]);
2489
+ }
2445
2490
  /**
2446
2491
  * Hook that returns a `logout` function which clears the server session
2447
2492
  * via `DELETE /logout` and all cached/persisted client state.
@@ -2460,35 +2505,44 @@ function resetFairShareSdk() {
2460
2505
  * ```
2461
2506
  */
2462
2507
  function useLogout({ redirectUrl, onLogout } = {}) {
2463
- const queryClient = (0, _tanstack_react_query.useQueryClient)();
2508
+ const clearClientState = useClearClientState();
2464
2509
  return (0, react.useCallback)(async () => {
2465
- await queryClient.cancelQueries();
2466
- queryClient.clear();
2467
- try {
2468
- await require_build_widget_registry.deleteDatabase();
2469
- } catch (error) {
2470
- console.error("[useLogout] Failed to clear IndexedDB cache:", error);
2471
- }
2472
- try {
2473
- sessionStorage.clear();
2474
- } catch {}
2475
- resetFairShareSdk();
2510
+ await clearClientState();
2476
2511
  if (redirectUrl) window.location.href = redirectUrl;
2477
2512
  else if (onLogout) onLogout();
2478
- else window.location.href = "/logout";
2513
+ else {
2514
+ const csrfToken = document.querySelector("meta[name=\"csrf-token\"]")?.getAttribute("content");
2515
+ if (csrfToken) submitDeleteLogout(csrfToken);
2516
+ else window.location.href = "/logout";
2517
+ }
2479
2518
  }, [
2480
- queryClient,
2519
+ clearClientState,
2481
2520
  redirectUrl,
2482
2521
  onLogout
2483
2522
  ]);
2484
2523
  }
2485
2524
  //#endregion
2525
+ //#region src/hooks/use-switch-company.ts
2526
+ /**
2527
+ * Returns a handler that clears client-side state and then navigates to the
2528
+ * tenant's `/switch-company`, or undefined when `enabled` is false.
2529
+ */
2530
+ function useSwitchCompany(enabled) {
2531
+ const clearClientState = useClearClientState();
2532
+ const switchCompany = (0, react.useCallback)(() => {
2533
+ clearClientState().then(() => {
2534
+ window.location.href = "/switch-company";
2535
+ });
2536
+ }, [clearClientState]);
2537
+ return enabled ? switchCompany : void 0;
2538
+ }
2539
+ //#endregion
2486
2540
  //#region src/shell/SdkLogoutButton.tsx
2487
2541
  /**
2488
- * Sidebar footer slot. Renders Theme toggle + Log out.
2542
+ * Sidebar footer slot. Renders Theme toggle + Switch company (default config) + Log out.
2489
2543
  * Filename is historical — kept to avoid touching the AppShell wiring.
2490
2544
  */
2491
- function SdkLogoutButton({ onLogout }) {
2545
+ function SdkLogoutButton({ onLogout, onSwitchCompany }) {
2492
2546
  const [isPending, setIsPending] = (0, react.useState)(false);
2493
2547
  const themeMode = useThemeMode();
2494
2548
  const { t } = require_shell_translation_api_context.useShellTranslation();
@@ -2503,15 +2557,22 @@ function SdkLogoutButton({ onLogout }) {
2503
2557
  }
2504
2558
  }, [onLogout]);
2505
2559
  const ThemeIcon = themeMode.displayMode === "dark" ? lucide_react.Moon : lucide_react.Sun;
2506
- return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_sidebar.SidebarMenu, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_sidebar.SidebarMenuItem, { children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_sidebar.SidebarMenuButton, {
2507
- onClick: themeMode.cycleMode,
2508
- "aria-label": t("theme_switch", { mode: themeMode.mode }),
2509
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(ThemeIcon, { className: "size-4" }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: t("theme_label") })]
2510
- }) }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_sidebar.SidebarMenuItem, { children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_sidebar.SidebarMenuButton, {
2511
- onClick: handleClick,
2512
- disabled: isPending,
2513
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.LogOut, { className: "size-4" }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: isPending ? t("logout_pending") : t("logout") })]
2514
- }) })] });
2560
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_sidebar.SidebarMenu, { children: [
2561
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_sidebar.SidebarMenuItem, { children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_sidebar.SidebarMenuButton, {
2562
+ onClick: themeMode.cycleMode,
2563
+ "aria-label": t("theme_switch", { mode: themeMode.mode }),
2564
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(ThemeIcon, { className: "size-4" }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: t("theme_label") })]
2565
+ }) }),
2566
+ onSwitchCompany && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_sidebar.SidebarMenuItem, { children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_sidebar.SidebarMenuButton, {
2567
+ onClick: onSwitchCompany,
2568
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.ArrowLeftRight, { className: "size-4" }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: t("switch_company") })]
2569
+ }) }),
2570
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_sidebar.SidebarMenuItem, { children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_sidebar.SidebarMenuButton, {
2571
+ onClick: handleClick,
2572
+ disabled: isPending,
2573
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.LogOut, { className: "size-4" }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: isPending ? t("logout_pending") : t("logout") })]
2574
+ }) })
2575
+ ] });
2515
2576
  }
2516
2577
  //#endregion
2517
2578
  //#region src/navigation/filter-nav-items.ts
@@ -2960,6 +3021,7 @@ function AppShell({ appData: appDataProp, navigation: navigationProp, customPage
2960
3021
  redirectUrl: logoutRedirectUrl,
2961
3022
  onLogout
2962
3023
  });
3024
+ const handleSwitchCompany = useSwitchCompany(!logoutRedirectUrl && !onLogout);
2963
3025
  const activeSlug = controlledSlug ?? pathSlug;
2964
3026
  const shoppingEnabled = isPortalCartAvailable(activeSlug, allNavSlugs);
2965
3027
  const activeSlugRef = (0, react.useRef)(activeSlug);
@@ -3026,7 +3088,14 @@ function AppShell({ appData: appDataProp, navigation: navigationProp, customPage
3026
3088
  const orderToken = item.token;
3027
3089
  if (typeof orderToken === "string" && orderToken) handleNavigate(`orders/${orderToken}`);
3028
3090
  }, [handleNavigate]);
3029
- const resolvedSidebarFooter = (0, react.useMemo)(() => sidebarFooter !== void 0 ? sidebarFooter : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SdkLogoutButton, { onLogout: logout }), [sidebarFooter, logout]);
3091
+ const resolvedSidebarFooter = (0, react.useMemo)(() => sidebarFooter !== void 0 ? sidebarFooter : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SdkLogoutButton, {
3092
+ onLogout: logout,
3093
+ onSwitchCompany: handleSwitchCompany
3094
+ }), [
3095
+ sidebarFooter,
3096
+ logout,
3097
+ handleSwitchCompany
3098
+ ]);
3030
3099
  const slugMatch = (0, react.useMemo)(() => require_use_navigation_parent.matchSlugPrefix(activeSlug, allNavSlugs), [activeSlug, allNavSlugs]);
3031
3100
  const baseSlug = slugMatch?.matchedSlug ?? require_use_navigation_parent.normalizeSlug(activeSlug);
3032
3101
  const restParams = slugMatch?.rest ?? "";
@@ -3132,6 +3201,7 @@ function AppShell({ appData: appDataProp, navigation: navigationProp, customPage
3132
3201
  onNavigate: handleNavigate,
3133
3202
  onTabNavigate: handleTabNavigate,
3134
3203
  onLogout: logout,
3204
+ onSwitchCompany: handleSwitchCompany,
3135
3205
  persistentActions: shoppingEnabled ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(PortalCartButton, { viewport: "mobile" }) : void 0
3136
3206
  }),
3137
3207
  sidebarHeader: sidebarHeader !== void 0 ? sidebarHeader : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SdkCompanySwitcher, {}),
@@ -4693,11 +4763,11 @@ const CORE_PAGE_IDS = {
4693
4763
  //#endregion
4694
4764
  //#region src/screens/index.ts
4695
4765
  const screenPropertySchemas = {
4696
- ProfileScreen: () => Promise.resolve().then(() => require("./ProfileScreen-Bcj6y4w0.cjs")).then((m) => m.profileScreenPropertySchema),
4697
- MessagingScreen: () => Promise.resolve().then(() => require("./MessagingScreen-CixARTag.cjs")).then((m) => m.messagingScreenPropertySchema),
4766
+ ProfileScreen: () => Promise.resolve().then(() => require("./ProfileScreen-BmQXLvco.cjs")).then((m) => m.profileScreenPropertySchema),
4767
+ MessagingScreen: () => Promise.resolve().then(() => require("./MessagingScreen-CxX8SKBi.cjs")).then((m) => m.messagingScreenPropertySchema),
4698
4768
  ContactsScreen: () => Promise.resolve().then(() => require("./ContactsScreen-J8cS9Y97.cjs")).then((m) => m.contactsScreenPropertySchema),
4699
- OrdersScreen: () => Promise.resolve().then(() => require("./OrdersScreen-CwknCE8D.cjs")).then((m) => m.ordersScreenPropertySchema),
4700
- SubscriptionsScreen: () => Promise.resolve().then(() => require("./SubscriptionsScreen-DDLOLgpn.cjs")).then((m) => m.subscriptionsScreenPropertySchema),
4769
+ OrdersScreen: () => Promise.resolve().then(() => require("./OrdersScreen-DNZi4pqX.cjs")).then((m) => m.ordersScreenPropertySchema),
4770
+ SubscriptionsScreen: () => Promise.resolve().then(() => require("./SubscriptionsScreen-bUnvHm8y.cjs")).then((m) => m.subscriptionsScreenPropertySchema),
4701
4771
  CustomersScreen: () => Promise.resolve().then(() => require("./CustomersScreen-Bs8sOzV-.cjs")).then((m) => m.customersScreenPropertySchema),
4702
4772
  MySiteScreen: () => Promise.resolve().then(() => require("./MySiteScreen-BsGXf1C4.cjs")).then((m) => m.mySiteScreenPropertySchema),
4703
4773
  ShareablesScreen: () => Promise.resolve().then(() => require("./ShareablesScreen-DrnYAtJy.cjs")).then((m) => m.shareablesScreenPropertySchema),