@paramms/chat-widget 1.6.3 → 1.7.0

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