@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
|
@@ -1,340 +0,0 @@
|
|
|
1
|
-
# Forms — playbook
|
|
2
|
-
|
|
3
|
-
The machinery ships as files — the schema read flattened into render-ready fields, upload +
|
|
4
|
-
submit, schema-driven validation, and server violations mapped onto controls, correct
|
|
5
|
-
end-to-end. A form is **schema-driven**: the owner picks the fields in their dashboard, so
|
|
6
|
-
every form has a different field set and no "contact form" component could ship for it.
|
|
7
|
-
**You render the fields; you never write the reading, validating or submitting.**
|
|
8
|
-
|
|
9
|
-
## The file map (deployed into `src/`)
|
|
10
|
-
|
|
11
|
-
**On Astro and React the shipped files are tested and work as they are** — this table and the
|
|
12
|
-
contracts below are everything you need to use them, so don't spend the run reading their source;
|
|
13
|
-
wire them and build your surfaces. Reading them is the right move when something is off (a runtime
|
|
14
|
-
error, a field kind this playbook doesn't cover) or when the brief wants a behaviour they don't
|
|
15
|
-
offer — then read the file that owns it and change or extend it. On `lib`, `static`, and a port
|
|
16
|
-
the hook doesn't deploy; the store behind it does, and the wiring sections below say what to
|
|
17
|
-
read first. Files you edit: `SiteLayout.astro` and `styles/global.css`. Files you **create**
|
|
18
|
-
(skeletons below): the form page and its island, plus your home page.
|
|
19
|
-
|
|
20
|
-
| file | what it is |
|
|
21
|
-
|---|---|
|
|
22
|
-
| `wix/config.ts` · `wix/sdk.ts` · `wix/media.ts` · `wix/money.ts` | shared auth seam + helpers (deploy configures; nothing to set) |
|
|
23
|
-
| `wix/forms/types.ts` | the DTOs (`FormDto`, `FormFieldDto`, `FormValues`, `FormErrors`, `SubmissionDto`) — contracts below |
|
|
24
|
-
| `wix/forms/forms.ts` | `getForm`, `listForms` — the transport; the flattening of the raw schema into `FormFieldDto[]` is in `forms-core.ts` beside it (shared with the REST layer) |
|
|
25
|
-
| `wix/forms/submissions.ts` | `uploadFiles`, `createSubmission` — the transport; `toSubmissionValues`, `submissionErrors`, `normalizePhone`, `SUBMITTED_OK` and the upload PUT are in `submissions-core.ts` beside it (shared with the REST layer) |
|
|
26
|
-
| `wix/forms/form-store.ts` | the form state machine, framework-free (`createFormStore({ formId, initialForm? })` — `getState`/`subscribe` + `setValue`/`setValues`/`validate`/`submit`, one instance per form on the page); `validateValue`, `FORM_ERROR`; the hook below binds it to React, every other stack uses it directly |
|
|
27
|
-
| `hooks/forms/useWixForm.ts` | React binding of `form-store.ts` — the whole form as state plus `bind` — contract below |
|
|
28
|
-
| `rest/forms.ts` · `rest/submissions.ts` (skill-side) | the REST twin of the two data files: same exports, same DTOs, over `fetch` with the visitor token — what `--stack static` deploys, and the spec a port reads |
|
|
29
|
-
| `styles/global.css` | the design system: Tailwind v4 + the `@theme` token block (shared across verticals) |
|
|
30
|
-
|
|
31
|
-
There are **no shipped components and no shipped pages** — every control is yours.
|
|
32
|
-
|
|
33
|
-
## What you build — the design job
|
|
34
|
-
|
|
35
|
-
Read the seed plan first: its forms and their fields are what the page renders.
|
|
36
|
-
|
|
37
|
-
1. **A form surface per seeded form** — your layout, your labels' typography, your error
|
|
38
|
-
styling, mapping `form.fields` to controls. **Never name a field in code**: the owner can
|
|
39
|
-
rename, reorder, add or require one from their dashboard, and the page must follow with no
|
|
40
|
-
code change. That is the entire point of this vertical.
|
|
41
|
-
2. **A success state** — the resolved `submit()` IS the confirmation (a visitor cannot read
|
|
42
|
-
submissions back). Show a thank-you; never a "check your submissions" link.
|
|
43
|
-
3. **The home page and wherever the form lives** — hero, copy, the form section.
|
|
44
|
-
|
|
45
|
-
Plus the **theme** (`@theme` block, one edit) and the **chrome** (`SiteLayout`, one pass).
|
|
46
|
-
|
|
47
|
-
### What a complete form page shows (recommended defaults)
|
|
48
|
-
|
|
49
|
-
Defaults for a brief that says nothing about them; the prompt wins when it asks otherwise.
|
|
50
|
-
|
|
51
|
-
- Every field's `label` visible above or beside its control; `required` marked the same way on
|
|
52
|
-
every field; `description` as help text under the control; `placeholder` only where the owner
|
|
53
|
-
wrote one.
|
|
54
|
-
- An error under its own control (`errors[target]`, `id="err-<target>"` so `aria-describedby`
|
|
55
|
-
resolves), the form-level `errors[FORM_ERROR]` above the button; nothing turns red before the
|
|
56
|
-
visitor touched the field or pressed submit.
|
|
57
|
-
- The submit button reads `submitText` when set, your wording else; disabled while `loading`.
|
|
58
|
-
- `form === null` renders a skeleton of the section, not an empty `<form>`; `errors[FORM_ERROR]`
|
|
59
|
-
with no form renders the message and nothing else.
|
|
60
|
-
- The thank-you replaces the form in place (same section, same width) — the visitor stays where
|
|
61
|
-
they were.
|
|
62
|
-
- Copy is the owner's: labels and choices from the schema, no invented privacy promises or
|
|
63
|
-
response-time claims.
|
|
64
|
-
|
|
65
|
-
### The contracts your components consume (tested and work as they are; read the source when something is off or the brief wants more)
|
|
66
|
-
|
|
67
|
-
```ts
|
|
68
|
-
// FormDto — one form, ready to render
|
|
69
|
-
// { id, name, fields: FormFieldDto[], submitText } // submitText "" ⇒ write your own
|
|
70
|
-
|
|
71
|
-
// FormFieldDto — one visible input, flattened (settings nest 2 levels deep upstream)
|
|
72
|
-
// { target, // the input's name, the key in values, the root of error keys
|
|
73
|
-
// label, // never empty; rich-content labels already flattened to text
|
|
74
|
-
// control, // text|textarea|number|rating|email|phone|url|date|time|datetime
|
|
75
|
-
// // |select|radio|checkbox|checkboxGroup|tags|address|file|signature
|
|
76
|
-
// // |payment|appointment|unknown
|
|
77
|
-
// required, placeholder?, description?,
|
|
78
|
-
// defaultValue, // "" | [] | {} | the owner's prefill — already the right SHAPE
|
|
79
|
-
// choices: [{ value, label }], // select/radio/checkboxGroup/tags — else []
|
|
80
|
-
// addressParts: [{ sub, label, required }], // address — else []
|
|
81
|
-
// validation: { format?, minLength?, maxLength?, pattern?, minimum?, maximum?,
|
|
82
|
-
// fileLimit?, minItems?, maxItems? },
|
|
83
|
-
// phoneCountry?, // phone only
|
|
84
|
-
// identifier, // TEXT_AREA, IMAGE_CHOICE, CONTACTS_EMAIL … when control isn't enough
|
|
85
|
-
// inputType, componentType }
|
|
86
|
-
```
|
|
87
|
-
|
|
88
|
-
```ts
|
|
89
|
-
// useWixForm(formId, { initialForm? })
|
|
90
|
-
// → { form, // FormDto | null — null while loading; render a skeleton, not an empty form
|
|
91
|
-
// values, // target → value; arrays for multi-choice/files, objects for an address
|
|
92
|
-
// setValues, // setValues(v => ({ ...v, [target]: next }))
|
|
93
|
-
// bind, // spread onto a text-ish control: <input {...bind(f.target)} />
|
|
94
|
-
// submit, // onSubmit handler; resolves TRUE when the submission was created
|
|
95
|
-
// validate, // validate(target) | validate("addr/city") | validate() for the whole form
|
|
96
|
-
// errors, // target (or target/sub) → visitor-facing message; errors[FORM_ERROR] is form-level
|
|
97
|
-
// loading } // loading the schema, or submitting
|
|
98
|
-
|
|
99
|
-
// createFormStore({ formId, initialForm? }) — the same machine without React (lib, static, a port):
|
|
100
|
-
// getState() → { form, values, errors, loading }; subscribe(fn); start() once mounted (loads the
|
|
101
|
-
// schema unless initialForm was given); stop() on unmount; setValue(target, value);
|
|
102
|
-
// setValues(next | fn); validate(target?) → boolean; submit(event?) → Promise<boolean>.
|
|
103
|
-
// submit(event) reads event.currentTarget to focus the first invalid control — hand it the
|
|
104
|
-
// native submit event. FORM_ERROR and validateValue are exported next to it.
|
|
105
|
-
```
|
|
106
|
-
|
|
107
|
-
`bind` covers input / textarea / select. A **checkbox or radio group** carries `checked`
|
|
108
|
-
instead of `value`, and a **file input cannot be controlled at all** — wire those by hand,
|
|
109
|
-
keeping the same `name`, `onBlur: () => validate(target)` and `aria-describedby` contract.
|
|
110
|
-
|
|
111
|
-
### Which control each field kind wants
|
|
112
|
-
|
|
113
|
-
| `control` | render |
|
|
114
|
-
|---|---|
|
|
115
|
-
| `text` `email` `url` `phone` | `<input>` with the matching `type` — spread `bind` |
|
|
116
|
-
| `textarea` | `<textarea>` — spread `bind` |
|
|
117
|
-
| `number` `rating` | `<input type="number">`, or your own star control writing a number |
|
|
118
|
-
| `date` `time` `datetime` | `<input type="date" / "time" / "datetime-local">` |
|
|
119
|
-
| `select` | `<select>` over `choices` — spread `bind` |
|
|
120
|
-
| `radio` | one `<input type="radio">` per choice, all sharing `name={f.target}` |
|
|
121
|
-
| `checkbox` | a single `<input type="checkbox">`; its value is a **boolean** |
|
|
122
|
-
| `checkboxGroup` `tags` | one checkbox per choice; the value is an **array** of chosen values |
|
|
123
|
-
| `address` | one control per `addressParts` entry; the value is an **object** keyed by `sub`, and its error keys are `target/sub` |
|
|
124
|
-
| `file` `signature` | `<input type="file">` (uncontrolled) — put the `File` objects in `values[target]`; the store uploads them on submit |
|
|
125
|
-
| `payment` `appointment` `unknown` | out of scope for a plain form — a payment field needs the payment flow, an appointment field needs the `bookings` vertical. Render a disabled note rather than an input that submits the wrong thing |
|
|
126
|
-
|
|
127
|
-
### The page and island you create — skeletons
|
|
128
|
-
|
|
129
|
-
The class names here are the Astro/React spelling of rules that hold on every stack; on a
|
|
130
|
-
stack where the hook doesn't deploy, keep the rule and write it in your own CSS. Hooks first,
|
|
131
|
-
branches after (an early return above a hook changes hook order between renders and React
|
|
132
|
-
throws). The island renders on the server too (`client:load` SSRs) — render every state
|
|
133
|
-
totally; nothing in a render path may throw.
|
|
134
|
-
|
|
135
|
-
```astro
|
|
136
|
-
---
|
|
137
|
-
// src/pages/contact.astro — YOU create it. The schema is fetched SERVER-SIDE so the first paint
|
|
138
|
-
// has the fields, and handed to the island as a serialized DTO prop.
|
|
139
|
-
import SiteLayout from "../layouts/SiteLayout.astro";
|
|
140
|
-
import ContactForm from "../components/forms/ContactForm";
|
|
141
|
-
import { getForm } from "../wix/forms/forms";
|
|
142
|
-
import type { FormDto } from "../wix/forms/types";
|
|
143
|
-
|
|
144
|
-
const FORM_ID = "…"; // from the seed result (seed-result.json → forms[].formId)
|
|
145
|
-
let form: FormDto | null = null;
|
|
146
|
-
try {
|
|
147
|
-
form = await getForm(FORM_ID);
|
|
148
|
-
} catch {
|
|
149
|
-
// Guarded: an unhandled SSR throw truncates the response mid-stream; the island loads the
|
|
150
|
-
// schema itself and shows the real error if it fails again.
|
|
151
|
-
}
|
|
152
|
-
---
|
|
153
|
-
<SiteLayout title="Contact">
|
|
154
|
-
<!-- your heading / intro, then: -->
|
|
155
|
-
<ContactForm client:load formId={FORM_ID} initialForm={form ?? undefined} />
|
|
156
|
-
</SiteLayout>
|
|
157
|
-
```
|
|
158
|
-
|
|
159
|
-
```tsx
|
|
160
|
-
// src/components/forms/ContactForm.tsx — YOU build it; contact.astro mounts it.
|
|
161
|
-
import { useState } from "react";
|
|
162
|
-
import { useWixForm, FORM_ERROR } from "../../hooks/forms/useWixForm";
|
|
163
|
-
import type { FormDto } from "../../wix/forms/types";
|
|
164
|
-
|
|
165
|
-
export default function ContactForm({ formId, initialForm }: { formId: string; initialForm?: FormDto }) {
|
|
166
|
-
const f = useWixForm(formId, { initialForm }); // no second fetch when initialForm is passed
|
|
167
|
-
const [sent, setSent] = useState(false);
|
|
168
|
-
// …you implement the render:
|
|
169
|
-
// • sent → your thank-you, in place of the form (the resolved submit() IS the confirmation)
|
|
170
|
-
// • f.errors[FORM_ERROR] && !f.form → the message alone (a form that can't load is a setup problem)
|
|
171
|
-
// • !f.form → a skeleton of the section
|
|
172
|
-
// • else <form noValidate onSubmit={async (e) => { if (await f.submit(e)) setSent(true); }}>
|
|
173
|
-
// mapping f.form.fields to controls per the table above — text-ish: <input type=… {...f.bind(field.target)} />;
|
|
174
|
-
// groups/checkbox/file by hand with the same name / onBlur / aria contract; the error for a
|
|
175
|
-
// control in <p id={`err-${field.target}`}>{f.errors[field.target]}</p>; address subfield
|
|
176
|
-
// errors under f.errors[`${field.target}/${sub}`]; f.errors[FORM_ERROR] above the button;
|
|
177
|
-
// the button labelled f.form.submitText || your wording, disabled while f.loading.
|
|
178
|
-
// noValidate: the store validates in your wording and focuses the first invalid control —
|
|
179
|
-
// the browser's bubbles would race it.
|
|
180
|
-
}
|
|
181
|
-
```
|
|
182
|
-
|
|
183
|
-
### The reference files for stacks where the components don't deploy
|
|
184
|
-
|
|
185
|
-
On `lib`, `static`, and a port, nothing under `hooks/` arrives — and this vertical ships nothing
|
|
186
|
-
under `components/` on any stack. The state machine behind the hook does arrive —
|
|
187
|
-
`wix/forms/form-store.ts` — so you never rewrite it: `createFormStore` per form, `subscribe`,
|
|
188
|
-
render from `getState()`, call its actions. Its `FormState` interface is the render contract;
|
|
189
|
-
read that. What you write is the rendering, and one shipped file is worth reading first:
|
|
190
|
-
|
|
191
|
-
1. `hooks/forms/useWixForm.ts` — `bind`: the exact props a text-ish control gets (`name`,
|
|
192
|
-
`value`, change → `setValue`, blur → `validate(target)`, `aria-describedby="err-<target>"`,
|
|
193
|
-
`aria-invalid`), and how a change of `formId` gets a fresh store. Your framework's controls
|
|
194
|
-
follow the same contract.
|
|
195
|
-
|
|
196
|
-
The control table above is the spec for everything else. Under `references/forms/app/`.
|
|
197
|
-
|
|
198
|
-
### Wiring — Astro (default)
|
|
199
|
-
|
|
200
|
-
1. Set the `@theme` tokens (one edit); brand `SiteLayout.astro` (one pass).
|
|
201
|
-
2. Create the form page and its island per the skeletons above — frontmatter machinery exact,
|
|
202
|
-
presentation yours. Fetch in frontmatter so the first paint has the schema; the island calls
|
|
203
|
-
`useWixForm(formId, { initialForm })` — no second fetch, no loading flash.
|
|
204
|
-
3. Write `pages/index.astro` (home) on `SiteLayout`.
|
|
205
|
-
|
|
206
|
-
### Wiring — another JS framework (`--stack lib`: Vue, Svelte, Solid, plain Vite)
|
|
207
|
-
|
|
208
|
-
Read the reference file listed above before writing the surface.
|
|
209
|
-
|
|
210
|
-
`deploy.mjs forms --stack lib` put the data layer in `src/wix/` and nothing else: `sdk.ts` (the
|
|
211
|
-
visitor client, configured with the public client id), `media.ts`, `money.ts`, and `wix/forms/` —
|
|
212
|
-
`forms.ts`, `submissions.ts`, `types.ts`, the two `*-core.ts` rule files, and `form-store.ts`.
|
|
213
|
-
None of it is React. The hook doesn't ship on this stack; the store replaces it, and you write
|
|
214
|
-
the controls in your framework to the contracts on this page:
|
|
215
|
-
|
|
216
|
-
- bind the store with your framework's external-store primitive (Vue: `shallowRef` updated in
|
|
217
|
-
`subscribe`; Svelte: `readable(store.getState(), (set) => store.subscribe(() => set(store.getState())))`;
|
|
218
|
-
Solid: a signal set in `subscribe`). `createFormStore({ formId })` per form (`start()` when
|
|
219
|
-
mounted, `stop()` when unmounted). State in, actions out — exactly the hook's contract above;
|
|
220
|
-
- a control's change handler calls `setValue(target, value)` (a checkbox group: the array of
|
|
221
|
-
checked values; a file input: `[...input.files]`), blur calls `validate(target)`, the
|
|
222
|
-
`<form>`'s submit handler calls `submit(event)` and shows the thank-you on `true`.
|
|
223
|
-
|
|
224
|
-
Route `/contact` (or wherever the form lives); dev server on 4321; a static build goes through
|
|
225
|
-
`npx @wix/cli@latest release` with `site.outputDirectory` pointing at the build folder, an SSR
|
|
226
|
-
build is hosted by you.
|
|
227
|
-
|
|
228
|
-
### Wiring — static site (`--stack static`, no bundler)
|
|
229
|
-
|
|
230
|
-
Read the reference file listed above before writing the surface.
|
|
231
|
-
|
|
232
|
-
`deploy.mjs forms --stack static --out site` put the REST layer in `site/js/wix/` (browser ESM,
|
|
233
|
-
the `.ts` beside each `.js` for reading). Everything the visitor loads lives under `site/` —
|
|
234
|
-
pages, styles, `js/` — and `wix.config.json`'s `site.outputDirectory` is `"./site"`; the project
|
|
235
|
-
root (config, plan, seed output) is never the upload. Same function names and DTOs as the table
|
|
236
|
-
above, so the contracts on this page hold unchanged: `getForm`, `listForms` from
|
|
237
|
-
`./js/wix/forms.js`; `uploadFiles`, `createSubmission`, `toSubmissionValues`, `submissionErrors`
|
|
238
|
-
from `./js/wix/submissions.js`. The state machine ships too: `createFormStore` from
|
|
239
|
-
`./js/wix/form-store.js` (`start()` once the page is up; `setValue`, `validate`, `submit`;
|
|
240
|
-
`FORM_ERROR` beside it). No hook, no components — you write the rendering in plain JS: build the
|
|
241
|
-
controls ONCE when `getState().form` arrives (one element per `form.fields` entry, `name` =
|
|
242
|
-
`target`, `input` → `setValue`, `blur` → `validate(target)`), and on later notifications update
|
|
243
|
-
only the error text, `aria-invalid`, and the button's disabled state — rebuilding the inputs on
|
|
244
|
-
every keystroke drops focus. `<form novalidate>` with `onsubmit = (e) => store.submit(e).then(ok
|
|
245
|
-
=> ok && showThankYou())`; `submit` reads the native event's `currentTarget` to focus the first
|
|
246
|
-
invalid control. Wix static hosting serves files, not directories: the page is `contact.html`,
|
|
247
|
-
linked as such. The visitor token persists in `localStorage` on its own; never mint per page.
|
|
248
|
-
The page's title and meta description are yours (a form is not an entity page; there is no
|
|
249
|
-
`seoData`). `npx @wix/cli@latest release` uploads `site/`.
|
|
250
|
-
|
|
251
|
-
### Wiring — server-rendered, another language (Flask, Laravel, Rails, …)
|
|
252
|
-
|
|
253
|
-
Read the reference file listed above before writing the surface.
|
|
254
|
-
|
|
255
|
-
Run `deploy.mjs forms --stack static` in the project folder anyway: `js/wix/` is both the
|
|
256
|
-
browser-side code and the readable spec. Then split by where the call runs. **The schema on the
|
|
257
|
-
server:** port `js/wix/forms.ts` and `forms-core.ts` to your language — `getForm` is one GET with
|
|
258
|
-
the visitor token, `toForm` is the flattening — and render the fields in your template (labels,
|
|
259
|
-
required marks, choices, the same `name` = `target`), so the form is in the HTML; one anonymous
|
|
260
|
-
visitor token per process for this public read (mint and refresh per `client.ts`). **Values,
|
|
261
|
-
validation and the submit in the browser:** load `./js/wix/form-store.js` in the template and
|
|
262
|
-
drive the rendered controls through `createFormStore({ formId })` exactly as the static wiring
|
|
263
|
-
above — the browser owns the visitor's token, so the server never handles per-visitor tokens or
|
|
264
|
-
submissions. If the submit must run server-side anyway (no JS), port `submissions.ts` +
|
|
265
|
-
`submissions-core.ts` and `client.ts`'s header applies: one token set per visitor in the visitor's
|
|
266
|
-
session, never one process-wide token. Add your public https origin to the OAuth app's allowed
|
|
267
|
-
domains.
|
|
268
|
-
|
|
269
|
-
**Pre-rendered (Frozen-Flask, Pelican, any static-site generator) → Wix-hosted.** Same port for
|
|
270
|
-
the schema read, run at build time with one anonymous token; the generator emits the form page
|
|
271
|
-
with the fields in the HTML. Run `deploy.mjs forms --stack static --out <build dir>` so `js/wix/`
|
|
272
|
-
is inside the output the page imports from, point `site.outputDirectory` at that folder, `wix
|
|
273
|
-
release`. Pages sit at different depths: give the templates one base path to `js/wix/` (a
|
|
274
|
-
template variable, or root-relative `/js/wix/…`), never a relative `./js/wix/` — it breaks one
|
|
275
|
-
level down. The rendered fields are the first paint; values, validation and the submit still run
|
|
276
|
-
client-side through `createFormStore()` from `./js/wix/form-store.js`, exactly as on a static
|
|
277
|
-
site. Close with the rebuild + release command and one line for the owner: a field renamed or
|
|
278
|
-
added in the dashboard reaches the rendered HTML when that command runs; the submit is live
|
|
279
|
-
regardless.
|
|
280
|
-
|
|
281
|
-
### Wiring — React SPA (Vite etc.)
|
|
282
|
-
|
|
283
|
-
Import `./styles/global.css` once at the app entry (needs `@tailwindcss/vite` in the vite config
|
|
284
|
-
plugins — deploy already added the dep). `useWixForm(FORM_ID)` with no `initialForm`; render a
|
|
285
|
-
skeleton while `form` is null. Deploy wrote the public client id into `wix/config.ts`; nothing
|
|
286
|
-
else to configure.
|
|
287
|
-
|
|
288
|
-
Routes on Wix hosting: the host serves files only, so a clean route answers 404 when loaded directly — hash routes, or one HTML file per route, decided before the first route is written; any URL handed to Wix as a return target must be one the host serves (SKILL.md step 1).
|
|
289
|
-
|
|
290
|
-
## Hard rules
|
|
291
|
-
|
|
292
|
-
- **Never name a field in code.** Map `form.fields`. A page with `values.email` hardcoded
|
|
293
|
-
breaks the moment the owner renames or removes that field — and the owner editing fields
|
|
294
|
-
without a code change is what this vertical is for.
|
|
295
|
-
- **Never build a form without reading the schema.** A hand-built `<form>` posting to Wix Data
|
|
296
|
-
or an email service silently drops real enquiries and loses the dashboard form builder,
|
|
297
|
-
spam protection, notifications and CRM contact mapping.
|
|
298
|
-
- **Values, validation and the submit go through `useWixForm` / the store** — never call the
|
|
299
|
-
submission API by hand, never re-derive a request shape, never validate by a field's name.
|
|
300
|
-
Extend by adding a function in `wix/forms/` for what they don't cover (API contracts: the
|
|
301
|
-
`wix-docs` skill).
|
|
302
|
-
- **The visitor token is enough.** Both the schema read and the submission return 200 on an
|
|
303
|
-
anonymous visitor, even though the spec lists them under owner scopes. Never add a backend,
|
|
304
|
-
a connector token, or `auth.elevate` to make a form work.
|
|
305
|
-
- **Submissions are write-only from a visitor.** Reading them back genuinely 403s. If the app
|
|
306
|
-
must LIST what visitors submitted, that is the `cms` vertical.
|
|
307
|
-
- **All three success statuses are a success** — `CONFIRMED`, `PENDING`, `PAYMENT_WAITING`
|
|
308
|
-
all mean the submission exists. Showing an error instead invites a second submit, and the
|
|
309
|
-
owner gets duplicates for an entry they already have.
|
|
310
|
-
- **Never mock, fail loudly.** A form that cannot load is a setup problem — surface it; never
|
|
311
|
-
fall back to a hand-built form.
|
|
312
|
-
- Don't wrap shipped calls in your own API routes — they run client-side by design.
|
|
313
|
-
- Where the shipped code deploys (Astro, React): theme via the `@theme` tokens, and your markup
|
|
314
|
-
uses Tailwind utilities on the same tokens — one design system. Where it doesn't (`lib`,
|
|
315
|
-
`static`, a port): style with whatever your stack does well, on one token set of your own.
|
|
316
|
-
- **Call every hook before any conditional return.** An island that returns early for the
|
|
317
|
-
skeleton or the thank-you above `useWixForm`/`useState` changes hook order between renders and
|
|
318
|
-
React throws. Hooks first, branches after.
|
|
319
|
-
|
|
320
|
-
## Point the user to their dashboard
|
|
321
|
-
|
|
322
|
-
Hand the owner these links — `{siteId}` is `siteId` in `wix.config.json` (the deploy JSON prints it as
|
|
323
|
-
`dashboardUrl`); `{formId}` is the id the seed result returned.
|
|
324
|
-
|
|
325
|
-
| page | `https://manage.wix.com/dashboard/{siteId}/` + |
|
|
326
|
-
|---|---|
|
|
327
|
-
| Forms list | `wix-forms` |
|
|
328
|
-
| Edit the form (fields, rules, submit settings, notifications) | `wix-forms/form/{formId}` |
|
|
329
|
-
| Its submissions | `wix-forms/form/{formId}/submissions` |
|
|
330
|
-
|
|
331
|
-
Say so when you hand the site over — the whole value of this vertical is that their edits land on the
|
|
332
|
-
site with no code change. Submissions are per form; there is no site-wide submissions page.
|
|
333
|
-
|
|
334
|
-
## Seeding
|
|
335
|
-
|
|
336
|
-
`seed/SEED.md` is the contract: a plain-data plan in, created forms out. Read it when drafting
|
|
337
|
-
the plan; the seed writes the form ids your pages import.
|
|
338
|
-
|
|
339
|
-
**Build the UI only after the seed has run** — the form id comes from it, and the field set
|
|
340
|
-
you are rendering is the one it created.
|
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
// React binding of the form store (wix/forms/form-store.ts) — schema in, validated submission
|
|
2
|
-
// out, minus the markup; the state machine lives there, framework-free. This hook subscribes to
|
|
3
|
-
// one store per mounted form and exposes its state and actions under one name, plus `bind` (the
|
|
4
|
-
// props a text-ish control spreads). Astro islands and React SPAs use this; a static page, Vue,
|
|
5
|
-
// or Svelte uses the store directly.
|
|
6
|
-
//
|
|
7
|
-
// This vertical ships no components: a form is schema-driven (the owner picks the fields), so
|
|
8
|
-
// every form has a different field set and no "contact form" component could ship for it. You
|
|
9
|
-
// render `form.fields`; see references/forms/INSTRUCTIONS.md.
|
|
10
|
-
//
|
|
11
|
-
// SSR-friendly: pass a server-fetched FormDto as `initialForm` (Astro frontmatter) and no
|
|
12
|
-
// client fetch happens; a SPA passes nothing and the hook loads it.
|
|
13
|
-
import { useCallback, useEffect, useRef, useSyncExternalStore } from "react";
|
|
14
|
-
import { createFormStore, type FormStore, type FormSubmitEvent } from "../../wix/forms/form-store";
|
|
15
|
-
import type { FormDto, FormErrors, FormValues } from "../../wix/forms/types";
|
|
16
|
-
|
|
17
|
-
export { FORM_ERROR, validateValue } from "../../wix/forms/form-store";
|
|
18
|
-
|
|
19
|
-
export interface UseWixFormOptions {
|
|
20
|
-
/** Server-fetched form (Astro frontmatter) — skips the client fetch entirely. */
|
|
21
|
-
initialForm?: FormDto;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
export interface UseWixForm {
|
|
25
|
-
/** null while the schema is loading — render a skeleton, not an empty form. */
|
|
26
|
-
form: FormDto | null;
|
|
27
|
-
/** `target` → current value. Arrays for multi-choice and files, objects for an address. */
|
|
28
|
-
values: FormValues;
|
|
29
|
-
setValues: (next: FormValues | ((prev: FormValues) => FormValues)) => void;
|
|
30
|
-
/** Props for a text-ish control, ready to spread: `<input {...bind("email_a1")} />`. */
|
|
31
|
-
bind: (target: string) => {
|
|
32
|
-
name: string;
|
|
33
|
-
value: string;
|
|
34
|
-
onChange: (e: { target: { value: string } }) => void;
|
|
35
|
-
onBlur: () => void;
|
|
36
|
-
"aria-describedby": string;
|
|
37
|
-
"aria-invalid": true | undefined;
|
|
38
|
-
};
|
|
39
|
-
/** `onSubmit`. Resolves TRUE when the submission was created — that IS the success signal. */
|
|
40
|
-
submit: (event?: FormSubmitEvent) => Promise<boolean>;
|
|
41
|
-
/** One field, one address subfield, or the whole form when called with nothing. */
|
|
42
|
-
validate: (target?: string) => boolean;
|
|
43
|
-
errors: FormErrors;
|
|
44
|
-
/** Loading the schema, or submitting. */
|
|
45
|
-
loading: boolean;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
export function useWixForm(formId: string, options: UseWixFormOptions = {}): UseWixForm {
|
|
49
|
-
const { initialForm } = options;
|
|
50
|
-
const ref = useRef<{ formId: string; store: FormStore } | null>(null);
|
|
51
|
-
if (!ref.current || ref.current.formId !== formId) ref.current = { formId, store: createFormStore({ formId, initialForm }) };
|
|
52
|
-
const store = ref.current.store;
|
|
53
|
-
useEffect(() => {
|
|
54
|
-
store.start();
|
|
55
|
-
return () => store.stop();
|
|
56
|
-
}, [store]);
|
|
57
|
-
const state = useSyncExternalStore(store.subscribe, store.getState, store.getState);
|
|
58
|
-
const { values, errors } = state;
|
|
59
|
-
|
|
60
|
-
// Covers input / textarea / select. A checkbox or radio group carries `checked` instead of
|
|
61
|
-
// `value`, and a file input cannot be controlled at all — wire those by hand, keeping the
|
|
62
|
-
// same `name`, `onBlur` and aria contract.
|
|
63
|
-
const bind = useCallback(
|
|
64
|
-
(target: string) => ({
|
|
65
|
-
name: target,
|
|
66
|
-
value: String(values[target] ?? ""),
|
|
67
|
-
onChange: (e: { target: { value: string } }) => store.setValue(target, e.target.value),
|
|
68
|
-
onBlur: () => store.validate(target),
|
|
69
|
-
"aria-describedby": `err-${target}`,
|
|
70
|
-
"aria-invalid": errors[target] ? (true as const) : undefined,
|
|
71
|
-
}),
|
|
72
|
-
[values, errors, store],
|
|
73
|
-
);
|
|
74
|
-
|
|
75
|
-
return {
|
|
76
|
-
form: state.form,
|
|
77
|
-
values,
|
|
78
|
-
setValues: store.setValues,
|
|
79
|
-
bind,
|
|
80
|
-
submit: store.submit,
|
|
81
|
-
validate: store.validate,
|
|
82
|
-
errors,
|
|
83
|
-
loading: state.loading,
|
|
84
|
-
};
|
|
85
|
-
}
|