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

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