@palbase/web 1.6.0 → 1.6.2

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.
@@ -7,7 +7,7 @@ import {
7
7
  __configure,
8
8
  endpointRefFromApiKey,
9
9
  getRuntime
10
- } from "../chunk-A5WIPBGQ.js";
10
+ } from "../chunk-XQZ53URR.js";
11
11
 
12
12
  // src/next/client.ts
13
13
  var SESSION_MAX_AGE_S = 2592e3;
@@ -4611,24 +4611,38 @@ var Chat = class {
4611
4611
  resolvedReplyTo = resolveReply(replyRef, (id) => this.byClientMsgId.get(id) ?? null);
4612
4612
  }
4613
4613
  const bodyRanges = opts?.mentions ?? null;
4614
- const start = opts?.expiresIn?.start ?? "send";
4615
- const expiry = opts?.expiresIn ? {
4616
- v: 1,
4617
- ttlSeconds: opts.expiresIn.ttlSeconds,
4618
- start,
4619
- senderSendTs: start === "send" ? Math.floor(Date.now() / 1e3) : null
4620
- } : null;
4614
+ const effectiveExpiry = this.composeExpiry(opts?.expiresIn);
4621
4615
  const { receipt, clientMsgId } = await this.backend.sendText(
4622
4616
  group,
4623
4617
  text,
4624
4618
  replyRef,
4625
4619
  bodyRanges,
4626
- expiry
4620
+ effectiveExpiry
4627
4621
  );
4628
- this.appendOwnSend(text, receipt, clientMsgId, resolvedReplyTo, bodyRanges);
4629
- if (expiry) void this.armPurge(expiry, receipt.serverSeq, clientMsgId);
4622
+ this.appendOwnSend(text, receipt, clientMsgId, resolvedReplyTo, bodyRanges, effectiveExpiry);
4623
+ if (effectiveExpiry) void this.armPurge(effectiveExpiry, receipt.serverSeq, clientMsgId);
4630
4624
  return receipt;
4631
4625
  }
4626
+ /** Resolve a send's effective per-message expiry at COMPOSE TIME: the caller's explicit
4627
+ * `expiresIn` if present, ELSE the chat's active default timer stamped onto the message
4628
+ * NOW (the durable record per spec §"Compose-time stamping"). A `send`-anchored expiry
4629
+ * (explicit or default-inherited) stamps `senderSendTs` = the sender's compose epoch
4630
+ * seconds; a `read`-anchored one carries none (the deadline is the recipient's local
4631
+ * first-read). Returns null when there is neither an explicit expiry nor an active
4632
+ * default (a plain, non-disappearing send). Mirrors the iOS compose-time stamping. */
4633
+ composeExpiry(explicit) {
4634
+ const base = explicit ? {
4635
+ v: 1,
4636
+ ttlSeconds: explicit.ttlSeconds,
4637
+ start: explicit.start ?? "send",
4638
+ senderSendTs: null
4639
+ } : this.defaultExpiry();
4640
+ if (!base) return null;
4641
+ return {
4642
+ ...base,
4643
+ senderSendTs: base.start === "send" ? Math.floor(Date.now() / 1e3) : null
4644
+ };
4645
+ }
4632
4646
  /** Set (or DISABLE) this chat's DEFAULT disappearing timer. Emits a `timer_set` control
4633
4647
  * envelope (server-blind — an opaque application message, NEVER a bubble) and folds the
4634
4648
  * own-set locally so the default applies immediately to subsequent sends that carry no
@@ -4653,7 +4667,7 @@ var Chat = class {
4653
4667
  eventClientMsgId: clientMsgId
4654
4668
  });
4655
4669
  }
4656
- appendOwnSend(text, receipt, clientMsgId, resolvedReplyTo, bodyRanges) {
4670
+ appendOwnSend(text, receipt, clientMsgId, resolvedReplyTo, bodyRanges, expiry) {
4657
4671
  if (receipt.serverSeq <= 0) return;
4658
4672
  const key = this.internalKey(receipt.serverSeq);
4659
4673
  if (this.seenKeys.has(key)) return;
@@ -4682,9 +4696,11 @@ var Chat = class {
4682
4696
  // Mentions T6: resolve the own-sent bubble's mentions for its own render (the
4683
4697
  // sender never gets a wire echo of its own message — this is the only local copy).
4684
4698
  mentions: this.resolveMentions(text, bodyRanges),
4685
- // Disappearing T10: the surfaced deadline is set by armPurge (own-send with a TTL)
4686
- // via the messageList overlay; default null here (a plain own-send has no deadline).
4687
- expiresAt: null
4699
+ // Disappearing T10: the surfaced deadline reflects the message's effective expiry
4700
+ // (explicit `expiresIn` OR the chat default stamped at compose time). null only when
4701
+ // this send is non-disappearing. armPurge re-derives the durable monotonic deadline;
4702
+ // this is the immediate UI countdown baseline (own sender and receiver are symmetric).
4703
+ expiresAt: this.deadlineFor(expiry ?? null)
4688
4704
  });
4689
4705
  this.messageList.sort((a, b) => a.serverSeq - b.serverSeq);
4690
4706
  this.emit();
@@ -7263,9 +7279,9 @@ var MessagingCoordinator = class {
7263
7279
  });
7264
7280
  return group;
7265
7281
  }
7266
- async sendText(group, text, replyTo, bodyRanges) {
7282
+ async sendText(group, text, replyTo, bodyRanges, expiry) {
7267
7283
  const r = await this.resolve();
7268
- return r.groups.sendText(group, text, replyTo, bodyRanges);
7284
+ return r.groups.sendText(group, text, replyTo, bodyRanges, expiry);
7269
7285
  }
7270
7286
  async sendReaction(group, args) {
7271
7287
  const r = await this.resolve();
@@ -8305,7 +8321,7 @@ function defaultSessionStorage(key) {
8305
8321
  }
8306
8322
 
8307
8323
  // src/version.ts
8308
- var VERSION = "1.6.0";
8324
+ var VERSION = "1.6.2";
8309
8325
 
8310
8326
  // src/runtime.ts
8311
8327
  function buildRuntime(config) {