@ohhwells/bridge 0.1.52-next.139 → 0.1.52-next.140

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
@@ -9192,6 +9192,27 @@ function readLogoIdentityFromDom() {
9192
9192
  const href = (logoRoot instanceof HTMLAnchorElement ? logoRoot.getAttribute("href") : null) || logoRoot?.closest("a")?.getAttribute("href") || "/";
9193
9193
  return { text, isPlaceholder, imageUrl: null, href, alt: text };
9194
9194
  }
9195
+ function applyLogoFromContent(content) {
9196
+ const hasLogoIdentity = LOGO_PLACEHOLDER_KEY in content || LOGO_TEXT_KEYS.some((key) => key in content) || LOGO_IMAGE_KEYS.some((key) => key in content) || LOGO_ALT_KEY in content || LOGO_HREF_KEYS.some((key) => key in content);
9197
+ if (!hasLogoIdentity) return false;
9198
+ const logoText = content[LOGO_TEXT_KEYS[0]] ?? content[LOGO_TEXT_KEYS[1]] ?? readLogoIdentityFromDom().text;
9199
+ const logoAlt = content[LOGO_ALT_KEY] ?? logoText;
9200
+ const rawLogoImage = content[LOGO_IMAGE_URL_KEY] ?? content["footer-logo"] ?? content["footer-logo-image"] ?? null;
9201
+ const logoImageUrl = typeof rawLogoImage === "string" && rawLogoImage.trim() ? rawLogoImage.trim() : null;
9202
+ const imageExplicitlyCleared = LOGO_IMAGE_KEYS.some((key) => key in content) && !logoImageUrl;
9203
+ const logoIsPlaceholder = LOGO_PLACEHOLDER_KEY in content ? content[LOGO_PLACEHOLDER_KEY] !== "false" : !logoImageUrl && (!logoText.trim() || logoText === PLACEHOLDER_BUSINESS_NAME);
9204
+ if (logoImageUrl) {
9205
+ applyLogoImage(logoImageUrl, logoAlt);
9206
+ } else {
9207
+ if (imageExplicitlyCleared) applyLogoImage(null, logoAlt);
9208
+ applyLogoIdentity(logoText, logoIsPlaceholder);
9209
+ }
9210
+ const logoHref = content["nav-logo-href"] ?? content["footer-logo-href"] ?? content["logo-href"];
9211
+ if (typeof logoHref === "string" && logoHref.trim()) {
9212
+ applyLogoHref(logoHref);
9213
+ }
9214
+ return true;
9215
+ }
9195
9216
 
9196
9217
  // src/lib/site-wide-scope.ts
9197
9218
  function getLogoElement(el) {
@@ -12681,6 +12702,8 @@ function OhhwellsBridge() {
12681
12702
  const imageLoads = [];
12682
12703
  for (const [key, val] of Object.entries(content)) {
12683
12704
  if (key === "__ohw_sections") continue;
12705
+ if (key === LOGO_PLACEHOLDER_KEY) continue;
12706
+ if (LOGO_IMAGE_KEYS.includes(key)) continue;
12684
12707
  if (applyVideoSettingNode(key, val)) continue;
12685
12708
  if (applyCarouselNode(key, val)) continue;
12686
12709
  document.querySelectorAll(`[data-ohw-key="${key}"]`).forEach((el) => {
@@ -12713,6 +12736,7 @@ function OhhwellsBridge() {
12713
12736
  });
12714
12737
  applyLinkByKey(key, val);
12715
12738
  }
12739
+ applyLogoFromContent(content);
12716
12740
  reconcileNavbarItemsFromContent(content);
12717
12741
  reconcileFooterOrderFromContent(content);
12718
12742
  enforceLinkHrefs();
@@ -12755,6 +12779,8 @@ function OhhwellsBridge() {
12755
12779
  try {
12756
12780
  for (const [key, val] of Object.entries(content)) {
12757
12781
  if (key === "__ohw_sections") continue;
12782
+ if (key === LOGO_PLACEHOLDER_KEY) continue;
12783
+ if (LOGO_IMAGE_KEYS.includes(key)) continue;
12758
12784
  if (applyVideoSettingNode(key, val)) continue;
12759
12785
  if (applyCarouselNode(key, val)) continue;
12760
12786
  document.querySelectorAll(`[data-ohw-key="${key}"]`).forEach((el) => {
@@ -12775,6 +12801,7 @@ function OhhwellsBridge() {
12775
12801
  });
12776
12802
  applyLinkByKey(key, val);
12777
12803
  }
12804
+ applyLogoFromContent(content);
12778
12805
  reconcileNavbarItemsFromContent(content);
12779
12806
  reconcileFooterOrderFromContent(content);
12780
12807
  } finally {
@@ -14193,28 +14220,7 @@ function OhhwellsBridge() {
14193
14220
  });
14194
14221
  applyLinkByKey(key, val);
14195
14222
  }
14196
- const hasLogoIdentity = LOGO_PLACEHOLDER_KEY in content || LOGO_TEXT_KEYS.some((key) => key in content) || LOGO_IMAGE_KEYS.some((key) => key in content) || LOGO_ALT_KEY in content || LOGO_HREF_KEYS.some((key) => key in content);
14197
- if (hasLogoIdentity) {
14198
- const logoText = content[LOGO_TEXT_KEYS[0]] ?? content[LOGO_TEXT_KEYS[1]] ?? readLogoIdentityFromDom().text;
14199
- const logoAlt = content[LOGO_ALT_KEY] ?? logoText;
14200
- const rawLogoImage = content[LOGO_IMAGE_URL_KEY] ?? content["footer-logo"] ?? content["footer-logo-image"] ?? null;
14201
- const logoImageUrl = typeof rawLogoImage === "string" && rawLogoImage.trim() ? rawLogoImage.trim() : null;
14202
- const imageExplicitlyCleared = LOGO_IMAGE_KEYS.some((key) => key in content) && !logoImageUrl;
14203
- const logoIsPlaceholder = LOGO_PLACEHOLDER_KEY in content ? content[LOGO_PLACEHOLDER_KEY] !== "false" : !logoImageUrl && (!logoText.trim() || logoText === PLACEHOLDER_BUSINESS_NAME);
14204
- if (logoImageUrl) {
14205
- applyLogoImage(logoImageUrl, logoAlt);
14206
- } else {
14207
- if (imageExplicitlyCleared) applyLogoImage(null, logoAlt);
14208
- applyLogoIdentity(logoText, logoIsPlaceholder);
14209
- }
14210
- const logoHref = content["nav-logo-href"] ?? content["footer-logo-href"] ?? content["logo-href"];
14211
- if (typeof logoHref === "string" && logoHref.trim()) {
14212
- applyLogoHref(logoHref);
14213
- applyLinkByKey("nav-logo-href", logoHref);
14214
- applyLinkByKey("footer-logo-href", logoHref);
14215
- applyLinkByKey("logo-href", logoHref);
14216
- }
14217
- }
14223
+ applyLogoFromContent(content);
14218
14224
  if (sectionsJson) {
14219
14225
  initSectionsFromContent({ __ohw_sections: sectionsJson }, true);
14220
14226
  sectionsLoadedRef.current = true;