@jay-framework/wix-stores-v1 0.25.5 → 0.26.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.
@@ -0,0 +1,75 @@
1
+ # wix-stores-v1 — dashboard-managed content
2
+
3
+ **Plugin** `@jay-framework/wix-stores-v1` · **contracts** `product-page`, `product-search`, `category-page`, `category-list`.
4
+
5
+ Product and collection data (names, prices, descriptions, images, options) is managed in the **Wix dashboard**. When asked to change it: **do not edit code.** Identify the record with the steps below. **Never write without an id from these steps** — a wrong id changes, or sends the site owner to, the wrong product. When a step doesn't give a clear answer, use a [fallback](#fallbacks): it gives a list link and never writes.
6
+
7
+ **Mixed requests** (e.g. "change the price and make the title bigger"): edit the jay-html part normally, and handle the catalog data part with the steps below.
8
+
9
+ ## Agent behavior
10
+
11
+ ### Reply style
12
+
13
+ Keep replies to the site owner **short and simple** (about 1–3 sentences). They are often non-technical — use everyday words and a visual or business angle. Say **what** changed or **where** they can change the product or collection in Wix. Do **not** put file paths, code, binding syntax, or internal ids in the thread reply (use ids only in tools and in the steps below).
14
+
15
+ ### Update data or send a link
16
+
17
+ - **Try to update** when you are **confident** you have the right record id (steps 1–2), the request is **unambiguous**, and you have a **Wix API or tool** that can apply the change. After a successful update, confirm in plain language and include the dashboard link from step 3 so they can review.
18
+ - If you are **not** confident, the request is **ambiguous**, or you **lack** a working update tool → **do not write**. Build the dashboard link when you can and tell them where to edit in the Wix Stores dashboard.
19
+ - If an update **fails** → say so briefly and give the dashboard link.
20
+
21
+ Do not hard-code catalog values into jay-html.
22
+
23
+ ### Ambiguity and area markers
24
+
25
+ A screenshot may show **several products or collections** inside one **area marker**, but inspect returns **one** `Target source` (one element, at most **one** record id from the steps below).
26
+
27
+ When you are unsure — several items visible, the comment does not name which one, “change these” without naming each, or the resolved id may not match what they meant — **do not write**. Explain briefly what you see, which item (if any) the mark resolved to, and **ask them to clarify** (name the product or collection, say “both”, or mark one item at a time). Use the [fallback](#fallbacks) list link when several items might be in scope; use a single-record link only when the steps gave one clear id.
28
+
29
+ ## What you get
30
+
31
+ When the user clicks an element in the editor, you get the **source-editing inspector result**: `file` (the page jay-html), `route`, `routePattern`, `node` (the clicked element: `lines`, `tag`, `html` — its open tag, attributes and own text) and `stack` — enclosing frames, **innermost → outermost**:
32
+
33
+ - `{ kind: 'forEach', lines, itemId }` — a repeated item; `itemId` is the value of its `trackBy`.
34
+ - `{ kind: 'region', lines, name, props? }` — a `<jay:NAME …>` instance; `props` are its static props.
35
+
36
+ All `lines` are 1-based ranges in `file`. This plugin's contracts are added as page scripts — `<script type="application/jay-headless" plugin="@jay-framework/wix-stores-v1" contract="X" key="K">` in `<head>` — which produce **no** `region` frame; their lists appear as `forEach="K.<list>"`. Only scripts with `plugin="@jay-framework/wix-stores-v1"` count.
37
+
38
+ No inspector result → fallback.
39
+
40
+ ## Steps
41
+
42
+ 1. **Find the record.** Go through the `forEach` frames in `stack`, innermost first. For each, read the element in `file` at the frame's `lines` and match its `forEach="…"` against this table. A row matches only if the element also has `trackBy="_id"`.
43
+
44
+ | `forEach` attribute | page script | `itemId` is |
45
+ |---------------------|-------------|-------------|
46
+ | `K.searchResults` | `contract="product-search" key="K"` | product `_id` |
47
+ | `K.products` or `K.loadedProducts` | `contract="category-page" key="K"` | product `_id` |
48
+ | `K.categories` | `contract="category-list" key="K"` | collection `_id` |
49
+
50
+ Use the **first** frame that matches. Any other `forEach` (`suggestions`, `filters…`, `breadcrumbs`, `media…`, `options`, `choices`, `modifiers`, `infoSections`, …) is **not** a product or collection — skip it and keep going outward.
51
+
52
+ 2. **No match in step 1:**
53
+ - **Product page** — `file` has a page script `contract="product-page"`: slug = the script body's `slug:` value if present, otherwise the value in `route` at the `[slug]` segment of `routePattern`. Call `wix-stores-v1/getProductBySlug` with `{ "slug": "<slug>" }`; product id = the result's `_id`, name = its `name`. On a product page, **never** use a `forEach` `itemId` — those are option / info-section / modifier ids.
54
+ - **Collection page** (click outside its product list, e.g. the header) — page script `contract="category-page"`: it's the collection; use the collections link.
55
+ - Neither applies → fallback.
56
+
57
+ 3. **Build the link** with `wix-server-client/getDashboardUrl` `{ "path": "<path>" }`:
58
+ - product → `wix-stores/products/product/<productId>`
59
+ - collection → `wix-stores/categories/list` (no per-collection link is verified for Catalog V1)
60
+
61
+ Run from the project root: `npx jay-stack-cli action wix-server-client/getDashboardUrl --input '{"path":"<path>"}'`; the output's `url` is the link. Never read `config/.wix.yaml` or other credential files to build it.
62
+
63
+ 4. **Reply** (see [Agent behavior](#agent-behavior)): plain language only — e.g. “This product is in your Wix Stores catalog; edit it here: <url>” or “I updated the name; review it here: <url>”. Name it from `getProductBySlug` or visible text; **never invent a name.**
64
+
65
+ ## Fallbacks
66
+
67
+ Give the list link instead, and say you couldn't identify the specific item: products → path `wix-stores/products`; collections → path `wix-stores/categories/list`.
68
+
69
+ Fall back when: there is no inspector result; no step matches; `trackBy` isn't `_id`; `wix-stores-v1/getProductBySlug` returns `null`; or the slug can't be read.
70
+
71
+ If `wix-server-client/getDashboardUrl` itself fails, give no link: say the data is managed in the Wix dashboard (Store Products / Categories) and that you couldn't build the link.
72
+
73
+ ## Not dashboard content
74
+
75
+ Layout, CSS and markup live in jay-html — edit those normally.
package/dist/index.js CHANGED
@@ -465,6 +465,8 @@ function allOptionsHaveSelection(options) {
465
465
  }
466
466
  return true;
467
467
  }
468
+ const SLOW_RENDER_TTL = 600;
469
+ const SLOW_RENDER_GRACE = 3600;
468
470
  function mapProductType(productType) {
469
471
  return productType === "digital" ? ProductType.DIGITAL : ProductType.PHYSICAL;
470
472
  }
@@ -619,7 +621,9 @@ async function renderSlowlyChanging$3(props, wixStores) {
619
621
  pricePerUnit: "",
620
622
  stockStatus,
621
623
  variants
622
- }
624
+ },
625
+ ttl: SLOW_RENDER_TTL,
626
+ grace: SLOW_RENDER_GRACE
623
627
  };
