@palbase/web 1.6.2 → 1.7.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.d.cts CHANGED
@@ -1,6 +1,6 @@
1
- export { A as AnalyticsProperties, a as AuthChangeEvent, b as AuthState, c as AuthSuccess, d as AuthUser, C as Call, e as CallChangeCallback, f as CallParticipant, g as CallState, h as Chat, i as ChatBackend, j as ChatDraft, k as ChatKind, l as ChatMember, m as ChatMessage, n as ChatMessageKind, o as ChatRole, p as ChatState, q as CommsPrefs, F as FlagsView, M as MagicLinkResult, r as MentionRange, s as MessageDirection, O as OAuthExchangeResult, P as PalbeAnalytics, t as PalbeAuth, u as PalbeCalls, v as PalbeConfig, w as PalbeFlags, x as PalbeMessaging, y as PalbeOAuthConfig, z as PalbeRealtime, B as PresenceState, R as RealtimeChannel, D as RealtimeConnectionState, E as RealtimeHandler, G as RealtimePayload, H as RealtimeStatus, I as RealtimeStatusSnapshot, J as RealtimeSubscription, K as ResolvedMention, L as ResolvedReply, S as SentReceipt, U as Unsubscribe } from './analytics-facade-ATGUv2-f.cjs';
1
+ export { A as AnalyticsProperties, a as AuthChangeEvent, b as AuthState, c as AuthSuccess, d as AuthUser, C as Call, e as CallChangeCallback, f as CallParticipant, g as CallState, h as Chat, i as ChatBackend, j as ChatDraft, k as ChatKind, l as ChatMember, m as ChatMessage, n as ChatMessageKind, o as ChatRole, p as ChatState, q as CommsPrefs, F as FlagsView, M as MagicLinkResult, r as MentionRange, s as MessageDirection, N as NotifyScope, O as OAuthExchangeResult, P as PalbeAnalytics, t as PalbeAuth, u as PalbeCalls, v as PalbeConfig, w as PalbeFlags, x as PalbeMessaging, y as PalbeOAuthConfig, z as PalbeRealtime, B as PresenceState, R as RealtimeChannel, D as RealtimeConnectionState, E as RealtimeHandler, G as RealtimePayload, H as RealtimeStatus, I as RealtimeStatusSnapshot, J as RealtimeSubscription, K as ResolvedMention, L as ResolvedReply, S as SentReceipt, U as UnreadView, Q as Unsubscribe } from './analytics-facade-9GPSKnVG.cjs';
2
2
  export { B as BackendError, a as BackendErrorKind, F as FieldError, i as isBackendError } from './errors-fDoNdTrJ.cjs';
3
- export { C as CallOptions, P as PB, U as UploadOptions, a as UploadProgress, p as pb } from './pb-VzJvX7Gg.cjs';
3
+ export { C as CallOptions, P as PB, U as UploadOptions, a as UploadProgress, p as pb } from './pb-D4HyUbpb.cjs';
4
4
  export { P as PersistedSession, S as SessionStorageAdapter, l as localStorageSessionStorage, m as memorySessionStorage } from './storage-BPaeSG8K.cjs';
5
5
  export { F as FlagValue } from './pooled-flags-Bwq4usn0.js';
6
6
  import 'livekit-client';
