@liforma/client 0.4.5 → 0.4.8
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/CHANGELOG.md +36 -0
- package/README.md +23 -0
- package/dist/next/index.js +23 -4
- package/dist/next/index.js.map +1 -1
- package/dist/next/next/thumbnail.d.ts +5 -0
- package/dist/next/next/thumbnail.d.ts.map +1 -0
- package/dist/next/react/thumbnail.d.ts +4 -0
- package/dist/next/react/thumbnail.d.ts.map +1 -0
- package/dist/next/thumbnail.js +396 -0
- package/dist/next/thumbnail.js.map +1 -0
- package/dist/next/v2/embed/iframeHost.d.ts +3 -1
- package/dist/next/v2/embed/iframeHost.d.ts.map +1 -1
- package/dist/next/v2/embed/protocol.d.ts +10 -1
- package/dist/next/v2/embed/protocol.d.ts.map +1 -1
- package/dist/next/v2/experience.d.ts +10 -2
- package/dist/next/v2/experience.d.ts.map +1 -1
- package/dist/next/v2/experienceEvents.d.ts +2 -0
- package/dist/next/v2/experienceEvents.d.ts.map +1 -1
- package/dist/next/v2/types/sessionInteraction.d.ts +30 -0
- package/dist/next/v2/types/sessionInteraction.d.ts.map +1 -1
- package/dist/npm/index.js +23 -4
- package/dist/npm/index.js.map +1 -1
- package/dist/npm/thumbnail/index.js +231 -0
- package/dist/npm/thumbnail/index.js.map +1 -0
- package/dist/npm/v2/embed/iframeHost.d.ts +3 -1
- package/dist/npm/v2/embed/iframeHost.d.ts.map +1 -1
- package/dist/npm/v2/embed/protocol.d.ts +10 -1
- package/dist/npm/v2/embed/protocol.d.ts.map +1 -1
- package/dist/npm/v2/experience.d.ts +10 -2
- package/dist/npm/v2/experience.d.ts.map +1 -1
- package/dist/npm/v2/experienceEvents.d.ts +2 -0
- package/dist/npm/v2/experienceEvents.d.ts.map +1 -1
- package/dist/npm/v2/index.d.ts +1 -1
- package/dist/npm/v2/index.d.ts.map +1 -1
- package/dist/npm/v2/npm.d.ts +1 -1
- package/dist/npm/v2/npm.d.ts.map +1 -1
- package/dist/npm/v2/thumbnail-cdn.d.ts +17 -0
- package/dist/npm/v2/thumbnail-cdn.d.ts.map +1 -0
- package/dist/npm/v2/types/sessionInteraction.d.ts +30 -0
- package/dist/npm/v2/types/sessionInteraction.d.ts.map +1 -1
- package/dist/react/component/experienceComponentRuntime.d.ts +1 -0
- package/dist/react/component/experienceComponentRuntime.d.ts.map +1 -1
- package/dist/react/component/experienceComponentTypes.d.ts +8 -0
- package/dist/react/component/experienceComponentTypes.d.ts.map +1 -1
- package/dist/react/index.js +119 -96
- package/dist/react/index.js.map +1 -1
- package/dist/react/react/Experience.d.ts.map +1 -1
- package/dist/react/react/thumbnail.d.ts +4 -0
- package/dist/react/react/thumbnail.d.ts.map +1 -0
- package/dist/react/thumbnail.js +396 -0
- package/dist/react/thumbnail.js.map +1 -0
- package/dist/react/v2/embed/iframeHost.d.ts +3 -1
- package/dist/react/v2/embed/iframeHost.d.ts.map +1 -1
- package/dist/react/v2/embed/protocol.d.ts +10 -1
- package/dist/react/v2/embed/protocol.d.ts.map +1 -1
- package/dist/react/v2/experience.d.ts +10 -2
- package/dist/react/v2/experience.d.ts.map +1 -1
- package/dist/react/v2/experienceEvents.d.ts +2 -0
- package/dist/react/v2/experienceEvents.d.ts.map +1 -1
- package/dist/react/v2/types/sessionInteraction.d.ts +30 -0
- package/dist/react/v2/types/sessionInteraction.d.ts.map +1 -1
- package/dist/sdk/v2/client.js +3 -810
- package/dist/sdk/v2/client.js.map +1 -1
- package/dist/sdk/v2/thumbnail.js +222 -0
- package/dist/sdk/v2/thumbnail.js.map +1 -0
- package/dist/svelte/Experience.svelte +11 -0
- package/dist/svelte/Experience.svelte.d.ts +1 -0
- package/dist/svelte/ExperienceThumbnail.svelte +1 -1
- package/dist/svelte/ExperienceThumbnail.svelte.d.ts +1 -1
- package/dist/svelte/thumbnail.d.ts +2 -0
- package/dist/svelte/thumbnail.js +1 -0
- package/package.json +24 -6
package/dist/react/index.js
CHANGED
|
@@ -234,6 +234,7 @@ function N(e = () => ({}), t = () => ({})) {
|
|
|
234
234
|
container: n,
|
|
235
235
|
fit: d.fit,
|
|
236
236
|
startButton: d.startButton,
|
|
237
|
+
theme: d.theme,
|
|
237
238
|
showFeedback: d.showFeedback,
|
|
238
239
|
closeButton: d.closeButton,
|
|
239
240
|
returnUrl: f,
|
|
@@ -327,42 +328,44 @@ function ee(e, t) {
|
|
|
327
328
|
//#endregion
|
|
328
329
|
//#region src/react/Experience.tsx
|
|
329
330
|
var te = e(function(e, a) {
|
|
330
|
-
let { returnUrl: c, fit: l, startButton: u,
|
|
331
|
+
let { returnUrl: c, fit: l, startButton: u, theme: p, showFeedback: m, closeButton: h, onReady: g, onStarted: y, onUserTranscript: b, onUserSpeechStarted: x, onUserSpeechEnded: S, onCharacterSpeechStarted: C, onCharacterSpeechEnded: w, onCharacterFocusChanged: T, onConversationUpdate: E, onMessage: k, onListeningState: A, onActivityChange: j, onFeedback: M, onFeedbackFailed: P, onConversationProcessorError: F, onPlayerStatusChange: I, onStateUpdate: te, onClose: ne, onError: L } = e, re = o({}), ie = o({
|
|
331
332
|
fit: l,
|
|
332
333
|
startButton: u,
|
|
333
|
-
|
|
334
|
-
|
|
334
|
+
theme: p,
|
|
335
|
+
showFeedback: m,
|
|
336
|
+
closeButton: h,
|
|
335
337
|
returnUrl: c
|
|
336
|
-
}), R = o(N(() =>
|
|
337
|
-
|
|
338
|
+
}), R = o(N(() => re.current, () => ie.current)), z = o(null), [B, ae] = s(!1), [V, oe] = s(null), se = o(null), ce = o(null), H = v(e);
|
|
339
|
+
ie.current = {
|
|
338
340
|
fit: l,
|
|
339
341
|
startButton: u,
|
|
340
|
-
|
|
341
|
-
|
|
342
|
+
theme: p,
|
|
343
|
+
showFeedback: m,
|
|
344
|
+
closeButton: h,
|
|
342
345
|
returnUrl: c
|
|
343
|
-
},
|
|
344
|
-
onReady:
|
|
345
|
-
onStarted:
|
|
346
|
-
onUserTranscript:
|
|
347
|
-
onUserSpeechStarted:
|
|
348
|
-
onUserSpeechEnded:
|
|
349
|
-
onCharacterSpeechStarted:
|
|
350
|
-
onCharacterSpeechEnded:
|
|
351
|
-
onCharacterFocusChanged:
|
|
352
|
-
onConversationUpdate:
|
|
353
|
-
onMessage:
|
|
354
|
-
onListeningState:
|
|
355
|
-
onActivityChange:
|
|
356
|
-
onFeedback:
|
|
357
|
-
onFeedbackFailed:
|
|
358
|
-
onConversationProcessorError:
|
|
359
|
-
onPlayerStatusChange:
|
|
360
|
-
onStateUpdate:
|
|
361
|
-
onClose:
|
|
362
|
-
onError:
|
|
346
|
+
}, re.current = {
|
|
347
|
+
onReady: g,
|
|
348
|
+
onStarted: y,
|
|
349
|
+
onUserTranscript: b,
|
|
350
|
+
onUserSpeechStarted: x,
|
|
351
|
+
onUserSpeechEnded: S,
|
|
352
|
+
onCharacterSpeechStarted: C,
|
|
353
|
+
onCharacterSpeechEnded: w,
|
|
354
|
+
onCharacterFocusChanged: T,
|
|
355
|
+
onConversationUpdate: E,
|
|
356
|
+
onMessage: k,
|
|
357
|
+
onListeningState: A,
|
|
358
|
+
onActivityChange: j,
|
|
359
|
+
onFeedback: M,
|
|
360
|
+
onFeedbackFailed: P,
|
|
361
|
+
onConversationProcessorError: F,
|
|
362
|
+
onPlayerStatusChange: I,
|
|
363
|
+
onStateUpdate: te,
|
|
364
|
+
onClose: ne,
|
|
365
|
+
onError: L
|
|
363
366
|
};
|
|
364
|
-
let
|
|
365
|
-
|
|
367
|
+
let le = t((e) => {
|
|
368
|
+
se.current = e, ae(e !== null);
|
|
366
369
|
}, []);
|
|
367
370
|
return r(a, () => ({
|
|
368
371
|
ready: () => {
|
|
@@ -392,32 +395,33 @@ var te = e(function(e, a) {
|
|
|
392
395
|
focusCharacter: (e) => R.current.withSession((t) => t.focusCharacter(e)),
|
|
393
396
|
setFit: (e) => R.current.withSession((t) => t.setFit(e)),
|
|
394
397
|
conversion: (e) => R.current.withSession((t) => t.conversion(e)),
|
|
398
|
+
engage: () => R.current.withSession((e) => e.engage()),
|
|
395
399
|
end: () => R.current.withSession((e) => e.end())
|
|
396
400
|
}), []), i(() => {
|
|
397
|
-
if (!
|
|
398
|
-
let t =
|
|
401
|
+
if (!B || !se.current) return;
|
|
402
|
+
let t = se.current, n = R.current, r;
|
|
399
403
|
try {
|
|
400
404
|
r = { options: _(e) };
|
|
401
405
|
} catch (e) {
|
|
402
406
|
r = { error: O(e) };
|
|
403
407
|
}
|
|
404
|
-
let i = n.activateGeneration(t, r, c,
|
|
408
|
+
let i = n.activateGeneration(t, r, c, oe);
|
|
405
409
|
return z.current = i, () => {
|
|
406
410
|
n.cancelGeneration(i), z.current === i && (z.current = null);
|
|
407
411
|
};
|
|
408
412
|
}, [
|
|
409
|
-
|
|
410
|
-
|
|
413
|
+
B,
|
|
414
|
+
H,
|
|
411
415
|
c
|
|
412
416
|
]), n(() => {
|
|
413
417
|
let e = R.current.getActiveInstance();
|
|
414
418
|
e && e.setFit(l ?? "full");
|
|
415
419
|
}, [l]), n(() => {
|
|
416
|
-
let e =
|
|
417
|
-
if (!e || (e.replaceChildren(), !
|
|
418
|
-
let t = ee(e,
|
|
420
|
+
let e = ce.current;
|
|
421
|
+
if (!e || (e.replaceChildren(), !V)) return;
|
|
422
|
+
let t = ee(e, V);
|
|
419
423
|
return () => t.remove();
|
|
420
|
-
}, [
|
|
424
|
+
}, [V]), /* @__PURE__ */ f("div", {
|
|
421
425
|
className: "liforma-experience-shell",
|
|
422
426
|
style: {
|
|
423
427
|
position: "relative",
|
|
@@ -426,17 +430,17 @@ var te = e(function(e, a) {
|
|
|
426
430
|
minHeight: "inherit"
|
|
427
431
|
},
|
|
428
432
|
children: [/* @__PURE__ */ d("div", {
|
|
429
|
-
ref:
|
|
433
|
+
ref: ce,
|
|
430
434
|
className: "liforma-experience-error-host",
|
|
431
|
-
"aria-hidden":
|
|
435
|
+
"aria-hidden": V ? void 0 : !0,
|
|
432
436
|
style: {
|
|
433
437
|
position: "absolute",
|
|
434
438
|
inset: 0,
|
|
435
439
|
zIndex: 20,
|
|
436
|
-
pointerEvents:
|
|
440
|
+
pointerEvents: V ? "auto" : "none"
|
|
437
441
|
}
|
|
438
442
|
}), /* @__PURE__ */ d("div", {
|
|
439
|
-
ref:
|
|
443
|
+
ref: le,
|
|
440
444
|
className: "liforma-experience-host",
|
|
441
445
|
style: {
|
|
442
446
|
position: "absolute",
|
|
@@ -453,27 +457,27 @@ function ne(e) {
|
|
|
453
457
|
}
|
|
454
458
|
//#endregion
|
|
455
459
|
//#region src/thumbnail/toGalleryThumbUrl.ts
|
|
456
|
-
var L = /(\/avatars\/[^/]+\/)(\d+)(\/)/i, re = /_CH(\.webp)/i,
|
|
457
|
-
function
|
|
460
|
+
var L = /(\/avatars\/[^/]+\/)(\d+)(\/)/i, re = /_CH(\.webp)/i, ie = /(-)(\d+x\d+)(\.webp)(\?|$)/i;
|
|
461
|
+
function R(e) {
|
|
458
462
|
let t = e.trim();
|
|
459
463
|
if (!t) return t;
|
|
460
464
|
let n = t.replace(L, (e, t, n, r) => n === "256" ? `${t}${n}${r}` : `${t}256${r}`);
|
|
461
|
-
return n = n.replace(re, "_neutral$1"), n = n.replace(
|
|
465
|
+
return n = n.replace(re, "_neutral$1"), n = n.replace(ie, (e, t, n, r, i) => n === "256x256" ? `${t}${n}${r}${i}` : `${t}256x256${r}${i}`), n;
|
|
462
466
|
}
|
|
463
|
-
function
|
|
467
|
+
function z(e) {
|
|
464
468
|
let t = e.avatarImage?.trim() || e.galleryThumb?.avatarImage?.trim() || "";
|
|
465
469
|
if (!t) return null;
|
|
466
470
|
let n = e.backgroundImage?.trim() || e.galleryThumb?.backgroundImage?.trim() || "", r = e.foregroundImage?.trim() || e.galleryThumb?.foregroundImage?.trim() || "", i = e.fallbackImage?.trim() || "";
|
|
467
471
|
return {
|
|
468
|
-
avatarImage:
|
|
469
|
-
...n ? { backgroundImage:
|
|
470
|
-
...r ? { foregroundImage:
|
|
471
|
-
...i ? { fallbackImage:
|
|
472
|
+
avatarImage: R(t),
|
|
473
|
+
...n ? { backgroundImage: R(n) } : {},
|
|
474
|
+
...r ? { foregroundImage: R(r) } : {},
|
|
475
|
+
...i ? { fallbackImage: R(i) } : {}
|
|
472
476
|
};
|
|
473
477
|
}
|
|
474
478
|
//#endregion
|
|
475
479
|
//#region src/shims/localStack.ts
|
|
476
|
-
function
|
|
480
|
+
function B() {
|
|
477
481
|
if (globalThis.__LIFORMA_STACK === "local") return !0;
|
|
478
482
|
if (typeof location > "u") return !1;
|
|
479
483
|
try {
|
|
@@ -484,13 +488,13 @@ function ae() {
|
|
|
484
488
|
}
|
|
485
489
|
//#endregion
|
|
486
490
|
//#region src/thumbnail/hostedLaunchUrl.ts
|
|
487
|
-
var
|
|
491
|
+
var ae = "https://player.liforma.ai", V = "http://localhost:3002";
|
|
488
492
|
function oe(e) {
|
|
489
493
|
return e.href?.trim() ? "anchor" : e.hasClickHandler ? "button" : e.experienceId?.trim() ? "anchor" : "presentational";
|
|
490
494
|
}
|
|
491
495
|
function se(e) {
|
|
492
496
|
let t = e?.trim();
|
|
493
|
-
return t ? t.replace(/\/$/, "") :
|
|
497
|
+
return t ? t.replace(/\/$/, "") : B() ? V : ae;
|
|
494
498
|
}
|
|
495
499
|
function ce(e) {
|
|
496
500
|
let t = e.experienceId.trim(), n = se(e.playerBaseUrl), r = new URL(`${n}/${encodeURIComponent(t)}`), i = e.returnUrl?.trim();
|
|
@@ -671,7 +675,7 @@ function ke(e, t) {
|
|
|
671
675
|
return `${e} liforma-et__media${t ? " liforma-et__media--ready" : ""}`;
|
|
672
676
|
}
|
|
673
677
|
function Ae(e) {
|
|
674
|
-
let { galleryThumb: t, avatarImage: r, backgroundImage: i, foregroundImage: c, alt: l, experienceId: p, href: m, target: h, rel: g, onClick: _, returnUrl: v, playerBaseUrl: y, parallax: b = !0, fit: x = "full", lazy: S = !0, className: C = "", fallbackImage: w } = e, T = a(() =>
|
|
678
|
+
let { galleryThumb: t, avatarImage: r, backgroundImage: i, foregroundImage: c, alt: l, experienceId: p, href: m, target: h, rel: g, onClick: _, returnUrl: v, playerBaseUrl: y, parallax: b = !0, fit: x = "full", lazy: S = !0, className: C = "", fallbackImage: w } = e, T = a(() => z({
|
|
675
679
|
galleryThumb: t,
|
|
676
680
|
avatarImage: r,
|
|
677
681
|
backgroundImage: i,
|
|
@@ -687,7 +691,7 @@ function Ae(e) {
|
|
|
687
691
|
href: m,
|
|
688
692
|
hasClickHandler: typeof _ == "function",
|
|
689
693
|
experienceId: p
|
|
690
|
-
}), D = E === "anchor" && !m?.trim() && !!p?.trim(), O = !!T?.backgroundImage, k = b !== !1, A = o(null), j = o(!1), [M, N] = s(!S), [P, F] = s(!1), [I, ee] = s(!1), [te, L] = s(0), [re,
|
|
694
|
+
}), D = E === "anchor" && !m?.trim() && !!p?.trim(), O = !!T?.backgroundImage, k = b !== !1, A = o(null), j = o(!1), [M, N] = s(!S), [P, F] = s(!1), [I, ee] = s(!1), [te, L] = s(0), [re, ie] = s(0), [R, B] = s(!1), [ae, V] = s(!1), [se, ce] = s(!1), [le, U] = s(!1), [ue, de] = s(), W = T ? R && T.fallbackImage ? T.fallbackImage : T.avatarImage : "";
|
|
691
695
|
n(() => {
|
|
692
696
|
Oe(Ee);
|
|
693
697
|
}, []), n(() => {
|
|
@@ -705,7 +709,7 @@ function Ae(e) {
|
|
|
705
709
|
y,
|
|
706
710
|
D
|
|
707
711
|
]), n(() => {
|
|
708
|
-
V(!1), ce(!1), U(!1),
|
|
712
|
+
V(!1), ce(!1), U(!1), B(!1);
|
|
709
713
|
}, [
|
|
710
714
|
T?.backgroundImage,
|
|
711
715
|
T?.foregroundImage,
|
|
@@ -730,7 +734,7 @@ function Ae(e) {
|
|
|
730
734
|
let e = A.current;
|
|
731
735
|
if (!(!e || !k)) return we(e, {
|
|
732
736
|
onParallax: (e) => {
|
|
733
|
-
ee(!0), j.current || (L(e),
|
|
737
|
+
ee(!0), j.current || (L(e), ie(0));
|
|
734
738
|
},
|
|
735
739
|
pointerActive: () => j.current
|
|
736
740
|
});
|
|
@@ -743,10 +747,10 @@ function Ae(e) {
|
|
|
743
747
|
let fe = (e) => {
|
|
744
748
|
if (!k || I) return;
|
|
745
749
|
let t = e.currentTarget.getBoundingClientRect();
|
|
746
|
-
t.width <= 0 || t.height <= 0 || (L(((e.clientX - t.left) / t.width - .5) * 2),
|
|
750
|
+
t.width <= 0 || t.height <= 0 || (L(((e.clientX - t.left) / t.width - .5) * 2), ie(((e.clientY - t.top) / t.height - .5) * 2));
|
|
747
751
|
}, pe = (e) => {
|
|
748
752
|
let t = j.current;
|
|
749
|
-
j.current = !1, F(!1), I && t ? (L(ye(e.getBoundingClientRect(), window.innerHeight)),
|
|
753
|
+
j.current = !1, F(!1), I && t ? (L(ye(e.getBoundingClientRect(), window.innerHeight)), ie(0)) : I || (L(0), ie(0));
|
|
750
754
|
}, me = (e) => {
|
|
751
755
|
if (!k) return;
|
|
752
756
|
j.current = !0, e.pointerType === "mouse" && F(!0);
|
|
@@ -765,7 +769,7 @@ function Ae(e) {
|
|
|
765
769
|
}
|
|
766
770
|
};
|
|
767
771
|
if (!T) return null;
|
|
768
|
-
let ge = k && (P || I), ve = M && (se ||
|
|
772
|
+
let ge = k && (P || I), ve = M && (se || ae || le), G = [
|
|
769
773
|
"liforma-et",
|
|
770
774
|
O ? "liforma-et--scene" : "",
|
|
771
775
|
ne(x),
|
|
@@ -785,7 +789,7 @@ function Ae(e) {
|
|
|
785
789
|
"aria-hidden": "true"
|
|
786
790
|
}),
|
|
787
791
|
M && T.backgroundImage ? /* @__PURE__ */ d("img", {
|
|
788
|
-
className: ke("liforma-et__background",
|
|
792
|
+
className: ke("liforma-et__background", ae),
|
|
789
793
|
src: T.backgroundImage,
|
|
790
794
|
alt: "",
|
|
791
795
|
decoding: "async",
|
|
@@ -805,7 +809,7 @@ function Ae(e) {
|
|
|
805
809
|
},
|
|
806
810
|
onLoad: () => ce(!0),
|
|
807
811
|
onError: () => {
|
|
808
|
-
T.fallbackImage ?
|
|
812
|
+
T.fallbackImage ? B(!0) : ce(!0);
|
|
809
813
|
}
|
|
810
814
|
}) : null,
|
|
811
815
|
M && T.foregroundImage ? /* @__PURE__ */ d("img", {
|
|
@@ -828,7 +832,7 @@ function Ae(e) {
|
|
|
828
832
|
},
|
|
829
833
|
onPointerMove: fe,
|
|
830
834
|
onPointerLeave: () => {
|
|
831
|
-
j.current || (F(!1), I || (L(0),
|
|
835
|
+
j.current || (F(!1), I || (L(0), ie(0)));
|
|
832
836
|
}
|
|
833
837
|
}, q = (e) => {
|
|
834
838
|
A.current = e;
|
|
@@ -888,7 +892,7 @@ function Ie() {
|
|
|
888
892
|
return t ? t.replace(/\/$/, "") : null;
|
|
889
893
|
}
|
|
890
894
|
function Le() {
|
|
891
|
-
return Ie() || (
|
|
895
|
+
return Ie() || (B() ? Fe : Pe);
|
|
892
896
|
}
|
|
893
897
|
//#endregion
|
|
894
898
|
//#region src/v2/api/fetchExperiencePreview.ts
|
|
@@ -1332,7 +1336,7 @@ function xt(e) {
|
|
|
1332
1336
|
function St(e, t, n) {
|
|
1333
1337
|
let r = e.trim();
|
|
1334
1338
|
if (!r) throw Error("createLaunchMessage requires a non-empty launch string.");
|
|
1335
|
-
let i = n?.startButton, a = n?.showFeedback;
|
|
1339
|
+
let i = n?.startButton, a = n?.theme, o = n?.showFeedback;
|
|
1336
1340
|
return {
|
|
1337
1341
|
type: "launch",
|
|
1338
1342
|
schemaVersion: 2,
|
|
@@ -1340,7 +1344,8 @@ function St(e, t, n) {
|
|
|
1340
1344
|
launch: r,
|
|
1341
1345
|
...t === void 0 ? {} : { session: t },
|
|
1342
1346
|
...i ? { startButton: i } : {},
|
|
1343
|
-
...a
|
|
1347
|
+
...a ? { theme: a } : {},
|
|
1348
|
+
...o === void 0 ? {} : { showFeedback: o }
|
|
1344
1349
|
}
|
|
1345
1350
|
};
|
|
1346
1351
|
}
|
|
@@ -1783,6 +1788,13 @@ function Mt(e) {
|
|
|
1783
1788
|
}
|
|
1784
1789
|
});
|
|
1785
1790
|
},
|
|
1791
|
+
engage() {
|
|
1792
|
+
return C({
|
|
1793
|
+
type: "engage",
|
|
1794
|
+
schemaVersion: 2,
|
|
1795
|
+
payload: { correlationId: Z() }
|
|
1796
|
+
});
|
|
1797
|
+
},
|
|
1786
1798
|
destroy() {
|
|
1787
1799
|
if (!r) {
|
|
1788
1800
|
r = !0, i && s(!1);
|
|
@@ -1819,7 +1831,7 @@ function It() {
|
|
|
1819
1831
|
}
|
|
1820
1832
|
function Lt() {
|
|
1821
1833
|
let e = It();
|
|
1822
|
-
return e ? e.endsWith("/embed") ? e : `${e}/embed` :
|
|
1834
|
+
return e ? e.endsWith("/embed") ? e : `${e}/embed` : B() ? Ft : Pt;
|
|
1823
1835
|
}
|
|
1824
1836
|
function Rt(e, t) {
|
|
1825
1837
|
return e?.trim() || t?.trim() || void 0;
|
|
@@ -1856,6 +1868,7 @@ function Wt() {
|
|
|
1856
1868
|
return {
|
|
1857
1869
|
ready: /* @__PURE__ */ new Set(),
|
|
1858
1870
|
started: /* @__PURE__ */ new Set(),
|
|
1871
|
+
sessionMinted: /* @__PURE__ */ new Set(),
|
|
1859
1872
|
userTranscript: /* @__PURE__ */ new Set(),
|
|
1860
1873
|
userSpeechStarted: /* @__PURE__ */ new Set(),
|
|
1861
1874
|
userSpeechEnded: /* @__PURE__ */ new Set(),
|
|
@@ -2532,6 +2545,7 @@ var An = class e {
|
|
|
2532
2545
|
eventRegistry = Wt();
|
|
2533
2546
|
readyEnvelope = null;
|
|
2534
2547
|
startedEnvelope = null;
|
|
2548
|
+
sessionMintedEnvelope = null;
|
|
2535
2549
|
conversationCache = [];
|
|
2536
2550
|
speech;
|
|
2537
2551
|
constructor(e) {
|
|
@@ -2620,7 +2634,7 @@ var An = class e {
|
|
|
2620
2634
|
}
|
|
2621
2635
|
on(e, t) {
|
|
2622
2636
|
let n = Gt(this.eventRegistry, e, t);
|
|
2623
|
-
return e === "ready" && this.readyEnvelope && queueMicrotask(() => t(this.readyEnvelope)), e === "started" && this.startedEnvelope && queueMicrotask(() => t(this.startedEnvelope)), n;
|
|
2637
|
+
return e === "ready" && this.readyEnvelope && queueMicrotask(() => t(this.readyEnvelope)), e === "started" && this.startedEnvelope && queueMicrotask(() => t(this.startedEnvelope)), e === "sessionMinted" && this.sessionMintedEnvelope && queueMicrotask(() => t(this.sessionMintedEnvelope)), n;
|
|
2624
2638
|
}
|
|
2625
2639
|
async attach(e) {
|
|
2626
2640
|
if (this.closed) throw Error("Session has ended.");
|
|
@@ -2736,11 +2750,15 @@ var An = class e {
|
|
|
2736
2750
|
f.postParentHello();
|
|
2737
2751
|
let g = h?.launch ?? (this.bootstrap.kind === "launch" ? this.bootstrap.launch : null), _ = h?.session ?? (this.bootstrap.kind === "launch" ? this.bootstrap.session : void 0);
|
|
2738
2752
|
if (!g) throw f.destroy(), this.iframeHost === f && (this.iframeHost = null), Error("Session Launch response did not include a launch token.");
|
|
2739
|
-
|
|
2753
|
+
this.launchToken = g;
|
|
2754
|
+
let v = _ ?? (this.bootstrap.kind === "launch" ? this.bootstrap.session : void 0);
|
|
2755
|
+
return v && !this.sessionMintedEnvelope && (this.resolvedSession = v, this.sessionMintedEnvelope = this.emitWrapped("sessionMinted", { session: v })), _ ? (this.resolvedSession = _, this.bootstrap.kind === "launch" && tt(_), f.postLaunch(g, _, {
|
|
2740
2756
|
startButton: e.startButton,
|
|
2757
|
+
theme: e.theme,
|
|
2741
2758
|
showFeedback: e.showFeedback
|
|
2742
2759
|
}), u.setValue(_)) : f.postLaunch(g, void 0, {
|
|
2743
2760
|
startButton: e.startButton,
|
|
2761
|
+
theme: e.theme,
|
|
2744
2762
|
showFeedback: e.showFeedback
|
|
2745
2763
|
}), await Promise.race([s, new Promise((e, t) => {
|
|
2746
2764
|
setTimeout(() => t(/* @__PURE__ */ Error("Timed out waiting for player loading UI.")), 12e4);
|
|
@@ -2780,6 +2798,11 @@ var An = class e {
|
|
|
2780
2798
|
if (!this.iframeHost) throw Error("conversion() requires attach() first.");
|
|
2781
2799
|
await this.iframeHost.conversion(e);
|
|
2782
2800
|
}
|
|
2801
|
+
async engage() {
|
|
2802
|
+
if (this.closed) throw Error("Session has ended.");
|
|
2803
|
+
if (!this.iframeHost) throw Error("engage() requires attach() first.");
|
|
2804
|
+
await this.iframeHost.engage();
|
|
2805
|
+
}
|
|
2783
2806
|
getLastTurn() {
|
|
2784
2807
|
if (this.conversationCache.length === 0) return [];
|
|
2785
2808
|
let e = this.conversationCache[this.conversationCache.length - 1].turnId;
|
|
@@ -2917,7 +2940,7 @@ function $(e) {
|
|
|
2917
2940
|
var Gn = "<svg viewBox=\"0 0 24 24\" aria-hidden=\"true\" focusable=\"false\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"M10.325 4.317c.426-1.756 2.924-1.756 3.35 0a1.724 1.724 0 0 0 2.573 1.066c1.543-.94 3.31.826 2.37 2.37a1.724 1.724 0 0 0 1.065 2.572c1.756.426 1.756 2.924 0 3.35a1.724 1.724 0 0 0-1.066 2.573c.94 1.543-.826 3.31-2.37 2.37a1.724 1.724 0 0 0-2.572 1.065c-.426 1.756-2.924 1.756-3.35 0a1.724 1.724 0 0 0-2.573-1.066c-1.543.94-3.31-.826-2.37-2.37a1.724 1.724 0 0 0-1.065-2.572c-1.756-.426-1.756-2.924 0-3.35a1.724 1.724 0 0 0 1.066-2.573c-.94-1.543.826-3.31 2.37-2.37c1 .608 2.296.07 2.572-1.065\"/><path d=\"M9 12a3 3 0 1 0 6 0a3 3 0 0 0-6 0\"/></svg>", Kn = "<svg viewBox=\"0 0 24 24\" aria-hidden=\"true\" focusable=\"false\"><path fill=\"currentColor\" d=\"M18.3 5.71a1 1 0 0 0-1.41 0L12 10.59 7.11 5.7A1 1 0 0 0 5.7 7.11L10.59 12l-4.9 4.89a1 1 0 1 0 1.42 1.42L12 13.41l4.89 4.9a1 1 0 0 0 1.42-1.42L13.41 12l4.9-4.89a1 1 0 0 0-.01-1.4Z\"/></svg>", qn = "<svg viewBox=\"0 0 24 24\" aria-hidden=\"true\" focusable=\"false\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"M18 10h-4V6m6-2l-6 6m-8 4h4v4m0-4l-6 6\"/></svg>", Jn = "<svg viewBox=\"0 0 24 24\" aria-hidden=\"true\" focusable=\"false\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"M16 4h4v4m-6 2l6-6M8 20H4v-4m0 4l6-6\"/></svg>";
|
|
2918
2941
|
function Yn(e, t, n) {
|
|
2919
2942
|
Oe(Ee);
|
|
2920
|
-
let r =
|
|
2943
|
+
let r = z({
|
|
2921
2944
|
galleryThumb: t.galleryThumb,
|
|
2922
2945
|
avatarImage: t.avatarImage,
|
|
2923
2946
|
backgroundImage: t.backgroundImage,
|
|
@@ -3011,14 +3034,14 @@ function Qn(e, t) {
|
|
|
3011
3034
|
v.className = "liforma-ew__stage";
|
|
3012
3035
|
let y = document.createElement("div");
|
|
3013
3036
|
y.className = "liforma-ew__status", y.hidden = !0, f.append(v, y), u.append(d, f), a.append(o, l, u, p), e.replaceChildren(a);
|
|
3014
|
-
let b = null, x = !1, S = !1, C = !1, w = !1, T = !1, E = !1, D = !1, O = 0, k = "", A = null, j = null, M = null, N = null, P = null, F = null, I = null, ee = 0, te = 0, ne = null, L = !1, re = new AbortController(),
|
|
3037
|
+
let b = null, x = !1, S = !1, C = !1, w = !1, T = !1, E = !1, D = !1, O = 0, k = "", A = null, j = null, M = null, N = null, P = null, F = null, I = null, ee = 0, te = 0, ne = null, L = !1, re = new AbortController(), ie = t.parallax !== !1, R = () => {
|
|
3015
3038
|
let e = a.dataset.state;
|
|
3016
3039
|
return e === "expanded" || e === "docked" || e === "collapsed" ? e : "collapsed";
|
|
3017
|
-
},
|
|
3040
|
+
}, z = () => {
|
|
3018
3041
|
M !== null && (clearTimeout(M), M = null);
|
|
3019
|
-
}, ae = () => {
|
|
3020
|
-
N !== null && (clearTimeout(N), N = null), a.classList.remove("liforma-ew--layout-settling");
|
|
3021
3042
|
}, B = () => {
|
|
3043
|
+
N !== null && (clearTimeout(N), N = null), a.classList.remove("liforma-ew--layout-settling");
|
|
3044
|
+
}, ae = () => {
|
|
3022
3045
|
for (let e of [
|
|
3023
3046
|
f,
|
|
3024
3047
|
l,
|
|
@@ -3033,11 +3056,11 @@ function Qn(e, t) {
|
|
|
3033
3056
|
let a = p.offsetWidth || 120;
|
|
3034
3057
|
p.style.left = `${e + n - a - 10}px`, p.style.top = `${t + 10}px`, p.style.right = "auto", p.style.bottom = "auto", p.style.width = "auto", p.style.height = "auto";
|
|
3035
3058
|
}, oe = (e, t) => {
|
|
3036
|
-
if (
|
|
3059
|
+
if (R() !== "docked") return;
|
|
3037
3060
|
let n = zn(), r = Vn(e - ee, t - te, n);
|
|
3038
3061
|
P = r.left, F = r.top, V(r.left, r.top, n.width, n.height);
|
|
3039
3062
|
}, se = (e, t) => {
|
|
3040
|
-
if (
|
|
3063
|
+
if (R() !== "docked" || !Number.isFinite(e) || !Number.isFinite(t) || e === 0 && t === 0) return;
|
|
3041
3064
|
let n = zn(), r = P ?? f.getBoundingClientRect().left, i = F ?? f.getBoundingClientRect().top, a = Vn(r + e, i + t, n);
|
|
3042
3065
|
P = a.left, F = a.top, V(a.left, a.top, n.width, n.height);
|
|
3043
3066
|
}, ce = (e) => {
|
|
@@ -3047,12 +3070,12 @@ function Qn(e, t) {
|
|
|
3047
3070
|
let t = ne;
|
|
3048
3071
|
I = null, ne = null, p.classList.remove("liforma-ew__toolbar--dragging"), a.classList.remove("liforma-ew--dock-dragging"), t === "toolbar" && L && (L = !1, window.removeEventListener("pointermove", ce), window.removeEventListener("pointerup", H), window.removeEventListener("pointercancel", H));
|
|
3049
3072
|
}, le = (e, t, n) => {
|
|
3050
|
-
if (S ||
|
|
3073
|
+
if (S || R() !== "docked" || !Hn() || I !== null) return;
|
|
3051
3074
|
I = n, ne = "toolbar", p.classList.add("liforma-ew__toolbar--dragging"), a.classList.add("liforma-ew--dock-dragging");
|
|
3052
3075
|
let r = f.getBoundingClientRect();
|
|
3053
3076
|
ee = e - r.left, te = t - r.top, L || (L = !0, window.addEventListener("pointermove", ce), window.addEventListener("pointerup", H), window.addEventListener("pointercancel", H));
|
|
3054
3077
|
}, U = (e) => {
|
|
3055
|
-
if (S ||
|
|
3078
|
+
if (S || R() !== "docked" || !Hn() || I !== null) return;
|
|
3056
3079
|
I = e.pointerId, ne = "player", p.classList.add("liforma-ew__toolbar--dragging"), a.classList.add("liforma-ew--dock-dragging");
|
|
3057
3080
|
let t = f.getBoundingClientRect();
|
|
3058
3081
|
P = t.left, F = t.top;
|
|
@@ -3061,7 +3084,7 @@ function Qn(e, t) {
|
|
|
3061
3084
|
}, de = (e) => {
|
|
3062
3085
|
ne === "player" && (I === null || e.pointerId !== I || H());
|
|
3063
3086
|
}, W = () => {
|
|
3064
|
-
let e = Hn(), t =
|
|
3087
|
+
let e = Hn(), t = R();
|
|
3065
3088
|
if (!e || t !== "expanded" && t !== "docked") {
|
|
3066
3089
|
h.hidden = !0;
|
|
3067
3090
|
return;
|
|
@@ -3077,7 +3100,7 @@ function Qn(e, t) {
|
|
|
3077
3100
|
});
|
|
3078
3101
|
});
|
|
3079
3102
|
}, me = (e) => {
|
|
3080
|
-
if (
|
|
3103
|
+
if (B(), a.classList.remove("liforma-ew--session-revealed"), a.classList.add("liforma-ew--layout-settling"), e(), !D) {
|
|
3081
3104
|
a.classList.remove("liforma-ew--layout-settling");
|
|
3082
3105
|
return;
|
|
3083
3106
|
}
|
|
@@ -3089,7 +3112,7 @@ function Qn(e, t) {
|
|
|
3089
3112
|
a.classList.remove("liforma-ew--layout-settling"), pe();
|
|
3090
3113
|
}, 220);
|
|
3091
3114
|
}, he = () => (a.classList.add("liforma-ew--session-concealing"), a.classList.remove("liforma-ew--session-revealed"), new Promise((e) => {
|
|
3092
|
-
|
|
3115
|
+
z(), M = setTimeout(() => {
|
|
3093
3116
|
M = null, a.classList.remove("liforma-ew--session-concealing"), e();
|
|
3094
3117
|
}, 280);
|
|
3095
3118
|
})), ge = {
|
|
@@ -3116,7 +3139,7 @@ function Qn(e, t) {
|
|
|
3116
3139
|
w = !0, a.dataset.warm = "true", l.hidden = !1, D || (o.tabIndex = -1, o.setAttribute("aria-hidden", "true")), t.onPrefetchReady?.();
|
|
3117
3140
|
}, be = (e) => {
|
|
3118
3141
|
A?.(), A = null;
|
|
3119
|
-
let t = Yn(s, e, { parallax:
|
|
3142
|
+
let t = Yn(s, e, { parallax: ie });
|
|
3120
3143
|
return t ? (A = t, !0) : !1;
|
|
3121
3144
|
}, K = () => {
|
|
3122
3145
|
if (be(ge)) {
|
|
@@ -3148,7 +3171,7 @@ function Qn(e, t) {
|
|
|
3148
3171
|
startButton: Xn(t),
|
|
3149
3172
|
...t.showFeedback === void 0 ? {} : { showFeedback: t.showFeedback }
|
|
3150
3173
|
}), q = (e = !0) => {
|
|
3151
|
-
o.hidden = !0, u.hidden = !1, p.hidden = !1, u.setAttribute("aria-modal", "true"),
|
|
3174
|
+
o.hidden = !0, u.hidden = !1, p.hidden = !1, u.setAttribute("aria-modal", "true"), ae(), a.dataset.state = "expanded", _e(null), typeof document < "u" && (k = document.body.style.overflow, document.body.style.overflow = "hidden"), W(), e && t.onExpanded?.();
|
|
3152
3175
|
}, Ce = () => {
|
|
3153
3176
|
o.hidden = !0, u.hidden = !1, p.hidden = !1, u.setAttribute("aria-modal", "false"), a.dataset.state = "docked", _e(null), typeof document < "u" && (document.body.style.overflow = k), fe(!0), W(), b?.setWidgetChrome("docked");
|
|
3154
3177
|
}, we = (e) => {
|
|
@@ -3160,9 +3183,9 @@ function Qn(e, t) {
|
|
|
3160
3183
|
S || t.onFeedbackFailed?.(e);
|
|
3161
3184
|
});
|
|
3162
3185
|
}, Te = () => {
|
|
3163
|
-
|
|
3186
|
+
B(), u.hidden = !0, p.hidden = !0, ae(), a.dataset.state = "collapsed", a.classList.remove("liforma-ew--session-revealed"), a.classList.remove("liforma-ew--session-concealing"), g.setAttribute("aria-pressed", "false"), o.hidden = !1, o.tabIndex = 0, o.removeAttribute("aria-hidden"), C && (o.disabled = !1), _e(null), typeof document < "u" && (document.body.style.overflow = k), W();
|
|
3164
3187
|
}, Ee = () => {
|
|
3165
|
-
|
|
3188
|
+
z(), B(), O += 1, x = !1, w = !1, T = !1, E = !1, D = !1;
|
|
3166
3189
|
let e = b;
|
|
3167
3190
|
b = null, e?.destroy(), v.replaceChildren(), l.replaceChildren(), l.hidden = !0, delete a.dataset.warm, delete a.dataset.live, a.classList.remove("liforma-ew--session-revealed");
|
|
3168
3191
|
}, De = () => {
|
|
@@ -3177,19 +3200,19 @@ function Qn(e, t) {
|
|
|
3177
3200
|
Ee(), Te(), t.onCollapsed?.(), t.onClose?.();
|
|
3178
3201
|
}
|
|
3179
3202
|
}, Oe = () => {
|
|
3180
|
-
S || Hn() &&
|
|
3203
|
+
S || Hn() && R() === "expanded" && me(() => {
|
|
3181
3204
|
Ce();
|
|
3182
3205
|
});
|
|
3183
3206
|
}, ke = () => {
|
|
3184
|
-
S ||
|
|
3185
|
-
|
|
3207
|
+
S || R() === "docked" && (H(), me(() => {
|
|
3208
|
+
ae(), q(!1), b?.setWidgetChrome("expanded");
|
|
3186
3209
|
}));
|
|
3187
3210
|
}, Ae = () => {
|
|
3188
|
-
!b || !D || (
|
|
3211
|
+
!b || !D || (z(), a.classList.remove("liforma-ew--session-revealed"), q(), b.setWidgetChrome("expanded"), x = !1, pe());
|
|
3189
3212
|
}, Me = () => {
|
|
3190
|
-
!b || !E || D || (
|
|
3213
|
+
!b || !E || D || (z(), a.classList.remove("liforma-ew--session-revealed"), q(), x = !1, w || b.setWidgetChrome("expanded"));
|
|
3191
3214
|
}, Pe = (e) => {
|
|
3192
|
-
S || e !== O && !D || (
|
|
3215
|
+
S || e !== O && !D || (z(), a.classList.remove("liforma-ew--session-revealed"), q(), x = !1, D && pe());
|
|
3193
3216
|
}, Fe = () => {
|
|
3194
3217
|
if (S || T || w || b || $(a.dataset.state)) return;
|
|
3195
3218
|
T = !0;
|
|
@@ -3312,22 +3335,22 @@ function Qn(e, t) {
|
|
|
3312
3335
|
Ie();
|
|
3313
3336
|
}
|
|
3314
3337
|
}, Re = (e) => {
|
|
3315
|
-
if (e.stopPropagation(),
|
|
3338
|
+
if (e.stopPropagation(), R() === "expanded") {
|
|
3316
3339
|
Oe();
|
|
3317
3340
|
return;
|
|
3318
3341
|
}
|
|
3319
|
-
|
|
3342
|
+
R() === "docked" && ke();
|
|
3320
3343
|
}, J = (e) => {
|
|
3321
3344
|
g.setAttribute("aria-pressed", e ? "true" : "false");
|
|
3322
3345
|
}, Be = (e) => {
|
|
3323
3346
|
e.stopPropagation(), $(a.dataset.state) && b?.toggleAudioSettings();
|
|
3324
3347
|
}, Ve = (e) => {
|
|
3325
|
-
|
|
3348
|
+
R() === "docked" && Hn() && (e.target?.closest("button") || (e.preventDefault(), le(e.clientX, e.clientY, e.pointerId)));
|
|
3326
3349
|
}, He = (e) => {
|
|
3327
3350
|
e.key === "Escape" && $(a.dataset.state) && (e.preventDefault(), De());
|
|
3328
3351
|
}, Ue = () => {
|
|
3329
3352
|
if (!S) {
|
|
3330
|
-
if (
|
|
3353
|
+
if (R() === "docked") {
|
|
3331
3354
|
if (!Hn()) {
|
|
3332
3355
|
ke();
|
|
3333
3356
|
return;
|
|
@@ -3341,7 +3364,7 @@ function Qn(e, t) {
|
|
|
3341
3364
|
}
|
|
3342
3365
|
}, Y = typeof window < "u" ? window.matchMedia(Mn) : null, We = () => {
|
|
3343
3366
|
if (!S) {
|
|
3344
|
-
if (
|
|
3367
|
+
if (R() === "docked" && !Hn()) {
|
|
3345
3368
|
ke();
|
|
3346
3369
|
return;
|
|
3347
3370
|
}
|