PluginProbe
HubSpot All-In-One Marketing – Forms, Popups, Live Chat / 11.0.31
HubSpot All-In-One Marketing – Forms, Popups, Live Chat v11.0.31
11.3.75 11.3.73 11.3.71 11.3.70 11.3.69 11.3.64 11.3.65 11.3.62 11.3.61 11.3.56 11.3.58 11.0.31 11.0.52 11.0.54 11.0.56 11.0.58 11.0.7 11.1.10 11.1.11 11.1.13 11.1.14 11.1.15 11.1.2 11.1.20 11.1.21 All 73 releases
leadin / build / reviewBanner.js

reviewBanner.js in HubSpot All-In-One Marketing – Forms, Popups, Live Chat 11.0.31, at build/reviewBanner.js

3,711 lines 117.8 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 /******/ (() => { // webpackBootstrap
2 /******/ var __webpack_modules__ = ({
3
4 /***/ "./scripts/constants/leadinConfig.ts":
5 /*!*******************************************!*\
6 !*** ./scripts/constants/leadinConfig.ts ***!
7 \*******************************************/
8 /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
9
10 "use strict";
11 __webpack_require__.r(__webpack_exports__);
12 /* harmony export */ __webpack_require__.d(__webpack_exports__, {
13 /* harmony export */ "accountName": () => (/* binding */ accountName),
14 /* harmony export */ "activationTime": () => (/* binding */ activationTime),
15 /* harmony export */ "adminUrl": () => (/* binding */ adminUrl),
16 /* harmony export */ "connectionStatus": () => (/* binding */ connectionStatus),
17 /* harmony export */ "deviceId": () => (/* binding */ deviceId),
18 /* harmony export */ "didDisconnect": () => (/* binding */ didDisconnect),
19 /* harmony export */ "env": () => (/* binding */ env),
20 /* harmony export */ "formsScript": () => (/* binding */ formsScript),
21 /* harmony export */ "formsScriptPayload": () => (/* binding */ formsScriptPayload),
22 /* harmony export */ "hublet": () => (/* binding */ hublet),
23 /* harmony export */ "hubspotBaseUrl": () => (/* binding */ hubspotBaseUrl),
24 /* harmony export */ "hubspotNonce": () => (/* binding */ hubspotNonce),
25 /* harmony export */ "iframeUrl": () => (/* binding */ iframeUrl),
26 /* harmony export */ "impactLink": () => (/* binding */ impactLink),
27 /* harmony export */ "leadinPluginVersion": () => (/* binding */ leadinPluginVersion),
28 /* harmony export */ "leadinQueryParams": () => (/* binding */ leadinQueryParams),
29 /* harmony export */ "locale": () => (/* binding */ locale),
30 /* harmony export */ "loginUrl": () => (/* binding */ loginUrl),
31 /* harmony export */ "meetingsScript": () => (/* binding */ meetingsScript),
32 /* harmony export */ "phpVersion": () => (/* binding */ phpVersion),
33 /* harmony export */ "pluginPath": () => (/* binding */ pluginPath),
34 /* harmony export */ "plugins": () => (/* binding */ plugins),
35 /* harmony export */ "portalDomain": () => (/* binding */ portalDomain),
36 /* harmony export */ "portalEmail": () => (/* binding */ portalEmail),
37 /* harmony export */ "portalId": () => (/* binding */ portalId),
38 /* harmony export */ "redirectNonce": () => (/* binding */ redirectNonce),
39 /* harmony export */ "refreshToken": () => (/* binding */ refreshToken),
40 /* harmony export */ "restNonce": () => (/* binding */ restNonce),
41 /* harmony export */ "restUrl": () => (/* binding */ restUrl),
42 /* harmony export */ "reviewSkippedDate": () => (/* binding */ reviewSkippedDate),
43 /* harmony export */ "theme": () => (/* binding */ theme),
44 /* harmony export */ "trackConsent": () => (/* binding */ trackConsent),
45 /* harmony export */ "wpVersion": () => (/* binding */ wpVersion)
46 /* harmony export */ });
47 var _window$leadinConfig = window.leadinConfig,
48 accountName = _window$leadinConfig.accountName,
49 adminUrl = _window$leadinConfig.adminUrl,
50 activationTime = _window$leadinConfig.activationTime,
51 connectionStatus = _window$leadinConfig.connectionStatus,
52 deviceId = _window$leadinConfig.deviceId,
53 didDisconnect = _window$leadinConfig.didDisconnect,
54 env = _window$leadinConfig.env,
55 formsScript = _window$leadinConfig.formsScript,
56 meetingsScript = _window$leadinConfig.meetingsScript,
57 formsScriptPayload = _window$leadinConfig.formsScriptPayload,
58 hublet = _window$leadinConfig.hublet,
59 hubspotBaseUrl = _window$leadinConfig.hubspotBaseUrl,
60 hubspotNonce = _window$leadinConfig.hubspotNonce,
61 iframeUrl = _window$leadinConfig.iframeUrl,
62 impactLink = _window$leadinConfig.impactLink,
63 leadinPluginVersion = _window$leadinConfig.leadinPluginVersion,
64 leadinQueryParams = _window$leadinConfig.leadinQueryParams,
65 locale = _window$leadinConfig.locale,
66 loginUrl = _window$leadinConfig.loginUrl,
67 phpVersion = _window$leadinConfig.phpVersion,
68 pluginPath = _window$leadinConfig.pluginPath,
69 plugins = _window$leadinConfig.plugins,
70 portalDomain = _window$leadinConfig.portalDomain,
71 portalEmail = _window$leadinConfig.portalEmail,
72 portalId = _window$leadinConfig.portalId,
73 redirectNonce = _window$leadinConfig.redirectNonce,
74 restNonce = _window$leadinConfig.restNonce,
75 restUrl = _window$leadinConfig.restUrl,
76 refreshToken = _window$leadinConfig.refreshToken,
77 reviewSkippedDate = _window$leadinConfig.reviewSkippedDate,
78 theme = _window$leadinConfig.theme,
79 trackConsent = _window$leadinConfig.trackConsent,
80 wpVersion = _window$leadinConfig.wpVersion;
81
82
83 /***/ }),
84
85 /***/ "./scripts/constants/selectors.ts":
86 /*!****************************************!*\
87 !*** ./scripts/constants/selectors.ts ***!
88 \****************************************/
89 /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
90
91 "use strict";
92 __webpack_require__.r(__webpack_exports__);
93 /* harmony export */ __webpack_require__.d(__webpack_exports__, {
94 /* harmony export */ "domElements": () => (/* binding */ domElements)
95 /* harmony export */ });
96 var domElements = {
97 iframe: '#leadin-iframe',
98 subMenu: '.toplevel_page_leadin > ul',
99 subMenuLinks: '.toplevel_page_leadin > ul a',
100 subMenuButtons: '.toplevel_page_leadin > ul > li',
101 deactivatePluginButton: '[data-slug="leadin"] .deactivate a',
102 deactivateFeedbackForm: 'form.leadin-deactivate-form',
103 deactivateFeedbackSubmit: 'button#leadin-feedback-submit',
104 deactivateFeedbackSkip: 'button#leadin-feedback-skip',
105 thickboxModalClose: '.leadin-modal-close',
106 thickboxModalWindow: 'div#TB_window.thickbox-loading',
107 thickboxModalContent: 'div#TB_ajaxContent.TB_modal',
108 reviewBannerContainer: '#leadin-review-banner',
109 reviewBannerLeaveReviewLink: 'a#leave-review-button',
110 reviewBannerDismissButton: 'a#dismiss-review-banner-button',
111 leadinIframeContainer: 'leadin-iframe-container',
112 leadinIframe: 'leadin-iframe',
113 leadinIframeFallbackContainer: 'leadin-iframe-fallback-container'
114 };
115
116 /***/ }),
117
118 /***/ "./scripts/iframe/integratedMessages/core/CoreMessages.ts":
119 /*!****************************************************************!*\
120 !*** ./scripts/iframe/integratedMessages/core/CoreMessages.ts ***!
121 \****************************************************************/
122 /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
123
124 "use strict";
125 __webpack_require__.r(__webpack_exports__);
126 /* harmony export */ __webpack_require__.d(__webpack_exports__, {
127 /* harmony export */ "CoreMessages": () => (/* binding */ CoreMessages)
128 /* harmony export */ });
129 var CoreMessages = {
130 HandshakeReceive: 'INTEGRATED_APP_EMBEDDER_HANDSHAKE_RECEIVED',
131 SendRefreshToken: 'INTEGRATED_APP_EMBEDDER_SEND_REFRESH_TOKEN',
132 ReloadParentFrame: 'INTEGRATED_APP_EMBEDDER_RELOAD_PARENT_FRAME',
133 RedirectParentFrame: 'INTEGRATED_APP_EMBEDDER_REDIRECT_PARENT_FRAME',
134 SendLocale: 'INTEGRATED_APP_EMBEDDER_SEND_LOCALE',
135 SendDeviceId: 'INTEGRATED_APP_EMBEDDER_SEND_DEVICE_ID'
136 };
137
138 /***/ }),
139
140 /***/ "./scripts/iframe/integratedMessages/forms/FormsMessages.ts":
141 /*!******************************************************************!*\
142 !*** ./scripts/iframe/integratedMessages/forms/FormsMessages.ts ***!
143 \******************************************************************/
144 /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
145
146 "use strict";
147 __webpack_require__.r(__webpack_exports__);
148 /* harmony export */ __webpack_require__.d(__webpack_exports__, {
149 /* harmony export */ "FormMessages": () => (/* binding */ FormMessages)
150 /* harmony export */ });
151 var FormMessages = {
152 CreateFormAppNavigation: 'CREATE_FORM_APP_NAVIGATION'
153 };
154
155 /***/ }),
156
157 /***/ "./scripts/iframe/integratedMessages/index.ts":
158 /*!****************************************************!*\
159 !*** ./scripts/iframe/integratedMessages/index.ts ***!
160 \****************************************************/
161 /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
162
163 "use strict";
164 __webpack_require__.r(__webpack_exports__);
165 /* harmony export */ __webpack_require__.d(__webpack_exports__, {
166 /* harmony export */ "CoreMessages": () => (/* reexport safe */ _core_CoreMessages__WEBPACK_IMPORTED_MODULE_0__.CoreMessages),
167 /* harmony export */ "FormMessages": () => (/* reexport safe */ _forms_FormsMessages__WEBPACK_IMPORTED_MODULE_1__.FormMessages),
168 /* harmony export */ "LiveChatMessages": () => (/* reexport safe */ _livechat_LiveChatMessages__WEBPACK_IMPORTED_MODULE_2__.LiveChatMessages),
169 /* harmony export */ "PluginMessages": () => (/* reexport safe */ _plugin_PluginMessages__WEBPACK_IMPORTED_MODULE_3__.PluginMessages),
170 /* harmony export */ "ProxyMessages": () => (/* reexport safe */ _proxy_ProxyMessages__WEBPACK_IMPORTED_MODULE_4__.ProxyMessages)
171 /* harmony export */ });
172 /* harmony import */ var _core_CoreMessages__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./core/CoreMessages */ "./scripts/iframe/integratedMessages/core/CoreMessages.ts");
173 /* harmony import */ var _forms_FormsMessages__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./forms/FormsMessages */ "./scripts/iframe/integratedMessages/forms/FormsMessages.ts");
174 /* harmony import */ var _livechat_LiveChatMessages__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./livechat/LiveChatMessages */ "./scripts/iframe/integratedMessages/livechat/LiveChatMessages.ts");
175 /* harmony import */ var _plugin_PluginMessages__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./plugin/PluginMessages */ "./scripts/iframe/integratedMessages/plugin/PluginMessages.ts");
176 /* harmony import */ var _proxy_ProxyMessages__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./proxy/ProxyMessages */ "./scripts/iframe/integratedMessages/proxy/ProxyMessages.ts");
177
178
179
180
181
182
183 /***/ }),
184
185 /***/ "./scripts/iframe/integratedMessages/livechat/LiveChatMessages.ts":
186 /*!************************************************************************!*\
187 !*** ./scripts/iframe/integratedMessages/livechat/LiveChatMessages.ts ***!
188 \************************************************************************/
189 /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
190
191 "use strict";
192 __webpack_require__.r(__webpack_exports__);
193 /* harmony export */ __webpack_require__.d(__webpack_exports__, {
194 /* harmony export */ "LiveChatMessages": () => (/* binding */ LiveChatMessages)
195 /* harmony export */ });
196 var LiveChatMessages = {
197 CreateLiveChatAppNavigation: 'CREATE_LIVE_CHAT_APP_NAVIGATION'
198 };
199
200 /***/ }),
201
202 /***/ "./scripts/iframe/integratedMessages/plugin/PluginMessages.ts":
203 /*!********************************************************************!*\
204 !*** ./scripts/iframe/integratedMessages/plugin/PluginMessages.ts ***!
205 \********************************************************************/
206 /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
207
208 "use strict";
209 __webpack_require__.r(__webpack_exports__);
210 /* harmony export */ __webpack_require__.d(__webpack_exports__, {
211 /* harmony export */ "PluginMessages": () => (/* binding */ PluginMessages)
212 /* harmony export */ });
213 var PluginMessages = {
214 PluginSettingsNavigation: 'PLUGIN_SETTINGS_NAVIGATION',
215 PluginLeadinConfig: 'PLUGIN_LEADIN_CONFIG',
216 TrackConsent: 'INTEGRATED_APP_EMBEDDER_TRACK_CONSENT',
217 InternalTrackingFetchRequest: 'INTEGRATED_TRACKING_FETCH_REQUEST',
218 InternalTrackingFetchResponse: 'INTEGRATED_TRACKING_FETCH_RESPONSE',
219 InternalTrackingFetchError: 'INTEGRATED_TRACKING_FETCH_ERROR',
220 InternalTrackingChangeRequest: 'INTEGRATED_TRACKING_CHANGE_REQUEST',
221 InternalTrackingChangeError: 'INTEGRATED_TRACKING_CHANGE_ERROR',
222 BusinessUnitFetchRequest: 'BUSINESS_UNIT_FETCH_REQUEST',
223 BusinessUnitFetchResponse: 'BUSINESS_UNIT_FETCH_FETCH_RESPONSE',
224 BusinessUnitFetchError: 'BUSINESS_UNIT_FETCH_FETCH_ERROR',
225 BusinessUnitChangeRequest: 'BUSINESS_UNIT_CHANGE_REQUEST',
226 BusinessUnitChangeError: 'BUSINESS_UNIT_CHANGE_ERROR',
227 SkipReviewRequest: 'SKIP_REVIEW_REQUEST',
228 SkipReviewResponse: 'SKIP_REVIEW_RESPONSE',
229 SkipReviewError: 'SKIP_REVIEW_ERROR',
230 RemoveParentQueryParam: 'REMOVE_PARENT_QUERY_PARAM'
231 };
232
233 /***/ }),
234
235 /***/ "./scripts/iframe/integratedMessages/proxy/ProxyMessages.ts":
236 /*!******************************************************************!*\
237 !*** ./scripts/iframe/integratedMessages/proxy/ProxyMessages.ts ***!
238 \******************************************************************/
239 /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
240
241 "use strict";
242 __webpack_require__.r(__webpack_exports__);
243 /* harmony export */ __webpack_require__.d(__webpack_exports__, {
244 /* harmony export */ "ProxyMessages": () => (/* binding */ ProxyMessages)
245 /* harmony export */ });
246 var ProxyMessages = {
247 FetchForms: 'FETCH_FORMS',
248 FetchForm: 'FETCH_FORM',
249 CreateFormFromTemplate: 'CREATE_FORM_FROM_TEMPLATE',
250 FetchAuth: 'FETCH_AUTH',
251 FetchMeetingsAndUsers: 'FETCH_MEETINGS_AND_USERS',
252 FetchContactsCreateSinceActivation: 'FETCH_CONTACTS_CREATED_SINCE_ACTIVATION',
253 FetchOrCreateMeetingUser: 'FETCH_OR_CREATE_MEETING_USER',
254 ConnectMeetingsCalendar: 'CONNECT_MEETINGS_CALENDAR',
255 TrackFormPreviewRender: 'TRACK_FORM_PREVIEW_RENDER',
256 TrackFormCreatedFromTemplate: 'TRACK_FORM_CREATED_FROM_TEMPLATE',
257 TrackFormCreationFailed: 'TRACK_FORM_CREATION_FAILED',
258 TrackMeetingPreviewRender: 'TRACK_MEETING_PREVIEW_RENDER',
259 TrackSidebarMetaChange: 'TRACK_SIDEBAR_META_CHANGE',
260 TrackReviewBannerRender: 'TRACK_REVIEW_BANNER_RENDER',
261 TrackReviewBannerInteraction: 'TRACK_REVIEW_BANNER_INTERACTION',
262 TrackReviewBannerDismissed: 'TRACK_REVIEW_BANNER_DISMISSED',
263 TrackPluginDeactivation: 'TRACK_PLUGIN_DEACTIVATION'
264 };
265
266 /***/ }),
267
268 /***/ "./scripts/lib/Raven.ts":
269 /*!******************************!*\
270 !*** ./scripts/lib/Raven.ts ***!
271 \******************************/
272 /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
273
274 "use strict";
275 __webpack_require__.r(__webpack_exports__);
276 /* harmony export */ __webpack_require__.d(__webpack_exports__, {
277 /* harmony export */ "configureRaven": () => (/* binding */ configureRaven),
278 /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
279 /* harmony export */ });
280 /* harmony import */ var raven_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! raven-js */ "./node_modules/raven-js/src/singleton.js");
281 /* harmony import */ var raven_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(raven_js__WEBPACK_IMPORTED_MODULE_0__);
282 /* harmony import */ var _constants_leadinConfig__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../constants/leadinConfig */ "./scripts/constants/leadinConfig.ts");
283
284
285 function configureRaven() {
286 if (_constants_leadinConfig__WEBPACK_IMPORTED_MODULE_1__.hubspotBaseUrl.indexOf('app.hubspot.com') === -1) {
287 return;
288 }
289
290 raven_js__WEBPACK_IMPORTED_MODULE_0___default().config('https://e9b8f382cdd130c0d415cd977d2be56f@exceptions.hubspot.com/1', {
291 instrument: {
292 tryCatch: false
293 },
294 release: _constants_leadinConfig__WEBPACK_IMPORTED_MODULE_1__.leadinPluginVersion
295 }).install();
296 raven_js__WEBPACK_IMPORTED_MODULE_0___default().setTagsContext({
297 v: _constants_leadinConfig__WEBPACK_IMPORTED_MODULE_1__.leadinPluginVersion,
298 php: _constants_leadinConfig__WEBPACK_IMPORTED_MODULE_1__.phpVersion,
299 wordpress: _constants_leadinConfig__WEBPACK_IMPORTED_MODULE_1__.wpVersion
300 });
301 raven_js__WEBPACK_IMPORTED_MODULE_0___default().setExtraContext({
302 hub: _constants_leadinConfig__WEBPACK_IMPORTED_MODULE_1__.portalId,
303 plugins: Object.keys(_constants_leadinConfig__WEBPACK_IMPORTED_MODULE_1__.plugins).map(function (name) {
304 return "".concat(name, "#").concat(_constants_leadinConfig__WEBPACK_IMPORTED_MODULE_1__.plugins[name]);
305 }).join(',')
306 });
307 }
308 /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ((raven_js__WEBPACK_IMPORTED_MODULE_0___default()));
309
310 /***/ }),
311
312 /***/ "./scripts/utils/appUtils.ts":
313 /*!***********************************!*\
314 !*** ./scripts/utils/appUtils.ts ***!
315 \***********************************/
316 /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
317
318 "use strict";
319 __webpack_require__.r(__webpack_exports__);
320 /* harmony export */ __webpack_require__.d(__webpack_exports__, {
321 /* harmony export */ "initApp": () => (/* binding */ initApp),
322 /* harmony export */ "initAppOnReady": () => (/* binding */ initAppOnReady)
323 /* harmony export */ });
324 /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! jquery */ "jquery");
325 /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(jquery__WEBPACK_IMPORTED_MODULE_0__);
326 /* harmony import */ var _lib_Raven__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../lib/Raven */ "./scripts/lib/Raven.ts");
327
328
329 function initApp(initFn) {
330 (0,_lib_Raven__WEBPACK_IMPORTED_MODULE_1__.configureRaven)();
331 _lib_Raven__WEBPACK_IMPORTED_MODULE_1__["default"].context(initFn);
332 }
333 function initAppOnReady(initFn) {
334 function main() {
335 jquery__WEBPACK_IMPORTED_MODULE_0___default()(initFn);
336 }
337
338 initApp(main);
339 }
340
341 /***/ }),
342
343 /***/ "./scripts/utils/backgroundAppUtils.ts":
344 /*!*********************************************!*\
345 !*** ./scripts/utils/backgroundAppUtils.ts ***!
346 \*********************************************/
347 /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
348
349 "use strict";
350 __webpack_require__.r(__webpack_exports__);
351 /* harmony export */ __webpack_require__.d(__webpack_exports__, {
352 /* harmony export */ "getOrCreateBackgroundApp": () => (/* binding */ getOrCreateBackgroundApp),
353 /* harmony export */ "initBackgroundApp": () => (/* binding */ initBackgroundApp)
354 /* harmony export */ });
355 /* harmony import */ var _constants_leadinConfig__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../constants/leadinConfig */ "./scripts/constants/leadinConfig.ts");
356 /* harmony import */ var _appUtils__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./appUtils */ "./scripts/utils/appUtils.ts");
357
358
359 function initBackgroundApp(initFn) {
360 function main() {
361 if (Array.isArray(initFn)) {
362 initFn.forEach(function (callback) {
363 return callback();
364 });
365 } else {
366 initFn();
367 }
368 }
369
370 (0,_appUtils__WEBPACK_IMPORTED_MODULE_1__.initApp)(main);
371 }
372 var getOrCreateBackgroundApp = function getOrCreateBackgroundApp(refreshToken) {
373 if (window.LeadinBackgroundApp) {
374 return window.LeadinBackgroundApp;
375 }
376
377 var _window = window,
378 IntegratedAppEmbedder = _window.IntegratedAppEmbedder,
379 IntegratedAppOptions = _window.IntegratedAppOptions;
380 var options = new IntegratedAppOptions().setLocale(_constants_leadinConfig__WEBPACK_IMPORTED_MODULE_0__.locale).setDeviceId(_constants_leadinConfig__WEBPACK_IMPORTED_MODULE_0__.deviceId).setRefreshToken(refreshToken);
381 var embedder = new IntegratedAppEmbedder('integrated-plugin-proxy', _constants_leadinConfig__WEBPACK_IMPORTED_MODULE_0__.portalId, _constants_leadinConfig__WEBPACK_IMPORTED_MODULE_0__.hubspotBaseUrl, function () {}).setOptions(options);
382 embedder.attachTo(document.body, false);
383 embedder.postStartAppMessage(); // lets the app know all all data has been passed to it
384
385 window.LeadinBackgroundApp = embedder;
386 return window.LeadinBackgroundApp;
387 };
388
389 /***/ }),
390
391 /***/ "./node_modules/raven-js/src/configError.js":
392 /*!**************************************************!*\
393 !*** ./node_modules/raven-js/src/configError.js ***!
394 \**************************************************/
395 /***/ ((module) => {
396
397 function RavenConfigError(message) {
398 this.name = 'RavenConfigError';
399 this.message = message;
400 }
401 RavenConfigError.prototype = new Error();
402 RavenConfigError.prototype.constructor = RavenConfigError;
403
404 module.exports = RavenConfigError;
405
406
407 /***/ }),
408
409 /***/ "./node_modules/raven-js/src/console.js":
410 /*!**********************************************!*\
411 !*** ./node_modules/raven-js/src/console.js ***!
412 \**********************************************/
413 /***/ ((module) => {
414
415 var wrapMethod = function(console, level, callback) {
416 var originalConsoleLevel = console[level];
417 var originalConsole = console;
418
419 if (!(level in console)) {
420 return;
421 }
422
423 var sentryLevel = level === 'warn' ? 'warning' : level;
424
425 console[level] = function() {
426 var args = [].slice.call(arguments);
427
428 var msg = '' + args.join(' ');
429 var data = {level: sentryLevel, logger: 'console', extra: {arguments: args}};
430
431 if (level === 'assert') {
432 if (args[0] === false) {
433 // Default browsers message
434 msg = 'Assertion failed: ' + (args.slice(1).join(' ') || 'console.assert');
435 data.extra.arguments = args.slice(1);
436 callback && callback(msg, data);
437 }
438 } else {
439 callback && callback(msg, data);
440 }
441
442 // this fails for some browsers. :(
443 if (originalConsoleLevel) {
444 // IE9 doesn't allow calling apply on console functions directly
445 // See: https://stackoverflow.com/questions/5472938/does-ie9-support-console-log-and-is-it-a-real-function#answer-5473193
446 Function.prototype.apply.call(originalConsoleLevel, originalConsole, args);
447 }
448 };
449 };
450
451 module.exports = {
452 wrapMethod: wrapMethod
453 };
454
455
456 /***/ }),
457
458 /***/ "./node_modules/raven-js/src/raven.js":
459 /*!********************************************!*\
460 !*** ./node_modules/raven-js/src/raven.js ***!
461 \********************************************/
462 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
463
464 /*global XDomainRequest:false */
465
466 var TraceKit = __webpack_require__(/*! ../vendor/TraceKit/tracekit */ "./node_modules/raven-js/vendor/TraceKit/tracekit.js");
467 var stringify = __webpack_require__(/*! ../vendor/json-stringify-safe/stringify */ "./node_modules/raven-js/vendor/json-stringify-safe/stringify.js");
468 var RavenConfigError = __webpack_require__(/*! ./configError */ "./node_modules/raven-js/src/configError.js");
469
470 var utils = __webpack_require__(/*! ./utils */ "./node_modules/raven-js/src/utils.js");
471 var isError = utils.isError;
472 var isObject = utils.isObject;
473 var isObject = utils.isObject;
474 var isErrorEvent = utils.isErrorEvent;
475 var isUndefined = utils.isUndefined;
476 var isFunction = utils.isFunction;
477 var isString = utils.isString;
478 var isEmptyObject = utils.isEmptyObject;
479 var each = utils.each;
480 var objectMerge = utils.objectMerge;
481 var truncate = utils.truncate;
482 var objectFrozen = utils.objectFrozen;
483 var hasKey = utils.hasKey;
484 var joinRegExp = utils.joinRegExp;
485 var urlencode = utils.urlencode;
486 var uuid4 = utils.uuid4;
487 var htmlTreeAsString = utils.htmlTreeAsString;
488 var isSameException = utils.isSameException;
489 var isSameStacktrace = utils.isSameStacktrace;
490 var parseUrl = utils.parseUrl;
491 var fill = utils.fill;
492
493 var wrapConsoleMethod = (__webpack_require__(/*! ./console */ "./node_modules/raven-js/src/console.js").wrapMethod);
494
495 var dsnKeys = 'source protocol user pass host port path'.split(' '),
496 dsnPattern = /^(?:(\w+):)?\/\/(?:(\w+)(:\w+)?@)?([\w\.-]+)(?::(\d+))?(\/.*)/;
497
498 function now() {
499 return +new Date();
500 }
501
502 // This is to be defensive in environments where window does not exist (see https://github.com/getsentry/raven-js/pull/785)
503 var _window =
504 typeof window !== 'undefined'
505 ? window
506 : typeof __webpack_require__.g !== 'undefined' ? __webpack_require__.g : typeof self !== 'undefined' ? self : {};
507 var _document = _window.document;
508 var _navigator = _window.navigator;
509
510 function keepOriginalCallback(original, callback) {
511 return isFunction(callback)
512 ? function(data) {
513 return callback(data, original);
514 }
515 : callback;
516 }
517
518 // First, check for JSON support
519 // If there is no JSON, we no-op the core features of Raven
520 // since JSON is required to encode the payload
521 function Raven() {
522 this._hasJSON = !!(typeof JSON === 'object' && JSON.stringify);
523 // Raven can run in contexts where there's no document (react-native)
524 this._hasDocument = !isUndefined(_document);
525 this._hasNavigator = !isUndefined(_navigator);
526 this._lastCapturedException = null;
527 this._lastData = null;
528 this._lastEventId = null;
529 this._globalServer = null;
530 this._globalKey = null;
531 this._globalProject = null;
532 this._globalContext = {};
533 this._globalOptions = {
534 logger: 'javascript',
535 ignoreErrors: [],
536 ignoreUrls: [],
537 whitelistUrls: [],
538 includePaths: [],
539 collectWindowErrors: true,
540 maxMessageLength: 0,
541
542 // By default, truncates URL values to 250 chars
543 maxUrlLength: 250,
544 stackTraceLimit: 50,
545 autoBreadcrumbs: true,
546 instrument: true,
547 sampleRate: 1
548 };
549 this._ignoreOnError = 0;
550 this._isRavenInstalled = false;
551 this._originalErrorStackTraceLimit = Error.stackTraceLimit;
552 // capture references to window.console *and* all its methods first
553 // before the console plugin has a chance to monkey patch
554 this._originalConsole = _window.console || {};
555 this._originalConsoleMethods = {};
556 this._plugins = [];
557 this._startTime = now();
558 this._wrappedBuiltIns = [];
559 this._breadcrumbs = [];
560 this._lastCapturedEvent = null;
561 this._keypressTimeout;
562 this._location = _window.location;
563 this._lastHref = this._location && this._location.href;
564 this._resetBackoff();
565
566 // eslint-disable-next-line guard-for-in
567 for (var method in this._originalConsole) {
568 this._originalConsoleMethods[method] = this._originalConsole[method];
569 }
570 }
571
572 /*
573 * The core Raven singleton
574 *
575 * @this {Raven}
576 */
577
578 Raven.prototype = {
579 // Hardcode version string so that raven source can be loaded directly via
580 // webpack (using a build step causes webpack #1617). Grunt verifies that
581 // this value matches package.json during build.
582 // See: https://github.com/getsentry/raven-js/issues/465
583 VERSION: '3.19.1',
584
585 debug: false,
586
587 TraceKit: TraceKit, // alias to TraceKit
588
589 /*
590 * Configure Raven with a DSN and extra options
591 *
592 * @param {string} dsn The public Sentry DSN
593 * @param {object} options Set of global options [optional]
594 * @return {Raven}
595 */
596 config: function(dsn, options) {
597 var self = this;
598
599 if (self._globalServer) {
600 this._logDebug('error', 'Error: Raven has already been configured');
601 return self;
602 }
603 if (!dsn) return self;
604
605 var globalOptions = self._globalOptions;
606
607 // merge in options
608 if (options) {
609 each(options, function(key, value) {
610 // tags and extra are special and need to be put into context
611 if (key === 'tags' || key === 'extra' || key === 'user') {
612 self._globalContext[key] = value;
613 } else {
614 globalOptions[key] = value;
615 }
616 });
617 }
618
619 self.setDSN(dsn);
620
621 // "Script error." is hard coded into browsers for errors that it can't read.
622 // this is the result of a script being pulled in from an external domain and CORS.
623 globalOptions.ignoreErrors.push(/^Script error\.?$/);
624 globalOptions.ignoreErrors.push(/^Javascript error: Script error\.? on line 0$/);
625
626 // join regexp rules into one big rule
627 globalOptions.ignoreErrors = joinRegExp(globalOptions.ignoreErrors);
628 globalOptions.ignoreUrls = globalOptions.ignoreUrls.length
629 ? joinRegExp(globalOptions.ignoreUrls)
630 : false;
631 globalOptions.whitelistUrls = globalOptions.whitelistUrls.length
632 ? joinRegExp(globalOptions.whitelistUrls)
633 : false;
634 globalOptions.includePaths = joinRegExp(globalOptions.includePaths);
635 globalOptions.maxBreadcrumbs = Math.max(
636 0,
637 Math.min(globalOptions.maxBreadcrumbs || 100, 100)
638 ); // default and hard limit is 100
639
640 var autoBreadcrumbDefaults = {
641 xhr: true,
642 console: true,
643 dom: true,
644 location: true
645 };
646
647 var autoBreadcrumbs = globalOptions.autoBreadcrumbs;
648 if ({}.toString.call(autoBreadcrumbs) === '[object Object]') {
649 autoBreadcrumbs = objectMerge(autoBreadcrumbDefaults, autoBreadcrumbs);
650 } else if (autoBreadcrumbs !== false) {
651 autoBreadcrumbs = autoBreadcrumbDefaults;
652 }
653 globalOptions.autoBreadcrumbs = autoBreadcrumbs;
654
655 var instrumentDefaults = {
656 tryCatch: true
657 };
658
659 var instrument = globalOptions.instrument;
660 if ({}.toString.call(instrument) === '[object Object]') {
661 instrument = objectMerge(instrumentDefaults, instrument);
662 } else if (instrument !== false) {
663 instrument = instrumentDefaults;
664 }
665 globalOptions.instrument = instrument;
666
667 TraceKit.collectWindowErrors = !!globalOptions.collectWindowErrors;
668
669 // return for chaining
670 return self;
671 },
672
673 /*
674 * Installs a global window.onerror error handler
675 * to capture and report uncaught exceptions.
676 * At this point, install() is required to be called due
677 * to the way TraceKit is set up.
678 *
679 * @return {Raven}
680 */
681 install: function() {
682 var self = this;
683 if (self.isSetup() && !self._isRavenInstalled) {
684 TraceKit.report.subscribe(function() {
685 self._handleOnErrorStackInfo.apply(self, arguments);
686 });
687 if (self._globalOptions.instrument && self._globalOptions.instrument.tryCatch) {
688 self._instrumentTryCatch();
689 }
690
691 if (self._globalOptions.autoBreadcrumbs) self._instrumentBreadcrumbs();
692
693 // Install all of the plugins
694 self._drainPlugins();
695
696 self._isRavenInstalled = true;
697 }
698
699 Error.stackTraceLimit = self._globalOptions.stackTraceLimit;
700 return this;
701 },
702
703 /*
704 * Set the DSN (can be called multiple time unlike config)
705 *
706 * @param {string} dsn The public Sentry DSN
707 */
708 setDSN: function(dsn) {
709 var self = this,
710 uri = self._parseDSN(dsn),
711 lastSlash = uri.path.lastIndexOf('/'),
712 path = uri.path.substr(1, lastSlash);
713
714 self._dsn = dsn;
715 self._globalKey = uri.user;
716 self._globalSecret = uri.pass && uri.pass.substr(1);
717 self._globalProject = uri.path.substr(lastSlash + 1);
718
719 self._globalServer = self._getGlobalServer(uri);
720
721 self._globalEndpoint =
722 self._globalServer + '/' + path + 'api/' + self._globalProject + '/store/';
723
724 // Reset backoff state since we may be pointing at a
725 // new project/server
726 this._resetBackoff();
727 },
728
729 /*
730 * Wrap code within a context so Raven can capture errors
731 * reliably across domains that is executed immediately.
732 *
733 * @param {object} options A specific set of options for this context [optional]
734 * @param {function} func The callback to be immediately executed within the context
735 * @param {array} args An array of arguments to be called with the callback [optional]
736 */
737 context: function(options, func, args) {
738 if (isFunction(options)) {
739 args = func || [];
740 func = options;
741 options = undefined;
742 }
743
744 return this.wrap(options, func).apply(this, args);
745 },
746
747 /*
748 * Wrap code within a context and returns back a new function to be executed
749 *
750 * @param {object} options A specific set of options for this context [optional]
751 * @param {function} func The function to be wrapped in a new context
752 * @param {function} func A function to call before the try/catch wrapper [optional, private]
753 * @return {function} The newly wrapped functions with a context
754 */
755 wrap: function(options, func, _before) {
756 var self = this;
757 // 1 argument has been passed, and it's not a function
758 // so just return it
759 if (isUndefined(func) && !isFunction(options)) {
760 return options;
761 }
762
763 // options is optional
764 if (isFunction(options)) {
765 func = options;
766 options = undefined;
767 }
768
769 // At this point, we've passed along 2 arguments, and the second one
770 // is not a function either, so we'll just return the second argument.
771 if (!isFunction(func)) {
772 return func;
773 }
774
775 // We don't wanna wrap it twice!
776 try {
777 if (func.__raven__) {
778 return func;
779 }
780
781 // If this has already been wrapped in the past, return that
782 if (func.__raven_wrapper__) {
783 return func.__raven_wrapper__;
784 }
785 } catch (e) {
786 // Just accessing custom props in some Selenium environments
787 // can cause a "Permission denied" exception (see raven-js#495).
788 // Bail on wrapping and return the function as-is (defers to window.onerror).
789 return func;
790 }
791
792 function wrapped() {
793 var args = [],
794 i = arguments.length,
795 deep = !options || (options && options.deep !== false);
796
797 if (_before && isFunction(_before)) {
798 _before.apply(this, arguments);
799 }
800
801 // Recursively wrap all of a function's arguments that are
802 // functions themselves.
803 while (i--) args[i] = deep ? self.wrap(options, arguments[i]) : arguments[i];
804
805 try {
806 // Attempt to invoke user-land function
807 // NOTE: If you are a Sentry user, and you are seeing this stack frame, it
808 // means Raven caught an error invoking your application code. This is
809 // expected behavior and NOT indicative of a bug with Raven.js.
810 return func.apply(this, args);
811 } catch (e) {
812 self._ignoreNextOnError();
813 self.captureException(e, options);
814 throw e;
815 }
816 }
817
818 // copy over properties of the old function
819 for (var property in func) {
820 if (hasKey(func, property)) {
821 wrapped[property] = func[property];
822 }
823 }
824 wrapped.prototype = func.prototype;
825
826 func.__raven_wrapper__ = wrapped;
827 // Signal that this function has been wrapped already
828 // for both debugging and to prevent it to being wrapped twice
829 wrapped.__raven__ = true;
830 wrapped.__inner__ = func;
831
832 return wrapped;
833 },
834
835 /*
836 * Uninstalls the global error handler.
837 *
838 * @return {Raven}
839 */
840 uninstall: function() {
841 TraceKit.report.uninstall();
842
843 this._restoreBuiltIns();
844
845 Error.stackTraceLimit = this._originalErrorStackTraceLimit;
846 this._isRavenInstalled = false;
847
848 return this;
849 },
850
851 /*
852 * Manually capture an exception and send it over to Sentry
853 *
854 * @param {error} ex An exception to be logged
855 * @param {object} options A specific set of options for this error [optional]
856 * @return {Raven}
857 */
858 captureException: function(ex, options) {
859 // Cases for sending ex as a message, rather than an exception
860 var isNotError = !isError(ex);
861 var isNotErrorEvent = !isErrorEvent(ex);
862 var isErrorEventWithoutError = isErrorEvent(ex) && !ex.error;
863
864 if ((isNotError && isNotErrorEvent) || isErrorEventWithoutError) {
865 return this.captureMessage(
866 ex,
867 objectMerge(
868 {
869 trimHeadFrames: 1,
870 stacktrace: true // if we fall back to captureMessage, default to attempting a new trace
871 },
872 options
873 )
874 );
875 }
876
877 // Get actual Error from ErrorEvent
878 if (isErrorEvent(ex)) ex = ex.error;
879
880 // Store the raw exception object for potential debugging and introspection
881 this._lastCapturedException = ex;
882
883 // TraceKit.report will re-raise any exception passed to it,
884 // which means you have to wrap it in try/catch. Instead, we
885 // can wrap it here and only re-raise if TraceKit.report
886 // raises an exception different from the one we asked to
887 // report on.
888 try {
889 var stack = TraceKit.computeStackTrace(ex);
890 this._handleStackInfo(stack, options);
891 } catch (ex1) {
892 if (ex !== ex1) {
893 throw ex1;
894 }
895 }
896
897 return this;
898 },
899
900 /*
901 * Manually send a message to Sentry
902 *
903 * @param {string} msg A plain message to be captured in Sentry
904 * @param {object} options A specific set of options for this message [optional]
905 * @return {Raven}
906 */
907 captureMessage: function(msg, options) {
908 // config() automagically converts ignoreErrors from a list to a RegExp so we need to test for an
909 // early call; we'll error on the side of logging anything called before configuration since it's
910 // probably something you should see:
911 if (
912 !!this._globalOptions.ignoreErrors.test &&
913 this._globalOptions.ignoreErrors.test(msg)
914 ) {
915 return;
916 }
917
918 options = options || {};
919
920 var data = objectMerge(
921 {
922 message: msg + '' // Make sure it's actually a string
923 },
924 options
925 );
926
927 var ex;
928 // Generate a "synthetic" stack trace from this point.
929 // NOTE: If you are a Sentry user, and you are seeing this stack frame, it is NOT indicative
930 // of a bug with Raven.js. Sentry generates synthetic traces either by configuration,
931 // or if it catches a thrown object without a "stack" property.
932 try {
933 throw new Error(msg);
934 } catch (ex1) {
935 ex = ex1;
936 }
937
938 // null exception name so `Error` isn't prefixed to msg
939 ex.name = null;
940 var stack = TraceKit.computeStackTrace(ex);
941
942 // stack[0] is `throw new Error(msg)` call itself, we are interested in the frame that was just before that, stack[1]
943 var initialCall = stack.stack[1];
944
945 var fileurl = (initialCall && initialCall.url) || '';
946
947 if (
948 !!this._globalOptions.ignoreUrls.test &&
949 this._globalOptions.ignoreUrls.test(fileurl)
950 ) {
951 return;
952 }
953
954 if (
955 !!this._globalOptions.whitelistUrls.test &&
956 !this._globalOptions.whitelistUrls.test(fileurl)
957 ) {
958 return;
959 }
960
961 if (this._globalOptions.stacktrace || (options && options.stacktrace)) {
962 options = objectMerge(
963 {
964 // fingerprint on msg, not stack trace (legacy behavior, could be
965 // revisited)
966 fingerprint: msg,
967 // since we know this is a synthetic trace, the top N-most frames
968 // MUST be from Raven.js, so mark them as in_app later by setting
969 // trimHeadFrames
970 trimHeadFrames: (options.trimHeadFrames || 0) + 1
971 },
972 options
973 );
974
975 var frames = this._prepareFrames(stack, options);
976 data.stacktrace = {
977 // Sentry expects frames oldest to newest
978 frames: frames.reverse()
979 };
980 }
981
982 // Fire away!
983 this._send(data);
984
985 return this;
986 },
987
988 captureBreadcrumb: function(obj) {
989 var crumb = objectMerge(
990 {
991 timestamp: now() / 1000
992 },
993 obj
994 );
995
996 if (isFunction(this._globalOptions.breadcrumbCallback)) {
997 var result = this._globalOptions.breadcrumbCallback(crumb);
998
999 if (isObject(result) && !isEmptyObject(result)) {
1000 crumb = result;
1001 } else if (result === false) {
1002 return this;
1003 }
1004 }
1005
1006 this._breadcrumbs.push(crumb);
1007 if (this._breadcrumbs.length > this._globalOptions.maxBreadcrumbs) {
1008 this._breadcrumbs.shift();
1009 }
1010 return this;
1011 },
1012
1013 addPlugin: function(plugin /*arg1, arg2, ... argN*/) {
1014 var pluginArgs = [].slice.call(arguments, 1);
1015
1016 this._plugins.push([plugin, pluginArgs]);
1017 if (this._isRavenInstalled) {
1018 this._drainPlugins();
1019 }
1020
1021 return this;
1022 },
1023
1024 /*
1025 * Set/clear a user to be sent along with the payload.
1026 *
1027 * @param {object} user An object representing user data [optional]
1028 * @return {Raven}
1029 */
1030 setUserContext: function(user) {
1031 // Intentionally do not merge here since that's an unexpected behavior.
1032 this._globalContext.user = user;
1033
1034 return this;
1035 },
1036
1037 /*
1038 * Merge extra attributes to be sent along with the payload.
1039 *
1040 * @param {object} extra An object representing extra data [optional]
1041 * @return {Raven}
1042 */
1043 setExtraContext: function(extra) {
1044 this._mergeContext('extra', extra);
1045
1046 return this;
1047 },
1048
1049 /*
1050 * Merge tags to be sent along with the payload.
1051 *
1052 * @param {object} tags An object representing tags [optional]
1053 * @return {Raven}
1054 */
1055 setTagsContext: function(tags) {
1056 this._mergeContext('tags', tags);
1057
1058 return this;
1059 },
1060
1061 /*
1062 * Clear all of the context.
1063 *
1064 * @return {Raven}
1065 */
1066 clearContext: function() {
1067 this._globalContext = {};
1068
1069 return this;
1070 },
1071
1072 /*
1073 * Get a copy of the current context. This cannot be mutated.
1074 *
1075 * @return {object} copy of context
1076 */
1077 getContext: function() {
1078 // lol javascript
1079 return JSON.parse(stringify(this._globalContext));
1080 },
1081
1082 /*
1083 * Set environment of application
1084 *
1085 * @param {string} environment Typically something like 'production'.
1086 * @return {Raven}
1087 */
1088 setEnvironment: function(environment) {
1089 this._globalOptions.environment = environment;
1090
1091 return this;
1092 },
1093
1094 /*
1095 * Set release version of application
1096 *
1097 * @param {string} release Typically something like a git SHA to identify version
1098 * @return {Raven}
1099 */
1100 setRelease: function(release) {
1101 this._globalOptions.release = release;
1102
1103 return this;
1104 },
1105
1106 /*
1107 * Set the dataCallback option
1108 *
1109 * @param {function} callback The callback to run which allows the
1110 * data blob to be mutated before sending
1111 * @return {Raven}
1112 */
1113 setDataCallback: function(callback) {
1114 var original = this._globalOptions.dataCallback;
1115 this._globalOptions.dataCallback = keepOriginalCallback(original, callback);
1116 return this;
1117 },
1118
1119 /*
1120 * Set the breadcrumbCallback option
1121 *
1122 * @param {function} callback The callback to run which allows filtering
1123 * or mutating breadcrumbs
1124 * @return {Raven}
1125 */
1126 setBreadcrumbCallback: function(callback) {
1127 var original = this._globalOptions.breadcrumbCallback;
1128 this._globalOptions.breadcrumbCallback = keepOriginalCallback(original, callback);
1129 return this;
1130 },
1131
1132 /*
1133 * Set the shouldSendCallback option
1134 *
1135 * @param {function} callback The callback to run which allows
1136 * introspecting the blob before sending
1137 * @return {Raven}
1138 */
1139 setShouldSendCallback: function(callback) {
1140 var original = this._globalOptions.shouldSendCallback;
1141 this._globalOptions.shouldSendCallback = keepOriginalCallback(original, callback);
1142 return this;
1143 },
1144
1145 /**
1146 * Override the default HTTP transport mechanism that transmits data
1147 * to the Sentry server.
1148 *
1149 * @param {function} transport Function invoked instead of the default
1150 * `makeRequest` handler.
1151 *
1152 * @return {Raven}
1153 */
1154 setTransport: function(transport) {
1155 this._globalOptions.transport = transport;
1156
1157 return this;
1158 },
1159
1160 /*
1161 * Get the latest raw exception that was captured by Raven.
1162 *
1163 * @return {error}
1164 */
1165 lastException: function() {
1166 return this._lastCapturedException;
1167 },
1168
1169 /*
1170 * Get the last event id
1171 *
1172 * @return {string}
1173 */
1174 lastEventId: function() {
1175 return this._lastEventId;
1176 },
1177
1178 /*
1179 * Determine if Raven is setup and ready to go.
1180 *
1181 * @return {boolean}
1182 */
1183 isSetup: function() {
1184 if (!this._hasJSON) return false; // needs JSON support
1185 if (!this._globalServer) {
1186 if (!this.ravenNotConfiguredError) {
1187 this.ravenNotConfiguredError = true;
1188 this._logDebug('error', 'Error: Raven has not been configured.');
1189 }
1190 return false;
1191 }
1192 return true;
1193 },
1194
1195 afterLoad: function() {
1196 // TODO: remove window dependence?
1197
1198 // Attempt to initialize Raven on load
1199 var RavenConfig = _window.RavenConfig;
1200 if (RavenConfig) {
1201 this.config(RavenConfig.dsn, RavenConfig.config).install();
1202 }
1203 },
1204
1205 showReportDialog: function(options) {
1206 if (
1207 !_document // doesn't work without a document (React native)
1208 )
1209 return;
1210
1211 options = options || {};
1212
1213 var lastEventId = options.eventId || this.lastEventId();
1214 if (!lastEventId) {
1215 throw new RavenConfigError('Missing eventId');
1216 }
1217
1218 var dsn = options.dsn || this._dsn;
1219 if (!dsn) {
1220 throw new RavenConfigError('Missing DSN');
1221 }
1222
1223 var encode = encodeURIComponent;
1224 var qs = '';
1225 qs += '?eventId=' + encode(lastEventId);
1226 qs += '&dsn=' + encode(dsn);
1227
1228 var user = options.user || this._globalContext.user;
1229 if (user) {
1230 if (user.name) qs += '&name=' + encode(user.name);
1231 if (user.email) qs += '&email=' + encode(user.email);
1232 }
1233
1234 var globalServer = this._getGlobalServer(this._parseDSN(dsn));
1235
1236 var script = _document.createElement('script');
1237 script.async = true;
1238 script.src = globalServer + '/api/embed/error-page/' + qs;
1239 (_document.head || _document.body).appendChild(script);
1240 },
1241
1242 /**** Private functions ****/
1243 _ignoreNextOnError: function() {
1244 var self = this;
1245 this._ignoreOnError += 1;
1246 setTimeout(function() {
1247 // onerror should trigger before setTimeout
1248 self._ignoreOnError -= 1;
1249 });
1250 },
1251
1252 _triggerEvent: function(eventType, options) {
1253 // NOTE: `event` is a native browser thing, so let's avoid conflicting wiht it
1254 var evt, key;
1255
1256 if (!this._hasDocument) return;
1257
1258 options = options || {};
1259
1260 eventType = 'raven' + eventType.substr(0, 1).toUpperCase() + eventType.substr(1);
1261
1262 if (_document.createEvent) {
1263 evt = _document.createEvent('HTMLEvents');
1264 evt.initEvent(eventType, true, true);
1265 } else {
1266 evt = _document.createEventObject();
1267 evt.eventType = eventType;
1268 }
1269
1270 for (key in options)
1271 if (hasKey(options, key)) {
1272 evt[key] = options[key];
1273 }
1274
1275 if (_document.createEvent) {
1276 // IE9 if standards
1277 _document.dispatchEvent(evt);
1278 } else {
1279 // IE8 regardless of Quirks or Standards
1280 // IE9 if quirks
1281 try {
1282 _document.fireEvent('on' + evt.eventType.toLowerCase(), evt);
1283 } catch (e) {
1284 // Do nothing
1285 }
1286 }
1287 },
1288
1289 /**
1290 * Wraps addEventListener to capture UI breadcrumbs
1291 * @param evtName the event name (e.g. "click")
1292 * @returns {Function}
1293 * @private
1294 */
1295 _breadcrumbEventHandler: function(evtName) {
1296 var self = this;
1297 return function(evt) {
1298 // reset keypress timeout; e.g. triggering a 'click' after
1299 // a 'keypress' will reset the keypress debounce so that a new
1300 // set of keypresses can be recorded
1301 self._keypressTimeout = null;
1302
1303 // It's possible this handler might trigger multiple times for the same
1304 // event (e.g. event propagation through node ancestors). Ignore if we've
1305 // already captured the event.
1306 if (self._lastCapturedEvent === evt) return;
1307
1308 self._lastCapturedEvent = evt;
1309
1310 // try/catch both:
1311 // - accessing evt.target (see getsentry/raven-js#838, #768)
1312 // - `htmlTreeAsString` because it's complex, and just accessing the DOM incorrectly
1313 // can throw an exception in some circumstances.
1314 var target;
1315 try {
1316 target = htmlTreeAsString(evt.target);
1317 } catch (e) {
1318 target = '<unknown>';
1319 }
1320
1321 self.captureBreadcrumb({
1322 category: 'ui.' + evtName, // e.g. ui.click, ui.input
1323 message: target
1324 });
1325 };
1326 },
1327
1328 /**
1329 * Wraps addEventListener to capture keypress UI events
1330 * @returns {Function}
1331 * @private
1332 */
1333 _keypressEventHandler: function() {
1334 var self = this,
1335 debounceDuration = 1000; // milliseconds
1336
1337 // TODO: if somehow user switches keypress target before
1338 // debounce timeout is triggered, we will only capture
1339 // a single breadcrumb from the FIRST target (acceptable?)
1340 return function(evt) {
1341 var target;
1342 try {
1343 target = evt.target;
1344 } catch (e) {
1345 // just accessing event properties can throw an exception in some rare circumstances
1346 // see: https://github.com/getsentry/raven-js/issues/838
1347 return;
1348 }
1349 var tagName = target && target.tagName;
1350
1351 // only consider keypress events on actual input elements
1352 // this will disregard keypresses targeting body (e.g. tabbing
1353 // through elements, hotkeys, etc)
1354 if (
1355 !tagName ||
1356 (tagName !== 'INPUT' && tagName !== 'TEXTAREA' && !target.isContentEditable)
1357 )
1358 return;
1359
1360 // record first keypress in a series, but ignore subsequent
1361 // keypresses until debounce clears
1362 var timeout = self._keypressTimeout;
1363 if (!timeout) {
1364 self._breadcrumbEventHandler('input')(evt);
1365 }
1366 clearTimeout(timeout);
1367 self._keypressTimeout = setTimeout(function() {
1368 self._keypressTimeout = null;
1369 }, debounceDuration);
1370 };
1371 },
1372
1373 /**
1374 * Captures a breadcrumb of type "navigation", normalizing input URLs
1375 * @param to the originating URL
1376 * @param from the target URL
1377 * @private
1378 */
1379 _captureUrlChange: function(from, to) {
1380 var parsedLoc = parseUrl(this._location.href);
1381 var parsedTo = parseUrl(to);
1382 var parsedFrom = parseUrl(from);
1383
1384 // because onpopstate only tells you the "new" (to) value of location.href, and
1385 // not the previous (from) value, we need to track the value of the current URL
1386 // state ourselves
1387 this._lastHref = to;
1388
1389 // Use only the path component of the URL if the URL matches the current
1390 // document (almost all the time when using pushState)
1391 if (parsedLoc.protocol === parsedTo.protocol && parsedLoc.host === parsedTo.host)
1392 to = parsedTo.relative;
1393 if (parsedLoc.protocol === parsedFrom.protocol && parsedLoc.host === parsedFrom.host)
1394 from = parsedFrom.relative;
1395
1396 this.captureBreadcrumb({
1397 category: 'navigation',
1398 data: {
1399 to: to,
1400 from: from
1401 }
1402 });
1403 },
1404
1405 /**
1406 * Wrap timer functions and event targets to catch errors and provide
1407 * better metadata.
1408 */
1409 _instrumentTryCatch: function() {
1410 var self = this;
1411
1412 var wrappedBuiltIns = self._wrappedBuiltIns;
1413
1414 function wrapTimeFn(orig) {
1415 return function(fn, t) {
1416 // preserve arity
1417 // Make a copy of the arguments to prevent deoptimization
1418 // https://github.com/petkaantonov/bluebird/wiki/Optimization-killers#32-leaking-arguments
1419 var args = new Array(arguments.length);
1420 for (var i = 0; i < args.length; ++i) {
1421 args[i] = arguments[i];
1422 }
1423 var originalCallback = args[0];
1424 if (isFunction(originalCallback)) {
1425 args[0] = self.wrap(originalCallback);
1426 }
1427
1428 // IE < 9 doesn't support .call/.apply on setInterval/setTimeout, but it
1429 // also supports only two arguments and doesn't care what this is, so we
1430 // can just call the original function directly.
1431 if (orig.apply) {
1432 return orig.apply(this, args);
1433 } else {
1434 return orig(args[0], args[1]);
1435 }
1436 };
1437 }
1438
1439 var autoBreadcrumbs = this._globalOptions.autoBreadcrumbs;
1440
1441 function wrapEventTarget(global) {
1442 var proto = _window[global] && _window[global].prototype;
1443 if (proto && proto.hasOwnProperty && proto.hasOwnProperty('addEventListener')) {
1444 fill(
1445 proto,
1446 'addEventListener',
1447 function(orig) {
1448 return function(evtName, fn, capture, secure) {
1449 // preserve arity
1450 try {
1451 if (fn && fn.handleEvent) {
1452 fn.handleEvent = self.wrap(fn.handleEvent);
1453 }
1454 } catch (err) {
1455 // can sometimes get 'Permission denied to access property "handle Event'
1456 }
1457
1458 // More breadcrumb DOM capture ... done here and not in `_instrumentBreadcrumbs`
1459 // so that we don't have more than one wrapper function
1460 var before, clickHandler, keypressHandler;
1461
1462 if (
1463 autoBreadcrumbs &&
1464 autoBreadcrumbs.dom &&
1465 (global === 'EventTarget' || global === 'Node')
1466 ) {
1467 // NOTE: generating multiple handlers per addEventListener invocation, should
1468 // revisit and verify we can just use one (almost certainly)
1469 clickHandler = self._breadcrumbEventHandler('click');
1470 keypressHandler = self._keypressEventHandler();
1471 before = function(evt) {
1472 // need to intercept every DOM event in `before` argument, in case that
1473 // same wrapped method is re-used for different events (e.g. mousemove THEN click)
1474 // see #724
1475 if (!evt) return;
1476
1477 var eventType;
1478 try {
1479 eventType = evt.type;
1480 } catch (e) {
1481 // just accessing event properties can throw an exception in some rare circumstances
1482 // see: https://github.com/getsentry/raven-js/issues/838
1483 return;
1484 }
1485 if (eventType === 'click') return clickHandler(evt);
1486 else if (eventType === 'keypress') return keypressHandler(evt);
1487 };
1488 }
1489 return orig.call(
1490 this,
1491 evtName,
1492 self.wrap(fn, undefined, before),
1493 capture,
1494 secure
1495 );
1496 };
1497 },
1498 wrappedBuiltIns
1499 );
1500 fill(
1501 proto,
1502 'removeEventListener',
1503 function(orig) {
1504 return function(evt, fn, capture, secure) {
1505 try {
1506 fn = fn && (fn.__raven_wrapper__ ? fn.__raven_wrapper__ : fn);
1507 } catch (e) {
1508 // ignore, accessing __raven_wrapper__ will throw in some Selenium environments
1509 }
1510 return orig.call(this, evt, fn, capture, secure);
1511 };
1512 },
1513 wrappedBuiltIns
1514 );
1515 }
1516 }
1517
1518 fill(_window, 'setTimeout', wrapTimeFn, wrappedBuiltIns);
1519 fill(_window, 'setInterval', wrapTimeFn, wrappedBuiltIns);
1520 if (_window.requestAnimationFrame) {
1521 fill(
1522 _window,
1523 'requestAnimationFrame',
1524 function(orig) {
1525 return function(cb) {
1526 return orig(self.wrap(cb));
1527 };
1528 },
1529 wrappedBuiltIns
1530 );
1531 }
1532
1533 // event targets borrowed from bugsnag-js:
1534 // https://github.com/bugsnag/bugsnag-js/blob/master/src/bugsnag.js#L666
1535 var eventTargets = [
1536 'EventTarget',
1537 'Window',
1538 'Node',
1539 'ApplicationCache',
1540 'AudioTrackList',
1541 'ChannelMergerNode',
1542 'CryptoOperation',
1543 'EventSource',
1544 'FileReader',
1545 'HTMLUnknownElement',
1546 'IDBDatabase',
1547 'IDBRequest',
1548 'IDBTransaction',
1549 'KeyOperation',
1550 'MediaController',
1551 'MessagePort',
1552 'ModalWindow',
1553 'Notification',
1554 'SVGElementInstance',
1555 'Screen',
1556 'TextTrack',
1557 'TextTrackCue',
1558 'TextTrackList',
1559 'WebSocket',
1560 'WebSocketWorker',
1561 'Worker',
1562 'XMLHttpRequest',
1563 'XMLHttpRequestEventTarget',
1564 'XMLHttpRequestUpload'
1565 ];
1566 for (var i = 0; i < eventTargets.length; i++) {
1567 wrapEventTarget(eventTargets[i]);
1568 }
1569 },
1570
1571 /**
1572 * Instrument browser built-ins w/ breadcrumb capturing
1573 * - XMLHttpRequests
1574 * - DOM interactions (click/typing)
1575 * - window.location changes
1576 * - console
1577 *
1578 * Can be disabled or individually configured via the `autoBreadcrumbs` config option
1579 */
1580 _instrumentBreadcrumbs: function() {
1581 var self = this;
1582 var autoBreadcrumbs = this._globalOptions.autoBreadcrumbs;
1583
1584 var wrappedBuiltIns = self._wrappedBuiltIns;
1585
1586 function wrapProp(prop, xhr) {
1587 if (prop in xhr && isFunction(xhr[prop])) {
1588 fill(xhr, prop, function(orig) {
1589 return self.wrap(orig);
1590 }); // intentionally don't track filled methods on XHR instances
1591 }
1592 }
1593
1594 if (autoBreadcrumbs.xhr && 'XMLHttpRequest' in _window) {
1595 var xhrproto = XMLHttpRequest.prototype;
1596 fill(
1597 xhrproto,
1598 'open',
1599 function(origOpen) {
1600 return function(method, url) {
1601 // preserve arity
1602
1603 // if Sentry key appears in URL, don't capture
1604 if (isString(url) && url.indexOf(self._globalKey) === -1) {
1605 this.__raven_xhr = {
1606 method: method,
1607 url: url,
1608 status_code: null
1609 };
1610 }
1611
1612 return origOpen.apply(this, arguments);
1613 };
1614 },
1615 wrappedBuiltIns
1616 );
1617
1618 fill(
1619 xhrproto,
1620 'send',
1621 function(origSend) {
1622 return function(data) {
1623 // preserve arity
1624 var xhr = this;
1625
1626 function onreadystatechangeHandler() {
1627 if (xhr.__raven_xhr && xhr.readyState === 4) {
1628 try {
1629 // touching statusCode in some platforms throws
1630 // an exception
1631 xhr.__raven_xhr.status_code = xhr.status;
1632 } catch (e) {
1633 /* do nothing */
1634 }
1635
1636 self.captureBreadcrumb({
1637 type: 'http',
1638 category: 'xhr',
1639 data: xhr.__raven_xhr
1640 });
1641 }
1642 }
1643
1644 var props = ['onload', 'onerror', 'onprogress'];
1645 for (var j = 0; j < props.length; j++) {
1646 wrapProp(props[j], xhr);
1647 }
1648
1649 if ('onreadystatechange' in xhr && isFunction(xhr.onreadystatechange)) {
1650 fill(
1651 xhr,
1652 'onreadystatechange',
1653 function(orig) {
1654 return self.wrap(orig, undefined, onreadystatechangeHandler);
1655 } /* intentionally don't track this instrumentation */
1656 );
1657 } else {
1658 // if onreadystatechange wasn't actually set by the page on this xhr, we
1659 // are free to set our own and capture the breadcrumb
1660 xhr.onreadystatechange = onreadystatechangeHandler;
1661 }
1662
1663 return origSend.apply(this, arguments);
1664 };
1665 },
1666 wrappedBuiltIns
1667 );
1668 }
1669
1670 if (autoBreadcrumbs.xhr && 'fetch' in _window) {
1671 fill(
1672 _window,
1673 'fetch',
1674 function(origFetch) {
1675 return function(fn, t) {
1676 // preserve arity
1677 // Make a copy of the arguments to prevent deoptimization
1678 // https://github.com/petkaantonov/bluebird/wiki/Optimization-killers#32-leaking-arguments
1679 var args = new Array(arguments.length);
1680 for (var i = 0; i < args.length; ++i) {
1681 args[i] = arguments[i];
1682 }
1683
1684 var fetchInput = args[0];
1685 var method = 'GET';
1686 var url;
1687
1688 if (typeof fetchInput === 'string') {
1689 url = fetchInput;
1690 } else if ('Request' in _window && fetchInput instanceof _window.Request) {
1691 url = fetchInput.url;
1692 if (fetchInput.method) {
1693 method = fetchInput.method;
1694 }
1695 } else {
1696 url = '' + fetchInput;
1697 }
1698
1699 if (args[1] && args[1].method) {
1700 method = args[1].method;
1701 }
1702
1703 var fetchData = {
1704 method: method,
1705 url: url,
1706 status_code: null
1707 };
1708
1709 self.captureBreadcrumb({
1710 type: 'http',
1711 category: 'fetch',
1712 data: fetchData
1713 });
1714
1715 return origFetch.apply(this, args).then(function(response) {
1716 fetchData.status_code = response.status;
1717
1718 return response;
1719 });
1720 };
1721 },
1722 wrappedBuiltIns
1723 );
1724 }
1725
1726 // Capture breadcrumbs from any click that is unhandled / bubbled up all the way
1727 // to the document. Do this before we instrument addEventListener.
1728 if (autoBreadcrumbs.dom && this._hasDocument) {
1729 if (_document.addEventListener) {
1730 _document.addEventListener('click', self._breadcrumbEventHandler('click'), false);
1731 _document.addEventListener('keypress', self._keypressEventHandler(), false);
1732 } else {
1733 // IE8 Compatibility
1734 _document.attachEvent('onclick', self._breadcrumbEventHandler('click'));
1735 _document.attachEvent('onkeypress', self._keypressEventHandler());
1736 }
1737 }
1738
1739 // record navigation (URL) changes
1740 // NOTE: in Chrome App environment, touching history.pushState, *even inside
1741 // a try/catch block*, will cause Chrome to output an error to console.error
1742 // borrowed from: https://github.com/angular/angular.js/pull/13945/files
1743 var chrome = _window.chrome;
1744 var isChromePackagedApp = chrome && chrome.app && chrome.app.runtime;
1745 var hasPushAndReplaceState =
1746 !isChromePackagedApp &&
1747 _window.history &&
1748 history.pushState &&
1749 history.replaceState;
1750 if (autoBreadcrumbs.location && hasPushAndReplaceState) {
1751 // TODO: remove onpopstate handler on uninstall()
1752 var oldOnPopState = _window.onpopstate;
1753 _window.onpopstate = function() {
1754 var currentHref = self._location.href;
1755 self._captureUrlChange(self._lastHref, currentHref);
1756
1757 if (oldOnPopState) {
1758 return oldOnPopState.apply(this, arguments);
1759 }
1760 };
1761
1762 var historyReplacementFunction = function(origHistFunction) {
1763 // note history.pushState.length is 0; intentionally not declaring
1764 // params to preserve 0 arity
1765 return function(/* state, title, url */) {
1766 var url = arguments.length > 2 ? arguments[2] : undefined;
1767
1768 // url argument is optional
1769 if (url) {
1770 // coerce to string (this is what pushState does)
1771 self._captureUrlChange(self._lastHref, url + '');
1772 }
1773
1774 return origHistFunction.apply(this, arguments);
1775 };
1776 };
1777
1778 fill(history, 'pushState', historyReplacementFunction, wrappedBuiltIns);
1779 fill(history, 'replaceState', historyReplacementFunction, wrappedBuiltIns);
1780 }
1781
1782 if (autoBreadcrumbs.console && 'console' in _window && console.log) {
1783 // console
1784 var consoleMethodCallback = function(msg, data) {
1785 self.captureBreadcrumb({
1786 message: msg,
1787 level: data.level,
1788 category: 'console'
1789 });
1790 };
1791
1792 each(['debug', 'info', 'warn', 'error', 'log'], function(_, level) {
1793 wrapConsoleMethod(console, level, consoleMethodCallback);
1794 });
1795 }
1796 },
1797
1798 _restoreBuiltIns: function() {
1799 // restore any wrapped builtins
1800 var builtin;
1801 while (this._wrappedBuiltIns.length) {
1802 builtin = this._wrappedBuiltIns.shift();
1803
1804 var obj = builtin[0],
1805 name = builtin[1],
1806 orig = builtin[2];
1807
1808 obj[name] = orig;
1809 }
1810 },
1811
1812 _drainPlugins: function() {
1813 var self = this;
1814
1815 // FIX ME TODO
1816 each(this._plugins, function(_, plugin) {
1817 var installer = plugin[0];
1818 var args = plugin[1];
1819 installer.apply(self, [self].concat(args));
1820 });
1821 },
1822
1823 _parseDSN: function(str) {
1824 var m = dsnPattern.exec(str),
1825 dsn = {},
1826 i = 7;
1827
1828 try {
1829 while (i--) dsn[dsnKeys[i]] = m[i] || '';
1830 } catch (e) {
1831 throw new RavenConfigError('Invalid DSN: ' + str);
1832 }
1833
1834 if (dsn.pass && !this._globalOptions.allowSecretKey) {
1835 throw new RavenConfigError(
1836 'Do not specify your secret key in the DSN. See: http://bit.ly/raven-secret-key'
1837 );
1838 }
1839
1840 return dsn;
1841 },
1842
1843 _getGlobalServer: function(uri) {
1844 // assemble the endpoint from the uri pieces
1845 var globalServer = '//' + uri.host + (uri.port ? ':' + uri.port : '');
1846
1847 if (uri.protocol) {
1848 globalServer = uri.protocol + ':' + globalServer;
1849 }
1850 return globalServer;
1851 },
1852
1853 _handleOnErrorStackInfo: function() {
1854 // if we are intentionally ignoring errors via onerror, bail out
1855 if (!this._ignoreOnError) {
1856 this._handleStackInfo.apply(this, arguments);
1857 }
1858 },
1859
1860 _handleStackInfo: function(stackInfo, options) {
1861 var frames = this._prepareFrames(stackInfo, options);
1862
1863 this._triggerEvent('handle', {
1864 stackInfo: stackInfo,
1865 options: options
1866 });
1867
1868 this._processException(
1869 stackInfo.name,
1870 stackInfo.message,
1871 stackInfo.url,
1872 stackInfo.lineno,
1873 frames,
1874 options
1875 );
1876 },
1877
1878 _prepareFrames: function(stackInfo, options) {
1879 var self = this;
1880 var frames = [];
1881 if (stackInfo.stack && stackInfo.stack.length) {
1882 each(stackInfo.stack, function(i, stack) {
1883 var frame = self._normalizeFrame(stack, stackInfo.url);
1884 if (frame) {
1885 frames.push(frame);
1886 }
1887 });
1888
1889 // e.g. frames captured via captureMessage throw
1890 if (options && options.trimHeadFrames) {
1891 for (var j = 0; j < options.trimHeadFrames && j < frames.length; j++) {
1892 frames[j].in_app = false;
1893 }
1894 }
1895 }
1896 frames = frames.slice(0, this._globalOptions.stackTraceLimit);
1897 return frames;
1898 },
1899
1900 _normalizeFrame: function(frame, stackInfoUrl) {
1901 // normalize the frames data
1902 var normalized = {
1903 filename: frame.url,
1904 lineno: frame.line,
1905 colno: frame.column,
1906 function: frame.func || '?'
1907 };
1908
1909 // Case when we don't have any information about the error
1910 // E.g. throwing a string or raw object, instead of an `Error` in Firefox
1911 // Generating synthetic error doesn't add any value here
1912 //
1913 // We should probably somehow let a user know that they should fix their code
1914 if (!frame.url) {
1915 normalized.filename = stackInfoUrl; // fallback to whole stacks url from onerror handler
1916 }
1917
1918 normalized.in_app = !// determine if an exception came from outside of our app
1919 // first we check the global includePaths list.
1920 (
1921 (!!this._globalOptions.includePaths.test &&
1922 !this._globalOptions.includePaths.test(normalized.filename)) ||
1923 // Now we check for fun, if the function name is Raven or TraceKit
1924 /(Raven|TraceKit)\./.test(normalized['function']) ||
1925 // finally, we do a last ditch effort and check for raven.min.js
1926 /raven\.(min\.)?js$/.test(normalized.filename)
1927 );
1928
1929 return normalized;
1930 },
1931
1932 _processException: function(type, message, fileurl, lineno, frames, options) {
1933 var prefixedMessage = (type ? type + ': ' : '') + (message || '');
1934 if (
1935 !!this._globalOptions.ignoreErrors.test &&
1936 (this._globalOptions.ignoreErrors.test(message) ||
1937 this._globalOptions.ignoreErrors.test(prefixedMessage))
1938 ) {
1939 return;
1940 }
1941
1942 var stacktrace;
1943
1944 if (frames && frames.length) {
1945 fileurl = frames[0].filename || fileurl;
1946 // Sentry expects frames oldest to newest
1947 // and JS sends them as newest to oldest
1948 frames.reverse();
1949 stacktrace = {frames: frames};
1950 } else if (fileurl) {
1951 stacktrace = {
1952 frames: [
1953 {
1954 filename: fileurl,
1955 lineno: lineno,
1956 in_app: true
1957 }
1958 ]
1959 };
1960 }
1961
1962 if (
1963 !!this._globalOptions.ignoreUrls.test &&
1964 this._globalOptions.ignoreUrls.test(fileurl)
1965 ) {
1966 return;
1967 }
1968
1969 if (
1970 !!this._globalOptions.whitelistUrls.test &&
1971 !this._globalOptions.whitelistUrls.test(fileurl)
1972 ) {
1973 return;
1974 }
1975
1976 var data = objectMerge(
1977 {
1978 // sentry.interfaces.Exception
1979 exception: {
1980 values: [
1981 {
1982 type: type,
1983 value: message,
1984 stacktrace: stacktrace
1985 }
1986 ]
1987 },
1988 culprit: fileurl
1989 },
1990 options
1991 );
1992
1993 // Fire away!
1994 this._send(data);
1995 },
1996
1997 _trimPacket: function(data) {
1998 // For now, we only want to truncate the two different messages
1999 // but this could/should be expanded to just trim everything
2000 var max = this._globalOptions.maxMessageLength;
2001 if (data.message) {
2002 data.message = truncate(data.message, max);
2003 }
2004 if (data.exception) {
2005 var exception = data.exception.values[0];
2006 exception.value = truncate(exception.value, max);
2007 }
2008
2009 var request = data.request;
2010 if (request) {
2011 if (request.url) {
2012 request.url = truncate(request.url, this._globalOptions.maxUrlLength);
2013 }
2014 if (request.Referer) {
2015 request.Referer = truncate(request.Referer, this._globalOptions.maxUrlLength);
2016 }
2017 }
2018
2019 if (data.breadcrumbs && data.breadcrumbs.values)
2020 this._trimBreadcrumbs(data.breadcrumbs);
2021
2022 return data;
2023 },
2024
2025 /**
2026 * Truncate breadcrumb values (right now just URLs)
2027 */
2028 _trimBreadcrumbs: function(breadcrumbs) {
2029 // known breadcrumb properties with urls
2030 // TODO: also consider arbitrary prop values that start with (https?)?://
2031 var urlProps = ['to', 'from', 'url'],
2032 urlProp,
2033 crumb,
2034 data;
2035
2036 for (var i = 0; i < breadcrumbs.values.length; ++i) {
2037 crumb = breadcrumbs.values[i];
2038 if (
2039 !crumb.hasOwnProperty('data') ||
2040 !isObject(crumb.data) ||
2041 objectFrozen(crumb.data)
2042 )
2043 continue;
2044
2045 data = objectMerge({}, crumb.data);
2046 for (var j = 0; j < urlProps.length; ++j) {
2047 urlProp = urlProps[j];
2048 if (data.hasOwnProperty(urlProp) && data[urlProp]) {
2049 data[urlProp] = truncate(data[urlProp], this._globalOptions.maxUrlLength);
2050 }
2051 }
2052 breadcrumbs.values[i].data = data;
2053 }
2054 },
2055
2056 _getHttpData: function() {
2057 if (!this._hasNavigator && !this._hasDocument) return;
2058 var httpData = {};
2059
2060 if (this._hasNavigator && _navigator.userAgent) {
2061 httpData.headers = {
2062 'User-Agent': navigator.userAgent
2063 };
2064 }
2065
2066 if (this._hasDocument) {
2067 if (_document.location && _document.location.href) {
2068 httpData.url = _document.location.href;
2069 }
2070 if (_document.referrer) {
2071 if (!httpData.headers) httpData.headers = {};
2072 httpData.headers.Referer = _document.referrer;
2073 }
2074 }
2075
2076 return httpData;
2077 },
2078
2079 _resetBackoff: function() {
2080 this._backoffDuration = 0;
2081 this._backoffStart = null;
2082 },
2083
2084 _shouldBackoff: function() {
2085 return this._backoffDuration && now() - this._backoffStart < this._backoffDuration;
2086 },
2087
2088 /**
2089 * Returns true if the in-process data payload matches the signature
2090 * of the previously-sent data
2091 *
2092 * NOTE: This has to be done at this level because TraceKit can generate
2093 * data from window.onerror WITHOUT an exception object (IE8, IE9,
2094 * other old browsers). This can take the form of an "exception"
2095 * data object with a single frame (derived from the onerror args).
2096 */
2097 _isRepeatData: function(current) {
2098 var last = this._lastData;
2099
2100 if (
2101 !last ||
2102 current.message !== last.message || // defined for captureMessage
2103 current.culprit !== last.culprit // defined for captureException/onerror
2104 )
2105 return false;
2106
2107 // Stacktrace interface (i.e. from captureMessage)
2108 if (current.stacktrace || last.stacktrace) {
2109 return isSameStacktrace(current.stacktrace, last.stacktrace);
2110 } else if (current.exception || last.exception) {
2111 // Exception interface (i.e. from captureException/onerror)
2112 return isSameException(current.exception, last.exception);
2113 }
2114
2115 return true;
2116 },
2117
2118 _setBackoffState: function(request) {
2119 // If we are already in a backoff state, don't change anything
2120 if (this._shouldBackoff()) {
2121 return;
2122 }
2123
2124 var status = request.status;
2125
2126 // 400 - project_id doesn't exist or some other fatal
2127 // 401 - invalid/revoked dsn
2128 // 429 - too many requests
2129 if (!(status === 400 || status === 401 || status === 429)) return;
2130
2131 var retry;
2132 try {
2133 // If Retry-After is not in Access-Control-Expose-Headers, most
2134 // browsers will throw an exception trying to access it
2135 retry = request.getResponseHeader('Retry-After');
2136 retry = parseInt(retry, 10) * 1000; // Retry-After is returned in seconds
2137 } catch (e) {
2138 /* eslint no-empty:0 */
2139 }
2140
2141 this._backoffDuration = retry
2142 ? // If Sentry server returned a Retry-After value, use it
2143 retry
2144 : // Otherwise, double the last backoff duration (starts at 1 sec)
2145 this._backoffDuration * 2 || 1000;
2146
2147 this._backoffStart = now();
2148 },
2149
2150 _send: function(data) {
2151 var globalOptions = this._globalOptions;
2152
2153 var baseData = {
2154 project: this._globalProject,
2155 logger: globalOptions.logger,
2156 platform: 'javascript'
2157 },
2158 httpData = this._getHttpData();
2159
2160 if (httpData) {
2161 baseData.request = httpData;
2162 }
2163
2164 // HACK: delete `trimHeadFrames` to prevent from appearing in outbound payload
2165 if (data.trimHeadFrames) delete data.trimHeadFrames;
2166
2167 data = objectMerge(baseData, data);
2168
2169 // Merge in the tags and extra separately since objectMerge doesn't handle a deep merge
2170 data.tags = objectMerge(objectMerge({}, this._globalContext.tags), data.tags);
2171 data.extra = objectMerge(objectMerge({}, this._globalContext.extra), data.extra);
2172
2173 // Send along our own collected metadata with extra
2174 data.extra['session:duration'] = now() - this._startTime;
2175
2176 if (this._breadcrumbs && this._breadcrumbs.length > 0) {
2177 // intentionally make shallow copy so that additions
2178 // to breadcrumbs aren't accidentally sent in this request
2179 data.breadcrumbs = {
2180 values: [].slice.call(this._breadcrumbs, 0)
2181 };
2182 }
2183
2184 // If there are no tags/extra, strip the key from the payload alltogther.
2185 if (isEmptyObject(data.tags)) delete data.tags;
2186
2187 if (this._globalContext.user) {
2188 // sentry.interfaces.User
2189 data.user = this._globalContext.user;
2190 }
2191
2192 // Include the environment if it's defined in globalOptions
2193 if (globalOptions.environment) data.environment = globalOptions.environment;
2194
2195 // Include the release if it's defined in globalOptions
2196 if (globalOptions.release) data.release = globalOptions.release;
2197
2198 // Include server_name if it's defined in globalOptions
2199 if (globalOptions.serverName) data.server_name = globalOptions.serverName;
2200
2201 if (isFunction(globalOptions.dataCallback)) {
2202 data = globalOptions.dataCallback(data) || data;
2203 }
2204
2205 // Why??????????
2206 if (!data || isEmptyObject(data)) {
2207 return;
2208 }
2209
2210 // Check if the request should be filtered or not
2211 if (
2212 isFunction(globalOptions.shouldSendCallback) &&
2213 !globalOptions.shouldSendCallback(data)
2214 ) {
2215 return;
2216 }
2217
2218 // Backoff state: Sentry server previously responded w/ an error (e.g. 429 - too many requests),
2219 // so drop requests until "cool-off" period has elapsed.
2220 if (this._shouldBackoff()) {
2221 this._logDebug('warn', 'Raven dropped error due to backoff: ', data);
2222 return;
2223 }
2224
2225 if (typeof globalOptions.sampleRate === 'number') {
2226 if (Math.random() < globalOptions.sampleRate) {
2227 this._sendProcessedPayload(data);
2228 }
2229 } else {
2230 this._sendProcessedPayload(data);
2231 }
2232 },
2233
2234 _getUuid: function() {
2235 return uuid4();
2236 },
2237
2238 _sendProcessedPayload: function(data, callback) {
2239 var self = this;
2240 var globalOptions = this._globalOptions;
2241
2242 if (!this.isSetup()) return;
2243
2244 // Try and clean up the packet before sending by truncating long values
2245 data = this._trimPacket(data);
2246
2247 // ideally duplicate error testing should occur *before* dataCallback/shouldSendCallback,
2248 // but this would require copying an un-truncated copy of the data packet, which can be
2249 // arbitrarily deep (extra_data) -- could be worthwhile? will revisit
2250 if (!this._globalOptions.allowDuplicates && this._isRepeatData(data)) {
2251 this._logDebug('warn', 'Raven dropped repeat event: ', data);
2252 return;
2253 }
2254
2255 // Send along an event_id if not explicitly passed.
2256 // This event_id can be used to reference the error within Sentry itself.
2257 // Set lastEventId after we know the error should actually be sent
2258 this._lastEventId = data.event_id || (data.event_id = this._getUuid());
2259
2260 // Store outbound payload after trim
2261 this._lastData = data;
2262
2263 this._logDebug('debug', 'Raven about to send:', data);
2264
2265 var auth = {
2266 sentry_version: '7',
2267 sentry_client: 'raven-js/' + this.VERSION,
2268 sentry_key: this._globalKey
2269 };
2270
2271 if (this._globalSecret) {
2272 auth.sentry_secret = this._globalSecret;
2273 }
2274
2275 var exception = data.exception && data.exception.values[0];
2276 this.captureBreadcrumb({
2277 category: 'sentry',
2278 message: exception
2279 ? (exception.type ? exception.type + ': ' : '') + exception.value
2280 : data.message,
2281 event_id: data.event_id,
2282 level: data.level || 'error' // presume error unless specified
2283 });
2284
2285 var url = this._globalEndpoint;
2286 (globalOptions.transport || this._makeRequest).call(this, {
2287 url: url,
2288 auth: auth,
2289 data: data,
2290 options: globalOptions,
2291 onSuccess: function success() {
2292 self._resetBackoff();
2293
2294 self._triggerEvent('success', {
2295 data: data,
2296 src: url
2297 });
2298 callback && callback();
2299 },
2300 onError: function failure(error) {
2301 self._logDebug('error', 'Raven transport failed to send: ', error);
2302
2303 if (error.request) {
2304 self._setBackoffState(error.request);
2305 }
2306
2307 self._triggerEvent('failure', {
2308 data: data,
2309 src: url
2310 });
2311 error = error || new Error('Raven send failed (no additional details provided)');
2312 callback && callback(error);
2313 }
2314 });
2315 },
2316
2317 _makeRequest: function(opts) {
2318 var request = _window.XMLHttpRequest && new _window.XMLHttpRequest();
2319 if (!request) return;
2320
2321 // if browser doesn't support CORS (e.g. IE7), we are out of luck
2322 var hasCORS = 'withCredentials' in request || typeof XDomainRequest !== 'undefined';
2323
2324 if (!hasCORS) return;
2325
2326 var url = opts.url;
2327
2328 if ('withCredentials' in request) {
2329 request.onreadystatechange = function() {
2330 if (request.readyState !== 4) {
2331 return;
2332 } else if (request.status === 200) {
2333 opts.onSuccess && opts.onSuccess();
2334 } else if (opts.onError) {
2335 var err = new Error('Sentry error code: ' + request.status);
2336 err.request = request;
2337 opts.onError(err);
2338 }
2339 };
2340 } else {
2341 request = new XDomainRequest();
2342 // xdomainrequest cannot go http -> https (or vice versa),
2343 // so always use protocol relative
2344 url = url.replace(/^https?:/, '');
2345
2346 // onreadystatechange not supported by XDomainRequest
2347 if (opts.onSuccess) {
2348 request.onload = opts.onSuccess;
2349 }
2350 if (opts.onError) {
2351 request.onerror = function() {
2352 var err = new Error('Sentry error code: XDomainRequest');
2353 err.request = request;
2354 opts.onError(err);
2355 };
2356 }
2357 }
2358
2359 // NOTE: auth is intentionally sent as part of query string (NOT as custom
2360 // HTTP header) so as to avoid preflight CORS requests
2361 request.open('POST', url + '?' + urlencode(opts.auth));
2362 request.send(stringify(opts.data));
2363 },
2364
2365 _logDebug: function(level) {
2366 if (this._originalConsoleMethods[level] && this.debug) {
2367 // In IE<10 console methods do not have their own 'apply' method
2368 Function.prototype.apply.call(
2369 this._originalConsoleMethods[level],
2370 this._originalConsole,
2371 [].slice.call(arguments, 1)
2372 );
2373 }
2374 },
2375
2376 _mergeContext: function(key, context) {
2377 if (isUndefined(context)) {
2378 delete this._globalContext[key];
2379 } else {
2380 this._globalContext[key] = objectMerge(this._globalContext[key] || {}, context);
2381 }
2382 }
2383 };
2384
2385 // Deprecations
2386 Raven.prototype.setUser = Raven.prototype.setUserContext;
2387 Raven.prototype.setReleaseContext = Raven.prototype.setRelease;
2388
2389 module.exports = Raven;
2390
2391
2392 /***/ }),
2393
2394 /***/ "./node_modules/raven-js/src/singleton.js":
2395 /*!************************************************!*\
2396 !*** ./node_modules/raven-js/src/singleton.js ***!
2397 \************************************************/
2398 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
2399
2400 /**
2401 * Enforces a single instance of the Raven client, and the
2402 * main entry point for Raven. If you are a consumer of the
2403 * Raven library, you SHOULD load this file (vs raven.js).
2404 **/
2405
2406 var RavenConstructor = __webpack_require__(/*! ./raven */ "./node_modules/raven-js/src/raven.js");
2407
2408 // This is to be defensive in environments where window does not exist (see https://github.com/getsentry/raven-js/pull/785)
2409 var _window =
2410 typeof window !== 'undefined'
2411 ? window
2412 : typeof __webpack_require__.g !== 'undefined' ? __webpack_require__.g : typeof self !== 'undefined' ? self : {};
2413 var _Raven = _window.Raven;
2414
2415 var Raven = new RavenConstructor();
2416
2417 /*
2418 * Allow multiple versions of Raven to be installed.
2419 * Strip Raven from the global context and returns the instance.
2420 *
2421 * @return {Raven}
2422 */
2423 Raven.noConflict = function() {
2424 _window.Raven = _Raven;
2425 return Raven;
2426 };
2427
2428 Raven.afterLoad();
2429
2430 module.exports = Raven;
2431
2432
2433 /***/ }),
2434
2435 /***/ "./node_modules/raven-js/src/utils.js":
2436 /*!********************************************!*\
2437 !*** ./node_modules/raven-js/src/utils.js ***!
2438 \********************************************/
2439 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
2440
2441 var _window =
2442 typeof window !== 'undefined'
2443 ? window
2444 : typeof __webpack_require__.g !== 'undefined' ? __webpack_require__.g : typeof self !== 'undefined' ? self : {};
2445
2446 function isObject(what) {
2447 return typeof what === 'object' && what !== null;
2448 }
2449
2450 // Yanked from https://git.io/vS8DV re-used under CC0
2451 // with some tiny modifications
2452 function isError(value) {
2453 switch ({}.toString.call(value)) {
2454 case '[object Error]':
2455 return true;
2456 case '[object Exception]':
2457 return true;
2458 case '[object DOMException]':
2459 return true;
2460 default:
2461 return value instanceof Error;
2462 }
2463 }
2464
2465 function isErrorEvent(value) {
2466 return supportsErrorEvent() && {}.toString.call(value) === '[object ErrorEvent]';
2467 }
2468
2469 function isUndefined(what) {
2470 return what === void 0;
2471 }
2472
2473 function isFunction(what) {
2474 return typeof what === 'function';
2475 }
2476
2477 function isString(what) {
2478 return Object.prototype.toString.call(what) === '[object String]';
2479 }
2480
2481 function isEmptyObject(what) {
2482 for (var _ in what) return false; // eslint-disable-line guard-for-in, no-unused-vars
2483 return true;
2484 }
2485
2486 function supportsErrorEvent() {
2487 try {
2488 new ErrorEvent(''); // eslint-disable-line no-new
2489 return true;
2490 } catch (e) {
2491 return false;
2492 }
2493 }
2494
2495 function wrappedCallback(callback) {
2496 function dataCallback(data, original) {
2497 var normalizedData = callback(data) || data;
2498 if (original) {
2499 return original(normalizedData) || normalizedData;
2500 }
2501 return normalizedData;
2502 }
2503
2504 return dataCallback;
2505 }
2506
2507 function each(obj, callback) {
2508 var i, j;
2509
2510 if (isUndefined(obj.length)) {
2511 for (i in obj) {
2512 if (hasKey(obj, i)) {
2513 callback.call(null, i, obj[i]);
2514 }
2515 }
2516 } else {
2517 j = obj.length;
2518 if (j) {
2519 for (i = 0; i < j; i++) {
2520 callback.call(null, i, obj[i]);
2521 }
2522 }
2523 }
2524 }
2525
2526 function objectMerge(obj1, obj2) {
2527 if (!obj2) {
2528 return obj1;
2529 }
2530 each(obj2, function(key, value) {
2531 obj1[key] = value;
2532 });
2533 return obj1;
2534 }
2535
2536 /**
2537 * This function is only used for react-native.
2538 * react-native freezes object that have already been sent over the
2539 * js bridge. We need this function in order to check if the object is frozen.
2540 * So it's ok that objectFrozen returns false if Object.isFrozen is not
2541 * supported because it's not relevant for other "platforms". See related issue:
2542 * https://github.com/getsentry/react-native-sentry/issues/57
2543 */
2544 function objectFrozen(obj) {
2545 if (!Object.isFrozen) {
2546 return false;
2547 }
2548 return Object.isFrozen(obj);
2549 }
2550
2551 function truncate(str, max) {
2552 return !max || str.length <= max ? str : str.substr(0, max) + '\u2026';
2553 }
2554
2555 /**
2556 * hasKey, a better form of hasOwnProperty
2557 * Example: hasKey(MainHostObject, property) === true/false
2558 *
2559 * @param {Object} host object to check property
2560 * @param {string} key to check
2561 */
2562 function hasKey(object, key) {
2563 return Object.prototype.hasOwnProperty.call(object, key);
2564 }
2565
2566 function joinRegExp(patterns) {
2567 // Combine an array of regular expressions and strings into one large regexp
2568 // Be mad.
2569 var sources = [],
2570 i = 0,
2571 len = patterns.length,
2572 pattern;
2573
2574 for (; i < len; i++) {
2575 pattern = patterns[i];
2576 if (isString(pattern)) {
2577 // If it's a string, we need to escape it
2578 // Taken from: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions
2579 sources.push(pattern.replace(/([.*+?^=!:${}()|\[\]\/\\])/g, '\\$1'));
2580 } else if (pattern && pattern.source) {
2581 // If it's a regexp already, we want to extract the source
2582 sources.push(pattern.source);
2583 }
2584 // Intentionally skip other cases
2585 }
2586 return new RegExp(sources.join('|'), 'i');
2587 }
2588
2589 function urlencode(o) {
2590 var pairs = [];
2591 each(o, function(key, value) {
2592 pairs.push(encodeURIComponent(key) + '=' + encodeURIComponent(value));
2593 });
2594 return pairs.join('&');
2595 }
2596
2597 // borrowed from https://tools.ietf.org/html/rfc3986#appendix-B
2598 // intentionally using regex and not <a/> href parsing trick because React Native and other
2599 // environments where DOM might not be available
2600 function parseUrl(url) {
2601 var match = url.match(/^(([^:\/?#]+):)?(\/\/([^\/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?$/);
2602 if (!match) return {};
2603
2604 // coerce to undefined values to empty string so we don't get 'undefined'
2605 var query = match[6] || '';
2606 var fragment = match[8] || '';
2607 return {
2608 protocol: match[2],
2609 host: match[4],
2610 path: match[5],
2611 relative: match[5] + query + fragment // everything minus origin
2612 };
2613 }
2614 function uuid4() {
2615 var crypto = _window.crypto || _window.msCrypto;
2616
2617 if (!isUndefined(crypto) && crypto.getRandomValues) {
2618 // Use window.crypto API if available
2619 // eslint-disable-next-line no-undef
2620 var arr = new Uint16Array(8);
2621 crypto.getRandomValues(arr);
2622
2623 // set 4 in byte 7
2624 arr[3] = (arr[3] & 0xfff) | 0x4000;
2625 // set 2 most significant bits of byte 9 to '10'
2626 arr[4] = (arr[4] & 0x3fff) | 0x8000;
2627
2628 var pad = function(num) {
2629 var v = num.toString(16);
2630 while (v.length < 4) {
2631 v = '0' + v;
2632 }
2633 return v;
2634 };
2635
2636 return (
2637 pad(arr[0]) +
2638 pad(arr[1]) +
2639 pad(arr[2]) +
2640 pad(arr[3]) +
2641 pad(arr[4]) +
2642 pad(arr[5]) +
2643 pad(arr[6]) +
2644 pad(arr[7])
2645 );
2646 } else {
2647 // http://stackoverflow.com/questions/105034/how-to-create-a-guid-uuid-in-javascript/2117523#2117523
2648 return 'xxxxxxxxxxxx4xxxyxxxxxxxxxxxxxxx'.replace(/[xy]/g, function(c) {
2649 var r = (Math.random() * 16) | 0,
2650 v = c === 'x' ? r : (r & 0x3) | 0x8;
2651 return v.toString(16);
2652 });
2653 }
2654 }
2655
2656 /**
2657 * Given a child DOM element, returns a query-selector statement describing that
2658 * and its ancestors
2659 * e.g. [HTMLElement] => body > div > input#foo.btn[name=baz]
2660 * @param elem
2661 * @returns {string}
2662 */
2663 function htmlTreeAsString(elem) {
2664 /* eslint no-extra-parens:0*/
2665 var MAX_TRAVERSE_HEIGHT = 5,
2666 MAX_OUTPUT_LEN = 80,
2667 out = [],
2668 height = 0,
2669 len = 0,
2670 separator = ' > ',
2671 sepLength = separator.length,
2672 nextStr;
2673
2674 while (elem && height++ < MAX_TRAVERSE_HEIGHT) {
2675 nextStr = htmlElementAsString(elem);
2676 // bail out if
2677 // - nextStr is the 'html' element
2678 // - the length of the string that would be created exceeds MAX_OUTPUT_LEN
2679 // (ignore this limit if we are on the first iteration)
2680 if (
2681 nextStr === 'html' ||
2682 (height > 1 && len + out.length * sepLength + nextStr.length >= MAX_OUTPUT_LEN)
2683 ) {
2684 break;
2685 }
2686
2687 out.push(nextStr);
2688
2689 len += nextStr.length;
2690 elem = elem.parentNode;
2691 }
2692
2693 return out.reverse().join(separator);
2694 }
2695
2696 /**
2697 * Returns a simple, query-selector representation of a DOM element
2698 * e.g. [HTMLElement] => input#foo.btn[name=baz]
2699 * @param HTMLElement
2700 * @returns {string}
2701 */
2702 function htmlElementAsString(elem) {
2703 var out = [],
2704 className,
2705 classes,
2706 key,
2707 attr,
2708 i;
2709
2710 if (!elem || !elem.tagName) {
2711 return '';
2712 }
2713
2714 out.push(elem.tagName.toLowerCase());
2715 if (elem.id) {
2716 out.push('#' + elem.id);
2717 }
2718
2719 className = elem.className;
2720 if (className && isString(className)) {
2721 classes = className.split(/\s+/);
2722 for (i = 0; i < classes.length; i++) {
2723 out.push('.' + classes[i]);
2724 }
2725 }
2726 var attrWhitelist = ['type', 'name', 'title', 'alt'];
2727 for (i = 0; i < attrWhitelist.length; i++) {
2728 key = attrWhitelist[i];
2729 attr = elem.getAttribute(key);
2730 if (attr) {
2731 out.push('[' + key + '="' + attr + '"]');
2732 }
2733 }
2734 return out.join('');
2735 }
2736
2737 /**
2738 * Returns true if either a OR b is truthy, but not both
2739 */
2740 function isOnlyOneTruthy(a, b) {
2741 return !!(!!a ^ !!b);
2742 }
2743
2744 /**
2745 * Returns true if the two input exception interfaces have the same content
2746 */
2747 function isSameException(ex1, ex2) {
2748 if (isOnlyOneTruthy(ex1, ex2)) return false;
2749
2750 ex1 = ex1.values[0];
2751 ex2 = ex2.values[0];
2752
2753 if (ex1.type !== ex2.type || ex1.value !== ex2.value) return false;
2754
2755 return isSameStacktrace(ex1.stacktrace, ex2.stacktrace);
2756 }
2757
2758 /**
2759 * Returns true if the two input stack trace interfaces have the same content
2760 */
2761 function isSameStacktrace(stack1, stack2) {
2762 if (isOnlyOneTruthy(stack1, stack2)) return false;
2763
2764 var frames1 = stack1.frames;
2765 var frames2 = stack2.frames;
2766
2767 // Exit early if frame count differs
2768 if (frames1.length !== frames2.length) return false;
2769
2770 // Iterate through every frame; bail out if anything differs
2771 var a, b;
2772 for (var i = 0; i < frames1.length; i++) {
2773 a = frames1[i];
2774 b = frames2[i];
2775 if (
2776 a.filename !== b.filename ||
2777 a.lineno !== b.lineno ||
2778 a.colno !== b.colno ||
2779 a['function'] !== b['function']
2780 )
2781 return false;
2782 }
2783 return true;
2784 }
2785
2786 /**
2787 * Polyfill a method
2788 * @param obj object e.g. `document`
2789 * @param name method name present on object e.g. `addEventListener`
2790 * @param replacement replacement function
2791 * @param track {optional} record instrumentation to an array
2792 */
2793 function fill(obj, name, replacement, track) {
2794 var orig = obj[name];
2795 obj[name] = replacement(orig);
2796 if (track) {
2797 track.push([obj, name, orig]);
2798 }
2799 }
2800
2801 module.exports = {
2802 isObject: isObject,
2803 isError: isError,
2804 isErrorEvent: isErrorEvent,
2805 isUndefined: isUndefined,
2806 isFunction: isFunction,
2807 isString: isString,
2808 isEmptyObject: isEmptyObject,
2809 supportsErrorEvent: supportsErrorEvent,
2810 wrappedCallback: wrappedCallback,
2811 each: each,
2812 objectMerge: objectMerge,
2813 truncate: truncate,
2814 objectFrozen: objectFrozen,
2815 hasKey: hasKey,
2816 joinRegExp: joinRegExp,
2817 urlencode: urlencode,
2818 uuid4: uuid4,
2819 htmlTreeAsString: htmlTreeAsString,
2820 htmlElementAsString: htmlElementAsString,
2821 isSameException: isSameException,
2822 isSameStacktrace: isSameStacktrace,
2823 parseUrl: parseUrl,
2824 fill: fill
2825 };
2826
2827
2828 /***/ }),
2829
2830 /***/ "./node_modules/raven-js/vendor/TraceKit/tracekit.js":
2831 /*!***********************************************************!*\
2832 !*** ./node_modules/raven-js/vendor/TraceKit/tracekit.js ***!
2833 \***********************************************************/
2834 /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
2835
2836 var utils = __webpack_require__(/*! ../../src/utils */ "./node_modules/raven-js/src/utils.js");
2837
2838 /*
2839 TraceKit - Cross brower stack traces
2840
2841 This was originally forked from github.com/occ/TraceKit, but has since been
2842 largely re-written and is now maintained as part of raven-js. Tests for
2843 this are in test/vendor.
2844
2845 MIT license
2846 */
2847
2848 var TraceKit = {
2849 collectWindowErrors: true,
2850 debug: false
2851 };
2852
2853 // This is to be defensive in environments where window does not exist (see https://github.com/getsentry/raven-js/pull/785)
2854 var _window =
2855 typeof window !== 'undefined'
2856 ? window
2857 : typeof __webpack_require__.g !== 'undefined' ? __webpack_require__.g : typeof self !== 'undefined' ? self : {};
2858
2859 // global reference to slice
2860 var _slice = [].slice;
2861 var UNKNOWN_FUNCTION = '?';
2862
2863 // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error#Error_types
2864 var ERROR_TYPES_RE = /^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/;
2865
2866 function getLocationHref() {
2867 if (typeof document === 'undefined' || document.location == null) return '';
2868
2869 return document.location.href;
2870 }
2871
2872 /**
2873 * TraceKit.report: cross-browser processing of unhandled exceptions
2874 *
2875 * Syntax:
2876 * TraceKit.report.subscribe(function(stackInfo) { ... })
2877 * TraceKit.report.unsubscribe(function(stackInfo) { ... })
2878 * TraceKit.report(exception)
2879 * try { ...code... } catch(ex) { TraceKit.report(ex); }
2880 *
2881 * Supports:
2882 * - Firefox: full stack trace with line numbers, plus column number
2883 * on top frame; column number is not guaranteed
2884 * - Opera: full stack trace with line and column numbers
2885 * - Chrome: full stack trace with line and column numbers
2886 * - Safari: line and column number for the top frame only; some frames
2887 * may be missing, and column number is not guaranteed
2888 * - IE: line and column number for the top frame only; some frames
2889 * may be missing, and column number is not guaranteed
2890 *
2891 * In theory, TraceKit should work on all of the following versions:
2892 * - IE5.5+ (only 8.0 tested)
2893 * - Firefox 0.9+ (only 3.5+ tested)
2894 * - Opera 7+ (only 10.50 tested; versions 9 and earlier may require
2895 * Exceptions Have Stacktrace to be enabled in opera:config)
2896 * - Safari 3+ (only 4+ tested)
2897 * - Chrome 1+ (only 5+ tested)
2898 * - Konqueror 3.5+ (untested)
2899 *
2900 * Requires TraceKit.computeStackTrace.
2901 *
2902 * Tries to catch all unhandled exceptions and report them to the
2903 * subscribed handlers. Please note that TraceKit.report will rethrow the
2904 * exception. This is REQUIRED in order to get a useful stack trace in IE.
2905 * If the exception does not reach the top of the browser, you will only
2906 * get a stack trace from the point where TraceKit.report was called.
2907 *
2908 * Handlers receive a stackInfo object as described in the
2909 * TraceKit.computeStackTrace docs.
2910 */
2911 TraceKit.report = (function reportModuleWrapper() {
2912 var handlers = [],
2913 lastArgs = null,
2914 lastException = null,
2915 lastExceptionStack = null;
2916
2917 /**
2918 * Add a crash handler.
2919 * @param {Function} handler
2920 */
2921 function subscribe(handler) {
2922 installGlobalHandler();
2923 handlers.push(handler);
2924 }
2925
2926 /**
2927 * Remove a crash handler.
2928 * @param {Function} handler
2929 */
2930 function unsubscribe(handler) {
2931 for (var i = handlers.length - 1; i >= 0; --i) {
2932 if (handlers[i] === handler) {
2933 handlers.splice(i, 1);
2934 }
2935 }
2936 }
2937
2938 /**
2939 * Remove all crash handlers.
2940 */
2941 function unsubscribeAll() {
2942 uninstallGlobalHandler();
2943 handlers = [];
2944 }
2945
2946 /**
2947 * Dispatch stack information to all handlers.
2948 * @param {Object.<string, *>} stack
2949 */
2950 function notifyHandlers(stack, isWindowError) {
2951 var exception = null;
2952 if (isWindowError && !TraceKit.collectWindowErrors) {
2953 return;
2954 }
2955 for (var i in handlers) {
2956 if (handlers.hasOwnProperty(i)) {
2957 try {
2958 handlers[i].apply(null, [stack].concat(_slice.call(arguments, 2)));
2959 } catch (inner) {
2960 exception = inner;
2961 }
2962 }
2963 }
2964
2965 if (exception) {
2966 throw exception;
2967 }
2968 }
2969
2970 var _oldOnerrorHandler, _onErrorHandlerInstalled;
2971
2972 /**
2973 * Ensures all global unhandled exceptions are recorded.
2974 * Supported by Gecko and IE.
2975 * @param {string} message Error message.
2976 * @param {string} url URL of script that generated the exception.
2977 * @param {(number|string)} lineNo The line number at which the error
2978 * occurred.
2979 * @param {?(number|string)} colNo The column number at which the error
2980 * occurred.
2981 * @param {?Error} ex The actual Error object.
2982 */
2983 function traceKitWindowOnError(message, url, lineNo, colNo, ex) {
2984 var stack = null;
2985
2986 if (lastExceptionStack) {
2987 TraceKit.computeStackTrace.augmentStackTraceWithInitialElement(
2988 lastExceptionStack,
2989 url,
2990 lineNo,
2991 message
2992 );
2993 processLastException();
2994 } else if (ex && utils.isError(ex)) {
2995 // non-string `ex` arg; attempt to extract stack trace
2996
2997 // New chrome and blink send along a real error object
2998 // Let's just report that like a normal error.
2999 // See: https://mikewest.org/2013/08/debugging-runtime-errors-with-window-onerror
3000 stack = TraceKit.computeStackTrace(ex);
3001 notifyHandlers(stack, true);
3002 } else {
3003 var location = {
3004 url: url,
3005 line: lineNo,
3006 column: colNo
3007 };
3008
3009 var name = undefined;
3010 var msg = message; // must be new var or will modify original `arguments`
3011 var groups;
3012 if ({}.toString.call(message) === '[object String]') {
3013 var groups = message.match(ERROR_TYPES_RE);
3014 if (groups) {
3015 name = groups[1];
3016 msg = groups[2];
3017 }
3018 }
3019
3020 location.func = UNKNOWN_FUNCTION;
3021
3022 stack = {
3023 name: name,
3024 message: msg,
3025 url: getLocationHref(),
3026 stack: [location]
3027 };
3028 notifyHandlers(stack, true);
3029 }
3030
3031 if (_oldOnerrorHandler) {
3032 return _oldOnerrorHandler.apply(this, arguments);
3033 }
3034
3035 return false;
3036 }
3037
3038 function installGlobalHandler() {
3039 if (_onErrorHandlerInstalled) {
3040 return;
3041 }
3042 _oldOnerrorHandler = _window.onerror;
3043 _window.onerror = traceKitWindowOnError;
3044 _onErrorHandlerInstalled = true;
3045 }
3046
3047 function uninstallGlobalHandler() {
3048 if (!_onErrorHandlerInstalled) {
3049 return;
3050 }
3051 _window.onerror = _oldOnerrorHandler;
3052 _onErrorHandlerInstalled = false;
3053 _oldOnerrorHandler = undefined;
3054 }
3055
3056 function processLastException() {
3057 var _lastExceptionStack = lastExceptionStack,
3058 _lastArgs = lastArgs;
3059 lastArgs = null;
3060 lastExceptionStack = null;
3061 lastException = null;
3062 notifyHandlers.apply(null, [_lastExceptionStack, false].concat(_lastArgs));
3063 }
3064
3065 /**
3066 * Reports an unhandled Error to TraceKit.
3067 * @param {Error} ex
3068 * @param {?boolean} rethrow If false, do not re-throw the exception.
3069 * Only used for window.onerror to not cause an infinite loop of
3070 * rethrowing.
3071 */
3072 function report(ex, rethrow) {
3073 var args = _slice.call(arguments, 1);
3074 if (lastExceptionStack) {
3075 if (lastException === ex) {
3076 return; // already caught by an inner catch block, ignore
3077 } else {
3078 processLastException();
3079 }
3080 }
3081
3082 var stack = TraceKit.computeStackTrace(ex);
3083 lastExceptionStack = stack;
3084 lastException = ex;
3085 lastArgs = args;
3086
3087 // If the stack trace is incomplete, wait for 2 seconds for
3088 // slow slow IE to see if onerror occurs or not before reporting
3089 // this exception; otherwise, we will end up with an incomplete
3090 // stack trace
3091 setTimeout(function() {
3092 if (lastException === ex) {
3093 processLastException();
3094 }
3095 }, stack.incomplete ? 2000 : 0);
3096
3097 if (rethrow !== false) {
3098 throw ex; // re-throw to propagate to the top level (and cause window.onerror)
3099 }
3100 }
3101
3102 report.subscribe = subscribe;
3103 report.unsubscribe = unsubscribe;
3104 report.uninstall = unsubscribeAll;
3105 return report;
3106 })();
3107
3108 /**
3109 * TraceKit.computeStackTrace: cross-browser stack traces in JavaScript
3110 *
3111 * Syntax:
3112 * s = TraceKit.computeStackTrace(exception) // consider using TraceKit.report instead (see below)
3113 * Returns:
3114 * s.name - exception name
3115 * s.message - exception message
3116 * s.stack[i].url - JavaScript or HTML file URL
3117 * s.stack[i].func - function name, or empty for anonymous functions (if guessing did not work)
3118 * s.stack[i].args - arguments passed to the function, if known
3119 * s.stack[i].line - line number, if known
3120 * s.stack[i].column - column number, if known
3121 *
3122 * Supports:
3123 * - Firefox: full stack trace with line numbers and unreliable column
3124 * number on top frame
3125 * - Opera 10: full stack trace with line and column numbers
3126 * - Opera 9-: full stack trace with line numbers
3127 * - Chrome: full stack trace with line and column numbers
3128 * - Safari: line and column number for the topmost stacktrace element
3129 * only
3130 * - IE: no line numbers whatsoever
3131 *
3132 * Tries to guess names of anonymous functions by looking for assignments
3133 * in the source code. In IE and Safari, we have to guess source file names
3134 * by searching for function bodies inside all page scripts. This will not
3135 * work for scripts that are loaded cross-domain.
3136 * Here be dragons: some function names may be guessed incorrectly, and
3137 * duplicate functions may be mismatched.
3138 *
3139 * TraceKit.computeStackTrace should only be used for tracing purposes.
3140 * Logging of unhandled exceptions should be done with TraceKit.report,
3141 * which builds on top of TraceKit.computeStackTrace and provides better
3142 * IE support by utilizing the window.onerror event to retrieve information
3143 * about the top of the stack.
3144 *
3145 * Note: In IE and Safari, no stack trace is recorded on the Error object,
3146 * so computeStackTrace instead walks its *own* chain of callers.
3147 * This means that:
3148 * * in Safari, some methods may be missing from the stack trace;
3149 * * in IE, the topmost function in the stack trace will always be the
3150 * caller of computeStackTrace.
3151 *
3152 * This is okay for tracing (because you are likely to be calling
3153 * computeStackTrace from the function you want to be the topmost element
3154 * of the stack trace anyway), but not okay for logging unhandled
3155 * exceptions (because your catch block will likely be far away from the
3156 * inner function that actually caused the exception).
3157 *
3158 */
3159 TraceKit.computeStackTrace = (function computeStackTraceWrapper() {
3160 // Contents of Exception in various browsers.
3161 //
3162 // SAFARI:
3163 // ex.message = Can't find variable: qq
3164 // ex.line = 59
3165 // ex.sourceId = 580238192
3166 // ex.sourceURL = http://...
3167 // ex.expressionBeginOffset = 96
3168 // ex.expressionCaretOffset = 98
3169 // ex.expressionEndOffset = 98
3170 // ex.name = ReferenceError
3171 //
3172 // FIREFOX:
3173 // ex.message = qq is not defined
3174 // ex.fileName = http://...
3175 // ex.lineNumber = 59
3176 // ex.columnNumber = 69
3177 // ex.stack = ...stack trace... (see the example below)
3178 // ex.name = ReferenceError
3179 //
3180 // CHROME:
3181 // ex.message = qq is not defined
3182 // ex.name = ReferenceError
3183 // ex.type = not_defined
3184 // ex.arguments = ['aa']
3185 // ex.stack = ...stack trace...
3186 //
3187 // INTERNET EXPLORER:
3188 // ex.message = ...
3189 // ex.name = ReferenceError
3190 //
3191 // OPERA:
3192 // ex.message = ...message... (see the example below)
3193 // ex.name = ReferenceError
3194 // ex.opera#sourceloc = 11 (pretty much useless, duplicates the info in ex.message)
3195 // ex.stacktrace = n/a; see 'opera:config#UserPrefs|Exceptions Have Stacktrace'
3196
3197 /**
3198 * Computes stack trace information from the stack property.
3199 * Chrome and Gecko use this property.
3200 * @param {Error} ex
3201 * @return {?Object.<string, *>} Stack trace information.
3202 */
3203 function computeStackTraceFromStackProp(ex) {
3204 if (typeof ex.stack === 'undefined' || !ex.stack) return;
3205
3206 var chrome = /^\s*at (.*?) ?\(((?:file|https?|blob|chrome-extension|native|eval|webpack|<anonymous>|[a-z]:|\/).*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,
3207 gecko = /^\s*(.*?)(?:\((.*?)\))?(?:^|@)((?:file|https?|blob|chrome|webpack|resource|\[native).*?|[^@]*bundle)(?::(\d+))?(?::(\d+))?\s*$/i,
3208 winjs = /^\s*at (?:((?:\[object object\])?.+) )?\(?((?:file|ms-appx|https?|webpack|blob):.*?):(\d+)(?::(\d+))?\)?\s*$/i,
3209 // Used to additionally parse URL/line/column from eval frames
3210 geckoEval = /(\S+) line (\d+)(?: > eval line \d+)* > eval/i,
3211 chromeEval = /\((\S*)(?::(\d+))(?::(\d+))\)/,
3212 lines = ex.stack.split('\n'),
3213 stack = [],
3214 submatch,
3215 parts,
3216 element,
3217 reference = /^(.*) is undefined$/.exec(ex.message);
3218
3219 for (var i = 0, j = lines.length; i < j; ++i) {
3220 if ((parts = chrome.exec(lines[i]))) {
3221 var isNative = parts[2] && parts[2].indexOf('native') === 0; // start of line
3222 var isEval = parts[2] && parts[2].indexOf('eval') === 0; // start of line
3223 if (isEval && (submatch = chromeEval.exec(parts[2]))) {
3224 // throw out eval line/column and use top-most line/column number
3225 parts[2] = submatch[1]; // url
3226 parts[3] = submatch[2]; // line
3227 parts[4] = submatch[3]; // column
3228 }
3229 element = {
3230 url: !isNative ? parts[2] : null,
3231 func: parts[1] || UNKNOWN_FUNCTION,
3232 args: isNative ? [parts[2]] : [],
3233 line: parts[3] ? +parts[3] : null,
3234 column: parts[4] ? +parts[4] : null
3235 };
3236 } else if ((parts = winjs.exec(lines[i]))) {
3237 element = {
3238 url: parts[2],
3239 func: parts[1] || UNKNOWN_FUNCTION,
3240 args: [],
3241 line: +parts[3],
3242 column: parts[4] ? +parts[4] : null
3243 };
3244 } else if ((parts = gecko.exec(lines[i]))) {
3245 var isEval = parts[3] && parts[3].indexOf(' > eval') > -1;
3246 if (isEval && (submatch = geckoEval.exec(parts[3]))) {
3247 // throw out eval line/column and use top-most line number
3248 parts[3] = submatch[1];
3249 parts[4] = submatch[2];
3250 parts[5] = null; // no column when eval
3251 } else if (i === 0 && !parts[5] && typeof ex.columnNumber !== 'undefined') {
3252 // FireFox uses this awesome columnNumber property for its top frame
3253 // Also note, Firefox's column number is 0-based and everything else expects 1-based,
3254 // so adding 1
3255 // NOTE: this hack doesn't work if top-most frame is eval
3256 stack[0].column = ex.columnNumber + 1;
3257 }
3258 element = {
3259 url: parts[3],
3260 func: parts[1] || UNKNOWN_FUNCTION,
3261 args: parts[2] ? parts[2].split(',') : [],
3262 line: parts[4] ? +parts[4] : null,
3263 column: parts[5] ? +parts[5] : null
3264 };
3265 } else {
3266 continue;
3267 }
3268
3269 if (!element.func && element.line) {
3270 element.func = UNKNOWN_FUNCTION;
3271 }
3272
3273 stack.push(element);
3274 }
3275
3276 if (!stack.length) {
3277 return null;
3278 }
3279
3280 return {
3281 name: ex.name,
3282 message: ex.message,
3283 url: getLocationHref(),
3284 stack: stack
3285 };
3286 }
3287
3288 /**
3289 * Adds information about the first frame to incomplete stack traces.
3290 * Safari and IE require this to get complete data on the first frame.
3291 * @param {Object.<string, *>} stackInfo Stack trace information from
3292 * one of the compute* methods.
3293 * @param {string} url The URL of the script that caused an error.
3294 * @param {(number|string)} lineNo The line number of the script that
3295 * caused an error.
3296 * @param {string=} message The error generated by the browser, which
3297 * hopefully contains the name of the object that caused the error.
3298 * @return {boolean} Whether or not the stack information was
3299 * augmented.
3300 */
3301 function augmentStackTraceWithInitialElement(stackInfo, url, lineNo, message) {
3302 var initial = {
3303 url: url,
3304 line: lineNo
3305 };
3306
3307 if (initial.url && initial.line) {
3308 stackInfo.incomplete = false;
3309
3310 if (!initial.func) {
3311 initial.func = UNKNOWN_FUNCTION;
3312 }
3313
3314 if (stackInfo.stack.length > 0) {
3315 if (stackInfo.stack[0].url === initial.url) {
3316 if (stackInfo.stack[0].line === initial.line) {
3317 return false; // already in stack trace
3318 } else if (
3319 !stackInfo.stack[0].line &&
3320 stackInfo.stack[0].func === initial.func
3321 ) {
3322 stackInfo.stack[0].line = initial.line;
3323 return false;
3324 }
3325 }
3326 }
3327
3328 stackInfo.stack.unshift(initial);
3329 stackInfo.partial = true;
3330 return true;
3331 } else {
3332 stackInfo.incomplete = true;
3333 }
3334
3335 return false;
3336 }
3337
3338 /**
3339 * Computes stack trace information by walking the arguments.caller
3340 * chain at the time the exception occurred. This will cause earlier
3341 * frames to be missed but is the only way to get any stack trace in
3342 * Safari and IE. The top frame is restored by
3343 * {@link augmentStackTraceWithInitialElement}.
3344 * @param {Error} ex
3345 * @return {?Object.<string, *>} Stack trace information.
3346 */
3347 function computeStackTraceByWalkingCallerChain(ex, depth) {
3348 var functionName = /function\s+([_$a-zA-Z\xA0-\uFFFF][_$a-zA-Z0-9\xA0-\uFFFF]*)?\s*\(/i,
3349 stack = [],
3350 funcs = {},
3351 recursion = false,
3352 parts,
3353 item,
3354 source;
3355
3356 for (
3357 var curr = computeStackTraceByWalkingCallerChain.caller;
3358 curr && !recursion;
3359 curr = curr.caller
3360 ) {
3361 if (curr === computeStackTrace || curr === TraceKit.report) {
3362 // console.log('skipping internal function');
3363 continue;
3364 }
3365
3366 item = {
3367 url: null,
3368 func: UNKNOWN_FUNCTION,
3369 line: null,
3370 column: null
3371 };
3372
3373 if (curr.name) {
3374 item.func = curr.name;
3375 } else if ((parts = functionName.exec(curr.toString()))) {
3376 item.func = parts[1];
3377 }
3378
3379 if (typeof item.func === 'undefined') {
3380 try {
3381 item.func = parts.input.substring(0, parts.input.indexOf('{'));
3382 } catch (e) {}
3383 }
3384
3385 if (funcs['' + curr]) {
3386 recursion = true;
3387 } else {
3388 funcs['' + curr] = true;
3389 }
3390
3391 stack.push(item);
3392 }
3393
3394 if (depth) {
3395 // console.log('depth is ' + depth);
3396 // console.log('stack is ' + stack.length);
3397 stack.splice(0, depth);
3398 }
3399
3400 var result = {
3401 name: ex.name,
3402 message: ex.message,
3403 url: getLocationHref(),
3404 stack: stack
3405 };
3406 augmentStackTraceWithInitialElement(
3407 result,
3408 ex.sourceURL || ex.fileName,
3409 ex.line || ex.lineNumber,
3410 ex.message || ex.description
3411 );
3412 return result;
3413 }
3414
3415 /**
3416 * Computes a stack trace for an exception.
3417 * @param {Error} ex
3418 * @param {(string|number)=} depth
3419 */
3420 function computeStackTrace(ex, depth) {
3421 var stack = null;
3422 depth = depth == null ? 0 : +depth;
3423
3424 try {
3425 stack = computeStackTraceFromStackProp(ex);
3426 if (stack) {
3427 return stack;
3428 }
3429 } catch (e) {
3430 if (TraceKit.debug) {
3431 throw e;
3432 }
3433 }
3434
3435 try {
3436 stack = computeStackTraceByWalkingCallerChain(ex, depth + 1);
3437 if (stack) {
3438 return stack;
3439 }
3440 } catch (e) {
3441 if (TraceKit.debug) {
3442 throw e;
3443 }
3444 }
3445 return {
3446 name: ex.name,
3447 message: ex.message,
3448 url: getLocationHref()
3449 };
3450 }
3451
3452 computeStackTrace.augmentStackTraceWithInitialElement = augmentStackTraceWithInitialElement;
3453 computeStackTrace.computeStackTraceFromStackProp = computeStackTraceFromStackProp;
3454
3455 return computeStackTrace;
3456 })();
3457
3458 module.exports = TraceKit;
3459
3460
3461 /***/ }),
3462
3463 /***/ "./node_modules/raven-js/vendor/json-stringify-safe/stringify.js":
3464 /*!***********************************************************************!*\
3465 !*** ./node_modules/raven-js/vendor/json-stringify-safe/stringify.js ***!
3466 \***********************************************************************/
3467 /***/ ((module, exports) => {
3468
3469 /*
3470 json-stringify-safe
3471 Like JSON.stringify, but doesn't throw on circular references.
3472
3473 Originally forked from https://github.com/isaacs/json-stringify-safe
3474 version 5.0.1 on 3/8/2017 and modified to handle Errors serialization
3475 and IE8 compatibility. Tests for this are in test/vendor.
3476
3477 ISC license: https://github.com/isaacs/json-stringify-safe/blob/master/LICENSE
3478 */
3479
3480 exports = module.exports = stringify;
3481 exports.getSerialize = serializer;
3482
3483 function indexOf(haystack, needle) {
3484 for (var i = 0; i < haystack.length; ++i) {
3485 if (haystack[i] === needle) return i;
3486 }
3487 return -1;
3488 }
3489
3490 function stringify(obj, replacer, spaces, cycleReplacer) {
3491 return JSON.stringify(obj, serializer(replacer, cycleReplacer), spaces);
3492 }
3493
3494 // https://github.com/ftlabs/js-abbreviate/blob/fa709e5f139e7770a71827b1893f22418097fbda/index.js#L95-L106
3495 function stringifyError(value) {
3496 var err = {
3497 // These properties are implemented as magical getters and don't show up in for in
3498 stack: value.stack,
3499 message: value.message,
3500 name: value.name
3501 };
3502
3503 for (var i in value) {
3504 if (Object.prototype.hasOwnProperty.call(value, i)) {
3505 err[i] = value[i];
3506 }
3507 }
3508
3509 return err;
3510 }
3511
3512 function serializer(replacer, cycleReplacer) {
3513 var stack = [];
3514 var keys = [];
3515
3516 if (cycleReplacer == null) {
3517 cycleReplacer = function(key, value) {
3518 if (stack[0] === value) {
3519 return '[Circular ~]';
3520 }
3521 return '[Circular ~.' + keys.slice(0, indexOf(stack, value)).join('.') + ']';
3522 };
3523 }
3524
3525 return function(key, value) {
3526 if (stack.length > 0) {
3527 var thisPos = indexOf(stack, this);
3528 ~thisPos ? stack.splice(thisPos + 1) : stack.push(this);
3529 ~thisPos ? keys.splice(thisPos, Infinity, key) : keys.push(key);
3530
3531 if (~indexOf(stack, value)) {
3532 value = cycleReplacer.call(this, key, value);
3533 }
3534 } else {
3535 stack.push(value);
3536 }
3537
3538 return replacer == null
3539 ? value instanceof Error ? stringifyError(value) : value
3540 : replacer.call(this, key, value);
3541 };
3542 }
3543
3544
3545 /***/ }),
3546
3547 /***/ "jquery":
3548 /*!*************************!*\
3549 !*** external "jQuery" ***!
3550 \*************************/
3551 /***/ ((module) => {
3552
3553 "use strict";
3554 module.exports = window["jQuery"];
3555
3556 /***/ })
3557
3558 /******/ });
3559 /************************************************************************/
3560 /******/ // The module cache
3561 /******/ var __webpack_module_cache__ = {};
3562 /******/
3563 /******/ // The require function
3564 /******/ function __webpack_require__(moduleId) {
3565 /******/ // Check if module is in cache
3566 /******/ var cachedModule = __webpack_module_cache__[moduleId];
3567 /******/ if (cachedModule !== undefined) {
3568 /******/ return cachedModule.exports;
3569 /******/ }
3570 /******/ // Create a new module (and put it into the cache)
3571 /******/ var module = __webpack_module_cache__[moduleId] = {
3572 /******/ // no module.id needed
3573 /******/ // no module.loaded needed
3574 /******/ exports: {}
3575 /******/ };
3576 /******/
3577 /******/ // Execute the module function
3578 /******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
3579 /******/
3580 /******/ // Return the exports of the module
3581 /******/ return module.exports;
3582 /******/ }
3583 /******/
3584 /************************************************************************/
3585 /******/ /* webpack/runtime/compat get default export */
3586 /******/ (() => {
3587 /******/ // getDefaultExport function for compatibility with non-harmony modules
3588 /******/ __webpack_require__.n = (module) => {
3589 /******/ var getter = module && module.__esModule ?
3590 /******/ () => (module['default']) :
3591 /******/ () => (module);
3592 /******/ __webpack_require__.d(getter, { a: getter });
3593 /******/ return getter;
3594 /******/ };
3595 /******/ })();
3596 /******/
3597 /******/ /* webpack/runtime/define property getters */
3598 /******/ (() => {
3599 /******/ // define getter functions for harmony exports
3600 /******/ __webpack_require__.d = (exports, definition) => {
3601 /******/ for(var key in definition) {
3602 /******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
3603 /******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
3604 /******/ }
3605 /******/ }
3606 /******/ };
3607 /******/ })();
3608 /******/
3609 /******/ /* webpack/runtime/global */
3610 /******/ (() => {
3611 /******/ __webpack_require__.g = (function() {
3612 /******/ if (typeof globalThis === 'object') return globalThis;
3613 /******/ try {
3614 /******/ return this || new Function('return this')();
3615 /******/ } catch (e) {
3616 /******/ if (typeof window === 'object') return window;
3617 /******/ }
3618 /******/ })();
3619 /******/ })();
3620 /******/
3621 /******/ /* webpack/runtime/hasOwnProperty shorthand */
3622 /******/ (() => {
3623 /******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
3624 /******/ })();
3625 /******/
3626 /******/ /* webpack/runtime/make namespace object */
3627 /******/ (() => {
3628 /******/ // define __esModule on exports
3629 /******/ __webpack_require__.r = (exports) => {
3630 /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
3631 /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
3632 /******/ }
3633 /******/ Object.defineProperty(exports, '__esModule', { value: true });
3634 /******/ };
3635 /******/ })();
3636 /******/
3637 /************************************************************************/
3638 var __webpack_exports__ = {};
3639 // This entry need to be wrapped in an IIFE because it need to be in strict mode.
3640 (() => {
3641 "use strict";
3642 /*!*****************************************!*\
3643 !*** ./scripts/entries/reviewBanner.ts ***!
3644 \*****************************************/
3645 __webpack_require__.r(__webpack_exports__);
3646 /* harmony export */ __webpack_require__.d(__webpack_exports__, {
3647 /* harmony export */ "initMonitorReviewBanner": () => (/* binding */ initMonitorReviewBanner)
3648 /* harmony export */ });
3649 /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! jquery */ "jquery");
3650 /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(jquery__WEBPACK_IMPORTED_MODULE_0__);
3651 /* harmony import */ var _utils_backgroundAppUtils__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../utils/backgroundAppUtils */ "./scripts/utils/backgroundAppUtils.ts");
3652 /* harmony import */ var _constants_selectors__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../constants/selectors */ "./scripts/constants/selectors.ts");
3653 /* harmony import */ var _constants_leadinConfig__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../constants/leadinConfig */ "./scripts/constants/leadinConfig.ts");
3654 /* harmony import */ var _iframe_integratedMessages__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../iframe/integratedMessages */ "./scripts/iframe/integratedMessages/index.ts");
3655
3656
3657
3658
3659
3660 var REVIEW_BANNER_INTRO_PERIOD_DAYS = 15;
3661
3662 var userIsAfterIntroductoryPeriod = function userIsAfterIntroductoryPeriod() {
3663 var activationDate = new Date(+_constants_leadinConfig__WEBPACK_IMPORTED_MODULE_3__.activationTime * 1000);
3664 var currentDate = new Date();
3665 var timeElapsed = new Date(currentDate.getTime() - activationDate.getTime());
3666 return timeElapsed.getUTCDate() - 1 >= REVIEW_BANNER_INTRO_PERIOD_DAYS;
3667 };
3668 /**
3669 * Adds some methods to window when review banner is
3670 * displayed to monitor events
3671 */
3672
3673
3674 function initMonitorReviewBanner() {
3675 if (_constants_leadinConfig__WEBPACK_IMPORTED_MODULE_3__.refreshToken) {
3676 var embedder = (0,_utils_backgroundAppUtils__WEBPACK_IMPORTED_MODULE_1__.getOrCreateBackgroundApp)(_constants_leadinConfig__WEBPACK_IMPORTED_MODULE_3__.refreshToken);
3677 var container = jquery__WEBPACK_IMPORTED_MODULE_0___default()(_constants_selectors__WEBPACK_IMPORTED_MODULE_2__.domElements.reviewBannerContainer);
3678
3679 if (container && userIsAfterIntroductoryPeriod()) {
3680 jquery__WEBPACK_IMPORTED_MODULE_0___default()(_constants_selectors__WEBPACK_IMPORTED_MODULE_2__.domElements.reviewBannerLeaveReviewLink).off('click').on('click', function () {
3681 embedder.postMessage({
3682 key: _iframe_integratedMessages__WEBPACK_IMPORTED_MODULE_4__.ProxyMessages.TrackReviewBannerInteraction
3683 });
3684 });
3685 jquery__WEBPACK_IMPORTED_MODULE_0___default()(_constants_selectors__WEBPACK_IMPORTED_MODULE_2__.domElements.reviewBannerDismissButton).off('click').on('click', function () {
3686 embedder.postMessage({
3687 key: _iframe_integratedMessages__WEBPACK_IMPORTED_MODULE_4__.ProxyMessages.TrackReviewBannerDismissed
3688 });
3689 });
3690 embedder.postAsyncMessage({
3691 key: _iframe_integratedMessages__WEBPACK_IMPORTED_MODULE_4__.ProxyMessages.FetchContactsCreateSinceActivation,
3692 payload: +_constants_leadinConfig__WEBPACK_IMPORTED_MODULE_3__.activationTime * 1000
3693 }).then(function (_ref) {
3694 var total = _ref.total;
3695
3696 if (total >= 5) {
3697 container.removeClass('leadin-review-banner--hide');
3698 embedder.postMessage({
3699 key: _iframe_integratedMessages__WEBPACK_IMPORTED_MODULE_4__.ProxyMessages.TrackReviewBannerRender
3700 });
3701 }
3702 });
3703 }
3704 }
3705 }
3706 (0,_utils_backgroundAppUtils__WEBPACK_IMPORTED_MODULE_1__.initBackgroundApp)(initMonitorReviewBanner);
3707 })();
3708
3709 /******/ })()
3710 ;
3711 //# sourceMappingURL=reviewBanner.js.map