@wix/agent-skills 1.21.0 → 1.23.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/skills/wix-app/SKILL.md +71 -7
- package/skills/wix-app/references/APP_VALIDATION.md +16 -10
- package/skills/wix-app/references/DASHBOARD_PAGE.md +11 -25
- package/skills/wix-app/references/DATA_COLLECTION.md +16 -219
- package/skills/wix-app/references/SDK_MODULE_MAP.md +2 -0
- package/skills/wix-app/references/dashboard-page/DATA_SOURCES.md +182 -0
- package/skills/wix-app/references/dashboard-page/DRAFT_TEMPLATE.md +97 -0
- package/skills/wix-app/references/dashboard-page/DRAFT_TEMPLATE_COLLECTION.md +184 -0
- package/skills/wix-app/references/dashboard-page/DRAFT_TEMPLATE_ROUTER.md +203 -0
- package/skills/wix-app/references/dashboard-page/DRAFT_TEMPLATE_SETTINGS.md +44 -0
- package/skills/wix-app/references/dashboard-page/QUERY_AND_PAGING.md +182 -0
- package/skills/wix-app/references/dashboard-page/TABLE_STATE.md +133 -0
- package/skills/wix-app/references/dashboard-page/UX_SUCCESS_MODEL.md +10 -5
- package/skills/wix-app/references/data-collection/LIFECYCLE.md +68 -0
- package/skills/wix-app/references/data-collection/PERMISSIONS.md +47 -0
- package/skills/wix-app/references/data-collection/SCHEMA.md +181 -0
- package/skills/wix-app/references/data-collection/WIX_DATA.md +38 -66
- package/skills/wix-headless-fast/SKILL.md +95 -230
- package/skills/wix-headless-fast/cold-start/bootstrap.mjs +156 -0
- package/skills/wix-headless-fast/{entry/skill.md → cold-start/cold-start.md} +17 -14
- package/skills/wix-headless-fast/guides/existing-site.md +78 -0
- package/skills/wix-headless-fast/guides/migration.md +43 -0
- package/skills/wix-headless-fast/guides/reference-mode.md +100 -0
- package/skills/wix-headless-fast/install/AGENTS.md +9 -4
- package/skills/wix-headless-fast/install/agents-md.mjs +5 -1
- package/skills/wix-headless-fast/install/attach.mjs +25 -47
- package/skills/wix-headless-fast/install/check.mjs +87 -0
- package/skills/wix-headless-fast/install/context.mjs +126 -0
- package/skills/wix-headless-fast/install/deploy.mjs +106 -80
- package/skills/wix-headless-fast/install/lock.mjs +55 -0
- package/skills/wix-headless-fast/install/setup.mjs +83 -23
- package/skills/wix-headless-fast/install/templates.mjs +168 -0
- package/skills/wix-manage/SKILL.md +3 -3
- package/skills/wix-manage/references/app-installation/install-wix-apps.md +68 -2
- package/skills/wix-manage/references/contacts/bulk-label-and-unlabel-contacts.md +37 -4
- package/skills/wix-manage/references/ecommerce/ecom-pricing.md +29 -3
- package/skills/wix-manage/references/google-ads/google-ads-dashboard-navigation.md +27 -0
- package/skills/wix-manage/references/google-ads/manage-campaign-success-guide.md +83 -37
- package/skills/wix-manage/references/sites/site-import.md +101 -37
- package/skills/wix-headless-fast/references/blog/INSTRUCTIONS.md +0 -303
- package/skills/wix-headless-fast/references/blog/app/components/blog/BlogFeedView.tsx +0 -136
- package/skills/wix-headless-fast/references/blog/app/components/blog/PostView.tsx +0 -112
- package/skills/wix-headless-fast/references/blog/app/components/blog/RichContent.tsx +0 -42
- package/skills/wix-headless-fast/references/blog/app/hooks/blog/useBlogFeed.ts +0 -31
- package/skills/wix-headless-fast/references/blog/app/hooks/blog/usePost.ts +0 -22
- package/skills/wix-headless-fast/references/blog/app/wix/blog/blog-feed-store.ts +0 -137
- package/skills/wix-headless-fast/references/blog/app/wix/blog/post-store.ts +0 -78
- package/skills/wix-headless-fast/references/blog/app/wix/blog/posts-core.ts +0 -117
- package/skills/wix-headless-fast/references/blog/app/wix/blog/posts.ts +0 -52
- package/skills/wix-headless-fast/references/blog/app/wix/blog/taxonomy-core.ts +0 -47
- package/skills/wix-headless-fast/references/blog/app/wix/blog/taxonomy.ts +0 -58
- package/skills/wix-headless-fast/references/blog/app/wix/blog/types.ts +0 -62
- package/skills/wix-headless-fast/references/blog/app-astro/layouts/SiteLayout.astro +0 -40
- package/skills/wix-headless-fast/references/blog/app-astro/pages/blog/[...slug].astro +0 -97
- package/skills/wix-headless-fast/references/blog/app-astro/pages/blog.astro +0 -24
- package/skills/wix-headless-fast/references/blog/lock/astro/package-lock.json +0 -16156
- package/skills/wix-headless-fast/references/blog/rest/posts.ts +0 -42
- package/skills/wix-headless-fast/references/blog/rest/taxonomy.ts +0 -62
- package/skills/wix-headless-fast/references/blog/seed/SEED.md +0 -81
- package/skills/wix-headless-fast/references/blog/seed/read-site.mjs +0 -22
- package/skills/wix-headless-fast/references/blog/seed/seed-blog.mjs +0 -287
- package/skills/wix-headless-fast/references/bookings/INSTRUCTIONS.md +0 -277
- package/skills/wix-headless-fast/references/bookings/app/components/bookings/ServiceBookingView.tsx +0 -144
- package/skills/wix-headless-fast/references/bookings/app/components/bookings/ServicesView.tsx +0 -119
- package/skills/wix-headless-fast/references/bookings/app/hooks/bookings/useBookingFlow.ts +0 -32
- package/skills/wix-headless-fast/references/bookings/app/hooks/bookings/useServices.ts +0 -23
- package/skills/wix-headless-fast/references/bookings/app/wix/bookings/booking-core.ts +0 -218
- package/skills/wix-headless-fast/references/bookings/app/wix/bookings/booking-flow-store.ts +0 -169
- package/skills/wix-headless-fast/references/bookings/app/wix/bookings/booking.ts +0 -121
- package/skills/wix-headless-fast/references/bookings/app/wix/bookings/services-core.ts +0 -92
- package/skills/wix-headless-fast/references/bookings/app/wix/bookings/services-store.ts +0 -90
- package/skills/wix-headless-fast/references/bookings/app/wix/bookings/services.ts +0 -57
- package/skills/wix-headless-fast/references/bookings/app/wix/bookings/types.ts +0 -72
- package/skills/wix-headless-fast/references/bookings/app-astro/layouts/SiteLayout.astro +0 -40
- package/skills/wix-headless-fast/references/bookings/app-astro/pages/services/[slug].astro +0 -76
- package/skills/wix-headless-fast/references/bookings/app-astro/pages/services.astro +0 -22
- package/skills/wix-headless-fast/references/bookings/lock/astro/package-lock.json +0 -11962
- package/skills/wix-headless-fast/references/bookings/rest/booking.ts +0 -113
- package/skills/wix-headless-fast/references/bookings/rest/services.ts +0 -55
- package/skills/wix-headless-fast/references/bookings/seed/SEED.md +0 -71
- package/skills/wix-headless-fast/references/bookings/seed/read-site.mjs +0 -28
- package/skills/wix-headless-fast/references/bookings/seed/seed-bookings.mjs +0 -302
- package/skills/wix-headless-fast/references/cms/INSTRUCTIONS.md +0 -355
- package/skills/wix-headless-fast/references/cms/app/hooks/cms/useCollection.ts +0 -50
- package/skills/wix-headless-fast/references/cms/app/hooks/cms/useItem.ts +0 -37
- package/skills/wix-headless-fast/references/cms/app/wix/cms/collection-store.ts +0 -158
- package/skills/wix-headless-fast/references/cms/app/wix/cms/item-store.ts +0 -93
- package/skills/wix-headless-fast/references/cms/app/wix/cms/items-core.ts +0 -177
- package/skills/wix-headless-fast/references/cms/app/wix/cms/items.ts +0 -123
- package/skills/wix-headless-fast/references/cms/app/wix/cms/types.ts +0 -75
- package/skills/wix-headless-fast/references/cms/app-astro/layouts/SiteLayout.astro +0 -41
- package/skills/wix-headless-fast/references/cms/lock/astro/package-lock.json +0 -11262
- package/skills/wix-headless-fast/references/cms/rest/items.ts +0 -125
- package/skills/wix-headless-fast/references/cms/seed/SEED.md +0 -112
- package/skills/wix-headless-fast/references/cms/seed/read-site.mjs +0 -20
- package/skills/wix-headless-fast/references/cms/seed/seed-cms.mjs +0 -324
- package/skills/wix-headless-fast/references/events/INSTRUCTIONS.md +0 -307
- package/skills/wix-headless-fast/references/events/app/components/events/EventConfirmationView.tsx +0 -66
- package/skills/wix-headless-fast/references/events/app/components/events/EventRegistrationView.tsx +0 -178
- package/skills/wix-headless-fast/references/events/app/components/events/EventsView.tsx +0 -118
- package/skills/wix-headless-fast/references/events/app/hooks/events/useEventRegistration.ts +0 -35
- package/skills/wix-headless-fast/references/events/app/hooks/events/useEvents.ts +0 -24
- package/skills/wix-headless-fast/references/events/app/wix/events/events-core.ts +0 -130
- package/skills/wix-headless-fast/references/events/app/wix/events/events-store.ts +0 -97
- package/skills/wix-headless-fast/references/events/app/wix/events/events.ts +0 -55
- package/skills/wix-headless-fast/references/events/app/wix/events/registration-core.ts +0 -113
- package/skills/wix-headless-fast/references/events/app/wix/events/registration-store.ts +0 -156
- package/skills/wix-headless-fast/references/events/app/wix/events/registration.ts +0 -97
- package/skills/wix-headless-fast/references/events/app/wix/events/types.ts +0 -61
- package/skills/wix-headless-fast/references/events/app-astro/layouts/SiteLayout.astro +0 -40
- package/skills/wix-headless-fast/references/events/app-astro/pages/event-confirmation.astro +0 -12
- package/skills/wix-headless-fast/references/events/app-astro/pages/events/[slug].astro +0 -80
- package/skills/wix-headless-fast/references/events/app-astro/pages/events.astro +0 -21
- package/skills/wix-headless-fast/references/events/lock/astro/package-lock.json +0 -11884
- package/skills/wix-headless-fast/references/events/rest/events.ts +0 -57
- package/skills/wix-headless-fast/references/events/rest/registration.ts +0 -83
- package/skills/wix-headless-fast/references/events/seed/SEED.md +0 -95
- package/skills/wix-headless-fast/references/events/seed/read-site.mjs +0 -26
- package/skills/wix-headless-fast/references/events/seed/seed-events.mjs +0 -276
- package/skills/wix-headless-fast/references/forms/INSTRUCTIONS.md +0 -340
- package/skills/wix-headless-fast/references/forms/app/hooks/forms/useWixForm.ts +0 -85
- package/skills/wix-headless-fast/references/forms/app/wix/forms/form-store.ts +0 -332
- package/skills/wix-headless-fast/references/forms/app/wix/forms/forms-core.ts +0 -238
- package/skills/wix-headless-fast/references/forms/app/wix/forms/forms.ts +0 -54
- package/skills/wix-headless-fast/references/forms/app/wix/forms/submissions-core.ts +0 -216
- package/skills/wix-headless-fast/references/forms/app/wix/forms/submissions.ts +0 -59
- package/skills/wix-headless-fast/references/forms/app/wix/forms/types.ts +0 -135
- package/skills/wix-headless-fast/references/forms/lock/astro/package-lock.json +0 -10593
- package/skills/wix-headless-fast/references/forms/rest/forms.ts +0 -34
- package/skills/wix-headless-fast/references/forms/rest/submissions.ts +0 -56
- package/skills/wix-headless-fast/references/forms/seed/SEED.md +0 -116
- package/skills/wix-headless-fast/references/forms/seed/read-site.mjs +0 -20
- package/skills/wix-headless-fast/references/forms/seed/seed-forms.mjs +0 -327
- package/skills/wix-headless-fast/references/members/INSTRUCTIONS.md +0 -316
- package/skills/wix-headless-fast/references/members/app/components/members/AccountView.tsx +0 -60
- package/skills/wix-headless-fast/references/members/app/components/members/LoginForm.tsx +0 -155
- package/skills/wix-headless-fast/references/members/app/components/members/MemberMenu.tsx +0 -78
- package/skills/wix-headless-fast/references/members/app/components/members/RequireAuth.tsx +0 -47
- package/skills/wix-headless-fast/references/members/app/hooks/members/useMember.ts +0 -66
- package/skills/wix-headless-fast/references/members/app/wix/members/auth-core.ts +0 -105
- package/skills/wix-headless-fast/references/members/app/wix/members/auth.ts +0 -59
- package/skills/wix-headless-fast/references/members/app/wix/members/client.ts +0 -53
- package/skills/wix-headless-fast/references/members/app/wix/members/member-store.ts +0 -122
- package/skills/wix-headless-fast/references/members/app/wix/members/members-core.ts +0 -43
- package/skills/wix-headless-fast/references/members/app/wix/members/members.ts +0 -29
- package/skills/wix-headless-fast/references/members/app/wix/members/types.ts +0 -21
- package/skills/wix-headless-fast/references/members/app-astro/layouts/SiteLayout.astro +0 -42
- package/skills/wix-headless-fast/references/members/app-astro/pages/account.astro +0 -10
- package/skills/wix-headless-fast/references/members/app-astro/pages/login.astro +0 -11
- package/skills/wix-headless-fast/references/members/lock/astro/package-lock.json +0 -10329
- package/skills/wix-headless-fast/references/members/rest/auth.ts +0 -215
- package/skills/wix-headless-fast/references/members/rest/members.ts +0 -26
- package/skills/wix-headless-fast/references/members/seed/SEED.md +0 -39
- package/skills/wix-headless-fast/references/members/seed/read-site.mjs +0 -15
- package/skills/wix-headless-fast/references/members/seed/seed-members.mjs +0 -94
- package/skills/wix-headless-fast/references/portfolio/INSTRUCTIONS.md +0 -315
- package/skills/wix-headless-fast/references/portfolio/app/components/portfolio/CollectionProjectsView.tsx +0 -110
- package/skills/wix-headless-fast/references/portfolio/app/components/portfolio/CollectionsView.tsx +0 -90
- package/skills/wix-headless-fast/references/portfolio/app/components/portfolio/GalleryMedia.tsx +0 -35
- package/skills/wix-headless-fast/references/portfolio/app/components/portfolio/ProjectDetailView.tsx +0 -85
- package/skills/wix-headless-fast/references/portfolio/app/hooks/portfolio/useCollectionProjects.ts +0 -32
- package/skills/wix-headless-fast/references/portfolio/app/hooks/portfolio/useCollections.ts +0 -21
- package/skills/wix-headless-fast/references/portfolio/app/hooks/portfolio/useProjectDetail.ts +0 -31
- package/skills/wix-headless-fast/references/portfolio/app/wix/portfolio/collection-projects-store.ts +0 -82
- package/skills/wix-headless-fast/references/portfolio/app/wix/portfolio/collections-store.ts +0 -58
- package/skills/wix-headless-fast/references/portfolio/app/wix/portfolio/portfolio-core.ts +0 -177
- package/skills/wix-headless-fast/references/portfolio/app/wix/portfolio/portfolio.ts +0 -78
- package/skills/wix-headless-fast/references/portfolio/app/wix/portfolio/project-detail-store.ts +0 -81
- package/skills/wix-headless-fast/references/portfolio/app/wix/portfolio/types.ts +0 -55
- package/skills/wix-headless-fast/references/portfolio/app-astro/layouts/SiteLayout.astro +0 -40
- package/skills/wix-headless-fast/references/portfolio/app-astro/pages/portfolio/[slug].astro +0 -30
- package/skills/wix-headless-fast/references/portfolio/app-astro/pages/portfolio.astro +0 -21
- package/skills/wix-headless-fast/references/portfolio/app-astro/pages/projects/[slug].astro +0 -29
- package/skills/wix-headless-fast/references/portfolio/lock/astro/package-lock.json +0 -10197
- package/skills/wix-headless-fast/references/portfolio/rest/portfolio.ts +0 -75
- package/skills/wix-headless-fast/references/portfolio/seed/SEED.md +0 -86
- package/skills/wix-headless-fast/references/portfolio/seed/read-site.mjs +0 -20
- package/skills/wix-headless-fast/references/portfolio/seed/seed-portfolio.mjs +0 -256
- package/skills/wix-headless-fast/references/pricing-plans/INSTRUCTIONS.md +0 -296
- package/skills/wix-headless-fast/references/pricing-plans/app/components/pricing-plans/PlanDetailView.tsx +0 -47
- package/skills/wix-headless-fast/references/pricing-plans/app/components/pricing-plans/PlansView.tsx +0 -101
- package/skills/wix-headless-fast/references/pricing-plans/app/components/pricing-plans/SubscribeButton.tsx +0 -41
- package/skills/wix-headless-fast/references/pricing-plans/app/hooks/pricing-plans/usePlanPurchase.ts +0 -16
- package/skills/wix-headless-fast/references/pricing-plans/app/hooks/pricing-plans/usePlans.ts +0 -22
- package/skills/wix-headless-fast/references/pricing-plans/app/wix/pricing-plans/plan-purchase-store.ts +0 -54
- package/skills/wix-headless-fast/references/pricing-plans/app/wix/pricing-plans/plans-core.ts +0 -106
- package/skills/wix-headless-fast/references/pricing-plans/app/wix/pricing-plans/plans-store.ts +0 -64
- package/skills/wix-headless-fast/references/pricing-plans/app/wix/pricing-plans/plans.ts +0 -27
- package/skills/wix-headless-fast/references/pricing-plans/app/wix/pricing-plans/purchase-core.ts +0 -43
- package/skills/wix-headless-fast/references/pricing-plans/app/wix/pricing-plans/purchase.ts +0 -22
- package/skills/wix-headless-fast/references/pricing-plans/app/wix/pricing-plans/types.ts +0 -30
- package/skills/wix-headless-fast/references/pricing-plans/app-astro/layouts/SiteLayout.astro +0 -41
- package/skills/wix-headless-fast/references/pricing-plans/app-astro/pages/plans/[slug].astro +0 -40
- package/skills/wix-headless-fast/references/pricing-plans/app-astro/pages/plans.astro +0 -21
- package/skills/wix-headless-fast/references/pricing-plans/lock/astro/package-lock.json +0 -11226
- package/skills/wix-headless-fast/references/pricing-plans/rest/plans.ts +0 -31
- package/skills/wix-headless-fast/references/pricing-plans/rest/purchase.ts +0 -20
- package/skills/wix-headless-fast/references/pricing-plans/seed/SEED.md +0 -79
- package/skills/wix-headless-fast/references/pricing-plans/seed/read-site.mjs +0 -21
- package/skills/wix-headless-fast/references/pricing-plans/seed/seed-pricing-plans.mjs +0 -279
- package/skills/wix-headless-fast/references/restaurants/INSTRUCTIONS.md +0 -360
- package/skills/wix-headless-fast/references/restaurants/app/components/restaurants/MenuView.tsx +0 -142
- package/skills/wix-headless-fast/references/restaurants/app/components/restaurants/OrderCartButton.tsx +0 -26
- package/skills/wix-headless-fast/references/restaurants/app/components/restaurants/OrderCartDrawer.tsx +0 -121
- package/skills/wix-headless-fast/references/restaurants/app/components/restaurants/ReservationView.tsx +0 -155
- package/skills/wix-headless-fast/references/restaurants/app/hooks/restaurants/useMenus.ts +0 -34
- package/skills/wix-headless-fast/references/restaurants/app/hooks/restaurants/useOrderCart.ts +0 -43
- package/skills/wix-headless-fast/references/restaurants/app/hooks/restaurants/useReservation.ts +0 -34
- package/skills/wix-headless-fast/references/restaurants/app/wix/restaurants/menu-core.ts +0 -155
- package/skills/wix-headless-fast/references/restaurants/app/wix/restaurants/menu-store.ts +0 -89
- package/skills/wix-headless-fast/references/restaurants/app/wix/restaurants/menu.ts +0 -71
- package/skills/wix-headless-fast/references/restaurants/app/wix/restaurants/order-store.ts +0 -103
- package/skills/wix-headless-fast/references/restaurants/app/wix/restaurants/ordering-core.ts +0 -124
- package/skills/wix-headless-fast/references/restaurants/app/wix/restaurants/ordering.ts +0 -185
- package/skills/wix-headless-fast/references/restaurants/app/wix/restaurants/reservation-store.ts +0 -193
- package/skills/wix-headless-fast/references/restaurants/app/wix/restaurants/reservations-core.ts +0 -94
- package/skills/wix-headless-fast/references/restaurants/app/wix/restaurants/reservations.ts +0 -74
- package/skills/wix-headless-fast/references/restaurants/app/wix/restaurants/types.ts +0 -168
- package/skills/wix-headless-fast/references/restaurants/app-astro/layouts/SiteLayout.astro +0 -47
- package/skills/wix-headless-fast/references/restaurants/app-astro/pages/menu.astro +0 -22
- package/skills/wix-headless-fast/references/restaurants/app-astro/pages/reservations.astro +0 -12
- package/skills/wix-headless-fast/references/restaurants/lock/astro/package-lock.json +0 -12560
- package/skills/wix-headless-fast/references/restaurants/rest/menu.ts +0 -60
- package/skills/wix-headless-fast/references/restaurants/rest/ordering.ts +0 -169
- package/skills/wix-headless-fast/references/restaurants/rest/reservations.ts +0 -68
- package/skills/wix-headless-fast/references/restaurants/seed/SEED.md +0 -89
- package/skills/wix-headless-fast/references/restaurants/seed/read-site.mjs +0 -25
- package/skills/wix-headless-fast/references/restaurants/seed/seed-restaurants.mjs +0 -499
- package/skills/wix-headless-fast/references/shared/CONTENT.md +0 -22
- package/skills/wix-headless-fast/references/shared/CUSTOM_OPERATIONS.md +0 -73
- package/skills/wix-headless-fast/references/shared/DESIGN.md +0 -26
- package/skills/wix-headless-fast/references/shared/SUPPLIED-CONTENT.md +0 -23
- package/skills/wix-headless-fast/references/shared/app/styles/global.css +0 -52
- package/skills/wix-headless-fast/references/shared/app/wix/config.ts +0 -15
- package/skills/wix-headless-fast/references/shared/app/wix/media.ts +0 -81
- package/skills/wix-headless-fast/references/shared/app/wix/money.ts +0 -24
- package/skills/wix-headless-fast/references/shared/app/wix/sdk.ts +0 -89
- package/skills/wix-headless-fast/references/shared/capabilities/media-upload/app/wix/media-upload/client.ts +0 -46
- package/skills/wix-headless-fast/references/shared/capabilities/media-upload/app-astro/pages/api/wix/media-upload.ts +0 -46
- package/skills/wix-headless-fast/references/shared/rest/client.ts +0 -155
- package/skills/wix-headless-fast/references/shared/rest/config.ts +0 -3
- package/skills/wix-headless-fast/references/shared/rest/media.ts +0 -65
- package/skills/wix-headless-fast/references/shared/seed/images.mjs +0 -145
- package/skills/wix-headless-fast/references/shared/seed/read-site.mjs +0 -99
- package/skills/wix-headless-fast/references/storefront/INSTRUCTIONS.md +0 -612
- package/skills/wix-headless-fast/references/storefront/app/components/storefront/CartButton.tsx +0 -26
- package/skills/wix-headless-fast/references/storefront/app/components/storefront/CartDrawer.tsx +0 -155
- package/skills/wix-headless-fast/references/storefront/app/components/storefront/FilterPanel.tsx +0 -266
- package/skills/wix-headless-fast/references/storefront/app/components/storefront/OptionPicker.tsx +0 -95
- package/skills/wix-headless-fast/references/storefront/app/components/storefront/QuickAdd.tsx +0 -136
- package/skills/wix-headless-fast/references/storefront/app/hooks/storefront/useCart.ts +0 -48
- package/skills/wix-headless-fast/references/storefront/app/hooks/storefront/useProductDetail.ts +0 -39
- package/skills/wix-headless-fast/references/storefront/app/hooks/storefront/useShop.ts +0 -34
- package/skills/wix-headless-fast/references/storefront/app/wix/storefront/cart-core.ts +0 -121
- package/skills/wix-headless-fast/references/storefront/app/wix/storefront/cart-store.ts +0 -107
- package/skills/wix-headless-fast/references/storefront/app/wix/storefront/cart.ts +0 -138
- package/skills/wix-headless-fast/references/storefront/app/wix/storefront/catalog-core.ts +0 -314
- package/skills/wix-headless-fast/references/storefront/app/wix/storefront/catalog.ts +0 -133
- package/skills/wix-headless-fast/references/storefront/app/wix/storefront/product-detail-store.ts +0 -147
- package/skills/wix-headless-fast/references/storefront/app/wix/storefront/shop-store.ts +0 -289
- package/skills/wix-headless-fast/references/storefront/app/wix/storefront/types.ts +0 -169
- package/skills/wix-headless-fast/references/storefront/app-astro/layouts/SiteLayout.astro +0 -65
- package/skills/wix-headless-fast/references/storefront/lock/astro/package-lock.json +0 -12247
- package/skills/wix-headless-fast/references/storefront/rest/cart.ts +0 -132
- package/skills/wix-headless-fast/references/storefront/rest/catalog.ts +0 -123
- package/skills/wix-headless-fast/references/storefront/seed/SEED.md +0 -130
- package/skills/wix-headless-fast/references/storefront/seed/read-site.mjs +0 -38
- package/skills/wix-headless-fast/references/storefront/seed/seed-store.mjs +0 -561
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
// Event reads over REST — the twin of app/wix/events/events.ts. Same exports, same DTOs; the rules
|
|
2
|
-
// and mappers come from events-core (the SAME file the SDK transport uses, deployed flat next to
|
|
3
|
-
// this one by deploy.mjs --stack static), so this file is only the transport: one fetch with a
|
|
4
|
-
// literal body per function. Every call here is safe from a browser with a visitor token.
|
|
5
|
-
// Porting: keep the paths, keep the bodies, port the core once.
|
|
6
|
-
// docs: https://dev.wix.com/docs/api-reference/business-solutions/events/event-management/events-v3/query-events.md
|
|
7
|
-
// docs: https://dev.wix.com/docs/api-reference/business-solutions/events/event-management/events-v3/get-event-by-slug.md
|
|
8
|
-
// docs: https://dev.wix.com/docs/api-reference/business-solutions/events/event-management/events-v3/get-event.md
|
|
9
|
-
import { WixApiError, wixRequest } from "./client.js";
|
|
10
|
-
import { imgSrc } from "./media.js";
|
|
11
|
-
import { DETAIL_FIELDS, EVENTS_APP_ID, LIST_FIELDS, listQuery, rawId, toDetail, toSummary, type Raw } from "./events-core.js";
|
|
12
|
-
import type { EventDetail, EventSummary } from "./types.js";
|
|
13
|
-
|
|
14
|
-
export { EVENTS_APP_ID };
|
|
15
|
-
|
|
16
|
-
const notFound = (e: unknown): boolean => e instanceof WixApiError && e.status === 404;
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* Live (UPCOMING/STARTED) events, soonest first. The limit is always sent: `paging.limit`
|
|
20
|
-
* defaults to 0 and a bare query answers `total: N, events: []` with no error.
|
|
21
|
-
* POST /events/v3/events/query { query: { filter: { status: { $in } }, sort, paging: { limit } }, fields }
|
|
22
|
-
*/
|
|
23
|
-
export async function fetchEvents({ limit = 100 } = {}): Promise<EventSummary[]> {
|
|
24
|
-
const res = await wixRequest<Raw>("/events/v3/events/query", { body: { query: listQuery({ limit }), fields: LIST_FIELDS } });
|
|
25
|
-
return ((res?.events ?? []) as Raw[]).map((e) => toSummary(e, imgSrc));
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
/**
|
|
29
|
-
* One event by URL slug; null when the slug doesn't resolve (EVENT_NOT_FOUND, 404) — a real 404,
|
|
30
|
-
* never a fallback to another event. The response is WRAPPED: { event }.
|
|
31
|
-
* GET /events/v3/events/slug/{slug}?fields=DETAILS&fields=TEXTS&fields=REGISTRATION&fields=URLS&fields=CATEGORIES
|
|
32
|
-
*/
|
|
33
|
-
export async function fetchEventBySlug(slug: string): Promise<EventDetail | null> {
|
|
34
|
-
try {
|
|
35
|
-
const res = await wixRequest<Raw>(`/events/v3/events/slug/${encodeURIComponent(slug)}`, { method: "GET", query: { fields: DETAIL_FIELDS } });
|
|
36
|
-
return res?.event ? toDetail(res.event, imgSrc) : null;
|
|
37
|
-
} catch (e) {
|
|
38
|
-
if (notFound(e)) return null;
|
|
39
|
-
throw e;
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
/**
|
|
44
|
-
* One event by id — the post-checkout confirmation read (the thank-you URL carries
|
|
45
|
-
* `?orderNumber=&eventId=`). On REST this response is WRAPPED too: { event } (the SDK's getEvent
|
|
46
|
-
* is the unwrapped one). GET /events/v3/events/{eventId}?fields=…
|
|
47
|
-
*/
|
|
48
|
-
export async function fetchEventById(eventId: string): Promise<EventDetail | null> {
|
|
49
|
-
try {
|
|
50
|
-
const res = await wixRequest<Raw>(`/events/v3/events/${encodeURIComponent(eventId)}`, { method: "GET", query: { fields: DETAIL_FIELDS } });
|
|
51
|
-
const raw: Raw | undefined = res?.event;
|
|
52
|
-
return raw && rawId(raw) ? toDetail(raw, imgSrc) : null;
|
|
53
|
-
} catch (e) {
|
|
54
|
-
if (notFound(e)) return null;
|
|
55
|
-
throw e;
|
|
56
|
-
}
|
|
57
|
-
}
|
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
// Ticket tiers, the reserve → hosted-checkout redirect, and RSVP over REST — the twin of
|
|
2
|
-
// app/wix/events/registration.ts. Same exports, same DTOs; rules and mappers from
|
|
3
|
-
// registration-core (the SAME file the SDK transport uses, deployed flat next to this one). The
|
|
4
|
-
// request shapes are exact and rewriting them is how registrations break. Failures are loud.
|
|
5
|
-
// All calls run with the visitor token — the reservation and the RSVP are the token's.
|
|
6
|
-
// docs: https://dev.wix.com/docs/api-reference/business-solutions/events/registration/ticketing/orders/query-available-tickets.md
|
|
7
|
-
// docs: https://dev.wix.com/docs/api-reference/business-solutions/events/registration/ticketing/ticket-reservations/create-ticket-reservation.md
|
|
8
|
-
// docs: https://dev.wix.com/docs/api-reference/business-solutions/events/registration/rsvp-v2/create-rsvp.md
|
|
9
|
-
// docs: https://dev.wix.com/docs/api-reference/business-management/headless/redirects/create-redirect-session.md
|
|
10
|
-
import { wixRequest } from "./client.js";
|
|
11
|
-
import {
|
|
12
|
-
checkoutCallbacks,
|
|
13
|
-
redirectResult,
|
|
14
|
-
reservationError,
|
|
15
|
-
reservationId,
|
|
16
|
-
reservationTickets,
|
|
17
|
-
rsvpBody,
|
|
18
|
-
rsvpResult,
|
|
19
|
-
toTiers,
|
|
20
|
-
type CheckoutEvent,
|
|
21
|
-
type CheckoutPaths,
|
|
22
|
-
} from "./registration-core.js";
|
|
23
|
-
import type { Raw } from "./events-core.js";
|
|
24
|
-
import type { RegistrationResult, TicketTier } from "./types.js";
|
|
25
|
-
|
|
26
|
-
export { type CheckoutPaths };
|
|
27
|
-
|
|
28
|
-
/**
|
|
29
|
-
* Ticket tiers for a TICKETING event, in display order — the VISITOR-public storefront read, never
|
|
30
|
-
* the ticket-definitions management API (403 for a visitor). `limit` is REQUIRED: it defaults to 0
|
|
31
|
-
* and returns metadata only. POST /events/v1/checkout/available-tickets/query { filter: { eventId }, limit }
|
|
32
|
-
*/
|
|
33
|
-
export async function fetchTicketTiers(eventId: string): Promise<TicketTier[]> {
|
|
34
|
-
const res = await wixRequest<Raw>("/events/v1/checkout/available-tickets/query", { body: { filter: { eventId }, limit: 100 } });
|
|
35
|
-
return toTiers(res?.definitions);
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
/**
|
|
39
|
-
* RSVP to a free (RSVP-type) event — completes fully client-side: no reservation, no redirect, no
|
|
40
|
-
* payment. The form is BUILT-IN: exactly firstName + lastName + email. "NO" only when the event's
|
|
41
|
-
* rsvpResponseType is "YES_AND_NO". Throws on closed registration, a guest limit, or an invalid
|
|
42
|
-
* email — surface the message (a repeat email is accepted by default). A full event with a waitlist
|
|
43
|
-
* answers "WAITLIST".
|
|
44
|
-
* POST /events/v2/rsvps { rsvp: { eventId, firstName, lastName, email, status } } → { rsvp: { id, status } }
|
|
45
|
-
*/
|
|
46
|
-
export async function submitRsvp(
|
|
47
|
-
eventId: string,
|
|
48
|
-
guest: { firstName: string; lastName: string; email: string },
|
|
49
|
-
status: "YES" | "NO" = "YES",
|
|
50
|
-
): Promise<RegistrationResult> {
|
|
51
|
-
const res = await wixRequest<Raw>("/events/v2/rsvps", { body: { rsvp: rsvpBody(eventId, guest, status) } });
|
|
52
|
-
return rsvpResult(res?.rsvp, status);
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
/**
|
|
56
|
-
* Ticketed checkout, the exact sequence: reserve the selected tiers (a PENDING hold that
|
|
57
|
-
* auto-expires), then mint the Wix-hosted checkout redirect and return its URL — the caller
|
|
58
|
-
* navigates the FULL document to it; Wix collects guest details + payment and emails the tickets.
|
|
59
|
-
* `origin` must be the site's real https origin as registered on the OAuth app's allowed domains
|
|
60
|
-
* (browser: window.location.origin). Never hand-build the checkout URL. `paths` overrides the
|
|
61
|
-
* return routes — a static site passes `{ confirmation: "/event-confirmation.html", event: "/event.html?slug=…" }`.
|
|
62
|
-
* POST /events/v1/ticket-reservations { ticketReservation: { tickets: [{ ticketDefinitionId, quantity }] } } → { ticketReservation: { id, status: "PENDING", expirationDate } }
|
|
63
|
-
* POST /headless/v1/redirect-session { eventsCheckout: { reservationId, eventSlug }, callbacks: { thankYouPageUrl, postFlowUrl } }
|
|
64
|
-
*/
|
|
65
|
-
export async function startTicketCheckout(
|
|
66
|
-
event: CheckoutEvent,
|
|
67
|
-
selections: { tierId: string; quantity: number }[],
|
|
68
|
-
paths: CheckoutPaths = {},
|
|
69
|
-
origin: string = typeof window !== "undefined" ? window.location.origin : "",
|
|
70
|
-
): Promise<RegistrationResult> {
|
|
71
|
-
const tickets = reservationTickets(selections);
|
|
72
|
-
let reservation: Raw | undefined;
|
|
73
|
-
try {
|
|
74
|
-
// Until the site has a premium plan AND a payment method this is a 403 NO_PAYMENT_METHOD_CONFIGURED — a business gate, not a bug.
|
|
75
|
-
reservation = (await wixRequest<Raw>("/events/v1/ticket-reservations", { body: { ticketReservation: { tickets } } }))?.ticketReservation;
|
|
76
|
-
} catch (e) {
|
|
77
|
-
throw reservationError(e);
|
|
78
|
-
}
|
|
79
|
-
const session = await wixRequest<Raw>("/headless/v1/redirect-session", {
|
|
80
|
-
body: { eventsCheckout: { reservationId: reservationId(reservation), eventSlug: event.slug }, callbacks: checkoutCallbacks(origin, event.slug, paths) },
|
|
81
|
-
});
|
|
82
|
-
return redirectResult(session);
|
|
83
|
-
}
|
|
@@ -1,95 +0,0 @@
|
|
|
1
|
-
# Events — seeding
|
|
2
|
-
|
|
3
|
-
Seed by **running `seed-events.mjs` with a plan file** — don't hand-write the REST calls.
|
|
4
|
-
The script mints its own site token via the Wix CLI (logged-in session + `wix.config.json`
|
|
5
|
-
required), installs the Wix Events app if needed, resolves the site currency, and creates
|
|
6
|
-
everything in the one order that works (create DRAFT → tiers → publish — the registration
|
|
7
|
-
type is immutable and publishing is one-way).
|
|
8
|
-
|
|
9
|
-
```bash
|
|
10
|
-
# from the project root (where wix.config.json lives):
|
|
11
|
-
node <SKILL_ROOT>/references/events/seed/seed-events.mjs plan.json
|
|
12
|
-
```
|
|
13
|
-
|
|
14
|
-
`plan.json` is plain data — write it from the brief. **Default to 3 events** (the seed shows
|
|
15
|
-
the shape; the owner adds the rest in the dashboard) and make them exercise the UI: mix
|
|
16
|
-
`TICKETING` and `RSVP` (≥1 of each), give a ticketed event 2 tiers, and give every event an
|
|
17
|
-
image (an events page without images looks broken) — the default is an `imagePrompt`
|
|
18
|
-
(AI-generated, ~1 Wix AI credit per image, account-billed): brand-contextual — subject,
|
|
19
|
-
aesthetic/mood, palette, lighting — always ending "no text, no watermarks". At least one image in the set shows the real subject of the business — the actual product/space/service, not abstract decoration. For an asset the user actually
|
|
20
|
-
supplied use `imagePath` (a file on this machine — uploaded to Wix Media) or `imageUrl`
|
|
21
|
-
(their own hosted URL; verify it with `curl -sI` → 200) — never a stock-photo or guessed URL. Images resolve in parallel and never block the
|
|
22
|
-
seed; a failed image leaves that event text-only.
|
|
23
|
-
|
|
24
|
-
```json
|
|
25
|
-
{
|
|
26
|
-
"events": [
|
|
27
|
-
{ "type": "TICKETING", "title": "Summer Synth Festival",
|
|
28
|
-
"shortDescription": "One night of analog sound under the stars.",
|
|
29
|
-
"startDate": "2026-11-07T03:30:00.000Z", "endDate": "2026-11-07T07:00:00.000Z",
|
|
30
|
-
"timeZoneId": "America/Los_Angeles",
|
|
31
|
-
"location": { "name": "The Echo Lot", "type": "VENUE",
|
|
32
|
-
"address": { "addressLine": "120 Harbor St", "city": "Seattle", "subdivision": "US-WA", "postalCode": "98101", "country": "US" } },
|
|
33
|
-
"ticketTiers": [
|
|
34
|
-
{ "name": "General Admission", "price": "45.00", "initialLimit": 200 },
|
|
35
|
-
{ "name": "Front Row", "price": "85.00", "description": "First two rows.", "initialLimit": 40 }
|
|
36
|
-
],
|
|
37
|
-
"category": "Concerts", "imageUrl": "https://…" },
|
|
38
|
-
{ "type": "TICKETING", "title": "Vinyl Mixing Workshop",
|
|
39
|
-
"shortDescription": "Hands-on turntable session, decks provided.",
|
|
40
|
-
"startDate": "2026-11-14T18:00:00.000Z", "endDate": "2026-11-14T20:00:00.000Z",
|
|
41
|
-
"timeZoneId": "America/Los_Angeles",
|
|
42
|
-
"location": { "name": "Studio B", "type": "VENUE",
|
|
43
|
-
"address": { "addressLine": "9 Pine Ave", "city": "Seattle", "subdivision": "US-WA", "postalCode": "98101", "country": "US" } },
|
|
44
|
-
"ticketTiers": [{ "name": "Workshop Seat", "price": "30.00", "initialLimit": 16 }],
|
|
45
|
-
"category": "Workshops", "imageUrl": "https://…" },
|
|
46
|
-
{ "type": "RSVP", "title": "Community Listening Night",
|
|
47
|
-
"shortDescription": "Free open-deck evening — bring a record.",
|
|
48
|
-
"startDate": "2026-11-20T19:00:00.000Z", "endDate": "2026-11-20T22:00:00.000Z",
|
|
49
|
-
"timeZoneId": "America/Los_Angeles",
|
|
50
|
-
"location": { "name": "The Back Room", "type": "VENUE",
|
|
51
|
-
"address": { "addressLine": "120 Harbor St", "city": "Seattle", "subdivision": "US-WA", "postalCode": "98101", "country": "US" } },
|
|
52
|
-
"category": "Community", "imageUrl": "https://…" }
|
|
53
|
-
]
|
|
54
|
-
}
|
|
55
|
-
```
|
|
56
|
-
|
|
57
|
-
- `type` — `TICKETING` (paid tiers; buyers pay on Wix's hosted checkout) or `RSVP` (free;
|
|
58
|
-
the built-in name+email form — seed NO form fields). **Immutable after create** — decide
|
|
59
|
-
from the brief, never plan to convert.
|
|
60
|
-
- **Dates are future ISO-8601 UTC** (`…Z`), `endDate` after `startDate`, `timeZoneId` an
|
|
61
|
-
IANA tz. A past event isn't registerable and won't show in the live listing; no date in
|
|
62
|
-
the brief → default ~60–90 days out and say so.
|
|
63
|
-
- `ticketTiers` — TICKETING only, created before publish. `price` is a **decimal STRING**
|
|
64
|
-
(`"45.00"`, never a number), `name` ≤ 30 chars, omit `initialLimit` for unlimited. Tier
|
|
65
|
-
currency is the site currency (resolved automatically).
|
|
66
|
-
- `location` — `{ name, type: "VENUE", address }` (address `subdivision` is ISO-3166-2 like
|
|
67
|
-
`US-WA`, `country` ISO alpha-2), `{ name, type: "ONLINE" }`, or
|
|
68
|
-
`{ locationTbd: true, name }`.
|
|
69
|
-
- `category` — a name; created and assigned for you. Skip when the brief has no grouping.
|
|
70
|
-
- `rsvpResponseType` — `"YES_AND_NO"` to let guests decline (default `"YES_ONLY"`).
|
|
71
|
-
|
|
72
|
-
The result JSON carries a `notes` array — when any event is ticketed it reminds that
|
|
73
|
-
**completing a paid purchase needs a premium plan + a configured payment method** in the
|
|
74
|
-
dashboard. That's an owner step, not a seeding failure; relay it.
|
|
75
|
-
|
|
76
|
-
**Seeding is additive — never delete or overwrite existing content**; ask first if a cleanup
|
|
77
|
-
seems needed.
|
|
78
|
-
|
|
79
|
-
## Supplied content
|
|
80
|
-
|
|
81
|
-
The general rules are in `references/shared/SUPPLIED-CONTENT.md`. For events, each event the user
|
|
82
|
-
lists is one entry. Its title becomes `title`; its date and time become `startDate` and `endDate` in
|
|
83
|
-
ISO with the `timeZoneId` the user stated; the venue and address become `location`; named tickets
|
|
84
|
-
with prices become `ticketTiers` on a `TICKETING` event, and an event with no tickets is `RSVP`; a
|
|
85
|
-
category becomes `category`; their image becomes `imageUrl`. A date without a year or without a
|
|
86
|
-
time zone is a question for the user, never a guess.
|
|
87
|
-
|
|
88
|
-
## Escape hatch — individual functions
|
|
89
|
-
`setupEvents` composes exported steps — `installEventsApp`, `getSiteCurrency`, `createEvent`,
|
|
90
|
-
`createTicketTiers`, `publishEvent`, `createEventCategories`, `assignEventsToCategory`,
|
|
91
|
-
`importImage`, `setEventMainImage`, plus `makeCtx()` — import them only for a partial re-seed.
|
|
92
|
-
|
|
93
|
-
## Reference
|
|
94
|
-
Unexpected shape or an uncovered operation → read the live Wix API reference; the
|
|
95
|
-
authoritative source recipe is `wix-headless/references/inline-recipes/setup-events.md`.
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
// What the events site holds: events and their ticket definitions.
|
|
2
|
-
// node <SKILL_ROOT>/references/events/seed/read-site.mjs [--site <siteId>] [--limit <n>]
|
|
3
|
-
import { runReader } from "../../shared/seed/read-site.mjs";
|
|
4
|
-
|
|
5
|
-
const EVENTS_APP_ID = "140603ad-af8d-84a5-2c80-a0f60cb47351";
|
|
6
|
-
const D = "https://dev.wix.com/docs/api-reference/business-solutions/events/event-management";
|
|
7
|
-
|
|
8
|
-
await runReader({
|
|
9
|
-
vertical: "events",
|
|
10
|
-
appId: EVENTS_APP_ID,
|
|
11
|
-
async read(api, { limit }) {
|
|
12
|
-
const ev = await api.call({ path: "/events/v3/events/query", body: { query: { filter: { status: { $ne: "CANCELED" } }, paging: { limit } }, fields: ["DETAILS", "REGISTRATION"] }, docs: `${D}/events-v3/query-events` });
|
|
13
|
-
const td = await api.tryCall({ path: "/events-ticket-definitions/v3/ticket-definitions/query", body: { query: { paging: { limit: 100 } } }, docs: `${D}/ticket-definitions-v3/query-ticket-definitions` });
|
|
14
|
-
const defs = td?.ticketDefinitions ?? [];
|
|
15
|
-
return {
|
|
16
|
-
eventCount: ev.pagingMetadata?.total ?? (ev.events ?? []).length,
|
|
17
|
-
events: (ev.events ?? []).map((e) => ({
|
|
18
|
-
title: e.title, slug: e.slug, status: e.status, start: e.dateAndTimeSettings?.startDate ?? null,
|
|
19
|
-
location: e.location?.name ?? e.location?.type ?? null, registration: e.registration?.type ?? null,
|
|
20
|
-
tickets: defs.filter((d) => d.eventId === e.id).map((d) => `${d.name}${d.pricingMethod?.fixedPrice?.formattedValue ? " " + d.pricingMethod.fixedPrice.formattedValue : ""}`),
|
|
21
|
-
image: !!e.mainImage,
|
|
22
|
-
})),
|
|
23
|
-
ticketDefinitionCount: defs.length,
|
|
24
|
-
};
|
|
25
|
-
},
|
|
26
|
-
});
|
|
@@ -1,276 +0,0 @@
|
|
|
1
|
-
// Events seed — a BUILD-TIME script, never shipped in the app. Run from the project root
|
|
2
|
-
// (where wix.config.json lives) with a plan file:
|
|
3
|
-
//
|
|
4
|
-
// node <SKILL_ROOT>/references/events/seed/seed-events.mjs plan.json
|
|
5
|
-
//
|
|
6
|
-
// It mints its own site token via the Wix CLI, installs the Wix Events app if needed,
|
|
7
|
-
// resolves the site currency, then per event: create DRAFT → (TICKETING) add ticket tiers →
|
|
8
|
-
// publish — the order two one-way constraints force (registration.initialType is immutable
|
|
9
|
-
// after create; publishing is one-way). Then it creates + assigns categories and
|
|
10
|
-
// imports+attaches images. Prints a JSON result to stdout.
|
|
11
|
-
//
|
|
12
|
-
// Plan shape (see SEED.md):
|
|
13
|
-
// { "events": [{ "title", "shortDescription"?, "type": "TICKETING"|"RSVP",
|
|
14
|
-
// "startDate", "endDate" (future ISO-8601 UTC), "timeZoneId",
|
|
15
|
-
// "location" ({name,type:"VENUE",address} | {name,type:"ONLINE"} | {locationTbd:true,name}),
|
|
16
|
-
// "ticketTiers"?: [{ "name" (≤30 chars), "price" (decimal STRING), "description"?, "initialLimit"? }],
|
|
17
|
-
// "category"? (name), "imageUrl"? | "imagePrompt"?, "rsvpResponseType"? }] }
|
|
18
|
-
//
|
|
19
|
-
// Seeding is ADDITIVE — never deletes or overwrites existing content. Unexpected shapes →
|
|
20
|
-
// read the live API reference; authoritative source recipe:
|
|
21
|
-
// wix-headless/references/inline-recipes/setup-events.md.
|
|
22
|
-
import { execFileSync } from "node:child_process";
|
|
23
|
-
import { readFileSync } from "node:fs";
|
|
24
|
-
import { resolveItemImages } from "../../shared/seed/images.mjs";
|
|
25
|
-
|
|
26
|
-
const API = "https://www.wixapis.com";
|
|
27
|
-
const EVENTS_APP_ID = "140603ad-af8d-84a5-2c80-a0f60cb47351";
|
|
28
|
-
|
|
29
|
-
export function makeCtx({ cwd = process.cwd() } = {}) {
|
|
30
|
-
const config = JSON.parse(readFileSync(`${cwd}/wix.config.json`, "utf8"));
|
|
31
|
-
const siteId = config.siteId ?? config.projectId;
|
|
32
|
-
if (!siteId) throw new Error("wix.config.json has no siteId — is this a Wix CLI project?");
|
|
33
|
-
const token = execFileSync("npx", ["@wix/cli@latest", "token", "--site", siteId], {
|
|
34
|
-
encoding: "utf8",
|
|
35
|
-
cwd,
|
|
36
|
-
}).trim();
|
|
37
|
-
if (!token) throw new Error("The Wix CLI returned no token — run `npx @wix/cli@latest login` first.");
|
|
38
|
-
return { token, siteId };
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
async function req(ctx, path, { method = "POST", body } = {}) {
|
|
42
|
-
const res = await fetch(API + path, {
|
|
43
|
-
method,
|
|
44
|
-
headers: {
|
|
45
|
-
Authorization: `Bearer ${ctx.token}`,
|
|
46
|
-
"wix-site-id": ctx.siteId,
|
|
47
|
-
"Content-Type": "application/json",
|
|
48
|
-
},
|
|
49
|
-
body: body ? JSON.stringify(body) : undefined,
|
|
50
|
-
});
|
|
51
|
-
const json = await res.json().catch(() => ({}));
|
|
52
|
-
if (!res.ok) throw new Error(`${method} ${path} -> ${res.status}: ${JSON.stringify(json).slice(0, 400)}`);
|
|
53
|
-
return json;
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
// {type:"TICKETING"|"RSVP", …} -> the registration block. TICKETING carries a tickets{}
|
|
57
|
-
// config; RSVP carries rsvp{responseType} and seeds NO form fields (name+email is built-in).
|
|
58
|
-
// initialType is IMMUTABLE after create — set from the plan, never plan to convert.
|
|
59
|
-
function buildRegistration(ev) {
|
|
60
|
-
if (ev.type === "TICKETING") {
|
|
61
|
-
return {
|
|
62
|
-
initialType: "TICKETING",
|
|
63
|
-
tickets: {
|
|
64
|
-
ticketLimitPerOrder: ev.ticketLimitPerOrder ?? 8,
|
|
65
|
-
currency: ev.currency ?? "USD", // setupEvents threads the site currency; USD is the last resort
|
|
66
|
-
reservationDurationInMinutes: ev.reservationDurationInMinutes ?? 20,
|
|
67
|
-
},
|
|
68
|
-
};
|
|
69
|
-
}
|
|
70
|
-
return {
|
|
71
|
-
initialType: "RSVP",
|
|
72
|
-
rsvp: { responseType: ev.rsvpResponseType ?? "YES_ONLY" }, // "YES_ONLY" | "YES_AND_NO"
|
|
73
|
-
};
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
// ---- operations ----------------------------------------------------------------------------------
|
|
77
|
-
|
|
78
|
-
// Idempotent: re-installing an already-installed app returns 200.
|
|
79
|
-
// docs: https://dev.wix.com/docs/api-reference/articles/work-with-wix-apis/platform/about-apps-created-by-wix.md
|
|
80
|
-
export async function installEventsApp(ctx) {
|
|
81
|
-
try {
|
|
82
|
-
await req(ctx, "/apps-installer-service/v1/app-instance/install", { body: {
|
|
83
|
-
tenant: { tenantType: "SITE", id: ctx.siteId },
|
|
84
|
-
appInstance: { appDefId: EVENTS_APP_ID, enabled: true },
|
|
85
|
-
} });
|
|
86
|
-
} catch {
|
|
87
|
-
/* already installed is fine */
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
// The ticket-definitions API REQUIRES currency and uses whatever you pass verbatim (it does
|
|
92
|
-
// NOT fall back to the site currency) — resolve it once, or a non-USD site gets mis-priced.
|
|
93
|
-
// docs: https://dev.wix.com/docs/api-reference/business-management/site-properties/properties/get-site-properties.md
|
|
94
|
-
export async function getSiteCurrency(ctx) {
|
|
95
|
-
try {
|
|
96
|
-
const r = await req(ctx, "/site-properties/v4/properties", { method: "GET" });
|
|
97
|
-
return r?.properties?.paymentCurrency || "USD";
|
|
98
|
-
} catch {
|
|
99
|
-
return "USD";
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
/**
|
|
104
|
-
* STEP 1 — create ONE event as a draft (no bulk endpoint; loop for multiple). Dates MUST be
|
|
105
|
-
* in the future — a past event isn't registerable and won't show in the live listing.
|
|
106
|
-
* Returns { id, slug } — id feeds the tier/publish steps; slug is the URL identifier.
|
|
107
|
-
* docs: https://dev.wix.com/docs/api-reference/business-solutions/events/event-management/events-v3/create-event.md
|
|
108
|
-
*/
|
|
109
|
-
export async function createEvent(ctx, ev) {
|
|
110
|
-
const body = {
|
|
111
|
-
draft: true,
|
|
112
|
-
event: {
|
|
113
|
-
title: ev.title,
|
|
114
|
-
shortDescription: ev.shortDescription,
|
|
115
|
-
location: ev.location,
|
|
116
|
-
dateAndTimeSettings: {
|
|
117
|
-
startDate: ev.startDate,
|
|
118
|
-
endDate: ev.endDate,
|
|
119
|
-
timeZoneId: ev.timeZoneId,
|
|
120
|
-
showTimeZone: ev.showTimeZone ?? true,
|
|
121
|
-
},
|
|
122
|
-
registration: buildRegistration(ev),
|
|
123
|
-
},
|
|
124
|
-
fields: ["DETAILS", "TEXTS", "REGISTRATION", "URLS"],
|
|
125
|
-
};
|
|
126
|
-
const r = await req(ctx, "/events/v3/events", { body });
|
|
127
|
-
return { id: r.event?.id, slug: r.event?.slug };
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
/**
|
|
131
|
-
* STEP 2 — ticket tiers for a TICKETING event (skip for RSVP). Must run BEFORE publish —
|
|
132
|
-
* publishing a ticketed event with no tiers ships an event with nothing to buy, and there is
|
|
133
|
-
* no un-publish. price is a decimal STRING ("65.00", never a number); name ≤ 30 chars; omit
|
|
134
|
-
* initialLimit for unlimited. Tiers are independent — fired as one parallel batch.
|
|
135
|
-
* docs: https://dev.wix.com/docs/api-reference/business-solutions/events/event-management/ticket-definitions-v3/create-ticket-definition.md
|
|
136
|
-
*/
|
|
137
|
-
export async function createTicketTiers(ctx, eventId, tiers) {
|
|
138
|
-
return Promise.all(tiers.map(async (t) => {
|
|
139
|
-
const body = {
|
|
140
|
-
ticketDefinition: {
|
|
141
|
-
eventId,
|
|
142
|
-
name: t.name,
|
|
143
|
-
description: t.description,
|
|
144
|
-
...(t.initialLimit != null ? { initialLimit: t.initialLimit } : {}),
|
|
145
|
-
pricingMethod: { fixedPrice: { value: String(t.price), currency: t.currency ?? "USD" } },
|
|
146
|
-
feeType: t.feeType ?? "FEE_INCLUDED",
|
|
147
|
-
},
|
|
148
|
-
fields: ["SALES_DETAILS"],
|
|
149
|
-
};
|
|
150
|
-
const r = await req(ctx, "/events/v3/ticket-definitions", { body });
|
|
151
|
-
return { id: r.ticketDefinition?.id };
|
|
152
|
-
}));
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
// STEP 3 — publish (one-way; for TICKETING only after its tiers exist).
|
|
156
|
-
// docs: https://dev.wix.com/docs/api-reference/business-solutions/events/event-management/events-v3/publish-draft-event.md
|
|
157
|
-
export async function publishEvent(ctx, eventId) {
|
|
158
|
-
return req(ctx, `/events/v3/events/${eventId}/publish`, { body: {} });
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
// STEP 4 (optional) — group events by a format/track. Categories are the v1 API (NOT v3).
|
|
162
|
-
// docs: https://dev.wix.com/docs/api-reference/business-solutions/events/event-management/categories/create-category.md
|
|
163
|
-
export async function createEventCategories(ctx, names) {
|
|
164
|
-
const out = [];
|
|
165
|
-
for (const name of names) {
|
|
166
|
-
const r = await req(ctx, "/events/v1/categories", { body: { category: { name } } });
|
|
167
|
-
out.push({ id: r.category?.id, name });
|
|
168
|
-
}
|
|
169
|
-
return out;
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
// Assign events to a category. Path is /{categoryId}/events (NOT /assign); body key is
|
|
173
|
-
// `eventId` — an ARRAY despite the singular name.
|
|
174
|
-
// docs: https://dev.wix.com/docs/api-reference/business-solutions/events/event-management/categories/assign-events.md
|
|
175
|
-
export async function assignEventsToCategory(ctx, categoryId, eventIds) {
|
|
176
|
-
return req(ctx, `/events/v1/categories/${categoryId}/events`, { body: { eventId: eventIds } });
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
// Events binds mainImage by Wix Media file ID — an external url must be imported first
|
|
180
|
-
// (a raw url as the id stores 200 but renders nothing); a plan `imagePrompt` is generated
|
|
181
|
-
// (Wix AI, 1 credit) then imported. Both live in the shared util (parallel, resilient,
|
|
182
|
-
// never blocks the seed).
|
|
183
|
-
export { importImage } from "../../shared/seed/images.mjs";
|
|
184
|
-
|
|
185
|
-
// mainImage is an Image OBJECT; height/width are REQUIRED or it won't render. Events V3 uses
|
|
186
|
-
// NO revision — partial PATCH keyed by event.id. Works before OR after publish.
|
|
187
|
-
// docs: https://dev.wix.com/docs/api-reference/business-solutions/events/event-management/events-v3/update-event.md
|
|
188
|
-
export async function setEventMainImage(ctx, it) {
|
|
189
|
-
return req(ctx, `/events/v3/events/${it.eventId}`, {
|
|
190
|
-
method: "PATCH",
|
|
191
|
-
body: {
|
|
192
|
-
event: {
|
|
193
|
-
id: it.eventId,
|
|
194
|
-
mainImage: { id: it.id, url: it.url, height: it.height ?? 1024, width: it.width ?? 1024, altText: it.altText },
|
|
195
|
-
},
|
|
196
|
-
fields: ["DETAILS"], // mainImage reads back only under DETAILS
|
|
197
|
-
},
|
|
198
|
-
});
|
|
199
|
-
}
|
|
200
|
-
|
|
201
|
-
/**
|
|
202
|
-
* ONE-CALL seed: install → site currency → per event create DRAFT → tiers → publish →
|
|
203
|
-
* categories → images, ids threaded in memory. The default path.
|
|
204
|
-
*/
|
|
205
|
-
export async function setupEvents(ctx, { events = [] } = {}) {
|
|
206
|
-
await installEventsApp(ctx);
|
|
207
|
-
const siteCurrency = await getSiteCurrency(ctx);
|
|
208
|
-
|
|
209
|
-
const created = [];
|
|
210
|
-
for (const ev of events) {
|
|
211
|
-
const e = await createEvent(ctx, { ...ev, currency: ev.currency ?? siteCurrency });
|
|
212
|
-
if (!e.id) throw new Error(`Event "${ev.title}" was not created — no id returned.`);
|
|
213
|
-
const tiers = ev.type === "TICKETING" && ev.ticketTiers?.length
|
|
214
|
-
? await createTicketTiers(ctx, e.id, ev.ticketTiers.map((t) => ({ ...t, currency: t.currency ?? siteCurrency })))
|
|
215
|
-
: [];
|
|
216
|
-
await publishEvent(ctx, e.id);
|
|
217
|
-
created.push({ ...e, category: ev.category, imageUrl: ev.imageUrl, imagePrompt: ev.imagePrompt, ticketCount: tiers.length });
|
|
218
|
-
}
|
|
219
|
-
|
|
220
|
-
const names = [...new Set(created.map((e) => e.category).filter(Boolean))];
|
|
221
|
-
const categories = names.length ? await createEventCategories(ctx, names) : [];
|
|
222
|
-
for (const c of categories) {
|
|
223
|
-
const eventIds = created.filter((e) => e.category === c.name).map((e) => e.id);
|
|
224
|
-
if (eventIds.length) await assignEventsToCategory(ctx, c.id, eventIds);
|
|
225
|
-
}
|
|
226
|
-
|
|
227
|
-
// Pass 2 — images: resolve (import by url / generate by prompt) in one parallel wave, then
|
|
228
|
-
// attach. Failures leave the event text-only; the seed's exit never depends on images.
|
|
229
|
-
const files = await resolveItemImages(ctx, created.map((e) => ({
|
|
230
|
-
url: e.imageUrl,
|
|
231
|
-
path: e.imagePath,
|
|
232
|
-
prompt: e.imagePrompt,
|
|
233
|
-
displayName: `${e.slug || "event"}.png`,
|
|
234
|
-
})));
|
|
235
|
-
let imagesAttached = 0;
|
|
236
|
-
for (let i = 0; i < created.length; i++) {
|
|
237
|
-
const e = created[i];
|
|
238
|
-
if (!files[i]) continue;
|
|
239
|
-
try {
|
|
240
|
-
await setEventMainImage(ctx, { eventId: e.id, id: files[i].id, url: files[i].url, height: 1024, width: 1024, altText: e.slug });
|
|
241
|
-
imagesAttached++;
|
|
242
|
-
} catch {
|
|
243
|
-
/* never block on image failure — the event stays text-only */
|
|
244
|
-
}
|
|
245
|
-
}
|
|
246
|
-
|
|
247
|
-
return {
|
|
248
|
-
events: created.map((e) => ({ id: e.id, slug: e.slug, ticketCount: e.ticketCount, category: e.category ?? null })),
|
|
249
|
-
categories,
|
|
250
|
-
imagesAttached,
|
|
251
|
-
// Completing a PAID purchase needs a premium plan + a configured payment method in the
|
|
252
|
-
// dashboard — not a seeding failure; surface it to the owner. Free/RSVP need neither.
|
|
253
|
-
notes: created.some((e) => e.ticketCount > 0)
|
|
254
|
-
? ["Paid tickets require a premium plan + a configured payment method in the dashboard to complete a purchase."]
|
|
255
|
-
: [],
|
|
256
|
-
};
|
|
257
|
-
}
|
|
258
|
-
|
|
259
|
-
// ---- CLI entry ----------------------------------------------------------------------------------
|
|
260
|
-
|
|
261
|
-
const invokedDirectly = process.argv[1] && import.meta.url.endsWith(process.argv[1].split("/").pop());
|
|
262
|
-
if (invokedDirectly) {
|
|
263
|
-
const planPath = process.argv[2];
|
|
264
|
-
if (!planPath) {
|
|
265
|
-
console.error("usage: node seed-events.mjs <plan.json> (run from the project root)");
|
|
266
|
-
process.exit(1);
|
|
267
|
-
}
|
|
268
|
-
const plan = JSON.parse(readFileSync(planPath, "utf8"));
|
|
269
|
-
const ctx = makeCtx();
|
|
270
|
-
setupEvents(ctx, plan)
|
|
271
|
-
.then((result) => console.log(JSON.stringify(result, null, 2)))
|
|
272
|
-
.catch((e) => {
|
|
273
|
-
console.error(e.message);
|
|
274
|
-
process.exit(1);
|
|
275
|
-
});
|
|
276
|
-
}
|