@jay-framework/wix-stores 0.19.7 → 0.20.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.
package/README.md CHANGED
@@ -64,9 +64,6 @@ Run `jay-stack agent-kit` (or `yarn agent-kit`) to index the live category tree
64
64
  urls:
65
65
  product: '/products/{slug}' # default
66
66
  category: null # no category pages by default
67
-
68
- # Fallback category for pages without category context
69
- defaultCategory: 'all-products' # slug of the fallback category
70
67
  ```
71
68
 
72
69
  URL templates use three placeholders:
@@ -114,7 +111,6 @@ src/pages/products/
114
111
  urls:
115
112
  product: '/products/{prefix}/{category}/{slug}'
116
113
  category: '/products/{prefix}/{category}'
117
- defaultCategory: 'all-products'
118
114
  ```
119
115
 
120
116
  ```
@@ -154,12 +150,12 @@ src/pages/products/polgat/
154
150
 
155
151
  ### Setting Params for Static Routes
156
152
 
157
- Static route directories use `jay-params` to tell the component which prefix they represent:
153
+ Static route directories use `jay-params` to tell the component which category they represent:
158
154
 
159
155
  ```html
160
- <!-- src/pages/products/polgat/page.jay-html -->
156
+ <!-- src/pages/products/polgat/page.jay-html (root category) -->
161
157
  <script type="application/jay-params">
162
- prefix: polgat
158
+ category: polgat
163
159
  </script>
164
160
  <script
165
161
  type="application/jay-headless"
@@ -171,11 +167,10 @@ Static route directories use `jay-params` to tell the component which prefix the
171
167
 
172
168
  ## Category Header
173
169
 
174
- The category header is always loaded. The component resolves category metadata using a fallback chain:
170
+ The category header is always loaded. The component resolves category metadata:
175
171
 
176
- 1. **`category` param** → load category
177
- 2. **`prefix` param** → load root category
178
- 3. **Neither** → load `defaultCategory` from config
172
+ 1. **`category` param** → load category (always the active category slug)
173
+ 2. **No `category`** → load the "All Products" system category via `getAllProductsCategory()` (header only, no base filter)
179
174
 
180
175
  If the resolved category is missing image, description, or SEO data, the component walks up the parent chain until it finds the data. Each field inherits independently.
181
176
 
@@ -5,7 +5,11 @@ items:
5
5
  subCategory: Components
6
6
  pluginName: wix-stores
7
7
  packageName: "@jay-framework/wix-stores"
8
- thumbnail: thumbnails/wix-stores/product-search.png
8
+ thumbnail: thumbnails/wix-stores/product-search.svg
9
+ interaction:
10
+ mode: stage-place
11
+ stagePromptTemplate: |
12
+ Add a product search component at this marker location on the page.
9
13
  prompt: |
10
14
  Use headless component @jay-framework/wix-stores / contract product-search.
11
15
  Read agent-kit/materialized-contracts/wix-stores/product-search.jay-contract.
@@ -18,7 +22,11 @@ items:
18
22
  subCategory: Components
19
23
  pluginName: wix-stores
20
24
  packageName: "@jay-framework/wix-stores"
21
- thumbnail: thumbnails/wix-stores/product-page.png
25
+ thumbnail: thumbnails/wix-stores/product-page.svg
26
+ interaction:
27
+ mode: stage-place
28
+ stagePromptTemplate: |
29
+ Add a product page component at this marker location on the page.
22
30
  prompt: |
23
31
  Use headless component @jay-framework/wix-stores / contract product-page.
24
32
  Read agent-kit/materialized-contracts/wix-stores/product-page.jay-contract.
@@ -31,7 +39,11 @@ items:
31
39
  subCategory: Components
32
40
  pluginName: wix-stores
33
41
  packageName: "@jay-framework/wix-stores"
34
- thumbnail: thumbnails/wix-stores/category-products.png
42
+ thumbnail: thumbnails/wix-stores/category-products.svg
43
+ interaction:
44
+ mode: stage-place
45
+ stagePromptTemplate: |
46
+ Add a category products grid at this marker location on the page.
35
47
  prompt: |
