@wix/agent-skills 1.21.0 → 1.22.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/skills/wix-app/SKILL.md +60 -4
- package/skills/wix-app/references/DASHBOARD_PAGE.md +11 -25
- package/skills/wix-app/references/DATA_COLLECTION.md +16 -219
- package/skills/wix-app/references/dashboard-page/DATA_SOURCES.md +182 -0
- package/skills/wix-app/references/dashboard-page/DRAFT_TEMPLATE.md +97 -0
- package/skills/wix-app/references/dashboard-page/DRAFT_TEMPLATE_COLLECTION.md +184 -0
- package/skills/wix-app/references/dashboard-page/DRAFT_TEMPLATE_ROUTER.md +203 -0
- package/skills/wix-app/references/dashboard-page/DRAFT_TEMPLATE_SETTINGS.md +44 -0
- package/skills/wix-app/references/dashboard-page/QUERY_AND_PAGING.md +182 -0
- package/skills/wix-app/references/dashboard-page/TABLE_STATE.md +133 -0
- package/skills/wix-app/references/dashboard-page/UX_SUCCESS_MODEL.md +10 -5
- package/skills/wix-app/references/data-collection/LIFECYCLE.md +68 -0
- package/skills/wix-app/references/data-collection/PERMISSIONS.md +47 -0
- package/skills/wix-app/references/data-collection/SCHEMA.md +181 -0
- package/skills/wix-app/references/data-collection/WIX_DATA.md +38 -66
- package/skills/wix-headless-fast/SKILL.md +61 -223
- package/skills/wix-headless-fast/cold-start/bootstrap.mjs +156 -0
- package/skills/wix-headless-fast/{entry/skill.md → cold-start/cold-start.md} +11 -12
- package/skills/wix-headless-fast/guides/existing-site.md +76 -0
- package/skills/wix-headless-fast/guides/reference-mode.md +97 -0
- package/skills/wix-headless-fast/install/AGENTS.md +6 -3
- package/skills/wix-headless-fast/install/attach.mjs +15 -47
- package/skills/wix-headless-fast/install/deploy.mjs +21 -60
- package/skills/wix-headless-fast/install/lock.mjs +55 -0
- package/skills/wix-headless-fast/install/setup.mjs +32 -12
- package/skills/wix-headless-fast/install/templates.mjs +168 -0
- package/skills/wix-manage/references/google-ads/google-ads-dashboard-navigation.md +27 -0
- package/skills/wix-manage/references/google-ads/manage-campaign-success-guide.md +83 -37
- package/skills/wix-headless-fast/references/blog/INSTRUCTIONS.md +0 -303
- package/skills/wix-headless-fast/references/blog/app/components/blog/BlogFeedView.tsx +0 -136
- package/skills/wix-headless-fast/references/blog/app/components/blog/PostView.tsx +0 -112
- package/skills/wix-headless-fast/references/blog/app/components/blog/RichContent.tsx +0 -42
- package/skills/wix-headless-fast/references/blog/app/hooks/blog/useBlogFeed.ts +0 -31
- package/skills/wix-headless-fast/references/blog/app/hooks/blog/usePost.ts +0 -22
- package/skills/wix-headless-fast/references/blog/app/wix/blog/blog-feed-store.ts +0 -137
- package/skills/wix-headless-fast/references/blog/app/wix/blog/post-store.ts +0 -78
- package/skills/wix-headless-fast/references/blog/app/wix/blog/posts-core.ts +0 -117
- package/skills/wix-headless-fast/references/blog/app/wix/blog/posts.ts +0 -52
- package/skills/wix-headless-fast/references/blog/app/wix/blog/taxonomy-core.ts +0 -47
- package/skills/wix-headless-fast/references/blog/app/wix/blog/taxonomy.ts +0 -58
- package/skills/wix-headless-fast/references/blog/app/wix/blog/types.ts +0 -62
- package/skills/wix-headless-fast/references/blog/app-astro/layouts/SiteLayout.astro +0 -40
- package/skills/wix-headless-fast/references/blog/app-astro/pages/blog/[...slug].astro +0 -97
- package/skills/wix-headless-fast/references/blog/app-astro/pages/blog.astro +0 -24
- package/skills/wix-headless-fast/references/blog/lock/astro/package-lock.json +0 -16156
- package/skills/wix-headless-fast/references/blog/rest/posts.ts +0 -42
- package/skills/wix-headless-fast/references/blog/rest/taxonomy.ts +0 -62
- package/skills/wix-headless-fast/references/blog/seed/SEED.md +0 -81
- package/skills/wix-headless-fast/references/blog/seed/read-site.mjs +0 -22
- package/skills/wix-headless-fast/references/blog/seed/seed-blog.mjs +0 -287
- package/skills/wix-headless-fast/references/bookings/INSTRUCTIONS.md +0 -277
- package/skills/wix-headless-fast/references/bookings/app/components/bookings/ServiceBookingView.tsx +0 -144
- package/skills/wix-headless-fast/references/bookings/app/components/bookings/ServicesView.tsx +0 -119
- package/skills/wix-headless-fast/references/bookings/app/hooks/bookings/useBookingFlow.ts +0 -32
- package/skills/wix-headless-fast/references/bookings/app/hooks/bookings/useServices.ts +0 -23
- package/skills/wix-headless-fast/references/bookings/app/wix/bookings/booking-core.ts +0 -218
- package/skills/wix-headless-fast/references/bookings/app/wix/bookings/booking-flow-store.ts +0 -169
- package/skills/wix-headless-fast/references/bookings/app/wix/bookings/booking.ts +0 -121
- package/skills/wix-headless-fast/references/bookings/app/wix/bookings/services-core.ts +0 -92
- package/skills/wix-headless-fast/references/bookings/app/wix/bookings/services-store.ts +0 -90
- package/skills/wix-headless-fast/references/bookings/app/wix/bookings/services.ts +0 -57
- package/skills/wix-headless-fast/references/bookings/app/wix/bookings/types.ts +0 -72
- package/skills/wix-headless-fast/references/bookings/app-astro/layouts/SiteLayout.astro +0 -40
- package/skills/wix-headless-fast/references/bookings/app-astro/pages/services/[slug].astro +0 -76
- package/skills/wix-headless-fast/references/bookings/app-astro/pages/services.astro +0 -22
- package/skills/wix-headless-fast/references/bookings/lock/astro/package-lock.json +0 -11962
- package/skills/wix-headless-fast/references/bookings/rest/booking.ts +0 -113
- package/skills/wix-headless-fast/references/bookings/rest/services.ts +0 -55
- package/skills/wix-headless-fast/references/bookings/seed/SEED.md +0 -71
- package/skills/wix-headless-fast/references/bookings/seed/read-site.mjs +0 -28
- package/skills/wix-headless-fast/references/bookings/seed/seed-bookings.mjs +0 -302
- package/skills/wix-headless-fast/references/cms/INSTRUCTIONS.md +0 -355
- package/skills/wix-headless-fast/references/cms/app/hooks/cms/useCollection.ts +0 -50
- package/skills/wix-headless-fast/references/cms/app/hooks/cms/useItem.ts +0 -37
- package/skills/wix-headless-fast/references/cms/app/wix/cms/collection-store.ts +0 -158
- package/skills/wix-headless-fast/references/cms/app/wix/cms/item-store.ts +0 -93
- package/skills/wix-headless-fast/references/cms/app/wix/cms/items-core.ts +0 -177
- package/skills/wix-headless-fast/references/cms/app/wix/cms/items.ts +0 -123
- package/skills/wix-headless-fast/references/cms/app/wix/cms/types.ts +0 -75
- package/skills/wix-headless-fast/references/cms/app-astro/layouts/SiteLayout.astro +0 -41
- package/skills/wix-headless-fast/references/cms/lock/astro/package-lock.json +0 -11262
- package/skills/wix-headless-fast/references/cms/rest/items.ts +0 -125
- package/skills/wix-headless-fast/references/cms/seed/SEED.md +0 -112
- package/skills/wix-headless-fast/references/cms/seed/read-site.mjs +0 -20
- package/skills/wix-headless-fast/references/cms/seed/seed-cms.mjs +0 -324
- package/skills/wix-headless-fast/references/events/INSTRUCTIONS.md +0 -307
- package/skills/wix-headless-fast/references/events/app/components/events/EventConfirmationView.tsx +0 -66
- package/skills/wix-headless-fast/references/events/app/components/events/EventRegistrationView.tsx +0 -178
- package/skills/wix-headless-fast/references/events/app/components/events/EventsView.tsx +0 -118
- package/skills/wix-headless-fast/references/events/app/hooks/events/useEventRegistration.ts +0 -35
- package/skills/wix-headless-fast/references/events/app/hooks/events/useEvents.ts +0 -24
- package/skills/wix-headless-fast/references/events/app/wix/events/events-core.ts +0 -130
- package/skills/wix-headless-fast/references/events/app/wix/events/events-store.ts +0 -97
- package/skills/wix-headless-fast/references/events/app/wix/events/events.ts +0 -55
- package/skills/wix-headless-fast/references/events/app/wix/events/registration-core.ts +0 -113
- package/skills/wix-headless-fast/references/events/app/wix/events/registration-store.ts +0 -156
- package/skills/wix-headless-fast/references/events/app/wix/events/registration.ts +0 -97
- package/skills/wix-headless-fast/references/events/app/wix/events/types.ts +0 -61
- package/skills/wix-headless-fast/references/events/app-astro/layouts/SiteLayout.astro +0 -40
- package/skills/wix-headless-fast/references/events/app-astro/pages/event-confirmation.astro +0 -12
- package/skills/wix-headless-fast/references/events/app-astro/pages/events/[slug].astro +0 -80
- package/skills/wix-headless-fast/references/events/app-astro/pages/events.astro +0 -21
- package/skills/wix-headless-fast/references/events/lock/astro/package-lock.json +0 -11884
- package/skills/wix-headless-fast/references/events/rest/events.ts +0 -57
- package/skills/wix-headless-fast/references/events/rest/registration.ts +0 -83
- package/skills/wix-headless-fast/references/events/seed/SEED.md +0 -95
- package/skills/wix-headless-fast/references/events/seed/read-site.mjs +0 -26
- package/skills/wix-headless-fast/references/events/seed/seed-events.mjs +0 -276
- package/skills/wix-headless-fast/references/forms/INSTRUCTIONS.md +0 -340
- package/skills/wix-headless-fast/references/forms/app/hooks/forms/useWixForm.ts +0 -85
- package/skills/wix-headless-fast/references/forms/app/wix/forms/form-store.ts +0 -332
- package/skills/wix-headless-fast/references/forms/app/wix/forms/forms-core.ts +0 -238
- package/skills/wix-headless-fast/references/forms/app/wix/forms/forms.ts +0 -54
- package/skills/wix-headless-fast/references/forms/app/wix/forms/submissions-core.ts +0 -216
- package/skills/wix-headless-fast/references/forms/app/wix/forms/submissions.ts +0 -59
- package/skills/wix-headless-fast/references/forms/app/wix/forms/types.ts +0 -135
- package/skills/wix-headless-fast/references/forms/lock/astro/package-lock.json +0 -10593
- package/skills/wix-headless-fast/references/forms/rest/forms.ts +0 -34
- package/skills/wix-headless-fast/references/forms/rest/submissions.ts +0 -56
- package/skills/wix-headless-fast/references/forms/seed/SEED.md +0 -116
- package/skills/wix-headless-fast/references/forms/seed/read-site.mjs +0 -20
- package/skills/wix-headless-fast/references/forms/seed/seed-forms.mjs +0 -327
- package/skills/wix-headless-fast/references/members/INSTRUCTIONS.md +0 -316
- package/skills/wix-headless-fast/references/members/app/components/members/AccountView.tsx +0 -60
- package/skills/wix-headless-fast/references/members/app/components/members/LoginForm.tsx +0 -155
- package/skills/wix-headless-fast/references/members/app/components/members/MemberMenu.tsx +0 -78
- package/skills/wix-headless-fast/references/members/app/components/members/RequireAuth.tsx +0 -47
- package/skills/wix-headless-fast/references/members/app/hooks/members/useMember.ts +0 -66
- package/skills/wix-headless-fast/references/members/app/wix/members/auth-core.ts +0 -105
- package/skills/wix-headless-fast/references/members/app/wix/members/auth.ts +0 -59
- package/skills/wix-headless-fast/references/members/app/wix/members/client.ts +0 -53
- package/skills/wix-headless-fast/references/members/app/wix/members/member-store.ts +0 -122
- package/skills/wix-headless-fast/references/members/app/wix/members/members-core.ts +0 -43
- package/skills/wix-headless-fast/references/members/app/wix/members/members.ts +0 -29
- package/skills/wix-headless-fast/references/members/app/wix/members/types.ts +0 -21
- package/skills/wix-headless-fast/references/members/app-astro/layouts/SiteLayout.astro +0 -42
- package/skills/wix-headless-fast/references/members/app-astro/pages/account.astro +0 -10
- package/skills/wix-headless-fast/references/members/app-astro/pages/login.astro +0 -11
- package/skills/wix-headless-fast/references/members/lock/astro/package-lock.json +0 -10329
- package/skills/wix-headless-fast/references/members/rest/auth.ts +0 -215
- package/skills/wix-headless-fast/references/members/rest/members.ts +0 -26
- package/skills/wix-headless-fast/references/members/seed/SEED.md +0 -39
- package/skills/wix-headless-fast/references/members/seed/read-site.mjs +0 -15
- package/skills/wix-headless-fast/references/members/seed/seed-members.mjs +0 -94
- package/skills/wix-headless-fast/references/portfolio/INSTRUCTIONS.md +0 -315
- package/skills/wix-headless-fast/references/portfolio/app/components/portfolio/CollectionProjectsView.tsx +0 -110
- package/skills/wix-headless-fast/references/portfolio/app/components/portfolio/CollectionsView.tsx +0 -90
- package/skills/wix-headless-fast/references/portfolio/app/components/portfolio/GalleryMedia.tsx +0 -35
- package/skills/wix-headless-fast/references/portfolio/app/components/portfolio/ProjectDetailView.tsx +0 -85
- package/skills/wix-headless-fast/references/portfolio/app/hooks/portfolio/useCollectionProjects.ts +0 -32
- package/skills/wix-headless-fast/references/portfolio/app/hooks/portfolio/useCollections.ts +0 -21
- package/skills/wix-headless-fast/references/portfolio/app/hooks/portfolio/useProjectDetail.ts +0 -31
- package/skills/wix-headless-fast/references/portfolio/app/wix/portfolio/collection-projects-store.ts +0 -82
- package/skills/wix-headless-fast/references/portfolio/app/wix/portfolio/collections-store.ts +0 -58
- package/skills/wix-headless-fast/references/portfolio/app/wix/portfolio/portfolio-core.ts +0 -177
- package/skills/wix-headless-fast/references/portfolio/app/wix/portfolio/portfolio.ts +0 -78
- package/skills/wix-headless-fast/references/portfolio/app/wix/portfolio/project-detail-store.ts +0 -81
- package/skills/wix-headless-fast/references/portfolio/app/wix/portfolio/types.ts +0 -55
- package/skills/wix-headless-fast/references/portfolio/app-astro/layouts/SiteLayout.astro +0 -40
- package/skills/wix-headless-fast/references/portfolio/app-astro/pages/portfolio/[slug].astro +0 -30
- package/skills/wix-headless-fast/references/portfolio/app-astro/pages/portfolio.astro +0 -21
- package/skills/wix-headless-fast/references/portfolio/app-astro/pages/projects/[slug].astro +0 -29
- package/skills/wix-headless-fast/references/portfolio/lock/astro/package-lock.json +0 -10197
- package/skills/wix-headless-fast/references/portfolio/rest/portfolio.ts +0 -75
- package/skills/wix-headless-fast/references/portfolio/seed/SEED.md +0 -86
- package/skills/wix-headless-fast/references/portfolio/seed/read-site.mjs +0 -20
- package/skills/wix-headless-fast/references/portfolio/seed/seed-portfolio.mjs +0 -256
- package/skills/wix-headless-fast/references/pricing-plans/INSTRUCTIONS.md +0 -296
- package/skills/wix-headless-fast/references/pricing-plans/app/components/pricing-plans/PlanDetailView.tsx +0 -47
- package/skills/wix-headless-fast/references/pricing-plans/app/components/pricing-plans/PlansView.tsx +0 -101
- package/skills/wix-headless-fast/references/pricing-plans/app/components/pricing-plans/SubscribeButton.tsx +0 -41
- package/skills/wix-headless-fast/references/pricing-plans/app/hooks/pricing-plans/usePlanPurchase.ts +0 -16
- package/skills/wix-headless-fast/references/pricing-plans/app/hooks/pricing-plans/usePlans.ts +0 -22
- package/skills/wix-headless-fast/references/pricing-plans/app/wix/pricing-plans/plan-purchase-store.ts +0 -54
- package/skills/wix-headless-fast/references/pricing-plans/app/wix/pricing-plans/plans-core.ts +0 -106
- package/skills/wix-headless-fast/references/pricing-plans/app/wix/pricing-plans/plans-store.ts +0 -64
- package/skills/wix-headless-fast/references/pricing-plans/app/wix/pricing-plans/plans.ts +0 -27
- package/skills/wix-headless-fast/references/pricing-plans/app/wix/pricing-plans/purchase-core.ts +0 -43
- package/skills/wix-headless-fast/references/pricing-plans/app/wix/pricing-plans/purchase.ts +0 -22
- package/skills/wix-headless-fast/references/pricing-plans/app/wix/pricing-plans/types.ts +0 -30
- package/skills/wix-headless-fast/references/pricing-plans/app-astro/layouts/SiteLayout.astro +0 -41
- package/skills/wix-headless-fast/references/pricing-plans/app-astro/pages/plans/[slug].astro +0 -40
- package/skills/wix-headless-fast/references/pricing-plans/app-astro/pages/plans.astro +0 -21
- package/skills/wix-headless-fast/references/pricing-plans/lock/astro/package-lock.json +0 -11226
- package/skills/wix-headless-fast/references/pricing-plans/rest/plans.ts +0 -31
- package/skills/wix-headless-fast/references/pricing-plans/rest/purchase.ts +0 -20
- package/skills/wix-headless-fast/references/pricing-plans/seed/SEED.md +0 -79
- package/skills/wix-headless-fast/references/pricing-plans/seed/read-site.mjs +0 -21
- package/skills/wix-headless-fast/references/pricing-plans/seed/seed-pricing-plans.mjs +0 -279
- package/skills/wix-headless-fast/references/restaurants/INSTRUCTIONS.md +0 -360
- package/skills/wix-headless-fast/references/restaurants/app/components/restaurants/MenuView.tsx +0 -142
- package/skills/wix-headless-fast/references/restaurants/app/components/restaurants/OrderCartButton.tsx +0 -26
- package/skills/wix-headless-fast/references/restaurants/app/components/restaurants/OrderCartDrawer.tsx +0 -121
- package/skills/wix-headless-fast/references/restaurants/app/components/restaurants/ReservationView.tsx +0 -155
- package/skills/wix-headless-fast/references/restaurants/app/hooks/restaurants/useMenus.ts +0 -34
- package/skills/wix-headless-fast/references/restaurants/app/hooks/restaurants/useOrderCart.ts +0 -43
- package/skills/wix-headless-fast/references/restaurants/app/hooks/restaurants/useReservation.ts +0 -34
- package/skills/wix-headless-fast/references/restaurants/app/wix/restaurants/menu-core.ts +0 -155
- package/skills/wix-headless-fast/references/restaurants/app/wix/restaurants/menu-store.ts +0 -89
- package/skills/wix-headless-fast/references/restaurants/app/wix/restaurants/menu.ts +0 -71
- package/skills/wix-headless-fast/references/restaurants/app/wix/restaurants/order-store.ts +0 -103
- package/skills/wix-headless-fast/references/restaurants/app/wix/restaurants/ordering-core.ts +0 -124
- package/skills/wix-headless-fast/references/restaurants/app/wix/restaurants/ordering.ts +0 -185
- package/skills/wix-headless-fast/references/restaurants/app/wix/restaurants/reservation-store.ts +0 -193
- package/skills/wix-headless-fast/references/restaurants/app/wix/restaurants/reservations-core.ts +0 -94
- package/skills/wix-headless-fast/references/restaurants/app/wix/restaurants/reservations.ts +0 -74
- package/skills/wix-headless-fast/references/restaurants/app/wix/restaurants/types.ts +0 -168
- package/skills/wix-headless-fast/references/restaurants/app-astro/layouts/SiteLayout.astro +0 -47
- package/skills/wix-headless-fast/references/restaurants/app-astro/pages/menu.astro +0 -22
- package/skills/wix-headless-fast/references/restaurants/app-astro/pages/reservations.astro +0 -12
- package/skills/wix-headless-fast/references/restaurants/lock/astro/package-lock.json +0 -12560
- package/skills/wix-headless-fast/references/restaurants/rest/menu.ts +0 -60
- package/skills/wix-headless-fast/references/restaurants/rest/ordering.ts +0 -169
- package/skills/wix-headless-fast/references/restaurants/rest/reservations.ts +0 -68
- package/skills/wix-headless-fast/references/restaurants/seed/SEED.md +0 -89
- package/skills/wix-headless-fast/references/restaurants/seed/read-site.mjs +0 -25
- package/skills/wix-headless-fast/references/restaurants/seed/seed-restaurants.mjs +0 -499
- package/skills/wix-headless-fast/references/shared/CONTENT.md +0 -22
- package/skills/wix-headless-fast/references/shared/CUSTOM_OPERATIONS.md +0 -73
- package/skills/wix-headless-fast/references/shared/DESIGN.md +0 -26
- package/skills/wix-headless-fast/references/shared/SUPPLIED-CONTENT.md +0 -23
- package/skills/wix-headless-fast/references/shared/app/styles/global.css +0 -52
- package/skills/wix-headless-fast/references/shared/app/wix/config.ts +0 -15
- package/skills/wix-headless-fast/references/shared/app/wix/media.ts +0 -81
- package/skills/wix-headless-fast/references/shared/app/wix/money.ts +0 -24
- package/skills/wix-headless-fast/references/shared/app/wix/sdk.ts +0 -89
- package/skills/wix-headless-fast/references/shared/capabilities/media-upload/app/wix/media-upload/client.ts +0 -46
- package/skills/wix-headless-fast/references/shared/capabilities/media-upload/app-astro/pages/api/wix/media-upload.ts +0 -46
- package/skills/wix-headless-fast/references/shared/rest/client.ts +0 -155
- package/skills/wix-headless-fast/references/shared/rest/config.ts +0 -3
- package/skills/wix-headless-fast/references/shared/rest/media.ts +0 -65
- package/skills/wix-headless-fast/references/shared/seed/images.mjs +0 -145
- package/skills/wix-headless-fast/references/shared/seed/read-site.mjs +0 -99
- package/skills/wix-headless-fast/references/storefront/INSTRUCTIONS.md +0 -612
- package/skills/wix-headless-fast/references/storefront/app/components/storefront/CartButton.tsx +0 -26
- package/skills/wix-headless-fast/references/storefront/app/components/storefront/CartDrawer.tsx +0 -155
- package/skills/wix-headless-fast/references/storefront/app/components/storefront/FilterPanel.tsx +0 -266
- package/skills/wix-headless-fast/references/storefront/app/components/storefront/OptionPicker.tsx +0 -95
- package/skills/wix-headless-fast/references/storefront/app/components/storefront/QuickAdd.tsx +0 -136
- package/skills/wix-headless-fast/references/storefront/app/hooks/storefront/useCart.ts +0 -48
- package/skills/wix-headless-fast/references/storefront/app/hooks/storefront/useProductDetail.ts +0 -39
- package/skills/wix-headless-fast/references/storefront/app/hooks/storefront/useShop.ts +0 -34
- package/skills/wix-headless-fast/references/storefront/app/wix/storefront/cart-core.ts +0 -121
- package/skills/wix-headless-fast/references/storefront/app/wix/storefront/cart-store.ts +0 -107
- package/skills/wix-headless-fast/references/storefront/app/wix/storefront/cart.ts +0 -138
- package/skills/wix-headless-fast/references/storefront/app/wix/storefront/catalog-core.ts +0 -314
- package/skills/wix-headless-fast/references/storefront/app/wix/storefront/catalog.ts +0 -133
- package/skills/wix-headless-fast/references/storefront/app/wix/storefront/product-detail-store.ts +0 -147
- package/skills/wix-headless-fast/references/storefront/app/wix/storefront/shop-store.ts +0 -289
- package/skills/wix-headless-fast/references/storefront/app/wix/storefront/types.ts +0 -169
- package/skills/wix-headless-fast/references/storefront/app-astro/layouts/SiteLayout.astro +0 -65
- package/skills/wix-headless-fast/references/storefront/lock/astro/package-lock.json +0 -12247
- package/skills/wix-headless-fast/references/storefront/rest/cart.ts +0 -132
- package/skills/wix-headless-fast/references/storefront/rest/catalog.ts +0 -123
- package/skills/wix-headless-fast/references/storefront/seed/SEED.md +0 -130
- package/skills/wix-headless-fast/references/storefront/seed/read-site.mjs +0 -38
- package/skills/wix-headless-fast/references/storefront/seed/seed-store.mjs +0 -561
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
# Finding the real SDK shape behind a dashboard page
|
|
2
|
+
|
|
3
|
+
> **Scope.** [DRAFT_TEMPLATE.md](DRAFT_TEMPLATE.md) gives you the page. This file is the other half:
|
|
4
|
+
> locating the method and the *field names* for the data it lists. Read it before Step 3's MCP
|
|
5
|
+
> discovery — the installed package answers most of it faster and more accurately than a doc search,
|
|
6
|
+
> because it is the version your code will compile against.
|
|
7
|
+
|
|
8
|
+
## Where the types actually live
|
|
9
|
+
|
|
10
|
+
A Wix vertical package such as `@wix/ecom` is a thin re-export barrel. `build/es/index.d.mts` is a
|
|
11
|
+
list of namespaces (`orders`, `orderTransactions`, `currentCart`, …), each re-exported from its own
|
|
12
|
+
generated package:
|
|
13
|
+
|
|
14
|
+
```
|
|
15
|
+
node_modules/@wix/ecom/build/es/index.d.mts # namespace list only, ~90 lines
|
|
16
|
+
node_modules/@wix/auto_sdk_ecom_orders/build/es/
|
|
17
|
+
index.d.mts # the callable functions
|
|
18
|
+
index.typings.d.mts # request/response types
|
|
19
|
+
ecom-v1-order-orders.universal-<hash>.d.mts # the domain entities
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
Three consequences worth knowing before you start grepping:
|
|
23
|
+
|
|
24
|
+
1. **The directory name is not the namespace name.** Namespaces are camelCase, package directories
|
|
25
|
+
are kebab-case — `extendedBookings` lives in `auto_sdk_bookings_extended-bookings`, not
|
|
26
|
+
`auto_sdk_bookings_extendedBookings`. Don't derive one from the other; list them:
|
|
27
|
+
`ls node_modules/@wix | grep <vertical>`.
|
|
28
|
+
2. **The entity is not always in `index.typings.d.mts`.** `Order`, `Refund`, `Service` live in the
|
|
29
|
+
hashed `*.universal-*.d.mts` when the package has one. The hash changes between versions, so glob
|
|
30
|
+
for it, never hard-code it, and fall back to `index.typings.d.mts` when no universal file exists.
|
|
31
|
+
3. **Never `cat` *or plain-`grep`* the barrel's export block.** These files end with a single
|
|
32
|
+
several-hundred-KB `export { … as a, … as b }` line, so `grep -n "queryServices" index.d.mts`
|
|
33
|
+
prints that whole line. Anchor to the declarations instead —
|
|
34
|
+
`grep -oE "^declare (const|function) [a-zA-Z]+"` — or pipe any barrel grep through `cut -c1-200`.
|
|
35
|
+
|
|
36
|
+
## Confirming a method
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
E=node_modules/@wix/auto_sdk_ecom_order-transactions/build/es
|
|
40
|
+
grep -oE "^declare function [a-zA-Z]+" $E/index.d.mts
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
Prefer this to recall: `listTransactionsForMultipleOrders(orderIds: string[])` and
|
|
44
|
+
`listTransactionsForSingleOrder` differ by exactly the shape a collection page needs, and only one
|
|
45
|
+
of them avoids an N+1 across the visible page.
|
|
46
|
+
|
|
47
|
+
## Confirming a field — the part that ships bugs
|
|
48
|
+
|
|
49
|
+
Once you have the entity, read the declaration for **every field you map into a column**, not just
|
|
50
|
+
the uncertain ones. Two failure modes recur:
|
|
51
|
+
|
|
52
|
+
**Deprecated fields still compile.** On `RegularPaymentDetails`, `paymentMethod` carries
|
|
53
|
+
`@deprecated Use paymentMethodName.buyerLanguageName instead` — the deprecated one is a bare code,
|
|
54
|
+
the replacement is the localised name a person expects to read. Grep before you map:
|
|
55
|
+
|
|
56
|
+
```bash
|
|
57
|
+
grep -B4 "paymentMethod?:" $E/index.typings.d.mts # shows the @deprecated banner above it
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
A column bound to a deprecated field renders something plausible and wrong, which is the hardest
|
|
61
|
+
kind of defect to catch in review.
|
|
62
|
+
|
|
63
|
+
**Aggregates hide one level down.** Money on a refund is not on the refund — it is
|
|
64
|
+
`refund.summary.refunded.amount` (`AggregatedRefundSummary`, with `pendingRefund`, `failedRefundAmount`
|
|
65
|
+
and `requestedRefund` beside it), while per-transaction status is
|
|
66
|
+
`refund.transactions[].refundStatus`. Summing the wrong one silently under-reports.
|
|
67
|
+
|
|
68
|
+
**A generic-sounding field is not the related entity.** Treat `.title`, `.name` and `.summary` as
|
|
69
|
+
unverified until you read the declaration: an `Extended*` / `*WithDetails` shape exists precisely to
|
|
70
|
+
attach the real related entity, and a summary field on the base item is not a substitute. A column
|
|
71
|
+
must show what its header promises.
|
|
72
|
+
|
|
73
|
+
**A mapper must cover every shape the response returns.** Responses often carry a oneof — Bookings'
|
|
74
|
+
`bookedEntity` is `slot` for an appointment, `schedule` for a class — and a mapper reading one
|
|
75
|
+
variant renders blank cells for the other while passing `tsc`.
|
|
76
|
+
|
|
77
|
+
## Joining two sources for one row
|
|
78
|
+
|
|
79
|
+
A collection page usually needs one query plus one batch lookup, never a lookup per row:
|
|
80
|
+
|
|
81
|
+
```ts
|
|
82
|
+
const { orders: found } = await orders.searchOrders({ filter, sort, cursorPaging: { limit, cursor } });
|
|
83
|
+
const ids = found.map((o) => o._id).filter((id): id is string => Boolean(id));
|
|
84
|
+
const { orderTransactions: txns } = await orderTransactions.listTransactionsForMultipleOrders(ids);
|
|
85
|
+
const byId = new Map(txns.map((t) => [t.orderId, t]));
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
Build the `Map` once and index it in the row mapper. Guard the empty case before the second call —
|
|
89
|
+
a batch endpoint given `[]` is a wasted round trip at best.
|
|
90
|
+
|
|
91
|
+
## Filter syntax
|
|
92
|
+
|
|
93
|
+
`searchOrders` takes a `CursorSearch`: `{ cursorPaging, filter, sort }`, where `filter` is a
|
|
94
|
+
Mongo-shaped `Record<string, any>` — `{ paymentStatus: { $in: [...] } }`,
|
|
95
|
+
`{ _createdDate: { $gte, $lte } }`, `{ number: { $startsWith } }`. Enum values come from the
|
|
96
|
+
declaration, not from memory: order payment status is `FULLY_REFUNDED` / `PARTIALLY_REFUNDED` /
|
|
97
|
+
`PAID` / `NOT_PAID` / `PENDING` / `PARTIALLY_PAID` / `PENDING_MERCHANT` / `CANCELED` / `DECLINED` /
|
|
98
|
+
`UNSPECIFIED`.
|
|
99
|
+
|
|
100
|
+
## The SDK is not the REST API
|
|
101
|
+
|
|
102
|
+
Docs search returns REST pages, and a dashboard page calls the **SDK**. Append `?apiView=SDK` to the
|
|
103
|
+
URL of whatever page you landed on and read that view — it answers two of the four differences
|
|
104
|
+
before you write a line.
|
|
105
|
+
|
|
106
|
+
**1 and 2 — namespace and id naming. The SDK view states both.** It prints the package and namespace
|
|
107
|
+
outright (`SDK Package: @wix/members`, `SDK Namespace: customFields`), and uses `_id` in its own
|
|
108
|
+
parameter list. Infer either from the REST page and you get them wrong: REST paths say `services/v2`,
|
|
109
|
+
so `servicesV2` looks right, and the SDK exports `services`; REST responses show `"id"`, and the SDK
|
|
110
|
+
type declares `_id` — same for `_createdDate` / `_updatedDate`. Offline, the barrel is the fallback
|
|
111
|
+
for the namespace list:
|
|
112
|
+
|
|
113
|
+
```bash
|
|
114
|
+
grep -oE "as [a-zA-Z_]+" node_modules/@wix/<pkg>/build/es/index.d.mts | sed 's/as //' | sort -u
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
The next two are codegen artifacts that no docs page mentions — read them off the declaration.
|
|
118
|
+
|
|
119
|
+
**3. Don't derive types from `ReturnType`.** Most SDK functions are overloaded — a direct call
|
|
120
|
+
and an `httpClient` form — so `Awaited<ReturnType<typeof ns.method>>['items'][number]` resolves
|
|
121
|
+
against the wrong overload and fails. Import the entity type the package exports instead:
|
|
122
|
+
|
|
123
|
+
```ts
|
|
124
|
+
type Row = <namespace>.<Entity>; // e.g. extendedBookings.ExtendedBooking — not ReturnType<typeof …>
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
**4. Paging metadata carries no `hasNext`.** `PagingMetadataV2` is `count`, `offset`, `total`,
|
|
128
|
+
`tooManyToCount`, `cursors` — nothing else, in every generated package. Whether another page exists
|
|
129
|
+
is knowable only from `pagingMetadata.cursors.next`. What the collection wants you to *return* is a
|
|
130
|
+
separate question — see [TABLE_STATE.md](TABLE_STATE.md#query-and-result-shapes).
|
|
131
|
+
|
|
132
|
+
## Two things to settle before you write the page
|
|
133
|
+
|
|
134
|
+
**Is the package even installed?** A vertical's SDK is not a default dependency. `@wix/bookings`,
|
|
135
|
+
`@wix/ecom` and the rest have to be present before the import resolves:
|
|
136
|
+
|
|
137
|
+
```bash
|
|
138
|
+
node -e "const p=require('./package.json');console.log(!!({...p.dependencies,...p.devDependencies})['@wix/<pkg>'])"
|
|
139
|
+
npm install @wix/<pkg> # if false
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
**Does the app hold the scope?** This is the one that produces a page which builds, mounts, renders
|
|
143
|
+
its shell, and shows nothing — the hardest failure to read, because an empty table looks like empty
|
|
144
|
+
data. Reads of a vertical's data need that vertical's permission scope, granted in **Dev Center →
|
|
145
|
+
Permissions**; it cannot be declared in the repo, and the app's install consent screen names what it
|
|
146
|
+
actually has.
|
|
147
|
+
|
|
148
|
+
**Don't guess the scope name — the method's own docs page prints it.** In SDK view every method
|
|
149
|
+
carries `Method Permissions` and `Method Permissions Scopes IDs`, for example
|
|
150
|
+
`Manage Members: SCOPE.DC-MEMBERS.MANAGE-MEMBERS`. Look it up for the exact method you are calling,
|
|
151
|
+
assume it is missing on a fresh app, and report it under
|
|
152
|
+
[Manual Steps Required](../../SKILL.md#-manual-steps-required) by name. Wiring `errorState` on the
|
|
153
|
+
table (the draft template does) is what turns this from silent skeletons into a message you can read.
|
|
154
|
+
|
|
155
|
+
## A second vertical is a second scope
|
|
156
|
+
|
|
157
|
+
The two checks above are easy to run once, at Step 3, for the vertical the page is obviously about —
|
|
158
|
+
and then to skip for the *next* one, because by then you are deep in Step 4b adding a detail column
|
|
159
|
+
or resolving a search term. That second package needs the same two things, and it fails differently:
|
|
160
|
+
the page already worked, so the regression looks like something you broke in the UI.
|
|
161
|
+
|
|
162
|
+
A measured run added `@wix/crm` mid-implementation to resolve a client-name search. The app held
|
|
163
|
+
Bookings scopes and not `SCOPE.DC-CONTACTS.READ-CONTACTS`, the contacts call answered 403, and
|
|
164
|
+
because the search awaited it unconditionally, a page that had been loading fine stopped loading at
|
|
165
|
+
all.
|
|
166
|
+
|
|
167
|
+
**Run the package-and-scope check for every `@wix/*` import you add, whenever you add it** — and
|
|
168
|
+
then decide what its failure should cost:
|
|
169
|
+
|
|
170
|
+
- **Primary source** — the rows themselves. Its failure is the page's failure; `errorState` reports it.
|
|
171
|
+
- **Secondary source** — an enrichment lookup, a filter's option list, a term resolved to ids. Its
|
|
172
|
+
failure must cost only that feature. Wrap the call, fall back to the empty result, and say so in
|
|
173
|
+
the UI (`TableTopNotification` is the patterns component for it) rather than degrading silently.
|
|
174
|
+
|
|
175
|
+
Ask which one you are adding before you write the `await`. An unwrapped secondary call is a page
|
|
176
|
+
whose availability is the *intersection* of every scope it touches.
|
|
177
|
+
|
|
178
|
+
## Querying and paging
|
|
179
|
+
|
|
180
|
+
Filter field paths, WQL's one-operator-per-field rule, and the two cursor-paging traps are in
|
|
181
|
+
[QUERY_AND_PAGING.md](QUERY_AND_PAGING.md). Read it before writing `fetchData` — every rule there
|
|
182
|
+
was a shipped bug first.
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
# Draft Template — the starting point for every dashboard page
|
|
2
|
+
|
|
3
|
+
**Start here for any Dashboard Page request, before writing a shell, provider, or router from scratch.** Pick the case below, copy its files, rename, and adapt fields/API calls/data source. Only leave this file for [WIX_PATTERNS_DOCS.md](../WIX_PATTERNS_DOCS.md), the package's own `Collection Toolkit.md` guide, [TABLE_STATE.md](TABLE_STATE.md), a component doc, or an MCP lookup when the request needs something no case shows.
|
|
4
|
+
|
|
5
|
+
Every snippet below was copied from the installed `dist/docs/*.md` and `dist/dts-bundle/*.d.ts`, not from memory — confirm props against your own installed version before deviating.
|
|
6
|
+
|
|
7
|
+
## Which case matches the request?
|
|
8
|
+
|
|
9
|
+
| The request needs… | Case | Router? |
|
|
10
|
+
| --- | --- | --- |
|
|
11
|
+
| A list/report whose rows are read-only — no create/edit form | **A — Collection + read-only detail** | Yes |
|
|
12
|
+
| A list **and** create/edit for each record (no separate app-settings area) | **B — Collection + Entity** | Yes |
|
|
13
|
+
| Only app-wide settings/config — no list at all | **C — Settings only** | No |
|
|
14
|
+
| A list, create/edit, **and** an app-settings area, all in one extension | **D — Collection + Entity + Settings** | Yes |
|
|
15
|
+
|
|
16
|
+
Don't default to D because it's the most complete — [Step 4c's checklist](../../SKILL.md#step-4c-ux-completeness-self-audit) doesn't ask for a settings or entity page unless the request needs one. If unsure between B and D, re-read the prompt for "settings," "configure," "preferences" — their absence means B.
|
|
17
|
+
|
|
18
|
+
## Then: what `fetchData` calls
|
|
19
|
+
|
|
20
|
+
Case tells you how many pages. This tells you only what `fetchData` calls — the page itself is
|
|
21
|
+
[DRAFT_TEMPLATE_COLLECTION.md](DRAFT_TEMPLATE_COLLECTION.md) either way:
|
|
22
|
+
|
|
23
|
+
| The rows come from | `fetchData` calls |
|
|
24
|
+
| --- | --- |
|
|
25
|
+
| A vertical SDK (`@wix/bookings`, `@wix/ecom`, …) or any API you call yourself | that SDK's own query method — [DATA_SOURCES.md](DATA_SOURCES.md) |
|
|
26
|
+
| A **CMS collection** — one your Data Collection extension ships, or an existing site collection | `@wix/data` `items.query()` — [WIX_DATA.md](../data-collection/WIX_DATA.md) |
|
|
27
|
+
|
|
28
|
+
A CMS collection is not a different template, just a different call inside the same one: you write
|
|
29
|
+
`fetchData`, the filters and the columns for both.
|
|
30
|
+
|
|
31
|
+
**Cases B and D both need a router** — their entry file, app shell, and entity page are in [DRAFT_TEMPLATE_ROUTER.md](DRAFT_TEMPLATE_ROUTER.md). The collection and settings files are shared by every case that uses them, B and D included; the router file links back rather than repeating them.
|
|
32
|
+
|
|
33
|
+
## File layout
|
|
34
|
+
|
|
35
|
+
```
|
|
36
|
+
src/extensions/dashboard/pages/{feature}/
|
|
37
|
+
{feature}.extension.ts # single wix generate scaffold — always exactly one route registered here
|
|
38
|
+
{feature}.tsx # entry — Case C: Section 1 below. Cases A/B/D: DRAFT_TEMPLATE_ROUTER.md
|
|
39
|
+
{Feature}App.tsx # Case A/B/D only — see DRAFT_TEMPLATE_ROUTER.md
|
|
40
|
+
{Feature}CollectionPage.tsx # Case A, B, D — see DRAFT_TEMPLATE_COLLECTION.md
|
|
41
|
+
{Feature}DetailPage.tsx # Case A only — read-only detail route, DRAFT_TEMPLATE_ROUTER.md §4
|
|
42
|
+
{Feature}EntityPage.tsx # Case B, D only — see DRAFT_TEMPLATE_ROUTER.md
|
|
43
|
+
{Feature}SettingsPage.tsx # Case C, D only — see DRAFT_TEMPLATE_SETTINGS.md
|
|
44
|
+
{feature}-api.ts # fetch/save calls — keep these out of the components
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
Scaffold with a single call regardless of case — this is always one extension:
|
|
48
|
+
|
|
49
|
+
```bash
|
|
50
|
+
wix generate --params '{"extensionType":"DASHBOARD_PAGE","title":"<title>","route":"<route>"}'
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
## 1. Entry — Case C only (router-free, no location plumbing)
|
|
54
|
+
|
|
55
|
+
Case C has one page and no rows to open, so it needs no router and no manual `location` wiring. **Cases A, B and D all route** — a row opens a page of its own in every one of them — so their entry file is [DRAFT_TEMPLATE_ROUTER.md](DRAFT_TEMPLATE_ROUTER.md) §1:
|
|
56
|
+
|
|
57
|
+
```tsx
|
|
58
|
+
// {feature}.tsx — Case C
|
|
59
|
+
import type { FC } from 'react';
|
|
60
|
+
import { withDashboard } from '@wix/patterns';
|
|
61
|
+
import { WixPatternsProvider } from '@wix/patterns/provider';
|
|
62
|
+
import { WixDesignSystemProvider } from '@wix/design-system';
|
|
63
|
+
import '@wix/design-system/styles.global.css';
|
|
64
|
+
import { {Feature}SettingsPage } from './{Feature}SettingsPage'; // DRAFT_TEMPLATE_SETTINGS.md
|
|
65
|
+
|
|
66
|
+
const Page: FC = () => (
|
|
67
|
+
<WixDesignSystemProvider>
|
|
68
|
+
<WixPatternsProvider>
|
|
69
|
+
<{Feature}SettingsPage />
|
|
70
|
+
</WixPatternsProvider>
|
|
71
|
+
</WixDesignSystemProvider>
|
|
72
|
+
);
|
|
73
|
+
|
|
74
|
+
export default withDashboard(Page);
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
Cases A, B and D differ — they need `location` supplied manually for `PatternsReactRouter`. See [DRAFT_TEMPLATE_ROUTER.md](DRAFT_TEMPLATE_ROUTER.md) rather than adding that plumbing here; it's dead code without a router underneath it.
|
|
78
|
+
|
|
79
|
+
## 2. Collection page — Case A, B, D
|
|
80
|
+
|
|
81
|
+
In [DRAFT_TEMPLATE_COLLECTION.md](DRAFT_TEMPLATE_COLLECTION.md) — `useTableCollection`, a working
|
|
82
|
+
filter, the four placeholder states, and a row that opens. Shared by Cases A, B and D. No
|
|
83
|
+
`SummaryBar` unless the request asked for one, and the drill-in is always a route — never a side
|
|
84
|
+
panel.
|
|
85
|
+
|
|
86
|
+
## 3. Settings page — Case C, D
|
|
87
|
+
|
|
88
|
+
In [DRAFT_TEMPLATE_SETTINGS.md](DRAFT_TEMPLATE_SETTINGS.md) — `useSettingsPage` + `useForm`,
|
|
89
|
+
with the same field-controller patterns as the entity page.
|
|
90
|
+
|
|
91
|
+
## What to change vs. keep, per case
|
|
92
|
+
|
|
93
|
+
| Change per request | Keep as shown |
|
|
94
|
+
| --- | --- |
|
|
95
|
+
| Feature/entity names, fields, columns, API calls in `{feature}-api.ts` | Which case (A/B/C/D) — don't over-build D for a request that only named a list |
|
|
96
|
+
| Detail fields, form field types, columns | The drill-in being a route, and the absence of a `SummaryBar` the request never asked for |
|
|
97
|
+
| Real data source (SDK-first per [SDK-First Rule](../../SKILL.md#sdk-first-rule-existing-wix-app-data-is-never-cms)) vs CMS | B/D wiring (provider/router nesting, `parentPath`, `location`): [DRAFT_TEMPLATE_ROUTER.md](DRAFT_TEMPLATE_ROUTER.md) |
|
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
# Draft Template — Collection page (Cases A, B and D)
|
|
2
|
+
|
|
3
|
+
> Pick your case in [DRAFT_TEMPLATE.md](DRAFT_TEMPLATE.md) first. This page is shared by A, B
|
|
4
|
+
> and D.
|
|
5
|
+
|
|
6
|
+
> **You write `fetchData`, the filters and the columns.** This holds whatever the rows are: for a
|
|
7
|
+
> CMS collection `fetchData` calls `@wix/data` `items.query()`
|
|
8
|
+
> ([WIX_DATA.md](../data-collection/WIX_DATA.md)) and nothing else on this page changes.
|
|
9
|
+
|
|
10
|
+
## Two rules this skeleton encodes, so read them before editing it
|
|
11
|
+
|
|
12
|
+
**Every row opens a page of its own, never a panel.** `onRowClick` navigates —
|
|
13
|
+
`navigateToEntityPage` to an `EntityPage` route when the record is editable, or to a read-only
|
|
14
|
+
detail route when the page is display-only ([DRAFT_TEMPLATE_ROUTER.md § 4](DRAFT_TEMPLATE_ROUTER.md#4-read-only-detail-route--case-a)).
|
|
15
|
+
A WDS `SidePanel` is not the drill-in: in Cairo it is the host for a page's own side panels — the
|
|
16
|
+
fields card's "Manage fields", a table's column panel — and `example-bm` uses it as a row drill-in
|
|
17
|
+
in exactly nothing. Every collection example there navigates.
|
|
18
|
+
|
|
19
|
+
**No `SummaryBar` unless the request asked for one.** Not "unless the page seems to want one" —
|
|
20
|
+
unless the prompt named a total, a count, or a "how many / how much" figure. It is absent from this
|
|
21
|
+
skeleton on purpose; adding one uninvited pushes the rows down the page and puts a number on screen
|
|
22
|
+
nobody has to be right about. When you do add one, wire it from
|
|
23
|
+
[SKILL.md § Step 2](../../SKILL.md) — no `SummaryBar` unless the request asked for one.
|
|
24
|
+
|
|
25
|
+
## The collection page
|
|
26
|
+
|
|
27
|
+
This is the file [Step 4c's UX Completeness Self-Audit](../../SKILL.md#step-4c-ux-completeness-self-audit)
|
|
28
|
+
is about: a working filter, named filters, and a row that opens.
|
|
29
|
+
|
|
30
|
+
```tsx
|
|
31
|
+
// {Feature}CollectionPage.tsx — Case A, B, D
|
|
32
|
+
import type { FC } from 'react';
|
|
33
|
+
import {
|
|
34
|
+
CollectionEmptyState, CollectionErrorState, CollectionNoResultsState, CollectionSearch, CollectionToolbarFilters,
|
|
35
|
+
MultiSelectCheckboxFilter, Table, stringsArrayFilter,
|
|
36
|
+
useStaticListFilterCollection, useTableCollection,
|
|
37
|
+
} from '@wix/patterns';
|
|
38
|
+
import { CollectionPage } from '@wix/patterns/page';
|
|
39
|
+
import { usePatternsNavigate } from '@wix/patterns/router';
|
|
40
|
+
import { fetch{Feature}Page, type {Entity}Row } from './{feature}-api';
|
|
41
|
+
|
|
42
|
+
const STATUS_LABELS: Record<string, string> = { ACTIVE: 'Active', ARCHIVED: 'Archived' };
|
|
43
|
+
// Filter factories are module-level: one instance per page, not per render.
|
|
44
|
+
const statusFilter = stringsArrayFilter<'ACTIVE' | 'ARCHIVED'>({
|
|
45
|
+
// `name` is NOT the visible title — it feeds a11y legends, BI grouping and dataHooks.
|
|
46
|
+
// The title comes from the label props in the JSX below; the package's own
|
|
47
|
+
// `Collection Toolkit.md` guide has the prop model.
|
|
48
|
+
name: 'Status',
|
|
49
|
+
itemKey: (item) => item,
|
|
50
|
+
itemName: (item) => STATUS_LABELS[item] ?? item,
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
export const {Feature}CollectionPage: FC = () => {
|
|
54
|
+
const { navigateToEntityPage } = usePatternsNavigate<{Entity}Row>();
|
|
55
|
+
|
|
56
|
+
const state = useTableCollection<{Entity}Row, { status: typeof statusFilter }>({
|
|
57
|
+
queryName: '{feature}',
|
|
58
|
+
paginationMode: 'cursor', // 'offset' if your API pages by offset
|
|
59
|
+
itemKey: (item) => item.id,
|
|
60
|
+
itemName: (item) => item.name,
|
|
61
|
+
filters: { status: statusFilter },
|
|
62
|
+
// Every declared filter AND the search box are read here — one that never
|
|
63
|
+
// reaches the query renders fine and narrows nothing.
|
|
64
|
+
fetchData: async (query) =>
|
|
65
|
+
fetch{Feature}Page({
|
|
66
|
+
limit: query.limit,
|
|
67
|
+
cursor: query.cursor ?? undefined, // return `cursor: next || undefined` — key always
|
|
68
|
+
// present, '' walks pages forever
|
|
69
|
+
search: query.search,
|
|
70
|
+
filters: { status: query.filters.status },
|
|
71
|
+
}),
|
|
72
|
+
// fetchTotal is for a requested aggregate, so it is commented out here. Uncommented, it
|
|
73
|
+
// must RESOLVE A NUMBER from an endpoint that counts, and it OVERRIDES the fallback to the
|
|
74
|
+
// loaded-rows count — so a wrong one reports 0 beside a full table while tsc stays green.
|
|
75
|
+
// Read QUERY_AND_PAGING.md, "What fetchTotal is allowed to call", before uncommenting.
|
|
76
|
+
// fetchTotal: async (query) => count{Feature}({ search: query.search, filters: query.filters }),
|
|
77
|
+
fetchErrorMessage: ({ err }) => (err instanceof Error ? err.message : 'Failed to load {feature}'),
|
|
78
|
+
});
|
|
79
|
+
|
|
80
|
+
const statusOptions = useStaticListFilterCollection(statusFilter, ['ACTIVE', 'ARCHIVED']);
|
|
81
|
+
|
|
82
|
+
// Nothing here reads `state` directly: the Table observes it internally. The moment you
|
|
83
|
+
// DO derive a number from it in this component — a header figure, a badge, a requested
|
|
84
|
+
// SummaryBar — it is MobX, and a plain read is computed once while the collection is still
|
|
85
|
+
// empty and never recomputed. Wrap it in `useSelector` and select a primitive: TABLE_STATE.md.
|
|
86
|
+
|
|
87
|
+
return (
|
|
88
|
+
<CollectionPage>
|
|
89
|
+
<CollectionPage.Header title={{ text: '{Page Title}' }} />
|
|
90
|
+
<CollectionPage.Content>
|
|
91
|
+
<Table
|
|
92
|
+
state={state}
|
|
93
|
+
// `search` defaults to ON, so omitting it ships a box that reaches no
|
|
94
|
+
// query. Wire it AND read query.search above. If the API has no
|
|
95
|
+
// free-text filter, resolve the term to one it does support.
|
|
96
|
+
search={<CollectionSearch placeholder="Search {feature}" />}
|
|
97
|
+
filters={
|
|
98
|
+
<CollectionToolbarFilters>
|
|
99
|
+
{/* BOTH label props, same string, and never accordionItemProps.title.
|
|
100
|
+
The resolution model is the package's own `Collection Toolkit.md` guide. */}
|
|
101
|
+
<MultiSelectCheckboxFilter
|
|
102
|
+
filter={statusFilter} collection={statusOptions}
|
|
103
|
+
toolbarItemProps={{ label: 'Status' }}
|
|
104
|
+
accordionItemProps={{ label: 'Status' }}
|
|
105
|
+
/>
|
|
106
|
+
</CollectionToolbarFilters>
|
|
107
|
+
}
|
|
108
|
+
// Three distinct messages. Without errorState a failed query looks
|
|
109
|
+
// exactly like a slow one: skeletons, forever.
|
|
110
|
+
emptyState={<CollectionEmptyState title="No {feature} yet" />}
|
|
111
|
+
// Name what excluded the rows — a seeded default or a missing scope
|
|
112
|
+
// looks exactly like "nothing matched", and only one is actionable.
|
|
113
|
+
noResultsState={<CollectionNoResultsState title="No {feature} match" subtitle="…" />}
|
|
114
|
+
// errorState is a RENDER FUNCTION: (err, { retry }) => ReactElement.
|
|
115
|
+
errorState={(err, { retry }) => (
|
|
116
|
+
<CollectionErrorState
|
|
117
|
+
title="Couldn't load {feature}"
|
|
118
|
+
subtitle={String(err)}
|
|
119
|
+
action={{ text: 'Retry', onClick: retry }}
|
|
120
|
+
/>
|
|
121
|
+
)}
|
|
122
|
+
// The drill-in. Editable record → the EntityPage route (`/${item.id}`).
|
|
123
|
+
// Display-only → the read-only route, DRAFT_TEMPLATE_ROUTER.md §4. Either way a
|
|
124
|
+
// route, and passing `entity` lets the target title itself before its fetch lands.
|
|
125
|
+
onRowClick={(item) => navigateToEntityPage({ path: `/${item.id}`, entity: item })}
|
|
126
|
+
columns={[
|
|
127
|
+
// One column per field the prompt names; verify each source field —
|
|
128
|
+
// DATA_SOURCES.md, "A column must show what its header promises."
|
|
129
|
+
{ id: 'name', title: 'Name', render: (item) => item.name },
|
|
130
|
+
]}
|
|
131
|
+
/>
|
|
132
|
+
</CollectionPage.Content>
|
|
133
|
+
</CollectionPage>
|
|
134
|
+
);
|
|
135
|
+
};
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
## Turning `query.search` into a query
|
|
139
|
+
|
|
140
|
+
`{feature}-api.ts` turns one term into a filter over *several* fields — an OR. **This is where
|
|
141
|
+
search ships broken**: it renders, it reaches the query, and still returns every row, so nothing
|
|
142
|
+
looks wrong until someone counts results.
|
|
143
|
+
|
|
144
|
+
### A CMS collection — `@wix/data`
|
|
145
|
+
|
|
146
|
+
`or()` combines two filters; it is **not** a condition. Called on a query or filter holding no
|
|
147
|
+
condition yet it contributes an empty `{}` branch, and `{} OR x` matches the whole collection. Seed
|
|
148
|
+
the filter with the first field, `or()` the rest onto it, then `and()` it onto the query — which is
|
|
149
|
+
also what keeps the facet filters applying to *every* branch:
|
|
150
|
+
|
|
151
|
+
```ts
|
|
152
|
+
// SHORT_TEXT / LONG_TEXT fields only: `contains` on a number, date or
|
|
153
|
+
// reference field is not a narrower match, it is no match.
|
|
154
|
+
const searchFilter = (term: string, fields: string[]) =>
|
|
155
|
+
fields.map((f) => items.filter().contains(f, term)).reduce((acc, f) => acc.or(f));
|
|
156
|
+
|
|
157
|
+
let query = items.query(COLLECTION_ID).eq('status', status).limit(limit);
|
|
158
|
+
const term = search?.trim();
|
|
159
|
+
if (term) query = query.and(searchFilter(term, ['companyName', 'contactEmail']));
|
|
160
|
+
|
|
161
|
+
// ❌ or() onto a query holding no condition — empty $or branch, every row matches
|
|
162
|
+
items.query(ID).or(items.filter().contains('a', t)).or(items.filter().contains('b', t));
|
|
163
|
+
// ❌ or() onto the query itself — `status` survives only on the first branch
|
|
164
|
+
items.query(ID).eq('status', s).contains('a', t).or(items.filter().contains('b', t));
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
### A vertical SDK — `@wix/bookings`, `@wix/ecom`, …
|
|
168
|
+
|
|
169
|
+
No shared free-text operator; the shape differs per endpoint. Read its *Supported Filters* page
|
|
170
|
+
([QUERY_AND_PAGING.md](QUERY_AND_PAGING.md#the-filterable-fields-are-a-closed-list-published-per-endpoint)),
|
|
171
|
+
then `$or` one clause per identity field it lists. Never route the term to a single field by its
|
|
172
|
+
shape — a measured run shipped this, and one branch is always dead:
|
|
173
|
+
|
|
174
|
+
```ts
|
|
175
|
+
query = term.includes('@')
|
|
176
|
+
? query.startsWith('loginEmail', term)
|
|
177
|
+
: query.startsWith('contact.firstName', term); // a surname matches nothing, ever
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
`startsWith` is prefix-only too — "Smith" never finds "John Smith" — so prefer the containment
|
|
181
|
+
operator when the endpoint declares one, and say which you used in `noResultsState`.
|
|
182
|
+
|
|
183
|
+
**Whatever the shape, prove it narrows.** Run one term you expect to hit a known row and one you
|
|
184
|
+
expect to hit nothing, and check the row count changes for both.
|