| @@ -1,168 +1,3 @@ | ||
| 1 | -/******/ (function() { // webpackBootstrap | |
| 2 | -/******/ "use strict"; | |
| 3 | -/******/ var __webpack_modules__ = ({ | |
| 4 | - | |
| 5 | -/***/ "./packages/packages/libs/events/src/use-mixpanel.ts": | |
| 6 | -/*!***********************************************************!*\ | |
| 7 | - !*** ./packages/packages/libs/events/src/use-mixpanel.ts ***! | |
| 8 | - \***********************************************************/ | |
| 9 | -/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { | |
| 10 | - | |
| 11 | -__webpack_require__.r(__webpack_exports__); | |
| 12 | -/* harmony export */ __webpack_require__.d(__webpack_exports__, { | |
| 13 | -/* harmony export */ canSendEvents: function() { return /* binding */ canSendEvents; }, | |
| 14 | -/* harmony export */ enableTracking: function() { return /* binding */ enableTracking; }, | |
| 15 | -/* harmony export */ getMixpanel: function() { return /* binding */ getMixpanel; }, | |
| 16 | -/* harmony export */ initializeAndEnableTracking: function() { return /* binding */ initializeAndEnableTracking; }, | |
| 17 | -/* harmony export */ initializeMixpanel: function() { return /* binding */ initializeMixpanel; }, | |
| 18 | -/* harmony export */ isMixpanelReady: function() { return /* binding */ isMixpanelReady; }, | |
| 19 | -/* harmony export */ isTrackingEnabled: function() { return /* binding */ isTrackingEnabled; }, | |
| 20 | -/* harmony export */ setCanSendEvents: function() { return /* binding */ setCanSendEvents; }, | |
| 21 | -/* harmony export */ trackEvent: function() { return /* binding */ trackEvent; }, | |
| 22 | -/* harmony export */ useMixpanel: function() { return /* binding */ useMixpanel; } | |
| 23 | -/* harmony export */ }); | |
| 24 | -const getMixpanel = () => { | |
| 25 | - const eventsManager = window.elementorCommon?.eventsManager || {}; | |
| 26 | - return { | |
| 27 | - dispatchEvent: eventsManager.dispatchEvent?.bind(eventsManager), | |
| 28 | - config: eventsManager.config, | |
| 29 | - canSendEvents: eventsManager.canSendEvents?.bind(eventsManager), | |
| 30 | - initializeMixpanel: eventsManager.initializeMixpanel?.bind(eventsManager), | |
| 31 | - enableTracking: eventsManager.enableTracking?.bind(eventsManager), | |
| 32 | - isMixpanelReady: eventsManager.isMixpanelReady?.bind(eventsManager), | |
| 33 | - trackingEnabled: eventsManager.trackingEnabled ?? false, | |
| 34 | - getMixpanelInstance: eventsManager.getMixpanelInstance?.bind(eventsManager) | |
| 35 | - }; | |
| 36 | -}; | |
| 37 | -const useMixpanel = () => { | |
| 38 | - const { | |
| 39 | - dispatchEvent, | |
| 40 | - config | |
| 41 | - } = getMixpanel(); | |
| 42 | - return { | |
| 43 | - dispatchEvent, | |
| 44 | - config | |
| 45 | - }; | |
| 46 | -}; | |
| 47 | -const trackEvent = event => { | |
| 48 | - const { | |
| 49 | - dispatchEvent | |
| 50 | - } = getMixpanel(); | |
| 51 | - dispatchEvent?.(event.eventName, event); | |
| 52 | -}; | |
| 53 | -const canSendEvents = () => getMixpanel().canSendEvents?.() ?? false; | |
| 54 | -const setCanSendEvents = value => { | |
| 55 | - const editorEvents = window.elementorCommon?.config?.editor_events; | |
| 56 | - if (editorEvents) { | |
| 57 | - editorEvents.can_send_events = value; | |
| 58 | - } | |
| 59 | -}; | |
| 60 | -const isMixpanelReady = () => getMixpanel().isMixpanelReady?.() ?? false; | |
| 61 | -const isTrackingEnabled = () => getMixpanel().trackingEnabled; | |
| 62 | -const enableTracking = () => getMixpanel().enableTracking?.(); | |
| 63 | -const initializeMixpanel = onLoaded => getMixpanel().initializeMixpanel?.(onLoaded ?? (() => {})); | |
| 64 | -function initializeAndEnableTracking(onReady) { | |
| 65 | - const mixpanel = getMixpanel(); | |
| 66 | - if (!mixpanel.dispatchEvent) { | |
| 67 | - return; | |
| 68 | - } | |
| 69 | - if (mixpanel.trackingEnabled) { | |
| 70 | - onReady?.(mixpanel.getMixpanelInstance?.()); | |
| 71 | - return; | |
| 72 | - } | |
| 73 | - if (mixpanel.isMixpanelReady?.()) { | |
| 74 | - mixpanel.enableTracking?.(); | |
| 75 | - onReady?.(mixpanel.getMixpanelInstance?.()); | |
| 76 | - return; | |
| 77 | - } | |
| 78 | - mixpanel.initializeMixpanel?.(mpInstance => { | |
| 79 | - mixpanel.enableTracking?.(); | |
| 80 | - onReady?.(mpInstance); | |
| 81 | - }); | |
| 82 | -} | |
| 83 | - | |
| 84 | -/***/ }) | |
| 85 | - | |
| 86 | -/******/ }); | |
| 87 | -/************************************************************************/ | |
| 88 | -/******/ // The module cache | |
| 89 | -/******/ var __webpack_module_cache__ = {}; | |
| 90 | -/******/ | |
| 91 | -/******/ // The require function | |
| 92 | -/******/ function __webpack_require__(moduleId) { | |
| 93 | -/******/ // Check if module is in cache | |
| 94 | -/******/ var cachedModule = __webpack_module_cache__[moduleId]; | |
| 95 | -/******/ if (cachedModule !== undefined) { | |
| 96 | -/******/ return cachedModule.exports; | |
| 97 | -/******/ } | |
| 98 | -/******/ // Create a new module (and put it into the cache) | |
| 99 | -/******/ var module = __webpack_module_cache__[moduleId] = { | |
| 100 | -/******/ // no module.id needed | |
| 101 | -/******/ // no module.loaded needed | |
| 102 | -/******/ exports: {} | |
| 103 | -/******/ }; | |
| 104 | -/******/ | |
| 105 | -/******/ // Execute the module function | |
| 106 | -/******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__); | |
| 107 | -/******/ | |
| 108 | -/******/ // Return the exports of the module | |
| 109 | -/******/ return module.exports; | |
| 110 | -/******/ } | |
| 111 | -/******/ | |
| 112 | -/************************************************************************/ | |
| 113 | -/******/ /* webpack/runtime/define property getters */ | |
| 114 | -/******/ !function() { | |
| 115 | -/******/ // define getter functions for harmony exports | |
| 116 | -/******/ __webpack_require__.d = function(exports, definition) { | |
| 117 | -/******/ for(var key in definition) { | |
| 118 | -/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) { | |
| 119 | -/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); | |
| 120 | -/******/ } | |
| 121 | -/******/ } | |
| 122 | -/******/ }; | |
| 123 | -/******/ }(); | |
| 124 | -/******/ | |
| 125 | -/******/ /* webpack/runtime/hasOwnProperty shorthand */ | |
| 126 | -/******/ !function() { | |
| 127 | -/******/ __webpack_require__.o = function(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); } | |
| 128 | -/******/ }(); | |
| 129 | -/******/ | |
| 130 | -/******/ /* webpack/runtime/make namespace object */ | |
| 131 | -/******/ !function() { | |
| 132 | -/******/ // define __esModule on exports | |
| 133 | -/******/ __webpack_require__.r = function(exports) { | |
| 134 | -/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { | |
| 135 | -/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); | |
| 136 | -/******/ } | |
| 137 | -/******/ Object.defineProperty(exports, '__esModule', { value: true }); | |
| 138 | -/******/ }; | |
| 139 | -/******/ }(); | |
| 140 | -/******/ | |
| 141 | -/************************************************************************/ | |
| 142 | -var __webpack_exports__ = {}; | |
| 143 | -// This entry needs to be wrapped in an IIFE because it needs to be isolated against other modules in the chunk. | |
| 144 | -!function() { | |
| 145 | -/*!****************************************************!*\ | |
| 146 | - !*** ./packages/packages/libs/events/src/index.ts ***! | |
| 147 | - \****************************************************/ | |
| 148 | -__webpack_require__.r(__webpack_exports__); | |
| 149 | -/* harmony export */ __webpack_require__.d(__webpack_exports__, { | |
| 150 | -/* harmony export */ canSendEvents: function() { return /* reexport safe */ _use_mixpanel__WEBPACK_IMPORTED_MODULE_0__.canSendEvents; }, | |
| 151 | -/* harmony export */ enableTracking: function() { return /* reexport safe */ _use_mixpanel__WEBPACK_IMPORTED_MODULE_0__.enableTracking; }, | |
| 152 | -/* harmony export */ getMixpanel: function() { return /* reexport safe */ _use_mixpanel__WEBPACK_IMPORTED_MODULE_0__.getMixpanel; }, | |
| 153 | -/* harmony export */ initializeAndEnableTracking: function() { return /* reexport safe */ _use_mixpanel__WEBPACK_IMPORTED_MODULE_0__.initializeAndEnableTracking; }, | |
| 154 | -/* harmony export */ initializeMixpanel: function() { return /* reexport safe */ _use_mixpanel__WEBPACK_IMPORTED_MODULE_0__.initializeMixpanel; }, | |
| 155 | -/* harmony export */ isMixpanelReady: function() { return /* reexport safe */ _use_mixpanel__WEBPACK_IMPORTED_MODULE_0__.isMixpanelReady; }, | |
| 156 | -/* harmony export */ isTrackingEnabled: function() { return /* reexport safe */ _use_mixpanel__WEBPACK_IMPORTED_MODULE_0__.isTrackingEnabled; }, | |
| 157 | -/* harmony export */ setCanSendEvents: function() { return /* reexport safe */ _use_mixpanel__WEBPACK_IMPORTED_MODULE_0__.setCanSendEvents; }, | |
| 158 | -/* harmony export */ trackEvent: function() { return /* reexport safe */ _use_mixpanel__WEBPACK_IMPORTED_MODULE_0__.trackEvent; }, | |
| 159 | -/* harmony export */ useMixpanel: function() { return /* reexport safe */ _use_mixpanel__WEBPACK_IMPORTED_MODULE_0__.useMixpanel; } | |
| 160 | -/* harmony export */ }); | |
| 161 | -/* harmony import */ var _use_mixpanel__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./use-mixpanel */ "./packages/packages/libs/events/src/use-mixpanel.ts"); | |
| 162 | - | |
| 163 | -}(); | |
| 164 | -(window.elementorV2 = window.elementorV2 || {}).events = __webpack_exports__; | |
| 165 | -/******/ })() | |
| 166 | -; | |
| 167 | -window.elementorV2.events?.init?.(); | |
| 1 | +/*! For license information please see events.js.LICENSE.txt */ | |
| 2 | +!function(){"use strict";var n={"./packages/packages/libs/events/src/use-mixpanel.ts":function(n,e,i){i.r(e),i.d(e,{canSendEvents:function(){return canSendEvents},enableTracking:function(){return enableTracking},getMixpanel:function(){return getMixpanel},initializeAndEnableTracking:function(){return initializeAndEnableTracking},initializeMixpanel:function(){return initializeMixpanel},isMixpanelReady:function(){return isMixpanelReady},isTrackingEnabled:function(){return isTrackingEnabled},setCanSendEvents:function(){return setCanSendEvents},trackEvent:function(){return trackEvent},useMixpanel:function(){return useMixpanel}});const getMixpanel=()=>{const n=window.elementorCommon?.eventsManager||{};return{dispatchEvent:n.dispatchEvent?.bind(n),config:n.config,canSendEvents:n.canSendEvents?.bind(n),initializeMixpanel:n.initializeMixpanel?.bind(n),enableTracking:n.enableTracking?.bind(n),isMixpanelReady:n.isMixpanelReady?.bind(n),trackingEnabled:n.trackingEnabled??!1,getMixpanelInstance:n.getMixpanelInstance?.bind(n)}},useMixpanel=()=>{const{dispatchEvent:n,config:e}=getMixpanel();return{dispatchEvent:n,config:e}},trackEvent=n=>{const{dispatchEvent:e}=getMixpanel();e?.(n.eventName,n)},canSendEvents=()=>getMixpanel().canSendEvents?.()??!1,setCanSendEvents=n=>{const e=window.elementorCommon?.config?.editor_events;e&&(e.can_send_events=n)},isMixpanelReady=()=>getMixpanel().isMixpanelReady?.()??!1,isTrackingEnabled=()=>getMixpanel().trackingEnabled,enableTracking=()=>getMixpanel().enableTracking?.(),initializeMixpanel=n=>getMixpanel().initializeMixpanel?.(n??(()=>{}));function initializeAndEnableTracking(n){const e=getMixpanel();if(e.dispatchEvent){if(!e.trackingEnabled)return e.isMixpanelReady?.()?(e.enableTracking?.(),void n?.(e.getMixpanelInstance?.())):void e.initializeMixpanel?.(i=>{e.enableTracking?.(),n?.(i)});n?.(e.getMixpanelInstance?.())}}}},e={};function __webpack_require__(i){var t=e[i];if(void 0!==t)return t.exports;var a=e[i]={exports:{}};return n[i](a,a.exports,__webpack_require__),a.exports}__webpack_require__.d=function(n,e){for(var i in e)__webpack_require__.o(e,i)&&!__webpack_require__.o(n,i)&&Object.defineProperty(n,i,{enumerable:!0,get:e[i]})},__webpack_require__.o=function(n,e){return Object.prototype.hasOwnProperty.call(n,e)},__webpack_require__.r=function(n){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(n,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(n,"__esModule",{value:!0})};var i={};!function(){__webpack_require__.r(i),__webpack_require__.d(i,{canSendEvents:function(){return n.canSendEvents},enableTracking:function(){return n.enableTracking},getMixpanel:function(){return n.getMixpanel},initializeAndEnableTracking:function(){return n.initializeAndEnableTracking},initializeMixpanel:function(){return n.initializeMixpanel},isMixpanelReady:function(){return n.isMixpanelReady},isTrackingEnabled:function(){return n.isTrackingEnabled},setCanSendEvents:function(){return n.setCanSendEvents},trackEvent:function(){return n.trackEvent},useMixpanel:function(){return n.useMixpanel}});var n=__webpack_require__("./packages/packages/libs/events/src/use-mixpanel.ts")}(),(window.elementorV2=window.elementorV2||{}).events=i}(),window.elementorV2.events?.init?.(); | |
| 168 | 3 | //# sourceMappingURL=events.js.map |