36
48
  Use headless component @jay-framework/wix-stores / contract category-products.
37
49
  Read agent-kit/materialized-contracts/wix-stores/category-products.jay-contract.
@@ -46,6 +58,10 @@ items:
46
58
  pluginName: wix-stores
47
59
  packageName: "@jay-framework/wix-stores"
48
60
  thumbnail: thumbnails/wix-stores/product-spotlight.png
61
+ interaction:
62
+ mode: stage-place
63
+ stagePromptTemplate: |
64
+ Add a product spotlight at this marker location on the page.
49
65
  prompt: |
50
66
  Use headless component @jay-framework/wix-stores / contract product-spotlight.
51
67
  Read agent-kit/materialized-contracts/wix-stores/product-spotlight.jay-contract.
@@ -59,7 +75,11 @@ items:
59
75
  subCategory: Components
60
76
  pluginName: wix-stores
61
77
  packageName: "@jay-framework/wix-stores"
62
- thumbnail: thumbnails/wix-stores/category-list.png
78
+ thumbnail: thumbnails/wix-stores/category-list.svg
79
+ interaction:
80
+ mode: stage-place
81
+ stagePromptTemplate: |
82
+ Add a category list at this marker location on the page.
63
83
  prompt: |
64
84
  Use headless component @jay-framework/wix-stores / contract category-list.
65
85
  Read agent-kit/materialized-contracts/wix-stores/category-list.jay-contract.
