@getlupa/client 0.14.4 → 0.15.1
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-results/SearchResults.vue.d.ts +1 -1
- package/dist/cjs/components/search-results/products/product-card/SearchResultsProductCard.vue.d.ts +2 -0
- package/dist/cjs/index.min.js +49 -13
- package/dist/cjs/store/modules/options.d.ts +5 -0
- package/dist/cjs/types/AnalyticsOptions.d.ts +1 -0
- package/dist/cjs/types/search-box/Common.d.ts +2 -0
- package/dist/es/components/search-results/SearchResults.vue.d.ts +1 -1
- package/dist/es/components/search-results/products/product-card/SearchResultsProductCard.vue.d.ts +2 -0
- package/dist/es/index.min.js +49 -13
- package/dist/es/store/modules/options.d.ts +5 -0
- package/dist/es/types/AnalyticsOptions.d.ts +1 -0
- package/dist/es/types/search-box/Common.d.ts +2 -0
- package/dist/iife/components/search-results/SearchResults.vue.d.ts +1 -1
- package/dist/iife/components/search-results/products/product-card/SearchResultsProductCard.vue.d.ts +2 -0
- package/dist/iife/index.min.js +1 -1
- package/dist/iife/store/modules/options.d.ts +5 -0
- package/dist/iife/types/AnalyticsOptions.d.ts +1 -0
- package/dist/iife/types/search-box/Common.d.ts +2 -0
- package/package.json +1 -1
|
@@ -58,7 +58,7 @@ export default class SearchResults extends Vue {
|
|
|
58
58
|
}) => void;
|
|
59
59
|
mounted(): void;
|
|
60
60
|
beforeDestroy(): void;
|
|
61
|
-
trackItemListView(title: string): void;
|
|
61
|
+
trackItemListView(title: string, items?: Record<string, unknown>[]): void;
|
|
62
62
|
handleMounted(): void;
|
|
63
63
|
handleParamsChange(): void;
|
|
64
64
|
addSearchResult: (searchResult: SearchQueryResult) => SearchQueryResult;
|
package/dist/cjs/components/search-results/products/product-card/SearchResultsProductCard.vue.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { DocumentElement } from "@/types/DocumentElement";
|
|
2
|
+
import { TrackingOptions } from "@/types/General";
|
|
2
3
|
import { TrackableEventData } from "@/types/search-box/Common";
|
|
3
4
|
import { BadgeOptions } from "@/types/search-results/BadgeOptions";
|
|
4
5
|
import { ResultsLayout } from "@/types/search-results/ResultsLayout";
|
|
@@ -15,6 +16,7 @@ export default class SearchResultsProductCard extends Vue {
|
|
|
15
16
|
layout: ResultsLayout;
|
|
16
17
|
searchResultsRoutingBehavior: RoutingBehavior;
|
|
17
18
|
searchResultOptions: SearchResultsOptions;
|
|
19
|
+
trackingOptions: TrackingOptions;
|
|
18
20
|
query: string;
|
|
19
21
|
trackClick: ({ queryKey, data, }: {
|
|
20
22
|
queryKey: string;
|
package/dist/cjs/index.min.js
CHANGED
|
@@ -12429,6 +12429,7 @@ let SearchBoxProduct = class SearchBoxProduct extends Vue$1 {
|
|
|
12429
12429
|
analytics: {
|
|
12430
12430
|
type: "autocomplete_product_click",
|
|
12431
12431
|
label: (_a = this.title) !== null && _a !== void 0 ? _a : this.link,
|
|
12432
|
+
items: [this.item],
|
|
12432
12433
|
},
|
|
12433
12434
|
},
|
|
12434
12435
|
});
|
|
@@ -31119,6 +31120,7 @@ let SearchBox = class SearchBox extends Vue$1 {
|
|
|
31119
31120
|
analytics: {
|
|
31120
31121
|
type: "autocomplete_product_click",
|
|
31121
31122
|
label: doc.title || doc.id,
|
|
31123
|
+
items: [doc],
|
|
31122
31124
|
},
|
|
31123
31125
|
},
|
|
31124
31126
|
});
|
|
@@ -31257,7 +31259,7 @@ __vue_render__$V._withStripped = true;
|
|
|
31257
31259
|
/* style */
|
|
31258
31260
|
const __vue_inject_styles__$V = function (inject) {
|
|
31259
31261
|
if (!inject) return
|
|
31260
|
-
inject("data-v-
|
|
31262
|
+
inject("data-v-1d0dc04c_0", { source: "\n#lupa-search-box {\n width: 100%;\n}\n.lupa-search-box-wrapper {\n position: relative;\n}\n", map: undefined, media: undefined });
|
|
31261
31263
|
|
|
31262
31264
|
};
|
|
31263
31265
|
/* scoped */
|
|
@@ -35674,7 +35676,7 @@ let SearchResultsProductCard = class SearchResultsProductCard extends Vue$1 {
|
|
|
35674
35676
|
: "";
|
|
35675
35677
|
}
|
|
35676
35678
|
handleClick() {
|
|
35677
|
-
var _a, _b;
|
|
35679
|
+
var _a, _b, _c, _d;
|
|
35678
35680
|
this.trackClick({
|
|
35679
35681
|
queryKey: this.options.queryKey,
|
|
35680
35682
|
data: {
|
|
@@ -35684,11 +35686,13 @@ let SearchResultsProductCard = class SearchResultsProductCard extends Vue$1 {
|
|
|
35684
35686
|
analytics: {
|
|
35685
35687
|
type: this.query ? "search_product_click" : "select_item",
|
|
35686
35688
|
label: this.title || this.id || this.link,
|
|
35689
|
+
listLabel: (_b = (_a = this.options) === null || _a === void 0 ? void 0 : _a.labels) === null || _b === void 0 ? void 0 : _b.htmlTitleTemplate,
|
|
35690
|
+
items: [this.product],
|
|
35687
35691
|
},
|
|
35688
35692
|
options: { allowEmptySearchQuery: true },
|
|
35689
35693
|
},
|
|
35690
35694
|
});
|
|
35691
|
-
(
|
|
35695
|
+
(_d = (_c = this.searchResultOptions.callbacks) === null || _c === void 0 ? void 0 : _c.onProductClick) === null || _d === void 0 ? void 0 : _d.call(_c, {
|
|
35692
35696
|
queryKey: this.query,
|
|
35693
35697
|
hasResults: true,
|
|
35694
35698
|
});
|
|
@@ -35731,6 +35735,9 @@ __decorate([
|
|
|
35731
35735
|
__decorate([
|
|
35732
35736
|
options$7.State((o) => o.searchResultOptions)
|
|
35733
35737
|
], SearchResultsProductCard.prototype, "searchResultOptions", void 0);
|
|
35738
|
+
__decorate([
|
|
35739
|
+
options$7.State((o) => o.trackingOptions)
|
|
35740
|
+
], SearchResultsProductCard.prototype, "trackingOptions", void 0);
|
|
35734
35741
|
__decorate([
|
|
35735
35742
|
params$a.Getter("query")
|
|
35736
35743
|
], SearchResultsProductCard.prototype, "query", void 0);
|
|
@@ -36067,6 +36074,15 @@ const trackAnalyticsEvent = (data) => {
|
|
|
36067
36074
|
console.error("Unable to send an event to google analytics");
|
|
36068
36075
|
}
|
|
36069
36076
|
};
|
|
36077
|
+
const parseEcommerceData = (data, title) => {
|
|
36078
|
+
var _a, _b;
|
|
36079
|
+
return ((_a = data.analytics) === null || _a === void 0 ? void 0 : _a.items)
|
|
36080
|
+
? {
|
|
36081
|
+
item_list_name: title,
|
|
36082
|
+
items: (_b = data.analytics) === null || _b === void 0 ? void 0 : _b.items,
|
|
36083
|
+
}
|
|
36084
|
+
: undefined;
|
|
36085
|
+
};
|
|
36070
36086
|
const sendUaAnalyticsEvent = (data, options) => {
|
|
36071
36087
|
var _a, _b, _c, _d;
|
|
36072
36088
|
const ga = window.ga;
|
|
@@ -36077,25 +36093,29 @@ const sendUaAnalyticsEvent = (data, options) => {
|
|
|
36077
36093
|
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 : "");
|
|
36078
36094
|
};
|
|
36079
36095
|
const sendGa4AnalyticsEvent = (data, options) => {
|
|
36080
|
-
var _a, _b, _c, _d;
|
|
36096
|
+
var _a, _b, _c, _d, _e;
|
|
36081
36097
|
if (!window || !window.dataLayer) {
|
|
36082
36098
|
console.error("dataLayer object not found.");
|
|
36083
36099
|
return;
|
|
36084
36100
|
}
|
|
36085
36101
|
const sendItemTitle = data.searchQuery !== ((_a = data.analytics) === null || _a === void 0 ? void 0 : _a.label);
|
|
36102
|
+
const title = sendItemTitle ? (_b = data.analytics) === null || _b === void 0 ? void 0 : _b.label : undefined;
|
|
36086
36103
|
const params = {
|
|
36087
36104
|
search_text: data.searchQuery,
|
|
36088
|
-
item_title:
|
|
36105
|
+
item_title: title,
|
|
36106
|
+
ecommerce: parseEcommerceData(data, (_c = data.analytics) === null || _c === void 0 ? void 0 : _c.listLabel),
|
|
36089
36107
|
};
|
|
36090
|
-
window.dataLayer.push(Object.assign({ event: (
|
|
36108
|
+
window.dataLayer.push(Object.assign({ event: (_e = (_d = data.analytics) === null || _d === void 0 ? void 0 : _d.type) !== null && _e !== void 0 ? _e : options.parentEventName }, params));
|
|
36091
36109
|
};
|
|
36092
36110
|
const processDebugEvent = (data) => {
|
|
36093
|
-
var _a, _b, _c;
|
|
36111
|
+
var _a, _b, _c, _d;
|
|
36094
36112
|
const sendItemTitle = data.searchQuery !== ((_a = data.analytics) === null || _a === void 0 ? void 0 : _a.label);
|
|
36113
|
+
const title = sendItemTitle ? (_b = data.analytics) === null || _b === void 0 ? void 0 : _b.label : undefined;
|
|
36095
36114
|
const params = {
|
|
36096
|
-
event: (
|
|
36115
|
+
event: (_c = data.analytics) === null || _c === void 0 ? void 0 : _c.type,
|
|
36097
36116
|
search_text: data.searchQuery,
|
|
36098
|
-
item_title:
|
|
36117
|
+
item_title: title,
|
|
36118
|
+
ecommerce: parseEcommerceData(data, (_d = data.analytics) === null || _d === void 0 ? void 0 : _d.listLabel),
|
|
36099
36119
|
};
|
|
36100
36120
|
console.debug("Analytics debug event:", params);
|
|
36101
36121
|
};
|
|
@@ -38466,13 +38486,15 @@ let SearchResults = class SearchResults extends Vue$1 {
|
|
|
38466
38486
|
beforeDestroy() {
|
|
38467
38487
|
window.removeEventListener("resize", this.handleResize);
|
|
38468
38488
|
}
|
|
38469
|
-
trackItemListView(title) {
|
|
38489
|
+
trackItemListView(title, items = []) {
|
|
38470
38490
|
this.trackEvent({
|
|
38471
38491
|
queryKey: this.options.queryKey,
|
|
38472
38492
|
data: {
|
|
38473
38493
|
analytics: {
|
|
38474
38494
|
type: "view_item_list",
|
|
38475
38495
|
label: title,
|
|
38496
|
+
listLabel: title,
|
|
38497
|
+
items,
|
|
38476
38498
|
},
|
|
38477
38499
|
options: { allowEmptySearchQuery: true },
|
|
38478
38500
|
},
|
|
@@ -38486,7 +38508,6 @@ let SearchResults = class SearchResults extends Vue$1 {
|
|
|
38486
38508
|
setDocumentTitle(pageTitle, "");
|
|
38487
38509
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
38488
38510
|
(_a = this.$refs.searchResultsFilters) === null || _a === void 0 ? void 0 : _a.fetch();
|
|
38489
|
-
this.trackItemListView(pageTitle);
|
|
38490
38511
|
}
|
|
38491
38512
|
const params = new URLSearchParams(window.location.search);
|
|
38492
38513
|
if (!params.has(QUERY_PARAMS.QUERY)) {
|
|
@@ -38555,6 +38576,7 @@ let SearchResults = class SearchResults extends Vue$1 {
|
|
|
38555
38576
|
if (!hasResults) {
|
|
38556
38577
|
return;
|
|
38557
38578
|
}
|
|
38579
|
+
this.trackItemListView(this.options.labels.htmlTitleTemplate, results.items);
|
|
38558
38580
|
yield this.enhanceData({ result: results });
|
|
38559
38581
|
});
|
|
38560
38582
|
}
|
|
@@ -40395,6 +40417,7 @@ let OptionsModule = class OptionsModule extends VuexModule {
|
|
|
40395
40417
|
super(...arguments);
|
|
40396
40418
|
this.searchBoxOptions = DEFAULT_SEARCH_BOX_OPTIONS;
|
|
40397
40419
|
this.searchResultOptions = DEFAULT_OPTIONS_RESULTS;
|
|
40420
|
+
this.trackingOptions = {};
|
|
40398
40421
|
this.searchResultInitialFilters = {};
|
|
40399
40422
|
}
|
|
40400
40423
|
get envOptions() {
|
|
@@ -40443,6 +40466,9 @@ let OptionsModule = class OptionsModule extends VuexModule {
|
|
|
40443
40466
|
setSearchBoxOptions({ options }) {
|
|
40444
40467
|
this.searchBoxOptions = options;
|
|
40445
40468
|
}
|
|
40469
|
+
setTrackingOptions({ options }) {
|
|
40470
|
+
this.trackingOptions = options !== null && options !== void 0 ? options : {};
|
|
40471
|
+
}
|
|
40446
40472
|
setSearchResultOptions({ options }) {
|
|
40447
40473
|
this.searchResultOptions = options;
|
|
40448
40474
|
}
|
|
@@ -40453,6 +40479,9 @@ let OptionsModule = class OptionsModule extends VuexModule {
|
|
|
40453
40479
|
__decorate([
|
|
40454
40480
|
Mutation
|
|
40455
40481
|
], OptionsModule.prototype, "setSearchBoxOptions", null);
|
|
40482
|
+
__decorate([
|
|
40483
|
+
Mutation
|
|
40484
|
+
], OptionsModule.prototype, "setTrackingOptions", null);
|
|
40456
40485
|
__decorate([
|
|
40457
40486
|
Mutation
|
|
40458
40487
|
], OptionsModule.prototype, "setSearchResultOptions", null);
|
|
@@ -40497,9 +40526,15 @@ let TrackingModule = class TrackingModule extends VuexModule {
|
|
|
40497
40526
|
}
|
|
40498
40527
|
}
|
|
40499
40528
|
track({ queryKey, data, }) {
|
|
40500
|
-
var _a;
|
|
40529
|
+
var _a, _b, _c, _d, _e;
|
|
40501
40530
|
const options = (_a = this.context.rootGetters["options/envOptions"]) !== null && _a !== void 0 ? _a : {};
|
|
40502
|
-
|
|
40531
|
+
const trackingOptions = (_b = this.context.rootState["options"].trackingOptions) !== null && _b !== void 0 ? _b : {};
|
|
40532
|
+
const items = (_d = (_c = data.analytics) === null || _c === void 0 ? void 0 : _c.items) !== null && _d !== void 0 ? _d : [];
|
|
40533
|
+
const mappedItems = ((_e = trackingOptions.analytics) === null || _e === void 0 ? void 0 : _e.itemMap)
|
|
40534
|
+
? items.map(trackingOptions.analytics.itemMap)
|
|
40535
|
+
: items;
|
|
40536
|
+
track(queryKey, Object.assign(Object.assign({}, data), { analytics: data.analytics
|
|
40537
|
+
? Object.assign(Object.assign({}, data.analytics), { items: mappedItems }) : undefined }), options);
|
|
40503
40538
|
}
|
|
40504
40539
|
};
|
|
40505
40540
|
__decorate([
|
|
@@ -40674,6 +40709,7 @@ const app = {
|
|
|
40674
40709
|
};
|
|
40675
40710
|
const tracking = (options) => {
|
|
40676
40711
|
initTracking(options);
|
|
40712
|
+
store.commit("options/setTrackingOptions", { options });
|
|
40677
40713
|
};
|
|
40678
40714
|
const applySearchBox = (options, mountOptions) => {
|
|
40679
40715
|
const existingInstance = app.box[options.inputSelector];
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { TrackingOptions } from "@/types/General";
|
|
1
2
|
import { SearchBoxOptions } from "@/types/search-box/SearchBoxOptions";
|
|
2
3
|
import { RoutingBehavior } from "@/types/search-results/RoutingBehavior";
|
|
3
4
|
import { SearchResultsOptions } from "@/types/search-results/SearchResultsOptions";
|
|
@@ -6,6 +7,7 @@ import { VuexModule } from "vuex-module-decorators";
|
|
|
6
7
|
export default class OptionsModule extends VuexModule {
|
|
7
8
|
searchBoxOptions: SearchBoxOptions;
|
|
8
9
|
searchResultOptions: SearchResultsOptions;
|
|
10
|
+
trackingOptions: TrackingOptions;
|
|
9
11
|
searchResultInitialFilters: FilterGroup;
|
|
10
12
|
get envOptions(): Options;
|
|
11
13
|
get classMap(): Record<string, string>;
|
|
@@ -17,6 +19,9 @@ export default class OptionsModule extends VuexModule {
|
|
|
17
19
|
setSearchBoxOptions({ options }: {
|
|
18
20
|
options: SearchBoxOptions;
|
|
19
21
|
}): void;
|
|
22
|
+
setTrackingOptions({ options }: {
|
|
23
|
+
options: TrackingOptions;
|
|
24
|
+
}): void;
|
|
20
25
|
setSearchResultOptions({ options }: {
|
|
21
26
|
options: SearchResultsOptions;
|
|
22
27
|
}): void;
|
|
@@ -58,7 +58,7 @@ export default class SearchResults extends Vue {
|
|
|
58
58
|
}) => void;
|
|
59
59
|
mounted(): void;
|
|
60
60
|
beforeDestroy(): void;
|
|
61
|
-
trackItemListView(title: string): void;
|
|
61
|
+
trackItemListView(title: string, items?: Record<string, unknown>[]): void;
|
|
62
62
|
handleMounted(): void;
|
|
63
63
|
handleParamsChange(): void;
|
|
64
64
|
addSearchResult: (searchResult: SearchQueryResult) => SearchQueryResult;
|
package/dist/es/components/search-results/products/product-card/SearchResultsProductCard.vue.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { DocumentElement } from "@/types/DocumentElement";
|
|
2
|
+
import { TrackingOptions } from "@/types/General";
|
|
2
3
|
import { TrackableEventData } from "@/types/search-box/Common";
|
|
3
4
|
import { BadgeOptions } from "@/types/search-results/BadgeOptions";
|
|
4
5
|
import { ResultsLayout } from "@/types/search-results/ResultsLayout";
|
|
@@ -15,6 +16,7 @@ export default class SearchResultsProductCard extends Vue {
|
|
|
15
16
|
layout: ResultsLayout;
|
|
16
17
|
searchResultsRoutingBehavior: RoutingBehavior;
|
|
17
18
|
searchResultOptions: SearchResultsOptions;
|
|
19
|
+
trackingOptions: TrackingOptions;
|
|
18
20
|
query: string;
|
|
19
21
|
trackClick: ({ queryKey, data, }: {
|
|
20
22
|
queryKey: string;
|
package/dist/es/index.min.js
CHANGED
|
@@ -12425,6 +12425,7 @@ let SearchBoxProduct = class SearchBoxProduct extends Vue$1 {
|
|
|
12425
12425
|
analytics: {
|
|
12426
12426
|
type: "autocomplete_product_click",
|
|
12427
12427
|
label: (_a = this.title) !== null && _a !== void 0 ? _a : this.link,
|
|
12428
|
+
items: [this.item],
|
|
12428
12429
|
},
|
|
12429
12430
|
},
|
|
12430
12431
|
});
|
|
@@ -31115,6 +31116,7 @@ let SearchBox = class SearchBox extends Vue$1 {
|
|
|
31115
31116
|
analytics: {
|
|
31116
31117
|
type: "autocomplete_product_click",
|
|
31117
31118
|
label: doc.title || doc.id,
|
|
31119
|
+
items: [doc],
|
|
31118
31120
|
},
|
|
31119
31121
|
},
|
|
31120
31122
|
});
|
|
@@ -31253,7 +31255,7 @@ __vue_render__$V._withStripped = true;
|
|
|
31253
31255
|
/* style */
|
|
31254
31256
|
const __vue_inject_styles__$V = function (inject) {
|
|
31255
31257
|
if (!inject) return
|
|
31256
|
-
inject("data-v-
|
|
31258
|
+
inject("data-v-1d0dc04c_0", { source: "\n#lupa-search-box {\n width: 100%;\n}\n.lupa-search-box-wrapper {\n position: relative;\n}\n", map: undefined, media: undefined });
|
|
31257
31259
|
|
|
31258
31260
|
};
|
|
31259
31261
|
/* scoped */
|
|
@@ -35670,7 +35672,7 @@ let SearchResultsProductCard = class SearchResultsProductCard extends Vue$1 {
|
|
|
35670
35672
|
: "";
|
|
35671
35673
|
}
|
|
35672
35674
|
handleClick() {
|
|
35673
|
-
var _a, _b;
|
|
35675
|
+
var _a, _b, _c, _d;
|
|
35674
35676
|
this.trackClick({
|
|
35675
35677
|
queryKey: this.options.queryKey,
|
|
35676
35678
|
data: {
|
|
@@ -35680,11 +35682,13 @@ let SearchResultsProductCard = class SearchResultsProductCard extends Vue$1 {
|
|
|
35680
35682
|
analytics: {
|
|
35681
35683
|
type: this.query ? "search_product_click" : "select_item",
|
|
35682
35684
|
label: this.title || this.id || this.link,
|
|
35685
|
+
listLabel: (_b = (_a = this.options) === null || _a === void 0 ? void 0 : _a.labels) === null || _b === void 0 ? void 0 : _b.htmlTitleTemplate,
|
|
35686
|
+
items: [this.product],
|
|
35683
35687
|
},
|
|
35684
35688
|
options: { allowEmptySearchQuery: true },
|
|
35685
35689
|
},
|
|
35686
35690
|
});
|
|
35687
|
-
(
|
|
35691
|
+
(_d = (_c = this.searchResultOptions.callbacks) === null || _c === void 0 ? void 0 : _c.onProductClick) === null || _d === void 0 ? void 0 : _d.call(_c, {
|
|
35688
35692
|
queryKey: this.query,
|
|
35689
35693
|
hasResults: true,
|
|
35690
35694
|
});
|
|
@@ -35727,6 +35731,9 @@ __decorate([
|
|
|
35727
35731
|
__decorate([
|
|
35728
35732
|
options$7.State((o) => o.searchResultOptions)
|
|
35729
35733
|
], SearchResultsProductCard.prototype, "searchResultOptions", void 0);
|
|
35734
|
+
__decorate([
|
|
35735
|
+
options$7.State((o) => o.trackingOptions)
|
|
35736
|
+
], SearchResultsProductCard.prototype, "trackingOptions", void 0);
|
|
35730
35737
|
__decorate([
|
|
35731
35738
|
params$a.Getter("query")
|
|
35732
35739
|
], SearchResultsProductCard.prototype, "query", void 0);
|
|
@@ -36063,6 +36070,15 @@ const trackAnalyticsEvent = (data) => {
|
|
|
36063
36070
|
console.error("Unable to send an event to google analytics");
|
|
36064
36071
|
}
|
|
36065
36072
|
};
|
|
36073
|
+
const parseEcommerceData = (data, title) => {
|
|
36074
|
+
var _a, _b;
|
|
36075
|
+
return ((_a = data.analytics) === null || _a === void 0 ? void 0 : _a.items)
|
|
36076
|
+
? {
|
|
36077
|
+
item_list_name: title,
|
|
36078
|
+
items: (_b = data.analytics) === null || _b === void 0 ? void 0 : _b.items,
|
|
36079
|
+
}
|
|
36080
|
+
: undefined;
|
|
36081
|
+
};
|
|
36066
36082
|
const sendUaAnalyticsEvent = (data, options) => {
|
|
36067
36083
|
var _a, _b, _c, _d;
|
|
36068
36084
|
const ga = window.ga;
|
|
@@ -36073,25 +36089,29 @@ const sendUaAnalyticsEvent = (data, options) => {
|
|
|
36073
36089
|
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 : "");
|
|
36074
36090
|
};
|
|
36075
36091
|
const sendGa4AnalyticsEvent = (data, options) => {
|
|
36076
|
-
var _a, _b, _c, _d;
|
|
36092
|
+
var _a, _b, _c, _d, _e;
|
|
36077
36093
|
if (!window || !window.dataLayer) {
|
|
36078
36094
|
console.error("dataLayer object not found.");
|
|
36079
36095
|
return;
|
|
36080
36096
|
}
|
|
36081
36097
|
const sendItemTitle = data.searchQuery !== ((_a = data.analytics) === null || _a === void 0 ? void 0 : _a.label);
|
|
36098
|
+
const title = sendItemTitle ? (_b = data.analytics) === null || _b === void 0 ? void 0 : _b.label : undefined;
|
|
36082
36099
|
const params = {
|
|
36083
36100
|
search_text: data.searchQuery,
|
|
36084
|
-
item_title:
|
|
36101
|
+
item_title: title,
|
|
36102
|
+
ecommerce: parseEcommerceData(data, (_c = data.analytics) === null || _c === void 0 ? void 0 : _c.listLabel),
|
|
36085
36103
|
};
|
|
36086
|
-
window.dataLayer.push(Object.assign({ event: (
|
|
36104
|
+
window.dataLayer.push(Object.assign({ event: (_e = (_d = data.analytics) === null || _d === void 0 ? void 0 : _d.type) !== null && _e !== void 0 ? _e : options.parentEventName }, params));
|
|
36087
36105
|
};
|
|
36088
36106
|
const processDebugEvent = (data) => {
|
|
36089
|
-
var _a, _b, _c;
|
|
36107
|
+
var _a, _b, _c, _d;
|
|
36090
36108
|
const sendItemTitle = data.searchQuery !== ((_a = data.analytics) === null || _a === void 0 ? void 0 : _a.label);
|
|
36109
|
+
const title = sendItemTitle ? (_b = data.analytics) === null || _b === void 0 ? void 0 : _b.label : undefined;
|
|
36091
36110
|
const params = {
|
|
36092
|
-
event: (
|
|
36111
|
+
event: (_c = data.analytics) === null || _c === void 0 ? void 0 : _c.type,
|
|
36093
36112
|
search_text: data.searchQuery,
|
|
36094
|
-
item_title:
|
|
36113
|
+
item_title: title,
|
|
36114
|
+
ecommerce: parseEcommerceData(data, (_d = data.analytics) === null || _d === void 0 ? void 0 : _d.listLabel),
|
|
36095
36115
|
};
|
|
36096
36116
|
console.debug("Analytics debug event:", params);
|
|
36097
36117
|
};
|
|
@@ -38462,13 +38482,15 @@ let SearchResults = class SearchResults extends Vue$1 {
|
|
|
38462
38482
|
beforeDestroy() {
|
|
38463
38483
|
window.removeEventListener("resize", this.handleResize);
|
|
38464
38484
|
}
|
|
38465
|
-
trackItemListView(title) {
|
|
38485
|
+
trackItemListView(title, items = []) {
|
|
38466
38486
|
this.trackEvent({
|
|
38467
38487
|
queryKey: this.options.queryKey,
|
|
38468
38488
|
data: {
|
|
38469
38489
|
analytics: {
|
|
38470
38490
|
type: "view_item_list",
|
|
38471
38491
|
label: title,
|
|
38492
|
+
listLabel: title,
|
|
38493
|
+
items,
|
|
38472
38494
|
},
|
|
38473
38495
|
options: { allowEmptySearchQuery: true },
|
|
38474
38496
|
},
|
|
@@ -38482,7 +38504,6 @@ let SearchResults = class SearchResults extends Vue$1 {
|
|
|
38482
38504
|
setDocumentTitle(pageTitle, "");
|
|
38483
38505
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
38484
38506
|
(_a = this.$refs.searchResultsFilters) === null || _a === void 0 ? void 0 : _a.fetch();
|
|
38485
|
-
this.trackItemListView(pageTitle);
|
|
38486
38507
|
}
|
|
38487
38508
|
const params = new URLSearchParams(window.location.search);
|
|
38488
38509
|
if (!params.has(QUERY_PARAMS.QUERY)) {
|
|
@@ -38551,6 +38572,7 @@ let SearchResults = class SearchResults extends Vue$1 {
|
|
|
38551
38572
|
if (!hasResults) {
|
|
38552
38573
|
return;
|
|
38553
38574
|
}
|
|
38575
|
+
this.trackItemListView(this.options.labels.htmlTitleTemplate, results.items);
|
|
38554
38576
|
yield this.enhanceData({ result: results });
|
|
38555
38577
|
});
|
|
38556
38578
|
}
|
|
@@ -40391,6 +40413,7 @@ let OptionsModule = class OptionsModule extends VuexModule {
|
|
|
40391
40413
|
super(...arguments);
|
|
40392
40414
|
this.searchBoxOptions = DEFAULT_SEARCH_BOX_OPTIONS;
|
|
40393
40415
|
this.searchResultOptions = DEFAULT_OPTIONS_RESULTS;
|
|
40416
|
+
this.trackingOptions = {};
|
|
40394
40417
|
this.searchResultInitialFilters = {};
|
|
40395
40418
|
}
|
|
40396
40419
|
get envOptions() {
|
|
@@ -40439,6 +40462,9 @@ let OptionsModule = class OptionsModule extends VuexModule {
|
|
|
40439
40462
|
setSearchBoxOptions({ options }) {
|
|
40440
40463
|
this.searchBoxOptions = options;
|
|
40441
40464
|
}
|
|
40465
|
+
setTrackingOptions({ options }) {
|
|
40466
|
+
this.trackingOptions = options !== null && options !== void 0 ? options : {};
|
|
40467
|
+
}
|
|
40442
40468
|
setSearchResultOptions({ options }) {
|
|
40443
40469
|
this.searchResultOptions = options;
|
|
40444
40470
|
}
|
|
@@ -40449,6 +40475,9 @@ let OptionsModule = class OptionsModule extends VuexModule {
|
|
|
40449
40475
|
__decorate([
|
|
40450
40476
|
Mutation
|
|
40451
40477
|
], OptionsModule.prototype, "setSearchBoxOptions", null);
|
|
40478
|
+
__decorate([
|
|
40479
|
+
Mutation
|
|
40480
|
+
], OptionsModule.prototype, "setTrackingOptions", null);
|
|
40452
40481
|
__decorate([
|
|
40453
40482
|
Mutation
|
|
40454
40483
|
], OptionsModule.prototype, "setSearchResultOptions", null);
|
|
@@ -40493,9 +40522,15 @@ let TrackingModule = class TrackingModule extends VuexModule {
|
|
|
40493
40522
|
}
|
|
40494
40523
|
}
|
|
40495
40524
|
track({ queryKey, data, }) {
|
|
40496
|
-
var _a;
|
|
40525
|
+
var _a, _b, _c, _d, _e;
|
|
40497
40526
|
const options = (_a = this.context.rootGetters["options/envOptions"]) !== null && _a !== void 0 ? _a : {};
|
|
40498
|
-
|
|
40527
|
+
const trackingOptions = (_b = this.context.rootState["options"].trackingOptions) !== null && _b !== void 0 ? _b : {};
|
|
40528
|
+
const items = (_d = (_c = data.analytics) === null || _c === void 0 ? void 0 : _c.items) !== null && _d !== void 0 ? _d : [];
|
|
40529
|
+
const mappedItems = ((_e = trackingOptions.analytics) === null || _e === void 0 ? void 0 : _e.itemMap)
|
|
40530
|
+
? items.map(trackingOptions.analytics.itemMap)
|
|
40531
|
+
: items;
|
|
40532
|
+
track(queryKey, Object.assign(Object.assign({}, data), { analytics: data.analytics
|
|
40533
|
+
? Object.assign(Object.assign({}, data.analytics), { items: mappedItems }) : undefined }), options);
|
|
40499
40534
|
}
|
|
40500
40535
|
};
|
|
40501
40536
|
__decorate([
|
|
@@ -40670,6 +40705,7 @@ const app = {
|
|
|
40670
40705
|
};
|
|
40671
40706
|
const tracking = (options) => {
|
|
40672
40707
|
initTracking(options);
|
|
40708
|
+
store.commit("options/setTrackingOptions", { options });
|
|
40673
40709
|
};
|
|
40674
40710
|
const applySearchBox = (options, mountOptions) => {
|
|
40675
40711
|
const existingInstance = app.box[options.inputSelector];
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { TrackingOptions } from "@/types/General";
|
|
1
2
|
import { SearchBoxOptions } from "@/types/search-box/SearchBoxOptions";
|
|
2
3
|
import { RoutingBehavior } from "@/types/search-results/RoutingBehavior";
|
|
3
4
|
import { SearchResultsOptions } from "@/types/search-results/SearchResultsOptions";
|
|
@@ -6,6 +7,7 @@ import { VuexModule } from "vuex-module-decorators";
|
|
|
6
7
|
export default class OptionsModule extends VuexModule {
|
|
7
8
|
searchBoxOptions: SearchBoxOptions;
|
|
8
9
|
searchResultOptions: SearchResultsOptions;
|
|
10
|
+
trackingOptions: TrackingOptions;
|
|
9
11
|
searchResultInitialFilters: FilterGroup;
|
|
10
12
|
get envOptions(): Options;
|
|
11
13
|
get classMap(): Record<string, string>;
|
|
@@ -17,6 +19,9 @@ export default class OptionsModule extends VuexModule {
|
|
|
17
19
|
setSearchBoxOptions({ options }: {
|
|
18
20
|
options: SearchBoxOptions;
|
|
19
21
|
}): void;
|
|
22
|
+
setTrackingOptions({ options }: {
|
|
23
|
+
options: TrackingOptions;
|
|
24
|
+
}): void;
|
|
20
25
|
setSearchResultOptions({ options }: {
|
|
21
26
|
options: SearchResultsOptions;
|
|
22
27
|
}): void;
|
|
@@ -58,7 +58,7 @@ export default class SearchResults extends Vue {
|
|
|
58
58
|
}) => void;
|
|
59
59
|
mounted(): void;
|
|
60
60
|
beforeDestroy(): void;
|
|
61
|
-
trackItemListView(title: string): void;
|
|
61
|
+
trackItemListView(title: string, items?: Record<string, unknown>[]): void;
|
|
62
62
|
handleMounted(): void;
|
|
63
63
|
handleParamsChange(): void;
|
|
64
64
|
addSearchResult: (searchResult: SearchQueryResult) => SearchQueryResult;
|
package/dist/iife/components/search-results/products/product-card/SearchResultsProductCard.vue.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { DocumentElement } from "@/types/DocumentElement";
|
|
2
|
+
import { TrackingOptions } from "@/types/General";
|
|
2
3
|
import { TrackableEventData } from "@/types/search-box/Common";
|
|
3
4
|
import { BadgeOptions } from "@/types/search-results/BadgeOptions";
|
|
4
5
|
import { ResultsLayout } from "@/types/search-results/ResultsLayout";
|
|
@@ -15,6 +16,7 @@ export default class SearchResultsProductCard extends Vue {
|
|
|
15
16
|
layout: ResultsLayout;
|
|
16
17
|
searchResultsRoutingBehavior: RoutingBehavior;
|
|
17
18
|
searchResultOptions: SearchResultsOptions;
|
|
19
|
+
trackingOptions: TrackingOptions;
|
|
18
20
|
query: string;
|
|
19
21
|
trackClick: ({ queryKey, data, }: {
|
|
20
22
|
queryKey: string;
|