x
This commit is contained in:
1 parent
3965f4f4da
commit
70877882b0
82 files changed
+4353
-186
No files matched your search
@@ -43,6 +43,7 @@ export const MENU_TOOL_DEFINITIONS = [
|
||||
description: "Optional menu payload for tree-based menus such as main"
|
||||
},
|
||||
isActive: { type: "boolean", description: "Optional active state for the menu" },
|
||||
rootImage: { type: "string", description: "Optional root image for the menu" },
|
||||
items: {
|
||||
type: "array",
|
||||
description: "Array of menu items",
|
||||
@@ -53,6 +54,8 @@ export const MENU_TOOL_DEFINITIONS = [
|
||||
label: { type: "string", description: "Label of the menu item" },
|
||||
url: { type: "string", description: "URL of the menu item" },
|
||||
order: { type: "number", description: "Order sequence" },
|
||||
columnImage: { type: "string", description: "Optional column image for the menu item" },
|
||||
hoverImage: { type: "string", description: "Optional hover image for the menu item" },
|
||||
translations: {
|
||||
type: "array",
|
||||
description: "Optional array of translations",
|
||||
@@ -230,6 +233,12 @@ export async function handleMenuTool(api: AxiosInstance, name: string, params: a
|
||||
body.isActive = existingMenu.isActive;
|
||||
}
|
||||
|
||||
if (params.rootImage !== undefined) {
|
||||
body.rootImage = params.rootImage;
|
||||
} else if (existingMenu?.rootImage !== undefined) {
|
||||
body.rootImage = existingMenu.rootImage;
|
||||
}
|
||||
|
||||
if (params.payload !== undefined && !isPlainObject(params.payload) && !Array.isArray(params.payload)) {
|
||||
throw new Error("Invalid menu payload: payload must be an object or array");
|
||||
}
|
||||
@@ -249,7 +258,8 @@ export async function handleMenuTool(api: AxiosInstance, name: string, params: a
|
||||
name: params.name,
|
||||
itemCount: items.length,
|
||||
hasPayload: !!body.payload,
|
||||
isActive: body.isActive
|
||||
isActive: body.isActive,
|
||||
rootImage: body.rootImage || null
|
||||
},
|
||||
warnings: itemCheck.warnings
|
||||
},
|
||||
@@ -273,7 +283,8 @@ export async function handleMenuTool(api: AxiosInstance, name: string, params: a
|
||||
name: res.data.name,
|
||||
isActive: res.data.isActive,
|
||||
itemCount: res.data.items?.length || 0,
|
||||
hasPayload: !!res.data.payload
|
||||
hasPayload: !!res.data.payload,
|
||||
rootImage: res.data.rootImage || null
|
||||
},
|
||||
null,
|
||||
2
|
||||
|
||||
@@ -182,6 +182,14 @@ function validateMenuItems(items: any) {
|
||||
issues.push(`items[${index}].order must be a number when provided`);
|
||||
}
|
||||
|
||||
if (item.columnImage !== undefined && item.columnImage !== null && typeof item.columnImage !== "string") {
|
||||
issues.push(`items[${index}].columnImage must be a string or null when provided`);
|
||||
}
|
||||
|
||||
if (item.hoverImage !== undefined && item.hoverImage !== null && typeof item.hoverImage !== "string") {
|
||||
issues.push(`items[${index}].hoverImage must be a string or null when provided`);
|
||||
}
|
||||
|
||||
if (item.translations !== undefined) {
|
||||
if (!Array.isArray(item.translations)) {
|
||||
issues.push(`items[${index}].translations must be an array when provided`);
|
||||
|
||||
Reference in new issue
Block a user