@flamingo-stack/openframe-frontend-core 0.0.399 → 0.0.400
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-4K5XJ5EJ.js → chunk-463X3AW2.js} +3 -3
- package/dist/{chunk-XBCAY6NE.js → chunk-4HAVKWTJ.js} +3 -3
- package/dist/{chunk-G5NDKTX6.cjs → chunk-556BG7SX.cjs} +40 -40
- package/dist/{chunk-G5NDKTX6.cjs.map → chunk-556BG7SX.cjs.map} +1 -1
- package/dist/{chunk-2L6ALD2Q.js → chunk-56XCRZ7I.js} +2 -2
- package/dist/{chunk-BSJO5VFV.js → chunk-6VR7BJF6.js} +5 -5
- package/dist/{chunk-VOHOA3WV.cjs → chunk-6XQJSN7G.cjs} +15 -15
- package/dist/{chunk-VOHOA3WV.cjs.map → chunk-6XQJSN7G.cjs.map} +1 -1
- package/dist/{chunk-QNYNXSYQ.cjs → chunk-ABRDOCVN.cjs} +7 -7
- package/dist/{chunk-QNYNXSYQ.cjs.map → chunk-ABRDOCVN.cjs.map} +1 -1
- package/dist/{chunk-ZSZRJWY3.js → chunk-DH6HTYOV.js} +153 -134
- package/dist/chunk-DH6HTYOV.js.map +1 -0
- package/dist/{chunk-YWCCKB4J.cjs → chunk-EFTKJFEF.cjs} +5 -5
- package/dist/{chunk-YWCCKB4J.cjs.map → chunk-EFTKJFEF.cjs.map} +1 -1
- package/dist/{chunk-G3A7QHCX.js → chunk-FHEIG7QO.js} +2 -2
- package/dist/{chunk-Z5ERSGP2.js → chunk-I4XG5PJA.js} +2 -2
- package/dist/{chunk-D5IHYUBY.cjs → chunk-ILWSJCWD.cjs} +29 -29
- package/dist/{chunk-D5IHYUBY.cjs.map → chunk-ILWSJCWD.cjs.map} +1 -1
- package/dist/{chunk-JWBRDNYH.cjs → chunk-J4XR6YYZ.cjs} +23 -4
- package/dist/chunk-J4XR6YYZ.cjs.map +1 -0
- package/dist/{chunk-7OKNKZBW.cjs → chunk-J6IQQJJQ.cjs} +566 -531
- package/dist/chunk-J6IQQJJQ.cjs.map +1 -0
- package/dist/{chunk-O5NA3ULU.cjs → chunk-KIC4ZEZ7.cjs} +73 -73
- package/dist/{chunk-O5NA3ULU.cjs.map → chunk-KIC4ZEZ7.cjs.map} +1 -1
- package/dist/{chunk-VVKWNVKE.js → chunk-LAL63W5J.js} +6 -6
- package/dist/{chunk-JBLBFJ4N.cjs → chunk-MFRP2UDK.cjs} +32 -32
- package/dist/{chunk-JBLBFJ4N.cjs.map → chunk-MFRP2UDK.cjs.map} +1 -1
- package/dist/{chunk-A6KGHQRF.js → chunk-MQRTT3DO.js} +6 -6
- package/dist/{chunk-4KWIQEZT.js → chunk-MTBFE3JF.js} +2 -2
- package/dist/{chunk-RIC4TCPD.cjs → chunk-OPD5V57R.cjs} +19 -19
- package/dist/{chunk-RIC4TCPD.cjs.map → chunk-OPD5V57R.cjs.map} +1 -1
- package/dist/{chunk-CRRH7RJX.js → chunk-PD5MXNTJ.js} +5 -5
- package/dist/{chunk-WBLRUO3F.cjs → chunk-Q3AO2QWK.cjs} +3 -3
- package/dist/{chunk-WBLRUO3F.cjs.map → chunk-Q3AO2QWK.cjs.map} +1 -1
- package/dist/{chunk-4PEC5KU6.cjs → chunk-QGQ76SSR.cjs} +12 -12
- package/dist/{chunk-4PEC5KU6.cjs.map → chunk-QGQ76SSR.cjs.map} +1 -1
- package/dist/{chunk-ZDT2MBKE.cjs → chunk-RSFHAFZN.cjs} +40 -40
- package/dist/{chunk-ZDT2MBKE.cjs.map → chunk-RSFHAFZN.cjs.map} +1 -1
- package/dist/{chunk-4H2ICJYB.js → chunk-RYPCNUXA.js} +4 -4
- package/dist/{chunk-FXWURWDU.js → chunk-UFP45JLE.js} +3 -3
- package/dist/{chunk-2XVOYDRF.js → chunk-UYBNOHTC.js} +57 -22
- package/dist/{chunk-2XVOYDRF.js.map → chunk-UYBNOHTC.js.map} +1 -1
- package/dist/{chunk-NCW22SII.cjs → chunk-VTSEL7CJ.cjs} +73 -73
- package/dist/{chunk-NCW22SII.cjs.map → chunk-VTSEL7CJ.cjs.map} +1 -1
- package/dist/components/case-studies/index.cjs +9 -9
- package/dist/components/case-studies/index.js +3 -3
- package/dist/components/chat/index.cjs +3 -3
- package/dist/components/chat/index.js +2 -2
- package/dist/components/contact/index.cjs +4 -4
- package/dist/components/contact/index.js +3 -3
- package/dist/components/docs/index.cjs +6 -6
- package/dist/components/docs/index.js +5 -5
- package/dist/components/embeds/index.cjs +4 -4
- package/dist/components/embeds/index.js +3 -3
- package/dist/components/faq/index.cjs +5 -5
- package/dist/components/faq/index.js +4 -4
- package/dist/components/features/auth/auth-benefits-panel.d.ts.map +1 -1
- package/dist/components/features/auth/complete-account-form.d.ts.map +1 -1
- package/dist/components/features/auth/create-organization-form.d.ts.map +1 -1
- package/dist/components/features/auth/login-form.d.ts.map +1 -1
- package/dist/components/features/auth/openframe-sso-login-form.d.ts.map +1 -1
- package/dist/components/features/auth/openframe-sso-signup-form.d.ts.map +1 -1
- package/dist/components/features/auth/password-reset-form.d.ts.map +1 -1
- package/dist/components/features/index.cjs +3 -3
- package/dist/components/features/index.js +2 -2
- package/dist/components/help-center-pages/index.cjs +22 -22
- package/dist/components/help-center-pages/index.js +13 -13
- package/dist/components/index.cjs +125 -125
- package/dist/components/index.js +11 -11
- package/dist/components/navigation/index.cjs +3 -3
- package/dist/components/navigation/index.js +2 -2
- package/dist/components/onboarding-guides/index.cjs +7 -7
- package/dist/components/onboarding-guides/index.js +6 -6
- package/dist/components/related-content/index.cjs +5 -5
- package/dist/components/related-content/index.js +4 -4
- package/dist/components/tickets/index.cjs +6 -6
- package/dist/components/tickets/index.js +5 -5
- package/dist/components/ui/index.cjs +3 -3
- package/dist/components/ui/index.js +2 -2
- package/dist/hooks/index.cjs +4 -2
- package/dist/hooks/index.cjs.map +1 -1
- package/dist/hooks/index.js +3 -1
- package/dist/hooks/ui/index.d.ts +1 -0
- package/dist/hooks/ui/index.d.ts.map +1 -1
- package/dist/hooks/ui/use-deferred-error.d.ts +16 -0
- package/dist/hooks/ui/use-deferred-error.d.ts.map +1 -0
- package/dist/index.cjs +5 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +4 -2
- package/package.json +1 -1
- package/src/components/features/auth/auth-benefits-panel.tsx +1 -1
- package/src/components/features/auth/complete-account-form.tsx +15 -4
- package/src/components/features/auth/create-organization-form.tsx +14 -5
- package/src/components/features/auth/login-form.tsx +6 -1
- package/src/components/features/auth/openframe-sso-login-form.tsx +9 -2
- package/src/components/features/auth/openframe-sso-signup-form.tsx +18 -5
- package/src/components/features/auth/password-reset-form.tsx +9 -2
- package/src/hooks/ui/index.ts +1 -0
- package/src/hooks/ui/use-deferred-error.ts +38 -0
- package/src/stories/Input.stories.tsx +1 -1
- package/src/stories/auth/CreateOrganization.stories.tsx +2 -1
- package/dist/chunk-7OKNKZBW.cjs.map +0 -1
- package/dist/chunk-JWBRDNYH.cjs.map +0 -1
- package/dist/chunk-ZSZRJWY3.js.map +0 -1
- /package/dist/{chunk-4K5XJ5EJ.js.map → chunk-463X3AW2.js.map} +0 -0
- /package/dist/{chunk-XBCAY6NE.js.map → chunk-4HAVKWTJ.js.map} +0 -0
- /package/dist/{chunk-2L6ALD2Q.js.map → chunk-56XCRZ7I.js.map} +0 -0
- /package/dist/{chunk-BSJO5VFV.js.map → chunk-6VR7BJF6.js.map} +0 -0
- /package/dist/{chunk-G3A7QHCX.js.map → chunk-FHEIG7QO.js.map} +0 -0
- /package/dist/{chunk-Z5ERSGP2.js.map → chunk-I4XG5PJA.js.map} +0 -0
- /package/dist/{chunk-VVKWNVKE.js.map → chunk-LAL63W5J.js.map} +0 -0
- /package/dist/{chunk-A6KGHQRF.js.map → chunk-MQRTT3DO.js.map} +0 -0
- /package/dist/{chunk-4KWIQEZT.js.map → chunk-MTBFE3JF.js.map} +0 -0
- /package/dist/{chunk-CRRH7RJX.js.map → chunk-PD5MXNTJ.js.map} +0 -0
- /package/dist/{chunk-4H2ICJYB.js.map → chunk-RYPCNUXA.js.map} +0 -0
- /package/dist/{chunk-FXWURWDU.js.map → chunk-UFP45JLE.js.map} +0 -0
|
@@ -123,11 +123,29 @@ function useDebounce(value, delay = 500) {
|
|
|
123
123
|
return debouncedValue;
|
|
124
124
|
}
|
|
125
125
|
|
|
126
|
+
// src/hooks/ui/use-deferred-error.ts
|
|
127
|
+
import * as React from "react";
|
|
128
|
+
function useDeferredError(error, value, delay = 1500) {
|
|
129
|
+
const [touched, setTouched] = React.useState(false);
|
|
130
|
+
const [paused, setPaused] = React.useState(false);
|
|
131
|
+
React.useEffect(() => {
|
|
132
|
+
if (touched) return;
|
|
133
|
+
setPaused(false);
|
|
134
|
+
const timer = setTimeout(() => setPaused(true), delay);
|
|
135
|
+
return () => clearTimeout(timer);
|
|
136
|
+
}, [value, delay, touched]);
|
|
137
|
+
const onBlur = React.useCallback(() => setTouched(true), []);
|
|
138
|
+
return {
|
|
139
|
+
error: error && (touched || paused) ? error : void 0,
|
|
140
|
+
onBlur
|
|
141
|
+
};
|
|
142
|
+
}
|
|
143
|
+
|
|
126
144
|
// src/hooks/ui/use-header-height.ts
|
|
127
|
-
import { useEffect as
|
|
145
|
+
import { useEffect as useEffect4, useState as useState4 } from "react";
|
|
128
146
|
function useHeaderHeight(defaultHeight = 64) {
|
|
129
|
-
const [height, setHeight] =
|
|
130
|
-
|
|
147
|
+
const [height, setHeight] = useState4(defaultHeight);
|
|
148
|
+
useEffect4(() => {
|
|
131
149
|
const measure = () => {
|
|
132
150
|
let total = 0;
|
|
133
151
|
const header2 = document.querySelector("header");
|
|
@@ -166,22 +184,22 @@ function useHeaderHeight(defaultHeight = 64) {
|
|
|
166
184
|
}
|
|
167
185
|
|
|
168
186
|
// src/hooks/ui/use-horizontal-scrollbar.ts
|
|
169
|
-
import { useRef as useRef2, useState as
|
|
187
|
+
import { useRef as useRef2, useState as useState5, useCallback as useCallback3 } from "react";
|
|
170
188
|
function useHorizontalScrollbar() {
|
|
171
189
|
const scrollElRef = useRef2(null);
|
|
172
190
|
const trackRef = useRef2(null);
|
|
173
191
|
const thumbRef = useRef2(null);
|
|
174
192
|
const roRef = useRef2(null);
|
|
175
193
|
const moRef = useRef2(null);
|
|
176
|
-
const [thumbRatio, setThumbRatio] =
|
|
177
|
-
const [canScrollLeft, setCanScrollLeft] =
|
|
178
|
-
const [canScrollRight, setCanScrollRight] =
|
|
194
|
+
const [thumbRatio, setThumbRatio] = useState5(0);
|
|
195
|
+
const [canScrollLeft, setCanScrollLeft] = useState5(false);
|
|
196
|
+
const [canScrollRight, setCanScrollRight] = useState5(false);
|
|
179
197
|
const prevCanScrollLeftRef = useRef2(false);
|
|
180
198
|
const prevCanScrollRightRef = useRef2(false);
|
|
181
199
|
const isDraggingRef = useRef2(false);
|
|
182
200
|
const dragStartRef = useRef2({ mouseX: 0, scrollLeft: 0 });
|
|
183
201
|
const rafIdRef = useRef2(0);
|
|
184
|
-
const syncThumbToDOM =
|
|
202
|
+
const syncThumbToDOM = useCallback3(() => {
|
|
185
203
|
const el = scrollElRef.current;
|
|
186
204
|
const thumb = thumbRef.current;
|
|
187
205
|
if (!el || !thumb) return;
|
|
@@ -194,7 +212,7 @@ function useHorizontalScrollbar() {
|
|
|
194
212
|
const fraction = Math.min(Math.max(el.scrollLeft, 0), maxScroll) / maxScroll;
|
|
195
213
|
thumb.style.left = `${fraction * (1 - ratio) * 100}%`;
|
|
196
214
|
}, []);
|
|
197
|
-
const syncEdgeFades =
|
|
215
|
+
const syncEdgeFades = useCallback3(() => {
|
|
198
216
|
const el = scrollElRef.current;
|
|
199
217
|
if (!el) return;
|
|
200
218
|
const maxScroll = el.scrollWidth - el.clientWidth;
|
|
@@ -222,7 +240,7 @@ function useHorizontalScrollbar() {
|
|
|
222
240
|
setCanScrollRight(right);
|
|
223
241
|
}
|
|
224
242
|
}, []);
|
|
225
|
-
const measure =
|
|
243
|
+
const measure = useCallback3(() => {
|
|
226
244
|
const el = scrollElRef.current;
|
|
227
245
|
if (!el) return;
|
|
228
246
|
const ratio = el.clientWidth / el.scrollWidth;
|
|
@@ -230,7 +248,7 @@ function useHorizontalScrollbar() {
|
|
|
230
248
|
syncThumbToDOM();
|
|
231
249
|
syncEdgeFades();
|
|
232
250
|
}, [syncThumbToDOM, syncEdgeFades]);
|
|
233
|
-
const scrollRef =
|
|
251
|
+
const scrollRef = useCallback3((node) => {
|
|
234
252
|
if (roRef.current) {
|
|
235
253
|
roRef.current.disconnect();
|
|
236
254
|
roRef.current = null;
|
|
@@ -272,7 +290,7 @@ function useHorizontalScrollbar() {
|
|
|
272
290
|
setCanScrollRight(false);
|
|
273
291
|
}
|
|
274
292
|
}, [measure, syncThumbToDOM, syncEdgeFades]);
|
|
275
|
-
const onScroll =
|
|
293
|
+
const onScroll = useCallback3(() => {
|
|
276
294
|
if (isDraggingRef.current) return;
|
|
277
295
|
if (rafIdRef.current) cancelAnimationFrame(rafIdRef.current);
|
|
278
296
|
rafIdRef.current = requestAnimationFrame(() => {
|
|
@@ -280,7 +298,7 @@ function useHorizontalScrollbar() {
|
|
|
280
298
|
syncEdgeFades();
|
|
281
299
|
});
|
|
282
300
|
}, [syncThumbToDOM, syncEdgeFades]);
|
|
283
|
-
const onTrackClick =
|
|
301
|
+
const onTrackClick = useCallback3((e) => {
|
|
284
302
|
if (e.target.closest("[data-scrollbar-thumb]")) return;
|
|
285
303
|
const track = trackRef.current;
|
|
286
304
|
const el = scrollElRef.current;
|
|
@@ -298,13 +316,13 @@ function useHorizontalScrollbar() {
|
|
|
298
316
|
const targetScrollLeft = targetFraction * (el.scrollWidth - el.clientWidth);
|
|
299
317
|
el.scrollTo({ left: targetScrollLeft, behavior: "smooth" });
|
|
300
318
|
}, []);
|
|
301
|
-
const onTrackWheel =
|
|
319
|
+
const onTrackWheel = useCallback3((e) => {
|
|
302
320
|
const el = scrollElRef.current;
|
|
303
321
|
if (!el) return;
|
|
304
322
|
e.preventDefault();
|
|
305
323
|
el.scrollLeft += e.deltaX || e.deltaY;
|
|
306
324
|
}, []);
|
|
307
|
-
const onThumbPointerDown =
|
|
325
|
+
const onThumbPointerDown = useCallback3((e) => {
|
|
308
326
|
e.preventDefault();
|
|
309
327
|
e.stopPropagation();
|
|
310
328
|
const el = scrollElRef.current;
|
|
@@ -315,7 +333,7 @@ function useHorizontalScrollbar() {
|
|
|
315
333
|
target.setPointerCapture(e.pointerId);
|
|
316
334
|
target.style.cursor = "grabbing";
|
|
317
335
|
}, []);
|
|
318
|
-
const onThumbPointerMove =
|
|
336
|
+
const onThumbPointerMove = useCallback3((e) => {
|
|
319
337
|
if (!isDraggingRef.current) return;
|
|
320
338
|
const el = scrollElRef.current;
|
|
321
339
|
const track = trackRef.current;
|
|
@@ -335,7 +353,7 @@ function useHorizontalScrollbar() {
|
|
|
335
353
|
syncThumbToDOM();
|
|
336
354
|
syncEdgeFades();
|
|
337
355
|
}, [syncThumbToDOM, syncEdgeFades]);
|
|
338
|
-
const onThumbPointerUp =
|
|
356
|
+
const onThumbPointerUp = useCallback3((e) => {
|
|
339
357
|
isDraggingRef.current = false;
|
|
340
358
|
const target = e.currentTarget;
|
|
341
359
|
target.releasePointerCapture(e.pointerId);
|
|
@@ -358,7 +376,7 @@ function useHorizontalScrollbar() {
|
|
|
358
376
|
}
|
|
359
377
|
|
|
360
378
|
// src/hooks/ui/use-image-edge-color.ts
|
|
361
|
-
import { useState as
|
|
379
|
+
import { useState as useState6, useEffect as useEffect5 } from "react";
|
|
362
380
|
function extractEdgeColor(img) {
|
|
363
381
|
const canvas = document.createElement("canvas");
|
|
364
382
|
const ctx = canvas.getContext("2d");
|
|
@@ -414,8 +432,8 @@ function extractEdgeColor(img) {
|
|
|
414
432
|
return `rgb(${r}, ${g}, ${b})`;
|
|
415
433
|
}
|
|
416
434
|
function useImageEdgeColor(imageUrl, fallback = "#000000") {
|
|
417
|
-
const [color, setColor] =
|
|
418
|
-
|
|
435
|
+
const [color, setColor] = useState6(fallback);
|
|
436
|
+
useEffect5(() => {
|
|
419
437
|
if (!imageUrl) {
|
|
420
438
|
setColor(fallback);
|
|
421
439
|
return;
|
|
@@ -444,9 +462,9 @@ function useImageEdgeColor(imageUrl, fallback = "#000000") {
|
|
|
444
462
|
}
|
|
445
463
|
|
|
446
464
|
// src/hooks/ui/use-local-storage.ts
|
|
447
|
-
import { useEffect as
|
|
465
|
+
import { useEffect as useEffect6, useRef as useRef3, useState as useState7 } from "react";
|
|
448
466
|
function useLocalStorage(key, initialValue) {
|
|
449
|
-
const [storedValue, setStoredValue] =
|
|
467
|
+
const [storedValue, setStoredValue] = useState7(() => {
|
|
450
468
|
try {
|
|
451
469
|
if (typeof window !== "undefined") {
|
|
452
470
|
const item = window.localStorage.getItem(key);
|
|
@@ -459,7 +477,7 @@ function useLocalStorage(key, initialValue) {
|
|
|
459
477
|
});
|
|
460
478
|
const isInitialized = useRef3(true);
|
|
461
479
|
const isFromStorageEvent = useRef3(false);
|
|
462
|
-
|
|
480
|
+
useEffect6(() => {
|
|
463
481
|
if (!isInitialized.current) return;
|
|
464
482
|
const handleStorageChange = (e) => {
|
|
465
483
|
if (e.key === key && e.newValue !== null) {
|
|
@@ -498,7 +516,7 @@ function useLocalStorage(key, initialValue) {
|
|
|
498
516
|
window.removeEventListener("localStorageUpdate", handleCustomStorageUpdate);
|
|
499
517
|
};
|
|
500
518
|
}, [key]);
|
|
501
|
-
|
|
519
|
+
useEffect6(() => {
|
|
502
520
|
if (!isInitialized.current) return;
|
|
503
521
|
if (isFromStorageEvent.current) {
|
|
504
522
|
isFromStorageEvent.current = false;
|
|
@@ -524,9 +542,9 @@ function useLocalStorage(key, initialValue) {
|
|
|
524
542
|
}
|
|
525
543
|
|
|
526
544
|
// src/hooks/ui/use-media-query.ts
|
|
527
|
-
import { useLayoutEffect, useState as
|
|
545
|
+
import { useLayoutEffect, useState as useState8 } from "react";
|
|
528
546
|
function useMediaQuery(query) {
|
|
529
|
-
const [matches, setMatches] =
|
|
547
|
+
const [matches, setMatches] = useState8(void 0);
|
|
530
548
|
useLayoutEffect(() => {
|
|
531
549
|
const matchMedia = window.matchMedia(query);
|
|
532
550
|
const handleChange = () => {
|
|
@@ -559,7 +577,7 @@ function useLgUp() {
|
|
|
559
577
|
}
|
|
560
578
|
|
|
561
579
|
// src/hooks/ui/use-memoized-callback.ts
|
|
562
|
-
import { useCallback as
|
|
580
|
+
import { useCallback as useCallback4, useRef as useRef4 } from "react";
|
|
563
581
|
function useMemoizedCallback(callback, dependencies) {
|
|
564
582
|
const callbackRef = useRef4(callback);
|
|
565
583
|
const dependenciesRef = useRef4(dependencies);
|
|
@@ -568,15 +586,15 @@ function useMemoizedCallback(callback, dependencies) {
|
|
|
568
586
|
if (depsChanged) {
|
|
569
587
|
dependenciesRef.current = dependencies;
|
|
570
588
|
}
|
|
571
|
-
return
|
|
589
|
+
return useCallback4(((...args) => callbackRef.current(...args)), [depsChanged]);
|
|
572
590
|
}
|
|
573
591
|
|
|
574
592
|
// src/hooks/ui/use-notification-permission.ts
|
|
575
|
-
import { useCallback as
|
|
593
|
+
import { useCallback as useCallback5, useEffect as useEffect7, useState as useState9 } from "react";
|
|
576
594
|
function useNotificationPermission() {
|
|
577
|
-
const [supported, setSupported] =
|
|
578
|
-
const [permission, setPermission] =
|
|
579
|
-
|
|
595
|
+
const [supported, setSupported] = useState9(false);
|
|
596
|
+
const [permission, setPermission] = useState9("default");
|
|
597
|
+
useEffect7(() => {
|
|
580
598
|
if (typeof window === "undefined" || !("Notification" in window)) return;
|
|
581
599
|
setSupported(true);
|
|
582
600
|
const sync = () => setPermission(Notification.permission);
|
|
@@ -597,7 +615,7 @@ function useNotificationPermission() {
|
|
|
597
615
|
window.removeEventListener("focus", sync);
|
|
598
616
|
};
|
|
599
617
|
}, []);
|
|
600
|
-
const request =
|
|
618
|
+
const request = useCallback5(async () => {
|
|
601
619
|
if (typeof window === "undefined" || !("Notification" in window)) {
|
|
602
620
|
return "denied";
|
|
603
621
|
}
|
|
@@ -612,7 +630,7 @@ function useNotificationPermission() {
|
|
|
612
630
|
}
|
|
613
631
|
|
|
614
632
|
// src/hooks/ui/use-onboarding-state.ts
|
|
615
|
-
import { useState as
|
|
633
|
+
import { useState as useState10, useEffect as useEffect8, useCallback as useCallback6 } from "react";
|
|
616
634
|
|
|
617
635
|
// src/utils/onboarding-storage.ts
|
|
618
636
|
var DEFAULT_STATE = {
|
|
@@ -687,9 +705,9 @@ function dismissOnboarding(key) {
|
|
|
687
705
|
|
|
688
706
|
// src/hooks/ui/use-onboarding-state.ts
|
|
689
707
|
function useOnboardingState(storageKey = "openframe-onboarding-state") {
|
|
690
|
-
const [state, setState] =
|
|
691
|
-
const [, forceUpdate] =
|
|
692
|
-
|
|
708
|
+
const [state, setState] = useState10(() => loadOnboardingState(storageKey));
|
|
709
|
+
const [, forceUpdate] = useState10(0);
|
|
710
|
+
useEffect8(() => {
|
|
693
711
|
const handleStorageUpdate = (e) => {
|
|
694
712
|
if (e.detail.key === storageKey) {
|
|
695
713
|
const newState = loadOnboardingState(storageKey);
|
|
@@ -703,38 +721,38 @@ function useOnboardingState(storageKey = "openframe-onboarding-state") {
|
|
|
703
721
|
window.removeEventListener("localStorageUpdate", handleStorageUpdate);
|
|
704
722
|
};
|
|
705
723
|
}, [storageKey]);
|
|
706
|
-
const markComplete =
|
|
724
|
+
const markComplete = useCallback6((stepId) => {
|
|
707
725
|
console.log(`\u{1F3AF} markComplete called for: "${stepId}"`);
|
|
708
726
|
const newState = markStepComplete(storageKey, stepId);
|
|
709
727
|
setState(newState);
|
|
710
728
|
forceUpdate((prev) => prev + 1);
|
|
711
729
|
}, [storageKey]);
|
|
712
|
-
const markSkipped =
|
|
730
|
+
const markSkipped = useCallback6((stepId) => {
|
|
713
731
|
console.log(`\u23ED\uFE0F markSkipped called for: "${stepId}"`);
|
|
714
732
|
const newState = markStepSkipped(storageKey, stepId);
|
|
715
733
|
setState(newState);
|
|
716
734
|
forceUpdate((prev) => prev + 1);
|
|
717
735
|
}, [storageKey]);
|
|
718
|
-
const dismissOnboarding2 =
|
|
736
|
+
const dismissOnboarding2 = useCallback6(() => {
|
|
719
737
|
console.log(`\u{1F6AB} dismissOnboarding called`);
|
|
720
738
|
const newState = dismissOnboarding(storageKey);
|
|
721
739
|
setState(newState);
|
|
722
740
|
forceUpdate((prev) => prev + 1);
|
|
723
741
|
}, [storageKey]);
|
|
724
|
-
const markMultipleComplete2 =
|
|
742
|
+
const markMultipleComplete2 = useCallback6((stepIds) => {
|
|
725
743
|
console.log(`\u{1F3AF} markMultipleComplete called for:`, stepIds);
|
|
726
744
|
const newState = markMultipleComplete(storageKey, stepIds);
|
|
727
745
|
setState(newState);
|
|
728
746
|
forceUpdate((prev) => prev + 1);
|
|
729
747
|
console.log(`\u{1F4DD} State after batch:`, newState);
|
|
730
748
|
}, [storageKey]);
|
|
731
|
-
const isStepComplete =
|
|
749
|
+
const isStepComplete = useCallback6((stepId) => {
|
|
732
750
|
return state.completedSteps.includes(stepId);
|
|
733
751
|
}, [state.completedSteps]);
|
|
734
|
-
const isStepSkipped =
|
|
752
|
+
const isStepSkipped = useCallback6((stepId) => {
|
|
735
753
|
return state.skippedSteps.includes(stepId);
|
|
736
754
|
}, [state.skippedSteps]);
|
|
737
|
-
const allStepsComplete =
|
|
755
|
+
const allStepsComplete = useCallback6((steps) => {
|
|
738
756
|
return steps.every((step) => isStepComplete(step.id) || isStepSkipped(step.id));
|
|
739
757
|
}, [isStepComplete, isStepSkipped]);
|
|
740
758
|
return {
|
|
@@ -750,19 +768,19 @@ function useOnboardingState(storageKey = "openframe-onboarding-state") {
|
|
|
750
768
|
}
|
|
751
769
|
|
|
752
770
|
// src/hooks/ui/use-search.ts
|
|
753
|
-
import { useState as
|
|
771
|
+
import { useState as useState11, useEffect as useEffect9, useCallback as useCallback7 } from "react";
|
|
754
772
|
function useSearch(config) {
|
|
755
773
|
const { searchFn, mapResult, debounceMs = 300, minQueryLength = 2 } = config;
|
|
756
|
-
const [query, setQuery] =
|
|
757
|
-
const [results, setResults] =
|
|
758
|
-
const [isLoading, setIsLoading] =
|
|
759
|
-
const [error, setError] =
|
|
774
|
+
const [query, setQuery] = useState11("");
|
|
775
|
+
const [results, setResults] = useState11([]);
|
|
776
|
+
const [isLoading, setIsLoading] = useState11(false);
|
|
777
|
+
const [error, setError] = useState11(null);
|
|
760
778
|
const debouncedQuery = useDebounce(query, debounceMs);
|
|
761
|
-
const clearResults =
|
|
779
|
+
const clearResults = useCallback7(() => {
|
|
762
780
|
setResults([]);
|
|
763
781
|
setError(null);
|
|
764
782
|
}, []);
|
|
765
|
-
|
|
783
|
+
useEffect9(() => {
|
|
766
784
|
if (!debouncedQuery || debouncedQuery.length < minQueryLength) {
|
|
767
785
|
setResults([]);
|
|
768
786
|
setIsLoading(false);
|
|
@@ -835,11 +853,11 @@ function useTablePagination(config) {
|
|
|
835
853
|
}
|
|
836
854
|
|
|
837
855
|
// src/hooks/ui/use-throttle.ts
|
|
838
|
-
import { useState as
|
|
856
|
+
import { useState as useState12, useEffect as useEffect10, useRef as useRef5 } from "react";
|
|
839
857
|
function useThrottle(value, limit = 200) {
|
|
840
|
-
const [throttledValue, setThrottledValue] =
|
|
858
|
+
const [throttledValue, setThrottledValue] = useState12(value);
|
|
841
859
|
const lastUpdated = useRef5(Date.now());
|
|
842
|
-
|
|
860
|
+
useEffect10(() => {
|
|
843
861
|
const now = Date.now();
|
|
844
862
|
const elapsed = now - lastUpdated.current;
|
|
845
863
|
if (elapsed >= limit) {
|
|
@@ -859,13 +877,13 @@ function useThrottle(value, limit = 200) {
|
|
|
859
877
|
}
|
|
860
878
|
|
|
861
879
|
// src/hooks/ui/use-window-size.ts
|
|
862
|
-
import { useLayoutEffect as useLayoutEffect2, useState as
|
|
880
|
+
import { useLayoutEffect as useLayoutEffect2, useState as useState13 } from "react";
|
|
863
881
|
function useWindowSize() {
|
|
864
|
-
const [windowSize, setWindowSize] =
|
|
882
|
+
const [windowSize, setWindowSize] = useState13({
|
|
865
883
|
width: 0,
|
|
866
884
|
height: 0
|
|
867
885
|
});
|
|
868
|
-
const [isClient, setIsClient] =
|
|
886
|
+
const [isClient, setIsClient] = useState13(false);
|
|
869
887
|
useLayoutEffect2(() => {
|
|
870
888
|
setIsClient(true);
|
|
871
889
|
if (!isClient) return;
|
|
@@ -883,7 +901,7 @@ function useWindowSize() {
|
|
|
883
901
|
}
|
|
884
902
|
|
|
885
903
|
// src/hooks/platform/use-platform-config.ts
|
|
886
|
-
import { useState as
|
|
904
|
+
import { useState as useState14, useEffect as useEffect11 } from "react";
|
|
887
905
|
|
|
888
906
|
// src/utils/platform-config.tsx
|
|
889
907
|
import { Globe } from "lucide-react";
|
|
@@ -1061,10 +1079,10 @@ function getPlatformIconComponent(platformName, className = "h-6 w-6") {
|
|
|
1061
1079
|
var platformCache = null;
|
|
1062
1080
|
var fetchPromise = null;
|
|
1063
1081
|
function usePlatformConfig() {
|
|
1064
|
-
const [platforms, setPlatforms] =
|
|
1065
|
-
const [isLoading, setIsLoading] =
|
|
1066
|
-
const [error, setError] =
|
|
1067
|
-
|
|
1082
|
+
const [platforms, setPlatforms] = useState14(platformCache || []);
|
|
1083
|
+
const [isLoading, setIsLoading] = useState14(!platformCache);
|
|
1084
|
+
const [error, setError] = useState14(null);
|
|
1085
|
+
useEffect11(() => {
|
|
1068
1086
|
if (platformCache) {
|
|
1069
1087
|
setPlatforms(platformCache);
|
|
1070
1088
|
setIsLoading(false);
|
|
@@ -1132,7 +1150,7 @@ function useValidatePlatform(value) {
|
|
|
1132
1150
|
import { toast as sonnerToast2 } from "sonner";
|
|
1133
1151
|
|
|
1134
1152
|
// src/components/ui/toaster.tsx
|
|
1135
|
-
import * as
|
|
1153
|
+
import * as React2 from "react";
|
|
1136
1154
|
import { Toaster as SonnerToaster, toast as sonnerToast } from "sonner";
|
|
1137
1155
|
|
|
1138
1156
|
// src/types/tool.types.ts
|
|
@@ -1300,7 +1318,7 @@ function CommandApprovalToast({
|
|
|
1300
1318
|
defaultExpanded = false,
|
|
1301
1319
|
className
|
|
1302
1320
|
}) {
|
|
1303
|
-
const [expanded, setExpanded] =
|
|
1321
|
+
const [expanded, setExpanded] = React2.useState(defaultExpanded);
|
|
1304
1322
|
const handleApprove = () => {
|
|
1305
1323
|
onApprove?.();
|
|
1306
1324
|
sonnerToast.dismiss(id);
|
|
@@ -1513,7 +1531,7 @@ var useToast = () => ({
|
|
|
1513
1531
|
});
|
|
1514
1532
|
|
|
1515
1533
|
// src/hooks/use-contact-submission.ts
|
|
1516
|
-
import { useState as
|
|
1534
|
+
import { useState as useState16, useCallback as useCallback8, useEffect as useEffect12 } from "react";
|
|
1517
1535
|
init_next_navigation();
|
|
1518
1536
|
|
|
1519
1537
|
// src/utils/local-storage-adapter.ts
|
|
@@ -1774,9 +1792,9 @@ function useContactSubmission(options = {}) {
|
|
|
1774
1792
|
const { toast: toast2 } = useToast();
|
|
1775
1793
|
const router = useRouter();
|
|
1776
1794
|
const { contactUrl } = useRequiredEndpointsRuntime();
|
|
1777
|
-
const [isSubmitting, setIsSubmitting] =
|
|
1778
|
-
const [isSuccess, setIsSuccess] =
|
|
1779
|
-
const submit =
|
|
1795
|
+
const [isSubmitting, setIsSubmitting] = useState16(false);
|
|
1796
|
+
const [isSuccess, setIsSuccess] = useState16(false);
|
|
1797
|
+
const submit = useCallback8(async (formData) => {
|
|
1780
1798
|
if (isSubmitting) return;
|
|
1781
1799
|
setIsSubmitting(true);
|
|
1782
1800
|
try {
|
|
@@ -1811,7 +1829,7 @@ function useContactSubmission(options = {}) {
|
|
|
1811
1829
|
setIsSubmitting(false);
|
|
1812
1830
|
}
|
|
1813
1831
|
}, [isSubmitting, toast2, userId, successToastMessage, contactUrl]);
|
|
1814
|
-
|
|
1832
|
+
useEffect12(() => {
|
|
1815
1833
|
if (isSuccess && successRedirectUrl) {
|
|
1816
1834
|
console.log("\u{1F680} Contact submission successful, redirecting to:", successRedirectUrl);
|
|
1817
1835
|
const timer = setTimeout(() => {
|
|
@@ -1825,7 +1843,7 @@ function useContactSubmission(options = {}) {
|
|
|
1825
1843
|
return () => clearTimeout(timer);
|
|
1826
1844
|
}
|
|
1827
1845
|
}, [isSuccess, successRedirectUrl, router]);
|
|
1828
|
-
|
|
1846
|
+
useEffect12(() => {
|
|
1829
1847
|
if (isSuccess && onSuccess) {
|
|
1830
1848
|
onSuccess();
|
|
1831
1849
|
}
|
|
@@ -1834,19 +1852,19 @@ function useContactSubmission(options = {}) {
|
|
|
1834
1852
|
}
|
|
1835
1853
|
|
|
1836
1854
|
// src/hooks/use-quick-action-hint.ts
|
|
1837
|
-
import { useEffect as
|
|
1855
|
+
import { useEffect as useEffect13, useState as useState17, useRef as useRef6, useCallback as useCallback9 } from "react";
|
|
1838
1856
|
function useQuickActionHint({
|
|
1839
1857
|
actionCount,
|
|
1840
1858
|
cycleDuration = 5e3,
|
|
1841
1859
|
enabled = true
|
|
1842
1860
|
}) {
|
|
1843
|
-
const [activeHintIndex, setActiveHintIndex] =
|
|
1861
|
+
const [activeHintIndex, setActiveHintIndex] = useState17(-1);
|
|
1844
1862
|
const containerRef = useRef6(null);
|
|
1845
1863
|
const timeoutRef = useRef6(null);
|
|
1846
1864
|
const cycleCountRef = useRef6(0);
|
|
1847
1865
|
const currentIndexRef = useRef6(0);
|
|
1848
1866
|
const sequenceRef = useRef6([]);
|
|
1849
|
-
const shuffleIndices =
|
|
1867
|
+
const shuffleIndices = useCallback9((length) => {
|
|
1850
1868
|
const indices = Array.from({ length }, (_, i) => i);
|
|
1851
1869
|
for (let i = indices.length - 1; i > 0; i--) {
|
|
1852
1870
|
const j = Math.floor(Math.random() * (i + 1));
|
|
@@ -1854,7 +1872,7 @@ function useQuickActionHint({
|
|
|
1854
1872
|
}
|
|
1855
1873
|
return indices;
|
|
1856
1874
|
}, []);
|
|
1857
|
-
const stopHint =
|
|
1875
|
+
const stopHint = useCallback9(() => {
|
|
1858
1876
|
if (timeoutRef.current) {
|
|
1859
1877
|
clearTimeout(timeoutRef.current);
|
|
1860
1878
|
timeoutRef.current = null;
|
|
@@ -1864,7 +1882,7 @@ function useQuickActionHint({
|
|
|
1864
1882
|
currentIndexRef.current = 0;
|
|
1865
1883
|
sequenceRef.current = [];
|
|
1866
1884
|
}, []);
|
|
1867
|
-
const advanceHint =
|
|
1885
|
+
const advanceHint = useCallback9(() => {
|
|
1868
1886
|
if (currentIndexRef.current === 0) {
|
|
1869
1887
|
sequenceRef.current = shuffleIndices(actionCount);
|
|
1870
1888
|
}
|
|
@@ -1877,7 +1895,7 @@ function useQuickActionHint({
|
|
|
1877
1895
|
}
|
|
1878
1896
|
timeoutRef.current = setTimeout(advanceHint, cycleDuration);
|
|
1879
1897
|
}, [actionCount, cycleDuration, shuffleIndices]);
|
|
1880
|
-
|
|
1898
|
+
useEffect13(() => {
|
|
1881
1899
|
if (!enabled || actionCount === 0) {
|
|
1882
1900
|
return;
|
|
1883
1901
|
}
|
|
@@ -1903,7 +1921,7 @@ function useQuickActionHint({
|
|
|
1903
1921
|
}
|
|
1904
1922
|
|
|
1905
1923
|
// src/hooks/use-copy-to-clipboard.ts
|
|
1906
|
-
import { useCallback as
|
|
1924
|
+
import { useCallback as useCallback10, useState as useState18 } from "react";
|
|
1907
1925
|
function useCopyToClipboard({
|
|
1908
1926
|
successTitle = "Copied",
|
|
1909
1927
|
successDescription = "Copied to clipboard",
|
|
@@ -1912,8 +1930,8 @@ function useCopyToClipboard({
|
|
|
1912
1930
|
resetDelay = 2e3
|
|
1913
1931
|
} = {}) {
|
|
1914
1932
|
const { toast: toast2 } = useToast();
|
|
1915
|
-
const [copied, setCopied] =
|
|
1916
|
-
const copy =
|
|
1933
|
+
const [copied, setCopied] = useState18(false);
|
|
1934
|
+
const copy = useCallback10(
|
|
1917
1935
|
async (text) => {
|
|
1918
1936
|
try {
|
|
1919
1937
|
await navigator.clipboard.writeText(text);
|
|
@@ -1930,7 +1948,7 @@ function useCopyToClipboard({
|
|
|
1930
1948
|
}
|
|
1931
1949
|
|
|
1932
1950
|
// src/hooks/use-batch-images.ts
|
|
1933
|
-
import { useEffect as
|
|
1951
|
+
import { useEffect as useEffect14, useMemo as useMemo2, useState as useState19, useRef as useRef7 } from "react";
|
|
1934
1952
|
var globalBatchImageConfig = {};
|
|
1935
1953
|
function configureBatchImageFetch(config) {
|
|
1936
1954
|
globalBatchImageConfig = { ...globalBatchImageConfig, ...config };
|
|
@@ -2003,14 +2021,14 @@ async function batchFetchAuthenticatedImages(imageUrls, config) {
|
|
|
2003
2021
|
return results;
|
|
2004
2022
|
}
|
|
2005
2023
|
function useBatchImages(imageUrls, config) {
|
|
2006
|
-
const [fetchedImages, setFetchedImages] =
|
|
2007
|
-
const [loading, setLoading] =
|
|
2024
|
+
const [fetchedImages, setFetchedImages] = useState19({});
|
|
2025
|
+
const [loading, setLoading] = useState19(false);
|
|
2008
2026
|
const uniqueUrls = useMemo2(
|
|
2009
2027
|
() => Array.from(new Set(imageUrls.filter((url) => Boolean(url)))),
|
|
2010
2028
|
[imageUrls]
|
|
2011
2029
|
);
|
|
2012
2030
|
const requestedUrls = useRef7(/* @__PURE__ */ new Set());
|
|
2013
|
-
|
|
2031
|
+
useEffect14(() => {
|
|
2014
2032
|
if (uniqueUrls.length === 0) {
|
|
2015
2033
|
setFetchedImages({});
|
|
2016
2034
|
return;
|
|
@@ -2040,7 +2058,7 @@ function useBatchImages(imageUrls, config) {
|
|
|
2040
2058
|
}
|
|
2041
2059
|
|
|
2042
2060
|
// src/hooks/use-authenticated-image.ts
|
|
2043
|
-
import { useEffect as
|
|
2061
|
+
import { useEffect as useEffect15, useState as useState20, useRef as useRef8 } from "react";
|
|
2044
2062
|
var globalImageConfig = {};
|
|
2045
2063
|
var imageCache = /* @__PURE__ */ new Map();
|
|
2046
2064
|
var pendingRequests = /* @__PURE__ */ new Map();
|
|
@@ -2069,11 +2087,11 @@ function getImageConfig() {
|
|
|
2069
2087
|
};
|
|
2070
2088
|
}
|
|
2071
2089
|
function useAuthenticatedImage(imageUrl, refreshKey, config) {
|
|
2072
|
-
const [fetchedImageUrl, setFetchedImageUrl] =
|
|
2073
|
-
const [isLoading, setIsLoading] =
|
|
2074
|
-
const [error, setError] =
|
|
2090
|
+
const [fetchedImageUrl, setFetchedImageUrl] = useState20();
|
|
2091
|
+
const [isLoading, setIsLoading] = useState20(false);
|
|
2092
|
+
const [error, setError] = useState20(null);
|
|
2075
2093
|
const currentCacheKeyRef = useRef8(null);
|
|
2076
|
-
|
|
2094
|
+
useEffect15(() => {
|
|
2077
2095
|
if (!imageUrl) {
|
|
2078
2096
|
setFetchedImageUrl(void 0);
|
|
2079
2097
|
setIsLoading(false);
|
|
@@ -2184,7 +2202,7 @@ function useAuthenticatedImage(imageUrl, refreshKey, config) {
|
|
|
2184
2202
|
});
|
|
2185
2203
|
pendingRequests.set(cacheKey, fetchPromise2);
|
|
2186
2204
|
}, [imageUrl, refreshKey, config]);
|
|
2187
|
-
|
|
2205
|
+
useEffect15(() => {
|
|
2188
2206
|
return () => {
|
|
2189
2207
|
if (currentCacheKeyRef.current) {
|
|
2190
2208
|
const entry = imageCache.get(currentCacheKeyRef.current);
|
|
@@ -2199,7 +2217,7 @@ function useAuthenticatedImage(imageUrl, refreshKey, config) {
|
|
|
2199
2217
|
|
|
2200
2218
|
// src/hooks/state/use-query-params.ts
|
|
2201
2219
|
init_next_navigation();
|
|
2202
|
-
import { useEffect as
|
|
2220
|
+
import { useEffect as useEffect16, useState as useState21, useMemo as useMemo3, useCallback as useCallback11 } from "react";
|
|
2203
2221
|
|
|
2204
2222
|
// src/hooks/state/graphql-parser.ts
|
|
2205
2223
|
import {
|
|
@@ -2661,14 +2679,14 @@ var introspector = new GraphQLIntrospector();
|
|
|
2661
2679
|
function useQueryParams(query, options = {}) {
|
|
2662
2680
|
const router = useRouter();
|
|
2663
2681
|
const searchParams = useSearchParams();
|
|
2664
|
-
const [isLoading, setIsLoading] =
|
|
2665
|
-
const [isReady, setIsReady] =
|
|
2666
|
-
const [error, setError] =
|
|
2667
|
-
const [schema, setSchema] =
|
|
2682
|
+
const [isLoading, setIsLoading] = useState21(true);
|
|
2683
|
+
const [isReady, setIsReady] = useState21(false);
|
|
2684
|
+
const [error, setError] = useState21(null);
|
|
2685
|
+
const [schema, setSchema] = useState21({});
|
|
2668
2686
|
const defaultValues = options.defaultValues || {};
|
|
2669
2687
|
const skipIntrospection = options.skipIntrospection || false;
|
|
2670
2688
|
const debug = options.debug || false;
|
|
2671
|
-
|
|
2689
|
+
useEffect16(() => {
|
|
2672
2690
|
async function initialize() {
|
|
2673
2691
|
try {
|
|
2674
2692
|
if (debug) console.log("[useQueryParams] Initializing...");
|
|
@@ -2738,14 +2756,14 @@ function useQueryParams(query, options = {}) {
|
|
|
2738
2756
|
});
|
|
2739
2757
|
return result;
|
|
2740
2758
|
}, [searchParams]);
|
|
2741
|
-
const updateUrl =
|
|
2759
|
+
const updateUrl = useCallback11((newParams) => {
|
|
2742
2760
|
const url = newParams.toString() ? `?${newParams.toString()}` : window.location.pathname;
|
|
2743
2761
|
if (debug) {
|
|
2744
2762
|
console.log("[useQueryParams] Updating URL:", url);
|
|
2745
2763
|
}
|
|
2746
2764
|
router.replace(url, { scroll: false });
|
|
2747
2765
|
}, [router, debug]);
|
|
2748
|
-
const setParam =
|
|
2766
|
+
const setParam = useCallback11((key, value) => {
|
|
2749
2767
|
if (!isReady) {
|
|
2750
2768
|
console.warn("[useQueryParams] Schema not ready, cannot set param");
|
|
2751
2769
|
return;
|
|
@@ -2759,7 +2777,7 @@ function useQueryParams(query, options = {}) {
|
|
|
2759
2777
|
console.error("[useQueryParams] Failed to set param:", err);
|
|
2760
2778
|
}
|
|
2761
2779
|
}, [variables, schema, isReady, updateUrl]);
|
|
2762
|
-
const setParams =
|
|
2780
|
+
const setParams = useCallback11((updates) => {
|
|
2763
2781
|
if (!isReady) {
|
|
2764
2782
|
console.warn("[useQueryParams] Schema not ready, cannot set params");
|
|
2765
2783
|
return;
|
|
@@ -2773,7 +2791,7 @@ function useQueryParams(query, options = {}) {
|
|
|
2773
2791
|
console.error("[useQueryParams] Failed to set params:", err);
|
|
2774
2792
|
}
|
|
2775
2793
|
}, [variables, schema, isReady, updateUrl]);
|
|
2776
|
-
const clearParamsHandler =
|
|
2794
|
+
const clearParamsHandler = useCallback11((keys) => {
|
|
2777
2795
|
if (!isReady) {
|
|
2778
2796
|
console.warn("[useQueryParams] Schema not ready, cannot clear params");
|
|
2779
2797
|
return;
|
|
@@ -2787,7 +2805,7 @@ function useQueryParams(query, options = {}) {
|
|
|
2787
2805
|
console.error("[useQueryParams] Failed to clear params:", err);
|
|
2788
2806
|
}
|
|
2789
2807
|
}, [variables, schema, isReady, updateUrl]);
|
|
2790
|
-
const resetParams =
|
|
2808
|
+
const resetParams = useCallback11(() => {
|
|
2791
2809
|
if (debug) {
|
|
2792
2810
|
console.log("[useQueryParams] Resetting params");
|
|
2793
2811
|
}
|
|
@@ -2820,7 +2838,7 @@ function applyParamMapping(schema, mapping) {
|
|
|
2820
2838
|
|
|
2821
2839
|
// src/hooks/state/use-api-params.ts
|
|
2822
2840
|
init_next_navigation();
|
|
2823
|
-
import { useCallback as
|
|
2841
|
+
import { useCallback as useCallback12, useMemo as useMemo4, useRef as useRef9 } from "react";
|
|
2824
2842
|
function useContentStable(value, key) {
|
|
2825
2843
|
const ref = useRef9(void 0);
|
|
2826
2844
|
if (ref.current && ref.current.key === key) return ref.current.value;
|
|
@@ -2879,7 +2897,7 @@ function useApiParams(schema, options = {}) {
|
|
|
2879
2897
|
prevParamsRef.current = result;
|
|
2880
2898
|
return result;
|
|
2881
2899
|
}, [searchString, schemaKey, debug]);
|
|
2882
|
-
const addParamToSearchParams =
|
|
2900
|
+
const addParamToSearchParams = useCallback12((searchParams, key, value) => {
|
|
2883
2901
|
if (value === void 0 || value === "" || value === null) {
|
|
2884
2902
|
return;
|
|
2885
2903
|
}
|
|
@@ -2907,7 +2925,7 @@ function useApiParams(schema, options = {}) {
|
|
|
2907
2925
|
}
|
|
2908
2926
|
return newParams;
|
|
2909
2927
|
}, [params, schemaKey, flattenedSchema, addParamToSearchParams]);
|
|
2910
|
-
const updateUrl =
|
|
2928
|
+
const updateUrl = useCallback12((newParams, keysToRemove = []) => {
|
|
2911
2929
|
const finalParams = new URLSearchParams(searchString);
|
|
2912
2930
|
keysToRemove.forEach((key) => {
|
|
2913
2931
|
if (key in stableSchema) {
|
|
@@ -2943,7 +2961,7 @@ function useApiParams(schema, options = {}) {
|
|
|
2943
2961
|
}
|
|
2944
2962
|
return false;
|
|
2945
2963
|
};
|
|
2946
|
-
const setParam =
|
|
2964
|
+
const setParam = useCallback12((key, value) => {
|
|
2947
2965
|
const config = stableSchema[key];
|
|
2948
2966
|
if (!config) {
|
|
2949
2967
|
console.warn(`[useApiParams] Unknown parameter: ${key}`);
|
|
@@ -2957,7 +2975,7 @@ function useApiParams(schema, options = {}) {
|
|
|
2957
2975
|
updateUrl(newParams);
|
|
2958
2976
|
}
|
|
2959
2977
|
}, [schemaKey, updateUrl, addParamToSearchParams]);
|
|
2960
|
-
const setParams =
|
|
2978
|
+
const setParams = useCallback12((updates) => {
|
|
2961
2979
|
const newParams = new URLSearchParams();
|
|
2962
2980
|
const keysToRemove = [];
|
|
2963
2981
|
for (const [key, value] of Object.entries(updates)) {
|
|
@@ -2974,11 +2992,11 @@ function useApiParams(schema, options = {}) {
|
|
|
2974
2992
|
}
|
|
2975
2993
|
updateUrl(newParams, keysToRemove);
|
|
2976
2994
|
}, [schemaKey, updateUrl, addParamToSearchParams]);
|
|
2977
|
-
const clearParams2 =
|
|
2995
|
+
const clearParams2 = useCallback12((keys) => {
|
|
2978
2996
|
const newParams = new URLSearchParams();
|
|
2979
2997
|
updateUrl(newParams, keys);
|
|
2980
2998
|
}, [updateUrl]);
|
|
2981
|
-
const resetParams =
|
|
2999
|
+
const resetParams = useCallback12(() => {
|
|
2982
3000
|
if (debug) {
|
|
2983
3001
|
console.log("[useApiParams] Resetting params");
|
|
2984
3002
|
}
|
|
@@ -3015,7 +3033,7 @@ function createSearchParams(params) {
|
|
|
3015
3033
|
}
|
|
3016
3034
|
|
|
3017
3035
|
// src/hooks/state/use-cursor-pagination-state.ts
|
|
3018
|
-
import { useCallback as
|
|
3036
|
+
import { useCallback as useCallback13, useEffect as useEffect17, useRef as useRef10, useState as useState22 } from "react";
|
|
3019
3037
|
var urlSchema = {
|
|
3020
3038
|
search: { type: "string", default: "" },
|
|
3021
3039
|
cursor: { type: "string", default: "" }
|
|
@@ -3026,13 +3044,13 @@ function useCursorPaginationState(options) {
|
|
|
3026
3044
|
onSearchChange
|
|
3027
3045
|
} = options;
|
|
3028
3046
|
const { params, setParam, setParams } = useApiParams(urlSchema);
|
|
3029
|
-
const [searchInput, setSearchInput] =
|
|
3030
|
-
const [hasLoadedBeyondFirst, setHasLoadedBeyondFirst] =
|
|
3031
|
-
const [initialLoadCount, setInitialLoadCount] =
|
|
3047
|
+
const [searchInput, setSearchInput] = useState22(params.search || "");
|
|
3048
|
+
const [hasLoadedBeyondFirst, setHasLoadedBeyondFirst] = useState22(false);
|
|
3049
|
+
const [initialLoadCount, setInitialLoadCount] = useState22(0);
|
|
3032
3050
|
const lastSearchRef = useRef10(null);
|
|
3033
3051
|
const isSyncingFromUrl = useRef10(false);
|
|
3034
3052
|
const isInitialLoadInProgress = useRef10(true);
|
|
3035
|
-
|
|
3053
|
+
useEffect17(() => {
|
|
3036
3054
|
if (isInitialLoadInProgress.current) return;
|
|
3037
3055
|
const urlSearch = params.search || "";
|
|
3038
3056
|
if (urlSearch !== searchInput) {
|
|
@@ -3043,7 +3061,7 @@ function useCursorPaginationState(options) {
|
|
|
3043
3061
|
}, 0);
|
|
3044
3062
|
}
|
|
3045
3063
|
}, [params.search, initialLoadCount]);
|
|
3046
|
-
|
|
3064
|
+
useEffect17(() => {
|
|
3047
3065
|
if (isInitialLoadInProgress.current) return;
|
|
3048
3066
|
if (isSyncingFromUrl.current) return;
|
|
3049
3067
|
if (searchInput !== params.search) {
|
|
@@ -3054,7 +3072,7 @@ function useCursorPaginationState(options) {
|
|
|
3054
3072
|
});
|
|
3055
3073
|
}
|
|
3056
3074
|
}, [searchInput, params.search, setParams, initialLoadCount]);
|
|
3057
|
-
|
|
3075
|
+
useEffect17(() => {
|
|
3058
3076
|
if (initialLoadCount === 0) {
|
|
3059
3077
|
const cursor = params.cursor || null;
|
|
3060
3078
|
const search = params.search || "";
|
|
@@ -3068,7 +3086,7 @@ function useCursorPaginationState(options) {
|
|
|
3068
3086
|
});
|
|
3069
3087
|
}
|
|
3070
3088
|
}, []);
|
|
3071
|
-
|
|
3089
|
+
useEffect17(() => {
|
|
3072
3090
|
if (isInitialLoadInProgress.current) return;
|
|
3073
3091
|
if (initialLoadCount === 0) return;
|
|
3074
3092
|
const currentSearch = params.search || "";
|
|
@@ -3078,7 +3096,7 @@ function useCursorPaginationState(options) {
|
|
|
3078
3096
|
onSearchChange(currentSearch);
|
|
3079
3097
|
}
|
|
3080
3098
|
}, [params.search, onSearchChange, initialLoadCount]);
|
|
3081
|
-
const handleNextPage =
|
|
3099
|
+
const handleNextPage = useCallback13(
|
|
3082
3100
|
async (endCursor, fetchFn) => {
|
|
3083
3101
|
setParam("cursor", endCursor);
|
|
3084
3102
|
await fetchFn();
|
|
@@ -3086,7 +3104,7 @@ function useCursorPaginationState(options) {
|
|
|
3086
3104
|
},
|
|
3087
3105
|
[setParam]
|
|
3088
3106
|
);
|
|
3089
|
-
const handleResetToFirstPage =
|
|
3107
|
+
const handleResetToFirstPage = useCallback13(
|
|
3090
3108
|
async (fetchFn) => {
|
|
3091
3109
|
setParam("cursor", "");
|
|
3092
3110
|
await fetchFn();
|
|
@@ -3108,16 +3126,16 @@ function useCursorPaginationState(options) {
|
|
|
3108
3126
|
}
|
|
3109
3127
|
|
|
3110
3128
|
// src/hooks/nats/use-nats-client.ts
|
|
3111
|
-
import { useEffect as
|
|
3129
|
+
import { useEffect as useEffect18, useMemo as useMemo5, useState as useState23 } from "react";
|
|
3112
3130
|
function useNatsClient(clientOptions, options = {}) {
|
|
3113
3131
|
const { autoConnect = true } = options;
|
|
3114
3132
|
const client = useMemo5(() => {
|
|
3115
3133
|
if (!clientOptions) return null;
|
|
3116
3134
|
return createNatsClient(clientOptions);
|
|
3117
3135
|
}, [clientOptions]);
|
|
3118
|
-
const [status, setStatus] =
|
|
3119
|
-
const [lastError, setLastError] =
|
|
3120
|
-
|
|
3136
|
+
const [status, setStatus] = useState23("disconnected");
|
|
3137
|
+
const [lastError, setLastError] = useState23(null);
|
|
3138
|
+
useEffect18(() => {
|
|
3121
3139
|
if (!client) {
|
|
3122
3140
|
setStatus("disconnected");
|
|
3123
3141
|
setLastError(null);
|
|
@@ -3148,7 +3166,7 @@ function useNatsClient(clientOptions, options = {}) {
|
|
|
3148
3166
|
}
|
|
3149
3167
|
|
|
3150
3168
|
// src/hooks/use-near-viewport.ts
|
|
3151
|
-
import { useEffect as
|
|
3169
|
+
import { useEffect as useEffect19, useRef as useRef11, useState as useState24, useCallback as useCallback14 } from "react";
|
|
3152
3170
|
var observers = /* @__PURE__ */ new Map();
|
|
3153
3171
|
var subscribers = /* @__PURE__ */ new WeakMap();
|
|
3154
3172
|
function getObserverFor(rootMargin) {
|
|
@@ -3172,9 +3190,9 @@ function getObserverFor(rootMargin) {
|
|
|
3172
3190
|
return io;
|
|
3173
3191
|
}
|
|
3174
3192
|
function useNearViewport(rootMargin = "500px") {
|
|
3175
|
-
const [isNear, setIsNear] =
|
|
3193
|
+
const [isNear, setIsNear] = useState24(false);
|
|
3176
3194
|
const elRef = useRef11(null);
|
|
3177
|
-
const ref =
|
|
3195
|
+
const ref = useCallback14(
|
|
3178
3196
|
(node) => {
|
|
3179
3197
|
const prev = elRef.current;
|
|
3180
3198
|
if (prev) {
|
|
@@ -3192,7 +3210,7 @@ function useNearViewport(rootMargin = "500px") {
|
|
|
3192
3210
|
},
|
|
3193
3211
|
[rootMargin]
|
|
3194
3212
|
);
|
|
3195
|
-
|
|
3213
|
+
useEffect19(() => {
|
|
3196
3214
|
return () => {
|
|
3197
3215
|
const el = elRef.current;
|
|
3198
3216
|
if (!el) return;
|
|
@@ -3206,7 +3224,7 @@ function useNearViewport(rootMargin = "500px") {
|
|
|
3206
3224
|
}
|
|
3207
3225
|
|
|
3208
3226
|
// src/hooks/use-access-code-integration.ts
|
|
3209
|
-
import
|
|
3227
|
+
import React3 from "react";
|
|
3210
3228
|
|
|
3211
3229
|
// src/utils/access-code-client.ts
|
|
3212
3230
|
async function validateAccessCode(email, code, endpoints) {
|
|
@@ -3269,8 +3287,8 @@ async function validateAndConsumeAccessCode(email, code, endpoints) {
|
|
|
3269
3287
|
function useAccessCodeIntegration() {
|
|
3270
3288
|
const runtime = useRequiredEndpointsRuntime();
|
|
3271
3289
|
const endpoints = runtime.accessCode;
|
|
3272
|
-
const [isValidating, setIsValidating] =
|
|
3273
|
-
const [isConsuming, setIsConsuming] =
|
|
3290
|
+
const [isValidating, setIsValidating] = React3.useState(false);
|
|
3291
|
+
const [isConsuming, setIsConsuming] = React3.useState(false);
|
|
3274
3292
|
const validate = async (email, code) => {
|
|
3275
3293
|
setIsValidating(true);
|
|
3276
3294
|
try {
|
|
@@ -3350,7 +3368,7 @@ function useOgPlaceholderUrl({
|
|
|
3350
3368
|
}
|
|
3351
3369
|
|
|
3352
3370
|
// src/hooks/use-scroll-to-hash.ts
|
|
3353
|
-
import { useEffect as
|
|
3371
|
+
import { useEffect as useEffect20 } from "react";
|
|
3354
3372
|
|
|
3355
3373
|
// src/utils/scroll-into-view.ts
|
|
3356
3374
|
var activeRaf = 0;
|
|
@@ -3488,7 +3506,7 @@ function navigateSamePageHash(target, options = {}) {
|
|
|
3488
3506
|
var MAX_POLL_FRAMES = 60;
|
|
3489
3507
|
function useScrollToHash(readyDep = true, options) {
|
|
3490
3508
|
const headerOffset = options?.headerOffset ?? 0;
|
|
3491
|
-
|
|
3509
|
+
useEffect20(() => {
|
|
3492
3510
|
if (typeof window === "undefined") return;
|
|
3493
3511
|
if (readyDep === null || readyDep === false) return;
|
|
3494
3512
|
let rafId = null;
|
|
@@ -3528,7 +3546,7 @@ function useScrollToHash(readyDep = true, options) {
|
|
|
3528
3546
|
}
|
|
3529
3547
|
|
|
3530
3548
|
// src/hooks/use-humanity-signals.ts
|
|
3531
|
-
import { useCallback as
|
|
3549
|
+
import { useCallback as useCallback15, useRef as useRef12 } from "react";
|
|
3532
3550
|
|
|
3533
3551
|
// src/utils/humanity-signals.ts
|
|
3534
3552
|
var HONEYPOT_FIELD = "contact_url_confirm";
|
|
@@ -3554,14 +3572,14 @@ var splitCsvEnv = (s) => s?.split(",").map((t) => t.trim()).filter(Boolean) ?? [
|
|
|
3554
3572
|
function useHumanitySignals() {
|
|
3555
3573
|
const ref = useRef12(null);
|
|
3556
3574
|
const mountedAt = useRef12(typeof performance !== "undefined" ? performance.now() : 0);
|
|
3557
|
-
const getSignals =
|
|
3575
|
+
const getSignals = useCallback15(
|
|
3558
3576
|
() => ({
|
|
3559
3577
|
[HONEYPOT_FIELD]: ref.current?.value ?? "",
|
|
3560
3578
|
[ELAPSED_MS_FIELD]: typeof performance !== "undefined" ? Math.round(performance.now() - mountedAt.current) : 0
|
|
3561
3579
|
}),
|
|
3562
3580
|
[]
|
|
3563
3581
|
);
|
|
3564
|
-
const resetSignals =
|
|
3582
|
+
const resetSignals = useCallback15(() => {
|
|
3565
3583
|
if (ref.current) ref.current.value = "";
|
|
3566
3584
|
if (typeof performance !== "undefined") mountedAt.current = performance.now();
|
|
3567
3585
|
}, []);
|
|
@@ -3571,6 +3589,7 @@ function useHumanitySignals() {
|
|
|
3571
3589
|
export {
|
|
3572
3590
|
useAutoLimitTags,
|
|
3573
3591
|
useDebounce,
|
|
3592
|
+
useDeferredError,
|
|
3574
3593
|
useHeaderHeight,
|
|
3575
3594
|
useHorizontalScrollbar,
|
|
3576
3595
|
useImageEdgeColor,
|
|
@@ -3681,4 +3700,4 @@ export {
|
|
|
3681
3700
|
splitCsvEnv,
|
|
3682
3701
|
useHumanitySignals
|
|
3683
3702
|
};
|
|
3684
|
-
//# sourceMappingURL=chunk-
|
|
3703
|
+
//# sourceMappingURL=chunk-DH6HTYOV.js.map
|