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