@pega/cosmos-react-social 2.1.5 → 2.1.6

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 (197) hide show
  1. package/package.json +4 -4
  2. package/lib/components/Chat/Chat.d.ts +0 -31
  3. package/lib/components/Chat/Chat.d.ts.map +0 -1
  4. package/lib/components/Chat/Chat.js +0 -67
  5. package/lib/components/Chat/Chat.js.map +0 -1
  6. package/lib/components/Chat/Chat.types.d.ts +0 -23
  7. package/lib/components/Chat/Chat.types.d.ts.map +0 -1
  8. package/lib/components/Chat/Chat.types.js +0 -2
  9. package/lib/components/Chat/Chat.types.js.map +0 -1
  10. package/lib/components/Chat/ChatBody.d.ts +0 -12
  11. package/lib/components/Chat/ChatBody.d.ts.map +0 -1
  12. package/lib/components/Chat/ChatBody.js +0 -18
  13. package/lib/components/Chat/ChatBody.js.map +0 -1
  14. package/lib/components/Chat/ChatComposer.d.ts +0 -51
  15. package/lib/components/Chat/ChatComposer.d.ts.map +0 -1
  16. package/lib/components/Chat/ChatComposer.js +0 -213
  17. package/lib/components/Chat/ChatComposer.js.map +0 -1
  18. package/lib/components/Chat/ChatHeader.d.ts +0 -15
  19. package/lib/components/Chat/ChatHeader.d.ts.map +0 -1
  20. package/lib/components/Chat/ChatHeader.js +0 -28
  21. package/lib/components/Chat/ChatHeader.js.map +0 -1
  22. package/lib/components/Chat/ChatTranscript.d.ts +0 -23
  23. package/lib/components/Chat/ChatTranscript.d.ts.map +0 -1
  24. package/lib/components/Chat/ChatTranscript.js +0 -45
  25. package/lib/components/Chat/ChatTranscript.js.map +0 -1
  26. package/lib/components/Chat/Message.d.ts +0 -46
  27. package/lib/components/Chat/Message.d.ts.map +0 -1
  28. package/lib/components/Chat/Message.js +0 -59
  29. package/lib/components/Chat/Message.js.map +0 -1
  30. package/lib/components/Chat/Message.styles.d.ts +0 -29
  31. package/lib/components/Chat/Message.styles.d.ts.map +0 -1
  32. package/lib/components/Chat/Message.styles.js +0 -193
  33. package/lib/components/Chat/Message.styles.js.map +0 -1
  34. package/lib/components/Chat/MessageList.d.ts +0 -35
  35. package/lib/components/Chat/MessageList.d.ts.map +0 -1
  36. package/lib/components/Chat/MessageList.js +0 -123
  37. package/lib/components/Chat/MessageList.js.map +0 -1
  38. package/lib/components/Chat/RepeatingView.d.ts +0 -31
  39. package/lib/components/Chat/RepeatingView.d.ts.map +0 -1
  40. package/lib/components/Chat/RepeatingView.js +0 -47
  41. package/lib/components/Chat/RepeatingView.js.map +0 -1
  42. package/lib/components/Chat/SuggestedReplyPicker.d.ts +0 -26
  43. package/lib/components/Chat/SuggestedReplyPicker.d.ts.map +0 -1
  44. package/lib/components/Chat/SuggestedReplyPicker.js +0 -78
  45. package/lib/components/Chat/SuggestedReplyPicker.js.map +0 -1
  46. package/lib/components/Chat/SystemMessage.d.ts +0 -19
  47. package/lib/components/Chat/SystemMessage.d.ts.map +0 -1
  48. package/lib/components/Chat/SystemMessage.js +0 -40
  49. package/lib/components/Chat/SystemMessage.js.map +0 -1
  50. package/lib/components/Chat/TranscriptMessage.d.ts +0 -25
  51. package/lib/components/Chat/TranscriptMessage.d.ts.map +0 -1
  52. package/lib/components/Chat/TranscriptMessage.js +0 -47
  53. package/lib/components/Chat/TranscriptMessage.js.map +0 -1
  54. package/lib/components/Chat/TypeIndicator.d.ts +0 -13
  55. package/lib/components/Chat/TypeIndicator.d.ts.map +0 -1
  56. package/lib/components/Chat/TypeIndicator.js +0 -9
  57. package/lib/components/Chat/TypeIndicator.js.map +0 -1
  58. package/lib/components/Chat/index.d.ts +0 -14
  59. package/lib/components/Chat/index.d.ts.map +0 -1
  60. package/lib/components/Chat/index.js +0 -13
  61. package/lib/components/Chat/index.js.map +0 -1
  62. package/lib/components/Email/Email.d.ts +0 -6
  63. package/lib/components/Email/Email.d.ts.map +0 -1
  64. package/lib/components/Email/Email.js +0 -153
  65. package/lib/components/Email/Email.js.map +0 -1
  66. package/lib/components/Email/Email.styles.d.ts +0 -18
  67. package/lib/components/Email/Email.styles.d.ts.map +0 -1
  68. package/lib/components/Email/Email.styles.js +0 -131
  69. package/lib/components/Email/Email.styles.js.map +0 -1
  70. package/lib/components/Email/Email.types.d.ts +0 -237
  71. package/lib/components/Email/Email.types.d.ts.map +0 -1
  72. package/lib/components/Email/Email.types.js +0 -2
  73. package/lib/components/Email/Email.types.js.map +0 -1
  74. package/lib/components/Email/EmailComposer.d.ts +0 -9
  75. package/lib/components/Email/EmailComposer.d.ts.map +0 -1
  76. package/lib/components/Email/EmailComposer.js +0 -185
  77. package/lib/components/Email/EmailComposer.js.map +0 -1
  78. package/lib/components/Email/EmailConversation.d.ts +0 -14
  79. package/lib/components/Email/EmailConversation.d.ts.map +0 -1
  80. package/lib/components/Email/EmailConversation.js +0 -179
  81. package/lib/components/Email/EmailConversation.js.map +0 -1
  82. package/lib/components/Email/EmailEntity.d.ts +0 -6
  83. package/lib/components/Email/EmailEntity.d.ts.map +0 -1
  84. package/lib/components/Email/EmailEntity.js +0 -19
  85. package/lib/components/Email/EmailEntity.js.map +0 -1
  86. package/lib/components/Email/EmailSelector.d.ts +0 -19
  87. package/lib/components/Email/EmailSelector.d.ts.map +0 -1
  88. package/lib/components/Email/EmailSelector.js +0 -103
  89. package/lib/components/Email/EmailSelector.js.map +0 -1
  90. package/lib/components/Email/EmailShell.d.ts +0 -9
  91. package/lib/components/Email/EmailShell.d.ts.map +0 -1
  92. package/lib/components/Email/EmailShell.js +0 -56
  93. package/lib/components/Email/EmailShell.js.map +0 -1
  94. package/lib/components/Email/EmailSummaryItem.d.ts +0 -10
  95. package/lib/components/Email/EmailSummaryItem.d.ts.map +0 -1
  96. package/lib/components/Email/EmailSummaryItem.js +0 -93
  97. package/lib/components/Email/EmailSummaryItem.js.map +0 -1
  98. package/lib/components/Email/EmailSummaryList.d.ts +0 -6
  99. package/lib/components/Email/EmailSummaryList.d.ts.map +0 -1
  100. package/lib/components/Email/EmailSummaryList.js +0 -115
  101. package/lib/components/Email/EmailSummaryList.js.map +0 -1
  102. package/lib/components/Email/ViewAnalysis.d.ts +0 -6
  103. package/lib/components/Email/ViewAnalysis.d.ts.map +0 -1
  104. package/lib/components/Email/ViewAnalysis.js +0 -20
  105. package/lib/components/Email/ViewAnalysis.js.map +0 -1
  106. package/lib/components/Email/index.d.ts +0 -9
  107. package/lib/components/Email/index.d.ts.map +0 -1
  108. package/lib/components/Email/index.js +0 -8
  109. package/lib/components/Email/index.js.map +0 -1
  110. package/lib/components/Feed/Feed.context.d.ts +0 -35
  111. package/lib/components/Feed/Feed.context.d.ts.map +0 -1
  112. package/lib/components/Feed/Feed.context.js +0 -8
  113. package/lib/components/Feed/Feed.context.js.map +0 -1
  114. package/lib/components/Feed/Feed.d.ts +0 -52
  115. package/lib/components/Feed/Feed.d.ts.map +0 -1
  116. package/lib/components/Feed/Feed.js +0 -143
  117. package/lib/components/Feed/Feed.js.map +0 -1
  118. package/lib/components/Feed/FeedAnnouncer.d.ts +0 -7
  119. package/lib/components/Feed/FeedAnnouncer.d.ts.map +0 -1
  120. package/lib/components/Feed/FeedAnnouncer.js +0 -11
  121. package/lib/components/Feed/FeedAnnouncer.js.map +0 -1
  122. package/lib/components/Feed/FeedAttachments.d.ts +0 -14
  123. package/lib/components/Feed/FeedAttachments.d.ts.map +0 -1
  124. package/lib/components/Feed/FeedAttachments.js +0 -94
  125. package/lib/components/Feed/FeedAttachments.js.map +0 -1
  126. package/lib/components/Feed/FeedButton.d.ts +0 -6
  127. package/lib/components/Feed/FeedButton.d.ts.map +0 -1
  128. package/lib/components/Feed/FeedButton.js +0 -23
  129. package/lib/components/Feed/FeedButton.js.map +0 -1
  130. package/lib/components/Feed/FeedContent.d.ts +0 -14
  131. package/lib/components/Feed/FeedContent.d.ts.map +0 -1
  132. package/lib/components/Feed/FeedContent.js +0 -39
  133. package/lib/components/Feed/FeedContent.js.map +0 -1
  134. package/lib/components/Feed/FeedLikeButton.d.ts +0 -19
  135. package/lib/components/Feed/FeedLikeButton.d.ts.map +0 -1
  136. package/lib/components/Feed/FeedLikeButton.js +0 -87
  137. package/lib/components/Feed/FeedLikeButton.js.map +0 -1
  138. package/lib/components/Feed/FeedModalList.d.ts +0 -15
  139. package/lib/components/Feed/FeedModalList.d.ts.map +0 -1
  140. package/lib/components/Feed/FeedModalList.js +0 -49
  141. package/lib/components/Feed/FeedModalList.js.map +0 -1
  142. package/lib/components/Feed/FeedNewPost.d.ts +0 -36
  143. package/lib/components/Feed/FeedNewPost.d.ts.map +0 -1
  144. package/lib/components/Feed/FeedNewPost.js +0 -108
  145. package/lib/components/Feed/FeedNewPost.js.map +0 -1
  146. package/lib/components/Feed/FeedNewPostTypeMenu.d.ts +0 -35
  147. package/lib/components/Feed/FeedNewPostTypeMenu.d.ts.map +0 -1
  148. package/lib/components/Feed/FeedNewPostTypeMenu.js +0 -387
  149. package/lib/components/Feed/FeedNewPostTypeMenu.js.map +0 -1
  150. package/lib/components/Feed/FeedPost.d.ts +0 -10
  151. package/lib/components/Feed/FeedPost.d.ts.map +0 -1
  152. package/lib/components/Feed/FeedPost.js +0 -185
  153. package/lib/components/Feed/FeedPost.js.map +0 -1
  154. package/lib/components/Feed/FeedPost.types.d.ts +0 -101
  155. package/lib/components/Feed/FeedPost.types.d.ts.map +0 -1
  156. package/lib/components/Feed/FeedPost.types.js +0 -2
  157. package/lib/components/Feed/FeedPost.types.js.map +0 -1
  158. package/lib/components/Feed/FeedReply.d.ts +0 -10
  159. package/lib/components/Feed/FeedReply.d.ts.map +0 -1
  160. package/lib/components/Feed/FeedReply.js +0 -131
  161. package/lib/components/Feed/FeedReply.js.map +0 -1
  162. package/lib/components/Feed/FeedReply.types.d.ts +0 -68
  163. package/lib/components/Feed/FeedReply.types.d.ts.map +0 -1
  164. package/lib/components/Feed/FeedReply.types.js +0 -2
  165. package/lib/components/Feed/FeedReply.types.js.map +0 -1
  166. package/lib/components/Feed/FeedReplyInput.d.ts +0 -32
  167. package/lib/components/Feed/FeedReplyInput.d.ts.map +0 -1
  168. package/lib/components/Feed/FeedReplyInput.js +0 -105
  169. package/lib/components/Feed/FeedReplyInput.js.map +0 -1
  170. package/lib/components/Feed/FeedRichText.d.ts +0 -9
  171. package/lib/components/Feed/FeedRichText.d.ts.map +0 -1
  172. package/lib/components/Feed/FeedRichText.js +0 -96
  173. package/lib/components/Feed/FeedRichText.js.map +0 -1
  174. package/lib/components/Feed/index.d.ts +0 -10
  175. package/lib/components/Feed/index.d.ts.map +0 -1
  176. package/lib/components/Feed/index.js +0 -6
  177. package/lib/components/Feed/index.js.map +0 -1
  178. package/lib/components/HashtagButton/HashtagButton.d.ts +0 -16
  179. package/lib/components/HashtagButton/HashtagButton.d.ts.map +0 -1
  180. package/lib/components/HashtagButton/HashtagButton.js +0 -31
  181. package/lib/components/HashtagButton/HashtagButton.js.map +0 -1
  182. package/lib/components/HashtagButton/index.d.ts +0 -3
  183. package/lib/components/HashtagButton/index.d.ts.map +0 -1
  184. package/lib/components/HashtagButton/index.js +0 -3
  185. package/lib/components/HashtagButton/index.js.map +0 -1
  186. package/lib/components/MentionButton/MentionButton.d.ts +0 -20
  187. package/lib/components/MentionButton/MentionButton.d.ts.map +0 -1
  188. package/lib/components/MentionButton/MentionButton.js +0 -58
  189. package/lib/components/MentionButton/MentionButton.js.map +0 -1
  190. package/lib/components/MentionButton/index.d.ts +0 -3
  191. package/lib/components/MentionButton/index.d.ts.map +0 -1
  192. package/lib/components/MentionButton/index.js +0 -3
  193. package/lib/components/MentionButton/index.js.map +0 -1
  194. package/lib/index.d.ts +0 -11
  195. package/lib/index.d.ts.map +0 -1
  196. package/lib/index.js +0 -12
  197. package/lib/index.js.map +0 -1
