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

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

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