@searchstax-inc/searchstudio-ux-vue 0.0.3
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/README.md +164 -0
- package/dist/App.vue.d.ts +2 -0
- package/dist/components/SearchstaxInputWidget.vue.d.ts +60 -0
- package/dist/components/SearchstaxInputWidget.vue.d.ts.map +1 -0
- package/dist/components/SearchstaxResultWidget.vue.d.ts +135 -0
- package/dist/components/SearchstaxResultWidget.vue.d.ts.map +1 -0
- package/dist/components/SearchstaxWrapper.vue.d.ts +76 -0
- package/dist/components/SearchstaxWrapper.vue.d.ts.map +1 -0
- package/dist/favicon.ico +0 -0
- package/dist/main.d.ts +7 -0
- package/dist/searchstudio-ux-vue-ts.cjs.js +69 -0
- package/dist/searchstudio-ux-vue-ts.es.js +1230 -0
- package/dist/searchstudio-ux-vue-ts.umd.js +69 -0
- package/dist/stores/searchstaxStore.d.ts +109 -0
- package/dist/style.css +1 -0
- package/package.json +55 -0
|
@@ -0,0 +1,1230 @@
|
|
|
1
|
+
import { reactive as X, defineComponent as U, renderSlot as B, openBlock as g, createElementBlock as d, createElementVNode as p, createCommentVNode as b, createTextVNode as O, toDisplayString as A, Fragment as D, renderList as N } from "vue";
|
|
2
|
+
var J = Object.defineProperty, Y = (s, e, t) => e in s ? J(s, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : s[e] = t, h = (s, e, t) => (Y(s, typeof e != "symbol" ? e + "" : e, t), t);
|
|
3
|
+
class V {
|
|
4
|
+
constructor(e) {
|
|
5
|
+
h(this, "value"), h(this, "observers", []), this.value = e, this.observers = [];
|
|
6
|
+
}
|
|
7
|
+
subscribe(e) {
|
|
8
|
+
this.observers.push(e), e(this.value);
|
|
9
|
+
}
|
|
10
|
+
unsubscribe(e) {
|
|
11
|
+
const t = this.observers.indexOf(e);
|
|
12
|
+
t !== -1 && this.observers.splice(t, 1);
|
|
13
|
+
}
|
|
14
|
+
setValue(e) {
|
|
15
|
+
this.value = e, this.notify();
|
|
16
|
+
}
|
|
17
|
+
getValue() {
|
|
18
|
+
return this.value;
|
|
19
|
+
}
|
|
20
|
+
notify() {
|
|
21
|
+
this.observers.forEach((e) => e(this.value));
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
class Z {
|
|
25
|
+
constructor() {
|
|
26
|
+
h(this, "searchTermChangeObservable", new V("")), h(this, "loadingChangeObservable", new V(!1)), h(this, "searchResultsObservable", new V(null)), h(this, "searchResultsMetadataObservable", new V(null)), h(this, "searchAutosuggestObservable", new V(null)), h(this, "currentPage", 1), h(this, "renderingEngine", "mustache");
|
|
27
|
+
}
|
|
28
|
+
setSearchTerm(e) {
|
|
29
|
+
this.searchTermChangeObservable.setValue(e);
|
|
30
|
+
}
|
|
31
|
+
setRenderingEngine(e) {
|
|
32
|
+
this.renderingEngine = e;
|
|
33
|
+
}
|
|
34
|
+
setCurrentPage(e) {
|
|
35
|
+
this.currentPage = e;
|
|
36
|
+
}
|
|
37
|
+
setLoading(e) {
|
|
38
|
+
this.loadingChangeObservable.setValue(e);
|
|
39
|
+
}
|
|
40
|
+
setSearchResults(e) {
|
|
41
|
+
this.searchResultsObservable.setValue(e);
|
|
42
|
+
}
|
|
43
|
+
setSearchResultsMetadata(e) {
|
|
44
|
+
this.searchResultsMetadataObservable.setValue(e);
|
|
45
|
+
}
|
|
46
|
+
setSearchAutosuggest(e) {
|
|
47
|
+
this.searchAutosuggestObservable.setValue(e);
|
|
48
|
+
}
|
|
49
|
+
get searchResultsValue() {
|
|
50
|
+
return this.searchResultsObservable.getValue();
|
|
51
|
+
}
|
|
52
|
+
get searchTermValue() {
|
|
53
|
+
return this.searchTermChangeObservable.getValue();
|
|
54
|
+
}
|
|
55
|
+
get loadingValue() {
|
|
56
|
+
return this.loadingChangeObservable.getValue();
|
|
57
|
+
}
|
|
58
|
+
get searchAutosuggestValue() {
|
|
59
|
+
return this.searchAutosuggestObservable.getValue();
|
|
60
|
+
}
|
|
61
|
+
get searchResultsMetadataValue() {
|
|
62
|
+
return this.searchResultsMetadataObservable.getValue();
|
|
63
|
+
}
|
|
64
|
+
get currentPageValue() {
|
|
65
|
+
return this.currentPage;
|
|
66
|
+
}
|
|
67
|
+
get renderingEngineValue() {
|
|
68
|
+
return this.renderingEngine;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
class P {
|
|
72
|
+
static combineResultsWithMetadata(e) {
|
|
73
|
+
const t = [], r = parseInt(e.response.start + "");
|
|
74
|
+
return e.response.docs.forEach((a, i) => {
|
|
75
|
+
const n = {
|
|
76
|
+
custom: null,
|
|
77
|
+
uniqueId: this.getValueByKey(
|
|
78
|
+
e.responseHeader.params.uniqueId,
|
|
79
|
+
a,
|
|
80
|
+
e
|
|
81
|
+
) ?? "",
|
|
82
|
+
position: r + i + 1,
|
|
83
|
+
ribbon: this.doesMapExist("ribbon", e) ? this.getValueByKey("ribbon", a, e) : null,
|
|
84
|
+
paths: this.doesMapExist("paths", e) ? this.getValueByKey("paths", a, e) : null,
|
|
85
|
+
url: this.doesMapExist("url", e) ? this.getValueByKey("url", a, e) : null,
|
|
86
|
+
title: this.doesMapExist("title", e) ? this.getValueByKey("title", a, e) : null,
|
|
87
|
+
promoted: a["[elevated]"] ? a["[elevated]"] : !1,
|
|
88
|
+
thumbnail: this.doesMapExist("thumbnail", e) ? this.getValueByKey("thumbnail", a, e) : null,
|
|
89
|
+
date: this.doesMapExist("date", e) ? this.getValueByKey("date", a, e) : null,
|
|
90
|
+
snippet: this.doesMapExist("snippet", e) ? this.getValueByKey("snippet", a, e) : null,
|
|
91
|
+
description: this.doesMapExist("description", e) ? this.getValueByKey("description", a, e) : null,
|
|
92
|
+
unmappedFields: this.getUnmappedFields(a, e),
|
|
93
|
+
allFields: this.getAllFields(a, e)
|
|
94
|
+
};
|
|
95
|
+
t.push(n);
|
|
96
|
+
}), t;
|
|
97
|
+
}
|
|
98
|
+
static extractSearchResultsMetadata(e) {
|
|
99
|
+
var t, r, a, i;
|
|
100
|
+
let n = "";
|
|
101
|
+
return n = ((i = (a = (r = (t = e == null ? void 0 : e.spellcheck) == null ? void 0 : t.suggestions) == null ? void 0 : r[0]) == null ? void 0 : a.suggestion) == null ? void 0 : i[0]) ?? "", typeof n != "string" && (n = (n == null ? void 0 : n.word) ?? ""), {
|
|
102
|
+
recordsPerPageValue: parseInt(e.responseHeader.params.rows),
|
|
103
|
+
startDocVal: parseInt(e.response.start + ""),
|
|
104
|
+
totalResultsValue: parseInt(e.response.numFound + ""),
|
|
105
|
+
latency: parseInt(e.responseHeader.QTime + ""),
|
|
106
|
+
endDocValue: parseInt(e.responseHeader.params.rows) + parseInt(e.response.start + ""),
|
|
107
|
+
spellingSuggestion: n
|
|
108
|
+
};
|
|
109
|
+
}
|
|
110
|
+
static findResultByUniqueId(e, t) {
|
|
111
|
+
return t.find((r) => r.uniqueId === e) ?? null;
|
|
112
|
+
}
|
|
113
|
+
static getUnmappedFields(e, t) {
|
|
114
|
+
const r = t.metadata.results.filter((i) => i.result_card === "").map((i) => i.name), a = [];
|
|
115
|
+
for (const i of Object.keys(e))
|
|
116
|
+
if (r.indexOf(i) !== -1) {
|
|
117
|
+
const n = Array.isArray(e[i]) ? e[i].join(", ") : e[i];
|
|
118
|
+
a.push({
|
|
119
|
+
key: i,
|
|
120
|
+
value: n,
|
|
121
|
+
isImage: this.checkIfImage(e[i])
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
return a;
|
|
125
|
+
}
|
|
126
|
+
static checkIfImage(e) {
|
|
127
|
+
return e === void 0 || typeof e != "string" ? !1 : /\.(gif|jpe?g|tiff?|png|webp|bmp)$/i.test(e);
|
|
128
|
+
}
|
|
129
|
+
static getAllFields(e, t) {
|
|
130
|
+
const r = t.metadata.results.map((i) => i.name), a = [];
|
|
131
|
+
for (const i of Object.keys(e))
|
|
132
|
+
r.indexOf(i) !== -1 && a.push({
|
|
133
|
+
key: i,
|
|
134
|
+
value: e[i],
|
|
135
|
+
isImage: this.checkIfImage(e[i])
|
|
136
|
+
});
|
|
137
|
+
return a;
|
|
138
|
+
}
|
|
139
|
+
static doesMapExist(e, t) {
|
|
140
|
+
return t.metadata.results.find((r) => r.result_card === e) !== void 0;
|
|
141
|
+
}
|
|
142
|
+
static getValueByKey(e, t, r) {
|
|
143
|
+
const a = r.metadata.results.find(
|
|
144
|
+
(n) => n.result_card === e
|
|
145
|
+
);
|
|
146
|
+
if (a === void 0)
|
|
147
|
+
return null;
|
|
148
|
+
const i = t[a.name];
|
|
149
|
+
return i === void 0 ? null : typeof i == "string" ? i : Array.isArray(i) ? i.join(", ") : null;
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
class ee {
|
|
153
|
+
constructor(e, t) {
|
|
154
|
+
h(this, "url", ""), h(this, "relatedSearches", ""), h(this, "suggester", ""), h(this, "authHeader"), h(this, "authHeaderRelated"), h(this, "language", "en"), h(this, "trackApiKey", ""), h(this, "session", ""), h(this, "searchAdditionalArgs", ""), h(this, "searchAuthType"), h(this, "selectAuthToken"), h(this, "suggesterAuthToken"), h(this, "controllerSearch"), h(this, "signalSearch"), h(this, "controllerSuggest"), h(this, "signalSuggest"), h(this, "dataLayer"), this.dataLayer = t, this.url = e.searchURL, this.language = e.language, this.suggester = e.suggesterURL, this.trackApiKey = e.trackApiKey, this.session = e.sessionId, this.searchAuthType = e.authType, this.selectAuthToken = e.searchToken ?? "", this.suggesterAuthToken = e.suggesterToken ?? "", this.authHeader = new Headers(), this.authHeader.append("Accept", "application/json");
|
|
155
|
+
const r = this.searchAuthType === "token" ? `Token ${this.suggesterAuthToken}` : `Basic ${e.authenticationValue}`;
|
|
156
|
+
this.authHeader.append("Authorization", r), this.authHeaderRelated = new Headers(), this.authHeaderRelated.append("Accept", "application/json"), this.authHeaderRelated.append("Authorization", e.searchApiKey);
|
|
157
|
+
}
|
|
158
|
+
search(e, t, r) {
|
|
159
|
+
this.dataLayer.setSearchTerm(e), this.dataLayer.setLoading(!0), this.controllerSearch && this.controllerSearch.abort(), this.controllerSearch = new AbortController(), this.signalSearch = this.controllerSearch.signal;
|
|
160
|
+
const a = new Proxy(
|
|
161
|
+
new URLSearchParams(window.location.search),
|
|
162
|
+
{
|
|
163
|
+
get: (o, u) => o.get(u) ?? ""
|
|
164
|
+
}
|
|
165
|
+
), i = a.languageVariant ? (
|
|
166
|
+
//@ts-expect-error - this is a hack to get around the fact that the urlQueryParams is a proxy
|
|
167
|
+
"&fq=_language:" + a.languageVariant
|
|
168
|
+
) : "", n = this.url + "?q=" + encodeURIComponent(e.trim()) + this.toQueryString(r) + this.searchAdditionalArgs + "&language=" + this.language + i;
|
|
169
|
+
fetch(n, {
|
|
170
|
+
method: "GET",
|
|
171
|
+
headers: this.authHeader,
|
|
172
|
+
credentials: "same-origin",
|
|
173
|
+
signal: this.signalSearch
|
|
174
|
+
}).then((o) => o.json()).then((o) => {
|
|
175
|
+
this.dataLayer.setLoading(!1), t(o);
|
|
176
|
+
}).catch((o) => {
|
|
177
|
+
this.dataLayer.setLoading(!1), console.log(o);
|
|
178
|
+
});
|
|
179
|
+
}
|
|
180
|
+
suggest(e, t, r) {
|
|
181
|
+
this.controllerSuggest && this.controllerSuggest.abort(), this.controllerSuggest = new AbortController(), this.signalSuggest = this.controllerSuggest.signal;
|
|
182
|
+
const a = this.suggester + "?q=" + e.trim() + this.toQueryString(r) + "&language=" + this.language;
|
|
183
|
+
fetch(a, {
|
|
184
|
+
method: "GET",
|
|
185
|
+
headers: this.authHeader,
|
|
186
|
+
credentials: "same-origin",
|
|
187
|
+
signal: this.signalSuggest
|
|
188
|
+
}).then((i) => i.json()).then((i) => {
|
|
189
|
+
t(i);
|
|
190
|
+
}).catch((i) => console.log(i));
|
|
191
|
+
}
|
|
192
|
+
fields() {
|
|
193
|
+
return this.fields;
|
|
194
|
+
}
|
|
195
|
+
toQueryString(e) {
|
|
196
|
+
return "&" + e.join("&");
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
class te {
|
|
200
|
+
static getOrSetCookie(e) {
|
|
201
|
+
let t = this.getCookie(e);
|
|
202
|
+
return t == null && (t = this.makeid(25), this.setCookie(e, t, {
|
|
203
|
+
secure: !0,
|
|
204
|
+
"max-age": 3600
|
|
205
|
+
})), t;
|
|
206
|
+
}
|
|
207
|
+
static makeid(e) {
|
|
208
|
+
let t = "";
|
|
209
|
+
const r = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789", a = r.length;
|
|
210
|
+
for (let i = 0; i < e; i++)
|
|
211
|
+
t += r.charAt(Math.floor(Math.random() * a));
|
|
212
|
+
return t;
|
|
213
|
+
}
|
|
214
|
+
static getCookie(e) {
|
|
215
|
+
const t = document.cookie.match(
|
|
216
|
+
new RegExp(
|
|
217
|
+
"(?:^|; )" + e.replace(/([.$?*|{}()[\]\\/+^])/g, "\\$1") + "=([^;]*)"
|
|
218
|
+
)
|
|
219
|
+
);
|
|
220
|
+
return t ? decodeURIComponent(t[1]) : void 0;
|
|
221
|
+
}
|
|
222
|
+
static setCookie(e, t, r) {
|
|
223
|
+
const a = { path: "/", ...r };
|
|
224
|
+
r.expires instanceof Date && (a.expires = r.expires.toUTCString());
|
|
225
|
+
let i = encodeURIComponent(e) + "=" + encodeURIComponent(t);
|
|
226
|
+
for (const n in a) {
|
|
227
|
+
i += "; " + n;
|
|
228
|
+
const o = a[n];
|
|
229
|
+
o !== !0 && (i += "=" + o);
|
|
230
|
+
}
|
|
231
|
+
document.cookie = i;
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
class se {
|
|
235
|
+
static trackClick(e) {
|
|
236
|
+
const t = {
|
|
237
|
+
key: e.trackApiKey,
|
|
238
|
+
query: e.searchTermValue,
|
|
239
|
+
shownHits: e.recordsPerPage,
|
|
240
|
+
totalHits: e.totalResults,
|
|
241
|
+
pageNo: e.currentPage,
|
|
242
|
+
latency: e.latencyVal,
|
|
243
|
+
session: e.session,
|
|
244
|
+
cDocId: e.result.uniqueId,
|
|
245
|
+
cDocTitle: e.result.title,
|
|
246
|
+
position: e.result.position,
|
|
247
|
+
language: e.language
|
|
248
|
+
};
|
|
249
|
+
_msq.push(["trackClick", t]);
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
/*!
|
|
253
|
+
* mustache.js - Logic-less {{mustache}} templates with JavaScript
|
|
254
|
+
* http://github.com/janl/mustache.js
|
|
255
|
+
*/
|
|
256
|
+
var ae = Object.prototype.toString, L = Array.isArray || function(s) {
|
|
257
|
+
return ae.call(s) === "[object Array]";
|
|
258
|
+
};
|
|
259
|
+
function K(s) {
|
|
260
|
+
return typeof s == "function";
|
|
261
|
+
}
|
|
262
|
+
function re(s) {
|
|
263
|
+
return L(s) ? "array" : typeof s;
|
|
264
|
+
}
|
|
265
|
+
function $(s) {
|
|
266
|
+
return s.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g, "\\$&");
|
|
267
|
+
}
|
|
268
|
+
function z(s, e) {
|
|
269
|
+
return s != null && typeof s == "object" && e in s;
|
|
270
|
+
}
|
|
271
|
+
function ie(s, e) {
|
|
272
|
+
return s != null && typeof s != "object" && s.hasOwnProperty && s.hasOwnProperty(e);
|
|
273
|
+
}
|
|
274
|
+
var ne = RegExp.prototype.test;
|
|
275
|
+
function oe(s, e) {
|
|
276
|
+
return ne.call(s, e);
|
|
277
|
+
}
|
|
278
|
+
var he = /\S/;
|
|
279
|
+
function ue(s) {
|
|
280
|
+
return !oe(he, s);
|
|
281
|
+
}
|
|
282
|
+
var ce = {
|
|
283
|
+
"&": "&",
|
|
284
|
+
"<": "<",
|
|
285
|
+
">": ">",
|
|
286
|
+
'"': """,
|
|
287
|
+
"'": "'",
|
|
288
|
+
"/": "/",
|
|
289
|
+
"`": "`",
|
|
290
|
+
"=": "="
|
|
291
|
+
};
|
|
292
|
+
function le(s) {
|
|
293
|
+
return String(s).replace(/[&<>"'`=\/]/g, function(e) {
|
|
294
|
+
return ce[e];
|
|
295
|
+
});
|
|
296
|
+
}
|
|
297
|
+
var ge = /\s*/, de = /\s+/, Q = /\s*=/, pe = /\s*\}/, fe = /#|\^|\/|>|\{|&|=|!/;
|
|
298
|
+
function me(s, e) {
|
|
299
|
+
if (!s)
|
|
300
|
+
return [];
|
|
301
|
+
var t = !1, r = [], a = [], i = [], n = !1, o = !1, u = "", c = 0;
|
|
302
|
+
function S() {
|
|
303
|
+
if (n && !o)
|
|
304
|
+
for (; i.length; )
|
|
305
|
+
delete a[i.pop()];
|
|
306
|
+
else
|
|
307
|
+
i = [];
|
|
308
|
+
n = !1, o = !1;
|
|
309
|
+
}
|
|
310
|
+
var T, w, W;
|
|
311
|
+
function F(C) {
|
|
312
|
+
if (typeof C == "string" && (C = C.split(de, 2)), !L(C) || C.length !== 2)
|
|
313
|
+
throw new Error("Invalid tags: " + C);
|
|
314
|
+
T = new RegExp($(C[0]) + "\\s*"), w = new RegExp("\\s*" + $(C[1])), W = new RegExp("\\s*" + $("}" + C[1]));
|
|
315
|
+
}
|
|
316
|
+
F(e || f.tags);
|
|
317
|
+
for (var l = new M(s), I, v, y, E, q, x; !l.eos(); ) {
|
|
318
|
+
if (I = l.pos, y = l.scanUntil(T), y)
|
|
319
|
+
for (var H = 0, G = y.length; H < G; ++H)
|
|
320
|
+
E = y.charAt(H), ue(E) ? (i.push(a.length), u += E) : (o = !0, t = !0, u += " "), a.push(["text", E, I, I + 1]), I += 1, E === `
|
|
321
|
+
` && (S(), u = "", c = 0, t = !1);
|
|
322
|
+
if (!l.scan(T))
|
|
323
|
+
break;
|
|
324
|
+
if (n = !0, v = l.scan(fe) || "name", l.scan(ge), v === "=" ? (y = l.scanUntil(Q), l.scan(Q), l.scanUntil(w)) : v === "{" ? (y = l.scanUntil(W), l.scan(pe), l.scanUntil(w), v = "&") : y = l.scanUntil(w), !l.scan(w))
|
|
325
|
+
throw new Error("Unclosed tag at " + l.pos);
|
|
326
|
+
if (v == ">" ? q = [v, y, I, l.pos, u, c, t] : q = [v, y, I, l.pos], c++, a.push(q), v === "#" || v === "^")
|
|
327
|
+
r.push(q);
|
|
328
|
+
else if (v === "/") {
|
|
329
|
+
if (x = r.pop(), !x)
|
|
330
|
+
throw new Error('Unopened section "' + y + '" at ' + I);
|
|
331
|
+
if (x[1] !== y)
|
|
332
|
+
throw new Error('Unclosed section "' + x[1] + '" at ' + I);
|
|
333
|
+
} else
|
|
334
|
+
v === "name" || v === "{" || v === "&" ? o = !0 : v === "=" && F(y);
|
|
335
|
+
}
|
|
336
|
+
if (S(), x = r.pop(), x)
|
|
337
|
+
throw new Error('Unclosed section "' + x[1] + '" at ' + l.pos);
|
|
338
|
+
return ye(ve(a));
|
|
339
|
+
}
|
|
340
|
+
function ve(s) {
|
|
341
|
+
for (var e = [], t, r, a = 0, i = s.length; a < i; ++a)
|
|
342
|
+
t = s[a], t && (t[0] === "text" && r && r[0] === "text" ? (r[1] += t[1], r[3] = t[3]) : (e.push(t), r = t));
|
|
343
|
+
return e;
|
|
344
|
+
}
|
|
345
|
+
function ye(s) {
|
|
346
|
+
for (var e = [], t = e, r = [], a, i, n = 0, o = s.length; n < o; ++n)
|
|
347
|
+
switch (a = s[n], a[0]) {
|
|
348
|
+
case "#":
|
|
349
|
+
case "^":
|
|
350
|
+
t.push(a), r.push(a), t = a[4] = [];
|
|
351
|
+
break;
|
|
352
|
+
case "/":
|
|
353
|
+
i = r.pop(), i[5] = a[2], t = r.length > 0 ? r[r.length - 1][4] : e;
|
|
354
|
+
break;
|
|
355
|
+
default:
|
|
356
|
+
t.push(a);
|
|
357
|
+
}
|
|
358
|
+
return e;
|
|
359
|
+
}
|
|
360
|
+
function M(s) {
|
|
361
|
+
this.string = s, this.tail = s, this.pos = 0;
|
|
362
|
+
}
|
|
363
|
+
M.prototype.eos = function() {
|
|
364
|
+
return this.tail === "";
|
|
365
|
+
};
|
|
366
|
+
M.prototype.scan = function(s) {
|
|
367
|
+
var e = this.tail.match(s);
|
|
368
|
+
if (!e || e.index !== 0)
|
|
369
|
+
return "";
|
|
370
|
+
var t = e[0];
|
|
371
|
+
return this.tail = this.tail.substring(t.length), this.pos += t.length, t;
|
|
372
|
+
};
|
|
373
|
+
M.prototype.scanUntil = function(s) {
|
|
374
|
+
var e = this.tail.search(s), t;
|
|
375
|
+
switch (e) {
|
|
376
|
+
case -1:
|
|
377
|
+
t = this.tail, this.tail = "";
|
|
378
|
+
break;
|
|
379
|
+
case 0:
|
|
380
|
+
t = "";
|
|
381
|
+
break;
|
|
382
|
+
default:
|
|
383
|
+
t = this.tail.substring(0, e), this.tail = this.tail.substring(e);
|
|
384
|
+
}
|
|
385
|
+
return this.pos += t.length, t;
|
|
386
|
+
};
|
|
387
|
+
function R(s, e) {
|
|
388
|
+
this.view = s, this.cache = { ".": this.view }, this.parent = e;
|
|
389
|
+
}
|
|
390
|
+
R.prototype.push = function(s) {
|
|
391
|
+
return new R(s, this);
|
|
392
|
+
};
|
|
393
|
+
R.prototype.lookup = function(s) {
|
|
394
|
+
var e = this.cache, t;
|
|
395
|
+
if (e.hasOwnProperty(s))
|
|
396
|
+
t = e[s];
|
|
397
|
+
else {
|
|
398
|
+
for (var r = this, a, i, n, o = !1; r; ) {
|
|
399
|
+
if (s.indexOf(".") > 0)
|
|
400
|
+
for (a = r.view, i = s.split("."), n = 0; a != null && n < i.length; )
|
|
401
|
+
n === i.length - 1 && (o = z(a, i[n]) || ie(a, i[n])), a = a[i[n++]];
|
|
402
|
+
else
|
|
403
|
+
a = r.view[s], o = z(r.view, s);
|
|
404
|
+
if (o) {
|
|
405
|
+
t = a;
|
|
406
|
+
break;
|
|
407
|
+
}
|
|
408
|
+
r = r.parent;
|
|
409
|
+
}
|
|
410
|
+
e[s] = t;
|
|
411
|
+
}
|
|
412
|
+
return K(t) && (t = t.call(this.view)), t;
|
|
413
|
+
};
|
|
414
|
+
function m() {
|
|
415
|
+
this.templateCache = {
|
|
416
|
+
_cache: {},
|
|
417
|
+
set: function(s, e) {
|
|
418
|
+
this._cache[s] = e;
|
|
419
|
+
},
|
|
420
|
+
get: function(s) {
|
|
421
|
+
return this._cache[s];
|
|
422
|
+
},
|
|
423
|
+
clear: function() {
|
|
424
|
+
this._cache = {};
|
|
425
|
+
}
|
|
426
|
+
};
|
|
427
|
+
}
|
|
428
|
+
m.prototype.clearCache = function() {
|
|
429
|
+
typeof this.templateCache < "u" && this.templateCache.clear();
|
|
430
|
+
};
|
|
431
|
+
m.prototype.parse = function(s, e) {
|
|
432
|
+
var t = this.templateCache, r = s + ":" + (e || f.tags).join(":"), a = typeof t < "u", i = a ? t.get(r) : void 0;
|
|
433
|
+
return i == null && (i = me(s, e), a && t.set(r, i)), i;
|
|
434
|
+
};
|
|
435
|
+
m.prototype.render = function(s, e, t, r) {
|
|
436
|
+
var a = this.getConfigTags(r), i = this.parse(s, a), n = e instanceof R ? e : new R(e, void 0);
|
|
437
|
+
return this.renderTokens(i, n, t, s, r);
|
|
438
|
+
};
|
|
439
|
+
m.prototype.renderTokens = function(s, e, t, r, a) {
|
|
440
|
+
for (var i = "", n, o, u, c = 0, S = s.length; c < S; ++c)
|
|
441
|
+
u = void 0, n = s[c], o = n[0], o === "#" ? u = this.renderSection(n, e, t, r, a) : o === "^" ? u = this.renderInverted(n, e, t, r, a) : o === ">" ? u = this.renderPartial(n, e, t, a) : o === "&" ? u = this.unescapedValue(n, e) : o === "name" ? u = this.escapedValue(n, e, a) : o === "text" && (u = this.rawValue(n)), u !== void 0 && (i += u);
|
|
442
|
+
return i;
|
|
443
|
+
};
|
|
444
|
+
m.prototype.renderSection = function(s, e, t, r, a) {
|
|
445
|
+
var i = this, n = "", o = e.lookup(s[1]);
|
|
446
|
+
function u(T) {
|
|
447
|
+
return i.render(T, e, t, a);
|
|
448
|
+
}
|
|
449
|
+
if (o) {
|
|
450
|
+
if (L(o))
|
|
451
|
+
for (var c = 0, S = o.length; c < S; ++c)
|
|
452
|
+
n += this.renderTokens(s[4], e.push(o[c]), t, r, a);
|
|
453
|
+
else if (typeof o == "object" || typeof o == "string" || typeof o == "number")
|
|
454
|
+
n += this.renderTokens(s[4], e.push(o), t, r, a);
|
|
455
|
+
else if (K(o)) {
|
|
456
|
+
if (typeof r != "string")
|
|
457
|
+
throw new Error("Cannot use higher-order sections without the original template");
|
|
458
|
+
o = o.call(e.view, r.slice(s[3], s[5]), u), o != null && (n += o);
|
|
459
|
+
} else
|
|
460
|
+
n += this.renderTokens(s[4], e, t, r, a);
|
|
461
|
+
return n;
|
|
462
|
+
}
|
|
463
|
+
};
|
|
464
|
+
m.prototype.renderInverted = function(s, e, t, r, a) {
|
|
465
|
+
var i = e.lookup(s[1]);
|
|
466
|
+
if (!i || L(i) && i.length === 0)
|
|
467
|
+
return this.renderTokens(s[4], e, t, r, a);
|
|
468
|
+
};
|
|
469
|
+
m.prototype.indentPartial = function(s, e, t) {
|
|
470
|
+
for (var r = e.replace(/[^ \t]/g, ""), a = s.split(`
|
|
471
|
+
`), i = 0; i < a.length; i++)
|
|
472
|
+
a[i].length && (i > 0 || !t) && (a[i] = r + a[i]);
|
|
473
|
+
return a.join(`
|
|
474
|
+
`);
|
|
475
|
+
};
|
|
476
|
+
m.prototype.renderPartial = function(s, e, t, r) {
|
|
477
|
+
if (t) {
|
|
478
|
+
var a = this.getConfigTags(r), i = K(t) ? t(s[1]) : t[s[1]];
|
|
479
|
+
if (i != null) {
|
|
480
|
+
var n = s[6], o = s[5], u = s[4], c = i;
|
|
481
|
+
o == 0 && u && (c = this.indentPartial(i, u, n));
|
|
482
|
+
var S = this.parse(c, a);
|
|
483
|
+
return this.renderTokens(S, e, t, c, r);
|
|
484
|
+
}
|
|
485
|
+
}
|
|
486
|
+
};
|
|
487
|
+
m.prototype.unescapedValue = function(s, e) {
|
|
488
|
+
var t = e.lookup(s[1]);
|
|
489
|
+
if (t != null)
|
|
490
|
+
return t;
|
|
491
|
+
};
|
|
492
|
+
m.prototype.escapedValue = function(s, e, t) {
|
|
493
|
+
var r = this.getConfigEscape(t) || f.escape, a = e.lookup(s[1]);
|
|
494
|
+
if (a != null)
|
|
495
|
+
return typeof a == "number" && r === f.escape ? String(a) : r(a);
|
|
496
|
+
};
|
|
497
|
+
m.prototype.rawValue = function(s) {
|
|
498
|
+
return s[1];
|
|
499
|
+
};
|
|
500
|
+
m.prototype.getConfigTags = function(s) {
|
|
501
|
+
return L(s) ? s : s && typeof s == "object" ? s.tags : void 0;
|
|
502
|
+
};
|
|
503
|
+
m.prototype.getConfigEscape = function(s) {
|
|
504
|
+
if (s && typeof s == "object" && !L(s))
|
|
505
|
+
return s.escape;
|
|
506
|
+
};
|
|
507
|
+
var f = {
|
|
508
|
+
name: "mustache.js",
|
|
509
|
+
version: "4.2.0",
|
|
510
|
+
tags: ["{{", "}}"],
|
|
511
|
+
clearCache: void 0,
|
|
512
|
+
escape: void 0,
|
|
513
|
+
parse: void 0,
|
|
514
|
+
render: void 0,
|
|
515
|
+
Scanner: void 0,
|
|
516
|
+
Context: void 0,
|
|
517
|
+
Writer: void 0,
|
|
518
|
+
/**
|
|
519
|
+
* Allows a user to override the default caching strategy, by providing an
|
|
520
|
+
* object with set, get and clear methods. This can also be used to disable
|
|
521
|
+
* the cache by setting it to the literal `undefined`.
|
|
522
|
+
*/
|
|
523
|
+
set templateCache(s) {
|
|
524
|
+
_.templateCache = s;
|
|
525
|
+
},
|
|
526
|
+
/**
|
|
527
|
+
* Gets the default or overridden caching object from the default writer.
|
|
528
|
+
*/
|
|
529
|
+
get templateCache() {
|
|
530
|
+
return _.templateCache;
|
|
531
|
+
}
|
|
532
|
+
}, _ = new m();
|
|
533
|
+
f.clearCache = function() {
|
|
534
|
+
return _.clearCache();
|
|
535
|
+
};
|
|
536
|
+
f.parse = function(s, e) {
|
|
537
|
+
return _.parse(s, e);
|
|
538
|
+
};
|
|
539
|
+
f.render = function(s, e, t, r) {
|
|
540
|
+
if (typeof s != "string")
|
|
541
|
+
throw new TypeError('Invalid template! Template should be a "string" but "' + re(s) + '" was given as the first argument for mustache#render(template, view, partials)');
|
|
542
|
+
return _.render(s, e, t, r);
|
|
543
|
+
};
|
|
544
|
+
f.escape = le;
|
|
545
|
+
f.Scanner = M;
|
|
546
|
+
f.Context = R;
|
|
547
|
+
f.Writer = m;
|
|
548
|
+
class be {
|
|
549
|
+
constructor(e) {
|
|
550
|
+
h(this, "dataLayer"), h(this, "config"), h(this, "suggestAfterMinChars"), h(this, "hideBranding"), h(this, "containerId"), h(this, "currentInputValue", ""), h(this, "autosuggestResults"), h(this, "searchInput"), h(this, "actionButton"), h(this, "autosuggestContainer"), h(this, "buttonState", "search"), h(this, "selectedAutosuggestItem", -1), h(this, "suggestTrigger"), h(this, "searchTrigger"), this.dataLayer = e.dataLayer, this.config = e.config, this.searchTrigger = e.searchTrigger, this.suggestTrigger = e.suggestTrigger, this.containerId = e.containerId, this.suggestAfterMinChars = e.config.suggestAfterMinChars, this.hideBranding = e.config.hideBranding, this.renderMainTemplate(), this.actionButtonInit(), this.updateActionButtonState("search"), this.searchInput && (this.createAutosuggestContainer(), this.attachSubscriptions());
|
|
551
|
+
}
|
|
552
|
+
renderMainTemplate() {
|
|
553
|
+
var e, t;
|
|
554
|
+
const r = document.getElementById(this.containerId);
|
|
555
|
+
if (!r)
|
|
556
|
+
throw new Error("Search input container not found");
|
|
557
|
+
const a = ((e = this.config.templates) == null ? void 0 : e.mainTemplate) || `
|
|
558
|
+
<div class="searchstax-search-input-container">
|
|
559
|
+
<div class="searchstax-search-input-wrapper">
|
|
560
|
+
<input type="text" id="searchstax-search-input" class="searchstax-search-input" placeholder="SEARCH FOR..." />
|
|
561
|
+
<button class="searchstax-spinner-icon" id="searchstax-search-input-action-button"></button>
|
|
562
|
+
</div>
|
|
563
|
+
</div>
|
|
564
|
+
`;
|
|
565
|
+
if (console.log(
|
|
566
|
+
"this.dataLayer.renderingEngineValue",
|
|
567
|
+
this.dataLayer.renderingEngineValue
|
|
568
|
+
), this.dataLayer.renderingEngineValue === "mustache") {
|
|
569
|
+
const o = f.render(a, {});
|
|
570
|
+
r.innerHTML = o;
|
|
571
|
+
}
|
|
572
|
+
const i = ((t = this.config.templates) == null ? void 0 : t.searchInputId) || "searchstax-search-input", n = document.querySelector(`#${i}`);
|
|
573
|
+
if (n)
|
|
574
|
+
this.searchInput = n, n.addEventListener("keyup", this.inputKeyupEvent.bind(this)), n.addEventListener("blur", this.hideAutosuggest.bind(this)), n.addEventListener("paste", this.inputPasteEvent.bind(this));
|
|
575
|
+
else
|
|
576
|
+
throw new Error("Input not found");
|
|
577
|
+
}
|
|
578
|
+
createAutosuggestContainer() {
|
|
579
|
+
var e;
|
|
580
|
+
this.autosuggestContainer = document.createElement("div"), this.autosuggestContainer.classList.add("searchstax-autosuggest-container"), this.autosuggestContainer.addEventListener("mouseleave", () => {
|
|
581
|
+
this.resetAutosuggestSelection(), this.markActiveAutosuggestItem();
|
|
582
|
+
}), (e = this.searchInput) == null || e.after(this.autosuggestContainer);
|
|
583
|
+
}
|
|
584
|
+
actionButtonInit() {
|
|
585
|
+
this.actionButton = document.getElementById(
|
|
586
|
+
"searchstax-search-input-action-button"
|
|
587
|
+
), this.actionButton && this.actionButton.addEventListener("click", () => {
|
|
588
|
+
var e;
|
|
589
|
+
this.buttonState === "search" ? this.executeSearch(((e = this.searchInput) == null ? void 0 : e.value) ?? "") : this.buttonState === "close" && this.searchInput && (this.searchInput.value = "", this.executeSearch(""));
|
|
590
|
+
});
|
|
591
|
+
}
|
|
592
|
+
attachSubscriptions() {
|
|
593
|
+
this.dataLayer.searchTermChangeObservable.subscribe(() => {
|
|
594
|
+
this.handleSearchTermChange();
|
|
595
|
+
}), this.dataLayer.loadingChangeObservable.subscribe(() => {
|
|
596
|
+
this.handleLoadingChange();
|
|
597
|
+
}), this.dataLayer.searchAutosuggestObservable.subscribe(
|
|
598
|
+
(e) => {
|
|
599
|
+
e && this.appendSuggestions(e);
|
|
600
|
+
}
|
|
601
|
+
);
|
|
602
|
+
}
|
|
603
|
+
handleLoadingChange() {
|
|
604
|
+
this.dataLayer.loadingValue ? this.updateActionButtonState("loading") : this.handleSearchTermChange();
|
|
605
|
+
}
|
|
606
|
+
handleSearchTermChange() {
|
|
607
|
+
var e;
|
|
608
|
+
this.dataLayer.searchTermValue === ((e = this.searchInput) == null ? void 0 : e.value) && this.searchInput.value !== "" ? this.updateActionButtonState("close") : this.updateActionButtonState("search");
|
|
609
|
+
}
|
|
610
|
+
updateActionButtonState(e) {
|
|
611
|
+
if (this.buttonState = e, this.actionButton)
|
|
612
|
+
switch (this.actionButton.classList.remove("searchstax-spinner-icon"), this.actionButton.classList.remove("searchstax-search-close"), this.actionButton.classList.remove("searchstax-search-icon"), e) {
|
|
613
|
+
case "loading":
|
|
614
|
+
this.actionButton.classList.add("searchstax-spinner-icon");
|
|
615
|
+
break;
|
|
616
|
+
case "search":
|
|
617
|
+
this.actionButton.classList.add("searchstax-search-icon");
|
|
618
|
+
break;
|
|
619
|
+
case "close":
|
|
620
|
+
this.actionButton.classList.add("searchstax-search-close");
|
|
621
|
+
break;
|
|
622
|
+
}
|
|
623
|
+
}
|
|
624
|
+
selectPreviousAutosuggestItem() {
|
|
625
|
+
this.selectedAutosuggestItem > 0 ? this.selectedAutosuggestItem-- : this.selectedAutosuggestItem = this.autosuggestResults.suggestions.length - 1, this.markActiveAutosuggestItem();
|
|
626
|
+
}
|
|
627
|
+
selectNextAutosuggestItem() {
|
|
628
|
+
this.selectedAutosuggestItem < this.autosuggestResults.suggestions.length - 1 ? this.selectedAutosuggestItem++ : this.selectedAutosuggestItem = 0, this.markActiveAutosuggestItem();
|
|
629
|
+
}
|
|
630
|
+
resetAutosuggestSelection() {
|
|
631
|
+
this.selectedAutosuggestItem = -1, this.markActiveAutosuggestItem();
|
|
632
|
+
}
|
|
633
|
+
markActiveAutosuggestItem() {
|
|
634
|
+
const e = document.getElementsByClassName(
|
|
635
|
+
"searchstax-autosuggest-item"
|
|
636
|
+
);
|
|
637
|
+
for (let t = 0; t < e.length; t++) {
|
|
638
|
+
const r = e[t];
|
|
639
|
+
t === this.selectedAutosuggestItem ? r.classList.add("active") : r.classList.remove("active");
|
|
640
|
+
}
|
|
641
|
+
}
|
|
642
|
+
inputKeyupEvent(e) {
|
|
643
|
+
const t = e.key;
|
|
644
|
+
this.currentInputValue = e.target.value, t === "Enter" ? this.suggestionChosen() : t === "Escape" ? this.hideAutosuggest() : t === "ArrowUp" ? this.selectPreviousAutosuggestItem() : t === "ArrowDown" ? this.selectNextAutosuggestItem() : this.autosuggestHandling(e), this.handleSearchTermChange();
|
|
645
|
+
}
|
|
646
|
+
autosuggestHandling(e) {
|
|
647
|
+
e.target && e.target.value.length >= this.suggestAfterMinChars ? this.executeSuggest(e.target.value) : this.hideAutosuggest();
|
|
648
|
+
}
|
|
649
|
+
inputPasteEvent(e) {
|
|
650
|
+
setTimeout(() => {
|
|
651
|
+
this.autosuggestHandling(e), this.handleSearchTermChange();
|
|
652
|
+
}, 0);
|
|
653
|
+
}
|
|
654
|
+
executeSuggest(e) {
|
|
655
|
+
this.suggestTrigger(e);
|
|
656
|
+
}
|
|
657
|
+
executeSearch(e) {
|
|
658
|
+
this.hideAutosuggest(), this.searchTrigger(e === "" ? "*" : e);
|
|
659
|
+
}
|
|
660
|
+
suggestionChosen() {
|
|
661
|
+
this.selectedAutosuggestItem > -1 ? this.autosuggestItemClicked(
|
|
662
|
+
this.autosuggestResults.suggestions[this.selectedAutosuggestItem]
|
|
663
|
+
) : this.executeSearch(this.currentInputValue);
|
|
664
|
+
}
|
|
665
|
+
hideAutosuggest() {
|
|
666
|
+
this.autosuggestContainer && (this.autosuggestContainer.innerHTML = "", this.autosuggestContainer.classList.add("hidden")), this.resetAutosuggestSelection();
|
|
667
|
+
}
|
|
668
|
+
cleanSuggestionTerm(e) {
|
|
669
|
+
return e.replace(/(<([^>]+)>)/gi, "").trim();
|
|
670
|
+
}
|
|
671
|
+
autosuggestItemClicked(e) {
|
|
672
|
+
this.searchInput.value = this.cleanSuggestionTerm(e.term), this.executeSearch(this.cleanSuggestionTerm(e.term));
|
|
673
|
+
}
|
|
674
|
+
createAutosuggestItem(e) {
|
|
675
|
+
var t;
|
|
676
|
+
const r = document.createElement("div");
|
|
677
|
+
r.classList.add("searchstax-autosuggest-item"), r.addEventListener("click", () => {
|
|
678
|
+
this.autosuggestItemClicked(e);
|
|
679
|
+
}), r.addEventListener("mouseenter", () => {
|
|
680
|
+
var i;
|
|
681
|
+
this.selectedAutosuggestItem = ((i = this.autosuggestResults) == null ? void 0 : i.suggestions.indexOf(e)) || 0, this.markActiveAutosuggestItem();
|
|
682
|
+
});
|
|
683
|
+
const a = ((t = this.config.templates) == null ? void 0 : t.autosuggestItemTemplate) || '<div class="searchstax-autosuggest-item-term-container">{{{term}}}</div>';
|
|
684
|
+
return r.innerHTML = f.render(a, e), r;
|
|
685
|
+
}
|
|
686
|
+
appendSuggestions(e) {
|
|
687
|
+
if (this.autosuggestContainer) {
|
|
688
|
+
this.autosuggestContainer.innerHTML = "", this.autosuggestContainer.classList.remove("hidden");
|
|
689
|
+
for (const t in e.suggest)
|
|
690
|
+
if (Object.prototype.hasOwnProperty.call(e.suggest, t)) {
|
|
691
|
+
const r = e.suggest[t];
|
|
692
|
+
for (const a in r)
|
|
693
|
+
if (Object.prototype.hasOwnProperty.call(r, a)) {
|
|
694
|
+
const i = r[a];
|
|
695
|
+
this.autosuggestResults = i, i.numFound > 0 ? i.suggestions.forEach((n) => {
|
|
696
|
+
this.autosuggestContainer.appendChild(
|
|
697
|
+
this.createAutosuggestItem(n)
|
|
698
|
+
);
|
|
699
|
+
}) : this.autosuggestContainer.classList.add("hidden");
|
|
700
|
+
}
|
|
701
|
+
}
|
|
702
|
+
}
|
|
703
|
+
}
|
|
704
|
+
}
|
|
705
|
+
class ke {
|
|
706
|
+
constructor(e) {
|
|
707
|
+
h(this, "dataLayer"), h(this, "config"), h(this, "linkClickCallback"), h(this, "searchCallback"), h(this, "containerId"), h(this, "searchResultsMainContainer"), h(this, "searchResultsContainer"), h(this, "searchResultLinks", []), this.linkClickCallback = e.linkClickCallback, this.searchCallback = e.searchTrigger, this.dataLayer = e.dataLayer, this.config = e.config, this.containerId = e.containerId;
|
|
708
|
+
const t = document.getElementById(this.containerId);
|
|
709
|
+
if (console.log("resultsContainer", t), t)
|
|
710
|
+
this.searchResultsMainContainer = t;
|
|
711
|
+
else
|
|
712
|
+
throw new Error(
|
|
713
|
+
`Search Results Main Container with id ${this.containerId} not found`
|
|
714
|
+
);
|
|
715
|
+
this.initializeSubscriptions(), this.renderMainTemplate();
|
|
716
|
+
}
|
|
717
|
+
initializeSubscriptions() {
|
|
718
|
+
this.dataLayer.searchResultsObservable.subscribe((e) => {
|
|
719
|
+
e && this.searchResultsContainer && this.renderResults(e);
|
|
720
|
+
});
|
|
721
|
+
}
|
|
722
|
+
renderNoResultsTemplate() {
|
|
723
|
+
var e, t, r;
|
|
724
|
+
const a = ((t = (e = this.config) == null ? void 0 : e.templates) == null ? void 0 : t.noSearchResultTemplate) || `
|
|
725
|
+
<div class="searchstax-no-results">
|
|
726
|
+
Showing <strong>no results</strong> for <strong>"{{ searchTerm }}"</strong>
|
|
727
|
+
<br>
|
|
728
|
+
{{#spellingSuggestion}}
|
|
729
|
+
<span> Did you mean <a href="#"
|
|
730
|
+
class="searchstax-suggestion-term">{{ spellingSuggestion }}</a>?</span>
|
|
731
|
+
{{/spellingSuggestion}}
|
|
732
|
+
</div>
|
|
733
|
+
<div>
|
|
734
|
+
<p>Try searching for search related terms or topics. We offer a wide variety of content to help you get the information you need.</p>
|
|
735
|
+
<p>Lost? Click on the ‘X” in the Search Box to reset your search.</p>
|
|
736
|
+
</div>
|
|
737
|
+
`, i = ((r = this.dataLayer.searchResultsMetadataValue) == null ? void 0 : r.spellingSuggestion) ?? "";
|
|
738
|
+
if (this.dataLayer.renderingEngineValue === "mustache" && this.searchResultsContainer && (this.searchResultsContainer.innerHTML = f.render(
|
|
739
|
+
a,
|
|
740
|
+
{
|
|
741
|
+
spellingSuggestion: i,
|
|
742
|
+
searchTerm: this.dataLayer.searchTermValue
|
|
743
|
+
}
|
|
744
|
+
)), i && this.searchResultsContainer) {
|
|
745
|
+
const n = this.searchResultsContainer.querySelector("a");
|
|
746
|
+
n && n.addEventListener("click", (o) => {
|
|
747
|
+
o.preventDefault(), o.stopPropagation(), this.searchCallback(i);
|
|
748
|
+
});
|
|
749
|
+
}
|
|
750
|
+
}
|
|
751
|
+
renderResults(e) {
|
|
752
|
+
var t, r;
|
|
753
|
+
if (this.dataLayer.renderingEngineValue === "mustache" && this.searchResultsContainer)
|
|
754
|
+
if (this.removeLinkClickEvents(), e.length === 0)
|
|
755
|
+
this.renderNoResultsTemplate();
|
|
756
|
+
else {
|
|
757
|
+
const a = ((r = (t = this.config) == null ? void 0 : t.templates) == null ? void 0 : r.searchResultTemplate) || `
|
|
758
|
+
<div class="searchstax-search-result">
|
|
759
|
+
{{#url}}
|
|
760
|
+
<a href="{{url}}" data-searchstax-unique-result-id="{{uniqueId}}" class="searchstax-result-item-link"></a>
|
|
761
|
+
{{/url}}
|
|
762
|
+
{{#ribbon}}
|
|
763
|
+
<div class="searchstax-search-result-ribbon">
|
|
764
|
+
{{ribbon}}
|
|
765
|
+
</div>
|
|
766
|
+
{{/ribbon}}
|
|
767
|
+
{{#thumbnail}}
|
|
768
|
+
<img :src="thumbnail" class="searchstax-thumbnail">
|
|
769
|
+
{{/thumbnail}}
|
|
770
|
+
<div class="searchstax-search-result-title-container">
|
|
771
|
+
<span class="searchstax-search-result-title">{{title}}</span>
|
|
772
|
+
</div>
|
|
773
|
+
{{#paths}}
|
|
774
|
+
<p class="searchstax-search-result-common">
|
|
775
|
+
{{paths}}
|
|
776
|
+
</p>
|
|
777
|
+
{{/paths}}
|
|
778
|
+
{{#description}}
|
|
779
|
+
<p class="searchstax-search-result-description searchstax-search-result-common">
|
|
780
|
+
{{description}}
|
|
781
|
+
</p>
|
|
782
|
+
{{/description}}
|
|
783
|
+
{{#unmappedFields}}
|
|
784
|
+
{{#isImage}}
|
|
785
|
+
<div class="searchstax-search-result-image-container">
|
|
786
|
+
<img :src="result[value]" class="searchstax-result-image">
|
|
787
|
+
</div>
|
|
788
|
+
{{/isImage}}
|
|
789
|
+
{{^isImage}}
|
|
790
|
+
<p class="searchstax-search-result-common">
|
|
791
|
+
{{value}}
|
|
792
|
+
</p>
|
|
793
|
+
{{/isImage}}
|
|
794
|
+
{{/unmappedFields}}
|
|
795
|
+
</div>`, i = e.map((n) => f.render(a, n));
|
|
796
|
+
this.searchResultsContainer.innerHTML = i.join(""), this.searchResultLinks = Array.from(
|
|
797
|
+
this.searchResultsContainer.querySelectorAll(
|
|
798
|
+
`[${this.uniqueIdAttribute}]`
|
|
799
|
+
)
|
|
800
|
+
), this.attachLinkClickEvents();
|
|
801
|
+
}
|
|
802
|
+
}
|
|
803
|
+
removeLinkClickEvents() {
|
|
804
|
+
this.searchResultLinks.forEach((e) => {
|
|
805
|
+
e.removeEventListener("click", () => {
|
|
806
|
+
});
|
|
807
|
+
});
|
|
808
|
+
}
|
|
809
|
+
get uniqueIdAttribute() {
|
|
810
|
+
return this.config.searchResultUniqueIdAttribute || "data-searchstax-unique-result-id";
|
|
811
|
+
}
|
|
812
|
+
attachLinkClickEvents() {
|
|
813
|
+
this.searchResultLinks.forEach((e) => {
|
|
814
|
+
e.addEventListener("click", (t) => {
|
|
815
|
+
t.preventDefault(), t.stopPropagation();
|
|
816
|
+
const r = e.getAttribute(this.uniqueIdAttribute) ?? "";
|
|
817
|
+
r && this.linkClickCallback(r);
|
|
818
|
+
});
|
|
819
|
+
});
|
|
820
|
+
}
|
|
821
|
+
renderMainTemplate() {
|
|
822
|
+
var e, t;
|
|
823
|
+
const r = ((t = (e = this.config) == null ? void 0 : e.templates) == null ? void 0 : t.mainTemplate) || `
|
|
824
|
+
<div class="searchstax-search-results-container">
|
|
825
|
+
<div class="searchstax-search-results"></div>
|
|
826
|
+
</div>
|
|
827
|
+
`;
|
|
828
|
+
this.dataLayer.renderingEngineValue === "mustache" && (this.searchResultsMainContainer.innerHTML = f.render(
|
|
829
|
+
r,
|
|
830
|
+
{}
|
|
831
|
+
)), setTimeout(() => {
|
|
832
|
+
var a, i;
|
|
833
|
+
const n = (a = this.config) != null && a.searchResultsContainerId ? (i = this.config) == null ? void 0 : i.searchResultsContainerId : "searchstax-search-results", o = document.getElementById(n);
|
|
834
|
+
if (o)
|
|
835
|
+
this.searchResultsContainer = o;
|
|
836
|
+
else
|
|
837
|
+
throw new Error(`Search Results Container with id ${n} not found`);
|
|
838
|
+
}, 0);
|
|
839
|
+
}
|
|
840
|
+
}
|
|
841
|
+
class Ce {
|
|
842
|
+
constructor(e = "mustache") {
|
|
843
|
+
h(this, "sessionId"), h(this, "searchstaxConfig"), h(this, "searchHelper"), h(this, "searchInputConfig"), h(this, "searchResultsConfig"), h(this, "searchInputWidget"), h(this, "searchResultsWidget"), h(this, "dataLayer", new Z()), e && this.dataLayer.setRenderingEngine(e), this.sessionId = te.getOrSetCookie("searchstax_session_id"), this.handleHooks();
|
|
844
|
+
}
|
|
845
|
+
setRenderingEngine(e = "mustache") {
|
|
846
|
+
this.dataLayer.setRenderingEngine(e);
|
|
847
|
+
}
|
|
848
|
+
handleHooks() {
|
|
849
|
+
var e, t;
|
|
850
|
+
(t = (e = this.searchInputConfig) == null ? void 0 : e.hooks) != null && t.afterSearch && this.dataLayer.searchResultsObservable.subscribe((r) => {
|
|
851
|
+
this.searchInputConfig.hooks.afterSearch(r);
|
|
852
|
+
});
|
|
853
|
+
}
|
|
854
|
+
initialize(e) {
|
|
855
|
+
this.searchstaxConfig || (this.searchstaxConfig = e, this.searchHelper = new ee(
|
|
856
|
+
{ ...e, sessionId: this.sessionId },
|
|
857
|
+
this.dataLayer
|
|
858
|
+
));
|
|
859
|
+
}
|
|
860
|
+
search(e, t) {
|
|
861
|
+
this.searchHelper && this.searchHelper.search(
|
|
862
|
+
e,
|
|
863
|
+
this.parseSearchResultsResponse.bind(this),
|
|
864
|
+
t
|
|
865
|
+
);
|
|
866
|
+
}
|
|
867
|
+
parseSearchResultsResponse(e) {
|
|
868
|
+
var t, r;
|
|
869
|
+
let a = P.combineResultsWithMetadata(e);
|
|
870
|
+
(r = (t = this.searchInputConfig) == null ? void 0 : t.hooks) != null && r.afterSearch && (a = this.searchInputConfig.hooks.afterSearch(a)), this.dataLayer.setSearchResults(a), this.dataLayer.setSearchResultsMetadata(
|
|
871
|
+
P.extractSearchResultsMetadata(e)
|
|
872
|
+
);
|
|
873
|
+
}
|
|
874
|
+
parseSuggestSuggestResponse(e) {
|
|
875
|
+
var t, r;
|
|
876
|
+
let a = e;
|
|
877
|
+
(r = (t = this.searchInputConfig) == null ? void 0 : t.hooks) != null && r.afterAutosuggest && (a = this.searchInputConfig.hooks.afterAutosuggest(e)), this.dataLayer.setSearchAutosuggest(a);
|
|
878
|
+
}
|
|
879
|
+
suggest(e, t) {
|
|
880
|
+
this.searchHelper && this.searchHelper.suggest(
|
|
881
|
+
e,
|
|
882
|
+
this.parseSuggestSuggestResponse.bind(this),
|
|
883
|
+
t
|
|
884
|
+
);
|
|
885
|
+
}
|
|
886
|
+
changeLanguage(e) {
|
|
887
|
+
this.searchHelper && (this.searchHelper.language = e);
|
|
888
|
+
}
|
|
889
|
+
addSearchInputWidget(e, t) {
|
|
890
|
+
this.searchInputConfig || (this.searchInputConfig = t, this.searchInputWidget = new be({
|
|
891
|
+
containerId: e,
|
|
892
|
+
config: t,
|
|
893
|
+
searchTrigger: this.executeSearch.bind(this),
|
|
894
|
+
suggestTrigger: this.executeSuggest.bind(this),
|
|
895
|
+
dataLayer: this.dataLayer
|
|
896
|
+
}));
|
|
897
|
+
}
|
|
898
|
+
addSearchResultsWidget(e, t) {
|
|
899
|
+
this.searchResultsConfig || (this.searchResultsConfig = t, this.searchResultsWidget = new ke({
|
|
900
|
+
containerId: e,
|
|
901
|
+
linkClickCallback: this.executeLinkClick.bind(this),
|
|
902
|
+
searchTrigger: this.executeSearch.bind(this),
|
|
903
|
+
config: t,
|
|
904
|
+
dataLayer: this.dataLayer
|
|
905
|
+
}));
|
|
906
|
+
}
|
|
907
|
+
executeSearch(e) {
|
|
908
|
+
var t, r;
|
|
909
|
+
let a = { term: e, queryParams: [] };
|
|
910
|
+
(r = (t = this.searchInputConfig) == null ? void 0 : t.hooks) != null && r.beforeSearch && (a = this.searchInputConfig.hooks.beforeSearch(a)), a && a.term !== void 0 && a.queryParams !== void 0 && this.search(a.term, a.queryParams);
|
|
911
|
+
}
|
|
912
|
+
executeSuggest(e) {
|
|
913
|
+
var t, r;
|
|
914
|
+
let a = { term: e, queryParams: [] };
|
|
915
|
+
(r = (t = this.searchInputConfig) == null ? void 0 : t.hooks) != null && r.beforeAutosuggest && (a = this.searchInputConfig.hooks.beforeAutosuggest(a)), a && a.term !== void 0 && a.queryParams !== void 0 && this.suggest(a.term, a.queryParams);
|
|
916
|
+
}
|
|
917
|
+
executeLinkClick(e) {
|
|
918
|
+
var t, r, a, i;
|
|
919
|
+
let n = P.findResultByUniqueId(
|
|
920
|
+
e,
|
|
921
|
+
this.dataLayer.searchResultsValue ?? []
|
|
922
|
+
);
|
|
923
|
+
n && ((r = (t = this.searchResultsConfig) == null ? void 0 : t.hooks) != null && r.afterLinkClick && (n = this.searchResultsConfig.hooks.afterLinkClick(n)), n && (console.log("foundResult", n), this.dataLayer.searchResultsMetadataValue && se.trackClick({
|
|
924
|
+
result: n,
|
|
925
|
+
searchTermValue: this.dataLayer.searchTermValue,
|
|
926
|
+
trackApiKey: ((a = this.searchstaxConfig) == null ? void 0 : a.trackApiKey) ?? "",
|
|
927
|
+
session: this.sessionId,
|
|
928
|
+
language: ((i = this.searchHelper) == null ? void 0 : i.language) ?? "",
|
|
929
|
+
recordsPerPage: this.dataLayer.searchResultsMetadataValue.recordsPerPageValue,
|
|
930
|
+
totalResults: this.dataLayer.searchResultsMetadataValue.totalResultsValue,
|
|
931
|
+
currentPage: this.dataLayer.currentPageValue,
|
|
932
|
+
latencyVal: this.dataLayer.searchResultsMetadataValue.latency
|
|
933
|
+
})));
|
|
934
|
+
}
|
|
935
|
+
}
|
|
936
|
+
const k = X({
|
|
937
|
+
searchstax: new Ce("vue")
|
|
938
|
+
}), Se = U({
|
|
939
|
+
name: "SearchstaxWrapper",
|
|
940
|
+
props: {
|
|
941
|
+
language: {
|
|
942
|
+
type: String,
|
|
943
|
+
required: !1,
|
|
944
|
+
default: "en"
|
|
945
|
+
},
|
|
946
|
+
searchURL: {
|
|
947
|
+
type: String,
|
|
948
|
+
required: !0
|
|
949
|
+
},
|
|
950
|
+
suggesterURL: {
|
|
951
|
+
type: String,
|
|
952
|
+
required: !0
|
|
953
|
+
},
|
|
954
|
+
relatedSearchesURL: {
|
|
955
|
+
type: String,
|
|
956
|
+
required: !0
|
|
957
|
+
},
|
|
958
|
+
authenticationValue: {
|
|
959
|
+
type: String,
|
|
960
|
+
required: !0
|
|
961
|
+
},
|
|
962
|
+
trackApiKey: {
|
|
963
|
+
type: String,
|
|
964
|
+
required: !0
|
|
965
|
+
},
|
|
966
|
+
searchApiKey: {
|
|
967
|
+
type: String,
|
|
968
|
+
required: !0
|
|
969
|
+
},
|
|
970
|
+
authType: {
|
|
971
|
+
type: String,
|
|
972
|
+
required: !1,
|
|
973
|
+
default: "basic"
|
|
974
|
+
}
|
|
975
|
+
},
|
|
976
|
+
mounted() {
|
|
977
|
+
k.searchstax.initialize({
|
|
978
|
+
language: this.language,
|
|
979
|
+
searchURL: this.searchURL,
|
|
980
|
+
suggesterURL: this.suggesterURL,
|
|
981
|
+
authenticationValue: this.authenticationValue,
|
|
982
|
+
trackApiKey: this.trackApiKey,
|
|
983
|
+
searchApiKey: this.searchApiKey,
|
|
984
|
+
authType: this.authType
|
|
985
|
+
}), this.$emit("initialized", k.searchstax);
|
|
986
|
+
}
|
|
987
|
+
}), j = (s, e) => {
|
|
988
|
+
const t = s.__vccOpts || s;
|
|
989
|
+
for (const [r, a] of e)
|
|
990
|
+
t[r] = a;
|
|
991
|
+
return t;
|
|
992
|
+
};
|
|
993
|
+
function Ie(s, e, t, r, a, i) {
|
|
994
|
+
return B(s.$slots, "default");
|
|
995
|
+
}
|
|
996
|
+
const xe = /* @__PURE__ */ j(Se, [["render", Ie]]), Ae = U({
|
|
997
|
+
name: "SearchstaxInputWidget",
|
|
998
|
+
props: {
|
|
999
|
+
beforeSearch: {
|
|
1000
|
+
type: Function,
|
|
1001
|
+
required: !1
|
|
1002
|
+
},
|
|
1003
|
+
afterSearch: {
|
|
1004
|
+
type: Function,
|
|
1005
|
+
required: !1
|
|
1006
|
+
},
|
|
1007
|
+
afterAutosuggest: {
|
|
1008
|
+
type: Function,
|
|
1009
|
+
required: !1
|
|
1010
|
+
},
|
|
1011
|
+
beforeAutosuggest: {
|
|
1012
|
+
type: Function,
|
|
1013
|
+
required: !1
|
|
1014
|
+
},
|
|
1015
|
+
searchInputId: {
|
|
1016
|
+
type: String,
|
|
1017
|
+
required: !1
|
|
1018
|
+
},
|
|
1019
|
+
suggestAfterMinChars: {
|
|
1020
|
+
type: Number,
|
|
1021
|
+
required: !1,
|
|
1022
|
+
default: 3
|
|
1023
|
+
}
|
|
1024
|
+
},
|
|
1025
|
+
data() {
|
|
1026
|
+
return {};
|
|
1027
|
+
},
|
|
1028
|
+
methods: {},
|
|
1029
|
+
computed: {
|
|
1030
|
+
hasInputSlot() {
|
|
1031
|
+
return !!this.$slots.input;
|
|
1032
|
+
}
|
|
1033
|
+
},
|
|
1034
|
+
mounted() {
|
|
1035
|
+
if (k.searchstax) {
|
|
1036
|
+
const s = {};
|
|
1037
|
+
this.beforeSearch && (s.beforeSearch = this.beforeSearch), this.afterSearch && (s.afterSearch = this.afterSearch), this.afterAutosuggest && (s.afterAutosuggest = this.afterAutosuggest), this.beforeAutosuggest && (s.beforeAutosuggest = this.beforeAutosuggest), k.searchstax.addSearchInputWidget("searchstax-input-container", {
|
|
1038
|
+
suggestAfterMinChars: this.suggestAfterMinChars,
|
|
1039
|
+
hideBranding: !0,
|
|
1040
|
+
hooks: s,
|
|
1041
|
+
templates: {
|
|
1042
|
+
searchInputId: this.searchInputId ?? "searchstax-search-input"
|
|
1043
|
+
}
|
|
1044
|
+
});
|
|
1045
|
+
} else
|
|
1046
|
+
throw Error("Searchstax instance needs to be passed via props");
|
|
1047
|
+
}
|
|
1048
|
+
}), Re = { id: "searchstax-input-container" }, Le = { class: "searchstax-search-input-container" }, Te = {
|
|
1049
|
+
key: 0,
|
|
1050
|
+
class: "searchstax-search-input-wrapper"
|
|
1051
|
+
}, we = /* @__PURE__ */ p("input", {
|
|
1052
|
+
type: "text",
|
|
1053
|
+
id: "searchstax-search-input",
|
|
1054
|
+
class: "searchstax-search-input",
|
|
1055
|
+
placeholder: "SEARCH FOR..."
|
|
1056
|
+
}, null, -1), Ee = /* @__PURE__ */ p("button", {
|
|
1057
|
+
class: "searchstax-spinner-icon",
|
|
1058
|
+
id: "searchstax-search-input-action-button"
|
|
1059
|
+
}, null, -1), Ve = [
|
|
1060
|
+
we,
|
|
1061
|
+
Ee
|
|
1062
|
+
];
|
|
1063
|
+
function _e(s, e, t, r, a, i) {
|
|
1064
|
+
return g(), d("div", Re, [
|
|
1065
|
+
p("div", Le, [
|
|
1066
|
+
s.hasInputSlot ? b("", !0) : (g(), d("div", Te, Ve)),
|
|
1067
|
+
B(s.$slots, "input")
|
|
1068
|
+
])
|
|
1069
|
+
]);
|
|
1070
|
+
}
|
|
1071
|
+
const Me = /* @__PURE__ */ j(Ae, [["render", _e]]), qe = U({
|
|
1072
|
+
name: "SearchstaxResultsWidget",
|
|
1073
|
+
props: {
|
|
1074
|
+
afterLinkClick: {
|
|
1075
|
+
type: Function,
|
|
1076
|
+
required: !1
|
|
1077
|
+
}
|
|
1078
|
+
},
|
|
1079
|
+
computed: {
|
|
1080
|
+
hasNoResultsSlot() {
|
|
1081
|
+
return !!this.$slots.noResult;
|
|
1082
|
+
},
|
|
1083
|
+
hasResultSlot() {
|
|
1084
|
+
return !!this.$slots.results;
|
|
1085
|
+
},
|
|
1086
|
+
hooks() {
|
|
1087
|
+
const s = {};
|
|
1088
|
+
return this.afterLinkClick && (s.afterLinkClick = this.afterLinkClick), s;
|
|
1089
|
+
}
|
|
1090
|
+
},
|
|
1091
|
+
data() {
|
|
1092
|
+
return {
|
|
1093
|
+
searchResults: null,
|
|
1094
|
+
searchTerm: "",
|
|
1095
|
+
store: k
|
|
1096
|
+
};
|
|
1097
|
+
},
|
|
1098
|
+
methods: {
|
|
1099
|
+
resultClicked(s, e) {
|
|
1100
|
+
e.preventDefault(), e.stopPropagation(), k.searchstax.executeLinkClick(s.uniqueId);
|
|
1101
|
+
},
|
|
1102
|
+
attachObservables() {
|
|
1103
|
+
k.searchstax.dataLayer.searchResultsObservable.subscribe(
|
|
1104
|
+
(s) => {
|
|
1105
|
+
this.searchResults = s;
|
|
1106
|
+
}
|
|
1107
|
+
), k.searchstax.dataLayer.searchTermChangeObservable.subscribe(
|
|
1108
|
+
(s) => {
|
|
1109
|
+
this.searchTerm = s;
|
|
1110
|
+
}
|
|
1111
|
+
);
|
|
1112
|
+
}
|
|
1113
|
+
},
|
|
1114
|
+
mounted() {
|
|
1115
|
+
if (k.searchstax)
|
|
1116
|
+
this.attachObservables(), k.searchstax.addSearchResultsWidget("searchstax-results-container", {
|
|
1117
|
+
hideUniqueKey: !0,
|
|
1118
|
+
// searchResultUniqueIdAttribute: ' data-searchstax-unique-result-id', if custom result template is used
|
|
1119
|
+
// points to an attribute that will be used to identify a result
|
|
1120
|
+
searchResultsContainerId: "searchstax-result-container",
|
|
1121
|
+
// if main template is over ridden this points to an
|
|
1122
|
+
// id in the main element where results need to be rendered
|
|
1123
|
+
templates: {},
|
|
1124
|
+
hooks: this.hooks
|
|
1125
|
+
});
|
|
1126
|
+
else
|
|
1127
|
+
throw Error("Searchstax instance needs to be passed via props");
|
|
1128
|
+
}
|
|
1129
|
+
}), Oe = { id: "searchstax-results-container" }, Be = { class: "searchstax-search-results-container" }, He = { id: "searchstax-result-container" }, Pe = { key: 0 }, $e = { class: "searchstax-no-results" }, Ue = /* @__PURE__ */ p("strong", null, "no results", -1), Ke = /* @__PURE__ */ p("br", null, null, -1), je = { key: 0 }, We = {
|
|
1130
|
+
href: "#",
|
|
1131
|
+
class: "searchstax-suggestion-term"
|
|
1132
|
+
}, Fe = /* @__PURE__ */ p("div", null, [
|
|
1133
|
+
/* @__PURE__ */ p("p", null, " Try searching for search related terms or topics. We offer a wide variety of content to help you get the information you need. "),
|
|
1134
|
+
/* @__PURE__ */ p("p", null, "Lost? Click on the ‘X” in the Search Box to reset your search.")
|
|
1135
|
+
], -1), De = {
|
|
1136
|
+
key: 2,
|
|
1137
|
+
class: "searchstax-search-results"
|
|
1138
|
+
}, Ne = ["href", "data-searchstax-unique-result-id", "onClick"], ze = {
|
|
1139
|
+
key: 1,
|
|
1140
|
+
class: "searchstax-search-result-ribbon"
|
|
1141
|
+
}, Qe = ["src"], Ge = { class: "searchstax-search-result-title-container" }, Xe = { class: "searchstax-search-result-title" }, Je = {
|
|
1142
|
+
key: 3,
|
|
1143
|
+
class: "searchstax-search-result-common"
|
|
1144
|
+
}, Ye = {
|
|
1145
|
+
key: 4,
|
|
1146
|
+
class: "searchstax-search-result-description searchstax-search-result-common"
|
|
1147
|
+
}, Ze = {
|
|
1148
|
+
key: 0,
|
|
1149
|
+
class: "searchstax-search-result-image-container"
|
|
1150
|
+
}, et = ["src"], tt = { key: 1 }, st = { class: "searchstax-search-result-common" }, at = { key: 3 };
|
|
1151
|
+
function rt(s, e, t, r, a, i) {
|
|
1152
|
+
var n, o;
|
|
1153
|
+
return g(), d("div", Oe, [
|
|
1154
|
+
p("div", Be, [
|
|
1155
|
+
p("div", He, [
|
|
1156
|
+
s.searchResults && s.searchResults.length === 0 && !s.hasNoResultsSlot ? (g(), d("div", Pe, [
|
|
1157
|
+
p("div", $e, [
|
|
1158
|
+
O(" Showing "),
|
|
1159
|
+
Ue,
|
|
1160
|
+
O(" for "),
|
|
1161
|
+
p("strong", null, '"' + A(s.searchTerm) + '"', 1),
|
|
1162
|
+
Ke,
|
|
1163
|
+
(n = s.store.searchstax.dataLayer.searchResultsMetadataValue) != null && n.spellingSuggestion ? (g(), d("span", je, [
|
|
1164
|
+
O(" Did you mean "),
|
|
1165
|
+
p("a", We, A((o = s.store.searchstax.dataLayer.searchResultsMetadataValue) == null ? void 0 : o.spellingSuggestion), 1),
|
|
1166
|
+
O("?")
|
|
1167
|
+
])) : b("", !0)
|
|
1168
|
+
]),
|
|
1169
|
+
Fe
|
|
1170
|
+
])) : b("", !0),
|
|
1171
|
+
s.searchResults && s.searchResults.length === 0 && s.hasNoResultsSlot ? B(s.$slots, "noResult", { key: 1 }) : b("", !0),
|
|
1172
|
+
s.searchResults && s.searchResults.length && !s.hasResultSlot ? (g(), d("div", De, [
|
|
1173
|
+
(g(!0), d(D, null, N(s.searchResults, (u) => (g(), d("div", {
|
|
1174
|
+
class: "searchstax-search-result",
|
|
1175
|
+
key: u.uniqueId
|
|
1176
|
+
}, [
|
|
1177
|
+
u.url ? (g(), d("a", {
|
|
1178
|
+
key: 0,
|
|
1179
|
+
href: u.url,
|
|
1180
|
+
"data-searchstax-unique-result-id": u.uniqueId,
|
|
1181
|
+
onClick: (c) => s.resultClicked(u, c),
|
|
1182
|
+
class: "searchstax-result-item-link"
|
|
1183
|
+
}, null, 8, Ne)) : b("", !0),
|
|
1184
|
+
u.ribbon ? (g(), d("div", ze, A(u.ribbon), 1)) : b("", !0),
|
|
1185
|
+
u.thumbnail ? (g(), d("img", {
|
|
1186
|
+
key: 2,
|
|
1187
|
+
src: u.thumbnail,
|
|
1188
|
+
class: "searchstax-thumbnail"
|
|
1189
|
+
}, null, 8, Qe)) : b("", !0),
|
|
1190
|
+
p("div", Ge, [
|
|
1191
|
+
p("span", Xe, A(u.title), 1)
|
|
1192
|
+
]),
|
|
1193
|
+
u.paths ? (g(), d("p", Je, A(u.paths), 1)) : b("", !0),
|
|
1194
|
+
u.description ? (g(), d("p", Ye, A(u.description), 1)) : b("", !0),
|
|
1195
|
+
(g(!0), d(D, null, N(u.unmappedFields, (c) => (g(), d("div", {
|
|
1196
|
+
key: c.key
|
|
1197
|
+
}, [
|
|
1198
|
+
c.isImage && typeof c.value == "string" ? (g(), d("div", Ze, [
|
|
1199
|
+
p("img", {
|
|
1200
|
+
src: c.value,
|
|
1201
|
+
class: "searchstax-result-image"
|
|
1202
|
+
}, null, 8, et)
|
|
1203
|
+
])) : (g(), d("div", tt, [
|
|
1204
|
+
p("p", st, A(c.value), 1)
|
|
1205
|
+
]))
|
|
1206
|
+
]))), 128))
|
|
1207
|
+
]))), 128))
|
|
1208
|
+
])) : b("", !0),
|
|
1209
|
+
s.searchResults && s.searchResults.length && s.hasResultSlot ? (g(), d("div", at, [
|
|
1210
|
+
B(s.$slots, "results", {
|
|
1211
|
+
searchResults: s.searchResults,
|
|
1212
|
+
resultClicked: s.resultClicked
|
|
1213
|
+
})
|
|
1214
|
+
])) : b("", !0)
|
|
1215
|
+
])
|
|
1216
|
+
])
|
|
1217
|
+
]);
|
|
1218
|
+
}
|
|
1219
|
+
const it = /* @__PURE__ */ j(qe, [["render", rt]]);
|
|
1220
|
+
const ot = {
|
|
1221
|
+
install: (s) => {
|
|
1222
|
+
s.component("SearchstaxWrapper", xe), s.component("SearchstaxResultWidget", it), s.component("SearchstaxInputWidget", Me);
|
|
1223
|
+
}
|
|
1224
|
+
};
|
|
1225
|
+
export {
|
|
1226
|
+
Me as SearchstaxInputWidget,
|
|
1227
|
+
it as SearchstaxResultWidget,
|
|
1228
|
+
xe as SearchstaxWrapper,
|
|
1229
|
+
ot as default
|
|
1230
|
+
};
|