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

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