@wix/agent-skills 1.25.0 → 1.27.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/README.md +1 -0
- package/package.json +1 -1
- package/skills/wix-app/SKILL.md +18 -17
- package/skills/wix-app/references/BUSINESS_MANAGER_THEME.md +1 -2
- package/skills/wix-app/references/BUSINESS_MANAGER_TOKENS.md +1 -1
- package/skills/wix-app/references/DASHBOARD_PAGE.md +12 -12
- package/skills/wix-app/references/WIX_PATTERNS_DOCS.md +3 -2
- package/skills/wix-app/references/dashboard-page/DRAFT_TEMPLATE.md +75 -66
- package/skills/wix-app/references/dashboard-page/UX_SUCCESS_MODEL.md +4 -5
- package/skills/wix-app/references/data-collection/LIFECYCLE.md +6 -4
- package/skills/wix-headless-kit/SKILL.md +31 -14
- package/skills/wix-headless-kit/guides/existing-site.md +12 -5
- package/skills/wix-headless-kit/install/attach.mjs +55 -10
- package/skills/wix-headless-kit/install/check.mjs +5 -5
- package/skills/wix-headless-kit/install/deploy.mjs +7 -3
- package/skills/wix-headless-kit/install/templates.mjs +21 -17
- package/skills/wix-headless-templates/SKILL.md +43 -0
- package/skills/wix-headless-templates/blank/project/README.md +15 -0
- package/skills/wix-headless-templates/blank/project/astro.config.mjs +20 -0
- package/skills/wix-headless-templates/blank/project/package.json +34 -0
- package/skills/wix-headless-templates/blank/project/public/favicon.svg +9 -0
- package/skills/wix-headless-templates/blank/project/src/assets/astro.svg +1 -0
- package/skills/wix-headless-templates/blank/project/src/assets/background.svg +1 -0
- package/skills/wix-headless-templates/blank/project/src/assets/wix.svg +18 -0
- package/skills/wix-headless-templates/blank/project/src/components/Hero.astro +77 -0
- package/skills/wix-headless-templates/blank/project/src/components/Welcome.astro +95 -0
- package/skills/wix-headless-templates/blank/project/src/layouts/Layout.astro +22 -0
- package/skills/wix-headless-templates/blank/project/src/pages/index.astro +8 -0
- package/skills/wix-headless-templates/blank/project/tsconfig.json +5 -0
- package/skills/wix-headless-templates/blog/INSTRUCTIONS.md +418 -0
- package/skills/wix-headless-templates/blog/app/components/blog/BlogFeedView.tsx +191 -0
- package/skills/wix-headless-templates/blog/app/components/blog/CommentsView.tsx +206 -0
- package/skills/wix-headless-templates/blog/app/components/blog/PostLikeButton.tsx +62 -0
- package/skills/wix-headless-templates/blog/app/components/blog/PostView.tsx +139 -0
- package/skills/wix-headless-templates/blog/app/components/blog/RichContent.tsx +42 -0
- package/skills/wix-headless-templates/blog/app/hooks/blog/useBlogFeed.ts +31 -0
- package/skills/wix-headless-templates/blog/app/hooks/blog/useComments.ts +26 -0
- package/skills/wix-headless-templates/blog/app/hooks/blog/usePost.ts +25 -0
- package/skills/wix-headless-templates/blog/app/wix/blog/authors-core.ts +51 -0
- package/skills/wix-headless-templates/blog/app/wix/blog/authors.ts +50 -0
- package/skills/wix-headless-templates/blog/app/wix/blog/blog-feed-store.ts +156 -0
- package/skills/wix-headless-templates/blog/app/wix/blog/comments-core.ts +189 -0
- package/skills/wix-headless-templates/blog/app/wix/blog/comments-store.ts +214 -0
- package/skills/wix-headless-templates/blog/app/wix/blog/comments.ts +84 -0
- package/skills/wix-headless-templates/blog/app/wix/blog/post-likes.ts +42 -0
- package/skills/wix-headless-templates/blog/app/wix/blog/post-store.ts +158 -0
- package/skills/wix-headless-templates/blog/app/wix/blog/posts-core.ts +347 -0
- package/skills/wix-headless-templates/blog/app/wix/blog/posts.ts +132 -0
- package/skills/wix-headless-templates/blog/app/wix/blog/taxonomy-core.ts +80 -0
- package/skills/wix-headless-templates/blog/app/wix/blog/taxonomy.ts +78 -0
- package/skills/wix-headless-templates/blog/app/wix/blog/types.ts +161 -0
- package/skills/wix-headless-templates/blog/app-astro/layouts/SiteLayout.astro +44 -0
- package/skills/wix-headless-templates/blog/app-astro/pages/blog/[...slug].astro +148 -0
- package/skills/wix-headless-templates/blog/app-astro/pages/blog/category/[slug].astro +97 -0
- package/skills/wix-headless-templates/blog/app-astro/pages/blog/tag/[slug].astro +51 -0
- package/skills/wix-headless-templates/blog/app-astro/pages/blog.astro +34 -0
- package/skills/wix-headless-templates/blog/project/README.md +15 -0
- package/skills/wix-headless-templates/blog/project/astro.config.mjs +22 -0
- package/skills/wix-headless-templates/blog/project/package-lock.json +14699 -0
- package/skills/wix-headless-templates/blog/project/package.json +39 -0
- package/skills/wix-headless-templates/blog/project/public/favicon.svg +9 -0
- package/skills/wix-headless-templates/blog/project/src/assets/astro.svg +1 -0
- package/skills/wix-headless-templates/blog/project/src/assets/background.svg +1 -0
- package/skills/wix-headless-templates/blog/project/src/assets/wix.svg +18 -0
- package/skills/wix-headless-templates/blog/project/src/components/Hero.astro +77 -0
- package/skills/wix-headless-templates/blog/project/src/components/Welcome.astro +95 -0
- package/skills/wix-headless-templates/blog/project/src/components/blog/BlogFeedView.tsx +191 -0
- package/skills/wix-headless-templates/blog/project/src/components/blog/CommentsView.tsx +206 -0
- package/skills/wix-headless-templates/blog/project/src/components/blog/PostLikeButton.tsx +62 -0
- package/skills/wix-headless-templates/blog/project/src/components/blog/PostView.tsx +139 -0
- package/skills/wix-headless-templates/blog/project/src/components/blog/RichContent.tsx +42 -0
- package/skills/wix-headless-templates/blog/project/src/hooks/blog/useBlogFeed.ts +31 -0
- package/skills/wix-headless-templates/blog/project/src/hooks/blog/useComments.ts +26 -0
- package/skills/wix-headless-templates/blog/project/src/hooks/blog/usePost.ts +25 -0
- package/skills/wix-headless-templates/blog/project/src/layouts/Layout.astro +22 -0
- package/skills/wix-headless-templates/blog/project/src/layouts/SiteLayout.astro +44 -0
- package/skills/wix-headless-templates/blog/project/src/pages/blog/[...slug].astro +148 -0
- package/skills/wix-headless-templates/blog/project/src/pages/blog/category/[slug].astro +97 -0
- package/skills/wix-headless-templates/blog/project/src/pages/blog/tag/[slug].astro +51 -0
- package/skills/wix-headless-templates/blog/project/src/pages/blog.astro +34 -0
- package/skills/wix-headless-templates/blog/project/src/pages/index.astro +8 -0
- package/skills/wix-headless-templates/blog/project/src/styles/global.css +57 -0
- package/skills/wix-headless-templates/blog/project/src/wix/blog/authors-core.ts +51 -0
- package/skills/wix-headless-templates/blog/project/src/wix/blog/authors.ts +50 -0
- package/skills/wix-headless-templates/blog/project/src/wix/blog/blog-feed-store.ts +156 -0
- package/skills/wix-headless-templates/blog/project/src/wix/blog/comments-core.ts +189 -0
- package/skills/wix-headless-templates/blog/project/src/wix/blog/comments-store.ts +214 -0
- package/skills/wix-headless-templates/blog/project/src/wix/blog/comments.ts +84 -0
- package/skills/wix-headless-templates/blog/project/src/wix/blog/post-likes.ts +42 -0
- package/skills/wix-headless-templates/blog/project/src/wix/blog/post-store.ts +158 -0
- package/skills/wix-headless-templates/blog/project/src/wix/blog/posts-core.ts +347 -0
- package/skills/wix-headless-templates/blog/project/src/wix/blog/posts.ts +132 -0
- package/skills/wix-headless-templates/blog/project/src/wix/blog/taxonomy-core.ts +80 -0
- package/skills/wix-headless-templates/blog/project/src/wix/blog/taxonomy.ts +78 -0
- package/skills/wix-headless-templates/blog/project/src/wix/blog/types.ts +161 -0
- package/skills/wix-headless-templates/blog/project/src/wix/config.ts +16 -0
- package/skills/wix-headless-templates/blog/project/src/wix/media.ts +106 -0
- package/skills/wix-headless-templates/blog/project/src/wix/money.ts +24 -0
- package/skills/wix-headless-templates/blog/project/src/wix/sdk.ts +89 -0
- package/skills/wix-headless-templates/blog/project/tsconfig.json +5 -0
- package/skills/wix-headless-templates/blog/rest/authors.ts +39 -0
- package/skills/wix-headless-templates/blog/rest/comments.ts +64 -0
- package/skills/wix-headless-templates/blog/rest/post-likes.ts +37 -0
- package/skills/wix-headless-templates/blog/rest/posts.ts +123 -0
- package/skills/wix-headless-templates/blog/rest/taxonomy.ts +79 -0
- package/skills/wix-headless-templates/blog/seed/SEED.md +81 -0
- package/skills/wix-headless-templates/blog/seed/read-site.mjs +33 -0
- package/skills/wix-headless-templates/blog/seed/seed-blog.mjs +337 -0
- package/skills/wix-headless-templates/bookings/INSTRUCTIONS.md +356 -0
- package/skills/wix-headless-templates/bookings/app/components/bookings/ServiceBookingView.tsx +369 -0
- package/skills/wix-headless-templates/bookings/app/components/bookings/ServicesView.tsx +193 -0
- package/skills/wix-headless-templates/bookings/app/hooks/bookings/useBookingFlow.ts +56 -0
- package/skills/wix-headless-templates/bookings/app/hooks/bookings/useServices.ts +23 -0
- package/skills/wix-headless-templates/bookings/app/wix/bookings/booking-core.ts +614 -0
- package/skills/wix-headless-templates/bookings/app/wix/bookings/booking-flow-store.ts +410 -0
- package/skills/wix-headless-templates/bookings/app/wix/bookings/booking.ts +227 -0
- package/skills/wix-headless-templates/bookings/app/wix/bookings/services-core.ts +366 -0
- package/skills/wix-headless-templates/bookings/app/wix/bookings/services-store.ts +213 -0
- package/skills/wix-headless-templates/bookings/app/wix/bookings/services.ts +100 -0
- package/skills/wix-headless-templates/bookings/app/wix/bookings/types.ts +236 -0
- package/skills/wix-headless-templates/bookings/app-astro/layouts/SiteLayout.astro +40 -0
- package/skills/wix-headless-templates/bookings/app-astro/pages/services/[slug].astro +81 -0
- package/skills/wix-headless-templates/bookings/app-astro/pages/services.astro +40 -0
- package/skills/wix-headless-templates/bookings/project/README.md +15 -0
- package/skills/wix-headless-templates/bookings/project/astro.config.mjs +22 -0
- package/skills/wix-headless-templates/bookings/project/package-lock.json +10546 -0
- package/skills/wix-headless-templates/bookings/project/package.json +41 -0
- package/skills/wix-headless-templates/bookings/project/public/favicon.svg +9 -0
- package/skills/wix-headless-templates/bookings/project/src/assets/astro.svg +1 -0
- package/skills/wix-headless-templates/bookings/project/src/assets/background.svg +1 -0
- package/skills/wix-headless-templates/bookings/project/src/assets/wix.svg +18 -0
- package/skills/wix-headless-templates/bookings/project/src/components/Hero.astro +77 -0
- package/skills/wix-headless-templates/bookings/project/src/components/Welcome.astro +95 -0
- package/skills/wix-headless-templates/bookings/project/src/components/bookings/ServiceBookingView.tsx +369 -0
- package/skills/wix-headless-templates/bookings/project/src/components/bookings/ServicesView.tsx +193 -0
- package/skills/wix-headless-templates/bookings/project/src/hooks/bookings/useBookingFlow.ts +56 -0
- package/skills/wix-headless-templates/bookings/project/src/hooks/bookings/useServices.ts +23 -0
- package/skills/wix-headless-templates/bookings/project/src/layouts/Layout.astro +22 -0
- package/skills/wix-headless-templates/bookings/project/src/layouts/SiteLayout.astro +40 -0
- package/skills/wix-headless-templates/bookings/project/src/pages/index.astro +8 -0
- package/skills/wix-headless-templates/bookings/project/src/pages/services/[slug].astro +81 -0
- package/skills/wix-headless-templates/bookings/project/src/pages/services.astro +40 -0
- package/skills/wix-headless-templates/bookings/project/src/styles/global.css +57 -0
- package/skills/wix-headless-templates/bookings/project/src/wix/bookings/booking-core.ts +614 -0
- package/skills/wix-headless-templates/bookings/project/src/wix/bookings/booking-flow-store.ts +410 -0
- package/skills/wix-headless-templates/bookings/project/src/wix/bookings/booking.ts +227 -0
- package/skills/wix-headless-templates/bookings/project/src/wix/bookings/services-core.ts +366 -0
- package/skills/wix-headless-templates/bookings/project/src/wix/bookings/services-store.ts +213 -0
- package/skills/wix-headless-templates/bookings/project/src/wix/bookings/services.ts +100 -0
- package/skills/wix-headless-templates/bookings/project/src/wix/bookings/types.ts +236 -0
- package/skills/wix-headless-templates/bookings/project/src/wix/config.ts +16 -0
- package/skills/wix-headless-templates/bookings/project/src/wix/media.ts +106 -0
- package/skills/wix-headless-templates/bookings/project/src/wix/money.ts +24 -0
- package/skills/wix-headless-templates/bookings/project/src/wix/sdk.ts +89 -0
- package/skills/wix-headless-templates/bookings/project/tsconfig.json +5 -0
- package/skills/wix-headless-templates/bookings/rest/booking.ts +227 -0
- package/skills/wix-headless-templates/bookings/rest/services.ts +94 -0
- package/skills/wix-headless-templates/bookings/seed/SEED.md +109 -0
- package/skills/wix-headless-templates/bookings/seed/read-site.mjs +28 -0
- package/skills/wix-headless-templates/bookings/seed/seed-bookings.mjs +407 -0
- package/skills/wix-headless-templates/cms/INSTRUCTIONS.md +399 -0
- package/skills/wix-headless-templates/cms/app/hooks/cms/useCollection.ts +82 -0
- package/skills/wix-headless-templates/cms/app/hooks/cms/useItem.ts +37 -0
- package/skills/wix-headless-templates/cms/app/wix/cms/collection-store.ts +220 -0
- package/skills/wix-headless-templates/cms/app/wix/cms/collections-core.ts +41 -0
- package/skills/wix-headless-templates/cms/app/wix/cms/collections.ts +28 -0
- package/skills/wix-headless-templates/cms/app/wix/cms/item-store.ts +93 -0
- package/skills/wix-headless-templates/cms/app/wix/cms/items-core.ts +259 -0
- package/skills/wix-headless-templates/cms/app/wix/cms/items.ts +182 -0
- package/skills/wix-headless-templates/cms/app/wix/cms/types.ts +138 -0
- package/skills/wix-headless-templates/cms/app-astro/layouts/SiteLayout.astro +41 -0
- package/skills/wix-headless-templates/cms/project/README.md +15 -0
- package/skills/wix-headless-templates/cms/project/astro.config.mjs +22 -0
- package/skills/wix-headless-templates/cms/project/package-lock.json +9798 -0
- package/skills/wix-headless-templates/cms/project/package.json +37 -0
- package/skills/wix-headless-templates/cms/project/public/favicon.svg +9 -0
- package/skills/wix-headless-templates/cms/project/src/assets/astro.svg +1 -0
- package/skills/wix-headless-templates/cms/project/src/assets/background.svg +1 -0
- package/skills/wix-headless-templates/cms/project/src/assets/wix.svg +18 -0
- package/skills/wix-headless-templates/cms/project/src/components/Hero.astro +77 -0
- package/skills/wix-headless-templates/cms/project/src/components/Welcome.astro +95 -0
- package/skills/wix-headless-templates/cms/project/src/hooks/cms/useCollection.ts +82 -0
- package/skills/wix-headless-templates/cms/project/src/hooks/cms/useItem.ts +37 -0
- package/skills/wix-headless-templates/cms/project/src/layouts/Layout.astro +22 -0
- package/skills/wix-headless-templates/cms/project/src/layouts/SiteLayout.astro +41 -0
- package/skills/wix-headless-templates/cms/project/src/pages/index.astro +8 -0
- package/skills/wix-headless-templates/cms/project/src/styles/global.css +57 -0
- package/skills/wix-headless-templates/cms/project/src/wix/cms/collection-store.ts +220 -0
- package/skills/wix-headless-templates/cms/project/src/wix/cms/collections-core.ts +41 -0
- package/skills/wix-headless-templates/cms/project/src/wix/cms/collections.ts +28 -0
- package/skills/wix-headless-templates/cms/project/src/wix/cms/item-store.ts +93 -0
- package/skills/wix-headless-templates/cms/project/src/wix/cms/items-core.ts +259 -0
- package/skills/wix-headless-templates/cms/project/src/wix/cms/items.ts +182 -0
- package/skills/wix-headless-templates/cms/project/src/wix/cms/types.ts +138 -0
- package/skills/wix-headless-templates/cms/project/src/wix/config.ts +16 -0
- package/skills/wix-headless-templates/cms/project/src/wix/media.ts +106 -0
- package/skills/wix-headless-templates/cms/project/src/wix/money.ts +24 -0
- package/skills/wix-headless-templates/cms/project/src/wix/sdk.ts +89 -0
- package/skills/wix-headless-templates/cms/project/tsconfig.json +5 -0
- package/skills/wix-headless-templates/cms/rest/collections.ts +25 -0
- package/skills/wix-headless-templates/cms/rest/items.ts +189 -0
- package/skills/wix-headless-templates/cms/seed/SEED.md +116 -0
- package/skills/wix-headless-templates/cms/seed/read-site.mjs +20 -0
- package/skills/wix-headless-templates/cms/seed/seed-cms.mjs +321 -0
- package/skills/wix-headless-templates/compose.mjs +83 -0
- package/skills/wix-headless-templates/donations/INSTRUCTIONS.md +349 -0
- package/skills/wix-headless-templates/donations/app/components/donations/DonateForm.tsx +155 -0
- package/skills/wix-headless-templates/donations/app/components/donations/DonationReceipt.tsx +46 -0
- package/skills/wix-headless-templates/donations/app/components/donations/GoalProgress.tsx +49 -0
- package/skills/wix-headless-templates/donations/app/hooks/donations/useCampaigns.ts +21 -0
- package/skills/wix-headless-templates/donations/app/hooks/donations/useDonation.ts +27 -0
- package/skills/wix-headless-templates/donations/app/hooks/donations/useDonationReceipt.ts +19 -0
- package/skills/wix-headless-templates/donations/app/wix/donations/campaigns-store.ts +59 -0
- package/skills/wix-headless-templates/donations/app/wix/donations/campaigns.ts +83 -0
- package/skills/wix-headless-templates/donations/app/wix/donations/donate.ts +95 -0
- package/skills/wix-headless-templates/donations/app/wix/donations/donation-store.ts +163 -0
- package/skills/wix-headless-templates/donations/app/wix/donations/donations-core.ts +466 -0
- package/skills/wix-headless-templates/donations/app/wix/donations/receipt-store.ts +55 -0
- package/skills/wix-headless-templates/donations/app/wix/donations/types.ts +121 -0
- package/skills/wix-headless-templates/donations/app-astro/components/donations/CampaignPage.astro +43 -0
- package/skills/wix-headless-templates/donations/app-astro/layouts/SiteLayout.astro +45 -0
- package/skills/wix-headless-templates/donations/app-astro/pages/donate/[id].astro +28 -0
- package/skills/wix-headless-templates/donations/app-astro/pages/donate/index.astro +51 -0
- package/skills/wix-headless-templates/donations/app-astro/pages/donate/thank-you.astro +13 -0
- package/skills/wix-headless-templates/donations/project/README.md +15 -0
- package/skills/wix-headless-templates/donations/project/astro.config.mjs +22 -0
- package/skills/wix-headless-templates/donations/project/package-lock.json +10266 -0
- package/skills/wix-headless-templates/donations/project/package.json +39 -0
- package/skills/wix-headless-templates/donations/project/public/favicon.svg +9 -0
- package/skills/wix-headless-templates/donations/project/src/assets/astro.svg +1 -0
- package/skills/wix-headless-templates/donations/project/src/assets/background.svg +1 -0
- package/skills/wix-headless-templates/donations/project/src/assets/wix.svg +18 -0
- package/skills/wix-headless-templates/donations/project/src/components/Hero.astro +77 -0
- package/skills/wix-headless-templates/donations/project/src/components/Welcome.astro +95 -0
- package/skills/wix-headless-templates/donations/project/src/components/donations/CampaignPage.astro +43 -0
- package/skills/wix-headless-templates/donations/project/src/components/donations/DonateForm.tsx +155 -0
- package/skills/wix-headless-templates/donations/project/src/components/donations/DonationReceipt.tsx +46 -0
- package/skills/wix-headless-templates/donations/project/src/components/donations/GoalProgress.tsx +49 -0
- package/skills/wix-headless-templates/donations/project/src/hooks/donations/useCampaigns.ts +21 -0
- package/skills/wix-headless-templates/donations/project/src/hooks/donations/useDonation.ts +27 -0
- package/skills/wix-headless-templates/donations/project/src/hooks/donations/useDonationReceipt.ts +19 -0
- package/skills/wix-headless-templates/donations/project/src/layouts/Layout.astro +22 -0
- package/skills/wix-headless-templates/donations/project/src/layouts/SiteLayout.astro +45 -0
- package/skills/wix-headless-templates/donations/project/src/pages/donate/[id].astro +28 -0
- package/skills/wix-headless-templates/donations/project/src/pages/donate/index.astro +51 -0
- package/skills/wix-headless-templates/donations/project/src/pages/donate/thank-you.astro +13 -0
- package/skills/wix-headless-templates/donations/project/src/pages/index.astro +8 -0
- package/skills/wix-headless-templates/donations/project/src/styles/global.css +57 -0
- package/skills/wix-headless-templates/donations/project/src/wix/config.ts +16 -0
- package/skills/wix-headless-templates/donations/project/src/wix/donations/campaigns-store.ts +59 -0
- package/skills/wix-headless-templates/donations/project/src/wix/donations/campaigns.ts +83 -0
- package/skills/wix-headless-templates/donations/project/src/wix/donations/donate.ts +95 -0
- package/skills/wix-headless-templates/donations/project/src/wix/donations/donation-store.ts +163 -0
- package/skills/wix-headless-templates/donations/project/src/wix/donations/donations-core.ts +466 -0
- package/skills/wix-headless-templates/donations/project/src/wix/donations/receipt-store.ts +55 -0
- package/skills/wix-headless-templates/donations/project/src/wix/donations/types.ts +121 -0
- package/skills/wix-headless-templates/donations/project/src/wix/media.ts +106 -0
- package/skills/wix-headless-templates/donations/project/src/wix/money.ts +24 -0
- package/skills/wix-headless-templates/donations/project/src/wix/sdk.ts +89 -0
- package/skills/wix-headless-templates/donations/project/tsconfig.json +5 -0
- package/skills/wix-headless-templates/donations/rest/campaigns.ts +76 -0
- package/skills/wix-headless-templates/donations/rest/donate.ts +90 -0
- package/skills/wix-headless-templates/donations/seed/SEED.md +90 -0
- package/skills/wix-headless-templates/donations/seed/read-site.mjs +33 -0
- package/skills/wix-headless-templates/donations/seed/seed-donations.mjs +250 -0
- package/skills/wix-headless-templates/events/INSTRUCTIONS.md +387 -0
- package/skills/wix-headless-templates/events/app/components/events/EventConfirmationView.tsx +139 -0
- package/skills/wix-headless-templates/events/app/components/events/EventRegistrationView.tsx +375 -0
- package/skills/wix-headless-templates/events/app/components/events/EventsView.tsx +134 -0
- package/skills/wix-headless-templates/events/app/hooks/events/useEventConfirmation.ts +21 -0
- package/skills/wix-headless-templates/events/app/hooks/events/useEventRegistration.ts +40 -0
- package/skills/wix-headless-templates/events/app/hooks/events/useEvents.ts +24 -0
- package/skills/wix-headless-templates/events/app/wix/events/events-core.ts +379 -0
- package/skills/wix-headless-templates/events/app/wix/events/events-store.ts +175 -0
- package/skills/wix-headless-templates/events/app/wix/events/events.ts +124 -0
- package/skills/wix-headless-templates/events/app/wix/events/order-store.ts +143 -0
- package/skills/wix-headless-templates/events/app/wix/events/orders-core.ts +86 -0
- package/skills/wix-headless-templates/events/app/wix/events/orders.ts +30 -0
- package/skills/wix-headless-templates/events/app/wix/events/registration-core.ts +415 -0
- package/skills/wix-headless-templates/events/app/wix/events/registration-store.ts +237 -0
- package/skills/wix-headless-templates/events/app/wix/events/registration.ts +109 -0
- package/skills/wix-headless-templates/events/app/wix/events/types.ts +249 -0
- package/skills/wix-headless-templates/events/app-astro/layouts/SiteLayout.astro +40 -0
- package/skills/wix-headless-templates/events/app-astro/pages/event-confirmation.astro +12 -0
- package/skills/wix-headless-templates/events/app-astro/pages/events/[slug].astro +104 -0
- package/skills/wix-headless-templates/events/app-astro/pages/events.astro +23 -0
- package/skills/wix-headless-templates/events/project/README.md +15 -0
- package/skills/wix-headless-templates/events/project/astro.config.mjs +22 -0
- package/skills/wix-headless-templates/events/project/package-lock.json +10497 -0
- package/skills/wix-headless-templates/events/project/package.json +39 -0
- package/skills/wix-headless-templates/events/project/public/favicon.svg +9 -0
- package/skills/wix-headless-templates/events/project/src/assets/astro.svg +1 -0
- package/skills/wix-headless-templates/events/project/src/assets/background.svg +1 -0
- package/skills/wix-headless-templates/events/project/src/assets/wix.svg +18 -0
- package/skills/wix-headless-templates/events/project/src/components/Hero.astro +77 -0
- package/skills/wix-headless-templates/events/project/src/components/Welcome.astro +95 -0
- package/skills/wix-headless-templates/events/project/src/components/events/EventConfirmationView.tsx +139 -0
- package/skills/wix-headless-templates/events/project/src/components/events/EventRegistrationView.tsx +375 -0
- package/skills/wix-headless-templates/events/project/src/components/events/EventsView.tsx +134 -0
- package/skills/wix-headless-templates/events/project/src/hooks/events/useEventConfirmation.ts +21 -0
- package/skills/wix-headless-templates/events/project/src/hooks/events/useEventRegistration.ts +40 -0
- package/skills/wix-headless-templates/events/project/src/hooks/events/useEvents.ts +24 -0
- package/skills/wix-headless-templates/events/project/src/layouts/Layout.astro +22 -0
- package/skills/wix-headless-templates/events/project/src/layouts/SiteLayout.astro +40 -0
- package/skills/wix-headless-templates/events/project/src/pages/event-confirmation.astro +12 -0
- package/skills/wix-headless-templates/events/project/src/pages/events/[slug].astro +104 -0
- package/skills/wix-headless-templates/events/project/src/pages/events.astro +23 -0
- package/skills/wix-headless-templates/events/project/src/pages/index.astro +8 -0
- package/skills/wix-headless-templates/events/project/src/styles/global.css +57 -0
- package/skills/wix-headless-templates/events/project/src/wix/config.ts +16 -0
- package/skills/wix-headless-templates/events/project/src/wix/events/events-core.ts +379 -0
- package/skills/wix-headless-templates/events/project/src/wix/events/events-store.ts +175 -0
- package/skills/wix-headless-templates/events/project/src/wix/events/events.ts +124 -0
- package/skills/wix-headless-templates/events/project/src/wix/events/order-store.ts +143 -0
- package/skills/wix-headless-templates/events/project/src/wix/events/orders-core.ts +86 -0
- package/skills/wix-headless-templates/events/project/src/wix/events/orders.ts +30 -0
- package/skills/wix-headless-templates/events/project/src/wix/events/registration-core.ts +415 -0
- package/skills/wix-headless-templates/events/project/src/wix/events/registration-store.ts +237 -0
- package/skills/wix-headless-templates/events/project/src/wix/events/registration.ts +109 -0
- package/skills/wix-headless-templates/events/project/src/wix/events/types.ts +249 -0
- package/skills/wix-headless-templates/events/project/src/wix/media.ts +106 -0
- package/skills/wix-headless-templates/events/project/src/wix/money.ts +24 -0
- package/skills/wix-headless-templates/events/project/src/wix/sdk.ts +89 -0
- package/skills/wix-headless-templates/events/project/tsconfig.json +5 -0
- package/skills/wix-headless-templates/events/rest/events.ts +112 -0
- package/skills/wix-headless-templates/events/rest/orders.ts +28 -0
- package/skills/wix-headless-templates/events/rest/registration.ts +96 -0
- package/skills/wix-headless-templates/events/seed/SEED.md +115 -0
- package/skills/wix-headless-templates/events/seed/read-site.mjs +26 -0
- package/skills/wix-headless-templates/events/seed/seed-events.mjs +322 -0
- package/skills/wix-headless-templates/faq/INSTRUCTIONS.md +317 -0
- package/skills/wix-headless-templates/faq/app/components/faq/FaqAccordion.tsx +159 -0
- package/skills/wix-headless-templates/faq/app/components/faq/FaqCategoryNav.tsx +46 -0
- package/skills/wix-headless-templates/faq/app/components/faq/FaqSearch.tsx +56 -0
- package/skills/wix-headless-templates/faq/app/hooks/faq/useFaq.ts +53 -0
- package/skills/wix-headless-templates/faq/app/wix/faq/faq-core.ts +428 -0
- package/skills/wix-headless-templates/faq/app/wix/faq/faq-store.ts +212 -0
- package/skills/wix-headless-templates/faq/app/wix/faq/faq.ts +72 -0
- package/skills/wix-headless-templates/faq/app/wix/faq/types.ts +63 -0
- package/skills/wix-headless-templates/faq/app-astro/layouts/SiteLayout.astro +40 -0
- package/skills/wix-headless-templates/faq/app-astro/pages/faq.astro +39 -0
- package/skills/wix-headless-templates/faq/project/README.md +15 -0
- package/skills/wix-headless-templates/faq/project/astro.config.mjs +22 -0
- package/skills/wix-headless-templates/faq/project/package-lock.json +8837 -0
- package/skills/wix-headless-templates/faq/project/package.json +37 -0
- package/skills/wix-headless-templates/faq/project/public/favicon.svg +9 -0
- package/skills/wix-headless-templates/faq/project/src/assets/astro.svg +1 -0
- package/skills/wix-headless-templates/faq/project/src/assets/background.svg +1 -0
- package/skills/wix-headless-templates/faq/project/src/assets/wix.svg +18 -0
- package/skills/wix-headless-templates/faq/project/src/components/Hero.astro +77 -0
- package/skills/wix-headless-templates/faq/project/src/components/Welcome.astro +95 -0
- package/skills/wix-headless-templates/faq/project/src/components/faq/FaqAccordion.tsx +159 -0
- package/skills/wix-headless-templates/faq/project/src/components/faq/FaqCategoryNav.tsx +46 -0
- package/skills/wix-headless-templates/faq/project/src/components/faq/FaqSearch.tsx +56 -0
- package/skills/wix-headless-templates/faq/project/src/hooks/faq/useFaq.ts +53 -0
- package/skills/wix-headless-templates/faq/project/src/layouts/Layout.astro +22 -0
- package/skills/wix-headless-templates/faq/project/src/layouts/SiteLayout.astro +40 -0
- package/skills/wix-headless-templates/faq/project/src/pages/faq.astro +39 -0
- package/skills/wix-headless-templates/faq/project/src/pages/index.astro +8 -0
- package/skills/wix-headless-templates/faq/project/src/styles/global.css +57 -0
- package/skills/wix-headless-templates/faq/project/src/wix/config.ts +16 -0
- package/skills/wix-headless-templates/faq/project/src/wix/faq/faq-core.ts +428 -0
- package/skills/wix-headless-templates/faq/project/src/wix/faq/faq-store.ts +212 -0
- package/skills/wix-headless-templates/faq/project/src/wix/faq/faq.ts +72 -0
- package/skills/wix-headless-templates/faq/project/src/wix/faq/types.ts +63 -0
- package/skills/wix-headless-templates/faq/project/src/wix/media.ts +106 -0
- package/skills/wix-headless-templates/faq/project/src/wix/money.ts +24 -0
- package/skills/wix-headless-templates/faq/project/src/wix/sdk.ts +89 -0
- package/skills/wix-headless-templates/faq/project/tsconfig.json +5 -0
- package/skills/wix-headless-templates/faq/rest/faq.ts +71 -0
- package/skills/wix-headless-templates/faq/seed/SEED.md +104 -0
- package/skills/wix-headless-templates/faq/seed/read-site.mjs +23 -0
- package/skills/wix-headless-templates/faq/seed/seed-faq.mjs +302 -0
- package/skills/wix-headless-templates/forms/INSTRUCTIONS.md +417 -0
- package/skills/wix-headless-templates/forms/app/hooks/forms/useWixForm.ts +108 -0
- package/skills/wix-headless-templates/forms/app/wix/forms/address-templates.generated.ts +13 -0
- package/skills/wix-headless-templates/forms/app/wix/forms/form-store.ts +533 -0
- package/skills/wix-headless-templates/forms/app/wix/forms/forms-core.ts +671 -0
- package/skills/wix-headless-templates/forms/app/wix/forms/forms.ts +57 -0
- package/skills/wix-headless-templates/forms/app/wix/forms/submissions-core.ts +423 -0
- package/skills/wix-headless-templates/forms/app/wix/forms/submissions.ts +95 -0
- package/skills/wix-headless-templates/forms/app/wix/forms/types.ts +284 -0
- package/skills/wix-headless-templates/forms/project/README.md +15 -0
- package/skills/wix-headless-templates/forms/project/astro.config.mjs +22 -0
- package/skills/wix-headless-templates/forms/project/package-lock.json +9102 -0
- package/skills/wix-headless-templates/forms/project/package.json +37 -0
- package/skills/wix-headless-templates/forms/project/public/favicon.svg +9 -0
- package/skills/wix-headless-templates/forms/project/src/assets/astro.svg +1 -0
- package/skills/wix-headless-templates/forms/project/src/assets/background.svg +1 -0
- package/skills/wix-headless-templates/forms/project/src/assets/wix.svg +18 -0
- package/skills/wix-headless-templates/forms/project/src/components/Hero.astro +77 -0
- package/skills/wix-headless-templates/forms/project/src/components/Welcome.astro +95 -0
- package/skills/wix-headless-templates/forms/project/src/hooks/forms/useWixForm.ts +108 -0
- package/skills/wix-headless-templates/forms/project/src/layouts/Layout.astro +22 -0
- package/skills/wix-headless-templates/forms/project/src/pages/index.astro +8 -0
- package/skills/wix-headless-templates/forms/project/src/styles/global.css +57 -0
- package/skills/wix-headless-templates/forms/project/src/wix/config.ts +16 -0
- package/skills/wix-headless-templates/forms/project/src/wix/forms/address-templates.generated.ts +13 -0
- package/skills/wix-headless-templates/forms/project/src/wix/forms/form-store.ts +533 -0
- package/skills/wix-headless-templates/forms/project/src/wix/forms/forms-core.ts +671 -0
- package/skills/wix-headless-templates/forms/project/src/wix/forms/forms.ts +57 -0
- package/skills/wix-headless-templates/forms/project/src/wix/forms/submissions-core.ts +423 -0
- package/skills/wix-headless-templates/forms/project/src/wix/forms/submissions.ts +95 -0
- package/skills/wix-headless-templates/forms/project/src/wix/forms/types.ts +284 -0
- package/skills/wix-headless-templates/forms/project/src/wix/media.ts +106 -0
- package/skills/wix-headless-templates/forms/project/src/wix/money.ts +24 -0
- package/skills/wix-headless-templates/forms/project/src/wix/sdk.ts +89 -0
- package/skills/wix-headless-templates/forms/project/tsconfig.json +5 -0
- package/skills/wix-headless-templates/forms/rest/forms.ts +37 -0
- package/skills/wix-headless-templates/forms/rest/submissions.ts +83 -0
- package/skills/wix-headless-templates/forms/seed/SEED.md +225 -0
- package/skills/wix-headless-templates/forms/seed/read-site.mjs +53 -0
- package/skills/wix-headless-templates/forms/seed/seed-forms.mjs +574 -0
- package/skills/wix-headless-templates/forms/tooling/address-templates.mjs +96 -0
- package/skills/wix-headless-templates/members/INSTRUCTIONS.md +345 -0
- package/skills/wix-headless-templates/members/app/components/members/AccountPage.tsx +16 -0
- package/skills/wix-headless-templates/members/app/components/members/AccountView.tsx +60 -0
- package/skills/wix-headless-templates/members/app/components/members/LoginForm.tsx +165 -0
- package/skills/wix-headless-templates/members/app/components/members/MemberMenu.tsx +78 -0
- package/skills/wix-headless-templates/members/app/components/members/RequireAuth.tsx +47 -0
- package/skills/wix-headless-templates/members/app/hooks/members/useMember.ts +67 -0
- package/skills/wix-headless-templates/members/app/wix/members/auth-core.ts +160 -0
- package/skills/wix-headless-templates/members/app/wix/members/auth.ts +117 -0
- package/skills/wix-headless-templates/members/app/wix/members/client.ts +27 -0
- package/skills/wix-headless-templates/members/app/wix/members/member-store.ts +133 -0
- package/skills/wix-headless-templates/members/app/wix/members/members-core.ts +43 -0
- package/skills/wix-headless-templates/members/app/wix/members/members.ts +29 -0
- package/skills/wix-headless-templates/members/app/wix/members/types.ts +21 -0
- package/skills/wix-headless-templates/members/app-astro/layouts/SiteLayout.astro +42 -0
- package/skills/wix-headless-templates/members/app-astro/pages/account.astro +9 -0
- package/skills/wix-headless-templates/members/app-astro/pages/login.astro +11 -0
- package/skills/wix-headless-templates/members/project/README.md +15 -0
- package/skills/wix-headless-templates/members/project/astro.config.mjs +22 -0
- package/skills/wix-headless-templates/members/project/package-lock.json +8892 -0
- package/skills/wix-headless-templates/members/project/package.json +37 -0
- package/skills/wix-headless-templates/members/project/public/favicon.svg +9 -0
- package/skills/wix-headless-templates/members/project/src/assets/astro.svg +1 -0
- package/skills/wix-headless-templates/members/project/src/assets/background.svg +1 -0
- package/skills/wix-headless-templates/members/project/src/assets/wix.svg +18 -0
- package/skills/wix-headless-templates/members/project/src/components/Hero.astro +77 -0
- package/skills/wix-headless-templates/members/project/src/components/Welcome.astro +95 -0
- package/skills/wix-headless-templates/members/project/src/components/members/AccountPage.tsx +16 -0
- package/skills/wix-headless-templates/members/project/src/components/members/AccountView.tsx +60 -0
- package/skills/wix-headless-templates/members/project/src/components/members/LoginForm.tsx +165 -0
- package/skills/wix-headless-templates/members/project/src/components/members/MemberMenu.tsx +78 -0
- package/skills/wix-headless-templates/members/project/src/components/members/RequireAuth.tsx +47 -0
- package/skills/wix-headless-templates/members/project/src/hooks/members/useMember.ts +67 -0
- package/skills/wix-headless-templates/members/project/src/layouts/Layout.astro +22 -0
- package/skills/wix-headless-templates/members/project/src/layouts/SiteLayout.astro +42 -0
- package/skills/wix-headless-templates/members/project/src/pages/account.astro +9 -0
- package/skills/wix-headless-templates/members/project/src/pages/index.astro +8 -0
- package/skills/wix-headless-templates/members/project/src/pages/login.astro +11 -0
- package/skills/wix-headless-templates/members/project/src/styles/global.css +57 -0
- package/skills/wix-headless-templates/members/project/src/wix/config.ts +16 -0
- package/skills/wix-headless-templates/members/project/src/wix/media.ts +106 -0
- package/skills/wix-headless-templates/members/project/src/wix/members/auth-core.ts +160 -0
- package/skills/wix-headless-templates/members/project/src/wix/members/auth.ts +117 -0
- package/skills/wix-headless-templates/members/project/src/wix/members/client.ts +27 -0
- package/skills/wix-headless-templates/members/project/src/wix/members/member-store.ts +133 -0
- package/skills/wix-headless-templates/members/project/src/wix/members/members-core.ts +43 -0
- package/skills/wix-headless-templates/members/project/src/wix/members/members.ts +29 -0
- package/skills/wix-headless-templates/members/project/src/wix/members/types.ts +21 -0
- package/skills/wix-headless-templates/members/project/src/wix/money.ts +24 -0
- package/skills/wix-headless-templates/members/project/src/wix/sdk.ts +89 -0
- package/skills/wix-headless-templates/members/project/tsconfig.json +5 -0
- package/skills/wix-headless-templates/members/rest/auth.ts +224 -0
- package/skills/wix-headless-templates/members/rest/members.ts +26 -0
- package/skills/wix-headless-templates/members/seed/SEED.md +39 -0
- package/skills/wix-headless-templates/members/seed/read-site.mjs +15 -0
- package/skills/wix-headless-templates/members/seed/seed-members.mjs +91 -0
- package/skills/wix-headless-templates/portfolio/INSTRUCTIONS.md +315 -0
- package/skills/wix-headless-templates/portfolio/app/components/portfolio/CollectionProjectsView.tsx +110 -0
- package/skills/wix-headless-templates/portfolio/app/components/portfolio/CollectionsView.tsx +90 -0
- package/skills/wix-headless-templates/portfolio/app/components/portfolio/GalleryMedia.tsx +35 -0
- package/skills/wix-headless-templates/portfolio/app/components/portfolio/ProjectDetailView.tsx +85 -0
- package/skills/wix-headless-templates/portfolio/app/hooks/portfolio/useCollectionProjects.ts +32 -0
- package/skills/wix-headless-templates/portfolio/app/hooks/portfolio/useCollections.ts +21 -0
- package/skills/wix-headless-templates/portfolio/app/hooks/portfolio/useProjectDetail.ts +31 -0
- package/skills/wix-headless-templates/portfolio/app/wix/portfolio/collection-projects-store.ts +82 -0
- package/skills/wix-headless-templates/portfolio/app/wix/portfolio/collections-store.ts +58 -0
- package/skills/wix-headless-templates/portfolio/app/wix/portfolio/portfolio-core.ts +177 -0
- package/skills/wix-headless-templates/portfolio/app/wix/portfolio/portfolio.ts +78 -0
- package/skills/wix-headless-templates/portfolio/app/wix/portfolio/project-detail-store.ts +81 -0
- package/skills/wix-headless-templates/portfolio/app/wix/portfolio/types.ts +55 -0
- package/skills/wix-headless-templates/portfolio/app-astro/layouts/SiteLayout.astro +40 -0
- package/skills/wix-headless-templates/portfolio/app-astro/pages/portfolio/[slug].astro +30 -0
- package/skills/wix-headless-templates/portfolio/app-astro/pages/portfolio.astro +21 -0
- package/skills/wix-headless-templates/portfolio/app-astro/pages/projects/[slug].astro +29 -0
- package/skills/wix-headless-templates/portfolio/project/README.md +15 -0
- package/skills/wix-headless-templates/portfolio/project/astro.config.mjs +22 -0
- package/skills/wix-headless-templates/portfolio/project/package-lock.json +8760 -0
- package/skills/wix-headless-templates/portfolio/project/package.json +37 -0
- package/skills/wix-headless-templates/portfolio/project/public/favicon.svg +9 -0
- package/skills/wix-headless-templates/portfolio/project/src/assets/astro.svg +1 -0
- package/skills/wix-headless-templates/portfolio/project/src/assets/background.svg +1 -0
- package/skills/wix-headless-templates/portfolio/project/src/assets/wix.svg +18 -0
- package/skills/wix-headless-templates/portfolio/project/src/components/Hero.astro +77 -0
- package/skills/wix-headless-templates/portfolio/project/src/components/Welcome.astro +95 -0
- package/skills/wix-headless-templates/portfolio/project/src/components/portfolio/CollectionProjectsView.tsx +110 -0
- package/skills/wix-headless-templates/portfolio/project/src/components/portfolio/CollectionsView.tsx +90 -0
- package/skills/wix-headless-templates/portfolio/project/src/components/portfolio/GalleryMedia.tsx +35 -0
- package/skills/wix-headless-templates/portfolio/project/src/components/portfolio/ProjectDetailView.tsx +85 -0
- package/skills/wix-headless-templates/portfolio/project/src/hooks/portfolio/useCollectionProjects.ts +32 -0
- package/skills/wix-headless-templates/portfolio/project/src/hooks/portfolio/useCollections.ts +21 -0
- package/skills/wix-headless-templates/portfolio/project/src/hooks/portfolio/useProjectDetail.ts +31 -0
- package/skills/wix-headless-templates/portfolio/project/src/layouts/Layout.astro +22 -0
- package/skills/wix-headless-templates/portfolio/project/src/layouts/SiteLayout.astro +40 -0
- package/skills/wix-headless-templates/portfolio/project/src/pages/index.astro +8 -0
- package/skills/wix-headless-templates/portfolio/project/src/pages/portfolio/[slug].astro +30 -0
- package/skills/wix-headless-templates/portfolio/project/src/pages/portfolio.astro +21 -0
- package/skills/wix-headless-templates/portfolio/project/src/pages/projects/[slug].astro +29 -0
- package/skills/wix-headless-templates/portfolio/project/src/styles/global.css +57 -0
- package/skills/wix-headless-templates/portfolio/project/src/wix/config.ts +16 -0
- package/skills/wix-headless-templates/portfolio/project/src/wix/media.ts +106 -0
- package/skills/wix-headless-templates/portfolio/project/src/wix/money.ts +24 -0
- package/skills/wix-headless-templates/portfolio/project/src/wix/portfolio/collection-projects-store.ts +82 -0
- package/skills/wix-headless-templates/portfolio/project/src/wix/portfolio/collections-store.ts +58 -0
- package/skills/wix-headless-templates/portfolio/project/src/wix/portfolio/portfolio-core.ts +177 -0
- package/skills/wix-headless-templates/portfolio/project/src/wix/portfolio/portfolio.ts +78 -0
- package/skills/wix-headless-templates/portfolio/project/src/wix/portfolio/project-detail-store.ts +81 -0
- package/skills/wix-headless-templates/portfolio/project/src/wix/portfolio/types.ts +55 -0
- package/skills/wix-headless-templates/portfolio/project/src/wix/sdk.ts +89 -0
- package/skills/wix-headless-templates/portfolio/project/tsconfig.json +5 -0
- package/skills/wix-headless-templates/portfolio/rest/portfolio.ts +75 -0
- package/skills/wix-headless-templates/portfolio/seed/SEED.md +86 -0
- package/skills/wix-headless-templates/portfolio/seed/read-site.mjs +20 -0
- package/skills/wix-headless-templates/portfolio/seed/seed-portfolio.mjs +253 -0
- package/skills/wix-headless-templates/pricing-plans/INSTRUCTIONS.md +376 -0
- package/skills/wix-headless-templates/pricing-plans/app/components/pricing-plans/PlanDetailView.tsx +54 -0
- package/skills/wix-headless-templates/pricing-plans/app/components/pricing-plans/PlansView.tsx +108 -0
- package/skills/wix-headless-templates/pricing-plans/app/components/pricing-plans/RequirePlan.tsx +87 -0
- package/skills/wix-headless-templates/pricing-plans/app/components/pricing-plans/SubscribeButton.tsx +41 -0
- package/skills/wix-headless-templates/pricing-plans/app/hooks/pricing-plans/usePlanAccess.ts +31 -0
- package/skills/wix-headless-templates/pricing-plans/app/hooks/pricing-plans/usePlanPurchase.ts +16 -0
- package/skills/wix-headless-templates/pricing-plans/app/hooks/pricing-plans/usePlans.ts +22 -0
- package/skills/wix-headless-templates/pricing-plans/app/wix/pricing-plans/plan-access-core.ts +29 -0
- package/skills/wix-headless-templates/pricing-plans/app/wix/pricing-plans/plan-access-store.ts +92 -0
- package/skills/wix-headless-templates/pricing-plans/app/wix/pricing-plans/plan-access.ts +37 -0
- package/skills/wix-headless-templates/pricing-plans/app/wix/pricing-plans/plan-purchase-store.ts +54 -0
- package/skills/wix-headless-templates/pricing-plans/app/wix/pricing-plans/plans-core.ts +212 -0
- package/skills/wix-headless-templates/pricing-plans/app/wix/pricing-plans/plans-store.ts +64 -0
- package/skills/wix-headless-templates/pricing-plans/app/wix/pricing-plans/plans.ts +54 -0
- package/skills/wix-headless-templates/pricing-plans/app/wix/pricing-plans/purchase-core.ts +43 -0
- package/skills/wix-headless-templates/pricing-plans/app/wix/pricing-plans/purchase.ts +22 -0
- package/skills/wix-headless-templates/pricing-plans/app/wix/pricing-plans/types.ts +52 -0
- package/skills/wix-headless-templates/pricing-plans/app-astro/layouts/SiteLayout.astro +41 -0
- package/skills/wix-headless-templates/pricing-plans/app-astro/pages/plans/[slug].astro +43 -0
- package/skills/wix-headless-templates/pricing-plans/app-astro/pages/plans.astro +21 -0
- package/skills/wix-headless-templates/pricing-plans/project/README.md +15 -0
- package/skills/wix-headless-templates/pricing-plans/project/astro.config.mjs +22 -0
- package/skills/wix-headless-templates/pricing-plans/project/package-lock.json +9799 -0
- package/skills/wix-headless-templates/pricing-plans/project/package.json +38 -0
- package/skills/wix-headless-templates/pricing-plans/project/public/favicon.svg +9 -0
- package/skills/wix-headless-templates/pricing-plans/project/src/assets/astro.svg +1 -0
- package/skills/wix-headless-templates/pricing-plans/project/src/assets/background.svg +1 -0
- package/skills/wix-headless-templates/pricing-plans/project/src/assets/wix.svg +18 -0
- package/skills/wix-headless-templates/pricing-plans/project/src/components/Hero.astro +77 -0
- package/skills/wix-headless-templates/pricing-plans/project/src/components/Welcome.astro +95 -0
- package/skills/wix-headless-templates/pricing-plans/project/src/components/pricing-plans/PlanDetailView.tsx +54 -0
- package/skills/wix-headless-templates/pricing-plans/project/src/components/pricing-plans/PlansView.tsx +108 -0
- package/skills/wix-headless-templates/pricing-plans/project/src/components/pricing-plans/RequirePlan.tsx +87 -0
- package/skills/wix-headless-templates/pricing-plans/project/src/components/pricing-plans/SubscribeButton.tsx +41 -0
- package/skills/wix-headless-templates/pricing-plans/project/src/hooks/pricing-plans/usePlanAccess.ts +31 -0
- package/skills/wix-headless-templates/pricing-plans/project/src/hooks/pricing-plans/usePlanPurchase.ts +16 -0
- package/skills/wix-headless-templates/pricing-plans/project/src/hooks/pricing-plans/usePlans.ts +22 -0
- package/skills/wix-headless-templates/pricing-plans/project/src/layouts/Layout.astro +22 -0
- package/skills/wix-headless-templates/pricing-plans/project/src/layouts/SiteLayout.astro +41 -0
- package/skills/wix-headless-templates/pricing-plans/project/src/pages/index.astro +8 -0
- package/skills/wix-headless-templates/pricing-plans/project/src/pages/plans/[slug].astro +43 -0
- package/skills/wix-headless-templates/pricing-plans/project/src/pages/plans.astro +21 -0
- package/skills/wix-headless-templates/pricing-plans/project/src/styles/global.css +57 -0
- package/skills/wix-headless-templates/pricing-plans/project/src/wix/config.ts +16 -0
- package/skills/wix-headless-templates/pricing-plans/project/src/wix/media.ts +106 -0
- package/skills/wix-headless-templates/pricing-plans/project/src/wix/money.ts +24 -0
- package/skills/wix-headless-templates/pricing-plans/project/src/wix/pricing-plans/plan-access-core.ts +29 -0
- package/skills/wix-headless-templates/pricing-plans/project/src/wix/pricing-plans/plan-access-store.ts +92 -0
- package/skills/wix-headless-templates/pricing-plans/project/src/wix/pricing-plans/plan-access.ts +37 -0
- package/skills/wix-headless-templates/pricing-plans/project/src/wix/pricing-plans/plan-purchase-store.ts +54 -0
- package/skills/wix-headless-templates/pricing-plans/project/src/wix/pricing-plans/plans-core.ts +212 -0
- package/skills/wix-headless-templates/pricing-plans/project/src/wix/pricing-plans/plans-store.ts +64 -0
- package/skills/wix-headless-templates/pricing-plans/project/src/wix/pricing-plans/plans.ts +54 -0
- package/skills/wix-headless-templates/pricing-plans/project/src/wix/pricing-plans/purchase-core.ts +43 -0
- package/skills/wix-headless-templates/pricing-plans/project/src/wix/pricing-plans/purchase.ts +22 -0
- package/skills/wix-headless-templates/pricing-plans/project/src/wix/pricing-plans/types.ts +52 -0
- package/skills/wix-headless-templates/pricing-plans/project/src/wix/sdk.ts +89 -0
- package/skills/wix-headless-templates/pricing-plans/project/tsconfig.json +5 -0
- package/skills/wix-headless-templates/pricing-plans/rest/plan-access.ts +31 -0
- package/skills/wix-headless-templates/pricing-plans/rest/plans.ts +58 -0
- package/skills/wix-headless-templates/pricing-plans/rest/purchase.ts +20 -0
- package/skills/wix-headless-templates/pricing-plans/seed/SEED.md +93 -0
- package/skills/wix-headless-templates/pricing-plans/seed/read-site.mjs +22 -0
- package/skills/wix-headless-templates/pricing-plans/seed/seed-pricing-plans.mjs +301 -0
- package/skills/wix-headless-templates/rentals/INSTRUCTIONS.md +309 -0
- package/skills/wix-headless-templates/rentals/app/components/rentals/RentalBookingView.tsx +195 -0
- package/skills/wix-headless-templates/rentals/app/components/rentals/RentalsView.tsx +89 -0
- package/skills/wix-headless-templates/rentals/app/hooks/rentals/useRentalFlow.ts +31 -0
- package/skills/wix-headless-templates/rentals/app/hooks/rentals/useRentals.ts +23 -0
- package/skills/wix-headless-templates/rentals/app/wix/rentals/rental-flow-store.ts +283 -0
- package/skills/wix-headless-templates/rentals/app/wix/rentals/rentals-core.ts +435 -0
- package/skills/wix-headless-templates/rentals/app/wix/rentals/rentals-store.ts +112 -0
- package/skills/wix-headless-templates/rentals/app/wix/rentals/rentals.ts +173 -0
- package/skills/wix-headless-templates/rentals/app/wix/rentals/types.ts +113 -0
- package/skills/wix-headless-templates/rentals/app-astro/layouts/SiteLayout.astro +40 -0
- package/skills/wix-headless-templates/rentals/app-astro/pages/rentals/[slug].astro +81 -0
- package/skills/wix-headless-templates/rentals/app-astro/pages/rentals.astro +24 -0
- package/skills/wix-headless-templates/rentals/project/README.md +15 -0
- package/skills/wix-headless-templates/rentals/project/astro.config.mjs +22 -0
- package/skills/wix-headless-templates/rentals/project/package-lock.json +10545 -0
- package/skills/wix-headless-templates/rentals/project/package.json +40 -0
- package/skills/wix-headless-templates/rentals/project/public/favicon.svg +9 -0
- package/skills/wix-headless-templates/rentals/project/src/assets/astro.svg +1 -0
- package/skills/wix-headless-templates/rentals/project/src/assets/background.svg +1 -0
- package/skills/wix-headless-templates/rentals/project/src/assets/wix.svg +18 -0
- package/skills/wix-headless-templates/rentals/project/src/components/Hero.astro +77 -0
- package/skills/wix-headless-templates/rentals/project/src/components/Welcome.astro +95 -0
- package/skills/wix-headless-templates/rentals/project/src/components/rentals/RentalBookingView.tsx +195 -0
- package/skills/wix-headless-templates/rentals/project/src/components/rentals/RentalsView.tsx +89 -0
- package/skills/wix-headless-templates/rentals/project/src/hooks/rentals/useRentalFlow.ts +31 -0
- package/skills/wix-headless-templates/rentals/project/src/hooks/rentals/useRentals.ts +23 -0
- package/skills/wix-headless-templates/rentals/project/src/layouts/Layout.astro +22 -0
- package/skills/wix-headless-templates/rentals/project/src/layouts/SiteLayout.astro +40 -0
- package/skills/wix-headless-templates/rentals/project/src/pages/index.astro +8 -0
- package/skills/wix-headless-templates/rentals/project/src/pages/rentals/[slug].astro +81 -0
- package/skills/wix-headless-templates/rentals/project/src/pages/rentals.astro +24 -0
- package/skills/wix-headless-templates/rentals/project/src/styles/global.css +57 -0
- package/skills/wix-headless-templates/rentals/project/src/wix/config.ts +16 -0
- package/skills/wix-headless-templates/rentals/project/src/wix/media.ts +106 -0
- package/skills/wix-headless-templates/rentals/project/src/wix/money.ts +24 -0
- package/skills/wix-headless-templates/rentals/project/src/wix/rentals/rental-flow-store.ts +283 -0
- package/skills/wix-headless-templates/rentals/project/src/wix/rentals/rentals-core.ts +435 -0
- package/skills/wix-headless-templates/rentals/project/src/wix/rentals/rentals-store.ts +112 -0
- package/skills/wix-headless-templates/rentals/project/src/wix/rentals/rentals.ts +173 -0
- package/skills/wix-headless-templates/rentals/project/src/wix/rentals/types.ts +113 -0
- package/skills/wix-headless-templates/rentals/project/src/wix/sdk.ts +89 -0
- package/skills/wix-headless-templates/rentals/project/tsconfig.json +5 -0
- package/skills/wix-headless-templates/rentals/rest/rentals.ts +153 -0
- package/skills/wix-headless-templates/rentals/seed/SEED.md +95 -0
- package/skills/wix-headless-templates/rentals/seed/read-site.mjs +34 -0
- package/skills/wix-headless-templates/rentals/seed/seed-rentals.mjs +321 -0
- package/skills/wix-headless-templates/restaurants/INSTRUCTIONS.md +468 -0
- package/skills/wix-headless-templates/restaurants/app/components/restaurants/MenuView.tsx +257 -0
- package/skills/wix-headless-templates/restaurants/app/components/restaurants/OrderCartButton.tsx +26 -0
- package/skills/wix-headless-templates/restaurants/app/components/restaurants/OrderCartDrawer.tsx +121 -0
- package/skills/wix-headless-templates/restaurants/app/components/restaurants/ReservationView.tsx +212 -0
- package/skills/wix-headless-templates/restaurants/app/hooks/restaurants/useMenus.ts +34 -0
- package/skills/wix-headless-templates/restaurants/app/hooks/restaurants/useOrderCart.ts +52 -0
- package/skills/wix-headless-templates/restaurants/app/hooks/restaurants/useReservation.ts +49 -0
- package/skills/wix-headless-templates/restaurants/app/wix/restaurants/menu-core.ts +333 -0
- package/skills/wix-headless-templates/restaurants/app/wix/restaurants/menu-store.ts +89 -0
- package/skills/wix-headless-templates/restaurants/app/wix/restaurants/menu.ts +109 -0
- package/skills/wix-headless-templates/restaurants/app/wix/restaurants/order-store.ts +141 -0
- package/skills/wix-headless-templates/restaurants/app/wix/restaurants/ordering-core.ts +287 -0
- package/skills/wix-headless-templates/restaurants/app/wix/restaurants/ordering.ts +237 -0
- package/skills/wix-headless-templates/restaurants/app/wix/restaurants/reservation-store.ts +279 -0
- package/skills/wix-headless-templates/restaurants/app/wix/restaurants/reservations-core.ts +218 -0
- package/skills/wix-headless-templates/restaurants/app/wix/restaurants/reservations.ts +109 -0
- package/skills/wix-headless-templates/restaurants/app/wix/restaurants/time-core.ts +118 -0
- package/skills/wix-headless-templates/restaurants/app/wix/restaurants/types.ts +337 -0
- package/skills/wix-headless-templates/restaurants/app-astro/layouts/SiteLayout.astro +47 -0
- package/skills/wix-headless-templates/restaurants/app-astro/pages/menu.astro +22 -0
- package/skills/wix-headless-templates/restaurants/app-astro/pages/reservations.astro +12 -0
- package/skills/wix-headless-templates/restaurants/project/README.md +15 -0
- package/skills/wix-headless-templates/restaurants/project/astro.config.mjs +22 -0
- package/skills/wix-headless-templates/restaurants/project/package-lock.json +11038 -0
- package/skills/wix-headless-templates/restaurants/project/package.json +40 -0
- package/skills/wix-headless-templates/restaurants/project/public/favicon.svg +9 -0
- package/skills/wix-headless-templates/restaurants/project/src/assets/astro.svg +1 -0
- package/skills/wix-headless-templates/restaurants/project/src/assets/background.svg +1 -0
- package/skills/wix-headless-templates/restaurants/project/src/assets/wix.svg +18 -0
- package/skills/wix-headless-templates/restaurants/project/src/components/Hero.astro +77 -0
- package/skills/wix-headless-templates/restaurants/project/src/components/Welcome.astro +95 -0
- package/skills/wix-headless-templates/restaurants/project/src/components/restaurants/MenuView.tsx +257 -0
- package/skills/wix-headless-templates/restaurants/project/src/components/restaurants/OrderCartButton.tsx +26 -0
- package/skills/wix-headless-templates/restaurants/project/src/components/restaurants/OrderCartDrawer.tsx +121 -0
- package/skills/wix-headless-templates/restaurants/project/src/components/restaurants/ReservationView.tsx +212 -0
- package/skills/wix-headless-templates/restaurants/project/src/hooks/restaurants/useMenus.ts +34 -0
- package/skills/wix-headless-templates/restaurants/project/src/hooks/restaurants/useOrderCart.ts +52 -0
- package/skills/wix-headless-templates/restaurants/project/src/hooks/restaurants/useReservation.ts +49 -0
- package/skills/wix-headless-templates/restaurants/project/src/layouts/Layout.astro +22 -0
- package/skills/wix-headless-templates/restaurants/project/src/layouts/SiteLayout.astro +47 -0
- package/skills/wix-headless-templates/restaurants/project/src/pages/index.astro +8 -0
- package/skills/wix-headless-templates/restaurants/project/src/pages/menu.astro +22 -0
- package/skills/wix-headless-templates/restaurants/project/src/pages/reservations.astro +12 -0
- package/skills/wix-headless-templates/restaurants/project/src/styles/global.css +57 -0
- package/skills/wix-headless-templates/restaurants/project/src/wix/config.ts +16 -0
- package/skills/wix-headless-templates/restaurants/project/src/wix/media.ts +106 -0
- package/skills/wix-headless-templates/restaurants/project/src/wix/money.ts +24 -0
- package/skills/wix-headless-templates/restaurants/project/src/wix/restaurants/menu-core.ts +333 -0
- package/skills/wix-headless-templates/restaurants/project/src/wix/restaurants/menu-store.ts +89 -0
- package/skills/wix-headless-templates/restaurants/project/src/wix/restaurants/menu.ts +109 -0
- package/skills/wix-headless-templates/restaurants/project/src/wix/restaurants/order-store.ts +141 -0
- package/skills/wix-headless-templates/restaurants/project/src/wix/restaurants/ordering-core.ts +287 -0
- package/skills/wix-headless-templates/restaurants/project/src/wix/restaurants/ordering.ts +237 -0
- package/skills/wix-headless-templates/restaurants/project/src/wix/restaurants/reservation-store.ts +279 -0
- package/skills/wix-headless-templates/restaurants/project/src/wix/restaurants/reservations-core.ts +218 -0
- package/skills/wix-headless-templates/restaurants/project/src/wix/restaurants/reservations.ts +109 -0
- package/skills/wix-headless-templates/restaurants/project/src/wix/restaurants/time-core.ts +118 -0
- package/skills/wix-headless-templates/restaurants/project/src/wix/restaurants/types.ts +337 -0
- package/skills/wix-headless-templates/restaurants/project/src/wix/sdk.ts +89 -0
- package/skills/wix-headless-templates/restaurants/project/tsconfig.json +5 -0
- package/skills/wix-headless-templates/restaurants/rest/menu.ts +96 -0
- package/skills/wix-headless-templates/restaurants/rest/ordering.ts +222 -0
- package/skills/wix-headless-templates/restaurants/rest/reservations.ts +102 -0
- package/skills/wix-headless-templates/restaurants/seed/SEED.md +118 -0
- package/skills/wix-headless-templates/restaurants/seed/read-site.mjs +25 -0
- package/skills/wix-headless-templates/restaurants/seed/seed-restaurants.mjs +577 -0
- package/skills/wix-headless-templates/shared/CONTENT.md +22 -0
- package/skills/wix-headless-templates/shared/CUSTOM_OPERATIONS.md +100 -0
- package/skills/wix-headless-templates/shared/DESIGN.md +37 -0
- package/skills/wix-headless-templates/shared/SUPPLIED-CONTENT.md +27 -0
- package/skills/wix-headless-templates/shared/app/styles/global.css +57 -0
- package/skills/wix-headless-templates/shared/app/wix/config.ts +16 -0
- package/skills/wix-headless-templates/shared/app/wix/media.ts +106 -0
- package/skills/wix-headless-templates/shared/app/wix/money.ts +24 -0
- package/skills/wix-headless-templates/shared/app/wix/sdk.ts +89 -0
- package/skills/wix-headless-templates/shared/capabilities/media-upload/app/wix/media-upload/client.ts +46 -0
- package/skills/wix-headless-templates/shared/capabilities/media-upload/app-astro/pages/api/wix/media-upload.ts +69 -0
- package/skills/wix-headless-templates/shared/capabilities/site-search/INSTRUCTIONS.md +194 -0
- package/skills/wix-headless-templates/shared/capabilities/site-search/app/components/site-search/SearchBox.tsx +136 -0
- package/skills/wix-headless-templates/shared/capabilities/site-search/app/components/site-search/SearchHit.tsx +50 -0
- package/skills/wix-headless-templates/shared/capabilities/site-search/app/components/site-search/SearchResults.tsx +300 -0
- package/skills/wix-headless-templates/shared/capabilities/site-search/app/hooks/site-search/useSearch.ts +31 -0
- package/skills/wix-headless-templates/shared/capabilities/site-search/app/hooks/site-search/useSuggest.ts +26 -0
- package/skills/wix-headless-templates/shared/capabilities/site-search/app/wix/site-search/search-core.ts +520 -0
- package/skills/wix-headless-templates/shared/capabilities/site-search/app/wix/site-search/search-store.ts +235 -0
- package/skills/wix-headless-templates/shared/capabilities/site-search/app/wix/site-search/search.ts +80 -0
- package/skills/wix-headless-templates/shared/capabilities/site-search/app/wix/site-search/suggest-store.ts +178 -0
- package/skills/wix-headless-templates/shared/capabilities/site-search/app/wix/site-search/types.ts +158 -0
- package/skills/wix-headless-templates/shared/capabilities/site-search/app-astro/pages/search.astro +33 -0
- package/skills/wix-headless-templates/shared/capabilities/site-search/rest/search.ts +82 -0
- package/skills/wix-headless-templates/shared/capabilities/site-search/seed/install.mjs +43 -0
- package/skills/wix-headless-templates/shared/rest/client.ts +155 -0
- package/skills/wix-headless-templates/shared/rest/config.ts +4 -0
- package/skills/wix-headless-templates/shared/rest/media.ts +92 -0
- package/skills/wix-headless-templates/shared/seed/images.mjs +183 -0
- package/skills/wix-headless-templates/shared/seed/read-site.mjs +97 -0
- package/skills/wix-headless-templates/shared/seed/site-context.mjs +70 -0
- package/skills/wix-headless-templates/shared/seed/site.mjs +48 -0
- package/skills/wix-headless-templates/shared/seed/wix-cli.mjs +44 -0
- package/skills/wix-headless-templates/storefront/INSTRUCTIONS.md +685 -0
- package/skills/wix-headless-templates/storefront/app/components/storefront/CartButton.tsx +26 -0
- package/skills/wix-headless-templates/storefront/app/components/storefront/CartDrawer.tsx +239 -0
- package/skills/wix-headless-templates/storefront/app/components/storefront/FilterPanel.tsx +267 -0
- package/skills/wix-headless-templates/storefront/app/components/storefront/OptionPicker.tsx +171 -0
- package/skills/wix-headless-templates/storefront/app/components/storefront/QuickAdd.tsx +148 -0
- package/skills/wix-headless-templates/storefront/app/hooks/storefront/useCart.ts +59 -0
- package/skills/wix-headless-templates/storefront/app/hooks/storefront/useProductDetail.ts +42 -0
- package/skills/wix-headless-templates/storefront/app/hooks/storefront/useShop.ts +34 -0
- package/skills/wix-headless-templates/storefront/app/wix/storefront/cart-core.ts +220 -0
- package/skills/wix-headless-templates/storefront/app/wix/storefront/cart-store.ts +134 -0
- package/skills/wix-headless-templates/storefront/app/wix/storefront/cart.ts +187 -0
- package/skills/wix-headless-templates/storefront/app/wix/storefront/catalog-core.ts +698 -0
- package/skills/wix-headless-templates/storefront/app/wix/storefront/catalog.ts +260 -0
- package/skills/wix-headless-templates/storefront/app/wix/storefront/product-detail-store.ts +280 -0
- package/skills/wix-headless-templates/storefront/app/wix/storefront/shop-store.ts +341 -0
- package/skills/wix-headless-templates/storefront/app/wix/storefront/types.ts +305 -0
- package/skills/wix-headless-templates/storefront/app-astro/layouts/SiteLayout.astro +65 -0
- package/skills/wix-headless-templates/storefront/project/README.md +15 -0
- package/skills/wix-headless-templates/storefront/project/astro.config.mjs +22 -0
- package/skills/wix-headless-templates/storefront/project/package-lock.json +10786 -0
- package/skills/wix-headless-templates/storefront/project/package.json +41 -0
- package/skills/wix-headless-templates/storefront/project/public/favicon.svg +9 -0
- package/skills/wix-headless-templates/storefront/project/src/assets/astro.svg +1 -0
- package/skills/wix-headless-templates/storefront/project/src/assets/background.svg +1 -0
- package/skills/wix-headless-templates/storefront/project/src/assets/wix.svg +18 -0
- package/skills/wix-headless-templates/storefront/project/src/components/Hero.astro +77 -0
- package/skills/wix-headless-templates/storefront/project/src/components/Welcome.astro +95 -0
- package/skills/wix-headless-templates/storefront/project/src/components/storefront/CartButton.tsx +26 -0
- package/skills/wix-headless-templates/storefront/project/src/components/storefront/CartDrawer.tsx +239 -0
- package/skills/wix-headless-templates/storefront/project/src/components/storefront/FilterPanel.tsx +267 -0
- package/skills/wix-headless-templates/storefront/project/src/components/storefront/OptionPicker.tsx +171 -0
- package/skills/wix-headless-templates/storefront/project/src/components/storefront/QuickAdd.tsx +148 -0
- package/skills/wix-headless-templates/storefront/project/src/hooks/storefront/useCart.ts +59 -0
- package/skills/wix-headless-templates/storefront/project/src/hooks/storefront/useProductDetail.ts +42 -0
- package/skills/wix-headless-templates/storefront/project/src/hooks/storefront/useShop.ts +34 -0
- package/skills/wix-headless-templates/storefront/project/src/layouts/Layout.astro +22 -0
- package/skills/wix-headless-templates/storefront/project/src/layouts/SiteLayout.astro +65 -0
- package/skills/wix-headless-templates/storefront/project/src/pages/index.astro +8 -0
- package/skills/wix-headless-templates/storefront/project/src/styles/global.css +57 -0
- package/skills/wix-headless-templates/storefront/project/src/wix/config.ts +16 -0
- package/skills/wix-headless-templates/storefront/project/src/wix/media.ts +106 -0
- package/skills/wix-headless-templates/storefront/project/src/wix/money.ts +24 -0
- package/skills/wix-headless-templates/storefront/project/src/wix/sdk.ts +89 -0
- package/skills/wix-headless-templates/storefront/project/src/wix/storefront/cart-core.ts +220 -0
- package/skills/wix-headless-templates/storefront/project/src/wix/storefront/cart-store.ts +134 -0
- package/skills/wix-headless-templates/storefront/project/src/wix/storefront/cart.ts +187 -0
- package/skills/wix-headless-templates/storefront/project/src/wix/storefront/catalog-core.ts +698 -0
- package/skills/wix-headless-templates/storefront/project/src/wix/storefront/catalog.ts +260 -0
- package/skills/wix-headless-templates/storefront/project/src/wix/storefront/product-detail-store.ts +280 -0
- package/skills/wix-headless-templates/storefront/project/src/wix/storefront/shop-store.ts +341 -0
- package/skills/wix-headless-templates/storefront/project/src/wix/storefront/types.ts +305 -0
- package/skills/wix-headless-templates/storefront/project/tsconfig.json +5 -0
- package/skills/wix-headless-templates/storefront/rest/cart.ts +183 -0
- package/skills/wix-headless-templates/storefront/rest/catalog.ts +267 -0
- package/skills/wix-headless-templates/storefront/seed/SEED.md +169 -0
- package/skills/wix-headless-templates/storefront/seed/read-site.mjs +38 -0
- package/skills/wix-headless-templates/storefront/seed/seed-store.mjs +839 -0
- package/skills/wix-manage/SKILL.md +11 -7
- package/skills/wix-manage/references/bookings/end-to-end-booking-flow.md +1 -1
- package/skills/wix-manage/references/custom-apps/use-app-skills-and-app-tools.md +206 -0
- package/skills/wix-manage/references/site-properties/change-payment-currency-site-properties.md +17 -24
- package/skills/wix-manage/references/sites/create-headless-site.md +2 -0
- package/skills/wix-manage/references/sites/upload-static-site.md +262 -171
- package/skills/wix-manage/references/stores/update-product-with-options.md +1 -1
- package/skills/wix-app/references/dashboard-page/DRAFT_TEMPLATE_COLLECTION.md +0 -184
- package/skills/wix-app/references/dashboard-page/DRAFT_TEMPLATE_ROUTER.md +0 -204
- package/skills/wix-app/references/dashboard-page/DRAFT_TEMPLATE_SETTINGS.md +0 -44
- package/skills/wix-headless/entry/bootstrap.mjs +0 -156
- package/skills/wix-headless/entry/skill.md +0 -78
- package/skills/wix-headless-kit/cold-start/bootstrap.mjs +0 -156
- package/skills/wix-headless-kit/cold-start/cold-start.md +0 -111
- package/skills/wix-manage/references/bookings/booking-system-integration-gaps.md +0 -423
|
@@ -0,0 +1,698 @@
|
|
|
1
|
+
// Catalog rules and DTO mapping — transport-agnostic, imported by BOTH transports: ./catalog.ts
|
|
2
|
+
// (the SDK, managed Astro and React) and the REST twin in templates/storefront/rest/catalog.ts
|
|
3
|
+
// (fetch, a static site or a port to another language). Every rule about prices, ribbons,
|
|
4
|
+
// ranges, media, variants, facets lives HERE, once. A raw entity may come from the SDK (`_id`)
|
|
5
|
+
// or from REST (`id`); the mappers accept both. Imports are type-only so a strip to JS emits no
|
|
6
|
+
// imports.
|
|
7
|
+
import type {
|
|
8
|
+
Availability,
|
|
9
|
+
Breadcrumb,
|
|
10
|
+
Category,
|
|
11
|
+
Facet,
|
|
12
|
+
FacetChoice,
|
|
13
|
+
FacetData,
|
|
14
|
+
ProductDetail,
|
|
15
|
+
ProductModifier,
|
|
16
|
+
ProductOption,
|
|
17
|
+
ProductSummary,
|
|
18
|
+
ProductVariant,
|
|
19
|
+
SubscriptionPlan,
|
|
20
|
+
VariantInventory,
|
|
21
|
+
} from "./types";
|
|
22
|
+
|
|
23
|
+
/** A raw Catalog V3 entity as either transport returns it. */
|
|
24
|
+
export type Raw = Record<string, any>;
|
|
25
|
+
/** Media value + size → https URL. Injected: the SDK transport scales through @wix/sdk, REST through the URL form. */
|
|
26
|
+
export type ImgSrc = (value: any, width: number, height: number) => string;
|
|
27
|
+
/** Media identity before scaling — de-duplicate on this, never on a resolved URL. */
|
|
28
|
+
export type MediaKey = (value: any) => string;
|
|
29
|
+
|
|
30
|
+
const id = (raw: Raw | undefined): string => raw?._id ?? raw?.id ?? "";
|
|
31
|
+
|
|
32
|
+
// Requested on every product read. CURRENCY → formattedAmount (without it prices render as bare
|
|
33
|
+
// numbers); MEDIA_ITEMS_INFO → the gallery; MIN_PRICE_VARIANT + DISCOUNT_INFO → the cheapest variant
|
|
34
|
+
// with its discounted price and the discount rule names: a card's real price and the direct-add
|
|
35
|
+
// variant id, no per-product fetch.
|
|
36
|
+
export const LIST_FIELDS = ["CURRENCY", "MEDIA_ITEMS_INFO", "MIN_PRICE_VARIANT", "DISCOUNT_INFO"] as const;
|
|
37
|
+
// The detail read adds the HTML description, the variants (VARIANT_OPTION_CHOICE_NAMES — without it
|
|
38
|
+
// variantsInfo is null), the info sections with HTML bodies, each variant's plan prices
|
|
39
|
+
// (SUBSCRIPTION_PRICES_INFO), and the category path (BREADCRUMBS_INFO, DIRECT_CATEGORIES_INFO).
|
|
40
|
+
export const DETAIL_FIELDS = [
|
|
41
|
+
...LIST_FIELDS,
|
|
42
|
+
"PLAIN_DESCRIPTION",
|
|
43
|
+
"VARIANT_OPTION_CHOICE_NAMES",
|
|
44
|
+
"INFO_SECTION",
|
|
45
|
+
"INFO_SECTION_PLAIN_DESCRIPTION",
|
|
46
|
+
"SUBSCRIPTION_PRICES_INFO",
|
|
47
|
+
"BREADCRUMBS_INFO",
|
|
48
|
+
"DIRECT_CATEGORIES_INFO",
|
|
49
|
+
// the gallery image linked to each option choice (the dashboard's "image per colour"); variant
|
|
50
|
+
// media is derived from it at creation only, so the choice is the source of truth
|
|
51
|
+
"PRODUCT_CHOICES_MEDIA_REFERENCES",
|
|
52
|
+
] as const;
|
|
53
|
+
|
|
54
|
+
/** Stores' category tree — every Categories API call names it. */
|
|
55
|
+
export const STORES_TREE = { appNamespace: "@wix/stores", treeKey: null } as const;
|
|
56
|
+
|
|
57
|
+
// ---- sort + filter ---------------------------------------------------------------------------------
|
|
58
|
+
|
|
59
|
+
export const CATALOG_SORTS = {
|
|
60
|
+
featured: { label: "Default order" }, // the catalog's own order — no sort sent, and NOT a sales ranking
|
|
61
|
+
priceAsc: { label: "Price: low to high" },
|
|
62
|
+
priceHigh: { label: "Price: high to low" },
|
|
63
|
+
name: { label: "Name: A–Z" },
|
|
64
|
+
nameDesc: { label: "Name: Z–A" },
|
|
65
|
+
newest: { label: "Newest" },
|
|
66
|
+
} as const;
|
|
67
|
+
export type CatalogSort = keyof typeof CATALOG_SORTS;
|
|
68
|
+
|
|
69
|
+
export const SORT_FIELDS: Partial<Record<CatalogSort, { fieldName: string; order: "ASC" | "DESC" }[]>> = {
|
|
70
|
+
priceAsc: [{ fieldName: "actualPriceRange.minValue.amount", order: "ASC" }, { fieldName: "name", order: "ASC" }],
|
|
71
|
+
priceHigh: [{ fieldName: "actualPriceRange.minValue.amount", order: "DESC" }, { fieldName: "name", order: "ASC" }],
|
|
72
|
+
name: [{ fieldName: "name", order: "ASC" }],
|
|
73
|
+
nameDesc: [{ fieldName: "name", order: "DESC" }],
|
|
74
|
+
newest: [{ fieldName: "createdDate", order: "DESC" }, { fieldName: "name", order: "ASC" }],
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
// The search fields a product carries its customization ids under — the same paths aggregate
|
|
78
|
+
// (facets) and filter (selection), so a facet always filters on the field it was counted from.
|
|
79
|
+
export const OPTION_CHOICE_FIELD = "options.choicesSettings.choices.choiceId";
|
|
80
|
+
export const MODIFIER_CHOICE_FIELD = "modifiers.choicesSettings.choices.choiceId";
|
|
81
|
+
|
|
82
|
+
/** The buyer's picks in ONE facet: a choice matches when the product carries ANY of them; facets AND together. */
|
|
83
|
+
export interface FacetSelection {
|
|
84
|
+
/** The facet (customization) id. */
|
|
85
|
+
id: string;
|
|
86
|
+
kind: "option" | "modifier";
|
|
87
|
+
/** Choice ids — linked choices already expanded under their primary (see expandFacetChoiceIds). */
|
|
88
|
+
choiceIds: string[];
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
export interface CatalogSearchOptions {
|
|
92
|
+
/** 1–100, default 24. */
|
|
93
|
+
limit?: number;
|
|
94
|
+
/** Continues the ORIGINAL query — send it alone; any change of selection starts over without one. */
|
|
95
|
+
cursor?: string | null;
|
|
96
|
+
categoryId?: string | null;
|
|
97
|
+
sort?: CatalogSort;
|
|
98
|
+
/** Inclusive bounds, site currency: the cheapest variant at least `minPrice`, the dearest at most `maxPrice`. */
|
|
99
|
+
minPrice?: number | string;
|
|
100
|
+
maxPrice?: number | string;
|
|
101
|
+
/** IN_STOCK only — excludes partially stocked and preorder-only products. */
|
|
102
|
+
inStockOnly?: boolean;
|
|
103
|
+
/** Name search, max 100 chars. */
|
|
104
|
+
search?: string;
|
|
105
|
+
/** Facet selections — one $hasSome per facet, AND-ed across facets (Red OR Blue, AND Large). */
|
|
106
|
+
facetSelections?: FacetSelection[];
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
export function priceBound(value: number | string | undefined, name: string): number | undefined {
|
|
110
|
+
if (value == null || value === "") return undefined;
|
|
111
|
+
const n = Number(value);
|
|
112
|
+
if (!Number.isFinite(n) || n < 0) throw new Error(`${name} must be a non-negative number.`);
|
|
113
|
+
return n;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
/**
|
|
117
|
+
* The filter every catalog read shares (the page, its count, the facets) — one place, so they
|
|
118
|
+
* can't drift. Search rejects two operators in ONE field object: price bounds are separate
|
|
119
|
+
* conditions joined by $and. Category: `allCategoriesInfo.categories` with `$matchItems` on the
|
|
120
|
+
* id (includes parent categories); never `$hasSome`, never V1 `collectionIds`. The price bounds
|
|
121
|
+
* bracket the product's RANGE: its minimum at least `minPrice`, its maximum at most `maxPrice` —
|
|
122
|
+
* a "$10–$50" filter must not admit a $12–$400 product. Facets discover PRODUCTS carrying a
|
|
123
|
+
* choice; the picker / PDP still resolves the variant.
|
|
124
|
+
*/
|
|
125
|
+
export function catalogFilter({ categoryId, minPrice, maxPrice, inStockOnly = false, facetSelections = [] }: CatalogSearchOptions = {}): Raw {
|
|
126
|
+
const min = priceBound(minPrice, "minPrice"), max = priceBound(maxPrice, "maxPrice");
|
|
127
|
+
if (min !== undefined && max !== undefined && min > max) throw new Error("minPrice must not exceed maxPrice.");
|
|
128
|
+
const and: Raw[] = [{ visible: true }];
|
|
129
|
+
if (categoryId) and.push({ "allCategoriesInfo.categories": { $matchItems: [{ id: categoryId }] } });
|
|
130
|
+
if (min !== undefined) and.push({ "actualPriceRange.minValue.amount": { $gte: String(min) } });
|
|
131
|
+
if (max !== undefined) and.push({ "actualPriceRange.maxValue.amount": { $lte: String(max) } });
|
|
132
|
+
if (inStockOnly) and.push({ "inventory.availabilityStatus": { $eq: "IN_STOCK" } });
|
|
133
|
+
for (const f of facetSelections) {
|
|
134
|
+
if (!f.choiceIds.length) continue;
|
|
135
|
+
and.push({ [f.kind === "modifier" ? MODIFIER_CHOICE_FIELD : OPTION_CHOICE_FIELD]: { $hasSome: f.choiceIds } });
|
|
136
|
+
}
|
|
137
|
+
return { $and: and };
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
/** The full Search Products body (minus fields) for a page; a cursor request carries ONLY cursorPaging. */
|
|
141
|
+
export function searchQuery(o: CatalogSearchOptions): Raw {
|
|
142
|
+
const { limit = 24, cursor, sort = "featured", search = "" } = o;
|
|
143
|
+
if (!Number.isInteger(limit) || limit < 1 || limit > 100) throw new Error("limit must be between 1 and 100.");
|
|
144
|
+
const paging = { cursorPaging: { limit, ...(cursor ? { cursor } : {}) } };
|
|
145
|
+
if (cursor) return paging;
|
|
146
|
+
if (!(sort in CATALOG_SORTS)) throw new Error("Unsupported catalog sort.");
|
|
147
|
+
if (search.trim().length > 100) throw new Error("Search must be at most 100 characters.");
|
|
148
|
+
return {
|
|
149
|
+
...paging,
|
|
150
|
+
filter: catalogFilter(o),
|
|
151
|
+
...(SORT_FIELDS[sort] ? { sort: SORT_FIELDS[sort] } : {}),
|
|
152
|
+
...(search.trim() ? { search: { expression: search.trim(), fields: ["name"] } } : {}),
|
|
153
|
+
};
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
/** Read a search response's paging: `hasNext` is authoritative, the cursor is what continues. */
|
|
157
|
+
export function pageInfo(res: Raw | null | undefined): { nextCursor: string | null; hasMore: boolean } {
|
|
158
|
+
const nextCursor: string | null = res?.pagingMetadata?.cursors?.next ?? null;
|
|
159
|
+
const hasNext = res?.pagingMetadata?.hasNext;
|
|
160
|
+
return { nextCursor, hasMore: typeof hasNext === "boolean" ? hasNext && !!nextCursor : !!nextCursor };
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
// ---- facets (aggregations + customizations) ---------------------------------------------------------
|
|
164
|
+
|
|
165
|
+
// The aggregations-only search that discovers a scope's filters: price bounds as scalars, the
|
|
166
|
+
// option/modifier ids and their choice ids as value buckets with counts. `cursorPaging.limit: 0`
|
|
167
|
+
// returns no products — the whole catalog is summarised in one call, however many products.
|
|
168
|
+
export const FACET_AGGREGATIONS: Raw[] = [
|
|
169
|
+
{ name: "min_price", type: "SCALAR", fieldPath: "actualPriceRange.minValue.amount", scalar: { type: "MIN" } },
|
|
170
|
+
{ name: "max_price", type: "SCALAR", fieldPath: "actualPriceRange.maxValue.amount", scalar: { type: "MAX" } },
|
|
171
|
+
{ name: "options", type: "VALUE", fieldPath: "options.id", value: { limit: 1000, sortType: "COUNT", sortDirection: "DESC" } },
|
|
172
|
+
{ name: "options_with_choice", type: "VALUE", fieldPath: OPTION_CHOICE_FIELD, value: { limit: 20000, sortType: "COUNT", sortDirection: "DESC" } },
|
|
173
|
+
{ name: "modifiers", type: "VALUE", fieldPath: "modifiers.id", value: { limit: 1000, sortType: "COUNT", sortDirection: "DESC" } },
|
|
174
|
+
{ name: "modifiers_with_choice", type: "VALUE", fieldPath: MODIFIER_CHOICE_FIELD, value: { limit: 20000, sortType: "COUNT", sortDirection: "DESC" } },
|
|
175
|
+
];
|
|
176
|
+
|
|
177
|
+
/** The Search Products body that returns only the aggregations of a scope. */
|
|
178
|
+
export function facetSearchBody(categoryId?: string | null): Raw {
|
|
179
|
+
return { filter: catalogFilter({ categoryId }), cursorPaging: { limit: 0 }, aggregations: FACET_AGGREGATIONS };
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
/** The ids the aggregations named, plus per-choice product counts and the price bounds. */
|
|
183
|
+
export interface FacetAggregates {
|
|
184
|
+
minPrice: number | null;
|
|
185
|
+
maxPrice: number | null;
|
|
186
|
+
optionIds: string[];
|
|
187
|
+
modifierIds: string[];
|
|
188
|
+
/** choiceId -> products carrying it, options and modifiers together (ids are GUIDs, they never collide). */
|
|
189
|
+
choiceCounts: Record<string, number>;
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
export function readFacetAggregates(res: Raw | null | undefined): FacetAggregates {
|
|
193
|
+
const byName = new Map<string, Raw>();
|
|
194
|
+
for (const r of (res?.aggregationData?.results ?? []) as Raw[]) if (r?.name) byName.set(r.name, r);
|
|
195
|
+
const ids = (name: string): string[] => ((byName.get(name)?.values?.results ?? []) as Raw[]).map((b) => b?.value).filter((v): v is string => typeof v === "string" && v.length > 0);
|
|
196
|
+
const counts: Record<string, number> = {};
|
|
197
|
+
for (const name of ["options_with_choice", "modifiers_with_choice"]) {
|
|
198
|
+
for (const b of (byName.get(name)?.values?.results ?? []) as Raw[]) if (typeof b?.value === "string" && typeof b?.count === "number") counts[b.value] = b.count;
|
|
199
|
+
}
|
|
200
|
+
const scalar = (name: string): number | null => {
|
|
201
|
+
const v = byName.get(name)?.scalar?.value;
|
|
202
|
+
return typeof v === "number" && Number.isFinite(v) ? v : null;
|
|
203
|
+
};
|
|
204
|
+
return { minPrice: scalar("min_price"), maxPrice: scalar("max_price"), optionIds: ids("options"), modifierIds: ids("modifiers"), choiceCounts: counts };
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
/** Every customization id the facets need names, colors and choice order for. */
|
|
208
|
+
export function facetCustomizationIds(agg: FacetAggregates): string[] {
|
|
209
|
+
return [...new Set([...agg.optionIds, ...agg.modifierIds])];
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
const numeric = (s: string): number | null => {
|
|
213
|
+
const t = s.trim();
|
|
214
|
+
if (!t) return null;
|
|
215
|
+
const n = Number(t);
|
|
216
|
+
return Number.isFinite(n) ? n : null;
|
|
217
|
+
};
|
|
218
|
+
// Names sort case-insensitively, numbers first and numerically ("2", "10", "L").
|
|
219
|
+
const byNameNumericFirst = <T>(items: T[], name: (t: T) => string): T[] =>
|
|
220
|
+
[...items].sort((a, b) => {
|
|
221
|
+
const na = numeric(name(a)), nb = numeric(name(b));
|
|
222
|
+
if (na !== null && nb !== null) return na - nb;
|
|
223
|
+
if (na !== null) return -1;
|
|
224
|
+
if (nb !== null) return 1;
|
|
225
|
+
return name(a).toLowerCase().localeCompare(name(b).toLowerCase());
|
|
226
|
+
});
|
|
227
|
+
|
|
228
|
+
/**
|
|
229
|
+
* One facet from a customization entity and the counts the aggregation gave its choices: only
|
|
230
|
+
* choices some product in the scope carries; a linked choice ("Light red", `primaryChoiceIds`)
|
|
231
|
+
* folds into its primary with its count and rides along as a childId when the primary is picked;
|
|
232
|
+
* order per the merchant's `choicesSettings.sortOrder` (BY_NAME, BY_PRODUCT_COUNT, MANUAL; the
|
|
233
|
+
* default is name for text, count for swatches).
|
|
234
|
+
*/
|
|
235
|
+
export function toFacet(customization: Raw, kind: Facet["kind"], choiceCounts: Record<string, number>): Facet {
|
|
236
|
+
const all: Raw[] = customization.choicesSettings?.choices ?? [];
|
|
237
|
+
const parentOf = new Map<string, string[]>(); // childId -> primary ids
|
|
238
|
+
for (const c of all) if (Array.isArray(c.primaryChoiceIds) && c.primaryChoiceIds.length) parentOf.set(id(c), c.primaryChoiceIds);
|
|
239
|
+
const choices = new Map<string, FacetChoice>();
|
|
240
|
+
const choiceOf = (c: Raw): FacetChoice => ({ id: id(c), name: c.name ?? "", colorCode: c.colorCode ?? null, count: 0, childIds: [] });
|
|
241
|
+
for (const c of all) {
|
|
242
|
+
const count = choiceCounts[id(c)] ?? 0;
|
|
243
|
+
const primaries = parentOf.get(id(c));
|
|
244
|
+
if (primaries) {
|
|
245
|
+
if (!count) continue;
|
|
246
|
+
for (const pid of primaries) {
|
|
247
|
+
const primary = all.find((p) => id(p) === pid);
|
|
248
|
+
if (!primary) continue;
|
|
249
|
+
const entry = choices.get(pid) ?? choiceOf(primary);
|
|
250
|
+
entry.count += count;
|
|
251
|
+
entry.childIds.push(id(c));
|
|
252
|
+
choices.set(pid, entry);
|
|
253
|
+
}
|
|
254
|
+
continue;
|
|
255
|
+
}
|
|
256
|
+
if (!count && !choices.has(id(c))) continue;
|
|
257
|
+
const entry = choices.get(id(c)) ?? choiceOf(c);
|
|
258
|
+
entry.count += count;
|
|
259
|
+
choices.set(id(c), entry);
|
|
260
|
+
}
|
|
261
|
+
// a primary that only got children (no own count) surfaces through them above; drop empties
|
|
262
|
+
let list = [...choices.values()].filter((c) => c.id && c.count > 0);
|
|
263
|
+
const isColor = customization.customizationRenderType === "SWATCH_CHOICES";
|
|
264
|
+
const order: string = customization.choicesSettings?.sortOrder ?? "DEFAULT";
|
|
265
|
+
if (order === "BY_NAME" || (order === "DEFAULT" && !isColor)) list = byNameNumericFirst(list, (c) => c.name);
|
|
266
|
+
else if (order === "BY_PRODUCT_COUNT" || (order === "DEFAULT" && parentOf.size > 0)) list = [...list].sort((a, b) => b.count - a.count);
|
|
267
|
+
else if (order === "MANUAL") {
|
|
268
|
+
const pos = new Map(all.map((c, i) => [id(c), i]));
|
|
269
|
+
list = [...list].sort((a, b) => (pos.get(a.id) ?? 1e9) - (pos.get(b.id) ?? 1e9));
|
|
270
|
+
}
|
|
271
|
+
return { id: id(customization), name: customization.name ?? "", kind, isColor, choices: list };
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
/**
|
|
275
|
+
* Facets + price bounds from the aggregations and the customization entities they named. Free-text
|
|
276
|
+
* customizations never arrive (the query excludes them); a facet with one choice narrows nothing
|
|
277
|
+
* and is dropped; swatch facets first, then text, each by name.
|
|
278
|
+
*/
|
|
279
|
+
export function toFacetData(agg: FacetAggregates, customizations: Raw[]): FacetData {
|
|
280
|
+
const byId = new Map(customizations.map((c) => [id(c), c]));
|
|
281
|
+
const build = (ids: string[], kind: Facet["kind"]): Facet[] =>
|
|
282
|
+
ids.flatMap((cid) => {
|
|
283
|
+
const c = byId.get(cid);
|
|
284
|
+
if (!c || c.customizationRenderType === "FREE_TEXT") return [];
|
|
285
|
+
const f = toFacet(c, kind, agg.choiceCounts);
|
|
286
|
+
return f.choices.length > 1 ? [f] : [];
|
|
287
|
+
});
|
|
288
|
+
const facets = [...build(agg.optionIds, "option"), ...build(agg.modifierIds, "modifier")];
|
|
289
|
+
const swatches = byNameNumericFirst(facets.filter((f) => f.isColor), (f) => f.name);
|
|
290
|
+
const texts = byNameNumericFirst(facets.filter((f) => !f.isColor), (f) => f.name);
|
|
291
|
+
const lo = agg.minPrice, hi = agg.maxPrice;
|
|
292
|
+
return {
|
|
293
|
+
facets: [...swatches, ...texts],
|
|
294
|
+
priceRange: lo !== null && hi !== null && hi > lo ? { min: Math.floor(lo), max: Math.ceil(hi) } : null,
|
|
295
|
+
};
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
/** The ids a selection sends for a facet: each picked choice plus the linked choices folded under it. */
|
|
299
|
+
export function expandFacetChoiceIds(facet: Facet | undefined, choiceIds: string[]): string[] {
|
|
300
|
+
const out = new Set<string>();
|
|
301
|
+
for (const cid of choiceIds) {
|
|
302
|
+
out.add(cid);
|
|
303
|
+
for (const child of facet?.choices.find((c) => c.id === cid)?.childIds ?? []) out.add(child);
|
|
304
|
+
}
|
|
305
|
+
return [...out];
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
// ---- price rules ----------------------------------------------------------------------------------
|
|
309
|
+
|
|
310
|
+
/**
|
|
311
|
+
* The price the buyer pays and the price to strike — exact precedence, shared by cards and
|
|
312
|
+
* variants. An automatic discount (priceAfterDiscount) wins and strikes the regular actualPrice;
|
|
313
|
+
* else actualPrice with the merchant's compareAtPrice as the "was". `!== undefined` on purpose:
|
|
314
|
+
* a discounted price of 0 is a real price.
|
|
315
|
+
*/
|
|
316
|
+
export function sellingPrice(price: Raw | undefined): { current?: Raw; original?: Raw } {
|
|
317
|
+
if (price?.priceAfterDiscount !== undefined) return { current: price.priceAfterDiscount, original: price.actualPrice };
|
|
318
|
+
return { current: price?.actualPrice, original: price?.compareAtPrice };
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
/** The struck price only when it is real and higher than what the buyer pays. */
|
|
322
|
+
export function strike(original: Raw | undefined, current: Raw | undefined): string | null {
|
|
323
|
+
const o = Number(original?.amount), c = Number(current?.amount);
|
|
324
|
+
return original?.formattedAmount && Number.isFinite(o) && Number.isFinite(c) && o > c ? original.formattedAmount : null;
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
/** Every merchant ribbon, primary first, de-duplicated. A ribbon is a label, never proof of a price. */
|
|
328
|
+
export function ribbonsOf(raw: Raw): string[] {
|
|
329
|
+
return [raw.ribbon?.name, ...((raw.additionalRibbons ?? []) as Raw[]).map((r) => r?.name)]
|
|
330
|
+
.filter((n, i, all): n is string => typeof n === "string" && n.length > 0 && all.indexOf(n) === i);
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
export function toAvailability(raw: Raw): Availability {
|
|
334
|
+
const s = raw.inventory?.availabilityStatus;
|
|
335
|
+
return s === "OUT_OF_STOCK" || s === "PARTIALLY_OUT_OF_STOCK" ? s : "IN_STOCK";
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
/**
|
|
339
|
+
* The product-level pre-order state: every variant pre-orderable, or some are and the product
|
|
340
|
+
* is out of stock (`inventory.preorderAvailability`). Older responses without that field fall
|
|
341
|
+
* back to `preorderStatus`.
|
|
342
|
+
*/
|
|
343
|
+
export function isPreorderProduct(raw: Raw): boolean {
|
|
344
|
+
const availability = toAvailability(raw);
|
|
345
|
+
const pa = raw.inventory?.preorderAvailability;
|
|
346
|
+
if (pa) return pa === "ALL_VARIANTS" || (pa === "SOME_VARIANTS" && availability === "OUT_OF_STOCK");
|
|
347
|
+
return raw.inventory?.preorderStatus === "ENABLED" && availability === "OUT_OF_STOCK";
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
/**
|
|
351
|
+
* Every distinct media entry, main first, keyed on identity — two scaled URLs of one photo are
|
|
352
|
+
* ONE entry (the "two thumbnails for the same image" bug). Shared by the tile and the PDP.
|
|
353
|
+
*/
|
|
354
|
+
export function mediaEntries(raw: Raw, mediaKey: MediaKey): unknown[] {
|
|
355
|
+
const out: unknown[] = [];
|
|
356
|
+
const seen = new Set<string>();
|
|
357
|
+
for (const m of [raw.media?.main, ...((raw.media?.itemsInfo?.items ?? []) as Raw[])]) {
|
|
358
|
+
const v = m?.image ?? m;
|
|
359
|
+
const k = mediaKey(v);
|
|
360
|
+
if (!k || seen.has(k)) continue;
|
|
361
|
+
seen.add(k);
|
|
362
|
+
out.push(v);
|
|
363
|
+
}
|
|
364
|
+
return out;
|
|
365
|
+
}
|
|
366
|
+
|
|
367
|
+
const visibleSubscriptions = (raw: Raw): Raw[] => ((raw.subscriptionDetails?.subscriptions ?? []) as Raw[]).filter((s) => s.visible !== false);
|
|
368
|
+
|
|
369
|
+
// ---- DTO mappers -----------------------------------------------------------------------------------
|
|
370
|
+
|
|
371
|
+
export function toSummary(raw: Raw, imgSrc: ImgSrc, mediaKey: MediaKey): ProductSummary {
|
|
372
|
+
const options: Raw[] = raw.options ?? [];
|
|
373
|
+
const media = mediaEntries(raw, mediaKey);
|
|
374
|
+
const mainUrl = imgSrc(media[0], 800, 800);
|
|
375
|
+
const hover = media.slice(1).map((m) => imgSrc(m, 800, 800)).filter(Boolean);
|
|
376
|
+
const availability = toAvailability(raw);
|
|
377
|
+
// Price: the cheapest variant's selling price (discount applied); the product RANGE when variants
|
|
378
|
+
// are priced differently — and NO struck price beside a range (a lone struck minimum claims a
|
|
379
|
+
// saving that may not apply to the variant picked). When that cheapest variant is DISCOUNTED the
|
|
380
|
+
// range's top is unknown here (actualPriceRange is pre-discount) — the tile says "From {price}"
|
|
381
|
+
// and the PDP recomputes the range from its variants.
|
|
382
|
+
const min = raw.actualPriceRange?.minValue, max = raw.actualPriceRange?.maxValue;
|
|
383
|
+
const isRange = !!(min?.amount && max?.amount && min.amount !== max.amount);
|
|
384
|
+
const minVariant: Raw | undefined = raw.variantSummary?.minPriceVariant;
|
|
385
|
+
const { current, original } = sellingPrice(minVariant?.price);
|
|
386
|
+
const discounted = minVariant?.price?.priceAfterDiscount !== undefined;
|
|
387
|
+
const price = current?.formattedAmount ?? min?.formattedAmount ?? "";
|
|
388
|
+
const fromPrice = isRange && discounted;
|
|
389
|
+
const ribbons = ribbonsOf(raw);
|
|
390
|
+
const hasSubscriptions = visibleSubscriptions(raw).length > 0;
|
|
391
|
+
return {
|
|
392
|
+
id: id(raw),
|
|
393
|
+
slug: raw.slug ?? "",
|
|
394
|
+
name: raw.name ?? "",
|
|
395
|
+
price,
|
|
396
|
+
maxPrice: fromPrice ? price : max?.formattedAmount ?? "",
|
|
397
|
+
fromPrice,
|
|
398
|
+
compareAtPrice: isRange ? null : strike(original ?? raw.compareAtPriceRange?.minValue, current ?? min),
|
|
399
|
+
discountNames: ((raw.discountInfo?.discountRuleNames ?? []) as unknown[]).filter((n): n is string => typeof n === "string" && n.length > 0),
|
|
400
|
+
pricePerUnit: minVariant?.physicalProperties?.pricePerUnit?.description ?? raw.physicalProperties?.pricePerUnitRange?.minValue?.description ?? null,
|
|
401
|
+
ribbon: ribbons[0] ?? null,
|
|
402
|
+
ribbons,
|
|
403
|
+
minPriceVariantId: minVariant ? id(minVariant) || minVariant.variantId || null : null,
|
|
404
|
+
availability,
|
|
405
|
+
preorder: isPreorderProduct(raw),
|
|
406
|
+
hasSubscriptions,
|
|
407
|
+
imageUrl: mainUrl,
|
|
408
|
+
hoverImageUrl: hover[0] ?? "",
|
|
409
|
+
optionsSummary: options
|
|
410
|
+
.map((o) => {
|
|
411
|
+
const n = ((o.choicesSettings?.choices ?? []) as Raw[]).filter((c) => c.visible !== false).length;
|
|
412
|
+
return `${n} ${String(o.name ?? "").toLowerCase()}${n === 1 ? "" : "s"}`;
|
|
413
|
+
})
|
|
414
|
+
.join(" · "),
|
|
415
|
+
swatches: options
|
|
416
|
+
.filter((o) => o.optionRenderType === "SWATCH_CHOICES" || o.optionRenderType === "COLOR_CHOICES")
|
|
417
|
+
.flatMap((o) => (o.choicesSettings?.choices ?? []) as Raw[])
|
|
418
|
+
.filter((c) => c.visible !== false && c.colorCode)
|
|
419
|
+
.map((c) => String(c.colorCode)),
|
|
420
|
+
// Addable in one click: no options, plainly in stock, and no plan to choose.
|
|
421
|
+
quickAddable: options.length === 0 && availability === "IN_STOCK" && !hasSubscriptions,
|
|
422
|
+
};
|
|
423
|
+
}
|
|
424
|
+
|
|
425
|
+
/**
|
|
426
|
+
* A choice's linked image. With PRODUCT_CHOICES_MEDIA_REFERENCES the choice carries
|
|
427
|
+
* `media.items[].mediaId` pointing into the product gallery; without it Wix returns the same link
|
|
428
|
+
* as the deprecated `linkedMedia` with the media object inline. Both read forms are handled.
|
|
429
|
+
*/
|
|
430
|
+
function choiceImage(c: Raw, gallery: Map<string, Raw>, imgSrc: ImgSrc | undefined): string | null {
|
|
431
|
+
if (!imgSrc) return null;
|
|
432
|
+
const ref = (c.media?.items ?? [])[0]?.mediaId;
|
|
433
|
+
const linked = (c.linkedMedia ?? [])[0];
|
|
434
|
+
const m = ref ? gallery.get(String(ref)) : linked ? (linked.image ?? linked) : null;
|
|
435
|
+
return m ? imgSrc(m, 1200, 1200) || null : null;
|
|
436
|
+
}
|
|
437
|
+
|
|
438
|
+
export function toOptions(raw: Raw, imgSrc?: ImgSrc): ProductOption[] {
|
|
439
|
+
// the gallery by item id — `id` over REST, `_id` through the SDK (both feed this mapper)
|
|
440
|
+
const gallery = new Map<string, Raw>();
|
|
441
|
+
for (const m of [raw.media?.main, ...((raw.media?.itemsInfo?.items ?? []) as Raw[])]) {
|
|
442
|
+
const key = m?._id ?? m?.id;
|
|
443
|
+
if (key) gallery.set(String(key), m.image ?? m);
|
|
444
|
+
}
|
|
445
|
+
return ((raw.options ?? []) as Raw[]).map((o) => ({
|
|
446
|
+
id: id(o) || o.name || "",
|
|
447
|
+
key: o.key ?? o.name ?? "",
|
|
448
|
+
name: o.name ?? "",
|
|
449
|
+
isColor: o.optionRenderType === "SWATCH_CHOICES" || o.optionRenderType === "COLOR_CHOICES",
|
|
450
|
+
choices: ((o.choicesSettings?.choices ?? []) as Raw[])
|
|
451
|
+
.filter((c) => c.visible !== false) // a retired choice the merchant no longer sells
|
|
452
|
+
.map((c) => ({
|
|
453
|
+
choiceId: c.choiceId ?? "",
|
|
454
|
+
key: c.key ?? c.name ?? "",
|
|
455
|
+
name: c.name ?? "",
|
|
456
|
+
colorCode: c.colorCode ?? null,
|
|
457
|
+
inStock: c.inStock !== false,
|
|
458
|
+
imageUrl: choiceImage(c, gallery, imgSrc),
|
|
459
|
+
})),
|
|
460
|
+
}));
|
|
461
|
+
}
|
|
462
|
+
|
|
463
|
+
// Mandatory unless the API says `mandatory: false` — an omitted flag is REQUIRED on Wix's own
|
|
464
|
+
// storefront. A free-text modifier is keyed by `freeTextSettings.key` (what `customTextFields`
|
|
465
|
+
// takes); a choice modifier by its own `key` (what `options` takes).
|
|
466
|
+
export function toModifiers(raw: Raw): ProductModifier[] {
|
|
467
|
+
return ((raw.modifiers ?? []) as Raw[]).map((m) => {
|
|
468
|
+
const isText = m.modifierRenderType === "FREE_TEXT";
|
|
469
|
+
const ft: Raw = m.freeTextSettings ?? {};
|
|
470
|
+
const charCount = (v: unknown): number | null => (typeof v === "number" && v > 0 ? v : null);
|
|
471
|
+
return {
|
|
472
|
+
id: id(m) || m.key || m.name || "",
|
|
473
|
+
key: isText ? ft.key ?? m.key ?? m.name ?? "" : m.key ?? m.name ?? "",
|
|
474
|
+
name: m.name ?? "",
|
|
475
|
+
mandatory: m.mandatory !== false,
|
|
476
|
+
type: isText ? ("text" as const) : ("choices" as const),
|
|
477
|
+
title: (isText ? ft.title : undefined) || m.name || "",
|
|
478
|
+
maxChars: isText ? charCount(ft.maxCharCount) : null,
|
|
479
|
+
minChars: isText ? charCount(ft.minCharCount) : null,
|
|
480
|
+
choices: ((m.choicesSettings?.choices ?? []) as Raw[]).map((c) => ({ choiceId: c.choiceId ?? "", key: c.key ?? c.name ?? "", name: c.name ?? "" })),
|
|
481
|
+
};
|
|
482
|
+
});
|
|
483
|
+
}
|
|
484
|
+
|
|
485
|
+
const FREQUENCY_WORD: Record<string, string> = { DAY: "day", WEEK: "week", MONTH: "month", YEAR: "year" };
|
|
486
|
+
|
|
487
|
+
/** "every 2 months · 6 payments" / "every month · until cancelled" from a plan's settings. */
|
|
488
|
+
export function planTerms(frequency: string | null, interval: number, billingCycles: number | null): string {
|
|
489
|
+
const parts: string[] = [];
|
|
490
|
+
const u = FREQUENCY_WORD[String(frequency ?? "")];
|
|
491
|
+
if (u) parts.push(`every ${interval > 1 ? `${interval} ${u}s` : u}`);
|
|
492
|
+
parts.push(billingCycles ? `${billingCycles} payments` : "until cancelled");
|
|
493
|
+
return parts.join(" · ");
|
|
494
|
+
}
|
|
495
|
+
|
|
496
|
+
/** The product's visible recurring plans; a plan without `billingCycles` auto-renews. */
|
|
497
|
+
export function toSubscriptionPlans(raw: Raw): SubscriptionPlan[] {
|
|
498
|
+
return visibleSubscriptions(raw).map((s) => {
|
|
499
|
+
const frequency = (["DAY", "WEEK", "MONTH", "YEAR"] as const).find((f) => f === s.frequency) ?? null;
|
|
500
|
+
const interval = typeof s.interval === "number" && s.interval > 0 ? s.interval : 1;
|
|
501
|
+
const billingCycles = s.autoRenewal === true ? null : typeof s.billingCycles === "number" && s.billingCycles > 0 ? s.billingCycles : null;
|
|
502
|
+
return { id: id(s), name: s.title ?? "", description: s.description ?? "", frequency, interval, billingCycles, terms: planTerms(frequency, interval, billingCycles) };
|
|
503
|
+
});
|
|
504
|
+
}
|
|
505
|
+
|
|
506
|
+
/**
|
|
507
|
+
* Variants keyed by optionId → choiceId (names kept for display). Buyable when in stock OR
|
|
508
|
+
* pre-orderable. `quantity`/`preorderMessage` stay null here — the Inventory Items read fills them
|
|
509
|
+
* (mergeInventory). `variant.media` is read-only on the API: Wix derives it from the media linked
|
|
510
|
+
* to the variant's choice (a product with several options derives it only when the choices
|
|
511
|
+
* agree). Mapped to a URL so a PDP can show the selected variant's picture without knowing how
|
|
512
|
+
* Wix derives it.
|
|
513
|
+
*/
|
|
514
|
+
export function toVariants(raw: Raw, imgSrc: ImgSrc): ProductVariant[] {
|
|
515
|
+
return ((raw.variantsInfo?.variants ?? []) as Raw[])
|
|
516
|
+
.filter((v) => v.visible !== false)
|
|
517
|
+
.map((v) => {
|
|
518
|
+
const choices: Record<string, string> = {};
|
|
519
|
+
const choiceIds: Record<string, string> = {};
|
|
520
|
+
for (const c of (v.choices ?? []) as Raw[]) {
|
|
521
|
+
const on = c.optionChoiceNames?.optionName, cn = c.optionChoiceNames?.choiceName;
|
|
522
|
+
if (on && cn) choices[on] = cn;
|
|
523
|
+
const oi = c.optionChoiceIds?.optionId, ci = c.optionChoiceIds?.choiceId;
|
|
524
|
+
if (oi && ci) choiceIds[oi] = ci;
|
|
525
|
+
}
|
|
526
|
+
const { current, original } = sellingPrice(v.price);
|
|
527
|
+
const vm = v.media ? (v.media.image ?? v.media) : null;
|
|
528
|
+
const subscriptionPrices: Record<string, string> = {};
|
|
529
|
+
for (const sp of (v.subscriptionPricesInfo?.subscriptionPrices ?? []) as Raw[]) {
|
|
530
|
+
const formatted = sp.priceAfterDiscount?.formattedAmount ?? sp.price?.formattedAmount;
|
|
531
|
+
if (sp.subscriptionId && formatted) subscriptionPrices[sp.subscriptionId] = formatted;
|
|
532
|
+
}
|
|
533
|
+
const amount = Number(current?.amount);
|
|
534
|
+
return {
|
|
535
|
+
variantId: id(v),
|
|
536
|
+
choiceIds,
|
|
537
|
+
choices,
|
|
538
|
+
price: current?.formattedAmount ?? "",
|
|
539
|
+
priceAmount: Number.isFinite(amount) ? amount : 0,
|
|
540
|
+
compareAtPrice: strike(original, current),
|
|
541
|
+
pricePerUnit: v.physicalProperties?.pricePerUnit?.description ?? null,
|
|
542
|
+
sku: v.sku ?? null,
|
|
543
|
+
subscriptionPrices,
|
|
544
|
+
inStock: v.inventoryStatus?.inStock !== false,
|
|
545
|
+
preorderEnabled: v.inventoryStatus?.preorderEnabled === true,
|
|
546
|
+
quantity: null,
|
|
547
|
+
preorderMessage: null,
|
|
548
|
+
imageUrl: vm ? imgSrc(vm, 1200, 1200) || null : null,
|
|
549
|
+
};
|
|
550
|
+
});
|
|
551
|
+
}
|
|
552
|
+
|
|
553
|
+
/** The product's category path and direct categories, from BREADCRUMBS_INFO / DIRECT_CATEGORIES_INFO. */
|
|
554
|
+
export function toBreadcrumbs(info: Raw | undefined): Breadcrumb[] {
|
|
555
|
+
return ((info?.breadcrumbs ?? []) as Raw[])
|
|
556
|
+
.filter((b) => b.categoryId)
|
|
557
|
+
.map((b) => ({ id: b.categoryId, name: b.categoryName ?? "", slug: b.categorySlug ?? "" }));
|
|
558
|
+
}
|
|
559
|
+
|
|
560
|
+
export function toDetail(raw: Raw, imgSrc: ImgSrc, mediaKey: MediaKey): ProductDetail {
|
|
561
|
+
const summary = toSummary(raw, imgSrc, mediaKey);
|
|
562
|
+
const variants = toVariants(raw, imgSrc);
|
|
563
|
+
// The exact range from the variants' SELLING prices (discounts applied) — the summary's range is
|
|
564
|
+
// pre-discount and had to say "From" when the cheapest variant was discounted.
|
|
565
|
+
let price = summary.price, maxPrice = summary.maxPrice, compareAtPrice = summary.compareAtPrice;
|
|
566
|
+
if (variants.length) {
|
|
567
|
+
const lo = variants.reduce((a, v) => (v.priceAmount < a.priceAmount ? v : a));
|
|
568
|
+
const hi = variants.reduce((a, v) => (v.priceAmount > a.priceAmount ? v : a));
|
|
569
|
+
price = lo.price || price;
|
|
570
|
+
maxPrice = hi.price || maxPrice;
|
|
571
|
+
compareAtPrice = price !== maxPrice ? null : lo.compareAtPrice;
|
|
572
|
+
}
|
|
573
|
+
return {
|
|
574
|
+
...summary,
|
|
575
|
+
price,
|
|
576
|
+
maxPrice,
|
|
577
|
+
fromPrice: false,
|
|
578
|
+
compareAtPrice,
|
|
579
|
+
descriptionHtml: raw.plainDescription ?? "", // an HTML string despite the name — render as HTML
|
|
580
|
+
infoSections: ((raw.infoSections ?? []) as Raw[])
|
|
581
|
+
.map((s) => ({ title: s.title ?? "", html: s.plainDescription ?? "" }))
|
|
582
|
+
.filter((s) => s.title || s.html),
|
|
583
|
+
// De-duplicated on media identity, then resolved once at one size.
|
|
584
|
+
gallery: mediaEntries(raw, mediaKey).map((m) => imgSrc(m, 1200, 1200)).filter(Boolean),
|
|
585
|
+
breadcrumbs: toBreadcrumbs(raw.breadcrumbsInfo),
|
|
586
|
+
categoryIds: ((raw.directCategoriesInfo?.categories ?? []) as Raw[]).map((c) => id(c)).filter(Boolean),
|
|
587
|
+
options: toOptions(raw, imgSrc),
|
|
588
|
+
modifiers: toModifiers(raw),
|
|
589
|
+
variants,
|
|
590
|
+
subscriptions: toSubscriptionPlans(raw),
|
|
591
|
+
allowOneTimePurchase: raw.subscriptionDetails?.allowOneTimePurchases === true,
|
|
592
|
+
};
|
|
593
|
+
}
|
|
594
|
+
|
|
595
|
+
export function toCategory(raw: Raw, imgSrc: ImgSrc): Category {
|
|
596
|
+
const parent: Raw | undefined = raw.parentCategory;
|
|
597
|
+
return {
|
|
598
|
+
id: id(raw),
|
|
599
|
+
slug: raw.slug ?? "",
|
|
600
|
+
name: raw.name ?? "",
|
|
601
|
+
description: raw.description ?? "",
|
|
602
|
+
imageUrl: imgSrc(raw.image, 1200, 1200),
|
|
603
|
+
parentId: parent ? id(parent) || null : null,
|
|
604
|
+
index: typeof parent?.index === "number" ? parent.index : 0,
|
|
605
|
+
productCount: typeof raw.itemCounter === "number" ? raw.itemCounter : null,
|
|
606
|
+
breadcrumbs: toBreadcrumbs(raw.breadcrumbsInfo),
|
|
607
|
+
};
|
|
608
|
+
}
|
|
609
|
+
|
|
610
|
+
// ---- inventory --------------------------------------------------------------------------------------
|
|
611
|
+
|
|
612
|
+
/** Inventory Items → per-variant record: a PREORDER item's remaining allowance is `preorderInfo.quantity`. */
|
|
613
|
+
export function toInventory(items: Raw[]): Record<string, VariantInventory> {
|
|
614
|
+
const out: Record<string, VariantInventory> = {};
|
|
615
|
+
for (const it of items) {
|
|
616
|
+
if (!it?.variantId) continue;
|
|
617
|
+
const status = it.availabilityStatus === "IN_STOCK" || it.availabilityStatus === "PREORDER" ? it.availabilityStatus : "OUT_OF_STOCK";
|
|
618
|
+
const tracked = it.trackQuantity === true;
|
|
619
|
+
out[it.variantId] = {
|
|
620
|
+
status,
|
|
621
|
+
quantity: tracked && typeof it.quantity === "number" ? Math.max(0, it.quantity) : null,
|
|
622
|
+
preorderQuantity: tracked && typeof it.preorderInfo?.quantity === "number" ? Math.max(0, it.preorderInfo.quantity) : null,
|
|
623
|
+
preorderMessage: it.preorderInfo?.message || null,
|
|
624
|
+
};
|
|
625
|
+
}
|
|
626
|
+
return out;
|
|
627
|
+
}
|
|
628
|
+
|
|
629
|
+
/**
|
|
630
|
+
* The variants with the default location's live inventory: status → inStock/preorderEnabled, the
|
|
631
|
+
* remaining units (`quantity`: stock, or the pre-order allowance while pre-ordering), the pre-order
|
|
632
|
+
* message. A variant without a record keeps its catalog flags.
|
|
633
|
+
*/
|
|
634
|
+
export function mergeInventory(variants: ProductVariant[], inventory: Record<string, VariantInventory>): ProductVariant[] {
|
|
635
|
+
return variants.map((v) => {
|
|
636
|
+
const inv = inventory[v.variantId];
|
|
637
|
+
if (!inv) return v;
|
|
638
|
+
const preorder = inv.status === "PREORDER";
|
|
639
|
+
return {
|
|
640
|
+
...v,
|
|
641
|
+
inStock: inv.status === "IN_STOCK",
|
|
642
|
+
preorderEnabled: preorder,
|
|
643
|
+
quantity: preorder ? inv.preorderQuantity : inv.quantity,
|
|
644
|
+
preorderMessage: preorder ? inv.preorderMessage : null,
|
|
645
|
+
};
|
|
646
|
+
});
|
|
647
|
+
}
|
|
648
|
+
|
|
649
|
+
// ---- selection rules --------------------------------------------------------------------------------
|
|
650
|
+
|
|
651
|
+
/**
|
|
652
|
+
* Resolve the variant for the buyer's selections (optionId → choiceId). A product with no options
|
|
653
|
+
* resolves to its single variant; with options every option must be selected and match. null
|
|
654
|
+
* while incomplete. Selections start EMPTY — never pre-pick a first choice.
|
|
655
|
+
*/
|
|
656
|
+
export function resolveVariant(detail: ProductDetail, selections: Record<string, string>): ProductVariant | null {
|
|
657
|
+
if (detail.options.length === 0) return detail.variants[0] ?? null;
|
|
658
|
+
if (!detail.options.every((o) => selections[o.id])) return null;
|
|
659
|
+
return detail.variants.find((v) => detail.options.every((o) => v.choiceIds[o.id] === selections[o.id])) ?? null;
|
|
660
|
+
}
|
|
661
|
+
|
|
662
|
+
/**
|
|
663
|
+
* Per-choice availability AGAINST the current selection: optionId → choiceId → { inStock, exists }.
|
|
664
|
+
* With nothing picked, a choice's catalog flag. Otherwise each choice is judged as if picked on
|
|
665
|
+
* top of the other selections: `exists` when some variant answers to that combination, `inStock`
|
|
666
|
+
* when one of those is buyable (in stock or pre-orderable). Red picked → XL greys out when Red/XL
|
|
667
|
+
* is sold out, but stays clickable elsewhere.
|
|
668
|
+
*/
|
|
669
|
+
export function choiceAvailability(detail: ProductDetail, selections: Record<string, string>): Record<string, Record<string, { inStock: boolean; exists: boolean }>> {
|
|
670
|
+
const picked = Object.entries(selections).filter(([oid, cid]) => oid && cid);
|
|
671
|
+
const out: Record<string, Record<string, { inStock: boolean; exists: boolean }>> = {};
|
|
672
|
+
for (const o of detail.options) {
|
|
673
|
+
out[o.id] = {};
|
|
674
|
+
for (const c of o.choices) {
|
|
675
|
+
if (!picked.length) {
|
|
676
|
+
out[o.id][c.choiceId] = { inStock: c.inStock, exists: true };
|
|
677
|
+
continue;
|
|
678
|
+
}
|
|
679
|
+
const candidate = [...picked.filter(([oid]) => oid !== o.id), [o.id, c.choiceId] as [string, string]];
|
|
680
|
+
let exists = false, inStock = false;
|
|
681
|
+
for (const v of detail.variants) {
|
|
682
|
+
if (!candidate.every(([oid, cid]) => v.choiceIds[oid] === cid)) continue;
|
|
683
|
+
exists = true;
|
|
684
|
+
if (v.inStock || v.preorderEnabled) { inStock = true; break; }
|
|
685
|
+
}
|
|
686
|
+
out[o.id][c.choiceId] = { inStock, exists };
|
|
687
|
+
}
|
|
688
|
+
}
|
|
689
|
+
return out;
|
|
690
|
+
}
|
|
691
|
+
|
|
692
|
+
/** Wix's storefront caps the stepper at 99999 when stock isn't counted. */
|
|
693
|
+
export const MAX_QUANTITY = 99999;
|
|
694
|
+
|
|
695
|
+
/** The most a buyer may add of a variant: its remaining units when counted (none left → the cap; the add is blocked anyway), else the cap. */
|
|
696
|
+
export function maxPurchasable(variant: ProductVariant | null): number {
|
|
697
|
+
return variant?.quantity || MAX_QUANTITY;
|
|
698
|
+
}
|