@wix/agent-skills 1.21.0 → 1.22.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/skills/wix-app/SKILL.md +60 -4
- package/skills/wix-app/references/DASHBOARD_PAGE.md +11 -25
- package/skills/wix-app/references/DATA_COLLECTION.md +16 -219
- package/skills/wix-app/references/dashboard-page/DATA_SOURCES.md +182 -0
- package/skills/wix-app/references/dashboard-page/DRAFT_TEMPLATE.md +97 -0
- package/skills/wix-app/references/dashboard-page/DRAFT_TEMPLATE_COLLECTION.md +184 -0
- package/skills/wix-app/references/dashboard-page/DRAFT_TEMPLATE_ROUTER.md +203 -0
- package/skills/wix-app/references/dashboard-page/DRAFT_TEMPLATE_SETTINGS.md +44 -0
- package/skills/wix-app/references/dashboard-page/QUERY_AND_PAGING.md +182 -0
- package/skills/wix-app/references/dashboard-page/TABLE_STATE.md +133 -0
- package/skills/wix-app/references/dashboard-page/UX_SUCCESS_MODEL.md +10 -5
- package/skills/wix-app/references/data-collection/LIFECYCLE.md +68 -0
- package/skills/wix-app/references/data-collection/PERMISSIONS.md +47 -0
- package/skills/wix-app/references/data-collection/SCHEMA.md +181 -0
- package/skills/wix-app/references/data-collection/WIX_DATA.md +38 -66
- package/skills/wix-headless-fast/SKILL.md +61 -223
- package/skills/wix-headless-fast/cold-start/bootstrap.mjs +156 -0
- package/skills/wix-headless-fast/{entry/skill.md → cold-start/cold-start.md} +11 -12
- package/skills/wix-headless-fast/guides/existing-site.md +76 -0
- package/skills/wix-headless-fast/guides/reference-mode.md +97 -0
- package/skills/wix-headless-fast/install/AGENTS.md +6 -3
- package/skills/wix-headless-fast/install/attach.mjs +15 -47
- package/skills/wix-headless-fast/install/deploy.mjs +21 -60
- package/skills/wix-headless-fast/install/lock.mjs +55 -0
- package/skills/wix-headless-fast/install/setup.mjs +32 -12
- package/skills/wix-headless-fast/install/templates.mjs +168 -0
- package/skills/wix-manage/references/google-ads/google-ads-dashboard-navigation.md +27 -0
- package/skills/wix-manage/references/google-ads/manage-campaign-success-guide.md +83 -37
- package/skills/wix-headless-fast/references/blog/INSTRUCTIONS.md +0 -303
- package/skills/wix-headless-fast/references/blog/app/components/blog/BlogFeedView.tsx +0 -136
- package/skills/wix-headless-fast/references/blog/app/components/blog/PostView.tsx +0 -112
- package/skills/wix-headless-fast/references/blog/app/components/blog/RichContent.tsx +0 -42
- package/skills/wix-headless-fast/references/blog/app/hooks/blog/useBlogFeed.ts +0 -31
- package/skills/wix-headless-fast/references/blog/app/hooks/blog/usePost.ts +0 -22
- package/skills/wix-headless-fast/references/blog/app/wix/blog/blog-feed-store.ts +0 -137
- package/skills/wix-headless-fast/references/blog/app/wix/blog/post-store.ts +0 -78
- package/skills/wix-headless-fast/references/blog/app/wix/blog/posts-core.ts +0 -117
- package/skills/wix-headless-fast/references/blog/app/wix/blog/posts.ts +0 -52
- package/skills/wix-headless-fast/references/blog/app/wix/blog/taxonomy-core.ts +0 -47
- package/skills/wix-headless-fast/references/blog/app/wix/blog/taxonomy.ts +0 -58
- package/skills/wix-headless-fast/references/blog/app/wix/blog/types.ts +0 -62
- package/skills/wix-headless-fast/references/blog/app-astro/layouts/SiteLayout.astro +0 -40
- package/skills/wix-headless-fast/references/blog/app-astro/pages/blog/[...slug].astro +0 -97
- package/skills/wix-headless-fast/references/blog/app-astro/pages/blog.astro +0 -24
- package/skills/wix-headless-fast/references/blog/lock/astro/package-lock.json +0 -16156
- package/skills/wix-headless-fast/references/blog/rest/posts.ts +0 -42
- package/skills/wix-headless-fast/references/blog/rest/taxonomy.ts +0 -62
- package/skills/wix-headless-fast/references/blog/seed/SEED.md +0 -81
- package/skills/wix-headless-fast/references/blog/seed/read-site.mjs +0 -22
- package/skills/wix-headless-fast/references/blog/seed/seed-blog.mjs +0 -287
- package/skills/wix-headless-fast/references/bookings/INSTRUCTIONS.md +0 -277
- package/skills/wix-headless-fast/references/bookings/app/components/bookings/ServiceBookingView.tsx +0 -144
- package/skills/wix-headless-fast/references/bookings/app/components/bookings/ServicesView.tsx +0 -119
- package/skills/wix-headless-fast/references/bookings/app/hooks/bookings/useBookingFlow.ts +0 -32
- package/skills/wix-headless-fast/references/bookings/app/hooks/bookings/useServices.ts +0 -23
- package/skills/wix-headless-fast/references/bookings/app/wix/bookings/booking-core.ts +0 -218
- package/skills/wix-headless-fast/references/bookings/app/wix/bookings/booking-flow-store.ts +0 -169
- package/skills/wix-headless-fast/references/bookings/app/wix/bookings/booking.ts +0 -121
- package/skills/wix-headless-fast/references/bookings/app/wix/bookings/services-core.ts +0 -92
- package/skills/wix-headless-fast/references/bookings/app/wix/bookings/services-store.ts +0 -90
- package/skills/wix-headless-fast/references/bookings/app/wix/bookings/services.ts +0 -57
- package/skills/wix-headless-fast/references/bookings/app/wix/bookings/types.ts +0 -72
- package/skills/wix-headless-fast/references/bookings/app-astro/layouts/SiteLayout.astro +0 -40
- package/skills/wix-headless-fast/references/bookings/app-astro/pages/services/[slug].astro +0 -76
- package/skills/wix-headless-fast/references/bookings/app-astro/pages/services.astro +0 -22
- package/skills/wix-headless-fast/references/bookings/lock/astro/package-lock.json +0 -11962
- package/skills/wix-headless-fast/references/bookings/rest/booking.ts +0 -113
- package/skills/wix-headless-fast/references/bookings/rest/services.ts +0 -55
- package/skills/wix-headless-fast/references/bookings/seed/SEED.md +0 -71
- package/skills/wix-headless-fast/references/bookings/seed/read-site.mjs +0 -28
- package/skills/wix-headless-fast/references/bookings/seed/seed-bookings.mjs +0 -302
- package/skills/wix-headless-fast/references/cms/INSTRUCTIONS.md +0 -355
- package/skills/wix-headless-fast/references/cms/app/hooks/cms/useCollection.ts +0 -50
- package/skills/wix-headless-fast/references/cms/app/hooks/cms/useItem.ts +0 -37
- package/skills/wix-headless-fast/references/cms/app/wix/cms/collection-store.ts +0 -158
- package/skills/wix-headless-fast/references/cms/app/wix/cms/item-store.ts +0 -93
- package/skills/wix-headless-fast/references/cms/app/wix/cms/items-core.ts +0 -177
- package/skills/wix-headless-fast/references/cms/app/wix/cms/items.ts +0 -123
- package/skills/wix-headless-fast/references/cms/app/wix/cms/types.ts +0 -75
- package/skills/wix-headless-fast/references/cms/app-astro/layouts/SiteLayout.astro +0 -41
- package/skills/wix-headless-fast/references/cms/lock/astro/package-lock.json +0 -11262
- package/skills/wix-headless-fast/references/cms/rest/items.ts +0 -125
- package/skills/wix-headless-fast/references/cms/seed/SEED.md +0 -112
- package/skills/wix-headless-fast/references/cms/seed/read-site.mjs +0 -20
- package/skills/wix-headless-fast/references/cms/seed/seed-cms.mjs +0 -324
- package/skills/wix-headless-fast/references/events/INSTRUCTIONS.md +0 -307
- package/skills/wix-headless-fast/references/events/app/components/events/EventConfirmationView.tsx +0 -66
- package/skills/wix-headless-fast/references/events/app/components/events/EventRegistrationView.tsx +0 -178
- package/skills/wix-headless-fast/references/events/app/components/events/EventsView.tsx +0 -118
- package/skills/wix-headless-fast/references/events/app/hooks/events/useEventRegistration.ts +0 -35
- package/skills/wix-headless-fast/references/events/app/hooks/events/useEvents.ts +0 -24
- package/skills/wix-headless-fast/references/events/app/wix/events/events-core.ts +0 -130
- package/skills/wix-headless-fast/references/events/app/wix/events/events-store.ts +0 -97
- package/skills/wix-headless-fast/references/events/app/wix/events/events.ts +0 -55
- package/skills/wix-headless-fast/references/events/app/wix/events/registration-core.ts +0 -113
- package/skills/wix-headless-fast/references/events/app/wix/events/registration-store.ts +0 -156
- package/skills/wix-headless-fast/references/events/app/wix/events/registration.ts +0 -97
- package/skills/wix-headless-fast/references/events/app/wix/events/types.ts +0 -61
- package/skills/wix-headless-fast/references/events/app-astro/layouts/SiteLayout.astro +0 -40
- package/skills/wix-headless-fast/references/events/app-astro/pages/event-confirmation.astro +0 -12
- package/skills/wix-headless-fast/references/events/app-astro/pages/events/[slug].astro +0 -80
- package/skills/wix-headless-fast/references/events/app-astro/pages/events.astro +0 -21
- package/skills/wix-headless-fast/references/events/lock/astro/package-lock.json +0 -11884
- package/skills/wix-headless-fast/references/events/rest/events.ts +0 -57
- package/skills/wix-headless-fast/references/events/rest/registration.ts +0 -83
- package/skills/wix-headless-fast/references/events/seed/SEED.md +0 -95
- package/skills/wix-headless-fast/references/events/seed/read-site.mjs +0 -26
- package/skills/wix-headless-fast/references/events/seed/seed-events.mjs +0 -276
- package/skills/wix-headless-fast/references/forms/INSTRUCTIONS.md +0 -340
- package/skills/wix-headless-fast/references/forms/app/hooks/forms/useWixForm.ts +0 -85
- package/skills/wix-headless-fast/references/forms/app/wix/forms/form-store.ts +0 -332
- package/skills/wix-headless-fast/references/forms/app/wix/forms/forms-core.ts +0 -238
- package/skills/wix-headless-fast/references/forms/app/wix/forms/forms.ts +0 -54
- package/skills/wix-headless-fast/references/forms/app/wix/forms/submissions-core.ts +0 -216
- package/skills/wix-headless-fast/references/forms/app/wix/forms/submissions.ts +0 -59
- package/skills/wix-headless-fast/references/forms/app/wix/forms/types.ts +0 -135
- package/skills/wix-headless-fast/references/forms/lock/astro/package-lock.json +0 -10593
- package/skills/wix-headless-fast/references/forms/rest/forms.ts +0 -34
- package/skills/wix-headless-fast/references/forms/rest/submissions.ts +0 -56
- package/skills/wix-headless-fast/references/forms/seed/SEED.md +0 -116
- package/skills/wix-headless-fast/references/forms/seed/read-site.mjs +0 -20
- package/skills/wix-headless-fast/references/forms/seed/seed-forms.mjs +0 -327
- package/skills/wix-headless-fast/references/members/INSTRUCTIONS.md +0 -316
- package/skills/wix-headless-fast/references/members/app/components/members/AccountView.tsx +0 -60
- package/skills/wix-headless-fast/references/members/app/components/members/LoginForm.tsx +0 -155
- package/skills/wix-headless-fast/references/members/app/components/members/MemberMenu.tsx +0 -78
- package/skills/wix-headless-fast/references/members/app/components/members/RequireAuth.tsx +0 -47
- package/skills/wix-headless-fast/references/members/app/hooks/members/useMember.ts +0 -66
- package/skills/wix-headless-fast/references/members/app/wix/members/auth-core.ts +0 -105
- package/skills/wix-headless-fast/references/members/app/wix/members/auth.ts +0 -59
- package/skills/wix-headless-fast/references/members/app/wix/members/client.ts +0 -53
- package/skills/wix-headless-fast/references/members/app/wix/members/member-store.ts +0 -122
- package/skills/wix-headless-fast/references/members/app/wix/members/members-core.ts +0 -43
- package/skills/wix-headless-fast/references/members/app/wix/members/members.ts +0 -29
- package/skills/wix-headless-fast/references/members/app/wix/members/types.ts +0 -21
- package/skills/wix-headless-fast/references/members/app-astro/layouts/SiteLayout.astro +0 -42
- package/skills/wix-headless-fast/references/members/app-astro/pages/account.astro +0 -10
- package/skills/wix-headless-fast/references/members/app-astro/pages/login.astro +0 -11
- package/skills/wix-headless-fast/references/members/lock/astro/package-lock.json +0 -10329
- package/skills/wix-headless-fast/references/members/rest/auth.ts +0 -215
- package/skills/wix-headless-fast/references/members/rest/members.ts +0 -26
- package/skills/wix-headless-fast/references/members/seed/SEED.md +0 -39
- package/skills/wix-headless-fast/references/members/seed/read-site.mjs +0 -15
- package/skills/wix-headless-fast/references/members/seed/seed-members.mjs +0 -94
- package/skills/wix-headless-fast/references/portfolio/INSTRUCTIONS.md +0 -315
- package/skills/wix-headless-fast/references/portfolio/app/components/portfolio/CollectionProjectsView.tsx +0 -110
- package/skills/wix-headless-fast/references/portfolio/app/components/portfolio/CollectionsView.tsx +0 -90
- package/skills/wix-headless-fast/references/portfolio/app/components/portfolio/GalleryMedia.tsx +0 -35
- package/skills/wix-headless-fast/references/portfolio/app/components/portfolio/ProjectDetailView.tsx +0 -85
- package/skills/wix-headless-fast/references/portfolio/app/hooks/portfolio/useCollectionProjects.ts +0 -32
- package/skills/wix-headless-fast/references/portfolio/app/hooks/portfolio/useCollections.ts +0 -21
- package/skills/wix-headless-fast/references/portfolio/app/hooks/portfolio/useProjectDetail.ts +0 -31
- package/skills/wix-headless-fast/references/portfolio/app/wix/portfolio/collection-projects-store.ts +0 -82
- package/skills/wix-headless-fast/references/portfolio/app/wix/portfolio/collections-store.ts +0 -58
- package/skills/wix-headless-fast/references/portfolio/app/wix/portfolio/portfolio-core.ts +0 -177
- package/skills/wix-headless-fast/references/portfolio/app/wix/portfolio/portfolio.ts +0 -78
- package/skills/wix-headless-fast/references/portfolio/app/wix/portfolio/project-detail-store.ts +0 -81
- package/skills/wix-headless-fast/references/portfolio/app/wix/portfolio/types.ts +0 -55
- package/skills/wix-headless-fast/references/portfolio/app-astro/layouts/SiteLayout.astro +0 -40
- package/skills/wix-headless-fast/references/portfolio/app-astro/pages/portfolio/[slug].astro +0 -30
- package/skills/wix-headless-fast/references/portfolio/app-astro/pages/portfolio.astro +0 -21
- package/skills/wix-headless-fast/references/portfolio/app-astro/pages/projects/[slug].astro +0 -29
- package/skills/wix-headless-fast/references/portfolio/lock/astro/package-lock.json +0 -10197
- package/skills/wix-headless-fast/references/portfolio/rest/portfolio.ts +0 -75
- package/skills/wix-headless-fast/references/portfolio/seed/SEED.md +0 -86
- package/skills/wix-headless-fast/references/portfolio/seed/read-site.mjs +0 -20
- package/skills/wix-headless-fast/references/portfolio/seed/seed-portfolio.mjs +0 -256
- package/skills/wix-headless-fast/references/pricing-plans/INSTRUCTIONS.md +0 -296
- package/skills/wix-headless-fast/references/pricing-plans/app/components/pricing-plans/PlanDetailView.tsx +0 -47
- package/skills/wix-headless-fast/references/pricing-plans/app/components/pricing-plans/PlansView.tsx +0 -101
- package/skills/wix-headless-fast/references/pricing-plans/app/components/pricing-plans/SubscribeButton.tsx +0 -41
- package/skills/wix-headless-fast/references/pricing-plans/app/hooks/pricing-plans/usePlanPurchase.ts +0 -16
- package/skills/wix-headless-fast/references/pricing-plans/app/hooks/pricing-plans/usePlans.ts +0 -22
- package/skills/wix-headless-fast/references/pricing-plans/app/wix/pricing-plans/plan-purchase-store.ts +0 -54
- package/skills/wix-headless-fast/references/pricing-plans/app/wix/pricing-plans/plans-core.ts +0 -106
- package/skills/wix-headless-fast/references/pricing-plans/app/wix/pricing-plans/plans-store.ts +0 -64
- package/skills/wix-headless-fast/references/pricing-plans/app/wix/pricing-plans/plans.ts +0 -27
- package/skills/wix-headless-fast/references/pricing-plans/app/wix/pricing-plans/purchase-core.ts +0 -43
- package/skills/wix-headless-fast/references/pricing-plans/app/wix/pricing-plans/purchase.ts +0 -22
- package/skills/wix-headless-fast/references/pricing-plans/app/wix/pricing-plans/types.ts +0 -30
- package/skills/wix-headless-fast/references/pricing-plans/app-astro/layouts/SiteLayout.astro +0 -41
- package/skills/wix-headless-fast/references/pricing-plans/app-astro/pages/plans/[slug].astro +0 -40
- package/skills/wix-headless-fast/references/pricing-plans/app-astro/pages/plans.astro +0 -21
- package/skills/wix-headless-fast/references/pricing-plans/lock/astro/package-lock.json +0 -11226
- package/skills/wix-headless-fast/references/pricing-plans/rest/plans.ts +0 -31
- package/skills/wix-headless-fast/references/pricing-plans/rest/purchase.ts +0 -20
- package/skills/wix-headless-fast/references/pricing-plans/seed/SEED.md +0 -79
- package/skills/wix-headless-fast/references/pricing-plans/seed/read-site.mjs +0 -21
- package/skills/wix-headless-fast/references/pricing-plans/seed/seed-pricing-plans.mjs +0 -279
- package/skills/wix-headless-fast/references/restaurants/INSTRUCTIONS.md +0 -360
- package/skills/wix-headless-fast/references/restaurants/app/components/restaurants/MenuView.tsx +0 -142
- package/skills/wix-headless-fast/references/restaurants/app/components/restaurants/OrderCartButton.tsx +0 -26
- package/skills/wix-headless-fast/references/restaurants/app/components/restaurants/OrderCartDrawer.tsx +0 -121
- package/skills/wix-headless-fast/references/restaurants/app/components/restaurants/ReservationView.tsx +0 -155
- package/skills/wix-headless-fast/references/restaurants/app/hooks/restaurants/useMenus.ts +0 -34
- package/skills/wix-headless-fast/references/restaurants/app/hooks/restaurants/useOrderCart.ts +0 -43
- package/skills/wix-headless-fast/references/restaurants/app/hooks/restaurants/useReservation.ts +0 -34
- package/skills/wix-headless-fast/references/restaurants/app/wix/restaurants/menu-core.ts +0 -155
- package/skills/wix-headless-fast/references/restaurants/app/wix/restaurants/menu-store.ts +0 -89
- package/skills/wix-headless-fast/references/restaurants/app/wix/restaurants/menu.ts +0 -71
- package/skills/wix-headless-fast/references/restaurants/app/wix/restaurants/order-store.ts +0 -103
- package/skills/wix-headless-fast/references/restaurants/app/wix/restaurants/ordering-core.ts +0 -124
- package/skills/wix-headless-fast/references/restaurants/app/wix/restaurants/ordering.ts +0 -185
- package/skills/wix-headless-fast/references/restaurants/app/wix/restaurants/reservation-store.ts +0 -193
- package/skills/wix-headless-fast/references/restaurants/app/wix/restaurants/reservations-core.ts +0 -94
- package/skills/wix-headless-fast/references/restaurants/app/wix/restaurants/reservations.ts +0 -74
- package/skills/wix-headless-fast/references/restaurants/app/wix/restaurants/types.ts +0 -168
- package/skills/wix-headless-fast/references/restaurants/app-astro/layouts/SiteLayout.astro +0 -47
- package/skills/wix-headless-fast/references/restaurants/app-astro/pages/menu.astro +0 -22
- package/skills/wix-headless-fast/references/restaurants/app-astro/pages/reservations.astro +0 -12
- package/skills/wix-headless-fast/references/restaurants/lock/astro/package-lock.json +0 -12560
- package/skills/wix-headless-fast/references/restaurants/rest/menu.ts +0 -60
- package/skills/wix-headless-fast/references/restaurants/rest/ordering.ts +0 -169
- package/skills/wix-headless-fast/references/restaurants/rest/reservations.ts +0 -68
- package/skills/wix-headless-fast/references/restaurants/seed/SEED.md +0 -89
- package/skills/wix-headless-fast/references/restaurants/seed/read-site.mjs +0 -25
- package/skills/wix-headless-fast/references/restaurants/seed/seed-restaurants.mjs +0 -499
- package/skills/wix-headless-fast/references/shared/CONTENT.md +0 -22
- package/skills/wix-headless-fast/references/shared/CUSTOM_OPERATIONS.md +0 -73
- package/skills/wix-headless-fast/references/shared/DESIGN.md +0 -26
- package/skills/wix-headless-fast/references/shared/SUPPLIED-CONTENT.md +0 -23
- package/skills/wix-headless-fast/references/shared/app/styles/global.css +0 -52
- package/skills/wix-headless-fast/references/shared/app/wix/config.ts +0 -15
- package/skills/wix-headless-fast/references/shared/app/wix/media.ts +0 -81
- package/skills/wix-headless-fast/references/shared/app/wix/money.ts +0 -24
- package/skills/wix-headless-fast/references/shared/app/wix/sdk.ts +0 -89
- package/skills/wix-headless-fast/references/shared/capabilities/media-upload/app/wix/media-upload/client.ts +0 -46
- package/skills/wix-headless-fast/references/shared/capabilities/media-upload/app-astro/pages/api/wix/media-upload.ts +0 -46
- package/skills/wix-headless-fast/references/shared/rest/client.ts +0 -155
- package/skills/wix-headless-fast/references/shared/rest/config.ts +0 -3
- package/skills/wix-headless-fast/references/shared/rest/media.ts +0 -65
- package/skills/wix-headless-fast/references/shared/seed/images.mjs +0 -145
- package/skills/wix-headless-fast/references/shared/seed/read-site.mjs +0 -99
- package/skills/wix-headless-fast/references/storefront/INSTRUCTIONS.md +0 -612
- package/skills/wix-headless-fast/references/storefront/app/components/storefront/CartButton.tsx +0 -26
- package/skills/wix-headless-fast/references/storefront/app/components/storefront/CartDrawer.tsx +0 -155
- package/skills/wix-headless-fast/references/storefront/app/components/storefront/FilterPanel.tsx +0 -266
- package/skills/wix-headless-fast/references/storefront/app/components/storefront/OptionPicker.tsx +0 -95
- package/skills/wix-headless-fast/references/storefront/app/components/storefront/QuickAdd.tsx +0 -136
- package/skills/wix-headless-fast/references/storefront/app/hooks/storefront/useCart.ts +0 -48
- package/skills/wix-headless-fast/references/storefront/app/hooks/storefront/useProductDetail.ts +0 -39
- package/skills/wix-headless-fast/references/storefront/app/hooks/storefront/useShop.ts +0 -34
- package/skills/wix-headless-fast/references/storefront/app/wix/storefront/cart-core.ts +0 -121
- package/skills/wix-headless-fast/references/storefront/app/wix/storefront/cart-store.ts +0 -107
- package/skills/wix-headless-fast/references/storefront/app/wix/storefront/cart.ts +0 -138
- package/skills/wix-headless-fast/references/storefront/app/wix/storefront/catalog-core.ts +0 -314
- package/skills/wix-headless-fast/references/storefront/app/wix/storefront/catalog.ts +0 -133
- package/skills/wix-headless-fast/references/storefront/app/wix/storefront/product-detail-store.ts +0 -147
- package/skills/wix-headless-fast/references/storefront/app/wix/storefront/shop-store.ts +0 -289
- package/skills/wix-headless-fast/references/storefront/app/wix/storefront/types.ts +0 -169
- package/skills/wix-headless-fast/references/storefront/app-astro/layouts/SiteLayout.astro +0 -65
- package/skills/wix-headless-fast/references/storefront/lock/astro/package-lock.json +0 -12247
- package/skills/wix-headless-fast/references/storefront/rest/cart.ts +0 -132
- package/skills/wix-headless-fast/references/storefront/rest/catalog.ts +0 -123
- package/skills/wix-headless-fast/references/storefront/seed/SEED.md +0 -130
- package/skills/wix-headless-fast/references/storefront/seed/read-site.mjs +0 -38
- package/skills/wix-headless-fast/references/storefront/seed/seed-store.mjs +0 -561
|
@@ -1,215 +0,0 @@
|
|
|
1
|
-
// Member authentication over REST — the twin of app/wix/members/auth.ts. Same exports, same
|
|
2
|
-
// LoginResult; the state and error-code rules come from auth-core (the SAME file the SDK transport
|
|
3
|
-
// uses). The custom credential flow, as the docs order it: login/register with the VISITOR token →
|
|
4
|
-
// a one-shot sessionToken (5-minute life) → a redirect session that authorizes it (PKCE,
|
|
5
|
-
// web_message) → an authorization code → POST /oauth2/token grantType authorization_code → MEMBER
|
|
6
|
-
// tokens, adopted by ./client.js so every later call (the current-member read, a member's own
|
|
7
|
-
// records) runs as the member and the refresh keeps the member. All from a page with the public
|
|
8
|
-
// client id; nothing elevated. Porting: keep the paths and bodies; the exchange is three calls.
|
|
9
|
-
// docs: https://dev.wix.com/docs/go-headless/authentication/members/custom-login-page/build-a-custom-login-page-rest.md
|
|
10
|
-
// docs: https://dev.wix.com/docs/api-reference/business-management/headless/redirects/create-redirect-session.md
|
|
11
|
-
import { WIX_CLIENT_ID } from "./config.js";
|
|
12
|
-
import { WixApiError, clearTokens, loadTokens, mintTokens, setTokens, wixRequest, type Tokens } from "./client.js";
|
|
13
|
-
import {
|
|
14
|
-
NO_SESSION_ERROR,
|
|
15
|
-
authOutcome,
|
|
16
|
-
failure,
|
|
17
|
-
loginErrorCode,
|
|
18
|
-
registerErrorCode,
|
|
19
|
-
toLoginResult,
|
|
20
|
-
type LoginResult,
|
|
21
|
-
type LoginState,
|
|
22
|
-
type RawAuth,
|
|
23
|
-
} from "./auth-core.js";
|
|
24
|
-
|
|
25
|
-
export type { LoginResult, LoginState };
|
|
26
|
-
|
|
27
|
-
const REDIRECT_SESSION = "/headless/v1/redirect-session";
|
|
28
|
-
/** The stateToken of a login/registration that stopped at email verification — verifyMemberEmail continues it. */
|
|
29
|
-
let pendingStateToken: string | null = null;
|
|
30
|
-
|
|
31
|
-
/** True when the persisted token set is a member's (no network) — the store skips the profile read when false. */
|
|
32
|
-
export function loggedInHint(): boolean {
|
|
33
|
-
return loadTokens()?.role === "member";
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
// A SUCCESS carries the one-shot session token: exchange it for member tokens and adopt them. Other
|
|
37
|
-
// states pass through; a verification state keeps its stateToken for verifyMemberEmail.
|
|
38
|
-
async function finish(raw: RawAuth): Promise<LoginResult> {
|
|
39
|
-
const outcome = authOutcome(raw);
|
|
40
|
-
if (outcome.state === "SUCCESS") {
|
|
41
|
-
pendingStateToken = null;
|
|
42
|
-
if (!outcome.sessionToken) return failure(NO_SESSION_ERROR);
|
|
43
|
-
setTokens(await memberTokensForSession(outcome.sessionToken));
|
|
44
|
-
return { state: "SUCCESS" };
|
|
45
|
-
}
|
|
46
|
-
if (outcome.stateToken) pendingStateToken = outcome.stateToken;
|
|
47
|
-
return toLoginResult(outcome);
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
const message = (e: unknown): string => (e instanceof Error ? e.message : String(e));
|
|
51
|
-
|
|
52
|
-
/**
|
|
53
|
-
* Sign in with email + password. A wrong password or unknown email is a FAILURE result (errorCode
|
|
54
|
-
* invalidPassword / invalidEmail, Wix's message in `error`), never a throw.
|
|
55
|
-
* POST /_api/iam/authentication/v2/login { loginId: { email }, password } → { state, sessionToken?, stateToken? }
|
|
56
|
-
*/
|
|
57
|
-
export async function loginMember(email: string, password: string): Promise<LoginResult> {
|
|
58
|
-
let raw: RawAuth;
|
|
59
|
-
try {
|
|
60
|
-
raw = await wixRequest<RawAuth>("/_api/iam/authentication/v2/login", { body: { loginId: { email }, password } });
|
|
61
|
-
} catch (e) {
|
|
62
|
-
return failure(message(e), e instanceof WixApiError ? loginErrorCode(e.code) : undefined);
|
|
63
|
-
}
|
|
64
|
-
return finish(raw);
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
/**
|
|
68
|
-
* Sign up with email + password (+ first/last name). An email already registered is a FAILURE with
|
|
69
|
-
* errorCode emailAlreadyExists. Whether the result is SUCCESS, EMAIL_VERIFICATION_REQUIRED, or
|
|
70
|
-
* OWNER_APPROVAL_REQUIRED is the site's signup policy (dashboard), not the caller's.
|
|
71
|
-
* POST /_api/iam/authentication/v2/register { loginId: { email }, password, profile?: { firstName, lastName } }
|
|
72
|
-
*/
|
|
73
|
-
export async function registerMember(
|
|
74
|
-
email: string,
|
|
75
|
-
password: string,
|
|
76
|
-
profile?: { firstName?: string; lastName?: string },
|
|
77
|
-
): Promise<LoginResult> {
|
|
78
|
-
let raw: RawAuth;
|
|
79
|
-
try {
|
|
80
|
-
raw = await wixRequest<RawAuth>("/_api/iam/authentication/v2/register", {
|
|
81
|
-
body: { loginId: { email }, password, ...(profile ? { profile } : {}) },
|
|
82
|
-
});
|
|
83
|
-
} catch (e) {
|
|
84
|
-
return failure(message(e), e instanceof WixApiError ? registerErrorCode(e.code, e.details) : undefined);
|
|
85
|
-
}
|
|
86
|
-
return finish(raw);
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
/**
|
|
90
|
-
* Continue an EMAIL_VERIFICATION_REQUIRED flow with the code from the email; the state token of the
|
|
91
|
-
* last login/registration is kept here. A FAILURE when nothing is waiting or the code is wrong.
|
|
92
|
-
* POST /_api/iam/verification/v1/auth/verify { code, stateToken } → { state, sessionToken?, stateToken? }
|
|
93
|
-
*/
|
|
94
|
-
export async function verifyMemberEmail(verificationCode: string): Promise<LoginResult> {
|
|
95
|
-
if (!pendingStateToken) return failure("No sign-in is waiting for a verification code.");
|
|
96
|
-
let raw: RawAuth;
|
|
97
|
-
try {
|
|
98
|
-
raw = await wixRequest<RawAuth>("/_api/iam/verification/v1/auth/verify", { body: { code: verificationCode, stateToken: pendingStateToken } });
|
|
99
|
-
} catch (e) {
|
|
100
|
-
return failure(message(e));
|
|
101
|
-
}
|
|
102
|
-
return finish(raw);
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
/**
|
|
106
|
-
* The Wix logout URL for the current member — navigating the document there ends the Wix session
|
|
107
|
-
* and lands on `returnTo` (an absolute URL). Called with the MEMBER token.
|
|
108
|
-
* POST /headless/v1/redirect-session { logout: { clientId }, callbacks: { postFlowUrl } } → { redirectSession: { fullUrl } }
|
|
109
|
-
*/
|
|
110
|
-
export async function logoutUrl(returnTo: string): Promise<string> {
|
|
111
|
-
const res = await wixRequest<RawAuth>(REDIRECT_SESSION, { body: { logout: { clientId: WIX_CLIENT_ID }, callbacks: { postFlowUrl: returnTo } } });
|
|
112
|
-
const url = res?.redirectSession?.fullUrl;
|
|
113
|
-
if (!url) throw new Error("Logout couldn't start: no redirect URL returned.");
|
|
114
|
-
return url;
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
/** Log out: drop the member tokens (the next call is a fresh visitor) and navigate to Wix's logout, which returns to `returnTo`. */
|
|
118
|
-
export async function logoutMember(returnTo = "/"): Promise<void> {
|
|
119
|
-
const target = typeof window !== "undefined" ? new URL(returnTo, window.location.origin).href : returnTo;
|
|
120
|
-
const url = await logoutUrl(target);
|
|
121
|
-
clearTokens();
|
|
122
|
-
if (typeof window !== "undefined") window.location.assign(url);
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
/**
|
|
126
|
-
* sessionToken → member tokens. Three calls, as the docs order them:
|
|
127
|
-
* 1. POST /headless/v1/redirect-session
|
|
128
|
-
* { auth: { authRequest: { clientId, codeChallenge, codeChallengeMethod: "S256", responseMode: "web_message",
|
|
129
|
-
* responseType: "code", scope: "offline_access", state, sessionToken }, prompt: "none" } }
|
|
130
|
-
* → { redirectSession: { fullUrl } } (with the visitor token)
|
|
131
|
-
* 2. fullUrl is a page whose script posts { code, state, error } to its parent — a hidden iframe in a
|
|
132
|
-
* browser (its origin must be one of the OAuth app's allowed domains, or the message is dropped
|
|
133
|
-
* and this times out); without a DOM (a server-side port, a Node check) the same page is fetched
|
|
134
|
-
* and read.
|
|
135
|
-
* 3. POST /oauth2/token { clientId, grantType: "authorization_code", code, codeVerifier }
|
|
136
|
-
* → member access + refresh tokens (role "member"); the code is single-use.
|
|
137
|
-
*/
|
|
138
|
-
export async function memberTokensForSession(sessionToken: string): Promise<Tokens> {
|
|
139
|
-
const { verifier, challenge } = await pkce();
|
|
140
|
-
const state = randomString();
|
|
141
|
-
const res = await wixRequest<RawAuth>(REDIRECT_SESSION, {
|
|
142
|
-
body: {
|
|
143
|
-
auth: {
|
|
144
|
-
authRequest: {
|
|
145
|
-
clientId: WIX_CLIENT_ID,
|
|
146
|
-
codeChallenge: challenge,
|
|
147
|
-
codeChallengeMethod: "S256",
|
|
148
|
-
responseMode: "web_message",
|
|
149
|
-
responseType: "code",
|
|
150
|
-
scope: "offline_access",
|
|
151
|
-
state,
|
|
152
|
-
sessionToken,
|
|
153
|
-
},
|
|
154
|
-
prompt: "none",
|
|
155
|
-
},
|
|
156
|
-
},
|
|
157
|
-
});
|
|
158
|
-
const url: string | undefined = res?.redirectSession?.fullUrl;
|
|
159
|
-
if (!url) throw new Error("Login couldn't finish: no authorization URL returned.");
|
|
160
|
-
const code = await authorizationCode(url, state);
|
|
161
|
-
return mintTokens({ grantType: "authorization_code", code, codeVerifier: verifier }, "member");
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
// The authorize page posts { code, state, error }. Browser: a hidden iframe and a message listener
|
|
165
|
-
// keyed on our state (the SDK's own mechanism). No DOM: fetch the page and read the same three values.
|
|
166
|
-
async function authorizationCode(url: string, state: string): Promise<string> {
|
|
167
|
-
if (typeof document === "undefined") {
|
|
168
|
-
const html = await (await fetch(url)).text();
|
|
169
|
-
const field = (name: string) => html.match(new RegExp(`'${name}':\\s*'([^']*)'`))?.[1];
|
|
170
|
-
const error = field("error");
|
|
171
|
-
if (error) throw new Error(`Login was refused: ${error}`);
|
|
172
|
-
const code = field("code");
|
|
173
|
-
if (!code || field("state") !== state) throw new Error("Login couldn't finish: no authorization code.");
|
|
174
|
-
return code;
|
|
175
|
-
}
|
|
176
|
-
return new Promise<string>((resolve, reject) => {
|
|
177
|
-
const frame = document.createElement("iframe");
|
|
178
|
-
frame.style.display = "none";
|
|
179
|
-
const done = () => {
|
|
180
|
-
window.removeEventListener("message", onMessage);
|
|
181
|
-
clearTimeout(timer);
|
|
182
|
-
frame.remove();
|
|
183
|
-
};
|
|
184
|
-
const onMessage = (e: MessageEvent) => {
|
|
185
|
-
const data = e.data as { code?: string; state?: string; error?: string } | null;
|
|
186
|
-
if (!data || data.state !== state) return; // a message not meant for us
|
|
187
|
-
done();
|
|
188
|
-
if (data.error) reject(new Error(`Login was refused: ${data.error}`));
|
|
189
|
-
else if (data.code) resolve(data.code);
|
|
190
|
-
else reject(new Error("Login couldn't finish: no authorization code."));
|
|
191
|
-
};
|
|
192
|
-
const timer = setTimeout(() => {
|
|
193
|
-
done();
|
|
194
|
-
reject(new Error("Login timed out. Is this page's origin on the OAuth app's allowed domains?"));
|
|
195
|
-
}, 120_000);
|
|
196
|
-
window.addEventListener("message", onMessage);
|
|
197
|
-
frame.src = url;
|
|
198
|
-
document.body.appendChild(frame);
|
|
199
|
-
});
|
|
200
|
-
}
|
|
201
|
-
|
|
202
|
-
// PKCE: a 43-char base64url verifier, its SHA-256 as the S256 challenge. Web Crypto (browser + Node).
|
|
203
|
-
function base64url(bytes: Uint8Array): string {
|
|
204
|
-
let s = "";
|
|
205
|
-
for (const b of bytes) s += String.fromCharCode(b);
|
|
206
|
-
return btoa(s).replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/, "");
|
|
207
|
-
}
|
|
208
|
-
function randomString(): string {
|
|
209
|
-
return base64url(crypto.getRandomValues(new Uint8Array(32)));
|
|
210
|
-
}
|
|
211
|
-
async function pkce(): Promise<{ verifier: string; challenge: string }> {
|
|
212
|
-
const verifier = randomString();
|
|
213
|
-
const digest = await crypto.subtle.digest("SHA-256", new TextEncoder().encode(verifier));
|
|
214
|
-
return { verifier, challenge: base64url(new Uint8Array(digest)) };
|
|
215
|
-
}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
// Current-member read over REST — the twin of app/wix/members/members.ts. Same export, same DTO;
|
|
2
|
-
// the mapper comes from members-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 GET. It runs with
|
|
4
|
-
// whatever token ./client.js holds — a member's after a rest/auth.ts login → the profile; a
|
|
5
|
-
// visitor's → 403 → null. Porting: keep the path and the fieldsets, port the core once.
|
|
6
|
-
// docs: https://dev.wix.com/docs/api-reference/crm/members-contacts/members/member-management/members/get-my-member.md
|
|
7
|
-
import { wixRequest } from "./client.js";
|
|
8
|
-
import { imgSrc } from "./media.js";
|
|
9
|
-
import { MEMBER_FIELDSETS, memberId, toCurrentMember, type Raw } from "./members-core.js";
|
|
10
|
-
import type { CurrentMember } from "./types.js";
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* The current member, or null: for a visitor (the call is refused — "Missing site member id"), for
|
|
14
|
-
* a logged-in member whose site lacks the Members Area app (no profile), and on any failure —
|
|
15
|
-
* anonymous is a normal state, never an error.
|
|
16
|
-
* GET /members/v1/members/my?fieldsets=FULL → { member: { id, loginEmail, contactId, contact: { firstName, lastName }, profile: { nickname, photo? }, createdDate, … } }
|
|
17
|
-
*/
|
|
18
|
-
export async function fetchCurrentMember(): Promise<CurrentMember | null> {
|
|
19
|
-
try {
|
|
20
|
-
const res = await wixRequest<Raw>("/members/v1/members/my", { method: "GET", query: { fieldsets: MEMBER_FIELDSETS } });
|
|
21
|
-
const raw: Raw | undefined = res?.member;
|
|
22
|
-
return raw && memberId(raw) ? toCurrentMember(raw, imgSrc) : null;
|
|
23
|
-
} catch {
|
|
24
|
-
return null;
|
|
25
|
-
}
|
|
26
|
-
}
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
# Members — seeding
|
|
2
|
-
|
|
3
|
-
**Members self-register — there is no member content to seed.** The Wix login page registers
|
|
4
|
-
or logs in members at runtime; creating members at build time is intentionally out of scope
|
|
5
|
-
(a headless run must never stall on an interactive login, and Create Member needs an
|
|
6
|
-
elevated credential).
|
|
7
|
-
|
|
8
|
-
What `seed-members.mjs` does is the one build-time setup the vertical needs: **install the
|
|
9
|
-
Wix Members Area app** — the *profile* layer. Identity (log in / log out / "logged-in vs
|
|
10
|
-
not" gating) needs no install; profile data does: without the app, `getCurrentMember()`
|
|
11
|
-
returns nothing for a logged-in member and the account page can't render who they are.
|
|
12
|
-
|
|
13
|
-
```bash
|
|
14
|
-
# from the project root (where wix.config.json lives) — the plan file is optional:
|
|
15
|
-
node <SKILL_ROOT>/references/members/seed/seed-members.mjs
|
|
16
|
-
```
|
|
17
|
-
|
|
18
|
-
```json
|
|
19
|
-
{ "installMembersArea": true }
|
|
20
|
-
```
|
|
21
|
-
|
|
22
|
-
- `installMembersArea` — default `true`; set `false` only when the run needs pure
|
|
23
|
-
"logged-in vs not" gating and will never display member data.
|
|
24
|
-
- Re-running is safe: an already-installed app is recorded in the result JSON
|
|
25
|
-
(`membersAreaInstall.note`), never thrown.
|
|
26
|
-
|
|
27
|
-
**Seeding is additive — never delete or overwrite existing content**; ask first if a cleanup
|
|
28
|
-
seems needed.
|
|
29
|
-
|
|
30
|
-
## Escape hatch — individual functions
|
|
31
|
-
`setupMembers` composes the exported steps — `installMembersAreaApp`, plus `makeCtx()` —
|
|
32
|
-
import them for a partial re-run.
|
|
33
|
-
|
|
34
|
-
## Reference
|
|
35
|
-
The appDefId and the identity/profile split come from
|
|
36
|
-
`wix-headless/references/SETUP.md` (§ members). Signup security (email verification, owner
|
|
37
|
-
approval, reCAPTCHA) is dashboard-governed — never seeded. If a run's prompt explicitly needs
|
|
38
|
-
a pre-created member (rare), the admin Create Member shape is in the live Wix API reference —
|
|
39
|
-
read it via the `wix-docs` skill; don't guess it here.
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
// Whether the site has a members area, and how many members.
|
|
2
|
-
// node <SKILL_ROOT>/references/members/seed/read-site.mjs [--site <siteId>]
|
|
3
|
-
import { runReader } from "../../shared/seed/read-site.mjs";
|
|
4
|
-
|
|
5
|
-
const MEMBERS_AREA_APP_ID = "14cc59bc-f0b7-15b8-e1c7-89ce41d0e0c9";
|
|
6
|
-
const D = "https://dev.wix.com/docs/api-reference/crm/members-contacts/members/members";
|
|
7
|
-
|
|
8
|
-
await runReader({
|
|
9
|
-
vertical: "members",
|
|
10
|
-
appId: MEMBERS_AREA_APP_ID,
|
|
11
|
-
async read(api) {
|
|
12
|
-
const r = await api.call({ method: "GET", path: "/members/v1/members?fieldsets=PUBLIC&paging.limit=1", docs: `${D}/list-members` });
|
|
13
|
-
return { memberCount: r.metadata?.total ?? r.pagingMetadata?.total ?? null };
|
|
14
|
-
},
|
|
15
|
-
});
|
|
@@ -1,94 +0,0 @@
|
|
|
1
|
-
// Members seed — a BUILD-TIME script, never shipped in the app. Run from the project root
|
|
2
|
-
// (where wix.config.json lives); the plan file is optional:
|
|
3
|
-
//
|
|
4
|
-
// node <SKILL_ROOT>/references/members/seed/seed-members.mjs [plan.json]
|
|
5
|
-
//
|
|
6
|
-
// Members SELF-REGISTER — there is no member content to create (see SEED.md). The one
|
|
7
|
-
// build-time setup this vertical needs is installing the Wix Members Area app, which serves
|
|
8
|
-
// member PROFILE data: without it getCurrentMember() returns nothing for a logged-in member,
|
|
9
|
-
// so the account page can't render who they are. Identity alone (log in / log out / gating)
|
|
10
|
-
// needs no install. Prints a JSON result to stdout.
|
|
11
|
-
//
|
|
12
|
-
// Plan shape (see SEED.md): { "installMembersArea": true } // default true
|
|
13
|
-
//
|
|
14
|
-
// Seeding is ADDITIVE — never deletes or overwrites existing content. Authoritative source:
|
|
15
|
-
// wix-headless/references/SETUP.md § members (the appDefId and the identity/profile split).
|
|
16
|
-
import { execFileSync } from "node:child_process";
|
|
17
|
-
import { readFileSync } from "node:fs";
|
|
18
|
-
|
|
19
|
-
const API = "https://www.wixapis.com";
|
|
20
|
-
// The Wix Members Area app (the profile layer). Not in the "Apps Created by Wix" table —
|
|
21
|
-
// the GUID comes from the App Market listing; recorded in wix-headless/references/SETUP.md.
|
|
22
|
-
// Installing it pulls in its Site-Members dependency automatically.
|
|
23
|
-
const MEMBERS_AREA_APP_ID = "14cc59bc-f0b7-15b8-e1c7-89ce41d0e0c9";
|
|
24
|
-
|
|
25
|
-
export function makeCtx({ cwd = process.cwd() } = {}) {
|
|
26
|
-
const config = JSON.parse(readFileSync(`${cwd}/wix.config.json`, "utf8"));
|
|
27
|
-
const siteId = config.siteId ?? config.projectId;
|
|
28
|
-
if (!siteId) throw new Error("wix.config.json has no siteId — is this a Wix CLI project?");
|
|
29
|
-
const token = execFileSync("npx", ["@wix/cli@latest", "token", "--site", siteId], {
|
|
30
|
-
encoding: "utf8",
|
|
31
|
-
cwd,
|
|
32
|
-
}).trim();
|
|
33
|
-
if (!token) throw new Error("The Wix CLI returned no token — run `npx @wix/cli@latest login` first.");
|
|
34
|
-
return { token, siteId };
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
async function req(ctx, path, { method = "POST", body } = {}) {
|
|
38
|
-
const res = await fetch(API + path, {
|
|
39
|
-
method,
|
|
40
|
-
headers: {
|
|
41
|
-
Authorization: `Bearer ${ctx.token}`,
|
|
42
|
-
"wix-site-id": ctx.siteId,
|
|
43
|
-
"Content-Type": "application/json",
|
|
44
|
-
},
|
|
45
|
-
body: body ? JSON.stringify(body) : undefined,
|
|
46
|
-
});
|
|
47
|
-
const json = await res.json().catch(() => ({}));
|
|
48
|
-
if (!res.ok) throw new Error(`${method} ${path} -> ${res.status}: ${JSON.stringify(json).slice(0, 400)}`);
|
|
49
|
-
return json;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
// ---- operations ----------------------------------------------------------------------------------
|
|
53
|
-
|
|
54
|
-
/**
|
|
55
|
-
* Install the Wix Members Area app (idempotent in effect: re-running against a site that
|
|
56
|
-
* already has it errors — recorded in the result, not thrown, since "already installed" and
|
|
57
|
-
* a real failure aren't distinguishable from the response).
|
|
58
|
-
* docs: https://dev.wix.com/docs/api-reference/articles/work-with-wix-apis/platform/about-apps-created-by-wix.md
|
|
59
|
-
*/
|
|
60
|
-
export async function installMembersAreaApp(ctx) {
|
|
61
|
-
try {
|
|
62
|
-
await req(ctx, "/apps-installer-service/v1/app-instance/install", { body: {
|
|
63
|
-
tenant: { tenantType: "SITE", id: ctx.siteId },
|
|
64
|
-
appInstance: { appDefId: MEMBERS_AREA_APP_ID, enabled: true },
|
|
65
|
-
} });
|
|
66
|
-
return { requested: true, note: null };
|
|
67
|
-
} catch (e) {
|
|
68
|
-
return { requested: false, note: String(e.message).slice(0, 300) };
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
/** ONE-CALL seed: install the Members Area app (the profile layer). The default path. */
|
|
73
|
-
export async function setupMembers(ctx, { installMembersArea = true } = {}) {
|
|
74
|
-
return {
|
|
75
|
-
membersAreaAppId: MEMBERS_AREA_APP_ID,
|
|
76
|
-
membersAreaInstall: installMembersArea ? await installMembersAreaApp(ctx) : { skipped: true },
|
|
77
|
-
membersCreated: 0, // members self-register — never created at build time
|
|
78
|
-
};
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
// ---- CLI entry ----------------------------------------------------------------------------------
|
|
82
|
-
|
|
83
|
-
const invokedDirectly = process.argv[1] && import.meta.url.endsWith(process.argv[1].split("/").pop());
|
|
84
|
-
if (invokedDirectly) {
|
|
85
|
-
const planPath = process.argv[2];
|
|
86
|
-
const plan = planPath ? JSON.parse(readFileSync(planPath, "utf8")) : {};
|
|
87
|
-
const ctx = makeCtx();
|
|
88
|
-
setupMembers(ctx, plan)
|
|
89
|
-
.then((result) => console.log(JSON.stringify(result, null, 2)))
|
|
90
|
-
.catch((e) => {
|
|
91
|
-
console.error(e.message);
|
|
92
|
-
process.exit(1);
|
|
93
|
-
});
|
|
94
|
-
}
|