@sweepypanda/wp-elementor-mcp 1.7.1
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/LICENSE +21 -0
- package/README.md +381 -0
- package/client-config.json +13 -0
- package/dist/elementor-handler.d.ts +51 -0
- package/dist/elementor-handler.d.ts.map +1 -0
- package/dist/elementor-handler.js +358 -0
- package/dist/elementor-handler.js.map +1 -0
- package/dist/helpers.d.ts +24 -0
- package/dist/helpers.d.ts.map +1 -0
- package/dist/helpers.js +107 -0
- package/dist/helpers.js.map +1 -0
- package/dist/index-backup.d.ts +3 -0
- package/dist/index-backup.d.ts.map +1 -0
- package/dist/index-backup.js +3752 -0
- package/dist/index-backup.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +187 -0
- package/dist/index.js.map +1 -0
- package/dist/server-config.d.ts +80 -0
- package/dist/server-config.d.ts.map +1 -0
- package/dist/server-config.js +137 -0
- package/dist/server-config.js.map +1 -0
- package/dist/tool-handlers.d.ts +44 -0
- package/dist/tool-handlers.d.ts.map +1 -0
- package/dist/tool-handlers.js +1682 -0
- package/dist/tool-handlers.js.map +1 -0
- package/dist/tool-schemas.d.ts +859 -0
- package/dist/tool-schemas.d.ts.map +1 -0
- package/dist/tool-schemas.js +870 -0
- package/dist/tool-schemas.js.map +1 -0
- package/dist/types.d.ts +19 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +2 -0
- package/dist/types.js.map +1 -0
- package/dist/utils.d.ts +10 -0
- package/dist/utils.d.ts.map +1 -0
- package/dist/utils.js +142 -0
- package/dist/utils.js.map +1 -0
- package/dist/wordpress-client.d.ts +21 -0
- package/dist/wordpress-client.d.ts.map +1 -0
- package/dist/wordpress-client.js +151 -0
- package/dist/wordpress-client.js.map +1 -0
- package/package.json +74 -0
|
@@ -0,0 +1,358 @@
|
|
|
1
|
+
import { TempFileManager } from './utils.js';
|
|
2
|
+
import { ResponseHelpers } from './helpers.js';
|
|
3
|
+
export class ElementorDataHandler {
|
|
4
|
+
wordPressClient;
|
|
5
|
+
constructor(wordPressClient) {
|
|
6
|
+
this.wordPressClient = wordPressClient;
|
|
7
|
+
}
|
|
8
|
+
// Safe method to get raw Elementor data directly from WordPress
|
|
9
|
+
async safeGetElementorData(postId) {
|
|
10
|
+
const authCheck = this.wordPressClient.ensureAuthenticated();
|
|
11
|
+
if (authCheck) {
|
|
12
|
+
return {
|
|
13
|
+
success: false,
|
|
14
|
+
error: 'WordPress connection not configured',
|
|
15
|
+
debugInfo: 'Authentication check failed'
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
try {
|
|
19
|
+
console.error(`🔍 Getting raw Elementor data for post ID: ${postId}`);
|
|
20
|
+
const axios = this.wordPressClient.getAxiosInstance();
|
|
21
|
+
// Try to get as post first, then as page if that fails
|
|
22
|
+
let response;
|
|
23
|
+
let postType = 'post';
|
|
24
|
+
try {
|
|
25
|
+
response = await axios.get(`posts/${postId}`, {
|
|
26
|
+
params: { context: 'edit' }
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
catch (postError) {
|
|
30
|
+
if (postError.response?.status === 404) {
|
|
31
|
+
try {
|
|
32
|
+
response = await axios.get(`pages/${postId}`, {
|
|
33
|
+
params: { context: 'edit' }
|
|
34
|
+
});
|
|
35
|
+
postType = 'page';
|
|
36
|
+
}
|
|
37
|
+
catch (pageError) {
|
|
38
|
+
return {
|
|
39
|
+
success: false,
|
|
40
|
+
error: `Post/Page ID ${postId} not found in either posts or pages`,
|
|
41
|
+
debugInfo: `Post error: ${postError.response?.status}, Page error: ${pageError.response?.status}`
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
else {
|
|
46
|
+
throw postError;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
// Extract Elementor data directly
|
|
50
|
+
const data = response.data;
|
|
51
|
+
const elementorData = data.meta?._elementor_data;
|
|
52
|
+
const elementorEditMode = data.meta?._elementor_edit_mode;
|
|
53
|
+
if (elementorData) {
|
|
54
|
+
try {
|
|
55
|
+
const parsedData = JSON.parse(elementorData);
|
|
56
|
+
return {
|
|
57
|
+
success: true,
|
|
58
|
+
data: parsedData,
|
|
59
|
+
debugInfo: `Successfully retrieved ${Array.isArray(parsedData) ? parsedData.length : 0} elements for ${postType} ${postId}`
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
catch (parseError) {
|
|
63
|
+
return {
|
|
64
|
+
success: false,
|
|
65
|
+
error: 'Failed to parse Elementor data JSON',
|
|
66
|
+
debugInfo: `JSON parsing error: ${parseError}`
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
else {
|
|
71
|
+
return {
|
|
72
|
+
success: false,
|
|
73
|
+
error: `No Elementor data found for ${postType} ID ${postId}`,
|
|
74
|
+
debugInfo: `Edit mode: ${elementorEditMode || 'None'}, Available meta keys: ${data.meta ? Object.keys(data.meta).join(', ') : 'None'}`
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
catch (error) {
|
|
79
|
+
return {
|
|
80
|
+
success: false,
|
|
81
|
+
error: `Failed to retrieve Elementor data: ${error.message}`,
|
|
82
|
+
debugInfo: `API call error: ${error.stack}`
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
// NEW: Get Elementor data and write to temp file
|
|
87
|
+
async getElementorDataToFile(args) {
|
|
88
|
+
try {
|
|
89
|
+
console.error(`📁 Getting Elementor data for post ${args.post_id} and writing to temp file...`);
|
|
90
|
+
// Use the existing safe method to get Elementor data
|
|
91
|
+
const parsedData = await this.safeGetElementorData(args.post_id);
|
|
92
|
+
if (!parsedData.success) {
|
|
93
|
+
return {
|
|
94
|
+
content: [{
|
|
95
|
+
type: 'text',
|
|
96
|
+
text: JSON.stringify({
|
|
97
|
+
status: 'error',
|
|
98
|
+
data: {
|
|
99
|
+
message: `Error getting Elementor data: ${parsedData.error}`,
|
|
100
|
+
code: 'elementor_data_error',
|
|
101
|
+
tool: 'get_elementor_data_to_file'
|
|
102
|
+
}
|
|
103
|
+
}, null, 2)
|
|
104
|
+
}]
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
// Write to temp file
|
|
108
|
+
const tempFileResult = TempFileManager.writeElementorDataToFile(args.post_id, parsedData.data);
|
|
109
|
+
console.error(`✅ Elementor data written to temp file: ${tempFileResult.file_path}`);
|
|
110
|
+
console.error(`📊 File size: ${tempFileResult.size_bytes} bytes`);
|
|
111
|
+
return {
|
|
112
|
+
content: [{
|
|
113
|
+
type: 'text',
|
|
114
|
+
text: JSON.stringify(tempFileResult, null, 2)
|
|
115
|
+
}]
|
|
116
|
+
};
|
|
117
|
+
}
|
|
118
|
+
catch (error) {
|
|
119
|
+
console.error(`❌ Error writing Elementor data to temp file: ${error.message}`);
|
|
120
|
+
return {
|
|
121
|
+
content: [{
|
|
122
|
+
type: 'text',
|
|
123
|
+
text: JSON.stringify({
|
|
124
|
+
status: 'error',
|
|
125
|
+
data: {
|
|
126
|
+
message: error.message,
|
|
127
|
+
code: 'elementor_data_file_error',
|
|
128
|
+
tool: 'get_elementor_data_to_file'
|
|
129
|
+
}
|
|
130
|
+
}, null, 2)
|
|
131
|
+
}]
|
|
132
|
+
};
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
// NEW: Get page structure and write to temp file
|
|
136
|
+
async getPageStructureToFile(args) {
|
|
137
|
+
try {
|
|
138
|
+
console.error(`📁 Getting page structure for post ${args.post_id} and writing to temp file...`);
|
|
139
|
+
// Get page structure first
|
|
140
|
+
const structureResponse = await this.getPageStructure(args);
|
|
141
|
+
const structureData = JSON.parse(structureResponse.content[0].text);
|
|
142
|
+
// Write to temp file
|
|
143
|
+
const tempFileResult = TempFileManager.writeElementorDataToFile(args.post_id, structureData);
|
|
144
|
+
console.error(`✅ Page structure written to temp file: ${tempFileResult.file_path}`);
|
|
145
|
+
console.error(`📊 File size: ${tempFileResult.size_bytes} bytes`);
|
|
146
|
+
return {
|
|
147
|
+
content: [{
|
|
148
|
+
type: 'text',
|
|
149
|
+
text: JSON.stringify(tempFileResult, null, 2)
|
|
150
|
+
}]
|
|
151
|
+
};
|
|
152
|
+
}
|
|
153
|
+
catch (error) {
|
|
154
|
+
console.error(`❌ Error writing page structure to temp file: ${error.message}`);
|
|
155
|
+
return {
|
|
156
|
+
content: [{
|
|
157
|
+
type: 'text',
|
|
158
|
+
text: JSON.stringify({
|
|
159
|
+
status: 'error',
|
|
160
|
+
data: {
|
|
161
|
+
message: error.message,
|
|
162
|
+
code: 'page_structure_file_error',
|
|
163
|
+
tool: 'get_page_structure_to_file'
|
|
164
|
+
}
|
|
165
|
+
}, null, 2)
|
|
166
|
+
}]
|
|
167
|
+
};
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
// NEW: Backup Elementor data to temp file
|
|
171
|
+
async backupElementorDataToFile(args) {
|
|
172
|
+
try {
|
|
173
|
+
console.error(`📁 Creating backup of Elementor data for post ${args.post_id} to temp file...`);
|
|
174
|
+
// Get the full Elementor data
|
|
175
|
+
const dataResponse = await this.getElementorDataToFile({ post_id: args.post_id });
|
|
176
|
+
const tempFileInfo = JSON.parse(dataResponse.content[0].text);
|
|
177
|
+
console.error(`✅ Backup created at: ${tempFileInfo.file_path}`);
|
|
178
|
+
return {
|
|
179
|
+
content: [{
|
|
180
|
+
type: 'text',
|
|
181
|
+
text: JSON.stringify({
|
|
182
|
+
...tempFileInfo,
|
|
183
|
+
backup_name: args.backup_name || `backup-${new Date().toISOString()}`,
|
|
184
|
+
backup_type: 'full_elementor_data'
|
|
185
|
+
}, null, 2)
|
|
186
|
+
}]
|
|
187
|
+
};
|
|
188
|
+
}
|
|
189
|
+
catch (error) {
|
|
190
|
+
console.error(`❌ Error creating Elementor data backup: ${error.message}`);
|
|
191
|
+
return {
|
|
192
|
+
content: [{
|
|
193
|
+
type: 'text',
|
|
194
|
+
text: JSON.stringify({
|
|
195
|
+
status: 'error',
|
|
196
|
+
data: {
|
|
197
|
+
message: error.message,
|
|
198
|
+
code: 'backup_elementor_data_error',
|
|
199
|
+
tool: 'backup_elementor_data_to_file'
|
|
200
|
+
}
|
|
201
|
+
}, null, 2)
|
|
202
|
+
}]
|
|
203
|
+
};
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
async getElementorData(args) {
|
|
207
|
+
const authCheck = this.wordPressClient.ensureAuthenticated();
|
|
208
|
+
if (authCheck)
|
|
209
|
+
return authCheck;
|
|
210
|
+
return this.wordPressClient.safeApiCall(async () => {
|
|
211
|
+
console.error(`Getting Elementor data for ID: ${args.post_id}`);
|
|
212
|
+
const axios = this.wordPressClient.getAxiosInstance();
|
|
213
|
+
// Try to get as post first, then as page if that fails
|
|
214
|
+
let response;
|
|
215
|
+
let postType = 'post';
|
|
216
|
+
let debugInfo = '';
|
|
217
|
+
try {
|
|
218
|
+
console.error(`Trying to fetch as post: posts/${args.post_id}`);
|
|
219
|
+
response = await axios.get(`posts/${args.post_id}`, {
|
|
220
|
+
params: { context: 'edit' }
|
|
221
|
+
});
|
|
222
|
+
debugInfo += `Found as post (ID: ${args.post_id})\n`;
|
|
223
|
+
}
|
|
224
|
+
catch (postError) {
|
|
225
|
+
console.error(`Post fetch failed: ${postError.response?.status} - ${postError.response?.statusText}`);
|
|
226
|
+
if (postError.response?.status === 404) {
|
|
227
|
+
// Try as page
|
|
228
|
+
try {
|
|
229
|
+
console.error(`Trying to fetch as page: pages/${args.post_id}`);
|
|
230
|
+
response = await axios.get(`pages/${args.post_id}`, {
|
|
231
|
+
params: { context: 'edit' }
|
|
232
|
+
});
|
|
233
|
+
postType = 'page';
|
|
234
|
+
debugInfo += `Found as page (ID: ${args.post_id})\n`;
|
|
235
|
+
}
|
|
236
|
+
catch (pageError) {
|
|
237
|
+
console.error(`Page fetch failed: ${pageError.response?.status} - ${pageError.response?.statusText}`);
|
|
238
|
+
const errorDetails = `
|
|
239
|
+
❌ Post/Page ID ${args.post_id} not found
|
|
240
|
+
|
|
241
|
+
Debug Information:
|
|
242
|
+
- Tried as post: ${postError.response?.status} ${postError.response?.statusText}
|
|
243
|
+
- Tried as page: ${pageError.response?.status} ${pageError.response?.statusText}
|
|
244
|
+
|
|
245
|
+
Suggestions:
|
|
246
|
+
1. Verify the ID exists by running get_posts or get_pages
|
|
247
|
+
2. Check if the ID might be a custom post type
|
|
248
|
+
3. Ensure the post/page is not trashed
|
|
249
|
+
4. Verify your user permissions include access to this content
|
|
250
|
+
`;
|
|
251
|
+
return ResponseHelpers.createErrorResponse(errorDetails.trim(), "POST_PAGE_NOT_FOUND", "NOT_FOUND", "Post/Page ID not found in either posts or pages endpoints");
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
else {
|
|
255
|
+
throw postError;
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
// Analyze the response for Elementor data
|
|
259
|
+
const data = response.data;
|
|
260
|
+
console.error(`Response received for ${postType} ${args.post_id}`);
|
|
261
|
+
console.error(`Meta keys available: ${data.meta ? Object.keys(data.meta).join(', ') : 'None'}`);
|
|
262
|
+
const elementorData = data.meta?._elementor_data;
|
|
263
|
+
const elementorEditMode = data.meta?._elementor_edit_mode;
|
|
264
|
+
const elementorVersion = data.meta?._elementor_version;
|
|
265
|
+
const elementorPageSettings = data.meta?._elementor_page_settings;
|
|
266
|
+
debugInfo += `Title: "${data.title.rendered}"\n`;
|
|
267
|
+
debugInfo += `Status: ${data.status}\n`;
|
|
268
|
+
debugInfo += `Type: ${postType}\n`;
|
|
269
|
+
debugInfo += `Edit Mode: ${elementorEditMode || 'None'}\n`;
|
|
270
|
+
debugInfo += `Version: ${elementorVersion || 'None'}\n`;
|
|
271
|
+
debugInfo += `Has Page Settings: ${elementorPageSettings ? 'Yes' : 'No'}\n`;
|
|
272
|
+
debugInfo += `Has Elementor Data: ${elementorData ? 'Yes' : 'No'}\n`;
|
|
273
|
+
if (elementorData) {
|
|
274
|
+
try {
|
|
275
|
+
const parsedData = JSON.parse(elementorData);
|
|
276
|
+
debugInfo += `Elementor Elements Count: ${Array.isArray(parsedData) ? parsedData.length : 'Not an array'}\n`;
|
|
277
|
+
return ResponseHelpers.createSuccessResponse({
|
|
278
|
+
post_id: args.post_id,
|
|
279
|
+
post_type: postType,
|
|
280
|
+
title: data.title?.rendered || data.title?.raw || 'Unknown',
|
|
281
|
+
status: data.status,
|
|
282
|
+
edit_mode: elementorEditMode,
|
|
283
|
+
elementor_data: parsedData,
|
|
284
|
+
metadata: {
|
|
285
|
+
has_page_settings: !!data.meta?._elementor_page_settings,
|
|
286
|
+
has_elementor_data: true,
|
|
287
|
+
elements_count: Array.isArray(parsedData) ? parsedData.length : 0,
|
|
288
|
+
version: elementorVersion
|
|
289
|
+
}
|
|
290
|
+
}, `Successfully retrieved Elementor data for ${postType} ID ${args.post_id} with ${Array.isArray(parsedData) ? parsedData.length : 0} elements`);
|
|
291
|
+
}
|
|
292
|
+
catch (parseError) {
|
|
293
|
+
debugInfo += `⚠️ Elementor data found but failed to parse JSON\n`;
|
|
294
|
+
return ResponseHelpers.createErrorResponse(`Failed to parse Elementor data for ${postType} ID ${args.post_id}: JSON parsing error`, 'PARSE_ERROR', 'DATA_FORMAT_ERROR', `${debugInfo}\nRaw data: ${elementorData?.substring(0, 200)}...`);
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
else {
|
|
298
|
+
// Check if this is an Elementor page without data
|
|
299
|
+
if (elementorEditMode === 'builder') {
|
|
300
|
+
debugInfo += `\n⚠️ This appears to be an Elementor page but has no data.\n`;
|
|
301
|
+
debugInfo += `Possible reasons:\n`;
|
|
302
|
+
debugInfo += `- Empty Elementor page\n`;
|
|
303
|
+
debugInfo += `- Cache/synchronization issue\n`;
|
|
304
|
+
debugInfo += `- Elementor data stored differently\n`;
|
|
305
|
+
}
|
|
306
|
+
else {
|
|
307
|
+
debugInfo += `\n❌ This ${postType} does not use Elementor builder.\n`;
|
|
308
|
+
}
|
|
309
|
+
return ResponseHelpers.createErrorResponse(`No Elementor data found for ${postType} ID ${args.post_id}`, 'NO_ELEMENTOR_DATA', 'DATA_NOT_FOUND', `${debugInfo}\nAvailable meta keys: ${data.meta ? Object.keys(data.meta).join(', ') : 'None'}`);
|
|
310
|
+
}
|
|
311
|
+
}, 'getElementorData', `post/page ID ${args.post_id}`);
|
|
312
|
+
}
|
|
313
|
+
async getPageStructure(args) {
|
|
314
|
+
const authCheck = this.wordPressClient.ensureAuthenticated();
|
|
315
|
+
if (authCheck)
|
|
316
|
+
return authCheck;
|
|
317
|
+
try {
|
|
318
|
+
console.error(`🏗️ Getting page structure for ID: ${args.post_id}`);
|
|
319
|
+
// Get current Elementor data using safe parsing utility
|
|
320
|
+
const parsedResult = await this.safeGetElementorData(args.post_id);
|
|
321
|
+
if (!parsedResult.success || !parsedResult.data) {
|
|
322
|
+
console.error(`❌ Failed to get Elementor data: ${parsedResult.error}`);
|
|
323
|
+
return ResponseHelpers.createErrorResponse(`Could not get Elementor data for post/page ID ${args.post_id}: ${parsedResult.error || 'Unknown error'}`, 'GET_PAGE_STRUCTURE_ERROR', 'API_ERROR', 'Failed to retrieve Elementor data');
|
|
324
|
+
}
|
|
325
|
+
const elementorData = parsedResult.data;
|
|
326
|
+
console.error(`✅ Successfully parsed structure for ${elementorData.length} top-level elements`);
|
|
327
|
+
// Function to extract structure
|
|
328
|
+
const extractStructure = (elements, level = 0) => {
|
|
329
|
+
return elements.map(element => {
|
|
330
|
+
const structure = {
|
|
331
|
+
id: element.id,
|
|
332
|
+
type: element.elType,
|
|
333
|
+
widgetType: element.widgetType || null,
|
|
334
|
+
level: level
|
|
335
|
+
};
|
|
336
|
+
if (args.include_settings && element.settings) {
|
|
337
|
+
structure.settings = element.settings;
|
|
338
|
+
}
|
|
339
|
+
if (element.elements && element.elements.length > 0) {
|
|
340
|
+
structure.children = extractStructure(element.elements, level + 1);
|
|
341
|
+
}
|
|
342
|
+
return structure;
|
|
343
|
+
});
|
|
344
|
+
};
|
|
345
|
+
const structure = extractStructure(elementorData);
|
|
346
|
+
return ResponseHelpers.createSuccessResponse({
|
|
347
|
+
post_id: args.post_id,
|
|
348
|
+
structure: structure,
|
|
349
|
+
total_elements: elementorData.length,
|
|
350
|
+
include_settings: args.include_settings || false
|
|
351
|
+
}, `Successfully retrieved page structure for post/page ID ${args.post_id} with ${elementorData.length} top-level elements`);
|
|
352
|
+
}
|
|
353
|
+
catch (error) {
|
|
354
|
+
return ResponseHelpers.createErrorResponse(`Failed to get page structure: ${error.message}`, "GET_PAGE_STRUCTURE_ERROR", "API_ERROR", "Operation failed");
|
|
355
|
+
}
|
|
356
|
+
}
|
|
357
|
+
}
|
|
358
|
+
//# sourceMappingURL=elementor-handler.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"elementor-handler.js","sourceRoot":"","sources":["../src/elementor-handler.ts"],"names":[],"mappings":"AACA,OAAO,EAAuB,eAAe,EAAE,MAAM,YAAY,CAAC;AAElE,OAAO,EAAE,eAAe,EAAoB,MAAM,cAAc,CAAC;AAEjE,MAAM,OAAO,oBAAoB;IACX;IAApB,YAAoB,eAAgC;QAAhC,oBAAe,GAAf,eAAe,CAAiB;IAAG,CAAC;IAExD,gEAAgE;IAChE,KAAK,CAAC,oBAAoB,CAAC,MAAc;QACvC,MAAM,SAAS,GAAG,IAAI,CAAC,eAAe,CAAC,mBAAmB,EAAE,CAAC;QAC7D,IAAI,SAAS,EAAE,CAAC;YACd,OAAO;gBACL,OAAO,EAAE,KAAK;gBACd,KAAK,EAAE,qCAAqC;gBAC5C,SAAS,EAAE,6BAA6B;aACzC,CAAC;QACJ,CAAC;QAED,IAAI,CAAC;YACH,OAAO,CAAC,KAAK,CAAC,8CAA8C,MAAM,EAAE,CAAC,CAAC;YAEtE,MAAM,KAAK,GAAG,IAAI,CAAC,eAAe,CAAC,gBAAgB,EAAE,CAAC;YAEtD,uDAAuD;YACvD,IAAI,QAAQ,CAAC;YACb,IAAI,QAAQ,G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S,CAAC,QAAQ,GAAG,OAAO,CAAC,QAAQ,CAAC;oBACxC,CAAC;oBAED,IAAI,OAAO,CAAC,QAAQ,IAAI,OAAO,CAAC,QAAQ,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;wBACpD,SAAS,CAAC,QAAQ,GAAG,gBAAgB,CAAC,OAAO,CAAC,QAAQ,EAAE,KAAK,GAAG,CAAC,CAAC,CAAC;oBACrE,CAAC;oBAED,OAAO,SAAS,CAAC;gBACnB,CAAC,CAAC,CAAC;YACL,CAAC,CAAC;YAEF,MAAM,SAAS,GAAG,gBAAgB,CAAC,aAAa,CAAC,CAAC;YAElD,OAAO,eAAe,CAAC,qBAAqB,CAC1C;gBACE,OAAO,EAAE,IAAI,CAAC,OAAO;gBACrB,SAAS,EAAE,SAAS;gBACpB,cAAc,EAAE,aAAa,CAAC,MAAM;gBACpC,gBAAgB,EAAE,IAAI,CAAC,gBAAgB,IAAI,KAAK;aACjD,EACD,0DAA0D,IAAI,CAAC,OAAO,SAAS,aAAa,CAAC,MAAM,qBAAqB,CACzH,CAAC;QACJ,CAAC;QAAC,OAAO,KAAU,EAAE,CAAC;YACpB,OAAO,eAAe,CAAC,mBAAmB,CACxC,iCAAiC,KAAK,CAAC,OAAO,EAAE,EAChD,0BAA0B,EAC1B,WAAW,EACX,kBAAkB,CACnB,CAAC;QACJ,CAAC;IACH,CAAC;CACF"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export declare class ResponseHelpers {
|
|
2
|
+
static createSuccessResponse(data: any, message: string): {
|
|
3
|
+
content: {
|
|
4
|
+
type: string;
|
|
5
|
+
text: string;
|
|
6
|
+
}[];
|
|
7
|
+
};
|
|
8
|
+
static createErrorResponse(message: string, toolName: string, errorType: string, details: string): {
|
|
9
|
+
content: {
|
|
10
|
+
type: string;
|
|
11
|
+
text: string;
|
|
12
|
+
}[];
|
|
13
|
+
isError: boolean;
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
export declare class ElementorHelpers {
|
|
17
|
+
static clearElementorCache(postId?: number): Promise<void>;
|
|
18
|
+
static generateElementorId(): string;
|
|
19
|
+
static updateWidgetContent(element: any, content: string): void;
|
|
20
|
+
static findElementRecursive(elements: any[], elementId: string): any | null;
|
|
21
|
+
static createElementorColumn(columnSize?: number): any;
|
|
22
|
+
static createElementorSection(columns?: number, settings?: any): any;
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=helpers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../src/helpers.ts"],"names":[],"mappings":"AAEA,qBAAa,eAAe;IAC1B,MAAM,CAAC,qBAAqB,CAAC,IAAI,EAAE,GAAG,EAAE,OAAO,EAAE,MAAM;;;;;;IAcvD,MAAM,CAAC,mBAAmB,CAAC,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM;;;;;;;CAiBjG;AAED,qBAAa,gBAAgB;WACd,mBAAmB,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAMhE,MAAM,CAAC,mBAAmB,IAAI,MAAM;IAIpC,MAAM,CAAC,mBAAmB,CAAC,OAAO,EAAE,GAAG,EAAE,OAAO,EAAE,MAAM,GAAG,IAAI;IAuB/D,MAAM,CAAC,oBAAoB,CAAC,QAAQ,EAAE,GAAG,EAAE,EAAE,SAAS,EAAE,MAAM,GAAG,GAAG,GAAG,IAAI;IAc3E,MAAM,CAAC,qBAAqB,CAAC,UAAU,GAAE,MAAW,GAAG,GAAG;IAc1D,MAAM,CAAC,sBAAsB,CAAC,OAAO,GAAE,MAAU,EAAE,QAAQ,GAAE,GAAQ,GAAG,GAAG;CAiB5E"}
|
package/dist/helpers.js
ADDED
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
export class ResponseHelpers {
|
|
2
|
+
static createSuccessResponse(data, message) {
|
|
3
|
+
return {
|
|
4
|
+
content: [{
|
|
5
|
+
type: 'text',
|
|
6
|
+
text: JSON.stringify({
|
|
7
|
+
status: 'success',
|
|
8
|
+
success: true,
|
|
9
|
+
message,
|
|
10
|
+
data
|
|
11
|
+
}, null, 2)
|
|
12
|
+
}]
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
static createErrorResponse(message, toolName, errorType, details) {
|
|
16
|
+
return {
|
|
17
|
+
content: [{
|
|
18
|
+
type: 'text',
|
|
19
|
+
text: JSON.stringify({
|
|
20
|
+
status: 'error',
|
|
21
|
+
data: {
|
|
22
|
+
message,
|
|
23
|
+
code: errorType,
|
|
24
|
+
tool: toolName,
|
|
25
|
+
details
|
|
26
|
+
}
|
|
27
|
+
}, null, 2)
|
|
28
|
+
}],
|
|
29
|
+
isError: true
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
export class ElementorHelpers {
|
|
34
|
+
static async clearElementorCache(postId) {
|
|
35
|
+
// In a real implementation, this would clear Elementor cache
|
|
36
|
+
// For now, this is a placeholder that logs the action
|
|
37
|
+
console.error(`🧹 Clearing Elementor cache${postId ? ` for post ${postId}` : ' (global)'}`);
|
|
38
|
+
}
|
|
39
|
+
static generateElementorId() {
|
|
40
|
+
return Math.random().toString(36).substr(2, 8);
|
|
41
|
+
}
|
|
42
|
+
static updateWidgetContent(element, content) {
|
|
43
|
+
if (!element.widgetType)
|
|
44
|
+
return;
|
|
45
|
+
switch (element.widgetType) {
|
|
46
|
+
case 'html':
|
|
47
|
+
element.settings.html = content;
|
|
48
|
+
break;
|
|
49
|
+
case 'text-editor':
|
|
50
|
+
element.settings.editor = content;
|
|
51
|
+
break;
|
|
52
|
+
case 'heading':
|
|
53
|
+
element.settings.title = content;
|
|
54
|
+
break;
|
|
55
|
+
default:
|
|
56
|
+
// For other widget types, try common content properties
|
|
57
|
+
if (element.settings.content) {
|
|
58
|
+
element.settings.content = content;
|
|
59
|
+
}
|
|
60
|
+
else if (element.settings.text) {
|
|
61
|
+
element.settings.text = content;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
static findElementRecursive(elements, elementId) {
|
|
66
|
+
for (const element of elements) {
|
|
67
|
+
if (element.id === elementId) {
|
|
68
|
+
return element;
|
|
69
|
+
}
|
|
70
|
+
if (element.elements && element.elements.length > 0) {
|
|
71
|
+
const found = this.findElementRecursive(element.elements, elementId);
|
|
72
|
+
if (found)
|
|
73
|
+
return found;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
return null;
|
|
77
|
+
}
|
|
78
|
+
static createElementorColumn(columnSize = 50) {
|
|
79
|
+
return {
|
|
80
|
+
id: this.generateElementorId(),
|
|
81
|
+
elType: 'column',
|
|
82
|
+
isInner: false,
|
|
83
|
+
settings: {
|
|
84
|
+
_column_size: columnSize,
|
|
85
|
+
_inline_size: null
|
|
86
|
+
},
|
|
87
|
+
elements: [],
|
|
88
|
+
widgetType: null
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
static createElementorSection(columns = 1, settings = {}) {
|
|
92
|
+
const columnElements = [];
|
|
93
|
+
const columnSize = Math.floor(100 / columns);
|
|
94
|
+
for (let i = 0; i < columns; i++) {
|
|
95
|
+
columnElements.push(this.createElementorColumn(columnSize));
|
|
96
|
+
}
|
|
97
|
+
return {
|
|
98
|
+
id: this.generateElementorId(),
|
|
99
|
+
elType: 'section',
|
|
100
|
+
isInner: false,
|
|
101
|
+
settings,
|
|
102
|
+
elements: columnElements,
|
|
103
|
+
widgetType: null
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
//# sourceMappingURL=helpers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"helpers.js","sourceRoot":"","sources":["../src/helpers.ts"],"names":[],"mappings":"AAEA,MAAM,OAAO,eAAe;IAC1B,MAAM,CAAC,qBAAqB,CAAC,IAAS,EAAE,OAAe;QACrD,OAAO;YACL,OAAO,E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