@paramms/chat-widget 1.0.36 → 1.0.37

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/hooks.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { useState as d, useEffect as R, useRef as $, useSyncExternalStore as w, useMemo as h } from "react";
2
2
  import { RelayClient as C } from "./core.js";
3
- import { r as b, p as U } from "./uid.js";
3
+ import { r as b, p as U } from "./codec.js";
4
4
  function T(e) {
5
5
  var c;
6
6
  const l = `${e.url}|${e.token ?? ""}|${e.profileId}|${e.subjectId ?? ""}|${e.kind ?? ""}|${e.peerId ?? ""}`, o = $(null);
package/dist/index.js CHANGED
@@ -1,8 +1,8 @@
1
1
  var pe = Object.defineProperty;
2
2
  var he = (o, e, i) => e in o ? pe(o, e, { enumerable: !0, configurable: !0, writable: !0, value: i }) : o[e] = i;
3
3
  var y = (o, e, i) => he(o, typeof e != "symbol" ? e + "" : e, i);
4
- import { p as fe, r as ue, a as we } from "./uid.js";
5
- import { h as Me } from "./uid.js";
4
+ import { p as fe, r as ue, a as we } from "./codec.js";
5
+ import { h as Me } from "./codec.js";
6
6
  import { P as be, C as xe, b as ge } from "./outbox.js";
7
7
  import { e as He } from "./outbox.js";
8
8
  import { E2ESession as me, extractX3DHInit as ye } from "./e2e.js";
@@ -908,7 +908,12 @@ function Be(o) {
908
908
  try {
909
909
  const E = await fetch(p, {
910
910
  method: "POST",
911
- headers: { "content-type": n.type, ...o.token ? { authorization: `Bearer ${o.token}` } : {} },
911
+ // Use the resolved connection token (a signed JWT, an explicit userId,
912
+ // or the anonymous persistent uid) — NOT just opts.token. The server
913
+ // requires an Authorization header, and the verifier accepts an
914
+ // anonymous id as a guest; keying off opts.token alone meant anonymous
915
+ // visitors (the common case) sent no auth and every upload 401'd.
916
+ headers: { "content-type": n.type, authorization: `Bearer ${a}` },
912
917
  body: n
913
918
  });
914
919
  if (!E.ok) throw new Error(`Upload failed: ${E.status}`);