@paramms/chat-widget 1.0.21 → 1.0.22
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/connection.d.ts +1 -3
- package/dist/index.d.ts +13 -0
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/connection.d.ts
CHANGED
|
@@ -14,9 +14,7 @@ export type SocketFactory = (url: string) => SocketLike;
|
|
|
14
14
|
export interface ConnectionOptions {
|
|
15
15
|
url: string;
|
|
16
16
|
token: string;
|
|
17
|
-
open:
|
|
18
|
-
type: 'open';
|
|
19
|
-
}>;
|
|
17
|
+
open: ClientFrame;
|
|
20
18
|
onFrame: (frame: ServerFrame) => void;
|
|
21
19
|
getCursor: () => number;
|
|
22
20
|
onStatusChange?: (status: 'connecting' | 'open' | 'reconnecting') => void;
|
package/dist/index.d.ts
CHANGED
|
@@ -21,7 +21,20 @@ export interface MountOptions {
|
|
|
21
21
|
apiUrl?: string;
|
|
22
22
|
profileId: string;
|
|
23
23
|
subjectId?: string;
|
|
24
|
+
/** IDENTITY (tiered — the host owns identity, the widget never has to persist it):
|
|
25
|
+
* 1. `token` — a signed identity token. Either a capability token, or (recommended
|
|
26
|
+
* for embedders) an ES256 JWT `{sub,iat,exp}` signed by your backend with the
|
|
27
|
+
* private key whose public half is set as the chatroom's `guestPublicKey`.
|
|
28
|
+
* The server cryptographically verifies it. Works in ANY language/environment,
|
|
29
|
+
* no cookies or storage required. This is the production path.
|
|
30
|
+
* 2. `userId` — a stable id you already have for the visitor (e.g. your logged-in
|
|
31
|
+
* user id). Unauthenticated ("you vouch for it") but works everywhere. Used
|
|
32
|
+
* only when `token` is absent.
|
|
33
|
+
* 3. Neither — the widget falls back to best-effort local identity on the host
|
|
34
|
+
* origin (first-party cookie + localStorage). A returning visitor on the same
|
|
35
|
+
* browser keeps their history; if storage is blocked they get a fresh chat. */
|
|
24
36
|
token?: string;
|
|
37
|
+
userId?: string;
|
|
25
38
|
subject?: WidgetConfig['subject'];
|
|
26
39
|
quickReplies?: string[];
|
|
27
40
|
accent?: string;
|
package/dist/index.js
CHANGED
|
@@ -2169,7 +2169,7 @@ function Ot(s) {
|
|
|
2169
2169
|
function Nt(s) {
|
|
2170
2170
|
var ce, de, le, he;
|
|
2171
2171
|
H.has(s.el) && (H.get(s.el).close(), H.delete(s.el));
|
|
2172
|
-
const e = s.token ?? Ae(), { wsUrl: t, httpBase: i } = ze(s.url, s.apiUrl);
|
|
2172
|
+
const e = s.token ?? s.userId ?? Ae(), { wsUrl: t, httpBase: i } = ze(s.url, s.apiUrl);
|
|
2173
2173
|
let n = new bt(e);
|
|
2174
2174
|
const o = s.subjectId ? `${e}::${s.subjectId}` : e, a = new St(o);
|
|
2175
2175
|
let d, w = !1, x = null, m = null;
|