@paramms/chat-widget 1.0.32 → 1.0.33

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.ts CHANGED
@@ -21,6 +21,12 @@ export interface MountOptions {
21
21
  apiUrl?: string;
22
22
  profileId: string;
23
23
  subjectId?: string;
24
+ /** Open a user↔user direct conversation with `peerId` instead of a support
25
+ * thread. Requires signed identity on the chatroom (both `kind: 'direct'`
26
+ * and `peerId` together; `subjectId` is ignored — the server derives the
27
+ * symmetric DM key so both sides land in the SAME conversation). */
28
+ kind?: 'direct';
29
+ peerId?: string;
24
30
  /** IDENTITY (tiered — the host owns identity, the widget never has to persist it):
25
31
  * 1. `token` — a signed identity token. Either a capability token, or (recommended
26
32
  * for embedders) an ES256 JWT `{sub,iat,exp}` signed by your backend with the
package/dist/index.js CHANGED
@@ -2,9 +2,10 @@ var ce = Object.defineProperty;
2
2
  var de = (t, e, n) => e in t ? ce(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n;
3
3
  var m = (t, e, n) => de(t, typeof e != "symbol" ? e + "" : e, n);
4
4
  import { p as le, r as pe, a as ue } from "./uid.js";
5
- import { h as $e } from "./uid.js";
6
- import { P as fe, C as he, E as we, b as be, m as xe } from "./e2e.js";
7
- import { e as Me } from "./e2e.js";
5
+ import { h as Be } from "./uid.js";
6
+ import { P as fe, C as he, b as we } from "./outbox.js";
7
+ import { e as qe } from "./outbox.js";
8
+ import { E2ESession as be, extractX3DHInit as xe } from "./e2e.js";
8
9
  const Q = "http://www.w3.org/2000/svg", ge = 8e3;
9
10
  class me {
10
11
  constructor() {
@@ -682,11 +683,11 @@ const M = /* @__PURE__ */ new WeakMap(), F = /* @__PURE__ */ new Map();
682
683
  function ee(t) {
683
684
  return `relay-launcher::${t.profileId}::${t.subjectId ?? ""}`;
684
685
  }
685
- function je(t) {
686
+ function Le(t) {
686
687
  var e;
687
688
  (e = M.get(t)) == null || e.close(), M.delete(t);
688
689
  }
689
- function Le(t) {
690
+ function Ae(t) {
690
691
  var V, Y, X, J, G;
691
692
  M.has(t.el) && (M.get(t.el).close(), M.delete(t.el)), t.launcher && ((V = F.get(ee(t))) == null || V.close());
692
693
  const e = le(), n = t.token ?? t.userId ?? e, s = n !== e ? e : void 0, { wsUrl: p, httpBase: d } = pe(t.url, t.apiUrl);
@@ -773,7 +774,7 @@ function Le(t) {
773
774
  }
774
775
  };
775
776
  let g;
776
- const k = new we(`ocw-e2e-${t.profileId}`);
777
+ const k = new be(`ocw-e2e-${t.profileId}`);
777
778
  let $ = !1;
778
779
  const y = [], E = [];
779
780
  let R = !1;
@@ -887,7 +888,10 @@ function Le(t) {
887
888
  } : void 0, ae = {
888
889
  type: "open",
889
890
  profileId: t.profileId,
890
- ...t.subjectId ? { subjectId: t.subjectId } : {},
891
+ // Direct conversations use the kind/peerId pair; the dm:… subject key is
892
+ // server-derived and owner-keyed, so passing it as subjectId from the
893
+ // NON-owner side would find-or-create a junk duplicate thread.
894
+ ...t.kind === "direct" && t.peerId ? { kind: "direct", peerId: t.peerId } : t.subjectId ? { subjectId: t.subjectId } : {},
891
895
  ...s ? { linkFrom: s } : {},
892
896
  ...K ? { userInfo: K } : {},
893
897
  ...typeof location < "u" ? { pageUrl: location.href } : {},
@@ -897,7 +901,7 @@ function Le(t) {
897
901
  ...(J = t.subject) != null && J.title ? { subjectTitle: t.subject.title } : {},
898
902
  ...(G = t.subject) != null && G.subtitle ? { subjectMeta: t.subject.subtitle } : {}
899
903
  };
900
- g = new be({
904
+ g = new we({
901
905
  ...t.refreshToken ? { refreshToken: t.refreshToken } : {},
902
906
  url: p,
903
907
  token: n,
@@ -955,16 +959,16 @@ function Le(t) {
955
959
  }
956
960
  export {
957
961
  he as ChatStore,
958
- be as ConnectionManager,
959
- we as E2ESession,
962
+ we as ConnectionManager,
963
+ be as E2ESession,
960
964
  fe as PersistentOutbox,
961
965
  Te as Renderer,
962
- Me as asConversationId,
966
+ qe as asConversationId,
963
967
  xe as extractX3DHInit,
964
- $e as httpBaseFromWsUrl,
965
- Le as mount,
968
+ Be as httpBaseFromWsUrl,
969
+ Ae as mount,
966
970
  pe as resolveRelayUrls,
967
971
  ue as restoreHistory,
968
- je as unmount
972
+ Le as unmount
969
973
  };
970
974
  //# sourceMappingURL=index.js.map