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