@gengage/assistant-fe 0.6.34 → 0.6.36
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/chat/components/ChatDrawer.d.ts +2 -2
- package/dist/chat/components/KvkkBanner.d.ts +0 -2
- package/dist/chat/kvkk.d.ts +11 -5
- package/dist/chat-runtime.js +1 -1
- package/dist/chat.iife.js +11 -11
- package/dist/chat.js +1 -1
- package/dist/common/index.d.ts +2 -1
- package/dist/{common-CB1Vjd-T.js → common-ByXFSuDh.js} +1 -1
- package/dist/common.js +68 -67
- package/dist/{connection-warning-DBE8pkFv.js → connection-warning-ChSjBT_4.js} +1 -1
- package/dist/{fastIntent-D9jYpC8V.js → fastIntent-B9AE8K30.js} +1 -1
- package/dist/index.js +21 -21
- package/dist/native.iife.js +9 -9
- package/dist/qna-runtime.js +1 -1
- package/dist/qna.iife.js +1 -1
- package/dist/qna.js +1 -1
- package/dist/request-response-cache-D6O2m-O-.js +1426 -0
- package/dist/{runtime-By-msZ8j.js → runtime-CCQGaWOq.js} +198 -199
- package/dist/{runtime-DyG44pqo.js → runtime-YKSfwMAr.js} +415 -422
- package/dist/{runtime-CABcQc-L.js → runtime-aR-A6Jh2.js} +8 -9
- package/dist/{simbut-CsQSH5vN.js → simbut-BCKrXmkh.js} +1 -1
- package/dist/simbut.iife.js +1 -1
- package/dist/simbut.js +1 -1
- package/dist/{simrel-bxdmsMmZ.js → simrel-CSlprSEe.js} +1 -1
- package/dist/simrel-runtime.js +1 -1
- package/dist/simrel.iife.js +1 -1
- package/dist/simrel.js +2 -2
- package/dist/{widget-base-C_RZ-VIr.js → widget-base-CmxCHKJi.js} +1 -1
- package/package.json +3 -19
- package/dist/agent-ui-steps-DIWmTMuV.js +0 -3199
- package/dist/agentic/adaptor/create-adaptor.d.ts +0 -22
- package/dist/agentic/adaptor/fetch-bridge.d.ts +0 -31
- package/dist/agentic/adaptor/mount.d.ts +0 -45
- package/dist/agentic/algos/similarity.d.ts +0 -86
- package/dist/agentic/algos/similarity.js +0 -261
- package/dist/agentic/context/chat-context.d.ts +0 -17
- package/dist/agentic/context/context-store.d.ts +0 -57
- package/dist/agentic/context/persistence.d.ts +0 -14
- package/dist/agentic/contracts/agentic-contracts.d.ts +0 -133
- package/dist/agentic/debug/activity-collector.d.ts +0 -15
- package/dist/agentic/debug/activity-instrumentation.d.ts +0 -22
- package/dist/agentic/debug/activity-overlay.d.ts +0 -3
- package/dist/agentic/debug/activity-state.d.ts +0 -37
- package/dist/agentic/debug/local-dev.d.ts +0 -18
- package/dist/agentic/events/builders.d.ts +0 -10
- package/dist/agentic/events/comparison.d.ts +0 -6
- package/dist/agentic/events/context-products.d.ts +0 -6
- package/dist/agentic/events/error-taxonomy.d.ts +0 -27
- package/dist/agentic/events/product-normalize.d.ts +0 -50
- package/dist/agentic/events/ui-specs.d.ts +0 -41
- package/dist/agentic/flow/create-flow.d.ts +0 -2
- package/dist/agentic/flow/dispatch.d.ts +0 -3
- package/dist/agentic/index.d.ts +0 -65
- package/dist/agentic/index.js +0 -3493
- package/dist/agentic/types.d.ts +0 -360
- package/dist/agentic/util/account-config.d.ts +0 -8
- package/dist/agentic/util/assistant-host.d.ts +0 -11
- package/dist/agentic/util/be-url.d.ts +0 -4
- package/dist/agentic/util/browser-memory.d.ts +0 -13
- package/dist/agentic/util/browser-tools.d.ts +0 -31
- package/dist/agentic/util/cache-key.d.ts +0 -15
- package/dist/agentic/util/common/declarative-cache.d.ts +0 -21
- package/dist/agentic/util/common/fallback-status.d.ts +0 -10
- package/dist/agentic/util/common/flow-steps.d.ts +0 -8
- package/dist/agentic/util/common/gss-tool-aliases.d.ts +0 -66
- package/dist/agentic/util/common/iframe-scraper.d.ts +0 -22
- package/dist/agentic/util/common/llm-routing.d.ts +0 -50
- package/dist/agentic/util/common/object.d.ts +0 -1
- package/dist/agentic/util/common/open-product-page.d.ts +0 -30
- package/dist/agentic/util/common/panel-context.d.ts +0 -3
- package/dist/agentic/util/common/privacy.d.ts +0 -14
- package/dist/agentic/util/common/product-resolver.d.ts +0 -20
- package/dist/agentic/util/common/product-surface.d.ts +0 -24
- package/dist/agentic/util/common/ref-store.d.ts +0 -15
- package/dist/agentic/util/common/retail-privacy.d.ts +0 -4
- package/dist/agentic/util/common/route-params.d.ts +0 -3
- package/dist/agentic/util/common/similarity-ranking.d.ts +0 -2
- package/dist/agentic/util/common/site-awareness.d.ts +0 -130
- package/dist/agentic/util/lazy-runtime-loader.d.ts +0 -10
- package/dist/agentic/util/privacy.d.ts +0 -12
- package/dist/agentic/util/request-text.d.ts +0 -3
- package/dist/agentic/util/time.d.ts +0 -2
- package/dist/agentic/widgets/endpoints.d.ts +0 -12
- package/dist/agentic/worker/agent-ui-steps.d.ts +0 -43
- package/dist/agentic/worker/agent-ui.d.ts +0 -44
- package/dist/agentic/worker/be-client.d.ts +0 -32
- package/dist/agentic/worker/coalesce.d.ts +0 -25
- package/dist/agentic/worker/compaction.d.ts +0 -12
- package/dist/agentic/worker/entry.d.ts +0 -2
- package/dist/agentic/worker/flow-runner.d.ts +0 -24
- package/dist/agentic/worker/jwt-mint.d.ts +0 -21
- package/dist/agentic/worker/pdp-hydrate.d.ts +0 -30
- package/dist/agentic/worker/rpc.d.ts +0 -47
- package/dist/agentic/worker/tool-bridge.d.ts +0 -2
- package/dist/agentic/worker/tool-schema.d.ts +0 -19
- package/dist/agentic/worker.d.ts +0 -52
- package/dist/agentic/worker.js +0 -432
- package/dist/agentic.iife.js +0 -445
- package/dist/api-paths-DZQ4Xx7u.js +0 -1274
- package/dist/request-response-cache-BxRsKGJ0.js +0 -154
|
@@ -1,23 +1,22 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { A as
|
|
3
|
-
import { o as
|
|
1
|
+
import { f as x, g as Q, i as R, m as N, n as H, t as O } from "./request-response-cache-D6O2m-O-.js";
|
|
2
|
+
import { A as U, D as j, E as M, a as q, v as F } from "./context-UTzCGyR9.js";
|
|
3
|
+
import { o as W, t as D } from "./widget-base-CmxCHKJi.js";
|
|
4
4
|
import { t as A } from "./locale-uQ5XZ2yS.js";
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
const o = H("launcher_action", t), i = {
|
|
5
|
+
import { n as z } from "./connection-warning-ChSjBT_4.js";
|
|
6
|
+
async function $(t, e, n) {
|
|
7
|
+
const o = H("launcher_action", e), i = {
|
|
9
8
|
uiSpecs: [],
|
|
10
9
|
actions: []
|
|
11
10
|
}, a = {
|
|
12
11
|
method: "POST",
|
|
13
12
|
headers: { "Content-Type": "application/json" },
|
|
14
|
-
body: JSON.stringify(
|
|
13
|
+
body: JSON.stringify(t)
|
|
15
14
|
};
|
|
16
15
|
n !== void 0 && (a.signal = n);
|
|
17
|
-
const l = await
|
|
16
|
+
const l = await O(o, a);
|
|
18
17
|
if (!l.ok) throw new Error(`HTTP ${l.status}: ${l.statusText}`);
|
|
19
18
|
const s = { onEvent: (c) => {
|
|
20
|
-
const r =
|
|
19
|
+
const r = R(c);
|
|
21
20
|
if (r && (r.type === "ui_spec" && i.uiSpecs.push(r.spec), r.type === "ui_spec" && r.spec.elements)) {
|
|
22
21
|
for (const u of Object.values(r.spec.elements)) if (u.type === "ActionButton" && u.props?.action) {
|
|
23
22
|
const m = u.props.action;
|
|
@@ -27,35 +26,35 @@ async function $(e, t, n) {
|
|
|
27
26
|
} };
|
|
28
27
|
return n !== void 0 && (s.signal = n), await x(l, s), i;
|
|
29
28
|
}
|
|
30
|
-
function T(
|
|
31
|
-
const
|
|
32
|
-
|
|
33
|
-
for (const n of
|
|
29
|
+
function T(t) {
|
|
30
|
+
const e = document.createElement("div");
|
|
31
|
+
e.className = "gengage-qna-buttons gds-toolbar", e.dataset.gengagePart = "qna-button-row", e.setAttribute("role", "group"), e.setAttribute("aria-label", t.quickQuestionsAriaLabel ?? "Quick questions"), t.orientation === "vertical" && (e.style.flexDirection = "column");
|
|
32
|
+
for (const n of t.actions) {
|
|
34
33
|
const o = document.createElement("button");
|
|
35
34
|
o.className = "gengage-qna-button gds-chip", o.dataset.gengagePart = "qna-quick-question", o.textContent = n.title, o.type = "button", o.addEventListener("click", () => {
|
|
36
35
|
const i = {
|
|
37
36
|
title: n.title,
|
|
38
37
|
type: n.type
|
|
39
38
|
};
|
|
40
|
-
n.payload !== void 0 && (i.payload = n.payload),
|
|
41
|
-
}),
|
|
39
|
+
n.payload !== void 0 && (i.payload = n.payload), t.onAction(i);
|
|
40
|
+
}), e.appendChild(o);
|
|
42
41
|
}
|
|
43
|
-
if (
|
|
42
|
+
if (t.ctaText || t.onOpenChat) {
|
|
44
43
|
const n = document.createElement("button");
|
|
45
|
-
n.className = "gengage-qna-cta gds-btn gds-btn-secondary", n.dataset.gengagePart = "qna-cta", n.textContent =
|
|
46
|
-
|
|
47
|
-
}),
|
|
44
|
+
n.className = "gengage-qna-cta gds-btn gds-btn-secondary", n.dataset.gengagePart = "qna-cta", n.textContent = t.ctaText ?? t.defaultCtaText ?? "Ask something else", n.type = "button", n.addEventListener("click", () => {
|
|
45
|
+
t.onOpenChat?.();
|
|
46
|
+
}), e.appendChild(n);
|
|
48
47
|
}
|
|
49
|
-
return
|
|
48
|
+
return e;
|
|
50
49
|
}
|
|
51
|
-
function G(
|
|
52
|
-
const
|
|
53
|
-
|
|
50
|
+
function G(t) {
|
|
51
|
+
const e = document.createElement("div");
|
|
52
|
+
e.className = "gengage-qna-input-wrapper", e.dataset.gengagePart = "qna-input-wrapper";
|
|
54
53
|
const n = document.createElement("div");
|
|
55
54
|
n.className = "gengage-qna-input-combo", n.dataset.gengagePart = "qna-input-combo";
|
|
56
55
|
const o = document.createElement("input");
|
|
57
|
-
o.type = "text", o.className = "gengage-qna-input", o.dataset.gengagePart = "qna-input", o.setAttribute("aria-label",
|
|
58
|
-
const i = Array.isArray(
|
|
56
|
+
o.type = "text", o.className = "gengage-qna-input", o.dataset.gengagePart = "qna-input", o.setAttribute("aria-label", t.askQuestionAriaLabel ?? "Ask a question");
|
|
57
|
+
const i = Array.isArray(t.placeholders) ? t.placeholders : t.placeholders ? [t.placeholders] : [t.defaultInputPlaceholder ?? "Ask a question..."];
|
|
59
58
|
let a = 0, l = i[0] ?? "";
|
|
60
59
|
o.placeholder = l;
|
|
61
60
|
let s = null, c = null, r = !1;
|
|
@@ -72,13 +71,13 @@ function G(e) {
|
|
|
72
71
|
const f = document.createElement("button");
|
|
73
72
|
f.className = "gengage-qna-icon-btn gengage-qna-clear gengage-qna-icon-btn--hidden", f.type = "button", f.dataset.gengagePart = "qna-clear", f.setAttribute("aria-label", "Clear question"), f.innerHTML = '<svg viewBox="0 0 24 24" aria-hidden="true" focusable="false"><path d="M18 6L6 18" /><path d="M6 6L18 18" /></svg>';
|
|
74
73
|
const p = document.createElement("button");
|
|
75
|
-
p.className = "gengage-qna-icon-btn gengage-qna-send gengage-qna-icon-btn--hidden", p.type = "button", p.dataset.gengagePart = "qna-send", p.setAttribute("aria-label",
|
|
74
|
+
p.className = "gengage-qna-icon-btn gengage-qna-send gengage-qna-icon-btn--hidden", p.type = "button", p.dataset.gengagePart = "qna-send", p.setAttribute("aria-label", t.sendQuestionAriaLabel ?? "Send question"), p.disabled = !0, p.innerHTML = `<svg viewBox="0 0 24 24" aria-hidden="true" focusable="false"><path d="M22 2L11 13" /><path d="M22 2L15 22L11 13L2 9L22 2Z" /></svg><span class="gengage-qna-sr-only">${t.ctaLabel ?? t.sendButtonText ?? "Ask"}</span>`;
|
|
76
75
|
const y = () => {
|
|
77
76
|
const d = o.value.trim().length > 0;
|
|
78
77
|
f.classList.toggle("gengage-qna-icon-btn--hidden", !d), p.classList.toggle("gengage-qna-icon-btn--hidden", !d), p.classList.toggle("gengage-qna-send--active", d), p.disabled = !d;
|
|
79
78
|
}, b = () => {
|
|
80
79
|
const d = o.value.trim();
|
|
81
|
-
d && (
|
|
80
|
+
d && (t.onSubmit({
|
|
82
81
|
title: d,
|
|
83
82
|
type: "user_message",
|
|
84
83
|
payload: d
|
|
@@ -98,15 +97,15 @@ function G(e) {
|
|
|
98
97
|
o.placeholder = r ? "" : l, g();
|
|
99
98
|
}), o.addEventListener("keydown", (d) => {
|
|
100
99
|
d.key === "Enter" && (d.preventDefault(), b()), d.key === "Escape" && o.value.length > 0 && (o.value = "", y(), g());
|
|
101
|
-
}), h.appendChild(f), h.appendChild(p), n.appendChild(o), n.appendChild(h),
|
|
100
|
+
}), h.appendChild(f), h.appendChild(p), n.appendChild(o), n.appendChild(h), e.appendChild(n), y(), g(), e._cleanup = () => {
|
|
102
101
|
u();
|
|
103
|
-
},
|
|
102
|
+
}, e;
|
|
104
103
|
}
|
|
105
|
-
function v(
|
|
106
|
-
if (!
|
|
107
|
-
const n =
|
|
104
|
+
function v(t, e) {
|
|
105
|
+
if (!t || typeof t != "object") return null;
|
|
106
|
+
const n = t, o = n.type;
|
|
108
107
|
if (typeof o != "string" || o.length === 0) return null;
|
|
109
|
-
const i = n.title, a = n.payload, l = typeof i == "string" && i.length > 0 ? i :
|
|
108
|
+
const i = n.title, a = n.payload, l = typeof i == "string" && i.length > 0 ? i : e;
|
|
110
109
|
if (!l) return null;
|
|
111
110
|
const s = {
|
|
112
111
|
title: l,
|
|
@@ -114,27 +113,27 @@ function v(e, t) {
|
|
|
114
113
|
};
|
|
115
114
|
return a !== void 0 && (s.payload = a), s;
|
|
116
115
|
}
|
|
117
|
-
function E(
|
|
118
|
-
const
|
|
119
|
-
title:
|
|
120
|
-
type:
|
|
116
|
+
function E(t) {
|
|
117
|
+
const e = {
|
|
118
|
+
title: t.title,
|
|
119
|
+
type: t.type
|
|
121
120
|
};
|
|
122
|
-
return
|
|
121
|
+
return t.payload !== void 0 && (e.payload = t.payload), e;
|
|
123
122
|
}
|
|
124
|
-
function C(
|
|
125
|
-
const n = [], o =
|
|
123
|
+
function C(t, e) {
|
|
124
|
+
const n = [], o = t.props?.actions;
|
|
126
125
|
if (Array.isArray(o)) for (const l of o) {
|
|
127
126
|
const s = v(l);
|
|
128
127
|
s && n.push(s);
|
|
129
128
|
}
|
|
130
|
-
const i =
|
|
129
|
+
const i = t.props?.buttons;
|
|
131
130
|
if (Array.isArray(i)) for (const l of i) {
|
|
132
131
|
if (!l || typeof l != "object") continue;
|
|
133
132
|
const s = l, c = typeof s.label == "string" ? s.label : void 0, r = v(s.action, c);
|
|
134
133
|
r && n.push(r);
|
|
135
134
|
}
|
|
136
|
-
if (
|
|
137
|
-
const s =
|
|
135
|
+
if (t.children) for (const l of t.children) {
|
|
136
|
+
const s = e.elements[l];
|
|
138
137
|
if (!s || s.type !== "ActionButton") continue;
|
|
139
138
|
const c = typeof s.props?.label == "string" ? s.props.label : void 0, r = v(s.props?.action, c);
|
|
140
139
|
r && n.push(r);
|
|
@@ -143,8 +142,8 @@ function C(e, t) {
|
|
|
143
142
|
return n.filter((l) => a.has(l.title) ? !1 : (a.add(l.title), !0));
|
|
144
143
|
}
|
|
145
144
|
var L = {
|
|
146
|
-
ButtonRow: ({ element:
|
|
147
|
-
const o = C(
|
|
145
|
+
ButtonRow: ({ element: t, spec: e, context: n }) => {
|
|
146
|
+
const o = C(t, e).map(E), i = t.props?.orientation, a = {
|
|
148
147
|
actions: o,
|
|
149
148
|
onAction: n.onAction,
|
|
150
149
|
defaultCtaText: n.i18n.defaultCtaText,
|
|
@@ -152,45 +151,45 @@ var L = {
|
|
|
152
151
|
};
|
|
153
152
|
return n.onOpenChat !== void 0 && (a.onOpenChat = n.onOpenChat), n.ctaText !== void 0 && (a.ctaText = n.ctaText), (i === "horizontal" || i === "vertical") && (a.orientation = i), T(a);
|
|
154
153
|
},
|
|
155
|
-
ActionButtons: ({ element:
|
|
154
|
+
ActionButtons: ({ element: t, spec: e, context: n }) => {
|
|
156
155
|
const o = {
|
|
157
|
-
actions: C(
|
|
156
|
+
actions: C(t, e).map(E),
|
|
158
157
|
onAction: n.onAction,
|
|
159
158
|
defaultCtaText: n.i18n.defaultCtaText,
|
|
160
159
|
quickQuestionsAriaLabel: n.i18n.quickQuestionsAriaLabel
|
|
161
160
|
};
|
|
162
161
|
return n.onOpenChat !== void 0 && (o.onOpenChat = n.onOpenChat), n.ctaText !== void 0 && (o.ctaText = n.ctaText), T(o);
|
|
163
162
|
},
|
|
164
|
-
ActionButton: ({ element:
|
|
163
|
+
ActionButton: ({ element: t, context: e }) => {
|
|
165
164
|
const n = document.createElement("button");
|
|
166
165
|
n.className = "gengage-qna-button gds-chip", n.type = "button", n.dataset.gengagePart = "qna-action-button";
|
|
167
|
-
const o =
|
|
168
|
-
typeof o == "string" ? n.textContent = o : n.textContent =
|
|
169
|
-
const i = v(
|
|
170
|
-
return i && n.addEventListener("click", () =>
|
|
166
|
+
const o = t.props?.label;
|
|
167
|
+
typeof o == "string" ? n.textContent = o : n.textContent = e.i18n.defaultCtaText;
|
|
168
|
+
const i = v(t.props?.action, typeof o == "string" ? o : void 0);
|
|
169
|
+
return i && n.addEventListener("click", () => e.onAction(i)), n;
|
|
171
170
|
},
|
|
172
|
-
TextInput: ({ element:
|
|
173
|
-
const n =
|
|
174
|
-
onSubmit:
|
|
175
|
-
askQuestionAriaLabel:
|
|
176
|
-
defaultInputPlaceholder:
|
|
177
|
-
sendButtonText:
|
|
178
|
-
sendQuestionAriaLabel:
|
|
171
|
+
TextInput: ({ element: t, context: e }) => {
|
|
172
|
+
const n = t.props?.placeholder, o = typeof n == "string" || Array.isArray(n) ? n : e.inputPlaceholder, i = typeof t.props?.ctaLabel == "string" ? t.props.ctaLabel : void 0, a = {
|
|
173
|
+
onSubmit: e.onAction,
|
|
174
|
+
askQuestionAriaLabel: e.i18n.askQuestionAriaLabel,
|
|
175
|
+
defaultInputPlaceholder: e.i18n.defaultInputPlaceholder,
|
|
176
|
+
sendButtonText: e.i18n.sendButton,
|
|
177
|
+
sendQuestionAriaLabel: e.i18n.sendQuestionAriaLabel
|
|
179
178
|
};
|
|
180
179
|
return o !== void 0 && (a.placeholders = o), i !== void 0 && (a.ctaLabel = i), G(a);
|
|
181
180
|
},
|
|
182
|
-
QuestionHeading: ({ element:
|
|
181
|
+
QuestionHeading: ({ element: t, context: e }) => {
|
|
183
182
|
const n = document.createElement("h3");
|
|
184
183
|
n.className = "gengage-qna-heading", n.dataset.gengagePart = "qna-heading";
|
|
185
|
-
const o =
|
|
184
|
+
const o = t.props?.text, i = e.headingTitleOverride;
|
|
186
185
|
return n.textContent = typeof i == "string" && i.trim().length > 0 ? i : typeof o == "string" ? o : "", n;
|
|
187
186
|
},
|
|
188
187
|
ProductCard: () => null
|
|
189
|
-
}, S = ({ element:
|
|
190
|
-
if (!
|
|
188
|
+
}, S = ({ element: t, renderElement: e }) => {
|
|
189
|
+
if (!t.children || t.children.length === 0) return null;
|
|
191
190
|
const n = document.createElement("div");
|
|
192
|
-
for (const o of
|
|
193
|
-
const i =
|
|
191
|
+
for (const o of t.children) {
|
|
192
|
+
const i = e(o);
|
|
194
193
|
i && n.appendChild(i);
|
|
195
194
|
}
|
|
196
195
|
return n;
|
|
@@ -198,35 +197,35 @@ var L = {
|
|
|
198
197
|
function J() {
|
|
199
198
|
return { ...L };
|
|
200
199
|
}
|
|
201
|
-
function V(
|
|
200
|
+
function V(t, e, n = L, o = S) {
|
|
202
201
|
return Q({
|
|
203
|
-
spec:
|
|
204
|
-
context:
|
|
202
|
+
spec: t,
|
|
203
|
+
context: e,
|
|
205
204
|
registry: n,
|
|
206
205
|
containerClassName: "gengage-qna-uispec",
|
|
207
206
|
unknownRenderer: o
|
|
208
207
|
});
|
|
209
208
|
}
|
|
210
|
-
function Y(
|
|
211
|
-
if (!
|
|
212
|
-
const
|
|
213
|
-
if (
|
|
214
|
-
const o =
|
|
209
|
+
function Y(t) {
|
|
210
|
+
if (!t) return;
|
|
211
|
+
const e = t.extra;
|
|
212
|
+
if (e && typeof e == "object" && !Array.isArray(e)) {
|
|
213
|
+
const o = e.visible_skus ?? e.visibleSkus;
|
|
215
214
|
if (Array.isArray(o)) {
|
|
216
215
|
const i = o.filter((a) => typeof a == "string" && a.trim().length > 0).map((a) => a.trim()).slice(0, 200);
|
|
217
216
|
if (i.length > 0) return i;
|
|
218
217
|
}
|
|
219
218
|
}
|
|
220
|
-
const n = typeof
|
|
219
|
+
const n = typeof t.sku == "string" && t.sku.trim() ? t.sku.trim() : void 0;
|
|
221
220
|
return n ? [n] : void 0;
|
|
222
221
|
}
|
|
223
|
-
function P(
|
|
224
|
-
if (!
|
|
225
|
-
const n =
|
|
222
|
+
function P(t, e) {
|
|
223
|
+
if (!t) return null;
|
|
224
|
+
const n = t.action;
|
|
226
225
|
if (!n || typeof n != "object") return null;
|
|
227
226
|
const o = n, i = o.type;
|
|
228
227
|
if (typeof i != "string" || i.length === 0) return null;
|
|
229
|
-
const a = o.title, l = typeof a == "string" && a.length > 0 ? a : typeof
|
|
228
|
+
const a = o.title, l = typeof a == "string" && a.length > 0 ? a : typeof e == "string" && e.length > 0 ? e : "";
|
|
230
229
|
if (!l) return null;
|
|
231
230
|
const s = o.payload, c = {
|
|
232
231
|
title: l,
|
|
@@ -234,24 +233,24 @@ function P(e, t) {
|
|
|
234
233
|
};
|
|
235
234
|
return s !== void 0 && (c.payload = s), c;
|
|
236
235
|
}
|
|
237
|
-
function Z(
|
|
238
|
-
const n =
|
|
236
|
+
function Z(t, e) {
|
|
237
|
+
const n = t.elements[t.root];
|
|
239
238
|
if (!n) return !1;
|
|
240
239
|
const o = (i) => {
|
|
241
240
|
if (i.type !== "ActionButton") return !1;
|
|
242
241
|
const a = i.props;
|
|
243
242
|
if (!a || typeof a != "object") return !1;
|
|
244
243
|
const l = typeof a.label == "string" ? a.label : void 0;
|
|
245
|
-
return l ===
|
|
244
|
+
return l === e ? !0 : P(a, l)?.title === e;
|
|
246
245
|
};
|
|
247
246
|
if (n.type === "ActionButton") return o(n);
|
|
248
247
|
if (n.children) for (const i of n.children) {
|
|
249
|
-
const a =
|
|
248
|
+
const a = t.elements[i];
|
|
250
249
|
if (a && o(a)) return !0;
|
|
251
250
|
}
|
|
252
251
|
if (n.type === "ActionButtons" && Array.isArray(n.props?.buttons)) {
|
|
253
252
|
for (const i of n.props.buttons)
|
|
254
|
-
if (i?.label ===
|
|
253
|
+
if (i?.label === e || i?.action?.title === e) return !0;
|
|
255
254
|
}
|
|
256
255
|
return !1;
|
|
257
256
|
}
|
|
@@ -259,43 +258,43 @@ var I = 0;
|
|
|
259
258
|
function w() {
|
|
260
259
|
return I += 1, `gengage-merge-${I}`;
|
|
261
260
|
}
|
|
262
|
-
function K(
|
|
263
|
-
const n =
|
|
261
|
+
function K(t, e) {
|
|
262
|
+
const n = t.elements[t.root];
|
|
264
263
|
if (!n || n.type !== "ButtonRow") return;
|
|
265
264
|
const o = w();
|
|
266
|
-
|
|
265
|
+
t.elements[o] = {
|
|
267
266
|
type: "ActionButton",
|
|
268
267
|
props: {
|
|
269
|
-
label:
|
|
268
|
+
label: e.title,
|
|
270
269
|
action: {
|
|
271
|
-
title:
|
|
272
|
-
type:
|
|
273
|
-
...
|
|
270
|
+
title: e.title,
|
|
271
|
+
type: e.type,
|
|
272
|
+
...e.payload !== void 0 ? { payload: e.payload } : {}
|
|
274
273
|
}
|
|
275
274
|
}
|
|
276
275
|
}, n.children = n.children ? [o, ...n.children] : [o];
|
|
277
276
|
}
|
|
278
|
-
function X(
|
|
279
|
-
const n =
|
|
277
|
+
function X(t, e) {
|
|
278
|
+
const n = t.elements[t.root];
|
|
280
279
|
if (!n || n.type !== "ActionButtons") return;
|
|
281
280
|
const o = w();
|
|
282
|
-
|
|
281
|
+
t.elements[o] = {
|
|
283
282
|
type: "ActionButton",
|
|
284
283
|
props: {
|
|
285
|
-
label:
|
|
284
|
+
label: e.title,
|
|
286
285
|
action: {
|
|
287
|
-
title:
|
|
288
|
-
type:
|
|
289
|
-
...
|
|
286
|
+
title: e.title,
|
|
287
|
+
type: e.type,
|
|
288
|
+
...e.payload !== void 0 ? { payload: e.payload } : {}
|
|
290
289
|
}
|
|
291
290
|
}
|
|
292
291
|
}, n.children = n.children ? [o, ...n.children] : [o];
|
|
293
292
|
const i = n.props?.buttons ?? [], a = {
|
|
294
|
-
label:
|
|
293
|
+
label: e.title,
|
|
295
294
|
action: {
|
|
296
|
-
title:
|
|
297
|
-
type:
|
|
298
|
-
...
|
|
295
|
+
title: e.title,
|
|
296
|
+
type: e.type,
|
|
297
|
+
...e.payload !== void 0 ? { payload: e.payload } : {}
|
|
299
298
|
}
|
|
300
299
|
};
|
|
301
300
|
n.props = {
|
|
@@ -303,11 +302,11 @@ function X(e, t) {
|
|
|
303
302
|
buttons: [a, ...i]
|
|
304
303
|
};
|
|
305
304
|
}
|
|
306
|
-
function
|
|
307
|
-
const
|
|
308
|
-
for (let o = 0; o <
|
|
309
|
-
const i =
|
|
310
|
-
n.push(a),
|
|
305
|
+
function ee(t) {
|
|
306
|
+
const e = {}, n = [];
|
|
307
|
+
for (let o = 0; o < t.length; o++) {
|
|
308
|
+
const i = t[o], a = `action-${o}`;
|
|
309
|
+
n.push(a), e[a] = {
|
|
311
310
|
type: "ActionButton",
|
|
312
311
|
props: {
|
|
313
312
|
label: i.title,
|
|
@@ -319,44 +318,44 @@ function tt(e) {
|
|
|
319
318
|
}
|
|
320
319
|
};
|
|
321
320
|
}
|
|
322
|
-
return
|
|
321
|
+
return e.root = {
|
|
323
322
|
type: "ButtonRow",
|
|
324
323
|
children: n
|
|
325
324
|
}, {
|
|
326
325
|
root: "root",
|
|
327
|
-
elements:
|
|
326
|
+
elements: e
|
|
328
327
|
};
|
|
329
328
|
}
|
|
330
|
-
function
|
|
331
|
-
return
|
|
332
|
-
const n =
|
|
329
|
+
function te(t) {
|
|
330
|
+
return t.find((e) => {
|
|
331
|
+
const n = e.elements[e.root];
|
|
333
332
|
return n?.type === "ActionButtons" || n?.type === "ButtonRow";
|
|
334
333
|
});
|
|
335
334
|
}
|
|
336
|
-
function k(
|
|
337
|
-
const n =
|
|
338
|
-
return
|
|
335
|
+
function k(t, e) {
|
|
336
|
+
const n = t.productContextQuickPillLabel, o = { text: n };
|
|
337
|
+
return e && e.length > 0 && (o.sku_list = e), {
|
|
339
338
|
title: n,
|
|
340
339
|
type: "user_message",
|
|
341
340
|
payload: o
|
|
342
341
|
};
|
|
343
342
|
}
|
|
344
|
-
function
|
|
343
|
+
function ne(t, e, n) {
|
|
345
344
|
const o = n?.skuList, i = [], a = [];
|
|
346
|
-
for (const c of
|
|
345
|
+
for (const c of t) {
|
|
347
346
|
const r = c.elements[c.root];
|
|
348
347
|
if (r?.type === "ActionButton") {
|
|
349
348
|
const u = r.props;
|
|
350
349
|
if (P(u, typeof u?.label == "string" ? u.label : void 0)?.type === "findSimilar") {
|
|
351
|
-
i.push(k(
|
|
350
|
+
i.push(k(e, o));
|
|
352
351
|
continue;
|
|
353
352
|
}
|
|
354
353
|
}
|
|
355
354
|
a.push(c);
|
|
356
355
|
}
|
|
357
|
-
if (i.length === 0) return
|
|
358
|
-
const l = k(
|
|
359
|
-
if (!s) return [...a,
|
|
356
|
+
if (i.length === 0) return t;
|
|
357
|
+
const l = k(e, o), s = te(a);
|
|
358
|
+
if (!s) return [...a, ee([l])];
|
|
360
359
|
if (!Z(s, l.title)) {
|
|
361
360
|
const c = s.elements[s.root];
|
|
362
361
|
c?.type === "ActionButtons" ? X(s, l) : c?.type === "ButtonRow" && K(s, l);
|
|
@@ -372,7 +371,7 @@ var B = {
|
|
|
372
371
|
defaultCtaText: "Başka bir şey sor",
|
|
373
372
|
redirectingToChat: "Sohbete yönlendiriliyor...",
|
|
374
373
|
productContextQuickPillLabel: "Bu ürün hakkında ne bilmeliyim?"
|
|
375
|
-
},
|
|
374
|
+
}, oe = {
|
|
376
375
|
quickQuestionsAriaLabel: "Quick questions",
|
|
377
376
|
askQuestionAriaLabel: "Ask a question",
|
|
378
377
|
defaultInputPlaceholder: "Ask a question...",
|
|
@@ -382,30 +381,30 @@ var B = {
|
|
|
382
381
|
redirectingToChat: "Redirecting to chat...",
|
|
383
382
|
productContextQuickPillLabel: "What should I know about this product?"
|
|
384
383
|
};
|
|
385
|
-
function
|
|
386
|
-
return
|
|
384
|
+
function ie(t) {
|
|
385
|
+
return t ? t.toLowerCase().split("-")[0] ?? "tr" : "tr";
|
|
387
386
|
}
|
|
388
|
-
function
|
|
389
|
-
return
|
|
387
|
+
function ae(t) {
|
|
388
|
+
return ie(t) === "en" ? oe : B;
|
|
390
389
|
}
|
|
391
|
-
var
|
|
392
|
-
constructor(...
|
|
393
|
-
super(...
|
|
394
|
-
}
|
|
395
|
-
async onInit(
|
|
396
|
-
this._i18n = this._resolveI18n(
|
|
397
|
-
const
|
|
398
|
-
if (
|
|
390
|
+
var se = class extends D {
|
|
391
|
+
constructor(...t) {
|
|
392
|
+
super(...t), this._abortController = null, this._debounceTimer = null, this._contentEl = null, this._i18n = B, this._actionHandler = this._handleAction.bind(this), this._openChatHandler = this._handleOpenChat.bind(this);
|
|
393
|
+
}
|
|
394
|
+
async onInit(t) {
|
|
395
|
+
this._i18n = this._resolveI18n(t), this._contentEl = document.createElement("div"), this._contentEl.className = "gengage-qna-container", this._contentEl.dataset.gengagePart = "qna-container", this._contentEl.lang = A(t.locale);
|
|
396
|
+
const e = this._createChrome(t);
|
|
397
|
+
if (e) {
|
|
399
398
|
const o = document.createElement("div");
|
|
400
|
-
o.className = "gengage-qna-chrome-widget", o.dataset.gengagePart = "qna-chrome-widget", o.appendChild(this._contentEl),
|
|
399
|
+
o.className = "gengage-qna-chrome-widget", o.dataset.gengagePart = "qna-chrome-widget", o.appendChild(this._contentEl), e.appendChild(o), this.root.appendChild(e);
|
|
401
400
|
} else this.root.appendChild(this._contentEl);
|
|
402
|
-
const n =
|
|
403
|
-
n && (this._lastSku = n, await this._fetchAndRender(n)),
|
|
401
|
+
const n = t.pageContext?.sku;
|
|
402
|
+
n && (this._lastSku = n, await this._fetchAndRender(n)), F("qna");
|
|
404
403
|
}
|
|
405
|
-
onUpdate(
|
|
406
|
-
const
|
|
407
|
-
!
|
|
408
|
-
this._debounceTimer = null, this._lastSku =
|
|
404
|
+
onUpdate(t) {
|
|
405
|
+
const e = t.sku;
|
|
406
|
+
!e || e === this._lastSku || (this._debounceTimer && clearTimeout(this._debounceTimer), this._debounceTimer = setTimeout(() => {
|
|
407
|
+
this._debounceTimer = null, this._lastSku = e, this._fetchAndRender(e);
|
|
409
408
|
}, 50));
|
|
410
409
|
}
|
|
411
410
|
onShow() {
|
|
@@ -422,21 +421,21 @@ var st = class extends W {
|
|
|
422
421
|
this._abortController?.abort(), this._abortController = null;
|
|
423
422
|
}
|
|
424
423
|
_resolvedQnaHeaderTitle() {
|
|
425
|
-
const
|
|
426
|
-
if (typeof
|
|
427
|
-
const
|
|
428
|
-
return
|
|
424
|
+
const t = this.config.headerTitle ?? this.config.headingTitle;
|
|
425
|
+
if (typeof t != "string") return;
|
|
426
|
+
const e = t.trim();
|
|
427
|
+
return e.length > 0 ? e : void 0;
|
|
429
428
|
}
|
|
430
429
|
_cleanupTextInputTimers() {
|
|
431
430
|
if (!this._contentEl) return;
|
|
432
|
-
const
|
|
433
|
-
for (const
|
|
431
|
+
const t = this._contentEl.querySelectorAll(".gengage-qna-input-wrapper");
|
|
432
|
+
for (const e of t) e._cleanup?.();
|
|
434
433
|
}
|
|
435
|
-
async _fetchAndRender(
|
|
434
|
+
async _fetchAndRender(t) {
|
|
436
435
|
if (this._abort(), this._abortController = new AbortController(), !this._contentEl) return;
|
|
437
436
|
this._cleanupTextInputTimers(), this._contentEl.innerHTML = "";
|
|
438
|
-
const
|
|
439
|
-
this._contentEl.appendChild(
|
|
437
|
+
const e = this._createLoadingIndicator();
|
|
438
|
+
this._contentEl.appendChild(e);
|
|
440
439
|
const n = { middlewareUrl: this.config.middlewareUrl }, o = z({
|
|
441
440
|
source: "qna",
|
|
442
441
|
locale: this.config.locale
|
|
@@ -446,7 +445,7 @@ var st = class extends W {
|
|
|
446
445
|
account_id: this.config.accountId,
|
|
447
446
|
session_id: i,
|
|
448
447
|
correlation_id: i,
|
|
449
|
-
sku:
|
|
448
|
+
sku: t,
|
|
450
449
|
locale: A(this.config.locale)
|
|
451
450
|
};
|
|
452
451
|
this.config.session?.userId !== void 0 && (a.user_id = this.config.session.userId), this.config.session?.viewId !== void 0 && (a.view_id = this.config.session.viewId);
|
|
@@ -474,18 +473,18 @@ var st = class extends W {
|
|
|
474
473
|
i18n: this._i18n
|
|
475
474
|
}, f = this._resolvedQnaHeaderTitle();
|
|
476
475
|
f !== void 0 && (h.headingTitleOverride = f), this.config.hideButtonRowCta || (h.onOpenChat = this._openChatHandler, this.config.ctaText !== void 0 && (h.ctaText = this.config.ctaText)), g !== void 0 && (h.inputPlaceholder = g);
|
|
477
|
-
const p = this._buildFallbackActionsSpec(s.actions), y = Y(this.config.pageContext), b = (s.uiSpecs.length > 0 ?
|
|
476
|
+
const p = this._buildFallbackActionsSpec(s.actions), y = Y(this.config.pageContext), b = (s.uiSpecs.length > 0 ? ne(s.uiSpecs, this._i18n, { skuList: y }) : [p]).filter((d) => Object.keys(d.elements).length > 0);
|
|
478
477
|
for (const d of b) {
|
|
479
478
|
const _ = this._renderUISpec(d, h);
|
|
480
479
|
c.appendChild(_);
|
|
481
480
|
}
|
|
482
|
-
b.length > 0 &&
|
|
481
|
+
b.length > 0 && M("qna"), this._specIncludesType(b, "TextInput") || this._insertStandaloneInputBeforePills(c, h, g);
|
|
483
482
|
} catch (i) {
|
|
484
483
|
if (i instanceof DOMException && i.name === "AbortError") return;
|
|
485
484
|
if (q("gengage:global:error", {
|
|
486
485
|
source: "qna",
|
|
487
486
|
code: "FETCH_ERROR",
|
|
488
|
-
message:
|
|
487
|
+
message: W(this.config.locale, i)
|
|
489
488
|
}), this._contentEl) {
|
|
490
489
|
this._cleanupTextInputTimers(), this._contentEl.innerHTML = "";
|
|
491
490
|
const a = document.createElement("div");
|
|
@@ -502,25 +501,25 @@ var st = class extends W {
|
|
|
502
501
|
}
|
|
503
502
|
}
|
|
504
503
|
_createLoadingIndicator() {
|
|
505
|
-
const
|
|
506
|
-
|
|
507
|
-
for (let
|
|
504
|
+
const t = document.createElement("div");
|
|
505
|
+
t.className = "gengage-qna-loading";
|
|
506
|
+
for (let e = 0; e < 3; e++) {
|
|
508
507
|
const n = document.createElement("div");
|
|
509
|
-
n.className = "gengage-qna-loading-dot",
|
|
508
|
+
n.className = "gengage-qna-loading-dot", t.appendChild(n);
|
|
510
509
|
}
|
|
511
|
-
return
|
|
510
|
+
return t;
|
|
512
511
|
}
|
|
513
|
-
_resolveI18n(
|
|
512
|
+
_resolveI18n(t) {
|
|
514
513
|
return {
|
|
515
|
-
...
|
|
516
|
-
...
|
|
514
|
+
...ae(t.locale),
|
|
515
|
+
...t.i18n
|
|
517
516
|
};
|
|
518
517
|
}
|
|
519
|
-
_createChrome(
|
|
520
|
-
const
|
|
521
|
-
if (!
|
|
522
|
-
const n = typeof
|
|
523
|
-
s.className = "gengage-qna-chrome", s.dataset.gengagePart = "qna-chrome",
|
|
518
|
+
_createChrome(t) {
|
|
519
|
+
const e = t.chrome;
|
|
520
|
+
if (!e) return null;
|
|
521
|
+
const n = typeof e.title == "string" ? e.title.trim() : "", o = typeof e.subtitle == "string" ? e.subtitle.trim() : "", i = typeof e.startButtonLabel == "string" ? e.startButtonLabel.trim() : "", a = typeof e.imageUrl == "string" ? e.imageUrl.trim() : "", l = typeof e.imagePadding == "string" ? e.imagePadding.trim() : "", s = document.createElement("section");
|
|
522
|
+
s.className = "gengage-qna-chrome", s.dataset.gengagePart = "qna-chrome", e.layout === "side-image" && (s.classList.add("gengage-qna-chrome--side-image"), s.dataset.gengageChromeLayout = "side-image"), l && s.style.setProperty("--gengage-qna-chrome-image-padding", l);
|
|
524
523
|
const c = document.createElement("div");
|
|
525
524
|
if (c.className = "gengage-qna-chrome-copy", c.dataset.gengagePart = "qna-chrome-copy", n) {
|
|
526
525
|
const r = document.createElement("h2");
|
|
@@ -530,9 +529,9 @@ var st = class extends W {
|
|
|
530
529
|
const r = document.createElement("p");
|
|
531
530
|
r.className = "gengage-qna-chrome-subtitle", r.dataset.gengagePart = "qna-chrome-subtitle", r.textContent = o, c.appendChild(r);
|
|
532
531
|
}
|
|
533
|
-
if (c.children.length > 0 && s.appendChild(c), a &&
|
|
532
|
+
if (c.children.length > 0 && s.appendChild(c), a && U(a)) {
|
|
534
533
|
const r = document.createElement("img");
|
|
535
|
-
r.className = "gengage-qna-chrome-image", r.dataset.gengagePart = "qna-chrome-image", r.src = a, r.alt = typeof
|
|
534
|
+
r.className = "gengage-qna-chrome-image", r.dataset.gengagePart = "qna-chrome-image", r.src = a, r.alt = typeof e.imageAlt == "string" ? e.imageAlt : "", r.loading = "lazy", r.addEventListener("error", () => {
|
|
536
535
|
r.style.display = "none";
|
|
537
536
|
}, { once: !0 }), s.appendChild(r);
|
|
538
537
|
}
|
|
@@ -543,29 +542,29 @@ var st = class extends W {
|
|
|
543
542
|
return s.children.length === 0 ? null : s;
|
|
544
543
|
}
|
|
545
544
|
_resolveUISpecRegistry() {
|
|
546
|
-
return
|
|
545
|
+
return N(J(), this.config.renderer?.registry);
|
|
547
546
|
}
|
|
548
|
-
_renderUISpec(
|
|
547
|
+
_renderUISpec(t, e) {
|
|
549
548
|
const n = this._resolveUISpecRegistry(), o = this.config.renderer?.unknownRenderer ?? S, i = (l, s) => V(l, s, n, o), a = this.config.renderer?.renderUISpec;
|
|
550
|
-
return a ? a(
|
|
549
|
+
return a ? a(t, e, {
|
|
551
550
|
registry: n,
|
|
552
551
|
unknownRenderer: o,
|
|
553
552
|
defaultRender: i
|
|
554
|
-
}) : i(
|
|
553
|
+
}) : i(t, e);
|
|
555
554
|
}
|
|
556
|
-
_specIncludesType(
|
|
557
|
-
for (const n of
|
|
555
|
+
_specIncludesType(t, e) {
|
|
556
|
+
for (const n of t) for (const o of Object.values(n.elements)) if (o.type === e) return !0;
|
|
558
557
|
return !1;
|
|
559
558
|
}
|
|
560
|
-
_buildFallbackActionsSpec(
|
|
561
|
-
if (
|
|
559
|
+
_buildFallbackActionsSpec(t) {
|
|
560
|
+
if (t.length === 0) return {
|
|
562
561
|
root: "root",
|
|
563
562
|
elements: {}
|
|
564
563
|
};
|
|
565
|
-
const
|
|
566
|
-
for (let o = 0; o <
|
|
567
|
-
const i =
|
|
568
|
-
n.push(a),
|
|
564
|
+
const e = {}, n = [];
|
|
565
|
+
for (let o = 0; o < t.length; o++) {
|
|
566
|
+
const i = t[o], a = `action-${o}`;
|
|
567
|
+
n.push(a), e[a] = {
|
|
569
568
|
type: "ActionButton",
|
|
570
569
|
props: {
|
|
571
570
|
label: i.title,
|
|
@@ -577,47 +576,47 @@ var st = class extends W {
|
|
|
577
576
|
}
|
|
578
577
|
};
|
|
579
578
|
}
|
|
580
|
-
return
|
|
579
|
+
return e.root = {
|
|
581
580
|
type: "ButtonRow",
|
|
582
581
|
children: n
|
|
583
582
|
}, {
|
|
584
583
|
root: "root",
|
|
585
|
-
elements:
|
|
584
|
+
elements: e
|
|
586
585
|
};
|
|
587
586
|
}
|
|
588
|
-
_insertStandaloneInputBeforePills(
|
|
587
|
+
_insertStandaloneInputBeforePills(t, e, n) {
|
|
589
588
|
const o = {
|
|
590
589
|
root: "root",
|
|
591
590
|
elements: { root: {
|
|
592
591
|
type: "TextInput",
|
|
593
592
|
props: { placeholder: n }
|
|
594
593
|
} }
|
|
595
|
-
}, i = this._renderUISpec(o,
|
|
594
|
+
}, i = this._renderUISpec(o, e), a = i.querySelector(".gengage-qna-input-wrapper");
|
|
596
595
|
if (!a) return;
|
|
597
|
-
const l =
|
|
596
|
+
const l = t.querySelector(".gengage-qna-uispec"), s = t.querySelector(".gengage-qna-uispec > .gengage-qna-buttons"), c = this.config.inputAfterPills === !0;
|
|
598
597
|
if (s) c ? s.insertAdjacentElement("afterend", a) : s.insertAdjacentElement("beforebegin", a);
|
|
599
598
|
else if (l) {
|
|
600
599
|
const r = l.querySelector(":scope > .gengage-qna-heading");
|
|
601
600
|
!c && r ? r.insertAdjacentElement("afterend", a) : l.appendChild(a);
|
|
602
601
|
} else {
|
|
603
|
-
|
|
602
|
+
t.appendChild(i);
|
|
604
603
|
return;
|
|
605
604
|
}
|
|
606
605
|
i.remove();
|
|
607
606
|
}
|
|
608
|
-
_appendStandaloneInput(
|
|
607
|
+
_appendStandaloneInput(t, e, n) {
|
|
609
608
|
if (!this._contentEl) return;
|
|
610
609
|
const o = {
|
|
611
610
|
root: "root",
|
|
612
611
|
elements: { root: {
|
|
613
612
|
type: "TextInput",
|
|
614
|
-
props: { placeholder:
|
|
613
|
+
props: { placeholder: e }
|
|
615
614
|
} }
|
|
616
|
-
}, i = this._renderUISpec(o,
|
|
615
|
+
}, i = this._renderUISpec(o, t);
|
|
617
616
|
(n ?? this._contentEl).appendChild(i);
|
|
618
617
|
}
|
|
619
|
-
_handleAction(
|
|
620
|
-
this._showTransitionIndicator(),
|
|
618
|
+
_handleAction(t) {
|
|
619
|
+
this._showTransitionIndicator(), j(t.title, t.type), this.config.onActionSelected?.(t), setTimeout(() => q("gengage:qna:action", t), 350);
|
|
621
620
|
}
|
|
622
621
|
_handleOpenChat() {
|
|
623
622
|
this._showTransitionIndicator(), this.config.onOpenChat?.(), setTimeout(() => q("gengage:qna:open-chat", {}), 350);
|
|
@@ -625,19 +624,19 @@ var st = class extends W {
|
|
|
625
624
|
_showTransitionIndicator() {
|
|
626
625
|
if (!this._contentEl) return;
|
|
627
626
|
this._contentEl.querySelector(".gengage-qna-transition-indicator")?.remove(), this._contentEl.classList.add("gengage-qna--transitioning");
|
|
628
|
-
const
|
|
629
|
-
|
|
630
|
-
this._contentEl?.classList.remove("gengage-qna--transitioning"),
|
|
627
|
+
const t = this._i18n.redirectingToChat ?? "Redirecting to chat...", e = document.createElement("div");
|
|
628
|
+
e.className = "gengage-qna-transition-indicator", e.textContent = t, (this._contentEl.querySelector(".gengage-qna-panel") ?? this._contentEl).appendChild(e), setTimeout(() => {
|
|
629
|
+
this._contentEl?.classList.remove("gengage-qna--transitioning"), e.remove();
|
|
631
630
|
}, 600);
|
|
632
631
|
}
|
|
633
632
|
};
|
|
634
|
-
function
|
|
635
|
-
return new
|
|
633
|
+
function pe() {
|
|
634
|
+
return new se();
|
|
636
635
|
}
|
|
637
636
|
export {
|
|
638
637
|
V as a,
|
|
639
638
|
S as i,
|
|
640
|
-
|
|
639
|
+
pe as n,
|
|
641
640
|
J as r,
|
|
642
|
-
|
|
641
|
+
se as t
|
|
643
642
|
};
|