@wix/agent-skills 1.5.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/EDITOR_REACT_COMPONENT.md +15 -1
- 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/data-collection/WIX_DATA.md +1 -1
- package/skills/wix-app/references/editor-react-component/COMPONENT-API.md +1 -1
- 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 +112 -368
- 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 +250 -94
- 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 +70 -1
- 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 +14 -7
- 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,27 +1,28 @@
|
|
|
1
1
|
|
|
2
2
|
# Wix Service Plugin (SPI) Builder
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
Service plugins are a set of APIs defined by Wix that let you inject custom logic into the existing backend flows of Wix business solutions or introduce entirely new flows. When you implement a service plugin, Wix calls your custom functions during specific flows. Common use cases include eCommerce customization (shipping, fees, payment settings, validations) and Bookings customization (staff sorting).
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
## Scaffold
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
Use `wix generate --params` with `extensionType: SERVICE_PLUGIN`. `pluginType` is one of:
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
| Value | SPI |
|
|
11
|
+
| --- | --- |
|
|
12
|
+
| `ECOM_ADDITIONAL_FEES` | Additional Fees |
|
|
13
|
+
| `ECOM_SHIPPING_RATES` | Shipping Rates |
|
|
14
|
+
| `ECOM_DISCOUNTS_TRIGGER` | Discount Triggers |
|
|
15
|
+
| `ECOM_VALIDATIONS` | Validations |
|
|
16
|
+
| `ECOM_PAYMENT_SETTINGS` | Payment Settings |
|
|
17
|
+
| `GIFT_CARDS_PROVIDER` | Gift Cards Provider |
|
|
18
|
+
| `STAFF_SORTING_PROVIDER` | Bookings Staff Sorting |
|
|
19
|
+
| `REALTIME_PERMISSIONS_PROVIDER` | Realtime Permissions Provider |
|
|
11
20
|
|
|
12
|
-
|
|
13
|
-
2. [ ] Create plugin folder: `src/extensions/backend/service-plugins/<service-type>/<plugin-name>/`
|
|
14
|
-
3. [ ] Create `plugin.ts` with correct imports and `provideHandlers()` call
|
|
15
|
-
4. [ ] Implement all required handler functions with complete business logic
|
|
16
|
-
5. [ ] Create `extensions.ts` with appropriate builder method and unique UUID
|
|
17
|
-
6. [ ] Update `src/extensions.ts` to import and use the new extension
|
|
18
|
-
7. [ ] Run `npx tsc --noEmit` to verify TypeScript compiles
|
|
19
|
-
8. [ ] Run `npx wix build` to verify build succeeds
|
|
20
|
-
9. [ ] Test by triggering the relevant site action (e.g., add to cart for fees)
|
|
21
|
+
`name` must be lowercase alphanumeric + hyphens, max 19 characters. The CLI generates the folder, `plugin.ts`, the builder file, the UUID, and the `src/extensions.ts` registration with the appropriate builder method for the SPI type. Some SPI types (e.g., `ECOM_SHIPPING_RATES`) get a `description` placeholder field in the generated builder — replace it with your real copy.
|
|
21
22
|
|
|
22
23
|
## References
|
|
23
24
|
|
|
24
|
-
**You MUST read the relevant reference document before implementing
|
|
25
|
+
**You MUST read the relevant reference document before implementing an SPI**, and **call `ReadFullDocsMethodSchema`** with the docs URL it points at to get the exact request/response types — **do NOT edit code until you have the schema**. If the schema alone isn't enough, follow up with `ReadFullDocsArticle` on the same URL for prose explanations and additional code examples. Each reference also contains the correct imports, handler signatures, response structures, and a worked example.
|
|
25
26
|
|
|
26
27
|
| SPI Type | Reference |
|
|
27
28
|
| --- | --- |
|
|
@@ -33,199 +34,45 @@ Follow these steps in order when creating a service plugin:
|
|
|
33
34
|
| Validations | [VALIDATIONS.md](service-plugin/VALIDATIONS.md) |
|
|
34
35
|
| Bookings Staff Sorting | [BOOKINGS-STAFF-SORTING.md](service-plugin/BOOKINGS-STAFF-SORTING.md) |
|
|
35
36
|
|
|
36
|
-
## Output Structure
|
|
37
|
-
|
|
38
|
-
Service plugins consist of two files that work together. Registration of plugins requires an extension builder file.
|
|
39
|
-
|
|
40
|
-
```
|
|
41
|
-
src/extensions/backend/service-plugins/
|
|
42
|
-
└── {service-type}/
|
|
43
|
-
└── {plugin-name}/
|
|
44
|
-
├── plugin.ts # Handler logic with provideHandlers()
|
|
45
|
-
└── extensions.ts # Builder configuration (id, name, source)
|
|
46
|
-
```
|
|
47
|
-
|
|
48
|
-
### File Descriptions
|
|
49
|
-
|
|
50
|
-
| File | Purpose |
|
|
51
|
-
| --- | --- |
|
|
52
|
-
| `plugin.ts` | Contains the service plugin handler logic with `provideHandlers()` - this is where you implement your custom business logic |
|
|
53
|
-
| `extensions.ts` | Contains the service plugin builder configuration with id (GUID), name, source path, and builder-specific optional fields |
|
|
54
|
-
|
|
55
|
-
## Implementation Requirements
|
|
56
|
-
|
|
57
|
-
### Generation Requirements
|
|
58
|
-
|
|
59
|
-
1. **Implement ALL required handler functions** with complete business logic
|
|
60
|
-
2. **Include proper TypeScript types and error handling**
|
|
61
|
-
3. **Focus on implementing the EXACT business logic** described in the user prompt
|
|
62
|
-
|
|
63
|
-
### Implementation Patterns
|
|
64
|
-
|
|
65
|
-
- **If capabilities are undocumented/unavailable**, explicitly state the gap and proceed only with documented minimal logic
|
|
66
|
-
- **Implement all required handler functions** according to Wix specifications
|
|
67
|
-
- **Never use placeholders** - always implement complete, working functionality
|
|
68
|
-
|
|
69
|
-
### Data Validation
|
|
70
|
-
|
|
71
|
-
All service plugins must include comprehensive data validation:
|
|
72
|
-
|
|
73
|
-
- **Validate all input data** from Wix requests
|
|
74
|
-
- **Ensure required fields** are present and properly formatted
|
|
75
|
-
- **Handle missing or malformed data** gracefully
|
|
76
|
-
- **Validate business logic constraints** (e.g., minimum order amounts, valid addresses)
|
|
77
|
-
|
|
78
37
|
## Implementation Pattern
|
|
79
38
|
|
|
80
|
-
The
|
|
81
|
-
|
|
82
|
-
1. Import the relevant service plugin from the appropriate package (e.g., `@wix/ecom/service-plugins` for eCommerce, `@wix/bookings/service-plugins` for Bookings)
|
|
83
|
-
2. Call `provideHandlers()` with an object containing handler functions
|
|
84
|
-
3. Each handler function receives a payload with `request` and `metadata`
|
|
85
|
-
4. Return the expected response structure for that SPI type
|
|
39
|
+
The scaffolded `plugin.ts` imports the relevant module from the SPI's package (`@wix/ecom/service-plugins`, `@wix/bookings/service-plugins`, etc.) and calls `provideHandlers({...})`. Each handler is invoked by Wix on the relevant flow with a `{ request, metadata }` payload and must return the SPI-specific response shape — see the per-SPI reference (Shipping Rates, Validations, etc.) for the exact request/response types and a worked example.
|
|
86
40
|
|
|
87
|
-
|
|
88
|
-
import { shippingRates } from "@wix/ecom/service-plugins";
|
|
89
|
-
|
|
90
|
-
shippingRates.provideHandlers({
|
|
91
|
-
getShippingRates: async (payload) => {
|
|
92
|
-
const { request, metadata } = payload;
|
|
93
|
-
|
|
94
|
-
// Implement custom logic based on request data
|
|
95
|
-
// - request contains cart items, shipping address, etc.
|
|
96
|
-
// - metadata contains currency, locale, etc.
|
|
97
|
-
|
|
98
|
-
return {
|
|
99
|
-
shippingRates: [
|
|
100
|
-
{
|
|
101
|
-
code: "custom-shipping",
|
|
102
|
-
title: "Custom Shipping",
|
|
103
|
-
logistics: {
|
|
104
|
-
deliveryTime: "3-5 business days",
|
|
105
|
-
},
|
|
106
|
-
cost: {
|
|
107
|
-
price: "9.99",
|
|
108
|
-
currency: metadata.currency || "USD",
|
|
109
|
-
},
|
|
110
|
-
},
|
|
111
|
-
],
|
|
112
|
-
};
|
|
113
|
-
},
|
|
114
|
-
});
|
|
115
|
-
```
|
|
41
|
+
## Implementation Requirements
|
|
116
42
|
|
|
117
|
-
|
|
43
|
+
- Implement ALL required handler functions for the chosen SPI with complete business logic. Focus on the EXACT business logic the user asked for.
|
|
44
|
+
- Validate inputs: required fields present, correctly formatted, business constraints met (minimum order amounts, valid addresses, etc.). Handle missing or malformed data gracefully.
|
|
45
|
+
- Return the exact response shape documented for the SPI; handler responses must match Wix's documented structure.
|
|
46
|
+
- Handle errors gracefully — return appropriate error responses, don't throw unhandled exceptions.
|
|
47
|
+
- Test edge cases (empty carts, missing addresses, invalid data) before reporting completion.
|
|
48
|
+
- If a required capability isn't documented or available in the SDK, surface the gap to the user explicitly — do not fabricate.
|
|
118
49
|
|
|
119
50
|
## Elevating Permissions for API Calls
|
|
120
51
|
|
|
121
|
-
When making Wix API calls from service plugins,
|
|
52
|
+
When making Wix API calls from service plugins, wrap the SDK method with `auth.elevate` from `@wix/essentials` before calling it. The pattern is identical for every Wix SDK module (`@wix/data`, `@wix/ecom`, `@wix/stores`, etc.):
|
|
122
53
|
|
|
123
54
|
```typescript
|
|
124
55
|
import { auth } from "@wix/essentials";
|
|
125
56
|
import { items } from "@wix/data";
|
|
126
57
|
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
const elevatedResponse = await elevatedFunction("myCollection");
|
|
130
|
-
return elevatedResponse;
|
|
131
|
-
};
|
|
58
|
+
const elevated = auth.elevate(items.query);
|
|
59
|
+
const response = await elevated("myCollection");
|
|
132
60
|
```
|
|
133
61
|
|
|
134
|
-
|
|
135
|
-
import { auth } from "@wix/essentials";
|
|
136
|
-
import { cart } from "@wix/ecom";
|
|
62
|
+
## Builder field overrides
|
|
137
63
|
|
|
138
|
-
|
|
139
|
-
const elevatedFunction = auth.elevate(cart.getCart);
|
|
140
|
-
const elevatedResponse = await elevatedFunction("cart-id");
|
|
141
|
-
return elevatedResponse;
|
|
142
|
-
};
|
|
143
|
-
```
|
|
64
|
+
The CLI generates a builder with `id`, `name`, and `source`. Some SPI types accept additional optional fields you may want to set in the generated builder file:
|
|
144
65
|
|
|
145
|
-
|
|
146
|
-
import { auth } from "@wix/essentials";
|
|
147
|
-
import { products } from "@wix/stores";
|
|
148
|
-
|
|
149
|
-
export const myFunction = async () => {
|
|
150
|
-
const elevatedFunction = auth.elevate(products.deleteCollection);
|
|
151
|
-
const elevatedResponse = await elevatedFunction("collection-id");
|
|
152
|
-
return elevatedResponse;
|
|
153
|
-
};
|
|
154
|
-
```
|
|
155
|
-
|
|
156
|
-
## Best Practices
|
|
157
|
-
|
|
158
|
-
### Development Workflow
|
|
159
|
-
|
|
160
|
-
- **Always implement complete, working functionality** - never use placeholders
|
|
161
|
-
- **Handle all required fields** according to Wix documentation
|
|
162
|
-
- **Implement proper validation** for all input data
|
|
163
|
-
- **Return responses in exact format** expected by Wix
|
|
164
|
-
- **Add comprehensive error handling** for all failure scenarios
|
|
165
|
-
- **Use meaningful variable names** and clear code structure
|
|
166
|
-
- **Test thoroughly** with different input combinations
|
|
167
|
-
|
|
168
|
-
### Implementation Guidelines
|
|
169
|
-
|
|
170
|
-
- **Validate all input:** Check required fields are present and properly formatted
|
|
171
|
-
- **Handle errors gracefully:** Return appropriate error responses, don't throw unhandled exceptions
|
|
172
|
-
- **Return exact format:** Responses must match Wix documented structure exactly
|
|
173
|
-
- **Use TypeScript types:** Leverage SDK types for better type safety
|
|
174
|
-
- **Test edge cases:** Empty carts, missing addresses, invalid data
|
|
175
|
-
- **Performance:** Keep calculations efficient - these run on every checkout
|
|
176
|
-
- **Logging:** Add console.log for debugging but keep production logs minimal
|
|
177
|
-
|
|
178
|
-
## Extension Registration
|
|
179
|
-
|
|
180
|
-
**Extension registration is MANDATORY and has TWO required steps.**
|
|
181
|
-
|
|
182
|
-
### Step 1: Create Plugin-Specific Extension File
|
|
183
|
-
|
|
184
|
-
Each service plugin requires an `extensions.ts` file in its folder with the appropriate builder method for the SPI type:
|
|
185
|
-
|
|
186
|
-
```typescript
|
|
187
|
-
import { extensions } from "@wix/astro/builders";
|
|
188
|
-
|
|
189
|
-
export const ecomadditionalfeesMyFees = extensions.ecomAdditionalFees({
|
|
190
|
-
id: "{{GENERATE_UUID}}",
|
|
191
|
-
name: "My Additional Fees",
|
|
192
|
-
source: "./extensions/backend/service-plugins/ecom-additional-fees/my-fees/plugin.ts",
|
|
193
|
-
});
|
|
194
|
-
```
|
|
195
|
-
|
|
196
|
-
**CRITICAL: UUID Generation**
|
|
197
|
-
|
|
198
|
-
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"`.
|
|
199
|
-
|
|
200
|
-
### Builder Configuration Fields
|
|
201
|
-
|
|
202
|
-
All builder methods accept these three fields:
|
|
203
|
-
|
|
204
|
-
| Field | Type | Description |
|
|
66
|
+
| SPI Type | Builder Method | Additional Optional Fields |
|
|
205
67
|
| --- | --- | --- |
|
|
206
|
-
|
|
|
207
|
-
|
|
|
208
|
-
|
|
|
209
|
-
|
|
210
|
-
**Builder methods by SPI type and their accepted fields:**
|
|
211
|
-
|
|
212
|
-
| SPI Type | Builder Method | Accepted Fields |
|
|
213
|
-
| ----------------- | ------------------------ | --------------- |
|
|
214
|
-
| Shipping Rates | `ecomShippingRates()` | `id`, `name`, `source`, `description`, `learnMoreUrl`, `dashboardUrl`, `fallbackDefinitionMandatory`, `thumbnailUrl` |
|
|
215
|
-
| Additional Fees | `ecomAdditionalFees()` | `id`, `name`, `source` |
|
|
216
|
-
| Validations | `ecomValidations()` | `id`, `name`, `source`, `validateInCart` |
|
|
217
|
-
| Discount Triggers | `ecomDiscountTriggers()` | `id`, `name`, `source` |
|
|
218
|
-
| Gift Cards | `ecomGiftCards()` | `id`, `name`, `source` |
|
|
219
|
-
| Payment Settings | `ecomPaymentSettings()` | `id`, `name`, `source`, `fallbackValueForRequires3dSecure` |
|
|
220
|
-
| Bookings Staff Sorting | `bookingsStaffSortingProvider()` | `id`, `name`, `source`, `methodName`, `methodDescription` (max 100 chars), `dashboardPluginId` |
|
|
221
|
-
|
|
222
|
-
Only `ecomShippingRates()` accepts `description`. Passing unsupported fields to other builders causes TypeScript errors. `bookingsStaffSortingProvider()` requires `methodName` and `methodDescription` fields (methodDescription has a 100-character limit), and optionally accepts `dashboardPluginId`.
|
|
223
|
-
|
|
224
|
-
### Step 2: Register in Main Extensions File
|
|
68
|
+
| Shipping Rates | `ecomShippingRates()` | `description`, `learnMoreUrl`, `dashboardUrl`, `fallbackDefinitionMandatory`, `thumbnailUrl` |
|
|
69
|
+
| Validations | `ecomValidations()` | `validateInCart` |
|
|
70
|
+
| Payment Settings | `ecomPaymentSettings()` | `fallbackValueForRequires3dSecure` |
|
|
71
|
+
| Bookings Staff Sorting | `bookingsStaffSortingProvider()` | `methodName` (required), `methodDescription` (required, max 100 chars), `dashboardPluginId` |
|
|
225
72
|
|
|
226
|
-
|
|
73
|
+
Only `ecomShippingRates()` accepts `description`. Passing unsupported fields to other builders causes TypeScript errors. `bookingsStaffSortingProvider()` requires `methodName` and `methodDescription` fields — set these in the generated builder file after scaffolding.
|
|
227
74
|
|
|
228
|
-
**
|
|
75
|
+
> **Performance:** keep handler logic efficient. Most SPIs run on hot paths (every cart view, every checkout step, etc.).
|
|
229
76
|
|
|
230
77
|
## Testing Service Plugins
|
|
231
78
|
|
|
@@ -1,23 +1,15 @@
|
|
|
1
1
|
|
|
2
2
|
# Wix Site Plugin Builder
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
Site plugins are custom elements that integrate into predefined **slots** within Wix business solutions (Wix Stores, Wix Bookings, Wix eCommerce, etc.), extending their functionality and user experience. Site owners place site plugins into UI slots using the plugin explorer in Wix editors.
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
## Scaffold
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
Follow these steps in order when creating a site plugin:
|
|
11
|
-
|
|
12
|
-
1. [ ] Create plugin folder: `src/extensions/site/plugins/<plugin-name>/`
|
|
13
|
-
2. [ ] Create `<plugin-name>.tsx` extending `HTMLElement` with `observedAttributes`
|
|
14
|
-
3. [ ] Create `<plugin-name>.panel.tsx` with WDS components and `widget.getProp/setProp`
|
|
15
|
-
4. [ ] Create `<plugin-name>.extension.ts` with `extensions.sitePlugin()` and unique UUID
|
|
16
|
-
5. [ ] Update `src/extensions.ts` to import and use the new extension
|
|
8
|
+
Use `wix generate --params` with `extensionType: SITE_PLUGIN`. `slotId` is `<componentId>:<slotId>` — the colon-joined widget component ID and slot ID. Run `wix schema generate --type SITE_PLUGIN` to list the available `slotId` values (each `anyOf` entry has the slot's human-readable title). The CLI generates the folder, the plugin `.tsx`, the settings panel `.tsx`, the builder file, the UUID, the logo SVG, and the `src/extensions.ts` registration.
|
|
17
9
|
|
|
18
10
|
## Architecture
|
|
19
11
|
|
|
20
|
-
Site plugins consist of **three required files
|
|
12
|
+
Site plugins consist of **three required files** generated by the CLI:
|
|
21
13
|
|
|
22
14
|
### 1. Plugin Component (`<plugin-name>.tsx`)
|
|
23
15
|
|
|
@@ -40,13 +32,9 @@ Settings panel shown in the Wix Editor sidebar:
|
|
|
40
32
|
- Widget properties are bound to custom element attributes — any property change automatically updates the corresponding attribute
|
|
41
33
|
- Wrapped in `WixDesignSystemProvider > SidePanel > SidePanel.Content`
|
|
42
34
|
|
|
43
|
-
### 3. Extension
|
|
44
|
-
|
|
45
|
-
Defines the plugin's placement configuration:
|
|
35
|
+
### 3. Extension Builder (`<plugin-name>.extension.ts`)
|
|
46
36
|
|
|
47
|
-
|
|
48
|
-
- Configures auto-add behavior on app installation
|
|
49
|
-
- Sets the tag name and file paths
|
|
37
|
+
Generated by the CLI with placements, tagName, element/settings paths, marketData (name/description/logoUrl), and `installation.autoAdd`. Edit `marketData.description` and `installation.autoAdd` directly in this file after scaffolding if defaults don't match your needs.
|
|
50
38
|
|
|
51
39
|
## Plugin Component Pattern
|
|
52
40
|
|
|
@@ -255,26 +243,12 @@ Site plugins use **kebab-case** consistently for HTML attributes:
|
|
|
255
243
|
| `<plugin>.tsx` (observedAttributes) | kebab-case | `['display-name', 'bg-color']` |
|
|
256
244
|
| `<plugin>.panel.tsx` (widget API) | kebab-case | `widget.getProp('display-name')` |
|
|
257
245
|
|
|
258
|
-
## Output Structure
|
|
259
|
-
|
|
260
|
-
Site plugins live under `src/extensions/site/plugins`. Each plugin has its own folder with files named after the plugin.
|
|
261
|
-
|
|
262
|
-
```
|
|
263
|
-
src/extensions/site/plugins/
|
|
264
|
-
└── {plugin-name}/
|
|
265
|
-
├── {plugin-name}.tsx # Main plugin component (HTMLElement)
|
|
266
|
-
├── {plugin-name}.panel.tsx # Settings panel component
|
|
267
|
-
└── {plugin-name}.extension.ts # Extension registration
|
|
268
|
-
public/
|
|
269
|
-
└── {plugin-name}-logo.svg # Plugin logo (optional)
|
|
270
|
-
```
|
|
271
|
-
|
|
272
246
|
## References
|
|
273
247
|
|
|
274
248
|
| Topic | Reference |
|
|
275
249
|
| --- | --- |
|
|
276
250
|
| Complete Examples | [EXAMPLES.md](site-plugin/EXAMPLES.md) |
|
|
277
|
-
| Slots (App IDs,
|
|
251
|
+
| Slots (App IDs, runtime APIs, design guidelines, multiple placements) | [SLOTS.md](site-plugin/SLOTS.md) — run `wix schema generate --type SITE_PLUGIN` for the authoritative `slotId` enum |
|
|
278
252
|
| WDS Components | the `wix-design-system` skill |
|
|
279
253
|
|
|
280
254
|
## Available Slots
|
|
@@ -287,65 +261,7 @@ Site plugins integrate into predefined slots in Wix business solutions. Each slo
|
|
|
287
261
|
|
|
288
262
|
Common placement areas include product pages (Wix Stores), checkout and side cart (Wix eCommerce), booking pages (Wix Bookings), service pages, event pages, and blog post pages.
|
|
289
263
|
|
|
290
|
-
For
|
|
291
|
-
|
|
292
|
-
## Extension Registration
|
|
293
|
-
|
|
294
|
-
**Extension registration is MANDATORY and has TWO required steps.**
|
|
295
|
-
|
|
296
|
-
### Step 1: Create Plugin-Specific Extension File
|
|
297
|
-
|
|
298
|
-
Each site plugin requires an extension file in its folder:
|
|
299
|
-
|
|
300
|
-
```typescript
|
|
301
|
-
// my-site-plugin.extension.ts
|
|
302
|
-
import { extensions } from '@wix/astro/builders';
|
|
303
|
-
|
|
304
|
-
export default extensions.sitePlugin({
|
|
305
|
-
id: '{{GENERATE_UUID}}',
|
|
306
|
-
name: 'My Site Plugin',
|
|
307
|
-
marketData: {
|
|
308
|
-
name: 'My Site Plugin',
|
|
309
|
-
description: 'Marketing Description',
|
|
310
|
-
logoUrl: '{{BASE_URL}}/my-site-plugin-logo.svg',
|
|
311
|
-
},
|
|
312
|
-
placements: [{
|
|
313
|
-
appDefinitionId: 'a0c68605-c2e7-4c8d-9ea1-767f9770e087',
|
|
314
|
-
widgetId: '6a25b678-53ec-4b37-a190-65fcd1ca1a63',
|
|
315
|
-
slotId: 'product-page-details-6',
|
|
316
|
-
}],
|
|
317
|
-
installation: { autoAdd: true },
|
|
318
|
-
tagName: 'my-site-plugin',
|
|
319
|
-
element: './extensions/site/plugins/my-site-plugin/my-site-plugin.tsx',
|
|
320
|
-
settings: './extensions/site/plugins/my-site-plugin/my-site-plugin.panel.tsx',
|
|
321
|
-
});
|
|
322
|
-
```
|
|
323
|
-
|
|
324
|
-
**CRITICAL: UUID Generation**
|
|
325
|
-
|
|
326
|
-
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 `"95a28afd-7df1-4e09-9ec1-ce710b0389a0"`.
|
|
327
|
-
|
|
328
|
-
| Property | Type | Description |
|
|
329
|
-
| -------------------------- | ------- | --------------------------------------------------------------- |
|
|
330
|
-
| `id` | string | Unique static UUID v4 (generate fresh) |
|
|
331
|
-
| `name` | string | Internal name for the plugin |
|
|
332
|
-
| `marketData.name` | string | Display name in plugin explorer and app dashboard |
|
|
333
|
-
| `marketData.description` | string | Description shown in plugin explorer and app dashboard |
|
|
334
|
-
| `marketData.logoUrl` | string | Path to logo file (`{{BASE_URL}}` resolves to public folder) |
|
|
335
|
-
| `placements` | array | Array of slot placements where plugin can be added |
|
|
336
|
-
| `placements.appDefinitionId` | string | ID of the Wix app containing the slot |
|
|
337
|
-
| `placements.widgetId` | string | ID of the page containing the slot |
|
|
338
|
-
| `placements.slotId` | string | ID of the specific slot |
|
|
339
|
-
| `installation.autoAdd` | boolean | Whether to auto-add plugin to slots on app installation |
|
|
340
|
-
| `tagName` | string | HTML custom element tag (kebab-case, must contain a hyphen) |
|
|
341
|
-
| `element` | string | Relative path to plugin component |
|
|
342
|
-
| `settings` | string | Relative path to settings panel component |
|
|
343
|
-
|
|
344
|
-
### Step 2: Register in Main Extensions File
|
|
345
|
-
|
|
346
|
-
**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`.
|
|
347
|
-
|
|
348
|
-
**Without completing Step 2, the site plugin will not be available in the plugin explorer.**
|
|
264
|
+
For App Definition IDs, per-slot runtime APIs, design guidelines, and placement constraints, see [SLOTS.md](site-plugin/SLOTS.md). Run `wix schema generate --type SITE_PLUGIN` for the authoritative `slotId` enum.
|
|
349
265
|
|
|
350
266
|
## Checkout Plugins
|
|
351
267
|
|
|
@@ -10,17 +10,6 @@ This reference lists common event types, SDK imports, permissions, and links. Fo
|
|
|
10
10
|
| Contact updated | `import { contacts } from "@wix/crm"` | `contacts.onContactUpdated(handler)` | `SCOPE.DC-CONTACTS.READ-CONTACTS` | [onContactUpdated](https://dev.wix.com/docs/api-reference/crm/members-contacts/contacts/contacts/contact-v4/contact-updated?apiView=SDK) |
|
|
11
11
|
| Contact deleted | `import { contacts } from "@wix/crm"` | `contacts.onContactDeleted(handler)` | `SCOPE.DC-CONTACTS.READ-CONTACTS` | [onContactDeleted](https://dev.wix.com/docs/api-reference/crm/members-contacts/contacts/contacts/contact-v4/contact-deleted?apiView=SDK) |
|
|
12
12
|
|
|
13
|
-
**Example – contact created:**
|
|
14
|
-
|
|
15
|
-
```typescript
|
|
16
|
-
import { contacts } from "@wix/crm";
|
|
17
|
-
|
|
18
|
-
export default contacts.onContactCreated((event) => {
|
|
19
|
-
const contact = event.entity;
|
|
20
|
-
console.log("New contact:", contact._id, contact.primaryInfo?.email);
|
|
21
|
-
});
|
|
22
|
-
```
|
|
23
|
-
|
|
24
13
|
## eCommerce Events
|
|
25
14
|
|
|
26
15
|
| Event | Import | Handler Call | Permission | API Reference |
|
|
@@ -30,17 +19,6 @@ export default contacts.onContactCreated((event) => {
|
|
|
30
19
|
| Cart created | `import { cart } from "@wix/ecom"` | `cart.onCartCreated(handler)` | `SCOPE.DC-STORES.READ-ORDERS` | [onCartCreated](https://dev.wix.com/docs/api-reference/business-solutions/e-commerce/purchase-flow/cart/cart/cart-created?apiView=SDK) |
|
|
31
20
|
| Cart updated | `import { cart } from "@wix/ecom"` | `cart.onCartUpdated(handler)` | `SCOPE.DC-STORES.READ-ORDERS` | [onCartUpdated](https://dev.wix.com/docs/api-reference/business-solutions/e-commerce/purchase-flow/cart/cart/cart-updated?apiView=SDK) |
|
|
32
21
|
|
|
33
|
-
**Example – order approved:**
|
|
34
|
-
|
|
35
|
-
```typescript
|
|
36
|
-
import { orders } from "@wix/ecom";
|
|
37
|
-
|
|
38
|
-
export default orders.onOrderApproved(async (event) => {
|
|
39
|
-
const order = event.data.order;
|
|
40
|
-
console.log("Order approved:", order._id);
|
|
41
|
-
});
|
|
42
|
-
```
|
|
43
|
-
|
|
44
22
|
## Bookings Events
|
|
45
23
|
|
|
46
24
|
| Event | Import | Handler Call | Permission | API Reference |
|
|
@@ -48,17 +26,6 @@ export default orders.onOrderApproved(async (event) => {
|
|
|
48
26
|
| Booking confirmed | `import { bookings } from "@wix/bookings"` | `bookings.onBookingConfirmed(handler)` | `SCOPE.DC-BOOKINGS.READ-CALENDAR-WITH-PARTICIPANTS` | [onBookingConfirmed](https://dev.wix.com/docs/api-reference/business-solutions/bookings/bookings/bookings-writer-v2/booking-confirmed?apiView=SDK) |
|
|
49
27
|
| Booking canceled | `import { bookings } from "@wix/bookings"` | `bookings.onBookingCanceled(handler)` | `SCOPE.DC-BOOKINGS.READ-CALENDAR-WITH-PARTICIPANTS` | [onBookingCanceled](https://dev.wix.com/docs/api-reference/business-solutions/bookings/bookings/bookings-writer-v2/booking-canceled?apiView=SDK) |
|
|
50
28
|
|
|
51
|
-
**Example – booking confirmed:**
|
|
52
|
-
|
|
53
|
-
```typescript
|
|
54
|
-
import { bookings } from "@wix/bookings";
|
|
55
|
-
|
|
56
|
-
export default bookings.onBookingConfirmed((event) => {
|
|
57
|
-
const booking = event.data.booking;
|
|
58
|
-
console.log("Booking confirmed:", booking._id);
|
|
59
|
-
});
|
|
60
|
-
```
|
|
61
|
-
|
|
62
29
|
## Blog Events
|
|
63
30
|
|
|
64
31
|
| Event | Import | Handler Call | Permission | API Reference |
|
|
@@ -66,17 +33,6 @@ export default bookings.onBookingConfirmed((event) => {
|
|
|
66
33
|
| Post created | `import { posts } from "@wix/blog"` | `posts.onPostCreated(handler)` | `SCOPE.DC-BLOG.READ-BLOGS` | [onPostCreated](https://dev.wix.com/docs/api-reference/business-solutions/blog/posts-stats/post-created?apiView=SDK) |
|
|
67
34
|
| Post updated | `import { posts } from "@wix/blog"` | `posts.onPostUpdated(handler)` | `SCOPE.DC-BLOG.READ-BLOGS` | [onPostUpdated](https://dev.wix.com/docs/api-reference/business-solutions/blog/posts-stats/post-updated?apiView=SDK) |
|
|
68
35
|
|
|
69
|
-
**Example – post created:**
|
|
70
|
-
|
|
71
|
-
```typescript
|
|
72
|
-
import { posts } from "@wix/blog";
|
|
73
|
-
|
|
74
|
-
export default posts.onPostCreated((event) => {
|
|
75
|
-
const post = event.entity;
|
|
76
|
-
console.log("Post created:", post._id, post.title);
|
|
77
|
-
});
|
|
78
|
-
```
|
|
79
|
-
|
|
80
36
|
## Payload Shape
|
|
81
37
|
|
|
82
38
|
The event envelope structure varies by API — the path to the main entity differs (e.g., `event.entity`, `event.data.order`). Use TypeScript and your IDE for autocomplete and type safety. See each event's API reference link above for the exact payload shape.
|