@elementor/editor-canvas 4.3.0-1015 → 4.3.0-1017

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 CHANGED
@@ -4134,11 +4134,10 @@ var import_http_client5 = require("@elementor/http-client");
4134
4134
  var DYNAMIC_TAGS_URI = "elementor://dynamic-tags";
4135
4135
  var MCP_PROXY_URL4 = "elementor/v1/mcp-proxy";
4136
4136
  var fetchDynamicTags = async () => {
4137
- const { data } = await (0, import_http_client5.httpService)().post(MCP_PROXY_URL4, {
4138
- tool: "list-dynamic-tags",
4139
- input: {}
4137
+ const { data } = await (0, import_http_client5.httpService)().get(MCP_PROXY_URL4, {
4138
+ params: { uri: DYNAMIC_TAGS_URI }
4140
4139
  });
4141
- return data.data ?? [];
4140
+ return data.data ?? "[]";
4142
4141
  };
4143
4142
  var initDynamicTagsResource = (reg) => {
4144
4143
  const { resource } = reg;
@@ -4150,13 +4149,12 @@ var initDynamicTagsResource = (reg) => {
4150
4149
  mimeType: "application/json"
4151
4150
  },
4152
4151
  async (uri) => {
4153
- const tags = await fetchDynamicTags();
4154
4152
  return {
4155
4153
  contents: [
4156
4154
  {
4157
4155
  uri: uri.href,
4158
4156
  mimeType: "application/json",
4159
- text: JSON.stringify(tags)
4157
+ text: await fetchDynamicTags()
4160
4158
  }
4161
4159
  ]
4162
4160
  };
package/dist/index.mjs CHANGED
@@ -4097,11 +4097,10 @@ import { httpService as httpService5 } from "@elementor/http-client";
4097
4097
  var DYNAMIC_TAGS_URI = "elementor://dynamic-tags";
4098
4098
  var MCP_PROXY_URL4 = "elementor/v1/mcp-proxy";
4099
4099
  var fetchDynamicTags = async () => {
4100
- const { data } = await httpService5().post(MCP_PROXY_URL4, {
4101
- tool: "list-dynamic-tags",
4102
- input: {}
4100
+ const { data } = await httpService5().get(MCP_PROXY_URL4, {
4101
+ params: { uri: DYNAMIC_TAGS_URI }
4103
4102
  });
4104
- return data.data ?? [];
4103
+ return data.data ?? "[]";
4105
4104
  };
4106
4105
  var initDynamicTagsResource = (reg) => {
4107
4106
  const { resource } = reg;
@@ -4113,13 +4112,12 @@ var initDynamicTagsResource = (reg) => {
4113
4112
  mimeType: "application/json"
4114
4113
  },
4115
4114
  async (uri) => {
4116
- const tags = await fetchDynamicTags();
4117
4115
  return {
4118
4116
  contents: [
4119
4117
  {
4120
4118
  uri: uri.href,
4121
4119
  mimeType: "application/json",
4122
- text: JSON.stringify(tags)
4120
+ text: await fetchDynamicTags()
4123
4121
  }
4124
4122
  ]
4125
4123
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@elementor/editor-canvas",
3
3
  "description": "Elementor Editor Canvas",
4
- "version": "4.3.0-1015",
4
+ "version": "4.3.0-1017",
5
5
  "private": false,
6
6
  "author": "Elementor Team",
7
7
  "homepage": "https://elementor.com/",
@@ -37,26 +37,26 @@
37
37
  "react-dom": "^18.3.1"
38
38
  },
39
39
  "dependencies": {
40
- "@elementor/editor": "4.3.0-1015",
41
- "@elementor/editor-controls": "4.3.0-1015",
42
- "@elementor/editor-documents": "4.3.0-1015",
43
- "@elementor/editor-elements": "4.3.0-1015",
44
- "@elementor/editor-interactions": "4.3.0-1015",
45
- "@elementor/editor-mcp": "4.3.0-1015",
46
- "@elementor/editor-notifications": "4.3.0-1015",
47
- "@elementor/editor-props": "4.3.0-1015",
48
- "@elementor/editor-responsive": "4.3.0-1015",
49
- "@elementor/editor-styles": "4.3.0-1015",
50
- "@elementor/editor-styles-repository": "4.3.0-1015",
51
- "@elementor/editor-ui": "4.3.0-1015",
52
- "@elementor/editor-v1-adapters": "4.3.0-1015",
53
- "@elementor/events": "4.3.0-1015",
54
- "@elementor/http-client": "4.3.0-1015",
55
- "@elementor/schema": "4.3.0-1015",
56
- "@elementor/twing": "4.3.0-1015",
40
+ "@elementor/editor": "4.3.0-1017",
41
+ "@elementor/editor-controls": "4.3.0-1017",
42
+ "@elementor/editor-documents": "4.3.0-1017",
43
+ "@elementor/editor-elements": "4.3.0-1017",
44
+ "@elementor/editor-interactions": "4.3.0-1017",
45
+ "@elementor/editor-mcp": "4.3.0-1017",
46
+ "@elementor/editor-notifications": "4.3.0-1017",
47
+ "@elementor/editor-props": "4.3.0-1017",
48
+ "@elementor/editor-responsive": "4.3.0-1017",
49
+ "@elementor/editor-styles": "4.3.0-1017",
50
+ "@elementor/editor-styles-repository": "4.3.0-1017",
51
+ "@elementor/editor-ui": "4.3.0-1017",
52
+ "@elementor/editor-v1-adapters": "4.3.0-1017",
53
+ "@elementor/events": "4.3.0-1017",
54
+ "@elementor/http-client": "4.3.0-1017",
55
+ "@elementor/schema": "4.3.0-1017",
56
+ "@elementor/twing": "4.3.0-1017",
57
57
  "@elementor/ui": "1.37.5",
58
- "@elementor/utils": "4.3.0-1015",
59
- "@elementor/wp-media": "4.3.0-1015",
58
+ "@elementor/utils": "4.3.0-1017",
59
+ "@elementor/wp-media": "4.3.0-1017",
60
60
  "@floating-ui/react": "^0.27.5",
61
61
  "@wordpress/i18n": "^5.13.0",
62
62
  "dompurify": "^3.2.6"
@@ -19,7 +19,7 @@ const captureHandler = (): ResourceHandler => {
19
19
  const readCatalog = async () => {
20
20
  const handler = captureHandler();
21
21
  const result = await handler( new URL( DYNAMIC_TAGS_URI ) );
22
- return JSON.parse( result.contents[ 0 ].text );
22
+ return result.contents[ 0 ].text;
23
23
  };
24
24
 
25
25
  describe( 'dynamic-tags-resource', () => {
@@ -27,31 +27,9 @@ describe( 'dynamic-tags-resource', () => {
27
27
  jest.clearAllMocks();
28
28
  } );
29
29
 
30
- it( 'returns the flat tag list fetched from the server', async () => {
30
+ it( 'returns the json string fetched from the server', async () => {
31
31
  // Arrange
32
- const post = jest.fn().mockResolvedValue( {
33
- data: {
34
- data: [
35
- {
36
- name: 'post-custom-field',
37
- label: 'Post Custom Field',
38
- categories: [ 'text', 'url' ],
39
- settings: { key: { mocked: true }, before: { mocked: true } },
40
- },
41
- ],
42
- },
43
- } );
44
- mockedHttpService.mockReturnValue( { post } as never );
45
-
46
- // Act
47
- const catalog = await readCatalog();
48
-
49
- // Assert
50
- expect( post ).toHaveBeenCalledWith( 'elementor/v1/mcp-proxy', {
51
- tool: 'list-dynamic-tags',
52
- input: {},
53
- } );
54
- expect( catalog ).toEqual( [
32
+ const serverJson = JSON.stringify( [
55
33
  {
56
34
  name: 'post-custom-field',
57
35
  label: 'Post Custom Field',
@@ -59,17 +37,31 @@ describe( 'dynamic-tags-resource', () => {
59
37
  settings: { key: { mocked: true }, before: { mocked: true } },
60
38
  },
61
39
  ] );
40
+
41
+ const get = jest.fn().mockResolvedValue( {
42
+ data: { data: serverJson },
43
+ } );
44
+ mockedHttpService.mockReturnValue( { get } as never );
45
+
46
+ // Act
47
+ const text = await readCatalog();
48
+
49
+ // Assert
50
+ expect( get ).toHaveBeenCalledWith( 'elementor/v1/mcp-proxy', {
51
+ params: { uri: DYNAMIC_TAGS_URI },
52
+ } );
53
+ expect( text ).toBe( serverJson );
62
54
  } );
63
55
 
64
- it( 'returns an empty list when the server returns no data', async () => {
56
+ it( 'returns an empty json array string when the server returns no data', async () => {
65
57
  // Arrange
66
- const post = jest.fn().mockResolvedValue( { data: {} } );
67
- mockedHttpService.mockReturnValue( { post } as never );
58
+ const get = jest.fn().mockResolvedValue( { data: {} } );
59
+ mockedHttpService.mockReturnValue( { get } as never );
68
60
 
69
61
  // Act
70
- const catalog = await readCatalog();
62
+ const text = await readCatalog();
71
63
 
72
64
  // Assert
73
- expect( catalog ).toEqual( [] );
65
+ expect( text ).toBe( '[]' );
74
66
  } );
75
67
  } );
@@ -5,20 +5,13 @@ export const DYNAMIC_TAGS_URI = 'elementor://dynamic-tags';
5
5
 
6
6
  const MCP_PROXY_URL = 'elementor/v1/mcp-proxy';
7
7
 
8
- type DynamicTagEntry = {
9
- name: string;
10
- label: string;
11
- categories: string[];
12
- settings: Record< string, unknown >;
13
- };
14
-
15
- const fetchDynamicTags = async (): Promise< DynamicTagEntry[] > => {
16
- const { data } = await httpService().post< HttpResponse< DynamicTagEntry[] > >( MCP_PROXY_URL, {
17
- tool: 'list-dynamic-tags',
18
- input: {},
8
+ // NOTE: JSON-encoded array of dynamic tag entries; shape defined by List_Dynamic_Tags_Ability::execute() in modules/mcp/abilities/list-dynamic-tags-ability.php
9
+ const fetchDynamicTags = async (): Promise< string > => {
10
+ const { data } = await httpService().get< HttpResponse< string > >( MCP_PROXY_URL, {
11
+ params: { uri: DYNAMIC_TAGS_URI },
19
12
  } );
20
13
 
21
- return data.data ?? [];
14
+ return data.data ?? '[]';
22
15
  };
23
16
 
24
17
  export const initDynamicTagsResource = ( reg: MCPRegistryEntry ) => {
@@ -35,14 +28,12 @@ export const initDynamicTagsResource = ( reg: MCPRegistryEntry ) => {
35
28
  mimeType: 'application/json',
36
29
  },
37
30
  async ( uri: URL ) => {
38
- const tags = await fetchDynamicTags();
39
-
40
31
  return {
41
32
  contents: [
42
33
  {
43
34
  uri: uri.href,
44
35
  mimeType: 'application/json',
45
- text: JSON.stringify( tags ),
36
+ text: await fetchDynamicTags(),
46
37
  },
47
38
  ],
48
39
  };