@@ -0,0 +1,12 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" width="320" height="240" viewBox="0 0 320 240" fill="none">
2
+ <rect width="320" height="240" fill="#f8fafc"/>
3
+ <rect x="16" y="20" width="288" height="36" rx="8" fill="#fff" stroke="#e2e8f0"/>
4
+ <rect x="28" y="32" width="120" height="12" rx="3" fill="#cbd5e1"/>
5
+ <rect x="16" y="72" width="136" height="14" rx="4" fill="#e2e8f0"/>
6
+ <rect x="16" y="98" width="288" height="1" fill="#e2e8f0"/>
7
+ <rect x="16" y="112" width="200" height="12" rx="3" fill="#cbd5e1"/>
8
+ <rect x="16" y="136" width="160" height="10" rx="3" fill="#e2e8f0"/>
9
+ <rect x="16" y="168" width="288" height="1" fill="#e2e8f0"/>
10
+ <rect x="16" y="182" width="184" height="12" rx="3" fill="#cbd5e1"/>
11
+ <rect x="16" y="206" width="128" height="10" rx="3" fill="#e2e8f0"/>
12
+ </svg>
@@ -0,0 +1,15 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" width="320" height="240" viewBox="0 0 320 240" fill="none">
2
+ <rect width="320" height="240" fill="#f8fafc"/>
3
+ <rect x="16" y="24" width="120" height="12" rx="3" fill="#cbd5e1"/>
4
+ <rect x="16" y="56" width="72" height="96" rx="8" fill="#fff" stroke="#e2e8f0"/>
5
+ <rect x="24" y="64" width="56" height="48" rx="4" fill="#dbeafe"/>
6
+ <rect x="24" y="120" width="48" height="8" rx="2" fill="#cbd5e1"/>
7
+ <rect x="96" y="56" width="72" height="96" rx="8" fill="#fff" stroke="#e2e8f0"/>
8
+ <rect x="104" y="64" width="56" height="48" rx="4" fill="#fce7f3"/>
9
+ <rect x="104" y="120" width="48" height="8" rx="2" fill="#cbd5e1"/>
10
+ <rect x="176" y="56" width="72" height="96" rx="8" fill="#fff" stroke="#e2e8f0"/>
11
+ <rect x="184" y="64" width="56" height="48" rx="4" fill="#dcfce7"/>
12
+ <rect x="184" y="120" width="48" height="8" rx="2" fill="#cbd5e1"/>
13
+ <rect x="248" y="56" width="56" height="96" rx="8" fill="#fff" stroke="#e2e8f0"/>
14
+ <rect x="256" y="64" width="40" height="48" rx="4" fill="#fef3c7"/>
15
+ </svg>
@@ -0,0 +1,12 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" width="320" height="240" viewBox="0 0 320 240" fill="none">
2
+ <rect width="320" height="240" fill="#f4f7fb"/>
3
+ <rect x="16" y="16" width="288" height="28" rx="6" fill="#e2e8f0"/>
4
+ <rect x="16" y="56" width="120" height="12" rx="3" fill="#cbd5e1"/>
5
+ <rect x="16" y="76" width="88" height="10" rx="3" fill="#e2e8f0"/>
6
+ <rect x="16" y="104" width="136" height="120" rx="8" fill="#dbeafe" stroke="#93c5fd"/>
7
+ <rect x="168" y="104" width="136" height="16" rx="4" fill="#cbd5e1"/>
8
+ <rect x="168" y="128" width="96" height="10" rx="3" fill="#e2e8f0"/>
9
+ <rect x="168" y="148" width="72" height="10" rx="3" fill="#e2e8f0"/>
10
+ <rect x="168" y="180" width="88" height="28" rx="6" fill="#2563eb"/>
11
+ <text x="188" y="198" fill="#fff" font-family="system-ui,sans-serif" font-size="11">Add to cart</text>
12
+ </svg>
@@ -0,0 +1,17 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" width="320" height="240" viewBox="0 0 320 240" fill="none">
2
+ <rect width="320" height="240" fill="#f8fafc"/>
3
+ <rect x="16" y="16" width="200" height="24" rx="6" fill="#fff" stroke="#cbd5e1"/>
4
+ <rect x="24" y="24" width="64" height="8" rx="2" fill="#e2e8f0"/>
5
+ <g>
6
+ <rect x="16" y="56" width="88" height="88" rx="8" fill="#fff" stroke="#e2e8f0"/>
7
+ <rect x="24" y="64" width="72" height="48" rx="4" fill="#dbeafe"/>
8
+ <rect x="24" y="120" width="56" height="8" rx="2" fill="#cbd5e1"/>
9
+ <rect x="112" y="56" width="88" height="88" rx="8" fill="#fff" stroke="#e2e8f0"/>
10
+ <rect x="120" y="64" width="72" height="48" rx="4" fill="#fce7f3"/>
11
+ <rect x="120" y="120" width="56" height="8" rx="2" fill="#cbd5e1"/>
12
+ <rect x="208" y="56" width="88" height="88" rx="8" fill="#fff" stroke="#e2e8f0"/>
13
+ <rect x="216" y="64" width="72" height="48" rx="4" fill="#dcfce7"/>
14
+ <rect x="216" y="120" width="56" height="8" rx="2" fill="#cbd5e1"/>
15
+ </g>
16
+ <rect x="16" y="160" width="288" height="64" rx="8" fill="#fff" stroke="#e2e8f0"/>
17
+ </svg>
package/dist/index.d.ts CHANGED
@@ -487,6 +487,8 @@ interface WixStoresService {
487
487
  getCustomizations(): Promise<Customization[]>;
488
488
  /** Get cached data extension schemas for products. Lazily loaded. */
489
489
  getDataExtensionSchemas(): Promise<DataExtensionSchema[]>;
490
+ /** Get the "All Products" system category ID. Lazily fetched and cached. */
491
+ getAllProductsCategoryId(): Promise<string | null>;
490
492
  }
