@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/{analytics-facade-ATGUv2-f.d.cts → analytics-facade-9GPSKnVG.d.cts} +64 -2
- package/dist/{analytics-facade-DhcTP_kw.d.ts → analytics-facade-CQJ3b-zB.d.ts} +64 -2
- package/dist/{chunk-XQZ53URR.js → chunk-QRO632M7.js} +91 -3
- package/dist/chunk-QRO632M7.js.map +1 -0
- package/dist/index.cjs +90 -2
- 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 +90 -2
- 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 +90 -2
- package/dist/next/client.cjs.map +1 -1
- package/dist/next/client.js +1 -1
- package/dist/next/index.cjs +90 -2
- 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-TAUNVyT6.d.ts → pb-BvfCJZux.d.ts} +1 -1
- package/dist/{pb-VzJvX7Gg.d.cts → pb-D4HyUbpb.d.cts} +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 +3 -3
- package/dist/chunk-XQZ53URR.js.map +0 -1
package/dist/next/client.js
CHANGED
package/dist/next/index.cjs
CHANGED
|
@@ -2921,6 +2921,10 @@ var MessagingPaths = {
|
|
|
2921
2921
|
groupMessages: (displayId) => `${GROUPS}/${seg(displayId)}/messages`,
|
|
2922
2922
|
groupCommits: (displayId) => `${GROUPS}/${seg(displayId)}/commits`,
|
|
2923
2923
|
groupRead: (displayId) => `${GROUPS}/${seg(displayId)}/read`,
|
|
2924
|
+
// Server-metadata cluster: the per-(user,group) notify scope (mute toggle, GET/PUT)
|
|
2925
|
+
// + the caller's own unread view (GET). {gid} is the grp_ display_id (M3 #7).
|
|
2926
|
+
groupNotify: (displayId) => `${GROUPS}/${seg(displayId)}/notify`,
|
|
2927
|
+
groupUnread: (displayId) => `${GROUPS}/${seg(displayId)}/unread`,
|
|
2924
2928
|
deviceWelcomes: (deviceId) => `${DEVICES}/${seg(deviceId)}/welcomes`,
|
|
2925
2929
|
deviceQueue: (deviceId) => `${DEVICES}/${seg(deviceId)}/queue`,
|
|
2926
2930
|
deviceQueueAck: (deviceId) => `${DEVICES}/${seg(deviceId)}/queue/ack`,
|
|
@@ -4499,6 +4503,18 @@ var Chat = class {
|
|
|
4499
4503
|
lastSeenAt: ts ? new Date(ts * 1e3) : null
|
|
4500
4504
|
});
|
|
4501
4505
|
this.emit();
|
|
4506
|
+
} else if (event === "delivered" || event === "read") {
|
|
4507
|
+
const seq = typeof payload.up_to_server_seq === "number" ? payload.up_to_server_seq : null;
|
|
4508
|
+
if (seq === null) return;
|
|
4509
|
+
let changed = false;
|
|
4510
|
+
this.messageList = this.messageList.map((m) => {
|
|
4511
|
+
if (m.direction !== "outgoing" || m.serverSeq > seq) return m;
|
|
4512
|
+
const cur = event === "delivered" ? m.deliveredUpTo ?? -1 : m.readUpTo ?? -1;
|
|
4513
|
+
if (seq <= cur) return m;
|
|
4514
|
+
changed = true;
|
|
4515
|
+
return event === "delivered" ? { ...m, deliveredUpTo: seq } : { ...m, readUpTo: seq };
|
|
4516
|
+
});
|
|
4517
|
+
if (changed) this.emit();
|
|
4502
4518
|
}
|
|
4503
4519
|
}
|
|
4504
4520
|
kindOf(incoming) {
|
|
@@ -4747,6 +4763,31 @@ var Chat = class {
|
|
|
4747
4763
|
this.readWatermark = Math.max(this.readWatermark, message.serverSeq);
|
|
4748
4764
|
this.emit();
|
|
4749
4765
|
}
|
|
4766
|
+
// ── Server-metadata cluster: notify scope (mute) + server unread ──
|
|
4767
|
+
/** Set this chat's notify scope (the mute toggle). `'none'` mutes the push wake;
|
|
4768
|
+
* `'all'` unmutes (the default). Materializes a draft first (the scope is a
|
|
4769
|
+
* per-(user,group) server row), PUTs `/notify`, and returns the server-echoed scope.
|
|
4770
|
+
* Mirrors iOS `Chat.setNotifyScope`. */
|
|
4771
|
+
async setNotifyScope(scope) {
|
|
4772
|
+
const group = await this.materializeIfNeeded();
|
|
4773
|
+
return this.backend.setNotifyScope(group, scope);
|
|
4774
|
+
}
|
|
4775
|
+
/** Refresh + return this chat's notify scope from the server (fail-OPEN to `'all'`).
|
|
4776
|
+
* Returns `'all'` for a draft chat (no server row yet). */
|
|
4777
|
+
async getNotifyScope() {
|
|
4778
|
+
if (!this._group) return "all";
|
|
4779
|
+
return this.backend.getNotifyScope(this._group);
|
|
4780
|
+
}
|
|
4781
|
+
/** Fetch the caller's authoritative SERVER unread count (opaque server metadata).
|
|
4782
|
+
* Returns the clamped count (`max(0, …)`); `0` for a draft chat. The local computed
|
|
4783
|
+
* `unreadCount` getter stays the instant, offline best-effort badge — this is the
|
|
4784
|
+
* canonical count on demand. Named distinctly so it does not shadow the observable
|
|
4785
|
+
* `unreadCount` snapshot getter. Mirrors iOS `Chat.refreshUnread`. */
|
|
4786
|
+
async unreadCountFromServer() {
|
|
4787
|
+
if (!this._group) return 0;
|
|
4788
|
+
const v = await this.backend.unread(this._group);
|
|
4789
|
+
return Math.max(0, v.unreadCount);
|
|
4790
|
+
}
|
|
4750
4791
|
// ── Reactions ──
|
|
4751
4792
|
/** Add an emoji reaction to a message. No-op if the message isn't reactable
|
|
4752
4793
|
* (empty clientMsgId — a legacy/system row). The reaction folds locally with
|
|
@@ -5185,7 +5226,7 @@ var MessageDeliverySource = class {
|
|
|
5185
5226
|
if (this.observed.has(group.displayId)) return;
|
|
5186
5227
|
try {
|
|
5187
5228
|
const channel = this.rt.realtime.channel(`messaging:conv:${group.rfcGroupId}`);
|
|
5188
|
-
const subs = ["presence", "typing", "read"].map(
|
|
5229
|
+
const subs = ["presence", "typing", "read", "delivered"].map(
|
|
5189
5230
|
(ev) => channel.on(ev, (payload) => {
|
|
5190
5231
|
this.hub.emitConv(group.displayId, { event: ev, payload });
|
|
5191
5232
|
})
|
|
@@ -5225,6 +5266,40 @@ var MessageDeliverySource = class {
|
|
|
5225
5266
|
body: { read_seq: upToServerSeq, read_epoch: group.currentEpoch, is_private: false }
|
|
5226
5267
|
});
|
|
5227
5268
|
}
|
|
5269
|
+
// ── Server-metadata cluster: notify scope (mute) + unread (HTTP) ──
|
|
5270
|
+
/** PUT `/v1/messaging/groups/{gid}/notify` — set the caller's per-(user,group) notify
|
|
5271
|
+
* scope (`'all'`|`'none'`). The server stores the opaque enum verbatim and stays blind.
|
|
5272
|
+
* Returns the server-echoed scope (fail-OPEN to `'all'` on an unknown value). */
|
|
5273
|
+
async setNotifyScope(group, scope) {
|
|
5274
|
+
const res = await palbeRequest(
|
|
5275
|
+
this.rt,
|
|
5276
|
+
"PUT",
|
|
5277
|
+
MessagingPaths.groupNotify(group.displayId),
|
|
5278
|
+
{ body: { notify_scope: scope } }
|
|
5279
|
+
);
|
|
5280
|
+
return res.notify_scope === "none" ? "none" : "all";
|
|
5281
|
+
}
|
|
5282
|
+
/** GET `/v1/messaging/groups/{gid}/notify` — the caller's notify scope. An absent
|
|
5283
|
+
* server row / unknown value reads as `'all'` (fail-OPEN — never silently mutes). */
|
|
5284
|
+
async getNotifyScope(group) {
|
|
5285
|
+
const res = await palbeRequest(
|
|
5286
|
+
this.rt,
|
|
5287
|
+
"GET",
|
|
5288
|
+
MessagingPaths.groupNotify(group.displayId)
|
|
5289
|
+
);
|
|
5290
|
+
return res.notify_scope === "none" ? "none" : "all";
|
|
5291
|
+
}
|
|
5292
|
+
/** GET `/v1/messaging/groups/{gid}/unread` — the caller's OWN unread view (opaque
|
|
5293
|
+
* server metadata). Maps the snake_case wire → the camelCase `UnreadView`. */
|
|
5294
|
+
async unread(group) {
|
|
5295
|
+
const res = await palbeRequest(this.rt, "GET", MessagingPaths.groupUnread(group.displayId));
|
|
5296
|
+
return {
|
|
5297
|
+
groupMaxSeq: res.group_max_seq,
|
|
5298
|
+
lastReadSeq: res.last_read_seq,
|
|
5299
|
+
deliveredSeq: res.delivered_seq,
|
|
5300
|
+
unreadCount: res.unread_count
|
|
5301
|
+
};
|
|
5302
|
+
}
|
|
5228
5303
|
};
|
|
5229
5304
|
function isOwnEchoOrConsumed(e) {
|
|
5230
5305
|
const msg = e instanceof Error ? e.message : String(e);
|
|
@@ -7382,6 +7457,19 @@ var MessagingCoordinator = class {
|
|
|
7382
7457
|
const r = await this.resolve();
|
|
7383
7458
|
await r.source.markRead(group, upToServerSeq);
|
|
7384
7459
|
}
|
|
7460
|
+
// ── Server-metadata cluster: notify scope (mute) + unread ──
|
|
7461
|
+
async setNotifyScope(group, scope) {
|
|
7462
|
+
const r = await this.resolve();
|
|
7463
|
+
return r.source.setNotifyScope(group, scope);
|
|
7464
|
+
}
|
|
7465
|
+
async getNotifyScope(group) {
|
|
7466
|
+
const r = await this.resolve();
|
|
7467
|
+
return r.source.getNotifyScope(group);
|
|
7468
|
+
}
|
|
7469
|
+
async unread(group) {
|
|
7470
|
+
const r = await this.resolve();
|
|
7471
|
+
return r.source.unread(group);
|
|
7472
|
+
}
|
|
7385
7473
|
subscribeLive(group, chat) {
|
|
7386
7474
|
let offMsg = null;
|
|
7387
7475
|
let offConv = null;
|
|
@@ -8321,7 +8409,7 @@ function defaultSessionStorage(key) {
|
|
|
8321
8409
|
}
|
|
8322
8410
|
|
|
8323
8411
|
// src/version.ts
|
|
8324
|
-
var VERSION = "1.
|
|
8412
|
+
var VERSION = "1.7.0";
|
|
8325
8413
|
|
|
8326
8414
|
// src/runtime.ts
|
|
8327
8415
|
function buildRuntime(config) {
|