framepexls-ui-lib 2.2.0 → 2.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/Sidebar.mjs CHANGED
@@ -1474,13 +1474,20 @@ function WorkspaceSwitcher({
1474
1474
  variant = "standalone",
1475
1475
  color = "accent"
1476
1476
  }) {
1477
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
1477
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l;
1478
1478
  const [open, setOpen] = useState(false);
1479
+ const [workspaceQuery, setWorkspaceQuery] = useState("");
1479
1480
  const triggerRef = useRef(null);
1481
+ const searchRef = useRef(null);
1480
1482
  const popoverRef = useRef(null);
1481
1483
  const [mounted, setMounted] = useState(false);
1482
1484
  const portalRoot = typeof document !== "undefined" ? document.body : null;
1483
- const [menuPos, setMenuPos] = useState({ top: 0, left: 0, width: 0 });
1485
+ const [menuPos, setMenuPos] = useState({
1486
+ top: 0,
1487
+ left: 0,
1488
+ width: 0,
1489
+ maxHeight: 420
1490
+ });
1484
1491
  const current = useMemo(() => {
1485
1492
  var _a2, _b2;
1486
1493
  const list = (workspaces != null ? workspaces : []).filter((w) => !w.disabled);
@@ -1496,6 +1503,17 @@ function WorkspaceSwitcher({
1496
1503
  }
1497
1504
  return { primary: p, secondary: s };
1498
1505
  }, [workspaces]);
1506
+ const normalizedWorkspaceQuery = workspaceQuery.trim().toLocaleLowerCase();
1507
+ const matchesWorkspaceQuery = React.useCallback(
1508
+ (workspace) => {
1509
+ if (!normalizedWorkspaceQuery) return true;
1510
+ return [workspace.name, workspace.subtitle, workspace.badge, workspace.initials].filter(Boolean).some((value) => String(value).toLocaleLowerCase().includes(normalizedWorkspaceQuery));
1511
+ },
1512
+ [normalizedWorkspaceQuery]
1513
+ );
1514
+ const filteredPrimary = useMemo(() => primary.filter(matchesWorkspaceQuery), [matchesWorkspaceQuery, primary]);
1515
+ const filteredSecondary = useMemo(() => secondary.filter(matchesWorkspaceQuery), [matchesWorkspaceQuery, secondary]);
1516
+ const hasFilteredWorkspaces = filteredPrimary.length > 0 || filteredSecondary.length > 0;
1499
1517
  useEffect(() => {
1500
1518
  if (!open) return;
1501
1519
  const onDown = (e) => {
@@ -1518,6 +1536,17 @@ function WorkspaceSwitcher({
1518
1536
  useEffect(() => {
1519
1537
  if (collapsed) setOpen(false);
1520
1538
  }, [collapsed]);
1539
+ useEffect(() => {
1540
+ if (!open) {
1541
+ setWorkspaceQuery("");
1542
+ return;
1543
+ }
1544
+ const id = window.setTimeout(() => {
1545
+ var _a2;
1546
+ return (_a2 = searchRef.current) == null ? void 0 : _a2.focus({ preventScroll: true });
1547
+ }, 40);
1548
+ return () => window.clearTimeout(id);
1549
+ }, [open]);
1521
1550
  useEffect(() => {
1522
1551
  setMounted(true);
1523
1552
  }, []);
@@ -1526,21 +1555,29 @@ function WorkspaceSwitcher({
1526
1555
  if (!el) return;
1527
1556
  const r = el.getBoundingClientRect();
1528
1557
  const viewportPad = 12;
1529
- const w = Math.max(240, Math.min(340, window.innerWidth - viewportPad * 2));
1558
+ const w = Math.min(380, Math.max(180, window.innerWidth - viewportPad * 2));
1559
+ const maxPreferredHeight = Math.min(520, Math.max(120, window.innerHeight - viewportPad * 2));
1530
1560
  if (collapsed) {
1531
1561
  let left2 = r.right + 12;
1532
1562
  if (left2 + w > window.innerWidth - viewportPad) left2 = Math.max(viewportPad, window.innerWidth - viewportPad - w);
1533
- let top2 = r.top;
1534
- const maxTop = Math.max(viewportPad, window.innerHeight - viewportPad - 420);
1535
- if (top2 > maxTop) top2 = maxTop;
1536
- if (top2 < viewportPad) top2 = viewportPad;
1537
- setMenuPos({ left: left2, top: top2, width: w });
1563
+ let top = r.top;
1564
+ const maxTop = Math.max(viewportPad, window.innerHeight - viewportPad - maxPreferredHeight);
1565
+ if (top > maxTop) top = maxTop;
1566
+ if (top < viewportPad) top = viewportPad;
1567
+ setMenuPos({ left: left2, top, width: w, maxHeight: maxPreferredHeight });
1538
1568
  return;
1539
1569
  }
1540
1570
  let left = r.left;
1541
1571
  if (left + w > window.innerWidth - viewportPad) left = Math.max(viewportPad, window.innerWidth - viewportPad - w);
1542
- const top = r.bottom + 8;
1543
- setMenuPos({ left, top, width: w });
1572
+ const belowTop = r.bottom + 8;
1573
+ const belowSpace = Math.max(80, window.innerHeight - belowTop - viewportPad);
1574
+ const aboveSpace = Math.max(80, r.top - viewportPad - 8);
1575
+ if (belowSpace < 260 && aboveSpace > belowSpace) {
1576
+ const maxHeight = Math.min(maxPreferredHeight, aboveSpace);
1577
+ setMenuPos({ left, top: Math.max(viewportPad, r.top - 8 - maxHeight), width: w, maxHeight });
1578
+ return;
1579
+ }
1580
+ setMenuPos({ left, top: belowTop, width: w, maxHeight: Math.min(maxPreferredHeight, belowSpace) });
1544
1581
  }, [collapsed]);
1545
1582
  useLayoutEffect(() => {
1546
1583
  if (!open) return;
@@ -1563,9 +1600,11 @@ function WorkspaceSwitcher({
1563
1600
  const labelSecondary = (_c = labels == null ? void 0 : labels.secondary) != null ? _c : "Secundarios";
1564
1601
  const labelManage = (_d = labels == null ? void 0 : labels.manage) != null ? _d : "Administrar espacios";
1565
1602
  const labelManageHint = (_e = labels == null ? void 0 : labels.manageHint) != null ? _e : "Agrega slots para sub-empresas.";
1603
+ const labelSearchPlaceholder = (_f = labels == null ? void 0 : labels.searchPlaceholder) != null ? _f : "Buscar empresa o workspace...";
1604
+ const labelEmpty = (_g = labels == null ? void 0 : labels.empty) != null ? _g : "No hay espacios que coincidan.";
1566
1605
  const tooltipContent = /* @__PURE__ */ jsxs("div", { className: "min-w-0", children: [
1567
1606
  /* @__PURE__ */ jsx("div", { className: "truncate text-[0.75rem] font-semibold", children: current.name }),
1568
- /* @__PURE__ */ jsx("div", { className: "mt-0.5 truncate text-[0.6875rem] text-white/70", children: (_f = current.subtitle) != null ? _f : labelTitle })
1607
+ /* @__PURE__ */ jsx("div", { className: "mt-0.5 truncate text-[0.6875rem] text-white/70", children: (_h = current.subtitle) != null ? _h : labelTitle })
1569
1608
  ] });
1570
1609
  const renderRow = (w) => {
1571
1610
  var _a2, _b2, _c2;
@@ -1581,7 +1620,7 @@ function WorkspaceSwitcher({
1581
1620
  },
1582
1621
  disabled: w.disabled,
1583
1622
  className: [
1584
- "flex w-full items-center gap-3 rounded-2xl px-2.5 py-2 text-left",
1623
+ "grid w-full min-w-0 grid-cols-[auto_minmax(0,1fr)_auto] items-center gap-3 rounded-2xl px-2.5 py-2 text-left",
1585
1624
  w.disabled ? "cursor-not-allowed opacity-50" : "hover:bg-[color-mix(in_oklab,var(--surface)_70%,transparent)]",
1586
1625
  active ? "bg-[color-mix(in_oklab,var(--primary)_10%,transparent)] ring-1 ring-inset ring-[color-mix(in_oklab,var(--ring)_22%,transparent)]" : ""
1587
1626
  ].join(" "),
@@ -1594,13 +1633,14 @@ function WorkspaceSwitcher({
1594
1633
  alt: w.name,
1595
1634
  initials: (_b2 = w.initials) != null ? _b2 : computeInitials(w.name),
1596
1635
  radiusClass: "rounded-2xl",
1597
- color: (_c2 = w.color) != null ? _c2 : color
1636
+ color: (_c2 = w.color) != null ? _c2 : color,
1637
+ className: "shrink-0"
1598
1638
  }
1599
1639
  ),
1600
- /* @__PURE__ */ jsxs("div", { className: "min-w-0 flex-1", children: [
1601
- /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
1602
- /* @__PURE__ */ jsx("div", { className: "min-w-0 truncate text-sm font-semibold text-[var(--foreground)]", children: w.name }),
1603
- w.badge ? /* @__PURE__ */ jsx("span", { className: "shrink-0 rounded-full border border-[var(--border)] bg-[color-mix(in_oklab,var(--surface)_70%,transparent)] px-2 py-0.5 text-[0.6875rem] font-semibold text-[var(--muted)]", children: w.badge }) : null
1640
+ /* @__PURE__ */ jsxs("div", { className: "min-w-0 flex-1 overflow-hidden", children: [
1641
+ /* @__PURE__ */ jsxs("div", { className: "flex min-w-0 items-center gap-2", children: [
1642
+ /* @__PURE__ */ jsx("div", { className: "block min-w-0 max-w-full flex-1 overflow-hidden text-ellipsis whitespace-nowrap text-sm font-semibold text-[var(--foreground)]", children: w.name }),
1643
+ w.badge ? /* @__PURE__ */ jsx("span", { className: "max-w-[5.75rem] shrink-0 truncate rounded-full border border-[var(--border)] bg-[color-mix(in_oklab,var(--surface)_70%,transparent)] px-2 py-0.5 text-[0.6875rem] font-semibold text-[var(--muted)]", children: w.badge }) : null
1604
1644
  ] }),
1605
1645
  w.subtitle ? /* @__PURE__ */ jsx("div", { className: "truncate text-xs text-[var(--muted)] text-left", children: w.subtitle }) : null
1606
1646
  ] }),
@@ -1625,7 +1665,8 @@ function WorkspaceSwitcher({
1625
1665
  "aria-expanded": open,
1626
1666
  title: void 0,
1627
1667
  className: [
1628
- "group flex w-full items-center gap-3 rounded-2xl",
1668
+ "group w-full min-w-0 items-center gap-3 rounded-2xl",
1669
+ collapsed ? "flex" : "grid grid-cols-[auto_minmax(0,1fr)_auto]",
1629
1670
  variant === "panel" ? "border-0 bg-transparent shadow-none hover:bg-[color-mix(in_oklab,var(--surface)_70%,transparent)]" : "border border-[var(--border)] bg-[var(--card)] shadow-sm hover:bg-[color-mix(in_oklab,var(--surface)_70%,transparent)]",
1630
1671
  collapsed ? "justify-center p-2" : "px-2.5 py-2",
1631
1672
  "active:scale-[0.99]"
@@ -1635,20 +1676,21 @@ function WorkspaceSwitcher({
1635
1676
  AvatarSquare,
1636
1677
  {
1637
1678
  size: collapsed ? 44 : 34,
1638
- src: (_g = current.avatarUrl) != null ? _g : void 0,
1679
+ src: (_i = current.avatarUrl) != null ? _i : void 0,
1639
1680
  alt: current.name,
1640
- initials: (_h = current.initials) != null ? _h : computeInitials(current.name),
1681
+ initials: (_j = current.initials) != null ? _j : computeInitials(current.name),
1641
1682
  radiusClass: collapsed ? "rounded-2xl" : "rounded-2xl",
1642
- color: (_i = current.color) != null ? _i : color
1683
+ color: (_k = current.color) != null ? _k : color,
1684
+ className: "shrink-0"
1643
1685
  }
1644
1686
  ),
1645
1687
  !collapsed && /* @__PURE__ */ jsxs(Fragment, { children: [
1646
- /* @__PURE__ */ jsxs("div", { className: "min-w-0 flex-1", children: [
1647
- /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
1648
- /* @__PURE__ */ jsx("div", { className: "min-w-0 truncate text-sm font-semibold", children: current.name }),
1649
- current.badge ? /* @__PURE__ */ jsx("span", { className: "shrink-0 rounded-full border border-[var(--border)] bg-[color-mix(in_oklab,var(--surface)_70%,transparent)] px-2 py-0.5 text-[0.6875rem] font-semibold text-[var(--muted)]", children: current.badge }) : null
1688
+ /* @__PURE__ */ jsxs("div", { className: "min-w-0 flex-1 overflow-hidden", children: [
1689
+ /* @__PURE__ */ jsxs("div", { className: "flex min-w-0 items-center gap-2", children: [
1690
+ /* @__PURE__ */ jsx("div", { className: "block min-w-0 max-w-full flex-1 overflow-hidden text-ellipsis whitespace-nowrap text-left text-sm font-semibold", children: current.name }),
1691
+ current.badge ? /* @__PURE__ */ jsx("span", { className: "max-w-[5.75rem] shrink-0 truncate rounded-full border border-[var(--border)] bg-[color-mix(in_oklab,var(--surface)_70%,transparent)] px-2 py-0.5 text-[0.6875rem] font-semibold text-[var(--muted)]", children: current.badge }) : null
1650
1692
  ] }),
1651
- /* @__PURE__ */ jsx("div", { className: "truncate text-xs text-[var(--muted)] text-left", children: (_j = current.subtitle) != null ? _j : labelTitle })
1693
+ /* @__PURE__ */ jsx("div", { className: "truncate text-xs text-[var(--muted)] text-left", children: (_l = current.subtitle) != null ? _l : labelTitle })
1652
1694
  ] }),
1653
1695
  /* @__PURE__ */ jsx("div", { className: "shrink-0 text-[var(--muted)] group-hover:text-[var(--foreground)]", children: /* @__PURE__ */ jsx(ChevronDownIcon, { className: `transition-transform ${open ? "rotate-180" : ""}`, "aria-hidden": true }) })
1654
1696
  ] })
@@ -1666,23 +1708,37 @@ function WorkspaceSwitcher({
1666
1708
  exit: { opacity: 0, y: 6, scale: 0.985 },
1667
1709
  transition: { duration: 0.14, ease: "easeOut" },
1668
1710
  className: [
1669
- "fixed z-50 overflow-hidden rounded-3xl border border-[var(--border)] bg-[var(--card)] shadow-2xl",
1711
+ "fixed z-50 flex flex-col overflow-hidden rounded-3xl border border-[var(--border)] bg-[var(--card)] shadow-2xl",
1670
1712
  mobile ? "max-w-[18rem]" : ""
1671
1713
  ].join(" "),
1672
- style: { top: menuPos.top, left: menuPos.left, width: menuPos.width },
1714
+ style: { top: menuPos.top, left: menuPos.left, width: menuPos.width, maxHeight: menuPos.maxHeight },
1673
1715
  children: [
1674
- /* @__PURE__ */ jsx("div", { className: "px-3 py-2", children: /* @__PURE__ */ jsx("div", { className: "text-[0.6875rem] font-semibold uppercase tracking-wider text-[var(--muted)]", children: labelTitle }) }),
1675
- /* @__PURE__ */ jsxs("div", { className: "px-2 pb-2", children: [
1676
- primary.length ? /* @__PURE__ */ jsxs(Fragment, { children: [
1716
+ /* @__PURE__ */ jsx("div", { className: "shrink-0 px-3 py-2", children: /* @__PURE__ */ jsx("div", { className: "text-[0.6875rem] font-semibold uppercase tracking-wider text-[var(--muted)]", children: labelTitle }) }),
1717
+ /* @__PURE__ */ jsx("div", { className: "shrink-0 px-3 pb-2", children: /* @__PURE__ */ jsx(
1718
+ Input,
1719
+ {
1720
+ ref: searchRef,
1721
+ type: "search",
1722
+ value: workspaceQuery,
1723
+ onChange: (event) => setWorkspaceQuery(event.currentTarget.value),
1724
+ placeholder: labelSearchPlaceholder,
1725
+ leftSlot: /* @__PURE__ */ jsx(MagnifyingGlassIcon, { className: "size-4", "aria-hidden": true }),
1726
+ clearable: true,
1727
+ onClear: () => setWorkspaceQuery(""),
1728
+ className: "h-9 rounded-2xl py-2 text-xs shadow-none"
1729
+ }
1730
+ ) }),
1731
+ /* @__PURE__ */ jsx("div", { className: "min-h-0 flex-1 overflow-y-auto overflow-x-hidden px-2 pb-2 [scrollbar-width:thin]", children: hasFilteredWorkspaces ? /* @__PURE__ */ jsxs(Fragment, { children: [
1732
+ filteredPrimary.length ? /* @__PURE__ */ jsxs(Fragment, { children: [
1677
1733
  /* @__PURE__ */ jsx("div", { className: "px-2 pb-1 pt-1 text-[0.6875rem] font-semibold uppercase tracking-wider text-slate-400", children: labelPrimary }),
1678
- /* @__PURE__ */ jsx("div", { className: "space-y-1", children: primary.map(renderRow) })
1734
+ /* @__PURE__ */ jsx("div", { className: "space-y-1", children: filteredPrimary.map(renderRow) })
1679
1735
  ] }) : null,
1680
- secondary.length ? /* @__PURE__ */ jsxs(Fragment, { children: [
1736
+ filteredSecondary.length ? /* @__PURE__ */ jsxs(Fragment, { children: [
1681
1737
  /* @__PURE__ */ jsx("div", { className: "mt-3 px-2 pb-1 pt-1 text-[0.6875rem] font-semibold uppercase tracking-wider text-slate-400", children: labelSecondary }),
1682
- /* @__PURE__ */ jsx("div", { className: "space-y-1", children: secondary.map(renderRow) })
1738
+ /* @__PURE__ */ jsx("div", { className: "space-y-1", children: filteredSecondary.map(renderRow) })
1683
1739
  ] }) : null
1684
- ] }),
1685
- onManageWorkspaces ? /* @__PURE__ */ jsx("div", { className: "border-t border-[var(--border)] px-2 py-2", children: /* @__PURE__ */ jsxs(
1740
+ ] }) : /* @__PURE__ */ jsx("div", { className: "px-3 py-8 text-center text-sm text-[var(--muted)]", children: labelEmpty }) }),
1741
+ onManageWorkspaces ? /* @__PURE__ */ jsx("div", { className: "shrink-0 border-t border-[var(--border)] px-2 py-2", children: /* @__PURE__ */ jsxs(
1686
1742
  Button,
1687
1743
  {
1688
1744
  unstyled: true,
@@ -1691,13 +1747,13 @@ function WorkspaceSwitcher({
1691
1747
  setOpen(false);
1692
1748
  onManageWorkspaces();
1693
1749
  },
1694
- className: "flex w-full items-center justify-between gap-3 rounded-2xl px-3 py-2 text-left hover:bg-[color-mix(in_oklab,var(--surface)_70%,transparent)]",
1750
+ className: "flex w-full min-w-0 items-center justify-between gap-3 rounded-2xl px-3 py-2 text-left hover:bg-[color-mix(in_oklab,var(--surface)_70%,transparent)]",
1695
1751
  children: [
1696
- /* @__PURE__ */ jsxs("div", { className: "min-w-0", children: [
1697
- /* @__PURE__ */ jsx("div", { className: "text-sm font-semibold text-[var(--foreground)]", children: labelManage }),
1698
- /* @__PURE__ */ jsx("div", { className: "text-xs text-[var(--muted)]", children: labelManageHint })
1752
+ /* @__PURE__ */ jsxs("div", { className: "min-w-0 overflow-hidden", children: [
1753
+ /* @__PURE__ */ jsx("div", { className: "truncate text-sm font-semibold text-[var(--foreground)]", children: labelManage }),
1754
+ /* @__PURE__ */ jsx("div", { className: "truncate text-xs text-[var(--muted)]", children: labelManageHint })
1699
1755
  ] }),
1700
- /* @__PURE__ */ jsx(PlusIcon, { className: "text-[var(--muted)]", "aria-hidden": true })
1756
+ /* @__PURE__ */ jsx(PlusIcon, { className: "shrink-0 text-[var(--muted)]", "aria-hidden": true })
1701
1757
  ]
1702
1758
  }
1703
1759
  ) }) : null
@@ -2270,7 +2326,7 @@ function SidebarInner({
2270
2326
  ] }) : null,
2271
2327
  sidebarSlotCollapsed ? /* @__PURE__ */ jsx("div", { className: "flex items-center justify-center", children: sidebarSlotCollapsed }) : null
2272
2328
  ] }) }) : /* @__PURE__ */ jsxs("div", { className: topPanelClass, children: [
2273
- showWorkspaceInTopPanel ? /* @__PURE__ */ jsxs("div", { className: "px-3 py-3", children: [
2329
+ showWorkspaceInTopPanel ? /* @__PURE__ */ jsxs("div", { className: "min-w-0 overflow-hidden px-3 py-3", children: [
2274
2330
  /* @__PURE__ */ jsx(
2275
2331
  WorkspaceSwitcher,
2276
2332
  {
@@ -0,0 +1,128 @@
1
+ import React__default from 'react';
2
+
3
+ type SupportChatMode = "bot" | "live" | "offline";
4
+ type SupportChatRole = "visitor" | "bot" | "agent" | "system";
5
+ type SupportChatActor = {
6
+ name: string;
7
+ subtitle?: string;
8
+ avatarUrl?: string | null;
9
+ initials?: string | null;
10
+ color?: "accent" | "slate" | "gray" | "zinc" | "neutral" | "stone" | "red" | "orange" | "amber" | "yellow" | "lime" | "green" | "emerald" | "teal" | "cyan" | "sky" | "blue" | "indigo" | "violet" | "purple" | "fuchsia" | "pink" | "rose";
11
+ };
12
+ type SupportChatMessage = {
13
+ id: string;
14
+ role: SupportChatRole;
15
+ content: string;
16
+ createdAt?: string | number | Date;
17
+ state?: "complete" | "typing" | "sending" | "error";
18
+ actor?: SupportChatActor;
19
+ suggestedReplies?: string[];
20
+ serviceSuggestions?: SupportChatServiceSuggestion[];
21
+ };
22
+ type SupportChatServiceSuggestion = {
23
+ id: string;
24
+ title: string;
25
+ description?: string;
26
+ meta?: string;
27
+ priceLabel?: string;
28
+ ctaLabel?: string;
29
+ imageUrl?: string | null;
30
+ };
31
+ type SupportChatContactAction = {
32
+ id: string;
33
+ label: string;
34
+ href?: string;
35
+ kind?: "phone" | "email" | "link";
36
+ onSelect?: () => void;
37
+ };
38
+ type SupportChatKnowledgeSignal = {
39
+ id: string;
40
+ label: string;
41
+ value?: string;
42
+ };
43
+ type SupportChatTranscriptMode = "recent-text" | "full-html";
44
+ type SupportChatTranscriptPayload = {
45
+ mode: SupportChatTranscriptMode;
46
+ messages: SupportChatMessage[];
47
+ fileName: string;
48
+ content: string;
49
+ mimeType: string;
50
+ };
51
+ type SupportChatTranscriptConfig = {
52
+ enabled?: boolean;
53
+ fullHistoryAllowed?: boolean;
54
+ recentMessageLimit?: number;
55
+ fileName?: string;
56
+ title?: string;
57
+ onSave?: (payload: SupportChatTranscriptPayload) => void | Promise<void>;
58
+ };
59
+ type SupportChatSendResult = string | void | SupportChatMessage[] | {
60
+ reply?: string;
61
+ messages?: SupportChatMessage[];
62
+ };
63
+ type SupportChatWidgetLabels = {
64
+ trigger?: string;
65
+ title?: string;
66
+ subtitle?: string;
67
+ botStatus?: string;
68
+ liveStatus?: string;
69
+ offlineStatus?: string;
70
+ composerPlaceholder?: string;
71
+ offlineComposerPlaceholder?: string;
72
+ send?: string;
73
+ close?: string;
74
+ requestLive?: string;
75
+ liveUnavailable?: string;
76
+ servicesTitle?: string;
77
+ suggestedTitle?: string;
78
+ contactTitle?: string;
79
+ saveTranscript?: string;
80
+ saveRecentTranscript?: string;
81
+ saveFullTranscript?: string;
82
+ ratingLabel?: string;
83
+ poweredBy?: string;
84
+ defaultWelcomeTitle?: string;
85
+ defaultWelcomeMessage?: string;
86
+ errorMessage?: string;
87
+ };
88
+ type SupportChatWidgetProps = {
89
+ mode?: SupportChatMode;
90
+ brandName?: string;
91
+ assistant?: SupportChatActor;
92
+ agent?: SupportChatActor;
93
+ open?: boolean;
94
+ defaultOpen?: boolean;
95
+ onOpenChange?: (open: boolean) => void;
96
+ messages?: SupportChatMessage[];
97
+ defaultMessages?: SupportChatMessage[];
98
+ onMessagesChange?: (messages: SupportChatMessage[]) => void;
99
+ onSendMessage?: (payload: {
100
+ text: string;
101
+ messages: SupportChatMessage[];
102
+ mode: SupportChatMode;
103
+ }) => Promise<SupportChatSendResult> | SupportChatSendResult;
104
+ onRequestLive?: () => void | Promise<void>;
105
+ onSelectService?: (service: SupportChatServiceSuggestion) => void;
106
+ onQuickReply?: (reply: string) => void;
107
+ transcript?: SupportChatTranscriptConfig;
108
+ serviceSuggestions?: SupportChatServiceSuggestion[];
109
+ suggestedReplies?: string[];
110
+ contactActions?: SupportChatContactAction[];
111
+ knowledgeSignals?: SupportChatKnowledgeSignal[];
112
+ businessHoursLabel?: string;
113
+ rating?: number;
114
+ ratingCount?: number;
115
+ liveAllowed?: boolean;
116
+ liveAvailable?: boolean;
117
+ allowOfflineMessages?: boolean;
118
+ disabled?: boolean;
119
+ unreadCount?: number;
120
+ position?: "bottom-right" | "bottom-left" | "inline";
121
+ zIndex?: number;
122
+ className?: string;
123
+ panelClassName?: string;
124
+ labels?: SupportChatWidgetLabels;
125
+ };
126
+ declare function SupportChatWidget({ mode, brandName, assistant, agent, open: openProp, defaultOpen, onOpenChange, messages: messagesProp, defaultMessages, onMessagesChange, onSendMessage, onRequestLive, onSelectService, onQuickReply, transcript, serviceSuggestions, suggestedReplies, contactActions, knowledgeSignals, businessHoursLabel, rating, ratingCount, liveAllowed, liveAvailable, allowOfflineMessages, disabled, unreadCount, position, zIndex, className, panelClassName, labels, }: SupportChatWidgetProps): React__default.JSX.Element;
127
+
128
+ export { type SupportChatActor, type SupportChatContactAction, type SupportChatKnowledgeSignal, type SupportChatMessage, type SupportChatMode, type SupportChatRole, type SupportChatSendResult, type SupportChatServiceSuggestion, type SupportChatTranscriptConfig, type SupportChatTranscriptMode, type SupportChatTranscriptPayload, type SupportChatWidgetLabels, type SupportChatWidgetProps, SupportChatWidget as default };
@@ -0,0 +1,128 @@
1
+ import React__default from 'react';
2
+
3
+ type SupportChatMode = "bot" | "live" | "offline";
4
+ type SupportChatRole = "visitor" | "bot" | "agent" | "system";
5
+ type SupportChatActor = {
6
+ name: string;
7
+ subtitle?: string;
8
+ avatarUrl?: string | null;
9
+ initials?: string | null;
10
+ color?: "accent" | "slate" | "gray" | "zinc" | "neutral" | "stone" | "red" | "orange" | "amber" | "yellow" | "lime" | "green" | "emerald" | "teal" | "cyan" | "sky" | "blue" | "indigo" | "violet" | "purple" | "fuchsia" | "pink" | "rose";
11
+ };
12
+ type SupportChatMessage = {
13
+ id: string;
14
+ role: SupportChatRole;
15
+ content: string;
16
+ createdAt?: string | number | Date;
17
+ state?: "complete" | "typing" | "sending" | "error";
18
+ actor?: SupportChatActor;
19
+ suggestedReplies?: string[];
20
+ serviceSuggestions?: SupportChatServiceSuggestion[];
21
+ };
22
+ type SupportChatServiceSuggestion = {
23
+ id: string;
24
+ title: string;
25
+ description?: string;
26
+ meta?: string;
27
+ priceLabel?: string;
28
+ ctaLabel?: string;
29
+ imageUrl?: string | null;
30
+ };
31
+ type SupportChatContactAction = {
32
+ id: string;
33
+ label: string;
34
+ href?: string;
35
+ kind?: "phone" | "email" | "link";
36
+ onSelect?: () => void;
37
+ };
38
+ type SupportChatKnowledgeSignal = {
39
+ id: string;
40
+ label: string;
41
+ value?: string;
42
+ };
43
+ type SupportChatTranscriptMode = "recent-text" | "full-html";
44
+ type SupportChatTranscriptPayload = {
45
+ mode: SupportChatTranscriptMode;
46
+ messages: SupportChatMessage[];
47
+ fileName: string;
48
+ content: string;
49
+ mimeType: string;
50
+ };
51
+ type SupportChatTranscriptConfig = {
52
+ enabled?: boolean;
53
+ fullHistoryAllowed?: boolean;
54
+ recentMessageLimit?: number;
55
+ fileName?: string;
56
+ title?: string;
57
+ onSave?: (payload: SupportChatTranscriptPayload) => void | Promise<void>;
58
+ };
59
+ type SupportChatSendResult = string | void | SupportChatMessage[] | {
60
+ reply?: string;
61
+ messages?: SupportChatMessage[];
62
+ };
63
+ type SupportChatWidgetLabels = {
64
+ trigger?: string;
65
+ title?: string;
66
+ subtitle?: string;
67
+ botStatus?: string;
68
+ liveStatus?: string;
69
+ offlineStatus?: string;
70
+ composerPlaceholder?: string;
71
+ offlineComposerPlaceholder?: string;
72
+ send?: string;
73
+ close?: string;
74
+ requestLive?: string;
75
+ liveUnavailable?: string;
76
+ servicesTitle?: string;
77
+ suggestedTitle?: string;
78
+ contactTitle?: string;
79
+ saveTranscript?: string;
80
+ saveRecentTranscript?: string;
81
+ saveFullTranscript?: string;
82
+ ratingLabel?: string;
83
+ poweredBy?: string;
84
+ defaultWelcomeTitle?: string;
85
+ defaultWelcomeMessage?: string;
86
+ errorMessage?: string;
87
+ };
88
+ type SupportChatWidgetProps = {
89
+ mode?: SupportChatMode;
90
+ brandName?: string;
91
+ assistant?: SupportChatActor;
92
+ agent?: SupportChatActor;
93
+ open?: boolean;
94
+ defaultOpen?: boolean;
95
+ onOpenChange?: (open: boolean) => void;
96
+ messages?: SupportChatMessage[];
97
+ defaultMessages?: SupportChatMessage[];
98
+ onMessagesChange?: (messages: SupportChatMessage[]) => void;
99
+ onSendMessage?: (payload: {
100
+ text: string;
101
+ messages: SupportChatMessage[];
102
+ mode: SupportChatMode;
103
+ }) => Promise<SupportChatSendResult> | SupportChatSendResult;
104
+ onRequestLive?: () => void | Promise<void>;
105
+ onSelectService?: (service: SupportChatServiceSuggestion) => void;
106
+ onQuickReply?: (reply: string) => void;
107
+ transcript?: SupportChatTranscriptConfig;
108
+ serviceSuggestions?: SupportChatServiceSuggestion[];
109
+ suggestedReplies?: string[];
110
+ contactActions?: SupportChatContactAction[];
111
+ knowledgeSignals?: SupportChatKnowledgeSignal[];
112
+ businessHoursLabel?: string;
113
+ rating?: number;
114
+ ratingCount?: number;
115
+ liveAllowed?: boolean;
116
+ liveAvailable?: boolean;
117
+ allowOfflineMessages?: boolean;
118
+ disabled?: boolean;
119
+ unreadCount?: number;
120
+ position?: "bottom-right" | "bottom-left" | "inline";
121
+ zIndex?: number;
122
+ className?: string;
123
+ panelClassName?: string;
124
+ labels?: SupportChatWidgetLabels;
125
+ };
126
+ declare function SupportChatWidget({ mode, brandName, assistant, agent, open: openProp, defaultOpen, onOpenChange, messages: messagesProp, defaultMessages, onMessagesChange, onSendMessage, onRequestLive, onSelectService, onQuickReply, transcript, serviceSuggestions, suggestedReplies, contactActions, knowledgeSignals, businessHoursLabel, rating, ratingCount, liveAllowed, liveAvailable, allowOfflineMessages, disabled, unreadCount, position, zIndex, className, panelClassName, labels, }: SupportChatWidgetProps): React__default.JSX.Element;
127
+
128
+ export { type SupportChatActor, type SupportChatContactAction, type SupportChatKnowledgeSignal, type SupportChatMessage, type SupportChatMode, type SupportChatRole, type SupportChatSendResult, type SupportChatServiceSuggestion, type SupportChatTranscriptConfig, type SupportChatTranscriptMode, type SupportChatTranscriptPayload, type SupportChatWidgetLabels, type SupportChatWidgetProps, SupportChatWidget as default };