@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
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
|
|
2
1
|
# Wix Stores Catalog Versioning (V1 / V3)
|
|
3
2
|
|
|
4
3
|
Wix Stores has two catalog versions that are **NOT backwards compatible**. Apps **must support both** — single-version apps cannot list in the App Market and break on new sites.
|
|
@@ -82,214 +81,6 @@ Handle `STORES_NOT_INSTALLED` gracefully — return empty results, do not throw.
|
|
|
82
81
|
|
|
83
82
|
---
|
|
84
83
|
|
|
85
|
-
## Copy-Paste Recipes
|
|
86
|
-
|
|
87
|
-
Each recipe handles both versions. `V3Product` and V1 `Product` types are **not** re-exported from `@wix/stores` top-level — let TS infer or use structural types.
|
|
88
|
-
|
|
89
|
-
### List products with pagination
|
|
90
|
-
|
|
91
|
-
Both versions expose a fluent query builder, but the paging method differs:
|
|
92
|
-
|
|
93
|
-
| Aspect | V1 (`products.queryProducts()`) | V3 (`productsV3.queryProducts()`) |
|
|
94
|
-
|--------|--------------------------------|----------------------------------|
|
|
95
|
-
| API style | Fluent builder: `.skip().limit().find()` | Fluent builder: `.skipTo(cursor).limit().find()` |
|
|
96
|
-
| Pagination | Offset (`.skip(n)`) | Cursor (`.skipTo(cursor)`) |
|
|
97
|
-
| Result `items` | `res.items` (V1 `Product[]`) | `res.items` (V3 `Product[]`) |
|
|
98
|
-
| Total count | `res.totalCount` | **None** — V3 only has `cursors.next` + `hasNext()` |
|
|
99
|
-
| `hasNext` | `res.hasNext()` (method) | `res.hasNext()` (method) |
|
|
100
|
-
| Next cursor | n/a | `res.cursors.next` (string) |
|
|
101
|
-
|
|
102
|
-
```typescript
|
|
103
|
-
import { catalogVersioning, products, productsV3 } from '@wix/stores';
|
|
104
|
-
|
|
105
|
-
export interface ProductsPage {
|
|
106
|
-
products: unknown[]; // narrow at call site
|
|
107
|
-
nextCursor: string | null; // V3 only
|
|
108
|
-
hasNext: boolean;
|
|
109
|
-
totalCount: number | null; // V1 only
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
export async function listProductsPage(
|
|
113
|
-
limit: number,
|
|
114
|
-
cursorOrSkip: string | number | undefined,
|
|
115
|
-
): Promise<ProductsPage> {
|
|
116
|
-
const v = await getVersion();
|
|
117
|
-
if (v === 'STORES_NOT_INSTALLED') {
|
|
118
|
-
return { products: [], nextCursor: null, hasNext: false, totalCount: 0 };
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
if (v === 'V3_CATALOG') {
|
|
122
|
-
let builder = productsV3.queryProducts().limit(limit);
|
|
123
|
-
if (typeof cursorOrSkip === 'string') builder = builder.skipTo(cursorOrSkip);
|
|
124
|
-
// Do NOT chain a sort — see gotcha #10.
|
|
125
|
-
const res = await builder.find();
|
|
126
|
-
return {
|
|
127
|
-
products: res.items,
|
|
128
|
-
nextCursor: res.cursors.next ?? null,
|
|
129
|
-
hasNext: res.hasNext(),
|
|
130
|
-
totalCount: null,
|
|
131
|
-
};
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
const skip = typeof cursorOrSkip === 'number' ? cursorOrSkip : 0;
|
|
135
|
-
const res = await products.queryProducts().skip(skip).limit(limit).find();
|
|
136
|
-
return {
|
|
137
|
-
products: res.items,
|
|
138
|
-
nextCursor: null,
|
|
139
|
-
hasNext: res.hasNext(),
|
|
140
|
-
totalCount: res.totalCount ?? null,
|
|
141
|
-
};
|
|
142
|
-
}
|
|
143
|
-
```
|
|
144
|
-
|
|
145
|
-
> **Two ways to call V3 `queryProducts`:** the canonical builder shown above, and a direct-call form `productsV3.queryProducts({ cursorPaging: { limit, cursor } })` returning a `Promise<{ products, pagingMetadata }>`. Both compile and run, but the builder is more idiomatic and matches V1's shape.
|
|
146
|
-
|
|
147
|
-
### Display price/stock without fetching variants
|
|
148
|
-
|
|
149
|
-
V3 `queryProducts` does not return variants. Read product-level rollup fields instead:
|
|
150
|
-
|
|
151
|
-
```typescript
|
|
152
|
-
function displayPrice(p: { actualPriceRange?: { minValue?: { amount?: string }; maxValue?: { amount?: string } } }): string {
|
|
153
|
-
const min = p.actualPriceRange?.minValue?.amount;
|
|
154
|
-
const max = p.actualPriceRange?.maxValue?.amount;
|
|
155
|
-
if (!min) return '—';
|
|
156
|
-
return max && max !== min ? `${min} – ${max}` : min;
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
function stockLabel(status: string | undefined): string {
|
|
160
|
-
switch (status) {
|
|
161
|
-
case 'IN_STOCK': return 'In Stock';
|
|
162
|
-
case 'OUT_OF_STOCK': return 'Out of Stock';
|
|
163
|
-
case 'PARTIALLY_OUT_OF_STOCK': return 'Limited';
|
|
164
|
-
case 'PREORDER': return 'Pre-order';
|
|
165
|
-
default: return '—';
|
|
166
|
-
}
|
|
167
|
-
}
|
|
168
|
-
// V1 path: product.stock.inventoryStatus (same UPPER_SNAKE_CASE values)
|
|
169
|
-
// V3 path: product.inventory.availabilityStatus (adds PREORDER)
|
|
170
|
-
// SKU lives on the variant — show "—" in lists, or use Read-Only Variants API.
|
|
171
|
-
```
|
|
172
|
-
|
|
173
|
-
### Get a single product
|
|
174
|
-
|
|
175
|
-
```typescript
|
|
176
|
-
if (v === 'V3_CATALOG') {
|
|
177
|
-
const product = await productsV3.getProduct(id); // returns Product directly
|
|
178
|
-
return product;
|
|
179
|
-
}
|
|
180
|
-
const { product } = await products.getProduct(id); // V1 wraps in { product }
|
|
181
|
-
return product;
|
|
182
|
-
```
|
|
183
|
-
|
|
184
|
-
### Create a product (single-variant, with price)
|
|
185
|
-
|
|
186
|
-
```typescript
|
|
187
|
-
if (v === 'V3_CATALOG') {
|
|
188
|
-
const product = await productsV3.createProduct({
|
|
189
|
-
name: 'My Product',
|
|
190
|
-
productType: 'PHYSICAL', // UPPER_CASE
|
|
191
|
-
variantsInfo: {
|
|
192
|
-
variants: [{
|
|
193
|
-
price: { actualPrice: { amount: '19.99' } }, // string, on the variant
|
|
194
|
-
sku: 'SKU-001',
|
|
195
|
-
}],
|
|
196
|
-
},
|
|
197
|
-
});
|
|
198
|
-
return product;
|
|
199
|
-
}
|
|
200
|
-
|
|
201
|
-
const { product } = await products.createProduct({
|
|
202
|
-
name: 'My Product',
|
|
203
|
-
productType: 'physical', // lower-case
|
|
204
|
-
priceData: { price: 19.99 }, // number, on the product
|
|
205
|
-
sku: 'SKU-001',
|
|
206
|
-
});
|
|
207
|
-
return product;
|
|
208
|
-
```
|
|
209
|
-
|
|
210
|
-
### Update a product (V3 needs `revision`)
|
|
211
|
-
|
|
212
|
-
```typescript
|
|
213
|
-
if (v === 'V3_CATALOG') {
|
|
214
|
-
// Signature: updateProduct(_id, productFields). Returns Product directly.
|
|
215
|
-
const current = await productsV3.getProduct(id);
|
|
216
|
-
if (current.revision == null) throw new Error(`Product ${id} has no revision`);
|
|
217
|
-
return await productsV3.updateProduct(id, {
|
|
218
|
-
revision: current.revision, // narrowed — required under exactOptionalPropertyTypes
|
|
219
|
-
name: 'New name',
|
|
220
|
-
});
|
|
221
|
-
}
|
|
222
|
-
// V1: updateProduct(id, productFields). Returns { product }.
|
|
223
|
-
const { product } = await products.updateProduct(id, { name: 'New name' });
|
|
224
|
-
return product;
|
|
225
|
-
```
|
|
226
|
-
|
|
227
|
-
### Delete a product
|
|
228
|
-
|
|
229
|
-
```typescript
|
|
230
|
-
if (v === 'V3_CATALOG') await productsV3.deleteProduct(id);
|
|
231
|
-
else await products.deleteProduct(id);
|
|
232
|
-
```
|
|
233
|
-
|
|
234
|
-
### Inventory: increment stock
|
|
235
|
-
|
|
236
|
-
```typescript
|
|
237
|
-
import { inventory, inventoryItemsV3 } from '@wix/stores';
|
|
238
|
-
|
|
239
|
-
if (v === 'V3_CATALOG') {
|
|
240
|
-
// Per-variant; flat shape.
|
|
241
|
-
await inventoryItemsV3.bulkIncrementInventoryItems([
|
|
242
|
-
{ inventoryItemId, incrementBy: 5 },
|
|
243
|
-
]);
|
|
244
|
-
} else {
|
|
245
|
-
// Per-product (variant optional).
|
|
246
|
-
await inventory.incrementInventory([
|
|
247
|
-
{ productId, variantId, incrementBy: 5 },
|
|
248
|
-
]);
|
|
249
|
-
}
|
|
250
|
-
```
|
|
251
|
-
|
|
252
|
-
To find a V3 inventory item ID, use `inventoryItemsV3.searchInventoryItems` filtered by `productId` / `variantId`.
|
|
253
|
-
|
|
254
|
-
### Query inventory
|
|
255
|
-
|
|
256
|
-
```typescript
|
|
257
|
-
if (v === 'V3_CATALOG') {
|
|
258
|
-
const res = await inventoryItemsV3.queryInventoryItems().eq('productId', productId).find();
|
|
259
|
-
return res.items;
|
|
260
|
-
}
|
|
261
|
-
// V1: filter is a JSON-stringified expression.
|
|
262
|
-
const res = await inventory.queryInventory({
|
|
263
|
-
query: { filter: JSON.stringify({ productId }) },
|
|
264
|
-
});
|
|
265
|
-
return res.inventoryItems;
|
|
266
|
-
```
|
|
267
|
-
|
|
268
|
-
### Collections (V1) ↔ Categories (V3)
|
|
269
|
-
|
|
270
|
-
```typescript
|
|
271
|
-
// V1 write ops (createCollection, updateCollection, addProductsToCollection, …)
|
|
272
|
-
// live on the `products` namespace, NOT `collections`. The `collections` namespace is read-only.
|
|
273
|
-
import { products } from '@wix/stores';
|
|
274
|
-
import { categories } from '@wix/categories';
|
|
275
|
-
|
|
276
|
-
if (v === 'V3_CATALOG') {
|
|
277
|
-
// V3 createCategory(category, options). treeReference is REQUIRED and goes in `options`.
|
|
278
|
-
// For Wix Stores categories: appNamespace MUST be the literal "@wix/stores", treeKey is null.
|
|
279
|
-
const category = await categories.createCategory(
|
|
280
|
-
{ name: 'Sale' },
|
|
281
|
-
{ treeReference: { appNamespace: '@wix/stores', treeKey: null } },
|
|
282
|
-
);
|
|
283
|
-
return category;
|
|
284
|
-
}
|
|
285
|
-
const { collection } = await products.createCollection({ name: 'Sale' }); // V1 returns { collection }
|
|
286
|
-
return collection;
|
|
287
|
-
```
|
|
288
|
-
|
|
289
|
-
V3 categories are tree-structured. Reference them on a product via `directCategories[]`, not `collectionIds[]`. **All Stores category API calls must pass `treeReference: { appNamespace: '@wix/stores', treeKey: null }` in `options`** — applies to `createCategory`, `updateCategory`, `queryCategories`, etc.
|
|
290
|
-
|
|
291
|
-
---
|
|
292
|
-
|
|
293
84
|
## V1 → V3 Field Mapping (most common)
|
|
294
85
|
|
|
295
86
|
For the full table see the [Catalog V1 to V3 Migration Guide](https://dev.wix.com/docs/api-reference/business-solutions/stores/catalog-v3/catalog-v1-to-v3-migration-guide?apiView=SDK).
|
|
@@ -311,6 +102,7 @@ For the full table see the [Catalog V1 to V3 Migration Guide](https://dev.wix.co
|
|
|
311
102
|
| `collectionIds[i]` | `directCategories[i].id` |
|
|
312
103
|
| `ribbon`, `brand` (string) | `ribbon.name`, `brand.name` (managed via `ribbonsV3` / `brandsV3`) |
|
|
313
104
|
| `media.mainMedia.image.url` (main image URL) | `media.main.image ?? media.main.url` — in V3, `ProductMedia.image` is a `string` (Wix-hosted URL), `url` is a `string` (external URL); check both |
|
|
105
|
+
| `lastUpdated` | `updatedDate` |
|
|
314
106
|
|
|
315
107
|
**Pricing model** — V1 had a `discount` object; V3 removed it. Discounts are now expressed by the relationship between two fields on the variant: `actualPrice` (required, what the customer pays) vs `compareAtPrice` (optional, original price shown struck through). With discount: V1 `price`/`discountedPrice` → V3 `compareAtPrice`/`actualPrice`. Without discount: V1 `price` → V3 `actualPrice`, leave `compareAtPrice` empty.
|
|
316
108
|
|
|
@@ -330,6 +122,12 @@ Payload changes: V1 `changedFields` → V3 `modifiedFields`. Top-level `entityId
|
|
|
330
122
|
|
|
331
123
|
---
|
|
332
124
|
|
|
333
|
-
##
|
|
125
|
+
## Detailed references
|
|
126
|
+
|
|
127
|
+
- [stores/QUERY.md](stores/QUERY.md) — list/query products, pagination, price and stock display
|
|
128
|
+
- [stores/GET_PRODUCT.md](stores/GET_PRODUCT.md) — getProduct, options/choices, modifiers, variant choices
|
|
129
|
+
- [stores/WRITE.md](stores/WRITE.md) — create, update, delete products
|
|
130
|
+
- [stores/INVENTORY.md](stores/INVENTORY.md) — inventory read and write operations
|
|
131
|
+
- [stores/CATEGORIES.md](stores/CATEGORIES.md) — collections (V1) ↔ categories (V3)
|
|
334
132
|
|
|
335
|
-
|
|
133
|
+
For methods not listed here, use `SearchWixSDKDocumentation` then `ReadFullDocsArticle`. Always return the required permission scopes to the user.
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
# ActionCell Rules
|
|
2
|
+
|
|
3
|
+
## Type Definitions
|
|
4
|
+
```typescript
|
|
5
|
+
interface ActionCellConfig {
|
|
6
|
+
primaryAction?: SinglePrimary | MultiplePrimary;
|
|
7
|
+
secondaryActions?: {
|
|
8
|
+
items: (ActionCellItem | DividerItem)[];
|
|
9
|
+
inlineCount?: number;
|
|
10
|
+
inlineAlwaysVisible?: boolean;
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
interface SinglePrimary {
|
|
15
|
+
item: ActionCellItem;
|
|
16
|
+
alwaysVisible?: boolean;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
interface MultiplePrimary {
|
|
20
|
+
items: ActionCellItem[];
|
|
21
|
+
alwaysVisible?: boolean;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
interface ActionCellItem {
|
|
25
|
+
id: string; // Matches resolver if custom
|
|
26
|
+
type: 'update' | 'delete' | 'custom';
|
|
27
|
+
label?: string;
|
|
28
|
+
biName: string; // MANDATORY
|
|
29
|
+
skin?: 'standard' | 'inverted' | 'premium' | 'dark' | 'destructive';
|
|
30
|
+
update?: { mode: 'page'; page: { id: string } };
|
|
31
|
+
delete?: { mode: 'modal'; modal: ModalConfig };
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
interface DividerItem {
|
|
35
|
+
type: 'divider';
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
// Primary cell action resolver — primary actions don't accept `icon`; use `prefixIcon`/`suffixIcon`.
|
|
39
|
+
type CustomActionCellPrimaryActionResolver = (params: {
|
|
40
|
+
actionParams: { item: any };
|
|
41
|
+
sdk: AutoPatternsSDK;
|
|
42
|
+
}) => ResolvedActionCellPrimaryAction;
|
|
43
|
+
// ResolvedActionCellPrimaryAction = Omit<ResolvedAction, 'icon'> & { prefixIcon?: IconElement; suffixIcon?: IconElement }
|
|
44
|
+
|
|
45
|
+
// Secondary cell action resolver — uses standard ResolvedAction (with `icon`).
|
|
46
|
+
type CustomActionCellSecondaryActionResolver = (params: {
|
|
47
|
+
actionParams: { item: any };
|
|
48
|
+
sdk: AutoPatternsSDK;
|
|
49
|
+
}) => ResolvedAction;
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
## Validation Logic
|
|
53
|
+
- **IF** `type: 'update'` **THEN** `update` config with `page.id` is **REQUIRED**.
|
|
54
|
+
- **IF** `type: 'delete'` **THEN** `delete.mode: 'modal'` is **REQUIRED**.
|
|
55
|
+
- **IF** `type: 'custom'` **THEN** resolver implementation is **REQUIRED**.
|
|
56
|
+
- **IF** `type: 'custom'` **THEN** resolver MUST be registered via override pattern (see **custom_actions_override**).
|
|
57
|
+
- **IF** using `secondaryActions.inlineCount` **THEN** value MUST be <= items count.
|
|
58
|
+
|
|
59
|
+
## Implementation Rules
|
|
60
|
+
- **MUST** include `biName` for every action (`{action-purpose}-action`).
|
|
61
|
+
- **MUST** place `actionCell` at component level (sibling to `collection`), NOT inside `table`/`grid`.
|
|
62
|
+
- **MUST** implement custom resolvers using `CustomActionCellPrimaryActionResolver` (for primary actions) or `CustomActionCellSecondaryActionResolver` (for secondary actions).
|
|
63
|
+
- **MUST** use `errorHandler` for Wix API calls in resolvers.
|
|
64
|
+
- **SHOULD** use `multiplePrimary` for 2-3 equally important actions.
|
|
65
|
+
- **NEVER** use `primaryAction` inside `secondaryActions`.
|
|
66
|
+
- **NEVER** use `actionResolvers` prop on `AutoPatternsApp` - this prop does not exist.
|
|
67
|
+
- **NEVER** create resolver files outside `components/actions/` folder.
|
|
68
|
+
|
|
69
|
+
## Canonical Example
|
|
70
|
+
```typescript
|
|
71
|
+
// Config
|
|
72
|
+
actionCell: {
|
|
73
|
+
primaryAction: {
|
|
74
|
+
item: {
|
|
75
|
+
id: 'editItem',
|
|
76
|
+
type: 'update',
|
|
77
|
+
label: 'Edit',
|
|
78
|
+
biName: 'edit-action',
|
|
79
|
+
skin: 'standard',
|
|
80
|
+
update: { mode: 'page', page: { id: 'edit-page' } }
|
|
81
|
+
},
|
|
82
|
+
alwaysVisible: true
|
|
83
|
+
},
|
|
84
|
+
secondaryActions: {
|
|
85
|
+
items: [
|
|
86
|
+
{
|
|
87
|
+
id: 'deleteItem',
|
|
88
|
+
type: 'delete',
|
|
89
|
+
label: 'Delete',
|
|
90
|
+
biName: 'delete-action',
|
|
91
|
+
skin: 'destructive',
|
|
92
|
+
delete: { mode: 'modal', modal: {} }
|
|
93
|
+
}
|
|
94
|
+
]
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
// Resolvers (if custom) - see custom_actions_override for full registration pattern
|
|
99
|
+
|
|
100
|
+
// Primary action resolver: use prefixIcon (icon is not allowed on primary cell actions)
|
|
101
|
+
export const myPrimaryAction: CustomActionCellPrimaryActionResolver = ({ actionParams }) => ({
|
|
102
|
+
label: 'Custom',
|
|
103
|
+
prefixIcon: <MyIcon />,
|
|
104
|
+
biName: 'custom-action',
|
|
105
|
+
onClick: () => console.log(actionParams.item)
|
|
106
|
+
});
|
|
107
|
+
|
|
108
|
+
// Secondary action resolver: uses icon
|
|
109
|
+
export const mySecondaryAction: CustomActionCellSecondaryActionResolver = ({ actionParams }) => ({
|
|
110
|
+
label: 'Custom',
|
|
111
|
+
icon: <MyIcon />,
|
|
112
|
+
biName: 'custom-action',
|
|
113
|
+
onClick: () => console.log(actionParams.item)
|
|
114
|
+
});
|
|
115
|
+
```
|
|
@@ -0,0 +1,264 @@
|
|
|
1
|
+
# AppConfig Rules
|
|
2
|
+
|
|
3
|
+
## Type Definitions
|
|
4
|
+
```typescript
|
|
5
|
+
export interface AppConfig {
|
|
6
|
+
pages: PageConfig[];
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
type PageConfig = CollectionPageConfig | EntityPageConfig;
|
|
10
|
+
|
|
11
|
+
interface PageBase {
|
|
12
|
+
id: string; // Unique across app
|
|
13
|
+
appMainPage?: boolean; // ONE page must be true
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
interface CollectionPageConfig extends PageBase {
|
|
17
|
+
type: 'collectionPage';
|
|
18
|
+
collectionPage: {
|
|
19
|
+
route: { path: string };
|
|
20
|
+
title: { text: string; hideTotal?: boolean };
|
|
21
|
+
subtitle?: { text: string };
|
|
22
|
+
actions?: PageActions;
|
|
23
|
+
components: [CollectionComponent | CustomComponent]; // EXACTLY ONE component with layout
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
interface EntityPageConfig extends PageBase {
|
|
28
|
+
type: 'entityPage';
|
|
29
|
+
entityPage: {
|
|
30
|
+
mode?: 'edit' | 'view'; // Default 'edit'
|
|
31
|
+
route: { path: string; params: { id: string } };
|
|
32
|
+
title?: { text: string; badges?: { id?: string } };
|
|
33
|
+
subtitle?: { text: string; id?: string };
|
|
34
|
+
actions?: EntityPageActions;
|
|
35
|
+
parentPageId?: string; // ID of parent collection page
|
|
36
|
+
collectionId: string;
|
|
37
|
+
entityTypeSource: 'cms' | 'custom';
|
|
38
|
+
custom?: { id: string }; // REQUIRED if entityTypeSource='custom'
|
|
39
|
+
layout?: {
|
|
40
|
+
main: CardLayout[];
|
|
41
|
+
sidebar?: CardLayout[];
|
|
42
|
+
};
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
// Action Types
|
|
47
|
+
interface PageActions {
|
|
48
|
+
primaryActions?: ActionGroup;
|
|
49
|
+
secondaryActions?: ActionGroup;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
interface EntityPageActions {
|
|
53
|
+
primaryActions?: ActionGroup; // View mode only
|
|
54
|
+
secondaryActions?: ActionGroup; // View mode only
|
|
55
|
+
moreActions?: CustomAction[]; // Both modes
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
type ActionGroup = { type: 'action'; action?: { item: ActionItem } } | { type: 'menu'; menu?: { label: string; items: ActionItem[] } };
|
|
59
|
+
|
|
60
|
+
interface ActionItem {
|
|
61
|
+
id: string;
|
|
62
|
+
type: 'create' | 'update' | 'delete' | 'custom' | 'bulkDelete';
|
|
63
|
+
label?: string;
|
|
64
|
+
biName: string; // MANDATORY
|
|
65
|
+
skin?: string;
|
|
66
|
+
disabled?: boolean;
|
|
67
|
+
tooltip?: string;
|
|
68
|
+
collection?: CollectionSource; // For create action
|
|
69
|
+
create?: { mode: 'page'; page: { id: string } };
|
|
70
|
+
update?: { mode: 'page'; page: { id: string } };
|
|
71
|
+
delete?: { mode: 'modal'; modal: ModalConfig };
|
|
72
|
+
bulkDelete?: { mode: 'modal'; modal: ModalConfig };
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
// Component Types
|
|
76
|
+
interface CollectionComponent {
|
|
77
|
+
type: 'collection';
|
|
78
|
+
entityPageId?: string;
|
|
79
|
+
collection: CollectionSettings;
|
|
80
|
+
filters?: FilterConfig;
|
|
81
|
+
actionCell?: ActionCellConfig;
|
|
82
|
+
bulkActionToolbar?: BulkActionToolbar;
|
|
83
|
+
toolbarTitle?: ToolbarTitle;
|
|
84
|
+
views?: ViewsConfig;
|
|
85
|
+
search?: { shown?: boolean };
|
|
86
|
+
emptyState?: EmptyStateConfig;
|
|
87
|
+
dragAndDrop?: { enabled: boolean; dragAndDropCancel?: { id?: string } };
|
|
88
|
+
layout: [TableLayout, GridLayout];
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
interface CustomComponent {
|
|
92
|
+
type: 'custom';
|
|
93
|
+
id: string;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
// Sub-Types
|
|
97
|
+
interface CollectionSource {
|
|
98
|
+
collectionId: string;
|
|
99
|
+
entityTypeSource: 'cms' | 'custom';
|
|
100
|
+
custom?: { id: string };
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
interface CollectionSettings extends CollectionSource {
|
|
104
|
+
reflectQueryInUrl?: boolean;
|
|
105
|
+
selectAllScope?: 'page' | 'all';
|
|
106
|
+
selectionUpdateMode?: 'preserve' | 'clear';
|
|
107
|
+
paginationMode?: 'cursor' | 'offset';
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
interface TableLayout {
|
|
111
|
+
type: 'Table';
|
|
112
|
+
table?: {
|
|
113
|
+
columns: ColumnConfig[];
|
|
114
|
+
customColumns?: { enabled: boolean };
|
|
115
|
+
dataExtension?: { enabled: boolean };
|
|
116
|
+
stickyColumns?: number;
|
|
117
|
+
showTitleBar?: boolean;
|
|
118
|
+
};
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
interface GridLayout {
|
|
122
|
+
type: 'Grid';
|
|
123
|
+
grid?: {
|
|
124
|
+
item: {
|
|
125
|
+
titleFieldId: string;
|
|
126
|
+
subtitleFieldId?: string;
|
|
127
|
+
imageFieldId?: string;
|
|
128
|
+
cardContentMode?: 'full' | 'title' | 'empty';
|
|
129
|
+
imagePlacement?: 'top' | 'side';
|
|
130
|
+
};
|
|
131
|
+
};
|
|
132
|
+
}
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
## Validation Logic
|
|
136
|
+
- **IF** `entityTypeSource` is `'custom'` **THEN** `custom: { id: "..." }` is **REQUIRED**.
|
|
137
|
+
- **IF** `type: 'collectionPage'` **THEN** `collectionPage` object is **REQUIRED**, `entityPage` object is **FORBIDDEN**.
|
|
138
|
+
- **IF** `type: 'entityPage'` **THEN** `entityPage` object is **REQUIRED**, `collectionPage` object is **FORBIDDEN**.
|
|
139
|
+
- **IF** `type: 'action'` **THEN** `action` property is **REQUIRED**.
|
|
140
|
+
- **IF** `type: 'menu'` **THEN** `menu` property is **REQUIRED**.
|
|
141
|
+
- **IF** action type is `'create'` **THEN** `create` config is **REQUIRED**.
|
|
142
|
+
- **IF** action type is `'update'` **THEN** `update` config is **REQUIRED**.
|
|
143
|
+
- **IF** action type is `'delete'` **THEN** `delete` config is **REQUIRED**.
|
|
144
|
+
|
|
145
|
+
## Implementation Rules
|
|
146
|
+
- **MUST** include `biName` in EVERY action configuration (format: kebab-case, `{action-purpose}-action`).
|
|
147
|
+
- **MUST** designate exactly ONE page as `appMainPage: true`.
|
|
148
|
+
- **MUST** use TypeScript for configuration.
|
|
149
|
+
- **NEVER** fill optional fields unless explicitly requested.
|
|
150
|
+
- **NEVER** mix page types in a single configuration.
|
|
151
|
+
- **NEVER** set `stickyColumns` to negative, zero, or > column count.
|
|
152
|
+
- **NEVER** invent enum values; ASK user for values.
|
|
153
|
+
|
|
154
|
+
## page.tsx Structure
|
|
155
|
+
```tsx
|
|
156
|
+
import React from 'react';
|
|
157
|
+
import { WixDesignSystemProvider } from '@wix/design-system';
|
|
158
|
+
import '@wix/design-system/styles.global.css';
|
|
159
|
+
import { WixPatternsProvider } from '@wix/patterns/provider';
|
|
160
|
+
import { PatternsWizardOverridesProvider, AutoPatternsApp, type AppConfig } from '@wix/auto-patterns';
|
|
161
|
+
import { withDashboard } from '@wix/patterns';
|
|
162
|
+
import config from './patterns.json';
|
|
163
|
+
|
|
164
|
+
const Index: React.FC = () => {
|
|
165
|
+
return (
|
|
166
|
+
<WixDesignSystemProvider features={{ newColorsBranding: true }}>
|
|
167
|
+
<WixPatternsProvider>
|
|
168
|
+
<PatternsWizardOverridesProvider value={{}}>
|
|
169
|
+
<AutoPatternsApp configuration={config as AppConfig} />
|
|
170
|
+
</PatternsWizardOverridesProvider>
|
|
171
|
+
</WixPatternsProvider>
|
|
172
|
+
</WixDesignSystemProvider>
|
|
173
|
+
);
|
|
174
|
+
};
|
|
175
|
+
|
|
176
|
+
export default withDashboard(Index);
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
## Canonical Example
|
|
180
|
+
```typescript
|
|
181
|
+
export const config: AppConfig = {
|
|
182
|
+
pages: [
|
|
183
|
+
{
|
|
184
|
+
id: "product-list",
|
|
185
|
+
type: "collectionPage",
|
|
186
|
+
appMainPage: true,
|
|
187
|
+
collectionPage: {
|
|
188
|
+
route: { path: "/" },
|
|
189
|
+
title: { text: "Products" },
|
|
190
|
+
actions: {
|
|
191
|
+
primaryActions: {
|
|
192
|
+
type: "action",
|
|
193
|
+
action: {
|
|
194
|
+
item: {
|
|
195
|
+
id: "create-product",
|
|
196
|
+
type: "create",
|
|
197
|
+
label: "Add Product",
|
|
198
|
+
biName: "create-product-action",
|
|
199
|
+
collection: {
|
|
200
|
+
collectionId: "products",
|
|
201
|
+
entityTypeSource: "cms"
|
|
202
|
+
},
|
|
203
|
+
create: {
|
|
204
|
+
mode: "page",
|
|
205
|
+
page: { id: "product-details" }
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
},
|
|
211
|
+
components: [
|
|
212
|
+
{
|
|
213
|
+
type: "collection",
|
|
214
|
+
entityPageId: "product-details",
|
|
215
|
+
collection: {
|
|
216
|
+
collectionId: "products",
|
|
217
|
+
entityTypeSource: "cms"
|
|
218
|
+
},
|
|
219
|
+
layout: [
|
|
220
|
+
{
|
|
221
|
+
type: "Table",
|
|
222
|
+
table: {
|
|
223
|
+
columns: [
|
|
224
|
+
{ id: "name", name: "Name", width: "200px" },
|
|
225
|
+
{ id: "price", name: "Price", width: "100px" }
|
|
226
|
+
]
|
|
227
|
+
}
|
|
228
|
+
},
|
|
229
|
+
{
|
|
230
|
+
type: "Grid",
|
|
231
|
+
grid: {
|
|
232
|
+
item: { titleFieldId: "name" }
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
]
|
|
236
|
+
}
|
|
237
|
+
]
|
|
238
|
+
}
|
|
239
|
+
},
|
|
240
|
+
{
|
|
241
|
+
id: "product-details",
|
|
242
|
+
type: "entityPage",
|
|
243
|
+
entityPage: {
|
|
244
|
+
route: { path: "/product/:id", params: { id: "id" } },
|
|
245
|
+
collectionId: "products",
|
|
246
|
+
entityTypeSource: "cms",
|
|
247
|
+
layout: {
|
|
248
|
+
main: [
|
|
249
|
+
{
|
|
250
|
+
type: "card",
|
|
251
|
+
card: {
|
|
252
|
+
title: { text: "Basic Info" },
|
|
253
|
+
children: [
|
|
254
|
+
{ type: "field", field: { fieldId: "name" } }
|
|
255
|
+
]
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
]
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
]
|
|
263
|
+
};
|
|
264
|
+
```
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# AppContext Rules
|
|
2
|
+
|
|
3
|
+
## Type Definitions
|
|
4
|
+
```typescript
|
|
5
|
+
interface AppContext {
|
|
6
|
+
items: any[];
|
|
7
|
+
refreshCollection: () => void;
|
|
8
|
+
}
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Validation Logic
|
|
12
|
+
- **IF** using `useAppContext` **THEN** component MUST be inside `AutoPatternsApp` (as children).
|
|
13
|
+
|
|
14
|
+
## Implementation Rules
|
|
15
|
+
- **MUST** wrap child components (modals, panels) with `<AutoPatternsApp>`.
|
|
16
|
+
- **MUST** use `useAppContext` to access shared collection data/refresh.
|
|
17
|
+
- **MUST** use `refreshCollection` after data mutations in external components.
|
|
18
|
+
- **NEVER** use `useAppContext` outside of the `AutoPatternsApp` tree.
|
|
19
|
+
|
|
20
|
+
## Canonical Example
|
|
21
|
+
```typescript
|
|
22
|
+
// 1. Child Component
|
|
23
|
+
const MyModal = () => {
|
|
24
|
+
const { items, refreshCollection } = useAppContext();
|
|
25
|
+
return (
|
|
26
|
+
<Modal>
|
|
27
|
+
<Text>Count: {items.length}</Text>
|
|
28
|
+
<Button onClick={refreshCollection}>Refresh</Button>
|
|
29
|
+
</Modal>
|
|
30
|
+
);
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
// 2. Integration
|
|
34
|
+
<AutoPatternsApp configuration={config}>
|
|
35
|
+
<MyModal />
|
|
36
|
+
</AutoPatternsApp>
|
|
37
|
+
```
|