webcake-storefront-mcp 1.21.0 → 1.22.0

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.
@@ -253,7 +253,7 @@ export const ELEMENT_ATTRS = {
253
253
  "favorite-icon": { events: "click — toggle favourite." },
254
254
  "bonus-items": { specials: { typeBonus: "combo_product | other." }, events: "none" },
255
255
  // ── navigation ──
256
- menu: { specials: { type: "horizontal | vertical | hamburger | anchor.", sync: "Auto-sync items with site pages (boolean).", fullField: "Stretch items to fill the menu width (boolean)." }, config: { showArrow: "Show the dropdown caret on items with a submenu (boolean).", textColor: "Item text colour (often a theme var like var(--color_20)).", colorHover: "Item hover colour.", "--padX": "Horizontal padding inside each item (CSS var, e.g. 15px)." }, events: "none", notes: "Holds menu-item children. Real templates colour items via theme vars (var(--color_20))." },
256
+ menu: { specials: { type: "horizontal | vertical | hamburger | collapse | grid | anchor.", sync: "Auto-sync items with site pages (boolean).", fullField: "Stretch items to fill the menu width (boolean)." }, config: { showArrow: "Show the dropdown caret on items with a submenu (boolean).", textColor: "Item text colour (often a theme var like var(--color_20)).", colorHover: "Item hover colour.", "--padX": "Horizontal padding inside each item (CSS var, e.g. 15px)." }, events: "none", notes: "Holds menu-item children. Real headers often have TWO menus (a horizontal desktop menu + a hamburger/collapse mobile menu). Colour items via theme vars (var(--color_20))." },
257
257
  "menu-item": { specials: { name: "Link label.", isCustom: "Custom link (boolean).", linkType: "page | category | blog_category | brand | product_tag | custom.", linkPage: "Target page id (linkType=page).", pageId: "Target page id (mirror of linkPage, set both).", linkCategory: "Linked category id.", categoryId: "Category id.", syncSubmenu: "Auto-build submenu (boolean)." }, events: "navigation lives in SPECIALS here, NOT events — set linkType + the matching id.", notes: "For a page link set linkType='page' + linkPage + pageId + name. (Generic text/container/button elements navigate via events:[{action:'open_page',open_page_id}] instead.)" },
258
258
  "menu-anchor-item": { specials: { name: "Label.", isCustom: "Custom.", linkType: "Link kind.", categoryId: "Category id." }, events: "click — scrolls to an anchor." },
259
259
  submenu: { events: "none", notes: "Dropdown under a menu-item." },
@@ -26,7 +26,12 @@ export const BINDING_DATASETS = {
26
26
  "product::product_categories", "product::brand_name", "product::product_tag",
27
27
  "product::product_remain_quantity", "product::total_sold_web", "product::rating_point",
28
28
  "product::rating_count", "product::variation_sku", "product::product_wholesale_price",
29
- "product::discount_price_from_original_price", "product::preorder_text", "product::product_note",
29
+ "product::discount_price_from_original_price", "product::discount_price_to_original_price",
30
+ "product::preorder_text", "product::product_note",
31
+ // course / LMS products (use_store + course app):
32
+ "product::total_course", "product::total_course_learning", "product::course_member_quantity",
33
+ "product::course_total_time", "product::course_video_quantity", "product::lesson_name",
34
+ "product::lesson_description", "product::video_lesson",
30
35
  ],
31
36
  },
32
37
  "product-overlay": {
@@ -46,7 +51,9 @@ export const BINDING_DATASETS = {
46
51
  "cart_item::cart_item_original_price", "cart_item::cart_item_subtotal", "cart_item::cart_item_total_price",
47
52
  "cart_item::cart_item_total_quantity", "cart_item::cart_item_prod_attr", "cart_item::sku",
48
53
  "cart_item::cart_total_price", "cart_item::cart_total_tax", "cart_item::cart_shipping_fee",
49
- "cart_item::cart_promotion_discount", "cart_item::subtotal_before_discount", "cart_item::product_note",
54
+ "cart_item::cart_surcharge_fee", "cart_item::cart_promotion_discount", "cart_item::discount_percent",
55
+ "cart_item::discount_reward_point", "cart_item::total_price_all_promotions",
56
+ "cart_item::subtotal_before_discount", "cart_item::product_note",
50
57
  ],
51
58
  },
