@banbox/chat 1.0.4 → 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.js CHANGED
@@ -1603,27 +1603,12 @@ var ChatFooter = ({
1603
1603
  ] });
1604
1604
  };
1605
1605
  var ChatFooter_default = ChatFooter;
1606
- function ChatHeader({ left, right, below }) {
1606
+ function ChatHeader({ left, right, below, className }) {
1607
1607
  return /* @__PURE__ */ jsxs("div", { children: [
1608
- /* @__PURE__ */ jsxs(
1609
- "div",
1610
- {
1611
- style: {
1612
- borderBottom: "1px solid #e1e1e1",
1613
- height: 64,
1614
- display: "flex",
1615
- alignItems: "flex-start",
1616
- justifyContent: "space-between",
1617
- paddingLeft: 16,
1618
- paddingRight: 16,
1619
- paddingTop: 10
1620
- },
1621
- children: [
1622
- /* @__PURE__ */ jsx("div", { style: { display: "flex", alignItems: "flex-start", gap: 12 }, children: left }),
1623
- right
1624
- ]
1625
- }
1626
- ),
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
+ /* @__PURE__ */ jsx("div", { className: "flex items-start gap-3", children: left }),
1610
+ right
1611
+ ] }),
1627
1612
  below && /* @__PURE__ */ jsx(Fragment, { children: below })
1628
1613
  ] });
1629
1614
  }
@@ -1766,7 +1751,7 @@ var ChatInquiryBar = ({ id, onView, className, label, buttonLabel }) => {
1766
1751
  );
1767
1752
  };
1768
1753
  var ChatInquiryBar_default = ChatInquiryBar;