@@ -1,237 +0,0 @@
1
- import { MouseEventHandler, ReactNode, Ref } from 'react';
2
- import { BaseProps, AvatarProps, SentimentProps, FileDisplayProps, FileUploadItemProps, OmitStrict, MenuProps, MenuItemProps, TooltipProps, NoChildrenProp } from '@pega/cosmos-react-core';
3
- import { RichTextEditorProps } from '@pega/cosmos-react-rte';
4
- export interface EmailTemplate {
5
- /** Template title */
6
- title: string;
7
- /** Template value */
8
- content: string;
9
- /** Template id */
10
- id: string;
11
- }
12
- export interface EmailUser {
13
- /** Short name of the User */
14
- shortName: string;
15
- /** Full name of the User */
16
- fullName: string;
17
- /** Email of the User */
18
- emailAddress: string;
19
- /** Avatar props of the User */
20
- avatarProps?: Partial<AvatarProps>;
21
- }
22
- export interface EntityHighlightMapping {
23
- value: string;
24
- type: string;
25
- name: string;
26
- variant: number;
27
- description?: TooltipProps['children'];
28
- icon?: string;
29
- }
30
- export interface EmailProps extends BaseProps, NoChildrenProp {
31
- /** Ref to the element */
32
- ref?: Ref<HTMLDivElement>;
33
- /** Unique ID for this email record */
34
- id: string;
35
- /** Timestamp of this email as ISO8601 string, timestamp or native Date object. */
36
- timeStamp: Date | number | string;
37
- /** From email */
38
- from: EmailUser;
39
- /** To email */
40
- to: EmailUser[];
41
- /** Carbon copy of email users list */
42
- cc?: EmailUser[];
43
- /** Blind carbon copy of email users list */
44
- bcc?: EmailUser[];
45
- /** Sentiment */
46
- sentiment?: SentimentProps;
47
- /** Subject of the email */
48
- subject?: string;
49
- /** Body */
50
- body?: ReactNode | string;
51
- /** Entity highlight mapping */
52
- entityHighlightMapping?: EntityHighlightMapping[];
53
- /** onReply callback */
54
- onReply: (id: EmailProps['id']) => void;
55
- /** onForward Callback */
56
- onForward: (id: EmailProps['id']) => void;
57
- /** onReply callback */
58
- onReplyAll?: (id: EmailProps['id']) => void;
59
- /** List of suggestions */
60
- suggestions?: EmailTemplate[];
61
- /** Callback that triggers on click of tag */
62
- onSuggestionClick?: (id: EmailProps['id'], suggestionId: EmailTemplate['id']) => void;
63
- /** Actions region */
64
- actions?: ReactNode;
65
- /** Flag that indicates if email is unread
66
- * @default false
67
- */
68
- unRead?: boolean;
69
- /** Attachments list */
70
- attachments?: FileDisplayProps[];
71
- }
72
- export interface EmailConversationProps extends BaseProps {
73
- /** ref to the element */
74
- ref?: Ref<HTMLLIElement>;
75
- /** Unique ID for this email conversation record */
76
- id: string;
77
- /** List of mails */
78
- emails: EmailProps[];
79
- /** Sender(s) of this email conversation */
80
- from: EmailUser;
81
- /** Recipient(s) of this email conversation */
82
- to: EmailUser[];
83
- /** Count of unread emails */
84
- unReadEmailCount?: number;
85
- /** Timestamp of this conversation as ISO8601 string, timestamp or native Date object. */
86
- timeStamp: Date | string | number;
87
- /** Flag that indicates if email conversation is expanded */
88
- isCollapsed?: boolean;
89
- /** Flag to set if conversation is spun off from forwarded email */
90
- isForwarded?: boolean;
91
- /** Callback when email conversation is collapsed */
92
- onCollapse?: () => void;
93
- /** Callback when email conversation is expanded */
94
- onExpand?: () => void;
95
- }
96
- export interface EmailComposerData extends Pick<EmailComposerProps, 'cc' | 'bcc' | 'subject' | 'bodyContent' | 'attachments' | 'responseType'> {
97
- /** Array to hold the initial participants that should be default initialized in To address. */
98
- to: EmailUser['emailAddress'][];
99
- }
100
- export declare type EmailResponseType = 'reply' | 'replyAll' | 'forward';
101
- export interface EmailDirectRecipients {
102
- /** To address/addresses in case of reply response type on email. */
103
- reply: EmailUser['emailAddress'][];
104
- /** To address/addresses in case of replyAll response type on email. */
105
- replyAll: EmailUser['emailAddress'][];
106
- /** To address/addresses in case of forward response type on email. */
107
- forward?: EmailUser['emailAddress'][];
108
- }
109
- export interface EmailComposerProps extends Pick<EmailProps, 'attachments' | 'suggestions' | 'onSuggestionClick'>, BaseProps, NoChildrenProp {
110
- /** Object containing full list of email participants. */
111
- participants: EmailUser[];
112
- /** Object to hold initial to address/addresses based on different action types. */
113
- to?: EmailDirectRecipients;
114
- /** Array to hold the initial participants that should be default initialized in Cc address. */
115
- cc?: EmailUser['emailAddress'][];
116
- /** Array to hold the initial participants that should be default initialized in Bcc address. */
117
- bcc?: EmailUser['emailAddress'][];
118
- /** Object containing the props to render the subject input */
119
- subject: string;
120
- /** Body content of the email */
121
- bodyContent: string;
122
- /** Initial Value of template */
123
- defaultTemplate?: string;
124
- /** Callback when email needs to be sent */
125
- onSend: (data: EmailComposerData) => void;
126
- /** Callback when image is added */
127
- onImageAdded?: RichTextEditorProps['onImageAdded'];
128
- /** List of attachments */
129
- attachments?: FileUploadItemProps[];
130
- /** Region to show more actions in footer */
131
- footerMoreActions?: ReactNode;
132
- /** Templates for drafting email */
133
- templates?: EmailTemplate[];
134
- /** Callback when cancel composing */
135
- onCancel: () => void;
136
- /**
137
- * Callback to handle external entry validation
138
- * If returned true considers the entry to be a valid entry
139
- */
140
- externalValidator?: (value: string) => boolean;
141
- /** Ref to the element */
142
- ref?: Ref<HTMLDivElement>;
143
- /** Email action types */
144
- responseType?: EmailResponseType;
145
- }
146
- export interface EmailShellProps extends BaseProps {
147
- /** ref to the element */
148
- ref?: Ref<HTMLDivElement>;
149
- /** Region for header */
150
- headerProps?: {
151
- /** Region for actions */
152
- actions?: ReactNode;
153
- /** Subject of the email conversations list */
154
- subject?: string;
155
- };
156
- /** Email conversations */
157
- conversations?: EmailConversationProps[];
158
- /** Shows only one conversation at a time */
159
- autoCollapse?: boolean;
160
- }
161
- export interface EmailSummaryItemProps extends BaseProps {
162
- /** Id of each summary item */
163
- id: string;
164
- /** List of from participant names of the conversations */
165
- activeParticipants: EmailUser[];
166
- /** Email body of last email in the email */
167
- message: string;
168
- /** Timestamp of the latest email */
169
- timeStamp: Date | string | number;
170
- /** Top topic of an email */
171
- topic: string;
172
- /** Sentiment */
173
- sentiment?: SentimentProps;
174
- /** Urgency of an email */
175
- urgency?: number;
176
- /** Total number of unread emails in the email */
177
- unreadEmailCount?: number;
178
- /** Is the email currently active */
179
- active?: boolean;
180
- /** On click of email item */
181
- onClick: MouseEventHandler;
182
- /** ref to the element */
183
- ref?: Ref<HTMLButtonElement>;
184
- }
185
- export interface Filter {
186
- /** Sets DOM id for the control and associates label element via 'for' attribute. */
187
- id: string;
188
- /** Pass a string or a fragment with an Icon and string for the filter label. */
189
- label: ReactNode;
190
- /**
191
- * Disables the filter.
192
- * @default false
193
- */
194
- disabled?: boolean;
195
- /**
196
- * Sets on prop via onFilterChange.
197
- * @default false
198
- */
199
- on?: boolean;
200
- }
201
- export interface EmailSummaryListProps extends BaseProps {
202
- /** List of email categories */
203
- categories: MenuProps['items'];
204
- /** Handles category change */
205
- onCategoryClick?: MenuItemProps['onClick'];
206
- /** List of EmailItems items */
207
- items: OmitStrict<EmailSummaryItemProps, 'onClick' | 'active'>[];
208
- /** Total number of unread email count */
209
- unreadEmailCount?: number;
210
- /** A set of filters to apply to the email inbox. */
211
- filters?: Filter[];
212
- /** A callback that runs when a filter is clicked. */
213
- onFilterChange?: (filterId: Filter['id'], on: boolean) => void;
214
- /** onClick of list item */
215
- onItemClick: (id: EmailSummaryItemProps['id']) => void;
216
- /** ref to the element */
217
- ref?: Ref<HTMLDivElement>;
218
- }
219
- export interface EmailEntityProps extends BaseProps {
220
- entity: EntityHighlightMapping;
221
- ref?: Ref<HTMLElement>;
222
- }
223
- export interface ViewAnalysisProps extends BaseProps {
224
- content: {
225
- name: string;
226
- value?: {
227
- id: string;
228
- entity: EntityHighlightMapping;
229
- }[];
230
- }[];
231
- header: {
232
- icon: string;
233
- text: string;
234
- };
235
- ref?: Ref<HTMLDivElement>;
236
- }
237
- //# sourceMappingURL=Email.types.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Email.types.d.ts","sourceRoot":"","sources":["../../../src/components/Email/Email.types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,SAAS,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAE1D,OAAO,EACL,SAAS,EACT,WAAW,EACX,cAAc,EACd,gBAAgB,EAChB,mBAAmB,EACnB,UAAU,EACV,SAAS,EACT,aAAa,EACb,YAAY,EACZ,cAAc,EACf,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAE7D,MAAM,WAAW,aAAa;IAC5B,qBAAqB;IACrB,KAAK,EAAE,MAAM,CAAC;IACd,qBAAqB;IACrB,OAAO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AM,WAAW,iBAAkB,SAAQ,SAAS;IAClD,OAAO,EAAE;QACP,IAAI,EAAE,MAAM,CAAC;QACb,KAAK,CAAC,EAAE;YACN,EAAE,EAAE,MAAM,CAAC;YACX,MAAM,EAAE,sBAAsB,CAAC;SAChC,EAAE,CAAC;KACL,EAAE,CAAC;IAEJ,MAAM,EAAE;QACN,IAAI,EAAE,MAAM,CAAC;QACb,IAAI,EAAE,MAAM,CAAC;KACd,CAAC;IACF,GAAG,CAAC,EAAE,GAAG,CAAC,cAAc,CAAC,CAAC;CAC3B"}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=Email.types.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Email.types.js","sourceRoot":"","sources":["../../../src/components/Email/Email.types.ts"],"names":[],"mappings":"","sourcesContent":["import { MouseEventHandler, ReactNode, Ref } from 'react';\n\nimport {\n BaseProps,\n AvatarProps,\n SentimentProps,\n FileDisplayProps,\n FileUploadItemProps,\n OmitStrict,\n MenuProps,\n MenuItemProps,\n TooltipProps,\n NoChildrenProp\n} from '@pega/cosmos-react-core';\nimport { RichTextEditorProps } from '@pega/cosmos-react-rte';\n\nexport interface EmailTemplate {\n /** Template title */\n title: string;\n /** Template value */\n content: string;\n /** Template id */\n id: string;\n}\n\nexport interface EmailUser {\n /** Short name of the User */\n shortName: string;\n /** Full name of the User */\n fullName: string;\n /** Email of the User */\n emailAddress: string;\n /** Avatar props of the User */\n avatarProps?: Partial<AvatarProps>;\n}\n\nexport interface EntityHighlightMapping {\n value: string;\n type: string;\n name: string;\n variant: number;\n description?: TooltipProps['children'];\n icon?: string;\n}\n\nexport interface EmailProps extends BaseProps, NoChildrenProp {\n /** Ref to the element */\n ref?: Ref<HTMLDivElement>;\n /** Unique ID for this email record */\n id: string;\n /** Timestamp of this email as ISO8601 string, timestamp or native Date object. */\n timeStamp: Date | number | string;\n /** From email */\n from: EmailUser;\n /** To email */\n to: EmailUser[];\n /** Carbon copy of email users list */\n cc?: EmailUser[];\n /** Blind carbon copy of email users list */\n bcc?: EmailUser[];\n /** Sentiment */\n sentiment?: SentimentProps;\n /** Subject of the email */\n subject?: string;\n /** Body */\n body?: ReactNode | string;\n /** Entity highlight mapping */\n entityHighlightMapping?: EntityHighlightMapping[];\n /** onReply callback */\n onReply: (id: EmailProps['id']) => void;\n /** onForward Callback */\n onForward: (id: EmailProps['id']) => void;\n /** onReply callback */\n onReplyAll?: (id: EmailProps['id']) => void;\n /** List of suggestions */\n suggestions?: EmailTemplate[];\n /** Callback that triggers on click of tag */\n onSuggestionClick?: (id: EmailProps['id'], suggestionId: EmailTemplate['id']) => void;\n /** Actions region */\n actions?: ReactNode;\n /** Flag that indicates if email is unread\n * @default false\n */\n unRead?: boolean;\n /** Attachments list */\n attachments?: FileDisplayProps[];\n}\n\nexport interface EmailConversationProps extends BaseProps {\n /** ref to the element */\n ref?: Ref<HTMLLIElement>;\n /** Unique ID for this email conversation record */\n id: string;\n /** List of mails */\n emails: EmailProps[];\n /** Sender(s) of this email conversation */\n from: EmailUser;\n /** Recipient(s) of this email conversation */\n to: EmailUser[];\n /** Count of unread emails */\n unReadEmailCount?: number;\n /** Timestamp of this conversation as ISO8601 string, timestamp or native Date object. */\n timeStamp: Date | string | number;\n /** Flag that indicates if email conversation is expanded */\n isCollapsed?: boolean;\n /** Flag to set if conversation is spun off from forwarded email */\n isForwarded?: boolean;\n /** Callback when email conversation is collapsed */\n onCollapse?: () => void;\n /** Callback when email conversation is expanded */\n onExpand?: () => void;\n}\n\nexport interface EmailComposerData\n extends Pick<\n EmailComposerProps,\n 'cc' | 'bcc' | 'subject' | 'bodyContent' | 'attachments' | 'responseType'\n > {\n /** Array to hold the initial participants that should be default initialized in To address. */\n to: EmailUser['emailAddress'][];\n}\n\nexport type EmailResponseType = 'reply' | 'replyAll' | 'forward';\n\nexport interface EmailDirectRecipients {\n /** To address/addresses in case of reply response type on email. */\n reply: EmailUser['emailAddress'][];\n /** To address/addresses in case of replyAll response type on email. */\n replyAll: EmailUser['emailAddress'][];\n /** To address/addresses in case of forward response type on email. */\n forward?: EmailUser['emailAddress'][];\n}\n\nexport interface EmailComposerProps\n extends Pick<EmailProps, 'attachments' | 'suggestions' | 'onSuggestionClick'>,\n BaseProps,\n NoChildrenProp {\n /** Object containing full list of email participants. */\n participants: EmailUser[];\n /** Object to hold initial to address/addresses based on different action types. */\n to?: EmailDirectRecipients;\n /** Array to hold the initial participants that should be default initialized in Cc address. */\n cc?: EmailUser['emailAddress'][];\n /** Array to hold the initial participants that should be default initialized in Bcc address. */\n bcc?: EmailUser['emailAddress'][];\n /** Object containing the props to render the subject input */\n subject: string;\n /** Body content of the email */\n bodyContent: string;\n /** Initial Value of template */\n defaultTemplate?: string;\n /** Callback when email needs to be sent */\n onSend: (data: EmailComposerData) => void;\n /** Callback when image is added */\n onImageAdded?: RichTextEditorProps['onImageAdded'];\n /** List of attachments */\n attachments?: FileUploadItemProps[];\n /** Region to show more actions in footer */\n footerMoreActions?: ReactNode;\n /** Templates for drafting email */\n templates?: EmailTemplate[];\n /** Callback when cancel composing */\n onCancel: () => void;\n /**\n * Callback to handle external entry validation\n * If returned true considers the entry to be a valid entry\n */\n externalValidator?: (value: string) => boolean;\n /** Ref to the element */\n ref?: Ref<HTMLDivElement>;\n /** Email action types */\n responseType?: EmailResponseType;\n}\nexport interface EmailShellProps extends BaseProps {\n /** ref to the element */\n ref?: Ref<HTMLDivElement>;\n /** Region for header */\n headerProps?: {\n /** Region for actions */\n actions?: ReactNode;\n /** Subject of the email conversations list */\n subject?: string;\n };\n /** Email conversations */\n conversations?: EmailConversationProps[];\n /** Shows only one conversation at a time */\n autoCollapse?: boolean;\n}\n\nexport interface EmailSummaryItemProps extends BaseProps {\n /** Id of each summary item */\n id: string;\n /** List of from participant names of the conversations */\n activeParticipants: EmailUser[];\n /** Email body of last email in the email */\n message: string;\n /** Timestamp of the latest email */\n timeStamp: Date | string | number;\n /** Top topic of an email */\n topic: string;\n /** Sentiment */\n sentiment?: SentimentProps;\n /** Urgency of an email */\n urgency?: number;\n /** Total number of unread emails in the email */\n unreadEmailCount?: number;\n /** Is the email currently active */\n active?: boolean;\n /** On click of email item */\n onClick: MouseEventHandler;\n /** ref to the element */\n ref?: Ref<HTMLButtonElement>;\n}\n\nexport interface Filter {\n /** Sets DOM id for the control and associates label element via 'for' attribute. */\n id: string;\n /** Pass a string or a fragment with an Icon and string for the filter label. */\n label: ReactNode;\n /**\n * Disables the filter.\n * @default false\n */\n disabled?: boolean;\n /**\n * Sets on prop via onFilterChange.\n * @default false\n */\n on?: boolean;\n}\n\nexport interface EmailSummaryListProps extends BaseProps {\n /** List of email categories */\n categories: MenuProps['items'];\n /** Handles category change */\n onCategoryClick?: MenuItemProps['onClick'];\n /** List of EmailItems items */\n items: OmitStrict<EmailSummaryItemProps, 'onClick' | 'active'>[];\n /** Total number of unread email count */\n unreadEmailCount?: number;\n /** A set of filters to apply to the email inbox. */\n filters?: Filter[];\n /** A callback that runs when a filter is clicked. */\n onFilterChange?: (filterId: Filter['id'], on: boolean) => void;\n /** onClick of list item */\n onItemClick: (id: EmailSummaryItemProps['id']) => void;\n /** ref to the element */\n ref?: Ref<HTMLDivElement>;\n}\n\nexport interface EmailEntityProps extends BaseProps {\n entity: EntityHighlightMapping;\n ref?: Ref<HTMLElement>;\n}\n\nexport interface ViewAnalysisProps extends BaseProps {\n content: {\n name: string;\n value?: {\n id: string;\n entity: EntityHighlightMapping;\n }[];\n }[];\n\n header: {\n icon: string;\n text: string;\n };\n ref?: Ref<HTMLDivElement>;\n}\n"]}
@@ -1,9 +0,0 @@
1
- import { FunctionComponent } from 'react';
2
- import { Icon } from '@pega/cosmos-react-core';
3
- import { EmailComposerProps } from './Email.types';
4
- export declare const StyledEmailComposer: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
5
- export declare const StyledResponseTypeIcon: typeof Icon;
6
- export declare const StyledToggleButton: import("styled-components").StyledComponent<FunctionComponent<import("@pega/cosmos-react-core").ButtonProps & import("@pega/cosmos-react-core").ForwardProps>, import("styled-components").DefaultTheme, {}, never>;
7
- declare const EmailComposer: FunctionComponent<EmailComposerProps>;
8
- export default EmailComposer;
9
- //# sourceMappingURL=EmailComposer.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"EmailComposer.d.ts","sourceRoot":"","sources":["../../../src/components/Email/EmailComposer.tsx"],"names":[],"mappings":"AAAA,OAAO,EAEL,iBAAiB,EASlB,MAAM,OAAO,CAAC;AAGf,OAAO,EAGL,IAAI,EAWL,MAAM,yBAAyB,CAAC;AAOjC,OAAO,EAAE,kBAAkB,EAAa,MAAM,eAAe,CAAC;AAK9D,eAAO,MAAM,mBAAmB,yGAAe,CAAC;AAEhD,eAAO,MAAM,sBAAsB,EAAE,OAAO,IAI1C,CAAC;AAIH,eAAO,MAAM,kBAAkB,qNAK7B,CAAC;AAmBH,QAAA,MAAM,aAAa,EAAE,iBAAiB,CAAC,kBAAkB,CAiTxD,CAAC;AAEF,eAAe,aAAa,CAAC"}
@@ -1,185 +0,0 @@
1
- import { createElement as _createElement } from "react";
2
- import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
3
- import { forwardRef, useState, useMemo, useRef, useCallback, useEffect } from 'react';
4
- import styled, { css } from 'styled-components';
5
- import { Button, Flex, Icon, registerIcon, useI18n, Option, defaultThemeProp, FileUploadItem, MenuButton, Select, Input, useUID } from '@pega/cosmos-react-core';
6
- import { RichTextEditor } from '@pega/cosmos-react-rte';
7
- import * as paperClipIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/paper-clip.icon';
8
- import * as replyAllIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/reply-all.icon';
9
- import * as replyIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/reply.icon';
10
- import * as forwardIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/forward.icon';
11
- import EmailSelector from './EmailSelector';
12
- registerIcon(paperClipIcon, replyAllIcon, replyIcon, forwardIcon);
13
- export const StyledEmailComposer = styled.div ``;
14
- export const StyledResponseTypeIcon = styled(Icon)(({ theme }) => {
15
- return css `
16
- color: ${theme.base.palette.interactive};
17
- `;
18
- });
19
- StyledResponseTypeIcon.defaultProps = defaultThemeProp;
20
- export const StyledToggleButton = styled(Button)(({ theme }) => {
21
- return css `
22
- margin-block-start: calc(2 * ${theme.base.spacing});
23
- color: ${theme.base.palette.interactive};
24
- `;
25
- });
26
- StyledToggleButton.defaultProps = defaultThemeProp;
27
- const responseTypeIcons = {
28
- reply: 'reply',
29
- replyAll: 'reply-all',
30
- forward: 'forward'
31
- };
32
- const rteToolbar = [
33
- 'inline-styling',
34
- 'headers',
35
- 'lists',
36
- 'images',
37
- 'cut-copy-paste',
38
- 'indentation'
39
- ];
40
- const EmailComposer = forwardRef(({ participants, bodyContent, onCancel, onSend, onImageAdded, externalValidator, to, footerMoreActions, templates, defaultTemplate, ...restProps }, ref) => {
41
- const t = useI18n();
42
- const [cc, setCC] = useState(restProps.cc);
43
- const [bcc, setBCC] = useState(restProps.bcc);
44
- const [responseType, setResponseType] = useState(restProps.responseType);
45
- const [showCC, setShowCC] = useState(restProps.responseType !== 'reply' && !!cc && cc.length > 0);
46
- const [showBCC, setShowBCC] = useState(restProps.responseType !== 'reply' && !!bcc && bcc.length > 0);
47
- const [subject, setSubject] = useState(restProps.subject);
48
- const [autoReplyTemplate, setAutoReplyTemplate] = useState(defaultTemplate || '');
49
- const [attachments, setAttachments] = useState(restProps.attachments || []);
50
- const [toAddresses, setToAddresses] = useState(() => {
51
- if (responseType && to?.[responseType])
52
- return to?.[responseType];
53
- return [];
54
- });
55
- const [ccAddresses, setCcAddresses] = useState(() => {
56
- if (responseType === 'replyAll')
57
- return cc;
58
- return [];
59
- });
60
- const [bccAddresses, setBccAddresses] = useState(() => {
61
- if (responseType === 'replyAll')
62
- return bcc;
63
- return [];
64
- });
65
- const initialCC = cc;
66
- const initialBCC = bcc;
67
- const rteEditorRef = useRef(null);
68
- const fileUploadInputRef = useRef(null);
69
- const uid = useUID();
70
- // inserts selected template in RTE
71
- useEffect(() => {
72
- const selectedTemplate = templates?.find(template => template.title === autoReplyTemplate);
73
- if (selectedTemplate) {
74
- rteEditorRef?.current?.insertHtml(selectedTemplate.content, true);
75
- }
76
- }, [autoReplyTemplate]);
77
- // resets To | CC | BCC combobox selection and toggles fields on responseType change reply | replyAll | forward
78
- useEffect(() => {
79
- setShowCC(responseType === 'replyAll' ? !!cc && cc.length > 0 : false);
80
- setShowBCC(responseType === 'replyAll' && !!bcc && bcc?.length > 0 ? !!bcc : false);
81
- if (responseType === 'replyAll') {
82
- setCC(initialCC);
83
- setBCC(initialBCC);
84
- }
85
- if (responseType === 'reply') {
86
- setCcAddresses([]);
87
- setBccAddresses([]);
88
- }
89
- }, [responseType]);
90
- const templateOptions = useMemo(() => templates &&
91
- templates.map(template => {
92
- if (template.title === defaultTemplate) {
93
- _jsx(Option, { selected: 'selected', children: template.title }, template.id);
94
- }
95
- return _jsx(Option, { children: template.title }, template.id);
96
- }), [templates]);
97
- const responseTypeMenuData = useMemo(() => {
98
- const menuItems = [
99
- {
100
- id: 'reply',
101
- primary: t('reply'),
102
- visual: _jsx(StyledResponseTypeIcon, { name: responseTypeIcons.reply }, void 0),
103
- selected: responseType === 'reply',
104
- onClick: () => {
105
- setResponseType('reply');
106
- }
107
- },
108
- {
109
- id: 'replyAll',
110
- primary: t('reply_all'),
111
- visual: _jsx(StyledResponseTypeIcon, { name: responseTypeIcons.replyAll }, void 0),
112
- selected: responseType === 'replyAll',
113
- onClick: () => {
114
- setResponseType('replyAll');
115
- }
116
- }
117
- ];
118
- return {
119
- menuItems,
120
- selectedResponseType: menuItems.find(item => item.selected)?.primary || menuItems[0].primary,
121
- selectedResponseTypeIcon: (responseType && responseTypeIcons[responseType]) || responseTypeIcons.reply
122
- };
123
- }, [responseType]);
124
- const onSubjectChange = useCallback((e) => {
125
- setSubject(e.target.value);
126
- }, []);
127
- const onTemplateChange = useCallback((e) => {
128
- setAutoReplyTemplate(e.target.value);
129
- }, []);
130
- const onAttachmentDelete = useCallback((name) => {
131
- setAttachments(prevAttachments => prevAttachments.filter(item => item.name !== name));
132
- }, []);
133
- const onFileChange = useCallback((e) => {
134
- if (e.target.files) {
135
- setAttachments(prevAttachments => [
136
- ...prevAttachments,
137
- ...Array.from(e.target.files).map(file => ({
138
- name: file.name,
139
- file
140
- }))
141
- ]);
142
- }
143
- }, []);
144
- const selectedItems = (selections, label) => {
145
- if (label === 'To') {
146
- setToAddresses(selections);
147
- }
148
- if (label === 'Cc') {
149
- setCcAddresses(selections);
150
- }
151
- if (label === 'Bcc') {
152
- setBccAddresses(selections);
153
- }
154
- };
155
- const handleSend = () => {
156
- onSend({
157
- to: toAddresses,
158
- cc: showCC ? ccAddresses : undefined,
159
- bcc: showBCC ? bccAddresses : undefined,
160
- subject,
161
- bodyContent: rteEditorRef.current?.getHtml() || '',
162
- attachments,
163
- responseType
164
- });
165
- };
166
- return (_jsxs(Flex, { as: StyledEmailComposer, ref: ref, ...restProps, container: {
167
- gap: 2,
168
- direction: 'column'
169
- }, children: [_jsx("div", { children: responseType !== 'forward' && (_jsx(MenuButton, { text: responseTypeMenuData.selectedResponseType, variant: 'link', icon: responseTypeMenuData.selectedResponseTypeIcon, menu: {
170
- mode: 'single-select',
171
- items: responseTypeMenuData.menuItems
172
- } }, void 0)) }, void 0), _jsxs(Flex, { container: {
173
- alignItems: 'start',
174
- gap: 0.5
175
- }, children: [_jsx(Flex, { container: {
176
- gap: 1,
177
- direction: 'column'
178
- }, item: {
179
- grow: 1
180
- }, children: _jsx(EmailSelector, { participants: participants, defaultSelections: to?.[responseType], label: t('to'), mode: 'multi-select', required: true, selections: selectedItems, externalValidator: externalValidator }, void 0) }, void 0), !showCC && (_jsx(StyledToggleButton, { variant: 'simple', onClick: () => setShowCC(true), icon: true, children: t('cc') }, void 0)), !showBCC && (_jsx(StyledToggleButton, { variant: 'simple', onClick: () => setShowBCC(true), icon: true, children: t('bcc') }, void 0))] }, void 0), showCC && (_jsx(EmailSelector, { participants: participants, defaultSelections: responseType === 'replyAll' ? cc : undefined, label: t('cc'), mode: 'multi-select', selections: selectedItems, externalValidator: externalValidator }, void 0)), showBCC && (_jsx(EmailSelector, { selections: selectedItems, participants: participants, defaultSelections: responseType === 'replyAll' ? bcc : undefined, label: t('bcc'), mode: 'multi-select', externalValidator: externalValidator }, void 0)), _jsx(Input, { value: subject, onChange: onSubjectChange, label: t('subject') }, void 0), _jsxs(Select, { onChange: onTemplateChange, label: t('auto_reply'), value: autoReplyTemplate, children: [_jsx(Option, { children: t('insert') }, uid), _jsx(_Fragment, { children: templateOptions }, void 0)] }, void 0), _jsx(RichTextEditor, { autoFocus: true, ref: rteEditorRef, toolbar: rteToolbar, onImageAdded: onImageAdded, labelHidden: true, label: t('email_message'), defaultValue: bodyContent }, void 0), attachments.length > 0 && (_jsx(Flex, { container: { gap: 1, wrap: 'wrap' }, children: attachments.map(attachment => (_createElement(FileUploadItem, { ...attachment, key: attachment.name, onDelete: onAttachmentDelete }))) }, void 0)), _jsxs(Flex, { container: {
181
- gap: 1
182
- }, children: [_jsxs(Flex, { container: true, item: { grow: 1 }, children: [_jsx(Button, { variant: 'secondary', onClick: onCancel, children: t('cancel') }, void 0), footerMoreActions] }, void 0), _jsxs(Flex, { container: true, children: [_jsx(Button, { onClick: () => fileUploadInputRef.current?.click(), variant: 'link', label: t('file_upload_text_multiple'), children: _jsx(Icon, { name: 'paper-clip' }, void 0) }, void 0), _jsx(Button, { variant: 'primary', onClick: handleSend, children: t('send_label') }, void 0)] }, void 0)] }, void 0), _jsx("input", { type: 'file', style: { display: 'none' }, ref: fileUploadInputRef, onChange: onFileChange, multiple: true }, void 0)] }, void 0));
183
- });
184
- export default EmailComposer;
185
- //# sourceMappingURL=EmailComposer.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"EmailComposer.js","sourceRoot":"","sources":["../../../src/components/Email/EmailComposer.tsx"],"names":[],"mappings":";;AAAA,OAAO,E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,CACzB,KAAC,IAAI,IAAC,SAAS,EAAE,EAAE,GAAG,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,YACtC,WAAW,CAAC,GAAG,CAAC,UAAU,CAAC,EAAE,CAAC,CAC7B,eAAC,cAAc,OAAK,UAAU,EAAE,GAAG,EAAE,UAAU,CAAC,IAAI,EAAE,QAAQ,EAAE,kBAAkB,GAAI,CACvF,CAAC,WACG,CACR,EACD,MAAC,IAAI,IACH,SAAS,EAAE;oBACT,GAAG,EAAE,CAAC;iBACP,aAED,MAAC,IAAI,IAAC,SAAS,QAAC,IAAI,EAAE,EAAE,IAAI,EAAE,CAAC,EAAE,aAC/B,KAAC,MAAM,IAAC,OAAO,EAAC,WAAW,EAAC,OAAO,EAAE,QAAQ,YAC1C,CAAC,CAAC,QAAQ,CAAC,WACL,EACR,iBAAiB,YACb,EACP,MAAC,IAAI,IAAC,SAAS,mBACb,KAAC,MAAM,IACL,OAAO,EAAE,GAAG,EAAE,CAAC,kBAAkB,CAAC,OAAO,EAAE,KAAK,EAAE,EAClD,OAAO,EAAC,MAAM,EACd,KAAK,EAAE,CAAC,CAAC,2BAA2B,CAAC,YAErC,KAAC,IAAI,IAAC,IAAI,EAAC,YAAY,WAAG,WACnB,EAET,KAAC,MAAM,IAAC,OAAO,EAAC,SAAS,EAAC,OAAO,EAAE,UAAU,YAC1C,CAAC,CAAC,YAAY,CAAC,WACT,YACJ,YACF,EACP,gBACE,IAAI,EAAC,MAAM,EACX,KAAK,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE,EAC1B,GAAG,EAAE,kBAAkB,EACvB,QAAQ,EAAE,YAAY,EACtB,QAAQ,iBACR,YACG,CACR,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,aAAa,CAAC","sourcesContent":["import {\n forwardRef,\n FunctionComponent,\n PropsWithoutRef,\n useState,\n ChangeEvent,\n useMemo,\n useRef,\n useCallback,\n useEffect,\n ReactNode\n} from 'react';\nimport styled, { css } from 'styled-components';\n\nimport {\n Button,\n Flex,\n Icon,\n registerIcon,\n useI18n,\n Option,\n defaultThemeProp,\n FileUploadItem,\n MenuButton,\n FileUploadItemProps,\n Select,\n Input,\n useUID\n} from '@pega/cosmos-react-core';\nimport { RichTextEditor, RichTextEditorProps, RichTextEditorState } from '@pega/cosmos-react-rte';\nimport * as paperClipIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/paper-clip.icon';\nimport * as replyAllIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/reply-all.icon';\nimport * as replyIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/reply.icon';\nimport * as forwardIcon from '@pega/cosmos-react-core/lib/components/Icon/icons/forward.icon';\n\nimport { EmailComposerProps, EmailUser } from './Email.types';\nimport EmailSelector from './EmailSelector';\n\nregisterIcon(paperClipIcon, replyAllIcon, replyIcon, forwardIcon);\n\nexport const StyledEmailComposer = styled.div``;\n\nexport const StyledResponseTypeIcon: typeof Icon = styled(Icon)(({ theme }) => {\n return css`\n color: ${theme.base.palette.interactive};\n `;\n});\n\nStyledResponseTypeIcon.defaultProps = defaultThemeProp;\n\nexport const StyledToggleButton = styled(Button)(({ theme }) => {\n return css`\n margin-block-start: calc(2 * ${theme.base.spacing});\n color: ${theme.base.palette.interactive};\n `;\n});\n\nStyledToggleButton.defaultProps = defaultThemeProp;\n\nconst responseTypeIcons = {\n reply: 'reply',\n replyAll: 'reply-all',\n forward: 'forward'\n};\n\nconst rteToolbar: RichTextEditorProps['toolbar'] = [\n 'inline-styling',\n 'headers',\n 'lists',\n 'images',\n 'cut-copy-paste',\n 'indentation'\n];\n\nconst EmailComposer: FunctionComponent<EmailComposerProps> = forwardRef(\n (\n {\n participants,\n bodyContent,\n onCancel,\n onSend,\n onImageAdded,\n externalValidator,\n to,\n footerMoreActions,\n templates,\n defaultTemplate,\n ...restProps\n }: PropsWithoutRef<EmailComposerProps>,\n ref: EmailComposerProps['ref']\n ) => {\n const t = useI18n();\n const [cc, setCC] = useState(restProps.cc);\n const [bcc, setBCC] = useState(restProps.bcc);\n const [responseType, setResponseType] = useState(restProps.responseType);\n const [showCC, setShowCC] = useState(\n restProps.responseType !== 'reply' && !!cc && cc.length > 0\n );\n const [showBCC, setShowBCC] = useState(\n restProps.responseType !== 'reply' && !!bcc && bcc.length > 0\n );\n const [subject, setSubject] = useState(restProps.subject);\n const [autoReplyTemplate, setAutoReplyTemplate] = useState(defaultTemplate || '');\n const [attachments, setAttachments] = useState(restProps.attachments || []);\n\n const [toAddresses, setToAddresses] = useState<EmailUser['emailAddress'][]>(() => {\n if (responseType && to?.[responseType])\n return to?.[responseType] as EmailUser['emailAddress'][];\n return [];\n });\n const [ccAddresses, setCcAddresses] = useState<EmailUser['emailAddress'][]>(() => {\n if (responseType === 'replyAll') return cc as EmailUser['emailAddress'][];\n return [];\n });\n const [bccAddresses, setBccAddresses] = useState<EmailUser['emailAddress'][]>(() => {\n if (responseType === 'replyAll') return bcc as EmailUser['emailAddress'][];\n return [];\n });\n\n const initialCC = cc;\n const initialBCC = bcc;\n\n const rteEditorRef = useRef<RichTextEditorState>(null);\n const fileUploadInputRef = useRef<HTMLInputElement>(null);\n const uid = useUID();\n\n // inserts selected template in RTE\n useEffect(() => {\n const selectedTemplate = templates?.find(template => template.title === autoReplyTemplate);\n if (selectedTemplate) {\n rteEditorRef?.current?.insertHtml(selectedTemplate.content, true);\n }\n }, [autoReplyTemplate]);\n\n // resets To | CC | BCC combobox selection and toggles fields on responseType change reply | replyAll | forward\n useEffect(() => {\n setShowCC(responseType === 'replyAll' ? !!cc && cc.length > 0 : false);\n setShowBCC(responseType === 'replyAll' && !!bcc && bcc?.length > 0 ? !!bcc : false);\n if (responseType === 'replyAll') {\n setCC(initialCC);\n setBCC(initialBCC);\n }\n if (responseType === 'reply') {\n setCcAddresses([] as EmailUser['emailAddress'][]);\n setBccAddresses([] as EmailUser['emailAddress'][]);\n }\n }, [responseType]);\n\n const templateOptions = useMemo(\n () =>\n templates &&\n templates.map(template => {\n if (template.title === defaultTemplate) {\n <Option selected='selected' key={template.id}>\n {template.title}\n </Option>;\n }\n return <Option key={template.id}>{template.title}</Option>;\n }),\n [templates]\n );\n\n const responseTypeMenuData = useMemo(() => {\n const menuItems = [\n {\n id: 'reply',\n primary: t('reply'),\n visual: <StyledResponseTypeIcon name={responseTypeIcons.reply} />,\n selected: responseType === 'reply',\n onClick: () => {\n setResponseType('reply');\n }\n },\n {\n id: 'replyAll',\n primary: t('reply_all'),\n visual: <StyledResponseTypeIcon name={responseTypeIcons.replyAll} />,\n selected: responseType === 'replyAll',\n onClick: () => {\n setResponseType('replyAll');\n }\n }\n ];\n return {\n menuItems,\n selectedResponseType:\n menuItems.find(item => item.selected)?.primary || menuItems[0].primary,\n selectedResponseTypeIcon:\n (responseType && responseTypeIcons[responseType]) || responseTypeIcons.reply\n };\n }, [responseType]);\n\n const onSubjectChange = useCallback((e: ChangeEvent<HTMLInputElement>) => {\n setSubject(e.target.value);\n }, []);\n\n const onTemplateChange = useCallback((e: ChangeEvent<HTMLSelectElement>) => {\n setAutoReplyTemplate(e.target.value);\n }, []);\n\n const onAttachmentDelete = useCallback((name: FileUploadItemProps['name']) => {\n setAttachments(prevAttachments => prevAttachments.filter(item => item.name !== name));\n }, []);\n\n const onFileChange = useCallback((e: ChangeEvent<HTMLInputElement>) => {\n if (e.target.files) {\n setAttachments(prevAttachments => [\n ...prevAttachments,\n ...Array.from(e.target.files!).map(file => ({\n name: file.name,\n file\n }))\n ]);\n }\n }, []);\n\n const selectedItems = (selections: EmailUser['emailAddress'][], label: ReactNode) => {\n if (label === 'To') {\n setToAddresses(selections);\n }\n if (label === 'Cc') {\n setCcAddresses(selections);\n }\n if (label === 'Bcc') {\n setBccAddresses(selections);\n }\n };\n const handleSend = () => {\n onSend({\n to: toAddresses,\n cc: showCC ? ccAddresses : undefined,\n bcc: showBCC ? bccAddresses : undefined,\n subject,\n bodyContent: rteEditorRef.current?.getHtml() || '',\n attachments,\n responseType\n });\n };\n\n return (\n <Flex\n as={StyledEmailComposer}\n ref={ref}\n {...restProps}\n container={{\n gap: 2,\n direction: 'column'\n }}\n >\n <div>\n {responseType !== 'forward' && (\n <MenuButton\n text={responseTypeMenuData.selectedResponseType}\n variant='link'\n icon={responseTypeMenuData.selectedResponseTypeIcon}\n menu={{\n mode: 'single-select',\n items: responseTypeMenuData.menuItems\n }}\n />\n )}\n </div>\n\n <Flex\n container={{\n alignItems: 'start',\n gap: 0.5\n }}\n >\n <Flex\n container={{\n gap: 1,\n direction: 'column'\n }}\n item={{\n grow: 1\n }}\n >\n <EmailSelector\n participants={participants}\n defaultSelections={to?.[responseType!]}\n label={t('to')}\n mode='multi-select'\n required\n selections={selectedItems}\n externalValidator={externalValidator}\n />\n </Flex>\n {!showCC && (\n <StyledToggleButton variant='simple' onClick={() => setShowCC(true)} icon>\n {t('cc')}\n </StyledToggleButton>\n )}\n {!showBCC && (\n <StyledToggleButton variant='simple' onClick={() => setShowBCC(true)} icon>\n {t('bcc')}\n </StyledToggleButton>\n )}\n </Flex>\n\n {showCC && (\n <EmailSelector\n participants={participants}\n defaultSelections={responseType === 'replyAll' ? cc : undefined}\n label={t('cc')}\n mode='multi-select'\n selections={selectedItems}\n externalValidator={externalValidator}\n />\n )}\n {showBCC && (\n <EmailSelector\n selections={selectedItems}\n participants={participants}\n defaultSelections={responseType === 'replyAll' ? bcc : undefined}\n label={t('bcc')}\n mode='multi-select'\n externalValidator={externalValidator}\n />\n )}\n\n <Input value={subject} onChange={onSubjectChange} label={t('subject')} />\n\n <Select onChange={onTemplateChange} label={t('auto_reply')} value={autoReplyTemplate}>\n <Option key={uid}>{t('insert')}</Option>\n <>{templateOptions}</>\n </Select>\n\n <RichTextEditor\n autoFocus\n ref={rteEditorRef}\n toolbar={rteToolbar}\n onImageAdded={onImageAdded}\n labelHidden\n label={t('email_message')}\n defaultValue={bodyContent}\n />\n {attachments.length > 0 && (\n <Flex container={{ gap: 1, wrap: 'wrap' }}>\n {attachments.map(attachment => (\n <FileUploadItem {...attachment} key={attachment.name} onDelete={onAttachmentDelete} />\n ))}\n </Flex>\n )}\n <Flex\n container={{\n gap: 1\n }}\n >\n <Flex container item={{ grow: 1 }}>\n <Button variant='secondary' onClick={onCancel}>\n {t('cancel')}\n </Button>\n {footerMoreActions}\n </Flex>\n <Flex container>\n <Button\n onClick={() => fileUploadInputRef.current?.click()}\n variant='link'\n label={t('file_upload_text_multiple')}\n >\n <Icon name='paper-clip' />\n </Button>\n\n <Button variant='primary' onClick={handleSend}>\n {t('send_label')}\n </Button>\n </Flex>\n </Flex>\n <input\n type='file'\n style={{ display: 'none' }}\n ref={fileUploadInputRef}\n onChange={onFileChange}\n multiple\n />\n </Flex>\n );\n }\n);\n\nexport default EmailComposer;\n"]}
@@ -1,14 +0,0 @@
1
- import { FunctionComponent } from 'react';
2
- import { ForwardProps } from '@pega/cosmos-react-core';
3
- import { EmailConversationProps } from './Email.types';
4
- export declare const StyledEmailParticipantsText: import("styled-components").StyledComponent<FunctionComponent<import("@pega/cosmos-react-core").TextProps & ForwardProps>, import("styled-components").DefaultTheme, {}, never>;
5
- export declare const StyledCompactTimeStampDisplay: import("styled-components").StyledComponent<FunctionComponent<import("@pega/cosmos-react-core").TextProps & ForwardProps>, import("styled-components").DefaultTheme, {}, never>;
6
- export declare const StyledConversationHeader: import("styled-components").StyledComponent<"header", import("styled-components").DefaultTheme, {
7
- collapsed: boolean;
8
- }, never>;
9
- export declare const StyledUnReadCount: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
10
- export declare const StyledEmailConversation: import("styled-components").StyledComponent<"li", import("styled-components").DefaultTheme, {}, never>;
11
- export declare const StyledEmailInConversation: import("styled-components").StyledComponent<FunctionComponent<import("./Email.types").EmailProps & ForwardProps>, import("styled-components").DefaultTheme, {}, never>;
12
- declare const EmailConversation: FunctionComponent<EmailConversationProps & ForwardProps>;
13
- export default EmailConversation;
14
- //# sourceMappingURL=EmailConversation.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"EmailConversation.d.ts","sourceRoot":"","sources":["../../../src/components/Email/EmailConversation.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAc,iBAAiB,EAA8C,MAAM,OAAO,CAAC;AAKlG,OAAO,EAQL,YAAY,EASb,MAAM,yBAAyB,CAAC;AAGjC,OAAO,EAAE,sBAAsB,EAAE,MAAM,eAAe,CAAC;AAWvD,eAAO,MAAM,2BAA2B,iLAEvC,CAAC;AAIF,eAAO,MAAM,6BAA6B,iLAGzC,CAAC;AAGF,eAAO,MAAM,wBAAwB;eAA8B,OAAO;SASzE,CAAC;AAGF,eAAO,MAAM,iBAAiB,yGAoB5B,CAAC;AAIH,eAAO,MAAM,uBAAuB,wGAQlC,CAAC;AAGH,eAAO,MAAM,yBAAyB,wKAsBpC,CAAC;AAwEH,QAAA,MAAM,iBAAiB,EAAE,iBAAiB,CAAC,sBAAsB,GAAG,YAAY,CA2H/E,CAAC;AAEF,eAAe,iBAAiB,CAAC"}