@@ -207,6 +207,6 @@ interface MlsGlue {
207
207
  */
208
208
  declare function initMls(): Promise<MlsGlue>;
209
209
 
210
- declare const VERSION = "1.6.2";
210
+ declare const VERSION = "1.7.0";
211
211
 
212
212
  export { VERSION, initMls };
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
- export { A as AnalyticsProperties, a as AuthChangeEvent, b as AuthState, c as AuthSuccess, d as AuthUser, C as Call, e as CallChangeCallback, f as CallParticipant, g as CallState, h as Chat, i as ChatBackend, j as ChatDraft, k as ChatKind, l as ChatMember, m as ChatMessage, n as ChatMessageKind, o as ChatRole, p as ChatState, q as CommsPrefs, F as FlagsView, M as MagicLinkResult, r as MentionRange, s as MessageDirection, O as OAuthExchangeResult, P as PalbeAnalytics, t as PalbeAuth, u as PalbeCalls, v as PalbeConfig, w as PalbeFlags, x as PalbeMessaging, y as PalbeOAuthConfig, z as PalbeRealtime, B as PresenceState, R as RealtimeChannel, D as RealtimeConnectionState, E as RealtimeHandler, G as RealtimePayload, H as RealtimeStatus, I as RealtimeStatusSnapshot, J as RealtimeSubscription, K as ResolvedMention, L as ResolvedReply, S as SentReceipt, U as Unsubscribe } from './analytics-facade-DhcTP_kw.js';
1
+ export { A as AnalyticsProperties, a as AuthChangeEvent, b as AuthState, c as AuthSuccess, d as AuthUser, C as Call, e as CallChangeCallback, f as CallParticipant, g as CallState, h as Chat, i as ChatBackend, j as ChatDraft, k as ChatKind, l as ChatMember, m as ChatMessage, n as ChatMessageKind, o as ChatRole, p as ChatState, q as CommsPrefs, F as FlagsView, M as MagicLinkResult, r as MentionRange, s as MessageDirection, N as NotifyScope, O as OAuthExchangeResult, P as PalbeAnalytics, t as PalbeAuth, u as PalbeCalls, v as PalbeConfig, w as PalbeFlags, x as PalbeMessaging, y as PalbeOAuthConfig, z as PalbeRealtime, B as PresenceState, R as RealtimeChannel, D as RealtimeConnectionState, E as RealtimeHandler, G as RealtimePayload, H as RealtimeStatus, I as RealtimeStatusSnapshot, J as RealtimeSubscription, K as ResolvedMention, L as ResolvedReply, S as SentReceipt, U as UnreadView, Q as Unsubscribe } from './analytics-facade-CQJ3b-zB.js';
2
2
  export { B as BackendError, a as BackendErrorKind, F as FieldError, i as isBackendError } from './errors-fDoNdTrJ.js';
3
- export { C as CallOptions, P as PB, U as UploadOptions, a as UploadProgress, p as pb } from './pb-TAUNVyT6.js';
3
+ export { C as CallOptions, P as PB, U as UploadOptions, a as UploadProgress, p as pb } from './pb-BvfCJZux.js';
4
4
  export { P as PersistedSession, S as SessionStorageAdapter, l as localStorageSessionStorage, m as memorySessionStorage } from './storage-BPaeSG8K.js';
5
5
  export { F as FlagValue } from './pooled-flags-Bwq4usn0.js';
6
6
  import 'livekit-client';
@@ -207,6 +207,6 @@ interface MlsGlue {
207
207
  */
208
208
  declare function initMls(): Promise<MlsGlue>;
209
209
 
210
- declare const VERSION = "1.6.2";
210
+ declare const VERSION = "1.7.0";
211
211
 
212
212
  export { VERSION, initMls };
package/dist/index.js CHANGED
@@ -13,7 +13,7 @@ import {
13
13
  localStorageSessionStorage,
14
14
  memorySessionStorage,
15
15
  pb
16
- } from "./chunk-XQZ53URR.js";
16
+ } from "./chunk-QRO632M7.js";
17
17
  export {
18
18
  BackendError,
19
19
  PalbeAnalytics,
package/dist/internal.cjs CHANGED
@@ -2905,6 +2905,10 @@ var MessagingPaths = {
2905
2905
  groupMessages: (displayId) => `${GROUPS}/${seg(displayId)}/messages`,
2906
2906
  groupCommits: (displayId) => `${GROUPS}/${seg(displayId)}/commits`,
2907
2907
  groupRead: (displayId) => `${GROUPS}/${seg(displayId)}/read`,
2908
+ // Server-metadata cluster: the per-(user,group) notify scope (mute toggle, GET/PUT)
2909
+ // + the caller's own unread view (GET). {gid} is the grp_ display_id (M3 #7).
2910
+ groupNotify: (displayId) => `${GROUPS}/${seg(displayId)}/notify`,
2911
+ groupUnread: (displayId) => `${GROUPS}/${seg(displayId)}/unread`,
2908
2912
  deviceWelcomes: (deviceId) => `${DEVICES}/${seg(deviceId)}/welcomes`,
2909
2913
  deviceQueue: (deviceId) => `${DEVICES}/${seg(deviceId)}/queue`,
2910
2914
  deviceQueueAck: (deviceId) => `${DEVICES}/${seg(deviceId)}/queue/ack`,
@@ -4483,6 +4487,18 @@ var Chat = class {
4483
4487
  lastSeenAt: ts ? new Date(ts * 1e3) : null
4484
4488
  });
4485
4489
  this.emit();
4490
+ } else if (event === "delivered" || event === "read") {
4491
+ const seq = typeof payload.up_to_server_seq === "number" ? payload.up_to_server_seq : null;
4492
+ if (seq === null) return;
4493
+ let changed = false;
4494
+ this.messageList = this.messageList.map((m) => {
4495
+ if (m.direction !== "outgoing" || m.serverSeq > seq) return m;
4496
+ const cur = event === "delivered" ? m.deliveredUpTo ?? -1 : m.readUpTo ?? -1;
4497
+ if (seq <= cur) return m;
4498
+ changed = true;
4499
+ return event === "delivered" ? { ...m, deliveredUpTo: seq } : { ...m, readUpTo: seq };
4500
+ });
4501
+ if (changed) this.emit();
4486
4502
  }
4487
4503
  }
