@flamingo-stack/openframe-frontend-core 0.0.210 → 0.0.212-snapshot.20260528112413
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-VBFOCTMD.cjs → chunk-35XIT2CF.cjs} +17 -17
- package/dist/{chunk-VBFOCTMD.cjs.map → chunk-35XIT2CF.cjs.map} +1 -1
- package/dist/{chunk-ATEUJQKU.js → chunk-3JWIJJ44.js} +2 -2
- package/dist/chunk-CZR7ARBA.js +698 -0
- package/dist/chunk-CZR7ARBA.js.map +1 -0
- package/dist/{chunk-UYQOPC57.js → chunk-HICZPTRR.js} +4 -351
- package/dist/chunk-HICZPTRR.js.map +1 -0
- package/dist/{chunk-WJBPLMBX.js → chunk-IK2X5YJU.js} +3 -3
- package/dist/{chunk-MDTIOPVS.cjs → chunk-OTKJASSX.cjs} +26 -26
- package/dist/{chunk-MDTIOPVS.cjs.map → chunk-OTKJASSX.cjs.map} +1 -1
- package/dist/chunk-OZ3GH6OQ.cjs +698 -0
- package/dist/chunk-OZ3GH6OQ.cjs.map +1 -0
- package/dist/{chunk-6RZYJICV.cjs → chunk-P5EE2VJX.cjs} +1 -1
- package/dist/chunk-P5EE2VJX.cjs.map +1 -0
- package/dist/{chunk-EH3RWVF3.cjs → chunk-WT5JV2GS.cjs} +8 -355
- package/dist/chunk-WT5JV2GS.cjs.map +1 -0
- package/dist/{chunk-TWKPYZNQ.cjs → chunk-ZDF6F7ED.cjs} +569 -694
- package/dist/chunk-ZDF6F7ED.cjs.map +1 -0
- package/dist/{chunk-7L4DWM7P.js → chunk-ZG2YY5E7.js} +1 -1
- package/dist/chunk-ZG2YY5E7.js.map +1 -0
- package/dist/{chunk-R5RNRH62.js → chunk-ZTJVRSN5.js} +422 -547
- package/dist/chunk-ZTJVRSN5.js.map +1 -0
- package/dist/components/chat/hooks/use-chat-identity.d.ts +3 -3
- package/dist/components/chat/hooks/use-chat-identity.d.ts.map +1 -1
- package/dist/components/chat/hooks/use-jetstream-dialog-subscription.d.ts.map +1 -1
- package/dist/components/chat/hooks/use-nats-dialog-subscription.d.ts +0 -9
- package/dist/components/chat/hooks/use-nats-dialog-subscription.d.ts.map +1 -1
- package/dist/components/chat/index.cjs +6 -5
- package/dist/components/chat/index.cjs.map +1 -1
- package/dist/components/chat/index.js +5 -4
- package/dist/components/contact/index.cjs +7 -6
- package/dist/components/contact/index.cjs.map +1 -1
- package/dist/components/contact/index.js +6 -5
- package/dist/components/features/index.cjs +6 -5
- package/dist/components/features/index.cjs.map +1 -1
- package/dist/components/features/index.js +5 -4
- package/dist/components/features/notifications/index.d.ts +2 -2
- package/dist/components/features/notifications/index.d.ts.map +1 -1
- package/dist/components/features/notifications/notifications-context.d.ts +16 -1
- package/dist/components/features/notifications/notifications-context.d.ts.map +1 -1
- package/dist/components/features/notifications/types.d.ts +4 -0
- package/dist/components/features/notifications/types.d.ts.map +1 -1
- package/dist/components/footer-waitlist-button.d.ts +21 -2
- package/dist/components/footer-waitlist-button.d.ts.map +1 -1
- package/dist/components/index.cjs +93 -96
- package/dist/components/index.cjs.map +1 -1
- package/dist/components/index.js +17 -20
- package/dist/components/index.js.map +1 -1
- package/dist/components/navigation/app-header.d.ts.map +1 -1
- package/dist/components/navigation/index.cjs +6 -5
- package/dist/components/navigation/index.cjs.map +1 -1
- package/dist/components/navigation/index.js +5 -4
- package/dist/components/navigation/sticky-section-nav.d.ts.map +1 -1
- package/dist/components/tickets/help-center-card.d.ts.map +1 -1
- package/dist/components/tickets/index.cjs +144 -102
- package/dist/components/tickets/index.cjs.map +1 -1
- package/dist/components/tickets/index.js +98 -56
- package/dist/components/tickets/index.js.map +1 -1
- package/dist/components/tickets/ticket-row.d.ts.map +1 -1
- package/dist/components/ui/index.cjs +6 -5
- package/dist/components/ui/index.cjs.map +1 -1
- package/dist/components/ui/index.js +5 -4
- package/dist/contexts/chat-runtime-context.d.ts +6 -3
- package/dist/contexts/chat-runtime-context.d.ts.map +1 -1
- package/dist/contexts/index.cjs +2 -2
- package/dist/contexts/index.js +1 -1
- package/dist/embed-shims/index.cjs +3 -3
- package/dist/embed-shims/index.cjs.map +1 -1
- package/dist/embed-shims/index.js +4 -4
- package/dist/hooks/index.cjs +3 -2
- package/dist/hooks/index.cjs.map +1 -1
- package/dist/hooks/index.js +2 -1
- package/dist/index.cjs +8 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +7 -4
- package/dist/nats/index.cjs +28 -346
- package/dist/nats/index.cjs.map +1 -1
- package/dist/nats/index.d.ts +3 -0
- package/dist/nats/index.d.ts.map +1 -1
- package/dist/nats/index.js +30 -346
- package/dist/nats/index.js.map +1 -1
- package/dist/nats/nats-provider.d.ts +28 -0
- package/dist/nats/nats-provider.d.ts.map +1 -0
- package/dist/nats/nats.d.ts +1 -0
- package/dist/nats/nats.d.ts.map +1 -1
- package/dist/nats/shared-connection.d.ts +73 -0
- package/dist/nats/shared-connection.d.ts.map +1 -0
- package/dist/nats/use-nats-subscription.d.ts +18 -0
- package/dist/nats/use-nats-subscription.d.ts.map +1 -0
- package/dist/utils/index.cjs +10 -0
- package/dist/utils/index.cjs.map +1 -1
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/index.js +10 -1
- package/dist/utils/index.js.map +1 -1
- package/dist/utils/scroll-into-view.d.ts +63 -0
- package/dist/utils/scroll-into-view.d.ts.map +1 -0
- package/package.json +1 -1
- package/src/components/chat/hooks/use-chat-identity.ts +8 -7
- package/src/components/chat/hooks/use-jetstream-dialog-subscription.ts +60 -207
- package/src/components/chat/hooks/use-nats-dialog-subscription.ts +71 -214
- package/src/components/features/notifications/index.ts +2 -1
- package/src/components/features/notifications/notifications-context.tsx +104 -6
- package/src/components/features/notifications/types.ts +5 -0
- package/src/components/footer-waitlist-button.tsx +33 -16
- package/src/components/navigation/app-header.tsx +7 -9
- package/src/components/navigation/sticky-section-nav.tsx +6 -4
- package/src/components/tickets/help-center-card.tsx +55 -1
- package/src/components/tickets/help-center-list.tsx +9 -1
- package/src/components/tickets/ticket-detail-drawer.tsx +19 -4
- package/src/components/tickets/ticket-row.tsx +30 -19
- package/src/contexts/chat-runtime-context.tsx +6 -3
- package/src/nats/index.ts +3 -0
- package/src/nats/nats-provider.tsx +146 -0
- package/src/nats/nats.ts +2 -0
- package/src/nats/shared-connection.ts +285 -0
- package/src/nats/use-nats-subscription.ts +99 -0
- package/src/stories/EmbeddableChat.stories.tsx +1 -1
- package/src/utils/index.ts +12 -0
- package/src/utils/scroll-into-view.ts +74 -0
- package/dist/chunk-6RZYJICV.cjs.map +0 -1
- package/dist/chunk-7L4DWM7P.js.map +0 -1
- package/dist/chunk-EH3RWVF3.cjs.map +0 -1
- package/dist/chunk-R5RNRH62.js.map +0 -1
- package/dist/chunk-TWKPYZNQ.cjs.map +0 -1
- package/dist/chunk-UYQOPC57.js.map +0 -1
- /package/dist/{chunk-ATEUJQKU.js.map → chunk-3JWIJJ44.js.map} +0 -0
- /package/dist/{chunk-WJBPLMBX.js.map → chunk-IK2X5YJU.js.map} +0 -0
|
@@ -9,11 +9,11 @@ import {
|
|
|
9
9
|
EmptyState,
|
|
10
10
|
UnifiedPagination,
|
|
11
11
|
init_unified_pagination
|
|
12
|
-
} from "../../chunk-
|
|
12
|
+
} from "../../chunk-3JWIJJ44.js";
|
|
13
13
|
import "../../chunk-4XLJWX2N.js";
|
|
14
14
|
import {
|
|
15
15
|
ContactForm
|
|
16
|
-
} from "../../chunk-
|
|
16
|
+
} from "../../chunk-IK2X5YJU.js";
|
|
17
17
|
import {
|
|
18
18
|
AlertDialog,
|
|
19
19
|
AlertDialogAction,
|
|
@@ -33,24 +33,26 @@ import {
|
|
|
33
33
|
embedAuthedFetch,
|
|
34
34
|
formatRelativeTime,
|
|
35
35
|
getStatusColorScheme,
|
|
36
|
+
scrollElementIntoView,
|
|
36
37
|
useChatAttachments,
|
|
37
38
|
useChatIdentity
|
|
38
|
-
} from "../../chunk-
|
|
39
|
+
} from "../../chunk-ZTJVRSN5.js";
|
|
39
40
|
import {
|
|
40
41
|
toast
|
|
41
|
-
} from "../../chunk-
|
|
42
|
+
} from "../../chunk-HICZPTRR.js";
|
|
42
43
|
import "../../chunk-CIPO6DXK.js";
|
|
43
44
|
import "../../chunk-EDW2NVRV.js";
|
|
44
45
|
import "../../chunk-W72U7OU7.js";
|
|
45
|
-
import "../../chunk-
|
|
46
|
+
import "../../chunk-ZG2YY5E7.js";
|
|
46
47
|
import "../../chunk-MJNXIEV2.js";
|
|
48
|
+
import "../../chunk-LXC6P2EO.js";
|
|
47
49
|
import "../../chunk-EL5YVPD5.js";
|
|
48
50
|
import {
|
|
49
51
|
usePathname,
|
|
50
52
|
useRouter,
|
|
51
53
|
useSearchParams
|
|
52
54
|
} from "../../chunk-PLJLE4A4.js";
|
|
53
|
-
import "../../chunk-
|
|
55
|
+
import "../../chunk-CZR7ARBA.js";
|
|
54
56
|
import {
|
|
55
57
|
Button,
|
|
56
58
|
Input,
|
|
@@ -63,7 +65,7 @@ import "../../chunk-OHPI2HRK.js";
|
|
|
63
65
|
import "../../chunk-GGWZFCYS.js";
|
|
64
66
|
|
|
65
67
|
// src/components/tickets/ticket-center.tsx
|
|
66
|
-
import { useCallback as
|
|
68
|
+
import { useCallback as useCallback3, useState as useState4 } from "react";
|
|
67
69
|
import { useQueryClient as useQueryClient2 } from "@tanstack/react-query";
|
|
68
70
|
init_button();
|
|
69
71
|
import { RefreshCw } from "lucide-react";
|
|
@@ -212,7 +214,7 @@ function TicketOpenForm({
|
|
|
212
214
|
}
|
|
213
215
|
|
|
214
216
|
// src/components/tickets/ticket-row.tsx
|
|
215
|
-
import {
|
|
217
|
+
import { useCallback, useRef } from "react";
|
|
216
218
|
|
|
217
219
|
// src/components/collapsible.tsx
|
|
218
220
|
import * as CollapsiblePrimitive from "@radix-ui/react-collapsible";
|
|
@@ -405,7 +407,7 @@ function TicketTimelinePanel({ ticket }) {
|
|
|
405
407
|
ConversationCardRow,
|
|
406
408
|
{
|
|
407
409
|
author,
|
|
408
|
-
role:
|
|
410
|
+
role: "Reply",
|
|
409
411
|
avatarSrc,
|
|
410
412
|
timestamp: eng.createdAt,
|
|
411
413
|
body: stripAttachmentsPreamble(eng.body ?? ""),
|
|
@@ -605,14 +607,22 @@ function TicketRow({
|
|
|
605
607
|
}) {
|
|
606
608
|
const optimistic = isOptimistic(ticket);
|
|
607
609
|
const rowRef = useRef(null);
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
rowRef.current
|
|
613
|
-
|
|
610
|
+
const handleClick = useCallback(() => {
|
|
611
|
+
onToggle(ticket.id);
|
|
612
|
+
scrollElementIntoView(rowRef.current, {
|
|
613
|
+
adjustTargetY: (raw) => {
|
|
614
|
+
if (!rowRef.current) return raw;
|
|
615
|
+
const expandedDrawer = document.querySelector(
|
|
616
|
+
'div[id^="ticket-drawer-"]'
|
|
617
|
+
);
|
|
618
|
+
if (!(expandedDrawer instanceof HTMLElement)) return raw;
|
|
619
|
+
const drawerRect = expandedDrawer.getBoundingClientRect();
|
|
620
|
+
const myRect = rowRef.current.getBoundingClientRect();
|
|
621
|
+
if (drawerRect.bottom > myRect.top) return raw;
|
|
622
|
+
return raw - drawerRect.height;
|
|
623
|
+
}
|
|
614
624
|
});
|
|
615
|
-
}, [
|
|
625
|
+
}, [onToggle, ticket.id]);
|
|
616
626
|
const tileData = {
|
|
617
627
|
id: ticket.id,
|
|
618
628
|
title: ticket.subject ?? "(untitled)",
|
|
@@ -633,7 +643,7 @@ function TicketRow({
|
|
|
633
643
|
// when the task exists but its status hasn't synced yet.
|
|
634
644
|
linkedTaskLabel: ticket.clickup ? ticket.clickup.status ? ticket.clickup.status.replace(/\b\w/g, (c) => c.toUpperCase()) : "Linked work" : void 0
|
|
635
645
|
};
|
|
636
|
-
return /* @__PURE__ */ jsx4("div", { ref: rowRef, className: "scroll-mt-
|
|
646
|
+
return /* @__PURE__ */ jsx4("div", { ref: rowRef, className: "scroll-mt-24", children: /* @__PURE__ */ jsxs3(
|
|
637
647
|
Collapsible,
|
|
638
648
|
{
|
|
639
649
|
open: expanded && !optimistic,
|
|
@@ -643,7 +653,7 @@ function TicketRow({
|
|
|
643
653
|
ChatTicketItem,
|
|
644
654
|
{
|
|
645
655
|
ticket: tileData,
|
|
646
|
-
onClick: optimistic ? void 0 :
|
|
656
|
+
onClick: optimistic ? void 0 : handleClick,
|
|
647
657
|
"aria-expanded": expanded && !optimistic,
|
|
648
658
|
"aria-controls": `ticket-drawer-${ticket.id}`
|
|
649
659
|
}
|
|
@@ -758,7 +768,7 @@ function useTicketsList(filters) {
|
|
|
758
768
|
}
|
|
759
769
|
|
|
760
770
|
// src/components/tickets/hooks/use-ticket-actions.ts
|
|
761
|
-
import { useCallback
|
|
771
|
+
import { useCallback as useCallback2, useEffect, useMemo, useRef as useRef2, useState as useState3 } from "react";
|
|
762
772
|
import { useQueryClient } from "@tanstack/react-query";
|
|
763
773
|
var TICKET_ACTION_ENDPOINT = "/api/chat/agent/ticket-action";
|
|
764
774
|
var MIRROR_SYNC_BACKOFF_MS = [3e3, 6e3, 12e3];
|
|
@@ -769,14 +779,14 @@ function useTicketActions(options) {
|
|
|
769
779
|
const [isSubmittingForm, setIsSubmittingForm] = useState3(false);
|
|
770
780
|
const busyRowsRef = useRef2(/* @__PURE__ */ new Set());
|
|
771
781
|
const [busyRows, setBusyRows] = useState3(() => /* @__PURE__ */ new Set());
|
|
772
|
-
const setRowBusy =
|
|
782
|
+
const setRowBusy = useCallback2((id, busy) => {
|
|
773
783
|
if (busy) busyRowsRef.current.add(id);
|
|
774
784
|
else busyRowsRef.current.delete(id);
|
|
775
785
|
setBusyRows(new Set(busyRowsRef.current));
|
|
776
786
|
}, []);
|
|
777
|
-
const isRowBusy =
|
|
787
|
+
const isRowBusy = useCallback2((id) => busyRows.has(id), [busyRows]);
|
|
778
788
|
const watcherControllersRef = useRef2(/* @__PURE__ */ new Map());
|
|
779
|
-
|
|
789
|
+
useEffect(() => {
|
|
780
790
|
return () => {
|
|
781
791
|
for (const controller of watcherControllersRef.current.values()) {
|
|
782
792
|
controller.abort();
|
|
@@ -785,12 +795,12 @@ function useTicketActions(options) {
|
|
|
785
795
|
};
|
|
786
796
|
}, []);
|
|
787
797
|
const queueRef = useRef2(Promise.resolve());
|
|
788
|
-
const enqueue =
|
|
798
|
+
const enqueue = useCallback2((work) => {
|
|
789
799
|
const next = queueRef.current.then(work, work);
|
|
790
800
|
queueRef.current = next.catch(() => void 0);
|
|
791
801
|
return next;
|
|
792
802
|
}, []);
|
|
793
|
-
const executeTicketAction =
|
|
803
|
+
const executeTicketAction = useCallback2(
|
|
794
804
|
async (toolName, args) => {
|
|
795
805
|
const res = await embedAuthedFetch(TICKET_ACTION_ENDPOINT, {
|
|
796
806
|
method: "POST",
|
|
@@ -806,7 +816,7 @@ function useTicketActions(options) {
|
|
|
806
816
|
},
|
|
807
817
|
[]
|
|
808
818
|
);
|
|
809
|
-
const watchMirrorSync =
|
|
819
|
+
const watchMirrorSync = useCallback2(
|
|
810
820
|
(placeholderId, expectedTicketId) => {
|
|
811
821
|
const prior = watcherControllersRef.current.get(placeholderId);
|
|
812
822
|
if (prior) prior.abort();
|
|
@@ -852,7 +862,7 @@ function useTicketActions(options) {
|
|
|
852
862
|
},
|
|
853
863
|
[queryClient, removeOptimistic, toast2]
|
|
854
864
|
);
|
|
855
|
-
const surfaceError =
|
|
865
|
+
const surfaceError = useCallback2(
|
|
856
866
|
(err, action) => {
|
|
857
867
|
const mapped = mapTicketActionError(err);
|
|
858
868
|
if (mapped.supportSystemDown) onSupportSystemDown();
|
|
@@ -865,7 +875,7 @@ function useTicketActions(options) {
|
|
|
865
875
|
},
|
|
866
876
|
[toast2, onSupportSystemDown]
|
|
867
877
|
);
|
|
868
|
-
const submitTicket =
|
|
878
|
+
const submitTicket = useCallback2(
|
|
869
879
|
async (input) => {
|
|
870
880
|
if (formInFlightRef.current) return false;
|
|
871
881
|
formInFlightRef.current = true;
|
|
@@ -930,7 +940,7 @@ function useTicketActions(options) {
|
|
|
930
940
|
surfaceError
|
|
931
941
|
]
|
|
932
942
|
);
|
|
933
|
-
const updateTicket =
|
|
943
|
+
const updateTicket = useCallback2(
|
|
934
944
|
async (ticket, serverArgs, successCopy, action) => {
|
|
935
945
|
if (busyRowsRef.current.has(ticket.id)) return false;
|
|
936
946
|
setRowBusy(ticket.id, true);
|
|
@@ -963,7 +973,7 @@ function useTicketActions(options) {
|
|
|
963
973
|
// and cascade-recreate addNote/closeTicket/etc.
|
|
964
974
|
[setRowBusy, enqueue, executeTicketAction, queryClient, toast2, surfaceError, removeTicketFromCache]
|
|
965
975
|
);
|
|
966
|
-
const sendMessage =
|
|
976
|
+
const sendMessage = useCallback2(
|
|
967
977
|
(ticket, text, attachments) => {
|
|
968
978
|
const trimmed = text.trim();
|
|
969
979
|
const hasText = trimmed.length > 0;
|
|
@@ -981,7 +991,7 @@ function useTicketActions(options) {
|
|
|
981
991
|
},
|
|
982
992
|
[updateTicket]
|
|
983
993
|
);
|
|
984
|
-
const closeTicket =
|
|
994
|
+
const closeTicket = useCallback2(
|
|
985
995
|
(ticket, resolution) => updateTicket(
|
|
986
996
|
ticket,
|
|
987
997
|
{
|
|
@@ -993,7 +1003,7 @@ function useTicketActions(options) {
|
|
|
993
1003
|
),
|
|
994
1004
|
[updateTicket]
|
|
995
1005
|
);
|
|
996
|
-
const reopenTicket =
|
|
1006
|
+
const reopenTicket = useCallback2(
|
|
997
1007
|
(ticket) => updateTicket(ticket, { status: "OPEN" }, TOAST_COPY.reopen_success, "reopen ticket"),
|
|
998
1008
|
[updateTicket]
|
|
999
1009
|
);
|
|
@@ -1140,14 +1150,14 @@ function TicketCenterAuthed({
|
|
|
1140
1150
|
const [optimisticTickets, setOptimisticTickets] = useState4([]);
|
|
1141
1151
|
const [expandedTicketId, setExpandedTicketId] = useState4(null);
|
|
1142
1152
|
const [supportSystemDown, setSupportSystemDown] = useState4(false);
|
|
1143
|
-
const prependOptimistic =
|
|
1153
|
+
const prependOptimistic = useCallback3((placeholder) => {
|
|
1144
1154
|
setOptimisticTickets((prev) => [placeholder, ...prev]);
|
|
1145
1155
|
}, []);
|
|
1146
|
-
const removeOptimistic =
|
|
1156
|
+
const removeOptimistic = useCallback3((placeholderId) => {
|
|
1147
1157
|
setOptimisticTickets((prev) => prev.filter((t) => t.id !== placeholderId));
|
|
1148
1158
|
setExpandedTicketId((prev) => prev === placeholderId ? null : prev);
|
|
1149
1159
|
}, []);
|
|
1150
|
-
const removeTicketFromCache =
|
|
1160
|
+
const removeTicketFromCache = useCallback3(
|
|
1151
1161
|
(ticketId) => {
|
|
1152
1162
|
queryClient.setQueriesData(
|
|
1153
1163
|
{ queryKey: ["tickets"] },
|
|
@@ -1164,7 +1174,7 @@ function TicketCenterAuthed({
|
|
|
1164
1174
|
toast: toast2,
|
|
1165
1175
|
onSupportSystemDown: () => setSupportSystemDown(true)
|
|
1166
1176
|
});
|
|
1167
|
-
const toggleRow =
|
|
1177
|
+
const toggleRow = useCallback3((id) => {
|
|
1168
1178
|
setExpandedTicketId((prev) => prev === id ? null : id);
|
|
1169
1179
|
}, []);
|
|
1170
1180
|
const merged = [...optimisticTickets, ...tickets];
|
|
@@ -1247,12 +1257,14 @@ function TicketListSkeleton() {
|
|
|
1247
1257
|
}
|
|
1248
1258
|
|
|
1249
1259
|
// src/components/tickets/help-center-list.tsx
|
|
1250
|
-
import { useCallback as
|
|
1260
|
+
import { useCallback as useCallback5, useState as useState6 } from "react";
|
|
1251
1261
|
import { useQueryClient as useQueryClient3 } from "@tanstack/react-query";
|
|
1252
1262
|
init_unified_pagination();
|
|
1253
1263
|
|
|
1254
1264
|
// src/components/tickets/help-center-card.tsx
|
|
1265
|
+
import { useCallback as useCallback4, useRef as useRef3 } from "react";
|
|
1255
1266
|
import { Fragment, jsx as jsx6, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
1267
|
+
var STICKY_HEADER_OFFSET_PX = 96;
|
|
1256
1268
|
function HelpCenterCard({
|
|
1257
1269
|
ticket,
|
|
1258
1270
|
expanded,
|
|
@@ -1273,6 +1285,24 @@ function HelpCenterCard({
|
|
|
1273
1285
|
const description = ticket.preview ?? ticket.body ?? "";
|
|
1274
1286
|
const isExpandable = !optimistic;
|
|
1275
1287
|
const isExpanded = expanded && isExpandable;
|
|
1288
|
+
const rowRef = useRef3(null);
|
|
1289
|
+
const handleClick = useCallback4(() => {
|
|
1290
|
+
onToggle(ticket.id);
|
|
1291
|
+
scrollElementIntoView(rowRef.current, {
|
|
1292
|
+
headerOffset: STICKY_HEADER_OFFSET_PX,
|
|
1293
|
+
adjustTargetY: (raw) => {
|
|
1294
|
+
if (!rowRef.current) return raw;
|
|
1295
|
+
const expandedDrawer = document.querySelector(
|
|
1296
|
+
'div[id^="help-center-drawer-"]'
|
|
1297
|
+
);
|
|
1298
|
+
if (!(expandedDrawer instanceof HTMLElement)) return raw;
|
|
1299
|
+
const drawerRect = expandedDrawer.getBoundingClientRect();
|
|
1300
|
+
const myRect = rowRef.current.getBoundingClientRect();
|
|
1301
|
+
if (drawerRect.bottom > myRect.top) return raw;
|
|
1302
|
+
return raw - drawerRect.height;
|
|
1303
|
+
}
|
|
1304
|
+
});
|
|
1305
|
+
}, [onToggle, ticket.id]);
|
|
1276
1306
|
const rightBadges = /* @__PURE__ */ jsxs5(Fragment, { children: [
|
|
1277
1307
|
/* @__PURE__ */ jsx6(
|
|
1278
1308
|
StatusBadge,
|
|
@@ -1296,6 +1326,8 @@ function HelpCenterCard({
|
|
|
1296
1326
|
return /* @__PURE__ */ jsxs5(
|
|
1297
1327
|
"div",
|
|
1298
1328
|
{
|
|
1329
|
+
ref: rowRef,
|
|
1330
|
+
style: { scrollMarginTop: STICKY_HEADER_OFFSET_PX },
|
|
1299
1331
|
className: `border-b border-ods-border last:border-b-0 ${optimistic ? "opacity-60" : ""}`,
|
|
1300
1332
|
"aria-busy": optimistic || void 0,
|
|
1301
1333
|
children: [
|
|
@@ -1303,7 +1335,7 @@ function HelpCenterCard({
|
|
|
1303
1335
|
"button",
|
|
1304
1336
|
{
|
|
1305
1337
|
type: "button",
|
|
1306
|
-
onClick: isExpandable ?
|
|
1338
|
+
onClick: isExpandable ? handleClick : void 0,
|
|
1307
1339
|
disabled: !isExpandable,
|
|
1308
1340
|
"aria-expanded": isExpandable ? isExpanded : void 0,
|
|
1309
1341
|
"aria-controls": isExpanded ? `help-center-drawer-${ticket.id}` : void 0,
|
|
@@ -1518,14 +1550,14 @@ function HelpCenterListAuthed({
|
|
|
1518
1550
|
const [optimisticTickets, setOptimisticTickets] = useState6([]);
|
|
1519
1551
|
const [expandedTicketId, setExpandedTicketId] = useState6(null);
|
|
1520
1552
|
const [supportSystemDown, setSupportSystemDown] = useState6(false);
|
|
1521
|
-
const prependOptimistic =
|
|
1553
|
+
const prependOptimistic = useCallback5((placeholder) => {
|
|
1522
1554
|
setOptimisticTickets((prev) => [placeholder, ...prev]);
|
|
1523
1555
|
}, []);
|
|
1524
|
-
const removeOptimistic =
|
|
1556
|
+
const removeOptimistic = useCallback5((placeholderId) => {
|
|
1525
1557
|
setOptimisticTickets((prev) => prev.filter((t) => t.id !== placeholderId));
|
|
1526
1558
|
setExpandedTicketId((prev) => prev === placeholderId ? null : prev);
|
|
1527
1559
|
}, []);
|
|
1528
|
-
const removeTicketFromCache =
|
|
1560
|
+
const removeTicketFromCache = useCallback5(
|
|
1529
1561
|
(ticketId) => {
|
|
1530
1562
|
queryClient.setQueriesData(
|
|
1531
1563
|
{ queryKey: ["tickets"] },
|
|
@@ -1542,7 +1574,7 @@ function HelpCenterListAuthed({
|
|
|
1542
1574
|
toast: toast2,
|
|
1543
1575
|
onSupportSystemDown: () => setSupportSystemDown(true)
|
|
1544
1576
|
});
|
|
1545
|
-
const toggleRow =
|
|
1577
|
+
const toggleRow = useCallback5((id) => {
|
|
1546
1578
|
setExpandedTicketId((prev) => prev === id ? null : id);
|
|
1547
1579
|
}, []);
|
|
1548
1580
|
const merged = [...optimisticTickets, ...tickets];
|
|
@@ -1595,21 +1627,31 @@ function HelpCenterListAuthed({
|
|
|
1595
1627
|
description: "Open one above to start the conversation with the support team.",
|
|
1596
1628
|
showCTA: false
|
|
1597
1629
|
}
|
|
1598
|
-
) :
|
|
1599
|
-
|
|
1600
|
-
|
|
1601
|
-
|
|
1602
|
-
|
|
1603
|
-
|
|
1604
|
-
|
|
1605
|
-
|
|
1606
|
-
|
|
1607
|
-
|
|
1608
|
-
|
|
1609
|
-
|
|
1610
|
-
|
|
1611
|
-
|
|
1612
|
-
|
|
1630
|
+
) : (
|
|
1631
|
+
// `overflow-clip` (NOT `overflow-hidden`) — both visually
|
|
1632
|
+
// clip the rounded corners, but `hidden` makes the element
|
|
1633
|
+
// a "scroll container" per CSSOM spec, which causes
|
|
1634
|
+
// `scrollIntoView` calls inside (`<HelpCenterCard>` click
|
|
1635
|
+
// handlers) to try scrolling THIS div (can't, overflow
|
|
1636
|
+
// hidden) instead of bubbling up to the window. `clip`
|
|
1637
|
+
// keeps the visual clip but NOT the scroll-container
|
|
1638
|
+
// status, so click-to-scroll actually moves the page.
|
|
1639
|
+
/* @__PURE__ */ jsx8("div", { className: "bg-ods-card border border-ods-border rounded-[6px] overflow-clip w-full", children: merged.map((ticket) => /* @__PURE__ */ jsx8(
|
|
1640
|
+
HelpCenterCard,
|
|
1641
|
+
{
|
|
1642
|
+
ticket,
|
|
1643
|
+
expanded: expandedTicketId === ticket.id,
|
|
1644
|
+
onToggle: toggleRow,
|
|
1645
|
+
busy: isOptimistic(ticket) ? false : actions.isRowBusy(ticket.id),
|
|
1646
|
+
supportSystemDown,
|
|
1647
|
+
onSendMessage: actions.sendMessage,
|
|
1648
|
+
onClose: actions.closeTicket,
|
|
1649
|
+
onReopen: actions.reopenTicket,
|
|
1650
|
+
onActionCollapsed: () => setExpandedTicketId(null)
|
|
1651
|
+
},
|
|
1652
|
+
ticket.id
|
|
1653
|
+
)) })
|
|
1654
|
+
) }),
|
|
1613
1655
|
!error && totalPages > 1 && /* @__PURE__ */ jsx8(UnifiedPagination, { currentPage: page, totalPages })
|
|
1614
1656
|
] });
|
|
1615
1657
|
return /* @__PURE__ */ jsx8(DevSectionPage, { sectionKey: "tickets", preControls: form, children: body });
|