@searchspring/snap-controller 0.66.0 → 0.66.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/Autocomplete/AutocompleteController.d.ts.map +1 -1
- package/dist/cjs/Autocomplete/AutocompleteController.js +4 -5
- package/dist/cjs/Recommendation/RecommendationController.js +3 -3
- package/dist/cjs/Search/SearchController.d.ts.map +1 -1
- package/dist/cjs/Search/SearchController.js +6 -16
- package/dist/cjs/utils/isClickWithinProductLink.d.ts.map +1 -1
- package/dist/cjs/utils/isClickWithinProductLink.js +3 -2
- package/dist/esm/Autocomplete/AutocompleteController.d.ts.map +1 -1
- package/dist/esm/Autocomplete/AutocompleteController.js +2 -3
- package/dist/esm/Recommendation/RecommendationController.js +1 -1
- package/dist/esm/Search/SearchController.d.ts.map +1 -1
- package/dist/esm/Search/SearchController.js +4 -13
- package/dist/esm/utils/isClickWithinProductLink.d.ts.map +1 -1
- package/dist/esm/utils/isClickWithinProductLink.js +3 -2
- 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,MAAM,+BAA+B,CAAC;AACzF,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,EAAiC,kBAAkB,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAElI,OAAO,KAAK,EAAE,wBAAwB,EAAgE,MAAM,2BAA2B,CAAC;AAcxI,eAAO,MAAM,WAAW,MAAM,CAAC;AA+B/B,KAAK,wBAAwB,GAAG;IAC/B,OAAO,EAAE;QACR,YAAY,EAAE,CAAC,CAAC,EAAE,UAAU,EAAE,MAAM,EAAE,OAAO,KAAK,IAAI,CAAC;QACvD,KAAK,EAAE,CAAC,CAAC,EAAE,UAAU,EAAE,MAAM,EAAE,OAAO,GAAG,MAAM,KAAK,IAAI,CAAC;QACzD,MAAM,EAAE,CAAC,MAAM,EAAE,OAAO,KAAK,IAAI,CAAC;QAClC,UAAU,EAAE,CAAC,MAAM,EAAE,OAAO,KAAK,IAAI,CAAC;QACtC,SAAS,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,IAAI,CAAC;KACtC,CAAC;IACF,QAAQ,EAAE,CAAC,WAAW,EAAE,MAAM,KAAK,IAAI,CAAC;CACxC,CAAC;AAEF,qBAAa,sBAAuB,SAAQ,kBAAkB;IACtD,IAAI,kBAAgC;IACnC,KAAK,EAAE,iBAAiB,CAAC;IACzB,MAAM,EAAE,4BAA4B,CAAC;IACtC,OAAO,EAAE,YAAY,CAAC;IAE7B,MAAM,EAAE;QACP,OAAO,EAAE,MAAM,CACd,MAAM,EACN;YACC,KAAK,CAAC,EAAE,OAAO,CAAC;YAChB,YAAY,CAAC,EAAE,OAAO,CAAC;YACvB,UAAU,CAAC,EAAE,OAAO,CAAC;YACrB,MAAM,CAAC,EAAE,OAAO,CAAC;SACjB,CACD,CAAC;KACF,CAEC;gBAGD,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;
|
|
1
|
+
{"version":3,"file":"AutocompleteController.d.ts","sourceRoot":"","sources":["../../../src/Autocomplete/AutocompleteController.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,YAAY,EAAa,OAAO,EAAE,MAAM,EAAE,MAAM,+BAA+B,CAAC;AACzF,OAAO,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AAEpE,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AY,EAAE,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,EAAE,kBAAkB,EAC1F,OAAO,CAAC,EAAE,gBAAgB;IA0E3B,KAAK,EAAE,wBAAwB,CA0D7B;IAEF,IAAI,MAAM,IAAI,wBAAwB,CAwCrC;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;wBAkDpD,aAAa,KAAG,IAAI;uBAMrB,UAAU,KAAG,IAAI;4BAQN,MAAM,SAAS,CAAC,gBAAgB,CAAC,KAAG,QAAQ,IAAI,CAAC;mCAgDhD,MAAM,WAAW,CAAC,gBAAgB,CAAC,KAAG,IAAI;uBAqBtD,KAAK;;;;uBAyDL,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,CA2I9B;IAEF,SAAS,cAAqB,OAAO,EAAE,GAAG,OAAO,KAAG,QAAQ,IAAI,CAAC,CAQ/D;CACF"}
|
|
@@ -150,11 +150,11 @@ var AutocompleteController = /** @class */ (function (_super) {
|
|
|
150
150
|
_this.eventManager.fire('track.product.render', { controller: _this, product: result, trackEvent: data });
|
|
151
151
|
},
|
|
152
152
|
impression: function (result) {
|
|
153
|
-
var _a, _b;
|
|
154
|
-
if ((_a = _this.events.product[result.id]) === null || _a === void 0 ? void 0 : _a.impression)
|
|
153
|
+
var _a, _b, _c;
|
|
154
|
+
if (((_a = _this.events.product[result.id]) === null || _a === void 0 ? void 0 : _a.impression) || !((_b = _this.events.product[result.id]) === null || _b === void 0 ? void 0 : _b.render))
|
|
155
155
|
return;
|
|
156
156
|
var data = getAutocompleteSchemaData({ params: _this.params, store: _this.store, results: [result] });
|
|
157
|
-
_this.tracker.events.autocomplete.impression({ data: data, siteId: (
|
|
157
|
+
_this.tracker.events.autocomplete.impression({ data: data, siteId: (_c = _this.config.globals) === null || _c === void 0 ? void 0 : _c.siteId });
|
|
158
158
|
_this.events.product[result.id] = _this.events.product[result.id] || {};
|
|
159
159
|
_this.events.product[result.id].impression = true;
|
|
160
160
|
_this.eventManager.fire('track.product.impression', { controller: _this, product: result, trackEvent: data });
|
|
@@ -479,6 +479,7 @@ var AutocompleteController = /** @class */ (function (_super) {
|
|
|
479
479
|
return [3 /*break*/, 6];
|
|
480
480
|
case 6:
|
|
481
481
|
searchProfile = this.profiler.create({ type: 'event', name: 'search', context: params }).start();
|
|
482
|
+
this.events = { product: {} };
|
|
482
483
|
return [4 /*yield*/, this.client.autocomplete(params)];
|
|
483
484
|
case 7:
|
|
484
485
|
_a = _d.sent(), meta = _a[0], response = _a[1];
|
|
@@ -644,8 +645,6 @@ var AutocompleteController = /** @class */ (function (_super) {
|
|
|
644
645
|
_this.events.product[result.id].render = true;
|
|
645
646
|
_this.eventManager.fire('track.product.render', { controller: _this, product: result, trackEvent: data_1 });
|
|
646
647
|
});
|
|
647
|
-
// reset events for new search. It's here for a reason. Ensures render happens before impressions on new input value?
|
|
648
|
-
this.events = { product: {} };
|
|
649
648
|
}
|
|
650
649
|
return [2 /*return*/];
|
|
651
650
|
}
|
|
@@ -116,11 +116,11 @@ var RecommendationController = /** @class */ (function (_super) {
|
|
|
116
116
|
}, isClickWithinProductLink_1.CLICK_DUPLICATION_TIMEOUT);
|
|
117
117
|
},
|
|
118
118
|
impression: function (result) {
|
|
119
|
-
var _a, _b;
|
|
120
|
-
if ((_a = _this.events.product[result.id]) === null || _a === void 0 ? void 0 : _a.impression)
|
|
119
|
+
var _a, _b, _c;
|
|
120
|
+
if (((_a = _this.events.product[result.id]) === null || _a === void 0 ? void 0 : _a.impression) || !((_b = _this.events.product[result.id]) === null || _b === void 0 ? void 0 : _b.render))
|
|
121
121
|
return;
|
|
122
122
|
var data = getRecommendationsSchemaData({ store: _this.store, results: [result] });
|
|
123
|
-
_this.tracker.events.recommendations.impression({ data: data, siteId: (
|
|
123
|
+
_this.tracker.events.recommendations.impression({ data: data, siteId: (_c = _this.config.globals) === null || _c === void 0 ? void 0 : _c.siteId });
|
|
124
124
|
_this.events.product[result.id] = _this.events.product[result.id] || {};
|
|
125
125
|
_this.events.product[result.id].impression = true;
|
|
126
126
|
_this.eventManager.fire('track.product.impression', { controller: _this, product: result, trackEvent: data });
|
|
@@ -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,MAAM,+BAA+B,CAAC;AAExE,OAAO,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAE3C,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,+BAA+B,CAAC;AAClF,OAAO,KAAK,EACX,sBAAsB,EAGtB,kBAAkB,EAClB,gBAAgB,EAIhB,MAAM,UAAU,CAAC;AAElB,OAAO,KAAK,EACX,kBAAkB,EAQlB,MAAM,2BAA2B,CAAC;
|
|
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,MAAM,+BAA+B,CAAC;AAExE,OAAO,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAE3C,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,+BAA+B,CAAC;AAClF,OAAO,KAAK,EACX,sBAAsB,EAGtB,kBAAkB,EAClB,gBAAgB,EAIhB,MAAM,UAAU,CAAC;AAElB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AkB,CAiBxF;AAED,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,WAAW,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,SAAI,GAAG,MAAM,GAAG,SAAS,CAgCvG"}
|
|
@@ -177,12 +177,12 @@ var SearchController = /** @class */ (function (_super) {
|
|
|
177
177
|
_this.eventManager.fire('track.product.render', { controller: _this, product: result, trackEvent: data });
|
|
178
178
|
},
|
|
179
179
|
impression: function (result) {
|
|
180
|
-
var _a, _b;
|
|
181
|
-
if ((_a = _this.events.product[result.id]) === null || _a === void 0 ? void 0 : _a.impression) {
|
|
180
|
+
var _a, _b, _c;
|
|
181
|
+
if (((_a = _this.events.product[result.id]) === null || _a === void 0 ? void 0 : _a.impression) || !((_b = _this.events.product[result.id]) === null || _b === void 0 ? void 0 : _b.render)) {
|
|
182
182
|
return;
|
|
183
183
|
}
|
|
184
184
|
var data = schemaMap[result.id];
|
|
185
|
-
_this.tracker.events[_this.pageType].impression({ data: data, siteId: (
|
|
185
|
+
_this.tracker.events[_this.pageType].impression({ data: data, siteId: (_c = _this.config.globals) === null || _c === void 0 ? void 0 : _c.siteId });
|
|
186
186
|
_this.events.product[result.id] = _this.events.product[result.id] || {};
|
|
187
187
|
_this.events.product[result.id].impression = true;
|
|
188
188
|
_this.eventManager.fire('track.product.impression', { controller: _this, product: result, trackEvent: data });
|
|
@@ -569,7 +569,7 @@ var SearchController = /** @class */ (function (_super) {
|
|
|
569
569
|
if (controller.store.loaded && !controller.store.error) {
|
|
570
570
|
products = controller.store.results.filter(function (result) { var _a; return result.type === 'product' && !((_a = _this.events.product[result.id]) === null || _a === void 0 ? void 0 : _a.render); });
|
|
571
571
|
if (products.length === 0) {
|
|
572
|
-
data = getSearchSchemaData({ params: search.request,
|
|
572
|
+
data = getSearchSchemaData({ params: search.request, response: search.response });
|
|
573
573
|
this.tracker.events[this.pageType].render({ data: data, siteId: (_a = this.config.globals) === null || _a === void 0 ? void 0 : _a.siteId });
|
|
574
574
|
}
|
|
575
575
|
products.forEach(function (result) {
|
|
@@ -750,7 +750,6 @@ function createResultSchemaMapping(_a) {
|
|
|
750
750
|
var _ = response[0], searchResponse = response[1];
|
|
751
751
|
var schema = getSearchSchemaData({
|
|
752
752
|
params: request,
|
|
753
|
-
results: [], // results added below because this would contain all results
|
|
754
753
|
response: searchResponse,
|
|
755
754
|
});
|
|
756
755
|
(_b = searchResponse.results) === null || _b === void 0 ? void 0 : _b.forEach(function (result) {
|
|
@@ -830,7 +829,7 @@ function getSearchAddtocartSchemaData(_a) {
|
|
|
830
829
|
}
|
|
831
830
|
function getSearchSchemaData(_a) {
|
|
832
831
|
var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
|
|
833
|
-
var params = _a.params,
|
|
832
|
+
var params = _a.params, response = _a.response;
|
|
834
833
|
var filters = (_b = params.filters) === null || _b === void 0 ? void 0 : _b.reduce(function (acc, filter) {
|
|
835
834
|
var _a;
|
|
836
835
|
var _b, _c, _d, _e;
|
|
@@ -881,14 +880,5 @@ function getSearchSchemaData(_a) {
|
|
|
881
880
|
};
|
|
882
881
|
})) ||
|
|
883
882
|
undefined,
|
|
884
|
-
}, results:
|
|
885
|
-
var _a;
|
|
886
|
-
var core = (_a = result.mappings) === null || _a === void 0 ? void 0 : _a.core;
|
|
887
|
-
var position = result.position;
|
|
888
|
-
return {
|
|
889
|
-
position: position,
|
|
890
|
-
uid: core.uid || '',
|
|
891
|
-
sku: core.sku,
|
|
892
|
-
};
|
|
893
|
-
})) || [] });
|
|
883
|
+
}, results: [] });
|
|
894
884
|
}
|
|
@@ -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,MAAM,CAAC;AAC7C,eAAO,MAAM,gCAAgC,KAAK,CAAC;AAEnD,eAAO,MAAM,wBAAwB,MAAO,UAAU,UAAU,OAAO,KAAG,
|
|
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,MAAM,CAAC;AAC7C,eAAO,MAAM,gCAAgC,KAAK,CAAC;AAEnD,eAAO,MAAM,wBAAwB,MAAO,UAAU,UAAU,OAAO,KAAG,OAgBzE,CAAC"}
|
|
@@ -8,10 +8,11 @@ var isClickWithinProductLink = function (e, result) {
|
|
|
8
8
|
var currentElement = e.target;
|
|
9
9
|
var href = null;
|
|
10
10
|
var level = 0;
|
|
11
|
-
var
|
|
11
|
+
var resultCoreUrl = ((_b = (_a = result === null || result === void 0 ? void 0 : result.display) === null || _a === void 0 ? void 0 : _a.mappings.core) === null || _b === void 0 ? void 0 : _b.url) || '';
|
|
12
|
+
var resultDisplayUrl = ((_c = result === null || result === void 0 ? void 0 : result.mappings.core) === null || _c === void 0 ? void 0 : _c.url) || '';
|
|
12
13
|
while (currentElement && level < exports.CLICK_THROUGH_CLOSEST_MAX_LEVELS) {
|
|
13
14
|
href = currentElement.getAttribute('href');
|
|
14
|
-
if (href &&
|
|
15
|
+
if (href && ((resultCoreUrl && href.includes(resultCoreUrl)) || (resultDisplayUrl && href.includes(resultDisplayUrl)))) {
|
|
15
16
|
return true;
|
|
16
17
|
}
|
|
17
18
|
currentElement = currentElement.parentElement;
|
|
@@ -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,MAAM,+BAA+B,CAAC;AACzF,OAAO,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AAE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,OAAO,EAAE,YAAY,CAAC;IAE7B,MAAM,EAAE;QACP,OAAO,EAAE,MAAM,CACd,MAAM,EACN;YACC,KAAK,CAAC,EAAE,OAAO,CAAC;YAChB,YAAY,CAAC,EAAE,OAAO,CAAC;YACvB,UAAU,CAAC,EAAE,OAAO,CAAC;YACrB,MAAM,CAAC,EAAE,OAAO,CAAC;SACjB,CACD,CAAC;KACF,CAEC;gBAGD,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;IA0E3B,KAAK,EAAE,wBAAwB,CA0D7B;IAEF,IAAI,MAAM,IAAI,wBAAwB,CAwCrC;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;wBAkDpD,aAAa,KAAG,IAAI;uBAMrB,UAAU,KAAG,IAAI;4BAQN,MAAM,SAAS,CAAC,gBAAgB,CAAC,KAAG,QAAQ,IAAI,CAAC;mCAgDhD,MAAM,WAAW,CAAC,gBAAgB,CAAC,KAAG,IAAI;uBAqBtD,KAAK;;;;uBAyDL,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,CA2I9B;IAEF,SAAS,cAAqB,OAAO,EAAE,GAAG,OAAO,KAAG,QAAQ,IAAI,CAAC,CAQ/D;CACF"}
|
|
@@ -77,7 +77,7 @@ export class AutocompleteController extends AbstractController {
|
|
|
77
77
|
this.eventManager.fire('track.product.render', { controller: this, product: result, trackEvent: data });
|
|
78
78
|
},
|
|
79
79
|
impression: (result) => {
|
|
80
|
-
if (this.events.product[result.id]?.impression)
|
|
80
|
+
if (this.events.product[result.id]?.impression || !this.events.product[result.id]?.render)
|
|
81
81
|
return;
|
|
82
82
|
const data = getAutocompleteSchemaData({ params: this.params, store: this.store, results: [result] });
|
|
83
83
|
this.tracker.events.autocomplete.impression({ data, siteId: this.config.globals?.siteId });
|
|
@@ -336,6 +336,7 @@ export class AutocompleteController extends AbstractController {
|
|
|
336
336
|
}
|
|
337
337
|
}
|
|
338
338
|
const searchProfile = this.profiler.create({ type: 'event', name: 'search', context: params }).start();
|
|
339
|
+
this.events = { product: {} };
|
|
339
340
|
const [meta, response] = await this.client.autocomplete(params);
|
|
340
341
|
// @ts-ignore : MockClient will overwrite the client search() method and use SearchData to return mock data which already contains meta data
|
|
341
342
|
if (!response.meta) {
|
|
@@ -471,8 +472,6 @@ export class AutocompleteController extends AbstractController {
|
|
|
471
472
|
this.events.product[result.id].render = true;
|
|
472
473
|
this.eventManager.fire('track.product.render', { controller: this, product: result, trackEvent: data });
|
|
473
474
|
});
|
|
474
|
-
// reset events for new search. It's here for a reason. Ensures render happens before impressions on new input value?
|
|
475
|
-
this.events = { product: {} };
|
|
476
475
|
}
|
|
477
476
|
});
|
|
478
477
|
// add 'afterSearch' middleware
|
|
@@ -43,7 +43,7 @@ export class RecommendationController extends AbstractController {
|
|
|
43
43
|
}, CLICK_DUPLICATION_TIMEOUT);
|
|
44
44
|
},
|
|
45
45
|
impression: (result) => {
|
|
46
|
-
if (this.events.product[result.id]?.impression)
|
|
46
|
+
if (this.events.product[result.id]?.impression || !this.events.product[result.id]?.render)
|
|
47
47
|
return;
|
|
48
48
|
const data = getRecommendationsSchemaData({ store: this.store, results: [result] });
|
|
49
49
|
this.tracker.events.recommendations.impression({ data, siteId: this.config.globals?.siteId });
|
|
@@ -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,MAAM,+BAA+B,CAAC;AAExE,OAAO,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAE3C,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,+BAA+B,CAAC;AAClF,OAAO,KAAK,EACX,sBAAsB,EAGtB,kBAAkB,EAClB,gBAAgB,EAIhB,MAAM,UAAU,CAAC;AAElB,OAAO,KAAK,EACX,kBAAkB,EAQlB,MAAM,2BAA2B,CAAC;
|
|
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,MAAM,+BAA+B,CAAC;AAExE,OAAO,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAE3C,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,+BAA+B,CAAC;AAClF,OAAO,KAAK,EACX,sBAAsB,EAGtB,kBAAkB,EAClB,gBAAgB,EAIhB,MAAM,UAAU,CAAC;AAElB,OAAO,KAAK,EACX,kBAAkB,EAQlB,MAAM,2BAA2B,CAAC;AAiCnC,KAAK,kBAAkB,GAAG;IACzB,OAAO,EAAE;QACR,YAAY,EAAE,CAAC,CAAC,EAAE,UAAU,EAAE,MAAM,EAAE,OAAO,KAAK,IAAI,CAAC;QACvD,KAAK,EAAE,CAAC,CAAC,EAAE,UAAU,EAAE,MAAM,EAAE,OAAO,GAAG,MAAM,KAAK,IAAI,CAAC;QACzD,MAAM,EAAE,CAAC,MAAM,EAAE,OAAO,KAAK,IAAI,CAAC;QAClC,UAAU,EAAE,CAAC,MAAM,EAAE,OAAO,KAAK,IAAI,CAAC;QACtC,SAAS,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,IAAI,CAAC;KACtC,CAAC;IACF,QAAQ,EAAE,CAAC,WAAW,EAAE,MAAM,KAAK,IAAI,CAAC;CACxC,CAAC;AAGF,qBAAa,gBAAiB,SAAQ,kBAAkB;IAChD,IAAI,kBAA0B;IAC7B,KAAK,EAAE,WAAW,CAAC;IACnB,MAAM,EAAE,sBAAsB,CAAC;IACvC,OAAO,EAAE,YAAY,CAAC;IACtB,OAAO,CAAC,eAAe,CAAwC;IAC/D,OAAO,CAAC,QAAQ,CAAmC;IACnD,OAAO,CAAC,MAAM,CAUM;gBAGnB,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;IAuN3B,KAAK,EAAE,kBAAkB,CA+FvB;IAEF,IAAI,MAAM,IAAI,kBAAkB,CA8C/B;IAED,MAAM,QAAa,QAAQ,IAAI,CAAC,CAyN9B;IAEF,SAAS,cAAqB,OAAO,EAAE,GAAG,OAAO,KAAG,QAAQ,IAAI,CAAC,CAQ/D;CACF;AAuBD,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,CAgCvG"}
|
|
@@ -94,7 +94,7 @@ export class SearchController extends AbstractController {
|
|
|
94
94
|
this.eventManager.fire('track.product.render', { controller: this, product: result, trackEvent: data });
|
|
95
95
|
},
|
|
96
96
|
impression: (result) => {
|
|
97
|
-
if (this.events.product[result.id]?.impression) {
|
|
97
|
+
if (this.events.product[result.id]?.impression || !this.events.product[result.id]?.render) {
|
|
98
98
|
return;
|
|
99
99
|
}
|
|
100
100
|
const data = schemaMap[result.id];
|
|
@@ -408,7 +408,7 @@ export class SearchController extends AbstractController {
|
|
|
408
408
|
const products = controller.store.results.filter((result) => result.type === 'product' && !this.events.product[result.id]?.render);
|
|
409
409
|
if (products.length === 0) {
|
|
410
410
|
// handle no results
|
|
411
|
-
const data = getSearchSchemaData({ params: search.request,
|
|
411
|
+
const data = getSearchSchemaData({ params: search.request, response: search.response });
|
|
412
412
|
this.tracker.events[this.pageType].render({ data, siteId: this.config.globals?.siteId });
|
|
413
413
|
}
|
|
414
414
|
products.forEach((result) => {
|
|
@@ -546,7 +546,6 @@ function createResultSchemaMapping({ request, response }) {
|
|
|
546
546
|
const [_, searchResponse] = response;
|
|
547
547
|
const schema = getSearchSchemaData({
|
|
548
548
|
params: request,
|
|
549
|
-
results: [], // results added below because this would contain all results
|
|
550
549
|
response: searchResponse,
|
|
551
550
|
});
|
|
552
551
|
searchResponse.results?.forEach((result) => {
|
|
@@ -623,7 +622,7 @@ function getSearchAddtocartSchemaData({ searchSchemaData, results, }) {
|
|
|
623
622
|
}) || [],
|
|
624
623
|
};
|
|
625
624
|
}
|
|
626
|
-
function getSearchSchemaData({ params,
|
|
625
|
+
function getSearchSchemaData({ params, response }) {
|
|
627
626
|
const filters = params.filters?.reduce((acc, filter) => {
|
|
628
627
|
const key = filter.background ? 'bgfilter' : 'filter';
|
|
629
628
|
acc[key] = acc[key] || [];
|
|
@@ -680,14 +679,6 @@ function getSearchSchemaData({ params, results, response, }) {
|
|
|
680
679
|
})) ||
|
|
681
680
|
undefined,
|
|
682
681
|
},
|
|
683
|
-
results:
|
|
684
|
-
const core = result.mappings?.core;
|
|
685
|
-
const position = result.position;
|
|
686
|
-
return {
|
|
687
|
-
position,
|
|
688
|
-
uid: core.uid || '',
|
|
689
|
-
sku: core.sku,
|
|
690
|
-
};
|
|
691
|
-
}) || [],
|
|
682
|
+
results: [],
|
|
692
683
|
};
|
|
693
684
|
}
|
|
@@ -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,MAAM,CAAC;AAC7C,eAAO,MAAM,gCAAgC,KAAK,CAAC;AAEnD,eAAO,MAAM,wBAAwB,MAAO,UAAU,UAAU,OAAO,KAAG,
|
|
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,MAAM,CAAC;AAC7C,eAAO,MAAM,gCAAgC,KAAK,CAAC;AAEnD,eAAO,MAAM,wBAAwB,MAAO,UAAU,UAAU,OAAO,KAAG,OAgBzE,CAAC"}
|
|
@@ -4,10 +4,11 @@ export const isClickWithinProductLink = (e, result) => {
|
|
|
4
4
|
let currentElement = e.target;
|
|
5
5
|
let href = null;
|
|
6
6
|
let level = 0;
|
|
7
|
-
const
|
|
7
|
+
const resultCoreUrl = result?.display?.mappings.core?.url || '';
|
|
8
|
+
const resultDisplayUrl = result?.mappings.core?.url || '';
|
|
8
9
|
while (currentElement && level < CLICK_THROUGH_CLOSEST_MAX_LEVELS) {
|
|
9
10
|
href = currentElement.getAttribute('href');
|
|
10
|
-
if (href &&
|
|
11
|
+
if (href && ((resultCoreUrl && href.includes(resultCoreUrl)) || (resultDisplayUrl && href.includes(resultDisplayUrl)))) {
|
|
11
12
|
return true;
|
|
12
13
|
}
|
|
13
14
|
currentElement = currentElement.parentElement;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@searchspring/snap-controller",
|
|
3
|
-
"version": "0.66.
|
|
3
|
+
"version": "0.66.2",
|
|
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.66.
|
|
23
|
+
"@searchspring/snap-toolbox": "^0.66.2",
|
|
24
24
|
"css.escape": "1.5.1",
|
|
25
25
|
"deepmerge": "4.3.1"
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|
|
28
|
-
"@searchspring/snap-client": "^0.66.
|
|
29
|
-
"@searchspring/snap-event-manager": "^0.66.
|
|
30
|
-
"@searchspring/snap-logger": "^0.66.
|
|
31
|
-
"@searchspring/snap-profiler": "^0.66.
|
|
32
|
-
"@searchspring/snap-store-mobx": "^0.66.
|
|
33
|
-
"@searchspring/snap-tracker": "^0.66.
|
|
34
|
-
"@searchspring/snap-url-manager": "^0.66.
|
|
28
|
+
"@searchspring/snap-client": "^0.66.2",
|
|
29
|
+
"@searchspring/snap-event-manager": "^0.66.2",
|
|
30
|
+
"@searchspring/snap-logger": "^0.66.2",
|
|
31
|
+
"@searchspring/snap-profiler": "^0.66.2",
|
|
32
|
+
"@searchspring/snap-store-mobx": "^0.66.2",
|
|
33
|
+
"@searchspring/snap-tracker": "^0.66.2",
|
|
34
|
+
"@searchspring/snap-url-manager": "^0.66.2"
|
|
35
35
|
},
|
|
36
36
|
"sideEffects": false,
|
|
37
37
|
"files": [
|
|
38
38
|
"dist/**/*"
|
|
39
39
|
],
|
|
40
|
-
"gitHead": "
|
|
40
|
+
"gitHead": "e6811388790e96d7f5ef5a92717f48da93204151"
|
|
41
41
|
}
|