4488
4504
  kindOf(incoming) {
@@ -4731,6 +4747,31 @@ var Chat = class {
4731
4747
  this.readWatermark = Math.max(this.readWatermark, message.serverSeq);
4732
4748
  this.emit();
4733
4749
  }
4750
+ // ── Server-metadata cluster: notify scope (mute) + server unread ──
4751
+ /** Set this chat's notify scope (the mute toggle). `'none'` mutes the push wake;
4752
+ * `'all'` unmutes (the default). Materializes a draft first (the scope is a
4753
+ * per-(user,group) server row), PUTs `/notify`, and returns the server-echoed scope.
4754
+ * Mirrors iOS `Chat.setNotifyScope`. */
4755
+ async setNotifyScope(scope) {
4756
+ const group = await this.materializeIfNeeded();
4757
+ return this.backend.setNotifyScope(group, scope);
4758
+ }
4759
+ /** Refresh + return this chat's notify scope from the server (fail-OPEN to `'all'`).
4760
+ * Returns `'all'` for a draft chat (no server row yet). */
4761
+ async getNotifyScope() {
4762
+ if (!this._group) return "all";
4763
+ return this.backend.getNotifyScope(this._group);
4764
+ }
4765
+ /** Fetch the caller's authoritative SERVER unread count (opaque server metadata).
4766
+ * Returns the clamped count (`max(0, …)`); `0` for a draft chat. The local computed
4767
+ * `unreadCount` getter stays the instant, offline best-effort badge — this is the
4768
+ * canonical count on demand. Named distinctly so it does not shadow the observable
4769
+ * `unreadCount` snapshot getter. Mirrors iOS `Chat.refreshUnread`. */
4770
+ async unreadCountFromServer() {
4771
+ if (!this._group) return 0;
4772
+ const v = await this.backend.unread(this._group);
4773
+ return Math.max(0, v.unreadCount);
4774
+ }
4734
4775
  // ── Reactions ──
4735
4776
  /** Add an emoji reaction to a message. No-op if the message isn't reactable
4736
4777
  * (empty clientMsgId — a legacy/system row). The reaction folds locally with
@@ -5169,7 +5210,7 @@ var MessageDeliverySource = class {
5169
5210
  if (this.observed.has(group.displayId)) return;
5170
5211
  try {
5171
5212
  const channel = this.rt.realtime.channel(`messaging:conv:${group.rfcGroupId}`);
5172
- const subs = ["presence", "typing", "read"].map(
5213
+ const subs = ["presence", "typing", "read", "delivered"].map(
5173
5214
  (ev) => channel.on(ev, (payload) => {
5174
5215
  this.hub.emitConv(group.displayId, { event: ev, payload });
5175
5216
  })
@@ -5209,6 +5250,40 @@ var MessageDeliverySource = class {
5209
5250
  body: { read_seq: upToServerSeq, read_epoch: group.currentEpoch, is_private: false }
5210
5251
  });
5211
5252
  }
5253
+ // ── Server-metadata cluster: notify scope (mute) + unread (HTTP) ──
5254
+ /** PUT `/v1/messaging/groups/{gid}/notify` — set the caller's per-(user,group) notify
5255
+ * scope (`'all'`|`'none'`). The server stores the opaque enum verbatim and stays blind.
5256
+ * Returns the server-echoed scope (fail-OPEN to `'all'` on an unknown value). */
5257
+ async setNotifyScope(group, scope) {
5258
+ const res = await palbeRequest(
5259
+ this.rt,
5260
+ "PUT",
5261
+ MessagingPaths.groupNotify(group.displayId),
5262
+ { body: { notify_scope: scope } }
5263
+ );
5264
+ return res.notify_scope === "none" ? "none" : "all";
5265
+ }
5266
+ /** GET `/v1/messaging/groups/{gid}/notify` — the caller's notify scope. An absent
5267
+ * server row / unknown value reads as `'all'` (fail-OPEN — never silently mutes). */
5268
+ async getNotifyScope(group) {
5269
+ const res = await palbeRequest(
5270
+ this.rt,
5271
+ "GET",
5272
+ MessagingPaths.groupNotify(group.displayId)
5273
+ );
5274
+ return res.notify_scope === "none" ? "none" : "all";
5275
+ }
5276
+ /** GET `/v1/messaging/groups/{gid}/unread` — the caller's OWN unread view (opaque
5277
+ * server metadata). Maps the snake_case wire → the camelCase `UnreadView`. */
5278
+ async unread(group) {
5279
+ const res = await palbeRequest(this.rt, "GET", MessagingPaths.groupUnread(group.displayId));
5280
+ return {
5281
+ groupMaxSeq: res.group_max_seq,
5282
+ lastReadSeq: res.last_read_seq,
5283
+ deliveredSeq: res.delivered_seq,
5284
+ unreadCount: res.unread_count
5285
+ };
5286
+ }
5212
5287
  };
