@wix/agent-skills 1.20.1 → 1.21.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/package.json +1 -1
- package/skills/wix-app/SKILL.md +14 -112
- package/skills/wix-app/references/APP_TOOLS.md +2 -1
- package/skills/wix-app/references/BACKEND_EVENT.md +3 -3
- package/skills/wix-app/references/CUSTOM_ELEMENT_WIDGET.md +41 -152
- package/skills/wix-app/references/DASHBOARD_MODAL.md +4 -4
- package/skills/wix-app/references/SDK_MODULE_MAP.md +44 -0
- package/skills/wix-app/references/SITE_PLUGIN.md +36 -190
- package/skills/wix-app/references/app-tools/TOOLS.md +3 -1
- package/skills/wix-app/references/custom-element-widget/SETTINGS_PANEL.md +21 -0
- package/skills/wix-app/references/dashboard-page/ECOM_NAVIGATION.md +17 -0
- package/skills/wix-app/references/dashboard-plugin/SLOTS.md +4 -18
- package/skills/wix-app/references/site-plugin/EXAMPLES.md +1 -1
- package/skills/wix-headless-fast/SKILL.md +134 -49
- package/skills/wix-headless-fast/entry/skill.md +4 -3
- package/skills/wix-headless-fast/install/AGENTS.md +32 -0
- package/skills/wix-headless-fast/install/agents-md.mjs +39 -0
- package/skills/wix-headless-fast/install/attach.mjs +149 -42
- package/skills/wix-headless-fast/install/setup.mjs +239 -0
- package/skills/wix-headless-fast/references/blog/INSTRUCTIONS.md +2 -0
- package/skills/wix-headless-fast/references/blog/seed/read-site.mjs +22 -0
- package/skills/wix-headless-fast/references/bookings/INSTRUCTIONS.md +2 -0
- package/skills/wix-headless-fast/references/bookings/seed/read-site.mjs +28 -0
- package/skills/wix-headless-fast/references/cms/INSTRUCTIONS.md +2 -0
- package/skills/wix-headless-fast/references/cms/seed/read-site.mjs +20 -0
- package/skills/wix-headless-fast/references/events/INSTRUCTIONS.md +2 -0
- package/skills/wix-headless-fast/references/events/seed/read-site.mjs +26 -0
- package/skills/wix-headless-fast/references/forms/INSTRUCTIONS.md +2 -0
- package/skills/wix-headless-fast/references/forms/seed/read-site.mjs +20 -0
- package/skills/wix-headless-fast/references/members/INSTRUCTIONS.md +2 -0
- package/skills/wix-headless-fast/references/members/seed/read-site.mjs +15 -0
- package/skills/wix-headless-fast/references/portfolio/INSTRUCTIONS.md +2 -0
- package/skills/wix-headless-fast/references/portfolio/seed/read-site.mjs +20 -0
- package/skills/wix-headless-fast/references/portfolio/seed/seed-portfolio.mjs +19 -21
- package/skills/wix-headless-fast/references/pricing-plans/INSTRUCTIONS.md +2 -0
- package/skills/wix-headless-fast/references/pricing-plans/seed/read-site.mjs +21 -0
- package/skills/wix-headless-fast/references/restaurants/INSTRUCTIONS.md +2 -0
- package/skills/wix-headless-fast/references/restaurants/seed/read-site.mjs +25 -0
- package/skills/wix-headless-fast/references/restaurants/seed/seed-restaurants.mjs +25 -5
- package/skills/wix-headless-fast/references/shared/seed/read-site.mjs +99 -0
- package/skills/wix-headless-fast/references/storefront/INSTRUCTIONS.md +4 -0
- package/skills/wix-headless-fast/references/storefront/app/wix/storefront/catalog-core.ts +7 -2
- package/skills/wix-headless-fast/references/storefront/app/wix/storefront/types.ts +2 -0
- package/skills/wix-headless-fast/references/storefront/seed/SEED.md +7 -1
- package/skills/wix-headless-fast/references/storefront/seed/read-site.mjs +38 -0
- package/skills/wix-headless-fast/references/storefront/seed/seed-store.mjs +52 -16
- package/skills/wix-manage/references/ecommerce/pricing-promotions/ecom-pricing-create-coupon.md +10 -19
- package/skills/wix-manage/references/events/create-wix-event.md +5 -1
- package/skills/wix-headless-fast/install/fast-path.mjs +0 -181
package/package.json
CHANGED
package/skills/wix-app/SKILL.md
CHANGED
|
@@ -28,13 +28,7 @@ Helps build extensions for Wix CLI applications. Covers all extension types: das
|
|
|
28
28
|
|
|
29
29
|
A filtered table with neither of the two is what gets built when nobody states the requirement — it is the most common way a generated dashboard disappoints.
|
|
30
30
|
- [ ] **🛑 Patterns Docs Gate (MANDATORY for any dashboard page UI):** Read [WIX_PATTERNS_DOCS.md](references/WIX_PATTERNS_DOCS.md), then **probe** `dist/docs/index.json` with `grep`/`python3` — never a whole-file `Read`, which truncates it silently. It is the one file that says, per symbol, where to import it from (`importPath`), whether its props live in the doc or in a `.d.ts` (`bundle`), and which worked examples exist (`examples`). Upgrade `@wix/patterns` if that file is missing. Patterns API facts come only from the published `dist/docs/` (pages), `dist/examples/` (worked calls) and `dist/dts-bundle/` (types) trees — never from `src/`, `dist/esm/`, or any other path inside the package, with one named exception: `dist/types/` when a bundle has stubbed the prop you need (WIX_PATTERNS_DOCS.md step 5).
|
|
31
|
-
- [ ] **🛑 Component Docs Gate (MANDATORY, dashboard UI only):** For each patterns symbol you are about to write, decided **from the index** which single artifact answers the question you actually have
|
|
32
|
-
- **Where do I import it from?** → the entry's `importPath`. No file read at all.
|
|
33
|
-
- **How do I call it?** (generics, what a callback receives and returns, how the pieces nest) → the **example** named in `examples`. One worked example beats reconstructing a call from a chain of type files; a hook's example is often filed under the component it pairs with.
|
|
34
|
-
- **What props, and which are optional?** → **the example first** — it shows the props in use, correctly typed. For what an example cannot show (optionality, union members, an exact callback signature): entry has `bundle` ⇒ read that `.d.ts`; entry has no `bundle` ⇒ the doc's own table is complete and marks `Required`, so read the doc. The two are mutually exclusive — reading both is always one hop too many. **Two thirds of bundles stub the parent that holds the props** (`propsTotal` far above what the file declares is the tell); when that happens, read the parent the index names — one hop — batch any `readWith` files you still need into a single call, and fall back to `dist/types/` for the declaration `tsc` enforces. WIX_PATTERNS_DOCS.md step 5 has the procedure.
|
|
35
|
-
- **Any setup requirement or gotcha?** → the doc's prose. Rare, but load-bearing where present (routers, providers).
|
|
36
|
-
|
|
37
|
-
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 `importPath` the index already gave you, is the failure this gate exists to prevent.
|
|
31
|
+
- [ ] **🛑 Component Docs Gate (MANDATORY, dashboard UI only):** For each patterns symbol you are about to write, decided **from the index** which single artifact answers the question you actually have — `importPath`, `examples`, or `bundle` — 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 `importPath` the index already gave you, is the failure this gate exists to prevent.
|
|
38
32
|
- [ ] **Step 3:** Checked API references; used MCP discovery only for gaps
|
|
39
33
|
- [ ] Site/editor extensions only: kept SDK calls in the extension by default, routing out only business-wide methods a visitor genuinely cannot call (see [Identity and Elevation Requirement](#identity-and-elevation-requirement))
|
|
40
34
|
- [ ] **Step 4a:** Scaffolded each CLI-supported extension via `wix generate --params`
|
|
@@ -53,25 +47,6 @@ Helps build extensions for Wix CLI applications. Covers all extension types: das
|
|
|
53
47
|
|
|
54
48
|
---
|
|
55
49
|
|
|
56
|
-
## ❌ ANTI-PATTERNS (DO NOT DO)
|
|
57
|
-
|
|
58
|
-
| ❌ WRONG | ✅ CORRECT |
|
|
59
|
-
| ------------------------------------------- | ---------------------------------------------- |
|
|
60
|
-
| Creating a CMS Data Collection for data an existing Wix app already owns (orders, products, bookings, contacts…), or deciding "no SDK exists" without a single MCP search | Use the domain's SDK module per the [SDK-First Rule](#sdk-first-rule-existing-wix-app-data-is-never-cms) |
|
|
61
|
-
| Hand-writing builder files, folders, UUIDs, or extension registration | Run `wix generate --params` — it owns scaffolding |
|
|
62
|
-
| Implementing without reading the extension reference | Always read the relevant reference file first |
|
|
63
|
-
| Using MCP discovery without checking refs | Check reference files first |
|
|
64
|
-
| Reporting done without validation | Always run validation at the end |
|
|
65
|
-
| Letting manual action items get buried | Aggregate all manual steps at the very end |
|
|
66
|
-
| Building a dashboard page's collection UI (table, grid, filters, sort, bulk actions, page header) out of raw WDS or hand-written React | Use the `@wix/patterns` equivalent — it exists (see [Component Selection Order](#component-selection-order)) |
|
|
67
|
-
| Guessing a `@wix/patterns` or WDS component/prop name from memory | Look it up: patterns via `dist/docs/index.json` + `dist/dts-bundle/index.json` (see [WIX_PATTERNS_DOCS.md](references/WIX_PATTERNS_DOCS.md)), WDS via the `wix-design-system` skill |
|
|
68
|
-
| Hand-rolling a component (empty state, badge, tooltip, pagination) that one of the two libraries already ships | Search patterns first, then WDS; only build custom when both genuinely lack it |
|
|
69
|
-
| Calling `auth.elevate` from a site or editor extension, or calling an admin-only method there | Put the call in a backend extension and elevate there — elevation only works in backend code |
|
|
70
|
-
| Elevating a session-resolved `current*`/`my*` method (`currentCartV2.*`, `members.getMyMember`) to "be safe" | Call it directly — elevating replaces the caller's session identity and retargets the operation |
|
|
71
|
-
| Elevating a read the platform filters by caller (`members.getMember`/`queryMembers`, `items.*`, catalog) to "make it return more" | Call it directly — elevating removes the filter and returns data the visitor was never entitled to |
|
|
72
|
-
|
|
73
|
-
---
|
|
74
|
-
|
|
75
50
|
## Quick Decision Helper
|
|
76
51
|
|
|
77
52
|
1. **What are you trying to build?**
|
|
@@ -87,22 +62,18 @@ Helps build extensions for Wix CLI applications. Covers all extension types: das
|
|
|
87
62
|
|
|
88
63
|
3. **Where will it appear?**
|
|
89
64
|
- Dashboard sidebar/page →
|
|
90
|
-
- Full admin screen: Dashboard Page — UI built with `@wix/patterns` + `@wix/design-system` (see [Component Selection Order](#component-selection-order))
|
|
65
|
+
- Full admin screen: Dashboard Page — UI built with `@wix/patterns` + `@wix/design-system` (see [Component Selection Order](#component-selection-order)). **Cannot use `<Modal />`** — use a separate Dashboard Modal extension and `dashboard.openModal()` instead.
|
|
91
66
|
- Popup/form: Dashboard Modal
|
|
92
67
|
- Existing Wix app dashboard (widget) → Dashboard Plugin
|
|
93
|
-
- Existing Wix app dashboard (menu item) → Dashboard Menu Plugin
|
|
94
|
-
- Anywhere on site → custom element widget
|
|
95
|
-
- Anywhere on site
|
|
96
|
-
- Wix business solution page → Site Plugin
|
|
97
|
-
-
|
|
98
|
-
-
|
|
99
|
-
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
- **Admin:** Admin screen in the site owner's dashboard? → Dashboard Page — build its UI with `@wix/patterns` first, `@wix/design-system` for whatever patterns does not cover (see [Component Selection Order](#component-selection-order)). Need popup/form? → Dashboard Modal. Extending Wix app dashboard with a visual widget? → Dashboard Plugin. Adding a menu item to a Wix app dashboard's more-actions or bulk-actions menu? → Dashboard Menu Plugin. **Modal constraint:** Dashboard Pages cannot use `<Modal />`; use a separate Dashboard Modal extension and `dashboard.openModal()`.
|
|
104
|
-
- **Backend:** During business flow (checkout/shipping/tax)? → Service Plugin. Exposing tools to the Wix AI assistant? → App Tools (requires both `APP_TOOLS` declaration + `TOOLS_PROVIDER_CONFIG` handler — see [APP_TOOLS.md](references/APP_TOOLS.md)). After event (webhooks/sync)? → Backend Event Extension. Custom HTTP endpoints? → Backend API. Need CMS collections for app-owned data? → Data Collection (see [SDK-First Rule](#sdk-first-rule-existing-wix-app-data-is-never-cms)).
|
|
105
|
-
- **Site:** User places anywhere (standalone)? → custom element widget. Editor React component with editor manifest (styling, content, elements)? → Editor React component. Fixed slot on Wix app page? → Site Plugin. Scripts/analytics only? → Embedded Script.
|
|
68
|
+
- Existing Wix app dashboard (menu item, more-actions/bulk-actions menu) → Dashboard Menu Plugin
|
|
69
|
+
- Anywhere on site, standalone → custom element widget
|
|
70
|
+
- Anywhere on site, with editor manifest (styling/content/elements) → Editor React component
|
|
71
|
+
- Fixed slot on a Wix business solution page → Site Plugin
|
|
72
|
+
- Scripts/analytics only, no UI → Embedded Script
|
|
73
|
+
- During business flow (checkout/shipping/tax) → Service Plugin
|
|
74
|
+
- Exposing tools to the Wix AI assistant → App Tools (requires both `APP_TOOLS` declaration + `TOOLS_PROVIDER_CONFIG` handler — see [APP_TOOLS.md](references/APP_TOOLS.md))
|
|
75
|
+
- After event occurs (webhooks/sync) → Backend Event Extension
|
|
76
|
+
- Custom HTTP endpoint → Backend API
|
|
106
77
|
|
|
107
78
|
---
|
|
108
79
|
|
|
@@ -199,14 +170,6 @@ Use a Dashboard Modal for dialogs that neither write nor display a listed record
|
|
|
199
170
|
|
|
200
171
|
> **HTTP endpoints:** Generate with `extensionType: "HTTP_ENDPOINT"` (not `BACKEND_API`). See [BACKEND_API.md](references/BACKEND_API.md) for project-specific directories, handler types, and frontend URLs.
|
|
201
172
|
|
|
202
|
-
## Extension Comparison
|
|
203
|
-
|
|
204
|
-
| Custom element widget vs Editor React component vs Site Plugin | Dashboard Page vs Modal | Service Plugin vs Event |
|
|
205
|
-
| -------------------------------------------------------------- | ----------------------- | ----------------------- |
|
|
206
|
-
| Custom element widget: standalone interactive component. Editor React component: React with editor manifest (CSS/data/elements). Plugin: fixed slot in Wix app page. | Page: full page. Modal: overlay; use for popups. | Service: during flow. Event: after event. |
|
|
207
|
-
|
|
208
|
-
---
|
|
209
|
-
|
|
210
173
|
## Cross-Cutting References
|
|
211
174
|
|
|
212
175
|
| Topic | Reference |
|
|
@@ -227,46 +190,7 @@ Use a Dashboard Modal for dialogs that neither write nor display a listed record
|
|
|
227
190
|
|
|
228
191
|
**CRITICAL:** Data owned by an existing Wix business app is read and written through that app's SDK module — NEVER modeled as a new CMS Data Collection. A custom collection for such data starts empty and stays disconnected from the real records (e.g., a "refunds dashboard" built on CMS shows an empty state while refunded orders exist in Wix eCommerce).
|
|
229
192
|
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
| Entity | SDK package |
|
|
233
|
-
| --- | --- |
|
|
234
|
-
| orders / carts / checkout / refund records / fulfillments | `@wix/ecom` — orders live here regardless of vertical |
|
|
235
|
-
| products / inventory / catalog | `@wix/stores` — ⚠️ V1/V3 check, see [STORES_VERSIONING.md](references/STORES_VERSIONING.md) |
|
|
236
|
-
| payments / refunds / disputes | `@wix/payments` |
|
|
237
|
-
| invoices / payment links / receipts | `@wix/get-paid` |
|
|
238
|
-
| gift cards | `@wix/gift-vouchers` |
|
|
239
|
-
| coupons | `@wix/marketing` |
|
|
240
|
-
| pricing plans / subscriptions | `@wix/pricing-plans` |
|
|
241
|
-
| bookings / services / staff / time slots | `@wix/bookings` |
|
|
242
|
-
| calendar events / schedules | `@wix/calendar` |
|
|
243
|
-
| table reservations | `@wix/table-reservations` |
|
|
244
|
-
| restaurant menus / online orders | `@wix/restaurants` |
|
|
245
|
-
| blog posts | `@wix/blog` |
|
|
246
|
-
| site events / tickets / RSVPs | `@wix/events` |
|
|
247
|
-
| reviews | `@wix/reviews` |
|
|
248
|
-
| comments | `@wix/comments` |
|
|
249
|
-
| groups | `@wix/groups` |
|
|
250
|
-
| online programs | `@wix/online-programs` |
|
|
251
|
-
| donations | `@wix/donations` |
|
|
252
|
-
| portfolio | `@wix/portfolio` |
|
|
253
|
-
| media files | `@wix/media` |
|
|
254
|
-
| contacts / labels / tasks | `@wix/crm` |
|
|
255
|
-
| members | `@wix/members` |
|
|
256
|
-
| inbox conversations | `@wix/inbox` |
|
|
257
|
-
| forms / form submissions | `@wix/forms` |
|
|
258
|
-
| loyalty points / rewards | `@wix/loyalty` |
|
|
259
|
-
| email marketing | `@wix/email-marketing` |
|
|
260
|
-
| notifications | `@wix/notifications` |
|
|
261
|
-
| analytics | `@wix/analytics-data` |
|
|
262
|
-
| automations | `@wix/automations` |
|
|
263
|
-
| SEO tags / redirects | `@wix/seo` |
|
|
264
|
-
| site search | `@wix/search` |
|
|
265
|
-
| secrets | `@wix/secrets` |
|
|
266
|
-
| locations / site properties | `@wix/business-tools` |
|
|
267
|
-
| app instances | `@wix/app-management` |
|
|
268
|
-
|
|
269
|
-
If the entity isn't listed or you're unsure, run `SearchWixSDKDocumentation` for it — **never conclude CMS with zero MCP calls**. CMS is only for data your app itself introduces (configuration, rules, app-specific records) that no Wix app manages.
|
|
193
|
+
Find the entity the user mentioned in the [entity → SDK module map](references/SDK_MODULE_MAP.md) and use that package. If the entity isn't listed or you're unsure, run `SearchWixSDKDocumentation` for it — **never conclude CMS with zero MCP calls**. CMS is only for data your app itself introduces (configuration, rules, app-specific records) that no Wix app manages.
|
|
270
194
|
|
|
271
195
|
---
|
|
272
196
|
|
|
@@ -349,7 +273,7 @@ Two signals never settle it: the scope name — `locations.queryLocations` is `S
|
|
|
349
273
|
|
|
350
274
|
Routing out means a Backend API endpoint that elevates and is reached with `httpClient.fetchWithAuth()`. Elevation bypasses Wix's permission check, so the endpoint must re-check the caller itself — see [Identity and Authorization](references/BACKEND_API.md#identity-and-authorization) for what each host can actually verify, and why an owner-only operation belongs in a dashboard extension instead.
|
|
351
275
|
|
|
352
|
-
|
|
276
|
+
**Some extensions or SDK calls require a permission scope that `wix generate` doesn't add automatically.** Adding one is a Dev Center account change, not something the agent does — tell the user which scope to add: open their app at `https://manage.wix.com/apps/<appId>/home`, select **Develop > Permissions** in the left menu, then **Add Permissions**, then report it under [Manual Steps Required](#-manual-steps-required). If the app is already installed on a site, the owner must also re-approve it via the install/update flow — revisit that same app page's "Test App" flow (or the release output's install links) and accept "Agree & Update" — before the scope takes effect there.
|
|
353
277
|
|
|
354
278
|
---
|
|
355
279
|
|
|
@@ -437,21 +361,11 @@ If the command fails because of unknown or invalid params, run `npx wix schema g
|
|
|
437
361
|
Open every path returned in `newFiles` and replace stubbed handler bodies / UI / queries with the user's actual logic, guided by the extension reference file's API and configuration sections.
|
|
438
362
|
|
|
439
363
|
- ⚠️ MANDATORY when using WDS: Invoke the `wix-design-system` skill **before editing your first `.tsx`/`.jsx` file that imports `@wix/design-system`**. Do NOT invoke it preemptively for backend-only or data-only jobs — it adds large content to context that you won't use.
|
|
440
|
-
- ⚠️ MANDATORY when using WDS: Add `import "@wix/design-system/styles.global.css";` in the **main component** entry file (`page.tsx`, modal `.tsx`, etc.) — not in child/tab/helper files.
|
|
441
364
|
- ⚠️ MANDATORY when using Data Collections: Use the EXACT collection ID from `idSuffix` (case-sensitive). If `idSuffix` is `"product-recommendations"`, use `<app-namespace>/product-recommendations` NOT `productRecommendations`.
|
|
442
365
|
|
|
443
366
|
### Step 5: Run Validation
|
|
444
367
|
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
1. Package installation (detect package manager, run install)
|
|
448
|
-
2. TypeScript compilation check (`npx tsc --noEmit -p .`)
|
|
449
|
-
3. Build validation (`npx wix build`)
|
|
450
|
-
4. Preview deployment (`npx wix preview`)
|
|
451
|
-
|
|
452
|
-
**Do NOT report completion to the user until validation passes.**
|
|
453
|
-
|
|
454
|
-
If validation fails, fix the errors and re-validate until it passes.
|
|
368
|
+
Run the four steps in [Validation](#validation) below. **Do NOT report completion to the user until validation passes** — if it fails, fix the errors and re-validate until it does.
|
|
455
369
|
|
|
456
370
|
### Step 6: Report Completion
|
|
457
371
|
|
|
@@ -516,18 +430,6 @@ Stop and report errors if any step fails. Check `.wix/debug.log` on failures.
|
|
|
516
430
|
|
|
517
431
|
---
|
|
518
432
|
|
|
519
|
-
## Cost Optimization
|
|
520
|
-
|
|
521
|
-
- **Let the CLI scaffold** — don't burn tokens describing folder layouts or builder boilerplate
|
|
522
|
-
- **Only run `wix schema generate --type <extensionType>`** when `wix generate --params` fails — don't pre-fetch it
|
|
523
|
-
- **Read extension reference first** — always read the relevant extension reference file before implementing
|
|
524
|
-
- **Check API references first** — read relevant API reference files before using MCP discovery
|
|
525
|
-
- **Skip discovery** when all required APIs are in reference files
|
|
526
|
-
- **maxResults: 5** for all MCP SDK searches
|
|
527
|
-
- **ReadFullDocsMethodSchema** for SDK method schemas; **ReadFullDocsArticle** for prose guides only
|
|
528
|
-
- **Invoke wix-design-system** first when using WDS (prevents import errors)
|
|
529
|
-
- **Patterns before WDS** for dashboard page UI — check `@wix/patterns` docs before building anything collection- or page-shaped (see [Component Selection Order](#component-selection-order))
|
|
530
|
-
|
|
531
433
|
## Documentation
|
|
532
434
|
|
|
533
435
|
For links to official Wix CLI documentation for all extension types, see [DOCUMENTATION.md](references/DOCUMENTATION.md).
|
|
@@ -51,6 +51,7 @@ export default extensions.appTools({
|
|
|
51
51
|
tools: [
|
|
52
52
|
{
|
|
53
53
|
methodName: 'get-order-status',
|
|
54
|
+
displayName: 'Get Order Status',
|
|
54
55
|
description: 'Returns the current fulfillment status, shipping carrier, and tracking number for a customer order. Use this tool when a collaborator or customer asks where their order is, whether it has shipped, when it will arrive, or needs a tracking number. Requires a valid orderId.',
|
|
55
56
|
requestSchema: {
|
|
56
57
|
type: 'object',
|
|
@@ -120,7 +121,7 @@ when it will arrive, or needs a tracking number. Requires a valid orderId.'
|
|
|
120
121
|
## Checklist
|
|
121
122
|
|
|
122
123
|
- [ ] Tool declarations filled in the generated `.extension.ts` (replace the stub `myMethod`)
|
|
123
|
-
- [ ] Set `activated: true` on every tool you want the AI assistant to invoke (`activated
|
|
124
|
+
- [ ] Set `activated: true` on every tool you want the AI assistant to invoke (`activated` is optional and **defaults to `false`** if omitted — an omitted or `false` tool is declared but never called, with no build error to warn you)
|
|
124
125
|
- [ ] `runTool` handler covers every `methodName` that has `activated: true`
|
|
125
126
|
- [ ] Inputs validated defensively (schemas are advisory, not enforced by Wix)
|
|
126
127
|
- [ ] Wix API calls wrapped with `auth.elevate` from `@wix/essentials`
|
|
@@ -44,7 +44,7 @@ export default contacts.onContactCreated(async (event) => {
|
|
|
44
44
|
## Key Constraints
|
|
45
45
|
|
|
46
46
|
- **One handler per event** – You cannot have two event extensions for the same event in the app (local or dashboard).
|
|
47
|
-
- **
|
|
47
|
+
- **Adding the first event to an app forces a major release** – The very first event extension in an app requests a brand-new permission scope, so `wix release --version-type minor` fails with `Minor version release is not allowed` / `Release major version.`; use `--version-type major` for that release. Once the required scope already exists on the app, later changes to event handler code can release as `minor`.
|
|
48
48
|
- **Testing** – Release a version with your changes, then perform the action that triggers the event. Some events are not fully testable in local dev.
|
|
49
49
|
- **Backend limits** – Event handlers run under backend extension limits (e.g. 1000 CPU ms per request, 20 sub-requests). See [About Backend Extensions](https://dev.wix.com/docs/wix-cli/guides/extensions/backend-extensions/about-backend-extensions).
|
|
50
50
|
|
|
@@ -57,5 +57,5 @@ export default contacts.onContactCreated(async (event) => {
|
|
|
57
57
|
|
|
58
58
|
## Testing Event Extensions
|
|
59
59
|
|
|
60
|
-
1. **Release** a version with your changes.
|
|
61
|
-
2. **Trigger** the event by taking
|
|
60
|
+
1. **Release** a version with your changes (see the major-vs-minor note above — the first event extension needs `--version-type major`).
|
|
61
|
+
2. **Trigger** the event by taking the real action on the site (e.g., create a Contact via the dashboard or REST API). Ask the user to confirm the subscription and delivery in Dev Center, since it isn't reachable through the CLI or API: the app's Webhooks page (Dev Center → your app → Webhooks → Subscriptions) should show the subscription, and the **Logs** tab there after triggering should show a `SUCCESS` row with the expected `entityId`/payload — that's what confirms the event reached the handler's deployed endpoint.
|
|
@@ -5,7 +5,7 @@ Custom element widgets are native web components (HTML custom elements) that app
|
|
|
5
5
|
|
|
6
6
|
## Scaffold
|
|
7
7
|
|
|
8
|
-
Use `wix generate --params
|
|
8
|
+
Use `wix generate --params '{"extensionType":"CUSTOM_ELEMENT","name":"<Display Name>"}'` — `name` is the required param (a human-readable name, e.g. `"Countdown Timer"`), **not `folder`**: the CLI derives the folder/tag name from it (kebab-cased, `-element` suffix added if needed for the hyphen requirement). The CLI generates 4 files plus the `src/extensions.ts` registration:
|
|
9
9
|
|
|
10
10
|
| File | Purpose |
|
|
11
11
|
|------|---------|
|
|
@@ -14,13 +14,13 @@ Use `wix generate --params` with `extensionType: CUSTOM_ELEMENT`. `folder` must
|
|
|
14
14
|
| `<name>.module.css` | CSS Modules stylesheet pre-wired with a `.root` class and CSS custom-property tokens |
|
|
15
15
|
| `<name>.extension.ts` | Builder file (UUID, name, sizing defaults, auto-add, presets, tagName, file paths) |
|
|
16
16
|
|
|
17
|
-
|
|
17
|
+
Edit `<name>.tsx`/`.panel.tsx`/`.module.css` for logic/settings-UI/styling; touch the builder file only for non-default sizing, auto-add, or presets.
|
|
18
18
|
|
|
19
19
|
## Widget Component (`<name>.tsx`)
|
|
20
20
|
|
|
21
21
|
Wix calls `customElements.define()` for you using the builder's `tagName`; do NOT call it in your code.
|
|
22
22
|
|
|
23
|
-
Two
|
|
23
|
+
Two patterns: **native class** (CLI default) and **React function component** via `react-to-webcomponent`.
|
|
24
24
|
|
|
25
25
|
### Native class component (CLI default)
|
|
26
26
|
|
|
@@ -29,9 +29,6 @@ import styles from './<name>.module.css';
|
|
|
29
29
|
|
|
30
30
|
class MyWidget extends HTMLElement {
|
|
31
31
|
static get observedAttributes() { return ['display-name']; }
|
|
32
|
-
|
|
33
|
-
constructor() { super(); }
|
|
34
|
-
|
|
35
32
|
connectedCallback() { this.render(); }
|
|
36
33
|
disconnectedCallback() { /* tear down timers, listeners */ }
|
|
37
34
|
attributeChangedCallback() { this.render(); }
|
|
@@ -45,14 +42,14 @@ class MyWidget extends HTMLElement {
|
|
|
45
42
|
export default MyWidget;
|
|
46
43
|
```
|
|
47
44
|
|
|
48
|
-
Key
|
|
45
|
+
Key rules:
|
|
49
46
|
|
|
50
47
|
- Extend `HTMLElement`; export the class as the default export.
|
|
51
48
|
- `observedAttributes` must return **kebab-case** strings — HTML attributes don't preserve camelCase.
|
|
52
49
|
- Start side effects in `connectedCallback`, tear them down in `disconnectedCallback`.
|
|
53
50
|
- Call `this.render()` from `attributeChangedCallback`; always provide defaults via `getAttribute` — attributes may be `null` on first paint.
|
|
54
51
|
- Render via `this.innerHTML` (template strings) or imperative DOM, not JSX.
|
|
55
|
-
- Apply the `.root` class from `<name>.module.css` rather than hard-coding colors inline.
|
|
52
|
+
- Apply the `.root` class from `<name>.module.css` rather than hard-coding colors inline — don't import other global CSS.
|
|
56
53
|
|
|
57
54
|
### React function component alternative (react-to-webcomponent)
|
|
58
55
|
|
|
@@ -77,9 +74,9 @@ export default reactToWebComponent(MyWidget, React, ReactDOM as any, {
|
|
|
77
74
|
});
|
|
78
75
|
```
|
|
79
76
|
|
|
80
|
-
Key
|
|
77
|
+
Key rules for this pattern:
|
|
81
78
|
|
|
82
|
-
- Define props in
|
|
79
|
+
- Define props in camelCase (see [Props Naming Convention](#props-naming-convention) below) — you do not need `observedAttributes` or `attributeChangedCallback`.
|
|
83
80
|
- Use React hooks (`useState`, `useEffect`) for state and side effects.
|
|
84
81
|
- Render with JSX; use `<name>.module.css` for styles via `className`.
|
|
85
82
|
|
|
@@ -92,8 +89,8 @@ React component shown in the Wix Editor sidebar.
|
|
|
92
89
|
- Loads initial values with `widget.getProp('kebab-case-name')`.
|
|
93
90
|
- Updates properties with `widget.setProp('kebab-case-name', value)`. Always update both local React state AND the widget prop in onChange handlers.
|
|
94
91
|
- Wrapped in `WixDesignSystemProvider > SidePanel > SidePanel.Content`.
|
|
95
|
-
- For color
|
|
96
|
-
- For
|
|
92
|
+
- For color/font fields, see [Color & Font Pickers](#color--font-pickers) below — never a plain `<Input>`.
|
|
93
|
+
- For date/time fields, see [Date & Time Fields](custom-element-widget/SETTINGS_PANEL.md#date--time-fields) — `DatePicker`/`TimeInput` `onChange` shapes differ.
|
|
97
94
|
|
|
98
95
|
## Builder file (`<name>.extension.ts`)
|
|
99
96
|
|
|
@@ -102,106 +99,57 @@ The CLI scaffolds the builder file with sensible defaults — edit it only to cu
|
|
|
102
99
|
| Field | Type | Default | Purpose |
|
|
103
100
|
|---|---|---|---|
|
|
104
101
|
| `id` | UUID | generated | Extension ID. Don't change after scaffolding. |
|
|
105
|
-
| `name` | string | from scaffold param | Display name
|
|
106
|
-
| `tagName` | kebab-case | derived from `folder` | Custom-element tag
|
|
107
|
-
| `width.defaultWidth` | number (px) | `450` | Initial width when
|
|
108
|
-
| `width.allowStretch` | boolean | `true` | Whether the site owner can stretch the widget
|
|
102
|
+
| `name` | string | from scaffold param | Display name, **max 30 chars** — longer fails platform validation on deploy. |
|
|
103
|
+
| `tagName` | kebab-case | derived from `folder` | Custom-element tag used by the Editor and `customElements.define()`. |
|
|
104
|
+
| `width.defaultWidth` | number (px) | `450` | Initial width when added to a page. |
|
|
105
|
+
| `width.allowStretch` | boolean | `true` | Whether the site owner can stretch the widget's width. |
|
|
109
106
|
| `height.defaultHeight` | number (px) | `250` | Initial height. |
|
|
110
|
-
| `installation.autoAdd` | boolean | `true` |
|
|
111
|
-
| `presets` | array | one default preset | Editor presets
|
|
112
|
-
| `presets[].thumbnailUrl` | string | `{{BASE_URL}}/<name>-thumbnail.png` |
|
|
113
|
-
| `element`
|
|
114
|
-
| `settings` | path | `./extensions/site/widgets/<name>/<name>.panel.tsx` | Path to the settings panel file. Don't change unless renaming files. |
|
|
107
|
+
| `installation.autoAdd` | boolean | `true` | Auto-added on app install if true; set `false` for opt-in widgets. |
|
|
108
|
+
| `presets` | array | one default preset | Editor presets the site owner can pick, each with its own `id`/`name`/`thumbnailUrl`. |
|
|
109
|
+
| `presets[].thumbnailUrl` | string | `{{BASE_URL}}/<name>-thumbnail.png` | Preview image path; `{{BASE_URL}}` resolves at build time — replace the placeholder asset there. |
|
|
110
|
+
| `element` / `settings` | path | generated paths | Widget/panel file paths. Don't change unless renaming files. |
|
|
115
111
|
|
|
116
112
|
- Import `@wix/design-system/styles.global.css` for styles
|
|
117
|
-
- For colors, use `ColorPickerField` with `inputs.selectColor()` from `@wix/editor` — NOT `<Input type="color">`
|
|
118
|
-
- For fonts, use `FontPickerField` with `inputs.selectFont()` from `@wix/editor` — NOT a text Input
|
|
119
|
-
- Font values are stored as JSON strings via `JSON.stringify()` / `JSON.parse()`
|
|
120
113
|
|
|
121
114
|
## Props Naming Convention
|
|
122
115
|
|
|
123
|
-
The convention differs by pattern, but the settings panel side is always kebab-case
|
|
124
|
-
|
|
125
|
-
**Native class component:**
|
|
126
|
-
|
|
127
|
-
| Side | Convention | Example |
|
|
128
|
-
| ---- | ---------- | ------- |
|
|
129
|
-
| `<name>.tsx` — `observedAttributes`, `getAttribute` | kebab-case | `"display-name"`, `"bg-color"` |
|
|
130
|
-
| `<name>.panel.tsx` — `widget.getProp` / `widget.setProp` | kebab-case | `"display-name"`, `"bg-color"` |
|
|
131
|
-
| Local TypeScript variables | camelCase | `displayName`, `bgColor` |
|
|
132
|
-
|
|
133
|
-
**React function component (react-to-webcomponent):** Define props with camelCase keys in the `props` option. The library handles the kebab-case ↔ camelCase mapping at the HTML attribute boundary automatically.
|
|
116
|
+
The convention differs by pattern, but the settings panel side is always kebab-case:
|
|
134
117
|
|
|
135
|
-
| Side | Convention | Example |
|
|
136
|
-
|
|
|
137
|
-
| `
|
|
138
|
-
|
|
|
139
|
-
|
|
|
118
|
+
| Pattern | Side | Convention | Example |
|
|
119
|
+
| --- | --- | --- | --- |
|
|
120
|
+
| Native class | `<name>.tsx` (`observedAttributes`, `getAttribute`) | kebab-case | `"display-name"`, `"bg-color"` |
|
|
121
|
+
| Native class | Local TypeScript variables | camelCase | `displayName`, `bgColor` |
|
|
122
|
+
| React FC | `reactToWebComponent` `props` option | camelCase | `{ displayName: 'string' }` |
|
|
123
|
+
| React FC | Component props interface | camelCase | `displayName?: string` |
|
|
124
|
+
| Both | `<name>.panel.tsx` (`widget.getProp`/`setProp`) | kebab-case | `"display-name"`, `"bg-color"` |
|
|
140
125
|
|
|
141
126
|
## Identity and SDK Calls
|
|
142
127
|
|
|
143
|
-
A widget runs
|
|
128
|
+
A widget runs as the **site visitor or member**, never as the app — see [Identity and Elevation Requirement](../SKILL.md#identity-and-elevation-requirement) before routing any SDK call out to a backend endpoint.
|
|
144
129
|
|
|
145
|
-
A widget's collection reads
|
|
130
|
+
A widget's collection reads need permissions admitting an anonymous visitor — see [Permissions](DATA_COLLECTION.md#permissions); the scaffolded default is `ANYONE` read, `PRIVILEGED` write.
|
|
146
131
|
|
|
147
132
|
## Wix Data API Integration
|
|
148
133
|
|
|
149
134
|
When using the Wix Data API in widgets, you **must** handle the Wix Editor environment gracefully — fetching data inside the Editor produces empty results and noisy errors.
|
|
150
135
|
|
|
151
|
-
**Requirements (both patterns):**
|
|
136
|
+
**Requirements (both patterns):** install `@wix/site-window` first (not part of the CLI's base scaffold), check `await wixWindow.viewMode()` before fetching, render a placeholder if `'Editor'`, as below.
|
|
152
137
|
|
|
153
|
-
|
|
154
|
-
- Check `await wixWindow.viewMode()` before fetching data.
|
|
155
|
-
- If `viewMode === 'Editor'`, render a placeholder instead of fetching.
|
|
156
|
-
- Only query and render real data when NOT in Editor mode.
|
|
157
|
-
|
|
158
|
-
**Native class component:**
|
|
138
|
+
**Native class component** — same class shape as [above](#native-class-component-cli-default), `observedAttributes` returning `['collection-id']`, with this `render()`:
|
|
159
139
|
|
|
160
140
|
```typescript
|
|
161
141
|
import { items } from '@wix/data';
|
|
162
142
|
import { window as wixWindow } from '@wix/site-window';
|
|
163
143
|
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
constructor() {
|
|
170
|
-
super();
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
connectedCallback() {
|
|
174
|
-
this.render();
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
attributeChangedCallback() {
|
|
178
|
-
this.render();
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
async render() {
|
|
182
|
-
const collectionId = this.getAttribute('collection-id') || '';
|
|
183
|
-
const viewMode = await wixWindow.viewMode();
|
|
184
|
-
|
|
185
|
-
if (viewMode === 'Editor') {
|
|
186
|
-
this.innerHTML = `
|
|
187
|
-
<div style="padding: 20px; border: 2px dashed #ccc">
|
|
188
|
-
<p>Widget will display data on the live site</p>
|
|
189
|
-
<p>Collection: ${collectionId}</p>
|
|
190
|
-
</div>
|
|
191
|
-
`;
|
|
192
|
-
return;
|
|
193
|
-
}
|
|
194
|
-
|
|
195
|
-
try {
|
|
196
|
-
const { items: results } = await items.query(collectionId).limit(10).find();
|
|
197
|
-
this.innerHTML = results.map((item) => `<div>${item.title}</div>`).join('');
|
|
198
|
-
} catch (error) {
|
|
199
|
-
console.error('Failed to load data:', error);
|
|
200
|
-
}
|
|
144
|
+
async render() {
|
|
145
|
+
const collectionId = this.getAttribute('collection-id') || '';
|
|
146
|
+
if ((await wixWindow.viewMode()) === 'Editor') {
|
|
147
|
+
this.innerHTML = `<div style="padding: 20px; border: 2px dashed #ccc"><p>Widget will display data on the live site</p></div>`;
|
|
148
|
+
return;
|
|
201
149
|
}
|
|
150
|
+
const { items: results } = await items.query(collectionId).limit(10).find();
|
|
151
|
+
this.innerHTML = results.map((item) => `<div>${item.title}</div>`).join('');
|
|
202
152
|
}
|
|
203
|
-
|
|
204
|
-
export default MyWidget;
|
|
205
153
|
```
|
|
206
154
|
|
|
207
155
|
**React function component** — use `useEffect` for the viewMode check and data fetch:
|
|
@@ -224,74 +172,15 @@ useEffect(() => {
|
|
|
224
172
|
|
|
225
173
|
## Color & Font Pickers
|
|
226
174
|
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
| Picker | API | Preview component | Value type |
|
|
230
|
-
|--------|-----|-------------------|------------|
|
|
231
|
-
| Color | `inputs.selectColor(value, { onChange })` from `@wix/editor` | `<FillPreview fill={value} onClick={...} />` | `string` |
|
|
232
|
-
| Font | `inputs.selectFont(value, { onChange })` from `@wix/editor` | `<Button onClick={...}>Change Font</Button>` | `{ font: string; textDecoration: string }` — store as `JSON.stringify()` |
|
|
233
|
-
|
|
234
|
-
```typescript
|
|
235
|
-
// Color — inside a SidePanel.Field > FormField
|
|
236
|
-
<FillPreview
|
|
237
|
-
fill={bgColor}
|
|
238
|
-
onClick={() => inputs.selectColor(bgColor, {
|
|
239
|
-
onChange: (val) => { if (val) { setBgColor(val); widget.setProp('bg-color', val); } }
|
|
240
|
-
})}
|
|
241
|
-
/>
|
|
242
|
-
|
|
243
|
-
// Font — inside a SidePanel.Field > FormField
|
|
244
|
-
<Button onClick={() => inputs.selectFont(font, {
|
|
245
|
-
onChange: (val) => {
|
|
246
|
-
const next = { font: val.font, textDecoration: val.textDecoration || '' };
|
|
247
|
-
setFont(next);
|
|
248
|
-
widget.setProp('font', JSON.stringify(next));
|
|
249
|
-
}
|
|
250
|
-
})}>Change Font</Button>
|
|
251
|
-
```
|
|
175
|
+
See [SETTINGS_PANEL.md § Color & Font Picker Fields](custom-element-widget/SETTINGS_PANEL.md#color--font-picker-fields) for the API, value types, and wiring — never `<Input type="color">` or a plain text input. Call `widget.setProp('bg-color', val)` / `widget.setProp('font', JSON.stringify(val))` from the `onChange` shown there to persist the value.
|
|
252
176
|
|
|
253
177
|
## Examples
|
|
254
178
|
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
**
|
|
258
|
-
|
|
259
|
-
**Output:**
|
|
260
|
-
|
|
261
|
-
- Widget with configurable title, target date/time, colors, and font
|
|
262
|
-
- Settings panel with date picker, time input, color pickers, font picker
|
|
263
|
-
- Real-time countdown display with days, hours, minutes, seconds
|
|
264
|
-
|
|
265
|
-
### Product Showcase Widget
|
|
266
|
-
|
|
267
|
-
**Request:** "Create a widget that displays products from a collection"
|
|
268
|
-
|
|
269
|
-
**Output:**
|
|
270
|
-
|
|
271
|
-
- Widget that queries Wix Data collection
|
|
272
|
-
- Editor environment handling (shows placeholder in editor)
|
|
273
|
-
- Settings panel for collection selection, display options, styling
|
|
274
|
-
- Responsive grid layout with product cards
|
|
275
|
-
|
|
276
|
-
### Interactive Calculator Widget
|
|
277
|
-
|
|
278
|
-
**Request:** "Create a calculator widget with customizable colors"
|
|
279
|
-
|
|
280
|
-
**Output:**
|
|
281
|
-
|
|
282
|
-
- Functional calculator component
|
|
283
|
-
- Settings panel for color customization (background, buttons, text)
|
|
284
|
-
- Inline styles for all styling
|
|
285
|
-
- No external dependencies
|
|
179
|
+
- **"Create a countdown timer widget"** → title/date/colors/font settings (see [Date & Time Fields](custom-element-widget/SETTINGS_PANEL.md#date--time-fields)), a live days/hours/minutes/seconds display.
|
|
180
|
+
- **"Create a widget that displays products from a collection"** → Wix Data query with [Editor-mode handling](#wix-data-api-integration), a responsive product-card grid.
|
|
181
|
+
- **"Create a calculator widget with customizable colors"** → a functional calculator, color-customization settings, inline styles, no external dependencies.
|
|
286
182
|
|
|
287
183
|
## Frontend Aesthetics
|
|
288
184
|
|
|
289
|
-
Avoid generic aesthetics
|
|
290
|
-
|
|
291
|
-
## Custom-element-specific Conventions
|
|
185
|
+
Avoid generic aesthetics — distinctive fonts (not Inter, Roboto, Arial), a cohesive color palette, and CSS micro-interactions, not a predictable clichéd layout.
|
|
292
186
|
|
|
293
|
-
- **Native class (CLI default):** Widget extends `HTMLElement` and renders via `this.innerHTML`. Use kebab-case throughout (`observedAttributes`, `getAttribute`, `getProp`, `setProp`).
|
|
294
|
-
- **React function component alternative:** Widget uses a React FC converted via `react-to-webcomponent`. Use camelCase in the `props` option; the library handles kebab-case HTML attributes automatically. The settings panel side still uses kebab-case with `getProp`/`setProp`.
|
|
295
|
-
- The settings panel (`<name>.panel.tsx`) is always a functional React component with hooks, regardless of which widget pattern is used.
|
|
296
|
-
- Style via the generated `<name>.module.css` (preferred) or inline styles. Don't import other global CSS.
|
|
297
|
-
- Handle the Wix Editor environment when using the Wix Data API.
|
|
@@ -67,12 +67,12 @@ const result = await modalClosed; // Resolves with data from closeModal()
|
|
|
67
67
|
|
|
68
68
|
## Receiving Data in Modal
|
|
69
69
|
|
|
70
|
-
Inside the modal, subscribe via `dashboard.observeState()` to access whatever was passed in `openModal({ params })`. The callback receives the params object as `state
|
|
70
|
+
Inside the modal, subscribe via `dashboard.observeState()` to access whatever was passed in `openModal({ params })`. The callback receives the params object as `state`. `observeState` is generic (`state`'s type defaults to `{}`), so **pass the params shape explicitly as a type argument** — without it, `tsc` fails every property access on `state` with "Property 'x' does not exist on type '{}'":
|
|
71
71
|
|
|
72
72
|
```typescript
|
|
73
73
|
import { dashboard } from "@wix/dashboard";
|
|
74
74
|
|
|
75
|
-
dashboard.observeState((state) => {
|
|
75
|
+
dashboard.observeState<{ userId: string; itemData: unknown }>((state) => {
|
|
76
76
|
// state contains the keys you passed in `openModal({ params: { ... } })`
|
|
77
77
|
console.log(state.userId, state.itemData);
|
|
78
78
|
});
|
|
@@ -109,7 +109,7 @@ export default {
|
|
|
109
109
|
|
|
110
110
|
| Mistake | Fix |
|
|
111
111
|
|---------|-----|
|
|
112
|
-
| Can't find modal ID | Check the modal's generated builder file (`extensions.ts
|
|
112
|
+
| Can't find modal ID | Check the modal's generated builder file's `id` field (not `src/extensions.ts`, which only registers the extension) |
|
|
113
113
|
| Using `extensionId` instead of `modalId` | Use `modalId` in `openModal()` |
|
|
114
114
|
| Can't access params in modal | Use `dashboard.observeState()` to read passed data |
|
|
115
115
|
| Modal won't close | Use `dashboard.closeModal()` from `@wix/dashboard` |
|
|
@@ -137,7 +137,7 @@ const handleDelete = async (item: Item) => {
|
|
|
137
137
|
const [itemName, setItemName] = useState<string | null>(null);
|
|
138
138
|
|
|
139
139
|
useEffect(() => {
|
|
140
|
-
dashboard.observeState((state) => {
|
|
140
|
+
dashboard.observeState<{ itemName?: string }>((state) => {
|
|
141
141
|
if (state.itemName) setItemName(state.itemName);
|
|
142
142
|
});
|
|
143
143
|
}, []);
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
# Entity → SDK Module Map
|
|
2
|
+
|
|
3
|
+
Data owned by an existing Wix business app is read and written through that app's SDK module — NEVER modeled as a new CMS Data Collection (see the [SDK-First Rule](../SKILL.md#sdk-first-rule-existing-wix-app-data-is-never-cms) in `SKILL.md`). A custom collection for such data starts empty and stays disconnected from the real records (e.g., a "refunds dashboard" built on CMS shows an empty state while refunded orders exist in Wix eCommerce).
|
|
4
|
+
|
|
5
|
+
**Entity → SDK module map** (find the entity the user mentioned, use that package):
|
|
6
|
+
|
|
7
|
+
| Entity | SDK package |
|
|
8
|
+
| --- | --- |
|
|
9
|
+
| orders / carts / checkout / refund records / fulfillments | `@wix/ecom` — orders live here regardless of vertical |
|
|
10
|
+
| products / inventory / catalog | `@wix/stores` — ⚠️ V1/V3 check, see [STORES_VERSIONING.md](STORES_VERSIONING.md) |
|
|
11
|
+
| payments / refunds / disputes | `@wix/payments` |
|
|
12
|
+
| invoices / payment links / receipts | `@wix/get-paid` |
|
|
13
|
+
| gift cards | `@wix/gift-vouchers` |
|
|
14
|
+
| coupons | `@wix/marketing` |
|
|
15
|
+
| pricing plans / subscriptions | `@wix/pricing-plans` |
|
|
16
|
+
| bookings / services / staff / time slots | `@wix/bookings` |
|
|
17
|
+
| calendar events / schedules | `@wix/calendar` |
|
|
18
|
+
| table reservations | `@wix/table-reservations` |
|
|
19
|
+
| restaurant menus / online orders | `@wix/restaurants` |
|
|
20
|
+
| blog posts | `@wix/blog` |
|
|
21
|
+
| site events / tickets / RSVPs | `@wix/events` |
|
|
22
|
+
| reviews | `@wix/reviews` |
|
|
23
|
+
| comments | `@wix/comments` |
|
|
24
|
+
| groups | `@wix/groups` |
|
|
25
|
+
| online programs | `@wix/online-programs` |
|
|
26
|
+
| donations | `@wix/donations` |
|
|
27
|
+
| portfolio | `@wix/portfolio` |
|
|
28
|
+
| media files | `@wix/media` |
|
|
29
|
+
| contacts / labels / tasks | `@wix/crm` |
|
|
30
|
+
| members | `@wix/members` |
|
|
31
|
+
| inbox conversations | `@wix/inbox` |
|
|
32
|
+
| forms / form submissions | `@wix/forms` |
|
|
33
|
+
| loyalty points / rewards | `@wix/loyalty` |
|
|
34
|
+
| email marketing | `@wix/email-marketing` |
|
|
35
|
+
| notifications | `@wix/notifications` |
|
|
36
|
+
| analytics | `@wix/analytics-data` |
|
|
37
|
+
| automations | `@wix/automations` |
|
|
38
|
+
| SEO tags / redirects | `@wix/seo` |
|
|
39
|
+
| site search | `@wix/search` |
|
|
40
|
+
| secrets | `@wix/secrets` |
|
|
41
|
+
| locations / site properties | `@wix/business-tools` |
|
|
42
|
+
| app instances | `@wix/app-management` |
|
|
43
|
+
|
|
44
|
+
If the entity isn't listed or you're unsure, run `SearchWixSDKDocumentation` for it — **never conclude CMS with zero MCP calls**. CMS is only for data your app itself introduces (configuration, rules, app-specific records) that no Wix app manages.
|