import { LiveControls } from "@decocms/blocks/hooks"; import { ANALYTICS_SCRIPT } from "@decocms/blocks/sdk/analytics"; import type { ReactNode } from "react"; function buildDecoEventsBootstrap(account?: string): string { const accountJson = JSON.stringify(account ?? ""); return ` window.__RUNTIME__ = window.__RUNTIME__ || { account: ${accountJson} }; window.DECO = window.DECO || {}; window.DECO.events = window.DECO.events || { _q: [], _subs: [], dispatch: function(e) { this._q.push(e); for (var i = 0; i < this._subs.length; i++) { try { this._subs[i](e); } catch(err) { console.error('[DECO.events]', err); } } }, subscribe: function(fn) { this._subs.push(fn); for (var i = 0; i < this._q.length; i++) { try { fn(this._q[i]); } catch(err) {} } } }; window.dataLayer = window.dataLayer || []; `; } export interface DecoRootLayoutProps { /** Language attribute for the tag. Default: "en" */ lang?: string; /** DaisyUI data-theme attribute. Default: "light" */ dataTheme?: string; /** Site name for LiveControls (admin iframe communication). Required. */ siteName: string; /** Commerce platform account name for analytics bootstrap (e.g. VTEX account). */ account?: string; /** CSS class for
. Default: "bg-base-200 text-base-content" */ bodyClassName?: string; children?: ReactNode; } /** * Root layout for app/layout.tsx — the Next.js analogue of * `@decocms/tanstack`'s `DecoRootLayout`. * * The bootstrap/analytics