@elementor/editor-global-classes 4.1.0-720 → 4.1.0-722
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/dist/index.js +78 -16
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +90 -28
- package/dist/index.mjs.map +1 -1
- package/package.json +20 -20
- package/src/components/class-manager/class-manager-panel.tsx +4 -0
- package/src/components/class-manager/start-sync-to-v3-modal.tsx +28 -2
- package/src/init.ts +5 -1
- package/src/mcp-integration/classes-resource.ts +2 -5
- package/src/mcp-integration/index.ts +13 -6
- package/src/utils/tracking.ts +48 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elementor/editor-global-classes",
|
|
3
|
-
"version": "4.1.0-
|
|
3
|
+
"version": "4.1.0-722",
|
|
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-
|
|
43
|
-
"@elementor/editor-current-user": "4.1.0-
|
|
44
|
-
"@elementor/editor-documents": "4.1.0-
|
|
45
|
-
"@elementor/editor-editing-panel": "4.1.0-
|
|
46
|
-
"@elementor/editor-mcp": "4.1.0-
|
|
47
|
-
"@elementor/editor-panels": "4.1.0-
|
|
48
|
-
"@elementor/editor-props": "4.1.0-
|
|
49
|
-
"@elementor/editor-variables": "4.1.0-
|
|
50
|
-
"@elementor/editor-styles": "4.1.0-
|
|
51
|
-
"@elementor/editor-canvas": "4.1.0-
|
|
52
|
-
"@elementor/editor-styles-repository": "4.1.0-
|
|
53
|
-
"@elementor/editor-ui": "4.1.0-
|
|
54
|
-
"@elementor/editor-v1-adapters": "4.1.0-
|
|
55
|
-
"@elementor/http-client": "4.1.0-
|
|
42
|
+
"@elementor/editor": "4.1.0-722",
|
|
43
|
+
"@elementor/editor-current-user": "4.1.0-722",
|
|
44
|
+
"@elementor/editor-documents": "4.1.0-722",
|
|
45
|
+
"@elementor/editor-editing-panel": "4.1.0-722",
|
|
46
|
+
"@elementor/editor-mcp": "4.1.0-722",
|
|
47
|
+
"@elementor/editor-panels": "4.1.0-722",
|
|
48
|
+
"@elementor/editor-props": "4.1.0-722",
|
|
49
|
+
"@elementor/editor-variables": "4.1.0-722",
|
|
50
|
+
"@elementor/editor-styles": "4.1.0-722",
|
|
51
|
+
"@elementor/editor-canvas": "4.1.0-722",
|
|
52
|
+
"@elementor/editor-styles-repository": "4.1.0-722",
|
|
53
|
+
"@elementor/editor-ui": "4.1.0-722",
|
|
54
|
+
"@elementor/editor-v1-adapters": "4.1.0-722",
|
|
55
|
+
"@elementor/http-client": "4.1.0-722",
|
|
56
56
|
"@elementor/icons": "^1.68.0",
|
|
57
|
-
"@elementor/query": "4.1.0-
|
|
58
|
-
"@elementor/schema": "4.1.0-
|
|
59
|
-
"@elementor/store": "4.1.0-
|
|
57
|
+
"@elementor/query": "4.1.0-722",
|
|
58
|
+
"@elementor/schema": "4.1.0-722",
|
|
59
|
+
"@elementor/store": "4.1.0-722",
|
|
60
60
|
"@elementor/ui": "1.36.17",
|
|
61
|
-
"@elementor/utils": "4.1.0-
|
|
61
|
+
"@elementor/utils": "4.1.0-722",
|
|
62
62
|
"@wordpress/i18n": "^5.13.0",
|
|
63
|
-
"@elementor/events": "4.1.0-
|
|
63
|
+
"@elementor/events": "4.1.0-722"
|
|
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 = ( {
|
|
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
|
};
|
package/src/init.ts
CHANGED
|
@@ -4,6 +4,7 @@ import {
|
|
|
4
4
|
injectIntoCssClassConvert,
|
|
5
5
|
registerStyleProviderToColors,
|
|
6
6
|
} from '@elementor/editor-editing-panel';
|
|
7
|
+
import { getMCPByDomain } from '@elementor/editor-mcp';
|
|
7
8
|
import { __registerPanel as registerPanel } from '@elementor/editor-panels';
|
|
8
9
|
import { stylesRepository } from '@elementor/editor-styles-repository';
|
|
9
10
|
import { __registerSlice as registerSlice } from '@elementor/store';
|
|
@@ -66,5 +67,8 @@ export function init() {
|
|
|
66
67
|
getThemeColor: ( theme ) => theme.palette.global.dark,
|
|
67
68
|
} );
|
|
68
69
|
|
|
69
|
-
initMcpIntegration(
|
|
70
|
+
initMcpIntegration(
|
|
71
|
+
getMCPByDomain( 'classes', { instructions: 'MCP server for management of Elementor global classes' } ),
|
|
72
|
+
getMCPByDomain( 'canvas' )
|
|
73
|
+
);
|
|
70
74
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { type MCPRegistryEntry } from '@elementor/editor-mcp';
|
|
2
2
|
|
|
3
3
|
import { globalClassesStylesProvider } from '../global-classes-styles-provider';
|
|
4
4
|
|
|
@@ -12,10 +12,7 @@ const updateLocalStorageCache = () => {
|
|
|
12
12
|
localStorage.setItem( STORAGE_KEY, JSON.stringify( classes ) );
|
|
13
13
|
};
|
|
14
14
|
|
|
15
|
-
export const initClassesResource = () => {
|
|
16
|
-
const canvasMcpEntry = getMCPByDomain( 'canvas' );
|
|
17
|
-
const classesMcpEntry = getMCPByDomain( 'classes' );
|
|
18
|
-
|
|
15
|
+
export const initClassesResource = ( classesMcpEntry: MCPRegistryEntry, canvasMcpEntry: MCPRegistryEntry ) => {
|
|
19
16
|
[ canvasMcpEntry, classesMcpEntry ].forEach( ( entry ) => {
|
|
20
17
|
const { mcpServer, resource, waitForReady } = entry;
|
|
21
18
|
resource(
|
|
@@ -1,16 +1,23 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { type MCPRegistryEntry } from '@elementor/editor-mcp';
|
|
2
2
|
|
|
3
3
|
import { initClassesResource } from './classes-resource';
|
|
4
4
|
import initMcpApplyUnapplyGlobalClasses from './mcp-apply-unapply-global-classes';
|
|
5
5
|
import initMcpApplyGetGlobalClassUsages from './mcp-get-global-class-usages';
|
|
6
6
|
import { initManageGlobalClasses } from './mcp-manage-global-classes';
|
|
7
7
|
|
|
8
|
-
export const initMcpIntegration = () => {
|
|
9
|
-
const
|
|
10
|
-
|
|
11
|
-
|
|
8
|
+
export const initMcpIntegration = ( reg: MCPRegistryEntry, canvasMcpEntry: MCPRegistryEntry ) => {
|
|
9
|
+
const { setMCPDescription } = reg;
|
|
10
|
+
setMCPDescription(
|
|
11
|
+
`Everything related to V4 ( Atomic ) global classes.
|
|
12
|
+
# Global classes
|
|
13
|
+
- Create/update/delete global classes
|
|
14
|
+
- Get list of global classes
|
|
15
|
+
- Get details of a global class
|
|
16
|
+
- Get details of a global class
|
|
17
|
+
`
|
|
18
|
+
);
|
|
12
19
|
initMcpApplyUnapplyGlobalClasses( reg );
|
|
13
20
|
initMcpApplyGetGlobalClassUsages( reg );
|
|
14
21
|
initManageGlobalClasses( reg );
|
|
15
|
-
initClassesResource();
|
|
22
|
+
initClassesResource( reg, canvasMcpEntry );
|
|
16
23
|
};
|
package/src/utils/tracking.ts
CHANGED
|
@@ -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
|
}
|