@banbox/chat 1.0.3 → 1.0.5
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.cjs +214 -192
- package/dist/index.cjs.map +1 -1
- package/dist/index.css +2273 -0
- package/dist/index.d.cts +20 -14
- package/dist/index.d.ts +20 -14
- package/dist/index.js +212 -190
- package/dist/index.js.map +1 -1
- package/package.json +9 -3
- package/src/chat/ChatRoot.tsx +15 -10
- package/src/chat/InboxPopup.tsx +97 -75
- package/src/chat/SinglePopup.tsx +40 -29
- package/src/index.ts +3 -0
- package/src/styles/index.css +231 -0
- package/src/ui/chat/ChatHeader.tsx +21 -24
- package/src/ui/chat/ChatListHeader.tsx +128 -156
- package/src/ui/chat/ChatScroll.tsx +52 -64
- package/src/ui/chat/TypingIndicator.tsx +10 -21
package/dist/index.cjs
CHANGED
|
@@ -4,14 +4,14 @@ var framerMotion = require('framer-motion');
|
|
|
4
4
|
var reactDom = require('react-dom');
|
|
5
5
|
var React10 = require('react');
|
|
6
6
|
var jsxRuntime = require('react/jsx-runtime');
|
|
7
|
-
var
|
|
7
|
+
var clsx16 = require('clsx');
|
|
8
8
|
var tailwindMerge = require('tailwind-merge');
|
|
9
9
|
var _Lottie = require('lottie-react');
|
|
10
10
|
|
|
11
11
|
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
12
12
|
|
|
13
13
|
var React10__default = /*#__PURE__*/_interopDefault(React10);
|
|
14
|
-
var
|
|
14
|
+
var clsx16__default = /*#__PURE__*/_interopDefault(clsx16);
|
|
15
15
|
var _Lottie__default = /*#__PURE__*/_interopDefault(_Lottie);
|
|
16
16
|
|
|
17
17
|
// src/chat/ChatRoot.tsx
|
|
@@ -107,7 +107,7 @@ var GalleryProvider = ({ children }) => {
|
|
|
107
107
|
return /* @__PURE__ */ jsxRuntime.jsx(GalleryContext.Provider, { value, children });
|
|
108
108
|
};
|
|
109
109
|
function cn(...inputs) {
|
|
110
|
-
return tailwindMerge.twMerge(
|
|
110
|
+
return tailwindMerge.twMerge(clsx16.clsx(inputs));
|
|
111
111
|
}
|
|
112
112
|
var sizeClasses = {
|
|
113
113
|
"26": "h-[26px] px-[10px] text-[12px] rounded-[4px] gap-1",
|
|
@@ -465,7 +465,7 @@ var ChatTranslateSettingsModal = ({
|
|
|
465
465
|
const content = /* @__PURE__ */ jsxRuntime.jsxs(
|
|
466
466
|
"div",
|
|
467
467
|
{
|
|
468
|
-
className:
|
|
468
|
+
className: clsx16__default.default(
|
|
469
469
|
isSingle ? "fixed inset-0 z-9999 flex" : "absolute inset-0 z-50 flex items-center justify-center"
|
|
470
470
|
),
|
|
471
471
|
onClick: () => onClose(),
|
|
@@ -478,7 +478,7 @@ var ChatTranslateSettingsModal = ({
|
|
|
478
478
|
"aria-modal": "true",
|
|
479
479
|
"aria-labelledby": "translate-settings-title",
|
|
480
480
|
onClick: (e) => e.stopPropagation(),
|
|
481
|
-
className:
|
|
481
|
+
className: clsx16__default.default(
|
|
482
482
|
isSingle ? "fixed bottom-6 right-6 w-[500px] max-w-[95vw]" : "relative w-[500px] max-w-[95vw]",
|
|
483
483
|
"z-10000 overflow-visible rounded-md bg-white shadow-[0_12px_30px_rgba(0,0,0,0.18)]",
|
|
484
484
|
className
|
|
@@ -561,7 +561,7 @@ var extColor = (ext) => {
|
|
|
561
561
|
var FilePreviewChip = ({ name, sizeMB, ext, onRemove }) => /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "mr-2 inline-flex items-center gap-3 whitespace-nowrap rounded-sm border border-[#e1e1e1] bg-white px-3 py-2 h-[65px] max-w-[185px]", children: [
|
|
562
562
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex min-w-0 items-center gap-2", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "min-w-0", children: [
|
|
563
563
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-1", children: [
|
|
564
|
-
/* @__PURE__ */ jsxRuntime.jsx(FileIcon, { className:
|
|
564
|
+
/* @__PURE__ */ jsxRuntime.jsx(FileIcon, { className: clsx16__default.default("h-[18px] w-[18px]", extColor(ext)) }),
|
|
565
565
|
" ",
|
|
566
566
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "truncate text-sm font-normal text-black", children: name })
|
|
567
567
|
] }),
|
|
@@ -712,7 +712,7 @@ var ChatComposerBar = ({
|
|
|
712
712
|
{
|
|
713
713
|
type: "button",
|
|
714
714
|
onClick: sendText,
|
|
715
|
-
className:
|
|
715
|
+
className: clsx16__default.default(
|
|
716
716
|
"ms-1 grid h-[40px] w-[40px] place-items-center rounded-full text-[#ff5301] hover:bg-[#f8f8f8]"
|
|
717
717
|
),
|
|
718
718
|
title: hasAttachments ? "Send attachments" : "Send",
|
|
@@ -728,7 +728,7 @@ var ChatComposerBar = ({
|
|
|
728
728
|
type: "button",
|
|
729
729
|
onClick: sendAttachments,
|
|
730
730
|
disabled: !hasAttachments,
|
|
731
|
-
className:
|
|
731
|
+
className: clsx16__default.default(
|
|
732
732
|
"ms-1 grid h-[40px] w-[40px] place-items-center rounded-full hover:bg-[#f8f8f8]",
|
|
733
733
|
hasAttachments ? "text-[#ff5301]" : "text-[#B9C3D4]"
|
|
734
734
|
),
|
|
@@ -753,7 +753,7 @@ var ChatComposerBar = ({
|
|
|
753
753
|
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
754
754
|
RecordMicIcon,
|
|
755
755
|
{
|
|
756
|
-
className:
|
|
756
|
+
className: clsx16__default.default(
|
|
757
757
|
"h-6 w-6",
|
|
758
758
|
seconds % 2 === 0 ? "text-[#929292]" : "text-[#ff5301]"
|
|
759
759
|
)
|
|
@@ -1050,7 +1050,7 @@ var EmojiDropup = ({ open, onClose, onSelect, anchorRef, className }) => {
|
|
|
1050
1050
|
ref: panelRef,
|
|
1051
1051
|
role: "dialog",
|
|
1052
1052
|
"aria-label": "Emoji picker",
|
|
1053
|
-
className:
|
|
1053
|
+
className: clsx16__default.default("emoji-dropup", className),
|
|
1054
1054
|
style: {
|
|
1055
1055
|
zIndex: "9999",
|
|
1056
1056
|
width: WIDTH2,
|
|
@@ -1194,7 +1194,7 @@ var ReplyCard = ({ refMsg, onClose, compact, className, jumpOnClick }) => {
|
|
|
1194
1194
|
"div",
|
|
1195
1195
|
{
|
|
1196
1196
|
onClick: clickToJump,
|
|
1197
|
-
className:
|
|
1197
|
+
className: clsx16__default.default(
|
|
1198
1198
|
widthClamp,
|
|
1199
1199
|
"relative rounded-md bg-[#f8f8f8] px-3",
|
|
1200
1200
|
"border-l-2 border-[#FF5300]",
|
|
@@ -1513,7 +1513,7 @@ var ChatFooter = ({
|
|
|
1513
1513
|
}
|
|
1514
1514
|
setSeconds(0);
|
|
1515
1515
|
};
|
|
1516
|
-
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className:
|
|
1516
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: clsx16__default.default("border-t border-[#ededed] bg-white p-3.5", className), children: [
|
|
1517
1517
|
replyTo && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "mb-2", children: /* @__PURE__ */ jsxRuntime.jsx(ReplyCard_default, { refMsg: replyTo, onClose: clearReply }) }),
|
|
1518
1518
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1519
1519
|
AttachmentPreviewStrip_default,
|
|
@@ -1613,10 +1613,10 @@ var ChatFooter = ({
|
|
|
1613
1613
|
var ChatFooter_default = ChatFooter;
|
|
1614
1614
|
function ChatHeader({ left, right, below, className }) {
|
|
1615
1615
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
1616
|
-
/* @__PURE__ */ jsxRuntime.
|
|
1616
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: `border-b border-[#e1e1e1] h-[64px] flex items-start justify-between px-4 pt-2.5${className ? ` ${className}` : ""}`, children: [
|
|
1617
1617
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex items-start gap-3", children: left }),
|
|
1618
1618
|
right
|
|
1619
|
-
] })
|
|
1619
|
+
] }),
|
|
1620
1620
|
below && /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: below })
|
|
1621
1621
|
] });
|
|
1622
1622
|
}
|
|
@@ -1634,11 +1634,11 @@ var ChatIdentity = (props) => {
|
|
|
1634
1634
|
size = 46,
|
|
1635
1635
|
className
|
|
1636
1636
|
} = props;
|
|
1637
|
-
const subtitleClass =
|
|
1637
|
+
const subtitleClass = clsx16__default.default(
|
|
1638
1638
|
"text-[10px] font-medium",
|
|
1639
1639
|
subtitleVariant === "live" ? "text-[#1E9E6A]" : "text-[#929292]"
|
|
1640
1640
|
);
|
|
1641
|
-
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className:
|
|
1641
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: clsx16__default.default("flex items-start gap-3", className), children: [
|
|
1642
1642
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "relative", style: { width: size, height: size }, children: [
|
|
1643
1643
|
props.variant === "avatar" && /* @__PURE__ */ jsxRuntime.jsx(
|
|
1644
1644
|
"img",
|
|
@@ -1651,7 +1651,7 @@ var ChatIdentity = (props) => {
|
|
|
1651
1651
|
props.variant === "initial" && /* @__PURE__ */ jsxRuntime.jsx(
|
|
1652
1652
|
"div",
|
|
1653
1653
|
{
|
|
1654
|
-
className:
|
|
1654
|
+
className: clsx16__default.default(
|
|
1655
1655
|
"grid h-full w-full place-items-center rounded-xs text-[15px] font-semibold text-[#2c2c2c]",
|
|
1656
1656
|
props.textClassName
|
|
1657
1657
|
),
|
|
@@ -1726,7 +1726,7 @@ var ChatInquiryBar = ({ id, onView, className, label, buttonLabel }) => {
|
|
|
1726
1726
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1727
1727
|
"div",
|
|
1728
1728
|
{
|
|
1729
|
-
className:
|
|
1729
|
+
className: clsx16__default.default(
|
|
1730
1730
|
"flex items-center justify-between border-b border-[#ededed] bg-[#f8f8f8] ps-[16px] pe-[30px] h-[30px]",
|
|
1731
1731
|
className
|
|
1732
1732
|
),
|
|
@@ -1772,9 +1772,7 @@ var ChatListHeader = ({ className, onClose, onSearchChange }) => {
|
|
|
1772
1772
|
};
|
|
1773
1773
|
}, [searching]);
|
|
1774
1774
|
React10__default.default.useEffect(() => {
|
|
1775
|
-
if (!searching)
|
|
1776
|
-
return;
|
|
1777
|
-
}
|
|
1775
|
+
if (!searching) return;
|
|
1778
1776
|
const onKey = (e) => {
|
|
1779
1777
|
if (e.key === "Escape") {
|
|
1780
1778
|
setSearching(false);
|
|
@@ -1793,90 +1791,84 @@ var ChatListHeader = ({ className, onClose, onSearchChange }) => {
|
|
|
1793
1791
|
inFromLeft: { opacity: 1, x: 0, transition: { duration: 0.18, ease: [0.16, 1, 0.3, 1] } },
|
|
1794
1792
|
outToRight: { opacity: 0, x: 24, transition: { duration: 0.16, ease: [0.4, 0, 1, 1] } }
|
|
1795
1793
|
};
|
|
1796
|
-
return /* @__PURE__ */ jsxRuntime.jsx("div", { className:
|
|
1797
|
-
|
|
1798
|
-
|
|
1799
|
-
|
|
1800
|
-
{
|
|
1801
|
-
|
|
1802
|
-
|
|
1803
|
-
|
|
1804
|
-
|
|
1805
|
-
|
|
1806
|
-
|
|
1807
|
-
/* @__PURE__ */ jsxRuntime.jsx("
|
|
1808
|
-
|
|
1809
|
-
|
|
1810
|
-
|
|
1811
|
-
|
|
1812
|
-
|
|
1813
|
-
"
|
|
1814
|
-
|
|
1815
|
-
|
|
1816
|
-
|
|
1817
|
-
|
|
1818
|
-
|
|
1819
|
-
|
|
1820
|
-
),
|
|
1821
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1822
|
-
"button",
|
|
1823
|
-
{
|
|
1824
|
-
title: "Close",
|
|
1825
|
-
onClick: onClose,
|
|
1826
|
-
className: "h-9 w-9 place-items-center rounded-full hover:bg-black/5 flex items-center justify-center",
|
|
1827
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(ChatXIcon, { className: "w-6 h-6" })
|
|
1828
|
-
}
|
|
1829
|
-
)
|
|
1830
|
-
] })
|
|
1831
|
-
]
|
|
1832
|
-
},
|
|
1833
|
-
"normal"
|
|
1834
|
-
)
|
|
1835
|
-
) : (
|
|
1836
|
-
// SEARCH — enters from right, exits to right
|
|
1837
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1838
|
-
framerMotion.motion.div,
|
|
1839
|
-
{
|
|
1840
|
-
className: "flex w-full items-center gap-3",
|
|
1841
|
-
initial: { opacity: 0, x: 24 },
|
|
1842
|
-
animate: "inFromRight",
|
|
1843
|
-
exit: "outToRight",
|
|
1844
|
-
variants,
|
|
1845
|
-
children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "relative flex-1", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex h-10 w-full items-center rounded-full border border-[#6A6A6A] bg-white px-[4px] gap-1.5", children: [
|
|
1846
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center ms-[12px] w-full", children: [
|
|
1847
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "mr-2 grid h-6 w-6 shrink-0 place-items-center text-[#929292]", children: /* @__PURE__ */ jsxRuntime.jsx(ChatSearchIcon, { className: "w-5 h-5" }) }),
|
|
1848
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "mr-2 h-6 w-px shrink-0 bg-[#e1e1e1]" }),
|
|
1849
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1850
|
-
"input",
|
|
1851
|
-
{
|
|
1852
|
-
ref: inputRef,
|
|
1853
|
-
value: q,
|
|
1854
|
-
onChange: (e) => {
|
|
1855
|
-
setQ(e.target.value);
|
|
1856
|
-
onSearchChange?.(e.target.value);
|
|
1857
|
-
},
|
|
1858
|
-
placeholder: "Search",
|
|
1859
|
-
className: "h-full w-full flex-1 bg-transparent text-[15px] outline-none placeholder:text-[#9C9C9C]"
|
|
1860
|
-
}
|
|
1861
|
-
)
|
|
1862
|
-
] }),
|
|
1863
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1794
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: `h-[64px] border-b border-[#ededed]${className ? ` ${className}` : ""}`, children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex h-full items-center px-[20px]", children: /* @__PURE__ */ jsxRuntime.jsx(framerMotion.AnimatePresence, { initial: false, mode: "wait", children: !searching ? /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1795
|
+
framerMotion.motion.div,
|
|
1796
|
+
{
|
|
1797
|
+
className: "flex w-full items-center justify-between",
|
|
1798
|
+
initial: { opacity: 0, x: -24 },
|
|
1799
|
+
animate: "inFromLeft",
|
|
1800
|
+
exit: "outToLeft",
|
|
1801
|
+
variants,
|
|
1802
|
+
children: [
|
|
1803
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex items-center gap-3", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "text-[#2c2c2c] flex items-center gap-2", children: [
|
|
1804
|
+
/* @__PURE__ */ jsxRuntime.jsx(MessageIcon, { className: "w-6 h-6" }),
|
|
1805
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-[22px] font-semibold", children: "Messenger" })
|
|
1806
|
+
] }) }),
|
|
1807
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2", children: [
|
|
1808
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1809
|
+
"button",
|
|
1810
|
+
{
|
|
1811
|
+
title: "Search",
|
|
1812
|
+
onClick: () => setSearching(true),
|
|
1813
|
+
className: "h-9 w-9 place-items-center rounded-full hover:bg-black/5 flex items-center justify-center cursor-pointer border-none bg-transparent",
|
|
1814
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(ChatSearchIcon, { className: "w-5 h-5" })
|
|
1815
|
+
}
|
|
1816
|
+
),
|
|
1817
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1864
1818
|
"button",
|
|
1865
1819
|
{
|
|
1866
|
-
title: "Close
|
|
1867
|
-
onClick:
|
|
1868
|
-
|
|
1869
|
-
|
|
1870
|
-
|
|
1820
|
+
title: "Close",
|
|
1821
|
+
onClick: onClose,
|
|
1822
|
+
className: "h-9 w-9 place-items-center rounded-full hover:bg-black/5 flex items-center justify-center cursor-pointer border-none bg-transparent",
|
|
1823
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(ChatXIcon, { className: "w-6 h-6" })
|
|
1824
|
+
}
|
|
1825
|
+
)
|
|
1826
|
+
] })
|
|
1827
|
+
]
|
|
1828
|
+
},
|
|
1829
|
+
"normal"
|
|
1830
|
+
) : /* @__PURE__ */ jsxRuntime.jsx(
|
|
1831
|
+
framerMotion.motion.div,
|
|
1832
|
+
{
|
|
1833
|
+
className: "flex w-full items-center gap-3",
|
|
1834
|
+
initial: { opacity: 0, x: 24 },
|
|
1835
|
+
animate: "inFromRight",
|
|
1836
|
+
exit: "outToRight",
|
|
1837
|
+
variants,
|
|
1838
|
+
children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "relative flex-1", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex h-10 w-full items-center rounded-full border border-[#6A6A6A] bg-white px-[4px] gap-1.5", children: [
|
|
1839
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center ms-[12px] w-full", children: [
|
|
1840
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "mr-2 grid h-6 w-6 shrink-0 place-items-center text-[#929292]", children: /* @__PURE__ */ jsxRuntime.jsx(ChatSearchIcon, { className: "w-5 h-5" }) }),
|
|
1841
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "mr-2 h-6 w-px shrink-0 bg-[#e1e1e1]" }),
|
|
1842
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1843
|
+
"input",
|
|
1844
|
+
{
|
|
1845
|
+
ref: inputRef,
|
|
1846
|
+
value: q,
|
|
1847
|
+
onChange: (e) => {
|
|
1848
|
+
setQ(e.target.value);
|
|
1849
|
+
onSearchChange?.(e.target.value);
|
|
1871
1850
|
},
|
|
1872
|
-
|
|
1873
|
-
|
|
1851
|
+
placeholder: "Search",
|
|
1852
|
+
className: "h-full w-full flex-1 bg-transparent text-[15px] outline-none placeholder:text-[#9C9C9C] border-none"
|
|
1874
1853
|
}
|
|
1875
|
-
)
|
|
1876
|
-
] })
|
|
1877
|
-
|
|
1878
|
-
|
|
1879
|
-
|
|
1854
|
+
)
|
|
1855
|
+
] }),
|
|
1856
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1857
|
+
"button",
|
|
1858
|
+
{
|
|
1859
|
+
title: "Close search",
|
|
1860
|
+
onClick: () => {
|
|
1861
|
+
setSearching(false);
|
|
1862
|
+
setQ("");
|
|
1863
|
+
onSearchChange?.("");
|
|
1864
|
+
},
|
|
1865
|
+
className: "grid h-8 w-8 place-items-center rounded-full text-xl hover:bg-black/5 cursor-pointer border-none bg-transparent",
|
|
1866
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(ChatXIcon, { className: "w-5 h-5" })
|
|
1867
|
+
}
|
|
1868
|
+
)
|
|
1869
|
+
] }) })
|
|
1870
|
+
},
|
|
1871
|
+
"search"
|
|
1880
1872
|
) }) }) });
|
|
1881
1873
|
};
|
|
1882
1874
|
var ChatListHeader_default = ChatListHeader;
|
|
@@ -1935,7 +1927,7 @@ var ChatAddressCard = ({ mine, card, className }) => {
|
|
|
1935
1927
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1936
1928
|
"div",
|
|
1937
1929
|
{
|
|
1938
|
-
className:
|
|
1930
|
+
className: clsx16__default.default(
|
|
1939
1931
|
"w-[340px] rounded-md bg-[#f8f8f8] p-2",
|
|
1940
1932
|
mine ? "ml-auto" : "mr-auto",
|
|
1941
1933
|
className
|
|
@@ -2083,7 +2075,7 @@ var ChatBubbleAudio = ({ mine, audio }) => {
|
|
|
2083
2075
|
type: "button",
|
|
2084
2076
|
"aria-label": playing ? "Pause" : "Play",
|
|
2085
2077
|
onClick: toggle,
|
|
2086
|
-
className:
|
|
2078
|
+
className: clsx16__default.default(
|
|
2087
2079
|
"grid h-7 w-[34px] place-items-center rounded-md transition-colors",
|
|
2088
2080
|
mine ? "bg-[#F1F1F1] text-[#00486F]" : "bg-[#F1F1F1] text-[#00486F]"
|
|
2089
2081
|
),
|
|
@@ -2154,7 +2146,7 @@ var extColor2 = (ext) => {
|
|
|
2154
2146
|
var FileChip = ({ file }) => /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between gap-3 rounded-sm border border-[#e1e1e1] bg-white px-3 py-2", children: [
|
|
2155
2147
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex min-w-0 items-center gap-2", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "min-w-0", children: [
|
|
2156
2148
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-1", children: [
|
|
2157
|
-
/* @__PURE__ */ jsxRuntime.jsx(FileIcon, { className:
|
|
2149
|
+
/* @__PURE__ */ jsxRuntime.jsx(FileIcon, { className: clsx16__default.default("h-[18px] w-[18px]", extColor2(file.ext)) }),
|
|
2158
2150
|
" ",
|
|
2159
2151
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "truncate text-xs font-normal text-black", children: file.name })
|
|
2160
2152
|
] }),
|
|
@@ -2269,14 +2261,14 @@ var ChatBubbleText = ({ mine, text }) => {
|
|
|
2269
2261
|
const color = mine ? "bg-[#f8f8f8] border-[#f1f1f1]" : "bg-white border-[#EFEFEF]";
|
|
2270
2262
|
const corner = mine ? "rounded-tr-[6px]" : "rounded-tl-md";
|
|
2271
2263
|
const textFormatting = "whitespace-pre-wrap break-words";
|
|
2272
|
-
return /* @__PURE__ */ jsxRuntime.jsx("div", { className:
|
|
2264
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: clsx16__default.default(base, color, corner, textFormatting), children: text });
|
|
2273
2265
|
};
|
|
2274
2266
|
var ChatBubbleText_default = ChatBubbleText;
|
|
2275
2267
|
var ChatBusinessCard = ({ mine, card }) => {
|
|
2276
2268
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
2277
2269
|
"div",
|
|
2278
2270
|
{
|
|
2279
|
-
className:
|
|
2271
|
+
className: clsx16__default.default(
|
|
2280
2272
|
"relative h-[208px] w-[355px] overflow-hidden rounded-[12px] bg-white bg-cover bg-no-repeat",
|
|
2281
2273
|
"shadow-[0_2px_12px_rgba(59,51,51,0.1)]",
|
|
2282
2274
|
mine ? "ml-auto" : "mr-auto"
|
|
@@ -2336,13 +2328,13 @@ var MessageHoverActions = ({
|
|
|
2336
2328
|
const showTranslate = !isItemButton || isItemButton.includes("translate");
|
|
2337
2329
|
const hasAny = showReplay || showTranslate;
|
|
2338
2330
|
const isActive = (k) => !!activeButtons?.includes(k);
|
|
2339
|
-
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className:
|
|
2331
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: clsx16__default.default("relative inline-flex group/message", className), children: [
|
|
2340
2332
|
children,
|
|
2341
2333
|
hasAny && /* @__PURE__ */ jsxRuntime.jsx(
|
|
2342
2334
|
"div",
|
|
2343
2335
|
{
|
|
2344
2336
|
"aria-hidden": true,
|
|
2345
|
-
className:
|
|
2337
|
+
className: clsx16__default.default(
|
|
2346
2338
|
"absolute inset-y-0 w-2",
|
|
2347
2339
|
mine ? "right-full" : "left-full",
|
|
2348
2340
|
"pointer-events-auto"
|
|
@@ -2352,7 +2344,7 @@ var MessageHoverActions = ({
|
|
|
2352
2344
|
hasAny && /* @__PURE__ */ jsxRuntime.jsx(
|
|
2353
2345
|
"div",
|
|
2354
2346
|
{
|
|
2355
|
-
className:
|
|
2347
|
+
className: clsx16__default.default(
|
|
2356
2348
|
"absolute bottom-0 pointer-events-auto transition-opacity",
|
|
2357
2349
|
sidePos,
|
|
2358
2350
|
railNudge,
|
|
@@ -2372,7 +2364,7 @@ var MessageHoverActions = ({
|
|
|
2372
2364
|
e.stopPropagation();
|
|
2373
2365
|
onReply?.();
|
|
2374
2366
|
},
|
|
2375
|
-
className:
|
|
2367
|
+
className: clsx16__default.default(
|
|
2376
2368
|
"inline-flex h-[22px] w-[22px] items-center justify-center rounded-sm bg-white text-[#2c2c2c] shadow-[0_1px_3px_rgba(0,0,0,0.08)] hover:bg-[#f8f8f8]",
|
|
2377
2369
|
isActive("replay") && "bg-[#636363] text-white"
|
|
2378
2370
|
),
|
|
@@ -2393,7 +2385,7 @@ var MessageHoverActions = ({
|
|
|
2393
2385
|
e.stopPropagation();
|
|
2394
2386
|
onTranslate?.();
|
|
2395
2387
|
},
|
|
2396
|
-
className:
|
|
2388
|
+
className: clsx16__default.default(
|
|
2397
2389
|
"inline-flex h-[22px] w-[22px] items-center justify-center rounded-sm bg-white text-[#2c2c2c] shadow-[0_1px_3px_rgba(0,0,0,0.08)] hover:bg-[#f8f8f8]",
|
|
2398
2390
|
isActive("translate") && "!bg-[#636363] text-white"
|
|
2399
2391
|
),
|
|
@@ -2449,7 +2441,7 @@ var ChatMessageItem = ({
|
|
|
2449
2441
|
setTranslated((v) => !v);
|
|
2450
2442
|
onTranslate?.();
|
|
2451
2443
|
};
|
|
2452
|
-
return /* @__PURE__ */ jsxRuntime.jsx("div", { className:
|
|
2444
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: clsx16__default.default("mb-4", className), "data-msg-id": id, children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: clsx16__default.default("flex items-end gap-3", mine && "justify-end"), children: [
|
|
2453
2445
|
!mine && /* @__PURE__ */ jsxRuntime.jsx("div", { className: `${showStatus ? "mb-5" : "mb-0"}`, children: initialSrc ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "relative h-10 w-10 shrink-0 rounded-full border border-[#F1F1F1]", children: [
|
|
2454
2446
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2455
2447
|
"img",
|
|
@@ -2471,19 +2463,19 @@ var ChatMessageItem = ({
|
|
|
2471
2463
|
]
|
|
2472
2464
|
}
|
|
2473
2465
|
) }),
|
|
2474
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className:
|
|
2466
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: clsx16__default.default("flex flex-col gap-1 w-full"), children: [
|
|
2475
2467
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2476
2468
|
"div",
|
|
2477
2469
|
{
|
|
2478
|
-
className:
|
|
2470
|
+
className: clsx16__default.default(
|
|
2479
2471
|
" text-xs font-light text-[#636363]",
|
|
2480
2472
|
mine ? "text-right" : "text-left"
|
|
2481
2473
|
),
|
|
2482
2474
|
children: time
|
|
2483
2475
|
}
|
|
2484
2476
|
),
|
|
2485
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className:
|
|
2486
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className:
|
|
2477
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: clsx16__default.default("flex flex-col gap-1 w-full", mine ? "items-end" : "items-start"), children: [
|
|
2478
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: clsx16__default.default("flex w-full", mine ? "justify-end" : "justify-start"), children: replyTo && /* @__PURE__ */ jsxRuntime.jsx(ReplyCard_default, { jumpOnClick: true, refMsg: replyTo, compact: true, className: "mb-1" }) }),
|
|
2487
2479
|
businessCard ? /* @__PURE__ */ jsxRuntime.jsx(ChatBusinessCard_default, { mine, card: businessCard }) : null,
|
|
2488
2480
|
addressCard ? /* @__PURE__ */ jsxRuntime.jsx(ChatAddressCard_default, { mine, card: addressCard }) : null,
|
|
2489
2481
|
images?.length ? /* @__PURE__ */ jsxRuntime.jsx(MessageHoverActions_default, { mine, onReply, isItemButton: ["replay"], children: /* @__PURE__ */ jsxRuntime.jsx(ChatBubbleImages_default, { images }) }) : null,
|
|
@@ -2500,7 +2492,7 @@ var ChatMessageItem = ({
|
|
|
2500
2492
|
children: /* @__PURE__ */ jsxRuntime.jsx(ChatBubbleText_default, { mine, text: displayText })
|
|
2501
2493
|
}
|
|
2502
2494
|
) : null,
|
|
2503
|
-
showStatus && /* @__PURE__ */ jsxRuntime.jsx("div", { className:
|
|
2495
|
+
showStatus && /* @__PURE__ */ jsxRuntime.jsx("div", { className: clsx16__default.default("text-xs text-[#9AA1A9]", mine ? "text-right" : "text-left"), children: status })
|
|
2504
2496
|
] })
|
|
2505
2497
|
] })
|
|
2506
2498
|
] }) });
|
|
@@ -2510,15 +2502,14 @@ var ChatScroll = ({
|
|
|
2510
2502
|
top,
|
|
2511
2503
|
children,
|
|
2512
2504
|
className,
|
|
2505
|
+
style,
|
|
2513
2506
|
bottomAlignWhenShort = false,
|
|
2514
2507
|
scrollKey
|
|
2515
2508
|
}) => {
|
|
2516
2509
|
const ref = React10__default.default.useRef(null);
|
|
2517
2510
|
const scrollToBottom = React10__default.default.useCallback(() => {
|
|
2518
2511
|
const el = ref.current;
|
|
2519
|
-
if (!el)
|
|
2520
|
-
return;
|
|
2521
|
-
}
|
|
2512
|
+
if (!el) return;
|
|
2522
2513
|
el.scrollTop = el.scrollHeight;
|
|
2523
2514
|
}, []);
|
|
2524
2515
|
React10__default.default.useEffect(() => {
|
|
@@ -2531,17 +2522,12 @@ var ChatScroll = ({
|
|
|
2531
2522
|
{
|
|
2532
2523
|
ref,
|
|
2533
2524
|
"data-chat-scroll": true,
|
|
2534
|
-
className:
|
|
2535
|
-
|
|
2536
|
-
className
|
|
2537
|
-
),
|
|
2525
|
+
className: `h-full min-h-0 overflow-y-auto bg-white p-4 custom-scroll-hidden${className ? ` ${className}` : ""}`,
|
|
2526
|
+
style,
|
|
2538
2527
|
children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
2539
2528
|
"div",
|
|
2540
2529
|
{
|
|
2541
|
-
className:
|
|
2542
|
-
"min-h-full flex flex-col",
|
|
2543
|
-
bottomAlignWhenShort ? "justify-end" : "justify-start"
|
|
2544
|
-
),
|
|
2530
|
+
className: `min-h-full flex flex-col${bottomAlignWhenShort ? " justify-end" : " justify-start"}`,
|
|
2545
2531
|
children: [
|
|
2546
2532
|
top,
|
|
2547
2533
|
children
|
|
@@ -2588,7 +2574,7 @@ var ChatThreadItem = ({
|
|
|
2588
2574
|
"button",
|
|
2589
2575
|
{
|
|
2590
2576
|
onClick,
|
|
2591
|
-
className:
|
|
2577
|
+
className: clsx16__default.default(
|
|
2592
2578
|
"relative w-full text-left px-5 py-2 hover:bg-[#f8f8f8] focus:outline-none h-[75px]",
|
|
2593
2579
|
active && "bg-[#f8f8f8]",
|
|
2594
2580
|
className
|
|
@@ -2641,19 +2627,20 @@ var ChatThreadItem_default = ChatThreadItem;
|
|
|
2641
2627
|
var typingdotanimation2_default = { v: "5.12.1", fr: 25, ip: 0, op: 59, w: 400, h: 100, nm: "Composizione 1", ddd: 0, assets: [{ id: "comp_0", nm: "barra", fr: 25, layers: [{ ddd: 0, ind: 1, ty: 4, nm: "barra contorni", sr: 1, ks: { o: { a: 0, k: 100, ix: 11 }, r: { a: 0, k: 0, ix: 10 }, p: { a: 1, k: [{ i: { x: 0.541, y: 1 }, o: { x: 0.158, y: 0 }, t: 0, s: [47, 189.5, 0], to: [48.333, 0, 0], ti: [-48.333, 0, 0] }, { t: 60, s: [337, 189.5, 0] }], ix: 2, l: 2 }, a: { a: 0, k: [57.25, 4.75, 0], ix: 1, l: 2 }, s: { a: 0, k: [100, 100, 100], ix: 6, l: 2 } }, ao: 0, shapes: [{ ty: "gr", it: [{ ind: 0, ty: "sh", ix: 1, ks: { a: 0, k: { i: [[2.485, 0], [0, 0], [0, 2.485], [-2.485, 0], [0, 0], [0, -2.485]], o: [[0, 0], [-2.485, 0], [0, -2.485], [0, 0], [2.485, 0], [0, 2.485]], v: [[52.5, 4.5], [-52.5, 4.5], [-57, 0], [-52.5, -4.5], [52.5, -4.5], [57, 0]], c: true }, ix: 2 }, nm: "Path 1", mn: "ADBE Vector Shape - Group", hd: false }, { ty: "fl", c: { a: 1, k: [{ i: { x: [0.833], y: [1] }, o: { x: [0.167], y: [0] }, t: 0, s: [0.058823529631, 0.800000011921, 0.807843148708, 1] }, { i: { x: [0.833], y: [0.999] }, o: { x: [0.167], y: [1e-3] }, t: 23, s: [0, 0.419607847929, 0.470588237047, 1] }, { t: 49, s: [0.376470595598, 0.435294121504, 0.482352942228, 1] }], ix: 4 }, o: { a: 0, k: 100, ix: 5 }, r: 1, bm: 0, nm: "Riempimento 1", mn: "ADBE Vector Graphic - Fill", hd: false }, { ty: "tr", p: { a: 0, k: [57.25, 4.75], ix: 2 }, a: { a: 0, k: [0, 0], ix: 1 }, s: { a: 0, k: [100, 100], ix: 3 }, r: { a: 0, k: 0, ix: 6 }, o: { a: 0, k: 100, ix: 7 }, sk: { a: 0, k: 0, ix: 4 }, sa: { a: 0, k: 0, ix: 5 }, nm: "Transform" }], nm: "Gruppo 1", np: 2, cix: 2, bm: 0, ix: 1, mn: "ADBE Vector Group", hd: false }], ip: 0, op: 250, st: 0, ct: 1, bm: 0 }] }], layers: [{ ddd: 0, ind: 1, ty: 0, nm: "barra", refId: "comp_0", sr: 0.89999997615814, ks: { o: { a: 0, k: 100, ix: 11 }, r: { a: 0, k: 0, ix: 10 }, p: { a: 0, k: [201, 50, 0], ix: 2, l: 2 }, a: { a: 0, k: [190, 190, 0], ix: 1, l: 2 }, s: { a: 0, k: [120, 120, 100], ix: 6, l: 2 } }, ao: 0, hasMask: true, masksProperties: [{ inv: false, mode: "a", pt: { a: 0, k: { i: [[2.347, 0], [0, 0], [0, -2.347], [-2.347, 0], [0, 0], [0, 2.347]], o: [[0, 0], [-2.347, 0], [0, 2.347], [0, 0], [2.347, 0], [0, -2.347]], v: [[270.25, 185], [108.75, 185], [104.5, 189.25], [108.75, 193.5], [270.25, 193.5], [274.5, 189.25]], c: true }, ix: 1 }, o: { a: 0, k: 100, ix: 3 }, x: { a: 0, k: 0, ix: 4 }, nm: "Mask 1" }], w: 380, h: 380, ip: 0, op: 59, st: 0, bm: 0 }], markers: [], props: {} };
|
|
2642
2628
|
var Lottie2 = _Lottie__default.default.default ?? _Lottie__default.default;
|
|
2643
2629
|
var TypingIndicator = ({
|
|
2644
|
-
size = 18,
|
|
2645
2630
|
loop = true,
|
|
2646
2631
|
autoplay = true,
|
|
2647
2632
|
className,
|
|
2648
2633
|
ariaLabel = "Typing\u2026",
|
|
2649
|
-
avatarSize = 40
|
|
2634
|
+
avatarSize = 40,
|
|
2635
|
+
style
|
|
2650
2636
|
}) => {
|
|
2651
2637
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
2652
2638
|
"div",
|
|
2653
2639
|
{
|
|
2654
|
-
className: cn("relative flex items-end gap-[6px]", className),
|
|
2655
2640
|
role: "status",
|
|
2656
2641
|
"aria-label": ariaLabel,
|
|
2642
|
+
className: `relative flex items-end gap-[6px]${className ? ` ${className}` : ""}`,
|
|
2643
|
+
style,
|
|
2657
2644
|
children: [
|
|
2658
2645
|
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
2659
2646
|
"div",
|
|
@@ -2669,7 +2656,7 @@ var TypingIndicator = ({
|
|
|
2669
2656
|
className: "h-full w-full rounded-full object-cover"
|
|
2670
2657
|
}
|
|
2671
2658
|
),
|
|
2672
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "absolute bottom-
|
|
2659
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "absolute bottom-0 right-0 h-[11.25px] w-[11.25px] rounded-full bg-[#328545] ring-1 ring-white" })
|
|
2673
2660
|
]
|
|
2674
2661
|
}
|
|
2675
2662
|
),
|
|
@@ -2887,7 +2874,21 @@ var avatarBgByInitial = {
|
|
|
2887
2874
|
B: "#F0EDEB",
|
|
2888
2875
|
b: "#F0EDEB"
|
|
2889
2876
|
};
|
|
2890
|
-
var
|
|
2877
|
+
var GRADIENT_BORDER = "linear-gradient(236.83deg, rgba(51,201,212,0.3) 0.4%, rgba(39,83,251,0.3) 30.28%, rgba(39,83,251,0.3) 50.2%, rgba(39,83,251,0.3) 65.14%, rgba(235,67,255,0.3) 100%)";
|
|
2878
|
+
function getThemeAttr(theme) {
|
|
2879
|
+
if (!theme || theme === "marketplace") return "marketplace";
|
|
2880
|
+
if (theme === "admin") return "admin";
|
|
2881
|
+
return "custom";
|
|
2882
|
+
}
|
|
2883
|
+
function getThemeVars(theme) {
|
|
2884
|
+
if (!theme || theme === "marketplace" || theme === "admin") return {};
|
|
2885
|
+
const vars = {};
|
|
2886
|
+
if (theme.primary) vars["--color-banbox-primary"] = theme.primary;
|
|
2887
|
+
if (theme.primaryActive) vars["--color-banbox-primary-active"] = theme.primaryActive;
|
|
2888
|
+
if (theme.surfaceLow) vars["--color-banbox-surface-container-low"] = theme.surfaceLow;
|
|
2889
|
+
return vars;
|
|
2890
|
+
}
|
|
2891
|
+
var InboxPopup = ({ adapter, uiCallbacks, theme }) => {
|
|
2891
2892
|
const { close, selectThread, selectedThreadId, reference } = useChatUI();
|
|
2892
2893
|
const { isOpen: isGalleryOpen, closeGallery } = useGallery();
|
|
2893
2894
|
const [threads, setThreads] = React10.useState(() => adapter.threads.list(reference));
|
|
@@ -2932,16 +2933,12 @@ var InboxPopup = ({ adapter, uiCallbacks }) => {
|
|
|
2932
2933
|
const idButtonLabel = activeThread?.orderId ? "View Order" : activeThread?.inquiryId ? "View Inquiry" : void 0;
|
|
2933
2934
|
const idValue = activeThread?.orderId ?? activeThread?.inquiryId ?? void 0;
|
|
2934
2935
|
const [showDelete, setShowDelete] = React10.useState(false);
|
|
2935
|
-
const [isLoading, setIsLoading] = React10.useState(false);
|
|
2936
2936
|
const scrollKey = `${activeId}-${messages.length}-${rev}`;
|
|
2937
|
-
const prevActiveIdRef =
|
|
2937
|
+
const prevActiveIdRef = React10.useRef(activeId);
|
|
2938
2938
|
React10.useEffect(() => {
|
|
2939
2939
|
if (prevActiveIdRef.current !== activeId) {
|
|
2940
2940
|
prevActiveIdRef.current = activeId;
|
|
2941
|
-
setIsLoading(true);
|
|
2942
|
-
const t = setTimeout(() => setIsLoading(false), 300);
|
|
2943
2941
|
if (activeId) adapter.threads.markRead?.(activeId);
|
|
2944
|
-
return () => clearTimeout(t);
|
|
2945
2942
|
}
|
|
2946
2943
|
}, [activeId, adapter]);
|
|
2947
2944
|
const toRef2 = (m) => ({
|
|
@@ -2963,19 +2960,21 @@ var InboxPopup = ({ adapter, uiCallbacks }) => {
|
|
|
2963
2960
|
if (nextId) selectThread(nextId);
|
|
2964
2961
|
setReplyTo(void 0);
|
|
2965
2962
|
setShowDelete(false);
|
|
2966
|
-
uiCallbacks?.showToast?.({
|
|
2967
|
-
type: "success",
|
|
2968
|
-
title: "Chat Deleted",
|
|
2969
|
-
message: "The chat has been deleted successfully."
|
|
2970
|
-
});
|
|
2963
|
+
uiCallbacks?.showToast?.({ type: "success", title: "Chat Deleted", message: "The chat has been deleted successfully." });
|
|
2971
2964
|
};
|
|
2965
|
+
const filteredThreads = threads.filter((t) => {
|
|
2966
|
+
if (!searchQuery.trim()) return true;
|
|
2967
|
+
const q = searchQuery.toLowerCase();
|
|
2968
|
+
return t.title.toLowerCase().includes(q) || t.last?.toLowerCase().includes(q) || t.orderId?.toLowerCase().includes(q) || t.inquiryId?.toLowerCase().includes(q);
|
|
2969
|
+
});
|
|
2972
2970
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "fixed bottom-4 right-4 z-[10002]", children: [
|
|
2973
2971
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2974
2972
|
framerMotion.motion.button,
|
|
2975
2973
|
{
|
|
2976
2974
|
"aria-label": "Close chat",
|
|
2977
2975
|
onClick: close,
|
|
2978
|
-
className: "fixed inset-0",
|
|
2976
|
+
className: "fixed inset-0 cursor-auto!",
|
|
2977
|
+
style: { background: "transparent", border: "none" },
|
|
2979
2978
|
initial: { opacity: 0 },
|
|
2980
2979
|
animate: { opacity: 1 },
|
|
2981
2980
|
exit: { opacity: 0 },
|
|
@@ -2987,12 +2986,14 @@ var InboxPopup = ({ adapter, uiCallbacks }) => {
|
|
|
2987
2986
|
{
|
|
2988
2987
|
role: "dialog",
|
|
2989
2988
|
"aria-modal": "true",
|
|
2990
|
-
|
|
2989
|
+
"data-theme": getThemeAttr(theme),
|
|
2990
|
+
className: "banbox-chat-root relative rounded-[20px] p-[3px]",
|
|
2991
2991
|
style: {
|
|
2992
2992
|
width: 800,
|
|
2993
2993
|
height: 650,
|
|
2994
2994
|
boxShadow: "0px 2px 12px 0px #3B33331A",
|
|
2995
|
-
background:
|
|
2995
|
+
background: GRADIENT_BORDER,
|
|
2996
|
+
...getThemeVars(theme)
|
|
2996
2997
|
},
|
|
2997
2998
|
initial: { x: "110%" },
|
|
2998
2999
|
animate: { x: 0 },
|
|
@@ -3005,7 +3006,7 @@ var InboxPopup = ({ adapter, uiCallbacks }) => {
|
|
|
3005
3006
|
style: { overscrollBehavior: "contain" },
|
|
3006
3007
|
children: [
|
|
3007
3008
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "pointer-events-none absolute inset-0 rounded-[14px] ring-1 ring-[#2F80ED]/40" }),
|
|
3008
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid h-full min-h-0 grid-cols-[
|
|
3009
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid h-full min-h-0 grid-cols-[1fr_310px]", children: [
|
|
3009
3010
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex h-full min-h-0 flex-col border-r border-[#9BBCCF]", children: [
|
|
3010
3011
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "h-[64px] shrink-0", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
3011
3012
|
ChatHeader,
|
|
@@ -3082,13 +3083,9 @@ var InboxPopup = ({ adapter, uiCallbacks }) => {
|
|
|
3082
3083
|
activeId
|
|
3083
3084
|
) })
|
|
3084
3085
|
] }),
|
|
3085
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "h-full min-h-0", children: [
|
|
3086
|
-
/* @__PURE__ */ jsxRuntime.jsx(ChatListHeader_default, { onClose: close, onSearchChange: (val) => setSearchQuery(val) }),
|
|
3087
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "h-
|
|
3088
|
-
if (!searchQuery.trim()) return true;
|
|
3089
|
-
const q = searchQuery.toLowerCase();
|
|
3090
|
-
return t.title.toLowerCase().includes(q) || t.last?.toLowerCase().includes(q) || t.orderId?.toLowerCase().includes(q) || t.inquiryId?.toLowerCase().includes(q);
|
|
3091
|
-
}).map((t) => {
|
|
3086
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex h-full min-h-0 flex-col", children: [
|
|
3087
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "shrink-0", children: /* @__PURE__ */ jsxRuntime.jsx(ChatListHeader_default, { onClose: close, onSearchChange: (val) => setSearchQuery(val) }) }),
|
|
3088
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex-1 min-h-0 overflow-y-auto custom-scroll", children: filteredThreads.map((t) => {
|
|
3092
3089
|
const status = t.status ?? (t.unread && t.unread > 0 ? { kind: "new", count: t.unread } : { kind: "seen" });
|
|
3093
3090
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
3094
3091
|
ChatThreadItem_default,
|
|
@@ -3123,6 +3120,7 @@ var InboxPopup = ({ adapter, uiCallbacks }) => {
|
|
|
3123
3120
|
] });
|
|
3124
3121
|
};
|
|
3125
3122
|
var InboxPopup_default = InboxPopup;
|
|
3123
|
+
var GRADIENT_BORDER2 = "linear-gradient(236.83deg, rgba(51,201,212,0.3) 0.4%, rgba(39,83,251,0.3) 30.28%, rgba(39,83,251,0.3) 50.2%, rgba(39,83,251,0.3) 65.14%, rgba(235,67,255,0.3) 100%)";
|
|
3126
3124
|
function coalesceThreadId(reference, threads) {
|
|
3127
3125
|
const referenceId = reference?.id;
|
|
3128
3126
|
if (reference?.kind === "quotation") {
|
|
@@ -3141,7 +3139,20 @@ function toRef(m) {
|
|
|
3141
3139
|
audio: m.audio
|
|
3142
3140
|
};
|
|
3143
3141
|
}
|
|
3144
|
-
|
|
3142
|
+
function getThemeAttr2(theme) {
|
|
3143
|
+
if (!theme || theme === "marketplace") return "marketplace";
|
|
3144
|
+
if (theme === "admin") return "admin";
|
|
3145
|
+
return "custom";
|
|
3146
|
+
}
|
|
3147
|
+
function getThemeVars2(theme) {
|
|
3148
|
+
if (!theme || theme === "marketplace" || theme === "admin") return {};
|
|
3149
|
+
const vars = {};
|
|
3150
|
+
if (theme.primary) vars["--color-banbox-primary"] = theme.primary;
|
|
3151
|
+
if (theme.primaryActive) vars["--color-banbox-primary-active"] = theme.primaryActive;
|
|
3152
|
+
if (theme.surfaceLow) vars["--color-banbox-surface-container-low"] = theme.surfaceLow;
|
|
3153
|
+
return vars;
|
|
3154
|
+
}
|
|
3155
|
+
var SinglePopup = ({ adapter, uiCallbacks, theme }) => {
|
|
3145
3156
|
const { close, reference } = useChatUI();
|
|
3146
3157
|
const threads = adapter.threads.list(reference);
|
|
3147
3158
|
const initialThreadId = React10__default.default.useMemo(
|
|
@@ -3175,7 +3186,6 @@ var SinglePopup = ({ adapter, uiCallbacks }) => {
|
|
|
3175
3186
|
setScrollKey(Date.now());
|
|
3176
3187
|
setReplyTo(void 0);
|
|
3177
3188
|
}, [activeId, adapter]);
|
|
3178
|
-
const statusText = activeThread?.status?.kind === "seen" ? "Seen" : "Delivered";
|
|
3179
3189
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "fixed bottom-4 right-4 z-[10002]", children: [
|
|
3180
3190
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3181
3191
|
framerMotion.motion.button,
|
|
@@ -3183,6 +3193,7 @@ var SinglePopup = ({ adapter, uiCallbacks }) => {
|
|
|
3183
3193
|
"aria-label": "Close chat",
|
|
3184
3194
|
onClick: close,
|
|
3185
3195
|
className: "fixed inset-0 cursor-auto!",
|
|
3196
|
+
style: { background: "transparent", border: "none" },
|
|
3186
3197
|
initial: { opacity: 0 },
|
|
3187
3198
|
animate: { opacity: 1 },
|
|
3188
3199
|
exit: { opacity: 0 },
|
|
@@ -3194,10 +3205,12 @@ var SinglePopup = ({ adapter, uiCallbacks }) => {
|
|
|
3194
3205
|
{
|
|
3195
3206
|
role: "dialog",
|
|
3196
3207
|
"aria-modal": "true",
|
|
3197
|
-
|
|
3208
|
+
"data-theme": getThemeAttr2(theme),
|
|
3209
|
+
className: "banbox-chat-root relative h-[650px] w-[450px] rounded-[20px] p-[2px]",
|
|
3198
3210
|
style: {
|
|
3199
3211
|
boxShadow: "0px 2px 12px 0px #3B33331A",
|
|
3200
|
-
background:
|
|
3212
|
+
background: GRADIENT_BORDER2,
|
|
3213
|
+
...getThemeVars2(theme)
|
|
3201
3214
|
},
|
|
3202
3215
|
initial: { x: "110%" },
|
|
3203
3216
|
animate: { x: 0 },
|
|
@@ -3229,40 +3242,48 @@ var SinglePopup = ({ adapter, uiCallbacks }) => {
|
|
|
3229
3242
|
{
|
|
3230
3243
|
type: "button",
|
|
3231
3244
|
onClick: close,
|
|
3232
|
-
className: "flex h-[34px] w-[34px] items-center justify-center rounded-full bg-white text-black shadow-[0px_2px_4px_0px_#A5A3AE4D] hover:bg-black/5 hover:text-[
|
|
3245
|
+
className: "flex h-[34px] w-[34px] items-center justify-center rounded-full bg-white text-black shadow-[0px_2px_4px_0px_#A5A3AE4D] hover:bg-black/5 hover:text-[var(--color-banbox-warning)] cursor-pointer border-none",
|
|
3233
3246
|
children: /* @__PURE__ */ jsxRuntime.jsx(ChatXIcon, { className: "h-6 w-6" })
|
|
3234
3247
|
}
|
|
3235
3248
|
)
|
|
3236
3249
|
}
|
|
3237
3250
|
) }),
|
|
3238
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex-1 min-h-0", children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
3239
|
-
|
|
3240
|
-
|
|
3241
|
-
|
|
3242
|
-
|
|
3243
|
-
|
|
3244
|
-
|
|
3245
|
-
|
|
3246
|
-
mine
|
|
3247
|
-
|
|
3248
|
-
|
|
3249
|
-
|
|
3250
|
-
|
|
3251
|
-
|
|
3252
|
-
|
|
3253
|
-
|
|
3254
|
-
|
|
3255
|
-
|
|
3256
|
-
|
|
3257
|
-
|
|
3258
|
-
|
|
3259
|
-
|
|
3260
|
-
|
|
3261
|
-
|
|
3262
|
-
|
|
3263
|
-
|
|
3264
|
-
|
|
3265
|
-
|
|
3251
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex-1 min-h-0", children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
3252
|
+
ChatScroll_default,
|
|
3253
|
+
{
|
|
3254
|
+
className: "h-full",
|
|
3255
|
+
bottomAlignWhenShort: false,
|
|
3256
|
+
scrollKey,
|
|
3257
|
+
children: [
|
|
3258
|
+
messages.map((m, idx) => {
|
|
3259
|
+
const mine = m.author === "you";
|
|
3260
|
+
const isLast = idx === messages.length - 1;
|
|
3261
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
3262
|
+
ChatMessageItem_default,
|
|
3263
|
+
{
|
|
3264
|
+
id: m.id,
|
|
3265
|
+
mine,
|
|
3266
|
+
time: m.time ?? "",
|
|
3267
|
+
authorInitial: typeof m.author === "string" ? m.author : "U",
|
|
3268
|
+
text: m.text ?? m.content,
|
|
3269
|
+
businessCard: m.businessCard,
|
|
3270
|
+
addressCard: m.addressCard,
|
|
3271
|
+
images: m.images,
|
|
3272
|
+
files: m.files,
|
|
3273
|
+
audio: m.audio,
|
|
3274
|
+
replyTo: m.replyTo,
|
|
3275
|
+
initialSrc: m.avatarSrc,
|
|
3276
|
+
showStatus: isLast,
|
|
3277
|
+
status: activeThread?.status?.kind === "seen" ? "Seen" : "Delivered",
|
|
3278
|
+
onReply: () => setReplyTo(toRef(m))
|
|
3279
|
+
},
|
|
3280
|
+
m.id
|
|
3281
|
+
);
|
|
3282
|
+
}),
|
|
3283
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex items-center justify-start", children: /* @__PURE__ */ jsxRuntime.jsx(TypingIndicator_default, {}) })
|
|
3284
|
+
]
|
|
3285
|
+
}
|
|
3286
|
+
) }),
|
|
3266
3287
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "shrink-0", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
3267
3288
|
ChatFooter_default,
|
|
3268
3289
|
{
|
|
@@ -3283,7 +3304,7 @@ var SinglePopup = ({ adapter, uiCallbacks }) => {
|
|
|
3283
3304
|
] });
|
|
3284
3305
|
};
|
|
3285
3306
|
var SinglePopup_default = SinglePopup;
|
|
3286
|
-
function ChatRoot({ adapter, uiCallbacks }) {
|
|
3307
|
+
function ChatRoot({ adapter, uiCallbacks, theme }) {
|
|
3287
3308
|
const { isOpen, variant } = useChatUI();
|
|
3288
3309
|
useDisableBodyScroll(isOpen);
|
|
3289
3310
|
if (typeof window === "undefined") {
|
|
@@ -3291,19 +3312,20 @@ function ChatRoot({ adapter, uiCallbacks }) {
|
|
|
3291
3312
|
}
|
|
3292
3313
|
return reactDom.createPortal(
|
|
3293
3314
|
// GalleryProvider is scoped to the chat only.
|
|
3294
|
-
// It is completely separate from the host app's own gallery context.
|
|
3295
3315
|
/* @__PURE__ */ jsxRuntime.jsx(GalleryProvider, { children: /* @__PURE__ */ jsxRuntime.jsx(framerMotion.AnimatePresence, { mode: "wait", children: isOpen && (variant === "inbox" ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
3296
3316
|
InboxPopup_default,
|
|
3297
3317
|
{
|
|
3298
3318
|
adapter,
|
|
3299
|
-
uiCallbacks
|
|
3319
|
+
uiCallbacks,
|
|
3320
|
+
theme
|
|
3300
3321
|
},
|
|
3301
3322
|
"inbox"
|
|
3302
3323
|
) : /* @__PURE__ */ jsxRuntime.jsx(
|
|
3303
3324
|
SinglePopup_default,
|
|
3304
3325
|
{
|
|
3305
3326
|
adapter,
|
|
3306
|
-
uiCallbacks
|
|
3327
|
+
uiCallbacks,
|
|
3328
|
+
theme
|
|
3307
3329
|
},
|
|
3308
3330
|
"single"
|
|
3309
3331
|
)) }) }),
|