1769
- var ChatListHeader = ({ onClose, onSearchChange }) => {
1754
+ var ChatListHeader = ({ className, onClose, onSearchChange }) => {
1770
1755
  const [searching, setSearching] = React10.useState(false);
1771
1756
  const [q, setQ] = React10.useState("");
1772
1757
  const inputRef = React10.useRef(null);
@@ -1798,117 +1783,85 @@ var ChatListHeader = ({ onClose, onSearchChange }) => {
1798
1783
  inFromLeft: { opacity: 1, x: 0, transition: { duration: 0.18, ease: [0.16, 1, 0.3, 1] } },
1799
1784
  outToRight: { opacity: 0, x: 24, transition: { duration: 0.16, ease: [0.4, 0, 1, 1] } }
1800
1785
  };
1801
- const btnStyle = {
1802
- height: 36,
1803
- width: 36,
1804
- display: "flex",
1805
- alignItems: "center",
1806
- justifyContent: "center",
1807
- borderRadius: "50%",
1808
- border: "none",
1809
- background: "transparent",
1810
- cursor: "pointer"
1811
- };
1812
- return /* @__PURE__ */ jsx(
1813
- "div",
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,
1814
1788
  {
1815
- style: {
1816
- height: 64,
1817
- borderBottom: "1px solid #ededed",
1818
- display: "flex",
1819
- alignItems: "center",
1820
- paddingLeft: 20,
1821
- paddingRight: 20
1822
- },
1823
- children: /* @__PURE__ */ jsx(AnimatePresence, { initial: false, mode: "wait", children: !searching ? /* @__PURE__ */ jsxs(
1824
- motion.div,
1825
- {
1826
- style: { display: "flex", width: "100%", alignItems: "center", justifyContent: "space-between" },
1827
- initial: { opacity: 0, x: -24 },
1828
- animate: "inFromLeft",
1829
- exit: "outToLeft",
1830
- variants,
1831
- children: [
1832
- /* @__PURE__ */ jsxs("div", { style: { display: "flex", alignItems: "center", gap: 8, color: "#2c2c2c" }, children: [
1833
- /* @__PURE__ */ jsx(MessageIcon, { className: "w-6 h-6" }),
1834
- /* @__PURE__ */ jsx("span", { style: { fontSize: 22, fontWeight: 600 }, children: "Messenger" })
1835
- ] }),
1836
- /* @__PURE__ */ jsxs("div", { style: { display: "flex", alignItems: "center", gap: 8 }, children: [
1837
- /* @__PURE__ */ jsx("button", { title: "Search", onClick: () => setSearching(true), style: btnStyle, children: /* @__PURE__ */ jsx(ChatSearchIcon, { className: "w-5 h-5" }) }),
1838
- /* @__PURE__ */ jsx("button", { title: "Close", onClick: onClose, style: btnStyle, children: /* @__PURE__ */ jsx(ChatXIcon, { className: "w-6 h-6" }) })
1839
- ] })
1840
- ]
1841
- },
1842
- "normal"
1843
- ) : /* @__PURE__ */ jsx(
1844
- motion.div,
1845
- {
1846
- style: { display: "flex", width: "100%", alignItems: "center", gap: 12 },
1847
- initial: { opacity: 0, x: 24 },
1848
- animate: "inFromRight",
1849
- exit: "outToRight",
1850
- variants,
1851
- children: /* @__PURE__ */ jsxs(
1852
- "div",
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(
1810
+ "button",
1811
+ {
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",
1853
1836
  {
1854
- style: {
1855
- display: "flex",
1856
- flex: 1,
1857
- height: 40,
1858
- alignItems: "center",
1859
- borderRadius: 9999,
1860
- border: "1px solid #6A6A6A",
1861
- backgroundColor: "#fff",
1862
- padding: "0 4px",
1863
- gap: 6
1837
+ ref: inputRef,
1838
+ value: q,
1839
+ onChange: (e) => {
1840
+ setQ(e.target.value);
1841
+ onSearchChange?.(e.target.value);
1864
1842
  },
1865
- children: [
1866
- /* @__PURE__ */ jsxs("div", { style: { display: "flex", alignItems: "center", flex: 1, marginLeft: 12 }, children: [
1867
- /* @__PURE__ */ jsx("span", { style: { marginRight: 8, color: "#929292", flexShrink: 0 }, children: /* @__PURE__ */ jsx(ChatSearchIcon, { className: "w-5 h-5" }) }),
1868
- /* @__PURE__ */ jsx("span", { style: { marginRight: 8, height: 24, width: 1, flexShrink: 0, backgroundColor: "#e1e1e1" } }),
1869
- /* @__PURE__ */ jsx(
1870
- "input",
1871
- {
1872
- ref: inputRef,
1873
- value: q,
1874
- onChange: (e) => {
1875
- setQ(e.target.value);
1876
- onSearchChange?.(e.target.value);
1877
- },
1878
- placeholder: "Search",
1879
- style: {
1880
- flex: 1,
1881
- height: "100%",
1882
- background: "transparent",
1883
- fontSize: 15,
1884
- outline: "none",
1885
- border: "none",
1886
- color: "#2c2c2c"
1887
- }
1888
- }
1889
- )
1890
- ] }),
1891
- /* @__PURE__ */ jsx(
1892
- "button",
1893
- {
1894
- title: "Close search",
1895
- onClick: () => {
1896
- setSearching(false);
1897
- setQ("");
1898
- onSearchChange?.("");
1899
- },
1900
- style: { ...btnStyle, height: 32, width: 32 },
1901
- children: /* @__PURE__ */ jsx(ChatXIcon, { className: "w-5 h-5" })
1902
- }
1903
- )
1904
- ]
1843
+ placeholder: "Search",
1844
+ className: "h-full w-full flex-1 bg-transparent text-[15px] outline-none placeholder:text-[#9C9C9C] border-none"
1905
1845
  }
1906
1846
  )
1907
- },
1908
- "search"
1909
- ) })
1910
- }
1911
- );
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"
1864
+ ) }) }) });
1912
1865
  };
1913
1866
  var ChatListHeader_default = ChatListHeader;
