@accelerated-agency/visual-editor 0.3.3 → 0.3.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 CHANGED
@@ -4807,6 +4807,7 @@ function PlatformVisualEditorV2({
4807
4807
  // channel kept for API compatibility; VvvebJs uses its own internal channel
4808
4808
  embeddedGlobalKey = "__CONVERSION_EMBEDDED__",
4809
4809
  proxyBaseUrl = "",
4810
+ strictObserverFreeze = false,
4810
4811
  className = "fixed inset-0 z-[9999] flex flex-col bg-white",
4811
4812
  editorClassName = "flex-1 min-h-0",
4812
4813
  showHeader = true,
@@ -4867,9 +4868,10 @@ function PlatformVisualEditorV2({
4867
4868
  status: experiment?.status,
4868
4869
  pageUrl: experiment?.pageUrl,
4869
4870
  editorPassword: experiment?.editorPassword,
4871
+ strictObserverFreeze: !!strictObserverFreeze,
4870
4872
  variations: experiment?.variations ?? []
4871
4873
  }),
4872
- [experiment]
4874
+ [experiment, strictObserverFreeze]
4873
4875
  );
4874
4876
  console.log("loadPayload", loadPayload);
4875
4877
  const editorSrc = useMemo(() => {
package/dist/vite.cjs CHANGED
@@ -2066,7 +2066,8 @@ function handleLoadExperiment(data) {
2066
2066
  return;
2067
2067
  }
2068
2068
  var proxyUrl = '/api/conversion-proxy?password=' + encodeURIComponent(data.editorPassword || '') +
2069
- '&url=' + encodeURIComponent(pageUrl);
2069
+ '&url=' + encodeURIComponent(pageUrl) +
2070
+ '&strictObserverFreeze=' + encodeURIComponent(data && data.strictObserverFreeze ? '1' : '0');
2070
2071
 
2071
2072
  // Parent often re-posts load-experiment when React re-renders (new object identity) or
2072
2073
  // after mutations-changed. Reloading the iframe again wipes variant changesets mid-session.
@@ -4762,6 +4763,7 @@ var getDefaultAnthropicApiKey = () => {
4762
4763
  function createVisualEditorMiddleware(options) {
4763
4764
  const anthropicApiKey = options?.anthropicApiKey || getDefaultAnthropicApiKey();
4764
4765
  const enableGenerateTestApi = options?.enableGenerateTestApi ?? true;
4766
+ const strictObserverFreeze = options?.strictObserverFreeze === true;
4765
4767
  const allowedFrameOrigins = options?.allowedFrameOrigins ?? ["*"];
4766
4768
  function setFrameHeaders(req, res) {
4767
4769
  res.removeHeader("X-Frame-Options");
@@ -4929,6 +4931,8 @@ function createVisualEditorMiddleware(options) {
4929
4931
  const url = new URL(req.url || "", "http://localhost");
4930
4932
  const targetUrl = url.searchParams.get("url");
4931
4933
  const password = url.searchParams.get("password") || "";
4934
+ const strictFreezeParam = (url.searchParams.get("strictObserverFreeze") || "").toLowerCase();
4935
+ const strictObserverFreezeForRequest = strictFreezeParam === "1" || strictFreezeParam === "true" || strictFreezeParam === "yes" ? true : strictFreezeParam === "0" || strictFreezeParam === "false" || strictFreezeParam === "no" ? false : strictObserverFreeze;
4932
4936
  if (!targetUrl) {
4933
4937
  res.statusCode = 400;
4934
4938
  res.end(JSON.stringify({ error: "Missing url parameter" }));
@@ -5066,6 +5070,7 @@ ${iframeAlwaysShowCssGuardScript}
5066
5070
  var TARGET_ORIGIN=${JSON.stringify(origin)};
5067
5071
  var TARGET_PAGE_URL=${JSON.stringify(targetUrl)};
5068
5072
  var PROXY_PASSWORD=${JSON.stringify(password)};
5073
+ var STRICT_OBSERVER_FREEZE=${JSON.stringify(strictObserverFreezeForRequest)};
5069
5074
  window.__CONVERSION_EDITOR_ACTIVE__=true;
5070
5075
  function isSkippable(raw){if(!raw||typeof raw!=="string")return true;return raw.startsWith("data:")||raw.startsWith("blob:")||raw.startsWith("javascript:")||raw.startsWith("#");}
5071
5076
  function toAbsolute(raw){if(isSkippable(raw))return raw;try{var base=raw.startsWith("/")||raw.startsWith("//")?TARGET_ORIGIN:TARGET_PAGE_URL;return new URL(raw,base).toString();}catch(_){return raw;}}
@@ -5085,6 +5090,9 @@ try{
5085
5090
  var wrapped=function(list,obs){
5086
5091
  try{
5087
5092
  if(!window.__CONVERSION_EDITOR_ACTIVE__)return cb(list,obs);
5093
+ if(STRICT_OBSERVER_FREEZE){
5094
+ return;
5095
+ }
5088
5096
  var now=Date.now();
5089
5097
  if(now-last<120)return;
5090
5098
  last=now;
@@ -5094,6 +5102,11 @@ try{
5094
5102
  return new NativeMO(wrapped);
5095
5103
  };
5096
5104
  window.MutationObserver.prototype=NativeMO.prototype;
5105
+ try{
5106
+ if(STRICT_OBSERVER_FREEZE){
5107
+ console.info("[conversion-proxy] strict MutationObserver freeze active");
5108
+ }
5109
+ }catch(_){}
5097
5110
  }
5098
5111
  }catch(_){}
5099
5112
  }catch(_){}})();</script>`;
package/dist/vite.js CHANGED
@@ -2058,7 +2058,8 @@ function handleLoadExperiment(data) {
2058
2058
  return;
2059
2059
  }
2060
2060
  var proxyUrl = '/api/conversion-proxy?password=' + encodeURIComponent(data.editorPassword || '') +
2061
- '&url=' + encodeURIComponent(pageUrl);
2061
+ '&url=' + encodeURIComponent(pageUrl) +
2062
+ '&strictObserverFreeze=' + encodeURIComponent(data && data.strictObserverFreeze ? '1' : '0');
2062
2063
 
2063
2064
  // Parent often re-posts load-experiment when React re-renders (new object identity) or
2064
2065
  // after mutations-changed. Reloading the iframe again wipes variant changesets mid-session.
@@ -4754,6 +4755,7 @@ var getDefaultAnthropicApiKey = () => {
4754
4755
  function createVisualEditorMiddleware(options) {
4755
4756
  const anthropicApiKey = options?.anthropicApiKey || getDefaultAnthropicApiKey();
4756
4757
  const enableGenerateTestApi = options?.enableGenerateTestApi ?? true;
4758
+ const strictObserverFreeze = options?.strictObserverFreeze === true;
4757
4759
  const allowedFrameOrigins = options?.allowedFrameOrigins ?? ["*"];
4758
4760
  function setFrameHeaders(req, res) {
4759
4761
  res.removeHeader("X-Frame-Options");
@@ -4921,6 +4923,8 @@ function createVisualEditorMiddleware(options) {
4921
4923
  const url = new URL(req.url || "", "http://localhost");
4922
4924
  const targetUrl = url.searchParams.get("url");
4923
4925
  const password = url.searchParams.get("password") || "";
4926
+ const strictFreezeParam = (url.searchParams.get("strictObserverFreeze") || "").toLowerCase();
4927
+ const strictObserverFreezeForRequest = strictFreezeParam === "1" || strictFreezeParam === "true" || strictFreezeParam === "yes" ? true : strictFreezeParam === "0" || strictFreezeParam === "false" || strictFreezeParam === "no" ? false : strictObserverFreeze;
4924
4928
  if (!targetUrl) {
4925
4929
  res.statusCode = 400;
4926
4930
  res.end(JSON.stringify({ error: "Missing url parameter" }));
@@ -5058,6 +5062,7 @@ ${iframeAlwaysShowCssGuardScript}
5058
5062
  var TARGET_ORIGIN=${JSON.stringify(origin)};
5059
5063
  var TARGET_PAGE_URL=${JSON.stringify(targetUrl)};
5060
5064
  var PROXY_PASSWORD=${JSON.stringify(password)};
5065
+ var STRICT_OBSERVER_FREEZE=${JSON.stringify(strictObserverFreezeForRequest)};
5061
5066
  window.__CONVERSION_EDITOR_ACTIVE__=true;
5062
5067
  function isSkippable(raw){if(!raw||typeof raw!=="string")return true;return raw.startsWith("data:")||raw.startsWith("blob:")||raw.startsWith("javascript:")||raw.startsWith("#");}
5063
5068
  function toAbsolute(raw){if(isSkippable(raw))return raw;try{var base=raw.startsWith("/")||raw.startsWith("//")?TARGET_ORIGIN:TARGET_PAGE_URL;return new URL(raw,base).toString();}catch(_){return raw;}}
@@ -5077,6 +5082,9 @@ try{
5077
5082
  var wrapped=function(list,obs){
5078
5083
  try{
5079
5084
  if(!window.__CONVERSION_EDITOR_ACTIVE__)return cb(list,obs);
5085
+ if(STRICT_OBSERVER_FREEZE){
5086
+ return;
5087
+ }
5080
5088
  var now=Date.now();
5081
5089
  if(now-last<120)return;
5082
5090
  last=now;
@@ -5086,6 +5094,11 @@ try{
5086
5094
  return new NativeMO(wrapped);
5087
5095
  };
5088
5096
  window.MutationObserver.prototype=NativeMO.prototype;
5097
+ try{
5098
+ if(STRICT_OBSERVER_FREEZE){
5099
+ console.info("[conversion-proxy] strict MutationObserver freeze active");
5100
+ }
5101
+ }catch(_){}
5089
5102
  }
5090
5103
  }catch(_){}
5091
5104
  }catch(_){}})();</script>`;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@accelerated-agency/visual-editor",
3
- "version": "0.3.3",
3
+ "version": "0.3.4",
4
4
  "private": false,
5
5
  "description": "Conversion visual editor as a reusable React package",
6
6
  "type": "module",