@elementor/editor-variables 3.33.0-256 → 3.33.0-258

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@elementor/editor-variables",
3
- "version": "3.33.0-256",
3
+ "version": "3.33.0-258",
4
4
  "private": false,
5
5
  "author": "Elementor Team",
6
6
  "homepage": "https://elementor.com/",
@@ -39,20 +39,20 @@
39
39
  "dev": "tsup --config=../../tsup.dev.ts"
40
40
  },
41
41
  "dependencies": {
42
- "@elementor/editor": "3.33.0-256",
43
- "@elementor/editor-canvas": "3.33.0-256",
44
- "@elementor/editor-controls": "3.33.0-256",
45
- "@elementor/editor-current-user": "3.33.0-256",
46
- "@elementor/editor-editing-panel": "3.33.0-256",
47
- "@elementor/editor-mcp": "3.33.0-256",
48
- "@elementor/editor-panels": "3.33.0-256",
49
- "@elementor/editor-props": "3.33.0-256",
50
- "@elementor/editor-ui": "3.33.0-256",
51
- "@elementor/editor-v1-adapters": "3.33.0-256",
52
- "@elementor/http-client": "3.33.0-256",
42
+ "@elementor/editor": "3.33.0-258",
43
+ "@elementor/editor-canvas": "3.33.0-258",
44
+ "@elementor/editor-controls": "3.33.0-258",
45
+ "@elementor/editor-current-user": "3.33.0-258",
46
+ "@elementor/editor-editing-panel": "3.33.0-258",
47
+ "@elementor/editor-mcp": "3.33.0-258",
48
+ "@elementor/editor-panels": "3.33.0-258",
49
+ "@elementor/editor-props": "3.33.0-258",
50
+ "@elementor/editor-ui": "3.33.0-258",
51
+ "@elementor/editor-v1-adapters": "3.33.0-258",
52
+ "@elementor/http-client": "3.33.0-258",
53
53
  "@elementor/icons": "^1.61.0",
54
- "@elementor/mixpanel": "3.33.0-256",
55
- "@elementor/schema": "3.33.0-256",
54
+ "@elementor/mixpanel": "3.33.0-258",
55
+ "@elementor/schema": "3.33.0-258",
56
56
  "@elementor/ui": "1.36.17",
57
57
  "@wordpress/i18n": "^5.13.0"
58
58
  },
@@ -5,6 +5,7 @@ import { bindMenu, bindTrigger, IconButton, Menu, MenuItem, type PopupState, Typ
5
5
  import { __ } from '@wordpress/i18n';
6
6
 
7
7
  import { type TVariablesList } from '../../storage';
8
+ import { trackVariablesManagerEvent } from '../../utils/tracking';
8
9
  import { getVariableTypes } from '../../variables-registry/variable-type-registry';
9
10
 
10
11
  export const SIZE = 'tiny';
@@ -36,6 +37,7 @@ export const VariableManagerCreateMenu = ( {
36
37
  onClick: () => {
37
38
  const defaultName = getDefaultName( variables, key, variable.variableType );
38
39
  onCreate( key, defaultName, variable.defaultValue || '' );
40
+ trackVariablesManagerEvent( { action: 'add', varType: variable.variableType } );
39
41
  },
40
42
  };
41
43
  } );
@@ -24,7 +24,9 @@ import {
24
24
  } from '@elementor/ui';
25
25
  import { __ } from '@wordpress/i18n';
26
26
 
27
+ import { trackVariablesManagerEvent } from '../../utils/tracking';
27
28
  import { type ErrorResponse, type MappedError, mapServerError } from '../../utils/validations';
29
+ import { getVariableType } from '../../variables-registry/variable-type-registry';
28
30
  import { DeleteConfirmationDialog } from '../ui/delete-confirmation-dialog';
29
31
  import { EmptyState } from '../ui/empty-state';
30
32
  import { NoSearchResults } from '../ui/no-search-results';