52
59
  order: {
@@ -58,6 +65,7 @@ export const BINDING_DATASETS = {
58
65
  "order::order_payment_method", "order::shipping_fee", "order::subtotal", "order::total_price",
59
66
  "order::total_tax", "order::code_order", "order::order_status", "order::payment_status",
60
67
  "order::order_quantity", "order::order_date", "order::order_coupon", "order::order_promotion_discount",
68
+ "order::order_promotion_coupon",
61
69
  ],
62
70
  },
63
71
  order_item: {
@@ -97,6 +105,7 @@ export const BINDING_DATASETS = {
97
105
  "customer::profile_avatar", "customer::profile_name", "customer::phone_number", "customer::email",
98
106
  "customer::gender", "customer::birthday", "customer::order_count", "customer::purchased_amount",
99
107
  "customer::pos_reward_point", "customer::pos_reward_point_level", "customer::pos_level_discount",
108
+ "customer::succeed_order_count",
100
109
  ],
101
110
  },
102
111
  customer_address: {
@@ -146,6 +155,46 @@ export const BINDING_DATASETS = {
146
155
  summary: "Page / site info.",
147
156
  fields: ["general_info::page_name", "general_info::site_name", "general_info::menu_title"],
148
157
  },
158
+ agency: {
159
+ name: "agency",
160
+ page_type: "any",
161
+ repeater_parents: ["agency"],
162
+ summary: "A store / branch in a store-locator (agency) list.",
163
+ fields: ["agency::name", "agency::phone_number", "agency::address", "agency::time"],
164
+ },
165
+ blog: {
166
+ name: "blog",
167
+ page_type: "blog",
168
+ summary: "The current blog CATEGORY (heading on a blog list page) — distinct from `post`.",
169
+ fields: ["blog::category_name", "blog::category_description"],
170
+ },
171
+ search_result: {
172
+ name: "search_result",
173
+ page_type: "store",
174
+ summary: "Search-results context (the query + matched products) on a search page.",
175
+ fields: ["search_result::search_name", "search_result::products"],
176
+ },
177
+ };
178
+ // Binding META keys beyond {id,name,target} — these are HOW a source field combines into the
179
+ // element (mined from 34 real templates). makeBinding preserves any of them verbatim, e.g.
180
+ // new_element('text-dataset',{ bindings:[{ target:'product::product_name', name_style:'sku',
181
+ // number_of_line_title:1 }] }). Listed so the AI knows the real combine-keys (no invented keys).
182
+ export const BINDING_META_KEYS = {
183
+ name_style: "Render style of a name/value: 'sku' | 'variation-sku' (show the SKU/variation form).",
184
+ attr_id: "Bind a SPECIFIC product attribute by id (ATTR-xxxx) — used with attr::attr_name / attr::attr_value.",
185
+ target_attr: "For cart_item::cart_item_prod_attr — pick one attribute by name (e.g. 'Màu sắc').",
186
+ value_attr: "Companion to target_attr — which part to show ('value').",
187
+ prefix_content: "Text prepended before the value (e.g. '-' or a label).",
188
+ separator: "Separator string when the field is a list.",
189
+ value: "A SECOND source for a COMPUTED display, e.g. cart_item::cart_total_price with value:'form::coupon_price' subtracts the coupon. Combine two datasets in one node.",
190
+ order: "Index into a multi-value field (pick the Nth).",
191
+ order_value: "Which sub-value of an ordered field to show (e.g. 'description').",
192
+ number_of_line_title: "Clamp the text to N lines.",
193
+ showText: "Show the field label/text alongside the value (boolean).",
194
+ max_item_show: "Max items to render for a list-valued field.",
195
+ bind_image_by_category_id: "For images: resolve from a category instead of the product.",
196
+ auto_hide_without_star: "Hide the node when there's no rating (boolean).",
197
+ show_video_demo: "Show the product video demo (boolean).",
149
198
  };
150
199
  // Build fast lookups.
151
200
  const ALL_TARGETS = new Set();
