| @@ -1,7 +1,149 @@ | ||
| 1 | 1 | /******/ (() => { // webpackBootstrap |
| 2 | 2 | /******/ var __webpack_modules__ = ({ |
| 3 | 3 | |
| 4 | +/***/ "./scripts/api/wordpressApiClient.ts": | |
| 5 | +/*!*******************************************!*\ | |
| 6 | + !*** ./scripts/api/wordpressApiClient.ts ***! | |
| 7 | + \*******************************************/ | |
| 8 | +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { | |
| 9 | + | |
| 10 | +"use strict"; | |
| 11 | +__webpack_require__.r(__webpack_exports__); | |
| 12 | +/* harmony export */ __webpack_require__.d(__webpack_exports__, { | |
| 13 | +/* harmony export */ "disableInternalTracking": () => (/* binding */ disableInternalTracking), | |
| 14 | +/* harmony export */ "fetchAccessToken": () => (/* binding */ fetchAccessToken), | |
| 15 | +/* harmony export */ "fetchDisableInternalTracking": () => (/* binding */ fetchDisableInternalTracking), | |
| 16 | +/* harmony export */ "fetchProxyMappingsEnabled": () => (/* binding */ fetchProxyMappingsEnabled), | |
| 17 | +/* harmony export */ "getBusinessUnitId": () => (/* binding */ getBusinessUnitId), | |
| 18 | +/* harmony export */ "healthcheckRestApi": () => (/* binding */ healthcheckRestApi), | |
| 19 | +/* harmony export */ "refreshProxyMappingsCache": () => (/* binding */ refreshProxyMappingsCache), | |
| 20 | +/* harmony export */ "setBusinessUnitId": () => (/* binding */ setBusinessUnitId), | |
| 21 | +/* harmony export */ "skipReview": () => (/* binding */ skipReview), | |
| 22 | +/* harmony export */ "toggleProxyMappingsEnabled": () => (/* binding */ toggleProxyMappingsEnabled), | |
| 23 | +/* harmony export */ "trackConsent": () => (/* binding */ trackConsent), | |
| 24 | +/* harmony export */ "updateHublet": () => (/* binding */ updateHublet) | |
| 25 | +/* harmony export */ }); | |
| 26 | +/* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! jquery */ "jquery"); | |
| 27 | +/* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(jquery__WEBPACK_IMPORTED_MODULE_0__); | |
| 28 | +/* harmony import */ var _lib_Raven__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../lib/Raven */ "./scripts/lib/Raven.ts"); | |
| 29 | +/* harmony import */ var _constants_leadinConfig__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../constants/leadinConfig */ "./scripts/constants/leadinConfig.ts"); | |
| 30 | +/* harmony import */ var _utils_queryParams__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../utils/queryParams */ "./scripts/utils/queryParams.ts"); | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | +function makeRequest(method, path) { | |
| 36 | + var data = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; | |
| 37 | + var queryParams = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {}; | |
| 38 | + // eslint-disable-next-line compat/compat | |
| 39 | + var restApiUrl = new URL("".concat(_constants_leadinConfig__WEBPACK_IMPORTED_MODULE_2__.restUrl, "leadin/v1").concat(path)); | |
| 40 | + (0,_utils_queryParams__WEBPACK_IMPORTED_MODULE_3__.addQueryObjectToUrl)(restApiUrl, queryParams); | |
| 41 | + return new Promise(function (resolve, reject) { | |
| 42 | + var payload = { | |
| 43 | + url: restApiUrl.toString(), | |
| 44 | + method: method, | |
| 45 | + contentType: 'application/json', | |
| 46 | + beforeSend: function beforeSend(xhr) { | |
| 47 | + return xhr.setRequestHeader('X-WP-Nonce', _constants_leadinConfig__WEBPACK_IMPORTED_MODULE_2__.restNonce); | |
| 48 | + }, | |
| 49 | + success: resolve, | |
| 50 | + error: function error(response) { | |
| 51 | + _lib_Raven__WEBPACK_IMPORTED_MODULE_1__["default"].captureMessage("HTTP Request to ".concat(restApiUrl, " failed with error ").concat(response.status, ": ").concat(response.responseText), { | |
| 52 | + fingerprint: ['{{ default }}', path, response.status, response.responseText] | |
| 53 | + }); | |
| 54 | + reject(response); | |
| 55 | + } | |
| 56 | + }; | |
| 57 | + if (method !== 'get') { | |
| 58 | + payload.data = JSON.stringify(data); | |
| 59 | + } | |
| 60 | + jquery__WEBPACK_IMPORTED_MODULE_0___default().ajax(payload); | |
| 61 | + }); | |
| 62 | +} | |
| 63 | +function healthcheckRestApi() { | |
| 64 | + return makeRequest('get', '/healthcheck'); | |
| 65 | +} | |
| 66 | +function disableInternalTracking(value) { | |
| 67 | + return makeRequest('put', '/internal-tracking', value ? '1' : '0'); | |
| 68 | +} | |
| 69 | +function fetchDisableInternalTracking() { | |
| 70 | + return makeRequest('get', '/internal-tracking').then(function (message) { | |
| 71 | + return { | |
| 72 | + message: message | |
| 73 | + }; | |
| 74 | + }); | |
| 75 | +} | |
| 76 | +function updateHublet(hublet) { | |
| 77 | + return makeRequest('put', '/hublet', { | |
| 78 | + hublet: hublet | |
| 79 | + }); | |
| 80 | +} | |
| 81 | +function skipReview() { | |
| 82 | + return makeRequest('post', '/skip-review'); | |
| 83 | +} | |
| 84 | +function trackConsent(canTrack) { | |
| 85 | + return makeRequest('post', '/track-consent', { | |
| 86 | + canTrack: canTrack | |
| 87 | + }).then(function (message) { | |
| 88 | + return { | |
| 89 | + message: message | |
| 90 | + }; | |
| 91 | + }); | |
| 92 | +} | |
| 93 | +function setBusinessUnitId(businessUnitId) { | |
| 94 | + return makeRequest('put', '/business-unit', { | |
| 95 | + businessUnitId: businessUnitId | |
| 96 | + }); | |
| 97 | +} | |
| 98 | +function getBusinessUnitId() { | |
| 99 | + return makeRequest('get', '/business-unit'); | |
| 100 | +} | |
| 101 | +function refreshProxyMappingsCache() { | |
| 102 | + return makeRequest('post', '/wp-mappings-cache-reset'); | |
| 103 | +} | |
| 104 | +function fetchProxyMappingsEnabled() { | |
| 105 | + return makeRequest('get', '/wp-mappings-proxy-enabled'); | |
| 106 | +} | |
| 107 | +function toggleProxyMappingsEnabled(value) { | |
| 108 | + return makeRequest('put', '/wp-mappings-proxy-enabled', value); | |
| 109 | +} | |
| 110 | +var ACCESS_TOKEN_CACHE_KEY = 'leadin_access_token'; | |
| 111 | +var ACCESS_TOKEN_MIN_TTL_SECONDS = 300; | |
| 112 | +var accessTokenRequest = null; | |
| 113 | +function fetchAccessToken() { | |
| 114 | + try { | |
| 115 | + var cached = sessionStorage.getItem(ACCESS_TOKEN_CACHE_KEY); | |
| 116 | + if (cached) { | |
| 117 | + var _JSON$parse = JSON.parse(cached), | |
| 118 | + accessToken = _JSON$parse.accessToken, | |
| 119 | + expiresAt = _JSON$parse.expiresAt; | |
| 120 | + if (accessToken && expiresAt > Math.floor(Date.now() / 1000) + ACCESS_TOKEN_MIN_TTL_SECONDS) { | |
| 121 | + return Promise.resolve({ | |
| 122 | + accessToken: accessToken, | |
| 123 | + expiresIn: expiresAt - Math.floor(Date.now() / 1000) | |
| 124 | + }); | |
| 125 | + } | |
| 126 | + } | |
| 127 | + } catch (_) {} | |
| 128 | + if (!accessTokenRequest) { | |
| 129 | + accessTokenRequest = makeRequest('get', '/access-token').then(function (response) { | |
| 130 | + try { | |
| 131 | + sessionStorage.setItem(ACCESS_TOKEN_CACHE_KEY, JSON.stringify({ | |
| 132 | + accessToken: response.accessToken, | |
| 133 | + expiresAt: Math.floor(Date.now() / 1000) + response.expiresIn | |
| 134 | + })); | |
| 135 | + } catch (_) {} | |
| 136 | + return response; | |
| 137 | + })["finally"](function () { | |
| 138 | + accessTokenRequest = null; | |
| 139 | + }); | |
| 140 | + } | |
| 141 | + return accessTokenRequest; | |
| 142 | +} | |
| 143 | + | |
| 144 | +/***/ }), | |
| 145 | + | |
| 4 | 146 | /***/ "./scripts/constants/leadinConfig.ts": |
| 5 | 147 | /*!*******************************************!*\ |
| 6 | 148 | !*** ./scripts/constants/leadinConfig.ts ***! |
| 7 | 149 | \*******************************************/ |
| @@ -14,8 +156,9 @@ | ||
| 14 | 156 | /* harmony export */ "activationTime": () => (/* binding */ activationTime), |
| 15 | 157 | /* harmony export */ "adminUrl": () => (/* binding */ adminUrl), |
| 16 | 158 | /* harmony export */ "connectionStatus": () => (/* binding */ connectionStatus), |
| 17 | 159 | /* harmony export */ "contentEmbed": () => (/* binding */ contentEmbed), |
| 160 | +/* harmony export */ "decryptError": () => (/* binding */ decryptError), | |
| 18 | 161 | /* harmony export */ "deviceId": () => (/* binding */ deviceId), |
| 19 | 162 | /* harmony export */ "didDisconnect": () => (/* binding */ didDisconnect), |
| 20 | 163 | /* harmony export */ "env": () => (/* binding */ env), |
| 21 | 164 | /* harmony export */ "formsScript": () => (/* binding */ formsScript), |
| @@ -40,9 +183,8 @@ | ||
| 40 | 183 | /* harmony export */ "portalEmail": () => (/* binding */ portalEmail), |
| 41 | 184 | /* harmony export */ "portalId": () => (/* binding */ portalId), |
| 42 | 185 | /* harmony export */ "redirectNonce": () => (/* binding */ redirectNonce), |
| 43 | 186 | /* harmony export */ "refreshToken": () => (/* binding */ refreshToken), |
| 44 | -/* harmony export */ "refreshTokenError": () => (/* binding */ refreshTokenError), | |
| 45 | 187 | /* harmony export */ "requiresContentEmbedScope": () => (/* binding */ requiresContentEmbedScope), |
| 46 | 188 | /* harmony export */ "restNonce": () => (/* binding */ restNonce), |
| 47 | 189 | /* harmony export */ "restUrl": () => (/* binding */ restUrl), |
| 48 | 190 | /* harmony export */ "reviewSkippedDate": () => (/* binding */ reviewSkippedDate), |
| @@ -50,47 +192,47 @@ | ||
| 50 | 192 | /* harmony export */ "trackConsent": () => (/* binding */ trackConsent), |
| 51 | 193 | /* harmony export */ "wpVersion": () => (/* binding */ wpVersion) |
| 52 | 194 | /* harmony export */ }); |
| 53 | 195 | var _window$leadinConfig = window.leadinConfig, |
| 54 | - accountName = _window$leadinConfig.accountName, | |
| 55 | - adminUrl = _window$leadinConfig.adminUrl, | |
| 56 | - activationTime = _window$leadinConfig.activationTime, | |
| 57 | - connectionStatus = _window$leadinConfig.connectionStatus, | |
| 58 | - deviceId = _window$leadinConfig.deviceId, | |
| 59 | - didDisconnect = _window$leadinConfig.didDisconnect, | |
| 60 | - env = _window$leadinConfig.env, | |
| 61 | - formsScript = _window$leadinConfig.formsScript, | |
| 62 | - meetingsScript = _window$leadinConfig.meetingsScript, | |
| 63 | - formsScriptPayload = _window$leadinConfig.formsScriptPayload, | |
| 64 | - hublet = _window$leadinConfig.hublet, | |
| 65 | - hubspotBaseUrl = _window$leadinConfig.hubspotBaseUrl, | |
| 66 | - hubspotNonce = _window$leadinConfig.hubspotNonce, | |
| 67 | - iframeUrl = _window$leadinConfig.iframeUrl, | |
| 68 | - impactLink = _window$leadinConfig.impactLink, | |
| 69 | - lastAuthorizeTime = _window$leadinConfig.lastAuthorizeTime, | |
| 70 | - lastDeauthorizeTime = _window$leadinConfig.lastDeauthorizeTime, | |
| 71 | - lastDisconnectTime = _window$leadinConfig.lastDisconnectTime, | |
| 72 | - leadinPluginVersion = _window$leadinConfig.leadinPluginVersion, | |
| 73 | - leadinQueryParams = _window$leadinConfig.leadinQueryParams, | |
| 74 | - locale = _window$leadinConfig.locale, | |
| 75 | - loginUrl = _window$leadinConfig.loginUrl, | |
| 76 | - phpVersion = _window$leadinConfig.phpVersion, | |
| 77 | - pluginPath = _window$leadinConfig.pluginPath, | |
| 78 | - plugins = _window$leadinConfig.plugins, | |
| 79 | - portalDomain = _window$leadinConfig.portalDomain, | |
| 80 | - portalEmail = _window$leadinConfig.portalEmail, | |
| 81 | - portalId = _window$leadinConfig.portalId, | |
| 82 | - redirectNonce = _window$leadinConfig.redirectNonce, | |
| 83 | - restNonce = _window$leadinConfig.restNonce, | |
| 84 | - restUrl = _window$leadinConfig.restUrl, | |
| 85 | - refreshToken = _window$leadinConfig.refreshToken, | |
| 86 | - reviewSkippedDate = _window$leadinConfig.reviewSkippedDate, | |
| 87 | - theme = _window$leadinConfig.theme, | |
| 88 | - trackConsent = _window$leadinConfig.trackConsent, | |
| 89 | - wpVersion = _window$leadinConfig.wpVersion, | |
| 90 | - contentEmbed = _window$leadinConfig.contentEmbed, | |
| 91 | - requiresContentEmbedScope = _window$leadinConfig.requiresContentEmbedScope, | |
| 92 | - refreshTokenError = _window$leadinConfig.refreshTokenError; | |
| 196 | + accountName = _window$leadinConfig.accountName, | |
| 197 | + adminUrl = _window$leadinConfig.adminUrl, | |
| 198 | + activationTime = _window$leadinConfig.activationTime, | |
| 199 | + connectionStatus = _window$leadinConfig.connectionStatus, | |
| 200 | + deviceId = _window$leadinConfig.deviceId, | |
| 201 | + didDisconnect = _window$leadinConfig.didDisconnect, | |
| 202 | + env = _window$leadinConfig.env, | |
| 203 | + formsScript = _window$leadinConfig.formsScript, | |
| 204 | + meetingsScript = _window$leadinConfig.meetingsScript, | |
| 205 | + formsScriptPayload = _window$leadinConfig.formsScriptPayload, | |
| 206 | + hublet = _window$leadinConfig.hublet, | |
| 207 | + hubspotBaseUrl = _window$leadinConfig.hubspotBaseUrl, | |
| 208 | + hubspotNonce = _window$leadinConfig.hubspotNonce, | |
| 209 | + iframeUrl = _window$leadinConfig.iframeUrl, | |
| 210 | + impactLink = _window$leadinConfig.impactLink, | |
| 211 | + lastAuthorizeTime = _window$leadinConfig.lastAuthorizeTime, | |
| 212 | + lastDeauthorizeTime = _window$leadinConfig.lastDeauthorizeTime, | |
| 213 | + lastDisconnectTime = _window$leadinConfig.lastDisconnectTime, | |
| 214 | + leadinPluginVersion = _window$leadinConfig.leadinPluginVersion, | |
| 215 | + leadinQueryParams = _window$leadinConfig.leadinQueryParams, | |
| 216 | + locale = _window$leadinConfig.locale, | |
| 217 | + loginUrl = _window$leadinConfig.loginUrl, | |
| 218 | + phpVersion = _window$leadinConfig.phpVersion, | |
| 219 | + pluginPath = _window$leadinConfig.pluginPath, | |
| 220 | + plugins = _window$leadinConfig.plugins, | |
| 221 | + portalDomain = _window$leadinConfig.portalDomain, | |
| 222 | + portalEmail = _window$leadinConfig.portalEmail, | |
| 223 | + portalId = _window$leadinConfig.portalId, | |
| 224 | + redirectNonce = _window$leadinConfig.redirectNonce, | |
| 225 | + restNonce = _window$leadinConfig.restNonce, | |
| 226 | + restUrl = _window$leadinConfig.restUrl, | |
| 227 | + refreshToken = _window$leadinConfig.refreshToken, | |
| 228 | + reviewSkippedDate = _window$leadinConfig.reviewSkippedDate, | |
| 229 | + theme = _window$leadinConfig.theme, | |
| 230 | + trackConsent = _window$leadinConfig.trackConsent, | |
| 231 | + wpVersion = _window$leadinConfig.wpVersion, | |
| 232 | + contentEmbed = _window$leadinConfig.contentEmbed, | |
| 233 | + requiresContentEmbedScope = _window$leadinConfig.requiresContentEmbedScope, | |
| 234 | + decryptError = _window$leadinConfig.decryptError; | |
| 93 | 235 | |
| 94 | 236 | |
| 95 | 237 | /***/ }), |
| 96 | 238 | |
| @@ -140,31 +282,24 @@ | ||
| 140 | 282 | /* harmony export */ }); |
| 141 | 283 | /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! jquery */ "jquery"); |
| 142 | 284 | /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(jquery__WEBPACK_IMPORTED_MODULE_0__); |
| 143 | 285 | /* harmony import */ var _constants_selectors__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../constants/selectors */ "./scripts/constants/selectors.ts"); |
| 144 | -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | |
| 286 | +function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); } | |
| 287 | +function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); } | |
| 288 | +function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } } | |
| 289 | +function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; } | |
| 290 | +function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; } | |
| 291 | +function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; } | |
| 292 | +function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); } | |
| 145 | 293 | |
| 146 | -function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } | |
| 147 | 294 | |
| 148 | -function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } | |
| 149 | - | |
| 150 | -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; } | |
| 151 | - | |
| 152 | - | |
| 153 | - | |
| 154 | - | |
| 155 | 295 | var ThickBoxModal = /*#__PURE__*/function () { |
| 156 | 296 | function ThickBoxModal(openTriggerSelector, inlineContentId, windowCssClass, contentCssClass) { |
| 157 | 297 | _classCallCheck(this, ThickBoxModal); |
| 158 | - | |
| 159 | 298 | _defineProperty(this, "openTriggerSelector", void 0); |
| 160 | - | |
| 161 | 299 | _defineProperty(this, "inlineContentId", void 0); |
| 162 | - | |
| 163 | 300 | _defineProperty(this, "windowCssClass", void 0); |
| 164 | - | |
| 165 | 301 | _defineProperty(this, "contentCssClass", void 0); |
| 166 | - | |
| 167 | 302 | this.openTriggerSelector = openTriggerSelector; |
| 168 | 303 | this.inlineContentId = inlineContentId; |
| 169 | 304 | this.windowCssClass = windowCssClass; |
| 170 | 305 | this.contentCssClass = contentCssClass; |
| @@ -169,10 +304,9 @@ | ||
| 169 | 304 | this.windowCssClass = windowCssClass; |
| 170 | 305 | this.contentCssClass = contentCssClass; |
| 171 | 306 | jquery__WEBPACK_IMPORTED_MODULE_0___default()(openTriggerSelector).on('click', this.init.bind(this)); |
| 172 | 307 | } |
| 173 | - | |
| 174 | - _createClass(ThickBoxModal, [{ | |
| 308 | + return _createClass(ThickBoxModal, [{ | |
| 175 | 309 | key: "close", |
| 176 | 310 | value: function close() { |
| 177 | 311 | //@ts-expect-error global |
| 178 | 312 | window.tb_remove(); |
| @@ -180,26 +314,23 @@ | ||
| 180 | 314 | }, { |
| 181 | 315 | key: "init", |
| 182 | 316 | value: function init(e) { |
| 183 | 317 | //@ts-expect-error global |
| 184 | - window.tb_show('', "#TB_inline?inlineId=".concat(this.inlineContentId, "&modal=true")); // thickbox doesn't respect the width and height url parameters https://core.trac.wordpress.org/ticket/17249 | |
| 318 | + window.tb_show('', "#TB_inline?inlineId=".concat(this.inlineContentId, "&modal=true")); | |
| 319 | + // thickbox doesn't respect the width and height url parameters https://core.trac.wordpress.org/ticket/17249 | |
| 185 | 320 | // We override thickboxes css with !important in the css |
| 186 | - | |
| 187 | - jquery__WEBPACK_IMPORTED_MODULE_0___default()(_constants_selectors__WEBPACK_IMPORTED_MODULE_1__.domElements.thickboxModalWindow).addClass(this.windowCssClass); // have to modify the css of the thickbox content container as well | |
| 188 | - | |
| 189 | - jquery__WEBPACK_IMPORTED_MODULE_0___default()(_constants_selectors__WEBPACK_IMPORTED_MODULE_1__.domElements.thickboxModalContent).addClass(this.contentCssClass); // we unbind previous handlers because a thickbox modal is a single global object. | |
| 321 | + jquery__WEBPACK_IMPORTED_MODULE_0___default()(_constants_selectors__WEBPACK_IMPORTED_MODULE_1__.domElements.thickboxModalWindow).addClass(this.windowCssClass); | |
| 322 | + // have to modify the css of the thickbox content container as well | |
| 323 | + jquery__WEBPACK_IMPORTED_MODULE_0___default()(_constants_selectors__WEBPACK_IMPORTED_MODULE_1__.domElements.thickboxModalContent).addClass(this.contentCssClass); | |
| 324 | + // we unbind previous handlers because a thickbox modal is a single global object. | |
| 190 | 325 | // Everytime it is re-opened, it still has old handlers bound |
| 191 | - | |
| 192 | 326 | jquery__WEBPACK_IMPORTED_MODULE_0___default()(_constants_selectors__WEBPACK_IMPORTED_MODULE_1__.domElements.thickboxModalClose).off('click').on('click', this.close); |
| 193 | 327 | e.preventDefault(); |
| 194 | 328 | } |
| 195 | 329 | }]); |
| 196 | - | |
| 197 | - return ThickBoxModal; | |
| 198 | 330 | }(); |
| 199 | 331 | |
| 200 | 332 | |
| 201 | - | |
| 202 | 333 | /***/ }), |
| 203 | 334 | |
| 204 | 335 | /***/ "./scripts/feedback/feedbackFormApi.ts": |
| 205 | 336 | /*!*********************************************!*\ |
| @@ -355,9 +486,17 @@ | ||
| 355 | 486 | ContentEmbedInstallResponse: 'CONTENT_EMBED_INSTALL_RESPONSE', |
| 356 | 487 | ContentEmbedInstallError: 'CONTENT_EMBED_INSTALL_ERROR', |
| 357 | 488 | ContentEmbedActivationRequest: 'CONTENT_EMBED_ACTIVATION_REQUEST', |
| 358 | 489 | ContentEmbedActivationResponse: 'CONTENT_EMBED_ACTIVATION_RESPONSE', |
| 359 | - ContentEmbedActivationError: 'CONTENT_EMBED_ACTIVATION_ERROR' | |
| 490 | + ContentEmbedActivationError: 'CONTENT_EMBED_ACTIVATION_ERROR', | |
| 491 | + ProxyMappingsEnabledRequest: 'PROXY_MAPPINGS_ENABLED_REQUEST', | |
| 492 | + ProxyMappingsEnabledResponse: 'PROXY_MAPPINGS_ENABLED_RESPONSE', | |
| 493 | + ProxyMappingsEnabledError: 'PROXY_MAPPINGS_ENABLED_ERROR', | |
| 494 | + ProxyMappingsEnabledChangeRequest: 'PROXY_MAPPINGS_ENABLED_CHANGE_REQUEST', | |
| 495 | + ProxyMappingsEnabledChangeError: 'PROXY_MAPPINGS_ENABLED_CHANGE_ERROR', | |
| 496 | + RefreshProxyMappingsRequest: 'REFRESH_PROXY_MAPPINGS_REQUEST', | |
| 497 | + RefreshProxyMappingsResponse: 'REFRESH_PROXY_MAPPINGS_RESPONSE', | |
| 498 | + RefreshProxyMappingsError: 'REFRESH_PROXY_MAPPINGS_ERROR' | |
| 360 | 499 | }; |
| 361 | 500 | |
| 362 | 501 | /***/ }), |
| 363 | 502 | |
| @@ -375,8 +514,9 @@ | ||
| 375 | 514 | var ProxyMessages = { |
| 376 | 515 | FetchForms: 'FETCH_FORMS', |
| 377 | 516 | FetchForm: 'FETCH_FORM', |
| 378 | 517 | CreateFormFromTemplate: 'CREATE_FORM_FROM_TEMPLATE', |
| 518 | + GetTemplateAvailability: 'GET_TEMPLATE_AVAILABILITY', | |
| 379 | 519 | FetchAuth: 'FETCH_AUTH', |
| 380 | 520 | FetchMeetingsAndUsers: 'FETCH_MEETINGS_AND_USERS', |
| 381 | 521 | FetchContactsCreateSinceActivation: 'FETCH_CONTACTS_CREATED_SINCE_ACTIVATION', |
| 382 | 522 | FetchOrCreateMeetingUser: 'FETCH_OR_CREATE_MEETING_USER', |
| @@ -411,16 +551,19 @@ | ||
| 411 | 551 | /* harmony import */ var _constants_leadinConfig__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../constants/leadinConfig */ "./scripts/constants/leadinConfig.ts"); |
| 412 | 552 | |
| 413 | 553 | |
| 414 | 554 | function configureRaven() { |
| 415 | - if (_constants_leadinConfig__WEBPACK_IMPORTED_MODULE_1__.hubspotBaseUrl.indexOf('app.hubspot.com') === -1) { | |
| 555 | + if (_constants_leadinConfig__WEBPACK_IMPORTED_MODULE_1__.hubspotBaseUrl.indexOf('local') !== -1) { | |
| 416 | 556 | return; |
| 417 | 557 | } |
| 418 | - | |
| 419 | - raven_js__WEBPACK_IMPORTED_MODULE_0___default().config('https://e9b8f382cdd130c0d415cd977d2be56f@exceptions.hubspot.com/1', { | |
| 558 | + var domain = _constants_leadinConfig__WEBPACK_IMPORTED_MODULE_1__.hubspotBaseUrl.replace(/https?:\/\/app/, ''); | |
| 559 | + raven_js__WEBPACK_IMPORTED_MODULE_0___default().config("https://a9f08e536ef66abb0bf90becc905b09e@exceptions".concat(domain, "/v2/1"), { | |
| 420 | 560 | instrument: { |
| 421 | 561 | tryCatch: false |
| 422 | 562 | }, |
| 563 | + shouldSendCallback: function shouldSendCallback(data) { | |
| 564 | + return !!data && !!data.culprit && /plugins\/leadin\//.test(data.culprit); | |
| 565 | + }, | |
| 423 | 566 | release: _constants_leadinConfig__WEBPACK_IMPORTED_MODULE_1__.leadinPluginVersion |
| 424 | 567 | }).install(); |
| 425 | 568 | raven_js__WEBPACK_IMPORTED_MODULE_0___default().setTagsContext({ |
| 426 | 569 | v: _constants_leadinConfig__WEBPACK_IMPORTED_MODULE_1__.leadinPluginVersion, |
| @@ -462,9 +605,8 @@ | ||
| 462 | 605 | function initAppOnReady(initFn) { |
| 463 | 606 | function main() { |
| 464 | 607 | jquery__WEBPACK_IMPORTED_MODULE_0___default()(initFn); |
| 465 | 608 | } |
| 466 | - | |
| 467 | 609 | initApp(main); |
| 468 | 610 | } |
| 469 | 611 | |
| 470 | 612 | /***/ }), |
| @@ -482,10 +624,14 @@ | ||
| 482 | 624 | /* harmony export */ "initBackgroundApp": () => (/* binding */ initBackgroundApp) |
| 483 | 625 | /* harmony export */ }); |
| 484 | 626 | /* harmony import */ var _constants_leadinConfig__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../constants/leadinConfig */ "./scripts/constants/leadinConfig.ts"); |
| 485 | 627 | /* harmony import */ var _appUtils__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./appUtils */ "./scripts/utils/appUtils.ts"); |
| 628 | +/* harmony import */ var _api_wordpressApiClient__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../api/wordpressApiClient */ "./scripts/api/wordpressApiClient.ts"); | |
| 629 | +/* harmony import */ var _embedderReady__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./embedderReady */ "./scripts/utils/embedderReady.ts"); | |
| 486 | 630 | |
| 487 | 631 | |
| 632 | + | |
| 633 | + | |
| 488 | 634 | function initBackgroundApp(initFn) { |
| 489 | 635 | function main() { |
| 490 | 636 | if (Array.isArray(initFn)) { |
| 491 | 637 | initFn.forEach(function (callback) { |
| @@ -494,24 +640,32 @@ | ||
| 494 | 640 | } else { |
| 495 | 641 | initFn(); |
| 496 | 642 | } |
| 497 | 643 | } |
| 498 | - | |
| 499 | 644 | (0,_appUtils__WEBPACK_IMPORTED_MODULE_1__.initApp)(main); |
| 500 | 645 | } |
| 501 | -var getOrCreateBackgroundApp = function getOrCreateBackgroundApp(refreshToken) { | |
| 646 | +var getLeadinConfig = function getLeadinConfig() { | |
| 647 | + return { | |
| 648 | + leadinPluginVersion: _constants_leadinConfig__WEBPACK_IMPORTED_MODULE_0__.leadinPluginVersion | |
| 649 | + }; | |
| 650 | +}; | |
| 651 | +var getOrCreateBackgroundApp = function getOrCreateBackgroundApp() { | |
| 652 | + var accessToken = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : ''; | |
| 653 | + var expiresIn = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0; | |
| 502 | 654 | if (window.LeadinBackgroundApp) { |
| 503 | 655 | return window.LeadinBackgroundApp; |
| 504 | 656 | } |
| 505 | - | |
| 657 | + if (!(0,_embedderReady__WEBPACK_IMPORTED_MODULE_3__.isEmbedderReady)()) { | |
| 658 | + return null; | |
| 659 | + } | |
| 506 | 660 | var _window = window, |
| 507 | - IntegratedAppEmbedder = _window.IntegratedAppEmbedder, | |
| 508 | - IntegratedAppOptions = _window.IntegratedAppOptions; | |
| 509 | - var options = new IntegratedAppOptions().setLocale(_constants_leadinConfig__WEBPACK_IMPORTED_MODULE_0__.locale).setDeviceId(_constants_leadinConfig__WEBPACK_IMPORTED_MODULE_0__.deviceId).setRefreshToken(refreshToken); | |
| 661 | + IntegratedAppEmbedder = _window.IntegratedAppEmbedder, | |
| 662 | + IntegratedAppOptions = _window.IntegratedAppOptions; | |
| 663 | + var options = new IntegratedAppOptions().setLocale(_constants_leadinConfig__WEBPACK_IMPORTED_MODULE_0__.locale).setDeviceId(_constants_leadinConfig__WEBPACK_IMPORTED_MODULE_0__.deviceId).setLeadinConfig(getLeadinConfig()).setAccessToken(accessToken, expiresIn); | |
| 510 | 664 | var embedder = new IntegratedAppEmbedder('integrated-plugin-proxy', _constants_leadinConfig__WEBPACK_IMPORTED_MODULE_0__.portalId, _constants_leadinConfig__WEBPACK_IMPORTED_MODULE_0__.hubspotBaseUrl, function () {}).setOptions(options); |
| 511 | 665 | embedder.attachTo(document.body, false); |
| 512 | - embedder.postStartAppMessage(); // lets the app know all all data has been passed to it | |
| 513 | - | |
| 666 | + embedder.setTokenRenewalCallback(_api_wordpressApiClient__WEBPACK_IMPORTED_MODULE_2__.fetchAccessToken); | |
| 667 | + embedder.postStartAppMessage(); // lets the app know all data has been passed to it | |
| 514 | 668 | window.LeadinBackgroundApp = embedder; |
| 515 | 669 | return window.LeadinBackgroundApp; |
| 516 | 670 | }; |
| 517 | 671 | |
| @@ -516,8 +670,139 @@ | ||
| 516 | 670 | }; |
| 517 | 671 | |
| 518 | 672 | /***/ }), |
| 519 | 673 | |
| 674 | +/***/ "./scripts/utils/embedderReady.ts": | |
| 675 | +/*!****************************************!*\ | |
| 676 | + !*** ./scripts/utils/embedderReady.ts ***! | |
| 677 | + \****************************************/ | |
| 678 | +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { | |
| 679 | + | |
| 680 | +"use strict"; | |
| 681 | +__webpack_require__.r(__webpack_exports__); | |
| 682 | +/* harmony export */ __webpack_require__.d(__webpack_exports__, { | |
| 683 | +/* harmony export */ "isEmbedderReady": () => (/* binding */ isEmbedderReady), | |
| 684 | +/* harmony export */ "reportEmbedderUnavailable": () => (/* binding */ reportEmbedderUnavailable), | |
| 685 | +/* harmony export */ "whenEmbedderReady": () => (/* binding */ whenEmbedderReady) | |
| 686 | +/* harmony export */ }); | |
| 687 | +/* harmony import */ var _lib_Raven__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../lib/Raven */ "./scripts/lib/Raven.ts"); | |
| 688 | +function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; } | |
| 689 | +function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; } | |
| 690 | +function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; } | |
| 691 | +function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; } | |
| 692 | +function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); } | |
| 693 | +function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); } | |
| 694 | + | |
| 695 | +var POLL_INTERVAL_MS = 250; | |
| 696 | +var DEFAULT_TIMEOUT_MS = 15000; | |
| 697 | +var EMBEDDER_SCRIPT_SELECTOR = 'script[src*="/integrated-app-embedder/"]'; | |
| 698 | +function isEmbedderReady() { | |
| 699 | + var _window = window, | |
| 700 | + IntegratedAppEmbedder = _window.IntegratedAppEmbedder, | |
| 701 | + IntegratedAppOptions = _window.IntegratedAppOptions; | |
| 702 | + return !!IntegratedAppEmbedder && typeof IntegratedAppOptions === 'function'; | |
| 703 | +} | |
| 704 | +function getEmbedderDiagnostics() { | |
| 705 | + var scriptTag = document.querySelector(EMBEDDER_SCRIPT_SELECTOR); | |
| 706 | + return { | |
| 707 | + hasScriptTag: !!scriptTag, | |
| 708 | + scriptSrc: scriptTag ? scriptTag.src : null, | |
| 709 | + readyState: document.readyState, | |
| 710 | + hasEmbedder: !!window.IntegratedAppEmbedder, | |
| 711 | + typeofOptions: _typeof(window.IntegratedAppOptions) | |
| 712 | + }; | |
| 713 | +} | |
| 714 | +/** | |
| 715 | + * The embedder script is a cross-origin script from js.hubspot.com, and nothing | |
| 716 | + * makes the widgets wait for it: they read its globals off `window` the moment a | |
| 717 | + * control renders. On sites where an asset pipeline defers it, or where the | |
| 718 | + * editor is simply slow, the widget can lose that race and fail permanently even | |
| 719 | + * though the script arrives seconds later. | |
| 720 | + * | |
| 721 | + * Resolves true as soon as the globals appear, or false once the wait is up. | |
| 722 | + */ | |
| 723 | +function whenEmbedderReady() { | |
| 724 | + var timeoutMs = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : DEFAULT_TIMEOUT_MS; | |
| 725 | + var intervalId; | |
| 726 | + var cancel = function cancel() { | |
| 727 | + if (intervalId !== undefined) { | |
| 728 | + window.clearInterval(intervalId); | |
| 729 | + intervalId = undefined; | |
| 730 | + } | |
| 731 | + }; | |
| 732 | + var promise = new Promise(function (resolve) { | |
| 733 | + if (isEmbedderReady()) { | |
| 734 | + console.info('HubSpot plugin - embedder ready immediately'); | |
| 735 | + resolve(true); | |
| 736 | + return; | |
| 737 | + } | |
| 738 | + var startedAt = Date.now(); | |
| 739 | + console.info("HubSpot plugin - waiting up to ".concat(timeoutMs, "ms for embedder script"), getEmbedderDiagnostics()); | |
| 740 | + intervalId = window.setInterval(function () { | |
| 741 | + var waitedMs = Date.now() - startedAt; | |
| 742 | + if (isEmbedderReady()) { | |
| 743 | + cancel(); | |
| 744 | + console.info("HubSpot plugin - embedder ready after ".concat(waitedMs, "ms")); | |
| 745 | + resolve(true); | |
| 746 | + } else if (waitedMs >= timeoutMs) { | |
| 747 | + cancel(); | |
| 748 | + resolve(false); | |
| 749 | + } | |
| 750 | + }, POLL_INTERVAL_MS); | |
| 751 | + }); | |
| 752 | + return { | |
| 753 | + promise: promise, | |
| 754 | + cancel: cancel | |
| 755 | + }; | |
| 756 | +} | |
| 757 | +/** | |
| 758 | + * Reports a give-up so these failures stop being invisible. Until now the widget | |
| 759 | + * rendered its error box without telling anyone, so the only signal we had for | |
| 760 | + * this whole class of problem came from unrelated admin pages. | |
| 761 | + * | |
| 762 | + * Uses captureException rather than captureMessage on purpose: Raven is | |
| 763 | + * configured with a shouldSendCallback that drops any event whose culprit does | |
| 764 | + * not match plugins/leadin/, and captureMessage does not attach a stack trace, | |
| 765 | + * so it has no culprit to match on. | |
| 766 | + */ | |
| 767 | +function reportEmbedderUnavailable(waitedMs) { | |
| 768 | + var diagnostics = getEmbedderDiagnostics(); | |
| 769 | + console.error("HubSpot plugin - embedder unavailable after ".concat(waitedMs, "ms"), diagnostics); | |
| 770 | + _lib_Raven__WEBPACK_IMPORTED_MODULE_0__["default"].captureException(new Error('Leadin embedder unavailable'), { | |
| 771 | + fingerprint: ['EMBEDDER_UNAVAILABLE'], | |
| 772 | + extra: _objectSpread({ | |
| 773 | + waitedMs: waitedMs | |
| 774 | + }, diagnostics) | |
| 775 | + }); | |
| 776 | +} | |
| 777 | + | |
| 778 | +/***/ }), | |
| 779 | + | |
| 780 | +/***/ "./scripts/utils/queryParams.ts": | |
| 781 | +/*!**************************************!*\ | |
| 782 | + !*** ./scripts/utils/queryParams.ts ***! | |
| 783 | + \**************************************/ | |
| 784 | +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { | |
| 785 | + | |
| 786 | +"use strict"; | |
| 787 | +__webpack_require__.r(__webpack_exports__); | |
| 788 | +/* harmony export */ __webpack_require__.d(__webpack_exports__, { | |
| 789 | +/* harmony export */ "addQueryObjectToUrl": () => (/* binding */ addQueryObjectToUrl), | |
| 790 | +/* harmony export */ "removeQueryParamFromLocation": () => (/* binding */ removeQueryParamFromLocation) | |
| 791 | +/* harmony export */ }); | |
| 792 | +function addQueryObjectToUrl(urlObject, queryParams) { | |
| 793 | + Object.keys(queryParams).forEach(function (key) { | |
| 794 | + urlObject.searchParams.append(key, queryParams[key]); | |
| 795 | + }); | |
| 796 | +} | |
| 797 | +function removeQueryParamFromLocation(key) { | |
| 798 | + var location = new URL(window.location.href); | |
| 799 | + location.searchParams["delete"](key); | |
| 800 | + window.history.replaceState(null, '', location.href); | |
| 801 | +} | |
| 802 | + | |
| 803 | +/***/ }), | |
| 804 | + | |
| 520 | 805 | /***/ "./node_modules/raven-js/src/configError.js": |
| 521 | 806 | /*!**************************************************!*\ |
| 522 | 807 | !*** ./node_modules/raven-js/src/configError.js ***! |
| 523 | 808 | \**************************************************/ |
| @@ -3778,10 +4063,9 @@ | ||
| 3778 | 4063 | /* harmony import */ var _constants_selectors__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../constants/selectors */ "./scripts/constants/selectors.ts"); |
| 3779 | 4064 | /* harmony import */ var _feedback_ThickBoxModal__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../feedback/ThickBoxModal */ "./scripts/feedback/ThickBoxModal.ts"); |
| 3780 | 4065 | /* harmony import */ var _feedback_feedbackFormApi__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../feedback/feedbackFormApi */ "./scripts/feedback/feedbackFormApi.ts"); |
| 3781 | 4066 | /* harmony import */ var _utils_backgroundAppUtils__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../utils/backgroundAppUtils */ "./scripts/utils/backgroundAppUtils.ts"); |
| 3782 | -/* harmony import */ var _constants_leadinConfig__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../constants/leadinConfig */ "./scripts/constants/leadinConfig.ts"); | |
| 3783 | -/* harmony import */ var _iframe_integratedMessages__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../iframe/integratedMessages */ "./scripts/iframe/integratedMessages/index.ts"); | |
| 4067 | +/* harmony import */ var _iframe_integratedMessages__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../iframe/integratedMessages */ "./scripts/iframe/integratedMessages/index.ts"); | |
| 3784 | 4068 | |
| 3785 | 4069 | |
| 3786 | 4070 | |
| 3787 | 4071 | |
| @@ -3787,22 +4071,18 @@ | ||
| 3787 | 4071 | |
| 3788 | 4072 | |
| 3789 | 4073 | |
| 3790 | 4074 | |
| 3791 | - | |
| 3792 | - | |
| 4075 | +var embedder; | |
| 3793 | 4076 | function deactivatePlugin() { |
| 3794 | 4077 | var href = jquery__WEBPACK_IMPORTED_MODULE_0___default()(_constants_selectors__WEBPACK_IMPORTED_MODULE_2__.domElements.deactivatePluginButton).attr('href'); |
| 3795 | - | |
| 3796 | 4078 | if (href) { |
| 3797 | 4079 | window.location.href = href; |
| 3798 | 4080 | } |
| 3799 | 4081 | } |
| 3800 | - | |
| 3801 | 4082 | function setLoadingState() { |
| 3802 | 4083 | jquery__WEBPACK_IMPORTED_MODULE_0___default()(_constants_selectors__WEBPACK_IMPORTED_MODULE_2__.domElements.deactivateFeedbackSubmit).addClass('loading'); |
| 3803 | 4084 | } |
| 3804 | - | |
| 3805 | 4085 | function submitAndDeactivate(e) { |
| 3806 | 4086 | e.preventDefault(); |
| 3807 | 4087 | setLoadingState(); |
| 3808 | 4088 | var feedback = jquery__WEBPACK_IMPORTED_MODULE_0___default()(_constants_selectors__WEBPACK_IMPORTED_MODULE_2__.domElements.deactivateFeedbackForm).serializeArray().find(function (field) { |
| @@ -3808,12 +4088,11 @@ | ||
| 3808 | 4088 | var feedback = jquery__WEBPACK_IMPORTED_MODULE_0___default()(_constants_selectors__WEBPACK_IMPORTED_MODULE_2__.domElements.deactivateFeedbackForm).serializeArray().find(function (field) { |
| 3809 | 4089 | return field.name === 'feedback'; |
| 3810 | 4090 | }); |
| 3811 | 4091 | (0,_feedback_feedbackFormApi__WEBPACK_IMPORTED_MODULE_4__.submitFeedbackForm)(_constants_selectors__WEBPACK_IMPORTED_MODULE_2__.domElements.deactivateFeedbackForm).then(function () { |
| 3812 | - if (feedback && _constants_leadinConfig__WEBPACK_IMPORTED_MODULE_6__.refreshToken) { | |
| 3813 | - var embedder = (0,_utils_backgroundAppUtils__WEBPACK_IMPORTED_MODULE_5__.getOrCreateBackgroundApp)(_constants_leadinConfig__WEBPACK_IMPORTED_MODULE_6__.refreshToken); | |
| 4092 | + if (feedback && embedder) { | |
| 3814 | 4093 | embedder.postMessage({ |
| 3815 | - key: _iframe_integratedMessages__WEBPACK_IMPORTED_MODULE_7__.ProxyMessages.TrackPluginDeactivation, | |
| 4094 | + key: _iframe_integratedMessages__WEBPACK_IMPORTED_MODULE_6__.ProxyMessages.TrackPluginDeactivation, | |
| 3816 | 4095 | payload: { |
| 3817 | 4096 | type: feedback.value.trim().replace(/[\s']+/g, '_') |
| 3818 | 4097 | } |
| 3819 | 4098 | }); |
| @@ -3823,16 +4102,15 @@ | ||
| 3823 | 4102 | })["finally"](function () { |
| 3824 | 4103 | deactivatePlugin(); |
| 3825 | 4104 | }); |
| 3826 | 4105 | } |
| 3827 | - | |
| 3828 | 4106 | function init() { |
| 4107 | + embedder = (0,_utils_backgroundAppUtils__WEBPACK_IMPORTED_MODULE_5__.getOrCreateBackgroundApp)(); | |
| 3829 | 4108 | // eslint-disable-next-line no-new |
| 3830 | 4109 | new _feedback_ThickBoxModal__WEBPACK_IMPORTED_MODULE_3__["default"](_constants_selectors__WEBPACK_IMPORTED_MODULE_2__.domElements.deactivatePluginButton, 'leadin-feedback-container', 'leadin-feedback-window', 'leadin-feedback-content'); |
| 3831 | 4110 | jquery__WEBPACK_IMPORTED_MODULE_0___default()(_constants_selectors__WEBPACK_IMPORTED_MODULE_2__.domElements.deactivateFeedbackForm).off('submit').on('submit', submitAndDeactivate); |
| 3832 | 4111 | jquery__WEBPACK_IMPORTED_MODULE_0___default()(_constants_selectors__WEBPACK_IMPORTED_MODULE_2__.domElements.deactivateFeedbackSkip).off('click').on('click', deactivatePlugin); |
| 3833 | 4112 | } |
| 3834 | - | |
| 3835 | 4113 | (0,_utils_backgroundAppUtils__WEBPACK_IMPORTED_MODULE_5__.initBackgroundApp)(init); |
| 3836 | 4114 | })(); |
| 3837 | 4115 | |
| 3838 | 4116 | /******/ })() |