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