@memori.ai/memori-react 8.13.5 → 8.14.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.
- package/CHANGELOG.md +20 -0
- package/dist/components/ChatHistoryDrawer/ChatHistory.css +172 -3
- package/dist/components/ChatHistoryDrawer/ChatHistory.js +62 -23
- package/dist/components/ChatHistoryDrawer/ChatHistory.js.map +1 -1
- package/dist/components/ExpertsDrawer/ExpertsDrawer.js +1 -1
- package/dist/components/ExpertsDrawer/ExpertsDrawer.js.map +1 -1
- package/dist/components/Header/Header.js +2 -2
- package/dist/components/Header/Header.js.map +1 -1
- package/dist/components/MemoriWidget/MemoriWidget.js +14 -14
- package/dist/components/MemoriWidget/MemoriWidget.js.map +1 -1
- package/dist/components/ShareButton/ShareButton.d.ts +2 -1
- package/dist/components/ShareButton/ShareButton.js +87 -2
- package/dist/components/ShareButton/ShareButton.js.map +1 -1
- package/dist/components/UploadButton/UploadButton.js +14 -12
- package/dist/components/UploadButton/UploadButton.js.map +1 -1
- package/dist/components/layouts/chat.css +3 -3
- package/dist/components/ui/Drawer.css +65 -8
- package/dist/components/ui/Drawer.d.ts +14 -0
- package/dist/components/ui/Drawer.js +8 -3
- package/dist/components/ui/Drawer.js.map +1 -1
- package/dist/components/ui/Select.css +0 -2
- package/dist/helpers/chatPdfExport.d.ts +18 -0
- package/dist/helpers/chatPdfExport.js +447 -0
- package/dist/helpers/chatPdfExport.js.map +1 -0
- package/dist/locales/de.json +9 -0
- package/dist/locales/en.json +9 -0
- package/dist/locales/es.json +9 -0
- package/dist/locales/fr.json +13 -4
- package/dist/locales/it.json +8 -0
- package/esm/components/ChatHistoryDrawer/ChatHistory.css +172 -3
- package/esm/components/ChatHistoryDrawer/ChatHistory.js +62 -23
- package/esm/components/ChatHistoryDrawer/ChatHistory.js.map +1 -1
- package/esm/components/ExpertsDrawer/ExpertsDrawer.js +1 -1
- package/esm/components/ExpertsDrawer/ExpertsDrawer.js.map +1 -1
- package/esm/components/Header/Header.js +2 -2
- package/esm/components/Header/Header.js.map +1 -1
- package/esm/components/MemoriWidget/MemoriWidget.js +14 -14
- package/esm/components/MemoriWidget/MemoriWidget.js.map +1 -1
- package/esm/components/ShareButton/ShareButton.d.ts +2 -1
- package/esm/components/ShareButton/ShareButton.js +87 -2
- package/esm/components/ShareButton/ShareButton.js.map +1 -1
- package/esm/components/UploadButton/UploadButton.js +14 -12
- package/esm/components/UploadButton/UploadButton.js.map +1 -1
- package/esm/components/layouts/chat.css +3 -3
- package/esm/components/ui/Drawer.css +65 -8
- package/esm/components/ui/Drawer.d.ts +14 -0
- package/esm/components/ui/Drawer.js +8 -3
- package/esm/components/ui/Drawer.js.map +1 -1
- package/esm/components/ui/Select.css +0 -2
- package/esm/helpers/chatPdfExport.d.ts +18 -0
- package/esm/helpers/chatPdfExport.js +441 -0
- package/esm/helpers/chatPdfExport.js.map +1 -0
- package/esm/locales/de.json +9 -0
- package/esm/locales/en.json +9 -0
- package/esm/locales/es.json +9 -0
- package/esm/locales/fr.json +13 -4
- package/esm/locales/it.json +8 -0
- package/package.json +1 -1
- package/src/components/ChatHistoryDrawer/ChatHistory.css +172 -3
- package/src/components/ChatHistoryDrawer/ChatHistory.tsx +358 -247
- package/src/components/ExpertsDrawer/ExpertsDrawer.tsx +0 -3
- package/src/components/Header/Header.tsx +2 -1
- package/src/components/MemoriWidget/MemoriWidget.tsx +1 -1
- package/src/components/ShareButton/ShareButton.tsx +142 -1
- package/src/components/UploadButton/UploadButton.tsx +17 -15
- package/src/components/layouts/chat.css +3 -3
- package/src/components/ui/Drawer.css +65 -8
- package/src/components/ui/Drawer.tsx +65 -11
- package/src/components/ui/Select.css +0 -2
- package/src/helpers/chatPdfExport.ts +547 -0
- package/src/locales/de.json +9 -0
- package/src/locales/en.json +9 -0
- package/src/locales/es.json +9 -0
- package/src/locales/fr.json +13 -4
- package/src/locales/it.json +8 -0
|
@@ -0,0 +1,447 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createChatPDFDocument = exports.formatChatHistoryForPDF = exports.generateChatPDFCSS = void 0;
|
|
4
|
+
const message_1 = require("./message");
|
|
5
|
+
const utils_1 = require("./utils");
|
|
6
|
+
const generateChatPDFCSS = (options = {}) => {
|
|
7
|
+
const { fontSize = '12pt', fontFamily = 'system-ui, -apple-system, sans-serif', lineHeight = '1.6', color = '#333', backgroundColor = '#fff', } = options;
|
|
8
|
+
const baseStyles = `
|
|
9
|
+
@page {
|
|
10
|
+
margin: 1in;
|
|
11
|
+
size: A4;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
@media print {
|
|
15
|
+
* {
|
|
16
|
+
-webkit-print-color-adjust: exact !important;
|
|
17
|
+
color-adjust: exact !important;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
body {
|
|
21
|
+
font-family: ${fontFamily};
|
|
22
|
+
font-size: ${fontSize};
|
|
23
|
+
line-height: ${lineHeight};
|
|
24
|
+
color: ${color};
|
|
25
|
+
background-color: ${backgroundColor};
|
|
26
|
+
margin: 0;
|
|
27
|
+
padding: 0;
|
|
28
|
+
max-width: none;
|
|
29
|
+
word-wrap: break-word;
|
|
30
|
+
overflow-wrap: break-word;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
h1, h2, h3, h4, h5, h6 {
|
|
34
|
+
page-break-after: avoid;
|
|
35
|
+
margin-top: 1.5em;
|
|
36
|
+
margin-bottom: 0.5em;
|
|
37
|
+
font-weight: 600;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
h1 { font-size: 1.8em; }
|
|
41
|
+
h2 { font-size: 1.5em; }
|
|
42
|
+
h3 { font-size: 1.3em; }
|
|
43
|
+
|
|
44
|
+
p {
|
|
45
|
+
margin: 0 0 1em 0;
|
|
46
|
+
orphans: 3;
|
|
47
|
+
widows: 3;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
pre, code {
|
|
51
|
+
font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
|
|
52
|
+
font-size: 0.9em;
|
|
53
|
+
background-color: #f5f5f5;
|
|
54
|
+
border: 1px solid #ddd;
|
|
55
|
+
border-radius: 3px;
|
|
56
|
+
padding: 0.2em 0.4em;
|
|
57
|
+
page-break-inside: avoid;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
pre {
|
|
61
|
+
padding: 1em;
|
|
62
|
+
overflow-x: auto;
|
|
63
|
+
white-space: pre;
|
|
64
|
+
margin: 1em 0;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
pre code {
|
|
68
|
+
background: none;
|
|
69
|
+
border: none;
|
|
70
|
+
padding: 0;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
blockquote {
|
|
74
|
+
margin: 1em 0;
|
|
75
|
+
padding-left: 1em;
|
|
76
|
+
border-left: 3px solid #ddd;
|
|
77
|
+
font-style: italic;
|
|
78
|
+
page-break-inside: avoid;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
ul, ol {
|
|
82
|
+
margin: 1em 0;
|
|
83
|
+
padding-left: 2em;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
li {
|
|
87
|
+
margin: 0.25em 0;
|
|
88
|
+
page-break-inside: avoid;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
table {
|
|
92
|
+
border-collapse: collapse;
|
|
93
|
+
width: 100%;
|
|
94
|
+
margin: 1em 0;
|
|
95
|
+
page-break-inside: avoid;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
th, td {
|
|
99
|
+
border: 1px solid #ddd;
|
|
100
|
+
padding: 0.5em;
|
|
101
|
+
text-align: left;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
th {
|
|
105
|
+
background-color: #f5f5f5;
|
|
106
|
+
font-weight: 600;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
a {
|
|
110
|
+
color: #0066cc;
|
|
111
|
+
text-decoration: none;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
a:hover {
|
|
115
|
+
text-decoration: underline;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
img {
|
|
119
|
+
max-width: 100%;
|
|
120
|
+
height: auto;
|
|
121
|
+
page-break-inside: avoid;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
hr {
|
|
125
|
+
margin: 2em 0;
|
|
126
|
+
border: none;
|
|
127
|
+
border-top: 1px solid #ddd;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
.page-break {
|
|
131
|
+
page-break-before: always;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
.no-print {
|
|
135
|
+
display: none !important;
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
@media screen {
|
|
140
|
+
body {
|
|
141
|
+
font-family: ${fontFamily};
|
|
142
|
+
font-size: ${fontSize};
|
|
143
|
+
line-height: ${lineHeight};
|
|
144
|
+
color: ${color};
|
|
145
|
+
background-color: ${backgroundColor};
|
|
146
|
+
margin: 20px;
|
|
147
|
+
padding: 20px;
|
|
148
|
+
max-width: 800px;
|
|
149
|
+
margin: 0 auto;
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
`;
|
|
153
|
+
const chatBubbleStyles = generateChatBubbleStyles(options.primaryColorRgb);
|
|
154
|
+
return `<style>${baseStyles}${chatBubbleStyles}</style>`;
|
|
155
|
+
};
|
|
156
|
+
exports.generateChatPDFCSS = generateChatPDFCSS;
|
|
157
|
+
const generateChatBubbleStyles = (primaryColorRgb) => {
|
|
158
|
+
const rgbValue = primaryColorRgb || '130, 70, 175';
|
|
159
|
+
return `
|
|
160
|
+
:root {
|
|
161
|
+
--memori-primary-rgb: ${rgbValue};
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
.chat-export-header {
|
|
165
|
+
margin-bottom: 2em;
|
|
166
|
+
padding-bottom: 1em;
|
|
167
|
+
border-bottom: 2px solid #e5e7eb;
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
.chat-export-date {
|
|
171
|
+
margin-top: 0.5em;
|
|
172
|
+
color: #6b7280;
|
|
173
|
+
font-size: 0.9em;
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
.chat-bubble-container {
|
|
177
|
+
display: flex;
|
|
178
|
+
align-items: flex-end;
|
|
179
|
+
margin-bottom: 1em;
|
|
180
|
+
page-break-inside: avoid;
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
.chat-bubble {
|
|
184
|
+
display: inline-flex;
|
|
185
|
+
max-width: 75%;
|
|
186
|
+
flex-direction: column;
|
|
187
|
+
padding: 10px 16px;
|
|
188
|
+
border-radius: 12px;
|
|
189
|
+
margin-bottom: 5px;
|
|
190
|
+
box-shadow: 0 3px 6px 0 rgba(0, 0, 0, 0.1), 0 1px 3px 0 rgba(0, 0, 0, 0.08);
|
|
191
|
+
font-size: 0.9em;
|
|
192
|
+
line-height: 1.5;
|
|
193
|
+
word-wrap: break-word;
|
|
194
|
+
overflow-wrap: break-word;
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
.chat-bubble-assistant {
|
|
198
|
+
border-radius: 12px 12px 12px 0;
|
|
199
|
+
margin-left: 0;
|
|
200
|
+
margin-right: auto;
|
|
201
|
+
background: #ffffff;
|
|
202
|
+
color: #141515;
|
|
203
|
+
border: 1px solid #e5e7eb;
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
.chat-bubble-user {
|
|
207
|
+
border-radius: 12px 12px 0 12px;
|
|
208
|
+
margin-left: auto;
|
|
209
|
+
margin-right: 0;
|
|
210
|
+
background: rgb(var(--memori-primary-rgb));
|
|
211
|
+
color: #ffffff;
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
.chat-bubble-content {
|
|
215
|
+
margin: 0;
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
.chat-bubble-content p {
|
|
219
|
+
margin: 0 0 0.5em 0;
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
.chat-bubble-content p:last-child {
|
|
223
|
+
margin-bottom: 0;
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
.chat-bubble-content ul,
|
|
227
|
+
.chat-bubble-content ol {
|
|
228
|
+
padding-left: 1.5em;
|
|
229
|
+
margin: 0.5em 0;
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
.chat-bubble-content a {
|
|
233
|
+
color: inherit;
|
|
234
|
+
text-decoration: underline;
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
.chat-bubble-user .chat-bubble-content a {
|
|
238
|
+
color: #ffffff;
|
|
239
|
+
text-decoration: underline;
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
.chat-bubble-assistant .chat-bubble-content a {
|
|
243
|
+
color:rgb(var(--memori-primary-rgb));
|
|
244
|
+
text-decoration: underline;
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
.chat-bubble-timestamp {
|
|
248
|
+
margin-top: 0.25em;
|
|
249
|
+
font-size: 0.75em;
|
|
250
|
+
opacity: 0.7;
|
|
251
|
+
text-align: right;
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
.chat-bubble-assistant .chat-bubble-timestamp {
|
|
255
|
+
text-align: left;
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
.chat-bubble-media {
|
|
259
|
+
margin: 0.5em 0 0 0;
|
|
260
|
+
padding-left: 1.5em;
|
|
261
|
+
list-style-type: disc;
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
.chat-bubble-media li {
|
|
265
|
+
margin: 0.25em 0;
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
.chat-bubble-content code {
|
|
269
|
+
background-color: rgba(0, 0, 0, 0.1);
|
|
270
|
+
padding: 0.2em 0.4em;
|
|
271
|
+
border-radius: 3px;
|
|
272
|
+
font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
|
|
273
|
+
font-size: 0.9em;
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
.chat-bubble-user .chat-bubble-content code {
|
|
277
|
+
background-color: rgba(255, 255, 255, 0.2);
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
.chat-bubble-content pre {
|
|
281
|
+
background-color: rgba(0, 0, 0, 0.05);
|
|
282
|
+
padding: 1em;
|
|
283
|
+
border-radius: 5px;
|
|
284
|
+
overflow-x: auto;
|
|
285
|
+
margin: 0.5em 0;
|
|
286
|
+
border: 1px solid rgba(0, 0, 0, 0.1);
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
.chat-bubble-user .chat-bubble-content pre {
|
|
290
|
+
background-color: rgba(255, 255, 255, 0.15);
|
|
291
|
+
border-color: rgba(255, 255, 255, 0.2);
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
.chat-bubble-content pre code {
|
|
295
|
+
background: none;
|
|
296
|
+
padding: 0;
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
.chat-bubble-content table {
|
|
300
|
+
width: 100%;
|
|
301
|
+
border-collapse: collapse;
|
|
302
|
+
margin: 0.5em 0;
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
.chat-bubble-content table th,
|
|
306
|
+
.chat-bubble-content table td {
|
|
307
|
+
border: 1px solid rgba(0, 0, 0, 0.1);
|
|
308
|
+
padding: 0.5em;
|
|
309
|
+
text-align: left;
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
.chat-bubble-user .chat-bubble-content table th,
|
|
313
|
+
.chat-bubble-user .chat-bubble-content table td {
|
|
314
|
+
border-color: rgba(255, 255, 255, 0.2);
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
.chat-bubble-content table th {
|
|
318
|
+
background-color: rgba(0, 0, 0, 0.05);
|
|
319
|
+
font-weight: 600;
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
.chat-bubble-user .chat-bubble-content table th {
|
|
323
|
+
background-color: rgba(255, 255, 255, 0.1);
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
.chat-bubble-content blockquote {
|
|
327
|
+
margin: 0.5em 0;
|
|
328
|
+
padding-left: 1em;
|
|
329
|
+
border-left: 3px solid rgba(0, 0, 0, 0.2);
|
|
330
|
+
font-style: italic;
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
.chat-bubble-user .chat-bubble-content blockquote {
|
|
334
|
+
border-left-color: rgba(255, 255, 255, 0.3);
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
.chat-bubble-content img {
|
|
338
|
+
max-width: 100%;
|
|
339
|
+
height: auto;
|
|
340
|
+
border-radius: 5px;
|
|
341
|
+
margin: 0.5em 0;
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
.chat-bubble-content h1,
|
|
345
|
+
.chat-bubble-content h2,
|
|
346
|
+
.chat-bubble-content h3,
|
|
347
|
+
.chat-bubble-content h4,
|
|
348
|
+
.chat-bubble-content h5,
|
|
349
|
+
.chat-bubble-content h6 {
|
|
350
|
+
margin: 0.5em 0 0.25em 0;
|
|
351
|
+
font-weight: 600;
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
.chat-bubble-content h1 { font-size: 1.5em; }
|
|
355
|
+
.chat-bubble-content h2 { font-size: 1.3em; }
|
|
356
|
+
.chat-bubble-content h3 { font-size: 1.1em; }
|
|
357
|
+
`;
|
|
358
|
+
};
|
|
359
|
+
const formatMessageBubble = (message, language = 'en') => {
|
|
360
|
+
const timestamp = message.timestamp
|
|
361
|
+
? new Intl.DateTimeFormat(language, {
|
|
362
|
+
dateStyle: 'short',
|
|
363
|
+
timeStyle: 'short',
|
|
364
|
+
}).format(new Date(message.timestamp.endsWith('Z')
|
|
365
|
+
? message.timestamp
|
|
366
|
+
: `${message.timestamp}Z`))
|
|
367
|
+
: '';
|
|
368
|
+
const cleanText = (message.text || '').replace(/<document_attachment filename="([^"]+)" type="([^"]+)">([\s\S]*?)<\/document_attachment>/g, '');
|
|
369
|
+
const { text: renderedText } = (0, message_1.renderMsg)(cleanText, false, 'Reasoning...', false);
|
|
370
|
+
const messageText = message.fromUser
|
|
371
|
+
? renderedText
|
|
372
|
+
: (0, utils_1.stripOutputTags)(renderedText);
|
|
373
|
+
const bubbleClass = message.fromUser
|
|
374
|
+
? 'chat-bubble chat-bubble-user'
|
|
375
|
+
: 'chat-bubble chat-bubble-assistant';
|
|
376
|
+
let html = `<div class="chat-bubble-container">`;
|
|
377
|
+
html += `<div class="${bubbleClass}">`;
|
|
378
|
+
if (messageText.trim()) {
|
|
379
|
+
html += `<div class="chat-bubble-content">${messageText}</div>`;
|
|
380
|
+
}
|
|
381
|
+
if (message.media && message.media.length > 0) {
|
|
382
|
+
html += `<ul class="chat-bubble-media">`;
|
|
383
|
+
message.media.forEach(media => {
|
|
384
|
+
if (media.title) {
|
|
385
|
+
html += `<li><a href="${media.url || '#'}">${media.title}</a></li>`;
|
|
386
|
+
}
|
|
387
|
+
else if (media.url) {
|
|
388
|
+
html += `<li><a href="${media.url}">${media.url}</a></li>`;
|
|
389
|
+
}
|
|
390
|
+
});
|
|
391
|
+
html += `</ul>`;
|
|
392
|
+
}
|
|
393
|
+
if (timestamp) {
|
|
394
|
+
html += `<div class="chat-bubble-timestamp">${timestamp}</div>`;
|
|
395
|
+
}
|
|
396
|
+
html += `</div>`;
|
|
397
|
+
html += `</div>`;
|
|
398
|
+
return html;
|
|
399
|
+
};
|
|
400
|
+
const formatChatHeader = (memoriName, exportDate, conversationStartedLabel) => {
|
|
401
|
+
return `
|
|
402
|
+
<div class="chat-export-header">
|
|
403
|
+
<h1>${memoriName} - Chat Export</h1>
|
|
404
|
+
<p class="chat-export-date">
|
|
405
|
+
<strong>${conversationStartedLabel}</strong>: ${exportDate}
|
|
406
|
+
</p>
|
|
407
|
+
</div>
|
|
408
|
+
`;
|
|
409
|
+
};
|
|
410
|
+
const formatChatHistoryForPDF = (params) => {
|
|
411
|
+
const { messages, memori, conversationStartedLabel, language = 'en' } = params;
|
|
412
|
+
if (!messages || messages.length === 0) {
|
|
413
|
+
return '';
|
|
414
|
+
}
|
|
415
|
+
const memoriName = (memori === null || memori === void 0 ? void 0 : memori.name) || 'Assistant';
|
|
416
|
+
const exportDate = new Intl.DateTimeFormat(language, {
|
|
417
|
+
dateStyle: 'long',
|
|
418
|
+
timeStyle: 'short',
|
|
419
|
+
}).format(new Date());
|
|
420
|
+
let html = formatChatHeader(memoriName, exportDate, conversationStartedLabel);
|
|
421
|
+
messages.forEach(message => {
|
|
422
|
+
html += formatMessageBubble(message, language);
|
|
423
|
+
});
|
|
424
|
+
return html;
|
|
425
|
+
};
|
|
426
|
+
exports.formatChatHistoryForPDF = formatChatHistoryForPDF;
|
|
427
|
+
const createChatPDFDocument = (htmlContent, title, options = {}) => {
|
|
428
|
+
const css = (0, exports.generateChatPDFCSS)(options);
|
|
429
|
+
return `
|
|
430
|
+
<!DOCTYPE html>
|
|
431
|
+
<html lang="en">
|
|
432
|
+
<head>
|
|
433
|
+
<meta charset="UTF-8">
|
|
434
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
435
|
+
<title>${title}</title>
|
|
436
|
+
${css}
|
|
437
|
+
</head>
|
|
438
|
+
<body>
|
|
439
|
+
<div class="content">
|
|
440
|
+
${htmlContent}
|
|
441
|
+
</div>
|
|
442
|
+
</body>
|
|
443
|
+
</html>
|
|
444
|
+
`;
|
|
445
|
+
};
|
|
446
|
+
exports.createChatPDFDocument = createChatPDFDocument;
|
|
447
|
+
//# sourceMappingURL=chatPdfExport.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chatPdfExport.js","sourceRoot":"","sources":["../../src/helpers/chatPdfExport.ts"],"names":[],"mappings":";;;AAMA,uCAAsC;AACtC,mCAA0C;AAqBnC,MAAM,kBAAkB,GAAG,CAAC,UAA0B,EAAE,EAAU,EAAE;IACzE,MAAM,EACJ,QAAQ,GAAG,MAAM,EACjB,UAAU,GAAG,sCAAsC,EACnD,UAAU,GAAG,KAAK,EAClB,KAAK,GAAG,MAAM,EAC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qB,GAAG,CACnC,WAAmB,EACnB,KAAa,EACb,UAA0B,EAAE,EACpB,EAAE;IACV,MAAM,GAAG,GAAG,IAAA,0BAAkB,EAAC,OAAO,CAAC,CAAC;IAExC,OAAO;;;;;;eAMM,KAAK;QACZ,GAAG;;;;UAID,WAAW;;;;GAIlB,CAAC;AACJ,CAAC,CAAC;AAvBW,QAAA,qBAAqB,yBAuBhC"}
|
package/dist/locales/de.json
CHANGED
|
@@ -128,6 +128,14 @@
|
|
|
128
128
|
"expertsInTheBoard": "Experten in diesem Rat",
|
|
129
129
|
"goToIntegrationsToCustomizeAvatar": "Um den Avatar anzupassen, gehen Sie zu \"Teilen\" und passen Sie die öffentliche Seite an"
|
|
130
130
|
},
|
|
131
|
+
"exportChatHistory": {
|
|
132
|
+
"exportPDF": "Chat als PDF exportieren",
|
|
133
|
+
"exporting": "Exportiere...",
|
|
134
|
+
"empty": "Kein Chatverlauf zum Exportieren",
|
|
135
|
+
"pdfNotSupported": "PDF-Export wird in diesem Browser nicht unterstützt",
|
|
136
|
+
"success": "Chat erfolgreich als PDF exportiert",
|
|
137
|
+
"error": "Fehler beim Exportieren des Chats als PDF. Bitte versuchen Sie es erneut."
|
|
138
|
+
},
|
|
131
139
|
"write_and_speak": {
|
|
132
140
|
"micButtonPopover": "Klicken Sie auf die Schaltfläche, um zu sprechen",
|
|
133
141
|
"micButtonPopoverListening": "Klicken Sie auf die Schaltfläche, um das Sprechen zu stoppen",
|
|
@@ -155,6 +163,7 @@
|
|
|
155
163
|
"latestFirst": "Neueste zuerst",
|
|
156
164
|
"oldestFirst": "Älteste zuerst",
|
|
157
165
|
"exportChat": "Chat exportieren",
|
|
166
|
+
"conversationStartedLabel": "Unterhaltung gestartet",
|
|
158
167
|
"settingsHeaderLabel": "Richten Sie hier ein, wenn Sie die Agent als Dauerrede einstellen möchten, und ändern Sie die Stillesekunden, wenn Sie sie anpassen möchten.",
|
|
159
168
|
"continuousSpeechLabel": "Kontinuierliche Rede",
|
|
160
169
|
"continuousSpeechDisabled": "Kontinuierliche Rede deaktiviert, da der Agent im Stummschaltmodus ist",
|
package/dist/locales/en.json
CHANGED
|
@@ -130,6 +130,14 @@
|
|
|
130
130
|
"expertsInTheBoard": "Experts in this board",
|
|
131
131
|
"goToIntegrationsToCustomizeAvatar": "To customize the avatar, go to Share and customize the public page"
|
|
132
132
|
},
|
|
133
|
+
"exportChatHistory": {
|
|
134
|
+
"exportPDF": "Export chat as PDF",
|
|
135
|
+
"exporting": "Exporting...",
|
|
136
|
+
"empty": "No chat history to export",
|
|
137
|
+
"pdfNotSupported": "PDF export is not supported in this browser",
|
|
138
|
+
"success": "Chat exported to PDF successfully",
|
|
139
|
+
"error": "Failed to export chat to PDF. Please try again."
|
|
140
|
+
},
|
|
133
141
|
"write_and_speak": {
|
|
134
142
|
"micButtonPopover": "Click the button to speak",
|
|
135
143
|
"micButtonPopoverListening": "Click the button to stop speak",
|
|
@@ -157,6 +165,7 @@
|
|
|
157
165
|
"latestFirst": "Latest first",
|
|
158
166
|
"oldestFirst": "Oldest first",
|
|
159
167
|
"exportChat": "Export Chat",
|
|
168
|
+
"conversationStartedLabel": "Conversation started",
|
|
160
169
|
"settingsHeaderLabel": "Setup here if you want to set the continuous speech, and change the silence seconds if you want to customize them.",
|
|
161
170
|
"continuousSpeechLabel": "Continuous speech",
|
|
162
171
|
"continuousSpeechDisabled": "Continuous speech disabled because the agent is in mute mode",
|
package/dist/locales/es.json
CHANGED
|
@@ -128,6 +128,14 @@
|
|
|
128
128
|
"expertsInTheBoard": "Expertos en este panel",
|
|
129
129
|
"goToIntegrationsToCustomizeAvatar": "Para personalizar el avatar, ve a Compartir y personaliza la página pública"
|
|
130
130
|
},
|
|
131
|
+
"exportChatHistory": {
|
|
132
|
+
"exportPDF": "Exportar chat como PDF",
|
|
133
|
+
"exporting": "Exportando...",
|
|
134
|
+
"empty": "No hay historial de chat para exportar",
|
|
135
|
+
"pdfNotSupported": "La exportación PDF no es compatible con este navegador",
|
|
136
|
+
"success": "Chat exportado a PDF exitosamente",
|
|
137
|
+
"error": "Error al exportar el chat a PDF. Por favor, inténtalo de nuevo."
|
|
138
|
+
},
|
|
131
139
|
"write_and_speak": {
|
|
132
140
|
"micButtonPopover": "Haga clic en el botón para hablar",
|
|
133
141
|
"micButtonPopoverListening": "Haga clic en el botón para dejar de hablar.",
|
|
@@ -155,6 +163,7 @@
|
|
|
155
163
|
"latestFirst": "Más recientes primero",
|
|
156
164
|
"oldestFirst": "Más antiguos primero",
|
|
157
165
|
"exportChat": "Exportar Chat",
|
|
166
|
+
"conversationStartedLabel": "Conversación iniciada",
|
|
158
167
|
"settingsHeaderLabel": "Configure aquí si desea configurar la memoria como voz continua y cambie los segundos de silencio si desea personalizarlos.",
|
|
159
168
|
"continuousSpeechLabel": "discurso continuo",
|
|
160
169
|
"continuousSpeechDisabled": "Discurso continuo deshabilitado porque el agente está en modo silencioso",
|
package/dist/locales/fr.json
CHANGED
|
@@ -124,16 +124,25 @@
|
|
|
124
124
|
"boardOfExperts": "Conseil d'experts",
|
|
125
125
|
"showExpertsInTheBoard": "Afficher les experts dans ce conseil",
|
|
126
126
|
"expertsInTheBoard": "Experts dans ce conseil",
|
|
127
|
-
"goToIntegrationsToCustomizeAvatar": "Pour personnaliser l'avatar, allez dans Partager et personnalisez la page publique"
|
|
128
|
-
|
|
129
|
-
|
|
127
|
+
"goToIntegrationsToCustomizeAvatar": "Pour personnaliser l'avatar, allez dans Partager et personnalisez la page publique"
|
|
128
|
+
},
|
|
129
|
+
"exportChatHistory": {
|
|
130
|
+
"exportPDF": "Exporter le chat en PDF",
|
|
131
|
+
"exporting": "Exportation en cours...",
|
|
132
|
+
"empty": "Aucun historique de chat à exporter",
|
|
133
|
+
"pdfNotSupported": "L'exportation PDF n'est pas prise en charge dans ce navigateur",
|
|
134
|
+
"success": "Chat exporté en PDF avec succès",
|
|
135
|
+
"error": "Échec de l'exportation du chat en PDF. Veuillez réessayer."
|
|
136
|
+
},
|
|
137
|
+
"write_and_speak": {
|
|
130
138
|
"loadingChatHistory": "Chargement de l'historique des discussions...",
|
|
131
139
|
"noChatHistoryAvailable": "Aucun historique des discussions disponible",
|
|
132
140
|
"noResultsFound": "Aucun résultat trouvé pour \"{{searchText}}\"",
|
|
133
141
|
"searchInChatHistory": "Rechercher dans l'historique des chats...",
|
|
134
142
|
"latestFirst": "Plus récents d'abord",
|
|
135
143
|
"oldestFirst": "Plus anciens d'abord",
|
|
136
|
-
"exportChat": "Exporter le Chat"
|
|
144
|
+
"exportChat": "Exporter le Chat",
|
|
145
|
+
"conversationStartedLabel": "Conversation démarrée"
|
|
137
146
|
},
|
|
138
147
|
"write_and_speak": {
|
|
139
148
|
"micButtonPopover": "Cliquez sur le bouton pour parler",
|
package/dist/locales/it.json
CHANGED
|
@@ -130,6 +130,14 @@
|
|
|
130
130
|
"expertsInTheBoard": "Esperti in questa board",
|
|
131
131
|
"goToIntegrationsToCustomizeAvatar": "Per personalizzare l'avatar, vai a Condividimi e configura la pagina pubblica"
|
|
132
132
|
},
|
|
133
|
+
"exportChatHistory": {
|
|
134
|
+
"exportPDF": "Esporta chat come PDF",
|
|
135
|
+
"exporting": "Esportazione in corso...",
|
|
136
|
+
"empty": "Nessuna cronologia chat da esportare",
|
|
137
|
+
"pdfNotSupported": "L'esportazione PDF non è supportata in questo browser",
|
|
138
|
+
"success": "Chat esportata in PDF con successo",
|
|
139
|
+
"error": "Impossibile esportare la chat in PDF. Riprova."
|
|
140
|
+
},
|
|
133
141
|
"write_and_speak": {
|
|
134
142
|
"micButtonPopover": "Premi il pulsante per parlare",
|
|
135
143
|
"micButtonPopoverListening": "Premi il pulsante per smettere di parlare",
|