@buerokratt-ria/common-gui-components 0.0.36 → 0.0.38

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,14 @@ 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.38] - 20.01.2026
8
+
9
+ - Added isFiveRatingScale Handle
10
+
11
+ ## [0.0.37] - 19.01.2026
12
+
13
+ - Added Sanitization to Markdownify
14
+
7
15
  ## [0.0.36] - 14.01.2026
8
16
 
9
17
  - Hide $backoffice, $validate_ and $general_knowledge from end user
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@buerokratt-ria/common-gui-components",
3
- "version": "0.0.36",
3
+ "version": "0.0.38",
4
4
  "description": "Common GUI components and pre defined templates.",
5
5
  "main": "index.ts",
6
6
  "author": "ExiRai",
@@ -59,7 +59,9 @@
59
59
  "use-debounce": "^10.0.1",
60
60
  "usehooks-ts": "^2.9.1",
61
61
  "uuid": "^9.0.0",
62
- "zustand": "^4.4.4"
62
+ "zustand": "^4.4.4",
63
+ "sanitize-html": "^2.17.0",
64
+ "@types/sanitize-html": "^2.16.0"
63
65
  },
64
66
  "devDependencies": {
65
67
  "@buerokratt-ria/header": "^0.1.20",
@@ -118,6 +120,8 @@
118
120
  "@types/react": "^18.0.26",
119
121
  "@types/react-cookies": "^0.1.3",
120
122
  "@types/react-dom": "^18.0.9",
121
- "typescript": "^5.7.3"
123
+ "typescript": "^5.7.3",
124
+ "sanitize-html": "^2.17.0",
125
+ "@types/sanitize-html": "^2.16.0"
122
126
  }
123
127
  }
@@ -704,7 +704,7 @@ const ChatHistory: FC<PropsWithChildren<HistoryProps>> = ({
704
704
  header: t('chat.history.rating') ?? '',
705
705
  cell: (props) => {
706
706
  const value = props.getValue();
707
- return value !== null && value !== undefined ? <span>{`${value}/10`}</span> : null;
707
+ return value !== null && value !== undefined ? <span>{`${value}/${props.row.original?.isFiveRatingScale === 'true' ? 5 : 10}`}</span> : null;
708
708
  }
709
709
  }),
710
710
  columnHelper.accessor('feedbackText', {
@@ -887,6 +887,7 @@ const ChatHistory: FC<PropsWithChildren<HistoryProps>> = ({
887
887
  }
888
888
 
889
889
  let processedValue: any = rawValue;
890
+ const totalCheck = chat.isFiveRatingScale === 'true' ? 5 : 10;
890
891
  switch (col.id) {
891
892
  case 'created':
892
893
  case 'ended':
@@ -902,7 +903,7 @@ const ChatHistory: FC<PropsWithChildren<HistoryProps>> = ({
902
903
  processedValue = rawValue ? t('global.yes') : t('global.no');
903
904
  break;
904
905
  case 'feedbackRating':
905
- processedValue = rawValue != null ? `${rawValue}/10` : '';
906
+ processedValue = rawValue == null ? '' : `${rawValue}/${totalCheck}`;
906
907
  break;
907
908
  case 'status':
908
909
  processedValue =
package/types/chat.ts CHANGED
@@ -88,6 +88,7 @@ export interface Chat {
88
88
  nps?: number;
89
89
  userDisplayName?: string;
90
90
  istest?: boolean;
91
+ isFiveRatingScale?: string;
91
92
  }
92
93
  export interface GroupedChat {
93
94
  myChats: Chat[];
@@ -1,6 +1,6 @@
1
1
  import React, { useState } from "react";
2
2
  import Markdown from "markdown-to-jsx";
3
- import "./Chat.scss";
3
+ import sanitizeHtml from "sanitize-html";
4
4
 
5
5
  interface MarkdownifyProps {
6
6
  message: string | undefined;
@@ -44,9 +44,11 @@ const LinkPreview: React.FC<{
44
44
  const hasSpecialFormat = (m: string) => m.includes("\n\n") && m.indexOf(".") > 0 && m.indexOf(":") > m.indexOf(".");
45
45
 
46
46
  function formatMessage(message?: string): string {
47
- if (!message) return "";
47
+ const sanitizedMessage = sanitizeHtml(message ?? "");
48
48
 
49
- const filteredMessage = message
49
+ if (!sanitizedMessage) return "";
50
+
51
+ const filteredMessage = sanitizedMessage
50
52
  .replaceAll(/\\?\$b\w*/g, "")
51
53
  .replaceAll(/\\?\$v\w*/g, "")
52
54
  .replaceAll(/\\?\$g\w*/g, "");