@livelayer/react 0.5.5-pr66c.1 → 0.5.5-pr66c.2
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/index.js +3 -3
- package/dist/index.mjs +441 -453
- package/package.json +2 -2
package/dist/index.mjs
CHANGED
|
@@ -34,7 +34,7 @@ class mn extends dn {
|
|
|
34
34
|
}
|
|
35
35
|
}
|
|
36
36
|
function gn(e) {
|
|
37
|
-
const [t, r] = S("idle"), [o, i] = S("idle"), [l, s] = S([]), [d,
|
|
37
|
+
const [t, r] = S("idle"), [o, i] = S("idle"), [l, s] = S([]), [d, u] = S(null), [m, h] = S(null), [a, c] = S(null), [R, C] = S(!1), [L, v] = S(null), b = E(null), z = E(e.onDataMessage);
|
|
38
38
|
z.current = e.onDataMessage, T(() => {
|
|
39
39
|
const N = {
|
|
40
40
|
onConnectionStateChange: (D) => {
|
|
@@ -42,10 +42,10 @@ function gn(e) {
|
|
|
42
42
|
},
|
|
43
43
|
onAgentStateChange: i,
|
|
44
44
|
onTranscript: (D) => s([...D]),
|
|
45
|
-
onAgentConfig:
|
|
45
|
+
onAgentConfig: u,
|
|
46
46
|
onAudioTrack: (D) => c(D),
|
|
47
|
-
onVideoTrack: (D) =>
|
|
48
|
-
onVideoTrackRemoved: () =>
|
|
47
|
+
onVideoTrack: (D) => h(D),
|
|
48
|
+
onVideoTrackRemoved: () => h(null),
|
|
49
49
|
onError: (D) => v(D),
|
|
50
50
|
onDataMessage: (D) => {
|
|
51
51
|
var A;
|
|
@@ -62,7 +62,7 @@ function gn(e) {
|
|
|
62
62
|
},
|
|
63
63
|
N
|
|
64
64
|
);
|
|
65
|
-
return b.current = B, r("idle"), i("idle"), s([]),
|
|
65
|
+
return b.current = B, r("idle"), i("idle"), s([]), u(null), h(null), c(null), C(!1), v(null), () => {
|
|
66
66
|
var D;
|
|
67
67
|
(D = B.destroy) == null || D.call(B), b.current = null;
|
|
68
68
|
};
|
|
@@ -93,7 +93,7 @@ function gn(e) {
|
|
|
93
93
|
agentState: o,
|
|
94
94
|
transcript: l,
|
|
95
95
|
agentConfig: d,
|
|
96
|
-
videoElement:
|
|
96
|
+
videoElement: m,
|
|
97
97
|
audioElement: a,
|
|
98
98
|
canResume: R,
|
|
99
99
|
error: L,
|
|
@@ -129,7 +129,7 @@ function yn() {
|
|
|
129
129
|
if (e.current || typeof window > "u" || typeof AudioContext > "u") return;
|
|
130
130
|
const a = new AudioContext(), c = a.createAnalyser();
|
|
131
131
|
c.fftSize = 64, c.connect(a.destination), e.current = a, t.current = c;
|
|
132
|
-
}, []),
|
|
132
|
+
}, []), u = k(
|
|
133
133
|
(a) => {
|
|
134
134
|
if (d(), !(!e.current || !t.current)) {
|
|
135
135
|
if (r.current) {
|
|
@@ -150,7 +150,7 @@ function yn() {
|
|
|
150
150
|
}
|
|
151
151
|
},
|
|
152
152
|
[d, s]
|
|
153
|
-
),
|
|
153
|
+
), m = k(() => {
|
|
154
154
|
if (o.current !== null && (cancelAnimationFrame(o.current), o.current = null), r.current) {
|
|
155
155
|
try {
|
|
156
156
|
r.current.disconnect();
|
|
@@ -158,11 +158,11 @@ function yn() {
|
|
|
158
158
|
}
|
|
159
159
|
r.current = null;
|
|
160
160
|
}
|
|
161
|
-
}, []),
|
|
161
|
+
}, []), h = k((a) => (i.current.add(a), () => {
|
|
162
162
|
i.current.delete(a);
|
|
163
163
|
}), []);
|
|
164
164
|
return T(() => () => {
|
|
165
|
-
if (
|
|
165
|
+
if (m(), t.current) {
|
|
166
166
|
try {
|
|
167
167
|
t.current.disconnect();
|
|
168
168
|
} catch {
|
|
@@ -177,10 +177,10 @@ function yn() {
|
|
|
177
177
|
e.current = null;
|
|
178
178
|
}
|
|
179
179
|
i.current.clear(), l.current = null;
|
|
180
|
-
}, [
|
|
180
|
+
}, [m]), { attach: u, detach: m, subscribe: h };
|
|
181
181
|
}
|
|
182
182
|
function vn() {
|
|
183
|
-
const [e, t] = S(!1), [r, o] = S(null), i = E(null), l = E(null), s = k(async (
|
|
183
|
+
const [e, t] = S(!1), [r, o] = S(null), i = E(null), l = E(null), s = k(async (h) => {
|
|
184
184
|
if (i.current && l.current) {
|
|
185
185
|
try {
|
|
186
186
|
await l.current.localParticipant.unpublishTrack(i.current);
|
|
@@ -188,46 +188,46 @@ function vn() {
|
|
|
188
188
|
}
|
|
189
189
|
i.current.stop(), i.current = null;
|
|
190
190
|
}
|
|
191
|
-
l.current =
|
|
191
|
+
l.current = h, o(null);
|
|
192
192
|
try {
|
|
193
193
|
const a = await pn({
|
|
194
194
|
echoCancellation: !0,
|
|
195
195
|
noiseSuppression: !0
|
|
196
196
|
});
|
|
197
|
-
await
|
|
197
|
+
await h.localParticipant.publishTrack(a), i.current = a, t(a.isMuted);
|
|
198
198
|
} catch (a) {
|
|
199
199
|
const c = a instanceof Error && a.name === "NotAllowedError" ? "Enable your microphone to talk with the agent." : "Microphone unavailable. Check browser permissions and try again.";
|
|
200
200
|
throw o(c), a;
|
|
201
201
|
}
|
|
202
202
|
}, []), d = k(() => {
|
|
203
|
-
const
|
|
204
|
-
|
|
205
|
-
}, []),
|
|
206
|
-
const
|
|
207
|
-
if (
|
|
203
|
+
const h = i.current;
|
|
204
|
+
h && (h.isMuted ? (h.unmute(), t(!1)) : (h.mute(), t(!0)));
|
|
205
|
+
}, []), u = k(() => {
|
|
206
|
+
const h = i.current, a = l.current;
|
|
207
|
+
if (h && a) {
|
|
208
208
|
try {
|
|
209
|
-
a.localParticipant.unpublishTrack(
|
|
209
|
+
a.localParticipant.unpublishTrack(h);
|
|
210
210
|
} catch {
|
|
211
211
|
}
|
|
212
|
-
|
|
212
|
+
h.stop();
|
|
213
213
|
}
|
|
214
214
|
i.current = null, l.current = null, t(!1);
|
|
215
|
-
}, []),
|
|
215
|
+
}, []), m = k(() => o(null), []);
|
|
216
216
|
return {
|
|
217
217
|
isMuted: e,
|
|
218
218
|
micError: r,
|
|
219
219
|
toggleMute: d,
|
|
220
220
|
setupMic: s,
|
|
221
|
-
teardownMic:
|
|
222
|
-
clearError:
|
|
221
|
+
teardownMic: u,
|
|
222
|
+
clearError: m
|
|
223
223
|
};
|
|
224
224
|
}
|
|
225
225
|
const bn = { resolution: { width: 640, height: 480, frameRate: 24 } };
|
|
226
226
|
function wn() {
|
|
227
|
-
const [e, t] = S(!1), [r, o] = S(null), [i, l] = S(null), [s, d] = S(""),
|
|
228
|
-
|
|
227
|
+
const [e, t] = S(!1), [r, o] = S(null), [i, l] = S(null), [s, d] = S(""), u = E(null), m = E(null), h = k((b) => {
|
|
228
|
+
u.current = b;
|
|
229
229
|
}, []), a = k(() => {
|
|
230
|
-
const b =
|
|
230
|
+
const b = u.current, z = m.current;
|
|
231
231
|
if (z && b) {
|
|
232
232
|
const I = b.localParticipant.getTrackPublication(jt.Source.Camera);
|
|
233
233
|
if (I != null && I.track) {
|
|
@@ -239,16 +239,16 @@ function wn() {
|
|
|
239
239
|
} else
|
|
240
240
|
z.stop();
|
|
241
241
|
}
|
|
242
|
-
|
|
242
|
+
m.current = null, l(null), t(!1);
|
|
243
243
|
}, []), c = k(async (b) => {
|
|
244
|
-
const z =
|
|
244
|
+
const z = u.current;
|
|
245
245
|
if (z) {
|
|
246
246
|
o(null);
|
|
247
247
|
try {
|
|
248
248
|
const I = { ...bn };
|
|
249
249
|
b && (I.deviceId = b);
|
|
250
250
|
const H = await hn(I);
|
|
251
|
-
await z.localParticipant.publishTrack(H),
|
|
251
|
+
await z.localParticipant.publishTrack(H), m.current = H;
|
|
252
252
|
const p = H.attach();
|
|
253
253
|
l(p), t(!0), b && d(b);
|
|
254
254
|
try {
|
|
@@ -268,10 +268,10 @@ function wn() {
|
|
|
268
268
|
}, [e, s, a, c]), C = k(async (b) => {
|
|
269
269
|
a(), await c(b);
|
|
270
270
|
}, [a, c]), L = k(() => {
|
|
271
|
-
a(),
|
|
271
|
+
a(), u.current = null, o(null), d("");
|
|
272
272
|
}, [a]), v = k(() => o(null), []);
|
|
273
273
|
return T(() => () => {
|
|
274
|
-
|
|
274
|
+
m.current && m.current.stop();
|
|
275
275
|
}, []), {
|
|
276
276
|
isEnabled: e,
|
|
277
277
|
error: r,
|
|
@@ -279,7 +279,7 @@ function wn() {
|
|
|
279
279
|
activeDeviceId: s,
|
|
280
280
|
toggle: R,
|
|
281
281
|
switchDevice: C,
|
|
282
|
-
attachRoom:
|
|
282
|
+
attachRoom: h,
|
|
283
283
|
teardown: L,
|
|
284
284
|
clearError: v
|
|
285
285
|
};
|
|
@@ -287,7 +287,7 @@ function wn() {
|
|
|
287
287
|
function _n() {
|
|
288
288
|
const [e, t] = S(!1), [r, o] = S(null), [i, l] = S(null), s = E(null), d = k((c) => {
|
|
289
289
|
s.current = c;
|
|
290
|
-
}, []),
|
|
290
|
+
}, []), u = k(() => l(null), []), m = k(async () => {
|
|
291
291
|
const c = s.current;
|
|
292
292
|
if (c) {
|
|
293
293
|
if (e) {
|
|
@@ -295,7 +295,7 @@ function _n() {
|
|
|
295
295
|
await c.localParticipant.setScreenShareEnabled(!1);
|
|
296
296
|
} catch {
|
|
297
297
|
}
|
|
298
|
-
|
|
298
|
+
u(), t(!1);
|
|
299
299
|
return;
|
|
300
300
|
}
|
|
301
301
|
o(null);
|
|
@@ -324,16 +324,16 @@ function _n() {
|
|
|
324
324
|
C !== "NotAllowedError" && C !== "AbortError" && o("Screen share unavailable. Try again."), t(!1);
|
|
325
325
|
}
|
|
326
326
|
}
|
|
327
|
-
}, [e,
|
|
327
|
+
}, [e, u]), h = k(() => {
|
|
328
328
|
const c = s.current;
|
|
329
329
|
if (c && e)
|
|
330
330
|
try {
|
|
331
331
|
c.localParticipant.setScreenShareEnabled(!1);
|
|
332
332
|
} catch {
|
|
333
333
|
}
|
|
334
|
-
|
|
335
|
-
}, [e,
|
|
336
|
-
return { isEnabled: e, error: r, previewEl: i, toggle:
|
|
334
|
+
u(), t(!1), o(null), s.current = null;
|
|
335
|
+
}, [e, u]), a = k(() => o(null), []);
|
|
336
|
+
return { isEnabled: e, error: r, previewEl: i, toggle: m, attachRoom: d, teardown: h, clearError: a };
|
|
337
337
|
}
|
|
338
338
|
function xn() {
|
|
339
339
|
const [e, t] = S([]), [r, o] = S([]), i = k(async () => {
|
|
@@ -351,15 +351,15 @@ function xn() {
|
|
|
351
351
|
}, [i]), { mics: e, cameras: r, refresh: i };
|
|
352
352
|
}
|
|
353
353
|
function kn(e, t, r = !1) {
|
|
354
|
-
const [o, i] = S(null), [l, s] = S(null), [d,
|
|
354
|
+
const [o, i] = S(null), [l, s] = S(null), [d, u] = S(!r && !!e);
|
|
355
355
|
return T(() => {
|
|
356
356
|
if (r || !e) {
|
|
357
|
-
|
|
357
|
+
u(!1);
|
|
358
358
|
return;
|
|
359
359
|
}
|
|
360
|
-
const
|
|
361
|
-
return
|
|
362
|
-
signal:
|
|
360
|
+
const m = new AbortController(), h = t || "https://app.livelayer.studio";
|
|
361
|
+
return u(!0), s(null), fetch(`${h}/api/widget/agent/${encodeURIComponent(e)}`, {
|
|
362
|
+
signal: m.signal
|
|
363
363
|
}).then(async (a) => {
|
|
364
364
|
if (!a.ok) {
|
|
365
365
|
const c = await a.json().catch(() => ({}));
|
|
@@ -367,10 +367,10 @@ function kn(e, t, r = !1) {
|
|
|
367
367
|
}
|
|
368
368
|
return a.json();
|
|
369
369
|
}).then((a) => {
|
|
370
|
-
|
|
370
|
+
m.signal.aborted || (i(a), u(!1));
|
|
371
371
|
}).catch((a) => {
|
|
372
|
-
|
|
373
|
-
}), () =>
|
|
372
|
+
m.signal.aborted || (s(a instanceof Error ? a.message : "Agent lookup failed"), u(!1));
|
|
373
|
+
}), () => m.abort();
|
|
374
374
|
}, [e, t, r]), { info: o, error: l, loading: d };
|
|
375
375
|
}
|
|
376
376
|
function Ln(e) {
|
|
@@ -394,8 +394,8 @@ function Cn({
|
|
|
394
394
|
onChange: r
|
|
395
395
|
} = {}) {
|
|
396
396
|
const o = e !== void 0, [i, l] = S(t), s = o ? e : i, d = k(
|
|
397
|
-
(
|
|
398
|
-
|
|
397
|
+
(u) => {
|
|
398
|
+
u !== s && (o || l(u), r == null || r(u));
|
|
399
399
|
},
|
|
400
400
|
[s, o, r]
|
|
401
401
|
);
|
|
@@ -412,18 +412,18 @@ function An({
|
|
|
412
412
|
persistKey: o = "ll-widget",
|
|
413
413
|
disablePersistence: i = !1
|
|
414
414
|
} = {}) {
|
|
415
|
-
const l = `${o}:display-mode`, s = E(!1), [d,
|
|
415
|
+
const l = `${o}:display-mode`, s = E(!1), [d, u] = Cn({
|
|
416
416
|
value: e,
|
|
417
417
|
defaultValue: t,
|
|
418
|
-
onChange: (
|
|
419
|
-
e === void 0 && !i && Sn(l,
|
|
418
|
+
onChange: (m) => {
|
|
419
|
+
e === void 0 && !i && Sn(l, m), r == null || r(m);
|
|
420
420
|
}
|
|
421
421
|
});
|
|
422
422
|
return T(() => {
|
|
423
423
|
if (s.current || (s.current = !0, i || e !== void 0)) return;
|
|
424
|
-
const
|
|
425
|
-
|
|
426
|
-
}, []), [d,
|
|
424
|
+
const m = Nn(Ln(l));
|
|
425
|
+
m && m !== d && u(m);
|
|
426
|
+
}, []), [d, u];
|
|
427
427
|
}
|
|
428
428
|
const Rn = 640;
|
|
429
429
|
function In(e = Rn) {
|
|
@@ -476,8 +476,8 @@ function Dn(e) {
|
|
|
476
476
|
function $n(e) {
|
|
477
477
|
const t = Rt.get(e);
|
|
478
478
|
if (t) return t;
|
|
479
|
-
const r = e.length > 1 && e.endsWith("/") ? e.slice(0, -1) : e, o = "", i = "", l = r.replace(/\*\*/g, o).replace(/\*/g, i), d = Dn(l).replace(new RegExp(`\\/${o}`, "g"), "(?:\\/.*)?").replace(new RegExp(o, "g"), ".*").replace(new RegExp(i, "g"), "[^/]+"),
|
|
480
|
-
return Rt.set(e,
|
|
479
|
+
const r = e.length > 1 && e.endsWith("/") ? e.slice(0, -1) : e, o = "", i = "", l = r.replace(/\*\*/g, o).replace(/\*/g, i), d = Dn(l).replace(new RegExp(`\\/${o}`, "g"), "(?:\\/.*)?").replace(new RegExp(o, "g"), ".*").replace(new RegExp(i, "g"), "[^/]+"), u = new RegExp(`^${d}\\/?$`);
|
|
480
|
+
return Rt.set(e, u), u;
|
|
481
481
|
}
|
|
482
482
|
function zn(e, t) {
|
|
483
483
|
const r = t.length > 1 && t.endsWith("/") ? t.slice(0, -1) : t;
|
|
@@ -625,13 +625,13 @@ const Vn = ({
|
|
|
625
625
|
avatarImageUrl: l,
|
|
626
626
|
agentName: s
|
|
627
627
|
}) => {
|
|
628
|
-
const d = Fn(e),
|
|
628
|
+
const d = Fn(e), u = d === "right" ? "left" : "right", m = t ? 80 : 72, h = !!l, [a, c] = S(null), [R, C] = S(!1), L = E(null), v = E(!1), b = k(
|
|
629
629
|
(A) => {
|
|
630
630
|
if (typeof window > "u") return A;
|
|
631
|
-
const O =
|
|
632
|
-
return
|
|
631
|
+
const O = m / 2, W = Dt + O, V = window.innerHeight - Dt - O;
|
|
632
|
+
return V < W ? Math.max(W, A) : Math.max(W, Math.min(V, A));
|
|
633
633
|
},
|
|
634
|
-
[
|
|
634
|
+
[m]
|
|
635
635
|
);
|
|
636
636
|
T(() => {
|
|
637
637
|
const A = jn();
|
|
@@ -689,8 +689,8 @@ const Vn = ({
|
|
|
689
689
|
const O = A.key === "ArrowUp" ? -8 : 8;
|
|
690
690
|
c((W) => {
|
|
691
691
|
if (W === null) return W;
|
|
692
|
-
const
|
|
693
|
-
return $t(
|
|
692
|
+
const V = b(W + O);
|
|
693
|
+
return $t(V), V;
|
|
694
694
|
});
|
|
695
695
|
}
|
|
696
696
|
},
|
|
@@ -701,8 +701,8 @@ const Vn = ({
|
|
|
701
701
|
t ? "ll-hidden--mobile" : "ll-hidden--desktop",
|
|
702
702
|
r ? "ll-hidden--speaking" : null,
|
|
703
703
|
R ? "is-dragging" : null,
|
|
704
|
-
|
|
705
|
-
].filter(Boolean).join(" "), D = a === null ? void 0 : { top: `${a -
|
|
704
|
+
h ? "ll-hidden--with-avatar" : null
|
|
705
|
+
].filter(Boolean).join(" "), D = a === null ? void 0 : { top: `${a - m / 2}px`, transform: "none" };
|
|
706
706
|
return /* @__PURE__ */ n(
|
|
707
707
|
"button",
|
|
708
708
|
{
|
|
@@ -717,7 +717,7 @@ const Vn = ({
|
|
|
717
717
|
"aria-label": i,
|
|
718
718
|
"data-position": e,
|
|
719
719
|
style: D,
|
|
720
|
-
children:
|
|
720
|
+
children: h ? (
|
|
721
721
|
// Layout: tiny chevron flush against the inward edge (peeks out
|
|
722
722
|
// as the click affordance), then the circular avatar photo
|
|
723
723
|
// taking the rest of the tab. Reinforces "this is an
|
|
@@ -726,7 +726,7 @@ const Vn = ({
|
|
|
726
726
|
/* @__PURE__ */ n(
|
|
727
727
|
Pt,
|
|
728
728
|
{
|
|
729
|
-
direction:
|
|
729
|
+
direction: u,
|
|
730
730
|
className: "ll-hidden__chevron ll-hidden__chevron--mini"
|
|
731
731
|
}
|
|
732
732
|
),
|
|
@@ -743,7 +743,7 @@ const Vn = ({
|
|
|
743
743
|
) : /* @__PURE__ */ n(
|
|
744
744
|
Pt,
|
|
745
745
|
{
|
|
746
|
-
direction:
|
|
746
|
+
direction: u,
|
|
747
747
|
className: "ll-hidden__chevron"
|
|
748
748
|
}
|
|
749
749
|
)
|
|
@@ -757,20 +757,20 @@ const Vn = ({
|
|
|
757
757
|
className: i,
|
|
758
758
|
barClassName: l
|
|
759
759
|
}) => {
|
|
760
|
-
const s = E(null), d = E([]),
|
|
761
|
-
const
|
|
762
|
-
return Array.from({ length: t }, (a, c) => 0.5 + c *
|
|
760
|
+
const s = E(null), d = E([]), u = Ze(() => {
|
|
761
|
+
const h = (Math.sqrt(5) - 1) / 2;
|
|
762
|
+
return Array.from({ length: t }, (a, c) => 0.5 + c * h % 1 * 0.5);
|
|
763
763
|
}, [t]);
|
|
764
764
|
T(() => e.subscribe((a) => {
|
|
765
765
|
for (let c = 0; c < t; c++) {
|
|
766
766
|
const R = d.current[c];
|
|
767
767
|
if (!R) continue;
|
|
768
|
-
const C = Math.max(o, a * r *
|
|
768
|
+
const C = Math.max(o, a * r * u[c]);
|
|
769
769
|
R.style.height = `${C}px`;
|
|
770
770
|
}
|
|
771
|
-
}), [e, t, r, o,
|
|
772
|
-
const
|
|
773
|
-
return /* @__PURE__ */ n("div", { ref: s, className:
|
|
771
|
+
}), [e, t, r, o, u]);
|
|
772
|
+
const m = ["ll-waveform", i].filter(Boolean).join(" ");
|
|
773
|
+
return /* @__PURE__ */ n("div", { ref: s, className: m, "aria-hidden": "true", children: Array.from({ length: t }, (h, a) => /* @__PURE__ */ n(
|
|
774
774
|
"div",
|
|
775
775
|
{
|
|
776
776
|
ref: (c) => {
|
|
@@ -781,7 +781,7 @@ const Vn = ({
|
|
|
781
781
|
},
|
|
782
782
|
a
|
|
783
783
|
)) });
|
|
784
|
-
},
|
|
784
|
+
}, Gn = ({
|
|
785
785
|
position: e,
|
|
786
786
|
isMobile: t,
|
|
787
787
|
agentName: r,
|
|
@@ -790,8 +790,8 @@ const Vn = ({
|
|
|
790
790
|
isMuted: l,
|
|
791
791
|
audioLevel: s,
|
|
792
792
|
onExpand: d,
|
|
793
|
-
onToggleMute:
|
|
794
|
-
onClose:
|
|
793
|
+
onToggleMute: u,
|
|
794
|
+
onClose: m
|
|
795
795
|
}) => t ? /* @__PURE__ */ n(
|
|
796
796
|
"div",
|
|
797
797
|
{
|
|
@@ -834,11 +834,11 @@ const Vn = ({
|
|
|
834
834
|
className: "ll-minimized__btn",
|
|
835
835
|
role: "button",
|
|
836
836
|
tabIndex: 0,
|
|
837
|
-
onClick: (
|
|
838
|
-
|
|
837
|
+
onClick: (h) => {
|
|
838
|
+
h.stopPropagation(), u();
|
|
839
839
|
},
|
|
840
|
-
onKeyDown: (
|
|
841
|
-
(
|
|
840
|
+
onKeyDown: (h) => {
|
|
841
|
+
(h.key === "Enter" || h.key === " ") && (h.stopPropagation(), h.preventDefault(), u());
|
|
842
842
|
},
|
|
843
843
|
"aria-label": l ? "Unmute microphone" : "Mute microphone",
|
|
844
844
|
children: /* @__PURE__ */ n(Mt, { muted: l, className: "ll-minimized__icon" })
|
|
@@ -879,7 +879,7 @@ const Vn = ({
|
|
|
879
879
|
{
|
|
880
880
|
type: "button",
|
|
881
881
|
className: "ll-minimized__btn",
|
|
882
|
-
onClick:
|
|
882
|
+
onClick: u,
|
|
883
883
|
"aria-label": l ? "Unmute microphone" : "Mute microphone",
|
|
884
884
|
children: /* @__PURE__ */ n(Mt, { muted: l, className: "ll-minimized__icon" })
|
|
885
885
|
}
|
|
@@ -899,7 +899,7 @@ const Vn = ({
|
|
|
899
899
|
{
|
|
900
900
|
type: "button",
|
|
901
901
|
className: "ll-minimized__btn ll-minimized__btn--close",
|
|
902
|
-
onClick:
|
|
902
|
+
onClick: m,
|
|
903
903
|
"aria-label": "Close widget",
|
|
904
904
|
children: /* @__PURE__ */ n(Bn, { className: "ll-minimized__icon" })
|
|
905
905
|
}
|
|
@@ -907,7 +907,7 @@ const Vn = ({
|
|
|
907
907
|
] })
|
|
908
908
|
] })
|
|
909
909
|
}
|
|
910
|
-
),
|
|
910
|
+
), Jn = ({
|
|
911
911
|
src: e,
|
|
912
912
|
alt: t,
|
|
913
913
|
preCannedPlaying: r = !1,
|
|
@@ -918,7 +918,7 @@ const Vn = ({
|
|
|
918
918
|
if (T(() => {
|
|
919
919
|
d.current !== e && (d.current = e, s(!1));
|
|
920
920
|
}, [e]), !e) return null;
|
|
921
|
-
const
|
|
921
|
+
const u = {
|
|
922
922
|
position: "absolute",
|
|
923
923
|
inset: 0,
|
|
924
924
|
width: "100%",
|
|
@@ -938,7 +938,7 @@ const Vn = ({
|
|
|
938
938
|
src: e,
|
|
939
939
|
alt: t,
|
|
940
940
|
className: o,
|
|
941
|
-
style:
|
|
941
|
+
style: u,
|
|
942
942
|
loading: "eager",
|
|
943
943
|
fetchPriority: "high",
|
|
944
944
|
onLoad: () => s(!0)
|
|
@@ -954,9 +954,9 @@ const Vn = ({
|
|
|
954
954
|
greeting: l,
|
|
955
955
|
branding: s,
|
|
956
956
|
teamMembers: d,
|
|
957
|
-
currentTeamMemberId:
|
|
958
|
-
isSwitchingTeamMember:
|
|
959
|
-
teamSwitcherOpen:
|
|
957
|
+
currentTeamMemberId: u,
|
|
958
|
+
isSwitchingTeamMember: m,
|
|
959
|
+
teamSwitcherOpen: h,
|
|
960
960
|
onToggleTeamSwitcher: a,
|
|
961
961
|
onSelectTeamMember: c,
|
|
962
962
|
languageMenuOpen: R,
|
|
@@ -974,81 +974,81 @@ const Vn = ({
|
|
|
974
974
|
cameraPreviewEl: A,
|
|
975
975
|
cameraDevices: O,
|
|
976
976
|
activeCameraId: W,
|
|
977
|
-
isScreenShareEnabled:
|
|
977
|
+
isScreenShareEnabled: V,
|
|
978
978
|
screenPreviewEl: te,
|
|
979
979
|
isSpeakerMuted: ue,
|
|
980
|
-
allowCamera:
|
|
981
|
-
allowScreenShare:
|
|
982
|
-
allowTyping:
|
|
983
|
-
avatarVideoContainerRef:
|
|
984
|
-
onConnect:
|
|
985
|
-
onDisconnect:
|
|
986
|
-
onRetry:
|
|
987
|
-
onResumeAudio:
|
|
988
|
-
onToggleMute:
|
|
989
|
-
onToggleCamera:
|
|
990
|
-
onSwitchCameraDevice:
|
|
991
|
-
onToggleScreenShare:
|
|
992
|
-
onToggleSpeaker:
|
|
993
|
-
onSendMessage:
|
|
994
|
-
onMinimize:
|
|
995
|
-
onClose:
|
|
996
|
-
onClearMicError:
|
|
980
|
+
allowCamera: He,
|
|
981
|
+
allowScreenShare: Oe,
|
|
982
|
+
allowTyping: qe,
|
|
983
|
+
avatarVideoContainerRef: Be,
|
|
984
|
+
onConnect: me,
|
|
985
|
+
onDisconnect: ge,
|
|
986
|
+
onRetry: ye,
|
|
987
|
+
onResumeAudio: ve,
|
|
988
|
+
onToggleMute: be,
|
|
989
|
+
onToggleCamera: we,
|
|
990
|
+
onSwitchCameraDevice: _e,
|
|
991
|
+
onToggleScreenShare: xe,
|
|
992
|
+
onToggleSpeaker: j,
|
|
993
|
+
onSendMessage: We,
|
|
994
|
+
onMinimize: Fe,
|
|
995
|
+
onClose: Ue,
|
|
996
|
+
onClearMicError: je
|
|
997
997
|
}) => {
|
|
998
|
-
var
|
|
999
|
-
const ae = b.length > 0 ? b[b.length - 1] : null, ie = ((d == null ? void 0 : d.length) ?? 0) > 1,
|
|
998
|
+
var Se;
|
|
999
|
+
const ae = b.length > 0 ? b[b.length - 1] : null, ie = ((d == null ? void 0 : d.length) ?? 0) > 1, ke = L === "connecting" || L === "connected", Le = L === "connected", fe = L === "idle" || L === "disconnected" || L === "error", J = E(null), Re = E(null);
|
|
1000
1000
|
T(() => {
|
|
1001
|
-
const y =
|
|
1001
|
+
const y = J.current;
|
|
1002
1002
|
y && (y.innerHTML = "", A && (A.style.width = "100%", A.style.height = "100%", A.style.objectFit = "cover", A.style.transform = "scaleX(-1)", y.appendChild(A)));
|
|
1003
1003
|
}, [A]), T(() => {
|
|
1004
|
-
const y =
|
|
1004
|
+
const y = Re.current;
|
|
1005
1005
|
y && (y.innerHTML = "", te && (te.style.width = "100%", te.style.height = "100%", te.style.objectFit = "contain", y.appendChild(te)));
|
|
1006
1006
|
}, [te]);
|
|
1007
1007
|
const [ne, ee] = S(!1), [le, ce] = S(!1);
|
|
1008
1008
|
T(() => {
|
|
1009
|
-
if (!ne && !le && !R && !
|
|
1009
|
+
if (!ne && !le && !R && !h) return;
|
|
1010
1010
|
const y = () => {
|
|
1011
|
-
ee(!1), ce(!1), R && C(),
|
|
1011
|
+
ee(!1), ce(!1), R && C(), h && a();
|
|
1012
1012
|
};
|
|
1013
1013
|
return document.addEventListener("click", y), () => document.removeEventListener("click", y);
|
|
1014
1014
|
}, [
|
|
1015
1015
|
ne,
|
|
1016
1016
|
le,
|
|
1017
1017
|
R,
|
|
1018
|
-
|
|
1018
|
+
h,
|
|
1019
1019
|
C,
|
|
1020
1020
|
a
|
|
1021
1021
|
]);
|
|
1022
|
-
const [
|
|
1022
|
+
const [Q, re] = S(""), pe = k(
|
|
1023
1023
|
(y) => {
|
|
1024
1024
|
y.preventDefault();
|
|
1025
|
-
const
|
|
1026
|
-
|
|
1025
|
+
const K = Q.trim();
|
|
1026
|
+
K && (We(K), re(""));
|
|
1027
1027
|
},
|
|
1028
|
-
[
|
|
1029
|
-
),
|
|
1028
|
+
[Q, We]
|
|
1029
|
+
), Ie = s.productName || "Live Layer", Ve = Le && (ae != null && ae.text) ? ae.text : l || "", Me = [
|
|
1030
1030
|
"ll-expanded",
|
|
1031
1031
|
t ? "ll-expanded--mobile" : "ll-expanded--desktop"
|
|
1032
1032
|
].join(" ");
|
|
1033
1033
|
return /* @__PURE__ */ w(
|
|
1034
1034
|
"div",
|
|
1035
1035
|
{
|
|
1036
|
-
className:
|
|
1036
|
+
className: Me,
|
|
1037
1037
|
"data-position": e,
|
|
1038
|
-
"data-state":
|
|
1038
|
+
"data-state": Le ? "connected" : ke ? "connecting" : "idle",
|
|
1039
1039
|
role: "dialog",
|
|
1040
1040
|
"aria-label": `${r} widget`,
|
|
1041
1041
|
children: [
|
|
1042
1042
|
/* @__PURE__ */ w("div", { className: "ll-expanded__bg", children: [
|
|
1043
1043
|
o ? /* @__PURE__ */ n(
|
|
1044
|
-
|
|
1044
|
+
Jn,
|
|
1045
1045
|
{
|
|
1046
1046
|
src: o,
|
|
1047
1047
|
alt: r,
|
|
1048
1048
|
className: "ll-expanded__bg-img"
|
|
1049
1049
|
}
|
|
1050
|
-
) : /* @__PURE__ */ n("div", { className: "ll-expanded__bg-fallback", children: /* @__PURE__ */ n("span", { className: "ll-expanded__bg-initial", children: ((
|
|
1051
|
-
i && !
|
|
1050
|
+
) : /* @__PURE__ */ n("div", { className: "ll-expanded__bg-fallback", children: /* @__PURE__ */ n("span", { className: "ll-expanded__bg-initial", children: ((Se = r == null ? void 0 : r.charAt(0)) == null ? void 0 : Se.toUpperCase()) || "A" }) }),
|
|
1051
|
+
i && !Le && /* @__PURE__ */ n(
|
|
1052
1052
|
"video",
|
|
1053
1053
|
{
|
|
1054
1054
|
className: "ll-expanded__bg-idle",
|
|
@@ -1060,24 +1060,24 @@ const Vn = ({
|
|
|
1060
1060
|
}
|
|
1061
1061
|
)
|
|
1062
1062
|
] }),
|
|
1063
|
-
/* @__PURE__ */ n("div", { ref:
|
|
1063
|
+
/* @__PURE__ */ n("div", { ref: Be, className: "ll-expanded__video" }),
|
|
1064
1064
|
L === "connecting" && /* @__PURE__ */ w("div", { className: "ll-expanded__overlay ll-expanded__overlay--connecting", children: [
|
|
1065
1065
|
/* @__PURE__ */ n("div", { className: "ll-expanded__spinner" }),
|
|
1066
|
-
/* @__PURE__ */ n("p", { className: "ll-expanded__overlay-text", children:
|
|
1066
|
+
/* @__PURE__ */ n("p", { className: "ll-expanded__overlay-text", children: m ? "Switching..." : "Connecting..." })
|
|
1067
1067
|
] }),
|
|
1068
|
-
I &&
|
|
1068
|
+
I && Le && /* @__PURE__ */ w(
|
|
1069
1069
|
"button",
|
|
1070
1070
|
{
|
|
1071
1071
|
type: "button",
|
|
1072
1072
|
className: "ll-expanded__overlay ll-expanded__overlay--gesture",
|
|
1073
|
-
onClick:
|
|
1073
|
+
onClick: ve,
|
|
1074
1074
|
children: [
|
|
1075
1075
|
/* @__PURE__ */ n("svg", { width: "32", height: "32", viewBox: "0 0 24 24", fill: "currentColor", "aria-hidden": !0, children: /* @__PURE__ */ n("path", { d: "M3 9v6h4l5 5V4L7 9H3zm13.54.12a5 5 0 0 1 0 5.76l-1.41-1.41a3 3 0 0 0 0-2.94L16.54 9.12z" }) }),
|
|
1076
1076
|
/* @__PURE__ */ n("p", { className: "ll-expanded__overlay-text", children: "Tap to enable audio" })
|
|
1077
1077
|
]
|
|
1078
1078
|
}
|
|
1079
1079
|
),
|
|
1080
|
-
|
|
1080
|
+
ke ? /* @__PURE__ */ w("div", { className: "ll-expanded__topbar", children: [
|
|
1081
1081
|
/* @__PURE__ */ w("div", { className: "ll-expanded__topbar-left", children: [
|
|
1082
1082
|
/* @__PURE__ */ w("div", { className: "ll-expanded__pill-wrap", children: [
|
|
1083
1083
|
/* @__PURE__ */ w(
|
|
@@ -1089,14 +1089,14 @@ const Vn = ({
|
|
|
1089
1089
|
ie && (y.stopPropagation(), a());
|
|
1090
1090
|
},
|
|
1091
1091
|
"aria-haspopup": ie ? "listbox" : void 0,
|
|
1092
|
-
"aria-expanded": ie ?
|
|
1092
|
+
"aria-expanded": ie ? h : void 0,
|
|
1093
1093
|
children: [
|
|
1094
1094
|
/* @__PURE__ */ n("span", { className: "ll-hpill__label", children: r }),
|
|
1095
1095
|
ie && /* @__PURE__ */ n(Xe, {})
|
|
1096
1096
|
]
|
|
1097
1097
|
}
|
|
1098
1098
|
),
|
|
1099
|
-
ie &&
|
|
1099
|
+
ie && h && /* @__PURE__ */ n(
|
|
1100
1100
|
"div",
|
|
1101
1101
|
{
|
|
1102
1102
|
className: "ll-hmenu",
|
|
@@ -1106,10 +1106,10 @@ const Vn = ({
|
|
|
1106
1106
|
"button",
|
|
1107
1107
|
{
|
|
1108
1108
|
type: "button",
|
|
1109
|
-
className: `ll-hmenu__item ${y.id ===
|
|
1109
|
+
className: `ll-hmenu__item ${y.id === u ? "is-active" : ""}`,
|
|
1110
1110
|
onClick: () => c(y.id),
|
|
1111
1111
|
role: "option",
|
|
1112
|
-
"aria-selected": y.id ===
|
|
1112
|
+
"aria-selected": y.id === u,
|
|
1113
1113
|
children: [
|
|
1114
1114
|
y.avatarImageUrl && /* @__PURE__ */ n(
|
|
1115
1115
|
"img",
|
|
@@ -1180,7 +1180,7 @@ const Vn = ({
|
|
|
1180
1180
|
{
|
|
1181
1181
|
type: "button",
|
|
1182
1182
|
className: "ll-hbtn",
|
|
1183
|
-
onClick:
|
|
1183
|
+
onClick: Fe,
|
|
1184
1184
|
"aria-label": "Minimize widget",
|
|
1185
1185
|
title: "Minimize",
|
|
1186
1186
|
children: /* @__PURE__ */ n(Ht, {})
|
|
@@ -1191,7 +1191,7 @@ const Vn = ({
|
|
|
1191
1191
|
{
|
|
1192
1192
|
type: "button",
|
|
1193
1193
|
className: "ll-hbtn ll-hbtn--danger",
|
|
1194
|
-
onClick:
|
|
1194
|
+
onClick: Ue,
|
|
1195
1195
|
"aria-label": "End call",
|
|
1196
1196
|
title: "End call",
|
|
1197
1197
|
children: /* @__PURE__ */ n(zt, {})
|
|
@@ -1201,14 +1201,14 @@ const Vn = ({
|
|
|
1201
1201
|
] }) : (
|
|
1202
1202
|
// Idle-state header with Live Layer product name + minimize/close
|
|
1203
1203
|
/* @__PURE__ */ w("div", { className: "ll-expanded__header ll-expanded__header--idle", children: [
|
|
1204
|
-
/* @__PURE__ */ n("span", { className: "ll-expanded__brand", children:
|
|
1204
|
+
/* @__PURE__ */ n("span", { className: "ll-expanded__brand", children: Ie }),
|
|
1205
1205
|
/* @__PURE__ */ w("div", { className: "ll-expanded__header-actions", children: [
|
|
1206
1206
|
/* @__PURE__ */ n(
|
|
1207
1207
|
"button",
|
|
1208
1208
|
{
|
|
1209
1209
|
type: "button",
|
|
1210
1210
|
className: "ll-hbtn ll-hbtn--ghost",
|
|
1211
|
-
onClick:
|
|
1211
|
+
onClick: Fe,
|
|
1212
1212
|
"aria-label": "Minimize widget",
|
|
1213
1213
|
children: /* @__PURE__ */ n(Ht, {})
|
|
1214
1214
|
}
|
|
@@ -1218,7 +1218,7 @@ const Vn = ({
|
|
|
1218
1218
|
{
|
|
1219
1219
|
type: "button",
|
|
1220
1220
|
className: "ll-hbtn ll-hbtn--danger",
|
|
1221
|
-
onClick:
|
|
1221
|
+
onClick: Ue,
|
|
1222
1222
|
"aria-label": "Close widget",
|
|
1223
1223
|
children: /* @__PURE__ */ n(zt, {})
|
|
1224
1224
|
}
|
|
@@ -1226,15 +1226,15 @@ const Vn = ({
|
|
|
1226
1226
|
] })
|
|
1227
1227
|
] })
|
|
1228
1228
|
),
|
|
1229
|
-
|
|
1230
|
-
const y = z ? "Restart paused session" : L === "disconnected" ? "Reconnect to agent" : "Start video call",
|
|
1229
|
+
fe && /* @__PURE__ */ (() => {
|
|
1230
|
+
const y = z ? "Restart paused session" : L === "disconnected" ? "Reconnect to agent" : "Start video call", K = z ? "Pick up where you left off" : null;
|
|
1231
1231
|
return /* @__PURE__ */ w(ut, { children: [
|
|
1232
1232
|
L === "idle" && !z && !H && /* @__PURE__ */ w(
|
|
1233
1233
|
"button",
|
|
1234
1234
|
{
|
|
1235
1235
|
type: "button",
|
|
1236
1236
|
className: "ll-expanded__play",
|
|
1237
|
-
onClick:
|
|
1237
|
+
onClick: me,
|
|
1238
1238
|
"aria-label": y,
|
|
1239
1239
|
children: [
|
|
1240
1240
|
/* @__PURE__ */ n("div", { className: "ll-expanded__play-circle", children: /* @__PURE__ */ n("svg", { width: "22", height: "22", viewBox: "0 0 24 24", fill: "currentColor", "aria-hidden": !0, children: /* @__PURE__ */ n("polygon", { points: "6 3 20 12 6 21 6 3" }) }) }),
|
|
@@ -1244,13 +1244,13 @@ const Vn = ({
|
|
|
1244
1244
|
),
|
|
1245
1245
|
/* @__PURE__ */ w("div", { className: "ll-expanded__bottom ll-expanded__bottom--idle", children: [
|
|
1246
1246
|
l && /* @__PURE__ */ n("div", { className: "ll-expanded__transcript", children: /* @__PURE__ */ n("p", { className: "ll-expanded__transcript-text", children: l }) }),
|
|
1247
|
-
|
|
1247
|
+
K && /* @__PURE__ */ n("p", { className: "ll-expanded__cta-sublabel", children: K }),
|
|
1248
1248
|
/* @__PURE__ */ n(
|
|
1249
1249
|
"button",
|
|
1250
1250
|
{
|
|
1251
1251
|
type: "button",
|
|
1252
1252
|
className: "ll-expanded__cta",
|
|
1253
|
-
onClick:
|
|
1253
|
+
onClick: me,
|
|
1254
1254
|
"aria-label": y,
|
|
1255
1255
|
children: y
|
|
1256
1256
|
}
|
|
@@ -1261,46 +1261,46 @@ const Vn = ({
|
|
|
1261
1261
|
/* @__PURE__ */ w(
|
|
1262
1262
|
"div",
|
|
1263
1263
|
{
|
|
1264
|
-
className: `ll-expanded__pip ${
|
|
1264
|
+
className: `ll-expanded__pip ${ke && (D || V) ? "is-visible" : ""}`,
|
|
1265
1265
|
children: [
|
|
1266
1266
|
/* @__PURE__ */ n(
|
|
1267
1267
|
"div",
|
|
1268
1268
|
{
|
|
1269
|
-
ref:
|
|
1270
|
-
className:
|
|
1269
|
+
ref: Re,
|
|
1270
|
+
className: V ? "ll-expanded__pip-host" : "ll-expanded__pip-host is-hidden"
|
|
1271
1271
|
}
|
|
1272
1272
|
),
|
|
1273
1273
|
/* @__PURE__ */ n(
|
|
1274
1274
|
"div",
|
|
1275
1275
|
{
|
|
1276
|
-
ref:
|
|
1277
|
-
className: !
|
|
1276
|
+
ref: J,
|
|
1277
|
+
className: !V && D ? "ll-expanded__pip-host" : "ll-expanded__pip-host is-hidden"
|
|
1278
1278
|
}
|
|
1279
1279
|
)
|
|
1280
1280
|
]
|
|
1281
1281
|
}
|
|
1282
1282
|
),
|
|
1283
|
-
|
|
1284
|
-
|
|
1283
|
+
ke ? /* @__PURE__ */ w("div", { className: "ll-expanded__bottom", children: [
|
|
1284
|
+
Ve && /* @__PURE__ */ n("div", { className: "ll-expanded__transcript", children: /* @__PURE__ */ n("p", { className: "ll-expanded__transcript-text", children: Ve }) }),
|
|
1285
1285
|
/* @__PURE__ */ w("div", { className: "ll-toolbar", onClick: (y) => y.stopPropagation(), children: [
|
|
1286
|
-
|
|
1286
|
+
Oe && /* @__PURE__ */ n(
|
|
1287
1287
|
"button",
|
|
1288
1288
|
{
|
|
1289
1289
|
type: "button",
|
|
1290
|
-
className: `ll-tool ${
|
|
1291
|
-
onClick:
|
|
1292
|
-
"aria-label":
|
|
1293
|
-
title:
|
|
1290
|
+
className: `ll-tool ${V ? "is-on" : ""}`,
|
|
1291
|
+
onClick: xe,
|
|
1292
|
+
"aria-label": V ? "Stop sharing screen" : "Share screen",
|
|
1293
|
+
title: V ? "Stop sharing" : "Share screen",
|
|
1294
1294
|
children: /* @__PURE__ */ n(Xn, {})
|
|
1295
1295
|
}
|
|
1296
1296
|
),
|
|
1297
|
-
|
|
1297
|
+
He && /* @__PURE__ */ w("div", { className: "ll-tool-split", children: [
|
|
1298
1298
|
/* @__PURE__ */ n(
|
|
1299
1299
|
"button",
|
|
1300
1300
|
{
|
|
1301
1301
|
type: "button",
|
|
1302
1302
|
className: `ll-tool ll-tool--left ${D ? "is-on" : ""}`,
|
|
1303
|
-
onClick:
|
|
1303
|
+
onClick: we,
|
|
1304
1304
|
"aria-label": D ? "Turn off camera" : "Turn on camera",
|
|
1305
1305
|
title: D ? "Stop camera" : "Start camera",
|
|
1306
1306
|
children: /* @__PURE__ */ n(Qn, {})
|
|
@@ -1312,7 +1312,7 @@ const Vn = ({
|
|
|
1312
1312
|
type: "button",
|
|
1313
1313
|
className: `ll-tool ll-tool--right ${D ? "is-on" : ""}`,
|
|
1314
1314
|
onClick: (y) => {
|
|
1315
|
-
y.stopPropagation(), ce((
|
|
1315
|
+
y.stopPropagation(), ce((K) => !K), ee(!1);
|
|
1316
1316
|
},
|
|
1317
1317
|
"aria-label": "Camera devices",
|
|
1318
1318
|
"aria-haspopup": "listbox",
|
|
@@ -1327,7 +1327,7 @@ const Vn = ({
|
|
|
1327
1327
|
devices: O,
|
|
1328
1328
|
activeId: W,
|
|
1329
1329
|
onPick: (y) => {
|
|
1330
|
-
ce(!1),
|
|
1330
|
+
ce(!1), _e(y);
|
|
1331
1331
|
}
|
|
1332
1332
|
}
|
|
1333
1333
|
)
|
|
@@ -1338,7 +1338,7 @@ const Vn = ({
|
|
|
1338
1338
|
{
|
|
1339
1339
|
type: "button",
|
|
1340
1340
|
className: `ll-tool ll-tool--left ${p ? "is-muted" : ""}`,
|
|
1341
|
-
onClick:
|
|
1341
|
+
onClick: be,
|
|
1342
1342
|
"aria-label": p ? "Unmute microphone" : "Mute microphone",
|
|
1343
1343
|
title: p ? "Unmute" : "Mute",
|
|
1344
1344
|
children: /* @__PURE__ */ n(Zn, { muted: p })
|
|
@@ -1350,7 +1350,7 @@ const Vn = ({
|
|
|
1350
1350
|
type: "button",
|
|
1351
1351
|
className: `ll-tool ll-tool--right ${p ? "is-muted" : ""}`,
|
|
1352
1352
|
onClick: (y) => {
|
|
1353
|
-
y.stopPropagation(), ee((
|
|
1353
|
+
y.stopPropagation(), ee((K) => !K), ce(!1);
|
|
1354
1354
|
},
|
|
1355
1355
|
"aria-label": "Microphone devices",
|
|
1356
1356
|
"aria-haspopup": "listbox",
|
|
@@ -1373,26 +1373,26 @@ const Vn = ({
|
|
|
1373
1373
|
{
|
|
1374
1374
|
type: "button",
|
|
1375
1375
|
className: `ll-tool ${ue ? "is-muted" : ""}`,
|
|
1376
|
-
onClick:
|
|
1376
|
+
onClick: j,
|
|
1377
1377
|
"aria-label": ue ? "Unmute speaker" : "Mute speaker",
|
|
1378
1378
|
title: ue ? "Unmute speaker" : "Mute speaker",
|
|
1379
1379
|
children: /* @__PURE__ */ n(er, { muted: ue })
|
|
1380
1380
|
}
|
|
1381
1381
|
)
|
|
1382
1382
|
] }),
|
|
1383
|
-
|
|
1383
|
+
qe && /* @__PURE__ */ w("form", { className: "ll-message-input", onSubmit: pe, children: [
|
|
1384
1384
|
/* @__PURE__ */ n(
|
|
1385
1385
|
"input",
|
|
1386
1386
|
{
|
|
1387
1387
|
type: "text",
|
|
1388
1388
|
className: "ll-message-input__field",
|
|
1389
1389
|
placeholder: "Message...",
|
|
1390
|
-
value:
|
|
1390
|
+
value: Q,
|
|
1391
1391
|
onChange: (y) => re(y.target.value),
|
|
1392
1392
|
"aria-label": "Message the agent"
|
|
1393
1393
|
}
|
|
1394
1394
|
),
|
|
1395
|
-
|
|
1395
|
+
Q.trim() && /* @__PURE__ */ n(
|
|
1396
1396
|
"button",
|
|
1397
1397
|
{
|
|
1398
1398
|
type: "submit",
|
|
@@ -1407,7 +1407,7 @@ const Vn = ({
|
|
|
1407
1407
|
{
|
|
1408
1408
|
type: "button",
|
|
1409
1409
|
className: "ll-expanded__end",
|
|
1410
|
-
onClick:
|
|
1410
|
+
onClick: ge,
|
|
1411
1411
|
children: "End conversation"
|
|
1412
1412
|
}
|
|
1413
1413
|
)
|
|
@@ -1421,14 +1421,14 @@ const Vn = ({
|
|
|
1421
1421
|
{
|
|
1422
1422
|
type: "button",
|
|
1423
1423
|
className: "ll-expanded__banner-x",
|
|
1424
|
-
onClick:
|
|
1424
|
+
onClick: je,
|
|
1425
1425
|
"aria-label": "Dismiss",
|
|
1426
1426
|
children: "×"
|
|
1427
1427
|
}
|
|
1428
1428
|
)
|
|
1429
1429
|
] });
|
|
1430
1430
|
if (!H || L !== "error") return null;
|
|
1431
|
-
let y = "Failed to connect",
|
|
1431
|
+
let y = "Failed to connect", K = "Try again";
|
|
1432
1432
|
return H === "MIC_PERMISSION_DENIED" ? y = "Microphone blocked. Allow access to talk." : H === "MIC_NOT_FOUND" ? y = "No microphone found. Plug one in + retry." : H === "MIC_UNAVAILABLE" ? y = "Mic unavailable. Check other apps using it." : H === "AGENT_TIMEOUT" ? y = "Agent didn't pick up. Try again." : H === "CONNECT_FAILED" ? y = "Connection failed. Check your network." : H.length < 80 && (y = H), /* @__PURE__ */ w("div", { className: "ll-expanded__banner ll-expanded__banner--error", role: "alert", children: [
|
|
1433
1433
|
/* @__PURE__ */ n("span", { children: y }),
|
|
1434
1434
|
/* @__PURE__ */ n(
|
|
@@ -1436,8 +1436,8 @@ const Vn = ({
|
|
|
1436
1436
|
{
|
|
1437
1437
|
type: "button",
|
|
1438
1438
|
className: "ll-expanded__banner-retry",
|
|
1439
|
-
onClick:
|
|
1440
|
-
children:
|
|
1439
|
+
onClick: ye,
|
|
1440
|
+
children: K
|
|
1441
1441
|
}
|
|
1442
1442
|
)
|
|
1443
1443
|
] });
|
|
@@ -1552,7 +1552,7 @@ const Qe = 4096, rr = 20, or = 20, ir = 10, lr = 10, ar = 30, qt = 500, cr = [
|
|
|
1552
1552
|
"noscript",
|
|
1553
1553
|
"iframe"
|
|
1554
1554
|
];
|
|
1555
|
-
function
|
|
1555
|
+
function $e(e) {
|
|
1556
1556
|
if (e.getAttribute("aria-hidden") === "true" || e.hasAttribute("hidden")) return !0;
|
|
1557
1557
|
let t = e;
|
|
1558
1558
|
for (; t; ) {
|
|
@@ -1562,7 +1562,7 @@ function He(e) {
|
|
|
1562
1562
|
}
|
|
1563
1563
|
return !1;
|
|
1564
1564
|
}
|
|
1565
|
-
function
|
|
1565
|
+
function ze(e) {
|
|
1566
1566
|
if (typeof window > "u") return !0;
|
|
1567
1567
|
const t = e.getBoundingClientRect();
|
|
1568
1568
|
if (t.width <= 0 || t.height <= 0) return !1;
|
|
@@ -1582,10 +1582,10 @@ function Bt(e) {
|
|
|
1582
1582
|
const i = e.closest("label");
|
|
1583
1583
|
return i != null && i.textContent ? i.textContent.trim() : "";
|
|
1584
1584
|
}
|
|
1585
|
-
function
|
|
1585
|
+
function he(e, t) {
|
|
1586
1586
|
return e.length <= t ? e : e.slice(0, t - 1) + "…";
|
|
1587
1587
|
}
|
|
1588
|
-
function
|
|
1588
|
+
function Ee(e) {
|
|
1589
1589
|
return e.length;
|
|
1590
1590
|
}
|
|
1591
1591
|
function sr(e, t = {}) {
|
|
@@ -1607,34 +1607,34 @@ function sr(e, t = {}) {
|
|
|
1607
1607
|
), d = [];
|
|
1608
1608
|
for (const p of s) {
|
|
1609
1609
|
if (d.length >= ir) break;
|
|
1610
|
-
if (
|
|
1611
|
-
const N = p.getAttribute("data-ll-region") ?? "", B = p.getAttribute("data-ll-intent") ?? void 0, D =
|
|
1610
|
+
if ($e(p) || !ze(p)) continue;
|
|
1611
|
+
const N = p.getAttribute("data-ll-region") ?? "", B = p.getAttribute("data-ll-intent") ?? void 0, D = he(
|
|
1612
1612
|
(p.innerText || p.textContent || "").trim(),
|
|
1613
1613
|
qt * 2
|
|
1614
1614
|
);
|
|
1615
1615
|
!N || !D || d.push({ id: N, intent: B, text: D });
|
|
1616
1616
|
}
|
|
1617
|
-
const
|
|
1617
|
+
const u = [], m = ["H1", "H2", "H3", "H4", "H5", "H6"], h = Array.from(
|
|
1618
1618
|
r.querySelectorAll("h1, h2, h3, h4, h5, h6")
|
|
1619
1619
|
);
|
|
1620
|
-
for (const p of
|
|
1621
|
-
if (
|
|
1620
|
+
for (const p of h) {
|
|
1621
|
+
if ($e(p) || !ze(p)) continue;
|
|
1622
1622
|
const N = (p.textContent || "").trim();
|
|
1623
|
-
N &&
|
|
1623
|
+
N && u.push(`${p.tagName}: ${he(N, 200)}`);
|
|
1624
1624
|
}
|
|
1625
1625
|
const a = Array.from(r.querySelectorAll("p, li"));
|
|
1626
1626
|
for (const p of a) {
|
|
1627
|
-
if (
|
|
1627
|
+
if ($e(p) || !ze(p) || m.includes(p.tagName)) continue;
|
|
1628
1628
|
const N = (p.textContent || "").trim();
|
|
1629
|
-
N.length > 10 &&
|
|
1629
|
+
N.length > 10 && u.push(he(N, qt));
|
|
1630
1630
|
}
|
|
1631
|
-
const c =
|
|
1631
|
+
const c = u.join(`
|
|
1632
1632
|
`), R = [], C = Array.from(r.querySelectorAll("a[href]"));
|
|
1633
1633
|
for (const p of C) {
|
|
1634
1634
|
if (R.length >= rr) break;
|
|
1635
|
-
if (
|
|
1635
|
+
if ($e(p) || !ze(p)) continue;
|
|
1636
1636
|
const N = p.getAttribute("href") || "", B = (p.textContent || "").trim();
|
|
1637
|
-
!N || !B || R.push({ href: N, text:
|
|
1637
|
+
!N || !B || R.push({ href: N, text: he(B, 100) });
|
|
1638
1638
|
}
|
|
1639
1639
|
const L = [], v = Array.from(
|
|
1640
1640
|
r.querySelectorAll(
|
|
@@ -1643,9 +1643,9 @@ function sr(e, t = {}) {
|
|
|
1643
1643
|
);
|
|
1644
1644
|
for (const p of v) {
|
|
1645
1645
|
if (L.length >= or) break;
|
|
1646
|
-
if (
|
|
1646
|
+
if ($e(p) || !tt(p) || !ze(p)) continue;
|
|
1647
1647
|
const N = Bt(p), B = p instanceof HTMLInputElement ? p.type : p.tagName.toLowerCase();
|
|
1648
|
-
N && L.push({ label:
|
|
1648
|
+
N && L.push({ label: he(N, 100), type: B });
|
|
1649
1649
|
}
|
|
1650
1650
|
const b = Array.from(
|
|
1651
1651
|
r.querySelectorAll("[data-ll-form]")
|
|
@@ -1665,8 +1665,8 @@ function sr(e, t = {}) {
|
|
|
1665
1665
|
if (!tt(O)) continue;
|
|
1666
1666
|
const W = O.getAttribute("data-ll-field") || "";
|
|
1667
1667
|
if (!W) continue;
|
|
1668
|
-
const
|
|
1669
|
-
A.push({ name: W, label:
|
|
1668
|
+
const V = Bt(O) || W, te = O instanceof HTMLInputElement ? O.type : O.tagName.toLowerCase();
|
|
1669
|
+
A.push({ name: W, label: he(V, 100), type: te });
|
|
1670
1670
|
}
|
|
1671
1671
|
z.push({ id: N, intent: B, fields: A });
|
|
1672
1672
|
}
|
|
@@ -1681,23 +1681,23 @@ function sr(e, t = {}) {
|
|
|
1681
1681
|
forms: z,
|
|
1682
1682
|
extras: e
|
|
1683
1683
|
};
|
|
1684
|
-
let H =
|
|
1684
|
+
let H = Ee(JSON.stringify(I.regions)) + Ee(I.visibleText) + Ee(JSON.stringify(I.visibleLinks)) + Ee(JSON.stringify(I.visibleFields));
|
|
1685
1685
|
for (; H > Qe && I.visibleFields.length > 0; )
|
|
1686
|
-
I.visibleFields.pop(), H =
|
|
1686
|
+
I.visibleFields.pop(), H = Ee(JSON.stringify(I.visibleFields));
|
|
1687
1687
|
for (; H > Qe && I.visibleLinks.length > 0; )
|
|
1688
1688
|
I.visibleLinks.pop(), H -= 80;
|
|
1689
|
-
return
|
|
1689
|
+
return Ee(I.visibleText) > Qe && (I.visibleText = he(I.visibleText, Qe - 100)), I;
|
|
1690
1690
|
}
|
|
1691
|
-
let
|
|
1691
|
+
let Ne = null;
|
|
1692
1692
|
function Wt(e, t = {}) {
|
|
1693
1693
|
const r = Date.now(), i = `${typeof window < "u" && window.location.pathname || "/"}::${typeof window < "u" ? window.scrollY : 0}`;
|
|
1694
|
-
if (
|
|
1695
|
-
return
|
|
1694
|
+
if (Ne && Ne.key === i && r - Ne.at < 1e3)
|
|
1695
|
+
return Ne.ctx;
|
|
1696
1696
|
const l = sr(e, t);
|
|
1697
|
-
return
|
|
1697
|
+
return Ne = { key: i, at: r, ctx: l }, l;
|
|
1698
1698
|
}
|
|
1699
1699
|
function dr() {
|
|
1700
|
-
|
|
1700
|
+
Ne = null;
|
|
1701
1701
|
}
|
|
1702
1702
|
const ur = 200;
|
|
1703
1703
|
function fr(e) {
|
|
@@ -1722,33 +1722,33 @@ function hr(e) {
|
|
|
1722
1722
|
if (pt(s)) continue;
|
|
1723
1723
|
const d = s.getAttribute("href") || "";
|
|
1724
1724
|
if (!pr(d)) continue;
|
|
1725
|
-
let
|
|
1725
|
+
let u = d, m = !0;
|
|
1726
1726
|
try {
|
|
1727
1727
|
if (typeof window < "u") {
|
|
1728
1728
|
const a = new URL(d, r);
|
|
1729
|
-
|
|
1729
|
+
m = a.origin === r, m && d.startsWith("http") && (u = a.pathname + a.search + a.hash);
|
|
1730
1730
|
}
|
|
1731
1731
|
} catch {
|
|
1732
1732
|
continue;
|
|
1733
1733
|
}
|
|
1734
|
-
if (o.has(
|
|
1735
|
-
o.add(
|
|
1736
|
-
const
|
|
1737
|
-
i.push({ href:
|
|
1734
|
+
if (o.has(u)) continue;
|
|
1735
|
+
o.add(u);
|
|
1736
|
+
const h = (s.textContent || "").trim().slice(0, 120);
|
|
1737
|
+
i.push({ href: u, text: h, internal: m });
|
|
1738
1738
|
}
|
|
1739
1739
|
return i;
|
|
1740
1740
|
}
|
|
1741
|
-
let
|
|
1741
|
+
let Ae = null;
|
|
1742
1742
|
const mr = 5e3;
|
|
1743
1743
|
function st() {
|
|
1744
1744
|
const e = Date.now(), t = typeof window < "u" && window.location.pathname || "/";
|
|
1745
|
-
if (
|
|
1746
|
-
return
|
|
1745
|
+
if (Ae && Ae.pathname === t && e - Ae.at < mr)
|
|
1746
|
+
return Ae.routes;
|
|
1747
1747
|
const r = hr();
|
|
1748
|
-
return
|
|
1748
|
+
return Ae = { at: e, pathname: t, routes: r }, r;
|
|
1749
1749
|
}
|
|
1750
1750
|
function gr() {
|
|
1751
|
-
|
|
1751
|
+
Ae = null;
|
|
1752
1752
|
}
|
|
1753
1753
|
function yr(e, t) {
|
|
1754
1754
|
const r = e instanceof HTMLInputElement ? HTMLInputElement.prototype : e instanceof HTMLTextAreaElement ? HTMLTextAreaElement.prototype : HTMLSelectElement.prototype, o = Object.getOwnPropertyDescriptor(r, "value"), i = o == null ? void 0 : o.set;
|
|
@@ -1844,9 +1844,9 @@ function Sr(e) {
|
|
|
1844
1844
|
sessionBody: l,
|
|
1845
1845
|
autoConnect: s = !1,
|
|
1846
1846
|
displayMode: d,
|
|
1847
|
-
defaultDisplayMode:
|
|
1848
|
-
onDisplayModeChange:
|
|
1849
|
-
position:
|
|
1847
|
+
defaultDisplayMode: u = "expanded",
|
|
1848
|
+
onDisplayModeChange: m,
|
|
1849
|
+
position: h = "bottom-right",
|
|
1850
1850
|
mobileBreakpoint: a = 640,
|
|
1851
1851
|
persistKey: c = "ll-widget",
|
|
1852
1852
|
disablePersistence: R = !1,
|
|
@@ -1864,63 +1864,63 @@ function Sr(e) {
|
|
|
1864
1864
|
showOn: A,
|
|
1865
1865
|
hideOn: O,
|
|
1866
1866
|
pathname: W,
|
|
1867
|
-
onNavigate:
|
|
1867
|
+
onNavigate: V,
|
|
1868
1868
|
onScrollToSelector: te,
|
|
1869
1869
|
getPageContext: ue,
|
|
1870
|
-
pageContextExtras:
|
|
1871
|
-
getRoutes:
|
|
1872
|
-
onScrollPage:
|
|
1873
|
-
onClick:
|
|
1874
|
-
capabilities:
|
|
1875
|
-
onConnect:
|
|
1876
|
-
onDisconnect:
|
|
1877
|
-
onTranscript:
|
|
1878
|
-
onAgentState:
|
|
1879
|
-
onConnectionStateChange:
|
|
1880
|
-
onAgentEvent:
|
|
1881
|
-
onAgentCommand:
|
|
1882
|
-
controlledSession:
|
|
1883
|
-
className:
|
|
1884
|
-
style:
|
|
1885
|
-
zIndex:
|
|
1886
|
-
} = e,
|
|
1870
|
+
pageContextExtras: He,
|
|
1871
|
+
getRoutes: Oe,
|
|
1872
|
+
onScrollPage: qe,
|
|
1873
|
+
onClick: Be,
|
|
1874
|
+
capabilities: me,
|
|
1875
|
+
onConnect: ge,
|
|
1876
|
+
onDisconnect: ye,
|
|
1877
|
+
onTranscript: ve,
|
|
1878
|
+
onAgentState: be,
|
|
1879
|
+
onConnectionStateChange: we,
|
|
1880
|
+
onAgentEvent: _e,
|
|
1881
|
+
onAgentCommand: xe,
|
|
1882
|
+
controlledSession: j,
|
|
1883
|
+
className: We,
|
|
1884
|
+
style: Fe,
|
|
1885
|
+
zIndex: Ue = 2147483647
|
|
1886
|
+
} = e, je = Tn(W), ae = qn(je, A, O);
|
|
1887
1887
|
T(() => {
|
|
1888
1888
|
dr(), gr();
|
|
1889
|
-
}, [
|
|
1890
|
-
const ie = L !== void 0, [
|
|
1891
|
-
var
|
|
1892
|
-
return L ?? ((
|
|
1893
|
-
}),
|
|
1894
|
-
() => (C == null ? void 0 : C.find((
|
|
1895
|
-
[C,
|
|
1896
|
-
),
|
|
1889
|
+
}, [je]);
|
|
1890
|
+
const ie = L !== void 0, [ke, Le] = S(() => {
|
|
1891
|
+
var g;
|
|
1892
|
+
return L ?? ((g = C == null ? void 0 : C[0]) == null ? void 0 : g.id);
|
|
1893
|
+
}), fe = ie ? L : ke, J = Ze(
|
|
1894
|
+
() => (C == null ? void 0 : C.find((g) => g.id === fe)) ?? null,
|
|
1895
|
+
[C, fe]
|
|
1896
|
+
), Re = (J == null ? void 0 : J.agentId) ?? t, [ne, ee] = An({
|
|
1897
1897
|
value: d,
|
|
1898
|
-
defaultValue:
|
|
1899
|
-
onChange:
|
|
1898
|
+
defaultValue: u,
|
|
1899
|
+
onChange: m,
|
|
1900
1900
|
persistKey: c,
|
|
1901
1901
|
disablePersistence: R
|
|
1902
|
-
}), le = In(a), ce = yn(),
|
|
1903
|
-
rt.current =
|
|
1904
|
-
function se(
|
|
1905
|
-
const
|
|
1906
|
-
return
|
|
1902
|
+
}), le = In(a), ce = yn(), Q = vn(), re = wn(), pe = _n(), Ie = xn(), [Ve, Me] = S(!1), [Se, y] = S(!1), [K, Ye] = S(!1), [Yt, Gt] = S(!1), [nt, Jt] = S(!1), rt = E(V), ot = E(te), it = E(qe), lt = E(Be), ht = E(ue), mt = E(He), gt = E(Oe), at = E(me), oe = E(null);
|
|
1903
|
+
rt.current = V, ot.current = te, it.current = qe, lt.current = Be, ht.current = ue, mt.current = He, gt.current = Oe, at.current = me;
|
|
1904
|
+
function se(g) {
|
|
1905
|
+
const f = at.current;
|
|
1906
|
+
return f ? f.includes(g) : !0;
|
|
1907
1907
|
}
|
|
1908
|
-
function de(
|
|
1908
|
+
function de(g, f) {
|
|
1909
1909
|
console.warn(
|
|
1910
|
-
`[LiveLayer] Agent command "${
|
|
1910
|
+
`[LiveLayer] Agent command "${g}" blocked — capability "${f}" not in allowlist. See https://livelayer.studio/docs/react/capabilities`
|
|
1911
1911
|
);
|
|
1912
1912
|
}
|
|
1913
|
-
const
|
|
1914
|
-
(
|
|
1915
|
-
var
|
|
1916
|
-
const
|
|
1917
|
-
if (!(!
|
|
1918
|
-
if (
|
|
1913
|
+
const Te = k(
|
|
1914
|
+
(g) => {
|
|
1915
|
+
var Z, Je, Ke, Et;
|
|
1916
|
+
const f = g;
|
|
1917
|
+
if (!(!f.type || typeof f.type != "string")) {
|
|
1918
|
+
if (_e == null || _e({ eventName: f.type, data: g }), f.type === "navigate") {
|
|
1919
1919
|
if (!se("navigate")) {
|
|
1920
1920
|
de("navigate", "navigate");
|
|
1921
1921
|
return;
|
|
1922
1922
|
}
|
|
1923
|
-
const x = typeof
|
|
1923
|
+
const x = typeof f.href == "string" ? f.href : null;
|
|
1924
1924
|
if (!x) {
|
|
1925
1925
|
console.warn(
|
|
1926
1926
|
`[LiveLayer] Agent emitted "navigate" without href. Skipping. Check your agent's tool schema. See https://livelayer.studio/docs/errors/navigate-missing-href`
|
|
@@ -1958,14 +1958,14 @@ function Sr(e) {
|
|
|
1958
1958
|
}
|
|
1959
1959
|
return;
|
|
1960
1960
|
}
|
|
1961
|
-
if (
|
|
1961
|
+
if (f.type === "scroll_to") {
|
|
1962
1962
|
if (!se("scroll")) {
|
|
1963
1963
|
de("scroll_to", "scroll");
|
|
1964
1964
|
return;
|
|
1965
1965
|
}
|
|
1966
|
-
const x = typeof
|
|
1966
|
+
const x = typeof f.selector == "string" ? f.selector : null;
|
|
1967
1967
|
if (!x) return;
|
|
1968
|
-
const M =
|
|
1968
|
+
const M = f.behavior === "instant" ? "instant" : "smooth";
|
|
1969
1969
|
if (ot.current) {
|
|
1970
1970
|
try {
|
|
1971
1971
|
ot.current(
|
|
@@ -2000,26 +2000,26 @@ function Sr(e) {
|
|
|
2000
2000
|
}
|
|
2001
2001
|
return;
|
|
2002
2002
|
}
|
|
2003
|
-
if (
|
|
2003
|
+
if (f.type === "request_page_context") {
|
|
2004
2004
|
if (!se("read_page")) {
|
|
2005
2005
|
de("request_page_context", "read_page");
|
|
2006
2006
|
return;
|
|
2007
2007
|
}
|
|
2008
|
-
const x = typeof
|
|
2008
|
+
const x = typeof f.requestId == "string" ? f.requestId : void 0, M = (Z = oe.current) == null ? void 0 : Z.call(oe), q = (U) => {
|
|
2009
2009
|
const P = M, G = P == null ? void 0 : P.localParticipant;
|
|
2010
2010
|
if (G != null && G.publishData)
|
|
2011
2011
|
try {
|
|
2012
|
-
const
|
|
2013
|
-
G.publishData(
|
|
2014
|
-
} catch (
|
|
2015
|
-
console.warn("[LiveLayer] publishData failed.",
|
|
2012
|
+
const X = x ? { ...U, requestId: x } : U, Ce = new TextEncoder().encode(JSON.stringify(X));
|
|
2013
|
+
G.publishData(Ce, { reliable: !0 });
|
|
2014
|
+
} catch (X) {
|
|
2015
|
+
console.warn("[LiveLayer] publishData failed.", X);
|
|
2016
2016
|
}
|
|
2017
2017
|
}, $ = mt.current, F = ht.current;
|
|
2018
2018
|
try {
|
|
2019
2019
|
if (F) {
|
|
2020
|
-
const
|
|
2021
|
-
if (
|
|
2022
|
-
q({ type: "page_context_pending" }),
|
|
2020
|
+
const U = F($);
|
|
2021
|
+
if (U instanceof Promise) {
|
|
2022
|
+
q({ type: "page_context_pending" }), U.then((P) => q({ type: "page_context", context: P })).catch((P) => {
|
|
2023
2023
|
console.warn(
|
|
2024
2024
|
"[LiveLayer] getPageContext rejected; falling back to default walker.",
|
|
2025
2025
|
P
|
|
@@ -2030,17 +2030,17 @@ function Sr(e) {
|
|
|
2030
2030
|
});
|
|
2031
2031
|
return;
|
|
2032
2032
|
}
|
|
2033
|
-
q({ type: "page_context", context:
|
|
2033
|
+
q({ type: "page_context", context: U });
|
|
2034
2034
|
return;
|
|
2035
2035
|
}
|
|
2036
2036
|
q({
|
|
2037
2037
|
type: "page_context",
|
|
2038
2038
|
context: Wt($)
|
|
2039
2039
|
});
|
|
2040
|
-
} catch (
|
|
2040
|
+
} catch (U) {
|
|
2041
2041
|
console.warn(
|
|
2042
2042
|
"[LiveLayer] page-context extraction threw. Sending empty context.",
|
|
2043
|
-
|
|
2043
|
+
U
|
|
2044
2044
|
), q({
|
|
2045
2045
|
type: "page_context",
|
|
2046
2046
|
context: { url: "", title: "", pathname: "/", regions: [], visibleText: "", visibleLinks: [], visibleFields: [], forms: [], extras: $ }
|
|
@@ -2048,19 +2048,19 @@ function Sr(e) {
|
|
|
2048
2048
|
}
|
|
2049
2049
|
return;
|
|
2050
2050
|
}
|
|
2051
|
-
if (
|
|
2051
|
+
if (f.type === "scroll_page") {
|
|
2052
2052
|
if (!se("scroll")) {
|
|
2053
2053
|
de("scroll_page", "scroll");
|
|
2054
2054
|
return;
|
|
2055
2055
|
}
|
|
2056
|
-
const x =
|
|
2056
|
+
const x = f.direction;
|
|
2057
2057
|
if (x !== "up" && x !== "down" && x !== "top" && x !== "bottom") {
|
|
2058
2058
|
console.warn(
|
|
2059
2059
|
`[LiveLayer] scroll_page: invalid direction "${String(x)}". Expected up | down | top | bottom.`
|
|
2060
2060
|
);
|
|
2061
2061
|
return;
|
|
2062
2062
|
}
|
|
2063
|
-
const M =
|
|
2063
|
+
const M = f.behavior === "instant" ? "instant" : "smooth";
|
|
2064
2064
|
if (it.current) {
|
|
2065
2065
|
try {
|
|
2066
2066
|
it.current(
|
|
@@ -2075,18 +2075,18 @@ function Sr(e) {
|
|
|
2075
2075
|
if (typeof window > "u") return;
|
|
2076
2076
|
const q = { behavior: M }, $ = xr(), F = (P) => {
|
|
2077
2077
|
$ instanceof Window ? $.scrollBy({ top: P, ...q }) : $.scrollBy({ top: P, ...q });
|
|
2078
|
-
},
|
|
2078
|
+
}, U = (P) => {
|
|
2079
2079
|
$ instanceof Window ? $.scrollTo({ top: P, ...q }) : $.scrollTo({ top: P, ...q });
|
|
2080
2080
|
};
|
|
2081
|
-
x === "up" ? F(-Ft($)) : x === "down" ? F(Ft($)) :
|
|
2081
|
+
x === "up" ? F(-Ft($)) : x === "down" ? F(Ft($)) : U(x === "top" ? 0 : kr($));
|
|
2082
2082
|
return;
|
|
2083
2083
|
}
|
|
2084
|
-
if (
|
|
2084
|
+
if (f.type === "click") {
|
|
2085
2085
|
if (!se("click")) {
|
|
2086
2086
|
de("click", "click");
|
|
2087
2087
|
return;
|
|
2088
2088
|
}
|
|
2089
|
-
const x = typeof
|
|
2089
|
+
const x = typeof f.selector == "string" ? f.selector : null;
|
|
2090
2090
|
if (!x) {
|
|
2091
2091
|
console.warn("[LiveLayer] click: missing selector.");
|
|
2092
2092
|
return;
|
|
@@ -2121,18 +2121,18 @@ function Sr(e) {
|
|
|
2121
2121
|
);
|
|
2122
2122
|
return;
|
|
2123
2123
|
}
|
|
2124
|
-
(
|
|
2124
|
+
(Je = M.click) == null || Je.call(M);
|
|
2125
2125
|
return;
|
|
2126
2126
|
}
|
|
2127
|
-
if (
|
|
2127
|
+
if (f.type === "fill_form" || f.type === "focus_field") {
|
|
2128
2128
|
if (!se("fill_forms")) {
|
|
2129
|
-
de(
|
|
2129
|
+
de(f.type, "fill_forms");
|
|
2130
2130
|
return;
|
|
2131
2131
|
}
|
|
2132
2132
|
if (typeof document > "u") return;
|
|
2133
|
-
const x = typeof
|
|
2133
|
+
const x = typeof f.formId == "string" ? f.formId : null;
|
|
2134
2134
|
if (!x) {
|
|
2135
|
-
console.warn(`[LiveLayer] ${
|
|
2135
|
+
console.warn(`[LiveLayer] ${f.type}: missing formId.`);
|
|
2136
2136
|
return;
|
|
2137
2137
|
}
|
|
2138
2138
|
const M = document.querySelector(
|
|
@@ -2140,18 +2140,18 @@ function Sr(e) {
|
|
|
2140
2140
|
);
|
|
2141
2141
|
if (!M) {
|
|
2142
2142
|
console.warn(
|
|
2143
|
-
`[LiveLayer] ${
|
|
2143
|
+
`[LiveLayer] ${f.type}: no form with data-ll-form="${x}". Tag your form with <LiveLayerForm id> or data-ll-form. See https://livelayer.studio/docs/react/forms`
|
|
2144
2144
|
);
|
|
2145
2145
|
return;
|
|
2146
2146
|
}
|
|
2147
2147
|
if (M.closest('[data-ll-private="true"], .ll-widget')) {
|
|
2148
2148
|
console.warn(
|
|
2149
|
-
`[LiveLayer] ${
|
|
2149
|
+
`[LiveLayer] ${f.type}: refusing to touch a form in a private subtree.`
|
|
2150
2150
|
);
|
|
2151
2151
|
return;
|
|
2152
2152
|
}
|
|
2153
|
-
if (
|
|
2154
|
-
const $ = typeof
|
|
2153
|
+
if (f.type === "focus_field") {
|
|
2154
|
+
const $ = typeof f.fieldName == "string" ? f.fieldName : null;
|
|
2155
2155
|
if (!$) {
|
|
2156
2156
|
console.warn("[LiveLayer] focus_field: missing fieldName.");
|
|
2157
2157
|
return;
|
|
@@ -2172,28 +2172,28 @@ function Sr(e) {
|
|
|
2172
2172
|
F.focus();
|
|
2173
2173
|
return;
|
|
2174
2174
|
}
|
|
2175
|
-
const q =
|
|
2175
|
+
const q = f.values && typeof f.values == "object" ? f.values : null;
|
|
2176
2176
|
if (!q) {
|
|
2177
2177
|
console.warn("[LiveLayer] fill_form: missing or invalid values.");
|
|
2178
2178
|
return;
|
|
2179
2179
|
}
|
|
2180
2180
|
for (const [$, F] of Object.entries(q)) {
|
|
2181
2181
|
if (typeof F != "string") continue;
|
|
2182
|
-
const
|
|
2183
|
-
if (!
|
|
2182
|
+
const U = M.querySelector(`[data-ll-field="${$.replace(/"/g, '\\"')}"]`);
|
|
2183
|
+
if (!U) {
|
|
2184
2184
|
console.warn(
|
|
2185
2185
|
`[LiveLayer] fill_form: no field "${$}" in form "${x}". Skipping.`
|
|
2186
2186
|
);
|
|
2187
2187
|
continue;
|
|
2188
2188
|
}
|
|
2189
|
-
if (!tt(
|
|
2189
|
+
if (!tt(U)) {
|
|
2190
2190
|
console.warn(
|
|
2191
2191
|
`[LiveLayer] fill_form: field "${$}" is privacy-protected (password / cc-* / private). Skipping.`
|
|
2192
2192
|
);
|
|
2193
2193
|
continue;
|
|
2194
2194
|
}
|
|
2195
2195
|
try {
|
|
2196
|
-
vr(
|
|
2196
|
+
vr(U, F);
|
|
2197
2197
|
} catch (P) {
|
|
2198
2198
|
console.warn(
|
|
2199
2199
|
`[LiveLayer] fill_form: failed to set "${$}".`,
|
|
@@ -2203,13 +2203,13 @@ function Sr(e) {
|
|
|
2203
2203
|
}
|
|
2204
2204
|
return;
|
|
2205
2205
|
}
|
|
2206
|
-
if (
|
|
2206
|
+
if (f.type === "submit_form") {
|
|
2207
2207
|
if (!se("submit_forms")) {
|
|
2208
2208
|
de("submit_form", "submit_forms");
|
|
2209
2209
|
return;
|
|
2210
2210
|
}
|
|
2211
2211
|
if (typeof document > "u") return;
|
|
2212
|
-
const x = typeof
|
|
2212
|
+
const x = typeof f.formId == "string" ? f.formId : null;
|
|
2213
2213
|
if (!x) {
|
|
2214
2214
|
console.warn("[LiveLayer] submit_form: missing formId.");
|
|
2215
2215
|
return;
|
|
@@ -2229,18 +2229,18 @@ function Sr(e) {
|
|
|
2229
2229
|
);
|
|
2230
2230
|
return;
|
|
2231
2231
|
}
|
|
2232
|
-
const q = typeof
|
|
2233
|
-
const
|
|
2234
|
-
if (
|
|
2232
|
+
const q = typeof f.requestId == "string" ? f.requestId : void 0, $ = (Ke = oe.current) == null ? void 0 : Ke.call(oe), F = (G) => {
|
|
2233
|
+
const X = $, Ce = X == null ? void 0 : X.localParticipant;
|
|
2234
|
+
if (Ce != null && Ce.publishData)
|
|
2235
2235
|
try {
|
|
2236
2236
|
const cn = q ? { ...G, requestId: q } : G, sn = new TextEncoder().encode(JSON.stringify(cn));
|
|
2237
|
-
|
|
2237
|
+
Ce.publishData(sn, { reliable: !0 });
|
|
2238
2238
|
} catch {
|
|
2239
2239
|
}
|
|
2240
2240
|
};
|
|
2241
|
-
let
|
|
2241
|
+
let U = !1;
|
|
2242
2242
|
const P = () => {
|
|
2243
|
-
|
|
2243
|
+
U = !0, F({ type: "form_submitted", formId: x });
|
|
2244
2244
|
};
|
|
2245
2245
|
M.addEventListener("submit", P, { once: !0 });
|
|
2246
2246
|
try {
|
|
@@ -2254,7 +2254,7 @@ function Sr(e) {
|
|
|
2254
2254
|
return;
|
|
2255
2255
|
}
|
|
2256
2256
|
setTimeout(() => {
|
|
2257
|
-
|
|
2257
|
+
U || (M.removeEventListener("submit", P), F({
|
|
2258
2258
|
type: "form_submit_blocked",
|
|
2259
2259
|
formId: x,
|
|
2260
2260
|
reason: "validation"
|
|
@@ -2262,34 +2262,34 @@ function Sr(e) {
|
|
|
2262
2262
|
}, 500);
|
|
2263
2263
|
return;
|
|
2264
2264
|
}
|
|
2265
|
-
if (
|
|
2265
|
+
if (f.type === "request_routes") {
|
|
2266
2266
|
if (!se("read_page")) {
|
|
2267
2267
|
de("request_routes", "read_page");
|
|
2268
2268
|
return;
|
|
2269
2269
|
}
|
|
2270
|
-
const x = typeof
|
|
2270
|
+
const x = typeof f.requestId == "string" ? f.requestId : void 0, q = (Et = oe.current) == null ? void 0 : Et.call(oe), $ = q == null ? void 0 : q.localParticipant;
|
|
2271
2271
|
if (!($ != null && $.publishData)) return;
|
|
2272
2272
|
const F = (P) => {
|
|
2273
2273
|
try {
|
|
2274
|
-
const G = x ? { type: "routes", routes: P, requestId: x } : { type: "routes", routes: P },
|
|
2275
|
-
$.publishData(
|
|
2274
|
+
const G = x ? { type: "routes", routes: P, requestId: x } : { type: "routes", routes: P }, X = new TextEncoder().encode(JSON.stringify(G));
|
|
2275
|
+
$.publishData(X, { reliable: !0 });
|
|
2276
2276
|
} catch (G) {
|
|
2277
2277
|
console.warn("[LiveLayer] request_routes: publishData failed.", G);
|
|
2278
2278
|
}
|
|
2279
|
-
},
|
|
2280
|
-
if (
|
|
2279
|
+
}, U = gt.current;
|
|
2280
|
+
if (U) {
|
|
2281
2281
|
try {
|
|
2282
|
-
const P =
|
|
2283
|
-
if (!Array.isArray(
|
|
2282
|
+
const P = U(), G = (X) => {
|
|
2283
|
+
if (!Array.isArray(X)) {
|
|
2284
2284
|
F([]);
|
|
2285
2285
|
return;
|
|
2286
2286
|
}
|
|
2287
|
-
F(
|
|
2287
|
+
F(X.map(fr).slice(0, 200));
|
|
2288
2288
|
};
|
|
2289
|
-
P instanceof Promise ? P.then(G).catch((
|
|
2289
|
+
P instanceof Promise ? P.then(G).catch((X) => {
|
|
2290
2290
|
console.warn(
|
|
2291
2291
|
"[LiveLayer] getRoutes rejected; falling back to DOM walker.",
|
|
2292
|
-
|
|
2292
|
+
X
|
|
2293
2293
|
), F(st());
|
|
2294
2294
|
}) : G(P);
|
|
2295
2295
|
} catch (P) {
|
|
@@ -2307,193 +2307,181 @@ function Sr(e) {
|
|
|
2307
2307
|
}
|
|
2308
2308
|
return;
|
|
2309
2309
|
}
|
|
2310
|
-
Lr.has(
|
|
2310
|
+
Lr.has(f.type) || xe == null || xe(f);
|
|
2311
2311
|
}
|
|
2312
2312
|
},
|
|
2313
|
-
[
|
|
2314
|
-
),
|
|
2315
|
-
agentId:
|
|
2313
|
+
[xe, _e]
|
|
2314
|
+
), Y = gn({
|
|
2315
|
+
agentId: j ? "__controlled__" : Re,
|
|
2316
2316
|
baseUrl: o,
|
|
2317
2317
|
apiKey: r,
|
|
2318
2318
|
sessionEndpoint: i,
|
|
2319
2319
|
sessionBody: l,
|
|
2320
|
-
onDataMessage:
|
|
2320
|
+
onDataMessage: j ? void 0 : Te
|
|
2321
2321
|
});
|
|
2322
2322
|
T(() => {
|
|
2323
|
-
if (
|
|
2324
|
-
return
|
|
2325
|
-
}, [
|
|
2326
|
-
var
|
|
2327
|
-
return (
|
|
2323
|
+
if (j != null && j.subscribeToDataMessages)
|
|
2324
|
+
return j.subscribeToDataMessages(Te);
|
|
2325
|
+
}, [j, Te]), oe.current = () => {
|
|
2326
|
+
var g;
|
|
2327
|
+
return (g = Y.getRoom) == null ? void 0 : g.call(Y);
|
|
2328
2328
|
}, T(() => {
|
|
2329
|
-
var
|
|
2330
|
-
if (!fe) return;
|
|
2331
|
-
const h = (J = U.getRoom) == null ? void 0 : J.call(U), u = h == null ? void 0 : h.localParticipant;
|
|
2332
|
-
if (u != null && u.publishData)
|
|
2333
|
-
try {
|
|
2334
|
-
const Ee = new TextEncoder().encode(
|
|
2335
|
-
JSON.stringify({ type: "pathname", pathname: fe })
|
|
2336
|
-
);
|
|
2337
|
-
u.publishData(Ee, { reliable: !0 });
|
|
2338
|
-
} catch {
|
|
2339
|
-
}
|
|
2340
|
-
}, [fe, U, U.connectionState]), T(() => {
|
|
2341
|
-
var J;
|
|
2329
|
+
var Z;
|
|
2342
2330
|
if (typeof window > "u") return;
|
|
2343
|
-
const
|
|
2344
|
-
if (
|
|
2345
|
-
return window.__livelayerSimulateCommand = (
|
|
2331
|
+
const g = ((Z = window.location) == null ? void 0 : Z.hostname) || "";
|
|
2332
|
+
if (g === "localhost" || g === "127.0.0.1" || g === "0.0.0.0" || g.endsWith(".local") || g.endsWith(".test"))
|
|
2333
|
+
return window.__livelayerSimulateCommand = (Je) => {
|
|
2346
2334
|
try {
|
|
2347
|
-
|
|
2335
|
+
Te(Je);
|
|
2348
2336
|
} catch (Ke) {
|
|
2349
2337
|
console.warn("[LiveLayer] simulate-command threw:", Ke);
|
|
2350
2338
|
}
|
|
2351
2339
|
}, () => {
|
|
2352
2340
|
delete window.__livelayerSimulateCommand;
|
|
2353
2341
|
};
|
|
2354
|
-
}, [
|
|
2355
|
-
const _ = Ze(() =>
|
|
2356
|
-
connectionState:
|
|
2357
|
-
agentState:
|
|
2358
|
-
transcript:
|
|
2359
|
-
videoElement:
|
|
2360
|
-
audioElement:
|
|
2361
|
-
canResume:
|
|
2362
|
-
error:
|
|
2342
|
+
}, [Te]);
|
|
2343
|
+
const _ = Ze(() => j ? {
|
|
2344
|
+
connectionState: j.connectionState,
|
|
2345
|
+
agentState: j.agentState,
|
|
2346
|
+
transcript: j.transcript,
|
|
2347
|
+
videoElement: j.videoElement,
|
|
2348
|
+
audioElement: j.audioElement,
|
|
2349
|
+
canResume: j.canResume,
|
|
2350
|
+
error: j.error,
|
|
2363
2351
|
agentConfig: null,
|
|
2364
2352
|
connect: async () => {
|
|
2365
|
-
await
|
|
2353
|
+
await j.onConnect();
|
|
2366
2354
|
},
|
|
2367
|
-
disconnect: () =>
|
|
2355
|
+
disconnect: () => j.onDisconnect(),
|
|
2368
2356
|
// Dummy getRoom for shape compatibility — controlled consumers own the Room.
|
|
2369
2357
|
// Internal session's getRoom returns null when no real connect has happened,
|
|
2370
2358
|
// so we reuse its reference for type consistency.
|
|
2371
|
-
getRoom:
|
|
2359
|
+
getRoom: Y.getRoom,
|
|
2372
2360
|
isControlled: !0
|
|
2373
2361
|
} : {
|
|
2374
|
-
connectionState:
|
|
2375
|
-
agentState:
|
|
2376
|
-
transcript:
|
|
2377
|
-
videoElement:
|
|
2378
|
-
audioElement:
|
|
2379
|
-
canResume:
|
|
2380
|
-
error:
|
|
2381
|
-
agentConfig:
|
|
2382
|
-
connect:
|
|
2383
|
-
disconnect:
|
|
2384
|
-
getRoom:
|
|
2362
|
+
connectionState: Y.connectionState,
|
|
2363
|
+
agentState: Y.agentState,
|
|
2364
|
+
transcript: Y.transcript,
|
|
2365
|
+
videoElement: Y.videoElement,
|
|
2366
|
+
audioElement: Y.audioElement,
|
|
2367
|
+
canResume: Y.canResume,
|
|
2368
|
+
error: Y.error,
|
|
2369
|
+
agentConfig: Y.agentConfig,
|
|
2370
|
+
connect: Y.connect,
|
|
2371
|
+
disconnect: Y.disconnect,
|
|
2372
|
+
getRoom: Y.getRoom,
|
|
2385
2373
|
isControlled: !1
|
|
2386
|
-
}, [
|
|
2374
|
+
}, [j, Y]), yt = E(null);
|
|
2387
2375
|
T(() => {
|
|
2388
|
-
const
|
|
2389
|
-
if (!(!
|
|
2390
|
-
return
|
|
2391
|
-
|
|
2376
|
+
const g = _.videoElement, f = yt.current;
|
|
2377
|
+
if (!(!g || !f))
|
|
2378
|
+
return f.appendChild(g), () => {
|
|
2379
|
+
g.parentNode === f && f.removeChild(g);
|
|
2392
2380
|
};
|
|
2393
2381
|
}, [_.videoElement]), T(() => {
|
|
2394
|
-
const
|
|
2395
|
-
if (!
|
|
2396
|
-
ce.attach(
|
|
2397
|
-
const
|
|
2398
|
-
return
|
|
2399
|
-
(
|
|
2382
|
+
const g = _.audioElement;
|
|
2383
|
+
if (!g) return;
|
|
2384
|
+
ce.attach(g);
|
|
2385
|
+
const f = g.play();
|
|
2386
|
+
return f && typeof f.catch == "function" && f.catch((Z) => {
|
|
2387
|
+
(Z == null ? void 0 : Z.name) === "NotAllowedError" && Me(!0);
|
|
2400
2388
|
}), () => {
|
|
2401
2389
|
ce.detach();
|
|
2402
2390
|
};
|
|
2403
2391
|
}, [_.audioElement]), T(() => {
|
|
2404
2392
|
if (_.isControlled || _.connectionState !== "connected") return;
|
|
2405
|
-
const
|
|
2406
|
-
if (
|
|
2407
|
-
return
|
|
2408
|
-
}), re.attachRoom(
|
|
2409
|
-
|
|
2393
|
+
const g = _.getRoom();
|
|
2394
|
+
if (g)
|
|
2395
|
+
return Q.setupMic(g).catch(() => {
|
|
2396
|
+
}), re.attachRoom(g), pe.attachRoom(g), Ie.refresh(), () => {
|
|
2397
|
+
Q.teardownMic(), re.teardown(), pe.teardown();
|
|
2410
2398
|
};
|
|
2411
2399
|
}, [_.isControlled, _.connectionState]), T(() => {
|
|
2412
|
-
const
|
|
2413
|
-
|
|
2400
|
+
const g = _.audioElement;
|
|
2401
|
+
g && (g.muted = nt);
|
|
2414
2402
|
}, [_.audioElement, nt]);
|
|
2415
|
-
const Kt = k((
|
|
2416
|
-
const
|
|
2417
|
-
if (
|
|
2403
|
+
const Kt = k((g) => {
|
|
2404
|
+
const f = _.getRoom();
|
|
2405
|
+
if (f)
|
|
2418
2406
|
try {
|
|
2419
|
-
const
|
|
2420
|
-
JSON.stringify({ type: "user_message", text:
|
|
2407
|
+
const Z = new TextEncoder().encode(
|
|
2408
|
+
JSON.stringify({ type: "user_message", text: g })
|
|
2421
2409
|
);
|
|
2422
|
-
|
|
2410
|
+
f.localParticipant.publishData(Z, { reliable: !0 });
|
|
2423
2411
|
} catch {
|
|
2424
2412
|
}
|
|
2425
2413
|
}, [_]), Xt = k(() => {
|
|
2426
|
-
|
|
2414
|
+
Jt((g) => !g);
|
|
2427
2415
|
}, []);
|
|
2428
2416
|
T(() => {
|
|
2429
|
-
|
|
2430
|
-
}, [_.connectionState,
|
|
2431
|
-
|
|
2432
|
-
}, [_.transcript,
|
|
2433
|
-
|
|
2434
|
-
}, [_.agentState,
|
|
2417
|
+
we == null || we(_.connectionState), _.connectionState === "connected" ? ge == null || ge() : _.connectionState === "disconnected" && (ye == null || ye());
|
|
2418
|
+
}, [_.connectionState, ge, ye, we]), T(() => {
|
|
2419
|
+
ve == null || ve(_.transcript);
|
|
2420
|
+
}, [_.transcript, ve]), T(() => {
|
|
2421
|
+
be == null || be(_.agentState);
|
|
2422
|
+
}, [_.agentState, be]);
|
|
2435
2423
|
const vt = E(!1);
|
|
2436
2424
|
T(() => {
|
|
2437
2425
|
_.isControlled || !s || vt.current || ae && _.connectionState === "idle" && (vt.current = !0, _.connect());
|
|
2438
2426
|
}, [s, _.connectionState, _, ae]);
|
|
2439
2427
|
const Qt = k(
|
|
2440
|
-
(
|
|
2441
|
-
const
|
|
2442
|
-
|
|
2428
|
+
(g) => {
|
|
2429
|
+
const f = C == null ? void 0 : C.find((Z) => Z.id === g);
|
|
2430
|
+
f && (Ye(!1), g !== fe && (y(!0), _.disconnect(), ie || Le(g), v == null || v(f)));
|
|
2443
2431
|
},
|
|
2444
2432
|
[
|
|
2445
2433
|
C,
|
|
2446
|
-
|
|
2434
|
+
fe,
|
|
2447
2435
|
_,
|
|
2448
2436
|
ie,
|
|
2449
2437
|
v
|
|
2450
2438
|
]
|
|
2451
2439
|
);
|
|
2452
2440
|
T(() => {
|
|
2453
|
-
|
|
2454
|
-
}, [_.connectionState,
|
|
2455
|
-
if (!
|
|
2456
|
-
const
|
|
2457
|
-
|
|
2441
|
+
Se && _.connectionState === "connected" && y(!1);
|
|
2442
|
+
}, [_.connectionState, Se]), T(() => {
|
|
2443
|
+
if (!K) return;
|
|
2444
|
+
const g = (f) => {
|
|
2445
|
+
f.key === "Escape" && Ye(!1);
|
|
2458
2446
|
};
|
|
2459
|
-
return window.addEventListener("keydown",
|
|
2460
|
-
}, [
|
|
2461
|
-
const Zt = !!I || !!(
|
|
2462
|
-
|
|
2463
|
-
const Ge = (
|
|
2447
|
+
return window.addEventListener("keydown", g), () => window.removeEventListener("keydown", g);
|
|
2448
|
+
}, [K]);
|
|
2449
|
+
const Zt = !!I || !!(J != null && J.avatarImageUrl) || _.isControlled, Pe = kn(Re, o, Zt);
|
|
2450
|
+
me === void 0 && ((wt = Pe.info) != null && wt.capabilities) && (at.current = Pe.info.capabilities);
|
|
2451
|
+
const Ge = (J == null ? void 0 : J.name) ?? H ?? ((_t = _.agentConfig) == null ? void 0 : _t.name) ?? ((xt = Pe.info) == null ? void 0 : xt.name) ?? "Live Layer", ct = (J == null ? void 0 : J.avatarImageUrl) ?? I ?? ((kt = _.agentConfig) == null ? void 0 : kt.avatarImageUrl) ?? ((Lt = Pe.info) == null ? void 0 : Lt.avatarImageUrl) ?? null, en = b ?? ((St = _.agentConfig) == null ? void 0 : St.idleLoopUrl) ?? ((Ct = Pe.info) == null ? void 0 : Ct.idleLoopUrl) ?? null, tn = z ?? null, nn = k(() => ee("expanded"), [ee]), rn = k(
|
|
2464
2452
|
() => ee("minimized"),
|
|
2465
2453
|
[ee]
|
|
2466
2454
|
), bt = k(() => {
|
|
2467
2455
|
_.disconnect(), ee("hidden");
|
|
2468
2456
|
}, [_, ee]), on = k(() => {
|
|
2469
|
-
const
|
|
2470
|
-
|
|
2457
|
+
const g = _.audioElement;
|
|
2458
|
+
g && g.play().then(() => Me(!1)).catch(() => {
|
|
2471
2459
|
});
|
|
2472
2460
|
}, [_.audioElement]), ln = k(() => {
|
|
2473
|
-
|
|
2474
|
-
}, [_]),
|
|
2475
|
-
...
|
|
2476
|
-
zIndex:
|
|
2461
|
+
Me(!1), _.connect();
|
|
2462
|
+
}, [_]), De = {
|
|
2463
|
+
...Fe,
|
|
2464
|
+
zIndex: Ue
|
|
2477
2465
|
};
|
|
2478
|
-
p.primaryColor && (
|
|
2466
|
+
p.primaryColor && (De["--ll-color-primary"] = p.primaryColor), p.accentColor && (De["--ll-color-accent"] = p.accentColor), p.backgroundColor && (De["--ll-color-bg"] = p.backgroundColor), p.textColor && (De["--ll-color-fg"] = p.textColor);
|
|
2479
2467
|
const an = [
|
|
2480
2468
|
"ll-widget",
|
|
2481
2469
|
`ll-widget--${ne}`,
|
|
2482
2470
|
`ll-widget--${le ? "mobile" : "desktop"}`,
|
|
2483
|
-
|
|
2471
|
+
We
|
|
2484
2472
|
].filter(Boolean).join(" ");
|
|
2485
2473
|
return ae ? /* @__PURE__ */ w(
|
|
2486
2474
|
"div",
|
|
2487
2475
|
{
|
|
2488
2476
|
className: an,
|
|
2489
|
-
style:
|
|
2477
|
+
style: De,
|
|
2490
2478
|
"data-display-mode": ne,
|
|
2491
|
-
"data-position":
|
|
2479
|
+
"data-position": h,
|
|
2492
2480
|
children: [
|
|
2493
2481
|
ne === "hidden" && /* @__PURE__ */ n(
|
|
2494
2482
|
Vn,
|
|
2495
2483
|
{
|
|
2496
|
-
position:
|
|
2484
|
+
position: h,
|
|
2497
2485
|
isMobile: le,
|
|
2498
2486
|
isSpeaking: _.agentState === "speaking",
|
|
2499
2487
|
onExpand: () => ee("expanded"),
|
|
@@ -2503,24 +2491,24 @@ function Sr(e) {
|
|
|
2503
2491
|
}
|
|
2504
2492
|
),
|
|
2505
2493
|
ne === "minimized" && /* @__PURE__ */ n(
|
|
2506
|
-
|
|
2494
|
+
Gn,
|
|
2507
2495
|
{
|
|
2508
|
-
position:
|
|
2496
|
+
position: h,
|
|
2509
2497
|
isMobile: le,
|
|
2510
2498
|
agentName: Ge,
|
|
2511
2499
|
avatarImageUrl: ct,
|
|
2512
2500
|
agentState: _.agentState,
|
|
2513
|
-
isMuted:
|
|
2501
|
+
isMuted: Q.isMuted,
|
|
2514
2502
|
audioLevel: ce,
|
|
2515
2503
|
onExpand: nn,
|
|
2516
|
-
onToggleMute:
|
|
2504
|
+
onToggleMute: Q.toggleMute,
|
|
2517
2505
|
onClose: bt
|
|
2518
2506
|
}
|
|
2519
2507
|
),
|
|
2520
2508
|
ne === "expanded" && /* @__PURE__ */ n(
|
|
2521
2509
|
Kn,
|
|
2522
2510
|
{
|
|
2523
|
-
position:
|
|
2511
|
+
position: h,
|
|
2524
2512
|
isMobile: le,
|
|
2525
2513
|
agentName: Ge,
|
|
2526
2514
|
avatarImageUrl: ct,
|
|
@@ -2528,46 +2516,46 @@ function Sr(e) {
|
|
|
2528
2516
|
greeting: tn,
|
|
2529
2517
|
branding: p,
|
|
2530
2518
|
teamMembers: C,
|
|
2531
|
-
currentTeamMemberId:
|
|
2532
|
-
isSwitchingTeamMember:
|
|
2533
|
-
teamSwitcherOpen:
|
|
2534
|
-
onToggleTeamSwitcher: () =>
|
|
2519
|
+
currentTeamMemberId: fe,
|
|
2520
|
+
isSwitchingTeamMember: Se,
|
|
2521
|
+
teamSwitcherOpen: K,
|
|
2522
|
+
onToggleTeamSwitcher: () => Ye((g) => !g),
|
|
2535
2523
|
onSelectTeamMember: Qt,
|
|
2536
2524
|
connectionState: _.connectionState,
|
|
2537
2525
|
agentState: _.agentState,
|
|
2538
2526
|
transcript: _.transcript,
|
|
2539
|
-
isMuted:
|
|
2540
|
-
micDevices:
|
|
2527
|
+
isMuted: Q.isMuted,
|
|
2528
|
+
micDevices: Ie.mics,
|
|
2541
2529
|
isCameraEnabled: re.isEnabled,
|
|
2542
2530
|
cameraPreviewEl: re.previewEl,
|
|
2543
|
-
cameraDevices:
|
|
2531
|
+
cameraDevices: Ie.cameras,
|
|
2544
2532
|
activeCameraId: re.activeDeviceId,
|
|
2545
|
-
isScreenShareEnabled:
|
|
2546
|
-
screenPreviewEl:
|
|
2533
|
+
isScreenShareEnabled: pe.isEnabled,
|
|
2534
|
+
screenPreviewEl: pe.previewEl,
|
|
2547
2535
|
isSpeakerMuted: nt,
|
|
2548
2536
|
allowCamera: N,
|
|
2549
2537
|
allowScreenShare: B,
|
|
2550
2538
|
allowTyping: D,
|
|
2551
2539
|
languageMenuOpen: Yt,
|
|
2552
|
-
onToggleLanguageMenu: () =>
|
|
2553
|
-
needsUserGesture:
|
|
2540
|
+
onToggleLanguageMenu: () => Gt((g) => !g),
|
|
2541
|
+
needsUserGesture: Ve,
|
|
2554
2542
|
canResume: _.canResume,
|
|
2555
|
-
micError:
|
|
2543
|
+
micError: Q.micError,
|
|
2556
2544
|
error: _.error,
|
|
2557
2545
|
avatarVideoContainerRef: yt,
|
|
2558
2546
|
onConnect: () => void _.connect(),
|
|
2559
2547
|
onDisconnect: () => _.disconnect(),
|
|
2560
2548
|
onRetry: ln,
|
|
2561
2549
|
onResumeAudio: on,
|
|
2562
|
-
onToggleMute:
|
|
2550
|
+
onToggleMute: Q.toggleMute,
|
|
2563
2551
|
onToggleCamera: () => void re.toggle(),
|
|
2564
|
-
onSwitchCameraDevice: (
|
|
2565
|
-
onToggleScreenShare: () => void
|
|
2552
|
+
onSwitchCameraDevice: (g) => void re.switchDevice(g),
|
|
2553
|
+
onToggleScreenShare: () => void pe.toggle(),
|
|
2566
2554
|
onToggleSpeaker: Xt,
|
|
2567
2555
|
onSendMessage: Kt,
|
|
2568
2556
|
onMinimize: rn,
|
|
2569
2557
|
onClose: bt,
|
|
2570
|
-
onClearMicError:
|
|
2558
|
+
onClearMicError: Q.clearError
|
|
2571
2559
|
}
|
|
2572
2560
|
)
|
|
2573
2561
|
]
|
|
@@ -2586,22 +2574,22 @@ const Pr = ({
|
|
|
2586
2574
|
className: l,
|
|
2587
2575
|
style: s
|
|
2588
2576
|
}) => {
|
|
2589
|
-
const d = E(null),
|
|
2590
|
-
|
|
2591
|
-
const
|
|
2577
|
+
const d = E(null), u = E(null), m = E(i);
|
|
2578
|
+
m.current = i;
|
|
2579
|
+
const h = k((a) => {
|
|
2592
2580
|
var R;
|
|
2593
2581
|
const c = a.detail;
|
|
2594
|
-
(R =
|
|
2582
|
+
(R = m.current) == null || R.call(m, c);
|
|
2595
2583
|
}, []);
|
|
2596
2584
|
return T(() => {
|
|
2597
2585
|
const a = d.current;
|
|
2598
2586
|
if (!a) return;
|
|
2599
2587
|
const c = document.createElement("livelayer-widget");
|
|
2600
|
-
return c.setAttribute("agent-id", e), t && c.setAttribute("base-url", t), r && c.setAttribute("api-key", r), o && c.setAttribute("mode", o), c.addEventListener("agent-event",
|
|
2601
|
-
c.removeEventListener("agent-event",
|
|
2588
|
+
return c.setAttribute("agent-id", e), t && c.setAttribute("base-url", t), r && c.setAttribute("api-key", r), o && c.setAttribute("mode", o), c.addEventListener("agent-event", h), a.appendChild(c), u.current = c, () => {
|
|
2589
|
+
c.removeEventListener("agent-event", h), a.removeChild(c), u.current = null;
|
|
2602
2590
|
};
|
|
2603
2591
|
}, [e]), T(() => {
|
|
2604
|
-
|
|
2592
|
+
u.current && (o ? u.current.setAttribute("mode", o) : u.current.removeAttribute("mode"));
|
|
2605
2593
|
}, [o]), /* @__PURE__ */ n("div", { ref: d, className: l, style: s });
|
|
2606
2594
|
}, Dr = ft(
|
|
2607
2595
|
function({ id: t, intent: r, as: o = "div", className: i, style: l, children: s }, d) {
|
|
@@ -2635,7 +2623,7 @@ const Pr = ({
|
|
|
2635
2623
|
const { name: o, label: i, labelClassName: l } = t, s = { name: o, "data-ll-field": o };
|
|
2636
2624
|
let d;
|
|
2637
2625
|
if ("as" in t && t.as === "textarea") {
|
|
2638
|
-
const { name:
|
|
2626
|
+
const { name: u, label: m, labelClassName: h, as: a, ...c } = t;
|
|
2639
2627
|
d = /* @__PURE__ */ n(
|
|
2640
2628
|
"textarea",
|
|
2641
2629
|
{
|
|
@@ -2645,7 +2633,7 @@ const Pr = ({
|
|
|
2645
2633
|
}
|
|
2646
2634
|
);
|
|
2647
2635
|
} else if ("as" in t && t.as === "select") {
|
|
2648
|
-
const { name:
|
|
2636
|
+
const { name: u, label: m, labelClassName: h, as: a, children: c, ...R } = t;
|
|
2649
2637
|
d = /* @__PURE__ */ n(
|
|
2650
2638
|
"select",
|
|
2651
2639
|
{
|
|
@@ -2656,7 +2644,7 @@ const Pr = ({
|
|
|
2656
2644
|
}
|
|
2657
2645
|
);
|
|
2658
2646
|
} else {
|
|
2659
|
-
const { name:
|
|
2647
|
+
const { name: u, label: m, labelClassName: h, as: a, ...c } = t;
|
|
2660
2648
|
d = /* @__PURE__ */ n(
|
|
2661
2649
|
"input",
|
|
2662
2650
|
{
|
|
@@ -2678,8 +2666,8 @@ function Hr({
|
|
|
2678
2666
|
defaultOpen: t = !1,
|
|
2679
2667
|
storageKey: r = "ll-debug-open"
|
|
2680
2668
|
}) {
|
|
2681
|
-
const [o, i] = S(t), [l, s] = S([]), [d,
|
|
2682
|
-
R.current =
|
|
2669
|
+
const [o, i] = S(t), [l, s] = S([]), [d, u] = S(""), [m, h] = S(!1), a = E(/* @__PURE__ */ new Set()), c = E([]), R = E(m);
|
|
2670
|
+
R.current = m, T(() => {
|
|
2683
2671
|
try {
|
|
2684
2672
|
const v = localStorage.getItem(r);
|
|
2685
2673
|
v === "1" && i(!0), v === "0" && i(!1);
|
|
@@ -2811,10 +2799,10 @@ function Hr({
|
|
|
2811
2799
|
"button",
|
|
2812
2800
|
{
|
|
2813
2801
|
type: "button",
|
|
2814
|
-
onClick: () =>
|
|
2815
|
-
style: dt(
|
|
2802
|
+
onClick: () => h((v) => !v),
|
|
2803
|
+
style: dt(m ? "#f59e0b" : "transparent"),
|
|
2816
2804
|
title: "Pause / resume capture",
|
|
2817
|
-
children:
|
|
2805
|
+
children: m ? "▶ resume" : "⏸ pause"
|
|
2818
2806
|
}
|
|
2819
2807
|
),
|
|
2820
2808
|
/* @__PURE__ */ n(
|
|
@@ -2848,7 +2836,7 @@ function Hr({
|
|
|
2848
2836
|
{
|
|
2849
2837
|
type: "text",
|
|
2850
2838
|
value: d,
|
|
2851
|
-
onChange: (v) =>
|
|
2839
|
+
onChange: (v) => u(v.target.value),
|
|
2852
2840
|
placeholder: "filter by type or data…",
|
|
2853
2841
|
style: {
|
|
2854
2842
|
margin: 8,
|