@wix/agent-skills 1.16.1 → 1.16.2

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.
Files changed (67) hide show
  1. package/package.json +1 -1
  2. package/skills/wix-app/SKILL.md +72 -8
  3. package/skills/wix-app/references/CODE_QUALITY.md +0 -1
  4. package/skills/wix-app/references/DASHBOARD_MODAL.md +21 -14
  5. package/skills/wix-app/references/DASHBOARD_PAGE.md +30 -184
  6. package/skills/wix-app/references/EDITOR_REACT_COMPONENT.md +1 -0
  7. package/skills/wix-app/references/WIX_PATTERNS_DOCS.md +172 -0
  8. package/skills/wix-app/references/dashboard-page/WDS_LAYOUT.md +187 -0
  9. package/skills/wix-app/references/editor-react-component/ANIMATED-COMPONENTS.md +31 -2
  10. package/skills/wix-app/references/editor-react-component/COMPONENT-API.md +6 -1
  11. package/skills/wix-app/references/editor-react-component/FUNCTION-HANDLERS.md +167 -0
  12. package/skills/wix-app/references/editor-react-component/REACT-GUIDELINES.md +2 -2
  13. package/skills/wix-base44-connector/SKILL.md +185 -0
  14. package/skills/wix-base44-connector/scripts/utils.js +212 -0
  15. package/skills/wix-design-system/SKILL.md +19 -15
  16. package/skills/wix-docs/SKILL.md +75 -1
  17. package/skills/wix-manage/SKILL.md +12 -16
  18. package/skills/wix-manage/references/domains/domain-search-purchase-and-connect.md +2603 -0
  19. package/skills/wix-manage/references/events/create-wix-event.md +112 -90
  20. package/skills/wix-manage/references/events/manage-wix-events.md +33 -94
  21. package/skills/wix-manage/references/sites/create-headless-site.md +1 -0
  22. package/skills/wix-manage/references/sites/manage-oauth-apps.md +154 -0
  23. package/skills/wix-manage/references/sites/read-site-context.md +125 -0
  24. package/skills/wix-manage/references/stores/create-product-catalog-v3.md +273 -0
  25. package/skills/wix-vibe-headless/install/deploy.cjs +1 -2
  26. package/skills/wix-vibe-headless/platforms/base44-ecom-light-seed.md +104 -0
  27. package/skills/wix-vibe-headless/platforms/base44-ecom-light.md +74 -0
  28. package/skills/wix-vibe-headless/platforms/base44.md +3 -3
  29. package/skills/wix-vibe-headless/references/blog/seed/SEED.md +1 -1
  30. package/skills/wix-vibe-headless/references/bookings/seed/SEED.md +1 -1
  31. package/skills/wix-vibe-headless/references/events/seed/SEED.md +1 -1
  32. package/skills/wix-vibe-headless/references/portfolio/seed/SEED.md +1 -1
  33. package/skills/wix-vibe-headless/references/pricing-plans/seed/SEED.md +1 -1
  34. package/skills/wix-vibe-headless/references/restaurants/seed/SEED.md +1 -1
  35. package/skills/wix-vibe-headless/references/storefront/INSTRUCTIONS.md +68 -2
  36. package/skills/wix-vibe-headless/references/storefront/app/components/ProductCard.jsx +29 -86
  37. package/skills/wix-vibe-headless/references/storefront/app/components/ProductGrid.jsx +3 -8
  38. package/skills/wix-vibe-headless/references/storefront/app/components/VariantPicker.jsx +78 -105
  39. package/skills/wix-vibe-headless/references/storefront/app/hooks/useProductCard.js +92 -0
  40. package/skills/wix-vibe-headless/references/storefront/app/hooks/useVariantOptions.js +76 -0
  41. package/skills/wix-vibe-headless/references/storefront/seed/SEED.md +1 -1
  42. package/skills/wix-app/references/AUTO_PATTERNS_DASHBOARD.md +0 -326
  43. package/skills/wix-app/references/auto-patterns-dashboard/action-cell.md +0 -115
  44. package/skills/wix-app/references/auto-patterns-dashboard/app-config-structure.md +0 -264
  45. package/skills/wix-app/references/auto-patterns-dashboard/app-context.md +0 -37
  46. package/skills/wix-app/references/auto-patterns-dashboard/bulk-actions.md +0 -86
  47. package/skills/wix-app/references/auto-patterns-dashboard/collection-page-actions.md +0 -119
  48. package/skills/wix-app/references/auto-patterns-dashboard/collection-page.md +0 -103
  49. package/skills/wix-app/references/auto-patterns-dashboard/custom-actions-override.md +0 -76
  50. package/skills/wix-app/references/auto-patterns-dashboard/custom-columns-override.md +0 -82
  51. package/skills/wix-app/references/auto-patterns-dashboard/custom-components-override.md +0 -89
  52. package/skills/wix-app/references/auto-patterns-dashboard/custom-header-override.md +0 -124
  53. package/skills/wix-app/references/auto-patterns-dashboard/custom-sections-override.md +0 -91
  54. package/skills/wix-app/references/auto-patterns-dashboard/custom-slots-override.md +0 -71
  55. package/skills/wix-app/references/auto-patterns-dashboard/entity-page-actions.md +0 -70
  56. package/skills/wix-app/references/auto-patterns-dashboard/entity-page-view-actions.md +0 -73
  57. package/skills/wix-app/references/auto-patterns-dashboard/entity-page.md +0 -98
  58. package/skills/wix-app/references/auto-patterns-dashboard/example-patterns.json +0 -278
  59. package/skills/wix-app/references/auto-patterns-dashboard/pages-configuration.md +0 -94
  60. package/skills/wix-app/references/auto-patterns-dashboard/resolved-action.md +0 -43
  61. package/skills/wix-app/references/auto-patterns-dashboard/sdk-utilities.md +0 -66
  62. package/skills/wix-app/references/auto-patterns-dashboard/views.md +0 -76
  63. package/skills/wix-app/scripts/generate-auto-patterns.js +0 -510
  64. package/skills/wix-manage/references/domains/domain-search-and-purchase.md +0 -437
  65. package/skills/wix-manage/references/stores/create-product-from-image.md +0 -1031
  66. package/skills/wix-manage/references/stores/create-product-with-options-catalog-v3.md +0 -623
  67. package/skills/wix-manage/references/stores/setup-online-store-catalog-v3.md +0 -106
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wix/agent-skills",
3
- "version": "1.16.1",
3
+ "version": "1.16.2",
4
4
  "description": "Wix Skills for AI coding agents — versioned npm distribution of the wix/skills content.",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -16,16 +16,16 @@ Helps build extensions for Wix CLI applications. Covers all extension types: das
