@ohhwells/bridge 0.1.166 → 0.1.167
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 +641 -528
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +9 -1
- package/dist/index.d.ts +9 -1
- package/dist/index.js +233 -122
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
3
|
// src/OhhwellsBridge.tsx
|
|
4
|
-
import React12, { useCallback as useCallback12, useEffect as
|
|
4
|
+
import React12, { useCallback as useCallback12, useEffect as useEffect21, useLayoutEffect as useLayoutEffect6, useRef as useRef14, useState as useState18 } from "react";
|
|
5
5
|
import { createRoot as createRoot3 } from "react-dom/client";
|
|
6
6
|
import { flushSync as flushSync3 } from "react-dom";
|
|
7
7
|
|
|
@@ -12150,8 +12150,116 @@ function useHashLinkScroll(isEditMode) {
|
|
|
12150
12150
|
}, [isEditMode]);
|
|
12151
12151
|
}
|
|
12152
12152
|
|
|
12153
|
+
// src/usePublishedPlaceholderStrip.ts
|
|
12154
|
+
import { useEffect as useEffect5 } from "react";
|
|
12155
|
+
|
|
12156
|
+
// src/lib/strip-placeholders.ts
|
|
12157
|
+
var PLACEHOLDER_RE = /\[[A-Za-z][A-Za-z0-9 _/&#'.-]{0,30}\]-?/g;
|
|
12158
|
+
var HAS_PLACEHOLDER_RE = /\[[A-Za-z][A-Za-z0-9 _/&#'.-]{0,30}\]/;
|
|
12159
|
+
var SKIPPED_TAGS = /* @__PURE__ */ new Set(["SCRIPT", "STYLE", "NOSCRIPT", "TEXTAREA", "CODE", "PRE"]);
|
|
12160
|
+
var TEXT_ATTRS = ["alt", "title", "aria-label", "placeholder"];
|
|
12161
|
+
var HIDDEN_ATTR2 = "data-ohw-placeholder-hidden";
|
|
12162
|
+
function hasPlaceholder(text) {
|
|
12163
|
+
return HAS_PLACEHOLDER_RE.test(text);
|
|
12164
|
+
}
|
|
12165
|
+
function stripPlaceholderText(text) {
|
|
12166
|
+
if (!hasPlaceholder(text)) return text;
|
|
12167
|
+
const lead = text.match(/^\s*/)?.[0] ?? "";
|
|
12168
|
+
const trail = lead.length === text.length ? "" : text.match(/\s*$/)?.[0] ?? "";
|
|
12169
|
+
const body = text.slice(lead.length, text.length - trail.length).replace(PLACEHOLDER_RE, "").replace(/\(\s*\)|\[\s*\]/g, "").replace(/[ \t]{2,}/g, " ").replace(/[ \t]+([.,;:!?])/g, "$1").trim();
|
|
12170
|
+
return body ? `${lead}${body}${trail}` : lead || trail ? " " : "";
|
|
12171
|
+
}
|
|
12172
|
+
function skipped(el) {
|
|
12173
|
+
for (let node = el; node; node = node.parentElement) {
|
|
12174
|
+
if (SKIPPED_TAGS.has(node.tagName)) return true;
|
|
12175
|
+
}
|
|
12176
|
+
return false;
|
|
12177
|
+
}
|
|
12178
|
+
function hideIfEmptied(el) {
|
|
12179
|
+
const control = el?.closest("a, button");
|
|
12180
|
+
if (!control || control.hasAttribute(HIDDEN_ATTR2)) return;
|
|
12181
|
+
if ((control.textContent ?? "").trim()) return;
|
|
12182
|
+
if (control.querySelector("img, svg, picture, video")) return;
|
|
12183
|
+
control.setAttribute(HIDDEN_ATTR2, "");
|
|
12184
|
+
control.style.display = "none";
|
|
12185
|
+
}
|
|
12186
|
+
function stripElementAttrs(el) {
|
|
12187
|
+
let changed = false;
|
|
12188
|
+
const href = el.getAttribute("href");
|
|
12189
|
+
if (href && hasPlaceholder(decodeSafely(href))) {
|
|
12190
|
+
el.removeAttribute("href");
|
|
12191
|
+
changed = true;
|
|
12192
|
+
}
|
|
12193
|
+
for (const name of TEXT_ATTRS) {
|
|
12194
|
+
const value = el.getAttribute(name);
|
|
12195
|
+
if (value && hasPlaceholder(value)) {
|
|
12196
|
+
el.setAttribute(name, stripPlaceholderText(value).trim());
|
|
12197
|
+
changed = true;
|
|
12198
|
+
}
|
|
12199
|
+
}
|
|
12200
|
+
return changed;
|
|
12201
|
+
}
|
|
12202
|
+
function decodeSafely(value) {
|
|
12203
|
+
try {
|
|
12204
|
+
return decodeURIComponent(value);
|
|
12205
|
+
} catch {
|
|
12206
|
+
return value;
|
|
12207
|
+
}
|
|
12208
|
+
}
|
|
12209
|
+
function stripPlaceholders(root) {
|
|
12210
|
+
const doc = root.ownerDocument ?? root;
|
|
12211
|
+
let changed = 0;
|
|
12212
|
+
if (root.nodeType === 3) {
|
|
12213
|
+
return stripTextNode(root) ? 1 : 0;
|
|
12214
|
+
}
|
|
12215
|
+
if (root.nodeType !== 1 && root.nodeType !== 9) return 0;
|
|
12216
|
+
const rootEl = root.nodeType === 1 ? root : root.documentElement;
|
|
12217
|
+
if (!rootEl || skipped(rootEl)) return 0;
|
|
12218
|
+
for (const el of [rootEl, ...Array.from(rootEl.querySelectorAll("[href], [alt], [title], [aria-label], [placeholder]"))]) {
|
|
12219
|
+
if (!skipped(el) && stripElementAttrs(el)) changed++;
|
|
12220
|
+
}
|
|
12221
|
+
const walker = doc.createTreeWalker(rootEl, 4);
|
|
12222
|
+
const texts = [];
|
|
12223
|
+
for (let node = walker.nextNode(); node; node = walker.nextNode()) {
|
|
12224
|
+
if (node.nodeValue && node.nodeValue.includes("[")) texts.push(node);
|
|
12225
|
+
}
|
|
12226
|
+
for (const node of texts) {
|
|
12227
|
+
if (stripTextNode(node)) changed++;
|
|
12228
|
+
}
|
|
12229
|
+
return changed;
|
|
12230
|
+
}
|
|
12231
|
+
function stripTextNode(node) {
|
|
12232
|
+
const value = node.nodeValue ?? "";
|
|
12233
|
+
if (!value.includes("[") || !hasPlaceholder(value) || skipped(node.parentElement)) return false;
|
|
12234
|
+
node.nodeValue = stripPlaceholderText(value);
|
|
12235
|
+
hideIfEmptied(node.parentElement);
|
|
12236
|
+
return true;
|
|
12237
|
+
}
|
|
12238
|
+
|
|
12239
|
+
// src/usePublishedPlaceholderStrip.ts
|
|
12240
|
+
function usePublishedPlaceholderStrip(isEditMode) {
|
|
12241
|
+
useEffect5(() => {
|
|
12242
|
+
if (isEditMode) return;
|
|
12243
|
+
stripPlaceholders(document.body);
|
|
12244
|
+
const observer = new MutationObserver((records) => {
|
|
12245
|
+
for (const record of records) {
|
|
12246
|
+
if (record.type === "childList") record.addedNodes.forEach((node) => stripPlaceholders(node));
|
|
12247
|
+
else stripPlaceholders(record.target);
|
|
12248
|
+
}
|
|
12249
|
+
});
|
|
12250
|
+
observer.observe(document.body, {
|
|
12251
|
+
childList: true,
|
|
12252
|
+
subtree: true,
|
|
12253
|
+
characterData: true,
|
|
12254
|
+
attributes: true,
|
|
12255
|
+
attributeFilter: ["href", "alt", "title", "aria-label", "placeholder"]
|
|
12256
|
+
});
|
|
12257
|
+
return () => observer.disconnect();
|
|
12258
|
+
}, [isEditMode]);
|
|
12259
|
+
}
|
|
12260
|
+
|
|
12153
12261
|
// src/ui/SchedulingWidget.tsx
|
|
12154
|
-
import { useCallback, useEffect as
|
|
12262
|
+
import { useCallback, useEffect as useEffect6, useId, useMemo, useRef, useState as useState3 } from "react";
|
|
12155
12263
|
|
|
12156
12264
|
// src/ui/EmailCaptureModal.tsx
|
|
12157
12265
|
import { useState as useState2 } from "react";
|
|
@@ -12469,7 +12577,7 @@ function ScheduleView({ schedule, dates, selectedIdx, onSelectDate, onOpenModal
|
|
|
12469
12577
|
setCanScrollLeft(el.scrollLeft > 0);
|
|
12470
12578
|
setCanScrollRight(el.scrollLeft + el.clientWidth < el.scrollWidth - 1);
|
|
12471
12579
|
};
|
|
12472
|
-
|
|
12580
|
+
useEffect6(() => {
|
|
12473
12581
|
const el = scrollRef.current;
|
|
12474
12582
|
if (!el) return;
|
|
12475
12583
|
updateScrollState();
|
|
@@ -12727,7 +12835,7 @@ function SchedulingWidget({ notifyOnConnect = false, initialScheduleId, insertAf
|
|
|
12727
12835
|
});
|
|
12728
12836
|
}, []);
|
|
12729
12837
|
const [selectedIdx, setSelectedIdx] = useState3(0);
|
|
12730
|
-
|
|
12838
|
+
useEffect6(() => {
|
|
12731
12839
|
if (!schedule?.classes) return;
|
|
12732
12840
|
for (let i = 0; i < dates.length; i++) {
|
|
12733
12841
|
if (schedule.classes.some((c) => classRunsOnDate(c, dates[i], schedule.type))) {
|
|
@@ -12736,7 +12844,7 @@ function SchedulingWidget({ notifyOnConnect = false, initialScheduleId, insertAf
|
|
|
12736
12844
|
}
|
|
12737
12845
|
}
|
|
12738
12846
|
}, [schedule, dates]);
|
|
12739
|
-
|
|
12847
|
+
useEffect6(() => {
|
|
12740
12848
|
if (typeof window === "undefined") return;
|
|
12741
12849
|
const onVisible = () => {
|
|
12742
12850
|
if (!document.hidden) void refetchLiveSchedule();
|
|
@@ -12748,7 +12856,7 @@ function SchedulingWidget({ notifyOnConnect = false, initialScheduleId, insertAf
|
|
|
12748
12856
|
document.removeEventListener("visibilitychange", onVisible);
|
|
12749
12857
|
};
|
|
12750
12858
|
}, [refetchLiveSchedule]);
|
|
12751
|
-
|
|
12859
|
+
useEffect6(() => {
|
|
12752
12860
|
if (typeof window === "undefined") return;
|
|
12753
12861
|
const isInEditor = window.self !== window.top;
|
|
12754
12862
|
setInEditor(isInEditor);
|
|
@@ -17285,7 +17393,7 @@ function clearSubmitError(form) {
|
|
|
17285
17393
|
if (note) note.style.display = "none";
|
|
17286
17394
|
}
|
|
17287
17395
|
var SUCCESS_TEXT_ATTR = "data-ohw-form-success-text";
|
|
17288
|
-
var
|
|
17396
|
+
var HIDDEN_ATTR3 = "data-ohw-form-hidden";
|
|
17289
17397
|
var DEFAULT_SUCCESS_TEXT = "Thanks! We'll be in touch.";
|
|
17290
17398
|
function formSuccessKey(formKey) {
|
|
17291
17399
|
return `${formKey}-success`;
|
|
@@ -17311,13 +17419,13 @@ function setFormViewState(form, formKey, state, initialText) {
|
|
|
17311
17419
|
Array.from(form.children).forEach((child) => {
|
|
17312
17420
|
if (!(child instanceof HTMLElement) || child === success) return;
|
|
17313
17421
|
if (state === "success") {
|
|
17314
|
-
if (!child.hasAttribute(
|
|
17315
|
-
child.setAttribute(
|
|
17422
|
+
if (!child.hasAttribute(HIDDEN_ATTR3)) {
|
|
17423
|
+
child.setAttribute(HIDDEN_ATTR3, child.style.display);
|
|
17316
17424
|
child.style.display = "none";
|
|
17317
17425
|
}
|
|
17318
|
-
} else if (child.hasAttribute(
|
|
17319
|
-
child.style.display = child.getAttribute(
|
|
17320
|
-
child.removeAttribute(
|
|
17426
|
+
} else if (child.hasAttribute(HIDDEN_ATTR3)) {
|
|
17427
|
+
child.style.display = child.getAttribute(HIDDEN_ATTR3) ?? "";
|
|
17428
|
+
child.removeAttribute(HIDDEN_ATTR3);
|
|
17321
17429
|
}
|
|
17322
17430
|
});
|
|
17323
17431
|
success.style.display = state === "success" ? "" : "none";
|
|
@@ -17382,7 +17490,7 @@ function apiBase() {
|
|
|
17382
17490
|
function bridgeVersion() {
|
|
17383
17491
|
try {
|
|
17384
17492
|
if (true) {
|
|
17385
|
-
return "0.1.
|
|
17493
|
+
return "0.1.167";
|
|
17386
17494
|
}
|
|
17387
17495
|
} catch {
|
|
17388
17496
|
}
|
|
@@ -17396,7 +17504,7 @@ function stampBridgeVersionOnDocument() {
|
|
|
17396
17504
|
return;
|
|
17397
17505
|
}
|
|
17398
17506
|
try {
|
|
17399
|
-
const v = true ? "0.1.
|
|
17507
|
+
const v = true ? "0.1.167" : "";
|
|
17400
17508
|
if (v) {
|
|
17401
17509
|
document.documentElement.setAttribute("data-ohw-bridge-version", v);
|
|
17402
17510
|
window.__OHW_BRIDGE_VERSION__ = v;
|
|
@@ -18303,7 +18411,7 @@ function CarouselOverlay({
|
|
|
18303
18411
|
}
|
|
18304
18412
|
|
|
18305
18413
|
// src/ui/ai-section/AiSectionOverlay.tsx
|
|
18306
|
-
import { useCallback as useCallback2, useEffect as
|
|
18414
|
+
import { useCallback as useCallback2, useEffect as useEffect8, useRef as useRef4, useState as useState7 } from "react";
|
|
18307
18415
|
import { Check, X } from "lucide-react";
|
|
18308
18416
|
|
|
18309
18417
|
// src/lib/ai-change-highlight.ts
|
|
@@ -18399,7 +18507,7 @@ function readRect(instanceId) {
|
|
|
18399
18507
|
}
|
|
18400
18508
|
function useLiveSectionRect(sectionId) {
|
|
18401
18509
|
const [rect, setRect] = useState7(null);
|
|
18402
|
-
|
|
18510
|
+
useEffect8(() => {
|
|
18403
18511
|
if (!sectionId) {
|
|
18404
18512
|
setRect(null);
|
|
18405
18513
|
return;
|
|
@@ -18439,7 +18547,7 @@ function readNavToggleRect() {
|
|
|
18439
18547
|
}
|
|
18440
18548
|
function useLiveNavToggleHole(active) {
|
|
18441
18549
|
const [rect, setRect] = useState7(null);
|
|
18442
|
-
|
|
18550
|
+
useEffect8(() => {
|
|
18443
18551
|
if (!active) {
|
|
18444
18552
|
setRect(null);
|
|
18445
18553
|
return;
|
|
@@ -18563,7 +18671,7 @@ function AiSectionOverlay({
|
|
|
18563
18671
|
reviewIdRef.current = reviewId;
|
|
18564
18672
|
const selectedIdRef = useRef4(null);
|
|
18565
18673
|
selectedIdRef.current = selectedId;
|
|
18566
|
-
|
|
18674
|
+
useEffect8(() => {
|
|
18567
18675
|
onSelectionChange?.(selectedId);
|
|
18568
18676
|
}, [selectedId, onSelectionChange]);
|
|
18569
18677
|
const report = useCallback2(
|
|
@@ -18589,7 +18697,7 @@ function AiSectionOverlay({
|
|
|
18589
18697
|
},
|
|
18590
18698
|
[report]
|
|
18591
18699
|
);
|
|
18592
|
-
|
|
18700
|
+
useEffect8(() => {
|
|
18593
18701
|
apiRef.current = {
|
|
18594
18702
|
selectFromElement,
|
|
18595
18703
|
handleBackgroundClick: (target, clientX, clientY) => {
|
|
@@ -18614,7 +18722,7 @@ function AiSectionOverlay({
|
|
|
18614
18722
|
apiRef.current = null;
|
|
18615
18723
|
};
|
|
18616
18724
|
}, [apiRef, selectFromElement, report]);
|
|
18617
|
-
|
|
18725
|
+
useEffect8(() => {
|
|
18618
18726
|
const onMessage = (e) => {
|
|
18619
18727
|
if (e.data?.type === "ow:ai-select" && e.data.sectionId === null) {
|
|
18620
18728
|
selectedIdRef.current = null;
|
|
@@ -18639,9 +18747,9 @@ function AiSectionOverlay({
|
|
|
18639
18747
|
window.addEventListener("message", onMessage);
|
|
18640
18748
|
return () => window.removeEventListener("message", onMessage);
|
|
18641
18749
|
}, [postToParent2]);
|
|
18642
|
-
|
|
18750
|
+
useEffect8(() => installAiChangeHighlight(), []);
|
|
18643
18751
|
const [hoveredId, setHoveredId] = useState7(null);
|
|
18644
|
-
|
|
18752
|
+
useEffect8(() => {
|
|
18645
18753
|
const onMove = (e) => {
|
|
18646
18754
|
const t = e.target;
|
|
18647
18755
|
if (!(t instanceof Element)) return;
|
|
@@ -18666,7 +18774,7 @@ function AiSectionOverlay({
|
|
|
18666
18774
|
document.documentElement.removeEventListener("mouseleave", onLeave);
|
|
18667
18775
|
};
|
|
18668
18776
|
}, []);
|
|
18669
|
-
|
|
18777
|
+
useEffect8(() => {
|
|
18670
18778
|
const onKeyDown = (e) => {
|
|
18671
18779
|
if (e.key !== "Escape") return;
|
|
18672
18780
|
if (reviewIdRef.current) return;
|
|
@@ -18690,7 +18798,7 @@ function AiSectionOverlay({
|
|
|
18690
18798
|
[postToParent2]
|
|
18691
18799
|
);
|
|
18692
18800
|
const [navDropdownForceOpen, setNavDropdownForceOpen] = useState7(false);
|
|
18693
|
-
|
|
18801
|
+
useEffect8(() => {
|
|
18694
18802
|
const update = () => {
|
|
18695
18803
|
setNavDropdownForceOpen(Boolean(document.querySelector("[data-ohw-nav-force-open]")));
|
|
18696
18804
|
};
|
|
@@ -18709,7 +18817,7 @@ function AiSectionOverlay({
|
|
|
18709
18817
|
const navToggleHole = useLiveNavToggleHole(Boolean(reviewId));
|
|
18710
18818
|
const hoverRect = useLiveSectionRect(reviewId || hoveredId === selectedId ? null : hoveredId);
|
|
18711
18819
|
const showSelectionBorder = Boolean(selectionRect) && !navDropdownForceOpen;
|
|
18712
|
-
|
|
18820
|
+
useEffect8(() => {
|
|
18713
18821
|
const selectedEl = activeSelectionId ? findSectionElement(activeSelectionId) : null;
|
|
18714
18822
|
if (!activeSelectionId || !selectionRect || selectedEl && isChromeSection(selectedEl)) {
|
|
18715
18823
|
postToParent2({ type: "ow:section-rect", instanceId: null, rect: null });
|
|
@@ -18829,7 +18937,7 @@ function AiSectionOverlay({
|
|
|
18829
18937
|
}
|
|
18830
18938
|
|
|
18831
18939
|
// src/ui/ai-section/AiMediaStripOverlay.tsx
|
|
18832
|
-
import { useCallback as useCallback3, useEffect as
|
|
18940
|
+
import { useCallback as useCallback3, useEffect as useEffect9, useRef as useRef5, useState as useState8 } from "react";
|
|
18833
18941
|
import { Star } from "lucide-react";
|
|
18834
18942
|
|
|
18835
18943
|
// src/lib/ai-media-strip-tree.ts
|
|
@@ -18992,7 +19100,7 @@ function readRect2(ref) {
|
|
|
18992
19100
|
}
|
|
18993
19101
|
function useLiveItemRect(ref) {
|
|
18994
19102
|
const [rect, setRect] = useState8(null);
|
|
18995
|
-
|
|
19103
|
+
useEffect9(() => {
|
|
18996
19104
|
if (!ref) {
|
|
18997
19105
|
setRect(null);
|
|
18998
19106
|
return;
|
|
@@ -19088,7 +19196,7 @@ function Pill({
|
|
|
19088
19196
|
}
|
|
19089
19197
|
function AltInput({ value, onCommit }) {
|
|
19090
19198
|
const [draft, setDraft] = useState8(value);
|
|
19091
|
-
|
|
19199
|
+
useEffect9(() => setDraft(value), [value]);
|
|
19092
19200
|
return /* @__PURE__ */ jsxs11(
|
|
19093
19201
|
"div",
|
|
19094
19202
|
{
|
|
@@ -19177,7 +19285,7 @@ var HTTP_URL_RE = /^https?:\/\/\S+$/i;
|
|
|
19177
19285
|
function LinkInput({ value, onCommit }) {
|
|
19178
19286
|
const [draft, setDraft] = useState8(value);
|
|
19179
19287
|
const [invalid, setInvalid] = useState8(false);
|
|
19180
|
-
|
|
19288
|
+
useEffect9(() => {
|
|
19181
19289
|
setDraft(value);
|
|
19182
19290
|
setInvalid(false);
|
|
19183
19291
|
}, [value]);
|
|
@@ -19372,7 +19480,7 @@ function AiMediaStripOverlay({
|
|
|
19372
19480
|
const [error, setError] = useState8(null);
|
|
19373
19481
|
const activeRef = useRef5(null);
|
|
19374
19482
|
activeRef.current = active;
|
|
19375
|
-
|
|
19483
|
+
useEffect9(() => {
|
|
19376
19484
|
const onMove = (e) => {
|
|
19377
19485
|
const t = e.target;
|
|
19378
19486
|
if (!(t instanceof HTMLElement)) return;
|
|
@@ -19402,7 +19510,7 @@ function AiMediaStripOverlay({
|
|
|
19402
19510
|
document.documentElement.removeEventListener("mouseleave", onLeave);
|
|
19403
19511
|
};
|
|
19404
19512
|
}, []);
|
|
19405
|
-
|
|
19513
|
+
useEffect9(() => {
|
|
19406
19514
|
const onClick = (e) => {
|
|
19407
19515
|
const current = activeRef.current;
|
|
19408
19516
|
if (!current) return;
|
|
@@ -19417,7 +19525,7 @@ function AiMediaStripOverlay({
|
|
|
19417
19525
|
document.addEventListener("click", onClick, true);
|
|
19418
19526
|
return () => document.removeEventListener("click", onClick, true);
|
|
19419
19527
|
}, []);
|
|
19420
|
-
|
|
19528
|
+
useEffect9(() => {
|
|
19421
19529
|
const onBlur = () => {
|
|
19422
19530
|
if (!activeRef.current) return;
|
|
19423
19531
|
setActive(null);
|
|
@@ -19426,7 +19534,7 @@ function AiMediaStripOverlay({
|
|
|
19426
19534
|
window.addEventListener("blur", onBlur);
|
|
19427
19535
|
return () => window.removeEventListener("blur", onBlur);
|
|
19428
19536
|
}, []);
|
|
19429
|
-
|
|
19537
|
+
useEffect9(() => {
|
|
19430
19538
|
const onKeyDown = (e) => {
|
|
19431
19539
|
if (e.key !== "Escape") return;
|
|
19432
19540
|
if (!activeRef.current) return;
|
|
@@ -19590,7 +19698,7 @@ function AiMediaStripOverlay({
|
|
|
19590
19698
|
}
|
|
19591
19699
|
|
|
19592
19700
|
// src/ui/ai-section/AiPricingCardOverlay.tsx
|
|
19593
|
-
import { useCallback as useCallback4, useEffect as
|
|
19701
|
+
import { useCallback as useCallback4, useEffect as useEffect10, useLayoutEffect as useLayoutEffect4, useRef as useRef6, useState as useState9 } from "react";
|
|
19594
19702
|
import { Check as Check2, ChevronDown as ChevronDown3, Minus, Plus as Plus2, Star as Star2 } from "lucide-react";
|
|
19595
19703
|
import { Fragment as Fragment8, jsx as jsx21, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
19596
19704
|
var PRIMARY4 = "var(--ohw-primary, #0885FE)";
|
|
@@ -19634,7 +19742,7 @@ function readGridRect(ref) {
|
|
|
19634
19742
|
}
|
|
19635
19743
|
function useLiveCardRect(ref, grid = false) {
|
|
19636
19744
|
const [rect, setRect] = useState9(null);
|
|
19637
|
-
|
|
19745
|
+
useEffect10(() => {
|
|
19638
19746
|
if (!ref) {
|
|
19639
19747
|
setRect(null);
|
|
19640
19748
|
return;
|
|
@@ -19928,7 +20036,7 @@ function AiPricingCardOverlay({
|
|
|
19928
20036
|
const [error, setError] = useState9(null);
|
|
19929
20037
|
const activeRef = useRef6(null);
|
|
19930
20038
|
activeRef.current = active;
|
|
19931
|
-
|
|
20039
|
+
useEffect10(() => {
|
|
19932
20040
|
const onMove = (e) => {
|
|
19933
20041
|
const ref = cardRefFromTarget(e.target);
|
|
19934
20042
|
const t = e.target;
|
|
@@ -19946,7 +20054,7 @@ function AiPricingCardOverlay({
|
|
|
19946
20054
|
document.documentElement.removeEventListener("mouseleave", onLeave);
|
|
19947
20055
|
};
|
|
19948
20056
|
}, []);
|
|
19949
|
-
|
|
20057
|
+
useEffect10(() => {
|
|
19950
20058
|
const onClick = (e) => {
|
|
19951
20059
|
const t = e.target;
|
|
19952
20060
|
if (!(t instanceof Element)) return;
|
|
@@ -19958,7 +20066,7 @@ function AiPricingCardOverlay({
|
|
|
19958
20066
|
document.addEventListener("click", onClick, true);
|
|
19959
20067
|
return () => document.removeEventListener("click", onClick, true);
|
|
19960
20068
|
}, []);
|
|
19961
|
-
|
|
20069
|
+
useEffect10(() => {
|
|
19962
20070
|
const onBlur = () => {
|
|
19963
20071
|
if (!activeRef.current) return;
|
|
19964
20072
|
setActive(null);
|
|
@@ -19967,7 +20075,7 @@ function AiPricingCardOverlay({
|
|
|
19967
20075
|
window.addEventListener("blur", onBlur);
|
|
19968
20076
|
return () => window.removeEventListener("blur", onBlur);
|
|
19969
20077
|
}, []);
|
|
19970
|
-
|
|
20078
|
+
useEffect10(() => {
|
|
19971
20079
|
const onKeyDown = (e) => {
|
|
19972
20080
|
if (e.key !== "Escape") return;
|
|
19973
20081
|
if (!activeRef.current) return;
|
|
@@ -20072,7 +20180,7 @@ function AiPricingCardOverlay({
|
|
|
20072
20180
|
}
|
|
20073
20181
|
|
|
20074
20182
|
// src/ui/ai-section/AiVideoOverlay.tsx
|
|
20075
|
-
import { useCallback as useCallback5, useEffect as
|
|
20183
|
+
import { useCallback as useCallback5, useEffect as useEffect11, useRef as useRef7, useState as useState10 } from "react";
|
|
20076
20184
|
import { Star as Star3 } from "lucide-react";
|
|
20077
20185
|
|
|
20078
20186
|
// src/lib/ai-video-tree.ts
|
|
@@ -20166,7 +20274,7 @@ function readRect4(ref) {
|
|
|
20166
20274
|
}
|
|
20167
20275
|
function useLiveBlockRect(ref) {
|
|
20168
20276
|
const [rect, setRect] = useState10(null);
|
|
20169
|
-
|
|
20277
|
+
useEffect11(() => {
|
|
20170
20278
|
if (!ref) {
|
|
20171
20279
|
setRect(null);
|
|
20172
20280
|
return;
|
|
@@ -20246,7 +20354,7 @@ function watchUrl(id) {
|
|
|
20246
20354
|
function VideoUrlInput({ value, onCommit }) {
|
|
20247
20355
|
const [draft, setDraft] = useState10(value ? watchUrl(value) : "");
|
|
20248
20356
|
const [invalid, setInvalid] = useState10(false);
|
|
20249
|
-
|
|
20357
|
+
useEffect11(() => {
|
|
20250
20358
|
setDraft(value ? watchUrl(value) : "");
|
|
20251
20359
|
setInvalid(false);
|
|
20252
20360
|
}, [value]);
|
|
@@ -20389,7 +20497,7 @@ function AiVideoOverlay({
|
|
|
20389
20497
|
const [error, setError] = useState10(null);
|
|
20390
20498
|
const activeRef = useRef7(null);
|
|
20391
20499
|
activeRef.current = active;
|
|
20392
|
-
|
|
20500
|
+
useEffect11(() => {
|
|
20393
20501
|
const onMove = (e) => {
|
|
20394
20502
|
const t = e.target;
|
|
20395
20503
|
if (!(t instanceof HTMLElement)) return;
|
|
@@ -20419,7 +20527,7 @@ function AiVideoOverlay({
|
|
|
20419
20527
|
document.documentElement.removeEventListener("mouseleave", onLeave);
|
|
20420
20528
|
};
|
|
20421
20529
|
}, []);
|
|
20422
|
-
|
|
20530
|
+
useEffect11(() => {
|
|
20423
20531
|
const onClick = (e) => {
|
|
20424
20532
|
const current = activeRef.current;
|
|
20425
20533
|
if (!current) return;
|
|
@@ -20434,7 +20542,7 @@ function AiVideoOverlay({
|
|
|
20434
20542
|
document.addEventListener("click", onClick, true);
|
|
20435
20543
|
return () => document.removeEventListener("click", onClick, true);
|
|
20436
20544
|
}, []);
|
|
20437
|
-
|
|
20545
|
+
useEffect11(() => {
|
|
20438
20546
|
const onBlur = () => {
|
|
20439
20547
|
if (!activeRef.current) return;
|
|
20440
20548
|
setActive(null);
|
|
@@ -20443,7 +20551,7 @@ function AiVideoOverlay({
|
|
|
20443
20551
|
window.addEventListener("blur", onBlur);
|
|
20444
20552
|
return () => window.removeEventListener("blur", onBlur);
|
|
20445
20553
|
}, []);
|
|
20446
|
-
|
|
20554
|
+
useEffect11(() => {
|
|
20447
20555
|
const onKeyDown = (e) => {
|
|
20448
20556
|
if (e.key !== "Escape") return;
|
|
20449
20557
|
if (!activeRef.current) return;
|
|
@@ -20552,7 +20660,7 @@ function AiVideoOverlay({
|
|
|
20552
20660
|
}
|
|
20553
20661
|
|
|
20554
20662
|
// src/ui/ai-section/AiFadeCarouselOverlay.tsx
|
|
20555
|
-
import { useCallback as useCallback6, useEffect as
|
|
20663
|
+
import { useCallback as useCallback6, useEffect as useEffect12, useRef as useRef8, useState as useState11 } from "react";
|
|
20556
20664
|
import { Star as Star4 } from "lucide-react";
|
|
20557
20665
|
|
|
20558
20666
|
// src/lib/ai-carousel-tree.ts
|
|
@@ -20626,7 +20734,7 @@ function readRect5(ref) {
|
|
|
20626
20734
|
}
|
|
20627
20735
|
function useLiveItemRect2(ref) {
|
|
20628
20736
|
const [rect, setRect] = useState11(null);
|
|
20629
|
-
|
|
20737
|
+
useEffect12(() => {
|
|
20630
20738
|
if (!ref) {
|
|
20631
20739
|
setRect(null);
|
|
20632
20740
|
return;
|
|
@@ -20842,10 +20950,10 @@ function AiFadeCarouselOverlay({
|
|
|
20842
20950
|
const skeletonRef = useRef8(null);
|
|
20843
20951
|
const activeRef = useRef8(null);
|
|
20844
20952
|
activeRef.current = active;
|
|
20845
|
-
|
|
20953
|
+
useEffect12(() => {
|
|
20846
20954
|
setAutoplayOverride(null);
|
|
20847
20955
|
}, [active?.sectionId, active?.index]);
|
|
20848
|
-
|
|
20956
|
+
useEffect12(() => {
|
|
20849
20957
|
if (!swapping?.fadingOut || !skeletonRef.current) return;
|
|
20850
20958
|
const anim = skeletonRef.current.animate([{ opacity: 1 }, { opacity: 0 }], {
|
|
20851
20959
|
duration: MEDIA_UPLOAD_FADE_MS,
|
|
@@ -20855,7 +20963,7 @@ function AiFadeCarouselOverlay({
|
|
|
20855
20963
|
anim.finished.then(() => setSwapping(null)).catch(() => setSwapping(null));
|
|
20856
20964
|
return () => anim.cancel();
|
|
20857
20965
|
}, [swapping?.fadingOut]);
|
|
20858
|
-
|
|
20966
|
+
useEffect12(() => {
|
|
20859
20967
|
const onMove = (e) => {
|
|
20860
20968
|
const t = e.target;
|
|
20861
20969
|
if (!(t instanceof Element)) return;
|
|
@@ -20889,7 +20997,7 @@ function AiFadeCarouselOverlay({
|
|
|
20889
20997
|
document.documentElement.removeEventListener("mouseleave", onLeave);
|
|
20890
20998
|
};
|
|
20891
20999
|
}, []);
|
|
20892
|
-
|
|
21000
|
+
useEffect12(() => {
|
|
20893
21001
|
const onClick = (e) => {
|
|
20894
21002
|
const current = activeRef.current;
|
|
20895
21003
|
if (!current) return;
|
|
@@ -20904,7 +21012,7 @@ function AiFadeCarouselOverlay({
|
|
|
20904
21012
|
document.addEventListener("click", onClick, true);
|
|
20905
21013
|
return () => document.removeEventListener("click", onClick, true);
|
|
20906
21014
|
}, []);
|
|
20907
|
-
|
|
21015
|
+
useEffect12(() => {
|
|
20908
21016
|
const onBlur = () => {
|
|
20909
21017
|
if (!activeRef.current) return;
|
|
20910
21018
|
setActive(null);
|
|
@@ -20913,7 +21021,7 @@ function AiFadeCarouselOverlay({
|
|
|
20913
21021
|
window.addEventListener("blur", onBlur);
|
|
20914
21022
|
return () => window.removeEventListener("blur", onBlur);
|
|
20915
21023
|
}, []);
|
|
20916
|
-
|
|
21024
|
+
useEffect12(() => {
|
|
20917
21025
|
const onKeyDown = (e) => {
|
|
20918
21026
|
if (e.key !== "Escape") return;
|
|
20919
21027
|
if (!activeRef.current) return;
|
|
@@ -21210,7 +21318,7 @@ function mergePrefetchedSections(prev, fetched, livePath, liveSections) {
|
|
|
21210
21318
|
}
|
|
21211
21319
|
|
|
21212
21320
|
// src/ui/link-modal/LinkPopover.tsx
|
|
21213
|
-
import { useEffect as
|
|
21321
|
+
import { useEffect as useEffect16 } from "react";
|
|
21214
21322
|
|
|
21215
21323
|
// src/ui/dialog.tsx
|
|
21216
21324
|
import * as React9 from "react";
|
|
@@ -21410,7 +21518,7 @@ function SectionTreeItem({
|
|
|
21410
21518
|
}
|
|
21411
21519
|
|
|
21412
21520
|
// src/ui/link-modal/UrlOrPageInput.tsx
|
|
21413
|
-
import { useEffect as
|
|
21521
|
+
import { useEffect as useEffect13, useId as useId2, useRef as useRef9, useState as useState12 } from "react";
|
|
21414
21522
|
|
|
21415
21523
|
// src/ui/input.tsx
|
|
21416
21524
|
import * as React10 from "react";
|
|
@@ -21482,7 +21590,7 @@ function UrlOrPageInput({
|
|
|
21482
21590
|
const inputRef = useRef9(null);
|
|
21483
21591
|
const rootRef = useRef9(null);
|
|
21484
21592
|
const [isFocused, setIsFocused] = useState12(false);
|
|
21485
|
-
|
|
21593
|
+
useEffect13(() => {
|
|
21486
21594
|
if (!dropdownOpen) return;
|
|
21487
21595
|
const isOutside = (e) => {
|
|
21488
21596
|
const root = rootRef.current;
|
|
@@ -21690,7 +21798,7 @@ function LinkEditorPanel({ state, onClose }) {
|
|
|
21690
21798
|
}
|
|
21691
21799
|
|
|
21692
21800
|
// src/ui/link-modal/SectionPickerOverlay.tsx
|
|
21693
|
-
import { useCallback as useCallback7, useEffect as
|
|
21801
|
+
import { useCallback as useCallback7, useEffect as useEffect14, useMemo as useMemo2, useRef as useRef10, useState as useState13 } from "react";
|
|
21694
21802
|
import { createPortal as createPortal2 } from "react-dom";
|
|
21695
21803
|
import { ArrowLeft as ArrowLeft2, Check as Check3 } from "lucide-react";
|
|
21696
21804
|
import { usePathname as usePathname2, useRouter as useRouter2 } from "next/navigation";
|
|
@@ -21752,7 +21860,7 @@ function useSectionRects(sectionIdsKey, enabled) {
|
|
|
21752
21860
|
() => sectionIdsKey ? sectionIdsKey.split("\0") : [],
|
|
21753
21861
|
[sectionIdsKey]
|
|
21754
21862
|
);
|
|
21755
|
-
|
|
21863
|
+
useEffect14(() => {
|
|
21756
21864
|
if (!enabled || sectionIds.length === 0) {
|
|
21757
21865
|
setRects((prev) => prev.size === 0 ? prev : /* @__PURE__ */ new Map());
|
|
21758
21866
|
return;
|
|
@@ -21807,12 +21915,12 @@ function SectionPickerOverlay({
|
|
|
21807
21915
|
);
|
|
21808
21916
|
const normalizedTarget = normalizePath(pagePath);
|
|
21809
21917
|
const isOnTargetPage = normalizePath(pathname) === normalizedTarget;
|
|
21810
|
-
|
|
21918
|
+
useEffect14(() => {
|
|
21811
21919
|
if (isOnTargetPage) return;
|
|
21812
21920
|
const search = readPreservedSearch();
|
|
21813
21921
|
router.push(`${normalizedTarget}${search}`);
|
|
21814
21922
|
}, [isOnTargetPage, normalizedTarget, router]);
|
|
21815
|
-
|
|
21923
|
+
useEffect14(() => {
|
|
21816
21924
|
document.documentElement.setAttribute("data-ohw-section-picking", "");
|
|
21817
21925
|
document.querySelectorAll("[data-ohw-hovered]").forEach((el) => {
|
|
21818
21926
|
el.removeAttribute("data-ohw-hovered");
|
|
@@ -21850,7 +21958,7 @@ function SectionPickerOverlay({
|
|
|
21850
21958
|
},
|
|
21851
21959
|
[]
|
|
21852
21960
|
);
|
|
21853
|
-
|
|
21961
|
+
useEffect14(() => {
|
|
21854
21962
|
const applyClip = (iframeOffsetTop, visibleCanvasTop, canvasH, promptBarH = 0) => {
|
|
21855
21963
|
const next = getIframeVisibleClip({
|
|
21856
21964
|
iframeOffsetTop,
|
|
@@ -21894,12 +22002,12 @@ function SectionPickerOverlay({
|
|
|
21894
22002
|
window.removeEventListener("resize", onResize);
|
|
21895
22003
|
};
|
|
21896
22004
|
}, [applyHoverAt]);
|
|
21897
|
-
|
|
22005
|
+
useEffect14(() => {
|
|
21898
22006
|
const ptr = pointerRef.current;
|
|
21899
22007
|
if (!ptr) return;
|
|
21900
22008
|
applyHoverAt(ptr.x, ptr.y, rects);
|
|
21901
22009
|
}, [rects, applyHoverAt]);
|
|
21902
|
-
|
|
22010
|
+
useEffect14(() => {
|
|
21903
22011
|
const rememberPointer = (clientX, clientY) => {
|
|
21904
22012
|
pointerRef.current = { x: clientX, y: clientY };
|
|
21905
22013
|
const top = iframeOffsetTopRef.current;
|
|
@@ -21931,7 +22039,7 @@ function SectionPickerOverlay({
|
|
|
21931
22039
|
},
|
|
21932
22040
|
[selectedId, onSelect]
|
|
21933
22041
|
);
|
|
21934
|
-
|
|
22042
|
+
useEffect14(() => {
|
|
21935
22043
|
const onKeyDown = (e) => {
|
|
21936
22044
|
if (e.key === "Escape") {
|
|
21937
22045
|
e.preventDefault();
|
|
@@ -22054,7 +22162,7 @@ function SectionPickerOverlay({
|
|
|
22054
22162
|
}
|
|
22055
22163
|
|
|
22056
22164
|
// src/ui/link-modal/useLinkModalState.ts
|
|
22057
|
-
import { useCallback as useCallback8, useEffect as
|
|
22165
|
+
import { useCallback as useCallback8, useEffect as useEffect15, useMemo as useMemo3, useState as useState14 } from "react";
|
|
22058
22166
|
function useLinkModalState({
|
|
22059
22167
|
open,
|
|
22060
22168
|
mode,
|
|
@@ -22081,7 +22189,7 @@ function useLinkModalState({
|
|
|
22081
22189
|
setDropdownOpen(false);
|
|
22082
22190
|
setUrlError("");
|
|
22083
22191
|
}, []);
|
|
22084
|
-
|
|
22192
|
+
useEffect15(() => {
|
|
22085
22193
|
if (!open) return;
|
|
22086
22194
|
if (mode === "edit" && initialTarget) {
|
|
22087
22195
|
const { pageRoute } = parseTarget(initialTarget);
|
|
@@ -22247,7 +22355,7 @@ function LinkPopover({
|
|
|
22247
22355
|
onSubmit
|
|
22248
22356
|
});
|
|
22249
22357
|
const sectionPickerActive = state.showSectionPicker && Boolean(state.selectedPage);
|
|
22250
|
-
|
|
22358
|
+
useEffect16(() => {
|
|
22251
22359
|
if (!open) return;
|
|
22252
22360
|
if (sectionPickerActive) {
|
|
22253
22361
|
postToParent({ type: "ui:unlock" });
|
|
@@ -22490,7 +22598,7 @@ function addFooterColumnWithPersist({
|
|
|
22490
22598
|
// src/ui/FloatingPanel.tsx
|
|
22491
22599
|
import {
|
|
22492
22600
|
useCallback as useCallback9,
|
|
22493
|
-
useEffect as
|
|
22601
|
+
useEffect as useEffect17,
|
|
22494
22602
|
useLayoutEffect as useLayoutEffect5,
|
|
22495
22603
|
useRef as useRef11,
|
|
22496
22604
|
useState as useState15
|
|
@@ -22574,10 +22682,10 @@ function FloatingPanel({
|
|
|
22574
22682
|
x: clampX(home.x, measured.w),
|
|
22575
22683
|
y: fittedY
|
|
22576
22684
|
};
|
|
22577
|
-
|
|
22685
|
+
useEffect17(() => {
|
|
22578
22686
|
setLiveScroll(parentScroll);
|
|
22579
22687
|
}, [parentScroll]);
|
|
22580
|
-
|
|
22688
|
+
useEffect17(() => {
|
|
22581
22689
|
if (!open) return;
|
|
22582
22690
|
const onParentScroll = (e) => {
|
|
22583
22691
|
if (e.data?.type !== "ow:parent-scroll") return;
|
|
@@ -22662,11 +22770,11 @@ function FloatingPanel({
|
|
|
22662
22770
|
} catch {
|
|
22663
22771
|
}
|
|
22664
22772
|
}, []);
|
|
22665
|
-
|
|
22773
|
+
useEffect17(() => {
|
|
22666
22774
|
if (open) return;
|
|
22667
22775
|
document.documentElement.removeAttribute("data-ohw-panel-dragging");
|
|
22668
22776
|
}, [open]);
|
|
22669
|
-
|
|
22777
|
+
useEffect17(() => () => document.documentElement.removeAttribute("data-ohw-panel-dragging"), []);
|
|
22670
22778
|
if (!open) return null;
|
|
22671
22779
|
return /* @__PURE__ */ jsxs22(
|
|
22672
22780
|
"div",
|
|
@@ -23186,7 +23294,7 @@ function hitTestNavDropSlot(clientX, clientY, draggedHrefKey, draggedEl) {
|
|
|
23186
23294
|
}
|
|
23187
23295
|
|
|
23188
23296
|
// src/useNavItemDrag.ts
|
|
23189
|
-
import { useCallback as useCallback10, useEffect as
|
|
23297
|
+
import { useCallback as useCallback10, useEffect as useEffect18, useRef as useRef12, useState as useState16 } from "react";
|
|
23190
23298
|
function useNavItemDrag({
|
|
23191
23299
|
isEditMode,
|
|
23192
23300
|
editContentRef,
|
|
@@ -23419,7 +23527,7 @@ function useNavItemDrag({
|
|
|
23419
23527
|
},
|
|
23420
23528
|
[]
|
|
23421
23529
|
);
|
|
23422
|
-
|
|
23530
|
+
useEffect18(() => {
|
|
23423
23531
|
if (!isEditMode) return;
|
|
23424
23532
|
const THRESHOLD = 10;
|
|
23425
23533
|
const resolveWasSelected = (el) => {
|
|
@@ -23578,7 +23686,7 @@ function useNavItemDrag({
|
|
|
23578
23686
|
}
|
|
23579
23687
|
|
|
23580
23688
|
// src/useSectionDrag.ts
|
|
23581
|
-
import { useCallback as useCallback11, useEffect as
|
|
23689
|
+
import { useCallback as useCallback11, useEffect as useEffect19, useRef as useRef13, useState as useState17 } from "react";
|
|
23582
23690
|
|
|
23583
23691
|
// src/lib/section-dnd.ts
|
|
23584
23692
|
function isFooterSection(el) {
|
|
@@ -23798,7 +23906,7 @@ function useSectionDrag({
|
|
|
23798
23906
|
},
|
|
23799
23907
|
[footerDragRef, navDragRef]
|
|
23800
23908
|
);
|
|
23801
|
-
|
|
23909
|
+
useEffect19(() => {
|
|
23802
23910
|
if (!isEditMode) return;
|
|
23803
23911
|
const onPointerDown = (e) => {
|
|
23804
23912
|
if (e.button !== 0) return;
|
|
@@ -24123,7 +24231,7 @@ function deleteSelectedNavFooterItem(deps) {
|
|
|
24123
24231
|
}
|
|
24124
24232
|
|
|
24125
24233
|
// src/lib/build-page-sync.ts
|
|
24126
|
-
import { useEffect as
|
|
24234
|
+
import { useEffect as useEffect20 } from "react";
|
|
24127
24235
|
var CHROME_KEY_RE = /^(nav|footer|header|navbar)[-_]/u;
|
|
24128
24236
|
function normalisePath(path) {
|
|
24129
24237
|
const trimmed = path.trim().replace(/[?#].*$/u, "");
|
|
@@ -24236,7 +24344,7 @@ function applyBuildPageSync(msg, deps) {
|
|
|
24236
24344
|
return plan.remove.length + plan.relabel.length + plan.retarget.length;
|
|
24237
24345
|
}
|
|
24238
24346
|
function useBuildPageSync(isEditMode, editContentRef, postToParent2) {
|
|
24239
|
-
|
|
24347
|
+
useEffect20(() => {
|
|
24240
24348
|
if (!isEditMode) return;
|
|
24241
24349
|
const onMessage = (e) => {
|
|
24242
24350
|
if (e.source !== window.parent || e.data?.type !== "ow:pages-sync") return;
|
|
@@ -25959,7 +26067,7 @@ function OhhwellsBridge() {
|
|
|
25959
26067
|
const searchParams = useSearchParams();
|
|
25960
26068
|
const isEditMode = isEditSessionActive();
|
|
25961
26069
|
const [bridgeRoot, setBridgeRoot] = useState18(null);
|
|
25962
|
-
|
|
26070
|
+
useEffect21(() => {
|
|
25963
26071
|
const figtreeFontId = "ohw-figtree-font";
|
|
25964
26072
|
if (!document.getElementById(figtreeFontId)) {
|
|
25965
26073
|
const preconnect1 = Object.assign(document.createElement("link"), { rel: "preconnect", href: "https://fonts.googleapis.com" });
|
|
@@ -25998,7 +26106,7 @@ function OhhwellsBridge() {
|
|
|
25998
26106
|
}, 0);
|
|
25999
26107
|
return () => window.clearTimeout(t);
|
|
26000
26108
|
}, [subdomainFromQuery, subdomain]);
|
|
26001
|
-
|
|
26109
|
+
useEffect21(() => {
|
|
26002
26110
|
if (!subdomainFromQuery || typeof window === "undefined") return;
|
|
26003
26111
|
const url = new URL(window.location.href);
|
|
26004
26112
|
if (!url.searchParams.has("subdomain")) return;
|
|
@@ -26010,6 +26118,7 @@ function OhhwellsBridge() {
|
|
|
26010
26118
|
useSavedLinkNavigation(isEditMode);
|
|
26011
26119
|
useNavDropdownToggle(isEditMode);
|
|
26012
26120
|
useHashLinkScroll(isEditMode);
|
|
26121
|
+
usePublishedPlaceholderStrip(isEditMode);
|
|
26013
26122
|
const postToParent2 = useCallback12((data) => {
|
|
26014
26123
|
if (typeof window !== "undefined" && window.parent !== window) {
|
|
26015
26124
|
window.parent.postMessage(data, "*");
|
|
@@ -26018,14 +26127,14 @@ function OhhwellsBridge() {
|
|
|
26018
26127
|
const [fetchState, setFetchState] = useState18("idle");
|
|
26019
26128
|
const [showBranding, setShowBranding] = useState18(false);
|
|
26020
26129
|
const autoSaveTimers = useRef14(/* @__PURE__ */ new Map());
|
|
26021
|
-
|
|
26130
|
+
useEffect21(() => {
|
|
26022
26131
|
stampBridgeVersionOnDocument();
|
|
26023
26132
|
}, []);
|
|
26024
|
-
|
|
26133
|
+
useEffect21(() => {
|
|
26025
26134
|
if (isEditMode) return;
|
|
26026
26135
|
return armLoaderHangBeacon(subdomain, fetchState);
|
|
26027
26136
|
}, [isEditMode, subdomain, fetchState]);
|
|
26028
|
-
|
|
26137
|
+
useEffect21(() => {
|
|
26029
26138
|
if (isEditMode || !subdomain) return;
|
|
26030
26139
|
const onError = (event) => {
|
|
26031
26140
|
reportOutageBeacon({
|
|
@@ -26166,7 +26275,7 @@ function OhhwellsBridge() {
|
|
|
26166
26275
|
}, []);
|
|
26167
26276
|
const selectMediaElementRef = useRef14(selectMediaElement);
|
|
26168
26277
|
selectMediaElementRef.current = selectMediaElement;
|
|
26169
|
-
|
|
26278
|
+
useEffect21(() => {
|
|
26170
26279
|
if (!selectedMedia) return;
|
|
26171
26280
|
const update = () => {
|
|
26172
26281
|
const el = selectedMediaElRef.current;
|
|
@@ -26381,7 +26490,7 @@ function OhhwellsBridge() {
|
|
|
26381
26490
|
const [fieldDragging, setFieldDragging] = useState18(false);
|
|
26382
26491
|
const clearFormPickRef = useRef14(clearFormPick);
|
|
26383
26492
|
clearFormPickRef.current = clearFormPick;
|
|
26384
|
-
|
|
26493
|
+
useEffect21(() => {
|
|
26385
26494
|
const el = fieldPickElRef.current;
|
|
26386
26495
|
if (!el || fieldPickRect === null) return;
|
|
26387
26496
|
const observer = new ResizeObserver(() => {
|
|
@@ -26390,7 +26499,7 @@ function OhhwellsBridge() {
|
|
|
26390
26499
|
observer.observe(el);
|
|
26391
26500
|
return () => observer.disconnect();
|
|
26392
26501
|
}, [fieldPickRect !== null, fieldPickState]);
|
|
26393
|
-
|
|
26502
|
+
useEffect21(() => {
|
|
26394
26503
|
const el = formPickElRef.current;
|
|
26395
26504
|
if (!el || formPickRect === null) return;
|
|
26396
26505
|
const observer = new ResizeObserver(() => {
|
|
@@ -26417,7 +26526,7 @@ function OhhwellsBridge() {
|
|
|
26417
26526
|
const hoveredItemElRef = useRef14(null);
|
|
26418
26527
|
const [hoveredItemRect, setHoveredItemRect] = useState18(null);
|
|
26419
26528
|
const [hoveredTextRect, setHoveredTextRect] = useState18(null);
|
|
26420
|
-
|
|
26529
|
+
useEffect21(() => {
|
|
26421
26530
|
const sync = () => {
|
|
26422
26531
|
const el = document.querySelector(
|
|
26423
26532
|
'[data-ohw-hovered]:not([contenteditable]):not([data-ohw-href-key]):not([data-ohw-editable="form"] *)'
|
|
@@ -26518,7 +26627,7 @@ function OhhwellsBridge() {
|
|
|
26518
26627
|
const linkPopoverGraceUntilRef = useRef14(0);
|
|
26519
26628
|
setLinkPopoverRef.current = setLinkPopover;
|
|
26520
26629
|
linkPopoverSessionRef.current = linkPopover;
|
|
26521
|
-
|
|
26630
|
+
useEffect21(() => {
|
|
26522
26631
|
setSectionOrderPersistHandler((entries) => {
|
|
26523
26632
|
const currentPath = window.location.pathname;
|
|
26524
26633
|
const merged = mergePageSectionOrder(editContentRef.current[SECTION_ORDER_KEY], currentPath, entries);
|
|
@@ -26528,7 +26637,7 @@ function OhhwellsBridge() {
|
|
|
26528
26637
|
});
|
|
26529
26638
|
return () => setSectionOrderPersistHandler(null);
|
|
26530
26639
|
}, []);
|
|
26531
|
-
|
|
26640
|
+
useEffect21(() => {
|
|
26532
26641
|
setAiFooterMountOptions({
|
|
26533
26642
|
resolvePageHref: (pageOrAnchorId) => {
|
|
26534
26643
|
const [pageId, anchor] = pageOrAnchorId.split("#");
|
|
@@ -26612,7 +26721,7 @@ function OhhwellsBridge() {
|
|
|
26612
26721
|
}, [isEditMode, pathname]);
|
|
26613
26722
|
const runSectionsPrefetchRef = useRef14(runSectionsPrefetch);
|
|
26614
26723
|
runSectionsPrefetchRef.current = runSectionsPrefetch;
|
|
26615
|
-
|
|
26724
|
+
useEffect21(() => {
|
|
26616
26725
|
if (!linkPopover) {
|
|
26617
26726
|
document.documentElement.removeAttribute("data-ohw-link-popover-open");
|
|
26618
26727
|
return;
|
|
@@ -26640,7 +26749,7 @@ function OhhwellsBridge() {
|
|
|
26640
26749
|
document.documentElement.removeAttribute("data-ohw-link-popover-open");
|
|
26641
26750
|
};
|
|
26642
26751
|
}, [linkPopover, postToParent2]);
|
|
26643
|
-
|
|
26752
|
+
useEffect21(() => {
|
|
26644
26753
|
if (!isEditMode) return;
|
|
26645
26754
|
const useFixtures = shouldUseDevFixtures();
|
|
26646
26755
|
if (useFixtures) {
|
|
@@ -26666,7 +26775,7 @@ function OhhwellsBridge() {
|
|
|
26666
26775
|
if (!useFixtures) postToParent2({ type: "ow:request-site-pages" });
|
|
26667
26776
|
return () => window.removeEventListener("message", onSitePages);
|
|
26668
26777
|
}, [isEditMode, postToParent2]);
|
|
26669
|
-
|
|
26778
|
+
useEffect21(() => {
|
|
26670
26779
|
if (!isEditMode) return;
|
|
26671
26780
|
const deps = {
|
|
26672
26781
|
getEditContent: () => editContentRef.current,
|
|
@@ -26703,14 +26812,14 @@ function OhhwellsBridge() {
|
|
|
26703
26812
|
window.addEventListener("message", onPageMessage);
|
|
26704
26813
|
return () => window.removeEventListener("message", onPageMessage);
|
|
26705
26814
|
}, [isEditMode, postToParent2]);
|
|
26706
|
-
|
|
26815
|
+
useEffect21(() => {
|
|
26707
26816
|
if (!isEditMode || shouldUseDevFixtures()) return;
|
|
26708
26817
|
void loadAllSectionsManifest().then((manifest) => {
|
|
26709
26818
|
if (Object.keys(manifest).length === 0) return;
|
|
26710
26819
|
setSectionsByPath((prev) => ({ ...manifest, ...prev }));
|
|
26711
26820
|
});
|
|
26712
26821
|
}, [isEditMode]);
|
|
26713
|
-
|
|
26822
|
+
useEffect21(() => {
|
|
26714
26823
|
const update = () => {
|
|
26715
26824
|
const el = activeElRef.current ?? selectedElRef.current;
|
|
26716
26825
|
if (el) setToolbarRect(getEditMeasureEl(el).getBoundingClientRect());
|
|
@@ -27969,7 +28078,7 @@ function OhhwellsBridge() {
|
|
|
27969
28078
|
},
|
|
27970
28079
|
[postToParent2]
|
|
27971
28080
|
);
|
|
27972
|
-
|
|
28081
|
+
useEffect21(() => {
|
|
27973
28082
|
const onDragOver = (e) => {
|
|
27974
28083
|
const dragged = buttonCollectionDragRef.current;
|
|
27975
28084
|
if (!dragged) return;
|
|
@@ -28040,7 +28149,7 @@ function OhhwellsBridge() {
|
|
|
28040
28149
|
setLogoSizeDraft(null);
|
|
28041
28150
|
deselectRef.current();
|
|
28042
28151
|
}, []);
|
|
28043
|
-
|
|
28152
|
+
useEffect21(() => {
|
|
28044
28153
|
const session = floatingPanel && floatingPanel.kind === "logo-size" ? floatingPanel : null;
|
|
28045
28154
|
if (!session || !logoSizeDraft) {
|
|
28046
28155
|
postToParentRef.current({ type: "ow:logo-size-panel", open: false });
|
|
@@ -28198,7 +28307,7 @@ function OhhwellsBridge() {
|
|
|
28198
28307
|
deselectRef.current = deselect;
|
|
28199
28308
|
closeFloatingPanelOnlyRef.current = closeFloatingPanelOnly;
|
|
28200
28309
|
const lastSiteWideScopeRef = useRef14(null);
|
|
28201
|
-
|
|
28310
|
+
useEffect21(() => {
|
|
28202
28311
|
if (!isEditMode) {
|
|
28203
28312
|
if (lastSiteWideScopeRef.current !== false) {
|
|
28204
28313
|
lastSiteWideScopeRef.current = false;
|
|
@@ -28375,7 +28484,7 @@ function OhhwellsBridge() {
|
|
|
28375
28484
|
cancelled = true;
|
|
28376
28485
|
};
|
|
28377
28486
|
}, [subdomain, isEditMode]);
|
|
28378
|
-
|
|
28487
|
+
useEffect21(() => {
|
|
28379
28488
|
if (!isEditMode) return;
|
|
28380
28489
|
const resolveIndex = (form, clientY) => {
|
|
28381
28490
|
const wrappers = listFieldWrappers(form).filter((el) => fieldKeyOf(el) !== fieldDragRef.current?.key);
|
|
@@ -28416,7 +28525,7 @@ function OhhwellsBridge() {
|
|
|
28416
28525
|
window.removeEventListener("drop", onDrop, true);
|
|
28417
28526
|
};
|
|
28418
28527
|
}, [buildFieldDropSlots, isEditMode, persistFields, selectField]);
|
|
28419
|
-
|
|
28528
|
+
useEffect21(() => {
|
|
28420
28529
|
if (!isEditMode) return;
|
|
28421
28530
|
const mark = () => document.querySelectorAll('[data-ohw-editable="form"]').forEach((form) => {
|
|
28422
28531
|
markFormFields(form);
|
|
@@ -28428,7 +28537,7 @@ function OhhwellsBridge() {
|
|
|
28428
28537
|
});
|
|
28429
28538
|
return () => observer.disconnect();
|
|
28430
28539
|
}, [isEditMode, fetchState, pathname]);
|
|
28431
|
-
|
|
28540
|
+
useEffect21(() => {
|
|
28432
28541
|
if (!isEditMode) return;
|
|
28433
28542
|
let saveTimer = null;
|
|
28434
28543
|
const onInput = (e) => {
|
|
@@ -28450,14 +28559,14 @@ function OhhwellsBridge() {
|
|
|
28450
28559
|
document.addEventListener("input", onInput, true);
|
|
28451
28560
|
return () => document.removeEventListener("input", onInput, true);
|
|
28452
28561
|
}, [isEditMode, persistFields]);
|
|
28453
|
-
|
|
28562
|
+
useEffect21(() => {
|
|
28454
28563
|
if (isEditMode || fetchState !== "done") return;
|
|
28455
28564
|
const content = contentCache.get(subdomain) ?? {};
|
|
28456
28565
|
document.querySelectorAll('[data-ohw-editable="form"]').forEach((form) => {
|
|
28457
28566
|
reconcileFieldsFromContent(form, content);
|
|
28458
28567
|
});
|
|
28459
28568
|
}, [isEditMode, fetchState, subdomain]);
|
|
28460
|
-
|
|
28569
|
+
useEffect21(() => {
|
|
28461
28570
|
if (!isEditMode) return;
|
|
28462
28571
|
const swallow = (e) => {
|
|
28463
28572
|
const target = e.target;
|
|
@@ -28466,14 +28575,14 @@ function OhhwellsBridge() {
|
|
|
28466
28575
|
document.addEventListener("submit", swallow, true);
|
|
28467
28576
|
return () => document.removeEventListener("submit", swallow, true);
|
|
28468
28577
|
}, [isEditMode]);
|
|
28469
|
-
|
|
28578
|
+
useEffect21(() => {
|
|
28470
28579
|
if (isEditMode || fetchState !== "done") return;
|
|
28471
28580
|
console.log("env", process.env.NEXT_PUBLIC_FLOWOPS_API_URL);
|
|
28472
28581
|
const apiUrl = process.env.NEXT_PUBLIC_FLOWOPS_API_URL ?? "https://flowops-backend-staging-2yfdh7pwpq-as.a.run.app";
|
|
28473
28582
|
console.log({ apiUrl, subdomain });
|
|
28474
28583
|
bindPublishedForms(apiUrl, subdomain, contentCache.get(subdomain) ?? {});
|
|
28475
28584
|
}, [isEditMode, fetchState, subdomain]);
|
|
28476
|
-
|
|
28585
|
+
useEffect21(() => {
|
|
28477
28586
|
if (!subdomain || isEditMode) return;
|
|
28478
28587
|
let debounceTimer = null;
|
|
28479
28588
|
let observer = null;
|
|
@@ -28596,10 +28705,10 @@ function OhhwellsBridge() {
|
|
|
28596
28705
|
const visible = Boolean(subdomain) && fetchState !== "done";
|
|
28597
28706
|
el.style.display = visible ? "flex" : "none";
|
|
28598
28707
|
}, [subdomain, fetchState]);
|
|
28599
|
-
|
|
28708
|
+
useEffect21(() => {
|
|
28600
28709
|
postToParent2({ type: "ow:navigation", path: pathname });
|
|
28601
28710
|
}, [pathname, postToParent2]);
|
|
28602
|
-
|
|
28711
|
+
useEffect21(() => {
|
|
28603
28712
|
if (!subdomain || isEditMode) return;
|
|
28604
28713
|
const content = contentCache.get(subdomain);
|
|
28605
28714
|
if (!content) return;
|
|
@@ -28617,7 +28726,7 @@ function OhhwellsBridge() {
|
|
|
28617
28726
|
}
|
|
28618
28727
|
applyAiFooterFromContent(content);
|
|
28619
28728
|
}, [pathname, subdomain, isEditMode]);
|
|
28620
|
-
|
|
28729
|
+
useEffect21(() => {
|
|
28621
28730
|
if (!isEditMode) return;
|
|
28622
28731
|
if (linkPopoverSessionRef.current?.intent === "add-nav") return;
|
|
28623
28732
|
if (document.querySelector("[data-ohw-section-picker]")) return;
|
|
@@ -28625,12 +28734,12 @@ function OhhwellsBridge() {
|
|
|
28625
28734
|
deselectRef.current();
|
|
28626
28735
|
deactivateRef.current();
|
|
28627
28736
|
}, [pathname, isEditMode]);
|
|
28628
|
-
|
|
28737
|
+
useEffect21(() => {
|
|
28629
28738
|
if (!isEditMode) return;
|
|
28630
28739
|
initSectionInstancesFromContent(editContentRef.current, pathname);
|
|
28631
28740
|
initItemInstancesFromContent(editContentRef.current);
|
|
28632
28741
|
}, [pathname, isEditMode]);
|
|
28633
|
-
|
|
28742
|
+
useEffect21(() => {
|
|
28634
28743
|
if (!isEditMode) return;
|
|
28635
28744
|
const observer = new MutationObserver(() => {
|
|
28636
28745
|
const drawer = document.querySelector("[data-ohw-nav-drawer]");
|
|
@@ -28641,7 +28750,7 @@ function OhhwellsBridge() {
|
|
|
28641
28750
|
observer.observe(document.body, { childList: true, subtree: true });
|
|
28642
28751
|
return () => observer.disconnect();
|
|
28643
28752
|
}, [isEditMode, pathname]);
|
|
28644
|
-
|
|
28753
|
+
useEffect21(() => {
|
|
28645
28754
|
const contentForNav = () => {
|
|
28646
28755
|
if (isEditMode) return editContentRef.current;
|
|
28647
28756
|
if (!subdomain) return {};
|
|
@@ -28714,7 +28823,7 @@ function OhhwellsBridge() {
|
|
|
28714
28823
|
observer?.disconnect();
|
|
28715
28824
|
};
|
|
28716
28825
|
}, [isEditMode, pathname, subdomain, fetchState, resyncSelectedNavigationItem]);
|
|
28717
|
-
|
|
28826
|
+
useEffect21(() => {
|
|
28718
28827
|
if (!isEditMode) return;
|
|
28719
28828
|
let applying = false;
|
|
28720
28829
|
let rafId = null;
|
|
@@ -28752,7 +28861,7 @@ function OhhwellsBridge() {
|
|
|
28752
28861
|
observer.disconnect();
|
|
28753
28862
|
};
|
|
28754
28863
|
}, [isEditMode, pathname]);
|
|
28755
|
-
|
|
28864
|
+
useEffect21(() => {
|
|
28756
28865
|
if (!isEditMode) return;
|
|
28757
28866
|
let lastPosted = 0;
|
|
28758
28867
|
const measure = () => {
|
|
@@ -28796,7 +28905,7 @@ function OhhwellsBridge() {
|
|
|
28796
28905
|
window.removeEventListener("resize", handleResize);
|
|
28797
28906
|
};
|
|
28798
28907
|
}, [pathname, isEditMode, postToParent2]);
|
|
28799
|
-
|
|
28908
|
+
useEffect21(() => {
|
|
28800
28909
|
if (isEditMode) return;
|
|
28801
28910
|
const handleClick = (e) => {
|
|
28802
28911
|
if (!isPlainLeftClick(e)) return;
|
|
@@ -28810,7 +28919,7 @@ function OhhwellsBridge() {
|
|
|
28810
28919
|
document.addEventListener("click", handleClick, true);
|
|
28811
28920
|
return () => document.removeEventListener("click", handleClick, true);
|
|
28812
28921
|
}, [isEditMode, router, pathname]);
|
|
28813
|
-
|
|
28922
|
+
useEffect21(() => {
|
|
28814
28923
|
if (!isEditMode) {
|
|
28815
28924
|
editStylesRef.current?.base.remove();
|
|
28816
28925
|
editStylesRef.current?.forceHover.remove();
|
|
@@ -32291,7 +32400,7 @@ function OhhwellsBridge() {
|
|
|
32291
32400
|
if (imageShowTimerRef.current) clearTimeout(imageShowTimerRef.current);
|
|
32292
32401
|
};
|
|
32293
32402
|
}, [isEditMode, refreshStateRules]);
|
|
32294
|
-
|
|
32403
|
+
useEffect21(() => {
|
|
32295
32404
|
if (!isEditMode) return;
|
|
32296
32405
|
const THRESHOLD = 10;
|
|
32297
32406
|
const resolveWasSelected = (el) => {
|
|
@@ -32447,7 +32556,7 @@ function OhhwellsBridge() {
|
|
|
32447
32556
|
unlockFooterDragInteraction();
|
|
32448
32557
|
};
|
|
32449
32558
|
}, [isEditMode]);
|
|
32450
|
-
|
|
32559
|
+
useEffect21(() => {
|
|
32451
32560
|
if (!isEditMode) return;
|
|
32452
32561
|
const THRESHOLD = 10;
|
|
32453
32562
|
const onPointerDown = (e) => {
|
|
@@ -32538,7 +32647,7 @@ function OhhwellsBridge() {
|
|
|
32538
32647
|
document.removeEventListener("selectstart", blockSelectStart, true);
|
|
32539
32648
|
};
|
|
32540
32649
|
}, [isEditMode, persistButtonCollectionDrag, refreshButtonDragVisuals]);
|
|
32541
|
-
|
|
32650
|
+
useEffect21(() => {
|
|
32542
32651
|
const handler = (e) => {
|
|
32543
32652
|
if (e.data?.type !== "ow:request-schedule-config") return;
|
|
32544
32653
|
const insertAfterVal = e.data.insertAfter;
|
|
@@ -32554,7 +32663,7 @@ function OhhwellsBridge() {
|
|
|
32554
32663
|
window.addEventListener("message", handler);
|
|
32555
32664
|
return () => window.removeEventListener("message", handler);
|
|
32556
32665
|
}, [processConfigRequest]);
|
|
32557
|
-
|
|
32666
|
+
useEffect21(() => {
|
|
32558
32667
|
if (!isEditMode) return;
|
|
32559
32668
|
document.querySelectorAll("[data-ohw-active-state]").forEach((el) => {
|
|
32560
32669
|
el.removeAttribute("data-ohw-active-state");
|
|
@@ -32578,7 +32687,7 @@ function OhhwellsBridge() {
|
|
|
32578
32687
|
postToParent2({
|
|
32579
32688
|
type: "ow:ready",
|
|
32580
32689
|
version: "1",
|
|
32581
|
-
bridgeVersion: "0.1.
|
|
32690
|
+
bridgeVersion: "0.1.167",
|
|
32582
32691
|
path: pathname,
|
|
32583
32692
|
nodes: collectEditableNodes(editContentRef.current),
|
|
32584
32693
|
sections
|
|
@@ -32590,7 +32699,7 @@ function OhhwellsBridge() {
|
|
|
32590
32699
|
clearTimeout(timer);
|
|
32591
32700
|
};
|
|
32592
32701
|
}, [pathname, isEditMode, refreshStateRules, postToParent2]);
|
|
32593
|
-
|
|
32702
|
+
useEffect21(() => {
|
|
32594
32703
|
scrollToHashSectionWhenReady();
|
|
32595
32704
|
const onHashChange = () => scrollToHashSectionWhenReady();
|
|
32596
32705
|
window.addEventListener("hashchange", onHashChange);
|
|
@@ -32632,7 +32741,7 @@ function OhhwellsBridge() {
|
|
|
32632
32741
|
if (el) setToolbarRect(getEditMeasureEl(el).getBoundingClientRect());
|
|
32633
32742
|
refreshActiveCommandsRef.current();
|
|
32634
32743
|
}, []);
|
|
32635
|
-
|
|
32744
|
+
useEffect21(() => {
|
|
32636
32745
|
const session = floatingPanel && floatingPanel.kind === "logo-size" ? floatingPanel : null;
|
|
32637
32746
|
if (!session || !logoSizeDraft) return;
|
|
32638
32747
|
const onPanelAction = (e) => {
|
|
@@ -33828,6 +33937,8 @@ export {
|
|
|
33828
33937
|
serializeAiFooterState,
|
|
33829
33938
|
shouldFetchContentForPath,
|
|
33830
33939
|
stepViableSlide,
|
|
33940
|
+
stripPlaceholderText,
|
|
33941
|
+
stripPlaceholders,
|
|
33831
33942
|
stripTextAlignCss,
|
|
33832
33943
|
toggleVariants,
|
|
33833
33944
|
useOhwCarousel,
|