@getlupa/client 0.10.0-alpha-2 → 0.10.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/dist/cjs/components/search-box/SearchBox.vue.d.ts +7 -1
- package/dist/cjs/components/search-box/products/SearchBoxProduct.vue.d.ts +1 -0
- package/dist/cjs/components/search-results/SearchResults.vue.d.ts +2 -0
- package/dist/cjs/components/search-results/filters/facets/StatsFacet.vue.d.ts +2 -0
- package/dist/cjs/components/search-results/products/product-card/SearchResultsProductCard.vue.d.ts +1 -0
- package/dist/cjs/constants/development/searchResultsDev.example.const.d.ts +1 -0
- package/dist/cjs/index.min.js +150 -41
- package/dist/cjs/store/modules/tracking.d.ts +3 -1
- package/dist/cjs/types/AnalyticsOptions.d.ts +3 -2
- package/dist/cjs/types/search-box/Common.d.ts +1 -0
- package/dist/cjs/types/search-results/SearchResultsProductCardOptions.d.ts +1 -0
- package/dist/cjs/utils/string.utils.d.ts +1 -0
- package/dist/es/components/search-box/SearchBox.vue.d.ts +7 -1
- package/dist/es/components/search-box/products/SearchBoxProduct.vue.d.ts +1 -0
- package/dist/es/components/search-results/SearchResults.vue.d.ts +2 -0
- package/dist/es/components/search-results/filters/facets/StatsFacet.vue.d.ts +2 -0
- package/dist/es/components/search-results/products/product-card/SearchResultsProductCard.vue.d.ts +1 -0
- package/dist/es/constants/development/searchResultsDev.example.const.d.ts +1 -0
- package/dist/es/index.min.js +150 -41
- package/dist/es/store/modules/tracking.d.ts +3 -1
- package/dist/es/types/AnalyticsOptions.d.ts +3 -2
- package/dist/es/types/search-box/Common.d.ts +1 -0
- package/dist/es/types/search-results/SearchResultsProductCardOptions.d.ts +1 -0
- package/dist/es/utils/string.utils.d.ts +1 -0
- package/dist/iife/components/search-box/SearchBox.vue.d.ts +7 -1
- package/dist/iife/components/search-box/products/SearchBoxProduct.vue.d.ts +1 -0
- package/dist/iife/components/search-results/SearchResults.vue.d.ts +2 -0
- package/dist/iife/components/search-results/filters/facets/StatsFacet.vue.d.ts +2 -0
- package/dist/iife/components/search-results/products/product-card/SearchResultsProductCard.vue.d.ts +1 -0
- package/dist/iife/constants/development/searchResultsDev.example.const.d.ts +1 -0
- package/dist/iife/index.min.js +1 -1
- package/dist/iife/store/modules/tracking.d.ts +3 -1
- package/dist/iife/types/AnalyticsOptions.d.ts +3 -2
- package/dist/iife/types/search-box/Common.d.ts +1 -0
- package/dist/iife/types/search-results/SearchResultsProductCardOptions.d.ts +1 -0
- package/dist/iife/utils/string.utils.d.ts +1 -0
- package/package.json +1 -1
package/dist/es/index.min.js
CHANGED
|
@@ -10824,6 +10824,13 @@ const getProductKey = (index, product, idKey) => {
|
|
|
10824
10824
|
}
|
|
10825
10825
|
return index;
|
|
10826
10826
|
};
|
|
10827
|
+
const normalizeFloat = (value) => {
|
|
10828
|
+
var _a;
|
|
10829
|
+
if (!value) {
|
|
10830
|
+
return 0;
|
|
10831
|
+
}
|
|
10832
|
+
return +((_a = value === null || value === void 0 ? void 0 : value.replace(/[^0-9,.]/g, "")) === null || _a === void 0 ? void 0 : _a.replace(",", "."));
|
|
10833
|
+
};
|
|
10827
10834
|
const escapeHtml = (value) => {
|
|
10828
10835
|
if (!value) {
|
|
10829
10836
|
return "";
|
|
@@ -12203,7 +12210,7 @@ const getRelativePath = (link) => {
|
|
|
12203
12210
|
}
|
|
12204
12211
|
catch (_a) {
|
|
12205
12212
|
// Invalid url, let's return original string
|
|
12206
|
-
return link;
|
|
12213
|
+
return (link === null || link === void 0 ? void 0 : link.endsWith("/")) ? link.slice(0, link.length - 1) : link;
|
|
12207
12214
|
}
|
|
12208
12215
|
};
|
|
12209
12216
|
// Checks if url links match absolutely, or if their relative parts are equal
|
|
@@ -12261,7 +12268,18 @@ let SearchBoxProduct = class SearchBoxProduct extends Vue$1 {
|
|
|
12261
12268
|
}
|
|
12262
12269
|
return "";
|
|
12263
12270
|
}
|
|
12271
|
+
get title() {
|
|
12272
|
+
if (!this.panelOptions.titleKey) {
|
|
12273
|
+
return "";
|
|
12274
|
+
}
|
|
12275
|
+
const title = this.item[this.panelOptions.titleKey] || "";
|
|
12276
|
+
this.addHistory({
|
|
12277
|
+
item: title,
|
|
12278
|
+
});
|
|
12279
|
+
return title;
|
|
12280
|
+
}
|
|
12264
12281
|
handleClick(event) {
|
|
12282
|
+
var _a;
|
|
12265
12283
|
if (this.panelOptions.titleKey) {
|
|
12266
12284
|
this.addHistory({
|
|
12267
12285
|
item: this.item[this.panelOptions.titleKey] || "",
|
|
@@ -12278,13 +12296,14 @@ let SearchBoxProduct = class SearchBoxProduct extends Vue$1 {
|
|
|
12278
12296
|
type: "itemClick",
|
|
12279
12297
|
analytics: {
|
|
12280
12298
|
type: "autocomplete_product_click",
|
|
12281
|
-
label: this.link,
|
|
12299
|
+
label: (_a = this.title) !== null && _a !== void 0 ? _a : this.link,
|
|
12282
12300
|
},
|
|
12283
12301
|
},
|
|
12284
12302
|
});
|
|
12285
12303
|
if (!this.link) {
|
|
12286
12304
|
return;
|
|
12287
12305
|
}
|
|
12306
|
+
this.$emit("product-click");
|
|
12288
12307
|
handleRoutingEvent(this.link, event, this.boxRoutingBehavior === "event");
|
|
12289
12308
|
}
|
|
12290
12309
|
};
|
|
@@ -12461,6 +12480,11 @@ var __vue_render__$11 = function () {
|
|
|
12461
12480
|
highlighted: index === _vm.highlightedIndex,
|
|
12462
12481
|
inputValue: _vm.inputValue,
|
|
12463
12482
|
},
|
|
12483
|
+
on: {
|
|
12484
|
+
"product-click": function ($event) {
|
|
12485
|
+
return _vm.$emit("product-click")
|
|
12486
|
+
},
|
|
12487
|
+
},
|
|
12464
12488
|
})
|
|
12465
12489
|
}),
|
|
12466
12490
|
1
|
|
@@ -12579,6 +12603,11 @@ var __vue_render__$10 = function () {
|
|
|
12579
12603
|
labels: _vm.labels,
|
|
12580
12604
|
inputValue: _vm.inputValue,
|
|
12581
12605
|
},
|
|
12606
|
+
on: {
|
|
12607
|
+
"product-click": function ($event) {
|
|
12608
|
+
return _vm.$emit("product-click")
|
|
12609
|
+
},
|
|
12610
|
+
},
|
|
12582
12611
|
})
|
|
12583
12612
|
};
|
|
12584
12613
|
var __vue_staticRenderFns__$10 = [];
|
|
@@ -12587,7 +12616,7 @@ __vue_render__$10._withStripped = true;
|
|
|
12587
12616
|
/* style */
|
|
12588
12617
|
const __vue_inject_styles__$10 = function (inject) {
|
|
12589
12618
|
if (!inject) return
|
|
12590
|
-
inject("data-v-
|
|
12619
|
+
inject("data-v-58b6ab21_0", { source: "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n", map: undefined, media: undefined });
|
|
12591
12620
|
|
|
12592
12621
|
};
|
|
12593
12622
|
/* scoped */
|
|
@@ -13310,8 +13339,9 @@ let SearchBoxMainPanel = class SearchBoxMainPanel extends Vue$1 {
|
|
|
13310
13339
|
this.sdkOptions = this.options.options;
|
|
13311
13340
|
}
|
|
13312
13341
|
get displayResults() {
|
|
13313
|
-
var _a;
|
|
13314
|
-
return ((_a = this.inputValue) === null || _a === void 0 ? void 0 : _a.length)
|
|
13342
|
+
var _a, _b;
|
|
13343
|
+
return (((_a = this.inputValue) === null || _a === void 0 ? void 0 : _a.length) > 0 &&
|
|
13344
|
+
((_b = this.inputValue) === null || _b === void 0 ? void 0 : _b.length) >= this.options.minInputLength);
|
|
13315
13345
|
}
|
|
13316
13346
|
get displayHistory() {
|
|
13317
13347
|
var _a;
|
|
@@ -13458,6 +13488,9 @@ var __vue_render__$V = function () {
|
|
|
13458
13488
|
itemSelect: function (item) {
|
|
13459
13489
|
return _vm.$emit("itemSelect", item)
|
|
13460
13490
|
},
|
|
13491
|
+
"product-click": function ($event) {
|
|
13492
|
+
return _vm.$emit("product-click")
|
|
13493
|
+
},
|
|
13461
13494
|
},
|
|
13462
13495
|
})
|
|
13463
13496
|
: _vm._e(),
|
|
@@ -13507,7 +13540,7 @@ __vue_render__$V._withStripped = true;
|
|
|
13507
13540
|
/* style */
|
|
13508
13541
|
const __vue_inject_styles__$V = function (inject) {
|
|
13509
13542
|
if (!inject) return
|
|
13510
|
-
inject("data-v-
|
|
13543
|
+
inject("data-v-947d134e_0", { source: "#lupa-search-box-panel {\n display: flex;\n justify-content: space-between;\n flex-direction: column;\n}\n.lupa-more-results {\n text-align: center;\n}", map: undefined, media: undefined });
|
|
13511
13544
|
|
|
13512
13545
|
};
|
|
13513
13546
|
/* scoped */
|
|
@@ -30844,6 +30877,7 @@ let SearchBox = class SearchBox extends Vue$1 {
|
|
|
30844
30877
|
this.opened = true;
|
|
30845
30878
|
this.inputValue = value;
|
|
30846
30879
|
this.suggestedValue = defaultSuggestedValue;
|
|
30880
|
+
this.trackSearchQuery(value);
|
|
30847
30881
|
if (this.isSearchContainer) {
|
|
30848
30882
|
this.goToResultsDebounced({
|
|
30849
30883
|
searchText: this.searchValue,
|
|
@@ -30936,11 +30970,22 @@ let SearchBox = class SearchBox extends Vue$1 {
|
|
|
30936
30970
|
type: "itemClick",
|
|
30937
30971
|
analytics: {
|
|
30938
30972
|
type: "autocomplete_product_click",
|
|
30939
|
-
label: doc.
|
|
30973
|
+
label: doc.title || doc.id,
|
|
30940
30974
|
},
|
|
30941
30975
|
},
|
|
30942
30976
|
});
|
|
30943
30977
|
}
|
|
30978
|
+
trackSearchQuery(query) {
|
|
30979
|
+
if (!query) {
|
|
30980
|
+
return;
|
|
30981
|
+
}
|
|
30982
|
+
this.trackSearch({
|
|
30983
|
+
queryKey: this.suggestedValue.queryKey,
|
|
30984
|
+
query: {
|
|
30985
|
+
searchText: query,
|
|
30986
|
+
},
|
|
30987
|
+
});
|
|
30988
|
+
}
|
|
30944
30989
|
trackSuggestionClick(suggestion) {
|
|
30945
30990
|
var _a;
|
|
30946
30991
|
if (suggestion ||
|
|
@@ -30955,7 +31000,7 @@ let SearchBox = class SearchBox extends Vue$1 {
|
|
|
30955
31000
|
searchQuery: this.inputValue,
|
|
30956
31001
|
type: "suggestionClick",
|
|
30957
31002
|
analytics: {
|
|
30958
|
-
type: "
|
|
31003
|
+
type: "autocomplete_suggestion_click",
|
|
30959
31004
|
label: suggestion || this.searchValue,
|
|
30960
31005
|
},
|
|
30961
31006
|
},
|
|
@@ -30965,6 +31010,9 @@ let SearchBox = class SearchBox extends Vue$1 {
|
|
|
30965
31010
|
this.inputValue = "";
|
|
30966
31011
|
this.suggestedValue = defaultSuggestedValue;
|
|
30967
31012
|
}
|
|
31013
|
+
handleProductClick() {
|
|
31014
|
+
this.opened = false;
|
|
31015
|
+
}
|
|
30968
31016
|
};
|
|
30969
31017
|
__decorate([
|
|
30970
31018
|
Prop()
|
|
@@ -30984,6 +31032,9 @@ __decorate([
|
|
|
30984
31032
|
__decorate([
|
|
30985
31033
|
tracking$4.Action("track")
|
|
30986
31034
|
], SearchBox.prototype, "trackClick", void 0);
|
|
31035
|
+
__decorate([
|
|
31036
|
+
tracking$4.Action("trackSearch")
|
|
31037
|
+
], SearchBox.prototype, "trackSearch", void 0);
|
|
30987
31038
|
__decorate([
|
|
30988
31039
|
params$e.Action("setSearchResultsLink")
|
|
30989
31040
|
], SearchBox.prototype, "setSearchResultsLink", void 0);
|
|
@@ -31042,6 +31093,7 @@ var __vue_render__$U = function () {
|
|
|
31042
31093
|
fetched: _vm.handleItemsFetch,
|
|
31043
31094
|
itemSelect: _vm.handleItemSelect,
|
|
31044
31095
|
"go-to-results": _vm.handleSearch,
|
|
31096
|
+
"product-click": _vm.handleProductClick,
|
|
31045
31097
|
},
|
|
31046
31098
|
})
|
|
31047
31099
|
: _vm._e(),
|
|
@@ -31056,7 +31108,7 @@ __vue_render__$U._withStripped = true;
|
|
|
31056
31108
|
/* style */
|
|
31057
31109
|
const __vue_inject_styles__$U = function (inject) {
|
|
31058
31110
|
if (!inject) return
|
|
31059
|
-
inject("data-v-
|
|
31111
|
+
inject("data-v-d81b3ccc_0", { source: "\n#lupa-search-box {\n width: 100%;\n}\n.lupa-search-box-wrapper {\n position: relative;\n}\n", map: undefined, media: undefined });
|
|
31060
31112
|
|
|
31061
31113
|
};
|
|
31062
31114
|
/* scoped */
|
|
@@ -32073,8 +32125,7 @@ let TermFacet = class TermFacet extends Vue$1 {
|
|
|
32073
32125
|
: `${this.sliderRange[0]}`;
|
|
32074
32126
|
}
|
|
32075
32127
|
set fromValue(stringValue) {
|
|
32076
|
-
|
|
32077
|
-
let value = +numberString;
|
|
32128
|
+
let value = normalizeFloat(stringValue);
|
|
32078
32129
|
if (value < this.facetMin) {
|
|
32079
32130
|
value = this.facetMin;
|
|
32080
32131
|
}
|
|
@@ -32090,8 +32141,7 @@ let TermFacet = class TermFacet extends Vue$1 {
|
|
|
32090
32141
|
: `${this.sliderRange[1]}`;
|
|
32091
32142
|
}
|
|
32092
32143
|
set toValue(stringValue) {
|
|
32093
|
-
|
|
32094
|
-
let value = +numberString;
|
|
32144
|
+
let value = normalizeFloat(stringValue);
|
|
32095
32145
|
if (value > this.facetMax) {
|
|
32096
32146
|
value = this.facetMax;
|
|
32097
32147
|
}
|
|
@@ -32153,6 +32203,13 @@ let TermFacet = class TermFacet extends Vue$1 {
|
|
|
32153
32203
|
var _a, _b, _c;
|
|
32154
32204
|
return (_c = (_b = (_a = this.searchResultOptions) === null || _a === void 0 ? void 0 : _a.labels) === null || _b === void 0 ? void 0 : _b.priceSeparator) !== null && _c !== void 0 ? _c : ",";
|
|
32155
32205
|
}
|
|
32206
|
+
get isIntegerRange() {
|
|
32207
|
+
return (Number.isInteger(this.currentMinValue) &&
|
|
32208
|
+
Number.isInteger(this.currentMaxValue));
|
|
32209
|
+
}
|
|
32210
|
+
get interval() {
|
|
32211
|
+
return this.isIntegerRange ? 1 : 0.01;
|
|
32212
|
+
}
|
|
32156
32213
|
get sliderInputFormat() {
|
|
32157
32214
|
return this.isPrice ? `[0-9]+([${this.separator}][0-9]{1,2})?` : undefined;
|
|
32158
32215
|
}
|
|
@@ -32322,6 +32379,7 @@ var __vue_render__$P = function () {
|
|
|
32322
32379
|
lazy: true,
|
|
32323
32380
|
silent: true,
|
|
32324
32381
|
duration: 0.1,
|
|
32382
|
+
interval: _vm.interval,
|
|
32325
32383
|
},
|
|
32326
32384
|
on: {
|
|
32327
32385
|
change: _vm.handleChange,
|
|
@@ -35332,10 +35390,14 @@ let SearchResultsProductCard = class SearchResultsProductCard extends Vue$1 {
|
|
|
35332
35390
|
});
|
|
35333
35391
|
}
|
|
35334
35392
|
get id() {
|
|
35335
|
-
|
|
35336
|
-
|
|
35337
|
-
|
|
35338
|
-
|
|
35393
|
+
return this.options.idKey
|
|
35394
|
+
? this.product[this.options.idKey]
|
|
35395
|
+
: "";
|
|
35396
|
+
}
|
|
35397
|
+
get title() {
|
|
35398
|
+
return this.options.titleKey
|
|
35399
|
+
? this.product[this.options.titleKey]
|
|
35400
|
+
: "";
|
|
35339
35401
|
}
|
|
35340
35402
|
handleClick() {
|
|
35341
35403
|
var _a, _b;
|
|
@@ -35345,6 +35407,10 @@ let SearchResultsProductCard = class SearchResultsProductCard extends Vue$1 {
|
|
|
35345
35407
|
itemId: this.id,
|
|
35346
35408
|
searchQuery: this.query,
|
|
35347
35409
|
type: "itemClick",
|
|
35410
|
+
analytics: {
|
|
35411
|
+
type: "search_product_click",
|
|
35412
|
+
label: this.title || this.id || this.link,
|
|
35413
|
+
},
|
|
35348
35414
|
},
|
|
35349
35415
|
});
|
|
35350
35416
|
(_b = (_a = this.searchResultOptions.callbacks) === null || _a === void 0 ? void 0 : _a.onProductClick) === null || _b === void 0 ? void 0 : _b.call(_a, {
|
|
@@ -35361,8 +35427,8 @@ let SearchResultsProductCard = class SearchResultsProductCard extends Vue$1 {
|
|
|
35361
35427
|
type: item.type,
|
|
35362
35428
|
analytics: item.type === "addToCart"
|
|
35363
35429
|
? {
|
|
35364
|
-
type: "
|
|
35365
|
-
label: this.link,
|
|
35430
|
+
type: "search_add_to_cart",
|
|
35431
|
+
label: this.title || this.id || this.link,
|
|
35366
35432
|
}
|
|
35367
35433
|
: undefined,
|
|
35368
35434
|
},
|
|
@@ -35532,7 +35598,7 @@ __vue_render__$o._withStripped = true;
|
|
|
35532
35598
|
|
|
35533
35599
|
const initAnalyticsTracking = (analyticsOptions) => {
|
|
35534
35600
|
try {
|
|
35535
|
-
if (
|
|
35601
|
+
if (analyticsOptions === null || analyticsOptions === void 0 ? void 0 : analyticsOptions.enabled) {
|
|
35536
35602
|
window.sessionStorage.setItem(TRACKING_ANALYTICS_KEY, JSON.stringify(analyticsOptions));
|
|
35537
35603
|
}
|
|
35538
35604
|
else {
|
|
@@ -35677,25 +35743,66 @@ const sendGa = (name, ...args) => {
|
|
|
35677
35743
|
});
|
|
35678
35744
|
};
|
|
35679
35745
|
const trackAnalyticsEvent = (data) => {
|
|
35680
|
-
var _a;
|
|
35746
|
+
var _a, _b, _c;
|
|
35681
35747
|
try {
|
|
35682
35748
|
const options = JSON.parse((_a = window.sessionStorage.getItem(TRACKING_ANALYTICS_KEY)) !== null && _a !== void 0 ? _a : "{}");
|
|
35683
|
-
if (!data.analytics ||
|
|
35749
|
+
if (!data.analytics ||
|
|
35750
|
+
!options.enabled ||
|
|
35751
|
+
((_b = options.ignoreEvents) === null || _b === void 0 ? void 0 : _b.includes((_c = data.analytics) === null || _c === void 0 ? void 0 : _c.type))) {
|
|
35684
35752
|
return;
|
|
35685
35753
|
}
|
|
35686
|
-
|
|
35687
|
-
|
|
35688
|
-
|
|
35689
|
-
|
|
35754
|
+
switch (options.type) {
|
|
35755
|
+
case "ua":
|
|
35756
|
+
sendUaAnalyticsEvent(data, options);
|
|
35757
|
+
break;
|
|
35758
|
+
case "ga4":
|
|
35759
|
+
sendGa4AnalyticsEvent(data, options);
|
|
35760
|
+
break;
|
|
35761
|
+
case "debug":
|
|
35762
|
+
processDebugEvent(data);
|
|
35763
|
+
break;
|
|
35764
|
+
default:
|
|
35765
|
+
sendUaAnalyticsEvent(data, options);
|
|
35690
35766
|
}
|
|
35691
|
-
sendGa("send", "event", options.parentEventName, data.analytics.type, data.analytics.label);
|
|
35692
35767
|
}
|
|
35693
|
-
catch (
|
|
35768
|
+
catch (_d) {
|
|
35694
35769
|
console.error("Unable to send an event to google analytics");
|
|
35695
35770
|
}
|
|
35696
35771
|
};
|
|
35772
|
+
const sendUaAnalyticsEvent = (data, options) => {
|
|
35773
|
+
var _a, _b, _c, _d;
|
|
35774
|
+
const ga = window.ga;
|
|
35775
|
+
if (!ga) {
|
|
35776
|
+
console.error("Google Analytics object not found");
|
|
35777
|
+
return;
|
|
35778
|
+
}
|
|
35779
|
+
sendGa("send", "event", options.parentEventName, (_b = (_a = data.analytics) === null || _a === void 0 ? void 0 : _a.type) !== null && _b !== void 0 ? _b : "", (_d = (_c = data.analytics) === null || _c === void 0 ? void 0 : _c.label) !== null && _d !== void 0 ? _d : "");
|
|
35780
|
+
};
|
|
35781
|
+
const sendGa4AnalyticsEvent = (data, options) => {
|
|
35782
|
+
var _a, _b, _c, _d;
|
|
35783
|
+
if (!window || !window.dataLayer) {
|
|
35784
|
+
console.error("dataLayer object not found.");
|
|
35785
|
+
return;
|
|
35786
|
+
}
|
|
35787
|
+
const sendItemTitle = data.searchQuery !== ((_a = data.analytics) === null || _a === void 0 ? void 0 : _a.label);
|
|
35788
|
+
const params = {
|
|
35789
|
+
search_text: data.searchQuery,
|
|
35790
|
+
item_title: sendItemTitle ? (_b = data.analytics) === null || _b === void 0 ? void 0 : _b.label : undefined,
|
|
35791
|
+
};
|
|
35792
|
+
window.dataLayer.push(Object.assign({ event: (_d = (_c = data.analytics) === null || _c === void 0 ? void 0 : _c.type) !== null && _d !== void 0 ? _d : options.parentEventName }, params));
|
|
35793
|
+
};
|
|
35794
|
+
const processDebugEvent = (data) => {
|
|
35795
|
+
var _a, _b, _c;
|
|
35796
|
+
const sendItemTitle = data.searchQuery !== ((_a = data.analytics) === null || _a === void 0 ? void 0 : _a.label);
|
|
35797
|
+
const params = {
|
|
35798
|
+
event: (_b = data.analytics) === null || _b === void 0 ? void 0 : _b.type,
|
|
35799
|
+
search_text: data.searchQuery,
|
|
35800
|
+
item_title: sendItemTitle ? (_c = data.analytics) === null || _c === void 0 ? void 0 : _c.label : undefined,
|
|
35801
|
+
};
|
|
35802
|
+
console.debug("Analytics debug event:", params);
|
|
35803
|
+
};
|
|
35697
35804
|
const track = (queryKey, data = {}, options) => {
|
|
35698
|
-
if (!isTrackingEnabled()) {
|
|
35805
|
+
if (!isTrackingEnabled() || !data.searchQuery) {
|
|
35699
35806
|
return;
|
|
35700
35807
|
}
|
|
35701
35808
|
trackLupaEvent(queryKey, data, options);
|
|
@@ -37362,6 +37469,7 @@ let SearchResultsProducts = class SearchResultsProducts extends Vue$1 {
|
|
|
37362
37469
|
"labels",
|
|
37363
37470
|
"queryKey",
|
|
37364
37471
|
"idKey",
|
|
37472
|
+
"titleKey",
|
|
37365
37473
|
"routingBehavior",
|
|
37366
37474
|
]);
|
|
37367
37475
|
}
|
|
@@ -38048,7 +38156,11 @@ let SearchResults = class SearchResults extends Vue$1 {
|
|
|
38048
38156
|
this.query(getPublicQuery(publicQuery, this.initialFilters, this.isProductList));
|
|
38049
38157
|
}
|
|
38050
38158
|
query(publicQuery) {
|
|
38051
|
-
this.trackSearch({
|
|
38159
|
+
this.trackSearch({
|
|
38160
|
+
queryKey: this.options.queryKey,
|
|
38161
|
+
query: publicQuery,
|
|
38162
|
+
type: "search_form_submit",
|
|
38163
|
+
});
|
|
38052
38164
|
const context = getLupaTrackingContext();
|
|
38053
38165
|
const limit = publicQuery.limit || this.defaultSearchResultPageSize;
|
|
38054
38166
|
const query = Object.assign(Object.assign(Object.assign({}, publicQuery), context), { limit });
|
|
@@ -38336,9 +38448,9 @@ let SearchResultsEntry = class SearchResultsEntry extends Vue$1 {
|
|
|
38336
38448
|
return merge(DEFAULT_OPTIONS_RESULTS, options);
|
|
38337
38449
|
}
|
|
38338
38450
|
fetch() {
|
|
38339
|
-
var _a;
|
|
38451
|
+
var _a, _b;
|
|
38340
38452
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
38341
|
-
(_a = this.$refs.searchResults) === null || _a === void 0 ? void 0 : _a.
|
|
38453
|
+
(_b = (_a = this.$refs.searchResults) === null || _a === void 0 ? void 0 : _a.handleUrlChange) === null || _b === void 0 ? void 0 : _b.call(_a);
|
|
38342
38454
|
}
|
|
38343
38455
|
};
|
|
38344
38456
|
__decorate([
|
|
@@ -39314,6 +39426,7 @@ let SearchBoxModule = class SearchBoxModule extends VuexModule {
|
|
|
39314
39426
|
link: generateLink((_b = panel.links) === null || _b === void 0 ? void 0 : _b.details, doc),
|
|
39315
39427
|
queryKey: panel.queryKey,
|
|
39316
39428
|
id: panel.idKey ? doc[panel.idKey] : "",
|
|
39429
|
+
title: panel.titleKey ? doc[panel.titleKey] : "",
|
|
39317
39430
|
};
|
|
39318
39431
|
}
|
|
39319
39432
|
saveSuggestions({ queryKey, suggestions, inputValue, }) {
|
|
@@ -39790,11 +39903,6 @@ let ParamsModule = class ParamsModule extends VuexModule {
|
|
|
39790
39903
|
const routing = (_a = this.context.rootGetters["options/boxRoutingBehavior"]) !== null && _a !== void 0 ? _a : "direct-link";
|
|
39791
39904
|
redirectToResultsPage(this.searchResultsLink, searchText, facet, routing);
|
|
39792
39905
|
}
|
|
39793
|
-
this.context.dispatch("tracking/track", {
|
|
39794
|
-
data: {
|
|
39795
|
-
analytics: { type: "search_form_submit", label: searchText },
|
|
39796
|
-
},
|
|
39797
|
-
}, { root: true });
|
|
39798
39906
|
}
|
|
39799
39907
|
appendParams({ params, paramsToRemove, encode = true, save = true, searchResultsLink, }) {
|
|
39800
39908
|
if (!(params === null || params === void 0 ? void 0 : params.length)) {
|
|
@@ -39945,22 +40053,23 @@ const getSearchTrackingData = (searchText, type) => {
|
|
|
39945
40053
|
};
|
|
39946
40054
|
};
|
|
39947
40055
|
let TrackingModule = class TrackingModule extends VuexModule {
|
|
39948
|
-
trackSearch({ queryKey, query, }) {
|
|
40056
|
+
trackSearch({ queryKey, query, type = "search_query", }) {
|
|
39949
40057
|
var _a, _b;
|
|
39950
40058
|
const options = (_a = this.context.rootGetters["options/envOptions"]) !== null && _a !== void 0 ? _a : {};
|
|
39951
40059
|
const hasFilters = Object.keys((_b = query.filters) !== null && _b !== void 0 ? _b : {}).length > 0;
|
|
39952
40060
|
if (hasFilters) {
|
|
39953
|
-
const data = getSearchTrackingData(query.searchText, "
|
|
40061
|
+
const data = getSearchTrackingData(query.searchText, "search_filters");
|
|
39954
40062
|
track(queryKey, data, options);
|
|
40063
|
+
return;
|
|
39955
40064
|
}
|
|
39956
|
-
const data = getSearchTrackingData(query.searchText,
|
|
40065
|
+
const data = getSearchTrackingData(query.searchText, type);
|
|
39957
40066
|
track(queryKey, data, options);
|
|
39958
40067
|
}
|
|
39959
40068
|
trackResults({ queryKey, results, }) {
|
|
39960
40069
|
var _a;
|
|
39961
40070
|
const options = (_a = this.context.rootGetters["options/envOptions"]) !== null && _a !== void 0 ? _a : {};
|
|
39962
40071
|
if (results.total < 1) {
|
|
39963
|
-
const data = getSearchTrackingData(results.searchText, "
|
|
40072
|
+
const data = getSearchTrackingData(results.searchText, "search_zero_results");
|
|
39964
40073
|
track(queryKey, data, options);
|
|
39965
40074
|
}
|
|
39966
40075
|
}
|
|
@@ -1,10 +1,12 @@
|
|
|
1
|
+
import { AnalyticsEventType } from "@/types/AnalyticsOptions";
|
|
1
2
|
import { TrackableEventData } from "@/types/search-box/Common";
|
|
2
3
|
import { PublicQuery, SearchQueryResult } from "@getlupa/client-sdk/Types";
|
|
3
4
|
import { VuexModule } from "vuex-module-decorators";
|
|
4
5
|
export default class TrackingModule extends VuexModule {
|
|
5
|
-
trackSearch({ queryKey, query, }: {
|
|
6
|
+
trackSearch({ queryKey, query, type, }: {
|
|
6
7
|
queryKey: string;
|
|
7
8
|
query: PublicQuery;
|
|
9
|
+
type?: AnalyticsEventType;
|
|
8
10
|
}): void;
|
|
9
11
|
trackResults({ queryKey, results, }: {
|
|
10
12
|
queryKey: string;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
export declare const PARENT_EVENT_NAME = "GetLupa";
|
|
2
|
-
export declare type AnalyticsEventType = "
|
|
2
|
+
export declare type AnalyticsEventType = "search_query" | "search_form_submit" | "autocomplete_suggestion_click" | "autocomplete_product_click" | "search_product_click" | "search_zero_results" | "search_filters" | "search_add_to_cart";
|
|
3
3
|
export declare type AnalyticsOptions = {
|
|
4
|
-
type: "ua";
|
|
4
|
+
type: "ua" | "ga4" | "debug";
|
|
5
5
|
enabled: boolean;
|
|
6
6
|
parentEventName: string;
|
|
7
|
+
ignoreEvents?: AnalyticsEventType[];
|
|
7
8
|
};
|
|
@@ -5,4 +5,5 @@ export declare const addParamsToLabel: (label: string, ...params: unknown[]) =>
|
|
|
5
5
|
export declare const getRandomString: (length: number) => string;
|
|
6
6
|
export declare const getDisplayValue: (value?: string | number | undefined) => string;
|
|
7
7
|
export declare const getProductKey: (index: string, product: Document, idKey: string | undefined) => string;
|
|
8
|
+
export declare const normalizeFloat: (value?: string | undefined) => number;
|
|
8
9
|
export declare const escapeHtml: (value?: string | undefined) => string;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { FetchedData, HighlightedDocInfo, InputSuggestion, InputSuggestionFacet, SelectedData, TrackableEventData } from "@/types/search-box/Common";
|
|
2
2
|
import { SearchBoxInputOptions, SearchBoxOptions, SearchBoxPanelOptions } from "@/types/search-box/SearchBoxOptions";
|
|
3
3
|
import { QueryParams } from "@/types/search-results/QueryParams";
|
|
4
|
-
import { Document } from "@getlupa/client-sdk/Types";
|
|
4
|
+
import { Document, PublicQuery } from "@getlupa/client-sdk/Types";
|
|
5
5
|
import Vue from "vue";
|
|
6
6
|
declare const params: import("vuex-class/lib/bindings").BindingHelpers;
|
|
7
7
|
export default class SearchBox extends Vue {
|
|
@@ -28,6 +28,10 @@ export default class SearchBox extends Vue {
|
|
|
28
28
|
queryKey: string;
|
|
29
29
|
data: TrackableEventData;
|
|
30
30
|
}) => void;
|
|
31
|
+
trackSearch: ({ queryKey, query, }: {
|
|
32
|
+
queryKey: string;
|
|
33
|
+
query: PublicQuery;
|
|
34
|
+
}) => void;
|
|
31
35
|
setSearchResultsLink: (searchResultsLink: string) => {
|
|
32
36
|
searchResultsLink: string;
|
|
33
37
|
};
|
|
@@ -63,7 +67,9 @@ export default class SearchBox extends Vue {
|
|
|
63
67
|
query: string;
|
|
64
68
|
}): void;
|
|
65
69
|
trackDocumentClick(doc: HighlightedDocInfo): void;
|
|
70
|
+
trackSearchQuery(query?: string): void;
|
|
66
71
|
trackSuggestionClick(suggestion?: string): void;
|
|
67
72
|
resetValues(): void;
|
|
73
|
+
handleProductClick(): void;
|
|
68
74
|
}
|
|
69
75
|
export {};
|
|
@@ -2,6 +2,7 @@ import { QueryParams } from "@/types/search-results/QueryParams";
|
|
|
2
2
|
import { ProductGrid, SearchResultsDidYouMeanLabels, SearchResultsOptions, SearchResultsProductOptions } from "@/types/search-results/SearchResultsOptions";
|
|
3
3
|
import { FilterGroup, PublicQuery, SearchQueryResult } from "@getlupa/client-sdk/Types";
|
|
4
4
|
import Vue from "vue";
|
|
5
|
+
import { AnalyticsEventType } from "@/types/AnalyticsOptions";
|
|
5
6
|
export default class SearchResults extends Vue {
|
|
6
7
|
options: SearchResultsOptions;
|
|
7
8
|
initialFilters: FilterGroup;
|
|
@@ -16,6 +17,7 @@ export default class SearchResults extends Vue {
|
|
|
16
17
|
trackSearch: ({ queryKey, query, }: {
|
|
17
18
|
queryKey: string;
|
|
18
19
|
query: PublicQuery;
|
|
20
|
+
type?: AnalyticsEventType;
|
|
19
21
|
}) => void;
|
|
20
22
|
trackResults: ({ queryKey, results, }: {
|
|
21
23
|
queryKey: string;
|
|
@@ -27,6 +27,8 @@ export default class TermFacet extends Vue {
|
|
|
27
27
|
get facetMax(): number;
|
|
28
28
|
get statsSummary(): string;
|
|
29
29
|
get separator(): string;
|
|
30
|
+
get isIntegerRange(): boolean;
|
|
31
|
+
get interval(): 1 | 0.01;
|
|
30
32
|
get sliderInputFormat(): string | undefined;
|
|
31
33
|
onMinValueChange(): void;
|
|
32
34
|
onMaxValueChange(): void;
|