· 4 years ago · Jun 15, 2021, 12:56 PM
1var socialproof = function(modules) {
2 function __webpack_require__(moduleId) {
3 if (installedModules[moduleId]) return installedModules[moduleId].exports;
4 var module = installedModules[moduleId] = {
5 i: moduleId,
6 l: !1,
7 exports: {}
8 };
9 return modules[moduleId].call(module.exports, module, module.exports, __webpack_require__), module.l = !0, module.exports
10 }
11 var installedModules = {};
12 return __webpack_require__.m = modules, __webpack_require__.c = installedModules, __webpack_require__.i = function(value) {
13 return value
14 }, __webpack_require__.d = function(exports, name, getter) {
15 __webpack_require__.o(exports, name) || Object.defineProperty(exports, name, {
16 configurable: !1,
17 enumerable: !0,
18 get: getter
19 })
20 }, __webpack_require__.n = function(module) {
21 var getter = module && module.__esModule ? function() {
22 return module.default
23 } : function() {
24 return module
25 };
26 return __webpack_require__.d(getter, "a", getter), getter
27 }, __webpack_require__.o = function(object, property) {
28 return Object.prototype.hasOwnProperty.call(object, property)
29 }, __webpack_require__.p = "", __webpack_require__(__webpack_require__.s = 77)
30}([function(module, exports, __webpack_require__) {
31 "use strict";
32 var docCookies = __webpack_require__(3),
33 replaceArray = function(replaceString, find, replace) {
34 for (var i = 0; i < find.length; i++) replaceString = replaceString.replace(find[i], replace[i]);
35 return replaceString
36 },
37 saveData = function(name, data) {
38 return "undefined" != typeof Storage ? localStorage.setItem(name, JSON.stringify(data, null, 0)) : docCookies.setItem(name, JSON.stringify(data, null, 0)), !0
39 },
40 retriveData = function(name) {
41 return "undefined" != typeof Storage ? JSON.parse(localStorage[name]) : JSON.parse(docCookies.getItem(name))
42 },
43 removeData = function(name) {
44 return "undefined" != typeof Storage ? localStorage.removeItem(name) : docCookies.removeItem(name), !0
45 },
46 getMetaValue = function(meta) {
47 for (var metas = document.getElementsByTagName("meta"), value = null, i = 0; i < metas.length; i++)
48 if (metas[i].getAttribute("property") === meta) {
49 value = metas[i].getAttribute("content");
50 break
51 } return value
52 },
53 getTagAttrValueByRegex = function(tag, attr, regex) {
54 for (var tags = document.getElementsByTagName(tag), value = null, i = 0; i < tags.length; i++) {
55 var attrValue = tags[i].getAttribute(attr);
56 if (attrValue && attrValue.match(regex)) {
57 value = attrValue;
58 break
59 }
60 }
61 return value
62 },
63 getTagAttrValueByKeyValue = function(tag, attr, key, keyValueMatch) {
64 for (var tags = document.getElementsByTagName(tag), value = null, i = 0; i < tags.length; i++) {
65 var attrValue = tags[i].getAttribute(attr),
66 keyValue = tags[i].getAttribute(key);
67 if (attrValue && keyValue && keyValue === keyValueMatch) {
68 value = attrValue;
69 break
70 }
71 }
72 return value
73 },
74 getTagValueByKeyValue = function(tag, key, keyValueMatch) {
75 for (var tags = document.getElementsByTagName(tag), value = null, i = 0; i < tags.length; i++) {
76 var keyValue = tags[i].getAttribute(key);
77 if (keyValue && keyValue === keyValueMatch) {
78 value = tags[i].innerText;
79 break
80 }
81 }
82 return value
83 },
84 getTagValueByKeyRegex = function(tag, key, keyRegex) {
85 for (var tags = document.getElementsByTagName(tag), value = null, i = 0; i < tags.length; i++) {
86 var keyValue = tags[i].getAttribute(key);
87 if (keyValue && keyValue.match(keyRegex)) {
88 value = tags[i].innerText;
89 break
90 }
91 }
92 return value
93 },
94 getDataLayerValueByName = function(name) {
95 var value = null;
96 if (window.dataLayer)
97 for (var i = 0; i < window.dataLayer.length; i++) {
98 for (var context = window.dataLayer[i], namespaces = name.split("."), j = 0; j < namespaces.length && (context = context[namespaces[j]], "undefined" != typeof context); j++);
99 "undefined" != typeof context && (value = context)
100 }
101 return value
102 },
103 createHash = function(s) {
104 for (var chk = 1635136640, len = s.length, i = 0; i < len; i++) chk += s.charCodeAt(i) * (i + 1);
105 return (4294967295 & chk).toString(16)
106 };
107 module.exports = {
108 saveData: saveData,
109 retriveData: retriveData,
110 removeData: removeData,
111 replaceArray: replaceArray,
112 getMetaValue: getMetaValue,
113 getTagAttrValueByRegex: getTagAttrValueByRegex,
114 getTagAttrValueByKeyValue: getTagAttrValueByKeyValue,
115 getTagValueByKeyValue: getTagValueByKeyValue,
116 getTagValueByKeyRegex: getTagValueByKeyRegex,
117 getDataLayerValueByName: getDataLayerValueByName,
118 createHash: createHash
119 }
120}, function(module, exports, __webpack_require__) {
121 "use strict";
122 module.exports = {
123 TRIGGER_TYPE_S_HOMEPAGE: -1,
124 TRIGGER_TYPE_S_CATEGORY: -2,
125 TRIGGER_TYPE_S_SEARCH: -3,
126 TRIGGER_TYPE_S_PRODUCT: -4,
127 TRIGGER_TYPE_S_BASKET: -5,
128 TRIGGER_TYPE_S_THANKYOU: -6,
129 TRIGGER_TYPE_MANUAL: 0,
130 TRIGGER_TYPE_EQ: 1,
131 TRIGGER_TYPE_REGEX: 2,
132 TRIGGER_TYPE_CONTAIN: 3,
133 TRIGGER_TYPE_STARTS: 4,
134 TRIGGER_TYPE_ENDS: 5,
135 TRIGGER_TYPE_EVENT: 6,
136 TRIGGER_TYPE_ANY: 7,
137 TRIGGER_TYPE_BASKET_ADD: 20,
138 TRIGGER_TYPE_BASKET_REMOVE: 21,
139 TRIGGER_TYPE_CLIENT_UPDATE: 30,
140 NOTIFICATION_TYPE_DEPRECATED: -1,
141 NOTIFICATION_TYPE_ALL_PRODUCTS: 0,
142 NOTIFICATION_TYPE_CURRENT_PRODUCT: 1,
143 NOTIFICATION_TYPE_ALL_EVENTS: 2,
144 NOTIFICATION_TYPE_NEW: 3,
145 FILTER_NONE: 0,
146 FILTER_BY_URL: 1,
147 FILTER_BY_PARAM: 2,
148 NO_PRODUCT_EVENT: "!",
149 FORBIDDEN_EVENTS: ["push", "get", "shuffle", "info", "pid", "stat"],
150 AB_COOKIE_NAME: "trustisto_ab",
151 AB_COOKIE_TIME: 31536e3,
152 UID_COOKIE_NAME: "trustisto_uid",
153 UID_COOKIE_TIME: 31536e3,
154 LS_CLIENT_KEY: "trustisto_client",
155 LS_BASKET_KEY: "trustisto_basket",
156 LS_CAPPING_KEY: "trustisto_capping",
157 NOTIFICATION_SOURCE_EVENT: "event",
158 NOTIFICATION_SOURCE_PRODUCT_FEED: "product_feed",
159 NOTIFICATION_SOURCE_STATIC: "static",
160 NOTIFICATION_SOURCE_REVIEW: "review",
161 NOTIFICATION_DISPLAY_STANDARD: 0,
162 NOTIFICATION_DISPLAY_NEW: 1,
163 NOTIFICATION_DISPLAY_INLINE: 2,
164 CAPPING_NOTIFICATIONS: "notification",
165 CAPPING_POPUPS: "popup",
166 CAPPING_ACTION_VIEW: "view",
167 POPUP_EVENT_PREFIX: "socialproof_popup",
168 POPUP_EVENT_CLOSE: "socialproof_popup_close",
169 POPUP_EVENT_FORM: "socialproof_popup_form",
170 POPUP_STAT_ACTION_SHOW: "show",
171 POPUP_STAT_ACTION_ENGAGE: "engage",
172 SELECT_TOOL_DEFAULT: 1,
173 SELECT_TOOL_INLINE: 2
174 }
175}, function(module, exports, __webpack_require__) {
176 "use strict";
177
178 function _classCallCheck(instance, Constructor) {
179 if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function")
180 }
181 Object.defineProperty(exports, "__esModule", {
182 value: !0
183 });
184 var _createClass = function() {
185 function defineProperties(target, props) {
186 for (var i = 0; i < props.length; i++) {
187 var descriptor = props[i];
188 descriptor.enumerable = descriptor.enumerable || !1, descriptor.configurable = !0, "value" in descriptor && (descriptor.writable = !0), Object.defineProperty(target, descriptor.key, descriptor)
189 }
190 }
191 return function(Constructor, protoProps, staticProps) {
192 return protoProps && defineProperties(Constructor.prototype, protoProps), staticProps && defineProperties(Constructor, staticProps), Constructor
193 }
194 }(),
195 XHR = function() {
196 function XHR() {
197 _classCallCheck(this, XHR)
198 }
199 return _createClass(XHR, [{
200 key: "sendPostRequest",
201 value: function(url) {
202 var callback = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : null,
203 postData = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : null,
204 withCredentials = !(arguments.length > 3 && void 0 !== arguments[3]) || arguments[3],
205 cache = arguments.length > 4 && void 0 !== arguments[4] && arguments[4];
206 this.sendRequest(url, callback, !0, withCredentials, postData, cache)
207 }
208 }, {
209 key: "sendGetRequest",
210 value: function(url) {
211 var callback = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : null,
212 withCredentials = !(arguments.length > 2 && void 0 !== arguments[2]) || arguments[2],
213 cache = arguments.length > 3 && void 0 !== arguments[3] && arguments[3];
214 this.sendRequest(url, callback, !1, withCredentials, null, cache)
215 }
216 }, {
217 key: "sendRequest",
218 value: function(url, callback) {
219 var isPost = arguments.length > 2 && void 0 !== arguments[2] && arguments[2],
220 withCredentials = !(arguments.length > 3 && void 0 !== arguments[3]) || arguments[3],
221 postData = arguments.length > 4 && void 0 !== arguments[4] ? arguments[4] : null,
222 req = (arguments.length > 5 && void 0 !== arguments[5] && arguments[5], this.createXMLHTTPObject());
223 if (req) {
224 var method = isPost ? "POST" : "GET";
225 req.open(method, url, !0), req.withCredentials = withCredentials, postData && (req.setRequestHeader("Content-type", "application/json; charset=UTF-8"), req.setRequestHeader("X-Content-Origin", this.checksum(postData))), req.onreadystatechange = function() {
226 if (4 === req.readyState) return 200 !== req.status && 304 !== req.status ? void callback(null, new Error) : void(callback && callback(req, null))
227 }, 4 !== req.readyState && (isPost ? req.send(postData) : req.send())
228 }
229 }
230 }, {
231 key: "xhrFactories",
232 value: function() {
233 return [function() {
234 return new XMLHttpRequest
235 }, function() {
236 return new ActiveXObject("Msxml3.XMLHTTP")
237 }, function() {
238 return new ActiveXObject("Msxml2.XMLHTTP.6.0")
239 }, function() {
240 return new ActiveXObject("Msxml2.XMLHTTP.3.0")
241 }, function() {
242 return new ActiveXObject("Msxml2.XMLHTTP")
243 }, function() {
244 return new ActiveXObject("Microsoft.XMLHTTP")
245 }]
246 }
247 }, {
248 key: "createXMLHTTPObject",
249 value: function() {
250 for (var xmlhttp = !1, factories = this.xhrFactories(), i = 0; i < factories.length; i++) {
251 try {
252 xmlhttp = factories[i]()
253 } catch (e) {
254 continue
255 }
256 break
257 }
258 return xmlhttp
259 }
260 }, {
261 key: "checksum",
262 value: function(s) {
263 for (var chk = 1653027968, len = s.length, i = 0; i < len; i++) chk += s.charCodeAt(i) * (i + 1);
264 return (4294967295 & chk).toString(16)
265 }
266 }]), XHR
267 }();
268 exports.default = XHR, module.exports = exports.default
269}, function(module, exports, __webpack_require__) {
270 "use strict";
271 var docCookies = {
272 getItem: function(sKey) {
273 return sKey ? decodeURIComponent(document.cookie.replace(new RegExp("(?:(?:^|.*;)\\s*" + encodeURIComponent(sKey).replace(/[\-\.\+\*]/g, "\\$&") + "\\s*\\=\\s*([^;]*).*$)|^.*$"), "$1")) || null : null
274 },
275 setItem: function(sKey, sValue, vEnd, sPath, sDomain, bSecure) {
276 if (!sKey || /^(?:expires|max\-age|path|domain|secure)$/i.test(sKey)) return !1;
277 var sExpires = "";
278 if (vEnd) switch (vEnd.constructor) {
279 case Number:
280 sExpires = vEnd === 1 / 0 ? "; expires=Fri, 31 Dec 9999 23:59:59 GMT" : "; max-age=" + vEnd;
281 break;
282 case String:
283 sExpires = "; expires=" + vEnd;
284 break;
285 case Date:
286 sExpires = "; expires=" + vEnd.toUTCString()
287 }
288 return document.cookie = encodeURIComponent(sKey) + "=" + encodeURIComponent(sValue) + sExpires + (sDomain ? "; domain=" + sDomain : "") + (sPath ? "; path=" + sPath : "") + (bSecure ? "; secure" : ""), !0
289 },
290 removeItem: function(sKey, sPath, sDomain) {
291 return !!this.hasItem(sKey) && (document.cookie = encodeURIComponent(sKey) + "=; expires=Thu, 01 Jan 1970 00:00:00 GMT" + (sDomain ? "; domain=" + sDomain : "") + (sPath ? "; path=" + sPath : ""), !0)
292 },
293 hasItem: function(sKey) {
294 return !(!sKey || /^(?:expires|max\-age|path|domain|secure)$/i.test(sKey)) && new RegExp("(?:^|;\\s*)" + encodeURIComponent(sKey).replace(/[\-\.\+\*]/g, "\\$&") + "\\s*\\=").test(document.cookie)
295 },
296 keys: function() {
297 for (var aKeys = document.cookie.replace(/((?:^|\s*;)[^\=]+)(?=;|$)|^\s*|\s*(?:\=[^;]*)?(?:\1|$)/g, "").split(/\s*(?:\=[^;]*)?;\s*/), nLen = aKeys.length, nIdx = 0; nIdx < nLen; nIdx++) aKeys[nIdx] = decodeURIComponent(aKeys[nIdx]);
298 return aKeys
299 }
300 };
301 "undefined" != typeof module && "undefined" != typeof module.exports && (module.exports = docCookies)
302}, function(module, exports, __webpack_require__) {
303 "use strict";
304
305 function getParameterByName(name, url) {
306 url || (url = window.location.href), name = name.replace(/[\[\]]/g, "\\$&");
307 var regex = new RegExp("[?&]" + name + "(=([^&#]*)|&|#|$)"),
308 results = regex.exec(url);
309 return results ? results[2] ? decodeURIComponent(results[2].replace(/\+/g, " ")) : "" : null
310 }
311 module.exports = getParameterByName
312}, function(module, exports, __webpack_require__) {
313 "use strict";
314
315 function _interopRequireDefault(obj) {
316 return obj && obj.__esModule ? obj : {
317 default: obj
318 }
319 }
320
321 function _classCallCheck(instance, Constructor) {
322 if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function")
323 }
324 Object.defineProperty(exports, "__esModule", {
325 value: !0
326 });
327 var _createClass = function() {
328 function defineProperties(target, props) {
329 for (var i = 0; i < props.length; i++) {
330 var descriptor = props[i];
331 descriptor.enumerable = descriptor.enumerable || !1, descriptor.configurable = !0, "value" in descriptor && (descriptor.writable = !0), Object.defineProperty(target, descriptor.key, descriptor)
332 }
333 }
334 return function(Constructor, protoProps, staticProps) {
335 return protoProps && defineProperties(Constructor.prototype, protoProps), staticProps && defineProperties(Constructor, staticProps), Constructor
336 }
337 }(),
338 _object = __webpack_require__(6),
339 _object2 = _interopRequireDefault(_object),
340 CurlyCurly = function() {
341 function CurlyCurly(params, pipes, prettier) {
342 _classCallCheck(this, CurlyCurly), this.params = params, this.pipes = pipes, this.prettier = prettier
343 }
344 return _createClass(CurlyCurly, [{
345 key: "compile",
346 value: function(message) {
347 return message.replace(/{{\s*([\w.[\]]+)\s*([|\s\w^(),."']*)}}/g, function(matched, p, f) {
348 var ret = (0, _object2.default)(this.params, p);
349 if (0 === f.toString().indexOf("|"))
350 for (var fs = f.replace(/\^[,|()]{1}/g, function(esc) {
351 return "^".concat(esc.charCodeAt(1))
352 }), ff = fs.split("|").slice(1), i = 0; i < ff.length; i++) {
353 var fmatch = ff[i].match(/(\w+)\s*\(([\s\w^,."']*)\)/),
354 fname = fmatch[1].trim(),
355 args = fmatch[2].split(",").map(function(p) {
356 return p = p.trim(), 0 !== p.indexOf('"') && 0 !== p.indexOf("'") || (p = p.substring(1, p.length - 1)), p = p.replace(/\^\d+/g, function(esc) {
357 return String.fromCharCode(esc.substring(1))
358 })
359 });
360 "undefined" == typeof ret && 0 !== fname.indexOf("fallback") && (ret = p), this.pipes[fname] && (ret = this.pipes[fname](ret, args))
361 }
362 return "undefined" == typeof ret && (ret = p), this.prettier && (ret = this.prettier(ret)), ret
363 }.bind(this))
364 }
365 }]), CurlyCurly
366 }();
367 exports.default = CurlyCurly, module.exports = exports.default
368}, function(module, exports, __webpack_require__) {
369 "use strict";
370 var _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(obj) {
371 return typeof obj
372 } : function(obj) {
373 return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj
374 },
375 getObjectValueByString = function(o, s) {
376 if ("object" === ("undefined" == typeof o ? "undefined" : _typeof(o))) {
377 s = s.replace(/\[(\w+)\]/g, ".$1"), s = s.replace(/^\./, "");
378 for (var a = s.split("."), i = 0, n = a.length; i < n; ++i) {
379 var k = a[i];
380 if (!(k in o)) return;
381 o = o[k]
382 }
383 return o
384 }
385 return s
386 };
387 module.exports = getObjectValueByString
388}, function(module, exports, __webpack_require__) {
389 "use strict";
390
391 function _defineProperty(obj, key, value) {
392 return key in obj ? Object.defineProperty(obj, key, {
393 value: value,
394 enumerable: !0,
395 configurable: !0,
396 writable: !0
397 }) : obj[key] = value, obj
398 }
399 Object.defineProperty(exports, "__esModule", {
400 value: !0
401 });
402 var _time = __webpack_require__(54),
403 pageCapping = {},
404 CAPPING_LS_NAME = "trustisto_capping",
405 CAPPING_LOG = !0,
406 CAPPING_MAX_DETAILS = 100,
407 log = function(message, params) {
408 CAPPING_LOG && window.SP.log("CAPPING " + message, params)
409 },
410 clearCapping = function() {
411 pageCapping = {}, window.localStorage.deleteItem(CAPPING_LS_NAME)
412 },
413 migrate1to2 = function(capping) {
414 var newCapping = {};
415 newCapping.version = 2, newCapping.global = capping.global, newCapping.notification = {};
416 var notificationIds = Object.keys(capping).filter(function(key) {
417 return ["version", "global", "display", "notification"].indexOf(key) === -1
418 });
419 return notificationIds.forEach(function(notificationId) {
420 newCapping.notification[notificationId] = capping[notificationId]
421 }), newCapping
422 },
423 migrate2to3 = function(capping) {
424 var today = (0, _time.getTimeMarker)(),
425 newCapping = {};
426 return newCapping.version = 3, newCapping.notification = {
427 day: _defineProperty({}, today, {
428 view: {
429 total: capping && capping.global && capping.global[today] || 0,
430 byId: Object.keys(capping && capping.notification || []).reduce(function(acc, curr) {
431 return Object.assign(acc, _defineProperty({}, curr, capping.notification[curr][today] || 0))
432 }, {}),
433 details: Object.keys(capping && capping.display || []).reduce(function(acc, curr) {
434 return Object.assign(acc, _defineProperty({}, curr, capping.display[curr][today] || []))
435 }, {})
436 }
437 }),
438 user: {}
439 }, newCapping
440 },
441 migrateCapping = function() {
442 var capping = JSON.parse(window.localStorage.getItem(CAPPING_LS_NAME) || null) || {};
443 if (1 === capping.version || "undefined" == typeof capping.version) {
444 var capping2 = migrate1to2(capping);
445 log("Migration LS:Capping 1>2 done"), log(capping2);
446 var capping3 = migrate2to3(capping2);
447 log("Migration LS:Capping 2>3 done"), log(capping3), window.localStorage.setItem(CAPPING_LS_NAME, JSON.stringify(capping3)), capping = capping3
448 } else if (2 === capping.version) {
449 var _capping = migrate2to3(capping);
450 log("Migration LS:Capping 2>3 done"), log(_capping), window.localStorage.setItem(CAPPING_LS_NAME, JSON.stringify(_capping)), capping = _capping
451 }
452 log("Initial capping", capping)
453 },
454 isUnderPageCapping = function(object, objectId, action, max) {
455 if (0 === max || "undefined" == typeof max) return !0;
456 var capping = pageCapping,
457 currentValue = null;
458 try {
459 currentValue = objectId ? capping[object].page[action].byId[objectId] : capping[object].page[action].total
460 } catch (_ex) {
461 return !0
462 }
463 return !currentValue || currentValue < max
464 },
465 isUnderDayCapping = function(object, objectId, action, max) {
466 if (0 === max || "undefined" == typeof max) return !0;
467 if (!window.localStorage) return !0;
468 var today = (0, _time.getTimeMarker)(),
469 capping = JSON.parse(window.localStorage.getItem(CAPPING_LS_NAME)) || {},
470 currentValue = null;
471 try {
472 currentValue = objectId ? capping[object].day[today][action].byId[objectId] : capping[object].day[today][action].total
473 } catch (_ex) {
474 return !0
475 }
476 return !currentValue || currentValue < max
477 },
478 isUnderUserCapping = function(object, objectId, action, max) {
479 if (0 === max || "undefined" == typeof max) return !0;
480 if (!window.localStorage) return !0;
481 var capping = JSON.parse(window.localStorage.getItem(CAPPING_LS_NAME)) || {},
482 currentValue = null;
483 try {
484 currentValue = objectId ? capping[object].user[action].byId[objectId] : capping[object].user[action].total
485 } catch (_ex) {
486 return !0
487 }
488 return !currentValue || currentValue < max
489 },
490 addCappedActionPage = function(object, objectId, action, value, details) {
491 var capping = pageCapping;
492 capping[object] = capping[object] || {}, capping[object].page = capping[object].page || {}, capping[object].page[action] = capping[object].page[action] || {}, objectId && (capping[object].page[action].byId = capping[object].page[action].byId || _defineProperty({}, objectId, 0), capping[object].page[action].byId[objectId] = capping[object].page[action].byId[objectId] || 0, capping[object].page[action].byId[objectId] = capping[object].page[action].byId[objectId] + value, details && (capping[object].page[action].details = capping[object].page[action].details || {}, capping[object].page[action].details[objectId] = capping[object].page[action].details[objectId] || [], capping[object].page[action].details[objectId].indexOf(details) === -1 && capping[object].page[action].details[objectId].push(details), capping[object].page[action].details[objectId].length > CAPPING_MAX_DETAILS && capping[object].page[action].details[objectId].shift())), capping[object].page[action].total = capping[object].page[action].total || 0, capping[object].page[action].total = capping[object].page[action].total + value
493 },
494 addCappedActionDay = function(object, objectId, action, value, details) {
495 if (window.localStorage) {
496 var today = (0, _time.getTimeMarker)(),
497 capping = JSON.parse(window.localStorage.getItem(CAPPING_LS_NAME) || null) || {};
498 capping[object] = capping[object] || {}, capping[object].day = capping[object].day || {}, capping[object].day[today] = capping[object].day[today] || {}, capping[object].day[today][action] = capping[object].day[today][action] || {}, objectId && (capping[object].day[today][action].byId = capping[object].day[today][action].byId || {}, capping[object].day[today][action].byId[objectId] = capping[object].day[today][action].byId[objectId] || 0, capping[object].day[today][action].byId[objectId] = capping[object].day[today][action].byId[objectId] + value, details && (capping[object].day[today][action].details = capping[object].day[today][action].details || {}, capping[object].day[today][action].details[objectId] = capping[object].day[today][action].details[objectId] || [], capping[object].day[today][action].details[objectId].indexOf(details) === -1 && capping[object].day[today][action].details[objectId].push(details), capping[object].day[today][action].details[objectId].length > CAPPING_MAX_DETAILS && capping[object].day[today][action].details[objectId].shift())), capping[object].day[today][action].total = capping[object].day[today][action].total || 0, capping[object].day[today][action].total = capping[object].day[today][action].total + value, capping[object].day = _defineProperty({}, today, capping[object].day[today]), window.localStorage.setItem(CAPPING_LS_NAME, JSON.stringify(capping))
499 }
500 },
501 addCappedActionUser = function(object, objectId, action, value, details) {
502 if (window.localStorage) {
503 var capping = JSON.parse(window.localStorage.getItem(CAPPING_LS_NAME)) || {};
504 capping[object] = capping[object] || {}, capping[object].user = capping[object].user || {}, capping[object].user[action] = capping[object].user[action] || {}, objectId && (capping[object].user[action].byId = capping[object].user[action].byId || {}, capping[object].user[action].byId[objectId] = capping[object].user[action].byId[objectId] || 0, capping[object].user[action].byId[objectId] = capping[object].user[action].byId[objectId] + value, details && (capping[object].user[action].details = capping[object].user[action].details || {}, capping[object].user[action].details[objectId] = capping[object].user[action].details[objectId] || [], capping[object].user[action].details[objectId].indexOf(details) === -1 && capping[object].user[action].details[objectId].push(details), capping[object].user[action].details[objectId].length > CAPPING_MAX_DETAILS && capping[object].user[action].details[objectId].shift())), capping[object].user[action].total = capping[object].user[action].total || 0, capping[object].user[action].total = capping[object].user[action].total + value, window.localStorage.setItem(CAPPING_LS_NAME, JSON.stringify(capping))
505 }
506 },
507 addCappedAction = function(object, objectId, action) {
508 var value = arguments.length > 3 && void 0 !== arguments[3] ? arguments[3] : 1,
509 details = arguments.length > 4 && void 0 !== arguments[4] ? arguments[4] : null;
510 addCappedActionPage(object, objectId, action, value, details), addCappedActionDay(object, objectId, action, value, details), addCappedActionUser(object, objectId, action, value, details), log("Updated page capping", pageCapping), log("Updated capping", JSON.parse(window.localStorage.getItem(CAPPING_LS_NAME)))
511 },
512 getCappedActionPageDetails = function(object, objectId, action) {
513 var capping = pageCapping,
514 details = null;
515 try {
516 details = capping[object].page[action].details[objectId]
517 } catch (_ex) {}
518 return details
519 },
520 getCappedActionDayDetails = function(object, objectId, action) {
521 if (!window.localStorage) return null;
522 var today = (0, _time.getTimeMarker)(),
523 capping = JSON.parse(window.localStorage.getItem(CAPPING_LS_NAME)) || {},
524 details = null;
525 try {
526 details = capping[object].day[today][action].details[objectId]
527 } catch (_ex) {
528 return !0
529 }
530 return details
531 },
532 getCappedActionUserDetails = function(object, objectId, action) {
533 if (!window.localStorage) return null;
534 var capping = JSON.parse(window.localStorage.getItem(CAPPING_LS_NAME)) || {},
535 details = null;
536 try {
537 details = capping[object].user[action].details[objectId]
538 } catch (_ex) {
539 return !0
540 }
541 return details
542 };
543 exports.default = {
544 migrateCapping: migrateCapping,
545 clearCapping: clearCapping,
546 isUnderPageCapping: isUnderPageCapping,
547 isUnderDayCapping: isUnderDayCapping,
548 isUnderUserCapping: isUnderUserCapping,
549 addCappedAction: addCappedAction,
550 getCappedActionPageDetails: getCappedActionPageDetails,
551 getCappedActionDayDetails: getCappedActionDayDetails,
552 getCappedActionUserDetails: getCappedActionUserDetails
553 }, module.exports = exports.default
554}, function(module, exports, __webpack_require__) {
555 "use strict";
556 Object.defineProperty(exports, "__esModule", {
557 value: !0
558 });
559 var _slicedToArray = function() {
560 function sliceIterator(arr, i) {
561 var _arr = [],
562 _n = !0,
563 _d = !1,
564 _e = void 0;
565 try {
566 for (var _s, _i = arr[Symbol.iterator](); !(_n = (_s = _i.next()).done) && (_arr.push(_s.value), !i || _arr.length !== i); _n = !0);
567 } catch (err) {
568 _d = !0, _e = err
569 } finally {
570 try {
571 !_n && _i.return && _i.return()
572 } finally {
573 if (_d) throw _e
574 }
575 }
576 return _arr
577 }
578 return function(arr, i) {
579 if (Array.isArray(arr)) return arr;
580 if (Symbol.iterator in Object(arr)) return sliceIterator(arr, i);
581 throw new TypeError("Invalid attempt to destructure non-iterable instance")
582 }
583 }(),
584 pipes = {
585 x: function(v, _ref) {
586 var _ref2 = _slicedToArray(_ref, 1),
587 _x = _ref2[0];
588 return v * _x
589 },
590 trim: function(v) {
591 return ("" + v).trim()
592 },
593 random: function(_v, _ref3) {
594 var _ref4 = _slicedToArray(_ref3, 2),
595 max = _ref4[0],
596 min = _ref4[1];
597 return min = Math.ceil(min || 0), max = Math.floor(max), Math.floor(Math.random() * (max - min)) + min
598 },
599 short: function(v, _ref5) {
600 var _ref6 = _slicedToArray(_ref5, 1),
601 max = _ref6[0];
602 return v.length > max ? v.substring(0, max).trim().concat("...") : v
603 },
604 bold: function(v) {
605 return "<strong>" + v + "</strong>"
606 },
607 count_up: function(v) {
608 return '<span class="socialproof-count-up">' + v + "</span>"
609 },
610 show_up: function(v) {
611 return '<span class="socialproof-show-up">' + v + "</span>"
612 },
613 fallback: function(v, _ref7) {
614 var _ref8 = _slicedToArray(_ref7, 1),
615 _fallback = _ref8[0];
616 return null == v || 0 === v.trim().length ? _fallback : v
617 },
618 fallback_random: function(v, options) {
619 var random = options[Math.floor(Math.random() * options.length)];
620 return null == v || 0 === v.trim().length ? random : v
621 },
622 upcase: function(v) {
623 return v.toUpperCase()
624 },
625 downcase: function(v) {
626 return v.toLowerCase()
627 },
628 propercase: function(v) {
629 return v.replace(/\S*/g, function(txt) {
630 return txt.charAt(0).toUpperCase() + txt.substr(1).toLowerCase()
631 })
632 }
633 };
634 exports.default = pipes, module.exports = exports.default
635}, function(module, exports, __webpack_require__) {
636 "use strict";
637
638 function _interopRequireDefault(obj) {
639 return obj && obj.__esModule ? obj : {
640 default: obj
641 }
642 }
643 var _static = __webpack_require__(1),
644 _static2 = _interopRequireDefault(_static),
645 _trigger_options = __webpack_require__(55),
646 _trigger_options2 = _interopRequireDefault(_trigger_options),
647 checkUrl = function(trigger) {
648 var url = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : window.location.pathname,
649 matchResult = !1;
650 switch (trigger.type) {
651 case _static2.default.TRIGGER_TYPE_ANY:
652 matchResult = !0;
653 break;
654 case _static2.default.TRIGGER_TYPE_EQ:
655 matchResult = url === trigger.value;
656 break;
657 case _static2.default.TRIGGER_TYPE_REGEX:
658 matchResult = new RegExp(trigger.value, "i").test(url);
659 break;
660 case _static2.default.TRIGGER_TYPE_CONTAIN:
661 matchResult = url.indexOf(trigger.value) > -1;
662 break;
663 case _static2.default.TRIGGER_TYPE_STARTS:
664 matchResult = url.substr(0, trigger.value.length) === trigger.value;
665 break;
666 case _static2.default.TRIGGER_TYPE_ENDS:
667 matchResult = url.substr(url.length - trigger.value.length) === trigger.value
668 }
669 return matchResult
670 },
671 getTriggeredObjectPerURL = function() {
672 var triggeredObject = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : [],
673 url = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : window.location.pathname,
674 callback = arguments[2],
675 matches = [];
676 return triggeredObject.forEach(function(item) {
677 for (var i = 0; i < item.triggers.length; i++) checkUrl(item.triggers[i], url) && (window.SP.log("TRIGGER URL met for object:", item), checkAllOptions(item, item.triggers[i], callback))
678 }), matches.filter(function(item) {
679 return item
680 })
681 },
682 getTriggeredObjectPerTriggerType = function() {
683 var triggeredObject = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : [],
684 triggeredTypes = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : [],
685 params = arguments[2],
686 callback = arguments[3],
687 matches = [];
688 return triggeredObject.forEach(function(item) {
689 for (var i = 0; i < item.triggers.length; i++)
690 if (triggeredTypes.indexOf(item.triggers[i].type) > -1) {
691 if (item.triggers[i].type === _static2.default.TRIGGER_TYPE_EVENT && item.triggers[i].value !== params._event) continue;
692 window.SP.log("TRIGGER TYPE " + item.triggers[i].type + " met for object: ", item), checkAllOptions(item, item.triggers[i], callback)
693 }
694 }), matches
695 },
696 checkAllOptions = function(triggeredObject, trigger, callback) {
697 var options = Object.keys(trigger.options || {});
698 if (0 === options.length) {
699 var triggeredObjectCopy = Object.assign({}, triggeredObject);
700 return triggeredObjectCopy.matchTrigger = trigger, void callback(triggeredObjectCopy)
701 }
702 window.SP.log("TRIGGER TYPE " + trigger.type + " OPTIONS checking...", options);
703 var optionsMet = new Array(options.length),
704 checkIfAllOptionsMet = function() {
705 if (optionsMet.filter(function(o) {
706 return o === !0
707 }).length === optionsMet.length) {
708 window.SP.log("TRIGGER TYPE " + trigger.type + " OPTIONS ALL MET!");
709 var _triggeredObjectCopy = Object.assign({}, triggeredObject);
710 _triggeredObjectCopy.matchTrigger = trigger, callback(_triggeredObjectCopy)
711 }
712 },
713 optionsMetCallback = function(optionIndex) {
714 optionsMet[optionIndex] = !0, checkIfAllOptionsMet()
715 };
716 options.forEach(function(option, optionIndex) {
717 var optionParam = trigger.options[option];
718 window.SP.log("TRIGGER OPTION " + option + " checking..."), _trigger_options2.default[option] ? _trigger_options2.default[option](optionParam, function() {
719 window.SP.log("TRIGGER OPTION " + option + " MET"), optionsMetCallback(optionIndex)
720 }) : window.SP.error("TRIGGER OPTION " + option + " definition not found")
721 })
722 };
723 module.exports = {
724 getTriggeredObjectPerTriggerType: getTriggeredObjectPerTriggerType,
725 getTriggeredObjectPerURL: getTriggeredObjectPerURL
726 }
727}, function(module, exports, __webpack_require__) {
728 "use strict";
729 module.exports = {
730 isMobile: function() {
731 var check = !1;
732 return function(a) {
733 (/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test(a) || /1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(a.substr(0, 4))) && (check = !0)
734 }(navigator.userAgent || navigator.vendor || window.opera), check
735 }
736 }
737}, function(module, exports, __webpack_require__) {
738 "use strict";
739
740 function _interopRequireDefault(obj) {
741 return obj && obj.__esModule ? obj : {
742 default: obj
743 }
744 }
745
746 function _toConsumableArray(arr) {
747 if (Array.isArray(arr)) {
748 for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) arr2[i] = arr[i];
749 return arr2
750 }
751 return Array.from(arr)
752 }
753
754 function _classCallCheck(instance, Constructor) {
755 if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function")
756 }
757 Object.defineProperty(exports, "__esModule", {
758 value: !0
759 });
760 var _createClass = function() {
761 function defineProperties(target, props) {
762 for (var i = 0; i < props.length; i++) {
763 var descriptor = props[i];
764 descriptor.enumerable = descriptor.enumerable || !1, descriptor.configurable = !0, "value" in descriptor && (descriptor.writable = !0), Object.defineProperty(target, descriptor.key, descriptor)
765 }
766 }
767 return function(Constructor, protoProps, staticProps) {
768 return protoProps && defineProperties(Constructor.prototype, protoProps), staticProps && defineProperties(Constructor, staticProps), Constructor
769 }
770 }(),
771 _static = __webpack_require__(1),
772 _static2 = _interopRequireDefault(_static),
773 _pipes = __webpack_require__(8),
774 _pipes2 = _interopRequireDefault(_pipes),
775 _curlycurly = __webpack_require__(5),
776 _curlycurly2 = _interopRequireDefault(_curlycurly),
777 _capping = __webpack_require__(7),
778 _capping2 = _interopRequireDefault(_capping),
779 NotificationInfo = function() {
780 function NotificationInfo(appInfo, notification, params, response) {
781 _classCallCheck(this, NotificationInfo), this.appInfo = appInfo, this.notification = notification, this.params = params, this.response = response
782 }
783 return _createClass(NotificationInfo, [{
784 key: "getEventName",
785 value: function() {
786 return this.notification.name
787 }
788 }, {
789 key: "getId",
790 value: function() {
791 return this.notification.id || -1
792 }
793 }, {
794 key: "inLimits",
795 value: function() {
796 var result = !0;
797 return this.notification.min_count > 0 && this.response.event.count < this.notification.min_count && (window.SP.log("NOTIFICATIONS Event Count < MIN for #" + this.notification.id), result = !1), this.notification.max_count > 0 && this.response.event.count > this.notification.max_count && (window.SP.log("NOTIFICATIONS Event Count < MAX for #" + this.notification.id), result = !1), result
798 }
799 }, {
800 key: "isUnderCapping",
801 value: function() {
802 var result = !0;
803 return _capping2.default.isUnderDayCapping(_static2.default.CAPPING_NOTIFICATIONS, this.notification.id, _static2.default.CAPPING_ACTION_VIEW, this.notification.capping_day) || (window.SP.warn("NOTIFICATIONS Day capping is over for #" + this.notification.id), result = !1), _capping2.default.isUnderPageCapping(_static2.default.CAPPING_NOTIFICATIONS, this.notification.id, _static2.default.CAPPING_ACTION_VIEW, this.notification.capping_page) || (window.SP.warn("NOTIFICATIONS Page capping is over for #" + this.notification.id),
804 result = !1), result
805 }
806 }, {
807 key: "canBeDisplayedToday",
808 value: function() {
809 var result = !0;
810 if (this.notification.block_duplicate_view) {
811 var displayTimestamp = parseInt(this.response.event.last),
812 timestamps = _capping2.default.getCappedActionDayDetails(_static2.default.CAPPING_NOTIFICATIONS, this.notification.id, _static2.default.CAPPING_ACTION_VIEW);
813 timestamps && timestamps.indexOf(displayTimestamp) > -1 && (window.SP.warn("NOTIFICATIONS was displayed today #" + this.notification.id), result = !1)
814 }
815 return result
816 }
817 }, {
818 key: "getMessage",
819 value: function() {
820 var event = this.response.event,
821 eventNameL = event.name.toLowerCase(),
822 msg = this.notification.msg,
823 mapObj = {
824 count: event.count,
825 last: event.lastRelativeText,
826 _: null
827 },
828 plurals = this.notification.plurals;
829 if (plurals)
830 for (var pluralsWords = Object.keys(plurals), w = 0; w < pluralsWords.length; w++) mapObj[pluralsWords[w]] = plurals[pluralsWords[w]][event.countPluralIndex];
831 var genders = this.notification.genders;
832 if (genders)
833 for (var gendersWords = Object.keys(genders), g = 0; g < gendersWords.length; g++) mapObj[gendersWords[g]] = genders[gendersWords[g]][event.gender];
834 if (event.lastParams)
835 for (var params = Object.keys(event.lastParams), p = 0; p < params.length; p++) {
836 var param = params[p];
837 mapObj[param] = event.lastParams[param]
838 }
839 var curly = new _curlycurly2.default(mapObj, _pipes2.default);
840 return msg = curly.compile(msg), msg = msg.replace(/href=['"](.*?)["']/g, function(matched, href) {
841 var secureHref = this.secureUrl(href);
842 return 'class="socialproof-message-reset" rel="nofollow" href="' + window.SP.schema + "//api" + window.SP.url + "/stats/notify/" + this.notification.id + "/click?appId=" + window.SP.appId + "&uid=" + window.SP.uid + ("&productId=" + event.productId) + "&ab=" + window.SP.ab.value + ("&event=" + eventNameL) + "&redirect=" + encodeURIComponent(secureHref) + '"'
843 }.bind(this))
844 }
845 }, {
846 key: "getIcon",
847 value: function() {
848 var icon = this.notification.icon;
849 return null === icon ? icon = window.SP.schema + "//js" + window.SP.url + "/icons/notification.png" : 0 === icon.indexOf("//") || 0 === icon.indexOf("http") || 0 === icon.indexOf("data:image") || (icon = window.SP.schema + "//js" + window.SP.url + "/icons/" + icon), icon
850 }
851 }, {
852 key: "getImage",
853 value: function() {
854 var image = this.getIcon(),
855 fallbackImage = image;
856 return "undefined" == typeof this.notification.show_image && (this.notification.show_image = !0), this.notification.show_image && this.response.event.lastParams && this.response.event.lastParams.image && "null" !== this.response.event.lastParams.image && (image = this.response.event.lastParams.image), 0 === image.indexOf("://") && (image = image.substring(1)), 0 === image.indexOf("http:") && (image = image.substring(5)), this.secureUrl(image, fallbackImage)
857 }
858 }, {
859 key: "getLink",
860 value: function() {
861 var link = null;
862 return this.notification.options && this.notification.options.link ? link = this.notification.options.link : (this.response.event.lastParams && (link = this.response.event.lastParams.image_link || this.response.event.lastParams.link), "null" !== link && "undefined" != typeof link || (link = null), this.secureUrl(link))
863 }
864 }, {
865 key: "saveDisplay",
866 value: function() {
867 var displayTimestamp = parseInt(this.response.event.last);
868 _capping2.default.addCappedAction(_static2.default.CAPPING_NOTIFICATIONS, this.notification.id, _static2.default.CAPPING_ACTION_VIEW, 1, displayTimestamp)
869 }
870 }, {
871 key: "notify",
872 value: function(callback) {
873 this.saveDisplay(), callback(this.response.event, this.getMessage(), this.getImage(), this.getLink(), this.getId())
874 }
875 }, {
876 key: "secureUrl",
877 value: function(url) {
878 var fallback = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : null,
879 allowedDomains = arguments[2];
880 if (null === url) return null;
881 if ("false" === this.appInfo.domainValidation) return window.SP.log("NOTIFICATIONS Domain validation is OFF, not securing url: " + url), url;
882 var secure = null;
883 window.SP.log("NOTIFICATIONS Apply security for link: " + url), 0 === url.indexOf("http") || (0 === url.indexOf("//") ? url = window.SP.location.protocol + url : 0 === url.indexOf("/") ? (url = window.SP.location.origin + url, secure = !0) : 0 === url.indexOf("data:image") ? secure = !0 : (url = window.SP.location.origin + "/" + url, secure = !0));
884 var withoutWWW = function(host) {
885 return 0 === host.indexOf("www.") ? host.slice(4) : host
886 };
887 if (!secure) try {
888 var current = new URL(url);
889 if (current.host)
890 if (withoutWWW(current.host) === withoutWWW(window.SP.location.host)) secure = !0;
891 else {
892 var allowed = this.appInfo.allowedDomains ? this.appInfo.allowedDomains.split(";") : [];
893 allowedDomains && (allowed = [].concat(_toConsumableArray(allowed), _toConsumableArray(allowedDomains))), allowed.push("js" + window.SP.url), allowed.indexOf(current.host) > -1 && (secure = !0)
894 }
895 else secure = !1
896 } catch (ex) {
897 secure = !1, window.SP.log("NOTIFICATIONS Exception when secureUrl()"), window.SP.log("NOTIFICATIONS", ex)
898 }
899 return !secure && fallback ? (window.SP.error("NOTIFICATIONS URL " + url + " not secure, using fallback: " + fallback), url = fallback) : secure || (window.SP.error("NOTIFICATIONS URL " + url + " not secure!"), url = window.SP.location.origin), window.SP.log("NOTIFICATIONS Final secure URL: " + url), url
900 }
901 }]), NotificationInfo
902 }();
903 exports.default = NotificationInfo, module.exports = exports.default
904}, function(module, exports, __webpack_require__) {
905 "use strict";
906 var evValue = function(value) {
907 var result = value;
908 if ("string" == typeof value && 0 === value.indexOf("$")) {
909 var funcArr = value.split(","),
910 funcName = funcArr[0].substr(1);
911 result = funcArr.length > 1 ? evCall(funcName, window, funcArr[1], funcArr[2], funcArr[3], funcArr[4]) : evCall(funcName, window)
912 }
913 return result
914 },
915 evObject = function(object) {
916 var result = object;
917 for (var key in object) Object.prototype.hasOwnProperty.call(object, key) && (result[key] = evValue(object[key]));
918 return result
919 },
920 evCall = function(functionName, context) {
921 for (var args = Array.prototype.slice.call(arguments, 2), namespaces = functionName.split("."), func = namespaces.pop(), i = 0; i < namespaces.length; i++) context = context[namespaces[i]];
922 return context[func].apply(context, args)
923 },
924 evArrayOfObjects = function(array) {
925 var result = array;
926 if (array.constructor === Array)
927 for (var l = array.length, i = 0; i < l; i++) result[i] = evObject(array[i]);
928 return result
929 };
930 module.exports = function(base) {
931 return {
932 ev: function(name) {
933 return base.initialiazed ? base.evValue(name) : void base.q(["ev", name])
934 },
935 evValue: evValue,
936 evObject: evObject,
937 evCall: evCall,
938 evArrayOfObjects: evArrayOfObjects
939 }
940 }
941}, function(module, exports, __webpack_require__) {
942 "use strict";
943
944 function _classCallCheck(instance, Constructor) {
945 if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function")
946 }
947 Object.defineProperty(exports, "__esModule", {
948 value: !0
949 });
950 var _createClass = function() {
951 function defineProperties(target, props) {
952 for (var i = 0; i < props.length; i++) {
953 var descriptor = props[i];
954 descriptor.enumerable = descriptor.enumerable || !1, descriptor.configurable = !0, "value" in descriptor && (descriptor.writable = !0), Object.defineProperty(target, descriptor.key, descriptor)
955 }
956 }
957 return function(Constructor, protoProps, staticProps) {
958 return protoProps && defineProperties(Constructor.prototype, protoProps), staticProps && defineProperties(Constructor, staticProps), Constructor
959 }
960 }(),
961 QUEUE_LOG = 0,
962 STATUS = {
963 STOPED: 0,
964 RUNNING: 1,
965 PAUSED: 3
966 },
967 Queue = function() {
968 function Queue(name, timing, sort, callback) {
969 _classCallCheck(this, Queue), this.name = name, this.startTime = 0, this.q = [], this.c = callback, this.t = null, this.timing = timing || {}, this.sort = sort, this.status = STATUS.STOPED
970 }
971 return _createClass(Queue, [{
972 key: "setTiming",
973 value: function(timing) {
974 this.log("Timing", timing), this.timing = timing
975 }
976 }, {
977 key: "setNotifyCallback",
978 value: function(callback) {
979 this.c = callback
980 }
981 }, {
982 key: "setSortFunction",
983 value: function(sortFunction) {
984 this.sort = sortFunction
985 }
986 }, {
987 key: "callCallback",
988 value: function(item) {
989 if (this.c) return this.c(item)
990 }
991 }, {
992 key: "log",
993 value: function(msg, params) {
994 if (QUEUE_LOG) {
995 var timeFromStart = Math.floor((Date.now() - this.startTime) / 1e3);
996 window.SP.log("QUEUE " + this.name + " [" + timeFromStart + "] " + msg, params)
997 }
998 }
999 }, {
1000 key: "push",
1001 value: function(obj) {
1002 this.log("PUSH", obj), this.q.push(obj), this.q.sort(this.sort), this.status === STATUS.PAUSED && this.resume()
1003 }
1004 }, {
1005 key: "pause",
1006 value: function() {
1007 this.log("PAUSE"), this.status = STATUS.PAUSED, clearInterval(this.t)
1008 }
1009 }, {
1010 key: "resume",
1011 value: function() {
1012 var _this = this;
1013 this.log("RESUME"), this.status = STATUS.RUNNING, this.tick(), this.status === STATUS.RUNNING && (this.t = setInterval(function() {
1014 return _this.tick()
1015 }, this.timing.showTime + this.timing.spanTime))
1016 }
1017 }, {
1018 key: "start",
1019 value: function() {
1020 var _this2 = this;
1021 this.startTime = Date.now(), this.log("START"), this.status = STATUS.STOPED, setTimeout(function() {
1022 return _this2.resume()
1023 }, this.timing.startTime)
1024 }
1025 }, {
1026 key: "tick",
1027 value: function() {
1028 if (this.log("TICK"), 0 !== this.q.length) {
1029 var e = this.q.shift();
1030 this.log("ITEM SHIFT", e);
1031 var ret = this.callCallback(e);
1032 ret || this.tick()
1033 } else this.pause()
1034 }
1035 }]), Queue
1036 }();
1037 exports.default = Queue, module.exports = exports.default
1038}, function(module, exports, __webpack_require__) {
1039 "use strict";
1040
1041 function _interopRequireDefault(obj) {
1042 return obj && obj.__esModule ? obj : {
1043 default: obj
1044 }
1045 }
1046
1047 function _classCallCheck(instance, Constructor) {
1048 if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function")
1049 }
1050 Object.defineProperty(exports, "__esModule", {
1051 value: !0
1052 });
1053 var _createClass = function() {
1054 function defineProperties(target, props) {
1055 for (var i = 0; i < props.length; i++) {
1056 var descriptor = props[i];
1057 descriptor.enumerable = descriptor.enumerable || !1, descriptor.configurable = !0, "value" in descriptor && (descriptor.writable = !0), Object.defineProperty(target, descriptor.key, descriptor)
1058 }
1059 }
1060 return function(Constructor, protoProps, staticProps) {
1061 return protoProps && defineProperties(Constructor.prototype, protoProps), staticProps && defineProperties(Constructor, staticProps), Constructor
1062 }
1063 }(),
1064 _notificator_config = __webpack_require__(16),
1065 _notificator_config2 = _interopRequireDefault(_notificator_config),
1066 _doc_cookies = __webpack_require__(3),
1067 _doc_cookies2 = _interopRequireDefault(_doc_cookies),
1068 Notification = function() {
1069 function Notification(event, message, image, link, brandless, id) {
1070 _classCallCheck(this, Notification), this.event = event, this.message = message, this.image = image || "https://js.trustisto.com/icon.png", this.link = link, this.brandless = brandless, this.id = id
1071 }
1072 return _createClass(Notification, [{
1073 key: "getElement",
1074 value: function() {
1075 var n = document.createElement("div");
1076 n.className = _notificator_config2.default.NOTIFICATION_CLASS + " event-" + this.event.name, n.id = "notify-" + (new Date).getTime();
1077 var imgCrop = document.createElement("div");
1078 imgCrop.className = _notificator_config2.default.IMAGE_CROP_CLASS;
1079 var img = document.createElement("img");
1080 if (img.src = this.image, img.alt = this.event.name, img.className = _notificator_config2.default.IMAGE_CLASS, img.alt = this.event.name, img.border = 0, this.link) {
1081 var imgLink = document.createElement("a");
1082 imgLink.rel = "nofollow", imgLink.className = _notificator_config2.default.IMAGE_LINK_CLASS;
1083 var redirect = window.SP.schema + "//api" + window.SP.url + "/stats/" + this.event.name.toLowerCase() + "/click?appId=" + window.SP.appId + "&uid=" + window.SP.uid + "¬ificationId=" + this.id + "&productId=" + this.event.productId + "&ab=" + window.SP.ab.value + "&statToken=" + this.event.statToken + "&redirect=";
1084 imgLink.href = redirect + encodeURIComponent(this.link), imgLink.appendChild(img), imgCrop.appendChild(imgLink)
1085 } else imgCrop.appendChild(img);
1086 n.appendChild(imgCrop);
1087 var p = document.createElement("p");
1088 p.className = _notificator_config2.default.TEXT_CLASS;
1089 var span = document.createElement("span");
1090 span.className = _notificator_config2.default.MESSAGE_CLASS, span.innerHTML = this.message, p.appendChild(span);
1091 var lastTime = document.createElement("small");
1092 if (lastTime.className = _notificator_config2.default.LASTTIME_CLASS, lastTime.innerHTML = this.event.lastRelativeText, p.appendChild(lastTime), n.appendChild(p), !this.brandless) {
1093 var brand = document.createElement("span");
1094 brand.className = _notificator_config2.default.BRAND_CLASS, brand.innerHTML = '<a target="_blank" class="' + _notificator_config2.default.BRAND_LINK_CLASS + '" href="' + _notificator_config2.default.BRAND_LINK + encodeURIComponent(window.location.origin) + '" rel="nofollow">Trustisto</a>', n.appendChild(brand)
1095 }
1096 if (!this.event.isTestEvent) {
1097 var notifyPixel = document.createElement("img");
1098 notifyPixel.alt = this.event.name, notifyPixel.src = window.SP.schema + "//api" + window.SP.url + "/stats/notify/" + this.id + "/notify.png?appId=" + window.SP.appId + "&uid=" + window.SP.uid + "&productId=" + this.event.productId + "&ab=" + window.SP.ab.value + (this.event.name ? "&event=" + this.event.name : ""), notifyPixel.className = _notificator_config2.default.NOTIFY_PIXEL_CLASS, notifyPixel.alt = this.event.name, notifyPixel.width = 0, notifyPixel.height = 0, n.appendChild(notifyPixel)
1099 }
1100 var close = document.createElement("span");
1101 return close.className = _notificator_config2.default.DISSMISS_CLASS, close.onclick = function(_e) {
1102 n.className = n.className + " fade-out", n.addEventListener("transitionend", function() {
1103 document.getElementById(_notificator_config2.default.CONTAINER_ID).removeChild(n.parentElement)
1104 }, !1), _doc_cookies2.default.setItem("trustisto_block", !0, 86400, "/")
1105 }, n.appendChild(close), n
1106 }
1107 }]), Notification
1108 }();
1109 exports.default = Notification, module.exports = exports.default
1110}, function(module, exports, __webpack_require__) {
1111 "use strict";
1112 Object.defineProperty(exports, "__esModule", {
1113 value: !0
1114 });
1115 exports.sortNotification = function(a, b) {
1116 if (a.notification) {
1117 var comparePriority = (b.notification.priority || 0) - (a.notification.priority || 0);
1118 if (0 === comparePriority) {
1119 var aT = a.response.event ? parseInt(a.response.event.last) : 0,
1120 bT = b.response.event ? parseInt(b.response.event.last) : 0;
1121 return bT - aT
1122 }
1123 return comparePriority
1124 }
1125 return 0
1126 }
1127}, function(module, exports, __webpack_require__) {
1128 "use strict";
1129 Object.defineProperty(exports, "__esModule", {
1130 value: !0
1131 }), exports.default = {
1132 CONTAINER_CLASS: "socialproof-reset socialproof-container",
1133 CONTAINER_ID: "socialproof-container",
1134 NOTIFICATION_WRAPPER_CLASS: "socialproof-reset socialproof-wrapper",
1135 NOTIFICATION_CLASS: "socialproof-reset socialproof",
1136 IMAGE_CROP_CLASS: "socialproof-reset socialproof-image-crop",
1137 IMAGE_LINK_CLASS: "socialproof-reset socialproof-image-link",
1138 IMAGE_CLASS: "socialproof-reset socialproof-image",
1139 TEXT_CLASS: "socialproof-reset socialproof-text",
1140 MESSAGE_CLASS: "socialproof-reset socialproof-message",
1141 LASTTIME_CLASS: "socialproof-reset socialproof-lasttime",
1142 BRAND_CLASS: "socialproof-reset socialproof-brand",
1143 BRAND_LINK_CLASS: "socialproof-reset socialproof-brand-link",
1144 BRAND_LINK: "https://js.trustisto.com/hello.html?url=",
1145 NOTIFY_PIXEL_CLASS: "socialproof-reset socialproof-pixel",
1146 DISSMISS_CLASS: "socialproof-reset socialproof-dissmiss",
1147 MARGIN_BETWEEEN_NOTIFICATIONS: 5
1148 }, module.exports = exports.default
1149}, function(module, exports, __webpack_require__) {
1150 "use strict";
1151 Object.defineProperty(exports, "__esModule", {
1152 value: !0
1153 }), exports.default = {
1154 CONTAINER_ID: "socialproof-container-new",
1155 NOTIFICATION_NEW_CONTAINER_CLASS: "socialproof-new-reset",
1156 NOTIFICATION_NEW_CLASS: "socialproof-new-reset socialproof-new socialproof-new-mobile socialproof-new-fade-in",
1157 NOTIFICATION_NEW_ICON_WRAPPER_CLASS: "socialproof-new-reset socialproof-new-icon",
1158 NOTIFICATION_NEW_ICON_CLASS: "socialproof-new-reset socialproof-new-icon-img",
1159 NOTIFICATION_NEW_CONTENT_CLASS: "socialproof-new-reset socialproof-new-content",
1160 NOTIFICATION_NEW_TIMEAGO_CLASS: "socialproof-new-reset socialproof-new-last-time",
1161 NOTIFICATION_NEW_CLOSE_CLASS: "socialproof-new-reset socialproof-new-close",
1162 NOTIFICATION_NEW_ICON_SVG: '<svg viewBox="0 0 231.32 229.56"><path d="M115.66,175.06c-33.55,0-60.74-26.99-60.74-60.28c0-33.29,27.19-60.28,60.74-60.28s60.74,26.99,60.74,60.28 C176.4,148.07,149.21,175.06,115.66,175.06 M115.66,0C51.78,0,0,51.39,0,114.78c0,63.39,51.78,114.78,115.66,114.78 c63.88,0,115.66-51.39,115.66-114.78V0H115.66z"></path></svg>',
1163 NOTIFICATION_NEW_FADE_OUT_ANIMATION_CLASS: "socialproof-new-fade-out",
1164 NOTIFICATION_NEW_PIXEL_CLASS: "socialproof-new-reset socialproof-new-pixel",
1165 NOTIFICATION_NEW_TEXT_CLASS: "socialproof-new-reset socialproof-new-text"
1166 }, module.exports = exports.default
1167}, function(module, exports, __webpack_require__) {
1168 "use strict";
1169 var getMetaValue = __webpack_require__(0).getMetaValue,
1170 _saveData = __webpack_require__(0).saveData,
1171 retriveData = __webpack_require__(0).retriveData,
1172 removeData = __webpack_require__(0).removeData,
1173 getTagAttrValueByRegex = __webpack_require__(0).getTagAttrValueByRegex,
1174 getTagAttrValueByKeyValue = __webpack_require__(0).getTagAttrValueByKeyValue,
1175 getDataLayerValueByName = __webpack_require__(0).getDataLayerValueByName,
1176 getTagValueByKeyValue = __webpack_require__(0).getTagValueByKeyValue,
1177 getTagValueByKeyRegex = __webpack_require__(0).getTagValueByKeyRegex,
1178 _require = __webpack_require__(12)(),
1179 evObject = _require.evObject,
1180 evArrayOfObjects = _require.evArrayOfObjects;
1181 module.exports = {
1182 getMetaValue: getMetaValue,
1183 getTagAttrValueByRegex: getTagAttrValueByRegex,
1184 getTagAttrValueByKeyValue: getTagAttrValueByKeyValue,
1185 getDataLayerValueByName: getDataLayerValueByName,
1186 getTagValueByKeyValue: getTagValueByKeyValue,
1187 getTagValueByKeyRegex: getTagValueByKeyRegex,
1188 retriveData: retriveData,
1189 saveData: function(key, value) {
1190 var valueToSave = value;
1191 if ("string" == typeof value && 0 === value.indexOf("$")) {
1192 var varName = value.substr(1);
1193 valueToSave = evObject(window[varName])
1194 }
1195 _saveData(key, valueToSave)
1196 },
1197 saveCart: function(cart) {
1198 var cartToSave = cart;
1199 if ("string" == typeof cart && 0 === cart.indexOf("$")) {
1200 var varName = cart.substr(1);
1201 cartToSave = evArrayOfObjects(window[varName])
1202 }
1203 _saveData("trustisto_cart", cartToSave)
1204 },
1205 saveDelivery: function(delivery) {
1206 var deliveryToSave = delivery;
1207 if ("string" == typeof delivery && 0 === delivery.indexOf("$")) {
1208 var varDelivery = delivery.substr(1);
1209 deliveryToSave = evObject(window[varDelivery])
1210 }
1211 _saveData("trustisto_delivery", deliveryToSave)
1212 },
1213 callCart: function() {
1214 for (var cart = retriveData("trustisto_cart"), o = 0; o < cart.length; o++) {
1215 var item = cart[o];
1216 SP.go("buyProduct", item.product_id, {
1217 product: item.product_name,
1218 link: item.product_url,
1219 image: item.product_img,
1220 quantity: item.quantity,
1221 price: item.sum / item.quantity,
1222 sum: item.sum
1223 })
1224 }
1225 removeData("trustisto_cart")
1226 },
1227 callNewCart: function() {
1228 for (var cart = retriveData("trustisto_cart"), o = 0; o < cart.length; o++) {
1229 var item = cart[o];
1230 SP.go("push", "buy", {
1231 productId: item.product_id,
1232 product: item.product_name,
1233 link: item.product_url,
1234 image: item.product_img,
1235 quantity: item.quantity,
1236 price: item.sum / item.quantity,
1237 sum: item.sum
1238 })
1239 }
1240 removeData("trustisto_cart")
1241 },
1242 callNewCartWithDelivery: function() {
1243 for (var cart = retriveData("trustisto_cart"), delivery = retriveData("trustisto_delivery"), o = 0; o < cart.length; o++) {
1244 var item = cart[o];
1245 SP.go("push", "buy", {
1246 firstname: delivery.firstname,
1247 city: delivery.city,
1248 productId: item.product_id,
1249 product: item.product_name,
1250 link: item.product_url,
1251 image: item.product_img,
1252 quantity: item.quantity,
1253 price: item.sum / item.quantity,
1254 sum: item.sum
1255 })
1256 }
1257 removeData("trustisto_cart"), removeData("trustisto_delivery")
1258 }
1259 }
1260}, function(module, exports, __webpack_require__) {
1261 "use strict";
1262
1263 function _interopRequireDefault(obj) {
1264 return obj && obj.__esModule ? obj : {
1265 default: obj
1266 }
1267 }
1268
1269 function _classCallCheck(instance, Constructor) {
1270 if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function")
1271 }
1272 Object.defineProperty(exports, "__esModule", {
1273 value: !0
1274 });
1275 var _createClass = function() {
1276 function defineProperties(target, props) {
1277 for (var i = 0; i < props.length; i++) {
1278 var descriptor = props[i];
1279 descriptor.enumerable = descriptor.enumerable || !1, descriptor.configurable = !0, "value" in descriptor && (descriptor.writable = !0), Object.defineProperty(target, descriptor.key, descriptor)
1280 }
1281 }
1282 return function(Constructor, protoProps, staticProps) {
1283 return protoProps && defineProperties(Constructor.prototype, protoProps), staticProps && defineProperties(Constructor, staticProps), Constructor
1284 }
1285 }(),
1286 _xhr = __webpack_require__(2),
1287 _xhr2 = _interopRequireDefault(_xhr),
1288 Configuration = function() {
1289 function Configuration(baseUrl) {
1290 _classCallCheck(this, Configuration), this.baseUrl = baseUrl, this.config = null
1291 }
1292 return _createClass(Configuration, [{
1293 key: "download",
1294 value: function(link, callback) {
1295 var a = new _xhr2.default;
1296 a.sendGetRequest(window.SP.schema + "//js" + this.baseUrl + link, function(req, error) {
1297 error ? window.SP.error("No configuration found! Is website published properly?") : (this.config = JSON.parse(req.responseText), callback())
1298 }.bind(this), !1, !0)
1299 }
1300 }, {
1301 key: "isBrandless",
1302 value: function() {
1303 return this.config.brandless === !0
1304 }
1305 }]), Configuration
1306 }();
1307 exports.default = Configuration, module.exports = exports.default
1308}, , , function(module, exports, __webpack_require__) {
1309 "use strict";
1310 var _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(obj) {
1311 return typeof obj
1312 } : function(obj) {
1313 return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj
1314 },
1315 plugin = function(lib, module) {
1316 if ("object" === ("undefined" == typeof module ? "undefined" : _typeof(module))) {
1317 var _iteratorNormalCompletion = !0,
1318 _didIteratorError = !1,
1319 _iteratorError = void 0;
1320 try {
1321 for (var _step, _iterator = Object.keys(module)[Symbol.iterator](); !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = !0) {
1322 var moduleKey = _step.value;
1323 if (lib[moduleKey]) throw new Error("Plugin crytical ERROR. " + moduleKey + " is already defined in library")
1324 }
1325 } catch (err) {
1326 _didIteratorError = !0, _iteratorError = err
1327 } finally {
1328 try {
1329 !_iteratorNormalCompletion && _iterator.return && _iterator.return()
1330 } finally {
1331 if (_didIteratorError) throw _iteratorError
1332 }
1333 }
1334 }
1335 Object.assign(lib, module)
1336 };
1337 module.exports = plugin
1338}, , , function(module, exports, __webpack_require__) {
1339 "use strict";
1340
1341 function _interopRequireDefault(obj) {
1342 return obj && obj.__esModule ? obj : {
1343 default: obj
1344 }
1345 }
1346
1347 function _classCallCheck(instance, Constructor) {
1348 if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function")
1349 }
1350 var _createClass = function() {
1351 function defineProperties(target, props) {
1352 for (var i = 0; i < props.length; i++) {
1353 var descriptor = props[i];
1354 descriptor.enumerable = descriptor.enumerable || !1, descriptor.configurable = !0, "value" in descriptor && (descriptor.writable = !0), Object.defineProperty(target, descriptor.key, descriptor)
1355 }
1356 }
1357 return function(Constructor, protoProps, staticProps) {
1358 return protoProps && defineProperties(Constructor.prototype, protoProps), staticProps && defineProperties(Constructor, staticProps), Constructor
1359 }
1360 }(),
1361 _static = __webpack_require__(1),
1362 _static2 = _interopRequireDefault(_static),
1363 _doc_cookies = __webpack_require__(3),
1364 _doc_cookies2 = _interopRequireDefault(_doc_cookies),
1365 ABTest = function() {
1366 function ABTest() {
1367 _classCallCheck(this, ABTest);
1368 var ab = _doc_cookies2.default.getItem(_static2.default.AB_COOKIE_NAME);
1369 ab && "c" !== ab || (ab = Math.random() >= .5 ? "a" : "b", _doc_cookies2.default.setItem(_static2.default.AB_COOKIE_NAME, ab, _static2.default.AB_COOKIE_TIME, "/")), this.value = ab
1370 }
1371 return _createClass(ABTest, [{
1372 key: "beforeNotification",
1373 value: function() {
1374 "b" !== this.value && (_doc_cookies2.default.setItem(_static2.default.AB_COOKIE_NAME, "b", _static2.default.AB_COOKIE_TIME, "/"), this.value = "b")
1375 }
1376 }]), ABTest
1377 }();
1378 module.exports = function(_base) {
1379 return {
1380 ab: new ABTest
1381 }
1382 }
1383}, function(module, exports, __webpack_require__) {
1384 "use strict";
1385
1386 function _interopRequireDefault(obj) {
1387 return obj && obj.__esModule ? obj : {
1388 default: obj
1389 }
1390 }
1391 var _xhr = __webpack_require__(2),
1392 _xhr2 = _interopRequireDefault(_xhr),
1393 isEventAvailable = function(configuration, event) {
1394 return event.name.toLowerCase() in configuration.config.events
1395 },
1396 getEventDefaultTimespan = function(configuration, eventName) {
1397 var eventNameL = eventName.toLowerCase();
1398 return configuration.config.events[eventNameL].timespan || ("view" === eventNameL ? 3600 : 86400)
1399 },
1400 getEventMsg = function(configuration, event) {
1401 var eventNameL = event.name.toLowerCase(),
1402 msg = configuration.config.events[eventNameL].msg,
1403 mapObj = {
1404 "{{count}}": event.count,
1405 "{{last}}": event.lastRelativeText
1406 },
1407 plurals = configuration.config.events[eventNameL].plurals;
1408 if (plurals)
1409 for (var pluralsWords = Object.keys(plurals), w = 0; w < pluralsWords.length; w++) mapObj["{{" + pluralsWords[w] + "}}"] = plurals[pluralsWords[w]][event.countPluralIndex];
1410 var genders = configuration.config.events[eventNameL].genders;
1411 if (genders)
1412 for (var gendersWords = Object.keys(genders), g = 0; g < gendersWords.length; g++) mapObj["{{" + gendersWords[g] + "}}"] = genders[gendersWords[g]][event.gender];
1413 if (event.lastParams)
1414 for (var params = Object.keys(event.lastParams), p = 0; p < params.length; p++) {
1415 var param = params[p];
1416 mapObj["{{" + param + "}}"] = event.lastParams[param]
1417 }
1418 return msg = msg.replace(new RegExp(Object.keys(mapObj).join("|"), "gi"), function(matched) {
1419 return mapObj[matched]
1420 }), msg = msg.replace(/href=['"](.+)["']/g, function(matched, href) {
1421 return 'class="socialproof-message-reset" rel="nofollow" href="' + window.SP.schema + "//api" + window.SP.url + "/stats/" + eventNameL + "/click?appId=" + window.SP.appId + "&uid=" + window.SP.uid + "¬ificationId=-1&productId=" + event.productId + "&ab=" + window.SP.ab.value + "&statToken=" + event.statToken + "&redirect=" + encodeURIComponent(href) + '"'
1422 })
1423 };
1424 module.exports = function(base) {
1425 var eventCall = function(isPost, event, callback) {
1426 if (base.initialiazed) {
1427 if (isEventAvailable(base.configuration, event)) {
1428 var a = new _xhr2.default;
1429 a.sendRequest(window.SP.schema + "//api" + window.SP.url + "/events/" + event.name.toLowerCase() + "?appId=" + base.appId + "&uid=" + base.uid + "&productId=" + base.evValue(event.productId) + "&ab=" + base.ab.value + "×pan=" + getEventDefaultTimespan(base.configuration, event.name.toLowerCase()), function(req, error) {
1430 if (!error) {
1431 var response = JSON.parse(req.responseText);
1432 callback(response, getEventMsg(base.configuration, response.event))
1433 }
1434 }, isPost, !0, isPost ? JSON.stringify(base.evObject(event.params)) : null)
1435 }
1436 } else {
1437 var result = {
1438 result: "error",
1439 error: "Trustisto has not been initalized"
1440 };
1441 callback(result), window.SP.error("Trustisto: SDK has not been initalized")
1442 }
1443 },
1444 shuffleCall = function(event, callback) {
1445 if (base.initialiazed) {
1446 if (isEventAvailable(base.configuration, event)) {
1447 var a = new _xhr2.default;
1448 a.sendGetRequest(window.SP.schema + "//api" + window.SP.url + "/events/" + event.name.toLowerCase() + "/shuffle?appId=" + base.appId + "&uid=" + base.uid + "&seed=0&ab=" + base.ab.value + "×pan=" + getEventDefaultTimespan(base.configuration, event.name.toLowerCase()), function(req, error) {
1449 if (!error)
1450 for (var res = JSON.parse(req.responseText), i = 0; i < res.events.length; i++) {
1451 var result = {
1452 result: "ok",
1453 event: res.events[i]
1454 };
1455 callback(result, getEventMsg(base.configuration, res.events[i]))
1456 }
1457 })
1458 }
1459 } else {
1460 var result = {
1461 result: "error",
1462 error: "Trustisto has not been initalized"
1463 };
1464 callback(result), window.SP.error("Trustisto: SDK has not been initalized")
1465 }
1466 };
1467 return {
1468 sendEvent: function(event, callback) {
1469 window.SP.log("EVENTS SCRIPT DEPRECATED: sendEvent", event), base.initialiazed ? eventCall(!0, event, callback) : base.q(["sendEvent", event, callback])
1470 },
1471 getEvent: function(event, callback) {
1472 window.SP.log("EVENTS SCRIPT DEPRECATED: getEvent", event), base.initialiazed ? eventCall(!1, event, callback) : base.q(["getEvent", event, callback])
1473 },
1474 shuffleEvent: function(event, callback) {
1475 window.SP.log("EVENTS SCRIPT DEPRECATED: shuffleEvent", event), base.initialiazed ? shuffleCall(event, callback) : base.q(["shuffleEvent", event, callback])
1476 }
1477 }
1478 }
1479}, function(module, exports, __webpack_require__) {
1480 "use strict";
1481
1482 function _interopRequireDefault(obj) {
1483 return obj && obj.__esModule ? obj : {
1484 default: obj
1485 }
1486 }
1487 var _static = __webpack_require__(1),
1488 _static2 = _interopRequireDefault(_static),
1489 _xhr = __webpack_require__(2),
1490 _xhr2 = _interopRequireDefault(_xhr),
1491 isNotificationForThisEvent = function(configuration, eventName) {
1492 return configuration.config.notifications.filter(function(n) {
1493 return n.name === eventName
1494 }).length > 0
1495 };
1496 module.exports = function(base) {
1497 return {
1498 push: function(eventName, params) {
1499 if (window.SP.log("EVENTS PUSH " + eventName, params), _static2.default.FORBIDDEN_EVENTS.indexOf(eventName) > -1) return void window.SP.error("EVENTS PUSH", "Event '" + eventName + "' is forbidden, please use other name.");
1500 if (base.initialiazed) {
1501 if (isNotificationForThisEvent(base.configuration, eventName.toLowerCase())) {
1502 var ajax = new _xhr2.default,
1503 url = window.SP.schema + "//api" + window.SP.url + "/events/push/" + eventName.toLowerCase() + "?appId=" + base.appId + "&uid=" + base.uid + "&productId=" + base.evValue(params && params.productId || _static2.default.NO_PRODUCT_EVENT) + "&ab=" + base.ab.value,
1504 data = JSON.stringify(base.evObject(params) || {});
1505 ajax.sendPostRequest(url, function(_req, _error) {}, data)
1506 } else window.SP.log("EVENTS Trustisto: Event '" + eventName + "' is not available, no actions found on that event.");
1507 base.trigger(_static2.default.TRIGGER_TYPE_EVENT, Object.assign({
1508 event: eventName
1509 }, {
1510 eventParams: params
1511 }))
1512 } else base.q(["push", eventName, params])
1513 }
1514 }
1515 }
1516}, function(module, exports, __webpack_require__) {
1517 "use strict";
1518 var _triggers = __webpack_require__(9);
1519 module.exports = function(base) {
1520 var pushMatchingURLCustomEvents = function(base, events) {
1521 (0, _triggers.getTriggeredObjectPerURL)(events, window.location.pathname, function(customEvent) {
1522 base.push(customEvent.event)
1523 })
1524 };
1525 base.modulesInitializers.push(function() {
1526 base.configuration.config.events_custom && (base.triggerListeners.push(function(triggeredTypes, params) {
1527 (0, _triggers.getTriggeredObjectPerTriggerType)(base.configuration.config.events_custom, triggeredTypes, params, function(customEvent) {
1528 base.push(customEvent.event)
1529 })
1530 }), pushMatchingURLCustomEvents(base, base.configuration.config.events_custom))
1531 })
1532 }
1533}, function(module, exports, __webpack_require__) {
1534 "use strict";
1535 var GA_INTEGRATION_AUTO = 0,
1536 GA_INTEGRATION_GAJS = 1,
1537 GA_INTEGRATION_ANALYTICS_JS = 2,
1538 GA_INTEGRATION_GTAG_JS = 3,
1539 gajs = function(tracker, category, action, label) {
1540 tracker && (tracker = tracker.trim(), tracker && "." !== tracker.slice(-1) && (tracker += ".")), window.SP.log("GA", "_gaq > [" + tracker + "] " + category + " " + action + " " + label), _gaq.push([(tracker || "") + "_trackEvent", category, action, label, null, !0])
1541 },
1542 analyticsjs = function(tracker, category, action, label) {
1543 tracker && (tracker = tracker.trim(), tracker && "." !== tracker.slice(-1) && (tracker += ".")), window.SP.log("GA", "ga > [" + tracker + "] " + category + " " + action + " " + label), ga((tracker || "") + "send", "event", category, action, label, {
1544 nonInteraction: !0
1545 })
1546 },
1547 gtagjs = function(tracker, category, action, label) {
1548 window.SP.log("GA", "gtag > [" + tracker + "] " + category + " " + action + " " + label), gtag("event", action, {
1549 event_category: category,
1550 event_label: label,
1551 non_interaction: !0
1552 })
1553 };
1554 module.exports = function(base) {
1555 var category = "Trustisto",
1556 enabled = !1,
1557 integration = GA_INTEGRATION_AUTO,
1558 tracker = null,
1559 findGAIntegration = function() {
1560 if (window.SP.log("GA", "Try to find proper integration..."), "undefined" != typeof _gaq) return GA_INTEGRATION_GAJS;
1561 if ("undefined" != typeof ga) return GA_INTEGRATION_ANALYTICS_JS;
1562 if ("undefined" != typeof gtag) return GA_INTEGRATION_GTAG_JS;
1563 throw new Error("Cannot find GA integration")
1564 };
1565 return base.modulesInitializers.push(function() {
1566 if (enabled = base.configuration.config.ga ? base.configuration.config.ga.enabled : "true" === base.appInfo.ga, !enabled) return void window.SP.warn("GA", "Integration with GA not enabled");
1567 if (integration = base.configuration.config.ga ? base.configuration.config.ga.integration : GA_INTEGRATION_AUTO, tracker = base.configuration.config.ga ? base.configuration.config.ga.tracker : null, window.SP.log("GA", "enabled: " + enabled + ", integration: " + integration + ", tracker: " + tracker), integration === GA_INTEGRATION_AUTO && tracker && (window.SP.warn("GA", "Tracker [" + tracker + "] will not be used in AUTO integration"), tracker = null), integration === GA_INTEGRATION_AUTO) try {
1568 integration = findGAIntegration(), window.SP.log("GA", "Final integration: " + integration)
1569 } catch (_ex) {
1570 window.SP.error("GA", "Can't find proper GA integration"), enabled = !1
1571 }
1572 }), {
1573 gaTrack: function(action, label) {
1574 enabled && (integration === GA_INTEGRATION_GAJS ? gajs(tracker, category, action, label) : integration === GA_INTEGRATION_ANALYTICS_JS ? analyticsjs(tracker, category, action, label) : integration === GA_INTEGRATION_GTAG_JS ? gtagjs(tracker, category, action, label) : window.SP.warn("No Google Analytics integration found for event [" + category + ";" + action + ";" + label + "]"))
1575 }
1576 }
1577 }
1578}, function(module, exports, __webpack_require__) {
1579 "use strict";
1580
1581 function _interopRequireDefault(obj) {
1582 return obj && obj.__esModule ? obj : {
1583 default: obj
1584 }
1585 }
1586 var _inspect = __webpack_require__(56),
1587 _inspect2 = _interopRequireDefault(_inspect);
1588 module.exports = function(base) {
1589 return {
1590 inspect: function() {
1591 if (base.initialiazed) {
1592 var host = window.SP.schema + "//" + window.SP.url.substr(1),
1593 i = new _inspect2.default(host, base.appId);
1594 i.runInspector()
1595 } else base.q(["inspect"])
1596 }
1597 }
1598 }
1599}, function(module, exports, __webpack_require__) {
1600 "use strict";
1601
1602 function _interopRequireDefault(obj) {
1603 return obj && obj.__esModule ? obj : {
1604 default: obj
1605 }
1606 }
1607
1608 function _classCallCheck(instance, Constructor) {
1609 if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function")
1610 }
1611 var _createClass = function() {
1612 function defineProperties(target, props) {
1613 for (var i = 0; i < props.length; i++) {
1614 var descriptor = props[i];
1615 descriptor.enumerable = descriptor.enumerable || !1, descriptor.configurable = !0, "value" in descriptor && (descriptor.writable = !0), Object.defineProperty(target, descriptor.key, descriptor)
1616 }
1617 }
1618 return function(Constructor, protoProps, staticProps) {
1619 return protoProps && defineProperties(Constructor.prototype, protoProps), staticProps && defineProperties(Constructor, staticProps), Constructor
1620 }
1621 }(),
1622 _queue = __webpack_require__(13),
1623 _queue2 = _interopRequireDefault(_queue),
1624 _query_params = __webpack_require__(4),
1625 _query_params2 = _interopRequireDefault(_query_params),
1626 _doc_cookies = __webpack_require__(3),
1627 _doc_cookies2 = _interopRequireDefault(_doc_cookies),
1628 _mobile = __webpack_require__(10),
1629 _notification = __webpack_require__(14),
1630 _notification2 = _interopRequireDefault(_notification),
1631 _notification_methods = __webpack_require__(15),
1632 NotifyConfig = function() {
1633 function NotifyConfig(config) {
1634 _classCallCheck(this, NotifyConfig), this.config = config
1635 }
1636 return _createClass(NotifyConfig, [{
1637 key: "getTiming",
1638 value: function() {
1639 return {
1640 startTime: 1e3 * (this.config.style.start_time || 5),
1641 showTime: 1e3 * (this.config.style.show_time || 7),
1642 spanTime: 1e3 * (this.config.style.span_time || 10)
1643 }
1644 }
1645 }, {
1646 key: "getEventLimitTime",
1647 value: function(event) {
1648 return this.config.events[event.name.toLowerCase()].limit_time || 1800
1649 }
1650 }, {
1651 key: "getEventMinCount",
1652 value: function(event) {
1653 var eventNameL = event.name.toLowerCase();
1654 return this.config.events[eventNameL].min_count || ("view" === eventNameL ? 2 : 1)
1655 }
1656 }, {
1657 key: "isEventLimited",
1658 value: function(event) {
1659 return this.config.events[event.name.toLowerCase()].limit || !1
1660 }
1661 }, {
1662 key: "getEventIcon",
1663 value: function(event) {
1664 return window.SP.schema + "//js" + window.SP.url + "/icons/" + (this.config.events[event.name.toLowerCase()].icon || "notification.png")
1665 }
1666 }, {
1667 key: "getEventImage",
1668 value: function(event) {
1669 var image = this.getEventIcon(event),
1670 eventNameL = event.name.toLowerCase();
1671 return "undefined" == typeof this.config.events[eventNameL].show_image && (this.config.events[eventNameL].show_image = !0), this.config.events[eventNameL].show_image && event.lastParams && event.lastParams.image && (image = event.lastParams.image), image
1672 }
1673 }, {
1674 key: "getEventLink",
1675 value: function(event) {
1676 var link = null;
1677 return event.lastParams && (link = event.lastParams.image_link || event.lastParams.link), link
1678 }
1679 }]), NotifyConfig
1680 }();
1681 module.exports = function(base) {
1682 var queue = null,
1683 configuration = null;
1684 base.modulesInitializers.push(function() {
1685 return "false" === base.appInfo.mobile && (0, _mobile.isMobile)() ? void window.SP.log("NOTIFICATIONS MOBILE IS DISABLED, stop deprecated notification initialization") : (configuration = new NotifyConfig(base.configuration.config), queue = new _queue2.default("OldNotifyQ"), queue.setTiming(configuration.getTiming()), queue.setSortFunction(_notification_methods.sortNotification), queue.setNotifyCallback(function(obj) {
1686 return base.notify(obj.response, obj.text)
1687 }), void queue.start())
1688 });
1689 var MAX_TIMELINE_LEN = 10,
1690 wasEventEmited = function(event) {
1691 var eventName = event.name.toLowerCase(),
1692 productId = event.productId.replace("_", "").replace("-", ""),
1693 timeMarker = productId + "_" + event.last,
1694 result = !1,
1695 cookieName = "trustisto_event_" + eventName,
1696 timeline = _doc_cookies2.default.getItem(cookieName);
1697 return timeline && timeline.indexOf(timeMarker) !== -1 && (result = !0), result
1698 },
1699 saveEventTimeSpan = function(event) {
1700 var eventName = event.name.toLowerCase(),
1701 productId = event.productId.replace("_", "").replace("-", ""),
1702 timeMarker = productId + "_" + event.last,
1703 cookieName = "trustisto_event_" + eventName,
1704 timeline = _doc_cookies2.default.getItem(cookieName);
1705 if (!timeline || timeline.indexOf(timeMarker) === -1) {
1706 var timelineArr = timeline ? timeline.split("-") : [];
1707 timelineArr.push(timeMarker), timelineArr.length > MAX_TIMELINE_LEN && timelineArr.splice(0, timelineArr.length - MAX_TIMELINE_LEN);
1708 var newTimeline = timelineArr.join("-");
1709 _doc_cookies2.default.setItem(cookieName, newTimeline, configuration.getEventLimitTime(event), "/")
1710 }
1711 },
1712 isNotificationBlocked = function() {
1713 var block = _doc_cookies2.default.getItem("trustisto_block");
1714 return block && window.SP.log("NOTIFICATIONS All notification blocked."), block
1715 };
1716 return {
1717 queueNotify: function(response, text) {
1718 base.initialiazed ? queue.push({
1719 response: response,
1720 text: text
1721 }) : window.SP.error("NOTIFICATIONS Trustisto: SDK was not initialized")
1722 },
1723 notify: function(response, text) {
1724 if (base.initialiazed) {
1725 if (response.event.count >= configuration.getEventMinCount(response.event) && !isNotificationBlocked() && ("false" === base.appInfo.ab || "a" !== base.ab.value || (0, _query_params2.default)("trustisto-show")) && (!configuration.isEventLimited(response.event) || !wasEventEmited(response.event))) {
1726 var image = configuration.getEventImage(response.event),
1727 link = configuration.getEventLink(response.event),
1728 brandless = base.configuration.isBrandless();
1729 return configuration.isEventLimited(response.event) && saveEventTimeSpan(response.event), base.gaTrack("NotificationShow", response.event.productId), base.ab.beforeNotification(), window.SOCIALPROOF_NOTIFICATOR && window.SOCIALPROOF_NOTIFICATOR.isAvailable() && window.SOCIALPROOF_NOTIFICATOR.forEvent(response.event) ? window.SOCIALPROOF_NOTIFICATOR.notify(response.event, text, image, link, brandless, -1) : base.getNotificator().notify(new _notification2.default(response.event, text, image, link, brandless, -1)), !0
1730 }
1731 } else window.SP.error("Trustisto: SDK was not initialized")
1732 }
1733 }
1734 }
1735}, function(module, exports, __webpack_require__) {
1736 "use strict";
1737
1738 function _interopRequireDefault(obj) {
1739 return obj && obj.__esModule ? obj : {
1740 default: obj
1741 }
1742 }
1743 var _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(obj) {
1744 return typeof obj
1745 } : function(obj) {
1746 return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj
1747 },
1748 _queue = __webpack_require__(13),
1749 _queue2 = _interopRequireDefault(_queue),
1750 _static = __webpack_require__(1),
1751 _static2 = _interopRequireDefault(_static),
1752 _xhr = __webpack_require__(2),
1753 _xhr2 = _interopRequireDefault(_xhr),
1754 _query_params = __webpack_require__(4),
1755 _query_params2 = _interopRequireDefault(_query_params),
1756 _doc_cookies = __webpack_require__(3),
1757 _doc_cookies2 = _interopRequireDefault(_doc_cookies),
1758 _mobile = __webpack_require__(10),
1759 _triggers = __webpack_require__(9),
1760 _notification_style = __webpack_require__(64),
1761 _notification_style2 = _interopRequireDefault(_notification_style),
1762 _notification_new_style = __webpack_require__(61),
1763 _notification_new_style2 = _interopRequireDefault(_notification_new_style),
1764 _notification_inline_style = __webpack_require__(59),
1765 _notification_inline_style2 = _interopRequireDefault(_notification_inline_style),
1766 _notificator = __webpack_require__(65),
1767 _notificator2 = _interopRequireDefault(_notificator),
1768 _notificator_new = __webpack_require__(68),
1769 _notificator_new2 = _interopRequireDefault(_notificator_new),
1770 _notificator_inline = __webpack_require__(66),
1771 _notificator_inline2 = _interopRequireDefault(_notificator_inline),
1772 _notification = __webpack_require__(14),
1773 _notification2 = _interopRequireDefault(_notification),
1774 _notification_new = __webpack_require__(60),
1775 _notification_new2 = _interopRequireDefault(_notification_new),
1776 _notification_inline = __webpack_require__(58),
1777 _notification_inline2 = _interopRequireDefault(_notification_inline),
1778 _notification_info = __webpack_require__(11),
1779 _notification_info2 = _interopRequireDefault(_notification_info),
1780 _notification_review = __webpack_require__(63),
1781 _notification_review2 = _interopRequireDefault(_notification_review),
1782 _notification_product_feed = __webpack_require__(62),
1783 _notification_product_feed2 = _interopRequireDefault(_notification_product_feed),
1784 _notification_configuration = __webpack_require__(57),
1785 _notification_configuration2 = _interopRequireDefault(_notification_configuration),
1786 _notification_methods = __webpack_require__(15);
1787 module.exports = function(base) {
1788 var notificationQueue = null,
1789 configuration = null,
1790 style = null,
1791 notificator = null,
1792 notificatorNew = null,
1793 styleNew = null,
1794 notificatorInline = null,
1795 styleInline = null,
1796 notifcationIdsTriggered = [],
1797 callNotificationEvent = function(notification, params, callback) {
1798 var endpoint = "get",
1799 productId = null;
1800 switch (notification.notification_type) {
1801 case _static2.default.NOTIFICATION_TYPE_ALL_PRODUCTS:
1802 endpoint = "shuffle", productId = null;
1803 break;
1804 case _static2.default.NOTIFICATION_TYPE_CURRENT_PRODUCT:
1805 endpoint = "get", productId = params && params.productId ? base.evValue(params.productId) : _static2.default.NO_PRODUCT_EVENT;
1806 break;
1807 case _static2.default.NOTIFICATION_TYPE_ALL_EVENTS:
1808 endpoint = "get", productId = _static2.default.NO_PRODUCT_EVENT;
1809 break;
1810 case _static2.default.NOTIFICATION_TYPE_NEW:
1811 endpoint = "pull", notification.matchTrigger && notification.matchTrigger.type === _static2.default.TRIGGER_TYPE_S_PRODUCT && (notification.matchTrigger.options ? notification.matchTrigger.options.filter : notification.matchTrigger.filter) === _static2.default.FILTER_BY_PARAM ? productId = params && params.productId ? base.evValue(params.productId) : null : notification.matchTrigger && notification.matchTrigger.type === _static2.default.TRIGGER_TYPE_EVENT && (notification.matchTrigger.options ? notification.matchTrigger.options.filter : notification.matchTrigger.filter) === _static2.default.FILTER_BY_PARAM ? productId = params && params.productId ? base.evValue(params.productId) : null : notification.matchTrigger && (notification.matchTrigger.options ? notification.matchTrigger.options.filter : notification.matchTrigger.filter) === _static2.default.FILTER_BY_URL
1812 }
1813 window.SP.log("NOTIFICATIONS GET /events/" + endpoint + "/" + notification.name.toLowerCase(), productId);
1814 var ajax = new _xhr2.default,
1815 sourceWebsite = notification.source_website ? "&fromAppId=" + notification.source_website : "",
1816 url = window.SP.schema + "//api" + window.SP.url + "/events/" + endpoint + "/" + notification.name.toLowerCase() + "?appId=" + base.appId + "&uid=" + base.uid + (productId ? "&productId=" + productId : "") + "&ab=" + base.ab.value + "×pan=" + notification.timespan + sourceWebsite;
1817 ajax.sendGetRequest(url, function(req, error) {
1818 error || ! function() {
1819 var response = JSON.parse(req.responseText);
1820 window.SP.log("NOTIFICATIONS EVENTS", response), "get" !== endpoint ? response.events.forEach(function(event) {
1821 var result = {
1822 result: response.result,
1823 event: event
1824 };
1825 callback(result)
1826 }) : callback(response)
1827 }()
1828 })
1829 },
1830 callNotificationProductFeed = function(notification, params, callback) {
1831 var ajax = new _xhr2.default,
1832 productUrl = window.SP.schema + "//api" + window.SP.url + "/products/" + params.productId + "?appId=" + window.SP.appId + "&uid=" + window.SP.uid;
1833 ajax.sendGetRequest(productUrl, function(req, error) {
1834 if (!error) {
1835 var responseData = JSON.parse(req.responseText),
1836 minStock = notification.min_count,
1837 maxStock = notification.max_count,
1838 productStock = parseInt(responseData.data.productStock);
1839 if (productStock >= minStock && productStock <= maxStock) {
1840 var result = {
1841 result: responseData.data,
1842 event: {
1843 last: responseData.data.updatedAt,
1844 name: "product"
1845 }
1846 };
1847 callback(result)
1848 }
1849 }
1850 })
1851 },
1852 callNotificationReview = function(notification, params, callback) {
1853 var ajax = new _xhr2.default,
1854 reviewsUrl = window.SP.schema + "//api" + window.SP.url + "/feeds/pull/reviews?appId=" + base.appId + "&uid=" + base.uid;
1855 ajax.sendGetRequest(reviewsUrl, function(req, error) {
1856 if (!error) {
1857 var reviewsResponse = JSON.parse(req.responseText).data.filter(function(review) {
1858 return review.rate >= notification.min_count
1859 });
1860 reviewsResponse.forEach(function(review) {
1861 var result = {
1862 result: review,
1863 event: {
1864 last: review.createdAt
1865 }
1866 };
1867 callback(result)
1868 })
1869 }
1870 })
1871 },
1872 callNotificationStatic = function(notification, callback) {
1873 var responseMock = {
1874 result: "ok",
1875 event: {
1876 name: notification.event || notification.name,
1877 productId: null,
1878 timespan: null,
1879 count: 1,
1880 countPluralIndex: null,
1881 gender: null,
1882 last: null,
1883 lastParams: {},
1884 lastRelativeText: null,
1885 statToken: null
1886 }
1887 };
1888 callback(responseMock)
1889 },
1890 processNotifications = function(notifications, params) {
1891 notifications.forEach(function(n) {
1892 n.source === _static2.default.NOTIFICATION_SOURCE_STATIC ? callNotificationStatic(n, function(response) {
1893 base.queueNotification(new _notification_info2.default(base.appInfo, n, params, response))
1894 }) : n.source === _static2.default.NOTIFICATION_SOURCE_REVIEW ? callNotificationReview(n, params, function(response) {
1895 base.queueNotification(new _notification_review2.default(base.appInfo, n, params, response))
1896 }) : n.source === _static2.default.NOTIFICATION_SOURCE_PRODUCT_FEED ? params.productId && callNotificationProductFeed(n, params, function(response) {
1897 base.queueNotification(new _notification_product_feed2.default(base.appInfo, n, params, response))
1898 }) : callNotificationEvent(n, params, function(response) {
1899 base.queueNotification(new _notification_info2.default(base.appInfo, n, params, response))
1900 })
1901 })
1902 },
1903 findUrlTriggers = function() {
1904 var url = window.location.pathname;
1905 (0, _triggers.getTriggeredObjectPerURL)(configuration.config.notifications, url, function(notification) {
1906 notifcationIdsTriggered.indexOf(notification.id) === -1 ? (notifcationIdsTriggered.push(notification.id), processNotifications([notification], Object.assign({
1907 _url: url
1908 }, window.SOCIALPROOF_PARMAS))) : window.SP.log("NOTIFICATIONS Notification " + notification.id + " triggered second time, skipping")
1909 })
1910 },
1911 isNotificationBlocked = function() {
1912 var block = _doc_cookies2.default.getItem("trustisto_block");
1913 return block && window.SP.log("NOTIFICATIONS All notification blocked."), block
1914 };
1915 return base.modulesInitializers.push(function() {
1916 return "false" === base.appInfo.mobile && (0, _mobile.isMobile)() ? void window.SP.log("NOTIFICATIONS MOBILE IS DISABLED, stop notification initialization") : (configuration = new _notification_configuration2.default(base.configuration.config), (configuration.areStandardNotificationsAvailable() || configuration.areDeprecatedNotificationsAvailable()) && (window.SP.log("NOTIFICATIONS Standard Notifcator & Standard Style setuped"), style = new _notification_style2.default, style.load(configuration.getStyleConfig()), style.embedStyle(document.body), notificator = new _notificator2.default, notificator.setStyle(style), notificator.setTiming(configuration.getTiming())), configuration.areNewNotificationsAvailable() && (window.SP.log("NOTIFICATIONS New Notifcator & New Style setuped"), styleNew = new _notification_new_style2.default, styleNew.loadNotifications(base.configuration.config.notifications), styleNew.loadGlobalStyles(configuration.getStyleConfig()), styleNew.embedStyle(document.body), notificatorNew = new _notificator_new2.default, notificatorNew.setStyle(styleNew), notificatorNew.setTiming(configuration.getTiming())), configuration.areInlineNotificationsAvailable() && (window.SP.log("NOTIFICATIONS Inline Notifcator & Inline Style setuped"), styleInline = new _notification_inline_style2.default, styleInline.loadNotifications(base.configuration.config.notifications), styleInline.embedStyle(document.body), notificatorInline = new _notificator_inline2.default, notificatorInline.setStyle(styleInline), notificatorInline.setTiming(configuration.getTiming())), window.SOCIALPROOF_NOTIFICATOR && window.SOCIALPROOF_NOTIFICATOR.isAvailable() && (window.SOCIALPROOF_NOTIFICATOR.setStyleConfig(configuration.getStyleConfig()), window.SOCIALPROOF_NOTIFICATOR.setTiming(configuration.getTiming())), notificationQueue = new _queue2.default("NewNotifyQ"), notificationQueue.setTiming(configuration.getTiming()), notificationQueue.setSortFunction(_notification_methods.sortNotification), notificationQueue.setNotifyCallback(function(obj) {
1917 return base.showNotification(obj)
1918 }), notificationQueue.start(), base.testNotify(), base.triggerListeners.push(function(triggeredTypes, params) {
1919 (0, _triggers.getTriggeredObjectPerTriggerType)(configuration.config.notifications, triggeredTypes, params, function(notification) {
1920 notifcationIdsTriggered.indexOf(notification.id) === -1 ? (notifcationIdsTriggered.push(notification.id), processNotifications([notification], params)) : window.SP.log("NOTIFICATIONS Notification " + notification.id + " triggered second time, skipping")
1921 })
1922 }), void findUrlTriggers())
1923 }), {
1924 showNotification: function(notificationInfo) {
1925 if (window.SP.log("NOTIFICATIONS Try to show notfication #" + notificationInfo.getId()), base.initialiazed) {
1926 if (notificationInfo.inLimits() && !isNotificationBlocked() && ("false" === base.appInfo.ab || "a" !== base.ab.value || (0, _query_params2.default)("trustisto-show")) && configuration.isUnderGlobalCapping() && notificationInfo.isUnderCapping() && notificationInfo.canBeDisplayedToday()) {
1927 var _ret2 = function() {
1928 var brandless = base.configuration.isBrandless();
1929 return base.gaTrack("NotificationShow", notificationInfo.response.event.productId), base.ab.beforeNotification(), notificationInfo.notify(function(responseEvent, text, image, link, id) {
1930 window.SOCIALPROOF_NOTIFICATOR && window.SOCIALPROOF_NOTIFICATOR.isAvailable() && window.SOCIALPROOF_NOTIFICATOR.forEvent(responseEvent) ? window.SOCIALPROOF_NOTIFICATOR.notify(responseEvent, text, image, link, brandless, id) : notificationInfo.notification.display === _static2.default.NOTIFICATION_DISPLAY_NEW ? notificatorNew.notify(new _notification_new2.default(responseEvent, text, image, link, brandless, notificationInfo.notification)) : notificationInfo.notification.display === _static2.default.NOTIFICATION_DISPLAY_INLINE ? notificatorInline.notify(new _notification_inline2.default(responseEvent, text, image, link, brandless, notificationInfo.notification)) : notificator.notify(new _notification2.default(responseEvent, text, image, link, brandless, id))
1931 }), {
1932 v: !0
1933 }
1934 }();
1935 if ("object" === ("undefined" == typeof _ret2 ? "undefined" : _typeof(_ret2))) return _ret2.v
1936 }
1937 } else window.SP.error("Trustisto: SDK was not initialized")
1938 },
1939 queueNotification: function(notificationInfo) {
1940 base.initialiazed ? notificationQueue.push(notificationInfo) : window.SP.error("Trustisto: SDK was not initialized")
1941 },
1942 clearNotifications: function() {
1943 base.initialiazed ? (notificator && notificator.removeAllNotifications(), notificatorNew && notificatorNew.removeAllNotifications()) : window.SP.error("Trustisto: SDK was not initialized")
1944 },
1945 testNotify: function(test) {
1946 ((0, _query_params2.default)("trustisto-test") || test) && (notificatorNew ? notificatorNew.notify(new _notification_new2.default({
1947 isTestEvent: !0,
1948 lastRelativeText: "right now"
1949 }, "Test notification", null, null, !1, Object.assign(base.configuration.config.notifications[0], {
1950 container: null
1951 }))) : notificator && notificator.notify(new _notification2.default({
1952 isTestEvent: !0,
1953 lastRelativeText: "right now"
1954 }, "Test notification")))
1955 },
1956 manualNotify: function(notificationId, response) {
1957 var notification = base.configuration.config.notifications.filter(function(n) {
1958 return n.id === notificationId
1959 })[0],
1960 info = new _notification_info2.default(base.appInfo, notification, {}, response);
1961 info.notify(function(responseEvent, text, image, link, _id) {
1962 notificatorNew.notify(new _notification_new2.default(responseEvent, text, image, link, !1, info.notification))
1963 })
1964 },
1965 getNotificator: function() {
1966 return notificator
1967 }
1968 }
1969 }
1970}, function(module, exports, __webpack_require__) {
1971 "use strict";
1972
1973 function _interopRequireDefault(obj) {
1974 return obj && obj.__esModule ? obj : {
1975 default: obj
1976 }
1977 }
1978 var _static = __webpack_require__(1),
1979 _static2 = _interopRequireDefault(_static),
1980 _xhr = __webpack_require__(2),
1981 _xhr2 = _interopRequireDefault(_xhr),
1982 _query_params = __webpack_require__(4),
1983 _query_params2 = _interopRequireDefault(_query_params),
1984 _capping = __webpack_require__(7),
1985 _capping2 = _interopRequireDefault(_capping),
1986 _schedule = __webpack_require__(52),
1987 _triggers = __webpack_require__(9),
1988 POPUP_LOG_ENABLED = !0;
1989 module.exports = function(base) {
1990 var allPopups = [],
1991 popups = [],
1992 log = function(message, params) {
1993 POPUP_LOG_ENABLED && window.SP.log("POPUP " + message, params)
1994 },
1995 warn = function(message, params) {
1996 POPUP_LOG_ENABLED && window.SP.warn("POPUP " + message, params)
1997 },
1998 createPopup = function(url, options) {
1999 var popupId = (0, _query_params2.default)("id", url) || "popup_" + (new Date).getTime().toString(),
2000 popupOverlay = document.createElement("div"),
2001 popupContainer = document.createElement("div");
2002 popupOverlay.id = "socialproof-popup-overlay-" + popupId;
2003 var getPopupAnimationClass = function() {
2004 return "center" === options.popupPosition ? "socialproof-popup-fade-in" : "bottomLeft" === options.popupPosition ? "socialproof-popup-slide-in-left" : "bottomRight" === options.popupPosition ? "socialproof-popup-slide-in-right" : "socialproof-popup-fade-in"
2005 };
2006 popupOverlay.className = "socialproof-popup-reset-" + popupId + " socialproof-popup-overlay-" + popupId + " socialproof-popup-fade-in", popupContainer.className = "socialproof-popup-reset-" + popupId + " socialproof-popup socialproof-popup-container-" + popupId + " " + getPopupAnimationClass();
2007 var popup = document.createElement("iframe");
2008 if (popup.className = "socialproof-popup-reset-" + popupId + " socialproof-popup-" + popupId + " socialproof-popup-" + popupId, url.indexOf("?") > -1 ? popup.src = url + ("&id=" + popupId + "&websiteId=" + base.appId + "&uid=testUID") : popup.src = url + ("?id=" + popupId + "&websiteId=" + base.appId + "&uid=testUID"), options && options.showCloseButton) {
2009 var closeBtn = document.createElement("span");
2010 closeBtn.className = "socialproof-popup-reset-" + popupId + " socialproof-popup-close socialproof-popup-close-" + popupId, popupContainer.appendChild(closeBtn)
2011 }
2012 popupOverlay.appendChild(popupContainer), popupContainer.appendChild(popup), document.body.appendChild(popupOverlay);
2013 var currentPopupElement = {
2014 popupId: popupId,
2015 popupOverlay: popupOverlay,
2016 popup: popupContainer,
2017 popupIframe: popup,
2018 options: options,
2019 style: createStyle(options, popupId)
2020 };
2021 popups.push(currentPopupElement), handlePopupEvents(options, currentPopupElement), _capping2.default.addCappedAction(_static2.default.CAPPING_POPUPS, popupId, _static2.default.CAPPING_ACTION_VIEW), tracking(popupId, _static2.default.POPUP_STAT_ACTION_SHOW)
2022 },
2023 tracking = function(popupId, action) {
2024 var pixel = document.createElement("img");
2025 pixel.src = base.schema + "//api" + base.url + "/stats/popup/" + popupId + "/" + action + ".png?appId=" + base.appId + "&uid=" + base.uid + "&ab=" + base.ab.value, pixel.width = 0, pixel.height = 0;
2026 var parent = document.querySelector(".socialproof-popup-container-" + popupId);
2027 parent.appendChild(pixel);
2028 var capitalizedAction = action.charAt(0).toUpperCase() + action.slice(1);
2029 base.gaTrack("Overlay" + capitalizedAction, popupId), externalTracking(popupId, action)
2030 },
2031 externalTracking = function(popupId, action) {
2032 var selectedPopups = allPopups.filter(function(p) {
2033 return p.id === parseInt(popupId)
2034 });
2035 if (0 === selectedPopups.length) return void warn("External tracking - Cannot find popup with ID ", popupId);
2036 var popup = selectedPopups[0];
2037 if (popup.tracking && 0 !== popup.tracking.length) {
2038 var trackers = popup.tracking.filter(function(t) {
2039 return t.event === action
2040 });
2041 0 !== trackers.length && trackers.forEach(function(t) {
2042 return SP.injectTag(t.tracker)
2043 })
2044 }
2045 },
2046 createStyle = function(options, target) {
2047 var style = document.createElement("style");
2048 return style.id = "socialproof-popup-style-" + target, style.innerHTML = "\n .socialproof-popup-reset-" + target + ' {\n position: static;\n float: none;\n padding: 0;\n margin: 0;\n border: 0 none;\n outline: 0 none;\n border-spacing: 0;\n color: #000;\n font-family: "Helvetica Neue", Arial, sans-serif;\n font-size: 10px;\n font-style: normal;\n font-weight: normal;\n font-variant: normal;\n line-height: normal;\n text-decoration: none;\n text-transform: none;\n text-align: left;\n text-indent: 0;\n text-shadow: none;\n letter-spacing: normal;\n word-spacing: normal;\n white-space: normal;\n direction: ltr;\n background: none repeat scroll 0 0 transparent;\n vertical-align: middle;\n overflow: visible;\n max-width: none;\n max-height: none;\n -moz-box-sizing: content-box;\n }\n\n .socialproof-popup-overlay-' + target + " {\n z-index: 2147483647;\n background: rgba(0, 0, 0, 0.3);\n position: fixed;\n top: 0;\n left: 0;\n width: 100vw;\n height: 100vh;\n }\n\n .socialproof-popup-container-" + target + " {\n position: fixed;\n " + ("bottomLeft" === options.popupPosition ? "top: calc(100% - " + options.height / 2 + "px);" : "") + "\n " + ("bottomLeft" === options.popupPosition ? "left: calc(" + options.width / 2 + "px);" : "") + "\n " + ("bottomRight" === options.popupPosition ? "top: calc(100% - " + options.height / 2 + "px);" : "") + "\n " + ("bottomRight" === options.popupPosition ? "right: " + options.width / 2 * -1 + "px;" : "") + "\n " + ("center" === options.popupPosition ? "top: 50%;" : "") + "\n " + ("center" === options.popupPosition ? "left: 50%;" : "") + "\n width: " + (options && options.width ? options.width + "px" : "500px") + ";\n height: " + (options && options.height ? options.height + "px" : "500px") + ";\n transform: translate(-50%, -50%);\n }\n\n .socialproof-popup-container-" + target + " .socialproof-popup-" + target + " {\n position: relative;\n width: 100%;\n height: 100%;\n max-width: 100%;\n max-height: 100%;\n border: none;\n }\n\n .socialproof-popup-container-" + target + " .socialproof-popup-close-" + target + ",\n .socialproof-popup-overlay-" + target + " .socialproof-popup-close-" + target + " {\n z-index: 2147483646;\n position: absolute;\n top: 3px;\n right: 3px;\n width: 16px;\n height: 16px;\n background: #272727;\n border-radius: 50%;\n }\n\n .socialproof-popup-container-" + target + " .socialproof-popup-close-" + target + ":before, .socialproof-popup-close-" + target + ":after,\n .socialproof-popup-overlay-" + target + " .socialproof-popup-close-" + target + ":before, .socialproof-popup-close-" + target + ":after {\n position: absolute;\n top: 3px;\n right: 7px;\n content: ' ';\n height: 10px;\n width: 2px;\n background-color: #ffffff;\n }\n\n .socialproof-popup-container-" + target + " .socialproof-popup-close-" + target + ":before, \n .socialproof-popup-overlay-" + target + " .socialproof-popup-close-" + target + ":before {\n transform: rotate(45deg);\n }\n\n .socialproof-popup-container-" + target + " .socialproof-popup-close-" + target + ":after, \n .socialproof-popup-overlay-" + target + " .socialproof-popup-close-" + target + ":after {\n transform: rotate(-45deg);\n }\n\n .socialproof-popup-container-" + target + " .socialproof-popup-close-" + target + ":hover,\n .socialproof-popup-overlay-" + target + " .socialproof-popup-close-" + target + ":hover {\n cursor: pointer;\n }\n\n .socialproof-popup-fade-in {\n animation: socialproof-popup-fade-in 0.85s forwards;\n }\n\n .socialproof-popup-slide-in-left {\n animation: socialproof-popup-slide-in-left 0.85s forwards;\n }\n\n .socialproof-popup-slide-in-right {\n animation: socialproof-popup-slide-in-right 0.85s forwards;\n }\n\n .socialproof-popup-slide-in-bottom {\n animation: socialproof-popup-slide-in-bottom 0.85s forwards;\n }\n\n .socialproof-popup-fade-out {\n animation: socialproof-popup-fade-out 0.85s forwards;\n }\n\n .socialproof-popup-slide-out-left {\n animation: socialproof-popup-slide-out-left 0.85s forwards;\n }\n\n .socialproof-popup-slide-out-right {\n animation: socialproof-popup-slide-out-right 0.85s forwards;\n }\n\n .socialproof-popup-slide-out-bottom {\n animation: socialproof-popup-slide-out-bottom 0.85s forwards;\n }\n\n @keyframes socialproof-popup-fade-in {\n from { opacity: 0; }\n to { opacity: 1; }\n }\n\n @keyframes socialproof-popup-fade-out {\n from { opacity: 1; }\n to { opacity: 0; }\n }\n\n @keyframes socialproof-popup-slide-in-left {\n from {transform: translate(-150vw, -50%);}\n to {transform: translate(-50%, -50%);}\n }\n\n @keyframes socialproof-popup-slide-out-left {\n from {transform: translate(-50%, -50%);}\n to {transform: translate(-150vw, -50%); opacity: 0;}\n }\n\n @keyframes socialproof-popup-slide-in-right {\n from {transform: translate(150vw, -50%);}\n to {transform: translate(-50%, -50%);}\n }\n\n @keyframes socialproof-popup-slide-out-right {\n from {transform: translate(-50%, -50%);}\n to {transform: translate(150vw, -50%); opacity: 0;}\n }\n\n @keyframes socialproof-popup-slide-in-bottom {\n from {transform: translate(-50%, -150vh);}\n to {transform: translate(-50%, -50%);}\n }\n\n @keyframes socialproof-popup-slide-out-bottom {\n from {transform: translate(-50%, -50%);}\n to {transform: translate(150vw, -150vh); opacity: 0;}\n }\n\n @media screen and (max-width: " + options.width + "px) {\n .socialproof-popup-container-" + target + " {\n height: 100vh; \n width: 100vw;\n top: 50%;\n left: 50%;\n }\n \n .socialproof-popup-container-" + target + " .socialproof-popup-" + target + " {\n width: 100vw;\n height: 100vh;\n max-width: 100vw;\n max-height: 100vh;\n }\n\n .socialproof-popup-container-" + target + " .socialproof-popup-close-" + target + " {\n width: 32px;\n height: 32px;\n }\n .socialproof-popup-overlay-" + target + " .socialproof-popup-close-" + target + ":before, .socialproof-popup-close-" + target + ":after {\n z-index: 2147483647;\n height: 16px;\n top: 8px;\n right: 15px;\n }\n }\n ", document.body.appendChild(style), style
2049 },
2050 createEventListener = function(eventCallback) {
2051 try {
2052 window.addEventListener("message", function(message) {
2053 message && message.data && message.data.event && 0 === message.data.event.indexOf(_static2.default.POPUP_EVENT_PREFIX) && eventCallback(message.data.event, message.data.id, message.data.params)
2054 }, !1)
2055 } catch (err) {
2056 base.SP.error(err)
2057 }
2058 },
2059 handlePopupEvents = function(options, popupElement) {
2060 var closeBtn = popupElement.popup.querySelector(".socialproof-popup-close"),
2061 handleRemovePopup = function() {
2062 _removePopup(popupElement.popupId), removeEventListeners()
2063 };
2064 closeBtn && closeBtn.addEventListener("click", handleRemovePopup);
2065 var removeEventListeners = function() {
2066 window.removeEventListener("click", removePopupOnOutsideClick), window.removeEventListener("keydown", removePopupOnEscape)
2067 },
2068 removePopupOnOutsideClick = function(e) {
2069 e.target && e.target.classList && e.target.classList.contains("socialproof-popup-close") || (_removePopup(popupElement.popupId), removeEventListeners())
2070 },
2071 removePopupOnEscape = function(e) {
2072 "Escape" === e.code && (_removePopup(popupElement.popupId), removeEventListeners())
2073 };
2074 options && options.closeOnOutsideClick && window.addEventListener("click", removePopupOnOutsideClick), options && options.closeOnEscape && (window.addEventListener("keydown", removePopupOnEscape), popupElement.popupIframe.addEventListener("DOMContentLoaded", function() {
2075 popupElement.popupIframe.contentDocument.body.addEventListener("keydown", removePopupOnEscape)
2076 }))
2077 },
2078 listenForInPopupEvents = function() {
2079 createEventListener(function(eventName, id, params) {
2080 switch (log("EVENT " + eventName + " [" + id + "]", params), eventName) {
2081 case _static2.default.POPUP_EVENT_CLOSE:
2082 _removePopup(id);
2083 break;
2084 case _static2.default.POPUP_EVENT_FORM:
2085 sendForm(id, params)
2086 }
2087 })
2088 },
2089 _removePopup = function(popupId) {
2090 var popupToRemove = popups.filter(function(p) {
2091 return p.popupId === popupId
2092 });
2093 if (0 !== popupToRemove.length) {
2094 var popupElement = popupToRemove[0];
2095 popupElement.popupOverlay.classList.add("socialproof-popup-fade-out"), "center" === popupElement.options.popupPosition ? popupElement.popup.classList.add("socialproof-popup-fade-out") : "bottomLeft" === popupElement.options.popupPosition ? popupElement.popup.classList.add("socialproof-popup-slide-out-left") : "bottomRight" === popupElement.options.popupPosition && popupElement.popup.classList.add("socialproof-popup-slide-out-right");
2096 var indexToRemove = popups.findIndex(function(p) {
2097 return p.popupId === popupElement.popupId
2098 });
2099 setTimeout(function() {
2100 popupElement.style.remove(), popupElement.popup.remove(), popups.splice(indexToRemove, 1)
2101 }, 1e3)
2102 }
2103 },
2104 sendForm = function(popupId, form) {
2105 tracking(popupId, _static2.default.POPUP_STAT_ACTION_ENGAGE);
2106 var xhr = new _xhr2.default;
2107 log("Send form", form), xhr.sendPostRequest(base.schema + "//api" + base.url + "/forms/popup_" + popupId + "/post?appId=" + base.appId + "&uid=" + base.uid, function(_req, _error) {}, JSON.stringify(form))
2108 },
2109 tryToShowPopup = function(popup) {
2110 if (log("Try to show popup " + popup.id), popup.schedule && popup.schedule.enabled) {
2111 log("Checking schedule", popup.schedule);
2112 var scheduleResult = (0, _schedule.scheduleCheck)(popup.schedule);
2113 if (!scheduleResult) return void warn("Schedule NOT OK, stop popup from showing");
2114 log("Schedule OK")
2115 }
2116 if (popup.limits) {
2117 if (!_capping2.default.isUnderPageCapping(_static2.default.CAPPING_POPUPS, popup.id, _static2.default.CAPPING_ACTION_VIEW, popup.limits.page)) return void warn("Page limits is over for #" + popup.id);
2118 if (!_capping2.default.isUnderDayCapping(_static2.default.CAPPING_POPUPS, popup.id, _static2.default.CAPPING_ACTION_VIEW, popup.limits.day)) return void warn("Day limits is over for #" + popup.id);
2119 if (!_capping2.default.isUnderUserCapping(_static2.default.CAPPING_POPUPS, popup.id, _static2.default.CAPPING_ACTION_VIEW, popup.limits.user)) return void warn("User limits is over for #" + popup.id)
2120 }
2121 base.showPopup(popup.url, popup.options)
2122 };
2123 return base.modulesInitializers.push(function() {
2124 allPopups = base.configuration.config.popups || [],
2125 0 !== !allPopups.length && (base.triggerListeners.push(function(triggeredTypes, params) {
2126 (0, _triggers.getTriggeredObjectPerTriggerType)(allPopups, triggeredTypes, params, function(popup) {
2127 tryToShowPopup(popup)
2128 })
2129 }), (0, _triggers.getTriggeredObjectPerURL)(allPopups, window.location.pathname, function(popup) {
2130 tryToShowPopup(popup)
2131 }), listenForInPopupEvents())
2132 }), {
2133 showPopup: function(url, options) {
2134 if (base.initialiazed) {
2135 var DEFAULT_OPTIONS = {
2136 width: 400,
2137 height: 350,
2138 closeOnEscape: !0,
2139 showCloseButton: !0,
2140 closeOnOutsideClick: !0,
2141 initCountdown: !1,
2142 popupPosition: "center"
2143 },
2144 allOptions = Object.assign(DEFAULT_OPTIONS, options || {});
2145 log("Open url", url), log("Open options", allOptions), createPopup(url, allOptions)
2146 }
2147 },
2148 removePopup: function(popupId) {
2149 base.initialiazed && (log("Close popup id", popupId), _removePopup(popupId))
2150 },
2151 manualPopup: function(popupId) {
2152 var popup = base.configuration.config.popups.filter(function(n) {
2153 return n.id === popupId
2154 })[0],
2155 url = popup.url,
2156 options = popup.options;
2157 base.showPopup(url, options)
2158 }
2159 }
2160 }
2161}, function(module, exports, __webpack_require__) {
2162 "use strict";
2163
2164 function _interopRequireDefault(obj) {
2165 return obj && obj.__esModule ? obj : {
2166 default: obj
2167 }
2168 }
2169 var _doc_cookies = __webpack_require__(3),
2170 _doc_cookies2 = _interopRequireDefault(_doc_cookies),
2171 _query_params = __webpack_require__(4),
2172 _query_params2 = _interopRequireDefault(_query_params),
2173 _static = __webpack_require__(1),
2174 _static2 = _interopRequireDefault(_static);
2175 module.exports = function(base) {
2176 var pageLanguage = window.navigator.userLanguage || window.navigator.browserLanguage,
2177 texts = {
2178 en: {
2179 prevBtn: "Back",
2180 chooseBtn: "Choose again",
2181 chooseElement: "Choose CSS selector",
2182 currentlySelected: "Currently selected: ",
2183 copy: "Copied to clipboard"
2184 },
2185 pl: {
2186 prevBtn: "Powrót",
2187 chooseBtn: "Wybierz ponownie",
2188 chooseElement: "Wybierz element na stronie",
2189 currentlySelected: "Aktualnie wybrany: ",
2190 copy: "Skopiowano do schowka"
2191 }
2192 },
2193 getCookieValue = function() {
2194 return parseInt(_doc_cookies2.default.getItem("trustisto_select_tool"))
2195 },
2196 isTrustistoSelectToolCookieSet = function(value) {
2197 return getCookieValue() === value
2198 },
2199 removeCookie = function removeCookie() {
2200 _doc_cookies2.default.removeItem("trustisto_select_tool"), _doc_cookies2.default.removeItem("trustisto_inline_test_data"), document.querySelector(".socialproof-select-tool-reset .socialproof-select-tool-back").removeEventListener("click", removeCookie)
2201 },
2202 hasUrlTrustistoSelectToolParam = function(value) {
2203 if (window.location && window.location.search.indexOf("trustisto-select-tool=" + value) > -1) return !0
2204 },
2205 createStyle = function() {
2206 var style = document.createElement("style");
2207 style.id = "socialproof-select-tool-style", style.innerHTML = "\n .socialproof-select-tool-reset {\n position: static;\n float: none;\n padding: 0;\n margin: 0;\n border: 0 none;\n outline: 0 none;\n border-spacing: 0;\n color: #000;\n font-family: \"Helvetica Neue\", Arial, sans-serif;\n font-size: 10px;\n font-style: normal;\n font-weight: normal;\n font-variant: normal;\n line-height: normal;\n text-decoration: none;\n text-transform: none;\n text-align: left;\n text-indent: 0;\n text-shadow: none;\n letter-spacing: normal;\n word-spacing: normal;\n white-space: normal;\n direction: ltr;\n background: none repeat scroll 0 0 transparent;\n vertical-align: middle;\n overflow: visible;\n max-width: none;\n max-height: none;\n -moz-box-sizing: content-box;\n }\n\n .socialproof-select-tool-fake-container {\n height: 80px;\n }\n\n .socialproof-select-tool {\n box-sizing: border-box;\n position: fixed;\n z-index: 2147483646;\n top: 0;\n left: 0;\n width: 100%;\n height: 80px;\n background: #4a24ea;\n display: flex;\n color: #ffffff;\n align-items: center;\n padding: 0 20px;\n }\n\n .socialproof-select-tool .socialproof-select-tool-logo {\n position: relative;\n width: 60px;\n height: 60px;\n background: #ffffff;\n border-radius: 30px;\n border-top-right-radius: 0;\n margin-right: 20px;\n }\n\n .socialproof-select-tool .socialproof-select-tool-logo:after {\n content: ' ';\n background: #000;\n height: 30px;\n border-radius: 15px;\n left: 50%;\n position: absolute;\n top: 50%;\n transform: translate(-50%, -50%);\n width: 30px;\n background: #4a24ea;\n }\n\n .socialproof-select-tool .socialproof-select-tool-text {\n color: inherit;\n display: flex;\n flex-direction: column;\n margin-right: auto;\n }\n\n .socialproof-select-tool .socialproof-select-tool-text .socialproof-select-tool-text-choose {\n color: inherit;\n font-size: 20px;\n font-weight: 700;\n margin-bottom: 6px;\n }\n \n .socialproof-select-tool .socialproof-select-tool-text .socialproof-select-tool-text-target {\n color: inherit;\n font-size: 14px;\n font-weight: 400;\n display: flex;\n align-items: center;\n }\n\n .socialproof-select-tool .socialproof-select-tool-text .socialproof-select-tool-text-target .socialproof-select-tool-text-current-target {\n color: inherit;\n font-size: 14px;\n font-weight: 700;\n margin-left: 10px;\n }\n\n .socialproof-select-tool .socialproof-select-tool-back {\n color: #4a24ea;\n background: #ffffff;\n border-radius: 10px;\n font-size: 20px;\n height: 40px;\n margin-right: 20px;\n text-align: center;\n padding: 5px 30px;\n font-weight: 700;\n border: 1px solid #ffffff;\n transition: color 0.3s ease-in-out, background 0.3s ease-in-out;\n }\n\n .socialproof-select-tool .socialproof-select-tool-choose {\n color: #ffffff;\n background: #4a24ea;\n border-radius: 10px;\n font-size: 20px;\n height: 40px;\n margin-right: 20px;\n text-align: center;\n padding: 5px 30px;\n font-weight: 700;\n border: 1px solid #ffffff;\n transition: color 0.3s ease-in-out, background 0.3s ease-in-out;\n display: none;\n }\n\n .socialproof-select-tool .socialproof-select-tool-choose:hover {\n color: #4a24ea;\n background: #ffffff;\n cursor: pointer;\n }\n\n .socialproof-select-tool .socialproof-select-tool-kill {\n z-index: 2147483647;\n position: absolute;\n top: 5px;\n right: 5px;\n color: #ff0000;\n font-size: 18px;\n height: 18px;\n width: 18px;\n font-weight: 700;\n transition: color 0.3s ease-in-out, background 0.3s ease-in-out;\n }\n\n .socialproof-select-tool .socialproof-select-tool-kill:hover {\n cursor: pointer;\n }\n\n .socialproof-select-tool .socialproof-select-tool-back:hover {\n color: #ffffff;\n cursor: pointer;\n background: #4a24ea;\n }\n\n .socialproof-selection {\n box-shadow: 0px 0px 0px 3px #4a24ea;\n }\n\n @media screen and (max-width: 768px) {\n .socialproof-select-tool {\n height: auto;\n flex-wrap: wrap;\n padding: 20px;\n }\n\n .socialproof-select-tool-fake-container {\n height: 200px;\n }\n\n .socialproof-select-tool .socialproof-select-tool-logo {\n margin-right: auto;\n margin-bottom: 20px;\n width: 30px;\n height: 30px;\n border-radius: 30px;\n border-top-right-radius: 0;\n margin: auto 0;\n margin-right: 20px;\n }\n\n .socialproof-select-tool .socialproof-select-tool-logo:after {\n width: 15px;\n height: 15px;\n border-radius: 7.5px;\n }\n\n .socialproof-select-tool .socialproof-select-tool-text {\n margin: 20px 0;\n }\n\n .socialproof-select-tool .socialproof-select-tool-kill {\n font-size: 25px;\n right: 10px;\n top: 5px;\n }\n\n .socialproof-select-tool .socialproof-select-tool-text .socialproof-select-tool-text-choose {\n font-size: 12px;\n }\n\n .socialproof-select-tool .socialproof-select-tool-text .socialproof-select-tool-text-target {\n font-size: 10px;\n }\n\n .socialproof-select-tool .socialproof-select-tool-back, .socialproof-select-tool .socialproof-select-tool-choose {\n margin: 0 auto;\n width: 100%;\n max-width: 500px;\n font-size: 12px;\n height: 30px;\n }\n\n .socialproof-select-tool .socialproof-select-tool-choose {\n margin-bottom: 8px;\n }\n }\n\n ", document.body.appendChild(style)
2208 },
2209 createInlineNotificationStyle = function() {
2210 var inlineTestData = JSON.parse(_doc_cookies2.default.getItem("trustisto_inline_test_data")),
2211 style = document.createElement("style");
2212 style.id = "socialproof-inline-test-notification-style", style.innerHTML = '\n .socialproof-inline-test-reset {\n position: static;\n float: none;\n padding: 0;\n margin: 0;\n border: 0 none;\n outline: 0 none;\n border-spacing: 0;\n color: #000;\n font-family: "Helvetica Neue", Arial, sans-serif;\n font-size: 10px;\n font-style: normal;\n font-weight: normal;\n font-variant: normal;\n line-height: normal;\n text-decoration: none;\n text-transform: none;\n text-align: left;\n text-indent: 0;\n text-shadow: none;\n letter-spacing: normal;\n word-spacing: normal;\n white-space: normal;\n direction: ltr;\n background: none repeat scroll 0 0 transparent;\n vertical-align: middle;\n overflow: visible;\n max-width: none;\n max-height: none;\n -moz-box-sizing: content-box;\n }\n\n .socialproof-inline-test-container {\n overflow: hidden;\n margin: 10px 0;\n }\n\n .socialproof-inline-test {\n box-sizing: border-box;\n color: ' + inlineTestData.color + ";\n background: " + inlineTestData.background + ";\n font-size: " + inlineTestData.font + "px;\n min-height: 18px;\n display: flex;\n align-items: center;\n padding: calc(1em / 6) 0.5em;\n border-radius: 1px;\n }\n \n .socialproof-inline-test .socialproof-inline-test-text {\n color: inherit;\n font-weight: inherit;\n font-size: inherit;\n max-width: 100% !important;\n margin-right: auto;\n }\n \n .socialproof-inline-test .socialproof-inline-test-brand {\n font-size: inherit;\n box-shadow: 0 0 0 0.1em #fefefe;\n position: relative;\n width: 1em;\n margin-left: 0.5em;\n height: 1em;\n min-width: 1em;\n min-height: 1em;\n border-radius: 0.5em 0 0.5em 0.5em;\n background: #4a25ea;\n }\n\n .socialproof-inline-test .socialproof-inline-test-brand:after {\n position: absolute;\n font-size: inherit;\n width: 0.5em;\n top: 50%;\n left: 50%;\n transform: translate(-50%, -50%);\n height: 0.5em;\n min-width: 0.5em;\n min-height: 0.5em;\n border-radius: 0.25em;\n background: #ffffff;\n content: '';\n }\n\n @keyframes socialproof-test-inline-animate {\n from {\n transform: translateX(-100vw);\n opacity: 0;\n }\n to {\n transform: translateX(0);\n opacity: 1;\n }\n }\n ", document.body.appendChild(style)
2213 },
2214 createInlineTestNotification = function(target) {
2215 var inlineTestData = JSON.parse(_doc_cookies2.default.getItem("trustisto_inline_test_data")),
2216 container = document.createElement("div");
2217 container.id = "socialproof-inline-test-container", container.className = "socialproof-inline-test-reset socialproof-inline-test-container", container.dataset.socialproofunclickable = "true";
2218 var notification = document.createElement("span");
2219 notification.className = "socialproof-inline-test-reset socialproof-inline-test", notification.dataset.socialproofunclickable = "true";
2220 var text = document.createElement("p");
2221 text.className = "socialproof-inline-test-reset socialproof-inline-test-text", text.textContent = inlineTestData.message, text.dataset.socialproofunclickable = "true";
2222 var brand = document.createElement("a");
2223 brand.className = "socialproof-inline-test-reset socialproof-inline-test-brand", brand.dataset.socialproofunclickable = "true", container.appendChild(notification), notification.appendChild(text), notification.appendChild(brand), target.lastElementChild && target.lastElementChild.nextSibling ? target.insertBefore(container, target.lastElementChild.nextSibling) : target.nextSibling && target.parentNode.insertBefore(container, target.nextSibling)
2224 },
2225 setTrustistoSelectToolCookie = function() {
2226 window.location.href.indexOf("trustisto-select-tool=1") > -1 && _doc_cookies2.default.setItem("trustisto_select_tool", 1), window.location.href.indexOf("trustisto-select-tool=2") > -1 && (_doc_cookies2.default.setItem("trustisto_select_tool", 2), _doc_cookies2.default.setItem("trustisto_inline_test_data", JSON.stringify({
2227 message: (0, _query_params2.default)("message"),
2228 color: (0, _query_params2.default)("color"),
2229 font: (0, _query_params2.default)("font"),
2230 background: (0, _query_params2.default)("background")
2231 })))
2232 },
2233 getCurrentSelector = function() {
2234 return document.querySelector(".socialproof-select-tool-reset .socialproof-select-tool-text-current-target").textContent
2235 },
2236 sendSelectorToOrigin = function() {
2237 window.opener.postMessage({
2238 name: "socialproof-select-tool-selector",
2239 selector: getCurrentSelector()
2240 }, "*"), _doc_cookies2.default.removeItem("trustisto_select_tool"), _doc_cookies2.default.removeItem("trustisto_inline_test_data"), setTimeout(function() {
2241 window.close()
2242 }, 300)
2243 },
2244 getCssStack = function(e) {
2245 e.preventDefault();
2246 var el = e.target;
2247 if (!el.dataset || !el.dataset.socialproofunclickable) {
2248 for (var stack = []; null != el.parentNode;) {
2249 for (var sibCount = 0, sibIndex = 0, i = 0; i < el.parentNode.childNodes.length; i++) {
2250 var sib = el.parentNode.childNodes[i];
2251 sib.nodeName === el.nodeName && (sib === el && (sibIndex = sibCount), sibCount++)
2252 }
2253 el.hasAttribute("id") && "" !== el.id ? stack.unshift("#" + el.id) : sibCount > 1 ? stack.unshift(el.nodeName.toLowerCase() + ":nth-of-type(" + parseInt(sibIndex + 1) + ")") : stack.unshift(el.nodeName.toLowerCase()), el = el.parentNode
2254 }
2255 var parsedIdStack = stack.filter(function(item) {
2256 return item.indexOf("#") > -1
2257 }),
2258 parsedRegularStack = stack.slice(1, stack.length);
2259 return parsedIdStack.length > 0 ? parsedRegularStack.slice(parsedRegularStack.indexOf(parsedIdStack.toString()), parsedRegularStack.length) : parsedRegularStack
2260 }
2261 },
2262 fillSelectedText = function(stack) {
2263 document.querySelector(".socialproof-select-tool-reset .socialproof-select-tool-text-current-target").textContent = stack.join(" ")
2264 },
2265 removeSelection = function() {
2266 document.querySelectorAll(".socialproof-selection").forEach(function(item) {
2267 item.classList.remove("socialproof-selection")
2268 })
2269 },
2270 removeInlineNotification = function() {
2271 var inlineNotification = document.getElementById("socialproof-inline-test-container");
2272 inlineNotification && inlineNotification.remove()
2273 },
2274 removeInlineSelection = function() {
2275 document.querySelectorAll(".socialproof-selection").forEach(function(item) {
2276 item.classList.remove("socialproof-selection")
2277 })
2278 },
2279 selectElement = function(stack) {
2280 if (stack && 0 !== stack.length) {
2281 var htmlElement = "html" !== stack.toString() ? document.querySelector(stack.join(" ")) : null;
2282 htmlElement && (htmlElement.classList.length ? document.querySelector(stack.join(" ")).classList += " socialproof-selection" : document.querySelector(stack.join(" ")).className = " socialproof-selection")
2283 }
2284 },
2285 handleSelection = function(e) {
2286 removeSelection();
2287 var stack = getCssStack(e);
2288 stack && (selectElement(stack), fillSelectedText(stack))
2289 },
2290 createInlineNotification = function(stack) {
2291 if (stack && 0 !== stack.length) {
2292 var target = document.querySelector(stack.join(" "));
2293 target && createInlineTestNotification(target)
2294 }
2295 },
2296 handleInlineSelection = function(e) {
2297 if (removeInlineSelection(), removeInlineNotification(), !e.target.closest("div") || "socialproof-inline-test-container" !== e.target.closest("div").getAttribute("id")) {
2298 var stack = getCssStack(e);
2299 stack && (selectElement(stack), fillSelectedText(stack), createInlineNotification(stack))
2300 }
2301 },
2302 showChooseBtn = function() {
2303 var chooseBtn = document.querySelector(".socialproof-select-tool-reset .socialproof-select-tool-choose");
2304 chooseBtn.style.display = "block"
2305 },
2306 hideChooseBtn = function() {
2307 var chooseBtn = document.querySelector(".socialproof-select-tool-reset .socialproof-select-tool-choose");
2308 chooseBtn.style.display = "none"
2309 },
2310 createSelectTool = function(selectToolType) {
2311 var fakeContainer = document.createElement("div");
2312 fakeContainer.className = "socialproof-select-tool-reset socialproof-select-tool-fake-container", fakeContainer.dataset.socialproofunclickable = "true", document.body.insertBefore(fakeContainer, document.body.firstChild);
2313 var selectTool = document.createElement("div");
2314 selectTool.className = "socialproof-select-tool-reset socialproof-select-tool", selectTool.dataset.socialproofunclickable = "true";
2315 var killBtn = document.createElement("span");
2316 killBtn.className = "socialproof-select-tool-reset socialproof-select-tool-kill", killBtn.innerHTML = "×", killBtn.dataset.socialproofunclickable = "true", selectTool.appendChild(killBtn);
2317 var selectToolLogo = document.createElement("a");
2318 selectToolLogo.className = "socialproof-select-tool-reset socialproof-select-tool-logo", selectToolLogo.href = "https://trustisto.com", selectToolLogo.target = "_blank", selectToolLogo.rel = "noopener noreferrer", selectToolLogo.title = "Trustisto", selectTool.appendChild(selectToolLogo), selectToolLogo.dataset.socialproofunclickable = "true";
2319 var selectToolText = document.createElement("div");
2320 selectToolText.className = "socialproof-select-tool-reset socialproof-select-tool-text", selectToolText.dataset.socialproofunclickable = "true";
2321 var selectToolTextChoose = document.createElement("p");
2322 selectToolTextChoose.className = "socialproof-select-tool-reset socialproof-select-tool-text-choose", selectToolTextChoose.dataset.socialproofunclickable = "true", selectToolTextChoose.textContent = "pl" === pageLanguage ? texts.pl.chooseElement : texts.en.chooseElement;
2323 var selectToolTextTarget = document.createElement("p");
2324 selectToolTextTarget.className = "socialproof-select-tool-reset socialproof-select-tool-text-target", selectToolTextTarget.dataset.socialproofunclickable = "true", selectToolTextTarget.textContent = "pl" === pageLanguage ? texts.pl.currentlySelected : texts.en.currentlySelected;
2325 var currentTarget = document.createElement("span");
2326 currentTarget.className = "socialproof-select-tool-reset socialproof-select-tool-text-current-target", currentTarget.dataset.socialproofunclickable = "true", currentTarget.textContent = "---", selectToolText.appendChild(selectToolTextChoose), selectToolTextTarget.appendChild(currentTarget), selectToolText.appendChild(selectToolTextTarget), selectTool.appendChild(selectToolText);
2327 var chooseBtn = document.createElement("button");
2328 chooseBtn.className = "socialproof-select-tool-reset socialproof-select-tool-choose", chooseBtn.dataset.socialproofunclickable = "true", chooseBtn.textContent = "pl" === pageLanguage ? texts.pl.chooseBtn : texts.en.chooseBtn, chooseBtn.type = "button", chooseBtn.onclick = function() {
2329 selectToolType === _static2.default.SELECT_TOOL_DEFAULT ? prependEventListeners() : selectToolType === _static2.default.SELECT_TOOL_INLINE && prependInlineEventListeners(), hideChooseBtn()
2330 }, selectTool.appendChild(chooseBtn);
2331 var backBtn = document.createElement("button");
2332 backBtn.className = "socialproof-select-tool-reset socialproof-select-tool-back", backBtn.dataset.socialproofunclickable = "true", backBtn.textContent = "pl" === pageLanguage ? texts.pl.prevBtn : texts.en.prevBtn, backBtn.type = "button", selectTool.appendChild(backBtn), document.body.insertBefore(selectTool, document.body.firstChild)
2333 },
2334 killSelectTool = function() {
2335 removeCookie(), window.location = window.location.href.replace("?trustisto-select-tool=1", "")
2336 },
2337 prependEventListeners = function() {
2338 document.body.addEventListener("mouseover", handleSelection), document.body.addEventListener("click", handleSelectorSelect), document.body.addEventListener("contextmenu", handleSelectorSelect), document.querySelector(".socialproof-select-tool-reset .socialproof-select-tool-back").addEventListener("click", removeCookie), document.querySelector(".socialproof-select-tool-reset .socialproof-select-tool-back").addEventListener("click", sendSelectorToOrigin), document.querySelector(".socialproof-select-tool-reset .socialproof-select-tool-back").addEventListener("click", removeEventListeners), document.querySelector(".socialproof-select-tool .socialproof-select-tool-kill").addEventListener("click", killSelectTool)
2339 },
2340 prependInlineEventListeners = function() {
2341 document.body.addEventListener("mouseover", handleInlineSelection), document.body.addEventListener("click", handleSelectorSelect), document.body.addEventListener("contextmenu", handleSelectorSelect), document.querySelector(".socialproof-select-tool-reset .socialproof-select-tool-back").addEventListener("click", removeCookie), document.querySelector(".socialproof-select-tool-reset .socialproof-select-tool-back").addEventListener("click", sendSelectorToOrigin), document.querySelector(".socialproof-select-tool-reset .socialproof-select-tool-back").addEventListener("click", removeEventListeners), document.querySelector(".socialproof-select-tool .socialproof-select-tool-kill").addEventListener("click", killSelectTool)
2342 },
2343 removeEventListeners = function removeEventListeners() {
2344 document.body.removeEventListener("mouseover", handleSelection), document.body.removeEventListener("click", handleSelectorSelect), document.body.removeEventListener("contextmenu", handleSelectorSelect), document.querySelector(".socialproof-select-tool-reset .socialproof-select-tool-back").removeEventListener("click", removeCookie), document.querySelector(".socialproof-select-tool-reset .socialproof-select-tool-back").removeEventListener("click", removeEventListeners)
2345 },
2346 removeInlineEventListeners = function removeInlineEventListeners() {
2347 document.body.removeEventListener("mouseover", handleInlineSelection), document.body.removeEventListener("click", handleSelectorSelect), document.body.removeEventListener("contextmenu", handleSelectorSelect), document.querySelector(".socialproof-select-tool-reset .socialproof-select-tool-back").removeEventListener("click", removeCookie), document.querySelector(".socialproof-select-tool-reset .socialproof-select-tool-back").removeEventListener("click", removeInlineEventListeners)
2348 },
2349 handleSelectorSelect = function(e) {
2350 e.preventDefault(), e.target.dataset.socialproofunclickable || (removeEventListeners(), removeInlineEventListeners(), showChooseBtn())
2351 };
2352 return base.modulesInitializers.push(function() {
2353 base.initSelectTool()
2354 }), {
2355 initSelectTool: function() {
2356 base.initialiazed && ((isTrustistoSelectToolCookieSet(_static2.default.SELECT_TOOL_DEFAULT) || hasUrlTrustistoSelectToolParam(_static2.default.SELECT_TOOL_DEFAULT)) && (setTrustistoSelectToolCookie(_static2.default.SELECT_TOOL_DEFAULT), createStyle(), createSelectTool(_static2.default.SELECT_TOOL_DEFAULT), prependEventListeners(), hideChooseBtn()), (isTrustistoSelectToolCookieSet(_static2.default.SELECT_TOOL_INLINE) || hasUrlTrustistoSelectToolParam(_static2.default.SELECT_TOOL_INLINE)) && (setTrustistoSelectToolCookie(_static2.default.SELECT_TOOL_INLINE), createStyle(), createSelectTool(_static2.default.SELECT_TOOL_INLINE), prependInlineEventListeners(), hideChooseBtn(), createInlineNotificationStyle()))
2357 }
2358 }
2359 }
2360}, function(module, exports, __webpack_require__) {
2361 "use strict";
2362
2363 function _interopRequireDefault(obj) {
2364 return obj && obj.__esModule ? obj : {
2365 default: obj
2366 }
2367 }
2368
2369 function _defineProperty(obj, key, value) {
2370 return key in obj ? Object.defineProperty(obj, key, {
2371 value: value,
2372 enumerable: !0,
2373 configurable: !0,
2374 writable: !0
2375 }) : obj[key] = value, obj
2376 }
2377 var _doc_cookies = __webpack_require__(3),
2378 _doc_cookies2 = _interopRequireDefault(_doc_cookies),
2379 _mobile = __webpack_require__(10),
2380 _xhr = __webpack_require__(2),
2381 _xhr2 = _interopRequireDefault(_xhr),
2382 USER_ID_COOKIE = "trustisto_uid",
2383 SESSION_COOKIE = "trustisto_session",
2384 SESSION_FIELDS = {
2385 sessionStart: "sessionStart",
2386 referrer: "referrer",
2387 pageCount: "pageCount"
2388 },
2389 getSessionField = function(name) {
2390 var session = JSON.parse(_doc_cookies2.default.getItem(SESSION_COOKIE));
2391 return session ? session[name] : null
2392 },
2393 updateSessionFields = function(newFields) {
2394 var session = JSON.parse(_doc_cookies2.default.getItem(SESSION_COOKIE));
2395 session = Object.assign(session || {}, newFields), _doc_cookies2.default.setItem(SESSION_COOKIE, JSON.stringify(session), null, "/")
2396 },
2397 USER_KEY = "trustisto_client",
2398 USER_FIELDS = {
2399 uid: "uid",
2400 referrer: "referrer",
2401 firstVisit: "firstVisit",
2402 pageCount: "pageCount"
2403 },
2404 updateUserFields = function(newFields) {
2405 var user = JSON.parse(localStorage.getItem(USER_KEY));
2406 user = Object.assign(user || {}, newFields), localStorage.setItem(USER_KEY, JSON.stringify(user))
2407 },
2408 getUserField = function(name) {
2409 var user = JSON.parse(localStorage.getItem(USER_KEY));
2410 return user ? user[name] : null
2411 };
2412 module.exports = function(base) {
2413 var pageTimeStart = Date.now(),
2414 checkFirstVisit = function() {
2415 var firstVisit = getUserField(USER_FIELDS.firstVisit);
2416 "undefined" != typeof firstVisit && null != firstVisit || updateUserFields(_defineProperty({}, USER_FIELDS.firstVisit, pageTimeStart))
2417 },
2418 checkSessionTime = function() {
2419 var sessionStart = getSessionField(SESSION_FIELDS.sessionStart);
2420 "undefined" != typeof sessionStart && null != sessionStart || updateSessionFields(_defineProperty({}, SESSION_FIELDS.sessionStart, pageTimeStart))
2421 },
2422 checkReferrer = function() {
2423 var currentReferrer = document.referrer,
2424 savedReferrer = getUserField(USER_FIELDS.referrer);
2425 "undefined" != typeof savedReferrer && null != savedReferrer || updateUserFields(_defineProperty({}, USER_FIELDS.referrer, currentReferrer));
2426 var sessionReferrer = getSessionField(SESSION_FIELDS.referrer);
2427 "undefined" != typeof sessionReferrer && null != sessionReferrer || updateSessionFields(_defineProperty({}, SESSION_FIELDS.referrer, currentReferrer))
2428 },
2429 increasePageCount = function() {
2430 var sessionPageCount = getSessionField(SESSION_FIELDS.pageCount);
2431 "undefined" == typeof sessionPageCount || null == sessionPageCount ? sessionPageCount = 1 : sessionPageCount += 1, updateSessionFields(_defineProperty({}, SESSION_FIELDS.pageCount, sessionPageCount));
2432 var userPageCount = getUserField(USER_FIELDS.pageCount);
2433 "undefined" == typeof userPageCount || null == userPageCount ? userPageCount = 1 : userPageCount += 1, updateUserFields(_defineProperty({}, USER_FIELDS.pageCount, userPageCount))
2434 },
2435 getUserGeoAPICall = function(geoCallback, ip) {
2436 var ajax = new _xhr2.default,
2437 geoUrl = window.SP.schema + "//api" + window.SP.url + "/users/geo?appId=" + base.appId + "&uid=" + base.uid + (ip ? "&ip=" + ip : "");
2438 ajax.sendGetRequest(geoUrl, function(req, _error) {
2439 var response = JSON.parse(req.responseText);
2440 geoCallback(response)
2441 })
2442 };
2443 return base.modulesInitializers.push(function() {
2444 checkFirstVisit(), checkReferrer(), checkSessionTime(), increasePageCount()
2445 }), {
2446 getSessionTime: function() {
2447 var sessionStart = getSessionField(SESSION_FIELDS.sessionStart);
2448 return Math.floor((Date.now() - sessionStart) / 1e3)
2449 },
2450 setSessionTimeAlarm: function(time, callback) {
2451 var diff = base.getSessionTime();
2452 diff > time ? callback() : setTimeout(callback, 1e3 * (time - diff))
2453 },
2454 getSessionPageCount: function() {
2455 return getSessionField(SESSION_FIELDS.pageCount)
2456 },
2457 getSessionSource: function() {
2458 return getSessionField(SESSION_FIELDS.referrer)
2459 },
2460 getUserPageTime: function() {
2461 return Math.floor((Date.now() - pageTimeStart) / 1e3)
2462 },
2463 setUserPageTimeAlarm: function(time, callback) {
2464 var diff = base.getUserPageTime();
2465 diff > time ? callback() : setTimeout(callback, 1e3 * (time - diff))
2466 },
2467 getUserPageCount: function() {
2468 return getUserField(USER_FIELDS.pageCount)
2469 },
2470 getUserAge: function() {
2471 var firstVisit = getUserField(USER_FIELDS.firstVisit),
2472 diff = Date.now() - firstVisit;
2473 return Math.floor(diff / 1e3 / 60 / 60 / 24)
2474 },
2475 getUserSource: function() {
2476 return getUserField(USER_FIELDS.referrer)
2477 },
2478 isUserReturning: function() {
2479 var firstVisit = getUserField(USER_FIELDS.firstVisit),
2480 sessionStart = getSessionField(SESSION_FIELDS.sessionStart);
2481 return firstVisit !== sessionStart
2482 },
2483 isUserNew: function() {
2484 return !base.isUserReturning()
2485 },
2486 getUserDeviceType: function() {
2487 return (0, _mobile.isMobile)() ? "mobile" : "desktop"
2488 },
2489 getUserGeo: function(callback, ip) {
2490 getUserGeoAPICall(function(response) {
2491 return callback(response.user.geo)
2492 }, ip)
2493 },
2494 getUserId: function() {
2495 return getUserField(USER_FIELDS.uid) || _doc_cookies2.default.getItem(USER_ID_COOKIE)
2496 },
2497 debugUserSession: function() {
2498 return console.log(JSON.parse(_doc_cookies2.default.getItem(SESSION_COOKIE)))
2499 },
2500 debugUser: function() {
2501 return console.log(JSON.parse(localStorage.getItem(USER_KEY)))
2502 }
2503 }
2504 }
2505}, function(module, exports, __webpack_require__) {
2506 "use strict";
2507 module.exports = function(base) {
2508 var initTabTicker = function(cfg) {
2509 var enabled = cfg.enabled,
2510 message = cfg.message,
2511 options = cfg.options;
2512 enabled && ! function() {
2513 var title = document.title;
2514 "flash" === options.style ? ! function() {
2515 var interval = void 0,
2516 i = 1;
2517 window.onblur = function() {
2518 interval = setInterval(function() {
2519 i % 2 === 0 ? document.title = message : document.title = title, i++
2520 }, 1e3), document.title = message, i = 0
2521 }, window.onfocus = function() {
2522 clearInterval(interval), interval = null, document.title = title, i = 0
2523 }
2524 }() : "static" === options.style ? (window.onfocus = function() {
2525 document.title = title
2526 }, window.onblur = function() {
2527 document.title = message
2528 }) : "scrolling" === options.style && ! function() {
2529 var interval = void 0,
2530 timeout = void 0,
2531 animateText = function(text, windowSize, callback) {
2532 var i = 0;
2533 interval = setInterval(function() {
2534 i === text.length + 1 ? timeout = setTimeout(function() {
2535 i = 0
2536 }, 1500) : (callback(text.substr(i, windowSize + i)), i++)
2537 }, 1e3)
2538 };
2539 window.onblur = function() {
2540 return animateText(message, 20, function(txt) {
2541 document.title = txt
2542 })
2543 }, window.onfocus = function() {
2544 clearInterval(interval), clearTimeout(timeout), document.title = title
2545 }
2546 }()
2547 }()
2548 };
2549 base.modulesInitializers.push(function() {
2550 base.configuration.config.tabticker && initTabTicker(base.configuration.config.tabticker)
2551 })
2552 }
2553}, function(module, exports, __webpack_require__) {
2554 "use strict";
2555
2556 function _interopRequireDefault(obj) {
2557 return obj && obj.__esModule ? obj : {
2558 default: obj
2559 }
2560 }
2561 var _triggers = __webpack_require__(9),
2562 _curlycurly = __webpack_require__(5),
2563 _curlycurly2 = _interopRequireDefault(_curlycurly),
2564 _pipes = __webpack_require__(8),
2565 _pipes2 = _interopRequireDefault(_pipes),
2566 TAG_MANAGER_CONFIG = {
2567 containerId: "socialproof-tagmanager",
2568 sortBy: "priority"
2569 },
2570 createContainer = function() {
2571 var container = document.querySelector("#" + TAG_MANAGER_CONFIG.containerId);
2572 if (container) return container;
2573 var tagManagerContainer = document.createElement("div");
2574 return tagManagerContainer.setAttribute("id", TAG_MANAGER_CONFIG.containerId), document.body.appendChild(tagManagerContainer), tagManagerContainer
2575 },
2576 createTag = function(tag, params) {
2577 var cc = new _curlycurly2.default(params, _pipes2.default),
2578 parsedTag = cc.compile(tag.body),
2579 node = document.createRange().createContextualFragment(parsedTag);
2580 return node
2581 },
2582 mapTags = function(tags, params) {
2583 var container = document.getElementById(TAG_MANAGER_CONFIG.containerId);
2584 tags.forEach(function(tag) {
2585 var t = createTag(tag, params);
2586 container.appendChild(t)
2587 })
2588 };
2589 module.exports = function(base) {
2590 return base.modulesInitializers.push(function() {
2591 if (base.configuration.config.tags && 0 !== base.configuration.config.tags.length) {
2592 createContainer(), base.triggerListeners.push(function(triggeredTypes, params) {
2593 (0, _triggers.getTriggeredObjectPerTriggerType)(base.configuration.config.tags, triggeredTypes, params, function(tag) {
2594 mapTags([tag])
2595 })
2596 });
2597 var sortedTags = base.configuration.config.tags.sort(function(a, b) {
2598 return parseInt(a[TAG_MANAGER_CONFIG.sortBy]) - parseInt(b[TAG_MANAGER_CONFIG.sortBy])
2599 }).reverse();
2600 (0, _triggers.getTriggeredObjectPerURL)(sortedTags, window.location.pathname, function(tag) {
2601 mapTags([tag])
2602 })
2603 }
2604 }), {
2605 injectTag: function(tag) {
2606 var container = createContainer(),
2607 tagNode = document.createRange().createContextualFragment(tag);
2608 container.appendChild(tagNode)
2609 }
2610 }
2611 }
2612}, function(module, exports, __webpack_require__) {
2613 "use strict";
2614
2615 function _interopRequireDefault(obj) {
2616 return obj && obj.__esModule ? obj : {
2617 default: obj
2618 }
2619 }
2620 var _query_params = __webpack_require__(4),
2621 _query_params2 = _interopRequireDefault(_query_params);
2622 module.exports = function() {
2623 var topbars = [],
2624 getTopbarElement = function(target) {
2625 return topbars.find(function(t) {
2626 return t.topbarId === target
2627 })
2628 },
2629 createStyle = function(options, target) {
2630 var style = document.createElement("style");
2631 style.id = "socialproof-topbar-style-" + target;
2632 var topbarStyle = "\n .socialproof-topbar-reset-" + target + ' {\n position: static;\n float: none;\n padding: 0;\n margin: 0;\n border: 0 none;\n outline: 0 none;\n border-spacing: 0;\n color: #000;\n font-family: "Helvetica Neue", Arial, sans-serif;\n font-size: 10px;\n font-style: normal;\n font-weight: normal;\n font-variant: normal;\n line-height: normal;\n text-decoration: none;\n text-transform: none;\n text-align: left;\n text-indent: 0;\n text-shadow: none;\n letter-spacing: normal;\n word-spacing: normal;\n white-space: normal;\n direction: ltr;\n background: none repeat scroll 0 0 transparent;\n vertical-align: middle;\n overflow: visible;\n max-width: none;\n max-height: none;\n -moz-box-sizing: content-box;\n }\n\n .socialproof-topbar-' + target + " {\n position: absolute;\n " + ("top" === options.topbarPosition ? "top: 0;" : "") + "\n " + ("bottom" === options.topbarPosition ? "bottom: 0;" : "") + "\n left: 0;\n background: " + options.background + ";\n color: " + options.color + ";\n font-size: " + options.fontSize + "px;\n height: " + options.height + "px;\n width: 100%;\n display: flex;\n justify-content: center;\n align-items: center;\n animation: socialproof-topbar-appear 1s forwards;\n z-index: 10000000;\n }\n\n .socialproof-fake-topbar-" + target + " {\n z-index: -1;\n height: " + options.height + "px;\n animation: socialproof-topbar-appear 1s forwards;\n }\n\n .socialproof-topbar-" + target + " .socialproof-topbar-text-" + target + " {\n font-size: inherit;\n color: inherit;\n white-space: nowrap;\n }\n\n .socialproof-topbar-" + target + " .socialproof-topbar-text-" + target + " a {\n font-size: inherit;\n color: inherit;\n white-space: nowrap;\n font-weight: 700;\n }\n\n .socialproof-topbar-disappear-" + target + " .socialproof-topbar-text-" + target + " {\n font-size: inherit;\n color: inherit;\n white-space: nowrap;\n animation: socialproof-topbar-hide 1s;\n }\n\n .socialproof-topbar-" + target + " .socialproof-topbar-close-" + target + " {\n z-index: 10000000;\n position: absolute;\n top: 3px;\n right: 3px;\n width: 16px;\n height: 16px;\n background: #ff0000;\n border-radius: 50%;\n animation: socialproof-topbar-hide-close-button 0.35s;\n animation-direction: reverse;\n }\n \n .socialproof-topbar-" + target + " .socialproof-topbar-close-" + target + ":before, .socialproof-topbar-close-" + target + ":after {\n position: absolute;\n top: 3px;\n right: 7px;\n content: ' ';\n height: 10px;\n width: 2px;\n background-color: #ffffff;\n }\n \n .socialproof-topbar-" + target + " .socialproof-topbar-close-" + target + ":before{\n transform: rotate(45deg);\n }\n \n .socialproof-topbar-" + target + " .socialproof-topbar-close-" + target + ":after{\n transform: rotate(-45deg);\n }\n \n .socialproof-topbar-" + target + " .socialproof-topbar-close-" + target + ":hover {\n cursor: pointer;\n }\n\n .socialproof-topbar-disappear-" + target + " {\n animation: socialproof-topbar-disappear 2s forwards;\n }\n\n .socialproof-topbar-disappear-" + target + " .socialproof-topbar-close-" + target + " {\n animation: socialproof-topbar-hide-close-button 0.65s forwards;\n }\n\n .socialproof-topbar-bottom-disappear-" + target + " {\n animation: socialproof-topbar-hide 0.65s forwards;\n }\n\n @keyframes socialproof-topbar-hide-close-button {\n from { opacity: 1; transform: scale(1); }\n to { opacity: 0; transform: scale(0); }\n }\n\n @keyframes socialproof-topbar-disappear {\n 0% {\n opacity: 1;\n overflow: hidden;\n height: " + options.height + "px;\n }\n 55% {\n height: 0;\n }\n 100% {\n opacity: 0;\n }\n }\n\n @keyframes socialproof-topbar-appear {\n 0% {\n opacity: 0;\n height: 0;\n }\n 100% {\n opacity: 1;\n height: " + options.height + "px;\n }\n }\n\n @keyframes socialproof-topbar-hide {\n from {opacity: 1}\n to {opacity: 0}\n }\n ";
2633 return style.innerHTML = topbarStyle, document.body.appendChild(style), style
2634 },
2635 createIframe = function(url, target) {
2636 var iframe = document.createElement("iframe");
2637 return iframe.style.width = "100%", iframe.style.height = "100%", iframe.style.border = "none", iframe.src = url, target.appendChild(iframe), iframe
2638 },
2639 createTopbar = function(url, options, target) {
2640 var topbar = document.createElement("div");
2641 if (topbar.id = "socialproof-topbar-" + target, topbar.className = "socialproof-topbar-reset-" + target + " socialproof-topbar-" + target, !url) {
2642 var topbarText = document.createElement("p");
2643 topbarText.className = "socialproof-topbar-reset-" + target + " socialproof-topbar-text-" + target, topbarText.innerHTML = options.text, topbar.appendChild(topbarText)
2644 }
2645 if (options.showCloseBtn) {
2646 var closeBtn = document.createElement("span");
2647 closeBtn.className = "socialproof-topbar-reset-" + target + " socialproof-topbar-close-" + target, closeBtn.id = "socialproof-topbar-close-" + target, topbar.appendChild(closeBtn)
2648 }
2649 var fakeTopbar = document.createElement("div");
2650 "top" === options.topbarPosition && (fakeTopbar.className = "socialproof-fake-topbar-" + target, fakeTopbar.id = "socialproof-fake-topbar-" + target, document.body.insertBefore(fakeTopbar, document.body.firstChild)), document.body.insertBefore(topbar, document.body.firstChild), topbars.push({
2651 topbarId: target,
2652 topbar: topbar,
2653 fakeTopbar: fakeTopbar.className ? fakeTopbar : null,
2654 style: createStyle(options, target),
2655 options: options,
2656 iframe: url ? createIframe(url, topbar) : null
2657 })
2658 },
2659 _removeTopbar = function(target) {
2660 var topbarElement = getTopbarElement(target);
2661 if (topbarElement) {
2662 var topbar = topbarElement.topbar,
2663 fakeTopbar = topbarElement.fakeTopbar;
2664 "top" === topbarElement.options.topbarPosition ? topbar.classList.add("socialproof-topbar-disappear-" + target) : topbar.classList.add("socialproof-topbar-bottom-disappear-" + target), fakeTopbar && fakeTopbar.classList.add("socialproof-topbar-disappear-" + target), setTimeout(function() {
2665 window.removeEventListener("scroll", topbarElement.stickyHandler), topbarElement.topbar.remove(), topbarElement.style.remove(), topbarElement.fakeTopbar && topbarElement.fakeTopbar.remove();
2666 var indexToRemove = topbars.findIndex(function(item) {
2667 return item.topbarId === target
2668 });
2669 topbars.splice(indexToRemove, 1)
2670 }, 1e3)
2671 }
2672 },
2673 prependEventListeners = function(url, options, target) {
2674 var topbarElement = getTopbarElement(target);
2675 url && window.addEventListener("message", function(message) {
2676 message && message.data && "socialproof_close" === message.data.event && _removeTopbar(message.data.id)
2677 }, !1), topbarElement && ((options.sticky || "bottom" === options.topbarPosition) && (topbarElement.stickyHandler = function() {
2678 var topbar = topbarElement.topbar;
2679 "top" === options.topbarPosition ? topbar.style.top = window.pageYOffset - 1 + "px" : topbar.style.top = window.innerHeight + window.scrollY - topbar.clientHeight + 1 + "px"
2680 }, window.addEventListener("scroll", topbarElement.stickyHandler), window.addEventListener("resize", topbarElement.stickyHandler)), options.showCloseBtn && ! function() {
2681 var closeBtn = document.getElementById("socialproof-topbar-close-" + target);
2682 topbarElement.closeBtnHandler = function() {
2683 _removeTopbar(target), closeBtn.removeEventListener("click", topbarElement.closeBtnHandler), window.removeEventListener("scroll", topbarElement.stickyHandler), window.removeEventListener("resize", topbarElement.stickyHandler)
2684 }, closeBtn.addEventListener("click", topbarElement.closeBtnHandler)
2685 }())
2686 },
2687 _showTopbar = function(url, options, target) {
2688 createTopbar(url, options, target), prependEventListeners(url, options, target)
2689 };
2690 return {
2691 showTopbar: function(url, options, target) {
2692 var targetId = target || (0, _query_params2.default)("id", url) || "topbar_" + (new Date).getTime().toString(),
2693 DEFAULT_OPTIONS = {
2694 background: "transparent",
2695 color: "#ffffff",
2696 fontSize: "12px",
2697 height: 60,
2698 showCloseBtn: !0,
2699 sticky: !0,
2700 text: "Lorem ipsum",
2701 topbarPosition: "top"
2702 },
2703 ALL_OPTIONS = Object.assign(DEFAULT_OPTIONS, options || {});
2704 _showTopbar(url, ALL_OPTIONS, targetId)
2705 },
2706 removeTopbar: function(target) {
2707 _removeTopbar(target)
2708 }
2709 }
2710 }
2711}, function(module, exports, __webpack_require__) {
2712 "use strict";
2713 module.exports = function(base) {
2714 return {
2715 viewProduct: function(productId, params, viewTimespan, buyTimespan) {
2716 window.SP.log("SCRIPT DEPRECATED: viewProduct " + productId, params), base.initialiazed ? (base.sendEvent({
2717 name: "view",
2718 productId: productId,
2719 params: params,
2720 timespan: viewTimespan
2721 }, function(viewResponse, viewMessage) {
2722 base.queueNotify(viewResponse, viewMessage)
2723 }), base.getEvent({
2724 name: "buy",
2725 productId: productId,
2726 timespan: buyTimespan
2727 }, function(buyResponse, buyMessage) {
2728 base.queueNotify(buyResponse, buyMessage)
2729 })) : base.q(["viewProduct", productId, params])
2730 },
2731 buyProduct: function(productId, params, buyTimespan) {
2732 window.SP.log("SCRIPT DEPRECATED: buyProduct " + productId, params), base.initialiazed ? base.sendEvent({
2733 name: "buy",
2734 productId: productId,
2735 params: params,
2736 timespan: buyTimespan
2737 }, function(_response, _message) {}) : base.q(["buyProduct", productId, params])
2738 },
2739 homepage: function(buyTimespan) {
2740 window.SP.log("SCRIPT DEPRECATED: homepage"), base.initialiazed ? base.shuffleEvent({
2741 name: "buy",
2742 timespan: buyTimespan
2743 }, function(response, message) {
2744 base.queueNotify(response, message)
2745 }) : base.q(["homepage"])
2746 }
2747 }
2748 }
2749}, function(module, exports, __webpack_require__) {
2750 "use strict";
2751
2752 function _interopRequireDefault(obj) {
2753 return obj && obj.__esModule ? obj : {
2754 default: obj
2755 }
2756 }
2757 var _static = __webpack_require__(1),
2758 _static2 = _interopRequireDefault(_static);
2759 module.exports = function(base) {
2760 return {
2761 startPage: function() {
2762 window.SP.log("TRACKING startPage"), base.initialiazed ? (base.push("home", {}), base.trigger(_static2.default.TRIGGER_TYPE_S_HOMEPAGE)) : base.q(["startPage"])
2763 },
2764 productPage: function(params) {
2765 window.SP.log("TRACKING productPage", params), base.initialiazed ? (base.push("view", params), base.trigger(_static2.default.TRIGGER_TYPE_S_PRODUCT, params)) : base.q(["productPage", params])
2766 },
2767 categoryPage: function(params) {
2768 window.SP.log("TRACKIN categoryPage", params), base.initialiazed ? (base.push("category", params), base.trigger(_static2.default.TRIGGER_TYPE_S_CATEGORY, params)) : base.q(["categoryPage", params])
2769 },
2770 searchPage: function(params) {
2771 window.SP.log("TRACKING searchPage", params), base.initialiazed ? (base.push("search", params), base.trigger(_static2.default.TRIGGER_TYPE_S_SEARCH, params)) : base.q(["searchPage", params])
2772 },
2773 categoryAndSearchPage: function(params) {
2774 window.SP.log("TRACKING categoryAndSearchPage", params), base.initialiazed ? (base.push("search", params), base.push("category", params), base.triggerMulti([_static2.default.TRIGGER_TYPE_S_SEARCH, _static2.default.TRIGGER_TYPE_S_CATEGORY], params)) : base.q(["categoryAndSearchPage", params])
2775 },
2776 addToBasket: function(params) {
2777 if (base.initialiazed) {
2778 window.SP.log("TRACKING addToBasket", params);
2779 var basket = JSON.parse(localStorage.getItem(_static2.default.LS_BASKET_KEY)) || [];
2780 basket.push(params), localStorage.setItem(_static2.default.LS_BASKET_KEY, JSON.stringify(basket)), base.push("addToBasket", params), base.trigger(_static2.default.TRIGGER_TYPE_BASKET_ADD, params)
2781 } else base.q(["addToBasket", params])
2782 },
2783 removeFromBasket: function(params) {
2784 if (base.initialiazed) {
2785 window.SP.log("TRACKING removeFromBasket", params);
2786 var basket = JSON.parse(localStorage.getItem(_static2.default.LS_BASKET_KEY));
2787 if (!basket) return;
2788 var itemIndexToRemove = basket.findIndex(function(p) {
2789 return p.productId === params.productId
2790 });
2791 itemIndexToRemove > -1 && (basket.splice(itemIndexToRemove, 1), localStorage.setItem(_static2.default.LS_BASKET_KEY, JSON.stringify(basket))), base.push("removeFromBasket", params), base.trigger(_static2.default.TRIGGER_TYPE_BASKET_REMOVE, params)
2792 } else base.q(["removeFromBasket", params])
2793 },
2794 saveClient: function(params) {
2795 if (base.initialiazed) {
2796 window.SP.log("TRACKING saveCLient", params);
2797 var client = JSON.parse(localStorage.getItem(_static2.default.LS_CLIENT_KEY));
2798 client = client ? Object.assign(client, params) : params, localStorage.setItem(_static2.default.LS_CLIENT_KEY, JSON.stringify(client)), base.trigger(_static2.default.TRIGGER_TYPE_CLIENT_UPDATE, client)
2799 } else base.q(["saveClient", params])
2800 },
2801 basketPage: function(params) {
2802 if (base.initialiazed) {
2803 window.SP.log("TRACKING basketPage", params);
2804 var basket = null;
2805 params ? (basket = params, localStorage.setItem(_static2.default.LS_BASKET_KEY, JSON.stringify(params))) : basket = JSON.parse(localStorage.getItem(_static2.default.LS_BASKET_KEY)), base.push("basket", basket), base.trigger(_static2.default.TRIGGER_TYPE_S_BASKET, basket)
2806 } else base.q(["basketPage", params])
2807 },
2808 thankYouPage: function(params) {
2809 window.SP.log("TRACKING thankYouPage", params), base.initialiazed ? ! function() {
2810 var localBasket = JSON.parse(localStorage.getItem(_static2.default.LS_BASKET_KEY)) || [],
2811 localClient = JSON.parse(localStorage.getItem(_static2.default.LS_CLIENT_KEY)) || {},
2812 basket = params && params.basket || localBasket,
2813 order = params && params.order,
2814 client = params && params.client ? Object.assign(localClient, params.client) : localClient;
2815 basket.forEach(function(basketItem) {
2816 base.push("buy", Object.assign(basketItem, Object.assign(client || {}, {
2817 order: order.id
2818 })))
2819 }), base.trigger(_static2.default.TRIGGER_TYPE_S_THANKYOU, {
2820 basket: basket,
2821 order: order,
2822 client: client
2823 }), localStorage.removeItem(_static2.default.LS_BASKET_KEY)
2824 }() : base.q(["thankYouPage", params])
2825 },
2826 getBasketSize: function() {
2827 var basket = JSON.parse(localStorage.getItem("trustisto_basket")) || [];
2828 return basket.reduce(function(sum, product) {
2829 return sum + (parseInt(product.quantity) || 1)
2830 }, 0)
2831 },
2832 getBasketValue: function() {
2833 var basket = JSON.parse(localStorage.getItem("trustisto_basket")) || [];
2834 return basket.reduce(function(sum, product) {
2835 return product.sum ? sum + parseFloat(product.sum) : product.price && product.quantity ? sum + parseFloat(product.price) * parseInt(product.quantity) : product.price ? sum + parseFloat(product.price) : sum
2836 }, 0)
2837 }
2838 }
2839 }
2840}, function(module, exports, __webpack_require__) {
2841 "use strict";
2842 var custom = __webpack_require__(18),
2843 iaishop = __webpack_require__(71),
2844 sstore = __webpack_require__(75),
2845 shoptet = __webpack_require__(74),
2846 redcart = __webpack_require__(73),
2847 bestseller = __webpack_require__(69),
2848 fastcentrik = __webpack_require__(70),
2849 kqs = __webpack_require__(72);
2850 module.exports = {
2851 platforms: {
2852 custom: custom,
2853 iaishop: iaishop,
2854 sstore: sstore,
2855 shoptet: shoptet,
2856 redcart: redcart,
2857 bestseller: bestseller,
2858 fastcentrik: fastcentrik,
2859 kqs: kqs
2860 }
2861 }
2862}, function(module, exports, __webpack_require__) {
2863 "use strict";
2864 Array.prototype.filter || (Array.prototype.filter = function(fun) {
2865 var len = this.length;
2866 if ("function" != typeof fun) throw new TypeError;
2867 for (var res = new Array, thisp = arguments[1], i = 0; i < len; i++)
2868 if (i in this) {
2869 var val = this[i];
2870 fun.call(thisp, val, i, this) && res.push(val)
2871 } return res
2872 })
2873}, function(module, exports, __webpack_require__) {
2874 "use strict";
2875 Array.prototype.forEach || (Array.prototype.forEach = function(callback) {
2876 var T, k;
2877 if (null == this) throw new TypeError("this is null or not defined");
2878 var O = Object(this),
2879 len = O.length >>> 0;
2880 if ("function" != typeof callback) throw new TypeError(callback + " is not a function");
2881 for (arguments.length > 1 && (T = arguments[1]), k = 0; k < len;) {
2882 var kValue;
2883 k in O && (kValue = O[k], callback.call(T, kValue, k, O)), k++
2884 }
2885 })
2886}, function(module, exports, __webpack_require__) {
2887 "use strict";
2888 Array.prototype.indexOf || (Array.prototype.indexOf = function(member, startFrom) {
2889 if (null == this) throw new TypeError("Array.prototype.indexOf() - can't convert `" + this + "` to object");
2890 var index = isFinite(startFrom) ? Math.floor(startFrom) : 0,
2891 that = this instanceof Object ? this : new Object(this),
2892 length = isFinite(that.length) ? Math.floor(that.length) : 0;
2893 if (index >= length) return -1;
2894 if (index < 0 && (index = Math.max(length + index, 0)), void 0 === member) {
2895 do
2896 if (index in that && void 0 === that[index]) return index; while (++index < length)
2897 } else
2898 do
2899 if (that[index] === member) return index; while (++index < length);
2900 return -1
2901 })
2902}, function(module, exports, __webpack_require__) {
2903 "use strict";
2904 Array.prototype.map || (Array.prototype.map = function(callback) {
2905 var T, A, k;
2906 if (null == this) throw new TypeError("this is null or not defined");
2907 var O = Object(this),
2908 len = O.length >>> 0;
2909 if ("function" != typeof callback) throw new TypeError(callback + " is not a function");
2910 for (arguments.length > 1 && (T = arguments[1]), A = new Array(len), k = 0; k < len;) {
2911 var kValue, mappedValue;
2912 k in O && (kValue = O[k], mappedValue = callback.call(T, kValue, k, O), A[k] = mappedValue), k++
2913 }
2914 return A
2915 })
2916}, function(module, exports, __webpack_require__) {
2917 "use strict"; /*! npm.im/object-fit-images 3.2.4 */
2918 window.SP_objectFitImages = function() {
2919 function createPlaceholder(w, h) {
2920 return "data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='" + w + "' height='" + h + "'%3E%3C/svg%3E"
2921 }
2922
2923 function polyfillCurrentSrc(el) {
2924 if (el.srcset && !supportsCurrentSrc && window.picturefill) {
2925 var pf = window.picturefill._;
2926 el[pf.ns] && el[pf.ns].evaled || pf.fillImg(el, {
2927 reselect: !0
2928 }), el[pf.ns].curSrc || (el[pf.ns].supported = !1, pf.fillImg(el, {
2929 reselect: !0
2930 })), el.currentSrc = el[pf.ns].curSrc || el.src
2931 }
2932 }
2933
2934 function getStyle(el) {
2935 for (var parsed, style = getComputedStyle(el).fontFamily, props = {}; null !== (parsed = propRegex.exec(style));) props[parsed[1]] = parsed[2];
2936 return props
2937 }
2938
2939 function setPlaceholder(img, width, height) {
2940 var placeholder = createPlaceholder(width || 1, height || 0);
2941 nativeGetAttribute.call(img, "src") !== placeholder && nativeSetAttribute.call(img, "src", placeholder)
2942 }
2943
2944 function onImageReady(img, callback) {
2945 img.naturalWidth ? callback(img) : setTimeout(onImageReady, 100, img, callback)
2946 }
2947
2948 function fixOne(el) {
2949 var style = getStyle(el),
2950 ofi = el[OFI];
2951 if (style["object-fit"] = style["object-fit"] || "fill", !ofi.img) {
2952 if ("fill" === style["object-fit"]) return;
2953 if (!ofi.skipTest && supportsObjectFit && !style["object-position"]) return
2954 }
2955 if (!ofi.img) {
2956 ofi.img = new Image(el.width, el.height), ofi.img.srcset = nativeGetAttribute.call(el, "data-ofi-srcset") || el.srcset, ofi.img.src = nativeGetAttribute.call(el, "data-ofi-src") || el.src, nativeSetAttribute.call(el, "data-ofi-src", el.src), el.srcset && nativeSetAttribute.call(el, "data-ofi-srcset", el.srcset), setPlaceholder(el, el.naturalWidth || el.width, el.naturalHeight || el.height), el.srcset && (el.srcset = "");
2957 try {
2958 keepSrcUsable(el)
2959 } catch (err) {
2960 window.console && console.warn("https://bit.ly/ofi-old-browser")
2961 }
2962 }
2963 polyfillCurrentSrc(ofi.img), el.style.backgroundImage = 'url("' + (ofi.img.currentSrc || ofi.img.src).replace(/"/g, '\\"') + '")', el.style.backgroundPosition = style["object-position"] || "center", el.style.backgroundRepeat = "no-repeat", el.style.backgroundOrigin = "content-box", /scale-down/.test(style["object-fit"]) ? onImageReady(ofi.img, function() {
2964 ofi.img.naturalWidth > el.width || ofi.img.naturalHeight > el.height ? el.style.backgroundSize = "contain" : el.style.backgroundSize = "auto"
2965 }) : el.style.backgroundSize = style["object-fit"].replace("none", "auto").replace("fill", "100% 100%"), onImageReady(ofi.img, function(img) {
2966 setPlaceholder(el, img.naturalWidth, img.naturalHeight)
2967 })
2968 }
2969
2970 function keepSrcUsable(el) {
2971 var descriptors = {
2972 get: function(prop) {
2973 return el[OFI].img[prop ? prop : "src"]
2974 },
2975 set: function(value, prop) {
2976 return el[OFI].img[prop ? prop : "src"] = value, nativeSetAttribute.call(el, "data-ofi-" + prop, value), fixOne(el), value
2977 }
2978 };
2979 Object.defineProperty(el, "src", descriptors), Object.defineProperty(el, "currentSrc", {
2980 get: function() {
2981 return descriptors.get("currentSrc")
2982 }
2983 }), Object.defineProperty(el, "srcset", {
2984 get: function() {
2985 return descriptors.get("srcset")
2986 },
2987 set: function(ss) {
2988 return descriptors.set(ss, "srcset")
2989 }
2990 })
2991 }
2992
2993 function hijackAttributes() {
2994 function getOfiImageMaybe(el, name) {
2995 return el[OFI] && el[OFI].img && ("src" === name || "srcset" === name) ? el[OFI].img : el
2996 }
2997 supportsObjectPosition || (HTMLImageElement.prototype.getAttribute = function(name) {
2998 return nativeGetAttribute.call(getOfiImageMaybe(this, name), name)
2999 }, HTMLImageElement.prototype.setAttribute = function(name, value) {
3000 return nativeSetAttribute.call(getOfiImageMaybe(this, name), name, String(value))
3001 })
3002 }
3003
3004 function fix(imgs, opts) {
3005 var startAutoMode = !autoModeEnabled && !imgs;
3006 if (opts = opts || {}, imgs = imgs || "img", supportsObjectPosition && !opts.skipTest || !supportsOFI) return !1;
3007 "img" === imgs ? imgs = document.getElementsByTagName("img") : "string" == typeof imgs ? imgs = document.querySelectorAll(imgs) : "length" in imgs || (imgs = [imgs]);
3008 for (var i = 0; i < imgs.length; i++) imgs[i][OFI] = imgs[i][OFI] || {
3009 skipTest: opts.skipTest
3010 }, fixOne(imgs[i]);
3011 startAutoMode && (document.body.addEventListener("load", function(e) {
3012 "IMG" === e.target.tagName && fix(e.target, {
3013 skipTest: opts.skipTest
3014 })
3015 }, !0), autoModeEnabled = !0, imgs = "img"), opts.watchMQ && window.addEventListener("resize", fix.bind(null, imgs, {
3016 skipTest: opts.skipTest
3017 }))
3018 }
3019 var OFI = "bfred-it:object-fit-images",
3020 propRegex = /(object-fit|object-position)\s*:\s*([-.\w\s%]+)/g,
3021 testImg = "undefined" == typeof Image ? {
3022 style: {
3023 "object-position": 1
3024 }
3025 } : new Image,
3026 supportsObjectFit = "object-fit" in testImg.style,
3027 supportsObjectPosition = "object-position" in testImg.style,
3028 supportsOFI = "background-size" in testImg.style,
3029 supportsCurrentSrc = "string" == typeof testImg.currentSrc,
3030 nativeGetAttribute = testImg.getAttribute,
3031 nativeSetAttribute = testImg.setAttribute,
3032 autoModeEnabled = !1;
3033 return fix.supportsObjectFit = supportsObjectFit, fix.supportsObjectPosition = supportsObjectPosition, hijackAttributes(), fix
3034 }()
3035}, function(module, exports, __webpack_require__) {
3036 "use strict";
3037 "function" != typeof Object.assign && Object.defineProperty(Object, "assign", {
3038 value: function(target, varArgs) {
3039 if (null == target) throw new TypeError("Cannot convert undefined or null to object");
3040 for (var to = Object(target), index = 1; index < arguments.length; index++) {
3041 var nextSource = arguments[index];
3042 if (null != nextSource)
3043 for (var nextKey in nextSource) Object.prototype.hasOwnProperty.call(nextSource, nextKey) && (to[nextKey] = nextSource[nextKey])
3044 }
3045 return to
3046 },
3047 writable: !0,
3048 configurable: !0
3049 })
3050}, function(module, exports, __webpack_require__) {
3051 "use strict";
3052 (function(global) {
3053 var _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(obj) {
3054 return typeof obj
3055 } : function(obj) {
3056 return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj
3057 };
3058 ! function(global) {
3059 var checkIfIteratorIsSupported = function() {
3060 try {
3061 return !!Symbol.iterator
3062 } catch (error) {
3063 return !1
3064 }
3065 },
3066 iteratorSupported = checkIfIteratorIsSupported(),
3067 createIterator = function(items) {
3068 var iterator = {
3069 next: function() {
3070 var value = items.shift();
3071 return {
3072 done: void 0 === value,
3073 value: value
3074 }
3075 }
3076 };
3077 return iteratorSupported && (iterator[Symbol.iterator] = function() {
3078 return iterator
3079 }), iterator
3080 },
3081 serializeParam = function(value) {
3082 return encodeURIComponent(value).replace(/%20/g, "+")
3083 },
3084 deserializeParam = function(value) {
3085 return decodeURIComponent(String(value).replace(/\+/g, " "))
3086 },
3087 polyfillURLSearchParams = function() {
3088 var URLSearchParams = function URLSearchParams(searchString) {
3089 Object.defineProperty(this, "_entries", {
3090 writable: !0,
3091 value: {}
3092 });
3093 var typeofSearchString = "undefined" == typeof searchString ? "undefined" : _typeof(searchString);
3094 if ("undefined" === typeofSearchString);
3095 else if ("string" === typeofSearchString) "" !== searchString && this._fromString(searchString);
3096 else if (searchString instanceof URLSearchParams) {
3097 var _this = this;
3098 searchString.forEach(function(value, name) {
3099 _this.append(name, value)
3100 })
3101 } else {
3102 if (null === searchString || "object" !== typeofSearchString) throw new TypeError("Unsupported input's type for URLSearchParams");
3103 if ("[object Array]" === Object.prototype.toString.call(searchString))
3104 for (var i = 0; i < searchString.length; i++) {
3105 var entry = searchString[i];
3106 if ("[object Array]" !== Object.prototype.toString.call(entry) && 2 === entry.length) throw new TypeError("Expected [string, any] as entry at index " + i + " of URLSearchParams's input");
3107 this.append(entry[0], entry[1])
3108 } else
3109 for (var key in searchString) searchString.hasOwnProperty(key) && this.append(key, searchString[key])
3110 }
3111 },
3112 proto = URLSearchParams.prototype;
3113 proto.append = function(name, value) {
3114 name in this._entries ? this._entries[name].push(String(value)) : this._entries[name] = [String(value)]
3115 }, proto.delete = function(name) {
3116 delete this._entries[name]
3117 }, proto.get = function(name) {
3118 return name in this._entries ? this._entries[name][0] : null
3119 }, proto.getAll = function(name) {
3120 return name in this._entries ? this._entries[name].slice(0) : []
3121 }, proto.has = function(name) {
3122 return name in this._entries
3123 }, proto.set = function(name, value) {
3124 this._entries[name] = [String(value)]
3125 }, proto.forEach = function(callback, thisArg) {
3126 var entries;
3127 for (var name in this._entries)
3128 if (this._entries.hasOwnProperty(name)) {
3129 entries = this._entries[name];
3130 for (var i = 0; i < entries.length; i++) callback.call(thisArg, entries[i], name, this)
3131 }
3132 }, proto.keys = function() {
3133 var items = [];
3134 return this.forEach(function(value, name) {
3135 items.push(name)
3136 }), createIterator(items)
3137 }, proto.values = function() {
3138 var items = [];
3139 return this.forEach(function(value) {
3140 items.push(value)
3141 }), createIterator(items)
3142 }, proto.entries = function() {
3143 var items = [];
3144 return this.forEach(function(value, name) {
3145 items.push([name, value])
3146 }), createIterator(items)
3147 }, iteratorSupported && (proto[Symbol.iterator] = proto.entries), proto.toString = function() {
3148 var searchArray = [];
3149 return this.forEach(function(value, name) {
3150 searchArray.push(serializeParam(name) + "=" + serializeParam(value))
3151 }), searchArray.join("&")
3152 }, global.URLSearchParams = URLSearchParams
3153 },
3154 checkIfURLSearchParamsSupported = function() {
3155 try {
3156 var URLSearchParams = global.URLSearchParams;
3157 return "a=1" === new URLSearchParams("?a=1").toString() && "function" == typeof URLSearchParams.prototype.set && "function" == typeof URLSearchParams.prototype.entries
3158 } catch (e) {
3159 return !1
3160 }
3161 };
3162 checkIfURLSearchParamsSupported() || polyfillURLSearchParams();
3163 var proto = global.URLSearchParams.prototype;
3164 "function" != typeof proto.sort && (proto.sort = function() {
3165 var _this = this,
3166 items = [];
3167 this.forEach(function(value, name) {
3168 items.push([name, value]), _this._entries || _this.delete(name)
3169 }), items.sort(function(a, b) {
3170 return a[0] < b[0] ? -1 : a[0] > b[0] ? 1 : 0
3171 }), _this._entries && (_this._entries = {});
3172 for (var i = 0; i < items.length; i++) this.append(items[i][0], items[i][1])
3173 }), "function" != typeof proto._fromString && Object.defineProperty(proto, "_fromString", {
3174 enumerable: !1,
3175 configurable: !1,
3176 writable: !1,
3177 value: function(searchString) {
3178 if (this._entries) this._entries = {};
3179 else {
3180 var keys = [];
3181 this.forEach(function(value, name) {
3182 keys.push(name)
3183 });
3184 for (var i = 0; i < keys.length; i++) this.delete(keys[i])
3185 }
3186 searchString = searchString.replace(/^\?/, "");
3187 for (var attribute, attributes = searchString.split("&"), i = 0; i < attributes.length; i++) attribute = attributes[i].split("="), this.append(deserializeParam(attribute[0]), attribute.length > 1 ? deserializeParam(attribute[1]) : "")
3188 }
3189 })
3190 }("undefined" != typeof global ? global : "undefined" != typeof window ? window : "undefined" != typeof self ? self : void 0),
3191 function(global) {
3192 var checkIfURLIsSupported = function() {
3193 try {
3194 var u = new global.URL("b", "http://a");
3195 return u.pathname = "c d", "http://a/c%20d" === u.href && u.searchParams
3196 } catch (e) {
3197 return !1
3198 }
3199 },
3200 polyfillURL = function() {
3201 var _URL = global.URL,
3202 URL = function(url, base) {
3203 "string" != typeof url && (url = String(url)), base && "string" != typeof base && (base = String(base));
3204 var baseElement, doc = document;
3205 if (base && (void 0 === global.location || base !== global.location.href)) {
3206 base = base.toLowerCase(), doc = document.implementation.createHTMLDocument(""), baseElement = doc.createElement("base"), baseElement.href = base, doc.head.appendChild(baseElement);
3207 try {
3208 if (0 !== baseElement.href.indexOf(base)) throw new Error(baseElement.href)
3209 } catch (err) {
3210 throw new Error("URL unable to set base " + base + " due to " + err)
3211 }
3212 }
3213 var anchorElement = doc.createElement("a");
3214 anchorElement.href = url, baseElement && (doc.body.appendChild(anchorElement), anchorElement.href = anchorElement.href);
3215 var inputElement = doc.createElement("input");
3216 if (inputElement.type = "url", inputElement.value = url, ":" === anchorElement.protocol || !/:/.test(anchorElement.href) || !inputElement.checkValidity() && !base) throw new TypeError("Invalid URL");
3217 Object.defineProperty(this, "_anchorElement", {
3218 value: anchorElement
3219 });
3220 var searchParams = new global.URLSearchParams(this.search),
3221 enableSearchUpdate = !0,
3222 enableSearchParamsUpdate = !0,
3223 _this = this;
3224 ["append", "delete", "set"].forEach(function(methodName) {
3225 var method = searchParams[methodName];
3226 searchParams[methodName] = function() {
3227 method.apply(searchParams, arguments), enableSearchUpdate && (enableSearchParamsUpdate = !1, _this.search = searchParams.toString(), enableSearchParamsUpdate = !0)
3228 }
3229 }), Object.defineProperty(this, "searchParams", {
3230 value: searchParams,
3231 enumerable: !0
3232 });
3233 var search = void 0;
3234 Object.defineProperty(this, "_updateSearchParams", {
3235 enumerable: !1,
3236 configurable: !1,
3237 writable: !1,
3238 value: function() {
3239 this.search !== search && (search = this.search, enableSearchParamsUpdate && (enableSearchUpdate = !1, this.searchParams._fromString(this.search), enableSearchUpdate = !0))
3240 }
3241 })
3242 },
3243 proto = URL.prototype,
3244 linkURLWithAnchorAttribute = function(attributeName) {
3245 Object.defineProperty(proto, attributeName, {
3246 get: function() {
3247 return this._anchorElement[attributeName]
3248 },
3249 set: function(value) {
3250 this._anchorElement[attributeName] = value
3251 },
3252 enumerable: !0
3253 })
3254 };
3255 ["hash", "host", "hostname", "port", "protocol"].forEach(function(attributeName) {
3256 linkURLWithAnchorAttribute(attributeName)
3257 }), Object.defineProperty(proto, "search", {
3258 get: function() {
3259 return this._anchorElement.search
3260 },
3261 set: function(value) {
3262 this._anchorElement.search = value, this._updateSearchParams()
3263 },
3264 enumerable: !0
3265 }), Object.defineProperties(proto, {
3266 toString: {
3267 get: function() {
3268 var _this = this;
3269 return function() {
3270 return _this.href
3271 }
3272 }
3273 },
3274 href: {
3275 get: function() {
3276 return this._anchorElement.href.replace(/\?$/, "")
3277 },
3278 set: function(value) {
3279 this._anchorElement.href = value, this._updateSearchParams()
3280 },
3281 enumerable: !0
3282 },
3283 pathname: {
3284 get: function() {
3285 return this._anchorElement.pathname.replace(/(^\/?)/, "/")
3286 },
3287 set: function(value) {
3288 this._anchorElement.pathname = value
3289 },
3290 enumerable: !0
3291 },
3292 origin: {
3293 get: function() {
3294 var expectedPort = {
3295 "http:": 80,
3296 "https:": 443,
3297 "ftp:": 21
3298 } [this._anchorElement.protocol],
3299 addPortToOrigin = this._anchorElement.port != expectedPort && "" !== this._anchorElement.port;
3300 return this._anchorElement.protocol + "//" + this._anchorElement.hostname + (addPortToOrigin ? ":" + this._anchorElement.port : "")
3301 },
3302 enumerable: !0
3303 },
3304 password: {
3305 get: function() {
3306 return ""
3307 },
3308 set: function(value) {},
3309 enumerable: !0
3310 },
3311 username: {
3312 get: function() {
3313 return ""
3314 },
3315 set: function(value) {},
3316 enumerable: !0
3317 }
3318 }), URL.createObjectURL = function(blob) {
3319 return _URL.createObjectURL.apply(_URL, arguments)
3320 }, URL.revokeObjectURL = function(url) {
3321 return _URL.revokeObjectURL.apply(_URL, arguments)
3322 }, global.URL = URL
3323 };
3324 if (checkIfURLIsSupported() || polyfillURL(), void 0 !== global.location && !("origin" in global.location)) {
3325 var getOrigin = function() {
3326 return global.location.protocol + "//" + global.location.hostname + (global.location.port ? ":" + global.location.port : "")
3327 };
3328 try {
3329 Object.defineProperty(global.location, "origin", {
3330 get: getOrigin,
3331 enumerable: !0
3332 })
3333 } catch (e) {
3334 setInterval(function() {
3335 global.location.origin = getOrigin()
3336 }, 100)
3337 }
3338 }
3339 }("undefined" != typeof global ? global : "undefined" != typeof window ? window : "undefined" != typeof self ? self : void 0)
3340 }).call(exports, __webpack_require__(76))
3341}, , function(module, exports, __webpack_require__) {
3342 "use strict";
3343 Object.defineProperty(exports, "__esModule", {
3344 value: !0
3345 });
3346 exports.allowedDomains = ["https://facebook.com", "https://google.com"]
3347}, , function(module, exports, __webpack_require__) {
3348 "use strict";
3349 var _slicedToArray = function() {
3350 function sliceIterator(arr, i) {
3351 var _arr = [],
3352 _n = !0,
3353 _d = !1,
3354 _e = void 0;
3355 try {
3356 for (var _s, _i = arr[Symbol.iterator](); !(_n = (_s = _i.next()).done) && (_arr.push(_s.value), !i || _arr.length !== i); _n = !0);
3357 } catch (err) {
3358 _d = !0, _e = err
3359 } finally {
3360 try {
3361 !_n && _i.return && _i.return()
3362 } finally {
3363 if (_d) throw _e
3364 }
3365 }
3366 return _arr
3367 }
3368 return function(arr, i) {
3369 if (Array.isArray(arr)) return arr;
3370 if (Symbol.iterator in Object(arr)) return sliceIterator(arr, i);
3371 throw new TypeError("Invalid attempt to destructure non-iterable instance")
3372 }
3373 }(),
3374 periodCheck = function(_ref) {
3375 var from = _ref.from,
3376 to = _ref.to,
3377 now = new Date,
3378 fromDate = from ? new Date(from) : null,
3379 toDate = to ? new Date(to) : null;
3380 return fromDate && !toDate ? fromDate <= now : !fromDate && toDate ? now <= toDate : fromDate <= now && now <= toDate
3381 },
3382 currentHour = function() {
3383 var now = new Date;
3384 return now.getHours() + ":" + now.getMinutes()
3385 },
3386 compareHour = function(a, b) {
3387 var _a$split = a.split(":"),
3388 _a$split2 = _slicedToArray(_a$split, 2),
3389 aH = _a$split2[0],
3390 aM = _a$split2[1],
3391 _b$split = b.split(":"),
3392 _b$split2 = _slicedToArray(_b$split, 2),
3393 bH = _b$split2[0],
3394 bM = _b$split2[1],
3395 aInt = 60 * parseInt(aH) + parseInt(aM),
3396 bInt = 60 * parseInt(bH) + parseInt(bM);
3397 return aInt <= bInt
3398 },
3399 DAYS = ["sd", "mon", "tue", "wed", "thu", "fri", "sat"],
3400 currentDay = function() {
3401 var now = new Date;
3402 return DAYS[now.getDay()]
3403 },
3404 repeatCheck = function(_ref2) {
3405 var period = _ref2.period,
3406 hourly = _ref2.hourly,
3407 daily = _ref2.daily,
3408 monthly = _ref2.monthly,
3409 result = !0;
3410 if (result && period.indexOf("hourly") > -1) {
3411 var now = currentHour(),
3412 from = hourly.from,
3413 to = hourly.to;
3414 result = compareHour(from, now) && compareHour(now, to)
3415 }
3416 if (result && period.indexOf("daily") > -1) {
3417 var today = currentDay();
3418 result = daily.indexOf(today) > -1
3419 }
3420 if (result && period.indexOf("monthly") > -1) {
3421 var currentDate = (new Date).getDate(),
3422 _from = monthly.from,
3423 _to = monthly.to;
3424 result = _from <= currentDate && currentDate <= _to
3425 }
3426 return result
3427 },
3428 scheduleCheck = function(schedule) {
3429 return !schedule.enabled || ("period" === schedule.type ? periodCheck(schedule) : "repeat" === schedule.type ? repeatCheck(schedule) : (window.SP.error("SCHEDULE Unknown scheudle type: ", schedule.type), !1))
3430 };
3431 module.exports = {
3432 DAYS: DAYS,
3433 currentDay: currentDay,
3434 currentHour: currentHour,
3435 compareHour: compareHour,
3436 scheduleCheck: scheduleCheck
3437 }
3438}, , function(module, exports, __webpack_require__) {
3439 "use strict";
3440 module.exports = {
3441 getTimeMarker: function() {
3442 var now = new Date,
3443 today = now.getFullYear() + "-" + (now.getMonth() + 1) + "-" + now.getDate();
3444 return today
3445 }
3446 }
3447}, function(module, exports, __webpack_require__) {
3448 "use strict";
3449 module.exports.filter = function(_params, callback) {
3450 callback()
3451 }, module.exports.submitForm = function(params, callback) {
3452 var element = document.querySelector(params.selector);
3453 if (!element) return void window.SP.warn("TRIGGER OPTION submitForm cannot find element with selector: ", params.selector);
3454 var callCallback = function callCallback() {
3455 callback(), element.removeEventListener("submit", callCallback)
3456 };
3457 element.addEventListener("submit", callCallback)
3458 }, module.exports.exitIntent = function(params, callback) {
3459 var OUT_TIME = 250;
3460 setTimeout(function() {
3461 var handleMouseLeave = function handleMouseLeave() {
3462 var triggerLeave = setTimeout(function() {
3463 callback(), document.removeEventListener("mouseleave", handleMouseLeave)
3464 }, OUT_TIME),
3465 stopExecuting = function stopExecuting() {
3466 clearTimeout(triggerLeave), document.removeEventListener("mousemove", stopExecuting)
3467 };
3468 document.addEventListener("mousemove", stopExecuting)
3469 };
3470 document.addEventListener("mouseleave", handleMouseLeave)
3471 }, 1e3 * params.delay)
3472 }, module.exports.pageTime = function(params, callback) {
3473 window.SP.setUserPageTimeAlarm(params.minTime, function() {
3474 var currentPageTime = window.SP.getUserPageTime();
3475 params.maxTime && params.maxTime > 0 && currentPageTime < params.maxTime, callback()
3476 })
3477 }, module.exports.sessionTime = function(params, callback) {
3478 window.SP.setSessionTimeAlarm(params.minTime, function() {
3479 var currentsessionTime = window.SP.getSessionTime();
3480 params.maxTime && params.maxTime > 0 && currentsessionTime < params.maxTime, callback()
3481 })
3482 }, module.exports.click = function(params, callback) {
3483 var element = document.querySelector(params.selector);
3484 element || window.SP.warn("TRIGGER OPTION click cannot find element with selector: ", params.selector);
3485 var callCallback = function callCallback() {
3486 callback(), element.removeEventListener("click", callCallback)
3487 };
3488 element.addEventListener("click", callCallback)
3489 }, module.exports.userAge = function(params, callback) {
3490 var userAge = SP.getUserAge(),
3491 option = params.option,
3492 age = params.age;
3493 "include" === option ? userAge >= age && callback() : userAge >= age || callback()
3494 };
3495 var simpleRegex = function(str, rule) {
3496 var escapeRegex = function(str) {
3497 return str.replace(/([.*+?^=!:${}()|[\]\/\\])/g, "\\$1")
3498 };
3499 rule = rule.split("*").map(escapeRegex).join(".*");
3500 var regex = new RegExp(rule);
3501 return regex.test(str)
3502 },
3503 urlMatch = function(str, rule) {
3504 return rule = rule.replace(/\/\*/g, "*"), simpleRegex(str, rule)
3505 };
3506 module.exports.urlMatch = urlMatch;
3507 var utmMatch = function(_url, utmRule) {
3508 var url = new URL(_url),
3509 query = new URLSearchParams(url.search),
3510 result = !0,
3511 utmSource = query.get("utm_source");
3512 utmSource && (simpleRegex(utmSource, utmRule.utm_source) || (result = !1));
3513 var utmMedium = query.get("utm_medium");
3514 utmMedium && (simpleRegex(utmMedium, utmRule.utm_medium) || (result = !1));
3515 var utmCampaign = query.get("utm_campaign");
3516 return utmCampaign && (simpleRegex(utmCampaign, utmRule.utm_campaign) || (result = !1)), result
3517 };
3518 module.exports.utmMatch = utmMatch, module.exports.userSource = function(params, callback) {
3519 var userSource = SP.getUserSource(),
3520 option = params.option,
3521 sourceType = params.sourceType;
3522 if ("direct" === sourceType) "include" === option && "" === userSource && callback(), "exclude" === option && "" !== userSource && callback();
3523 else if ("referrer" === sourceType) {
3524 var referrer = params.referrer,
3525 matchFound = !1;
3526 referrer.forEach(function(targetReferer) {
3527 urlMatch(userSource, targetReferer) && (matchFound = !0)
3528 }), "include" === option && matchFound && callback(), "exclude" !== option || matchFound || callback()
3529 } else if ("utm" === sourceType) {
3530 var utm = params.utm,
3531 _matchFound = !1;
3532 utm.forEach(function(targetUtm) {
3533 utmMatch(userSource, targetUtm) && (_matchFound = !0)
3534 }), "include" === option && _matchFound && callback(), "exclude" !== option || _matchFound || callback()
3535 }
3536 }, module.exports.userGeo = function(params, callback) {
3537 var option = params.option,
3538 continents = params.continents,
3539 countries = params.countries,
3540 cities = params.cities;
3541 SP.getUserGeo(function(geoInfo) {
3542 var result = !0;
3543 "include" === option ? (continents.length && continents.indexOf(geoInfo.continent) === -1 && (result = !1), countries.length && countries.indexOf(geoInfo.country) === -1 && (result = !1), cities.length && cities.indexOf(geoInfo.city) === -1 && (result = !1)) : "exclude" === option && (continents.length && continents.indexOf(geoInfo.continent) > -1 && (result = !1), countries.length && countries.indexOf(geoInfo.country) > -1 && (result = !1), cities.length && cities.indexOf(geoInfo.city) > -1 && (result = !1)), result && callback()
3544 })
3545 }
3546}, function(module, exports, __webpack_require__) {
3547 "use strict";
3548
3549 function _classCallCheck(instance, Constructor) {
3550 if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function")
3551 }
3552 Object.defineProperty(exports, "__esModule", {
3553 value: !0
3554 });
3555 var _createClass = function() {
3556 function defineProperties(target, props) {
3557 for (var i = 0; i < props.length; i++) {
3558 var descriptor = props[i];
3559 descriptor.enumerable = descriptor.enumerable || !1, descriptor.configurable = !0, "value" in descriptor && (descriptor.writable = !0), Object.defineProperty(target, descriptor.key, descriptor)
3560 }
3561 }
3562 return function(Constructor, protoProps, staticProps) {
3563 return protoProps && defineProperties(Constructor.prototype, protoProps), staticProps && defineProperties(Constructor, staticProps), Constructor
3564 }
3565 }(),
3566 Inspect = function() {
3567 function Inspect(host, appId) {
3568 _classCallCheck(this, Inspect), this.host = host, this.appId = appId
3569 }
3570 return _createClass(Inspect, [{
3571 key: "runInspector",
3572 value: function() {
3573 window.SP.log("Running Trustisto inspector..."), this.embed(document.body)
3574 }
3575 }, {
3576 key: "embed",
3577 value: function(parentElement) {
3578 var inspector = document.createElement("div");
3579 inspector.setAttribute("style", "width: 500px; height: 90%; border: 5px solid #cdcdcd; top: 5%; left: 50px; position: fixed; background: #fff; padding: 5px; z-index: 99999999; box-sizing: content-box;");
3580 var close = document.createElement("a");
3581 close.setAttribute("href", "#"), close.innerHTML = "[x]", close.setAttribute("style", "position: absolute; right: 2px; top: 0px; color: black; font-family: sans-serif; text-decoration: none;"), close.addEventListener("click", function(e) {
3582 e.preventDefault(), parentElement.removeChild(inspector)
3583 }, !1), inspector.appendChild(close);
3584 var iframe = document.createElement("iframe");
3585 iframe.setAttribute("src", this.host + "/pl/admin/websites/inspect?appId=" + this.appId), iframe.setAttribute("style", "border: none; width: 500px; height: 100%"), inspector.appendChild(iframe), parentElement.appendChild(inspector)
3586 }
3587 }]), Inspect
3588 }();
3589 exports.default = Inspect, module.exports = exports.default
3590}, function(module, exports, __webpack_require__) {
3591 "use strict";
3592
3593 function _interopRequireDefault(obj) {
3594 return obj && obj.__esModule ? obj : {
3595 default: obj
3596 }
3597 }
3598
3599 function _classCallCheck(instance, Constructor) {
3600 if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function")
3601 }
3602 Object.defineProperty(exports, "__esModule", {
3603 value: !0
3604 });
3605 var _createClass = function() {
3606 function defineProperties(target, props) {
3607 for (var i = 0; i < props.length; i++) {
3608 var descriptor = props[i];
3609 descriptor.enumerable = descriptor.enumerable || !1, descriptor.configurable = !0, "value" in descriptor && (descriptor.writable = !0), Object.defineProperty(target, descriptor.key, descriptor)
3610 }
3611 }
3612 return function(Constructor, protoProps, staticProps) {
3613 return protoProps && defineProperties(Constructor.prototype, protoProps), staticProps && defineProperties(Constructor, staticProps), Constructor
3614 }
3615 }(),
3616 _static = __webpack_require__(1),
3617 _static2 = _interopRequireDefault(_static),
3618 _capping = __webpack_require__(7),
3619 _capping2 = _interopRequireDefault(_capping),
3620 NotificationConfiguration = function() {
3621 function NotificationConfiguration(config) {
3622 _classCallCheck(this, NotificationConfiguration), this.config = config
3623 }
3624 return _createClass(NotificationConfiguration, [{
3625 key: "getStyleConfig",
3626 value: function() {
3627 return this.config.style
3628 }
3629 }, {
3630 key: "getTiming",
3631 value: function() {
3632 return {
3633 startTime: 1e3 * (this.config.style.start_time || 5),
3634 showTime: 1e3 * (this.config.style.show_time || 7),
3635 spanTime: 1e3 * (this.config.style.span_time || 10)
3636 }
3637 }
3638 }, {
3639 key: "areStandardNotificationsAvailable",
3640 value: function() {
3641 return this.config.notifications.filter(function(n) {
3642 return n.display === _static2.default.NOTIFICATION_DISPLAY_STANDARD
3643 }).length || this.config.notifications.filter(function(n) {
3644 return "undefined" == typeof n.display
3645 }).length
3646 }
3647 }, {
3648 key: "areNewNotificationsAvailable",
3649 value: function() {
3650 return this.config.notifications.filter(function(n) {
3651 return n.display === _static2.default.NOTIFICATION_DISPLAY_NEW
3652 }).length
3653 }
3654 }, {
3655 key: "areDeprecatedNotificationsAvailable",
3656 value: function() {
3657 return this.config.notifications.filter(function(n) {
3658 return n.notification_type === _static2.default.NOTIFICATION_TYPE_DEPRECATED
3659 }).length
3660 }
3661 }, {
3662 key: "areInlineNotificationsAvailable",
3663 value: function() {
3664 return this.config.notifications.filter(function(n) {
3665 return n.display === _static2.default.NOTIFICATION_DISPLAY_INLINE
3666 }).length
3667 }
3668 }, {
3669 key: "isUnderGlobalCapping",
3670 value: function() {
3671 var result = !0;
3672 return _capping2.default.isUnderDayCapping(_static2.default.CAPPING_NOTIFICATIONS, null, _static2.default.CAPPING_ACTION_VIEW, this.config.style.capping_day) || (window.SP.warn("NOTIFICATIONS global day capping is over"), result = !1), _capping2.default.isUnderPageCapping(_static2.default.CAPPING_NOTIFICATIONS, null, _static2.default.CAPPING_ACTION_VIEW, this.config.style.capping_page) || (window.SP.warn("NOTIFICATIONS global page capping is over"), result = !1), result
3673 }
3674 }]), NotificationConfiguration
3675 }();
3676 exports.default = NotificationConfiguration, module.exports = exports.default
3677}, function(module, exports, __webpack_require__) {
3678 "use strict";
3679
3680 function _interopRequireDefault(obj) {
3681 return obj && obj.__esModule ? obj : {
3682 default: obj
3683 }
3684 }
3685
3686 function _classCallCheck(instance, Constructor) {
3687 if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function")
3688 }
3689 Object.defineProperty(exports, "__esModule", {
3690 value: !0
3691 });
3692 var _createClass = function() {
3693 function defineProperties(target, props) {
3694 for (var i = 0; i < props.length; i++) {
3695 var descriptor = props[i];
3696 descriptor.enumerable = descriptor.enumerable || !1, descriptor.configurable = !0, "value" in descriptor && (descriptor.writable = !0), Object.defineProperty(target, descriptor.key, descriptor)
3697 }
3698 }
3699 return function(Constructor, protoProps, staticProps) {
3700 return protoProps && defineProperties(Constructor.prototype, protoProps), staticProps && defineProperties(Constructor, staticProps), Constructor
3701 }
3702 }(),
3703 _notificator_inline_config = __webpack_require__(67),
3704 _notificator_inline_config2 = _interopRequireDefault(_notificator_inline_config),
3705 NotificationInline = function() {
3706 function NotificationInline(event, message, image, link, brandless, notification) {
3707 _classCallCheck(this, NotificationInline), this.event = event, this.message = message, this.image = image, this.link = link, this.brandless = brandless, this.notification = notification
3708 }
3709 return _createClass(NotificationInline, [{
3710 key: "createContainer",
3711 value: function(selector) {
3712 var oc = document.querySelector('[data-selector="' + selector + '"]');
3713 if (oc) return oc;
3714 var nc = document.createElement("div");
3715 return nc.className = _notificator_inline_config2.default.NOTIFICATION_INLINE_CONTAINER_CLASS, nc.dataset.selector = selector, nc
3716 }
3717 }, {
3718 key: "getElement",
3719 value: function() {
3720 var id = this.notification.id,
3721 container = this.createContainer(this.notification.options.container),
3722 n = document.createElement("div");
3723 n.className = _notificator_inline_config2.default.NOTIFICATION_INLINE_CLASS, n.className += " socialproof-inline-" + id;
3724 var text = document.createElement("p");
3725 text.className = _notificator_inline_config2.default.NOTIFICATION_INLINE_TEXT_CLASS, text.innerHTML = this.message;
3726 var brandingIcon = document.createElement("a");
3727 if (brandingIcon.className = _notificator_inline_config2.default.NOTIFICATION_INLINE_BRAND_CLASS, brandingIcon.href = "https://js.trustisto.com/hello.html?url=" + encodeURIComponent(window.location.host), brandingIcon.target = "_blank", brandingIcon.rel = "noreferrer noopener", n.appendChild(text), n.appendChild(brandingIcon), !this.event.isTestEvent) {
3728 var notifyPixel = document.createElement("img");
3729 notifyPixel.alt = this.event.name, notifyPixel.src = window.SP.schema + "//api" + window.SP.url + "/stats/" + this.event.name + "/notify.png?appId=" + window.SP.appId + "&uid=" + window.SP.uid + "¬ificationId=" + id + "&productId=" + this.event.productId + "&ab=" + window.SP.ab.value + "&statToken=" + this.event.statToken, notifyPixel.className = _notificator_inline_config2.default.NOTIFICATION_INLINE_PIXEL_CLASS, notifyPixel.alt = this.event.name, notifyPixel.width = 0, notifyPixel.height = 0, n.appendChild(notifyPixel)
3730 }
3731 return container.appendChild(n), container
3732 }
3733 }]), NotificationInline
3734 }();
3735 exports.default = NotificationInline, module.exports = exports.default
3736}, function(module, exports, __webpack_require__) {
3737 "use strict";
3738
3739 function _interopRequireDefault(obj) {
3740 return obj && obj.__esModule ? obj : {
3741 default: obj
3742 }
3743 }
3744
3745 function _classCallCheck(instance, Constructor) {
3746 if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function")
3747 }
3748 Object.defineProperty(exports, "__esModule", {
3749 value: !0
3750 });
3751 var _createClass = function() {
3752 function defineProperties(target, props) {
3753 for (var i = 0; i < props.length; i++) {
3754 var descriptor = props[i];
3755 descriptor.enumerable = descriptor.enumerable || !1, descriptor.configurable = !0, "value" in descriptor && (descriptor.writable = !0), Object.defineProperty(target, descriptor.key, descriptor)
3756 }
3757 }
3758 return function(Constructor, protoProps, staticProps) {
3759 return protoProps && defineProperties(Constructor.prototype, protoProps), staticProps && defineProperties(Constructor, staticProps), Constructor
3760 }
3761 }(),
3762 _static = __webpack_require__(1),
3763 _static2 = _interopRequireDefault(_static),
3764 CSS = function() {
3765 function CSS() {
3766 _classCallCheck(this, CSS), this.notifications = null
3767 }
3768 return _createClass(CSS, [{
3769 key: "loadNotifications",
3770 value: function(notifications) {
3771 this.notifications = notifications
3772 }
3773 }, {
3774 key: "createCustomClasses",
3775 value: function() {
3776 var customClasses = this.notifications.filter(function(n) {
3777 return n.display === _static2.default.NOTIFICATION_DISPLAY_INLINE
3778 }).map(function(notification) {
3779 var options = notification.options;
3780 return "\n .socialproof-inline-" + notification.id + " {\n background: " + options.background_color + ";\n font-size: " + options.text_font_size + "px;\n color: " + options.text_color + ";\n }\n "
3781 });
3782 return customClasses.join("\n")
3783 }
3784 }, {
3785 key: "removeStyle",
3786 value: function() {
3787 var e = document.getElementById("socialproof-inline-style");
3788 e && e.parentNode.removeChild(e)
3789 }
3790 }, {
3791 key: "embedStyle",
3792 value: function(parentElement) {
3793 var style = document.createElement("style");
3794 style.setAttribute("id", "socialproof-inline-style"), style.type = "text/css", style.innerHTML = "\n .socialproof-inline-reset {\n position: static;\n float: none;\n padding: 0;\n margin: 0;\n border: 0 none;\n outline: 0 none;\n border-spacing: 0;\n color: #000;\n font-family: \"Helvetica Neue\", Arial, sans-serif;\n font-size: 10px;\n font-style: normal;\n font-weight: normal;\n font-variant: normal;\n line-height: normal;\n text-decoration: none;\n text-transform: none;\n text-align: left;\n text-indent: 0;\n text-shadow: none;\n letter-spacing: normal;\n word-spacing: normal;\n white-space: normal;\n direction: ltr;\n background: none repeat scroll 0 0 transparent;\n vertical-align: middle;\n overflow: visible;\n max-width: none;\n max-height: none;\n -moz-box-sizing: content-box;\n }\n\n .socialproof-pixel {\n position: absolute;\n }\n\n .socialproof-inline-container {\n position: relative;\n display: flex;\n justify-content: center;\n flex-direction: column;\n margin: 3px 0;\n overflow: hidden;\n animation: socialproof-inline-maxheight 0.25s;\n }\n\n .socialproof-inline {\n width: 100%;\n box-sizing: border-box;\n color: inherit;\n background: inherit;\n min-height: 18px;\n color: #000;\n display: flex;\n align-items: center;\n background: #c4c4c4;\n padding: calc(1em / 6) 0.5em;\n border-radius: 1px;\n }\n\n .socialproof-inline-text {\n color: inherit;\n font-weight: inherit;\n font-size: inherit;\n max-width: 100% !important;\n margin-right: auto;\n }\n\n .socialproof-inline-brand {\n font-size: inherit;\n box-shadow: 0 0 0 0.1em #fefefe;\n position: relative;\n width: 1em;\n margin-left: 0.5em;\n height: 1em;\n min-width: 1em;\n min-height: 1em;\n border-radius: 0.5em 0 0.5em 0.5em;\n background: #4a25ea;\n }\n\n .socialproof-inline-brand:after {\n position: absolute;\n font-size: inherit;\n width: 0.5em;\n top: 50%;\n left: 50%;\n transform: translate(-50%, -50%);\n height: 0.5em;\n min-width: 0.5em;\n min-height: 0.5em;\n border-radius: 0.25em;\n background: #ffffff;\n content: '';\n }\n\n .socialproof-inline-slide-in {\n animation: socialproof-inline-slide-in 0.65s;\n }\n \n .socialproof-inline-fade-out {\n animation: socialproof-inline-fade-out 0.45s forwards;\n }\n\n @keyframes socialproof-inline-slide-in {\n from {\n transform: translateX(-100vw);\n }\n to {\n transform: translateX(0);\n }\n }\n\n @keyframes socialproof-inline-fade-out {\n from {\n min-height: 18px;\n max-height: 100%;\n opacity: 1;\n }\n to {\n transform: scaleY(0);\n max-height: 0;\n min-height: 0;\n opacity: 0;\n }\n }\n\n @keyframes socialproof-inline-maxheight {\n from {\n max-height: 0;\n }\n to {\n max-height: 100%;\n }\n }\n ",
3795 style.innerHTML += "\n" + this.createCustomClasses(), parentElement.appendChild(style)
3796 }
3797 }]), CSS
3798 }();
3799 exports.default = CSS, module.exports = exports.default
3800}, function(module, exports, __webpack_require__) {
3801 "use strict";
3802
3803 function _interopRequireDefault(obj) {
3804 return obj && obj.__esModule ? obj : {
3805 default: obj
3806 }
3807 }
3808
3809 function _classCallCheck(instance, Constructor) {
3810 if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function")
3811 }
3812 Object.defineProperty(exports, "__esModule", {
3813 value: !0
3814 });
3815 var _createClass = function() {
3816 function defineProperties(target, props) {
3817 for (var i = 0; i < props.length; i++) {
3818 var descriptor = props[i];
3819 descriptor.enumerable = descriptor.enumerable || !1, descriptor.configurable = !0, "value" in descriptor && (descriptor.writable = !0), Object.defineProperty(target, descriptor.key, descriptor)
3820 }
3821 }
3822 return function(Constructor, protoProps, staticProps) {
3823 return protoProps && defineProperties(Constructor.prototype, protoProps), staticProps && defineProperties(Constructor, staticProps), Constructor
3824 }
3825 }(),
3826 _notificator_new_config = __webpack_require__(17),
3827 _notificator_new_config2 = _interopRequireDefault(_notificator_new_config),
3828 _doc_cookies = __webpack_require__(3),
3829 _doc_cookies2 = _interopRequireDefault(_doc_cookies),
3830 NotificationNew = function() {
3831 function NotificationNew(event, message, image, link, brandless, notification) {
3832 _classCallCheck(this, NotificationNew), this.event = event, this.message = message, this.image = image || "https://js.trustisto.com/icon.png", this.link = link, this.brandless = brandless, this.notification = notification
3833 }
3834 return _createClass(NotificationNew, [{
3835 key: "getElement",
3836 value: function() {
3837 var id = this.notification.id,
3838 size = this.notification.options.size,
3839 n = document.createElement("div");
3840 n.className = _notificator_new_config2.default.NOTIFICATION_NEW_CLASS + (" socialproof-new-" + size), n.className += " socialproof-new-notification-" + id;
3841 var iconWrapperLink = document.createElement("a");
3842 iconWrapperLink.setAttribute("href", this.link), iconWrapperLink.className = _notificator_new_config2.default.NOTIFICATION_NEW_ICON_WRAPPER_CLASS;
3843 var img = document.createElement("img");
3844 img.src = this.image, img.alt = this.event.name, img.className = _notificator_new_config2.default.NOTIFICATION_NEW_ICON_CLASS, iconWrapperLink.appendChild(img), n.appendChild(iconWrapperLink);
3845 var content = document.createElement("div");
3846 content.className = _notificator_new_config2.default.NOTIFICATION_NEW_CONTENT_CLASS;
3847 var text = document.createElement("span");
3848 if (text.className = _notificator_new_config2.default.NOTIFICATION_NEW_TEXT_CLASS, text.innerHTML = this.message, content.appendChild(text), this.notification.options.last_time) {
3849 var timeAgo = document.createElement("div");
3850 timeAgo.className = _notificator_new_config2.default.NOTIFICATION_NEW_TIMEAGO_CLASS, timeAgo.textContent = this.event.lastRelativeText, content.appendChild(timeAgo)
3851 }
3852 var closeBtn = document.createElement("span");
3853 if (closeBtn.title = "Close", closeBtn.className = _notificator_new_config2.default.NOTIFICATION_NEW_CLOSE_CLASS, content.appendChild(closeBtn), !this.brandless) {
3854 var brandingIcon = document.createElement("a");
3855 brandingIcon.href = "https://js.trustisto.com/hello.html?url=" + encodeURIComponent(window.location.origin), brandingIcon.target = "_blank", brandingIcon.rel = "noreferrer noopener", brandingIcon.className = "socialproof-new-brand", brandingIcon.innerHTML += _notificator_new_config2.default.NOTIFICATION_NEW_ICON_SVG, content.appendChild(brandingIcon)
3856 }
3857 if (!this.event.isTestEvent) {
3858 var notifyPixel = document.createElement("img");
3859 notifyPixel.alt = this.event.name, notifyPixel.src = window.SP.schema + "//api" + window.SP.url + "/stats/notify/" + id + "/notify.png?appId=" + window.SP.appId + "&uid=" + window.SP.uid + (this.event.productId ? "&productId=" + this.event.productId : "") + "&ab=" + window.SP.ab.value + (this.event.name ? "&event=" + this.event.name : ""), notifyPixel.className = _notificator_new_config2.default.NOTIFICATION_NEW_PIXEL_CLASS, notifyPixel.alt = this.event.name, notifyPixel.width = 0, notifyPixel.height = 0, n.appendChild(notifyPixel)
3860 }
3861 return n.appendChild(content), closeBtn.onclick = function() {
3862 n.className = n.className + " " + _notificator_new_config2.default.NOTIFICATION_NEW_FADE_OUT_ANIMATION_CLASS, n.addEventListener("transitionend", function() {
3863 document.getElementById(_notificator_new_config2.default.CONTAINER_ID).removeChild(n.parentElement)
3864 }, !1), _doc_cookies2.default.setItem("trustisto_block", !0, 86400, "/")
3865 }, n
3866 }
3867 }]), NotificationNew
3868 }();
3869 exports.default = NotificationNew, module.exports = exports.default
3870}, function(module, exports, __webpack_require__) {
3871 "use strict";
3872
3873 function _interopRequireDefault(obj) {
3874 return obj && obj.__esModule ? obj : {
3875 default: obj
3876 }
3877 }
3878
3879 function _classCallCheck(instance, Constructor) {
3880 if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function")
3881 }
3882 Object.defineProperty(exports, "__esModule", {
3883 value: !0
3884 });
3885 var _createClass = function() {
3886 function defineProperties(target, props) {
3887 for (var i = 0; i < props.length; i++) {
3888 var descriptor = props[i];
3889 descriptor.enumerable = descriptor.enumerable || !1, descriptor.configurable = !0, "value" in descriptor && (descriptor.writable = !0), Object.defineProperty(target, descriptor.key, descriptor)
3890 }
3891 }
3892 return function(Constructor, protoProps, staticProps) {
3893 return protoProps && defineProperties(Constructor.prototype, protoProps), staticProps && defineProperties(Constructor, staticProps), Constructor
3894 }
3895 }(),
3896 _static = __webpack_require__(1),
3897 _static2 = _interopRequireDefault(_static),
3898 CSS = function() {
3899 function CSS() {
3900 _classCallCheck(this, CSS), this.notifications = null
3901 }
3902 return _createClass(CSS, [{
3903 key: "loadNotifications",
3904 value: function(notifications) {
3905 this.notifications = notifications
3906 }
3907 }, {
3908 key: "loadGlobalStyles",
3909 value: function(globalStyles) {
3910 this.globalStyles = globalStyles
3911 }
3912 }, {
3913 key: "createCustomClasses",
3914 value: function() {
3915 var _this = this,
3916 customClasses = this.notifications.filter(function(n) {
3917 return n.display === _static2.default.NOTIFICATION_DISPLAY_NEW
3918 }).map(function(notification) {
3919 var options = notification.options;
3920 return "\n .socialproof-pixel {\n position: absolute;\n }\n .socialproof-new-notification-" + notification.id + " {\n background: " + options.background_color + ";\n border: 2px solid " + options.background_color + ";\n z-index: 2147483640;\n " + options.x + ": 10px;\n " + options.y + ": 10px;\n font-size: " + options.text_font_size + "px;\n color: " + options.text_color + ";\n }\n .socialproof-new-notification-" + notification.id + " .socialproof-new-content .socialproof-new-last-time {\n font-size: " + (options.text_font_size - 2) + "px;\n }\n @media screen and (max-width: 600px) {\n .socialproof-new-notification-" + notification.id + " {\n " + (_this.globalStyles.mobile_enabled && "window" === options.parent ? "\n " + _this.globalStyles.mobile_y + ": 0;\n " : "") + "\n }\n }\n " + (notification.source === _static2.default.NOTIFICATION_SOURCE_REVIEW && notification.show_image ? ".socialproof-new-notification-" + notification.id + " .socialproof-new-icon img {\n width: 100%;\n max-width: 100%;\n }" : "") + "\n \n "
3921 });
3922 return customClasses.join("\n")
3923 }
3924 }, {
3925 key: "removeStyle",
3926 value: function() {
3927 var e = document.getElementById("socialproof-new-style");
3928 e && e.parentNode.removeChild(e)
3929 }
3930 }, {
3931 key: "embedStyle",
3932 value: function(parentElement) {
3933 var style = document.createElement("style");
3934 style.setAttribute("id", "socialproof-new-style"), style.type = "text/css", style.innerHTML = '\n .socialproof-new-reset {\n position: static;\n float: none;\n padding: 0;\n margin: 0;\n border: 0 none;\n outline: 0 none;\n border-spacing: 0;\n color: #000;\n font-family: "Helvetica Neue", Arial, sans-serif;\n font-size: 10px;\n font-style: normal;\n font-weight: normal;\n font-variant: normal;\n line-height: normal;\n text-decoration: none;\n text-transform: none;\n text-align: left;\n text-indent: 0;\n text-shadow: none;\n letter-spacing: normal;\n word-spacing: normal;\n white-space: normal;\n direction: ltr;\n background: none repeat scroll 0 0 transparent;\n vertical-align: middle;\n overflow: visible;\n max-width: none;\n max-height: none;\n -moz-box-sizing: content-box;\n }\n \n .socialproof-new {\n display: flex;\n align-items: center;\n position: fixed;\n border-radius: 100px 0 0 100px;\n overflow: hidden;\n z-index: 2147483639;\n }\n\n /* Size */\n \n .socialproof-new-large {\n width: 500px;\n height: 120px;\n }\n \n .socialproof-new-big {\n width: 400px;\n height: 100px;\n }\n \n .socialproof-new-normal {\n width: 350px;\n height: 80px;\n }\n \n .socialproof-new-small {\n width: 300px;\n height: 60px;\n }\n \n .socialproof-new .socialproof-new-icon {\n display: flex;\n justify-content: center;\n align-items: center;\n background-color: white;\n background-position: center;\n background-size: cover;\n overflow: hidden;\n }\n \n .socialproof-new .socialproof-new-icon-img {\n width: 75%;\n max-width: 75%;\n }\n \n .socialproof-new-large .socialproof-new-icon {\n width: 120px;\n min-width: 120px;\n height: 120px;\n border-radius: 60px 0 60px 60px;\n }\n \n .socialproof-new-big .socialproof-new-icon {\n width: 100px;\n min-width: 100px;\n height: 100px;\n border-radius: 50px 0 50px 50px;\n }\n \n .socialproof-new-normal .socialproof-new-icon {\n width: 80px;\n min-width: 80px;\n height: 80px;\n border-radius: 40px 0 40px 40px;\n }\n \n .socialproof-new-small .socialproof-new-icon {\n width: 60px;\n min-width: 60px;\n height: 60px;\n border-radius: 30px 0 30px 30px;\n }\n \n /* Content */\n \n .socialproof-new .socialproof-new-content {\n color: inherit;\n font-family: "Helvetica Neue", Arial, sans-serif;\n font-weight: 600;\n padding: 10px;\n font-size: inherit !important;\n }\n\n .socialproof-new .socialproof-new-content .socialproof-new-text {\n color: inherit;\n font-size: inherit;\n font-weight: inherit;\n display: -webkit-box;\n -webkit-line-clamp: 3;\n -webkit-box-orient: vertical; \n overflow: hidden;\n }\n\n .socialproof-new .socialproof-new-content .socialproof-message-reset {\n color: inherit;\n text-decoration: none;\n }\n \n .socialproof-new-large .socialproof-new-content {\n padding: 10px;\n max-width: 360px; /* = width (500) - image size (120) - 2x padding (20) */\n }\n \n .socialproof-new-big .socialproof-new-content {\n padding: 5px;\n max-width: 290px; /* = width - image size - 2x padding */\n }\n \n .socialproof-new-normal .socialproof-new-content {\n padding: 5px;\n max-width: 240px; /* = width - image size - 2x padding */\n }\n \n .socialproof-new-small .socialproof-new-content {\n padding: 5px;\n max-width: 230px; /* = width - image size - 2x padding */\n }\n \n .socialproof-new .socialproof-new-content a {\n text-decoration: none;\n }\n \n /* Last time */\n \n .socialproof-new .socialproof-new-content .socialproof-new-last-time {\n margin-top: 5px;\n color: inherit !important;\n font-family: "Helvetica Neue", Arial, sans-serif !important;\n font-weight: 600 !important;\n }\n \n /* Close button */\n \n .socialproof-new .socialproof-new-content .socialproof-new-close {\n cursor: pointer;\n position: absolute;\n opacity: 0.3;\n }\n \n .socialproof-new .socialproof-new-content .socialproof-new-close {\n top: 3px;\n right: 25px;\n }\n \n .socialproof-new .socialproof-new-content .socialproof-new-close:hover {\n opacity: 1;\n }\n \n .socialproof-new .socialproof-new-content .socialproof-new-close:before,\n .socialproof-new .socialproof-new-content .socialproof-new-close:after {\n position: absolute;\n content: " ";\n left: 15px;\n width: 2px;\n height: 15px;\n background-color: white;\n }\n \n .socialproof-new-inverse .socialproof-new-content .socialproof-new-close:before,\n .socialproof-new-inverse .socialproof-new-content .socialproof-new-close:after {\n background-color: black;\n }\n \n .socialproof-new .socialproof-new-content .socialproof-new-close:before {\n transform: rotate(45deg);\n }\n \n .socialproof-new .socialproof-new-content .socialproof-new-close:after {\n transform: rotate(-45deg);\n }\n \n /* Branding */\n \n .socialproof-new .socialproof-new-content .socialproof-new-brand {\n position: absolute;\n fill: white;\n width: 13px;\n height: 13px;\n bottom: 2px;\n right: 2px;\n opacity: 0.5;\n }\n \n .socialproof-new-inverse .socialproof-new-content .socialproof-new-brand {\n fill: black;\n }\n \n .socialproof-new .socialproof-new-content .socialproof-new-brand:hover {\n opacity: 1.0;\n }\n \n /* Animations */\n \n .socialproof-new-fade-in {\n animation: fade-in 500ms;\n }\n \n @keyframes fade-in {\n from {\n opacity: 0;\n }\n to {\n opacity: 1;\n }\n }\n \n .socialproof-new-fade-out {\n animation: fade-out 500ms forwards !important;\n }\n \n @keyframes fade-out {\n from {\n opacity: 1;\n }\n to {\n opacity: 0;\n }\n }\n \n .socialproof-new-slide-in.socialproof-new-right {\n animation: slide-in-from-right 2s;\n }\n \n @keyframes slide-in-from-right {\n from {\n right: -600px;\n }\n to {\n right: 10px;\n }\n }\n \n .socialproof-new-slide-in.socialproof-new-left {\n animation: slide-in-from-left 2s;\n }\n \n @keyframes slide-in-from-left {\n from {\n left: -600px;\n }\n to {\n left: 10px;\n }\n }\n \n .socialproof-new-slide-out {\n animation: slide-out 2s forwards !important;\n }\n \n @keyframes slide-out {\n to {\n right: -600px;\n }\n }\n \n .socialproof-new-rotate-in {\n animation: rotate-in 1s;\n }\n \n @keyframes rotate-in {\n from {\n transform: scale(0) rotate(500deg);\n }\n to {\n transform: scale(1) rotate(0deg);\n }\n }\n \n .socialproof-new-rotate-out {\n animation: rotate-out 1s;\n }\n \n @keyframes rotate-out {\n from {\n transform: scale(1) rotate(0deg);\n }\n to {\n transform: scale(0) rotate(500deg);\n }\n }\n \n /* Responsive */\n \n @media screen and (max-width: 600px) {\n .socialproof-new:not(.socialproof-new-clip) {\n width: 95%;\n right: 2%;\n left: 2%;\n }\n\n .socialproof-new-mobile {\n width: 95% !important;\n font-size: 12px !important;\n height: 60px !important;\n }\n\n .socialproof-new-mobile .socialproof-new-icon {\n width: 60px !important;\n min-width: 60px !important;\n height: 60px !important;\n border-radius: 30px 0 30px 30px !important;\n }\n\n .socialproof-new-mobile .socialproof-new-content {\n padding: 5px !important;\n max-width: 230px !important; /* = width - image size - 2x padding */\n }\n \n .socialproof-new-mobile .socialproof-new-content .socialproof-new-last-time {\n font-size: 10px !important;\n }\n\n .socialproof-new .socialproof-new-content .socialproof-new-text {\n -webkit-line-clamp: 2;\n }\n }\n ', style.innerHTML += "\n" + this.createCustomClasses(), parentElement.appendChild(style)
3935 }
3936 }]), CSS
3937 }();
3938 exports.default = CSS, module.exports = exports.default
3939}, function(module, exports, __webpack_require__) {
3940 "use strict";
3941
3942 function _interopRequireDefault(obj) {
3943 return obj && obj.__esModule ? obj : {
3944 default: obj
3945 }
3946 }
3947
3948 function _classCallCheck(instance, Constructor) {
3949 if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function")
3950 }
3951
3952 function _possibleConstructorReturn(self, call) {
3953 if (!self) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
3954 return !call || "object" != typeof call && "function" != typeof call ? self : call
3955 }
3956
3957 function _inherits(subClass, superClass) {
3958 if ("function" != typeof superClass && null !== superClass) throw new TypeError("Super expression must either be null or a function, not " + typeof superClass);
3959 subClass.prototype = Object.create(superClass && superClass.prototype, {
3960 constructor: {
3961 value: subClass,
3962 enumerable: !1,
3963 writable: !0,
3964 configurable: !0
3965 }
3966 }), superClass && (Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass)
3967 }
3968 Object.defineProperty(exports, "__esModule", {
3969 value: !0
3970 });
3971 var _createClass = function() {
3972 function defineProperties(target, props) {
3973 for (var i = 0; i < props.length; i++) {
3974 var descriptor = props[i];
3975 descriptor.enumerable = descriptor.enumerable || !1, descriptor.configurable = !0, "value" in descriptor && (descriptor.writable = !0), Object.defineProperty(target, descriptor.key, descriptor)
3976 }
3977 }
3978 return function(Constructor, protoProps, staticProps) {
3979 return protoProps && defineProperties(Constructor.prototype, protoProps), staticProps && defineProperties(Constructor, staticProps), Constructor
3980 }
3981 }(),
3982 _pipes = __webpack_require__(8),
3983 _pipes2 = _interopRequireDefault(_pipes),
3984 _curlycurly = __webpack_require__(5),
3985 _curlycurly2 = _interopRequireDefault(_curlycurly),
3986 _notification_info = __webpack_require__(11),
3987 _notification_info2 = _interopRequireDefault(_notification_info),
3988 NotificationProductFeed = function(_NotificationInfo) {
3989 function NotificationProductFeed() {
3990 return _classCallCheck(this, NotificationProductFeed), _possibleConstructorReturn(this, (NotificationProductFeed.__proto__ || Object.getPrototypeOf(NotificationProductFeed)).apply(this, arguments))
3991 }
3992 return _inherits(NotificationProductFeed, _NotificationInfo), _createClass(NotificationProductFeed, [{
3993 key: "getMessage",
3994 value: function() {
3995 var curly = new _curlycurly2.default(this.response.result, _pipes2.default),
3996 msg = curly.compile(this.notification.msg);
3997 return msg = msg.replace(/href=['"](.*?)["']/g, function(matched, href) {
3998 var secureHref = this.secureUrl(href);
3999 return 'class="socialproof-message-reset" rel="nofollow" href="' + window.SP.schema + "//api" + window.SP.url + "/stats/notify/" + this.notification.id + "/click?appId=" + window.SP.appId + "&uid=" + window.SP.uid + "&ab=" + window.SP.ab.value + "&redirect=" + encodeURIComponent(secureHref) + '"'
4000 }.bind(this))
4001 }
4002 }, {
4003 key: "getImage",
4004 value: function() {
4005 var image = this.getIcon();
4006 return "undefined" == typeof this.notification.show_image && (this.notification.show_image = !0), this.notification.show_image && (image = this.response.result.productImage), 0 === image.indexOf("://") && (image = image.substring(1)), 0 === image.indexOf("http:") && (image = image.substring(5)), image
4007 }
4008 }, {
4009 key: "getLink",
4010 value: function() {
4011 return window.SP.schema + "//api" + window.SP.url + "/stats/notify/" + this.notification.id + "/click?appId=" + window.SP.appId + "&uid=" + window.SP.uid + "&ab=" + window.SP.ab.value + "&redirect=" + encodeURIComponent(this.secureUrl(this.response.result.productUrl))
4012 }
4013 }, {
4014 key: "notify",
4015 value: function(callback) {
4016 this.saveDisplay(), callback(this.response.event, this.getMessage(), this.getImage(), this.getLink(), this.getId())
4017 }
4018 }]), NotificationProductFeed
4019 }(_notification_info2.default);
4020 exports.default = NotificationProductFeed, module.exports = exports.default
4021}, function(module, exports, __webpack_require__) {
4022 "use strict";
4023
4024 function _interopRequireDefault(obj) {
4025 return obj && obj.__esModule ? obj : {
4026 default: obj
4027 }
4028 }
4029
4030 function _classCallCheck(instance, Constructor) {
4031 if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function")
4032 }
4033
4034 function _possibleConstructorReturn(self, call) {
4035 if (!self) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
4036 return !call || "object" != typeof call && "function" != typeof call ? self : call
4037 }
4038
4039 function _inherits(subClass, superClass) {
4040 if ("function" != typeof superClass && null !== superClass) throw new TypeError("Super expression must either be null or a function, not " + typeof superClass);
4041 subClass.prototype = Object.create(superClass && superClass.prototype, {
4042 constructor: {
4043 value: subClass,
4044 enumerable: !1,
4045 writable: !0,
4046 configurable: !0
4047 }
4048 }), superClass && (Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass)
4049 }
4050 Object.defineProperty(exports, "__esModule", {
4051 value: !0
4052 });
4053 var _createClass = function() {
4054 function defineProperties(target, props) {
4055 for (var i = 0; i < props.length; i++) {
4056 var descriptor = props[i];
4057 descriptor.enumerable = descriptor.enumerable || !1, descriptor.configurable = !0, "value" in descriptor && (descriptor.writable = !0), Object.defineProperty(target, descriptor.key, descriptor)
4058 }
4059 }
4060 return function(Constructor, protoProps, staticProps) {
4061 return protoProps && defineProperties(Constructor.prototype, protoProps), staticProps && defineProperties(Constructor, staticProps), Constructor
4062 }
4063 }(),
4064 _pipes = __webpack_require__(8),
4065 _pipes2 = _interopRequireDefault(_pipes),
4066 _curlycurly = __webpack_require__(5),
4067 _curlycurly2 = _interopRequireDefault(_curlycurly),
4068 _notification_info = __webpack_require__(11),
4069 _notification_info2 = _interopRequireDefault(_notification_info),
4070 _allowed_domains = __webpack_require__(50),
4071 NotificationReview = function(_NotificationInfo) {
4072 function NotificationReview() {
4073 return _classCallCheck(this, NotificationReview), _possibleConstructorReturn(this, (NotificationReview.__proto__ || Object.getPrototypeOf(NotificationReview)).apply(this, arguments))
4074 }
4075 return _inherits(NotificationReview, _NotificationInfo), _createClass(NotificationReview, [{
4076 key: "getMessage",
4077 value: function() {
4078 var curly = new _curlycurly2.default(this.response.result, _pipes2.default),
4079 msg = curly.compile(this.notification.msg);
4080 return msg = msg.replace(/href=['"](.*?)["']/g, function(matched, href) {
4081 var secureHref = this.secureUrl(href, null, _allowed_domains.allowedDomains);
4082 return 'class="socialproof-message-reset" rel="nofollow" href="' + window.SP.schema + "//api" + window.SP.url + "/stats/notify/" + this.notification.id + "/click?appId=" + window.SP.appId + "&uid=" + window.SP.uid + "&ab=" + window.SP.ab.value + "&redirect=" + encodeURIComponent(secureHref) + '"'
4083 }.bind(this))
4084 }
4085 }, {
4086 key: "getImage",
4087 value: function() {
4088 var image = this.getIcon();
4089 return "undefined" == typeof this.notification.show_image && (this.notification.show_image = !0), this.notification.show_image && (image = this.response.result.userAvatar), 0 === image.indexOf("://") && (image = image.substring(1)), 0 === image.indexOf("http:") && (image = image.substring(5)), image
4090 }
4091 }, {
4092 key: "getLink",
4093 value: function() {
4094 return window.SP.schema + "//api" + window.SP.url + "/stats/notify/" + this.notification.id + "/click?appId=" + window.SP.appId + "&uid=" + window.SP.uid + "&ab=" + window.SP.ab.value + "&redirect=" + encodeURIComponent(this.secureUrl(this.response.result.permalink, null, _allowed_domains.allowedDomains))
4095 }
4096 }, {
4097 key: "notify",
4098 value: function(callback) {
4099 this.saveDisplay(), callback(this.response.event, this.getMessage(), this.getImage(), this.getLink(), this.getId())
4100 }
4101 }]), NotificationReview
4102 }(_notification_info2.default);
4103 exports.default = NotificationReview, module.exports = exports.default
4104}, function(module, exports, __webpack_require__) {
4105 "use strict";
4106
4107 function _classCallCheck(instance, Constructor) {
4108 if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function")
4109 }
4110 Object.defineProperty(exports, "__esModule", {
4111 value: !0
4112 });
4113 var _createClass = function() {
4114 function defineProperties(target, props) {
4115 for (var i = 0; i < props.length; i++) {
4116 var descriptor = props[i];
4117 descriptor.enumerable = descriptor.enumerable || !1, descriptor.configurable = !0, "value" in descriptor && (descriptor.writable = !0), Object.defineProperty(target, descriptor.key, descriptor)
4118 }
4119 }
4120 return function(Constructor, protoProps, staticProps) {
4121 return protoProps && defineProperties(Constructor.prototype, protoProps), staticProps && defineProperties(Constructor, staticProps), Constructor
4122 }
4123 }(),
4124 CSS = function() {
4125 function CSS() {
4126 _classCallCheck(this, CSS), this.style = null
4127 }
4128 return _createClass(CSS, [{
4129 key: "load",
4130 value: function(configStyle) {
4131 this.style = configStyle
4132 }
4133 }, {
4134 key: "getClass",
4135 value: function() {
4136 switch (this.style.schema) {
4137 case 0:
4138 return "";
4139 case 1:
4140 return "gradient";
4141 default:
4142 return ""
4143 }
4144 }
4145 }, {
4146 key: "removeStyle",
4147 value: function() {
4148 var e = document.getElementById("socialproof-style");
4149 e && e.parentNode.removeChild(e)
4150 }
4151 }, {
4152 key: "embedStyle",
4153 value: function(parentElement) {
4154 var style = document.createElement("style");
4155 style.setAttribute("id", "socialproof-style"), style.type = "text/css", style.innerHTML = '\n .socialproof-reset {\n position: static;\n float: none;\n padding: 0;\n margin: 0;\n border: 0 none;\n outline: 0 none;\n border-spacing: 0;\n color: #000;\n font-family: "Helvetica Neue", Arial, sans-serif;\n font-size: 10px;\n font-style: normal;\n font-weight: normal;\n font-variant: normal;\n line-height: normal;\n text-decoration: none;\n text-transform: none;\n text-align: left;\n text-indent: 0;\n text-shadow: none;\n letter-spacing: normal;\n word-spacing: normal;\n white-space: normal;\n direction: ltr;\n background: none repeat scroll 0 0 transparent;\n vertical-align: middle;\n overflow: visible;\n max-width: none;\n max-height: none;\n -moz-box-sizing: content-box;\n }\n\n .socialproof-container {\n position: fixed;\n ' + (this.style.x || "right") + ": 10px;\n " + (this.style.y || "bottom") + ": 10px;\n width: " + (this.style.width || 15) + "px;\n height: auto;\n overflow-y: auto;\n overflow-x: hidden;\n z-index: 2147483640;\n padding: 10px;\n }\n\n .socialproof-wrapper {\n clear: both;\n\n /* Animation on creation */\n -webkit-animation: pushDown 500ms forwards;\n animation: pushDown 500ms forwards;\n }\n\n .socialproof {\n position: relative;\n opacity: 1;\n margin-top: 10px;\n border-radius: 6px;\n -webkit-box-shadow: 0 0 10px 0 rgba(0, 0, 0, 0.1);\n -moz-box-shadow: 0 0 10px 0 rgba(0, 0, 0, 0.1);\n box-shadow: 0 0 10px 0 rgba(0, 0, 0, 0.1);\n z-index: 99999;\n\n /* Configurable */\n background-color: " + (this.style.background_color || "#fff") + ";\n\n /* Animation on creation */\n -webkit-animation: fadein 500ms; /* Safari, Chrome and Opera > 12.1 */\n -moz-animation: fadein 500ms; /* Firefox < 16 */\n -ms-animation: fadein 500ms; /* Internet Explorer */\n -o-animation: fadein 500ms; /* Opera < 12.1 */\n animation: fadein 500ms;\n }\n\n .socialproof.gradient {\n background: linear-gradient(to right, " + (this.style.border_color || "#000") + ", " + (this.style.background_color || "#fff") + ");\n }\n\n .socialproof .socialproof-image-crop {\n width: " + (this.style.height || 80) + "px;\n height: " + (this.style.height || 80) + "px;\n float: left;\n margin-right: 5px;\n border-color: " + (this.style.border_color || "#000") + ";\n border-style: solid;\n border-width: 5px;\n background-color: " + (this.style.border_color || "#000") + ";\n overflow: hidden;\n box-sizing: content-box;\n text-align: center;\n border-radius: 6px 0px 0px 6px;\n }\n\n .socialproof .socialproof-image-crop .socialproof-image {\n height: " + (this.style.height || 80) + "px !important;\n width: " + (this.style.height || 80) + "px !important;\n object-fit: scale-down;\n font-family: 'object-fit: scale-down;';\n }\n\n .socialproof.gradient .socialproof-image-crop {\n background-color: transparent;\n border-color: transparent;\n }\n\n .socialproof .socialproof-text {\n min-height: " + (this.style.height || 80) + "px;\n width: auto;\n padding: 10px 20px 0 0;\n box-sizing: content-box;\n text-align: left;\n margin-left: " + (this.style.height || 80) + "px;\n }\n\n .socialproof .socialproof-text .socialproof-message {\n color: " + (this.style.text_color || this.style.text && this.style.text.color || "#000") + ";\n font-size: " + (this.style.text_font_size || this.style.text && this.style.text.font_size || 13) + "px;\n }\n\n .socialproof .socialproof-text .socialproof-message a {\n color: " + (this.style.text_color || this.style.text && this.style.text.color || "#000") + ";\n font-size: " + (this.style.text_font_size || this.style.text && this.style.text.font_size || 13) + 'px;\n font-family: "Helvetica Neue", Arial, sans-serif;\n text-decoration: none;\n font-style: normal;\n font-weight: 700;\n }\n\n .socialproof .socialproof-text .socialproof-message strong {\n color: ' + (this.style.text_color || this.style.text && this.style.text.color || "#000") + ";\n font-size: " + (this.style.text_font_size || this.style.text && this.style.text.font_size || 13) + "px;\n font-weight: 700;\n }\n\n .socialproof .socialproof-text .socialproof-lasttime {\n color: " + (this.style.text_color || this.style.text && this.style.text.color || "#000") + ";\n display: " + (this.style.last_time === !1 ? "none" : "block") + ";\n font-size: 10px;\n line-height: 20px;\n margin-left: 15px;\n }\n\n .socialproof .socialproof-brand {\n position: absolute;\n font-size: 10px;\n bottom: 5px;\n right: 5px;\n }\n\n .socialproof .socialproof-brand .socialproof-brand-link {\n text-decoration: none;\n color: #cdcdcd;\n }\n\n .socialproof .socialproof-dissmiss {\n position: absolute;\n top: 3px;\n right: 3px;\n width: 16px;\n height: 16px;\n background: rgba(0,0,0,0.2);\n border-radius: 50%;\n }\n\n .socialproof .socialproof-dissmiss:before, .socialproof-dissmiss:after {\n position: absolute;\n top: 3px;\n right: 7px;\n content: ' ';\n height: 10px;\n width: 2px;\n background-color: #ffffff;\n }\n\n .socialproof .socialproof-dissmiss:before{\n transform: rotate(45deg);\n }\n\n .socialproof .socialproof-dissmiss:after{\n transform: rotate(-45deg);\n }\n\n .socialproof .socialproof-dissmiss:hover {\n background: #000000;\n cursor: pointer;\n }\n\n .socialproof .socialproof-pixel {\n position: absolute;\n }\n\n .socialproof-show-up { \n animation-name: showUp;\n animation-iteration-count: infinite;\n animation-duration: .5s;\n display: inline-block;\n max-width: " + (this.style.width - this.style.height - 60) + "px;\n }\n \n @keyframes showUp {\n 35%, 65% { transform: scale(1.2) }\n }\n\n /* Outro transition */\n .socialproof.fade-out {\n opacity: 0;\n transition: opacity 500ms ease-in-out;\n -moz-transition: opacity 500ms ease-in-out;\n -webkit-transition: opacity 500ms ease-in-out;\n }\n\n /* CSS Animations */\n @keyframes fadein {\n from { opacity: 0; }\n to { opacity: 1; }\n }\n \n /* Firefox < 16 */\n @-moz-keyframes fadein {\n from { opacity: 0; }\n to { opacity: 1; }\n }\n \n /* Safari, Chrome and Opera > 12.1 */\n @-webkit-keyframes fadein {\n from { opacity: 0; }\n to { opacity: 1; }\n }\n \n /* Internet Explorer */\n @-ms-keyframes fadein {\n from { opacity: 0; }\n to { opacity: 1; }\n }\n \n /* Opera < 12.1 */\n @-o-keyframes fadein {\n from { opacity: 0; }\n to { opacity: 1; }\n }\n\n @media screen and (max-width:767px) {\n .socialproof-container {\n " + (this.style.mobile_y || this.style.mobile_text || "bottom") + ": 0;\n " + ("top" === (this.style.mobile_y || this.style.mobile_text) ? "bottom" : "top") + ": auto;\n right: 0;\n left: 0;\n width: 100%;\n padding: 0px\n }\n .socialproof {\n font-size: 12px;\n margin-" + (this.style.mobile_y || this.style.mobile_text || "bottom") + ": 0px;\n margin-" + ("top" === (this.style.mobile_y || this.style.mobile_text) ? "bottom" : "top") + ": 10px;\n border-radius: 0px;\n }\n .socialproof .socialproof-image-crop {\n width: 50px;\n height: 50px;\n border-radius: 0px;\n }\n .socialproof .socialproof-image-crop .socialproof-image {\n height: 50px !important;\n width: 50px !important;\n object-fit: scale-down;\n font-family: 'object-fit: scale-down;';\n }\n .socialproof .socialproof-text {\n min-height: 50px;\n }\n .socialproof .socialproof-text .socialproof-message,\n .socialproof .socialproof-text .socialproof-message a,\n .socialproof .socialproof-text .socialproof-message strong {\n font-size: 12px;\n }\n .socialproof .socialproof-text .socialproof-lasttime {\n margin-left: 0px;\n }\n }",
4156 parentElement.appendChild(style)
4157 }
4158 }]), CSS
4159 }();
4160 exports.default = CSS, module.exports = exports.default
4161}, function(module, exports, __webpack_require__) {
4162 "use strict";
4163
4164 function _interopRequireDefault(obj) {
4165 return obj && obj.__esModule ? obj : {
4166 default: obj
4167 }
4168 }
4169
4170 function _classCallCheck(instance, Constructor) {
4171 if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function")
4172 }
4173 Object.defineProperty(exports, "__esModule", {
4174 value: !0
4175 });
4176 var _createClass = function() {
4177 function defineProperties(target, props) {
4178 for (var i = 0; i < props.length; i++) {
4179 var descriptor = props[i];
4180 descriptor.enumerable = descriptor.enumerable || !1, descriptor.configurable = !0, "value" in descriptor && (descriptor.writable = !0), Object.defineProperty(target, descriptor.key, descriptor)
4181 }
4182 }
4183 return function(Constructor, protoProps, staticProps) {
4184 return protoProps && defineProperties(Constructor.prototype, protoProps), staticProps && defineProperties(Constructor, staticProps), Constructor
4185 }
4186 }(),
4187 _notificator_config = __webpack_require__(16),
4188 _notificator_config2 = _interopRequireDefault(_notificator_config),
4189 Notificator = function() {
4190 function Notificator() {
4191 _classCallCheck(this, Notificator), this.timing = {}
4192 }
4193 return _createClass(Notificator, [{
4194 key: "setStyle",
4195 value: function(style) {
4196 this.style = style
4197 }
4198 }, {
4199 key: "setTiming",
4200 value: function(timing) {
4201 this.timing = timing
4202 }
4203 }, {
4204 key: "notify",
4205 value: function(notification) {
4206 document.getElementById(_notificator_config2.default.CONTAINER_ID) || this.createContainer(), this.showNotification(notification.getElement())
4207 }
4208 }, {
4209 key: "createContainer",
4210 value: function() {
4211 var nc = document.createElement("div");
4212 nc.className = _notificator_config2.default.CONTAINER_CLASS, nc.id = _notificator_config2.default.CONTAINER_ID, document.body.appendChild(nc)
4213 }
4214 }, {
4215 key: "showNotification",
4216 value: function(notificationElement) {
4217 var nc = document.getElementById(_notificator_config2.default.CONTAINER_ID),
4218 nw = document.createElement("div");
4219 nw.className = _notificator_config2.default.NOTIFICATION_WRAPPER_CLASS, notificationElement.className = notificationElement.className + " " + this.style.getClass(), nw.appendChild(notificationElement), nc.insertBefore(nw, nc.firstChild), window.SP_objectFitImages("img.socialproof-image"), this.runAnimations(nw), setTimeout(function() {
4220 this.removeNotification(notificationElement)
4221 }.bind(this), this.timing.showTime)
4222 }
4223 }, {
4224 key: "removeNotification",
4225 value: function(notificationElement) {
4226 notificationElement.className = notificationElement.className + " fade-out", setTimeout(function() {
4227 document.getElementById(_notificator_config2.default.CONTAINER_ID).removeChild(notificationElement.parentElement)
4228 }, 600)
4229 }
4230 }, {
4231 key: "removeAllNotifications",
4232 value: function() {
4233 var c = document.getElementById(_notificator_config2.default.CONTAINER_ID);
4234 if (c)
4235 for (; c.firstChild;) c.removeChild(c.firstChild)
4236 }
4237 }, {
4238 key: "runAnimations",
4239 value: function(element) {
4240 this.runAnimationCountUp(element)
4241 }
4242 }, {
4243 key: "runAnimationCountUp",
4244 value: function(element) {
4245 var countUp = element.querySelector(".socialproof-count-up");
4246 if (countUp) {
4247 var startTimestamp = Date.now();
4248 window.SP.log("NOTIFICATIONS Starting count_up animation");
4249 var number = Number(countUp.innerHTML) + 1,
4250 counter = 0,
4251 delay = 1,
4252 x = number / 2,
4253 y = 0,
4254 counterJs = function counterJs() {
4255 y++, delay = y - x, countUp.innerHTML = counter.toString(), counter++, counter < number ? setTimeout(function() {
4256 counterJs()
4257 }, delay) : window.SP.log("NOTIFICATIONS Finishing count_up animation. Took [ms]: " + (Date.now() - startTimestamp))
4258 };
4259 counterJs()
4260 }
4261 }
4262 }]), Notificator
4263 }();
4264 exports.default = Notificator, module.exports = exports.default
4265}, function(module, exports, __webpack_require__) {
4266 "use strict";
4267
4268 function _classCallCheck(instance, Constructor) {
4269 if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function")
4270 }
4271 Object.defineProperty(exports, "__esModule", {
4272 value: !0
4273 });
4274 var _createClass = function() {
4275 function defineProperties(target, props) {
4276 for (var i = 0; i < props.length; i++) {
4277 var descriptor = props[i];
4278 descriptor.enumerable = descriptor.enumerable || !1, descriptor.configurable = !0, "value" in descriptor && (descriptor.writable = !0), Object.defineProperty(target, descriptor.key, descriptor)
4279 }
4280 }
4281 return function(Constructor, protoProps, staticProps) {
4282 return protoProps && defineProperties(Constructor.prototype, protoProps), staticProps && defineProperties(Constructor, staticProps), Constructor
4283 }
4284 }(),
4285 NotificatorInline = function() {
4286 function NotificatorInline() {
4287 _classCallCheck(this, NotificatorInline), this.timing = {}
4288 }
4289 return _createClass(NotificatorInline, [{
4290 key: "setTiming",
4291 value: function(timing) {
4292 this.timing = timing
4293 }
4294 }, {
4295 key: "setStyle",
4296 value: function(style) {
4297 this.style = style
4298 }
4299 }, {
4300 key: "removePreviousNotification",
4301 value: function(selector) {
4302 var container = document.querySelector('[data-selector="' + selector + '"]');
4303 container && container.firstChild && ! function() {
4304 var notificationElement = container.firstChild;
4305 notificationElement.classList.add("socialproof-inline-fade-out"), setTimeout(function() {
4306 notificationElement.remove()
4307 }, 500)
4308 }()
4309 }
4310 }, {
4311 key: "notify",
4312 value: function(notification) {
4313 var n = notification.getElement();
4314 this.showNotification(n, notification.notification.options.container)
4315 }
4316 }, {
4317 key: "showNotification",
4318 value: function(container, selector) {
4319 this.removePreviousNotification(selector);
4320 var parent = document.querySelector(selector);
4321 parent && parent.lastElementChild && parent.lastElementChild.nextSibling ? parent.insertBefore(container, parent.lastElementChild.nextSibling) : parent && parent.nextSibling && parent.parentNode.insertBefore(container, parent.nextSibling)
4322 }
4323 }]), NotificatorInline
4324 }();
4325 exports.default = NotificatorInline, module.exports = exports.default
4326}, function(module, exports, __webpack_require__) {
4327 "use strict";
4328 Object.defineProperty(exports, "__esModule", {
4329 value: !0
4330 }), exports.default = {
4331 NOTIFICATION_INLINE_RESET_CLASS: "socialproof-inline-reset",
4332 NOTIFICATION_INLINE_CONTAINER_CLASS: "socialproof-inline-reset socialproof-inline-container",
4333 NOTIFICATION_INLINE_CLASS: "socialproof-inline-reset socialproof-inline socialproof-inline-slide-in",
4334 NOTIFICATION_INLINE_TEXT_CLASS: "socialproof-inline-reset socialproof-inline-text",
4335 NOTIFICATION_INLINE_BRAND_CLASS: "socialproof-inline-reset socialproof-inline-brand",
4336 NOTIFICATION_INLINE_PIXEL_CLASS: "socialproof-inline-reset socialproof-inline-pixel"
4337 }, module.exports = exports.default
4338}, function(module, exports, __webpack_require__) {
4339 "use strict";
4340
4341 function _interopRequireDefault(obj) {
4342 return obj && obj.__esModule ? obj : {
4343 default: obj
4344 }
4345 }
4346
4347 function _classCallCheck(instance, Constructor) {
4348 if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function")
4349 }
4350 Object.defineProperty(exports, "__esModule", {
4351 value: !0
4352 });
4353 var _createClass = function() {
4354 function defineProperties(target, props) {
4355 for (var i = 0; i < props.length; i++) {
4356 var descriptor = props[i];
4357 descriptor.enumerable = descriptor.enumerable || !1, descriptor.configurable = !0, "value" in descriptor && (descriptor.writable = !0), Object.defineProperty(target, descriptor.key, descriptor)
4358 }
4359 }
4360 return function(Constructor, protoProps, staticProps) {
4361 return protoProps && defineProperties(Constructor.prototype, protoProps), staticProps && defineProperties(Constructor, staticProps), Constructor
4362 }
4363 }(),
4364 _notificator_new_config = __webpack_require__(17),
4365 _notificator_new_config2 = _interopRequireDefault(_notificator_new_config),
4366 NotificatorNew = function() {
4367 function NotificatorNew() {
4368 _classCallCheck(this, NotificatorNew), this.timing = {}
4369 }
4370 return _createClass(NotificatorNew, [{
4371 key: "setStyle",
4372 value: function(style) {
4373 this.style = style
4374 }
4375 }, {
4376 key: "setTiming",
4377 value: function(timing) {
4378 this.timing = timing
4379 }
4380 }, {
4381 key: "handleNotificationPosition",
4382 value: function(notificationElement, options) {
4383 if ("window" !== options.parent && "selector" === options.parent && options.container && document.querySelector(options.container)) {
4384 var notificationElementSizes = notificationElement.getBoundingClientRect(),
4385 targetElement = document.querySelector(options.container),
4386 targetElementSizes = targetElement.getBoundingClientRect();
4387 "bottom" === options.y ? (notificationElement.style.bottom = "0px", notificationElement.style.top = targetElementSizes.y + targetElement.clientHeight - notificationElementSizes.height + "px") : (notificationElement.style.bottom = "0px", notificationElement.style.top = targetElementSizes.top + "px"), "left" === options.x ? (notificationElement.style.right = "0px", notificationElement.style.left = targetElementSizes.x + "px") : (notificationElement.style.right = "0px", notificationElement.style.left = targetElementSizes.x + targetElementSizes.width - notificationElementSizes.width + "px")
4388 }
4389 }
4390 }, {
4391 key: "notify",
4392 value: function(notification) {
4393 var _this = this;
4394 document.getElementById(_notificator_new_config2.default.CONTAINER_ID) || this.createContainer();
4395 var n = notification.getElement(),
4396 positionHandle = function() {
4397 return _this.handleNotificationPosition(n, notification.notification.options)
4398 };
4399 this.showNotification(n, positionHandle)
4400 }
4401 }, {
4402 key: "createContainer",
4403 value: function() {
4404 var nc = document.createElement("div");
4405 nc.id = _notificator_new_config2.default.CONTAINER_ID, nc.className = _notificator_new_config2.default.NOTIFICATION_NEW_CONTAINER_CLASS, document.body.appendChild(nc)
4406 }
4407 }, {
4408 key: "showNotification",
4409 value: function(notificationElement, positionHandle) {
4410 var _this2 = this,
4411 nc = document.getElementById(_notificator_new_config2.default.CONTAINER_ID),
4412 nw = document.createElement("div");
4413 nw.appendChild(notificationElement), nc.insertBefore(nw, nc.firstChild), positionHandle(), window.addEventListener("scroll", positionHandle), window.addEventListener("resize", positionHandle), setTimeout(function() {
4414 _this2.removeNotification(notificationElement, positionHandle)
4415 }, parseInt(this.timing.showTime))
4416 }
4417 }, {
4418 key: "removeNotification",
4419 value: function(notificationElement, positionHandle) {
4420 notificationElement.className = notificationElement.className + " " + _notificator_new_config2.default.NOTIFICATION_NEW_FADE_OUT_ANIMATION_CLASS, notificationElement.addEventListener("transitionend", function() {
4421 document.getElementById(_notificator_new_config2.default.CONTAINER_ID).removeChild(notificationElement.parentElement)
4422 }, !1), setTimeout(function() {
4423 window.removeEventListener("scroll", positionHandle), window.removeEventListener("resize", positionHandle), document.getElementById(_notificator_new_config2.default.CONTAINER_ID).removeChild(notificationElement.parentElement)
4424 }, 600)
4425 }
4426 }, {
4427 key: "removeAllNotifications",
4428 value: function() {
4429 var c = document.getElementById(_notificator_new_config2.default.CONTAINER_ID);
4430 if (c)
4431 for (; c.firstChild;) c.removeChild(c.firstChild)
4432 }
4433 }]), NotificatorNew
4434 }();
4435 exports.default = NotificatorNew, module.exports = exports.default
4436}, function(module, exports, __webpack_require__) {
4437 "use strict";
4438 var customSaveCart = __webpack_require__(18).saveCart,
4439 getCart = function() {
4440 for (var orders = document.querySelectorAll("table.orders.addedItems > tbody > tr"), products = [], i = 0; i < orders.length; i++) {
4441 var q = parseInt(orders[i].querySelector(".col-quantity input").value),
4442 s = parseFloat(orders[i].querySelector(".col-price .price").innerText.match(/\d+,\d+/)[0].replace(",", "."));
4443 products.push({
4444 product_id: orders[i].querySelector(".col-name a").href.match(/,(\d+)\.html/)[1],
4445 product_name: orders[i].querySelector(".col-name a").innerText,
4446 product_url: orders[i].querySelector(".col-name a").href,
4447 product_img: orders[i].querySelector(".col-image img").src,
4448 quantity: q,
4449 sum: s,
4450 price: s / q
4451 })
4452 }
4453 return products
4454 };
4455 module.exports = {
4456 product: function() {
4457 SP.go("productPage", {
4458 productId: document.location.pathname.match(/,(\d+)\.html/)[1],
4459 product: "$SP.platforms.custom.getMetaValue,og:title",
4460 link: "$SP.platforms.custom.getMetaValue,og:url",
4461 image: "$SP.platforms.custom.getMetaValue,og:image"
4462 })
4463 },
4464 saveCart: function() {
4465 return customSaveCart(getCart())
4466 }
4467 }
4468}, function(module, exports, __webpack_require__) {
4469 "use strict";
4470 var productPage = function() {
4471 Array.from(document.querySelectorAll('script[type="application/ld+json"]')).forEach(function(ldjson) {
4472 try {
4473 var ld = JSON.parse(ldjson.textContent);
4474 "Product" === ld["@type"] && SP.go("productPage", {
4475 productId: ld.productID,
4476 product: ld.name,
4477 link: ld.url,
4478 image: ld.image[0]
4479 })
4480 } catch (error) {
4481 window.SP.error("PRODUCT ERROR", error)
4482 }
4483 })
4484 },
4485 purchasedBasket = function() {
4486 var orderID = document.querySelector("div.vc-orderfinish article > div.message.success").textContent.match(/\d+/)[0];
4487 Array.from(document.querySelectorAll(".orderItems .orderItem")).forEach(function(item) {
4488 try {
4489 SP.go("push", "buy", {
4490 firstname: document.querySelector(".invoiceAddress .firstName .frm-text").textContent,
4491 city: document.querySelector(".invoiceAddress .city .frm-text").textContent,
4492 productId: item.querySelector(".basicInfo .code").textContent,
4493 product: item.querySelector(".basicInfo .name span").textContent,
4494 link: item.querySelector(".basicInfo .name a").href,
4495 image: item.querySelector("img").src,
4496 orderId: orderID,
4497 price: parseFloat(item.querySelector(".pricing .unitPrice dd").textContent.replace(/\D*/g, "")) / 100,
4498 quantity: parseInt(item.querySelector(".quantity small").textContent.match(/\d+/)[0]),
4499 sum: parseFloat(item.querySelector(".pricing .sumPrice dd").textContent.replace(/\D*/g, "")) / 100
4500 })
4501 } catch (error) {
4502 window.SP.error("THANK YOU ERROR", error)
4503 }
4504 })
4505 };
4506 module.exports = {
4507 start: function() {
4508 var bodyClasses = Array.from(document.getElementsByTagName("body")[0].classList);
4509 bodyClasses.indexOf("view-index") > -1 ? SP.go("startPage") : bodyClasses.indexOf("view-commoditycategory-detail") > -1 ? SP.go("categoryPage") : bodyClasses.indexOf("view-commodity-detail") > -1 ? productPage() : bodyClasses.indexOf("view-basket-Index") > -1 ? SP.go("basketPage") : document.querySelector("div.vc-orderfinish") && (SP.go("thankYouPage"), purchasedBasket())
4510 }
4511 }
4512}, function(module, exports, __webpack_require__) {
4513 "use strict";
4514 var getMetaValue = __webpack_require__(0).getMetaValue,
4515 getTagAttrValueByRegex = __webpack_require__(0).getTagAttrValueByRegex,
4516 PRODUCT_URL_RX = "product-(pol|eng|\\w{3})-(#PRODUCT_ID#)-[\\w\\-\\d]+(\\.html)?",
4517 PRODUCT_URL_RX_2 = "(pl|en)\\/products\\/([\\w\\-\\d]+\\/)*([\\w\\-\\d]+)-(#PRODUCT_ID#)(\\.html)?",
4518 PRODUCT_IMAGE_URL_RX = "data\\/gfx\\/(pictures|icons)\\/(small|medium)\\/\\d\\/\\d\\/(#PRODUCT_ID#)(_\\d)?\\.(jpg|jpeg|png)",
4519 getRxForProductId = function(rx, productId) {
4520 return new RegExp(rx.replace("#PRODUCT_ID#", productId), "gi")
4521 };
4522 module.exports = {
4523 getProductName: function() {
4524 return getMetaValue("og:title")
4525 },
4526 getProductUrl: function() {
4527 return getMetaValue("og:url")
4528 },
4529 getProductImageUrl: function() {
4530 return getMetaValue("og:image")
4531 },
4532 getProductUrlFromOrder: function(productId) {
4533 var r = null;
4534 return r = r || getTagAttrValueByRegex("a", "href", getRxForProductId(PRODUCT_URL_RX, productId)), r = r || getTagAttrValueByRegex("a", "href", getRxForProductId(PRODUCT_URL_RX_2, productId))
4535 },
4536 getProductImageUrlFromOrder: function(productId) {
4537 return getTagAttrValueByRegex("img", "src", getRxForProductId(PRODUCT_IMAGE_URL_RX, productId))
4538 }
4539 }
4540}, function(module, exports, __webpack_require__) {
4541 "use strict";
4542 module.exports = {
4543 product: function() {
4544 SP.go("productPage", {
4545 productId: document.querySelector('.page-product input[name="koszyk"]').value,
4546 product: document.querySelector(".page-product h1").textContent.trim(),
4547 link: document.querySelector('meta[property="og:url"]').content,
4548 image: document.querySelector('meta[property="og:image"]').content
4549 })
4550 },
4551 basket: function() {
4552 SP.go("basketPage"),
4553 function() {
4554 window.trustisto_delivery = {
4555 firstname: "",
4556 city: ""
4557 }, document.querySelectorAll(".user-info input").length > 0 && (document.querySelector('.user-info input[name="imie"]').addEventListener("change", function(e) {
4558 window.trustisto_delivery.firstname = e.target.value, SP.go("ev", "$SP.platforms.custom.saveDelivery,$trustisto_delivery")
4559 }), document.querySelector('.user-info input[name="miasto"]').addEventListener("change", function(e) {
4560 window.trustisto_delivery.city = e.target.value, SP.go("ev", "$SP.platforms.custom.saveDelivery,$trustisto_delivery")
4561 }))
4562 }(),
4563 function() {
4564 document.querySelectorAll(".module-items .item input").length > 0 && (window.trustisto_basket = Array.from(document.querySelectorAll(".module-items .item")).map(function(item) {
4565 return {
4566 product_id: item.querySelector("figure a").href.match(/p(\d+)/)[1],
4567 product_name: item.querySelector(".title").innerText,
4568 product_url: item.querySelector(".title a").href,
4569 product_img: item.querySelector("figure img").src,
4570 price: item.querySelector(".price span").innerText.split(" ")[0].replace(",", "."),
4571 quantity: item.querySelector('.option input[type="text"]').value,
4572 sum: item.querySelector(".price-all span").innerText.split(" ")[0].replace(",", ".")
4573 }
4574 }), SP.go("ev", "$SP.platforms.custom.saveCart,$trustisto_basket"))
4575 }()
4576 },
4577 thankyou: function() {
4578 SP.go("ev", "$SP.platforms.custom.callNewCartWithDelivery"), SP.go("thankYouPage")
4579 }
4580 }
4581}, function(module, exports, __webpack_require__) {
4582 "use strict";
4583
4584 function fixImage(oryginalUrl) {
4585 var productImage = oryginalUrl;
4586 try {
4587 if (0 !== productImage.indexOf("https://static")) {
4588 var path = productImage.substring(productImage.indexOf("templates/images/products")),
4589 websiteId = path.match(/products\/(\d+)\//)[1];
4590 productImage = "https://static4.redcart.pl/templates/images/thumb/" + websiteId + "/200/200/pl/0/" + path
4591 }
4592 } catch (_ex) {
4593 productImage = oryginalUrl
4594 }
4595 return productImage
4596 }
4597 module.exports = {
4598 start: function() {
4599 var pageType = window.RC_VARS && window.RC_VARS.event;
4600 switch (pageType) {
4601 case "home":
4602 SP.go("startPage");
4603 break;
4604 case "categories":
4605 SP.go("categoryPage");
4606 break;
4607 case "search":
4608 SP.go("searchPage");
4609 break;
4610 case "product":
4611 var product = window.RC_VARS.data.products[0];
4612 SP.go("productPage", {
4613 productId: product.products_id,
4614 product: product.name,
4615 link: product.url,
4616 image: fixImage(product.images[0])
4617 });
4618 break;
4619 case "cart":
4620 SP.go("basketPage");
4621 break;
4622 case "purchase":
4623 SP.go("thankYouPage");
4624 for (var order = window.RC_VARS.data.orders[0], cart = order.products, c = 0; c < cart.length; c++) {
4625 var purchasedProduct = cart[c];
4626 SP.go("push", "buy", {
4627 firstname: order.customers_first_name,
4628 city: order.customers_city,
4629 productId: purchasedProduct.products_id,
4630 product: purchasedProduct.name,
4631 link: purchasedProduct.url,
4632 image: fixImage(purchasedProduct.images[0]),
4633 price: purchasedProduct.gross_price,
4634 quantity: purchasedProduct.item,
4635 sum: parseInt(purchasedProduct.item) * parseFloat(purchasedProduct.gross_price)
4636 })
4637 }
4638 }
4639 }
4640 }
4641}, function(module, exports, __webpack_require__) {
4642 "use strict";
4643 var getDataLayerValueByName = __webpack_require__(0).getDataLayerValueByName,
4644 createHash = __webpack_require__(0).createHash,
4645 getMetaValue = __webpack_require__(0).getMetaValue;
4646 module.exports = {
4647 start: function() {
4648 var pageType = getDataLayerValueByName("shoptet.pageType");
4649 switch (pageType) {
4650 case "homepage":
4651 SP.go("startPage");
4652 break;
4653 case "category":
4654 SP.go("categoryPage");
4655 break;
4656 case "article":
4657 "/search/" === window.location.pathname && SP.go("searchPage");
4658 break;
4659 case "productDetail":
4660 var productName = getDataLayerValueByName("shoptet.product.name");
4661 SP.go("productPage", {
4662 productId: createHash(productName),
4663 product: productName,
4664 link: getMetaValue("og:url"),
4665 image: getMetaValue("og:image"),
4666 category: getDataLayerValueByName("shoptet.product.currentCategory"),
4667 manufacturer: getDataLayerValueByName("shoptet.product.manufacturer")
4668 });
4669 break;
4670 case "cart":
4671 SP.go("basketPage");
4672 break;
4673 case "billingAndShipping":
4674 break;
4675 case "customerDetails":
4676 break;
4677 case "thankYou":
4678 SP.go("thankYouPage");
4679 for (var cart = getDataLayerValueByName("shoptet.order.content"), c = 0; c < cart.length; c++) {
4680 var p = cart[c];
4681 SP.go("push", "buy", {
4682 city: getDataLayerValueByName("shoptet.order.city"),
4683 productId: createHash(p.name),
4684 product: p.name,
4685 link: "%SP,copy,view,link",
4686 image: "%SP,copy,view,image",
4687 price: p.price,
4688 quantity: p.quantity,
4689 sum: parseFloat(p.price) * p.quantity
4690 })
4691 }
4692 }
4693 }
4694 }
4695}, function(module, exports, __webpack_require__) {
4696 "use strict";
4697 var replaceArray = __webpack_require__(0).replaceArray,
4698 saveData = __webpack_require__(0).saveData,
4699 retriveData = __webpack_require__(0).retriveData,
4700 getMetaValue = __webpack_require__(0).getMetaValue,
4701 getTagAttrValueByKeyValue = __webpack_require__(0).getTagAttrValueByKeyValue,
4702 getCart = function() {
4703 for (var items = [], trs = document.getElementsByTagName("tr"), productTrs = [], t = 0; t < trs.length; t++) {
4704 var trClass = trs[t].getAttribute("class");
4705 trClass && trClass.indexOf("productListing") > -1 && productTrs.push(trs[t])
4706 }
4707 for (var pt = 0; pt < productTrs.length; pt++) {
4708 var p = productTrs[pt],
4709 item = {};
4710 item.product_id = p.children[4].children[1].getAttribute("value"), item.product_id.indexOf("{") > -1 && (item.product_id = item.product_id.substring(0, item.product_id.indexOf("{"))), item.product_name = replaceArray(p.children[2].innerText, ["\n"], [" "]).trim(), item.product_url = p.children[2].children[0].getAttribute("href"), item.product_img = "/" + p.children[1].children[0].children[0].getAttribute("src"), item.quantity = parseInt(p.children[4].children[0].children[1].getAttribute("value")), item.sum = parseFloat(replaceArray(p.children[6].innerText, ["zł", ",", " "], ["", ".", ""]).trim()), items.push(item)
4711 }
4712 return items
4713 },
4714 getOrderDetails = function() {
4715 return {}
4716 };
4717 module.exports = {
4718 getProductId: function() {
4719 return getTagAttrValueByKeyValue("input", "value", "name", "products_id")
4720 },
4721 getProductName: function() {
4722 return getMetaValue("og:title")
4723 },
4724 getProductUrl: function() {
4725 return getMetaValue("og:url")
4726 },
4727 getProductImageUrl: function() {
4728 return getMetaValue("og:image")
4729 },
4730 saveCart: function() {
4731 return saveData("trustisto_cart", getCart())
4732 },
4733 saveOrderDetails: function() {
4734 return saveData("trustisto_order_details", getOrderDetails())
4735 },
4736 callBuy: function() {
4737 for (var cart = retriveData("trustisto_cart"), o = 0; o < cart.length; o++) {
4738 var item = cart[o];
4739 SP.go("buyProduct", item.product_id, {
4740 product: item.product_name,
4741 link: item.product_url,
4742 image: item.product_img,
4743 quantity: item.quantity,
4744 price: item.sum / item.quantity,
4745 sum: item.sum
4746 })
4747 }
4748 return !0
4749 },
4750 callNewBuy: function() {
4751 for (var cart = retriveData("trustisto_cart"), o = 0; o < cart.length; o++) {
4752 var item = cart[o];
4753 SP.go("push", "buy", {
4754 productId: item.product_id,
4755 product: item.product_name,
4756 link: item.product_url,
4757 image: item.product_img,
4758 quantity: item.quantity,
4759 price: item.sum / item.quantity,
4760 sum: item.sum
4761 })
4762 }
4763 return !0
4764 }
4765 }
4766}, function(module, exports) {
4767 var g;
4768 g = function() {
4769 return this
4770 }();
4771 try {
4772 g = g || Function("return this")() || (0, eval)("this")
4773 } catch (e) {
4774 "object" == typeof window && (g = window)
4775 }
4776 module.exports = g
4777}, function(module, exports, __webpack_require__) {
4778 "use strict";
4779
4780 function _interopRequireDefault(obj) {
4781 return obj && obj.__esModule ? obj : {
4782 default: obj
4783 }
4784 }
4785 __webpack_require__(42), __webpack_require__(43), __webpack_require__(45), __webpack_require__(44), __webpack_require__(47), __webpack_require__(46), __webpack_require__(48);
4786 var _plugin = __webpack_require__(22),
4787 _plugin2 = _interopRequireDefault(_plugin),
4788 _configuration = __webpack_require__(19),
4789 _configuration2 = _interopRequireDefault(_configuration),
4790 _xhr = __webpack_require__(2),
4791 _xhr2 = _interopRequireDefault(_xhr),
4792 _doc_cookies = __webpack_require__(3),
4793 _doc_cookies2 = _interopRequireDefault(_doc_cookies),
4794 _query_params = __webpack_require__(4),
4795 _query_params2 = _interopRequireDefault(_query_params),
4796 _capping = __webpack_require__(7),
4797 _capping2 = _interopRequireDefault(_capping),
4798 _ev = __webpack_require__(12),
4799 _ev2 = _interopRequireDefault(_ev),
4800 _static = __webpack_require__(1),
4801 _static2 = _interopRequireDefault(_static),
4802 _platforms = __webpack_require__(41),
4803 _platforms2 = _interopRequireDefault(_platforms),
4804 _events = __webpack_require__(27),
4805 _events2 = _interopRequireDefault(_events),
4806 _deprecated = __webpack_require__(26),
4807 _deprecated2 = _interopRequireDefault(_deprecated),
4808 _tracking = __webpack_require__(40),
4809 _tracking2 = _interopRequireDefault(_tracking),
4810 _deprecated3 = __webpack_require__(39),
4811 _deprecated4 = _interopRequireDefault(_deprecated3),
4812 _notifications = __webpack_require__(32),
4813 _notifications2 = _interopRequireDefault(_notifications),
4814 _deprecated5 = __webpack_require__(31),
4815 _deprecated6 = _interopRequireDefault(_deprecated5),
4816 _inspector = __webpack_require__(30),
4817 _inspector2 = _interopRequireDefault(_inspector),
4818 _ga = __webpack_require__(29),
4819 _ga2 = _interopRequireDefault(_ga),
4820 _abtests = __webpack_require__(25),
4821 _abtests2 = _interopRequireDefault(_abtests),
4822 _tabticker = __webpack_require__(36),
4823 _tabticker2 = _interopRequireDefault(_tabticker),
4824 _tagmanager = __webpack_require__(37),
4825 _tagmanager2 = _interopRequireDefault(_tagmanager),
4826 _popups = __webpack_require__(33),
4827 _popups2 = _interopRequireDefault(_popups),
4828 _topbar = __webpack_require__(38),
4829 _topbar2 = _interopRequireDefault(_topbar),
4830 _events_custom = __webpack_require__(28),
4831 _events_custom2 = _interopRequireDefault(_events_custom),
4832 _select_tool = __webpack_require__(34),
4833 _select_tool2 = _interopRequireDefault(_select_tool),
4834 _session = __webpack_require__(35),
4835 _session2 = _interopRequireDefault(_session);
4836 ! function() {
4837 window.SPR || (window.SPR = !0, window.SP = {
4838 initializing: !1,
4839 initialiazed: !1,
4840 url: window.SPT.u || "",
4841 location: null,
4842 schema: document.location.host.indexOf(".local") > -1 ? "http:" : "https:",
4843 appId: null,
4844 appInfo: null,
4845 uid: null,
4846 userInfo: null,
4847 configuration: null,
4848 logEnabled: !1,
4849 modulesInitializers: [],
4850 triggerListeners: [],
4851 version: "6.0.0",
4852 init: function(appId, callback) {
4853 var _this = this;
4854 if (!window.SP.initializing && !window.SP.initialiazed) {
4855 window.SP.initializing = !0, this.location = new URL(document.location.href), ((0, _query_params2.default)("trustisto-log") || _doc_cookies2.default.getItem("trustisto_log")) && (this.logEnabled = !0, _doc_cookies2.default.setItem("trustisto_log", 1, 31536e3, "/")), window.SP.log("BASE Hello Trustisto. JS libary version: " + this.version);
4856 var cleanAppId = appId.replace(/\s/g, ""),
4857 uid = this.getUID();
4858 window.SP.log("BASE Loading appinfo..."), this.getAppInfoCall(cleanAppId, uid, function(appInfo, userInfo) {
4859 window.SP.log("BASE APPINFO", appInfo), window.SP.log("BASE USERINFO", userInfo), _this.appId = appInfo.id, _this.uid = userInfo.uid, _this.appInfo = appInfo, _this.userInfo = userInfo, _this.setUID(userInfo.uid), _this.configuration = new _configuration2.default(_this.url), window.SP.log("BASE Loading configuration..."), _this.configuration.download(appInfo.config, function() {
4860 if (window.SP.log("BASE CONFIGURATION", _this.configuration.config), _capping2.default.migrateCapping(), _this.initialiazed = !0, _this.initializing = !1, _this.modulesInitializers.forEach(function(f) {
4861 return f()
4862 }), window.SPT.eq)
4863 for (var i = 0; i < window.SPT.eq.length; i++) window.SP.go.apply(window.SP, window.SPT.eq[i]);
4864 _this.advertise(), callback && callback()
4865 })
4866 })
4867 }
4868 },
4869 go: function() {
4870 var args = Array.prototype.slice.call(arguments);
4871 return this[args[0]].apply(this, args.slice(1))
4872 },
4873 q: function(args) {
4874 (window.SPT.eq = window.SPT.eq || []).push(args)
4875 },
4876 getAppInfoCall: function(appId, uid, callback) {
4877 var a = new _xhr2.default;
4878 a.sendRequest(window.SP.schema + "//api" + this.url + "/app/" + appId + "?uid=" + (uid || "") + "&ab=" + this.ab.value, function(req, error) {
4879 if (error) window.SP.error("No appinfo found! Is website published?");
4880 else {
4881 var response = JSON.parse(req.responseText);
4882 callback(response.app, response.user)
4883 }
4884 })
4885 },
4886 setUID: function(uid) {
4887 if (_doc_cookies2.default.setItem(_static2.default.UID_COOKIE_NAME, uid, _static2.default.UID_COOKIE_TIME, "/"), localStorage) {
4888 var client = JSON.parse(localStorage.getItem(_static2.default.LS_CLIENT_KEY));
4889 client = Object.assign(client || {}, {
4890 uid: uid
4891 }), localStorage.setItem(_static2.default.LS_CLIENT_KEY, JSON.stringify(client))
4892 }
4893 },
4894 getUID: function() {
4895 var uid = _doc_cookies2.default.getItem(_static2.default.UID_COOKIE_NAME);
4896 if (!uid && localStorage) {
4897 var client = JSON.parse(localStorage.getItem(_static2.default.LS_CLIENT_KEY));
4898 uid = client ? client.uid : null
4899 }
4900 return uid
4901 },
4902 trigger: function(triggeredType, params) {
4903 this.initialiazed && (window.SP.log("BASE CALL TRIGGER " + triggeredType, params), this.triggerListeners.forEach(function(listener) {
4904 return listener([triggeredType], params)
4905 }))
4906 },
4907 triggerMulti: function(triggeredTypes, params) {
4908 this.initialiazed && (window.SP.log("BASE CALL TRIGGER MULTI", triggeredTypes), window.SP.log("BASE CALL TRIGGER MULTI PARAMS", params), this.triggerListeners.forEach(function(listener) {
4909 return listener(triggeredTypes, params)
4910 }))
4911 },
4912 advertise: function() {
4913 console.log("Hi! Nice to see you! Try our awesome socialproof widget at https://trustisto.com")
4914 },
4915 log: function(text) {
4916 var param = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : "";
4917 this.logEnabled && console.log("#TRUSTISTO LOG:", text, param)
4918 },
4919 warn: function(text) {
4920 var param = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : "";
4921 this.logEnabled && console.warn("#TRUSTISTO WARN:", text, param)
4922 },
4923 error: function(text) {
4924 var param = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : "";
4925 console.error("#TRUSTISTO ERROR:", text, param)
4926 }
4927 }, (0, _plugin2.default)(window.SP, (0, _ev2.default)(window.SP)), (0, _plugin2.default)(window.SP, _platforms2.default), (0, _plugin2.default)(window.SP, (0, _events2.default)(window.SP)), (0, _plugin2.default)(window.SP, (0, _deprecated2.default)(window.SP)), (0, _plugin2.default)(window.SP, (0, _tracking2.default)(window.SP)), (0, _plugin2.default)(window.SP, (0, _deprecated4.default)(window.SP)), (0, _plugin2.default)(window.SP, (0, _notifications2.default)(window.SP)), (0, _plugin2.default)(window.SP, (0, _deprecated6.default)(window.SP)), (0, _plugin2.default)(window.SP, (0, _inspector2.default)(window.SP)), (0, _plugin2.default)(window.SP, (0, _ga2.default)(window.SP)), (0, _plugin2.default)(window.SP, (0, _abtests2.default)(window.SP)), (0, _plugin2.default)(window.SP, (0, _tabticker2.default)(window.SP)), (0, _plugin2.default)(window.SP, (0, _tagmanager2.default)(window.SP)), (0, _plugin2.default)(window.SP, (0, _events_custom2.default)(window.SP)), (0, _plugin2.default)(window.SP, (0, _select_tool2.default)(window.SP)), (0, _plugin2.default)(window.SP, (0, _popups2.default)(window.SP)), (0, _plugin2.default)(window.SP, (0, _topbar2.default)(window.SP)), (0, _plugin2.default)(window.SP, (0, _session2.default)(window.SP)), window.SPT.ai && window.SP.init(window.SPT.ai, window.SPT.cb))
4928 }()
4929}]);