reachat 1.0.2 → 1.0.3

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.
@@ -1,5 +1,5 @@
1
1
  import { FC, ReactNode } from 'react';
2
- import { GroupedSessions } from '../utils';
2
+ import { GroupedSessions } from '../utils/grouping';
3
3
 
4
4
  export interface SessionGroupsProps {
5
5
  /**
package/dist/index.js CHANGED
@@ -10,7 +10,6 @@ import { Prism } from "react-syntax-highlighter";
10
10
  import { findAndReplace } from "mdast-util-find-and-replace";
11
11
  import remarkYoutube from "remark-youtube";
12
12
  import { useHotkeys } from "reakeys";
13
- import useDimensions from "react-cool-dimensions";
14
13
  import { isToday, isYesterday, isThisWeek, isThisMonth, isThisYear, format } from "date-fns";
15
14
  const SvgSend = (props) => /* @__PURE__ */ React.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", width: 24, height: 24, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: 1, strokeLinecap: "round", strokeLinejoin: "round", className: "lucide lucide-send-horizontal", ...props }, /* @__PURE__ */ React.createElement("path", { d: "m3 3 3 9-3 9 19-9Z" }), /* @__PURE__ */ React.createElement("path", { d: "M6 12h16" }));
16
15
  const SvgStop = (props) => /* @__PURE__ */ React.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", width: 24, height: 24, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: 1, strokeLinecap: "round", strokeLinejoin: "round", className: "lucide lucide-octagon-x", ...props }, /* @__PURE__ */ React.createElement("path", { d: "m15 9-6 6" }), /* @__PURE__ */ React.createElement("path", { d: "M2.586 16.726A2 2 0 0 1 2 15.312V8.688a2 2 0 0 1 .586-1.414l4.688-4.688A2 2 0 0 1 8.688 2h6.624a2 2 0 0 1 1.414.586l4.688 4.688A2 2 0 0 1 22 8.688v6.624a2 2 0 0 1-.586 1.414l-4.688 4.688a2 2 0 0 1-1.414.586H8.688a2 2 0 0 1-1.414-.586z" }), /* @__PURE__ */ React.createElement("path", { d: "m9 9 6 6" }));
@@ -1630,6 +1629,26 @@ const chatTheme = {
1630
1629
  stop: "px-4 py-2 bg-red-500 text-white rounded hover:bg-red-700"
1631
1630
  }
1632
1631
  };
1632
+ const useDimensions = () => {
1633
+ const [ref, setRef] = useState(null);
1634
+ const [width, setWidth] = useState(void 0);
1635
+ const observe = useCallback((element) => {
1636
+ if (element) setRef(element);
1637
+ }, []);
1638
+ useEffect(() => {
1639
+ if (!ref) return;
1640
+ const resizeObserver = new ResizeObserver((entries) => {
1641
+ for (let entry of entries) {
1642
+ setWidth(entry.contentRect.width);
1643
+ }
1644
+ });
1645
+ resizeObserver.observe(ref);
1646
+ return () => {
1647
+ resizeObserver.disconnect();
1648
+ };
1649
+ }, [ref]);
1650
+ return { width, observe };
1651
+ };
1633
1652
  const Chat = ({
1634
1653
  children,
1635
1654
  viewType = "console",