@paramms/chat-widget 1.0.41 → 1.0.42
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/connection.d.ts +13 -0
- package/dist/embed.d.ts +22 -0
- package/dist/embed.js +3 -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 +187 -185
- 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
22
|
apiUrl: i,
|
|
23
|
-
profileId:
|
|
23
|
+
profileId: s,
|
|
24
24
|
token: n,
|
|
25
25
|
refreshToken: r,
|
|
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:
|
|
31
|
+
contextSubtitle: p,
|
|
32
|
+
contextStatus: h,
|
|
33
33
|
subjectId: L,
|
|
34
34
|
accent: C,
|
|
35
|
-
launcher:
|
|
35
|
+
launcher: b,
|
|
36
36
|
position: t,
|
|
37
37
|
launcherMessage: f,
|
|
38
|
-
quickReplies:
|
|
39
|
-
height:
|
|
40
|
-
i18n:
|
|
41
|
-
translateLang:
|
|
42
|
-
inbox:
|
|
43
|
-
inboxScope:
|
|
38
|
+
quickReplies: R,
|
|
39
|
+
height: S = "100%",
|
|
40
|
+
i18n: j,
|
|
41
|
+
translateLang: M,
|
|
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
52
|
...i ? { apiUrl: i } : {},
|
|
53
|
-
profileId:
|
|
53
|
+
profileId: s,
|
|
54
54
|
...L ? { subjectId: L } : {},
|
|
55
55
|
...n ? { token: n } : {},
|
|
56
56
|
...r ? { refreshToken: r } : {},
|
|
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
|
-
...
|
|
72
|
+
...R ? { quickReplies: R } : {},
|
|
73
73
|
...C ? { accent: C } : {},
|
|
74
|
-
...
|
|
75
|
-
...
|
|
76
|
-
...
|
|
77
|
-
...
|
|
74
|
+
...M ? { translateLang: M } : {},
|
|
75
|
+
...j ? { i18n: j } : {},
|
|
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, i,
|
|
83
|
-
|
|
82
|
+
}, [o, i, s, L, n, l, d, u, C, b, t, f, M, a, x]), a && !b && x ? /* @__PURE__ */ e(
|
|
83
|
+
A,
|
|
84
84
|
{
|
|
85
85
|
url: o,
|
|
86
86
|
...i ? { apiUrl: i } : {},
|
|
87
|
-
profileId:
|
|
87
|
+
profileId: s,
|
|
88
88
|
...n ? { token: n } : {},
|
|
89
89
|
...r ? { refreshToken: r } : {},
|
|
90
90
|
...l ? { userId: l } : {},
|
|
91
|
-
...
|
|
92
|
-
...
|
|
91
|
+
...d ? { userName: d } : {},
|
|
92
|
+
...u ? { userEmail: u } : {},
|
|
93
93
|
...C ? { accent: C } : {},
|
|
94
|
-
scope:
|
|
95
|
-
height:
|
|
96
|
-
onClose: () =>
|
|
94
|
+
scope: $ ?? "tenant",
|
|
95
|
+
height: S,
|
|
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: S, minHeight: S === "100%" ? "480px" : void 0 }
|
|
103
103
|
}
|
|
104
104
|
);
|
|
105
105
|
}
|
|
@@ -108,165 +108,167 @@ 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
113
|
apiUrl: i,
|
|
114
|
-
profileId:
|
|
114
|
+
profileId: s,
|
|
115
115
|
token: n,
|
|
116
116
|
refreshToken: r,
|
|
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:
|
|
122
|
+
userId: p,
|
|
123
|
+
userName: h,
|
|
124
124
|
userEmail: L,
|
|
125
125
|
userAvatar: C,
|
|
126
|
-
accent:
|
|
126
|
+
accent: b,
|
|
127
127
|
launcher: t,
|
|
128
128
|
position: f,
|
|
129
|
-
launcherMessage:
|
|
130
|
-
quickReplies:
|
|
131
|
-
height:
|
|
132
|
-
i18n:
|
|
133
|
-
translateLang:
|
|
134
|
-
inbox:
|
|
135
|
-
inboxScope:
|
|
129
|
+
launcherMessage: R,
|
|
130
|
+
quickReplies: S,
|
|
131
|
+
height: j = "100%",
|
|
132
|
+
i18n: M,
|
|
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
146
|
...i ? { apiUrl: i } : {},
|
|
147
|
-
profileId:
|
|
147
|
+
profileId: s,
|
|
148
148
|
...l ? { subjectId: `listing_${l}` } : {},
|
|
149
149
|
...n ? { token: n } : {},
|
|
150
150
|
...r ? { refreshToken: r } : {},
|
|
151
|
-
...
|
|
152
|
-
...
|
|
151
|
+
...p ? { userId: p } : {},
|
|
152
|
+
...p || h || L || C ? {
|
|
153
153
|
user: {
|
|
154
|
-
...
|
|
154
|
+
...h ? { name: h } : {},
|
|
155
155
|
...L ? { email: L } : {},
|
|
156
156
|
...C ? { avatar: C } : {},
|
|
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
|
-
quickReplies:
|
|
169
|
-
...
|
|
170
|
-
...
|
|
171
|
-
...
|
|
172
|
-
|
|
173
|
-
...t ? { launcher: t, position: f ?? "bottom-right", ...
|
|
168
|
+
quickReplies: S ?? q,
|
|
169
|
+
...b ? { accent: b } : {},
|
|
170
|
+
...a ? { translateLang: a } : {},
|
|
171
|
+
...M ? { i18n: M } : {},
|
|
172
|
+
...$ && !t ? { onBack: () => z(!0) } : {},
|
|
173
|
+
...t ? { launcher: t, position: f ?? "bottom-right", ...R ? { launcherMessage: R } : {} } : {}
|
|
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, i,
|
|
181
|
-
|
|
180
|
+
}, [o, i, s, l, n, p, b, t, f, R, a, $, g]), $ && !t && g ? /* @__PURE__ */ e(
|
|
181
|
+
A,
|
|
182
182
|
{
|
|
183
183
|
url: o,
|
|
184
184
|
...i ? { apiUrl: i } : {},
|
|
185
|
-
profileId:
|
|
185
|
+
profileId: s,
|
|
186
186
|
...n ? { token: n } : {},
|
|
187
187
|
...r ? { refreshToken: r } : {},
|
|
188
|
-
...
|
|
189
|
-
...
|
|
188
|
+
...p ? { userId: p } : {},
|
|
189
|
+
...h ? { userName: h } : {},
|
|
190
190
|
...L ? { userEmail: L } : {},
|
|
191
|
-
...
|
|
192
|
-
scope:
|
|
193
|
-
height:
|
|
194
|
-
onClose: () =>
|
|
191
|
+
...b ? { accent: b } : {},
|
|
192
|
+
scope: w ?? "tenant",
|
|
193
|
+
height: j,
|
|
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: j, minHeight: j === "100%" ? "480px" : void 0 }
|
|
201
201
|
}
|
|
202
202
|
);
|
|
203
203
|
}
|
|
204
204
|
function K(o) {
|
|
205
|
-
const [i,
|
|
205
|
+
const [i, 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)`), r = (l) =>
|
|
211
|
-
return
|
|
210
|
+
const n = window.matchMedia(`(max-width: ${o}px)`), r = (l) => s(l.matches);
|
|
211
|
+
return s(n.matches), n.addEventListener("change", r), () => n.removeEventListener("change", r);
|
|
212
212
|
}, [o]), i;
|
|
213
213
|
}
|
|
214
|
-
function
|
|
214
|
+
function A({
|
|
215
215
|
url: o,
|
|
216
216
|
apiUrl: i,
|
|
217
|
-
profileId:
|
|
217
|
+
profileId: s,
|
|
218
218
|
tenantId: n,
|
|
219
219
|
token: r,
|
|
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:
|
|
225
|
+
height: p = "100%",
|
|
226
|
+
i18n: h,
|
|
227
227
|
onClose: L,
|
|
228
228
|
scope: C = "tenant"
|
|
229
229
|
}) {
|
|
230
|
-
const
|
|
230
|
+
const b = !s && !n, [t, f] = k(null), [R, S] = k(!1), j = B(null), M = B(null), a = B(null), $ = B(null);
|
|
231
231
|
return D(() => {
|
|
232
|
-
if (!
|
|
233
|
-
let
|
|
234
|
-
return import("./chatlist.js").
|
|
235
|
-
|
|
236
|
-
|
|
232
|
+
if (!j.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 || S(!0), null)).then((c) => {
|
|
235
|
+
if (!c) return;
|
|
236
|
+
const { mountChatList: x } = c;
|
|
237
|
+
w || !j.current || (a.current = x({
|
|
238
|
+
el: j.current,
|
|
237
239
|
url: o,
|
|
238
240
|
...i ? { apiUrl: i } : {},
|
|
239
|
-
...
|
|
241
|
+
...s ? { profileId: s } : {},
|
|
240
242
|
...n ? { tenantId: n } : {},
|
|
241
243
|
scope: C,
|
|
242
|
-
onSelect: (
|
|
244
|
+
onSelect: (g) => f(g),
|
|
243
245
|
// Compose (✎) opens the chatroom's general support thread — without
|
|
244
246
|
// this a user with no conversations yet had an empty list and no way
|
|
245
247
|
// to ever start one, which is what made ChatApp feel broken.
|
|
246
248
|
// Compose target: the configured chatroom, else the tenant's default
|
|
247
249
|
// (oldest chatroom, reported by the server on the first list fetch).
|
|
248
250
|
onNewChat: () => {
|
|
249
|
-
var
|
|
250
|
-
const
|
|
251
|
-
|
|
251
|
+
var z;
|
|
252
|
+
const g = (z = a.current) == null ? void 0 : z.defaultProfileId();
|
|
253
|
+
g && f({ id: "__new__", profileId: g, state: "open", updatedAt: Date.now() });
|
|
252
254
|
},
|
|
253
255
|
...r ? { token: r } : {},
|
|
254
|
-
...
|
|
256
|
+
...d ? { userId: d } : {},
|
|
255
257
|
...m ? { accent: m } : {},
|
|
256
|
-
...
|
|
258
|
+
...h ? { i18n: h } : {}
|
|
257
259
|
}));
|
|
258
260
|
}), () => {
|
|
259
|
-
var
|
|
260
|
-
|
|
261
|
+
var c;
|
|
262
|
+
w = !0, (c = a.current) == null || c.close(), a.current = null;
|
|
261
263
|
};
|
|
262
|
-
}, [o, i,
|
|
263
|
-
var
|
|
264
|
+
}, [o, i, s, n, r, d, C]), D(() => {
|
|
265
|
+
var c;
|
|
264
266
|
if (!M.current || !t) return;
|
|
265
|
-
(
|
|
267
|
+
(c = $.current) == null || c.close(), $.current = H({
|
|
266
268
|
el: M.current,
|
|
267
269
|
url: o,
|
|
268
270
|
...i ? { apiUrl: i } : {},
|
|
269
|
-
profileId: t.profileId ??
|
|
271
|
+
profileId: t.profileId ?? s,
|
|
270
272
|
// rows always carry theirs; compose sets one explicitly
|
|
271
273
|
// DM rows open as direct conversations (kind + peer). Opening them via
|
|
272
274
|
// their dm:… subjectId only works for the participant that OWNS the
|
|
@@ -274,10 +276,10 @@ function F({
|
|
|
274
276
|
...t.kind === "direct" && t.peerId ? { kind: "direct", peerId: t.peerId } : t.subjectId ? { subjectId: t.subjectId } : {},
|
|
275
277
|
...r ? { token: r } : {},
|
|
276
278
|
...l ? { refreshToken: l } : {},
|
|
277
|
-
...
|
|
278
|
-
...
|
|
279
|
+
...d ? { userId: d } : {},
|
|
280
|
+
...d || u || v ? {
|
|
279
281
|
user: {
|
|
280
|
-
...
|
|
282
|
+
...u ? { name: u } : {},
|
|
281
283
|
...v ? { email: v } : {}
|
|
282
284
|
}
|
|
283
285
|
} : {},
|
|
@@ -291,26 +293,26 @@ function F({
|
|
|
291
293
|
// Stack navigation: the chatroom's back chevron returns to the list.
|
|
292
294
|
onBack: () => f(null)
|
|
293
295
|
});
|
|
294
|
-
const
|
|
295
|
-
var
|
|
296
|
-
return (
|
|
296
|
+
const w = setInterval(() => {
|
|
297
|
+
var x;
|
|
298
|
+
return (x = a.current) == null ? void 0 : x.refresh();
|
|
297
299
|
}, 2e4);
|
|
298
300
|
return () => {
|
|
299
|
-
var
|
|
300
|
-
clearInterval(
|
|
301
|
+
var x, g;
|
|
302
|
+
clearInterval(w), (x = $.current) == null || x.close(), $.current = null, (g = a.current) == null || g.refresh();
|
|
301
303
|
};
|
|
302
|
-
}, [t == null ? void 0 : t.id]),
|
|
304
|
+
}, [t == null ? void 0 : t.id]), b ? /* @__PURE__ */ _("div", { style: { padding: 16, font: "13px system-ui", color: "#b91c1c", background: "#fef2f2", borderRadius: 8 }, children: [
|
|
303
305
|
"[relay] <ChatApp/> needs a ",
|
|
304
306
|
/* @__PURE__ */ e("code", { children: "profileId" }),
|
|
305
307
|
" or a ",
|
|
306
308
|
/* @__PURE__ */ e("code", { children: "tenantId" }),
|
|
307
309
|
"."
|
|
308
|
-
] }) : /* @__PURE__ */
|
|
310
|
+
] }) : /* @__PURE__ */ _("div", { style: { position: "relative", width: "100%", height: p, minHeight: "400px", overflow: "hidden", background: "#fff" }, children: [
|
|
309
311
|
L && !t && /* @__PURE__ */ e(
|
|
310
312
|
"button",
|
|
311
313
|
{
|
|
312
314
|
onClick: L,
|
|
313
|
-
"aria-label": (
|
|
315
|
+
"aria-label": (h == null ? void 0 : h.close) ?? "Close",
|
|
314
316
|
style: {
|
|
315
317
|
position: "absolute",
|
|
316
318
|
top: 8,
|
|
@@ -337,47 +339,47 @@ function F({
|
|
|
337
339
|
inset: 0,
|
|
338
340
|
display: t ? "none" : "flex",
|
|
339
341
|
flexDirection: "column"
|
|
340
|
-
}, children: /* @__PURE__ */ e("div", { ref:
|
|
342
|
+
}, children: R ? /* @__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: j, style: { width: "100%", height: "100%" } }) }),
|
|
341
343
|
t && /* @__PURE__ */ e("div", { style: { position: "absolute", inset: 0, display: "flex", flexDirection: "column" }, children: /* @__PURE__ */ e("div", { ref: M, style: { width: "100%", height: "100%" } }) })
|
|
342
344
|
] });
|
|
343
345
|
}
|
|
344
|
-
function
|
|
346
|
+
function X({
|
|
345
347
|
url: o,
|
|
346
348
|
apiUrl: i,
|
|
347
|
-
profileId:
|
|
349
|
+
profileId: s,
|
|
348
350
|
tenantId: n,
|
|
349
351
|
token: r,
|
|
350
352
|
refreshToken: l,
|
|
351
|
-
userId:
|
|
352
|
-
userName:
|
|
353
|
+
userId: d,
|
|
354
|
+
userName: u,
|
|
353
355
|
userEmail: v,
|
|
354
356
|
scope: m,
|
|
355
|
-
accent:
|
|
356
|
-
floating:
|
|
357
|
+
accent: p = "#4F63F5",
|
|
358
|
+
floating: h = !0,
|
|
357
359
|
position: L = "bottom-right",
|
|
358
360
|
label: C,
|
|
359
|
-
panelWidth:
|
|
361
|
+
panelWidth: b,
|
|
360
362
|
panelHeight: t = "600px"
|
|
361
363
|
}) {
|
|
362
|
-
const [f,
|
|
364
|
+
const [f, R] = k(!1), S = B(null), j = L === "bottom-right", M = C ?? (h ? void 0 : "Messages"), a = K(479);
|
|
363
365
|
if (D(() => {
|
|
364
|
-
const y = (
|
|
365
|
-
|
|
366
|
+
const y = (F) => {
|
|
367
|
+
F.key === "Escape" && R(!1);
|
|
366
368
|
};
|
|
367
369
|
return document.addEventListener("keydown", y), () => document.removeEventListener("keydown", y);
|
|
368
|
-
}, []),
|
|
369
|
-
return /* @__PURE__ */
|
|
370
|
+
}, []), h)
|
|
371
|
+
return /* @__PURE__ */ _("div", { style: {
|
|
370
372
|
position: "fixed",
|
|
371
|
-
[
|
|
373
|
+
[j ? "right" : "left"]: "20px",
|
|
372
374
|
bottom: "20px",
|
|
373
375
|
zIndex: 9999,
|
|
374
376
|
display: "flex",
|
|
375
377
|
flexDirection: "column",
|
|
376
|
-
alignItems:
|
|
378
|
+
alignItems: j ? "flex-end" : "flex-start",
|
|
377
379
|
gap: "12px"
|
|
378
380
|
}, children: [
|
|
379
381
|
/* @__PURE__ */ e("div", { style: {
|
|
380
|
-
...
|
|
382
|
+
...a ? {
|
|
381
383
|
position: "fixed",
|
|
382
384
|
inset: 0,
|
|
383
385
|
width: "100%",
|
|
@@ -385,47 +387,47 @@ function Z({
|
|
|
385
387
|
borderRadius: "0",
|
|
386
388
|
zIndex: 9998
|
|
387
389
|
} : {
|
|
388
|
-
width: `min(${
|
|
390
|
+
width: `min(${b ?? "420px"}, calc(100vw - 40px))`,
|
|
389
391
|
height: `min(${t}, calc(100dvh - 108px))`,
|
|
390
392
|
borderRadius: "16px"
|
|
391
393
|
},
|
|
392
394
|
overflow: "hidden",
|
|
393
|
-
boxShadow:
|
|
395
|
+
boxShadow: a ? "none" : "0 8px 40px rgba(0,0,0,.18)",
|
|
394
396
|
background: "#fff",
|
|
395
397
|
display: f ? "flex" : "none",
|
|
396
398
|
flexDirection: "column",
|
|
397
|
-
transformOrigin: `bottom ${
|
|
399
|
+
transformOrigin: `bottom ${j ? "right" : "left"}`,
|
|
398
400
|
animation: f ? "ocl-pop-in .18s ease" : "none"
|
|
399
401
|
}, children: /* @__PURE__ */ e(
|
|
400
|
-
|
|
402
|
+
A,
|
|
401
403
|
{
|
|
402
404
|
url: o,
|
|
403
405
|
...i ? { apiUrl: i } : {},
|
|
404
|
-
...
|
|
406
|
+
...s ? { profileId: s } : {},
|
|
405
407
|
...n ? { tenantId: n } : {},
|
|
406
408
|
...r ? { token: r } : {},
|
|
407
409
|
...l ? { refreshToken: l } : {},
|
|
408
|
-
...
|
|
409
|
-
...
|
|
410
|
+
...d ? { userId: d } : {},
|
|
411
|
+
...u ? { userName: u } : {},
|
|
410
412
|
...v ? { userEmail: v } : {},
|
|
411
413
|
...m ? { scope: m } : {},
|
|
412
|
-
accent:
|
|
414
|
+
accent: p,
|
|
413
415
|
height: "100%",
|
|
414
|
-
onClose: () =>
|
|
416
|
+
onClose: () => R(!1)
|
|
415
417
|
}
|
|
416
418
|
) }),
|
|
417
419
|
/* @__PURE__ */ e(
|
|
418
420
|
"button",
|
|
419
421
|
{
|
|
420
|
-
ref:
|
|
421
|
-
onClick: () =>
|
|
422
|
-
"aria-label": f ? "Close chat" : typeof
|
|
422
|
+
ref: S,
|
|
423
|
+
onClick: () => R((y) => !y),
|
|
424
|
+
"aria-label": f ? "Close chat" : typeof M == "string" ? M : "Open chat",
|
|
423
425
|
"aria-expanded": f,
|
|
424
426
|
style: {
|
|
425
427
|
width: "56px",
|
|
426
428
|
height: "56px",
|
|
427
429
|
borderRadius: "50%",
|
|
428
|
-
background:
|
|
430
|
+
background: p,
|
|
429
431
|
color: "#fff",
|
|
430
432
|
border: "none",
|
|
431
433
|
fontSize: "20px",
|
|
@@ -435,7 +437,7 @@ function Z({
|
|
|
435
437
|
transition: "transform .15s",
|
|
436
438
|
alignItems: "center",
|
|
437
439
|
justifyContent: "center",
|
|
438
|
-
display: f &&
|
|
440
|
+
display: f && a ? "none" : "flex"
|
|
439
441
|
},
|
|
440
442
|
onMouseEnter: (y) => {
|
|
441
443
|
y.currentTarget.style.transform = "scale(1.08)";
|
|
@@ -448,24 +450,24 @@ function Z({
|
|
|
448
450
|
),
|
|
449
451
|
/* @__PURE__ */ e("style", { children: "@keyframes ocl-pop-in { from { opacity:0; transform:scale(.95) } to { opacity:1; transform:scale(1) } }" })
|
|
450
452
|
] });
|
|
451
|
-
const
|
|
452
|
-
!f &&
|
|
453
|
-
},
|
|
454
|
-
return /* @__PURE__ */
|
|
455
|
-
/* @__PURE__ */
|
|
453
|
+
const $ = `min(${b ?? "420px"}, calc(100vw - 16px))`, [w, c] = k(null), x = () => {
|
|
454
|
+
!f && S.current && c(S.current.getBoundingClientRect()), R((y) => !y);
|
|
455
|
+
}, g = w ? w.bottom + 8 : 0, z = w ? Math.max(8, window.innerWidth - w.right) : 0;
|
|
456
|
+
return /* @__PURE__ */ _(O, { children: [
|
|
457
|
+
/* @__PURE__ */ _(
|
|
456
458
|
"button",
|
|
457
459
|
{
|
|
458
|
-
ref:
|
|
459
|
-
onClick:
|
|
460
|
+
ref: S,
|
|
461
|
+
onClick: x,
|
|
460
462
|
style: {
|
|
461
463
|
display: "inline-flex",
|
|
462
464
|
alignItems: "center",
|
|
463
465
|
gap: "6px",
|
|
464
466
|
padding: "8px 16px",
|
|
465
467
|
borderRadius: "8px",
|
|
466
|
-
background: f ?
|
|
467
|
-
color: f ? "#fff" :
|
|
468
|
-
border: `2px solid ${
|
|
468
|
+
background: f ? p : "transparent",
|
|
469
|
+
color: f ? "#fff" : p,
|
|
470
|
+
border: `2px solid ${p}`,
|
|
469
471
|
fontSize: "14px",
|
|
470
472
|
fontWeight: 600,
|
|
471
473
|
cursor: "pointer",
|
|
@@ -474,53 +476,53 @@ function Z({
|
|
|
474
476
|
children: [
|
|
475
477
|
/* @__PURE__ */ e(G, { size: 16 }),
|
|
476
478
|
" ",
|
|
477
|
-
|
|
479
|
+
M
|
|
478
480
|
]
|
|
479
481
|
}
|
|
480
482
|
),
|
|
481
|
-
f &&
|
|
483
|
+
f && w && /* @__PURE__ */ _(O, { children: [
|
|
482
484
|
/* @__PURE__ */ e(
|
|
483
485
|
"div",
|
|
484
486
|
{
|
|
485
|
-
onClick: () =>
|
|
487
|
+
onClick: () => R(!1),
|
|
486
488
|
style: { position: "fixed", inset: 0, zIndex: 9998 }
|
|
487
489
|
}
|
|
488
490
|
),
|
|
489
491
|
/* @__PURE__ */ e("div", { style: {
|
|
490
492
|
position: "fixed",
|
|
491
|
-
...
|
|
493
|
+
...a ? {
|
|
492
494
|
inset: 0,
|
|
493
495
|
width: "100%",
|
|
494
496
|
height: "100dvh",
|
|
495
497
|
borderRadius: "0"
|
|
496
498
|
} : {
|
|
497
|
-
top:
|
|
498
|
-
right:
|
|
499
|
-
width:
|
|
500
|
-
height: `min(${t}, calc(100dvh - ${
|
|
499
|
+
top: g,
|
|
500
|
+
right: z,
|
|
501
|
+
width: $,
|
|
502
|
+
height: `min(${t}, calc(100dvh - ${g}px - 12px))`,
|
|
501
503
|
borderRadius: "16px"
|
|
502
504
|
},
|
|
503
505
|
overflow: "hidden",
|
|
504
|
-
boxShadow:
|
|
506
|
+
boxShadow: a ? "none" : "0 8px 40px rgba(0,0,0,.2)",
|
|
505
507
|
background: "#fff",
|
|
506
508
|
zIndex: 9999,
|
|
507
509
|
animation: "ocl-slide-in .18s ease"
|
|
508
510
|
}, children: /* @__PURE__ */ e(
|
|
509
|
-
|
|
511
|
+
A,
|
|
510
512
|
{
|
|
511
513
|
url: o,
|
|
512
514
|
...i ? { apiUrl: i } : {},
|
|
513
|
-
...
|
|
515
|
+
...s ? { profileId: s } : {},
|
|
514
516
|
...n ? { tenantId: n } : {},
|
|
515
517
|
...r ? { token: r } : {},
|
|
516
518
|
...l ? { refreshToken: l } : {},
|
|
517
|
-
...
|
|
518
|
-
...
|
|
519
|
+
...d ? { userId: d } : {},
|
|
520
|
+
...u ? { userName: u } : {},
|
|
519
521
|
...v ? { userEmail: v } : {},
|
|
520
522
|
...m ? { scope: m } : {},
|
|
521
|
-
accent:
|
|
523
|
+
accent: p,
|
|
522
524
|
height: "100%",
|
|
523
|
-
onClose: () =>
|
|
525
|
+
onClose: () => R(!1)
|
|
524
526
|
}
|
|
525
527
|
) }),
|
|
526
528
|
/* @__PURE__ */ e("style", { children: "@keyframes ocl-slide-in { from { opacity:0; transform:translateY(-8px) } to { opacity:1; transform:translateY(0) } }" })
|
|
@@ -528,9 +530,9 @@ function Z({
|
|
|
528
530
|
] });
|
|
529
531
|
}
|
|
530
532
|
export {
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
533
|
+
A as ChatApp,
|
|
534
|
+
X as ChatAppLauncher,
|
|
535
|
+
Q as ChatWidget,
|
|
536
|
+
V as MarketplaceChat
|
|
535
537
|
};
|
|
536
538
|
//# sourceMappingURL=react.js.map
|