491
493
  /**
492
494
  * Server service marker for Wix Stores.
package/dist/index.js CHANGED
@@ -60,6 +60,7 @@ function provideWixStoresService(wixClient, options) {
60
60
  let cachedTree = null;
61
61
  let cachedCustomizations = null;
62
62
  let cachedExtensionSchemas = null;
63
+ let cachedAllProductsCategoryId;
63
64
  const categoriesClient = getCategoriesClient(wixClient);
64
65
  const customizationsClient = getCustomizationsV3Client(wixClient);
65
66
  const service = {
@@ -134,6 +135,17 @@ function provideWixStoresService(wixClient, options) {
134
135
  cachedExtensionSchemas = [];
135
136
  }
136
137
  return cachedExtensionSchemas;
138
+ },
139
+ async getAllProductsCategoryId() {
140
+ if (cachedAllProductsCategoryId !== void 0) return cachedAllProductsCategoryId;
141
+ try {
142
+ const result = await service.products.getAllProductsCategory();
143
+ cachedAllProductsCategoryId = result.categoryId ?? null;
144
+ } catch (error) {
145
+ console.error("[wix-stores] Failed to get All Products category:", error);
146
+ cachedAllProductsCategoryId = null;
147
+ }
148
+ return cachedAllProductsCategoryId;
137
149
  }
138
150
  };
139
151
  registerService(WIX_STORES_SERVICE_MARKER, service);
@@ -879,7 +891,10 @@ const EMPTY_CATEGORY_HEADER = {
879
891
  };
880
892
  async function findCategoryBySlug$1(categoriesClient, slug) {
881
893
  const result = await categoriesClient.queryCategories({ treeReference: { appNamespace: "@wix/stores" } }).eq("slug", slug).eq("visible", true).limit(1).find();
882
- return result.items?.[0] ?? null;
894
+ const cat = result.items?.[0];
895
+ if (!cat?._id)
896
+ return null;
897
+ return loadCategoryDetails(categoriesClient, cat._id);
883
898
  }
884
899
  async function loadCategoryDetails(categoriesClient, categoryId) {
885
900
  try {
@@ -889,8 +904,7 @@ async function loadCategoryDetails(categoriesClient, categoryId) {
889
904
  }
890
905
  }
891
906
  async function buildCategoryHeader(wixStoreService, category, categoryUrlTemplate) {
892
- const details = await loadCategoryDetails(wixStoreService.categories, category._id);
893
- const cat = details || category;
907
+ const cat = category;
894
908
  const imageUrl = cat.image ? formatWixMediaUrl("", cat.image) : "";
895
909
  const description = cat.description || "";
896
910
  const categoryTree = await wixStoreService.getCategoryTree();
@@ -959,18 +973,16 @@ async function buildCategoryHeader(wixStoreService, category, categoryUrlTemplat
959
973
  async function renderSlowlyChanging$4(props, wixStores) {
960
974
  const Pipeline = RenderPipeline.for();
961
975
  const categorySlug = props.category ?? null;
962
- const prefixSlug = props.prefix ?? null;
963
- const defaultCategorySlug = wixStores.defaultCategory;
964
976
  let activeCategory = null;
965
977
  let baseCategoryId = null;
966
978
  if (categorySlug) {
967
979
  activeCategory = await findCategoryBySlug$1(wixStores.categories, categorySlug);
968
980
  baseCategoryId = activeCategory?._id ?? null;
969
- } else if (prefixSlug) {
970
- activeCategory = await findCategoryBySlug$1(wixStores.categories, prefixSlug);
971
- baseCategoryId = activeCategory?._id ?? null;
972
- } else if (defaultCategorySlug) {
973
- activeCategory = await findCategoryBySlug$1(wixStores.categories, defaultCategorySlug);
981
+ } else {
982
+ const allProductsCategoryId = await wixStores.getAllProductsCategoryId();
983
+ if (allProductsCategoryId) {
984
+ activeCategory = await loadCategoryDetails(wixStores.categories, allProductsCategoryId);
985
+ }
974
986
  }
975
987
  const tree = await wixStores.getCategoryTree();
976
988
  const categoryHeader = activeCategory ? await buildCategoryHeader(wixStores, activeCategory, wixStores.urls.category) : EMPTY_CATEGORY_HEADER;
@@ -1156,12 +1168,13 @@ async function* loadSearchParams([wixStores]) {
1156
1168
  if (rootSlug) {
1157
1169
  params.push({ prefix: rootSlug, category: node.slug });
1158
1170
  } else {
1159
- params.push({ prefix: node.slug });
1171
+ params.push({ category: node.slug });
1160
1172
  }
1161
1173
  for (const child of node.children) {
1162
1174
  collectParams(child, rootSlug ?? node.slug);
1163
1175
  }
1164
1176
  };
1177
+ const allProductsCategoryId = await wixStores.getAllProductsCategoryId();
1165
1178
  const allCategories = [];
1166
1179
  let result = await wixStores.categories.queryCategories({
1167
1180
  treeReference: { appNamespace: "@wix/stores" }
@@ -1177,6 +1190,8 @@ async function* loadSearchParams([wixStores]) {
1177
1190
  for (const cat of allCategories) {
1178
1191
  if (!cat._id)
1179
1192
  continue;
1193
+ if (cat._id === allProductsCategoryId)
1194
+ continue;
1180
1195
  const node = {
1181
1196
  slug: cat.slug || "",
1182
1197
  itemCount: cat.itemCounter ?? 0,
@@ -1206,7 +1221,7 @@ async function* loadSearchParams([wixStores]) {
1206
1221
  for (const root of roots) {
1207
1222
  sumItems(root);
1208
1223
  }
1209
- const params = [];
1224
+ const params = [{}];
1210
1225
  for (const root of roots) {
1211
1226
  collectParams(root, null);
1212
1227
  }
@@ -1932,16 +1947,39 @@ function buildCategoryAddMenuItems(roots, config) {
1932
1947
  prompt: buildCategoryPrompt(config, entry)
1933
1948
  }));
1934
1949
  }
1950
+ const PUBLIC_THUMBNAIL_ROOT = path.join("public", "aiditor-add-menu-thumbnails");
1951
+ function copyAiditorAddMenuThumbnails(ctx, resolvePackagePath, pluginName) {
1952
+ const sourceDir = resolvePackagePath(
1953
+ path.join("agent-kit", "aiditor", "thumbnails", pluginName)
1954
+ );
1955
+ if (!fs.existsSync(sourceDir)) return [];
1956
+ const destDir = path.join(ctx.projectRoot, PUBLIC_THUMBNAIL_ROOT, pluginName);
1957
+ const created = [];
1958
+ fs.mkdirSync(destDir, { recursive: true });
1959
+ for (const entry of fs.readdirSync(sourceDir, { withFileTypes: true })) {
1960
+ if (!entry.isFile()) continue;
1961
+ const src = path.join(sourceDir, entry.name);
1962
+ const dest = path.join(destDir, entry.name);
1963
+ if (!fs.existsSync(dest) || ctx.force) {
1964
+ fs.copyFileSync(src, dest);
1965
+ created.push(path.posix.join(PUBLIC_THUMBNAIL_ROOT, pluginName, entry.name));
1966
+ }
1967
+ }
1968
+ return created;
1969
+ }
1935
1970
  const CONFIG_FILE_NAME = ".wix-stores.yaml";
1936
1971
  const ADD_MENU_OUTPUT_REL = "agent-kit/aiditor/add-menu/wix-stores.yaml";
1937
1972
  const ADD_MENU_GENERATED_REL = "agent-kit/aiditor/add-menu/wix-stores.generated.yaml";
1938
- function resolveAddMenuTemplatePath() {
1973
+ function resolvePackageAgentKitPath(relativePath) {
1939
1974
  const thisDir = path.dirname(fileURLToPath(import.meta.url));
1940
- const fromDist = path.join(thisDir, "agent-kit/aiditor/add-menu.template.yaml");
1975
+ const fromDist = path.join(thisDir, relativePath);
1941
1976
  if (fs.existsSync(fromDist)) {
1942
1977
  return fromDist;
1943
1978
  }
1944
- return path.join(thisDir, "..", "agent-kit/aiditor/add-menu.template.yaml");
1979
+ return path.join(thisDir, "..", relativePath);
1980
+ }
1981
+ function resolveAddMenuTemplatePath() {
1982
+ return resolvePackageAgentKitPath("agent-kit/aiditor/add-menu.template.yaml");
1945
1983
  }
1946
1984
  function writeAddMenuCatalog(ctx) {
1947
1985
  const outputPath = path.join(ctx.projectRoot, ADD_MENU_OUTPUT_REL);
@@ -2022,6 +2060,9 @@ async function setupWixStores(ctx) {
2022
2060
  if (addMenuCreated) {
2023
2061
  configCreated.push(addMenuCreated);
2024
2062
  }
2063
+ configCreated.push(
2064
+ ...copyAiditorAddMenuThumbnails(ctx, resolvePackageAgentKitPath, "wix-stores")
2065
+ );
2025
2066
  const message = `Wix Stores configured (product URL: ${service.urls.product})`;
2026
2067
  return {
2027
2068
  status: "configured",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jay-framework/wix-stores",
3
- "version": "0.19.7",
3
+ "version": "0.20.0",
4
4
  "type": "module",
5
5
  "description": "Wix Stores API client for Jay Framework",
6
6
  "license": "Apache-2.0",
@@ -31,7 +31,7 @@
31
31
  "validate": "jay-stack-cli validate-plugin",
32
32
  "build:client": "vite build",
33
33
  "build:server": "vite build --ssr",
34
- "build:copy-contract": "mkdir -p dist/contracts && cp lib/contracts/*.jay-contract* dist/contracts/ && mkdir -p dist/actions && cp lib/actions/*.jay-action dist/actions/ && mkdir -p dist/agent-kit/aiditor && cp agent-kit/aiditor/add-menu.template.yaml dist/agent-kit/aiditor/",
34
+ "build:copy-contract": "mkdir -p dist/contracts && cp lib/contracts/*.jay-contract* dist/contracts/ && mkdir -p dist/actions && cp lib/actions/*.jay-action dist/actions/ && mkdir -p dist/agent-kit/aiditor && cp agent-kit/aiditor/add-menu.template.yaml dist/agent-kit/aiditor/ && cp -R agent-kit/aiditor/thumbnails dist/agent-kit/aiditor/",
35
35
  "build:types": "tsup lib/index.ts --dts-only --format esm",
36
36
  "build:check-types": "tsc",
37
37
  "clean": "rimraf dist",
@@ -39,16 +39,16 @@
39
39
  "test": "vitest run"
40
40
  },
41
41
  "dependencies": {
42
- "@jay-framework/component": "^0.19.7",
43
- "@jay-framework/fullstack-component": "^0.19.7",
44
- "@jay-framework/reactive": "^0.19.7",
45
- "@jay-framework/runtime": "^0.19.7",
46
- "@jay-framework/secure": "^0.19.7",
47
- "@jay-framework/stack-client-runtime": "^0.19.7",
48
- "@jay-framework/stack-server-runtime": "^0.19.7",
49
- "@jay-framework/wix-cart": "^0.19.7",
50
- "@jay-framework/wix-server-client": "^0.19.7",
51
- "@jay-framework/wix-utils": "^0.19.7",
42
+ "@jay-framework/component": "^0.20.0",
43
+ "@jay-framework/fullstack-component": "^0.20.0",
44
+ "@jay-framework/reactive": "^0.20.0",
45
+ "@jay-framework/runtime": "^0.20.0",
46
+ "@jay-framework/secure": "^0.20.0",
47
+ "@jay-framework/stack-client-runtime": "^0.20.0",
48
+ "@jay-framework/stack-server-runtime": "^0.20.0",
49
+ "@jay-framework/wix-cart": "^0.20.0",
50
+ "@jay-framework/wix-server-client": "^0.20.0",
51
+ "@jay-framework/wix-utils": "^0.20.0",
52
52
  "@wix/categories": "^1.0.185",
53
53
  "@wix/data-extension-schema": "^1.0.221",
54
54
  "@wix/sdk": "^1.21.5",
@@ -60,10 +60,10 @@
60
60
  "@babel/core": "^7.23.7",
61
61
  "@babel/preset-env": "^7.23.8",
62
62
  "@babel/preset-typescript": "^7.23.3",
63
- "@jay-framework/compiler-jay-stack": "^0.19.7",
64
- "@jay-framework/jay-cli": "^0.19.7",
65
- "@jay-framework/jay-stack-cli": "^0.19.7",
66
- "@jay-framework/vite-plugin": "^0.19.7",
63
+ "@jay-framework/compiler-jay-stack": "^0.20.0",
64
+ "@jay-framework/jay-cli": "^0.20.0",
65
+ "@jay-framework/jay-stack-cli": "^0.20.0",
66
+ "@jay-framework/vite-plugin": "^0.20.0",
67
67
  "nodemon": "^3.0.3",
68
68
  "rimraf": "^5.0.5",
69
69
  "tslib": "^2.6.2",