fast-simon-sdk 1.2.55 → 1.2.59
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/lib/config.js +1 -1
- package/lib/config.js.map +1 -1
- package/lib/index.js +3 -3
- package/lib/index.js.map +1 -1
- package/lib/models/common.d.ts +7 -2
- package/lib/models/common.js.map +1 -1
- package/lib/models/exports.js +1 -1
- package/lib/models/exports.js.map +1 -1
- package/lib/sections/contentSearch/index.js +13 -18
- package/lib/sections/contentSearch/index.js.map +1 -1
- package/lib/sections/eventReporter/index.js +233 -180
- package/lib/sections/eventReporter/index.js.map +1 -1
- package/lib/sections/eventReporter/utils.js +9 -8
- package/lib/sections/eventReporter/utils.js.map +1 -1
- package/lib/sections/fullTextSearch/index.js +52 -26
- package/lib/sections/fullTextSearch/index.js.map +1 -1
- package/lib/sections/fullTextSearch/utils.d.ts +2 -2
- package/lib/sections/fullTextSearch/utils.js +56 -47
- package/lib/sections/fullTextSearch/utils.js.map +1 -1
- package/lib/sections/index.js +167 -96
- package/lib/sections/index.js.map +1 -1
- package/lib/sections/initialization/index.js +14 -13
- package/lib/sections/initialization/index.js.map +1 -1
- package/lib/sections/initialization/utils.js +83 -40
- package/lib/sections/initialization/utils.js.map +1 -1
- package/lib/sections/instantSearch/index.d.ts +1 -1
- package/lib/sections/instantSearch/index.js +39 -18
- package/lib/sections/instantSearch/index.js.map +1 -1
- package/lib/sections/instantSearch/utils.d.ts +4 -2
- package/lib/sections/instantSearch/utils.js +72 -56
- package/lib/sections/instantSearch/utils.js.map +1 -1
- package/lib/sections/landingPage/index.js +34 -15
- package/lib/sections/landingPage/index.js.map +1 -1
- package/lib/sections/landingPage/utils.js +28 -22
- package/lib/sections/landingPage/utils.js.map +1 -1
- package/lib/sections/lookAlikeProductRecommendation/index.js +5 -4
- package/lib/sections/lookAlikeProductRecommendation/index.js.map +1 -1
- package/lib/sections/recommendations/index.d.ts +1 -1
- package/lib/sections/recommendations/index.js +16 -14
- package/lib/sections/recommendations/index.js.map +1 -1
- package/lib/sections/recommendations/utils.js +8 -8
- package/lib/sections/recommendations/utils.js.map +1 -1
- package/lib/sections/smartCollections/index.js +58 -32
- package/lib/sections/smartCollections/index.js.map +1 -1
- package/lib/sections/smartCollections/utils.d.ts +14 -12
- package/lib/sections/smartCollections/utils.js +76 -61
- package/lib/sections/smartCollections/utils.js.map +1 -1
- package/lib/services/autocomplete.d.ts +2 -1
- package/lib/services/autocomplete.js +11 -8
- package/lib/services/autocomplete.js.map +1 -1
- package/lib/services/common.d.ts +2 -1
- package/lib/services/common.js +23 -17
- package/lib/services/common.js.map +1 -1
- package/lib/services/content.js +11 -10
- package/lib/services/content.js.map +1 -1
- package/lib/services/fullTextSearch.js +20 -14
- package/lib/services/fullTextSearch.js.map +1 -1
- package/lib/services/landingPage.js +10 -9
- package/lib/services/landingPage.js.map +1 -1
- package/lib/services/lookAlikeProductRecommendation.js +6 -5
- package/lib/services/lookAlikeProductRecommendation.js.map +1 -1
- package/lib/services/related.d.ts +2 -1
- package/lib/services/related.js +14 -11
- package/lib/services/related.js.map +1 -1
- package/lib/services/reporting.js +24 -17
- package/lib/services/reporting.js.map +1 -1
- package/lib/services/smartCollections.js +19 -14
- package/lib/services/smartCollections.js.map +1 -1
- package/lib/services/utils.js +6 -5
- package/lib/services/utils.js.map +1 -1
- package/lib/utils/API.js +63 -9
- package/lib/utils/API.js.map +1 -1
- package/lib/utils/ArrayUtils.js +1 -1
- package/lib/utils/cookies.js +36 -23
- package/lib/utils/cookies.js.map +1 -1
- package/lib/utils/debug.js +5 -5
- package/lib/utils/debug.js.map +1 -1
- package/lib/utils/klaviyo.js +4 -4
- package/lib/utils/klaviyo.js.map +1 -1
- package/lib/utils/options.d.ts +7 -0
- package/lib/utils/options.js +3 -3
- package/lib/utils/options.js.map +1 -1
- package/lib/utils/validation.js +9 -8
- package/lib/utils/validation.js.map +1 -1
- package/package.json +7 -2
|
@@ -1,11 +1,22 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __assign = (this && this.__assign) || function () {
|
|
3
|
+
__assign = Object.assign || function(t) {
|
|
4
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
+
s = arguments[i];
|
|
6
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
+
t[p] = s[p];
|
|
8
|
+
}
|
|
9
|
+
return t;
|
|
10
|
+
};
|
|
11
|
+
return __assign.apply(this, arguments);
|
|
12
|
+
};
|
|
2
13
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
14
|
exports.reportEvent = exports.event = exports.SPAOnlyReports = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
15
|
+
var utils_1 = require("./utils");
|
|
16
|
+
var utils_2 = require("../smartCollections/utils");
|
|
17
|
+
var utils_3 = require("../fullTextSearch/utils");
|
|
18
|
+
var config_1 = require("../../config");
|
|
19
|
+
var reporting_1 = require("../../services/reporting");
|
|
9
20
|
exports.SPAOnlyReports = new Set([
|
|
10
21
|
"lookALikeViewSerp",
|
|
11
22
|
"quickViewSerp",
|
|
@@ -14,254 +25,283 @@ exports.SPAOnlyReports = new Set([
|
|
|
14
25
|
"search",
|
|
15
26
|
"collection"
|
|
16
27
|
]);
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
28
|
+
var event = function (_a) {
|
|
29
|
+
var report = _a.report, self = _a.self;
|
|
30
|
+
var type = report.reportAppType ? report.reportAppType : self.type;
|
|
31
|
+
var categoryName = self.temp.smartCollections.name;
|
|
20
32
|
if (report.eventName === "productFromCollection" && !report.data.query) {
|
|
21
|
-
report =
|
|
33
|
+
report = __assign(__assign({}, report), { data: __assign(__assign({}, report.data), { query: categoryName !== null && categoryName !== void 0 ? categoryName : "" }) });
|
|
22
34
|
}
|
|
35
|
+
console.log("event-received", type, report);
|
|
23
36
|
if (type === "MPA" && !exports.SPAOnlyReports.has(report.eventName)) {
|
|
24
37
|
utils_1.saveEvent(report);
|
|
25
38
|
}
|
|
26
39
|
else {
|
|
27
|
-
reportEvent({ report, self });
|
|
40
|
+
reportEvent({ report: report, self: self });
|
|
28
41
|
}
|
|
29
42
|
};
|
|
30
43
|
exports.event = event;
|
|
31
|
-
function reportEvent(
|
|
44
|
+
function reportEvent(_a) {
|
|
45
|
+
var report = _a.report, self = _a.self;
|
|
32
46
|
switch (report.eventName) {
|
|
33
47
|
case "instantsearch-product": {
|
|
34
|
-
reportAutocompleteProductSeen({ self, report });
|
|
48
|
+
reportAutocompleteProductSeen({ self: self, report: report });
|
|
35
49
|
break;
|
|
36
50
|
}
|
|
37
51
|
case "instantsearch-category": {
|
|
38
|
-
reportAutocompleteCategory({ self, report });
|
|
52
|
+
reportAutocompleteCategory({ self: self, report: report });
|
|
39
53
|
break;
|
|
40
54
|
}
|
|
41
55
|
case "instantsearch-popular-search": {
|
|
42
|
-
reportAutocompletePopularSearch({ self, report });
|
|
56
|
+
reportAutocompletePopularSearch({ self: self, report: report });
|
|
43
57
|
break;
|
|
44
58
|
}
|
|
45
59
|
case "search": {
|
|
46
|
-
reportSearchPreformed({ self, report });
|
|
60
|
+
reportSearchPreformed({ self: self, report: report });
|
|
47
61
|
break;
|
|
48
62
|
}
|
|
49
63
|
case "productFromSearch": {
|
|
50
|
-
reportSerpProductSeen({ self, report });
|
|
64
|
+
reportSerpProductSeen({ self: self, report: report });
|
|
51
65
|
break;
|
|
52
66
|
}
|
|
53
67
|
case "collection": {
|
|
54
|
-
reportSmartCollectionPreformed({ self, report });
|
|
68
|
+
reportSmartCollectionPreformed({ self: self, report: report });
|
|
55
69
|
break;
|
|
56
70
|
}
|
|
57
71
|
case "productFromCollection": {
|
|
58
|
-
reportProductFromCollection({ self, report });
|
|
72
|
+
reportProductFromCollection({ self: self, report: report });
|
|
59
73
|
break;
|
|
60
74
|
}
|
|
61
75
|
case "productFromRecommendation": {
|
|
62
|
-
reportRecommendationsProductSeen({ self, report });
|
|
76
|
+
reportRecommendationsProductSeen({ self: self, report: report });
|
|
63
77
|
break;
|
|
64
78
|
}
|
|
65
79
|
case "productFromLookALike": {
|
|
66
|
-
reportProductFromLookALike({ self, report });
|
|
80
|
+
reportProductFromLookALike({ self: self, report: report });
|
|
67
81
|
break;
|
|
68
82
|
}
|
|
69
83
|
case "quickViewCollection": {
|
|
70
|
-
reportQuickViewCollection({ self, report, type: "Quick View" });
|
|
84
|
+
reportQuickViewCollection({ self: self, report: report, type: "Quick View" });
|
|
71
85
|
break;
|
|
72
86
|
}
|
|
73
87
|
case "quickViewSerp": {
|
|
74
|
-
reportQuickViewSerp({ self, report, type: "Quick View" });
|
|
88
|
+
reportQuickViewSerp({ self: self, report: report, type: "Quick View" });
|
|
75
89
|
break;
|
|
76
90
|
}
|
|
77
91
|
case "productFromQuickView": {
|
|
78
|
-
reportProductFromQuickView({ self, report });
|
|
92
|
+
reportProductFromQuickView({ self: self, report: report });
|
|
79
93
|
break;
|
|
80
94
|
}
|
|
81
95
|
case "lookALikeViewCollection": {
|
|
82
|
-
reportQuickViewCollection({ self, report, type: "Look A Like" });
|
|
96
|
+
reportQuickViewCollection({ self: self, report: report, type: "Look A Like" });
|
|
83
97
|
break;
|
|
84
98
|
}
|
|
85
99
|
case "lookALikeViewSerp": {
|
|
86
|
-
reportQuickViewSerp({ self, report, type: "Look A Like" });
|
|
100
|
+
reportQuickViewSerp({ self: self, report: report, type: "Look A Like" });
|
|
87
101
|
break;
|
|
88
102
|
}
|
|
89
103
|
case "productDirect": {
|
|
90
|
-
reportDirectProductViewData({ self, report });
|
|
104
|
+
reportDirectProductViewData({ self: self, report: report });
|
|
91
105
|
break;
|
|
92
106
|
}
|
|
93
107
|
case "cartPerformed": {
|
|
94
|
-
reportCartVisited({ self, report });
|
|
108
|
+
reportCartVisited({ self: self, report: report });
|
|
95
109
|
break;
|
|
96
110
|
}
|
|
97
111
|
case "cartVisited": {
|
|
98
|
-
reportAddToCart({ self, report });
|
|
112
|
+
reportAddToCart({ self: self, report: report });
|
|
99
113
|
break;
|
|
100
114
|
}
|
|
101
115
|
}
|
|
102
116
|
localStorage.removeItem(config_1.POST_LOAD_EVENT_KEY);
|
|
103
117
|
}
|
|
104
118
|
exports.reportEvent = reportEvent;
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
119
|
+
var reportAutocompleteProductSeen = function (_a) {
|
|
120
|
+
var self = _a.self, report = _a.report;
|
|
121
|
+
var _b = self.data, userToken = _b.userToken, sessionToken = _b.sessionToken, uuid = _b.uuid, storeID = _b.storeID, cartToken = _b.cartToken;
|
|
122
|
+
var time = report.time, callback = report.callback, targetURL = report.targetURL;
|
|
123
|
+
var _c = report.data, productID = _c.productID, query = _c.query, productQuery = _c.productQuery;
|
|
124
|
+
var waitTime = time ? time : config_1.POST_LOAD_WAIT_TIME;
|
|
125
|
+
function reportEvent() {
|
|
126
|
+
utils_3.setRecentSearchProducts(self, productID);
|
|
127
|
+
utils_1.postLoadCallback({
|
|
128
|
+
eventName: report.eventName,
|
|
129
|
+
promise: reporting_1.Reporting.productSeen({
|
|
130
|
+
type: "autocomplete", query: productQuery,
|
|
131
|
+
term: query,
|
|
132
|
+
uuid: uuid, storeID: storeID, userToken: userToken,
|
|
133
|
+
productId: productID,
|
|
134
|
+
sessionStart: sessionToken.start,
|
|
135
|
+
cartToken: cartToken
|
|
136
|
+
}),
|
|
137
|
+
callback: callback
|
|
138
|
+
});
|
|
139
|
+
}
|
|
140
|
+
if (report.reportAppType && report.reportAppType === "SPA") {
|
|
141
|
+
reportEvent();
|
|
142
|
+
}
|
|
143
|
+
else {
|
|
144
|
+
setTimeout(function () {
|
|
145
|
+
if (!targetURL || targetURL.includes(window.location.pathname)) {
|
|
146
|
+
reportEvent();
|
|
147
|
+
}
|
|
148
|
+
}, waitTime);
|
|
149
|
+
}
|
|
124
150
|
};
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
151
|
+
var reportAutocompleteCategory = function (_a) {
|
|
152
|
+
var report = _a.report, self = _a.self;
|
|
153
|
+
var _b = self.data, userToken = _b.userToken, sessionToken = _b.sessionToken, uuid = _b.uuid, storeID = _b.storeID, cartToken = _b.cartToken;
|
|
154
|
+
var callback = report.callback;
|
|
155
|
+
var _c = report.data, categoryID = _c.categoryID, query = _c.query;
|
|
129
156
|
utils_1.postLoadCallback({
|
|
130
157
|
eventName: report.eventName,
|
|
131
158
|
promise: reporting_1.Reporting.categorySearchSeen({
|
|
132
|
-
query, uuid, storeID, userToken
|
|
133
|
-
|
|
159
|
+
query: query, uuid: uuid, storeID: storeID, userToken: userToken,
|
|
160
|
+
categoryID: categoryID,
|
|
161
|
+
sessionStart: sessionToken.start,
|
|
162
|
+
cartToken: cartToken
|
|
134
163
|
}),
|
|
135
164
|
callback: callback
|
|
136
165
|
});
|
|
137
166
|
};
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
167
|
+
var reportDirectProductViewData = function (_a) {
|
|
168
|
+
var report = _a.report, self = _a.self;
|
|
169
|
+
var _b = self.data, userToken = _b.userToken, sessionToken = _b.sessionToken, uuid = _b.uuid, storeID = _b.storeID, cartToken = _b.cartToken;
|
|
170
|
+
var time = report.time, callback = report.callback, targetURL = report.targetURL;
|
|
171
|
+
var productID = report.data.productID;
|
|
172
|
+
var waitTime = time ? time : config_1.POST_LOAD_WAIT_TIME;
|
|
173
|
+
setTimeout(function () {
|
|
144
174
|
if (!targetURL || targetURL.includes(window.location.pathname)) {
|
|
145
175
|
utils_1.postLoadCallback({
|
|
146
176
|
eventName: report.eventName,
|
|
147
177
|
promise: reporting_1.Reporting.productSeen({
|
|
148
178
|
type: "direct",
|
|
149
|
-
uuid, storeID, userToken
|
|
150
|
-
|
|
179
|
+
uuid: uuid, storeID: storeID, userToken: userToken,
|
|
180
|
+
productId: productID,
|
|
181
|
+
sessionStart: sessionToken.start,
|
|
182
|
+
cartToken: cartToken
|
|
151
183
|
}),
|
|
152
184
|
callback: callback
|
|
153
185
|
});
|
|
154
186
|
}
|
|
155
187
|
}, waitTime);
|
|
156
188
|
};
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
189
|
+
var reportAutocompletePopularSearch = function (_a) {
|
|
190
|
+
var report = _a.report, self = _a.self;
|
|
191
|
+
var _b = self.data, userToken = _b.userToken, sessionToken = _b.sessionToken, uuid = _b.uuid, storeID = _b.storeID, cartToken = _b.cartToken;
|
|
192
|
+
var callback = report.callback;
|
|
193
|
+
var _c = report.data, query = _c.query, term = _c.term;
|
|
161
194
|
utils_1.postLoadCallback({
|
|
162
195
|
eventName: report.eventName,
|
|
163
196
|
promise: reporting_1.Reporting.popularSearchSeen({
|
|
164
|
-
originId: query,
|
|
165
|
-
|
|
197
|
+
originId: query,
|
|
198
|
+
uuid: uuid, storeID: storeID, userToken: userToken, term: term,
|
|
199
|
+
sessionStart: sessionToken.start,
|
|
200
|
+
cartToken: cartToken
|
|
166
201
|
}),
|
|
167
202
|
callback: callback
|
|
168
203
|
});
|
|
169
204
|
};
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
205
|
+
var reportSearchPreformed = function (_a) {
|
|
206
|
+
var self = _a.self, report = _a.report;
|
|
207
|
+
var _b = self.data, userToken = _b.userToken, sessionToken = _b.sessionToken, uuid = _b.uuid, storeID = _b.storeID, cartToken = _b.cartToken;
|
|
208
|
+
var _c = report.data, query = _c.query, narrowBy = _c.narrowBy, sortBy = _c.sortBy;
|
|
209
|
+
var callback = report.callback;
|
|
174
210
|
utils_1.postLoadCallback({
|
|
175
211
|
eventName: report.eventName,
|
|
176
212
|
promise: reporting_1.Reporting.searchPerformed({
|
|
177
|
-
userToken,
|
|
213
|
+
userToken: userToken,
|
|
178
214
|
sessionStart: sessionToken.start,
|
|
179
|
-
uuid,
|
|
180
|
-
storeID,
|
|
181
|
-
query,
|
|
215
|
+
uuid: uuid,
|
|
216
|
+
storeID: storeID,
|
|
217
|
+
query: query,
|
|
182
218
|
narrow: narrowBy,
|
|
183
|
-
sortBy,
|
|
184
|
-
cartToken
|
|
219
|
+
sortBy: sortBy,
|
|
220
|
+
cartToken: cartToken
|
|
185
221
|
}),
|
|
186
222
|
callback: callback
|
|
187
223
|
});
|
|
188
224
|
};
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
225
|
+
var reportSmartCollectionPreformed = function (_a) {
|
|
226
|
+
var self = _a.self, report = _a.report;
|
|
227
|
+
var _b = self.data, userToken = _b.userToken, sessionToken = _b.sessionToken, uuid = _b.uuid, storeID = _b.storeID, cartToken = _b.cartToken;
|
|
228
|
+
var _c = report.data, query = _c.query, categoryID = _c.categoryID, narrowBy = _c.narrowBy, sortBy = _c.sortBy;
|
|
229
|
+
var callback = report.callback;
|
|
230
|
+
var categoryName = self.temp.smartCollections.name;
|
|
194
231
|
/* check if categories were fetched, if not retry in 300ms */
|
|
195
232
|
if (!categoryName && self.data.categories.length === 0) {
|
|
196
|
-
setTimeout(()
|
|
197
|
-
reportSmartCollectionPreformed({ self, report });
|
|
233
|
+
setTimeout(function () {
|
|
234
|
+
reportSmartCollectionPreformed({ self: self, report: report });
|
|
198
235
|
}, 300);
|
|
199
236
|
return;
|
|
200
237
|
}
|
|
201
238
|
utils_1.postLoadCallback({
|
|
202
239
|
eventName: report.eventName,
|
|
203
240
|
promise: reporting_1.Reporting.collectionPerformed({
|
|
204
|
-
uuid,
|
|
205
|
-
storeID,
|
|
206
|
-
userToken,
|
|
241
|
+
uuid: uuid,
|
|
242
|
+
storeID: storeID,
|
|
243
|
+
userToken: userToken,
|
|
207
244
|
sessionStart: sessionToken.start,
|
|
208
245
|
query: (query !== null && query !== void 0 ? query : categoryName) || utils_2.getCollectionName(self, categoryID),
|
|
209
246
|
collectionID: categoryID,
|
|
210
247
|
narrow: narrowBy,
|
|
211
|
-
sortBy,
|
|
212
|
-
cartToken
|
|
248
|
+
sortBy: sortBy,
|
|
249
|
+
cartToken: cartToken
|
|
213
250
|
}),
|
|
214
251
|
callback: callback
|
|
215
252
|
});
|
|
216
253
|
};
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
254
|
+
var reportQuickViewSerp = function (_a) {
|
|
255
|
+
var self = _a.self, report = _a.report, type = _a.type;
|
|
256
|
+
var _b = self.data, userToken = _b.userToken, sessionToken = _b.sessionToken, uuid = _b.uuid, storeID = _b.storeID, cartToken = _b.cartToken;
|
|
257
|
+
var _c = report.data, position = _c.position, productID = _c.productID, term = _c.term;
|
|
258
|
+
var callback = report.callback;
|
|
221
259
|
utils_1.postLoadCallback({
|
|
222
260
|
eventName: report.eventName,
|
|
223
261
|
promise: reporting_1.Reporting.popUpUsed({
|
|
224
|
-
uuid,
|
|
225
|
-
storeID,
|
|
226
|
-
userToken,
|
|
227
|
-
cartToken,
|
|
262
|
+
uuid: uuid,
|
|
263
|
+
storeID: storeID,
|
|
264
|
+
userToken: userToken,
|
|
265
|
+
cartToken: cartToken,
|
|
228
266
|
query: term,
|
|
229
267
|
productId: productID,
|
|
230
|
-
position,
|
|
268
|
+
position: position,
|
|
231
269
|
sessionStart: sessionToken.start,
|
|
232
|
-
type
|
|
270
|
+
type: type
|
|
233
271
|
}),
|
|
234
272
|
callback: callback
|
|
235
273
|
});
|
|
236
274
|
};
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
275
|
+
var reportQuickViewCollection = function (_a) {
|
|
276
|
+
var self = _a.self, report = _a.report, type = _a.type;
|
|
277
|
+
var _b = self.data, userToken = _b.userToken, sessionToken = _b.sessionToken, uuid = _b.uuid, storeID = _b.storeID, cartToken = _b.cartToken;
|
|
278
|
+
var _c = report.data, position = _c.position, productID = _c.productID, collectionID = _c.collectionID;
|
|
279
|
+
var callback = report.callback;
|
|
280
|
+
var categoryName = self.temp.smartCollections.name;
|
|
242
281
|
utils_1.postLoadCallback({
|
|
243
282
|
eventName: report.eventName,
|
|
244
283
|
promise: reporting_1.Reporting.popUpUsed({
|
|
245
|
-
uuid,
|
|
246
|
-
storeID,
|
|
247
|
-
userToken,
|
|
248
|
-
cartToken,
|
|
284
|
+
uuid: uuid,
|
|
285
|
+
storeID: storeID,
|
|
286
|
+
userToken: userToken,
|
|
287
|
+
cartToken: cartToken,
|
|
249
288
|
productId: productID,
|
|
250
|
-
position,
|
|
289
|
+
position: position,
|
|
251
290
|
categoryID: collectionID,
|
|
252
291
|
categoryName: categoryName || utils_2.getCollectionName(self, collectionID),
|
|
253
292
|
sessionStart: sessionToken.start,
|
|
254
|
-
type
|
|
293
|
+
type: type
|
|
255
294
|
}),
|
|
256
295
|
callback: callback
|
|
257
296
|
});
|
|
258
297
|
};
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
298
|
+
var reportSerpProductSeen = function (_a) {
|
|
299
|
+
var self = _a.self, report = _a.report;
|
|
300
|
+
var _b = self.data, userToken = _b.userToken, sessionToken = _b.sessionToken, uuid = _b.uuid, storeID = _b.storeID, cartToken = _b.cartToken;
|
|
301
|
+
var time = report.time, callback = report.callback, targetURL = report.targetURL;
|
|
302
|
+
var _c = report.data, productID = _c.productID, query = _c.query, _d = _c.position, position = _d === void 0 ? 1 : _d, imageID = _c.imageID;
|
|
303
|
+
var waitTime = time ? time : config_1.POST_LOAD_WAIT_TIME;
|
|
304
|
+
setTimeout(function () {
|
|
265
305
|
if (!targetURL || targetURL.includes(window.location.pathname)) {
|
|
266
306
|
utils_3.setRecentSearchProducts(self, productID);
|
|
267
307
|
utils_1.postLoadCallback({
|
|
@@ -270,55 +310,61 @@ const reportSerpProductSeen = ({ self, report }) => {
|
|
|
270
310
|
type: "search",
|
|
271
311
|
term: query,
|
|
272
312
|
originId: query,
|
|
273
|
-
uuid,
|
|
274
|
-
storeID,
|
|
275
|
-
userToken,
|
|
313
|
+
uuid: uuid,
|
|
314
|
+
storeID: storeID,
|
|
315
|
+
userToken: userToken,
|
|
276
316
|
productId: productID,
|
|
277
317
|
sessionStart: sessionToken.start,
|
|
278
|
-
position,
|
|
279
|
-
cartToken,
|
|
318
|
+
position: position,
|
|
319
|
+
cartToken: cartToken,
|
|
280
320
|
recommended: utils_3.isRecentSearchProduct(productID, self),
|
|
281
|
-
imageID
|
|
321
|
+
imageID: imageID
|
|
282
322
|
}),
|
|
283
323
|
callback: callback
|
|
284
324
|
});
|
|
285
325
|
}
|
|
286
326
|
}, waitTime);
|
|
287
327
|
};
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
328
|
+
var reportRecommendationsProductSeen = function (_a) {
|
|
329
|
+
var self = _a.self, report = _a.report;
|
|
330
|
+
var _b = self.data, userToken = _b.userToken, sessionToken = _b.sessionToken, uuid = _b.uuid, storeID = _b.storeID, cartToken = _b.cartToken;
|
|
331
|
+
var time = report.time, callback = report.callback, targetURL = report.targetURL;
|
|
332
|
+
var _c = report.data, productID = _c.productID, _d = _c.position, position = _d === void 0 ? 1 : _d, sourceProductID = _c.sourceProductID;
|
|
333
|
+
var waitTime = time ? time : config_1.POST_LOAD_WAIT_TIME;
|
|
334
|
+
setTimeout(function () {
|
|
294
335
|
if (!targetURL || targetURL.includes(window.location.pathname)) {
|
|
295
336
|
utils_3.setRecentSearchProducts(self, productID);
|
|
296
337
|
utils_1.postLoadCallback({
|
|
297
338
|
eventName: report.eventName,
|
|
298
339
|
promise: reporting_1.Reporting.productSeen({
|
|
299
340
|
type: "related", sourceProduct: sourceProductID,
|
|
300
|
-
uuid, storeID, userToken
|
|
301
|
-
|
|
341
|
+
uuid: uuid, storeID: storeID, userToken: userToken,
|
|
342
|
+
productId: productID,
|
|
343
|
+
cartToken: cartToken,
|
|
344
|
+
sessionStart: sessionToken.start,
|
|
345
|
+
position: position,
|
|
346
|
+
reference: 'isp_rel_prd',
|
|
302
347
|
}),
|
|
303
348
|
callback: callback
|
|
304
349
|
});
|
|
305
350
|
}
|
|
306
351
|
}, waitTime);
|
|
307
352
|
};
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
353
|
+
var reportProductFromCollection = function (_a) {
|
|
354
|
+
var report = _a.report, self = _a.self;
|
|
355
|
+
var _b = self.data, userToken = _b.userToken, sessionToken = _b.sessionToken, uuid = _b.uuid, storeID = _b.storeID, cartToken = _b.cartToken;
|
|
356
|
+
var time = report.time, callback = report.callback, targetURL = report.targetURL;
|
|
357
|
+
var _c = report.data, productID = _c.productID, collectionID = _c.collectionID, _d = _c.position, position = _d === void 0 ? 1 : _d, query = _c.query, imageID = _c.imageID;
|
|
358
|
+
var waitTime = time ? time : config_1.POST_LOAD_WAIT_TIME;
|
|
359
|
+
var isRecommended = utils_2.isRecommendedProduct(productID);
|
|
314
360
|
/* check if categories were fetched, if not retry in 300ms */
|
|
315
361
|
if (!query && self.data.categories.length === 0) {
|
|
316
|
-
setTimeout(()
|
|
317
|
-
reportProductFromCollection({ self, report });
|
|
362
|
+
setTimeout(function () {
|
|
363
|
+
reportProductFromCollection({ self: self, report: report });
|
|
318
364
|
}, 300);
|
|
319
365
|
return;
|
|
320
366
|
}
|
|
321
|
-
setTimeout(()
|
|
367
|
+
setTimeout(function () {
|
|
322
368
|
if (!targetURL || targetURL.includes(window.location.pathname)) {
|
|
323
369
|
utils_2.updateRecentCollectionProducts(productID, collectionID);
|
|
324
370
|
utils_3.setRecentSearchProducts(self, productID);
|
|
@@ -327,59 +373,64 @@ const reportProductFromCollection = ({ report, self }) => {
|
|
|
327
373
|
promise: reporting_1.Reporting.productSeen({
|
|
328
374
|
type: "category",
|
|
329
375
|
categoryName: query || utils_2.getCollectionName(self, collectionID),
|
|
330
|
-
uuid,
|
|
331
|
-
storeID,
|
|
332
|
-
userToken,
|
|
376
|
+
uuid: uuid,
|
|
377
|
+
storeID: storeID,
|
|
378
|
+
userToken: userToken,
|
|
333
379
|
productId: productID,
|
|
334
380
|
categoryID: collectionID,
|
|
335
381
|
sessionStart: sessionToken.start,
|
|
336
|
-
position,
|
|
337
|
-
cartToken,
|
|
382
|
+
position: position,
|
|
383
|
+
cartToken: cartToken,
|
|
338
384
|
recommended: isRecommended,
|
|
339
|
-
imageID
|
|
385
|
+
imageID: imageID
|
|
340
386
|
}),
|
|
341
387
|
callback: callback
|
|
342
388
|
});
|
|
343
389
|
}
|
|
344
390
|
}, waitTime);
|
|
345
391
|
};
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
392
|
+
var reportProductFromLookALike = function (_a) {
|
|
393
|
+
var report = _a.report, self = _a.self;
|
|
394
|
+
var _b = self.data, userToken = _b.userToken, sessionToken = _b.sessionToken, uuid = _b.uuid, storeID = _b.storeID, cartToken = _b.cartToken;
|
|
395
|
+
var time = report.time, callback = report.callback, targetURL = report.targetURL;
|
|
396
|
+
var _c = report.data, productID = _c.productID, _d = _c.position, position = _d === void 0 ? 1 : _d, originalProduct = _c.originalProduct;
|
|
397
|
+
var waitTime = time ? time : config_1.POST_LOAD_WAIT_TIME;
|
|
398
|
+
setTimeout(function () {
|
|
352
399
|
if (!targetURL || targetURL.includes(window.location.pathname)) {
|
|
353
400
|
utils_1.postLoadCallback({
|
|
354
401
|
eventName: report.eventName,
|
|
355
402
|
promise: reporting_1.Reporting.productSeen({
|
|
356
403
|
type: "look a like",
|
|
357
|
-
uuid, storeID
|
|
358
|
-
|
|
404
|
+
uuid: uuid, storeID: storeID, userToken: userToken,
|
|
405
|
+
productId: productID, originProduct: originalProduct,
|
|
406
|
+
sessionStart: sessionToken.start,
|
|
407
|
+
position: position, cartToken: cartToken,
|
|
408
|
+
reference: "isp_look_a_like"
|
|
359
409
|
}),
|
|
360
410
|
callback: callback
|
|
361
411
|
});
|
|
362
412
|
}
|
|
363
413
|
}, waitTime);
|
|
364
414
|
};
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
415
|
+
var reportProductFromQuickView = function (_a) {
|
|
416
|
+
var report = _a.report, self = _a.self;
|
|
417
|
+
var _b = self.data, userToken = _b.userToken, sessionToken = _b.sessionToken, uuid = _b.uuid, storeID = _b.storeID, cartToken = _b.cartToken;
|
|
418
|
+
var time = report.time, callback = report.callback, targetURL = report.targetURL;
|
|
419
|
+
var _c = report.data, productID = _c.productID, _d = _c.position, position = _d === void 0 ? 1 : _d, originalProduct = _c.originalProduct;
|
|
420
|
+
var waitTime = time ? time : config_1.POST_LOAD_WAIT_TIME;
|
|
421
|
+
setTimeout(function () {
|
|
371
422
|
if (!targetURL || targetURL.includes(window.location.pathname)) {
|
|
372
423
|
utils_1.postLoadCallback({
|
|
373
424
|
eventName: report.eventName,
|
|
374
425
|
promise: reporting_1.Reporting.productSeen({
|
|
375
|
-
uuid,
|
|
376
|
-
storeID,
|
|
377
|
-
userToken,
|
|
426
|
+
uuid: uuid,
|
|
427
|
+
storeID: storeID,
|
|
428
|
+
userToken: userToken,
|
|
378
429
|
productId: productID,
|
|
379
430
|
originProduct: originalProduct,
|
|
380
431
|
sessionStart: sessionToken.start,
|
|
381
|
-
position,
|
|
382
|
-
cartToken,
|
|
432
|
+
position: position,
|
|
433
|
+
cartToken: cartToken,
|
|
383
434
|
type: "quick view",
|
|
384
435
|
reference: "isp_look_a_like"
|
|
385
436
|
}),
|
|
@@ -388,34 +439,36 @@ const reportProductFromQuickView = ({ report, self }) => {
|
|
|
388
439
|
}
|
|
389
440
|
}, waitTime);
|
|
390
441
|
};
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
442
|
+
var reportAddToCart = function (_a) {
|
|
443
|
+
var report = _a.report, self = _a.self;
|
|
444
|
+
var _b = self.data, userToken = _b.userToken, sessionToken = _b.sessionToken, uuid = _b.uuid, storeID = _b.storeID, cartToken = _b.cartToken;
|
|
445
|
+
var callback = report.callback;
|
|
446
|
+
var productID = report.data.productID;
|
|
395
447
|
utils_1.postLoadCallback({
|
|
396
448
|
eventName: report.eventName,
|
|
397
449
|
promise: reporting_1.Reporting.addToCart({
|
|
398
|
-
userToken,
|
|
450
|
+
userToken: userToken,
|
|
399
451
|
sessionStart: sessionToken.start,
|
|
400
|
-
uuid,
|
|
401
|
-
storeID,
|
|
402
|
-
cartToken,
|
|
403
|
-
productID
|
|
452
|
+
uuid: uuid,
|
|
453
|
+
storeID: storeID,
|
|
454
|
+
cartToken: cartToken,
|
|
455
|
+
productID: productID
|
|
404
456
|
}),
|
|
405
457
|
callback: callback
|
|
406
458
|
});
|
|
407
459
|
};
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
460
|
+
var reportCartVisited = function (_a) {
|
|
461
|
+
var report = _a.report, self = _a.self;
|
|
462
|
+
var _b = self.data, userToken = _b.userToken, sessionToken = _b.sessionToken, uuid = _b.uuid, storeID = _b.storeID, cartToken = _b.cartToken;
|
|
463
|
+
var callback = report.callback;
|
|
411
464
|
utils_1.postLoadCallback({
|
|
412
465
|
eventName: report.eventName,
|
|
413
466
|
promise: reporting_1.Reporting.addToCart({
|
|
414
|
-
userToken,
|
|
467
|
+
userToken: userToken,
|
|
415
468
|
sessionStart: sessionToken.start,
|
|
416
|
-
uuid,
|
|
417
|
-
storeID,
|
|
418
|
-
cartToken,
|
|
469
|
+
uuid: uuid,
|
|
470
|
+
storeID: storeID,
|
|
471
|
+
cartToken: cartToken,
|
|
419
472
|
}),
|
|
420
473
|
callback: callback
|
|
421
474
|
});
|