@elementor/editor-global-classes 4.1.0-719 → 4.1.0-721

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-global-classes",
3
- "version": "4.1.0-719",
3
+ "version": "4.1.0-721",
4
4
  "private": false,
5
5
  "author": "Elementor Team",
6
6
  "homepage": "https://elementor.com/",
@@ -39,28 +39,28 @@
39
39
  "dev": "tsup --config=../../tsup.dev.ts"
40
40
  },
41
41
  "dependencies": {
42
- "@elementor/editor": "4.1.0-719",
43
- "@elementor/editor-current-user": "4.1.0-719",
44
- "@elementor/editor-documents": "4.1.0-719",
45
- "@elementor/editor-editing-panel": "4.1.0-719",
46
- "@elementor/editor-mcp": "4.1.0-719",
47
- "@elementor/editor-panels": "4.1.0-719",
48
- "@elementor/editor-props": "4.1.0-719",
49
- "@elementor/editor-variables": "4.1.0-719",
50
- "@elementor/editor-styles": "4.1.0-719",
51
- "@elementor/editor-canvas": "4.1.0-719",
52
- "@elementor/editor-styles-repository": "4.1.0-719",
53
- "@elementor/editor-ui": "4.1.0-719",
54
- "@elementor/editor-v1-adapters": "4.1.0-719",
55
- "@elementor/http-client": "4.1.0-719",
42
+ "@elementor/editor": "4.1.0-721",
43
+ "@elementor/editor-current-user": "4.1.0-721",
44
+ "@elementor/editor-documents": "4.1.0-721",
45
+ "@elementor/editor-editing-panel": "4.1.0-721",
46
+ "@elementor/editor-mcp": "4.1.0-721",
47
+ "@elementor/editor-panels": "4.1.0-721",
48
+ "@elementor/editor-props": "4.1.0-721",
49
+ "@elementor/editor-variables": "4.1.0-721",
50
+ "@elementor/editor-styles": "4.1.0-721",
51
+ "@elementor/editor-canvas": "4.1.0-721",
52
+ "@elementor/editor-styles-repository": "4.1.0-721",
53
+ "@elementor/editor-ui": "4.1.0-721",
54
+ "@elementor/editor-v1-adapters": "4.1.0-721",
55
+ "@elementor/http-client": "4.1.0-721",
56
56
  "@elementor/icons": "^1.68.0",
57
- "@elementor/query": "4.1.0-719",
58
- "@elementor/schema": "4.1.0-719",
59
- "@elementor/store": "4.1.0-719",
57
+ "@elementor/query": "4.1.0-721",
58
+ "@elementor/schema": "4.1.0-721",
59
+ "@elementor/store": "4.1.0-721",
60
60
  "@elementor/ui": "1.36.17",
61
- "@elementor/utils": "4.1.0-719",
61
+ "@elementor/utils": "4.1.0-721",
62
62
  "@wordpress/i18n": "^5.13.0",
63
- "@elementor/events": "4.1.0-719"
63
+ "@elementor/events": "4.1.0-721"
64
64
  },
65
65
  "peerDependencies": {
66
66
  "react": "^18.3.1",
@@ -34,6 +34,7 @@ import { useDirtyState } from '../../hooks/use-dirty-state';
34
34
  import { useFilters } from '../../hooks/use-filters';
35
35
  import { saveGlobalClasses } from '../../save-global-classes';
36
36
  import { slice } from '../../store';
37
+ import { trackGlobalClasses } from '../../utils/tracking';
37
38
  import { ActiveFilters } from '../search-and-filter/components/filter/active-filters';
38
39
  import { CssClassFilter } from '../search-and-filter/components/filter/css-class-filter';
39
40
  import { ClassManagerSearch } from '../search-and-filter/components/search/class-manager-search';
@@ -113,6 +114,7 @@ export function ClassManagerPanel() {
113
114
  },
114
115
  } )
115
116
  );
117
+ trackGlobalClasses( { event: 'classSyncToV3', classId, action: 'unsync' } );
116
118
  setStopSyncConfirmation( null );
117
119
  }, [] );
118
120
 
@@ -125,6 +127,7 @@ export function ClassManagerPanel() {
125
127
  },
126
128
  } )
127
129
  );
130
+ trackGlobalClasses( { event: 'classSyncToV3', classId, action: 'sync' } );
128
131
  setStartSyncConfirmation( null );
129
132
  }, [] );
130
133
 
