@searchspring/snap-controller 0.74.0 → 0.75.0
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/Autocomplete/AutocompleteController.d.ts.map +1 -1
- package/dist/cjs/Autocomplete/AutocompleteController.js +39 -8
- package/dist/cjs/Recommendation/RecommendationController.d.ts.map +1 -1
- package/dist/cjs/Recommendation/RecommendationController.js +17 -1
- package/dist/cjs/Search/SearchController.d.ts.map +1 -1
- package/dist/cjs/Search/SearchController.js +30 -2
- package/dist/cjs/utils/isClickWithinProductLink.d.ts +1 -1
- package/dist/cjs/utils/isClickWithinProductLink.d.ts.map +1 -1
- package/dist/cjs/utils/isClickWithinProductLink.js +1 -1
- package/dist/esm/Autocomplete/AutocompleteController.d.ts.map +1 -1
- package/dist/esm/Autocomplete/AutocompleteController.js +36 -5
- package/dist/esm/Recommendation/RecommendationController.d.ts.map +1 -1
- package/dist/esm/Recommendation/RecommendationController.js +17 -1
- package/dist/esm/Search/SearchController.d.ts.map +1 -1
- package/dist/esm/Search/SearchController.js +30 -2
- package/dist/esm/utils/isClickWithinProductLink.d.ts +1 -1
- package/dist/esm/utils/isClickWithinProductLink.d.ts.map +1 -1
- package/dist/esm/utils/isClickWithinProductLink.js +1 -1
- package/package.json +10 -10
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AutocompleteController.d.ts","sourceRoot":"","sources":["../../../src/Autocomplete/AutocompleteController.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,YAAY,EAAa,OAAO,EAAE,MAAM,EAAE,0BAA0B,EAAE,MAAM,+BAA+B,CAAC;AACrH,OAAO,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AAEpE,OAAO,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAE3C,OAAO,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AAClE,OAAO,KAAK,EAAE,4BAA4B,EAA6C,kBAAkB,EAAE,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E,GAAG,OAAO,KAAG,QAAQ,IAAI,CAAC,CAY/D;CACF"}
|
|
@@ -116,13 +116,17 @@ var AutocompleteController = /** @class */ (function (_super) {
|
|
|
116
116
|
_this.track = {
|
|
117
117
|
banner: {
|
|
118
118
|
impression: function (_banner) {
|
|
119
|
-
var _a, _b, _c, _d, _e;
|
|
119
|
+
var _a, _b, _c, _d, _e, _f;
|
|
120
120
|
if (!_banner) {
|
|
121
121
|
_this.log.warn('No banner provided to track.banner.impression');
|
|
122
122
|
return;
|
|
123
123
|
}
|
|
124
124
|
var responseId = _banner.responseId, uid = _banner.uid;
|
|
125
|
-
if (
|
|
125
|
+
if (!_this.events[responseId]) {
|
|
126
|
+
_this.log.warn('No responseId found in controller, ensure correct controller is used');
|
|
127
|
+
return;
|
|
128
|
+
}
|
|
129
|
+
else if ((_d = (_c = (_b = (_a = _this.events) === null || _a === void 0 ? void 0 : _a[responseId]) === null || _b === void 0 ? void 0 : _b.banner) === null || _c === void 0 ? void 0 : _c[uid]) === null || _d === void 0 ? void 0 : _d.impression) {
|
|
126
130
|
return;
|
|
127
131
|
}
|
|
128
132
|
var banner = { uid: uid };
|
|
@@ -132,7 +136,7 @@ var AutocompleteController = /** @class */ (function (_super) {
|
|
|
132
136
|
results: [],
|
|
133
137
|
};
|
|
134
138
|
_this.eventManager.fire('track.banner.impression', { controller: _this, product: { uid: uid }, trackEvent: data });
|
|
135
|
-
((
|
|
139
|
+
((_e = _this.config.beacon) === null || _e === void 0 ? void 0 : _e.enabled) && _this.tracker.events.autocomplete.impression({ data: data, siteId: (_f = _this.config.globals) === null || _f === void 0 ? void 0 : _f.siteId });
|
|
136
140
|
_this.events[responseId].banner[uid] = _this.events[responseId].banner[uid] || {};
|
|
137
141
|
_this.events[responseId].banner[uid].impression = true;
|
|
138
142
|
},
|
|
@@ -143,6 +147,10 @@ var AutocompleteController = /** @class */ (function (_super) {
|
|
|
143
147
|
return;
|
|
144
148
|
}
|
|
145
149
|
var responseId = banner.responseId, uid = banner.uid;
|
|
150
|
+
if (!_this.events[responseId]) {
|
|
151
|
+
_this.log.warn('No responseId found in controller, ensure correct controller is used');
|
|
152
|
+
return;
|
|
153
|
+
}
|
|
146
154
|
if ((0, isClickWithinBannerLink_1.isClickWithinBannerLink)(e)) {
|
|
147
155
|
if ((_c = (_b = (_a = _this.events) === null || _a === void 0 ? void 0 : _a[responseId]) === null || _b === void 0 ? void 0 : _b.banner[uid]) === null || _c === void 0 ? void 0 : _c.clickThrough) {
|
|
148
156
|
return;
|
|
@@ -162,6 +170,10 @@ var AutocompleteController = /** @class */ (function (_super) {
|
|
|
162
170
|
_this.log.warn('No banner uid provided to track.banner.clickThrough');
|
|
163
171
|
return;
|
|
164
172
|
}
|
|
173
|
+
if (!_this.events[responseId]) {
|
|
174
|
+
_this.log.warn('No responseId found in controller, ensure correct controller is used');
|
|
175
|
+
return;
|
|
176
|
+
}
|
|
165
177
|
var banner = { uid: uid };
|
|
166
178
|
var data = {
|
|
167
179
|
responseId: responseId,
|
|
@@ -184,6 +196,10 @@ var AutocompleteController = /** @class */ (function (_super) {
|
|
|
184
196
|
return;
|
|
185
197
|
}
|
|
186
198
|
var responseId = result.responseId;
|
|
199
|
+
if (!_this.events[responseId]) {
|
|
200
|
+
_this.log.warn('No responseId found in controller, ensure correct controller is used');
|
|
201
|
+
return;
|
|
202
|
+
}
|
|
187
203
|
var type = (['product', 'banner'].includes(result.type) ? result.type : 'product');
|
|
188
204
|
var item = __assign({ type: type, uid: result.id ? '' + result.id : '' }, (type === 'product'
|
|
189
205
|
? {
|
|
@@ -205,6 +221,10 @@ var AutocompleteController = /** @class */ (function (_super) {
|
|
|
205
221
|
return;
|
|
206
222
|
}
|
|
207
223
|
var responseId = result.responseId;
|
|
224
|
+
if (!_this.events[responseId]) {
|
|
225
|
+
_this.log.warn('No responseId found in controller, ensure correct controller is used');
|
|
226
|
+
return;
|
|
227
|
+
}
|
|
208
228
|
if (result.type === 'banner' && (0, isClickWithinBannerLink_1.isClickWithinBannerLink)(e)) {
|
|
209
229
|
if ((_c = (_b = (_a = _this.events) === null || _a === void 0 ? void 0 : _a[responseId]) === null || _b === void 0 ? void 0 : _b.product[result.id]) === null || _c === void 0 ? void 0 : _c.inlineBannerClickThrough) {
|
|
210
230
|
return;
|
|
@@ -235,7 +255,11 @@ var AutocompleteController = /** @class */ (function (_super) {
|
|
|
235
255
|
return;
|
|
236
256
|
}
|
|
237
257
|
var responseId = result.responseId;
|
|
238
|
-
if (
|
|
258
|
+
if (!_this.events[responseId]) {
|
|
259
|
+
_this.log.warn('No responseId found in controller, ensure correct controller is used');
|
|
260
|
+
return;
|
|
261
|
+
}
|
|
262
|
+
else if ((_c = (_b = (_a = _this.events) === null || _a === void 0 ? void 0 : _a[responseId]) === null || _b === void 0 ? void 0 : _b.product[result.id]) === null || _c === void 0 ? void 0 : _c.impression) {
|
|
239
263
|
return;
|
|
240
264
|
}
|
|
241
265
|
var type = (['product', 'banner'].includes(result.type) ? result.type : 'product');
|
|
@@ -262,6 +286,10 @@ var AutocompleteController = /** @class */ (function (_super) {
|
|
|
262
286
|
return;
|
|
263
287
|
}
|
|
264
288
|
var responseId = result.responseId;
|
|
289
|
+
if (!_this.events[responseId]) {
|
|
290
|
+
_this.log.warn('No responseId found in controller, ensure correct controller is used');
|
|
291
|
+
return;
|
|
292
|
+
}
|
|
265
293
|
var product = {
|
|
266
294
|
parentId: result.id,
|
|
267
295
|
uid: result.id,
|
|
@@ -552,7 +580,7 @@ var AutocompleteController = /** @class */ (function (_super) {
|
|
|
552
580
|
});
|
|
553
581
|
}); };
|
|
554
582
|
_this.search = function () { return __awaiter(_this, void 0, void 0, function () {
|
|
555
|
-
var params, err_3, searchProfile, _a, meta, response, responseId_1, previousResponseId, impressedResultIds, afterSearchProfile, err_4, data, afterStoreProfile, err_5, err_6;
|
|
583
|
+
var params, err_3, searchProfile, _a, meta, response, responseId_1, previousResponseId, repeatedSearch, impressedResultIds, afterSearchProfile, err_4, data, afterStoreProfile, err_5, err_6;
|
|
556
584
|
var _this = this;
|
|
557
585
|
var _b, _c, _d, _e, _f;
|
|
558
586
|
return __generator(this, function (_g) {
|
|
@@ -613,7 +641,8 @@ var AutocompleteController = /** @class */ (function (_super) {
|
|
|
613
641
|
responseId_1 = response.tracking.responseId;
|
|
614
642
|
this.events[responseId_1] = this.events[responseId_1] || { product: {}, banner: {} };
|
|
615
643
|
previousResponseId = (_d = this.store.results[0]) === null || _d === void 0 ? void 0 : _d.responseId;
|
|
616
|
-
|
|
644
|
+
repeatedSearch = previousResponseId && previousResponseId === responseId_1;
|
|
645
|
+
if (repeatedSearch) {
|
|
617
646
|
impressedResultIds = Object.keys(this.events[responseId_1].product || {}).filter(function (resultId) { var _a, _b; return (_b = (_a = _this.events[responseId_1].product) === null || _a === void 0 ? void 0 : _a[resultId]) === null || _b === void 0 ? void 0 : _b.impression; });
|
|
618
647
|
this.events[responseId_1] = {
|
|
619
648
|
product: impressedResultIds.reduce(function (acc, resultId) {
|
|
@@ -655,8 +684,10 @@ var AutocompleteController = /** @class */ (function (_super) {
|
|
|
655
684
|
this.log.profile(afterSearchProfile);
|
|
656
685
|
// update the store
|
|
657
686
|
this.store.update(response);
|
|
658
|
-
|
|
659
|
-
|
|
687
|
+
if (!repeatedSearch) {
|
|
688
|
+
data = { responseId: responseId_1 };
|
|
689
|
+
((_e = this.config.beacon) === null || _e === void 0 ? void 0 : _e.enabled) && this.tracker.events.autocomplete.render({ data: data, siteId: (_f = this.config.globals) === null || _f === void 0 ? void 0 : _f.siteId });
|
|
690
|
+
}
|
|
660
691
|
afterStoreProfile = this.profiler.create({ type: 'event', name: 'afterStore', context: params }).start();
|
|
661
692
|
_g.label = 12;
|
|
662
693
|
case 12:
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RecommendationController.d.ts","sourceRoot":"","sources":["../../../src/Recommendation/RecommendationController.ts"],"names":[],"mappings":"AAEA,OAAO,EAAa,OAAO,EAAE,MAAM,+BAA+B,CAAC;AACnE,OAAO,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AACpE,OAAO,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAW3C,OAAO,KAAK,EAAE,MAAM,EAAE,mBAAmB,EAAE,MAAM,+BAA+B,CAAC;AACjF,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAC;AACvE,OAAO,KAAK,EAAE,8BAA8B,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAGrG,KAAK,0BAA0B,GAAG;IACjC,OAAO,EAAE;QACR,YAAY,EAAE,CAAC,CAAC,EAAE,UAAU,EAAE,MAAM,EAAE,OAAO,GAAG,MAAM,KAAK,IAAI,CAAC;QAChE,KAAK,EAAE,CAAC,CAAC,EAAE,UAAU,EAAE,MAAM,EAAE,OAAO,GAAG,MAAM,KAAK,IAAI,CAAC;QACzD,UAAU,EAAE,CAAC,MAAM,EAAE,OAAO,GAAG,MAAM,KAAK,IAAI,CAAC;QAC/C,SAAS,EAAE,CAAC,MAAM,EAAE,OAAO,KAAK,IAAI,CAAC;KACrC,CAAC;CACF,CAAC;AAaF,qBAAa,wBAAyB,SAAQ,kBAAkB;IACxD,IAAI,kBAAkC;IACrC,KAAK,EAAE,mBAAmB,CAAC;IAC3B,MAAM,EAAE,8BAA8B,CAAC;IAE/C,OAAO,CAAC,MAAM,CAUP;gBAGN,MAAM,EAAE,8BAA8B,EACtC,EAAE,MAAM,EAAE,KAAK,EAAE,UAAU,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,EAAE,kBAAkB,EAC1F,OAAO,CAAC,EAAE,gBAAgB;IAwC3B,KAAK,EAAE,0BAA0B,
|
|
1
|
+
{"version":3,"file":"RecommendationController.d.ts","sourceRoot":"","sources":["../../../src/Recommendation/RecommendationController.ts"],"names":[],"mappings":"AAEA,OAAO,EAAa,OAAO,EAAE,MAAM,+BAA+B,CAAC;AACnE,OAAO,EAAE,kBAAkB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6 +98,10 @@ var RecommendationController = /** @class */ (function (_super) {
|
|
|
98
98
|
return;
|
|
99
99
|
}
|
|
100
100
|
var responseId = result.responseId;
|
|
101
|
+
if (!_this.events[responseId]) {
|
|
102
|
+
_this.log.warn('No responseId found in controller, ensure correct controller is used');
|
|
103
|
+
return;
|
|
104
|
+
}
|
|
101
105
|
if ((_b = (_a = _this.events[responseId]) === null || _a === void 0 ? void 0 : _a.product[result.id]) === null || _b === void 0 ? void 0 : _b.productClickThrough)
|
|
102
106
|
return;
|
|
103
107
|
var type = (['product', 'banner'].includes(result.type) ? result.type : 'product');
|
|
@@ -124,6 +128,10 @@ var RecommendationController = /** @class */ (function (_super) {
|
|
|
124
128
|
return;
|
|
125
129
|
}
|
|
126
130
|
var responseId = result.responseId;
|
|
131
|
+
if (!_this.events[responseId]) {
|
|
132
|
+
_this.log.warn('No responseId found in controller, ensure correct controller is used');
|
|
133
|
+
return;
|
|
134
|
+
}
|
|
127
135
|
if (result.type === 'banner') {
|
|
128
136
|
if ((_b = (_a = _this.events[responseId]) === null || _a === void 0 ? void 0 : _a.product[result.id]) === null || _b === void 0 ? void 0 : _b.inlineBannerClickThrough) {
|
|
129
137
|
return;
|
|
@@ -154,7 +162,11 @@ var RecommendationController = /** @class */ (function (_super) {
|
|
|
154
162
|
return;
|
|
155
163
|
}
|
|
156
164
|
var responseId = result.responseId;
|
|
157
|
-
if (
|
|
165
|
+
if (!_this.events[responseId]) {
|
|
166
|
+
_this.log.warn('No responseId found in controller, ensure correct controller is used');
|
|
167
|
+
return;
|
|
168
|
+
}
|
|
169
|
+
else if ((_b = (_a = _this.events[responseId]) === null || _a === void 0 ? void 0 : _a.product[result.id]) === null || _b === void 0 ? void 0 : _b.impression) {
|
|
158
170
|
return;
|
|
159
171
|
}
|
|
160
172
|
var type = (['product', 'banner'].includes(result.type) ? result.type : 'product');
|
|
@@ -182,6 +194,10 @@ var RecommendationController = /** @class */ (function (_super) {
|
|
|
182
194
|
return;
|
|
183
195
|
}
|
|
184
196
|
var responseId = result.responseId;
|
|
197
|
+
if (!_this.events[responseId]) {
|
|
198
|
+
_this.log.warn('No responseId found in controller, ensure correct controller is used');
|
|
199
|
+
return;
|
|
200
|
+
}
|
|
185
201
|
var product = {
|
|
186
202
|
parentId: result.id,
|
|
187
203
|
uid: result.id,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SearchController.d.ts","sourceRoot":"","sources":["../../../src/Search/SearchController.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AACpE,OAAO,EAAE,YAAY,EAAa,0BAA0B,EAAE,MAAM,+BAA+B,CAAC;AAEpG,OAAO,EAAE,eAAe,EAAuB,MAAM,UAAU,CAAC;AAEhE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,WAAW,EAAc,MAAM,+BAA+B,CAAC;AAC9F,OAAO,KAAK,EACX,sBAAsB,EAGtB,kBAAkB,EAClB,gBAAgB,EAIhB,MAAM,UAAU,CAAC;AAElB,OAAO,EACN,KAAK,kBAAkB,EAYvB,MAAM,2BAA2B,CAAC;AAyCnC,KAAK,kBAAkB,GAAG;IACzB,MAAM,EAAE;QACP,KAAK,EAAE,CAAC,CAAC,EAAE,UAAU,EAAE,mBAAmB,EAAE,0BAA0B,KAAK,IAAI,CAAC;QAChF,YAAY,EAAE,CAAC,CAAC,EAAE,UAAU,EAAE,mBAAmB,EAAE,0BAA0B,KAAK,IAAI,CAAC;QACvF,UAAU,EAAE,CAAC,mBAAmB,EAAE,0BAA0B,KAAK,IAAI,CAAC;KACtE,CAAC;IACF,OAAO,EAAE;QACR,YAAY,EAAE,CAAC,CAAC,EAAE,UAAU,EAAE,MAAM,EAAE,OAAO,GAAG,MAAM,KAAK,IAAI,CAAC;QAChE,KAAK,EAAE,CAAC,CAAC,EAAE,UAAU,EAAE,MAAM,EAAE,OAAO,GAAG,MAAM,KAAK,IAAI,CAAC;QACzD,UAAU,EAAE,CAAC,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AAkB,CA4PvB;IAEF,IAAI,MAAM,IAAI,kBAAkB,CA8C/B;IAED,MAAM,QAAa,QAAQ,IAAI,CAAC,CA6N9B;IAEF,SAAS,cAAqB,OAAO,EAAE,GAAG,OAAO,KAAG,QAAQ,IAAI,CAAC,CAY/D;CACF;AAED,wBAAgB,wBAAwB,CAAC,OAAO,EAAE,kBAAkB,GAAG,kBAAkB,CAiBxF;AAED,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,WAAW,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,SAAI,GAAG,MAAM,GAAG,SAAS,CAuCvG"}
|
|
@@ -125,7 +125,11 @@ var SearchController = /** @class */ (function (_super) {
|
|
|
125
125
|
_this.log.warn('No banner provided to track.banner.impression');
|
|
126
126
|
return;
|
|
127
127
|
}
|
|
128
|
-
if (
|
|
128
|
+
if (!_this.events[responseId]) {
|
|
129
|
+
_this.log.warn('No responseId found in controller, ensure correct controller is used');
|
|
130
|
+
return;
|
|
131
|
+
}
|
|
132
|
+
else if ((_c = (_b = _this.events[responseId]) === null || _b === void 0 ? void 0 : _b.banner[uid]) === null || _c === void 0 ? void 0 : _c.impression) {
|
|
129
133
|
return;
|
|
130
134
|
}
|
|
131
135
|
var banner = { uid: uid };
|
|
@@ -146,6 +150,10 @@ var SearchController = /** @class */ (function (_super) {
|
|
|
146
150
|
return;
|
|
147
151
|
}
|
|
148
152
|
var responseId = banner.responseId, uid = banner.uid;
|
|
153
|
+
if (!_this.events[responseId]) {
|
|
154
|
+
_this.log.warn('No responseId found in controller, ensure correct controller is used');
|
|
155
|
+
return;
|
|
156
|
+
}
|
|
149
157
|
if ((0, isClickWithinBannerLink_1.isClickWithinBannerLink)(e)) {
|
|
150
158
|
if ((_c = (_b = (_a = _this.events) === null || _a === void 0 ? void 0 : _a[responseId]) === null || _b === void 0 ? void 0 : _b.banner[uid]) === null || _c === void 0 ? void 0 : _c.clickThrough) {
|
|
151
159
|
return;
|
|
@@ -165,6 +173,10 @@ var SearchController = /** @class */ (function (_super) {
|
|
|
165
173
|
_this.log.warn('No banner provided to track.banner.clickThrough');
|
|
166
174
|
return;
|
|
167
175
|
}
|
|
176
|
+
if (!_this.events[responseId]) {
|
|
177
|
+
_this.log.warn('No responseId found in controller, ensure correct controller is used');
|
|
178
|
+
return;
|
|
179
|
+
}
|
|
168
180
|
var banner = { uid: uid };
|
|
169
181
|
var data = {
|
|
170
182
|
responseId: responseId,
|
|
@@ -187,6 +199,10 @@ var SearchController = /** @class */ (function (_super) {
|
|
|
187
199
|
return;
|
|
188
200
|
}
|
|
189
201
|
var responseId = result.responseId;
|
|
202
|
+
if (!_this.events[responseId]) {
|
|
203
|
+
_this.log.warn('No responseId found in controller, ensure correct controller is used');
|
|
204
|
+
return;
|
|
205
|
+
}
|
|
190
206
|
var target = e.target;
|
|
191
207
|
var resultHref = ((_b = (_a = result.display) === null || _a === void 0 ? void 0 : _a.mappings.core) === null || _b === void 0 ? void 0 : _b.url) || ((_c = result.mappings.core) === null || _c === void 0 ? void 0 : _c.url) || '';
|
|
192
208
|
var elemHref = target === null || target === void 0 ? void 0 : target.getAttribute('href');
|
|
@@ -234,6 +250,10 @@ var SearchController = /** @class */ (function (_super) {
|
|
|
234
250
|
return;
|
|
235
251
|
}
|
|
236
252
|
var responseId = result.responseId;
|
|
253
|
+
if (!_this.events[responseId]) {
|
|
254
|
+
_this.log.warn('No responseId found in controller, ensure correct controller is used');
|
|
255
|
+
return;
|
|
256
|
+
}
|
|
237
257
|
if (result.type === 'banner' && (0, isClickWithinBannerLink_1.isClickWithinBannerLink)(e)) {
|
|
238
258
|
if ((_c = (_b = (_a = _this.events) === null || _a === void 0 ? void 0 : _a[responseId]) === null || _b === void 0 ? void 0 : _b.product[result.id]) === null || _c === void 0 ? void 0 : _c.inlineBannerClickThrough) {
|
|
239
259
|
return;
|
|
@@ -264,7 +284,11 @@ var SearchController = /** @class */ (function (_super) {
|
|
|
264
284
|
return;
|
|
265
285
|
}
|
|
266
286
|
var responseId = result.responseId;
|
|
267
|
-
if (
|
|
287
|
+
if (!_this.events[responseId]) {
|
|
288
|
+
_this.log.warn('No responseId found in controller, ensure correct controller is used');
|
|
289
|
+
return;
|
|
290
|
+
}
|
|
291
|
+
else if ((_b = (_a = _this.events[responseId]) === null || _a === void 0 ? void 0 : _a.product[result.id]) === null || _b === void 0 ? void 0 : _b.impression) {
|
|
268
292
|
return;
|
|
269
293
|
}
|
|
270
294
|
var type = (['product', 'banner'].includes(result.type) ? result.type : 'product');
|
|
@@ -291,6 +315,10 @@ var SearchController = /** @class */ (function (_super) {
|
|
|
291
315
|
return;
|
|
292
316
|
}
|
|
293
317
|
var responseId = result.responseId;
|
|
318
|
+
if (!_this.events[responseId]) {
|
|
319
|
+
_this.log.warn('No responseId found in controller, ensure correct controller is used');
|
|
320
|
+
return;
|
|
321
|
+
}
|
|
294
322
|
var product = {
|
|
295
323
|
parentId: result.id,
|
|
296
324
|
uid: result.id,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Product } from '@searchspring/snap-store-mobx';
|
|
2
|
-
export declare const CLICK_DUPLICATION_TIMEOUT =
|
|
2
|
+
export declare const CLICK_DUPLICATION_TIMEOUT = 1000;
|
|
3
3
|
export declare const CLICK_THROUGH_CLOSEST_MAX_LEVELS = 12;
|
|
4
4
|
export declare const isClickWithinProductLink: (e: MouseEvent, result: Product) => boolean;
|
|
5
5
|
//# sourceMappingURL=isClickWithinProductLink.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"isClickWithinProductLink.d.ts","sourceRoot":"","sources":["../../../src/utils/isClickWithinProductLink.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,+BAA+B,CAAC;AAE7D,eAAO,MAAM,yBAAyB,
|
|
1
|
+
{"version":3,"file":"isClickWithinProductLink.d.ts","sourceRoot":"","sources":["../../../src/utils/isClickWithinProductLink.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,+BAA+B,CAAC;AAE7D,eAAO,MAAM,yBAAyB,OAAO,CAAC;AAC9C,eAAO,MAAM,gCAAgC,KAAK,CAAC;AAEnD,eAAO,MAAM,wBAAwB,MAAO,UAAU,UAAU,OAAO,KAAG,OAoBzE,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.isClickWithinProductLink = exports.CLICK_THROUGH_CLOSEST_MAX_LEVELS = exports.CLICK_DUPLICATION_TIMEOUT = void 0;
|
|
4
|
-
exports.CLICK_DUPLICATION_TIMEOUT =
|
|
4
|
+
exports.CLICK_DUPLICATION_TIMEOUT = 1000;
|
|
5
5
|
exports.CLICK_THROUGH_CLOSEST_MAX_LEVELS = 12;
|
|
6
6
|
var isClickWithinProductLink = function (e, result) {
|
|
7
7
|
var _a, _b, _c;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AutocompleteController.d.ts","sourceRoot":"","sources":["../../../src/Autocomplete/AutocompleteController.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,YAAY,EAAa,OAAO,EAAE,MAAM,EAAE,0BAA0B,EAAE,MAAM,+BAA+B,CAAC;AACrH,OAAO,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AAEpE,OAAO,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAE3C,OAAO,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AAClE,OAAO,KAAK,EAAE,4BAA4B,EAA6C,kBAAkB,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAE9I,OAAO,KAAK,EAAE,wBAAwB,EAA4C,MAAM,2BAA2B,CAAC;AAkBpH,eAAO,MAAM,WAAW,MAAM,CAAC;AAkC/B,KAAK,wBAAwB,GAAG;IAC/B,MAAM,EAAE;QACP,KAAK,EAAE,CAAC,CAAC,EAAE,UAAU,EAAE,mBAAmB,EA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Q,kBAAkB;IACtD,IAAI,kBAAgC;IACnC,KAAK,EAAE,iBAAiB,CAAC;IACzB,MAAM,EAAE,4BAA4B,CAAC;IACtC,OAAO,EAAE,YAAY,CAAC;IAE7B,OAAO,CAAC,MAAM,CAgBP;gBAGN,MAAM,EAAE,4BAA4B,EACpC,EAAE,MAAM,EAAE,KAAK,EAAE,UAAU,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,EAAE,kBAAkB,EAC1F,OAAO,CAAC,EAAE,gBAAgB;IA8D3B,KAAK,EAAE,wBAAwB,CA8N7B;IAEF,IAAI,MAAM,IAAI,wBAAwB,CAkDrC;IAEK,UAAU,CAAC,YAAY,CAAC,EAAE,gBAAgB,GAAG,OAAO,CAAC,IAAI,CAAC;IA2BhE,KAAK,IAAI,IAAI;IASb,QAAQ;;0BAEc,aAAa,KAAG,QAAQ,OAAO,GAAG,SAAS,CAAC;wBAiDpD,aAAa,KAAG,IAAI;uBAMrB,UAAU,KAAG,IAAI;4BAQN,MAAM,SAAS,CAAC,gBAAgB,CAAC,KAAG,QAAQ,IAAI,CAAC;mCA+ChD,MAAM,WAAW,CAAC,gBAAgB,CAAC,KAAG,IAAI;uBAqBtD,KAAK;;;;uBA0DL,UAAU,KAAG,IAAI;;MAS5B;IAEF,MAAM,IAAI,IAAI;IAgBR,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;IAgF3B,cAAc,QAAa,QAAQ,IAAI,CAAC,CAwBtC;IAEF,MAAM,QAAa,QAAQ,IAAI,CAAC,CAqK9B;IAEF,SAAS,cAAqB,OAAO,EAAE,GAAG,OAAO,KAAG,QAAQ,IAAI,CAAC,CAY/D;CACF"}
|
|
@@ -51,7 +51,11 @@ export class AutocompleteController extends AbstractController {
|
|
|
51
51
|
return;
|
|
52
52
|
}
|
|
53
53
|
const { responseId, uid } = _banner;
|
|
54
|
-
if (this.events[responseId]
|
|
54
|
+
if (!this.events[responseId]) {
|
|
55
|
+
this.log.warn('No responseId found in controller, ensure correct controller is used');
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
58
|
+
else if (this.events?.[responseId]?.banner?.[uid]?.impression) {
|
|
55
59
|
return;
|
|
56
60
|
}
|
|
57
61
|
const banner = { uid };
|
|
@@ -71,6 +75,10 @@ export class AutocompleteController extends AbstractController {
|
|
|
71
75
|
return;
|
|
72
76
|
}
|
|
73
77
|
const { responseId, uid } = banner;
|
|
78
|
+
if (!this.events[responseId]) {
|
|
79
|
+
this.log.warn('No responseId found in controller, ensure correct controller is used');
|
|
80
|
+
return;
|
|
81
|
+
}
|
|
74
82
|
if (isClickWithinBannerLink(e)) {
|
|
75
83
|
if (this.events?.[responseId]?.banner[uid]?.clickThrough) {
|
|
76
84
|
return;
|
|
@@ -88,6 +96,10 @@ export class AutocompleteController extends AbstractController {
|
|
|
88
96
|
this.log.warn('No banner uid provided to track.banner.clickThrough');
|
|
89
97
|
return;
|
|
90
98
|
}
|
|
99
|
+
if (!this.events[responseId]) {
|
|
100
|
+
this.log.warn('No responseId found in controller, ensure correct controller is used');
|
|
101
|
+
return;
|
|
102
|
+
}
|
|
91
103
|
const banner = { uid };
|
|
92
104
|
const data = {
|
|
93
105
|
responseId,
|
|
@@ -109,6 +121,10 @@ export class AutocompleteController extends AbstractController {
|
|
|
109
121
|
return;
|
|
110
122
|
}
|
|
111
123
|
const responseId = result.responseId;
|
|
124
|
+
if (!this.events[responseId]) {
|
|
125
|
+
this.log.warn('No responseId found in controller, ensure correct controller is used');
|
|
126
|
+
return;
|
|
127
|
+
}
|
|
112
128
|
const type = (['product', 'banner'].includes(result.type) ? result.type : 'product');
|
|
113
129
|
const item = {
|
|
114
130
|
type,
|
|
@@ -133,6 +149,10 @@ export class AutocompleteController extends AbstractController {
|
|
|
133
149
|
return;
|
|
134
150
|
}
|
|
135
151
|
const responseId = result.responseId;
|
|
152
|
+
if (!this.events[responseId]) {
|
|
153
|
+
this.log.warn('No responseId found in controller, ensure correct controller is used');
|
|
154
|
+
return;
|
|
155
|
+
}
|
|
136
156
|
if (result.type === 'banner' && isClickWithinBannerLink(e)) {
|
|
137
157
|
if (this.events?.[responseId]?.product[result.id]?.inlineBannerClickThrough) {
|
|
138
158
|
return;
|
|
@@ -162,7 +182,11 @@ export class AutocompleteController extends AbstractController {
|
|
|
162
182
|
return;
|
|
163
183
|
}
|
|
164
184
|
const responseId = result.responseId;
|
|
165
|
-
if (this.events
|
|
185
|
+
if (!this.events[responseId]) {
|
|
186
|
+
this.log.warn('No responseId found in controller, ensure correct controller is used');
|
|
187
|
+
return;
|
|
188
|
+
}
|
|
189
|
+
else if (this.events?.[responseId]?.product[result.id]?.impression) {
|
|
166
190
|
return;
|
|
167
191
|
}
|
|
168
192
|
const type = (['product', 'banner'].includes(result.type) ? result.type : 'product');
|
|
@@ -192,6 +216,10 @@ export class AutocompleteController extends AbstractController {
|
|
|
192
216
|
return;
|
|
193
217
|
}
|
|
194
218
|
const responseId = result.responseId;
|
|
219
|
+
if (!this.events[responseId]) {
|
|
220
|
+
this.log.warn('No responseId found in controller, ensure correct controller is used');
|
|
221
|
+
return;
|
|
222
|
+
}
|
|
195
223
|
const product = {
|
|
196
224
|
parentId: result.id,
|
|
197
225
|
uid: result.id,
|
|
@@ -471,7 +499,8 @@ export class AutocompleteController extends AbstractController {
|
|
|
471
499
|
const responseId = response.tracking.responseId;
|
|
472
500
|
this.events[responseId] = this.events[responseId] || { product: {}, banner: {} };
|
|
473
501
|
const previousResponseId = this.store.results[0]?.responseId;
|
|
474
|
-
|
|
502
|
+
const repeatedSearch = previousResponseId && previousResponseId === responseId;
|
|
503
|
+
if (repeatedSearch) {
|
|
475
504
|
const impressedResultIds = Object.keys(this.events[responseId].product || {}).filter((resultId) => this.events[responseId].product?.[resultId]?.impression);
|
|
476
505
|
this.events[responseId] = {
|
|
477
506
|
product: impressedResultIds.reduce((acc, resultId) => {
|
|
@@ -507,8 +536,10 @@ export class AutocompleteController extends AbstractController {
|
|
|
507
536
|
this.log.profile(afterSearchProfile);
|
|
508
537
|
// update the store
|
|
509
538
|
this.store.update(response);
|
|
510
|
-
|
|
511
|
-
|
|
539
|
+
if (!repeatedSearch) {
|
|
540
|
+
const data = { responseId };
|
|
541
|
+
this.config.beacon?.enabled && this.tracker.events.autocomplete.render({ data, siteId: this.config.globals?.siteId });
|
|
542
|
+
}
|
|
512
543
|
const afterStoreProfile = this.profiler.create({ type: 'event', name: 'afterStore', context: params }).start();
|
|
513
544
|
try {
|
|
514
545
|
await this.eventManager.fire('afterStore', {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RecommendationController.d.ts","sourceRoot":"","sources":["../../../src/Recommendation/RecommendationController.ts"],"names":[],"mappings":"AAEA,OAAO,EAAa,OAAO,EAAE,MAAM,+BAA+B,CAAC;AACnE,OAAO,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AACpE,OAAO,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAW3C,OAAO,KAAK,EAAE,MAAM,EAAE,mBAAmB,EAAE,MAAM,+BAA+B,CAAC;AACjF,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAC;AACvE,OAAO,KAAK,EAAE,8BAA8B,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAGrG,KAAK,0BAA0B,GAAG;IACjC,OAAO,EAAE;QACR,YAAY,EAAE,CAAC,CAAC,EAAE,UAAU,EAAE,MAAM,EAAE,OAAO,GAAG,MAAM,KAAK,IAAI,CAAC;QAChE,KAAK,EAAE,CAAC,CAAC,EAAE,UAAU,EAAE,MAAM,EAAE,OAAO,GAAG,MAAM,KAAK,IAAI,CAAC;QACzD,UAAU,EAAE,CAAC,MAAM,EAAE,OAAO,GAAG,MAAM,KAAK,IAAI,CAAC;QAC/C,SAAS,EAAE,CAAC,MAAM,EAAE,OAAO,KAAK,IAAI,CAAC;KACrC,CAAC;CACF,CAAC;AAaF,qBAAa,wBAAyB,SAAQ,kBAAkB;IACxD,IAAI,kBAAkC;IACrC,KAAK,EAAE,mBAAmB,CAAC;IAC3B,MAAM,EAAE,8BAA8B,CAAC;IAE/C,OAAO,CAAC,MAAM,CAUP;gBAGN,MAAM,EAAE,8BAA8B,EACtC,EAAE,MAAM,EAAE,KAAK,EAAE,UAAU,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,EAAE,kBAAkB,EAC1F,OAAO,CAAC,EAAE,gBAAgB;IAwC3B,KAAK,EAAE,0BAA0B,
|
|
1
|
+
{"version":3,"file":"RecommendationController.d.ts","sourceRoot":"","sources":["../../../src/Recommendation/RecommendationController.ts"],"names":[],"mappings":"AAEA,OAAO,EAAa,OAAO,EAAE,MAAM,+BAA+B,CAAC;AACnE,OAAO,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AACpE,OAAO,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAW3C,OAAO,KAAK,EAAE,MAAM,EAAE,mBAAmB,EAAE,MAAM,+BAA+B,CAAC;AACjF,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAC;AACvE,OAAO,KAAK,EAAE,8BAA8B,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAGrG,KAAK,0BAA0B,GAAG;IACjC,OAAO,EAAE;QACR,YAAY,EAAE,CAAC,CAAC,EAAE,UAAU,EAAE,MAAM,EAAE,OAAO,GAAG,MAAM,KAAK,IAAI,CAAC;QAChE,KAAK,EAAE,CAAC,CAAC,EAAE,UAAU,EAAE,MAAM,EAAE,OAAO,GAAG,MAAM,KAAK,IAAI,CAAC;QACzD,UAAU,EAAE,CAAC,MAAM,EAAE,OAAO,GAAG,MAAM,KAAK,IAAI,CAAC;QAC/C,SAAS,EAAE,CAAC,MAAM,EAAE,OAAO,KAAK,IAAI,CAAC;KACrC,CAAC;CACF,CAAC;AAaF,qBAAa,wBAAyB,SAAQ,kBAAkB;IACxD,IAAI,kBAAkC;IACrC,KAAK,EAAE,mBAAmB,CAAC;IAC3B,MAAM,EAAE,8BAA8B,CAAC;IAE/C,OAAO,CAAC,MAAM,CAUP;gBAGN,MAAM,EAAE,8BAA8B,EACtC,EAAE,MAAM,EAAE,KAAK,EAAE,UAAU,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,EAAE,kBAAkB,EAC1F,OAAO,CAAC,EAAE,gBAAgB;IAwC3B,KAAK,EAAE,0BAA0B,CA0I/B;IAEF,IAAI,MAAM,IAAI,qBAAqB,CA4BlC;IAED,MAAM,QAAa,QAAQ,IAAI,CAAC,CAgI9B;IAEF,SAAS,cAAqB,OAAO,EAAE,GAAG,OAAO,KAAG,QAAQ,IAAI,CAAC,CAY/D;CACF"}
|
|
@@ -26,6 +26,10 @@ export class RecommendationController extends AbstractController {
|
|
|
26
26
|
return;
|
|
27
27
|
}
|
|
28
28
|
const responseId = result.responseId;
|
|
29
|
+
if (!this.events[responseId]) {
|
|
30
|
+
this.log.warn('No responseId found in controller, ensure correct controller is used');
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
29
33
|
if (this.events[responseId]?.product[result.id]?.productClickThrough)
|
|
30
34
|
return;
|
|
31
35
|
const type = (['product', 'banner'].includes(result.type) ? result.type : 'product');
|
|
@@ -55,6 +59,10 @@ export class RecommendationController extends AbstractController {
|
|
|
55
59
|
return;
|
|
56
60
|
}
|
|
57
61
|
const responseId = result.responseId;
|
|
62
|
+
if (!this.events[responseId]) {
|
|
63
|
+
this.log.warn('No responseId found in controller, ensure correct controller is used');
|
|
64
|
+
return;
|
|
65
|
+
}
|
|
58
66
|
if (result.type === 'banner') {
|
|
59
67
|
if (this.events[responseId]?.product[result.id]?.inlineBannerClickThrough) {
|
|
60
68
|
return;
|
|
@@ -84,7 +92,11 @@ export class RecommendationController extends AbstractController {
|
|
|
84
92
|
return;
|
|
85
93
|
}
|
|
86
94
|
const responseId = result.responseId;
|
|
87
|
-
if (this.events[responseId]
|
|
95
|
+
if (!this.events[responseId]) {
|
|
96
|
+
this.log.warn('No responseId found in controller, ensure correct controller is used');
|
|
97
|
+
return;
|
|
98
|
+
}
|
|
99
|
+
else if (this.events[responseId]?.product[result.id]?.impression) {
|
|
88
100
|
return;
|
|
89
101
|
}
|
|
90
102
|
const type = (['product', 'banner'].includes(result.type) ? result.type : 'product');
|
|
@@ -115,6 +127,10 @@ export class RecommendationController extends AbstractController {
|
|
|
115
127
|
return;
|
|
116
128
|
}
|
|
117
129
|
const responseId = result.responseId;
|
|
130
|
+
if (!this.events[responseId]) {
|
|
131
|
+
this.log.warn('No responseId found in controller, ensure correct controller is used');
|
|
132
|
+
return;
|
|
133
|
+
}
|
|
118
134
|
const product = {
|
|
119
135
|
parentId: result.id,
|
|
120
136
|
uid: result.id,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SearchController.d.ts","sourceRoot":"","sources":["../../../src/Search/SearchController.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AACpE,OAAO,EAAE,YAAY,EAAa,0BAA0B,EAAE,MAAM,+BAA+B,CAAC;AAEpG,OAAO,EAAE,eAAe,EAAuB,MAAM,UAAU,CAAC;AAEhE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,WAAW,EAAc,MAAM,+BAA+B,CAAC;AAC9F,OAAO,KAAK,EACX,sBAAsB,EAGtB,kBAAkB,EAClB,gBAAgB,EAIhB,MAAM,UAAU,CAAC;AAElB,OAAO,EACN,KAAK,kBAAkB,EAYvB,MAAM,2BAA2B,CAAC;AAyCnC,KAAK,kBAAkB,GAAG;IACzB,MAAM,EAAE;QACP,KAAK,EAAE,CAAC,CAAC,EAAE,UAAU,EAAE,mBAAmB,EAAE,0BAA0B,KAAK,IAAI,CAAC;QAChF,YAAY,EAAE,CAAC,CAAC,EAAE,UAAU,EAAE,mBAAmB,EAAE,0BAA0B,KAAK,IAAI,CAAC;QACvF,UAAU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Y,CAAC;IACtB,OAAO,CAAC,eAAe,CAAwC;IAC/D,OAAO,CAAC,IAAI,CAEV;IACF,OAAO,CAAC,MAAM,CAgBP;gBAGN,MAAM,EAAE,sBAAsB,EAC9B,EAAE,MAAM,EAAE,KAAK,EAAE,UAAU,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,EAAE,kBAAkB,EAC1F,OAAO,CAAC,EAAE,gBAAgB;IAiP3B,KAAK,EAAE,kBAAkB,CA4PvB;IAEF,IAAI,MAAM,IAAI,kBAAkB,CA8C/B;IAED,MAAM,QAAa,QAAQ,IAAI,CAAC,CA6N9B;IAEF,SAAS,cAAqB,OAAO,EAAE,GAAG,OAAO,KAAG,QAAQ,IAAI,CAAC,CAY/D;CACF;AAED,wBAAgB,wBAAwB,CAAC,OAAO,EAAE,kBAAkB,GAAG,kBAAkB,CAiBxF;AAED,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,WAAW,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,SAAI,GAAG,MAAM,GAAG,SAAS,CAuCvG"}
|
|
@@ -43,7 +43,11 @@ export class SearchController extends AbstractController {
|
|
|
43
43
|
this.log.warn('No banner provided to track.banner.impression');
|
|
44
44
|
return;
|
|
45
45
|
}
|
|
46
|
-
if (this.events[responseId]
|
|
46
|
+
if (!this.events[responseId]) {
|
|
47
|
+
this.log.warn('No responseId found in controller, ensure correct controller is used');
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
else if (this.events[responseId]?.banner[uid]?.impression) {
|
|
47
51
|
return;
|
|
48
52
|
}
|
|
49
53
|
const banner = { uid };
|
|
@@ -63,6 +67,10 @@ export class SearchController extends AbstractController {
|
|
|
63
67
|
return;
|
|
64
68
|
}
|
|
65
69
|
const { responseId, uid } = banner;
|
|
70
|
+
if (!this.events[responseId]) {
|
|
71
|
+
this.log.warn('No responseId found in controller, ensure correct controller is used');
|
|
72
|
+
return;
|
|
73
|
+
}
|
|
66
74
|
if (isClickWithinBannerLink(e)) {
|
|
67
75
|
if (this.events?.[responseId]?.banner[uid]?.clickThrough) {
|
|
68
76
|
return;
|
|
@@ -80,6 +88,10 @@ export class SearchController extends AbstractController {
|
|
|
80
88
|
this.log.warn('No banner provided to track.banner.clickThrough');
|
|
81
89
|
return;
|
|
82
90
|
}
|
|
91
|
+
if (!this.events[responseId]) {
|
|
92
|
+
this.log.warn('No responseId found in controller, ensure correct controller is used');
|
|
93
|
+
return;
|
|
94
|
+
}
|
|
83
95
|
const banner = { uid };
|
|
84
96
|
const data = {
|
|
85
97
|
responseId,
|
|
@@ -101,6 +113,10 @@ export class SearchController extends AbstractController {
|
|
|
101
113
|
return;
|
|
102
114
|
}
|
|
103
115
|
const responseId = result.responseId;
|
|
116
|
+
if (!this.events[responseId]) {
|
|
117
|
+
this.log.warn('No responseId found in controller, ensure correct controller is used');
|
|
118
|
+
return;
|
|
119
|
+
}
|
|
104
120
|
const target = e.target;
|
|
105
121
|
const resultHref = result.display?.mappings.core?.url || result.mappings.core?.url || '';
|
|
106
122
|
const elemHref = target?.getAttribute('href');
|
|
@@ -151,6 +167,10 @@ export class SearchController extends AbstractController {
|
|
|
151
167
|
return;
|
|
152
168
|
}
|
|
153
169
|
const responseId = result.responseId;
|
|
170
|
+
if (!this.events[responseId]) {
|
|
171
|
+
this.log.warn('No responseId found in controller, ensure correct controller is used');
|
|
172
|
+
return;
|
|
173
|
+
}
|
|
154
174
|
if (result.type === 'banner' && isClickWithinBannerLink(e)) {
|
|
155
175
|
if (this.events?.[responseId]?.product[result.id]?.inlineBannerClickThrough) {
|
|
156
176
|
return;
|
|
@@ -180,7 +200,11 @@ export class SearchController extends AbstractController {
|
|
|
180
200
|
return;
|
|
181
201
|
}
|
|
182
202
|
const responseId = result.responseId;
|
|
183
|
-
if (this.events[responseId]
|
|
203
|
+
if (!this.events[responseId]) {
|
|
204
|
+
this.log.warn('No responseId found in controller, ensure correct controller is used');
|
|
205
|
+
return;
|
|
206
|
+
}
|
|
207
|
+
else if (this.events[responseId]?.product[result.id]?.impression) {
|
|
184
208
|
return;
|
|
185
209
|
}
|
|
186
210
|
const type = (['product', 'banner'].includes(result.type) ? result.type : 'product');
|
|
@@ -210,6 +234,10 @@ export class SearchController extends AbstractController {
|
|
|
210
234
|
return;
|
|
211
235
|
}
|
|
212
236
|
const responseId = result.responseId;
|
|
237
|
+
if (!this.events[responseId]) {
|
|
238
|
+
this.log.warn('No responseId found in controller, ensure correct controller is used');
|
|
239
|
+
return;
|
|
240
|
+
}
|
|
213
241
|
const product = {
|
|
214
242
|
parentId: result.id,
|
|
215
243
|
uid: result.id,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Product } from '@searchspring/snap-store-mobx';
|
|
2
|
-
export declare const CLICK_DUPLICATION_TIMEOUT =
|
|
2
|
+
export declare const CLICK_DUPLICATION_TIMEOUT = 1000;
|
|
3
3
|
export declare const CLICK_THROUGH_CLOSEST_MAX_LEVELS = 12;
|
|
4
4
|
export declare const isClickWithinProductLink: (e: MouseEvent, result: Product) => boolean;
|
|
5
5
|
//# sourceMappingURL=isClickWithinProductLink.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"isClickWithinProductLink.d.ts","sourceRoot":"","sources":["../../../src/utils/isClickWithinProductLink.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,+BAA+B,CAAC;AAE7D,eAAO,MAAM,yBAAyB,
|
|
1
|
+
{"version":3,"file":"isClickWithinProductLink.d.ts","sourceRoot":"","sources":["../../../src/utils/isClickWithinProductLink.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,+BAA+B,CAAC;AAE7D,eAAO,MAAM,yBAAyB,OAAO,CAAC;AAC9C,eAAO,MAAM,gCAAgC,KAAK,CAAC;AAEnD,eAAO,MAAM,wBAAwB,MAAO,UAAU,UAAU,OAAO,KAAG,OAoBzE,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export const CLICK_DUPLICATION_TIMEOUT =
|
|
1
|
+
export const CLICK_DUPLICATION_TIMEOUT = 1000;
|
|
2
2
|
export const CLICK_THROUGH_CLOSEST_MAX_LEVELS = 12;
|
|
3
3
|
export const isClickWithinProductLink = (e, result) => {
|
|
4
4
|
const resultDisplayUrl = result?.display?.mappings.core?.url || '';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@searchspring/snap-controller",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.75.0",
|
|
4
4
|
"description": "Snap Controllers",
|
|
5
5
|
"main": "dist/cjs/index.js",
|
|
6
6
|
"module": "dist/esm/index.js",
|
|
@@ -20,22 +20,22 @@
|
|
|
20
20
|
"test:watch": "jest --watch"
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@searchspring/snap-toolbox": "0.
|
|
23
|
+
"@searchspring/snap-toolbox": "0.75.0",
|
|
24
24
|
"css.escape": "1.5.1",
|
|
25
25
|
"deepmerge": "4.3.1"
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|
|
28
|
-
"@searchspring/snap-client": "0.
|
|
29
|
-
"@searchspring/snap-event-manager": "0.
|
|
30
|
-
"@searchspring/snap-logger": "0.
|
|
31
|
-
"@searchspring/snap-profiler": "0.
|
|
32
|
-
"@searchspring/snap-store-mobx": "0.
|
|
33
|
-
"@searchspring/snap-tracker": "0.
|
|
34
|
-
"@searchspring/snap-url-manager": "0.
|
|
28
|
+
"@searchspring/snap-client": "0.75.0",
|
|
29
|
+
"@searchspring/snap-event-manager": "0.75.0",
|
|
30
|
+
"@searchspring/snap-logger": "0.75.0",
|
|
31
|
+
"@searchspring/snap-profiler": "0.75.0",
|
|
32
|
+
"@searchspring/snap-store-mobx": "0.75.0",
|
|
33
|
+
"@searchspring/snap-tracker": "0.75.0",
|
|
34
|
+
"@searchspring/snap-url-manager": "0.75.0"
|
|
35
35
|
},
|
|
36
36
|
"sideEffects": false,
|
|
37
37
|
"files": [
|
|
38
38
|
"dist/**/*"
|
|
39
39
|
],
|
|
40
|
-
"gitHead": "
|
|
40
|
+
"gitHead": "262c02e06e2bc4637e8e4eb9e48990cc3a9d3c18"
|
|
41
41
|
}
|