@wix/agent-skills 1.17.0 → 1.18.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 +115 -12
- package/skills/wix-app/references/APP_MARKET_REVIEW.md +1 -1
- package/skills/wix-app/references/BACKEND_API.md +18 -0
- package/skills/wix-app/references/CUSTOM_ELEMENT_WIDGET.md +6 -0
- package/skills/wix-app/references/DASHBOARD_MODAL.md +10 -2
- package/skills/wix-app/references/DASHBOARD_PAGE.md +32 -70
- package/skills/wix-app/references/EDITOR_REACT_COMPONENT.md +14 -3
- package/skills/wix-app/references/SITE_PLUGIN.md +12 -0
- package/skills/wix-app/references/WIX_PATTERNS_DOCS.md +74 -68
- package/skills/wix-app/references/dashboard-page/COLLECTION_TOOLKIT.md +79 -0
- package/skills/wix-app/references/dashboard-page/ENTITY_PAGE_TOOLKIT.md +73 -0
- package/skills/wix-app/references/dashboard-page/PATTERNS_BUNDLE_READING.md +52 -0
- package/skills/wix-app/references/dashboard-page/UX_SUCCESS_MODEL.md +184 -0
- package/skills/wix-app/references/editor-react-component/ANIMATED-COMPONENTS.md +12 -11
- package/skills/wix-app/references/editor-react-component/BRANDED-COMPONENTS.md +1 -0
- package/skills/wix-app/references/editor-react-component/BROWSER-SUPPORT.md +56 -0
- package/skills/wix-app/references/editor-react-component/COMPONENT-PREVIEW.md +16 -8
- package/skills/wix-app/references/editor-react-component/CSS-GUIDELINES.md +19 -1
- package/skills/wix-app/references/editor-react-component/DESIGN-STATES.md +3 -0
- package/skills/wix-base44-connector/SKILL.md +133 -44
- package/skills/wix-base44-connector/references/CAPABILITY_MAP.md +78 -0
- package/skills/wix-base44-connector/scripts/utils.js +216 -30
- package/skills/wix-headless/entry/skill.md +1 -1
- package/skills/wix-headless/references/CAPABILITIES.md +9 -1
- package/skills/wix-headless/references/DESIGN.md +1 -0
- package/skills/wix-headless/references/DISCOVERY.md +2 -1
- package/skills/wix-headless/references/IMAGE_GENERATION.md +1 -0
- package/skills/wix-headless/references/SDK_HANDOFF.md +4 -1
- package/skills/wix-headless/references/SEED.md +2 -1
- package/skills/wix-headless/references/SETUP.md +1 -0
- package/skills/wix-headless/references/inline-recipes/how-to-code-a-blog.md +2 -2
- package/skills/wix-headless/references/inline-recipes/how-to-code-a-store.md +26 -8
- package/skills/wix-headless/references/inline-recipes/how-to-code-forms.md +26 -10
- package/skills/wix-headless/references/inline-recipes/how-to-code-members-astro.md +8 -8
- package/skills/wix-headless/references/inline-recipes/how-to-code-members-custom-login.md +1 -1
- package/skills/wix-headless/references/inline-recipes/how-to-code-members-non-astro.md +1 -1
- package/skills/wix-headless/references/inline-recipes/how-to-code-rentals.md +254 -0
- package/skills/wix-headless/references/inline-recipes/setup-online-store.md +13 -0
- package/skills/wix-headless/references/inline-recipes/setup-rentals.md +254 -0
- package/skills/wix-headless/references/non-astro.md +1 -1
- package/skills/wix-headless-fast/SKILL.md +166 -0
- package/skills/wix-headless-fast/entry/skill.md +99 -0
- package/skills/wix-headless-fast/install/deploy.mjs +433 -0
- package/skills/wix-headless-fast/install/fast-path.mjs +141 -0
- package/skills/wix-headless-fast/references/blog/INSTRUCTIONS.md +137 -0
- package/skills/wix-headless-fast/references/blog/app/components/blog/BlogFeedView.tsx +137 -0
- package/skills/wix-headless-fast/references/blog/app/components/blog/PostView.tsx +113 -0
- package/skills/wix-headless-fast/references/blog/app/components/blog/RichContent.tsx +42 -0
- package/skills/wix-headless-fast/references/blog/app/hooks/blog/useBlogFeed.ts +123 -0
- package/skills/wix-headless-fast/references/blog/app/hooks/blog/usePost.ts +70 -0
- package/skills/wix-headless-fast/references/blog/app/wix/blog/posts.ts +99 -0
- package/skills/wix-headless-fast/references/blog/app/wix/blog/taxonomy.ts +76 -0
- package/skills/wix-headless-fast/references/blog/app/wix/blog/types.ts +62 -0
- package/skills/wix-headless-fast/references/blog/app-astro/layouts/SiteLayout.astro +40 -0
- package/skills/wix-headless-fast/references/blog/app-astro/pages/blog/[...slug].astro +99 -0
- package/skills/wix-headless-fast/references/blog/app-astro/pages/blog.astro +24 -0
- package/skills/wix-headless-fast/references/blog/lock/astro/package-lock.json +16156 -0
- package/skills/wix-headless-fast/references/blog/seed/SEED.md +72 -0
- package/skills/wix-headless-fast/references/blog/seed/seed-blog.mjs +287 -0
- package/skills/wix-headless-fast/references/bookings/INSTRUCTIONS.md +129 -0
- package/skills/wix-headless-fast/references/bookings/app/components/bookings/ServiceBookingView.tsx +143 -0
- package/skills/wix-headless-fast/references/bookings/app/components/bookings/ServicesView.tsx +119 -0
- package/skills/wix-headless-fast/references/bookings/app/hooks/bookings/useBookingFlow.ts +138 -0
- package/skills/wix-headless-fast/references/bookings/app/hooks/bookings/useServices.ts +54 -0
- package/skills/wix-headless-fast/references/bookings/app/wix/bookings/booking.ts +206 -0
- package/skills/wix-headless-fast/references/bookings/app/wix/bookings/services.ts +96 -0
- package/skills/wix-headless-fast/references/bookings/app/wix/bookings/types.ts +70 -0
- package/skills/wix-headless-fast/references/bookings/app-astro/layouts/SiteLayout.astro +40 -0
- package/skills/wix-headless-fast/references/bookings/app-astro/pages/services/[slug].astro +76 -0
- package/skills/wix-headless-fast/references/bookings/app-astro/pages/services.astro +22 -0
- package/skills/wix-headless-fast/references/bookings/lock/astro/package-lock.json +11962 -0
- package/skills/wix-headless-fast/references/bookings/seed/SEED.md +61 -0
- package/skills/wix-headless-fast/references/bookings/seed/seed-bookings.mjs +302 -0
- package/skills/wix-headless-fast/references/cms/INSTRUCTIONS.md +179 -0
- package/skills/wix-headless-fast/references/cms/app/hooks/cms/useCollection.ts +83 -0
- package/skills/wix-headless-fast/references/cms/app/hooks/cms/useItem.ts +57 -0
- package/skills/wix-headless-fast/references/cms/app/wix/cms/items.ts +151 -0
- package/skills/wix-headless-fast/references/cms/app/wix/cms/types.ts +75 -0
- package/skills/wix-headless-fast/references/cms/app-astro/layouts/SiteLayout.astro +41 -0
- package/skills/wix-headless-fast/references/cms/lock/astro/package-lock.json +11262 -0
- package/skills/wix-headless-fast/references/cms/seed/SEED.md +103 -0
- package/skills/wix-headless-fast/references/cms/seed/seed-cms.mjs +324 -0
- package/skills/wix-headless-fast/references/events/INSTRUCTIONS.md +149 -0
- package/skills/wix-headless-fast/references/events/app/components/events/EventConfirmationView.tsx +66 -0
- package/skills/wix-headless-fast/references/events/app/components/events/EventRegistrationView.tsx +176 -0
- package/skills/wix-headless-fast/references/events/app/components/events/EventsView.tsx +118 -0
- package/skills/wix-headless-fast/references/events/app/hooks/events/useEventRegistration.ts +117 -0
- package/skills/wix-headless-fast/references/events/app/hooks/events/useEvents.ts +59 -0
- package/skills/wix-headless-fast/references/events/app/wix/events/events.ts +136 -0
- package/skills/wix-headless-fast/references/events/app/wix/events/registration.ts +128 -0
- package/skills/wix-headless-fast/references/events/app/wix/events/types.ts +61 -0
- package/skills/wix-headless-fast/references/events/app-astro/layouts/SiteLayout.astro +40 -0
- package/skills/wix-headless-fast/references/events/app-astro/pages/event-confirmation.astro +12 -0
- package/skills/wix-headless-fast/references/events/app-astro/pages/events/[slug].astro +80 -0
- package/skills/wix-headless-fast/references/events/app-astro/pages/events.astro +21 -0
- package/skills/wix-headless-fast/references/events/lock/astro/package-lock.json +11884 -0
- package/skills/wix-headless-fast/references/events/seed/SEED.md +86 -0
- package/skills/wix-headless-fast/references/events/seed/seed-events.mjs +276 -0
- package/skills/wix-headless-fast/references/forms/INSTRUCTIONS.md +150 -0
- package/skills/wix-headless-fast/references/forms/app/hooks/forms/useWixForm.ts +317 -0
- package/skills/wix-headless-fast/references/forms/app/wix/forms/forms.ts +269 -0
- package/skills/wix-headless-fast/references/forms/app/wix/forms/submissions.ts +231 -0
- package/skills/wix-headless-fast/references/forms/app/wix/forms/types.ts +135 -0
- package/skills/wix-headless-fast/references/forms/lock/astro/package-lock.json +10593 -0
- package/skills/wix-headless-fast/references/forms/seed/SEED.md +108 -0
- package/skills/wix-headless-fast/references/forms/seed/seed-forms.mjs +320 -0
- package/skills/wix-headless-fast/references/members/INSTRUCTIONS.md +63 -0
- package/skills/wix-headless-fast/references/members/app/components/members/AccountView.tsx +60 -0
- package/skills/wix-headless-fast/references/members/app/components/members/LoginForm.tsx +155 -0
- package/skills/wix-headless-fast/references/members/app/components/members/MemberMenu.tsx +78 -0
- package/skills/wix-headless-fast/references/members/app/components/members/RequireAuth.tsx +47 -0
- package/skills/wix-headless-fast/references/members/app/hooks/members/useMember.ts +66 -0
- package/skills/wix-headless-fast/references/members/app/wix/members/auth.ts +88 -0
- package/skills/wix-headless-fast/references/members/app/wix/members/client.ts +53 -0
- package/skills/wix-headless-fast/references/members/app/wix/members/member-store.ts +122 -0
- package/skills/wix-headless-fast/references/members/app/wix/members/members.ts +50 -0
- package/skills/wix-headless-fast/references/members/app/wix/members/types.ts +21 -0
- package/skills/wix-headless-fast/references/members/app-astro/layouts/SiteLayout.astro +42 -0
- package/skills/wix-headless-fast/references/members/app-astro/pages/account.astro +10 -0
- package/skills/wix-headless-fast/references/members/app-astro/pages/login.astro +11 -0
- package/skills/wix-headless-fast/references/members/lock/astro/package-lock.json +10329 -0
- package/skills/wix-headless-fast/references/members/seed/SEED.md +39 -0
- package/skills/wix-headless-fast/references/members/seed/seed-members.mjs +94 -0
- package/skills/wix-headless-fast/references/portfolio/INSTRUCTIONS.md +134 -0
- package/skills/wix-headless-fast/references/portfolio/app/components/portfolio/CollectionProjectsView.tsx +110 -0
- package/skills/wix-headless-fast/references/portfolio/app/components/portfolio/CollectionsView.tsx +90 -0
- package/skills/wix-headless-fast/references/portfolio/app/components/portfolio/ProjectDetailView.tsx +115 -0
- package/skills/wix-headless-fast/references/portfolio/app/hooks/portfolio/useCollectionProjects.ts +59 -0
- package/skills/wix-headless-fast/references/portfolio/app/hooks/portfolio/useCollections.ts +39 -0
- package/skills/wix-headless-fast/references/portfolio/app/hooks/portfolio/useProjectDetail.ts +58 -0
- package/skills/wix-headless-fast/references/portfolio/app/wix/portfolio/portfolio.ts +165 -0
- package/skills/wix-headless-fast/references/portfolio/app/wix/portfolio/types.ts +55 -0
- package/skills/wix-headless-fast/references/portfolio/app-astro/layouts/SiteLayout.astro +40 -0
- package/skills/wix-headless-fast/references/portfolio/app-astro/pages/portfolio/[slug].astro +30 -0
- package/skills/wix-headless-fast/references/portfolio/app-astro/pages/portfolio.astro +21 -0
- package/skills/wix-headless-fast/references/portfolio/app-astro/pages/projects/[slug].astro +29 -0
- package/skills/wix-headless-fast/references/portfolio/lock/astro/package-lock.json +10197 -0
- package/skills/wix-headless-fast/references/portfolio/seed/SEED.md +78 -0
- package/skills/wix-headless-fast/references/portfolio/seed/seed-portfolio.mjs +258 -0
- package/skills/wix-headless-fast/references/pricing-plans/INSTRUCTIONS.md +133 -0
- package/skills/wix-headless-fast/references/pricing-plans/app/components/pricing-plans/PlanDetailView.tsx +58 -0
- package/skills/wix-headless-fast/references/pricing-plans/app/components/pricing-plans/PlansView.tsx +126 -0
- package/skills/wix-headless-fast/references/pricing-plans/app/hooks/pricing-plans/usePlanPurchase.ts +37 -0
- package/skills/wix-headless-fast/references/pricing-plans/app/hooks/pricing-plans/usePlans.ts +39 -0
- package/skills/wix-headless-fast/references/pricing-plans/app/wix/pricing-plans/plans.ts +75 -0
- package/skills/wix-headless-fast/references/pricing-plans/app/wix/pricing-plans/purchase.ts +45 -0
- package/skills/wix-headless-fast/references/pricing-plans/app/wix/pricing-plans/types.ts +30 -0
- package/skills/wix-headless-fast/references/pricing-plans/app-astro/layouts/SiteLayout.astro +41 -0
- package/skills/wix-headless-fast/references/pricing-plans/app-astro/pages/plans/[slug].astro +40 -0
- package/skills/wix-headless-fast/references/pricing-plans/app-astro/pages/plans.astro +21 -0
- package/skills/wix-headless-fast/references/pricing-plans/lock/astro/package-lock.json +11226 -0
- package/skills/wix-headless-fast/references/pricing-plans/seed/SEED.md +71 -0
- package/skills/wix-headless-fast/references/pricing-plans/seed/seed-pricing-plans.mjs +279 -0
- package/skills/wix-headless-fast/references/restaurants/INSTRUCTIONS.md +165 -0
- package/skills/wix-headless-fast/references/restaurants/app/components/restaurants/MenuView.tsx +142 -0
- package/skills/wix-headless-fast/references/restaurants/app/components/restaurants/OrderCartButton.tsx +26 -0
- package/skills/wix-headless-fast/references/restaurants/app/components/restaurants/OrderCartDrawer.tsx +121 -0
- package/skills/wix-headless-fast/references/restaurants/app/components/restaurants/ReservationView.tsx +155 -0
- package/skills/wix-headless-fast/references/restaurants/app/hooks/restaurants/useMenus.ts +55 -0
- package/skills/wix-headless-fast/references/restaurants/app/hooks/restaurants/useOrderCart.ts +43 -0
- package/skills/wix-headless-fast/references/restaurants/app/hooks/restaurants/useReservation.ts +177 -0
- package/skills/wix-headless-fast/references/restaurants/app/wix/restaurants/menu.ts +165 -0
- package/skills/wix-headless-fast/references/restaurants/app/wix/restaurants/order-store.ts +103 -0
- package/skills/wix-headless-fast/references/restaurants/app/wix/restaurants/ordering.ts +254 -0
- package/skills/wix-headless-fast/references/restaurants/app/wix/restaurants/reservations.ts +146 -0
- package/skills/wix-headless-fast/references/restaurants/app/wix/restaurants/types.ts +168 -0
- package/skills/wix-headless-fast/references/restaurants/app-astro/layouts/SiteLayout.astro +47 -0
- package/skills/wix-headless-fast/references/restaurants/app-astro/pages/menu.astro +22 -0
- package/skills/wix-headless-fast/references/restaurants/app-astro/pages/reservations.astro +12 -0
- package/skills/wix-headless-fast/references/restaurants/lock/astro/package-lock.json +12560 -0
- package/skills/wix-headless-fast/references/restaurants/seed/SEED.md +81 -0
- package/skills/wix-headless-fast/references/restaurants/seed/seed-restaurants.mjs +479 -0
- package/skills/wix-headless-fast/references/shared/CONTENT.md +22 -0
- package/skills/wix-headless-fast/references/shared/CUSTOM_OPERATIONS.md +73 -0
- package/skills/wix-headless-fast/references/shared/DESIGN.md +26 -0
- package/skills/wix-headless-fast/references/shared/app/styles/global.css +52 -0
- package/skills/wix-headless-fast/references/shared/app/wix/config.ts +15 -0
- package/skills/wix-headless-fast/references/shared/app/wix/media.ts +27 -0
- package/skills/wix-headless-fast/references/shared/app/wix/money.ts +24 -0
- package/skills/wix-headless-fast/references/shared/app/wix/sdk.ts +76 -0
- package/skills/wix-headless-fast/references/shared/capabilities/media-upload/app/wix/media-upload/client.ts +46 -0
- package/skills/wix-headless-fast/references/shared/capabilities/media-upload/app-astro/pages/api/wix/media-upload.ts +46 -0
- package/skills/wix-headless-fast/references/shared/seed/images.mjs +145 -0
- package/skills/wix-headless-fast/references/storefront/INSTRUCTIONS.md +149 -0
- package/skills/wix-headless-fast/references/storefront/app/components/storefront/CartButton.tsx +26 -0
- package/skills/wix-headless-fast/references/storefront/app/components/storefront/CartDrawer.tsx +121 -0
- package/skills/wix-headless-fast/references/storefront/app/components/storefront/ProductCard.tsx +100 -0
- package/skills/wix-headless-fast/references/storefront/app/components/storefront/ProductDetailView.tsx +130 -0
- package/skills/wix-headless-fast/references/storefront/app/components/storefront/ProductGrid.tsx +48 -0
- package/skills/wix-headless-fast/references/storefront/app/components/storefront/ShopView.tsx +66 -0
- package/skills/wix-headless-fast/references/storefront/app/components/storefront/VariantPicker.tsx +103 -0
- package/skills/wix-headless-fast/references/storefront/app/hooks/storefront/useCart.ts +48 -0
- package/skills/wix-headless-fast/references/storefront/app/hooks/storefront/useProductDetail.ts +140 -0
- package/skills/wix-headless-fast/references/storefront/app/hooks/storefront/useShop.ts +80 -0
- package/skills/wix-headless-fast/references/storefront/app/wix/storefront/cart-store.ts +101 -0
- package/skills/wix-headless-fast/references/storefront/app/wix/storefront/cart.ts +221 -0
- package/skills/wix-headless-fast/references/storefront/app/wix/storefront/catalog.ts +215 -0
- package/skills/wix-headless-fast/references/storefront/app/wix/storefront/types.ts +109 -0
- package/skills/wix-headless-fast/references/storefront/app-astro/layouts/SiteLayout.astro +46 -0
- package/skills/wix-headless-fast/references/storefront/app-astro/pages/products/[slug].astro +56 -0
- package/skills/wix-headless-fast/references/storefront/app-astro/pages/shop.astro +23 -0
- package/skills/wix-headless-fast/references/storefront/lock/astro/package-lock.json +12247 -0
- package/skills/wix-headless-fast/references/storefront/seed/SEED.md +85 -0
- package/skills/wix-headless-fast/references/storefront/seed/seed-store.mjs +415 -0
- package/skills/wix-manage/SKILL.md +18 -2
- package/skills/wix-manage/references/google-ads/manage-campaign-success-guide.md +141 -0
- package/skills/wix-manage/references/google-business-profile/connect-google-business-profile.md +134 -0
- package/skills/wix-manage/references/google-business-profile/manage-google-business-profile-locations.md +182 -0
- package/skills/wix-manage/references/marketing/create-and-publish-social-post.md +3 -0
- package/skills/wix-manage/references/stores/create-product-catalog-v3.md +21 -6
- package/skills/wix-manage/references/stores/update-product-with-options.md +83 -0
- package/skills/wix-vibe-headless/SKILL.md +18 -4
- package/skills/wix-vibe-headless/install/deploy.cjs +12 -4
- package/skills/wix-vibe-headless/install/pin-agents-md.cjs +2 -1
- package/skills/wix-vibe-headless/platforms/base44-ecom-light-seed.md +3 -1
- package/skills/wix-vibe-headless/platforms/base44-ecom-light.md +3 -1
- package/skills/wix-vibe-headless/platforms/base44.md +23 -61
- package/skills/wix-vibe-headless/platforms/generic.md +6 -3
- package/skills/wix-vibe-headless/references/bookings/INSTRUCTIONS.md +43 -0
- package/skills/wix-vibe-headless/references/bookings/app/components/RentalDurationPicker.jsx +67 -0
- package/skills/wix-vibe-headless/references/bookings/app/hooks/useRentalDuration.js +128 -0
- package/skills/wix-vibe-headless/references/bookings/app/hooks/useServiceDetail.js +5 -3
- package/skills/wix-vibe-headless/references/bookings/app/rest/wix-bookings-rentals.js +250 -0
- package/skills/wix-vibe-headless/references/bookings/app/rest/wix-bookings-services.js +12 -5
- package/skills/wix-vibe-headless/references/bookings/seed/SEED.md +41 -0
- package/skills/wix-vibe-headless/references/bookings/seed/seed-rentals.js +267 -0
- package/skills/wix-vibe-headless/references/cms/INSTRUCTIONS.md +6 -3
- package/skills/wix-vibe-headless/references/forms/INSTRUCTIONS.md +470 -0
- package/skills/wix-vibe-headless/references/forms/app/hooks/useWixForm.js +425 -0
- package/skills/wix-vibe-headless/references/forms/app/lib/wix-form-schema-utils.js +187 -0
- package/skills/wix-vibe-headless/references/forms/app/rest/wix-forms-submissions.js +238 -0
- package/skills/wix-vibe-headless/references/forms/app/rest/wix-forms.js +108 -0
- package/skills/wix-vibe-headless/references/forms/seed/SEED.md +1762 -0
- package/skills/wix-vibe-headless/references/rentals/INSTRUCTIONS.md +13 -0
- package/skills/wix-vibe-headless/references/storefront/INSTRUCTIONS.md +137 -84
- package/skills/wix-vibe-headless/references/storefront/app/hooks/useProductDetail.js +15 -8
- package/skills/wix-vibe-headless/references/storefront/app/lib/storeImage.js +37 -0
- package/skills/wix-vibe-headless/references/storefront/app/rest/wix-store-catalog.js +18 -6
- package/skills/wix-vibe-headless/references/storefront/seed/SEED.md +30 -7
- package/skills/wix-vibe-headless/references/storefront/seed/seed-store.js +46 -10
- package/skills/wix-vibe-headless/references/storefront/app/components/ProductCard.jsx +0 -110
- package/skills/wix-vibe-headless/references/storefront/app/components/ProductGallery.jsx +0 -51
- package/skills/wix-vibe-headless/references/storefront/app/components/ProductGrid.jsx +0 -49
- package/skills/wix-vibe-headless/references/storefront/app/components/VariantPicker.jsx +0 -92
- package/skills/wix-vibe-headless/references/storefront/app/pages/ProductDetail.jsx +0 -139
|
@@ -0,0 +1,470 @@
|
|
|
1
|
+
# Wix Forms — client utils (you build the UI)
|
|
2
|
+
|
|
3
|
+
**Intent:** contact / enquiry / lead / signup / waitlist / application / feedback / survey / quote
|
|
4
|
+
request / intake or registration — any form a visitor fills in and submits. Whether the submission
|
|
5
|
+
also becomes a CRM contact is a per-field mapping, not a different vertical.
|
|
6
|
+
|
|
7
|
+
This vertical ships **no UI**: the owner picks the fields in their dashboard, so every form has a
|
|
8
|
+
different field set and no "contact form" component could ship for it. You write one control per
|
|
9
|
+
field — the shipped utils supply the schema behind it, the state, the validation and the submit. Everything runs on the public `WIX_CLIENT_ID`
|
|
10
|
+
(anonymous visitor token) — no SDK, no backend, no elevated credential.
|
|
11
|
+
|
|
12
|
+
> **⚠️ A visitor-fillable form is FORMS, not CMS.** Wiring one to `insertDataItem` works, and is the
|
|
13
|
+
> wrong call: it gives up the dashboard form builder, spam protection, notifications and contact
|
|
14
|
+
> mapping, and needs the owner to set collection permissions before a visitor can submit at all.
|
|
15
|
+
> Use **`cms`** only when the app must **read the entries back** (a gallery, a listing, "my
|
|
16
|
+
> submissions") — a visitor cannot read Forms submissions. Submit-only → forms.
|
|
17
|
+
|
|
18
|
+
## What ships (utils only)
|
|
19
|
+
|
|
20
|
+
| file | what it is |
|
|
21
|
+
|---|---|
|
|
22
|
+
| `lib/wix-form-schema-utils.js` | **Reading the raw schema** — `orderedInputs`, `submitTextOf`, and per field `targetOf`, `labelOf`, `isRequired`, `validationOf`, `componentOf`, `optionsOf`, `inputTypeOf`, `componentTypeOf`, `choicesOf`, `addressPartsOf`, `phoneCountryOf`, `isMulti`/`isFile`/`isNumber`/`isAddress`. No React, no REST; the hook hands them back as `read`. |
|
|
23
|
+
| `rest/wix-forms.js` | Schema transport: `getForm`, `listForms`, plus `phoneExample` (what a visitor is shown), `normalizePhone` (what goes on the wire), `setSiteCountry`. |
|
|
24
|
+
| `rest/wix-forms-submissions.js` | Write transport: `toSubmissionValues`, `createSubmission`, `SUBMITTED_OK`, the file flow (`getMediaUploadUrl`, `uploadSubmissionFile`, `uploadFormFiles`), `submissionViolations`. |
|
|
25
|
+
| `hooks/useWixForm.js` | The form's non-visual half: `useWixForm(formId)` → `{ form, values, setValues, bind, submit, validate, errors, loading, read }`. Also exports `validateField`, `mapSubmissionErrors`, `FORM_ERROR`. Not on React? Those plus `lib/` are the load-bearing part; port the state around them. |
|
|
26
|
+
| `wix-config.js` *(shared)* | the two ids, written by the install step. |
|
|
27
|
+
| `wix-forms.config.js` *(generated)* | **the gate** — `WIX_FORMS`: each form's `formId` + read-back `targets`, written by the seed after verification. |
|
|
28
|
+
| `WixManageBanner` *(shared)* | Dev-only manage banner — mount it in your Layout. |
|
|
29
|
+
|
|
30
|
+
## Prerequisites — a HARD GATE
|
|
31
|
+
|
|
32
|
+
- **`src/rest/wix-forms.config.js` must exist.** No file → the seed hasn't succeeded → **stop and
|
|
33
|
+
run the seed**. It's the one vertical whose client can't be built in parallel with its seed.
|
|
34
|
+
- **Never invent a `formId`, and never write that file early.** Its only value is as proof that a
|
|
35
|
+
verified schema exists; the seed writes it after creating *and* verifying each schema.
|
|
36
|
+
- **The Wix Forms app installed, with at least one form.** This vertical doesn't provision forms.
|
|
37
|
+
- **No permission setup** — unlike CMS, a visitor can read a published form's schema and submit to it
|
|
38
|
+
out of the box.
|
|
39
|
+
|
|
40
|
+
## Build the UI
|
|
41
|
+
|
|
42
|
+
**The schema is the source of truth, whatever the markup looks like.** Every `target`, label,
|
|
43
|
+
`required` flag, constraint and choice option comes from it, and so does the submission map — nothing
|
|
44
|
+
about a field is yours to invent.
|
|
45
|
+
|
|
46
|
+
**The markup is yours to author.** Write a JSX element per field (step 5) when the layout matters,
|
|
47
|
+
which on a designed page it usually does. Loop over `read.orderedInputs(form)` with a branch per
|
|
48
|
+
control type instead when the owner will keep editing the form, and a dashboard change should reach
|
|
49
|
+
the site with no code touch. The per-field wiring is identical either way.
|
|
50
|
+
|
|
51
|
+
The JSDoc in `hooks/useWixForm.js` and `lib/wix-form-schema-utils.js` covers what each util does;
|
|
52
|
+
this covers which control a field wants and where the obvious implementation is wrong. Markup and
|
|
53
|
+
styling are yours (on base44: shadcn + `src/index.css`).
|
|
54
|
+
|
|
55
|
+
### 1 · Load the form
|
|
56
|
+
|
|
57
|
+
```jsx
|
|
58
|
+
import { useWixForm, FORM_ERROR } from "@/hooks/useWixForm";
|
|
59
|
+
import { WIX_FORMS } from "@/rest/wix-forms.config"; // written by the seed — never by hand
|
|
60
|
+
|
|
61
|
+
const { form, values, setValues, submit, validate, errors, loading, read } =
|
|
62
|
+
useWixForm(WIX_FORMS.contact.formId);
|
|
63
|
+
|
|
64
|
+
const fields = read.orderedInputs(form); // what the form contains, in the owner's layout order
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
| | |
|
|
68
|
+
|---|---|
|
|
69
|
+
| `form` | the Form exactly as Wix returned it (`null` until loaded). Nothing stripped or renamed. |
|
|
70
|
+
| `values` | state, keyed by `target`: string for text/choice/date, **array** for multi-choice and files, **object** for an address. Seeded from the schema's defaults. |
|
|
71
|
+
| `setValues` | plain React setter — `setValues((v) => ({ ...v, [name]: value }))`. |
|
|
72
|
+
| `bind(target)` | the props a text-ish control needs, ready to spread: `name`, `value`, `onChange`, `onBlur`, `aria-describedby`, `aria-invalid`. |
|
|
73
|
+
| `submit(event)` | use as `onSubmit`; resolves **`true`** only when the submission was created. |
|
|
74
|
+
| `validate(target?)` | one field, one address subfield, or the whole form. Returns whether it passed. |
|
|
75
|
+
| `errors` | control name → visitor-facing message; `errors[FORM_ERROR]` is form-level. |
|
|
76
|
+
| `loading` | loading the schema (`form` still `null`) **or** submitting (`form` set). |
|
|
77
|
+
| `read` | the schema accessors, so the UI needs one import. |
|
|
78
|
+
|
|
79
|
+
Fields are the raw objects Wix sent, so anything the accessors don't cover is still on them —
|
|
80
|
+
`pii`, `showLabel`, `buttonText`, `explanationText`, `options[].image`, the `steps[]` a multi-page
|
|
81
|
+
form would need.
|
|
82
|
+
|
|
83
|
+
**`contact` is this example's key.** The seed names each form — `waitlist`, `quote`, `application` —
|
|
84
|
+
so use the keys `wix-forms.config.js` actually contains.
|
|
85
|
+
|
|
86
|
+
**Several forms on one page?** The hook loads one schema each. Past two, call
|
|
87
|
+
`listForms({ formIds: [...] })` once (up to 100 ids) and run `orderedInputs` over each result.
|
|
88
|
+
|
|
89
|
+
**Set the site's country once at app start**, so locale-derived examples match the business, not the
|
|
90
|
+
visitor's browser:
|
|
91
|
+
|
|
92
|
+
```js
|
|
93
|
+
import { setSiteCountry } from "@/rest/wix-forms";
|
|
94
|
+
setSiteCountry("GB");
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
### 2 · Render one control per field
|
|
98
|
+
|
|
99
|
+
Author them or loop over them — every control carries the same four things, and `bind(target)` from
|
|
100
|
+
the hook supplies the first three:
|
|
101
|
+
|
|
102
|
+
1. **`name` = the field's `target`** — the immutable storage key, and also the state key, the error
|
|
103
|
+
key and the submission key. Keying everything by it makes the submission right by construction;
|
|
104
|
+
it's how a blocked submit finds the control to focus, and it drives autofill.
|
|
105
|
+
2. **`value` from `values[target]`, written back through `setValues`.** (A choice group carries
|
|
106
|
+
`checked` instead; a file input can't be controlled at all and takes only `onChange`.)
|
|
107
|
+
3. **`onBlur` → `validate(target)`** — not on the first keystroke of an untouched field, which
|
|
108
|
+
reddens a required field before the visitor types. Once flagged, re-check as they type from an
|
|
109
|
+
**effect on the value**: React hasn't committed the new value when `onChange` runs, so a check
|
|
110
|
+
there judges the value they just replaced.
|
|
111
|
+
4. **A real `<label>`, and an error node** — see step 6 for the wiring both need. `bind` sets the
|
|
112
|
+
error node's `aria-describedby`/`id` pair (`err-${target}`); you render the node itself.
|
|
113
|
+
|
|
114
|
+
**Stamp the schema's constraints as native attributes.** They reinforce the JS checks and drive
|
|
115
|
+
mobile keyboards:
|
|
116
|
+
|
|
117
|
+
| from the schema | onto the control |
|
|
118
|
+
|---|---|
|
|
119
|
+
| `isRequired(field)` | `required` |
|
|
120
|
+
| `validationOf(field).minLength` / `.maxLength` | `minLength` / `maxLength` |
|
|
121
|
+
| `validationOf(field).pattern` | `pattern` |
|
|
122
|
+
| `validationOf(field).minimum` / `.maximum` | `min` / `max` (number and rating) |
|
|
123
|
+
| `validationOf(field).format` | input `type` — `EMAIL`→`email`, `PHONE`→`tel`, `URL`→`url`, `DATE`→`date`, `TIME`→`time`, `DATE_TIME`→`datetime-local`, else `text`; `isNumber(field)`→`number` |
|
|
124
|
+
| the resolved `type` | `inputMode` — `number`→`decimal`, `tel`/`email`/`url` as themselves; omit for date/time (native picker) |
|
|
125
|
+
| `componentOf(field).placeholder` | `placeholder` |
|
|
126
|
+
| `validationOf(field).fileLimit` | `multiple`, when above 1 |
|
|
127
|
+
| `validationOf(field).uploadFileFormats` | `accept` — map the media kinds a browser knows (`IMAGE`→`image/*`, `VIDEO`, `AUDIO`, `DOCUMENT`); omit `accept` when the owner allows anything |
|
|
128
|
+
| `field.identifier` for `CONTACTS_*` kinds | `autoComplete` — `email`, `tel`, `given-name`, `family-name`, `organization`, `bday`; address subfields take `address-line1`, `address-level2`, `postal-code`, `country` |
|
|
129
|
+
|
|
130
|
+
**A constrained field with no placeholder gets a synthesized one:** PHONE →
|
|
131
|
+
`phoneExample(read.phoneCountryOf(field))` (that country's regulator-reserved fictional number,
|
|
132
|
+
falling back to the site's), URL → `https://…`. It prevents the `must match format "phone"` rejection
|
|
133
|
+
without a hint line under every field.
|
|
134
|
+
|
|
135
|
+
#### Which control
|
|
136
|
+
|
|
137
|
+
`identifier` and `componentType` are **independent axes** — several fields share one component — so
|
|
138
|
+
branch on whichever distinguishes the control, and **never on the `target` name**, which an owner's
|
|
139
|
+
rename silently breaks.
|
|
140
|
+
|
|
141
|
+
| control | branch on | `values[target]` |
|
|
142
|
+
|---|---|---|
|
|
143
|
+
| `<textarea>` | `field.identifier === "TEXT_AREA"` | string |
|
|
144
|
+
| `<select>` | `read.componentTypeOf(field) === "DROPDOWN"` | string |
|
|
145
|
+
| radios | `read.componentTypeOf(field) === "RADIO_GROUP"` | string |
|
|
146
|
+
| checkbox group | `read.isMulti(field)` | **array** of checked values |
|
|
147
|
+
| address group | `read.isAddress(field)` | **object** keyed by subfield |
|
|
148
|
+
| file / signature | `read.isFile(field)` | **`File` objects** until submit |
|
|
149
|
+
| text / email / tel / url / date / time / number | `validationOf(field).format`, `isNumber` | string |
|
|
150
|
+
|
|
151
|
+
Two that bite: `componentType` is `TEXT_INPUT` for short **and** long answer, so keying a textarea
|
|
152
|
+
off it renders every long field single-line; and `IMAGE_CHOICE` is indistinguishable from multi
|
|
153
|
+
choice except by `identifier` — it falls out as plain checkboxes, and its pictures are on
|
|
154
|
+
`componentOf(field).options[].image`.
|
|
155
|
+
|
|
156
|
+
**Coverage check — every field kind an owner can add:**
|
|
157
|
+
|
|
158
|
+
| dashboard field | `identifier` | renders as | `values[target]` |
|
|
159
|
+
|---|---|---|---|
|
|
160
|
+
| Short answer, Link, Company, Position, Tax ID, First/Last name, Email, single-line Address | `TEXT_INPUT`, `URL_INPUT`, `CONTACTS_*` | text input, `type` from `format` | string |
|
|
161
|
+
| Long answer | `TEXT_AREA` | `<textarea>` | string |
|
|
162
|
+
| Phone | `CONTACTS_PHONE` | `type="tel"` + reserved example | string (E.164 on submit) |
|
|
163
|
+
| Number, Rating | `NUMBER_INPUT`, `RATING_INPUT` | `type="number"` (or your stars) | string in state, number on the wire |
|
|
164
|
+
| Dropdown | `DROPDOWN` | `<select>` | string |
|
|
165
|
+
| Single choice | `RADIO_GROUP` | radios | string |
|
|
166
|
+
| Multi choice, Tag picker, Image choice | `CHECKBOX_GROUP`, `TAGS`, `IMAGE_CHOICE` | checkboxes (or a chip / image control) | **array** |
|
|
167
|
+
| Date, Date picker, Date and time, Time, Birthdate | `DATE_INPUT`, `DATE_PICKER`, `DATE_TIME_INPUT`, `TIME_INPUT`, `CONTACTS_BIRTHDATE` | native date/time input | string |
|
|
168
|
+
| Multi-line address | `MULTILINE_ADDRESS` | fieldset of subfields | **object** |
|
|
169
|
+
| File upload, Signature | `FILE_UPLOAD`, `SIGNATURE` | file input (a signature deserves a canvas) | **`File` objects** |
|
|
170
|
+
| Checkbox, Subscribe checkbox | `CHECKBOX`, `CONTACTS_SUBSCRIBE` | not covered here — `BOOLEAN`, and its label is Ricos rich content, not a string | boolean |
|
|
171
|
+
| Product, Fixed price, Custom price, Donation | `PRODUCT_LIST`, `FIXED_PAYMENT`, `PAYMENT_INPUT`, `DONATION` | not covered here — `PAYMENT` | array of product objects |
|
|
172
|
+
| Appointment | `APPOINTMENT` | not covered here — `SCHEDULING` | appointment object |
|
|
173
|
+
| Service picker, Multi-service picker | `SERVICES_DROPDOWN`, `SERVICES_MULTI_CHOICE` | `<select>` / checkboxes, options from the connected app | string / **array** |
|
|
174
|
+
|
|
175
|
+
`orderedInputs` returns the uncovered types too — nothing is filtered for you. Write the control, or
|
|
176
|
+
have the owner drop the field; a **required** field you don't render makes the form unsubmittable.
|
|
177
|
+
|
|
178
|
+
**Display fields never reach this loop.** `RICH_TEXT` blocks and the submit button are
|
|
179
|
+
`fieldType: "DISPLAY"`, so `orderedInputs` drops them. If a form uses rich-content blocks as section
|
|
180
|
+
copy between fields, read them off `form.formFields` yourself — their content is Ricos, not a string.
|
|
181
|
+
|
|
182
|
+
Wix's [About Form Fields](https://dev.wix.com/docs/api-reference/crm/forms/form-schemas/about-form-fields.md)
|
|
183
|
+
is the spec behind this table. `seed/SEED.md` carries the same identifiers from the authoring side
|
|
184
|
+
(which JSON creates each field); this one is the rendering side (which control, which value shape) —
|
|
185
|
+
they join on `identifier`.
|
|
186
|
+
|
|
187
|
+
#### Controls that need more than an input
|
|
188
|
+
|
|
189
|
+
**Choice groups** go in a `<fieldset>` with a `<legend>`; the group's `aria-describedby`,
|
|
190
|
+
`aria-invalid` and `aria-required` go on the fieldset, since no single radio can carry them. Options
|
|
191
|
+
come from `read.choicesOf(field)` (`{ value, label }`, label falling back to value). A checkbox
|
|
192
|
+
group's value is an array — toggle values in and out of it.
|
|
193
|
+
|
|
194
|
+
**A dropdown** needs a disabled `<option value="">` first (state starts empty, so otherwise the first
|
|
195
|
+
real option looks pre-selected); use `componentOf(field).placeholder` for its text.
|
|
196
|
+
|
|
197
|
+
**An address** is a group whose value is a nested object. Subfields come from
|
|
198
|
+
`read.addressPartsOf(field)` (`{ sub, required }`, hidden `addressLine2` already dropped); name each
|
|
199
|
+
control **`${target}/${sub}`**, which is exactly the server's error path for a nested field, so
|
|
200
|
+
rejections land on the right control with no mapping of your own. Subfield keys are storage keys —
|
|
201
|
+
humanize them (`postalCode` → "Postal code"). **`country` and `subdivision` are country-dependent
|
|
202
|
+
enums the schema doesn't enumerate**: render `country` as a select over ISO-3166 alpha-2 codes,
|
|
203
|
+
narrowed to `validationOf(field).allowedCountries` when set. Keeping `subdivision` free text means
|
|
204
|
+
leaving it optional and relying on the mapped error.
|
|
205
|
+
|
|
206
|
+
#### File uploads — the value is the upload URL
|
|
207
|
+
|
|
208
|
+
The hook's `submit` runs this before it sends anything:
|
|
209
|
+
|
|
210
|
+
1. **`getMediaUploadUrl(formId, filename, mimeType)`** → a signed `uploadUrl`. This Forms-scoped
|
|
211
|
+
wrapper is what makes a visitor upload possible at all: `site-media` directly needs a Manage-Media
|
|
212
|
+
credential and 403s for a visitor.
|
|
213
|
+
2. **`PUT` the bytes to it** with the file's `Content-Type`, via plain `fetch` — the URL is
|
|
214
|
+
pre-signed, and adding the visitor's `Authorization` header turns a working upload into a 400.
|
|
215
|
+
3. **Submit that same `uploadUrl` as the value** — not the CDN URL the upload returns, not a file id.
|
|
216
|
+
One file submits the string; several submit an array.
|
|
217
|
+
|
|
218
|
+
So `values[target]` holds `File` objects until submit, and validation checks the count (`required`,
|
|
219
|
+
`fileLimit`) since no string rule applies. Three render consequences: the input can't be controlled
|
|
220
|
+
(wire `onChange`, list the picked filenames yourself); clearing it after success needs a `key` you
|
|
221
|
+
bump in `handleSubmit`, because resetting state leaves the browser's own "1 file selected" text; and uploads run inside
|
|
222
|
+
`loading`, so the button's progress state matters more here.
|
|
223
|
+
|
|
224
|
+
**A signature** shares `WIX_FILE`, so a file input accepts one — but the honest control is a canvas:
|
|
225
|
+
`canvas.toBlob(...)` → a `File` named `signature.png` in `values[target]`, same upload path.
|
|
226
|
+
|
|
227
|
+
**Never base64 a file into a value.** It stores no real file and blows past the submission size
|
|
228
|
+
limit. A form with no file field at all is a plan gate — file, signature and payment fields need a
|
|
229
|
+
Core-or-above plan — fixed by the owner's plan, never an inlined blob.
|
|
230
|
+
|
|
231
|
+
### 3 · Validation — schema-driven on the client, authoritative on the server
|
|
232
|
+
|
|
233
|
+
`validate(target?)` applies only rules the schema states:
|
|
234
|
+
|
|
235
|
+
| rule | from |
|
|
236
|
+
|---|---|
|
|
237
|
+
| required | `isRequired(field)` — including a multi-choice or file field with nothing picked, and each required address subfield |
|
|
238
|
+
| length | `validationOf(field).minLength` / `.maxLength` |
|
|
239
|
+
| shape | `.pattern`, and `.format` — EMAIL, PHONE (E.164 after stripping spaces/dashes/parens), URL |
|
|
240
|
+
| range | `.minimum` / `.maximum` on number and rating, parsed before comparing |
|
|
241
|
+
|
|
242
|
+
Call it as `validate("email")` (the `onBlur` wiring), `validate("address/city")` for one subfield, or
|
|
243
|
+
`validate()` for everything — `submit` already does the last, so reach for it only to gate something
|
|
244
|
+
else. It reads `values`, and it clears what now passes as well as flagging what doesn't. An address
|
|
245
|
+
subfield gets the `required` check only; `country`/`subdivision` content is the server's call.
|
|
246
|
+
|
|
247
|
+
**Show invalid state on the control**, keyed off the same `aria-invalid` the render sets, so visual
|
|
248
|
+
and assistive-tech state can't drift — no parallel `.has-error` class:
|
|
249
|
+
|
|
250
|
+
```css
|
|
251
|
+
input[aria-invalid="true"], select[aria-invalid="true"], textarea[aria-invalid="true"],
|
|
252
|
+
fieldset[aria-invalid="true"] { border-color: var(--destructive); outline-color: var(--destructive); }
|
|
253
|
+
.error:empty { display: none; }
|
|
254
|
+
```
|
|
255
|
+
|
|
256
|
+
**Never key a check on a field's name** (the classic slip: keying the email check on
|
|
257
|
+
`target === "email"`) — derive it from `format` and the schema's constraints, as `validateField`
|
|
258
|
+
does. And a client rule **laxer** than the server's is worse than none: the visitor
|
|
259
|
+
then learns about the problem after a round trip, in Wix's wording instead of yours.
|
|
260
|
+
|
|
261
|
+
### 4 · Submit
|
|
262
|
+
|
|
263
|
+
`submit(event)` client-validates → uploads picked files → builds the submission map (empty optionals
|
|
264
|
+
dropped, PHONE normalized to E.164, NUMBER coerced; it walks the *schema*, so a stray key in `values`
|
|
265
|
+
can't reach the API) → creates the submission → maps server violations onto controls and focuses the
|
|
266
|
+
first invalid one. On success it resets `values` to the schema's defaults.
|
|
267
|
+
|
|
268
|
+
**The resolved `true` is the only success signal there is.** Submissions are write-only from the
|
|
269
|
+
browser — reading them back needs an owner scope and 403s for a visitor. The submission lands in the
|
|
270
|
+
owner's dashboard.
|
|
271
|
+
|
|
272
|
+
`CONFIRMED`, `PENDING` and `PAYMENT_WAITING` all mean created. A `PAYMENT_WAITING` form leaves the
|
|
273
|
+
visitor a payment step: surface it **inside** the success state, never as a failed submit.
|
|
274
|
+
|
|
275
|
+
**No captcha** at the default protection level — don't add captcha plumbing speculatively.
|
|
276
|
+
|
|
277
|
+
### 5 · The whole component
|
|
278
|
+
|
|
279
|
+
Author one JSX element per field, using the `target`s the seed wrote and the constraints the schema
|
|
280
|
+
states. `bind(target)` supplies the wiring every control shares — `name`, `value`, `onChange`,
|
|
281
|
+
`onBlur`, `aria-describedby`, `aria-invalid` — so a field is a label, a control and its error node:
|
|
282
|
+
|
|
283
|
+
```jsx
|
|
284
|
+
export default function ContactForm() {
|
|
285
|
+
const { form, values, bind, setValues, submit, validate, errors, loading, read } =
|
|
286
|
+
useWixForm(WIX_FORMS.contact.formId);
|
|
287
|
+
const [sent, setSent] = useState(false);
|
|
288
|
+
|
|
289
|
+
async function handleSubmit(event) {
|
|
290
|
+
setSent(await submit(event)); // true only when the submission was created
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
if (loading && !form) return <p>Loading…</p>;
|
|
294
|
+
// A form that can't load is a setup problem — say so; never fall through to a hand-built form,
|
|
295
|
+
// which silently drops real enquiries.
|
|
296
|
+
if (!form) return <p role="alert">This form isn't available right now. {errors[FORM_ERROR]}</p>;
|
|
297
|
+
// Swapping the form out is a silent DOM change, so the success state announces itself.
|
|
298
|
+
if (sent) {
|
|
299
|
+
return (
|
|
300
|
+
<div role="status">
|
|
301
|
+
<h3 tabIndex={-1}>Thank you</h3>
|
|
302
|
+
<p>We'll be in touch shortly.</p>
|
|
303
|
+
<button type="button" onClick={() => setSent(false)}>Send another</button>
|
|
304
|
+
</div>
|
|
305
|
+
);
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
return (
|
|
309
|
+
<form onSubmit={handleSubmit} noValidate>
|
|
310
|
+
<label>
|
|
311
|
+
<span>Your email<span aria-hidden="true"> *</span></span>
|
|
312
|
+
<input {...bind("email_a1b2")} type="email" required autoComplete="email" />
|
|
313
|
+
<p className="error" id="err-email_a1b2" role="alert">{errors.email_a1b2}</p>
|
|
314
|
+
</label>
|
|
315
|
+
|
|
316
|
+
<label>
|
|
317
|
+
<span>How can we help?</span>
|
|
318
|
+
<textarea {...bind("message_c3d4")} rows={5} maxLength={500} />
|
|
319
|
+
<p className="error" id="err-message_c3d4" role="alert">{errors.message_c3d4}</p>
|
|
320
|
+
</label>
|
|
321
|
+
|
|
322
|
+
{/* A choice group carries `checked` rather than `value`, so wire it by hand — same name,
|
|
323
|
+
same onBlur, and the aria-* on the fieldset because no single radio can hold them. */}
|
|
324
|
+
<fieldset aria-describedby="err-budget_e5f6" aria-invalid={Boolean(errors.budget_e5f6) || undefined}>
|
|
325
|
+
<legend>Budget</legend>
|
|
326
|
+
{["Under £5k", "£5k–£20k", "Over £20k"].map((option) => (
|
|
327
|
+
<label key={option}>
|
|
328
|
+
<input type="radio" name="budget_e5f6" value={option}
|
|
329
|
+
checked={values.budget_e5f6 === option}
|
|
330
|
+
onChange={() => setValues((v) => ({ ...v, budget_e5f6: option }))}
|
|
331
|
+
onBlur={() => validate("budget_e5f6")} />
|
|
332
|
+
{option}
|
|
333
|
+
</label>
|
|
334
|
+
))}
|
|
335
|
+
<p className="error" id="err-budget_e5f6" role="alert">{errors.budget_e5f6}</p>
|
|
336
|
+
</fieldset>
|
|
337
|
+
|
|
338
|
+
<p role="alert">{errors[FORM_ERROR]}</p>
|
|
339
|
+
<button type="submit" disabled={loading}>
|
|
340
|
+
{loading ? "Sending…" : (read.submitTextOf(form) || "Submit")}
|
|
341
|
+
</button>
|
|
342
|
+
</form>
|
|
343
|
+
);
|
|
344
|
+
}
|
|
345
|
+
```
|
|
346
|
+
|
|
347
|
+
The `target`s (`email_a1b2`, …) come from `WIX_FORMS.<key>.targets` — **never invent or shorten one**,
|
|
348
|
+
since a key that isn't an exact schema `target` 400s the whole submission. Everything else on each
|
|
349
|
+
control comes from that field's schema entry (step 2): its label, its `required`, its length/pattern
|
|
350
|
+
bounds, its choice options. `noValidate` keeps your messages instead of the browser's bubbles; the
|
|
351
|
+
native constraints still drive keyboards and assistive tech.
|
|
352
|
+
|
|
353
|
+
**Authoring beats looping here**, because the layout is the point: a two-column name row, a budget
|
|
354
|
+
group styled as cards, copy between sections. **Loop instead when the owner will keep editing the
|
|
355
|
+
form** — `read.orderedInputs(form).map(...)` with a branch per control type keeps a dashboard change
|
|
356
|
+
reaching the site with no code touch. Either way the wiring per field is what's above.
|
|
357
|
+
|
|
358
|
+
Two things the shell doesn't show:
|
|
359
|
+
|
|
360
|
+
- **Server violations land on controls**, keyed exactly like the client's (`target`, or `target/sub`
|
|
361
|
+
for an address subfield). The copy comes from the violation's `errorType` plus the field's schema;
|
|
362
|
+
an unmapped type degrades to safe copy, and Wix's internal `errorMessage` goes to `console.debug`.
|
|
363
|
+
Only a failure with no per-field violations sets `errors[FORM_ERROR]`.
|
|
364
|
+
- **A required field you didn't render** blocks submit with a message that has no control to display
|
|
365
|
+
it. Check `read.orderedInputs(form)` against your branches before shipping.
|
|
366
|
+
|
|
367
|
+
### 6 · Accessibility — the controls are generated, so one slip hits every field
|
|
368
|
+
|
|
369
|
+
- **The error node renders always**, empty or filled, with `role="alert"` and a deterministic id
|
|
370
|
+
(`err-${target}`) the control points at via `aria-describedby`. `aria-describedby` alone only reads
|
|
371
|
+
on focus; conditional rendering (`{error && …}`) destroys the live region entirely. Hide the empty
|
|
372
|
+
state with CSS.
|
|
373
|
+
- **`aria-invalid` only when invalid** — `undefined`, never `"false"`.
|
|
374
|
+
- **A group's error and `aria-*` go on the `<fieldset>`** — choice groups and addresses have no
|
|
375
|
+
single control to describe.
|
|
376
|
+
- **Required is programmatic**: the `required` attribute (or `aria-required` on a group) carries the
|
|
377
|
+
meaning, the `*` is `aria-hidden` decoration. Both, never the glyph alone.
|
|
378
|
+
- **Every control has a real `<label>`** — a placeholder disappears on input and fails contrast.
|
|
379
|
+
- **The success state is announced** (`role="status"`, or focus its heading).
|
|
380
|
+
|
|
381
|
+
Don't reach for `role="form"`, an `aria-label` on an input that already has a `<label>`, or a custom
|
|
382
|
+
`role="radio"` — native radios in a `<fieldset>` are already a radiogroup.
|
|
383
|
+
|
|
384
|
+
## Hard rules
|
|
385
|
+
|
|
386
|
+
- A visitor-fillable form is this vertical, not `cms`.
|
|
387
|
+
- Read and write only through the shipped helpers — never hand-build a Wix Forms URL.
|
|
388
|
+
- Never invent a `target`, label, option or constraint — every one comes from the schema (authored
|
|
389
|
+
markup included). Never detect a control by its `target` name either.
|
|
390
|
+
- Read fields through the accessors, not by reaching into `inputOptions` — the block names are enum
|
|
391
|
+
derived, and the accessors map every one of them.
|
|
392
|
+
- Key every control by `target`: `values[target]`, `errors[target]`, `name`. Address subfields use
|
|
393
|
+
`target/sub`.
|
|
394
|
+
- Derive validation from the schema, and keep every client rule at least as strict as the server's.
|
|
395
|
+
- **Never add `auth.elevate`, a backend function or a connector token to make a form work.** The
|
|
396
|
+
visitor token reads the schema and creates the submission; the API spec's owner scopes are wrong
|
|
397
|
+
for the published-site path. This is the most common wrong turn on this vertical.
|
|
398
|
+
- Submissions are write-only from the browser — the resolved `createSubmission` **is** the success
|
|
399
|
+
signal. Listing entries back needs `cms`.
|
|
400
|
+
- Every status the submit resolves on is a created submission: show the thank-you, and put a payment
|
|
401
|
+
step inside it. Treating one as failure costs the owner duplicates.
|
|
402
|
+
- Order comes from `steps[]`, not `formFields[]`; take the order only, not the geometry.
|
|
403
|
+
- Render every field `orderedInputs` returns, or confirm what you skip isn't `required`.
|
|
404
|
+
- A file field submits the URL from `getMediaUploadUrl` — never base64, never a Manage-Media
|
|
405
|
+
credential, never the CDN URL the upload returns.
|
|
406
|
+
- `UNKNOWN_VALUE_ERROR` / `NOT_ALLOWED_VALUE_ERROR` are seed bugs — fix the schema, don't mangle the
|
|
407
|
+
key or value.
|
|
408
|
+
- Never mock a form. No `formId`, or a form that won't load, is a setup problem to surface.
|
|
409
|
+
- Never show a locale-wrong example, and never submit the reserved one you display.
|
|
410
|
+
|
|
411
|
+
## Fallback
|
|
412
|
+
|
|
413
|
+
Three sources answer what this file doesn't: the **JSDoc** in `hooks/useWixForm.js` and
|
|
414
|
+
`lib/wix-form-schema-utils.js`; the **Wix reference** below; and `seed/SEED.md` for how a field was
|
|
415
|
+
authored. Calling an endpoint the helpers don't wrap is fine via `wixApiRequest` — look up the exact
|
|
416
|
+
method and body first (or use the `wix-docs` skill), never guess.
|
|
417
|
+
|
|
418
|
+
- Form object (the shape `form` and its fields arrive in): https://dev.wix.com/docs/api-reference/crm/forms/form-schemas/form-object.md
|
|
419
|
+
- Form Schemas API: https://dev.wix.com/docs/api-reference/crm/forms/form-schemas.md
|
|
420
|
+
- About Form Fields (every field-level rule): https://dev.wix.com/docs/api-reference/crm/forms/form-schemas/about-form-fields.md
|
|
421
|
+
- Form Submissions API: https://dev.wix.com/docs/api-reference/crm/forms/form-submissions.md
|
|
422
|
+
- About Submission Values (per-`inputType` value shapes): https://dev.wix.com/docs/api-reference/crm/forms/form-submissions/about-submission-values.md
|
|
423
|
+
- Validation errors: https://dev.wix.com/docs/api-reference/crm/forms/form-submissions/introduction#validation-errors
|
|
424
|
+
- Get Media Upload URL: https://dev.wix.com/docs/api-reference/crm/forms/form-submissions/get-media-upload-url.md
|
|
425
|
+
- Uploading to a generated URL: https://dev.wix.com/docs/api-reference/assets/media/media-manager/files/upload-api.md
|
|
426
|
+
|
|
427
|
+
## Not this vertical
|
|
428
|
+
|
|
429
|
+
An event **RSVP** → `events` (it ships its own registration form). A **bookable service's** form →
|
|
430
|
+
`bookings`. Content the app **lists back** — reviews, galleries, "my items" → `cms`. A form only
|
|
431
|
+
logged-in members may reach → `members` for the gate, forms for the form. `SKILL.md`'s routing table
|
|
432
|
+
is the deciding copy.
|
|
433
|
+
|
|
434
|
+
## Seeding
|
|
435
|
+
|
|
436
|
+
Seed per `seed/SEED.md`: it installs the Forms app, creates each schema, verifies it (reads it back,
|
|
437
|
+
checks the dashboard summary, sends and deletes one real submission), then writes
|
|
438
|
+
`src/rest/wix-forms.config.js`. Needs an elevated credential, and **does not run in parallel with the
|
|
439
|
+
client** — see Prerequisites.
|
|
440
|
+
|
|
441
|
+
## Point the user to their dashboard
|
|
442
|
+
|
|
443
|
+
Substitute the site's `metaSiteId`:
|
|
444
|
+
|
|
445
|
+
- **Forms list** — `https://manage.wix.com/dashboard/{metaSiteId}/wix-forms`
|
|
446
|
+
- **Form builder** — `https://manage.wix.com/dashboard/{metaSiteId}/wix-forms/form/{formId}` → add,
|
|
447
|
+
relabel, reorder or require fields; every change reflects on the site with no code change.
|
|
448
|
+
- **Submissions** — `https://manage.wix.com/dashboard/{metaSiteId}/wix-forms-and-payments/submissions`
|
|
449
|
+
- **Forms settings** (incl. notifications) — `https://manage.wix.com/dashboard/{metaSiteId}/wix-forms-and-payments/settings`
|
|
450
|
+
- **Contacts** — `https://manage.wix.com/dashboard/{metaSiteId}/contacts` → contact-mapped fields
|
|
451
|
+
create or update a contact automatically.
|
|
452
|
+
|
|
453
|
+
## Verify
|
|
454
|
+
|
|
455
|
+
- [ ] `wix-forms.config.js` exists; every `formId` comes from `WIX_FORMS`, none typed by hand.
|
|
456
|
+
- [ ] `WIX_CLIENT_ID` set (not the placeholder).
|
|
457
|
+
- [ ] Looped form: relabel a field in the dashboard, reload, the new label appears with no code
|
|
458
|
+
change. Authored form: every `target` in the JSX matches `WIX_FORMS.<key>.targets` exactly.
|
|
459
|
+
- [ ] Every field `read.orderedInputs(form)` returns has a control — long answer is a `<textarea>`,
|
|
460
|
+
choice groups render their options, an address renders its subfields — or what you skipped
|
|
461
|
+
isn't `required`.
|
|
462
|
+
- [ ] Required fields show inline errors on blur, in your wording, before any round trip.
|
|
463
|
+
- [ ] A deliberately invalid email/phone is rejected inline, on the right control.
|
|
464
|
+
- [ ] A real submission shows the thank-you, then appears in the owner's **submissions inbox** and
|
|
465
|
+
(for contact-mapped fields) as a **contact**.
|
|
466
|
+
- [ ] Has a file field? Attached a real file, submitted, and opened the attachment from the
|
|
467
|
+
dashboard — a submission recording an unusable attachment still "succeeds".
|
|
468
|
+
- [ ] Keyboard pass: a blocked submit focuses the first invalid control, errors are announced, every
|
|
469
|
+
control has a real label.
|
|
470
|
+
- [ ] No `auth.elevate`, backend function or connector token in the submit path.
|