624
628
  });
625
629
  }
@@ -687,7 +691,9 @@ async function renderSlowlyChanging$2(props, wixStores) {
687
691
  searchFields: "name,description,sku",
688
692
  fuzzySearch: false,
689
693
  collections: collectionInfos
690
- }
694
+ },
695
+ ttl: SLOW_RENDER_TTL,
696
+ grace: SLOW_RENDER_GRACE
691
697
  };
692
698
  });
693
699
  }
@@ -800,7 +806,9 @@ async function renderSlowlyChanging$1(props, wixStores) {
800
806
  categories: collectionItems,
801
807
  hasCategories: collectionItems.length > 0
802
808
  },
803
- carryForward: {}
809
+ carryForward: {},
810
+ ttl: SLOW_RENDER_TTL,
811
+ grace: SLOW_RENDER_GRACE
804
812
  };
805
813
  });
806
814
  }
@@ -897,7 +905,9 @@ async function renderSlowlyChanging(props, wixStores) {
897
905
  totalProducts: productData.total,
898
906
  products: productData.products,
899
907
  currentOffset: productData.products.length
900
- }
908
+ },
909
+ ttl: SLOW_RENDER_TTL,
910
+ grace: SLOW_RENDER_GRACE
901
911
  };
902
912
  });
903
913
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jay-framework/wix-stores-v1",
3
- "version": "0.25.5",
3
+ "version": "0.26.0",
4
4
  "type": "module",
