@wix/agent-skills 1.6.0 → 1.7.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 +2 -2
- package/package.json +1 -1
- package/skills/wix-app/SKILL.md +49 -42
- package/skills/wix-app/references/BACKEND_EVENT.md +10 -65
- package/skills/wix-app/references/CUSTOM_ELEMENT_WIDGET.md +101 -406
- package/skills/wix-app/references/DASHBOARD_MENU_PLUGIN.md +14 -111
- package/skills/wix-app/references/DASHBOARD_MODAL.md +56 -205
- package/skills/wix-app/references/DASHBOARD_PAGE.md +19 -98
- package/skills/wix-app/references/DASHBOARD_PLUGIN.md +6 -108
- package/skills/wix-app/references/DATA_COLLECTION.md +113 -198
- package/skills/wix-app/references/EMBEDDED_SCRIPT.md +41 -268
- package/skills/wix-app/references/EXTENSION_REGISTRATION.md +27 -76
- package/skills/wix-app/references/SERVICE_PLUGIN.md +35 -188
- package/skills/wix-app/references/SITE_PLUGIN.md +8 -92
- package/skills/wix-app/references/backend-event/COMMON-EVENTS.md +0 -44
- package/skills/wix-app/references/custom-element-widget/SETTINGS_PANEL.md +19 -330
- package/skills/wix-app/references/dashboard-menu-plugin/bookings-slots.md +0 -12
- package/skills/wix-app/references/dashboard-menu-plugin/ecommerce-slots.md +7 -0
- package/skills/wix-app/references/dashboard-menu-plugin/restaurants-slots.md +0 -12
- package/skills/wix-app/references/dashboard-plugin/SLOTS.md +3 -15
- package/skills/wix-app/references/service-plugin/ADDITIONAL-FEES.md +2 -18
- package/skills/wix-app/references/service-plugin/BOOKINGS-STAFF-SORTING.md +2 -42
- package/skills/wix-app/references/service-plugin/DISCOUNT-TRIGGERS.md +1 -11
- package/skills/wix-app/references/service-plugin/GIFT-CARDS.md +1 -11
- package/skills/wix-app/references/service-plugin/PAYMENT-SETTINGS.md +2 -40
- package/skills/wix-app/references/service-plugin/SHIPPING-RATES.md +2 -19
- package/skills/wix-app/references/service-plugin/VALIDATIONS.md +2 -18
- package/skills/wix-app/references/site-plugin/SLOTS.md +17 -68
- package/skills/wix-headless/SKILL.md +111 -389
- package/skills/wix-headless/references/BUILD.md +307 -0
- package/skills/wix-headless/references/DESIGN_SYSTEM.md +115 -0
- package/skills/wix-headless/references/DISCOVERY.md +237 -112
- package/skills/wix-headless/references/PLAN.md +82 -0
- package/skills/wix-headless/references/SEED.md +205 -0
- package/skills/wix-headless/references/SETUP.md +140 -134
- package/skills/wix-headless/references/astro/COMPOSE.md +142 -0
- package/skills/wix-headless/references/{blog → astro/blog}/BLOG_PAGES.md +1 -1
- package/skills/wix-headless/references/{blog → astro/blog}/BLOG_SETUP.md +2 -2
- package/skills/wix-headless/references/astro/cms/CMS_FOUNDATIONS.md +214 -0
- package/skills/wix-headless/references/{cms → astro/cms}/FAQ_KNOWLEDGE_BASE.md +6 -4
- package/skills/wix-headless/references/{cms → astro/cms}/PORTFOLIO.md +5 -5
- package/skills/wix-headless/references/{cms → astro/cms}/RESOURCE_LIBRARY.md +5 -5
- package/skills/wix-headless/references/{cms → astro/cms}/TEAM_DIRECTORY.md +5 -5
- package/skills/wix-headless/references/astro/designer/INSTRUCTIONS.md +331 -0
- package/skills/wix-headless/references/{ecom → astro/ecom}/CART_PAGES.md +1 -1
- package/skills/wix-headless/references/{ecom → astro/ecom}/CART_WIRING.md +1 -1
- package/skills/wix-headless/references/{ecom → astro/ecom}/COMPONENTS_CSS.md +3 -3
- package/skills/wix-headless/references/{forms → astro/forms}/CONTACT_FORM.md +13 -13
- package/skills/wix-headless/references/{gift-cards → astro/gift-cards}/COMPONENTS.md +1 -1
- package/skills/wix-headless/references/{gift-cards → astro/gift-cards}/PAGES.md +1 -1
- package/skills/wix-headless/references/{stores → astro/stores}/BACK_IN_STOCK.md +1 -1
- package/skills/wix-headless/references/{stores → astro/stores}/CATEGORY_PAGES.md +12 -13
- package/skills/wix-headless/references/{stores → astro/stores}/COMPONENTS_CSS.md +4 -4
- package/skills/wix-headless/references/{stores → astro/stores}/HOME_AND_NAV.md +11 -9
- package/skills/wix-headless/references/{stores → astro/stores}/PRODUCT_PAGES.md +5 -3
- package/skills/wix-headless/references/{stores → astro/stores}/SHARED_WIRING.md +3 -3
- package/skills/wix-headless/references/astro/templates/Footer.astro +27 -0
- package/skills/wix-headless/references/astro/templates/Layout.astro +132 -0
- package/skills/wix-headless/references/astro/templates/Navigation.astro +38 -0
- package/skills/wix-headless/references/astro/templates/astro.config.mjs +41 -0
- package/skills/wix-headless/references/astro/templates/ecom/components-ecom.css +302 -0
- package/skills/wix-headless/references/astro/templates/global.css +286 -0
- package/skills/wix-headless/references/astro/templates/index.astro +56 -0
- package/skills/wix-headless/{templates → references/astro/templates}/stores/back-in-stock.ts +1 -1
- package/skills/wix-headless/{templates → references/astro/templates}/stores/components-stores.css +138 -33
- package/skills/wix-headless/references/blog/BLOG_CONTENT.md +10 -11
- package/skills/wix-headless/references/blog/INSTRUCTIONS.md +5 -5
- package/skills/wix-headless/references/cms/CMS_FOUNDATIONS.md +31 -230
- package/skills/wix-headless/references/cms/INSTRUCTIONS.md +13 -8
- package/skills/wix-headless/references/custom/INSTRUCTIONS.md +38 -0
- package/skills/wix-headless/references/ecom/INSTRUCTIONS.md +10 -10
- package/skills/wix-headless/references/forms/INSTRUCTIONS.md +5 -5
- package/skills/wix-headless/references/gift-cards/INSTRUCTIONS.md +11 -11
- package/skills/wix-headless/references/images/INSTRUCTIONS.md +47 -50
- package/skills/wix-headless/references/seed-recipes.md +49 -0
- package/skills/wix-headless/references/shared/AUTHENTICATION.md +110 -0
- package/skills/wix-headless/references/shared/BUILD_NOISE.md +2 -2
- package/skills/wix-headless/references/shared/DOCS_SEARCH.md +41 -0
- package/skills/wix-headless/references/shared/IMAGE_GENERATION.md +17 -17
- package/skills/wix-headless/references/shared/IMPLEMENTER.md +20 -29
- package/skills/wix-headless/references/shared/PRODUCTION_SHARP_EDGES.md +1 -1
- package/skills/wix-headless/references/shared/RETURN_CONTRACT.md +25 -16
- package/skills/wix-headless/references/shared/STYLING.md +47 -10
- package/skills/wix-headless/references/stores/INSTRUCTIONS.md +25 -25
- package/skills/wix-headless/references/stores/PRODUCT_CATALOG_DATA.md +17 -17
- package/skills/wix-headless/references/verticals/_schema.json +31 -117
- package/skills/wix-headless/references/verticals/_schema.md +60 -150
- package/skills/wix-headless/references/verticals/blog.md +5 -99
- package/skills/wix-headless/references/verticals/cms.md +9 -100
- package/skills/wix-headless/references/verticals/ecom.md +5 -76
- package/skills/wix-headless/references/verticals/forms.md +5 -85
- package/skills/wix-headless/references/verticals/gift-cards.md +6 -103
- package/skills/wix-headless/references/verticals/stores.md +10 -144
- package/skills/wix-headless/scripts/check-manifest.mjs +5 -5
- package/skills/wix-headless/scripts/emit-design-tokens.mjs +29 -23
- package/skills/wix-headless/scripts/init-site-json.mjs +59 -21
- package/skills/wix-headless/scripts/patch-decorative-slots.mjs +67 -43
- package/skills/wix-headless/scripts/plan-entity-image-waves.mjs +3 -3
- package/skills/wix-headless/scripts/preview.sh +3 -3
- package/skills/wix-headless/scripts/release.sh +4 -4
- package/skills/wix-headless/scripts/scaffold.sh +75 -20
- package/skills/wix-headless/scripts/seed-utilities.sh +50 -12
- package/skills/wix-manage/SKILL.md +4 -8
- package/skills/wix-manage/references/blog/how-to-create-blog-posts.md +2 -0
- package/skills/wix-manage/references/cms/cms-data-items-crud.md +4 -0
- package/skills/wix-manage/references/cms/cms-references-and-relationships.md +2 -0
- package/skills/wix-manage/references/cms/cms-schema-management.md +4 -0
- package/skills/wix-manage/references/ecommerce/api-shipping.md +443 -0
- package/skills/wix-manage/references/ecommerce/flow-add-free-shipping.md +5 -6
- package/skills/wix-manage/references/ecommerce/flow-fix-coverage-gaps.md +4 -5
- package/skills/wix-manage/references/ecommerce/flow-optimize-shipping-rates.md +4 -5
- package/skills/wix-manage/references/ecommerce/goal-increase-aov.md +1 -1
- package/skills/wix-manage/references/ecommerce/goal-reduce-cart-abandonment.md +1 -2
- package/skills/wix-manage/references/ecommerce/guardrail-shipping-health.md +2 -2
- package/skills/wix-manage/references/ecommerce/recipe-apply-shipping-recommendations.md +4 -5
- package/skills/wix-manage/references/ecommerce/recommend-ecommerce-strategy.md +7 -7
- package/skills/wix-manage/references/ecommerce/setup-discount-rules.md +209 -72
- package/skills/wix-manage/references/ecommerce/setup-store-pickup-location.md +9 -10
- package/skills/wix-manage/references/ecommerce/skill-graph.md +4 -4
- package/skills/wix-manage/references/forms/create-form.md +2 -0
- package/skills/wix-manage/references/stores/bulk-create-products-with-options.md +2 -0
- package/skills/wix-manage/references/stores/create-product-from-image.md +91 -38
- package/skills/wix-manage/references/stores/setup-online-store-catalog-v3.md +2 -0
- package/skills/wix-app/references/custom-element-widget/default-thumbnail.png +0 -0
- package/skills/wix-app/references/data-collection/extension-template.ts +0 -107
- package/skills/wix-headless/references/ORCHESTRATION.md +0 -269
- package/skills/wix-headless/references/commands/install-app.md +0 -42
- package/skills/wix-headless/references/commands/mcp-bootstrap.md +0 -28
- package/skills/wix-headless/references/designer/INSTRUCTIONS.md +0 -828
- package/skills/wix-headless/references/shared/MCP_PREFIX.md +0 -105
- package/skills/wix-headless/scripts/copy-utility-templates.mjs +0 -153
- package/skills/wix-headless/templates/ecom/components-ecom.css +0 -215
- package/skills/wix-manage/references/events/list-events.md +0 -203
- /package/skills/wix-headless/{templates → references/astro/templates}/ecom/CartBadge.tsx +0 -0
- /package/skills/wix-headless/{templates → references/astro/templates}/ecom/CartView.tsx +0 -0
- /package/skills/wix-headless/{templates → references/astro/templates}/ecom/cart.astro +0 -0
- /package/skills/wix-headless/{templates → references/astro/templates}/ecom/discounts.ts +0 -0
- /package/skills/wix-headless/{templates → references/astro/templates}/ecom/thank-you.astro +0 -0
- /package/skills/wix-headless/{templates → references/astro/templates}/gift-cards/GiftCardPurchase.tsx +0 -0
- /package/skills/wix-headless/{templates → references/astro/templates}/gift-cards/_home-teaser-snippet.astro +0 -0
- /package/skills/wix-headless/{templates → references/astro/templates}/gift-cards/_nav-snippet.astro +0 -0
- /package/skills/wix-headless/{templates → references/astro/templates}/gift-cards/components-gift-cards.css +0 -0
- /package/skills/wix-headless/{templates → references/astro/templates}/gift-cards/gift-cards.astro +0 -0
- /package/skills/wix-headless/{templates → references/astro/templates}/gift-cards/gift-cards.ts +0 -0
- /package/skills/wix-headless/{templates → references/astro/templates}/stores/AddToCartButton.tsx +0 -0
- /package/skills/wix-headless/{templates → references/astro/templates}/stores/BackInStockForm.tsx +0 -0
- /package/skills/wix-headless/{templates → references/astro/templates}/stores/CategoryRail.astro +0 -0
- /package/skills/wix-headless/{templates → references/astro/templates}/stores/ProductCard.astro +0 -0
- /package/skills/wix-headless/{templates → references/astro/templates}/stores/ProductPurchase.tsx +0 -0
- /package/skills/wix-headless/{templates → references/astro/templates}/stores/SeoTags.astro +0 -0
- /package/skills/wix-headless/{templates → references/astro/templates}/stores/categories.ts +0 -0
- /package/skills/wix-headless/{templates → references/astro/templates}/stores/category/[slug].astro +0 -0
- /package/skills/wix-headless/{templates → references/astro/templates}/stores/products/[slug].astro +0 -0
- /package/skills/wix-headless/{templates → references/astro/templates}/stores/products/index.astro +0 -0
|
@@ -1,20 +1,11 @@
|
|
|
1
1
|
|
|
2
2
|
# Wix Dashboard Plugin Builder
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
Dashboard plugins are interactive widgets that embed into predefined **slots** on dashboard pages managed by Wix first-party business apps (Wix Stores, Wix Bookings, Wix Blog, Wix eCommerce, etc.). They occupy the full width of their slot and maintain dynamic height based on content.
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
## Scaffold
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
## Quick Start Checklist
|
|
10
|
-
|
|
11
|
-
Follow these steps in order when creating a dashboard plugin:
|
|
12
|
-
|
|
13
|
-
1. [ ] Identify the target slot ID — see [Slots Reference](dashboard-plugin/SLOTS.md)
|
|
14
|
-
2. [ ] Create plugin folder: `src/extensions/dashboard/plugins/<plugin-name>/`
|
|
15
|
-
3. [ ] Create `<plugin-name>.extension.ts` with `extensions.dashboardPlugin()` and unique UUID
|
|
16
|
-
4. [ ] Create `<plugin-name>.tsx` with React component wrapped in `WixDesignSystemProvider`
|
|
17
|
-
5. [ ] Update `src/extensions.ts` to import and use the new extension
|
|
8
|
+
Use `wix generate --params` with `extensionType: DASHBOARD_PLUGIN`. `extendsSlotId` is the back-office extension container component ID from the host Wix app — see [Slots Reference](dashboard-plugin/SLOTS.md). The CLI generates the folder, the React component, the builder file, the UUID, and the `src/extensions.ts` registration.
|
|
18
9
|
|
|
19
10
|
## Architecture
|
|
20
11
|
|
|
@@ -23,84 +14,15 @@ Dashboard plugins operate through two mechanisms:
|
|
|
23
14
|
1. **Visual Integration** — Embedding plugin UI inside a supported dashboard page slot
|
|
24
15
|
2. **Logical Integration** — Implementing communication between the plugin and the host page's data via `observeState()`
|
|
25
16
|
|
|
26
|
-
##
|
|
27
|
-
|
|
28
|
-
Dashboard plugins live under `src/extensions/dashboard/plugins/`. Each plugin has its own folder.
|
|
29
|
-
|
|
30
|
-
```
|
|
31
|
-
src/extensions/dashboard/plugins/
|
|
32
|
-
└── <plugin-name>/
|
|
33
|
-
├── <plugin-name>.extension.ts # Builder configuration
|
|
34
|
-
└── <plugin-name>.tsx # React component
|
|
35
|
-
```
|
|
36
|
-
|
|
37
|
-
> **Note:** This is the default folder structure created by the CLI. You can move these files to any location within the `src/` folder and update the references in your `extension.ts` file.
|
|
38
|
-
|
|
39
|
-
## Plugin Builder Configuration
|
|
17
|
+
## The `extendsSlotId` field
|
|
40
18
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
```typescript
|
|
44
|
-
import { extensions } from "@wix/astro/builders";
|
|
45
|
-
|
|
46
|
-
export const dashboardpluginMyPlugin = extensions.dashboardPlugin({
|
|
47
|
-
id: "{{GENERATE_UUID}}",
|
|
48
|
-
title: "My Dashboard Plugin",
|
|
49
|
-
extends: "<SLOT_ID>",
|
|
50
|
-
component: "./extensions/dashboard/plugins/my-plugin/my-plugin.tsx",
|
|
51
|
-
});
|
|
52
|
-
```
|
|
53
|
-
|
|
54
|
-
**CRITICAL: UUID Generation**
|
|
55
|
-
|
|
56
|
-
The `id` must be a unique, static UUID v4 string. Generate a fresh UUID for each extension — do NOT use `randomUUID()` or copy UUIDs from examples. Replace `{{GENERATE_UUID}}` with a freshly generated UUID like `"a1b2c3d4-e5f6-7890-abcd-ef1234567890"`.
|
|
57
|
-
|
|
58
|
-
### Builder Fields
|
|
59
|
-
|
|
60
|
-
| Field | Type | Description |
|
|
61
|
-
|-------|------|-------------|
|
|
62
|
-
| `id` | string | Unique plugin ID (GUID). Must be unique across all extensions in the project. |
|
|
63
|
-
| `title` | string | Plugin title. Used to refer to the plugin in the project dashboard. |
|
|
64
|
-
| `extends` | string | Slot ID of the dashboard page hosting the plugin. See [Slots Reference](dashboard-plugin/SLOTS.md). |
|
|
65
|
-
| `component` | string | Relative path to the plugin content component (`.tsx` file). |
|
|
66
|
-
|
|
67
|
-
### The `extends` Field
|
|
68
|
-
|
|
69
|
-
The `extends` field specifies which dashboard page slot hosts your plugin. Each Wix business app exposes slots on its dashboard pages. You must provide the exact slot ID.
|
|
19
|
+
Specifies which dashboard page slot hosts your plugin. Each Wix business app exposes slots on its dashboard pages. You must provide the exact slot ID.
|
|
70
20
|
|
|
71
21
|
**Important:** Some slots with the same ID appear on different pages within the dashboard. If you create a plugin for a slot that exists on multiple pages, the plugin is displayed on all of those pages.
|
|
72
22
|
|
|
73
23
|
For the complete list of available slot IDs, see [Slots Reference](dashboard-plugin/SLOTS.md).
|
|
74
24
|
|
|
75
|
-
## Plugin
|
|
76
|
-
|
|
77
|
-
### File: `<plugin-name>.tsx`
|
|
78
|
-
|
|
79
|
-
The plugin component is a React component that renders within the dashboard page slot.
|
|
80
|
-
|
|
81
|
-
```typescript
|
|
82
|
-
import type { FC } from "react";
|
|
83
|
-
import { WixDesignSystemProvider, Card, Text } from "@wix/design-system";
|
|
84
|
-
import "@wix/design-system/styles.global.css";
|
|
85
|
-
|
|
86
|
-
const Plugin: FC = () => {
|
|
87
|
-
return (
|
|
88
|
-
<WixDesignSystemProvider features={{ newColorsBranding: true }}>
|
|
89
|
-
<Card>
|
|
90
|
-
<Card.Header title="My Plugin" />
|
|
91
|
-
<Card.Divider />
|
|
92
|
-
<Card.Content size="medium">
|
|
93
|
-
<Text>Plugin content goes here.</Text>
|
|
94
|
-
</Card.Content>
|
|
95
|
-
</Card>
|
|
96
|
-
</WixDesignSystemProvider>
|
|
97
|
-
);
|
|
98
|
-
};
|
|
99
|
-
|
|
100
|
-
export default Plugin;
|
|
101
|
-
```
|
|
102
|
-
|
|
103
|
-
### Available Resources in Plugin Components
|
|
25
|
+
## Available Resources in Plugin Components
|
|
104
26
|
|
|
105
27
|
- **React** — Component logic and state management
|
|
106
28
|
- **Wix SDK** — Access Wix business solutions and site data
|
|
@@ -152,36 +74,12 @@ const Plugin: FC<Props> = (props) => {
|
|
|
152
74
|
|
|
153
75
|
> **Note:** Typed props availability varies by Wix app. Consult the specific app's SDK documentation. Not all slots provide typed parameter interfaces.
|
|
154
76
|
|
|
155
|
-
## Extension Registration
|
|
156
|
-
|
|
157
|
-
**Extension registration is MANDATORY and has TWO required steps.**
|
|
158
|
-
|
|
159
|
-
### Step 1: Create Plugin-Specific Extension File
|
|
160
|
-
|
|
161
|
-
Each dashboard plugin requires an `<plugin-name>.extension.ts` file in its folder. See [Plugin Builder Configuration](#plugin-builder-configuration) above.
|
|
162
|
-
|
|
163
|
-
### Step 2: Register in Main Extensions File
|
|
164
|
-
|
|
165
|
-
**CRITICAL:** After creating the plugin-specific extension file, you MUST read [Extension Registration reference](EXTENSION_REGISTRATION.md) and follow the "App Registration" section to update `src/extensions.ts`.
|
|
166
|
-
|
|
167
|
-
**Without completing Step 2, the dashboard plugin will not appear on the dashboard page.**
|
|
168
|
-
|
|
169
77
|
## Sizing Behavior
|
|
170
78
|
|
|
171
79
|
- Dashboard plugins take the **full width** of their slot
|
|
172
80
|
- **Height** adjusts dynamically based on content within slot boundaries
|
|
173
81
|
- When using Dashboard SDK or dashboard-react SDK, dimensions change dynamically based on contents
|
|
174
82
|
|
|
175
|
-
## Troubleshooting
|
|
176
|
-
|
|
177
|
-
| Symptom | Cause | Fix |
|
|
178
|
-
|---------|-------|-----|
|
|
179
|
-
| Plugin not appearing on dashboard page | Missing registration | Import and `.use()` in `src/extensions.ts` |
|
|
180
|
-
| Plugin not appearing on dashboard page | Wrong slot ID | Verify `extends` field matches a valid slot ID from [Slots Reference](dashboard-plugin/SLOTS.md) |
|
|
181
|
-
|
|
182
|
-
## Dashboard-Plugin-specific Conventions
|
|
183
|
-
|
|
184
|
-
- The `extends` field MUST contain a valid slot ID from a Wix business app — do NOT invent slot IDs.
|
|
185
83
|
|
|
186
84
|
## Examples
|
|
187
85
|
|
|
@@ -5,6 +5,11 @@ Creates CMS data collections for Wix CLI apps. The data collections extension al
|
|
|
5
5
|
|
|
6
6
|
**Important:** This extension automatically enables the site's code editor, which is required for the Wix Data APIs to work. Without this extension, apps using Data APIs would need the Wix user to manually enable the code editor on their site, which isn't guaranteed. With the data collections extension, your app can reliably use Data APIs to read and write data in the collections.
|
|
7
7
|
|
|
8
|
+
## Scaffold
|
|
9
|
+
|
|
10
|
+
Use `wix generate --params` with `extensionType: DATA_COLLECTION`. The only other param is `collectionName` (1-36 chars: letters, numbers, underscores, hyphens) — fields, permissions, displayName overrides, etc. are all edited after scaffolding in the generated file.
|
|
11
|
+
|
|
12
|
+
The CLI manages a shared aggregator file (`data-collections.extension.ts`) that imports every collection file and registers them in one `extensions.dataCollections({...})` builder. The aggregator and `src/extensions.ts` are updated automatically — don't edit them manually.
|
|
8
13
|
|
|
9
14
|
## App Namespace Handling
|
|
10
15
|
|
|
@@ -21,48 +26,31 @@ Creates CMS data collections for Wix CLI apps. The data collections extension al
|
|
|
21
26
|
|
|
22
27
|
### Collection ID Format
|
|
23
28
|
|
|
24
|
-
- **In extension definition (`idSuffix`):** Use just the suffix, e.g., `"products"`
|
|
29
|
+
- **In extension definition (`idSuffix`):** Use just the suffix, e.g., `"products"`. The CLI uses `collectionName` from the scaffold params as the `idSuffix` for the generated entry.
|
|
25
30
|
- **In API calls:** Use the full scoped ID: `"<app-namespace>/products"` — MUST match `idSuffix` exactly (case-sensitive, no camelCase/PascalCase transformation)
|
|
26
31
|
- **In `referencedCollectionId`:** Use the `idSuffix` only (not the full scoped ID) — the system resolves it automatically
|
|
27
32
|
- Example: If `idSuffix` is `"product-recommendations"`, API calls use `"<app-namespace>/product-recommendations"` NOT `"<app-namespace>/productRecommendations"`
|
|
28
33
|
|
|
34
|
+
## Collection File Shape
|
|
29
35
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
In Wix CLI apps, all CMS collections are defined in a single file:
|
|
33
|
-
|
|
34
|
-
**File:** `src/extensions/data/extensions.ts`
|
|
35
|
-
|
|
36
|
-
This file uses the `extensions.genericExtension()` pattern from `@wix/astro/builders` to register all collections:
|
|
36
|
+
The CLI scaffolds `<CollectionName>.ts` as a `satisfies DataCollection` default export. The scaffolded `fields` and `dataPermissions` are placeholders — replace them with your real schema, and set permissions per the [Context-Based Permission Rules](#context-based-permission-rules) before shipping.
|
|
37
37
|
|
|
38
38
|
```typescript
|
|
39
|
-
import {
|
|
40
|
-
|
|
41
|
-
export const
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
});
|
|
39
|
+
import type { DataCollection } from '@wix/astro/builders';
|
|
40
|
+
|
|
41
|
+
export const collectionIdSuffix = '<CollectionName>';
|
|
42
|
+
|
|
43
|
+
export default {
|
|
44
|
+
idSuffix: collectionIdSuffix,
|
|
45
|
+
displayName: '<CollectionName>',
|
|
46
|
+
displayField: 'title', // Field shown when referencing items
|
|
47
|
+
fields: [ /* field definitions */ ],
|
|
48
|
+
dataPermissions: { /* itemRead, itemInsert, itemUpdate, itemRemove */ },
|
|
49
|
+
indexes: [],
|
|
50
|
+
initialData: [],
|
|
51
|
+
} satisfies DataCollection;
|
|
53
52
|
```
|
|
54
53
|
|
|
55
|
-
**CRITICAL:** The `compId` must be a unique, static UUID string. Generate a fresh UUID v4 for each app - do NOT use `randomUUID()` or copy UUIDs from examples. After creating or modifying this file, follow [Extension Registration reference](EXTENSION_REGISTRATION.md) for UUID generation and to register the extension in `src/extensions.ts` (required for collections to work).
|
|
56
|
-
|
|
57
|
-
**Key points:**
|
|
58
|
-
|
|
59
|
-
- Single file contains all collections
|
|
60
|
-
- Uses `extensions.genericExtension()` from `@wix/astro/builders`
|
|
61
|
-
- Each collection includes: `idSuffix`, `displayName`, `displayField`, `fields`, `dataPermissions`, and optionally `initialData`
|
|
62
|
-
- `displayField` specifies which field the CMS displays when referencing items in this collection from other collections
|
|
63
|
-
- Collections are generated by merging operations (INSERT, UPDATE, DELETE) with existing collections
|
|
64
|
-
- See [extension template](data-collection/extension-template.ts) for complete structure
|
|
65
|
-
|
|
66
54
|
## Field Types
|
|
67
55
|
|
|
68
56
|
| Type | Description | Use Case |
|
|
@@ -126,27 +114,59 @@ For structured objects, define nested fields inside `objectOptions.fields`:
|
|
|
126
114
|
|
|
127
115
|
## Field Properties
|
|
128
116
|
|
|
129
|
-
```
|
|
117
|
+
```ts
|
|
130
118
|
{
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
"
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
119
|
+
key: 'email', // required, lowerCamelCase ASCII
|
|
120
|
+
type: 'TEXT', // required, see Field Types above
|
|
121
|
+
displayName: 'Email Address', // optional, CMS label
|
|
122
|
+
description: "User's primary email", // optional, help text
|
|
123
|
+
encrypted: false, // optional, encrypt value at rest
|
|
124
|
+
// arrayOptions / objectOptions / referenceOptions / multiReferenceOptions
|
|
125
|
+
// only when type is ARRAY / OBJECT / REFERENCE / MULTI_REFERENCE
|
|
138
126
|
}
|
|
139
127
|
```
|
|
140
128
|
|
|
141
|
-
| Property
|
|
142
|
-
|
|
|
143
|
-
| `key`
|
|
144
|
-
| `
|
|
145
|
-
| `
|
|
146
|
-
| `
|
|
147
|
-
| `
|
|
148
|
-
|
|
149
|
-
|
|
129
|
+
| Property | Required | Description |
|
|
130
|
+
| ------------- | -------- | ------------------------------------ |
|
|
131
|
+
| `key` | yes | Field identifier (lowerCamelCase) |
|
|
132
|
+
| `type` | yes | Field data type (see Field Types) |
|
|
133
|
+
| `displayName` | no | Label shown in CMS |
|
|
134
|
+
| `description` | no | Help text |
|
|
135
|
+
| `encrypted` | no | Encrypt value at rest |
|
|
136
|
+
|
|
137
|
+
**There is no field-level `required`, `defaultValue`, or `unique`.** The `DevCenterDataCollectionField` type does not accept them and TypeScript will reject the build. Use these alternatives instead:
|
|
138
|
+
|
|
139
|
+
- **Required values:** Validate in the dashboard form and/or service-plugin handler before inserting. Do not rely on the collection schema to enforce presence.
|
|
140
|
+
- **Defaults:** Set defaults in the insert path (dashboard handler, service plugin) or via the collection's `initialData` for seeded rows.
|
|
141
|
+
- **Uniqueness:** Declare a unique index in the collection's `indexes` array (see [Indexes](#indexes)). Uniqueness is an index-level concern, not a field-level one.
|
|
142
|
+
|
|
143
|
+
## Indexes
|
|
144
|
+
|
|
145
|
+
The `indexes` array on the collection accepts entries shaped like:
|
|
146
|
+
|
|
147
|
+
```ts
|
|
148
|
+
indexes: [
|
|
149
|
+
{
|
|
150
|
+
fields: [{ path: 'email', order: 'ASC' }], // order is optional: 'ASC' | 'DESC'
|
|
151
|
+
unique: true, // optional, enforces uniqueness across items
|
|
152
|
+
},
|
|
153
|
+
{
|
|
154
|
+
fields: [
|
|
155
|
+
{ path: 'category' },
|
|
156
|
+
{ path: '_createdDate', order: 'DESC' },
|
|
157
|
+
],
|
|
158
|
+
},
|
|
159
|
+
],
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
| Property | Required | Description |
|
|
163
|
+
| --------------- | -------- | ------------------------------------------------------ |
|
|
164
|
+
| `fields` | yes | One or more `{ path, order? }` entries (composite index when more than one) |
|
|
165
|
+
| `fields[].path` | yes | Field key to index |
|
|
166
|
+
| `fields[].order`| no | `'ASC'` (default) or `'DESC'` |
|
|
167
|
+
| `unique` | no | Enforce uniqueness on the indexed field(s) |
|
|
168
|
+
|
|
169
|
+
Leave `indexes: []` when no custom indexing is needed; the `_id` index is created automatically.
|
|
150
170
|
|
|
151
171
|
## Naming Conventions
|
|
152
172
|
|
|
@@ -194,21 +214,14 @@ Access levels control who can read, create, update, and delete items in collecti
|
|
|
194
214
|
| **Backend code (site-side)** | Runs in visitor context | If called from page code or site-side modules, the caller has visitor-level permissions — data must be readable/writable at the appropriate public level. |
|
|
195
215
|
| **Backend code (elevated)** | Runs with `auth.elevate()` from `@wix/essentials` | Can bypass permissions, but the collection still needs correct defaults for any non-elevated callers. |
|
|
196
216
|
|
|
217
|
+
Use `SITE_MEMBER_AUTHOR` on `itemUpdate` / `itemRemove` when members should only modify their **own** items (e.g., a member can edit only their own reviews).
|
|
218
|
+
|
|
197
219
|
**How to apply this:**
|
|
198
220
|
|
|
199
221
|
1. **Identify every place the collection is read or written** — custom element widgets, dashboard pages, embedded scripts, backend APIs.
|
|
200
222
|
2. **Use the least restrictive context as the floor.** If a custom element widget reads the data AND a dashboard page also reads it, `itemRead` must be `ANYONE` (because the widget is public).
|
|
201
223
|
3. **Apply per-operation.** A collection can have `itemRead: ANYONE` (widget displays it) but `itemInsert: CMS_EDITOR` (only dashboard users add items). Each operation is independent.
|
|
202
224
|
|
|
203
|
-
**Examples by blueprint type:**
|
|
204
|
-
|
|
205
|
-
- **Dashboard manages data, custom element widget displays it:** `itemRead: ANYONE`, `itemInsert: CMS_EDITOR`, `itemUpdate: CMS_EDITOR`, `itemRemove: CMS_EDITOR`
|
|
206
|
-
- **Custom element widget collects user submissions (e.g., reviews), dashboard moderates:** `itemRead: ANYONE`, `itemInsert: ANYONE`, `itemUpdate: CMS_EDITOR`, `itemRemove: CMS_EDITOR`
|
|
207
|
-
- **Members-only widget reads data, members can submit:** `itemRead: SITE_MEMBER`, `itemInsert: SITE_MEMBER`, `itemUpdate: SITE_MEMBER_AUTHOR`, `itemRemove: CMS_EDITOR`
|
|
208
|
-
- **Dashboard-only (no public surface):** `itemRead: CMS_EDITOR`, `itemInsert: CMS_EDITOR`, `itemUpdate: CMS_EDITOR`, `itemRemove: CMS_EDITOR`
|
|
209
|
-
|
|
210
|
-
**Anti-pattern:** Setting `itemRead: PRIVILEGED` on a collection that a custom element widget queries — the widget will return empty results for all visitors because they lack privileged access.
|
|
211
|
-
|
|
212
225
|
## Relationships
|
|
213
226
|
|
|
214
227
|
**One-to-One / Many-to-One (REFERENCE):**
|
|
@@ -244,40 +257,6 @@ Access levels control who can read, create, update, and delete items in collecti
|
|
|
244
257
|
- **NEVER use REFERENCE fields to link to Wix business entities** (Products, Orders, Contacts, Members, etc.)
|
|
245
258
|
- Use Wix SDK APIs to access Wix business entities instead
|
|
246
259
|
|
|
247
|
-
## Collection Operations
|
|
248
|
-
|
|
249
|
-
Collections support three operation types for modifying collections:
|
|
250
|
-
|
|
251
|
-
### INSERT
|
|
252
|
-
|
|
253
|
-
Creates a new collection or replaces an existing one with the same `idSuffix`.
|
|
254
|
-
|
|
255
|
-
**Use when:** Creating a new collection or completely replacing an existing collection.
|
|
256
|
-
|
|
257
|
-
### UPDATE
|
|
258
|
-
|
|
259
|
-
Modifies an existing collection by merging new data with existing fields.
|
|
260
|
-
|
|
261
|
-
**Use when:** Adding fields, updating permissions, or modifying collection properties.
|
|
262
|
-
|
|
263
|
-
**Behavior:**
|
|
264
|
-
|
|
265
|
-
- If collection exists: Merges new data with existing collection
|
|
266
|
-
- If collection doesn't exist: Treats update as insert (creates new collection)
|
|
267
|
-
|
|
268
|
-
### DELETE
|
|
269
|
-
|
|
270
|
-
Removes a collection from the app.
|
|
271
|
-
|
|
272
|
-
**Use when:** Removing a collection that is no longer needed.
|
|
273
|
-
|
|
274
|
-
**Behavior:**
|
|
275
|
-
|
|
276
|
-
- Removes the collection from `src/extensions/data/extensions.ts`
|
|
277
|
-
- If all collections are deleted, the entire file is deleted
|
|
278
|
-
|
|
279
|
-
**Merge logic:** Operations are applied using a Map keyed by `idSuffix`. Existing collections are loaded into the Map first, then each operation modifies it: INSERT sets/replaces, UPDATE merges with existing (or creates if missing), DELETE removes. The final Map values become the output collections.
|
|
280
|
-
|
|
281
260
|
## App Version Updates
|
|
282
261
|
|
|
283
262
|
Changes to your data collections extension require releasing a new major version of your app. When a user updates to the new major version, their collections are updated as follows:
|
|
@@ -294,73 +273,18 @@ Changes to your data collections extension require releasing a new major version
|
|
|
294
273
|
|
|
295
274
|
## Wix CLI-Specific Constraints
|
|
296
275
|
|
|
297
|
-
###
|
|
298
|
-
|
|
299
|
-
**CRITICAL: NEVER create CMS collections to store configuration for embedded scripts.**
|
|
300
|
-
|
|
301
|
-
All embedded script configuration must go through embedded script parameters (`embeddedScriptParameters`), not CMS collections.
|
|
302
|
-
|
|
303
|
-
**DO NOT create collections for:**
|
|
304
|
-
|
|
305
|
-
- Colors, messages, headlines, text content
|
|
306
|
-
- Coupon codes, display settings
|
|
307
|
-
- UI customization (positions, sizes, styles)
|
|
308
|
-
- Timing settings, feature toggles
|
|
309
|
-
- Display frequencies, thresholds
|
|
310
|
-
- Minimums/maximums
|
|
311
|
-
- **ANY configuration that controls how an embedded script behaves or appears**
|
|
312
|
-
|
|
313
|
-
**Examples of configuration (use parameters, NOT collections):**
|
|
314
|
-
|
|
315
|
-
- Popup headline → embedded script parameter
|
|
316
|
-
- Coupon code → embedded script parameter
|
|
317
|
-
- Background color → embedded script parameter
|
|
318
|
-
- Display position → embedded script parameter
|
|
319
|
-
- Show/hide toggles → embedded script parameter
|
|
320
|
-
|
|
321
|
-
**CMS collections should ONLY be created for:**
|
|
322
|
-
|
|
323
|
-
- Business data (products, orders, inventory, etc.)
|
|
324
|
-
- User-generated content (reviews, comments, submissions)
|
|
325
|
-
- Event logs (if explicitly requested for analytics/tracking)
|
|
326
|
-
- Multi-record relational data that is NOT configuration
|
|
276
|
+
### When NOT to use a Collection
|
|
327
277
|
|
|
328
|
-
**
|
|
278
|
+
Collections are for **data**, not configuration:
|
|
329
279
|
|
|
330
|
-
-
|
|
331
|
-
-
|
|
280
|
+
- **Embedded script settings** → use `embeddedScriptParameters` instead.
|
|
281
|
+
- **Custom element widget settings** → use the widget's `panel.tsx` (settings panel) instead. A widget-only blueprint usually needs **zero** collections.
|
|
282
|
+
- **Single-value config** (theme, mode, threshold) → put it in the host extension's settings, not a one-field collection.
|
|
283
|
+
- **Computed / aggregated values** (averages, counts) → calculate dynamically, don't store.
|
|
332
284
|
|
|
333
|
-
|
|
285
|
+
Common values that do **not** belong in a collection: colors, fonts, sizes, headlines, labels, messages, dates/times, coupon codes, display positions, feature toggles, frequencies, numeric thresholds.
|
|
334
286
|
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
**For CUSTOM_ELEMENT_WIDGET-only blueprints (no DASHBOARD_PAGE or other extensions):**
|
|
338
|
-
|
|
339
|
-
- **ALWAYS return `collections: []` (empty array)**
|
|
340
|
-
- The widget panel handles everything
|
|
341
|
-
- **NEVER create collections to store widget configuration data**
|
|
342
|
-
|
|
343
|
-
**Configuration handled by widget panel (NOT collections):**
|
|
344
|
-
|
|
345
|
-
- Target date/time for countdown → widget panel
|
|
346
|
-
- Display colors, fonts, sizes → widget panel
|
|
347
|
-
- Headlines, labels, messages → widget panel
|
|
348
|
-
- Feature toggles, show/hide options → widget panel
|
|
349
|
-
- Numeric settings (delays, intervals, thresholds) → widget panel
|
|
350
|
-
|
|
351
|
-
**Only create collections for CUSTOM_ELEMENT_WIDGET when ALL of these conditions are met:**
|
|
352
|
-
|
|
353
|
-
1. The blueprint ALSO includes a DASHBOARD_PAGE extension that needs to manage data the widget displays
|
|
354
|
-
2. OR the widget explicitly needs to display MULTIPLE records of user-generated/business data (not configuration)
|
|
355
|
-
3. AND the data is NOT configuration (dates, colors, settings, display options are ALWAYS configuration)
|
|
356
|
-
|
|
357
|
-
### Anti-Patterns
|
|
358
|
-
|
|
359
|
-
**Don't create aggregated fields.** If you have individual `rating` fields, calculate averages dynamically — don't store computed values like `averageRating`.
|
|
360
|
-
|
|
361
|
-
**Don't duplicate configuration.** If embedded script parameters already hold `{ headline, color }`, don't also create a CMS collection with the same data.
|
|
362
|
-
|
|
363
|
-
**Don't create single-value collections.** A collection with one field like `{ theme: "dark" }` should be an embedded script parameter or widget setting instead.
|
|
287
|
+
Collections are for: business data (products, orders, inventory), user-generated content (reviews, comments, submissions), event logs, and multi-record relational data.
|
|
364
288
|
|
|
365
289
|
### Initial Data Rules
|
|
366
290
|
|
|
@@ -378,62 +302,54 @@ Each item in `initialData` must match the collection schema exactly:
|
|
|
378
302
|
|
|
379
303
|
**Request:** "Create a collection for handling fees with example data"
|
|
380
304
|
|
|
381
|
-
|
|
305
|
+
Scaffold:
|
|
306
|
+
|
|
307
|
+
```bash
|
|
308
|
+
wix generate --params '{"extensionType":"DATA_COLLECTION","collectionName":"additional-fees"}'
|
|
309
|
+
```
|
|
310
|
+
|
|
311
|
+
Edit the generated `src/extensions/backend/data-collections/additional-fees.ts`:
|
|
382
312
|
|
|
383
313
|
```typescript
|
|
384
|
-
import {
|
|
385
|
-
|
|
386
|
-
export const
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
],
|
|
402
|
-
dataPermissions: {
|
|
403
|
-
itemRead: "ANYONE",
|
|
404
|
-
itemInsert: "PRIVILEGED",
|
|
405
|
-
itemUpdate: "PRIVILEGED",
|
|
406
|
-
itemRemove: "PRIVILEGED",
|
|
407
|
-
},
|
|
408
|
-
initialData: [
|
|
409
|
-
{ title: "Handling Fee", amount: 5 },
|
|
410
|
-
{ title: "Gift Wrapping", amount: 3.5 },
|
|
411
|
-
],
|
|
412
|
-
},
|
|
413
|
-
],
|
|
414
|
-
},
|
|
314
|
+
import type { DataCollection } from '@wix/astro/builders';
|
|
315
|
+
|
|
316
|
+
export const collectionIdSuffix = 'additional-fees';
|
|
317
|
+
|
|
318
|
+
export default {
|
|
319
|
+
idSuffix: collectionIdSuffix,
|
|
320
|
+
displayName: 'Additional Fees',
|
|
321
|
+
displayField: 'title',
|
|
322
|
+
fields: [
|
|
323
|
+
{ key: 'title', displayName: 'Fee Title', type: 'TEXT' },
|
|
324
|
+
{ key: 'amount', displayName: 'Fee Amount', type: 'NUMBER' },
|
|
325
|
+
],
|
|
326
|
+
dataPermissions: {
|
|
327
|
+
itemRead: 'ANYONE',
|
|
328
|
+
itemInsert: 'PRIVILEGED',
|
|
329
|
+
itemUpdate: 'PRIVILEGED',
|
|
330
|
+
itemRemove: 'PRIVILEGED',
|
|
415
331
|
},
|
|
416
|
-
|
|
332
|
+
indexes: [],
|
|
333
|
+
initialData: [
|
|
334
|
+
{ title: 'Handling Fee', amount: 5 },
|
|
335
|
+
{ title: 'Gift Wrapping', amount: 3.5 },
|
|
336
|
+
],
|
|
337
|
+
} satisfies DataCollection;
|
|
417
338
|
```
|
|
418
339
|
|
|
419
340
|
### Collection with Reference Relationship
|
|
420
341
|
|
|
421
342
|
**Request:** "Create collections for products and categories with relationships"
|
|
422
343
|
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
- `categories` - Category definitions
|
|
426
|
-
- `products` - Products that reference categories
|
|
427
|
-
|
|
428
|
-
Both collections are defined in the same `src/extensions/data/extensions.ts` file, with the `products` collection using a REFERENCE field to link to `categories`. See the [extension template](data-collection/extension-template.ts) for a complete multi-collection example.
|
|
344
|
+
Run `wix generate --params` twice — once with `collectionName: "categories"` and once with `collectionName: "products"`. Then edit `src/extensions/backend/data-collections/products.ts` to add a `REFERENCE` field pointing at `categories` (`referenceOptions: { referencedCollectionId: "categories" }`). The aggregator `data-collections.extension.ts` is updated by the CLI automatically.
|
|
429
345
|
|
|
430
346
|
## Common Patterns
|
|
431
347
|
|
|
432
|
-
**Soft Delete:** Add `isDeleted` (BOOLEAN,
|
|
348
|
+
**Soft Delete:** Add `isDeleted` (BOOLEAN), defaulted at the insert path
|
|
433
349
|
|
|
434
350
|
**Status/Workflow:** Add `status` (TEXT) with values like draft/pending/published
|
|
435
351
|
|
|
436
|
-
**URL Slug:** Add `slug` (TEXT, unique
|
|
352
|
+
**URL Slug:** Add `slug` (TEXT) plus a `{ fields: [{ path: 'slug' }], unique: true }` entry in `indexes` for SEO-friendly URLs
|
|
437
353
|
|
|
438
354
|
**Owner Tracking:** Add `createdBy` (REFERENCE → custom collection, not Members)
|
|
439
355
|
|
|
@@ -442,7 +358,6 @@ Both collections are defined in the same `src/extensions/data/extensions.ts` fil
|
|
|
442
358
|
## Reference Documentation
|
|
443
359
|
|
|
444
360
|
- [Wix Data SDK Reference](data-collection/WIX_DATA.md) - Complete reference for reading and writing data using `@wix/data`
|
|
445
|
-
- [extension-template.ts](data-collection/extension-template.ts) - Template for `src/extensions/data/extensions.ts`
|
|
446
361
|
|
|
447
362
|
### Public Documentation
|
|
448
363
|
|