@sendbird/ai-agent-messenger-react 1.38.0 → 1.39.1

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.
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("react"),h=require("markdown-to-jsx"),x=require("styled-components"),e=require("../index.cjs"),b=t=>t&&t.__esModule?t:{default:t};function u(t){if(t&&t.__esModule)return t;const r=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const i in t)if(i!=="default"){const n=Object.getOwnPropertyDescriptor(t,i);Object.defineProperty(r,i,n.get?n:{enumerable:!0,get:()=>t[i]})}}return r.default=t,Object.freeze(r)}const d=u(c),m=b(h),f=b(x),w=e.createMarkdownPreprocessor({convertSoftBreaks:!0}),y=new RegExp(`(${e.MARK_CHAR}+)`),k=(t,r,i,n)=>r.type===h.RuleType.text&&r.text.includes(e.MARK_CHAR)?d.createElement(c.Fragment,{key:n.key},r.text.split(y).map((o,p)=>o.startsWith(e.MARK_CHAR)?d.createElement("span",{key:p,id:e.ID_MARKED_TEXT,"aria-label":"masked-text"},o):o)):t(),_=({className:t,children:r,style:i,onClickImage:n,onClickLink:o})=>{const p=c.useCallback(l=>{const a=d.createElement("img",{...l,alt:l.alt||""}),s=l.src;return n&&s?d.createElement("button",{type:"button",onClick:()=>n(s),style:{border:"none",padding:0,background:"none",cursor:"pointer",display:"block",width:"100%"}},a):a},[]);return d.createElement(M,{className:t,style:i},d.createElement(m.default,{options:{renderRule:k,disableParsingRawHTML:!0,disableAutoLink:!0,overrides:{a:{component:({children:l,href:a,...s})=>d.createElement("a",{...s,href:a,target:"_blank",rel:e.ANCHOR_REL,onClick:g=>{g.preventDefault(),a&&(o==null||o({url:a}))}},l)},img:{component:p}}}},w(r)))},M=f.default.div`*{&:first-child{margin-top:0;}&:last-child{margin-bottom:0;}}hr{border-top:1px solid ${e.cssVars.themedColor.textDisabled};margin:21px 0;}h1{margin-top:0;margin-bottom:12.4px;padding:0;font-size:22.4px;line-height:27.6px;font-weight:700;letter-spacing:-0.6px;}h2{font-weight:600;margin:24px 0 12px;font-size:18.2px;line-height:22.3px;}& :where(h3 + *){margin-top:0;}h3,h4,h5,h6{font-weight:600;margin:16px 0 8px;font-size:15.4px;line-height:22.4px;}p{font-size:14px;line-height:20px;margin-bottom:8px;margin-top:0;&:not(:first-child){margin-top:8px;}}a{color:inherit;font-weight:700;text-decoration:underline;}code{white-space:pre-wrap;border-radius:0.25rem;font-size:0.875em;font-weight:500;padding:2.4px 4.8px;background-color:${e.cssVars.themedColor.textDisabled};}menu{list-style:none;}ul{list-style-type:disc;}ol{list-style-type:decimal;}ul,ol{padding-inline-start:16px;margin:8px 0;& > li{padding-inline-start:0;margin:8px 0;& > ul,& > ol{margin-top:8px;& > li{margin:4px 0;}}}}p + ul,p + ol{margin-top:0;}blockquote{line-height:20px;margin:0;padding:4.8px 0;margin-inline-start:8px;padding-inline-start:16px;box-sizing:border-box;position:relative;font-style:normal;font-weight:500;border-inline-start-width:4px;&::before{border-radius:100px;content:'';position:absolute;top:0;left:0;height:100%;width:4px;background-color:${e.cssVars.themedColor.textDisabled};}}input[type='checkbox']{vertical-align:middle;margin:0;}table{unicode-bidi:isolate;overflow-wrap:break-word;white-space:normal;display:block;overflow-x:scroll;max-width:100%;text-indent:0;border-collapse:separate;border-spacing:0;margin:4px 0;text-align:start;font-size:12.3px;table-layout:auto;width:100%;*,&:after,&:before{border:0 solid;box-sizing:border-box;}}th:first-child{border-start-start-radius:6px;padding-inline-start:10.5px;}th:last-child{border-inline-end-width:1px;border-start-end-radius:6px;padding-inline-end:10.5px;}th{border-inline-start-width:1px;background-color:rgba(0,0,0,0.1);border-bottom-width:1px;border-color:${e.cssVars.themedColor.textDisabled};border-top-width:1px;padding:4px 10.5px;text-align:start;}& :where(thead th:first-child){padding-inline-start:0;}& :where(thead th:last-child){padding-inline-end:0;}& :where(thead th){padding-bottom:8px;padding-inline:8px;vertical-align:bottom;}& :where(tbody tr){border-bottom-width:1px;}& :where(tbody tr:last-child){border-bottom-width:0;}td:first-child{padding-inline-start:10.5px;}td:last-child{border-inline-end-width:1px;padding-inline-end:10.5px;}& :where(tbody td:first-child,tfoot td:first-child){padding-inline-start:0;}& :where(tbody td:last-child,tfoot td:last-child){padding-inline-end:0;}td{border-inline-start-width:1px;border-bottom-width:1px;border-color:${e.cssVars.themedColor.textDisabled};padding:4px 10.5px;text-align:start;}& :where(tbody td,tfoot td){padding:8px;}& :where(tbody td){vertical-align:baseline;}tbody tr:last-child td:first-child{border-end-start-radius:6px;}tbody tr:last-child td:last-child{border-end-end-radius:6px;}img{display:block;width:100%;height:auto;}`;exports.MarkdownText=_;
@@ -1,58 +1,62 @@
1
1
  import * as e from "react";
