@wix/agent-skills 1.30.0 → 1.31.1
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/package.json +1 -1
- package/skills/wix-app/SKILL.md +7 -8
- package/skills/wix-app/references/DASHBOARD_PAGE.md +1 -1
- package/skills/wix-app/references/WIX_PATTERNS_DOCS.md +11 -50
- package/skills/wix-app/references/dashboard-page/DATA_SOURCES.md +14 -10
- package/skills/wix-app/references/dashboard-page/DRAFT_TEMPLATE.md +5 -8
- package/skills/wix-app/references/dashboard-page/TABLE_STATE.md +5 -4
- package/skills/wix-headless-kit/SKILL.md +20 -12
- package/skills/wix-headless-kit/guides/api-run.md +178 -0
- package/skills/wix-headless-kit/guides/existing-site.md +3 -2
- package/skills/wix-headless-kit/guides/reference-mode.md +9 -1
- package/skills/wix-headless-kit/install/AGENTS.md +7 -5
- package/skills/wix-headless-kit/install/attach.mjs +3 -3
- package/skills/wix-headless-kit/install/context.mjs +13 -3
- package/skills/wix-headless-kit/install/deploy.mjs +3 -3
- package/skills/wix-headless-kit/install/pins.json +1 -1
- package/skills/wix-headless-kit/install/setup.mjs +2 -2
- package/skills/wix-headless-kit/install/templates.mjs +2 -1
- package/skills/wix-headless-templates/blog/seed/SEED.md +1 -1
- package/skills/wix-headless-templates/blog/seed/seed-blog.mjs +2 -2
- package/skills/wix-headless-templates/bookings/seed/SEED.md +1 -1
- package/skills/wix-headless-templates/bookings/seed/seed-bookings.mjs +2 -1
- package/skills/wix-headless-templates/donations/seed/SEED.md +1 -1
- package/skills/wix-headless-templates/donations/seed/seed-donations.mjs +3 -2
- package/skills/wix-headless-templates/events/seed/SEED.md +1 -1
- package/skills/wix-headless-templates/events/seed/seed-events.mjs +3 -2
- package/skills/wix-headless-templates/portfolio/seed/SEED.md +4 -2
- package/skills/wix-headless-templates/portfolio/seed/seed-portfolio.mjs +6 -6
- package/skills/wix-headless-templates/rentals/seed/SEED.md +1 -1
- package/skills/wix-headless-templates/rentals/seed/seed-rentals.mjs +2 -1
- package/skills/wix-headless-templates/restaurants/seed/SEED.md +1 -1
- package/skills/wix-headless-templates/restaurants/seed/seed-restaurants.mjs +4 -3
- package/skills/wix-headless-templates/shared/seed/images.mjs +63 -7
- package/skills/wix-headless-templates/storefront/seed/SEED.md +17 -5
- package/skills/wix-headless-templates/storefront/seed/seed-store.mjs +49 -16
- package/skills/wix-manage/SKILL.md +25 -15
- package/skills/wix-manage/references/automations/activation-status.md +52 -0
- package/skills/wix-manage/references/automations/api-catalog.md +81 -0
- package/skills/wix-manage/references/automations/build-and-manage-automations.md +34 -0
- package/skills/wix-manage/references/bookings/create-and-update-booking-services.md +277 -363
- package/skills/wix-manage/references/custom-apps/use-app-skills-and-app-tools.md +3 -1
- package/skills/wix-manage/references/sites/send-feedback-to-wix.md +92 -0
- package/skills/wix-manage/references/sites/upload-static-site.md +258 -279
- package/skills/wix-vibe-headless/platforms/base44-ecom-light-seed-with-install.md +7 -1
- package/skills/wix-vibe-headless/platforms/base44-ecom-light-seed.md +7 -1
- package/skills/wix-vibe-headless/platforms/base44-ecom-light.md +7 -1
- package/skills/wix-headless-kit/guides/no-machine.md +0 -115
- package/skills/wix-manage/references/bookings/create-appointment-service.md +0 -243
- package/skills/wix-manage/references/bookings/create-booking-service-from-prompt.md +0 -31
- package/skills/wix-manage/references/bookings/create-class-service.md +0 -222
- package/skills/wix-manage/references/bookings/create-course-service.md +0 -251
package/package.json
CHANGED
package/skills/wix-app/SKILL.md
CHANGED
|
@@ -28,9 +28,9 @@ Helps build extensions for Wix CLI applications. Covers all extension types: das
|
|
|
28
28
|
- [ ] **Every filter reaches the query**: declared in the collection hook's `filters` and read inside `fetchData`. Filter UI that never narrows the rows is a defect that looks like a feature.
|
|
29
29
|
|
|
30
30
|
A filtered table with no drill-in and no working filters is what gets built when nobody states the requirement — the most common way a generated dashboard disappoints. The aggregate is the judgment call; the drill-in and the filters are not.
|
|
31
|
-
- [ ] **🛑 Template-First Gate (MANDATORY, dashboard UI only, comes before writing any shell/provider/router):** Followed [DRAFT_TEMPLATE.md](references/dashboard-page/DRAFT_TEMPLATE.md): found the page templates the installed `@wix/patterns` ships, chose one with its `Page Templates.md` guide — which pages the workflow above needs, **and where the rows come from** (your own fetch, or a CMS collection) — read that template's page, and copied every file
|
|
32
|
-
- [ ] **🛑 Patterns Docs Gate (MANDATORY for any dashboard page UI):** Read [WIX_PATTERNS_DOCS.md](references/WIX_PATTERNS_DOCS.md) **before the first command that touches `node_modules/@wix/patterns`** — its discovery chain (`pkg-root.cjs`, the index, `Composition and Providers.md` once, `Collection Toolkit.md` for which component serves a need) lives only in that file, and this line is a summary of its step 1, not a substitute for opening it. Then
|
|
33
|
-
- [ ] **🛑 Component Docs Gate (MANDATORY, dashboard UI only):** For each patterns symbol you are about to write, decided **from the
|
|
31
|
+
- [ ] **🛑 Template-First Gate (MANDATORY, dashboard UI only, comes before writing any shell/provider/router):** Followed [DRAFT_TEMPLATE.md](references/dashboard-page/DRAFT_TEMPLATE.md): found the page templates the installed `@wix/patterns` ships, chose one with its `Page Templates.md` guide — which pages the workflow above needs, **and where the rows come from** (your own fetch, or a CMS collection) — read that template's page, and copied every file `--templates` lists for it. Composing the page shell, provider nesting, or router wiring from scratch when a template already shows it is the failure mode this gate exists to prevent — the Patterns/Component Docs gates below are for what the template doesn't cover, not a replacement for starting there. The reverse holds too: a template replaces composing the shell, never the discovery chain, so every symbol it doesn't show still goes through the next gate.
|
|
32
|
+
- [ ] **🛑 Patterns Docs Gate (MANDATORY for any dashboard page UI):** Read [WIX_PATTERNS_DOCS.md](references/WIX_PATTERNS_DOCS.md) **before the first command that touches `node_modules/@wix/patterns`** — its discovery chain (`pkg-root.cjs`, the index, `Composition and Providers.md` once, `Collection Toolkit.md` for which component serves a need) lives only in that file, and this line is a summary of its step 1, not a substitute for opening it. Then resolve every patterns name you plan to write in **one** `node <pkgRoot>/bin/patterns-lookup.cjs <name…>` call: per name, it prints the import, the examples and the one props file. Upgrade `@wix/patterns` if `dist/docs/index.json` is missing. Patterns API facts come only from the published `dist/docs/` (pages), `dist/examples/` (worked calls), `dist/dts-bundle/` (types) and `dist/templates/` (whole pages) trees — never from `src/`, `dist/esm/`, `dist/types/`, or any other path inside the package. A prop a bundle has stubbed is in the file its stub names (`Reading the Doc Indices.md`).
|
|
33
|
+
- [ ] **🛑 Component Docs Gate (MANDATORY, dashboard UI only):** For each patterns symbol you are about to write, decided **from the lookup output** which single artifact answers the question you actually have — the import line, an example, or the props file — and read only that one, per [Component Selection Order](#component-selection-order)'s "the short version". State which artifact you read per symbol, and why, before the first line of JSX. Reading a doc *and* its bundle for the same symbol, or opening a page for an import line the lookup already gave you, is the failure this gate exists to prevent.
|
|
34
34
|
|
|
35
35
|
For the object `useTableCollection()` returns, read [TABLE_STATE.md](references/dashboard-page/TABLE_STATE.md) — a state object you receive rather than construct, whose members are unobvious and several plausible ones absent.
|
|
36
36
|
- [ ] **Step 3:** Checked API references; used MCP discovery only for gaps
|
|
@@ -111,11 +111,10 @@ Whole pages are the package's too: the router wiring for a multi-page extension,
|
|
|
111
111
|
`@wix/patterns/schema`, where the schema supplies fetch, filters, columns and the form — both ship
|
|
112
112
|
as page templates. See [DRAFT_TEMPLATE.md](references/dashboard-page/DRAFT_TEMPLATE.md).
|
|
113
113
|
|
|
114
|
-
The short version
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
table. Read the one artifact your open question needs. Resolve `<pkgRoot>` once per session
|
|
114
|
+
The short version: list every patterns name you plan to write, and resolve them all in one
|
|
115
|
+
`node <pkgRoot>/bin/patterns-lookup.cjs <name…>` call, not one index probe per name.
|
|
116
|
+
Its output gives each name's import line (no read needed), its worked examples, and the one
|
|
117
|
+
file that holds its props. Read the one artifact your open question needs. Resolve `<pkgRoot>` once per session
|
|
119
118
|
([Prerequisites](references/WIX_PATTERNS_DOCS.md#prerequisites)) and reuse it.
|
|
120
119
|
|
|
121
120
|
**Opening one item from a collection uses an editable `EntityPage` by default; create/edit flows also use `EntityPage`, never a dashboard modal** — see
|
|
@@ -35,7 +35,7 @@ The CLI generates the folder, the page's component file (`<page>.tsx`, the build
|
|
|
35
35
|
|
|
36
36
|
**Before writing that UI:** copy in the installed `@wix/patterns` page template that matches, per [DRAFT_TEMPLATE.md](dashboard-page/DRAFT_TEMPLATE.md) — don't compose the shell from scratch.
|
|
37
37
|
|
|
38
|
-
**Then, for whatever the template doesn't cover:**
|
|
38
|
+
**Then, for whatever the template doesn't cover:** list every patterns name you'll add, and resolve them all in one `node <pkgRoot>/bin/patterns-lookup.cjs <name…>` call ([WIX_PATTERNS_DOCS.md § 1](WIX_PATTERNS_DOCS.md#1--the-index)). Its import, examples and props file decide whether you open anything else. Each Bash call is a fresh shell — re-set the path variable every time.
|
|
39
39
|
|
|
40
40
|
## Capabilities
|
|
41
41
|
|
|
@@ -12,23 +12,21 @@ Then check the install, two ways: `ls <pkgRoot>/dist/dts-bundle/index.json`, and
|
|
|
12
12
|
|
|
13
13
|
**If either fails, stop and upgrade `@wix/patterns`.** "Which component serves this need" now lives in the package, so proceeding means guessing names; do not hunt elsewhere in `node_modules` for a substitute. Everything below degrades by version rather than breaking, so probe rather than version-check.
|
|
14
14
|
|
|
15
|
-
**Patterns API facts come from four published trees only:** `dist/docs/` (pages), `dist/dts-bundle/` (types), `dist/examples/` (worked calls), `dist/templates/` (whole pages). Never take a component, prop or type from `src/`, `dist/esm/` or `dist/cjs/`, or a deep path a bundle mentions — internals change without notice. `dist/types
|
|
15
|
+
**Patterns API facts come from four published trees only:** `dist/docs/` (pages), `dist/dts-bundle/` (types), `dist/examples/` (worked calls), `dist/templates/` (whole pages). Never take a component, prop or type from `src/`, `dist/esm/` or `dist/cjs/`, or a deep path a bundle mentions — internals change without notice. That includes `dist/types/`: `tsc` reads it, but its files import their props from sibling files, so it answers no props question in one read.
|
|
16
16
|
|
|
17
17
|
## The Discovery Chain
|
|
18
18
|
|
|
19
19
|
### 1 — The index
|
|
20
20
|
|
|
21
|
-
**
|
|
21
|
+
**Resolve every patterns name you plan to write in one call:**
|
|
22
22
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
- **Resolve against the keys *and* each entry's `symbols` aliases.** The index is keyed by Storybook title: `ExportButton` lives under `ExportTo`, `CollectionToolbarFilters` under `ToolbarFilters`. Matching is exact — scan for something close before concluding a name isn't covered.
|
|
27
|
-
- **`status: "deprecated"`** means use what `statusMessage` names. A deprecated component still renders, so nothing else stops you.
|
|
23
|
+
```bash
|
|
24
|
+
node <pkgRoot>/bin/patterns-lookup.cjs Table useTableCollection stringsArrayFilter DateRangeFilter
|
|
25
|
+
```
|
|
28
26
|
|
|
29
|
-
|
|
27
|
+
The package ships this script, so it matches the installed indices. For each name it prints the import, the examples and the **one** file for props. Its `summary` line usually answers the question, so step 4 needs no read. A name in neither index makes it exit 1, with near matches. `--templates` lists the page templates. **List the names first.** Each name you add later costs another round trip, and those round trips are this step's whole cost.
|
|
30
28
|
|
|
31
|
-
**
|
|
29
|
+
**If `<pkgRoot>/bin/patterns-lookup.cjs` is missing** (an older `@wix/patterns`), probe `<pkgRoot>/dist/docs/index.json` with one `grep`/`python3` call covering every symbol, and match keys and `symbols` aliases exactly. Never `Read` it whole: it truncates silently. A name not in it may still be in `dist/dts-bundle/index.json`.
|
|
32
30
|
|
|
33
31
|
### 2 — Composition, once per session
|
|
34
32
|
|
|
@@ -46,48 +44,11 @@ Each guide's index entry carries `relatedComponents`; every name in it resolves,
|
|
|
46
44
|
|
|
47
45
|
### 4 — Read only what answers your question, then stop
|
|
48
46
|
|
|
49
|
-
|
|
50
|
-
| --- | --- | --- |
|
|
51
|
-
| What is it, and how does it wire in? | **nothing** — the entry says | `summary` |
|
|
52
|
-
| Where do I import it from? | **nothing** — the entry says | `importPath` |
|
|
53
|
-
| How do I call it? | one **example**, or a call in a guide's prose | `dist/examples/<examples[i]>` · `dist/docs/<guide>.md` |
|
|
54
|
-
| What props, and which are optional? | the **example** first; then the **`.d.ts`** *or* the doc — never both | `bundle` present: `dist/dts-bundle/<bundle>` · absent: `dist/docs/<file>` |
|
|
55
|
-
| A setup requirement or gotcha? | the **doc's** prose | `dist/docs/<file>` |
|
|
56
|
-
|
|
57
|
-
Prefix the index's bare values with their tree — `file` → `dist/docs/`, `examples` → `dist/examples/`, `bundle` → `dist/dts-bundle/`, `templateFiles` → `dist/templates/` — and never rebuild a path from a symbol name.
|
|
58
|
-
|
|
59
|
-
**Those two middle rows are one question in practice.** You ask how to call it, start writing, and the question turns prop-shaped mid-call — where the second row sends you to a `.d.ts` that may be stubbed (step 5). Take the props off the example first; go to the `.d.ts` only for what it cannot show — optionality, union members, an exact callback signature.
|
|
60
|
-
|
|
61
|
-
**A guide's prose often holds the call.** `PrimaryActions`' bundle stubs its own props type, while `usePatternsNavigate.md` carries `<PrimaryActions label="Add shift" onClick={…} />` verbatim. Check what you have already read before opening anything.
|
|
62
|
-
|
|
63
|
-
**`bundle` and a doc props table are mutually exclusive.** With `bundle`, the page's `### Props` is only a pointer; without it, that table marks what is required. Reading both is one hop too many.
|
|
64
|
-
|
|
65
|
-
**A `.d.ts` names props; it never says what they do.** Wiring and defaults live in prose: `CollectionSearch`'s bundle lists four optional props and no behaviour, while its page says the search term reaches your `fetchData` via `query.search`. When a behaviour question outlives the `summary`, open the page.
|
|
66
|
-
|
|
67
|
-
**Artifact not listed?** No `examples` — a hook's usage is usually filed under the component it pairs with (`useEntityPage` → `EntityPage/basic.tsx`). No `importPath` — a guide, or documented but not exported. Nothing at all — a state object you receive rather than construct; its doc is the only source.
|
|
68
|
-
|
|
69
|
-
### 5 — Traps that make a read wrong
|
|
70
|
-
|
|
71
|
-
**Search inside the file an index named, never across the tree.** A shared shape is re-stubbed in every bundle referencing it, so a tree-wide `grep` returns mostly pointers, and the first hit is rarely the declaration.
|
|
72
|
-
|
|
73
|
-
**Most bundles stub the parent holding the props — 70 of the 105 curated entries do** — and the index says so per entry. **`dist/dts-bundle/index.json` is the triage surface, not merely a fallback for names the docs index lacks:** a component entry carries `ownProps` / `inheritedProps` beside `bytes` and `readWith`, so "is this file the whole answer" is a lookup, not an inspection.
|
|
74
|
-
|
|
75
|
-
- `Table` → `ownProps: 5, inheritedProps: 58`, `readWith` naming 3 files. Five of sixty-three.
|
|
76
|
-
- `PrimaryActions` → `ownProps: 0, inheritedProps: 12`. A 470-byte file declaring none of them.
|
|
77
|
-
- No `ownProps` on a component entry means no split — that file *is* the whole answer.
|
|
78
|
-
|
|
79
|
-
A split is not a dead end: the parent is a real file, `readWith` names it, and from 1.469.0 so does the stub inside the file (`Full shape: types/Filter.d.ts`). **Read that one file — one hop, not N.** The rest of `readWith` is types referenced *inside* it, opened only if needed. Judge by the entry's own `bytes`, never `readWithBytes` — `Table`'s are 5,277 against 31,731 — since the combined figure talks you out of a read you should just do. A `…Params` type built from `Pick<>`/`Omit<>` is the same trap in another shape.
|
|
80
|
-
|
|
81
|
-
**When you do need several `readWith` files, read them in one call** — one `Read` per file in a single message. Reads measure ~21 ms each, so ten is a fifth of a second and one round trip. Deciding is what costs: decide once, then batch, and never hop one file per turn. Batching is not a licence to skip the filter, though — a few deliberate reads beat dozens of just-in-case ones.
|
|
82
|
-
|
|
83
|
-
**If the parent is large, take the declaration `tsc` uses.** `dist/types/components/CollectionTable/CollectionTable.d.ts` is 5,919 B against the bundle's 20,802 B, carries JSDoc, and states `columns: TableColumn<T>[]` (required) outright. Nothing there is stubbed, so a `grep` for a prop name is reliable. This case only.
|
|
84
|
-
|
|
85
|
-
The generated files' conventions — which one-line stubs are answers rather than truncation, how entry-point files are scoped — are in `dist/docs/Reading the Doc Indices.md`, worth reading before your first `dist/dts-bundle/*.d.ts` of the session.
|
|
86
|
-
|
|
87
|
-
### Rules for the reads themselves
|
|
47
|
+
**`Read <pkgRoot>/dist/docs/Reading the Doc Indices.md` once per session**, before your first read past the lookup output. The package keeps it in step with its own indices. It says which file answers which question, what a one-line stub in a `.d.ts` means, and how to follow a stubbed prop to the file that declares it. The rules below are about how many reads you make:
|
|
88
48
|
|
|
89
|
-
- **
|
|
90
|
-
- **
|
|
49
|
+
- **Read the one artifact your open question needs.** Check what you have already read first: a guide's prose often holds the call.
|
|
50
|
+
- **Decide once, then batch.** When you need several files, read them in one message, one `Read` per file. Never hop one file per turn. Deciding is what costs, so a few deliberate reads beat dozens of just-in-case ones.
|
|
51
|
+
- **Extract from the file the lookup named.** If an extraction is empty or ambiguous, read the whole file rather than guess.
|
|
91
52
|
- **A `@wix/design-system` name is not yours to look up here.** Use the `wix-design-system` skill; never follow a deep `@wix/design-system/dist/...` path a bundle mentions.
|
|
92
53
|
- **If a name is in neither index, stop and say so**, naming the path that dead-ended. A wrong guess compiles and breaks at runtime.
|
|
93
54
|
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
# Finding the real SDK shape behind a dashboard page
|
|
2
2
|
|
|
3
|
-
> **Scope.** [DRAFT_TEMPLATE.md](DRAFT_TEMPLATE.md) gives you the page
|
|
4
|
-
>
|
|
5
|
-
>
|
|
6
|
-
> because it is the version your code will compile against.
|
|
3
|
+
> **Scope.** [DRAFT_TEMPLATE.md](DRAFT_TEMPLATE.md) gives you the page; this file finds the method
|
|
4
|
+
> and *field names* for its data. Read it before Step 3's MCP discovery. The installed package is
|
|
5
|
+
> the version your code compiles against.
|
|
7
6
|
|
|
8
7
|
## Where the types actually live
|
|
9
8
|
|
|
@@ -47,7 +46,14 @@ of them avoids an N+1 across the visible page.
|
|
|
47
46
|
## Confirming a field — the part that ships bugs
|
|
48
47
|
|
|
49
48
|
Once you have the entity, read the declaration for **every field you map into a column**, not just
|
|
50
|
-
the uncertain ones
|
|
49
|
+
the uncertain ones, **in one pass**. List the types and fields first, then print them with one call
|
|
50
|
+
per file. A grep per question is a round trip each:
|
|
51
|
+
|
|
52
|
+
```bash
|
|
53
|
+
awk '/^(interface|type) (Payment|RegularPaymentDetails)[ <{=]/,/^}/' $E/index.typings.d.mts
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
Failure modes that recur:
|
|
51
57
|
|
|
52
58
|
**Deprecated fields still compile.** On `RegularPaymentDetails`, `paymentMethod` carries
|
|
53
59
|
`@deprecated Use paymentMethodName.buyerLanguageName instead` — the deprecated one is a bare code,
|
|
@@ -93,15 +99,13 @@ a batch endpoint given `[]` is a wasted round trip at best.
|
|
|
93
99
|
`searchOrders` takes a `CursorSearch`: `{ cursorPaging, filter, sort }`, where `filter` is a
|
|
94
100
|
Mongo-shaped `Record<string, any>` — `{ paymentStatus: { $in: [...] } }`,
|
|
95
101
|
`{ _createdDate: { $gte, $lte } }`, `{ number: { $startsWith } }`. Enum values come from the
|
|
96
|
-
declaration, not from memory: order payment status
|
|
97
|
-
`
|
|
98
|
-
`UNSPECIFIED`.
|
|
102
|
+
declaration, not from memory: order payment status has ten, `PENDING_MERCHANT` and
|
|
103
|
+
`PARTIALLY_REFUNDED` among them.
|
|
99
104
|
|
|
100
105
|
## The SDK is not the REST API
|
|
101
106
|
|
|
102
107
|
Docs search returns REST pages, and a dashboard page calls the **SDK**. Append `?apiView=SDK` to the
|
|
103
|
-
URL of whatever page you landed on and read that view — it answers two of the four differences
|
|
104
|
-
before you write a line.
|
|
108
|
+
URL of whatever page you landed on and read that view — it answers two of the four differences.
|
|
105
109
|
|
|
106
110
|
**1 and 2 — namespace and id naming. The SDK view states both.** It prints the package and namespace
|
|
107
111
|
outright (`SDK Package: @wix/members`, `SDK Namespace: customFields`), and uses `_id` in its own
|
|
@@ -6,17 +6,14 @@ Go through [WIX_PATTERNS_DOCS.md § Prerequisites](../WIX_PATTERNS_DOCS.md#prere
|
|
|
6
6
|
|
|
7
7
|
## 1. Find the templates
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
One call lists every page template with its files, plus the guide that chooses between them:
|
|
10
10
|
|
|
11
11
|
```bash
|
|
12
|
-
|
|
13
|
-
import json; i = json.load(open('<pkgRoot>/dist/docs/index.json'))
|
|
14
|
-
for k, e in i.items():
|
|
15
|
-
if e.get('category') == 'Templates' or e.get('relatedTemplates'):
|
|
16
|
-
print(k, '|', e.get('templateFiles') or e.get('relatedTemplates'), '|', e.get('summary', '')[:200])
|
|
17
|
-
"
|
|
12
|
+
node <pkgRoot>/bin/patterns-lookup.cjs --templates
|
|
18
13
|
```
|
|
19
14
|
|
|
15
|
+
It also takes names (`--templates Table useTableCollection …`), so the patterns names you already know you'll need can go in the same call ([WIX_PATTERNS_DOCS.md § 1](../WIX_PATTERNS_DOCS.md#1--the-index)). If the script is missing (an older `@wix/patterns`), list those entries from `<pkgRoot>/dist/docs/index.json` in one probe.
|
|
16
|
+
|
|
20
17
|
**No `Templates` entries means the install predates them — upgrade `@wix/patterns`.** Do not rebuild a page from memory or from an older copy of this skill instead: the templates exist so the shell, provider nesting and router wiring come from the package.
|
|
21
18
|
|
|
22
19
|
## 2. Choose, then read the chosen template's page
|
|
@@ -48,7 +45,7 @@ wix generate --params '{"extensionType":"DASHBOARD_PAGE","title":"<title>","rout
|
|
|
48
45
|
|
|
49
46
|
`route` takes no leading slash — `support-tickets`, not `/support-tickets`. See [Dashboard Page → Scaffold](../DASHBOARD_PAGE.md#scaffold).
|
|
50
47
|
|
|
51
|
-
Then copy **every** file
|
|
48
|
+
Then copy **every** file `--templates` lists for it into the generated folder (`src/extensions/dashboard/pages/<feature>/`). They import one another by relative path, so keep their names relative to each other; one file on its own does not compile.
|
|
52
49
|
|
|
53
50
|
- The template's `page.tsx` is the entry file, and the CLI generated none by that name: put its contents into the component file the builder's `component` path points at (e.g. `employee-shifts.tsx`), and add no separate `page.tsx`, which nothing loads. Leave the builder file and the `src/extensions.ts` registration as the CLI wrote them.
|
|
54
51
|
- Rename `Items` / `Item` to your feature and entity, in file names and identifiers alike.
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
## Why guessing here always fails
|
|
9
9
|
|
|
10
10
|
`useTableCollection()` returns a `TableState`. For the members themselves, read the declaration the
|
|
11
|
-
index names
|
|
11
|
+
index names: `patterns-lookup.cjs TableState`, alongside the other names you need, then the file it prints. Reading them is not the
|
|
12
12
|
hard part; the hard part is that several plausible members don't exist at all, and one that does
|
|
13
13
|
means something other than its name suggests (see
|
|
14
14
|
[Four that bite in practice](#four-that-bite-in-practice)).
|
|
@@ -24,7 +24,7 @@ That is a documentation abridgement, not the declaration your code compiles agai
|
|
|
24
24
|
`dist/types/index.d.ts`, which re-exports the **fully typed** `CollectionState` from
|
|
25
25
|
`@wix/bex-core` — no index signature. So `state.collection.…` is properly typed, a wrong member is a
|
|
26
26
|
compile error at the access, and reading `state.collection.status.status` to debug a stuck table is
|
|
27
|
-
sound. See
|
|
27
|
+
sound. See `<pkgRoot>/dist/docs/Reading the Doc Indices.md` for what a stub means.
|
|
28
28
|
|
|
29
29
|
Prefer a typed member on `TableState` itself anyway — it is the object the hook hands you, and the
|
|
30
30
|
table's own view of the collection.
|
|
@@ -129,5 +129,6 @@ cursor: response.pagingMetadata?.cursors?.next || undefined,
|
|
|
129
129
|
extend. Cursor mode also accepts a separate `fetchTotal`, since a cursor-paged response carries no
|
|
130
130
|
total; build its filter exactly as the page's or the count disagrees with the rows it counts.
|
|
131
131
|
|
|
132
|
-
Look any of these up yourself
|
|
133
|
-
|
|
132
|
+
Look any of these up yourself, all in one `patterns-lookup.cjs` call
|
|
133
|
+
([WIX_PATTERNS_DOCS.md § 1](../WIX_PATTERNS_DOCS.md#1--the-index)), and read the file it names. The
|
|
134
|
+
index is the single source of truth, and it moves between versions.
|
|
@@ -24,8 +24,9 @@ doesn't express — or once the site exists and the work turns to managing or ex
|
|
|
24
24
|
- **Shipped code is the implementation.** Every vertical ships in the repository's
|
|
25
25
|
`wix-headless-templates` skill (`skills/wix-headless-templates/<vertical>/`), not in this skill's
|
|
26
26
|
folder. `node <SKILL_ROOT>/install/templates.mjs` prints where that skill is: the sibling folder
|
|
27
|
-
`<SKILL_ROOT>/../wix-headless-templates/` when
|
|
28
|
-
|
|
27
|
+
`<SKILL_ROOT>/../wix-headless-templates/` when it was installed beside this skill (the cold start
|
|
28
|
+
installs both; a plugin may not), else a one-time fetch into `<SKILL_ROOT>/templates/` (a git
|
|
29
|
+
clone of the skill's repository, a second); every script below
|
|
29
30
|
resolves it the same way. **Every `templates/...` path in this document is relative to that
|
|
30
31
|
printed root** — there is no `templates/` folder inside this skill when the sibling exists.
|
|
31
32
|
The folder stays with the project (only the composed `project/` scaffolds are left out of its
|
|
@@ -100,8 +101,8 @@ cases of step 3, with the `next` for each) and the two identities a project has
|
|
|
100
101
|
as and whose dashboard manages the business). They are one site, except on a **migration preview**
|
|
101
102
|
(`guides/migration.md`), where the env names the site being migrated. Every script here reads that
|
|
102
103
|
context; the site a call targets is never guessed from the config alone. Then fetch the shipped
|
|
103
|
-
code once: `node <SKILL_ROOT>/install/templates.mjs`. It prints the folder;
|
|
104
|
-
|
|
104
|
+
code once: `node <SKILL_ROOT>/install/templates.mjs`. It prints the folder; the `templates/…`
|
|
105
|
+
paths below are relative to that folder, never assumed under `<SKILL_ROOT>`.
|
|
105
106
|
`node <SKILL_ROOT>/install/check.mjs` says whether the skill or its templates have a newer version
|
|
106
107
|
and prints the update commands; it changes nothing.
|
|
107
108
|
|
|
@@ -166,9 +167,9 @@ only after an explicit yes, never automatically. Step 5 ends with the same self-
|
|
|
166
167
|
folder's config does, the site holds the content already; the frontend reads what is there
|
|
167
168
|
(step 3's attach path), and only content the brief supplies or describes is added to it.
|
|
168
169
|
3. **Set up the project, in its folder** — one deterministic call, the same for an empty folder
|
|
169
|
-
and for a project already on disk; **the folder decides** what it does, from
|
|
170
|
+
and for a project already on disk; **the folder decides** what it does, from a few file facts:
|
|
170
171
|
`wix.config.json`, its `site.outputDirectory`, the migration variables in `.env.local`,
|
|
171
|
-
`package.json`, `index.html
|
|
172
|
+
`package.json`, `index.html` (at the root or in `public/`), `src/pages/`. `node <SKILL_ROOT>/install/context.mjs` prints the shape it reads
|
|
172
173
|
and the `next` for it. **The brief is the instruction**: what it asks to switch on is installed
|
|
173
174
|
on the site the folder names, without asking again. Ask only when acting would create a second
|
|
174
175
|
site for a folder that already has one, or when a cleanup seems needed.
|
|
@@ -189,6 +190,7 @@ only after an explicit yes, never automatically. Step 5 ends with the same self-
|
|
|
189
190
|
| a config whose `.env.local` declares an active editor migration (`EDITOR_MIGRATION_STATUS=ACTIVE`), with or without the blank Astro starter the download carries | **migration** → migrate | the shipped code into the starter (or the composed template around a bare config), deployed with the migrated site's app as the client, the install starts; `ready_for_brand_layer` says `mode: "migrate"`, the parent as `siteId`, the child as `deploySiteId` (`guides/migration.md`) | no, ever |
|
|
190
191
|
| a config, no frontend | **config-only** → refuses | the site exists and has no frontend yet: `attach.mjs` (below) takes the site from the config, reuses its hosting, scaffolds and deploys. That config is what `init` leaves behind, and `init` always creates a site: this site was made for this run and is empty | **yes**: draft the plan as for create, then `attach.mjs --plan` |
|
|
191
192
|
| a config and a frontend (a `package.json`, or `index.html` inside the folder `site.outputDirectory` names) | **wix-project** → refuses | iterate: never scaffold, `init` or reseed. `deploy.mjs <vertical…> --stack <stack>` adds a solution (the client id comes from `.env.local`, the config as the fallback), then ONE `npm install`; a change is file edits; then release | no |
|
|
193
|
+
| a config, a `package.json`, `public/index.html` and no `src/pages/` (a site published through the drop flow, on its Wix Dev Machine) | **static-in-astro** → refuses | the pages stay plain files in `public/`: `deploy.mjs <vertical…> --stack static --out public` puts the REST layer in `public/js/wix/`, the pages are wired in place (reference mode), and no Astro pages are added; release with `build` then `release`, the URL stays | no |
|
|
192
194
|
| a config, `index.html` at the root, no `package.json` (a site published through the drop flow and downloaded) | **published-static** | the config's site, no `init`: `site/` becomes the upload, the REST layer deploys into `site/js/wix/`; the `next` says to move the pages, styles and assets in; release keeps the URL | no |
|
|
193
195
|
|
|
194
196
|
**Who decides the seed: where the site came from, never the brief's wording.** A site made
|
|
@@ -201,7 +203,8 @@ only after an explicit yes, never automatically. Step 5 ends with the same self-
|
|
|
201
203
|
id in the brief or by `--site`, a project linked to it, a migration's parent (attach reports
|
|
202
204
|
`siteOrigin: "given"`) — holds content the run did not make: seed only what the brief
|
|
203
205
|
**supplies or asks to add** (`attach.mjs --plan plan.json`, or the vertical's seed module from
|
|
204
|
-
the project root: `node <
|
|
206
|
+
the project root: `node <templates>/<vertical>/seed/seed-<vertical>.mjs plan.json`, `<templates>`
|
|
207
|
+
being the folder `install/templates.mjs` printed),
|
|
205
208
|
and never invent content for it. "A new storefront for my toy store" describes the business,
|
|
206
209
|
not content to add: nothing is seeded. Read an existing site first either way
|
|
207
210
|
(`seed/read-site.mjs`). Seeds are additive and idempotent by name; nothing on a site is ever
|
|
@@ -253,9 +256,12 @@ only after an explicit yes, never automatically. Step 5 ends with the same self-
|
|
|
253
256
|
INSTRUCTIONS and the shared floors — `templates/shared/DESIGN.md` +
|
|
254
257
|
`templates/shared/CONTENT.md` — now (not earlier — their contracts matter only from this
|
|
255
258
|
step on); the hook/DTO
|
|
256
|
-
contracts are inlined there, so don't open the shipped files themselves.
|
|
257
|
-
|
|
258
|
-
(
|
|
259
|
+
contracts are inlined there, so don't open the shipped files themselves.
|
|
260
|
+
**A frontend that already exists gets the minimum.** When the run wires pages that were
|
|
261
|
+
there before it (a dropped mock, an adopted site, a published static site), do the least that
|
|
262
|
+
makes them work: connect each control the pages show to the shipped code, and add only what a
|
|
263
|
+
control can't work without. Anything more the vertical offers is added only when the brief
|
|
264
|
+
asks for it; name it in the closing message.
|
|
259
265
|
If the brief needs a core operation that shipped code does not cover, read
|
|
260
266
|
`templates/shared/CUSTOM_OPERATIONS.md` before writing it. Use one documented path and
|
|
261
267
|
implement it; do not reverse-engineer SDK internals.
|
|
@@ -286,7 +292,9 @@ only after an explicit yes, never automatically. Step 5 ends with the same self-
|
|
|
286
292
|
that fix it: **Accept payments** `https://manage.wix.com/dashboard/<siteId>/wix-cashier/payments`
|
|
287
293
|
(connect a payment method; "manual payments" is enough for free and pay-in-person flows) and
|
|
288
294
|
**Upgrade the plan** `https://www.wix.com/upgrade/website?metaSiteId=<siteId>` (online payments
|
|
289
|
-
need a premium plan). Both are the owner's steps, not a defect in the site.
|
|
295
|
+
need a premium plan). Both are the owner's steps, not a defect in the site. When the run started
|
|
296
|
+
from the owner's own pages, name what those pages promised that the released site does not do.
|
|
297
|
+
**Copy the live URL verbatim from the
|
|
290
298
|
`wix release` output — never retype it from memory** (a mistyped subdomain hands the user
|
|
291
299
|
a 404). Before you sign off, run the feedback self-check over the whole session
|
|
292
300
|
(`guides/feedback.md`): anything that cost more turns than it should have, including what you
|
|
@@ -305,7 +313,7 @@ how to close such a run. A public site is still better served by managed Astro;
|
|
|
305
313
|
close.
|
|
306
314
|
|
|
307
315
|
Without a machine at all, or when the install, the CLI or the login is blocked where you are,
|
|
308
|
-
read `<SKILL_ROOT>/guides/
|
|
316
|
+
read `<SKILL_ROOT>/guides/api-run.md`: the same run, step by step, as the Wix API calls the
|
|
309
317
|
scripts make and the files beside this skill that carry the contracts.
|
|
310
318
|
|
|
311
319
|
## Verticals
|
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
# The kit's run as Wix API calls
|
|
2
|
+
|
|
3
|
+
Read when the commands this skill is built on cannot run where you are, or stopped: your shell
|
|
4
|
+
can't reach Wix, there is no shell, or the install, the
|
|
5
|
+
CLI or the login is blocked. Wix is then reachable through the Wix MCP: every call below is an
|
|
6
|
+
`ExecuteWixAPI` call, and files reach the site through the upload recipe. It walks the run of
|
|
7
|
+
SKILL.md step by step and names, for each, the Wix API call the CLI or the script performs and the
|
|
8
|
+
file beside this skill that carries the contract; where a script can run where you are, it says so.
|
|
9
|
+
|
|
10
|
+
## Where these skills are
|
|
11
|
+
|
|
12
|
+
This skill is one of a set, and the guide reads from three of them:
|
|
13
|
+
|
|
14
|
+
- `{SKILL_ROOT}` — this skill, `wix-headless-kit`: the run, its guides, the Verticals table.
|
|
15
|
+
- `{TEMPLATES}` — `wix-headless-templates`: the shipped, verified code per Wix Business Solution,
|
|
16
|
+
one folder each, with its `INSTRUCTIONS.md` (the contracts), `seed/` (the seed script and
|
|
17
|
+
`SEED.md`) and `rest/` (the data layer over plain `fetch`). Not every install carries it (a
|
|
18
|
+
plugin may leave it out): it is installed beside this skill, or fetched to
|
|
19
|
+
`{SKILL_ROOT}/templates/` by `node {SKILL_ROOT}/install/templates.mjs` (a git clone), or installed
|
|
20
|
+
with `npx skills@latest add wix/skills --skill wix-headless-templates`; with none of those, read
|
|
21
|
+
online at `https://www.wix.com/skills/wix-headless-templates/{path}`.
|
|
22
|
+
- `{MANAGE}` — `wix-manage`: REST recipes to configure and manage a site's business solutions, one
|
|
23
|
+
recipe per operation with the exact endpoint and payload; its `SKILL.md` is the index.
|
|
24
|
+
- `{DOCS}` — `wix-docs`: how to look up the Wix API and SDK documentation and confirm a method's
|
|
25
|
+
exact shape before writing a call.
|
|
26
|
+
|
|
27
|
+
Installed, they sit beside each other wherever your client keeps them: under `.agents/skills/` after
|
|
28
|
+
`npx skills add`, or in a plugin's folder. Read them from disk when they are there. Online, they are
|
|
29
|
+
published alongside each other under the same names (the registry also serves each without its
|
|
30
|
+
`wix-` prefix, `headless-templates` for `wix-headless-templates`, which is the `base` its manifest
|
|
31
|
+
shows; both forms resolve), each with a manifest of its files, and in the
|
|
32
|
+
`wix/skills` repository on GitHub under `skills/{skill}/`; a sandbox that reaches GitHub has the
|
|
33
|
+
whole set on disk from a clone. Online pages are read with the Wix MCP's `ReadFullDocsArticle`
|
|
34
|
+
when it is connected: a client's web fetch may open only URLs the user gave or a search returned.
|
|
35
|
+
|
|
36
|
+
What such a run does not produce: the Astro build and its release. Those need a machine with the
|
|
37
|
+
CLI. Everything else the kit does to a site, it does through calls you can make, the frontend
|
|
38
|
+
included: step 5 ships it as static files.
|
|
39
|
+
|
|
40
|
+
## 0. Identity
|
|
41
|
+
|
|
42
|
+
Every call below runs as the site owner, with whatever identity your host gives you: the Wix
|
|
43
|
+
MCP's `ExecuteWixAPI` carries the user's login; an API key from the user's account goes in the
|
|
44
|
+
`Authorization` header of any call, as `{MANAGE}/SKILL.md` describes; a site token from the Wix CLI
|
|
45
|
+
works the same way when the user runs the CLI for you. The site's OAuth app (`client_id`) mints
|
|
46
|
+
visitor tokens only, which cover what a visitor may see and nothing here.
|
|
47
|
+
|
|
48
|
+
## 1. The brief → the solutions
|
|
49
|
+
|
|
50
|
+
Unchanged from SKILL.md step 2 and its Verticals table: the brief names the business, the table
|
|
51
|
+
names the solutions it needs. Read each solution's `{TEMPLATES}/{solution}/INSTRUCTIONS.md` for
|
|
52
|
+
what it covers and `{TEMPLATES}/{solution}/seed/SEED.md` for what a seeded site holds.
|
|
53
|
+
|
|
54
|
+
A brief that needs no solution (a game, a landing page, a tool) is a run of two steps: the site
|
|
55
|
+
(step 2, with no `seedOptions`) and the frontend (step 5). No apps, no seed.
|
|
56
|
+
|
|
57
|
+
## 2. The site
|
|
58
|
+
|
|
59
|
+
The CLI's `npm create @wix/new` is one call: `POST /headless-business-setup/v1/headless-business/provision`,
|
|
60
|
+
with `origin: agent-<your-id>`, a name, and the solutions to install as `seedOptions`. The recipe
|
|
61
|
+
is `{MANAGE}/references/sites/create-headless-site.md`; it returns the `metaSiteId` and the
|
|
62
|
+
site's OAuth client `appId`. Do not create a site any other way: a project from Create Project or
|
|
63
|
+
a template is neither headless nor publishable, and a later run with a machine cannot attach to it.
|
|
64
|
+
|
|
65
|
+
A site that already exists (the brief names it) is read first, never seeded unasked: SKILL.md
|
|
66
|
+
step 2 and `{SKILL_ROOT}/guides/existing-site.md` apply as written.
|
|
67
|
+
|
|
68
|
+
## 3. The apps
|
|
69
|
+
|
|
70
|
+
A solution the provision call did not install, or a capability's app (Members Area, Forms,
|
|
71
|
+
Restaurants, Donations, FAQ), goes on with the Apps Installer:
|
|
72
|
+
`{MANAGE}/references/app-installation/install-wix-apps.md`. The app ids are in each
|
|
73
|
+
`seed-{solution}.mjs`, which installs them before seeding.
|
|
74
|
+
|
|
75
|
+
## 4. The seed
|
|
76
|
+
|
|
77
|
+
`seed-{solution}.mjs` is a sequence of REST calls, and `SEED.md` is its contract: the plan shape
|
|
78
|
+
(what to create, how many, which images), the order the entities need, and the traps the script
|
|
79
|
+
encodes (a Bookings service needs a category to be visible and takes resource ids, not staff ids;
|
|
80
|
+
a Forms field is registered by its `validation` block; a product's choice photos are linked after
|
|
81
|
+
the gallery holds them; right after a bulk create a product's own stock summary can still read
|
|
82
|
+
`OUT_OF_STOCK` while its inventory items are already stocked, so check the items (Query Inventory
|
|
83
|
+
Items) and create only the missing ones, as `SEED.md` says, where `ALREADY_EXISTS` means stocked; stock that isn't counted, such as "made to order", is
|
|
84
|
+
`inStock: true`, never a missing quantity, which leaves the product unbuyable). Read `SEED.md`
|
|
85
|
+
before the first create call: it maps the brief's words to the fields. Those fields are the
|
|
86
|
+
script's input, not the request: the body each create sends is built in the script (for products,
|
|
87
|
+
`bulkCreateProducts` in `seed-store.mjs`: the description as rich-text nodes from `mkDesc`,
|
|
88
|
+
`productType` with `physicalProperties`, the stock as `inventoryItem`), so read that function before
|
|
89
|
+
the first create. On a site this run created, the store's currency is `SEED.md`'s `currency` rule,
|
|
90
|
+
the one the brief or the user's own pages state (a page priced "$68" is USD), set before the
|
|
91
|
+
products and without asking; a confirmation before a currency change is for a store the user
|
|
92
|
+
already runs. Then read the script for any call `SEED.md` only names, and make the same
|
|
93
|
+
calls through `{MANAGE}`'s recipe for each (services, products, posts, events, collections). Keep
|
|
94
|
+
the script's rules: create, never delete, and report what the site already held. A photo already in
|
|
95
|
+
the site's Media Manager, such as one the user uploaded, goes in by its file id (`imageMediaId` in
|
|
96
|
+
`SEED.md`), as it is: an import by URL would copy it. A photo on a site the user dropped is served
|
|
97
|
+
with the drop, not from the Media Manager: it goes in by its live URL, imported once through
|
|
98
|
+
`{MANAGE}/references/media/upload-media-to-wix.md`, and the file id the import returns is what the
|
|
99
|
+
product or service takes. Image prompts need the Media Manager; without
|
|
100
|
+
it, products and services stay text-only, say so. The scripts read
|
|
101
|
+
a response body directly; `ExecuteWixAPI`'s `wix.request` returns `{ status, data }`, and the body
|
|
102
|
+
is `data`. A generated image is billed when it is generated, so a read of the wrong level discards
|
|
103
|
+
a paid image.
|
|
104
|
+
|
|
105
|
+
## 5. The frontend
|
|
106
|
+
|
|
107
|
+
The run is not done until the pages use what the backend holds: every control the page shows for
|
|
108
|
+
it (add to cart, the cart, book, submit) works on the live site. A backend with untouched pages is
|
|
109
|
+
half a run.
|
|
110
|
+
|
|
111
|
+
The Astro pages cannot be released here: that is a run with a machine and a CLI login, which
|
|
112
|
+
attaches to this site (`guides/existing-site.md`) rather than making a new one. What ships from here
|
|
113
|
+
is static files, dropped onto the site from step 2 through
|
|
114
|
+
`{MANAGE}/references/sites/upload-static-site.md`: the Wix MCP's upload tool, or a script that
|
|
115
|
+
downloads what the site serves, edits it and drops it back, so only what changed is written. Which
|
|
116
|
+
files depends on whether the compose can run, and on what writing them costs: when files reach the
|
|
117
|
+
upload tool as files (its `attachments`), anything on your disk travels as it is; when they don't,
|
|
118
|
+
every file you send is text you write, and the smallest set wins.
|
|
119
|
+
|
|
120
|
+
**When the compose can run** (the skills on disk, Node, and npm reachable, for the TypeScript compiler it fetches), the frontend is the kit's own shipped code. The compose
|
|
121
|
+
`{SKILL_ROOT}/install/deploy.mjs {solution} --stack static --out site --client-id {appId}` fetches the
|
|
122
|
+
templates and writes the solution's REST data layer and stores to `site/js/wix/` as plain ES modules
|
|
123
|
+
(`guides/reference-mode.md`, the static site): the transport, the cores, the state machines, verified,
|
|
124
|
+
with the `.ts` beside each `.js` for reading. You write the pages and the rendering on those stores,
|
|
125
|
+
imported relative to `site/` in a `<script type="module">`, and nothing of the data layer. The drop
|
|
126
|
+
takes the complete file set in one call and a response has a hard size limit; the recipe's "Change it
|
|
127
|
+
later" section downloads what the site serves, so a later drop adds files to a live set without
|
|
128
|
+
resending what is already there.
|
|
129
|
+
|
|
130
|
+
**When it cannot**, or when its output would all have to be written out by hand, a page that loads
|
|
131
|
+
the Wix SDK from a package CDN and talks to the site as a visitor. One file per call, a few hundred lines, written in full inside that call: a response has a
|
|
132
|
+
hard size limit, and a call that carries the whole frontend at once exceeds it. A second file joins
|
|
133
|
+
the first the recipe's way, "Change it later": the same call downloads the live set and drops the
|
|
134
|
+
union. The
|
|
135
|
+
SDK comes from a pinned package URL, `https://esm.sh/@wix/sdk@{version}` and the solution's package
|
|
136
|
+
(`@wix/bookings`, `@wix/stores`, `@wix/blog`, …); the client is
|
|
137
|
+
`createClient({ modules: { … }, auth: OAuthStrategy({ clientId }) })` with the `appId` the provision
|
|
138
|
+
call returned, and the SDK mints and refreshes the visitor token itself. Markup, a render function
|
|
139
|
+
per state, the event handlers: that is what you write. Keep what the page shows to what the site
|
|
140
|
+
holds; nothing invented, as in SKILL.md step 4.
|
|
141
|
+
|
|
142
|
+
**The calls**, on that second path, take their shape from the kit's own transport for the solution,
|
|
143
|
+
`{TEMPLATES}/{solution}/app/wix/{solution}/*.ts` (`services.ts`, `booking.ts`, `catalog.ts`, …,
|
|
144
|
+
with `{TEMPLATES}/shared/app/wix/sdk.ts` for the client wiring): those files call the same SDK
|
|
145
|
+
modules the page imports, and they are verified. Copy the form of the call, not the file. A page
|
|
146
|
+
that talks to Wix over plain `fetch`, with no SDK, takes them from the REST twins instead:
|
|
147
|
+
`{TEMPLATES}/shared/rest/client.ts` (the visitor token and the request) and
|
|
148
|
+
`{TEMPLATES}/{solution}/rest/*.ts` (the calls; for a store, `storefront/rest/cart.ts` and
|
|
149
|
+
`storefront/rest/catalog.ts`). Read those files by name; the manifest and the solution's whole
|
|
150
|
+
`INSTRUCTIONS.md` are not needed to find them. The
|
|
151
|
+
cores beside them (`*-core.ts`) hold the rules the page needs and nothing else does: which fields
|
|
152
|
+
to read, how a price or a duration is formatted, which slot is bookable, how an id is read. Copy
|
|
153
|
+
those core functions into the page as they are, with only the types removed (`cart-core.ts`'s
|
|
154
|
+
`toLine` and `toCart`, the price formatter, `rawId`), and run every API response through them: a
|
|
155
|
+
raw field read by hand is where a page breaks (a product name is a translatable object, a cart
|
|
156
|
+
line's quantity is `quantityInfo.confirmedQuantity`). What you write is the markup, the rendering
|
|
157
|
+
of what the cores return, and the event handlers.
|
|
158
|
+
|
|
159
|
+
**A call those files don't cover** is confirmed before it is written, the way `{DOCS}` describes:
|
|
160
|
+
the method's SDK page, and when the page and the package disagree, the package's own type
|
|
161
|
+
declarations (the `@wix/auto_sdk_{solution}_<module>` package the solution package depends on,
|
|
162
|
+
its `index.d.ts`) are the truth. Two shapes that recur, as examples of what the types settle and
|
|
163
|
+
the kit's files already encode: SDK query methods return a query builder finished with `.find()`;
|
|
164
|
+
and an entity's id arrives as `_id` on some objects and `id` on others (the kit reads both,
|
|
165
|
+
`rawId`). Dates travel as local wall-clock strings in the business time zone. A page cannot be
|
|
166
|
+
opened here, so a wrong shape fails silently in the browser. Check the data code before the upload:
|
|
167
|
+
get a real response through `ExecuteWixAPI` for each call the page makes, run the page's data code
|
|
168
|
+
on it in your sandbox's Node, and look for names, prices and quantities in the output, not
|
|
169
|
+
`[object Object]` or `undefined`. The cart's calls run as a visitor, which `wix.request` (the
|
|
170
|
+
owner) is not: in the script, mint a visitor token with the site's public client id as
|
|
171
|
+
`shared/rest/client.ts` does (`POST https://www.wixapis.com/oauth2/token`, `grantType: "anonymous"`),
|
|
172
|
+
send the cart calls with it through `fetch`, add one product and read the cart back.
|
|
173
|
+
|
|
174
|
+
## 6. Closing
|
|
175
|
+
|
|
176
|
+
SKILL.md step 5's closing, with two additions: the site id, so a run with a machine attaches to this
|
|
177
|
+
site (`guides/existing-site.md`) instead of making a new one; and, when files were dropped, that a
|
|
178
|
+
change re-drops the whole set.
|
|
@@ -7,7 +7,8 @@ is the create flow's job on a site made for the run — a folder holding only a
|
|
|
7
7
|
is that case too: `init` made the site; SKILL.md step 3). (A project downloaded from Wix whose `.env.local` declares a
|
|
8
8
|
migration is the other way to arrive at an existing site: `guides/migration.md`; the reading
|
|
9
9
|
part below applies there too, against the migrated site.) `<SKILL_ROOT>` is the installed skill folder; the shipped code is
|
|
10
|
-
|
|
10
|
+
in the folder `node <SKILL_ROOT>/install/templates.mjs` prints (`<templates>` below; SKILL.md, "The
|
|
11
|
+
model").
|
|
11
12
|
|
|
12
13
|
**Read the site, then run attach.** First, one call tells you what
|
|
13
14
|
the site is — its name, currency, and the Wix apps installed on it:
|
|
@@ -46,7 +47,7 @@ for: what the chosen verticals will render, roughly how much of it, and what it
|
|
|
46
47
|
six items in three groups design differently from six hundred. Run the vertical's reader:
|
|
47
48
|
|
|
48
49
|
```bash
|
|
49
|
-
node <
|
|
50
|
+
node <templates>/<vertical>/seed/read-site.mjs --site <siteId> [--limit <n>]
|
|
50
51
|
```
|
|
51
52
|
|
|
52
53
|
It prints one JSON: whether the vertical's app is installed, counts, one page of each entity
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
# Reference mode: a static site, or a server-rendered app in another language
|
|
2
2
|
|
|
3
3
|
Read when SKILL.md step 1 resolves to a stack that cannot run `app/`. `<SKILL_ROOT>` is the
|
|
4
|
-
installed skill folder; the shipped code is
|
|
4
|
+
installed skill folder; the shipped code is in the folder `node <SKILL_ROOT>/install/templates.mjs`
|
|
5
|
+
prints (the `wix-headless-templates` skill beside this one, or a copy fetched into
|
|
6
|
+
`<SKILL_ROOT>/templates/`), and every `templates/…` path here is relative to it. Steps 2 to 5 of
|
|
5
7
|
SKILL.md still apply; this file is the mechanics that differ.
|
|
6
8
|
|
|
7
9
|
The data layer ships a second time as a **REST layer**: `templates/shared/rest/` (the auth seam
|
|
@@ -31,6 +33,12 @@ two transports: with `--plan` its REST twin and stores land in `js/wix/` beside
|
|
|
31
33
|
to it. Seed per the vertical's `SEED.md` (Node + the CLI token, no project dependencies).
|
|
32
34
|
Release with `npx @wix/cli@latest release` — no build. Item-page tags come from the entity's
|
|
33
35
|
`seoData`, set after the fetch (`document.title`, the meta description).
|
|
36
|
+
- **A dropped site on its Wix Dev Machine** (shape `static-in-astro`). The machine holds the
|
|
37
|
+
dropped pages in `public/` of an Astro starter with no pages of its own, and its Astro config
|
|
38
|
+
redirects `/` to `/index.html`. The pages stay where they are: run
|
|
39
|
+
`deploy.mjs <vertical> --stack static --out public`, which writes `public/js/wix/`, and wire the
|
|
40
|
+
pages in place as above. The config is left as it is, so the release goes through Astro:
|
|
41
|
+
`npx @wix/cli@latest build && npx @wix/cli@latest release`, to the same URL.
|
|
34
42
|
- **Server-rendered, another language (Flask, Laravel, Rails, …).** The same shape as managed
|
|
35
43
|
Astro — pages rendered on the server, the interactive surfaces in the browser — with hosting and
|
|
36
44
|
SEO plumbing theirs. `init` still runs in the project folder; run `deploy.mjs <vertical> --stack
|