@ibti-tech/chatbot 0.9.5 → 0.9.6

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/index.d.ts CHANGED
@@ -286,7 +286,7 @@ declare module '@ibti-tech/chatbot/components/MessageBalloon/index' {
286
286
  //# sourceMappingURL=index.d.ts.map
287
287
  }
288
288
  declare module '@ibti-tech/chatbot/components/MessageBalloon/index.d.ts' {
289
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../home/runner/work/ibti-chatbot/ibti-chatbot/src/components/MessageBalloon/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAsC,MAAM,OAAO,CAAA;AAE1D,OAAO,EAAE,YAAY,EAAE,MAAM,OAAO,CAAA;AAQpC,MAAM,MAAM,mBAAmB,GAAG;IAChC,IAAI,EAAE,YAAY,CAAC,WAAW,CAAA;IAC9B,cAAc,EAAE,MAAM,CAAA;CACvB,CAAA;AAOD,eAAO,MAAM,cAAc,GAAI,2BAG5B,mBAAmB,sBAiJrB,CAAA;AAED,eAAe,cAAc,CAAA"}
289
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../home/runner/work/ibti-chatbot/ibti-chatbot/src/components/MessageBalloon/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAsC,MAAM,OAAO,CAAA;AAE1D,OAAO,EAAE,YAAY,EAAE,MAAM,OAAO,CAAA;AAwBpC,MAAM,MAAM,mBAAmB,GAAG;IAChC,IAAI,EAAE,YAAY,CAAC,WAAW,CAAA;IAC9B,cAAc,EAAE,MAAM,CAAA;CACvB,CAAA;AAOD,eAAO,MAAM,cAAc,GAAI,2BAG5B,mBAAmB,sBAkKrB,CAAA;AAED,eAAe,cAAc,CAAA"}
290
290
  }
291
291
  declare module '@ibti-tech/chatbot/components/MessageBalloon/styles' {
292
292
  export const Time: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, {
package/dist/index.mjs CHANGED
@@ -1942,8 +1942,21 @@ var formatMessageTime = /* @__PURE__ */ __name((dateUTC, currentDateUTC, locale)
1942
1942
 
1943
1943
  // src/components/MessageBalloon/index.tsx
1944
1944
  import Markdown from "react-markdown";
1945
+ import remarkGfm from "remark-gfm";
1946
+ import rehypeRaw from "rehype-raw";
1947
+ import rehypeSanitize from "rehype-sanitize";
1945
1948
  import { CircleExclamationIcon } from "@ibti-tech/ui";
1946
1949
  import { Copy, Share2, RotateCw } from "lucide-react";
1950
+ function linkifyBareUrls(text) {
1951
+ return text.replace(
1952
+ /(?<!\]\()(https?:\/\/[^\s<>")\]]+)/gi,
1953
+ (url) => `[${url}](${url})`
1954
+ ).replace(
1955
+ /(?<!\]\()(www\.[^\s<>")\]]+)/gi,
1956
+ (url) => `[${url}](https://${url})`
1957
+ );
1958
+ }
1959
+ __name(linkifyBareUrls, "linkifyBareUrls");
1947
1960
  var messageTypes = {
1948
1961
  assistant: "received",
1949
1962
  user: "sent"
@@ -2008,7 +2021,26 @@ var MessageBalloon = /* @__PURE__ */ __name(({
2008
2021
  onMouseLeave: () => setIsHovered(false),
2009
2022
  $type: messageType
2010
2023
  },
2011
- /* @__PURE__ */ React7.createElement(BalloonContainer, { $type: messageType }, /* @__PURE__ */ React7.createElement(Balloon, { $type: messageType, $error: data.error }, data.error && /* @__PURE__ */ React7.createElement(CircleExclamationIcon, null), /* @__PURE__ */ React7.createElement(Markdown, null, data.content))),
2024
+ /* @__PURE__ */ React7.createElement(BalloonContainer, { $type: messageType }, /* @__PURE__ */ React7.createElement(Balloon, { $type: messageType, $error: data.error }, data.error && /* @__PURE__ */ React7.createElement(CircleExclamationIcon, null), /* @__PURE__ */ React7.createElement(
2025
+ Markdown,
2026
+ {
2027
+ remarkPlugins: [remarkGfm],
2028
+ rehypePlugins: [rehypeRaw, rehypeSanitize],
2029
+ components: {
2030
+ a: /* @__PURE__ */ __name(({ href, children, ...props }) => /* @__PURE__ */ React7.createElement(
2031
+ "a",
2032
+ {
2033
+ href,
2034
+ target: "_blank",
2035
+ rel: "noopener noreferrer",
2036
+ ...props
2037
+ },
2038
+ children
2039
+ ), "a")
2040
+ }
2041
+ },
2042
+ linkifyBareUrls(data.content)
2043
+ ))),
2012
2044
  /* @__PURE__ */ React7.createElement(TimestampAndActionsRow, { $type: messageType }, /* @__PURE__ */ React7.createElement(
2013
2045
  ActionsContainer,
2014
2046
  {
@@ -2799,7 +2831,7 @@ var Wrapper9 = styled10.div`
2799
2831
  // package.json
2800
2832
  var package_default = {
2801
2833
  name: "@ibti-tech/chatbot",
2802
- version: "0.9.5",
2834
+ version: "0.9.6",
2803
2835
  description: "Chatbot system developed to be embedded in any website",
2804
2836
  packageManager: "yarn@3.6.4",
2805
2837
  main: "./dist/index.mjs",
@@ -2839,6 +2871,9 @@ var package_default = {
2839
2871
  "lucide-react": "^0.263.1",
2840
2872
  polished: "^4.3.1",
2841
2873
  "react-markdown": "^9.0.1",
2874
+ "rehype-raw": "^7.0.0",
2875
+ "rehype-sanitize": "^6.0.0",
2876
+ "remark-gfm": "^4.0.0",
2842
2877
  uuid: "^9.0.1"
2843
2878
  },
2844
2879
  devDependencies: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ibti-tech/chatbot",
3
- "version": "0.9.5",
3
+ "version": "0.9.6",
4
4
  "description": "Chatbot system developed to be embedded in any website",
5
5
  "packageManager": "yarn@3.6.4",
6
6
  "main": "./dist/index.mjs",
@@ -40,6 +40,9 @@
40
40
  "lucide-react": "^0.263.1",
41
41
  "polished": "^4.3.1",
42
42
  "react-markdown": "^9.0.1",
43
+ "rehype-raw": "^7.0.0",
44
+ "rehype-sanitize": "^6.0.0",
45
+ "remark-gfm": "^4.0.0",
43
46
  "uuid": "^9.0.1"
44
47
  },
45
48
  "devDependencies": {