@accelerated-agency/visual-editor 0.1.3 → 0.1.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.
- package/dist/index.js +8 -6
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1867,7 +1867,7 @@ import { useState as useState6, useCallback as useCallback6, useEffect as useEff
|
|
|
1867
1867
|
import { useCallback as useCallback4, useEffect as useEffect4, useRef as useRef4, useState as useState4 } from "react";
|
|
1868
1868
|
import { jsx as jsx4, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
1869
1869
|
var CHANNEL = "conversion-editor";
|
|
1870
|
-
function IframeCanvas({ url, password, onBridgeReady, onPong }) {
|
|
1870
|
+
function IframeCanvas({ url, password, proxyBaseUrl = "", onBridgeReady, onPong }) {
|
|
1871
1871
|
const iframeElRef = useRef4(null);
|
|
1872
1872
|
const setSelectedElement = useMutationsStore((s) => s.setSelectedElement);
|
|
1873
1873
|
const addMutationToActive = useVariationsStore((s) => s.addMutationToActive);
|
|
@@ -1917,7 +1917,7 @@ function IframeCanvas({ url, password, onBridgeReady, onPong }) {
|
|
|
1917
1917
|
if (url.toLowerCase() === "test") {
|
|
1918
1918
|
resolvedUrl = "/test";
|
|
1919
1919
|
} else if (url.startsWith("http")) {
|
|
1920
|
-
resolvedUrl =
|
|
1920
|
+
resolvedUrl = `${proxyBaseUrl}/api/proxy?password=${encodeURIComponent(password || "")}&url=${encodeURIComponent(url)}`;
|
|
1921
1921
|
} else {
|
|
1922
1922
|
resolvedUrl = url;
|
|
1923
1923
|
}
|
|
@@ -2185,7 +2185,7 @@ var VIEWPORT_LABELS = {
|
|
|
2185
2185
|
tablet: "768 \xD7 1024",
|
|
2186
2186
|
mobile: "375 \xD7 812"
|
|
2187
2187
|
};
|
|
2188
|
-
function CanvasArea({ url, password, viewport, onBridgeReady, onPong }) {
|
|
2188
|
+
function CanvasArea({ url, password, viewport, proxyBaseUrl, onBridgeReady, onPong }) {
|
|
2189
2189
|
const iframeWidth = VIEWPORT_WIDTHS[viewport];
|
|
2190
2190
|
const isConstrained = viewport !== "desktop";
|
|
2191
2191
|
const [dragOver, setDragOver] = useState6(false);
|
|
@@ -2289,7 +2289,7 @@ function CanvasArea({ url, password, viewport, onBridgeReady, onPong }) {
|
|
|
2289
2289
|
maxWidth: "100%",
|
|
2290
2290
|
boxShadow: isConstrained ? "0 4px 24px rgba(0,0,0,0.1)" : "none"
|
|
2291
2291
|
},
|
|
2292
|
-
children: /* @__PURE__ */ jsx6(IframeCanvas, { url, password, onBridgeReady, onPong })
|
|
2292
|
+
children: /* @__PURE__ */ jsx6(IframeCanvas, { url, password, proxyBaseUrl, onBridgeReady, onPong })
|
|
2293
2293
|
}
|
|
2294
2294
|
) }),
|
|
2295
2295
|
dragOver && draggedSection && /* @__PURE__ */ jsx6(
|
|
@@ -4136,7 +4136,7 @@ function sendToPlatform(type, payload) {
|
|
|
4136
4136
|
data: { channel: PLATFORM_CHANNEL, type, payload }
|
|
4137
4137
|
}));
|
|
4138
4138
|
}
|
|
4139
|
-
function EditorShell({ initialExperiment, embeddedMode }) {
|
|
4139
|
+
function EditorShell({ initialExperiment, embeddedMode, proxyBaseUrl }) {
|
|
4140
4140
|
const [url, setUrl] = useState12("");
|
|
4141
4141
|
const [password, setPassword] = useState12("");
|
|
4142
4142
|
const [connectionStatus, setConnectionStatus] = useState12("disconnected");
|
|
@@ -4590,6 +4590,7 @@ function EditorShell({ initialExperiment, embeddedMode }) {
|
|
|
4590
4590
|
url,
|
|
4591
4591
|
password,
|
|
4592
4592
|
viewport,
|
|
4593
|
+
proxyBaseUrl,
|
|
4593
4594
|
onBridgeReady: handleBridgeReady,
|
|
4594
4595
|
onPong: handlePong
|
|
4595
4596
|
}
|
|
@@ -4605,6 +4606,7 @@ import { jsx as jsx13, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
|
4605
4606
|
function PlatformVisualEditor({
|
|
4606
4607
|
channel = "conversion-platform",
|
|
4607
4608
|
embeddedGlobalKey = "__CONVERSION_EMBEDDED__",
|
|
4609
|
+
proxyBaseUrl = typeof import.meta !== "undefined" && import.meta.env?.VITE_API_BASE_URL || "",
|
|
4608
4610
|
className = "fixed inset-0 z-[9999] flex flex-col bg-white",
|
|
4609
4611
|
editorClassName = "flex-1 min-h-0",
|
|
4610
4612
|
showHeader = true,
|
|
@@ -4816,7 +4818,7 @@ function PlatformVisualEditor({
|
|
|
4816
4818
|
) : null
|
|
4817
4819
|
] })
|
|
4818
4820
|
] }) : null,
|
|
4819
|
-
/* @__PURE__ */ jsx13("div", { className: editorClassName, children: /* @__PURE__ */ jsx13(ToastProvider, { children: /* @__PURE__ */ jsx13(EditorShell, { initialExperiment: experiment, embeddedMode: true }) }) })
|
|
4821
|
+
/* @__PURE__ */ jsx13("div", { className: editorClassName, children: /* @__PURE__ */ jsx13(ToastProvider, { children: /* @__PURE__ */ jsx13(EditorShell, { initialExperiment: experiment, embeddedMode: true, proxyBaseUrl }) }) })
|
|
4820
4822
|
] });
|
|
4821
4823
|
}
|
|
4822
4824
|
|