@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,66 +0,0 @@
|
|
|
1
|
-
// React binding for the member store. Works in any React root — Astro islands (several on
|
|
2
|
-
// one page share the same session) and SPAs alike. SSR-friendly: pass a server-resolved
|
|
3
|
-
// member as `initialMember` (Astro island props) and no client re-fetch happens.
|
|
4
|
-
import { useRef, useSyncExternalStore } from "react";
|
|
5
|
-
import {
|
|
6
|
-
getMemberState,
|
|
7
|
-
hydrateMember,
|
|
8
|
-
login,
|
|
9
|
-
register,
|
|
10
|
-
logout,
|
|
11
|
-
refreshMember,
|
|
12
|
-
subscribeMember,
|
|
13
|
-
verifyEmail,
|
|
14
|
-
type MemberState,
|
|
15
|
-
} from "../../wix/members/member-store";
|
|
16
|
-
import type { LoginResult } from "../../wix/members/auth";
|
|
17
|
-
import type { CurrentMember } from "../../wix/members/types";
|
|
18
|
-
|
|
19
|
-
export interface UseMemberOptions {
|
|
20
|
-
/** Server-resolved member (null = a known-anonymous visitor); omit to resolve client-side. */
|
|
21
|
-
initialMember?: CurrentMember | null;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
export interface UseMember extends MemberState {
|
|
25
|
-
/** Submit the shipped in-app credential form. */
|
|
26
|
-
login: (email: string, password: string) => Promise<LoginResult>;
|
|
27
|
-
register: (
|
|
28
|
-
email: string,
|
|
29
|
-
password: string,
|
|
30
|
-
profile?: { firstName?: string; lastName?: string },
|
|
31
|
-
) => Promise<LoginResult>;
|
|
32
|
-
verifyEmail: (code: string) => Promise<LoginResult>;
|
|
33
|
-
/** Log out through the Wix logout flow; navigates away. */
|
|
34
|
-
logout: (returnTo?: string) => Promise<void>;
|
|
35
|
-
refresh: () => Promise<void>;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
export function useMember({ initialMember }: UseMemberOptions = {}): UseMember {
|
|
39
|
-
// Adopt SSR props into the shared store before the first subscription (a no-op once any
|
|
40
|
-
// island has settled the session).
|
|
41
|
-
if (typeof window !== "undefined" && initialMember !== undefined)
|
|
42
|
-
hydrateMember(initialMember);
|
|
43
|
-
const server = useRef<MemberState | null>(null);
|
|
44
|
-
server.current ??=
|
|
45
|
-
initialMember !== undefined
|
|
46
|
-
? {
|
|
47
|
-
member: initialMember,
|
|
48
|
-
loggedIn: initialMember !== null,
|
|
49
|
-
loading: false,
|
|
50
|
-
error: null,
|
|
51
|
-
}
|
|
52
|
-
: getMemberState();
|
|
53
|
-
const state = useSyncExternalStore(
|
|
54
|
-
subscribeMember,
|
|
55
|
-
getMemberState,
|
|
56
|
-
() => server.current as MemberState,
|
|
57
|
-
);
|
|
58
|
-
return {
|
|
59
|
-
...state,
|
|
60
|
-
login,
|
|
61
|
-
register,
|
|
62
|
-
verifyEmail,
|
|
63
|
-
logout,
|
|
64
|
-
refresh: refreshMember,
|
|
65
|
-
};
|
|
66
|
-
}
|
|
@@ -1,105 +0,0 @@
|
|
|
1
|
-
// Authentication rules — transport-agnostic, imported by BOTH transports: ./auth.ts (the SDK's
|
|
2
|
-
// OAuthStrategy) and the REST twin in references/members/rest/auth.ts (the IAM authentication API
|
|
3
|
-
// over fetch). What a login/registration response MEANS — the four states, when a session token is
|
|
4
|
-
// expected, which Wix error code is which failure — lives HERE, once. No imports: a strip to JS
|
|
5
|
-
// emits a plain module.
|
|
6
|
-
|
|
7
|
-
/** The four outcomes every credential operation resolves to; the shipped LoginForm renders each. */
|
|
8
|
-
export type LoginState = "SUCCESS" | "EMAIL_VERIFICATION_REQUIRED" | "OWNER_APPROVAL_REQUIRED" | "FAILURE";
|
|
9
|
-
|
|
10
|
-
export interface LoginResult {
|
|
11
|
-
state: LoginState;
|
|
12
|
-
/** Continues an EMAIL_VERIFICATION_REQUIRED flow (the transport keeps it too — verifyMemberEmail needs no argument). */
|
|
13
|
-
stateToken?: string;
|
|
14
|
-
/** A stable name for a FAILURE: invalidPassword, invalidEmail, emailAlreadyExists, resetPassword, missingCaptchaToken, invalidCaptchaToken. */
|
|
15
|
-
errorCode?: string;
|
|
16
|
-
/** Wix's message for a FAILURE — render it. */
|
|
17
|
-
error?: string;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
/** A raw login/register/verify response as either transport returns it. */
|
|
21
|
-
export type RawAuth = Record<string, any>;
|
|
22
|
-
|
|
23
|
-
/** A LoginResult plus the one-shot session token a SUCCESS carries (5-minute life; exchanged, never shown). */
|
|
24
|
-
export interface AuthOutcome extends LoginResult {
|
|
25
|
-
sessionToken: string | null;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
// REST spells the states differently from the SDK; both map onto LoginState.
|
|
29
|
-
const REST_STATES: Record<string, LoginState> = {
|
|
30
|
-
SUCCESS: "SUCCESS",
|
|
31
|
-
REQUIRE_EMAIL_VERIFICATION: "EMAIL_VERIFICATION_REQUIRED",
|
|
32
|
-
REQUIRE_OWNER_APPROVAL: "OWNER_APPROVAL_REQUIRED",
|
|
33
|
-
};
|
|
34
|
-
|
|
35
|
-
/**
|
|
36
|
-
* Normalize either transport's response — SDK `{ loginState, data: { sessionToken | stateToken },
|
|
37
|
-
* error?, errorCode? }` or REST `{ state, sessionToken?, stateToken? }`. Anything else is a FAILURE.
|
|
38
|
-
*/
|
|
39
|
-
export function authOutcome(raw: RawAuth | null | undefined): AuthOutcome {
|
|
40
|
-
const state: LoginState = raw?.loginState ?? REST_STATES[raw?.state ?? ""] ?? "FAILURE";
|
|
41
|
-
const stateToken: string | undefined = raw?.stateToken ?? raw?.data?.stateToken;
|
|
42
|
-
return {
|
|
43
|
-
state,
|
|
44
|
-
sessionToken: raw?.data?.sessionToken ?? raw?.sessionToken ?? null,
|
|
45
|
-
...(stateToken ? { stateToken } : {}),
|
|
46
|
-
...(raw?.errorCode ? { errorCode: raw.errorCode } : {}),
|
|
47
|
-
...(raw?.error ? { error: raw.error } : {}),
|
|
48
|
-
};
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
/** The outcome as callers see it — without the session token, which the transport has consumed. */
|
|
52
|
-
export function toLoginResult({ sessionToken: _consumed, ...result }: AuthOutcome): LoginResult {
|
|
53
|
-
return result;
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
export function failure(error: string, errorCode?: string): LoginResult {
|
|
57
|
-
return { state: "FAILURE", error, ...(errorCode ? { errorCode } : {}) };
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
/** A SUCCESS without a session token — the exchange can't run; surfaced as a FAILURE with this text. */
|
|
61
|
-
export const NO_SESSION_ERROR = "Wix did not return a member session.";
|
|
62
|
-
|
|
63
|
-
// Wix IAM application-error codes, named as the SDK names them.
|
|
64
|
-
export const AUTH_ERROR_CODES = {
|
|
65
|
-
MISSING_CAPTCHA: "-19971",
|
|
66
|
-
INVALID_CAPTCHA: "-19970",
|
|
67
|
-
EMAIL_EXISTS: "-19995",
|
|
68
|
-
INVALID_PASSWORD: "-19976",
|
|
69
|
-
RESET_PASSWORD: "-19973",
|
|
70
|
-
} as const;
|
|
71
|
-
|
|
72
|
-
/** A failed login's applicationError code → the SDK's errorCode name (anything unrecognized is `invalidEmail`, as the SDK does). */
|
|
73
|
-
export function loginErrorCode(code: string | undefined): string {
|
|
74
|
-
switch (code) {
|
|
75
|
-
case AUTH_ERROR_CODES.MISSING_CAPTCHA:
|
|
76
|
-
return "missingCaptchaToken";
|
|
77
|
-
case AUTH_ERROR_CODES.INVALID_CAPTCHA:
|
|
78
|
-
return "invalidCaptchaToken";
|
|
79
|
-
case AUTH_ERROR_CODES.INVALID_PASSWORD:
|
|
80
|
-
return "invalidPassword";
|
|
81
|
-
case AUTH_ERROR_CODES.RESET_PASSWORD:
|
|
82
|
-
return "resetPassword";
|
|
83
|
-
default:
|
|
84
|
-
return "invalidEmail";
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
/**
|
|
89
|
-
* A failed registration's applicationError code (+ the response `details`) → the SDK's errorCode
|
|
90
|
-
* name; undefined when the SDK would name none. A validation error on the EMAIL field is `invalidEmail`.
|
|
91
|
-
*/
|
|
92
|
-
export function registerErrorCode(code: string | undefined, details?: RawAuth): string | undefined {
|
|
93
|
-
const violations: RawAuth[] = details?.validationError?.fieldViolations ?? [];
|
|
94
|
-
if (violations.some((v) => v?.data?.type === "EMAIL")) return "invalidEmail";
|
|
95
|
-
switch (code) {
|
|
96
|
-
case AUTH_ERROR_CODES.MISSING_CAPTCHA:
|
|
97
|
-
return "missingCaptchaToken";
|
|
98
|
-
case AUTH_ERROR_CODES.EMAIL_EXISTS:
|
|
99
|
-
return "emailAlreadyExists";
|
|
100
|
-
case AUTH_ERROR_CODES.INVALID_CAPTCHA:
|
|
101
|
-
return "invalidCaptchaToken";
|
|
102
|
-
default:
|
|
103
|
-
return undefined;
|
|
104
|
-
}
|
|
105
|
-
}
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
// Custom, in-app member authentication over the SDK — the transport only. Credentials are
|
|
2
|
-
// submitted from the branded LoginForm; there is no Wix-hosted login-page redirect or callback
|
|
3
|
-
// route. What a response means lives in ./auth-core (shared with the REST twin in
|
|
4
|
-
// references/members/rest/auth.ts); this file makes the OAuthStrategy calls and delegates.
|
|
5
|
-
// docs: https://dev.wix.com/docs/go-headless/authentication/members/custom-login-page/build-a-custom-login-page-js-sdk.md
|
|
6
|
-
import { membersAuth } from "./client";
|
|
7
|
-
import {
|
|
8
|
-
NO_SESSION_ERROR,
|
|
9
|
-
authOutcome,
|
|
10
|
-
failure,
|
|
11
|
-
toLoginResult,
|
|
12
|
-
type LoginResult,
|
|
13
|
-
type LoginState,
|
|
14
|
-
type RawAuth,
|
|
15
|
-
} from "./auth-core";
|
|
16
|
-
|
|
17
|
-
export type { LoginResult, LoginState };
|
|
18
|
-
|
|
19
|
-
/** True when the explicit members client holds member tokens (no network). */
|
|
20
|
-
export function loggedInHint(): boolean {
|
|
21
|
-
return membersAuth.loggedIn();
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
// A SUCCESS carries a one-shot session token; the strategy exchanges it for member tokens
|
|
25
|
-
// (getMemberTokensForDirectLogin) and setTokens writes them into Astro's wixSession cookie, so the
|
|
26
|
-
// next server render and every island run as the member. Other states pass through.
|
|
27
|
-
async function finish(raw: RawAuth): Promise<LoginResult> {
|
|
28
|
-
const outcome = authOutcome(raw);
|
|
29
|
-
if (outcome.state === "SUCCESS") {
|
|
30
|
-
if (!outcome.sessionToken) return failure(NO_SESSION_ERROR);
|
|
31
|
-
const tokens = await membersAuth.getMemberTokensForDirectLogin(outcome.sessionToken);
|
|
32
|
-
membersAuth.setTokens(tokens);
|
|
33
|
-
return { state: "SUCCESS" };
|
|
34
|
-
}
|
|
35
|
-
return toLoginResult(outcome);
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
export async function loginMember(email: string, password: string): Promise<LoginResult> {
|
|
39
|
-
return finish((await membersAuth.login({ email, password })) as RawAuth);
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
export async function registerMember(
|
|
43
|
-
email: string,
|
|
44
|
-
password: string,
|
|
45
|
-
profile?: { firstName?: string; lastName?: string },
|
|
46
|
-
): Promise<LoginResult> {
|
|
47
|
-
return finish((await membersAuth.register({ email, password, ...(profile ? { profile } : {}) })) as RawAuth);
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
/** Continue an EMAIL_VERIFICATION_REQUIRED flow with the code from the email; the strategy holds the state token. */
|
|
51
|
-
export async function verifyMemberEmail(verificationCode: string): Promise<LoginResult> {
|
|
52
|
-
return finish((await membersAuth.processVerification({ verificationCode })) as RawAuth);
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
/** Log out through Wix (clears the session cookie) and land on `returnTo` — navigates away. */
|
|
56
|
-
export async function logoutMember(returnTo = "/"): Promise<void> {
|
|
57
|
-
const { logoutUrl } = await membersAuth.logout(new URL(returnTo, window.location.origin).href);
|
|
58
|
-
window.location.assign(logoutUrl);
|
|
59
|
-
}
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
// Explicit custom-login client for the Members vertical. Unlike the shared SDK seam,
|
|
2
|
-
// this client is used in a browser island even on managed Astro: direct credential login
|
|
3
|
-
// cannot use the Wix-hosted /api/auth redirect flow.
|
|
4
|
-
import { createClient, EMPTY_TOKENS, OAuthStrategy } from "@wix/sdk";
|
|
5
|
-
import type { TokenStorage, Tokens } from "@wix/sdk";
|
|
6
|
-
import { members } from "@wix/members";
|
|
7
|
-
import { WIX_MEMBERS_CLIENT_ID } from "../config";
|
|
8
|
-
|
|
9
|
-
// `@wix/astro` uses this cookie as the session source for both browser islands
|
|
10
|
-
// and the next server render. Direct login must write the exact same contract,
|
|
11
|
-
// so the member identity becomes the managed Astro identity too.
|
|
12
|
-
const SESSION_COOKIE_NAME = "wixSession";
|
|
13
|
-
|
|
14
|
-
const tokenStorage: TokenStorage = {
|
|
15
|
-
getTokens(): Tokens {
|
|
16
|
-
try {
|
|
17
|
-
const raw = document.cookie
|
|
18
|
-
.split("; ")
|
|
19
|
-
.find((cookie) => cookie.startsWith(`${SESSION_COOKIE_NAME}=`));
|
|
20
|
-
if (!raw) return EMPTY_TOKENS;
|
|
21
|
-
const session = JSON.parse(
|
|
22
|
-
decodeURIComponent(raw.slice(SESSION_COOKIE_NAME.length + 1)),
|
|
23
|
-
) as { clientId?: string; tokens?: Tokens };
|
|
24
|
-
return session.clientId === WIX_MEMBERS_CLIENT_ID && session.tokens
|
|
25
|
-
? session.tokens
|
|
26
|
-
: EMPTY_TOKENS;
|
|
27
|
-
} catch {
|
|
28
|
-
return EMPTY_TOKENS;
|
|
29
|
-
}
|
|
30
|
-
},
|
|
31
|
-
setTokens(tokens: Tokens): void {
|
|
32
|
-
try {
|
|
33
|
-
const value = encodeURIComponent(
|
|
34
|
-
JSON.stringify({ clientId: WIX_MEMBERS_CLIENT_ID, tokens }),
|
|
35
|
-
);
|
|
36
|
-
document.cookie = `${SESSION_COOKIE_NAME}=${value}; path=/; secure; samesite=none`;
|
|
37
|
-
} catch {
|
|
38
|
-
// A blocked cookie only prevents the member session from surviving navigation.
|
|
39
|
-
}
|
|
40
|
-
},
|
|
41
|
-
};
|
|
42
|
-
|
|
43
|
-
if (!WIX_MEMBERS_CLIENT_ID) {
|
|
44
|
-
throw new Error("Custom member login needs WIX_MEMBERS_CLIENT_ID.");
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
const client = createClient({
|
|
48
|
-
modules: { members },
|
|
49
|
-
auth: OAuthStrategy({ clientId: WIX_MEMBERS_CLIENT_ID, tokenStorage }),
|
|
50
|
-
});
|
|
51
|
-
|
|
52
|
-
export const membersAuth = client.auth;
|
|
53
|
-
export const membersApi = client.members;
|
|
@@ -1,122 +0,0 @@
|
|
|
1
|
-
// Member session state — a module-scope store, deliberately NOT a React context.
|
|
2
|
-
// A context can't span Astro islands (each island is its own React root); a module
|
|
3
|
-
// singleton is shared by every island in the page bundle, and works identically in a
|
|
4
|
-
// single-root SPA. Consume it through useMember() (hooks/), or subscribe directly.
|
|
5
|
-
import { fetchCurrentMember } from "./members";
|
|
6
|
-
import {
|
|
7
|
-
loggedInHint,
|
|
8
|
-
loginMember,
|
|
9
|
-
logoutMember,
|
|
10
|
-
registerMember,
|
|
11
|
-
verifyMemberEmail,
|
|
12
|
-
type LoginResult,
|
|
13
|
-
} from "./auth";
|
|
14
|
-
import type { CurrentMember } from "./types";
|
|
15
|
-
|
|
16
|
-
export interface MemberState {
|
|
17
|
-
member: CurrentMember | null;
|
|
18
|
-
/** True for a logged-in member — can be true with `member` null when the Members Area app is absent. */
|
|
19
|
-
loggedIn: boolean;
|
|
20
|
-
/** True until the first session read settles — render skeletons, not the logged-out state. */
|
|
21
|
-
loading: boolean;
|
|
22
|
-
/** Last failed operation's message — render it; a new operation clears it. */
|
|
23
|
-
error: string | null;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
const EMPTY: MemberState = {
|
|
27
|
-
member: null,
|
|
28
|
-
loggedIn: false,
|
|
29
|
-
loading: true,
|
|
30
|
-
error: null,
|
|
31
|
-
};
|
|
32
|
-
|
|
33
|
-
let state: MemberState = EMPTY;
|
|
34
|
-
const listeners = new Set<() => void>();
|
|
35
|
-
let started = false;
|
|
36
|
-
|
|
37
|
-
function setState(patch: Partial<MemberState>): void {
|
|
38
|
-
state = { ...state, ...patch };
|
|
39
|
-
for (const l of listeners) l();
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
export function getMemberState(): MemberState {
|
|
43
|
-
return state;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
/** Adopt an SSR-resolved member (Astro island props) so no client re-fetch happens. */
|
|
47
|
-
export function hydrateMember(member: CurrentMember | null): void {
|
|
48
|
-
if (started) return;
|
|
49
|
-
started = true;
|
|
50
|
-
state = { member, loggedIn: member !== null, loading: false, error: null };
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
export function subscribeMember(listener: () => void): () => void {
|
|
54
|
-
listeners.add(listener);
|
|
55
|
-
// First subscriber triggers the initial session read (browser only — SSR renders `loading`).
|
|
56
|
-
if (!started && typeof window !== "undefined") {
|
|
57
|
-
started = true;
|
|
58
|
-
void refreshMember();
|
|
59
|
-
}
|
|
60
|
-
return () => listeners.delete(listener);
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
/** Re-read the session — call after anything that may have changed it. */
|
|
64
|
-
export async function refreshMember(): Promise<void> {
|
|
65
|
-
setState({ loading: true, error: null });
|
|
66
|
-
const hint = loggedInHint();
|
|
67
|
-
if (hint === false) {
|
|
68
|
-
setState({ member: null, loggedIn: false, loading: false });
|
|
69
|
-
return;
|
|
70
|
-
}
|
|
71
|
-
// hint true → read the profile (null = profile data missing, still logged in).
|
|
72
|
-
// hint null (ambient) → the member read IS the session check: null = anonymous.
|
|
73
|
-
const member = await fetchCurrentMember();
|
|
74
|
-
setState({ member, loggedIn: hint ?? member !== null, loading: false });
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
async function runLogin(
|
|
78
|
-
action: () => Promise<LoginResult>,
|
|
79
|
-
): Promise<LoginResult> {
|
|
80
|
-
try {
|
|
81
|
-
const result = await action();
|
|
82
|
-
if (result.state === "SUCCESS") await refreshMember();
|
|
83
|
-
if (result.state === "FAILURE")
|
|
84
|
-
setState({
|
|
85
|
-
error: result.error ?? result.errorCode ?? "Could not log in.",
|
|
86
|
-
});
|
|
87
|
-
return result;
|
|
88
|
-
} catch (e) {
|
|
89
|
-
setState({ error: e instanceof Error ? e.message : String(e) });
|
|
90
|
-
throw e;
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
/** Submit the branded in-app sign-in form. No Wix-hosted login redirect is used. */
|
|
95
|
-
export function login(email: string, password: string): Promise<LoginResult> {
|
|
96
|
-
return runLogin(() => loginMember(email, password));
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
/** Submit the branded in-app sign-up form. */
|
|
100
|
-
export function register(
|
|
101
|
-
email: string,
|
|
102
|
-
password: string,
|
|
103
|
-
profile?: { firstName?: string; lastName?: string },
|
|
104
|
-
): Promise<LoginResult> {
|
|
105
|
-
return runLogin(() => registerMember(email, password, profile));
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
/** Finish an email-verification branch from the same in-app form. */
|
|
109
|
-
export function verifyEmail(code: string): Promise<LoginResult> {
|
|
110
|
-
return runLogin(() => verifyMemberEmail(code));
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
/** Log out (navigates away); local state resets for the instant before the redirect lands. */
|
|
114
|
-
export async function logout(returnTo?: string): Promise<void> {
|
|
115
|
-
setState({ member: null, loggedIn: false });
|
|
116
|
-
try {
|
|
117
|
-
await logoutMember(returnTo);
|
|
118
|
-
} catch (e) {
|
|
119
|
-
setState({ error: e instanceof Error ? e.message : String(e) });
|
|
120
|
-
throw e;
|
|
121
|
-
}
|
|
122
|
-
}
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
// Member rules and DTO mapping — transport-agnostic, imported by BOTH transports: ./members.ts (the
|
|
2
|
-
// SDK, managed Astro and React) and the REST twin in references/members/rest/members.ts (fetch, a
|
|
3
|
-
// static site or a port to another language). The one rule about who a member "is" on screen lives
|
|
4
|
-
// HERE, once. A raw member comes from the SDK (`_id`, `_createdDate`) or from REST (`id`,
|
|
5
|
-
// `createdDate`); the mapper accepts both. Imports are type-only so a strip to JS emits no imports.
|
|
6
|
-
import type { CurrentMember } from "./types";
|
|
7
|
-
|
|
8
|
-
/** A raw Members V1 member as either transport returns it. */
|
|
9
|
-
export type Raw = Record<string, any>;
|
|
10
|
-
/** Media value + size → https URL. Injected: the SDK transport scales through @wix/sdk, REST through the URL form. */
|
|
11
|
-
export type ImgSrc = (value: any, width: number, height: number) => string;
|
|
12
|
-
|
|
13
|
-
// Requested on the current-member read. FULL → loginEmail, status, the contact's names, the profile
|
|
14
|
-
// (nickname, photo), and the dates; the default PUBLIC fieldset has no login email and no names.
|
|
15
|
-
export const MEMBER_FIELDSETS = ["FULL"] as const;
|
|
16
|
-
|
|
17
|
-
/** The member's id on either transport; "" when the raw object isn't a member. */
|
|
18
|
-
export const memberId = (raw: Raw | undefined): string => raw?._id ?? raw?.id ?? "";
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
* Raw member → CurrentMember. displayName is the first non-empty of nickname, "first last", the
|
|
22
|
-
* login email's local part, "Member". photoUrl is "" without a profile photo. memberSince is the
|
|
23
|
-
* creation date as "YYYY-MM-DD" ("" when unknown).
|
|
24
|
-
*/
|
|
25
|
-
export function toCurrentMember(raw: Raw, imgSrc: ImgSrc): CurrentMember {
|
|
26
|
-
const nickname: string = raw.profile?.nickname ?? "";
|
|
27
|
-
const firstName: string = raw.contact?.firstName ?? "";
|
|
28
|
-
const lastName: string = raw.contact?.lastName ?? "";
|
|
29
|
-
const loginEmail: string = raw.loginEmail ?? "";
|
|
30
|
-
const fullName = [firstName, lastName].filter(Boolean).join(" ");
|
|
31
|
-
const created = raw._createdDate ?? raw.createdDate;
|
|
32
|
-
return {
|
|
33
|
-
id: memberId(raw),
|
|
34
|
-
loginEmail,
|
|
35
|
-
displayName: nickname || fullName || loginEmail.split("@")[0] || "Member",
|
|
36
|
-
firstName,
|
|
37
|
-
lastName,
|
|
38
|
-
nickname,
|
|
39
|
-
photoUrl: imgSrc(raw.profile?.photo, 200, 200),
|
|
40
|
-
contactId: raw.contactId ?? "",
|
|
41
|
-
memberSince: created ? new Date(created).toISOString().slice(0, 10) : "",
|
|
42
|
-
};
|
|
43
|
-
}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
// Current-member read (Wix Members) over the SDK — the only file that touches raw member entities
|
|
2
|
-
// on this transport. The DTO mapper lives in ./members-core (shared with the REST twin in
|
|
3
|
-
// references/members/rest/members.ts); this file is the transport only. Identity vs. profile are
|
|
4
|
-
// different layers: "is this caller logged in?" needs no app install, but getCurrentMember returns
|
|
5
|
-
// profile DATA only once the Wix Members Area app is installed (the seed installs it). Copy as-is;
|
|
6
|
-
// extend by adding functions, not by editing these.
|
|
7
|
-
// docs: https://dev.wix.com/docs/api-reference/crm/members-contacts/members/member-management/members/get-my-member.md
|
|
8
|
-
import { membersApi } from "./client";
|
|
9
|
-
import { imgSrc } from "../media";
|
|
10
|
-
import { MEMBER_FIELDSETS, memberId, toCurrentMember, type Raw } from "./members-core";
|
|
11
|
-
import type { CurrentMember } from "./types";
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* The current member, or null for an anonymous visitor — and null for a LOGGED-IN member
|
|
15
|
-
* when the Members Area app isn't installed (setup, not a code bug; the seed installs it).
|
|
16
|
-
* Never throws: anonymous is a normal state for the client-side custom-login gate.
|
|
17
|
-
* The SDK export is getCurrentMember — the REST name "Get My Member" does not exist on
|
|
18
|
-
* the module; getMyMember(...) throws `is not a function`, and only once a real member
|
|
19
|
-
* loads the page.
|
|
20
|
-
*/
|
|
21
|
-
export async function fetchCurrentMember(): Promise<CurrentMember | null> {
|
|
22
|
-
try {
|
|
23
|
-
const res = await membersApi.getCurrentMember({ fieldsets: [...MEMBER_FIELDSETS] as any });
|
|
24
|
-
const raw = res.member as Raw | undefined;
|
|
25
|
-
return raw && memberId(raw) ? toCurrentMember(raw, imgSrc) : null;
|
|
26
|
-
} catch {
|
|
27
|
-
return null;
|
|
28
|
-
}
|
|
29
|
-
}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
// Members DTOs — the serializable shapes every hook, component, and page consumes.
|
|
2
|
-
// Plain JSON: safe as Astro island props or across server/client boundaries. The photo is a
|
|
3
|
-
// resolved https URL.
|
|
4
|
-
|
|
5
|
-
/** The logged-in member as the header/account surfaces need it. */
|
|
6
|
-
export interface CurrentMember {
|
|
7
|
-
id: string;
|
|
8
|
-
/** Email the member logs in with ("" when the fieldset hides it). */
|
|
9
|
-
loginEmail: string;
|
|
10
|
-
/** Best display name: nickname → first+last → the login email's local part. */
|
|
11
|
-
displayName: string;
|
|
12
|
-
firstName: string;
|
|
13
|
-
lastName: string;
|
|
14
|
-
nickname: string;
|
|
15
|
-
/** Resolved https URL ("" when the member has no photo). */
|
|
16
|
-
photoUrl: string;
|
|
17
|
-
/** Contact-list id — the key for member-owned CMS/content lookups. */
|
|
18
|
-
contactId: string;
|
|
19
|
-
/** "YYYY-MM-DD" the membership was created ("" when unknown). */
|
|
20
|
-
memberSince: string;
|
|
21
|
-
}
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
// The site chrome for every members page — THIS file (header/footer/nav) plus the @theme
|
|
3
|
-
// token block in src/styles/global.css are what you brand. Keep the <slot name="seo-tags" />
|
|
4
|
-
// in <head>, the global.css import, and one <MemberMenu client:only="react"> in the header
|
|
5
|
-
// (it reads browser session state and must not server-render). (If another vertical is also
|
|
6
|
-
// deployed, its SiteLayout won — mount MemberMenu in that header instead.)
|
|
7
|
-
import MemberMenu from "../components/members/MemberMenu";
|
|
8
|
-
import "../styles/global.css";
|
|
9
|
-
|
|
10
|
-
interface Props {
|
|
11
|
-
title: string;
|
|
12
|
-
description?: string;
|
|
13
|
-
}
|
|
14
|
-
const { title, description } = Astro.props;
|
|
15
|
-
---
|
|
16
|
-
|
|
17
|
-
<!doctype html>
|
|
18
|
-
<html lang="en">
|
|
19
|
-
<head>
|
|
20
|
-
<meta charset="UTF-8" />
|
|
21
|
-
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
22
|
-
<title>{title}</title>
|
|
23
|
-
{description && <meta name="description" content={description} />}
|
|
24
|
-
<slot name="seo-tags" />
|
|
25
|
-
</head>
|
|
26
|
-
<body>
|
|
27
|
-
<header class="sticky top-0 z-40 border-b border-border bg-background/80 backdrop-blur">
|
|
28
|
-
<div class="mx-auto flex h-16 max-w-6xl items-center justify-between px-6">
|
|
29
|
-
<a href="/" class="text-base font-bold tracking-tight text-foreground no-underline">Brand Name</a>
|
|
30
|
-
<nav class="flex items-center gap-6 text-sm">
|
|
31
|
-
<MemberMenu client:only="react" />
|
|
32
|
-
</nav>
|
|
33
|
-
</div>
|
|
34
|
-
</header>
|
|
35
|
-
<main class="mx-auto max-w-6xl px-6 pb-24 pt-10">
|
|
36
|
-
<slot />
|
|
37
|
-
</main>
|
|
38
|
-
<footer class="border-t border-border px-6 py-10 text-center text-sm text-muted-foreground">
|
|
39
|
-
© Brand Name
|
|
40
|
-
</footer>
|
|
41
|
-
</body>
|
|
42
|
-
</html>
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
import SiteLayout from "../layouts/SiteLayout.astro";
|
|
3
|
-
import AccountView from "../components/members/AccountView";
|
|
4
|
-
import RequireAuth from "../components/members/RequireAuth";
|
|
5
|
-
---
|
|
6
|
-
|
|
7
|
-
<SiteLayout title="My account">
|
|
8
|
-
<h1 class="mb-8 text-2xl font-semibold tracking-tight">My account</h1>
|
|
9
|
-
<RequireAuth client:only="react"><AccountView /></RequireAuth>
|
|
10
|
-
</SiteLayout>
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
import SiteLayout from "../layouts/SiteLayout.astro";
|
|
3
|
-
import LoginForm from "../components/members/LoginForm";
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
<SiteLayout title="Log in">
|
|
7
|
-
<section class="mx-auto max-w-md">
|
|
8
|
-
<h1 class="mb-6 text-2xl font-semibold">Welcome</h1>
|
|
9
|
-
<LoginForm client:only="react" />
|
|
10
|
-
</section>
|
|
11
|
-
</SiteLayout>
|