@wix/agent-skills 1.14.0 → 1.15.1
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 +12 -1
- package/package.json +1 -1
- package/skills/README.md +23 -0
- package/skills/wix-app/SKILL.md +10 -2
- package/skills/wix-app/references/AUTO_PATTERNS_DASHBOARD.md +326 -0
- package/skills/wix-app/references/CODE_QUALITY.md +1 -0
- package/skills/wix-app/references/CUSTOM_ELEMENT_WIDGET.md +124 -115
- package/skills/wix-app/references/DASHBOARD_PAGE.md +3 -0
- package/skills/wix-app/references/DATA_COLLECTION.md +5 -3
- package/skills/wix-app/references/EDITOR_REACT_COMPONENT.md +25 -9
- package/skills/wix-app/references/SITE_PLUGIN.md +1 -1
- package/skills/wix-app/references/STORES_VERSIONING.md +9 -211
- package/skills/wix-app/references/auto-patterns-dashboard/action-cell.md +115 -0
- package/skills/wix-app/references/auto-patterns-dashboard/app-config-structure.md +264 -0
- package/skills/wix-app/references/auto-patterns-dashboard/app-context.md +37 -0
- package/skills/wix-app/references/auto-patterns-dashboard/bulk-actions.md +86 -0
- package/skills/wix-app/references/auto-patterns-dashboard/collection-page-actions.md +119 -0
- package/skills/wix-app/references/auto-patterns-dashboard/collection-page.md +103 -0
- package/skills/wix-app/references/auto-patterns-dashboard/custom-actions-override.md +76 -0
- package/skills/wix-app/references/auto-patterns-dashboard/custom-columns-override.md +82 -0
- package/skills/wix-app/references/auto-patterns-dashboard/custom-components-override.md +89 -0
- package/skills/wix-app/references/auto-patterns-dashboard/custom-header-override.md +124 -0
- package/skills/wix-app/references/auto-patterns-dashboard/custom-sections-override.md +91 -0
- package/skills/wix-app/references/auto-patterns-dashboard/custom-slots-override.md +71 -0
- package/skills/wix-app/references/auto-patterns-dashboard/entity-page-actions.md +70 -0
- package/skills/wix-app/references/auto-patterns-dashboard/entity-page-view-actions.md +73 -0
- package/skills/wix-app/references/auto-patterns-dashboard/entity-page.md +98 -0
- package/skills/wix-app/references/auto-patterns-dashboard/example-patterns.json +278 -0
- package/skills/wix-app/references/auto-patterns-dashboard/pages-configuration.md +94 -0
- package/skills/wix-app/references/auto-patterns-dashboard/resolved-action.md +43 -0
- package/skills/wix-app/references/auto-patterns-dashboard/sdk-utilities.md +66 -0
- package/skills/wix-app/references/auto-patterns-dashboard/views.md +76 -0
- package/skills/wix-app/references/backend-event/COMMON-EVENTS.md +5 -0
- package/skills/wix-app/references/editor-react-component/ACCESSIBILITY.md +1 -14
- package/skills/wix-app/references/editor-react-component/ANIMATED-COMPONENTS.md +151 -0
- package/skills/wix-app/references/editor-react-component/COMPONENT-API.md +54 -29
- package/skills/wix-app/references/editor-react-component/COMPONENT-CONFIGURATION.md +2 -2
- package/skills/wix-app/references/editor-react-component/COMPONENT-PREVIEW.md +57 -0
- package/skills/wix-app/references/editor-react-component/CSS-GUIDELINES.md +23 -105
- package/skills/wix-app/references/editor-react-component/DESIGN-STATES.md +127 -0
- package/skills/wix-app/references/editor-react-component/PARTS.md +2 -1
- package/skills/wix-app/references/editor-react-component/REACT-GUIDELINES.md +18 -16
- package/skills/wix-app/references/editor-react-component/REACT-PATTERNS.md +25 -53
- package/skills/wix-app/references/stores/CATEGORIES.md +22 -0
- package/skills/wix-app/references/stores/GET_PRODUCT.md +99 -0
- package/skills/wix-app/references/stores/INVENTORY.md +37 -0
- package/skills/wix-app/references/stores/QUERY.md +87 -0
- package/skills/wix-app/references/stores/WRITE.md +55 -0
- package/skills/wix-app/scripts/generate-auto-patterns.js +510 -0
- package/skills/wix-auth/SKILL.md +12 -0
- package/skills/wix-auth/references/device-flow.md +140 -0
- package/skills/wix-docs/SKILL.md +188 -0
- package/skills/wix-docs/references/API_SPEC_SEARCH.md +213 -0
- package/skills/wix-docs/references/EXTRACTING.md +120 -0
- package/skills/wix-headless/SKILL.md +89 -130
- package/skills/wix-headless/entry/bootstrap.mjs +93 -0
- package/skills/wix-headless/entry/skill.md +76 -0
- package/skills/wix-headless/references/AI_FEATURES.md +178 -0
- package/skills/wix-headless/references/CAPABILITIES.md +86 -0
- package/skills/wix-headless/references/DISCOVERY.md +34 -56
- package/skills/wix-headless/references/DOC_DISCOVERY.md +37 -0
- package/skills/wix-headless/references/FEEDBACK.md +129 -0
- package/skills/wix-headless/references/IMAGE_GENERATION.md +69 -0
- package/skills/wix-headless/references/SDK_HANDOFF.md +99 -0
- package/skills/wix-headless/references/SEED.md +45 -187
- package/skills/wix-headless/references/SETUP.md +32 -103
- package/skills/wix-headless/references/astro.md +98 -0
- package/skills/wix-headless/references/inline-recipes/how-to-code-a-blog.md +196 -0
- package/skills/wix-headless/references/inline-recipes/how-to-code-a-store.md +236 -0
- package/skills/wix-headless/references/inline-recipes/how-to-code-bookings.md +279 -0
- package/skills/wix-headless/references/inline-recipes/how-to-code-cms.md +163 -0
- package/skills/wix-headless/references/inline-recipes/how-to-code-events.md +203 -0
- package/skills/wix-headless/references/inline-recipes/how-to-code-forms.md +222 -0
- package/skills/wix-headless/references/inline-recipes/how-to-code-members-astro.md +124 -0
- package/skills/wix-headless/references/inline-recipes/how-to-code-members-custom-login.md +160 -0
- package/skills/wix-headless/references/inline-recipes/how-to-code-members-non-astro.md +118 -0
- package/skills/wix-headless/references/inline-recipes/how-to-code-portfolio.md +132 -0
- package/skills/wix-headless/references/inline-recipes/how-to-code-pricing-plans.md +124 -0
- package/skills/wix-headless/references/inline-recipes/how-to-code-restaurant-orders.md +188 -0
- package/skills/wix-headless/references/inline-recipes/how-to-code-restaurant-reservations.md +213 -0
- package/skills/wix-headless/references/inline-recipes/how-to-code-restaurants.md +161 -0
- package/skills/wix-headless/references/inline-recipes/setup-blog.md +175 -0
- package/skills/wix-headless/references/inline-recipes/setup-bookings.md +232 -0
- package/skills/wix-headless/references/inline-recipes/setup-cms.md +200 -0
- package/skills/wix-headless/references/inline-recipes/setup-events.md +196 -0
- package/skills/wix-headless/references/inline-recipes/setup-forms.md +174 -0
- package/skills/wix-headless/references/inline-recipes/setup-online-store.md +192 -0
- package/skills/wix-headless/references/inline-recipes/setup-portfolio.md +155 -0
- package/skills/wix-headless/references/inline-recipes/setup-pricing-plans.md +229 -0
- package/skills/wix-headless/references/inline-recipes/setup-restaurant-experiences.md +73 -0
- package/skills/wix-headless/references/inline-recipes/setup-restaurant-orders.md +197 -0
- package/skills/wix-headless/references/inline-recipes/setup-restaurant-reservations.md +136 -0
- package/skills/wix-headless/references/inline-recipes/setup-restaurants.md +152 -0
- package/skills/wix-headless/references/managed/AUTHENTICATION.md +57 -0
- package/skills/wix-headless/references/managed/CONNECT.md +74 -0
- package/skills/wix-headless/references/managed/CREATE.md +130 -0
- package/skills/wix-headless/references/managed/DEPLOYMENT.md +79 -0
- package/skills/wix-headless/references/non-astro.md +59 -0
- package/skills/wix-headless/references/self-managed/AUTHENTICATION.md +22 -0
- package/skills/wix-headless/references/self-managed/DEPLOYMENT.md +15 -0
- package/skills/wix-headless/references/stripe/AUTHENTICATION.md +55 -0
- package/skills/wix-headless/references/stripe/DEPLOYMENT.md +71 -0
- package/skills/wix-manage/SKILL.md +29 -3
- package/skills/wix-manage/references/analytics/query-site-analytics.md +298 -0
- package/skills/wix-manage/references/app-installation/install-wix-apps.md +3 -0
- package/skills/wix-manage/references/bookings/create-and-update-booking-services.md +1 -1
- package/skills/wix-manage/references/bookings/create-booking-service-from-prompt.md +6 -5
- package/skills/wix-manage/references/bookings/create-course-service.md +30 -5
- package/skills/wix-manage/references/bookings/diagnose-availability-issues.md +299 -0
- package/skills/wix-manage/references/cms/cms-schema-management.md +6 -0
- package/skills/wix-manage/references/get-paid/how-to-setup-wix-payments.md +30 -7
- package/skills/wix-manage/references/marketing/create-and-publish-social-post.md +517 -0
- package/skills/wix-manage/references/marketing/generate-and-publish-marketing-plan.md +218 -0
- package/skills/wix-manage/references/rich-content/author-ricos-rich-content.md +249 -0
- package/skills/wix-manage/references/sites/site-import.md +270 -0
- package/skills/wix-manage/references/stores/create-product-from-image.md +8 -6
- package/skills/wix-manage/references/stores/create-product-with-options-catalog-v3.md +57 -0
- package/skills/wix-vibe-headless/SKILL.md +142 -0
- package/skills/wix-vibe-headless/platforms/README.md +22 -0
- package/skills/wix-vibe-headless/platforms/base44.md +142 -0
- package/skills/wix-vibe-headless/platforms/generic.md +87 -0
- package/skills/wix-vibe-headless/references/blog/INSTRUCTIONS.md +128 -0
- package/skills/wix-vibe-headless/references/blog/wix-blog.js +217 -0
- package/skills/wix-vibe-headless/references/bookings/INSTRUCTIONS.md +157 -0
- package/skills/wix-vibe-headless/references/bookings/wix-bookings-checkout.js +147 -0
- package/skills/wix-vibe-headless/references/bookings/wix-bookings-services.js +217 -0
- package/skills/wix-vibe-headless/references/cms/INSTRUCTIONS.md +154 -0
- package/skills/wix-vibe-headless/references/cms/wix-cms.js +186 -0
- package/skills/wix-vibe-headless/references/events/INSTRUCTIONS.md +142 -0
- package/skills/wix-vibe-headless/references/events/wix-events-browse.js +136 -0
- package/skills/wix-vibe-headless/references/events/wix-events-registration.js +187 -0
- package/skills/wix-vibe-headless/references/members/INSTRUCTIONS.md +211 -0
- package/skills/wix-vibe-headless/references/members/wix-members-auth.js +387 -0
- package/skills/wix-vibe-headless/references/portfolio/INSTRUCTIONS.md +111 -0
- package/skills/wix-vibe-headless/references/portfolio/wix-portfolio.js +223 -0
- package/skills/wix-vibe-headless/references/pricing-plans/INSTRUCTIONS.md +127 -0
- package/skills/wix-vibe-headless/references/pricing-plans/wix-pricing-plans.js +157 -0
- package/skills/wix-vibe-headless/references/restaurants/INSTRUCTIONS.md +138 -0
- package/skills/wix-vibe-headless/references/restaurants/wix-restaurants-menu.js +224 -0
- package/skills/wix-vibe-headless/references/restaurants/wix-restaurants-ordering.js +156 -0
- package/skills/wix-vibe-headless/references/restaurants/wix-restaurants-reservations.js +107 -0
- package/skills/wix-vibe-headless/references/shared/wix-client.js +186 -0
- package/skills/wix-vibe-headless/references/storefront/INSTRUCTIONS.md +164 -0
- package/skills/wix-vibe-headless/references/storefront/wix-store-cart.js +147 -0
- package/skills/wix-vibe-headless/references/storefront/wix-store-catalog.js +146 -0
- package/skills/wix-headless/references/BUILD-astro.md +0 -253
- package/skills/wix-headless/references/BUILD-own-build.md +0 -167
- package/skills/wix-headless/references/BUILD.md +0 -105
- package/skills/wix-headless/references/DESIGN_SYSTEM.md +0 -165
- package/skills/wix-headless/references/DISCOVERY-connect.md +0 -55
- package/skills/wix-headless/references/DISCOVERY-create.md +0 -238
- package/skills/wix-headless/references/PLAN-connect.md +0 -19
- package/skills/wix-headless/references/PLAN-create.md +0 -17
- package/skills/wix-headless/references/PLAN.md +0 -92
- package/skills/wix-headless/references/astro/blog/BLOG_PAGES.md +0 -300
- package/skills/wix-headless/references/astro/blog/BLOG_SETUP.md +0 -218
- package/skills/wix-headless/references/astro/bookings/COMPONENTS.md +0 -45
- package/skills/wix-headless/references/astro/bookings/SERVICES_PAGES.md +0 -77
- package/skills/wix-headless/references/astro/cms/CMS_FOUNDATIONS.md +0 -214
- package/skills/wix-headless/references/astro/cms/FAQ_KNOWLEDGE_BASE.md +0 -231
- package/skills/wix-headless/references/astro/cms/PORTFOLIO.md +0 -453
- package/skills/wix-headless/references/astro/cms/RESOURCE_LIBRARY.md +0 -354
- package/skills/wix-headless/references/astro/cms/TEAM_DIRECTORY.md +0 -299
- package/skills/wix-headless/references/astro/designer/INSTRUCTIONS.md +0 -351
- package/skills/wix-headless/references/astro/ecom/CART_PAGES.md +0 -119
- package/skills/wix-headless/references/astro/ecom/CART_WIRING.md +0 -103
- package/skills/wix-headless/references/astro/ecom/COMPONENTS_CSS.md +0 -132
- package/skills/wix-headless/references/astro/forms/CONTACT_FORM.md +0 -463
- package/skills/wix-headless/references/astro/gift-cards/COMPONENTS.md +0 -119
- package/skills/wix-headless/references/astro/gift-cards/PAGES.md +0 -129
- package/skills/wix-headless/references/astro/stores/BACK_IN_STOCK.md +0 -178
- package/skills/wix-headless/references/astro/stores/CATEGORY_PAGES.md +0 -85
- package/skills/wix-headless/references/astro/stores/COMPONENTS_CSS.md +0 -129
- package/skills/wix-headless/references/astro/stores/HOME_AND_NAV.md +0 -229
- package/skills/wix-headless/references/astro/stores/PRODUCT_PAGES.md +0 -215
- package/skills/wix-headless/references/astro/stores/SHARED_WIRING.md +0 -165
- package/skills/wix-headless/references/astro/templates/Layout.astro +0 -132
- package/skills/wix-headless/references/astro/templates/astro.config.mjs +0 -41
- package/skills/wix-headless/references/astro/templates/bookings/AvailabilityCalendar.tsx +0 -374
- package/skills/wix-headless/references/astro/templates/bookings/BookingForm.tsx +0 -136
- package/skills/wix-headless/references/astro/templates/bookings/SeoTags.astro +0 -25
- package/skills/wix-headless/references/astro/templates/bookings/ServiceBookingFlow.tsx +0 -71
- package/skills/wix-headless/references/astro/templates/bookings/ServiceCard.astro +0 -54
- package/skills/wix-headless/references/astro/templates/bookings/booking-confirmation.astro +0 -49
- package/skills/wix-headless/references/astro/templates/bookings/bookingDriver.ts +0 -245
- package/skills/wix-headless/references/astro/templates/bookings/components-bookings.css +0 -424
- package/skills/wix-headless/references/astro/templates/bookings/services/[slug].astro +0 -176
- package/skills/wix-headless/references/astro/templates/bookings/services/index.astro +0 -181
- package/skills/wix-headless/references/astro/templates/ecom/CartBadge.tsx +0 -84
- package/skills/wix-headless/references/astro/templates/ecom/CartView.tsx +0 -543
- package/skills/wix-headless/references/astro/templates/ecom/cart.astro +0 -13
- package/skills/wix-headless/references/astro/templates/ecom/components-ecom.css +0 -302
- package/skills/wix-headless/references/astro/templates/ecom/discounts.ts +0 -71
- package/skills/wix-headless/references/astro/templates/ecom/thank-you.astro +0 -24
- package/skills/wix-headless/references/astro/templates/gift-cards/GiftCardPurchase.tsx +0 -172
- package/skills/wix-headless/references/astro/templates/gift-cards/_home-teaser-snippet.astro +0 -42
- package/skills/wix-headless/references/astro/templates/gift-cards/_nav-snippet.astro +0 -11
- package/skills/wix-headless/references/astro/templates/gift-cards/components-gift-cards.css +0 -220
- package/skills/wix-headless/references/astro/templates/gift-cards/gift-cards.astro +0 -51
- package/skills/wix-headless/references/astro/templates/gift-cards/gift-cards.ts +0 -75
- package/skills/wix-headless/references/astro/templates/global.css +0 -288
- package/skills/wix-headless/references/astro/templates/stores/AddToCartButton.tsx +0 -77
- package/skills/wix-headless/references/astro/templates/stores/BackInStockForm.tsx +0 -176
- package/skills/wix-headless/references/astro/templates/stores/CategoryRail.astro +0 -69
- package/skills/wix-headless/references/astro/templates/stores/ProductCard.astro +0 -79
- package/skills/wix-headless/references/astro/templates/stores/ProductPurchase.tsx +0 -397
- package/skills/wix-headless/references/astro/templates/stores/SeoTags.astro +0 -21
- package/skills/wix-headless/references/astro/templates/stores/back-in-stock.ts +0 -67
- package/skills/wix-headless/references/astro/templates/stores/categories.ts +0 -155
- package/skills/wix-headless/references/astro/templates/stores/category/[slug].astro +0 -130
- package/skills/wix-headless/references/astro/templates/stores/components-stores.css +0 -400
- package/skills/wix-headless/references/astro/templates/stores/products/[slug].astro +0 -128
- package/skills/wix-headless/references/astro/templates/stores/products/index.astro +0 -101
- package/skills/wix-headless/references/blog/BLOG_CONTENT.md +0 -161
- package/skills/wix-headless/references/blog/INSTRUCTIONS.md +0 -32
- package/skills/wix-headless/references/bookings/FLOW.md +0 -246
- package/skills/wix-headless/references/bookings/INSTRUCTIONS.md +0 -95
- package/skills/wix-headless/references/bookings/SERVICES_DATA.md +0 -355
- package/skills/wix-headless/references/cms/CMS_FOUNDATIONS.md +0 -176
- package/skills/wix-headless/references/cms/INSTRUCTIONS.md +0 -71
- package/skills/wix-headless/references/commands/known-apps.json +0 -6
- package/skills/wix-headless/references/custom/CONNECTION_PLAN.md +0 -142
- package/skills/wix-headless/references/custom/INSTRUCTIONS.md +0 -88
- package/skills/wix-headless/references/custom/blog/WIRING.md +0 -52
- package/skills/wix-headless/references/custom/bookings/WIRING.md +0 -197
- package/skills/wix-headless/references/custom/cms/WIRING.md +0 -97
- package/skills/wix-headless/references/custom/ecom/WIRING.md +0 -67
- package/skills/wix-headless/references/custom/forms/WIRING.md +0 -101
- package/skills/wix-headless/references/custom/stores/WIRING.md +0 -80
- package/skills/wix-headless/references/ecom/INSTRUCTIONS.md +0 -59
- package/skills/wix-headless/references/forms/INSTRUCTIONS.md +0 -43
- package/skills/wix-headless/references/gift-cards/INSTRUCTIONS.md +0 -51
- package/skills/wix-headless/references/images/INSTRUCTIONS.md +0 -357
- package/skills/wix-headless/references/seed-recipes.md +0 -49
- package/skills/wix-headless/references/shared/AGENTS_MD.md +0 -47
- package/skills/wix-headless/references/shared/AUTHENTICATION.md +0 -108
- package/skills/wix-headless/references/shared/BUILD_NOISE.md +0 -8
- package/skills/wix-headless/references/shared/DESIGN_MD.md +0 -84
- package/skills/wix-headless/references/shared/DOCS_SEARCH.md +0 -41
- package/skills/wix-headless/references/shared/IMAGE_GENERATION.md +0 -186
- package/skills/wix-headless/references/shared/IMPLEMENTER.md +0 -206
- package/skills/wix-headless/references/shared/PRODUCTION_SHARP_EDGES.md +0 -97
- package/skills/wix-headless/references/shared/RETURN_CONTRACT.md +0 -143
- package/skills/wix-headless/references/shared/STYLING.md +0 -140
- package/skills/wix-headless/references/stores/INSTRUCTIONS.md +0 -126
- package/skills/wix-headless/references/stores/PRODUCT_CATALOG_DATA.md +0 -252
- package/skills/wix-headless/references/verticals/_schema.json +0 -74
- package/skills/wix-headless/references/verticals/_schema.md +0 -95
- package/skills/wix-headless/references/verticals/blog.md +0 -31
- package/skills/wix-headless/references/verticals/bookings.md +0 -41
- package/skills/wix-headless/references/verticals/cms.md +0 -30
- package/skills/wix-headless/references/verticals/ecom.md +0 -25
- package/skills/wix-headless/references/verticals/forms.md +0 -26
- package/skills/wix-headless/references/verticals/gift-cards.md +0 -24
- package/skills/wix-headless/references/verticals/stores.md +0 -33
- package/skills/wix-headless/scripts/check-manifest.mjs +0 -335
- package/skills/wix-headless/scripts/compose.mjs +0 -520
- package/skills/wix-headless/scripts/emit-design-tokens.mjs +0 -157
- package/skills/wix-headless/scripts/flatten.sh +0 -61
- package/skills/wix-headless/scripts/generate-images.mjs +0 -242
- package/skills/wix-headless/scripts/patch-decorative-slots.mjs +0 -154
- package/skills/wix-headless/scripts/plan-entity-image-waves.mjs +0 -190
- package/skills/wix-headless/scripts/scaffold.sh +0 -139
- package/skills/wix-headless/scripts/seed-utilities.sh +0 -93
- package/skills/wix-headless/scripts/write-decorative-json.mjs +0 -62
- package/skills/wix-headless/shared-utilities/analytics.ts +0 -40
- package/skills/wix-headless/shared-utilities/ricos.ts +0 -179
- package/skills/wix-headless/shared-utilities/wix-image.ts +0 -72
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
# Bulk Actions Rules
|
|
2
|
+
|
|
3
|
+
## Type Definitions
|
|
4
|
+
```typescript
|
|
5
|
+
interface BulkActionToolbar {
|
|
6
|
+
primaryActions?: BulkActionGroup[];
|
|
7
|
+
secondaryActions?: (BulkActionItem | DividerItem)[];
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
type BulkActionGroup = | { type: 'action'; action: { item: BulkActionItem } } | { type: 'menu'; menu: { label: string; items: (BulkActionItem | DividerItem)[] } };
|
|
11
|
+
|
|
12
|
+
interface DividerItem {
|
|
13
|
+
type: 'divider';
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
interface BulkActionItem {
|
|
17
|
+
id: string; // Must match custom resolver name
|
|
18
|
+
type: 'bulkDelete' | 'custom';
|
|
19
|
+
label?: string;
|
|
20
|
+
biName: string; // MANDATORY
|
|
21
|
+
bulkDelete?: {
|
|
22
|
+
mode: 'modal';
|
|
23
|
+
modal: {
|
|
24
|
+
title?: { text?: string; id?: string };
|
|
25
|
+
description?: { text: string };
|
|
26
|
+
actions?: { submit?: { text: string }; cancel?: { text: string } };
|
|
27
|
+
feedback?: { successToast?: { text: string }; errorToast?: { text: string } };
|
|
28
|
+
};
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
type CustomBulkActionsActionResolver = (params: {
|
|
33
|
+
actionParams: { selectedValues: any[]; total: number };
|
|
34
|
+
sdk: AutoPatternsSDK;
|
|
35
|
+
}) => ResolvedAction;
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
## Validation Logic
|
|
39
|
+
- **IF** `type: 'bulkDelete'` **THEN** `bulkDelete.mode: 'modal'` is **REQUIRED**.
|
|
40
|
+
- **IF** `type: 'custom'` **THEN** resolver implementation is **REQUIRED**.
|
|
41
|
+
- **IF** `primaryActions` AND `secondaryActions` both undefined **THEN** toolbar invalid.
|
|
42
|
+
|
|
43
|
+
## Implementation Rules
|
|
44
|
+
- **MUST** include `biName` for all bulk actions (`bulk-{action}-action`).
|
|
45
|
+
- **MUST** place toolbar configuration inside `table` or `grid` object.
|
|
46
|
+
- **MUST** use `CustomBulkActionsActionResolver` type for custom logic.
|
|
47
|
+
- **MUST** register custom resolvers in `AutoPatternsOverridesProvider`.
|
|
48
|
+
- **MUST** use `errorHandler` for Wix API calls in resolvers.
|
|
49
|
+
- **NEVER** use default navigation in bulk actions; implement explicitly.
|
|
50
|
+
|
|
51
|
+
## Canonical Example
|
|
52
|
+
```typescript
|
|
53
|
+
// Config
|
|
54
|
+
bulkActionToolbar: {
|
|
55
|
+
primaryActions: [{
|
|
56
|
+
type: 'action',
|
|
57
|
+
action: {
|
|
58
|
+
item: {
|
|
59
|
+
id: 'bulkDelete',
|
|
60
|
+
type: 'bulkDelete',
|
|
61
|
+
label: 'Delete',
|
|
62
|
+
biName: 'bulk-delete-action',
|
|
63
|
+
bulkDelete: { mode: 'modal', modal: {} }
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}],
|
|
67
|
+
secondaryActions: [
|
|
68
|
+
{
|
|
69
|
+
id: 'bulkExport',
|
|
70
|
+
type: 'custom',
|
|
71
|
+
label: 'Export',
|
|
72
|
+
biName: 'bulk-export-action'
|
|
73
|
+
}
|
|
74
|
+
]
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
// Resolver
|
|
78
|
+
export const bulkExport: CustomBulkActionsActionResolver = ({ actionParams }) => ({
|
|
79
|
+
label: 'Export',
|
|
80
|
+
icon: <Download />,
|
|
81
|
+
biName: 'bulk-export-action',
|
|
82
|
+
onClick: () => {
|
|
83
|
+
// Logic using actionParams.selectedValues
|
|
84
|
+
}
|
|
85
|
+
});
|
|
86
|
+
```
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
# Collection Page Action Rules
|
|
2
|
+
|
|
3
|
+
## Type Definitions
|
|
4
|
+
```typescript
|
|
5
|
+
interface CollectionPageActions {
|
|
6
|
+
primaryActions?: ActionGroup;
|
|
7
|
+
secondaryActions?: ActionGroup;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
type ActionGroup = | { type: 'action'; action: { item: ActionItem } } | { type: 'menu'; menu: { label: string; items: (ActionItem | DividerItem)[] } };
|
|
11
|
+
|
|
12
|
+
interface DividerItem {
|
|
13
|
+
type: 'divider';
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
interface ActionItem {
|
|
17
|
+
id: string; // Must match custom resolver name if custom
|
|
18
|
+
type: 'create' | 'custom';
|
|
19
|
+
label?: string;
|
|
20
|
+
biName: string; // MANDATORY
|
|
21
|
+
collection?: {
|
|
22
|
+
collectionId: string;
|
|
23
|
+
entityTypeSource: 'cms' | 'custom';
|
|
24
|
+
};
|
|
25
|
+
create?: {
|
|
26
|
+
mode: 'page';
|
|
27
|
+
page: { id: string };
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
// Row Click Action (Table level)
|
|
32
|
+
interface OnRowClickConfig {
|
|
33
|
+
id: string;
|
|
34
|
+
type: 'custom';
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
// Row Click Resolver Signature - NOTE: item is nested under actionParams
|
|
38
|
+
type CustomActionCollectionPageActionOnRowClickResolver = (params: {
|
|
39
|
+
actionParams: { item: any }; // The clicked row's data - nested under actionParams
|
|
40
|
+
sdk: AutoPatternsSDK;
|
|
41
|
+
}) => ResolvedAction;
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
## Validation Logic
|
|
45
|
+
- **IF** `type: 'create'` **THEN** `create` config with `page.id` is **REQUIRED**.
|
|
46
|
+
- **IF** `type: 'custom'` **THEN** `id` must match a registered resolver name.
|
|
47
|
+
- **IF** `onRowClick` is configured **THEN** matching `custom` resolver is **MANDATORY**.
|
|
48
|
+
- **IF** `onRowClick` is configured **THEN** default navigation is **DISABLED**.
|
|
49
|
+
- **IF** `onRowClick` resolver accesses row data **THEN** use `actionParams.item` (NOT direct `item` param).
|
|
50
|
+
|
|
51
|
+
## Implementation Rules
|
|
52
|
+
- **MUST** include a `create` action in `primaryActions` for every collection page.
|
|
53
|
+
- **MUST** include `biName` for every action (kebab-case).
|
|
54
|
+
- **MUST** implement custom resolvers using `CustomActionCollectionPageActionResolver`.
|
|
55
|
+
- **MUST** implement row click resolvers using `CustomActionCollectionPageActionOnRowClickResolver` returning `ResolvedAction`.
|
|
56
|
+
- **MUST** place onRowClick resolvers in `components/actions/` folder (same as other custom actions).
|
|
57
|
+
- **MUST** register onRowClick resolvers via `useActions` hook pattern (see **custom_actions_override**).
|
|
58
|
+
- **NEVER** mix `create` logic with `custom` action types.
|
|
59
|
+
- **NEVER** assume `schema` or `optimisticActions` exist without checking.
|
|
60
|
+
|
|
61
|
+
## Canonical Example
|
|
62
|
+
```typescript
|
|
63
|
+
{
|
|
64
|
+
primaryActions: {
|
|
65
|
+
type: 'action',
|
|
66
|
+
action: {
|
|
67
|
+
item: {
|
|
68
|
+
id: 'create-pet',
|
|
69
|
+
type: 'create',
|
|
70
|
+
label: 'Add Pet',
|
|
71
|
+
biName: 'create-pet-action',
|
|
72
|
+
collection: { collectionId: 'pets', entityTypeSource: 'cms' },
|
|
73
|
+
create: {
|
|
74
|
+
mode: 'page',
|
|
75
|
+
page: { id: 'pet-details' }
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
},
|
|
80
|
+
secondaryActions: {
|
|
81
|
+
type: 'menu',
|
|
82
|
+
menu: {
|
|
83
|
+
label: 'More',
|
|
84
|
+
items: [
|
|
85
|
+
{
|
|
86
|
+
id: 'exportCollection',
|
|
87
|
+
type: 'custom',
|
|
88
|
+
label: 'Export',
|
|
89
|
+
biName: 'export-action',
|
|
90
|
+
collection: { collectionId: 'pets', entityTypeSource: 'cms' }
|
|
91
|
+
}
|
|
92
|
+
]
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
## Canonical Example (onRowClick)
|
|
99
|
+
```typescript
|
|
100
|
+
// Config
|
|
101
|
+
{
|
|
102
|
+
"onRowClick": {
|
|
103
|
+
"id": "myRowClickAction",
|
|
104
|
+
"type": "custom"
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
// Resolver (if custom) - see custom_actions_override for full registration pattern
|
|
109
|
+
export const myRowClickAction: CustomActionCollectionPageActionOnRowClickResolver = ({
|
|
110
|
+
actionParams: { item }, // item is nested under actionParams
|
|
111
|
+
}) => ({
|
|
112
|
+
label: 'Custom Action',
|
|
113
|
+
icon: <MyIcon />,
|
|
114
|
+
biName: 'my-row-click-action',
|
|
115
|
+
onClick: () => {
|
|
116
|
+
// Custom onClick logic using item
|
|
117
|
+
}
|
|
118
|
+
});
|
|
119
|
+
```
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
# Collection Page Rules
|
|
2
|
+
|
|
3
|
+
## Type Definitions
|
|
4
|
+
```typescript
|
|
5
|
+
interface CollectionComponent {
|
|
6
|
+
type: 'collection';
|
|
7
|
+
entityPageId: string; // REQUIRED for navigation
|
|
8
|
+
collection: {
|
|
9
|
+
collectionId: string;
|
|
10
|
+
entityTypeSource: 'cms' | 'custom';
|
|
11
|
+
custom?: { id: string };
|
|
12
|
+
};
|
|
13
|
+
layout: LayoutItem[];
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
type LayoutItem = TableLayout | GridLayout;
|
|
17
|
+
|
|
18
|
+
interface TableLayout {
|
|
19
|
+
type: 'Table';
|
|
20
|
+
table: {
|
|
21
|
+
columns: ColumnConfig[];
|
|
22
|
+
customColumns?: { enabled: boolean };
|
|
23
|
+
stickyColumns?: number;
|
|
24
|
+
showTitleBar?: boolean;
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
interface ColumnConfig {
|
|
29
|
+
id: string; // Field ID
|
|
30
|
+
name: string; // Display title
|
|
31
|
+
width: string;
|
|
32
|
+
tooltipContent?: string; // Info icon text
|
|
33
|
+
sortable?: boolean;
|
|
34
|
+
hideable?: boolean;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
interface GridLayout {
|
|
38
|
+
type: 'Grid';
|
|
39
|
+
grid: {
|
|
40
|
+
item: {
|
|
41
|
+
titleFieldId: string; // REQUIRED Field ID
|
|
42
|
+
subtitleFieldId?: string; // Field ID
|
|
43
|
+
imageFieldId?: string; // Field ID
|
|
44
|
+
cardContentMode?: 'full' | 'title' | 'empty';
|
|
45
|
+
};
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
## Validation Logic
|
|
51
|
+
- **IF** `components` array length != 1 **THEN** Invalid Config (Must be exactly 1).
|
|
52
|
+
- **IF** `layout` contains both 'Table' and 'Grid' **THEN** View Switcher is automatically enabled.
|
|
53
|
+
- **IF** `columns` count > 5 **THEN** `customColumns.enabled` = `true`.
|
|
54
|
+
- **IF** `columns` count <= 5 **THEN** `customColumns.enabled` = `false` (unless explicitly requested).
|
|
55
|
+
- **IF** `type` is 'Grid' **THEN** `titleFieldId` is **REQUIRED**.
|
|
56
|
+
|
|
57
|
+
## Implementation Rules
|
|
58
|
+
- **MUST** reference `entityPageId` to link rows/cards to the entity page.
|
|
59
|
+
- **MUST** select max 3 columns initially for the table.
|
|
60
|
+
- **MUST** use `tooltipContent` to explain complex column data.
|
|
61
|
+
- **SHOULD** include a primary action with `type: 'update'` in Grid view to allow easy editing.
|
|
62
|
+
- **NEVER** use `onRowClick` unless custom behavior (not entity page navigation) is explicitly required.
|
|
63
|
+
|
|
64
|
+
## Canonical Example
|
|
65
|
+
```typescript
|
|
66
|
+
{
|
|
67
|
+
type: 'collectionPage',
|
|
68
|
+
// ... page props
|
|
69
|
+
components: [
|
|
70
|
+
{
|
|
71
|
+
type: 'collection',
|
|
72
|
+
entityPageId: 'pet-details', // Links to entity page
|
|
73
|
+
collection: {
|
|
74
|
+
collectionId: 'pets',
|
|
75
|
+
entityTypeSource: 'cms'
|
|
76
|
+
},
|
|
77
|
+
layout: [
|
|
78
|
+
{
|
|
79
|
+
type: 'Table',
|
|
80
|
+
table: {
|
|
81
|
+
columns: [
|
|
82
|
+
{ id: 'name', name: 'Name', width: '200px', tooltipContent: 'Pet Name' },
|
|
83
|
+
{ id: 'breed', name: 'Breed', width: '150px' },
|
|
84
|
+
{ id: 'age', name: 'Age', width: '100px' }
|
|
85
|
+
],
|
|
86
|
+
customColumns: { enabled: false }
|
|
87
|
+
}
|
|
88
|
+
},
|
|
89
|
+
{
|
|
90
|
+
type: 'Grid',
|
|
91
|
+
grid: {
|
|
92
|
+
item: {
|
|
93
|
+
titleFieldId: 'name',
|
|
94
|
+
subtitleFieldId: 'breed',
|
|
95
|
+
imageFieldId: 'photo'
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
]
|
|
100
|
+
}
|
|
101
|
+
]
|
|
102
|
+
}
|
|
103
|
+
```
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
# Custom Actions Override Rules
|
|
2
|
+
|
|
3
|
+
**REQUIRED**: After creating action files, you MUST update `page.tsx` to register them.
|
|
4
|
+
|
|
5
|
+
## Type Definitions
|
|
6
|
+
```typescript
|
|
7
|
+
interface ResolvedAction {
|
|
8
|
+
label: string;
|
|
9
|
+
icon?: React.ReactElement;
|
|
10
|
+
onClick: () => void | Promise<void>;
|
|
11
|
+
disabled?: boolean;
|
|
12
|
+
hidden?: boolean;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
// Action Resolver Signature
|
|
16
|
+
type CustomActionResolver = (params: {
|
|
17
|
+
item: any;
|
|
18
|
+
selectedItems?: any[];
|
|
19
|
+
}) => ResolvedAction;
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
## Configuration Schema
|
|
23
|
+
```json
|
|
24
|
+
{
|
|
25
|
+
"actions": [
|
|
26
|
+
{
|
|
27
|
+
"type": "custom",
|
|
28
|
+
"id": "myAction" // Matches override key
|
|
29
|
+
}
|
|
30
|
+
]
|
|
31
|
+
}
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
## Validation Logic
|
|
35
|
+
- **IF** `type` is `"custom"` **THEN** `id` MUST match key in `actions` override.
|
|
36
|
+
- **IF** action is async **THEN** `onClick` SHOULD return a Promise.
|
|
37
|
+
- **IF** action requires selection **THEN** check `selectedItems`.
|
|
38
|
+
|
|
39
|
+
## Implementation Rules
|
|
40
|
+
- **MUST** be placed in `components/actions/` folder.
|
|
41
|
+
- **MUST** use `.tsx` extension if the file contains JSX (icons, React elements). Use `.ts` only for pure logic files.
|
|
42
|
+
- **MUST** export `useActions` hook from `components/actions/index.tsx`.
|
|
43
|
+
- **MUST** return `ResolvedAction` object.
|
|
44
|
+
- **MUST** handle errors (use `try/catch` or `errorHandler` for Wix APIs).
|
|
45
|
+
- **APPLIES TO** all custom action types: actionCell, collectionPageActions, onRowClick, bulkActions.
|
|
46
|
+
- **NEVER** place action resolvers directly in page.tsx or overrides.tsx - always use components/actions/ folder.
|
|
47
|
+
|
|
48
|
+
## Canonical Example
|
|
49
|
+
```tsx
|
|
50
|
+
// components/actions/myAction.tsx (use .tsx when file contains JSX like icons)
|
|
51
|
+
export const myAction = ({ item }) => ({
|
|
52
|
+
label: 'Approve',
|
|
53
|
+
icon: <Check />,
|
|
54
|
+
onClick: async () => {
|
|
55
|
+
await approveItem(item.id);
|
|
56
|
+
}
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
// components/actions/index.tsx
|
|
60
|
+
import { myAction } from './myAction';
|
|
61
|
+
export const useActions = () => ({ myAction });
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
## page.tsx Registration (REQUIRED)
|
|
65
|
+
|
|
66
|
+
**CRITICAL: PRESERVE EXISTING OVERRIDES** - Do NOT remove existing overrides. ADD this new one alongside them.
|
|
67
|
+
|
|
68
|
+
```tsx
|
|
69
|
+
// 1. Add import (keep all existing imports)
|
|
70
|
+
import { useActions } from './components/actions';
|
|
71
|
+
|
|
72
|
+
// 2. Add hook call (keep all existing hook calls)
|
|
73
|
+
const actions = useActions();
|
|
74
|
+
|
|
75
|
+
// 3. Add actions to PatternsWizardOverridesProvider value (keep ALL existing overrides)
|
|
76
|
+
```
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
# Custom Columns Override Rules
|
|
2
|
+
|
|
3
|
+
**REQUIRED**: After creating column files, you MUST update `page.tsx` to register them.
|
|
4
|
+
|
|
5
|
+
## Type Definitions
|
|
6
|
+
```typescript
|
|
7
|
+
interface IColumnValue<T> {
|
|
8
|
+
value: T; // The individual column value
|
|
9
|
+
row: Record<string, any>; // The entire row object containing all field values
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
// Override Function Signature
|
|
13
|
+
type ColumnOverride<T> = (props: IColumnValue<T>) => React.ReactNode;
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
## Configuration Schema
|
|
17
|
+
```json
|
|
18
|
+
{
|
|
19
|
+
"type": "collectionPage",
|
|
20
|
+
"collectionPage": {
|
|
21
|
+
"components": [
|
|
22
|
+
{
|
|
23
|
+
"layout": [
|
|
24
|
+
{
|
|
25
|
+
"type": "Table",
|
|
26
|
+
"table": {
|
|
27
|
+
"columns": [
|
|
28
|
+
{
|
|
29
|
+
"id": "myCustomColumn" // Matches key in override object
|
|
30
|
+
}
|
|
31
|
+
]
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
]
|
|
35
|
+
}
|
|
36
|
+
]
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
## Validation Logic
|
|
42
|
+
- **IF** overriding a column **THEN** function name MUST match the `column.id` in AppConfig.
|
|
43
|
+
- **IF** needing React hooks (useState, useEffect) **THEN** MUST wrap implementation in a separate React component and return it.
|
|
44
|
+
- **IF** accessing row data **THEN** MUST use exact field IDs from schema as keys on `row` object.
|
|
45
|
+
- **NEVER** use React hooks directly inside the column override function (it is a render function, not a component).
|
|
46
|
+
|
|
47
|
+
## Implementation Rules
|
|
48
|
+
- **MUST** be placed in `components/columns/` folder.
|
|
49
|
+
- **MUST** export a `useColumns` hook from `components/columns/index.tsx`.
|
|
50
|
+
- **MUST** import type `IColumnValue` from `@wix/auto-patterns` for type safety.
|
|
51
|
+
- **MUST** return a ReactNode (JSX) or null.
|
|
52
|
+
|
|
53
|
+
## Canonical Example
|
|
54
|
+
```tsx
|
|
55
|
+
// components/columns/status.tsx
|
|
56
|
+
import type { IColumnValue } from '@wix/auto-patterns';
|
|
57
|
+
import { Badge } from '@wix/design-system';
|
|
58
|
+
|
|
59
|
+
export function status({ value, row }: IColumnValue<string>) {
|
|
60
|
+
// Pure rendering logic - NO HOOKS here
|
|
61
|
+
const skin = value === 'Active' ? 'success' : 'danger';
|
|
62
|
+
return <Badge skin={skin}>{value}</Badge>;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
// components/columns/index.tsx
|
|
66
|
+
import { status } from './status';
|
|
67
|
+
export const useColumns = () => ({ status });
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
## page.tsx Registration (REQUIRED)
|
|
71
|
+
|
|
72
|
+
**CRITICAL: PRESERVE EXISTING OVERRIDES** - Do NOT remove existing overrides. ADD this new one alongside them.
|
|
73
|
+
|
|
74
|
+
```tsx
|
|
75
|
+
// 1. Add import (keep all existing imports)
|
|
76
|
+
import { useColumns } from './components/columns';
|
|
77
|
+
|
|
78
|
+
// 2. Add hook call (keep all existing hook calls)
|
|
79
|
+
const columns = useColumns();
|
|
80
|
+
|
|
81
|
+
// 3. Add columns to PatternsWizardOverridesProvider value (keep ALL existing overrides)
|
|
82
|
+
```
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
# Custom Components Override Rules
|
|
2
|
+
|
|
3
|
+
**REQUIRED**: After creating component files, you MUST update `page.tsx` to register them.
|
|
4
|
+
|
|
5
|
+
## Type Definitions
|
|
6
|
+
```typescript
|
|
7
|
+
interface CustomComponentProps {
|
|
8
|
+
form: UseFormReturn; // react-hook-form instance
|
|
9
|
+
entity: Record<string, any>; // Initial entity state (static)
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
// Override Component Signature
|
|
13
|
+
type CustomComponent = React.FC<CustomComponentProps>;
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
## Configuration Schema
|
|
17
|
+
```json
|
|
18
|
+
{
|
|
19
|
+
"layout": [
|
|
20
|
+
{
|
|
21
|
+
"type": "Form",
|
|
22
|
+
"form": {
|
|
23
|
+
"groups": [
|
|
24
|
+
{
|
|
25
|
+
"fields": [
|
|
26
|
+
{
|
|
27
|
+
"id": "myCustomField",
|
|
28
|
+
"type": "custom",
|
|
29
|
+
"componentId": "myCustomComponent" // Matches override key
|
|
30
|
+
}
|
|
31
|
+
]
|
|
32
|
+
}
|
|
33
|
+
]
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
]
|
|
37
|
+
}
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
## Validation Logic
|
|
41
|
+
- **IF** overriding an input field **THEN** MUST use `useController` from `@wix/patterns/form` to bind to form state.
|
|
42
|
+
- **IF** needing reactivity **THEN** MUST use `form.watch()`, NEVER rely on `entity` prop for updates (it is initial state only).
|
|
43
|
+
- **IF** implementing a standalone widget (not input) **THEN** can use `entity` for display-only static data.
|
|
44
|
+
- **NEVER** import `useController` from `react-hook-form` directly; use `@wix/patterns/form`.
|
|
45
|
+
|
|
46
|
+
## Implementation Rules
|
|
47
|
+
- **MUST** be placed in `components/customComponents/` folder.
|
|
48
|
+
- **MUST** export a `useComponents` hook from `components/customComponents/index.tsx`.
|
|
49
|
+
- **MUST** handle form state (invalid, error message, onChange) properly via controller.
|
|
50
|
+
|
|
51
|
+
## Canonical Example
|
|
52
|
+
```tsx
|
|
53
|
+
// components/customComponents/CustomInput.tsx
|
|
54
|
+
import { useController } from '@wix/patterns/form';
|
|
55
|
+
import type { CustomComponentProps } from '@wix/auto-patterns';
|
|
56
|
+
import { Input, FormField } from '@wix/design-system';
|
|
57
|
+
|
|
58
|
+
export const CustomInput: React.FC<CustomComponentProps> = ({ form, entity }) => {
|
|
59
|
+
const { field, fieldState } = useController({
|
|
60
|
+
name: 'title', // Matches schema field ID
|
|
61
|
+
control: form.control,
|
|
62
|
+
defaultValue: entity?.title
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
return (
|
|
66
|
+
<FormField label="Title" status={fieldState.error ? 'error' : undefined}>
|
|
67
|
+
<Input {...field} />
|
|
68
|
+
</FormField>
|
|
69
|
+
);
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
// components/customComponents/index.tsx
|
|
73
|
+
import { CustomInput } from './CustomInput';
|
|
74
|
+
export const useComponents = () => ({ CustomInput });
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
## page.tsx Registration (REQUIRED)
|
|
78
|
+
|
|
79
|
+
**CRITICAL: PRESERVE EXISTING OVERRIDES** - Do NOT remove existing overrides. ADD this new one alongside them.
|
|
80
|
+
|
|
81
|
+
```tsx
|
|
82
|
+
// 1. Add import (keep all existing imports)
|
|
83
|
+
import { useComponents } from './components/customComponents';
|
|
84
|
+
|
|
85
|
+
// 2. Add hook call (keep all existing hook calls)
|
|
86
|
+
const components = useComponents();
|
|
87
|
+
|
|
88
|
+
// 3. Add components to PatternsWizardOverridesProvider value (keep ALL existing overrides)
|
|
89
|
+
```
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
# Custom Entity Header Override Rules
|
|
2
|
+
|
|
3
|
+
**REQUIRED**: After creating header override files, you MUST update `page.tsx` to register them.
|
|
4
|
+
|
|
5
|
+
## Type Definitions
|
|
6
|
+
```typescript
|
|
7
|
+
// Subtitle Override
|
|
8
|
+
type SubtitleResolver = (entity: Record<string, any>) => { text: string };
|
|
9
|
+
|
|
10
|
+
// Badge Override
|
|
11
|
+
interface BadgeObject {
|
|
12
|
+
text: string; // Required: Text to display
|
|
13
|
+
skin?: BadgeSkin; // Optional: Visual styling
|
|
14
|
+
prefixIcon?: React.ReactElement; // Optional: Icon before text (from @wix/wix-ui-icons-common)
|
|
15
|
+
suffixIcon?: React.ReactElement; // Optional: Icon after text (from @wix/wix-ui-icons-common)
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
type BadgeSkin = 'success' | 'warning' | 'destructive' | 'neutral' | 'premium';
|
|
19
|
+
|
|
20
|
+
type BadgesResolver = (entity: Record<string, any>) => BadgeObject[];
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## Configuration Schema
|
|
24
|
+
```json
|
|
25
|
+
{
|
|
26
|
+
"entityPage": {
|
|
27
|
+
"title": {
|
|
28
|
+
"text": "Entity Details",
|
|
29
|
+
"badges": {
|
|
30
|
+
"id": "entityPageHeaderBadges" // Must match override key
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
"subtitle": {
|
|
34
|
+
"text": "Default subtitle text",
|
|
35
|
+
"id": "entityPageHeaderSubtitle" // Must match override key
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
## Validation Logic
|
|
42
|
+
- **IF** overriding subtitle **THEN** function MUST return `{ text: string }` object.
|
|
43
|
+
- **IF** overriding badges **THEN** function MUST return array of `BadgeObject` (NOT JSX components).
|
|
44
|
+
- **IF** `badges.id` or `subtitle.id` defined in config **THEN** matching override MUST exist.
|
|
45
|
+
- **IF** logic depends on entity data **THEN** check for field existence (entity might be partial).
|
|
46
|
+
- **IF** `id` in config does not match override key **THEN** override will not render.
|
|
47
|
+
|
|
48
|
+
## Implementation Rules
|
|
49
|
+
- **MUST** be placed in `components/entityPageHeaderSubtitle/` or `components/entityPageHeaderBadges/`.
|
|
50
|
+
- **MUST** export `useEntityPageHeaderSubtitle` / `useEntityPageHeaderBadges` hooks from respective index files.
|
|
51
|
+
- **MUST** be pure functions (no hooks inside the resolver functions).
|
|
52
|
+
- **MUST** ensure `id` in config matches the key in override object exactly.
|
|
53
|
+
- **NEVER** return JSX from badge/subtitle functions (return data objects only).
|
|
54
|
+
|
|
55
|
+
## Canonical Example
|
|
56
|
+
|
|
57
|
+
### 1. Subtitle Override
|
|
58
|
+
```typescript
|
|
59
|
+
// components/entityPageHeaderSubtitle/entityPageHeaderSubtitle.ts
|
|
60
|
+
export const entityPageHeaderSubtitle = (entity: Record<string, any>) => {
|
|
61
|
+
return { text: `Created by ${entity.owner || 'Unknown'} on ${entity.date || 'N/A'}` };
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
// components/entityPageHeaderSubtitle/index.ts
|
|
65
|
+
import { entityPageHeaderSubtitle } from './entityPageHeaderSubtitle';
|
|
66
|
+
export const useEntityPageHeaderSubtitle = () => ({ entityPageHeaderSubtitle });
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
### 2. Badges Override
|
|
70
|
+
```typescript
|
|
71
|
+
// components/entityPageHeaderBadges/entityPageHeaderBadges.ts
|
|
72
|
+
export const entityPageHeaderBadges = (entity: Record<string, any>) => {
|
|
73
|
+
const badges = [];
|
|
74
|
+
|
|
75
|
+
// Add status badge
|
|
76
|
+
if (entity.isActive) {
|
|
77
|
+
badges.push({ text: 'Active', skin: 'success' });
|
|
78
|
+
} else {
|
|
79
|
+
badges.push({ text: 'Inactive', skin: 'neutral' });
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
// Add premium badge if applicable
|
|
83
|
+
if (entity.isPremium) {
|
|
84
|
+
badges.push({ text: 'Premium', skin: 'premium' });
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
// Add warning badge if needed
|
|
88
|
+
if (entity.needsAttention) {
|
|
89
|
+
badges.push({ text: 'Needs Attention', skin: 'warning' });
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
return badges;
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
// components/entityPageHeaderBadges/index.ts
|
|
96
|
+
import { entityPageHeaderBadges } from './entityPageHeaderBadges';
|
|
97
|
+
export const useEntityPageHeaderBadges = () => ({ entityPageHeaderBadges });
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
## page.tsx Registration (REQUIRED)
|
|
101
|
+
|
|
102
|
+
**CRITICAL: PRESERVE EXISTING OVERRIDES** - Do NOT remove existing overrides. ADD this new one alongside them.
|
|
103
|
+
|
|
104
|
+
### For Subtitle Override:
|
|
105
|
+
```tsx
|
|
106
|
+
// 1. Add import (keep all existing imports)
|
|
107
|
+
import { useEntityPageHeaderSubtitle } from './components/entityPageHeaderSubtitle';
|
|
108
|
+
|
|
109
|
+
// 2. Add hook call (keep all existing hook calls)
|
|
110
|
+
const entityPageHeaderSubtitle = useEntityPageHeaderSubtitle();
|
|
111
|
+
|
|
112
|
+
// 3. Add entityPageHeaderSubtitle to AutoPatternsOverridesProvider value (keep ALL existing overrides)
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
### For Badges Override:
|
|
116
|
+
```tsx
|
|
117
|
+
// 1. Add import (keep all existing imports)
|
|
118
|
+
import { useEntityPageHeaderBadges } from './components/entityPageHeaderBadges';
|
|
119
|
+
|
|
120
|
+
// 2. Add hook call (keep all existing hook calls)
|
|
121
|
+
const entityPageHeaderBadges = useEntityPageHeaderBadges();
|
|
122
|
+
|
|
123
|
+
// 3. Add entityPageHeaderBadges to AutoPatternsOverridesProvider value (keep ALL existing overrides)
|
|
124
|
+
```
|