@accelerated-agency/visual-editor 0.2.2 → 0.2.4

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 (4) hide show
  1. package/dist/index.js +13 -53
  2. package/dist/vite.cjs +1770 -165
  3. package/dist/vite.js +1770 -165
  4. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -1843,13 +1843,10 @@ function ElementIcon({ tag }) {
1843
1843
  return /* @__PURE__ */ jsx("span", { className: "shrink-0 w-5 h-5 rounded flex items-center justify-center", style: { backgroundColor: bgColor }, children: /* @__PURE__ */ jsx("svg", { width: "12", height: "12", viewBox: "0 0 12 12", fill: "none", children: /* @__PURE__ */ jsx("rect", { x: "1.5", y: "1.5", width: "9", height: "9", rx: "1.5", stroke: iconColor, strokeWidth: "1.2" }) }) });
1844
1844
  }
1845
1845
  var CHANNEL = "conversion-editor";
1846
- var IFRAME_LOAD_GUARD_MS = 13e4;
1847
1846
  function IframeCanvas({ url, password, proxyBaseUrl = "", onBridgeReady, onPong }) {
1848
1847
  const iframeElRef = useRef(null);
1849
- const loadGuardRef = useRef(null);
1850
1848
  const setSelectedElement = useMutationsStore((s) => s.setSelectedElement);
1851
1849
  const addMutationToActive = useVariationsStore((s) => s.addMutationToActive);
1852
- const [loading, setLoading] = useState(false);
1853
1850
  useEffect(() => {
1854
1851
  setIframeRef(iframeElRef.current);
1855
1852
  return () => setIframeRef(null);
@@ -1888,25 +1885,6 @@ function IframeCanvas({ url, password, proxyBaseUrl = "", onBridgeReady, onPong
1888
1885
  window.addEventListener("message", handleMessage);
1889
1886
  return () => window.removeEventListener("message", handleMessage);
1890
1887
  }, [handleMessage]);
1891
- useEffect(() => {
1892
- if (!url) return;
1893
- setLoading(true);
1894
- if (loadGuardRef.current) clearTimeout(loadGuardRef.current);
1895
- loadGuardRef.current = setTimeout(() => {
1896
- loadGuardRef.current = null;
1897
- setLoading(false);
1898
- }, IFRAME_LOAD_GUARD_MS);
1899
- return () => {
1900
- if (loadGuardRef.current) clearTimeout(loadGuardRef.current);
1901
- };
1902
- }, [url]);
1903
- const clearLoadGuard = useCallback(() => {
1904
- if (loadGuardRef.current) {
1905
- clearTimeout(loadGuardRef.current);
1906
- loadGuardRef.current = null;
1907
- }
1908
- setLoading(false);
1909
- }, []);
1910
1888
  let resolvedUrl;
1911
1889
  if (url.toLowerCase() === "test") {
1912
1890
  resolvedUrl = "/test";
@@ -1921,27 +1899,16 @@ function IframeCanvas({ url, password, proxyBaseUrl = "", onBridgeReady, onPong
1921
1899
  /* @__PURE__ */ jsx("p", { className: "text-sm text-gray-400", children: 'Load a page from the Page dropdown in the top bar, or type "test" for the local test page' })
1922
1900
  ] });
1923
1901
  }
1924
- return /* @__PURE__ */ jsxs("div", { className: "relative w-full h-full", children: [
1925
- loading && /* @__PURE__ */ jsxs("div", { className: "absolute inset-0 z-10 flex flex-col gap-4 p-8", style: { backgroundColor: "#F9FAFB" }, children: [
1926
- /* @__PURE__ */ jsx("div", { className: "h-8 w-3/4 rounded-md animate-pulse", style: { backgroundColor: "#E5E5E5" } }),
1927
- /* @__PURE__ */ jsx("div", { className: "h-4 w-1/2 rounded-md animate-pulse", style: { backgroundColor: "#E5E5E5" } }),
1928
- /* @__PURE__ */ jsx("div", { className: "h-48 w-full rounded-md animate-pulse", style: { backgroundColor: "#E5E5E5" } }),
1929
- /* @__PURE__ */ jsx("div", { className: "h-4 w-2/3 rounded-md animate-pulse", style: { backgroundColor: "#E5E5E5" } }),
1930
- /* @__PURE__ */ jsx("div", { className: "h-4 w-1/3 rounded-md animate-pulse", style: { backgroundColor: "#E5E5E5" } }),
1931
- /* @__PURE__ */ jsx("div", { className: "h-32 w-full rounded-md animate-pulse", style: { backgroundColor: "#E5E5E5" } })
1932
- ] }),
1933
- /* @__PURE__ */ jsx(
1934
- "iframe",
1935
- {
1936
- ref: iframeElRef,
1937
- src: resolvedUrl,
1938
- className: "w-full h-full border-0",
1939
- sandbox: "allow-scripts allow-same-origin allow-forms allow-popups",
1940
- onLoad: clearLoadGuard,
1941
- onError: clearLoadGuard
1942
- }
1943
- )
1944
- ] });
1902
+ return /* @__PURE__ */ jsx("div", { className: "relative w-full h-full", children: /* @__PURE__ */ jsx(
1903
+ "iframe",
1904
+ {
1905
+ ref: iframeElRef,
1906
+ src: resolvedUrl,
1907
+ className: "w-full h-full border-0",
1908
+ sandbox: "allow-scripts allow-same-origin allow-forms allow-popups",
1909
+ title: "Visual editor page"
1910
+ }
1911
+ ) });
1945
1912
  }
1946
1913
  function ElementOverlayToolbar() {
1947
1914
  const selectedElement = useMutationsStore((s) => s.selectedElement);
@@ -4804,11 +4771,12 @@ function PlatformVisualEditorV2({
4804
4771
  status,
4805
4772
  tabs = [],
4806
4773
  activeTab = "Visual Editor",
4807
- loading = false,
4774
+ loading: _loading = false,
4808
4775
  error = null,
4809
4776
  showCloseButton = true,
4810
4777
  closeLabel = "Close",
4811
- loadingText = "Loading visual editor...",
4778
+ loadingText: _loadingText = "Loading visual editor...",
4779
+ renderLoading: _renderLoading,
4812
4780
  saveDebounceSkips = 2,
4813
4781
  experiment,
4814
4782
  onClose,
@@ -4821,7 +4789,6 @@ function PlatformVisualEditorV2({
4821
4789
  onNavigateRequested,
4822
4790
  onDiscardDirty,
4823
4791
  renderHeader,
4824
- renderLoading,
4825
4792
  renderError
4826
4793
  }) {
4827
4794
  const iframeRef = useRef(null);
@@ -4943,13 +4910,6 @@ function PlatformVisualEditorV2({
4943
4910
  (tab) => onTabChange?.(tab),
4944
4911
  [onTabChange]
4945
4912
  );
4946
- if (loading) {
4947
- if (renderLoading) return renderLoading();
4948
- return /* @__PURE__ */ jsx("div", { className: "fixed inset-0 z-[9999] flex items-center justify-center bg-slate-50", children: /* @__PURE__ */ jsxs("div", { className: "flex flex-col items-center gap-3", children: [
4949
- /* @__PURE__ */ jsx("div", { className: "w-8 h-8 border-2 border-slate-200 border-t-indigo-500 rounded-full animate-spin" }),
4950
- /* @__PURE__ */ jsx("p", { className: "text-sm text-slate-400", children: loadingText })
4951
- ] }) });
4952
- }
4953
4913
  if (error) {
4954
4914
  if (renderError) return renderError(error);
4955
4915
  return /* @__PURE__ */ jsx("div", { className: "fixed inset-0 z-[9999] flex items-center justify-center bg-slate-50", children: /* @__PURE__ */ jsxs("div", { className: "flex flex-col items-center gap-2 text-center px-8", children: [