@adatechnology/conversations-ui 0.6.1 → 0.8.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 (119) hide show
  1. package/README.md +221 -19
  2. package/dist/{ConversationSimulatorPanel-CrfFjiWh.d.ts → ConversationSimulatorPanel-q-wVgBCN.d.ts} +1 -1
  3. package/dist/{chunk-HOKNKXIT.js → chunk-HMCOTZAX.js} +1 -1
  4. package/dist/{chunk-FAQLC3TX.js → chunk-L3OFAQPS.js} +2 -4
  5. package/dist/{chunk-CBYEHPX6.js → chunk-PJNR6UMN.js} +63 -1
  6. package/dist/flows/index.js +3 -5
  7. package/dist/index.d.ts +4 -4
  8. package/dist/index.js +834 -764
  9. package/dist/participant/index.d.ts +62 -3
  10. package/dist/participant/index.js +1444 -394
  11. package/dist/preview/index.d.ts +3 -3
  12. package/dist/preview/index.js +2 -3
  13. package/dist/{quickReply.types-B4gmZsSr.d.ts → quickReply.types-DzWH3NYV.d.ts} +1 -1
  14. package/dist/styles.css +629 -20
  15. package/package.json +3 -3
  16. package/src/participant/ConversationThread.test.tsx +165 -0
  17. package/src/participant/ConversationThread.tsx +117 -0
  18. package/src/participant/ParticipantAuthorAvatar.test.tsx +30 -0
  19. package/src/participant/ParticipantAuthorAvatar.tsx +24 -0
  20. package/src/participant/ParticipantBackButton.tsx +14 -0
  21. package/src/participant/ParticipantBubbleStatus.tsx +67 -0
  22. package/src/participant/ParticipantChannelBadges.tsx +13 -4
  23. package/src/participant/ParticipantComposer.tsx +8 -40
  24. package/src/participant/ParticipantComposerControls.tsx +83 -0
  25. package/src/participant/ParticipantConversationAvatar.tsx +13 -0
  26. package/src/participant/ParticipantConversations.tsx +7 -0
  27. package/src/participant/ParticipantConversationsOptions.test.tsx +87 -0
  28. package/src/participant/ParticipantCopyAnnouncer.tsx +48 -0
  29. package/src/participant/ParticipantCopyableToken.tsx +51 -0
  30. package/src/participant/ParticipantDayDivider.tsx +18 -0
  31. package/src/participant/ParticipantInbox.tsx +3 -1
  32. package/src/participant/ParticipantInboxRow.tsx +6 -4
  33. package/src/participant/ParticipantMessageBubble.test.tsx +52 -5
  34. package/src/participant/ParticipantMessageBubble.tsx +32 -84
  35. package/src/participant/ParticipantMessageNodes.tsx +54 -0
  36. package/src/participant/ParticipantMessageText.test.tsx +106 -0
  37. package/src/participant/ParticipantMessageText.tsx +52 -0
  38. package/src/participant/ParticipantProtocolBadge.tsx +15 -7
  39. package/src/participant/ParticipantProtocolView.test.tsx +4 -6
  40. package/src/participant/ParticipantScrollToLatest.test.tsx +153 -0
  41. package/src/participant/ParticipantScrollToLatest.tsx +40 -0
  42. package/src/participant/ParticipantThread.test.tsx +37 -0
  43. package/src/participant/ParticipantThread.tsx +54 -95
  44. package/src/participant/ParticipantThreadAvatarSequence.test.tsx +65 -0
  45. package/src/participant/ParticipantThreadHeader.test.tsx +181 -0
  46. package/src/participant/ParticipantThreadHeader.tsx +83 -0
  47. package/src/participant/ParticipantThreadScreen.tsx +30 -56
  48. package/src/participant/ParticipantTimeline.tsx +106 -0
  49. package/src/participant/conversationThreadApi.test.ts +27 -0
  50. package/src/participant/conversationThreadApi.ts +24 -0
  51. package/src/participant/conversationThreadCss.test.ts +116 -0
  52. package/src/participant/conversationThreadSummary.ts +34 -0
  53. package/src/participant/index.ts +4 -0
  54. package/src/participant/participantAutoGrow.test.ts +43 -0
  55. package/src/participant/participantAutoGrow.ts +12 -0
  56. package/src/participant/participantAvatar.test.ts +74 -0
  57. package/src/participant/participantAvatar.ts +48 -0
  58. package/src/participant/participantBubbleTail.test.tsx +107 -0
  59. package/src/participant/participantChatDesign.test.tsx +198 -0
  60. package/src/participant/participantContrast.test-helper.ts +116 -0
  61. package/src/participant/participantCopyAnnouncement.test.ts +52 -0
  62. package/src/participant/participantCopyAnnouncement.ts +37 -0
  63. package/src/participant/participantCss.test-helper.ts +34 -0
  64. package/src/participant/participantDay.test.ts +22 -0
  65. package/src/participant/participantDay.ts +8 -0
  66. package/src/participant/participantDocuments.ts +45 -0
  67. package/src/participant/participantGolden.test.tsx +46 -0
  68. package/src/participant/participantGoldenScenarios.test-helper.tsx +57 -0
  69. package/src/participant/participantHeaderA11y.test.tsx +85 -0
  70. package/src/participant/participantHeaderDesign.test.tsx +111 -0
  71. package/src/participant/participantLabels.ts +11 -0
  72. package/src/participant/participantMessageAtoms.ts +53 -0
  73. package/src/participant/participantMessageCopyables.test.ts +141 -0
  74. package/src/participant/participantMessageCopyables.ts +76 -0
  75. package/src/participant/participantMessageFormat.test-helper.ts +21 -0
  76. package/src/participant/participantMessageFormat.test.ts +177 -0
  77. package/src/participant/participantMessageFormat.ts +135 -0
  78. package/src/participant/participantMessageFormat.types.ts +22 -0
  79. package/src/participant/participantMessageInline.test.ts +82 -0
  80. package/src/participant/participantMessageInline.ts +99 -0
  81. package/src/participant/participantMessageLinks.test.ts +100 -0
  82. package/src/participant/participantMessageLinks.ts +54 -0
  83. package/src/participant/participantMessageTextStyle.test.ts +137 -0
  84. package/src/participant/participantMessages.ts +4 -3
  85. package/src/participant/participantNewMessages.test.ts +21 -0
  86. package/src/participant/participantNewMessages.ts +8 -3
  87. package/src/participant/participantPerspective.test.ts +67 -0
  88. package/src/participant/participantPerspective.ts +50 -0
  89. package/src/participant/participantPerspectiveRender.test.tsx +94 -0
  90. package/src/participant/participantScrollFocus.test.ts +22 -0
  91. package/src/participant/participantScrollFocus.ts +10 -0
  92. package/src/participant/participantScrollView.test.ts +74 -0
  93. package/src/participant/participantScrollView.ts +38 -0
  94. package/src/participant/participantScrollbars.test.ts +156 -0
  95. package/src/participant/participantSubjectIcon.test.tsx +27 -0
  96. package/src/participant/participantSubjectIcon.ts +26 -0
  97. package/src/participant/participantThemeContrast.test.ts +98 -0
  98. package/src/participant/test-fixtures/conversations-list.golden.html +1 -0
  99. package/src/participant/test-fixtures/conversations-selected.golden.html +1 -0
  100. package/src/participant/test-fixtures/thread-avatars-initials.golden.html +1 -0
  101. package/src/participant/test-fixtures/thread-closed.golden.html +1 -0
  102. package/src/participant/test-fixtures/thread-default.golden.html +1 -0
  103. package/src/participant/test-fixtures/thread-error.golden.html +1 -0
  104. package/src/participant/test-fixtures/thread-loading.golden.html +1 -0
  105. package/src/participant/test-fixtures/thread-plain.golden.html +1 -0
  106. package/src/participant/test-fixtures/thread-tail-off.golden.html +1 -0
  107. package/src/participant/useParticipantConversationView.ts +3 -0
  108. package/src/participant/useParticipantCopyFeedback.ts +33 -0
  109. package/src/participant/useParticipantThread.ts +13 -2
  110. package/src/participant/useParticipantThreadController.ts +112 -0
  111. package/src/participant/useParticipantThreadScroll.ts +13 -3
  112. package/src/participant/useParticipantUnread.test.tsx +40 -0
  113. package/src/participant/useParticipantUnread.ts +38 -0
  114. package/src/participant/useRevealActiveChip.ts +20 -0
  115. package/src/participant/useScrollAwayState.ts +24 -0
  116. package/src/participant/useStickToBottom.ts +16 -2
  117. package/src/styles.css +151 -23
  118. package/dist/chunk-MRVFFJEH.js +0 -64
  119. package/dist/chunk-OVFCLRQQ.js +0 -84