5213
5288
  function isOwnEchoOrConsumed(e) {
5214
5289
  const msg = e instanceof Error ? e.message : String(e);
@@ -7366,6 +7441,19 @@ var MessagingCoordinator = class {
7366
7441
  const r = await this.resolve();
7367
7442
  await r.source.markRead(group, upToServerSeq);
7368
7443
  }
7444
+ // ── Server-metadata cluster: notify scope (mute) + unread ──
7445
+ async setNotifyScope(group, scope) {
7446
+ const r = await this.resolve();
7447
+ return r.source.setNotifyScope(group, scope);
7448
+ }
7449
+ async getNotifyScope(group) {
7450
+ const r = await this.resolve();
7451
+ return r.source.getNotifyScope(group);
7452
+ }
7453
+ async unread(group) {
7454
+ const r = await this.resolve();
7455
+ return r.source.unread(group);
7456
+ }
7369
7457
  subscribeLive(group, chat) {
7370
7458
  let offMsg = null;
7371
7459
  let offConv = null;
@@ -8305,7 +8393,7 @@ function defaultSessionStorage(key) {
8305
8393
  }
8306
8394
 
8307
8395
  // src/version.ts
8308
- var VERSION = "1.6.2";
8396
+ var VERSION = "1.7.0";
8309
8397
 
8310
8398
  // src/runtime.ts
8311
8399
  function buildRuntime(config) {