@jay-framework/wix-stores 0.18.4 → 0.19.3
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 +6 -1
- package/dist/agent-kit/aiditor/add-menu.template.yaml +53 -0
- package/dist/contracts/category-list.jay-contract +1 -0
- package/dist/contracts/media.jay-contract +1 -2
- package/dist/contracts/media.jay-contract.d.ts +2 -3
- package/dist/contracts/product-card.jay-contract +8 -6
- package/dist/index.d.ts +1 -2
- package/dist/index.js +192 -10
- package/package.json +19 -18
package/README.md
CHANGED
|
@@ -50,7 +50,12 @@ The plugin requires `@jay-framework/wix-server-client` to be configured with Wix
|
|
|
50
50
|
jay-stack setup wix-stores
|
|
51
51
|
```
|
|
52
52
|
|
|
53
|
-
This creates `config/.wix-stores.yaml` and
|
|
53
|
+
This creates `config/.wix-stores.yaml` and writes static AIditor Add Menu component items to `agent-kit/aiditor/add-menu/wix-stores.yaml`.
|
|
54
|
+
|
|
55
|
+
Run `jay-stack agent-kit` (or `yarn agent-kit`) to index the live category tree and refresh:
|
|
56
|
+
|
|
57
|
+
- `agent-kit/references/wix-stores/categories.yaml` — full hierarchy for agent discovery
|
|
58
|
+
- `agent-kit/aiditor/add-menu/wix-stores.generated.yaml` — one Add Menu item per category (Store → Categories)
|
|
54
59
|
|
|
55
60
|
### Config File (`config/.wix-stores.yaml`)
|
|
56
61
|
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
items:
|
|
2
|
+
- id: wix-stores:product-search
|
|
3
|
+
title: Product search
|
|
4
|
+
category: Store
|
|
5
|
+
subCategory: Components
|
|
6
|
+
pluginName: wix-stores
|
|
7
|
+
packageName: "@jay-framework/wix-stores"
|
|
8
|
+
thumbnail: thumbnails/wix-stores/product-search.png
|
|
9
|
+
prompt: |
|
|
10
|
+
Use headless component @jay-framework/wix-stores / contract product-search.
|
|
11
|
+
Read agent-kit/materialized-contracts/wix-stores/product-search.jay-contract.
|
|
12
|
+
Script key: search
|
|
13
|
+
Bind ViewState and refs per agent-kit/designer/INSTRUCTIONS.md.
|
|
14
|
+
|
|
15
|
+
- id: wix-stores:product-page
|
|
16
|
+
title: Product page
|
|
17
|
+
category: Store
|
|
18
|
+
subCategory: Components
|
|
19
|
+
pluginName: wix-stores
|
|
20
|
+
packageName: "@jay-framework/wix-stores"
|
|
21
|
+
thumbnail: thumbnails/wix-stores/product-page.png
|
|
22
|
+
prompt: |
|
|
23
|
+
Use headless component @jay-framework/wix-stores / contract product-page.
|
|
24
|
+
Read agent-kit/materialized-contracts/wix-stores/product-page.jay-contract.
|
|
25
|
+
Script key: p
|
|
26
|
+
Bind ViewState and refs per agent-kit/designer/INSTRUCTIONS.md.
|
|
27
|
+
|
|
28
|
+
- id: wix-stores:related-products
|
|
29
|
+
title: Related products
|
|
30
|
+
category: Store
|
|
31
|
+
subCategory: Components
|
|
32
|
+
pluginName: wix-stores
|
|
33
|
+
packageName: "@jay-framework/wix-stores"
|
|
34
|
+
thumbnail: thumbnails/wix-stores/related-products.png
|
|
35
|
+
prompt: |
|
|
36
|
+
Use headless component @jay-framework/wix-stores / contract related-products.
|
|
37
|
+
Read agent-kit/materialized-contracts/wix-stores/related-products.jay-contract.
|
|
38
|
+
Script key: r
|
|
39
|
+
Bind ViewState and refs per agent-kit/designer/INSTRUCTIONS.md.
|
|
40
|
+
Use alongside product-page; pass productId and categorySlug as instance props.
|
|
41
|
+
|
|
42
|
+
- id: wix-stores:category-list
|
|
43
|
+
title: Category list
|
|
44
|
+
category: Store
|
|
45
|
+
subCategory: Components
|
|
46
|
+
pluginName: wix-stores
|
|
47
|
+
packageName: "@jay-framework/wix-stores"
|
|
48
|
+
thumbnail: thumbnails/wix-stores/category-list.png
|
|
49
|
+
prompt: |
|
|
50
|
+
Use headless component @jay-framework/wix-stores / contract category-list.
|
|
51
|
+
Read agent-kit/materialized-contracts/wix-stores/category-list.jay-contract.
|
|
52
|
+
Script key: categories
|
|
53
|
+
Bind ViewState and refs per agent-kit/designer/INSTRUCTIONS.md.
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
name: media
|
|
2
2
|
description: Single media item with URL, type, and thumbnail. Used as a sub-contract in media galleries.
|
|
3
3
|
tags:
|
|
4
|
-
- {tag: url, type: data, dataType: string, description: Media Url}
|
|
4
|
+
- {tag: url, type: data, dataType: string, description: Media Url, meta: {mediaType: wix-image}}
|
|
5
5
|
- {tag: mediaType, type: variant, dataType: "enum (IMAGE | VIDEO)", description: Media type}
|
|
6
|
-
- {tag: thumbnail_50x50, type: data, dataType: string, description: Media Thumbnail Url }
|
|
@@ -8,11 +8,10 @@ export enum MediaType {
|
|
|
8
8
|
|
|
9
9
|
export interface MediaViewState {
|
|
10
10
|
url: string,
|
|
11
|
-
mediaType: MediaType
|
|
12
|
-
thumbnail_50x50: string
|
|
11
|
+
mediaType: MediaType
|
|
13
12
|
}
|
|
14
13
|
|
|
15
|
-
export type MediaSlowViewState = Pick<MediaViewState, 'url' | 'mediaType'
|
|
14
|
+
export type MediaSlowViewState = Pick<MediaViewState, 'url' | 'mediaType'>;
|
|
16
15
|
|
|
17
16
|
export type MediaFastViewState = {};
|
|
18
17
|
|
|
@@ -42,17 +42,18 @@ tags:
|
|
|
42
42
|
type: data
|
|
43
43
|
dataType: string
|
|
44
44
|
description: Media URL
|
|
45
|
-
|
|
45
|
+
meta: {mediaType: wix-image}
|
|
46
|
+
|
|
46
47
|
- tag: altText
|
|
47
48
|
type: data
|
|
48
49
|
dataType: string
|
|
49
50
|
description: Media alt text
|
|
50
|
-
|
|
51
|
+
|
|
51
52
|
- tag: mediaType
|
|
52
53
|
type: data
|
|
53
54
|
dataType: enum (IMAGE | VIDEO)
|
|
54
55
|
description: Media type
|
|
55
|
-
|
|
56
|
+
|
|
56
57
|
- tag: thumbnail
|
|
57
58
|
type: sub-contract
|
|
58
59
|
description: Thumbnail image optimized for listings
|
|
@@ -61,17 +62,18 @@ tags:
|
|
|
61
62
|
type: data
|
|
62
63
|
dataType: string
|
|
63
64
|
description: Thumbnail URL
|
|
64
|
-
|
|
65
|
+
meta: {mediaType: wix-image}
|
|
66
|
+
|
|
65
67
|
- tag: altText
|
|
66
68
|
type: data
|
|
67
69
|
dataType: string
|
|
68
70
|
description: Thumbnail alt text
|
|
69
|
-
|
|
71
|
+
|
|
70
72
|
- tag: width
|
|
71
73
|
type: data
|
|
72
74
|
dataType: number
|
|
73
75
|
description: Thumbnail width in pixels
|
|
74
|
-
|
|
76
|
+
|
|
75
77
|
- tag: height
|
|
76
78
|
type: data
|
|
77
79
|
dataType: number
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -10,6 +10,7 @@ import { WIX_CLIENT_SERVICE } from "@jay-framework/wix-server-client";
|
|
|
10
10
|
import * as fs from "fs";
|
|
11
11
|
import * as path from "path";
|
|
12
12
|
import * as yaml from "js-yaml";
|
|
13
|
+
import { fileURLToPath } from "url";
|
|
13
14
|
var OptionRenderType$2 = /* @__PURE__ */ ((OptionRenderType2) => {
|
|
14
15
|
OptionRenderType2[OptionRenderType2["TEXT_CHOICES"] = 0] = "TEXT_CHOICES";
|
|
15
16
|
OptionRenderType2[OptionRenderType2["SWATCH_CHOICES"] = 1] = "SWATCH_CHOICES";
|
|
@@ -205,7 +206,7 @@ function parseWixMediaUrl(url) {
|
|
|
205
206
|
return result;
|
|
206
207
|
}
|
|
207
208
|
function formatWixMediaUrl(_id, url, resize) {
|
|
208
|
-
const resizeFragment =
|
|
209
|
+
const resizeFragment = "";
|
|
209
210
|
if (url == null ? void 0 : url.startsWith("wix:")) {
|
|
210
211
|
const parsed = parseWixMediaUrl(url);
|
|
211
212
|
if (parsed) {
|
|
@@ -429,7 +430,7 @@ function mapProductToCard(product, urls, tree) {
|
|
|
429
430
|
mediaType: mapMediaType$1(mainMedia?.mediaType)
|
|
430
431
|
},
|
|
431
432
|
thumbnail: {
|
|
432
|
-
url: mainMedia ? formatWixMediaUrl(mainMedia._id, mainMedia.url
|
|
433
|
+
url: mainMedia ? formatWixMediaUrl(mainMedia._id, mainMedia.url) : "",
|
|
433
434
|
altText: mainMedia?.altText || product.name || "",
|
|
434
435
|
width: 300,
|
|
435
436
|
height: 300
|
|
@@ -1343,7 +1344,7 @@ function mapMedia(media) {
|
|
|
1343
1344
|
const main = media?.main;
|
|
1344
1345
|
if (!main) {
|
|
1345
1346
|
return {
|
|
1346
|
-
selectedMedia: { url: "", mediaType: MediaType.IMAGE
|
|
1347
|
+
selectedMedia: { url: "", mediaType: MediaType.IMAGE },
|
|
1347
1348
|
availableMedia: []
|
|
1348
1349
|
};
|
|
1349
1350
|
}
|
|
@@ -1351,15 +1352,13 @@ function mapMedia(media) {
|
|
|
1351
1352
|
return {
|
|
1352
1353
|
selectedMedia: {
|
|
1353
1354
|
url: formatWixMediaUrl(main._id, main.url),
|
|
1354
|
-
mediaType: mainMediaType
|
|
1355
|
-
thumbnail_50x50: formatWixMediaUrl(main._id, main.url, { w: 50, h: 50 })
|
|
1355
|
+
mediaType: mainMediaType
|
|
1356
1356
|
},
|
|
1357
1357
|
availableMedia: media.itemsInfo?.items?.map((item) => ({
|
|
1358
1358
|
mediaId: item._id,
|
|
1359
1359
|
media: {
|
|
1360
1360
|
url: formatWixMediaUrl(item._id, item.url),
|
|
1361
|
-
mediaType: item.mediaType === "IMAGE" ? MediaType.IMAGE : MediaType.VIDEO
|
|
1362
|
-
thumbnail_50x50: formatWixMediaUrl(item._id, item.url, { w: 50, h: 50 })
|
|
1361
|
+
mediaType: item.mediaType === "IMAGE" ? MediaType.IMAGE : MediaType.VIDEO
|
|
1363
1362
|
},
|
|
1364
1363
|
selected: item._id === main._id ? Selected.selected : Selected.notSelected
|
|
1365
1364
|
})) ?? []
|
|
@@ -1650,8 +1649,9 @@ async function renderSlowlyChanging(props, wixStores) {
|
|
|
1650
1649
|
}
|
|
1651
1650
|
const categoryList = makeJayStackComponent().withProps().withServices(WIX_STORES_SERVICE_MARKER).withSlowlyRender(renderSlowlyChanging);
|
|
1652
1651
|
const WIX_STORES_CONTEXT = createJayContext("wix:stores");
|
|
1653
|
-
function loadWixStoresConfig() {
|
|
1654
|
-
const
|
|
1652
|
+
function loadWixStoresConfig(projectRoot) {
|
|
1653
|
+
const root = projectRoot ?? process.cwd();
|
|
1654
|
+
const configPath = path.join(root, "config", ".wix-stores.yaml");
|
|
1655
1655
|
const defaults = {
|
|
1656
1656
|
urls: { product: "/products/{slug}", category: null },
|
|
1657
1657
|
defaultCategory: null
|
|
@@ -1691,7 +1691,171 @@ const init = makeJayInit().withServer(async () => {
|
|
|
1691
1691
|
enableClientSearch: true
|
|
1692
1692
|
};
|
|
1693
1693
|
});
|
|
1694
|
+
function flattenCategoryTree(roots, parentNames = [], parentSlugs = [], rootSlug = null) {
|
|
1695
|
+
const entries = [];
|
|
1696
|
+
for (const node of roots) {
|
|
1697
|
+
const entryRootSlug = rootSlug ?? node.slug;
|
|
1698
|
+
entries.push({
|
|
1699
|
+
node,
|
|
1700
|
+
breadcrumbNames: parentNames,
|
|
1701
|
+
breadcrumbSlugs: parentSlugs,
|
|
1702
|
+
rootSlug: entryRootSlug,
|
|
1703
|
+
parentSlug: parentSlugs.length > 0 ? parentSlugs[parentSlugs.length - 1] : null
|
|
1704
|
+
});
|
|
1705
|
+
if (node.children.length > 0) {
|
|
1706
|
+
entries.push(
|
|
1707
|
+
...flattenCategoryTree(
|
|
1708
|
+
node.children,
|
|
1709
|
+
[...parentNames, node.name],
|
|
1710
|
+
[...parentSlugs, node.slug],
|
|
1711
|
+
entryRootSlug
|
|
1712
|
+
)
|
|
1713
|
+
);
|
|
1714
|
+
}
|
|
1715
|
+
}
|
|
1716
|
+
return entries;
|
|
1717
|
+
}
|
|
1718
|
+
function sanitizeIdSegment(slug, categoryId) {
|
|
1719
|
+
const sanitized = slug.trim().replace(/[^\w-]+/g, "-").replace(/^-+|-+$/g, "");
|
|
1720
|
+
if (sanitized.length > 0) {
|
|
1721
|
+
return sanitized.slice(0, 64);
|
|
1722
|
+
}
|
|
1723
|
+
return categoryId.slice(0, 8);
|
|
1724
|
+
}
|
|
1725
|
+
function uniqueCategoryItemId(slug, categoryId, usedIds) {
|
|
1726
|
+
const base = sanitizeIdSegment(slug, categoryId);
|
|
1727
|
+
let id = `wix-stores:category:${base}`;
|
|
1728
|
+
let suffix = 2;
|
|
1729
|
+
while (usedIds.has(id)) {
|
|
1730
|
+
id = `wix-stores:category:${base}-${suffix++}`;
|
|
1731
|
+
}
|
|
1732
|
+
usedIds.add(id);
|
|
1733
|
+
return id;
|
|
1734
|
+
}
|
|
1735
|
+
function formatCategoryTitle(entry) {
|
|
1736
|
+
const { node, breadcrumbNames, rootSlug } = entry;
|
|
1737
|
+
if (breadcrumbNames.length === 0) {
|
|
1738
|
+
return `Category — ${node.name}`;
|
|
1739
|
+
}
|
|
1740
|
+
const rootLabel = rootSlug !== node.slug ? ` (${rootSlug})` : "";
|
|
1741
|
+
const path2 = [...breadcrumbNames, node.name].join(" › ");
|
|
1742
|
+
return `Category — ${path2}${rootLabel}`;
|
|
1743
|
+
}
|
|
1744
|
+
function resolveExampleCategoryUrl(config, entry) {
|
|
1745
|
+
const template = config.urls.category;
|
|
1746
|
+
if (!template) {
|
|
1747
|
+
return null;
|
|
1748
|
+
}
|
|
1749
|
+
let url = template;
|
|
1750
|
+
if (url.includes("{prefix}")) {
|
|
1751
|
+
url = url.replace("{prefix}", entry.rootSlug);
|
|
1752
|
+
}
|
|
1753
|
+
if (url.includes("{category}")) {
|
|
1754
|
+
url = url.replace("{category}", entry.node.slug);
|
|
1755
|
+
}
|
|
1756
|
+
return url;
|
|
1757
|
+
}
|
|
1758
|
+
function buildCategoryPrompt(config, entry) {
|
|
1759
|
+
const { node, breadcrumbNames, breadcrumbSlugs, rootSlug, parentSlug } = entry;
|
|
1760
|
+
const hierarchyPath = breadcrumbNames.length > 0 ? [...breadcrumbNames, node.name].join(" > ") : node.name;
|
|
1761
|
+
const lines = [
|
|
1762
|
+
`Scope this request to Wix Stores category "${node.name}".`,
|
|
1763
|
+
"",
|
|
1764
|
+
"Category facts (from agent-kit/references/wix-stores/categories.yaml):",
|
|
1765
|
+
` Category ID: ${node._id}`,
|
|
1766
|
+
` Category slug: ${node.slug}`,
|
|
1767
|
+
` Product count: ${node.productCount}`,
|
|
1768
|
+
` Hierarchy: ${hierarchyPath}`
|
|
1769
|
+
];
|
|
1770
|
+
if (parentSlug) {
|
|
1771
|
+
lines.push(` Parent category slug: ${parentSlug}`);
|
|
1772
|
+
}
|
|
1773
|
+
if (rootSlug && rootSlug !== node.slug) {
|
|
1774
|
+
lines.push(` Root / prefix category slug: ${rootSlug}`);
|
|
1775
|
+
}
|
|
1776
|
+
const exampleUrl = resolveExampleCategoryUrl(config, entry);
|
|
1777
|
+
if (exampleUrl) {
|
|
1778
|
+
lines.push(` Example category URL (config/.wix-stores.yaml): ${exampleUrl}`);
|
|
1779
|
+
}
|
|
1780
|
+
lines.push(
|
|
1781
|
+
"",
|
|
1782
|
+
"Full indexed category tree: agent-kit/references/wix-stores/categories.yaml",
|
|
1783
|
+
"",
|
|
1784
|
+
"Common headless bindings for this category:",
|
|
1785
|
+
` product-search — filter by category slug via jay-params, e.g. category="${node.slug}"${rootSlug !== node.slug ? `; prefix="${rootSlug}" when URL template uses {prefix}` : ""}`
|
|
1786
|
+
);
|
|
1787
|
+
if (parentSlug) {
|
|
1788
|
+
lines.push(
|
|
1789
|
+
` category-list — show direct children with parentCategory="${parentSlug}"; this category's children use parentCategory="${node.slug}"`
|
|
1790
|
+
);
|
|
1791
|
+
} else {
|
|
1792
|
+
lines.push(
|
|
1793
|
+
` category-list — show top-level categories (no parentCategory), or children with parentCategory="${node.slug}"`
|
|
1794
|
+
);
|
|
1795
|
+
}
|
|
1796
|
+
lines.push(
|
|
1797
|
+
` related-products — pass categorySlug="${node.slug}" alongside a productId when showing related items in this category`,
|
|
1798
|
+
"",
|
|
1799
|
+
"Contracts:",
|
|
1800
|
+
" agent-kit/materialized-contracts/wix-stores/product-search.jay-contract",
|
|
1801
|
+
" agent-kit/materialized-contracts/wix-stores/category-list.jay-contract",
|
|
1802
|
+
" agent-kit/materialized-contracts/wix-stores/related-products.jay-contract",
|
|
1803
|
+
"",
|
|
1804
|
+
"Bind ViewState and refs per agent-kit/designer/INSTRUCTIONS.md."
|
|
1805
|
+
);
|
|
1806
|
+
if (config.defaultCategory) {
|
|
1807
|
+
lines.push(
|
|
1808
|
+
"",
|
|
1809
|
+
`Project defaultCategory (fallback when no category context): ${config.defaultCategory}`
|
|
1810
|
+
);
|
|
1811
|
+
}
|
|
1812
|
+
return lines.join("\n");
|
|
1813
|
+
}
|
|
1814
|
+
function buildCategoryAddMenuItems(roots, config) {
|
|
1815
|
+
const usedIds = /* @__PURE__ */ new Set();
|
|
1816
|
+
const entries = flattenCategoryTree(roots);
|
|
1817
|
+
return entries.map((entry) => ({
|
|
1818
|
+
id: uniqueCategoryItemId(entry.node.slug, entry.node._id, usedIds),
|
|
1819
|
+
title: formatCategoryTitle(entry),
|
|
1820
|
+
category: "Store",
|
|
1821
|
+
subCategory: "Categories",
|
|
1822
|
+
pluginName: "wix-stores",
|
|
1823
|
+
packageName: "@jay-framework/wix-stores",
|
|
1824
|
+
prompt: buildCategoryPrompt(config, entry)
|
|
1825
|
+
}));
|
|
1826
|
+
}
|
|
1694
1827
|
const CONFIG_FILE_NAME = ".wix-stores.yaml";
|
|
1828
|
+
const ADD_MENU_OUTPUT_REL = "agent-kit/aiditor/add-menu/wix-stores.yaml";
|
|
1829
|
+
const ADD_MENU_GENERATED_REL = "agent-kit/aiditor/add-menu/wix-stores.generated.yaml";
|
|
1830
|
+
function resolveAddMenuTemplatePath() {
|
|
1831
|
+
const thisDir = path.dirname(fileURLToPath(import.meta.url));
|
|
1832
|
+
const fromDist = path.join(thisDir, "agent-kit/aiditor/add-menu.template.yaml");
|
|
1833
|
+
if (fs.existsSync(fromDist)) {
|
|
1834
|
+
return fromDist;
|
|
1835
|
+
}
|
|
1836
|
+
return path.join(thisDir, "..", "agent-kit/aiditor/add-menu.template.yaml");
|
|
1837
|
+
}
|
|
1838
|
+
function writeAddMenuCatalog(ctx) {
|
|
1839
|
+
const outputPath = path.join(ctx.projectRoot, ADD_MENU_OUTPUT_REL);
|
|
1840
|
+
if (fs.existsSync(outputPath) && !ctx.force) {
|
|
1841
|
+
return null;
|
|
1842
|
+
}
|
|
1843
|
+
const templatePath = resolveAddMenuTemplatePath();
|
|
1844
|
+
const templateContent = fs.readFileSync(templatePath, "utf-8");
|
|
1845
|
+
fs.mkdirSync(path.dirname(outputPath), { recursive: true });
|
|
1846
|
+
fs.writeFileSync(outputPath, templateContent, "utf-8");
|
|
1847
|
+
return ADD_MENU_OUTPUT_REL;
|
|
1848
|
+
}
|
|
1849
|
+
function writeGeneratedAddMenuCatalog(projectRoot, categoryRoots) {
|
|
1850
|
+
const outputPath = path.join(projectRoot, ADD_MENU_GENERATED_REL);
|
|
1851
|
+
const config = loadWixStoresConfig(projectRoot);
|
|
1852
|
+
const items = buildCategoryAddMenuItems(categoryRoots, config);
|
|
1853
|
+
fs.mkdirSync(path.dirname(outputPath), { recursive: true });
|
|
1854
|
+
const header = "# DO NOT EDIT BY HAND — regenerated by jay-stack agent-kit (wix-stores references)\n\n";
|
|
1855
|
+
const body = yaml.dump({ items }, { indent: 2, lineWidth: 120, noRefs: true });
|
|
1856
|
+
fs.writeFileSync(outputPath, header + body, "utf-8");
|
|
1857
|
+
return ADD_MENU_GENERATED_REL;
|
|
1858
|
+
}
|
|
1695
1859
|
const CONFIG_TEMPLATE = `# Wix Stores Configuration
|
|
1696
1860
|
#
|
|
1697
1861
|
# URL templates for link generation.
|
|
@@ -1736,6 +1900,20 @@ async function setupWixStores(ctx) {
|
|
|
1736
1900
|
configCreated.push(`config/${CONFIG_FILE_NAME}`);
|
|
1737
1901
|
}
|
|
1738
1902
|
const service = getService(WIX_STORES_SERVICE_MARKER);
|
|
1903
|
+
try {
|
|
1904
|
+
await service.products.searchProducts({});
|
|
1905
|
+
} catch (e) {
|
|
1906
|
+
const msg = e.message || "";
|
|
1907
|
+
const hint = msg.includes("404") || msg.includes("not found") ? "Wix Stores may not be installed on this site" : msg.includes("403") || msg.includes("permission") ? "API key may lack Wix Stores permissions" : "This package requires the Stores Catalog V3 API — if using Catalog V1, use @jay-framework/wix-stores-v1 instead";
|
|
1908
|
+
return {
|
|
1909
|
+
status: "error",
|
|
1910
|
+
message: `Wix Stores V3 API check failed: ${hint}. (${msg})`
|
|
1911
|
+
};
|
|
1912
|
+
}
|
|
1913
|
+
const addMenuCreated = writeAddMenuCatalog(ctx);
|
|
1914
|
+
if (addMenuCreated) {
|
|
1915
|
+
configCreated.push(addMenuCreated);
|
|
1916
|
+
}
|
|
1739
1917
|
const message = `Wix Stores configured (product URL: ${service.urls.product})`;
|
|
1740
1918
|
return {
|
|
1741
1919
|
status: "configured",
|
|
@@ -1798,6 +1976,7 @@ async function generateWixStoresReferences(ctx) {
|
|
|
1798
1976
|
),
|
|
1799
1977
|
"utf-8"
|
|
1800
1978
|
);
|
|
1979
|
+
const addMenuGenerated = writeGeneratedAddMenuCatalog(ctx.projectRoot, roots);
|
|
1801
1980
|
let extensionFieldCount = 0;
|
|
1802
1981
|
try {
|
|
1803
1982
|
const extensionSchemas = await storesService.getDataExtensionSchemas();
|
|
@@ -1831,7 +2010,10 @@ async function generateWixStoresReferences(ctx) {
|
|
|
1831
2010
|
} catch (error) {
|
|
1832
2011
|
console.error("[wix-stores] Failed to fetch data extension schemas:", error);
|
|
1833
2012
|
}
|
|
1834
|
-
const referencesCreated = [
|
|
2013
|
+
const referencesCreated = [
|
|
2014
|
+
`agent-kit/references/${ctx.pluginName}/categories.yaml`,
|
|
2015
|
+
addMenuGenerated
|
|
2016
|
+
];
|
|
1835
2017
|
if (extensionFieldCount > 0) {
|
|
1836
2018
|
referencesCreated.push(`agent-kit/references/${ctx.pluginName}/data-extension-fields.yaml`);
|
|
1837
2019
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jay-framework/wix-stores",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.19.3",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Wix Stores API client for Jay Framework",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -30,24 +30,24 @@
|
|
|
30
30
|
"validate": "jay-stack-cli validate-plugin",
|
|
31
31
|
"build:client": "vite build",
|
|
32
32
|
"build:server": "vite build --ssr",
|
|
33
|
-
"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/",
|
|
33
|
+
"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
34
|
"build:types": "tsup lib/index.ts --dts-only --format esm",
|
|
35
35
|
"build:check-types": "tsc",
|
|
36
36
|
"clean": "rimraf dist",
|
|
37
37
|
"confirm": "npm run clean && npm run build && npm run test",
|
|
38
|
-
"test": "
|
|
38
|
+
"test": "vitest run"
|
|
39
39
|
},
|
|
40
40
|
"dependencies": {
|
|
41
|
-
"@jay-framework/component": "^0.
|
|
42
|
-
"@jay-framework/fullstack-component": "^0.
|
|
43
|
-
"@jay-framework/reactive": "^0.
|
|
44
|
-
"@jay-framework/runtime": "^0.
|
|
45
|
-
"@jay-framework/secure": "^0.
|
|
46
|
-
"@jay-framework/stack-client-runtime": "^0.
|
|
47
|
-
"@jay-framework/stack-server-runtime": "^0.
|
|
48
|
-
"@jay-framework/wix-cart": "^0.
|
|
49
|
-
"@jay-framework/wix-server-client": "^0.
|
|
50
|
-
"@jay-framework/wix-utils": "^0.
|
|
41
|
+
"@jay-framework/component": "^0.19.3",
|
|
42
|
+
"@jay-framework/fullstack-component": "^0.19.3",
|
|
43
|
+
"@jay-framework/reactive": "^0.19.3",
|
|
44
|
+
"@jay-framework/runtime": "^0.19.3",
|
|
45
|
+
"@jay-framework/secure": "^0.19.3",
|
|
46
|
+
"@jay-framework/stack-client-runtime": "^0.19.3",
|
|
47
|
+
"@jay-framework/stack-server-runtime": "^0.19.3",
|
|
48
|
+
"@jay-framework/wix-cart": "^0.19.3",
|
|
49
|
+
"@jay-framework/wix-server-client": "^0.19.3",
|
|
50
|
+
"@jay-framework/wix-utils": "^0.19.3",
|
|
51
51
|
"@wix/categories": "^1.0.185",
|
|
52
52
|
"@wix/data-extension-schema": "^1.0.221",
|
|
53
53
|
"@wix/sdk": "^1.21.5",
|
|
@@ -59,16 +59,17 @@
|
|
|
59
59
|
"@babel/core": "^7.23.7",
|
|
60
60
|
"@babel/preset-env": "^7.23.8",
|
|
61
61
|
"@babel/preset-typescript": "^7.23.3",
|
|
62
|
-
"@jay-framework/compiler-jay-stack": "^0.
|
|
63
|
-
"@jay-framework/jay-cli": "^0.
|
|
64
|
-
"@jay-framework/jay-stack-cli": "^0.
|
|
65
|
-
"@jay-framework/vite-plugin": "^0.
|
|
62
|
+
"@jay-framework/compiler-jay-stack": "^0.19.3",
|
|
63
|
+
"@jay-framework/jay-cli": "^0.19.3",
|
|
64
|
+
"@jay-framework/jay-stack-cli": "^0.19.3",
|
|
65
|
+
"@jay-framework/vite-plugin": "^0.19.3",
|
|
66
66
|
"nodemon": "^3.0.3",
|
|
67
67
|
"rimraf": "^5.0.5",
|
|
68
68
|
"tslib": "^2.6.2",
|
|
69
69
|
"tsup": "^8.5.1",
|
|
70
70
|
"typescript": "^5.3.3",
|
|
71
71
|
"vite": "^5.0.11",
|
|
72
|
-
"vite-plugin-inspect": "^0.8.1"
|
|
72
|
+
"vite-plugin-inspect": "^0.8.1",
|
|
73
|
+
"vitest": "^1.2.0"
|
|
73
74
|
}
|
|
74
75
|
}
|