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

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