@gengage/assistant-fe 0.3.35 → 0.3.37
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 +17 -10
- package/dist/chat/components/ComparisonTable.d.ts +2 -1
- package/dist/chat/features/beauty-consulting/consulting-grid.d.ts +10 -0
- package/dist/chat/index.d.ts +4 -1
- package/dist/chat/session-persistence.d.ts +2 -1
- package/dist/chat/types.d.ts +1 -0
- package/dist/{chat-BVxo08xS.js → chat-BJu5cvMq.js} +2042 -1981
- package/dist/chat.iife.js +39 -39
- package/dist/chat.js +11 -10
- package/dist/common/action-router.d.ts +1 -0
- package/dist/common/locale.d.ts +1 -0
- package/dist/common/navigation.d.ts +5 -0
- package/dist/{common-dxI9x9_U.js → common-DxR7wUEx.js} +2 -2
- package/dist/common.js +41 -41
- package/dist/{connection-warning-CHHi3BAf.js → connection-warning-nm_yulO-.js} +9 -9
- package/dist/{ga-datalayer-BwxWX-cr.js → ga-datalayer-BUM5z5Pq.js} +65 -60
- package/dist/index.js +31 -31
- package/dist/{native-webview-CMsUMLah.js → native-webview-BFWh8f-u.js} +31 -31
- package/dist/native.iife.js +36 -36
- package/dist/native.js +1 -1
- package/dist/{product-utils-Bm3aiAlJ.js → price-formatter-CR6VT5z4.js} +27 -27
- package/dist/{qna-BuBvAr2H.js → qna-6_XrdLG_.js} +85 -85
- package/dist/qna.iife.js +6 -6
- package/dist/qna.js +1 -1
- package/dist/{schemas-DBRIy5NT.js → schemas-ZYhTx11k.js} +1 -1
- package/dist/{simbut-BBXTlzOg.js → simbut--wBhTxId.js} +29 -29
- package/dist/simbut.iife.js +7 -7
- package/dist/simbut.js +1 -1
- package/dist/simrel/index.d.ts +1 -0
- package/dist/simrel/types.d.ts +2 -0
- package/dist/simrel-jN_YPfC7.js +710 -0
- package/dist/simrel.iife.js +19 -19
- package/dist/simrel.js +1 -1
- package/package.json +2 -2
- package/dist/simrel-BRh5eB2K.js +0 -694
package/dist/native.js
CHANGED
|
@@ -1,29 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
currencyCode: "TRY",
|
|
3
|
-
currencySymbol: "TL",
|
|
4
|
-
currencyPosition: "suffix",
|
|
5
|
-
thousandsSeparator: ".",
|
|
6
|
-
decimalSeparator: ",",
|
|
7
|
-
alwaysShowDecimals: !1
|
|
8
|
-
};
|
|
9
|
-
function f(e, o) {
|
|
10
|
-
const n = Number(e);
|
|
11
|
-
if (!Number.isFinite(n) || n < 0) return e;
|
|
12
|
-
const r = {
|
|
13
|
-
...u,
|
|
14
|
-
...o
|
|
15
|
-
}, c = Math.abs(n % 1) < Number.EPSILON, t = r.alwaysShowDecimals || !c ? n.toFixed(2) : n.toFixed(0), a = t.indexOf("."), s = a === -1 ? t : t.slice(0, a), d = a === -1 ? void 0 : t.slice(a + 1), l = s.replace(/\B(?=(\d{3})+(?!\d))/g, r.thousandsSeparator);
|
|
16
|
-
let i;
|
|
17
|
-
return d !== void 0 ? i = `${l}${r.decimalSeparator}${d}` : i = l, r.currencySymbol ? r.currencyPosition === "prefix" ? `${r.currencySymbol}${i}` : `${i} ${r.currencySymbol}` : i;
|
|
18
|
-
}
|
|
19
|
-
function m(e) {
|
|
1
|
+
function u(e) {
|
|
20
2
|
return Number.isFinite(e) ? Math.max(0, Math.min(5, e)) : 0;
|
|
21
3
|
}
|
|
22
|
-
function
|
|
4
|
+
function f(e) {
|
|
23
5
|
return Number.isFinite(e) ? Math.max(0, Math.min(100, Math.round(e))) : 0;
|
|
24
6
|
}
|
|
25
|
-
function
|
|
26
|
-
const o =
|
|
7
|
+
function p(e) {
|
|
8
|
+
const o = u(e), n = Math.floor(o), r = o - n >= 0.5, c = 5 - n - (r ? 1 : 0), t = document.createElement("span");
|
|
27
9
|
if (t.className = "gengage-star-rating", t.setAttribute("role", "img"), t.setAttribute("aria-label", `${o.toFixed(1)} out of 5 stars`), n > 0 && t.appendChild(document.createTextNode("★".repeat(n))), r) {
|
|
28
10
|
const a = document.createElement("span");
|
|
29
11
|
a.className = "gengage-star-half", a.textContent = "☆";
|
|
@@ -32,15 +14,33 @@ function h(e) {
|
|
|
32
14
|
}
|
|
33
15
|
return c > 0 && t.appendChild(document.createTextNode("☆".repeat(c))), t;
|
|
34
16
|
}
|
|
35
|
-
function
|
|
17
|
+
function h(e) {
|
|
36
18
|
e.addEventListener("error", () => {
|
|
37
19
|
e.style.display = "none";
|
|
38
20
|
}, { once: !0 });
|
|
39
21
|
}
|
|
22
|
+
var m = {
|
|
23
|
+
currencyCode: "TRY",
|
|
24
|
+
currencySymbol: "TL",
|
|
25
|
+
currencyPosition: "suffix",
|
|
26
|
+
thousandsSeparator: ".",
|
|
27
|
+
decimalSeparator: ",",
|
|
28
|
+
alwaysShowDecimals: !1
|
|
29
|
+
};
|
|
30
|
+
function y(e, o) {
|
|
31
|
+
const n = Number(e);
|
|
32
|
+
if (!Number.isFinite(n) || n < 0) return e;
|
|
33
|
+
const r = {
|
|
34
|
+
...m,
|
|
35
|
+
...o
|
|
36
|
+
}, c = Math.abs(n % 1) < Number.EPSILON, t = r.alwaysShowDecimals || !c ? n.toFixed(2) : n.toFixed(0), a = t.indexOf("."), s = a === -1 ? t : t.slice(0, a), d = a === -1 ? void 0 : t.slice(a + 1), l = s.replace(/\B(?=(\d{3})+(?!\d))/g, r.thousandsSeparator);
|
|
37
|
+
let i;
|
|
38
|
+
return d !== void 0 ? i = `${l}${r.decimalSeparator}${d}` : i = l, r.currencySymbol ? r.currencyPosition === "prefix" ? `${r.currencySymbol}${i}` : `${i} ${r.currencySymbol}` : i;
|
|
39
|
+
}
|
|
40
40
|
export {
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
41
|
+
p as a,
|
|
42
|
+
u as i,
|
|
43
|
+
h as n,
|
|
44
|
+
f as r,
|
|
45
45
|
y as t
|
|
46
46
|
};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { S as
|
|
2
|
-
import {
|
|
3
|
-
import { n as
|
|
4
|
-
async function
|
|
5
|
-
const o =
|
|
1
|
+
import { S as H, b as O, c as _, d as U, l as j, n as M, o as A, p as F, r as D, t as P, u as W, w as $ } from "./schemas-ZYhTx11k.js";
|
|
2
|
+
import { $ as z, C as G, F as E, Q as Z, Z as J, b as V, c as Y, g as K, h as X, tt, y as C } from "./ga-datalayer-BUM5z5Pq.js";
|
|
3
|
+
import { n as et } from "./connection-warning-nm_yulO-.js";
|
|
4
|
+
async function nt(t, n, e) {
|
|
5
|
+
const o = U("launcher_action", n), i = {
|
|
6
6
|
uiSpecs: [],
|
|
7
7
|
actions: []
|
|
8
8
|
}, a = {
|
|
@@ -14,7 +14,7 @@ async function et(t, n, e) {
|
|
|
14
14
|
const s = await fetch(o, a);
|
|
15
15
|
if (!s.ok) throw new Error(`HTTP ${s.status}: ${s.statusText}`);
|
|
16
16
|
const r = { onEvent: (l) => {
|
|
17
|
-
const c =
|
|
17
|
+
const c = F(l);
|
|
18
18
|
if (c && (c.type === "ui_spec" && i.uiSpecs.push(c.spec), c.type === "ui_spec" && c.spec.elements)) {
|
|
19
19
|
for (const d of Object.values(c.spec.elements)) if (d.type === "ActionButton" && d.props?.action) {
|
|
20
20
|
const m = d.props.action;
|
|
@@ -22,9 +22,9 @@ async function et(t, n, e) {
|
|
|
22
22
|
}
|
|
23
23
|
}
|
|
24
24
|
} };
|
|
25
|
-
return e !== void 0 && (r.signal = e), await
|
|
25
|
+
return e !== void 0 && (r.signal = e), await O(s, r), i;
|
|
26
26
|
}
|
|
27
|
-
function
|
|
27
|
+
function k(t) {
|
|
28
28
|
const n = document.createElement("div");
|
|
29
29
|
n.className = "gengage-qna-buttons gds-toolbar", n.dataset.gengagePart = "qna-button-row", n.setAttribute("role", "group"), n.setAttribute("aria-label", t.quickQuestionsAriaLabel ?? "Quick questions"), t.orientation === "vertical" && (n.style.flexDirection = "column");
|
|
30
30
|
for (const e of t.actions) {
|
|
@@ -45,7 +45,7 @@ function C(t) {
|
|
|
45
45
|
}
|
|
46
46
|
return n;
|
|
47
47
|
}
|
|
48
|
-
function
|
|
48
|
+
function ot(t) {
|
|
49
49
|
const n = document.createElement("div");
|
|
50
50
|
n.className = "gengage-qna-input-wrapper", n.dataset.gengagePart = "qna-input-wrapper";
|
|
51
51
|
const e = document.createElement("div");
|
|
@@ -118,7 +118,7 @@ function S(t) {
|
|
|
118
118
|
};
|
|
119
119
|
return t.payload !== void 0 && (n.payload = t.payload), n;
|
|
120
120
|
}
|
|
121
|
-
function
|
|
121
|
+
function I(t, n) {
|
|
122
122
|
const e = [], o = t.props?.actions;
|
|
123
123
|
if (Array.isArray(o)) for (const s of o) {
|
|
124
124
|
const r = q(s);
|
|
@@ -139,24 +139,24 @@ function k(t, n) {
|
|
|
139
139
|
const a = /* @__PURE__ */ new Set();
|
|
140
140
|
return e.filter((s) => a.has(s.title) ? !1 : (a.add(s.title), !0));
|
|
141
141
|
}
|
|
142
|
-
var
|
|
142
|
+
var x = {
|
|
143
143
|
ButtonRow: ({ element: t, spec: n, context: e }) => {
|
|
144
|
-
const o =
|
|
144
|
+
const o = I(t, n).map(S), i = t.props?.orientation, a = {
|
|
145
145
|
actions: o,
|
|
146
146
|
onAction: e.onAction,
|
|
147
147
|
defaultCtaText: e.i18n.defaultCtaText,
|
|
148
148
|
quickQuestionsAriaLabel: e.i18n.quickQuestionsAriaLabel
|
|
149
149
|
};
|
|
150
|
-
return e.onOpenChat !== void 0 && (a.onOpenChat = e.onOpenChat), e.ctaText !== void 0 && (a.ctaText = e.ctaText), (i === "horizontal" || i === "vertical") && (a.orientation = i),
|
|
150
|
+
return e.onOpenChat !== void 0 && (a.onOpenChat = e.onOpenChat), e.ctaText !== void 0 && (a.ctaText = e.ctaText), (i === "horizontal" || i === "vertical") && (a.orientation = i), k(a);
|
|
151
151
|
},
|
|
152
152
|
ActionButtons: ({ element: t, spec: n, context: e }) => {
|
|
153
153
|
const o = {
|
|
154
|
-
actions:
|
|
154
|
+
actions: I(t, n).map(S),
|
|
155
155
|
onAction: e.onAction,
|
|
156
156
|
defaultCtaText: e.i18n.defaultCtaText,
|
|
157
157
|
quickQuestionsAriaLabel: e.i18n.quickQuestionsAriaLabel
|
|
158
158
|
};
|
|
159
|
-
return e.onOpenChat !== void 0 && (o.onOpenChat = e.onOpenChat), e.ctaText !== void 0 && (o.ctaText = e.ctaText),
|
|
159
|
+
return e.onOpenChat !== void 0 && (o.onOpenChat = e.onOpenChat), e.ctaText !== void 0 && (o.ctaText = e.ctaText), k(o);
|
|
160
160
|
},
|
|
161
161
|
ActionButton: ({ element: t, context: n }) => {
|
|
162
162
|
const e = document.createElement("button");
|
|
@@ -174,7 +174,7 @@ var P = {
|
|
|
174
174
|
sendButtonText: n.i18n.sendButton,
|
|
175
175
|
sendQuestionAriaLabel: n.i18n.sendQuestionAriaLabel
|
|
176
176
|
};
|
|
177
|
-
return o !== void 0 && (a.placeholders = o), i !== void 0 && (a.ctaLabel = i),
|
|
177
|
+
return o !== void 0 && (a.placeholders = o), i !== void 0 && (a.ctaLabel = i), ot(a);
|
|
178
178
|
},
|
|
179
179
|
QuestionHeading: ({ element: t, context: n }) => {
|
|
180
180
|
const e = document.createElement("h3");
|
|
@@ -183,7 +183,7 @@ var P = {
|
|
|
183
183
|
return e.textContent = typeof i == "string" && i.trim().length > 0 ? i : typeof o == "string" ? o : "", e;
|
|
184
184
|
},
|
|
185
185
|
ProductCard: () => null
|
|
186
|
-
},
|
|
186
|
+
}, B = ({ element: t, renderElement: n }) => {
|
|
187
187
|
if (!t.children || t.children.length === 0) return null;
|
|
188
188
|
const e = document.createElement("div");
|
|
189
189
|
for (const o of t.children) {
|
|
@@ -192,11 +192,11 @@ var P = {
|
|
|
192
192
|
}
|
|
193
193
|
return e;
|
|
194
194
|
};
|
|
195
|
-
function
|
|
196
|
-
return { ...
|
|
195
|
+
function it() {
|
|
196
|
+
return { ...x };
|
|
197
197
|
}
|
|
198
|
-
function
|
|
199
|
-
return
|
|
198
|
+
function at(t, n, e = x, o = B) {
|
|
199
|
+
return $({
|
|
200
200
|
spec: t,
|
|
201
201
|
context: n,
|
|
202
202
|
registry: e,
|
|
@@ -204,7 +204,7 @@ function it(t, n, e = P, o = x) {
|
|
|
204
204
|
unknownRenderer: o
|
|
205
205
|
});
|
|
206
206
|
}
|
|
207
|
-
function
|
|
207
|
+
function st(t) {
|
|
208
208
|
if (!t) return;
|
|
209
209
|
const n = t.extra;
|
|
210
210
|
if (n && typeof n == "object" && !Array.isArray(n)) {
|
|
@@ -217,7 +217,7 @@ function at(t) {
|
|
|
217
217
|
const e = typeof t.sku == "string" && t.sku.trim() ? t.sku.trim() : void 0;
|
|
218
218
|
return e ? [e] : void 0;
|
|
219
219
|
}
|
|
220
|
-
function
|
|
220
|
+
function Q(t, n) {
|
|
221
221
|
if (!t) return null;
|
|
222
222
|
const e = t.action;
|
|
223
223
|
if (!e || typeof e != "object") return null;
|
|
@@ -231,7 +231,7 @@ function B(t, n) {
|
|
|
231
231
|
};
|
|
232
232
|
return r !== void 0 && (l.payload = r), l;
|
|
233
233
|
}
|
|
234
|
-
function
|
|
234
|
+
function rt(t, n) {
|
|
235
235
|
const e = t.elements[t.root];
|
|
236
236
|
if (!e) return !1;
|
|
237
237
|
const o = (i) => {
|
|
@@ -239,7 +239,7 @@ function st(t, n) {
|
|
|
239
239
|
const a = i.props;
|
|
240
240
|
if (!a || typeof a != "object") return !1;
|
|
241
241
|
const s = typeof a.label == "string" ? a.label : void 0;
|
|
242
|
-
return s === n ? !0 :
|
|
242
|
+
return s === n ? !0 : Q(a, s)?.title === n;
|
|
243
243
|
};
|
|
244
244
|
if (e.type === "ActionButton") return o(e);
|
|
245
245
|
if (e.children) for (const i of e.children) {
|
|
@@ -252,14 +252,14 @@ function st(t, n) {
|
|
|
252
252
|
}
|
|
253
253
|
return !1;
|
|
254
254
|
}
|
|
255
|
-
var
|
|
256
|
-
function
|
|
257
|
-
return
|
|
255
|
+
var w = 0;
|
|
256
|
+
function R() {
|
|
257
|
+
return w += 1, `gengage-merge-${w}`;
|
|
258
258
|
}
|
|
259
|
-
function
|
|
259
|
+
function lt(t, n) {
|
|
260
260
|
const e = t.elements[t.root];
|
|
261
261
|
if (!e || e.type !== "ButtonRow") return;
|
|
262
|
-
const o =
|
|
262
|
+
const o = R();
|
|
263
263
|
t.elements[o] = {
|
|
264
264
|
type: "ActionButton",
|
|
265
265
|
props: {
|
|
@@ -272,10 +272,10 @@ function rt(t, n) {
|
|
|
272
272
|
}
|
|
273
273
|
}, e.children = e.children ? [o, ...e.children] : [o];
|
|
274
274
|
}
|
|
275
|
-
function
|
|
275
|
+
function ct(t, n) {
|
|
276
276
|
const e = t.elements[t.root];
|
|
277
277
|
if (!e || e.type !== "ActionButtons") return;
|
|
278
|
-
const o =
|
|
278
|
+
const o = R();
|
|
279
279
|
t.elements[o] = {
|
|
280
280
|
type: "ActionButton",
|
|
281
281
|
props: {
|
|
@@ -300,7 +300,7 @@ function lt(t, n) {
|
|
|
300
300
|
buttons: [a, ...i]
|
|
301
301
|
};
|
|
302
302
|
}
|
|
303
|
-
function
|
|
303
|
+
function dt(t) {
|
|
304
304
|
const n = {}, e = [];
|
|
305
305
|
for (let o = 0; o < t.length; o++) {
|
|
306
306
|
const i = t[o], a = `action-${o}`;
|
|
@@ -324,13 +324,13 @@ function ct(t) {
|
|
|
324
324
|
elements: n
|
|
325
325
|
};
|
|
326
326
|
}
|
|
327
|
-
function
|
|
327
|
+
function ut(t) {
|
|
328
328
|
return t.find((n) => {
|
|
329
329
|
const e = n.elements[n.root];
|
|
330
330
|
return e?.type === "ActionButtons" || e?.type === "ButtonRow";
|
|
331
331
|
});
|
|
332
332
|
}
|
|
333
|
-
function
|
|
333
|
+
function L(t, n) {
|
|
334
334
|
const e = t.productContextQuickPillLabel, o = { text: e };
|
|
335
335
|
return n && n.length > 0 && (o.sku_list = n), {
|
|
336
336
|
title: e,
|
|
@@ -338,29 +338,29 @@ function w(t, n) {
|
|
|
338
338
|
payload: o
|
|
339
339
|
};
|
|
340
340
|
}
|
|
341
|
-
function
|
|
341
|
+
function pt(t, n, e) {
|
|
342
342
|
const o = e?.skuList, i = [], a = [];
|
|
343
343
|
for (const l of t) {
|
|
344
344
|
const c = l.elements[l.root];
|
|
345
345
|
if (c?.type === "ActionButton") {
|
|
346
346
|
const d = c.props;
|
|
347
|
-
if (
|
|
348
|
-
i.push(
|
|
347
|
+
if (Q(d, typeof d?.label == "string" ? d.label : void 0)?.type === "findSimilar") {
|
|
348
|
+
i.push(L(n, o));
|
|
349
349
|
continue;
|
|
350
350
|
}
|
|
351
351
|
}
|
|
352
352
|
a.push(l);
|
|
353
353
|
}
|
|
354
354
|
if (i.length === 0) return t;
|
|
355
|
-
const s =
|
|
356
|
-
if (!r) return [...a,
|
|
357
|
-
if (!
|
|
355
|
+
const s = L(n, o), r = ut(a);
|
|
356
|
+
if (!r) return [...a, dt([s])];
|
|
357
|
+
if (!rt(r, s.title)) {
|
|
358
358
|
const l = r.elements[r.root];
|
|
359
|
-
l?.type === "ActionButtons" ?
|
|
359
|
+
l?.type === "ActionButtons" ? ct(r, s) : l?.type === "ButtonRow" && lt(r, s);
|
|
360
360
|
}
|
|
361
361
|
return a;
|
|
362
362
|
}
|
|
363
|
-
var
|
|
363
|
+
var N = {
|
|
364
364
|
quickQuestionsAriaLabel: "Hızlı sorular",
|
|
365
365
|
askQuestionAriaLabel: "Soru sorun",
|
|
366
366
|
defaultInputPlaceholder: "Bir soru sorun...",
|
|
@@ -369,7 +369,7 @@ var R = {
|
|
|
369
369
|
defaultCtaText: "Başka bir şey sor",
|
|
370
370
|
redirectingToChat: "Sohbete yönlendiriliyor...",
|
|
371
371
|
productContextQuickPillLabel: "Bu ürün hakkında ne bilmeliyim?"
|
|
372
|
-
},
|
|
372
|
+
}, ht = {
|
|
373
373
|
quickQuestionsAriaLabel: "Quick questions",
|
|
374
374
|
askQuestionAriaLabel: "Ask a question",
|
|
375
375
|
defaultInputPlaceholder: "Ask a question...",
|
|
@@ -379,55 +379,55 @@ var R = {
|
|
|
379
379
|
redirectingToChat: "Redirecting to chat...",
|
|
380
380
|
productContextQuickPillLabel: "What should I know about this product?"
|
|
381
381
|
};
|
|
382
|
-
function
|
|
382
|
+
function gt(t) {
|
|
383
383
|
return t ? t.toLowerCase().split("-")[0] ?? "tr" : "tr";
|
|
384
384
|
}
|
|
385
|
-
function
|
|
386
|
-
return
|
|
385
|
+
function ft(t) {
|
|
386
|
+
return gt(t) === "en" ? ht : N;
|
|
387
387
|
}
|
|
388
|
-
var
|
|
388
|
+
var yt = A({
|
|
389
389
|
title: _(),
|
|
390
390
|
type: _(),
|
|
391
|
-
payload:
|
|
392
|
-
}),
|
|
391
|
+
payload: W().optional()
|
|
392
|
+
}), mt = A({
|
|
393
393
|
label: _(),
|
|
394
|
-
action:
|
|
395
|
-
variant:
|
|
394
|
+
action: yt,
|
|
395
|
+
variant: P([
|
|
396
396
|
"primary",
|
|
397
397
|
"outline",
|
|
398
398
|
"ghost"
|
|
399
399
|
]).optional()
|
|
400
|
-
}), mt = A({
|
|
401
|
-
orientation: L(["horizontal", "vertical"]).optional(),
|
|
402
|
-
wrap: D().optional()
|
|
403
400
|
}), bt = A({
|
|
404
|
-
|
|
401
|
+
orientation: P(["horizontal", "vertical"]).optional(),
|
|
402
|
+
wrap: D().optional()
|
|
403
|
+
}), _t = A({
|
|
404
|
+
placeholder: j([_(), M(_())]).optional(),
|
|
405
405
|
ctaLabel: _().optional()
|
|
406
|
-
}),
|
|
406
|
+
}), vt = A({ text: _() }), Ct = { components: {
|
|
407
407
|
ActionButton: {
|
|
408
|
-
schema:
|
|
408
|
+
schema: mt,
|
|
409
409
|
description: "A single clickable QNA action button."
|
|
410
410
|
},
|
|
411
411
|
ButtonRow: {
|
|
412
|
-
schema:
|
|
412
|
+
schema: bt,
|
|
413
413
|
description: "Container for a group of QNA action buttons."
|
|
414
414
|
},
|
|
415
415
|
TextInput: {
|
|
416
|
-
schema:
|
|
416
|
+
schema: _t,
|
|
417
417
|
description: "Free-text input with rotating placeholder and CTA button."
|
|
418
418
|
},
|
|
419
419
|
QuestionHeading: {
|
|
420
|
-
schema:
|
|
420
|
+
schema: vt,
|
|
421
421
|
description: "A heading displayed above the QNA button group."
|
|
422
422
|
}
|
|
423
|
-
} },
|
|
423
|
+
} }, At = class extends V {
|
|
424
424
|
constructor(...t) {
|
|
425
|
-
super(...t), this._abortController = null, this._debounceTimer = null, this._contentEl = null, this._i18n =
|
|
425
|
+
super(...t), this._abortController = null, this._debounceTimer = null, this._contentEl = null, this._i18n = N, this._actionHandler = this._handleAction.bind(this), this._openChatHandler = this._handleOpenChat.bind(this);
|
|
426
426
|
}
|
|
427
427
|
async onInit(t) {
|
|
428
|
-
this._i18n = this._resolveI18n(t), this._contentEl = document.createElement("div"), this._contentEl.className = "gengage-qna-container", this._contentEl.dataset.gengagePart = "qna-container", this.root.appendChild(this._contentEl);
|
|
428
|
+
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 = C(t.locale), this.root.appendChild(this._contentEl);
|
|
429
429
|
const n = t.pageContext?.sku;
|
|
430
|
-
n && (this._lastSku = n, await this._fetchAndRender(n)),
|
|
430
|
+
n && (this._lastSku = n, await this._fetchAndRender(n)), Y("qna");
|
|
431
431
|
}
|
|
432
432
|
onUpdate(t) {
|
|
433
433
|
const n = t.sku;
|
|
@@ -464,7 +464,7 @@ var ft = A({
|
|
|
464
464
|
this._cleanupTextInputTimers(), this._contentEl.innerHTML = "";
|
|
465
465
|
const n = this._createLoadingIndicator();
|
|
466
466
|
this._contentEl.appendChild(n);
|
|
467
|
-
const e = { middlewareUrl: this.config.middlewareUrl }, o = crypto.randomUUID(), i = Date.now(), a =
|
|
467
|
+
const e = { middlewareUrl: this.config.middlewareUrl }, o = crypto.randomUUID(), i = Date.now(), a = et({
|
|
468
468
|
source: "qna",
|
|
469
469
|
locale: this.config.locale
|
|
470
470
|
});
|
|
@@ -479,16 +479,16 @@ var ft = A({
|
|
|
479
479
|
session_id: this.config.session?.sessionId ?? "",
|
|
480
480
|
correlation_id: this.config.session?.sessionId ?? "",
|
|
481
481
|
sku: t,
|
|
482
|
-
locale: this.config.locale
|
|
482
|
+
locale: C(this.config.locale)
|
|
483
483
|
}, r = this.config.pageContext?.pageType;
|
|
484
484
|
r !== void 0 && (s.page_type = r);
|
|
485
|
-
const l = await
|
|
486
|
-
if (this.track(
|
|
485
|
+
const l = await nt(s, e, this._abortController.signal);
|
|
486
|
+
if (this.track(J(this.analyticsContext(), {
|
|
487
487
|
request_id: o,
|
|
488
488
|
latency_ms: Date.now() - i,
|
|
489
489
|
chunk_count: l.actions.length,
|
|
490
490
|
widget: "qna"
|
|
491
|
-
})), this.track(
|
|
491
|
+
})), this.track(tt(this.analyticsContext(), {
|
|
492
492
|
message_count: l.actions.length,
|
|
493
493
|
history_ref: o,
|
|
494
494
|
redaction_level: "none",
|
|
@@ -514,18 +514,18 @@ var ft = A({
|
|
|
514
514
|
i18n: this._i18n
|
|
515
515
|
}, h = this._resolvedQnaHeaderTitle();
|
|
516
516
|
h !== void 0 && (p.headingTitleOverride = h), this.config.hideButtonRowCta || (p.onOpenChat = this._openChatHandler, this.config.ctaText !== void 0 && (p.ctaText = this.config.ctaText)), g !== void 0 && (p.inputPlaceholder = g);
|
|
517
|
-
const b = this._buildFallbackActionsSpec(l.actions), T =
|
|
517
|
+
const b = this._buildFallbackActionsSpec(l.actions), T = st(this.config.pageContext), u = (l.uiSpecs.length > 0 ? pt(l.uiSpecs, this._i18n, { skuList: T }) : [b]).filter((f) => Object.keys(f.elements).length > 0);
|
|
518
518
|
for (const f of u) {
|
|
519
519
|
const v = this._renderUISpec(f, p);
|
|
520
520
|
c.appendChild(v);
|
|
521
521
|
}
|
|
522
|
-
u.length > 0 &&
|
|
522
|
+
u.length > 0 && X("qna"), this._specIncludesType(u, "TextInput") || this._insertStandaloneInputBeforePills(c, p, g);
|
|
523
523
|
} catch (s) {
|
|
524
524
|
if (s instanceof DOMException && s.name === "AbortError") return;
|
|
525
525
|
if (E("gengage:global:error", {
|
|
526
526
|
source: "qna",
|
|
527
527
|
code: "FETCH_ERROR",
|
|
528
|
-
message:
|
|
528
|
+
message: G(this.config.locale, s)
|
|
529
529
|
}), this.track(Z(this.analyticsContext(), {
|
|
530
530
|
request_id: o,
|
|
531
531
|
error_code: "FETCH_ERROR",
|
|
@@ -557,15 +557,15 @@ var ft = A({
|
|
|
557
557
|
}
|
|
558
558
|
_resolveI18n(t) {
|
|
559
559
|
return {
|
|
560
|
-
...
|
|
560
|
+
...ft(t.locale),
|
|
561
561
|
...t.i18n
|
|
562
562
|
};
|
|
563
563
|
}
|
|
564
564
|
_resolveUISpecRegistry() {
|
|
565
|
-
return
|
|
565
|
+
return H(it(), this.config.renderer?.registry);
|
|
566
566
|
}
|
|
567
567
|
_renderUISpec(t, n) {
|
|
568
|
-
const e = this._resolveUISpecRegistry(), o = this.config.renderer?.unknownRenderer ??
|
|
568
|
+
const e = this._resolveUISpecRegistry(), o = this.config.renderer?.unknownRenderer ?? B, i = (s, r) => at(s, r, e, o), a = this.config.renderer?.renderUISpec;
|
|
569
569
|
return a ? a(t, n, {
|
|
570
570
|
registry: e,
|
|
571
571
|
unknownRenderer: o,
|
|
@@ -636,7 +636,7 @@ var ft = A({
|
|
|
636
636
|
(e ?? this._contentEl).appendChild(i);
|
|
637
637
|
}
|
|
638
638
|
_handleAction(t) {
|
|
639
|
-
this._showTransitionIndicator(),
|
|
639
|
+
this._showTransitionIndicator(), K(t.title, t.type), this.config.onActionSelected?.(t), setTimeout(() => E("gengage:qna:action", t), 350);
|
|
640
640
|
}
|
|
641
641
|
_handleOpenChat() {
|
|
642
642
|
this._showTransitionIndicator(), this.config.onOpenChat?.(), setTimeout(() => E("gengage:qna:open-chat", {}), 350);
|
|
@@ -650,14 +650,14 @@ var ft = A({
|
|
|
650
650
|
}, 600);
|
|
651
651
|
}
|
|
652
652
|
};
|
|
653
|
-
function
|
|
654
|
-
return new
|
|
653
|
+
function kt() {
|
|
654
|
+
return new At();
|
|
655
655
|
}
|
|
656
656
|
export {
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
657
|
+
B as a,
|
|
658
|
+
it as i,
|
|
659
|
+
kt as n,
|
|
660
|
+
at as o,
|
|
661
|
+
Ct as r,
|
|
662
|
+
At as t
|
|
663
663
|
};
|