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

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