@@ -221,6 +224,7 @@ export function ClassManagerPanel() {
221
224
  { startSyncConfirmation && (
222
225
  <StartSyncToV3Modal
223
226
  externalOpen
227
+ classId={ startSyncConfirmation }
224
228
  onExternalClose={ () => setStartSyncConfirmation( null ) }
225
229
  onConfirm={ () => handleStartSync( startSyncConfirmation ) }
226
230
  />
@@ -1,5 +1,5 @@
1
1
  import * as React from 'react';
2
- import { useState } from 'react';
2
+ import { useEffect, useRef, useState } from 'react';
3
3
  import {
4
4
  Box,
5
5
  Button,
@@ -12,22 +12,48 @@ import {
12
12
  } from '@elementor/ui';
13
13
  import { __ } from '@wordpress/i18n';
14
14
 
15
+ import { trackGlobalClasses } from '../../utils/tracking';
16
+
15
17
  const IMAGE_URL = 'https://assets.elementor.com/packages/v1/images/class-manager-sync-modal.png';
16
18
 
17
19
  type StartSyncToV3ModalProps = {
18
20
  externalOpen?: boolean;
21
+ classId?: string;
19
22
  onExternalClose?: () => void;
20
23
  onConfirm?: () => void;
21
24
  };
22
25
 
23
- export const StartSyncToV3Modal = ( { externalOpen, onExternalClose, onConfirm }: StartSyncToV3ModalProps = {} ) => {
26
+ export const StartSyncToV3Modal = ( {
27
+ externalOpen,
28
+ classId,
29
+ onExternalClose,
30
+ onConfirm,
31
+ }: StartSyncToV3ModalProps = {} ) => {
24
32
  const [ shouldShowAgain, setShouldShowAgain ] = useState( true );
33
+ const hasTrackedExposure = useRef( false );
34
+
35
+ useEffect( () => {
36
+ if ( externalOpen && classId && ! hasTrackedExposure.current ) {
37
+ hasTrackedExposure.current = true;
38
+ trackGlobalClasses( { event: 'classSyncToV3PopupShown', classId } );
39
+ }
40
+
41
+ if ( ! externalOpen ) {
42
+ hasTrackedExposure.current = false;
43
+ }
44
+ }, [ externalOpen, classId ] );
25
45
 
26
46
  const handleClose = () => {
47
+ if ( classId ) {
48
+ trackGlobalClasses( { event: 'classSyncToV3PopupClick', classId, action: 'cancel' } );
49
+ }
27
50
  onExternalClose?.();
28
51
  };
29
52
 
30
53
  const handleConfirm = () => {
54
+ if ( classId ) {
55
+ trackGlobalClasses( { event: 'classSyncToV3PopupClick', classId, action: 'sync' } );
56
+ }
31
57
  onConfirm?.();
32
58
  onExternalClose?.();
33
59
  };
@@ -72,6 +72,17 @@ type EventMap = {
72
72
  type: string;
73
73
  source: 'global' | 'local';
74
74
  };
75
+ classSyncToV3PopupShown: {
76
+ classId: StyleDefinitionID;
77
+ };
78
+ classSyncToV3: {
79
+ classId: StyleDefinitionID;
80
+ action: 'sync' | 'unsync';
81
+ };
82
+ classSyncToV3PopupClick: {
83
+ classId: StyleDefinitionID;
84
+ action: 'sync' | 'cancel';
85
+ };
75
86
  };
76
87
 
77
88
  export type TrackingEvent = {
@@ -138,6 +149,43 @@ const getSanitizedData = async ( payload: TrackingEvent ): Promise< Record< stri
138
149
  return { ...payload, classTitle: getCssClass( payload.classId ).label };
139
150
  }
140
151
  break;
152
+ case 'classSyncToV3PopupShown':
153
+ return {
154
+ ...payload,
155
+ interaction_type: 'popup_shown',
156
+ target_type: 'popup',
157
+ target_name: 'sync_to_v3_popup',
158
+ interaction_result: 'popup_viewed',
159
+ target_location: 'widget_panel',
160
+ location_l1: 'class_manager',
161
+ };
162
+ case 'classSyncToV3': {
163
+ const classLabel = getCssClass( payload.classId ).label;
164
+ const isSync = payload.action === 'sync';
165
+ return {
166
+ ...payload,
167
+ interaction_type: 'click',
168
+ target_type: classLabel,
169
+ target_name: isSync ? 'sync_to_v3' : 'unsync_to_v3',
170
+ interaction_result: isSync ? 'class_is_synced_to_V3' : 'class_is_unsynced_from_V3',
171
+ target_location: 'widget_panel',
172
+ location_l1: 'class_manager',
173
+ interaction_description: isSync
174
+ ? `user_synced_${ classLabel }_to_v3`
175
+ : `user_unsync_${ classLabel }_from_v3`,
176
+ };
177
+ }
178
+ case 'classSyncToV3PopupClick': {
179
+ const isSyncAction = payload.action === 'sync';
180
+ return {
181
+ ...payload,
182
+ interaction_type: 'click',
183
+ target_type: 'button',
184
+ target_name: isSyncAction ? 'sync_to_v3' : 'cancel',
185
+ interaction_result: isSyncAction ? 'class_is_synced' : 'cancel',
186
+ target_location: 'sync_to_v3_popup',
187
+ };
188
+ }
141
189
  default:
142
190
  return payload;
143
191
  }