File size: 1,281 Bytes
092334a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import CustomerGrid from "./customer-grid/CustomerGrid";
import { OverlayProvider } from "./customer-grid/OverlaySurface";
import { isStreamlitComponent } from "./customer-grid/hostBridge";
import Shell from "./shell/Shell";

// HOSTED = either Streamlit path (the component iframe, or the legacy injected
// payload). There the surrounding app owns all chrome and this tree renders the
// BARE grid, byte-for-byte the behavior the embed always had. Only the
// standalone build gets the shell (wave 4, the strangler frame). Computed once
// at module level, like useCustomerData's own mode constants — the host mode
// cannot change within a page lifetime.
// EXPORTED (EXIT wave 1): main.tsx needs the same answer to decide whether to
// install the standalone event sink, and two copies of a mode predicate is how
// the two halves of "standalone-only" end up disagreeing.
export const HOSTED =
  isStreamlitComponent() ||
  typeof (window as unknown as { __AIOS_GRID__?: unknown }).__AIOS_GRID__ !== "undefined";

export default function App() {
  if (HOSTED) {
    return (
      <div style={{ width: "100%", height: "100%", overflow: "hidden" }}>
        <OverlayProvider>
          <CustomerGrid />
        </OverlayProvider>
      </div>
    );
  }
  return <Shell />;
}