@searchspring/snap-controller 0.39.3 → 0.40.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 +5 -1
- package/dist/cjs/Recommendation/RecommendationController.d.ts +1 -1
- package/dist/cjs/Recommendation/RecommendationController.d.ts.map +1 -1
- package/dist/cjs/Recommendation/RecommendationController.js +154 -129
- package/dist/cjs/Search/SearchController.d.ts.map +1 -1
- package/dist/cjs/Search/SearchController.js +78 -74
- package/dist/cjs/types.d.ts +2 -0
- package/dist/cjs/types.d.ts.map +1 -1
- package/dist/esm/Autocomplete/AutocompleteController.d.ts.map +1 -1
- package/dist/esm/Autocomplete/AutocompleteController.js +4 -0
- package/dist/esm/Recommendation/RecommendationController.d.ts +1 -1
- package/dist/esm/Recommendation/RecommendationController.d.ts.map +1 -1
- package/dist/esm/Recommendation/RecommendationController.js +153 -128
- package/dist/esm/Search/SearchController.d.ts.map +1 -1
- package/dist/esm/Search/SearchController.js +44 -42
- package/dist/esm/types.d.ts +2 -0
- package/dist/esm/types.d.ts.map +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,
|
|
1
|
+
{"version":3,"file":"AutocompleteController.d.ts","sourceRoot":"","sources":["../../../src/Autocomplete/AutocompleteController.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,YAAY,EAA8C,MAAM,+BAA+B,CAAC;AACzG,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,EAA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C,CAwBtC;IAEF,MAAM,QAAa,QAAQ,IAAI,CAAC,CAiH9B;CACF"}
|
|
@@ -275,7 +275,7 @@ var AutocompleteController = /** @class */ (function (_super) {
|
|
|
275
275
|
}
|
|
276
276
|
},
|
|
277
277
|
keyUp: function (e) {
|
|
278
|
-
var _a, _b, _c, _d, _e;
|
|
278
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
279
279
|
// ignore enter and escape keys
|
|
280
280
|
if ((e === null || e === void 0 ? void 0 : e.keyCode) == KEY_ENTER || (e === null || e === void 0 ? void 0 : e.keyCode) == KEY_ESCAPE)
|
|
281
281
|
return;
|
|
@@ -303,8 +303,12 @@ var AutocompleteController = /** @class */ (function (_super) {
|
|
|
303
303
|
if (((_c = _this.store.trending) === null || _c === void 0 ? void 0 : _c.length) && ((_e = (_d = _this.config.settings) === null || _d === void 0 ? void 0 : _d.trending) === null || _e === void 0 ? void 0 : _e.showResults)) {
|
|
304
304
|
_this.store.trending[0].preview();
|
|
305
305
|
}
|
|
306
|
+
else if (((_f = _this.store.history) === null || _f === void 0 ? void 0 : _f.length) && ((_h = (_g = _this.config.settings) === null || _g === void 0 ? void 0 : _g.history) === null || _h === void 0 ? void 0 : _h.showResults)) {
|
|
307
|
+
_this.store.history[0].preview();
|
|
308
|
+
}
|
|
306
309
|
}
|
|
307
310
|
else {
|
|
311
|
+
_this.store.resetTerms();
|
|
308
312
|
_this.handlers.input.timeoutDelay = setTimeout(function () {
|
|
309
313
|
_this.store.state.locks.terms.unlock();
|
|
310
314
|
_this.store.state.locks.facets.unlock();
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import { BeaconEvent } from '@searchspring/snap-tracker';
|
|
1
2
|
import { AbstractController } from '../Abstract/AbstractController';
|
|
2
3
|
import { ControllerTypes } from '../types';
|
|
3
|
-
import { BeaconEvent } from '@searchspring/snap-tracker';
|
|
4
4
|
import type { RecommendationStore } from '@searchspring/snap-store-mobx';
|
|
5
5
|
import type { RecommendationControllerConfig, ControllerServices, ContextVariables } from '../types';
|
|
6
6
|
declare type RecommendationTrackMethods = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RecommendationController.d.ts","sourceRoot":"","sources":["../../../src/Recommendation/RecommendationController.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"RecommendationController.d.ts","sourceRoot":"","sources":["../../../src/Recommendation/RecommendationController.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AACzD,OAAO,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AACpE,OAAO,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAG3C,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,+BAA+B,CAAC;AAEzE,OAAO,KAAK,EAAE,8BAA8B,EAAkC,kBAAkB,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAErI,aAAK,0BAA0B,GAAG;IACjC,OAAO,EAAE;QACR,KAAK,EAAE,CAAC,CAAC,EAAE,UAAU,EAAE,MAAM,EAAE,GAAG,KAAK,WAAW,GAAG,SAAS,CAAC;QAC/D,MAAM,EAAE,CAAC,MAAM,EAAE,GAAG,KAAK,WAAW,GAAG,SAAS,CAAC;QACjD,UAAU,EAAE,CAAC,MAAM,EAAE,GAAG,KAAK,WAAW,GAAG,SAAS,CAAC;KACrD,CAAC;IACF,KAAK,EAAE,CAAC,CAAC,EAAE,UAAU,KAAK,WAAW,GAAG,SAAS,CAAC;IAClD,UAAU,EAAE,MAAM,WAAW,GAAG,SAAS,CAAC;IAC1C,MAAM,EAAE,MAAM,WAAW,GAAG,SAAS,CAAC;CACtC,CAAC;AAEF,aAAK,6BAA6B,GAAG;IACpC,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;IACtB,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;IAChB,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;IACtB,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC;AAUF,qBAAa,wBAAyB,SAAQ,kBAAkB;IACxD,IAAI,kBAAkC;IACrC,KAAK,EAAE,mBAAmB,CAAC;IAC3B,MAAM,EAAE,8BAA8B,CAAC;IAE/C,MAAM,EAAE;QACP,KAAK,CAAC,EAAE,WAAW,CAAC;QACpB,UAAU,CAAC,EAAE,WAAW,CAAC;QACzB,MAAM,CAAC,EAAE,WAAW,CAAC;QACrB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE;YAAE,UAAU,CAAC,EAAE,WAAW,CAAC;YAAC,MAAM,CAAC,EAAE,WAAW,CAAA;SAAE,CAAC,CAAC;KAC7E,CAKC;gBAGD,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;IA8B3B,KAAK,EAAE,0BAA0B,CAgM5B;IAEL,IAAI,MAAM,IAAI,6BAA6B,CA0B1C;IAED,MAAM,QAAa,QAAQ,IAAI,CAAC,CAsG9B;CACF"}
|
|
@@ -68,9 +68,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
68
68
|
exports.RecommendationController = void 0;
|
|
69
69
|
var deepmerge_1 = __importDefault(require("deepmerge"));
|
|
70
70
|
var snap_tracker_1 = require("@searchspring/snap-tracker");
|
|
71
|
+
var snap_store_mobx_1 = require("@searchspring/snap-store-mobx");
|
|
71
72
|
var AbstractController_1 = require("../Abstract/AbstractController");
|
|
72
73
|
var types_1 = require("../types");
|
|
73
|
-
var snap_store_mobx_1 = require("@searchspring/snap-store-mobx");
|
|
74
74
|
var defaultConfig = {
|
|
75
75
|
id: 'recommend',
|
|
76
76
|
tag: '',
|
|
@@ -90,13 +90,121 @@ var RecommendationController = /** @class */ (function (_super) {
|
|
|
90
90
|
render: undefined,
|
|
91
91
|
product: {},
|
|
92
92
|
};
|
|
93
|
-
_this.track = {
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
93
|
+
_this.track = (function () {
|
|
94
|
+
var getSeed = function () {
|
|
95
|
+
var skus = [];
|
|
96
|
+
switch (_this.store.profile.placement) {
|
|
97
|
+
case snap_tracker_1.ProfilePlacement.PRODUCTPAGE:
|
|
98
|
+
if (_this.config.globals.product) {
|
|
99
|
+
skus = [_this.config.globals.product];
|
|
100
|
+
}
|
|
101
|
+
break;
|
|
102
|
+
case snap_tracker_1.ProfilePlacement.BASKETPAGE:
|
|
103
|
+
skus = _this.tracker.cookies.cart.get(); // this is an array
|
|
104
|
+
break;
|
|
105
|
+
default:
|
|
106
|
+
return;
|
|
107
|
+
}
|
|
108
|
+
if (skus.length) {
|
|
109
|
+
return skus.map(function (sku) { return ({
|
|
110
|
+
sku: sku,
|
|
111
|
+
}); });
|
|
112
|
+
}
|
|
113
|
+
};
|
|
114
|
+
return {
|
|
115
|
+
product: {
|
|
116
|
+
click: function (e, result) {
|
|
117
|
+
if (!_this.store.profile.tag || !result || !_this.events.click)
|
|
118
|
+
return;
|
|
119
|
+
var payload = {
|
|
120
|
+
type: snap_tracker_1.BeaconType.PROFILE_PRODUCT_CLICK,
|
|
121
|
+
category: snap_tracker_1.BeaconCategory.RECOMMENDATIONS,
|
|
122
|
+
context: _this.config.globals.siteId ? { website: { trackingCode: _this.config.globals.siteId } } : undefined,
|
|
123
|
+
event: {
|
|
124
|
+
context: {
|
|
125
|
+
action: 'navigate',
|
|
126
|
+
placement: _this.store.profile.placement,
|
|
127
|
+
tag: _this.store.profile.tag,
|
|
128
|
+
type: 'product-recommendation',
|
|
129
|
+
},
|
|
130
|
+
product: {
|
|
131
|
+
id: result.id,
|
|
132
|
+
mappings: {
|
|
133
|
+
core: result.mappings.core,
|
|
134
|
+
},
|
|
135
|
+
seed: getSeed(),
|
|
136
|
+
},
|
|
137
|
+
},
|
|
138
|
+
pid: _this.events.click.id,
|
|
139
|
+
};
|
|
140
|
+
var event = _this.tracker.track.event(payload);
|
|
141
|
+
_this.eventManager.fire('track.product.click', { controller: _this, event: e, result: result, trackEvent: event });
|
|
142
|
+
return event;
|
|
143
|
+
},
|
|
144
|
+
impression: function (result) {
|
|
145
|
+
var _a;
|
|
146
|
+
if (!_this.store.profile.tag || !result || !_this.events.impression || (_this.events.product && ((_a = _this.events.product[result.id]) === null || _a === void 0 ? void 0 : _a.impression)))
|
|
147
|
+
return;
|
|
148
|
+
var payload = {
|
|
149
|
+
type: snap_tracker_1.BeaconType.PROFILE_PRODUCT_IMPRESSION,
|
|
150
|
+
category: snap_tracker_1.BeaconCategory.RECOMMENDATIONS,
|
|
151
|
+
context: _this.config.globals.siteId ? { website: { trackingCode: _this.config.globals.siteId } } : undefined,
|
|
152
|
+
event: {
|
|
153
|
+
context: {
|
|
154
|
+
placement: _this.store.profile.placement,
|
|
155
|
+
tag: _this.store.profile.tag,
|
|
156
|
+
type: 'product-recommendation',
|
|
157
|
+
},
|
|
158
|
+
product: {
|
|
159
|
+
id: result.id,
|
|
160
|
+
mappings: {
|
|
161
|
+
core: result.mappings.core,
|
|
162
|
+
},
|
|
163
|
+
seed: getSeed(),
|
|
164
|
+
},
|
|
165
|
+
},
|
|
166
|
+
pid: _this.events.impression.id,
|
|
167
|
+
};
|
|
168
|
+
_this.events.product[result.id] = _this.events.product[result.id] || {};
|
|
169
|
+
var event = (_this.events.product[result.id].impression = _this.tracker.track.event(payload));
|
|
170
|
+
_this.eventManager.fire('track.product.impression', { controller: _this, result: result, trackEvent: event });
|
|
171
|
+
return event;
|
|
172
|
+
},
|
|
173
|
+
render: function (result) {
|
|
174
|
+
var _a;
|
|
175
|
+
if (!_this.store.profile.tag || !result || !_this.events.render || ((_a = _this.events.product[result.id]) === null || _a === void 0 ? void 0 : _a.render))
|
|
176
|
+
return;
|
|
177
|
+
var payload = {
|
|
178
|
+
type: snap_tracker_1.BeaconType.PROFILE_PRODUCT_RENDER,
|
|
179
|
+
category: snap_tracker_1.BeaconCategory.RECOMMENDATIONS,
|
|
180
|
+
context: _this.config.globals.siteId ? { website: { trackingCode: _this.config.globals.siteId } } : undefined,
|
|
181
|
+
event: {
|
|
182
|
+
context: {
|
|
183
|
+
placement: _this.store.profile.placement,
|
|
184
|
+
tag: _this.store.profile.tag,
|
|
185
|
+
type: 'product-recommendation',
|
|
186
|
+
},
|
|
187
|
+
product: {
|
|
188
|
+
id: result.id,
|
|
189
|
+
mappings: {
|
|
190
|
+
core: result.mappings.core,
|
|
191
|
+
},
|
|
192
|
+
seed: getSeed(),
|
|
193
|
+
},
|
|
194
|
+
},
|
|
195
|
+
pid: _this.events.render.id,
|
|
196
|
+
};
|
|
197
|
+
_this.events.product[result.id] = _this.events.product[result.id] || {};
|
|
198
|
+
var event = (_this.events.product[result.id].render = _this.tracker.track.event(payload));
|
|
199
|
+
_this.eventManager.fire('track.product.render', { controller: _this, result: result, trackEvent: event });
|
|
200
|
+
return event;
|
|
201
|
+
},
|
|
202
|
+
},
|
|
203
|
+
click: function (e) {
|
|
204
|
+
if (!_this.store.profile.tag)
|
|
97
205
|
return;
|
|
98
|
-
var
|
|
99
|
-
type: snap_tracker_1.BeaconType.
|
|
206
|
+
var event = _this.tracker.track.event({
|
|
207
|
+
type: snap_tracker_1.BeaconType.PROFILE_CLICK,
|
|
100
208
|
category: snap_tracker_1.BeaconCategory.RECOMMENDATIONS,
|
|
101
209
|
context: _this.config.globals.siteId ? { website: { trackingCode: _this.config.globals.siteId } } : undefined,
|
|
102
210
|
event: {
|
|
@@ -106,26 +214,24 @@ var RecommendationController = /** @class */ (function (_super) {
|
|
|
106
214
|
tag: _this.store.profile.tag,
|
|
107
215
|
type: 'product-recommendation',
|
|
108
216
|
},
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
seed:
|
|
217
|
+
profile: {
|
|
218
|
+
tag: _this.store.profile.tag,
|
|
219
|
+
placement: _this.store.profile.placement,
|
|
220
|
+
threshold: _this.store.profile.display.threshold,
|
|
221
|
+
templateId: _this.store.profile.display.template.uuid,
|
|
222
|
+
seed: getSeed(),
|
|
115
223
|
},
|
|
116
224
|
},
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
_this.eventManager.fire('track.product.click', { controller: _this, event: e, result: result, trackEvent: event });
|
|
225
|
+
});
|
|
226
|
+
_this.events.click = event;
|
|
227
|
+
_this.eventManager.fire('track.click', { controller: _this, event: e, trackEvent: event });
|
|
121
228
|
return event;
|
|
122
229
|
},
|
|
123
|
-
impression: function (
|
|
124
|
-
|
|
125
|
-
if (!_this.store.profile.tag || !result || !_this.events.impression || (_this.events.product && ((_a = _this.events.product[result.id]) === null || _a === void 0 ? void 0 : _a.impression)))
|
|
230
|
+
impression: function () {
|
|
231
|
+
if (!_this.store.profile.tag || _this.events.impression)
|
|
126
232
|
return;
|
|
127
|
-
var
|
|
128
|
-
type: snap_tracker_1.BeaconType.
|
|
233
|
+
var event = _this.tracker.track.event({
|
|
234
|
+
type: snap_tracker_1.BeaconType.PROFILE_IMPRESSION,
|
|
129
235
|
category: snap_tracker_1.BeaconCategory.RECOMMENDATIONS,
|
|
130
236
|
context: _this.config.globals.siteId ? { website: { trackingCode: _this.config.globals.siteId } } : undefined,
|
|
131
237
|
event: {
|
|
@@ -134,27 +240,24 @@ var RecommendationController = /** @class */ (function (_super) {
|
|
|
134
240
|
tag: _this.store.profile.tag,
|
|
135
241
|
type: 'product-recommendation',
|
|
136
242
|
},
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
seed:
|
|
243
|
+
profile: {
|
|
244
|
+
tag: _this.store.profile.tag,
|
|
245
|
+
placement: _this.store.profile.placement,
|
|
246
|
+
threshold: _this.store.profile.display.threshold,
|
|
247
|
+
templateId: _this.store.profile.display.template.uuid,
|
|
248
|
+
seed: getSeed(),
|
|
143
249
|
},
|
|
144
250
|
},
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
_this.
|
|
148
|
-
var event = (_this.events.product[result.id].impression = _this.tracker.track.event(payload));
|
|
149
|
-
_this.eventManager.fire('track.product.impression', { controller: _this, result: result, trackEvent: event });
|
|
251
|
+
});
|
|
252
|
+
_this.events.impression = event;
|
|
253
|
+
_this.eventManager.fire('track.impression', { controller: _this, trackEvent: event });
|
|
150
254
|
return event;
|
|
151
255
|
},
|
|
152
|
-
render: function (
|
|
153
|
-
|
|
154
|
-
if (!_this.store.profile.tag || !result || !_this.events.render || ((_a = _this.events.product[result.id]) === null || _a === void 0 ? void 0 : _a.render))
|
|
256
|
+
render: function () {
|
|
257
|
+
if (!_this.store.profile.tag || _this.events.render)
|
|
155
258
|
return;
|
|
156
|
-
var
|
|
157
|
-
type: snap_tracker_1.BeaconType.
|
|
259
|
+
var event = _this.tracker.track.event({
|
|
260
|
+
type: snap_tracker_1.BeaconType.PROFILE_RENDER,
|
|
158
261
|
category: snap_tracker_1.BeaconCategory.RECOMMENDATIONS,
|
|
159
262
|
context: _this.config.globals.siteId ? { website: { trackingCode: _this.config.globals.siteId } } : undefined,
|
|
160
263
|
event: {
|
|
@@ -163,101 +266,23 @@ var RecommendationController = /** @class */ (function (_super) {
|
|
|
163
266
|
tag: _this.store.profile.tag,
|
|
164
267
|
type: 'product-recommendation',
|
|
165
268
|
},
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
seed:
|
|
269
|
+
profile: {
|
|
270
|
+
tag: _this.store.profile.tag,
|
|
271
|
+
placement: _this.store.profile.placement,
|
|
272
|
+
threshold: _this.store.profile.display.threshold,
|
|
273
|
+
templateId: _this.store.profile.display.template.uuid,
|
|
274
|
+
seed: getSeed(),
|
|
172
275
|
},
|
|
173
276
|
},
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
_this.eventManager.fire('track.
|
|
277
|
+
});
|
|
278
|
+
_this.events.render = event;
|
|
279
|
+
// track results render
|
|
280
|
+
_this.store.results.forEach(function (result) { return _this.track.product.render(result); });
|
|
281
|
+
_this.eventManager.fire('track.render', { controller: _this, trackEvent: event });
|
|
179
282
|
return event;
|
|
180
283
|
},
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
if (!_this.store.profile.tag)
|
|
184
|
-
return;
|
|
185
|
-
var event = _this.tracker.track.event({
|
|
186
|
-
type: snap_tracker_1.BeaconType.PROFILE_CLICK,
|
|
187
|
-
category: snap_tracker_1.BeaconCategory.RECOMMENDATIONS,
|
|
188
|
-
context: _this.config.globals.siteId ? { website: { trackingCode: _this.config.globals.siteId } } : undefined,
|
|
189
|
-
event: {
|
|
190
|
-
context: {
|
|
191
|
-
action: 'navigate',
|
|
192
|
-
placement: _this.store.profile.placement,
|
|
193
|
-
tag: _this.store.profile.tag,
|
|
194
|
-
type: 'product-recommendation',
|
|
195
|
-
},
|
|
196
|
-
profile: {
|
|
197
|
-
tag: _this.store.profile.tag,
|
|
198
|
-
placement: _this.store.profile.placement,
|
|
199
|
-
threshold: _this.store.profile.display.threshold,
|
|
200
|
-
templateId: _this.store.profile.display.template.uuid,
|
|
201
|
-
},
|
|
202
|
-
},
|
|
203
|
-
});
|
|
204
|
-
_this.events.click = event;
|
|
205
|
-
_this.eventManager.fire('track.click', { controller: _this, event: e, trackEvent: event });
|
|
206
|
-
return event;
|
|
207
|
-
},
|
|
208
|
-
impression: function () {
|
|
209
|
-
if (!_this.store.profile.tag || _this.events.impression)
|
|
210
|
-
return;
|
|
211
|
-
var event = _this.tracker.track.event({
|
|
212
|
-
type: snap_tracker_1.BeaconType.PROFILE_IMPRESSION,
|
|
213
|
-
category: snap_tracker_1.BeaconCategory.RECOMMENDATIONS,
|
|
214
|
-
context: _this.config.globals.siteId ? { website: { trackingCode: _this.config.globals.siteId } } : undefined,
|
|
215
|
-
event: {
|
|
216
|
-
context: {
|
|
217
|
-
placement: _this.store.profile.placement,
|
|
218
|
-
tag: _this.store.profile.tag,
|
|
219
|
-
type: 'product-recommendation',
|
|
220
|
-
},
|
|
221
|
-
profile: {
|
|
222
|
-
tag: _this.store.profile.tag,
|
|
223
|
-
placement: _this.store.profile.placement,
|
|
224
|
-
threshold: _this.store.profile.display.threshold,
|
|
225
|
-
templateId: _this.store.profile.display.template.uuid,
|
|
226
|
-
},
|
|
227
|
-
},
|
|
228
|
-
});
|
|
229
|
-
_this.events.impression = event;
|
|
230
|
-
_this.eventManager.fire('track.impression', { controller: _this, trackEvent: event });
|
|
231
|
-
return event;
|
|
232
|
-
},
|
|
233
|
-
render: function () {
|
|
234
|
-
if (!_this.store.profile.tag || _this.events.render)
|
|
235
|
-
return;
|
|
236
|
-
var event = _this.tracker.track.event({
|
|
237
|
-
type: snap_tracker_1.BeaconType.PROFILE_RENDER,
|
|
238
|
-
category: snap_tracker_1.BeaconCategory.RECOMMENDATIONS,
|
|
239
|
-
context: _this.config.globals.siteId ? { website: { trackingCode: _this.config.globals.siteId } } : undefined,
|
|
240
|
-
event: {
|
|
241
|
-
context: {
|
|
242
|
-
placement: _this.store.profile.placement,
|
|
243
|
-
tag: _this.store.profile.tag,
|
|
244
|
-
type: 'product-recommendation',
|
|
245
|
-
},
|
|
246
|
-
profile: {
|
|
247
|
-
tag: _this.store.profile.tag,
|
|
248
|
-
placement: _this.store.profile.placement,
|
|
249
|
-
threshold: _this.store.profile.display.threshold,
|
|
250
|
-
templateId: _this.store.profile.display.template.uuid,
|
|
251
|
-
},
|
|
252
|
-
},
|
|
253
|
-
});
|
|
254
|
-
_this.events.render = event;
|
|
255
|
-
// track results render
|
|
256
|
-
_this.store.results.forEach(function (result) { return _this.track.product.render(result); });
|
|
257
|
-
_this.eventManager.fire('track.render', { controller: _this, trackEvent: event });
|
|
258
|
-
return event;
|
|
259
|
-
},
|
|
260
|
-
};
|
|
284
|
+
};
|
|
285
|
+
})();
|
|
261
286
|
_this.search = function () { return __awaiter(_this, void 0, void 0, function () {
|
|
262
287
|
var params, err_1, searchProfile, response, afterSearchProfile, err_2, afterStoreProfile, err_3, err_4;
|
|
263
288
|
return __generator(this, function (_a) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SearchController.d.ts","sourceRoot":"","sources":["../../../src/Search/SearchController.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AACpE,OAAO,EAAE,YAAY,EAA0B,MAAM,+BAA+B,CAAC;AAErF,OAAO,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAE3C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAC9D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,+BAA+B,CAAC;AACjE,OAAO,KAAK,EAAE,sBAAsB,EAAkD,kBAAkB,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAE7I,OAAO,KAAK,EAAE,kBAAkB,EAA2E,MAAM,2BAA2B,CAAC;
|
|
1
|
+
{"version":3,"file":"SearchController.d.ts","sourceRoot":"","sources":["../../../src/Search/SearchController.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AACpE,OAAO,EAAE,YAAY,EAA0B,MAAM,+BAA+B,CAAC;AAErF,OAAO,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAE3C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAC9D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,+BAA+B,CAAC;AACjE,OAAO,KAAK,EAAE,sBAAsB,EAAkD,kBAAkB,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAE7I,OAAO,KAAK,EAAE,kBAAkB,EAA2E,MAAM,2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