PluginProbe
HubSpot All-In-One Marketing – Forms, Popups, Live Chat / 11.0.54
HubSpot All-In-One Marketing – Forms, Popups, Live Chat v11.0.54
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.54, at build/reviewBanner.js

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