@@ -241,8 +290,9 @@ export function validateBindings(node) {
241
290
  /** Catalog for the list_bindings discovery tool. */
242
291
  export function describeBindingsCatalog() {
243
292
  return {
244
- note: "Dataset elements (text-dataset/image-dataset/…) and children of a repeater (grid-product, cart-items, post-list…) carry bindings:[{ id, name, target }]. Build via new_element opts.bindings (ids auto-minted) — e.g. new_element('text-dataset',{ bindings:[{ target:'product::product_price', show_tax:true }] }). A target only resolves on a page whose type enables its dataset (store→use_store, member→use_member, blog→use_blog) — build_page handles the flag.",
245
- page_type_required: { store: ["product", "product-overlay", "cart_item", "order", "order_item", "category", "bonus_item", "promotion_item", "attr"], member: ["customer", "customer_address"], blog: ["post"], any: ["form", "general_info"] },
293
+ note: "Dataset elements (text-dataset/image-dataset/…) and children of a repeater (grid-product, cart-items, post-list…) carry bindings:[{ id, name, target, ...meta }]. Build via new_element opts.bindings (ids auto-minted) — e.g. new_element('text-dataset',{ bindings:[{ target:'product::product_price', show_tax:true }] }). A target only resolves on a page whose type enables its dataset (store→use_store, member→use_member, blog→use_blog) — build_page handles the flag. The optional meta keys (name_style, prefix_content, value, attr_id, …) control HOW the value renders/combines — see meta_keys.",
294
+ meta_keys: BINDING_META_KEYS,
295
+ page_type_required: { store: ["product", "product-overlay", "cart_item", "order", "order_item", "category", "bonus_item", "promotion_item", "attr", "search_result"], member: ["customer", "customer_address"], blog: ["post", "blog"], any: ["form", "general_info", "agency"] },
246
296
  repeater_context: REPEATER_CONTEXT,
247
297
  datasets: Object.values(BINDING_DATASETS).map((ds) => ({
248
298
  name: ds.name,
@@ -26,22 +26,22 @@ export const EVENT_TRIGGERS = [
26
26
  const TRIGGER_NAMES = new Set(EVENT_TRIGGERS.map((t) => t.name));
27
27
  export const EVENT_ACTIONS = [
28
28
  // navigation
29
- { action: "open_page", trigger: "click", category: "navigation", summary: "Go to a page in this site.", required: ["open_page_id"], optional: ["scrollTarget", "scroll_to_id", "scroll_to_element_id", "scrollMore", "no_follow", "active_color"] },
29
+ { action: "open_page", trigger: "click", category: "navigation", summary: "Go to a page in this site.", required: ["open_page_id"], optional: ["scrollTarget", "scroll_to_id", "scroll_to_element_id", "scrollMore", "no_follow", "active_color", "popup_id", "popup_overlay", "close_all_other_popup", "open_category_id", "open_blog_category_id", "open_menu_id", "activeNotify"] },
30
30
  { action: "open_link", trigger: "click", category: "navigation", summary: "Open an external URL.", required: ["link_target"], optional: ["link_target_url", "no_follow"] },
31
31
  { action: "open_category", trigger: "click", category: "navigation", summary: "Open a product category page.", required: ["open_category_id"], optional: ["no_follow"] },
32
32
  { action: "open_blog_category", trigger: "click", category: "navigation", summary: "Open a blog category page.", required: ["open_blog_category_id"], optional: ["no_follow"] },
33
33
  { action: "scroll_to", trigger: "click", category: "navigation", summary: "Smooth-scroll to a section/element on this page.", required: ["scroll_to_id"], optional: ["scroll_to_element_id", "scrollMore", "scrollTarget"], target_in_page: ["scroll_to_id", "scroll_to_element_id"] },
34
34
  { action: "direction_login", trigger: "click", category: "navigation", summary: "Redirect by login state: open_page_id if logged in, target_direction_id if not.", required: ["open_page_id"], optional: ["target_direction_id"] },
35
35
  // ui control
36
- { action: "toggle", trigger: "click", category: "ui", summary: "Show/hide another element on this page.", required: ["toggle_id"], optional: ["toggle_status", "only_mode"], target_in_page: ["toggle_id"] },
37
- { action: "open_popup", trigger: "click", category: "ui", summary: "Open a popup.", required: ["popup_id"], optional: ["popup_overlay", "close_all_other_popup"] },
36
+ { action: "toggle", trigger: "click", category: "ui", summary: "Show/hide another element on this page (the most common interaction — accordions, drawers, filters).", required: ["toggle_id"], optional: ["toggle_status", "only_mode"], target_in_page: ["toggle_id"] },
37
+ { action: "open_popup", trigger: "click", category: "ui", summary: "Open a popup (use mouseenter for a hover mini-cart/submenu).", required: ["popup_id"], optional: ["popup_overlay", "close_all_other_popup", "open_page_id", "only_mode", "toggle_id", "open_category_id", "scroll_to_id"] },
38
38
  { action: "close_popup", trigger: "click", category: "ui", summary: "Close a popup.", required: ["popup_id"], optional: ["popup_overlay", "close_all_other_popup"] },
39
39
  { action: "open_menu", trigger: "click", category: "ui", summary: "Open a dropdown/submenu.", required: ["open_menu_id"], target_in_page: ["open_menu_id"] },
40
40
  { action: "close_menu", trigger: "click", category: "ui", summary: "Close a menu.", optional: ["close_menu_id"] },
41
41
  { action: "change_tab", trigger: "click", category: "ui", summary: "Switch a swiper/tabs to a given tab.", required: ["change_tab_id"], optional: ["move_to", "tab_index", "tab_color"], target_in_page: ["change_tab_id"] },
42
42
  { action: "load_more", trigger: "click", category: "ui", summary: "Load more items in a list.", optional: ["load_more_id"], target_in_page: ["load_more_id"] },
43
43
  // cart / commerce
44
- { action: "add_to_cart", trigger: "click", category: "cart", summary: "Add the current product to the cart.", optional: ["open_page", "auto_add_bonus", "activeNotify", "productNoteElId"] },
44
+ { action: "add_to_cart", trigger: "click", category: "cart", summary: "Add the current product to the cart.", optional: ["open_page", "open_page_id", "open_popup_id", "open_target", "open_category_id", "auto_add_bonus", "activeNotify", "productNoteElId"] },
45
45
  { action: "buy_now", trigger: "click", category: "cart", summary: "Add to cart and go straight to checkout.", optional: ["open_page", "auto_add_bonus", "activeNotify"] },
46
46
  { action: "add_to_cart_form", trigger: "success", category: "cart", summary: "Add to cart from a form submit (product form).", optional: ["open_page"] },
47
47
  { action: "open_cart", trigger: "click", category: "cart", summary: "Open the cart sidebar/drawer." },
@@ -66,10 +66,32 @@ export const EVENT_ACTIONS = [
66
66
  { action: "send_whatsapp_mess", trigger: "click", category: "contact", summary: "Open WhatsApp chat.", optional: ["whatsapp_phone_number"] },
67
67
  { action: "sharing", trigger: "click", category: "contact", summary: "Share to a social network.", optional: ["shareTarget", "shareLink", "shareLinkCustom"] },
68
68
  // hover styles (eventName must be "hover")
69
- { action: "scale", trigger: "hover", category: "hover", summary: "Scale the element on hover.", optional: ["el_target_id"] },
70
- { action: "change_background", trigger: "hover", category: "hover", summary: "Change background colour on hover." },
71
- { action: "change_text_color", trigger: "hover", category: "hover", summary: "Change text colour on hover." },
72
- { action: "change_border_color", trigger: "hover", category: "hover", summary: "Change border colour on hover." },
69
+ { action: "scale", trigger: "hover", category: "hover", summary: "Scale the element on hover.", optional: ["el_target_id", "scale_value"] },
70
+ { action: "change_background", trigger: "hover", category: "hover", summary: "Change background colour on hover.", optional: ["change_background", "apply_element", "cursor", "el_target_id"] },
71
+ { action: "change_text_color", trigger: "hover", category: "hover", summary: "Change text colour on hover.", optional: ["change_text_color", "apply_element", "cursor", "el_target_id"] },
72
+ { action: "change_border_color", trigger: "hover", category: "hover", summary: "Change border colour on hover.", optional: ["change_border_color", "apply_element", "cursor", "el_target_id"] },
73
+ { action: "transform_y", trigger: "hover", category: "hover", summary: "Shift the element vertically on hover (lift effect).", optional: ["transform_y", "apply_element"] },
74
+ { action: "transform_x", trigger: "hover", category: "hover", summary: "Shift the element horizontally on hover.", optional: ["transform_x", "apply_element"] },
75
+ { action: "cursor", trigger: "hover", category: "hover", summary: "Change the cursor on hover.", optional: ["cursor"] },
76
+ // commerce / cart interactions (mined from 34 real templates)
77
+ { action: "open_quick_view", trigger: "click", category: "cart", summary: "Open a product quick-view popup from a product card.", optional: ["popup_id", "activeNotify", "active_color"] },
78
+ { action: "open_product_page", trigger: "click", category: "navigation", summary: "Open the product detail page for this card's product." },
79
+ { action: "open_preview_product_gallery", trigger: "click", category: "media", summary: "Open the product image in a gallery preview.", optional: ["open_preview_product_gallery_id", "target"] },
80
+ { action: "close_cart_item", trigger: "click", category: "cart", summary: "Remove this line item from the cart." },
81
+ { action: "edit_cart_item", trigger: "click", category: "cart", summary: "Edit this cart line item (qty / variation)." },
82
+ { action: "change_column_grid_prd", trigger: "click", category: "ui", summary: "Switch the product grid's column count.", optional: ["columnNumber", "target_id"], target_in_page: ["target_id"] },
83
+ { action: "add_wishlist_product", trigger: "click", category: "cart", summary: "Add the product to the wishlist.", optional: ["activeNotify"] },
84
+ { action: "wishlist_remove_item", trigger: "click", category: "cart", summary: "Remove an item from the wishlist.", optional: ["target_custom_links"] },
85
+ { action: "use_reward_point", trigger: "click", category: "cart", summary: "Apply loyalty reward points to the order.", optional: ["reward_point", "target"] },
86
+ { action: "copy_promotion", trigger: "click", category: "cart", summary: "Copy a promotion/coupon code to the clipboard.", optional: ["has_text", "is_hidden", "text_change"] },
87
+ // search + menu + account interactions
88
+ { action: "search", trigger: "click", category: "navigation", summary: "Run a storefront product search.", optional: ["open_page_id", "open_category_id"] },
89
+ { action: "close_search", trigger: "click", category: "ui", summary: "Close the search box/droppable.", optional: ["close_search_id"], target_in_page: ["close_search_id"] },
90
+ { action: "toggle_group", trigger: "click", category: "ui", summary: "Toggle a group of elements together (e.g. a mobile menu / filter group).", optional: ["actions", "data", "data_more", "show"] },
91
+ { action: "back_to_menu_parent", trigger: "click", category: "ui", summary: "Go back up one level in a multi-level mobile menu." },
92
+ { action: "lightbox", trigger: "click", category: "media", summary: "Open an image in a lightbox.", optional: ["lightboxLink"] },
93
+ { action: "set_address_default", trigger: "click", category: "account", summary: "Mark a saved address as the default." },
94
+ { action: "change_avatar", trigger: "click", category: "account", summary: "Change the member avatar." },
73
95
  ];
74
96
  const ACTION_BY_NAME = {};
75
97
  for (const a of EVENT_ACTIONS)
@@ -131,6 +131,28 @@ key — only bp1..bp4.)
131
131
  \`text-dataset\` with \`product::product_name\` resolves to that cell's product (no extra
132
132
  wiring). Same for cart-items→cart_item, order-items→order_item, post-list→post,
133
133
  grid-category→category. A target only resolves on a page of the matching \`type\` (below).
134
+ - BINDING COMBINE-KEYS (how a field renders/combines — mined from real templates; pass them
135
+ alongside \`target\`): \`name_style:"sku"|"variation-sku"\`, \`prefix_content:"-"\` (prepend),
136
+ \`number_of_line_title:1\` (clamp lines), \`attr_id:"ATTR-…"\` (bind ONE attribute), and
137
+ \`value:"form::coupon_price"\` — a SECOND source so one node shows a COMPUTED value (e.g.
138
+ \`cart_item::cart_total_price\` with \`value:"form::coupon_price"\` = total minus coupon). Call
139
+ \`list_bindings\` → meta_keys for the full list.
140
+
141
+ ## Composition recipes (how real templates assemble components)
142
+ Repeaters fall into two kinds (surveyed across 34 templates):
143
+ - SELF-RENDERING (just add badges): \`grid-product\` / \`slider-product\` / \`post-list\` render the
144
+ card themselves — their children are only \`product-overlay\` (sale/discount badge) or, for a
145
+ fully custom card, a \`custom-layout\` wrapping dataset cells. \`post-list\`→\`post-overlay\` children.
146
+ - HAND-COMPOSED from per-item dataset cells (build the row yourself):
147
+ - \`cart-items\` row = \`image-dataset[cart_item::cart_item_image]\`, \`text-dataset[cart_item::cart_item_name]\`,
148
+ \`text-dataset[cart_item::cart_item_price]\`, \`quantity-input\`, \`text-dataset[cart_item::cart_item_total_price]\`,
149
+ a \`container\` for name+\`cart_item::cart_item_prod_attr\`, \`line\` (config.columns sets the row template).
150
+ - \`order-items\` row = \`image-dataset[order_item::product_image]\` + \`text-dataset\` for
151
+ \`order_item::product_name\` / \`product_attrs\` / \`product_quantity\` / \`items_sum_up_price\`.
152
+ - \`layout-dataset\` / \`customer-address\` = a generic repeater: \`text-dataset[customer_address::full_name|phone_number|address|pdc|is_default]\` + a "Set default" button.
153
+ - \`promotions\` = \`text-dataset[promotion_item::code|description|end_date]\` + a copy button (\`copy_promotion\`).
154
+ The bare \`cart-items\`/\`order-items\` (no children) self-render a DEFAULT row — fine for a quick build; compose cells only when you want a custom layout.
155
+ HEADER patterns: real headers carry TWO menus (a horizontal desktop \`menu\` + a hamburger/collapse mobile \`menu\`), the logo (image/text), \`cart-icon\`, often \`input-search\`/\`search-droppable\`, \`member-bar\`, and \`language-menu\`. BREADCRUMB is common — keep it on category/product pages (often its own slim section, or next to a \`text-dataset\` page title).
134
156
 
135
157
  ## Events (clicks, navigation, cart, popups)
136
158
  Interactive nodes (button, text, image, container, rectangle, icons) carry an \`events\`
@@ -1,4 +1,11 @@
1
1
  [
2
+ {
3
+ "v": "1.22.0",
4
+ "d": "25/06/2026",
5
+ "type": "Added",
6
+ "en": "list_bindings now returns a meta_keys map documenting binding combine-keys mined from 34 production templates — name_style, attr_id, prefix_content,…",
7
+ "vi": "list_bindings nay trả về map meta_keys tài liệu hóa các combine-key liên kết dữ liệu được khai thác từ 34 template production — name_style, attr_id,…"
8
+ },
2
9
  {
3
10
  "v": "1.21.0",
4
11
  "d": "25/06/2026",
@@ -33,12 +40,5 @@
33
40
  "type": "Changed",
34
41
  "en": "get_build_guide now includes three new sections: \"Build the WHOLE storefront\" with per-page recipes for enriching category, product detail, cart,…",
35
42
  "vi": "get_build_guide nay bổ sung ba mục mới: \"Build the WHOLE storefront\" — công thức từng trang để nâng cấp danh mục, trang chi tiết sản phẩm, giỏ hàng,…"
36
- },
37
- {
38
- "v": "1.18.0",
39
- "d": "25/06/2026",
40
- "type": "Added",
41
- "en": "New get_intake_guide tool returns a step-by-step questionnaire and recommended build flow (create_site → products → build_page → global sections →…",
42
- "vi": "Tool mới get_intake_guide trả về bảng câu hỏi từng bước và quy trình build được khuyến nghị (create_site → sản phẩm → build_page → global sections →…"
43
43
  }
44
44
  ]
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "webcake-storefront-mcp",
3
- "version": "1.21.0",
3
+ "version": "1.22.0",
4
4
  "description": "MCP server for the WebCake/StoreCake storefront builder — page CRUD, page authoring, products, orders, and more",
5
5
  "mcpName": "io.github.vuluu2k/webcake-storefront-mcp",
6
6
  "license": "MIT",