@accelerated-agency/visual-editor 0.5.6 → 0.5.7
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 +3 -1
- package/dist/vite.cjs +12 -1
- package/dist/vite.js +12 -2
- package/package.json +3 -2
package/dist/index.js
CHANGED
|
@@ -4879,9 +4879,11 @@ function PlatformVisualEditorV2({
|
|
|
4879
4879
|
[conversionProxyBaseUrl, experiment, strictObserverFreeze, trackingMarkers]
|
|
4880
4880
|
);
|
|
4881
4881
|
const editorSrc = useMemo(() => {
|
|
4882
|
+
const workerBase = normalizeProxyBaseUrl(conversionProxyBaseUrl);
|
|
4883
|
+
if (workerBase) return `${workerBase}/vvveb-editor`;
|
|
4882
4884
|
const safeBaseUrl = normalizeProxyBaseUrl(proxyBaseUrl);
|
|
4883
4885
|
return safeBaseUrl ? `${safeBaseUrl}/vvveb-editor` : "/vvveb-editor";
|
|
4884
|
-
}, [proxyBaseUrl]);
|
|
4886
|
+
}, [conversionProxyBaseUrl, proxyBaseUrl]);
|
|
4885
4887
|
useEffect(() => {
|
|
4886
4888
|
if (!editorReady) return;
|
|
4887
4889
|
const key = JSON.stringify(loadPayload);
|
package/dist/vite.cjs
CHANGED
|
@@ -3890,13 +3890,23 @@ function handleLoadExperiment(data) {
|
|
|
3890
3890
|
? data.conversionProxyBaseUrl
|
|
3891
3891
|
: '').trim().replace(/\\/+$/, '');
|
|
3892
3892
|
var proxyPath = '/api/conversion-proxy';
|
|
3893
|
-
|
|
3893
|
+
// Page iframe must stay same-origin as /vvveb-editor for DOM selection/editing.
|
|
3894
|
+
// When the shell is served from the worker (conversionProxyBaseUrl origin),
|
|
3895
|
+
// use same-origin relative proxy only. Otherwise delegate upstream via query param.
|
|
3896
|
+
var shellOrigin = '';
|
|
3897
|
+
try { shellOrigin = window.location.origin || ''; } catch(_) {}
|
|
3898
|
+
var onWorkerOrigin = !!(conversionProxyBaseUrl && shellOrigin === conversionProxyBaseUrl);
|
|
3899
|
+
var proxyRoot = proxyPath;
|
|
3894
3900
|
var trackingMarkersParam = extraTrackingMarkers.length
|
|
3895
3901
|
? '&trackingMarkers=' + encodeURIComponent(JSON.stringify(extraTrackingMarkers))
|
|
3896
3902
|
: '';
|
|
3903
|
+
var conversionProxyBaseUrlParam = (!onWorkerOrigin && conversionProxyBaseUrl)
|
|
3904
|
+
? '&conversionProxyBaseUrl=' + encodeURIComponent(conversionProxyBaseUrl)
|
|
3905
|
+
: '';
|
|
3897
3906
|
var proxyUrl = proxyRoot + '?password=' + encodeURIComponent(data.editorPassword || '') +
|
|
3898
3907
|
'&url=' + encodeURIComponent(pageUrl) +
|
|
3899
3908
|
'&strictObserverFreeze=' + encodeURIComponent(data && data.strictObserverFreeze ? '1' : '0') +
|
|
3909
|
+
conversionProxyBaseUrlParam +
|
|
3900
3910
|
trackingMarkersParam;
|
|
3901
3911
|
|
|
3902
3912
|
// Parent often re-posts load-experiment when React re-renders (new object identity) or
|
|
@@ -8762,5 +8772,6 @@ function visualEditorProxyPlugin(options) {
|
|
|
8762
8772
|
};
|
|
8763
8773
|
}
|
|
8764
8774
|
|
|
8775
|
+
exports.buildVvvebEditorHtml = buildVvvebEditorHtml;
|
|
8765
8776
|
exports.createVisualEditorMiddleware = createVisualEditorMiddleware;
|
|
8766
8777
|
exports.visualEditorProxyPlugin = visualEditorProxyPlugin;
|
package/dist/vite.js
CHANGED
|
@@ -3882,13 +3882,23 @@ function handleLoadExperiment(data) {
|
|
|
3882
3882
|
? data.conversionProxyBaseUrl
|
|
3883
3883
|
: '').trim().replace(/\\/+$/, '');
|
|
3884
3884
|
var proxyPath = '/api/conversion-proxy';
|
|
3885
|
-
|
|
3885
|
+
// Page iframe must stay same-origin as /vvveb-editor for DOM selection/editing.
|
|
3886
|
+
// When the shell is served from the worker (conversionProxyBaseUrl origin),
|
|
3887
|
+
// use same-origin relative proxy only. Otherwise delegate upstream via query param.
|
|
3888
|
+
var shellOrigin = '';
|
|
3889
|
+
try { shellOrigin = window.location.origin || ''; } catch(_) {}
|
|
3890
|
+
var onWorkerOrigin = !!(conversionProxyBaseUrl && shellOrigin === conversionProxyBaseUrl);
|
|
3891
|
+
var proxyRoot = proxyPath;
|
|
3886
3892
|
var trackingMarkersParam = extraTrackingMarkers.length
|
|
3887
3893
|
? '&trackingMarkers=' + encodeURIComponent(JSON.stringify(extraTrackingMarkers))
|
|
3888
3894
|
: '';
|
|
3895
|
+
var conversionProxyBaseUrlParam = (!onWorkerOrigin && conversionProxyBaseUrl)
|
|
3896
|
+
? '&conversionProxyBaseUrl=' + encodeURIComponent(conversionProxyBaseUrl)
|
|
3897
|
+
: '';
|
|
3889
3898
|
var proxyUrl = proxyRoot + '?password=' + encodeURIComponent(data.editorPassword || '') +
|
|
3890
3899
|
'&url=' + encodeURIComponent(pageUrl) +
|
|
3891
3900
|
'&strictObserverFreeze=' + encodeURIComponent(data && data.strictObserverFreeze ? '1' : '0') +
|
|
3901
|
+
conversionProxyBaseUrlParam +
|
|
3892
3902
|
trackingMarkersParam;
|
|
3893
3903
|
|
|
3894
3904
|
// Parent often re-posts load-experiment when React re-renders (new object identity) or
|
|
@@ -8754,4 +8764,4 @@ function visualEditorProxyPlugin(options) {
|
|
|
8754
8764
|
};
|
|
8755
8765
|
}
|
|
8756
8766
|
|
|
8757
|
-
export { createVisualEditorMiddleware, visualEditorProxyPlugin };
|
|
8767
|
+
export { buildVvvebEditorHtml, createVisualEditorMiddleware, visualEditorProxyPlugin };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@accelerated-agency/visual-editor",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.7",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Conversion visual editor as a reusable React package",
|
|
6
6
|
"type": "module",
|
|
@@ -30,10 +30,11 @@
|
|
|
30
30
|
"dev": "tsup --watch",
|
|
31
31
|
"clean": "rm -rf dist",
|
|
32
32
|
"build": "tsup",
|
|
33
|
+
"bundle:worker-assets": "tsx scripts/bundle-worker-assets.ts",
|
|
33
34
|
"generate:cro-previews": "PLAYWRIGHT_BROWSERS_PATH=./.playwright-browsers tsx scripts/generate-cro-section-previews.ts",
|
|
34
35
|
"local:build": "tsup && yarn --cwd ../codebase-server clean && yarn --cwd ../codebase-server dev",
|
|
35
36
|
"watch": "tsup --watch",
|
|
36
|
-
"deploy:worker": "wrangler deploy"
|
|
37
|
+
"deploy:worker": "npm run bundle:worker-assets && wrangler deploy"
|
|
37
38
|
},
|
|
38
39
|
"peerDependencies": {
|
|
39
40
|
"react": ">=18",
|