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