@ohhwells/bridge 0.1.93 → 0.1.94

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.cjs CHANGED
@@ -2261,6 +2261,22 @@ function applyAiSectionsToDom(state, options) {
2261
2261
  syncRemovedSections(state);
2262
2262
  syncTemplateHidden(state, pageSections.length > 0);
2263
2263
  }
2264
+ function unmountAllAiSections() {
2265
+ for (const [, section] of mounted) {
2266
+ section.root.unmount();
2267
+ section.container.remove();
2268
+ }
2269
+ mounted.clear();
2270
+ if (typeof document === "undefined") return;
2271
+ for (const el of document.querySelectorAll(`[${REPLACED_ATTR}]`)) {
2272
+ el.style.removeProperty("display");
2273
+ el.removeAttribute(REPLACED_ATTR);
2274
+ }
2275
+ for (const el of document.querySelectorAll(`[${REMOVED_ATTR}]`)) {
2276
+ el.style.removeProperty("display");
2277
+ el.removeAttribute(REMOVED_ATTR);
2278
+ }
2279
+ }
2264
2280
 
2265
2281
  // src/useLinkHrefGuardian.ts
2266
2282
  var import_react2 = require("react");
@@ -18427,6 +18443,22 @@ function OhhwellsBridge() {
18427
18443
  (0, import_react17.useEffect)(() => {
18428
18444
  postToParent2({ type: "ow:navigation", path: pathname });
18429
18445
  }, [pathname, postToParent2]);
18446
+ (0, import_react17.useEffect)(() => {
18447
+ if (!subdomain || isEditMode) return;
18448
+ const content = contentCache.get(subdomain);
18449
+ if (!content) return;
18450
+ unmountAllAiSections();
18451
+ initSectionsFromContent(
18452
+ content,
18453
+ /*removeExisting*/
18454
+ true,
18455
+ pathname
18456
+ );
18457
+ if (typeof content[AI_SECTIONS_KEY] === "string") {
18458
+ setAiSectionOrder(content[SECTION_ORDER_KEY], pathname);
18459
+ applyAiSectionsToDom(parseAiSectionsState(content[AI_SECTIONS_KEY]));
18460
+ }
18461
+ }, [pathname, subdomain, isEditMode]);
18430
18462
  (0, import_react17.useEffect)(() => {
18431
18463
  if (!isEditMode) return;
18432
18464
  if (linkPopoverSessionRef.current?.intent === "add-nav") return;
@@ -21508,7 +21540,7 @@ function OhhwellsBridge() {
21508
21540
  postToParent2({
21509
21541
  type: "ow:ready",
21510
21542
  version: "1",
21511
- bridgeVersion: "0.1.92",
21543
+ bridgeVersion: "0.1.93",
21512
21544
  path: pathname,
21513
21545
  nodes: collectEditableNodes(editContentRef.current),
21514
21546
  sections