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