@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.js
CHANGED
|
@@ -2,7 +2,7 @@ import { AnimatePresence, motion } from 'framer-motion';
|
|
|
2
2
|
import { createPortal } from 'react-dom';
|
|
3
3
|
import React10, { createContext, useContext, useRef, useState, useEffect, useMemo, useCallback } from 'react';
|
|
4
4
|
import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
|
|
5
|
-
import
|
|
5
|
+
import clsx16, { clsx } from 'clsx';
|
|
6
6
|
import { twMerge } from 'tailwind-merge';
|
|
7
7
|
import _Lottie from 'lottie-react';
|
|
8
8
|
|
|
@@ -457,7 +457,7 @@ var ChatTranslateSettingsModal = ({
|
|
|
457
457
|
const content = /* @__PURE__ */ jsxs(
|
|
458
458
|
"div",
|
|
459
459
|
{
|
|
460
|
-
className:
|
|
460
|
+
className: clsx16(
|
|
461
461
|
isSingle ? "fixed inset-0 z-9999 flex" : "absolute inset-0 z-50 flex items-center justify-center"
|
|
462
462
|
),
|
|
463
463
|
onClick: () => onClose(),
|
|
@@ -470,7 +470,7 @@ var ChatTranslateSettingsModal = ({
|
|
|
470
470
|
"aria-modal": "true",
|
|
471
471
|
"aria-labelledby": "translate-settings-title",
|
|
472
472
|
onClick: (e) => e.stopPropagation(),
|
|
473
|
-
className:
|
|
473
|
+
className: clsx16(
|
|
474
474
|
isSingle ? "fixed bottom-6 right-6 w-[500px] max-w-[95vw]" : "relative w-[500px] max-w-[95vw]",
|
|
475
475
|
"z-10000 overflow-visible rounded-md bg-white shadow-[0_12px_30px_rgba(0,0,0,0.18)]",
|
|
476
476
|
className
|
|
@@ -553,7 +553,7 @@ var extColor = (ext) => {
|
|
|
553
553
|
var FilePreviewChip = ({ name, sizeMB, ext, onRemove }) => /* @__PURE__ */ 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: [
|
|
554
554
|
/* @__PURE__ */ jsx("div", { className: "flex min-w-0 items-center gap-2", children: /* @__PURE__ */ jsxs("div", { className: "min-w-0", children: [
|
|
555
555
|
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1", children: [
|
|
556
|
-
/* @__PURE__ */ jsx(FileIcon, { className:
|
|
556
|
+
/* @__PURE__ */ jsx(FileIcon, { className: clsx16("h-[18px] w-[18px]", extColor(ext)) }),
|
|
557
557
|
" ",
|
|
558
558
|
/* @__PURE__ */ jsx("div", { className: "truncate text-sm font-normal text-black", children: name })
|
|
559
559
|
] }),
|
|
@@ -704,7 +704,7 @@ var ChatComposerBar = ({
|
|
|
704
704
|
{
|
|
705
705
|
type: "button",
|
|
706
706
|
onClick: sendText,
|
|
707
|
-
className:
|
|
707
|
+
className: clsx16(
|
|
708
708
|
"ms-1 grid h-[40px] w-[40px] place-items-center rounded-full text-[#ff5301] hover:bg-[#f8f8f8]"
|
|
709
709
|
),
|
|
710
710
|
title: hasAttachments ? "Send attachments" : "Send",
|
|
@@ -720,7 +720,7 @@ var ChatComposerBar = ({
|
|
|
720
720
|
type: "button",
|
|
721
721
|
onClick: sendAttachments,
|
|
722
722
|
disabled: !hasAttachments,
|
|
723
|
-
className:
|
|
723
|
+
className: clsx16(
|
|
724
724
|
"ms-1 grid h-[40px] w-[40px] place-items-center rounded-full hover:bg-[#f8f8f8]",
|
|
725
725
|
hasAttachments ? "text-[#ff5301]" : "text-[#B9C3D4]"
|
|
726
726
|
),
|
|
@@ -745,7 +745,7 @@ var ChatComposerBar = ({
|
|
|
745
745
|
children: /* @__PURE__ */ jsx(
|
|
746
746
|
RecordMicIcon,
|
|
747
747
|
{
|
|
748
|
-
className:
|
|
748
|
+
className: clsx16(
|
|
749
749
|
"h-6 w-6",
|
|
750
750
|
seconds % 2 === 0 ? "text-[#929292]" : "text-[#ff5301]"
|
|
751
751
|
)
|
|
@@ -1042,7 +1042,7 @@ var EmojiDropup = ({ open, onClose, onSelect, anchorRef, className }) => {
|
|
|
1042
1042
|
ref: panelRef,
|
|
1043
1043
|
role: "dialog",
|
|
1044
1044
|
"aria-label": "Emoji picker",
|
|
1045
|
-
className:
|
|
1045
|
+
className: clsx16("emoji-dropup", className),
|
|
1046
1046
|
style: {
|
|
1047
1047
|
zIndex: "9999",
|
|
1048
1048
|
width: WIDTH2,
|
|
@@ -1186,7 +1186,7 @@ var ReplyCard = ({ refMsg, onClose, compact, className, jumpOnClick }) => {
|
|
|
1186
1186
|
"div",
|
|
1187
1187
|
{
|
|
1188
1188
|
onClick: clickToJump,
|
|
1189
|
-
className:
|
|
1189
|
+
className: clsx16(
|
|
1190
1190
|
widthClamp,
|
|
1191
1191
|
"relative rounded-md bg-[#f8f8f8] px-3",
|
|
1192
1192
|
"border-l-2 border-[#FF5300]",
|
|
@@ -1505,7 +1505,7 @@ var ChatFooter = ({
|
|
|
1505
1505
|
}
|
|
1506
1506
|
setSeconds(0);
|
|
1507
1507
|
};
|
|
1508
|
-
return /* @__PURE__ */ jsxs("div", { className:
|
|
1508
|
+
return /* @__PURE__ */ jsxs("div", { className: clsx16("border-t border-[#ededed] bg-white p-3.5", className), children: [
|
|
1509
1509
|
replyTo && /* @__PURE__ */ jsx("div", { className: "mb-2", children: /* @__PURE__ */ jsx(ReplyCard_default, { refMsg: replyTo, onClose: clearReply }) }),
|
|
1510
1510
|
/* @__PURE__ */ jsx(
|
|
1511
1511
|
AttachmentPreviewStrip_default,
|
|
@@ -1605,10 +1605,10 @@ var ChatFooter = ({
|
|
|
1605
1605
|
var ChatFooter_default = ChatFooter;
|
|
1606
1606
|
function ChatHeader({ left, right, below, className }) {
|
|
1607
1607
|
return /* @__PURE__ */ jsxs("div", { children: [
|
|
1608
|
-
/* @__PURE__ */
|
|
1608
|
+
/* @__PURE__ */ jsxs("div", { className: `border-b border-[#e1e1e1] h-[64px] flex items-start justify-between px-4 pt-2.5${className ? ` ${className}` : ""}`, children: [
|
|
1609
1609
|
/* @__PURE__ */ jsx("div", { className: "flex items-start gap-3", children: left }),
|
|
1610
1610
|
right
|
|
1611
|
-
] })
|
|
1611
|
+
] }),
|
|
1612
1612
|
below && /* @__PURE__ */ jsx(Fragment, { children: below })
|
|
1613
1613
|
] });
|
|
1614
1614
|
}
|
|
@@ -1626,11 +1626,11 @@ var ChatIdentity = (props) => {
|
|
|
1626
1626
|
size = 46,
|
|
1627
1627
|
className
|
|
1628
1628
|
} = props;
|
|
1629
|
-
const subtitleClass =
|
|
1629
|
+
const subtitleClass = clsx16(
|
|
1630
1630
|
"text-[10px] font-medium",
|
|
1631
1631
|
subtitleVariant === "live" ? "text-[#1E9E6A]" : "text-[#929292]"
|
|
1632
1632
|
);
|
|
1633
|
-
return /* @__PURE__ */ jsxs("div", { className:
|
|
1633
|
+
return /* @__PURE__ */ jsxs("div", { className: clsx16("flex items-start gap-3", className), children: [
|
|
1634
1634
|
/* @__PURE__ */ jsxs("div", { className: "relative", style: { width: size, height: size }, children: [
|
|
1635
1635
|
props.variant === "avatar" && /* @__PURE__ */ jsx(
|
|
1636
1636
|
"img",
|
|
@@ -1643,7 +1643,7 @@ var ChatIdentity = (props) => {
|
|
|
1643
1643
|
props.variant === "initial" && /* @__PURE__ */ jsx(
|
|
1644
1644
|
"div",
|
|
1645
1645
|
{
|
|
1646
|
-
className:
|
|
1646
|
+
className: clsx16(
|
|
1647
1647
|
"grid h-full w-full place-items-center rounded-xs text-[15px] font-semibold text-[#2c2c2c]",
|
|
1648
1648
|
props.textClassName
|
|
1649
1649
|
),
|
|
@@ -1718,7 +1718,7 @@ var ChatInquiryBar = ({ id, onView, className, label, buttonLabel }) => {
|
|
|
1718
1718
|
return /* @__PURE__ */ jsxs(
|
|
1719
1719
|
"div",
|
|
1720
1720
|
{
|
|
1721
|
-
className:
|
|
1721
|
+
className: clsx16(
|
|
1722
1722
|
"flex items-center justify-between border-b border-[#ededed] bg-[#f8f8f8] ps-[16px] pe-[30px] h-[30px]",
|
|
1723
1723
|
className
|
|
1724
1724
|
),
|
|
@@ -1764,9 +1764,7 @@ var ChatListHeader = ({ className, onClose, onSearchChange }) => {
|
|
|
1764
1764
|
};
|
|
1765
1765
|
}, [searching]);
|
|
1766
1766
|
React10.useEffect(() => {
|
|
1767
|
-
if (!searching)
|
|
1768
|
-
return;
|
|
1769
|
-
}
|
|
1767
|
+
if (!searching) return;
|
|
1770
1768
|
const onKey = (e) => {
|
|
1771
1769
|
if (e.key === "Escape") {
|
|
1772
1770
|
setSearching(false);
|
|
@@ -1785,90 +1783,84 @@ var ChatListHeader = ({ className, onClose, onSearchChange }) => {
|
|
|
1785
1783
|
inFromLeft: { opacity: 1, x: 0, transition: { duration: 0.18, ease: [0.16, 1, 0.3, 1] } },
|
|
1786
1784
|
outToRight: { opacity: 0, x: 24, transition: { duration: 0.16, ease: [0.4, 0, 1, 1] } }
|
|
1787
1785
|
};
|
|
1788
|
-
return /* @__PURE__ */ jsx("div", { className:
|
|
1789
|
-
|
|
1790
|
-
|
|
1791
|
-
|
|
1792
|
-
{
|
|
1793
|
-
|
|
1794
|
-
|
|
1795
|
-
|
|
1796
|
-
|
|
1797
|
-
|
|
1798
|
-
|
|
1799
|
-
/* @__PURE__ */ jsx("
|
|
1800
|
-
|
|
1801
|
-
|
|
1802
|
-
|
|
1803
|
-
|
|
1804
|
-
|
|
1805
|
-
"
|
|
1806
|
-
|
|
1807
|
-
|
|
1808
|
-
|
|
1809
|
-
|
|
1810
|
-
|
|
1811
|
-
|
|
1812
|
-
),
|
|
1813
|
-
/* @__PURE__ */ jsx(
|
|
1814
|
-
"button",
|
|
1815
|
-
{
|
|
1816
|
-
title: "Close",
|
|
1817
|
-
onClick: onClose,
|
|
1818
|
-
className: "h-9 w-9 place-items-center rounded-full hover:bg-black/5 flex items-center justify-center",
|
|
1819
|
-
children: /* @__PURE__ */ jsx(ChatXIcon, { className: "w-6 h-6" })
|
|
1820
|
-
}
|
|
1821
|
-
)
|
|
1822
|
-
] })
|
|
1823
|
-
]
|
|
1824
|
-
},
|
|
1825
|
-
"normal"
|
|
1826
|
-
)
|
|
1827
|
-
) : (
|
|
1828
|
-
// SEARCH — enters from right, exits to right
|
|
1829
|
-
/* @__PURE__ */ jsx(
|
|
1830
|
-
motion.div,
|
|
1831
|
-
{
|
|
1832
|
-
className: "flex w-full items-center gap-3",
|
|
1833
|
-
initial: { opacity: 0, x: 24 },
|
|
1834
|
-
animate: "inFromRight",
|
|
1835
|
-
exit: "outToRight",
|
|
1836
|
-
variants,
|
|
1837
|
-
children: /* @__PURE__ */ jsx("div", { className: "relative flex-1", children: /* @__PURE__ */ jsxs("div", { className: "flex h-10 w-full items-center rounded-full border border-[#6A6A6A] bg-white px-[4px] gap-1.5", children: [
|
|
1838
|
-
/* @__PURE__ */ jsxs("div", { className: "flex items-center ms-[12px] w-full", children: [
|
|
1839
|
-
/* @__PURE__ */ jsx("span", { className: "mr-2 grid h-6 w-6 shrink-0 place-items-center text-[#929292]", children: /* @__PURE__ */ jsx(ChatSearchIcon, { className: "w-5 h-5" }) }),
|
|
1840
|
-
/* @__PURE__ */ jsx("span", { className: "mr-2 h-6 w-px shrink-0 bg-[#e1e1e1]" }),
|
|
1841
|
-
/* @__PURE__ */ jsx(
|
|
1842
|
-
"input",
|
|
1843
|
-
{
|
|
1844
|
-
ref: inputRef,
|
|
1845
|
-
value: q,
|
|
1846
|
-
onChange: (e) => {
|
|
1847
|
-
setQ(e.target.value);
|
|
1848
|
-
onSearchChange?.(e.target.value);
|
|
1849
|
-
},
|
|
1850
|
-
placeholder: "Search",
|
|
1851
|
-
className: "h-full w-full flex-1 bg-transparent text-[15px] outline-none placeholder:text-[#9C9C9C]"
|
|
1852
|
-
}
|
|
1853
|
-
)
|
|
1854
|
-
] }),
|
|
1855
|
-
/* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx(
|
|
1786
|
+
return /* @__PURE__ */ jsx("div", { className: `h-[64px] border-b border-[#ededed]${className ? ` ${className}` : ""}`, children: /* @__PURE__ */ jsx("div", { className: "flex h-full items-center px-[20px]", children: /* @__PURE__ */ jsx(AnimatePresence, { initial: false, mode: "wait", children: !searching ? /* @__PURE__ */ jsxs(
|
|
1787
|
+
motion.div,
|
|
1788
|
+
{
|
|
1789
|
+
className: "flex w-full items-center justify-between",
|
|
1790
|
+
initial: { opacity: 0, x: -24 },
|
|
1791
|
+
animate: "inFromLeft",
|
|
1792
|
+
exit: "outToLeft",
|
|
1793
|
+
variants,
|
|
1794
|
+
children: [
|
|
1795
|
+
/* @__PURE__ */ jsx("div", { className: "flex items-center gap-3", children: /* @__PURE__ */ jsxs("div", { className: "text-[#2c2c2c] flex items-center gap-2", children: [
|
|
1796
|
+
/* @__PURE__ */ jsx(MessageIcon, { className: "w-6 h-6" }),
|
|
1797
|
+
/* @__PURE__ */ jsx("span", { className: "text-[22px] font-semibold", children: "Messenger" })
|
|
1798
|
+
] }) }),
|
|
1799
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
|
|
1800
|
+
/* @__PURE__ */ jsx(
|
|
1801
|
+
"button",
|
|
1802
|
+
{
|
|
1803
|
+
title: "Search",
|
|
1804
|
+
onClick: () => setSearching(true),
|
|
1805
|
+
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",
|
|
1806
|
+
children: /* @__PURE__ */ jsx(ChatSearchIcon, { className: "w-5 h-5" })
|
|
1807
|
+
}
|
|
1808
|
+
),
|
|
1809
|
+
/* @__PURE__ */ jsx(
|
|
1856
1810
|
"button",
|
|
1857
1811
|
{
|
|
1858
|
-
title: "Close
|
|
1859
|
-
onClick:
|
|
1860
|
-
|
|
1861
|
-
|
|
1862
|
-
|
|
1812
|
+
title: "Close",
|
|
1813
|
+
onClick: onClose,
|
|
1814
|
+
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",
|
|
1815
|
+
children: /* @__PURE__ */ jsx(ChatXIcon, { className: "w-6 h-6" })
|
|
1816
|
+
}
|
|
1817
|
+
)
|
|
1818
|
+
] })
|
|
1819
|
+
]
|
|
1820
|
+
},
|
|
1821
|
+
"normal"
|
|
1822
|
+
) : /* @__PURE__ */ jsx(
|
|
1823
|
+
motion.div,
|
|
1824
|
+
{
|
|
1825
|
+
className: "flex w-full items-center gap-3",
|
|
1826
|
+
initial: { opacity: 0, x: 24 },
|
|
1827
|
+
animate: "inFromRight",
|
|
1828
|
+
exit: "outToRight",
|
|
1829
|
+
variants,
|
|
1830
|
+
children: /* @__PURE__ */ jsx("div", { className: "relative flex-1", children: /* @__PURE__ */ jsxs("div", { className: "flex h-10 w-full items-center rounded-full border border-[#6A6A6A] bg-white px-[4px] gap-1.5", children: [
|
|
1831
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center ms-[12px] w-full", children: [
|
|
1832
|
+
/* @__PURE__ */ jsx("span", { className: "mr-2 grid h-6 w-6 shrink-0 place-items-center text-[#929292]", children: /* @__PURE__ */ jsx(ChatSearchIcon, { className: "w-5 h-5" }) }),
|
|
1833
|
+
/* @__PURE__ */ jsx("span", { className: "mr-2 h-6 w-px shrink-0 bg-[#e1e1e1]" }),
|
|
1834
|
+
/* @__PURE__ */ jsx(
|
|
1835
|
+
"input",
|
|
1836
|
+
{
|
|
1837
|
+
ref: inputRef,
|
|
1838
|
+
value: q,
|
|
1839
|
+
onChange: (e) => {
|
|
1840
|
+
setQ(e.target.value);
|
|
1841
|
+
onSearchChange?.(e.target.value);
|
|
1863
1842
|
},
|
|
1864
|
-
|
|
1865
|
-
|
|
1843
|
+
placeholder: "Search",
|
|
1844
|
+
className: "h-full w-full flex-1 bg-transparent text-[15px] outline-none placeholder:text-[#9C9C9C] border-none"
|
|
1866
1845
|
}
|
|
1867
|
-
)
|
|
1868
|
-
] })
|
|
1869
|
-
|
|
1870
|
-
|
|
1871
|
-
|
|
1846
|
+
)
|
|
1847
|
+
] }),
|
|
1848
|
+
/* @__PURE__ */ jsx(
|
|
1849
|
+
"button",
|
|
1850
|
+
{
|
|
1851
|
+
title: "Close search",
|
|
1852
|
+
onClick: () => {
|
|
1853
|
+
setSearching(false);
|
|
1854
|
+
setQ("");
|
|
1855
|
+
onSearchChange?.("");
|
|
1856
|
+
},
|
|
1857
|
+
className: "grid h-8 w-8 place-items-center rounded-full text-xl hover:bg-black/5 cursor-pointer border-none bg-transparent",
|
|
1858
|
+
children: /* @__PURE__ */ jsx(ChatXIcon, { className: "w-5 h-5" })
|
|
1859
|
+
}
|
|
1860
|
+
)
|
|
1861
|
+
] }) })
|
|
1862
|
+
},
|
|
1863
|
+
"search"
|
|
1872
1864
|
) }) }) });
|
|
1873
1865
|
};
|
|
1874
1866
|
var ChatListHeader_default = ChatListHeader;
|
|
@@ -1927,7 +1919,7 @@ var ChatAddressCard = ({ mine, card, className }) => {
|
|
|
1927
1919
|
return /* @__PURE__ */ jsxs(
|
|
1928
1920
|
"div",
|
|
1929
1921
|
{
|
|
1930
|
-
className:
|
|
1922
|
+
className: clsx16(
|
|
1931
1923
|
"w-[340px] rounded-md bg-[#f8f8f8] p-2",
|
|
1932
1924
|
mine ? "ml-auto" : "mr-auto",
|
|
1933
1925
|
className
|
|
@@ -2075,7 +2067,7 @@ var ChatBubbleAudio = ({ mine, audio }) => {
|
|
|
2075
2067
|
type: "button",
|
|
2076
2068
|
"aria-label": playing ? "Pause" : "Play",
|
|
2077
2069
|
onClick: toggle,
|
|
2078
|
-
className:
|
|
2070
|
+
className: clsx16(
|
|
2079
2071
|
"grid h-7 w-[34px] place-items-center rounded-md transition-colors",
|
|
2080
2072
|
mine ? "bg-[#F1F1F1] text-[#00486F]" : "bg-[#F1F1F1] text-[#00486F]"
|
|
2081
2073
|
),
|
|
@@ -2146,7 +2138,7 @@ var extColor2 = (ext) => {
|
|
|
2146
2138
|
var FileChip = ({ file }) => /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between gap-3 rounded-sm border border-[#e1e1e1] bg-white px-3 py-2", children: [
|
|
2147
2139
|
/* @__PURE__ */ jsx("div", { className: "flex min-w-0 items-center gap-2", children: /* @__PURE__ */ jsxs("div", { className: "min-w-0", children: [
|
|
2148
2140
|
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1", children: [
|
|
2149
|
-
/* @__PURE__ */ jsx(FileIcon, { className:
|
|
2141
|
+
/* @__PURE__ */ jsx(FileIcon, { className: clsx16("h-[18px] w-[18px]", extColor2(file.ext)) }),
|
|
2150
2142
|
" ",
|
|
2151
2143
|
/* @__PURE__ */ jsx("div", { className: "truncate text-xs font-normal text-black", children: file.name })
|
|
2152
2144
|
] }),
|
|
@@ -2261,14 +2253,14 @@ var ChatBubbleText = ({ mine, text }) => {
|
|
|
2261
2253
|
const color = mine ? "bg-[#f8f8f8] border-[#f1f1f1]" : "bg-white border-[#EFEFEF]";
|
|
2262
2254
|
const corner = mine ? "rounded-tr-[6px]" : "rounded-tl-md";
|
|
2263
2255
|
const textFormatting = "whitespace-pre-wrap break-words";
|
|
2264
|
-
return /* @__PURE__ */ jsx("div", { className:
|
|
2256
|
+
return /* @__PURE__ */ jsx("div", { className: clsx16(base, color, corner, textFormatting), children: text });
|
|
2265
2257
|
};
|
|
2266
2258
|
var ChatBubbleText_default = ChatBubbleText;
|
|
2267
2259
|
var ChatBusinessCard = ({ mine, card }) => {
|
|
2268
2260
|
return /* @__PURE__ */ jsx(
|
|
2269
2261
|
"div",
|
|
2270
2262
|
{
|
|
2271
|
-
className:
|
|
2263
|
+
className: clsx16(
|
|
2272
2264
|
"relative h-[208px] w-[355px] overflow-hidden rounded-[12px] bg-white bg-cover bg-no-repeat",
|
|
2273
2265
|
"shadow-[0_2px_12px_rgba(59,51,51,0.1)]",
|
|
2274
2266
|
mine ? "ml-auto" : "mr-auto"
|
|
@@ -2328,13 +2320,13 @@ var MessageHoverActions = ({
|
|
|
2328
2320
|
const showTranslate = !isItemButton || isItemButton.includes("translate");
|
|
2329
2321
|
const hasAny = showReplay || showTranslate;
|
|
2330
2322
|
const isActive = (k) => !!activeButtons?.includes(k);
|
|
2331
|
-
return /* @__PURE__ */ jsxs("div", { className:
|
|
2323
|
+
return /* @__PURE__ */ jsxs("div", { className: clsx16("relative inline-flex group/message", className), children: [
|
|
2332
2324
|
children,
|
|
2333
2325
|
hasAny && /* @__PURE__ */ jsx(
|
|
2334
2326
|
"div",
|
|
2335
2327
|
{
|
|
2336
2328
|
"aria-hidden": true,
|
|
2337
|
-
className:
|
|
2329
|
+
className: clsx16(
|
|
2338
2330
|
"absolute inset-y-0 w-2",
|
|
2339
2331
|
mine ? "right-full" : "left-full",
|
|
2340
2332
|
"pointer-events-auto"
|
|
@@ -2344,7 +2336,7 @@ var MessageHoverActions = ({
|
|
|
2344
2336
|
hasAny && /* @__PURE__ */ jsx(
|
|
2345
2337
|
"div",
|
|
2346
2338
|
{
|
|
2347
|
-
className:
|
|
2339
|
+
className: clsx16(
|
|
2348
2340
|
"absolute bottom-0 pointer-events-auto transition-opacity",
|
|
2349
2341
|
sidePos,
|
|
2350
2342
|
railNudge,
|
|
@@ -2364,7 +2356,7 @@ var MessageHoverActions = ({
|
|
|
2364
2356
|
e.stopPropagation();
|
|
2365
2357
|
onReply?.();
|
|
2366
2358
|
},
|
|
2367
|
-
className:
|
|
2359
|
+
className: clsx16(
|
|
2368
2360
|
"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]",
|
|
2369
2361
|
isActive("replay") && "bg-[#636363] text-white"
|
|
2370
2362
|
),
|
|
@@ -2385,7 +2377,7 @@ var MessageHoverActions = ({
|
|
|
2385
2377
|
e.stopPropagation();
|
|
2386
2378
|
onTranslate?.();
|
|
2387
2379
|
},
|
|
2388
|
-
className:
|
|
2380
|
+
className: clsx16(
|
|
2389
2381
|
"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]",
|
|
2390
2382
|
isActive("translate") && "!bg-[#636363] text-white"
|
|
2391
2383
|
),
|
|
@@ -2441,7 +2433,7 @@ var ChatMessageItem = ({
|
|
|
2441
2433
|
setTranslated((v) => !v);
|
|
2442
2434
|
onTranslate?.();
|
|
2443
2435
|
};
|
|
2444
|
-
return /* @__PURE__ */ jsx("div", { className:
|
|
2436
|
+
return /* @__PURE__ */ jsx("div", { className: clsx16("mb-4", className), "data-msg-id": id, children: /* @__PURE__ */ jsxs("div", { className: clsx16("flex items-end gap-3", mine && "justify-end"), children: [
|
|
2445
2437
|
!mine && /* @__PURE__ */ jsx("div", { className: `${showStatus ? "mb-5" : "mb-0"}`, children: initialSrc ? /* @__PURE__ */ jsxs("div", { className: "relative h-10 w-10 shrink-0 rounded-full border border-[#F1F1F1]", children: [
|
|
2446
2438
|
/* @__PURE__ */ jsx(
|
|
2447
2439
|
"img",
|
|
@@ -2463,19 +2455,19 @@ var ChatMessageItem = ({
|
|
|
2463
2455
|
]
|
|
2464
2456
|
}
|
|
2465
2457
|
) }),
|
|
2466
|
-
/* @__PURE__ */ jsxs("div", { className:
|
|
2458
|
+
/* @__PURE__ */ jsxs("div", { className: clsx16("flex flex-col gap-1 w-full"), children: [
|
|
2467
2459
|
/* @__PURE__ */ jsx(
|
|
2468
2460
|
"div",
|
|
2469
2461
|
{
|
|
2470
|
-
className:
|
|
2462
|
+
className: clsx16(
|
|
2471
2463
|
" text-xs font-light text-[#636363]",
|
|
2472
2464
|
mine ? "text-right" : "text-left"
|
|
2473
2465
|
),
|
|
2474
2466
|
children: time
|
|
2475
2467
|
}
|
|
2476
2468
|
),
|
|
2477
|
-
/* @__PURE__ */ jsxs("div", { className:
|
|
2478
|
-
/* @__PURE__ */ jsx("div", { className:
|
|
2469
|
+
/* @__PURE__ */ jsxs("div", { className: clsx16("flex flex-col gap-1 w-full", mine ? "items-end" : "items-start"), children: [
|
|
2470
|
+
/* @__PURE__ */ jsx("div", { className: clsx16("flex w-full", mine ? "justify-end" : "justify-start"), children: replyTo && /* @__PURE__ */ jsx(ReplyCard_default, { jumpOnClick: true, refMsg: replyTo, compact: true, className: "mb-1" }) }),
|
|
2479
2471
|
businessCard ? /* @__PURE__ */ jsx(ChatBusinessCard_default, { mine, card: businessCard }) : null,
|
|
2480
2472
|
addressCard ? /* @__PURE__ */ jsx(ChatAddressCard_default, { mine, card: addressCard }) : null,
|
|
2481
2473
|
images?.length ? /* @__PURE__ */ jsx(MessageHoverActions_default, { mine, onReply, isItemButton: ["replay"], children: /* @__PURE__ */ jsx(ChatBubbleImages_default, { images }) }) : null,
|
|
@@ -2492,7 +2484,7 @@ var ChatMessageItem = ({
|
|
|
2492
2484
|
children: /* @__PURE__ */ jsx(ChatBubbleText_default, { mine, text: displayText })
|
|
2493
2485
|
}
|
|
2494
2486
|
) : null,
|
|
2495
|
-
showStatus && /* @__PURE__ */ jsx("div", { className:
|
|
2487
|
+
showStatus && /* @__PURE__ */ jsx("div", { className: clsx16("text-xs text-[#9AA1A9]", mine ? "text-right" : "text-left"), children: status })
|
|
2496
2488
|
] })
|
|
2497
2489
|
] })
|
|
2498
2490
|
] }) });
|
|
@@ -2502,15 +2494,14 @@ var ChatScroll = ({
|
|
|
2502
2494
|
top,
|
|
2503
2495
|
children,
|
|
2504
2496
|
className,
|
|
2497
|
+
style,
|
|
2505
2498
|
bottomAlignWhenShort = false,
|
|
2506
2499
|
scrollKey
|
|
2507
2500
|
}) => {
|
|
2508
2501
|
const ref = React10.useRef(null);
|
|
2509
2502
|
const scrollToBottom = React10.useCallback(() => {
|
|
2510
2503
|
const el = ref.current;
|
|
2511
|
-
if (!el)
|
|
2512
|
-
return;
|
|
2513
|
-
}
|
|
2504
|
+
if (!el) return;
|
|
2514
2505
|
el.scrollTop = el.scrollHeight;
|
|
2515
2506
|
}, []);
|
|
2516
2507
|
React10.useEffect(() => {
|
|
@@ -2523,17 +2514,12 @@ var ChatScroll = ({
|
|
|
2523
2514
|
{
|
|
2524
2515
|
ref,
|
|
2525
2516
|
"data-chat-scroll": true,
|
|
2526
|
-
className:
|
|
2527
|
-
|
|
2528
|
-
className
|
|
2529
|
-
),
|
|
2517
|
+
className: `h-full min-h-0 overflow-y-auto bg-white p-4 custom-scroll-hidden${className ? ` ${className}` : ""}`,
|
|
2518
|
+
style,
|
|
2530
2519
|
children: /* @__PURE__ */ jsxs(
|
|
2531
2520
|
"div",
|
|
2532
2521
|
{
|
|
2533
|
-
className:
|
|
2534
|
-
"min-h-full flex flex-col",
|
|
2535
|
-
bottomAlignWhenShort ? "justify-end" : "justify-start"
|
|
2536
|
-
),
|
|
2522
|
+
className: `min-h-full flex flex-col${bottomAlignWhenShort ? " justify-end" : " justify-start"}`,
|
|
2537
2523
|
children: [
|
|
2538
2524
|
top,
|
|
2539
2525
|
children
|
|
@@ -2580,7 +2566,7 @@ var ChatThreadItem = ({
|
|
|
2580
2566
|
"button",
|
|
2581
2567
|
{
|
|
2582
2568
|
onClick,
|
|
2583
|
-
className:
|
|
2569
|
+
className: clsx16(
|
|
2584
2570
|
"relative w-full text-left px-5 py-2 hover:bg-[#f8f8f8] focus:outline-none h-[75px]",
|
|
2585
2571
|
active && "bg-[#f8f8f8]",
|
|
2586
2572
|
className
|
|
@@ -2633,19 +2619,20 @@ var ChatThreadItem_default = ChatThreadItem;
|
|
|
2633
2619
|
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: {} };
|
|
2634
2620
|
var Lottie2 = _Lottie.default ?? _Lottie;
|
|
2635
2621
|
var TypingIndicator = ({
|
|
2636
|
-
size = 18,
|
|
2637
2622
|
loop = true,
|
|
2638
2623
|
autoplay = true,
|
|
2639
2624
|
className,
|
|
2640
2625
|
ariaLabel = "Typing\u2026",
|
|
2641
|
-
avatarSize = 40
|
|
2626
|
+
avatarSize = 40,
|
|
2627
|
+
style
|
|
2642
2628
|
}) => {
|
|
2643
2629
|
return /* @__PURE__ */ jsxs(
|
|
2644
2630
|
"div",
|
|
2645
2631
|
{
|
|
2646
|
-
className: cn("relative flex items-end gap-[6px]", className),
|
|
2647
2632
|
role: "status",
|
|
2648
2633
|
"aria-label": ariaLabel,
|
|
2634
|
+
className: `relative flex items-end gap-[6px]${className ? ` ${className}` : ""}`,
|
|
2635
|
+
style,
|
|
2649
2636
|
children: [
|
|
2650
2637
|
/* @__PURE__ */ jsxs(
|
|
2651
2638
|
"div",
|
|
@@ -2661,7 +2648,7 @@ var TypingIndicator = ({
|
|
|
2661
2648
|
className: "h-full w-full rounded-full object-cover"
|
|
2662
2649
|
}
|
|
2663
2650
|
),
|
|
2664
|
-
/* @__PURE__ */ jsx("span", { className: "absolute bottom-
|
|
2651
|
+
/* @__PURE__ */ jsx("span", { className: "absolute bottom-0 right-0 h-[11.25px] w-[11.25px] rounded-full bg-[#328545] ring-1 ring-white" })
|
|
2665
2652
|
]
|
|
2666
2653
|
}
|
|
2667
2654
|
),
|
|
@@ -2879,7 +2866,21 @@ var avatarBgByInitial = {
|
|
|
2879
2866
|
B: "#F0EDEB",
|
|
2880
2867
|
b: "#F0EDEB"
|
|
2881
2868
|
};
|
|
2882
|
-
var
|
|
2869
|
+
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%)";
|
|
2870
|
+
function getThemeAttr(theme) {
|
|
2871
|
+
if (!theme || theme === "marketplace") return "marketplace";
|
|
2872
|
+
if (theme === "admin") return "admin";
|
|
2873
|
+
return "custom";
|
|
2874
|
+
}
|
|
2875
|
+
function getThemeVars(theme) {
|
|
2876
|
+
if (!theme || theme === "marketplace" || theme === "admin") return {};
|
|
2877
|
+
const vars = {};
|
|
2878
|
+
if (theme.primary) vars["--color-banbox-primary"] = theme.primary;
|
|
2879
|
+
if (theme.primaryActive) vars["--color-banbox-primary-active"] = theme.primaryActive;
|
|
2880
|
+
if (theme.surfaceLow) vars["--color-banbox-surface-container-low"] = theme.surfaceLow;
|
|
2881
|
+
return vars;
|
|
2882
|
+
}
|
|
2883
|
+
var InboxPopup = ({ adapter, uiCallbacks, theme }) => {
|
|
2883
2884
|
const { close, selectThread, selectedThreadId, reference } = useChatUI();
|
|
2884
2885
|
const { isOpen: isGalleryOpen, closeGallery } = useGallery();
|
|
2885
2886
|
const [threads, setThreads] = useState(() => adapter.threads.list(reference));
|
|
@@ -2924,16 +2925,12 @@ var InboxPopup = ({ adapter, uiCallbacks }) => {
|
|
|
2924
2925
|
const idButtonLabel = activeThread?.orderId ? "View Order" : activeThread?.inquiryId ? "View Inquiry" : void 0;
|
|
2925
2926
|
const idValue = activeThread?.orderId ?? activeThread?.inquiryId ?? void 0;
|
|
2926
2927
|
const [showDelete, setShowDelete] = useState(false);
|
|
2927
|
-
const [isLoading, setIsLoading] = useState(false);
|
|
2928
2928
|
const scrollKey = `${activeId}-${messages.length}-${rev}`;
|
|
2929
|
-
const prevActiveIdRef =
|
|
2929
|
+
const prevActiveIdRef = useRef(activeId);
|
|
2930
2930
|
useEffect(() => {
|
|
2931
2931
|
if (prevActiveIdRef.current !== activeId) {
|
|
2932
2932
|
prevActiveIdRef.current = activeId;
|
|
2933
|
-
setIsLoading(true);
|
|
2934
|
-
const t = setTimeout(() => setIsLoading(false), 300);
|
|
2935
2933
|
if (activeId) adapter.threads.markRead?.(activeId);
|
|
2936
|
-
return () => clearTimeout(t);
|
|
2937
2934
|
}
|
|
2938
2935
|
}, [activeId, adapter]);
|
|
2939
2936
|
const toRef2 = (m) => ({
|
|
@@ -2955,19 +2952,21 @@ var InboxPopup = ({ adapter, uiCallbacks }) => {
|
|
|
2955
2952
|
if (nextId) selectThread(nextId);
|
|
2956
2953
|
setReplyTo(void 0);
|
|
2957
2954
|
setShowDelete(false);
|
|
2958
|
-
uiCallbacks?.showToast?.({
|
|
2959
|
-
type: "success",
|
|
2960
|
-
title: "Chat Deleted",
|
|
2961
|
-
message: "The chat has been deleted successfully."
|
|
2962
|
-
});
|
|
2955
|
+
uiCallbacks?.showToast?.({ type: "success", title: "Chat Deleted", message: "The chat has been deleted successfully." });
|
|
2963
2956
|
};
|
|
2957
|
+
const filteredThreads = threads.filter((t) => {
|
|
2958
|
+
if (!searchQuery.trim()) return true;
|
|
2959
|
+
const q = searchQuery.toLowerCase();
|
|
2960
|
+
return t.title.toLowerCase().includes(q) || t.last?.toLowerCase().includes(q) || t.orderId?.toLowerCase().includes(q) || t.inquiryId?.toLowerCase().includes(q);
|
|
2961
|
+
});
|
|
2964
2962
|
return /* @__PURE__ */ jsxs("div", { className: "fixed bottom-4 right-4 z-[10002]", children: [
|
|
2965
2963
|
/* @__PURE__ */ jsx(
|
|
2966
2964
|
motion.button,
|
|
2967
2965
|
{
|
|
2968
2966
|
"aria-label": "Close chat",
|
|
2969
2967
|
onClick: close,
|
|
2970
|
-
className: "fixed inset-0",
|
|
2968
|
+
className: "fixed inset-0 cursor-auto!",
|
|
2969
|
+
style: { background: "transparent", border: "none" },
|
|
2971
2970
|
initial: { opacity: 0 },
|
|
2972
2971
|
animate: { opacity: 1 },
|
|
2973
2972
|
exit: { opacity: 0 },
|
|
@@ -2979,12 +2978,14 @@ var InboxPopup = ({ adapter, uiCallbacks }) => {
|
|
|
2979
2978
|
{
|
|
2980
2979
|
role: "dialog",
|
|
2981
2980
|
"aria-modal": "true",
|
|
2982
|
-
|
|
2981
|
+
"data-theme": getThemeAttr(theme),
|
|
2982
|
+
className: "banbox-chat-root relative rounded-[20px] p-[3px]",
|
|
2983
2983
|
style: {
|
|
2984
2984
|
width: 800,
|
|
2985
2985
|
height: 650,
|
|
2986
2986
|
boxShadow: "0px 2px 12px 0px #3B33331A",
|
|
2987
|
-
background:
|
|
2987
|
+
background: GRADIENT_BORDER,
|
|
2988
|
+
...getThemeVars(theme)
|
|
2988
2989
|
},
|
|
2989
2990
|
initial: { x: "110%" },
|
|
2990
2991
|
animate: { x: 0 },
|
|
@@ -2997,7 +2998,7 @@ var InboxPopup = ({ adapter, uiCallbacks }) => {
|
|
|
2997
2998
|
style: { overscrollBehavior: "contain" },
|
|
2998
2999
|
children: [
|
|
2999
3000
|
/* @__PURE__ */ jsx("div", { className: "pointer-events-none absolute inset-0 rounded-[14px] ring-1 ring-[#2F80ED]/40" }),
|
|
3000
|
-
/* @__PURE__ */ jsxs("div", { className: "grid h-full min-h-0 grid-cols-[
|
|
3001
|
+
/* @__PURE__ */ jsxs("div", { className: "grid h-full min-h-0 grid-cols-[1fr_310px]", children: [
|
|
3001
3002
|
/* @__PURE__ */ jsxs("div", { className: "flex h-full min-h-0 flex-col border-r border-[#9BBCCF]", children: [
|
|
3002
3003
|
/* @__PURE__ */ jsx("div", { className: "h-[64px] shrink-0", children: /* @__PURE__ */ jsx(
|
|
3003
3004
|
ChatHeader,
|
|
@@ -3074,13 +3075,9 @@ var InboxPopup = ({ adapter, uiCallbacks }) => {
|
|
|
3074
3075
|
activeId
|
|
3075
3076
|
) })
|
|
3076
3077
|
] }),
|
|
3077
|
-
/* @__PURE__ */ jsxs("div", { className: "h-full min-h-0", children: [
|
|
3078
|
-
/* @__PURE__ */ jsx(ChatListHeader_default, { onClose: close, onSearchChange: (val) => setSearchQuery(val) }),
|
|
3079
|
-
/* @__PURE__ */ jsx("div", { className: "h-
|
|
3080
|
-
if (!searchQuery.trim()) return true;
|
|
3081
|
-
const q = searchQuery.toLowerCase();
|
|
3082
|
-
return t.title.toLowerCase().includes(q) || t.last?.toLowerCase().includes(q) || t.orderId?.toLowerCase().includes(q) || t.inquiryId?.toLowerCase().includes(q);
|
|
3083
|
-
}).map((t) => {
|
|
3078
|
+
/* @__PURE__ */ jsxs("div", { className: "flex h-full min-h-0 flex-col", children: [
|
|
3079
|
+
/* @__PURE__ */ jsx("div", { className: "shrink-0", children: /* @__PURE__ */ jsx(ChatListHeader_default, { onClose: close, onSearchChange: (val) => setSearchQuery(val) }) }),
|
|
3080
|
+
/* @__PURE__ */ jsx("div", { className: "flex-1 min-h-0 overflow-y-auto custom-scroll", children: filteredThreads.map((t) => {
|
|
3084
3081
|
const status = t.status ?? (t.unread && t.unread > 0 ? { kind: "new", count: t.unread } : { kind: "seen" });
|
|
3085
3082
|
return /* @__PURE__ */ jsx(
|
|
3086
3083
|
ChatThreadItem_default,
|
|
@@ -3115,6 +3112,7 @@ var InboxPopup = ({ adapter, uiCallbacks }) => {
|
|
|
3115
3112
|
] });
|
|
3116
3113
|
};
|
|
3117
3114
|
var InboxPopup_default = InboxPopup;
|
|
3115
|
+
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%)";
|
|
3118
3116
|
function coalesceThreadId(reference, threads) {
|
|
3119
3117
|
const referenceId = reference?.id;
|
|
3120
3118
|
if (reference?.kind === "quotation") {
|
|
@@ -3133,7 +3131,20 @@ function toRef(m) {
|
|
|
3133
3131
|
audio: m.audio
|
|
3134
3132
|
};
|
|
3135
3133
|
}
|
|
3136
|
-
|
|
3134
|
+
function getThemeAttr2(theme) {
|
|
3135
|
+
if (!theme || theme === "marketplace") return "marketplace";
|
|
3136
|
+
if (theme === "admin") return "admin";
|
|
3137
|
+
return "custom";
|
|
3138
|
+
}
|
|
3139
|
+
function getThemeVars2(theme) {
|
|
3140
|
+
if (!theme || theme === "marketplace" || theme === "admin") return {};
|
|
3141
|
+
const vars = {};
|
|
3142
|
+
if (theme.primary) vars["--color-banbox-primary"] = theme.primary;
|
|
3143
|
+
if (theme.primaryActive) vars["--color-banbox-primary-active"] = theme.primaryActive;
|
|
3144
|
+
if (theme.surfaceLow) vars["--color-banbox-surface-container-low"] = theme.surfaceLow;
|
|
3145
|
+
return vars;
|
|
3146
|
+
}
|
|
3147
|
+
var SinglePopup = ({ adapter, uiCallbacks, theme }) => {
|
|
3137
3148
|
const { close, reference } = useChatUI();
|
|
3138
3149
|
const threads = adapter.threads.list(reference);
|
|
3139
3150
|
const initialThreadId = React10.useMemo(
|
|
@@ -3167,7 +3178,6 @@ var SinglePopup = ({ adapter, uiCallbacks }) => {
|
|
|
3167
3178
|
setScrollKey(Date.now());
|
|
3168
3179
|
setReplyTo(void 0);
|
|
3169
3180
|
}, [activeId, adapter]);
|
|
3170
|
-
const statusText = activeThread?.status?.kind === "seen" ? "Seen" : "Delivered";
|
|
3171
3181
|
return /* @__PURE__ */ jsxs("div", { className: "fixed bottom-4 right-4 z-[10002]", children: [
|
|
3172
3182
|
/* @__PURE__ */ jsx(
|
|
3173
3183
|
motion.button,
|
|
@@ -3175,6 +3185,7 @@ var SinglePopup = ({ adapter, uiCallbacks }) => {
|
|
|
3175
3185
|
"aria-label": "Close chat",
|
|
3176
3186
|
onClick: close,
|
|
3177
3187
|
className: "fixed inset-0 cursor-auto!",
|
|
3188
|
+
style: { background: "transparent", border: "none" },
|
|
3178
3189
|
initial: { opacity: 0 },
|
|
3179
3190
|
animate: { opacity: 1 },
|
|
3180
3191
|
exit: { opacity: 0 },
|
|
@@ -3186,10 +3197,12 @@ var SinglePopup = ({ adapter, uiCallbacks }) => {
|
|
|
3186
3197
|
{
|
|
3187
3198
|
role: "dialog",
|
|
3188
3199
|
"aria-modal": "true",
|
|
3189
|
-
|
|
3200
|
+
"data-theme": getThemeAttr2(theme),
|
|
3201
|
+
className: "banbox-chat-root relative h-[650px] w-[450px] rounded-[20px] p-[2px]",
|
|
3190
3202
|
style: {
|
|
3191
3203
|
boxShadow: "0px 2px 12px 0px #3B33331A",
|
|
3192
|
-
background:
|
|
3204
|
+
background: GRADIENT_BORDER2,
|
|
3205
|
+
...getThemeVars2(theme)
|
|
3193
3206
|
},
|
|
3194
3207
|
initial: { x: "110%" },
|
|
3195
3208
|
animate: { x: 0 },
|
|
@@ -3221,40 +3234,48 @@ var SinglePopup = ({ adapter, uiCallbacks }) => {
|
|
|
3221
3234
|
{
|
|
3222
3235
|
type: "button",
|
|
3223
3236
|
onClick: close,
|
|
3224
|
-
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-[
|
|
3237
|
+
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",
|
|
3225
3238
|
children: /* @__PURE__ */ jsx(ChatXIcon, { className: "h-6 w-6" })
|
|
3226
3239
|
}
|
|
3227
3240
|
)
|
|
3228
3241
|
}
|
|
3229
3242
|
) }),
|
|
3230
|
-
/* @__PURE__ */ jsx("div", { className: "flex-1 min-h-0", children: /* @__PURE__ */ jsxs(
|
|
3231
|
-
|
|
3232
|
-
|
|
3233
|
-
|
|
3234
|
-
|
|
3235
|
-
|
|
3236
|
-
|
|
3237
|
-
|
|
3238
|
-
mine
|
|
3239
|
-
|
|
3240
|
-
|
|
3241
|
-
|
|
3242
|
-
|
|
3243
|
-
|
|
3244
|
-
|
|
3245
|
-
|
|
3246
|
-
|
|
3247
|
-
|
|
3248
|
-
|
|
3249
|
-
|
|
3250
|
-
|
|
3251
|
-
|
|
3252
|
-
|
|
3253
|
-
|
|
3254
|
-
|
|
3255
|
-
|
|
3256
|
-
|
|
3257
|
-
|
|
3243
|
+
/* @__PURE__ */ jsx("div", { className: "flex-1 min-h-0", children: /* @__PURE__ */ jsxs(
|
|
3244
|
+
ChatScroll_default,
|
|
3245
|
+
{
|
|
3246
|
+
className: "h-full",
|
|
3247
|
+
bottomAlignWhenShort: false,
|
|
3248
|
+
scrollKey,
|
|
3249
|
+
children: [
|
|
3250
|
+
messages.map((m, idx) => {
|
|
3251
|
+
const mine = m.author === "you";
|
|
3252
|
+
const isLast = idx === messages.length - 1;
|
|
3253
|
+
return /* @__PURE__ */ jsx(
|
|
3254
|
+
ChatMessageItem_default,
|
|
3255
|
+
{
|
|
3256
|
+
id: m.id,
|
|
3257
|
+
mine,
|
|
3258
|
+
time: m.time ?? "",
|
|
3259
|
+
authorInitial: typeof m.author === "string" ? m.author : "U",
|
|
3260
|
+
text: m.text ?? m.content,
|
|
3261
|
+
businessCard: m.businessCard,
|
|
3262
|
+
addressCard: m.addressCard,
|
|
3263
|
+
images: m.images,
|
|
3264
|
+
files: m.files,
|
|
3265
|
+
audio: m.audio,
|
|
3266
|
+
replyTo: m.replyTo,
|
|
3267
|
+
initialSrc: m.avatarSrc,
|
|
3268
|
+
showStatus: isLast,
|
|
3269
|
+
status: activeThread?.status?.kind === "seen" ? "Seen" : "Delivered",
|
|
3270
|
+
onReply: () => setReplyTo(toRef(m))
|
|
3271
|
+
},
|
|
3272
|
+
m.id
|
|
3273
|
+
);
|
|
3274
|
+
}),
|
|
3275
|
+
/* @__PURE__ */ jsx("div", { className: "flex items-center justify-start", children: /* @__PURE__ */ jsx(TypingIndicator_default, {}) })
|
|
3276
|
+
]
|
|
3277
|
+
}
|
|
3278
|
+
) }),
|
|
3258
3279
|
/* @__PURE__ */ jsx("div", { className: "shrink-0", children: /* @__PURE__ */ jsx(
|
|
3259
3280
|
ChatFooter_default,
|
|
3260
3281
|
{
|
|
@@ -3275,7 +3296,7 @@ var SinglePopup = ({ adapter, uiCallbacks }) => {
|
|
|
3275
3296
|
] });
|
|
3276
3297
|
};
|
|
3277
3298
|
var SinglePopup_default = SinglePopup;
|
|
3278
|
-
function ChatRoot({ adapter, uiCallbacks }) {
|
|
3299
|
+
function ChatRoot({ adapter, uiCallbacks, theme }) {
|
|
3279
3300
|
const { isOpen, variant } = useChatUI();
|
|
3280
3301
|
useDisableBodyScroll(isOpen);
|
|
3281
3302
|
if (typeof window === "undefined") {
|
|
@@ -3283,19 +3304,20 @@ function ChatRoot({ adapter, uiCallbacks }) {
|
|
|
3283
3304
|
}
|
|
3284
3305
|
return createPortal(
|
|
3285
3306
|
// GalleryProvider is scoped to the chat only.
|
|
3286
|
-
// It is completely separate from the host app's own gallery context.
|
|
3287
3307
|
/* @__PURE__ */ jsx(GalleryProvider, { children: /* @__PURE__ */ jsx(AnimatePresence, { mode: "wait", children: isOpen && (variant === "inbox" ? /* @__PURE__ */ jsx(
|
|
3288
3308
|
InboxPopup_default,
|
|
3289
3309
|
{
|
|
3290
3310
|
adapter,
|
|
3291
|
-
uiCallbacks
|
|
3311
|
+
uiCallbacks,
|
|
3312
|
+
theme
|
|
3292
3313
|
},
|
|
3293
3314
|
"inbox"
|
|
3294
3315
|
) : /* @__PURE__ */ jsx(
|
|
3295
3316
|
SinglePopup_default,
|
|
3296
3317
|
{
|
|
3297
3318
|
adapter,
|
|
3298
|
-
uiCallbacks
|
|
3319
|
+
uiCallbacks,
|
|
3320
|
+
theme
|
|
3299
3321
|
},
|
|
3300
3322
|
"single"
|
|
3301
3323
|
)) }) }),
|