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