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