2026-04-05 18:31:16 -07:00
|
|
|
import React from 'react';
|
|
|
|
|
import ReactDOM from 'react-dom/client';
|
|
|
|
|
import { App } from './App';
|
|
|
|
|
import { WhpConfig } from './types';
|
2026-08-09 10:37:32 -07:00
|
|
|
import { installConsoleErrorBuffer } from './utils/console-buffer';
|
2026-08-09 10:59:38 -07:00
|
|
|
import { editorBuild } from './utils/build-stamp';
|
2026-04-05 18:31:16 -07:00
|
|
|
import './styles/editor.css';
|
|
|
|
|
|
2026-08-09 10:37:32 -07:00
|
|
|
// Installed before React mounts so errors thrown during the first render are
|
|
|
|
|
// captured too.
|
|
|
|
|
installConsoleErrorBuffer();
|
|
|
|
|
|
2026-08-09 11:05:01 -07:00
|
|
|
// Exposed on window (not logged -- no need to print this on every load for
|
|
|
|
|
// every customer) so support can ask someone to type __WHP_EDITOR_BUILD__
|
|
|
|
|
// in the console on request. This call is also load-bearing for bundling:
|
|
|
|
|
// it is currently the only reference to `editorBuild()`, which keeps the
|
|
|
|
|
// __EDITOR_BUILD__-reading module from being tree-shaken out of the bundle
|
|
|
|
|
// before Task 19 wires it into the report payload. Do not remove this line
|
|
|
|
|
// as a "stray global" cleanup -- doing so silently reverts every future
|
|
|
|
|
// bug report to showing 'dev' instead of a real build stamp.
|
|
|
|
|
(window as any).__WHP_EDITOR_BUILD__ = editorBuild();
|
2026-08-09 10:59:38 -07:00
|
|
|
|
2026-04-05 18:31:16 -07:00
|
|
|
// Read WHP_CONFIG injected by PHP wrapper (or null for standalone dev)
|
|
|
|
|
const whpConfig: WhpConfig | null = (window as any).WHP_CONFIG || null;
|
|
|
|
|
|
|
|
|
|
ReactDOM.createRoot(document.getElementById('root')!).render(
|
|
|
|
|
<React.StrictMode>
|
|
|
|
|
<App whpConfig={whpConfig} />
|
|
|
|
|
</React.StrictMode>
|
|
|
|
|
);
|