@buerokratt-ria/common-gui-components 0.0.30 → 0.0.33

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/CHANGELOG.md CHANGED
@@ -4,6 +4,20 @@ All changes to this project will be documented in this file.
4
4
 
5
5
  ## Template [MajorVersion.MediterraneanVersion.MinorVersion] - DD-MM-YYYY
6
6
 
7
+ ## [0.0.33] - 22.12.2025
8
+
9
+ - Updated domain logic change
10
+ - Added abort ref to cancel unnecessary api calls.
11
+
12
+ ## [0.0.32] - 19-11-2025
13
+
14
+ - Fixed isTest Mark.
15
+ - Fixed Columns Spacing in Firefox
16
+
17
+ ## [0.0.31] - 18-11-2025
18
+
19
+ - Added chat id to URL params in chats history page.
20
+
7
21
  ## [0.0.30] - 10-11-2025
8
22
 
9
23
  - Enhanced Markdownify
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@buerokratt-ria/common-gui-components",
3
- "version": "0.0.30",
3
+ "version": "0.0.33",
4
4
  "description": "Common GUI components and pre defined templates.",
5
5
  "main": "index.ts",
6
6
  "author": "ExiRai",
@@ -124,6 +124,7 @@ const ChatHistory: FC<PropsWithChildren<HistoryProps>> = ({
124
124
  const envVal = import.meta.env.REACT_APP_SHOW_TEST_CONVERSATIONS;
125
125
  const showTest = envVal === undefined ? true : envVal.toLowerCase() === 'true';
126
126
  const [loading, setLoading] = useState(false);
127
+ const abortRef = useRef<AbortController | null>(null);
127
128
 
128
129
  const parseDateParam = (dateString: string | null) => {
129
130
  if (!dateString) return new Date();
@@ -158,13 +159,20 @@ const ChatHistory: FC<PropsWithChildren<HistoryProps>> = ({
158
159
  });
159
160
  }, 500);
160
161
 
161
- if (multiDomainEnabled) {
162
- useStore.subscribe((state, prevState) => {
163
- if (JSON.stringify(state.userDomains) !== JSON.stringify(prevState.userDomains)) {
164
- setUpdateKey(prevState => prevState + 1);
162
+ useEffect(() => {
163
+ if (!multiDomainEnabled) return;
164
+
165
+ const unsubscribe = useStore.subscribe((state, prevState) => {
166
+ if (
167
+ JSON.stringify(state.userDomains) !==
168
+ JSON.stringify(prevState.userDomains)
169
+ ) {
170
+ setUpdateKey((v) => v + 1);
165
171
  }
166
172
  });
167
- }
173
+
174
+ return () => unsubscribe();
175
+ }, [multiDomainEnabled, useStore]);
168
176
 
169
177
  useEffect(() => {
170
178
  if (passedChatId != null) {
@@ -292,6 +300,9 @@ const ChatHistory: FC<PropsWithChildren<HistoryProps>> = ({
292
300
  sorting: SortingState;
293
301
  search: string;
294
302
  }) => {
303
+ abortRef.current?.abort();
304
+ abortRef.current = new AbortController();
305
+
295
306
  let sortBy = 'created desc';
296
307
  if (sorting.length > 0) {
297
308
  const sortType = sorting[0].desc ? 'desc' : 'asc';
@@ -308,7 +319,11 @@ const ChatHistory: FC<PropsWithChildren<HistoryProps>> = ({
308
319
  page_size: data.pagination.pageSize,
309
320
  sorting: sortBy,
310
321
  search,
311
- });
322
+ },
323
+ {
324
+ signal: abortRef.current.signal
325
+ }
326
+ );
312
327
  },
313
328
  onSuccess: (res: any) => {
314
329
  if (selectedChat)
@@ -565,31 +580,51 @@ const ChatHistory: FC<PropsWithChildren<HistoryProps>> = ({
565
580
  </Tooltip>
566
581
  );
567
582
 
583
+ const updateChatTest = function (chatId: string, isTest: boolean) {
584
+ setFilteredEndedChatsList((prevChats) =>
585
+ prevChats.map((chat) => (chat.id === chatId ? ({ ...chat, istest: isTest } as ChatType) : chat))
586
+ );
587
+
588
+ if (selectedChat && selectedChat.id === chatId) {
589
+ setSelectedChat({
590
+ ...selectedChat,
591
+ istest: isTest,
592
+ } as ChatType);
593
+ }
594
+ };
595
+
568
596
  const markConversationAsTest = (props: any) => {
569
- return <>
570
- <FormCheckbox
571
- label={''}
572
- hideLabel
573
- emptyItem={true}
574
- name="active"
575
-
576
- item={{
577
- label: '',
578
- value: 'active',
579
- checked: props.getValue()
580
- }}
581
- onChange={(e) => {
582
- return chatTestChangeMutation.mutate({chatId: props.row.original.id, isTest: e.target.checked})
583
- }}
584
- />
585
- </>
586
- }
597
+ const chatId = props.row.original.id;
598
+ const newIsTestValue = props.getValue();
599
+ return (
600
+ <FormCheckbox
601
+ checked={newIsTestValue}
602
+ label={""}
603
+ hideLabel
604
+ emptyItem={true}
605
+ name="active"
606
+ item={{
607
+ label: "",
608
+ value: "active",
609
+ }}
610
+ onChange={(e) => {
611
+ const isTest = e.target.checked;
612
+ updateChatTest(chatId, isTest);
613
+ chatTestChangeMutation.mutate({ chatId, isTest });
614
+ }}
615
+ />
616
+ );
617
+ };
587
618
 
588
619
  const detailsView = (props: any) => (
589
620
  <Button
590
621
  appearance="text"
591
622
  onClick={() => {
592
623
  setSelectedChat(props.row.original);
624
+ setSearchParams((params) => {
625
+ params.set("chat", props.row.original.id);
626
+ return params;
627
+ });
593
628
  setChatState(props.row.original.lastMessageEvent);
594
629
  }}
595
630
  >
package/types/chat.ts CHANGED
@@ -87,6 +87,7 @@ export interface Chat {
87
87
  feedbackRating?: number;
88
88
  nps?: number;
89
89
  userDisplayName?: string;
90
+ istest?: boolean;
90
91
  }
91
92
  export interface GroupedChat {
92
93
  myChats: Chat[];
@@ -34,7 +34,7 @@
34
34
  padding: 12px 24px 12px 16px;
35
35
  border-bottom: 1px solid get-color(black-coral-2);
36
36
  vertical-align: middle;
37
- max-width: fit-content;
37
+ max-width: 300px;
38
38
 
39
39
  p{
40
40
  white-space: break-spaces;