@rqmii_immersive/agent-react-sdk 5.3.0 → 5.3.1
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/embed.js +36 -36
- package/dist/embed.js.map +1 -1
- package/dist/ui/chat/panels.d.ts +0 -1
- package/dist/ui/chat/panels.d.ts.map +1 -1
- package/dist/ui.cjs +3 -3
- package/dist/ui.cjs.map +1 -1
- package/dist/ui.js +99 -99
- package/dist/ui.js.map +1 -1
- package/package.json +1 -1
package/dist/ui.js
CHANGED
|
@@ -2757,7 +2757,7 @@ function He(e) {
|
|
|
2757
2757
|
function F(e, a) {
|
|
2758
2758
|
return Ye[e]?.[a] || Ye.en[a] || a;
|
|
2759
2759
|
}
|
|
2760
|
-
function
|
|
2760
|
+
function pe(e, a = "en") {
|
|
2761
2761
|
const t = Array.isArray(e) ? e.filter((i) => Qe.includes(i)) : [];
|
|
2762
2762
|
return !t.includes(a) && Qe.includes(a) && t.unshift(a), t.length ? [...new Set(t)] : ["ar-sa"];
|
|
2763
2763
|
}
|
|
@@ -2780,13 +2780,13 @@ const We = {
|
|
|
2780
2780
|
behavior: { post_chat_rating_enabled: !1, welcome_bubble_enabled: !1, welcome_bubble_delay_seconds: 3, welcome_bubble_sound_enabled: !1, typing_indicator_enabled: !0 }
|
|
2781
2781
|
}
|
|
2782
2782
|
};
|
|
2783
|
-
function
|
|
2783
|
+
function ge(e) {
|
|
2784
2784
|
if (!e) return We;
|
|
2785
|
-
const a = e, t = a.agent_type || a.agentType || oe.TEXT, i = typeof a.use_text == "boolean" ? a.use_text : typeof a.useText == "boolean" ? a.useText : t !== oe.VOICE, r = typeof a.use_voice == "boolean" ? a.use_voice : typeof a.useVoice == "boolean" ? a.useVoice : t === oe.TEXT_AND_VOICE || t === oe.CLOUD_AVATAR || t === oe.DESKTOP_AVATAR, o = a.conversation || a.agent_customization?.conversation || {}, s = a.speech || a.agent_customization?.speech || {}, c = o.default_language || "en", d =
|
|
2785
|
+
const a = e, t = a.agent_type || a.agentType || oe.TEXT, i = typeof a.use_text == "boolean" ? a.use_text : typeof a.useText == "boolean" ? a.useText : t !== oe.VOICE, r = typeof a.use_voice == "boolean" ? a.use_voice : typeof a.useVoice == "boolean" ? a.useVoice : t === oe.TEXT_AND_VOICE || t === oe.CLOUD_AVATAR || t === oe.DESKTOP_AVATAR, o = a.conversation || a.agent_customization?.conversation || {}, s = a.speech || a.agent_customization?.speech || {}, c = o.default_language || "en", d = pe(o.languages, c), l = a.widget || a.agent_customization?.widget || null, m = l?.appearance, u = l?.behavior, h = l, z = typeof m?.hide_branding == "boolean" ? !m.hide_branding : typeof m?.show_branding == "boolean" ? m.show_branding : !0, k = h ? {
|
|
2786
2786
|
appearance: {
|
|
2787
2787
|
brand_color: m?.brand_color,
|
|
2788
2788
|
position: m?.position || "right",
|
|
2789
|
-
show_branding:
|
|
2789
|
+
show_branding: z,
|
|
2790
2790
|
footer_content: m?.footer_content || {}
|
|
2791
2791
|
},
|
|
2792
2792
|
behavior: {
|
|
@@ -2796,8 +2796,8 @@ function pe(e) {
|
|
|
2796
2796
|
welcome_bubble_sound_enabled: typeof u?.welcome_bubble_sound_enabled == "boolean" ? u.welcome_bubble_sound_enabled : !1,
|
|
2797
2797
|
typing_indicator_enabled: typeof u?.typing_indicator_enabled == "boolean" ? u.typing_indicator_enabled : !0
|
|
2798
2798
|
}
|
|
2799
|
-
} : void 0, v = a.consent || a.consent_config || null,
|
|
2800
|
-
Object.entries(
|
|
2799
|
+
} : void 0, v = a.consent || a.consent_config || null, E = o.welcome_message || o.welcomeMessage || a.welcome_message || a.welcomeMessage || {}, T = Object.fromEntries(
|
|
2800
|
+
Object.entries(E).filter(([, p]) => typeof p == "string").map(([p, x]) => [p, x.slice(0, 1e3)])
|
|
2801
2801
|
), g = typeof a.allow_interrupt == "boolean" ? a.allow_interrupt : typeof s.allow_interrupt == "boolean" ? s.allow_interrupt : !0, b = typeof a.allow_welcome_message_interrupt == "boolean" ? a.allow_welcome_message_interrupt : typeof s.allow_welcome_message_interrupt == "boolean" ? s.allow_welcome_message_interrupt : !1;
|
|
2802
2802
|
return {
|
|
2803
2803
|
id: a.id || null,
|
|
@@ -2854,7 +2854,7 @@ async function Ct({
|
|
|
2854
2854
|
throw new Error(s);
|
|
2855
2855
|
}
|
|
2856
2856
|
const o = await r.json();
|
|
2857
|
-
return
|
|
2857
|
+
return ge({
|
|
2858
2858
|
id: o.id,
|
|
2859
2859
|
name: o.name,
|
|
2860
2860
|
company_name: o.company_name,
|
|
@@ -2892,7 +2892,7 @@ async function ei({ restUrl: e, apiKey: a, agentId: t, signal: i }) {
|
|
|
2892
2892
|
}
|
|
2893
2893
|
throw new Error(s);
|
|
2894
2894
|
}
|
|
2895
|
-
return
|
|
2895
|
+
return ge(await o.json());
|
|
2896
2896
|
}
|
|
2897
2897
|
function wt(e, a) {
|
|
2898
2898
|
if (!a) return e;
|
|
@@ -2971,7 +2971,7 @@ const Vt = (e) => {
|
|
|
2971
2971
|
strokeWidth: m = 2,
|
|
2972
2972
|
absoluteStrokeWidth: u = !1,
|
|
2973
2973
|
color: h = "currentColor",
|
|
2974
|
-
className:
|
|
2974
|
+
className: z = ""
|
|
2975
2975
|
} = It() ?? {}, k = i ?? u ? Number(t ?? m) * 24 / Number(a ?? l) : t ?? m;
|
|
2976
2976
|
return Me(
|
|
2977
2977
|
"svg",
|
|
@@ -2982,12 +2982,12 @@ const Vt = (e) => {
|
|
|
2982
2982
|
height: a ?? l ?? Pe.height,
|
|
2983
2983
|
stroke: e ?? h,
|
|
2984
2984
|
strokeWidth: k,
|
|
2985
|
-
className: oa("lucide",
|
|
2985
|
+
className: oa("lucide", z, r),
|
|
2986
2986
|
...!o && !Vt(c) && { "aria-hidden": "true" },
|
|
2987
2987
|
...c
|
|
2988
2988
|
},
|
|
2989
2989
|
[
|
|
2990
|
-
...s.map(([v,
|
|
2990
|
+
...s.map(([v, E]) => Me(v, E)),
|
|
2991
2991
|
...Array.isArray(o) ? o : [o]
|
|
2992
2992
|
]
|
|
2993
2993
|
);
|
|
@@ -3250,7 +3250,7 @@ function un(e) {
|
|
|
3250
3250
|
return e?.faceIndex === 0 && e.faceImageUrl ? e.faceImageUrl : e?.faceIndex === 9 ? null : nn(e?.faceIndex || 1);
|
|
3251
3251
|
}
|
|
3252
3252
|
const Ne = D.memo(function({ language: a, languages: t, onChange: i }) {
|
|
3253
|
-
const [r, o] = y(!1), s = _(null), c = He(a), d =
|
|
3253
|
+
const [r, o] = y(!1), s = _(null), c = He(a), d = pe(t, a).map((l) => He(l)).filter(Boolean);
|
|
3254
3254
|
return I(() => {
|
|
3255
3255
|
if (!r) return;
|
|
3256
3256
|
const l = (m) => {
|
|
@@ -3366,7 +3366,7 @@ const hn = D.memo(function({ message: a, delaySeconds: t, soundEnabled: i, langu
|
|
|
3366
3366
|
}), gn = D.memo(function({ text: a, streaming: t }) {
|
|
3367
3367
|
const i = cn(a, t);
|
|
3368
3368
|
return /* @__PURE__ */ n(Ae, { children: i });
|
|
3369
|
-
}), we = 133, pn = we + 44, bn = 767,
|
|
3369
|
+
}), we = 133, pn = we + 44, bn = 767, he = 36, kn = 8, Xe = he + kn;
|
|
3370
3370
|
function fn() {
|
|
3371
3371
|
return typeof window > "u" ? we : window.innerWidth <= bn ? pn : we;
|
|
3372
3372
|
}
|
|
@@ -3386,7 +3386,7 @@ function ea(e, a, t, i) {
|
|
|
3386
3386
|
}
|
|
3387
3387
|
}
|
|
3388
3388
|
const Fn = D.memo(function({ suggestions: a, language: t, onClick: i }) {
|
|
3389
|
-
const [r, o] = y(!1), [s, c] = y(!1), [d, l] = y(null), [m, u] = y(null), h = _(null),
|
|
3389
|
+
const [r, o] = y(!1), [s, c] = y(!1), [d, l] = y(null), [m, u] = y(null), h = _(null), z = _([]), k = se(t || "en"), v = vn(k), E = (T) => {
|
|
3390
3390
|
T.forEach((g) => {
|
|
3391
3391
|
g && (g.style.maxWidth = "", g.style.marginRight = "", g.style.marginLeft = "");
|
|
3392
3392
|
});
|
|
@@ -3395,8 +3395,8 @@ const Fn = D.memo(function({ suggestions: a, language: t, onClick: i }) {
|
|
|
3395
3395
|
const T = h.current;
|
|
3396
3396
|
if (!T || r) return;
|
|
3397
3397
|
const g = () => {
|
|
3398
|
-
const p =
|
|
3399
|
-
|
|
3398
|
+
const p = z.current;
|
|
3399
|
+
E(p);
|
|
3400
3400
|
const x = T.clientWidth, S = fn(), M = () => {
|
|
3401
3401
|
for (let L = 0; L < p.length; L++) {
|
|
3402
3402
|
const A = p[L];
|
|
@@ -3408,7 +3408,7 @@ const Fn = D.memo(function({ suggestions: a, language: t, onClick: i }) {
|
|
|
3408
3408
|
let P = M();
|
|
3409
3409
|
if (P !== null)
|
|
3410
3410
|
for (let L = 0; L <= p.length; L++) {
|
|
3411
|
-
|
|
3411
|
+
E(p);
|
|
3412
3412
|
const A = p.slice(0, P).filter((j) => !!j);
|
|
3413
3413
|
ea(A, x, v, Xe);
|
|
3414
3414
|
const C = M();
|
|
@@ -3416,24 +3416,24 @@ const Fn = D.memo(function({ suggestions: a, language: t, onClick: i }) {
|
|
|
3416
3416
|
P = C;
|
|
3417
3417
|
}
|
|
3418
3418
|
if (l(P), c(P !== null), P !== null) {
|
|
3419
|
-
const L = p.slice(0, P).filter((C) => !!C), A = L.length ? Math.max(...L.map((C) => C.offsetTop + C.offsetHeight)) :
|
|
3420
|
-
u(A -
|
|
3419
|
+
const L = p.slice(0, P).filter((C) => !!C), A = L.length ? Math.max(...L.map((C) => C.offsetTop + C.offsetHeight)) : he;
|
|
3420
|
+
u(A - he);
|
|
3421
3421
|
} else
|
|
3422
3422
|
u(null);
|
|
3423
3423
|
};
|
|
3424
3424
|
g();
|
|
3425
3425
|
const b = typeof ResizeObserver < "u" ? new ResizeObserver(g) : null;
|
|
3426
3426
|
return b?.observe(T), () => {
|
|
3427
|
-
b?.disconnect(), z
|
|
3427
|
+
b?.disconnect(), E(z.current);
|
|
3428
3428
|
};
|
|
3429
3429
|
}, [a, r, v]), Oe(() => {
|
|
3430
3430
|
const T = h.current;
|
|
3431
3431
|
if (!T || !r) return;
|
|
3432
|
-
const g =
|
|
3433
|
-
z
|
|
3434
|
-
const b = g.length ? Math.max(...g.map((p) => p.offsetTop + p.offsetHeight)) :
|
|
3435
|
-
return u(b -
|
|
3436
|
-
z
|
|
3432
|
+
const g = z.current.filter((p) => !!p);
|
|
3433
|
+
E(z.current), ea(g, T.clientWidth, v, Xe);
|
|
3434
|
+
const b = g.length ? Math.max(...g.map((p) => p.offsetTop + p.offsetHeight)) : he;
|
|
3435
|
+
return u(b - he), () => {
|
|
3436
|
+
E(z.current);
|
|
3437
3437
|
};
|
|
3438
3438
|
}, [r, a, v]), a.length ? /* @__PURE__ */ n("div", { className: V("rqmii-suggested-messages", r && "is-expanded", s && "has-overflow"), dir: k, children: /* @__PURE__ */ f("div", { ref: h, className: V("rqmii-suggested-messages-inner", r ? "is-expanded" : "is-collapsed"), children: [
|
|
3439
3439
|
a.map((T, g) => {
|
|
@@ -3442,7 +3442,7 @@ const Fn = D.memo(function({ suggestions: a, language: t, onClick: i }) {
|
|
|
3442
3442
|
"button",
|
|
3443
3443
|
{
|
|
3444
3444
|
ref: (p) => {
|
|
3445
|
-
|
|
3445
|
+
z.current[g] = p;
|
|
3446
3446
|
},
|
|
3447
3447
|
type: "button",
|
|
3448
3448
|
className: "rqmii-suggested-message",
|
|
@@ -3485,11 +3485,11 @@ const zn = {
|
|
|
3485
3485
|
phone: "leadFormPhone",
|
|
3486
3486
|
message: "leadFormMessage"
|
|
3487
3487
|
}, Sn = D.memo(function({ messageId: a, form: t, language: i, textDirection: r, formSubmitted: o }) {
|
|
3488
|
-
const s = ka(), [c, d] = y({}), [l, m] = y(!1), [u, h] = y(!!o), [
|
|
3488
|
+
const s = ka(), [c, d] = y({}), [l, m] = y(!1), [u, h] = y(!!o), [z, k] = y(null), v = t.title || F(i, "leadFormTitle"), E = (b) => {
|
|
3489
3489
|
const p = zn[b.key];
|
|
3490
3490
|
return `${p ? F(i, p) : b.label}${b.required ? "*" : ""}`;
|
|
3491
3491
|
}, T = (b, p) => {
|
|
3492
|
-
d((x) => ({ ...x, [b]: p })),
|
|
3492
|
+
d((x) => ({ ...x, [b]: p })), z && k(null);
|
|
3493
3493
|
}, g = async (b) => {
|
|
3494
3494
|
if (b.preventDefault(), l || u) return;
|
|
3495
3495
|
if (t.fields.some((S) => S.required && !c[S.key]?.trim())) {
|
|
@@ -3517,7 +3517,7 @@ const zn = {
|
|
|
3517
3517
|
return u ? /* @__PURE__ */ n("div", { className: "rqmii-chat-message-row rqmii-chat-lead-form-row", children: /* @__PURE__ */ n("div", { className: "rqmii-chat-lead-form rqmii-chat-lead-form--done", dir: r, children: /* @__PURE__ */ n("div", { className: "rqmii-chat-lead-form-success", children: F(i, "leadFormSuccess") }) }) }) : /* @__PURE__ */ n("div", { className: "rqmii-chat-message-row rqmii-chat-lead-form-row", children: /* @__PURE__ */ f("form", { className: "rqmii-chat-lead-form", dir: r, onSubmit: g, children: [
|
|
3518
3518
|
/* @__PURE__ */ n("div", { className: "rqmii-chat-lead-form-title", children: v }),
|
|
3519
3519
|
t.fields.map((b) => {
|
|
3520
|
-
const p =
|
|
3520
|
+
const p = E(b), x = b.type === "email" ? "email" : b.type === "date" ? "date" : "text";
|
|
3521
3521
|
return En(b.key) ? /* @__PURE__ */ n(
|
|
3522
3522
|
"textarea",
|
|
3523
3523
|
{
|
|
@@ -3542,7 +3542,7 @@ const zn = {
|
|
|
3542
3542
|
b.key
|
|
3543
3543
|
);
|
|
3544
3544
|
}),
|
|
3545
|
-
|
|
3545
|
+
z && /* @__PURE__ */ n("div", { className: "rqmii-chat-lead-form-error", children: z }),
|
|
3546
3546
|
/* @__PURE__ */ n("button", { type: "submit", className: "rqmii-chat-lead-form-submit", disabled: l, children: l ? F(i, "loading") : F(i, "submit") })
|
|
3547
3547
|
] }) });
|
|
3548
3548
|
}), xn = D.memo(function({ message: a, textDirection: t, language: i }) {
|
|
@@ -3663,16 +3663,16 @@ function Cn({
|
|
|
3663
3663
|
] });
|
|
3664
3664
|
}
|
|
3665
3665
|
const wn = D.lazy(() => import("./RqmiiCloudAvatarPlayer-Bi44g7bl.js").then((e) => e.e).then((e) => ({ default: e.RqmiiCloudAvatarPlayer })));
|
|
3666
|
-
function
|
|
3666
|
+
function be(e) {
|
|
3667
3667
|
if (!(e == null || typeof window > "u" || window.innerWidth >= 768))
|
|
3668
3668
|
return {
|
|
3669
3669
|
top: `${window.innerHeight - e}px`,
|
|
3670
3670
|
bottom: 0
|
|
3671
3671
|
};
|
|
3672
3672
|
}
|
|
3673
|
-
const Ln = D.memo(function({ agent: a, language: t, languages: i, onLanguageChange: r, onClose: o, onSend: s, isVoiceEnabled: c = !1, isAudioPlaying: d = !1, isVoiceSetupLoading: l = !1, onStartVoice: m, visualViewportHeight: u, disabled: h = !1, error:
|
|
3674
|
-
const T =
|
|
3675
|
-
return /* @__PURE__ */ f("div", { className: V("rqmii-chat-panel rqmii-chat-panel--start",
|
|
3673
|
+
const Ln = D.memo(function({ agent: a, language: t, languages: i, onLanguageChange: r, onClose: o, onSend: s, isVoiceEnabled: c = !1, isAudioPlaying: d = !1, isVoiceSetupLoading: l = !1, onStartVoice: m, visualViewportHeight: u, disabled: h = !1, error: z, suggestions: k, onSuggestionClick: v, compact: E = !1 }) {
|
|
3674
|
+
const T = be(u), g = E ? "start" : "hero", b = k && k.length > 0;
|
|
3675
|
+
return /* @__PURE__ */ f("div", { className: V("rqmii-chat-panel rqmii-chat-panel--start", E && "rqmii-chat-panel--start-compact", H(t)), style: T, children: [
|
|
3676
3676
|
/* @__PURE__ */ f("div", { className: "rqmii-chat-topbar", children: [
|
|
3677
3677
|
/* @__PURE__ */ n("span", {}),
|
|
3678
3678
|
/* @__PURE__ */ f("div", { className: "rqmii-chat-topbar-actions", children: [
|
|
@@ -3681,19 +3681,19 @@ const Ln = D.memo(function({ agent: a, language: t, languages: i, onLanguageChan
|
|
|
3681
3681
|
] })
|
|
3682
3682
|
] }),
|
|
3683
3683
|
/* @__PURE__ */ f("div", { className: "rqmii-chat-start-body", children: [
|
|
3684
|
-
c ? /* @__PURE__ */ f("div", { className: V("rqmii-chat-call-avatar-wrap",
|
|
3684
|
+
c ? /* @__PURE__ */ f("div", { className: V("rqmii-chat-call-avatar-wrap", E && "is-compact"), children: [
|
|
3685
3685
|
/* @__PURE__ */ n(J, { agent: a, size: g, active: d }),
|
|
3686
|
-
/* @__PURE__ */ n("button", { type: "button", className: V("rqmii-chat-call-button",
|
|
3686
|
+
/* @__PURE__ */ n("button", { type: "button", className: V("rqmii-chat-call-button", E && "is-compact"), onClick: m, disabled: l, "aria-label": F(t, "startVoice"), children: l ? /* @__PURE__ */ n(ye, { className: "rqmii-chat-spin", size: E ? 18 : 24 }) : /* @__PURE__ */ n(Ie, { size: E ? 18 : 24 }) })
|
|
3687
3687
|
] }) : /* @__PURE__ */ n(J, { agent: a, size: g }),
|
|
3688
3688
|
/* @__PURE__ */ n("div", { className: "rqmii-chat-agent-name", children: a.name }),
|
|
3689
|
-
|
|
3689
|
+
z && /* @__PURE__ */ n("div", { className: "rqmii-chat-error-text", children: z })
|
|
3690
3690
|
] }),
|
|
3691
3691
|
b && /* @__PURE__ */ n("div", { className: "rqmii-chat-start-suggestions", children: /* @__PURE__ */ n(Fn, { suggestions: k, language: t, onClick: (p) => v?.(p) }) }),
|
|
3692
3692
|
/* @__PURE__ */ n(Ee, { language: t, onSend: s, disabled: h }),
|
|
3693
3693
|
/* @__PURE__ */ n(le, { language: t, agent: a })
|
|
3694
3694
|
] });
|
|
3695
3695
|
}), An = D.memo(function({ agent: a, language: t, languages: i, onLanguageChange: r, onClose: o, onStartVoice: s, isVoiceSetupLoading: c = !1, isAudioPlaying: d, visualViewportHeight: l }) {
|
|
3696
|
-
const m =
|
|
3696
|
+
const m = be(l);
|
|
3697
3697
|
return /* @__PURE__ */ f("div", { className: V("rqmii-chat-panel rqmii-chat-panel--voice-start", H(t)), style: m, children: [
|
|
3698
3698
|
/* @__PURE__ */ f("div", { className: "rqmii-chat-topbar", children: [
|
|
3699
3699
|
/* @__PURE__ */ n("span", {}),
|
|
@@ -3715,8 +3715,8 @@ const Ln = D.memo(function({ agent: a, language: t, languages: i, onLanguageChan
|
|
|
3715
3715
|
] }),
|
|
3716
3716
|
/* @__PURE__ */ n(le, { language: t, agent: a })
|
|
3717
3717
|
] });
|
|
3718
|
-
}), Vn = D.memo(function({ agent: a, language: t, onEndSession: i, onMinimize: r, messages: o, partialTranscript: s, onSend: c, isAudioPlaying: d, isVoiceEnabled: l, onToggleVoice: m, isListening: u, isSpeaking: h, isLoading:
|
|
3719
|
-
const p = da({ language: t, isListening: u, isLoading:
|
|
3718
|
+
}), Vn = D.memo(function({ agent: a, language: t, onEndSession: i, onMinimize: r, messages: o, partialTranscript: s, onSend: c, isAudioPlaying: d, isVoiceEnabled: l, onToggleVoice: m, isListening: u, isSpeaking: h, isLoading: z, isAgentThinking: k, isAgentSpeaking: v, onStartVoice: E, elapsed: T, visualViewportHeight: g, waitingForResponse: b }) {
|
|
3719
|
+
const p = da({ language: t, isListening: u, isLoading: z, isSpeaking: h, isAudioPlaying: d, isAgentThinking: k, isAgentSpeaking: v, persistentListening: !1 }), x = be(g);
|
|
3720
3720
|
return /* @__PURE__ */ f("div", { className: V("rqmii-chat-panel rqmii-chat-panel--conversation", H(t)), style: x, children: [
|
|
3721
3721
|
/* @__PURE__ */ f("div", { className: "rqmii-chat-header", children: [
|
|
3722
3722
|
/* @__PURE__ */ n(J, { agent: a, size: "header", active: d }),
|
|
@@ -3733,8 +3733,8 @@ const Ln = D.memo(function({ agent: a, language: t, languages: i, onLanguageChan
|
|
|
3733
3733
|
/* @__PURE__ */ n(Ee, { language: t, onSend: c }),
|
|
3734
3734
|
/* @__PURE__ */ n(le, { language: t, agent: a })
|
|
3735
3735
|
] });
|
|
3736
|
-
}), jn = D.memo(function({ agent: a, language: t, onEndSession: i, onMinimize: r, isListening: o, isLoading: s, isSpeaking: c, isAudioPlaying: d, isAgentThinking: l, isAgentSpeaking: m, onToggleVoice: u, elapsed: h, visualViewportHeight:
|
|
3737
|
-
const k = da({ language: t, isListening: o, isLoading: s, isSpeaking: c, isAudioPlaying: d, isAgentThinking: l, isAgentSpeaking: m, persistentListening: !0 }), v =
|
|
3736
|
+
}), jn = D.memo(function({ agent: a, language: t, onEndSession: i, onMinimize: r, isListening: o, isLoading: s, isSpeaking: c, isAudioPlaying: d, isAgentThinking: l, isAgentSpeaking: m, onToggleVoice: u, elapsed: h, visualViewportHeight: z }) {
|
|
3737
|
+
const k = da({ language: t, isListening: o, isLoading: s, isSpeaking: c, isAudioPlaying: d, isAgentThinking: l, isAgentSpeaking: m, persistentListening: !0 }), v = be(z);
|
|
3738
3738
|
return /* @__PURE__ */ f("div", { className: V("rqmii-chat-panel rqmii-chat-panel--voice-call", H(t)), style: v, children: [
|
|
3739
3739
|
/* @__PURE__ */ f("div", { className: "rqmii-chat-call-status", children: [
|
|
3740
3740
|
/* @__PURE__ */ n("span", { className: V("rqmii-chat-live-dot", o && "is-live") }),
|
|
@@ -3756,14 +3756,14 @@ const Ln = D.memo(function({ agent: a, language: t, languages: i, onLanguageChan
|
|
|
3756
3756
|
function da({ language: e, isListening: a, isLoading: t, isSpeaking: i, isAudioPlaying: r, isAgentThinking: o, isAgentSpeaking: s, persistentListening: c = !1 }) {
|
|
3757
3757
|
return t ? F(e, "loading") : i ? F(e, "listening") : r || s ? F(e, "talkToInterrupt") : o ? F(e, "processing") : a && c ? F(e, "listening") : null;
|
|
3758
3758
|
}
|
|
3759
|
-
const In = D.memo(function({ agent: a, language: t, onRestore: i, onClose: r, isListening: o, isAudioPlaying: s, isSpeaking: c, onToggleVoice: d, elapsed: l,
|
|
3760
|
-
const
|
|
3761
|
-
return /* @__PURE__ */ f("div", { className: V("rqmii-chat-minimized", H(t)),
|
|
3759
|
+
const In = D.memo(function({ agent: a, language: t, onRestore: i, onClose: r, isListening: o, isAudioPlaying: s, isSpeaking: c, onToggleVoice: d, elapsed: l, variant: m = "voice" }) {
|
|
3760
|
+
const u = m === "text";
|
|
3761
|
+
return /* @__PURE__ */ f("div", { className: V("rqmii-chat-minimized", H(t)), children: [
|
|
3762
3762
|
/* @__PURE__ */ n(J, { agent: a, size: "minimized", active: s }),
|
|
3763
|
-
!
|
|
3763
|
+
!u && /* @__PURE__ */ n("span", { className: "rqmii-chat-minimized-time", children: qe(l) }),
|
|
3764
3764
|
/* @__PURE__ */ f("div", { className: "rqmii-chat-minimized-actions", children: [
|
|
3765
3765
|
/* @__PURE__ */ n("button", { type: "button", className: "rqmii-chat-circle-button", onClick: i, "aria-label": F(t, "maximize"), children: /* @__PURE__ */ n(Yt, { size: 20 }) }),
|
|
3766
|
-
!
|
|
3766
|
+
!u && /* @__PURE__ */ n("button", { type: "button", className: V("rqmii-chat-circle-button", c && "is-active"), onClick: d, "aria-label": o ? F(t, "stopVoice") : F(t, "startVoice"), children: o ? /* @__PURE__ */ n(Fe, { size: 20 }) : /* @__PURE__ */ n(Ve, { size: 20 }) }),
|
|
3767
3767
|
/* @__PURE__ */ n("button", { type: "button", className: "rqmii-chat-circle-button is-danger", onClick: r, "aria-label": F(t, "endCall"), children: /* @__PURE__ */ n(je, { size: 20 }) })
|
|
3768
3768
|
] })
|
|
3769
3769
|
] });
|
|
@@ -3780,22 +3780,22 @@ const In = D.memo(function({ agent: a, language: t, onRestore: i, onClose: r, is
|
|
|
3780
3780
|
isVoiceSetupLoading: m = !1,
|
|
3781
3781
|
visualViewportHeight: u,
|
|
3782
3782
|
rating: h,
|
|
3783
|
-
endedBy:
|
|
3783
|
+
endedBy: z,
|
|
3784
3784
|
sessionId: k,
|
|
3785
3785
|
ratingInteractive: v,
|
|
3786
|
-
showTellUsMore:
|
|
3786
|
+
showTellUsMore: E,
|
|
3787
3787
|
onRate: T,
|
|
3788
3788
|
onTellUsMore: g
|
|
3789
3789
|
}) {
|
|
3790
|
-
const b =
|
|
3790
|
+
const b = be(u), p = k && a.widget?.behavior?.post_chat_rating_enabled ? /* @__PURE__ */ n(
|
|
3791
3791
|
Mn,
|
|
3792
3792
|
{
|
|
3793
3793
|
language: t,
|
|
3794
3794
|
rating: h,
|
|
3795
|
-
endedBy:
|
|
3795
|
+
endedBy: z,
|
|
3796
3796
|
sessionId: k,
|
|
3797
3797
|
interactive: v,
|
|
3798
|
-
showTellUsMore:
|
|
3798
|
+
showTellUsMore: E,
|
|
3799
3799
|
onRate: T,
|
|
3800
3800
|
onTellUsMore: g
|
|
3801
3801
|
}
|
|
@@ -3928,11 +3928,11 @@ const Re = D.memo(function({
|
|
|
3928
3928
|
chatKind: m,
|
|
3929
3929
|
sdk: u,
|
|
3930
3930
|
renderPanel: h,
|
|
3931
|
-
messagesRef:
|
|
3931
|
+
messagesRef: z,
|
|
3932
3932
|
initialText: k,
|
|
3933
3933
|
autoStartVoice: v
|
|
3934
3934
|
}) {
|
|
3935
|
-
const [
|
|
3935
|
+
const [E, T] = y(!1), g = m || ve(a), [b, p] = y(() => g === "voice" && u.isSessionReady || g === "voice" && !!v), [x, S] = y(() => (g === "text" || g === "text_and_voice") && u.isSessionReady || !!k || g === "text_and_voice" && !!v), [M, P] = y(!1), [L, A] = y(!1), [C, j] = y(null), W = sn(g === "voice" && b || g === "text_and_voice" && x), q = ln(), B = a.consent?.enabled && !E && !l, N = _n(g), { events: U } = ue();
|
|
3936
3936
|
I(() => {
|
|
3937
3937
|
if (!U) return;
|
|
3938
3938
|
const K = () => {
|
|
@@ -3956,7 +3956,7 @@ const Re = D.memo(function({
|
|
|
3956
3956
|
u.sendTextMessage(K);
|
|
3957
3957
|
}, [d, u]);
|
|
3958
3958
|
I(() => {
|
|
3959
|
-
|
|
3959
|
+
z && (z.current = u.messages);
|
|
3960
3960
|
});
|
|
3961
3961
|
const ee = _(!1);
|
|
3962
3962
|
I(() => {
|
|
@@ -3994,11 +3994,11 @@ const Re = D.memo(function({
|
|
|
3994
3994
|
return h ? /* @__PURE__ */ n(Ae, { children: h(R) }) : /* @__PURE__ */ n(Rn, { ...R, connecting: L, connectError: C, visualViewportHeight: q, onCloseWidget: s ?? o, initiateVoice: $, onSendSuggestion: (K) => {
|
|
3995
3995
|
j(null), A(!0), u.sendSuggestion?.(K);
|
|
3996
3996
|
} });
|
|
3997
|
-
}), Rn = D.memo(function({ agent: a, language: t, languages: i, chatKind: r, sdk: o, onLanguageChange: s, onClose: c, onMinimize: d, onRestore: l, onSend: m, voiceStarted: u, conversationStarted: h, isMinimized:
|
|
3997
|
+
}), Rn = D.memo(function({ agent: a, language: t, languages: i, chatKind: r, sdk: o, onLanguageChange: s, onClose: c, onMinimize: d, onRestore: l, onSend: m, voiceStarted: u, conversationStarted: h, isMinimized: z, elapsed: k, setVoiceStarted: v, setConversationStarted: E, visualViewportHeight: T, connecting: g = !1, connectError: b = null, onCloseWidget: p, initiateVoice: x, onSendSuggestion: S }) {
|
|
3998
3998
|
const M = a.widget?.behavior?.typing_indicator_enabled ?? !0, P = r === "text" ? o.waitingForResponse && M : !1, L = o.messages;
|
|
3999
3999
|
if (r === "avatar") return /* @__PURE__ */ n(ua, { agent: a, language: t, onClose: c });
|
|
4000
|
-
if (
|
|
4001
|
-
return /* @__PURE__ */ n(In, { agent: a, language: t, onRestore: l, onClose: c, isListening: o.isVoiceActive, isAudioPlaying: o.isAudioPlaying, isSpeaking: o.vad.isSpeaking, onToggleVoice: o.toggleVoice, elapsed: k,
|
|
4000
|
+
if (z)
|
|
4001
|
+
return /* @__PURE__ */ n(In, { agent: a, language: t, onRestore: l, onClose: c, isListening: o.isVoiceActive, isAudioPlaying: o.isAudioPlaying, isSpeaking: o.vad.isSpeaking, onToggleVoice: o.toggleVoice, elapsed: k, variant: r === "text" ? "text" : "voice" });
|
|
4002
4002
|
if (r === "voice" && u)
|
|
4003
4003
|
return /* @__PURE__ */ n(jn, { agent: a, language: t, onEndSession: c, onMinimize: d, isListening: o.isVoiceActive, isLoading: o.vad.isLoading, isSpeaking: o.vad.isSpeaking, isAudioPlaying: o.isAudioPlaying, isAgentThinking: o.isAgentThinking, isAgentSpeaking: o.isAgentSpeaking, onToggleVoice: o.toggleVoice, elapsed: k, visualViewportHeight: T });
|
|
4004
4004
|
if (r === "voice")
|
|
@@ -4035,7 +4035,7 @@ function Be({ isSessionReady: e, signalClientReady: a }) {
|
|
|
4035
4035
|
}
|
|
4036
4036
|
const Gn = 300;
|
|
4037
4037
|
function Un(e) {
|
|
4038
|
-
const { isPreview: a = !1, ...t } = e, { messages: i, sendTextMessage: r, emitUserMessage: o, addLocalMessage: s, clearMessages: c } = de(), { changeSessionLanguage: d, clearSessionHistory: l, signalClientReady: m, error: u, isSessionReady: h, isAgentThinking:
|
|
4038
|
+
const { isPreview: a = !1, ...t } = e, { messages: i, sendTextMessage: r, emitUserMessage: o, addLocalMessage: s, clearMessages: c } = de(), { changeSessionLanguage: d, clearSessionHistory: l, signalClientReady: m, error: u, isSessionReady: h, isAgentThinking: z, isAgentSpeaking: k } = ue(), v = _(!1), E = _(null), T = _(!1), [g, b] = y(!1), [p, x] = y(null), [S, M] = y(!1), P = _(i.length);
|
|
4039
4039
|
I(() => {
|
|
4040
4040
|
if (i.length > P.current) {
|
|
4041
4041
|
const q = i[i.length - 1];
|
|
@@ -4046,9 +4046,9 @@ function Un(e) {
|
|
|
4046
4046
|
M(!1);
|
|
4047
4047
|
}, [])), I(() => {
|
|
4048
4048
|
if (!h || !g || T.current) return;
|
|
4049
|
-
const q =
|
|
4049
|
+
const q = E.current;
|
|
4050
4050
|
if (q === null) return;
|
|
4051
|
-
T.current = !0,
|
|
4051
|
+
T.current = !0, E.current = null, s("user", q), x(null);
|
|
4052
4052
|
const B = e.agent.welcomeMessages?.[e.language];
|
|
4053
4053
|
m(B ? { welcomeMessage: B } : void 0);
|
|
4054
4054
|
const N = setTimeout(() => {
|
|
@@ -4072,7 +4072,7 @@ function Un(e) {
|
|
|
4072
4072
|
isVoiceActive: !1,
|
|
4073
4073
|
chatKind: "text"
|
|
4074
4074
|
}, j = (q, B) => {
|
|
4075
|
-
e.onSessionStart?.(), v.current ? (M(!0), B.sendMessage(q)) : (v.current = !0, x(q),
|
|
4075
|
+
e.onSessionStart?.(), v.current ? (M(!0), B.sendMessage(q)) : (v.current = !0, x(q), E.current = q, b(!0), M(!0));
|
|
4076
4076
|
}, G = (q) => {
|
|
4077
4077
|
e.onTextSend ? e.onTextSend(q, C) : j(q, C);
|
|
4078
4078
|
};
|
|
@@ -4091,7 +4091,7 @@ function Un(e) {
|
|
|
4091
4091
|
partialTranscript: null,
|
|
4092
4092
|
changeSessionLanguage: d,
|
|
4093
4093
|
error: u,
|
|
4094
|
-
isAgentThinking:
|
|
4094
|
+
isAgentThinking: z,
|
|
4095
4095
|
isAgentSpeaking: k,
|
|
4096
4096
|
isVoiceSetupLoading: !1,
|
|
4097
4097
|
isVoiceActive: !1,
|
|
@@ -4108,7 +4108,7 @@ function Un(e) {
|
|
|
4108
4108
|
);
|
|
4109
4109
|
}
|
|
4110
4110
|
function Kn(e) {
|
|
4111
|
-
const { isPreview: a = !1, ...t } = e, { messages: i, sendTextMessage: r, clearMessages: o } = de(), { isAudioPlaying: s, partialTranscript: c } = ta(), { changeSessionLanguage: d, clearSessionHistory: l, signalClientReady: m, error: u, isSessionReady: h, isAgentThinking:
|
|
4111
|
+
const { isPreview: a = !1, ...t } = e, { messages: i, sendTextMessage: r, clearMessages: o } = de(), { isAudioPlaying: s, partialTranscript: c } = ta(), { changeSessionLanguage: d, clearSessionHistory: l, signalClientReady: m, error: u, isSessionReady: h, isAgentThinking: z, isAgentSpeaking: k } = ue(), { setPendingWelcomeText: v, setPendingMessage: E } = ma({ isSessionReady: h, sendTextMessage: r, messages: i }), { emitClientReady: T } = Be({ isSessionReady: h, signalClientReady: m }), [g, b] = y(!1), p = na({
|
|
4112
4112
|
enabled: !0,
|
|
4113
4113
|
preloadStream: !1
|
|
4114
4114
|
}), { isLoading: x, isListening: S, toggle: M } = p, P = x, L = S || g;
|
|
@@ -4120,7 +4120,7 @@ function Kn(e) {
|
|
|
4120
4120
|
}, C = {
|
|
4121
4121
|
emitClientReady: T,
|
|
4122
4122
|
sendMessage: (N) => {
|
|
4123
|
-
h ? r(N) :
|
|
4123
|
+
h ? r(N) : E(N);
|
|
4124
4124
|
},
|
|
4125
4125
|
queueForWelcome: (N) => v(N),
|
|
4126
4126
|
enableVoice: () => b(!0),
|
|
@@ -4155,7 +4155,7 @@ function Kn(e) {
|
|
|
4155
4155
|
partialTranscript: c,
|
|
4156
4156
|
changeSessionLanguage: d,
|
|
4157
4157
|
error: u,
|
|
4158
|
-
isAgentThinking:
|
|
4158
|
+
isAgentThinking: z,
|
|
4159
4159
|
isAgentSpeaking: k,
|
|
4160
4160
|
isVoiceSetupLoading: P,
|
|
4161
4161
|
isVoiceActive: L,
|
|
@@ -4176,7 +4176,7 @@ function Kn(e) {
|
|
|
4176
4176
|
}
|
|
4177
4177
|
const On = 300;
|
|
4178
4178
|
function Yn(e) {
|
|
4179
|
-
const { isPreview: a = !1, ...t } = e, { messages: i, sendTextMessage: r, emitUserMessage: o, addLocalMessage: s, clearMessages: c } = de(), { isAudioPlaying: d, partialTranscript: l } = ta(), { changeSessionLanguage: m, clearSessionHistory: u, signalClientReady: h, error:
|
|
4179
|
+
const { isPreview: a = !1, ...t } = e, { messages: i, sendTextMessage: r, emitUserMessage: o, addLocalMessage: s, clearMessages: c } = de(), { isAudioPlaying: d, partialTranscript: l } = ta(), { changeSessionLanguage: m, clearSessionHistory: u, signalClientReady: h, error: z, isSessionReady: k, isAgentThinking: v, isAgentSpeaking: E } = ue(), { emitClientReady: T } = Be({ isSessionReady: k, signalClientReady: h }), [g, b] = y(!1), p = _(null), [x, S] = y(!1), M = _(null), [P, L] = y(!1), A = _(!1), C = _(!1), j = _(!1), [G, W] = y(null), [q, B] = y(!1), N = _(i.length);
|
|
4180
4180
|
I(() => {
|
|
4181
4181
|
if (i.length > N.current) {
|
|
4182
4182
|
const w = i[i.length - 1];
|
|
@@ -4248,9 +4248,9 @@ function Yn(e) {
|
|
|
4248
4248
|
isAudioPlaying: d,
|
|
4249
4249
|
partialTranscript: l,
|
|
4250
4250
|
changeSessionLanguage: m,
|
|
4251
|
-
error:
|
|
4251
|
+
error: z,
|
|
4252
4252
|
isAgentThinking: v,
|
|
4253
|
-
isAgentSpeaking:
|
|
4253
|
+
isAgentSpeaking: E,
|
|
4254
4254
|
isVoiceSetupLoading: ne,
|
|
4255
4255
|
isVoiceActive: ee,
|
|
4256
4256
|
isSessionReady: k,
|
|
@@ -4280,11 +4280,11 @@ function Yn(e) {
|
|
|
4280
4280
|
);
|
|
4281
4281
|
}
|
|
4282
4282
|
function Qn(e) {
|
|
4283
|
-
const { isPreview: a = !1, agent: t, language: i, languages: r, onLanguageChange: o, onEndSession: s, onMinimize: c, messages: d, onSendMessage: l } = e, m = s || c || ie, { messages: u, sendTextMessage: h, clearMessages:
|
|
4284
|
-
return ma({ isSessionReady: g, sendTextMessage: h, messages: u }), Be({ isSessionReady: g, signalClientReady:
|
|
4283
|
+
const { isPreview: a = !1, agent: t, language: i, languages: r, onLanguageChange: o, onEndSession: s, onMinimize: c, messages: d, onSendMessage: l } = e, m = s || c || ie, { messages: u, sendTextMessage: h, clearMessages: z } = de(), { changeSessionLanguage: k, clearSessionHistory: v, signalClientReady: E, error: T, isSessionReady: g, isAgentThinking: b, isAgentSpeaking: p } = ue();
|
|
4284
|
+
return ma({ isSessionReady: g, sendTextMessage: h, messages: u }), Be({ isSessionReady: g, signalClientReady: E }), T && !a ? /* @__PURE__ */ n(la, { message: T, language: i, onClose: m }) : /* @__PURE__ */ n(ua, { agent: t, language: i, onClose: m });
|
|
4285
4285
|
}
|
|
4286
4286
|
function ai({ agent: e, defaultOpen: a = !1, className: t = "", preview: i = !1, ChatBoxComponent: r }) {
|
|
4287
|
-
const [o, s] = D.useState(a), [c, d] = D.useState(e.defaultLanguage), l = te(() =>
|
|
4287
|
+
const [o, s] = D.useState(a), [c, d] = D.useState(e.defaultLanguage), l = te(() => pe(e.languages, e.defaultLanguage), [e.defaultLanguage, e.languages]);
|
|
4288
4288
|
return D.useEffect(() => {
|
|
4289
4289
|
d(e.defaultLanguage);
|
|
4290
4290
|
}, [e.defaultLanguage]), /* @__PURE__ */ f("div", { className: V("rqmii-chat-surface", i && "is-preview", t), children: [
|
|
@@ -4293,9 +4293,9 @@ function ai({ agent: e, defaultOpen: a = !1, className: t = "", preview: i = !1,
|
|
|
4293
4293
|
] });
|
|
4294
4294
|
}
|
|
4295
4295
|
function Hn({ restUrl: e, identifier: a, fallbackAgent: t, withCredentials: i = !1, children: r, onError: o }) {
|
|
4296
|
-
const [s, c] = y(() => t ?
|
|
4296
|
+
const [s, c] = y(() => t ? ge(t) : null), [d, l] = y(null);
|
|
4297
4297
|
return I(() => {
|
|
4298
|
-
t && (c(
|
|
4298
|
+
t && (c(ge(t)), l(null));
|
|
4299
4299
|
}, [t]), I(() => {
|
|
4300
4300
|
if (!a || t) return;
|
|
4301
4301
|
const m = new AbortController();
|
|
@@ -4304,18 +4304,18 @@ function Hn({ restUrl: e, identifier: a, fallbackAgent: t, withCredentials: i =
|
|
|
4304
4304
|
}), () => m.abort();
|
|
4305
4305
|
}, [t, a, o, e, i]), d ? /* @__PURE__ */ n("div", { className: "rqmii-chat-panel rqmii-chat-panel--error", children: d.message || "Could not load agent" }) : s ? /* @__PURE__ */ n(Ae, { children: r(s) }) : /* @__PURE__ */ n("div", { className: "rqmii-chat-panel rqmii-chat-panel--error", children: "Loading" });
|
|
4306
4306
|
}
|
|
4307
|
-
function Le({ agent: e, language: a, languages: t, onLanguageChange: i, onEndSession: r, onMinimize: o, onStartText: s, onStartVoice: c, textOnly: d, messages: l, onSendMessage: m, isPreview: u, onSessionStart: h, initialText:
|
|
4308
|
-
const v = ve(e),
|
|
4307
|
+
function Le({ agent: e, language: a, languages: t, onLanguageChange: i, onEndSession: r, onMinimize: o, onStartText: s, onStartVoice: c, textOnly: d, messages: l, onSendMessage: m, isPreview: u, onSessionStart: h, initialText: z, autoStartVoice: k }) {
|
|
4308
|
+
const v = ve(e), E = { agent: e, language: a, languages: t, onLanguageChange: i, onEndSession: r, onMinimize: o, messages: l, onSendMessage: m, isPreview: u, onSessionStart: h, initialText: z, autoStartVoice: k };
|
|
4309
4309
|
switch (v) {
|
|
4310
4310
|
case "avatar":
|
|
4311
|
-
return /* @__PURE__ */ n(Qn, { ...
|
|
4311
|
+
return /* @__PURE__ */ n(Qn, { ...E });
|
|
4312
4312
|
case "voice":
|
|
4313
|
-
return /* @__PURE__ */ n(Kn, { ...
|
|
4313
|
+
return /* @__PURE__ */ n(Kn, { ...E });
|
|
4314
4314
|
case "text_and_voice":
|
|
4315
|
-
return /* @__PURE__ */ n(Yn, { ...
|
|
4315
|
+
return /* @__PURE__ */ n(Yn, { ...E, onStartText: s, onStartVoice: c, textOnly: d });
|
|
4316
4316
|
case "text":
|
|
4317
4317
|
default:
|
|
4318
|
-
return /* @__PURE__ */ n(Un, { ...
|
|
4318
|
+
return /* @__PURE__ */ n(Un, { ...E });
|
|
4319
4319
|
}
|
|
4320
4320
|
}
|
|
4321
4321
|
function Wn({
|
|
@@ -4333,18 +4333,18 @@ function Wn({
|
|
|
4333
4333
|
onStartText: u,
|
|
4334
4334
|
onStartVoice: h
|
|
4335
4335
|
}) {
|
|
4336
|
-
const { connectionState:
|
|
4336
|
+
const { connectionState: z, isConnected: k, isSessionTerminated: v, creditExhausted: E, session: T, endSession: g, submitFeedback: b, interrupt: p } = ue(), { messages: x } = de(), S = _(!1), M = _(null), [P, L] = y(null), [A, C] = y(0), [j, G] = y(!1), [W, q] = y(!1), [B, N] = y(!1);
|
|
4337
4337
|
I(() => {
|
|
4338
4338
|
k && (S.current = !0);
|
|
4339
4339
|
}, [k]), I(() => {
|
|
4340
4340
|
if (P) return;
|
|
4341
4341
|
let R = null;
|
|
4342
|
-
v ||
|
|
4342
|
+
v || z === "ended" ? R = M.current === "user" ? "user_ended" : "terminated" : z === "failed" ? E ? R = "credits_exhausted" : S.current ? R = "connection_lost" : R = "failed" : E && (R = "credits_exhausted"), R && L({
|
|
4343
4343
|
sessionId: T.sessionId,
|
|
4344
4344
|
endedBy: M.current ?? "agent",
|
|
4345
4345
|
reason: R
|
|
4346
4346
|
});
|
|
4347
|
-
}, [v,
|
|
4347
|
+
}, [v, z, E, T.sessionId, P]);
|
|
4348
4348
|
const U = () => {
|
|
4349
4349
|
M.current = "user", p(), g();
|
|
4350
4350
|
}, O = P?.sessionId ?? null, Q = (R) => {
|
|
@@ -4359,7 +4359,7 @@ function Wn({
|
|
|
4359
4359
|
G(!0), q(!1);
|
|
4360
4360
|
};
|
|
4361
4361
|
if (!o)
|
|
4362
|
-
return /* @__PURE__ */ n(sa, { agent: e, onClick: s, active:
|
|
4362
|
+
return /* @__PURE__ */ n(sa, { agent: e, onClick: s, active: z === "connected" });
|
|
4363
4363
|
const ne = ve(e), ee = e.agentType === "cloud_avatar" || e.agentType === "desktop_avatar", $ = i === "text";
|
|
4364
4364
|
return ee ? /* @__PURE__ */ n(
|
|
4365
4365
|
Le,
|
|
@@ -4423,7 +4423,7 @@ function Wn({
|
|
|
4423
4423
|
}
|
|
4424
4424
|
);
|
|
4425
4425
|
}
|
|
4426
|
-
function ti({ wsUrl: e, restUrl: a, apiKey: t, agentId: i, agent: r, language: o, defaultOpen: s = !1, open: c, className: d = "", pcmOptions: l, debug: m = !1, withCredentials: u = !1, onError: h, onInitialized:
|
|
4426
|
+
function ti({ wsUrl: e, restUrl: a, apiKey: t, agentId: i, agent: r, language: o, defaultOpen: s = !1, open: c, className: d = "", pcmOptions: l, debug: m = !1, withCredentials: u = !1, onError: h, onInitialized: z, config: k, promptOverrides: v, clientTools: E, onMinimize: T, onOpen: g }) {
|
|
4427
4427
|
if ([!!t, !!i].filter(Boolean).length > 1)
|
|
4428
4428
|
throw new Error("RqmiiAgentChat: only one of apiKey, or agentId may be provided");
|
|
4429
4429
|
return /* @__PURE__ */ n(Hn, { restUrl: a, identifier: t || i, fallbackAgent: r, withCredentials: u, onError: h, children: (x) => /* @__PURE__ */ n(
|
|
@@ -4442,17 +4442,17 @@ function ti({ wsUrl: e, restUrl: a, apiKey: t, agentId: i, agent: r, language: o
|
|
|
4442
4442
|
debug: m,
|
|
4443
4443
|
withCredentials: u,
|
|
4444
4444
|
onError: h,
|
|
4445
|
-
onInitialized:
|
|
4445
|
+
onInitialized: z,
|
|
4446
4446
|
config: k,
|
|
4447
4447
|
promptOverrides: v,
|
|
4448
|
-
clientTools:
|
|
4448
|
+
clientTools: E,
|
|
4449
4449
|
onMinimize: T,
|
|
4450
4450
|
onOpen: g
|
|
4451
4451
|
}
|
|
4452
4452
|
) });
|
|
4453
4453
|
}
|
|
4454
|
-
function $n({ wsUrl: e, restUrl: a, apiKey: t, agentId: i, agent: r, language: o, defaultOpen: s, open: c, className: d, pcmOptions: l, debug: m, withCredentials: u, onError: h, onInitialized:
|
|
4455
|
-
const [b, p] = y(s), x = c !== void 0 ? c : b, [S, M] = y(!1), [P, L] = y(o || r.defaultLanguage), [A, C] = y("idle"), [j, G] = y(0), [W, q] = y(null), [B, N] = y(!1), U = r.agentType === "cloud_avatar" || r.agentType === "desktop_avatar", O = U, Q = r.widget?.behavior, X = r.welcomeMessages?.[P] || "", ne = !x && !B && !O && !!Q?.welcome_bubble_enabled && !!X.trim(), ee = te(() =>
|
|
4454
|
+
function $n({ wsUrl: e, restUrl: a, apiKey: t, agentId: i, agent: r, language: o, defaultOpen: s, open: c, className: d, pcmOptions: l, debug: m, withCredentials: u, onError: h, onInitialized: z, config: k, promptOverrides: v, clientTools: E, onMinimize: T, onOpen: g }) {
|
|
4455
|
+
const [b, p] = y(s), x = c !== void 0 ? c : b, [S, M] = y(!1), [P, L] = y(o || r.defaultLanguage), [A, C] = y("idle"), [j, G] = y(0), [W, q] = y(null), [B, N] = y(!1), U = r.agentType === "cloud_avatar" || r.agentType === "desktop_avatar", O = U, Q = r.widget?.behavior, X = r.welcomeMessages?.[P] || "", ne = !x && !B && !O && !!Q?.welcome_bubble_enabled && !!X.trim(), ee = te(() => pe(r.languages, r.defaultLanguage), [r.defaultLanguage, r.languages]), $ = te(() => A === "text" ? { ...k ?? {}, use_voice: !1, use_text: !0 } : k, [k, A]), R = te(
|
|
4456
4456
|
() => wt(r, $),
|
|
4457
4457
|
[r, $]
|
|
4458
4458
|
), K = !O && R.useVoice, Z = U ? x : S, ke = te(() => ({
|
|
@@ -4467,9 +4467,9 @@ function $n({ wsUrl: e, restUrl: a, apiKey: t, agentId: i, agent: r, language: o
|
|
|
4467
4467
|
I(() => {
|
|
4468
4468
|
L(o || r.defaultLanguage);
|
|
4469
4469
|
}, [r.defaultLanguage, o]);
|
|
4470
|
-
const Se = te(() => h ? (
|
|
4471
|
-
C("idle"), h(
|
|
4472
|
-
} : (
|
|
4470
|
+
const Se = te(() => h ? (me) => {
|
|
4471
|
+
C("idle"), h(me);
|
|
4472
|
+
} : (me) => {
|
|
4473
4473
|
C("idle");
|
|
4474
4474
|
}, [h]), w = () => {
|
|
4475
4475
|
C("text"), M(!0);
|
|
@@ -4479,8 +4479,8 @@ function $n({ wsUrl: e, restUrl: a, apiKey: t, agentId: i, agent: r, language: o
|
|
|
4479
4479
|
c === void 0 && p(!1), T?.();
|
|
4480
4480
|
}, ha = () => {
|
|
4481
4481
|
c === void 0 && p(!0), N(!0), g?.();
|
|
4482
|
-
}, ga = (
|
|
4483
|
-
q(
|
|
4482
|
+
}, ga = (me, pa) => {
|
|
4483
|
+
q(me === "text" ? { mode: "text", text: pa ?? "" } : { mode: "voice" }), C(me), M(!0), G((ba) => ba + 1);
|
|
4484
4484
|
};
|
|
4485
4485
|
return /* @__PURE__ */ n(
|
|
4486
4486
|
va,
|
|
@@ -4494,8 +4494,8 @@ function $n({ wsUrl: e, restUrl: a, apiKey: t, agentId: i, agent: r, language: o
|
|
|
4494
4494
|
debug: m,
|
|
4495
4495
|
withCredentials: u,
|
|
4496
4496
|
onError: Se,
|
|
4497
|
-
onInitialized:
|
|
4498
|
-
clientTools:
|
|
4497
|
+
onInitialized: z,
|
|
4498
|
+
clientTools: E,
|
|
4499
4499
|
children: /* @__PURE__ */ f("div", { className: V("rqmii-chat-surface", r.widget?.appearance?.position === "left" && "rqmii-position-left", d), dir: "ltr", children: [
|
|
4500
4500
|
ne && /* @__PURE__ */ n(
|
|
4501
4501
|
hn,
|
|
@@ -4532,7 +4532,7 @@ function $n({ wsUrl: e, restUrl: a, apiKey: t, agentId: i, agent: r, language: o
|
|
|
4532
4532
|
);
|
|
4533
4533
|
}
|
|
4534
4534
|
function ni({ agent: e, language: a, open: t = !0, className: i = "", messages: r, onSendMessage: o, onClose: s }) {
|
|
4535
|
-
const c = te(() =>
|
|
4535
|
+
const c = te(() => ge(e), [e]), [d, l] = y(t), [m, u] = y(a || c.defaultLanguage), h = te(() => pe(c.languages, c.defaultLanguage), [c.defaultLanguage, c.languages]);
|
|
4536
4536
|
return I(() => {
|
|
4537
4537
|
a && u(a);
|
|
4538
4538
|
}, [a]), I(() => {
|
|
@@ -4582,8 +4582,8 @@ export {
|
|
|
4582
4582
|
nn as getBuiltinFace,
|
|
4583
4583
|
He as getChatLanguage,
|
|
4584
4584
|
F as getChatText,
|
|
4585
|
-
|
|
4586
|
-
|
|
4585
|
+
pe as normalizeChatLanguages,
|
|
4586
|
+
ge as normalizePublicAgent,
|
|
4587
4587
|
ve as resolveChatKind
|
|
4588
4588
|
};
|
|
4589
4589
|
//# sourceMappingURL=ui.js.map
|