@wix/agent-skills 1.7.0 → 1.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -7
- package/package.json +1 -1
- package/skills/wix-app/SKILL.md +2 -0
- package/skills/wix-app/references/EDITOR_REACT_COMPONENT.md +2 -1
- package/skills/wix-app/references/STORES_VERSIONING.md +1 -0
- package/skills/wix-app/references/editor-react-component/ACCESSIBILITY.md +14 -0
- package/skills/wix-app/references/editor-react-component/REACT-GUIDELINES.md +11 -6
- package/skills/wix-app/references/editor-react-component/REACT-PATTERNS.md +3 -17
- package/skills/wix-app/references/editor-react-component/SSR.md +119 -0
- package/skills/wix-design-system/SKILL.md +5 -1
- package/skills/wix-headless/SKILL.md +55 -32
- package/skills/wix-headless/references/BUILD-astro.md +244 -0
- package/skills/wix-headless/references/BUILD-own-build.md +167 -0
- package/skills/wix-headless/references/BUILD.md +50 -252
- package/skills/wix-headless/references/DESIGN_SYSTEM.md +94 -34
- package/skills/wix-headless/references/DISCOVERY-connect.md +55 -0
- package/skills/wix-headless/references/DISCOVERY-create.md +238 -0
- package/skills/wix-headless/references/DISCOVERY.md +41 -422
- package/skills/wix-headless/references/PLAN-connect.md +19 -0
- package/skills/wix-headless/references/PLAN-create.md +17 -0
- package/skills/wix-headless/references/PLAN.md +37 -27
- package/skills/wix-headless/references/SEED.md +27 -18
- package/skills/wix-headless/references/SETUP.md +32 -213
- package/skills/wix-headless/references/astro/blog/BLOG_PAGES.md +5 -4
- package/skills/wix-headless/references/astro/bookings/COMPONENTS.md +45 -0
- package/skills/wix-headless/references/astro/bookings/SERVICES_PAGES.md +58 -0
- package/skills/wix-headless/references/astro/cms/CMS_FOUNDATIONS.md +5 -5
- package/skills/wix-headless/references/astro/cms/FAQ_KNOWLEDGE_BASE.md +10 -10
- package/skills/wix-headless/references/astro/cms/PORTFOLIO.md +12 -13
- package/skills/wix-headless/references/astro/cms/RESOURCE_LIBRARY.md +10 -12
- package/skills/wix-headless/references/astro/cms/TEAM_DIRECTORY.md +8 -8
- package/skills/wix-headless/references/astro/designer/INSTRUCTIONS.md +47 -27
- package/skills/wix-headless/references/astro/ecom/CART_PAGES.md +7 -8
- package/skills/wix-headless/references/astro/ecom/CART_WIRING.md +5 -5
- package/skills/wix-headless/references/astro/ecom/COMPONENTS_CSS.md +3 -3
- package/skills/wix-headless/references/astro/forms/CONTACT_FORM.md +5 -19
- package/skills/wix-headless/references/astro/gift-cards/COMPONENTS.md +2 -2
- package/skills/wix-headless/references/astro/gift-cards/PAGES.md +1 -1
- package/skills/wix-headless/references/astro/stores/BACK_IN_STOCK.md +6 -6
- package/skills/wix-headless/references/astro/stores/CATEGORY_PAGES.md +4 -4
- package/skills/wix-headless/references/astro/stores/COMPONENTS_CSS.md +3 -3
- package/skills/wix-headless/references/astro/stores/HOME_AND_NAV.md +3 -3
- package/skills/wix-headless/references/astro/stores/PRODUCT_PAGES.md +9 -9
- package/skills/wix-headless/references/astro/stores/SHARED_WIRING.md +5 -4
- package/skills/wix-headless/references/astro/templates/Footer.astro +1 -1
- package/skills/wix-headless/references/astro/templates/Layout.astro +1 -1
- package/skills/wix-headless/references/astro/templates/Navigation.astro +1 -1
- package/skills/wix-headless/references/astro/templates/astro.config.mjs +1 -1
- package/skills/wix-headless/references/astro/templates/bookings/AvailabilityCalendar.tsx +233 -0
- package/skills/wix-headless/references/astro/templates/bookings/BookingForm.tsx +136 -0
- package/skills/wix-headless/references/astro/templates/bookings/SeoTags.astro +25 -0
- package/skills/wix-headless/references/astro/templates/bookings/ServiceBookingFlow.tsx +54 -0
- package/skills/wix-headless/references/astro/templates/bookings/ServiceCard.astro +45 -0
- package/skills/wix-headless/references/astro/templates/bookings/booking-confirmation.astro +49 -0
- package/skills/wix-headless/references/astro/templates/bookings/bookingDriver.ts +245 -0
- package/skills/wix-headless/references/astro/templates/bookings/components-bookings.css +356 -0
- package/skills/wix-headless/references/astro/templates/bookings/services/[slug].astro +133 -0
- package/skills/wix-headless/references/astro/templates/bookings/services/index.astro +73 -0
- package/skills/wix-headless/references/astro/templates/global.css +2 -2
- package/skills/wix-headless/references/astro/templates/index.astro +1 -1
- package/skills/wix-headless/references/blog/BLOG_CONTENT.md +19 -9
- package/skills/wix-headless/references/blog/INSTRUCTIONS.md +3 -3
- package/skills/wix-headless/references/bookings/FLOW.md +185 -0
- package/skills/wix-headless/references/bookings/INSTRUCTIONS.md +90 -0
- package/skills/wix-headless/references/bookings/SERVICES_DATA.md +295 -0
- package/skills/wix-headless/references/cms/CMS_FOUNDATIONS.md +4 -2
- package/skills/wix-headless/references/cms/INSTRUCTIONS.md +27 -1
- package/skills/wix-headless/references/commands/known-apps.json +2 -1
- package/skills/wix-headless/references/custom/CONNECTION_PLAN.md +142 -0
- package/skills/wix-headless/references/custom/INSTRUCTIONS.md +71 -21
- package/skills/wix-headless/references/custom/blog/WIRING.md +52 -0
- package/skills/wix-headless/references/custom/bookings/WIRING.md +146 -0
- package/skills/wix-headless/references/custom/cms/WIRING.md +97 -0
- package/skills/wix-headless/references/custom/ecom/WIRING.md +67 -0
- package/skills/wix-headless/references/custom/forms/WIRING.md +101 -0
- package/skills/wix-headless/references/custom/stores/WIRING.md +80 -0
- package/skills/wix-headless/references/ecom/INSTRUCTIONS.md +5 -5
- package/skills/wix-headless/references/forms/INSTRUCTIONS.md +2 -2
- package/skills/wix-headless/references/gift-cards/INSTRUCTIONS.md +3 -3
- package/skills/wix-headless/references/images/INSTRUCTIONS.md +16 -15
- package/skills/wix-headless/references/seed-recipes.md +2 -2
- package/skills/wix-headless/references/shared/AGENTS_MD.md +47 -0
- package/skills/wix-headless/references/shared/AUTHENTICATION.md +3 -5
- package/skills/wix-headless/references/shared/DESIGN_MD.md +85 -0
- package/skills/wix-headless/references/shared/IMAGE_GENERATION.md +29 -28
- package/skills/wix-headless/references/shared/IMPLEMENTER.md +87 -27
- package/skills/wix-headless/references/shared/PRODUCTION_SHARP_EDGES.md +2 -2
- package/skills/wix-headless/references/shared/RETURN_CONTRACT.md +24 -313
- package/skills/wix-headless/references/shared/STYLING.md +8 -18
- package/skills/wix-headless/references/stores/INSTRUCTIONS.md +39 -9
- package/skills/wix-headless/references/stores/PRODUCT_CATALOG_DATA.md +17 -14
- package/skills/wix-headless/references/verticals/_schema.json +1 -1
- package/skills/wix-headless/references/verticals/_schema.md +3 -3
- package/skills/wix-headless/references/verticals/blog.md +1 -1
- package/skills/wix-headless/references/verticals/bookings.md +39 -0
- package/skills/wix-headless/references/verticals/cms.md +1 -1
- package/skills/wix-headless/references/verticals/ecom.md +2 -2
- package/skills/wix-headless/references/verticals/gift-cards.md +1 -1
- package/skills/wix-headless/references/verticals/stores.md +1 -1
- package/skills/wix-headless/scripts/check-manifest.mjs +143 -6
- package/skills/wix-headless/scripts/compose.mjs +540 -0
- package/skills/wix-headless/scripts/emit-design-tokens.mjs +128 -51
- package/skills/wix-headless/scripts/flatten.sh +61 -0
- package/skills/wix-headless/scripts/generate-images.mjs +242 -0
- package/skills/wix-headless/scripts/scaffold.sh +47 -16
- package/skills/wix-headless/scripts/write-decorative-json.mjs +62 -0
- package/skills/wix-manage/SKILL.md +13 -1
- package/skills/wix-manage/references/app-installation/install-wix-apps.md +3 -27
- package/skills/wix-manage/references/blog/how-to-create-blog-posts.md +1 -1
- package/skills/wix-manage/references/bookings/create-appointment-service.md +266 -0
- package/skills/wix-manage/references/bookings/create-booking-service-from-prompt.md +37 -0
- package/skills/wix-manage/references/bookings/create-class-service.md +245 -0
- package/skills/wix-manage/references/bookings/create-course-service.md +249 -0
- package/skills/wix-manage/references/cms/cms-data-items-crud.md +3 -2
- package/skills/wix-manage/references/cms/cms-references-and-relationships.md +1 -1
- package/skills/wix-manage/references/cms/cms-schema-management.md +2 -2
- package/skills/wix-manage/references/domains/domain-search-and-purchase.md +10 -7
- package/skills/wix-manage/references/forms/create-form.md +49 -1
- package/skills/wix-manage/references/stores/bulk-create-products-with-options.md +1 -1
- package/skills/wix-manage/references/stores/create-product-from-image.md +154 -2
- package/skills/wix-manage/references/stores/setup-online-store-catalog-v3.md +1 -1
- package/skills/wix-headless/references/astro/COMPOSE.md +0 -142
- package/skills/wix-headless/scripts/finalize-run-json.mjs +0 -141
- package/skills/wix-headless/scripts/init-site-json.mjs +0 -101
- package/skills/wix-headless/scripts/preview.sh +0 -45
- package/skills/wix-headless/scripts/release.sh +0 -73
|
@@ -1,58 +1,36 @@
|
|
|
1
1
|
# Setup
|
|
2
2
|
|
|
3
|
-
Runs once
|
|
3
|
+
Runs once after approval, with the contract in scratch. Domain: install the apps the loaded packs declare, pull the Wix env, run `npm install`, and read `siteId` + `appId` from `wix.config.json` into scratch. Run flow (timing, handles, waits, batching) is owned by the framework conductor (`BUILD-astro.md` / `BUILD-own-build.md`; Setup is an early run-step in each).
|
|
4
4
|
|
|
5
|
-
This article
|
|
6
|
-
|
|
7
|
-
The **Existing project flow (Path B)** at the bottom is **retired** — non-astro (custom) frontends route to the not-available-yet stub (`references/custom/INSTRUCTIONS.md`) instead of running E1–E6. That section is kept as a historical reference only; see its banner.
|
|
8
|
-
|
|
9
|
-
This path assumes DISCOVERY.md's CLI-auth pre-flight has already passed (the foreground check that runs before any `AskUserQuestion`).
|
|
10
|
-
|
|
11
|
-
Mode/track routing (which path runs) is owned by `PLAN.md` § "Frontend-mode routing". Steps 1–5 below are the astro business steps.
|
|
5
|
+
This article is the **astro entry path** (`frontendBuild === "wix"`): Steps 1–5 + npm recovery. The `none`/`own` classes reuse **only** Step 4a (app installs); their skips (no `env pull`, no `scaffold.sh`, no per-pack `npm install`, no `seed-utilities.sh`) and their `init` bootstrap are owned by `BUILD-own-build.md`. Assumes `DISCOVERY.md`'s CLI-auth pre-flight passed. Routing: `PLAN.md` § "Operation routing" + `BUILD.md`.
|
|
12
6
|
|
|
13
7
|
---
|
|
14
8
|
|
|
15
9
|
## Step 1 — Read the scaffolded project config (siteId + appId)
|
|
16
10
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
Once the scaffolded project exists, read `<project-slug>/wix.config.json` and extract:
|
|
20
|
-
- `siteId` — the site id passed as `--site` to `npx @wix/cli@latest token` and embedded in every install body + as the `wix-site-id` header on every site-scoped REST call. Hold it in orchestrator session scratch.
|
|
21
|
-
- `appId` — the project's appId. Hold it in session scratch (it goes into the SDK's `createClient` inputs in later steps).
|
|
22
|
-
|
|
23
|
-
**Before `cd`, capture the current working directory as `<site-root>` and hold it in session scratch.** This is where Discovery's `init-site-json.mjs` wrote the slim `.wix/site.json` snapshot. The orchestrator is the **sole** reader/writer of that file; no subagent or downstream script reads it during the run. Hold `<site-root>` as an absolute path so the `cd` into the scaffold subdir below does not lose it.
|
|
11
|
+
> **Single folder — CWD == project == site-root.** `scaffold.sh` flattens the project into CWD: one folder, one `.wix/` (`package.json`, `src/`, `wix.config.json`, `.wix/design-tokens.css`, …), with the end-of-run `AGENTS.md` at its root. Never `cd` into a subdir or look in a parent for `.wix`. `<site-root>` == `<project-dir>` == CWD; pass absolute paths only when a call runs in its own subshell.
|
|
24
12
|
|
|
25
|
-
`
|
|
13
|
+
Do **not** speculatively `Read ./wix.config.json` before the scaffold completes — it doesn't exist yet on a fast-Q&A run, so the read fails and wastes a round-trip.
|
|
26
14
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
Discovery wrote `<site-root>/.wix/site.json` with `brand`, `frontend`, and `verticals`. Setup's only addition is patching `siteId` and `appId` in. This is a one-shot in-process JSON edit:
|
|
15
|
+
Once `scaffold_handle` returns, read `./wix.config.json` and hold in scratch:
|
|
16
|
+
- `siteId` — passed as `--site` to `npx @wix/cli@latest token`, embedded in every install body + the `wix-site-id` header on every site-scoped REST call.
|
|
17
|
+
- `appId` — goes into the SDK's `createClient` inputs later.
|
|
32
18
|
|
|
33
|
-
|
|
34
|
-
2. Add the two top-level fields (`siteId`, `appId`) using the values held in session scratch.
|
|
35
|
-
3. `Write` the updated file back to the same absolute path.
|
|
36
|
-
|
|
37
|
-
The file's purpose at this point is **observability + resume detection** — no subagent reads it; the orchestrator is the sole reader/writer. Six lines of edit doesn't justify a script.
|
|
19
|
+
Capture CWD as `<site-root>` in scratch. No `cd` step — every file op runs in the project root.
|
|
38
20
|
|
|
39
21
|
---
|
|
40
22
|
|
|
41
23
|
## Step 3 — Invoke the `wix-manage` skill
|
|
42
24
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
App installation is delegated to `wix-manage`. Use the harness's skill-invocation primitive — in Claude Code that's `Skill(name="wix-manage")`; other harnesses provide an analogous mechanism. **Do not** hardcode a tool-call snippet here; the prose instruction "Invoke the `wix-manage` skill" is the contract, and the harness owns the mechanics. This mirrors `wix-app/SKILL.md:241` ("Invoke the `wix-design-system` skill") and keeps the skill agent-agnostic.
|
|
25
|
+
**Always invoke `Skill(name="wix-manage")` here** — it is the only thing that publishes `<wix-manage-root>` into scratch **and loads the recipe files into context** (Step 4's installs and the whole Seed phase reuse them; `SEED.md` does not re-invoke). A known directory path is not a substitute — the recipes must be in context. Use the harness's skill-invocation primitive (Claude Code: `Skill(name="wix-manage")`); the prose instruction is the contract — don't hardcode a tool-call snippet.
|
|
46
26
|
|
|
47
|
-
|
|
27
|
+
Then read the app-install recipe by absolute path (the `Skill` invocation must precede this Read — it needs the path `wix-manage`'s SKILL.md publishes):
|
|
48
28
|
|
|
49
29
|
```
|
|
50
30
|
Read <wix-manage-root>/references/app-installation/install-wix-apps.md
|
|
51
31
|
```
|
|
52
32
|
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
The recipe's Step 2 documents the body shape every Step 4 install call will use:
|
|
33
|
+
The recipe's Step 2 documents the install body shape:
|
|
56
34
|
|
|
57
35
|
```
|
|
58
36
|
tenant: { tenantType: "SITE", id: "<siteId>" }
|
|
@@ -61,23 +39,19 @@ appInstance: { appDefId: "<pack.apps[N].appDefId>" }
|
|
|
61
39
|
|
|
62
40
|
Endpoint: `POST https://www.wixapis.com/apps-installer-service/v1/app-instance/install`.
|
|
63
41
|
|
|
64
|
-
> **Recipe call shape.**
|
|
42
|
+
> **Recipe call shape.** Recipes are authored in `curl` form. Build each call with the headers in `references/shared/AUTHENTICATION.md` (`Authorization: Bearer $TOKEN` + `wix-site-id: $SITE_ID` + `Content-Type: application/json`). The recipe's URL/method/body are the source of truth.
|
|
65
43
|
|
|
66
|
-
> **Missing-skill fallback (only
|
|
44
|
+
> **Missing-skill fallback (only if the `Skill` primitive errors):** fall back to the install body shape above (REST-shaped and stable) and note the missing skill in the run digest. Don't silently substitute — `wix-manage` is the canonical entry point.
|
|
67
45
|
|
|
68
46
|
---
|
|
69
47
|
|
|
70
48
|
## Step 4 — One concurrent batch
|
|
71
49
|
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
The dispatch contains three operations:
|
|
50
|
+
Fire 4a + 4b + 4c as a single concurrent batch (`PLAN.md` § "Batching discipline").
|
|
75
51
|
|
|
76
52
|
### 4a. App installs — one `curl` per `pack.apps[*]` (business track, frontend-blind)
|
|
77
53
|
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
Mint the site-scoped REST token once and cache it for the rest of the run, then iterate every loaded pack (top-level + transitive via `requires:`) and fire one `curl` per entry in the pack's `apps:` array:
|
|
54
|
+
The install body is identical per `pack.apps[*]` regardless of frontend. Mint the site-scoped REST token once, cache it for the run, then fire one `curl` per `apps:` entry across every loaded pack (top-level + transitive via `requires:`):
|
|
81
55
|
|
|
82
56
|
```bash
|
|
83
57
|
SITE_ID="<siteId>"
|
|
@@ -94,23 +68,17 @@ curl -sS -X POST "https://www.wixapis.com/apps-installer-service/v1/app-instance
|
|
|
94
68
|
}'
|
|
95
69
|
```
|
|
96
70
|
|
|
97
|
-
Use `npx @wix/cli@latest token …` (not bare `wix token
|
|
98
|
-
|
|
99
|
-
A 200 response confirms the install. On 401/403, retry the same call once with the cached token per the recovery ladder in `references/shared/AUTHENTICATION.md` — do **not** re-mint (the token is byte-identical for the run); if it still fails, surface the response body — a persistent 401 usually means the CLI session expired and `wix login` is required.
|
|
100
|
-
|
|
101
|
-
**Packs with `apps: []` (e.g. `cms`, `ecom`):** skip the curl but record a phase entry as `{phase: "app-install-<pack>", status: "skipped", notes: "no app required for this pack"}` — the explicit skipped entry keeps run observability unambiguous.
|
|
71
|
+
Use `npx @wix/cli@latest token …` (not bare `wix token`) — `npx` resolves the project-local CLI the scaffold produced (first call auto-fetches it ~3–5 s if missing). A 200 confirms the install. On 401/403, retry the same call once with the cached token (do **not** re-mint — it's byte-identical for the run; recovery ladder in `references/shared/AUTHENTICATION.md`); a persistent 401 usually means the CLI session expired and `wix login` is required — surface the response body.
|
|
102
72
|
|
|
103
|
-
|
|
73
|
+
Packs with `apps: []` (`cms`, `ecom`) or `disabled: true` (`gift-cards`, whose `apps:` is empty by design — the user opts in via the dashboard) install nothing — skip the curl.
|
|
104
74
|
|
|
105
75
|
### 4b. `npx @wix/cli@latest env pull --json`
|
|
106
76
|
|
|
107
|
-
Foreground
|
|
108
|
-
|
|
109
|
-
> **Always pass `--json`.** Without it the CLI renders an interactive spinner; captured through the tool's non-TTY pipe, every animation frame lands as a separate line of ANSI escapes (`\x1b[2K\x1b[1A…⠙ Pulling…`) and bloats the context for zero signal. `--json` selects the CLI's non-interactive render-to-string path (one clean `{"success": true}` line), and the skill doesn't parse this command's output anyway — it only needs `.env.local` on disk.
|
|
77
|
+
Foreground, ~5 s. Writes `WIX_CLIENT_ID` to `.env.local` (idempotent). Skipping it causes `Missing environment variable WIX_CLIENT_ID` build failures downstream. **Always pass `--json`** — without it the CLI emits an interactive spinner that floods the non-TTY pipe with ANSI frames; `--json` gives one clean line (the skill only needs `.env.local` on disk).
|
|
110
78
|
|
|
111
79
|
### 4c. Dispatch background `npm install`
|
|
112
80
|
|
|
113
|
-
|
|
81
|
+
Background shell; capture `npm_handle` + `<npm-tempfile>` in scratch. Trust the exit code at the seed gate — do not probe `node_modules`.
|
|
114
82
|
|
|
115
83
|
```bash
|
|
116
84
|
npm install --no-fund --no-audit --legacy-peer-deps <package-set> \
|
|
@@ -118,193 +86,44 @@ npm install --no-fund --no-audit --legacy-peer-deps <package-set> \
|
|
|
118
86
|
# dispatched with run_in_background: true; capture as npm_handle
|
|
119
87
|
```
|
|
120
88
|
|
|
121
|
-
`<package-set>`
|
|
89
|
+
`<package-set>` from the resolved pack set (loaded + transitive via `requires:`):
|
|
122
90
|
|
|
123
91
|
| Always | Add when pack is loaded |
|
|
124
92
|
|---|---|
|
|
125
93
|
| `@wix/sdk tailwindcss @tailwindcss/vite` | — |
|
|
126
94
|
| | **stores** → `@wix/stores` |
|
|
127
|
-
| | **ecom** (
|
|
95
|
+
| | **ecom** (direct or via stores `requires:`) → `@wix/ecom @wix/redirects` |
|
|
128
96
|
| | **blog** → `@wix/blog @wix/ricos @astrojs/rss @astrojs/sitemap` |
|
|
129
97
|
| | **forms** → `@wix/forms` |
|
|
130
|
-
| | **cms** → `@wix/data @wix/
|
|
98
|
+
| | **cms** → `@wix/data @wix/essentials` |
|
|
99
|
+
| | **bookings** → `@wix/bookings @wix/essentials @wix/forms @wix/redirects @wix/auto_sdk_ecom_cart-v-2` |
|
|
131
100
|
| | **gift-cards** → (none — disabled-by-default pack ships no Astro-time imports) |
|
|
132
101
|
|
|
133
|
-
|
|
102
|
+
Example (resolved set = stores + ecom + gift-cards + cms):
|
|
103
|
+
|
|
134
104
|
```bash
|
|
135
105
|
npm install --no-fund --no-audit --legacy-peer-deps \
|
|
136
106
|
@wix/sdk @wix/stores @wix/ecom @wix/redirects \
|
|
137
|
-
@wix/data @wix/
|
|
107
|
+
@wix/data @wix/essentials \
|
|
138
108
|
tailwindcss @tailwindcss/vite \
|
|
139
109
|
2> <npm-tempfile>
|
|
140
110
|
```
|
|
141
111
|
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
Per pre-flight S0.2, `pnpm install` fails against the `@wix/cli` template — use `npm install --legacy-peer-deps`.
|
|
145
|
-
|
|
146
|
-
**Why per-pack packages live here, not in pack frontmatter:** `references/verticals/_schema.md` is scoped to Discovery; it deliberately excludes `packages:` to keep that schema small. The install set is owned by SETUP.md instead — the lookup table above is the contract. **If you skip the per-pack additions and ship only the always-on three, `astro build` fails at Wave 5 with `Rollup failed to resolve import "@wix/stores"` (or whichever pack-side package the run depends on) and Setup's win on the foreground wall is paid back many times over in a recovery cycle.** When this happens, the build retries after an in-flight `npm install @wix/stores @wix/ecom`, costing ~30 s.
|
|
147
|
-
|
|
148
|
-
Do not invent packages beyond the table above. If a future vertical needs a new package, extend the table here.
|
|
112
|
+
Use `npm --legacy-peer-deps` — `pnpm` fails against the `@wix/cli` template. **Skipping the per-pack additions makes `astro build` fail with `Rollup failed to resolve import "@wix/<pack>"`** (~30 s recovery). Don't invent packages beyond the table; extend the table for a new vertical.
|
|
149
113
|
|
|
150
114
|
---
|
|
151
115
|
|
|
152
116
|
## Step 5 — Transition to Seed
|
|
153
117
|
|
|
154
|
-
Setup
|
|
118
|
+
Setup prints no summary. Before transitioning to `SEED.md`, confirm: `siteId` + `appId` in scratch (from `wix.config.json`, both non-empty), the cached token mints, every `apps:` pack got a 200 (empty-`apps:` packs skipped), `.env.local` contains `WIX_CLIENT_ID`, and `npm_handle` was dispatched. On any failure, surface it verbatim instead of proceeding.
|
|
155
119
|
|
|
156
120
|
---
|
|
157
121
|
|
|
158
122
|
## npm install recovery
|
|
159
123
|
|
|
160
|
-
Invoked when `npm_handle` returns non-zero
|
|
161
|
-
|
|
162
|
-
If the background `npm install` fails or hangs:
|
|
163
|
-
|
|
164
|
-
1. **Foreground retry** with `npm install --no-fund --no-audit --legacy-peer-deps <packages>` (90 s timeout). If that hangs, add `--prefer-offline`; if still hanging, run `npm cache clean --force` and retry once more.
|
|
165
|
-
2. **Last resort:** ask the user to run `npm install --legacy-peer-deps` manually and report back. Do not silently substitute pnpm/yarn — pre-flight S0.2 confirmed pnpm fails against the `@wix/cli` template.
|
|
166
|
-
|
|
167
|
-
The package set is the union of `@wix/sdk tailwindcss @tailwindcss/vite` (always) plus each loaded pack's frontmatter `packages:` array. The current pack frontmatter does not declare `packages:` blocks — vertical packs are discovery-only at this phase, so the install set is just the always-on three. Do not invent package names.
|
|
168
|
-
|
|
169
|
-
---
|
|
170
|
-
|
|
171
|
-
## Final scan (MANDATORY)
|
|
172
|
-
|
|
173
|
-
Before transitioning to SEED.md in Step 5, verify: `siteId` + `appId` are in `.wix/site.json` (extracted from `wix.config.json`, both non-empty), the cached token mints, every loaded pack with `apps:` got a 200 OK (or a `skipped` phase entry for empty `apps:`), `.env.local` contains `WIX_CLIENT_ID`, and `npm_handle` was dispatched. If any check fails, surface the failure verbatim instead of transitioning to SEED.md.
|
|
174
|
-
|
|
175
|
-
---
|
|
176
|
-
|
|
177
|
-
## Existing project flow (Path B) — RETIRED, historical reference only
|
|
178
|
-
|
|
179
|
-
> **⚠️ This flow is no longer dispatched.** Non-astro (custom) frontends now route to the **not-available-yet stub** (`references/custom/INSTRUCTIONS.md`); the conductor does not run E1–E6 (`PLAN.md` § "Custom (non-astro) frontends — not available yet", `DISCOVERY.md` § "Custom (non-astro) — not available yet"). The E1–E6 mechanics below — especially the **E4 SDK-wiring recipe** — are retained as the **historical reference / closest prior art** for the eventual custom authoring track (`references/custom/INSTRUCTIONS.md` § "Intended future shape" step 3). Do **not** dispatch this flow; it is documentation, not a live path.
|
|
180
|
-
|
|
181
|
-
This path used to run when the user already had a working frontend on disk (Claude Design output, Vite/React app, hand-coded `index.html`) and wanted to **connect it to Wix Headless** for hosting + Business Solutions.
|
|
182
|
-
|
|
183
|
-
**Differences from Path A:**
|
|
184
|
-
|
|
185
|
-
| Aspect | Path A (new project) | Path B (existing project) |
|
|
186
|
-
|---|---|---|
|
|
187
|
-
| Project creation | `npm create @wix/new@latest headless` (via `scaffold.sh`) — fresh Astro blank template | `npm create @wix/new@latest init` — wraps the existing project, leaves source untouched |
|
|
188
|
-
| Frontend | Generated by Designer + Components + Pages subagents | Already exists; orchestrator does **not** generate UI |
|
|
189
|
-
| Seeders / Designer / Pages / BUILD | Run | **Skipped** — there is no Astro structure to populate |
|
|
190
|
-
| App installs | From inferred vertical packs | From a quick **project analysis** (see E2) — only apps the existing project actually needs |
|
|
191
|
-
| SDK wiring into source | N/A (subagents write Astro + SDK calls from scratch) | **Required (E4)** — edit the project's existing source files in place |
|
|
192
|
-
| Build / release | `npx @wix/cli@latest build` + `release` via `release.sh` | `npx @wix/cli@latest release` directly — **no build step**; existing `index.html` is published as-is |
|
|
193
|
-
| Entry file | `src/pages/index.astro` (Astro convention) | **Must be `index.html`** at the configured `outputDirectory` |
|
|
194
|
-
|
|
195
|
-
### Step E1 — Init (replaces scaffold)
|
|
196
|
-
|
|
197
|
-
`cd` into the existing project directory. Run, foreground (it's interactive-ish but non-blocking with `--yes`-style defaults; capture stdout):
|
|
198
|
-
|
|
199
|
-
```bash
|
|
200
|
-
npm create @wix/new@latest init
|
|
201
|
-
```
|
|
202
|
-
|
|
203
|
-
> Same package + invoker as Path A's scaffold (`npm create @wix/new@latest headless`), only the subcommand differs: **`init` for existing projects, `headless` for new projects**. Do not combine them (`… headless init` is a known regression).
|
|
204
|
-
|
|
205
|
-
This creates a Wix Site + Headless Project (App) connected to that Site, and writes `wix.config.json` in the project root:
|
|
206
|
-
|
|
207
|
-
```jsonc
|
|
208
|
-
{
|
|
209
|
-
"projectType": "Site",
|
|
210
|
-
"appId": "16511cb9-3d3a-4371-a04a-bcc176ae5d50", // SDK clientId
|
|
211
|
-
"siteId": "90b8c952-a7f9-4d79-a2c0-b0ec3e1c1434", // siteId for every REST call this session
|
|
212
|
-
"site": {
|
|
213
|
-
"outputDirectory": "./site" // edit to "./" if the entry file is at project root
|
|
214
|
-
}
|
|
215
|
-
}
|
|
216
|
-
```
|
|
217
|
-
|
|
218
|
-
**Required follow-ups before continuing:**
|
|
219
|
-
|
|
220
|
-
1. **Entry file must be `index.html`.** If the project's entry is `index.htm`, `main.html`, etc., either rename to `index.html` or ask the user to confirm renaming. Wix Headless hosting serves `index.html` as the site root; anything else 404s.
|
|
221
|
-
2. **`site.outputDirectory` must point at the directory containing `index.html`.** If `index.html` is at the project root, use the `Edit` tool on `wix.config.json` to set `"outputDirectory": "./"`. Default is `"./site"` which assumes a build output directory.
|
|
222
|
-
3. Extract `siteId` and `appId` from `wix.config.json` and hold in session scratch (same role as Path A: `siteId` is the `wix-site-id` header on every REST call).
|
|
223
|
-
4. Capture `{ phase: "init", seconds, started, ended }` in `run.json.phases[]`.
|
|
224
|
-
|
|
225
|
-
Recovery ladder:
|
|
226
|
-
- Auth error → surface `"Run \`npx @wix/cli@latest login\` and retry."` and stop (same as Path A; full ladder in `references/shared/AUTHENTICATION.md`).
|
|
227
|
-
- `wix.config.json` already exists → skip E1, continue to E2.
|
|
228
|
-
- Network / unknown → surface stderr to the user.
|
|
229
|
-
|
|
230
|
-
### Step E2 — Analyze the project to decide which apps to install
|
|
231
|
-
|
|
232
|
-
The existing-project flow does NOT use vertical-pack inference from the user prompt. Instead, **read the project files** to decide which Wix Business Solutions are needed. Quick heuristic table:
|
|
233
|
-
|
|
234
|
-
| Signal in source files | Pack(s) to install |
|
|
235
|
-
|---|---|
|
|
236
|
-
| Mentions of "event", "wedding", "RSVP", "guests", "ceremony" | `events` (if pack exists), else CMS-backed RSVP via `cms` |
|
|
237
|
-
| `<form>` tags, "Contact us", "Get in touch", email collection | `forms` |
|
|
238
|
-
| Product listings, "buy", "$", "add to cart", price tags | `stores` (transitively pulls `ecom`, `gift-cards`) |
|
|
239
|
-
| Article / blog content, post listings | `blog` |
|
|
240
|
-
| Booking, appointments, calendar | `bookings` (if pack exists) |
|
|
241
|
-
| Restaurant menu, dishes | `restaurants` (if pack exists) |
|
|
242
|
-
| Always | `cms` (any user-editable content) |
|
|
243
|
-
|
|
244
|
-
Read `index.html` and any top-level source files (`*.jsx`, `*.tsx`, `*.html`, `*.js`) to look for these signals. Cap reading at the top 5 source files by size — don't grovel.
|
|
245
|
-
|
|
246
|
-
> If unsure between two packs, ask the user with `AskUserQuestion`. Don't install everything "just in case" — every app install adds clutter to the user's dashboard.
|
|
247
|
-
|
|
248
|
-
### Step E3 — Install apps
|
|
249
|
-
|
|
250
|
-
For each pack identified in E2, fire the install `curl` per § Step 4a above — same `tenant` / `appInstance` body, same headers, same recovery ladder (delegated to `wix-manage` per Step 3). Capture `{ phase: "app-install-<pack>", seconds }` per install.
|
|
251
|
-
|
|
252
|
-
**Skip the rest of Path A's Step 4 batch:** no `env pull` for a pure-static site (only needed if E4 below adds SDK code that reads `WIX_CLIENT_ID` at build time; if so, run `env pull` then), **no `npm install`** (the existing project manages its own deps), **no `seed-utilities.sh`** (it is frontend-track project prep for a skill-scaffolded project; integrate mode has no such project and skips Seed entirely, so the orchestrator never calls it in this flow). `.wix/site.json` itself **was** written by Discovery's "After Approval" step with `frontend: "user-provided"` — that snapshot stays for observability; do not write it again here.
|
|
253
|
-
|
|
254
|
-
### Step E4 — SDK wiring
|
|
255
|
-
|
|
256
|
-
> **The custom frontend track is the long-term home for this step.** When the custom track is built, this SDK-wiring recipe becomes per-pack wiring guides under `references/custom/<pack>/…` that inject `@wix/sdk` calls into the user's existing files (additive-only) — see `references/custom/INSTRUCTIONS.md` § "Intended future shape" step 3. Until that lands, this inline recipe is the **historical reference** (the flow itself is retired — non-astro frontends route to the stub, see the banner at the top of this section).
|
|
257
|
-
|
|
258
|
-
Installing apps in E3 only registers them against the Site — the existing frontend still ignores them until SDK calls are wired in. For each app installed in E3, find the matching feature surface in the project's source files (the same surfaces E2 detected) and wire its SDK calls inline.
|
|
259
|
-
|
|
260
|
-
1. Add `@wix/sdk` + the pack's packages (from § Step 4c's lookup table above) to the project's `package.json` (`npm init -y` first if absent), then run the project's install command with `--no-fund --no-audit --legacy-peer-deps`.
|
|
261
|
-
2. Edit the source files in place. Follow call patterns from `<SKILL_ROOT>/references/<pack>/INSTRUCTIONS.md` (translate Astro idioms → the project's framework; SDK calls themselves are framework-agnostic). Initialize the client once per file:
|
|
262
|
-
|
|
263
|
-
```js
|
|
264
|
-
import { createClient, OAuthStrategy } from "@wix/sdk";
|
|
265
|
-
const wix = createClient({
|
|
266
|
-
modules: { /* pack modules */ },
|
|
267
|
-
auth: OAuthStrategy({ clientId: "<appId from wix.config.json>" }),
|
|
268
|
-
});
|
|
269
|
-
```
|
|
270
|
-
|
|
271
|
-
**Always inline the `appId` literal from `wix.config.json`.** No env vars, no `import.meta.env`, no `window.__WIX_CLIENT_ID__` — read `wix.config.json` once and paste the appId string into every `createClient` call. Keeps the static-site case working with no build step.
|
|
272
|
-
|
|
273
|
-
Capture `{ phase: "sdk-wiring-<pack>", seconds }` per pack.
|
|
274
|
-
|
|
275
|
-
### Step E5 — Release (no build)
|
|
276
|
-
|
|
277
|
-
**Do NOT run `release.sh`** in this flow — `release.sh` runs `npx @wix/cli@latest build` first, and there is nothing to build. The existing project's `index.html` and its sibling assets already sit at the configured `site.outputDirectory`; Wix just needs to publish that directory as-is. Calling `build` here either no-ops (wastes ~5–15 s) or fails if the project has no Astro/Vite config the Wix CLI knows how to invoke.
|
|
278
|
-
|
|
279
|
-
Run release directly:
|
|
280
|
-
|
|
281
|
-
```bash
|
|
282
|
-
npx @wix/cli@latest release
|
|
283
|
-
```
|
|
284
|
-
|
|
285
|
-
Capture stdout. The CLI prints `Site published on <url>` on success — extract that URL (same parser logic as `release.sh` uses):
|
|
286
|
-
|
|
287
|
-
```bash
|
|
288
|
-
sed -nE 's/.*Site published on ([^[:space:]]+).*/\1/p'
|
|
289
|
-
```
|
|
290
|
-
|
|
291
|
-
Capture `{ phase: "release", seconds }` around the call. No `{ phase: "build" }` entry in `run.json` for this flow.
|
|
292
|
-
|
|
293
|
-
Auth-failure recovery: same as `release.sh` — if stderr mentions login, surface `"Run \`npx @wix/cli@latest login\` and retry."` and stop. Transient errors (`ECONNRESET`, `temporarily unavailable`, etc.) — retry up to 3 times with `attempt * 5` second backoff, mirroring `release.sh`.
|
|
294
|
-
|
|
295
|
-
> **If the project needs a client build** (Vite, React, Webpack, etc.), run the project's own build command manually (e.g. `npm run build`) before `npx @wix/cli@latest release`, and make sure `site.outputDirectory` points at the build output. Do not use `wix build`.
|
|
296
|
-
|
|
297
|
-
### Step E6 — Final message
|
|
298
|
-
|
|
299
|
-
Emit **exactly two URLs**, both copy-pasted verbatim from tool output / config (URL discipline from `SKILL.md` § "URL discipline" applies here too):
|
|
300
|
-
|
|
301
|
-
1. **Production URL** — bold heading / link at the top. The exact string from `Site published on <url>` in Step E5's stdout. Do not retype or modify.
|
|
302
|
-
2. **Dashboard URL** — `https://manage.wix.com/dashboard/<siteId>` where `<siteId>` is the value from `wix.config.json`.
|
|
303
|
-
|
|
304
|
-
Skip Path A's perf one-liner buckets that didn't run. For Path B the perf line is:
|
|
305
|
-
|
|
306
|
-
> `Connected in <Nm Ss> — init <n>s · app-install <n>s · sdk-wiring <n>s · release <n>s`
|
|
124
|
+
Invoked when `npm_handle` returns non-zero (dispatched in Step 4c, waited at the seed gate in `BUILD-astro.md`):
|
|
307
125
|
|
|
308
|
-
`
|
|
126
|
+
1. **Foreground retry** `npm install --no-fund --no-audit --legacy-peer-deps <packages>` (90 s timeout). If it hangs, add `--prefer-offline`; if still hanging, `npm cache clean --force` and retry once more.
|
|
127
|
+
2. **Last resort:** ask the user to run `npm install --legacy-peer-deps` manually and report back. Don't substitute pnpm/yarn — pnpm fails against the `@wix/cli` template.
|
|
309
128
|
|
|
310
|
-
|
|
129
|
+
Package set = the Step 4c table (always-on three ∪ per-pack packages). Don't invent package names.
|
|
@@ -114,8 +114,8 @@ const { title, description, pubDate, updatedDate, heroImage, tags = [] } = Astro
|
|
|
114
114
|
<head>
|
|
115
115
|
<BaseHead title={title} description={description ?? ''} />
|
|
116
116
|
<style is:global>
|
|
117
|
-
/* All BlogPost layout styles are created by the
|
|
118
|
-
See
|
|
117
|
+
/* All BlogPost layout styles are created by the merged pages scope.
|
|
118
|
+
See references/shared/STYLING.md (Blog Post Content) for the complete
|
|
119
119
|
styling contract: .hero-image, .prose, .title, .date, .tags,
|
|
120
120
|
.ricos-content overrides, etc. */
|
|
121
121
|
</style>
|
|
@@ -182,8 +182,8 @@ const posts = await queryBlogPosts();
|
|
|
182
182
|
<head>
|
|
183
183
|
<BaseHead title={SITE_TITLE} description={SITE_DESCRIPTION} />
|
|
184
184
|
<style>
|
|
185
|
-
/*
|
|
186
|
-
|
|
185
|
+
/* The merged blog-pages scope writes this route once — applying the
|
|
186
|
+
listing styles and binding queryBlogPosts() data in the same pass. */
|
|
187
187
|
</style>
|
|
188
188
|
</head>
|
|
189
189
|
<body>
|
|
@@ -267,6 +267,7 @@ Critical details:
|
|
|
267
267
|
- **`client:only="react"` is required** — `@wix/ricos` is a React component; `client:only="react"` ensures it renders only on the client, avoiding SSR issues with React-dependent code.
|
|
268
268
|
- **`[...slug]` (rest param)** — uses Astro's rest parameter syntax, not `[slug]`, to match the full slug path.
|
|
269
269
|
- **`RicosViewer`** renders the rich content from the Wix Blog editor (images, videos, text formatting, embeds, etc.) using `quickStartViewerPlugins()` for full content-type support.
|
|
270
|
+
- **Blog deliberately uses the React `RicosViewer`** (full feature set: galleries, polls, embedded media) — not a contradiction with CMS, which uses the lighter SSR `renderRicos` walker (`src/utils/ricos.ts`). Blog posts can carry the full Ricos feature set, so they need the React island; static CMS pages (about/faq/portfolio/team/resource) only need paragraphs + lists and avoid shipping ~80kb of React. See `references/astro/cms/CMS_FOUNDATIONS.md` § "Why not @wix/ricos?".
|
|
270
271
|
- **No `getStaticPaths()`** — Wix headless projects use `output: "server"` (SSR on Cloudflare Workers), so pages use `Astro.params` directly instead of static path generation.
|
|
271
272
|
- **404 handling** — `getPostBySlug` returns `null` for missing posts; redirect to `/blog` listing.
|
|
272
273
|
- **Ricos color overrides** — The BlogPost layout's `<style is:global>` block includes `.ricos-content` overrides that force `var(--color-text)` on all Ricos elements. Without these, blog text is invisible on dark themes.
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
# Bookings Components — the client islands (astro)
|
|
2
|
+
|
|
3
|
+
The `components` scope of the bookings vertical. You write the React islands that
|
|
4
|
+
power the booking UI. The **logic** is in `../../bookings/FLOW.md` (read it first);
|
|
5
|
+
this doc is the astro wiring + the gotchas. `src/styles/components-bookings.css`
|
|
6
|
+
and `src/components/bookingDriver.ts` are pre-copied — do **not** write them.
|
|
7
|
+
|
|
8
|
+
Read `references/shared/IMPLEMENTER.md` + `references/shared/STYLING.md` first.
|
|
9
|
+
|
|
10
|
+
> **Start from the templates — don't re-author the SDK wiring.** Each island has
|
|
11
|
+
> an example at `<SKILL_ROOT>/references/astro/templates/bookings/`. Read and adapt
|
|
12
|
+
> (brand copy, styling, class names already in `components-bookings.css`); keep the
|
|
13
|
+
> SDK calls + payload shapes.
|
|
14
|
+
|
|
15
|
+
## Islands you write
|
|
16
|
+
|
|
17
|
+
| File | From template | Role |
|
|
18
|
+
|------|---------------|------|
|
|
19
|
+
| `src/components/ServiceBookingFlow.tsx` | `…/ServiceBookingFlow.tsx` | `client:only` coordinator — holds the selected slot, swaps calendar → form, redirects on success. Mounted by `services/[slug].astro`. |
|
|
20
|
+
| `src/components/AvailabilityCalendar.tsx` | `…/AvailabilityCalendar.tsx` | the **week calendar** — week strip + nav → the picked day's slots. APPOINTMENT → `availabilityTimeSlots`; CLASS → `eventTimeSlots`. |
|
|
21
|
+
| `src/components/BookingForm.tsx` | `…/BookingForm.tsx` | the **schema-driven** form — renders the `@wix/forms` field list (passed in from the SSR page), keys values by `target`, calls `bookingDriver.book()`. |
|
|
22
|
+
|
|
23
|
+
## astro-specific rules
|
|
24
|
+
|
|
25
|
+
1. **Islands call `@wix` ambiently — no `createClient`/`OAuthStrategy`.** In an
|
|
26
|
+
astro browser island the `@wix/astro` visitor client is ambient (the same way
|
|
27
|
+
the ecom `CartView` island works): `import { availabilityTimeSlots } from "@wix/bookings"`
|
|
28
|
+
and call it directly. Do **not** build an `OAuthStrategy` client or read
|
|
29
|
+
`WIX_CLIENT_ID` — that pattern is for own/static builds (`../../custom/bookings/WIRING.md`).
|
|
30
|
+
2. **The booking sequence is imported, not re-authored.** Import `book`,
|
|
31
|
+
`navigateToCheckout`, `BookResultType`, and the `SelectedSlot` type from the
|
|
32
|
+
pre-copied `./bookingDriver`. The form island calls `book(...)` and branches:
|
|
33
|
+
`CheckoutRequired` → `navigateToCheckout(cartId, postFlowUrl)`; `CheckoutSkipped`
|
|
34
|
+
→ redirect to `/booking-confirmation`.
|
|
35
|
+
3. **Mount everything `client:only="react"`.** Availability + booking are
|
|
36
|
+
timezone/session-specific; never SSR them.
|
|
37
|
+
4. **The form fields come from SSR.** `services/[slug].astro` fetches the booking
|
|
38
|
+
form schema and passes a `fields` array into `ServiceBookingFlow` → `BookingForm`
|
|
39
|
+
(see `SERVICES_PAGES.md`). The island renders the fields generically — it does
|
|
40
|
+
not fetch the schema itself.
|
|
41
|
+
5. **No CSS.** The classes (`.availability-*`, `.time-slot*`, `.booking-*`) are in
|
|
42
|
+
the pre-copied `components-bookings.css`; reference them, don't write them.
|
|
43
|
+
|
|
44
|
+
## Return
|
|
45
|
+
`{ status, phase, scope: "components", summary, data, files, errors }`. If a pre-copied dependency (`bookingDriver.ts`, `components-bookings.css`) is missing, return `status: "partial"` with the coded error.
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
# Bookings Pages — the SSR routes (astro)
|
|
2
|
+
|
|
3
|
+
The `pages` scope of the bookings vertical. You write the route files. The
|
|
4
|
+
**logic** is in `../../bookings/FLOW.md` (read it first); this doc is the astro
|
|
5
|
+
wiring + the gotchas. Read `references/shared/IMPLEMENTER.md` +
|
|
6
|
+
`references/shared/STYLING.md` first.
|
|
7
|
+
|
|
8
|
+
> **Start from the templates — don't re-author the SSR data access.** Examples at
|
|
9
|
+
> `<SKILL_ROOT>/references/astro/templates/bookings/`: `ServiceCard.astro`,
|
|
10
|
+
> `services/index.astro`, `services/[slug].astro`, `booking-confirmation.astro`.
|
|
11
|
+
> Read and adapt (copy, headings, styling); keep the SDK query shapes.
|
|
12
|
+
|
|
13
|
+
## Pages you write
|
|
14
|
+
|
|
15
|
+
| File | From template | Role |
|
|
16
|
+
|------|---------------|------|
|
|
17
|
+
| `src/pages/services/index.astro` | `…/services/index.astro` | SSR catalog grid (SEO). `queryServices` via ambient `@wix/essentials`. |
|
|
18
|
+
| `src/components/ServiceCard.astro` | `…/ServiceCard.astro` | static service card for the grid. |
|
|
19
|
+
| `src/pages/services/[slug].astro` | `…/services/[slug].astro` | SSR detail (SEO) + mounts `<ServiceBookingFlow client:only="react">`. Also fetches the **booking-form schema** and passes `fields` to the island. |
|
|
20
|
+
| `src/pages/booking-confirmation.astro` | `…/booking-confirmation.astro` | confirmation — renders from the `service`/`startDate` query params (no re-fetch). |
|
|
21
|
+
|
|
22
|
+
Plus the nav/home links (shell chain — see below).
|
|
23
|
+
|
|
24
|
+
## astro-specific rules
|
|
25
|
+
|
|
26
|
+
1. **SSR reads use the ambient `@wix/essentials` client — never `OAuthStrategy`.**
|
|
27
|
+
`const result = await auth.elevate(services.queryServices)({ query: { filter: { appId: BOOKING_APP_ID }, paging: { limit: 100 } }, conditionalFields: ["STAFF_MEMBER_DETAILS"] }).find();`
|
|
28
|
+
Building `createClient({ auth: OAuthStrategy({ clientId: import.meta.env.* }) })`
|
|
29
|
+
in frontmatter 500s in the deployed runtime (the env var is client-only).
|
|
30
|
+
Always include **`appId`** in the filter. Single service by slug: the
|
|
31
|
+
`.eq("mainSlug.name", slug).eq("appId", BOOKING_APP_ID).limit(1).find()` chain.
|
|
32
|
+
2. **The detail page fetches the booking-form schema server-side.** Read
|
|
33
|
+
`service.form._id`'s form via `@wix/forms` (`auth.elevate(forms.getForm)(formId)`),
|
|
34
|
+
map `formFields` to `{ label, target, required, componentType, identifier, options }`,
|
|
35
|
+
and pass the array as `fields` into `<ServiceBookingFlow>`. **Filter to fields with a
|
|
36
|
+
recognized string `componentType`** (`TEXT_INPUT`/`PHONE_INPUT`/`DROPDOWN`) — skip
|
|
37
|
+
complex object-valued fields (e.g. the default form's multi-line `ADDRESS`), or
|
|
38
|
+
`createBooking` fails with "must be object". Pass the full `service` too — the
|
|
39
|
+
booking step reads its payment/policy. Same field-mapping as `../forms/CONTACT_FORM.md`.
|
|
40
|
+
3. **Only the read pages are SSR.** The detail page SSRs the service info for SEO,
|
|
41
|
+
then the booking UI runs in the `client:only` island. Do not SSR availability.
|
|
42
|
+
4. **Confirmation renders from query params.** The booking step redirects with
|
|
43
|
+
`?service=…&startDate=…`; render those. Do not re-fetch a stranger's booking
|
|
44
|
+
from this public page.
|
|
45
|
+
5. **Two dirs deep** (`services/[slug].astro`) → import with `../../`, not `../../../`.
|
|
46
|
+
|
|
47
|
+
## Shell chain — nav + home (this scope patches shared files)
|
|
48
|
+
|
|
49
|
+
- **Navigation** — at `<!-- nav:links -->` in `src/components/Navigation.astro`,
|
|
50
|
+
append a link to **`/services`** (label fitting the brand: "Book", "Services", "Appointments").
|
|
51
|
+
- **Home** — at `<!-- home:bookings -->` in `src/pages/index.astro`, add a short,
|
|
52
|
+
brand-voiced CTA linking to **`/services`** (heading + a line + a button-styled
|
|
53
|
+
link). Use the site's primary-action token (`--color-accent`). Do not list
|
|
54
|
+
specific services or hardcode slugs — the catalog renders them live.
|
|
55
|
+
- Append at the markers; keep the markers; never replace other packs' insertions.
|
|
56
|
+
|
|
57
|
+
## Return
|
|
58
|
+
`{ status, phase, scope: "pages", summary, data, files, errors }`. Run the pre-return file-existence assertion (`../../bookings/INSTRUCTIONS.md`). If `index.astro`/`Navigation.astro` lacks its marker, return `status: "partial"` with the coded error.
|
|
@@ -4,7 +4,7 @@ The **rendering / code-patterns** half of CMS foundations: service module templa
|
|
|
4
4
|
|
|
5
5
|
> **Seeding lives in the business track.** Creating collections and inserting/verifying items via REST is **not** here — it is in `<SKILL_ROOT>/references/cms/CMS_FOUNDATIONS.md` (the `seed` scope's doc). This file is consumed by the `pages` scope; that file by the `seed` scope. The `cms/INSTRUCTIONS.md` router points each scope at the right half.
|
|
6
6
|
|
|
7
|
-
> **Import note (read first).**
|
|
7
|
+
> **Import note (read first).** The Wix Data items API is the **`items`** named export of **`@wix/data`**: `import { items } from "@wix/data"`, then `items.query` / `items.insert` / `items.update` / `items.remove` (plus `items.bulkInsert` / `bulkSave` / `bulkPatch` / …). This is the documented form and what every CMS page here uses. Do **not** import from the internal `@wix/wix-data-items-sdk`. SETUP.md's per-pack install table (Step 4c) installs `@wix/data` + `@wix/essentials` for the cms pack.
|
|
8
8
|
|
|
9
9
|
## Rendering Ricos rich-text fields
|
|
10
10
|
|
|
@@ -14,7 +14,7 @@ For SSR Astro pages (about, faq, portfolio, team, resource), import the seeded `
|
|
|
14
14
|
|
|
15
15
|
```astro
|
|
16
16
|
---
|
|
17
|
-
import
|
|
17
|
+
import { items } from "@wix/data";
|
|
18
18
|
import { auth } from "@wix/essentials";
|
|
19
19
|
import { renderRicos } from "../utils/ricos";
|
|
20
20
|
|
|
@@ -46,7 +46,7 @@ The util covers the common subset (PARAGRAPH, HEADING 1-6, BULLETED_LIST / ORDER
|
|
|
46
46
|
|
|
47
47
|
## Prerequisites (page-side)
|
|
48
48
|
|
|
49
|
-
- `@wix/data` + `@wix/
|
|
49
|
+
- `@wix/data` + `@wix/essentials` installed (collected by SETUP.md Step 4c — do NOT install independently).
|
|
50
50
|
- The collections + items already created and seeded by the `seed` scope (see `../../cms/CMS_FOUNDATIONS.md`). Pages only **read**.
|
|
51
51
|
|
|
52
52
|
## Collection ID Format
|
|
@@ -65,7 +65,7 @@ For pages that just need to list items from a collection:
|
|
|
65
65
|
|
|
66
66
|
```astro
|
|
67
67
|
---
|
|
68
|
-
import
|
|
68
|
+
import { items } from "@wix/data";
|
|
69
69
|
import { auth } from "@wix/essentials";
|
|
70
70
|
|
|
71
71
|
// Always elevate queries for permission safety
|
|
@@ -93,7 +93,7 @@ const myItems = results.map((item) => ({
|
|
|
93
93
|
Every CMS use case follows the same `src/lib/{usecase}.ts` pattern — a typed interface and query functions that pages import.
|
|
94
94
|
|
|
95
95
|
```typescript
|
|
96
|
-
import
|
|
96
|
+
import { items } from "@wix/data";
|
|
97
97
|
import { auth } from "@wix/essentials";
|
|
98
98
|
import { media } from "@wix/sdk";
|
|
99
99
|
|
|
@@ -6,7 +6,7 @@ Build a FAQ page using `@wix/data` — Q&A pairs organized by category with acco
|
|
|
6
6
|
|
|
7
7
|
## Collection Schema
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
The schema the `seed` scope creates via REST (see `../../cms/CMS_FOUNDATIONS.md`) — fields:
|
|
10
10
|
|
|
11
11
|
| Field | Type | Purpose |
|
|
12
12
|
|-------|------|---------|
|
|
@@ -32,7 +32,7 @@ Create a collection in the Wix dashboard → CMS with these fields:
|
|
|
32
32
|
### 1. FAQ Service Module (`src/lib/faq.ts`)
|
|
33
33
|
|
|
34
34
|
```typescript
|
|
35
|
-
import
|
|
35
|
+
import { items } from "@wix/data";
|
|
36
36
|
import { auth } from "@wix/essentials";
|
|
37
37
|
|
|
38
38
|
const COLLECTION_ID = "FAQ";
|
|
@@ -169,7 +169,7 @@ export default function FaqSection({ categories }: Props) {
|
|
|
169
169
|
}
|
|
170
170
|
```
|
|
171
171
|
|
|
172
|
-
> **Styling note:** Uses `.faq-search`, `.faq-section`, `.faq-category`, `.faq-item`, `.faq-question`, `.faq-toggle`, `.faq-answer` from the designed component's `<style is:global>` block. See `
|
|
172
|
+
> **Styling note:** Uses `.faq-search`, `.faq-section`, `.faq-category`, `.faq-item`, `.faq-question`, `.faq-toggle`, `.faq-answer` from the designed component's `<style is:global>` block. See `references/shared/STYLING.md` (FAQ Accordion).
|
|
173
173
|
|
|
174
174
|
Key details:
|
|
175
175
|
- `<details>/<summary>` for native accordion behavior — no JavaScript needed for open/close
|
|
@@ -222,10 +222,10 @@ Key details:
|
|
|
222
222
|
|
|
223
223
|
## Testing
|
|
224
224
|
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
225
|
+
Assumes the `seed` scope has already created the "FAQ" collection and inserted items via REST (see `../../cms/CMS_FOUNDATIONS.md`) — with 6+ FAQ items across 2+ categories, all `published: true`.
|
|
226
|
+
|
|
227
|
+
1. Run `npx @wix/cli@latest dev`
|
|
228
|
+
2. `/faq` — shows all questions grouped by category
|
|
229
|
+
3. Click a question — accordion opens with the answer
|
|
230
|
+
4. Type in search — filters questions in real-time
|
|
231
|
+
5. Click a category jump link — scrolls to that section
|