@jay-framework/wix-stores 0.19.5 → 0.19.6

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/dist/index.js CHANGED
@@ -1314,15 +1314,22 @@ function mapInfoSections(infoSections) {
1314
1314
  uniqueName: infoSection.uniqueName || ""
1315
1315
  }));
1316
1316
  }
1317
- function mapSeoHeadTags(seoData) {
1318
- if (!seoData)
1319
- return [];
1320
- const headTags = (seoData.tags || []).map((tag) => ({
1317
+ function mapSeoHeadTags(product, seoData) {
1318
+ const headTags = (seoData?.tags || []).map((tag) => ({
1321
1319
  tag: tag.type || "meta",
1322
1320
  attrs: Object.fromEntries(Object.entries(tag.props || {}).map(([key, value]) => [key, value])),
1323
1321
  children: tag.children || void 0
1324
1322
  }));
1325
- const keywords = seoData.settings?.keywords;
1323
+ if (!headTags.some((t) => t.tag === "title") && product.name) {
1324
+ headTags.push({ tag: "title", children: product.name });
1325
+ }
1326
+ if (!headTags.some((t) => t.tag === "meta" && t.attrs?.name === "description") && product.plainDescription) {
1327
+ headTags.push({
1328
+ tag: "meta",
1329
+ attrs: { name: "description", content: product.plainDescription }
1330
+ });
1331
+ }
1332
+ const keywords = seoData?.settings?.keywords;
1326
1333
  if (keywords?.length) {
1327
1334
  const terms = keywords.map((k) => k.term).filter(Boolean);
1328
1335
  if (terms.length) {
@@ -1482,7 +1489,7 @@ async function renderSlowlyChanging$2(props, wixStores) {
1482
1489
  modifiers: mapModifiersToSlowVS(modifiers),
1483
1490
  extendedFields: mapExtendedFields(product)
1484
1491
  },
1485
- headTags: mapSeoHeadTags(seoData),
1492
+ headTags: mapSeoHeadTags({ name, plainDescription }, seoData),
1486
1493
  carryForward: {
1487
1494
  productId: _id,
1488
1495
  mediaGallery: mapMedia(media),
@@ -1691,15 +1698,19 @@ const init = makeJayInit().withServer(async () => {
1691
1698
  enableClientSearch: true
1692
1699
  };
1693
1700
  });
1694
- function flattenCategoryTree(roots, parentNames = [], parentSlugs = [], rootSlug = null) {
1701
+ function flattenCategoryTree(roots, parentNames = [], parentSlugs = [], rootSlug = null, rootName = null, rootHasChildren = null) {
1695
1702
  const entries = [];
1696
1703
  for (const node of roots) {
1697
1704
  const entryRootSlug = rootSlug ?? node.slug;
1705
+ const entryRootName = rootName ?? node.name;
1706
+ const entryRootHasChildren = rootHasChildren ?? node.children.length > 0;
1698
1707
  entries.push({
1699
1708
  node,
1700
1709
  breadcrumbNames: parentNames,
1701
1710
  breadcrumbSlugs: parentSlugs,
1702
1711
  rootSlug: entryRootSlug,
1712
+ rootName: entryRootName,
1713
+ rootHasChildren: entryRootHasChildren,
1703
1714
  parentSlug: parentSlugs.length > 0 ? parentSlugs[parentSlugs.length - 1] : null
1704
1715
  });
1705
1716
  if (node.children.length > 0) {
@@ -1708,7 +1719,9 @@ function flattenCategoryTree(roots, parentNames = [], parentSlugs = [], rootSlug
1708
1719
  node.children,
1709
1720
  [...parentNames, node.name],
1710
1721
  [...parentSlugs, node.slug],
1711
- entryRootSlug
1722
+ entryRootSlug,
1723
+ entryRootName,
1724
+ entryRootHasChildren
1712
1725
  )
1713
1726
  );
1714
1727
  }
@@ -1811,6 +1824,12 @@ function buildCategoryPrompt(config, entry) {
1811
1824
  }
1812
1825
  return lines.join("\n");
1813
1826
  }
1827
+ function resolveCategorySubCategory(entry) {
1828
+ if (entry.rootHasChildren) {
1829
+ return entry.rootName;
1830
+ }
1831
+ return "Categories";
1832
+ }
1814
1833
  function buildCategoryAddMenuItems(roots, config) {
1815
1834
  const usedIds = /* @__PURE__ */ new Set();
1816
1835
  const entries = flattenCategoryTree(roots);
@@ -1818,7 +1837,7 @@ function buildCategoryAddMenuItems(roots, config) {
1818
1837
  id: uniqueCategoryItemId(entry.node.slug, entry.node._id, usedIds),
1819
1838
  title: formatCategoryTitle(entry),
1820
1839
  category: "Store",
1821
- subCategory: "Categories",
1840
+ subCategory: resolveCategorySubCategory(entry),
1822
1841
  pluginName: "wix-stores",
1823
1842
  packageName: "@jay-framework/wix-stores",
1824
1843
  prompt: buildCategoryPrompt(config, entry)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jay-framework/wix-stores",
3
- "version": "0.19.5",
3
+ "version": "0.19.6",
4
4
  "type": "module",
5
5
  "description": "Wix Stores API client for Jay Framework",
6
6
  "license": "Apache-2.0",
@@ -38,16 +38,16 @@
38
38
  "test": "vitest run"
39
39
  },
40
40
  "dependencies": {
41
- "@jay-framework/component": "^0.19.5",
42
- "@jay-framework/fullstack-component": "^0.19.5",
43
- "@jay-framework/reactive": "^0.19.5",
44
- "@jay-framework/runtime": "^0.19.5",
45
- "@jay-framework/secure": "^0.19.5",
46
- "@jay-framework/stack-client-runtime": "^0.19.5",
47
- "@jay-framework/stack-server-runtime": "^0.19.5",
48
- "@jay-framework/wix-cart": "^0.19.5",
49
- "@jay-framework/wix-server-client": "^0.19.5",
50
- "@jay-framework/wix-utils": "^0.19.5",
41
+ "@jay-framework/component": "^0.19.6",
42
+ "@jay-framework/fullstack-component": "^0.19.6",
43
+ "@jay-framework/reactive": "^0.19.6",
44
+ "@jay-framework/runtime": "^0.19.6",
45
+ "@jay-framework/secure": "^0.19.6",
46
+ "@jay-framework/stack-client-runtime": "^0.19.6",
47
+ "@jay-framework/stack-server-runtime": "^0.19.6",
48
+ "@jay-framework/wix-cart": "^0.19.6",
49
+ "@jay-framework/wix-server-client": "^0.19.6",
50
+ "@jay-framework/wix-utils": "^0.19.6",
51
51
  "@wix/categories": "^1.0.185",
52
52
  "@wix/data-extension-schema": "^1.0.221",
53
53
  "@wix/sdk": "^1.21.5",
@@ -59,10 +59,10 @@
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.19.5",
63
- "@jay-framework/jay-cli": "^0.19.5",
64
- "@jay-framework/jay-stack-cli": "^0.19.5",
65
- "@jay-framework/vite-plugin": "^0.19.5",
62
+ "@jay-framework/compiler-jay-stack": "^0.19.6",
63
+ "@jay-framework/jay-cli": "^0.19.6",
64
+ "@jay-framework/jay-stack-cli": "^0.19.6",
65
+ "@jay-framework/vite-plugin": "^0.19.6",
66
66
  "nodemon": "^3.0.3",
67
67
  "rimraf": "^5.0.5",
68
68
  "tslib": "^2.6.2",
package/plugin.yaml CHANGED
@@ -22,6 +22,9 @@ dynamic_contracts:
22
22
  - prefix: 'product-page'
23
23
  component: productPage
24
24
  generator: productPageContractGenerator
25
+ headTags:
26
+ - title
27
+ - meta:description
25
28
 
26
29
  # Server actions (named exports from main module)
27
30
  actions: