@adatechnology/conversations-ui 0.5.0 → 0.6.0

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.
Files changed (50) hide show
  1. package/README.md +82 -20
  2. package/dist/{chunk-JXJCPN34.js → chunk-FAQLC3TX.js} +1 -1
  3. package/dist/{chunk-RJMSM3YA.js → chunk-O6457XHK.js} +17 -11
  4. package/dist/chunk-OVFCLRQQ.js +84 -0
  5. package/dist/index.d.ts +14 -4
  6. package/dist/index.js +3 -3
  7. package/dist/participant/index.d.ts +25 -1
  8. package/dist/participant/index.js +454 -194
  9. package/dist/preview/index.js +2 -2
  10. package/dist/styles.css +98 -0
  11. package/package.json +2 -2
  12. package/src/MessageBubble.test.tsx +2 -2
  13. package/src/MessageText.test.tsx +27 -10
  14. package/src/MessageText.tsx +25 -17
  15. package/src/MessageTextCopiedBadge.tsx +10 -2
  16. package/src/StatusTicks.test.tsx +27 -6
  17. package/src/StatusTicks.tsx +30 -15
  18. package/src/legacyChannels.golden.test.ts +89 -0
  19. package/src/legacyDefaults.golden.test.tsx +127 -0
  20. package/src/legacyStyles.fixture.css +1121 -0
  21. package/src/legacyStyles.golden.test.ts +121 -0
  22. package/src/messageTextCopyInteraction.test.ts +75 -0
  23. package/src/messageTextCopyInteraction.ts +37 -0
  24. package/src/participant/ParticipantChannelBadges.test.tsx +59 -0
  25. package/src/participant/ParticipantChannelBadges.tsx +75 -0
  26. package/src/participant/ParticipantConversations.tsx +13 -6
  27. package/src/participant/ParticipantConversationsScreen.tsx +18 -7
  28. package/src/participant/ParticipantInbox.test.tsx +99 -2
  29. package/src/participant/ParticipantInbox.tsx +27 -46
  30. package/src/participant/ParticipantInboxRow.tsx +75 -0
  31. package/src/participant/ParticipantInboxSearchField.tsx +34 -0
  32. package/src/participant/ParticipantMessageBubble.test.tsx +2 -0
  33. package/src/participant/ParticipantMessageBubble.tsx +3 -3
  34. package/src/participant/ParticipantProtocolBadge.tsx +74 -0
  35. package/src/participant/ParticipantProtocolView.test.tsx +208 -0
  36. package/src/participant/ParticipantThread.test.tsx +19 -2
  37. package/src/participant/ParticipantThread.tsx +25 -15
  38. package/src/participant/index.ts +1 -0
  39. package/src/participant/participant.types.ts +9 -0
  40. package/src/participant/participantChannels.test.ts +42 -0
  41. package/src/participant/participantChannels.ts +33 -0
  42. package/src/participant/participantGrouping.test.ts +101 -3
  43. package/src/participant/participantGrouping.ts +20 -7
  44. package/src/participant/participantLabels.ts +29 -0
  45. package/src/participant/participantProtocol.test.ts +104 -0
  46. package/src/participant/participantProtocol.ts +52 -0
  47. package/src/participant/participantProtocolCopy.test.ts +45 -0
  48. package/src/participant/participantProtocolCopy.ts +32 -0
  49. package/src/styles.css +19 -1
  50. package/dist/chunk-WSFGNR5R.js +0 -55
@@ -1,55 +0,0 @@
1
- import {
2
- parseWhatsAppFormatting
3
- } from "./chunk-CBYEHPX6.js";
4
-
5
- // src/MessageText.tsx
6
- import { useCallback, useState } from "react";
7
-
8
- // src/theme.ts
9
- var CHAT_TEXT_PRIMARY_CLASS = "text-[#111b21] dark:text-[#e9edef]";
10
- var CHAT_TEXT_SECONDARY_CLASS = "text-[#667781] dark:text-[#8696a0]";
11
-
12
- // src/MessageTextCopiedBadge.tsx
13
- import { jsx } from "react/jsx-runtime";
14
- function MessageTextCopiedBadge({ label = "Copied" }) {
15
- return /* @__PURE__ */ jsx("span", { className: "cv-message-text__copied", children: label });
16
- }
17
-
18
- // src/MessageText.tsx
19
- import { jsx as jsx2, jsxs } from "react/jsx-runtime";
20
- function MessageText({ message, copyOnClick = true, copiedLabel }) {
21
- const [copied, setCopied] = useState(false);
22
- const handleCopy = useCallback(async () => {
23
- if (!copyOnClick || !message.content) return;
24
- try {
25
- await navigator.clipboard.writeText(message.content);
26
- setCopied(true);
27
- setTimeout(() => setCopied(false), 2e3);
28
- } catch {
29
- }
30
- }, [copyOnClick, message.content]);
31
- const handleKeyDown = (event) => {
32
- if (event.key !== "Enter" && event.key !== " ") return;
33
- event.preventDefault();
34
- void handleCopy();
35
- };
36
- if (message.type === "template")
37
- return /* @__PURE__ */ jsx2("p", { className: `text-sm italic ${CHAT_TEXT_SECONDARY_CLASS}`, children: message.content ?? "Template message" });
38
- return /* @__PURE__ */ jsxs(
39
- "div",
40
- {
41
- className: copyOnClick ? "cv-message-text cv-message-text--copyable" : "cv-message-text",
42
- ...copyOnClick ? { role: "button", tabIndex: 0, onClick: handleCopy, onKeyDown: handleKeyDown } : {},
43
- children: [
44
- /* @__PURE__ */ jsx2("div", { children: parseWhatsAppFormatting(message.content ?? "") }),
45
- copied && /* @__PURE__ */ jsx2(MessageTextCopiedBadge, { label: copiedLabel })
46
- ]
47
- }
48
- );
49
- }
50
-
51
- export {
52
- CHAT_TEXT_PRIMARY_CLASS,
53
- CHAT_TEXT_SECONDARY_CLASS,
54
- MessageText
55
- };