5
5
  "description": "Wix Stores Catalog V1 API client for Jay Framework",
6
6
  "license": "Apache-2.0",
@@ -46,16 +46,16 @@
46
46
  "test": "vitest run"
47
47
  },
48
48
  "dependencies": {
49
- "@jay-framework/component": "^0.25.5",
50
- "@jay-framework/fullstack-component": "^0.25.5",
51
- "@jay-framework/reactive": "^0.25.5",
52
- "@jay-framework/runtime": "^0.25.5",
53
- "@jay-framework/secure": "^0.25.5",
54
- "@jay-framework/stack-client-runtime": "^0.25.5",
55
- "@jay-framework/stack-server-runtime": "^0.25.5",
56
- "@jay-framework/wix-cart": "^0.25.5",
57
- "@jay-framework/wix-server-client": "^0.25.5",
58
- "@jay-framework/wix-utils": "^0.25.5",
49
+ "@jay-framework/component": "^0.26.0",
50
+ "@jay-framework/fullstack-component": "^0.26.0",
51
+ "@jay-framework/reactive": "^0.26.0",
52
+ "@jay-framework/runtime": "^0.26.0",
53
+ "@jay-framework/secure": "^0.26.0",
54
+ "@jay-framework/stack-client-runtime": "^0.26.0",
55
+ "@jay-framework/stack-server-runtime": "^0.26.0",
56
+ "@jay-framework/wix-cart": "^0.26.0",
57
+ "@jay-framework/wix-server-client": "^0.26.0",
58
+ "@jay-framework/wix-utils": "^0.26.0",
59
59
  "@wix/sdk": "^1.21.5",
60
60
  "js-yaml": "^4.1.0"
61
61
  },
@@ -63,18 +63,18 @@
63
63
  "@babel/core": "^7.23.7",
64
64
  "@babel/preset-env": "^7.23.8",
65
65
  "@babel/preset-typescript": "^7.23.3",
66
- "@jay-framework/compiler-jay-stack": "^0.25.5",
67
- "@jay-framework/compiler-shared": "^0.25.5",
68
- "@jay-framework/jay-cli": "^0.25.5",
69
- "@jay-framework/jay-stack-cli": "^0.25.5",
70
- "@jay-framework/vite-plugin": "^0.25.5",
66
+ "@jay-framework/compiler-jay-stack": "^0.26.0",
67
+ "@jay-framework/compiler-shared": "^0.26.0",
68
+ "@jay-framework/jay-cli": "^0.26.0",
69
+ "@jay-framework/jay-stack-cli": "^0.26.0",
70
+ "@jay-framework/vite-plugin": "^0.26.0",
71
71
  "nodemon": "^3.0.3",
72
72
  "rimraf": "^5.0.5",
73
73
  "tslib": "^2.6.2",
74
74
  "tsup": "^8.5.1",
75
75
  "typescript": "^5.3.3",
76
- "vite": "^5.0.11",
76
+ "vite": "^6.4.4",
77
77
  "vite-plugin-inspect": "^0.8.1",
78
- "vitest": "^1.2.0"
78
+ "vitest": "^4.1.11"
79
79
  }
80
80
  }
package/plugin.yaml CHANGED
@@ -9,18 +9,22 @@ contracts:
9
9
  headTags:
10
10
  - title
11
11
  - meta:description
12
+ editingGuide: ./agent-kit/designer/wix-stores-v1-dashboard-content.md
12
13
  - name: product-search
13
14
  contract: product-search.jay-contract
14
15
  component: productSearch
15
16
  description: Headless product search page (Catalog V1)
17
+ editingGuide: ./agent-kit/designer/wix-stores-v1-dashboard-content.md
16
18
  - name: category-page
17
19
  contract: category-page.jay-contract
18
20
  component: categoryPage
19
21
  description: Collection page showing products (V1 uses collections instead of categories)
22
+ editingGuide: ./agent-kit/designer/wix-stores-v1-dashboard-content.md
20
23
  - name: category-list
21
24
  contract: category-list.jay-contract
22
25
  component: categoryList
23
26
  description: List of store collections (V1 uses collections instead of categories)
27
+ editingGuide: ./agent-kit/designer/wix-stores-v1-dashboard-content.md
24
28
 
25
29
  # Server actions (named exports from main module)
26
30
  actions: