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