2
- import { useCallback as x } from "react";
3
- import g from "dompurify";
4
- import b, { RuleType as c } from "markdown-to-jsx";
5
- import m from "styled-components";
6
- import { A as w, e as f, c as o } from "../index.js";
7
- const u = (a, n, l, i) => n.type === c.textStrikethroughed ? /* @__PURE__ */ e.createElement("span", { key: i.key }, `~~${l(n.children, i)}~~`) : a(), C = ({ className: a, children: n, style: l, onClickImage: i, onClickLink: p }) => {
8
- const s = x((r) => {
9
- const t = /* @__PURE__ */ e.createElement("img", { ...r, alt: r.alt || "" }), d = r.src;
10
- return i && d ? /* @__PURE__ */ e.createElement(
2
+ import { useCallback as b, Fragment as c } from "react";
3
+ import g, { RuleType as m } from "markdown-to-jsx";
4
+ import w from "styled-components";
5
+ import { A as u, c as n, M as s, I as f, a as y } from "../index.js";
6
+ const k = y({ convertSoftBreaks: !0 }), E = new RegExp(`(${s}+)`), R = (l, r, h, d) => r.type === m.text && r.text.includes(s) ? /* @__PURE__ */ e.createElement(c, { key: d.key }, r.text.split(E).map(
7
+ (t, p) => t.startsWith(s) ? /* @__PURE__ */ e.createElement("span", { key: p, id: f, "aria-label": "masked-text" }, t) : t
8
+ )) : l(), A = ({ className: l, children: r, style: h, onClickImage: d, onClickLink: t }) => {
9
+ const p = b((o) => {
10
+ const i = /* @__PURE__ */ e.createElement("img", { ...o, alt: o.alt || "" }), a = o.src;
11
+ return d && a ? /* @__PURE__ */ e.createElement(
11
12
  "button",
12
13
  {
13
14
  type: "button",
14
- onClick: () => i(d),
15
+ onClick: () => d(a),
15
16
  style: {
16
17
  border: "none",
17
18
  padding: 0,
18
19
  background: "none",
19
20
  cursor: "pointer",
20
- display: "inline-block"
21
+ display: "block",
22
+ width: "100%"
21
23
  }
22
24
  },
23
- t
24
- ) : t;
25
+ i
26
+ ) : i;
25
27
  }, []);
26
- return /* @__PURE__ */ e.createElement(y, { className: a, style: l }, /* @__PURE__ */ e.createElement(
27
- b,
28
+ return /* @__PURE__ */ e.createElement(v, { className: l, style: h }, /* @__PURE__ */ e.createElement(
29
+ g,
28
30
  {
29
31
  options: {
30
- renderRule: u,
32
+ renderRule: R,
33
+ disableParsingRawHTML: !0,
34
+ disableAutoLink: !0,
31
35
  overrides: {
32
36
  a: {
33
- component: ({ children: r, href: t, ...d }) => /* @__PURE__ */ e.createElement(
37
+ component: ({ children: o, href: i, ...a }) => /* @__PURE__ */ e.createElement(
34
38
  "a",
35
39
  {
36
- ...d,
37
- href: t,
40
+ ...a,
41
+ href: i,
38
42
  target: "_blank",
39
- rel: w,
40
- onClick: (h) => {
41
- h.preventDefault(), t && (p == null || p({ url: t }));
43
+ rel: u,
44
+ onClick: (x) => {
45
+ x.preventDefault(), i && (t == null || t({ url: i }));
42
46
  }
43
47
  },
44
- r
48
+ o
45
49
  )
46
50
  },
47
51
  img: {
48
- component: s
52
+ component: p
49
53
  }
50
54
  }
51
55
  }
52
56
  },
53
- g.sanitize(f(n))
57
+ k(r)
54
58
  ));
55
- }, y = m.div`*{&:first-child{margin-top:0;}&:last-child{margin-bottom:0;}}hr{border-top:1px solid ${o.themedColor.textDisabled};margin:21px 0;}h1{margin-top:0;margin-bottom:12.4px;padding:0;font-size:22.4px;line-height:27.6px;font-weight:700;letter-spacing:-0.6px;}h2{font-weight:600;margin:24px 0 12px;font-size:18.2px;line-height:22.3px;}& :where(h3 + *){margin-top:0;}h3,h4,h5,h6{font-weight:600;margin:16px 0 8px;font-size:15.4px;line-height:22.4px;}p{font-size:14px;line-height:20px;margin-bottom:8px;margin-top:0;&:not(:first-child){margin-top:8px;}}a{color:inherit;font-weight:700;text-decoration:underline;}code{white-space:pre-wrap;border-radius:0.25rem;font-size:0.875em;font-weight:500;padding:2.4px 4.8px;background-color:${o.themedColor.textDisabled};}menu{list-style:none;}ul{list-style-type:disc;}ol{list-style-type:decimal;}ul,ol{padding-inline-start:16px;margin:8px 0;& > li{padding-inline-start:0;margin:8px 0;& > ul,& > ol{margin-top:8px;& > li{margin:4px 0;}}}}p + ul,p + ol{margin-top:0;}blockquote{line-height:20px;margin:0;padding:4.8px 0;margin-inline-start:8px;padding-inline-start:16px;box-sizing:border-box;position:relative;font-style:normal;font-weight:500;border-inline-start-width:4px;&::before{border-radius:100px;content:'';position:absolute;top:0;left:0;height:100%;width:4px;background-color:${o.themedColor.textDisabled};}}input[type='checkbox']{vertical-align:middle;margin:0;}table{unicode-bidi:isolate;overflow-wrap:break-word;white-space:normal;display:block;overflow-x:scroll;max-width:100%;text-indent:0;border-collapse:separate;border-spacing:0;margin:4px 0;text-align:start;font-size:12.3px;table-layout:auto;width:100%;*,&:after,&:before{border:0 solid;box-sizing:border-box;}}th:first-child{border-start-start-radius:6px;padding-inline-start:10.5px;}th:last-child{border-inline-end-width:1px;border-start-end-radius:6px;padding-inline-end:10.5px;}th{border-inline-start-width:1px;background-color:rgba(0,0,0,0.1);border-bottom-width:1px;border-color:${o.themedColor.textDisabled};border-top-width:1px;padding:4px 10.5px;text-align:start;}& :where(thead th:first-child){padding-inline-start:0;}& :where(thead th:last-child){padding-inline-end:0;}& :where(thead th){padding-bottom:8px;padding-inline:8px;vertical-align:bottom;}& :where(tbody tr){border-bottom-width:1px;}& :where(tbody tr:last-child){border-bottom-width:0;}td:first-child{padding-inline-start:10.5px;}td:last-child{border-inline-end-width:1px;padding-inline-end:10.5px;}& :where(tbody td:first-child,tfoot td:first-child){padding-inline-start:0;}& :where(tbody td:last-child,tfoot td:last-child){padding-inline-end:0;}td{border-inline-start-width:1px;border-bottom-width:1px;border-color:${o.themedColor.textDisabled};padding:4px 10.5px;text-align:start;}& :where(tbody td,tfoot td){padding:8px;}& :where(tbody td){vertical-align:baseline;}tbody tr:last-child td:first-child{border-end-start-radius:6px;}tbody tr:last-child td:last-child{border-end-end-radius:6px;}img{max-width:100%;height:auto;}`;
59
+ }, v = w.div`*{&:first-child{margin-top:0;}&:last-child{margin-bottom:0;}}hr{border-top:1px solid ${n.themedColor.textDisabled};margin:21px 0;}h1{margin-top:0;margin-bottom:12.4px;padding:0;font-size:22.4px;line-height:27.6px;font-weight:700;letter-spacing:-0.6px;}h2{font-weight:600;margin:24px 0 12px;font-size:18.2px;line-height:22.3px;}& :where(h3 + *){margin-top:0;}h3,h4,h5,h6{font-weight:600;margin:16px 0 8px;font-size:15.4px;line-height:22.4px;}p{font-size:14px;line-height:20px;margin-bottom:8px;margin-top:0;&:not(:first-child){margin-top:8px;}}a{color:inherit;font-weight:700;text-decoration:underline;}code{white-space:pre-wrap;border-radius:0.25rem;font-size:0.875em;font-weight:500;padding:2.4px 4.8px;background-color:${n.themedColor.textDisabled};}menu{list-style:none;}ul{list-style-type:disc;}ol{list-style-type:decimal;}ul,ol{padding-inline-start:16px;margin:8px 0;& > li{padding-inline-start:0;margin:8px 0;& > ul,& > ol{margin-top:8px;& > li{margin:4px 0;}}}}p + ul,p + ol{margin-top:0;}blockquote{line-height:20px;margin:0;padding:4.8px 0;margin-inline-start:8px;padding-inline-start:16px;box-sizing:border-box;position:relative;font-style:normal;font-weight:500;border-inline-start-width:4px;&::before{border-radius:100px;content:'';position:absolute;top:0;left:0;height:100%;width:4px;background-color:${n.themedColor.textDisabled};}}input[type='checkbox']{vertical-align:middle;margin:0;}table{unicode-bidi:isolate;overflow-wrap:break-word;white-space:normal;display:block;overflow-x:scroll;max-width:100%;text-indent:0;border-collapse:separate;border-spacing:0;margin:4px 0;text-align:start;font-size:12.3px;table-layout:auto;width:100%;*,&:after,&:before{border:0 solid;box-sizing:border-box;}}th:first-child{border-start-start-radius:6px;padding-inline-start:10.5px;}th:last-child{border-inline-end-width:1px;border-start-end-radius:6px;padding-inline-end:10.5px;}th{border-inline-start-width:1px;background-color:rgba(0,0,0,0.1);border-bottom-width:1px;border-color:${n.themedColor.textDisabled};border-top-width:1px;padding:4px 10.5px;text-align:start;}& :where(thead th:first-child){padding-inline-start:0;}& :where(thead th:last-child){padding-inline-end:0;}& :where(thead th){padding-bottom:8px;padding-inline:8px;vertical-align:bottom;}& :where(tbody tr){border-bottom-width:1px;}& :where(tbody tr:last-child){border-bottom-width:0;}td:first-child{padding-inline-start:10.5px;}td:last-child{border-inline-end-width:1px;padding-inline-end:10.5px;}& :where(tbody td:first-child,tfoot td:first-child){padding-inline-start:0;}& :where(tbody td:last-child,tfoot td:last-child){padding-inline-end:0;}td{border-inline-start-width:1px;border-bottom-width:1px;border-color:${n.themedColor.textDisabled};padding:4px 10.5px;text-align:start;}& :where(tbody td,tfoot td){padding:8px;}& :where(tbody td){vertical-align:baseline;}tbody tr:last-child td:first-child{border-end-start-radius:6px;}tbody tr:last-child td:last-child{border-end-end-radius:6px;}img{display:block;width:100%;height:auto;}`;
56
60
  export {
57
- C as MarkdownText
61
+ A as MarkdownText
58
62
  };
@@ -3,7 +3,7 @@ import { useState as A } from "react";
3
3
  import _ from "styled-components";
4
4
  import { MessageProvider as I, renderer as R, parser as C } from "@sendbird/react-uikit-message-template-view";
5
5
  import { createMessageTemplate as O } from "@sendbird/uikit-message-template";
6
- import { r as M, f as K, a as S, p as N, b as v, d as y, u as h, g as B, I as G, n as J } from "../index.js";
6
+ import { r as M, f as K, b as S, p as N, d as v, e as y, u as h, g as B, h as G, n as J } from "../index.js";
7
7
  const w = {
8
8
  VARIABLE: (e) => new RegExp(`\\{${e}\\}`, "g"),
9
9
  VIEW_VARIABLE: (e) => new RegExp(`"{@${e}}"`, "g")