@accelerated-agency/visual-editor 0.4.5 → 0.4.6

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/vite.cjs CHANGED
@@ -146,7 +146,9 @@ async function getScraperProxyClient() {
146
146
  })();
147
147
  return scraperProxyClientPromise;
148
148
  }
149
- var iframeAlwaysShowCss = `<style id="__ce_force_show">#CybotCookiebotDialog,#CybotCookiebotDialogBodyUnderlay,#onetrust-consent-sdk,#onetrust-banner-sdk,.cc-window,.cc-banner,.cc-overlay,#cookie-notice,#cookie-banner,#cookie-consent,.cookie-notice,.cookie-banner,.cookie-consent,.cookie-popup,.cookie-bar,.cookie-message,.cookie-alert,.gdpr-banner,.gdpr-consent,.gdpr-popup,.gdpr-overlay,#gdpr-consent,#gdpr-banner,.consent-banner,.consent-popup,.consent-overlay,#consent-banner,#consent-popup,[class*="cookie-consent"],[class*="cookie-banner"],[class*="cookie-notice"],[class*="CookieConsent"],[class*="CookieBanner"],[id*="cookie-consent"],[id*="cookie-banner"],[id*="cookie-notice"],[aria-label*="cookie" i],[aria-label*="consent" i],.klaro,.klaro .cookie-modal,#usercentrics-root,.trustarc-banner,#truste-consent-track,#hs-eu-cookie-confirmation,.osano-cm-window,.osano-cm-dialog,.evidon-banner,#_evidon_banner,.js-cookie-consent,.cookie-disclaimer,.shopify-section-cookies,#shopify-section-cookies,#shopify-pc__banner,#shopify-pc__modal,.privacy-banner,.privacy-popup,[data-testid="cookie-banner"],[data-testid="consent-banner"],.amgdprcookie-bar-container,[data-amcookie-js="bar"],.amgdprjs-bar-template,.amgdprcookie-modal-container,.amgdprcookie-modal-overlay,#cmplz-cookiebanner-container,.cmplz-cookiebanner,#iubenda-cs-banner,.iubenda-cs-container,#qc-cmp2-container,.qc-cmp2-consent-info,#didomi-host,.didomi-popup-container,.didomi-notice,#termly-code-snippet-support,[class*="termly"],[class*="gdprcookie"],[class*="amgdpr"],[id*="gdpr-cookie"],[class*="cookie-modal"],[id*="cookie-modal"],[class*="cookieConsent"],[id*="cookieConsent"]{display:revert!important;visibility:visible!important;opacity:1!important;pointer-events:auto!important;height:auto!important;max-height:none!important;overflow:visible!important;}</style>`;
149
+ var iframeAlwaysShowCss = `<style id="__ce_force_show">
150
+
151
+ </style>`;
150
152
  var iframeAlwaysShowCssGuardScript = `<script id="__ce_force_show_guard">(function(){try{
151
153
  function ensureForceShowStyleLast(){
152
154
  var style=document.getElementById("__ce_force_show");
@@ -505,7 +507,10 @@ box-shadow: 0 0 1px 0 rgba(0, 0, 0, 0.20), 0 1px 2px 0 rgba(0, 0, 0, 0.05), 0 1p
505
507
  .dt-ico{width:16px;flex-shrink:0;text-align:center;color:var(--text-3);font-size:12px}
506
508
  .dt-lbl{flex:1;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-family:ui-monospace,SFMono-Regular,monospace;font-size:10px}
507
509
  .dt-muted{padding:16px 12px;text-align:center;color:var(--text-3);font-size:11px;line-height:1.4}
508
-
510
+ #section-components-panel{
511
+ max-height: 50%;
512
+ overflow-y: auto;
513
+ }
509
514
  /* \u2500\u2500 Right panel \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 */
510
515
  #right-panel{
511
516
  width:252px;background:var(--bg);border-left:1px solid var(--border);
@@ -634,6 +639,17 @@ box-shadow: 0 0 1px 0 rgba(0, 0, 0, 0.20), 0 1px 2px 0 rgba(0, 0, 0, 0.05), 0 1p
634
639
  flex:1;padding:8px 2px;text-align:center;font-size:10px;color:var(--text-3);
635
640
  cursor:pointer;border-bottom:2px solid transparent;transition:all .15s;font-weight:600;line-height:1.15
636
641
  }
642
+ .lp-tab.close-section-components-panel{
643
+ padding: 4px 10px;
644
+ background: #000;
645
+ display: flex;
646
+ max-width: fit-content;
647
+ align-items: center;
648
+ justify-content: center;
649
+ border-radius: 2px;
650
+ margin: 2px;
651
+ color: #fff;
652
+ }
637
653
  .lp-tab:hover{color:var(--text-2)}
638
654
  .lp-tab.active{color:var(--accent-txt);border-bottom-color:var(--accent)}
639
655
  .future-hidden{display:none!important}
@@ -1142,6 +1158,7 @@ select.pr-inp{cursor:pointer;background:#fff}
1142
1158
  <div class="section-components-tabs">
1143
1159
  <div class="lp-tab" onclick="switchSectionComponentsTab('components')">Components</div>
1144
1160
  <div class="lp-tab" onclick="switchSectionComponentsTab('sections')">Sections</div>
1161
+ <div class="lp-tab close-section-components-panel" onclick="toggleSectionComponentsPanel()"> Close</div>
1145
1162
  </div>
1146
1163
  <div class="lp-body">
1147
1164
  <div id="tab-components" class="tab-pane"></div>
@@ -6173,6 +6190,10 @@ function createVisualEditorMiddleware(options) {
6173
6190
  };
6174
6191
  const upstreamFetch = async (input, init = {}) => {
6175
6192
  if (conversionProxyBaseUrlForRequest) {
6193
+ const method2 = String(init?.method || "GET").toUpperCase();
6194
+ if (method2 !== "GET" && method2 !== "HEAD") {
6195
+ return directFetch(input, init);
6196
+ }
6176
6197
  return workerRawFetch(input, init);
6177
6198
  }
6178
6199
  const primary = await scraperFetch(input, init);
@@ -6511,12 +6532,40 @@ var PROXY_BASE_URL=_proxyCtx?_proxyCtx.searchParams.get("conversionProxyBaseUrl"
6511
6532
  var PROXY_TRACKING_MARKERS=_proxyCtx?_proxyCtx.searchParams.get("trackingMarkers")||"":"";
6512
6533
  var PROXY_STRICT_FREEZE=_proxyCtx?_proxyCtx.searchParams.get("strictObserverFreeze")||"":"";
6513
6534
  var PROXY_UPSTREAM_MODE=_proxyCtx?_proxyCtx.searchParams.get("proxy")||"":"";
6535
+ var EDITOR_ORIGIN=(function(){try{return String(window.location.origin||"");}catch(_){return "";}})();
6536
+ var EDITOR_HOST_KEY=(function(){try{var u=new URL(EDITOR_ORIGIN);return (u.hostname||"").toLowerCase()+":"+(u.port||"");}catch(_){return "";}})();
6514
6537
  function isSkippable(raw){if(!raw||typeof raw!=="string")return true;return raw.startsWith("data:")||raw.startsWith("blob:")||raw.startsWith("javascript:")||raw.startsWith("#");}
6538
+ function isEditorHostUrl(u){
6539
+ try{
6540
+ if(!u) return false;
6541
+ var hostKey=(u.hostname||"").toLowerCase()+":"+(u.port||"");
6542
+ if(EDITOR_HOST_KEY&&hostKey===EDITOR_HOST_KEY) return true;
6543
+ // localhost aliases for same dev server port
6544
+ var host=(u.hostname||"").toLowerCase();
6545
+ var editorHost=EDITOR_HOST_KEY.split(":")[0]||"";
6546
+ var samePort=(u.port||"")===(EDITOR_HOST_KEY.split(":")[1]||"");
6547
+ var localAlias=(host==="localhost"||host==="127.0.0.1"||host==="[::1]");
6548
+ var editorLocalAlias=(editorHost==="localhost"||editorHost==="127.0.0.1"||editorHost==="[::1]");
6549
+ return samePort&&localAlias&&editorLocalAlias;
6550
+ }catch(_){
6551
+ return false;
6552
+ }
6553
+ }
6515
6554
  function toProxyNetworkUrl(raw){
6516
6555
  if(isSkippable(raw))return raw;
6517
6556
  try{
6518
6557
  var base=raw.startsWith("/")?TARGET_ORIGIN:TARGET_PAGE_URL;
6519
6558
  var abs=new URL(raw,base);
6559
+ // Some embedded scripts build absolute requests against editor origin
6560
+ // (e.g. https://localhost:4001/api/unstable/graphql.json). Remap those
6561
+ // paths to target origin first, then proxy as usual.
6562
+ if(EDITOR_ORIGIN&&isEditorHostUrl(abs)){
6563
+ var p=abs.pathname||"";
6564
+ var isRootProxyPath=p==="/api/conversion-proxy"||p.indexOf("/api/conversion-proxy/")===0;
6565
+ if(!isRootProxyPath){
6566
+ abs=new URL((abs.pathname||"/")+(abs.search||"")+(abs.hash||""),TARGET_ORIGIN);
6567
+ }
6568
+ }
6520
6569
  if(abs.origin!==TARGET_ORIGIN)return raw;
6521
6570
  var prox=new URL(PROXY_ROOT,window.location.origin);
6522
6571
  prox.searchParams.set("password",PROXY_PASSWORD||"");
package/dist/vite.js CHANGED
@@ -138,7 +138,9 @@ async function getScraperProxyClient() {
138
138
  })();
139
139
  return scraperProxyClientPromise;
140
140
  }
141
- var iframeAlwaysShowCss = `<style id="__ce_force_show">#CybotCookiebotDialog,#CybotCookiebotDialogBodyUnderlay,#onetrust-consent-sdk,#onetrust-banner-sdk,.cc-window,.cc-banner,.cc-overlay,#cookie-notice,#cookie-banner,#cookie-consent,.cookie-notice,.cookie-banner,.cookie-consent,.cookie-popup,.cookie-bar,.cookie-message,.cookie-alert,.gdpr-banner,.gdpr-consent,.gdpr-popup,.gdpr-overlay,#gdpr-consent,#gdpr-banner,.consent-banner,.consent-popup,.consent-overlay,#consent-banner,#consent-popup,[class*="cookie-consent"],[class*="cookie-banner"],[class*="cookie-notice"],[class*="CookieConsent"],[class*="CookieBanner"],[id*="cookie-consent"],[id*="cookie-banner"],[id*="cookie-notice"],[aria-label*="cookie" i],[aria-label*="consent" i],.klaro,.klaro .cookie-modal,#usercentrics-root,.trustarc-banner,#truste-consent-track,#hs-eu-cookie-confirmation,.osano-cm-window,.osano-cm-dialog,.evidon-banner,#_evidon_banner,.js-cookie-consent,.cookie-disclaimer,.shopify-section-cookies,#shopify-section-cookies,#shopify-pc__banner,#shopify-pc__modal,.privacy-banner,.privacy-popup,[data-testid="cookie-banner"],[data-testid="consent-banner"],.amgdprcookie-bar-container,[data-amcookie-js="bar"],.amgdprjs-bar-template,.amgdprcookie-modal-container,.amgdprcookie-modal-overlay,#cmplz-cookiebanner-container,.cmplz-cookiebanner,#iubenda-cs-banner,.iubenda-cs-container,#qc-cmp2-container,.qc-cmp2-consent-info,#didomi-host,.didomi-popup-container,.didomi-notice,#termly-code-snippet-support,[class*="termly"],[class*="gdprcookie"],[class*="amgdpr"],[id*="gdpr-cookie"],[class*="cookie-modal"],[id*="cookie-modal"],[class*="cookieConsent"],[id*="cookieConsent"]{display:revert!important;visibility:visible!important;opacity:1!important;pointer-events:auto!important;height:auto!important;max-height:none!important;overflow:visible!important;}</style>`;
141
+ var iframeAlwaysShowCss = `<style id="__ce_force_show">
142
+
143
+ </style>`;
142
144
  var iframeAlwaysShowCssGuardScript = `<script id="__ce_force_show_guard">(function(){try{
143
145
  function ensureForceShowStyleLast(){
144
146
  var style=document.getElementById("__ce_force_show");
@@ -497,7 +499,10 @@ box-shadow: 0 0 1px 0 rgba(0, 0, 0, 0.20), 0 1px 2px 0 rgba(0, 0, 0, 0.05), 0 1p
497
499
  .dt-ico{width:16px;flex-shrink:0;text-align:center;color:var(--text-3);font-size:12px}
498
500
  .dt-lbl{flex:1;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-family:ui-monospace,SFMono-Regular,monospace;font-size:10px}
499
501
  .dt-muted{padding:16px 12px;text-align:center;color:var(--text-3);font-size:11px;line-height:1.4}
500
-
502
+ #section-components-panel{
503
+ max-height: 50%;
504
+ overflow-y: auto;
505
+ }
501
506
  /* \u2500\u2500 Right panel \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 */
502
507
  #right-panel{
503
508
  width:252px;background:var(--bg);border-left:1px solid var(--border);
@@ -626,6 +631,17 @@ box-shadow: 0 0 1px 0 rgba(0, 0, 0, 0.20), 0 1px 2px 0 rgba(0, 0, 0, 0.05), 0 1p
626
631
  flex:1;padding:8px 2px;text-align:center;font-size:10px;color:var(--text-3);
627
632
  cursor:pointer;border-bottom:2px solid transparent;transition:all .15s;font-weight:600;line-height:1.15
628
633
  }
634
+ .lp-tab.close-section-components-panel{
635
+ padding: 4px 10px;
636
+ background: #000;
637
+ display: flex;
638
+ max-width: fit-content;
639
+ align-items: center;
640
+ justify-content: center;
641
+ border-radius: 2px;
642
+ margin: 2px;
643
+ color: #fff;
644
+ }
629
645
  .lp-tab:hover{color:var(--text-2)}
630
646
  .lp-tab.active{color:var(--accent-txt);border-bottom-color:var(--accent)}
631
647
  .future-hidden{display:none!important}
@@ -1134,6 +1150,7 @@ select.pr-inp{cursor:pointer;background:#fff}
1134
1150
  <div class="section-components-tabs">
1135
1151
  <div class="lp-tab" onclick="switchSectionComponentsTab('components')">Components</div>
1136
1152
  <div class="lp-tab" onclick="switchSectionComponentsTab('sections')">Sections</div>
1153
+ <div class="lp-tab close-section-components-panel" onclick="toggleSectionComponentsPanel()"> Close</div>
1137
1154
  </div>
1138
1155
  <div class="lp-body">
1139
1156
  <div id="tab-components" class="tab-pane"></div>
@@ -6165,6 +6182,10 @@ function createVisualEditorMiddleware(options) {
6165
6182
  };
6166
6183
  const upstreamFetch = async (input, init = {}) => {
6167
6184
  if (conversionProxyBaseUrlForRequest) {
6185
+ const method2 = String(init?.method || "GET").toUpperCase();
6186
+ if (method2 !== "GET" && method2 !== "HEAD") {
6187
+ return directFetch(input, init);
6188
+ }
6168
6189
  return workerRawFetch(input, init);
6169
6190
  }
6170
6191
  const primary = await scraperFetch(input, init);
@@ -6503,12 +6524,40 @@ var PROXY_BASE_URL=_proxyCtx?_proxyCtx.searchParams.get("conversionProxyBaseUrl"
6503
6524
  var PROXY_TRACKING_MARKERS=_proxyCtx?_proxyCtx.searchParams.get("trackingMarkers")||"":"";
6504
6525
  var PROXY_STRICT_FREEZE=_proxyCtx?_proxyCtx.searchParams.get("strictObserverFreeze")||"":"";
6505
6526
  var PROXY_UPSTREAM_MODE=_proxyCtx?_proxyCtx.searchParams.get("proxy")||"":"";
6527
+ var EDITOR_ORIGIN=(function(){try{return String(window.location.origin||"");}catch(_){return "";}})();
6528
+ var EDITOR_HOST_KEY=(function(){try{var u=new URL(EDITOR_ORIGIN);return (u.hostname||"").toLowerCase()+":"+(u.port||"");}catch(_){return "";}})();
6506
6529
  function isSkippable(raw){if(!raw||typeof raw!=="string")return true;return raw.startsWith("data:")||raw.startsWith("blob:")||raw.startsWith("javascript:")||raw.startsWith("#");}
6530
+ function isEditorHostUrl(u){
6531
+ try{
6532
+ if(!u) return false;
6533
+ var hostKey=(u.hostname||"").toLowerCase()+":"+(u.port||"");
6534
+ if(EDITOR_HOST_KEY&&hostKey===EDITOR_HOST_KEY) return true;
6535
+ // localhost aliases for same dev server port
6536
+ var host=(u.hostname||"").toLowerCase();
6537
+ var editorHost=EDITOR_HOST_KEY.split(":")[0]||"";
6538
+ var samePort=(u.port||"")===(EDITOR_HOST_KEY.split(":")[1]||"");
6539
+ var localAlias=(host==="localhost"||host==="127.0.0.1"||host==="[::1]");
6540
+ var editorLocalAlias=(editorHost==="localhost"||editorHost==="127.0.0.1"||editorHost==="[::1]");
6541
+ return samePort&&localAlias&&editorLocalAlias;
6542
+ }catch(_){
6543
+ return false;
6544
+ }
6545
+ }
6507
6546
  function toProxyNetworkUrl(raw){
6508
6547
  if(isSkippable(raw))return raw;
6509
6548
  try{
6510
6549
  var base=raw.startsWith("/")?TARGET_ORIGIN:TARGET_PAGE_URL;
6511
6550
  var abs=new URL(raw,base);
6551
+ // Some embedded scripts build absolute requests against editor origin
6552
+ // (e.g. https://localhost:4001/api/unstable/graphql.json). Remap those
6553
+ // paths to target origin first, then proxy as usual.
6554
+ if(EDITOR_ORIGIN&&isEditorHostUrl(abs)){
6555
+ var p=abs.pathname||"";
6556
+ var isRootProxyPath=p==="/api/conversion-proxy"||p.indexOf("/api/conversion-proxy/")===0;
6557
+ if(!isRootProxyPath){
6558
+ abs=new URL((abs.pathname||"/")+(abs.search||"")+(abs.hash||""),TARGET_ORIGIN);
6559
+ }
6560
+ }
6512
6561
  if(abs.origin!==TARGET_ORIGIN)return raw;
6513
6562
  var prox=new URL(PROXY_ROOT,window.location.origin);
6514
6563
  prox.searchParams.set("password",PROXY_PASSWORD||"");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@accelerated-agency/visual-editor",
3
- "version": "0.4.5",
3
+ "version": "0.4.6",
4
4
  "private": false,
5
5
  "description": "Conversion visual editor as a reusable React package",
6
6
  "type": "module",