@wix/agent-skills 1.20.1 → 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 +71 -113
- package/skills/wix-app/references/APP_TOOLS.md +2 -1
- package/skills/wix-app/references/BACKEND_EVENT.md +3 -3
- package/skills/wix-app/references/CUSTOM_ELEMENT_WIDGET.md +41 -152
- package/skills/wix-app/references/DASHBOARD_MODAL.md +4 -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/SDK_MODULE_MAP.md +44 -0
- package/skills/wix-app/references/SITE_PLUGIN.md +36 -190
- package/skills/wix-app/references/app-tools/TOOLS.md +3 -1
- package/skills/wix-app/references/custom-element-widget/SETTINGS_PANEL.md +21 -0
- 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/ECOM_NAVIGATION.md +17 -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/dashboard-plugin/SLOTS.md +4 -18
- 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-app/references/site-plugin/EXAMPLES.md +1 -1
- package/skills/wix-headless-fast/SKILL.md +144 -221
- package/skills/wix-headless-fast/cold-start/bootstrap.mjs +156 -0
- package/skills/wix-headless-fast/{entry/skill.md → cold-start/cold-start.md} +15 -15
- 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 +35 -0
- package/skills/wix-headless-fast/install/agents-md.mjs +39 -0
- package/skills/wix-headless-fast/install/attach.mjs +161 -86
- 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 +259 -0
- package/skills/wix-headless-fast/install/templates.mjs +168 -0
- package/skills/wix-manage/references/ecommerce/pricing-promotions/ecom-pricing-create-coupon.md +10 -19
- package/skills/wix-manage/references/events/create-wix-event.md +5 -1
- 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/install/fast-path.mjs +0 -181
- package/skills/wix-headless-fast/references/blog/INSTRUCTIONS.md +0 -301
- 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/seed-blog.mjs +0 -287
- package/skills/wix-headless-fast/references/bookings/INSTRUCTIONS.md +0 -275
- 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/seed-bookings.mjs +0 -302
- package/skills/wix-headless-fast/references/cms/INSTRUCTIONS.md +0 -353
- 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/seed-cms.mjs +0 -324
- package/skills/wix-headless-fast/references/events/INSTRUCTIONS.md +0 -305
- 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/seed-events.mjs +0 -276
- package/skills/wix-headless-fast/references/forms/INSTRUCTIONS.md +0 -338
- 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/seed-forms.mjs +0 -327
- package/skills/wix-headless-fast/references/members/INSTRUCTIONS.md +0 -314
- 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/seed-members.mjs +0 -94
- package/skills/wix-headless-fast/references/portfolio/INSTRUCTIONS.md +0 -313
- 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/seed-portfolio.mjs +0 -258
- package/skills/wix-headless-fast/references/pricing-plans/INSTRUCTIONS.md +0 -294
- 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/seed-pricing-plans.mjs +0 -279
- package/skills/wix-headless-fast/references/restaurants/INSTRUCTIONS.md +0 -358
- 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/seed-restaurants.mjs +0 -479
- 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/storefront/INSTRUCTIONS.md +0 -608
- 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 -309
- 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 -167
- 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 -124
- package/skills/wix-headless-fast/references/storefront/seed/seed-store.mjs +0 -525
|
@@ -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.
|
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
# Draft Template — Cases A, B and D (router-wired)
|
|
2
|
+
|
|
3
|
+
**Applies to [DRAFT_TEMPLATE.md](DRAFT_TEMPLATE.md)'s Cases A, B and D.** All three need `PatternsReactRouter`, because in all three a row opens a page of its own — a panel is not the drill-in ([UX_SUCCESS_MODEL.md](UX_SUCCESS_MODEL.md)). Case A's detail route is read-only (§4); B and D route to a full `EntityPage`. The collection and settings components live in [DRAFT_TEMPLATE.md](DRAFT_TEMPLATE.md); this file covers only what a router adds — the entry file, the app shell, and the detail/entity page.
|
|
4
|
+
|
|
5
|
+
Every snippet below is copied from the installed `dist/docs/*.md` this session read, not from memory.
|
|
6
|
+
|
|
7
|
+
## 1. Entry — `location` is manual in a Wix CLI app, and only because the router needs it
|
|
8
|
+
|
|
9
|
+
`PatternsReactRouter` reads the page location through `container.usePageLocation()`, which only `withDashboard`'s `location` prop feeds — nothing supplies it automatically in a Wix CLI app the way Yoshi BM flow does:
|
|
10
|
+
|
|
11
|
+
```tsx
|
|
12
|
+
// {feature}.tsx — Case A, B or D
|
|
13
|
+
import { useEffect, useState, type FC } from 'react';
|
|
14
|
+
import { dashboard } from '@wix/dashboard';
|
|
15
|
+
import { WixDesignSystemProvider } from '@wix/design-system';
|
|
16
|
+
import '@wix/design-system/styles.global.css';
|
|
17
|
+
import { {Feature}App } from './{Feature}App';
|
|
18
|
+
|
|
19
|
+
type PageLocation = Parameters<Parameters<typeof dashboard.observeState>[0]>[1]['pageLocation'];
|
|
20
|
+
|
|
21
|
+
const Page: FC = () => {
|
|
22
|
+
const [location, setLocation] = useState<PageLocation | undefined>();
|
|
23
|
+
|
|
24
|
+
useEffect(() => {
|
|
25
|
+
const subscription = dashboard.observeState((_pageParams, environment) => {
|
|
26
|
+
setLocation(environment.pageLocation);
|
|
27
|
+
});
|
|
28
|
+
return () => subscription.disconnect();
|
|
29
|
+
}, []);
|
|
30
|
+
|
|
31
|
+
return (
|
|
32
|
+
<WixDesignSystemProvider>
|
|
33
|
+
{location ? <{Feature}App location={location} /> : null}
|
|
34
|
+
</WixDesignSystemProvider>
|
|
35
|
+
);
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
export default Page;
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
**Skipping this is a runtime-only failure.** Per `PatternsReactRouter`'s own docs: "Nothing catches this before runtime — type checking and bundling both pass, because neither renders the page." `tsc` and `wix build` will not catch a missing `location` — only opening the page in a browser will. This is exactly why [Step 5's Preview](../../SKILL.md#validation) is not optional for Case B/D.
|
|
42
|
+
|
|
43
|
+
## 2. App shell — provider, router, routes
|
|
44
|
+
|
|
45
|
+
```tsx
|
|
46
|
+
// {Feature}App.tsx — Case A, B or D
|
|
47
|
+
import { withDashboard } from '@wix/patterns';
|
|
48
|
+
import { WixPatternsProvider } from '@wix/patterns/provider';
|
|
49
|
+
import { PatternsReactRouter, PatternsReactRoute } from '@wix/patterns/router';
|
|
50
|
+
import { {Feature}CollectionPage } from './{Feature}CollectionPage';
|
|
51
|
+
import { {Feature}EntityPage } from './{Feature}EntityPage';
|
|
52
|
+
// Case D only:
|
|
53
|
+
import { {Feature}SettingsPage } from './{Feature}SettingsPage';
|
|
54
|
+
|
|
55
|
+
export const {Feature}App = withDashboard(() => (
|
|
56
|
+
<WixPatternsProvider>
|
|
57
|
+
<PatternsReactRouter>
|
|
58
|
+
<PatternsReactRoute type="collection" path="/" element={<{Feature}CollectionPage />} />
|
|
59
|
+
{/* Case B/D — editable record. Case A registers this ONE route instead, with
|
|
60
|
+
{Feature}DetailPage as the element and no /new route (§4). Either way the
|
|
61
|
+
type is `editEntity`: it wires back-navigation to the collection. */}
|
|
62
|
+
<PatternsReactRoute type="editEntity" path="/:id" element={<{Feature}EntityPage />} />
|
|
63
|
+
{/* Case B/D only — Case A has nothing to create: */}
|
|
64
|
+
<PatternsReactRoute type="createEntity" path="/new" element={<{Feature}EntityPage />} />
|
|
65
|
+
{/* Case D only: */}
|
|
66
|
+
<PatternsReactRoute type="other" path="/settings" element={<{Feature}SettingsPage />} />
|
|
67
|
+
</PatternsReactRouter>
|
|
68
|
+
</WixPatternsProvider>
|
|
69
|
+
));
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
`PatternsReactRoute`'s `type` is one of exactly `"collection" | "createEntity" | "editEntity" | "other"` — no dedicated settings value, so a settings route is `"other"`. Case B: delete the `/settings` route and the import above it — nothing else changes.
|
|
73
|
+
|
|
74
|
+
`{Feature}CollectionPage` is [DRAFT_TEMPLATE_COLLECTION.md](DRAFT_TEMPLATE_COLLECTION.md)'s component, unchanged; `{Feature}SettingsPage` (Case D) is [DRAFT_TEMPLATE_SETTINGS.md](DRAFT_TEMPLATE_SETTINGS.md).
|
|
75
|
+
|
|
76
|
+
## 2b. The collection side of the handoff
|
|
77
|
+
|
|
78
|
+
The router file above registers `/new`; something has to navigate there. All three of these live on
|
|
79
|
+
the collection page, and `usePatternsNavigate` comes from **`@wix/patterns/router`** — not the root
|
|
80
|
+
export, which is where it is easy to reach for it:
|
|
81
|
+
|
|
82
|
+
```tsx
|
|
83
|
+
import { PrimaryPageButton } from '@wix/patterns';
|
|
84
|
+
import { usePatternsNavigate } from '@wix/patterns/router';
|
|
85
|
+
|
|
86
|
+
const { navigateToEntityPage } = usePatternsNavigate<{Entity}>();
|
|
87
|
+
const openNew = () => navigateToEntityPage({ path: '/new' }); // no record yet — omit `entity`
|
|
88
|
+
|
|
89
|
+
// CollectionPage.Header — primaryAction takes an ELEMENT, not a { text, onClick } config:
|
|
90
|
+
<CollectionPage.Header
|
|
91
|
+
title={{ text: '{Page Title}' }}
|
|
92
|
+
primaryAction={<PrimaryPageButton text="Add {entity}" onClick={openNew} />}
|
|
93
|
+
/>
|
|
94
|
+
|
|
95
|
+
// the empty state should offer the same action, and this one IS a config object:
|
|
96
|
+
<CollectionEmptyState title="No {feature} yet" addNewCta={{ text: 'Add {entity}', onClick: openNew }} />
|
|
97
|
+
|
|
98
|
+
// and a row opens the edit route:
|
|
99
|
+
onRowClick={(item) => navigateToEntityPage({ path: `/${item.id}`, entity: item })}
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
The two shapes differ on purpose — `primaryAction` is an element, `addNewCta` is `{ text, onClick }`.
|
|
103
|
+
Guessing either costs a compile round.
|
|
104
|
+
|
|
105
|
+
## 3. Entity page — one component for both `/new` and `/:id`
|
|
106
|
+
|
|
107
|
+
Full call details (both generics, what `onSave` receives, the `UseEntityPageParams` pick list) are in `<pkgRoot>/dist/docs/useEntityPage.md` — read it before filling in fields. The part specific to this router-based shape:
|
|
108
|
+
|
|
109
|
+
```tsx
|
|
110
|
+
// {Feature}EntityPage.tsx — Case B or D (sketch — see dist/docs/useEntityPage.md for the full call)
|
|
111
|
+
import { useParams } from 'react-router-dom'; // NOT @wix/patterns/router — PatternsReactRoute wraps react-router-dom's Route, but only exports PatternsReactRoute/PatternsReactRouter/usePatternsNavigate itself
|
|
112
|
+
import { useEntityPage, EntityPage } from '@wix/patterns';
|
|
113
|
+
import { useForm } from '@wix/patterns/form';
|
|
114
|
+
import { fetch{Entity}, save{Entity}, type {Entity} } from './{feature}-api';
|
|
115
|
+
|
|
116
|
+
// The form's shape is yours to declare, and need not match the saved entity type.
|
|
117
|
+
type {Entity}FormFields = { name: string };
|
|
118
|
+
|
|
119
|
+
export const {Feature}EntityPage = () => {
|
|
120
|
+
const { id } = useParams<{ id?: string }>();
|
|
121
|
+
const form = useForm<{Entity}FormFields>();
|
|
122
|
+
|
|
123
|
+
const state = useEntityPage<{Entity}, {Entity}FormFields>({
|
|
124
|
+
parentPath: '/', // NOT parentPageId — this shape always uses Patterns Router
|
|
125
|
+
isNewEntity: () => !id, // a getter: the route can change (/new -> /:id after save) while this stays mounted
|
|
126
|
+
form,
|
|
127
|
+
fetch: () => (id ? fetch{Entity}(id).then((entity) => ({ entity })) : Promise.resolve({ entity: undefined })),
|
|
128
|
+
onSave: ({ widgetsFormData }) =>
|
|
129
|
+
save{Entity}({ id, ...form.getValues(), ...widgetsFormData }).then((updatedEntity) => ({ updatedEntity })),
|
|
130
|
+
});
|
|
131
|
+
|
|
132
|
+
return (
|
|
133
|
+
<EntityPage state={state}>
|
|
134
|
+
<EntityPage.Header title={{ text: id ? 'Edit {Entity}' : 'New {Entity}' }} />
|
|
135
|
+
<EntityPage.Content>
|
|
136
|
+
<EntityPage.MainContent>{/* form cards — see dist/docs/EntityPage.md */}</EntityPage.MainContent>
|
|
137
|
+
</EntityPage.Content>
|
|
138
|
+
</EntityPage>
|
|
139
|
+
);
|
|
140
|
+
};
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
`useEntityPage`'s own docs are explicit about both details above: `parentPath` "Must be passed if using Patterns Router" (`parentPageId` is the non-router alternative — irrelevant here, since Case B/D always uses the router), and `isNewEntity` should be "a getter when the route can change while the page stays mounted" — exactly this component's case, since a successful create typically navigates `/new` → `/:newId`.
|
|
144
|
+
|
|
145
|
+
**`UseEntityPageParams` is a `Pick<>`, so a param missing from it is a compile error, not an ignored prop.** `isNewEntity` is in that list at 1.470.0 and absent before ~1.46x. If it doesn't compile, read the pick list in your installed `dist/types/hooks/useEntityPage.d.ts` and upgrade — deleting the line makes a create route behave as an edit.
|
|
146
|
+
|
|
147
|
+
## 4. Read-only detail route — Case A
|
|
148
|
+
|
|
149
|
+
A display-only collection still routes its rows to a page — but not an `EntityPage`, which has no
|
|
150
|
+
read-only mode and still has none at **1.471.0**: `fetch` and `onSave` are both required, and
|
|
151
|
+
`actionsBarConfig` (`saveCta.text`, `cancelCta`) can retext Save but not remove it. It would ship
|
|
152
|
+
two buttons that either do nothing or save a form nobody was offered.
|
|
153
|
+
|
|
154
|
+
Use a WDS `Page` — what Cairo does itself: `example-bm`'s `DataExtensionEntityViewPage` and
|
|
155
|
+
auto-patterns' `ViewModeEntityPage` are both plain WDS `Page`s, the latter unexported.
|
|
156
|
+
|
|
157
|
+
```tsx
|
|
158
|
+
// {Feature}DetailPage.tsx — Case A
|
|
159
|
+
import { useEffect, useState } from 'react';
|
|
160
|
+
import { useParams } from 'react-router-dom';
|
|
161
|
+
import { Card, Loader, Page, Text } from '@wix/design-system';
|
|
162
|
+
import { usePatternsNavigate } from '@wix/patterns/router';
|
|
163
|
+
import { fetch{Entity}, type {Entity} } from './{feature}-api';
|
|
164
|
+
|
|
165
|
+
export const {Feature}DetailPage = () => {
|
|
166
|
+
const { id } = useParams<{ id: string }>();
|
|
167
|
+
const { navigateToCollectionPage } = usePatternsNavigate();
|
|
168
|
+
const [entity, setEntity] = useState<{Entity} | undefined>();
|
|
169
|
+
|
|
170
|
+
useEffect(() => {
|
|
171
|
+
if (id) {
|
|
172
|
+
fetch{Entity}(id).then(setEntity);
|
|
173
|
+
}
|
|
174
|
+
}, [id]);
|
|
175
|
+
|
|
176
|
+
return (
|
|
177
|
+
<Page>
|
|
178
|
+
{/* The way back is the header's back button — a read-only page has no Cancel. */}
|
|
179
|
+
<Page.Header
|
|
180
|
+
title={entity?.name ?? '{Entity}'}
|
|
181
|
+
showBackButton
|
|
182
|
+
onBackClicked={() => navigateToCollectionPage({ path: '/' })}
|
|
183
|
+
/>
|
|
184
|
+
<Page.Content>
|
|
185
|
+
{entity ? (
|
|
186
|
+
<Card>
|
|
187
|
+
<Card.Header title="Details" />
|
|
188
|
+
<Card.Divider />
|
|
189
|
+
<Card.Content>
|
|
190
|
+
<Text>{entity.name}</Text>
|
|
191
|
+
</Card.Content>
|
|
192
|
+
</Card>
|
|
193
|
+
) : (
|
|
194
|
+
<Loader />
|
|
195
|
+
)}
|
|
196
|
+
</Page.Content>
|
|
197
|
+
</Page>
|
|
198
|
+
);
|
|
199
|
+
};
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
If the request later grows an edit form this becomes §3's `EntityPage`, route type and `onRowClick`
|
|
203
|
+
unchanged — which is why Case A registers `editEntity`, not `other`.
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
# Draft Template — Settings page (Cases C and D)
|
|
2
|
+
|
|
3
|
+
> Pick your case in [DRAFT_TEMPLATE.md](DRAFT_TEMPLATE.md) first; this page covers Case C or D.
|
|
4
|
+
|
|
5
|
+
## The settings page
|
|
6
|
+
|
|
7
|
+
No dedicated toolkit file exists for this yet (unlike Entity/Collection) — the shape, verified against `useSettingsPage.md`:
|
|
8
|
+
|
|
9
|
+
```tsx
|
|
10
|
+
// {Feature}SettingsPage.tsx — Case C or D
|
|
11
|
+
import { SettingsPage, useSettingsPage, useSettings } from '@wix/patterns';
|
|
12
|
+
import { useForm } from '@wix/patterns/form';
|
|
13
|
+
import { fetch{Feature}Settings, save{Feature}Settings, type {Feature}Settings } from './{feature}-api';
|
|
14
|
+
|
|
15
|
+
// The form's shape is yours to declare, and need not match the saved settings type —
|
|
16
|
+
// one field per control on the page.
|
|
17
|
+
type {Feature}SettingsFormFields = { reminderHours: number; notifyStaff: boolean };
|
|
18
|
+
|
|
19
|
+
export const {Feature}SettingsPage = () => {
|
|
20
|
+
const form = useForm<{Feature}SettingsFormFields>();
|
|
21
|
+
|
|
22
|
+
const state = useSettingsPage<{Feature}Settings, {Feature}SettingsFormFields>({
|
|
23
|
+
form,
|
|
24
|
+
fetch: () => fetch{Feature}Settings().then((settings) => ({ settings })),
|
|
25
|
+
onSave: () => save{Feature}Settings(form.getValues()),
|
|
26
|
+
onCancel: async () => form.reset(),
|
|
27
|
+
saveSuccessToast: 'Settings saved',
|
|
28
|
+
saveErrorToast: (err, { retry }) => ({ message: 'Failed to save settings', action: { text: 'Retry', onClick: retry } }),
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
const settings = useSettings<{Feature}Settings, {Feature}SettingsFormFields>(state);
|
|
32
|
+
|
|
33
|
+
return (
|
|
34
|
+
<SettingsPage state={state}>
|
|
35
|
+
<SettingsPage.Header title={{ text: '{Settings Page Title}' }} />
|
|
36
|
+
<SettingsPage.Content>
|
|
37
|
+
<SettingsPage.MainContent>{/* form cards — same field-controller patterns as EntityPage */}</SettingsPage.MainContent>
|
|
38
|
+
</SettingsPage.Content>
|
|
39
|
+
</SettingsPage>
|
|
40
|
+
);
|
|
41
|
+
};
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
`useSettingsPage`'s params are all required except `saveSuccessToast`/`saveErrorToast`: `form`, `fetch`, `onSave`, `onCancel`. There is no `parentPath`/`parentPageId` — a settings page isn't reached by drilling into a row, so it carries no back-navigation contract, and Case C needs no router at all to reach it (Section 1's entry renders it directly).
|
|
@@ -141,6 +141,23 @@ dashboard.navigate(
|
|
|
141
141
|
);
|
|
142
142
|
```
|
|
143
143
|
|
|
144
|
+
## taxSettings()
|
|
145
|
+
|
|
146
|
+
Ecom Extensions Dashboard Pages 'taxSettings()' destination builder for navigating to the Tax Settings dashboard page.
|
|
147
|
+
|
|
148
|
+
**Request:**
|
|
149
|
+
This method does not take any parameters.
|
|
150
|
+
|
|
151
|
+
**Example:**
|
|
152
|
+
```typescript
|
|
153
|
+
import { dashboard } from "@wix/dashboard";
|
|
154
|
+
import { pages } from "@wix/ecom/dashboard";
|
|
155
|
+
|
|
156
|
+
dashboard.navigate(
|
|
157
|
+
pages.taxSettings(),
|
|
158
|
+
);
|
|
159
|
+
```
|
|
160
|
+
|
|
144
161
|
## orderRefund()
|
|
145
162
|
|
|
146
163
|
Ecom Extensions Dashboard Pages 'orderRefund()' destination builder for navigating to the Order Refund dashboard page.
|