| @@ -2340,8 +2340,9 @@ | ||
| 2340 | 2340 | accountConnected: 'account_connected' |
| 2341 | 2341 | }, |
| 2342 | 2342 | // ChecklistSteps event names are generated dynamically, based on stepId and action type taken: title, action, done, undone, upgrade |
| 2343 | 2343 | elementorEditor: { |
| 2344 | + editorLoaded: 'editor_loaded', | |
| 2344 | 2345 | checklist: { |
| 2345 | 2346 | checklistHeaderClose: 'checklist_header_close_icon', |
| 2346 | 2347 | checklistFirstPopup: 'checklist popup triggered' |
| 2347 | 2348 | }, |
| @@ -2359,8 +2360,17 @@ | ||
| 2359 | 2360 | saveChanges: 'save_variables_changes', |
| 2360 | 2361 | delete: 'delete_variable', |
| 2361 | 2362 | variableSyncToV3: 'variable_sync_to_v3' |
| 2362 | 2363 | }, |
| 2364 | + design_system: { | |
| 2365 | + importOpened: 'design_system_import_opened', | |
| 2366 | + fileSelected: 'design_system_file_selected', | |
| 2367 | + validationFailed: 'design_system_validation_failed', | |
| 2368 | + conflictChoice: 'design_system_conflict_choice', | |
| 2369 | + confirmed: 'design_system_import_confirmed', | |
| 2370 | + imported: 'design_system_imported', | |
| 2371 | + importFailed: 'design_system_import_failed' | |
| 2372 | + }, | |
| 2363 | 2373 | components: { |
| 2364 | 2374 | createClicked: 'component_create_clicked', |
| 2365 | 2375 | createCancelled: 'component_creation_cancelled', |
| 2366 | 2376 | created: 'component_created', |
| @@ -2430,8 +2440,9 @@ | ||
| 2430 | 2440 | "use strict"; |
| 2431 | 2441 | |
| 2432 | 2442 | |
| 2433 | 2443 | var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ "../node_modules/@babel/runtime/helpers/interopRequireDefault.js"); |
| 2444 | +var _typeof = __webpack_require__(/*! @babel/runtime/helpers/typeof */ "../node_modules/@babel/runtime/helpers/typeof.js"); | |
| 2434 | 2445 | Object.defineProperty(exports, "__esModule", ({ |
| 2435 | 2446 | value: true |
| 2436 | 2447 | })); |
| 2437 | 2448 | exports["default"] = void 0; |
| @@ -2443,14 +2454,18 @@ | ||
| 2443 | 2454 | var _getPrototypeOf2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/getPrototypeOf */ "../node_modules/@babel/runtime/helpers/getPrototypeOf.js")); |
| 2444 | 2455 | var _inherits2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/inherits */ "../node_modules/@babel/runtime/helpers/inherits.js")); |
| 2445 | 2456 | var _defineProperty2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/defineProperty */ "../node_modules/@babel/runtime/helpers/defineProperty.js")); |
| 2446 | 2457 | var _eventsConfig = _interopRequireDefault(__webpack_require__(/*! ./events-config */ "../core/common/modules/events-manager/assets/js/events-config.js")); |
| 2447 | -var _mixpanelBrowser = _interopRequireDefault(__webpack_require__(/*! mixpanel-browser */ "../node_modules/mixpanel-browser/dist/mixpanel.module.js")); | |
| 2458 | +var _mixpanelBrowser = _interopRequireWildcard(__webpack_require__(/*! mixpanel-browser */ "../node_modules/mixpanel-browser/dist/mixpanel.module.js")); | |
| 2448 | 2459 | var _tiers = __webpack_require__(/*! elementor-utils/tiers */ "../assets/dev/js/utils/tiers.js"); |
| 2460 | +var _sessionRecording = __webpack_require__(/*! ./session-recording */ "../core/common/modules/events-manager/assets/js/session-recording.js"); | |
| 2461 | +function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t2 in e) "default" !== _t2 && {}.hasOwnProperty.call(e, _t2) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t2)) && (i.get || i.set) ? o(f, _t2, i) : f[_t2] = e[_t2]); return f; })(e, t); } | |
| 2449 | 2462 | 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; } |
| 2450 | 2463 | 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) { (0, _defineProperty2.default)(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; } |
| 2451 | 2464 | function _callSuper(t, o, e) { return o = (0, _getPrototypeOf2.default)(o), (0, _possibleConstructorReturn2.default)(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], (0, _getPrototypeOf2.default)(t).constructor) : o.apply(t, e)); } |
| 2452 | 2465 | function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); } |
| 2466 | +/** @type {Mixpanel | null} */ | |
| 2467 | +var mixpanelInstance = null; | |
| 2453 | 2468 | var _default = exports["default"] = /*#__PURE__*/function (_elementorModules$Mod) { |
| 2454 | 2469 | function _default() { |
| 2455 | 2470 | var _this; |
| 2456 | 2471 | (0, _classCallCheck2.default)(this, _default); |
| @@ -2465,13 +2480,15 @@ | ||
| 2465 | 2480 | (0, _inherits2.default)(_default, _elementorModules$Mod); |
| 2466 | 2481 | return (0, _createClass2.default)(_default, [{ |
| 2467 | 2482 | key: "onInit", |
| 2468 | 2483 | value: function onInit() { |
| 2469 | - var _this2 = this; | |
| 2484 | + var _elementorCommon$conf, | |
| 2485 | + _this2 = this; | |
| 2470 | 2486 | this.config = _eventsConfig.default; |
| 2471 | 2487 | if (!this.canSendEvents()) { |
| 2472 | 2488 | return; |
| 2473 | 2489 | } |
| 2490 | + (0, _sessionRecording.configureSessionRecording)((_elementorCommon$conf = elementorCommon.config.editor_events) === null || _elementorCommon$conf === void 0 ? void 0 : _elementorCommon$conf.session_recording_events); | |
| 2474 | 2491 | this.initializeMixpanel(function () { |
| 2475 | 2492 | return _this2.enableTracking(); |
| 2476 | 2493 | }); |
| 2477 | 2494 | } |
| @@ -2477,35 +2494,50 @@ | ||
| 2477 | 2494 | } |
| 2478 | 2495 | }, { |
| 2479 | 2496 | key: "initializeMixpanel", |
| 2480 | 2497 | value: function initializeMixpanel(onLoaded) { |
| 2481 | - var _elementorCommon$conf; | |
| 2482 | - _mixpanelBrowser.default.init((_elementorCommon$conf = elementorCommon.config.editor_events) === null || _elementorCommon$conf === void 0 ? void 0 : _elementorCommon$conf.token, { | |
| 2483 | - persistence: 'localStorage', | |
| 2484 | - autocapture: false, | |
| 2485 | - flags: true, | |
| 2486 | - api_host: 'https://api-eu.mixpanel.com', | |
| 2487 | - loaded: onLoaded | |
| 2488 | - }); | |
| 2498 | + if (mixpanelInstance && mixpanelInstance.isInitialized) { | |
| 2499 | + onLoaded(mixpanelInstance); | |
| 2500 | + } else { | |
| 2501 | + var _elementorCommon$conf2; | |
| 2502 | + mixpanelInstance = _mixpanelBrowser.default.init((_elementorCommon$conf2 = elementorCommon.config.editor_events) === null || _elementorCommon$conf2 === void 0 ? void 0 : _elementorCommon$conf2.token, { | |
| 2503 | + persistence: 'localStorage', | |
| 2504 | + autocapture: false, | |
| 2505 | + flags: true, | |
| 2506 | + api_hosts: { | |
| 2507 | + flags: 'https://api-eu.mixpanel.com' | |
| 2508 | + }, | |
| 2509 | + loaded: onLoaded, | |
| 2510 | + record_sessions_percent: 0, | |
| 2511 | + record_idle_timeout_ms: 60 * 1000, | |
| 2512 | + // 60 Seconds | |
| 2513 | + record_min_ms: 5 * 1000, | |
| 2514 | + // 5 Seconds | |
| 2515 | + record_max_ms: 30 * 1000, | |
| 2516 | + // 30 Seconds | |
| 2517 | + record_mask_text_selector: '' | |
| 2518 | + }, 'elementor-editor'); | |
| 2519 | + } | |
| 2520 | + elementorCommon.config.editor_events.mixpanelInstance = mixpanelInstance; | |
| 2489 | 2521 | } |
| 2490 | 2522 | }, { |
| 2491 | 2523 | key: "enableTracking", |
| 2492 | 2524 | value: function enableTracking() { |
| 2493 | - var _elementorCommon$conf2; | |
| 2525 | + var _elementorCommon$conf3; | |
| 2494 | 2526 | if (!this.isMixpanelReady()) { |
| 2495 | 2527 | return; |
| 2496 | 2528 | } |
| 2497 | - var userId = (_elementorCommon$conf2 = elementorCommon.config.editor_events) === null || _elementorCommon$conf2 === void 0 ? void 0 : _elementorCommon$conf2.user_id; | |
| 2529 | + var userId = (_elementorCommon$conf3 = elementorCommon.config.editor_events) === null || _elementorCommon$conf3 === void 0 ? void 0 : _elementorCommon$conf3.user_id; | |
| 2530 | + mixpanelInstance.register({ | |
| 2531 | + appType: 'Editor' | |
| 2532 | + }); | |
| 2498 | 2533 | if (userId) { |
| 2499 | - var _elementorCommon$conf3; | |
| 2500 | - _mixpanelBrowser.default.identify(userId); | |
| 2501 | - _mixpanelBrowser.default.register({ | |
| 2502 | - appType: 'Editor' | |
| 2503 | - }); | |
| 2504 | - _mixpanelBrowser.default.people.set_once({ | |
| 2534 | + var _elementorCommon$conf4; | |
| 2535 | + mixpanelInstance.identify(userId); | |
| 2536 | + mixpanelInstance.people.set_once({ | |
| 2505 | 2537 | $user_id: userId, |
| 2506 | 2538 | $last_login: new Date().toISOString(), |
| 2507 | - $plan_type: ((_elementorCommon$conf3 = elementorCommon.config.library_connect) === null || _elementorCommon$conf3 === void 0 ? void 0 : _elementorCommon$conf3.plan_type) || _tiers.TIERS.free | |
| 2539 | + $plan_type: ((_elementorCommon$conf4 = elementorCommon.config.library_connect) === null || _elementorCommon$conf4 === void 0 ? void 0 : _elementorCommon$conf4.plan_type) || _tiers.TIERS.free | |
| 2508 | 2540 | }); |
| 2509 | 2541 | } |
| 2510 | 2542 | this.trackingEnabled = true; |
| 2511 | 2543 | this.availableExperiments = Object.keys(elementorCommon.config.experimentalFeatures || {}); |
| @@ -2512,9 +2544,9 @@ | ||
| 2512 | 2544 | } |
| 2513 | 2545 | }, { |
| 2514 | 2546 | key: "dispatchEvent", |
| 2515 | 2547 | value: function dispatchEvent(name, data) { |
| 2516 | - var _elementorCommon$conf4, _elementorCommon$conf5, _elementorCommon$conf6, _elementorCommon$conf7, _elementorCommon$conf8, _elementorCommon$conf9, _elementorCommon$conf0, _elementorCommon$conf1, _elementorCommon$conf10; | |
| 2548 | + var _elementorCommon$conf5, _elementorCommon$conf6, _elementorCommon$conf7, _elementorCommon$conf8, _elementorCommon$conf9, _elementorCommon$conf0, _elementorCommon$conf1, _elementorCommon$conf10, _elementorCommon$conf11; | |
| 2517 | 2549 | var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; |
| 2518 | 2550 | if (!this.canSendEvents()) { |
| 2519 | 2551 | return; |
| 2520 | 2552 | } |
| @@ -2521,31 +2553,35 @@ | ||
| 2521 | 2553 | if (!this.trackingEnabled) { |
| 2522 | 2554 | this.enableTracking(); |
| 2523 | 2555 | } |
| 2524 | 2556 | var eventData = _objectSpread({ |
| 2525 | - user_id: ((_elementorCommon$conf4 = elementorCommon.config.editor_events) === null || _elementorCommon$conf4 === void 0 ? void 0 : _elementorCommon$conf4.user_id) || null, | |
| 2526 | - user_roles: ((_elementorCommon$conf5 = elementorCommon.config.library_connect) === null || _elementorCommon$conf5 === void 0 ? void 0 : _elementorCommon$conf5.user_roles) || [], | |
| 2527 | - subscription_id: ((_elementorCommon$conf6 = elementorCommon.config.editor_events) === null || _elementorCommon$conf6 === void 0 ? void 0 : _elementorCommon$conf6.subscription_id) || null, | |
| 2528 | - user_tier: ((_elementorCommon$conf7 = elementorCommon.config.library_connect) === null || _elementorCommon$conf7 === void 0 ? void 0 : _elementorCommon$conf7.current_access_tier) || null, | |
| 2529 | - url: (_elementorCommon$conf8 = elementorCommon.config.editor_events) === null || _elementorCommon$conf8 === void 0 ? void 0 : _elementorCommon$conf8.site_url, | |
| 2530 | - wp_version: (_elementorCommon$conf9 = elementorCommon.config.editor_events) === null || _elementorCommon$conf9 === void 0 ? void 0 : _elementorCommon$conf9.wp_version, | |
| 2531 | - client_id: (_elementorCommon$conf0 = elementorCommon.config.editor_events) === null || _elementorCommon$conf0 === void 0 ? void 0 : _elementorCommon$conf0.site_key, | |
| 2532 | - app_version: (_elementorCommon$conf1 = elementorCommon.config.editor_events) === null || _elementorCommon$conf1 === void 0 ? void 0 : _elementorCommon$conf1.elementor_version, | |
| 2533 | - site_language: (_elementorCommon$conf10 = elementorCommon.config.editor_events) === null || _elementorCommon$conf10 === void 0 ? void 0 : _elementorCommon$conf10.site_language, | |
| 2557 | + user_id: ((_elementorCommon$conf5 = elementorCommon.config.editor_events) === null || _elementorCommon$conf5 === void 0 ? void 0 : _elementorCommon$conf5.user_id) || null, | |
| 2558 | + user_roles: ((_elementorCommon$conf6 = elementorCommon.config.library_connect) === null || _elementorCommon$conf6 === void 0 ? void 0 : _elementorCommon$conf6.user_roles) || [], | |
| 2559 | + subscription_id: ((_elementorCommon$conf7 = elementorCommon.config.editor_events) === null || _elementorCommon$conf7 === void 0 ? void 0 : _elementorCommon$conf7.subscription_id) || null, | |
| 2560 | + user_tier: ((_elementorCommon$conf8 = elementorCommon.config.library_connect) === null || _elementorCommon$conf8 === void 0 ? void 0 : _elementorCommon$conf8.current_access_tier) || null, | |
| 2561 | + url: (_elementorCommon$conf9 = elementorCommon.config.editor_events) === null || _elementorCommon$conf9 === void 0 ? void 0 : _elementorCommon$conf9.site_url, | |
| 2562 | + wp_version: (_elementorCommon$conf0 = elementorCommon.config.editor_events) === null || _elementorCommon$conf0 === void 0 ? void 0 : _elementorCommon$conf0.wp_version, | |
| 2563 | + client_id: (_elementorCommon$conf1 = elementorCommon.config.editor_events) === null || _elementorCommon$conf1 === void 0 ? void 0 : _elementorCommon$conf1.site_key, | |
| 2564 | + app_version: (_elementorCommon$conf10 = elementorCommon.config.editor_events) === null || _elementorCommon$conf10 === void 0 ? void 0 : _elementorCommon$conf10.elementor_version, | |
| 2565 | + site_language: (_elementorCommon$conf11 = elementorCommon.config.editor_events) === null || _elementorCommon$conf11 === void 0 ? void 0 : _elementorCommon$conf11.site_language, | |
| 2534 | 2566 | experiments: this.availableExperiments |
| 2535 | 2567 | }, data); |
| 2536 | - _mixpanelBrowser.default.track(name, eventData, options); | |
| 2568 | + mixpanelInstance.track(name, eventData, options); | |
| 2569 | + var recordingDecision = (0, _sessionRecording.handleSessionRecording)(name, mixpanelInstance); | |
| 2570 | + if (recordingDecision) { | |
| 2571 | + mixpanelInstance.track(recordingDecision, eventData); | |
| 2572 | + } | |
| 2537 | 2573 | } |
| 2538 | 2574 | }, { |
| 2539 | 2575 | key: "featureFlagIsActive", |
| 2540 | 2576 | value: function () { |
| 2541 | 2577 | var _featureFlagIsActive = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee(flagName) { |
| 2542 | - var _mixpanel$flags; | |
| 2578 | + var _mixpanelInstance; | |
| 2543 | 2579 | var isEnabled; |
| 2544 | 2580 | return _regenerator.default.wrap(function (_context) { |
| 2545 | 2581 | while (1) switch (_context.prev = _context.next) { |
| 2546 | 2582 | case 0: |
| 2547 | - if (!('function' !== typeof (_mixpanelBrowser.default === null || _mixpanelBrowser.default === void 0 || (_mixpanel$flags = _mixpanelBrowser.default.flags) === null || _mixpanel$flags === void 0 ? void 0 : _mixpanel$flags.is_enabled))) { | |
| 2583 | + if (!('function' !== typeof ((_mixpanelInstance = mixpanelInstance) === null || _mixpanelInstance === void 0 || (_mixpanelInstance = _mixpanelInstance.flags) === null || _mixpanelInstance === void 0 ? void 0 : _mixpanelInstance.is_enabled))) { | |
| 2548 | 2584 | _context.next = 1; |
| 2549 | 2585 | break; |
| 2550 | 2586 | } |
| 2551 | 2587 | return _context.abrupt("return", false); |
| @@ -2550,9 +2586,9 @@ | ||
| 2550 | 2586 | } |
| 2551 | 2587 | return _context.abrupt("return", false); |
| 2552 | 2588 | case 1: |
| 2553 | 2589 | _context.next = 2; |
| 2554 | - return _mixpanelBrowser.default.flags.is_enabled(flagName, false); | |
| 2590 | + return mixpanelInstance.flags.is_enabled(flagName, false); | |
| 2555 | 2591 | case 2: |
| 2556 | 2592 | isEnabled = _context.sent; |
| 2557 | 2593 | return _context.abrupt("return", true === isEnabled); |
| 2558 | 2594 | case 3: |
| @@ -2570,10 +2606,10 @@ | ||
| 2570 | 2606 | key: "getExperimentVariant", |
| 2571 | 2607 | value: function () { |
| 2572 | 2608 | var _getExperimentVariant = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee2(experimentName) { |
| 2573 | 2609 | var defaultValue, |
| 2574 | - _elementorCommon$conf11, | |
| 2575 | 2610 | _elementorCommon$conf12, |
| 2611 | + _elementorCommon$conf13, | |
| 2576 | 2612 | isAbTestingEnabled, |
| 2577 | 2613 | variant, |
| 2578 | 2614 | _args2 = arguments, |
| 2579 | 2615 | _t; |
| @@ -2587,9 +2623,9 @@ | ||
| 2587 | 2623 | break; |
| 2588 | 2624 | } |
| 2589 | 2625 | return _context2.abrupt("return", defaultValue); |
| 2590 | 2626 | case 2: |
| 2591 | - isAbTestingEnabled = (_elementorCommon$conf11 = (_elementorCommon$conf12 = elementorCommon.config.editor_events) === null || _elementorCommon$conf12 === void 0 ? void 0 : _elementorCommon$conf12.flags_enabled) !== null && _elementorCommon$conf11 !== void 0 ? _elementorCommon$conf11 : false; | |
| 2627 | + isAbTestingEnabled = (_elementorCommon$conf12 = (_elementorCommon$conf13 = elementorCommon.config.editor_events) === null || _elementorCommon$conf13 === void 0 ? void 0 : _elementorCommon$conf13.flags_enabled) !== null && _elementorCommon$conf12 !== void 0 ? _elementorCommon$conf12 : false; | |
| 2592 | 2628 | if (isAbTestingEnabled) { |
| 2593 | 2629 | _context2.next = 3; |
| 2594 | 2630 | break; |
| 2595 | 2631 | } |
| @@ -2594,9 +2630,9 @@ | ||
| 2594 | 2630 | break; |
| 2595 | 2631 | } |
| 2596 | 2632 | return _context2.abrupt("return", defaultValue); |
| 2597 | 2633 | case 3: |
| 2598 | - if (_mixpanelBrowser.default) { | |
| 2634 | + if (mixpanelInstance) { | |
| 2599 | 2635 | _context2.next = 4; |
| 2600 | 2636 | break; |
| 2601 | 2637 | } |
| 2602 | 2638 | return _context2.abrupt("return", defaultValue); |
| @@ -2603,15 +2639,15 @@ | ||
| 2603 | 2639 | case 4: |
| 2604 | 2640 | if (!this.trackingEnabled) { |
| 2605 | 2641 | this.enableTracking(); |
| 2606 | 2642 | } |
| 2607 | - if (_mixpanelBrowser.default.flags) { | |
| 2643 | + if (mixpanelInstance.flags) { | |
| 2608 | 2644 | _context2.next = 5; |
| 2609 | 2645 | break; |
| 2610 | 2646 | } |
| 2611 | 2647 | return _context2.abrupt("return", defaultValue); |
| 2612 | 2648 | case 5: |
| 2613 | - if (!('function' !== typeof _mixpanelBrowser.default.flags.get_variant_value)) { | |
| 2649 | + if (!('function' !== typeof mixpanelInstance.flags.get_variant_value)) { | |
| 2614 | 2650 | _context2.next = 6; |
| 2615 | 2651 | break; |
| 2616 | 2652 | } |
| 2617 | 2653 | return _context2.abrupt("return", defaultValue); |
| @@ -2616,9 +2652,9 @@ | ||
| 2616 | 2652 | } |
| 2617 | 2653 | return _context2.abrupt("return", defaultValue); |
| 2618 | 2654 | case 6: |
| 2619 | 2655 | _context2.next = 7; |
| 2620 | - return _mixpanelBrowser.default.flags.get_variant_value(experimentName, defaultValue); | |
| 2656 | + return mixpanelInstance.flags.get_variant_value(experimentName, defaultValue); | |
| 2621 | 2657 | case 7: |
| 2622 | 2658 | variant = _context2.sent; |
| 2623 | 2659 | if (!(undefined === variant || null === variant)) { |
| 2624 | 2660 | _context2.next = 8; |
| @@ -2647,9 +2683,9 @@ | ||
| 2647 | 2683 | value: function startExperiment(experimentName, experimentVariant) { |
| 2648 | 2684 | if (!this.trackingEnabled) { |
| 2649 | 2685 | return; |
| 2650 | 2686 | } |
| 2651 | - _mixpanelBrowser.default.track('$experiment_started', { | |
| 2687 | + mixpanelInstance.track('$experiment_started', { | |
| 2652 | 2688 | 'Experiment name': experimentName, |
| 2653 | 2689 | 'Variant name': experimentVariant |
| 2654 | 2690 | }); |
| 2655 | 2691 | } |
| @@ -2655,13 +2691,13 @@ | ||
| 2655 | 2691 | } |
| 2656 | 2692 | }, { |
| 2657 | 2693 | key: "isMixpanelReady", |
| 2658 | 2694 | value: function isMixpanelReady() { |
| 2659 | - if ('undefined' === typeof _mixpanelBrowser.default || !_mixpanelBrowser.default) { | |
| 2695 | + if ('undefined' === typeof mixpanelInstance || !mixpanelInstance) { | |
| 2660 | 2696 | return false; |
| 2661 | 2697 | } |
| 2662 | 2698 | try { |
| 2663 | - var distinctId = _mixpanelBrowser.default.get_distinct_id(); | |
| 2699 | + var distinctId = mixpanelInstance.get_distinct_id(); | |
| 2664 | 2700 | return distinctId !== undefined && distinctId !== null; |
| 2665 | 2701 | } catch (error) { |
| 2666 | 2702 | return false; |
| 2667 | 2703 | } |
| @@ -2674,12 +2710,91 @@ | ||
| 2674 | 2710 | } |
| 2675 | 2711 | }, { |
| 2676 | 2712 | key: "getMixpanelInstance", |
| 2677 | 2713 | value: function getMixpanelInstance() { |
| 2678 | - return this.isMixpanelReady() ? _mixpanelBrowser.default : undefined; | |
| 2714 | + return this.isMixpanelReady() ? mixpanelInstance : undefined; | |
| 2679 | 2715 | } |
| 2680 | 2716 | }]); |
| 2681 | 2717 | }(elementorModules.Module); |
| 2718 | + | |
| 2719 | +/***/ }), | |
| 2720 | + | |
| 2721 | +/***/ "../core/common/modules/events-manager/assets/js/session-recording.js": | |
| 2722 | +/*!****************************************************************************!*\ | |
| 2723 | + !*** ../core/common/modules/events-manager/assets/js/session-recording.js ***! | |
| 2724 | + \****************************************************************************/ | |
| 2725 | +/***/ ((__unused_webpack_module, exports) => { | |
| 2726 | + | |
| 2727 | +"use strict"; | |
| 2728 | + | |
| 2729 | + | |
| 2730 | +Object.defineProperty(exports, "__esModule", ({ | |
| 2731 | + value: true | |
| 2732 | +})); | |
| 2733 | +exports.configureSessionRecording = configureSessionRecording; | |
| 2734 | +exports.getIsRecording = getIsRecording; | |
| 2735 | +exports.handleSessionRecording = handleSessionRecording; | |
| 2736 | +var RECORD_SESSION_PERCENT = 1; | |
| 2737 | +var sessionRecordingPairs = []; | |
| 2738 | +var activeEndEvent = null; | |
| 2739 | +var isRecording = false; | |
| 2740 | +function shouldRecordSession(distinctId, percent) { | |
| 2741 | + var fraction = Math.min(Math.max(percent / 100, 0), 1); | |
| 2742 | + var hash = 0; | |
| 2743 | + for (var i = 0; i < distinctId.length; i++) { | |
| 2744 | + // eslint-disable-next-line no-bitwise | |
| 2745 | + hash = hash * 31 + distinctId.charCodeAt(i) >>> 0; | |
| 2746 | + } | |
| 2747 | + return hash / 4294967295 < fraction; | |
| 2748 | +} | |
| 2749 | + | |
| 2750 | +/** | |
| 2751 | + * @param {Array<{start: string, end?: string|null}>} pairs | |
| 2752 | + */ | |
| 2753 | +function configureSessionRecording(pairs) { | |
| 2754 | + if (!Array.isArray(pairs)) { | |
| 2755 | + return; | |
| 2756 | + } | |
| 2757 | + sessionRecordingPairs = pairs.filter(function (pair) { | |
| 2758 | + return 'string' === typeof (pair === null || pair === void 0 ? void 0 : pair.start) && pair.start; | |
| 2759 | + }); | |
| 2760 | +} | |
| 2761 | + | |
| 2762 | +/** | |
| 2763 | + * Evaluates whether to start/stop recording based on the event name. | |
| 2764 | + * | |
| 2765 | + * @param {string} name | |
| 2766 | + * @param {import('mixpanel-browser').Mixpanel} mixpanelInstance | |
| 2767 | + * @return {'recording_started'|'recording_skipped'|'recording_stopped'|null} The recording decision, or null if no action taken. | |
| 2768 | + */ | |
| 2769 | +function handleSessionRecording(name, mixpanelInstance) { | |
| 2770 | + var matchedPair = sessionRecordingPairs.find(function (pair) { | |
| 2771 | + return pair.start === name; | |
| 2772 | + }); | |
| 2773 | + if (matchedPair) { | |
| 2774 | + var distinctId = mixpanelInstance.get_distinct_id(); | |
| 2775 | + if (shouldRecordSession(distinctId, RECORD_SESSION_PERCENT)) { | |
| 2776 | + var _matchedPair$end; | |
| 2777 | + mixpanelInstance.start_session_recording(); | |
| 2778 | + isRecording = true; | |
| 2779 | + activeEndEvent = (_matchedPair$end = matchedPair.end) !== null && _matchedPair$end !== void 0 ? _matchedPair$end : null; | |
| 2780 | + return 'recording_started'; | |
| 2781 | + } | |
| 2782 | + isRecording = false; | |
| 2783 | + activeEndEvent = null; | |
| 2784 | + return 'recording_skipped'; | |
| 2785 | + } | |
| 2786 | + if (activeEndEvent && name === activeEndEvent) { | |
| 2787 | + mixpanelInstance.stop_session_recording(); | |
| 2788 | + isRecording = false; | |
| 2789 | + activeEndEvent = null; | |
| 2790 | + return 'recording_stopped'; | |
| 2791 | + } | |
| 2792 | + return null; | |
| 2793 | +} | |
| 2794 | +function getIsRecording() { | |
| 2795 | + return isRecording; | |
| 2796 | +} | |
| 2682 | 2797 | |
| 2683 | 2798 | /***/ }), |
| 2684 | 2799 | |
| 2685 | 2800 | /***/ "../core/common/modules/finder/assets/js/commands/index.js": |