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

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