@flamingo-stack/openframe-frontend-core 0.0.705 → 0.0.706-snapshot.20261006190707
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/{chunk-4KX6OED2.cjs → chunk-2G7UYK35.cjs} +46 -46
- package/dist/{chunk-KOWVJD4V.cjs → chunk-2KXTOP6G.cjs} +70 -57
- package/dist/{chunk-A75QY6CD.cjs → chunk-2RNB5DTN.cjs} +21 -21
- package/dist/{chunk-PN2RKPDF.js → chunk-36BCTE7D.js} +10 -10
- package/dist/{chunk-ZSAGLQOD.cjs → chunk-3AHTOSXJ.cjs} +17 -17
- package/dist/{chunk-VR2ZLFCP.js → chunk-4IBPRIQH.js} +1 -1
- package/dist/{chunk-FCGC42TS.js → chunk-4L6XCMOU.js} +66 -62
- package/dist/{chunk-X5MQ7JRP.js → chunk-4UM2ETLM.js} +9 -9
- package/dist/{chunk-6NJKKO73.cjs → chunk-6I4ZAFO2.cjs} +15 -15
- package/dist/{chunk-RBDP4WDE.js → chunk-6IW7TWPV.js} +6 -6
- package/dist/{chunk-MMOODW57.cjs → chunk-6NTPY5QA.cjs} +1887 -94
- package/dist/{chunk-QFXRPRFT.js → chunk-6YKAT7NV.js} +3 -3
- package/dist/{chunk-HPWWNJE7.cjs → chunk-AOWDNSTM.cjs} +89 -89
- package/dist/{chunk-IHERL5V4.cjs → chunk-B73373AG.cjs} +34 -34
- package/dist/{chunk-DENB2XJC.js → chunk-CNWOMQQJ.js} +2 -2
- package/dist/{chunk-MP2C3LJ4.js → chunk-CUME3VTQ.js} +1 -1
- package/dist/{chunk-PDWVPI3S.js → chunk-CZ7Y7UG4.js} +4 -72
- package/dist/{chunk-YHM5AWTT.js → chunk-CZSZSDD4.js} +6 -6
- package/dist/{chunk-F6I6XZMN.js → chunk-DA5UDTLG.js} +5 -5
- package/dist/{chunk-MFFCUVWG.js → chunk-F57ECE2I.js} +1 -1
- package/dist/{chunk-CH5232HV.js → chunk-FI6GMDO7.js} +2455 -662
- package/dist/{chunk-NDESEPW5.js → chunk-FXJ3WWUB.js} +68 -0
- package/dist/{chunk-G5A3PSPV.js → chunk-HDOYSEOJ.js} +1080 -691
- package/dist/{chunk-VA5T32XA.js → chunk-I3ST4PLM.js} +2 -2
- package/dist/{chunk-5HBHO5TB.js → chunk-JPG7OHEG.js} +1 -1
- package/dist/{chunk-YFBM2K6X.cjs → chunk-JRU2CXLB.cjs} +4 -4
- package/dist/{chunk-MKXO4Q5P.js → chunk-KUC673HM.js} +383 -142
- package/dist/{chunk-JEZKGCZI.cjs → chunk-L6Y6OOKG.cjs} +26 -26
- package/dist/{chunk-F6AFPNDF.js → chunk-LFFB6EMB.js} +29 -16
- package/dist/{chunk-X72J4ACL.cjs → chunk-LLSUVPQC.cjs} +252 -8
- package/dist/{chunk-RKV5B7EU.cjs → chunk-LM7TXMLU.cjs} +72 -4
- package/dist/{chunk-6SEANMOU.js → chunk-LNW45N2C.js} +11 -11
- package/dist/{chunk-OUY3HHW6.cjs → chunk-LRQTJOF2.cjs} +928 -539
- package/dist/{chunk-DW7G4KG3.js → chunk-MR3A4MZV.js} +3 -3
- package/dist/{chunk-2YXVWZVF.js → chunk-N45D4ZXQ.js} +959 -715
- package/dist/{chunk-Z2VNQQ74.js → chunk-NCPTID44.js} +978 -942
- package/dist/{chunk-WA6GUYQ4.cjs → chunk-NSGXARGJ.cjs} +104 -104
- package/dist/{chunk-ABU3TGXA.cjs → chunk-OF6GEI5A.cjs} +3 -3
- package/dist/{chunk-IKTQ3ZAG.cjs → chunk-OJLR5MEO.cjs} +6 -6
- package/dist/{chunk-VESKITRQ.cjs → chunk-P42V6N34.cjs} +736 -732
- package/dist/{chunk-OHFS7VOU.cjs → chunk-PLYEKV3N.cjs} +2 -2
- package/dist/{chunk-7VVFKJY5.js → chunk-PO33GZVY.js} +1799 -3449
- package/dist/{chunk-7LS22BZU.cjs → chunk-QAOFMK2A.cjs} +14 -14
- package/dist/{chunk-VHCACDKP.cjs → chunk-RQRX4YC3.cjs} +39 -39
- package/dist/{chunk-3MX5S4CF.cjs → chunk-SEXWHIMS.cjs} +899 -2549
- package/dist/{chunk-AQWZNP6A.js → chunk-SS5MBHDP.js} +4 -4
- package/dist/{chunk-ZSAO2HBW.js → chunk-TDYIREDJ.js} +15 -15
- package/dist/{chunk-XOYH2YQE.cjs → chunk-UDFRUKLC.cjs} +2 -2
- package/dist/{chunk-TYWLNCNH.cjs → chunk-UVTD52MD.cjs} +14 -82
- package/dist/{chunk-N3COXDBH.cjs → chunk-VX4E6YSB.cjs} +41 -5
- package/dist/{chunk-2QEUFXNS.cjs → chunk-WCVZCGK5.cjs} +312 -71
- package/dist/{chunk-6XIF2Z7I.js → chunk-WMX26HB5.js} +3 -3
- package/dist/{chunk-D7BTSVMS.cjs → chunk-Y2GSOUCS.cjs} +2 -2
- package/dist/{chunk-4I45Y3DN.cjs → chunk-YBUT4AMG.cjs} +6 -6
- package/dist/components/case-studies/index.cjs +30 -32
- package/dist/components/case-studies/index.js +14 -16
- package/dist/components/chat/entity-cards/case-study-card.d.ts +11 -4
- package/dist/components/chat/entity-cards/case-study-card.d.ts.map +1 -1
- package/dist/components/chat/index.cjs +11 -11
- package/dist/components/chat/index.d.ts +1 -1
- package/dist/components/chat/index.d.ts.map +1 -1
- package/dist/components/chat/index.js +16 -16
- package/dist/components/chat/nav-link-anchor-via-runtime.d.ts +34 -5
- package/dist/components/chat/nav-link-anchor-via-runtime.d.ts.map +1 -1
- package/dist/components/chat/utils/icon-library.d.ts.map +1 -1
- package/dist/components/contact/index.cjs +12 -14
- package/dist/components/contact/index.js +11 -13
- package/dist/components/docs/index.cjs +15 -17
- package/dist/components/docs/index.js +14 -16
- package/dist/components/embeds/index.cjs +12 -14
- package/dist/components/embeds/index.js +11 -13
- package/dist/components/faq/index.cjs +13 -15
- package/dist/components/faq/index.js +12 -14
- package/dist/components/features/index.cjs +12 -14
- package/dist/components/features/index.js +21 -23
- package/dist/components/help-center-pages/index.cjs +118 -120
- package/dist/components/help-center-pages/index.js +33 -35
- package/dist/components/icons/index.cjs +3 -5
- package/dist/components/icons/index.js +9 -11
- package/dist/components/icons-v2-generated/index.cjs +3 -5
- package/dist/components/icons-v2-generated/index.js +2 -4
- package/dist/components/index.cjs +87 -158
- package/dist/components/index.d.ts +0 -2
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/index.js +331 -402
- package/dist/components/loading/page-layout-skeleton.d.ts +1 -1
- package/dist/components/meeting-scheduler/index.cjs +62 -64
- package/dist/components/meeting-scheduler/index.js +12 -14
- package/dist/components/navigation/index.cjs +28 -16
- package/dist/components/navigation/index.d.ts +14 -10
- package/dist/components/navigation/index.d.ts.map +1 -1
- package/dist/components/navigation/index.js +38 -26
- package/dist/components/navigation/mingo-ai-button.d.ts +38 -3
- package/dist/components/navigation/mingo-ai-button.d.ts.map +1 -1
- package/dist/components/navigation/mobile-nav-sheet-id.d.ts +3 -0
- package/dist/components/navigation/mobile-nav-sheet-id.d.ts.map +1 -0
- package/dist/components/navigation/mobile-nav-sheet.d.ts +48 -0
- package/dist/components/navigation/mobile-nav-sheet.d.ts.map +1 -0
- package/dist/components/navigation/nav-item-row.d.ts +27 -0
- package/dist/components/navigation/nav-item-row.d.ts.map +1 -0
- package/dist/components/navigation/nav-panel.d.ts +43 -0
- package/dist/components/navigation/nav-panel.d.ts.map +1 -0
- package/dist/components/navigation/navigation-sidebar-item.d.ts +1 -2
- package/dist/components/navigation/navigation-sidebar-item.d.ts.map +1 -1
- package/dist/components/navigation/site-footer.d.ts +28 -0
- package/dist/components/navigation/site-footer.d.ts.map +1 -0
- package/dist/components/navigation/site-header.d.ts +61 -0
- package/dist/components/navigation/site-header.d.ts.map +1 -0
- package/dist/components/navigation/site-nav-link.d.ts +26 -0
- package/dist/components/navigation/site-nav-link.d.ts.map +1 -0
- package/dist/components/navigation/top-navigation.d.ts +2 -2
- package/dist/components/navigation/top-navigation.d.ts.map +1 -1
- package/dist/components/onboarding-guides/index.cjs +15 -17
- package/dist/components/onboarding-guides/index.js +14 -16
- package/dist/components/platform/ToolBadge.d.ts +6 -0
- package/dist/components/platform/ToolBadge.d.ts.map +1 -1
- package/dist/components/related-content/index.cjs +10 -8
- package/dist/components/related-content/index.js +9 -7
- package/dist/components/tickets/index.cjs +16 -18
- package/dist/components/tickets/index.js +15 -17
- package/dist/components/ui/brand-association-card.d.ts +7 -0
- package/dist/components/ui/brand-association-card.d.ts.map +1 -1
- package/dist/components/ui/index.cjs +14 -14
- package/dist/components/ui/index.js +19 -19
- package/dist/hooks/index.cjs +19 -11
- package/dist/hooks/index.d.ts +1 -0
- package/dist/hooks/index.d.ts.map +1 -1
- package/dist/hooks/index.js +19 -11
- package/dist/hooks/ui/index.d.ts +3 -0
- package/dist/hooks/ui/index.d.ts.map +1 -1
- package/dist/hooks/ui/use-active-section.d.ts +10 -0
- package/dist/hooks/ui/use-active-section.d.ts.map +1 -0
- package/dist/hooks/ui/use-nav-menus.d.ts +48 -0
- package/dist/hooks/ui/use-nav-menus.d.ts.map +1 -0
- package/dist/hooks/ui/use-visitor-os.d.ts +15 -0
- package/dist/hooks/ui/use-visitor-os.d.ts.map +1 -0
- package/dist/hooks/use-location-hash.d.ts +9 -0
- package/dist/hooks/use-location-hash.d.ts.map +1 -0
- package/dist/index.cjs +56 -21
- package/dist/index.js +231 -196
- package/dist/types/case-study.d.ts +9 -0
- package/dist/types/case-study.d.ts.map +1 -1
- package/dist/types/navigation.d.ts +95 -65
- package/dist/types/navigation.d.ts.map +1 -1
- package/dist/utils/index.cjs +55 -0
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/index.js +50 -1
- package/dist/utils/source-icons.d.ts.map +1 -1
- package/dist/utils/visitor-os.d.ts +45 -0
- package/dist/utils/visitor-os.d.ts.map +1 -0
- package/package.json +1 -1
- package/src/components/chat/entity-cards/case-study-card.tsx +115 -5
- package/src/components/chat/index.ts +7 -1
- package/src/components/chat/nav-link-anchor-via-runtime.tsx +62 -9
- package/src/components/chat/utils/icon-library.tsx +35 -1
- package/src/components/index.ts +0 -2
- package/src/components/loading/page-layout-skeleton.tsx +1 -1
- package/src/components/navigation/index.ts +21 -14
- package/src/components/navigation/mingo-ai-button.tsx +139 -63
- package/src/components/navigation/mobile-nav-sheet-id.ts +2 -0
- package/src/components/navigation/mobile-nav-sheet.tsx +241 -0
- package/src/components/navigation/nav-item-row.tsx +129 -0
- package/src/components/navigation/nav-panel.tsx +196 -0
- package/src/components/navigation/navigation-sidebar-item.tsx +1 -2
- package/src/components/navigation/site-footer.tsx +256 -0
- package/src/components/navigation/site-header.tsx +339 -0
- package/src/components/navigation/site-nav-link.tsx +41 -0
- package/src/components/navigation/ticket-alerts-button.tsx +2 -2
- package/src/components/navigation/top-navigation.tsx +2 -2
- package/src/components/platform/ToolBadge.tsx +18 -1
- package/src/components/ui/brand-association-card.tsx +25 -3
- package/src/hooks/index.ts +1 -0
- package/src/hooks/ui/index.ts +3 -0
- package/src/hooks/ui/use-active-section.ts +44 -0
- package/src/hooks/ui/use-nav-menus.ts +200 -0
- package/src/hooks/ui/use-visitor-os.ts +33 -0
- package/src/hooks/use-location-hash.ts +34 -0
- package/src/styles/chat-animations.css +57 -2
- package/src/types/case-study.ts +16 -0
- package/src/types/navigation.ts +80 -66
- package/src/utils/index.ts +1 -0
- package/src/utils/source-icons.ts +13 -0
- package/src/utils/visitor-os.ts +84 -0
- package/dist/chunk-LMBC5FFP.js +0 -43
- package/dist/chunk-O43V3EOS.js +0 -252
- package/dist/chunk-QZVSJF2K.cjs +0 -252
- package/dist/chunk-RALRPFDW.cjs +0 -43
- package/dist/components/footer-waitlist-button.d.ts +0 -29
- package/dist/components/footer-waitlist-button.d.ts.map +0 -1
- package/dist/components/footer.d.ts +0 -47
- package/dist/components/footer.d.ts.map +0 -1
- package/dist/components/navigation/client-only-header.d.ts +0 -8
- package/dist/components/navigation/client-only-header.d.ts.map +0 -1
- package/dist/components/navigation/header-skeleton.d.ts +0 -12
- package/dist/components/navigation/header-skeleton.d.ts.map +0 -1
- package/dist/components/navigation/header.d.ts +0 -9
- package/dist/components/navigation/header.d.ts.map +0 -1
- package/dist/components/navigation/mobile-nav-panel.d.ts +0 -10
- package/dist/components/navigation/mobile-nav-panel.d.ts.map +0 -1
- package/src/components/footer-waitlist-button.tsx +0 -53
- package/src/components/footer.tsx +0 -195
- package/src/components/navigation/client-only-header.tsx +0 -22
- package/src/components/navigation/header-skeleton.tsx +0 -74
- package/src/components/navigation/header.tsx +0 -429
- package/src/components/navigation/mobile-nav-panel.tsx +0 -155
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
parseSchemaParams,
|
|
10
10
|
positiveInt,
|
|
11
11
|
shouldIncludeInUrl
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-CUME3VTQ.js";
|
|
13
13
|
import {
|
|
14
14
|
ToolIcon,
|
|
15
15
|
apiErrorMessage,
|
|
@@ -18,30 +18,28 @@ import {
|
|
|
18
18
|
scrollElementIntoView,
|
|
19
19
|
useAutoplay,
|
|
20
20
|
useDebounce
|
|
21
|
-
} from "./chunk-
|
|
21
|
+
} from "./chunk-CZ7Y7UG4.js";
|
|
22
22
|
import {
|
|
23
23
|
useRouter,
|
|
24
24
|
useSearchParams
|
|
25
25
|
} from "./chunk-GY4IZG22.js";
|
|
26
|
-
import {
|
|
27
|
-
FlamingoLogo,
|
|
28
|
-
MlgLogo,
|
|
29
|
-
OpenmspLogo
|
|
30
|
-
} from "./chunk-2YXVWZVF.js";
|
|
31
|
-
import {
|
|
32
|
-
Chevron02DownIcon,
|
|
33
|
-
XmarkIcon
|
|
34
|
-
} from "./chunk-Z2VNQQ74.js";
|
|
35
26
|
import {
|
|
36
27
|
breakpoints,
|
|
37
28
|
createLocalStorageAdapter,
|
|
38
29
|
getPlatformBrandClasses,
|
|
39
30
|
useMediaQuery
|
|
40
|
-
} from "./chunk-
|
|
31
|
+
} from "./chunk-FXJ3WWUB.js";
|
|
41
32
|
import {
|
|
33
|
+
FlamingoLogo,
|
|
42
34
|
MiamiCyberGangLogoFaceOnly,
|
|
43
|
-
|
|
44
|
-
|
|
35
|
+
MlgLogo,
|
|
36
|
+
OpenFrameLogo,
|
|
37
|
+
OpenmspLogo
|
|
38
|
+
} from "./chunk-N45D4ZXQ.js";
|
|
39
|
+
import {
|
|
40
|
+
Chevron02DownIcon,
|
|
41
|
+
XmarkIcon
|
|
42
|
+
} from "./chunk-NCPTID44.js";
|
|
45
43
|
import {
|
|
46
44
|
cn
|
|
47
45
|
} from "./chunk-7RXWKTAP.js";
|
|
@@ -897,8 +895,219 @@ function useWindowSize() {
|
|
|
897
895
|
// src/hooks/ui/index.ts
|
|
898
896
|
import { usePreventScroll } from "@react-aria/overlays";
|
|
899
897
|
|
|
898
|
+
// src/hooks/ui/use-active-section.ts
|
|
899
|
+
import { useMemo as useMemo3 } from "react";
|
|
900
|
+
function pathOf(href) {
|
|
901
|
+
if (!href || !href.startsWith("/") || href.startsWith("//")) return null;
|
|
902
|
+
const path = href.split(/[?#]/)[0];
|
|
903
|
+
return path.length > 1 ? path.replace(/\/+$/, "") : "/";
|
|
904
|
+
}
|
|
905
|
+
function prefixHolds(prefix, pathname) {
|
|
906
|
+
if (prefix === "/") return pathname === "/";
|
|
907
|
+
return pathname === prefix || pathname.startsWith(`${prefix}/`);
|
|
908
|
+
}
|
|
909
|
+
function resolveActiveSection(menus, pathname) {
|
|
910
|
+
const current = pathOf(pathname ?? void 0);
|
|
911
|
+
if (!current) return null;
|
|
912
|
+
let best = null;
|
|
913
|
+
for (const menu of menus) {
|
|
914
|
+
const prefixes = menu.match?.length ? menu.match : [menu.href];
|
|
915
|
+
for (const raw of prefixes) {
|
|
916
|
+
const prefix = pathOf(raw);
|
|
917
|
+
if (!prefix || !prefixHolds(prefix, current)) continue;
|
|
918
|
+
if (!best || prefix.length > best.length) best = { id: menu.id, length: prefix.length };
|
|
919
|
+
}
|
|
920
|
+
}
|
|
921
|
+
return best?.id ?? null;
|
|
922
|
+
}
|
|
923
|
+
function useActiveSection(menus, pathname) {
|
|
924
|
+
return useMemo3(() => resolveActiveSection(menus, pathname), [menus, pathname]);
|
|
925
|
+
}
|
|
926
|
+
|
|
927
|
+
// src/hooks/ui/use-nav-menus.ts
|
|
928
|
+
import {
|
|
929
|
+
useCallback as useCallback8,
|
|
930
|
+
useEffect as useEffect10,
|
|
931
|
+
useId,
|
|
932
|
+
useRef as useRef8,
|
|
933
|
+
useState as useState10
|
|
934
|
+
} from "react";
|
|
935
|
+
function useNavMenus({
|
|
936
|
+
pathname,
|
|
937
|
+
hoverOpenMs = 150,
|
|
938
|
+
hoverCloseMs = 300
|
|
939
|
+
}) {
|
|
940
|
+
const baseId = useId();
|
|
941
|
+
const [opened, setOpened] = useState10(null);
|
|
942
|
+
const stale = opened !== null && opened.pathname !== pathname;
|
|
943
|
+
if (stale) setOpened(null);
|
|
944
|
+
const openId = opened && !stale ? opened.id : null;
|
|
945
|
+
const triggers = useRef8(/* @__PURE__ */ new Map());
|
|
946
|
+
const panels = useRef8(/* @__PURE__ */ new Map());
|
|
947
|
+
const openTimer = useRef8(null);
|
|
948
|
+
const closeTimer = useRef8(null);
|
|
949
|
+
const openedByHover = useRef8(null);
|
|
950
|
+
const clearTimers = useCallback8(() => {
|
|
951
|
+
if (openTimer.current) clearTimeout(openTimer.current);
|
|
952
|
+
if (closeTimer.current) clearTimeout(closeTimer.current);
|
|
953
|
+
openTimer.current = null;
|
|
954
|
+
closeTimer.current = null;
|
|
955
|
+
}, []);
|
|
956
|
+
useEffect10(() => clearTimers, [clearTimers]);
|
|
957
|
+
const close = useCallback8(() => {
|
|
958
|
+
clearTimers();
|
|
959
|
+
setOpened(null);
|
|
960
|
+
}, [clearTimers]);
|
|
961
|
+
const cancelClose = useCallback8(() => {
|
|
962
|
+
if (closeTimer.current) clearTimeout(closeTimer.current);
|
|
963
|
+
closeTimer.current = null;
|
|
964
|
+
}, []);
|
|
965
|
+
const scheduleClose = useCallback8(() => {
|
|
966
|
+
if (openTimer.current) clearTimeout(openTimer.current);
|
|
967
|
+
openTimer.current = null;
|
|
968
|
+
cancelClose();
|
|
969
|
+
closeTimer.current = setTimeout(() => {
|
|
970
|
+
closeTimer.current = null;
|
|
971
|
+
setOpened(null);
|
|
972
|
+
}, hoverCloseMs);
|
|
973
|
+
}, [cancelClose, hoverCloseMs]);
|
|
974
|
+
useEffect10(() => {
|
|
975
|
+
if (!openId) return void 0;
|
|
976
|
+
const handleKeyDown = (event) => {
|
|
977
|
+
if (event.key !== "Escape") return;
|
|
978
|
+
const trigger = triggers.current.get(openId);
|
|
979
|
+
close();
|
|
980
|
+
trigger?.focus({ preventScroll: true });
|
|
981
|
+
};
|
|
982
|
+
const handlePointerDown = (event) => {
|
|
983
|
+
const target = event.target;
|
|
984
|
+
if (!(target instanceof Node)) return;
|
|
985
|
+
for (const el of triggers.current.values()) if (el.contains(target)) return;
|
|
986
|
+
for (const el of panels.current.values()) if (el.contains(target)) return;
|
|
987
|
+
close();
|
|
988
|
+
};
|
|
989
|
+
document.addEventListener("keydown", handleKeyDown);
|
|
990
|
+
document.addEventListener("pointerdown", handlePointerDown);
|
|
991
|
+
return () => {
|
|
992
|
+
document.removeEventListener("keydown", handleKeyDown);
|
|
993
|
+
document.removeEventListener("pointerdown", handlePointerDown);
|
|
994
|
+
};
|
|
995
|
+
}, [openId, close]);
|
|
996
|
+
const getTriggerProps = useCallback8(
|
|
997
|
+
(id) => ({
|
|
998
|
+
ref: (el) => {
|
|
999
|
+
if (el) triggers.current.set(id, el);
|
|
1000
|
+
else triggers.current.delete(id);
|
|
1001
|
+
},
|
|
1002
|
+
"aria-expanded": openId === id,
|
|
1003
|
+
"aria-controls": `${baseId}-panel-${id}`,
|
|
1004
|
+
onClick: () => {
|
|
1005
|
+
clearTimers();
|
|
1006
|
+
const hovered = openedByHover.current === id;
|
|
1007
|
+
openedByHover.current = null;
|
|
1008
|
+
if (hovered) {
|
|
1009
|
+
setOpened({ id, pathname });
|
|
1010
|
+
return;
|
|
1011
|
+
}
|
|
1012
|
+
setOpened((prev) => prev && prev.id === id && prev.pathname === pathname ? null : { id, pathname });
|
|
1013
|
+
},
|
|
1014
|
+
onMouseEnter: () => {
|
|
1015
|
+
clearTimers();
|
|
1016
|
+
if (openId === id) return;
|
|
1017
|
+
if (openId !== null) {
|
|
1018
|
+
openedByHover.current = id;
|
|
1019
|
+
setOpened({ id, pathname });
|
|
1020
|
+
return;
|
|
1021
|
+
}
|
|
1022
|
+
openTimer.current = setTimeout(() => {
|
|
1023
|
+
openTimer.current = null;
|
|
1024
|
+
openedByHover.current = id;
|
|
1025
|
+
setOpened({ id, pathname });
|
|
1026
|
+
}, hoverOpenMs);
|
|
1027
|
+
},
|
|
1028
|
+
onMouseLeave: scheduleClose
|
|
1029
|
+
}),
|
|
1030
|
+
[baseId, openId, pathname, hoverOpenMs, clearTimers, scheduleClose]
|
|
1031
|
+
);
|
|
1032
|
+
const getPanelProps = useCallback8(
|
|
1033
|
+
(id) => ({
|
|
1034
|
+
ref: (el) => {
|
|
1035
|
+
if (el) panels.current.set(id, el);
|
|
1036
|
+
else panels.current.delete(id);
|
|
1037
|
+
},
|
|
1038
|
+
id: `${baseId}-panel-${id}`,
|
|
1039
|
+
inert: openId !== id,
|
|
1040
|
+
"data-state": openId === id ? "open" : "closed",
|
|
1041
|
+
onMouseEnter: cancelClose,
|
|
1042
|
+
onMouseLeave: scheduleClose
|
|
1043
|
+
}),
|
|
1044
|
+
[baseId, openId, cancelClose, scheduleClose]
|
|
1045
|
+
);
|
|
1046
|
+
return { openId, close, getTriggerProps, getPanelProps };
|
|
1047
|
+
}
|
|
1048
|
+
|
|
1049
|
+
// src/hooks/ui/use-visitor-os.ts
|
|
1050
|
+
import { useSyncExternalStore as useSyncExternalStore2 } from "react";
|
|
1051
|
+
|
|
1052
|
+
// src/utils/visitor-os.ts
|
|
1053
|
+
var DESKTOP_OSES = ["mac", "windows", "linux"];
|
|
1054
|
+
var HINT_PLATFORMS = {
|
|
1055
|
+
macos: "mac",
|
|
1056
|
+
windows: "windows",
|
|
1057
|
+
linux: "linux",
|
|
1058
|
+
"chrome os": "linux",
|
|
1059
|
+
"chromium os": "linux",
|
|
1060
|
+
android: "android",
|
|
1061
|
+
ios: "ios"
|
|
1062
|
+
};
|
|
1063
|
+
function detectVisitorOs(userAgent, hints = {}) {
|
|
1064
|
+
const touchMac = (os) => os === "mac" && (hints.maxTouchPoints ?? 0) > 1 ? "ios" : os;
|
|
1065
|
+
const hinted = HINT_PLATFORMS[(hints.platform ?? "").replace(/"/g, "").trim().toLowerCase()];
|
|
1066
|
+
if (hinted) return touchMac(hinted);
|
|
1067
|
+
const ua = userAgent ?? "";
|
|
1068
|
+
if (!ua) return null;
|
|
1069
|
+
if (/iPhone|iPad|iPod/i.test(ua)) return "ios";
|
|
1070
|
+
if (/Android/i.test(ua)) return "android";
|
|
1071
|
+
if (/Windows NT|Win64|Win32/i.test(ua)) return "windows";
|
|
1072
|
+
if (/Macintosh|Mac OS X/i.test(ua)) return touchMac("mac");
|
|
1073
|
+
if (/Linux|X11|CrOS/i.test(ua)) return "linux";
|
|
1074
|
+
return null;
|
|
1075
|
+
}
|
|
1076
|
+
function desktopOsOf(os) {
|
|
1077
|
+
return os !== null && DESKTOP_OSES.includes(os) ? os : null;
|
|
1078
|
+
}
|
|
1079
|
+
function detectDesktopOs(userAgent, hints) {
|
|
1080
|
+
return desktopOsOf(detectVisitorOs(userAgent, hints));
|
|
1081
|
+
}
|
|
1082
|
+
function usesCommandKey(os) {
|
|
1083
|
+
return os === "mac" || os === "ios";
|
|
1084
|
+
}
|
|
1085
|
+
function shortcutLabel(os, key) {
|
|
1086
|
+
return usesCommandKey(os) ? `\u2318${key}` : `Ctrl ${key}`;
|
|
1087
|
+
}
|
|
1088
|
+
|
|
1089
|
+
// src/hooks/ui/use-visitor-os.ts
|
|
1090
|
+
var UNKNOWN = { known: false, os: null };
|
|
1091
|
+
var KNOWN = /* @__PURE__ */ new Map();
|
|
1092
|
+
var subscribe2 = () => () => {
|
|
1093
|
+
};
|
|
1094
|
+
var getServerSnapshot = () => UNKNOWN;
|
|
1095
|
+
function getSnapshot() {
|
|
1096
|
+
const stated = navigator.userAgentData?.platform;
|
|
1097
|
+
const os = detectVisitorOs(navigator.userAgent, { platform: stated, maxTouchPoints: navigator.maxTouchPoints });
|
|
1098
|
+
let state = KNOWN.get(os);
|
|
1099
|
+
if (!state) {
|
|
1100
|
+
state = { known: true, os };
|
|
1101
|
+
KNOWN.set(os, state);
|
|
1102
|
+
}
|
|
1103
|
+
return state;
|
|
1104
|
+
}
|
|
1105
|
+
function useVisitorOs() {
|
|
1106
|
+
return useSyncExternalStore2(subscribe2, getSnapshot, getServerSnapshot);
|
|
1107
|
+
}
|
|
1108
|
+
|
|
900
1109
|
// src/hooks/platform/use-platform-config.ts
|
|
901
|
-
import { useState as
|
|
1110
|
+
import { useState as useState11, useEffect as useEffect11 } from "react";
|
|
902
1111
|
|
|
903
1112
|
// src/utils/platform-config.tsx
|
|
904
1113
|
import { Globe } from "lucide-react";
|
|
@@ -1011,10 +1220,10 @@ function toPlatformConfigs(payload) {
|
|
|
1011
1220
|
return configs;
|
|
1012
1221
|
}
|
|
1013
1222
|
function usePlatformConfig() {
|
|
1014
|
-
const [platforms, setPlatforms] =
|
|
1015
|
-
const [isLoading, setIsLoading] =
|
|
1016
|
-
const [error, setError] =
|
|
1017
|
-
|
|
1223
|
+
const [platforms, setPlatforms] = useState11(platformCache || []);
|
|
1224
|
+
const [isLoading, setIsLoading] = useState11(!platformCache);
|
|
1225
|
+
const [error, setError] = useState11(null);
|
|
1226
|
+
useEffect11(() => {
|
|
1018
1227
|
const commit = (data) => {
|
|
1019
1228
|
setPlatforms((prev) => prev === data ? prev : data);
|
|
1020
1229
|
setIsLoading(false);
|
|
@@ -1082,7 +1291,7 @@ function useValidatePlatform(value) {
|
|
|
1082
1291
|
import { toast as sonnerToast2 } from "sonner";
|
|
1083
1292
|
|
|
1084
1293
|
// src/components/ui/toaster.tsx
|
|
1085
|
-
import { useState as
|
|
1294
|
+
import { useState as useState12 } from "react";
|
|
1086
1295
|
import { Toaster as SonnerToaster, toast as sonnerToast } from "sonner";
|
|
1087
1296
|
import { Fragment, jsx as jsx2, jsxs } from "react/jsx-runtime";
|
|
1088
1297
|
var dotColorByVariant = {
|
|
@@ -1198,7 +1407,7 @@ function CommandApprovalToast({
|
|
|
1198
1407
|
defaultExpanded = false,
|
|
1199
1408
|
className
|
|
1200
1409
|
}) {
|
|
1201
|
-
const [expanded, setExpanded] =
|
|
1410
|
+
const [expanded, setExpanded] = useState12(defaultExpanded);
|
|
1202
1411
|
const handleApprove = () => {
|
|
1203
1412
|
onApprove?.();
|
|
1204
1413
|
sonnerToast.dismiss(id);
|
|
@@ -1398,15 +1607,15 @@ var useToast = () => ({
|
|
|
1398
1607
|
});
|
|
1399
1608
|
|
|
1400
1609
|
// src/hooks/use-contact-submission.ts
|
|
1401
|
-
import { useState as
|
|
1610
|
+
import { useState as useState13, useCallback as useCallback9, useEffect as useEffect12 } from "react";
|
|
1402
1611
|
function useContactSubmission(options = {}) {
|
|
1403
1612
|
const { userId, successRedirectUrl, successToastMessage, onSuccess } = options;
|
|
1404
1613
|
const { toast: toast2 } = useToast();
|
|
1405
1614
|
const router = useRouter();
|
|
1406
1615
|
const { contactUrl } = useRequiredEndpointsRuntime();
|
|
1407
|
-
const [isSubmitting, setIsSubmitting] =
|
|
1408
|
-
const [isSuccess, setIsSuccess] =
|
|
1409
|
-
const submit =
|
|
1616
|
+
const [isSubmitting, setIsSubmitting] = useState13(false);
|
|
1617
|
+
const [isSuccess, setIsSuccess] = useState13(false);
|
|
1618
|
+
const submit = useCallback9(
|
|
1410
1619
|
async (formData) => {
|
|
1411
1620
|
if (isSubmitting) return;
|
|
1412
1621
|
setIsSubmitting(true);
|
|
@@ -1444,7 +1653,7 @@ function useContactSubmission(options = {}) {
|
|
|
1444
1653
|
},
|
|
1445
1654
|
[isSubmitting, toast2, userId, successToastMessage, contactUrl]
|
|
1446
1655
|
);
|
|
1447
|
-
|
|
1656
|
+
useEffect12(() => {
|
|
1448
1657
|
if (!isSuccess || !successRedirectUrl) return void 0;
|
|
1449
1658
|
console.log("\u{1F680} Contact submission successful, redirecting to:", successRedirectUrl);
|
|
1450
1659
|
const timer = setTimeout(() => {
|
|
@@ -1457,7 +1666,7 @@ function useContactSubmission(options = {}) {
|
|
|
1457
1666
|
}, 1500);
|
|
1458
1667
|
return () => clearTimeout(timer);
|
|
1459
1668
|
}, [isSuccess, successRedirectUrl, router]);
|
|
1460
|
-
|
|
1669
|
+
useEffect12(() => {
|
|
1461
1670
|
if (isSuccess && onSuccess) {
|
|
1462
1671
|
onSuccess();
|
|
1463
1672
|
}
|
|
@@ -1466,7 +1675,7 @@ function useContactSubmission(options = {}) {
|
|
|
1466
1675
|
}
|
|
1467
1676
|
|
|
1468
1677
|
// src/hooks/use-copy-to-clipboard.ts
|
|
1469
|
-
import { useCallback as
|
|
1678
|
+
import { useCallback as useCallback10, useState as useState14 } from "react";
|
|
1470
1679
|
function useCopyToClipboard({
|
|
1471
1680
|
successTitle = "Copied",
|
|
1472
1681
|
successDescription = "Copied to clipboard",
|
|
@@ -1475,8 +1684,8 @@ function useCopyToClipboard({
|
|
|
1475
1684
|
resetDelay = 2e3
|
|
1476
1685
|
} = {}) {
|
|
1477
1686
|
const { toast: toast2 } = useToast();
|
|
1478
|
-
const [copied, setCopied] =
|
|
1479
|
-
const copy =
|
|
1687
|
+
const [copied, setCopied] = useState14(false);
|
|
1688
|
+
const copy = useCallback10(
|
|
1480
1689
|
async (text) => {
|
|
1481
1690
|
try {
|
|
1482
1691
|
await navigator.clipboard.writeText(text);
|
|
@@ -1493,7 +1702,7 @@ function useCopyToClipboard({
|
|
|
1493
1702
|
}
|
|
1494
1703
|
|
|
1495
1704
|
// src/hooks/use-batch-images.ts
|
|
1496
|
-
import { useEffect as
|
|
1705
|
+
import { useEffect as useEffect13, useMemo as useMemo4, useState as useState15, useRef as useRef9 } from "react";
|
|
1497
1706
|
var globalBatchImageConfig = {};
|
|
1498
1707
|
function configureBatchImageFetch(config) {
|
|
1499
1708
|
globalBatchImageConfig = { ...globalBatchImageConfig, ...config };
|
|
@@ -1566,17 +1775,17 @@ async function batchFetchAuthenticatedImages(imageUrls, config) {
|
|
|
1566
1775
|
return results;
|
|
1567
1776
|
}
|
|
1568
1777
|
function useBatchImages(imageUrls, config) {
|
|
1569
|
-
const [fetchedImages, setFetchedImages] =
|
|
1570
|
-
const uniqueUrls =
|
|
1778
|
+
const [fetchedImages, setFetchedImages] = useState15({});
|
|
1779
|
+
const uniqueUrls = useMemo4(
|
|
1571
1780
|
() => Array.from(new Set(imageUrls.filter((url) => Boolean(url)))),
|
|
1572
1781
|
[imageUrls]
|
|
1573
1782
|
);
|
|
1574
|
-
const requestedUrls =
|
|
1575
|
-
const fetchedImagesRef =
|
|
1576
|
-
|
|
1783
|
+
const requestedUrls = useRef9(/* @__PURE__ */ new Set());
|
|
1784
|
+
const fetchedImagesRef = useRef9(fetchedImages);
|
|
1785
|
+
useEffect13(() => {
|
|
1577
1786
|
fetchedImagesRef.current = fetchedImages;
|
|
1578
1787
|
}, [fetchedImages]);
|
|
1579
|
-
|
|
1788
|
+
useEffect13(
|
|
1580
1789
|
() => () => {
|
|
1581
1790
|
Object.values(fetchedImagesRef.current).forEach((blobUrl) => {
|
|
1582
1791
|
if (blobUrl && blobUrl.startsWith("blob:")) {
|
|
@@ -1586,7 +1795,7 @@ function useBatchImages(imageUrls, config) {
|
|
|
1586
1795
|
},
|
|
1587
1796
|
[]
|
|
1588
1797
|
);
|
|
1589
|
-
|
|
1798
|
+
useEffect13(() => {
|
|
1590
1799
|
const urlsToFetch = uniqueUrls.filter((url) => !requestedUrls.current.has(url));
|
|
1591
1800
|
if (urlsToFetch.length === 0) {
|
|
1592
1801
|
return;
|
|
@@ -1604,7 +1813,7 @@ function useBatchImages(imageUrls, config) {
|
|
|
1604
1813
|
}
|
|
1605
1814
|
|
|
1606
1815
|
// src/hooks/use-authenticated-image.ts
|
|
1607
|
-
import { useEffect as
|
|
1816
|
+
import { useEffect as useEffect14, useState as useState16, useRef as useRef10 } from "react";
|
|
1608
1817
|
var globalImageConfig = {};
|
|
1609
1818
|
var imageCache = /* @__PURE__ */ new Map();
|
|
1610
1819
|
var pendingRequests = /* @__PURE__ */ new Map();
|
|
@@ -1633,8 +1842,8 @@ function getImageConfig() {
|
|
|
1633
1842
|
};
|
|
1634
1843
|
}
|
|
1635
1844
|
function useAuthenticatedImage(imageUrl, refreshKey, config) {
|
|
1636
|
-
const [settled, setSettled] =
|
|
1637
|
-
const currentCacheKeyRef =
|
|
1845
|
+
const [settled, setSettled] = useState16(null);
|
|
1846
|
+
const currentCacheKeyRef = useRef10(null);
|
|
1638
1847
|
const { tenantHostUrl, enableDevMode, accessTokenKey } = {
|
|
1639
1848
|
...getImageConfig(),
|
|
1640
1849
|
...config
|
|
@@ -1652,7 +1861,7 @@ function useAuthenticatedImage(imageUrl, refreshKey, config) {
|
|
|
1652
1861
|
}
|
|
1653
1862
|
}
|
|
1654
1863
|
const cacheKey = fullImageUrl === null ? null : refreshKey ? `${fullImageUrl}?v=${refreshKey}` : fullImageUrl;
|
|
1655
|
-
|
|
1864
|
+
useEffect14(() => {
|
|
1656
1865
|
if (cacheKey === null) {
|
|
1657
1866
|
if (currentCacheKeyRef.current) {
|
|
1658
1867
|
const entry = imageCache.get(currentCacheKeyRef.current);
|
|
@@ -1729,7 +1938,7 @@ function useAuthenticatedImage(imageUrl, refreshKey, config) {
|
|
|
1729
1938
|
});
|
|
1730
1939
|
pendingRequests.set(cacheKey, fetchPromise2);
|
|
1731
1940
|
}, [cacheKey, fullImageUrl, refreshKey, enableDevMode, accessTokenKey]);
|
|
1732
|
-
|
|
1941
|
+
useEffect14(() => {
|
|
1733
1942
|
return () => {
|
|
1734
1943
|
if (currentCacheKeyRef.current) {
|
|
1735
1944
|
const entry = imageCache.get(currentCacheKeyRef.current);
|
|
@@ -1750,7 +1959,7 @@ function useAuthenticatedImage(imageUrl, refreshKey, config) {
|
|
|
1750
1959
|
}
|
|
1751
1960
|
|
|
1752
1961
|
// src/hooks/state/use-query-params.ts
|
|
1753
|
-
import { useEffect as
|
|
1962
|
+
import { useEffect as useEffect15, useState as useState17, useMemo as useMemo5, useCallback as useCallback11, useRef as useRef11 } from "react";
|
|
1754
1963
|
|
|
1755
1964
|
// src/hooks/state/flatten-schema.ts
|
|
1756
1965
|
function flattenQueryVariables(queryVariables, introspector2) {
|
|
@@ -2201,26 +2410,26 @@ function validateVariables(variables, schema) {
|
|
|
2201
2410
|
function useQueryParams(query, options = {}) {
|
|
2202
2411
|
const router = useRouter();
|
|
2203
2412
|
const searchParams = useSearchParams();
|
|
2204
|
-
const [isLoading, setIsLoading] =
|
|
2205
|
-
const [isReady, setIsReady] =
|
|
2206
|
-
const [error, setError] =
|
|
2207
|
-
const [schema, setSchema] =
|
|
2208
|
-
const defaultValues =
|
|
2413
|
+
const [isLoading, setIsLoading] = useState17(true);
|
|
2414
|
+
const [isReady, setIsReady] = useState17(false);
|
|
2415
|
+
const [error, setError] = useState17(null);
|
|
2416
|
+
const [schema, setSchema] = useState17({});
|
|
2417
|
+
const defaultValues = useMemo5(() => options.defaultValues || {}, [options.defaultValues]);
|
|
2209
2418
|
const skipIntrospection = options.skipIntrospection || false;
|
|
2210
2419
|
const debug = options.debug || false;
|
|
2211
|
-
const initSourceRef =
|
|
2420
|
+
const initSourceRef = useRef11({
|
|
2212
2421
|
introspectionHeaders: options.introspectionHeaders,
|
|
2213
2422
|
paramMapping: options.paramMapping,
|
|
2214
2423
|
defaultValues
|
|
2215
2424
|
});
|
|
2216
|
-
|
|
2425
|
+
useEffect15(() => {
|
|
2217
2426
|
initSourceRef.current = {
|
|
2218
2427
|
introspectionHeaders: options.introspectionHeaders,
|
|
2219
2428
|
paramMapping: options.paramMapping,
|
|
2220
2429
|
defaultValues
|
|
2221
2430
|
};
|
|
2222
2431
|
});
|
|
2223
|
-
|
|
2432
|
+
useEffect15(() => {
|
|
2224
2433
|
let cancelled = false;
|
|
2225
2434
|
async function initialize() {
|
|
2226
2435
|
try {
|
|
@@ -2267,7 +2476,7 @@ function useQueryParams(query, options = {}) {
|
|
|
2267
2476
|
cancelled = true;
|
|
2268
2477
|
};
|
|
2269
2478
|
}, [query, options.introspectionEndpoint, skipIntrospection, debug]);
|
|
2270
|
-
const variables =
|
|
2479
|
+
const variables = useMemo5(() => {
|
|
2271
2480
|
if (!isReady) {
|
|
2272
2481
|
return defaultValues;
|
|
2273
2482
|
}
|
|
@@ -2283,7 +2492,7 @@ function useQueryParams(query, options = {}) {
|
|
|
2283
2492
|
return defaultValues;
|
|
2284
2493
|
}
|
|
2285
2494
|
}, [searchParams, schema, isReady, defaultValues, debug]);
|
|
2286
|
-
const params =
|
|
2495
|
+
const params = useMemo5(() => {
|
|
2287
2496
|
const result = {};
|
|
2288
2497
|
searchParams.forEach((value, key) => {
|
|
2289
2498
|
const existing = result[key];
|
|
@@ -2297,7 +2506,7 @@ function useQueryParams(query, options = {}) {
|
|
|
2297
2506
|
});
|
|
2298
2507
|
return result;
|
|
2299
2508
|
}, [searchParams]);
|
|
2300
|
-
const updateUrl =
|
|
2509
|
+
const updateUrl = useCallback11(
|
|
2301
2510
|
(newParams) => {
|
|
2302
2511
|
const url = newParams.toString() ? `?${newParams.toString()}` : window.location.pathname;
|
|
2303
2512
|
if (debug) {
|
|
@@ -2307,7 +2516,7 @@ function useQueryParams(query, options = {}) {
|
|
|
2307
2516
|
},
|
|
2308
2517
|
[router, debug]
|
|
2309
2518
|
);
|
|
2310
|
-
const setParam =
|
|
2519
|
+
const setParam = useCallback11(
|
|
2311
2520
|
(key, value) => {
|
|
2312
2521
|
if (!isReady) {
|
|
2313
2522
|
console.warn("[useQueryParams] Schema not ready, cannot set param");
|
|
@@ -2323,7 +2532,7 @@ function useQueryParams(query, options = {}) {
|
|
|
2323
2532
|
},
|
|
2324
2533
|
[variables, schema, isReady, updateUrl]
|
|
2325
2534
|
);
|
|
2326
|
-
const setParams =
|
|
2535
|
+
const setParams = useCallback11(
|
|
2327
2536
|
(updates) => {
|
|
2328
2537
|
if (!isReady) {
|
|
2329
2538
|
console.warn("[useQueryParams] Schema not ready, cannot set params");
|
|
@@ -2339,7 +2548,7 @@ function useQueryParams(query, options = {}) {
|
|
|
2339
2548
|
},
|
|
2340
2549
|
[variables, schema, isReady, updateUrl]
|
|
2341
2550
|
);
|
|
2342
|
-
const clearParamsHandler =
|
|
2551
|
+
const clearParamsHandler = useCallback11(
|
|
2343
2552
|
(keys) => {
|
|
2344
2553
|
if (!isReady) {
|
|
2345
2554
|
console.warn("[useQueryParams] Schema not ready, cannot clear params");
|
|
@@ -2355,7 +2564,7 @@ function useQueryParams(query, options = {}) {
|
|
|
2355
2564
|
},
|
|
2356
2565
|
[variables, schema, isReady, updateUrl]
|
|
2357
2566
|
);
|
|
2358
|
-
const resetParams =
|
|
2567
|
+
const resetParams = useCallback11(() => {
|
|
2359
2568
|
if (debug) {
|
|
2360
2569
|
console.log("[useQueryParams] Resetting params");
|
|
2361
2570
|
}
|
|
@@ -2390,9 +2599,9 @@ function applyParamMapping(schema, mapping) {
|
|
|
2390
2599
|
}
|
|
2391
2600
|
|
|
2392
2601
|
// src/hooks/state/use-api-params.ts
|
|
2393
|
-
import { useCallback as
|
|
2602
|
+
import { useCallback as useCallback12, useEffect as useEffect16, useMemo as useMemo6, useRef as useRef12, useState as useState18 } from "react";
|
|
2394
2603
|
function useContentStable(value, key) {
|
|
2395
|
-
const [cached, setCached] =
|
|
2604
|
+
const [cached, setCached] = useState18({ value, key });
|
|
2396
2605
|
if (cached.key !== key) setCached({ value, key });
|
|
2397
2606
|
return cached.key === key ? cached.value : value;
|
|
2398
2607
|
}
|
|
@@ -2419,14 +2628,14 @@ function useApiParams(schema, options = {}) {
|
|
|
2419
2628
|
const searchParamsLive = useSearchParams();
|
|
2420
2629
|
const debug = options.debug || false;
|
|
2421
2630
|
const searchString = searchParamsLive.toString();
|
|
2422
|
-
const pendingRef =
|
|
2423
|
-
const [pendingTail, setPendingTail] =
|
|
2424
|
-
const syncPendingTail =
|
|
2631
|
+
const pendingRef = useRef12([]);
|
|
2632
|
+
const [pendingTail, setPendingTail] = useState18(void 0);
|
|
2633
|
+
const syncPendingTail = useCallback12(() => {
|
|
2425
2634
|
setPendingTail(pendingRef.current[pendingRef.current.length - 1]);
|
|
2426
2635
|
}, []);
|
|
2427
|
-
const schemaKey =
|
|
2636
|
+
const schemaKey = useMemo6(() => JSON.stringify(schema), [schema]);
|
|
2428
2637
|
const stableSchema = useContentStable(schema, schemaKey);
|
|
2429
|
-
const flattenedSchema =
|
|
2638
|
+
const flattenedSchema = useMemo6(() => {
|
|
2430
2639
|
const flattened = {};
|
|
2431
2640
|
for (const [key, config] of Object.entries(stableSchema)) {
|
|
2432
2641
|
flattened[key] = {
|
|
@@ -2440,7 +2649,7 @@ function useApiParams(schema, options = {}) {
|
|
|
2440
2649
|
}
|
|
2441
2650
|
return flattened;
|
|
2442
2651
|
}, [stableSchema]);
|
|
2443
|
-
const rawParams =
|
|
2652
|
+
const rawParams = useMemo6(() => {
|
|
2444
2653
|
const result = parseSchemaParams(stableSchema, new URLSearchParams(searchString), {
|
|
2445
2654
|
absent: options.absent === "null" ? "null" : "undefined"
|
|
2446
2655
|
});
|
|
@@ -2449,17 +2658,17 @@ function useApiParams(schema, options = {}) {
|
|
|
2449
2658
|
}
|
|
2450
2659
|
return result;
|
|
2451
2660
|
}, [searchString, debug, stableSchema, options.absent]);
|
|
2452
|
-
const [paramsCache, setParamsCache] =
|
|
2661
|
+
const [paramsCache, setParamsCache] = useState18(() => ({ src: rawParams, value: rawParams }));
|
|
2453
2662
|
let stableParams = paramsCache.value;
|
|
2454
2663
|
if (paramsCache.src !== rawParams) {
|
|
2455
2664
|
stableParams = reuseArrayRefs(paramsCache.value, rawParams);
|
|
2456
2665
|
setParamsCache({ src: rawParams, value: stableParams });
|
|
2457
2666
|
}
|
|
2458
2667
|
const params = stableParams;
|
|
2459
|
-
const addParamToSearchParams =
|
|
2668
|
+
const addParamToSearchParams = useCallback12((searchParams, key, value) => {
|
|
2460
2669
|
for (const [k, v] of createSearchParams({ [key]: value })) searchParams.append(k, v);
|
|
2461
2670
|
}, []);
|
|
2462
|
-
const urlSearchParams =
|
|
2671
|
+
const urlSearchParams = useMemo6(() => {
|
|
2463
2672
|
const newParams = new URLSearchParams();
|
|
2464
2673
|
for (const key of Object.keys(stableSchema)) {
|
|
2465
2674
|
const value = params[key];
|
|
@@ -2471,7 +2680,7 @@ function useApiParams(schema, options = {}) {
|
|
|
2471
2680
|
}
|
|
2472
2681
|
return newParams;
|
|
2473
2682
|
}, [params, flattenedSchema, addParamToSearchParams, stableSchema]);
|
|
2474
|
-
const updateUrl =
|
|
2683
|
+
const updateUrl = useCallback12(
|
|
2475
2684
|
(newParams, keysToRemove = []) => {
|
|
2476
2685
|
const base = pendingRef.current[pendingRef.current.length - 1] ?? searchString;
|
|
2477
2686
|
const finalParams = new URLSearchParams(base);
|
|
@@ -2506,14 +2715,14 @@ function useApiParams(schema, options = {}) {
|
|
|
2506
2715
|
},
|
|
2507
2716
|
[router, debug, searchString, stableSchema, syncPendingTail]
|
|
2508
2717
|
);
|
|
2509
|
-
|
|
2718
|
+
useEffect16(() => {
|
|
2510
2719
|
const queue = pendingRef.current;
|
|
2511
2720
|
if (queue.length === 0) return;
|
|
2512
2721
|
const hit = queue.indexOf(searchString);
|
|
2513
2722
|
pendingRef.current = hit === -1 ? [] : queue.slice(hit + 1);
|
|
2514
2723
|
syncPendingTail();
|
|
2515
2724
|
}, [searchString, syncPendingTail]);
|
|
2516
|
-
const setParam =
|
|
2725
|
+
const setParam = useCallback12(
|
|
2517
2726
|
(key, value) => {
|
|
2518
2727
|
const config = stableSchema[key];
|
|
2519
2728
|
if (!config) {
|
|
@@ -2530,7 +2739,7 @@ function useApiParams(schema, options = {}) {
|
|
|
2530
2739
|
},
|
|
2531
2740
|
[updateUrl, addParamToSearchParams, stableSchema]
|
|
2532
2741
|
);
|
|
2533
|
-
const setParams =
|
|
2742
|
+
const setParams = useCallback12(
|
|
2534
2743
|
(updates) => {
|
|
2535
2744
|
const newParams = new URLSearchParams();
|
|
2536
2745
|
const keysToRemove = [];
|
|
@@ -2550,20 +2759,20 @@ function useApiParams(schema, options = {}) {
|
|
|
2550
2759
|
},
|
|
2551
2760
|
[updateUrl, addParamToSearchParams, stableSchema, flattenedSchema]
|
|
2552
2761
|
);
|
|
2553
|
-
const clearParams2 =
|
|
2762
|
+
const clearParams2 = useCallback12(
|
|
2554
2763
|
(keys) => {
|
|
2555
2764
|
const newParams = new URLSearchParams();
|
|
2556
2765
|
updateUrl(newParams, keys);
|
|
2557
2766
|
},
|
|
2558
2767
|
[updateUrl]
|
|
2559
2768
|
);
|
|
2560
|
-
const resetParams =
|
|
2769
|
+
const resetParams = useCallback12(() => {
|
|
2561
2770
|
if (debug) {
|
|
2562
2771
|
console.log("[useApiParams] Resetting params");
|
|
2563
2772
|
}
|
|
2564
2773
|
router.replace(window.location.pathname, { scroll: false });
|
|
2565
2774
|
}, [router, debug]);
|
|
2566
|
-
const pendingParams =
|
|
2775
|
+
const pendingParams = useMemo6(() => {
|
|
2567
2776
|
if (pendingTail === void 0 || pendingTail === searchString) return params;
|
|
2568
2777
|
return parseSchemaParams(stableSchema, new URLSearchParams(pendingTail), {
|
|
2569
2778
|
absent: options.absent === "null" ? "null" : "undefined"
|
|
@@ -2581,7 +2790,7 @@ function useApiParams(schema, options = {}) {
|
|
|
2581
2790
|
}
|
|
2582
2791
|
|
|
2583
2792
|
// src/hooks/state/use-cursor-pagination-state.ts
|
|
2584
|
-
import { useCallback as
|
|
2793
|
+
import { useCallback as useCallback13, useEffect as useEffect17, useRef as useRef13, useState as useState19 } from "react";
|
|
2585
2794
|
var urlSchema = {
|
|
2586
2795
|
search: { type: "string", default: "" },
|
|
2587
2796
|
cursor: { type: "string", default: "" }
|
|
@@ -2589,21 +2798,21 @@ var urlSchema = {
|
|
|
2589
2798
|
function useCursorPaginationState(options) {
|
|
2590
2799
|
const { onInitialLoad, onSearchChange } = options;
|
|
2591
2800
|
const { params, setParam, setParams } = useApiParams(urlSchema);
|
|
2592
|
-
const [searchInput, setSearchInput] =
|
|
2593
|
-
const [hasLoadedBeyondFirst, setHasLoadedBeyondFirst] =
|
|
2594
|
-
const [initialLoadCount, setInitialLoadCount] =
|
|
2595
|
-
const lastSearchRef =
|
|
2596
|
-
const isSyncingFromUrl =
|
|
2597
|
-
const isInitialLoadInProgress =
|
|
2598
|
-
const searchInputRef =
|
|
2599
|
-
const onInitialLoadRef =
|
|
2600
|
-
const paramsRef =
|
|
2601
|
-
|
|
2801
|
+
const [searchInput, setSearchInput] = useState19(params.search || "");
|
|
2802
|
+
const [hasLoadedBeyondFirst, setHasLoadedBeyondFirst] = useState19(false);
|
|
2803
|
+
const [initialLoadCount, setInitialLoadCount] = useState19(0);
|
|
2804
|
+
const lastSearchRef = useRef13(null);
|
|
2805
|
+
const isSyncingFromUrl = useRef13(false);
|
|
2806
|
+
const isInitialLoadInProgress = useRef13(true);
|
|
2807
|
+
const searchInputRef = useRef13(searchInput);
|
|
2808
|
+
const onInitialLoadRef = useRef13(onInitialLoad);
|
|
2809
|
+
const paramsRef = useRef13(params);
|
|
2810
|
+
useEffect17(() => {
|
|
2602
2811
|
searchInputRef.current = searchInput;
|
|
2603
2812
|
onInitialLoadRef.current = onInitialLoad;
|
|
2604
2813
|
paramsRef.current = params;
|
|
2605
2814
|
});
|
|
2606
|
-
|
|
2815
|
+
useEffect17(() => {
|
|
2607
2816
|
if (isInitialLoadInProgress.current) return;
|
|
2608
2817
|
const urlSearch = params.search || "";
|
|
2609
2818
|
if (urlSearch !== searchInputRef.current) {
|
|
@@ -2614,7 +2823,7 @@ function useCursorPaginationState(options) {
|
|
|
2614
2823
|
}, 0);
|
|
2615
2824
|
}
|
|
2616
2825
|
}, [params.search, initialLoadCount]);
|
|
2617
|
-
|
|
2826
|
+
useEffect17(() => {
|
|
2618
2827
|
if (isInitialLoadInProgress.current) return;
|
|
2619
2828
|
if (isSyncingFromUrl.current) return;
|
|
2620
2829
|
if (searchInput !== params.search) {
|
|
@@ -2625,7 +2834,7 @@ function useCursorPaginationState(options) {
|
|
|
2625
2834
|
});
|
|
2626
2835
|
}
|
|
2627
2836
|
}, [searchInput, params.search, setParams, initialLoadCount]);
|
|
2628
|
-
|
|
2837
|
+
useEffect17(() => {
|
|
2629
2838
|
if (initialLoadCount === 0) {
|
|
2630
2839
|
const cursor = paramsRef.current.cursor || null;
|
|
2631
2840
|
const search = paramsRef.current.search || "";
|
|
@@ -2641,7 +2850,7 @@ function useCursorPaginationState(options) {
|
|
|
2641
2850
|
});
|
|
2642
2851
|
}
|
|
2643
2852
|
}, [initialLoadCount]);
|
|
2644
|
-
|
|
2853
|
+
useEffect17(() => {
|
|
2645
2854
|
if (isInitialLoadInProgress.current) return;
|
|
2646
2855
|
if (initialLoadCount === 0) return;
|
|
2647
2856
|
const currentSearch = params.search || "";
|
|
@@ -2653,7 +2862,7 @@ function useCursorPaginationState(options) {
|
|
|
2653
2862
|
});
|
|
2654
2863
|
}
|
|
2655
2864
|
}, [params.search, onSearchChange, initialLoadCount]);
|
|
2656
|
-
const handleNextPage =
|
|
2865
|
+
const handleNextPage = useCallback13(
|
|
2657
2866
|
async (endCursor, fetchFn) => {
|
|
2658
2867
|
setParam("cursor", endCursor);
|
|
2659
2868
|
await fetchFn();
|
|
@@ -2661,7 +2870,7 @@ function useCursorPaginationState(options) {
|
|
|
2661
2870
|
},
|
|
2662
2871
|
[setParam]
|
|
2663
2872
|
);
|
|
2664
|
-
const handleResetToFirstPage =
|
|
2873
|
+
const handleResetToFirstPage = useCallback13(
|
|
2665
2874
|
async (fetchFn) => {
|
|
2666
2875
|
setParam("cursor", "");
|
|
2667
2876
|
await fetchFn();
|
|
@@ -2683,22 +2892,22 @@ function useCursorPaginationState(options) {
|
|
|
2683
2892
|
}
|
|
2684
2893
|
|
|
2685
2894
|
// src/hooks/nats/use-nats-client.ts
|
|
2686
|
-
import { useEffect as
|
|
2895
|
+
import { useEffect as useEffect18, useMemo as useMemo7, useState as useState20 } from "react";
|
|
2687
2896
|
function useNatsClient(clientOptions, options = {}) {
|
|
2688
2897
|
const { autoConnect = true } = options;
|
|
2689
|
-
const client =
|
|
2898
|
+
const client = useMemo7(() => {
|
|
2690
2899
|
if (!clientOptions) return null;
|
|
2691
2900
|
return createNatsClient(clientOptions);
|
|
2692
2901
|
}, [clientOptions]);
|
|
2693
|
-
const [status, setStatus] =
|
|
2694
|
-
const [lastError, setLastError] =
|
|
2695
|
-
const [statusClient, setStatusClient] =
|
|
2902
|
+
const [status, setStatus] = useState20("disconnected");
|
|
2903
|
+
const [lastError, setLastError] = useState20(null);
|
|
2904
|
+
const [statusClient, setStatusClient] = useState20(client);
|
|
2696
2905
|
if (statusClient !== client) {
|
|
2697
2906
|
setStatusClient(client);
|
|
2698
2907
|
setStatus("disconnected");
|
|
2699
2908
|
setLastError(null);
|
|
2700
2909
|
}
|
|
2701
|
-
|
|
2910
|
+
useEffect18(() => {
|
|
2702
2911
|
if (!client) return void 0;
|
|
2703
2912
|
const off = client.onStatus((event) => {
|
|
2704
2913
|
setStatus(event.status);
|
|
@@ -2725,7 +2934,7 @@ function useNatsClient(clientOptions, options = {}) {
|
|
|
2725
2934
|
}
|
|
2726
2935
|
|
|
2727
2936
|
// src/hooks/use-scenario-player.ts
|
|
2728
|
-
import { useCallback as
|
|
2937
|
+
import { useCallback as useCallback14, useEffect as useEffect19, useRef as useRef14, useState as useState21 } from "react";
|
|
2729
2938
|
var START_MS = 300;
|
|
2730
2939
|
function useScenarioPlayer({
|
|
2731
2940
|
scenarioCount,
|
|
@@ -2738,14 +2947,14 @@ function useScenarioPlayer({
|
|
|
2738
2947
|
}) {
|
|
2739
2948
|
const auto = useAutoplay(enabled);
|
|
2740
2949
|
const { reducedMotion, paused, setPaused } = auto;
|
|
2741
|
-
const [scenario, setScenario] =
|
|
2742
|
-
const [rawStep, setRawStep] =
|
|
2950
|
+
const [scenario, setScenario] = useState21(initialScenario);
|
|
2951
|
+
const [rawStep, setRawStep] = useState21(startAtEnd ? Number.MAX_SAFE_INTEGER : 0);
|
|
2743
2952
|
const lastStep = typeof lastStepOption === "function" ? lastStepOption(scenario) : lastStepOption;
|
|
2744
2953
|
const step = reducedMotion ? lastStep : Math.min(rawStep, lastStep);
|
|
2745
2954
|
const playing = auto.playing && scenarioCount > 0;
|
|
2746
|
-
const starting =
|
|
2747
|
-
const wasPlaying =
|
|
2748
|
-
|
|
2955
|
+
const starting = useRef14(false);
|
|
2956
|
+
const wasPlaying = useRef14(false);
|
|
2957
|
+
useEffect19(() => {
|
|
2749
2958
|
if (playing && !wasPlaying.current) starting.current = true;
|
|
2750
2959
|
wasPlaying.current = playing;
|
|
2751
2960
|
if (!playing) return void 0;
|
|
@@ -2765,14 +2974,14 @@ function useScenarioPlayer({
|
|
|
2765
2974
|
);
|
|
2766
2975
|
return () => clearTimeout(timer);
|
|
2767
2976
|
}, [playing, rawStep, lastStep, stepMs, holdMs, scenario, scenarioCount]);
|
|
2768
|
-
const setStep =
|
|
2977
|
+
const setStep = useCallback14(
|
|
2769
2978
|
(next) => {
|
|
2770
2979
|
setRawStep(Math.max(0, Math.min(lastStep, next)));
|
|
2771
2980
|
setPaused(false);
|
|
2772
2981
|
},
|
|
2773
2982
|
[lastStep, setPaused]
|
|
2774
2983
|
);
|
|
2775
|
-
const go =
|
|
2984
|
+
const go = useCallback14(
|
|
2776
2985
|
(next) => {
|
|
2777
2986
|
setScenario(next);
|
|
2778
2987
|
setRawStep(0);
|
|
@@ -2886,7 +3095,7 @@ function useAccessCodeIntegration() {
|
|
|
2886
3095
|
}
|
|
2887
3096
|
|
|
2888
3097
|
// src/hooks/use-claude-mirror-src.ts
|
|
2889
|
-
import { useEffect as
|
|
3098
|
+
import { useEffect as useEffect20, useState as useState22 } from "react";
|
|
2890
3099
|
|
|
2891
3100
|
// src/utils/embed-url-converters.ts
|
|
2892
3101
|
function toGoogleSheetsEmbedUrl(url) {
|
|
@@ -2976,9 +3185,9 @@ async function revalidateMirror(mirrorPath) {
|
|
|
2976
3185
|
function useClaudeMirrorSrc(url) {
|
|
2977
3186
|
const endpoints = useEndpointsRuntime();
|
|
2978
3187
|
const mirrorPath = toClaudeMirrorPath(url, endpoints?.storageViewBaseUrl);
|
|
2979
|
-
const [resolved, setResolved] =
|
|
3188
|
+
const [resolved, setResolved] = useState22(null);
|
|
2980
3189
|
const state = resolved && resolved.key === mirrorPath ? resolved.value : { src: null, status: mirrorPath ? "probing" : "absent" };
|
|
2981
|
-
|
|
3190
|
+
useEffect20(() => {
|
|
2982
3191
|
if (!mirrorPath) return void 0;
|
|
2983
3192
|
let cancelled = false;
|
|
2984
3193
|
const settle = (value) => {
|
|
@@ -3004,12 +3213,33 @@ function useClaudeMirrorSrc(url) {
|
|
|
3004
3213
|
return state;
|
|
3005
3214
|
}
|
|
3006
3215
|
|
|
3216
|
+
// src/hooks/use-location-hash.ts
|
|
3217
|
+
import { useSyncExternalStore as useSyncExternalStore3 } from "react";
|
|
3218
|
+
var HASH_EVENTS = ["hashchange", "popstate"];
|
|
3219
|
+
function subscribe3(onChange) {
|
|
3220
|
+
for (const event of HASH_EVENTS) window.addEventListener(event, onChange);
|
|
3221
|
+
return () => {
|
|
3222
|
+
for (const event of HASH_EVENTS) window.removeEventListener(event, onChange);
|
|
3223
|
+
};
|
|
3224
|
+
}
|
|
3225
|
+
function readHash() {
|
|
3226
|
+
const raw = normalizeHashFragment(window.location.hash).replace(/^#/, "");
|
|
3227
|
+
try {
|
|
3228
|
+
return decodeURIComponent(raw);
|
|
3229
|
+
} catch {
|
|
3230
|
+
return raw;
|
|
3231
|
+
}
|
|
3232
|
+
}
|
|
3233
|
+
function useLocationHash() {
|
|
3234
|
+
return useSyncExternalStore3(subscribe3, readHash, () => "");
|
|
3235
|
+
}
|
|
3236
|
+
|
|
3007
3237
|
// src/hooks/use-scroll-to-hash.ts
|
|
3008
|
-
import { useEffect as
|
|
3238
|
+
import { useEffect as useEffect21 } from "react";
|
|
3009
3239
|
var MAX_POLL_FRAMES = 60;
|
|
3010
3240
|
function useScrollToHash(readyDep = true, options) {
|
|
3011
3241
|
const headerOffset = options?.headerOffset ?? 0;
|
|
3012
|
-
|
|
3242
|
+
useEffect21(() => {
|
|
3013
3243
|
if (typeof window === "undefined") return void 0;
|
|
3014
3244
|
if (readyDep === null || readyDep === false) return void 0;
|
|
3015
3245
|
let rafId = null;
|
|
@@ -3049,7 +3279,7 @@ function useScrollToHash(readyDep = true, options) {
|
|
|
3049
3279
|
}
|
|
3050
3280
|
|
|
3051
3281
|
// src/hooks/use-humanity-signals.ts
|
|
3052
|
-
import { useCallback as
|
|
3282
|
+
import { useCallback as useCallback15, useRef as useRef15, useState as useState23 } from "react";
|
|
3053
3283
|
|
|
3054
3284
|
// src/utils/humanity-signals.ts
|
|
3055
3285
|
var HONEYPOT_FIELD = "form_extra_note";
|
|
@@ -3111,17 +3341,17 @@ var splitCsvEnv = (s) => s?.split(",").map((t) => t.trim()).filter(Boolean) ?? [
|
|
|
3111
3341
|
|
|
3112
3342
|
// src/hooks/use-humanity-signals.ts
|
|
3113
3343
|
function useHumanitySignals() {
|
|
3114
|
-
const ref =
|
|
3115
|
-
const [mountedAt] =
|
|
3116
|
-
const startedAtRef =
|
|
3117
|
-
const getSignals =
|
|
3344
|
+
const ref = useRef15(null);
|
|
3345
|
+
const [mountedAt] = useState23(() => typeof performance !== "undefined" ? performance.now() : 0);
|
|
3346
|
+
const startedAtRef = useRef15(mountedAt);
|
|
3347
|
+
const getSignals = useCallback15(
|
|
3118
3348
|
() => ({
|
|
3119
3349
|
[HONEYPOT_FIELD]: ref.current?.value ?? "",
|
|
3120
3350
|
[ELAPSED_MS_FIELD]: typeof performance !== "undefined" ? Math.round(performance.now() - startedAtRef.current) : 0
|
|
3121
3351
|
}),
|
|
3122
3352
|
[]
|
|
3123
3353
|
);
|
|
3124
|
-
const resetSignals =
|
|
3354
|
+
const resetSignals = useCallback15(() => {
|
|
3125
3355
|
if (ref.current) ref.current.value = "";
|
|
3126
3356
|
if (typeof performance !== "undefined") startedAtRef.current = performance.now();
|
|
3127
3357
|
}, []);
|
|
@@ -3129,7 +3359,7 @@ function useHumanitySignals() {
|
|
|
3129
3359
|
}
|
|
3130
3360
|
|
|
3131
3361
|
// src/hooks/use-form-rescue.ts
|
|
3132
|
-
import { useCallback as
|
|
3362
|
+
import { useCallback as useCallback16, useEffect as useEffect22, useMemo as useMemo8, useRef as useRef16 } from "react";
|
|
3133
3363
|
|
|
3134
3364
|
// src/utils/form-rescue.ts
|
|
3135
3365
|
var FORM_ID_PATTERN = /^[a-z][a-z0-9_]{1,47}$/;
|
|
@@ -3343,27 +3573,27 @@ function readUtm() {
|
|
|
3343
3573
|
function useFormRescue({ form, fieldNames, onRestore, getSignals }) {
|
|
3344
3574
|
const draftsUrl = useEndpointsRuntime()?.formDraftsUrl;
|
|
3345
3575
|
const formId = form?.id ?? null;
|
|
3346
|
-
const attemptIdRef =
|
|
3347
|
-
const resumeTokenRef =
|
|
3348
|
-
const latestRef =
|
|
3349
|
-
const dirtyRef =
|
|
3350
|
-
const startedRef =
|
|
3351
|
-
const leadCapturedRef =
|
|
3352
|
-
const completedRef =
|
|
3353
|
-
const timerRef =
|
|
3354
|
-
const fieldNamesRef =
|
|
3355
|
-
const onRestoreRef =
|
|
3356
|
-
const getSignalsRef =
|
|
3357
|
-
|
|
3576
|
+
const attemptIdRef = useRef16(null);
|
|
3577
|
+
const resumeTokenRef = useRef16(null);
|
|
3578
|
+
const latestRef = useRef16(null);
|
|
3579
|
+
const dirtyRef = useRef16(false);
|
|
3580
|
+
const startedRef = useRef16(false);
|
|
3581
|
+
const leadCapturedRef = useRef16(false);
|
|
3582
|
+
const completedRef = useRef16(false);
|
|
3583
|
+
const timerRef = useRef16(null);
|
|
3584
|
+
const fieldNamesRef = useRef16(fieldNames);
|
|
3585
|
+
const onRestoreRef = useRef16(onRestore);
|
|
3586
|
+
const getSignalsRef = useRef16(getSignals);
|
|
3587
|
+
useEffect22(() => {
|
|
3358
3588
|
fieldNamesRef.current = fieldNames;
|
|
3359
3589
|
onRestoreRef.current = onRestore;
|
|
3360
3590
|
getSignalsRef.current = getSignals;
|
|
3361
3591
|
});
|
|
3362
|
-
const attemptId =
|
|
3592
|
+
const attemptId = useCallback16(() => {
|
|
3363
3593
|
if (!attemptIdRef.current) attemptIdRef.current = newAttemptId();
|
|
3364
3594
|
return attemptIdRef.current;
|
|
3365
3595
|
}, []);
|
|
3366
|
-
const send =
|
|
3596
|
+
const send = useCallback16(
|
|
3367
3597
|
(keepalive) => {
|
|
3368
3598
|
if (!formId || !draftsUrl || !dirtyRef.current || completedRef.current || !latestRef.current) return;
|
|
3369
3599
|
dirtyRef.current = false;
|
|
@@ -3394,7 +3624,7 @@ function useFormRescue({ form, fieldNames, onRestore, getSignals }) {
|
|
|
3394
3624
|
},
|
|
3395
3625
|
[attemptId, draftsUrl, formId]
|
|
3396
3626
|
);
|
|
3397
|
-
|
|
3627
|
+
useEffect22(() => {
|
|
3398
3628
|
if (!formId || typeof window === "undefined") return void 0;
|
|
3399
3629
|
let cancelled = false;
|
|
3400
3630
|
const token = new URLSearchParams(window.location.search).get(FORM_RESCUE_RESUME_PARAM);
|
|
@@ -3424,7 +3654,7 @@ function useFormRescue({ form, fieldNames, onRestore, getSignals }) {
|
|
|
3424
3654
|
cancelled = true;
|
|
3425
3655
|
};
|
|
3426
3656
|
}, [attemptId, draftsUrl, formId]);
|
|
3427
|
-
|
|
3657
|
+
useEffect22(() => {
|
|
3428
3658
|
if (!formId || typeof document === "undefined") return void 0;
|
|
3429
3659
|
const onHide = () => {
|
|
3430
3660
|
if (completedRef.current || !startedRef.current) return;
|
|
@@ -3451,7 +3681,7 @@ function useFormRescue({ form, fieldNames, onRestore, getSignals }) {
|
|
|
3451
3681
|
if (timerRef.current) clearTimeout(timerRef.current);
|
|
3452
3682
|
};
|
|
3453
3683
|
}, [attemptId, formId, send]);
|
|
3454
|
-
const track =
|
|
3684
|
+
const track = useCallback16(
|
|
3455
3685
|
(values, lastField) => {
|
|
3456
3686
|
if (!formId || completedRef.current) return;
|
|
3457
3687
|
const names = fieldNamesRef.current;
|
|
@@ -3484,14 +3714,14 @@ function useFormRescue({ form, fieldNames, onRestore, getSignals }) {
|
|
|
3484
3714
|
},
|
|
3485
3715
|
[attemptId, formId, send]
|
|
3486
3716
|
);
|
|
3487
|
-
const submitFields =
|
|
3717
|
+
const submitFields = useCallback16(() => {
|
|
3488
3718
|
if (!formId) return {};
|
|
3489
3719
|
return {
|
|
3490
3720
|
[FORM_RESCUE_ATTEMPT_FIELD]: attemptId(),
|
|
3491
3721
|
...resumeTokenRef.current ? { [FORM_RESCUE_RESUME_FIELD]: resumeTokenRef.current } : {}
|
|
3492
3722
|
};
|
|
3493
3723
|
}, [attemptId, formId]);
|
|
3494
|
-
const complete =
|
|
3724
|
+
const complete = useCallback16(() => {
|
|
3495
3725
|
if (!formId) return;
|
|
3496
3726
|
if (timerRef.current) {
|
|
3497
3727
|
clearTimeout(timerRef.current);
|
|
@@ -3505,11 +3735,11 @@ function useFormRescue({ form, fieldNames, onRestore, getSignals }) {
|
|
|
3505
3735
|
startedRef.current = false;
|
|
3506
3736
|
leadCapturedRef.current = false;
|
|
3507
3737
|
}, [attemptId, form, formId]);
|
|
3508
|
-
return
|
|
3738
|
+
return useMemo8(() => ({ track, submitFields, complete }), [track, submitFields, complete]);
|
|
3509
3739
|
}
|
|
3510
3740
|
|
|
3511
3741
|
// src/hooks/use-rescued-form.ts
|
|
3512
|
-
import { useEffect as
|
|
3742
|
+
import { useEffect as useEffect23 } from "react";
|
|
3513
3743
|
function flattenOneLevel(values) {
|
|
3514
3744
|
const flat = {};
|
|
3515
3745
|
for (const [key, value] of Object.entries(values)) {
|
|
@@ -3533,7 +3763,7 @@ function useRescuedForm(form, { rescue, fields, getSignals, fieldPath }) {
|
|
|
3533
3763
|
}
|
|
3534
3764
|
}
|
|
3535
3765
|
});
|
|
3536
|
-
|
|
3766
|
+
useEffect23(() => {
|
|
3537
3767
|
const subscription = watch((values, { name }) => {
|
|
3538
3768
|
handle.track(flattenOneLevel(values), name ? name.split(".").pop() ?? null : null);
|
|
3539
3769
|
});
|
|
@@ -3558,6 +3788,16 @@ export {
|
|
|
3558
3788
|
useTablePagination,
|
|
3559
3789
|
useThrottle,
|
|
3560
3790
|
useWindowSize,
|
|
3791
|
+
resolveActiveSection,
|
|
3792
|
+
useActiveSection,
|
|
3793
|
+
useNavMenus,
|
|
3794
|
+
DESKTOP_OSES,
|
|
3795
|
+
detectVisitorOs,
|
|
3796
|
+
desktopOsOf,
|
|
3797
|
+
detectDesktopOs,
|
|
3798
|
+
usesCommandKey,
|
|
3799
|
+
shortcutLabel,
|
|
3800
|
+
useVisitorOs,
|
|
3561
3801
|
usePreventScroll,
|
|
3562
3802
|
platformIcons,
|
|
3563
3803
|
transformPlatformConfigsToOptions,
|
|
@@ -3618,6 +3858,7 @@ export {
|
|
|
3618
3858
|
toClaudeMirrorPath,
|
|
3619
3859
|
toClaudeEmbedUrl,
|
|
3620
3860
|
useClaudeMirrorSrc,
|
|
3861
|
+
useLocationHash,
|
|
3621
3862
|
useScrollToHash,
|
|
3622
3863
|
HONEYPOT_FIELD,
|
|
3623
3864
|
ELAPSED_MS_FIELD,
|