16
16
 
17
17
  - [ ] **Step 1:** Determined extension type(s) needed
18
18
  - [ ] Asked clarifying questions if requirements were unclear
19
- - [ ] **🛑 Auto-Patterns Gate (MANDATORY):** If the use case is a single-collection CRUD admin page (table/grid + entity form), you MUST use [AUTO_PATTERNS_DASHBOARD.md](references/AUTO_PATTERNS_DASHBOARD.md). Auto-patterns is the DEFAULT; custom Dashboard Pages are the opt-out. Only fall back to Dashboard Page if a disqualifier applies: multi-collection joins, custom business logic, embedded script configuration, external API integrations, or the user explicitly requested a custom React page.
20
- - [ ] **🛑 Iteration Gate (MANDATORY):** Before editing ANY file under `src/extensions/dashboard/pages/<page>/`, check for a sibling `patterns.json`. If it exists, this is an auto-patterns page — you MUST follow [AUTO_PATTERNS_DASHBOARD.md](references/AUTO_PATTERNS_DASHBOARD.md) Part B and use the override topic-index (banners → `custom-slots-override.md`, header → `custom-header-override.md`, actions → `custom-actions-override.md`, columns → `custom-columns-override.md`, sections → `custom-sections-override.md`). Do NOT edit the page component (`<page-name>.tsx`) to add UI elements directly.
21
19
  - [ ] Checked for implicit Data Collection need — unless user provided a collection ID directly (see [Data Collection Inference](#data-collection-inference))
22
20
  - [ ] Obtained app namespace if Data Collection extension is being created
23
21
  - [ ] Determined full scoped collection IDs if Data Collection extension is being created (see [Collection ID Coordination](#collection-id-coordination))
24
22
  - [ ] Explained recommendation with reasoning
25
23
  - [ ] **Step 2:** Read extension reference file(s) for the chosen type(s) and the project-wide [CODE_QUALITY.md](references/CODE_QUALITY.md)
24
+ - [ ] **🛑 Patterns Docs Gate (MANDATORY for any dashboard page UI):** Read [WIX_PATTERNS_DOCS.md](references/WIX_PATTERNS_DOCS.md), then confirm `@wix/patterns` is in the project's `package.json` (install it if absent) and enumerate the real component list with `cat node_modules/@wix/patterns/dist/docs/index.json`. Do this BEFORE writing any JSX. You cannot apply [Component Selection Order](#component-selection-order) without the component list in front of you — skipping this step is why a page ends up built entirely from WDS.
26
25
  - [ ] **Step 3:** Checked API references; used MCP discovery only for gaps
27
26
  - [ ] **Step 4a:** Scaffolded each CLI-supported extension via `wix generate --params`
28
27
  - [ ] **Step 4b:** Filled in business logic in the generated files
28
+ - [ ] **🛑 Component Selection Gate (MANDATORY, dashboard UI only):** For every UI element on a Dashboard Page, resolved it against `@wix/patterns` BEFORE reaching for `@wix/design-system` — and never hand-rolled a component either library already provides. See [Component Selection Order](#component-selection-order).
29
29
  - [ ] Invoked `wix-design-system` skill ONLY before editing the first `.tsx`/`.jsx` file that imports `@wix/design-system`. Skip for backend-only or data-only extensions.
30
30
  - [ ] WDS: imported `@wix/design-system/styles.global.css` in the main component entry file (`page.tsx`, modal `.tsx`, etc.) — not child/tab/helper files.
31
31
  - [ ] **Step 5:** Ran validation (see [Validation](#validation))
@@ -48,8 +48,9 @@ Helps build extensions for Wix CLI applications. Covers all extension types: das
48
48
  | Using MCP discovery without checking refs | Check reference files first |
49
49
  | Reporting done without validation | Always run validation at the end |
50
50
  | Letting manual action items get buried | Aggregate all manual steps at the very end |
51
- | Writing custom React for single-collection CRUD when auto-patterns applies | Default to [AUTO_PATTERNS_DASHBOARD.md](references/AUTO_PATTERNS_DASHBOARD.md) for CRUD admin pages |
52
- | Editing the page component (`<page-name>.tsx`) to add UI (banners, headers, custom actions, slots, sections) when `patterns.json` exists | Use the matching `custom-*-override.md` from [AUTO_PATTERNS_DASHBOARD.md](references/AUTO_PATTERNS_DASHBOARD.md) Part B |
51
+ | 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)) |
52
+ | Guessing a `@wix/patterns` or WDS component/prop name from memory | Look it up: patterns docs in `node_modules/@wix/patterns/dist/docs/`, WDS via the `wix-design-system` skill |
53
+ | 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 |
53
54
 
54
55
  ---
55
56
 
@@ -68,8 +69,7 @@ Helps build extensions for Wix CLI applications. Covers all extension types: das
68
69
 
69
70
  3. **Where will it appear?**
70
71
  - Dashboard sidebar/page →
71
- - **Single-collection CRUD admin (default, MANDATORY):** [Auto Patterns Dashboard](references/AUTO_PATTERNS_DASHBOARD.md) — declarative `patterns.json`, faster to author, iterate by editing JSON, no React rewrite.
72
- - Custom logic / multi-collection / embedded scripts / external APIs: Dashboard Page
72
+ - Full admin screen: Dashboard Page — UI built with `@wix/patterns` + `@wix/design-system` (see [Component Selection Order](#component-selection-order))
73
73
  - Popup/form: Dashboard Modal
74
74
  - Existing Wix app dashboard (widget) → Dashboard Plugin
75
75
  - Existing Wix app dashboard (menu item) → Dashboard Menu Plugin
@@ -82,12 +82,75 @@ Helps build extensions for Wix CLI applications. Covers all extension types: das
82
82
 
83
83
  ## Decision Flow (Not sure?)
84
84
 
85
- - **Admin:** Single-collection CRUD admin page? → **Auto Patterns Dashboard (DEFAULT)**. Custom React page (multi-collection / custom logic / embedded scripts / external APIs / explicit user request)? → Dashboard Page. 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()`.
85
+ - **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()`.
86
86
  - **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 data? → Data Collection.
87
87
  - **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.
88
88
 
89
89
  ---
90
90
 
91
+ ## Component Selection Order
92
+
93
+ Dashboard pages at Wix are built from two libraries. For **every** UI element, resolve in this order and stop at the first hit. Never skip a step, and never decide a component is missing from memory — check.
94
+
95
+ ### 1. `@wix/patterns` — page structure and data collections
96
+
97
+ Patterns owns the page shell and everything collection-shaped. These concepts are patterns' territory — if you need one, look it up there first rather than assembling it from WDS parts:
98
+
99
+ | Need | Look for |
100
+ | --- | --- |
101
+ | Page shell, header, content area, sticky footer | `CollectionPage`, `EntityPage`, `SettingsPage` (+ their `.Header` / `.Content` sub-parts) |
102
+ | Table, grid, table↔grid switch, folder views | `Table`, `Grid`, `TableGridSwitch`, `TableFolders`, `GridFolders` |
103
+ | Collection state — paging, sorting, selection, loading | `useTableCollection()` and its sibling hooks (one per collection type) |
104
+ | Filters, search, sorting, view presets/tabs | the collection's filter and view APIs |
105
+ | Row actions, bulk actions, drag-and-drop | the collection's feature APIs |
106
+ | Multiple pages inside one extension | `PatternsReactRouter`, `PatternsReactRoute`, `usePatternsNavigate` |
107
+ | **Add / edit / view one item from a collection** | `EntityPage` + `useEntityPage` (fetch + save + validation), reached with `usePatternsNavigate().navigateToEntityPage`. Form state via `useForm` / `useController` from `@wix/patterns/form`. **Not** a dashboard modal — see [Entity create and edit](#entity-create-and-edit) |
108
+ | Overlays tied to a collection (item picker, bulk-action confirm) | `PickerModal` / `usePickerModal`, `bulkActionModal` |
109
+
110
+ **Confirm every name and prop against the generated docs — do not guess:**
111
+
112
+ ```bash
113
+ cat node_modules/@wix/patterns/dist/docs/index.json
114
+ ```
115
+
116
+ If that path does not exist, `@wix/patterns` is missing or too old — add it (`^1.367.0` or later ships `dist/docs/`) and re-read. **A missing docs folder is not a reason to fall through to step 2**; it means the lookup has not happened yet. Falling through here is the single most common way a dashboard page ends up built entirely from WDS.
117
+
118
+ `index.json` maps component name → doc file + category; doc filenames match component names (`Table.md`, `useTableCollection.md`). Full lookup workflow, provider selection, and the provider/page separation rule: [WIX_PATTERNS_DOCS.md](references/WIX_PATTERNS_DOCS.md).
119
+
120
+ ### 2. `@wix/design-system` — everything inside the shell
121
+
122
+ The leaf-level UI patterns does not own: inputs, buttons, form fields, text, layout primitives, cards, badges, tooltips, toasts, icons. Pick the component by lookup, not recall — invoke the **`wix-design-system` skill**, whose bundled helper reads the installed package:
123
+
124
+ ```bash
125
+ node <wix-design-system-skill-dir>/scripts/wds.cjs search <keyword>
126
+ node <wix-design-system-skill-dir>/scripts/wds.cjs component <Name>
127
+ ```
128
+
129
+ ### 3. Custom React — only after both came back empty
130
+
131
+ Compose from WDS layout primitives (`Box`, `Card`, `Text`). Do not add a third UI dependency, and do not restyle patterns or WDS internals.
132
+
133
+ ### Overlaps and scope
134
+
135
+ - When both libraries ship the same concept (page header, page container), the **patterns** one wins inside a patterns page — it is the piece wired into the shell's layout and collection state. Use the WDS equivalent only outside a patterns page shell.
136
+ - **Patterns has its own overlays.** `PickerModal` / `usePickerModal` and `bulkActionModal` cover collection-related overlays. "It's a modal" is not a reason to leave patterns.
137
+ - **Dashboard Plugins** render outside a patterns page shell, so WDS is the default there. Patterns collection components still apply when such a surface displays a data collection.
138
+
139
+ ### Entity create and edit
140
+
141
+ **Adding, editing, or viewing a single item from a collection page is an `EntityPage` — not a Dashboard Modal.** This is the most common place the selection order gets dropped: the collection gets built correctly with patterns, then the "add item" flow is hand-built as a WDS form in a modal.
142
+
143
+ The documented flow:
144
+
145
+ 1. From the collection page's action cell or primary action, call `navigateToEntityPage({ path, entity })` from `usePatternsNavigate()`. (The patterns docs give this exact use case — "navigate to an entity page on an action cell click on a collection page" — and it renders the entity header immediately, before the fetch resolves.)
146
+ 2. Register the route with `PatternsReactRoute` inside `PatternsReactRouter`.
147
+ 3. In the entity page, `useEntityPage({ fetch, onSave })` owns fetching, saving, validation, dirty state, loading skeletons, and error states. Form state comes from `useForm` / `useController` in `@wix/patterns/form`.
148
+ 4. Compose the body from `EntityPage.Header`, `EntityPage.MainContent`, `EntityPage.AdditionalContent`, and `EntityPage.Card`. **WDS goes inside those cards** — `FormField`, `Input`, `Text` for the individual fields.
149
+
150
+ Use a Dashboard Modal only for dialogs that are genuinely not entity editing: a delete confirmation, a short prompt, an unrelated popup. Reach for it because the interaction is a true dialog, never because "the form should open in a modal."
151
+
152
+ ---
153
+
91
154
  ## Extension Types Reference Table
92
155
 
93
156
  | Extension Type | Category | `extensionType` (for `wix generate --params`) | Reference File |
@@ -130,7 +193,7 @@ Helps build extensions for Wix CLI applications. Covers all extension types: das
130
193
  | App Identifiers (Namespace, Code ID) | [APP_IDENTIFIERS.md](references/APP_IDENTIFIERS.md) |
131
194
  | Wix Stores Versioning (V1/V3) | [STORES_VERSIONING.md](references/STORES_VERSIONING.md) |
132
195
  | Official Documentation Links | [DOCUMENTATION.md](references/DOCUMENTATION.md) |
133
- | Auto-patterns Dashboard Pages | [AUTO_PATTERNS_DASHBOARD.md](references/AUTO_PATTERNS_DASHBOARD.md) |
196
+ | Wix Patterns Dashboard Pages | [WIX_PATTERNS_DOCS.md](references/WIX_PATTERNS_DOCS.md) |
134
197
 
135
198
  ---
136
199
 
@@ -358,6 +421,7 @@ Stop and report errors if any step fails. Check `.wix/debug.log` on failures.
358
421
  - **maxResults: 5** for all MCP SDK searches
359
422
  - **ReadFullDocsMethodSchema** for SDK method schemas; **ReadFullDocsArticle** for prose guides only
360
423
  - **Invoke wix-design-system** first when using WDS (prevents import errors)
424
+ - **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))
361
425
 
362
426
  ## Documentation
363
427
 
@@ -26,7 +26,6 @@ Applies to all generated code across every Wix CLI app extension type. Each per-
26
26
 
27
27
  - If a generated file would exceed ~300 lines, split it into multiple smaller files with imports. Each component or function should stay ~50–100 lines.
28
28
  - Extract utilities/helpers into separate files; put types/interfaces into dedicated type files.
29
- - **Exception — auto-patterns override files** (column / action / slot / section / component / header overrides) ALWAYS live in their own file under `components/<type>/` with a `use*` hook, **regardless of file size**. This is a structural requirement of the override-registration model, not a size-based split — the ~300-line rule does NOT license inlining an override into the page component, even for a single small one. See [AUTO_PATTERNS_DASHBOARD.md](AUTO_PATTERNS_DASHBOARD.md).
30
29
 
31
30
  ## Error Handling
32
31
 
@@ -3,6 +3,8 @@
3
3
 
4
4
  Dashboard modals are popup dialogs triggered from dashboard pages or plugins. They use the Dashboard SDK for lifecycle control via `openModal()` and `closeModal()`.
5
5
 
6
+ > **🛑 Scope — genuine dialogs only.** Use a dashboard modal for delete/discard confirmations, short prompts, and dialogs unrelated to editing a collection item. **Adding, editing, or viewing a collection item is NOT a modal** — that is a `@wix/patterns` `EntityPage` reached via `usePatternsNavigate().navigateToEntityPage`. See [Entity create and edit](../SKILL.md#entity-create-and-edit) and [WIX_PATTERNS_DOCS.md](WIX_PATTERNS_DOCS.md).
7
+
6
8
  ## Scaffold
7
9
 
8
10
  Use `wix generate --params` with all required fields:
@@ -106,29 +108,34 @@ export default {
106
108
 
107
109
  ## Real-World Example
108
110
 
109
- End-to-end edit-item flow. The scaffolded `<modal>.tsx` already wires up `CustomModalLayout` — the unique parts are on the opener side, in `observeState`, and in the save handler.
111
+ End-to-end delete-confirmation flow. The scaffolded `<modal>.tsx` already wires up `CustomModalLayout` — the unique parts are on the opener side, in `observeState`, and in the confirm handler.
110
112
 
111
113
  ```typescript
112
- // Dashboard Page: open the modal with the item to edit
113
- const handleEdit = (item: Item) => {
114
- dashboard.openModal({
115
- modalId: "edit-item-modal-guid",
116
- params: { item }, // objects are passed directly via params
114
+ // Dashboard Page: open the modal with the item to delete, act on the result
115
+ const handleDelete = async (item: Item) => {
116
+ const { modalClosed } = dashboard.openModal({
117
+ modalId: "confirm-delete-modal-guid",
118
+ params: { itemId: item.id, itemName: item.name }, // objects are passed directly via params
117
119
  });
120
+ // `modalClosed` resolves as `Serializable` (a union) and `openModal` takes no type
121
+ // parameter, so narrow it to the shape this modal's own close payload uses.
122
+ const result = (await modalClosed) as { confirmed?: boolean } | undefined;
123
+ if (result?.confirmed) {
124
+ // ...your delete logic + collection refresh...
125
+ }
118
126
  };
119
127
 
120
- // Modal: read params, save, toast, close
121
- const [formData, setFormData] = useState<Item | null>(null);
128
+ // Modal: read params, confirm or cancel
129
+ const [itemName, setItemName] = useState<string | null>(null);
122
130
 
123
131
  useEffect(() => {
124
132
  dashboard.observeState((state) => {
125
- if (state.item) setFormData(state.item);
133
+ if (state.itemName) setItemName(state.itemName);
126
134
  });
127
135
  }, []);
128
136
 
129
- const handleSave = async () => {
130
- // ...your save logic...
131
- dashboard.showToast({ message: "Saved!", type: "success" });
132
- dashboard.closeModal();
133
- };
137
+ const handleConfirm = () => dashboard.closeModal({ confirmed: true });
138
+ const handleCancel = () => dashboard.closeModal({ confirmed: false });
134
139
  ```
140
+
141
+ (Editing the item itself would be an `EntityPage`, not a modal — see the scope note at the top.)
@@ -1,11 +1,17 @@
1
-
2
1
  # Wix Dashboard Page Builder
3
2
 
4
- > **🛑 STOP — Read this first.**
5
- > If this page is a single-collection CRUD admin (table/grid view + entity form, no multi-collection joins, no custom business logic, no embedded scripts, no external APIs), STOP and use [AUTO_PATTERNS_DASHBOARD.md](AUTO_PATTERNS_DASHBOARD.md) instead. Auto-patterns is the default; this file documents the custom React variant for cases auto-patterns cannot handle, or when the user explicitly requested a custom React page.
6
-
7
3
  Dashboard pages appear in the site owner's Wix dashboard and enable site administrators to manage data, configure settings, and perform admin tasks.
8
4
 
5
+ ## UI Libraries — Read Before Writing Any JSX
6
+
7
+ At Wix, dashboard pages are built from `@wix/patterns` and `@wix/design-system`, in that order of preference:
8
+
9
+ 1. **`@wix/patterns` first** — page shells (`CollectionPage`, `EntityPage`, `SettingsPage`), tables/grids, collection state hooks, filters, sorting, row and bulk actions, in-extension routing. Look every name up in the generated docs at `node_modules/@wix/patterns/dist/docs/` (start with `index.json`). See [WIX_PATTERNS_DOCS.md](WIX_PATTERNS_DOCS.md).
10
+ 2. **`@wix/design-system` second** — the leaf UI inside that shell (inputs, buttons, form fields, text, layout, cards, badges, icons). Choose components via the `wix-design-system` skill.
11
+ 3. **Custom React last** — only when neither library has it.
12
+
13
+ Do not hand-write React for anything either library already provides, and do not decide a component is missing without checking. Full rule: [SKILL.md → Component Selection Order](../SKILL.md#component-selection-order).
14
+
9
15
  ## Scaffold
10
16
 
11
17
  Use `wix generate --params` with all required fields:
@@ -21,6 +27,14 @@ wix generate --params '{"extensionType":"DASHBOARD_PAGE","title":"<title>","rout
21
27
 
22
28
  The CLI generates the folder, `page.tsx`, the builder file, the UUID, and the `src/extensions.ts` registration. After scaffolding, implement the page UI in the generated `page.tsx`.
23
29
 
30
+ **Then, before writing UI:** confirm `@wix/patterns` is a dependency and its docs are present.
31
+
32
+ ```bash
33
+ ls node_modules/@wix/patterns/dist/docs/index.json
34
+ ```
35
+
36
+ If it's missing, add the package (`^1.367.0` or later — earlier versions don't ship `dist/docs/`) and install. Without this, the patterns lookup in step 1 of [Component Selection Order](../SKILL.md#component-selection-order) silently finds nothing and the page gets built entirely from WDS.
37
+
24
38
  ## Capabilities
25
39
 
26
40
  ### Data Operations (Wix Data SDK)
@@ -54,14 +68,16 @@ See [Dashboard API Reference](dashboard-page/DASHBOARD_API.md) for complete docu
54
68
 
55
69
  **CRITICAL: Using Modals in Dashboard Pages**
56
70
 
57
- When you need to display popup forms, confirmations, detail views, or any dialog overlays from a dashboard page, you **MUST** use dashboard modals, not regular React modals or WDS Modal components.
71
+ Dashboard Pages cannot use `<Modal />`. When you need a true dialog overlay, you **MUST** use a dashboard modal extension — not a React modal and not the WDS `Modal` component.
58
72
 
59
- - **Use dashboard modals** for: edit forms, delete confirmations, detail views, settings dialogs, any popup content
73
+ - **Use dashboard modals** for: delete/discard confirmations, short prompts, and dialogs unrelated to editing a collection item
60
74
  - **Do NOT use** WDS `Modal` component or custom React modal implementations
61
75
  - **See [Dashboard Modal reference](DASHBOARD_MODAL.md)** for complete implementation guide
62
76
 
63
77
  Dashboard modals are opened using `dashboard.openModal()` and provide proper integration with the dashboard lifecycle, state management, and navigation.
64
78
 
79
+ > **🛑 Exception — adding, editing, or viewing a collection item is NOT a modal.** That is an `EntityPage` from `@wix/patterns`, reached via `usePatternsNavigate().navigateToEntityPage`, with `useEntityPage` owning fetch/save/validation and `@wix/patterns/form` owning form state. Do not hand-build the entity form as a WDS form inside a dashboard modal — that is the single most common way the patterns-first rule gets dropped after the table is already correct. See [Entity create and edit](../SKILL.md#entity-create-and-edit) and [WIX_PATTERNS_DOCS.md](WIX_PATTERNS_DOCS.md).
80
+
65
81
  **Ecom Navigation:** See [Ecom Navigation Reference](dashboard-page/ECOM_NAVIGATION.md) for ecom-specific navigation helpers.
66
82
 
67
83
  ### Embedded Script Configuration API
@@ -77,29 +93,31 @@ When building a dashboard page to configure an embedded script, see [Dynamic Par
77
93
 
78
94
  ## Examples
79
95
 
96
+ Each output below names the library that owns each part. Confirm every patterns component and prop in `node_modules/@wix/patterns/dist/docs/` before use — these examples name the shape, not a verified API.
97
+
80
98
  ### Data Management Table
81
99
 
82
100
  **Request:** "Create a dashboard page to manage blog posts"
83
101
 
84
- **Output:** Page with table displaying posts, search toolbar, add/edit/delete actions, empty state.
102
+ **Output:** A `@wix/patterns` `CollectionPage` shell wrapping a `Table` driven by a collection state hook (`useTableCollection`), with the search, add/edit/delete row actions, and empty state supplied by the collection's own APIs. Add and edit navigate to an `EntityPage` (`navigateToEntityPage` + `useEntityPage`). WDS only for the leaf UI inside cells and the fields inside the entity page's cards. The provider lives in a parent component, in a separate file from the hook call.
85
103
 
86
104
  ### Settings Form
87
105
 
88
106
  **Request:** "Build a settings page for notification preferences"
89
107
 
90
- **Output:** Page with form fields, save button with toast confirmation, unsaved changes warning.
108
+ **Output:** A `@wix/patterns` `SettingsPage` shell. WDS form fields inside it (`FormField`, `Input`, `ToggleSwitch`), save button with `dashboard.showToast()` confirmation, and `dashboard.onBeforeUnload()` for the unsaved-changes warning. No collection here, so no table hook.
91
109
 
92
110
  ### Order Management
93
111
 
94
112
  **Request:** "Create an admin panel for customer orders"
95
113
 
96
- **Output:** Page with orders table, status badges, filters, detail dashboard modal (using [Dashboard Modal reference](DASHBOARD_MODAL.md)), status update actions.
114
+ **Output:** A `@wix/patterns` `CollectionPage` + `Table`, with filters, sorting, and row actions from the collection APIs — **not** a hand-built WDS filter bar. Status badges are WDS leaf UI inside a cell. Viewing or editing an order opens an `EntityPage` via `usePatternsNavigate().navigateToEntityPage` — not a modal (see [Entity create and edit](../SKILL.md#entity-create-and-edit)). A Dashboard Modal appears only for the delete confirmation.
97
115
 
98
116
  ### Embedded Script Configuration
99
117
 
100
118
  **Request:** "Create a settings page for the coupon popup embedded script"
101
119
 
102
- **Output:** Page with form fields for popup headline, coupon code, minimum cart value, and enable toggle. Uses `embeddedScripts` API to load/save parameters.
120
+ **Output:** A `@wix/patterns` `SettingsPage` shell with WDS form fields for popup headline, coupon code, minimum cart value, and enable toggle. Uses `embeddedScripts` API to load/save parameters.
103
121
 
104
122
  ```typescript
105
123
  // Key pattern for embedded script configuration pages
@@ -140,178 +158,6 @@ When an API specification is provided, you can make API calls to those endpoints
140
158
 
141
159
  ## Layout Guidelines
142
160
 
143
- Layout determines how users interact with your dashboard content. It establishes the structure, hierarchy, and rhythm of your dashboard page, contributing to the overall coherence and user experience. By making mindful and calculated choices in how you organize your content, users can move around more smoothly, saving time and frustration when completing tasks.
144
-
145
- ### Design Principles
146
-
147
- To create dashboard pages optimized for user experience, follow these design principles:
148
-
149
- 1. **Consistent:** Maintain repetitive layouts and content patterns for intuitive and easy-to-read pages.
150
- 2. **Inclusive:** Create layouts and content that adapt well to various screen sizes.
151
- 3. **Balanced:** Emphasize the priority of regions and content elements through deliberate management of size and white space.
152
- 4. **Connected:** Minimize the distance between related regions or content elements to enhance cohesion and navigation.
153
-
154
-
155
- ### Screen Size
156
-
157
- Dashboard pages are designed to accommodate various screen sizes rather than being tailored to one specific resolution. The primary content should be at the top of the page to ensure users immediately understand the purpose of the page.
158
-
159
- > **Note:** Content displayed in the top 600 pixels of the page will be visible for the majority of users.
160
-
161
-
162
- ### Base Unit
163
-
164
- The base unit establishes the increment by which all elements and measurements are multiplied. This practice ensures consistency in the spacing and sizing of design elements.
165
-
166
- > **Note:** The design system is based on a 6px unit.
167
-
168
- The layout grid, spacing tokens, and nearly all visual elements and sizes adhere to multiples of six (6, 12, 18, 24, etc.), with only occasional exceptions.
169
-
170
- | TOKEN | SIZE | USE FOR |
171
- |-------|------|---------|
172
- | SP1 | 6px | Spacing between components |
173
- | SP2 | 12px | Spacing between components |
174
- | SP3 | 18px | Spacing between components |
175
- | SP4 | 24px | Spacing between components, layout spacing |
176
- | SP5 | 30px | Layout spacing |
177
- | SP6 | 36px | Layout spacing |
178
- | SP7 | 42px | Layout spacing |
179
- | SP8 | 48px | Layout spacing |
180
- | SP10 | 54px | Layout spacing |
181
- | SP11 | 60px | Layout spacing |
182
-
183
-
184
- ### Layout Structure
185
-
186
- To best design the layout for your app, understand:
187
-
188
- 1. The core frame of the app (Application frame)
189
- 2. The placement and alignment of each segment within the grid layout (Grid layout)
190
- 3. The content to appear in the grid (Common layouts)
191
-
192
- #### Application Frame
193
-
194
- The dashboard app frame is used by the majority of Wix applications settings. Dashboard pages consist of 4 areas:
195
-
196
- | AREA | USAGE |
197
- |------|-------|
198
- | 1. Global navigation (top bar) | General navigation at the top of a page which allows users to navigate between different environments. Full width container with a fixed height of 48px. |
199
- | 2. Sidebar navigation | Local navigation of an environment. Container with a fixed width of 228px. |
200
- | 3. Content area | Page content area with a width that's adaptive to screen size. |
201
- | 4. Side panel (optional) | An optional panel that shows additional actions or content associated with the content of a page. Fixed width of 420px. Can either overlay the main content area or push it from the right side. |
202
-
203
- **Side Panel Guidelines:**
204
- - Let the side panel overlay main content when it contains supplementary actions or settings, such as data filters
205
- - Push main content with the side panel when users must see the full context to continue
206
-
207
-
208
- #### Grid Layout
209
-
210
- The system uses a fluid grid layout with a fixed maximum width. It uses columns that scale and resize the content accordingly.
211
-
212
- The grid is constructed from 3 elements:
213
- - **Columns** - The design system uses a 12-column grid. Column width is fluid and changes according to the page width.
214
- - **Gutters** - The gaps between the columns. Gutter width has a fixed value of 24px.
215
- - **Margins** - By default, a page's content area has 48px side margins and a 48px bottom margin.
216
-
217
- **Grid Specifications:**
218
- - Minimum content area width: 864 pixels (each grid column is 50px wide)
219
- - Maximum content area width: 1248px (each column is 82px wide)
220
- - Wider screens maintain 1248px content width with side margins stretching to center content
221
- - Use 24px gap between cards both vertically and horizontally
222
-
223
-
224
- ### Common Layouts
225
-
226
- Page layouts can be divided by intention into the following types:
227
-
228
- #### 1. Form Layouts
229
-
230
- Forms are pages that allow users to fill in data or edit existing data. Two variations:
231
-
232
- - **2/3 layout with optional sidebar (8/4 column split)** - Provides flexibility to expose primary and secondary content at the same time
233
- - **Full width (12 columns)** - Supports advanced product needs with complex structures
234
-
235
- Both form page layouts include mandatory **Save** and **Cancel** actions in the header and footer areas.
236
-
237
- **2/3 Layout Best Practices:**
238
- - Use to expose primary and secondary content at the same time
239
- - Keep the form easy to scan and comprehend
240
- - Display a live content preview on the side (widget can be sticky)
241
- - Use 8 columns for forms to keep text lines and input fields narrow for quicker reading
242
- - Bring actions closer to related titles (e.g., toggle switches near settings)
243
-
244
- **Full Width Layout Best Practices:**
245
- - Use when a form includes complex structures such as tables
246
- - Use for list items that contain many data columns
247
-
248
- **Combining Layouts:**
249
- - Avoid coast-to-coast inputs; keep inputs to 2/3 width of a card, or lay them out in two columns
250
- - Use white space on the right side for content preview
251
- - Use full width for tables with many columns and dividers that separate sections
252
-
253
- > **Note:** A column is easy to read if it is wide enough to accommodate an average of 10 words per line.
254
-
255
- #### 2. Display Layouts
256
-
257
- Display pages showcase data or content without accepting input from users. They can contain minor actions such as data filtering.
258
-
259
- **List (Table):**
260
- - Tables display large data sets and provide users with a quick overview
261
- - Use a 12-column layout for tables
262
- - Enables users to manipulate and act on a data set
263
-
264
- **List (Grid) Options:**
265
- - 2 columns (6/6 split) - For items with lengthy descriptions
266
- - 3 columns (4/4/4 split) - For visual items with multiple data types
267
- - 4 columns (3/3/3/3 split) - For user-generated galleries and collections, reveals up to 50% more content above the fold than 4/4/4
268
- - Custom - For mixed content needs
269
-
270
- **Grid Selection Considerations:**
271
- - Total amount of items to show
272
- - Content to display in each list item
273
- - What objects the list items reflect (match physical shapes when applicable)
274
-
275
- **Dashboards:**
276
- Display different types of data on a specific topic using a combination grid.
277
-
278
- Column span recommendations:
279
- - **3 or 4 columns** - For list items, previews, marketing, statistics, and charts
280
- - **12 columns (full width)** - For tables and marketing content
281
- - **8 columns** - For lists, tables with few data columns, setup wizards, and charts
282
- - **6 columns** - For lists, tables with few data columns, and statistics
283
-
284
- **Empty States:**
285
- - Use full width layout for empty state of a page
286
- - Indicates feature/product has no data yet, all data cleared, or not set up yet
287
- - Include clear CTA indicating what to do to fill the page
288
- - Can combine with other layout elements such as tabs, statistics widgets, or marketing cards
289
-
290
- #### 3. Marketing Layouts
291
-
292
- Marketing pages promote new products that site owners are not aware of yet. Built using the `<MarketingPageLayout/>` component split into 2 columns:
293
-
294
- 1. Promo messaging
295
- 2. Visual representation of product and features
296
-
297
- Optional footer area can display features or testimonials list.
298
-
299
- #### 4. Wizard Layouts
300
-
301
- Wizard pages guide users through setting up a product or feature. They split complex forms into steps for easier completion.
302
-
303
- **Entry Points:**
304
- - A marketing page
305
- - A marketing card
306
- - The primary action of a page
307
- - An empty state
308
-
309
- > **Note:** Wizards must have a final destination. After completing all steps, users should end up on a relevant page: a dashboard, a details page, or any other relevant location.
310
-
311
-
312
- ### Related WDS Components
161
+ Content layout inside the page shell — the 6px base unit, the 12-column grid, spacing tokens, form/display/marketing/wizard layouts: see [WDS Layout Reference](dashboard-page/WDS_LAYOUT.md).
313
162
 
314
- - `<Page />` - Main page wrapper
315
- - `<Layout />` - Grid layout container
316
- - `<MarketingPageLayout />` - Marketing page wrapper
317
- - `<Card />` - Content container with 24px gaps between cards
163
+ Remember the split: `@wix/patterns` owns the page shell and anything collection-shaped (tables, grids, filters, sorting, empty states); that reference covers the content you place inside it.
@@ -118,6 +118,7 @@ Topic-focused references (rules + patterns + common mistakes in one place):
118
118
  - [`editor-react-component/DIRECTIONALITY.md`](editor-react-component/DIRECTIONALITY.md) — RTL/LTR rules and patterns
119
119
  - [`editor-react-component/PROPS-VS-CSS.md`](editor-react-component/PROPS-VS-CSS.md) — What should be a React prop vs CSS
120
120
  - [`editor-react-component/COMPONENT-API.md`](editor-react-component/COMPONENT-API.md) — Props structure, elementProps, data types, file splitting, containers, array props
121
+ - [`editor-react-component/FUNCTION-HANDLERS.md`](editor-react-component/FUNCTION-HANDLERS.md) — Standard SDK event handler props, DOM wiring, custom callbacks
121
122
  - [`editor-react-component/ANIMATED-COMPONENTS.md`](editor-react-component/ANIMATED-COMPONENTS.md) — Play/pause control and autoplay for animated/playable components
122
123
  - [`editor-react-component/COMPONENT-PREVIEW.md`](editor-react-component/COMPONENT-PREVIEW.md) — Editor-specific entry point (`component.preview.tsx`), `useIsEditMode()`, when to modify
123
124
  - [`editor-react-component/SITE-CONTEXT-HOOKS.md`](editor-react-component/SITE-CONTEXT-HOOKS.md) — Hooks for runtime site context (site pages, current URL, language direction, editor mode) — read only when a trigger above applies