@@ -104,7 +106,9 @@ export function VariablesManagerPanel() {
104
106
  setServerError( null );
105
107
  resetNavigation();
106
108
 
107
- return await handleSave();
109
+ const result = await handleSave();
110
+ trackVariablesManagerEvent( { action: 'saveChanges' } );
111
+ return result;
108
112
  } catch ( error ) {
109
113
  const mappedError = mapServerError( error as ErrorResponse );
110
114
  const duplicatedIds = mappedError?.action?.data?.duplicatedIds;
@@ -141,8 +145,12 @@ export function VariablesManagerPanel() {
141
145
  icon: TrashIcon,
142
146
  color: 'error.main',
143
147
  onClick: ( itemId: string ) => {
144
- if ( variables[ itemId ] ) {
145
- setDeleteConfirmation( { id: itemId, label: variables[ itemId ].label } );
148
+ const variable = variables[ itemId ];
149
+ if ( variable ) {
150
+ setDeleteConfirmation( { id: itemId, label: variable.label } );
151
+
152
+ const variableTypeOptions = getVariableType( variable.type );
153
+ trackVariablesManagerEvent( { action: 'delete', varType: variableTypeOptions?.variableType } );
146
154
  }
147
155
  },
148
156
  },
@@ -10,7 +10,7 @@ import { useVariableType } from '../context/variable-type-context';
10
10
  import { useFilteredVariables } from '../hooks/use-prop-variables';
11
11
  import { useVariableBoundProp } from '../hooks/use-variable-bound-prop';
12
12
  import { type ExtendedVirtualizedItem } from '../types';
13
- import { trackVariableEvent } from '../utils/tracking';
13
+ import { trackVariableEvent, trackVariablesManagerEvent } from '../utils/tracking';
14
14
  import { EmptyState } from './ui/empty-state';
15
15
  import { MenuItemContent } from './ui/menu-item-content';
16
16
  import { NoSearchResults } from './ui/no-search-results';
@@ -77,12 +77,21 @@ export const VariablesSelection = ( { closePopover, onAdd, onEdit, onSettings }:
77
77
  }
78
78
 
79
79
  if ( onSettings ) {
80
+ const handleOpenManager = () => {
81
+ onSettings();
82
+ trackVariablesManagerEvent( {
83
+ action: 'openManager',
84
+ varType: variableType,
85
+ controlPath: path.join( '.' ),
86
+ } );
87
+ };
88
+
80
89
  actions.push(
81
90
  <Tooltip key="settings" placement="top" title={ MANAGER_LABEL }>
82
91
  <IconButton
83
92
  id="variables-manager-button"
84
93
  size={ SIZE }
85
- onClick={ onSettings }
94
+ onClick={ handleOpenManager }
86
95
  aria-label={ MANAGER_LABEL }
87
96
  >
88
97
  <SettingsIcon fontSize={ SIZE } />
@@ -22,3 +22,33 @@ export const trackVariableEvent = ( { varType, controlPath, action }: VariableEv
22
22
  action_type: name,
23
23
  } );
24
24
  };
25
+
26
+ type VariablesManagerEventData = {
27
+ action: 'openManager' | 'add' | 'saveChanges' | 'delete';
28
+ varType?: string;
29
+ controlPath?: string;
30
+ };
31
+
32
+ export const trackVariablesManagerEvent = ( { action, varType, controlPath }: VariablesManagerEventData ) => {
33
+ const { dispatchEvent, config } = getMixpanel();
34
+ if ( ! config?.names?.variables?.[ action ] ) {
35
+ return;
36
+ }
37
+
38
+ const name = config.names.variables[ action ];
39
+ const eventData: Record< string, string > = {
40
+ location: config?.locations?.variablesManager || '',
41
+ trigger: config?.triggers?.click || '',
42
+ action_type: name,
43
+ };
44
+
45
+ if ( varType ) {
46
+ eventData.var_type = varType;
47
+ }
48
+
49
+ if ( controlPath ) {
50
+ eventData.style_control_path = controlPath;
51
+ }
52
+
53
+ dispatchEvent?.( name, eventData );
54
+ };