| 1 |
/******/ (() => { // webpackBootstrap |
| 2 |
/******/ var __webpack_modules__ = ({ |
| 3 |
|
| 4 |
/***/ "./node_modules/@emotion/memoize/dist/emotion-memoize.esm.js": |
| 5 |
/*!*******************************************************************!*\ |
| 6 |
!*** ./node_modules/@emotion/memoize/dist/emotion-memoize.esm.js ***! |
| 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 */ "default": () => (__WEBPACK_DEFAULT_EXPORT__) |
| 14 |
/* harmony export */ }); |
| 15 |
function memoize(fn) { |
| 16 |
var cache = Object.create(null); |
| 17 |
return function (arg) { |
| 18 |
if (cache[arg] === undefined) cache[arg] = fn(arg); |
| 19 |
return cache[arg]; |
| 20 |
}; |
| 21 |
} |
| 22 |
|
| 23 |
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (memoize); |
| 24 |
|
| 25 |
|
| 26 |
/***/ }), |
| 27 |
|
| 28 |
/***/ "./node_modules/@linaria/react/node_modules/@emotion/is-prop-valid/dist/emotion-is-prop-valid.esm.js": |
| 29 |
/*!***********************************************************************************************************!*\ |
| 30 |
!*** ./node_modules/@linaria/react/node_modules/@emotion/is-prop-valid/dist/emotion-is-prop-valid.esm.js ***! |
| 31 |
\***********************************************************************************************************/ |
| 32 |
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { |
| 33 |
|
| 34 |
"use strict"; |
| 35 |
__webpack_require__.r(__webpack_exports__); |
| 36 |
/* harmony export */ __webpack_require__.d(__webpack_exports__, { |
| 37 |
/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__) |
| 38 |
/* harmony export */ }); |
| 39 |
/* harmony import */ var _emotion_memoize__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @emotion/memoize */ "./node_modules/@emotion/memoize/dist/emotion-memoize.esm.js"); |
| 40 |
|
| 41 |
|
| 42 |
var reactPropsRegex = /^((children|dangerouslySetInnerHTML|key|ref|autoFocus|defaultValue|defaultChecked|innerHTML|suppressContentEditableWarning|suppressHydrationWarning|valueLink|abbr|accept|acceptCharset|accessKey|action|allow|allowUserMedia|allowPaymentRequest|allowFullScreen|allowTransparency|alt|async|autoComplete|autoPlay|capture|cellPadding|cellSpacing|challenge|charSet|checked|cite|classID|className|cols|colSpan|content|contentEditable|contextMenu|controls|controlsList|coords|crossOrigin|data|dateTime|decoding|default|defer|dir|disabled|disablePictureInPicture|download|draggable|encType|enterKeyHint|form|formAction|formEncType|formMethod|formNoValidate|formTarget|frameBorder|headers|height|hidden|high|href|hrefLang|htmlFor|httpEquiv|id|inputMode|integrity|is|keyParams|keyType|kind|label|lang|list|loading|loop|low|marginHeight|marginWidth|max|maxLength|media|mediaGroup|method|min|minLength|multiple|muted|name|nonce|noValidate|open|optimum|pattern|placeholder|playsInline|poster|preload|profile|radioGroup|readOnly|referrerPolicy|rel|required|reversed|role|rows|rowSpan|sandbox|scope|scoped|scrolling|seamless|selected|shape|size|sizes|slot|span|spellCheck|src|srcDoc|srcLang|srcSet|start|step|style|summary|tabIndex|target|title|translate|type|useMap|value|width|wmode|wrap|about|datatype|inlist|prefix|property|resource|typeof|vocab|autoCapitalize|autoCorrect|autoSave|color|incremental|fallback|inert|itemProp|itemScope|itemType|itemID|itemRef|on|option|results|security|unselectable|accentHeight|accumulate|additive|alignmentBaseline|allowReorder|alphabetic|amplitude|arabicForm|ascent|attributeName|attributeType|autoReverse|azimuth|baseFrequency|baselineShift|baseProfile|bbox|begin|bias|by|calcMode|capHeight|clip|clipPathUnits|clipPath|clipRule|colorInterpolation|colorInterpolationFilters|colorProfile|colorRendering|contentScriptType|contentStyleType|cursor|cx|cy|d|decelerate|descent|diffuseConstant|direction|display|divisor|dominantBaseline|dur|dx|dy|edgeMode|elevation|enableBackground|end|exponent|externalResourcesRequired|fill|fillOpacity|fillRule|filter|filterRes|filterUnits|floodColor|floodOpacity|focusable|fontFamily|fontSize|fontSizeAdjust|fontStretch|fontStyle|fontVariant|fontWeight|format|from|fr|fx|fy|g1|g2|glyphName|glyphOrientationHorizontal|glyphOrientationVertical|glyphRef|gradientTransform|gradientUnits|hanging|horizAdvX|horizOriginX|ideographic|imageRendering|in|in2|intercept|k|k1|k2|k3|k4|kernelMatrix|kernelUnitLength|kerning|keyPoints|keySplines|keyTimes|lengthAdjust|letterSpacing|lightingColor|limitingConeAngle|local|markerEnd|markerMid|markerStart|markerHeight|markerUnits|markerWidth|mask|maskContentUnits|maskUnits|mathematical|mode|numOctaves|offset|opacity|operator|order|orient|orientation|origin|overflow|overlinePosition|overlineThickness|panose1|paintOrder|pathLength|patternContentUnits|patternTransform|patternUnits|pointerEvents|points|pointsAtX|pointsAtY|pointsAtZ|preserveAlpha|preserveAspectRatio|primitiveUnits|r|radius|refX|refY|renderingIntent|repeatCount|repeatDur|requiredExtensions|requiredFeatures|restart|result|rotate|rx|ry|scale|seed|shapeRendering|slope|spacing|specularConstant|specularExponent|speed|spreadMethod|startOffset|stdDeviation|stemh|stemv|stitchTiles|stopColor|stopOpacity|strikethroughPosition|strikethroughThickness|string|stroke|strokeDasharray|strokeDashoffset|strokeLinecap|strokeLinejoin|strokeMiterlimit|strokeOpacity|strokeWidth|surfaceScale|systemLanguage|tableValues|targetX|targetY|textAnchor|textDecoration|textRendering|textLength|to|transform|u1|u2|underlinePosition|underlineThickness|unicode|unicodeBidi|unicodeRange|unitsPerEm|vAlphabetic|vHanging|vIdeographic|vMathematical|values|vectorEffect|version|vertAdvY|vertOriginX|vertOriginY|viewBox|viewTarget|visibility|widths|wordSpacing|writingMode|x|xHeight|x1|x2|xChannelSelector|xlinkActuate|xlinkArcrole|xlinkHref|xlinkRole|xlinkShow|xlinkTitle|xlinkType|xmlBase|xmlns|xmlnsXlink|xmlLang|xmlSpace|y|y1|y2|yChannelSelector|z|zoomAndPan|for|class|autofocus)|(([Dd][Aa][Tt][Aa]|[Aa][Rr][Ii][Aa]|x)-.*))$/; // https://esbench.com/bench/5bfee68a4cd7e6009ef61d23 |
| 43 |
|
| 44 |
var isPropValid = /* #__PURE__ */(0,_emotion_memoize__WEBPACK_IMPORTED_MODULE_0__["default"])(function (prop) { |
| 45 |
return reactPropsRegex.test(prop) || prop.charCodeAt(0) === 111 |
| 46 |
/* o */ |
| 47 |
&& prop.charCodeAt(1) === 110 |
| 48 |
/* n */ |
| 49 |
&& prop.charCodeAt(2) < 91; |
| 50 |
} |
| 51 |
/* Z+1 */ |
| 52 |
); |
| 53 |
|
| 54 |
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (isPropValid); |
| 55 |
|
| 56 |
|
| 57 |
/***/ }), |
| 58 |
|
| 59 |
/***/ "./scripts/api/wordpressApiClient.ts": |
| 60 |
/*!*******************************************!*\ |
| 61 |
!*** ./scripts/api/wordpressApiClient.ts ***! |
| 62 |
\*******************************************/ |
| 63 |
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { |
| 64 |
|
| 65 |
"use strict"; |
| 66 |
__webpack_require__.r(__webpack_exports__); |
| 67 |
/* harmony export */ __webpack_require__.d(__webpack_exports__, { |
| 68 |
/* harmony export */ "disableInternalTracking": () => (/* binding */ disableInternalTracking), |
| 69 |
/* harmony export */ "fetchDisableInternalTracking": () => (/* binding */ fetchDisableInternalTracking), |
| 70 |
/* harmony export */ "getBusinessUnitId": () => (/* binding */ getBusinessUnitId), |
| 71 |
/* harmony export */ "healthcheckRestApi": () => (/* binding */ healthcheckRestApi), |
| 72 |
/* harmony export */ "setBusinessUnitId": () => (/* binding */ setBusinessUnitId), |
| 73 |
/* harmony export */ "skipReview": () => (/* binding */ skipReview), |
| 74 |
/* harmony export */ "trackConsent": () => (/* binding */ trackConsent), |
| 75 |
/* harmony export */ "updateHublet": () => (/* binding */ updateHublet) |
| 76 |
/* harmony export */ }); |
| 77 |
/* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! jquery */ "jquery"); |
| 78 |
/* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(jquery__WEBPACK_IMPORTED_MODULE_0__); |
| 79 |
/* harmony import */ var _lib_Raven__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../lib/Raven */ "./scripts/lib/Raven.ts"); |
| 80 |
/* harmony import */ var _constants_leadinConfig__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../constants/leadinConfig */ "./scripts/constants/leadinConfig.ts"); |
| 81 |
/* harmony import */ var _utils_queryParams__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../utils/queryParams */ "./scripts/utils/queryParams.ts"); |
| 82 |
|
| 83 |
|
| 84 |
|
| 85 |
|
| 86 |
|
| 87 |
function makeRequest(method, path) { |
| 88 |
var data = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; |
| 89 |
var queryParams = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {}; |
| 90 |
// eslint-disable-next-line compat/compat |
| 91 |
var restApiUrl = new URL("".concat(_constants_leadinConfig__WEBPACK_IMPORTED_MODULE_2__.restUrl, "leadin/v1").concat(path)); |
| 92 |
(0,_utils_queryParams__WEBPACK_IMPORTED_MODULE_3__.addQueryObjectToUrl)(restApiUrl, queryParams); |
| 93 |
return new Promise(function (resolve, reject) { |
| 94 |
var payload = { |
| 95 |
url: restApiUrl.toString(), |
| 96 |
method: method, |
| 97 |
contentType: 'application/json', |
| 98 |
beforeSend: function beforeSend(xhr) { |
| 99 |
return xhr.setRequestHeader('X-WP-Nonce', _constants_leadinConfig__WEBPACK_IMPORTED_MODULE_2__.restNonce); |
| 100 |
}, |
| 101 |
success: resolve, |
| 102 |
error: function error(response) { |
| 103 |
_lib_Raven__WEBPACK_IMPORTED_MODULE_1__["default"].captureMessage("HTTP Request to ".concat(restApiUrl, " failed with error ").concat(response.status, ": ").concat(response.responseText), { |
| 104 |
fingerprint: ['{{ default }}', path, response.status, response.responseText] |
| 105 |
}); |
| 106 |
reject(response); |
| 107 |
} |
| 108 |
}; |
| 109 |
|
| 110 |
if (method !== 'get') { |
| 111 |
payload.data = JSON.stringify(data); |
| 112 |
} |
| 113 |
|
| 114 |
jquery__WEBPACK_IMPORTED_MODULE_0___default().ajax(payload); |
| 115 |
}); |
| 116 |
} |
| 117 |
|
| 118 |
function healthcheckRestApi() { |
| 119 |
return makeRequest('get', '/healthcheck'); |
| 120 |
} |
| 121 |
function disableInternalTracking(value) { |
| 122 |
return makeRequest('put', '/internal-tracking', value ? '1' : '0'); |
| 123 |
} |
| 124 |
function fetchDisableInternalTracking() { |
| 125 |
return makeRequest('get', '/internal-tracking').then(function (message) { |
| 126 |
return { |
| 127 |
message: message |
| 128 |
}; |
| 129 |
}); |
| 130 |
} |
| 131 |
function updateHublet(hublet) { |
| 132 |
return makeRequest('put', '/hublet', { |
| 133 |
hublet: hublet |
| 134 |
}); |
| 135 |
} |
| 136 |
function skipReview() { |
| 137 |
return makeRequest('post', '/skip-review'); |
| 138 |
} |
| 139 |
function trackConsent(canTrack) { |
| 140 |
return makeRequest('post', '/track-consent', { |
| 141 |
canTrack: canTrack |
| 142 |
}).then(function (message) { |
| 143 |
return { |
| 144 |
message: message |
| 145 |
}; |
| 146 |
}); |
| 147 |
} |
| 148 |
function setBusinessUnitId(businessUnitId) { |
| 149 |
return makeRequest('put', '/business-unit', { |
| 150 |
businessUnitId: businessUnitId |
| 151 |
}); |
| 152 |
} |
| 153 |
function getBusinessUnitId() { |
| 154 |
return makeRequest('get', '/business-unit'); |
| 155 |
} |
| 156 |
|
| 157 |
/***/ }), |
| 158 |
|
| 159 |
/***/ "./scripts/constants/leadinConfig.ts": |
| 160 |
/*!*******************************************!*\ |
| 161 |
!*** ./scripts/constants/leadinConfig.ts ***! |
| 162 |
\*******************************************/ |
| 163 |
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { |
| 164 |
|
| 165 |
"use strict"; |
| 166 |
__webpack_require__.r(__webpack_exports__); |
| 167 |
/* harmony export */ __webpack_require__.d(__webpack_exports__, { |
| 168 |
/* harmony export */ "accountName": () => (/* binding */ accountName), |
| 169 |
/* harmony export */ "activationTime": () => (/* binding */ activationTime), |
| 170 |
/* harmony export */ "adminUrl": () => (/* binding */ adminUrl), |
| 171 |
/* harmony export */ "connectionStatus": () => (/* binding */ connectionStatus), |
| 172 |
/* harmony export */ "contentEmbed": () => (/* binding */ contentEmbed), |
| 173 |
/* harmony export */ "deviceId": () => (/* binding */ deviceId), |
| 174 |
/* harmony export */ "didDisconnect": () => (/* binding */ didDisconnect), |
| 175 |
/* harmony export */ "env": () => (/* binding */ env), |
| 176 |
/* harmony export */ "formsScript": () => (/* binding */ formsScript), |
| 177 |
/* harmony export */ "formsScriptPayload": () => (/* binding */ formsScriptPayload), |
| 178 |
/* harmony export */ "hublet": () => (/* binding */ hublet), |
| 179 |
/* harmony export */ "hubspotBaseUrl": () => (/* binding */ hubspotBaseUrl), |
| 180 |
/* harmony export */ "hubspotNonce": () => (/* binding */ hubspotNonce), |
| 181 |
/* harmony export */ "iframeUrl": () => (/* binding */ iframeUrl), |
| 182 |
/* harmony export */ "impactLink": () => (/* binding */ impactLink), |
| 183 |
/* harmony export */ "lastAuthorizeTime": () => (/* binding */ lastAuthorizeTime), |
| 184 |
/* harmony export */ "lastDeauthorizeTime": () => (/* binding */ lastDeauthorizeTime), |
| 185 |
/* harmony export */ "lastDisconnectTime": () => (/* binding */ lastDisconnectTime), |
| 186 |
/* harmony export */ "leadinPluginVersion": () => (/* binding */ leadinPluginVersion), |
| 187 |
/* harmony export */ "leadinQueryParams": () => (/* binding */ leadinQueryParams), |
| 188 |
/* harmony export */ "locale": () => (/* binding */ locale), |
| 189 |
/* harmony export */ "loginUrl": () => (/* binding */ loginUrl), |
| 190 |
/* harmony export */ "meetingsScript": () => (/* binding */ meetingsScript), |
| 191 |
/* harmony export */ "phpVersion": () => (/* binding */ phpVersion), |
| 192 |
/* harmony export */ "pluginPath": () => (/* binding */ pluginPath), |
| 193 |
/* harmony export */ "plugins": () => (/* binding */ plugins), |
| 194 |
/* harmony export */ "portalDomain": () => (/* binding */ portalDomain), |
| 195 |
/* harmony export */ "portalEmail": () => (/* binding */ portalEmail), |
| 196 |
/* harmony export */ "portalId": () => (/* binding */ portalId), |
| 197 |
/* harmony export */ "redirectNonce": () => (/* binding */ redirectNonce), |
| 198 |
/* harmony export */ "refreshToken": () => (/* binding */ refreshToken), |
| 199 |
/* harmony export */ "refreshTokenError": () => (/* binding */ refreshTokenError), |
| 200 |
/* harmony export */ "requiresContentEmbedScope": () => (/* binding */ requiresContentEmbedScope), |
| 201 |
/* harmony export */ "restNonce": () => (/* binding */ restNonce), |
| 202 |
/* harmony export */ "restUrl": () => (/* binding */ restUrl), |
| 203 |
/* harmony export */ "reviewSkippedDate": () => (/* binding */ reviewSkippedDate), |
| 204 |
/* harmony export */ "theme": () => (/* binding */ theme), |
| 205 |
/* harmony export */ "trackConsent": () => (/* binding */ trackConsent), |
| 206 |
/* harmony export */ "wpVersion": () => (/* binding */ wpVersion) |
| 207 |
/* harmony export */ }); |
| 208 |
var _window$leadinConfig = window.leadinConfig, |
| 209 |
accountName = _window$leadinConfig.accountName, |
| 210 |
adminUrl = _window$leadinConfig.adminUrl, |
| 211 |
activationTime = _window$leadinConfig.activationTime, |
| 212 |
connectionStatus = _window$leadinConfig.connectionStatus, |
| 213 |
deviceId = _window$leadinConfig.deviceId, |
| 214 |
didDisconnect = _window$leadinConfig.didDisconnect, |
| 215 |
env = _window$leadinConfig.env, |
| 216 |
formsScript = _window$leadinConfig.formsScript, |
| 217 |
meetingsScript = _window$leadinConfig.meetingsScript, |
| 218 |
formsScriptPayload = _window$leadinConfig.formsScriptPayload, |
| 219 |
hublet = _window$leadinConfig.hublet, |
| 220 |
hubspotBaseUrl = _window$leadinConfig.hubspotBaseUrl, |
| 221 |
hubspotNonce = _window$leadinConfig.hubspotNonce, |
| 222 |
iframeUrl = _window$leadinConfig.iframeUrl, |
| 223 |
impactLink = _window$leadinConfig.impactLink, |
| 224 |
lastAuthorizeTime = _window$leadinConfig.lastAuthorizeTime, |
| 225 |
lastDeauthorizeTime = _window$leadinConfig.lastDeauthorizeTime, |
| 226 |
lastDisconnectTime = _window$leadinConfig.lastDisconnectTime, |
| 227 |
leadinPluginVersion = _window$leadinConfig.leadinPluginVersion, |
| 228 |
leadinQueryParams = _window$leadinConfig.leadinQueryParams, |
| 229 |
locale = _window$leadinConfig.locale, |
| 230 |
loginUrl = _window$leadinConfig.loginUrl, |
| 231 |
phpVersion = _window$leadinConfig.phpVersion, |
| 232 |
pluginPath = _window$leadinConfig.pluginPath, |
| 233 |
plugins = _window$leadinConfig.plugins, |
| 234 |
portalDomain = _window$leadinConfig.portalDomain, |
| 235 |
portalEmail = _window$leadinConfig.portalEmail, |
| 236 |
portalId = _window$leadinConfig.portalId, |
| 237 |
redirectNonce = _window$leadinConfig.redirectNonce, |
| 238 |
restNonce = _window$leadinConfig.restNonce, |
| 239 |
restUrl = _window$leadinConfig.restUrl, |
| 240 |
refreshToken = _window$leadinConfig.refreshToken, |
| 241 |
reviewSkippedDate = _window$leadinConfig.reviewSkippedDate, |
| 242 |
theme = _window$leadinConfig.theme, |
| 243 |
trackConsent = _window$leadinConfig.trackConsent, |
| 244 |
wpVersion = _window$leadinConfig.wpVersion, |
| 245 |
contentEmbed = _window$leadinConfig.contentEmbed, |
| 246 |
requiresContentEmbedScope = _window$leadinConfig.requiresContentEmbedScope, |
| 247 |
refreshTokenError = _window$leadinConfig.refreshTokenError; |
| 248 |
|
| 249 |
|
| 250 |
/***/ }), |
| 251 |
|
| 252 |
/***/ "./scripts/constants/selectors.ts": |
| 253 |
/*!****************************************!*\ |
| 254 |
!*** ./scripts/constants/selectors.ts ***! |
| 255 |
\****************************************/ |
| 256 |
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { |
| 257 |
|
| 258 |
"use strict"; |
| 259 |
__webpack_require__.r(__webpack_exports__); |
| 260 |
/* harmony export */ __webpack_require__.d(__webpack_exports__, { |
| 261 |
/* harmony export */ "domElements": () => (/* binding */ domElements) |
| 262 |
/* harmony export */ }); |
| 263 |
var domElements = { |
| 264 |
iframe: '#leadin-iframe', |
| 265 |
subMenu: '.toplevel_page_leadin > ul', |
| 266 |
subMenuLinks: '.toplevel_page_leadin > ul a', |
| 267 |
subMenuButtons: '.toplevel_page_leadin > ul > li', |
| 268 |
deactivatePluginButton: '[data-slug="leadin"] .deactivate a', |
| 269 |
deactivateFeedbackForm: 'form.leadin-deactivate-form', |
| 270 |
deactivateFeedbackSubmit: 'button#leadin-feedback-submit', |
| 271 |
deactivateFeedbackSkip: 'button#leadin-feedback-skip', |
| 272 |
thickboxModalClose: '.leadin-modal-close', |
| 273 |
thickboxModalWindow: 'div#TB_window.thickbox-loading', |
| 274 |
thickboxModalContent: 'div#TB_ajaxContent.TB_modal', |
| 275 |
reviewBannerContainer: '#leadin-review-banner', |
| 276 |
reviewBannerLeaveReviewLink: 'a#leave-review-button', |
| 277 |
reviewBannerDismissButton: 'a#dismiss-review-banner-button', |
| 278 |
leadinIframeContainer: 'leadin-iframe-container', |
| 279 |
leadinIframe: 'leadin-iframe', |
| 280 |
leadinIframeFallbackContainer: 'leadin-iframe-fallback-container' |
| 281 |
}; |
| 282 |
|
| 283 |
/***/ }), |
| 284 |
|
| 285 |
/***/ "./scripts/iframe/IframeErrorPage.tsx": |
| 286 |
/*!********************************************!*\ |
| 287 |
!*** ./scripts/iframe/IframeErrorPage.tsx ***! |
| 288 |
\********************************************/ |
| 289 |
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { |
| 290 |
|
| 291 |
"use strict"; |
| 292 |
__webpack_require__.r(__webpack_exports__); |
| 293 |
/* harmony export */ __webpack_require__.d(__webpack_exports__, { |
| 294 |
/* harmony export */ "IframeErrorPage": () => (/* binding */ IframeErrorPage) |
| 295 |
/* harmony export */ }); |
| 296 |
/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react/jsx-runtime */ "./node_modules/react/jsx-runtime.js"); |
| 297 |
/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @wordpress/i18n */ "@wordpress/i18n"); |
| 298 |
/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__); |
| 299 |
/* harmony import */ var _linaria_react__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @linaria/react */ "./node_modules/@linaria/react/dist/index.mjs"); |
| 300 |
|
| 301 |
|
| 302 |
|
| 303 |
var IframeErrorContainer = /*#__PURE__*/(0,_linaria_react__WEBPACK_IMPORTED_MODULE_2__.styled)('div')({ |
| 304 |
name: "IframeErrorContainer", |
| 305 |
"class": "i1jit3y0", |
| 306 |
propsAsIs: false |
| 307 |
}); |
| 308 |
var ErrorHeader = /*#__PURE__*/(0,_linaria_react__WEBPACK_IMPORTED_MODULE_2__.styled)('h1')({ |
| 309 |
name: "ErrorHeader", |
| 310 |
"class": "e12lu7tb", |
| 311 |
propsAsIs: false |
| 312 |
}); |
| 313 |
var IframeErrorPage = function IframeErrorPage() { |
| 314 |
return (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(IframeErrorContainer, { |
| 315 |
children: [(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("img", { |
| 316 |
alt: "Cannot find page", |
| 317 |
width: "175", |
| 318 |
src: "//static.hsappstatic.net/ui-images/static-1.14/optimized/errors/map.svg" |
| 319 |
}), (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(ErrorHeader, { |
| 320 |
children: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('The HubSpot for WordPress plugin is not able to load pages', 'leadin') |
| 321 |
}), (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("p", { |
| 322 |
children: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Try disabling your browser extensions and ad blockers, then refresh the page', 'leadin') |
| 323 |
}), (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)("p", { |
| 324 |
children: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)('Or open the HubSpot for WordPress plugin in a different browser', 'leadin') |
| 325 |
})] |
| 326 |
}); |
| 327 |
}; |
| 328 |
|
| 329 |
__webpack_require__(/*! ./IframeErrorPage.linaria.css!=!../../node_modules/@linaria/webpack5-loader/lib/outputCssLoader.js?cacheProvider=!./IframeErrorPage.tsx */ "./scripts/iframe/IframeErrorPage.linaria.css!=!./node_modules/@linaria/webpack5-loader/lib/outputCssLoader.js?cacheProvider=!./scripts/iframe/IframeErrorPage.tsx"); |
| 330 |
|
| 331 |
/***/ }), |
| 332 |
|
| 333 |
/***/ "./scripts/iframe/constants.ts": |
| 334 |
/*!*************************************!*\ |
| 335 |
!*** ./scripts/iframe/constants.ts ***! |
| 336 |
\*************************************/ |
| 337 |
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { |
| 338 |
|
| 339 |
"use strict"; |
| 340 |
__webpack_require__.r(__webpack_exports__); |
| 341 |
/* harmony export */ __webpack_require__.d(__webpack_exports__, { |
| 342 |
/* harmony export */ "App": () => (/* binding */ App), |
| 343 |
/* harmony export */ "AppIframe": () => (/* binding */ AppIframe) |
| 344 |
/* harmony export */ }); |
| 345 |
var _AppIframe; |
| 346 |
|
| 347 |
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } |
| 348 |
|
| 349 |
var App; |
| 350 |
|
| 351 |
(function (App) { |
| 352 |
App[App["Forms"] = 0] = "Forms"; |
| 353 |
App[App["LiveChat"] = 1] = "LiveChat"; |
| 354 |
App[App["Plugin"] = 2] = "Plugin"; |
| 355 |
App[App["PluginSettings"] = 3] = "PluginSettings"; |
| 356 |
App[App["Background"] = 4] = "Background"; |
| 357 |
})(App || (App = {})); |
| 358 |
|
| 359 |
var AppIframe = (_AppIframe = {}, _defineProperty(_AppIframe, App.Forms, 'integrated-form-app'), _defineProperty(_AppIframe, App.LiveChat, 'integrated-livechat-app'), _defineProperty(_AppIframe, App.Plugin, 'integrated-plugin-app'), _defineProperty(_AppIframe, App.PluginSettings, 'integrated-plugin-app'), _defineProperty(_AppIframe, App.Background, 'integrated-plugin-proxy'), _AppIframe); |
| 360 |
|
| 361 |
/***/ }), |
| 362 |
|
| 363 |
/***/ "./scripts/iframe/integratedMessages/core/CoreMessages.ts": |
| 364 |
/*!****************************************************************!*\ |
| 365 |
!*** ./scripts/iframe/integratedMessages/core/CoreMessages.ts ***! |
| 366 |
\****************************************************************/ |
| 367 |
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { |
| 368 |
|
| 369 |
"use strict"; |
| 370 |
__webpack_require__.r(__webpack_exports__); |
| 371 |
/* harmony export */ __webpack_require__.d(__webpack_exports__, { |
| 372 |
/* harmony export */ "CoreMessages": () => (/* binding */ CoreMessages) |
| 373 |
/* harmony export */ }); |
| 374 |
var CoreMessages = { |
| 375 |
HandshakeReceive: 'INTEGRATED_APP_EMBEDDER_HANDSHAKE_RECEIVED', |
| 376 |
SendRefreshToken: 'INTEGRATED_APP_EMBEDDER_SEND_REFRESH_TOKEN', |
| 377 |
ReloadParentFrame: 'INTEGRATED_APP_EMBEDDER_RELOAD_PARENT_FRAME', |
| 378 |
RedirectParentFrame: 'INTEGRATED_APP_EMBEDDER_REDIRECT_PARENT_FRAME', |
| 379 |
SendLocale: 'INTEGRATED_APP_EMBEDDER_SEND_LOCALE', |
| 380 |
SendDeviceId: 'INTEGRATED_APP_EMBEDDER_SEND_DEVICE_ID', |
| 381 |
SendIntegratedAppConfig: 'INTEGRATED_APP_EMBEDDER_CONFIG' |
| 382 |
}; |
| 383 |
|
| 384 |
/***/ }), |
| 385 |
|
| 386 |
/***/ "./scripts/iframe/integratedMessages/forms/FormsMessages.ts": |
| 387 |
/*!******************************************************************!*\ |
| 388 |
!*** ./scripts/iframe/integratedMessages/forms/FormsMessages.ts ***! |
| 389 |
\******************************************************************/ |
| 390 |
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { |
| 391 |
|
| 392 |
"use strict"; |
| 393 |
__webpack_require__.r(__webpack_exports__); |
| 394 |
/* harmony export */ __webpack_require__.d(__webpack_exports__, { |
| 395 |
/* harmony export */ "FormMessages": () => (/* binding */ FormMessages) |
| 396 |
/* harmony export */ }); |
| 397 |
var FormMessages = { |
| 398 |
CreateFormAppNavigation: 'CREATE_FORM_APP_NAVIGATION' |
| 399 |
}; |
| 400 |
|
| 401 |
/***/ }), |
| 402 |
|
| 403 |
/***/ "./scripts/iframe/integratedMessages/index.ts": |
| 404 |
/*!****************************************************!*\ |
| 405 |
!*** ./scripts/iframe/integratedMessages/index.ts ***! |
| 406 |
\****************************************************/ |
| 407 |
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { |
| 408 |
|
| 409 |
"use strict"; |
| 410 |
__webpack_require__.r(__webpack_exports__); |
| 411 |
/* harmony export */ __webpack_require__.d(__webpack_exports__, { |
| 412 |
/* harmony export */ "CoreMessages": () => (/* reexport safe */ _core_CoreMessages__WEBPACK_IMPORTED_MODULE_0__.CoreMessages), |
| 413 |
/* harmony export */ "FormMessages": () => (/* reexport safe */ _forms_FormsMessages__WEBPACK_IMPORTED_MODULE_1__.FormMessages), |
| 414 |
/* harmony export */ "LiveChatMessages": () => (/* reexport safe */ _livechat_LiveChatMessages__WEBPACK_IMPORTED_MODULE_2__.LiveChatMessages), |
| 415 |
/* harmony export */ "PluginMessages": () => (/* reexport safe */ _plugin_PluginMessages__WEBPACK_IMPORTED_MODULE_3__.PluginMessages), |
| 416 |
/* harmony export */ "ProxyMessages": () => (/* reexport safe */ _proxy_ProxyMessages__WEBPACK_IMPORTED_MODULE_4__.ProxyMessages) |
| 417 |
/* harmony export */ }); |
| 418 |
/* harmony import */ var _core_CoreMessages__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./core/CoreMessages */ "./scripts/iframe/integratedMessages/core/CoreMessages.ts"); |
| 419 |
/* harmony import */ var _forms_FormsMessages__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./forms/FormsMessages */ "./scripts/iframe/integratedMessages/forms/FormsMessages.ts"); |
| 420 |
/* harmony import */ var _livechat_LiveChatMessages__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./livechat/LiveChatMessages */ "./scripts/iframe/integratedMessages/livechat/LiveChatMessages.ts"); |
| 421 |
/* harmony import */ var _plugin_PluginMessages__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./plugin/PluginMessages */ "./scripts/iframe/integratedMessages/plugin/PluginMessages.ts"); |
| 422 |
/* harmony import */ var _proxy_ProxyMessages__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./proxy/ProxyMessages */ "./scripts/iframe/integratedMessages/proxy/ProxyMessages.ts"); |
| 423 |
|
| 424 |
|
| 425 |
|
| 426 |
|
| 427 |
|
| 428 |
|
| 429 |
/***/ }), |
| 430 |
|
| 431 |
/***/ "./scripts/iframe/integratedMessages/livechat/LiveChatMessages.ts": |
| 432 |
/*!************************************************************************!*\ |
| 433 |
!*** ./scripts/iframe/integratedMessages/livechat/LiveChatMessages.ts ***! |
| 434 |
\************************************************************************/ |
| 435 |
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { |
| 436 |
|
| 437 |
"use strict"; |
| 438 |
__webpack_require__.r(__webpack_exports__); |
| 439 |
/* harmony export */ __webpack_require__.d(__webpack_exports__, { |
| 440 |
/* harmony export */ "LiveChatMessages": () => (/* binding */ LiveChatMessages) |
| 441 |
/* harmony export */ }); |
| 442 |
var LiveChatMessages = { |
| 443 |
CreateLiveChatAppNavigation: 'CREATE_LIVE_CHAT_APP_NAVIGATION' |
| 444 |
}; |
| 445 |
|
| 446 |
/***/ }), |
| 447 |
|
| 448 |
/***/ "./scripts/iframe/integratedMessages/plugin/PluginMessages.ts": |
| 449 |
/*!********************************************************************!*\ |
| 450 |
!*** ./scripts/iframe/integratedMessages/plugin/PluginMessages.ts ***! |
| 451 |
\********************************************************************/ |
| 452 |
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { |
| 453 |
|
| 454 |
"use strict"; |
| 455 |
__webpack_require__.r(__webpack_exports__); |
| 456 |
/* harmony export */ __webpack_require__.d(__webpack_exports__, { |
| 457 |
/* harmony export */ "PluginMessages": () => (/* binding */ PluginMessages) |
| 458 |
/* harmony export */ }); |
| 459 |
var PluginMessages = { |
| 460 |
PluginSettingsNavigation: 'PLUGIN_SETTINGS_NAVIGATION', |
| 461 |
PluginLeadinConfig: 'PLUGIN_LEADIN_CONFIG', |
| 462 |
TrackConsent: 'INTEGRATED_APP_EMBEDDER_TRACK_CONSENT', |
| 463 |
InternalTrackingFetchRequest: 'INTEGRATED_TRACKING_FETCH_REQUEST', |
| 464 |
InternalTrackingFetchResponse: 'INTEGRATED_TRACKING_FETCH_RESPONSE', |
| 465 |
InternalTrackingFetchError: 'INTEGRATED_TRACKING_FETCH_ERROR', |
| 466 |
InternalTrackingChangeRequest: 'INTEGRATED_TRACKING_CHANGE_REQUEST', |
| 467 |
InternalTrackingChangeError: 'INTEGRATED_TRACKING_CHANGE_ERROR', |
| 468 |
BusinessUnitFetchRequest: 'BUSINESS_UNIT_FETCH_REQUEST', |
| 469 |
BusinessUnitFetchResponse: 'BUSINESS_UNIT_FETCH_FETCH_RESPONSE', |
| 470 |
BusinessUnitFetchError: 'BUSINESS_UNIT_FETCH_FETCH_ERROR', |
| 471 |
BusinessUnitChangeRequest: 'BUSINESS_UNIT_CHANGE_REQUEST', |
| 472 |
BusinessUnitChangeError: 'BUSINESS_UNIT_CHANGE_ERROR', |
| 473 |
SkipReviewRequest: 'SKIP_REVIEW_REQUEST', |
| 474 |
SkipReviewResponse: 'SKIP_REVIEW_RESPONSE', |
| 475 |
SkipReviewError: 'SKIP_REVIEW_ERROR', |
| 476 |
RemoveParentQueryParam: 'REMOVE_PARENT_QUERY_PARAM', |
| 477 |
ContentEmbedInstallRequest: 'CONTENT_EMBED_INSTALL_REQUEST', |
| 478 |
ContentEmbedInstallResponse: 'CONTENT_EMBED_INSTALL_RESPONSE', |
| 479 |
ContentEmbedInstallError: 'CONTENT_EMBED_INSTALL_ERROR', |
| 480 |
ContentEmbedActivationRequest: 'CONTENT_EMBED_ACTIVATION_REQUEST', |
| 481 |
ContentEmbedActivationResponse: 'CONTENT_EMBED_ACTIVATION_RESPONSE', |
| 482 |
ContentEmbedActivationError: 'CONTENT_EMBED_ACTIVATION_ERROR' |
| 483 |
}; |
| 484 |
|
| 485 |
/***/ }), |
| 486 |
|
| 487 |
/***/ "./scripts/iframe/integratedMessages/proxy/ProxyMessages.ts": |
| 488 |
/*!******************************************************************!*\ |
| 489 |
!*** ./scripts/iframe/integratedMessages/proxy/ProxyMessages.ts ***! |
| 490 |
\******************************************************************/ |
| 491 |
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { |
| 492 |
|
| 493 |
"use strict"; |
| 494 |
__webpack_require__.r(__webpack_exports__); |
| 495 |
/* harmony export */ __webpack_require__.d(__webpack_exports__, { |
| 496 |
/* harmony export */ "ProxyMessages": () => (/* binding */ ProxyMessages) |
| 497 |
/* harmony export */ }); |
| 498 |
var ProxyMessages = { |
| 499 |
FetchForms: 'FETCH_FORMS', |
| 500 |
FetchForm: 'FETCH_FORM', |
| 501 |
CreateFormFromTemplate: 'CREATE_FORM_FROM_TEMPLATE', |
| 502 |
FetchAuth: 'FETCH_AUTH', |
| 503 |
FetchMeetingsAndUsers: 'FETCH_MEETINGS_AND_USERS', |
| 504 |
FetchContactsCreateSinceActivation: 'FETCH_CONTACTS_CREATED_SINCE_ACTIVATION', |
| 505 |
FetchOrCreateMeetingUser: 'FETCH_OR_CREATE_MEETING_USER', |
| 506 |
ConnectMeetingsCalendar: 'CONNECT_MEETINGS_CALENDAR', |
| 507 |
TrackFormPreviewRender: 'TRACK_FORM_PREVIEW_RENDER', |
| 508 |
TrackFormCreatedFromTemplate: 'TRACK_FORM_CREATED_FROM_TEMPLATE', |
| 509 |
TrackFormCreationFailed: 'TRACK_FORM_CREATION_FAILED', |
| 510 |
TrackMeetingPreviewRender: 'TRACK_MEETING_PREVIEW_RENDER', |
| 511 |
TrackSidebarMetaChange: 'TRACK_SIDEBAR_META_CHANGE', |
| 512 |
TrackReviewBannerRender: 'TRACK_REVIEW_BANNER_RENDER', |
| 513 |
TrackReviewBannerInteraction: 'TRACK_REVIEW_BANNER_INTERACTION', |
| 514 |
TrackReviewBannerDismissed: 'TRACK_REVIEW_BANNER_DISMISSED', |
| 515 |
TrackPluginDeactivation: 'TRACK_PLUGIN_DEACTIVATION' |
| 516 |
}; |
| 517 |
|
| 518 |
/***/ }), |
| 519 |
|
| 520 |
/***/ "./scripts/iframe/messageMiddleware.ts": |
| 521 |
/*!*********************************************!*\ |
| 522 |
!*** ./scripts/iframe/messageMiddleware.ts ***! |
| 523 |
\*********************************************/ |
| 524 |
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { |
| 525 |
|
| 526 |
"use strict"; |
| 527 |
__webpack_require__.r(__webpack_exports__); |
| 528 |
/* harmony export */ __webpack_require__.d(__webpack_exports__, { |
| 529 |
/* harmony export */ "messageMiddleware": () => (/* binding */ messageMiddleware) |
| 530 |
/* harmony export */ }); |
| 531 |
/* harmony import */ var _iframe_integratedMessages__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../iframe/integratedMessages */ "./scripts/iframe/integratedMessages/index.ts"); |
| 532 |
/* harmony import */ var _api_wordpressApiClient__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../api/wordpressApiClient */ "./scripts/api/wordpressApiClient.ts"); |
| 533 |
/* harmony import */ var _utils_queryParams__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../utils/queryParams */ "./scripts/utils/queryParams.ts"); |
| 534 |
/* harmony import */ var _utils_contentEmbedInstaller__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../utils/contentEmbedInstaller */ "./scripts/utils/contentEmbedInstaller.ts"); |
| 535 |
|
| 536 |
|
| 537 |
|
| 538 |
|
| 539 |
var messageMapper = new Map([[_iframe_integratedMessages__WEBPACK_IMPORTED_MODULE_0__.PluginMessages.TrackConsent, function (message) { |
| 540 |
(0,_api_wordpressApiClient__WEBPACK_IMPORTED_MODULE_1__.trackConsent)(message.payload); |
| 541 |
}], [_iframe_integratedMessages__WEBPACK_IMPORTED_MODULE_0__.PluginMessages.InternalTrackingChangeRequest, function (message, embedder) { |
| 542 |
(0,_api_wordpressApiClient__WEBPACK_IMPORTED_MODULE_1__.disableInternalTracking)(message.payload).then(function () { |
| 543 |
embedder.postMessage({ |
| 544 |
key: _iframe_integratedMessages__WEBPACK_IMPORTED_MODULE_0__.PluginMessages.InternalTrackingFetchResponse, |
| 545 |
payload: message.payload |
| 546 |
}); |
| 547 |
})["catch"](function (payload) { |
| 548 |
embedder.postMessage({ |
| 549 |
key: _iframe_integratedMessages__WEBPACK_IMPORTED_MODULE_0__.PluginMessages.InternalTrackingChangeError, |
| 550 |
payload: payload |
| 551 |
}); |
| 552 |
}); |
| 553 |
}], [_iframe_integratedMessages__WEBPACK_IMPORTED_MODULE_0__.PluginMessages.InternalTrackingFetchRequest, function (__message, embedder) { |
| 554 |
(0,_api_wordpressApiClient__WEBPACK_IMPORTED_MODULE_1__.fetchDisableInternalTracking)().then(function (_ref) { |
| 555 |
var payload = _ref.message; |
| 556 |
embedder.postMessage({ |
| 557 |
key: _iframe_integratedMessages__WEBPACK_IMPORTED_MODULE_0__.PluginMessages.InternalTrackingFetchResponse, |
| 558 |
payload: payload |
| 559 |
}); |
| 560 |
})["catch"](function (payload) { |
| 561 |
embedder.postMessage({ |
| 562 |
key: _iframe_integratedMessages__WEBPACK_IMPORTED_MODULE_0__.PluginMessages.InternalTrackingFetchError, |
| 563 |
payload: payload |
| 564 |
}); |
| 565 |
}); |
| 566 |
}], [_iframe_integratedMessages__WEBPACK_IMPORTED_MODULE_0__.PluginMessages.BusinessUnitFetchRequest, function (__message, embedder) { |
| 567 |
(0,_api_wordpressApiClient__WEBPACK_IMPORTED_MODULE_1__.getBusinessUnitId)().then(function (payload) { |
| 568 |
embedder.postMessage({ |
| 569 |
key: _iframe_integratedMessages__WEBPACK_IMPORTED_MODULE_0__.PluginMessages.BusinessUnitFetchResponse, |
| 570 |
payload: payload |
| 571 |
}); |
| 572 |
})["catch"](function (payload) { |
| 573 |
embedder.postMessage({ |
| 574 |
key: _iframe_integratedMessages__WEBPACK_IMPORTED_MODULE_0__.PluginMessages.BusinessUnitFetchError, |
| 575 |
payload: payload |
| 576 |
}); |
| 577 |
}); |
| 578 |
}], [_iframe_integratedMessages__WEBPACK_IMPORTED_MODULE_0__.PluginMessages.BusinessUnitChangeRequest, function (message, embedder) { |
| 579 |
(0,_api_wordpressApiClient__WEBPACK_IMPORTED_MODULE_1__.setBusinessUnitId)(message.payload).then(function (payload) { |
| 580 |
embedder.postMessage({ |
| 581 |
key: _iframe_integratedMessages__WEBPACK_IMPORTED_MODULE_0__.PluginMessages.BusinessUnitFetchResponse, |
| 582 |
payload: payload |
| 583 |
}); |
| 584 |
})["catch"](function (payload) { |
| 585 |
embedder.postMessage({ |
| 586 |
key: _iframe_integratedMessages__WEBPACK_IMPORTED_MODULE_0__.PluginMessages.BusinessUnitChangeError, |
| 587 |
payload: payload |
| 588 |
}); |
| 589 |
}); |
| 590 |
}], [_iframe_integratedMessages__WEBPACK_IMPORTED_MODULE_0__.PluginMessages.SkipReviewRequest, function (__message, embedder) { |
| 591 |
(0,_api_wordpressApiClient__WEBPACK_IMPORTED_MODULE_1__.skipReview)().then(function (payload) { |
| 592 |
embedder.postMessage({ |
| 593 |
key: _iframe_integratedMessages__WEBPACK_IMPORTED_MODULE_0__.PluginMessages.SkipReviewResponse, |
| 594 |
payload: payload |
| 595 |
}); |
| 596 |
})["catch"](function (payload) { |
| 597 |
embedder.postMessage({ |
| 598 |
key: _iframe_integratedMessages__WEBPACK_IMPORTED_MODULE_0__.PluginMessages.SkipReviewError, |
| 599 |
payload: payload |
| 600 |
}); |
| 601 |
}); |
| 602 |
}], [_iframe_integratedMessages__WEBPACK_IMPORTED_MODULE_0__.PluginMessages.RemoveParentQueryParam, function (message) { |
| 603 |
(0,_utils_queryParams__WEBPACK_IMPORTED_MODULE_2__.removeQueryParamFromLocation)(message.payload); |
| 604 |
}], [_iframe_integratedMessages__WEBPACK_IMPORTED_MODULE_0__.PluginMessages.ContentEmbedInstallRequest, function (message, embedder) { |
| 605 |
(0,_utils_contentEmbedInstaller__WEBPACK_IMPORTED_MODULE_3__.startInstall)(message.payload.nonce).then(function (payload) { |
| 606 |
embedder.postMessage({ |
| 607 |
key: _iframe_integratedMessages__WEBPACK_IMPORTED_MODULE_0__.PluginMessages.ContentEmbedInstallResponse, |
| 608 |
payload: payload |
| 609 |
}); |
| 610 |
})["catch"](function (payload) { |
| 611 |
embedder.postMessage({ |
| 612 |
key: _iframe_integratedMessages__WEBPACK_IMPORTED_MODULE_0__.PluginMessages.ContentEmbedInstallError, |
| 613 |
payload: payload |
| 614 |
}); |
| 615 |
}); |
| 616 |
}], [_iframe_integratedMessages__WEBPACK_IMPORTED_MODULE_0__.PluginMessages.ContentEmbedActivationRequest, function (message, embedder) { |
| 617 |
(0,_utils_contentEmbedInstaller__WEBPACK_IMPORTED_MODULE_3__.startActivation)(message.payload.activateAjaxUrl).then(function (payload) { |
| 618 |
embedder.postMessage({ |
| 619 |
key: _iframe_integratedMessages__WEBPACK_IMPORTED_MODULE_0__.PluginMessages.ContentEmbedActivationResponse, |
| 620 |
payload: payload |
| 621 |
}); |
| 622 |
})["catch"](function (payload) { |
| 623 |
embedder.postMessage({ |
| 624 |
key: _iframe_integratedMessages__WEBPACK_IMPORTED_MODULE_0__.PluginMessages.ContentEmbedActivationError, |
| 625 |
payload: payload |
| 626 |
}); |
| 627 |
}); |
| 628 |
}]]); |
| 629 |
var messageMiddleware = function messageMiddleware(embedder) { |
| 630 |
return function (message) { |
| 631 |
var next = messageMapper.get(message.key); |
| 632 |
|
| 633 |
if (next) { |
| 634 |
next(message, embedder); |
| 635 |
} |
| 636 |
}; |
| 637 |
}; |
| 638 |
|
| 639 |
/***/ }), |
| 640 |
|
| 641 |
/***/ "./scripts/iframe/renderIframeApp.tsx": |
| 642 |
/*!********************************************!*\ |
| 643 |
!*** ./scripts/iframe/renderIframeApp.tsx ***! |
| 644 |
\********************************************/ |
| 645 |
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { |
| 646 |
|
| 647 |
"use strict"; |
| 648 |
__webpack_require__.r(__webpack_exports__); |
| 649 |
/* harmony export */ __webpack_require__.d(__webpack_exports__, { |
| 650 |
/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__) |
| 651 |
/* harmony export */ }); |
| 652 |
/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react/jsx-runtime */ "./node_modules/react/jsx-runtime.js"); |
| 653 |
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! react */ "react"); |
| 654 |
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_1__); |
| 655 |
/* harmony import */ var react_dom__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! react-dom */ "react-dom"); |
| 656 |
/* harmony import */ var react_dom__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(react_dom__WEBPACK_IMPORTED_MODULE_2__); |
| 657 |
/* harmony import */ var _constants_selectors__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../constants/selectors */ "./scripts/constants/selectors.ts"); |
| 658 |
/* harmony import */ var _useAppEmbedder__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./useAppEmbedder */ "./scripts/iframe/useAppEmbedder.ts"); |
| 659 |
/* harmony import */ var _constants__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./constants */ "./scripts/iframe/constants.ts"); |
| 660 |
/* harmony import */ var _IframeErrorPage__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./IframeErrorPage */ "./scripts/iframe/IframeErrorPage.tsx"); |
| 661 |
|
| 662 |
|
| 663 |
|
| 664 |
|
| 665 |
|
| 666 |
|
| 667 |
|
| 668 |
|
| 669 |
var IntegratedIframePortal = function IntegratedIframePortal(props) { |
| 670 |
var container = document.getElementById(_constants_selectors__WEBPACK_IMPORTED_MODULE_3__.domElements.leadinIframeContainer); |
| 671 |
var iframeNotRendered = (0,_useAppEmbedder__WEBPACK_IMPORTED_MODULE_4__["default"])(props.app, props.createRoute, container); |
| 672 |
|
| 673 |
if (container && !iframeNotRendered) { |
| 674 |
return /*#__PURE__*/react_dom__WEBPACK_IMPORTED_MODULE_2___default().createPortal(props.children, container); |
| 675 |
} |
| 676 |
|
| 677 |
return (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(react__WEBPACK_IMPORTED_MODULE_1__.Fragment, { |
| 678 |
children: (!container || iframeNotRendered) && (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_IframeErrorPage__WEBPACK_IMPORTED_MODULE_6__.IframeErrorPage, {}) |
| 679 |
}); |
| 680 |
}; |
| 681 |
|
| 682 |
var renderIframeApp = function renderIframeApp() { |
| 683 |
var iframeFallbackContainer = document.getElementById(_constants_selectors__WEBPACK_IMPORTED_MODULE_3__.domElements.leadinIframeContainer); |
| 684 |
var app; |
| 685 |
var queryParams = new URLSearchParams(location.search); |
| 686 |
var page = queryParams.get('page'); |
| 687 |
var createRoute = queryParams.get('leadin_route[0]') === 'create'; |
| 688 |
|
| 689 |
switch (page) { |
| 690 |
case 'leadin_forms': |
| 691 |
app = _constants__WEBPACK_IMPORTED_MODULE_5__.App.Forms; |
| 692 |
break; |
| 693 |
|
| 694 |
case 'leadin_chatflows': |
| 695 |
app = _constants__WEBPACK_IMPORTED_MODULE_5__.App.LiveChat; |
| 696 |
break; |
| 697 |
|
| 698 |
case 'leadin_settings': |
| 699 |
app = _constants__WEBPACK_IMPORTED_MODULE_5__.App.PluginSettings; |
| 700 |
break; |
| 701 |
|
| 702 |
case 'leadin_user_guide': |
| 703 |
default: |
| 704 |
app = _constants__WEBPACK_IMPORTED_MODULE_5__.App.Plugin; |
| 705 |
break; |
| 706 |
} |
| 707 |
|
| 708 |
react_dom__WEBPACK_IMPORTED_MODULE_2___default().render((0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(IntegratedIframePortal, { |
| 709 |
app: app, |
| 710 |
createRoute: createRoute |
| 711 |
}), iframeFallbackContainer); |
| 712 |
}; |
| 713 |
|
| 714 |
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (renderIframeApp); |
| 715 |
|
| 716 |
/***/ }), |
| 717 |
|
| 718 |
/***/ "./scripts/iframe/useAppEmbedder.ts": |
| 719 |
/*!******************************************!*\ |
| 720 |
!*** ./scripts/iframe/useAppEmbedder.ts ***! |
| 721 |
\******************************************/ |
| 722 |
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { |
| 723 |
|
| 724 |
"use strict"; |
| 725 |
__webpack_require__.r(__webpack_exports__); |
| 726 |
/* harmony export */ __webpack_require__.d(__webpack_exports__, { |
| 727 |
/* harmony export */ "default": () => (/* binding */ useAppEmbedder) |
| 728 |
/* harmony export */ }); |
| 729 |
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react"); |
| 730 |
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__); |
| 731 |
/* harmony import */ var _lib_Raven__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../lib/Raven */ "./scripts/lib/Raven.ts"); |
| 732 |
/* harmony import */ var _constants_leadinConfig__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../constants/leadinConfig */ "./scripts/constants/leadinConfig.ts"); |
| 733 |
/* harmony import */ var _constants__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./constants */ "./scripts/iframe/constants.ts"); |
| 734 |
/* harmony import */ var _messageMiddleware__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./messageMiddleware */ "./scripts/iframe/messageMiddleware.ts"); |
| 735 |
/* harmony import */ var _utils_iframe__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../utils/iframe */ "./scripts/utils/iframe.ts"); |
| 736 |
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; } |
| 737 |
|
| 738 |
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; } |
| 739 |
|
| 740 |
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } |
| 741 |
|
| 742 |
|
| 743 |
|
| 744 |
|
| 745 |
|
| 746 |
|
| 747 |
|
| 748 |
|
| 749 |
var getIntegrationConfig = function getIntegrationConfig() { |
| 750 |
return { |
| 751 |
adminUrl: _constants_leadinConfig__WEBPACK_IMPORTED_MODULE_2__.leadinQueryParams.adminUrl |
| 752 |
}; |
| 753 |
}; |
| 754 |
|
| 755 |
var getLeadinConfig = function getLeadinConfig() { |
| 756 |
var utm_query_params = Object.keys(_constants_leadinConfig__WEBPACK_IMPORTED_MODULE_2__.leadinQueryParams).filter(function (x) { |
| 757 |
return /^utm/.test(x); |
| 758 |
}).reduce(function (p, c) { |
| 759 |
return _objectSpread(_defineProperty({}, c, _constants_leadinConfig__WEBPACK_IMPORTED_MODULE_2__.leadinQueryParams[c]), p); |
| 760 |
}, {}); |
| 761 |
return _objectSpread({ |
| 762 |
accountName: _constants_leadinConfig__WEBPACK_IMPORTED_MODULE_2__.accountName, |
| 763 |
admin: _constants_leadinConfig__WEBPACK_IMPORTED_MODULE_2__.leadinQueryParams.admin, |
| 764 |
adminUrl: _constants_leadinConfig__WEBPACK_IMPORTED_MODULE_2__.adminUrl, |
| 765 |
company: _constants_leadinConfig__WEBPACK_IMPORTED_MODULE_2__.leadinQueryParams.company, |
| 766 |
connectionStatus: _constants_leadinConfig__WEBPACK_IMPORTED_MODULE_2__.connectionStatus, |
| 767 |
deviceId: _constants_leadinConfig__WEBPACK_IMPORTED_MODULE_2__.deviceId, |
| 768 |
email: _constants_leadinConfig__WEBPACK_IMPORTED_MODULE_2__.leadinQueryParams.email, |
| 769 |
firstName: _constants_leadinConfig__WEBPACK_IMPORTED_MODULE_2__.leadinQueryParams.firstName, |
| 770 |
irclickid: _constants_leadinConfig__WEBPACK_IMPORTED_MODULE_2__.leadinQueryParams.irclickid, |
| 771 |
justConnected: _constants_leadinConfig__WEBPACK_IMPORTED_MODULE_2__.leadinQueryParams.justConnected, |
| 772 |
lastName: _constants_leadinConfig__WEBPACK_IMPORTED_MODULE_2__.leadinQueryParams.lastName, |
| 773 |
lastAuthorizeTime: _constants_leadinConfig__WEBPACK_IMPORTED_MODULE_2__.lastAuthorizeTime, |
| 774 |
lastDeauthorizeTime: _constants_leadinConfig__WEBPACK_IMPORTED_MODULE_2__.lastDeauthorizeTime, |
| 775 |
lastDisconnectTime: _constants_leadinConfig__WEBPACK_IMPORTED_MODULE_2__.lastDisconnectTime, |
| 776 |
leadinPluginVersion: _constants_leadinConfig__WEBPACK_IMPORTED_MODULE_2__.leadinPluginVersion, |
| 777 |
mpid: _constants_leadinConfig__WEBPACK_IMPORTED_MODULE_2__.leadinQueryParams.mpid, |
| 778 |
nonce: _constants_leadinConfig__WEBPACK_IMPORTED_MODULE_2__.leadinQueryParams.nonce, |
| 779 |
phpVersion: _constants_leadinConfig__WEBPACK_IMPORTED_MODULE_2__.phpVersion, |
| 780 |
plugins: _constants_leadinConfig__WEBPACK_IMPORTED_MODULE_2__.plugins, |
| 781 |
portalDomain: _constants_leadinConfig__WEBPACK_IMPORTED_MODULE_2__.portalDomain, |
| 782 |
portalEmail: _constants_leadinConfig__WEBPACK_IMPORTED_MODULE_2__.portalEmail, |
| 783 |
portalId: _constants_leadinConfig__WEBPACK_IMPORTED_MODULE_2__.portalId, |
| 784 |
reviewSkippedDate: _constants_leadinConfig__WEBPACK_IMPORTED_MODULE_2__.reviewSkippedDate, |
| 785 |
theme: _constants_leadinConfig__WEBPACK_IMPORTED_MODULE_2__.theme, |
| 786 |
trackConsent: _constants_leadinConfig__WEBPACK_IMPORTED_MODULE_2__.leadinQueryParams.trackConsent, |
| 787 |
websiteName: _constants_leadinConfig__WEBPACK_IMPORTED_MODULE_2__.leadinQueryParams.websiteName, |
| 788 |
wpVersion: _constants_leadinConfig__WEBPACK_IMPORTED_MODULE_2__.wpVersion, |
| 789 |
contentEmbed: _constants_leadinConfig__WEBPACK_IMPORTED_MODULE_2__.contentEmbed, |
| 790 |
requiresContentEmbedScope: _constants_leadinConfig__WEBPACK_IMPORTED_MODULE_2__.requiresContentEmbedScope, |
| 791 |
refreshTokenError: _constants_leadinConfig__WEBPACK_IMPORTED_MODULE_2__.refreshTokenError |
| 792 |
}, utm_query_params); |
| 793 |
}; |
| 794 |
|
| 795 |
var getAppOptions = function getAppOptions(app) { |
| 796 |
var createRoute = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; |
| 797 |
var _window = window, |
| 798 |
IntegratedAppOptions = _window.IntegratedAppOptions, |
| 799 |
FormsAppOptions = _window.FormsAppOptions, |
| 800 |
LiveChatAppOptions = _window.LiveChatAppOptions, |
| 801 |
PluginAppOptions = _window.PluginAppOptions; |
| 802 |
var options; |
| 803 |
|
| 804 |
switch (app) { |
| 805 |
case _constants__WEBPACK_IMPORTED_MODULE_3__.App.Plugin: |
| 806 |
options = new PluginAppOptions().setLeadinConfig(getLeadinConfig()); |
| 807 |
break; |
| 808 |
|
| 809 |
case _constants__WEBPACK_IMPORTED_MODULE_3__.App.PluginSettings: |
| 810 |
options = new PluginAppOptions().setLeadinConfig(getLeadinConfig()).setPluginSettingsInit(); |
| 811 |
break; |
| 812 |
|
| 813 |
case _constants__WEBPACK_IMPORTED_MODULE_3__.App.Forms: |
| 814 |
options = new FormsAppOptions().setIntegratedAppConfig(getIntegrationConfig()); |
| 815 |
|
| 816 |
if (createRoute) { |
| 817 |
options = options.setCreateFormAppInit(); |
| 818 |
} |
| 819 |
|
| 820 |
break; |
| 821 |
|
| 822 |
case _constants__WEBPACK_IMPORTED_MODULE_3__.App.LiveChat: |
| 823 |
options = new LiveChatAppOptions(); |
| 824 |
|
| 825 |
if (createRoute) { |
| 826 |
options = options.setCreateLiveChatAppInit(); |
| 827 |
} |
| 828 |
|
| 829 |
break; |
| 830 |
|
| 831 |
default: |
| 832 |
options = new IntegratedAppOptions(); |
| 833 |
} |
| 834 |
|
| 835 |
return options; |
| 836 |
}; |
| 837 |
|
| 838 |
function useAppEmbedder(app, createRoute, container) { |
| 839 |
console.info('HubSpot plugin - starting app embedder for:', _constants__WEBPACK_IMPORTED_MODULE_3__.AppIframe[app], container); |
| 840 |
var iframeNotRendered = (0,_utils_iframe__WEBPACK_IMPORTED_MODULE_5__.useIframeNotRendered)(_constants__WEBPACK_IMPORTED_MODULE_3__.AppIframe[app]); |
| 841 |
(0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)(function () { |
| 842 |
var _window2 = window, |
| 843 |
IntegratedAppEmbedder = _window2.IntegratedAppEmbedder; |
| 844 |
|
| 845 |
if (IntegratedAppEmbedder) { |
| 846 |
var options = getAppOptions(app, createRoute).setLocale(_constants_leadinConfig__WEBPACK_IMPORTED_MODULE_2__.locale).setDeviceId(_constants_leadinConfig__WEBPACK_IMPORTED_MODULE_2__.deviceId).setRefreshToken(_constants_leadinConfig__WEBPACK_IMPORTED_MODULE_2__.refreshToken); |
| 847 |
var embedder = new IntegratedAppEmbedder(_constants__WEBPACK_IMPORTED_MODULE_3__.AppIframe[app], _constants_leadinConfig__WEBPACK_IMPORTED_MODULE_2__.portalId, _constants_leadinConfig__WEBPACK_IMPORTED_MODULE_2__.hubspotBaseUrl, _utils_iframe__WEBPACK_IMPORTED_MODULE_5__.resizeWindow, _constants_leadinConfig__WEBPACK_IMPORTED_MODULE_2__.refreshToken ? '' : _constants_leadinConfig__WEBPACK_IMPORTED_MODULE_2__.impactLink).setOptions(options); |
| 848 |
embedder.subscribe((0,_messageMiddleware__WEBPACK_IMPORTED_MODULE_4__.messageMiddleware)(embedder)); |
| 849 |
embedder.attachTo(container, true); |
| 850 |
embedder.postStartAppMessage(); // lets the app know all all data has been passed to it |
| 851 |
|
| 852 |
window.embedder = embedder; |
| 853 |
} |
| 854 |
}, []); |
| 855 |
|
| 856 |
if (iframeNotRendered) { |
| 857 |
console.error('HubSpot plugin Iframe not rendered', { |
| 858 |
portalId: _constants_leadinConfig__WEBPACK_IMPORTED_MODULE_2__.portalId, |
| 859 |
container: container, |
| 860 |
appName: _constants__WEBPACK_IMPORTED_MODULE_3__.AppIframe[app], |
| 861 |
hasIntegratedAppEmbedder: !!window.IntegratedAppEmbedder |
| 862 |
}); |
| 863 |
_lib_Raven__WEBPACK_IMPORTED_MODULE_1__["default"].captureException(new Error('Leadin Iframe not rendered'), { |
| 864 |
fingerprint: ['USE_APP_EMBEDDER', 'IFRAME_SETUP_ERROR'], |
| 865 |
extra: { |
| 866 |
portalId: _constants_leadinConfig__WEBPACK_IMPORTED_MODULE_2__.portalId, |
| 867 |
container: container, |
| 868 |
app: app, |
| 869 |
hubspotBaseUrl: _constants_leadinConfig__WEBPACK_IMPORTED_MODULE_2__.hubspotBaseUrl, |
| 870 |
impactLink: _constants_leadinConfig__WEBPACK_IMPORTED_MODULE_2__.impactLink, |
| 871 |
appName: _constants__WEBPACK_IMPORTED_MODULE_3__.AppIframe[app], |
| 872 |
hasRefreshToken: !!_constants_leadinConfig__WEBPACK_IMPORTED_MODULE_2__.refreshToken |
| 873 |
} |
| 874 |
}); |
| 875 |
} |
| 876 |
|
| 877 |
return iframeNotRendered; |
| 878 |
} |
| 879 |
|
| 880 |
/***/ }), |
| 881 |
|
| 882 |
/***/ "./scripts/lib/Raven.ts": |
| 883 |
/*!******************************!*\ |
| 884 |
!*** ./scripts/lib/Raven.ts ***! |
| 885 |
\******************************/ |
| 886 |
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { |
| 887 |
|
| 888 |
"use strict"; |
| 889 |
__webpack_require__.r(__webpack_exports__); |
| 890 |
/* harmony export */ __webpack_require__.d(__webpack_exports__, { |
| 891 |
/* harmony export */ "configureRaven": () => (/* binding */ configureRaven), |
| 892 |
/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__) |
| 893 |
/* harmony export */ }); |
| 894 |
/* harmony import */ var raven_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! raven-js */ "./node_modules/raven-js/src/singleton.js"); |
| 895 |
/* harmony import */ var raven_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(raven_js__WEBPACK_IMPORTED_MODULE_0__); |
| 896 |
/* harmony import */ var _constants_leadinConfig__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../constants/leadinConfig */ "./scripts/constants/leadinConfig.ts"); |
| 897 |
|
| 898 |
|
| 899 |
function configureRaven() { |
| 900 |
if (_constants_leadinConfig__WEBPACK_IMPORTED_MODULE_1__.hubspotBaseUrl.indexOf('app.hubspot.com') === -1) { |
| 901 |
return; |
| 902 |
} |
| 903 |
|
| 904 |
raven_js__WEBPACK_IMPORTED_MODULE_0___default().config('https://e9b8f382cdd130c0d415cd977d2be56f@exceptions.hubspot.com/1', { |
| 905 |
instrument: { |
| 906 |
tryCatch: false |
| 907 |
}, |
| 908 |
release: _constants_leadinConfig__WEBPACK_IMPORTED_MODULE_1__.leadinPluginVersion |
| 909 |
}).install(); |
| 910 |
raven_js__WEBPACK_IMPORTED_MODULE_0___default().setTagsContext({ |
| 911 |
v: _constants_leadinConfig__WEBPACK_IMPORTED_MODULE_1__.leadinPluginVersion, |
| 912 |
php: _constants_leadinConfig__WEBPACK_IMPORTED_MODULE_1__.phpVersion, |
| 913 |
wordpress: _constants_leadinConfig__WEBPACK_IMPORTED_MODULE_1__.wpVersion |
| 914 |
}); |
| 915 |
raven_js__WEBPACK_IMPORTED_MODULE_0___default().setExtraContext({ |
| 916 |
hub: _constants_leadinConfig__WEBPACK_IMPORTED_MODULE_1__.portalId, |
| 917 |
plugins: Object.keys(_constants_leadinConfig__WEBPACK_IMPORTED_MODULE_1__.plugins).map(function (name) { |
| 918 |
return "".concat(name, "#").concat(_constants_leadinConfig__WEBPACK_IMPORTED_MODULE_1__.plugins[name]); |
| 919 |
}).join(',') |
| 920 |
}); |
| 921 |
} |
| 922 |
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ((raven_js__WEBPACK_IMPORTED_MODULE_0___default())); |
| 923 |
|
| 924 |
/***/ }), |
| 925 |
|
| 926 |
/***/ "./scripts/utils/appUtils.ts": |
| 927 |
/*!***********************************!*\ |
| 928 |
!*** ./scripts/utils/appUtils.ts ***! |
| 929 |
\***********************************/ |
| 930 |
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { |
| 931 |
|
| 932 |
"use strict"; |
| 933 |
__webpack_require__.r(__webpack_exports__); |
| 934 |
/* harmony export */ __webpack_require__.d(__webpack_exports__, { |
| 935 |
/* harmony export */ "initApp": () => (/* binding */ initApp), |
| 936 |
/* harmony export */ "initAppOnReady": () => (/* binding */ initAppOnReady) |
| 937 |
/* harmony export */ }); |
| 938 |
/* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! jquery */ "jquery"); |
| 939 |
/* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(jquery__WEBPACK_IMPORTED_MODULE_0__); |
| 940 |
/* harmony import */ var _lib_Raven__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../lib/Raven */ "./scripts/lib/Raven.ts"); |
| 941 |
|
| 942 |
|
| 943 |
function initApp(initFn) { |
| 944 |
(0,_lib_Raven__WEBPACK_IMPORTED_MODULE_1__.configureRaven)(); |
| 945 |
_lib_Raven__WEBPACK_IMPORTED_MODULE_1__["default"].context(initFn); |
| 946 |
} |
| 947 |
function initAppOnReady(initFn) { |
| 948 |
function main() { |
| 949 |
jquery__WEBPACK_IMPORTED_MODULE_0___default()(initFn); |
| 950 |
} |
| 951 |
|
| 952 |
initApp(main); |
| 953 |
} |
| 954 |
|
| 955 |
/***/ }), |
| 956 |
|
| 957 |
/***/ "./scripts/utils/contentEmbedInstaller.ts": |
| 958 |
/*!************************************************!*\ |
| 959 |
!*** ./scripts/utils/contentEmbedInstaller.ts ***! |
| 960 |
\************************************************/ |
| 961 |
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { |
| 962 |
|
| 963 |
"use strict"; |
| 964 |
__webpack_require__.r(__webpack_exports__); |
| 965 |
/* harmony export */ __webpack_require__.d(__webpack_exports__, { |
| 966 |
/* harmony export */ "startActivation": () => (/* binding */ startActivation), |
| 967 |
/* harmony export */ "startInstall": () => (/* binding */ startInstall) |
| 968 |
/* harmony export */ }); |
| 969 |
function startInstall(nonce) { |
| 970 |
var formData = new FormData(); |
| 971 |
var ajaxUrl = window.ajaxurl; |
| 972 |
formData.append('_wpnonce', nonce); |
| 973 |
formData.append('action', 'content_embed_install'); |
| 974 |
return fetch(ajaxUrl, { |
| 975 |
method: 'POST', |
| 976 |
body: formData, |
| 977 |
keepalive: true |
| 978 |
}).then(function (res) { |
| 979 |
return res.json(); |
| 980 |
}); |
| 981 |
} |
| 982 |
function startActivation(requestUrl) { |
| 983 |
return fetch(requestUrl, { |
| 984 |
method: 'POST', |
| 985 |
keepalive: true |
| 986 |
}).then(function (res) { |
| 987 |
return res.json(); |
| 988 |
}); |
| 989 |
} |
| 990 |
|
| 991 |
/***/ }), |
| 992 |
|
| 993 |
/***/ "./scripts/utils/iframe.ts": |
| 994 |
/*!*********************************!*\ |
| 995 |
!*** ./scripts/utils/iframe.ts ***! |
| 996 |
\*********************************/ |
| 997 |
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { |
| 998 |
|
| 999 |
"use strict"; |
| 1000 |
__webpack_require__.r(__webpack_exports__); |
| 1001 |
/* harmony export */ __webpack_require__.d(__webpack_exports__, { |
| 1002 |
/* harmony export */ "resizeWindow": () => (/* binding */ resizeWindow), |
| 1003 |
/* harmony export */ "useIframeNotRendered": () => (/* binding */ useIframeNotRendered) |
| 1004 |
/* harmony export */ }); |
| 1005 |
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react"); |
| 1006 |
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__); |
| 1007 |
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); } |
| 1008 |
|
| 1009 |
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } |
| 1010 |
|
| 1011 |
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } |
| 1012 |
|
| 1013 |
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; } |
| 1014 |
|
| 1015 |
function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } |
| 1016 |
|
| 1017 |
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; } |
| 1018 |
|
| 1019 |
|
| 1020 |
var IFRAME_DISPLAY_TIMEOUT = 5000; |
| 1021 |
function useIframeNotRendered(app) { |
| 1022 |
var _useState = (0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(false), |
| 1023 |
_useState2 = _slicedToArray(_useState, 2), |
| 1024 |
iframeNotRendered = _useState2[0], |
| 1025 |
setIframeNotRendered = _useState2[1]; |
| 1026 |
|
| 1027 |
(0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)(function () { |
| 1028 |
var timer = setTimeout(function () { |
| 1029 |
var iframe = document.getElementById(app); |
| 1030 |
|
| 1031 |
if (!iframe) { |
| 1032 |
setIframeNotRendered(true); |
| 1033 |
} |
| 1034 |
}, IFRAME_DISPLAY_TIMEOUT); |
| 1035 |
return function () { |
| 1036 |
if (timer) { |
| 1037 |
clearTimeout(timer); |
| 1038 |
} |
| 1039 |
}; |
| 1040 |
}, []); |
| 1041 |
return iframeNotRendered; |
| 1042 |
} |
| 1043 |
var resizeWindow = function resizeWindow() { |
| 1044 |
var adminMenuWrap = document.getElementById('adminmenuwrap'); |
| 1045 |
var sideMenuHeight = adminMenuWrap ? adminMenuWrap.offsetHeight : 0; |
| 1046 |
var adminBar = document.getElementById('wpadminbar'); |
| 1047 |
var adminBarHeight = adminBar && adminBar.offsetHeight || 0; |
| 1048 |
var offset = 4; |
| 1049 |
|
| 1050 |
if (window.innerHeight < sideMenuHeight) { |
| 1051 |
return sideMenuHeight - offset; |
| 1052 |
} else { |
| 1053 |
return window.innerHeight - adminBarHeight - offset; |
| 1054 |
} |
| 1055 |
}; |
| 1056 |
|
| 1057 |
/***/ }), |
| 1058 |
|
| 1059 |
/***/ "./scripts/utils/queryParams.ts": |
| 1060 |
/*!**************************************!*\ |
| 1061 |
!*** ./scripts/utils/queryParams.ts ***! |
| 1062 |
\**************************************/ |
| 1063 |
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { |
| 1064 |
|
| 1065 |
"use strict"; |
| 1066 |
__webpack_require__.r(__webpack_exports__); |
| 1067 |
/* harmony export */ __webpack_require__.d(__webpack_exports__, { |
| 1068 |
/* harmony export */ "addQueryObjectToUrl": () => (/* binding */ addQueryObjectToUrl), |
| 1069 |
/* harmony export */ "removeQueryParamFromLocation": () => (/* binding */ removeQueryParamFromLocation) |
| 1070 |
/* harmony export */ }); |
| 1071 |
function addQueryObjectToUrl(urlObject, queryParams) { |
| 1072 |
Object.keys(queryParams).forEach(function (key) { |
| 1073 |
urlObject.searchParams.append(key, queryParams[key]); |
| 1074 |
}); |
| 1075 |
} |
| 1076 |
function removeQueryParamFromLocation(key) { |
| 1077 |
var location = new URL(window.location.href); |
| 1078 |
location.searchParams["delete"](key); |
| 1079 |
window.history.replaceState(null, '', location.href); |
| 1080 |
} |
| 1081 |
|
| 1082 |
/***/ }), |
| 1083 |
|
| 1084 |
/***/ "./scripts/iframe/IframeErrorPage.linaria.css!=!./node_modules/@linaria/webpack5-loader/lib/outputCssLoader.js?cacheProvider=!./scripts/iframe/IframeErrorPage.tsx": |
| 1085 |
/*!*************************************************************************************************************************************************************************!*\ |
| 1086 |
!*** ./scripts/iframe/IframeErrorPage.linaria.css!=!./node_modules/@linaria/webpack5-loader/lib/outputCssLoader.js?cacheProvider=!./scripts/iframe/IframeErrorPage.tsx ***! |
| 1087 |
\*************************************************************************************************************************************************************************/ |
| 1088 |
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { |
| 1089 |
|
| 1090 |
"use strict"; |
| 1091 |
__webpack_require__.r(__webpack_exports__); |
| 1092 |
// extracted by mini-css-extract-plugin |
| 1093 |
|
| 1094 |
|
| 1095 |
/***/ }), |
| 1096 |
|
| 1097 |
/***/ "./node_modules/object-assign/index.js": |
| 1098 |
/*!*********************************************!*\ |
| 1099 |
!*** ./node_modules/object-assign/index.js ***! |
| 1100 |
\*********************************************/ |
| 1101 |
/***/ ((module) => { |
| 1102 |
|
| 1103 |
"use strict"; |
| 1104 |
/* |
| 1105 |
object-assign |
| 1106 |
(c) Sindre Sorhus |
| 1107 |
@license MIT |
| 1108 |
*/ |
| 1109 |
|
| 1110 |
|
| 1111 |
/* eslint-disable no-unused-vars */ |
| 1112 |
var getOwnPropertySymbols = Object.getOwnPropertySymbols; |
| 1113 |
var hasOwnProperty = Object.prototype.hasOwnProperty; |
| 1114 |
var propIsEnumerable = Object.prototype.propertyIsEnumerable; |
| 1115 |
|
| 1116 |
function toObject(val) { |
| 1117 |
if (val === null || val === undefined) { |
| 1118 |
throw new TypeError('Object.assign cannot be called with null or undefined'); |
| 1119 |
} |
| 1120 |
|
| 1121 |
return Object(val); |
| 1122 |
} |
| 1123 |
|
| 1124 |
function shouldUseNative() { |
| 1125 |
try { |
| 1126 |
if (!Object.assign) { |
| 1127 |
return false; |
| 1128 |
} |
| 1129 |
|
| 1130 |
// Detect buggy property enumeration order in older V8 versions. |
| 1131 |
|
| 1132 |
// https://bugs.chromium.org/p/v8/issues/detail?id=4118 |
| 1133 |
var test1 = new String('abc'); // eslint-disable-line no-new-wrappers |
| 1134 |
test1[5] = 'de'; |
| 1135 |
if (Object.getOwnPropertyNames(test1)[0] === '5') { |
| 1136 |
return false; |
| 1137 |
} |
| 1138 |
|
| 1139 |
// https://bugs.chromium.org/p/v8/issues/detail?id=3056 |
| 1140 |
var test2 = {}; |
| 1141 |
for (var i = 0; i < 10; i++) { |
| 1142 |
test2['_' + String.fromCharCode(i)] = i; |
| 1143 |
} |
| 1144 |
var order2 = Object.getOwnPropertyNames(test2).map(function (n) { |
| 1145 |
return test2[n]; |
| 1146 |
}); |
| 1147 |
if (order2.join('') !== '0123456789') { |
| 1148 |
return false; |
| 1149 |
} |
| 1150 |
|
| 1151 |
// https://bugs.chromium.org/p/v8/issues/detail?id=3056 |
| 1152 |
var test3 = {}; |
| 1153 |
'abcdefghijklmnopqrst'.split('').forEach(function (letter) { |
| 1154 |
test3[letter] = letter; |
| 1155 |
}); |
| 1156 |
if (Object.keys(Object.assign({}, test3)).join('') !== |
| 1157 |
'abcdefghijklmnopqrst') { |
| 1158 |
return false; |
| 1159 |
} |
| 1160 |
|
| 1161 |
return true; |
| 1162 |
} catch (err) { |
| 1163 |
// We don't expect any of the above to throw, but better to be safe. |
| 1164 |
return false; |
| 1165 |
} |
| 1166 |
} |
| 1167 |
|
| 1168 |
module.exports = shouldUseNative() ? Object.assign : function (target, source) { |
| 1169 |
var from; |
| 1170 |
var to = toObject(target); |
| 1171 |
var symbols; |
| 1172 |
|
| 1173 |
for (var s = 1; s < arguments.length; s++) { |
| 1174 |
from = Object(arguments[s]); |
| 1175 |
|
| 1176 |
for (var key in from) { |
| 1177 |
if (hasOwnProperty.call(from, key)) { |
| 1178 |
to[key] = from[key]; |
| 1179 |
} |
| 1180 |
} |
| 1181 |
|
| 1182 |
if (getOwnPropertySymbols) { |
| 1183 |
symbols = getOwnPropertySymbols(from); |
| 1184 |
for (var i = 0; i < symbols.length; i++) { |
| 1185 |
if (propIsEnumerable.call(from, symbols[i])) { |
| 1186 |
to[symbols[i]] = from[symbols[i]]; |
| 1187 |
} |
| 1188 |
} |
| 1189 |
} |
| 1190 |
} |
| 1191 |
|
| 1192 |
return to; |
| 1193 |
}; |
| 1194 |
|
| 1195 |
|
| 1196 |
/***/ }), |
| 1197 |
|
| 1198 |
/***/ "./node_modules/raven-js/src/configError.js": |
| 1199 |
/*!**************************************************!*\ |
| 1200 |
!*** ./node_modules/raven-js/src/configError.js ***! |
| 1201 |
\**************************************************/ |
| 1202 |
/***/ ((module) => { |
| 1203 |
|
| 1204 |
function RavenConfigError(message) { |
| 1205 |
this.name = 'RavenConfigError'; |
| 1206 |
this.message = message; |
| 1207 |
} |
| 1208 |
RavenConfigError.prototype = new Error(); |
| 1209 |
RavenConfigError.prototype.constructor = RavenConfigError; |
| 1210 |
|
| 1211 |
module.exports = RavenConfigError; |
| 1212 |
|
| 1213 |
|
| 1214 |
/***/ }), |
| 1215 |
|
| 1216 |
/***/ "./node_modules/raven-js/src/console.js": |
| 1217 |
/*!**********************************************!*\ |
| 1218 |
!*** ./node_modules/raven-js/src/console.js ***! |
| 1219 |
\**********************************************/ |
| 1220 |
/***/ ((module) => { |
| 1221 |
|
| 1222 |
var wrapMethod = function(console, level, callback) { |
| 1223 |
var originalConsoleLevel = console[level]; |
| 1224 |
var originalConsole = console; |
| 1225 |
|
| 1226 |
if (!(level in console)) { |
| 1227 |
return; |
| 1228 |
} |
| 1229 |
|
| 1230 |
var sentryLevel = level === 'warn' ? 'warning' : level; |
| 1231 |
|
| 1232 |
console[level] = function() { |
| 1233 |
var args = [].slice.call(arguments); |
| 1234 |
|
| 1235 |
var msg = '' + args.join(' '); |
| 1236 |
var data = {level: sentryLevel, logger: 'console', extra: {arguments: args}}; |
| 1237 |
|
| 1238 |
if (level === 'assert') { |
| 1239 |
if (args[0] === false) { |
| 1240 |
// Default browsers message |
| 1241 |
msg = 'Assertion failed: ' + (args.slice(1).join(' ') || 'console.assert'); |
| 1242 |
data.extra.arguments = args.slice(1); |
| 1243 |
callback && callback(msg, data); |
| 1244 |
} |
| 1245 |
} else { |
| 1246 |
callback && callback(msg, data); |
| 1247 |
} |
| 1248 |
|
| 1249 |
// this fails for some browsers. :( |
| 1250 |
if (originalConsoleLevel) { |
| 1251 |
// IE9 doesn't allow calling apply on console functions directly |
| 1252 |
// See: https://stackoverflow.com/questions/5472938/does-ie9-support-console-log-and-is-it-a-real-function#answer-5473193 |
| 1253 |
Function.prototype.apply.call(originalConsoleLevel, originalConsole, args); |
| 1254 |
} |
| 1255 |
}; |
| 1256 |
}; |
| 1257 |
|
| 1258 |
module.exports = { |
| 1259 |
wrapMethod: wrapMethod |
| 1260 |
}; |
| 1261 |
|
| 1262 |
|
| 1263 |
/***/ }), |
| 1264 |
|
| 1265 |
/***/ "./node_modules/raven-js/src/raven.js": |
| 1266 |
/*!********************************************!*\ |
| 1267 |
!*** ./node_modules/raven-js/src/raven.js ***! |
| 1268 |
\********************************************/ |
| 1269 |
/***/ ((module, __unused_webpack_exports, __webpack_require__) => { |
| 1270 |
|
| 1271 |
/*global XDomainRequest:false */ |
| 1272 |
|
| 1273 |
var TraceKit = __webpack_require__(/*! ../vendor/TraceKit/tracekit */ "./node_modules/raven-js/vendor/TraceKit/tracekit.js"); |
| 1274 |
var stringify = __webpack_require__(/*! ../vendor/json-stringify-safe/stringify */ "./node_modules/raven-js/vendor/json-stringify-safe/stringify.js"); |
| 1275 |
var RavenConfigError = __webpack_require__(/*! ./configError */ "./node_modules/raven-js/src/configError.js"); |
| 1276 |
|
| 1277 |
var utils = __webpack_require__(/*! ./utils */ "./node_modules/raven-js/src/utils.js"); |
| 1278 |
var isError = utils.isError; |
| 1279 |
var isObject = utils.isObject; |
| 1280 |
var isObject = utils.isObject; |
| 1281 |
var isErrorEvent = utils.isErrorEvent; |
| 1282 |
var isUndefined = utils.isUndefined; |
| 1283 |
var isFunction = utils.isFunction; |
| 1284 |
var isString = utils.isString; |
| 1285 |
var isEmptyObject = utils.isEmptyObject; |
| 1286 |
var each = utils.each; |
| 1287 |
var objectMerge = utils.objectMerge; |
| 1288 |
var truncate = utils.truncate; |
| 1289 |
var objectFrozen = utils.objectFrozen; |
| 1290 |
var hasKey = utils.hasKey; |
| 1291 |
var joinRegExp = utils.joinRegExp; |
| 1292 |
var urlencode = utils.urlencode; |
| 1293 |
var uuid4 = utils.uuid4; |
| 1294 |
var htmlTreeAsString = utils.htmlTreeAsString; |
| 1295 |
var isSameException = utils.isSameException; |
| 1296 |
var isSameStacktrace = utils.isSameStacktrace; |
| 1297 |
var parseUrl = utils.parseUrl; |
| 1298 |
var fill = utils.fill; |
| 1299 |
|
| 1300 |
var wrapConsoleMethod = (__webpack_require__(/*! ./console */ "./node_modules/raven-js/src/console.js").wrapMethod); |
| 1301 |
|
| 1302 |
var dsnKeys = 'source protocol user pass host port path'.split(' '), |
| 1303 |
dsnPattern = /^(?:(\w+):)?\/\/(?:(\w+)(:\w+)?@)?([\w\.-]+)(?::(\d+))?(\/.*)/; |
| 1304 |
|
| 1305 |
function now() { |
| 1306 |
return +new Date(); |
| 1307 |
} |
| 1308 |
|
| 1309 |
// This is to be defensive in environments where window does not exist (see https://github.com/getsentry/raven-js/pull/785) |
| 1310 |
var _window = |
| 1311 |
typeof window !== 'undefined' |
| 1312 |
? window |
| 1313 |
: typeof __webpack_require__.g !== 'undefined' ? __webpack_require__.g : typeof self !== 'undefined' ? self : {}; |
| 1314 |
var _document = _window.document; |
| 1315 |
var _navigator = _window.navigator; |
| 1316 |
|
| 1317 |
function keepOriginalCallback(original, callback) { |
| 1318 |
return isFunction(callback) |
| 1319 |
? function(data) { |
| 1320 |
return callback(data, original); |
| 1321 |
} |
| 1322 |
: callback; |
| 1323 |
} |
| 1324 |
|
| 1325 |
// First, check for JSON support |
| 1326 |
// If there is no JSON, we no-op the core features of Raven |
| 1327 |
// since JSON is required to encode the payload |
| 1328 |
function Raven() { |
| 1329 |
this._hasJSON = !!(typeof JSON === 'object' && JSON.stringify); |
| 1330 |
// Raven can run in contexts where there's no document (react-native) |
| 1331 |
this._hasDocument = !isUndefined(_document); |
| 1332 |
this._hasNavigator = !isUndefined(_navigator); |
| 1333 |
this._lastCapturedException = null; |
| 1334 |
this._lastData = null; |
| 1335 |
this._lastEventId = null; |
| 1336 |
this._globalServer = null; |
| 1337 |
this._globalKey = null; |
| 1338 |
this._globalProject = null; |
| 1339 |
this._globalContext = {}; |
| 1340 |
this._globalOptions = { |
| 1341 |
logger: 'javascript', |
| 1342 |
ignoreErrors: [], |
| 1343 |
ignoreUrls: [], |
| 1344 |
whitelistUrls: [], |
| 1345 |
includePaths: [], |
| 1346 |
collectWindowErrors: true, |
| 1347 |
maxMessageLength: 0, |
| 1348 |
|
| 1349 |
// By default, truncates URL values to 250 chars |
| 1350 |
maxUrlLength: 250, |
| 1351 |
stackTraceLimit: 50, |
| 1352 |
autoBreadcrumbs: true, |
| 1353 |
instrument: true, |
| 1354 |
sampleRate: 1 |
| 1355 |
}; |
| 1356 |
this._ignoreOnError = 0; |
| 1357 |
this._isRavenInstalled = false; |
| 1358 |
this._originalErrorStackTraceLimit = Error.stackTraceLimit; |
| 1359 |
// capture references to window.console *and* all its methods first |
| 1360 |
// before the console plugin has a chance to monkey patch |
| 1361 |
this._originalConsole = _window.console || {}; |
| 1362 |
this._originalConsoleMethods = {}; |
| 1363 |
this._plugins = []; |
| 1364 |
this._startTime = now(); |
| 1365 |
this._wrappedBuiltIns = []; |
| 1366 |
this._breadcrumbs = []; |
| 1367 |
this._lastCapturedEvent = null; |
| 1368 |
this._keypressTimeout; |
| 1369 |
this._location = _window.location; |
| 1370 |
this._lastHref = this._location && this._location.href; |
| 1371 |
this._resetBackoff(); |
| 1372 |
|
| 1373 |
// eslint-disable-next-line guard-for-in |
| 1374 |
for (var method in this._originalConsole) { |
| 1375 |
this._originalConsoleMethods[method] = this._originalConsole[method]; |
| 1376 |
} |
| 1377 |
} |
| 1378 |
|
| 1379 |
/* |
| 1380 |
* The core Raven singleton |
| 1381 |
* |
| 1382 |
* @this {Raven} |
| 1383 |
*/ |
| 1384 |
|
| 1385 |
Raven.prototype = { |
| 1386 |
// Hardcode version string so that raven source can be loaded directly via |
| 1387 |
// webpack (using a build step causes webpack #1617). Grunt verifies that |
| 1388 |
// this value matches package.json during build. |
| 1389 |
// See: https://github.com/getsentry/raven-js/issues/465 |
| 1390 |
VERSION: '3.19.1', |
| 1391 |
|
| 1392 |
debug: false, |
| 1393 |
|
| 1394 |
TraceKit: TraceKit, // alias to TraceKit |
| 1395 |
|
| 1396 |
/* |
| 1397 |
* Configure Raven with a DSN and extra options |
| 1398 |
* |
| 1399 |
* @param {string} dsn The public Sentry DSN |
| 1400 |
* @param {object} options Set of global options [optional] |
| 1401 |
* @return {Raven} |
| 1402 |
*/ |
| 1403 |
config: function(dsn, options) { |
| 1404 |
var self = this; |
| 1405 |
|
| 1406 |
if (self._globalServer) { |
| 1407 |
this._logDebug('error', 'Error: Raven has already been configured'); |
| 1408 |
return self; |
| 1409 |
} |
| 1410 |
if (!dsn) return self; |
| 1411 |
|
| 1412 |
var globalOptions = self._globalOptions; |
| 1413 |
|
| 1414 |
// merge in options |
| 1415 |
if (options) { |
| 1416 |
each(options, function(key, value) { |
| 1417 |
// tags and extra are special and need to be put into context |
| 1418 |
if (key === 'tags' || key === 'extra' || key === 'user') { |
| 1419 |
self._globalContext[key] = value; |
| 1420 |
} else { |
| 1421 |
globalOptions[key] = value; |
| 1422 |
} |
| 1423 |
}); |
| 1424 |
} |
| 1425 |
|
| 1426 |
self.setDSN(dsn); |
| 1427 |
|
| 1428 |
// "Script error." is hard coded into browsers for errors that it can't read. |
| 1429 |
// this is the result of a script being pulled in from an external domain and CORS. |
| 1430 |
globalOptions.ignoreErrors.push(/^Script error\.?$/); |
| 1431 |
globalOptions.ignoreErrors.push(/^Javascript error: Script error\.? on line 0$/); |
| 1432 |
|
| 1433 |
// join regexp rules into one big rule |
| 1434 |
globalOptions.ignoreErrors = joinRegExp(globalOptions.ignoreErrors); |
| 1435 |
globalOptions.ignoreUrls = globalOptions.ignoreUrls.length |
| 1436 |
? joinRegExp(globalOptions.ignoreUrls) |
| 1437 |
: false; |
| 1438 |
globalOptions.whitelistUrls = globalOptions.whitelistUrls.length |
| 1439 |
? joinRegExp(globalOptions.whitelistUrls) |
| 1440 |
: false; |
| 1441 |
globalOptions.includePaths = joinRegExp(globalOptions.includePaths); |
| 1442 |
globalOptions.maxBreadcrumbs = Math.max( |
| 1443 |
0, |
| 1444 |
Math.min(globalOptions.maxBreadcrumbs || 100, 100) |
| 1445 |
); // default and hard limit is 100 |
| 1446 |
|
| 1447 |
var autoBreadcrumbDefaults = { |
| 1448 |
xhr: true, |
| 1449 |
console: true, |
| 1450 |
dom: true, |
| 1451 |
location: true |
| 1452 |
}; |
| 1453 |
|
| 1454 |
var autoBreadcrumbs = globalOptions.autoBreadcrumbs; |
| 1455 |
if ({}.toString.call(autoBreadcrumbs) === '[object Object]') { |
| 1456 |
autoBreadcrumbs = objectMerge(autoBreadcrumbDefaults, autoBreadcrumbs); |
| 1457 |
} else if (autoBreadcrumbs !== false) { |
| 1458 |
autoBreadcrumbs = autoBreadcrumbDefaults; |
| 1459 |
} |
| 1460 |
globalOptions.autoBreadcrumbs = autoBreadcrumbs; |
| 1461 |
|
| 1462 |
var instrumentDefaults = { |
| 1463 |
tryCatch: true |
| 1464 |
}; |
| 1465 |
|
| 1466 |
var instrument = globalOptions.instrument; |
| 1467 |
if ({}.toString.call(instrument) === '[object Object]') { |
| 1468 |
instrument = objectMerge(instrumentDefaults, instrument); |
| 1469 |
} else if (instrument !== false) { |
| 1470 |
instrument = instrumentDefaults; |
| 1471 |
} |
| 1472 |
globalOptions.instrument = instrument; |
| 1473 |
|
| 1474 |
TraceKit.collectWindowErrors = !!globalOptions.collectWindowErrors; |
| 1475 |
|
| 1476 |
// return for chaining |
| 1477 |
return self; |
| 1478 |
}, |
| 1479 |
|
| 1480 |
/* |
| 1481 |
* Installs a global window.onerror error handler |
| 1482 |
* to capture and report uncaught exceptions. |
| 1483 |
* At this point, install() is required to be called due |
| 1484 |
* to the way TraceKit is set up. |
| 1485 |
* |
| 1486 |
* @return {Raven} |
| 1487 |
*/ |
| 1488 |
install: function() { |
| 1489 |
var self = this; |
| 1490 |
if (self.isSetup() && !self._isRavenInstalled) { |
| 1491 |
TraceKit.report.subscribe(function() { |
| 1492 |
self._handleOnErrorStackInfo.apply(self, arguments); |
| 1493 |
}); |
| 1494 |
if (self._globalOptions.instrument && self._globalOptions.instrument.tryCatch) { |
| 1495 |
self._instrumentTryCatch(); |
| 1496 |
} |
| 1497 |
|
| 1498 |
if (self._globalOptions.autoBreadcrumbs) self._instrumentBreadcrumbs(); |
| 1499 |
|
| 1500 |
// Install all of the plugins |
| 1501 |
self._drainPlugins(); |
| 1502 |
|
| 1503 |
self._isRavenInstalled = true; |
| 1504 |
} |
| 1505 |
|
| 1506 |
Error.stackTraceLimit = self._globalOptions.stackTraceLimit; |
| 1507 |
return this; |
| 1508 |
}, |
| 1509 |
|
| 1510 |
/* |
| 1511 |
* Set the DSN (can be called multiple time unlike config) |
| 1512 |
* |
| 1513 |
* @param {string} dsn The public Sentry DSN |
| 1514 |
*/ |
| 1515 |
setDSN: function(dsn) { |
| 1516 |
var self = this, |
| 1517 |
uri = self._parseDSN(dsn), |
| 1518 |
lastSlash = uri.path.lastIndexOf('/'), |
| 1519 |
path = uri.path.substr(1, lastSlash); |
| 1520 |
|
| 1521 |
self._dsn = dsn; |
| 1522 |
self._globalKey = uri.user; |
| 1523 |
self._globalSecret = uri.pass && uri.pass.substr(1); |
| 1524 |
self._globalProject = uri.path.substr(lastSlash + 1); |
| 1525 |
|
| 1526 |
self._globalServer = self._getGlobalServer(uri); |
| 1527 |
|
| 1528 |
self._globalEndpoint = |
| 1529 |
self._globalServer + '/' + path + 'api/' + self._globalProject + '/store/'; |
| 1530 |
|
| 1531 |
// Reset backoff state since we may be pointing at a |
| 1532 |
// new project/server |
| 1533 |
this._resetBackoff(); |
| 1534 |
}, |
| 1535 |
|
| 1536 |
/* |
| 1537 |
* Wrap code within a context so Raven can capture errors |
| 1538 |
* reliably across domains that is executed immediately. |
| 1539 |
* |
| 1540 |
* @param {object} options A specific set of options for this context [optional] |
| 1541 |
* @param {function} func The callback to be immediately executed within the context |
| 1542 |
* @param {array} args An array of arguments to be called with the callback [optional] |
| 1543 |
*/ |
| 1544 |
context: function(options, func, args) { |
| 1545 |
if (isFunction(options)) { |
| 1546 |
args = func || []; |
| 1547 |
func = options; |
| 1548 |
options = undefined; |
| 1549 |
} |
| 1550 |
|
| 1551 |
return this.wrap(options, func).apply(this, args); |
| 1552 |
}, |
| 1553 |
|
| 1554 |
/* |
| 1555 |
* Wrap code within a context and returns back a new function to be executed |
| 1556 |
* |
| 1557 |
* @param {object} options A specific set of options for this context [optional] |
| 1558 |
* @param {function} func The function to be wrapped in a new context |
| 1559 |
* @param {function} func A function to call before the try/catch wrapper [optional, private] |
| 1560 |
* @return {function} The newly wrapped functions with a context |
| 1561 |
*/ |
| 1562 |
wrap: function(options, func, _before) { |
| 1563 |
var self = this; |
| 1564 |
// 1 argument has been passed, and it's not a function |
| 1565 |
// so just return it |
| 1566 |
if (isUndefined(func) && !isFunction(options)) { |
| 1567 |
return options; |
| 1568 |
} |
| 1569 |
|
| 1570 |
// options is optional |
| 1571 |
if (isFunction(options)) { |
| 1572 |
func = options; |
| 1573 |
options = undefined; |
| 1574 |
} |
| 1575 |
|
| 1576 |
// At this point, we've passed along 2 arguments, and the second one |
| 1577 |
// is not a function either, so we'll just return the second argument. |
| 1578 |
if (!isFunction(func)) { |
| 1579 |
return func; |
| 1580 |
} |
| 1581 |
|
| 1582 |
// We don't wanna wrap it twice! |
| 1583 |
try { |
| 1584 |
if (func.__raven__) { |
| 1585 |
return func; |
| 1586 |
} |
| 1587 |
|
| 1588 |
// If this has already been wrapped in the past, return that |
| 1589 |
if (func.__raven_wrapper__) { |
| 1590 |
return func.__raven_wrapper__; |
| 1591 |
} |
| 1592 |
} catch (e) { |
| 1593 |
// Just accessing custom props in some Selenium environments |
| 1594 |
// can cause a "Permission denied" exception (see raven-js#495). |
| 1595 |
// Bail on wrapping and return the function as-is (defers to window.onerror). |
| 1596 |
return func; |
| 1597 |
} |
| 1598 |
|
| 1599 |
function wrapped() { |
| 1600 |
var args = [], |
| 1601 |
i = arguments.length, |
| 1602 |
deep = !options || (options && options.deep !== false); |
| 1603 |
|
| 1604 |
if (_before && isFunction(_before)) { |
| 1605 |
_before.apply(this, arguments); |
| 1606 |
} |
| 1607 |
|
| 1608 |
// Recursively wrap all of a function's arguments that are |
| 1609 |
// functions themselves. |
| 1610 |
while (i--) args[i] = deep ? self.wrap(options, arguments[i]) : arguments[i]; |
| 1611 |
|
| 1612 |
try { |
| 1613 |
// Attempt to invoke user-land function |
| 1614 |
// NOTE: If you are a Sentry user, and you are seeing this stack frame, it |
| 1615 |
// means Raven caught an error invoking your application code. This is |
| 1616 |
// expected behavior and NOT indicative of a bug with Raven.js. |
| 1617 |
return func.apply(this, args); |
| 1618 |
} catch (e) { |
| 1619 |
self._ignoreNextOnError(); |
| 1620 |
self.captureException(e, options); |
| 1621 |
throw e; |
| 1622 |
} |
| 1623 |
} |
| 1624 |
|
| 1625 |
// copy over properties of the old function |
| 1626 |
for (var property in func) { |
| 1627 |
if (hasKey(func, property)) { |
| 1628 |
wrapped[property] = func[property]; |
| 1629 |
} |
| 1630 |
} |
| 1631 |
wrapped.prototype = func.prototype; |
| 1632 |
|
| 1633 |
func.__raven_wrapper__ = wrapped; |
| 1634 |
// Signal that this function has been wrapped already |
| 1635 |
// for both debugging and to prevent it to being wrapped twice |
| 1636 |
wrapped.__raven__ = true; |
| 1637 |
wrapped.__inner__ = func; |
| 1638 |
|
| 1639 |
return wrapped; |
| 1640 |
}, |
| 1641 |
|
| 1642 |
/* |
| 1643 |
* Uninstalls the global error handler. |
| 1644 |
* |
| 1645 |
* @return {Raven} |
| 1646 |
*/ |
| 1647 |
uninstall: function() { |
| 1648 |
TraceKit.report.uninstall(); |
| 1649 |
|
| 1650 |
this._restoreBuiltIns(); |
| 1651 |
|
| 1652 |
Error.stackTraceLimit = this._originalErrorStackTraceLimit; |
| 1653 |
this._isRavenInstalled = false; |
| 1654 |
|
| 1655 |
return this; |
| 1656 |
}, |
| 1657 |
|
| 1658 |
/* |
| 1659 |
* Manually capture an exception and send it over to Sentry |
| 1660 |
* |
| 1661 |
* @param {error} ex An exception to be logged |
| 1662 |
* @param {object} options A specific set of options for this error [optional] |
| 1663 |
* @return {Raven} |
| 1664 |
*/ |
| 1665 |
captureException: function(ex, options) { |
| 1666 |
// Cases for sending ex as a message, rather than an exception |
| 1667 |
var isNotError = !isError(ex); |
| 1668 |
var isNotErrorEvent = !isErrorEvent(ex); |
| 1669 |
var isErrorEventWithoutError = isErrorEvent(ex) && !ex.error; |
| 1670 |
|
| 1671 |
if ((isNotError && isNotErrorEvent) || isErrorEventWithoutError) { |
| 1672 |
return this.captureMessage( |
| 1673 |
ex, |
| 1674 |
objectMerge( |
| 1675 |
{ |
| 1676 |
trimHeadFrames: 1, |
| 1677 |
stacktrace: true // if we fall back to captureMessage, default to attempting a new trace |
| 1678 |
}, |
| 1679 |
options |
| 1680 |
) |
| 1681 |
); |
| 1682 |
} |
| 1683 |
|
| 1684 |
// Get actual Error from ErrorEvent |
| 1685 |
if (isErrorEvent(ex)) ex = ex.error; |
| 1686 |
|
| 1687 |
// Store the raw exception object for potential debugging and introspection |
| 1688 |
this._lastCapturedException = ex; |
| 1689 |
|
| 1690 |
// TraceKit.report will re-raise any exception passed to it, |
| 1691 |
// which means you have to wrap it in try/catch. Instead, we |
| 1692 |
// can wrap it here and only re-raise if TraceKit.report |
| 1693 |
// raises an exception different from the one we asked to |
| 1694 |
// report on. |
| 1695 |
try { |
| 1696 |
var stack = TraceKit.computeStackTrace(ex); |
| 1697 |
this._handleStackInfo(stack, options); |
| 1698 |
} catch (ex1) { |
| 1699 |
if (ex !== ex1) { |
| 1700 |
throw ex1; |
| 1701 |
} |
| 1702 |
} |
| 1703 |
|
| 1704 |
return this; |
| 1705 |
}, |
| 1706 |
|
| 1707 |
/* |
| 1708 |
* Manually send a message to Sentry |
| 1709 |
* |
| 1710 |
* @param {string} msg A plain message to be captured in Sentry |
| 1711 |
* @param {object} options A specific set of options for this message [optional] |
| 1712 |
* @return {Raven} |
| 1713 |
*/ |
| 1714 |
captureMessage: function(msg, options) { |
| 1715 |
// config() automagically converts ignoreErrors from a list to a RegExp so we need to test for an |
| 1716 |
// early call; we'll error on the side of logging anything called before configuration since it's |
| 1717 |
// probably something you should see: |
| 1718 |
if ( |
| 1719 |
!!this._globalOptions.ignoreErrors.test && |
| 1720 |
this._globalOptions.ignoreErrors.test(msg) |
| 1721 |
) { |
| 1722 |
return; |
| 1723 |
} |
| 1724 |
|
| 1725 |
options = options || {}; |
| 1726 |
|
| 1727 |
var data = objectMerge( |
| 1728 |
{ |
| 1729 |
message: msg + '' // Make sure it's actually a string |
| 1730 |
}, |
| 1731 |
options |
| 1732 |
); |
| 1733 |
|
| 1734 |
var ex; |
| 1735 |
// Generate a "synthetic" stack trace from this point. |
| 1736 |
// NOTE: If you are a Sentry user, and you are seeing this stack frame, it is NOT indicative |
| 1737 |
// of a bug with Raven.js. Sentry generates synthetic traces either by configuration, |
| 1738 |
// or if it catches a thrown object without a "stack" property. |
| 1739 |
try { |
| 1740 |
throw new Error(msg); |
| 1741 |
} catch (ex1) { |
| 1742 |
ex = ex1; |
| 1743 |
} |
| 1744 |
|
| 1745 |
// null exception name so `Error` isn't prefixed to msg |
| 1746 |
ex.name = null; |
| 1747 |
var stack = TraceKit.computeStackTrace(ex); |
| 1748 |
|
| 1749 |
// stack[0] is `throw new Error(msg)` call itself, we are interested in the frame that was just before that, stack[1] |
| 1750 |
var initialCall = stack.stack[1]; |
| 1751 |
|
| 1752 |
var fileurl = (initialCall && initialCall.url) || ''; |
| 1753 |
|
| 1754 |
if ( |
| 1755 |
!!this._globalOptions.ignoreUrls.test && |
| 1756 |
this._globalOptions.ignoreUrls.test(fileurl) |
| 1757 |
) { |
| 1758 |
return; |
| 1759 |
} |
| 1760 |
|
| 1761 |
if ( |
| 1762 |
!!this._globalOptions.whitelistUrls.test && |
| 1763 |
!this._globalOptions.whitelistUrls.test(fileurl) |
| 1764 |
) { |
| 1765 |
return; |
| 1766 |
} |
| 1767 |
|
| 1768 |
if (this._globalOptions.stacktrace || (options && options.stacktrace)) { |
| 1769 |
options = objectMerge( |
| 1770 |
{ |
| 1771 |
// fingerprint on msg, not stack trace (legacy behavior, could be |
| 1772 |
// revisited) |
| 1773 |
fingerprint: msg, |
| 1774 |
// since we know this is a synthetic trace, the top N-most frames |
| 1775 |
// MUST be from Raven.js, so mark them as in_app later by setting |
| 1776 |
// trimHeadFrames |
| 1777 |
trimHeadFrames: (options.trimHeadFrames || 0) + 1 |
| 1778 |
}, |
| 1779 |
options |
| 1780 |
); |
| 1781 |
|
| 1782 |
var frames = this._prepareFrames(stack, options); |
| 1783 |
data.stacktrace = { |
| 1784 |
// Sentry expects frames oldest to newest |
| 1785 |
frames: frames.reverse() |
| 1786 |
}; |
| 1787 |
} |
| 1788 |
|
| 1789 |
// Fire away! |
| 1790 |
this._send(data); |
| 1791 |
|
| 1792 |
return this; |
| 1793 |
}, |
| 1794 |
|
| 1795 |
captureBreadcrumb: function(obj) { |
| 1796 |
var crumb = objectMerge( |
| 1797 |
{ |
| 1798 |
timestamp: now() / 1000 |
| 1799 |
}, |
| 1800 |
obj |
| 1801 |
); |
| 1802 |
|
| 1803 |
if (isFunction(this._globalOptions.breadcrumbCallback)) { |
| 1804 |
var result = this._globalOptions.breadcrumbCallback(crumb); |
| 1805 |
|
| 1806 |
if (isObject(result) && !isEmptyObject(result)) { |
| 1807 |
crumb = result; |
| 1808 |
} else if (result === false) { |
| 1809 |
return this; |
| 1810 |
} |
| 1811 |
} |
| 1812 |
|
| 1813 |
this._breadcrumbs.push(crumb); |
| 1814 |
if (this._breadcrumbs.length > this._globalOptions.maxBreadcrumbs) { |
| 1815 |
this._breadcrumbs.shift(); |
| 1816 |
} |
| 1817 |
return this; |
| 1818 |
}, |
| 1819 |
|
| 1820 |
addPlugin: function(plugin /*arg1, arg2, ... argN*/) { |
| 1821 |
var pluginArgs = [].slice.call(arguments, 1); |
| 1822 |
|
| 1823 |
this._plugins.push([plugin, pluginArgs]); |
| 1824 |
if (this._isRavenInstalled) { |
| 1825 |
this._drainPlugins(); |
| 1826 |
} |
| 1827 |
|
| 1828 |
return this; |
| 1829 |
}, |
| 1830 |
|
| 1831 |
/* |
| 1832 |
* Set/clear a user to be sent along with the payload. |
| 1833 |
* |
| 1834 |
* @param {object} user An object representing user data [optional] |
| 1835 |
* @return {Raven} |
| 1836 |
*/ |
| 1837 |
setUserContext: function(user) { |
| 1838 |
// Intentionally do not merge here since that's an unexpected behavior. |
| 1839 |
this._globalContext.user = user; |
| 1840 |
|
| 1841 |
return this; |
| 1842 |
}, |
| 1843 |
|
| 1844 |
/* |
| 1845 |
* Merge extra attributes to be sent along with the payload. |
| 1846 |
* |
| 1847 |
* @param {object} extra An object representing extra data [optional] |
| 1848 |
* @return {Raven} |
| 1849 |
*/ |
| 1850 |
setExtraContext: function(extra) { |
| 1851 |
this._mergeContext('extra', extra); |
| 1852 |
|
| 1853 |
return this; |
| 1854 |
}, |
| 1855 |
|
| 1856 |
/* |
| 1857 |
* Merge tags to be sent along with the payload. |
| 1858 |
* |
| 1859 |
* @param {object} tags An object representing tags [optional] |
| 1860 |
* @return {Raven} |
| 1861 |
*/ |
| 1862 |
setTagsContext: function(tags) { |
| 1863 |
this._mergeContext('tags', tags); |
| 1864 |
|
| 1865 |
return this; |
| 1866 |
}, |
| 1867 |
|
| 1868 |
/* |
| 1869 |
* Clear all of the context. |
| 1870 |
* |
| 1871 |
* @return {Raven} |
| 1872 |
*/ |
| 1873 |
clearContext: function() { |
| 1874 |
this._globalContext = {}; |
| 1875 |
|
| 1876 |
return this; |
| 1877 |
}, |
| 1878 |
|
| 1879 |
/* |
| 1880 |
* Get a copy of the current context. This cannot be mutated. |
| 1881 |
* |
| 1882 |
* @return {object} copy of context |
| 1883 |
*/ |
| 1884 |
getContext: function() { |
| 1885 |
// lol javascript |
| 1886 |
return JSON.parse(stringify(this._globalContext)); |
| 1887 |
}, |
| 1888 |
|
| 1889 |
/* |
| 1890 |
* Set environment of application |
| 1891 |
* |
| 1892 |
* @param {string} environment Typically something like 'production'. |
| 1893 |
* @return {Raven} |
| 1894 |
*/ |
| 1895 |
setEnvironment: function(environment) { |
| 1896 |
this._globalOptions.environment = environment; |
| 1897 |
|
| 1898 |
return this; |
| 1899 |
}, |
| 1900 |
|
| 1901 |
/* |
| 1902 |
* Set release version of application |
| 1903 |
* |
| 1904 |
* @param {string} release Typically something like a git SHA to identify version |
| 1905 |
* @return {Raven} |
| 1906 |
*/ |
| 1907 |
setRelease: function(release) { |
| 1908 |
this._globalOptions.release = release; |
| 1909 |
|
| 1910 |
return this; |
| 1911 |
}, |
| 1912 |
|
| 1913 |
/* |
| 1914 |
* Set the dataCallback option |
| 1915 |
* |
| 1916 |
* @param {function} callback The callback to run which allows the |
| 1917 |
* data blob to be mutated before sending |
| 1918 |
* @return {Raven} |
| 1919 |
*/ |
| 1920 |
setDataCallback: function(callback) { |
| 1921 |
var original = this._globalOptions.dataCallback; |
| 1922 |
this._globalOptions.dataCallback = keepOriginalCallback(original, callback); |
| 1923 |
return this; |
| 1924 |
}, |
| 1925 |
|
| 1926 |
/* |
| 1927 |
* Set the breadcrumbCallback option |
| 1928 |
* |
| 1929 |
* @param {function} callback The callback to run which allows filtering |
| 1930 |
* or mutating breadcrumbs |
| 1931 |
* @return {Raven} |
| 1932 |
*/ |
| 1933 |
setBreadcrumbCallback: function(callback) { |
| 1934 |
var original = this._globalOptions.breadcrumbCallback; |
| 1935 |
this._globalOptions.breadcrumbCallback = keepOriginalCallback(original, callback); |
| 1936 |
return this; |
| 1937 |
}, |
| 1938 |
|
| 1939 |
/* |
| 1940 |
* Set the shouldSendCallback option |
| 1941 |
* |
| 1942 |
* @param {function} callback The callback to run which allows |
| 1943 |
* introspecting the blob before sending |
| 1944 |
* @return {Raven} |
| 1945 |
*/ |
| 1946 |
setShouldSendCallback: function(callback) { |
| 1947 |
var original = this._globalOptions.shouldSendCallback; |
| 1948 |
this._globalOptions.shouldSendCallback = keepOriginalCallback(original, callback); |
| 1949 |
return this; |
| 1950 |
}, |
| 1951 |
|
| 1952 |
/** |
| 1953 |
* Override the default HTTP transport mechanism that transmits data |
| 1954 |
* to the Sentry server. |
| 1955 |
* |
| 1956 |
* @param {function} transport Function invoked instead of the default |
| 1957 |
* `makeRequest` handler. |
| 1958 |
* |
| 1959 |
* @return {Raven} |
| 1960 |
*/ |
| 1961 |
setTransport: function(transport) { |
| 1962 |
this._globalOptions.transport = transport; |
| 1963 |
|
| 1964 |
return this; |
| 1965 |
}, |
| 1966 |
|
| 1967 |
/* |
| 1968 |
* Get the latest raw exception that was captured by Raven. |
| 1969 |
* |
| 1970 |
* @return {error} |
| 1971 |
*/ |
| 1972 |
lastException: function() { |
| 1973 |
return this._lastCapturedException; |
| 1974 |
}, |
| 1975 |
|
| 1976 |
/* |
| 1977 |
* Get the last event id |
| 1978 |
* |
| 1979 |
* @return {string} |
| 1980 |
*/ |
| 1981 |
lastEventId: function() { |
| 1982 |
return this._lastEventId; |
| 1983 |
}, |
| 1984 |
|
| 1985 |
/* |
| 1986 |
* Determine if Raven is setup and ready to go. |
| 1987 |
* |
| 1988 |
* @return {boolean} |
| 1989 |
*/ |
| 1990 |
isSetup: function() { |
| 1991 |
if (!this._hasJSON) return false; // needs JSON support |
| 1992 |
if (!this._globalServer) { |
| 1993 |
if (!this.ravenNotConfiguredError) { |
| 1994 |
this.ravenNotConfiguredError = true; |
| 1995 |
this._logDebug('error', 'Error: Raven has not been configured.'); |
| 1996 |
} |
| 1997 |
return false; |
| 1998 |
} |
| 1999 |
return true; |
| 2000 |
}, |
| 2001 |
|
| 2002 |
afterLoad: function() { |
| 2003 |
// TODO: remove window dependence? |
| 2004 |
|
| 2005 |
// Attempt to initialize Raven on load |
| 2006 |
var RavenConfig = _window.RavenConfig; |
| 2007 |
if (RavenConfig) { |
| 2008 |
this.config(RavenConfig.dsn, RavenConfig.config).install(); |
| 2009 |
} |
| 2010 |
}, |
| 2011 |
|
| 2012 |
showReportDialog: function(options) { |
| 2013 |
if ( |
| 2014 |
!_document // doesn't work without a document (React native) |
| 2015 |
) |
| 2016 |
return; |
| 2017 |
|
| 2018 |
options = options || {}; |
| 2019 |
|
| 2020 |
var lastEventId = options.eventId || this.lastEventId(); |
| 2021 |
if (!lastEventId) { |
| 2022 |
throw new RavenConfigError('Missing eventId'); |
| 2023 |
} |
| 2024 |
|
| 2025 |
var dsn = options.dsn || this._dsn; |
| 2026 |
if (!dsn) { |
| 2027 |
throw new RavenConfigError('Missing DSN'); |
| 2028 |
} |
| 2029 |
|
| 2030 |
var encode = encodeURIComponent; |
| 2031 |
var qs = ''; |
| 2032 |
qs += '?eventId=' + encode(lastEventId); |
| 2033 |
qs += '&dsn=' + encode(dsn); |
| 2034 |
|
| 2035 |
var user = options.user || this._globalContext.user; |
| 2036 |
if (user) { |
| 2037 |
if (user.name) qs += '&name=' + encode(user.name); |
| 2038 |
if (user.email) qs += '&email=' + encode(user.email); |
| 2039 |
} |
| 2040 |
|
| 2041 |
var globalServer = this._getGlobalServer(this._parseDSN(dsn)); |
| 2042 |
|
| 2043 |
var script = _document.createElement('script'); |
| 2044 |
script.async = true; |
| 2045 |
script.src = globalServer + '/api/embed/error-page/' + qs; |
| 2046 |
(_document.head || _document.body).appendChild(script); |
| 2047 |
}, |
| 2048 |
|
| 2049 |
/**** Private functions ****/ |
| 2050 |
_ignoreNextOnError: function() { |
| 2051 |
var self = this; |
| 2052 |
this._ignoreOnError += 1; |
| 2053 |
setTimeout(function() { |
| 2054 |
// onerror should trigger before setTimeout |
| 2055 |
self._ignoreOnError -= 1; |
| 2056 |
}); |
| 2057 |
}, |
| 2058 |
|
| 2059 |
_triggerEvent: function(eventType, options) { |
| 2060 |
// NOTE: `event` is a native browser thing, so let's avoid conflicting wiht it |
| 2061 |
var evt, key; |
| 2062 |
|
| 2063 |
if (!this._hasDocument) return; |
| 2064 |
|
| 2065 |
options = options || {}; |
| 2066 |
|
| 2067 |
eventType = 'raven' + eventType.substr(0, 1).toUpperCase() + eventType.substr(1); |
| 2068 |
|
| 2069 |
if (_document.createEvent) { |
| 2070 |
evt = _document.createEvent('HTMLEvents'); |
| 2071 |
evt.initEvent(eventType, true, true); |
| 2072 |
} else { |
| 2073 |
evt = _document.createEventObject(); |
| 2074 |
evt.eventType = eventType; |
| 2075 |
} |
| 2076 |
|
| 2077 |
for (key in options) |
| 2078 |
if (hasKey(options, key)) { |
| 2079 |
evt[key] = options[key]; |
| 2080 |
} |
| 2081 |
|
| 2082 |
if (_document.createEvent) { |
| 2083 |
// IE9 if standards |
| 2084 |
_document.dispatchEvent(evt); |
| 2085 |
} else { |
| 2086 |
// IE8 regardless of Quirks or Standards |
| 2087 |
// IE9 if quirks |
| 2088 |
try { |
| 2089 |
_document.fireEvent('on' + evt.eventType.toLowerCase(), evt); |
| 2090 |
} catch (e) { |
| 2091 |
// Do nothing |
| 2092 |
} |
| 2093 |
} |
| 2094 |
}, |
| 2095 |
|
| 2096 |
/** |
| 2097 |
* Wraps addEventListener to capture UI breadcrumbs |
| 2098 |
* @param evtName the event name (e.g. "click") |
| 2099 |
* @returns {Function} |
| 2100 |
* @private |
| 2101 |
*/ |
| 2102 |
_breadcrumbEventHandler: function(evtName) { |
| 2103 |
var self = this; |
| 2104 |
return function(evt) { |
| 2105 |
// reset keypress timeout; e.g. triggering a 'click' after |
| 2106 |
// a 'keypress' will reset the keypress debounce so that a new |
| 2107 |
// set of keypresses can be recorded |
| 2108 |
self._keypressTimeout = null; |
| 2109 |
|
| 2110 |
// It's possible this handler might trigger multiple times for the same |
| 2111 |
// event (e.g. event propagation through node ancestors). Ignore if we've |
| 2112 |
// already captured the event. |
| 2113 |
if (self._lastCapturedEvent === evt) return; |
| 2114 |
|
| 2115 |
self._lastCapturedEvent = evt; |
| 2116 |
|
| 2117 |
// try/catch both: |
| 2118 |
// - accessing evt.target (see getsentry/raven-js#838, #768) |
| 2119 |
// - `htmlTreeAsString` because it's complex, and just accessing the DOM incorrectly |
| 2120 |
// can throw an exception in some circumstances. |
| 2121 |
var target; |
| 2122 |
try { |
| 2123 |
target = htmlTreeAsString(evt.target); |
| 2124 |
} catch (e) { |
| 2125 |
target = '<unknown>'; |
| 2126 |
} |
| 2127 |
|
| 2128 |
self.captureBreadcrumb({ |
| 2129 |
category: 'ui.' + evtName, // e.g. ui.click, ui.input |
| 2130 |
message: target |
| 2131 |
}); |
| 2132 |
}; |
| 2133 |
}, |
| 2134 |
|
| 2135 |
/** |
| 2136 |
* Wraps addEventListener to capture keypress UI events |
| 2137 |
* @returns {Function} |
| 2138 |
* @private |
| 2139 |
*/ |
| 2140 |
_keypressEventHandler: function() { |
| 2141 |
var self = this, |
| 2142 |
debounceDuration = 1000; // milliseconds |
| 2143 |
|
| 2144 |
// TODO: if somehow user switches keypress target before |
| 2145 |
// debounce timeout is triggered, we will only capture |
| 2146 |
// a single breadcrumb from the FIRST target (acceptable?) |
| 2147 |
return function(evt) { |
| 2148 |
var target; |
| 2149 |
try { |
| 2150 |
target = evt.target; |
| 2151 |
} catch (e) { |
| 2152 |
// just accessing event properties can throw an exception in some rare circumstances |
| 2153 |
// see: https://github.com/getsentry/raven-js/issues/838 |
| 2154 |
return; |
| 2155 |
} |
| 2156 |
var tagName = target && target.tagName; |
| 2157 |
|
| 2158 |
// only consider keypress events on actual input elements |
| 2159 |
// this will disregard keypresses targeting body (e.g. tabbing |
| 2160 |
// through elements, hotkeys, etc) |
| 2161 |
if ( |
| 2162 |
!tagName || |
| 2163 |
(tagName !== 'INPUT' && tagName !== 'TEXTAREA' && !target.isContentEditable) |
| 2164 |
) |
| 2165 |
return; |
| 2166 |
|
| 2167 |
// record first keypress in a series, but ignore subsequent |
| 2168 |
// keypresses until debounce clears |
| 2169 |
var timeout = self._keypressTimeout; |
| 2170 |
if (!timeout) { |
| 2171 |
self._breadcrumbEventHandler('input')(evt); |
| 2172 |
} |
| 2173 |
clearTimeout(timeout); |
| 2174 |
self._keypressTimeout = setTimeout(function() { |
| 2175 |
self._keypressTimeout = null; |
| 2176 |
}, debounceDuration); |
| 2177 |
}; |
| 2178 |
}, |
| 2179 |
|
| 2180 |
/** |
| 2181 |
* Captures a breadcrumb of type "navigation", normalizing input URLs |
| 2182 |
* @param to the originating URL |
| 2183 |
* @param from the target URL |
| 2184 |
* @private |
| 2185 |
*/ |
| 2186 |
_captureUrlChange: function(from, to) { |
| 2187 |
var parsedLoc = parseUrl(this._location.href); |
| 2188 |
var parsedTo = parseUrl(to); |
| 2189 |
var parsedFrom = parseUrl(from); |
| 2190 |
|
| 2191 |
// because onpopstate only tells you the "new" (to) value of location.href, and |
| 2192 |
// not the previous (from) value, we need to track the value of the current URL |
| 2193 |
// state ourselves |
| 2194 |
this._lastHref = to; |
| 2195 |
|
| 2196 |
// Use only the path component of the URL if the URL matches the current |
| 2197 |
// document (almost all the time when using pushState) |
| 2198 |
if (parsedLoc.protocol === parsedTo.protocol && parsedLoc.host === parsedTo.host) |
| 2199 |
to = parsedTo.relative; |
| 2200 |
if (parsedLoc.protocol === parsedFrom.protocol && parsedLoc.host === parsedFrom.host) |
| 2201 |
from = parsedFrom.relative; |
| 2202 |
|
| 2203 |
this.captureBreadcrumb({ |
| 2204 |
category: 'navigation', |
| 2205 |
data: { |
| 2206 |
to: to, |
| 2207 |
from: from |
| 2208 |
} |
| 2209 |
}); |
| 2210 |
}, |
| 2211 |
|
| 2212 |
/** |
| 2213 |
* Wrap timer functions and event targets to catch errors and provide |
| 2214 |
* better metadata. |
| 2215 |
*/ |
| 2216 |
_instrumentTryCatch: function() { |
| 2217 |
var self = this; |
| 2218 |
|
| 2219 |
var wrappedBuiltIns = self._wrappedBuiltIns; |
| 2220 |
|
| 2221 |
function wrapTimeFn(orig) { |
| 2222 |
return function(fn, t) { |
| 2223 |
// preserve arity |
| 2224 |
// Make a copy of the arguments to prevent deoptimization |
| 2225 |
// https://github.com/petkaantonov/bluebird/wiki/Optimization-killers#32-leaking-arguments |
| 2226 |
var args = new Array(arguments.length); |
| 2227 |
for (var i = 0; i < args.length; ++i) { |
| 2228 |
args[i] = arguments[i]; |
| 2229 |
} |
| 2230 |
var originalCallback = args[0]; |
| 2231 |
if (isFunction(originalCallback)) { |
| 2232 |
args[0] = self.wrap(originalCallback); |
| 2233 |
} |
| 2234 |
|
| 2235 |
// IE < 9 doesn't support .call/.apply on setInterval/setTimeout, but it |
| 2236 |
// also supports only two arguments and doesn't care what this is, so we |
| 2237 |
// can just call the original function directly. |
| 2238 |
if (orig.apply) { |
| 2239 |
return orig.apply(this, args); |
| 2240 |
} else { |
| 2241 |
return orig(args[0], args[1]); |
| 2242 |
} |
| 2243 |
}; |
| 2244 |
} |
| 2245 |
|
| 2246 |
var autoBreadcrumbs = this._globalOptions.autoBreadcrumbs; |
| 2247 |
|
| 2248 |
function wrapEventTarget(global) { |
| 2249 |
var proto = _window[global] && _window[global].prototype; |
| 2250 |
if (proto && proto.hasOwnProperty && proto.hasOwnProperty('addEventListener')) { |
| 2251 |
fill( |
| 2252 |
proto, |
| 2253 |
'addEventListener', |
| 2254 |
function(orig) { |
| 2255 |
return function(evtName, fn, capture, secure) { |
| 2256 |
// preserve arity |
| 2257 |
try { |
| 2258 |
if (fn && fn.handleEvent) { |
| 2259 |
fn.handleEvent = self.wrap(fn.handleEvent); |
| 2260 |
} |
| 2261 |
} catch (err) { |
| 2262 |
// can sometimes get 'Permission denied to access property "handle Event' |
| 2263 |
} |
| 2264 |
|
| 2265 |
// More breadcrumb DOM capture ... done here and not in `_instrumentBreadcrumbs` |
| 2266 |
// so that we don't have more than one wrapper function |
| 2267 |
var before, clickHandler, keypressHandler; |
| 2268 |
|
| 2269 |
if ( |
| 2270 |
autoBreadcrumbs && |
| 2271 |
autoBreadcrumbs.dom && |
| 2272 |
(global === 'EventTarget' || global === 'Node') |
| 2273 |
) { |
| 2274 |
// NOTE: generating multiple handlers per addEventListener invocation, should |
| 2275 |
// revisit and verify we can just use one (almost certainly) |
| 2276 |
clickHandler = self._breadcrumbEventHandler('click'); |
| 2277 |
keypressHandler = self._keypressEventHandler(); |
| 2278 |
before = function(evt) { |
| 2279 |
// need to intercept every DOM event in `before` argument, in case that |
| 2280 |
// same wrapped method is re-used for different events (e.g. mousemove THEN click) |
| 2281 |
// see #724 |
| 2282 |
if (!evt) return; |
| 2283 |
|
| 2284 |
var eventType; |
| 2285 |
try { |
| 2286 |
eventType = evt.type; |
| 2287 |
} catch (e) { |
| 2288 |
// just accessing event properties can throw an exception in some rare circumstances |
| 2289 |
// see: https://github.com/getsentry/raven-js/issues/838 |
| 2290 |
return; |
| 2291 |
} |
| 2292 |
if (eventType === 'click') return clickHandler(evt); |
| 2293 |
else if (eventType === 'keypress') return keypressHandler(evt); |
| 2294 |
}; |
| 2295 |
} |
| 2296 |
return orig.call( |
| 2297 |
this, |
| 2298 |
evtName, |
| 2299 |
self.wrap(fn, undefined, before), |
| 2300 |
capture, |
| 2301 |
secure |
| 2302 |
); |
| 2303 |
}; |
| 2304 |
}, |
| 2305 |
wrappedBuiltIns |
| 2306 |
); |
| 2307 |
fill( |
| 2308 |
proto, |
| 2309 |
'removeEventListener', |
| 2310 |
function(orig) { |
| 2311 |
return function(evt, fn, capture, secure) { |
| 2312 |
try { |
| 2313 |
fn = fn && (fn.__raven_wrapper__ ? fn.__raven_wrapper__ : fn); |
| 2314 |
} catch (e) { |
| 2315 |
// ignore, accessing __raven_wrapper__ will throw in some Selenium environments |
| 2316 |
} |
| 2317 |
return orig.call(this, evt, fn, capture, secure); |
| 2318 |
}; |
| 2319 |
}, |
| 2320 |
wrappedBuiltIns |
| 2321 |
); |
| 2322 |
} |
| 2323 |
} |
| 2324 |
|
| 2325 |
fill(_window, 'setTimeout', wrapTimeFn, wrappedBuiltIns); |
| 2326 |
fill(_window, 'setInterval', wrapTimeFn, wrappedBuiltIns); |
| 2327 |
if (_window.requestAnimationFrame) { |
| 2328 |
fill( |
| 2329 |
_window, |
| 2330 |
'requestAnimationFrame', |
| 2331 |
function(orig) { |
| 2332 |
return function(cb) { |
| 2333 |
return orig(self.wrap(cb)); |
| 2334 |
}; |
| 2335 |
}, |
| 2336 |
wrappedBuiltIns |
| 2337 |
); |
| 2338 |
} |
| 2339 |
|
| 2340 |
// event targets borrowed from bugsnag-js: |
| 2341 |
// https://github.com/bugsnag/bugsnag-js/blob/master/src/bugsnag.js#L666 |
| 2342 |
var eventTargets = [ |
| 2343 |
'EventTarget', |
| 2344 |
'Window', |
| 2345 |
'Node', |
| 2346 |
'ApplicationCache', |
| 2347 |
'AudioTrackList', |
| 2348 |
'ChannelMergerNode', |
| 2349 |
'CryptoOperation', |
| 2350 |
'EventSource', |
| 2351 |
'FileReader', |
| 2352 |
'HTMLUnknownElement', |
| 2353 |
'IDBDatabase', |
| 2354 |
'IDBRequest', |
| 2355 |
'IDBTransaction', |
| 2356 |
'KeyOperation', |
| 2357 |
'MediaController', |
| 2358 |
'MessagePort', |
| 2359 |
'ModalWindow', |
| 2360 |
'Notification', |
| 2361 |
'SVGElementInstance', |
| 2362 |
'Screen', |
| 2363 |
'TextTrack', |
| 2364 |
'TextTrackCue', |
| 2365 |
'TextTrackList', |
| 2366 |
'WebSocket', |
| 2367 |
'WebSocketWorker', |
| 2368 |
'Worker', |
| 2369 |
'XMLHttpRequest', |
| 2370 |
'XMLHttpRequestEventTarget', |
| 2371 |
'XMLHttpRequestUpload' |
| 2372 |
]; |
| 2373 |
for (var i = 0; i < eventTargets.length; i++) { |
| 2374 |
wrapEventTarget(eventTargets[i]); |
| 2375 |
} |
| 2376 |
}, |
| 2377 |
|
| 2378 |
/** |
| 2379 |
* Instrument browser built-ins w/ breadcrumb capturing |
| 2380 |
* - XMLHttpRequests |
| 2381 |
* - DOM interactions (click/typing) |
| 2382 |
* - window.location changes |
| 2383 |
* - console |
| 2384 |
* |
| 2385 |
* Can be disabled or individually configured via the `autoBreadcrumbs` config option |
| 2386 |
*/ |
| 2387 |
_instrumentBreadcrumbs: function() { |
| 2388 |
var self = this; |
| 2389 |
var autoBreadcrumbs = this._globalOptions.autoBreadcrumbs; |
| 2390 |
|
| 2391 |
var wrappedBuiltIns = self._wrappedBuiltIns; |
| 2392 |
|
| 2393 |
function wrapProp(prop, xhr) { |
| 2394 |
if (prop in xhr && isFunction(xhr[prop])) { |
| 2395 |
fill(xhr, prop, function(orig) { |
| 2396 |
return self.wrap(orig); |
| 2397 |
}); // intentionally don't track filled methods on XHR instances |
| 2398 |
} |
| 2399 |
} |
| 2400 |
|
| 2401 |
if (autoBreadcrumbs.xhr && 'XMLHttpRequest' in _window) { |
| 2402 |
var xhrproto = XMLHttpRequest.prototype; |
| 2403 |
fill( |
| 2404 |
xhrproto, |
| 2405 |
'open', |
| 2406 |
function(origOpen) { |
| 2407 |
return function(method, url) { |
| 2408 |
// preserve arity |
| 2409 |
|
| 2410 |
// if Sentry key appears in URL, don't capture |
| 2411 |
if (isString(url) && url.indexOf(self._globalKey) === -1) { |
| 2412 |
this.__raven_xhr = { |
| 2413 |
method: method, |
| 2414 |
url: url, |
| 2415 |
status_code: null |
| 2416 |
}; |
| 2417 |
} |
| 2418 |
|
| 2419 |
return origOpen.apply(this, arguments); |
| 2420 |
}; |
| 2421 |
}, |
| 2422 |
wrappedBuiltIns |
| 2423 |
); |
| 2424 |
|
| 2425 |
fill( |
| 2426 |
xhrproto, |
| 2427 |
'send', |
| 2428 |
function(origSend) { |
| 2429 |
return function(data) { |
| 2430 |
// preserve arity |
| 2431 |
var xhr = this; |
| 2432 |
|
| 2433 |
function onreadystatechangeHandler() { |
| 2434 |
if (xhr.__raven_xhr && xhr.readyState === 4) { |
| 2435 |
try { |
| 2436 |
// touching statusCode in some platforms throws |
| 2437 |
// an exception |
| 2438 |
xhr.__raven_xhr.status_code = xhr.status; |
| 2439 |
} catch (e) { |
| 2440 |
/* do nothing */ |
| 2441 |
} |
| 2442 |
|
| 2443 |
self.captureBreadcrumb({ |
| 2444 |
type: 'http', |
| 2445 |
category: 'xhr', |
| 2446 |
data: xhr.__raven_xhr |
| 2447 |
}); |
| 2448 |
} |
| 2449 |
} |
| 2450 |
|
| 2451 |
var props = ['onload', 'onerror', 'onprogress']; |
| 2452 |
for (var j = 0; j < props.length; j++) { |
| 2453 |
wrapProp(props[j], xhr); |
| 2454 |
} |
| 2455 |
|
| 2456 |
if ('onreadystatechange' in xhr && isFunction(xhr.onreadystatechange)) { |
| 2457 |
fill( |
| 2458 |
xhr, |
| 2459 |
'onreadystatechange', |
| 2460 |
function(orig) { |
| 2461 |
return self.wrap(orig, undefined, onreadystatechangeHandler); |
| 2462 |
} /* intentionally don't track this instrumentation */ |
| 2463 |
); |
| 2464 |
} else { |
| 2465 |
// if onreadystatechange wasn't actually set by the page on this xhr, we |
| 2466 |
// are free to set our own and capture the breadcrumb |
| 2467 |
xhr.onreadystatechange = onreadystatechangeHandler; |
| 2468 |
} |
| 2469 |
|
| 2470 |
return origSend.apply(this, arguments); |
| 2471 |
}; |
| 2472 |
}, |
| 2473 |
wrappedBuiltIns |
| 2474 |
); |
| 2475 |
} |
| 2476 |
|
| 2477 |
if (autoBreadcrumbs.xhr && 'fetch' in _window) { |
| 2478 |
fill( |
| 2479 |
_window, |
| 2480 |
'fetch', |
| 2481 |
function(origFetch) { |
| 2482 |
return function(fn, t) { |
| 2483 |
// preserve arity |
| 2484 |
// Make a copy of the arguments to prevent deoptimization |
| 2485 |
// https://github.com/petkaantonov/bluebird/wiki/Optimization-killers#32-leaking-arguments |
| 2486 |
var args = new Array(arguments.length); |
| 2487 |
for (var i = 0; i < args.length; ++i) { |
| 2488 |
args[i] = arguments[i]; |
| 2489 |
} |
| 2490 |
|
| 2491 |
var fetchInput = args[0]; |
| 2492 |
var method = 'GET'; |
| 2493 |
var url; |
| 2494 |
|
| 2495 |
if (typeof fetchInput === 'string') { |
| 2496 |
url = fetchInput; |
| 2497 |
} else if ('Request' in _window && fetchInput instanceof _window.Request) { |
| 2498 |
url = fetchInput.url; |
| 2499 |
if (fetchInput.method) { |
| 2500 |
method = fetchInput.method; |
| 2501 |
} |
| 2502 |
} else { |
| 2503 |
url = '' + fetchInput; |
| 2504 |
} |
| 2505 |
|
| 2506 |
if (args[1] && args[1].method) { |
| 2507 |
method = args[1].method; |
| 2508 |
} |
| 2509 |
|
| 2510 |
var fetchData = { |
| 2511 |
method: method, |
| 2512 |
url: url, |
| 2513 |
status_code: null |
| 2514 |
}; |
| 2515 |
|
| 2516 |
self.captureBreadcrumb({ |
| 2517 |
type: 'http', |
| 2518 |
category: 'fetch', |
| 2519 |
data: fetchData |
| 2520 |
}); |
| 2521 |
|
| 2522 |
return origFetch.apply(this, args).then(function(response) { |
| 2523 |
fetchData.status_code = response.status; |
| 2524 |
|
| 2525 |
return response; |
| 2526 |
}); |
| 2527 |
}; |
| 2528 |
}, |
| 2529 |
wrappedBuiltIns |
| 2530 |
); |
| 2531 |
} |
| 2532 |
|
| 2533 |
// Capture breadcrumbs from any click that is unhandled / bubbled up all the way |
| 2534 |
// to the document. Do this before we instrument addEventListener. |
| 2535 |
if (autoBreadcrumbs.dom && this._hasDocument) { |
| 2536 |
if (_document.addEventListener) { |
| 2537 |
_document.addEventListener('click', self._breadcrumbEventHandler('click'), false); |
| 2538 |
_document.addEventListener('keypress', self._keypressEventHandler(), false); |
| 2539 |
} else { |
| 2540 |
// IE8 Compatibility |
| 2541 |
_document.attachEvent('onclick', self._breadcrumbEventHandler('click')); |
| 2542 |
_document.attachEvent('onkeypress', self._keypressEventHandler()); |
| 2543 |
} |
| 2544 |
} |
| 2545 |
|
| 2546 |
// record navigation (URL) changes |
| 2547 |
// NOTE: in Chrome App environment, touching history.pushState, *even inside |
| 2548 |
// a try/catch block*, will cause Chrome to output an error to console.error |
| 2549 |
// borrowed from: https://github.com/angular/angular.js/pull/13945/files |
| 2550 |
var chrome = _window.chrome; |
| 2551 |
var isChromePackagedApp = chrome && chrome.app && chrome.app.runtime; |
| 2552 |
var hasPushAndReplaceState = |
| 2553 |
!isChromePackagedApp && |
| 2554 |
_window.history && |
| 2555 |
history.pushState && |
| 2556 |
history.replaceState; |
| 2557 |
if (autoBreadcrumbs.location && hasPushAndReplaceState) { |
| 2558 |
// TODO: remove onpopstate handler on uninstall() |
| 2559 |
var oldOnPopState = _window.onpopstate; |
| 2560 |
_window.onpopstate = function() { |
| 2561 |
var currentHref = self._location.href; |
| 2562 |
self._captureUrlChange(self._lastHref, currentHref); |
| 2563 |
|
| 2564 |
if (oldOnPopState) { |
| 2565 |
return oldOnPopState.apply(this, arguments); |
| 2566 |
} |
| 2567 |
}; |
| 2568 |
|
| 2569 |
var historyReplacementFunction = function(origHistFunction) { |
| 2570 |
// note history.pushState.length is 0; intentionally not declaring |
| 2571 |
// params to preserve 0 arity |
| 2572 |
return function(/* state, title, url */) { |
| 2573 |
var url = arguments.length > 2 ? arguments[2] : undefined; |
| 2574 |
|
| 2575 |
// url argument is optional |
| 2576 |
if (url) { |
| 2577 |
// coerce to string (this is what pushState does) |
| 2578 |
self._captureUrlChange(self._lastHref, url + ''); |
| 2579 |
} |
| 2580 |
|
| 2581 |
return origHistFunction.apply(this, arguments); |
| 2582 |
}; |
| 2583 |
}; |
| 2584 |
|
| 2585 |
fill(history, 'pushState', historyReplacementFunction, wrappedBuiltIns); |
| 2586 |
fill(history, 'replaceState', historyReplacementFunction, wrappedBuiltIns); |
| 2587 |
} |
| 2588 |
|
| 2589 |
if (autoBreadcrumbs.console && 'console' in _window && console.log) { |
| 2590 |
// console |
| 2591 |
var consoleMethodCallback = function(msg, data) { |
| 2592 |
self.captureBreadcrumb({ |
| 2593 |
message: msg, |
| 2594 |
level: data.level, |
| 2595 |
category: 'console' |
| 2596 |
}); |
| 2597 |
}; |
| 2598 |
|
| 2599 |
each(['debug', 'info', 'warn', 'error', 'log'], function(_, level) { |
| 2600 |
wrapConsoleMethod(console, level, consoleMethodCallback); |
| 2601 |
}); |
| 2602 |
} |
| 2603 |
}, |
| 2604 |
|
| 2605 |
_restoreBuiltIns: function() { |
| 2606 |
// restore any wrapped builtins |
| 2607 |
var builtin; |
| 2608 |
while (this._wrappedBuiltIns.length) { |
| 2609 |
builtin = this._wrappedBuiltIns.shift(); |
| 2610 |
|
| 2611 |
var obj = builtin[0], |
| 2612 |
name = builtin[1], |
| 2613 |
orig = builtin[2]; |
| 2614 |
|
| 2615 |
obj[name] = orig; |
| 2616 |
} |
| 2617 |
}, |
| 2618 |
|
| 2619 |
_drainPlugins: function() { |
| 2620 |
var self = this; |
| 2621 |
|
| 2622 |
// FIX ME TODO |
| 2623 |
each(this._plugins, function(_, plugin) { |
| 2624 |
var installer = plugin[0]; |
| 2625 |
var args = plugin[1]; |
| 2626 |
installer.apply(self, [self].concat(args)); |
| 2627 |
}); |
| 2628 |
}, |
| 2629 |
|
| 2630 |
_parseDSN: function(str) { |
| 2631 |
var m = dsnPattern.exec(str), |
| 2632 |
dsn = {}, |
| 2633 |
i = 7; |
| 2634 |
|
| 2635 |
try { |
| 2636 |
while (i--) dsn[dsnKeys[i]] = m[i] || ''; |
| 2637 |
} catch (e) { |
| 2638 |
throw new RavenConfigError('Invalid DSN: ' + str); |
| 2639 |
} |
| 2640 |
|
| 2641 |
if (dsn.pass && !this._globalOptions.allowSecretKey) { |
| 2642 |
throw new RavenConfigError( |
| 2643 |
'Do not specify your secret key in the DSN. See: http://bit.ly/raven-secret-key' |
| 2644 |
); |
| 2645 |
} |
| 2646 |
|
| 2647 |
return dsn; |
| 2648 |
}, |
| 2649 |
|
| 2650 |
_getGlobalServer: function(uri) { |
| 2651 |
// assemble the endpoint from the uri pieces |
| 2652 |
var globalServer = '//' + uri.host + (uri.port ? ':' + uri.port : ''); |
| 2653 |
|
| 2654 |
if (uri.protocol) { |
| 2655 |
globalServer = uri.protocol + ':' + globalServer; |
| 2656 |
} |
| 2657 |
return globalServer; |
| 2658 |
}, |
| 2659 |
|
| 2660 |
_handleOnErrorStackInfo: function() { |
| 2661 |
// if we are intentionally ignoring errors via onerror, bail out |
| 2662 |
if (!this._ignoreOnError) { |
| 2663 |
this._handleStackInfo.apply(this, arguments); |
| 2664 |
} |
| 2665 |
}, |
| 2666 |
|
| 2667 |
_handleStackInfo: function(stackInfo, options) { |
| 2668 |
var frames = this._prepareFrames(stackInfo, options); |
| 2669 |
|
| 2670 |
this._triggerEvent('handle', { |
| 2671 |
stackInfo: stackInfo, |
| 2672 |
options: options |
| 2673 |
}); |
| 2674 |
|
| 2675 |
this._processException( |
| 2676 |
stackInfo.name, |
| 2677 |
stackInfo.message, |
| 2678 |
stackInfo.url, |
| 2679 |
stackInfo.lineno, |
| 2680 |
frames, |
| 2681 |
options |
| 2682 |
); |
| 2683 |
}, |
| 2684 |
|
| 2685 |
_prepareFrames: function(stackInfo, options) { |
| 2686 |
var self = this; |
| 2687 |
var frames = []; |
| 2688 |
if (stackInfo.stack && stackInfo.stack.length) { |
| 2689 |
each(stackInfo.stack, function(i, stack) { |
| 2690 |
var frame = self._normalizeFrame(stack, stackInfo.url); |
| 2691 |
if (frame) { |
| 2692 |
frames.push(frame); |
| 2693 |
} |
| 2694 |
}); |
| 2695 |
|
| 2696 |
// e.g. frames captured via captureMessage throw |
| 2697 |
if (options && options.trimHeadFrames) { |
| 2698 |
for (var j = 0; j < options.trimHeadFrames && j < frames.length; j++) { |
| 2699 |
frames[j].in_app = false; |
| 2700 |
} |
| 2701 |
} |
| 2702 |
} |
| 2703 |
frames = frames.slice(0, this._globalOptions.stackTraceLimit); |
| 2704 |
return frames; |
| 2705 |
}, |
| 2706 |
|
| 2707 |
_normalizeFrame: function(frame, stackInfoUrl) { |
| 2708 |
// normalize the frames data |
| 2709 |
var normalized = { |
| 2710 |
filename: frame.url, |
| 2711 |
lineno: frame.line, |
| 2712 |
colno: frame.column, |
| 2713 |
function: frame.func || '?' |
| 2714 |
}; |
| 2715 |
|
| 2716 |
// Case when we don't have any information about the error |
| 2717 |
// E.g. throwing a string or raw object, instead of an `Error` in Firefox |
| 2718 |
// Generating synthetic error doesn't add any value here |
| 2719 |
// |
| 2720 |
// We should probably somehow let a user know that they should fix their code |
| 2721 |
if (!frame.url) { |
| 2722 |
normalized.filename = stackInfoUrl; // fallback to whole stacks url from onerror handler |
| 2723 |
} |
| 2724 |
|
| 2725 |
normalized.in_app = !// determine if an exception came from outside of our app |
| 2726 |
// first we check the global includePaths list. |
| 2727 |
( |
| 2728 |
(!!this._globalOptions.includePaths.test && |
| 2729 |
!this._globalOptions.includePaths.test(normalized.filename)) || |
| 2730 |
// Now we check for fun, if the function name is Raven or TraceKit |
| 2731 |
/(Raven|TraceKit)\./.test(normalized['function']) || |
| 2732 |
// finally, we do a last ditch effort and check for raven.min.js |
| 2733 |
/raven\.(min\.)?js$/.test(normalized.filename) |
| 2734 |
); |
| 2735 |
|
| 2736 |
return normalized; |
| 2737 |
}, |
| 2738 |
|
| 2739 |
_processException: function(type, message, fileurl, lineno, frames, options) { |
| 2740 |
var prefixedMessage = (type ? type + ': ' : '') + (message || ''); |
| 2741 |
if ( |
| 2742 |
!!this._globalOptions.ignoreErrors.test && |
| 2743 |
(this._globalOptions.ignoreErrors.test(message) || |
| 2744 |
this._globalOptions.ignoreErrors.test(prefixedMessage)) |
| 2745 |
) { |
| 2746 |
return; |
| 2747 |
} |
| 2748 |
|
| 2749 |
var stacktrace; |
| 2750 |
|
| 2751 |
if (frames && frames.length) { |
| 2752 |
fileurl = frames[0].filename || fileurl; |
| 2753 |
// Sentry expects frames oldest to newest |
| 2754 |
// and JS sends them as newest to oldest |
| 2755 |
frames.reverse(); |
| 2756 |
stacktrace = {frames: frames}; |
| 2757 |
} else if (fileurl) { |
| 2758 |
stacktrace = { |
| 2759 |
frames: [ |
| 2760 |
{ |
| 2761 |
filename: fileurl, |
| 2762 |
lineno: lineno, |
| 2763 |
in_app: true |
| 2764 |
} |
| 2765 |
] |
| 2766 |
}; |
| 2767 |
} |
| 2768 |
|
| 2769 |
if ( |
| 2770 |
!!this._globalOptions.ignoreUrls.test && |
| 2771 |
this._globalOptions.ignoreUrls.test(fileurl) |
| 2772 |
) { |
| 2773 |
return; |
| 2774 |
} |
| 2775 |
|
| 2776 |
if ( |
| 2777 |
!!this._globalOptions.whitelistUrls.test && |
| 2778 |
!this._globalOptions.whitelistUrls.test(fileurl) |
| 2779 |
) { |
| 2780 |
return; |
| 2781 |
} |
| 2782 |
|
| 2783 |
var data = objectMerge( |
| 2784 |
{ |
| 2785 |
// sentry.interfaces.Exception |
| 2786 |
exception: { |
| 2787 |
values: [ |
| 2788 |
{ |
| 2789 |
type: type, |
| 2790 |
value: message, |
| 2791 |
stacktrace: stacktrace |
| 2792 |
} |
| 2793 |
] |
| 2794 |
}, |
| 2795 |
culprit: fileurl |
| 2796 |
}, |
| 2797 |
options |
| 2798 |
); |
| 2799 |
|
| 2800 |
// Fire away! |
| 2801 |
this._send(data); |
| 2802 |
}, |
| 2803 |
|
| 2804 |
_trimPacket: function(data) { |
| 2805 |
// For now, we only want to truncate the two different messages |
| 2806 |
// but this could/should be expanded to just trim everything |
| 2807 |
var max = this._globalOptions.maxMessageLength; |
| 2808 |
if (data.message) { |
| 2809 |
data.message = truncate(data.message, max); |
| 2810 |
} |
| 2811 |
if (data.exception) { |
| 2812 |
var exception = data.exception.values[0]; |
| 2813 |
exception.value = truncate(exception.value, max); |
| 2814 |
} |
| 2815 |
|
| 2816 |
var request = data.request; |
| 2817 |
if (request) { |
| 2818 |
if (request.url) { |
| 2819 |
request.url = truncate(request.url, this._globalOptions.maxUrlLength); |
| 2820 |
} |
| 2821 |
if (request.Referer) { |
| 2822 |
request.Referer = truncate(request.Referer, this._globalOptions.maxUrlLength); |
| 2823 |
} |
| 2824 |
} |
| 2825 |
|
| 2826 |
if (data.breadcrumbs && data.breadcrumbs.values) |
| 2827 |
this._trimBreadcrumbs(data.breadcrumbs); |
| 2828 |
|
| 2829 |
return data; |
| 2830 |
}, |
| 2831 |
|
| 2832 |
/** |
| 2833 |
* Truncate breadcrumb values (right now just URLs) |
| 2834 |
*/ |
| 2835 |
_trimBreadcrumbs: function(breadcrumbs) { |
| 2836 |
// known breadcrumb properties with urls |
| 2837 |
// TODO: also consider arbitrary prop values that start with (https?)?:// |
| 2838 |
var urlProps = ['to', 'from', 'url'], |
| 2839 |
urlProp, |
| 2840 |
crumb, |
| 2841 |
data; |
| 2842 |
|
| 2843 |
for (var i = 0; i < breadcrumbs.values.length; ++i) { |
| 2844 |
crumb = breadcrumbs.values[i]; |
| 2845 |
if ( |
| 2846 |
!crumb.hasOwnProperty('data') || |
| 2847 |
!isObject(crumb.data) || |
| 2848 |
objectFrozen(crumb.data) |
| 2849 |
) |
| 2850 |
continue; |
| 2851 |
|
| 2852 |
data = objectMerge({}, crumb.data); |
| 2853 |
for (var j = 0; j < urlProps.length; ++j) { |
| 2854 |
urlProp = urlProps[j]; |
| 2855 |
if (data.hasOwnProperty(urlProp) && data[urlProp]) { |
| 2856 |
data[urlProp] = truncate(data[urlProp], this._globalOptions.maxUrlLength); |
| 2857 |
} |
| 2858 |
} |
| 2859 |
breadcrumbs.values[i].data = data; |
| 2860 |
} |
| 2861 |
}, |
| 2862 |
|
| 2863 |
_getHttpData: function() { |
| 2864 |
if (!this._hasNavigator && !this._hasDocument) return; |
| 2865 |
var httpData = {}; |
| 2866 |
|
| 2867 |
if (this._hasNavigator && _navigator.userAgent) { |
| 2868 |
httpData.headers = { |
| 2869 |
'User-Agent': navigator.userAgent |
| 2870 |
}; |
| 2871 |
} |
| 2872 |
|
| 2873 |
if (this._hasDocument) { |
| 2874 |
if (_document.location && _document.location.href) { |
| 2875 |
httpData.url = _document.location.href; |
| 2876 |
} |
| 2877 |
if (_document.referrer) { |
| 2878 |
if (!httpData.headers) httpData.headers = {}; |
| 2879 |
httpData.headers.Referer = _document.referrer; |
| 2880 |
} |
| 2881 |
} |
| 2882 |
|
| 2883 |
return httpData; |
| 2884 |
}, |
| 2885 |
|
| 2886 |
_resetBackoff: function() { |
| 2887 |
this._backoffDuration = 0; |
| 2888 |
this._backoffStart = null; |
| 2889 |
}, |
| 2890 |
|
| 2891 |
_shouldBackoff: function() { |
| 2892 |
return this._backoffDuration && now() - this._backoffStart < this._backoffDuration; |
| 2893 |
}, |
| 2894 |
|
| 2895 |
/** |
| 2896 |
* Returns true if the in-process data payload matches the signature |
| 2897 |
* of the previously-sent data |
| 2898 |
* |
| 2899 |
* NOTE: This has to be done at this level because TraceKit can generate |
| 2900 |
* data from window.onerror WITHOUT an exception object (IE8, IE9, |
| 2901 |
* other old browsers). This can take the form of an "exception" |
| 2902 |
* data object with a single frame (derived from the onerror args). |
| 2903 |
*/ |
| 2904 |
_isRepeatData: function(current) { |
| 2905 |
var last = this._lastData; |
| 2906 |
|
| 2907 |
if ( |
| 2908 |
!last || |
| 2909 |
current.message !== last.message || // defined for captureMessage |
| 2910 |
current.culprit !== last.culprit // defined for captureException/onerror |
| 2911 |
) |
| 2912 |
return false; |
| 2913 |
|
| 2914 |
// Stacktrace interface (i.e. from captureMessage) |
| 2915 |
if (current.stacktrace || last.stacktrace) { |
| 2916 |
return isSameStacktrace(current.stacktrace, last.stacktrace); |
| 2917 |
} else if (current.exception || last.exception) { |
| 2918 |
// Exception interface (i.e. from captureException/onerror) |
| 2919 |
return isSameException(current.exception, last.exception); |
| 2920 |
} |
| 2921 |
|
| 2922 |
return true; |
| 2923 |
}, |
| 2924 |
|
| 2925 |
_setBackoffState: function(request) { |
| 2926 |
// If we are already in a backoff state, don't change anything |
| 2927 |
if (this._shouldBackoff()) { |
| 2928 |
return; |
| 2929 |
} |
| 2930 |
|
| 2931 |
var status = request.status; |
| 2932 |
|
| 2933 |
// 400 - project_id doesn't exist or some other fatal |
| 2934 |
// 401 - invalid/revoked dsn |
| 2935 |
// 429 - too many requests |
| 2936 |
if (!(status === 400 || status === 401 || status === 429)) return; |
| 2937 |
|
| 2938 |
var retry; |
| 2939 |
try { |
| 2940 |
// If Retry-After is not in Access-Control-Expose-Headers, most |
| 2941 |
// browsers will throw an exception trying to access it |
| 2942 |
retry = request.getResponseHeader('Retry-After'); |
| 2943 |
retry = parseInt(retry, 10) * 1000; // Retry-After is returned in seconds |
| 2944 |
} catch (e) { |
| 2945 |
/* eslint no-empty:0 */ |
| 2946 |
} |
| 2947 |
|
| 2948 |
this._backoffDuration = retry |
| 2949 |
? // If Sentry server returned a Retry-After value, use it |
| 2950 |
retry |
| 2951 |
: // Otherwise, double the last backoff duration (starts at 1 sec) |
| 2952 |
this._backoffDuration * 2 || 1000; |
| 2953 |
|
| 2954 |
this._backoffStart = now(); |
| 2955 |
}, |
| 2956 |
|
| 2957 |
_send: function(data) { |
| 2958 |
var globalOptions = this._globalOptions; |
| 2959 |
|
| 2960 |
var baseData = { |
| 2961 |
project: this._globalProject, |
| 2962 |
logger: globalOptions.logger, |
| 2963 |
platform: 'javascript' |
| 2964 |
}, |
| 2965 |
httpData = this._getHttpData(); |
| 2966 |
|
| 2967 |
if (httpData) { |
| 2968 |
baseData.request = httpData; |
| 2969 |
} |
| 2970 |
|
| 2971 |
// HACK: delete `trimHeadFrames` to prevent from appearing in outbound payload |
| 2972 |
if (data.trimHeadFrames) delete data.trimHeadFrames; |
| 2973 |
|
| 2974 |
data = objectMerge(baseData, data); |
| 2975 |
|
| 2976 |
// Merge in the tags and extra separately since objectMerge doesn't handle a deep merge |
| 2977 |
data.tags = objectMerge(objectMerge({}, this._globalContext.tags), data.tags); |
| 2978 |
data.extra = objectMerge(objectMerge({}, this._globalContext.extra), data.extra); |
| 2979 |
|
| 2980 |
// Send along our own collected metadata with extra |
| 2981 |
data.extra['session:duration'] = now() - this._startTime; |
| 2982 |
|
| 2983 |
if (this._breadcrumbs && this._breadcrumbs.length > 0) { |
| 2984 |
// intentionally make shallow copy so that additions |
| 2985 |
// to breadcrumbs aren't accidentally sent in this request |
| 2986 |
data.breadcrumbs = { |
| 2987 |
values: [].slice.call(this._breadcrumbs, 0) |
| 2988 |
}; |
| 2989 |
} |
| 2990 |
|
| 2991 |
// If there are no tags/extra, strip the key from the payload alltogther. |
| 2992 |
if (isEmptyObject(data.tags)) delete data.tags; |
| 2993 |
|
| 2994 |
if (this._globalContext.user) { |
| 2995 |
// sentry.interfaces.User |
| 2996 |
data.user = this._globalContext.user; |
| 2997 |
} |
| 2998 |
|
| 2999 |
// Include the environment if it's defined in globalOptions |
| 3000 |
if (globalOptions.environment) data.environment = globalOptions.environment; |
| 3001 |
|
| 3002 |
// Include the release if it's defined in globalOptions |
| 3003 |
if (globalOptions.release) data.release = globalOptions.release; |
| 3004 |
|
| 3005 |
// Include server_name if it's defined in globalOptions |
| 3006 |
if (globalOptions.serverName) data.server_name = globalOptions.serverName; |
| 3007 |
|
| 3008 |
if (isFunction(globalOptions.dataCallback)) { |
| 3009 |
data = globalOptions.dataCallback(data) || data; |
| 3010 |
} |
| 3011 |
|
| 3012 |
// Why?????????? |
| 3013 |
if (!data || isEmptyObject(data)) { |
| 3014 |
return; |
| 3015 |
} |
| 3016 |
|
| 3017 |
// Check if the request should be filtered or not |
| 3018 |
if ( |
| 3019 |
isFunction(globalOptions.shouldSendCallback) && |
| 3020 |
!globalOptions.shouldSendCallback(data) |
| 3021 |
) { |
| 3022 |
return; |
| 3023 |
} |
| 3024 |
|
| 3025 |
// Backoff state: Sentry server previously responded w/ an error (e.g. 429 - too many requests), |
| 3026 |
// so drop requests until "cool-off" period has elapsed. |
| 3027 |
if (this._shouldBackoff()) { |
| 3028 |
this._logDebug('warn', 'Raven dropped error due to backoff: ', data); |
| 3029 |
return; |
| 3030 |
} |
| 3031 |
|
| 3032 |
if (typeof globalOptions.sampleRate === 'number') { |
| 3033 |
if (Math.random() < globalOptions.sampleRate) { |
| 3034 |
this._sendProcessedPayload(data); |
| 3035 |
} |
| 3036 |
} else { |
| 3037 |
this._sendProcessedPayload(data); |
| 3038 |
} |
| 3039 |
}, |
| 3040 |
|
| 3041 |
_getUuid: function() { |
| 3042 |
return uuid4(); |
| 3043 |
}, |
| 3044 |
|
| 3045 |
_sendProcessedPayload: function(data, callback) { |
| 3046 |
var self = this; |
| 3047 |
var globalOptions = this._globalOptions; |
| 3048 |
|
| 3049 |
if (!this.isSetup()) return; |
| 3050 |
|
| 3051 |
// Try and clean up the packet before sending by truncating long values |
| 3052 |
data = this._trimPacket(data); |
| 3053 |
|
| 3054 |
// ideally duplicate error testing should occur *before* dataCallback/shouldSendCallback, |
| 3055 |
// but this would require copying an un-truncated copy of the data packet, which can be |
| 3056 |
// arbitrarily deep (extra_data) -- could be worthwhile? will revisit |
| 3057 |
if (!this._globalOptions.allowDuplicates && this._isRepeatData(data)) { |
| 3058 |
this._logDebug('warn', 'Raven dropped repeat event: ', data); |
| 3059 |
return; |
| 3060 |
} |
| 3061 |
|
| 3062 |
// Send along an event_id if not explicitly passed. |
| 3063 |
// This event_id can be used to reference the error within Sentry itself. |
| 3064 |
// Set lastEventId after we know the error should actually be sent |
| 3065 |
this._lastEventId = data.event_id || (data.event_id = this._getUuid()); |
| 3066 |
|
| 3067 |
// Store outbound payload after trim |
| 3068 |
this._lastData = data; |
| 3069 |
|
| 3070 |
this._logDebug('debug', 'Raven about to send:', data); |
| 3071 |
|
| 3072 |
var auth = { |
| 3073 |
sentry_version: '7', |
| 3074 |
sentry_client: 'raven-js/' + this.VERSION, |
| 3075 |
sentry_key: this._globalKey |
| 3076 |
}; |
| 3077 |
|
| 3078 |
if (this._globalSecret) { |
| 3079 |
auth.sentry_secret = this._globalSecret; |
| 3080 |
} |
| 3081 |
|
| 3082 |
var exception = data.exception && data.exception.values[0]; |
| 3083 |
this.captureBreadcrumb({ |
| 3084 |
category: 'sentry', |
| 3085 |
message: exception |
| 3086 |
? (exception.type ? exception.type + ': ' : '') + exception.value |
| 3087 |
: data.message, |
| 3088 |
event_id: data.event_id, |
| 3089 |
level: data.level || 'error' // presume error unless specified |
| 3090 |
}); |
| 3091 |
|
| 3092 |
var url = this._globalEndpoint; |
| 3093 |
(globalOptions.transport || this._makeRequest).call(this, { |
| 3094 |
url: url, |
| 3095 |
auth: auth, |
| 3096 |
data: data, |
| 3097 |
options: globalOptions, |
| 3098 |
onSuccess: function success() { |
| 3099 |
self._resetBackoff(); |
| 3100 |
|
| 3101 |
self._triggerEvent('success', { |
| 3102 |
data: data, |
| 3103 |
src: url |
| 3104 |
}); |
| 3105 |
callback && callback(); |
| 3106 |
}, |
| 3107 |
onError: function failure(error) { |
| 3108 |
self._logDebug('error', 'Raven transport failed to send: ', error); |
| 3109 |
|
| 3110 |
if (error.request) { |
| 3111 |
self._setBackoffState(error.request); |
| 3112 |
} |
| 3113 |
|
| 3114 |
self._triggerEvent('failure', { |
| 3115 |
data: data, |
| 3116 |
src: url |
| 3117 |
}); |
| 3118 |
error = error || new Error('Raven send failed (no additional details provided)'); |
| 3119 |
callback && callback(error); |
| 3120 |
} |
| 3121 |
}); |
| 3122 |
}, |
| 3123 |
|
| 3124 |
_makeRequest: function(opts) { |
| 3125 |
var request = _window.XMLHttpRequest && new _window.XMLHttpRequest(); |
| 3126 |
if (!request) return; |
| 3127 |
|
| 3128 |
// if browser doesn't support CORS (e.g. IE7), we are out of luck |
| 3129 |
var hasCORS = 'withCredentials' in request || typeof XDomainRequest !== 'undefined'; |
| 3130 |
|
| 3131 |
if (!hasCORS) return; |
| 3132 |
|
| 3133 |
var url = opts.url; |
| 3134 |
|
| 3135 |
if ('withCredentials' in request) { |
| 3136 |
request.onreadystatechange = function() { |
| 3137 |
if (request.readyState !== 4) { |
| 3138 |
return; |
| 3139 |
} else if (request.status === 200) { |
| 3140 |
opts.onSuccess && opts.onSuccess(); |
| 3141 |
} else if (opts.onError) { |
| 3142 |
var err = new Error('Sentry error code: ' + request.status); |
| 3143 |
err.request = request; |
| 3144 |
opts.onError(err); |
| 3145 |
} |
| 3146 |
}; |
| 3147 |
} else { |
| 3148 |
request = new XDomainRequest(); |
| 3149 |
// xdomainrequest cannot go http -> https (or vice versa), |
| 3150 |
// so always use protocol relative |
| 3151 |
url = url.replace(/^https?:/, ''); |
| 3152 |
|
| 3153 |
// onreadystatechange not supported by XDomainRequest |
| 3154 |
if (opts.onSuccess) { |
| 3155 |
request.onload = opts.onSuccess; |
| 3156 |
} |
| 3157 |
if (opts.onError) { |
| 3158 |
request.onerror = function() { |
| 3159 |
var err = new Error('Sentry error code: XDomainRequest'); |
| 3160 |
err.request = request; |
| 3161 |
opts.onError(err); |
| 3162 |
}; |
| 3163 |
} |
| 3164 |
} |
| 3165 |
|
| 3166 |
// NOTE: auth is intentionally sent as part of query string (NOT as custom |
| 3167 |
// HTTP header) so as to avoid preflight CORS requests |
| 3168 |
request.open('POST', url + '?' + urlencode(opts.auth)); |
| 3169 |
request.send(stringify(opts.data)); |
| 3170 |
}, |
| 3171 |
|
| 3172 |
_logDebug: function(level) { |
| 3173 |
if (this._originalConsoleMethods[level] && this.debug) { |
| 3174 |
// In IE<10 console methods do not have their own 'apply' method |
| 3175 |
Function.prototype.apply.call( |
| 3176 |
this._originalConsoleMethods[level], |
| 3177 |
this._originalConsole, |
| 3178 |
[].slice.call(arguments, 1) |
| 3179 |
); |
| 3180 |
} |
| 3181 |
}, |
| 3182 |
|
| 3183 |
_mergeContext: function(key, context) { |
| 3184 |
if (isUndefined(context)) { |
| 3185 |
delete this._globalContext[key]; |
| 3186 |
} else { |
| 3187 |
this._globalContext[key] = objectMerge(this._globalContext[key] || {}, context); |
| 3188 |
} |
| 3189 |
} |
| 3190 |
}; |
| 3191 |
|
| 3192 |
// Deprecations |
| 3193 |
Raven.prototype.setUser = Raven.prototype.setUserContext; |
| 3194 |
Raven.prototype.setReleaseContext = Raven.prototype.setRelease; |
| 3195 |
|
| 3196 |
module.exports = Raven; |
| 3197 |
|
| 3198 |
|
| 3199 |
/***/ }), |
| 3200 |
|
| 3201 |
/***/ "./node_modules/raven-js/src/singleton.js": |
| 3202 |
/*!************************************************!*\ |
| 3203 |
!*** ./node_modules/raven-js/src/singleton.js ***! |
| 3204 |
\************************************************/ |
| 3205 |
/***/ ((module, __unused_webpack_exports, __webpack_require__) => { |
| 3206 |
|
| 3207 |
/** |
| 3208 |
* Enforces a single instance of the Raven client, and the |
| 3209 |
* main entry point for Raven. If you are a consumer of the |
| 3210 |
* Raven library, you SHOULD load this file (vs raven.js). |
| 3211 |
**/ |
| 3212 |
|
| 3213 |
var RavenConstructor = __webpack_require__(/*! ./raven */ "./node_modules/raven-js/src/raven.js"); |
| 3214 |
|
| 3215 |
// This is to be defensive in environments where window does not exist (see https://github.com/getsentry/raven-js/pull/785) |
| 3216 |
var _window = |
| 3217 |
typeof window !== 'undefined' |
| 3218 |
? window |
| 3219 |
: typeof __webpack_require__.g !== 'undefined' ? __webpack_require__.g : typeof self !== 'undefined' ? self : {}; |
| 3220 |
var _Raven = _window.Raven; |
| 3221 |
|
| 3222 |
var Raven = new RavenConstructor(); |
| 3223 |
|
| 3224 |
/* |
| 3225 |
* Allow multiple versions of Raven to be installed. |
| 3226 |
* Strip Raven from the global context and returns the instance. |
| 3227 |
* |
| 3228 |
* @return {Raven} |
| 3229 |
*/ |
| 3230 |
Raven.noConflict = function() { |
| 3231 |
_window.Raven = _Raven; |
| 3232 |
return Raven; |
| 3233 |
}; |
| 3234 |
|
| 3235 |
Raven.afterLoad(); |
| 3236 |
|
| 3237 |
module.exports = Raven; |
| 3238 |
|
| 3239 |
|
| 3240 |
/***/ }), |
| 3241 |
|
| 3242 |
/***/ "./node_modules/raven-js/src/utils.js": |
| 3243 |
/*!********************************************!*\ |
| 3244 |
!*** ./node_modules/raven-js/src/utils.js ***! |
| 3245 |
\********************************************/ |
| 3246 |
/***/ ((module, __unused_webpack_exports, __webpack_require__) => { |
| 3247 |
|
| 3248 |
var _window = |
| 3249 |
typeof window !== 'undefined' |
| 3250 |
? window |
| 3251 |
: typeof __webpack_require__.g !== 'undefined' ? __webpack_require__.g : typeof self !== 'undefined' ? self : {}; |
| 3252 |
|
| 3253 |
function isObject(what) { |
| 3254 |
return typeof what === 'object' && what !== null; |
| 3255 |
} |
| 3256 |
|
| 3257 |
// Yanked from https://git.io/vS8DV re-used under CC0 |
| 3258 |
// with some tiny modifications |
| 3259 |
function isError(value) { |
| 3260 |
switch ({}.toString.call(value)) { |
| 3261 |
case '[object Error]': |
| 3262 |
return true; |
| 3263 |
case '[object Exception]': |
| 3264 |
return true; |
| 3265 |
case '[object DOMException]': |
| 3266 |
return true; |
| 3267 |
default: |
| 3268 |
return value instanceof Error; |
| 3269 |
} |
| 3270 |
} |
| 3271 |
|
| 3272 |
function isErrorEvent(value) { |
| 3273 |
return supportsErrorEvent() && {}.toString.call(value) === '[object ErrorEvent]'; |
| 3274 |
} |
| 3275 |
|
| 3276 |
function isUndefined(what) { |
| 3277 |
return what === void 0; |
| 3278 |
} |
| 3279 |
|
| 3280 |
function isFunction(what) { |
| 3281 |
return typeof what === 'function'; |
| 3282 |
} |
| 3283 |
|
| 3284 |
function isString(what) { |
| 3285 |
return Object.prototype.toString.call(what) === '[object String]'; |
| 3286 |
} |
| 3287 |
|
| 3288 |
function isEmptyObject(what) { |
| 3289 |
for (var _ in what) return false; // eslint-disable-line guard-for-in, no-unused-vars |
| 3290 |
return true; |
| 3291 |
} |
| 3292 |
|
| 3293 |
function supportsErrorEvent() { |
| 3294 |
try { |
| 3295 |
new ErrorEvent(''); // eslint-disable-line no-new |
| 3296 |
return true; |
| 3297 |
} catch (e) { |
| 3298 |
return false; |
| 3299 |
} |
| 3300 |
} |
| 3301 |
|
| 3302 |
function wrappedCallback(callback) { |
| 3303 |
function dataCallback(data, original) { |
| 3304 |
var normalizedData = callback(data) || data; |
| 3305 |
if (original) { |
| 3306 |
return original(normalizedData) || normalizedData; |
| 3307 |
} |
| 3308 |
return normalizedData; |
| 3309 |
} |
| 3310 |
|
| 3311 |
return dataCallback; |
| 3312 |
} |
| 3313 |
|
| 3314 |
function each(obj, callback) { |
| 3315 |
var i, j; |
| 3316 |
|
| 3317 |
if (isUndefined(obj.length)) { |
| 3318 |
for (i in obj) { |
| 3319 |
if (hasKey(obj, i)) { |
| 3320 |
callback.call(null, i, obj[i]); |
| 3321 |
} |
| 3322 |
} |
| 3323 |
} else { |
| 3324 |
j = obj.length; |
| 3325 |
if (j) { |
| 3326 |
for (i = 0; i < j; i++) { |
| 3327 |
callback.call(null, i, obj[i]); |
| 3328 |
} |
| 3329 |
} |
| 3330 |
} |
| 3331 |
} |
| 3332 |
|
| 3333 |
function objectMerge(obj1, obj2) { |
| 3334 |
if (!obj2) { |
| 3335 |
return obj1; |
| 3336 |
} |
| 3337 |
each(obj2, function(key, value) { |
| 3338 |
obj1[key] = value; |
| 3339 |
}); |
| 3340 |
return obj1; |
| 3341 |
} |
| 3342 |
|
| 3343 |
/** |
| 3344 |
* This function is only used for react-native. |
| 3345 |
* react-native freezes object that have already been sent over the |
| 3346 |
* js bridge. We need this function in order to check if the object is frozen. |
| 3347 |
* So it's ok that objectFrozen returns false if Object.isFrozen is not |
| 3348 |
* supported because it's not relevant for other "platforms". See related issue: |
| 3349 |
* https://github.com/getsentry/react-native-sentry/issues/57 |
| 3350 |
*/ |
| 3351 |
function objectFrozen(obj) { |
| 3352 |
if (!Object.isFrozen) { |
| 3353 |
return false; |
| 3354 |
} |
| 3355 |
return Object.isFrozen(obj); |
| 3356 |
} |
| 3357 |
|
| 3358 |
function truncate(str, max) { |
| 3359 |
return !max || str.length <= max ? str : str.substr(0, max) + '\u2026'; |
| 3360 |
} |
| 3361 |
|
| 3362 |
/** |
| 3363 |
* hasKey, a better form of hasOwnProperty |
| 3364 |
* Example: hasKey(MainHostObject, property) === true/false |
| 3365 |
* |
| 3366 |
* @param {Object} host object to check property |
| 3367 |
* @param {string} key to check |
| 3368 |
*/ |
| 3369 |
function hasKey(object, key) { |
| 3370 |
return Object.prototype.hasOwnProperty.call(object, key); |
| 3371 |
} |
| 3372 |
|
| 3373 |
function joinRegExp(patterns) { |
| 3374 |
// Combine an array of regular expressions and strings into one large regexp |
| 3375 |
// Be mad. |
| 3376 |
var sources = [], |
| 3377 |
i = 0, |
| 3378 |
len = patterns.length, |
| 3379 |
pattern; |
| 3380 |
|
| 3381 |
for (; i < len; i++) { |
| 3382 |
pattern = patterns[i]; |
| 3383 |
if (isString(pattern)) { |
| 3384 |
// If it's a string, we need to escape it |
| 3385 |
// Taken from: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions |
| 3386 |
sources.push(pattern.replace(/([.*+?^=!:${}()|\[\]\/\\])/g, '\\$1')); |
| 3387 |
} else if (pattern && pattern.source) { |
| 3388 |
// If it's a regexp already, we want to extract the source |
| 3389 |
sources.push(pattern.source); |
| 3390 |
} |
| 3391 |
// Intentionally skip other cases |
| 3392 |
} |
| 3393 |
return new RegExp(sources.join('|'), 'i'); |
| 3394 |
} |
| 3395 |
|
| 3396 |
function urlencode(o) { |
| 3397 |
var pairs = []; |
| 3398 |
each(o, function(key, value) { |
| 3399 |
pairs.push(encodeURIComponent(key) + '=' + encodeURIComponent(value)); |
| 3400 |
}); |
| 3401 |
return pairs.join('&'); |
| 3402 |
} |
| 3403 |
|
| 3404 |
// borrowed from https://tools.ietf.org/html/rfc3986#appendix-B |
| 3405 |
// intentionally using regex and not <a/> href parsing trick because React Native and other |
| 3406 |
// environments where DOM might not be available |
| 3407 |
function parseUrl(url) { |
| 3408 |
var match = url.match(/^(([^:\/?#]+):)?(\/\/([^\/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?$/); |
| 3409 |
if (!match) return {}; |
| 3410 |
|
| 3411 |
// coerce to undefined values to empty string so we don't get 'undefined' |
| 3412 |
var query = match[6] || ''; |
| 3413 |
var fragment = match[8] || ''; |
| 3414 |
return { |
| 3415 |
protocol: match[2], |
| 3416 |
host: match[4], |
| 3417 |
path: match[5], |
| 3418 |
relative: match[5] + query + fragment // everything minus origin |
| 3419 |
}; |
| 3420 |
} |
| 3421 |
function uuid4() { |
| 3422 |
var crypto = _window.crypto || _window.msCrypto; |
| 3423 |
|
| 3424 |
if (!isUndefined(crypto) && crypto.getRandomValues) { |
| 3425 |
// Use window.crypto API if available |
| 3426 |
// eslint-disable-next-line no-undef |
| 3427 |
var arr = new Uint16Array(8); |
| 3428 |
crypto.getRandomValues(arr); |
| 3429 |
|
| 3430 |
// set 4 in byte 7 |
| 3431 |
arr[3] = (arr[3] & 0xfff) | 0x4000; |
| 3432 |
// set 2 most significant bits of byte 9 to '10' |
| 3433 |
arr[4] = (arr[4] & 0x3fff) | 0x8000; |
| 3434 |
|
| 3435 |
var pad = function(num) { |
| 3436 |
var v = num.toString(16); |
| 3437 |
while (v.length < 4) { |
| 3438 |
v = '0' + v; |
| 3439 |
} |
| 3440 |
return v; |
| 3441 |
}; |
| 3442 |
|
| 3443 |
return ( |
| 3444 |
pad(arr[0]) + |
| 3445 |
pad(arr[1]) + |
| 3446 |
pad(arr[2]) + |
| 3447 |
pad(arr[3]) + |
| 3448 |
pad(arr[4]) + |
| 3449 |
pad(arr[5]) + |
| 3450 |
pad(arr[6]) + |
| 3451 |
pad(arr[7]) |
| 3452 |
); |
| 3453 |
} else { |
| 3454 |
// http://stackoverflow.com/questions/105034/how-to-create-a-guid-uuid-in-javascript/2117523#2117523 |
| 3455 |
return 'xxxxxxxxxxxx4xxxyxxxxxxxxxxxxxxx'.replace(/[xy]/g, function(c) { |
| 3456 |
var r = (Math.random() * 16) | 0, |
| 3457 |
v = c === 'x' ? r : (r & 0x3) | 0x8; |
| 3458 |
return v.toString(16); |
| 3459 |
}); |
| 3460 |
} |
| 3461 |
} |
| 3462 |
|
| 3463 |
/** |
| 3464 |
* Given a child DOM element, returns a query-selector statement describing that |
| 3465 |
* and its ancestors |
| 3466 |
* e.g. [HTMLElement] => body > div > input#foo.btn[name=baz] |
| 3467 |
* @param elem |
| 3468 |
* @returns {string} |
| 3469 |
*/ |
| 3470 |
function htmlTreeAsString(elem) { |
| 3471 |
/* eslint no-extra-parens:0*/ |
| 3472 |
var MAX_TRAVERSE_HEIGHT = 5, |
| 3473 |
MAX_OUTPUT_LEN = 80, |
| 3474 |
out = [], |
| 3475 |
height = 0, |
| 3476 |
len = 0, |
| 3477 |
separator = ' > ', |
| 3478 |
sepLength = separator.length, |
| 3479 |
nextStr; |
| 3480 |
|
| 3481 |
while (elem && height++ < MAX_TRAVERSE_HEIGHT) { |
| 3482 |
nextStr = htmlElementAsString(elem); |
| 3483 |
// bail out if |
| 3484 |
// - nextStr is the 'html' element |
| 3485 |
// - the length of the string that would be created exceeds MAX_OUTPUT_LEN |
| 3486 |
// (ignore this limit if we are on the first iteration) |
| 3487 |
if ( |
| 3488 |
nextStr === 'html' || |
| 3489 |
(height > 1 && len + out.length * sepLength + nextStr.length >= MAX_OUTPUT_LEN) |
| 3490 |
) { |
| 3491 |
break; |
| 3492 |
} |
| 3493 |
|
| 3494 |
out.push(nextStr); |
| 3495 |
|
| 3496 |
len += nextStr.length; |
| 3497 |
elem = elem.parentNode; |
| 3498 |
} |
| 3499 |
|
| 3500 |
return out.reverse().join(separator); |
| 3501 |
} |
| 3502 |
|
| 3503 |
/** |
| 3504 |
* Returns a simple, query-selector representation of a DOM element |
| 3505 |
* e.g. [HTMLElement] => input#foo.btn[name=baz] |
| 3506 |
* @param HTMLElement |
| 3507 |
* @returns {string} |
| 3508 |
*/ |
| 3509 |
function htmlElementAsString(elem) { |
| 3510 |
var out = [], |
| 3511 |
className, |
| 3512 |
classes, |
| 3513 |
key, |
| 3514 |
attr, |
| 3515 |
i; |
| 3516 |
|
| 3517 |
if (!elem || !elem.tagName) { |
| 3518 |
return ''; |
| 3519 |
} |
| 3520 |
|
| 3521 |
out.push(elem.tagName.toLowerCase()); |
| 3522 |
if (elem.id) { |
| 3523 |
out.push('#' + elem.id); |
| 3524 |
} |
| 3525 |
|
| 3526 |
className = elem.className; |
| 3527 |
if (className && isString(className)) { |
| 3528 |
classes = className.split(/\s+/); |
| 3529 |
for (i = 0; i < classes.length; i++) { |
| 3530 |
out.push('.' + classes[i]); |
| 3531 |
} |
| 3532 |
} |
| 3533 |
var attrWhitelist = ['type', 'name', 'title', 'alt']; |
| 3534 |
for (i = 0; i < attrWhitelist.length; i++) { |
| 3535 |
key = attrWhitelist[i]; |
| 3536 |
attr = elem.getAttribute(key); |
| 3537 |
if (attr) { |
| 3538 |
out.push('[' + key + '="' + attr + '"]'); |
| 3539 |
} |
| 3540 |
} |
| 3541 |
return out.join(''); |
| 3542 |
} |
| 3543 |
|
| 3544 |
/** |
| 3545 |
* Returns true if either a OR b is truthy, but not both |
| 3546 |
*/ |
| 3547 |
function isOnlyOneTruthy(a, b) { |
| 3548 |
return !!(!!a ^ !!b); |
| 3549 |
} |
| 3550 |
|
| 3551 |
/** |
| 3552 |
* Returns true if the two input exception interfaces have the same content |
| 3553 |
*/ |
| 3554 |
function isSameException(ex1, ex2) { |
| 3555 |
if (isOnlyOneTruthy(ex1, ex2)) return false; |
| 3556 |
|
| 3557 |
ex1 = ex1.values[0]; |
| 3558 |
ex2 = ex2.values[0]; |
| 3559 |
|
| 3560 |
if (ex1.type !== ex2.type || ex1.value !== ex2.value) return false; |
| 3561 |
|
| 3562 |
return isSameStacktrace(ex1.stacktrace, ex2.stacktrace); |
| 3563 |
} |
| 3564 |
|
| 3565 |
/** |
| 3566 |
* Returns true if the two input stack trace interfaces have the same content |
| 3567 |
*/ |
| 3568 |
function isSameStacktrace(stack1, stack2) { |
| 3569 |
if (isOnlyOneTruthy(stack1, stack2)) return false; |
| 3570 |
|
| 3571 |
var frames1 = stack1.frames; |
| 3572 |
var frames2 = stack2.frames; |
| 3573 |
|
| 3574 |
// Exit early if frame count differs |
| 3575 |
if (frames1.length !== frames2.length) return false; |
| 3576 |
|
| 3577 |
// Iterate through every frame; bail out if anything differs |
| 3578 |
var a, b; |
| 3579 |
for (var i = 0; i < frames1.length; i++) { |
| 3580 |
a = frames1[i]; |
| 3581 |
b = frames2[i]; |
| 3582 |
if ( |
| 3583 |
a.filename !== b.filename || |
| 3584 |
a.lineno !== b.lineno || |
| 3585 |
a.colno !== b.colno || |
| 3586 |
a['function'] !== b['function'] |
| 3587 |
) |
| 3588 |
return false; |
| 3589 |
} |
| 3590 |
return true; |
| 3591 |
} |
| 3592 |
|
| 3593 |
/** |
| 3594 |
* Polyfill a method |
| 3595 |
* @param obj object e.g. `document` |
| 3596 |
* @param name method name present on object e.g. `addEventListener` |
| 3597 |
* @param replacement replacement function |
| 3598 |
* @param track {optional} record instrumentation to an array |
| 3599 |
*/ |
| 3600 |
function fill(obj, name, replacement, track) { |
| 3601 |
var orig = obj[name]; |
| 3602 |
obj[name] = replacement(orig); |
| 3603 |
if (track) { |
| 3604 |
track.push([obj, name, orig]); |
| 3605 |
} |
| 3606 |
} |
| 3607 |
|
| 3608 |
module.exports = { |
| 3609 |
isObject: isObject, |
| 3610 |
isError: isError, |
| 3611 |
isErrorEvent: isErrorEvent, |
| 3612 |
isUndefined: isUndefined, |
| 3613 |
isFunction: isFunction, |
| 3614 |
isString: isString, |
| 3615 |
isEmptyObject: isEmptyObject, |
| 3616 |
supportsErrorEvent: supportsErrorEvent, |
| 3617 |
wrappedCallback: wrappedCallback, |
| 3618 |
each: each, |
| 3619 |
objectMerge: objectMerge, |
| 3620 |
truncate: truncate, |
| 3621 |
objectFrozen: objectFrozen, |
| 3622 |
hasKey: hasKey, |
| 3623 |
joinRegExp: joinRegExp, |
| 3624 |
urlencode: urlencode, |
| 3625 |
uuid4: uuid4, |
| 3626 |
htmlTreeAsString: htmlTreeAsString, |
| 3627 |
htmlElementAsString: htmlElementAsString, |
| 3628 |
isSameException: isSameException, |
| 3629 |
isSameStacktrace: isSameStacktrace, |
| 3630 |
parseUrl: parseUrl, |
| 3631 |
fill: fill |
| 3632 |
}; |
| 3633 |
|
| 3634 |
|
| 3635 |
/***/ }), |
| 3636 |
|
| 3637 |
/***/ "./node_modules/raven-js/vendor/TraceKit/tracekit.js": |
| 3638 |
/*!***********************************************************!*\ |
| 3639 |
!*** ./node_modules/raven-js/vendor/TraceKit/tracekit.js ***! |
| 3640 |
\***********************************************************/ |
| 3641 |
/***/ ((module, __unused_webpack_exports, __webpack_require__) => { |
| 3642 |
|
| 3643 |
var utils = __webpack_require__(/*! ../../src/utils */ "./node_modules/raven-js/src/utils.js"); |
| 3644 |
|
| 3645 |
/* |
| 3646 |
TraceKit - Cross brower stack traces |
| 3647 |
|
| 3648 |
This was originally forked from github.com/occ/TraceKit, but has since been |
| 3649 |
largely re-written and is now maintained as part of raven-js. Tests for |
| 3650 |
this are in test/vendor. |
| 3651 |
|
| 3652 |
MIT license |
| 3653 |
*/ |
| 3654 |
|
| 3655 |
var TraceKit = { |
| 3656 |
collectWindowErrors: true, |
| 3657 |
debug: false |
| 3658 |
}; |
| 3659 |
|
| 3660 |
// This is to be defensive in environments where window does not exist (see https://github.com/getsentry/raven-js/pull/785) |
| 3661 |
var _window = |
| 3662 |
typeof window !== 'undefined' |
| 3663 |
? window |
| 3664 |
: typeof __webpack_require__.g !== 'undefined' ? __webpack_require__.g : typeof self !== 'undefined' ? self : {}; |
| 3665 |
|
| 3666 |
// global reference to slice |
| 3667 |
var _slice = [].slice; |
| 3668 |
var UNKNOWN_FUNCTION = '?'; |
| 3669 |
|
| 3670 |
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error#Error_types |
| 3671 |
var ERROR_TYPES_RE = /^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/; |
| 3672 |
|
| 3673 |
function getLocationHref() { |
| 3674 |
if (typeof document === 'undefined' || document.location == null) return ''; |
| 3675 |
|
| 3676 |
return document.location.href; |
| 3677 |
} |
| 3678 |
|
| 3679 |
/** |
| 3680 |
* TraceKit.report: cross-browser processing of unhandled exceptions |
| 3681 |
* |
| 3682 |
* Syntax: |
| 3683 |
* TraceKit.report.subscribe(function(stackInfo) { ... }) |
| 3684 |
* TraceKit.report.unsubscribe(function(stackInfo) { ... }) |
| 3685 |
* TraceKit.report(exception) |
| 3686 |
* try { ...code... } catch(ex) { TraceKit.report(ex); } |
| 3687 |
* |
| 3688 |
* Supports: |
| 3689 |
* - Firefox: full stack trace with line numbers, plus column number |
| 3690 |
* on top frame; column number is not guaranteed |
| 3691 |
* - Opera: full stack trace with line and column numbers |
| 3692 |
* - Chrome: full stack trace with line and column numbers |
| 3693 |
* - Safari: line and column number for the top frame only; some frames |
| 3694 |
* may be missing, and column number is not guaranteed |
| 3695 |
* - IE: line and column number for the top frame only; some frames |
| 3696 |
* may be missing, and column number is not guaranteed |
| 3697 |
* |
| 3698 |
* In theory, TraceKit should work on all of the following versions: |
| 3699 |
* - IE5.5+ (only 8.0 tested) |
| 3700 |
* - Firefox 0.9+ (only 3.5+ tested) |
| 3701 |
* - Opera 7+ (only 10.50 tested; versions 9 and earlier may require |
| 3702 |
* Exceptions Have Stacktrace to be enabled in opera:config) |
| 3703 |
* - Safari 3+ (only 4+ tested) |
| 3704 |
* - Chrome 1+ (only 5+ tested) |
| 3705 |
* - Konqueror 3.5+ (untested) |
| 3706 |
* |
| 3707 |
* Requires TraceKit.computeStackTrace. |
| 3708 |
* |
| 3709 |
* Tries to catch all unhandled exceptions and report them to the |
| 3710 |
* subscribed handlers. Please note that TraceKit.report will rethrow the |
| 3711 |
* exception. This is REQUIRED in order to get a useful stack trace in IE. |
| 3712 |
* If the exception does not reach the top of the browser, you will only |
| 3713 |
* get a stack trace from the point where TraceKit.report was called. |
| 3714 |
* |
| 3715 |
* Handlers receive a stackInfo object as described in the |
| 3716 |
* TraceKit.computeStackTrace docs. |
| 3717 |
*/ |
| 3718 |
TraceKit.report = (function reportModuleWrapper() { |
| 3719 |
var handlers = [], |
| 3720 |
lastArgs = null, |
| 3721 |
lastException = null, |
| 3722 |
lastExceptionStack = null; |
| 3723 |
|
| 3724 |
/** |
| 3725 |
* Add a crash handler. |
| 3726 |
* @param {Function} handler |
| 3727 |
*/ |
| 3728 |
function subscribe(handler) { |
| 3729 |
installGlobalHandler(); |
| 3730 |
handlers.push(handler); |
| 3731 |
} |
| 3732 |
|
| 3733 |
/** |
| 3734 |
* Remove a crash handler. |
| 3735 |
* @param {Function} handler |
| 3736 |
*/ |
| 3737 |
function unsubscribe(handler) { |
| 3738 |
for (var i = handlers.length - 1; i >= 0; --i) { |
| 3739 |
if (handlers[i] === handler) { |
| 3740 |
handlers.splice(i, 1); |
| 3741 |
} |
| 3742 |
} |
| 3743 |
} |
| 3744 |
|
| 3745 |
/** |
| 3746 |
* Remove all crash handlers. |
| 3747 |
*/ |
| 3748 |
function unsubscribeAll() { |
| 3749 |
uninstallGlobalHandler(); |
| 3750 |
handlers = []; |
| 3751 |
} |
| 3752 |
|
| 3753 |
/** |
| 3754 |
* Dispatch stack information to all handlers. |
| 3755 |
* @param {Object.<string, *>} stack |
| 3756 |
*/ |
| 3757 |
function notifyHandlers(stack, isWindowError) { |
| 3758 |
var exception = null; |
| 3759 |
if (isWindowError && !TraceKit.collectWindowErrors) { |
| 3760 |
return; |
| 3761 |
} |
| 3762 |
for (var i in handlers) { |
| 3763 |
if (handlers.hasOwnProperty(i)) { |
| 3764 |
try { |
| 3765 |
handlers[i].apply(null, [stack].concat(_slice.call(arguments, 2))); |
| 3766 |
} catch (inner) { |
| 3767 |
exception = inner; |
| 3768 |
} |
| 3769 |
} |
| 3770 |
} |
| 3771 |
|
| 3772 |
if (exception) { |
| 3773 |
throw exception; |
| 3774 |
} |
| 3775 |
} |
| 3776 |
|
| 3777 |
var _oldOnerrorHandler, _onErrorHandlerInstalled; |
| 3778 |
|
| 3779 |
/** |
| 3780 |
* Ensures all global unhandled exceptions are recorded. |
| 3781 |
* Supported by Gecko and IE. |
| 3782 |
* @param {string} message Error message. |
| 3783 |
* @param {string} url URL of script that generated the exception. |
| 3784 |
* @param {(number|string)} lineNo The line number at which the error |
| 3785 |
* occurred. |
| 3786 |
* @param {?(number|string)} colNo The column number at which the error |
| 3787 |
* occurred. |
| 3788 |
* @param {?Error} ex The actual Error object. |
| 3789 |
*/ |
| 3790 |
function traceKitWindowOnError(message, url, lineNo, colNo, ex) { |
| 3791 |
var stack = null; |
| 3792 |
|
| 3793 |
if (lastExceptionStack) { |
| 3794 |
TraceKit.computeStackTrace.augmentStackTraceWithInitialElement( |
| 3795 |
lastExceptionStack, |
| 3796 |
url, |
| 3797 |
lineNo, |
| 3798 |
message |
| 3799 |
); |
| 3800 |
processLastException(); |
| 3801 |
} else if (ex && utils.isError(ex)) { |
| 3802 |
// non-string `ex` arg; attempt to extract stack trace |
| 3803 |
|
| 3804 |
// New chrome and blink send along a real error object |
| 3805 |
// Let's just report that like a normal error. |
| 3806 |
// See: https://mikewest.org/2013/08/debugging-runtime-errors-with-window-onerror |
| 3807 |
stack = TraceKit.computeStackTrace(ex); |
| 3808 |
notifyHandlers(stack, true); |
| 3809 |
} else { |
| 3810 |
var location = { |
| 3811 |
url: url, |
| 3812 |
line: lineNo, |
| 3813 |
column: colNo |
| 3814 |
}; |
| 3815 |
|
| 3816 |
var name = undefined; |
| 3817 |
var msg = message; // must be new var or will modify original `arguments` |
| 3818 |
var groups; |
| 3819 |
if ({}.toString.call(message) === '[object String]') { |
| 3820 |
var groups = message.match(ERROR_TYPES_RE); |
| 3821 |
if (groups) { |
| 3822 |
name = groups[1]; |
| 3823 |
msg = groups[2]; |
| 3824 |
} |
| 3825 |
} |
| 3826 |
|
| 3827 |
location.func = UNKNOWN_FUNCTION; |
| 3828 |
|
| 3829 |
stack = { |
| 3830 |
name: name, |
| 3831 |
message: msg, |
| 3832 |
url: getLocationHref(), |
| 3833 |
stack: [location] |
| 3834 |
}; |
| 3835 |
notifyHandlers(stack, true); |
| 3836 |
} |
| 3837 |
|
| 3838 |
if (_oldOnerrorHandler) { |
| 3839 |
return _oldOnerrorHandler.apply(this, arguments); |
| 3840 |
} |
| 3841 |
|
| 3842 |
return false; |
| 3843 |
} |
| 3844 |
|
| 3845 |
function installGlobalHandler() { |
| 3846 |
if (_onErrorHandlerInstalled) { |
| 3847 |
return; |
| 3848 |
} |
| 3849 |
_oldOnerrorHandler = _window.onerror; |
| 3850 |
_window.onerror = traceKitWindowOnError; |
| 3851 |
_onErrorHandlerInstalled = true; |
| 3852 |
} |
| 3853 |
|
| 3854 |
function uninstallGlobalHandler() { |
| 3855 |
if (!_onErrorHandlerInstalled) { |
| 3856 |
return; |
| 3857 |
} |
| 3858 |
_window.onerror = _oldOnerrorHandler; |
| 3859 |
_onErrorHandlerInstalled = false; |
| 3860 |
_oldOnerrorHandler = undefined; |
| 3861 |
} |
| 3862 |
|
| 3863 |
function processLastException() { |
| 3864 |
var _lastExceptionStack = lastExceptionStack, |
| 3865 |
_lastArgs = lastArgs; |
| 3866 |
lastArgs = null; |
| 3867 |
lastExceptionStack = null; |
| 3868 |
lastException = null; |
| 3869 |
notifyHandlers.apply(null, [_lastExceptionStack, false].concat(_lastArgs)); |
| 3870 |
} |
| 3871 |
|
| 3872 |
/** |
| 3873 |
* Reports an unhandled Error to TraceKit. |
| 3874 |
* @param {Error} ex |
| 3875 |
* @param {?boolean} rethrow If false, do not re-throw the exception. |
| 3876 |
* Only used for window.onerror to not cause an infinite loop of |
| 3877 |
* rethrowing. |
| 3878 |
*/ |
| 3879 |
function report(ex, rethrow) { |
| 3880 |
var args = _slice.call(arguments, 1); |
| 3881 |
if (lastExceptionStack) { |
| 3882 |
if (lastException === ex) { |
| 3883 |
return; // already caught by an inner catch block, ignore |
| 3884 |
} else { |
| 3885 |
processLastException(); |
| 3886 |
} |
| 3887 |
} |
| 3888 |
|
| 3889 |
var stack = TraceKit.computeStackTrace(ex); |
| 3890 |
lastExceptionStack = stack; |
| 3891 |
lastException = ex; |
| 3892 |
lastArgs = args; |
| 3893 |
|
| 3894 |
// If the stack trace is incomplete, wait for 2 seconds for |
| 3895 |
// slow slow IE to see if onerror occurs or not before reporting |
| 3896 |
// this exception; otherwise, we will end up with an incomplete |
| 3897 |
// stack trace |
| 3898 |
setTimeout(function() { |
| 3899 |
if (lastException === ex) { |
| 3900 |
processLastException(); |
| 3901 |
} |
| 3902 |
}, stack.incomplete ? 2000 : 0); |
| 3903 |
|
| 3904 |
if (rethrow !== false) { |
| 3905 |
throw ex; // re-throw to propagate to the top level (and cause window.onerror) |
| 3906 |
} |
| 3907 |
} |
| 3908 |
|
| 3909 |
report.subscribe = subscribe; |
| 3910 |
report.unsubscribe = unsubscribe; |
| 3911 |
report.uninstall = unsubscribeAll; |
| 3912 |
return report; |
| 3913 |
})(); |
| 3914 |
|
| 3915 |
/** |
| 3916 |
* TraceKit.computeStackTrace: cross-browser stack traces in JavaScript |
| 3917 |
* |
| 3918 |
* Syntax: |
| 3919 |
* s = TraceKit.computeStackTrace(exception) // consider using TraceKit.report instead (see below) |
| 3920 |
* Returns: |
| 3921 |
* s.name - exception name |
| 3922 |
* s.message - exception message |
| 3923 |
* s.stack[i].url - JavaScript or HTML file URL |
| 3924 |
* s.stack[i].func - function name, or empty for anonymous functions (if guessing did not work) |
| 3925 |
* s.stack[i].args - arguments passed to the function, if known |
| 3926 |
* s.stack[i].line - line number, if known |
| 3927 |
* s.stack[i].column - column number, if known |
| 3928 |
* |
| 3929 |
* Supports: |
| 3930 |
* - Firefox: full stack trace with line numbers and unreliable column |
| 3931 |
* number on top frame |
| 3932 |
* - Opera 10: full stack trace with line and column numbers |
| 3933 |
* - Opera 9-: full stack trace with line numbers |
| 3934 |
* - Chrome: full stack trace with line and column numbers |
| 3935 |
* - Safari: line and column number for the topmost stacktrace element |
| 3936 |
* only |
| 3937 |
* - IE: no line numbers whatsoever |
| 3938 |
* |
| 3939 |
* Tries to guess names of anonymous functions by looking for assignments |
| 3940 |
* in the source code. In IE and Safari, we have to guess source file names |
| 3941 |
* by searching for function bodies inside all page scripts. This will not |
| 3942 |
* work for scripts that are loaded cross-domain. |
| 3943 |
* Here be dragons: some function names may be guessed incorrectly, and |
| 3944 |
* duplicate functions may be mismatched. |
| 3945 |
* |
| 3946 |
* TraceKit.computeStackTrace should only be used for tracing purposes. |
| 3947 |
* Logging of unhandled exceptions should be done with TraceKit.report, |
| 3948 |
* which builds on top of TraceKit.computeStackTrace and provides better |
| 3949 |
* IE support by utilizing the window.onerror event to retrieve information |
| 3950 |
* about the top of the stack. |
| 3951 |
* |
| 3952 |
* Note: In IE and Safari, no stack trace is recorded on the Error object, |
| 3953 |
* so computeStackTrace instead walks its *own* chain of callers. |
| 3954 |
* This means that: |
| 3955 |
* * in Safari, some methods may be missing from the stack trace; |
| 3956 |
* * in IE, the topmost function in the stack trace will always be the |
| 3957 |
* caller of computeStackTrace. |
| 3958 |
* |
| 3959 |
* This is okay for tracing (because you are likely to be calling |
| 3960 |
* computeStackTrace from the function you want to be the topmost element |
| 3961 |
* of the stack trace anyway), but not okay for logging unhandled |
| 3962 |
* exceptions (because your catch block will likely be far away from the |
| 3963 |
* inner function that actually caused the exception). |
| 3964 |
* |
| 3965 |
*/ |
| 3966 |
TraceKit.computeStackTrace = (function computeStackTraceWrapper() { |
| 3967 |
// Contents of Exception in various browsers. |
| 3968 |
// |
| 3969 |
// SAFARI: |
| 3970 |
// ex.message = Can't find variable: qq |
| 3971 |
// ex.line = 59 |
| 3972 |
// ex.sourceId = 580238192 |
| 3973 |
// ex.sourceURL = http://... |
| 3974 |
// ex.expressionBeginOffset = 96 |
| 3975 |
// ex.expressionCaretOffset = 98 |
| 3976 |
// ex.expressionEndOffset = 98 |
| 3977 |
// ex.name = ReferenceError |
| 3978 |
// |
| 3979 |
// FIREFOX: |
| 3980 |
// ex.message = qq is not defined |
| 3981 |
// ex.fileName = http://... |
| 3982 |
// ex.lineNumber = 59 |
| 3983 |
// ex.columnNumber = 69 |
| 3984 |
// ex.stack = ...stack trace... (see the example below) |
| 3985 |
// ex.name = ReferenceError |
| 3986 |
// |
| 3987 |
// CHROME: |
| 3988 |
// ex.message = qq is not defined |
| 3989 |
// ex.name = ReferenceError |
| 3990 |
// ex.type = not_defined |
| 3991 |
// ex.arguments = ['aa'] |
| 3992 |
// ex.stack = ...stack trace... |
| 3993 |
// |
| 3994 |
// INTERNET EXPLORER: |
| 3995 |
// ex.message = ... |
| 3996 |
// ex.name = ReferenceError |
| 3997 |
// |
| 3998 |
// OPERA: |
| 3999 |
// ex.message = ...message... (see the example below) |
| 4000 |
// ex.name = ReferenceError |
| 4001 |
// ex.opera#sourceloc = 11 (pretty much useless, duplicates the info in ex.message) |
| 4002 |
// ex.stacktrace = n/a; see 'opera:config#UserPrefs|Exceptions Have Stacktrace' |
| 4003 |
|
| 4004 |
/** |
| 4005 |
* Computes stack trace information from the stack property. |
| 4006 |
* Chrome and Gecko use this property. |
| 4007 |
* @param {Error} ex |
| 4008 |
* @return {?Object.<string, *>} Stack trace information. |
| 4009 |
*/ |
| 4010 |
function computeStackTraceFromStackProp(ex) { |
| 4011 |
if (typeof ex.stack === 'undefined' || !ex.stack) return; |
| 4012 |
|
| 4013 |
var chrome = /^\s*at (.*?) ?\(((?:file|https?|blob|chrome-extension|native|eval|webpack|<anonymous>|[a-z]:|\/).*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i, |
| 4014 |
gecko = /^\s*(.*?)(?:\((.*?)\))?(?:^|@)((?:file|https?|blob|chrome|webpack|resource|\[native).*?|[^@]*bundle)(?::(\d+))?(?::(\d+))?\s*$/i, |
| 4015 |
winjs = /^\s*at (?:((?:\[object object\])?.+) )?\(?((?:file|ms-appx|https?|webpack|blob):.*?):(\d+)(?::(\d+))?\)?\s*$/i, |
| 4016 |
// Used to additionally parse URL/line/column from eval frames |
| 4017 |
geckoEval = /(\S+) line (\d+)(?: > eval line \d+)* > eval/i, |
| 4018 |
chromeEval = /\((\S*)(?::(\d+))(?::(\d+))\)/, |
| 4019 |
lines = ex.stack.split('\n'), |
| 4020 |
stack = [], |
| 4021 |
submatch, |
| 4022 |
parts, |
| 4023 |
element, |
| 4024 |
reference = /^(.*) is undefined$/.exec(ex.message); |
| 4025 |
|
| 4026 |
for (var i = 0, j = lines.length; i < j; ++i) { |
| 4027 |
if ((parts = chrome.exec(lines[i]))) { |
| 4028 |
var isNative = parts[2] && parts[2].indexOf('native') === 0; // start of line |
| 4029 |
var isEval = parts[2] && parts[2].indexOf('eval') === 0; // start of line |
| 4030 |
if (isEval && (submatch = chromeEval.exec(parts[2]))) { |
| 4031 |
// throw out eval line/column and use top-most line/column number |
| 4032 |
parts[2] = submatch[1]; // url |
| 4033 |
parts[3] = submatch[2]; // line |
| 4034 |
parts[4] = submatch[3]; // column |
| 4035 |
} |
| 4036 |
element = { |
| 4037 |
url: !isNative ? parts[2] : null, |
| 4038 |
func: parts[1] || UNKNOWN_FUNCTION, |
| 4039 |
args: isNative ? [parts[2]] : [], |
| 4040 |
line: parts[3] ? +parts[3] : null, |
| 4041 |
column: parts[4] ? +parts[4] : null |
| 4042 |
}; |
| 4043 |
} else if ((parts = winjs.exec(lines[i]))) { |
| 4044 |
element = { |
| 4045 |
url: parts[2], |
| 4046 |
func: parts[1] || UNKNOWN_FUNCTION, |
| 4047 |
args: [], |
| 4048 |
line: +parts[3], |
| 4049 |
column: parts[4] ? +parts[4] : null |
| 4050 |
}; |
| 4051 |
} else if ((parts = gecko.exec(lines[i]))) { |
| 4052 |
var isEval = parts[3] && parts[3].indexOf(' > eval') > -1; |
| 4053 |
if (isEval && (submatch = geckoEval.exec(parts[3]))) { |
| 4054 |
// throw out eval line/column and use top-most line number |
| 4055 |
parts[3] = submatch[1]; |
| 4056 |
parts[4] = submatch[2]; |
| 4057 |
parts[5] = null; // no column when eval |
| 4058 |
} else if (i === 0 && !parts[5] && typeof ex.columnNumber !== 'undefined') { |
| 4059 |
// FireFox uses this awesome columnNumber property for its top frame |
| 4060 |
// Also note, Firefox's column number is 0-based and everything else expects 1-based, |
| 4061 |
// so adding 1 |
| 4062 |
// NOTE: this hack doesn't work if top-most frame is eval |
| 4063 |
stack[0].column = ex.columnNumber + 1; |
| 4064 |
} |
| 4065 |
element = { |
| 4066 |
url: parts[3], |
| 4067 |
func: parts[1] || UNKNOWN_FUNCTION, |
| 4068 |
args: parts[2] ? parts[2].split(',') : [], |
| 4069 |
line: parts[4] ? +parts[4] : null, |
| 4070 |
column: parts[5] ? +parts[5] : null |
| 4071 |
}; |
| 4072 |
} else { |
| 4073 |
continue; |
| 4074 |
} |
| 4075 |
|
| 4076 |
if (!element.func && element.line) { |
| 4077 |
element.func = UNKNOWN_FUNCTION; |
| 4078 |
} |
| 4079 |
|
| 4080 |
stack.push(element); |
| 4081 |
} |
| 4082 |
|
| 4083 |
if (!stack.length) { |
| 4084 |
return null; |
| 4085 |
} |
| 4086 |
|
| 4087 |
return { |
| 4088 |
name: ex.name, |
| 4089 |
message: ex.message, |
| 4090 |
url: getLocationHref(), |
| 4091 |
stack: stack |
| 4092 |
}; |
| 4093 |
} |
| 4094 |
|
| 4095 |
/** |
| 4096 |
* Adds information about the first frame to incomplete stack traces. |
| 4097 |
* Safari and IE require this to get complete data on the first frame. |
| 4098 |
* @param {Object.<string, *>} stackInfo Stack trace information from |
| 4099 |
* one of the compute* methods. |
| 4100 |
* @param {string} url The URL of the script that caused an error. |
| 4101 |
* @param {(number|string)} lineNo The line number of the script that |
| 4102 |
* caused an error. |
| 4103 |
* @param {string=} message The error generated by the browser, which |
| 4104 |
* hopefully contains the name of the object that caused the error. |
| 4105 |
* @return {boolean} Whether or not the stack information was |
| 4106 |
* augmented. |
| 4107 |
*/ |
| 4108 |
function augmentStackTraceWithInitialElement(stackInfo, url, lineNo, message) { |
| 4109 |
var initial = { |
| 4110 |
url: url, |
| 4111 |
line: lineNo |
| 4112 |
}; |
| 4113 |
|
| 4114 |
if (initial.url && initial.line) { |
| 4115 |
stackInfo.incomplete = false; |
| 4116 |
|
| 4117 |
if (!initial.func) { |
| 4118 |
initial.func = UNKNOWN_FUNCTION; |
| 4119 |
} |
| 4120 |
|
| 4121 |
if (stackInfo.stack.length > 0) { |
| 4122 |
if (stackInfo.stack[0].url === initial.url) { |
| 4123 |
if (stackInfo.stack[0].line === initial.line) { |
| 4124 |
return false; // already in stack trace |
| 4125 |
} else if ( |
| 4126 |
!stackInfo.stack[0].line && |
| 4127 |
stackInfo.stack[0].func === initial.func |
| 4128 |
) { |
| 4129 |
stackInfo.stack[0].line = initial.line; |
| 4130 |
return false; |
| 4131 |
} |
| 4132 |
} |
| 4133 |
} |
| 4134 |
|
| 4135 |
stackInfo.stack.unshift(initial); |
| 4136 |
stackInfo.partial = true; |
| 4137 |
return true; |
| 4138 |
} else { |
| 4139 |
stackInfo.incomplete = true; |
| 4140 |
} |
| 4141 |
|
| 4142 |
return false; |
| 4143 |
} |
| 4144 |
|
| 4145 |
/** |
| 4146 |
* Computes stack trace information by walking the arguments.caller |
| 4147 |
* chain at the time the exception occurred. This will cause earlier |
| 4148 |
* frames to be missed but is the only way to get any stack trace in |
| 4149 |
* Safari and IE. The top frame is restored by |
| 4150 |
* {@link augmentStackTraceWithInitialElement}. |
| 4151 |
* @param {Error} ex |
| 4152 |
* @return {?Object.<string, *>} Stack trace information. |
| 4153 |
*/ |
| 4154 |
function computeStackTraceByWalkingCallerChain(ex, depth) { |
| 4155 |
var functionName = /function\s+([_$a-zA-Z\xA0-\uFFFF][_$a-zA-Z0-9\xA0-\uFFFF]*)?\s*\(/i, |
| 4156 |
stack = [], |
| 4157 |
funcs = {}, |
| 4158 |
recursion = false, |
| 4159 |
parts, |
| 4160 |
item, |
| 4161 |
source; |
| 4162 |
|
| 4163 |
for ( |
| 4164 |
var curr = computeStackTraceByWalkingCallerChain.caller; |
| 4165 |
curr && !recursion; |
| 4166 |
curr = curr.caller |
| 4167 |
) { |
| 4168 |
if (curr === computeStackTrace || curr === TraceKit.report) { |
| 4169 |
// console.log('skipping internal function'); |
| 4170 |
continue; |
| 4171 |
} |
| 4172 |
|
| 4173 |
item = { |
| 4174 |
url: null, |
| 4175 |
func: UNKNOWN_FUNCTION, |
| 4176 |
line: null, |
| 4177 |
column: null |
| 4178 |
}; |
| 4179 |
|
| 4180 |
if (curr.name) { |
| 4181 |
item.func = curr.name; |
| 4182 |
} else if ((parts = functionName.exec(curr.toString()))) { |
| 4183 |
item.func = parts[1]; |
| 4184 |
} |
| 4185 |
|
| 4186 |
if (typeof item.func === 'undefined') { |
| 4187 |
try { |
| 4188 |
item.func = parts.input.substring(0, parts.input.indexOf('{')); |
| 4189 |
} catch (e) {} |
| 4190 |
} |
| 4191 |
|
| 4192 |
if (funcs['' + curr]) { |
| 4193 |
recursion = true; |
| 4194 |
} else { |
| 4195 |
funcs['' + curr] = true; |
| 4196 |
} |
| 4197 |
|
| 4198 |
stack.push(item); |
| 4199 |
} |
| 4200 |
|
| 4201 |
if (depth) { |
| 4202 |
// console.log('depth is ' + depth); |
| 4203 |
// console.log('stack is ' + stack.length); |
| 4204 |
stack.splice(0, depth); |
| 4205 |
} |
| 4206 |
|
| 4207 |
var result = { |
| 4208 |
name: ex.name, |
| 4209 |
message: ex.message, |
| 4210 |
url: getLocationHref(), |
| 4211 |
stack: stack |
| 4212 |
}; |
| 4213 |
augmentStackTraceWithInitialElement( |
| 4214 |
result, |
| 4215 |
ex.sourceURL || ex.fileName, |
| 4216 |
ex.line || ex.lineNumber, |
| 4217 |
ex.message || ex.description |
| 4218 |
); |
| 4219 |
return result; |
| 4220 |
} |
| 4221 |
|
| 4222 |
/** |
| 4223 |
* Computes a stack trace for an exception. |
| 4224 |
* @param {Error} ex |
| 4225 |
* @param {(string|number)=} depth |
| 4226 |
*/ |
| 4227 |
function computeStackTrace(ex, depth) { |
| 4228 |
var stack = null; |
| 4229 |
depth = depth == null ? 0 : +depth; |
| 4230 |
|
| 4231 |
try { |
| 4232 |
stack = computeStackTraceFromStackProp(ex); |
| 4233 |
if (stack) { |
| 4234 |
return stack; |
| 4235 |
} |
| 4236 |
} catch (e) { |
| 4237 |
if (TraceKit.debug) { |
| 4238 |
throw e; |
| 4239 |
} |
| 4240 |
} |
| 4241 |
|
| 4242 |
try { |
| 4243 |
stack = computeStackTraceByWalkingCallerChain(ex, depth + 1); |
| 4244 |
if (stack) { |
| 4245 |
return stack; |
| 4246 |
} |
| 4247 |
} catch (e) { |
| 4248 |
if (TraceKit.debug) { |
| 4249 |
throw e; |
| 4250 |
} |
| 4251 |
} |
| 4252 |
return { |
| 4253 |
name: ex.name, |
| 4254 |
message: ex.message, |
| 4255 |
url: getLocationHref() |
| 4256 |
}; |
| 4257 |
} |
| 4258 |
|
| 4259 |
computeStackTrace.augmentStackTraceWithInitialElement = augmentStackTraceWithInitialElement; |
| 4260 |
computeStackTrace.computeStackTraceFromStackProp = computeStackTraceFromStackProp; |
| 4261 |
|
| 4262 |
return computeStackTrace; |
| 4263 |
})(); |
| 4264 |
|
| 4265 |
module.exports = TraceKit; |
| 4266 |
|
| 4267 |
|
| 4268 |
/***/ }), |
| 4269 |
|
| 4270 |
/***/ "./node_modules/raven-js/vendor/json-stringify-safe/stringify.js": |
| 4271 |
/*!***********************************************************************!*\ |
| 4272 |
!*** ./node_modules/raven-js/vendor/json-stringify-safe/stringify.js ***! |
| 4273 |
\***********************************************************************/ |
| 4274 |
/***/ ((module, exports) => { |
| 4275 |
|
| 4276 |
/* |
| 4277 |
json-stringify-safe |
| 4278 |
Like JSON.stringify, but doesn't throw on circular references. |
| 4279 |
|
| 4280 |
Originally forked from https://github.com/isaacs/json-stringify-safe |
| 4281 |
version 5.0.1 on 3/8/2017 and modified to handle Errors serialization |
| 4282 |
and IE8 compatibility. Tests for this are in test/vendor. |
| 4283 |
|
| 4284 |
ISC license: https://github.com/isaacs/json-stringify-safe/blob/master/LICENSE |
| 4285 |
*/ |
| 4286 |
|
| 4287 |
exports = module.exports = stringify; |
| 4288 |
exports.getSerialize = serializer; |
| 4289 |
|
| 4290 |
function indexOf(haystack, needle) { |
| 4291 |
for (var i = 0; i < haystack.length; ++i) { |
| 4292 |
if (haystack[i] === needle) return i; |
| 4293 |
} |
| 4294 |
return -1; |
| 4295 |
} |
| 4296 |
|
| 4297 |
function stringify(obj, replacer, spaces, cycleReplacer) { |
| 4298 |
return JSON.stringify(obj, serializer(replacer, cycleReplacer), spaces); |
| 4299 |
} |
| 4300 |
|
| 4301 |
// https://github.com/ftlabs/js-abbreviate/blob/fa709e5f139e7770a71827b1893f22418097fbda/index.js#L95-L106 |
| 4302 |
function stringifyError(value) { |
| 4303 |
var err = { |
| 4304 |
// These properties are implemented as magical getters and don't show up in for in |
| 4305 |
stack: value.stack, |
| 4306 |
message: value.message, |
| 4307 |
name: value.name |
| 4308 |
}; |
| 4309 |
|
| 4310 |
for (var i in value) { |
| 4311 |
if (Object.prototype.hasOwnProperty.call(value, i)) { |
| 4312 |
err[i] = value[i]; |
| 4313 |
} |
| 4314 |
} |
| 4315 |
|
| 4316 |
return err; |
| 4317 |
} |
| 4318 |
|
| 4319 |
function serializer(replacer, cycleReplacer) { |
| 4320 |
var stack = []; |
| 4321 |
var keys = []; |
| 4322 |
|
| 4323 |
if (cycleReplacer == null) { |
| 4324 |
cycleReplacer = function(key, value) { |
| 4325 |
if (stack[0] === value) { |
| 4326 |
return '[Circular ~]'; |
| 4327 |
} |
| 4328 |
return '[Circular ~.' + keys.slice(0, indexOf(stack, value)).join('.') + ']'; |
| 4329 |
}; |
| 4330 |
} |
| 4331 |
|
| 4332 |
return function(key, value) { |
| 4333 |
if (stack.length > 0) { |
| 4334 |
var thisPos = indexOf(stack, this); |
| 4335 |
~thisPos ? stack.splice(thisPos + 1) : stack.push(this); |
| 4336 |
~thisPos ? keys.splice(thisPos, Infinity, key) : keys.push(key); |
| 4337 |
|
| 4338 |
if (~indexOf(stack, value)) { |
| 4339 |
value = cycleReplacer.call(this, key, value); |
| 4340 |
} |
| 4341 |
} else { |
| 4342 |
stack.push(value); |
| 4343 |
} |
| 4344 |
|
| 4345 |
return replacer == null |
| 4346 |
? value instanceof Error ? stringifyError(value) : value |
| 4347 |
: replacer.call(this, key, value); |
| 4348 |
}; |
| 4349 |
} |
| 4350 |
|
| 4351 |
|
| 4352 |
/***/ }), |
| 4353 |
|
| 4354 |
/***/ "./node_modules/react/cjs/react-jsx-runtime.development.js": |
| 4355 |
/*!*****************************************************************!*\ |
| 4356 |
!*** ./node_modules/react/cjs/react-jsx-runtime.development.js ***! |
| 4357 |
\*****************************************************************/ |
| 4358 |
/***/ ((__unused_webpack_module, exports, __webpack_require__) => { |
| 4359 |
|
| 4360 |
"use strict"; |
| 4361 |
/** @license React v17.0.2 |
| 4362 |
* react-jsx-runtime.development.js |
| 4363 |
* |
| 4364 |
* Copyright (c) Facebook, Inc. and its affiliates. |
| 4365 |
* |
| 4366 |
* This source code is licensed under the MIT license found in the |
| 4367 |
* LICENSE file in the root directory of this source tree. |
| 4368 |
*/ |
| 4369 |
|
| 4370 |
|
| 4371 |
|
| 4372 |
if (true) { |
| 4373 |
(function() { |
| 4374 |
'use strict'; |
| 4375 |
|
| 4376 |
var React = __webpack_require__(/*! react */ "react"); |
| 4377 |
var _assign = __webpack_require__(/*! object-assign */ "./node_modules/object-assign/index.js"); |
| 4378 |
|
| 4379 |
// ATTENTION |
| 4380 |
// When adding new symbols to this file, |
| 4381 |
// Please consider also adding to 'react-devtools-shared/src/backend/ReactSymbols' |
| 4382 |
// The Symbol used to tag the ReactElement-like types. If there is no native Symbol |
| 4383 |
// nor polyfill, then a plain number is used for performance. |
| 4384 |
var REACT_ELEMENT_TYPE = 0xeac7; |
| 4385 |
var REACT_PORTAL_TYPE = 0xeaca; |
| 4386 |
exports.Fragment = 0xeacb; |
| 4387 |
var REACT_STRICT_MODE_TYPE = 0xeacc; |
| 4388 |
var REACT_PROFILER_TYPE = 0xead2; |
| 4389 |
var REACT_PROVIDER_TYPE = 0xeacd; |
| 4390 |
var REACT_CONTEXT_TYPE = 0xeace; |
| 4391 |
var REACT_FORWARD_REF_TYPE = 0xead0; |
| 4392 |
var REACT_SUSPENSE_TYPE = 0xead1; |
| 4393 |
var REACT_SUSPENSE_LIST_TYPE = 0xead8; |
| 4394 |
var REACT_MEMO_TYPE = 0xead3; |
| 4395 |
var REACT_LAZY_TYPE = 0xead4; |
| 4396 |
var REACT_BLOCK_TYPE = 0xead9; |
| 4397 |
var REACT_SERVER_BLOCK_TYPE = 0xeada; |
| 4398 |
var REACT_FUNDAMENTAL_TYPE = 0xead5; |
| 4399 |
var REACT_SCOPE_TYPE = 0xead7; |
| 4400 |
var REACT_OPAQUE_ID_TYPE = 0xeae0; |
| 4401 |
var REACT_DEBUG_TRACING_MODE_TYPE = 0xeae1; |
| 4402 |
var REACT_OFFSCREEN_TYPE = 0xeae2; |
| 4403 |
var REACT_LEGACY_HIDDEN_TYPE = 0xeae3; |
| 4404 |
|
| 4405 |
if (typeof Symbol === 'function' && Symbol.for) { |
| 4406 |
var symbolFor = Symbol.for; |
| 4407 |
REACT_ELEMENT_TYPE = symbolFor('react.element'); |
| 4408 |
REACT_PORTAL_TYPE = symbolFor('react.portal'); |
| 4409 |
exports.Fragment = symbolFor('react.fragment'); |
| 4410 |
REACT_STRICT_MODE_TYPE = symbolFor('react.strict_mode'); |
| 4411 |
REACT_PROFILER_TYPE = symbolFor('react.profiler'); |
| 4412 |
REACT_PROVIDER_TYPE = symbolFor('react.provider'); |
| 4413 |
REACT_CONTEXT_TYPE = symbolFor('react.context'); |
| 4414 |
REACT_FORWARD_REF_TYPE = symbolFor('react.forward_ref'); |
| 4415 |
REACT_SUSPENSE_TYPE = symbolFor('react.suspense'); |
| 4416 |
REACT_SUSPENSE_LIST_TYPE = symbolFor('react.suspense_list'); |
| 4417 |
REACT_MEMO_TYPE = symbolFor('react.memo'); |
| 4418 |
REACT_LAZY_TYPE = symbolFor('react.lazy'); |
| 4419 |
REACT_BLOCK_TYPE = symbolFor('react.block'); |
| 4420 |
REACT_SERVER_BLOCK_TYPE = symbolFor('react.server.block'); |
| 4421 |
REACT_FUNDAMENTAL_TYPE = symbolFor('react.fundamental'); |
| 4422 |
REACT_SCOPE_TYPE = symbolFor('react.scope'); |
| 4423 |
REACT_OPAQUE_ID_TYPE = symbolFor('react.opaque.id'); |
| 4424 |
REACT_DEBUG_TRACING_MODE_TYPE = symbolFor('react.debug_trace_mode'); |
| 4425 |
REACT_OFFSCREEN_TYPE = symbolFor('react.offscreen'); |
| 4426 |
REACT_LEGACY_HIDDEN_TYPE = symbolFor('react.legacy_hidden'); |
| 4427 |
} |
| 4428 |
|
| 4429 |
var MAYBE_ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator; |
| 4430 |
var FAUX_ITERATOR_SYMBOL = '@@iterator'; |
| 4431 |
function getIteratorFn(maybeIterable) { |
| 4432 |
if (maybeIterable === null || typeof maybeIterable !== 'object') { |
| 4433 |
return null; |
| 4434 |
} |
| 4435 |
|
| 4436 |
var maybeIterator = MAYBE_ITERATOR_SYMBOL && maybeIterable[MAYBE_ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL]; |
| 4437 |
|
| 4438 |
if (typeof maybeIterator === 'function') { |
| 4439 |
return maybeIterator; |
| 4440 |
} |
| 4441 |
|
| 4442 |
return null; |
| 4443 |
} |
| 4444 |
|
| 4445 |
var ReactSharedInternals = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED; |
| 4446 |
|
| 4447 |
function error(format) { |
| 4448 |
{ |
| 4449 |
for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) { |
| 4450 |
args[_key2 - 1] = arguments[_key2]; |
| 4451 |
} |
| 4452 |
|
| 4453 |
printWarning('error', format, args); |
| 4454 |
} |
| 4455 |
} |
| 4456 |
|
| 4457 |
function printWarning(level, format, args) { |
| 4458 |
// When changing this logic, you might want to also |
| 4459 |
// update consoleWithStackDev.www.js as well. |
| 4460 |
{ |
| 4461 |
var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame; |
| 4462 |
var stack = ReactDebugCurrentFrame.getStackAddendum(); |
| 4463 |
|
| 4464 |
if (stack !== '') { |
| 4465 |
format += '%s'; |
| 4466 |
args = args.concat([stack]); |
| 4467 |
} |
| 4468 |
|
| 4469 |
var argsWithFormat = args.map(function (item) { |
| 4470 |
return '' + item; |
| 4471 |
}); // Careful: RN currently depends on this prefix |
| 4472 |
|
| 4473 |
argsWithFormat.unshift('Warning: ' + format); // We intentionally don't use spread (or .apply) directly because it |
| 4474 |
// breaks IE9: https://github.com/facebook/react/issues/13610 |
| 4475 |
// eslint-disable-next-line react-internal/no-production-logging |
| 4476 |
|
| 4477 |
Function.prototype.apply.call(console[level], console, argsWithFormat); |
| 4478 |
} |
| 4479 |
} |
| 4480 |
|
| 4481 |
// Filter certain DOM attributes (e.g. src, href) if their values are empty strings. |
| 4482 |
|
| 4483 |
var enableScopeAPI = false; // Experimental Create Event Handle API. |
| 4484 |
|
| 4485 |
function isValidElementType(type) { |
| 4486 |
if (typeof type === 'string' || typeof type === 'function') { |
| 4487 |
return true; |
| 4488 |
} // Note: typeof might be other than 'symbol' or 'number' (e.g. if it's a polyfill). |
| 4489 |
|
| 4490 |
|
| 4491 |
if (type === exports.Fragment || type === REACT_PROFILER_TYPE || type === REACT_DEBUG_TRACING_MODE_TYPE || type === REACT_STRICT_MODE_TYPE || type === REACT_SUSPENSE_TYPE || type === REACT_SUSPENSE_LIST_TYPE || type === REACT_LEGACY_HIDDEN_TYPE || enableScopeAPI ) { |
| 4492 |
return true; |
| 4493 |
} |
| 4494 |
|
| 4495 |
if (typeof type === 'object' && type !== null) { |
| 4496 |
if (type.$$typeof === REACT_LAZY_TYPE || type.$$typeof === REACT_MEMO_TYPE || type.$$typeof === REACT_PROVIDER_TYPE || type.$$typeof === REACT_CONTEXT_TYPE || type.$$typeof === REACT_FORWARD_REF_TYPE || type.$$typeof === REACT_FUNDAMENTAL_TYPE || type.$$typeof === REACT_BLOCK_TYPE || type[0] === REACT_SERVER_BLOCK_TYPE) { |
| 4497 |
return true; |
| 4498 |
} |
| 4499 |
} |
| 4500 |
|
| 4501 |
return false; |
| 4502 |
} |
| 4503 |
|
| 4504 |
function getWrappedName(outerType, innerType, wrapperName) { |
| 4505 |
var functionName = innerType.displayName || innerType.name || ''; |
| 4506 |
return outerType.displayName || (functionName !== '' ? wrapperName + "(" + functionName + ")" : wrapperName); |
| 4507 |
} |
| 4508 |
|
| 4509 |
function getContextName(type) { |
| 4510 |
return type.displayName || 'Context'; |
| 4511 |
} |
| 4512 |
|
| 4513 |
function getComponentName(type) { |
| 4514 |
if (type == null) { |
| 4515 |
// Host root, text node or just invalid type. |
| 4516 |
return null; |
| 4517 |
} |
| 4518 |
|
| 4519 |
{ |
| 4520 |
if (typeof type.tag === 'number') { |
| 4521 |
error('Received an unexpected object in getComponentName(). ' + 'This is likely a bug in React. Please file an issue.'); |
| 4522 |
} |
| 4523 |
} |
| 4524 |
|
| 4525 |
if (typeof type === 'function') { |
| 4526 |
return type.displayName || type.name || null; |
| 4527 |
} |
| 4528 |
|
| 4529 |
if (typeof type === 'string') { |
| 4530 |
return type; |
| 4531 |
} |
| 4532 |
|
| 4533 |
switch (type) { |
| 4534 |
case exports.Fragment: |
| 4535 |
return 'Fragment'; |
| 4536 |
|
| 4537 |
case REACT_PORTAL_TYPE: |
| 4538 |
return 'Portal'; |
| 4539 |
|
| 4540 |
case REACT_PROFILER_TYPE: |
| 4541 |
return 'Profiler'; |
| 4542 |
|
| 4543 |
case REACT_STRICT_MODE_TYPE: |
| 4544 |
return 'StrictMode'; |
| 4545 |
|
| 4546 |
case REACT_SUSPENSE_TYPE: |
| 4547 |
return 'Suspense'; |
| 4548 |
|
| 4549 |
case REACT_SUSPENSE_LIST_TYPE: |
| 4550 |
return 'SuspenseList'; |
| 4551 |
} |
| 4552 |
|
| 4553 |
if (typeof type === 'object') { |
| 4554 |
switch (type.$$typeof) { |
| 4555 |
case REACT_CONTEXT_TYPE: |
| 4556 |
var context = type; |
| 4557 |
return getContextName(context) + '.Consumer'; |
| 4558 |
|
| 4559 |
case REACT_PROVIDER_TYPE: |
| 4560 |
var provider = type; |
| 4561 |
return getContextName(provider._context) + '.Provider'; |
| 4562 |
|
| 4563 |
case REACT_FORWARD_REF_TYPE: |
| 4564 |
return getWrappedName(type, type.render, 'ForwardRef'); |
| 4565 |
|
| 4566 |
case REACT_MEMO_TYPE: |
| 4567 |
return getComponentName(type.type); |
| 4568 |
|
| 4569 |
case REACT_BLOCK_TYPE: |
| 4570 |
return getComponentName(type._render); |
| 4571 |
|
| 4572 |
case REACT_LAZY_TYPE: |
| 4573 |
{ |
| 4574 |
var lazyComponent = type; |
| 4575 |
var payload = lazyComponent._payload; |
| 4576 |
var init = lazyComponent._init; |
| 4577 |
|
| 4578 |
try { |
| 4579 |
return getComponentName(init(payload)); |
| 4580 |
} catch (x) { |
| 4581 |
return null; |
| 4582 |
} |
| 4583 |
} |
| 4584 |
} |
| 4585 |
} |
| 4586 |
|
| 4587 |
return null; |
| 4588 |
} |
| 4589 |
|
| 4590 |
// Helpers to patch console.logs to avoid logging during side-effect free |
| 4591 |
// replaying on render function. This currently only patches the object |
| 4592 |
// lazily which won't cover if the log function was extracted eagerly. |
| 4593 |
// We could also eagerly patch the method. |
| 4594 |
var disabledDepth = 0; |
| 4595 |
var prevLog; |
| 4596 |
var prevInfo; |
| 4597 |
var prevWarn; |
| 4598 |
var prevError; |
| 4599 |
var prevGroup; |
| 4600 |
var prevGroupCollapsed; |
| 4601 |
var prevGroupEnd; |
| 4602 |
|
| 4603 |
function disabledLog() {} |
| 4604 |
|
| 4605 |
disabledLog.__reactDisabledLog = true; |
| 4606 |
function disableLogs() { |
| 4607 |
{ |
| 4608 |
if (disabledDepth === 0) { |
| 4609 |
/* eslint-disable react-internal/no-production-logging */ |
| 4610 |
prevLog = console.log; |
| 4611 |
prevInfo = console.info; |
| 4612 |
prevWarn = console.warn; |
| 4613 |
prevError = console.error; |
| 4614 |
prevGroup = console.group; |
| 4615 |
prevGroupCollapsed = console.groupCollapsed; |
| 4616 |
prevGroupEnd = console.groupEnd; // https://github.com/facebook/react/issues/19099 |
| 4617 |
|
| 4618 |
var props = { |
| 4619 |
configurable: true, |
| 4620 |
enumerable: true, |
| 4621 |
value: disabledLog, |
| 4622 |
writable: true |
| 4623 |
}; // $FlowFixMe Flow thinks console is immutable. |
| 4624 |
|
| 4625 |
Object.defineProperties(console, { |
| 4626 |
info: props, |
| 4627 |
log: props, |
| 4628 |
warn: props, |
| 4629 |
error: props, |
| 4630 |
group: props, |
| 4631 |
groupCollapsed: props, |
| 4632 |
groupEnd: props |
| 4633 |
}); |
| 4634 |
/* eslint-enable react-internal/no-production-logging */ |
| 4635 |
} |
| 4636 |
|
| 4637 |
disabledDepth++; |
| 4638 |
} |
| 4639 |
} |
| 4640 |
function reenableLogs() { |
| 4641 |
{ |
| 4642 |
disabledDepth--; |
| 4643 |
|
| 4644 |
if (disabledDepth === 0) { |
| 4645 |
/* eslint-disable react-internal/no-production-logging */ |
| 4646 |
var props = { |
| 4647 |
configurable: true, |
| 4648 |
enumerable: true, |
| 4649 |
writable: true |
| 4650 |
}; // $FlowFixMe Flow thinks console is immutable. |
| 4651 |
|
| 4652 |
Object.defineProperties(console, { |
| 4653 |
log: _assign({}, props, { |
| 4654 |
value: prevLog |
| 4655 |
}), |
| 4656 |
info: _assign({}, props, { |
| 4657 |
value: prevInfo |
| 4658 |
}), |
| 4659 |
warn: _assign({}, props, { |
| 4660 |
value: prevWarn |
| 4661 |
}), |
| 4662 |
error: _assign({}, props, { |
| 4663 |
value: prevError |
| 4664 |
}), |
| 4665 |
group: _assign({}, props, { |
| 4666 |
value: prevGroup |
| 4667 |
}), |
| 4668 |
groupCollapsed: _assign({}, props, { |
| 4669 |
value: prevGroupCollapsed |
| 4670 |
}), |
| 4671 |
groupEnd: _assign({}, props, { |
| 4672 |
value: prevGroupEnd |
| 4673 |
}) |
| 4674 |
}); |
| 4675 |
/* eslint-enable react-internal/no-production-logging */ |
| 4676 |
} |
| 4677 |
|
| 4678 |
if (disabledDepth < 0) { |
| 4679 |
error('disabledDepth fell below zero. ' + 'This is a bug in React. Please file an issue.'); |
| 4680 |
} |
| 4681 |
} |
| 4682 |
} |
| 4683 |
|
| 4684 |
var ReactCurrentDispatcher = ReactSharedInternals.ReactCurrentDispatcher; |
| 4685 |
var prefix; |
| 4686 |
function describeBuiltInComponentFrame(name, source, ownerFn) { |
| 4687 |
{ |
| 4688 |
if (prefix === undefined) { |
| 4689 |
// Extract the VM specific prefix used by each line. |
| 4690 |
try { |
| 4691 |
throw Error(); |
| 4692 |
} catch (x) { |
| 4693 |
var match = x.stack.trim().match(/\n( *(at )?)/); |
| 4694 |
prefix = match && match[1] || ''; |
| 4695 |
} |
| 4696 |
} // We use the prefix to ensure our stacks line up with native stack frames. |
| 4697 |
|
| 4698 |
|
| 4699 |
return '\n' + prefix + name; |
| 4700 |
} |
| 4701 |
} |
| 4702 |
var reentry = false; |
| 4703 |
var componentFrameCache; |
| 4704 |
|
| 4705 |
{ |
| 4706 |
var PossiblyWeakMap = typeof WeakMap === 'function' ? WeakMap : Map; |
| 4707 |
componentFrameCache = new PossiblyWeakMap(); |
| 4708 |
} |
| 4709 |
|
| 4710 |
function describeNativeComponentFrame(fn, construct) { |
| 4711 |
// If something asked for a stack inside a fake render, it should get ignored. |
| 4712 |
if (!fn || reentry) { |
| 4713 |
return ''; |
| 4714 |
} |
| 4715 |
|
| 4716 |
{ |
| 4717 |
var frame = componentFrameCache.get(fn); |
| 4718 |
|
| 4719 |
if (frame !== undefined) { |
| 4720 |
return frame; |
| 4721 |
} |
| 4722 |
} |
| 4723 |
|
| 4724 |
var control; |
| 4725 |
reentry = true; |
| 4726 |
var previousPrepareStackTrace = Error.prepareStackTrace; // $FlowFixMe It does accept undefined. |
| 4727 |
|
| 4728 |
Error.prepareStackTrace = undefined; |
| 4729 |
var previousDispatcher; |
| 4730 |
|
| 4731 |
{ |
| 4732 |
previousDispatcher = ReactCurrentDispatcher.current; // Set the dispatcher in DEV because this might be call in the render function |
| 4733 |
// for warnings. |
| 4734 |
|
| 4735 |
ReactCurrentDispatcher.current = null; |
| 4736 |
disableLogs(); |
| 4737 |
} |
| 4738 |
|
| 4739 |
try { |
| 4740 |
// This should throw. |
| 4741 |
if (construct) { |
| 4742 |
// Something should be setting the props in the constructor. |
| 4743 |
var Fake = function () { |
| 4744 |
throw Error(); |
| 4745 |
}; // $FlowFixMe |
| 4746 |
|
| 4747 |
|
| 4748 |
Object.defineProperty(Fake.prototype, 'props', { |
| 4749 |
set: function () { |
| 4750 |
// We use a throwing setter instead of frozen or non-writable props |
| 4751 |
// because that won't throw in a non-strict mode function. |
| 4752 |
throw Error(); |
| 4753 |
} |
| 4754 |
}); |
| 4755 |
|
| 4756 |
if (typeof Reflect === 'object' && Reflect.construct) { |
| 4757 |
// We construct a different control for this case to include any extra |
| 4758 |
// frames added by the construct call. |
| 4759 |
try { |
| 4760 |
Reflect.construct(Fake, []); |
| 4761 |
} catch (x) { |
| 4762 |
control = x; |
| 4763 |
} |
| 4764 |
|
| 4765 |
Reflect.construct(fn, [], Fake); |
| 4766 |
} else { |
| 4767 |
try { |
| 4768 |
Fake.call(); |
| 4769 |
} catch (x) { |
| 4770 |
control = x; |
| 4771 |
} |
| 4772 |
|
| 4773 |
fn.call(Fake.prototype); |
| 4774 |
} |
| 4775 |
} else { |
| 4776 |
try { |
| 4777 |
throw Error(); |
| 4778 |
} catch (x) { |
| 4779 |
control = x; |
| 4780 |
} |
| 4781 |
|
| 4782 |
fn(); |
| 4783 |
} |
| 4784 |
} catch (sample) { |
| 4785 |
// This is inlined manually because closure doesn't do it for us. |
| 4786 |
if (sample && control && typeof sample.stack === 'string') { |
| 4787 |
// This extracts the first frame from the sample that isn't also in the control. |
| 4788 |
// Skipping one frame that we assume is the frame that calls the two. |
| 4789 |
var sampleLines = sample.stack.split('\n'); |
| 4790 |
var controlLines = control.stack.split('\n'); |
| 4791 |
var s = sampleLines.length - 1; |
| 4792 |
var c = controlLines.length - 1; |
| 4793 |
|
| 4794 |
while (s >= 1 && c >= 0 && sampleLines[s] !== controlLines[c]) { |
| 4795 |
// We expect at least one stack frame to be shared. |
| 4796 |
// Typically this will be the root most one. However, stack frames may be |
| 4797 |
// cut off due to maximum stack limits. In this case, one maybe cut off |
| 4798 |
// earlier than the other. We assume that the sample is longer or the same |
| 4799 |
// and there for cut off earlier. So we should find the root most frame in |
| 4800 |
// the sample somewhere in the control. |
| 4801 |
c--; |
| 4802 |
} |
| 4803 |
|
| 4804 |
for (; s >= 1 && c >= 0; s--, c--) { |
| 4805 |
// Next we find the first one that isn't the same which should be the |
| 4806 |
// frame that called our sample function and the control. |
| 4807 |
if (sampleLines[s] !== controlLines[c]) { |
| 4808 |
// In V8, the first line is describing the message but other VMs don't. |
| 4809 |
// If we're about to return the first line, and the control is also on the same |
| 4810 |
// line, that's a pretty good indicator that our sample threw at same line as |
| 4811 |
// the control. I.e. before we entered the sample frame. So we ignore this result. |
| 4812 |
// This can happen if you passed a class to function component, or non-function. |
| 4813 |
if (s !== 1 || c !== 1) { |
| 4814 |
do { |
| 4815 |
s--; |
| 4816 |
c--; // We may still have similar intermediate frames from the construct call. |
| 4817 |
// The next one that isn't the same should be our match though. |
| 4818 |
|
| 4819 |
if (c < 0 || sampleLines[s] !== controlLines[c]) { |
| 4820 |
// V8 adds a "new" prefix for native classes. Let's remove it to make it prettier. |
| 4821 |
var _frame = '\n' + sampleLines[s].replace(' at new ', ' at '); |
| 4822 |
|
| 4823 |
{ |
| 4824 |
if (typeof fn === 'function') { |
| 4825 |
componentFrameCache.set(fn, _frame); |
| 4826 |
} |
| 4827 |
} // Return the line we found. |
| 4828 |
|
| 4829 |
|
| 4830 |
return _frame; |
| 4831 |
} |
| 4832 |
} while (s >= 1 && c >= 0); |
| 4833 |
} |
| 4834 |
|
| 4835 |
break; |
| 4836 |
} |
| 4837 |
} |
| 4838 |
} |
| 4839 |
} finally { |
| 4840 |
reentry = false; |
| 4841 |
|
| 4842 |
{ |
| 4843 |
ReactCurrentDispatcher.current = previousDispatcher; |
| 4844 |
reenableLogs(); |
| 4845 |
} |
| 4846 |
|
| 4847 |
Error.prepareStackTrace = previousPrepareStackTrace; |
| 4848 |
} // Fallback to just using the name if we couldn't make it throw. |
| 4849 |
|
| 4850 |
|
| 4851 |
var name = fn ? fn.displayName || fn.name : ''; |
| 4852 |
var syntheticFrame = name ? describeBuiltInComponentFrame(name) : ''; |
| 4853 |
|
| 4854 |
{ |
| 4855 |
if (typeof fn === 'function') { |
| 4856 |
componentFrameCache.set(fn, syntheticFrame); |
| 4857 |
} |
| 4858 |
} |
| 4859 |
|
| 4860 |
return syntheticFrame; |
| 4861 |
} |
| 4862 |
function describeFunctionComponentFrame(fn, source, ownerFn) { |
| 4863 |
{ |
| 4864 |
return describeNativeComponentFrame(fn, false); |
| 4865 |
} |
| 4866 |
} |
| 4867 |
|
| 4868 |
function shouldConstruct(Component) { |
| 4869 |
var prototype = Component.prototype; |
| 4870 |
return !!(prototype && prototype.isReactComponent); |
| 4871 |
} |
| 4872 |
|
| 4873 |
function describeUnknownElementTypeFrameInDEV(type, source, ownerFn) { |
| 4874 |
|
| 4875 |
if (type == null) { |
| 4876 |
return ''; |
| 4877 |
} |
| 4878 |
|
| 4879 |
if (typeof type === 'function') { |
| 4880 |
{ |
| 4881 |
return describeNativeComponentFrame(type, shouldConstruct(type)); |
| 4882 |
} |
| 4883 |
} |
| 4884 |
|
| 4885 |
if (typeof type === 'string') { |
| 4886 |
return describeBuiltInComponentFrame(type); |
| 4887 |
} |
| 4888 |
|
| 4889 |
switch (type) { |
| 4890 |
case REACT_SUSPENSE_TYPE: |
| 4891 |
return describeBuiltInComponentFrame('Suspense'); |
| 4892 |
|
| 4893 |
case REACT_SUSPENSE_LIST_TYPE: |
| 4894 |
return describeBuiltInComponentFrame('SuspenseList'); |
| 4895 |
} |
| 4896 |
|
| 4897 |
if (typeof type === 'object') { |
| 4898 |
switch (type.$$typeof) { |
| 4899 |
case REACT_FORWARD_REF_TYPE: |
| 4900 |
return describeFunctionComponentFrame(type.render); |
| 4901 |
|
| 4902 |
case REACT_MEMO_TYPE: |
| 4903 |
// Memo may contain any component type so we recursively resolve it. |
| 4904 |
return describeUnknownElementTypeFrameInDEV(type.type, source, ownerFn); |
| 4905 |
|
| 4906 |
case REACT_BLOCK_TYPE: |
| 4907 |
return describeFunctionComponentFrame(type._render); |
| 4908 |
|
| 4909 |
case REACT_LAZY_TYPE: |
| 4910 |
{ |
| 4911 |
var lazyComponent = type; |
| 4912 |
var payload = lazyComponent._payload; |
| 4913 |
var init = lazyComponent._init; |
| 4914 |
|
| 4915 |
try { |
| 4916 |
// Lazy may contain any component type so we recursively resolve it. |
| 4917 |
return describeUnknownElementTypeFrameInDEV(init(payload), source, ownerFn); |
| 4918 |
} catch (x) {} |
| 4919 |
} |
| 4920 |
} |
| 4921 |
} |
| 4922 |
|
| 4923 |
return ''; |
| 4924 |
} |
| 4925 |
|
| 4926 |
var loggedTypeFailures = {}; |
| 4927 |
var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame; |
| 4928 |
|
| 4929 |
function setCurrentlyValidatingElement(element) { |
| 4930 |
{ |
| 4931 |
if (element) { |
| 4932 |
var owner = element._owner; |
| 4933 |
var stack = describeUnknownElementTypeFrameInDEV(element.type, element._source, owner ? owner.type : null); |
| 4934 |
ReactDebugCurrentFrame.setExtraStackFrame(stack); |
| 4935 |
} else { |
| 4936 |
ReactDebugCurrentFrame.setExtraStackFrame(null); |
| 4937 |
} |
| 4938 |
} |
| 4939 |
} |
| 4940 |
|
| 4941 |
function checkPropTypes(typeSpecs, values, location, componentName, element) { |
| 4942 |
{ |
| 4943 |
// $FlowFixMe This is okay but Flow doesn't know it. |
| 4944 |
var has = Function.call.bind(Object.prototype.hasOwnProperty); |
| 4945 |
|
| 4946 |
for (var typeSpecName in typeSpecs) { |
| 4947 |
if (has(typeSpecs, typeSpecName)) { |
| 4948 |
var error$1 = void 0; // Prop type validation may throw. In case they do, we don't want to |
| 4949 |
// fail the render phase where it didn't fail before. So we log it. |
| 4950 |
// After these have been cleaned up, we'll let them throw. |
| 4951 |
|
| 4952 |
try { |
| 4953 |
// This is intentionally an invariant that gets caught. It's the same |
| 4954 |
// behavior as without this statement except with a better message. |
| 4955 |
if (typeof typeSpecs[typeSpecName] !== 'function') { |
| 4956 |
var err = Error((componentName || 'React class') + ': ' + location + ' type `' + typeSpecName + '` is invalid; ' + 'it must be a function, usually from the `prop-types` package, but received `' + typeof typeSpecs[typeSpecName] + '`.' + 'This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.'); |
| 4957 |
err.name = 'Invariant Violation'; |
| 4958 |
throw err; |
| 4959 |
} |
| 4960 |
|
| 4961 |
error$1 = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED'); |
| 4962 |
} catch (ex) { |
| 4963 |
error$1 = ex; |
| 4964 |
} |
| 4965 |
|
| 4966 |
if (error$1 && !(error$1 instanceof Error)) { |
| 4967 |
setCurrentlyValidatingElement(element); |
| 4968 |
|
| 4969 |
error('%s: type specification of %s' + ' `%s` is invalid; the type checker ' + 'function must return `null` or an `Error` but returned a %s. ' + 'You may have forgotten to pass an argument to the type checker ' + 'creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and ' + 'shape all require an argument).', componentName || 'React class', location, typeSpecName, typeof error$1); |
| 4970 |
|
| 4971 |
setCurrentlyValidatingElement(null); |
| 4972 |
} |
| 4973 |
|
| 4974 |
if (error$1 instanceof Error && !(error$1.message in loggedTypeFailures)) { |
| 4975 |
// Only monitor this failure once because there tends to be a lot of the |
| 4976 |
// same error. |
| 4977 |
loggedTypeFailures[error$1.message] = true; |
| 4978 |
setCurrentlyValidatingElement(element); |
| 4979 |
|
| 4980 |
error('Failed %s type: %s', location, error$1.message); |
| 4981 |
|
| 4982 |
setCurrentlyValidatingElement(null); |
| 4983 |
} |
| 4984 |
} |
| 4985 |
} |
| 4986 |
} |
| 4987 |
} |
| 4988 |
|
| 4989 |
var ReactCurrentOwner = ReactSharedInternals.ReactCurrentOwner; |
| 4990 |
var hasOwnProperty = Object.prototype.hasOwnProperty; |
| 4991 |
var RESERVED_PROPS = { |
| 4992 |
key: true, |
| 4993 |
ref: true, |
| 4994 |
__self: true, |
| 4995 |
__source: true |
| 4996 |
}; |
| 4997 |
var specialPropKeyWarningShown; |
| 4998 |
var specialPropRefWarningShown; |
| 4999 |
var didWarnAboutStringRefs; |
| 5000 |
|
| 5001 |
{ |
| 5002 |
didWarnAboutStringRefs = {}; |
| 5003 |
} |
| 5004 |
|
| 5005 |
function hasValidRef(config) { |
| 5006 |
{ |
| 5007 |
if (hasOwnProperty.call(config, 'ref')) { |
| 5008 |
var getter = Object.getOwnPropertyDescriptor(config, 'ref').get; |
| 5009 |
|
| 5010 |
if (getter && getter.isReactWarning) { |
| 5011 |
return false; |
| 5012 |
} |
| 5013 |
} |
| 5014 |
} |
| 5015 |
|
| 5016 |
return config.ref !== undefined; |
| 5017 |
} |
| 5018 |
|
| 5019 |
function hasValidKey(config) { |
| 5020 |
{ |
| 5021 |
if (hasOwnProperty.call(config, 'key')) { |
| 5022 |
var getter = Object.getOwnPropertyDescriptor(config, 'key').get; |
| 5023 |
|
| 5024 |
if (getter && getter.isReactWarning) { |
| 5025 |
return false; |
| 5026 |
} |
| 5027 |
} |
| 5028 |
} |
| 5029 |
|
| 5030 |
return config.key !== undefined; |
| 5031 |
} |
| 5032 |
|
| 5033 |
function warnIfStringRefCannotBeAutoConverted(config, self) { |
| 5034 |
{ |
| 5035 |
if (typeof config.ref === 'string' && ReactCurrentOwner.current && self && ReactCurrentOwner.current.stateNode !== self) { |
| 5036 |
var componentName = getComponentName(ReactCurrentOwner.current.type); |
| 5037 |
|
| 5038 |
if (!didWarnAboutStringRefs[componentName]) { |
| 5039 |
error('Component "%s" contains the string ref "%s". ' + 'Support for string refs will be removed in a future major release. ' + 'This case cannot be automatically converted to an arrow function. ' + 'We ask you to manually fix this case by using useRef() or createRef() instead. ' + 'Learn more about using refs safely here: ' + 'https://reactjs.org/link/strict-mode-string-ref', getComponentName(ReactCurrentOwner.current.type), config.ref); |
| 5040 |
|
| 5041 |
didWarnAboutStringRefs[componentName] = true; |
| 5042 |
} |
| 5043 |
} |
| 5044 |
} |
| 5045 |
} |
| 5046 |
|
| 5047 |
function defineKeyPropWarningGetter(props, displayName) { |
| 5048 |
{ |
| 5049 |
var warnAboutAccessingKey = function () { |
| 5050 |
if (!specialPropKeyWarningShown) { |
| 5051 |
specialPropKeyWarningShown = true; |
| 5052 |
|
| 5053 |
error('%s: `key` is not a prop. Trying to access it will result ' + 'in `undefined` being returned. If you need to access the same ' + 'value within the child component, you should pass it as a different ' + 'prop. (https://reactjs.org/link/special-props)', displayName); |
| 5054 |
} |
| 5055 |
}; |
| 5056 |
|
| 5057 |
warnAboutAccessingKey.isReactWarning = true; |
| 5058 |
Object.defineProperty(props, 'key', { |
| 5059 |
get: warnAboutAccessingKey, |
| 5060 |
configurable: true |
| 5061 |
}); |
| 5062 |
} |
| 5063 |
} |
| 5064 |
|
| 5065 |
function defineRefPropWarningGetter(props, displayName) { |
| 5066 |
{ |
| 5067 |
var warnAboutAccessingRef = function () { |
| 5068 |
if (!specialPropRefWarningShown) { |
| 5069 |
specialPropRefWarningShown = true; |
| 5070 |
|
| 5071 |
error('%s: `ref` is not a prop. Trying to access it will result ' + 'in `undefined` being returned. If you need to access the same ' + 'value within the child component, you should pass it as a different ' + 'prop. (https://reactjs.org/link/special-props)', displayName); |
| 5072 |
} |
| 5073 |
}; |
| 5074 |
|
| 5075 |
warnAboutAccessingRef.isReactWarning = true; |
| 5076 |
Object.defineProperty(props, 'ref', { |
| 5077 |
get: warnAboutAccessingRef, |
| 5078 |
configurable: true |
| 5079 |
}); |
| 5080 |
} |
| 5081 |
} |
| 5082 |
/** |
| 5083 |
* Factory method to create a new React element. This no longer adheres to |
| 5084 |
* the class pattern, so do not use new to call it. Also, instanceof check |
| 5085 |
* will not work. Instead test $$typeof field against Symbol.for('react.element') to check |
| 5086 |
* if something is a React Element. |
| 5087 |
* |
| 5088 |
* @param {*} type |
| 5089 |
* @param {*} props |
| 5090 |
* @param {*} key |
| 5091 |
* @param {string|object} ref |
| 5092 |
* @param {*} owner |
| 5093 |
* @param {*} self A *temporary* helper to detect places where `this` is |
| 5094 |
* different from the `owner` when React.createElement is called, so that we |
| 5095 |
* can warn. We want to get rid of owner and replace string `ref`s with arrow |
| 5096 |
* functions, and as long as `this` and owner are the same, there will be no |
| 5097 |
* change in behavior. |
| 5098 |
* @param {*} source An annotation object (added by a transpiler or otherwise) |
| 5099 |
* indicating filename, line number, and/or other information. |
| 5100 |
* @internal |
| 5101 |
*/ |
| 5102 |
|
| 5103 |
|
| 5104 |
var ReactElement = function (type, key, ref, self, source, owner, props) { |
| 5105 |
var element = { |
| 5106 |
// This tag allows us to uniquely identify this as a React Element |
| 5107 |
$$typeof: REACT_ELEMENT_TYPE, |
| 5108 |
// Built-in properties that belong on the element |
| 5109 |
type: type, |
| 5110 |
key: key, |
| 5111 |
ref: ref, |
| 5112 |
props: props, |
| 5113 |
// Record the component responsible for creating this element. |
| 5114 |
_owner: owner |
| 5115 |
}; |
| 5116 |
|
| 5117 |
{ |
| 5118 |
// The validation flag is currently mutative. We put it on |
| 5119 |
// an external backing store so that we can freeze the whole object. |
| 5120 |
// This can be replaced with a WeakMap once they are implemented in |
| 5121 |
// commonly used development environments. |
| 5122 |
element._store = {}; // To make comparing ReactElements easier for testing purposes, we make |
| 5123 |
// the validation flag non-enumerable (where possible, which should |
| 5124 |
// include every environment we run tests in), so the test framework |
| 5125 |
// ignores it. |
| 5126 |
|
| 5127 |
Object.defineProperty(element._store, 'validated', { |
| 5128 |
configurable: false, |
| 5129 |
enumerable: false, |
| 5130 |
writable: true, |
| 5131 |
value: false |
| 5132 |
}); // self and source are DEV only properties. |
| 5133 |
|
| 5134 |
Object.defineProperty(element, '_self', { |
| 5135 |
configurable: false, |
| 5136 |
enumerable: false, |
| 5137 |
writable: false, |
| 5138 |
value: self |
| 5139 |
}); // Two elements created in two different places should be considered |
| 5140 |
// equal for testing purposes and therefore we hide it from enumeration. |
| 5141 |
|
| 5142 |
Object.defineProperty(element, '_source', { |
| 5143 |
configurable: false, |
| 5144 |
enumerable: false, |
| 5145 |
writable: false, |
| 5146 |
value: source |
| 5147 |
}); |
| 5148 |
|
| 5149 |
if (Object.freeze) { |
| 5150 |
Object.freeze(element.props); |
| 5151 |
Object.freeze(element); |
| 5152 |
} |
| 5153 |
} |
| 5154 |
|
| 5155 |
return element; |
| 5156 |
}; |
| 5157 |
/** |
| 5158 |
* https://github.com/reactjs/rfcs/pull/107 |
| 5159 |
* @param {*} type |
| 5160 |
* @param {object} props |
| 5161 |
* @param {string} key |
| 5162 |
*/ |
| 5163 |
|
| 5164 |
function jsxDEV(type, config, maybeKey, source, self) { |
| 5165 |
{ |
| 5166 |
var propName; // Reserved names are extracted |
| 5167 |
|
| 5168 |
var props = {}; |
| 5169 |
var key = null; |
| 5170 |
var ref = null; // Currently, key can be spread in as a prop. This causes a potential |
| 5171 |
// issue if key is also explicitly declared (ie. <div {...props} key="Hi" /> |
| 5172 |
// or <div key="Hi" {...props} /> ). We want to deprecate key spread, |
| 5173 |
// but as an intermediary step, we will use jsxDEV for everything except |
| 5174 |
// <div {...props} key="Hi" />, because we aren't currently able to tell if |
| 5175 |
// key is explicitly declared to be undefined or not. |
| 5176 |
|
| 5177 |
if (maybeKey !== undefined) { |
| 5178 |
key = '' + maybeKey; |
| 5179 |
} |
| 5180 |
|
| 5181 |
if (hasValidKey(config)) { |
| 5182 |
key = '' + config.key; |
| 5183 |
} |
| 5184 |
|
| 5185 |
if (hasValidRef(config)) { |
| 5186 |
ref = config.ref; |
| 5187 |
warnIfStringRefCannotBeAutoConverted(config, self); |
| 5188 |
} // Remaining properties are added to a new props object |
| 5189 |
|
| 5190 |
|
| 5191 |
for (propName in config) { |
| 5192 |
if (hasOwnProperty.call(config, propName) && !RESERVED_PROPS.hasOwnProperty(propName)) { |
| 5193 |
props[propName] = config[propName]; |
| 5194 |
} |
| 5195 |
} // Resolve default props |
| 5196 |
|
| 5197 |
|
| 5198 |
if (type && type.defaultProps) { |
| 5199 |
var defaultProps = type.defaultProps; |
| 5200 |
|
| 5201 |
for (propName in defaultProps) { |
| 5202 |
if (props[propName] === undefined) { |
| 5203 |
props[propName] = defaultProps[propName]; |
| 5204 |
} |
| 5205 |
} |
| 5206 |
} |
| 5207 |
|
| 5208 |
if (key || ref) { |
| 5209 |
var displayName = typeof type === 'function' ? type.displayName || type.name || 'Unknown' : type; |
| 5210 |
|
| 5211 |
if (key) { |
| 5212 |
defineKeyPropWarningGetter(props, displayName); |
| 5213 |
} |
| 5214 |
|
| 5215 |
if (ref) { |
| 5216 |
defineRefPropWarningGetter(props, displayName); |
| 5217 |
} |
| 5218 |
} |
| 5219 |
|
| 5220 |
return ReactElement(type, key, ref, self, source, ReactCurrentOwner.current, props); |
| 5221 |
} |
| 5222 |
} |
| 5223 |
|
| 5224 |
var ReactCurrentOwner$1 = ReactSharedInternals.ReactCurrentOwner; |
| 5225 |
var ReactDebugCurrentFrame$1 = ReactSharedInternals.ReactDebugCurrentFrame; |
| 5226 |
|
| 5227 |
function setCurrentlyValidatingElement$1(element) { |
| 5228 |
{ |
| 5229 |
if (element) { |
| 5230 |
var owner = element._owner; |
| 5231 |
var stack = describeUnknownElementTypeFrameInDEV(element.type, element._source, owner ? owner.type : null); |
| 5232 |
ReactDebugCurrentFrame$1.setExtraStackFrame(stack); |
| 5233 |
} else { |
| 5234 |
ReactDebugCurrentFrame$1.setExtraStackFrame(null); |
| 5235 |
} |
| 5236 |
} |
| 5237 |
} |
| 5238 |
|
| 5239 |
var propTypesMisspellWarningShown; |
| 5240 |
|
| 5241 |
{ |
| 5242 |
propTypesMisspellWarningShown = false; |
| 5243 |
} |
| 5244 |
/** |
| 5245 |
* Verifies the object is a ReactElement. |
| 5246 |
* See https://reactjs.org/docs/react-api.html#isvalidelement |
| 5247 |
* @param {?object} object |
| 5248 |
* @return {boolean} True if `object` is a ReactElement. |
| 5249 |
* @final |
| 5250 |
*/ |
| 5251 |
|
| 5252 |
function isValidElement(object) { |
| 5253 |
{ |
| 5254 |
return typeof object === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE; |
| 5255 |
} |
| 5256 |
} |
| 5257 |
|
| 5258 |
function getDeclarationErrorAddendum() { |
| 5259 |
{ |
| 5260 |
if (ReactCurrentOwner$1.current) { |
| 5261 |
var name = getComponentName(ReactCurrentOwner$1.current.type); |
| 5262 |
|
| 5263 |
if (name) { |
| 5264 |
return '\n\nCheck the render method of `' + name + '`.'; |
| 5265 |
} |
| 5266 |
} |
| 5267 |
|
| 5268 |
return ''; |
| 5269 |
} |
| 5270 |
} |
| 5271 |
|
| 5272 |
function getSourceInfoErrorAddendum(source) { |
| 5273 |
{ |
| 5274 |
if (source !== undefined) { |
| 5275 |
var fileName = source.fileName.replace(/^.*[\\\/]/, ''); |
| 5276 |
var lineNumber = source.lineNumber; |
| 5277 |
return '\n\nCheck your code at ' + fileName + ':' + lineNumber + '.'; |
| 5278 |
} |
| 5279 |
|
| 5280 |
return ''; |
| 5281 |
} |
| 5282 |
} |
| 5283 |
/** |
| 5284 |
* Warn if there's no key explicitly set on dynamic arrays of children or |
| 5285 |
* object keys are not valid. This allows us to keep track of children between |
| 5286 |
* updates. |
| 5287 |
*/ |
| 5288 |
|
| 5289 |
|
| 5290 |
var ownerHasKeyUseWarning = {}; |
| 5291 |
|
| 5292 |
function getCurrentComponentErrorInfo(parentType) { |
| 5293 |
{ |
| 5294 |
var info = getDeclarationErrorAddendum(); |
| 5295 |
|
| 5296 |
if (!info) { |
| 5297 |
var parentName = typeof parentType === 'string' ? parentType : parentType.displayName || parentType.name; |
| 5298 |
|
| 5299 |
if (parentName) { |
| 5300 |
info = "\n\nCheck the top-level render call using <" + parentName + ">."; |
| 5301 |
} |
| 5302 |
} |
| 5303 |
|
| 5304 |
return info; |
| 5305 |
} |
| 5306 |
} |
| 5307 |
/** |
| 5308 |
* Warn if the element doesn't have an explicit key assigned to it. |
| 5309 |
* This element is in an array. The array could grow and shrink or be |
| 5310 |
* reordered. All children that haven't already been validated are required to |
| 5311 |
* have a "key" property assigned to it. Error statuses are cached so a warning |
| 5312 |
* will only be shown once. |
| 5313 |
* |
| 5314 |
* @internal |
| 5315 |
* @param {ReactElement} element Element that requires a key. |
| 5316 |
* @param {*} parentType element's parent's type. |
| 5317 |
*/ |
| 5318 |
|
| 5319 |
|
| 5320 |
function validateExplicitKey(element, parentType) { |
| 5321 |
{ |
| 5322 |
if (!element._store || element._store.validated || element.key != null) { |
| 5323 |
return; |
| 5324 |
} |
| 5325 |
|
| 5326 |
element._store.validated = true; |
| 5327 |
var currentComponentErrorInfo = getCurrentComponentErrorInfo(parentType); |
| 5328 |
|
| 5329 |
if (ownerHasKeyUseWarning[currentComponentErrorInfo]) { |
| 5330 |
return; |
| 5331 |
} |
| 5332 |
|
| 5333 |
ownerHasKeyUseWarning[currentComponentErrorInfo] = true; // Usually the current owner is the offender, but if it accepts children as a |
| 5334 |
// property, it may be the creator of the child that's responsible for |
| 5335 |
// assigning it a key. |
| 5336 |
|
| 5337 |
var childOwner = ''; |
| 5338 |
|
| 5339 |
if (element && element._owner && element._owner !== ReactCurrentOwner$1.current) { |
| 5340 |
// Give the component that originally created this child. |
| 5341 |
childOwner = " It was passed a child from " + getComponentName(element._owner.type) + "."; |
| 5342 |
} |
| 5343 |
|
| 5344 |
setCurrentlyValidatingElement$1(element); |
| 5345 |
|
| 5346 |
error('Each child in a list should have a unique "key" prop.' + '%s%s See https://reactjs.org/link/warning-keys for more information.', currentComponentErrorInfo, childOwner); |
| 5347 |
|
| 5348 |
setCurrentlyValidatingElement$1(null); |
| 5349 |
} |
| 5350 |
} |
| 5351 |
/** |
| 5352 |
* Ensure that every element either is passed in a static location, in an |
| 5353 |
* array with an explicit keys property defined, or in an object literal |
| 5354 |
* with valid key property. |
| 5355 |
* |
| 5356 |
* @internal |
| 5357 |
* @param {ReactNode} node Statically passed child of any type. |
| 5358 |
* @param {*} parentType node's parent's type. |
| 5359 |
*/ |
| 5360 |
|
| 5361 |
|
| 5362 |
function validateChildKeys(node, parentType) { |
| 5363 |
{ |
| 5364 |
if (typeof node !== 'object') { |
| 5365 |
return; |
| 5366 |
} |
| 5367 |
|
| 5368 |
if (Array.isArray(node)) { |
| 5369 |
for (var i = 0; i < node.length; i++) { |
| 5370 |
var child = node[i]; |
| 5371 |
|
| 5372 |
if (isValidElement(child)) { |
| 5373 |
validateExplicitKey(child, parentType); |
| 5374 |
} |
| 5375 |
} |
| 5376 |
} else if (isValidElement(node)) { |
| 5377 |
// This element was passed in a valid location. |
| 5378 |
if (node._store) { |
| 5379 |
node._store.validated = true; |
| 5380 |
} |
| 5381 |
} else if (node) { |
| 5382 |
var iteratorFn = getIteratorFn(node); |
| 5383 |
|
| 5384 |
if (typeof iteratorFn === 'function') { |
| 5385 |
// Entry iterators used to provide implicit keys, |
| 5386 |
// but now we print a separate warning for them later. |
| 5387 |
if (iteratorFn !== node.entries) { |
| 5388 |
var iterator = iteratorFn.call(node); |
| 5389 |
var step; |
| 5390 |
|
| 5391 |
while (!(step = iterator.next()).done) { |
| 5392 |
if (isValidElement(step.value)) { |
| 5393 |
validateExplicitKey(step.value, parentType); |
| 5394 |
} |
| 5395 |
} |
| 5396 |
} |
| 5397 |
} |
| 5398 |
} |
| 5399 |
} |
| 5400 |
} |
| 5401 |
/** |
| 5402 |
* Given an element, validate that its props follow the propTypes definition, |
| 5403 |
* provided by the type. |
| 5404 |
* |
| 5405 |
* @param {ReactElement} element |
| 5406 |
*/ |
| 5407 |
|
| 5408 |
|
| 5409 |
function validatePropTypes(element) { |
| 5410 |
{ |
| 5411 |
var type = element.type; |
| 5412 |
|
| 5413 |
if (type === null || type === undefined || typeof type === 'string') { |
| 5414 |
return; |
| 5415 |
} |
| 5416 |
|
| 5417 |
var propTypes; |
| 5418 |
|
| 5419 |
if (typeof type === 'function') { |
| 5420 |
propTypes = type.propTypes; |
| 5421 |
} else if (typeof type === 'object' && (type.$$typeof === REACT_FORWARD_REF_TYPE || // Note: Memo only checks outer props here. |
| 5422 |
// Inner props are checked in the reconciler. |
| 5423 |
type.$$typeof === REACT_MEMO_TYPE)) { |
| 5424 |
propTypes = type.propTypes; |
| 5425 |
} else { |
| 5426 |
return; |
| 5427 |
} |
| 5428 |
|
| 5429 |
if (propTypes) { |
| 5430 |
// Intentionally inside to avoid triggering lazy initializers: |
| 5431 |
var name = getComponentName(type); |
| 5432 |
checkPropTypes(propTypes, element.props, 'prop', name, element); |
| 5433 |
} else if (type.PropTypes !== undefined && !propTypesMisspellWarningShown) { |
| 5434 |
propTypesMisspellWarningShown = true; // Intentionally inside to avoid triggering lazy initializers: |
| 5435 |
|
| 5436 |
var _name = getComponentName(type); |
| 5437 |
|
| 5438 |
error('Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?', _name || 'Unknown'); |
| 5439 |
} |
| 5440 |
|
| 5441 |
if (typeof type.getDefaultProps === 'function' && !type.getDefaultProps.isReactClassApproved) { |
| 5442 |
error('getDefaultProps is only used on classic React.createClass ' + 'definitions. Use a static property named `defaultProps` instead.'); |
| 5443 |
} |
| 5444 |
} |
| 5445 |
} |
| 5446 |
/** |
| 5447 |
* Given a fragment, validate that it can only be provided with fragment props |
| 5448 |
* @param {ReactElement} fragment |
| 5449 |
*/ |
| 5450 |
|
| 5451 |
|
| 5452 |
function validateFragmentProps(fragment) { |
| 5453 |
{ |
| 5454 |
var keys = Object.keys(fragment.props); |
| 5455 |
|
| 5456 |
for (var i = 0; i < keys.length; i++) { |
| 5457 |
var key = keys[i]; |
| 5458 |
|
| 5459 |
if (key !== 'children' && key !== 'key') { |
| 5460 |
setCurrentlyValidatingElement$1(fragment); |
| 5461 |
|
| 5462 |
error('Invalid prop `%s` supplied to `React.Fragment`. ' + 'React.Fragment can only have `key` and `children` props.', key); |
| 5463 |
|
| 5464 |
setCurrentlyValidatingElement$1(null); |
| 5465 |
break; |
| 5466 |
} |
| 5467 |
} |
| 5468 |
|
| 5469 |
if (fragment.ref !== null) { |
| 5470 |
setCurrentlyValidatingElement$1(fragment); |
| 5471 |
|
| 5472 |
error('Invalid attribute `ref` supplied to `React.Fragment`.'); |
| 5473 |
|
| 5474 |
setCurrentlyValidatingElement$1(null); |
| 5475 |
} |
| 5476 |
} |
| 5477 |
} |
| 5478 |
|
| 5479 |
function jsxWithValidation(type, props, key, isStaticChildren, source, self) { |
| 5480 |
{ |
| 5481 |
var validType = isValidElementType(type); // We warn in this case but don't throw. We expect the element creation to |
| 5482 |
// succeed and there will likely be errors in render. |
| 5483 |
|
| 5484 |
if (!validType) { |
| 5485 |
var info = ''; |
| 5486 |
|
| 5487 |
if (type === undefined || typeof type === 'object' && type !== null && Object.keys(type).length === 0) { |
| 5488 |
info += ' You likely forgot to export your component from the file ' + "it's defined in, or you might have mixed up default and named imports."; |
| 5489 |
} |
| 5490 |
|
| 5491 |
var sourceInfo = getSourceInfoErrorAddendum(source); |
| 5492 |
|
| 5493 |
if (sourceInfo) { |
| 5494 |
info += sourceInfo; |
| 5495 |
} else { |
| 5496 |
info += getDeclarationErrorAddendum(); |
| 5497 |
} |
| 5498 |
|
| 5499 |
var typeString; |
| 5500 |
|
| 5501 |
if (type === null) { |
| 5502 |
typeString = 'null'; |
| 5503 |
} else if (Array.isArray(type)) { |
| 5504 |
typeString = 'array'; |
| 5505 |
} else if (type !== undefined && type.$$typeof === REACT_ELEMENT_TYPE) { |
| 5506 |
typeString = "<" + (getComponentName(type.type) || 'Unknown') + " />"; |
| 5507 |
info = ' Did you accidentally export a JSX literal instead of a component?'; |
| 5508 |
} else { |
| 5509 |
typeString = typeof type; |
| 5510 |
} |
| 5511 |
|
| 5512 |
error('React.jsx: type is invalid -- expected a string (for ' + 'built-in components) or a class/function (for composite ' + 'components) but got: %s.%s', typeString, info); |
| 5513 |
} |
| 5514 |
|
| 5515 |
var element = jsxDEV(type, props, key, source, self); // The result can be nullish if a mock or a custom function is used. |
| 5516 |
// TODO: Drop this when these are no longer allowed as the type argument. |
| 5517 |
|
| 5518 |
if (element == null) { |
| 5519 |
return element; |
| 5520 |
} // Skip key warning if the type isn't valid since our key validation logic |
| 5521 |
// doesn't expect a non-string/function type and can throw confusing errors. |
| 5522 |
// We don't want exception behavior to differ between dev and prod. |
| 5523 |
// (Rendering will throw with a helpful message and as soon as the type is |
| 5524 |
// fixed, the key warnings will appear.) |
| 5525 |
|
| 5526 |
|
| 5527 |
if (validType) { |
| 5528 |
var children = props.children; |
| 5529 |
|
| 5530 |
if (children !== undefined) { |
| 5531 |
if (isStaticChildren) { |
| 5532 |
if (Array.isArray(children)) { |
| 5533 |
for (var i = 0; i < children.length; i++) { |
| 5534 |
validateChildKeys(children[i], type); |
| 5535 |
} |
| 5536 |
|
| 5537 |
if (Object.freeze) { |
| 5538 |
Object.freeze(children); |
| 5539 |
} |
| 5540 |
} else { |
| 5541 |
error('React.jsx: Static children should always be an array. ' + 'You are likely explicitly calling React.jsxs or React.jsxDEV. ' + 'Use the Babel transform instead.'); |
| 5542 |
} |
| 5543 |
} else { |
| 5544 |
validateChildKeys(children, type); |
| 5545 |
} |
| 5546 |
} |
| 5547 |
} |
| 5548 |
|
| 5549 |
if (type === exports.Fragment) { |
| 5550 |
validateFragmentProps(element); |
| 5551 |
} else { |
| 5552 |
validatePropTypes(element); |
| 5553 |
} |
| 5554 |
|
| 5555 |
return element; |
| 5556 |
} |
| 5557 |
} // These two functions exist to still get child warnings in dev |
| 5558 |
// even with the prod transform. This means that jsxDEV is purely |
| 5559 |
// opt-in behavior for better messages but that we won't stop |
| 5560 |
// giving you warnings if you use production apis. |
| 5561 |
|
| 5562 |
function jsxWithValidationStatic(type, props, key) { |
| 5563 |
{ |
| 5564 |
return jsxWithValidation(type, props, key, true); |
| 5565 |
} |
| 5566 |
} |
| 5567 |
function jsxWithValidationDynamic(type, props, key) { |
| 5568 |
{ |
| 5569 |
return jsxWithValidation(type, props, key, false); |
| 5570 |
} |
| 5571 |
} |
| 5572 |
|
| 5573 |
var jsx = jsxWithValidationDynamic ; // we may want to special case jsxs internally to take advantage of static children. |
| 5574 |
// for now we can ship identical prod functions |
| 5575 |
|
| 5576 |
var jsxs = jsxWithValidationStatic ; |
| 5577 |
|
| 5578 |
exports.jsx = jsx; |
| 5579 |
exports.jsxs = jsxs; |
| 5580 |
})(); |
| 5581 |
} |
| 5582 |
|
| 5583 |
|
| 5584 |
/***/ }), |
| 5585 |
|
| 5586 |
/***/ "./node_modules/react/jsx-runtime.js": |
| 5587 |
/*!*******************************************!*\ |
| 5588 |
!*** ./node_modules/react/jsx-runtime.js ***! |
| 5589 |
\*******************************************/ |
| 5590 |
/***/ ((module, __unused_webpack_exports, __webpack_require__) => { |
| 5591 |
|
| 5592 |
"use strict"; |
| 5593 |
|
| 5594 |
|
| 5595 |
if (false) {} else { |
| 5596 |
module.exports = __webpack_require__(/*! ./cjs/react-jsx-runtime.development.js */ "./node_modules/react/cjs/react-jsx-runtime.development.js"); |
| 5597 |
} |
| 5598 |
|
| 5599 |
|
| 5600 |
/***/ }), |
| 5601 |
|
| 5602 |
/***/ "react": |
| 5603 |
/*!************************!*\ |
| 5604 |
!*** external "React" ***! |
| 5605 |
\************************/ |
| 5606 |
/***/ ((module) => { |
| 5607 |
|
| 5608 |
"use strict"; |
| 5609 |
module.exports = window["React"]; |
| 5610 |
|
| 5611 |
/***/ }), |
| 5612 |
|
| 5613 |
/***/ "react-dom": |
| 5614 |
/*!***************************!*\ |
| 5615 |
!*** external "ReactDOM" ***! |
| 5616 |
\***************************/ |
| 5617 |
/***/ ((module) => { |
| 5618 |
|
| 5619 |
"use strict"; |
| 5620 |
module.exports = window["ReactDOM"]; |
| 5621 |
|
| 5622 |
/***/ }), |
| 5623 |
|
| 5624 |
/***/ "jquery": |
| 5625 |
/*!*************************!*\ |
| 5626 |
!*** external "jQuery" ***! |
| 5627 |
\*************************/ |
| 5628 |
/***/ ((module) => { |
| 5629 |
|
| 5630 |
"use strict"; |
| 5631 |
module.exports = window["jQuery"]; |
| 5632 |
|
| 5633 |
/***/ }), |
| 5634 |
|
| 5635 |
/***/ "@wordpress/i18n": |
| 5636 |
/*!******************************!*\ |
| 5637 |
!*** external ["wp","i18n"] ***! |
| 5638 |
\******************************/ |
| 5639 |
/***/ ((module) => { |
| 5640 |
|
| 5641 |
"use strict"; |
| 5642 |
module.exports = window["wp"]["i18n"]; |
| 5643 |
|
| 5644 |
/***/ }), |
| 5645 |
|
| 5646 |
/***/ "./node_modules/@linaria/react/dist/index.mjs": |
| 5647 |
/*!****************************************************!*\ |
| 5648 |
!*** ./node_modules/@linaria/react/dist/index.mjs ***! |
| 5649 |
\****************************************************/ |
| 5650 |
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { |
| 5651 |
|
| 5652 |
"use strict"; |
| 5653 |
__webpack_require__.r(__webpack_exports__); |
| 5654 |
/* harmony export */ __webpack_require__.d(__webpack_exports__, { |
| 5655 |
/* harmony export */ "styled": () => (/* binding */ styled_default) |
| 5656 |
/* harmony export */ }); |
| 5657 |
/* harmony import */ var _emotion_is_prop_valid__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @emotion/is-prop-valid */ "./node_modules/@linaria/react/node_modules/@emotion/is-prop-valid/dist/emotion-is-prop-valid.esm.js"); |
| 5658 |
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! react */ "react"); |
| 5659 |
/* harmony import */ var _linaria_core__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @linaria/core */ "./node_modules/@linaria/react/node_modules/@linaria/core/dist/index.mjs"); |
| 5660 |
// src/styled.ts |
| 5661 |
|
| 5662 |
|
| 5663 |
|
| 5664 |
var isCapital = (ch) => ch.toUpperCase() === ch; |
| 5665 |
var filterKey = (keys) => (key) => keys.indexOf(key) === -1; |
| 5666 |
var omit = (obj, keys) => { |
| 5667 |
const res = {}; |
| 5668 |
Object.keys(obj).filter(filterKey(keys)).forEach((key) => { |
| 5669 |
res[key] = obj[key]; |
| 5670 |
}); |
| 5671 |
return res; |
| 5672 |
}; |
| 5673 |
function filterProps(asIs, props, omitKeys) { |
| 5674 |
const filteredProps = omit(props, omitKeys); |
| 5675 |
if (!asIs) { |
| 5676 |
const interopValidAttr = typeof _emotion_is_prop_valid__WEBPACK_IMPORTED_MODULE_0__["default"] === "function" ? { default: _emotion_is_prop_valid__WEBPACK_IMPORTED_MODULE_0__["default"] } : _emotion_is_prop_valid__WEBPACK_IMPORTED_MODULE_0__["default"]; |
| 5677 |
Object.keys(filteredProps).forEach((key) => { |
| 5678 |
if (!interopValidAttr.default(key)) { |
| 5679 |
delete filteredProps[key]; |
| 5680 |
} |
| 5681 |
}); |
| 5682 |
} |
| 5683 |
return filteredProps; |
| 5684 |
} |
| 5685 |
var warnIfInvalid = (value, componentName) => { |
| 5686 |
if (true) { |
| 5687 |
if (typeof value === "string" || typeof value === "number" && isFinite(value)) { |
| 5688 |
return; |
| 5689 |
} |
| 5690 |
const stringified = typeof value === "object" ? JSON.stringify(value) : String(value); |
| 5691 |
console.warn( |
| 5692 |
`An interpolation evaluated to '${stringified}' in the component '${componentName}', which is probably a mistake. You should explicitly cast or transform the value to a string.` |
| 5693 |
); |
| 5694 |
} |
| 5695 |
}; |
| 5696 |
function styled(tag) { |
| 5697 |
return (options) => { |
| 5698 |
if (true) { |
| 5699 |
if (Array.isArray(options)) { |
| 5700 |
throw new Error( |
| 5701 |
'Using the "styled" tag in runtime is not supported. Make sure you have set up the Babel plugin correctly. See https://github.com/callstack/linaria#setup' |
| 5702 |
); |
| 5703 |
} |
| 5704 |
} |
| 5705 |
const render = (props, ref) => { |
| 5706 |
const { as: component = tag, class: className } = props; |
| 5707 |
const shouldKeepProps = options.propsAsIs === void 0 ? !(typeof component === "string" && component.indexOf("-") === -1 && !isCapital(component[0])) : options.propsAsIs; |
| 5708 |
const filteredProps = filterProps(shouldKeepProps, props, [ |
| 5709 |
"as", |
| 5710 |
"class" |
| 5711 |
]); |
| 5712 |
filteredProps.ref = ref; |
| 5713 |
filteredProps.className = options.atomic ? (0,_linaria_core__WEBPACK_IMPORTED_MODULE_2__.cx)(options.class, filteredProps.className || className) : (0,_linaria_core__WEBPACK_IMPORTED_MODULE_2__.cx)(filteredProps.className || className, options.class); |
| 5714 |
const { vars } = options; |
| 5715 |
if (vars) { |
| 5716 |
const style = {}; |
| 5717 |
for (const name in vars) { |
| 5718 |
const variable = vars[name]; |
| 5719 |
const result = variable[0]; |
| 5720 |
const unit = variable[1] || ""; |
| 5721 |
const value = typeof result === "function" ? result(props) : result; |
| 5722 |
warnIfInvalid(value, options.name); |
| 5723 |
style[`--${name}`] = `${value}${unit}`; |
| 5724 |
} |
| 5725 |
const ownStyle = filteredProps.style || {}; |
| 5726 |
const keys = Object.keys(ownStyle); |
| 5727 |
if (keys.length > 0) { |
| 5728 |
keys.forEach((key) => { |
| 5729 |
style[key] = ownStyle[key]; |
| 5730 |
}); |
| 5731 |
} |
| 5732 |
filteredProps.style = style; |
| 5733 |
} |
| 5734 |
if (tag.__linaria && tag !== component) { |
| 5735 |
filteredProps.as = component; |
| 5736 |
return react__WEBPACK_IMPORTED_MODULE_1__.createElement(tag, filteredProps); |
| 5737 |
} |
| 5738 |
return react__WEBPACK_IMPORTED_MODULE_1__.createElement(component, filteredProps); |
| 5739 |
}; |
| 5740 |
const Result = react__WEBPACK_IMPORTED_MODULE_1__.forwardRef ? react__WEBPACK_IMPORTED_MODULE_1__.forwardRef(render) : (props) => { |
| 5741 |
const rest = omit(props, ["innerRef"]); |
| 5742 |
return render(rest, props.innerRef); |
| 5743 |
}; |
| 5744 |
Result.displayName = options.name; |
| 5745 |
Result.__linaria = { |
| 5746 |
className: options.class, |
| 5747 |
extends: tag |
| 5748 |
}; |
| 5749 |
return Result; |
| 5750 |
}; |
| 5751 |
} |
| 5752 |
var styled_default = true ? new Proxy(styled, { |
| 5753 |
get(o, prop) { |
| 5754 |
return o(prop); |
| 5755 |
} |
| 5756 |
}) : 0; |
| 5757 |
|
| 5758 |
//# sourceMappingURL=index.mjs.map |
| 5759 |
|
| 5760 |
/***/ }), |
| 5761 |
|
| 5762 |
/***/ "./node_modules/@linaria/react/node_modules/@linaria/core/dist/index.mjs": |
| 5763 |
/*!*******************************************************************************!*\ |
| 5764 |
!*** ./node_modules/@linaria/react/node_modules/@linaria/core/dist/index.mjs ***! |
| 5765 |
\*******************************************************************************/ |
| 5766 |
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { |
| 5767 |
|
| 5768 |
"use strict"; |
| 5769 |
__webpack_require__.r(__webpack_exports__); |
| 5770 |
/* harmony export */ __webpack_require__.d(__webpack_exports__, { |
| 5771 |
/* harmony export */ "css": () => (/* binding */ css_default), |
| 5772 |
/* harmony export */ "cx": () => (/* binding */ cx_default) |
| 5773 |
/* harmony export */ }); |
| 5774 |
// src/css.ts |
| 5775 |
var css = () => { |
| 5776 |
throw new Error( |
| 5777 |
'Using the "css" tag in runtime is not supported. Make sure you have set up the Babel plugin correctly.' |
| 5778 |
); |
| 5779 |
}; |
| 5780 |
var css_default = css; |
| 5781 |
|
| 5782 |
// src/cx.ts |
| 5783 |
var cx = function cx2() { |
| 5784 |
const presentClassNames = Array.prototype.slice.call(arguments).filter(Boolean); |
| 5785 |
const atomicClasses = {}; |
| 5786 |
const nonAtomicClasses = []; |
| 5787 |
presentClassNames.forEach((arg) => { |
| 5788 |
const individualClassNames = arg ? arg.split(" ") : []; |
| 5789 |
individualClassNames.forEach((className) => { |
| 5790 |
if (className.startsWith("atm_")) { |
| 5791 |
const [, keyHash] = className.split("_"); |
| 5792 |
atomicClasses[keyHash] = className; |
| 5793 |
} else { |
| 5794 |
nonAtomicClasses.push(className); |
| 5795 |
} |
| 5796 |
}); |
| 5797 |
}); |
| 5798 |
const result = []; |
| 5799 |
for (const keyHash in atomicClasses) { |
| 5800 |
if (Object.prototype.hasOwnProperty.call(atomicClasses, keyHash)) { |
| 5801 |
result.push(atomicClasses[keyHash]); |
| 5802 |
} |
| 5803 |
} |
| 5804 |
result.push(...nonAtomicClasses); |
| 5805 |
return result.join(" "); |
| 5806 |
}; |
| 5807 |
var cx_default = cx; |
| 5808 |
|
| 5809 |
//# sourceMappingURL=index.mjs.map |
| 5810 |
|
| 5811 |
/***/ }) |
| 5812 |
|
| 5813 |
/******/ }); |
| 5814 |
/************************************************************************/ |
| 5815 |
/******/ // The module cache |
| 5816 |
/******/ var __webpack_module_cache__ = {}; |
| 5817 |
/******/ |
| 5818 |
/******/ // The require function |
| 5819 |
/******/ function __webpack_require__(moduleId) { |
| 5820 |
/******/ // Check if module is in cache |
| 5821 |
/******/ var cachedModule = __webpack_module_cache__[moduleId]; |
| 5822 |
/******/ if (cachedModule !== undefined) { |
| 5823 |
/******/ return cachedModule.exports; |
| 5824 |
/******/ } |
| 5825 |
/******/ // Create a new module (and put it into the cache) |
| 5826 |
/******/ var module = __webpack_module_cache__[moduleId] = { |
| 5827 |
/******/ // no module.id needed |
| 5828 |
/******/ // no module.loaded needed |
| 5829 |
/******/ exports: {} |
| 5830 |
/******/ }; |
| 5831 |
/******/ |
| 5832 |
/******/ // Execute the module function |
| 5833 |
/******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__); |
| 5834 |
/******/ |
| 5835 |
/******/ // Return the exports of the module |
| 5836 |
/******/ return module.exports; |
| 5837 |
/******/ } |
| 5838 |
/******/ |
| 5839 |
/************************************************************************/ |
| 5840 |
/******/ /* webpack/runtime/compat get default export */ |
| 5841 |
/******/ (() => { |
| 5842 |
/******/ // getDefaultExport function for compatibility with non-harmony modules |
| 5843 |
/******/ __webpack_require__.n = (module) => { |
| 5844 |
/******/ var getter = module && module.__esModule ? |
| 5845 |
/******/ () => (module['default']) : |
| 5846 |
/******/ () => (module); |
| 5847 |
/******/ __webpack_require__.d(getter, { a: getter }); |
| 5848 |
/******/ return getter; |
| 5849 |
/******/ }; |
| 5850 |
/******/ })(); |
| 5851 |
/******/ |
| 5852 |
/******/ /* webpack/runtime/define property getters */ |
| 5853 |
/******/ (() => { |
| 5854 |
/******/ // define getter functions for harmony exports |
| 5855 |
/******/ __webpack_require__.d = (exports, definition) => { |
| 5856 |
/******/ for(var key in definition) { |
| 5857 |
/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) { |
| 5858 |
/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); |
| 5859 |
/******/ } |
| 5860 |
/******/ } |
| 5861 |
/******/ }; |
| 5862 |
/******/ })(); |
| 5863 |
/******/ |
| 5864 |
/******/ /* webpack/runtime/global */ |
| 5865 |
/******/ (() => { |
| 5866 |
/******/ __webpack_require__.g = (function() { |
| 5867 |
/******/ if (typeof globalThis === 'object') return globalThis; |
| 5868 |
/******/ try { |
| 5869 |
/******/ return this || new Function('return this')(); |
| 5870 |
/******/ } catch (e) { |
| 5871 |
/******/ if (typeof window === 'object') return window; |
| 5872 |
/******/ } |
| 5873 |
/******/ })(); |
| 5874 |
/******/ })(); |
| 5875 |
/******/ |
| 5876 |
/******/ /* webpack/runtime/hasOwnProperty shorthand */ |
| 5877 |
/******/ (() => { |
| 5878 |
/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop)) |
| 5879 |
/******/ })(); |
| 5880 |
/******/ |
| 5881 |
/******/ /* webpack/runtime/make namespace object */ |
| 5882 |
/******/ (() => { |
| 5883 |
/******/ // define __esModule on exports |
| 5884 |
/******/ __webpack_require__.r = (exports) => { |
| 5885 |
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { |
| 5886 |
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); |
| 5887 |
/******/ } |
| 5888 |
/******/ Object.defineProperty(exports, '__esModule', { value: true }); |
| 5889 |
/******/ }; |
| 5890 |
/******/ })(); |
| 5891 |
/******/ |
| 5892 |
/************************************************************************/ |
| 5893 |
var __webpack_exports__ = {}; |
| 5894 |
// This entry need to be wrapped in an IIFE because it need to be in strict mode. |
| 5895 |
(() => { |
| 5896 |
"use strict"; |
| 5897 |
/*!********************************!*\ |
| 5898 |
!*** ./scripts/entries/app.ts ***! |
| 5899 |
\********************************/ |
| 5900 |
__webpack_require__.r(__webpack_exports__); |
| 5901 |
/* harmony import */ var _utils_appUtils__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../utils/appUtils */ "./scripts/utils/appUtils.ts"); |
| 5902 |
/* harmony import */ var _iframe_renderIframeApp__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../iframe/renderIframeApp */ "./scripts/iframe/renderIframeApp.tsx"); |
| 5903 |
|
| 5904 |
|
| 5905 |
(0,_utils_appUtils__WEBPACK_IMPORTED_MODULE_0__.initAppOnReady)(_iframe_renderIframeApp__WEBPACK_IMPORTED_MODULE_1__["default"]); |
| 5906 |
})(); |
| 5907 |
|
| 5908 |
/******/ })() |
| 5909 |
; |
| 5910 |
//# sourceMappingURL=leadin.js.map |