@paramms/chat-widget 1.0.44 → 1.0.46
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/README.md +4 -4
- package/dist/chatlist.d.ts +3 -1
- package/dist/chatlist.js +128 -102
- package/dist/chatlist.js.map +1 -1
- package/dist/chatlist.styles.d.ts +1 -0
- package/dist/codec.js +191 -157
- package/dist/codec.js.map +1 -1
- package/dist/core.js.map +1 -1
- package/dist/e2e.d.ts +21 -2
- package/dist/e2e.js +50 -40
- package/dist/e2e.js.map +1 -1
- package/dist/embed-lite.js +242 -0
- package/dist/embed-lite.js.map +1 -0
- package/dist/embed.d.ts +10 -0
- package/dist/embed.js +87 -78
- package/dist/embed.js.map +1 -1
- package/dist/history.d.ts +7 -4
- package/dist/index.d.ts +22 -0
- package/dist/index.js +639 -723
- package/dist/index.js.map +1 -1
- package/dist/outbox.js +65 -75
- package/dist/outbox.js.map +1 -1
- package/dist/protocol/entities.d.ts +0 -11
- package/dist/protocol/frames.d.ts +1 -17
- package/dist/react.d.ts +16 -5
- package/dist/react.js +349 -323
- package/dist/react.js.map +1 -1
- package/dist/renderer.d.ts +17 -19
- package/dist/renderer.styles.d.ts +1 -0
- package/dist/store.d.ts +1 -5
- package/dist/theme-tokens.d.ts +4 -0
- package/package.json +2 -2
- package/dist/annotations.d.ts +0 -11
package/dist/react.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { useState as
|
|
3
|
-
import { mount as
|
|
4
|
-
function
|
|
5
|
-
return /* @__PURE__ */
|
|
1
|
+
import { jsxs as W, jsx as n, Fragment as q } from "react/jsx-runtime";
|
|
2
|
+
import { useState as _, useRef as k, useEffect as A } from "react";
|
|
3
|
+
import { mount as Y } from "./index.js";
|
|
4
|
+
function K({ size: r = 26 }) {
|
|
5
|
+
return /* @__PURE__ */ n("svg", { viewBox: "0 0 24 24", width: r, height: r, fill: "none", xmlns: "http://www.w3.org/2000/svg", "aria-hidden": "true", children: /* @__PURE__ */ n(
|
|
6
6
|
"path",
|
|
7
7
|
{
|
|
8
8
|
d: "M21 11.5a8.38 8.38 0 0 1-.9 3.8 8.5 8.5 0 0 1-7.6 4.7 8.38 8.38 0 0 1-3.8-.9L3 21l1.9-5.7a8.38 8.38 0 0 1-.9-3.8 8.5 8.5 0 0 1 4.7-7.6 8.38 8.38 0 0 1 3.8-.9h.5a8.48 8.48 0 0 1 8 8v.5z",
|
|
@@ -14,276 +14,302 @@ function G({ size: o = 26 }) {
|
|
|
14
14
|
}
|
|
15
15
|
) });
|
|
16
16
|
}
|
|
17
|
-
function
|
|
18
|
-
return /* @__PURE__ */
|
|
17
|
+
function E({ size: r = 22 }) {
|
|
18
|
+
return /* @__PURE__ */ n("svg", { viewBox: "0 0 24 24", width: r, height: r, fill: "none", xmlns: "http://www.w3.org/2000/svg", "aria-hidden": "true", children: /* @__PURE__ */ n("path", { d: "M18 6 6 18M6 6l12 12", stroke: "currentColor", strokeWidth: "2.5", strokeLinecap: "round" }) });
|
|
19
19
|
}
|
|
20
|
-
function
|
|
21
|
-
url:
|
|
22
|
-
apiUrl:
|
|
23
|
-
profileId:
|
|
24
|
-
token:
|
|
25
|
-
refreshToken:
|
|
26
|
-
userId:
|
|
20
|
+
function T({
|
|
21
|
+
url: r,
|
|
22
|
+
apiUrl: i,
|
|
23
|
+
profileId: c,
|
|
24
|
+
token: o,
|
|
25
|
+
refreshToken: l,
|
|
26
|
+
userId: s,
|
|
27
27
|
userName: d,
|
|
28
|
-
userEmail:
|
|
29
|
-
userAvatar:
|
|
30
|
-
contextTitle:
|
|
31
|
-
contextSubtitle:
|
|
32
|
-
contextStatus:
|
|
33
|
-
subjectId:
|
|
34
|
-
accent:
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
28
|
+
userEmail: p,
|
|
29
|
+
userAvatar: y,
|
|
30
|
+
contextTitle: v,
|
|
31
|
+
contextSubtitle: a,
|
|
32
|
+
contextStatus: j,
|
|
33
|
+
subjectId: L,
|
|
34
|
+
accent: f,
|
|
35
|
+
accent2: w,
|
|
36
|
+
theme: m,
|
|
37
|
+
webfont: h,
|
|
38
|
+
launcher: t,
|
|
39
|
+
position: b,
|
|
40
|
+
launcherMessage: $,
|
|
41
|
+
quickReplies: z,
|
|
42
|
+
height: g = "100%",
|
|
43
|
+
i18n: B,
|
|
44
|
+
features: x,
|
|
41
45
|
translateLang: S,
|
|
42
|
-
inbox:
|
|
43
|
-
inboxScope:
|
|
46
|
+
inbox: C,
|
|
47
|
+
inboxScope: u
|
|
44
48
|
}) {
|
|
45
|
-
const
|
|
46
|
-
return
|
|
47
|
-
var
|
|
48
|
-
if (!
|
|
49
|
-
return (
|
|
50
|
-
el:
|
|
51
|
-
url:
|
|
52
|
-
...
|
|
53
|
-
profileId:
|
|
54
|
-
...
|
|
55
|
-
...
|
|
56
|
-
...
|
|
57
|
-
...
|
|
58
|
-
...
|
|
49
|
+
const R = k(null), e = k(null), [M, D] = _(!1);
|
|
50
|
+
return A(() => {
|
|
51
|
+
var H;
|
|
52
|
+
if (!M && R.current)
|
|
53
|
+
return (H = e.current) == null || H.close(), e.current = Y({
|
|
54
|
+
el: R.current,
|
|
55
|
+
url: r,
|
|
56
|
+
...i ? { apiUrl: i } : {},
|
|
57
|
+
profileId: c,
|
|
58
|
+
...L ? { subjectId: L } : {},
|
|
59
|
+
...o ? { token: o } : {},
|
|
60
|
+
...l ? { refreshToken: l } : {},
|
|
61
|
+
...s ? { userId: s } : {},
|
|
62
|
+
...s || d || p || y ? {
|
|
59
63
|
user: {
|
|
60
64
|
...d ? { name: d } : {},
|
|
61
|
-
...
|
|
62
|
-
...
|
|
65
|
+
...p ? { email: p } : {},
|
|
66
|
+
...y ? { avatar: y } : {}
|
|
63
67
|
}
|
|
64
68
|
} : {},
|
|
65
|
-
...
|
|
69
|
+
...v ? {
|
|
66
70
|
subject: {
|
|
67
|
-
title:
|
|
68
|
-
...
|
|
69
|
-
...
|
|
71
|
+
title: v,
|
|
72
|
+
...a ? { subtitle: a } : {},
|
|
73
|
+
...j ? { status: j } : {}
|
|
70
74
|
}
|
|
71
75
|
} : {},
|
|
72
|
-
...
|
|
73
|
-
...
|
|
76
|
+
...z ? { quickReplies: z } : {},
|
|
77
|
+
...f ? { accent: f } : {},
|
|
78
|
+
...w ? { accent2: w } : {},
|
|
79
|
+
...m ? { theme: m } : {},
|
|
80
|
+
...h === !1 ? { webfont: !1 } : {},
|
|
74
81
|
...S ? { translateLang: S } : {},
|
|
75
|
-
...
|
|
76
|
-
...
|
|
77
|
-
...
|
|
82
|
+
...B ? { i18n: B } : {},
|
|
83
|
+
...x ? { features: x } : {},
|
|
84
|
+
...C && !t ? { onBack: () => D(!0) } : {},
|
|
85
|
+
...t ? { launcher: t, position: b ?? "bottom-right", ...$ ? { launcherMessage: $ } : {} } : {}
|
|
78
86
|
}), () => {
|
|
79
|
-
var
|
|
80
|
-
(
|
|
87
|
+
var O;
|
|
88
|
+
(O = e.current) == null || O.close(), e.current = null;
|
|
81
89
|
};
|
|
82
|
-
}, [
|
|
83
|
-
|
|
90
|
+
}, [r, i, c, L, o, s, d, p, f, t, b, $, S, C, M]), C && !t && M ? /* @__PURE__ */ n(
|
|
91
|
+
G,
|
|
84
92
|
{
|
|
85
|
-
url:
|
|
86
|
-
...
|
|
87
|
-
profileId:
|
|
88
|
-
...
|
|
89
|
-
...
|
|
90
|
-
...
|
|
93
|
+
url: r,
|
|
94
|
+
...i ? { apiUrl: i } : {},
|
|
95
|
+
profileId: c,
|
|
96
|
+
...o ? { token: o } : {},
|
|
97
|
+
...l ? { refreshToken: l } : {},
|
|
98
|
+
...s ? { userId: s } : {},
|
|
91
99
|
...d ? { userName: d } : {},
|
|
92
|
-
...
|
|
93
|
-
...
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
100
|
+
...p ? { userEmail: p } : {},
|
|
101
|
+
...f ? { accent: f } : {},
|
|
102
|
+
...w ? { accent2: w } : {},
|
|
103
|
+
...m ? { theme: m } : {},
|
|
104
|
+
...h === !1 ? { webfont: !1 } : {},
|
|
105
|
+
scope: u ?? "tenant",
|
|
106
|
+
height: g,
|
|
107
|
+
onClose: () => D(!1)
|
|
97
108
|
}
|
|
98
|
-
) : /* @__PURE__ */
|
|
109
|
+
) : /* @__PURE__ */ n(
|
|
99
110
|
"div",
|
|
100
111
|
{
|
|
101
|
-
ref:
|
|
102
|
-
style:
|
|
112
|
+
ref: R,
|
|
113
|
+
style: t ? { width: 0, height: 0, overflow: "hidden" } : { width: "100%", height: g, minHeight: g === "100%" ? "480px" : void 0 }
|
|
103
114
|
}
|
|
104
115
|
);
|
|
105
116
|
}
|
|
106
|
-
const
|
|
117
|
+
const P = [
|
|
107
118
|
"Is this still available?",
|
|
108
119
|
"Can I schedule a viewing?",
|
|
109
120
|
"What is your best price?"
|
|
110
121
|
];
|
|
111
|
-
function
|
|
112
|
-
url:
|
|
113
|
-
apiUrl:
|
|
114
|
-
profileId:
|
|
115
|
-
token:
|
|
116
|
-
refreshToken:
|
|
117
|
-
listingId:
|
|
122
|
+
function I({
|
|
123
|
+
url: r,
|
|
124
|
+
apiUrl: i,
|
|
125
|
+
profileId: c,
|
|
126
|
+
token: o,
|
|
127
|
+
refreshToken: l,
|
|
128
|
+
listingId: s,
|
|
118
129
|
listingTitle: d,
|
|
119
|
-
listingMeta:
|
|
120
|
-
listingPrice:
|
|
121
|
-
listingStatus:
|
|
122
|
-
userId:
|
|
123
|
-
userName:
|
|
124
|
-
userEmail:
|
|
125
|
-
userAvatar:
|
|
126
|
-
accent:
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
130
|
+
listingMeta: p,
|
|
131
|
+
listingPrice: y,
|
|
132
|
+
listingStatus: v,
|
|
133
|
+
userId: a,
|
|
134
|
+
userName: j,
|
|
135
|
+
userEmail: L,
|
|
136
|
+
userAvatar: f,
|
|
137
|
+
accent: w,
|
|
138
|
+
accent2: m,
|
|
139
|
+
theme: h,
|
|
140
|
+
webfont: t,
|
|
141
|
+
launcher: b,
|
|
142
|
+
position: $,
|
|
143
|
+
launcherMessage: z,
|
|
144
|
+
quickReplies: g,
|
|
145
|
+
height: B = "100%",
|
|
146
|
+
i18n: x,
|
|
147
|
+
features: S,
|
|
148
|
+
translateLang: C,
|
|
149
|
+
inbox: u,
|
|
150
|
+
inboxScope: R
|
|
136
151
|
}) {
|
|
137
|
-
const
|
|
138
|
-
return
|
|
139
|
-
if (
|
|
140
|
-
let
|
|
141
|
-
const
|
|
142
|
-
var
|
|
143
|
-
|
|
144
|
-
el:
|
|
145
|
-
url:
|
|
146
|
-
...
|
|
147
|
-
profileId:
|
|
148
|
-
...
|
|
149
|
-
...
|
|
150
|
-
...
|
|
151
|
-
...
|
|
152
|
-
...
|
|
152
|
+
const e = k(null), M = k(null), [D, H] = _(!1);
|
|
153
|
+
return A(() => {
|
|
154
|
+
if (D || !e.current) return;
|
|
155
|
+
let O = !1;
|
|
156
|
+
const J = setTimeout(() => {
|
|
157
|
+
var F;
|
|
158
|
+
O || !e.current || ((F = M.current) == null || F.close(), M.current = Y({
|
|
159
|
+
el: e.current,
|
|
160
|
+
url: r,
|
|
161
|
+
...i ? { apiUrl: i } : {},
|
|
162
|
+
profileId: c,
|
|
163
|
+
...s ? { subjectId: `listing_${s}` } : {},
|
|
164
|
+
...o ? { token: o } : {},
|
|
165
|
+
...l ? { refreshToken: l } : {},
|
|
166
|
+
...a ? { userId: a } : {},
|
|
167
|
+
...a || j || L || f ? {
|
|
153
168
|
user: {
|
|
154
|
-
...
|
|
155
|
-
...
|
|
156
|
-
...
|
|
157
|
-
...
|
|
169
|
+
...j ? { name: j } : {},
|
|
170
|
+
...L ? { email: L } : {},
|
|
171
|
+
...f ? { avatar: f } : {},
|
|
172
|
+
...s ? { meta: { listingId: s } } : {}
|
|
158
173
|
}
|
|
159
174
|
} : {},
|
|
160
175
|
...d ? {
|
|
161
176
|
subject: {
|
|
162
177
|
title: d,
|
|
163
|
-
...
|
|
164
|
-
...
|
|
165
|
-
...
|
|
178
|
+
...p ? { subtitle: p } : {},
|
|
179
|
+
...y ? { tags: [`$${y.toLocaleString()}`] } : {},
|
|
180
|
+
...v ? { status: v } : {}
|
|
166
181
|
}
|
|
167
182
|
} : {},
|
|
168
|
-
quickReplies:
|
|
169
|
-
...
|
|
170
|
-
...
|
|
171
|
-
...
|
|
172
|
-
|
|
173
|
-
...
|
|
183
|
+
quickReplies: g ?? P,
|
|
184
|
+
...w ? { accent: w } : {},
|
|
185
|
+
...m ? { accent2: m } : {},
|
|
186
|
+
...h ? { theme: h } : {},
|
|
187
|
+
...t === !1 ? { webfont: !1 } : {},
|
|
188
|
+
...C ? { translateLang: C } : {},
|
|
189
|
+
...x ? { i18n: x } : {},
|
|
190
|
+
...S ? { features: S } : {},
|
|
191
|
+
...u && !b ? { onBack: () => H(!0) } : {},
|
|
192
|
+
...b ? { launcher: b, position: $ ?? "bottom-right", ...z ? { launcherMessage: z } : {} } : {}
|
|
174
193
|
}));
|
|
175
194
|
}, 0);
|
|
176
195
|
return () => {
|
|
177
|
-
var
|
|
178
|
-
|
|
196
|
+
var F;
|
|
197
|
+
O = !0, clearTimeout(J), (F = M.current) == null || F.close(), M.current = null;
|
|
179
198
|
};
|
|
180
|
-
}, [
|
|
181
|
-
|
|
199
|
+
}, [r, i, c, s, o, a, w, b, $, z, C, u, D]), u && !b && D ? /* @__PURE__ */ n(
|
|
200
|
+
G,
|
|
182
201
|
{
|
|
183
|
-
url:
|
|
184
|
-
...
|
|
185
|
-
profileId:
|
|
186
|
-
...
|
|
187
|
-
...
|
|
188
|
-
...
|
|
189
|
-
...
|
|
190
|
-
...
|
|
191
|
-
...
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
202
|
+
url: r,
|
|
203
|
+
...i ? { apiUrl: i } : {},
|
|
204
|
+
profileId: c,
|
|
205
|
+
...o ? { token: o } : {},
|
|
206
|
+
...l ? { refreshToken: l } : {},
|
|
207
|
+
...a ? { userId: a } : {},
|
|
208
|
+
...j ? { userName: j } : {},
|
|
209
|
+
...L ? { userEmail: L } : {},
|
|
210
|
+
...w ? { accent: w } : {},
|
|
211
|
+
...m ? { accent2: m } : {},
|
|
212
|
+
...h ? { theme: h } : {},
|
|
213
|
+
...t === !1 ? { webfont: !1 } : {},
|
|
214
|
+
scope: R ?? "tenant",
|
|
215
|
+
height: B,
|
|
216
|
+
onClose: () => H(!1)
|
|
195
217
|
}
|
|
196
|
-
) : /* @__PURE__ */
|
|
218
|
+
) : /* @__PURE__ */ n(
|
|
197
219
|
"div",
|
|
198
220
|
{
|
|
199
|
-
ref:
|
|
200
|
-
style:
|
|
221
|
+
ref: e,
|
|
222
|
+
style: b ? { width: 0, height: 0, overflow: "hidden" } : { width: "100%", height: B, minHeight: B === "100%" ? "480px" : void 0 }
|
|
201
223
|
}
|
|
202
224
|
);
|
|
203
225
|
}
|
|
204
|
-
function
|
|
205
|
-
const [
|
|
206
|
-
typeof window < "u" && window.innerWidth <=
|
|
226
|
+
function Q(r) {
|
|
227
|
+
const [i, c] = _(
|
|
228
|
+
typeof window < "u" && window.innerWidth <= r
|
|
207
229
|
);
|
|
208
|
-
return
|
|
230
|
+
return A(() => {
|
|
209
231
|
if (typeof window > "u" || !window.matchMedia) return;
|
|
210
|
-
const
|
|
211
|
-
return
|
|
212
|
-
}, [
|
|
232
|
+
const o = window.matchMedia(`(max-width: ${r}px)`), l = (s) => c(s.matches);
|
|
233
|
+
return c(o.matches), o.addEventListener("change", l), () => o.removeEventListener("change", l);
|
|
234
|
+
}, [r]), i;
|
|
213
235
|
}
|
|
214
|
-
function
|
|
215
|
-
url:
|
|
216
|
-
apiUrl:
|
|
217
|
-
profileId:
|
|
218
|
-
tenantId:
|
|
219
|
-
token:
|
|
220
|
-
refreshToken:
|
|
236
|
+
function G({
|
|
237
|
+
url: r,
|
|
238
|
+
apiUrl: i,
|
|
239
|
+
profileId: c,
|
|
240
|
+
tenantId: o,
|
|
241
|
+
token: l,
|
|
242
|
+
refreshToken: s,
|
|
221
243
|
userId: d,
|
|
222
|
-
userName:
|
|
223
|
-
userEmail:
|
|
224
|
-
accent:
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
244
|
+
userName: p,
|
|
245
|
+
userEmail: y,
|
|
246
|
+
accent: v,
|
|
247
|
+
theme: a,
|
|
248
|
+
webfont: j,
|
|
249
|
+
height: L = "100%",
|
|
250
|
+
i18n: f,
|
|
251
|
+
onClose: w,
|
|
252
|
+
scope: m = "tenant"
|
|
229
253
|
}) {
|
|
230
|
-
const
|
|
231
|
-
return
|
|
232
|
-
if (!
|
|
233
|
-
let
|
|
234
|
-
return import("./chatlist.js").catch((
|
|
235
|
-
if (!
|
|
236
|
-
const { mountChatList:
|
|
237
|
-
|
|
238
|
-
el:
|
|
239
|
-
url:
|
|
240
|
-
...
|
|
241
|
-
...
|
|
242
|
-
...
|
|
243
|
-
|
|
254
|
+
const h = !c && !o, [t, b] = _(null), [$, z] = _(!1), g = k(null), B = k(null), x = k(null), S = k(null);
|
|
255
|
+
return A(() => {
|
|
256
|
+
if (!g.current) return;
|
|
257
|
+
let C = !1;
|
|
258
|
+
return import("./chatlist.js").catch((u) => (console.error("[relay] could not load the conversation list module.", u), C || z(!0), null)).then((u) => {
|
|
259
|
+
if (!u) return;
|
|
260
|
+
const { mountChatList: R } = u;
|
|
261
|
+
C || !g.current || (x.current = R({
|
|
262
|
+
el: g.current,
|
|
263
|
+
url: r,
|
|
264
|
+
...i ? { apiUrl: i } : {},
|
|
265
|
+
...c ? { profileId: c } : {},
|
|
266
|
+
...o ? { tenantId: o } : {},
|
|
267
|
+
...a ? { theme: a } : {},
|
|
268
|
+
...j === !1 ? { webfont: !1 } : {},
|
|
269
|
+
scope: m,
|
|
244
270
|
// We overlay a ✕ at top-right when `onClose` is given — tell the list to
|
|
245
271
|
// keep its header clear so the ✕ doesn't land on the ✎ compose button.
|
|
246
|
-
...
|
|
247
|
-
onSelect: (
|
|
272
|
+
...w ? { reserveCloseSpace: !0 } : {},
|
|
273
|
+
onSelect: (e) => b(e),
|
|
248
274
|
// Compose (✎) opens the chatroom's general support thread — without
|
|
249
275
|
// this a user with no conversations yet had an empty list and no way
|
|
250
276
|
// to ever start one, which is what made ChatApp feel broken.
|
|
251
277
|
// Compose target: the configured chatroom, else the tenant's default
|
|
252
278
|
// (oldest chatroom, reported by the server on the first list fetch).
|
|
253
279
|
onNewChat: () => {
|
|
254
|
-
var
|
|
255
|
-
const
|
|
256
|
-
|
|
280
|
+
var M;
|
|
281
|
+
const e = (M = x.current) == null ? void 0 : M.defaultProfileId();
|
|
282
|
+
e && b({ id: "__new__", profileId: e, state: "open", updatedAt: Date.now() });
|
|
257
283
|
},
|
|
258
|
-
...
|
|
284
|
+
...l ? { token: l } : {},
|
|
259
285
|
...d ? { userId: d } : {},
|
|
260
|
-
...
|
|
261
|
-
...
|
|
286
|
+
...v ? { accent: v } : {},
|
|
287
|
+
...f ? { i18n: f } : {}
|
|
262
288
|
}));
|
|
263
289
|
}), () => {
|
|
264
|
-
var
|
|
265
|
-
|
|
290
|
+
var u;
|
|
291
|
+
C = !0, (u = x.current) == null || u.close(), x.current = null;
|
|
266
292
|
};
|
|
267
|
-
}, [
|
|
268
|
-
var
|
|
269
|
-
if (!
|
|
270
|
-
(
|
|
271
|
-
el:
|
|
272
|
-
url:
|
|
273
|
-
...
|
|
274
|
-
profileId: t.profileId ??
|
|
293
|
+
}, [r, i, c, o, l, d, m]), A(() => {
|
|
294
|
+
var u;
|
|
295
|
+
if (!B.current || !t) return;
|
|
296
|
+
(u = S.current) == null || u.close(), S.current = Y({
|
|
297
|
+
el: B.current,
|
|
298
|
+
url: r,
|
|
299
|
+
...i ? { apiUrl: i } : {},
|
|
300
|
+
profileId: t.profileId ?? c,
|
|
275
301
|
// rows always carry theirs; compose sets one explicitly
|
|
276
302
|
// DM rows open as direct conversations (kind + peer). Opening them via
|
|
277
303
|
// their dm:… subjectId only works for the participant that OWNS the
|
|
278
304
|
// thread key — the other side would silently fork a duplicate.
|
|
279
305
|
...t.kind === "direct" && t.peerId ? { kind: "direct", peerId: t.peerId } : t.subjectId ? { subjectId: t.subjectId } : {},
|
|
280
|
-
...
|
|
281
|
-
...
|
|
306
|
+
...l ? { token: l } : {},
|
|
307
|
+
...s ? { refreshToken: s } : {},
|
|
282
308
|
...d ? { userId: d } : {},
|
|
283
|
-
...d ||
|
|
309
|
+
...d || p || y ? {
|
|
284
310
|
user: {
|
|
285
|
-
...
|
|
286
|
-
...
|
|
311
|
+
...p ? { name: p } : {},
|
|
312
|
+
...y ? { email: y } : {}
|
|
287
313
|
}
|
|
288
314
|
} : {},
|
|
289
315
|
...t.subjectTitle ? {
|
|
@@ -292,30 +318,30 @@ function A({
|
|
|
292
318
|
...t.subjectMeta ? { subtitle: t.subjectMeta } : {}
|
|
293
319
|
}
|
|
294
320
|
} : {},
|
|
295
|
-
...
|
|
321
|
+
...v ? { accent: v } : {},
|
|
296
322
|
// Stack navigation: the chatroom's back chevron returns to the list.
|
|
297
|
-
onBack: () =>
|
|
323
|
+
onBack: () => b(null)
|
|
298
324
|
});
|
|
299
|
-
const
|
|
300
|
-
var
|
|
301
|
-
return (
|
|
325
|
+
const C = setInterval(() => {
|
|
326
|
+
var R;
|
|
327
|
+
return (R = x.current) == null ? void 0 : R.refresh();
|
|
302
328
|
}, 2e4);
|
|
303
329
|
return () => {
|
|
304
|
-
var
|
|
305
|
-
clearInterval(
|
|
330
|
+
var R, e;
|
|
331
|
+
clearInterval(C), (R = S.current) == null || R.close(), S.current = null, (e = x.current) == null || e.refresh();
|
|
306
332
|
};
|
|
307
|
-
}, [t == null ? void 0 : t.id]),
|
|
333
|
+
}, [t == null ? void 0 : t.id]), h ? /* @__PURE__ */ W("div", { style: { padding: 16, font: "13px system-ui", color: "#b91c1c", background: "#fef2f2", borderRadius: 8 }, children: [
|
|
308
334
|
"[relay] <ChatApp/> needs a ",
|
|
309
|
-
/* @__PURE__ */
|
|
335
|
+
/* @__PURE__ */ n("code", { children: "profileId" }),
|
|
310
336
|
" or a ",
|
|
311
|
-
/* @__PURE__ */
|
|
337
|
+
/* @__PURE__ */ n("code", { children: "tenantId" }),
|
|
312
338
|
"."
|
|
313
|
-
] }) : /* @__PURE__ */
|
|
314
|
-
|
|
339
|
+
] }) : /* @__PURE__ */ W("div", { style: { position: "relative", width: "100%", height: L, minHeight: "400px", overflow: "hidden", background: "#fff" }, children: [
|
|
340
|
+
w && !t && /* @__PURE__ */ n(
|
|
315
341
|
"button",
|
|
316
342
|
{
|
|
317
|
-
onClick:
|
|
318
|
-
"aria-label": (
|
|
343
|
+
onClick: w,
|
|
344
|
+
"aria-label": (f == null ? void 0 : f.close) ?? "Close",
|
|
319
345
|
style: {
|
|
320
346
|
position: "absolute",
|
|
321
347
|
top: 8,
|
|
@@ -334,55 +360,55 @@ function A({
|
|
|
334
360
|
lineHeight: 1,
|
|
335
361
|
cursor: "pointer"
|
|
336
362
|
},
|
|
337
|
-
children: /* @__PURE__ */
|
|
363
|
+
children: /* @__PURE__ */ n(E, { size: 18 })
|
|
338
364
|
}
|
|
339
365
|
),
|
|
340
|
-
/* @__PURE__ */
|
|
366
|
+
/* @__PURE__ */ n("div", { style: {
|
|
341
367
|
position: "absolute",
|
|
342
368
|
inset: 0,
|
|
343
369
|
display: t ? "none" : "flex",
|
|
344
370
|
flexDirection: "column"
|
|
345
|
-
}, children:
|
|
346
|
-
t && /* @__PURE__ */
|
|
371
|
+
}, children: $ ? /* @__PURE__ */ n("div", { style: { display: "flex", alignItems: "center", justifyContent: "center", width: "100%", height: "100%", padding: 16, font: "13px system-ui", color: "#b91c1c", textAlign: "center" }, children: (f == null ? void 0 : f.error) ?? "Could not load conversations." }) : /* @__PURE__ */ n("div", { ref: g, style: { width: "100%", height: "100%" } }) }),
|
|
372
|
+
t && /* @__PURE__ */ n("div", { style: { position: "absolute", inset: 0, display: "flex", flexDirection: "column" }, children: /* @__PURE__ */ n("div", { ref: B, style: { width: "100%", height: "100%" } }) })
|
|
347
373
|
] });
|
|
348
374
|
}
|
|
349
|
-
function
|
|
350
|
-
url:
|
|
351
|
-
apiUrl:
|
|
352
|
-
profileId:
|
|
353
|
-
tenantId:
|
|
354
|
-
token:
|
|
355
|
-
refreshToken:
|
|
375
|
+
function N({
|
|
376
|
+
url: r,
|
|
377
|
+
apiUrl: i,
|
|
378
|
+
profileId: c,
|
|
379
|
+
tenantId: o,
|
|
380
|
+
token: l,
|
|
381
|
+
refreshToken: s,
|
|
356
382
|
userId: d,
|
|
357
|
-
userName:
|
|
358
|
-
userEmail:
|
|
359
|
-
scope:
|
|
360
|
-
accent:
|
|
361
|
-
floating:
|
|
362
|
-
position:
|
|
363
|
-
label:
|
|
364
|
-
panelWidth:
|
|
365
|
-
panelHeight:
|
|
383
|
+
userName: p,
|
|
384
|
+
userEmail: y,
|
|
385
|
+
scope: v,
|
|
386
|
+
accent: a = "#6c5ce7",
|
|
387
|
+
floating: j = !0,
|
|
388
|
+
position: L = "bottom-right",
|
|
389
|
+
label: f,
|
|
390
|
+
panelWidth: w,
|
|
391
|
+
panelHeight: m = "600px"
|
|
366
392
|
}) {
|
|
367
|
-
const [
|
|
368
|
-
if (
|
|
369
|
-
const
|
|
370
|
-
|
|
393
|
+
const [h, t] = _(!1), b = k(null), $ = L === "bottom-right", z = f ?? (j ? void 0 : "Messages"), g = Q(479);
|
|
394
|
+
if (A(() => {
|
|
395
|
+
const e = (M) => {
|
|
396
|
+
M.key === "Escape" && t(!1);
|
|
371
397
|
};
|
|
372
|
-
return document.addEventListener("keydown",
|
|
373
|
-
}, []),
|
|
374
|
-
return /* @__PURE__ */
|
|
398
|
+
return document.addEventListener("keydown", e), () => document.removeEventListener("keydown", e);
|
|
399
|
+
}, []), j)
|
|
400
|
+
return /* @__PURE__ */ W("div", { style: {
|
|
375
401
|
position: "fixed",
|
|
376
|
-
[
|
|
402
|
+
[$ ? "right" : "left"]: "20px",
|
|
377
403
|
bottom: "20px",
|
|
378
404
|
zIndex: 9999,
|
|
379
405
|
display: "flex",
|
|
380
406
|
flexDirection: "column",
|
|
381
|
-
alignItems:
|
|
407
|
+
alignItems: $ ? "flex-end" : "flex-start",
|
|
382
408
|
gap: "12px"
|
|
383
409
|
}, children: [
|
|
384
|
-
/* @__PURE__ */
|
|
385
|
-
...
|
|
410
|
+
/* @__PURE__ */ n("div", { style: {
|
|
411
|
+
...g ? {
|
|
386
412
|
position: "fixed",
|
|
387
413
|
inset: 0,
|
|
388
414
|
width: "100%",
|
|
@@ -390,152 +416,152 @@ function X({
|
|
|
390
416
|
borderRadius: "0",
|
|
391
417
|
zIndex: 9998
|
|
392
418
|
} : {
|
|
393
|
-
width: `min(${
|
|
394
|
-
height: `min(${
|
|
395
|
-
borderRadius: "
|
|
419
|
+
width: `min(${w ?? "420px"}, calc(100vw - 40px))`,
|
|
420
|
+
height: `min(${m}, calc(100dvh - 108px))`,
|
|
421
|
+
borderRadius: "28px"
|
|
396
422
|
},
|
|
397
423
|
overflow: "hidden",
|
|
398
|
-
boxShadow:
|
|
424
|
+
boxShadow: g ? "none" : "0 12px 32px rgba(108,92,231,.14)",
|
|
399
425
|
background: "#fff",
|
|
400
|
-
display:
|
|
426
|
+
display: h ? "flex" : "none",
|
|
401
427
|
flexDirection: "column",
|
|
402
|
-
transformOrigin: `bottom ${
|
|
403
|
-
animation:
|
|
404
|
-
}, children: /* @__PURE__ */
|
|
405
|
-
|
|
428
|
+
transformOrigin: `bottom ${$ ? "right" : "left"}`,
|
|
429
|
+
animation: h ? "ocl-pop-in .18s ease" : "none"
|
|
430
|
+
}, children: /* @__PURE__ */ n(
|
|
431
|
+
G,
|
|
406
432
|
{
|
|
407
|
-
url:
|
|
408
|
-
...
|
|
409
|
-
...
|
|
410
|
-
...
|
|
411
|
-
...
|
|
412
|
-
...
|
|
433
|
+
url: r,
|
|
434
|
+
...i ? { apiUrl: i } : {},
|
|
435
|
+
...c ? { profileId: c } : {},
|
|
436
|
+
...o ? { tenantId: o } : {},
|
|
437
|
+
...l ? { token: l } : {},
|
|
438
|
+
...s ? { refreshToken: s } : {},
|
|
413
439
|
...d ? { userId: d } : {},
|
|
414
|
-
...
|
|
415
|
-
...
|
|
416
|
-
...
|
|
417
|
-
accent:
|
|
440
|
+
...p ? { userName: p } : {},
|
|
441
|
+
...y ? { userEmail: y } : {},
|
|
442
|
+
...v ? { scope: v } : {},
|
|
443
|
+
accent: a,
|
|
418
444
|
height: "100%",
|
|
419
|
-
onClose: () =>
|
|
445
|
+
onClose: () => t(!1)
|
|
420
446
|
}
|
|
421
447
|
) }),
|
|
422
|
-
/* @__PURE__ */
|
|
448
|
+
/* @__PURE__ */ n(
|
|
423
449
|
"button",
|
|
424
450
|
{
|
|
425
|
-
ref:
|
|
426
|
-
onClick: () =>
|
|
427
|
-
"aria-label":
|
|
428
|
-
"aria-expanded":
|
|
451
|
+
ref: b,
|
|
452
|
+
onClick: () => t((e) => !e),
|
|
453
|
+
"aria-label": h ? "Close chat" : typeof z == "string" ? z : "Open chat",
|
|
454
|
+
"aria-expanded": h,
|
|
429
455
|
style: {
|
|
430
456
|
width: "56px",
|
|
431
457
|
height: "56px",
|
|
432
458
|
borderRadius: "50%",
|
|
433
|
-
background:
|
|
459
|
+
background: a,
|
|
434
460
|
color: "#fff",
|
|
435
461
|
border: "none",
|
|
436
462
|
fontSize: "20px",
|
|
437
463
|
cursor: "pointer",
|
|
438
464
|
flexShrink: 0,
|
|
439
|
-
boxShadow: "0
|
|
465
|
+
boxShadow: "0 12px 32px rgba(108,92,231,.14)",
|
|
440
466
|
transition: "transform .15s",
|
|
441
467
|
alignItems: "center",
|
|
442
468
|
justifyContent: "center",
|
|
443
|
-
display:
|
|
469
|
+
display: h && g ? "none" : "flex"
|
|
444
470
|
},
|
|
445
|
-
onMouseEnter: (
|
|
446
|
-
|
|
471
|
+
onMouseEnter: (e) => {
|
|
472
|
+
e.currentTarget.style.transform = "scale(1.08)";
|
|
447
473
|
},
|
|
448
|
-
onMouseLeave: (
|
|
449
|
-
|
|
474
|
+
onMouseLeave: (e) => {
|
|
475
|
+
e.currentTarget.style.transform = "scale(1)";
|
|
450
476
|
},
|
|
451
|
-
children:
|
|
477
|
+
children: h ? /* @__PURE__ */ n(E, {}) : f ?? /* @__PURE__ */ n(K, {})
|
|
452
478
|
}
|
|
453
479
|
),
|
|
454
|
-
/* @__PURE__ */
|
|
480
|
+
/* @__PURE__ */ n("style", { children: "@keyframes ocl-pop-in { from { opacity:0; transform:scale(.95) } to { opacity:1; transform:scale(1) } }" })
|
|
455
481
|
] });
|
|
456
|
-
const
|
|
457
|
-
!
|
|
458
|
-
},
|
|
459
|
-
return /* @__PURE__ */
|
|
460
|
-
/* @__PURE__ */
|
|
482
|
+
const B = `min(${w ?? "420px"}, calc(100vw - 16px))`, [x, S] = _(null), C = () => {
|
|
483
|
+
!h && b.current && S(b.current.getBoundingClientRect()), t((e) => !e);
|
|
484
|
+
}, u = x ? x.bottom + 8 : 0, R = x ? Math.max(8, window.innerWidth - x.right) : 0;
|
|
485
|
+
return /* @__PURE__ */ W(q, { children: [
|
|
486
|
+
/* @__PURE__ */ W(
|
|
461
487
|
"button",
|
|
462
488
|
{
|
|
463
|
-
ref:
|
|
464
|
-
onClick:
|
|
489
|
+
ref: b,
|
|
490
|
+
onClick: C,
|
|
465
491
|
style: {
|
|
466
492
|
display: "inline-flex",
|
|
467
493
|
alignItems: "center",
|
|
468
494
|
gap: "6px",
|
|
469
495
|
padding: "8px 16px",
|
|
470
496
|
borderRadius: "8px",
|
|
471
|
-
background:
|
|
472
|
-
color:
|
|
473
|
-
border: `2px solid ${
|
|
497
|
+
background: h ? a : "transparent",
|
|
498
|
+
color: h ? "#fff" : a,
|
|
499
|
+
border: `2px solid ${a}`,
|
|
474
500
|
fontSize: "14px",
|
|
475
501
|
fontWeight: 600,
|
|
476
502
|
cursor: "pointer",
|
|
477
503
|
transition: "background .15s, color .15s"
|
|
478
504
|
},
|
|
479
505
|
children: [
|
|
480
|
-
/* @__PURE__ */
|
|
506
|
+
/* @__PURE__ */ n(K, { size: 16 }),
|
|
481
507
|
" ",
|
|
482
|
-
|
|
508
|
+
z
|
|
483
509
|
]
|
|
484
510
|
}
|
|
485
511
|
),
|
|
486
|
-
|
|
487
|
-
/* @__PURE__ */
|
|
512
|
+
h && x && /* @__PURE__ */ W(q, { children: [
|
|
513
|
+
/* @__PURE__ */ n(
|
|
488
514
|
"div",
|
|
489
515
|
{
|
|
490
|
-
onClick: () =>
|
|
516
|
+
onClick: () => t(!1),
|
|
491
517
|
style: { position: "fixed", inset: 0, zIndex: 9998 }
|
|
492
518
|
}
|
|
493
519
|
),
|
|
494
|
-
/* @__PURE__ */
|
|
520
|
+
/* @__PURE__ */ n("div", { style: {
|
|
495
521
|
position: "fixed",
|
|
496
|
-
...
|
|
522
|
+
...g ? {
|
|
497
523
|
inset: 0,
|
|
498
524
|
width: "100%",
|
|
499
525
|
height: "100dvh",
|
|
500
526
|
borderRadius: "0"
|
|
501
527
|
} : {
|
|
502
|
-
top:
|
|
503
|
-
right:
|
|
504
|
-
width:
|
|
505
|
-
height: `min(${
|
|
506
|
-
borderRadius: "
|
|
528
|
+
top: u,
|
|
529
|
+
right: R,
|
|
530
|
+
width: B,
|
|
531
|
+
height: `min(${m}, calc(100dvh - ${u}px - 12px))`,
|
|
532
|
+
borderRadius: "28px"
|
|
507
533
|
},
|
|
508
534
|
overflow: "hidden",
|
|
509
|
-
boxShadow:
|
|
535
|
+
boxShadow: g ? "none" : "0 12px 32px rgba(108,92,231,.14)",
|
|
510
536
|
background: "#fff",
|
|
511
537
|
zIndex: 9999,
|
|
512
538
|
animation: "ocl-slide-in .18s ease"
|
|
513
|
-
}, children: /* @__PURE__ */
|
|
514
|
-
|
|
539
|
+
}, children: /* @__PURE__ */ n(
|
|
540
|
+
G,
|
|
515
541
|
{
|
|
516
|
-
url:
|
|
517
|
-
...
|
|
518
|
-
...
|
|
519
|
-
...
|
|
520
|
-
...
|
|
521
|
-
...
|
|
542
|
+
url: r,
|
|
543
|
+
...i ? { apiUrl: i } : {},
|
|
544
|
+
...c ? { profileId: c } : {},
|
|
545
|
+
...o ? { tenantId: o } : {},
|
|
546
|
+
...l ? { token: l } : {},
|
|
547
|
+
...s ? { refreshToken: s } : {},
|
|
522
548
|
...d ? { userId: d } : {},
|
|
523
|
-
...
|
|
524
|
-
...
|
|
525
|
-
...
|
|
526
|
-
accent:
|
|
549
|
+
...p ? { userName: p } : {},
|
|
550
|
+
...y ? { userEmail: y } : {},
|
|
551
|
+
...v ? { scope: v } : {},
|
|
552
|
+
accent: a,
|
|
527
553
|
height: "100%",
|
|
528
|
-
onClose: () =>
|
|
554
|
+
onClose: () => t(!1)
|
|
529
555
|
}
|
|
530
556
|
) }),
|
|
531
|
-
/* @__PURE__ */
|
|
557
|
+
/* @__PURE__ */ n("style", { children: "@keyframes ocl-slide-in { from { opacity:0; transform:translateY(-8px) } to { opacity:1; transform:translateY(0) } }" })
|
|
532
558
|
] })
|
|
533
559
|
] });
|
|
534
560
|
}
|
|
535
561
|
export {
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
562
|
+
G as ChatApp,
|
|
563
|
+
N as ChatAppLauncher,
|
|
564
|
+
T as ChatWidget,
|
|
565
|
+
I as MarketplaceChat
|
|
540
566
|
};
|
|
541
567
|
//# sourceMappingURL=react.js.map
|