@palbase/web 1.4.0 → 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/{analytics-facade-CbXprYrS.d.ts → analytics-facade-DYNLUW0L.d.ts} +239 -7
- package/dist/{analytics-facade-DA9TGKLF.d.cts → analytics-facade-iAWinswQ.d.cts} +239 -7
- package/dist/{chunk-3EVGYJ5F.js → chunk-A5WIPBGQ.js} +893 -70
- package/dist/chunk-A5WIPBGQ.js.map +1 -0
- package/dist/index.cjs +892 -69
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +1 -1
- package/dist/internal.cjs +892 -69
- package/dist/internal.cjs.map +1 -1
- package/dist/internal.d.cts +3 -3
- package/dist/internal.d.ts +3 -3
- package/dist/internal.js +1 -1
- package/dist/next/client.cjs +892 -69
- package/dist/next/client.cjs.map +1 -1
- package/dist/next/client.js +1 -1
- package/dist/next/index.cjs +892 -69
- package/dist/next/index.cjs.map +1 -1
- package/dist/next/index.d.cts +2 -2
- package/dist/next/index.d.ts +2 -2
- package/dist/next/index.js +1 -1
- package/dist/{pb-SVs7vTOp.d.cts → pb-Blj85_cg.d.cts} +1 -1
- package/dist/{pb-CLfTLQzH.d.ts → pb-DPPpThNg.d.ts} +1 -1
- package/dist/react/index.cjs +1 -1
- package/dist/react/index.cjs.map +1 -1
- package/dist/react/index.d.cts +1 -1
- package/dist/react/index.d.ts +1 -1
- package/dist/react/index.js +1 -1
- package/package.json +2 -2
- package/dist/chunk-3EVGYJ5F.js.map +0 -1
|
@@ -700,6 +700,24 @@ declare class PalbeFlags {
|
|
|
700
700
|
destroy(): void;
|
|
701
701
|
}
|
|
702
702
|
|
|
703
|
+
/**
|
|
704
|
+
* Pure deadline math — the web mirror of iOS DeadlineCalculator (Codex-finalized
|
|
705
|
+
* restart conversion rule). Identical algorithm; web uses ms internally and
|
|
706
|
+
* compares against ttlSeconds (converted). Clock readings are passed in so it is
|
|
707
|
+
* fully table-testable and byte-identical with iOS.
|
|
708
|
+
*
|
|
709
|
+
* NOTE on the send-vs-arrival clamp: like iOS T3, this Calculator stays PURE — it
|
|
710
|
+
* consumes an already-resolved anchor + the current clock readings. The
|
|
711
|
+
* `min(sender_send_ts + ttl, first_arrival_monotonic + ttl)` effective-deadline
|
|
712
|
+
* basis is applied at ARM time by the caller (Chat, T10), which picks the anchor's
|
|
713
|
+
* monotonic baseline; the Calculator only converts that anchor into remaining/purge.
|
|
714
|
+
*/
|
|
715
|
+
interface AnchorTriple {
|
|
716
|
+
mAnchorMs: number;
|
|
717
|
+
wAnchorEpochMs: number;
|
|
718
|
+
bAnchorToken: string;
|
|
719
|
+
}
|
|
720
|
+
|
|
703
721
|
/** A direct (1:1) chat or a multi-party group. */
|
|
704
722
|
type ChatKind = 'direct' | 'group';
|
|
705
723
|
/** A draft (local-only, not yet on the server) or an active (materialized) chat. */
|
|
@@ -710,6 +728,20 @@ type ChatRole = 'owner' | 'admin' | 'member';
|
|
|
710
728
|
type MessageDirection = 'incoming' | 'outgoing';
|
|
711
729
|
/** A renderable message kind. `system` = a membership commit / control frame. */
|
|
712
730
|
type ChatMessageKind = 'text' | 'media' | 'system';
|
|
731
|
+
/**
|
|
732
|
+
* A resolved mention span inside a message body. Produced at decode/merge time by
|
|
733
|
+
* NORMALIZING the wire `body_ranges` (the pinned `normalizeMentionRangesUtf16`
|
|
734
|
+
* contract) against the message text, then resolving the `mentionedUserId` to a
|
|
735
|
+
* roster display name. Offsets are UTF-16 code units, half-open `[start, start+length)`.
|
|
736
|
+
* `displayName` is `null` when the mentioned user is not in the local roster (the
|
|
737
|
+
* renderer falls back to the underlying `text` slice). Mirrors iOS `ResolvedMention`.
|
|
738
|
+
*/
|
|
739
|
+
interface ResolvedMention {
|
|
740
|
+
readonly start: number;
|
|
741
|
+
readonly length: number;
|
|
742
|
+
readonly mentionedUserId: string;
|
|
743
|
+
readonly displayName: string | null;
|
|
744
|
+
}
|
|
713
745
|
/** A participating USER (not a device). For a direct chat: `[me, peer]`. */
|
|
714
746
|
interface ChatMember {
|
|
715
747
|
/** == userId (stable identity). */
|
|
@@ -774,6 +806,25 @@ interface ChatMessage {
|
|
|
774
806
|
* local-only suppression that omits the message from this view entirely.)
|
|
775
807
|
*/
|
|
776
808
|
readonly isDeleted: boolean;
|
|
809
|
+
/**
|
|
810
|
+
* The resolved mention spans on this message (defaults to `[]`). A mention is a
|
|
811
|
+
* NORMAL bubble — these spans only annotate the existing `text` for highlighting,
|
|
812
|
+
* they never make a message non-bubble. Recomputed by the Chat as the roster
|
|
813
|
+
* resolves (display names are live, not snapshotted). When this message is
|
|
814
|
+
* tombstoned (deleted-for-everyone) the spans are scrubbed to `[]` (delete
|
|
815
|
+
* DOMINATES); when it is edited they reflect the EDIT's replacement `body_ranges`.
|
|
816
|
+
*/
|
|
817
|
+
readonly mentions: ResolvedMention[];
|
|
818
|
+
/**
|
|
819
|
+
* The LOCAL purge deadline for this message (monotonic-derived, never a wire field).
|
|
820
|
+
* `null` when this message has no TTL. The UI may show a countdown; the durable truth
|
|
821
|
+
* is the persisted anchor + a re-check on every load (disappearing T10). A message's
|
|
822
|
+
* effective TTL is its OWN per-message `expiry` if present, else the chat default
|
|
823
|
+
* `timer_set` active AS OF this message's order (forward-only — a message ordered
|
|
824
|
+
* BEFORE the governing `timer_set` inherits nothing; own-expiry WINS over the default).
|
|
825
|
+
* Mirrors iOS `ChatMessage.effectiveExpiry` (which it derives from).
|
|
826
|
+
*/
|
|
827
|
+
readonly expiresAt: Date | null;
|
|
777
828
|
}
|
|
778
829
|
/** The receipt from a send — the server's monotonic sequence + accepted epoch. */
|
|
779
830
|
interface SentReceipt {
|
|
@@ -814,6 +865,15 @@ interface ReplyRef {
|
|
|
814
865
|
client_msg_id: string;
|
|
815
866
|
preview?: QuotePreview;
|
|
816
867
|
}
|
|
868
|
+
/** A single mention range inside a message body.
|
|
869
|
+
* Offsets are UTF-16 code units, half-open [start, start+length).
|
|
870
|
+
* Wire: snake_case (mentioned_user_id, body_ranges) — web does RAW JSON, no case-convert.
|
|
871
|
+
*/
|
|
872
|
+
interface MentionRange {
|
|
873
|
+
start: number;
|
|
874
|
+
length: number;
|
|
875
|
+
mentionedUserId: string;
|
|
876
|
+
}
|
|
817
877
|
interface ReactionPayload {
|
|
818
878
|
targetClientMsgId: string;
|
|
819
879
|
emoji: string;
|
|
@@ -827,6 +887,13 @@ interface DeletePayload {
|
|
|
827
887
|
targetClientMsgId: string;
|
|
828
888
|
scope: string;
|
|
829
889
|
}
|
|
890
|
+
/** Per-message TTL spec (decoded). senderSendTs present iff start === 'send'. */
|
|
891
|
+
interface ExpirySpec {
|
|
892
|
+
v: number;
|
|
893
|
+
ttlSeconds: number;
|
|
894
|
+
start: 'send' | 'read';
|
|
895
|
+
senderSendTs: number | null;
|
|
896
|
+
}
|
|
830
897
|
|
|
831
898
|
/** A decoded incoming message handed to chat listeners. */
|
|
832
899
|
interface IncomingMessage {
|
|
@@ -857,6 +924,20 @@ interface IncomingMessage {
|
|
|
857
924
|
* the Chat route a delete-for-everyone tombstone into its DeleteFold instead of
|
|
858
925
|
* appending a visible bubble. */
|
|
859
926
|
delete?: DeletePayload | null;
|
|
927
|
+
/** The decoded mention ranges (raw, un-normalized). Present on a `'text'` bubble
|
|
928
|
+
* with `body_ranges` OR on an `'edit'` (the edit's replacement ranges). The Chat
|
|
929
|
+
* normalizes + resolves roster names → `ChatMessage.mentions` (mentions T6). */
|
|
930
|
+
bodyRanges?: MentionRange[] | null;
|
|
931
|
+
/** The decoded `timer_set` payload, present only when `envelopeType === 'timer_set'`
|
|
932
|
+
* (disappearing T10). Lets the Chat route a chat-default timer into its TimerFold
|
|
933
|
+
* instead of appending a visible bubble. */
|
|
934
|
+
timer?: {
|
|
935
|
+
ttlSeconds: number | null;
|
|
936
|
+
start: 'send' | 'read';
|
|
937
|
+
} | null;
|
|
938
|
+
/** The decoded per-message TTL spec, present only on a `'text'` bubble that carried an
|
|
939
|
+
* `expiry` (disappearing T10). Lets the Chat arm the message's purge on first display. */
|
|
940
|
+
expiry?: ExpirySpec | null;
|
|
860
941
|
}
|
|
861
942
|
|
|
862
943
|
/** The intended participants of a draft chat (held until the first send). */
|
|
@@ -876,7 +957,7 @@ interface ChatBackend {
|
|
|
876
957
|
selfUserId: string;
|
|
877
958
|
/** Materialize a draft → the active group (DM get-or-create / group create+add). */
|
|
878
959
|
materialize(draft: ChatDraft): Promise<MessagingGroup>;
|
|
879
|
-
sendText(group: MessagingGroup, text: string, replyTo?: ReplyRef | null): Promise<{
|
|
960
|
+
sendText(group: MessagingGroup, text: string, replyTo?: ReplyRef | null, bodyRanges?: MentionRange[] | null, expiry?: ExpirySpec | null): Promise<{
|
|
880
961
|
receipt: SentReceipt;
|
|
881
962
|
clientMsgId: string;
|
|
882
963
|
}>;
|
|
@@ -897,6 +978,7 @@ interface ChatBackend {
|
|
|
897
978
|
clientMsgId: string;
|
|
898
979
|
targetClientMsgId: string;
|
|
899
980
|
newText: string;
|
|
981
|
+
bodyRanges?: MentionRange[] | null;
|
|
900
982
|
}): Promise<{
|
|
901
983
|
receipt: SentReceipt;
|
|
902
984
|
clientMsgId: string;
|
|
@@ -927,6 +1009,36 @@ interface ChatBackend {
|
|
|
927
1009
|
loadSuppressed(group: MessagingGroup): Promise<string[]>;
|
|
928
1010
|
/** Persist this chat's delete-for-me suppression keys (durable, no wire). */
|
|
929
1011
|
saveSuppressed(group: MessagingGroup, keys: string[]): Promise<void>;
|
|
1012
|
+
/** Load this chat's persisted self-elevation dedup keys (durable, no wire) so a
|
|
1013
|
+
* re-delivered mention does not re-fire `onMentionElevation` after a cold launch. */
|
|
1014
|
+
loadElevated(group: MessagingGroup): Promise<string[]>;
|
|
1015
|
+
/** Persist this chat's self-elevation dedup keys (durable, no wire). */
|
|
1016
|
+
saveElevated(group: MessagingGroup, keys: string[]): Promise<void>;
|
|
1017
|
+
/** Send a per-chat default disappearing-timer control envelope (`timer_set`). Goes
|
|
1018
|
+
* through the SAME MLS application path as `sendText` — server-blind, never a bubble.
|
|
1019
|
+
* `ttlSeconds === null` disables the default. Returns the receipt + the wire clientMsgId. */
|
|
1020
|
+
sendTimerSet(group: MessagingGroup, args: {
|
|
1021
|
+
clientMsgId: string;
|
|
1022
|
+
ttlSeconds: number | null;
|
|
1023
|
+
start: 'send' | 'read';
|
|
1024
|
+
}): Promise<{
|
|
1025
|
+
receipt: SentReceipt;
|
|
1026
|
+
clientMsgId: string;
|
|
1027
|
+
}>;
|
|
1028
|
+
/** The persisted INTEGER `server_seq` tombstone set for a chat — drives transcript
|
|
1029
|
+
* exclusion (cold-launch) + redelivery drop (live arrival). Durable, no wire. */
|
|
1030
|
+
tombstonedSeqs(group: MessagingGroup): Promise<Set<number>>;
|
|
1031
|
+
/** The persisted STRING `client_msg_id` purge set — drives the orphan-fold resolver
|
|
1032
|
+
* (`authorOfTarget → 'purged'`) so a late edit DROPs / a late delete no-ops. */
|
|
1033
|
+
purgedClientMsgIds(group: MessagingGroup): Promise<Set<string>>;
|
|
1034
|
+
/** The persisted write-once anchor triple for a `clientMsgId`, or null if none. */
|
|
1035
|
+
anchor(group: MessagingGroup, clientMsgId: string): Promise<AnchorTriple | null>;
|
|
1036
|
+
/** Write-once: capture the first-arrival/first-read anchor triple for a `clientMsgId`
|
|
1037
|
+
* (a second call for the same id is a no-op, so the deadline never resets). */
|
|
1038
|
+
writeAnchorOnce(group: MessagingGroup, clientMsgId: string, a: AnchorTriple): Promise<void>;
|
|
1039
|
+
/** Tombstone-first purge commit point: persist the int `server_seq` + string
|
|
1040
|
+
* `client_msg_id` purge id in ONE durable record (idempotent). */
|
|
1041
|
+
tombstone(group: MessagingGroup, serverSeq: number, clientMsgId: string): Promise<void>;
|
|
930
1042
|
}
|
|
931
1043
|
declare class Chat {
|
|
932
1044
|
/** Stable, URL/log-safe id (the grp_ display id once active; a reserved local id while draft). */
|
|
@@ -952,12 +1064,35 @@ declare class Chat {
|
|
|
952
1064
|
/** The single authoritative delete-for-everyone fold (live + own-send + history).
|
|
953
1065
|
* A tombstone scrubs its target in place (delete DOMINATES edit at render). */
|
|
954
1066
|
private readonly deleteFold;
|
|
1067
|
+
/** The per-chat default disappearing-timer fold — the latest valid `timer_set` (LWW
|
|
1068
|
+
* on (epoch, serverSeq), author = the resolved MLS sender). A `timer_set` is NEVER a
|
|
1069
|
+
* bubble; it routes here. The active default governs a subsequent bubble that carries
|
|
1070
|
+
* no per-message expiry (disappearing T10). */
|
|
1071
|
+
private readonly timerFold;
|
|
1072
|
+
/** Advisory in-memory purge timers, keyed by serverSeq. The DURABLE truth is the
|
|
1073
|
+
* persisted anchor + a re-check on every load; this just drives live eviction while
|
|
1074
|
+
* the tab is open. Cancelled when the message purges (disappearing T10). */
|
|
1075
|
+
private readonly purgeTimers;
|
|
1076
|
+
/** In-memory mirror of the durable `purgedClientMsgIds` set (the STRING namespace),
|
|
1077
|
+
* hydrated from `backend.purgedClientMsgIds` and grown by each live purge. Consulted
|
|
1078
|
+
* by `authorOfTarget` so a late edit/delete targeting a TTL-purged message resolves to
|
|
1079
|
+
* `'purged'` (DROP / no-op — never resurrects). Namespace-separate from the int seq
|
|
1080
|
+
* tombstone (disappearing T10). */
|
|
1081
|
+
private readonly purgedCids;
|
|
1082
|
+
private purgedLoaded;
|
|
955
1083
|
/** delete-for-me suppression keys (clientMsgId, or `seq:<serverSeq>` for legacy)
|
|
956
1084
|
* — the message is OMITTED from this view. Local + persisted per chat, NO wire. */
|
|
957
1085
|
private readonly suppressed;
|
|
958
1086
|
/** True once the persisted suppression set has been loaded (so the omit applies
|
|
959
1087
|
* even on the cold-launch hydrate path before a fresh deleteForMe). */
|
|
960
1088
|
private suppressedLoaded;
|
|
1089
|
+
/** Self-elevation dedup keys (`<selfUserId>|<clientMsgId or seq:n>`). Once a
|
|
1090
|
+
* mention of me from another sender fires `onMentionElevation`, its key lands here
|
|
1091
|
+
* + is persisted, so a re-delivery / cold-launch re-hydrate never re-fires. */
|
|
1092
|
+
private readonly elevated;
|
|
1093
|
+
/** True once the persisted elevation set has been loaded (so a re-delivered mention
|
|
1094
|
+
* on the cold-launch hydrate path dedups against the persisted decision). */
|
|
1095
|
+
private elevatedLoaded;
|
|
961
1096
|
/** Per-target BASE (original) text, so the rendered text is `edit ?? original`.
|
|
962
1097
|
* Seeded once per target (write-once base) so a 2nd own edit can't corrupt it. */
|
|
963
1098
|
private readonly originalTextByClientMsgId;
|
|
@@ -969,6 +1104,14 @@ declare class Chat {
|
|
|
969
1104
|
private wired;
|
|
970
1105
|
private liveUnsub;
|
|
971
1106
|
private readonly listeners;
|
|
1107
|
+
/**
|
|
1108
|
+
* Fires ONCE per `(selfUserId, clientMsgId)` when an INCOMING message mentions THIS
|
|
1109
|
+
* user from ANOTHER sender (not an edit). The dedup survives re-delivery + reload
|
|
1110
|
+
* via the persisted elevation set, so this never double-fires for one mention. The
|
|
1111
|
+
* app wires it to a buzz/badge (e.g. an in-app banner). Best-effort cooperative —
|
|
1112
|
+
* the SDK guarantees the DECISION, not the buzz. Mirrors iOS `Chat.onMentionElevation`.
|
|
1113
|
+
*/
|
|
1114
|
+
onMentionElevation?: (message: ChatMessage) => void;
|
|
972
1115
|
/** @internal — obtain via pb.messaging.directChat / groupChat / chat(id). */
|
|
973
1116
|
constructor(args: {
|
|
974
1117
|
group: MessagingGroup;
|
|
@@ -1006,17 +1149,85 @@ declare class Chat {
|
|
|
1006
1149
|
get title(): string;
|
|
1007
1150
|
presence(userId: string): PresenceState | null;
|
|
1008
1151
|
private ensureWired;
|
|
1152
|
+
/** Hydrate the durable `purgedClientMsgIds` set (once) into the in-memory mirror so the
|
|
1153
|
+
* live Edit/Delete fold author-gate sees TTL-purged targets as 'purged' on cold launch
|
|
1154
|
+
* (disappearing T10). No re-emit: it only gates the orphan-fold resolution. */
|
|
1155
|
+
private loadPurged;
|
|
1009
1156
|
/** Hydrate the persisted delete-for-me suppression keys (once), then re-emit so
|
|
1010
1157
|
* any already-surfaced suppressed message is omitted (cold-launch parity). */
|
|
1011
1158
|
private loadSuppressed;
|
|
1159
|
+
/** Hydrate the persisted self-elevation dedup keys (once). No re-emit: the set only
|
|
1160
|
+
* gates the elevation DECISION, it does not change what renders. */
|
|
1161
|
+
private loadElevated;
|
|
1012
1162
|
private hydrateHistory;
|
|
1013
1163
|
private mergeHistory;
|
|
1014
1164
|
/** @internal — called by the backend's live subscription. */
|
|
1015
1165
|
ingestLive(incoming: IncomingMessage): Promise<void>;
|
|
1016
|
-
/**
|
|
1017
|
-
*
|
|
1018
|
-
|
|
1166
|
+
/** Normalize a decoded `IncomingMessage.expiry` / `StoredMessage.expiry` into the
|
|
1167
|
+
* `ExpirySpec` the arm path consumes (or null when absent). */
|
|
1168
|
+
private toExpirySpec;
|
|
1169
|
+
/** The chat-default expiry derived from the active `timer_set` fold, as an `ExpirySpec`
|
|
1170
|
+
* so a bubble with no per-message expiry inherits it. null when no default is active or
|
|
1171
|
+
* the default was explicitly DISABLED (`ttlSeconds === null`). `senderSendTs` is null —
|
|
1172
|
+
* the default has no per-message sender clock; the arrival anchor drives the deadline
|
|
1173
|
+
* (mirrors iOS `defaultExpiry()`). */
|
|
1174
|
+
private defaultExpiry;
|
|
1175
|
+
/** The surfaced display deadline for an effective expiry (a local, monotonic-derived
|
|
1176
|
+
* value — the wall-clock projection of the TTL from now). null for a non-disappearing
|
|
1177
|
+
* message. The durable purge is driven by `armPurge`'s write-once anchor; this is the
|
|
1178
|
+
* UI countdown baseline. */
|
|
1179
|
+
private deadlineFor;
|
|
1180
|
+
/** Arm a message's TTL purge on first decrypt-and-display. Captures the WRITE-ONCE
|
|
1181
|
+
* monotonic/wall/boot anchor (so the deadline survives a reload — a re-arm after relaunch
|
|
1182
|
+
* reads back the ORIGINAL capture, never a fresh one → the deadline never resets),
|
|
1183
|
+
* computes the remaining time via `remainingSeconds`, applies the send-anchor clamp
|
|
1184
|
+
* `min(sender_send_ts+ttl, first_arrival+ttl)` (read-anchor uses the write-once first-read
|
|
1185
|
+
* capture), then either purges immediately or schedules an advisory `setTimeout`. A null
|
|
1186
|
+
* expiry / empty clientMsgId is a no-op. Mirrors iOS `armPurge`. */
|
|
1187
|
+
private armPurge;
|
|
1188
|
+
/** Re-arm a purge from a derived deadline (cold-launch hydrate path). The deadline is
|
|
1189
|
+
* the projection's monotonic-derived `expiresAt`; schedule an advisory timer for the
|
|
1190
|
+
* remaining time (purge immediately if the deadline has already passed). The durable
|
|
1191
|
+
* tombstone is written by `purge` when it fires (the crash-safe commit point). */
|
|
1192
|
+
private armFromDeadline;
|
|
1193
|
+
/** Purge message M (TTL eviction). TOMBSTONE-FIRST (the crash-safe commit point):
|
|
1194
|
+
* persist the `server_seq` tombstone + the `client_msg_id` purge id in ONE durable
|
|
1195
|
+
* record, THEN drop M's body from `messageList` + `emit()`, then re-evaluate any HELD
|
|
1196
|
+
* edit / PARKED delete targeting the now-purged cid so an orphan annotation DROPs/no-ops
|
|
1197
|
+
* (the resolver now returns `'purged'`). Idempotent. Mirrors iOS `purge`. */
|
|
1198
|
+
private purge;
|
|
1199
|
+
/** The Edit/Delete fold author-gate input via {@link AuthorResolution} (disappearing
|
|
1200
|
+
* T10 — the orphan-aware resolver): `'purged'` when the target's clientMsgId is in the
|
|
1201
|
+
* durable purge set (a late edit DROPs / a late delete no-ops — never resurrects a
|
|
1202
|
+
* disappeared message); `'author'` when its author is locally known → run the
|
|
1203
|
+
* author-gate; `'unknown'` otherwise → HOLD. The live twin of `projectHistory`'s
|
|
1204
|
+
* resolver. Captured as a bound arrow so it can be passed to the pure folds. */
|
|
1019
1205
|
private readonly authorOfTarget;
|
|
1206
|
+
/** Resolve a message's decode-time mention spans: NORMALIZE the raw `body_ranges`
|
|
1207
|
+
* against `text` (the pinned `normalizeMentionRangesUtf16` cross-SDK contract) then
|
|
1208
|
+
* resolve each surviving range's `mentionedUserId` to a roster display name. An id
|
|
1209
|
+
* not in the roster resolves to `null` (the renderer falls back to the `text` slice).
|
|
1210
|
+
* Pure over (text, bodyRanges, memberCache); never throws. Mirrors iOS T3. */
|
|
1211
|
+
private resolveMentions;
|
|
1212
|
+
/** Re-resolve the roster display name on already-NORMALIZED spans (the history
|
|
1213
|
+
* projection produces them with null names — resolution is LIVE, not snapshotted).
|
|
1214
|
+
* A member rename then reflects on old messages. Returns the message unchanged when
|
|
1215
|
+
* it has no mentions (the common case) or no name changed. Mirrors iOS T3. */
|
|
1216
|
+
private resolveMentionNames;
|
|
1217
|
+
/** The WINNING edit's resolved mentions for a target (normalize its replacement
|
|
1218
|
+
* ranges against the new text + roster names), or `[]` if no winning edit / no
|
|
1219
|
+
* ranges. The edited message's mentions reflect the EDIT's ranges (mirrors iOS T3). */
|
|
1220
|
+
private editMentions;
|
|
1221
|
+
/** Resolve a userId → its roster display name (null if not a known member). */
|
|
1222
|
+
private displayNameOf;
|
|
1223
|
+
/** Compute the SELF-ELEVATION decision for a freshly-ingested INCOMING bubble and,
|
|
1224
|
+
* when it fires, record the dedup key (persisted) + invoke `onMentionElevation`.
|
|
1225
|
+
* Gate (mirrors iOS T3): a surviving mention targets THIS user AND the sender is not
|
|
1226
|
+
* me AND it's NOT an edit AND the `(selfUserId, clientMsgId|seq)` key isn't already
|
|
1227
|
+
* elevated. Dedup-once: the in-memory set gates the session, the persisted set
|
|
1228
|
+
* survives reload. An EDIT never reaches here (it folds, not a bubble) — the
|
|
1229
|
+
* `envelopeType !== 'edit'` guard is belt-and-braces. */
|
|
1230
|
+
private elevateIfMentioned;
|
|
1020
1231
|
/** Seed the per-target base text + author for the edit fold. Base is write-once
|
|
1021
1232
|
* (a later own/peer edit must not overwrite the original we render against). The
|
|
1022
1233
|
* author is (re)recorded whenever a non-empty resolution is available. */
|
|
@@ -1057,11 +1268,29 @@ declare class Chat {
|
|
|
1057
1268
|
/** Page older messages in. Returns how many were prepended. */
|
|
1058
1269
|
loadEarlier(limit?: number): Promise<number>;
|
|
1059
1270
|
private refreshMembers;
|
|
1271
|
+
/** Re-resolve roster display names across the whole transcript (called on a roster
|
|
1272
|
+
* change). Re-emits only if any name actually changed. */
|
|
1273
|
+
private reresolveAllMentionNames;
|
|
1060
1274
|
private seedMembersFromGroup;
|
|
1061
1275
|
private seedDraftMembers;
|
|
1062
1276
|
send(text: string, opts?: {
|
|
1063
1277
|
replyTo?: ChatMessage;
|
|
1278
|
+
mentions?: MentionRange[];
|
|
1279
|
+
expiresIn?: {
|
|
1280
|
+
ttlSeconds: number;
|
|
1281
|
+
start?: 'send' | 'read';
|
|
1282
|
+
};
|
|
1064
1283
|
}): Promise<SentReceipt>;
|
|
1284
|
+
/** Set (or DISABLE) this chat's DEFAULT disappearing timer. Emits a `timer_set` control
|
|
1285
|
+
* envelope (server-blind — an opaque application message, NEVER a bubble) and folds the
|
|
1286
|
+
* own-set locally so the default applies immediately to subsequent sends that carry no
|
|
1287
|
+
* per-message expiry. `ttlSeconds === null` DISABLES the default. FIRE-AND-FORGET
|
|
1288
|
+
* ADVISORY: returns on the LOCAL emit only; it exposes NO "active for all peers" signal.
|
|
1289
|
+
* Mirrors iOS `setDisappearing(ttlSeconds:start:)`. */
|
|
1290
|
+
setDisappearing(opts: {
|
|
1291
|
+
ttlSeconds: number | null;
|
|
1292
|
+
start?: 'send' | 'read';
|
|
1293
|
+
}): Promise<void>;
|
|
1065
1294
|
private appendOwnSend;
|
|
1066
1295
|
private materializeIfNeeded;
|
|
1067
1296
|
addMemberUser(userId: string): Promise<void>;
|
|
@@ -1084,8 +1313,11 @@ declare class Chat {
|
|
|
1084
1313
|
* instantly; the durable echo on the next pump is a fold no-op (dedup on the
|
|
1085
1314
|
* SAME wire clientMsgId). Never appends a bubble; PRESERVES the target's
|
|
1086
1315
|
* reactions + reply context. Only the original author's edits count — for an own
|
|
1087
|
-
* message self IS the author, so the author-gate passes.
|
|
1088
|
-
|
|
1316
|
+
* message self IS the author, so the author-gate passes. `opts.mentions` carries the
|
|
1317
|
+
* edit's REPLACEMENT mention ranges → the edited message's mentions reflect them. */
|
|
1318
|
+
edit(message: ChatMessage, newText: string, opts?: {
|
|
1319
|
+
mentions?: MentionRange[];
|
|
1320
|
+
}): Promise<void>;
|
|
1089
1321
|
/** Delete a message for EVERYONE (a cooperative encrypted tombstone). Only the
|
|
1090
1322
|
* ORIGINAL SENDER can do this — for an own message self IS the author, so the
|
|
1091
1323
|
* author-gate passes. Legacy messages (empty clientMsgId) are DISABLED (a
|
|
@@ -1491,4 +1723,4 @@ declare class PalbeAnalytics {
|
|
|
1491
1723
|
private post;
|
|
1492
1724
|
}
|
|
1493
1725
|
|
|
1494
|
-
export { type AnalyticsProperties as A, type
|
|
1726
|
+
export { type AnalyticsProperties as A, type PresenceState as B, Call as C, type RealtimeConnectionState as D, type RealtimeHandler as E, type FlagsView as F, type RealtimePayload as G, type RealtimeStatus as H, type RealtimeStatusSnapshot as I, type RealtimeSubscription as J, type ResolvedMention as K, type ResolvedReply as L, type MagicLinkResult as M, type PalbeRuntime as N, type OAuthExchangeResult as O, PalbeAnalytics as P, buildRuntime as Q, RealtimeChannel as R, type SentReceipt as S, type Unsubscribe as U, type AuthChangeEvent as a, type AuthState as b, type AuthSuccess as c, type AuthUser as d, type CallChangeCallback as e, type CallParticipant as f, type CallState as g, Chat as h, type ChatBackend as i, type ChatDraft as j, type ChatKind as k, type ChatMember as l, type ChatMessage as m, type ChatMessageKind as n, type ChatRole as o, type ChatState as p, type CommsPrefs as q, type MentionRange as r, type MessageDirection as s, PalbeAuth as t, PalbeCalls as u, type PalbeConfig as v, PalbeFlags as w, PalbeMessaging as x, type PalbeOAuthConfig as y, PalbeRealtime as z };
|