@searchstax-inc/searchstudio-ux-js 0.3.0 → 0.3.2
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 +15 -216
- package/README.mustache +10 -216
- package/dist/@searchstax-inc/searchstudio-ux-js.cjs +12 -7
- package/dist/@searchstax-inc/searchstudio-ux-js.d.mts +16 -7
- package/dist/@searchstax-inc/searchstudio-ux-js.d.ts +16 -7
- package/dist/@searchstax-inc/searchstudio-ux-js.iife.js +10 -5
- package/dist/@searchstax-inc/searchstudio-ux-js.mjs +103 -68
- package/dist/styles/mainTheme.css +5 -0
- package/dist/styles/scss/widgets/searchFeedback/style.scss +10 -0
- package/package.json +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
var
|
|
2
|
-
var z = (o, e, t) => e in o ?
|
|
1
|
+
var _ = Object.defineProperty;
|
|
2
|
+
var z = (o, e, t) => e in o ? _(o, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : o[e] = t;
|
|
3
3
|
var n = (o, e, t) => (z(o, typeof e != "symbol" ? e + "" : e, t), t);
|
|
4
|
-
var x = /* @__PURE__ */ ((o) => (o[o.mustache = 0] = "mustache", o[o.vue = 1] = "vue", o[o.react = 2] = "react", o))(x || {});
|
|
4
|
+
var x = /* @__PURE__ */ ((o) => (o[o.mustache = 0] = "mustache", o[o.vue = 1] = "vue", o[o.react = 2] = "react", o[o.angular = 3] = "angular", o))(x || {});
|
|
5
5
|
class J {
|
|
6
6
|
constructor(e) {
|
|
7
7
|
n(this, "dataLayer");
|
|
@@ -39,10 +39,18 @@ class J {
|
|
|
39
39
|
get results() {
|
|
40
40
|
return this.dataLayer.searchResults ?? [];
|
|
41
41
|
}
|
|
42
|
-
get
|
|
42
|
+
get autoCorrectedQuery() {
|
|
43
|
+
var e;
|
|
44
|
+
return ((e = this.dataLayer.searchResultsMetadata) == null ? void 0 : e.autoCorrectedQuery) || "";
|
|
45
|
+
}
|
|
46
|
+
get originalQuery() {
|
|
43
47
|
var e;
|
|
44
48
|
return ((e = this.dataLayer.searchObject) == null ? void 0 : e.query) || "";
|
|
45
49
|
}
|
|
50
|
+
get searchTerm() {
|
|
51
|
+
var e, t;
|
|
52
|
+
return ((e = this.dataLayer.searchResultsMetadata) == null ? void 0 : e.autoCorrectedQuery) || ((t = this.dataLayer.searchObject) == null ? void 0 : t.query) || "";
|
|
53
|
+
}
|
|
46
54
|
get searchExecuted() {
|
|
47
55
|
var e, t, a;
|
|
48
56
|
return ((e = this.dataLayer.searchObject) == null ? void 0 : e.query) !== void 0 && ((t = this.dataLayer.searchObject) == null ? void 0 : t.query) !== "undefined" && ((a = this.dataLayer.searchObject) == null ? void 0 : a.query) !== "";
|
|
@@ -78,6 +86,8 @@ class J {
|
|
|
78
86
|
isLastPage: this.isLastPage,
|
|
79
87
|
results: this.results,
|
|
80
88
|
searchTerm: this.searchTerm !== "undefined" ? this.searchTerm : "",
|
|
89
|
+
autoCorrectedQuery: this.autoCorrectedQuery,
|
|
90
|
+
originalQuery: this.originalQuery,
|
|
81
91
|
selectedFacets: this.selectedFacets,
|
|
82
92
|
searchExecuted: this.searchExecuted,
|
|
83
93
|
relatedSearches: this.relatedSearches,
|
|
@@ -102,7 +112,7 @@ class J {
|
|
|
102
112
|
};
|
|
103
113
|
}
|
|
104
114
|
}
|
|
105
|
-
class
|
|
115
|
+
class E {
|
|
106
116
|
static deepEqual(e, t) {
|
|
107
117
|
const a = Object.keys(e), r = Object.keys(t);
|
|
108
118
|
if (a.length !== r.length)
|
|
@@ -173,6 +183,7 @@ class X {
|
|
|
173
183
|
n(this, "renderingEngineValue", x.mustache);
|
|
174
184
|
n(this, "parsedData", new J(this));
|
|
175
185
|
n(this, "sessionId");
|
|
186
|
+
n(this, "autocorrect", !1);
|
|
176
187
|
this.sessionId = e;
|
|
177
188
|
}
|
|
178
189
|
setSearchTerm(e) {
|
|
@@ -188,10 +199,10 @@ class X {
|
|
|
188
199
|
this.$loadingChange.setValue(e);
|
|
189
200
|
}
|
|
190
201
|
setSearchResults(e) {
|
|
191
|
-
|
|
202
|
+
E.deepEqual(e, this.searchResults ?? []) || this.$searchResults.setValue(e);
|
|
192
203
|
}
|
|
193
204
|
setSearchResultsMetadata(e) {
|
|
194
|
-
|
|
205
|
+
E.deepEqual(e, this.searchResultsMetadata ?? {}) || this.$searchResultsMetadata.setValue(e);
|
|
195
206
|
}
|
|
196
207
|
setSearchAutosuggest(e) {
|
|
197
208
|
this.$searchAutosuggest.setValue(e);
|
|
@@ -199,19 +210,19 @@ class X {
|
|
|
199
210
|
setSearchObject(e) {
|
|
200
211
|
var a, r;
|
|
201
212
|
let t = e;
|
|
202
|
-
(r = (a = this.searchstaxConfig) == null ? void 0 : a.hooks) != null && r.beforeSearch && t && (t = this.searchstaxConfig.hooks.beforeSearch(t)), t && (
|
|
213
|
+
(r = (a = this.searchstaxConfig) == null ? void 0 : a.hooks) != null && r.beforeSearch && t && (t = this.searchstaxConfig.hooks.beforeSearch(t)), t && (E.deepEqual(t, this.searchObject ?? {}) || this.$searchObject.setValue(t));
|
|
203
214
|
}
|
|
204
215
|
setSearchFacets(e) {
|
|
205
|
-
|
|
216
|
+
E.deepEqual(e, this.searchFacets ?? []) || this.$searchFacets.setValue(e);
|
|
206
217
|
}
|
|
207
218
|
setSearchFacetsCached(e) {
|
|
208
|
-
|
|
219
|
+
E.deepEqual(e, this.searchFacetsCached ?? []) || this.$searchFacetsCached.setValue(e);
|
|
209
220
|
}
|
|
210
221
|
setSearchRelatedSearches(e) {
|
|
211
|
-
|
|
222
|
+
E.deepEqual(e, this.searchRelatedSearches ?? []) || this.$searchRelatedSearches.setValue(e);
|
|
212
223
|
}
|
|
213
224
|
setSearchExternalPromotions(e) {
|
|
214
|
-
|
|
225
|
+
E.deepEqual(e, this.searchExternalPromotions ?? []) || this.$searchExternalPromotions.setValue(e);
|
|
215
226
|
}
|
|
216
227
|
setLanguage(e) {
|
|
217
228
|
this.$language.setValue(e);
|
|
@@ -316,6 +327,7 @@ class D {
|
|
|
316
327
|
latency: parseInt(e.responseHeader.QTime + ""),
|
|
317
328
|
endDocValue: parseInt(e.responseHeader.params.rows) + parseInt(e.response.start + ""),
|
|
318
329
|
spellingSuggestion: t,
|
|
330
|
+
autoCorrectedQuery: e.responseHeader.params.autoCorrectedQ ?? "",
|
|
319
331
|
impressions: this.getImpressions(e)
|
|
320
332
|
};
|
|
321
333
|
}
|
|
@@ -556,7 +568,7 @@ class Y {
|
|
|
556
568
|
(h) => h.type === "and" || h.type === "tabs"
|
|
557
569
|
),
|
|
558
570
|
!1
|
|
559
|
-
) + i +
|
|
571
|
+
) + i + `&spellcheck.correct=${this.dataLayer.autocorrect}&language=` + this.dataLayer.language + s, l = {
|
|
560
572
|
method: "GET",
|
|
561
573
|
headers: this.authHeader,
|
|
562
574
|
credentials: "same-origin",
|
|
@@ -631,7 +643,7 @@ class Z {
|
|
|
631
643
|
document.cookie = s;
|
|
632
644
|
}
|
|
633
645
|
}
|
|
634
|
-
class
|
|
646
|
+
class j {
|
|
635
647
|
static trackClick(e) {
|
|
636
648
|
const t = {
|
|
637
649
|
key: e.trackApiKey,
|
|
@@ -698,19 +710,19 @@ class B {
|
|
|
698
710
|
}
|
|
699
711
|
}
|
|
700
712
|
//@ts-ignore
|
|
701
|
-
n(
|
|
713
|
+
n(j, "msq", window._msq || []);
|
|
702
714
|
/*!
|
|
703
715
|
* mustache.js - Logic-less {{mustache}} templates with JavaScript
|
|
704
716
|
* http://github.com/janl/mustache.js
|
|
705
717
|
*/
|
|
706
|
-
var ee = Object.prototype.toString,
|
|
718
|
+
var ee = Object.prototype.toString, A = Array.isArray || function(e) {
|
|
707
719
|
return ee.call(e) === "[object Array]";
|
|
708
720
|
};
|
|
709
721
|
function U(o) {
|
|
710
722
|
return typeof o == "function";
|
|
711
723
|
}
|
|
712
724
|
function te(o) {
|
|
713
|
-
return
|
|
725
|
+
return A(o) ? "array" : typeof o;
|
|
714
726
|
}
|
|
715
727
|
function N(o) {
|
|
716
728
|
return o.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g, "\\$&");
|
|
@@ -744,7 +756,7 @@ function le(o) {
|
|
|
744
756
|
return ce[t];
|
|
745
757
|
});
|
|
746
758
|
}
|
|
747
|
-
var oe = /\s*/, he = /\s+/,
|
|
759
|
+
var oe = /\s*/, he = /\s+/, Q = /\s*=/, ue = /\s*\}/, de = /#|\^|\/|>|\{|&|=|!/;
|
|
748
760
|
function ge(o, e) {
|
|
749
761
|
if (!o)
|
|
750
762
|
return [];
|
|
@@ -759,19 +771,19 @@ function ge(o, e) {
|
|
|
759
771
|
}
|
|
760
772
|
var g, p, y;
|
|
761
773
|
function b(T) {
|
|
762
|
-
if (typeof T == "string" && (T = T.split(he, 2)), !
|
|
774
|
+
if (typeof T == "string" && (T = T.split(he, 2)), !A(T) || T.length !== 2)
|
|
763
775
|
throw new Error("Invalid tags: " + T);
|
|
764
776
|
g = new RegExp(N(T[0]) + "\\s*"), p = new RegExp("\\s*" + N(T[1])), y = new RegExp("\\s*" + N("}" + T[1]));
|
|
765
777
|
}
|
|
766
778
|
b(e || m.tags);
|
|
767
779
|
for (var f = new V(o), C, v, S, R, P, L; !f.eos(); ) {
|
|
768
780
|
if (C = f.pos, S = f.scanUntil(g), S)
|
|
769
|
-
for (var
|
|
770
|
-
R = S.charAt(
|
|
781
|
+
for (var M = 0, F = S.length; M < F; ++M)
|
|
782
|
+
R = S.charAt(M), ne(R) ? (s.push(r.length), l += R) : (c = !0, t = !0, l += " "), r.push(["text", R, C, C + 1]), C += 1, R === `
|
|
771
783
|
` && (u(), l = "", h = 0, t = !1);
|
|
772
784
|
if (!f.scan(g))
|
|
773
785
|
break;
|
|
774
|
-
if (i = !0, v = f.scan(de) || "name", f.scan(oe), v === "=" ? (S = f.scanUntil(
|
|
786
|
+
if (i = !0, v = f.scan(de) || "name", f.scan(oe), v === "=" ? (S = f.scanUntil(Q), f.scan(Q), f.scanUntil(p)) : v === "{" ? (S = f.scanUntil(y), f.scan(ue), f.scanUntil(p), v = "&") : S = f.scanUntil(p), !f.scan(p))
|
|
775
787
|
throw new Error("Unclosed tag at " + f.pos);
|
|
776
788
|
if (v == ">" ? P = [v, S, C, f.pos, l, h, t] : P = [v, S, C, f.pos], h++, r.push(P), v === "#" || v === "^")
|
|
777
789
|
a.push(P);
|
|
@@ -834,13 +846,13 @@ V.prototype.scanUntil = function(e) {
|
|
|
834
846
|
}
|
|
835
847
|
return this.pos += a.length, a;
|
|
836
848
|
};
|
|
837
|
-
function
|
|
849
|
+
function q(o, e) {
|
|
838
850
|
this.view = o, this.cache = { ".": this.view }, this.parent = e;
|
|
839
851
|
}
|
|
840
|
-
|
|
841
|
-
return new
|
|
852
|
+
q.prototype.push = function(e) {
|
|
853
|
+
return new q(e, this);
|
|
842
854
|
};
|
|
843
|
-
|
|
855
|
+
q.prototype.lookup = function(e) {
|
|
844
856
|
var t = this.cache, a;
|
|
845
857
|
if (t.hasOwnProperty(e))
|
|
846
858
|
a = t[e];
|
|
@@ -883,7 +895,7 @@ k.prototype.parse = function(e, t) {
|
|
|
883
895
|
return i == null && (i = ge(e, t), s && a.set(r, i)), i;
|
|
884
896
|
};
|
|
885
897
|
k.prototype.render = function(e, t, a, r) {
|
|
886
|
-
var s = this.getConfigTags(r), i = this.parse(e, s), c = t instanceof
|
|
898
|
+
var s = this.getConfigTags(r), i = this.parse(e, s), c = t instanceof q ? t : new q(t, void 0);
|
|
887
899
|
return this.renderTokens(i, c, a, e, r);
|
|
888
900
|
};
|
|
889
901
|
k.prototype.renderTokens = function(e, t, a, r, s) {
|
|
@@ -897,7 +909,7 @@ k.prototype.renderSection = function(e, t, a, r, s) {
|
|
|
897
909
|
return i.render(p, t, a, s);
|
|
898
910
|
}
|
|
899
911
|
if (l) {
|
|
900
|
-
if (
|
|
912
|
+
if (A(l))
|
|
901
913
|
for (var u = 0, g = l.length; u < g; ++u)
|
|
902
914
|
c += this.renderTokens(e[4], t.push(l[u]), a, r, s);
|
|
903
915
|
else if (typeof l == "object" || typeof l == "string" || typeof l == "number")
|
|
@@ -913,7 +925,7 @@ k.prototype.renderSection = function(e, t, a, r, s) {
|
|
|
913
925
|
};
|
|
914
926
|
k.prototype.renderInverted = function(e, t, a, r, s) {
|
|
915
927
|
var i = t.lookup(e[1]);
|
|
916
|
-
if (!i ||
|
|
928
|
+
if (!i || A(i) && i.length === 0)
|
|
917
929
|
return this.renderTokens(e[4], t, a, r, s);
|
|
918
930
|
};
|
|
919
931
|
k.prototype.indentPartial = function(e, t, a) {
|
|
@@ -948,10 +960,10 @@ k.prototype.rawValue = function(e) {
|
|
|
948
960
|
return e[1];
|
|
949
961
|
};
|
|
950
962
|
k.prototype.getConfigTags = function(e) {
|
|
951
|
-
return
|
|
963
|
+
return A(e) ? e : e && typeof e == "object" ? e.tags : void 0;
|
|
952
964
|
};
|
|
953
965
|
k.prototype.getConfigEscape = function(e) {
|
|
954
|
-
if (e && typeof e == "object" && !
|
|
966
|
+
if (e && typeof e == "object" && !A(e))
|
|
955
967
|
return e.escape;
|
|
956
968
|
};
|
|
957
969
|
var m = {
|
|
@@ -971,29 +983,29 @@ var m = {
|
|
|
971
983
|
* the cache by setting it to the literal `undefined`.
|
|
972
984
|
*/
|
|
973
985
|
set templateCache(o) {
|
|
974
|
-
|
|
986
|
+
B.templateCache = o;
|
|
975
987
|
},
|
|
976
988
|
/**
|
|
977
989
|
* Gets the default or overridden caching object from the default writer.
|
|
978
990
|
*/
|
|
979
991
|
get templateCache() {
|
|
980
|
-
return
|
|
992
|
+
return B.templateCache;
|
|
981
993
|
}
|
|
982
|
-
},
|
|
994
|
+
}, B = new k();
|
|
983
995
|
m.clearCache = function() {
|
|
984
|
-
return
|
|
996
|
+
return B.clearCache();
|
|
985
997
|
};
|
|
986
998
|
m.parse = function(e, t) {
|
|
987
|
-
return
|
|
999
|
+
return B.parse(e, t);
|
|
988
1000
|
};
|
|
989
1001
|
m.render = function(e, t, a, r) {
|
|
990
1002
|
if (typeof e != "string")
|
|
991
1003
|
throw new TypeError('Invalid template! Template should be a "string" but "' + te(e) + '" was given as the first argument for mustache#render(template, view, partials)');
|
|
992
|
-
return
|
|
1004
|
+
return B.render(e, t, a, r);
|
|
993
1005
|
};
|
|
994
1006
|
m.escape = le;
|
|
995
1007
|
m.Scanner = V;
|
|
996
|
-
m.Context =
|
|
1008
|
+
m.Context = q;
|
|
997
1009
|
m.Writer = k;
|
|
998
1010
|
const me = {
|
|
999
1011
|
mainTemplate: {
|
|
@@ -1182,9 +1194,15 @@ const me = {
|
|
|
1182
1194
|
{{#searchExecuted}}
|
|
1183
1195
|
<div class="searchstax-feedback-container">
|
|
1184
1196
|
Showing <b>{{startResultIndex}} - {{endResultIndex}}</b> of <b>{{totalResults}}</b> results {{#searchTerm}} for "<b>{{searchTerm}}</b>" {{/searchTerm}}
|
|
1197
|
+
<div class="searchstax-feedback-container-suggested">
|
|
1198
|
+
{{#autoCorrectedQuery}}
|
|
1199
|
+
Search instead for <a href="#" class="searchstax-feedback-original-query">{{originalQuery}}</a>
|
|
1200
|
+
{{/autoCorrectedQuery}}
|
|
1201
|
+
</div>
|
|
1185
1202
|
</div>
|
|
1186
1203
|
{{/searchExecuted}}
|
|
1187
|
-
|
|
1204
|
+
`,
|
|
1205
|
+
originalQueryClass: "searchstax-feedback-original-query"
|
|
1188
1206
|
}
|
|
1189
1207
|
}, be = {
|
|
1190
1208
|
mainTemplate: {
|
|
@@ -1384,8 +1402,8 @@ class ke {
|
|
|
1384
1402
|
const i = this.dataLayer.searchObject;
|
|
1385
1403
|
let c = [...i.facets];
|
|
1386
1404
|
const l = this.extractFacetValue(t);
|
|
1387
|
-
s.checked ? c.find((u) =>
|
|
1388
|
-
(h) => !
|
|
1405
|
+
s.checked ? c.find((u) => E.deepEqual(u, l) ? u : !1) || (this.config.facetingType === "tabs" && (c = c.filter((u) => u.name !== l.name)), c.push(l)) : c = c.filter(
|
|
1406
|
+
(h) => !E.deepEqual(h, l)
|
|
1389
1407
|
), setTimeout(() => {
|
|
1390
1408
|
this.dataLayer.setSearchObject({ ...i, facets: c, page: 1 }), this.config.facetingType === "tabs" && this.renderMainTemplate(this.generateTemplateData(), !0);
|
|
1391
1409
|
}, 0);
|
|
@@ -1491,21 +1509,21 @@ class ke {
|
|
|
1491
1509
|
var l, h, u, g, p, y, b, f, C, v, S, R, P, L;
|
|
1492
1510
|
const a = document.createElement("div");
|
|
1493
1511
|
a.classList.add("searchstax-facet-value-container"), e.disabled && a.classList.add("searchstax-facet-value-disabled");
|
|
1494
|
-
const s = !!((l = this.dataLayer.searchObject.facets) != null && l.find((
|
|
1512
|
+
const s = !!((l = this.dataLayer.searchObject.facets) != null && l.find((M) => E.deepEqual(M, this.extractFacetValue(e)))), i = ((g = (u = (h = this.config) == null ? void 0 : h.templates) == null ? void 0 : u.facetItemTemplate) == null ? void 0 : g.template) || ((p = d.facets.facetItemTemplate) == null ? void 0 : p.template);
|
|
1495
1513
|
a.innerHTML = m.render(
|
|
1496
1514
|
i,
|
|
1497
1515
|
{ ...e, isChecked: s }
|
|
1498
1516
|
);
|
|
1499
1517
|
let c = (y = d.facets.facetItemTemplate) == null ? void 0 : y.checkTriggerClasses;
|
|
1500
|
-
c = ((C = (f = (b = this.config) == null ? void 0 : b.templates) == null ? void 0 : f.facetItemTemplate) == null ? void 0 : C.checkTriggerClasses) || c, c.forEach((
|
|
1518
|
+
c = ((C = (f = (b = this.config) == null ? void 0 : b.templates) == null ? void 0 : f.facetItemTemplate) == null ? void 0 : C.checkTriggerClasses) || c, c.forEach((M) => {
|
|
1501
1519
|
var F;
|
|
1502
|
-
(F = a.querySelector("." +
|
|
1520
|
+
(F = a.querySelector("." + M)) == null || F.addEventListener("click", (T) => {
|
|
1503
1521
|
this.onFacetSelect(T, e, a);
|
|
1504
1522
|
});
|
|
1505
1523
|
}), (L = a.querySelector(
|
|
1506
1524
|
"." + (((R = (S = (v = this.config) == null ? void 0 : v.templates) == null ? void 0 : S.facetItemTemplate) == null ? void 0 : R.inputCheckboxClass) || ((P = d.facets.facetItemTemplate) == null ? void 0 : P.inputCheckboxClass))
|
|
1507
|
-
)) == null || L.addEventListener("click", (
|
|
1508
|
-
this.onFacetSelect(
|
|
1525
|
+
)) == null || L.addEventListener("click", (M) => {
|
|
1526
|
+
this.onFacetSelect(M, e, a, !0);
|
|
1509
1527
|
}), t.appendChild(a);
|
|
1510
1528
|
}
|
|
1511
1529
|
createHasMoreComponent(e, t, a) {
|
|
@@ -1534,7 +1552,7 @@ class ke {
|
|
|
1534
1552
|
}
|
|
1535
1553
|
renderMainTemplate(e, t) {
|
|
1536
1554
|
var a, r, s, i, c, l, h, u, g, p, y;
|
|
1537
|
-
if (e && (!
|
|
1555
|
+
if (e && (!E.deepEqual(this.cachedData ?? {}, e) || t)) {
|
|
1538
1556
|
this.cachedData = e;
|
|
1539
1557
|
const b = ((s = (r = (a = this.config) == null ? void 0 : a.templates) == null ? void 0 : r.mainTemplateDesktop) == null ? void 0 : s.template) || ((i = d.facets.mainTemplateDesktop) == null ? void 0 : i.template);
|
|
1540
1558
|
if (this.dataLayer.renderingEngine === x.mustache && this.searchFacetsMainContainer) {
|
|
@@ -1641,9 +1659,9 @@ class ke {
|
|
|
1641
1659
|
if (e) {
|
|
1642
1660
|
const L = document.createElement("div");
|
|
1643
1661
|
L.classList.add("searchstax-facets-container-mobile");
|
|
1644
|
-
const
|
|
1662
|
+
const M = ((r = (a = (t = this.config) == null ? void 0 : t.templates) == null ? void 0 : a.mainTemplateMobile) == null ? void 0 : r.template) || ((s = d.facets.mainTemplateMobile) == null ? void 0 : s.template);
|
|
1645
1663
|
if (this.dataLayer.renderingEngine === x.mustache) {
|
|
1646
|
-
if (L.innerHTML = m.render(
|
|
1664
|
+
if (L.innerHTML = m.render(M, {
|
|
1647
1665
|
...e,
|
|
1648
1666
|
overlayOpened: this.overlayOpened
|
|
1649
1667
|
}), (i = this.searchFacetsMainContainer) == null || i.appendChild(L), (l = (c = this.config) == null ? void 0 : c.templates) != null && l.mainTemplateMobile)
|
|
@@ -1806,9 +1824,10 @@ class Pe {
|
|
|
1806
1824
|
n(this, "config");
|
|
1807
1825
|
n(this, "containerId");
|
|
1808
1826
|
n(this, "searchFeedbackMainContainer", null);
|
|
1809
|
-
this
|
|
1827
|
+
n(this, "searchTrigger");
|
|
1828
|
+
this.dataLayer = e.dataLayer, this.config = e.config, this.containerId = e.containerId, this.searchTrigger = e.searchTrigger, this.searchFeedbackMainContainer = document.getElementById(
|
|
1810
1829
|
this.containerId
|
|
1811
|
-
), this.initializeSubscriptions()
|
|
1830
|
+
), this.initializeSubscriptions();
|
|
1812
1831
|
}
|
|
1813
1832
|
initializeSubscriptions() {
|
|
1814
1833
|
this.dataLayer.$searchResults.subscribe((e) => {
|
|
@@ -1820,16 +1839,31 @@ class Pe {
|
|
|
1820
1839
|
...this.dataLayer.parsedData.data
|
|
1821
1840
|
};
|
|
1822
1841
|
}
|
|
1842
|
+
onOriginalQueryClick(e) {
|
|
1843
|
+
var a;
|
|
1844
|
+
e.stopPropagation(), e.preventDefault();
|
|
1845
|
+
const t = (a = e.target) == null ? void 0 : a.innerHTML;
|
|
1846
|
+
this.searchTrigger(t);
|
|
1847
|
+
}
|
|
1848
|
+
attachClick() {
|
|
1849
|
+
var t, a, r, s, i;
|
|
1850
|
+
const e = (i = this.searchFeedbackMainContainer) == null ? void 0 : i.querySelector(
|
|
1851
|
+
"." + (((r = (a = (t = this.config) == null ? void 0 : t.templates) == null ? void 0 : a.main) == null ? void 0 : r.originalQueryClass) || ((s = d.searchFeedback.main) == null ? void 0 : s.originalQueryClass))
|
|
1852
|
+
);
|
|
1853
|
+
e && e.addEventListener("click", this.onOriginalQueryClick.bind(this));
|
|
1854
|
+
}
|
|
1823
1855
|
renderMainTemplate(e) {
|
|
1824
1856
|
var a, r, s;
|
|
1825
1857
|
const t = ((s = (r = (a = this.config) == null ? void 0 : a.templates) == null ? void 0 : r.main) == null ? void 0 : s.template) || d.searchFeedback.main.template;
|
|
1826
1858
|
this.dataLayer.renderingEngine === x.mustache && (this.searchFeedbackMainContainer.innerHTML = m.render(
|
|
1827
1859
|
t,
|
|
1828
1860
|
e
|
|
1829
|
-
))
|
|
1861
|
+
), setTimeout(() => {
|
|
1862
|
+
this.attachClick();
|
|
1863
|
+
}, 0));
|
|
1830
1864
|
}
|
|
1831
1865
|
}
|
|
1832
|
-
class
|
|
1866
|
+
class Me {
|
|
1833
1867
|
constructor(e) {
|
|
1834
1868
|
n(this, "dataLayer");
|
|
1835
1869
|
n(this, "config");
|
|
@@ -1993,7 +2027,7 @@ class Ee {
|
|
|
1993
2027
|
}
|
|
1994
2028
|
}
|
|
1995
2029
|
}
|
|
1996
|
-
class
|
|
2030
|
+
class Ee {
|
|
1997
2031
|
constructor(e) {
|
|
1998
2032
|
n(this, "dataLayer");
|
|
1999
2033
|
n(this, "config");
|
|
@@ -2140,7 +2174,7 @@ class we {
|
|
|
2140
2174
|
}
|
|
2141
2175
|
}
|
|
2142
2176
|
}
|
|
2143
|
-
class
|
|
2177
|
+
class qe {
|
|
2144
2178
|
constructor(e = x.mustache) {
|
|
2145
2179
|
n(this, "routerEnabled", !1);
|
|
2146
2180
|
n(this, "cachedQuery", "");
|
|
@@ -2177,7 +2211,7 @@ class Ae {
|
|
|
2177
2211
|
}), this.dataLayer.$searchObject.subscribe((a) => {
|
|
2178
2212
|
a.query !== "" && this.search(a);
|
|
2179
2213
|
}), this.dataLayer.$searchResults.subscribe((a) => {
|
|
2180
|
-
a && this.dataLayer.searchResultsMetadata &&
|
|
2214
|
+
a && this.dataLayer.searchResultsMetadata && j.trackSearch({
|
|
2181
2215
|
...this.dataLayer.parsedData.trackingData,
|
|
2182
2216
|
impressions: this.dataLayer.searchResultsMetadata.impressions
|
|
2183
2217
|
});
|
|
@@ -2185,7 +2219,7 @@ class Ae {
|
|
|
2185
2219
|
}
|
|
2186
2220
|
initialize(e) {
|
|
2187
2221
|
var t, a;
|
|
2188
|
-
this.dataLayer.searchstaxConfig || (this.dataLayer.setSearchstaxConfig(e), this.searchHelper = new Y(
|
|
2222
|
+
this.dataLayer.autocorrect = e.autocorrect ?? !1, this.dataLayer.searchstaxConfig || (this.dataLayer.setSearchstaxConfig(e), this.searchHelper = new Y(
|
|
2189
2223
|
{ ...e, sessionId: this.dataLayer.sessionId },
|
|
2190
2224
|
this.dataLayer
|
|
2191
2225
|
)), ((t = e.router) == null ? void 0 : t.enabled) === void 0 || ((a = e.router) == null ? void 0 : a.enabled) === !0 ? (this.routerEnabled = !0, this.routerHelper = new W(
|
|
@@ -2221,7 +2255,7 @@ class Ae {
|
|
|
2221
2255
|
relatedSearch: i.related_search,
|
|
2222
2256
|
position: i.position
|
|
2223
2257
|
});
|
|
2224
|
-
this.dataLayer.searchResultsMetadata &&
|
|
2258
|
+
this.dataLayer.searchResultsMetadata && j.trackRelatedSearches({
|
|
2225
2259
|
...this.dataLayer.parsedData.trackingData,
|
|
2226
2260
|
impressions: r
|
|
2227
2261
|
}), this.dataLayer.setSearchRelatedSearches(a);
|
|
@@ -2230,12 +2264,12 @@ class Ae {
|
|
|
2230
2264
|
this.routerEnabled && this.routerHelper.updateUrl(this.dataLayer.searchObject);
|
|
2231
2265
|
}
|
|
2232
2266
|
parseSearchResultsResponse(e) {
|
|
2233
|
-
var
|
|
2267
|
+
var s, i;
|
|
2234
2268
|
this.handleRouter();
|
|
2235
2269
|
let t = D.combineResultsWithMetadata(e), a = D.extractFacets(e);
|
|
2236
|
-
this.dataLayer.setSearchFacets(a), (
|
|
2237
|
-
|
|
2238
|
-
), this.dataLayer.setSearchResults(t);
|
|
2270
|
+
this.dataLayer.setSearchFacets(a), (i = (s = this.dataLayer.searchstaxConfig) == null ? void 0 : s.hooks) != null && i.afterSearch && (t = this.dataLayer.searchstaxConfig.hooks.afterSearch(t)), this.dataLayer.setSearchExternalPromotions(e.externalLinks ?? []);
|
|
2271
|
+
const r = D.extractSearchResultsMetadata(e);
|
|
2272
|
+
this.dataLayer.setSearchResultsMetadata(r), this.dataLayer.setSearchResults(t);
|
|
2239
2273
|
}
|
|
2240
2274
|
cacheFacets() {
|
|
2241
2275
|
var e;
|
|
@@ -2257,7 +2291,7 @@ class Ae {
|
|
|
2257
2291
|
this.searchHelper && this.dataLayer.setLanguage(e);
|
|
2258
2292
|
}
|
|
2259
2293
|
addSearchInputWidget(e, t) {
|
|
2260
|
-
this.dataLayer.searchInputConfig || (this.dataLayer.setSearchInputConfig(t), this.searchInputWidget = new
|
|
2294
|
+
this.dataLayer.searchInputConfig || (this.dataLayer.setSearchInputConfig(t), this.searchInputWidget = new Me({
|
|
2261
2295
|
containerId: e,
|
|
2262
2296
|
config: t,
|
|
2263
2297
|
searchTrigger: this.executeSearch.bind(this),
|
|
@@ -2266,7 +2300,7 @@ class Ae {
|
|
|
2266
2300
|
}));
|
|
2267
2301
|
}
|
|
2268
2302
|
addSearchResultsWidget(e, t) {
|
|
2269
|
-
this.searchResultsConfig || (this.searchResultsConfig = t, this.searchResultsWidget = new
|
|
2303
|
+
this.searchResultsConfig || (this.searchResultsConfig = t, this.searchResultsWidget = new Ee({
|
|
2270
2304
|
containerId: e,
|
|
2271
2305
|
linkClickCallback: this.executeLinkClick.bind(this),
|
|
2272
2306
|
searchTrigger: this.executeSearch.bind(this),
|
|
@@ -2286,7 +2320,8 @@ class Ae {
|
|
|
2286
2320
|
this.searchFeedbackConfig || (this.searchFeedbackConfig = t, this.searchFeedbackWidget = new Pe({
|
|
2287
2321
|
containerId: e,
|
|
2288
2322
|
config: t,
|
|
2289
|
-
dataLayer: this.dataLayer
|
|
2323
|
+
dataLayer: this.dataLayer,
|
|
2324
|
+
searchTrigger: this.executeSearch.bind(this)
|
|
2290
2325
|
}));
|
|
2291
2326
|
}
|
|
2292
2327
|
addSearchSortingWidget(e, t) {
|
|
@@ -2337,7 +2372,7 @@ class Ae {
|
|
|
2337
2372
|
(r = (a = this.dataLayer.searchInputConfig) == null ? void 0 : a.hooks) != null && r.beforeAutosuggest && (t = this.dataLayer.searchInputConfig.hooks.beforeAutosuggest(t)), t && t.term !== void 0 && t.queryParams !== void 0 && this.suggest(t.term, t.queryParams);
|
|
2338
2373
|
}
|
|
2339
2374
|
trackRelatedSearchClick(e) {
|
|
2340
|
-
this.dataLayer.searchResultsMetadata && this.dataLayer.searchRelatedSearches &&
|
|
2375
|
+
this.dataLayer.searchResultsMetadata && this.dataLayer.searchRelatedSearches && j.trackRelatedSearchClick({
|
|
2341
2376
|
...this.dataLayer.parsedData.trackingData,
|
|
2342
2377
|
relatedSearch: e
|
|
2343
2378
|
});
|
|
@@ -2348,7 +2383,7 @@ class Ae {
|
|
|
2348
2383
|
e,
|
|
2349
2384
|
this.dataLayer.searchResults ?? []
|
|
2350
2385
|
);
|
|
2351
|
-
t && ((r = (a = this.searchResultsConfig) == null ? void 0 : a.hooks) != null && r.afterLinkClick && (t = this.searchResultsConfig.hooks.afterLinkClick(t)), t && this.dataLayer.searchResultsMetadata && (
|
|
2386
|
+
t && ((r = (a = this.searchResultsConfig) == null ? void 0 : a.hooks) != null && r.afterLinkClick && (t = this.searchResultsConfig.hooks.afterLinkClick(t)), t && this.dataLayer.searchResultsMetadata && (j.trackClick({
|
|
2352
2387
|
result: t,
|
|
2353
2388
|
...this.dataLayer.parsedData.trackingData
|
|
2354
2389
|
}), setTimeout(() => {
|
|
@@ -2365,5 +2400,5 @@ class Ae {
|
|
|
2365
2400
|
}
|
|
2366
2401
|
}
|
|
2367
2402
|
export {
|
|
2368
|
-
|
|
2403
|
+
qe as Searchstax
|
|
2369
2404
|
};
|
|
@@ -429,6 +429,11 @@
|
|
|
429
429
|
.searchstax-feedback-container {
|
|
430
430
|
font-size: 18px;
|
|
431
431
|
font-weight: 300; }
|
|
432
|
+
.searchstax-feedback-container .searchstax-feedback-container-suggested {
|
|
433
|
+
margin-top: 10px; }
|
|
434
|
+
.searchstax-feedback-container .searchstax-feedback-container-suggested a.searchstax-feedback-original-query {
|
|
435
|
+
color: #fc6730;
|
|
436
|
+
text-decoration: none; }
|
|
432
437
|
|
|
433
438
|
.searchstax-sorting-container {
|
|
434
439
|
display: flex;
|
|
@@ -1,4 +1,14 @@
|
|
|
1
|
+
@import "./../../colors.scss";
|
|
1
2
|
.searchstax-feedback-container {
|
|
2
3
|
font-size: 18px;
|
|
3
4
|
font-weight: 300;
|
|
5
|
+
|
|
6
|
+
.searchstax-feedback-container-suggested{
|
|
7
|
+
margin-top: 10px;
|
|
8
|
+
a.searchstax-feedback-original-query{
|
|
9
|
+
color: $actionColor;
|
|
10
|
+
text-decoration: none;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
|
|
4
14
|
}
|