1914
1867
  var Row = ({ icon, label, value, highlight }) => {
@@ -2540,6 +2493,7 @@ var ChatMessageItem_default = ChatMessageItem;
2540
2493
  var ChatScroll = ({
2541
2494
  top,
2542
2495
  children,
2496
+ className,
2543
2497
  style,
2544
2498
  bottomAlignWhenShort = false,
2545
2499
  scrollKey
@@ -2547,9 +2501,7 @@ var ChatScroll = ({
2547
2501
  const ref = React10.useRef(null);
2548
2502
  const scrollToBottom = React10.useCallback(() => {
2549
2503
  const el = ref.current;
2550
- if (!el) {
2551
- return;
2552
- }
2504
+ if (!el) return;
2553
2505
  el.scrollTop = el.scrollHeight;
2554
2506
  }, []);
2555
2507
  React10.useEffect(() => {
@@ -2562,26 +2514,12 @@ var ChatScroll = ({
2562
2514
  {
2563
2515
  ref,
2564
2516
  "data-chat-scroll": true,
2565
- style: {
2566
- height: "100%",
2567
- minHeight: 0,
2568
- overflowY: "auto",
2569
- backgroundColor: "#fff",
2570
- padding: 16,
2571
- // custom scrollbar — hide track for clean look
2572
- scrollbarWidth: "thin",
2573
- scrollbarColor: "#d1d5db transparent",
2574
- ...style
2575
- },
2517
+ className: `h-full min-h-0 overflow-y-auto bg-white p-4 custom-scroll-hidden${className ? ` ${className}` : ""}`,
2518
+ style,
2576
2519
  children: /* @__PURE__ */ jsxs(
2577
2520
  "div",
2578
2521
  {
2579
- style: {
2580
- minHeight: "100%",
2581
- display: "flex",
2582
- flexDirection: "column",
2583
- justifyContent: bottomAlignWhenShort ? "flex-end" : "flex-start"
2584
- },
2522
+ className: `min-h-full flex flex-col${bottomAlignWhenShort ? " justify-end" : " justify-start"}`,
2585
2523
  children: [
2586
2524
  top,
2587
2525
  children
@@ -2683,6 +2621,7 @@ var Lottie2 = _Lottie.default ?? _Lottie;
2683
2621
  var TypingIndicator = ({
2684
2622
  loop = true,
2685
2623
  autoplay = true,
2624
+ className,
2686
2625
  ariaLabel = "Typing\u2026",
2687
2626
  avatarSize = 40,
2688
2627
  style
@@ -2692,53 +2631,28 @@ var TypingIndicator = ({
2692
2631
  {
2693
2632
  role: "status",
2694
2633
  "aria-label": ariaLabel,
2695
- style: {
2696
- position: "relative",
2697
- display: "flex",
2698
- alignItems: "flex-end",
2699
- gap: 6,
2700
- ...style
2701
- },
2634
+ className: `relative flex items-end gap-[6px]${className ? ` ${className}` : ""}`,
2635
+ style,
2702
2636
  children: [
2703
2637
  /* @__PURE__ */ jsxs(
2704
2638
  "div",
2705
2639
  {
2706
- style: {
2707
- position: "relative",
2708
- flexShrink: 0,
2709
- borderRadius: "50%",
2710
- border: "1px solid #F1F1F1",
2711
- width: avatarSize,
2712
- height: avatarSize
2713
- },
2640
+ className: "relative shrink-0 rounded-full border border-[#F1F1F1]",
2641
+ style: { width: avatarSize, height: avatarSize },
2714
2642
  children: [
2715
2643
  /* @__PURE__ */ jsx(
2716
2644
  "img",
2717
2645
  {
2718
2646
  src: "/chat/img/girl_support.png",
2719
2647
  alt: "avatar image",
2720
- style: { height: "100%", width: "100%", borderRadius: "50%", objectFit: "cover" }
2648
+ className: "h-full w-full rounded-full object-cover"
2721
2649
  }
2722
2650
  ),
2723
- /* @__PURE__ */ jsx(
2724
- "span",
2725
- {
2726
- style: {
2727
- position: "absolute",
2728
- bottom: 0,
2729
- right: 0,
2730
- height: 11.25,
2731
- width: 11.25,
2732
- borderRadius: "50%",
2733
- backgroundColor: "#328545",
2734
- outline: "2px solid #fff"
2735
- }
2736
- }
2737
- )
2651
+ /* @__PURE__ */ jsx("span", { className: "absolute bottom-0 right-0 h-[11.25px] w-[11.25px] rounded-full bg-[#328545] ring-1 ring-white" })
2738
2652
  ]
2739
2653
  }
2740
2654
  ),
2741
- /* @__PURE__ */ jsx("span", { style: { position: "absolute", bottom: -13, left: 30 }, children: /* @__PURE__ */ jsx(
2655
+ /* @__PURE__ */ jsx("span", { className: "absolute bottom-[-13px] left-[30px]", children: /* @__PURE__ */ jsx(
2742
2656
  Lottie2,
2743
2657
  {
2744
2658
  animationData: typingdotanimation2_default,
@@ -2953,7 +2867,20 @@ var avatarBgByInitial = {
2953
2867
  b: "#F0EDEB"
2954
2868
  };
2955
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%)";
2956
- var InboxPopup = ({ adapter, uiCallbacks }) => {
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 }) => {
2957
2884
  const { close, selectThread, selectedThreadId, reference } = useChatUI();
2958
2885
  const { isOpen: isGalleryOpen, closeGallery } = useGallery();
2959
2886
  const [threads, setThreads] = useState(() => adapter.threads.list(reference));
@@ -3025,24 +2952,21 @@ var InboxPopup = ({ adapter, uiCallbacks }) => {
3025
2952
  if (nextId) selectThread(nextId);
3026
2953
  setReplyTo(void 0);
3027
2954
  setShowDelete(false);
3028
- uiCallbacks?.showToast?.({
3029
- type: "success",
3030
- title: "Chat Deleted",
3031
- message: "The chat has been deleted successfully."
3032
- });
2955
+ uiCallbacks?.showToast?.({ type: "success", title: "Chat Deleted", message: "The chat has been deleted successfully." });
3033
2956
  };
3034
2957
  const filteredThreads = threads.filter((t) => {
3035
2958
  if (!searchQuery.trim()) return true;
3036
2959
  const q = searchQuery.toLowerCase();
3037
2960
  return t.title.toLowerCase().includes(q) || t.last?.toLowerCase().includes(q) || t.orderId?.toLowerCase().includes(q) || t.inquiryId?.toLowerCase().includes(q);
3038
2961
  });
3039
- return /* @__PURE__ */ jsxs("div", { style: { position: "fixed", bottom: 16, right: 16, zIndex: 10002 }, children: [
2962
+ return /* @__PURE__ */ jsxs("div", { className: "fixed bottom-4 right-4 z-[10002]", children: [
3040
2963
  /* @__PURE__ */ jsx(
3041
2964
  motion.button,
3042
2965
  {
3043
2966
  "aria-label": "Close chat",
3044
2967
  onClick: close,
3045
- style: { position: "fixed", inset: 0, background: "transparent", border: "none", cursor: "auto" },
2968
+ className: "fixed inset-0 cursor-auto!",
2969
+ style: { background: "transparent", border: "none" },
3046
2970
  initial: { opacity: 0 },
3047
2971
  animate: { opacity: 1 },
3048
2972
  exit: { opacity: 0 },
@@ -3054,14 +2978,14 @@ var InboxPopup = ({ adapter, uiCallbacks }) => {
3054
2978
  {
3055
2979
  role: "dialog",
3056
2980
  "aria-modal": "true",
2981
+ "data-theme": getThemeAttr(theme),
2982
+ className: "banbox-chat-root relative rounded-[20px] p-[3px]",
3057
2983
  style: {
3058
- position: "relative",
3059
2984
  width: 800,
3060
2985
  height: 650,
3061
- borderRadius: 20,
3062
- padding: 3,
3063
2986
  boxShadow: "0px 2px 12px 0px #3B33331A",
3064
- background: GRADIENT_BORDER
2987
+ background: GRADIENT_BORDER,
2988
+ ...getThemeVars(theme)
3065
2989
  },
3066
2990
  initial: { x: "110%" },
3067
2991
  animate: { x: 0 },
@@ -3070,192 +2994,115 @@ var InboxPopup = ({ adapter, uiCallbacks }) => {
3070
2994
  children: /* @__PURE__ */ jsxs(
3071
2995
  "div",
3072
2996
  {
3073
- style: {
3074
- position: "relative",
3075
- height: "100%",
3076
- width: "100%",
3077
- overflow: "hidden",
3078
- borderRadius: 18,
3079
- backgroundColor: "#fff",
3080
- overscrollBehavior: "contain"
3081
- },
2997
+ className: "relative h-full w-full overflow-hidden rounded-[18px] bg-white",
2998
+ style: { overscrollBehavior: "contain" },
3082
2999
  children: [
3083
- /* @__PURE__ */ jsxs(
3084
- "div",
3085
- {
3086
- style: {
3087
- display: "grid",
3088
- gridTemplateColumns: "1fr 310px",
3089
- height: "100%",
3090
- minHeight: 0
3091
- },
3092
- children: [
3093
- /* @__PURE__ */ jsxs(
3094
- "div",
3095
- {
3096
- style: {
3097
- display: "flex",
3098
- flexDirection: "column",
3099
- height: "100%",
3100
- minHeight: 0,
3101
- borderRight: "1px solid #9BBCCF"
3000
+ /* @__PURE__ */ jsx("div", { className: "pointer-events-none absolute inset-0 rounded-[14px] ring-1 ring-[#2F80ED]/40" }),
3001
+ /* @__PURE__ */ jsxs("div", { className: "grid h-full min-h-0 grid-cols-[1fr_310px]", children: [
3002
+ /* @__PURE__ */ jsxs("div", { className: "flex h-full min-h-0 flex-col border-r border-[#9BBCCF]", children: [
3003
+ /* @__PURE__ */ jsx("div", { className: "h-[64px] shrink-0", children: /* @__PURE__ */ jsx(
3004
+ ChatHeader,
3005
+ {
3006
+ left: activeThread?.avatarSrc ? /* @__PURE__ */ jsx(ChatIdentity_default, { variant: "avatar", src: activeThread.avatarSrc, online, title, subtitle, verified: isVerified, subtitleVariant: "muted" }) : /* @__PURE__ */ jsx(ChatIdentity_default, { variant: "initial", initial, bg: avatarBg, online, title, subtitle, verified: isVerified, subtitleVariant: "muted" }),
3007
+ right: uiCallbacks?.renderKebabMenu?.({
3008
+ pinned: Boolean(activeThread?.pinned),
3009
+ onPinToggle: () => {
3010
+ if (activeId) adapter.threads.pin(activeId, !activeThread?.pinned);
3102
3011
  },
3103
- children: [
3104
- /* @__PURE__ */ jsx("div", { style: { height: 64, flexShrink: 0 }, children: /* @__PURE__ */ jsx(
3105
- ChatHeader,
3106
- {
3107
- left: activeThread?.avatarSrc ? /* @__PURE__ */ jsx(
3108
- ChatIdentity_default,
3109
- {
3110
- variant: "avatar",
3111
- src: activeThread.avatarSrc,
3112
- online,
3113
- title,
3114
- subtitle,
3115
- verified: isVerified,
3116
- subtitleVariant: "muted"
3117
- }
3118
- ) : /* @__PURE__ */ jsx(
3119
- ChatIdentity_default,
3120
- {
3121
- variant: "initial",
3122
- initial,
3123
- bg: avatarBg,
3124
- online,
3125
- title,
3126
- subtitle,
3127
- verified: isVerified,
3128
- subtitleVariant: "muted"
3129
- }
3130
- ),
3131
- right: uiCallbacks?.renderKebabMenu?.({
3132
- pinned: Boolean(activeThread?.pinned),
3133
- onPinToggle: () => {
3134
- if (activeId) adapter.threads.pin(activeId, !activeThread?.pinned);
3135
- },
3136
- onDelete: () => setShowDelete(true)
3137
- }) ?? null
3138
- }
3139
- ) }),
3140
- idValue && /* @__PURE__ */ jsx("div", { style: { flexShrink: 0 }, children: /* @__PURE__ */ jsx(
3141
- ChatInquiryBar_default,
3142
- {
3143
- id: idValue,
3144
- label: idLabel,
3145
- buttonLabel: idButtonLabel,
3146
- onView: () => {
3147
- const type = activeThread?.orderId ? "order" : "inquiry";
3148
- uiCallbacks?.onNavigate?.({ type, id: idValue });
3149
- }
3150
- }
3151
- ) }),
3152
- /* @__PURE__ */ jsxs("div", { style: { flex: 1, minHeight: 0, position: "relative" }, children: [
3153
- /* @__PURE__ */ jsx(
3154
- ChatScroll_default,
3155
- {
3156
- className: "h-full pb-10",
3157
- bottomAlignWhenShort: false,
3158
- scrollKey,
3159
- style: { height: "100%", overflowY: "auto" },
3160
- children: messages.map((m, idx) => {
3161
- const mine = m.author === "you";
3162
- const isLast = idx === messages.length - 1;
3163
- return /* @__PURE__ */ jsx(
3164
- ChatMessageItem_default,
3165
- {
3166
- id: m.id,
3167
- mine,
3168
- time: m.time ?? "",
3169
- authorInitial: typeof m.author === "string" ? m.author : "U",
3170
- avatarBg,
3171
- text: m.text ?? m.content,
3172
- businessCard: m.businessCard,
3173
- addressCard: m.addressCard,
3174
- images: m.images,
3175
- files: m.files,
3176
- audio: m.audio,
3177
- replyTo: m.replyTo,
3178
- showStatus: isLast,
3179
- status: activeThread?.status?.kind === "seen" ? "Seen" : "Delivered",
3180
- onReply: () => setReplyTo(toRef2(m)),
3181
- initialSrc: m.avatarSrc
3182
- },
3183
- m.id
3184
- );
3185
- })
3186
- }
3187
- ),
3188
- /* @__PURE__ */ jsx(
3189
- "div",
3190
- {
3191
- style: {
3192
- position: "absolute",
3193
- left: 0,
3194
- right: 0,
3195
- bottom: 0,
3196
- display: "flex",
3197
- alignItems: "center",
3198
- justifyContent: "flex-start",
3199
- padding: "4px 16px 8px",
3200
- background: "#fff",
3201
- pointerEvents: "none"
3202
- },
3203
- children: /* @__PURE__ */ jsx(TypingIndicator_default, { style: { pointerEvents: "auto" } })
3204
- }
3205
- )
3206
- ] }),
3207
- /* @__PURE__ */ jsx("div", { style: { flexShrink: 0 }, children: /* @__PURE__ */ jsx(
3208
- ChatFooter_default,
3012
+ onDelete: () => setShowDelete(true)
3013
+ }) ?? null
3014
+ }
3015
+ ) }),
3016
+ idValue && /* @__PURE__ */ jsx("div", { className: "shrink-0", children: /* @__PURE__ */ jsx(
3017
+ ChatInquiryBar_default,
3018
+ {
3019
+ id: idValue,
3020
+ label: idLabel,
3021
+ buttonLabel: idButtonLabel,
3022
+ onView: () => {
3023
+ const type = activeThread?.orderId ? "order" : "inquiry";
3024
+ uiCallbacks?.onNavigate?.({ type, id: idValue });
3025
+ }
3026
+ }
3027
+ ) }),
3028
+ /* @__PURE__ */ jsx("div", { className: "flex-1 min-h-0", children: /* @__PURE__ */ jsxs("div", { className: "relative h-full min-h-0", children: [
3029
+ /* @__PURE__ */ jsx(
3030
+ ChatScroll_default,
3031
+ {
3032
+ className: "h-full pb-10",
3033
+ bottomAlignWhenShort: false,
3034
+ scrollKey,
3035
+ children: messages.map((m, idx) => {
3036
+ const mine = m.author === "you";
3037
+ const isLast = idx === messages.length - 1;
3038
+ return /* @__PURE__ */ jsx(
3039
+ ChatMessageItem_default,
3209
3040
  {
3210
- replyTo,
3211
- clearReply: () => setReplyTo(void 0),
3212
- onAfterSend: () => setRev((v) => v + 1),
3213
- onSend: (payload) => {
3214
- if (activeId) adapter.messages.send(activeId, payload);
3215
- }
3041
+ id: m.id,
3042
+ mine,
3043
+ time: m.time ?? "",
3044
+ authorInitial: typeof m.author === "string" ? m.author : "U",
3045
+ avatarBg,
3046
+ text: m.text ?? m.content,
3047
+ businessCard: m.businessCard,
3048
+ addressCard: m.addressCard,
3049
+ images: m.images,
3050
+ files: m.files,
3051
+ audio: m.audio,
3052
+ replyTo: m.replyTo,
3053
+ showStatus: isLast,
3054
+ status: activeThread?.status?.kind === "seen" ? "Seen" : "Delivered",
3055
+ onReply: () => setReplyTo(toRef2(m)),
3056
+ initialSrc: m.avatarSrc
3216
3057
  },
3217
- activeId
3218
- ) })
3219
- ]
3058
+ m.id
3059
+ );
3060
+ })
3220
3061
  }
3221
3062
  ),
3222
- /* @__PURE__ */ jsxs("div", { style: { display: "flex", flexDirection: "column", height: "100%", minHeight: 0 }, children: [
3223
- /* @__PURE__ */ jsx("div", { style: { flexShrink: 0 }, children: /* @__PURE__ */ jsx(ChatListHeader_default, { onClose: close, onSearchChange: (val) => setSearchQuery(val) }) }),
3224
- /* @__PURE__ */ jsx("div", { style: { flex: 1, minHeight: 0, overflowY: "auto" }, children: filteredThreads.map((t) => {
3225
- const status = t.status ?? (t.unread && t.unread > 0 ? { kind: "new", count: t.unread } : { kind: "seen" });
3226
- return /* @__PURE__ */ jsx(
3227
- ChatThreadItem_default,
3228
- {
3229
- onClick: () => {
3230
- setReplyTo(void 0);
3231
- selectThread(t.id);
3232
- },
3233
- active: t.id === activeId,
3234
- pinned: Boolean(t.pinned),
3235
- online: t.online,
3236
- verified: Boolean(t.badge),
3237
- title: t.title,
3238
- preview: t.last ?? "",
3239
- time: t.time ?? "",
3240
- status,
3241
- avatarText: t.avatarText ?? "",
3242
- avatarSrc: t.avatarSrc
3243
- },
3244
- t.id
3245
- );
3246
- }) })
3247
- ] })
3248
- ]
3249
- }
3250
- ),
3251
- /* @__PURE__ */ jsx(
3252
- ChatConfirmModal,
3253
- {
3254
- open: showDelete,
3255
- onClose: () => setShowDelete(false),
3256
- onConfirm: handleConfirmDelete
3257
- }
3258
- ),
3063
+ /* @__PURE__ */ jsx("div", { className: "pointer-events-none absolute inset-x-0 bottom-0 flex items-center justify-start px-4 pb-2 pt-1 bg-white", children: /* @__PURE__ */ jsx(TypingIndicator_default, { className: "pointer-events-auto" }) })
3064
+ ] }) }),
3065
+ /* @__PURE__ */ jsx("div", { className: "shrink-0", children: /* @__PURE__ */ jsx(
3066
+ ChatFooter_default,
3067
+ {
3068
+ replyTo,
3069
+ clearReply: () => setReplyTo(void 0),
3070
+ onAfterSend: () => setRev((v) => v + 1),
3071
+ onSend: (payload) => {
3072
+ if (activeId) adapter.messages.send(activeId, payload);
3073
+ }
3074
+ },
3075
+ activeId
3076
+ ) })
3077
+ ] }),
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) => {
3081
+ const status = t.status ?? (t.unread && t.unread > 0 ? { kind: "new", count: t.unread } : { kind: "seen" });
3082
+ return /* @__PURE__ */ jsx(
3083
+ ChatThreadItem_default,
3084
+ {
3085
+ onClick: () => {
3086
+ setReplyTo(void 0);
3087
+ selectThread(t.id);
3088
+ },
3089
+ active: t.id === activeId,
3090
+ pinned: Boolean(t.pinned),
3091
+ online: t.online,
3092
+ verified: Boolean(t.badge),
3093
+ title: t.title,
3094
+ preview: t.last ?? "",
3095
+ time: t.time ?? "",
3096
+ status,
3097
+ avatarText: t.avatarText ?? "",
3098
+ avatarSrc: t.avatarSrc
3099
+ },
3100
+ t.id
3101
+ );
3102
+ }) })
3103
+ ] })
3104
+ ] }),
3105
+ /* @__PURE__ */ jsx(ChatConfirmModal, { open: showDelete, onClose: () => setShowDelete(false), onConfirm: handleConfirmDelete }),
3259
3106
  /* @__PURE__ */ jsx(ChatImagePreviewModal_default, { isOpen: isGalleryOpen, onClose: closeGallery })
3260
3107
  ]
3261
3108
  }
@@ -3284,7 +3131,20 @@ function toRef(m) {
3284
3131
  audio: m.audio
3285
3132
  };
3286
3133
  }
3287
- var SinglePopup = ({ adapter, uiCallbacks }) => {
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 }) => {
3288
3148
  const { close, reference } = useChatUI();
3289
3149
  const threads = adapter.threads.list(reference);
3290
3150
  const initialThreadId = React10.useMemo(
@@ -3318,13 +3178,14 @@ var SinglePopup = ({ adapter, uiCallbacks }) => {
3318
3178
  setScrollKey(Date.now());
3319
3179
  setReplyTo(void 0);
3320
3180
  }, [activeId, adapter]);
3321
- return /* @__PURE__ */ jsxs("div", { style: { position: "fixed", bottom: 16, right: 16, zIndex: 10002 }, children: [
3181
+ return /* @__PURE__ */ jsxs("div", { className: "fixed bottom-4 right-4 z-[10002]", children: [
3322
3182
  /* @__PURE__ */ jsx(
3323
3183
  motion.button,
3324
3184
  {
3325
3185
  "aria-label": "Close chat",
3326
3186
  onClick: close,
3327
- style: { position: "fixed", inset: 0, background: "transparent", border: "none", cursor: "auto" },
3187
+ className: "fixed inset-0 cursor-auto!",
3188
+ style: { background: "transparent", border: "none" },
3328
3189
  initial: { opacity: 0 },
3329
3190
  animate: { opacity: 1 },
3330
3191
  exit: { opacity: 0 },
@@ -3336,14 +3197,12 @@ var SinglePopup = ({ adapter, uiCallbacks }) => {
3336
3197
  {
3337
3198
  role: "dialog",
3338
3199
  "aria-modal": "true",
3200
+ "data-theme": getThemeAttr2(theme),
3201
+ className: "banbox-chat-root relative h-[650px] w-[450px] rounded-[20px] p-[2px]",
3339
3202
  style: {
3340
- position: "relative",
3341
- height: 650,
3342
- width: 450,
3343
- borderRadius: 20,
3344
- padding: 2,
3345
3203
  boxShadow: "0px 2px 12px 0px #3B33331A",
3346
- background: GRADIENT_BORDER2
3204
+ background: GRADIENT_BORDER2,
3205
+ ...getThemeVars2(theme)
3347
3206
  },
3348
3207
  initial: { x: "110%" },
3349
3208
  animate: { x: 0 },
@@ -3352,18 +3211,10 @@ var SinglePopup = ({ adapter, uiCallbacks }) => {
3352
3211
  children: /* @__PURE__ */ jsxs(
3353
3212
  "div",
3354
3213
  {
3355
- style: {
3356
- display: "flex",
3357
- flexDirection: "column",
3358
- height: "100%",
3359
- width: "100%",
3360
- overflow: "hidden",
3361
- borderRadius: 18,
3362
- backgroundColor: "#fff",
3363
- overscrollBehavior: "contain"
3364
- },
3214
+ className: "flex h-full w-full flex-col overflow-hidden rounded-[18px] bg-white",
3215
+ style: { overscrollBehavior: "contain" },
3365
3216
  children: [
3366
- /* @__PURE__ */ jsx("div", { style: { height: 64, flexShrink: 0 }, children: /* @__PURE__ */ jsx(
3217
+ /* @__PURE__ */ jsx("div", { className: "h-[64px] shrink-0", children: /* @__PURE__ */ jsx(
3367
3218
  ChatHeader,
3368
3219
  {
3369
3220
  left: /* @__PURE__ */ jsx(
@@ -3383,30 +3234,18 @@ var SinglePopup = ({ adapter, uiCallbacks }) => {
3383
3234
  {
3384
3235
  type: "button",
3385
3236
  onClick: close,
3386
- style: {
3387
- display: "flex",
3388
- alignItems: "center",
3389
- justifyContent: "center",
3390
- height: 34,
3391
- width: 34,
3392
- borderRadius: "50%",
3393
- backgroundColor: "#fff",
3394
- color: "#000",
3395
- border: "none",
3396
- boxShadow: "0px 2px 4px 0px #A5A3AE4D",
3397
- cursor: "pointer"
3398
- },
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",
3399
3238
  children: /* @__PURE__ */ jsx(ChatXIcon, { className: "h-6 w-6" })
3400
3239
  }
3401
3240
  )
3402
3241
  }
3403
3242
  ) }),
3404
- /* @__PURE__ */ jsx("div", { style: { flex: 1, minHeight: 0, position: "relative" }, children: /* @__PURE__ */ jsxs(
3243
+ /* @__PURE__ */ jsx("div", { className: "flex-1 min-h-0", children: /* @__PURE__ */ jsxs(
3405
3244
  ChatScroll_default,
3406
3245
  {
3246
+ className: "h-full",
3407
3247
  bottomAlignWhenShort: false,
3408
3248
  scrollKey,
3409
- style: { height: "100%", overflowY: "auto" },
3410
3249
  children: [
3411
3250
  messages.map((m, idx) => {
3412
3251
  const mine = m.author === "you";
@@ -3433,11 +3272,11 @@ var SinglePopup = ({ adapter, uiCallbacks }) => {
3433
3272
  m.id
3434
3273
  );
3435
3274
  }),
3436
- /* @__PURE__ */ jsx("div", { style: { display: "flex", alignItems: "center", justifyContent: "flex-start" }, children: /* @__PURE__ */ jsx(TypingIndicator_default, {}) })
3275
+ /* @__PURE__ */ jsx("div", { className: "flex items-center justify-start", children: /* @__PURE__ */ jsx(TypingIndicator_default, {}) })
3437
3276
  ]
3438
3277
  }
3439
3278
  ) }),
3440
- /* @__PURE__ */ jsx("div", { style: { flexShrink: 0 }, children: /* @__PURE__ */ jsx(
3279
+ /* @__PURE__ */ jsx("div", { className: "shrink-0", children: /* @__PURE__ */ jsx(
3441
3280
  ChatFooter_default,
3442
3281
  {
3443
3282
  variant: "single",
@@ -3457,7 +3296,7 @@ var SinglePopup = ({ adapter, uiCallbacks }) => {
3457
3296
  ] });
3458
3297
  };
3459
3298
  var SinglePopup_default = SinglePopup;
3460
- function ChatRoot({ adapter, uiCallbacks }) {
3299
+ function ChatRoot({ adapter, uiCallbacks, theme }) {
3461
3300
  const { isOpen, variant } = useChatUI();
3462
3301
  useDisableBodyScroll(isOpen);
3463
3302
  if (typeof window === "undefined") {
@@ -3465,19 +3304,20 @@ function ChatRoot({ adapter, uiCallbacks }) {
3465
3304
  }
3466
3305
  return createPortal(
3467
3306
  // GalleryProvider is scoped to the chat only.
3468
- // It is completely separate from the host app's own gallery context.
3469
3307
  /* @__PURE__ */ jsx(GalleryProvider, { children: /* @__PURE__ */ jsx(AnimatePresence, { mode: "wait", children: isOpen && (variant === "inbox" ? /* @__PURE__ */ jsx(
3470
3308
  InboxPopup_default,
3471
3309
  {
3472
3310
  adapter,
3473
- uiCallbacks
3311
+ uiCallbacks,
3312
+ theme
3474
3313
  },
3475
3314
  "inbox"
3476
3315
  ) : /* @__PURE__ */ jsx(
3477
3316
  SinglePopup_default,
3478
3317
  {
3479
3318
  adapter,
3480
- uiCallbacks
3319
+ uiCallbacks,
3320
+ theme
3481
3321
  },
3482
3322
  "single"
3483
3323
  )) }) }),