PluginProbe
HubSpot All-In-One Marketing – Forms, Popups, Live Chat / 11.3.65
HubSpot All-In-One Marketing – Forms, Popups, Live Chat v11.3.65
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 / reviewBanner.js

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

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