@palbase/web 1.6.0 → 1.6.1

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.
@@ -1281,6 +1281,14 @@ declare class Chat {
1281
1281
  start?: 'send' | 'read';
1282
1282
  };
1283
1283
  }): Promise<SentReceipt>;
1284
+ /** Resolve a send's effective per-message expiry at COMPOSE TIME: the caller's explicit
1285
+ * `expiresIn` if present, ELSE the chat's active default timer stamped onto the message
1286
+ * NOW (the durable record per spec §"Compose-time stamping"). A `send`-anchored expiry
1287
+ * (explicit or default-inherited) stamps `senderSendTs` = the sender's compose epoch
1288
+ * seconds; a `read`-anchored one carries none (the deadline is the recipient's local
1289
+ * first-read). Returns null when there is neither an explicit expiry nor an active
1290
+ * default (a plain, non-disappearing send). Mirrors the iOS compose-time stamping. */
1291
+ private composeExpiry;
1284
1292
  /** Set (or DISABLE) this chat's DEFAULT disappearing timer. Emits a `timer_set` control
1285
1293
  * envelope (server-blind — an opaque application message, NEVER a bubble) and folds the
1286
1294
  * own-set locally so the default applies immediately to subsequent sends that carry no
@@ -1281,6 +1281,14 @@ declare class Chat {
1281
1281
  start?: 'send' | 'read';
1282
1282
  };
1283
1283
  }): Promise<SentReceipt>;
1284
+ /** Resolve a send's effective per-message expiry at COMPOSE TIME: the caller's explicit
1285
+ * `expiresIn` if present, ELSE the chat's active default timer stamped onto the message
1286
+ * NOW (the durable record per spec §"Compose-time stamping"). A `send`-anchored expiry
1287
+ * (explicit or default-inherited) stamps `senderSendTs` = the sender's compose epoch
1288
+ * seconds; a `read`-anchored one carries none (the deadline is the recipient's local
1289
+ * first-read). Returns null when there is neither an explicit expiry nor an active
1290
+ * default (a plain, non-disappearing send). Mirrors the iOS compose-time stamping. */
1291
+ private composeExpiry;
1284
1292
  /** Set (or DISABLE) this chat's DEFAULT disappearing timer. Emits a `timer_set` control
1285
1293
  * envelope (server-blind — an opaque application message, NEVER a bubble) and folds the
1286
1294
  * own-set locally so the default applies immediately to subsequent sends that carry no
@@ -4574,24 +4574,38 @@ var Chat = class {
4574
4574
  resolvedReplyTo = resolveReply(replyRef, (id) => this.byClientMsgId.get(id) ?? null);
4575
4575
  }
4576
4576
  const bodyRanges = opts?.mentions ?? null;
4577
- const start = opts?.expiresIn?.start ?? "send";
4578
- const expiry = opts?.expiresIn ? {
4579
- v: 1,
4580
- ttlSeconds: opts.expiresIn.ttlSeconds,
4581
- start,
4582
- senderSendTs: start === "send" ? Math.floor(Date.now() / 1e3) : null
4583
- } : null;
4577
+ const effectiveExpiry = this.composeExpiry(opts?.expiresIn);
4584
4578
  const { receipt, clientMsgId } = await this.backend.sendText(
4585
4579
  group,
4586
4580
  text,
4587
4581
  replyRef,
4588
4582
  bodyRanges,
4589
- expiry
4583
+ effectiveExpiry
4590
4584
  );
4591
- this.appendOwnSend(text, receipt, clientMsgId, resolvedReplyTo, bodyRanges);
4592
- if (expiry) void this.armPurge(expiry, receipt.serverSeq, clientMsgId);
4585
+ this.appendOwnSend(text, receipt, clientMsgId, resolvedReplyTo, bodyRanges, effectiveExpiry);
4586
+ if (effectiveExpiry) void this.armPurge(effectiveExpiry, receipt.serverSeq, clientMsgId);
4593
4587
  return receipt;
4594
4588
  }
4589
+ /** Resolve a send's effective per-message expiry at COMPOSE TIME: the caller's explicit
4590
+ * `expiresIn` if present, ELSE the chat's active default timer stamped onto the message
4591
+ * NOW (the durable record per spec §"Compose-time stamping"). A `send`-anchored expiry
4592
+ * (explicit or default-inherited) stamps `senderSendTs` = the sender's compose epoch
4593
+ * seconds; a `read`-anchored one carries none (the deadline is the recipient's local
4594
+ * first-read). Returns null when there is neither an explicit expiry nor an active
4595
+ * default (a plain, non-disappearing send). Mirrors the iOS compose-time stamping. */
4596
+ composeExpiry(explicit) {
4597
+ const base = explicit ? {
4598
+ v: 1,
4599
+ ttlSeconds: explicit.ttlSeconds,
4600
+ start: explicit.start ?? "send",
4601
+ senderSendTs: null
4602
+ } : this.defaultExpiry();
4603
+ if (!base) return null;
4604
+ return {
4605
+ ...base,
4606
+ senderSendTs: base.start === "send" ? Math.floor(Date.now() / 1e3) : null
4607
+ };
4608
+ }
4595
4609
  /** Set (or DISABLE) this chat's DEFAULT disappearing timer. Emits a `timer_set` control
4596
4610
  * envelope (server-blind — an opaque application message, NEVER a bubble) and folds the
4597
4611
  * own-set locally so the default applies immediately to subsequent sends that carry no
@@ -4616,7 +4630,7 @@ var Chat = class {
4616
4630
  eventClientMsgId: clientMsgId
4617
4631
  });
4618
4632
  }
4619
- appendOwnSend(text, receipt, clientMsgId, resolvedReplyTo, bodyRanges) {
4633
+ appendOwnSend(text, receipt, clientMsgId, resolvedReplyTo, bodyRanges, expiry) {
4620
4634
  if (receipt.serverSeq <= 0) return;
4621
4635
  const key = this.internalKey(receipt.serverSeq);
4622
4636
  if (this.seenKeys.has(key)) return;
@@ -4645,9 +4659,11 @@ var Chat = class {
4645
4659
  // Mentions T6: resolve the own-sent bubble's mentions for its own render (the
4646
4660
  // sender never gets a wire echo of its own message — this is the only local copy).
4647
4661
  mentions: this.resolveMentions(text, bodyRanges),
4648
- // Disappearing T10: the surfaced deadline is set by armPurge (own-send with a TTL)
4649
- // via the messageList overlay; default null here (a plain own-send has no deadline).
4650
- expiresAt: null
4662
+ // Disappearing T10: the surfaced deadline reflects the message's effective expiry
4663
+ // (explicit `expiresIn` OR the chat default stamped at compose time). null only when
4664
+ // this send is non-disappearing. armPurge re-derives the durable monotonic deadline;
4665
+ // this is the immediate UI countdown baseline (own sender and receiver are symmetric).
4666
+ expiresAt: this.deadlineFor(expiry ?? null)
4651
4667
  });
4652
4668
  this.messageList.sort((a, b) => a.serverSeq - b.serverSeq);
4653
4669
  this.emit();
@@ -8267,7 +8283,7 @@ function defaultSessionStorage(key) {
8267
8283
  }
8268
8284
 
8269
8285
  // src/version.ts
8270
- var VERSION = "1.6.0";
8286
+ var VERSION = "1.6.1";
8271
8287
 
8272
8288
  // src/runtime.ts
8273
8289
  function buildRuntime(config) {
@@ -8627,4 +8643,4 @@ export {
8627
8643
  pb,
8628
8644
  createBoundClient
8629
8645
  };
8630
- //# sourceMappingURL=chunk-A5WIPBGQ.js.map
8646
+ //# sourceMappingURL=chunk-EQAHM3ZJ.js.map