@flamingo-stack/openframe-frontend-core 0.0.247 → 0.0.249
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-AGU44B7B.js → chunk-2FCXJTOV.js} +55 -357
- package/dist/chunk-2FCXJTOV.js.map +1 -0
- package/dist/{chunk-3JRA55FZ.cjs → chunk-3DZ7QYNA.cjs} +166 -15
- package/dist/chunk-3DZ7QYNA.cjs.map +1 -0
- package/dist/{chunk-P2G5X6AW.cjs → chunk-3VTHSACO.cjs} +34 -32
- package/dist/chunk-3VTHSACO.cjs.map +1 -0
- package/dist/{chunk-ESADULCN.cjs → chunk-4EED3YEI.cjs} +1550 -5971
- package/dist/chunk-4EED3YEI.cjs.map +1 -0
- package/dist/{chunk-ZXECERJ4.js → chunk-4HHYUEMD.js} +3 -3
- package/dist/{chunk-UECRKCKH.js → chunk-4RDJZIHW.js} +115 -279
- package/dist/chunk-4RDJZIHW.js.map +1 -0
- package/dist/{chunk-QRGODKEG.js → chunk-5ZVPKTXM.js} +167 -16
- package/dist/chunk-5ZVPKTXM.js.map +1 -0
- package/dist/chunk-6JINAOI7.cjs +311 -0
- package/dist/chunk-6JINAOI7.cjs.map +1 -0
- package/dist/chunk-6LK4VEXE.cjs +4514 -0
- package/dist/chunk-6LK4VEXE.cjs.map +1 -0
- package/dist/chunk-DAAFVOTL.cjs +172 -0
- package/dist/chunk-DAAFVOTL.cjs.map +1 -0
- package/dist/{chunk-27VVOBDB.cjs → chunk-ELF4OOHC.cjs} +16 -180
- package/dist/chunk-ELF4OOHC.cjs.map +1 -0
- package/dist/{chunk-PINAV6VJ.cjs → chunk-LHZYI23D.cjs} +32 -30
- package/dist/chunk-LHZYI23D.cjs.map +1 -0
- package/dist/chunk-LKI3YCAX.js +4514 -0
- package/dist/chunk-LKI3YCAX.js.map +1 -0
- package/dist/{chunk-GMFDA36U.cjs → chunk-LZL6P7SN.cjs} +12 -12
- package/dist/{chunk-GMFDA36U.cjs.map → chunk-LZL6P7SN.cjs.map} +1 -1
- package/dist/chunk-M2OCXTNT.js +311 -0
- package/dist/chunk-M2OCXTNT.js.map +1 -0
- package/dist/{chunk-NZST65RV.js → chunk-PCXI7ZB2.js} +4928 -9349
- package/dist/chunk-PCXI7ZB2.js.map +1 -0
- package/dist/{chunk-DB4HW42V.js → chunk-PVAYXHYF.js} +7 -5
- package/dist/{chunk-DB4HW42V.js.map → chunk-PVAYXHYF.js.map} +1 -1
- package/dist/{chunk-GRTZ23GL.cjs → chunk-TU26IZPO.cjs} +16 -318
- package/dist/chunk-TU26IZPO.cjs.map +1 -0
- package/dist/{chunk-VI7GW7PE.js → chunk-VAKBNCV6.js} +7 -5
- package/dist/{chunk-VI7GW7PE.js.map → chunk-VAKBNCV6.js.map} +1 -1
- package/dist/chunk-ZXZJSTNV.js +172 -0
- package/dist/chunk-ZXZJSTNV.js.map +1 -0
- package/dist/components/chat/entity-cards/onboarding-guide-card.d.ts.map +1 -1
- package/dist/components/chat/index.cjs +11 -7
- package/dist/components/chat/index.cjs.map +1 -1
- package/dist/components/chat/index.js +53 -49
- package/dist/components/contact/index.cjs +11 -8
- package/dist/components/contact/index.cjs.map +1 -1
- package/dist/components/contact/index.js +10 -7
- package/dist/components/features/index.cjs +11 -7
- package/dist/components/features/index.cjs.map +1 -1
- package/dist/components/features/index.js +26 -22
- package/dist/components/index.cjs +112 -109
- package/dist/components/index.cjs.map +1 -1
- package/dist/components/index.js +134 -131
- package/dist/components/index.js.map +1 -1
- package/dist/components/navigation/index.cjs +10 -7
- package/dist/components/navigation/index.cjs.map +1 -1
- package/dist/components/navigation/index.js +9 -6
- package/dist/components/onboarding-guides/index.cjs +43 -53
- package/dist/components/onboarding-guides/index.cjs.map +1 -1
- package/dist/components/onboarding-guides/index.js +25 -35
- package/dist/components/onboarding-guides/index.js.map +1 -1
- package/dist/components/onboarding-guides/onboarding-guides-catalog-skeleton.d.ts +11 -11
- package/dist/components/onboarding-guides/onboarding-guides-catalog-skeleton.d.ts.map +1 -1
- package/dist/components/related-content/index.cjs +11 -8
- package/dist/components/related-content/index.cjs.map +1 -1
- package/dist/components/related-content/index.js +10 -7
- package/dist/components/tickets/index.cjs +96 -93
- package/dist/components/tickets/index.cjs.map +1 -1
- package/dist/components/tickets/index.js +21 -18
- package/dist/components/tickets/index.js.map +1 -1
- package/dist/components/ui/file-manager/index.cjs +52 -50
- package/dist/components/ui/file-manager/index.cjs.map +1 -1
- package/dist/components/ui/file-manager/index.js +6 -4
- package/dist/components/ui/file-manager/index.js.map +1 -1
- package/dist/components/ui/index.cjs +16 -11
- package/dist/components/ui/index.cjs.map +1 -1
- package/dist/components/ui/index.js +102 -97
- package/dist/contexts/index.cjs +2 -2
- package/dist/contexts/index.js +5 -5
- package/dist/hooks/index.cjs +6 -4
- package/dist/hooks/index.cjs.map +1 -1
- package/dist/hooks/index.js +8 -6
- package/dist/index.cjs +17 -11
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +157 -151
- package/package.json +1 -1
- package/src/components/chat/entity-cards/onboarding-guide-card.tsx +6 -1
- package/src/components/onboarding-guides/onboarding-guides-catalog-skeleton.tsx +28 -33
- package/dist/chunk-27VVOBDB.cjs.map +0 -1
- package/dist/chunk-3JRA55FZ.cjs.map +0 -1
- package/dist/chunk-AGU44B7B.js.map +0 -1
- package/dist/chunk-ESADULCN.cjs.map +0 -1
- package/dist/chunk-GRTZ23GL.cjs.map +0 -1
- package/dist/chunk-LXDA67PW.js +0 -162
- package/dist/chunk-LXDA67PW.js.map +0 -1
- package/dist/chunk-NZST65RV.js.map +0 -1
- package/dist/chunk-P2G5X6AW.cjs.map +0 -1
- package/dist/chunk-PINAV6VJ.cjs.map +0 -1
- package/dist/chunk-QRGODKEG.js.map +0 -1
- package/dist/chunk-UECRKCKH.js.map +0 -1
- package/dist/chunk-YJVDQZ5Y.cjs +0 -162
- package/dist/chunk-YJVDQZ5Y.cjs.map +0 -1
- /package/dist/{chunk-ZXECERJ4.js.map → chunk-4HHYUEMD.js.map} +0 -0
|
@@ -2,6 +2,12 @@
|
|
|
2
2
|
import {
|
|
3
3
|
useRequiredEndpointsRuntime
|
|
4
4
|
} from "./chunk-MJNXIEV2.js";
|
|
5
|
+
import {
|
|
6
|
+
createNatsClient
|
|
7
|
+
} from "./chunk-CZR7ARBA.js";
|
|
8
|
+
import {
|
|
9
|
+
useDebounce
|
|
10
|
+
} from "./chunk-ZXZJSTNV.js";
|
|
5
11
|
import {
|
|
6
12
|
init_next_navigation,
|
|
7
13
|
useRouter,
|
|
@@ -26,29 +32,11 @@ import {
|
|
|
26
32
|
TacticalRmmLogoIcon,
|
|
27
33
|
XmarkIcon
|
|
28
34
|
} from "./chunk-4WZOFD46.js";
|
|
29
|
-
import {
|
|
30
|
-
createNatsClient
|
|
31
|
-
} from "./chunk-CZR7ARBA.js";
|
|
32
|
-
|
|
33
|
-
// src/hooks/ui/use-debounce.ts
|
|
34
|
-
import { useState, useEffect } from "react";
|
|
35
|
-
function useDebounce(value, delay = 500) {
|
|
36
|
-
const [debouncedValue, setDebouncedValue] = useState(value);
|
|
37
|
-
useEffect(() => {
|
|
38
|
-
const timer = setTimeout(() => {
|
|
39
|
-
setDebouncedValue(value);
|
|
40
|
-
}, delay);
|
|
41
|
-
return () => {
|
|
42
|
-
clearTimeout(timer);
|
|
43
|
-
};
|
|
44
|
-
}, [value, delay]);
|
|
45
|
-
return debouncedValue;
|
|
46
|
-
}
|
|
47
35
|
|
|
48
36
|
// src/hooks/ui/use-local-storage.ts
|
|
49
|
-
import { useEffect
|
|
37
|
+
import { useEffect, useRef, useState } from "react";
|
|
50
38
|
function useLocalStorage(key, initialValue) {
|
|
51
|
-
const [storedValue, setStoredValue] =
|
|
39
|
+
const [storedValue, setStoredValue] = useState(() => {
|
|
52
40
|
try {
|
|
53
41
|
if (typeof window !== "undefined") {
|
|
54
42
|
const item = window.localStorage.getItem(key);
|
|
@@ -61,7 +49,7 @@ function useLocalStorage(key, initialValue) {
|
|
|
61
49
|
});
|
|
62
50
|
const isInitialized = useRef(true);
|
|
63
51
|
const isFromStorageEvent = useRef(false);
|
|
64
|
-
|
|
52
|
+
useEffect(() => {
|
|
65
53
|
if (!isInitialized.current) return;
|
|
66
54
|
const handleStorageChange = (e) => {
|
|
67
55
|
if (e.key === key && e.newValue !== null) {
|
|
@@ -100,7 +88,7 @@ function useLocalStorage(key, initialValue) {
|
|
|
100
88
|
window.removeEventListener("localStorageUpdate", handleCustomStorageUpdate);
|
|
101
89
|
};
|
|
102
90
|
}, [key]);
|
|
103
|
-
|
|
91
|
+
useEffect(() => {
|
|
104
92
|
if (!isInitialized.current) return;
|
|
105
93
|
if (isFromStorageEvent.current) {
|
|
106
94
|
isFromStorageEvent.current = false;
|
|
@@ -126,9 +114,9 @@ function useLocalStorage(key, initialValue) {
|
|
|
126
114
|
}
|
|
127
115
|
|
|
128
116
|
// src/hooks/ui/use-media-query.ts
|
|
129
|
-
import { useLayoutEffect, useState as
|
|
117
|
+
import { useLayoutEffect, useState as useState2 } from "react";
|
|
130
118
|
function useMediaQuery(query) {
|
|
131
|
-
const [matches, setMatches] =
|
|
119
|
+
const [matches, setMatches] = useState2(void 0);
|
|
132
120
|
useLayoutEffect(() => {
|
|
133
121
|
const matchMedia = window.matchMedia(query);
|
|
134
122
|
const handleChange = () => {
|
|
@@ -174,7 +162,7 @@ function useMemoizedCallback(callback, dependencies) {
|
|
|
174
162
|
}
|
|
175
163
|
|
|
176
164
|
// src/hooks/ui/use-onboarding-state.ts
|
|
177
|
-
import { useState as
|
|
165
|
+
import { useState as useState3, useEffect as useEffect2, useCallback as useCallback2 } from "react";
|
|
178
166
|
|
|
179
167
|
// src/utils/onboarding-storage.ts
|
|
180
168
|
var DEFAULT_STATE = {
|
|
@@ -249,9 +237,9 @@ function dismissOnboarding(key) {
|
|
|
249
237
|
|
|
250
238
|
// src/hooks/ui/use-onboarding-state.ts
|
|
251
239
|
function useOnboardingState(storageKey = "openframe-onboarding-state") {
|
|
252
|
-
const [state, setState] =
|
|
253
|
-
const [, forceUpdate] =
|
|
254
|
-
|
|
240
|
+
const [state, setState] = useState3(() => loadOnboardingState(storageKey));
|
|
241
|
+
const [, forceUpdate] = useState3(0);
|
|
242
|
+
useEffect2(() => {
|
|
255
243
|
const handleStorageUpdate = (e) => {
|
|
256
244
|
if (e.detail.key === storageKey) {
|
|
257
245
|
const newState = loadOnboardingState(storageKey);
|
|
@@ -349,11 +337,11 @@ function useTablePagination(config) {
|
|
|
349
337
|
}
|
|
350
338
|
|
|
351
339
|
// src/hooks/ui/use-throttle.ts
|
|
352
|
-
import { useState as
|
|
340
|
+
import { useState as useState4, useEffect as useEffect3, useRef as useRef3 } from "react";
|
|
353
341
|
function useThrottle(value, limit = 200) {
|
|
354
|
-
const [throttledValue, setThrottledValue] =
|
|
342
|
+
const [throttledValue, setThrottledValue] = useState4(value);
|
|
355
343
|
const lastUpdated = useRef3(Date.now());
|
|
356
|
-
|
|
344
|
+
useEffect3(() => {
|
|
357
345
|
const now = Date.now();
|
|
358
346
|
const elapsed = now - lastUpdated.current;
|
|
359
347
|
if (elapsed >= limit) {
|
|
@@ -373,13 +361,13 @@ function useThrottle(value, limit = 200) {
|
|
|
373
361
|
}
|
|
374
362
|
|
|
375
363
|
// src/hooks/ui/use-window-size.ts
|
|
376
|
-
import { useLayoutEffect as useLayoutEffect2, useState as
|
|
364
|
+
import { useLayoutEffect as useLayoutEffect2, useState as useState5 } from "react";
|
|
377
365
|
function useWindowSize() {
|
|
378
|
-
const [windowSize, setWindowSize] =
|
|
366
|
+
const [windowSize, setWindowSize] = useState5({
|
|
379
367
|
width: 0,
|
|
380
368
|
height: 0
|
|
381
369
|
});
|
|
382
|
-
const [isClient, setIsClient] =
|
|
370
|
+
const [isClient, setIsClient] = useState5(false);
|
|
383
371
|
useLayoutEffect2(() => {
|
|
384
372
|
setIsClient(true);
|
|
385
373
|
if (!isClient) return;
|
|
@@ -397,15 +385,15 @@ function useWindowSize() {
|
|
|
397
385
|
}
|
|
398
386
|
|
|
399
387
|
// src/hooks/ui/use-horizontal-scrollbar.ts
|
|
400
|
-
import { useRef as useRef4, useState as
|
|
388
|
+
import { useRef as useRef4, useState as useState6, useCallback as useCallback3 } from "react";
|
|
401
389
|
function useHorizontalScrollbar() {
|
|
402
390
|
const scrollElRef = useRef4(null);
|
|
403
391
|
const trackRef = useRef4(null);
|
|
404
392
|
const thumbRef = useRef4(null);
|
|
405
393
|
const roRef = useRef4(null);
|
|
406
|
-
const [thumbRatio, setThumbRatio] =
|
|
407
|
-
const [canScrollLeft, setCanScrollLeft] =
|
|
408
|
-
const [canScrollRight, setCanScrollRight] =
|
|
394
|
+
const [thumbRatio, setThumbRatio] = useState6(0);
|
|
395
|
+
const [canScrollLeft, setCanScrollLeft] = useState6(false);
|
|
396
|
+
const [canScrollRight, setCanScrollRight] = useState6(false);
|
|
409
397
|
const prevCanScrollLeftRef = useRef4(false);
|
|
410
398
|
const prevCanScrollRightRef = useRef4(false);
|
|
411
399
|
const isDraggingRef = useRef4(false);
|
|
@@ -573,7 +561,7 @@ function useHorizontalScrollbar() {
|
|
|
573
561
|
}
|
|
574
562
|
|
|
575
563
|
// src/hooks/ui/use-image-edge-color.ts
|
|
576
|
-
import { useState as
|
|
564
|
+
import { useState as useState7, useEffect as useEffect4 } from "react";
|
|
577
565
|
function extractEdgeColor(img) {
|
|
578
566
|
const canvas = document.createElement("canvas");
|
|
579
567
|
const ctx = canvas.getContext("2d");
|
|
@@ -629,8 +617,8 @@ function extractEdgeColor(img) {
|
|
|
629
617
|
return `rgb(${r}, ${g}, ${b})`;
|
|
630
618
|
}
|
|
631
619
|
function useImageEdgeColor(imageUrl, fallback = "#000000") {
|
|
632
|
-
const [color, setColor] =
|
|
633
|
-
|
|
620
|
+
const [color, setColor] = useState7(fallback);
|
|
621
|
+
useEffect4(() => {
|
|
634
622
|
if (!imageUrl) {
|
|
635
623
|
setColor(fallback);
|
|
636
624
|
return;
|
|
@@ -659,19 +647,19 @@ function useImageEdgeColor(imageUrl, fallback = "#000000") {
|
|
|
659
647
|
}
|
|
660
648
|
|
|
661
649
|
// src/hooks/ui/use-search.ts
|
|
662
|
-
import { useState as
|
|
650
|
+
import { useState as useState8, useEffect as useEffect5, useCallback as useCallback4 } from "react";
|
|
663
651
|
function useSearch(config) {
|
|
664
652
|
const { searchFn, mapResult, debounceMs = 300, minQueryLength = 2 } = config;
|
|
665
|
-
const [query, setQuery] =
|
|
666
|
-
const [results, setResults] =
|
|
667
|
-
const [isLoading, setIsLoading] =
|
|
668
|
-
const [error, setError] =
|
|
653
|
+
const [query, setQuery] = useState8("");
|
|
654
|
+
const [results, setResults] = useState8([]);
|
|
655
|
+
const [isLoading, setIsLoading] = useState8(false);
|
|
656
|
+
const [error, setError] = useState8(null);
|
|
669
657
|
const debouncedQuery = useDebounce(query, debounceMs);
|
|
670
658
|
const clearResults = useCallback4(() => {
|
|
671
659
|
setResults([]);
|
|
672
660
|
setError(null);
|
|
673
661
|
}, []);
|
|
674
|
-
|
|
662
|
+
useEffect5(() => {
|
|
675
663
|
if (!debouncedQuery || debouncedQuery.length < minQueryLength) {
|
|
676
664
|
setResults([]);
|
|
677
665
|
setIsLoading(false);
|
|
@@ -706,86 +694,8 @@ function useSearch(config) {
|
|
|
706
694
|
return { query, setQuery, results, isLoading, error, clearResults };
|
|
707
695
|
}
|
|
708
696
|
|
|
709
|
-
// src/hooks/ui/use-auto-limit-tags.ts
|
|
710
|
-
import { useCallback as useCallback5, useEffect as useEffect7, useRef as useRef5, useState as useState10 } from "react";
|
|
711
|
-
function useAutoLimitTags({
|
|
712
|
-
count,
|
|
713
|
-
limitTags = "auto",
|
|
714
|
-
placeholder = "",
|
|
715
|
-
reserveInputWidth = true
|
|
716
|
-
}) {
|
|
717
|
-
const middleRef = useRef5(null);
|
|
718
|
-
const measureRef = useRef5(null);
|
|
719
|
-
const textMeasureRef = useRef5(null);
|
|
720
|
-
const badgeRef = useRef5(null);
|
|
721
|
-
const inputRef = useRef5(null);
|
|
722
|
-
const [visibleCount, setVisibleCount] = useState10(count);
|
|
723
|
-
const recalculate = useCallback5(() => {
|
|
724
|
-
if (limitTags !== "auto") {
|
|
725
|
-
setVisibleCount(Math.min(limitTags, count));
|
|
726
|
-
return;
|
|
727
|
-
}
|
|
728
|
-
const middle = middleRef.current;
|
|
729
|
-
const measure = measureRef.current;
|
|
730
|
-
if (!middle || !measure) {
|
|
731
|
-
setVisibleCount(count);
|
|
732
|
-
return;
|
|
733
|
-
}
|
|
734
|
-
if (count === 0) {
|
|
735
|
-
setVisibleCount(0);
|
|
736
|
-
return;
|
|
737
|
-
}
|
|
738
|
-
const cs = getComputedStyle(middle);
|
|
739
|
-
const padL = parseFloat(cs.paddingLeft) || 0;
|
|
740
|
-
const padR = parseFloat(cs.paddingRight) || 0;
|
|
741
|
-
const gap = parseFloat(cs.gap) || 0;
|
|
742
|
-
const middleW = middle.clientWidth;
|
|
743
|
-
let inputReservedW = 0;
|
|
744
|
-
let trailingGap = 0;
|
|
745
|
-
if (reserveInputWidth) {
|
|
746
|
-
const textW = textMeasureRef.current?.offsetWidth ?? 60;
|
|
747
|
-
const inputMinW = inputRef.current ? parseFloat(getComputedStyle(inputRef.current).minWidth) || 60 : 60;
|
|
748
|
-
inputReservedW = Math.max(textW + 8, inputMinW);
|
|
749
|
-
trailingGap = gap;
|
|
750
|
-
}
|
|
751
|
-
const available = middleW - padL - padR - inputReservedW - trailingGap;
|
|
752
|
-
const tagEls = Array.from(measure.children);
|
|
753
|
-
const widths = tagEls.map((el) => el.offsetWidth);
|
|
754
|
-
let total = 0;
|
|
755
|
-
for (let i = 0; i < widths.length; i++) {
|
|
756
|
-
total += widths[i] + (i > 0 ? gap : 0);
|
|
757
|
-
}
|
|
758
|
-
if (total <= available) {
|
|
759
|
-
setVisibleCount(count);
|
|
760
|
-
return;
|
|
761
|
-
}
|
|
762
|
-
const badgeW = badgeRef.current?.offsetWidth ?? 40;
|
|
763
|
-
const spaceWithBadge = available - badgeW - gap;
|
|
764
|
-
let used = 0;
|
|
765
|
-
let fitCount = 0;
|
|
766
|
-
for (let i = 0; i < widths.length; i++) {
|
|
767
|
-
const need = widths[i] + (i > 0 ? gap : 0);
|
|
768
|
-
if (used + need > spaceWithBadge) break;
|
|
769
|
-
used += need;
|
|
770
|
-
fitCount++;
|
|
771
|
-
}
|
|
772
|
-
setVisibleCount(Math.max(0, fitCount));
|
|
773
|
-
}, [count, limitTags, placeholder, reserveInputWidth]);
|
|
774
|
-
useEffect7(() => {
|
|
775
|
-
recalculate();
|
|
776
|
-
}, [recalculate]);
|
|
777
|
-
useEffect7(() => {
|
|
778
|
-
const el = middleRef.current;
|
|
779
|
-
if (!el) return;
|
|
780
|
-
const ro = new ResizeObserver(recalculate);
|
|
781
|
-
ro.observe(el);
|
|
782
|
-
return () => ro.disconnect();
|
|
783
|
-
}, [recalculate]);
|
|
784
|
-
return { visibleCount, middleRef, measureRef, textMeasureRef, badgeRef, inputRef };
|
|
785
|
-
}
|
|
786
|
-
|
|
787
697
|
// src/hooks/platform/use-platform-config.ts
|
|
788
|
-
import { useState as
|
|
698
|
+
import { useState as useState9, useEffect as useEffect6 } from "react";
|
|
789
699
|
|
|
790
700
|
// src/utils/platform-config.tsx
|
|
791
701
|
import { Globe } from "lucide-react";
|
|
@@ -963,10 +873,10 @@ function getPlatformIconComponent(platformName, className = "h-6 w-6") {
|
|
|
963
873
|
var platformCache = null;
|
|
964
874
|
var fetchPromise = null;
|
|
965
875
|
function usePlatformConfig() {
|
|
966
|
-
const [platforms, setPlatforms] =
|
|
967
|
-
const [isLoading, setIsLoading] =
|
|
968
|
-
const [error, setError] =
|
|
969
|
-
|
|
876
|
+
const [platforms, setPlatforms] = useState9(platformCache || []);
|
|
877
|
+
const [isLoading, setIsLoading] = useState9(!platformCache);
|
|
878
|
+
const [error, setError] = useState9(null);
|
|
879
|
+
useEffect6(() => {
|
|
970
880
|
if (platformCache) {
|
|
971
881
|
setPlatforms(platformCache);
|
|
972
882
|
setIsLoading(false);
|
|
@@ -1415,16 +1325,16 @@ var useToast = () => ({
|
|
|
1415
1325
|
});
|
|
1416
1326
|
|
|
1417
1327
|
// src/hooks/use-contact-submission.ts
|
|
1418
|
-
import { useState as
|
|
1328
|
+
import { useState as useState11, useCallback as useCallback5, useEffect as useEffect7 } from "react";
|
|
1419
1329
|
init_next_navigation();
|
|
1420
1330
|
function useContactSubmission(options = {}) {
|
|
1421
1331
|
const { userId, successRedirectUrl, successToastMessage, onSuccess } = options;
|
|
1422
1332
|
const { toast: toast2 } = useToast();
|
|
1423
1333
|
const router = useRouter();
|
|
1424
1334
|
const { contactUrl } = useRequiredEndpointsRuntime();
|
|
1425
|
-
const [isSubmitting, setIsSubmitting] =
|
|
1426
|
-
const [isSuccess, setIsSuccess] =
|
|
1427
|
-
const submit =
|
|
1335
|
+
const [isSubmitting, setIsSubmitting] = useState11(false);
|
|
1336
|
+
const [isSuccess, setIsSuccess] = useState11(false);
|
|
1337
|
+
const submit = useCallback5(async (formData) => {
|
|
1428
1338
|
if (isSubmitting) return;
|
|
1429
1339
|
setIsSubmitting(true);
|
|
1430
1340
|
try {
|
|
@@ -1459,7 +1369,7 @@ function useContactSubmission(options = {}) {
|
|
|
1459
1369
|
setIsSubmitting(false);
|
|
1460
1370
|
}
|
|
1461
1371
|
}, [isSubmitting, toast2, userId, successToastMessage, contactUrl]);
|
|
1462
|
-
|
|
1372
|
+
useEffect7(() => {
|
|
1463
1373
|
if (isSuccess && successRedirectUrl) {
|
|
1464
1374
|
console.log("\u{1F680} Contact submission successful, redirecting to:", successRedirectUrl);
|
|
1465
1375
|
const timer = setTimeout(() => {
|
|
@@ -1473,7 +1383,7 @@ function useContactSubmission(options = {}) {
|
|
|
1473
1383
|
return () => clearTimeout(timer);
|
|
1474
1384
|
}
|
|
1475
1385
|
}, [isSuccess, successRedirectUrl, router]);
|
|
1476
|
-
|
|
1386
|
+
useEffect7(() => {
|
|
1477
1387
|
if (isSuccess && onSuccess) {
|
|
1478
1388
|
onSuccess();
|
|
1479
1389
|
}
|
|
@@ -1482,19 +1392,19 @@ function useContactSubmission(options = {}) {
|
|
|
1482
1392
|
}
|
|
1483
1393
|
|
|
1484
1394
|
// src/hooks/use-quick-action-hint.ts
|
|
1485
|
-
import { useEffect as
|
|
1395
|
+
import { useEffect as useEffect8, useState as useState12, useRef as useRef5, useCallback as useCallback6 } from "react";
|
|
1486
1396
|
function useQuickActionHint({
|
|
1487
1397
|
actionCount,
|
|
1488
1398
|
cycleDuration = 5e3,
|
|
1489
1399
|
enabled = true
|
|
1490
1400
|
}) {
|
|
1491
|
-
const [activeHintIndex, setActiveHintIndex] =
|
|
1492
|
-
const containerRef =
|
|
1493
|
-
const timeoutRef =
|
|
1494
|
-
const cycleCountRef =
|
|
1495
|
-
const currentIndexRef =
|
|
1496
|
-
const sequenceRef =
|
|
1497
|
-
const shuffleIndices =
|
|
1401
|
+
const [activeHintIndex, setActiveHintIndex] = useState12(-1);
|
|
1402
|
+
const containerRef = useRef5(null);
|
|
1403
|
+
const timeoutRef = useRef5(null);
|
|
1404
|
+
const cycleCountRef = useRef5(0);
|
|
1405
|
+
const currentIndexRef = useRef5(0);
|
|
1406
|
+
const sequenceRef = useRef5([]);
|
|
1407
|
+
const shuffleIndices = useCallback6((length) => {
|
|
1498
1408
|
const indices = Array.from({ length }, (_, i) => i);
|
|
1499
1409
|
for (let i = indices.length - 1; i > 0; i--) {
|
|
1500
1410
|
const j = Math.floor(Math.random() * (i + 1));
|
|
@@ -1502,7 +1412,7 @@ function useQuickActionHint({
|
|
|
1502
1412
|
}
|
|
1503
1413
|
return indices;
|
|
1504
1414
|
}, []);
|
|
1505
|
-
const stopHint =
|
|
1415
|
+
const stopHint = useCallback6(() => {
|
|
1506
1416
|
if (timeoutRef.current) {
|
|
1507
1417
|
clearTimeout(timeoutRef.current);
|
|
1508
1418
|
timeoutRef.current = null;
|
|
@@ -1512,7 +1422,7 @@ function useQuickActionHint({
|
|
|
1512
1422
|
currentIndexRef.current = 0;
|
|
1513
1423
|
sequenceRef.current = [];
|
|
1514
1424
|
}, []);
|
|
1515
|
-
const advanceHint =
|
|
1425
|
+
const advanceHint = useCallback6(() => {
|
|
1516
1426
|
if (currentIndexRef.current === 0) {
|
|
1517
1427
|
sequenceRef.current = shuffleIndices(actionCount);
|
|
1518
1428
|
}
|
|
@@ -1525,7 +1435,7 @@ function useQuickActionHint({
|
|
|
1525
1435
|
}
|
|
1526
1436
|
timeoutRef.current = setTimeout(advanceHint, cycleDuration);
|
|
1527
1437
|
}, [actionCount, cycleDuration, shuffleIndices]);
|
|
1528
|
-
|
|
1438
|
+
useEffect8(() => {
|
|
1529
1439
|
if (!enabled || actionCount === 0) {
|
|
1530
1440
|
return;
|
|
1531
1441
|
}
|
|
@@ -1551,7 +1461,7 @@ function useQuickActionHint({
|
|
|
1551
1461
|
}
|
|
1552
1462
|
|
|
1553
1463
|
// src/hooks/use-copy-to-clipboard.ts
|
|
1554
|
-
import { useCallback as
|
|
1464
|
+
import { useCallback as useCallback7, useState as useState13 } from "react";
|
|
1555
1465
|
function useCopyToClipboard({
|
|
1556
1466
|
successTitle = "Copied",
|
|
1557
1467
|
successDescription = "Copied to clipboard",
|
|
@@ -1560,8 +1470,8 @@ function useCopyToClipboard({
|
|
|
1560
1470
|
resetDelay = 2e3
|
|
1561
1471
|
} = {}) {
|
|
1562
1472
|
const { toast: toast2 } = useToast();
|
|
1563
|
-
const [copied, setCopied] =
|
|
1564
|
-
const copy =
|
|
1473
|
+
const [copied, setCopied] = useState13(false);
|
|
1474
|
+
const copy = useCallback7(
|
|
1565
1475
|
async (text) => {
|
|
1566
1476
|
try {
|
|
1567
1477
|
await navigator.clipboard.writeText(text);
|
|
@@ -1578,7 +1488,7 @@ function useCopyToClipboard({
|
|
|
1578
1488
|
}
|
|
1579
1489
|
|
|
1580
1490
|
// src/hooks/use-batch-images.ts
|
|
1581
|
-
import { useEffect as
|
|
1491
|
+
import { useEffect as useEffect9, useMemo as useMemo2, useState as useState14, useRef as useRef6 } from "react";
|
|
1582
1492
|
var globalBatchImageConfig = {};
|
|
1583
1493
|
function configureBatchImageFetch(config) {
|
|
1584
1494
|
globalBatchImageConfig = { ...globalBatchImageConfig, ...config };
|
|
@@ -1651,14 +1561,14 @@ async function batchFetchAuthenticatedImages(imageUrls, config) {
|
|
|
1651
1561
|
return results;
|
|
1652
1562
|
}
|
|
1653
1563
|
function useBatchImages(imageUrls, config) {
|
|
1654
|
-
const [fetchedImages, setFetchedImages] =
|
|
1655
|
-
const [loading, setLoading] =
|
|
1564
|
+
const [fetchedImages, setFetchedImages] = useState14({});
|
|
1565
|
+
const [loading, setLoading] = useState14(false);
|
|
1656
1566
|
const uniqueUrls = useMemo2(
|
|
1657
1567
|
() => Array.from(new Set(imageUrls.filter((url) => Boolean(url)))),
|
|
1658
1568
|
[imageUrls]
|
|
1659
1569
|
);
|
|
1660
|
-
const requestedUrls =
|
|
1661
|
-
|
|
1570
|
+
const requestedUrls = useRef6(/* @__PURE__ */ new Set());
|
|
1571
|
+
useEffect9(() => {
|
|
1662
1572
|
if (uniqueUrls.length === 0) {
|
|
1663
1573
|
setFetchedImages({});
|
|
1664
1574
|
return;
|
|
@@ -1688,7 +1598,7 @@ function useBatchImages(imageUrls, config) {
|
|
|
1688
1598
|
}
|
|
1689
1599
|
|
|
1690
1600
|
// src/hooks/use-authenticated-image.ts
|
|
1691
|
-
import { useEffect as
|
|
1601
|
+
import { useEffect as useEffect10, useState as useState15, useRef as useRef7 } from "react";
|
|
1692
1602
|
var globalImageConfig = {};
|
|
1693
1603
|
var imageCache = /* @__PURE__ */ new Map();
|
|
1694
1604
|
var pendingRequests = /* @__PURE__ */ new Map();
|
|
@@ -1717,11 +1627,11 @@ function getImageConfig() {
|
|
|
1717
1627
|
};
|
|
1718
1628
|
}
|
|
1719
1629
|
function useAuthenticatedImage(imageUrl, refreshKey, config) {
|
|
1720
|
-
const [fetchedImageUrl, setFetchedImageUrl] =
|
|
1721
|
-
const [isLoading, setIsLoading] =
|
|
1722
|
-
const [error, setError] =
|
|
1723
|
-
const currentCacheKeyRef =
|
|
1724
|
-
|
|
1630
|
+
const [fetchedImageUrl, setFetchedImageUrl] = useState15();
|
|
1631
|
+
const [isLoading, setIsLoading] = useState15(false);
|
|
1632
|
+
const [error, setError] = useState15(null);
|
|
1633
|
+
const currentCacheKeyRef = useRef7(null);
|
|
1634
|
+
useEffect10(() => {
|
|
1725
1635
|
if (!imageUrl) {
|
|
1726
1636
|
setFetchedImageUrl(void 0);
|
|
1727
1637
|
setIsLoading(false);
|
|
@@ -1832,7 +1742,7 @@ function useAuthenticatedImage(imageUrl, refreshKey, config) {
|
|
|
1832
1742
|
});
|
|
1833
1743
|
pendingRequests.set(cacheKey, fetchPromise2);
|
|
1834
1744
|
}, [imageUrl, refreshKey, config]);
|
|
1835
|
-
|
|
1745
|
+
useEffect10(() => {
|
|
1836
1746
|
return () => {
|
|
1837
1747
|
if (currentCacheKeyRef.current) {
|
|
1838
1748
|
const entry = imageCache.get(currentCacheKeyRef.current);
|
|
@@ -1847,7 +1757,7 @@ function useAuthenticatedImage(imageUrl, refreshKey, config) {
|
|
|
1847
1757
|
|
|
1848
1758
|
// src/hooks/state/use-query-params.ts
|
|
1849
1759
|
init_next_navigation();
|
|
1850
|
-
import { useEffect as
|
|
1760
|
+
import { useEffect as useEffect11, useState as useState16, useMemo as useMemo3, useCallback as useCallback8 } from "react";
|
|
1851
1761
|
|
|
1852
1762
|
// src/hooks/state/graphql-parser.ts
|
|
1853
1763
|
import {
|
|
@@ -2309,14 +2219,14 @@ var introspector = new GraphQLIntrospector();
|
|
|
2309
2219
|
function useQueryParams(query, options = {}) {
|
|
2310
2220
|
const router = useRouter();
|
|
2311
2221
|
const searchParams = useSearchParams();
|
|
2312
|
-
const [isLoading, setIsLoading] =
|
|
2313
|
-
const [isReady, setIsReady] =
|
|
2314
|
-
const [error, setError] =
|
|
2315
|
-
const [schema, setSchema] =
|
|
2222
|
+
const [isLoading, setIsLoading] = useState16(true);
|
|
2223
|
+
const [isReady, setIsReady] = useState16(false);
|
|
2224
|
+
const [error, setError] = useState16(null);
|
|
2225
|
+
const [schema, setSchema] = useState16({});
|
|
2316
2226
|
const defaultValues = options.defaultValues || {};
|
|
2317
2227
|
const skipIntrospection = options.skipIntrospection || false;
|
|
2318
2228
|
const debug = options.debug || false;
|
|
2319
|
-
|
|
2229
|
+
useEffect11(() => {
|
|
2320
2230
|
async function initialize() {
|
|
2321
2231
|
try {
|
|
2322
2232
|
if (debug) console.log("[useQueryParams] Initializing...");
|
|
@@ -2386,14 +2296,14 @@ function useQueryParams(query, options = {}) {
|
|
|
2386
2296
|
});
|
|
2387
2297
|
return result;
|
|
2388
2298
|
}, [searchParams]);
|
|
2389
|
-
const updateUrl =
|
|
2299
|
+
const updateUrl = useCallback8((newParams) => {
|
|
2390
2300
|
const url = newParams.toString() ? `?${newParams.toString()}` : window.location.pathname;
|
|
2391
2301
|
if (debug) {
|
|
2392
2302
|
console.log("[useQueryParams] Updating URL:", url);
|
|
2393
2303
|
}
|
|
2394
2304
|
router.replace(url, { scroll: false });
|
|
2395
2305
|
}, [router, debug]);
|
|
2396
|
-
const setParam =
|
|
2306
|
+
const setParam = useCallback8((key, value) => {
|
|
2397
2307
|
if (!isReady) {
|
|
2398
2308
|
console.warn("[useQueryParams] Schema not ready, cannot set param");
|
|
2399
2309
|
return;
|
|
@@ -2407,7 +2317,7 @@ function useQueryParams(query, options = {}) {
|
|
|
2407
2317
|
console.error("[useQueryParams] Failed to set param:", err);
|
|
2408
2318
|
}
|
|
2409
2319
|
}, [variables, schema, isReady, updateUrl]);
|
|
2410
|
-
const setParams =
|
|
2320
|
+
const setParams = useCallback8((updates) => {
|
|
2411
2321
|
if (!isReady) {
|
|
2412
2322
|
console.warn("[useQueryParams] Schema not ready, cannot set params");
|
|
2413
2323
|
return;
|
|
@@ -2421,7 +2331,7 @@ function useQueryParams(query, options = {}) {
|
|
|
2421
2331
|
console.error("[useQueryParams] Failed to set params:", err);
|
|
2422
2332
|
}
|
|
2423
2333
|
}, [variables, schema, isReady, updateUrl]);
|
|
2424
|
-
const clearParamsHandler =
|
|
2334
|
+
const clearParamsHandler = useCallback8((keys) => {
|
|
2425
2335
|
if (!isReady) {
|
|
2426
2336
|
console.warn("[useQueryParams] Schema not ready, cannot clear params");
|
|
2427
2337
|
return;
|
|
@@ -2435,7 +2345,7 @@ function useQueryParams(query, options = {}) {
|
|
|
2435
2345
|
console.error("[useQueryParams] Failed to clear params:", err);
|
|
2436
2346
|
}
|
|
2437
2347
|
}, [variables, schema, isReady, updateUrl]);
|
|
2438
|
-
const resetParams =
|
|
2348
|
+
const resetParams = useCallback8(() => {
|
|
2439
2349
|
if (debug) {
|
|
2440
2350
|
console.log("[useQueryParams] Resetting params");
|
|
2441
2351
|
}
|
|
@@ -2468,9 +2378,9 @@ function applyParamMapping(schema, mapping) {
|
|
|
2468
2378
|
|
|
2469
2379
|
// src/hooks/state/use-api-params.ts
|
|
2470
2380
|
init_next_navigation();
|
|
2471
|
-
import { useCallback as
|
|
2381
|
+
import { useCallback as useCallback9, useMemo as useMemo4, useRef as useRef8 } from "react";
|
|
2472
2382
|
function useContentStable(value, key) {
|
|
2473
|
-
const ref =
|
|
2383
|
+
const ref = useRef8(void 0);
|
|
2474
2384
|
if (ref.current && ref.current.key === key) return ref.current.value;
|
|
2475
2385
|
ref.current = { value, key };
|
|
2476
2386
|
return value;
|
|
@@ -2503,7 +2413,7 @@ function useApiParams(schema, options = {}) {
|
|
|
2503
2413
|
}
|
|
2504
2414
|
return flattened;
|
|
2505
2415
|
}, [schemaKey]);
|
|
2506
|
-
const prevParamsRef =
|
|
2416
|
+
const prevParamsRef = useRef8(void 0);
|
|
2507
2417
|
const params = useMemo4(() => {
|
|
2508
2418
|
const sp = new URLSearchParams(searchString);
|
|
2509
2419
|
const result = {};
|
|
@@ -2527,7 +2437,7 @@ function useApiParams(schema, options = {}) {
|
|
|
2527
2437
|
prevParamsRef.current = result;
|
|
2528
2438
|
return result;
|
|
2529
2439
|
}, [searchString, schemaKey, debug]);
|
|
2530
|
-
const addParamToSearchParams =
|
|
2440
|
+
const addParamToSearchParams = useCallback9((searchParams, key, value) => {
|
|
2531
2441
|
if (value === void 0 || value === "" || value === null) {
|
|
2532
2442
|
return;
|
|
2533
2443
|
}
|
|
@@ -2555,7 +2465,7 @@ function useApiParams(schema, options = {}) {
|
|
|
2555
2465
|
}
|
|
2556
2466
|
return newParams;
|
|
2557
2467
|
}, [params, schemaKey, flattenedSchema, addParamToSearchParams]);
|
|
2558
|
-
const updateUrl =
|
|
2468
|
+
const updateUrl = useCallback9((newParams, keysToRemove = []) => {
|
|
2559
2469
|
const finalParams = new URLSearchParams(searchString);
|
|
2560
2470
|
keysToRemove.forEach((key) => {
|
|
2561
2471
|
if (key in stableSchema) {
|
|
@@ -2591,7 +2501,7 @@ function useApiParams(schema, options = {}) {
|
|
|
2591
2501
|
}
|
|
2592
2502
|
return false;
|
|
2593
2503
|
};
|
|
2594
|
-
const setParam =
|
|
2504
|
+
const setParam = useCallback9((key, value) => {
|
|
2595
2505
|
const config = stableSchema[key];
|
|
2596
2506
|
if (!config) {
|
|
2597
2507
|
console.warn(`[useApiParams] Unknown parameter: ${key}`);
|
|
@@ -2605,7 +2515,7 @@ function useApiParams(schema, options = {}) {
|
|
|
2605
2515
|
updateUrl(newParams);
|
|
2606
2516
|
}
|
|
2607
2517
|
}, [schemaKey, updateUrl, addParamToSearchParams]);
|
|
2608
|
-
const setParams =
|
|
2518
|
+
const setParams = useCallback9((updates) => {
|
|
2609
2519
|
const newParams = new URLSearchParams();
|
|
2610
2520
|
const keysToRemove = [];
|
|
2611
2521
|
for (const [key, value] of Object.entries(updates)) {
|
|
@@ -2622,11 +2532,11 @@ function useApiParams(schema, options = {}) {
|
|
|
2622
2532
|
}
|
|
2623
2533
|
updateUrl(newParams, keysToRemove);
|
|
2624
2534
|
}, [schemaKey, updateUrl, addParamToSearchParams]);
|
|
2625
|
-
const clearParams2 =
|
|
2535
|
+
const clearParams2 = useCallback9((keys) => {
|
|
2626
2536
|
const newParams = new URLSearchParams();
|
|
2627
2537
|
updateUrl(newParams, keys);
|
|
2628
2538
|
}, [updateUrl]);
|
|
2629
|
-
const resetParams =
|
|
2539
|
+
const resetParams = useCallback9(() => {
|
|
2630
2540
|
if (debug) {
|
|
2631
2541
|
console.log("[useApiParams] Resetting params");
|
|
2632
2542
|
}
|
|
@@ -2663,7 +2573,7 @@ function createSearchParams(params) {
|
|
|
2663
2573
|
}
|
|
2664
2574
|
|
|
2665
2575
|
// src/hooks/state/use-cursor-pagination-state.ts
|
|
2666
|
-
import { useCallback as
|
|
2576
|
+
import { useCallback as useCallback10, useEffect as useEffect12, useRef as useRef9, useState as useState17 } from "react";
|
|
2667
2577
|
var urlSchema = {
|
|
2668
2578
|
search: { type: "string", default: "" },
|
|
2669
2579
|
cursor: { type: "string", default: "" }
|
|
@@ -2674,13 +2584,13 @@ function useCursorPaginationState(options) {
|
|
|
2674
2584
|
onSearchChange
|
|
2675
2585
|
} = options;
|
|
2676
2586
|
const { params, setParam, setParams } = useApiParams(urlSchema);
|
|
2677
|
-
const [searchInput, setSearchInput] =
|
|
2678
|
-
const [hasLoadedBeyondFirst, setHasLoadedBeyondFirst] =
|
|
2679
|
-
const [initialLoadCount, setInitialLoadCount] =
|
|
2680
|
-
const lastSearchRef =
|
|
2681
|
-
const isSyncingFromUrl =
|
|
2682
|
-
const isInitialLoadInProgress =
|
|
2683
|
-
|
|
2587
|
+
const [searchInput, setSearchInput] = useState17(params.search || "");
|
|
2588
|
+
const [hasLoadedBeyondFirst, setHasLoadedBeyondFirst] = useState17(false);
|
|
2589
|
+
const [initialLoadCount, setInitialLoadCount] = useState17(0);
|
|
2590
|
+
const lastSearchRef = useRef9(null);
|
|
2591
|
+
const isSyncingFromUrl = useRef9(false);
|
|
2592
|
+
const isInitialLoadInProgress = useRef9(true);
|
|
2593
|
+
useEffect12(() => {
|
|
2684
2594
|
if (isInitialLoadInProgress.current) return;
|
|
2685
2595
|
const urlSearch = params.search || "";
|
|
2686
2596
|
if (urlSearch !== searchInput) {
|
|
@@ -2691,7 +2601,7 @@ function useCursorPaginationState(options) {
|
|
|
2691
2601
|
}, 0);
|
|
2692
2602
|
}
|
|
2693
2603
|
}, [params.search, initialLoadCount]);
|
|
2694
|
-
|
|
2604
|
+
useEffect12(() => {
|
|
2695
2605
|
if (isInitialLoadInProgress.current) return;
|
|
2696
2606
|
if (isSyncingFromUrl.current) return;
|
|
2697
2607
|
if (searchInput !== params.search) {
|
|
@@ -2702,7 +2612,7 @@ function useCursorPaginationState(options) {
|
|
|
2702
2612
|
});
|
|
2703
2613
|
}
|
|
2704
2614
|
}, [searchInput, params.search, setParams, initialLoadCount]);
|
|
2705
|
-
|
|
2615
|
+
useEffect12(() => {
|
|
2706
2616
|
if (initialLoadCount === 0) {
|
|
2707
2617
|
const cursor = params.cursor || null;
|
|
2708
2618
|
const search = params.search || "";
|
|
@@ -2716,7 +2626,7 @@ function useCursorPaginationState(options) {
|
|
|
2716
2626
|
});
|
|
2717
2627
|
}
|
|
2718
2628
|
}, []);
|
|
2719
|
-
|
|
2629
|
+
useEffect12(() => {
|
|
2720
2630
|
if (isInitialLoadInProgress.current) return;
|
|
2721
2631
|
if (initialLoadCount === 0) return;
|
|
2722
2632
|
const currentSearch = params.search || "";
|
|
@@ -2726,7 +2636,7 @@ function useCursorPaginationState(options) {
|
|
|
2726
2636
|
onSearchChange(currentSearch);
|
|
2727
2637
|
}
|
|
2728
2638
|
}, [params.search, onSearchChange, initialLoadCount]);
|
|
2729
|
-
const handleNextPage =
|
|
2639
|
+
const handleNextPage = useCallback10(
|
|
2730
2640
|
async (endCursor, fetchFn) => {
|
|
2731
2641
|
setParam("cursor", endCursor);
|
|
2732
2642
|
await fetchFn();
|
|
@@ -2734,7 +2644,7 @@ function useCursorPaginationState(options) {
|
|
|
2734
2644
|
},
|
|
2735
2645
|
[setParam]
|
|
2736
2646
|
);
|
|
2737
|
-
const handleResetToFirstPage =
|
|
2647
|
+
const handleResetToFirstPage = useCallback10(
|
|
2738
2648
|
async (fetchFn) => {
|
|
2739
2649
|
setParam("cursor", "");
|
|
2740
2650
|
await fetchFn();
|
|
@@ -2756,16 +2666,16 @@ function useCursorPaginationState(options) {
|
|
|
2756
2666
|
}
|
|
2757
2667
|
|
|
2758
2668
|
// src/hooks/nats/use-nats-client.ts
|
|
2759
|
-
import { useEffect as
|
|
2669
|
+
import { useEffect as useEffect13, useMemo as useMemo5, useState as useState18 } from "react";
|
|
2760
2670
|
function useNatsClient(clientOptions, options = {}) {
|
|
2761
2671
|
const { autoConnect = true } = options;
|
|
2762
2672
|
const client = useMemo5(() => {
|
|
2763
2673
|
if (!clientOptions) return null;
|
|
2764
2674
|
return createNatsClient(clientOptions);
|
|
2765
2675
|
}, [clientOptions]);
|
|
2766
|
-
const [status, setStatus] =
|
|
2767
|
-
const [lastError, setLastError] =
|
|
2768
|
-
|
|
2676
|
+
const [status, setStatus] = useState18("disconnected");
|
|
2677
|
+
const [lastError, setLastError] = useState18(null);
|
|
2678
|
+
useEffect13(() => {
|
|
2769
2679
|
if (!client) {
|
|
2770
2680
|
setStatus("disconnected");
|
|
2771
2681
|
setLastError(null);
|
|
@@ -2795,64 +2705,6 @@ function useNatsClient(clientOptions, options = {}) {
|
|
|
2795
2705
|
};
|
|
2796
2706
|
}
|
|
2797
2707
|
|
|
2798
|
-
// src/hooks/use-near-viewport.ts
|
|
2799
|
-
import { useEffect as useEffect16, useRef as useRef11, useState as useState21, useCallback as useCallback12 } from "react";
|
|
2800
|
-
var observers = /* @__PURE__ */ new Map();
|
|
2801
|
-
var subscribers = /* @__PURE__ */ new WeakMap();
|
|
2802
|
-
function getObserverFor(rootMargin) {
|
|
2803
|
-
const existing = observers.get(rootMargin);
|
|
2804
|
-
if (existing) return existing;
|
|
2805
|
-
const io = new IntersectionObserver(
|
|
2806
|
-
(entries) => {
|
|
2807
|
-
entries.forEach((entry) => {
|
|
2808
|
-
if (!entry.isIntersecting) return;
|
|
2809
|
-
const cb = subscribers.get(entry.target);
|
|
2810
|
-
if (cb) {
|
|
2811
|
-
cb();
|
|
2812
|
-
io.unobserve(entry.target);
|
|
2813
|
-
subscribers.delete(entry.target);
|
|
2814
|
-
}
|
|
2815
|
-
});
|
|
2816
|
-
},
|
|
2817
|
-
{ rootMargin }
|
|
2818
|
-
);
|
|
2819
|
-
observers.set(rootMargin, io);
|
|
2820
|
-
return io;
|
|
2821
|
-
}
|
|
2822
|
-
function useNearViewport(rootMargin = "500px") {
|
|
2823
|
-
const [isNear, setIsNear] = useState21(false);
|
|
2824
|
-
const elRef = useRef11(null);
|
|
2825
|
-
const ref = useCallback12(
|
|
2826
|
-
(node) => {
|
|
2827
|
-
const prev = elRef.current;
|
|
2828
|
-
if (prev) {
|
|
2829
|
-
const stillOurs = subscribers.get(prev);
|
|
2830
|
-
if (stillOurs) {
|
|
2831
|
-
subscribers.delete(prev);
|
|
2832
|
-
observers.get(rootMargin)?.unobserve(prev);
|
|
2833
|
-
}
|
|
2834
|
-
}
|
|
2835
|
-
elRef.current = node;
|
|
2836
|
-
if (!node) return;
|
|
2837
|
-
const cb = () => setIsNear(true);
|
|
2838
|
-
subscribers.set(node, cb);
|
|
2839
|
-
getObserverFor(rootMargin).observe(node);
|
|
2840
|
-
},
|
|
2841
|
-
[rootMargin]
|
|
2842
|
-
);
|
|
2843
|
-
useEffect16(() => {
|
|
2844
|
-
return () => {
|
|
2845
|
-
const el = elRef.current;
|
|
2846
|
-
if (!el) return;
|
|
2847
|
-
if (subscribers.get(el)) {
|
|
2848
|
-
subscribers.delete(el);
|
|
2849
|
-
observers.get(rootMargin)?.unobserve(el);
|
|
2850
|
-
}
|
|
2851
|
-
};
|
|
2852
|
-
}, [rootMargin]);
|
|
2853
|
-
return { ref, isNear };
|
|
2854
|
-
}
|
|
2855
|
-
|
|
2856
2708
|
// src/hooks/use-access-code-integration.ts
|
|
2857
2709
|
import React2 from "react";
|
|
2858
2710
|
|
|
@@ -2955,20 +2807,8 @@ function useAccessCodeIntegration() {
|
|
|
2955
2807
|
};
|
|
2956
2808
|
}
|
|
2957
2809
|
|
|
2958
|
-
// src/hooks/use-og-placeholder.ts
|
|
2959
|
-
import { useMemo as useMemo6 } from "react";
|
|
2960
|
-
function useOgPlaceholder(buildUrl, title, siteName = "", enabled = true, aspect = "wide") {
|
|
2961
|
-
return useMemo6(() => {
|
|
2962
|
-
if (!enabled || !title) return null;
|
|
2963
|
-
const options = {};
|
|
2964
|
-
if (siteName) options.site = siteName;
|
|
2965
|
-
if (aspect === "square") options.aspect = "square";
|
|
2966
|
-
return buildUrl(title, options);
|
|
2967
|
-
}, [buildUrl, title, siteName, enabled, aspect]);
|
|
2968
|
-
}
|
|
2969
|
-
|
|
2970
2810
|
// src/hooks/use-humanity-signals.ts
|
|
2971
|
-
import { useCallback as
|
|
2811
|
+
import { useCallback as useCallback11, useRef as useRef10 } from "react";
|
|
2972
2812
|
|
|
2973
2813
|
// src/utils/humanity-signals.ts
|
|
2974
2814
|
var HONEYPOT_FIELD = "contact_url_confirm";
|
|
@@ -2992,16 +2832,16 @@ var splitCsvEnv = (s) => s?.split(",").map((t) => t.trim()).filter(Boolean) ?? [
|
|
|
2992
2832
|
|
|
2993
2833
|
// src/hooks/use-humanity-signals.ts
|
|
2994
2834
|
function useHumanitySignals() {
|
|
2995
|
-
const ref =
|
|
2996
|
-
const mountedAt =
|
|
2997
|
-
const getSignals =
|
|
2835
|
+
const ref = useRef10(null);
|
|
2836
|
+
const mountedAt = useRef10(typeof performance !== "undefined" ? performance.now() : 0);
|
|
2837
|
+
const getSignals = useCallback11(
|
|
2998
2838
|
() => ({
|
|
2999
2839
|
[HONEYPOT_FIELD]: ref.current?.value ?? "",
|
|
3000
2840
|
[ELAPSED_MS_FIELD]: typeof performance !== "undefined" ? Math.round(performance.now() - mountedAt.current) : 0
|
|
3001
2841
|
}),
|
|
3002
2842
|
[]
|
|
3003
2843
|
);
|
|
3004
|
-
const resetSignals =
|
|
2844
|
+
const resetSignals = useCallback11(() => {
|
|
3005
2845
|
if (ref.current) ref.current.value = "";
|
|
3006
2846
|
if (typeof performance !== "undefined") mountedAt.current = performance.now();
|
|
3007
2847
|
}, []);
|
|
@@ -3009,8 +2849,6 @@ function useHumanitySignals() {
|
|
|
3009
2849
|
}
|
|
3010
2850
|
|
|
3011
2851
|
export {
|
|
3012
|
-
useAutoLimitTags,
|
|
3013
|
-
useDebounce,
|
|
3014
2852
|
useLocalStorage,
|
|
3015
2853
|
useMediaQuery,
|
|
3016
2854
|
breakpoints,
|
|
@@ -3089,12 +2927,10 @@ export {
|
|
|
3089
2927
|
createSearchParams,
|
|
3090
2928
|
useCursorPaginationState,
|
|
3091
2929
|
useNatsClient,
|
|
3092
|
-
useNearViewport,
|
|
3093
2930
|
validateAccessCode,
|
|
3094
2931
|
consumeAccessCode,
|
|
3095
2932
|
validateAndConsumeAccessCode,
|
|
3096
2933
|
useAccessCodeIntegration,
|
|
3097
|
-
useOgPlaceholder,
|
|
3098
2934
|
HONEYPOT_FIELD,
|
|
3099
2935
|
ELAPSED_MS_FIELD,
|
|
3100
2936
|
DEFAULT_MIN_FILL_MS,
|
|
@@ -3103,4 +2939,4 @@ export {
|
|
|
3103
2939
|
splitCsvEnv,
|
|
3104
2940
|
useHumanitySignals
|
|
3105
2941
|
};
|
|
3106
|
-
//# sourceMappingURL=chunk-
|
|
2942
|
+
//# sourceMappingURL=chunk-4RDJZIHW.js.map
|