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