@pocketping/widget 1.5.1 → 1.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +193 -105
- package/dist/index.js +193 -105
- package/dist/pocketping.min.global.js +99 -34
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -189,7 +189,7 @@ function styles(primaryColor, theme) {
|
|
|
189
189
|
display: flex;
|
|
190
190
|
align-items: center;
|
|
191
191
|
justify-content: space-between;
|
|
192
|
-
padding:
|
|
192
|
+
padding: 12px 14px;
|
|
193
193
|
background: ${primaryColor};
|
|
194
194
|
color: white;
|
|
195
195
|
}
|
|
@@ -197,24 +197,24 @@ function styles(primaryColor, theme) {
|
|
|
197
197
|
.pp-header-info {
|
|
198
198
|
display: flex;
|
|
199
199
|
align-items: center;
|
|
200
|
-
gap:
|
|
200
|
+
gap: 10px;
|
|
201
201
|
}
|
|
202
202
|
|
|
203
203
|
.pp-avatar {
|
|
204
|
-
width:
|
|
205
|
-
height:
|
|
204
|
+
width: 36px;
|
|
205
|
+
height: 36px;
|
|
206
206
|
border-radius: 50%;
|
|
207
207
|
object-fit: cover;
|
|
208
208
|
}
|
|
209
209
|
|
|
210
210
|
.pp-header-title {
|
|
211
211
|
font-weight: 600;
|
|
212
|
-
font-size:
|
|
212
|
+
font-size: 15px;
|
|
213
213
|
}
|
|
214
214
|
|
|
215
215
|
.pp-header-status {
|
|
216
|
-
font-size:
|
|
217
|
-
opacity: 0.
|
|
216
|
+
font-size: 11px;
|
|
217
|
+
opacity: 0.85;
|
|
218
218
|
display: flex;
|
|
219
219
|
align-items: center;
|
|
220
220
|
gap: 4px;
|
|
@@ -260,10 +260,10 @@ function styles(primaryColor, theme) {
|
|
|
260
260
|
.pp-messages {
|
|
261
261
|
flex: 1;
|
|
262
262
|
overflow-y: auto;
|
|
263
|
-
padding:
|
|
263
|
+
padding: 12px;
|
|
264
264
|
display: flex;
|
|
265
265
|
flex-direction: column;
|
|
266
|
-
gap:
|
|
266
|
+
gap: 3px;
|
|
267
267
|
}
|
|
268
268
|
|
|
269
269
|
.pp-welcome {
|
|
@@ -273,14 +273,32 @@ function styles(primaryColor, theme) {
|
|
|
273
273
|
font-size: 13px;
|
|
274
274
|
}
|
|
275
275
|
|
|
276
|
+
.pp-date-separator {
|
|
277
|
+
display: flex;
|
|
278
|
+
align-items: center;
|
|
279
|
+
justify-content: center;
|
|
280
|
+
margin: 16px 0 12px;
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
.pp-date-separator span {
|
|
284
|
+
background: ${colors.bgSecondary};
|
|
285
|
+
color: ${colors.textSecondary};
|
|
286
|
+
font-size: 11px;
|
|
287
|
+
padding: 4px 12px;
|
|
288
|
+
border-radius: 12px;
|
|
289
|
+
font-weight: 500;
|
|
290
|
+
}
|
|
291
|
+
|
|
276
292
|
.pp-message {
|
|
277
|
-
max-width:
|
|
278
|
-
padding: 10px
|
|
279
|
-
border-radius:
|
|
293
|
+
max-width: 85%;
|
|
294
|
+
padding: 6px 10px;
|
|
295
|
+
border-radius: 12px;
|
|
280
296
|
word-wrap: break-word;
|
|
281
297
|
position: relative;
|
|
282
298
|
user-select: text;
|
|
283
299
|
-webkit-user-select: text;
|
|
300
|
+
font-size: 14px;
|
|
301
|
+
line-height: 1.35;
|
|
284
302
|
}
|
|
285
303
|
|
|
286
304
|
/* Hover actions container - positioned above message (Slack style) */
|
|
@@ -372,7 +390,8 @@ function styles(primaryColor, theme) {
|
|
|
372
390
|
align-self: flex-end;
|
|
373
391
|
background: ${primaryColor};
|
|
374
392
|
color: white;
|
|
375
|
-
border-bottom-right-radius:
|
|
393
|
+
border-bottom-right-radius: 3px;
|
|
394
|
+
margin-left: 32px;
|
|
376
395
|
}
|
|
377
396
|
|
|
378
397
|
.pp-message-operator,
|
|
@@ -380,19 +399,31 @@ function styles(primaryColor, theme) {
|
|
|
380
399
|
align-self: flex-start;
|
|
381
400
|
background: ${colors.messageBg};
|
|
382
401
|
color: ${colors.text};
|
|
383
|
-
border-bottom-left-radius:
|
|
402
|
+
border-bottom-left-radius: 3px;
|
|
403
|
+
margin-right: 32px;
|
|
404
|
+
}
|
|
405
|
+
|
|
406
|
+
/* Add spacing between different senders */
|
|
407
|
+
.pp-message-visitor + .pp-message-operator,
|
|
408
|
+
.pp-message-visitor + .pp-message-ai,
|
|
409
|
+
.pp-message-operator + .pp-message-visitor,
|
|
410
|
+
.pp-message-ai + .pp-message-visitor {
|
|
411
|
+
margin-top: 8px;
|
|
384
412
|
}
|
|
385
413
|
|
|
386
414
|
.pp-message-content {
|
|
387
|
-
|
|
415
|
+
display: inline;
|
|
388
416
|
}
|
|
389
417
|
|
|
390
418
|
.pp-message-time {
|
|
391
|
-
font-size:
|
|
392
|
-
opacity: 0.
|
|
393
|
-
display: flex;
|
|
419
|
+
font-size: 10px;
|
|
420
|
+
opacity: 0.6;
|
|
421
|
+
display: inline-flex;
|
|
394
422
|
align-items: center;
|
|
395
|
-
gap:
|
|
423
|
+
gap: 3px;
|
|
424
|
+
float: right;
|
|
425
|
+
margin-left: 8px;
|
|
426
|
+
margin-top: 4px;
|
|
396
427
|
}
|
|
397
428
|
|
|
398
429
|
.pp-ai-badge {
|
|
@@ -429,13 +460,13 @@ function styles(primaryColor, theme) {
|
|
|
429
460
|
|
|
430
461
|
.pp-typing {
|
|
431
462
|
display: flex;
|
|
432
|
-
gap:
|
|
433
|
-
padding:
|
|
463
|
+
gap: 3px;
|
|
464
|
+
padding: 8px 12px;
|
|
434
465
|
}
|
|
435
466
|
|
|
436
467
|
.pp-typing span {
|
|
437
|
-
width:
|
|
438
|
-
height:
|
|
468
|
+
width: 6px;
|
|
469
|
+
height: 6px;
|
|
439
470
|
background: ${colors.textSecondary};
|
|
440
471
|
border-radius: 50%;
|
|
441
472
|
animation: pp-bounce 1.4s infinite ease-in-out both;
|
|
@@ -451,14 +482,18 @@ function styles(primaryColor, theme) {
|
|
|
451
482
|
|
|
452
483
|
.pp-input-form {
|
|
453
484
|
display: flex;
|
|
454
|
-
padding: 12px;
|
|
485
|
+
padding: 10px 12px;
|
|
455
486
|
gap: 8px;
|
|
456
487
|
border-top: 1px solid ${colors.border};
|
|
488
|
+
align-items: center;
|
|
457
489
|
}
|
|
458
490
|
|
|
459
491
|
.pp-input {
|
|
460
492
|
flex: 1;
|
|
461
|
-
|
|
493
|
+
min-width: 0;
|
|
494
|
+
height: 40px;
|
|
495
|
+
line-height: 40px;
|
|
496
|
+
padding: 0 16px;
|
|
462
497
|
border: 1px solid ${colors.border};
|
|
463
498
|
border-radius: 20px;
|
|
464
499
|
background: ${colors.bg};
|
|
@@ -466,6 +501,8 @@ function styles(primaryColor, theme) {
|
|
|
466
501
|
font-size: 14px;
|
|
467
502
|
outline: none;
|
|
468
503
|
transition: border-color 0.2s;
|
|
504
|
+
box-sizing: border-box;
|
|
505
|
+
margin: 0;
|
|
469
506
|
}
|
|
470
507
|
|
|
471
508
|
.pp-input:focus {
|
|
@@ -479,6 +516,7 @@ function styles(primaryColor, theme) {
|
|
|
479
516
|
.pp-send-btn {
|
|
480
517
|
width: 40px;
|
|
481
518
|
height: 40px;
|
|
519
|
+
min-width: 40px;
|
|
482
520
|
border-radius: 50%;
|
|
483
521
|
background: ${primaryColor};
|
|
484
522
|
color: white;
|
|
@@ -487,7 +525,18 @@ function styles(primaryColor, theme) {
|
|
|
487
525
|
display: flex;
|
|
488
526
|
align-items: center;
|
|
489
527
|
justify-content: center;
|
|
490
|
-
transition: opacity 0.2s;
|
|
528
|
+
transition: opacity 0.2s, transform 0.1s;
|
|
529
|
+
flex-shrink: 0;
|
|
530
|
+
margin: 0;
|
|
531
|
+
padding: 0;
|
|
532
|
+
}
|
|
533
|
+
|
|
534
|
+
.pp-send-btn:not(:disabled):hover {
|
|
535
|
+
transform: scale(1.05);
|
|
536
|
+
}
|
|
537
|
+
|
|
538
|
+
.pp-send-btn:not(:disabled):active {
|
|
539
|
+
transform: scale(0.95);
|
|
491
540
|
}
|
|
492
541
|
|
|
493
542
|
.pp-send-btn:disabled {
|
|
@@ -506,6 +555,7 @@ function styles(primaryColor, theme) {
|
|
|
506
555
|
font-size: 11px;
|
|
507
556
|
color: ${colors.textSecondary};
|
|
508
557
|
border-top: 1px solid ${colors.border};
|
|
558
|
+
opacity: 0.7;
|
|
509
559
|
}
|
|
510
560
|
|
|
511
561
|
.pp-footer a {
|
|
@@ -534,6 +584,7 @@ function styles(primaryColor, theme) {
|
|
|
534
584
|
.pp-attach-btn {
|
|
535
585
|
width: 40px;
|
|
536
586
|
height: 40px;
|
|
587
|
+
min-width: 40px;
|
|
537
588
|
border-radius: 50%;
|
|
538
589
|
background: transparent;
|
|
539
590
|
color: ${colors.textSecondary};
|
|
@@ -542,6 +593,8 @@ function styles(primaryColor, theme) {
|
|
|
542
593
|
display: flex;
|
|
543
594
|
align-items: center;
|
|
544
595
|
justify-content: center;
|
|
596
|
+
margin: 0;
|
|
597
|
+
padding: 0;
|
|
545
598
|
transition: color 0.2s, border-color 0.2s;
|
|
546
599
|
flex-shrink: 0;
|
|
547
600
|
}
|
|
@@ -933,17 +986,29 @@ function styles(primaryColor, theme) {
|
|
|
933
986
|
}
|
|
934
987
|
|
|
935
988
|
.pp-reply-cancel {
|
|
936
|
-
background:
|
|
989
|
+
background: ${isDark ? "rgba(255,255,255,0.1)" : "rgba(0,0,0,0.05)"};
|
|
937
990
|
border: none;
|
|
991
|
+
border-radius: 50%;
|
|
938
992
|
color: ${colors.textSecondary};
|
|
939
993
|
cursor: pointer;
|
|
940
|
-
padding:
|
|
994
|
+
padding: 0;
|
|
995
|
+
width: 24px;
|
|
996
|
+
height: 24px;
|
|
997
|
+
min-width: 24px;
|
|
998
|
+
display: flex;
|
|
999
|
+
align-items: center;
|
|
1000
|
+
justify-content: center;
|
|
941
1001
|
flex-shrink: 0;
|
|
1002
|
+
transition: background 0.15s;
|
|
1003
|
+
}
|
|
1004
|
+
|
|
1005
|
+
.pp-reply-cancel:hover {
|
|
1006
|
+
background: ${isDark ? "rgba(255,255,255,0.2)" : "rgba(0,0,0,0.1)"};
|
|
942
1007
|
}
|
|
943
1008
|
|
|
944
1009
|
.pp-reply-cancel svg {
|
|
945
|
-
width:
|
|
946
|
-
height:
|
|
1010
|
+
width: 14px;
|
|
1011
|
+
height: 14px;
|
|
947
1012
|
}
|
|
948
1013
|
|
|
949
1014
|
/* Reply Quote in Message */
|
|
@@ -1048,6 +1113,24 @@ function styles(primaryColor, theme) {
|
|
|
1048
1113
|
|
|
1049
1114
|
// src/components/ChatWidget.tsx
|
|
1050
1115
|
var import_jsx_runtime = require("preact/jsx-runtime");
|
|
1116
|
+
function formatDateSeparator(date) {
|
|
1117
|
+
const now = /* @__PURE__ */ new Date();
|
|
1118
|
+
const messageDate = new Date(date);
|
|
1119
|
+
const today = new Date(now.getFullYear(), now.getMonth(), now.getDate());
|
|
1120
|
+
const msgDay = new Date(messageDate.getFullYear(), messageDate.getMonth(), messageDate.getDate());
|
|
1121
|
+
const diffDays = Math.floor((today.getTime() - msgDay.getTime()) / (1e3 * 60 * 60 * 24));
|
|
1122
|
+
if (diffDays === 0) return "Today";
|
|
1123
|
+
if (diffDays === 1) return "Yesterday";
|
|
1124
|
+
return messageDate.toLocaleDateString("en-US", {
|
|
1125
|
+
month: "short",
|
|
1126
|
+
day: "numeric",
|
|
1127
|
+
year: messageDate.getFullYear() !== now.getFullYear() ? "numeric" : void 0
|
|
1128
|
+
});
|
|
1129
|
+
}
|
|
1130
|
+
function getDateKey(date) {
|
|
1131
|
+
const d = new Date(date);
|
|
1132
|
+
return `${d.getFullYear()}-${d.getMonth()}-${d.getDate()}`;
|
|
1133
|
+
}
|
|
1051
1134
|
function ChatWidget({ client: client2, config: initialConfig }) {
|
|
1052
1135
|
const [isOpen, setIsOpen] = (0, import_hooks.useState)(false);
|
|
1053
1136
|
const [messages, setMessages] = (0, import_hooks.useState)([]);
|
|
@@ -1457,9 +1540,12 @@ function ChatWidget({ client: client2, config: initialConfig }) {
|
|
|
1457
1540
|
] }),
|
|
1458
1541
|
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { class: "pp-messages", ref: messagesContainerRef, children: [
|
|
1459
1542
|
config.welcomeMessage && messages.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { class: "pp-welcome", children: config.welcomeMessage }),
|
|
1460
|
-
messages.map((msg) => {
|
|
1543
|
+
messages.map((msg, index) => {
|
|
1461
1544
|
const isDeleted = !!msg.deletedAt;
|
|
1462
1545
|
const isEdited = !!msg.editedAt;
|
|
1546
|
+
const msgDate = new Date(msg.timestamp);
|
|
1547
|
+
const prevMsg = index > 0 ? messages[index - 1] : null;
|
|
1548
|
+
const showDateSeparator = !prevMsg || getDateKey(new Date(prevMsg.timestamp)) !== getDateKey(msgDate);
|
|
1463
1549
|
let replyData = null;
|
|
1464
1550
|
if (msg.replyTo) {
|
|
1465
1551
|
if (typeof msg.replyTo === "object") {
|
|
@@ -1481,86 +1567,88 @@ function ChatWidget({ client: client2, config: initialConfig }) {
|
|
|
1481
1567
|
}
|
|
1482
1568
|
const isHovered = hoveredMessageId === msg.id;
|
|
1483
1569
|
const showActions = isHovered && !isDeleted;
|
|
1484
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
1485
|
-
"div",
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
|
|
1489
|
-
|
|
1490
|
-
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
|
|
1494
|
-
|
|
1495
|
-
|
|
1496
|
-
|
|
1497
|
-
|
|
1498
|
-
|
|
1499
|
-
{
|
|
1500
|
-
class: "pp-action-btn",
|
|
1501
|
-
onClick: () => handleReply(msg),
|
|
1502
|
-
title: "Reply",
|
|
1503
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ReplyIcon, { color: actionIconColor })
|
|
1504
|
-
}
|
|
1505
|
-
),
|
|
1506
|
-
msg.sender === "visitor" && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
1570
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_preact.Fragment, { children: [
|
|
1571
|
+
showDateSeparator && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { class: "pp-date-separator", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: formatDateSeparator(msgDate) }) }),
|
|
1572
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
1573
|
+
"div",
|
|
1574
|
+
{
|
|
1575
|
+
id: `pp-msg-${msg.id}`,
|
|
1576
|
+
class: `pp-message pp-message-${msg.sender} ${isDeleted ? "pp-message-deleted" : ""}`,
|
|
1577
|
+
onContextMenu: (e) => handleMessageContextMenu(e, msg),
|
|
1578
|
+
onMouseEnter: () => setHoveredMessageId(msg.id),
|
|
1579
|
+
onMouseLeave: () => setHoveredMessageId(null),
|
|
1580
|
+
onTouchStart: () => handleTouchStart(msg),
|
|
1581
|
+
onTouchEnd: handleTouchEnd,
|
|
1582
|
+
onTouchCancel: handleTouchEnd,
|
|
1583
|
+
children: [
|
|
1584
|
+
showActions && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { class: `pp-message-actions ${msg.sender === "visitor" ? "pp-actions-left" : "pp-actions-right"}`, children: [
|
|
1507
1585
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
1508
1586
|
"button",
|
|
1509
1587
|
{
|
|
1510
1588
|
class: "pp-action-btn",
|
|
1511
|
-
onClick: () =>
|
|
1512
|
-
title: "
|
|
1513
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
1589
|
+
onClick: () => handleReply(msg),
|
|
1590
|
+
title: "Reply",
|
|
1591
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ReplyIcon, { color: actionIconColor })
|
|
1514
1592
|
}
|
|
1515
1593
|
),
|
|
1516
|
-
/* @__PURE__ */ (0, import_jsx_runtime.
|
|
1517
|
-
|
|
1518
|
-
|
|
1519
|
-
|
|
1520
|
-
|
|
1521
|
-
|
|
1522
|
-
|
|
1523
|
-
|
|
1524
|
-
|
|
1594
|
+
msg.sender === "visitor" && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
1595
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
1596
|
+
"button",
|
|
1597
|
+
{
|
|
1598
|
+
class: "pp-action-btn",
|
|
1599
|
+
onClick: () => handleStartEdit(msg),
|
|
1600
|
+
title: "Edit",
|
|
1601
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(EditIcon, { color: actionIconColor })
|
|
1602
|
+
}
|
|
1603
|
+
),
|
|
1604
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
1605
|
+
"button",
|
|
1606
|
+
{
|
|
1607
|
+
class: "pp-action-btn pp-action-delete",
|
|
1608
|
+
onClick: () => handleDelete(msg),
|
|
1609
|
+
title: "Delete",
|
|
1610
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DeleteIcon, { color: actionIconColor })
|
|
1611
|
+
}
|
|
1612
|
+
)
|
|
1613
|
+
] })
|
|
1614
|
+
] }),
|
|
1615
|
+
replyData && (replyData.content || replyData.hasAttachment) && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
1616
|
+
"div",
|
|
1617
|
+
{
|
|
1618
|
+
class: "pp-reply-quote pp-reply-quote-clickable",
|
|
1619
|
+
onClick: () => scrollToMessage(replyData.id),
|
|
1620
|
+
role: "button",
|
|
1621
|
+
tabIndex: 0,
|
|
1622
|
+
onKeyDown: (e) => e.key === "Enter" && scrollToMessage(replyData.id),
|
|
1623
|
+
children: [
|
|
1624
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { class: "pp-reply-sender", children: replyData.sender === "visitor" ? "You" : "Support" }),
|
|
1625
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { class: "pp-reply-content", children: replyData.deleted ? "Message deleted" : /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
1626
|
+
replyData.hasAttachment && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { class: "pp-reply-attachment-icon", children: replyData.attachmentType?.startsWith("image/") ? "\u{1F4F7} " : "\u{1F4CE} " }),
|
|
1627
|
+
replyData.content ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
1628
|
+
(replyData.content || "").slice(0, 50),
|
|
1629
|
+
(replyData.content || "").length > 50 ? "..." : ""
|
|
1630
|
+
] }) : replyData.attachmentType?.startsWith("image/") ? "Photo" : "File"
|
|
1631
|
+
] }) })
|
|
1632
|
+
]
|
|
1633
|
+
}
|
|
1634
|
+
),
|
|
1635
|
+
isDeleted ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { class: "pp-message-content pp-deleted-content", children: [
|
|
1636
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { class: "pp-deleted-icon", children: "\u{1F5D1}\uFE0F" }),
|
|
1637
|
+
" Message deleted"
|
|
1638
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
1639
|
+
msg.content && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { class: "pp-message-content", children: msg.content }),
|
|
1640
|
+
msg.attachments && msg.attachments.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { class: "pp-message-attachments", children: msg.attachments.map((att) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AttachmentDisplay, { attachment: att }, att.id)) })
|
|
1641
|
+
] }),
|
|
1642
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { class: "pp-message-time", children: [
|
|
1643
|
+
formatTime(msg.timestamp),
|
|
1644
|
+
isEdited && !isDeleted && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { class: "pp-edited-badge", children: "edited" }),
|
|
1645
|
+
msg.sender === "ai" && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { class: "pp-ai-badge", children: "AI" }),
|
|
1646
|
+
msg.sender === "visitor" && !isDeleted && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { class: `pp-status pp-status-${msg.status ?? "sent"}`, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(StatusIcon, { status: msg.status }) })
|
|
1525
1647
|
] })
|
|
1526
|
-
]
|
|
1527
|
-
|
|
1528
|
-
|
|
1529
|
-
|
|
1530
|
-
class: "pp-reply-quote pp-reply-quote-clickable",
|
|
1531
|
-
onClick: () => scrollToMessage(replyData.id),
|
|
1532
|
-
role: "button",
|
|
1533
|
-
tabIndex: 0,
|
|
1534
|
-
onKeyDown: (e) => e.key === "Enter" && scrollToMessage(replyData.id),
|
|
1535
|
-
children: [
|
|
1536
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { class: "pp-reply-sender", children: replyData.sender === "visitor" ? "You" : "Support" }),
|
|
1537
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { class: "pp-reply-content", children: replyData.deleted ? "Message deleted" : /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
1538
|
-
replyData.hasAttachment && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { class: "pp-reply-attachment-icon", children: replyData.attachmentType?.startsWith("image/") ? "\u{1F4F7} " : "\u{1F4CE} " }),
|
|
1539
|
-
replyData.content ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
1540
|
-
(replyData.content || "").slice(0, 50),
|
|
1541
|
-
(replyData.content || "").length > 50 ? "..." : ""
|
|
1542
|
-
] }) : replyData.attachmentType?.startsWith("image/") ? "Photo" : "File"
|
|
1543
|
-
] }) })
|
|
1544
|
-
]
|
|
1545
|
-
}
|
|
1546
|
-
),
|
|
1547
|
-
isDeleted ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { class: "pp-message-content pp-deleted-content", children: [
|
|
1548
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { class: "pp-deleted-icon", children: "\u{1F5D1}\uFE0F" }),
|
|
1549
|
-
" Message deleted"
|
|
1550
|
-
] }) : /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
1551
|
-
msg.content && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { class: "pp-message-content", children: msg.content }),
|
|
1552
|
-
msg.attachments && msg.attachments.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { class: "pp-message-attachments", children: msg.attachments.map((att) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AttachmentDisplay, { attachment: att }, att.id)) })
|
|
1553
|
-
] }),
|
|
1554
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { class: "pp-message-time", children: [
|
|
1555
|
-
formatTime(msg.timestamp),
|
|
1556
|
-
isEdited && !isDeleted && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { class: "pp-edited-badge", children: "edited" }),
|
|
1557
|
-
msg.sender === "ai" && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { class: "pp-ai-badge", children: "AI" }),
|
|
1558
|
-
msg.sender === "visitor" && !isDeleted && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { class: `pp-status pp-status-${msg.status ?? "sent"}`, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(StatusIcon, { status: msg.status }) })
|
|
1559
|
-
] })
|
|
1560
|
-
]
|
|
1561
|
-
},
|
|
1562
|
-
msg.id
|
|
1563
|
-
);
|
|
1648
|
+
]
|
|
1649
|
+
}
|
|
1650
|
+
)
|
|
1651
|
+
] }, msg.id);
|
|
1564
1652
|
}),
|
|
1565
1653
|
isTyping && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { class: "pp-message pp-message-operator pp-typing", children: [
|
|
1566
1654
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {}),
|
|
@@ -1836,7 +1924,7 @@ function AttachmentDisplay({ attachment }) {
|
|
|
1836
1924
|
}
|
|
1837
1925
|
|
|
1838
1926
|
// src/version.ts
|
|
1839
|
-
var VERSION = "0.3.
|
|
1927
|
+
var VERSION = "0.3.7";
|
|
1840
1928
|
|
|
1841
1929
|
// src/client.ts
|
|
1842
1930
|
var PocketPingClient = class {
|