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