The easy-to-use open source Business Intelligence and Embedded Analytics tool that lets everyone work with data :bar_chart:
TypeScript analyticsbibusiness-intelligencebusinessintelligenceclojuredashboarddatadata-analysisdata-visualizationdatabasemetabasemysqlpostgrespostgresqlreportingslacksql-editorvisualization
/**
* The single source of truth for the globals the data-app bundle is built
* against. The app is built as one IIFE that assigns its factory to
* `DATA_APP_FACTORY_GLOBAL`, with React + the SDK left external and mapped to
* these names; the host's `createDataAppSandbox` (`./sandbox.ts`) endows
* exactly these names — both sides import this map so the build-time and
* runtime contracts can't drift.
*/
export const DATA_APP_GLOBAL_NAMES = {
react: "React",
reactDom: "__react_dom__",
reactDomClient: "__react_dom_client__",
reactDomServer: "__react_dom_server__",
reactJsxRuntime: "__react_jsx_runtime__",
reactJsxDevRuntime: "__react_jsx_dev_runtime__",
sdk: "__metabase_sdk__",
dataApp: "__metabase_data_app__",
factory: "__dataAppFactory__",
} as const;
export const DATA_APP_FACTORY_GLOBAL = DATA_APP_GLOBAL_NAMES.factory;
/** Each externalized import mapped to the global the sandbox endows it as. */
export const DATA_APP_GLOBALS: Record<string, string> = {
react: DATA_APP_GLOBAL_NAMES.react,
"react-dom": DATA_APP_GLOBAL_NAMES.reactDom,
"react-dom/client": DATA_APP_GLOBAL_NAMES.reactDomClient,
"react-dom/server": DATA_APP_GLOBAL_NAMES.reactDomServer,
"react/jsx-runtime": DATA_APP_GLOBAL_NAMES.reactJsxRuntime,
"react/jsx-dev-runtime": DATA_APP_GLOBAL_NAMES.reactJsxDevRuntime,
"@metabase/embedding-sdk-react": DATA_APP_GLOBAL_NAMES.sdk,
"@metabase/embedding-sdk-react/data-app": DATA_APP_GLOBAL_NAMES.dataApp,
};
/** The imports kept external, derived from `DATA_APP_GLOBALS` so the two can't drift. */
export const DATA_APP_EXTERNALS: string[] = Object.keys(DATA_APP_GLOBALS);