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

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

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