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

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