alice-and-bot 1.0.79 → 1.0.80
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/README.md +7 -5
- package/_dist/lit/components/chat-box.d.ts +8 -0
- package/_dist/lit/components/chat-box.d.ts.map +1 -1
- package/_dist/lit/components/connected-chat.d.ts +14 -0
- package/_dist/lit/components/connected-chat.d.ts.map +1 -1
- package/_dist/protocol/src/retention.d.ts.map +1 -1
- package/{chunk-45LBWUH3.js → chunk-UYJMSQZX.js} +3 -0
- package/components.js +404 -27
- package/mod.js +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -294,7 +294,9 @@ await sendMessage({
|
|
|
294
294
|
});
|
|
295
295
|
```
|
|
296
296
|
|
|
297
|
-
Upload a file as an encrypted attachment
|
|
297
|
+
Upload a file as an encrypted attachment (hosted attachments and messages
|
|
298
|
+
auto-delete after 30 days — see the
|
|
299
|
+
[retention schedule](https://aliceandbot.com/privacy#retention)):
|
|
298
300
|
|
|
299
301
|
```ts
|
|
300
302
|
uploadAttachment({
|
|
@@ -863,7 +865,7 @@ To host your own widget:
|
|
|
863
865
|
signed by the notification server with Ed25519 (`X-Alice-Signature` /
|
|
864
866
|
`serverSignature`), verified with timestamp freshness and per-message replay
|
|
865
867
|
deduplication in `handleWebhookUpdate` / `verifyWebhookOrigin`.
|
|
866
|
-
- **30-day rolling retention:**
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
868
|
+
- **30-day rolling retention:** Hosted messages and attachments auto-delete
|
|
869
|
+
after 30 days; see the
|
|
870
|
+
[retention schedule](https://aliceandbot.com/privacy#retention) for the full
|
|
871
|
+
breakdown of what is stored and for how long.
|
|
@@ -127,6 +127,12 @@ export declare class ChatBox extends LitElement {
|
|
|
127
127
|
participants: {
|
|
128
128
|
type: any;
|
|
129
129
|
};
|
|
130
|
+
unreadDividerAfterTimestamp: {
|
|
131
|
+
attribute: boolean;
|
|
132
|
+
};
|
|
133
|
+
otherUnreadCount: {
|
|
134
|
+
type: any;
|
|
135
|
+
};
|
|
130
136
|
_input: {
|
|
131
137
|
state: boolean;
|
|
132
138
|
};
|
|
@@ -234,6 +240,8 @@ export declare class ChatBox extends LitElement {
|
|
|
234
240
|
name: string;
|
|
235
241
|
avatar: string;
|
|
236
242
|
}[];
|
|
243
|
+
unreadDividerAfterTimestamp: number | undefined;
|
|
244
|
+
otherUnreadCount: number;
|
|
237
245
|
private _input: any;
|
|
238
246
|
private _pendingFiles: any;
|
|
239
247
|
private _showAttachMenu: any;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chat-box.d.ts","sources":["../../../lit/components/chat-box.ts"],"names":[],"mappings":"AAAA,SAAe,UAAU,EAAW,KAAK,cAAc,cAAwB;
|
|
1
|
+
{"version":3,"file":"chat-box.d.ts","sources":["../../../lit/components/chat-box.ts"],"names":[],"mappings":"AAAA,SAAe,UAAU,EAAW,KAAK,cAAc,cAAwB;AAmE/E,cACE,kBAAkB,EAClB,cAAc,EACd,aAAa,EACb,YAAY,EACZ,YAAY,EACZ,gBAAgB,qBAEE;AAylBpB,OAAO,cAAM,gBAAgB;EAC3B,gBAAgB;IACd;MAAY;;IACZ;MAAe;;IACf;MAAa;MAAe;;IAC5B;MAAe;;IACf;MAAY;;IACZ;MAAU;;IACV;MAAU;;IACV;MAAyB;;IACzB;MAAU;;IACV;MAAW;;IACX;;IACA;MAAgB;;IAChB;MAAqB;;IACrB;MAAe;;IACf;MAAmB;;IACnB;MAAa;;IACb;MAAoB;;IACpB;MAAgB;;IAChB;MAAuB;;IACvB;MAAqB;;IACrB;MAAwB;;IACxB;MAAmB;;IACnB;;IACA;MAAqB;;IACrB;MAAkB;;IAClB;MAAgB;;IAChB;MAAe;;IACf;MAAgB;;IAChB;MAAgB;;IAChB;MAAa;;IACb;MAAgB;;IAChB;MAAU;;IACV;MAAW;;IACX;MAAiB;;IACjB;MAAkB;;IAClB;MAAkB;;IAClB;MAAkB;;IACl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AEF,QAAQ,sBAUN;EAEF,QAAQ,wBAsHN;EAEF,QAAQ,mBAIN;EAEF,QAAQ,uBAaN;EAEF,QAAQ,qBAIN;EAEF,QAAQ,oBAIN;EAEF,QAAQ,uBAIN;EAEF,QAAQ,uBAQN;EAEF,QAAQ,iBAON;EAEF,QAAQ,kBAEN;EAEF,QAAQ,oBAIN;EAEF,QAAQ,qBAEN;UAEU;EAMZ,SAAS,QAAQ,SAAS,IAAI,MAAM,EAAE,OAAO,CAAC;EAmK9C,SAAS,UAAU;UAo8BX;UA0CA;AAwDV"}
|
|
@@ -58,6 +58,12 @@ export declare class ConnectedChat extends LitElement {
|
|
|
58
58
|
onConversationChange: {
|
|
59
59
|
attribute: boolean;
|
|
60
60
|
};
|
|
61
|
+
unreadDividerAfterTimestamp: {
|
|
62
|
+
attribute: boolean;
|
|
63
|
+
};
|
|
64
|
+
otherUnreadCount: {
|
|
65
|
+
type: any;
|
|
66
|
+
};
|
|
61
67
|
};
|
|
62
68
|
credentials: Credentials | null;
|
|
63
69
|
conversationId: string;
|
|
@@ -77,6 +83,8 @@ export declare class ConnectedChat extends LitElement {
|
|
|
77
83
|
onChatWith: ((publicSignKey: string) => void) | undefined;
|
|
78
84
|
onNewThread: ((conversationId: string) => void) | undefined;
|
|
79
85
|
onConversationChange: ((conversationId: string) => void) | undefined;
|
|
86
|
+
unreadDividerAfterTimestamp: number | undefined;
|
|
87
|
+
otherUnreadCount: number;
|
|
80
88
|
constructor();
|
|
81
89
|
private _activeConversationId: any;
|
|
82
90
|
private _subscribedConversationId: any;
|
|
@@ -85,6 +93,9 @@ export declare class ConnectedChat extends LitElement {
|
|
|
85
93
|
private _conversations: any;
|
|
86
94
|
private _conversationPreviews: any;
|
|
87
95
|
private _typingByConversation: any;
|
|
96
|
+
private _unreadState: any;
|
|
97
|
+
private _unreadStorageUnsub: any;
|
|
98
|
+
private _internalUnreadDividerAfterTimestamp: any;
|
|
88
99
|
private _searchQuery: any;
|
|
89
100
|
private _nameCache: any;
|
|
90
101
|
private _nameUnsubs: any;
|
|
@@ -138,6 +149,9 @@ export declare class ConnectedChat extends LitElement {
|
|
|
138
149
|
private _teardownChatListSubscriptions: any;
|
|
139
150
|
private _teardown: any;
|
|
140
151
|
private _setupSubscriptions: any;
|
|
152
|
+
private _isConversationVisiblyOpen: any;
|
|
153
|
+
private _markConversationReadIfNeeded: any;
|
|
154
|
+
private _handleVisibilityOrFocus: any;
|
|
141
155
|
private _setupChatListSubscriptions: any;
|
|
142
156
|
private _subscribeName: any;
|
|
143
157
|
private _selectConversation: any;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"connected-chat.d.ts","sources":["../../../lit/components/connected-chat.ts"],"names":[],"mappings":"AAAA,SAAe,UAAU,EAAE,OAAO,EAAE,KAAK,cAAc,cAAwB;AAE/E,cAEE,WAAW,0CAI4B;AAoBzC,SAEE,KAAK,YAAY,mCAUe;
|
|
1
|
+
{"version":3,"file":"connected-chat.d.ts","sources":["../../../lit/components/connected-chat.ts"],"names":[],"mappings":"AAAA,SAAe,UAAU,EAAE,OAAO,EAAE,KAAK,cAAc,cAAwB;AAE/E,cAEE,WAAW,0CAI4B;AAoBzC,SAEE,KAAK,YAAY,mCAUe;AAsDlC,cAKE,YAAY,EAGZ,gBAAgB,qBACE;AAupBpB,OAAO,cAAM,sBAAsB;EACjC,gBAAgB;IACd;MAAe;;IACf;MAAkB;;IAClB;MAAuB;;IACvB;MAAU;;IACV;MAAW;;IACX;MAAoB;;IACpB;MAAoB;;IACpB;MAAgB;;IAChB;MAAqB;;IACrB;MAAwB;;IACxB;MAAmB;;IACnB;MAAuB;;IACvB;MAAU;;IACV;MAAgB;;IAChB;MAAqB;;IACrB;MAAc;;IACd;MAAe;;IACf;MAAwB;;IACxB;MAA+B;;IAC/B;MAAoB;;IACpB;EAEM,aAAa,cAAc,IAAI,CAAC;EAChC,gBAAgB,MAAM,CAAC;EACvB,qBAAqB,eAAe,IAAI,GAAG,SAAS,CAAC;EACr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F,QAAQ,+BAMN;EAEF,QAAQ,mBAuCN;EAEF,QAAQ,2BAyBN;EAEF,QAAQ,uBAA0B;EAElC,QAAQ,kBAiBN;EAEF,QAAQ,qBA0DN;EAEF,QAAQ,2BAIN;EAEF,QAAQ,4BAcN;EAEF,QAAQ,0BAKN;EAEF,QAAQ,yBAoCN;EAEF,QAAQ,6BAIN;EAEF,QAAQ,4BAaN;EAEF,QAAQ,sBAEN;EACF,QAAQ,uBAEN;EACF,QAAQ,uBAEN;EACF,QAAQ,oBAEN;EACF,QAAQ,uBAEN;EAEF,QAAQ,mBAGN;UAEM;EAgBR,QAAQ,0BA+BN;EAEF,QAAQ,wBAGN;EAEF,QAAQ,0BAiBN;UAEM;UAuKA;EAwFR,SAAS,UAAU,wBAAwB;AAiT7C"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"retention.d.ts","sources":["../../../protocol/src/retention.ts"],"names":[],"mappings":"AAAA,OAAO,cAAM,eAAe,MAAM,CAAM;AACxC,OAAO,cAAM,aAAa,MAAM,CAAuC;
|
|
1
|
+
{"version":3,"file":"retention.d.ts","sources":["../../../protocol/src/retention.ts"],"names":[],"mappings":"AAAA,OAAO,cAAM,eAAe,MAAM,CAAM;AACxC,OAAO,cAAM,aAAa,MAAM,CAAuC;AASvE,OAAO,cAAM,2BAA4B,OAAO,OAAO,KAAG,OAAO,CAER"}
|
|
@@ -97,6 +97,7 @@ var resetSeenWebhookMessages = () => {
|
|
|
97
97
|
// protocol/src/retention.ts
|
|
98
98
|
var retentionDays = 30;
|
|
99
99
|
var retentionMs = retentionDays * 24 * 60 * 60 * 1e3;
|
|
100
|
+
var retentionSummary = `Messages and file attachments auto-delete after ${retentionDays} days.`;
|
|
100
101
|
var attachmentExpiredErrorPrefix = "Attachment expired";
|
|
101
102
|
var createAttachmentExpiredError = (status) => new Error(`${attachmentExpiredErrorPrefix} (${status})`);
|
|
102
103
|
var isAttachmentExpiredError = (error) => error instanceof Error && error.message.startsWith(attachmentExpiredErrorPrefix);
|
|
@@ -107,6 +108,8 @@ import stringify2 from "safe-stable-stringify";
|
|
|
107
108
|
|
|
108
109
|
// landing/src/paths.ts
|
|
109
110
|
var chatPath = "/chat";
|
|
111
|
+
var privacyPath = "/privacy";
|
|
112
|
+
var retentionPolicyPath = `${privacyPath}#retention`;
|
|
110
113
|
|
|
111
114
|
// protocol/src/alias.ts
|
|
112
115
|
var normalizeAlias = (alias) => alias.trim().toLowerCase().replace(/\s+/g, "").slice(0, 15);
|
package/components.js
CHANGED
|
@@ -44,7 +44,7 @@ import {
|
|
|
44
44
|
subscribeUserName,
|
|
45
45
|
typingTtl,
|
|
46
46
|
uploadAttachment
|
|
47
|
-
} from "./chunk-
|
|
47
|
+
} from "./chunk-UYJMSQZX.js";
|
|
48
48
|
import {
|
|
49
49
|
actOnCanvas,
|
|
50
50
|
canvasFromRow,
|
|
@@ -482,7 +482,7 @@ var formatMessagePreview = (message) => {
|
|
|
482
482
|
|
|
483
483
|
// lit/core/conversation-previews.ts
|
|
484
484
|
var conversationPreviewsCacheKey = "alicebot_conversation_previews_cache";
|
|
485
|
-
var previewMessagesLimit =
|
|
485
|
+
var previewMessagesLimit = 25;
|
|
486
486
|
var maxPriorityConversations = 40;
|
|
487
487
|
var maxConcurrentFetches = 6;
|
|
488
488
|
var fetchTimeoutMs = 15e3;
|
|
@@ -490,15 +490,69 @@ var typingRefreshIntervalMs = 5e3;
|
|
|
490
490
|
var firstOf = (value) => Array.isArray(value) ? value[0] : value;
|
|
491
491
|
var isRecord = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
|
|
492
492
|
var isEncryptedKeyStr = (value) => typeof value === "string";
|
|
493
|
+
var isValidRecentMessage = (value) => isRecord(value) && typeof value.id === "string" && typeof value.timestamp === "number" && typeof value.authorPublicSignKey === "string";
|
|
493
494
|
var isValidPreview = (value) => isRecord(value) && typeof value.text === "string" && typeof value.timestamp === "number" && typeof value.authorPublicSignKey === "string" && typeof value.updatedAt === "number";
|
|
495
|
+
var sanitizeCachedPreview = (preview, nowMs) => {
|
|
496
|
+
const recentMessages = Array.isArray(preview.recentMessages) ? preview.recentMessages.filter((item) => isValidRecentMessage(item) && !isTimestampExpired(item.timestamp, nowMs)) : void 0;
|
|
497
|
+
return {
|
|
498
|
+
text: preview.text,
|
|
499
|
+
timestamp: preview.timestamp,
|
|
500
|
+
authorPublicSignKey: preview.authorPublicSignKey,
|
|
501
|
+
updatedAt: preview.updatedAt,
|
|
502
|
+
...preview.empty ? {
|
|
503
|
+
empty: true
|
|
504
|
+
} : {},
|
|
505
|
+
...recentMessages ? {
|
|
506
|
+
recentMessages
|
|
507
|
+
} : {},
|
|
508
|
+
...typeof preview.oldestFetchedTimestamp === "number" ? {
|
|
509
|
+
oldestFetchedTimestamp: preview.oldestFetchedTimestamp
|
|
510
|
+
} : {},
|
|
511
|
+
...typeof preview.fetchedFullPage === "boolean" ? {
|
|
512
|
+
fetchedFullPage: preview.fetchedFullPage
|
|
513
|
+
} : {}
|
|
514
|
+
};
|
|
515
|
+
};
|
|
494
516
|
var formatPreviewText = (message) => {
|
|
495
517
|
if (isSilentMessage(message)) return null;
|
|
496
518
|
if (message.type === "call") return "\u{1F4DE} Voice call";
|
|
497
519
|
return formatMessagePreview(message);
|
|
498
520
|
};
|
|
521
|
+
var isCountableUnreadMessage = (message) => !isSilentMessage(message) && message.type !== "edit";
|
|
499
522
|
var sortMessagesDesc = (messages) => [
|
|
500
523
|
...messages
|
|
501
524
|
].sort((a, b) => b.timestamp - a.timestamp);
|
|
525
|
+
var extractRecentMessages = (messages, limit = previewMessagesLimit) => {
|
|
526
|
+
const seen = /* @__PURE__ */ new Set();
|
|
527
|
+
return sortMessagesDesc(messages).filter((m) => {
|
|
528
|
+
if (!isCountableUnreadMessage(m) || seen.has(m.id)) return false;
|
|
529
|
+
seen.add(m.id);
|
|
530
|
+
return true;
|
|
531
|
+
}).slice(0, limit).map((m) => ({
|
|
532
|
+
id: m.id,
|
|
533
|
+
timestamp: m.timestamp,
|
|
534
|
+
authorPublicSignKey: m.publicSignKey
|
|
535
|
+
}));
|
|
536
|
+
};
|
|
537
|
+
var mergeRecentMessages = (existing, incoming, limit = previewMessagesLimit) => {
|
|
538
|
+
const byId = /* @__PURE__ */ new Map();
|
|
539
|
+
(existing ?? []).forEach((m) => byId.set(m.id, m));
|
|
540
|
+
incoming.forEach((m) => byId.set(m.id, m));
|
|
541
|
+
return Array.from(byId.values()).sort((a, b) => b.timestamp - a.timestamp).slice(0, limit);
|
|
542
|
+
};
|
|
543
|
+
var minMessageTimestamp = (messages) => messages.reduce((min, m) => m.timestamp < min ? m.timestamp : min, messages[0]?.timestamp ?? 0);
|
|
544
|
+
var withRecentMetadata = ({ preview, recentMessages, oldestFetchedTimestamp, fetchedFullPage }) => ({
|
|
545
|
+
...preview,
|
|
546
|
+
...nonempty(recentMessages) ? {
|
|
547
|
+
recentMessages
|
|
548
|
+
} : {},
|
|
549
|
+
...oldestFetchedTimestamp !== void 0 && oldestFetchedTimestamp > 0 ? {
|
|
550
|
+
oldestFetchedTimestamp
|
|
551
|
+
} : {},
|
|
552
|
+
...fetchedFullPage !== void 0 ? {
|
|
553
|
+
fetchedFullPage
|
|
554
|
+
} : {}
|
|
555
|
+
});
|
|
502
556
|
var extractLatestPreview = (messages, updatedAt) => {
|
|
503
557
|
const match = sortMessagesDesc(messages).find((m) => formatPreviewText(m) !== null);
|
|
504
558
|
if (!match) {
|
|
@@ -676,7 +730,10 @@ var readCachedConversationPreviews = (publicSignKey, nowMs = Date.now()) => {
|
|
|
676
730
|
if (!isRecord(parsed) || parsed.publicSignKey !== publicSignKey || !isRecord(parsed.previews)) {
|
|
677
731
|
return {};
|
|
678
732
|
}
|
|
679
|
-
return Object.fromEntries(Object.entries(parsed.previews).filter((entry) => isValidPreview(entry[1]) && (entry[1].empty === true || !isTimestampExpired(entry[1].timestamp, nowMs))))
|
|
733
|
+
return Object.fromEntries(Object.entries(parsed.previews).filter((entry) => isValidPreview(entry[1]) && (entry[1].empty === true || !isTimestampExpired(entry[1].timestamp, nowMs))).map(([convId, preview]) => [
|
|
734
|
+
convId,
|
|
735
|
+
sanitizeCachedPreview(preview, nowMs)
|
|
736
|
+
]));
|
|
680
737
|
} catch {
|
|
681
738
|
return {};
|
|
682
739
|
}
|
|
@@ -735,7 +792,13 @@ var decryptMessagesList = (conversationId, conversationKey, rawMessages) => {
|
|
|
735
792
|
});
|
|
736
793
|
return Promise.all(rawMessages.map(decryptOne)).then((results) => results.filter((m) => m !== void 0));
|
|
737
794
|
};
|
|
738
|
-
var
|
|
795
|
+
var sameRecentMessages = (a, b) => {
|
|
796
|
+
const listA = a ?? [];
|
|
797
|
+
const listB = b ?? [];
|
|
798
|
+
if (listA.length !== listB.length) return false;
|
|
799
|
+
return listA.every((item, idx) => item.id === listB[idx].id && item.timestamp === listB[idx].timestamp && item.authorPublicSignKey === listB[idx].authorPublicSignKey);
|
|
800
|
+
};
|
|
801
|
+
var samePreview = (a, b) => a !== void 0 && a.text === b.text && a.timestamp === b.timestamp && a.authorPublicSignKey === b.authorPublicSignKey && a.updatedAt === b.updatedAt && Boolean(a.empty) === Boolean(b.empty) && Boolean(a.fetchedFullPage) === Boolean(b.fetchedFullPage) && a.oldestFetchedTimestamp === b.oldestFetchedTimestamp && sameRecentMessages(a.recentMessages, b.recentMessages);
|
|
739
802
|
var makeCreateConversationPreviewsManager = ({ subscribeKeys, fetchLatestMessages, keyStore = defaultPushKeyStore, readCache = readCachedConversationPreviews, writeCache = writeCachedConversationPreviews, maxConcurrency = maxConcurrentFetches, maxConversations = maxPriorityConversations }) => (credentials, onChange) => {
|
|
740
803
|
const { publicSignKey, privateEncryptKey } = credentials;
|
|
741
804
|
const previews = {
|
|
@@ -809,7 +872,12 @@ var makeCreateConversationPreviewsManager = ({ subscribeKeys, fetchLatestMessage
|
|
|
809
872
|
if (state.cancelled) return;
|
|
810
873
|
const prev = previews[conversationId];
|
|
811
874
|
if (prev && prev.updatedAt > current.updatedAt) return;
|
|
812
|
-
applyPreview(conversationId,
|
|
875
|
+
applyPreview(conversationId, withRecentMetadata({
|
|
876
|
+
preview: extractLatestPreview(decrypted, current.updatedAt),
|
|
877
|
+
recentMessages: extractRecentMessages(decrypted),
|
|
878
|
+
oldestFetchedTimestamp: minMessageTimestamp(current.messages),
|
|
879
|
+
fetchedFullPage: current.messages.length >= previewMessagesLimit
|
|
880
|
+
}));
|
|
813
881
|
});
|
|
814
882
|
});
|
|
815
883
|
};
|
|
@@ -861,12 +929,16 @@ var makeCreateConversationPreviewsManager = ({ subscribeKeys, fetchLatestMessage
|
|
|
861
929
|
if (state.cancelled) return;
|
|
862
930
|
checkedInSession.add(conversationId);
|
|
863
931
|
const effectiveUpdatedAt = Math.max(updatedAt ?? 0, knownUpdatedAt.get(conversationId) ?? 0, messages[0]?.timestamp ?? 0, previews[conversationId]?.updatedAt ?? 0);
|
|
864
|
-
const
|
|
932
|
+
const basePreview = extractLatestPreview(messages, effectiveUpdatedAt);
|
|
865
933
|
const existing = previews[conversationId];
|
|
866
|
-
if (
|
|
867
|
-
if (!
|
|
934
|
+
if (basePreview.empty && existing && !existing.empty) return;
|
|
935
|
+
if (!basePreview.empty && existing && !existing.empty && existing.timestamp > basePreview.timestamp) {
|
|
868
936
|
return;
|
|
869
937
|
}
|
|
938
|
+
const nextPreview = withRecentMetadata({
|
|
939
|
+
preview: basePreview,
|
|
940
|
+
recentMessages: extractRecentMessages(messages)
|
|
941
|
+
});
|
|
870
942
|
applyPreview(conversationId, nextPreview);
|
|
871
943
|
};
|
|
872
944
|
liveMessagesListeners.add(onLiveMessages);
|
|
@@ -883,10 +955,16 @@ var makeCreateConversationPreviewsManager = ({ subscribeKeys, fetchLatestMessage
|
|
|
883
955
|
dbMsg
|
|
884
956
|
]).then((decrypted) => {
|
|
885
957
|
if (state.cancelled || empty(decrypted)) return;
|
|
886
|
-
const
|
|
887
|
-
if (
|
|
958
|
+
const basePreview = extractLatestPreview(decrypted, Math.max(message.timestamp, knownUpdatedAt.get(conversationId) ?? 0));
|
|
959
|
+
if (basePreview.empty) return;
|
|
888
960
|
const existing = previews[conversationId];
|
|
889
|
-
if (existing && existing.timestamp >
|
|
961
|
+
if (existing && existing.timestamp > basePreview.timestamp) return;
|
|
962
|
+
const nextPreview = withRecentMetadata({
|
|
963
|
+
preview: basePreview,
|
|
964
|
+
recentMessages: mergeRecentMessages(existing?.recentMessages, extractRecentMessages(decrypted)),
|
|
965
|
+
oldestFetchedTimestamp: existing?.oldestFetchedTimestamp,
|
|
966
|
+
fetchedFullPage: existing?.fetchedFullPage
|
|
967
|
+
});
|
|
890
968
|
applyPreview(conversationId, nextPreview);
|
|
891
969
|
});
|
|
892
970
|
});
|
|
@@ -930,6 +1008,160 @@ var createConversationPreviewsManager = makeCreateConversationPreviewsManager({
|
|
|
930
1008
|
fetchLatestMessages: queryLatestMessagesOnce
|
|
931
1009
|
});
|
|
932
1010
|
|
|
1011
|
+
// lit/core/unread-state.ts
|
|
1012
|
+
var unreadStateStorageKey = "alicebot_unread_state";
|
|
1013
|
+
var isRecord2 = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
|
|
1014
|
+
var parseNumberRecord = (value) => isRecord2(value) ? Object.fromEntries(Object.entries(value).filter((entry) => typeof entry[1] === "number" && Number.isFinite(entry[1]))) : {};
|
|
1015
|
+
var parseTrueRecord = (value) => isRecord2(value) ? Object.fromEntries(Object.entries(value).filter((entry) => entry[1] === true).map(([k]) => [
|
|
1016
|
+
k,
|
|
1017
|
+
true
|
|
1018
|
+
])) : {};
|
|
1019
|
+
var parseStoredUnreadState = (raw, publicSignKey) => {
|
|
1020
|
+
if (!raw) return null;
|
|
1021
|
+
try {
|
|
1022
|
+
const parsed = JSON.parse(raw);
|
|
1023
|
+
if (!isRecord2(parsed) || parsed.publicSignKey !== publicSignKey || typeof parsed.initializedAt !== "number" || !Number.isFinite(parsed.initializedAt)) {
|
|
1024
|
+
return null;
|
|
1025
|
+
}
|
|
1026
|
+
return {
|
|
1027
|
+
publicSignKey,
|
|
1028
|
+
initializedAt: parsed.initializedAt,
|
|
1029
|
+
lastReadAt: parseNumberRecord(parsed.lastReadAt),
|
|
1030
|
+
markedUnread: parseTrueRecord(parsed.markedUnread)
|
|
1031
|
+
};
|
|
1032
|
+
} catch {
|
|
1033
|
+
return null;
|
|
1034
|
+
}
|
|
1035
|
+
};
|
|
1036
|
+
var readUnreadState = (publicSignKey) => {
|
|
1037
|
+
try {
|
|
1038
|
+
return parseStoredUnreadState(globalThis.localStorage?.getItem(unreadStateStorageKey), publicSignKey);
|
|
1039
|
+
} catch {
|
|
1040
|
+
return null;
|
|
1041
|
+
}
|
|
1042
|
+
};
|
|
1043
|
+
var writeUnreadState = (state) => {
|
|
1044
|
+
try {
|
|
1045
|
+
if (!globalThis.localStorage?.getItem("alicebot_credentials")) return;
|
|
1046
|
+
globalThis.localStorage.setItem(unreadStateStorageKey, JSON.stringify(state));
|
|
1047
|
+
} catch {
|
|
1048
|
+
}
|
|
1049
|
+
};
|
|
1050
|
+
var seedUnreadState = (state, publicSignKey, conversations, nowMs = Date.now()) => {
|
|
1051
|
+
if (state && state.publicSignKey === publicSignKey) return state;
|
|
1052
|
+
const lastReadAt = Object.fromEntries(conversations.map((conv) => [
|
|
1053
|
+
conv.id,
|
|
1054
|
+
conv.updatedAt && conv.updatedAt > 0 ? conv.updatedAt : nowMs
|
|
1055
|
+
]));
|
|
1056
|
+
return {
|
|
1057
|
+
publicSignKey,
|
|
1058
|
+
initializedAt: nowMs,
|
|
1059
|
+
lastReadAt,
|
|
1060
|
+
markedUnread: {}
|
|
1061
|
+
};
|
|
1062
|
+
};
|
|
1063
|
+
var latestKnownConversationTimestamp = (conversation, preview) => Math.max(conversation?.updatedAt ?? 0, preview?.timestamp ?? 0, preview?.updatedAt ?? 0, preview?.recentMessages?.[0]?.timestamp ?? 0);
|
|
1064
|
+
var markConversationRead = (state, conversationId, readUpToTimestamp) => {
|
|
1065
|
+
const prevReadAt = state.lastReadAt[conversationId];
|
|
1066
|
+
const nextReadAt = Math.max(prevReadAt ?? 0, readUpToTimestamp);
|
|
1067
|
+
const wasMarked = Boolean(state.markedUnread[conversationId]);
|
|
1068
|
+
if (prevReadAt === nextReadAt && !wasMarked) return state;
|
|
1069
|
+
const { [conversationId]: _removed, ...restMarked } = state.markedUnread;
|
|
1070
|
+
return {
|
|
1071
|
+
...state,
|
|
1072
|
+
lastReadAt: {
|
|
1073
|
+
...state.lastReadAt,
|
|
1074
|
+
[conversationId]: nextReadAt
|
|
1075
|
+
},
|
|
1076
|
+
markedUnread: restMarked
|
|
1077
|
+
};
|
|
1078
|
+
};
|
|
1079
|
+
var computeConversationUnread = ({ conversationId, preview, selfPublicSignKey, state, isActivelyViewing }) => {
|
|
1080
|
+
const manuallyMarked = Boolean(state?.markedUnread[conversationId]);
|
|
1081
|
+
const baseReadAt = state && conversationId in state.lastReadAt ? state.lastReadAt[conversationId] : state?.initializedAt ?? 0;
|
|
1082
|
+
if (isActivelyViewing) {
|
|
1083
|
+
return {
|
|
1084
|
+
isUnread: manuallyMarked,
|
|
1085
|
+
count: 0,
|
|
1086
|
+
overflow: false,
|
|
1087
|
+
markedUnread: manuallyMarked,
|
|
1088
|
+
effectiveReadAt: baseReadAt
|
|
1089
|
+
};
|
|
1090
|
+
}
|
|
1091
|
+
if (!preview || preview.empty) {
|
|
1092
|
+
return {
|
|
1093
|
+
isUnread: manuallyMarked,
|
|
1094
|
+
count: 0,
|
|
1095
|
+
overflow: false,
|
|
1096
|
+
markedUnread: manuallyMarked,
|
|
1097
|
+
effectiveReadAt: baseReadAt
|
|
1098
|
+
};
|
|
1099
|
+
}
|
|
1100
|
+
if (preview.recentMessages && nonempty(preview.recentMessages)) {
|
|
1101
|
+
const latestSelfTs = preview.recentMessages.reduce((max2, msg) => msg.authorPublicSignKey === selfPublicSignKey && msg.timestamp > max2 ? msg.timestamp : max2, 0);
|
|
1102
|
+
const effectiveReadAt = Math.max(baseReadAt, latestSelfTs);
|
|
1103
|
+
const count2 = preview.recentMessages.filter((msg) => msg.authorPublicSignKey !== selfPublicSignKey && msg.timestamp > effectiveReadAt).length;
|
|
1104
|
+
const overflow = count2 > 0 && Boolean(preview.fetchedFullPage) && (preview.oldestFetchedTimestamp ?? 0) > effectiveReadAt;
|
|
1105
|
+
return {
|
|
1106
|
+
isUnread: count2 > 0 || manuallyMarked,
|
|
1107
|
+
count: count2,
|
|
1108
|
+
overflow,
|
|
1109
|
+
markedUnread: manuallyMarked,
|
|
1110
|
+
effectiveReadAt
|
|
1111
|
+
};
|
|
1112
|
+
}
|
|
1113
|
+
if (preview.authorPublicSignKey === selfPublicSignKey) {
|
|
1114
|
+
return {
|
|
1115
|
+
isUnread: manuallyMarked,
|
|
1116
|
+
count: 0,
|
|
1117
|
+
overflow: false,
|
|
1118
|
+
markedUnread: manuallyMarked,
|
|
1119
|
+
effectiveReadAt: Math.max(baseReadAt, preview.timestamp)
|
|
1120
|
+
};
|
|
1121
|
+
}
|
|
1122
|
+
if (preview.timestamp > baseReadAt) {
|
|
1123
|
+
return {
|
|
1124
|
+
isUnread: true,
|
|
1125
|
+
count: 1,
|
|
1126
|
+
overflow: false,
|
|
1127
|
+
markedUnread: manuallyMarked,
|
|
1128
|
+
effectiveReadAt: baseReadAt
|
|
1129
|
+
};
|
|
1130
|
+
}
|
|
1131
|
+
return {
|
|
1132
|
+
isUnread: manuallyMarked,
|
|
1133
|
+
count: 0,
|
|
1134
|
+
overflow: false,
|
|
1135
|
+
markedUnread: manuallyMarked,
|
|
1136
|
+
effectiveReadAt: baseReadAt
|
|
1137
|
+
};
|
|
1138
|
+
};
|
|
1139
|
+
var formatUnreadBadgeLabel = (count2, overflow = false) => {
|
|
1140
|
+
if (count2 <= 0) return "";
|
|
1141
|
+
if (count2 > 99) return "99+";
|
|
1142
|
+
return overflow ? `${count2}+` : String(count2);
|
|
1143
|
+
};
|
|
1144
|
+
var findUnreadDividerInfo = (messages, userId, unreadDividerAfterTimestamp) => {
|
|
1145
|
+
if (unreadDividerAfterTimestamp === void 0) return null;
|
|
1146
|
+
const unread = messages.filter((m) => m.authorId !== userId && m.timestamp > unreadDividerAfterTimestamp);
|
|
1147
|
+
if (!nonempty(unread)) return null;
|
|
1148
|
+
return {
|
|
1149
|
+
firstUnreadMessageId: unread[0].id,
|
|
1150
|
+
count: unread.length
|
|
1151
|
+
};
|
|
1152
|
+
};
|
|
1153
|
+
var subscribeUnreadStateStorage = (publicSignKey, onChange) => {
|
|
1154
|
+
if (typeof globalThis.addEventListener !== "function") return () => {
|
|
1155
|
+
};
|
|
1156
|
+
const handler = (event) => {
|
|
1157
|
+
if (event.key !== unreadStateStorageKey) return;
|
|
1158
|
+
const next = parseStoredUnreadState(event.newValue, publicSignKey);
|
|
1159
|
+
if (next) onChange(next);
|
|
1160
|
+
};
|
|
1161
|
+
globalThis.addEventListener("storage", handler);
|
|
1162
|
+
return () => globalThis.removeEventListener("storage", handler);
|
|
1163
|
+
};
|
|
1164
|
+
|
|
933
1165
|
// lit/core/voice-call.ts
|
|
934
1166
|
var defaultStunServers = [
|
|
935
1167
|
{
|
|
@@ -7510,6 +7742,22 @@ var pruneOptimistic = (messages, optimistic, userId) => {
|
|
|
7510
7742
|
const remaining = optimistic.filter((o) => !realTexts.has(o.text));
|
|
7511
7743
|
return remaining.length === optimistic.length ? optimistic : remaining;
|
|
7512
7744
|
};
|
|
7745
|
+
var unreadDividerRowStyle = "display:flex;align-items:center;gap:10px;margin:8px 0 4px;width:100%";
|
|
7746
|
+
var unreadDividerLineStyle = (isDark) => `flex:1;height:1px;background:${isDark ? "rgba(255,255,255,0.12)" : "rgba(24,23,21,0.11)"}`;
|
|
7747
|
+
var unreadDividerPillStyle = (isDark) => `font-size:11px;font-weight:600;letter-spacing:0.01em;padding:3px 10px;border-radius:9999px;white-space:nowrap;background:${isDark ? "rgba(125,162,207,0.16)" : "rgba(57,88,127,0.10)"};color:${isDark ? "#9cc0eb" : "#39587f"};border:1px solid ${isDark ? "rgba(125,162,207,0.28)" : "rgba(57,88,127,0.18)"}`;
|
|
7748
|
+
var backUnreadBadgeStyle = (isDark) => `display:inline-flex;align-items:center;justify-content:center;min-width:18px;height:18px;padding:0 5px;margin-left:-4px;margin-right:4px;border-radius:9999px;border:none;cursor:pointer;font-size:11px;font-weight:700;line-height:1;font-variant-numeric:tabular-nums;background:${isDark ? "#7da2cf" : "#39587f"};color:${isDark ? "#111110" : "#ffffff"};flex-shrink:0`;
|
|
7749
|
+
var renderUnreadMessagesDivider = (count2, isDark) => html9`
|
|
7750
|
+
<div
|
|
7751
|
+
data-testid="unread-messages-divider"
|
|
7752
|
+
role="separator"
|
|
7753
|
+
aria-label="${count2 === 1 ? "1 unread message" : `${count2} unread messages`}"
|
|
7754
|
+
style="${unreadDividerRowStyle}"
|
|
7755
|
+
>
|
|
7756
|
+
<span style="${unreadDividerLineStyle(isDark)}"></span>
|
|
7757
|
+
<span style="${unreadDividerPillStyle(isDark)}">${count2 === 1 ? "1 unread message" : `${count2} unread messages`}</span>
|
|
7758
|
+
<span style="${unreadDividerLineStyle(isDark)}"></span>
|
|
7759
|
+
</div>
|
|
7760
|
+
`;
|
|
7513
7761
|
var ChatBox = class extends LitElement8 {
|
|
7514
7762
|
static properties = {
|
|
7515
7763
|
messages: {
|
|
@@ -7635,6 +7883,12 @@ var ChatBox = class extends LitElement8 {
|
|
|
7635
7883
|
participants: {
|
|
7636
7884
|
type: Array
|
|
7637
7885
|
},
|
|
7886
|
+
unreadDividerAfterTimestamp: {
|
|
7887
|
+
attribute: false
|
|
7888
|
+
},
|
|
7889
|
+
otherUnreadCount: {
|
|
7890
|
+
type: Number
|
|
7891
|
+
},
|
|
7638
7892
|
_input: {
|
|
7639
7893
|
state: true
|
|
7640
7894
|
},
|
|
@@ -7716,6 +7970,7 @@ var ChatBox = class extends LitElement8 {
|
|
|
7716
7970
|
this.voiceCallState = "idle";
|
|
7717
7971
|
this.voiceCallDuration = 0;
|
|
7718
7972
|
this.voiceCallMuted = false;
|
|
7973
|
+
this.otherUnreadCount = 0;
|
|
7719
7974
|
this.activeSpinners = [];
|
|
7720
7975
|
this.activeProgress = [];
|
|
7721
7976
|
this.activeStreams = [];
|
|
@@ -8772,6 +9027,7 @@ var ChatBox = class extends LitElement8 {
|
|
|
8772
9027
|
const allMsgs = allMessagesFrom(this.messages, this._optimisticMessages, this.userId);
|
|
8773
9028
|
const timeline = timelineWithTransientEvents(allMsgs, this.activeSpinners, this.activeProgress, this.activeStreams, this.typingUsers);
|
|
8774
9029
|
const quickReplyEntryId = activeQuickReplyEntryId(timeline, this._isSending);
|
|
9030
|
+
const unreadDivider = findUnreadDividerInfo(allMsgs, this.userId, this.unreadDividerAfterTimestamp);
|
|
8775
9031
|
const hasContent = !!this._input.trim() || this._pendingFiles.length > 0;
|
|
8776
9032
|
const showMic = this.enableAudioRecording && !hasContent && !this._isRecording;
|
|
8777
9033
|
const showStop = this._isRecording && !this._isRecordingLocked;
|
|
@@ -8965,6 +9221,17 @@ var ChatBox = class extends LitElement8 {
|
|
|
8965
9221
|
>
|
|
8966
9222
|
${faArrowLeft}
|
|
8967
9223
|
</button>
|
|
9224
|
+
${this.otherUnreadCount > 0 ? html9`
|
|
9225
|
+
<button
|
|
9226
|
+
type="button"
|
|
9227
|
+
data-testid="back-unread-badge"
|
|
9228
|
+
@click="${this.onBack}"
|
|
9229
|
+
aria-label="${this.otherUnreadCount === 1 ? "1 unread chat" : `${this.otherUnreadCount} unread chats`}"
|
|
9230
|
+
style="${backUnreadBadgeStyle(isDark)}"
|
|
9231
|
+
>
|
|
9232
|
+
${this.otherUnreadCount > 99 ? "99+" : this.otherUnreadCount}
|
|
9233
|
+
</button>
|
|
9234
|
+
` : nothing4}
|
|
8968
9235
|
` : nothing4}
|
|
8969
9236
|
<div style="flex:1;display:flex;justify-content:center;min-width:0;overflow:hidden">
|
|
8970
9237
|
${this._isEditingTitle ? html9`
|
|
@@ -9100,7 +9367,7 @@ var ChatBox = class extends LitElement8 {
|
|
|
9100
9367
|
}
|
|
9101
9368
|
if (entry.kind === "stream") return entry.stream.elementId;
|
|
9102
9369
|
return "typing";
|
|
9103
|
-
}, (entry) => this._renderTimelineEntry(entry, customColors, isDark, quickReplyEntryId))} ${this._isSending ? sendingIndicator(sendingStatusText(this._sendingType), customColors?.primary ?? defaultPrimary(isDark), isDark) : nothing4}
|
|
9370
|
+
}, (entry) => this._renderTimelineEntry(entry, customColors, isDark, quickReplyEntryId, unreadDivider))} ${this._isSending ? sendingIndicator(sendingStatusText(this._sendingType), customColors?.primary ?? defaultPrimary(isDark), isDark) : nothing4}
|
|
9104
9371
|
`}
|
|
9105
9372
|
</div>
|
|
9106
9373
|
</div>
|
|
@@ -9394,10 +9661,12 @@ var ChatBox = class extends LitElement8 {
|
|
|
9394
9661
|
</div>
|
|
9395
9662
|
`;
|
|
9396
9663
|
}
|
|
9397
|
-
_renderMessageEntry(entry, quickReplyEntryId) {
|
|
9664
|
+
_renderMessageEntry(entry, quickReplyEntryId, unreadDivider) {
|
|
9398
9665
|
const isDark = this._effectiveDark;
|
|
9399
9666
|
const { customColors } = this;
|
|
9667
|
+
const showUnreadDivider = unreadDivider !== null && entry.msg.id === unreadDivider.firstUnreadMessageId;
|
|
9400
9668
|
return html9`
|
|
9669
|
+
${showUnreadDivider ? renderUnreadMessagesDivider(unreadDivider.count, isDark) : nothing4}
|
|
9401
9670
|
<chat-message
|
|
9402
9671
|
.msg="${entry.msg}"
|
|
9403
9672
|
.prev="${entry.prevMsg}"
|
|
@@ -9420,9 +9689,9 @@ var ChatBox = class extends LitElement8 {
|
|
|
9420
9689
|
></chat-message>
|
|
9421
9690
|
`;
|
|
9422
9691
|
}
|
|
9423
|
-
_renderTimelineEntry(entry, customColors, isDark, quickReplyEntryId) {
|
|
9692
|
+
_renderTimelineEntry(entry, customColors, isDark, quickReplyEntryId, unreadDivider) {
|
|
9424
9693
|
if (entry.kind === "message") {
|
|
9425
|
-
return this._renderMessageEntry(entry, quickReplyEntryId);
|
|
9694
|
+
return this._renderMessageEntry(entry, quickReplyEntryId, unreadDivider);
|
|
9426
9695
|
}
|
|
9427
9696
|
if (entry.kind === "spinner") {
|
|
9428
9697
|
return renderSpinnerIndicator(entry.spinner, isDark, customColors?.hideNames, this.isGroupChat, customColors?.text);
|
|
@@ -9670,10 +9939,13 @@ var sidebarInlineRenameInputStyle = (isDark) => `width:100%;box-sizing:border-bo
|
|
|
9670
9939
|
var sidebarRenameButtonStyle = (isDark, customColors) => `background:transparent;border:none;cursor:pointer;padding:6px;border-radius:6px;color:${customColors?.text ?? (isDark ? "#9ca3af" : "#6b7280")};display:flex;align-items:center;justify-content:center;font-size:12px;transition:opacity 0.15s,background 0.15s;flex-shrink:0`;
|
|
9671
9940
|
var sidebarItemBodyStyle = "flex:1;min-width:0;display:flex;flex-direction:column;gap:2px";
|
|
9672
9941
|
var sidebarItemTopRowStyle = "display:flex;align-items:center;justify-content:space-between;gap:8px;min-width:0;min-height:18px";
|
|
9673
|
-
var sidebarItemTimeStyle = (isDark) => `font-size:11px;line-height:18px;flex-shrink:0;color:${isDark ? "#78736a" : "#8c867c"}`;
|
|
9674
|
-
var
|
|
9675
|
-
var
|
|
9942
|
+
var sidebarItemTimeStyle = (isDark, isUnread = false) => `font-size:11px;line-height:18px;flex-shrink:0;font-variant-numeric:tabular-nums;font-weight:${isUnread ? "600" : "400"};color:${isUnread ? isDark ? "#7da2cf" : "#39587f" : isDark ? "#78736a" : "#8c867c"}`;
|
|
9943
|
+
var sidebarItemBottomRowStyle = "display:flex;align-items:center;justify-content:space-between;gap:8px;min-width:0";
|
|
9944
|
+
var sidebarItemPreviewRowStyle = "font-size:12px;line-height:15px;min-height:15px;height:15px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;flex:1;min-width:0";
|
|
9945
|
+
var sidebarItemPreviewStyle = (isDark, isUnread = false) => `${sidebarItemPreviewRowStyle};font-weight:${isUnread ? "500" : "400"};color:${isUnread ? isDark ? "#e7e5df" : "#2c2a26" : isDark ? "#9c968c" : "#66625b"}`;
|
|
9676
9946
|
var sidebarItemTypingStyle = (isDark) => `${sidebarItemPreviewRowStyle};font-weight:500;color:${isDark ? "#7da2cf" : "#39587f"}`;
|
|
9947
|
+
var sidebarUnreadBadgeStyle = (isDark) => `display:inline-flex;align-items:center;justify-content:center;min-width:18px;height:18px;padding:0 5px;border-radius:9999px;font-size:11px;font-weight:700;line-height:1;font-variant-numeric:tabular-nums;flex-shrink:0;background:${isDark ? "#7da2cf" : "#39587f"};color:${isDark ? "#111110" : "#ffffff"}`;
|
|
9948
|
+
var sidebarUnreadDotStyle = (isDark) => `display:inline-block;width:9px;height:9px;border-radius:9999px;flex-shrink:0;background:${isDark ? "#7da2cf" : "#39587f"}`;
|
|
9677
9949
|
var sidebarHoverStyles = `
|
|
9678
9950
|
.alice-sidebar-rename-btn { opacity: 0.6; }
|
|
9679
9951
|
.alice-sidebar-desktop .alice-sidebar-item .alice-sidebar-rename-btn { opacity: 0; pointer-events: none; }
|
|
@@ -9807,7 +10079,7 @@ var sidebarHeaderStyle = (isDark) => `padding:12px 14px;border-bottom:1px solid
|
|
|
9807
10079
|
var sidebarSearchInputStyle = (isDark, customColors) => `width:100%;padding:8px 12px;border-radius:8px;font-size:13px;outline:none;border:1px solid ${inputBorderColor(isDark, customColors)};background:${customColors?.inputBackground ?? defaultInputBackground(isDark)};color:${customColors?.inputBackground ? inputTextColor(isDark, customColors) : customColors?.text ?? (isDark ? "#f4f4f4" : "#111827")};box-sizing:border-box`;
|
|
9808
10080
|
var sidebarListStyle = (scrollbarColor) => `flex:1;min-height:0;overflow-y:auto;padding:6px 8px;display:flex;flex-direction:column;gap:2px;${scrollbarColor ? `scrollbar-color:${scrollbarColor};` : ""}`;
|
|
9809
10081
|
var sidebarItemStyle = (isSelected, isDark, customColors) => `display:flex;align-items:center;gap:10px;padding:8px 10px;width:100%;text-align:left;background:${isSelected ? isDark ? "rgba(255,255,255,0.08)" : "rgba(0,0,0,0.06)" : "transparent"};border:none;border-left:3px solid ${isSelected ? customColors?.primary ?? defaultPrimary(isDark) : "transparent"};border-radius:8px;cursor:pointer;transition:background 0.15s;box-sizing:border-box;outline:none`;
|
|
9810
|
-
var sidebarItemTitleStyle = (isDark, isSelected, customColors) => `font-size:13px;line-height:18px;font-weight:${isSelected ? "600" : "500"};color:${customColors?.text ?? (isDark ? "#f4f4f4" : "#111827")};white-space:nowrap;overflow:hidden;text-overflow:ellipsis;flex:1;min-width:0`;
|
|
10082
|
+
var sidebarItemTitleStyle = (isDark, isSelected, customColors, isUnread = false) => `font-size:13px;line-height:18px;font-weight:${isSelected || isUnread ? "600" : "500"};color:${customColors?.text ?? (isDark ? "#f4f4f4" : "#111827")};white-space:nowrap;overflow:hidden;text-overflow:ellipsis;flex:1;min-width:0`;
|
|
9811
10083
|
var mobileBackButtonStyle = (isDark, customColors) => `position:absolute;top:10px;left:10px;z-index:90;display:flex;align-items:center;gap:6px;padding:6px 12px;border-radius:18px;background:${isDark ? "rgba(30,30,30,0.9)" : "rgba(255,255,255,0.9)"};color:${customColors?.text ?? (isDark ? "#f4f4f4" : "#111827")};border:1px solid ${isDark ? "#444" : "#e5e7eb"};box-shadow:0 2px 8px rgba(0,0,0,0.15);cursor:pointer;font-size:12px;font-weight:600;backdrop-filter:blur(4px)`;
|
|
9812
10084
|
var mobileFullListStyle = (isDark, customColors) => `display:flex;flex-direction:column;width:100%;height:100%;min-height:0;background:${customColors?.background ?? (isDark ? "#111110" : "#f6f4ee")};font-family:sans-serif;box-sizing:border-box`;
|
|
9813
10085
|
var mainChatContainerStyle = "display:flex;flex-direction:column;flex:1;min-width:0;min-height:0;overflow:hidden;position:relative";
|
|
@@ -9958,6 +10230,12 @@ var ConnectedChat = class extends LitElement10 {
|
|
|
9958
10230
|
},
|
|
9959
10231
|
onConversationChange: {
|
|
9960
10232
|
attribute: false
|
|
10233
|
+
},
|
|
10234
|
+
unreadDividerAfterTimestamp: {
|
|
10235
|
+
attribute: false
|
|
10236
|
+
},
|
|
10237
|
+
otherUnreadCount: {
|
|
10238
|
+
type: Number
|
|
9961
10239
|
}
|
|
9962
10240
|
};
|
|
9963
10241
|
constructor() {
|
|
@@ -9970,6 +10248,7 @@ var ConnectedChat = class extends LitElement10 {
|
|
|
9970
10248
|
this.enableChatSwitching = false;
|
|
9971
10249
|
this.disableAutoFocus = false;
|
|
9972
10250
|
this.isDark = false;
|
|
10251
|
+
this.otherUnreadCount = 0;
|
|
9973
10252
|
}
|
|
9974
10253
|
_activeConversationId = "";
|
|
9975
10254
|
_subscribedConversationId = "";
|
|
@@ -9978,6 +10257,9 @@ var ConnectedChat = class extends LitElement10 {
|
|
|
9978
10257
|
_conversations = null;
|
|
9979
10258
|
_conversationPreviews = {};
|
|
9980
10259
|
_typingByConversation = {};
|
|
10260
|
+
_unreadState = null;
|
|
10261
|
+
_unreadStorageUnsub = null;
|
|
10262
|
+
_internalUnreadDividerAfterTimestamp = void 0;
|
|
9981
10263
|
_searchQuery = "";
|
|
9982
10264
|
_nameCache = /* @__PURE__ */ new Map();
|
|
9983
10265
|
_nameUnsubs = /* @__PURE__ */ new Map();
|
|
@@ -10042,6 +10324,8 @@ var ConnectedChat = class extends LitElement10 {
|
|
|
10042
10324
|
this._activeConversationId = this.conversationId;
|
|
10043
10325
|
this.addEventListener("click", this._handleClick);
|
|
10044
10326
|
globalThis.addEventListener("keydown", this._handleGlobalKeydown);
|
|
10327
|
+
globalThis.addEventListener("focus", this._handleVisibilityOrFocus);
|
|
10328
|
+
globalThis.document?.addEventListener("visibilitychange", this._handleVisibilityOrFocus);
|
|
10045
10329
|
if (this.enableChatSwitching) {
|
|
10046
10330
|
this._responsiveUnsub = subscribeIsMobile((m) => {
|
|
10047
10331
|
this._isMobile = m;
|
|
@@ -10054,6 +10338,8 @@ var ConnectedChat = class extends LitElement10 {
|
|
|
10054
10338
|
super.disconnectedCallback();
|
|
10055
10339
|
this.removeEventListener("click", this._handleClick);
|
|
10056
10340
|
globalThis.removeEventListener("keydown", this._handleGlobalKeydown);
|
|
10341
|
+
globalThis.removeEventListener("focus", this._handleVisibilityOrFocus);
|
|
10342
|
+
globalThis.document?.removeEventListener("visibilitychange", this._handleVisibilityOrFocus);
|
|
10057
10343
|
this._teardown();
|
|
10058
10344
|
}
|
|
10059
10345
|
get _effectiveDark() {
|
|
@@ -10144,6 +10430,10 @@ var ConnectedChat = class extends LitElement10 {
|
|
|
10144
10430
|
this._previewsManager = null;
|
|
10145
10431
|
this._allTypingUnsub?.();
|
|
10146
10432
|
this._allTypingUnsub = null;
|
|
10433
|
+
this._unreadStorageUnsub?.();
|
|
10434
|
+
this._unreadStorageUnsub = null;
|
|
10435
|
+
this._unreadState = null;
|
|
10436
|
+
this._internalUnreadDividerAfterTimestamp = void 0;
|
|
10147
10437
|
this._conversationPreviews = {};
|
|
10148
10438
|
this._typingByConversation = {};
|
|
10149
10439
|
this._chatListCredentials = null;
|
|
@@ -10170,6 +10460,31 @@ var ConnectedChat = class extends LitElement10 {
|
|
|
10170
10460
|
}
|
|
10171
10461
|
this._setupConversationSubscriptions();
|
|
10172
10462
|
}
|
|
10463
|
+
_isConversationVisiblyOpen(conversationId) {
|
|
10464
|
+
if (!this.enableChatSwitching) return false;
|
|
10465
|
+
if (this._isMobile && this._mobileShowList) return false;
|
|
10466
|
+
if (globalThis.document?.visibilityState === "hidden") return false;
|
|
10467
|
+
const currentId = this._activeConversationId || this.conversationId;
|
|
10468
|
+
return currentId === conversationId;
|
|
10469
|
+
}
|
|
10470
|
+
_markConversationReadIfNeeded(conversationId) {
|
|
10471
|
+
if (!this._unreadState || !conversationId) return;
|
|
10472
|
+
const conv = this._conversations?.find((c) => c.id === conversationId);
|
|
10473
|
+
const preview = this._conversationPreviews[conversationId];
|
|
10474
|
+
const readTs = latestKnownConversationTimestamp(conv, preview);
|
|
10475
|
+
const next = markConversationRead(this._unreadState, conversationId, readTs);
|
|
10476
|
+
if (next === this._unreadState) return;
|
|
10477
|
+
this._unreadState = next;
|
|
10478
|
+
writeUnreadState(next);
|
|
10479
|
+
}
|
|
10480
|
+
_handleVisibilityOrFocus = () => {
|
|
10481
|
+
if (globalThis.document?.visibilityState === "hidden") return;
|
|
10482
|
+
const currentId = this._activeConversationId || this.conversationId;
|
|
10483
|
+
if (currentId && this._isConversationVisiblyOpen(currentId)) {
|
|
10484
|
+
this._markConversationReadIfNeeded(currentId);
|
|
10485
|
+
this.requestUpdate();
|
|
10486
|
+
}
|
|
10487
|
+
};
|
|
10173
10488
|
_setupChatListSubscriptions() {
|
|
10174
10489
|
if (!this.credentials) return;
|
|
10175
10490
|
if (this._conversationsUnsub && sameCredentials(this._chatListCredentials, this.credentials)) {
|
|
@@ -10177,8 +10492,18 @@ var ConnectedChat = class extends LitElement10 {
|
|
|
10177
10492
|
}
|
|
10178
10493
|
this._teardownChatListSubscriptions();
|
|
10179
10494
|
this._chatListCredentials = this.credentials;
|
|
10495
|
+
const { publicSignKey } = this.credentials;
|
|
10496
|
+
this._unreadState = readUnreadState(publicSignKey);
|
|
10497
|
+
this._unreadStorageUnsub = subscribeUnreadStateStorage(publicSignKey, (next) => {
|
|
10498
|
+
this._unreadState = next;
|
|
10499
|
+
this.requestUpdate();
|
|
10500
|
+
});
|
|
10180
10501
|
this._previewsManager = createConversationPreviewsManager(this.credentials, (map3) => {
|
|
10181
10502
|
this._conversationPreviews = map3;
|
|
10503
|
+
const currentId = this._activeConversationId || this.conversationId;
|
|
10504
|
+
if (currentId && this._isConversationVisiblyOpen(currentId)) {
|
|
10505
|
+
this._markConversationReadIfNeeded(currentId);
|
|
10506
|
+
}
|
|
10182
10507
|
this.requestUpdate();
|
|
10183
10508
|
});
|
|
10184
10509
|
this._allTypingUnsub = subscribeAllTypingStates(this.credentials, (map3) => {
|
|
@@ -10187,7 +10512,13 @@ var ConnectedChat = class extends LitElement10 {
|
|
|
10187
10512
|
});
|
|
10188
10513
|
this._conversationsUnsub = subscribeConversations(this.credentials, (convs) => {
|
|
10189
10514
|
this._conversations = convs;
|
|
10190
|
-
if (convs)
|
|
10515
|
+
if (convs) {
|
|
10516
|
+
if (!this._unreadState) {
|
|
10517
|
+
this._unreadState = seedUnreadState(null, publicSignKey, convs);
|
|
10518
|
+
writeUnreadState(this._unreadState);
|
|
10519
|
+
}
|
|
10520
|
+
this._previewsManager?.setConversations(convs);
|
|
10521
|
+
}
|
|
10191
10522
|
convs?.forEach((conv) => {
|
|
10192
10523
|
const other = conv.participants.find((p) => p.publicSignKey !== this.credentials.publicSignKey);
|
|
10193
10524
|
if (other && !conv.title && !other.name) {
|
|
@@ -10196,6 +10527,10 @@ var ConnectedChat = class extends LitElement10 {
|
|
|
10196
10527
|
});
|
|
10197
10528
|
this._identityDetails = mergeIdentityDetails(this._identityDetails, extractInlineIdentityDetails(this._participants, convs));
|
|
10198
10529
|
this._resubscribeIdentities();
|
|
10530
|
+
const currentId = this._activeConversationId || this.conversationId;
|
|
10531
|
+
if (currentId && this._isConversationVisiblyOpen(currentId)) {
|
|
10532
|
+
this._markConversationReadIfNeeded(currentId);
|
|
10533
|
+
}
|
|
10199
10534
|
if (!this._activeConversationId && convs && convs.length > 0 && this.enableChatSwitching) {
|
|
10200
10535
|
this._selectConversation(convs[0].id);
|
|
10201
10536
|
}
|
|
@@ -10212,6 +10547,19 @@ var ConnectedChat = class extends LitElement10 {
|
|
|
10212
10547
|
}
|
|
10213
10548
|
_selectConversation(id) {
|
|
10214
10549
|
if (this._activeConversationId === id && !this._mobileShowList) return;
|
|
10550
|
+
if (this.enableChatSwitching && this.credentials && this._unreadState) {
|
|
10551
|
+
const status = computeConversationUnread({
|
|
10552
|
+
conversationId: id,
|
|
10553
|
+
preview: this._conversationPreviews[id],
|
|
10554
|
+
selfPublicSignKey: this.credentials.publicSignKey,
|
|
10555
|
+
state: this._unreadState,
|
|
10556
|
+
isActivelyViewing: false
|
|
10557
|
+
});
|
|
10558
|
+
this._internalUnreadDividerAfterTimestamp = status.count > 0 ? status.effectiveReadAt : void 0;
|
|
10559
|
+
this._markConversationReadIfNeeded(id);
|
|
10560
|
+
} else {
|
|
10561
|
+
this._internalUnreadDividerAfterTimestamp = void 0;
|
|
10562
|
+
}
|
|
10215
10563
|
this._activeConversationId = id;
|
|
10216
10564
|
this._mobileShowList = false;
|
|
10217
10565
|
if (this._subscribedConversationId !== id || !sameCredentials(this._subscribedCredentials, this.credentials)) {
|
|
@@ -10385,6 +10733,8 @@ var ConnectedChat = class extends LitElement10 {
|
|
|
10385
10733
|
_handleSend = (text, replyTo) => {
|
|
10386
10734
|
const targetId = this._activeConversationId || this.conversationId;
|
|
10387
10735
|
if (!this.credentials || !targetId) return;
|
|
10736
|
+
this._internalUnreadDividerAfterTimestamp = void 0;
|
|
10737
|
+
this._markConversationReadIfNeeded(targetId);
|
|
10388
10738
|
this.dispatchEvent(new CustomEvent("message-sent", {
|
|
10389
10739
|
bubbles: true,
|
|
10390
10740
|
composed: true
|
|
@@ -10919,6 +11269,14 @@ var ConnectedChat = class extends LitElement10 {
|
|
|
10919
11269
|
const baseColor = avatarColor(otherKey, isDark);
|
|
10920
11270
|
const avatar = otherParticipant ? resolveParticipantAvatar(otherParticipant, this._identityDetails) : void 0;
|
|
10921
11271
|
const preview = this._conversationPreviews[conv.id];
|
|
11272
|
+
const unread = computeConversationUnread({
|
|
11273
|
+
conversationId: conv.id,
|
|
11274
|
+
preview,
|
|
11275
|
+
selfPublicSignKey: myKey,
|
|
11276
|
+
state: this._unreadState,
|
|
11277
|
+
isActivelyViewing: this._isConversationVisiblyOpen(conv.id)
|
|
11278
|
+
});
|
|
11279
|
+
const unreadLabel = formatUnreadBadgeLabel(unread.count, unread.overflow);
|
|
10922
11280
|
const typingNames = activeTypingNamesForConversation(this._typingByConversation[conv.id], preview);
|
|
10923
11281
|
const typingLabel2 = formatConversationTypingLabel(typingNames, conv.participants.length > 2);
|
|
10924
11282
|
const previewLine = preview ? formatConversationPreviewLine({
|
|
@@ -10931,6 +11289,7 @@ var ConnectedChat = class extends LitElement10 {
|
|
|
10931
11289
|
return html11`
|
|
10932
11290
|
<div
|
|
10933
11291
|
class="alice-sidebar-item"
|
|
11292
|
+
data-conversation-id="${conv.id}"
|
|
10934
11293
|
style="${sidebarItemStyle(isSelected, isDark, this.customColors)}"
|
|
10935
11294
|
@click="${() => this._selectConversation(conv.id)}"
|
|
10936
11295
|
>
|
|
@@ -10956,18 +11315,34 @@ var ConnectedChat = class extends LitElement10 {
|
|
|
10956
11315
|
@blur="${this._commitSidebarRename}"
|
|
10957
11316
|
/>
|
|
10958
11317
|
` : html11`
|
|
10959
|
-
<div style="${sidebarItemTitleStyle(isDark, isSelected, this.customColors)}">
|
|
11318
|
+
<div style="${sidebarItemTitleStyle(isDark, isSelected, this.customColors, unread.isUnread)}">
|
|
10960
11319
|
${displayName}
|
|
10961
11320
|
</div>
|
|
10962
11321
|
`} ${timeLabel && this._editingSidebarConvId !== conv.id ? html11`
|
|
10963
|
-
<span style="${sidebarItemTimeStyle(isDark)}">${timeLabel}</span>
|
|
11322
|
+
<span style="${sidebarItemTimeStyle(isDark, unread.isUnread)}">${timeLabel}</span>
|
|
10964
11323
|
` : nothing6}
|
|
10965
11324
|
</div>
|
|
10966
|
-
<div
|
|
10967
|
-
|
|
10968
|
-
|
|
10969
|
-
|
|
10970
|
-
|
|
11325
|
+
<div style="${sidebarItemBottomRowStyle}">
|
|
11326
|
+
<div
|
|
11327
|
+
data-testid="conversation-preview-slot"
|
|
11328
|
+
style="${typingLabel2 ? sidebarItemTypingStyle(isDark) : sidebarItemPreviewStyle(isDark, unread.isUnread)}"
|
|
11329
|
+
>
|
|
11330
|
+
${typingLabel2 || previewLine || nothing6}
|
|
11331
|
+
</div>
|
|
11332
|
+
${unread.isUnread ? unreadLabel ? html11`
|
|
11333
|
+
<span
|
|
11334
|
+
data-testid="conversation-unread-badge"
|
|
11335
|
+
aria-label="${unread.count === 1 ? "1 unread message" : `${unreadLabel} unread messages`}"
|
|
11336
|
+
style="${sidebarUnreadBadgeStyle(isDark)}"
|
|
11337
|
+
>${unreadLabel}</span>
|
|
11338
|
+
` : html11`
|
|
11339
|
+
<span
|
|
11340
|
+
data-testid="conversation-unread-badge"
|
|
11341
|
+
data-unread-dot
|
|
11342
|
+
aria-label="Unread"
|
|
11343
|
+
style="${sidebarUnreadDotStyle(isDark)}"
|
|
11344
|
+
></span>
|
|
11345
|
+
` : nothing6}
|
|
10971
11346
|
</div>
|
|
10972
11347
|
</div>
|
|
10973
11348
|
<button
|
|
@@ -11051,6 +11426,8 @@ var ConnectedChat = class extends LitElement10 {
|
|
|
11051
11426
|
.isDark="${isDark}"
|
|
11052
11427
|
.emptyMessage="${this.emptyMessage}"
|
|
11053
11428
|
.suggestedMessages="${this.suggestedMessages}"
|
|
11429
|
+
.unreadDividerAfterTimestamp="${this.unreadDividerAfterTimestamp ?? this._internalUnreadDividerAfterTimestamp}"
|
|
11430
|
+
.otherUnreadCount="${this.otherUnreadCount}"
|
|
11054
11431
|
@new-thread="${this._handleNewThread}"
|
|
11055
11432
|
@rename-conversation="${this._handleRenameConversation}"
|
|
11056
11433
|
@show-participants="${this._handleShowParticipants}"
|
package/mod.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "alice-and-bot",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.80",
|
|
4
4
|
"description": "A chat network for agents. Open-source, end-to-end encrypted messaging SDK, React chat UI, and embeddable widgets for AI agents and humans.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|