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