@@ -1,8 +1,12 @@
1
1
  import * as react from 'react';
2
2
  import { ReactNode } from 'react';
3
- import { ParticipantConversationSummary, ParticipantSubjectRef, ParticipantConversationPage, ParticipantMessage, ParticipantAttachment } from '@adatechnology/conversation-contracts';
3
+ import { ParticipantConversationSummary, ParticipantConversationPage, ParticipantSubjectRef, ParticipantMessage, ParticipantAttachment } from '@adatechnology/conversation-contracts';
4
4
  export { ParticipantAttachment, ParticipantConversationPage, ParticipantConversationSummary, ParticipantMessage, ParticipantSubjectRef } from '@adatechnology/conversation-contracts';
5
- import { C as ConversationChannel, a as ConversationsTheme, Q as QuickReply } from '../quickReply.types-B4gmZsSr.js';
5
+ import { C as ConversationChannel, d as ConversationsTheme, Q as QuickReply } from '../quickReply.types-DzWH3NYV.js';
6
+
7
+ type ParticipantAuthorAvatarRenderer = (author: {
8
+ name: string | null;
9
+ }) => ReactNode;
6
10
 
7
11
  type ParticipantSubjectGroup = {
8
12
  readonly subjectType: string;
@@ -116,6 +120,8 @@ type ParticipantConversationsLabels = {
116
120
  readonly me: string;
117
121
  readonly newMessages: string;
118
122
  readonly loadOlder: string;
123
+ /** Accessible name of the floating button that returns to the end of the conversation. */
124
+ readonly scrollToLatest: string;
119
125
  readonly closedNotice: string;
120
126
  readonly messageInputLabel: string;
121
127
  readonly messageInputPlaceholder: string;
@@ -156,6 +162,11 @@ type ParticipantConversationsLabels = {
156
162
  readonly channelEmail: string;
157
163
  readonly channelPortal: string;
158
164
  readonly channelWebchat: string;
165
+ /** Spoken after a link that opens in a new tab. */
166
+ readonly externalLinkHint: string;
167
+ /** Prefix of the accessible name of the copy buttons: "Copy 529.982.247-25". */
168
+ readonly copyValue: string;
169
+ readonly valueCopied: string;
159
170
  };
160
171
  declare const DEFAULT_PARTICIPANT_CONVERSATIONS_LABELS: ParticipantConversationsLabels;
161
172
 
@@ -178,9 +189,57 @@ type ParticipantConversationsProps = {
178
189
  renderSubjectIcon?: ParticipantSubjectIconRenderer;
179
190
  renderSubjectCard?: (conversation: ParticipantConversationSummary) => ReactNode;
180
191
  onOpenSubject?: (subject: ParticipantSubjectRef) => void;
192
+ /** Absent draws no avatar. The SDK has no photo: the host supplies it through renderAuthorAvatar. */
193
+ avatars?: 'initials';
194
+ /** Host slot for the author's photo; wins over 'initials' and enables avatars on its own. */
195
+ renderAuthorAvatar?: ParticipantAuthorAvatarRenderer;
196
+ /** Speech-bubble tail on the bottom corner; false removes it. Default true. */
197
+ tail?: boolean;
181
198
  };
182
199
  declare function ParticipantConversations(props: ParticipantConversationsProps): react.JSX.Element;
183
200
 
201
+ /** What one conversation needs from the host: no list, no open-by-subject. `markRead` and `subscribe` are optional. */
202
+ type ConversationThreadApi = Pick<ParticipantConversationsApi, 'fetchMessages' | 'sendMessage' | 'resolveAttachmentUrl'> & Partial<Pick<ParticipantConversationsApi, 'markRead' | 'subscribe'>>;
203
+
204
+ /** Who is looking at the conversation. `participant` is the outside party; `operator` is the company. */
205
+ type ParticipantPerspective = 'participant' | 'operator';
206
+
207
+ type ConversationThreadProps = {
208
+ readonly api: ConversationThreadApi;
209
+ readonly subject: ParticipantSubjectRef;
210
+ /** `participant` (default) is the outside party; `operator` is the company, which owns the outbound messages. */
211
+ readonly perspective?: ParticipantPerspective;
212
+ readonly title: string;
213
+ readonly protocol?: string;
214
+ readonly channels?: ParticipantConversationSummary['channels'];
215
+ /** `closed` removes the composer and shows `labels.closedNotice`. */
216
+ readonly status?: 'open' | 'closed';
217
+ /** Short line under the title, written by the host (for example "Participant: Ana"). */
218
+ readonly counterpartLabel?: string;
219
+ /** Slot at the end of the header bar for the host's own actions (close, reopen...). The package knows none of them. */
220
+ readonly headerActions?: ReactNode;
221
+ /** Absent draws no back arrow. */
222
+ readonly onBack?: () => void;
223
+ readonly renderSubjectIcon?: ParticipantSubjectIconRenderer;
224
+ readonly subjectGroups?: readonly ParticipantSubjectGroup[];
225
+ /** Chips above the field: tapping one fills the text, it never sends. */
226
+ readonly quickReplies?: readonly QuickReply[];
227
+ readonly labels?: Partial<ParticipantConversationsLabels>;
228
+ readonly theme?: ConversationsTheme;
229
+ readonly className?: string;
230
+ readonly locale?: string;
231
+ readonly channel?: ConversationChannel;
232
+ readonly pendingMessages?: readonly ParticipantPendingMessage[];
233
+ readonly onRetryPending?: (clientMessageId: string) => void;
234
+ /** Tells the host the other side's messages were marked read, to refresh its own badges. */
235
+ readonly onMarkedRead?: (subject: ParticipantSubjectRef) => void;
236
+ readonly tail?: boolean;
237
+ readonly avatars?: 'initials';
238
+ readonly renderAuthorAvatar?: ParticipantAuthorAvatarRenderer;
239
+ };
240
+ /** One conversation about one subject, drawn like the participant app and seen from either side. */
241
+ declare function ConversationThread(props: ConversationThreadProps): react.JSX.Element;
242
+
184
243
  declare function groupParticipantConversations(params: GroupParticipantConversationsParams): ParticipantInboxView;
185
244
 
186
- export { DEFAULT_PARTICIPANT_CONVERSATIONS_LABELS, type GroupParticipantConversationsParams, type ParticipantConversationEvent, ParticipantConversations, type ParticipantConversationsApi, type ParticipantConversationsClassNames, type ParticipantConversationsLabels, type ParticipantConversationsProps, type ParticipantInboxSection, type ParticipantInboxView, type ParticipantLocalPendingMessage, type ParticipantPendingMessage, type ParticipantSendInput, type ParticipantSendResult, type ParticipantSubjectGroup, type ParticipantSubjectIconRenderer, groupParticipantConversations };
245
+ export { ConversationThread, type ConversationThreadApi, type ConversationThreadProps, DEFAULT_PARTICIPANT_CONVERSATIONS_LABELS, type GroupParticipantConversationsParams, type ParticipantAuthorAvatarRenderer, type ParticipantConversationEvent, ParticipantConversations, type ParticipantConversationsApi, type ParticipantConversationsClassNames, type ParticipantConversationsLabels, type ParticipantConversationsProps, type ParticipantInboxSection, type ParticipantInboxView, type ParticipantLocalPendingMessage, type ParticipantPendingMessage, type ParticipantPerspective, type ParticipantSendInput, type ParticipantSendResult, type ParticipantSubjectGroup, type ParticipantSubjectIconRenderer, groupParticipantConversations };