@wix/agent-skills 1.20.1 → 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 +71 -113
- package/skills/wix-app/references/APP_TOOLS.md +2 -1
- package/skills/wix-app/references/BACKEND_EVENT.md +3 -3
- package/skills/wix-app/references/CUSTOM_ELEMENT_WIDGET.md +41 -152
- package/skills/wix-app/references/DASHBOARD_MODAL.md +4 -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/SDK_MODULE_MAP.md +44 -0
- package/skills/wix-app/references/SITE_PLUGIN.md +36 -190
- package/skills/wix-app/references/app-tools/TOOLS.md +3 -1
- package/skills/wix-app/references/custom-element-widget/SETTINGS_PANEL.md +21 -0
- package/skills/wix-app/references/dashboard-page/DATA_SOURCES.md +182 -0
- package/skills/wix-app/references/dashboard-page/DRAFT_TEMPLATE.md +97 -0
- package/skills/wix-app/references/dashboard-page/DRAFT_TEMPLATE_COLLECTION.md +184 -0
- package/skills/wix-app/references/dashboard-page/DRAFT_TEMPLATE_ROUTER.md +203 -0
- package/skills/wix-app/references/dashboard-page/DRAFT_TEMPLATE_SETTINGS.md +44 -0
- package/skills/wix-app/references/dashboard-page/ECOM_NAVIGATION.md +17 -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/dashboard-plugin/SLOTS.md +4 -18
- 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-app/references/site-plugin/EXAMPLES.md +1 -1
- package/skills/wix-headless-fast/SKILL.md +144 -221
- package/skills/wix-headless-fast/cold-start/bootstrap.mjs +156 -0
- package/skills/wix-headless-fast/{entry/skill.md → cold-start/cold-start.md} +15 -15
- 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 +35 -0
- package/skills/wix-headless-fast/install/agents-md.mjs +39 -0
- package/skills/wix-headless-fast/install/attach.mjs +161 -86
- 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 +259 -0
- package/skills/wix-headless-fast/install/templates.mjs +168 -0
- package/skills/wix-manage/references/ecommerce/pricing-promotions/ecom-pricing-create-coupon.md +10 -19
- package/skills/wix-manage/references/events/create-wix-event.md +5 -1
- 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/install/fast-path.mjs +0 -181
- package/skills/wix-headless-fast/references/blog/INSTRUCTIONS.md +0 -301
- 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/seed-blog.mjs +0 -287
- package/skills/wix-headless-fast/references/bookings/INSTRUCTIONS.md +0 -275
- 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/seed-bookings.mjs +0 -302
- package/skills/wix-headless-fast/references/cms/INSTRUCTIONS.md +0 -353
- 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/seed-cms.mjs +0 -324
- package/skills/wix-headless-fast/references/events/INSTRUCTIONS.md +0 -305
- 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/seed-events.mjs +0 -276
- package/skills/wix-headless-fast/references/forms/INSTRUCTIONS.md +0 -338
- 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/seed-forms.mjs +0 -327
- package/skills/wix-headless-fast/references/members/INSTRUCTIONS.md +0 -314
- 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/seed-members.mjs +0 -94
- package/skills/wix-headless-fast/references/portfolio/INSTRUCTIONS.md +0 -313
- 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/seed-portfolio.mjs +0 -258
- package/skills/wix-headless-fast/references/pricing-plans/INSTRUCTIONS.md +0 -294
- 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/seed-pricing-plans.mjs +0 -279
- package/skills/wix-headless-fast/references/restaurants/INSTRUCTIONS.md +0 -358
- 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/seed-restaurants.mjs +0 -479
- 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/storefront/INSTRUCTIONS.md +0 -608
- 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 -309
- 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 -167
- 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 -124
- package/skills/wix-headless-fast/references/storefront/seed/seed-store.mjs +0 -525
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
// Portfolio reads over REST — the twin of app/wix/portfolio/portfolio.ts. Same exports, same DTOs;
|
|
2
|
-
// the rules and mappers come from portfolio-core (the SAME file the SDK transport uses, deployed
|
|
3
|
-
// flat next to this one by deploy.mjs --stack static), so this file is only the transport: one
|
|
4
|
-
// fetch with a literal URL and body per function. Every call here is a public read, safe from a
|
|
5
|
-
// browser with a visitor token. Porting: keep the paths, keep the bodies, port the core once.
|
|
6
|
-
// docs: https://dev.wix.com/docs/api-reference/business-solutions/portfolio/collections/list-collections.md
|
|
7
|
-
// docs: https://dev.wix.com/docs/api-reference/business-solutions/portfolio/collections/query-collections.md
|
|
8
|
-
// docs: https://dev.wix.com/docs/api-reference/business-solutions/portfolio/projects/list-projects.md
|
|
9
|
-
// docs: https://dev.wix.com/docs/api-reference/business-solutions/portfolio/projects/query-projects.md
|
|
10
|
-
// docs: https://dev.wix.com/docs/api-reference/business-solutions/portfolio/project-items/list-project-items.md
|
|
11
|
-
import { wixRequest } from "./client.js";
|
|
12
|
-
import { imgSrc } from "./media.js";
|
|
13
|
-
import {
|
|
14
|
-
galleryItems,
|
|
15
|
-
visibleCollection,
|
|
16
|
-
visibleCollections,
|
|
17
|
-
visibleProject,
|
|
18
|
-
visibleProjects,
|
|
19
|
-
type Raw,
|
|
20
|
-
type VideoSrc,
|
|
21
|
-
} from "./portfolio-core.js";
|
|
22
|
-
import type { CollectionSummary, GalleryItem, ProjectDetail, ProjectSummary } from "./types.js";
|
|
23
|
-
|
|
24
|
-
// REST never returns the bare wix:video:// string — videoInfo arrives as { resolutions, posters },
|
|
25
|
-
// which the core reads directly. A string here has no resolver on this transport → dropped.
|
|
26
|
-
const videoSrc: VideoSrc = () => null;
|
|
27
|
-
|
|
28
|
-
/** Visible collections in dashboard order. GET /portfolio/v1/collections?paging.limit=N → { collections } */
|
|
29
|
-
export async function fetchCollections({ limit = 100 } = {}): Promise<CollectionSummary[]> {
|
|
30
|
-
const res = await wixRequest<Raw>("/portfolio/v1/collections", { method: "GET", query: { "paging.limit": String(limit) } });
|
|
31
|
-
return visibleCollections((res?.collections ?? []) as Raw[], imgSrc);
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
/**
|
|
35
|
-
* One visible collection by URL slug; null when missing or hidden → a real 404.
|
|
36
|
-
* POST /portfolio/v1/collections/query { query: { filter: { slug }, cursorPaging: { limit: 1 } } } → { collections }
|
|
37
|
-
*/
|
|
38
|
-
export async function fetchCollectionBySlug(slug: string): Promise<CollectionSummary | null> {
|
|
39
|
-
const res = await wixRequest<Raw>("/portfolio/v1/collections/query", {
|
|
40
|
-
body: { query: { filter: { slug }, cursorPaging: { limit: 1 } } },
|
|
41
|
-
});
|
|
42
|
-
return visibleCollection(res?.collections?.[0] as Raw | undefined, imgSrc);
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
/** Visible projects in list order, optionally one collection's. GET /portfolio/v1/projects?paging.limit=N → { projects } */
|
|
46
|
-
export async function fetchProjects({
|
|
47
|
-
collectionId,
|
|
48
|
-
limit = 100,
|
|
49
|
-
}: { collectionId?: string; limit?: number } = {}): Promise<ProjectSummary[]> {
|
|
50
|
-
const res = await wixRequest<Raw>("/portfolio/v1/projects", { method: "GET", query: { "paging.limit": String(limit) } });
|
|
51
|
-
return visibleProjects((res?.projects ?? []) as Raw[], collectionId, imgSrc, videoSrc);
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
/**
|
|
55
|
-
* One visible project with its details rows by URL slug; null when missing or hidden.
|
|
56
|
-
* POST /portfolio/v1/projects/query { query: { filter: { slug }, cursorPaging: { limit: 1 } } } → { projects }
|
|
57
|
-
*/
|
|
58
|
-
export async function fetchProjectBySlug(slug: string): Promise<ProjectDetail | null> {
|
|
59
|
-
const res = await wixRequest<Raw>("/portfolio/v1/projects/query", {
|
|
60
|
-
body: { query: { filter: { slug }, cursorPaging: { limit: 1 } } },
|
|
61
|
-
});
|
|
62
|
-
return visibleProject(res?.projects?.[0] as Raw | undefined, imgSrc, videoSrc);
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
/**
|
|
66
|
-
* A project's gallery in dashboard order; IMAGE and VIDEO items only.
|
|
67
|
-
* GET /portfolio/v1/projectItems/{projectId}/items?paging.limit=100 → { items }
|
|
68
|
-
*/
|
|
69
|
-
export async function fetchProjectGallery(projectId: string): Promise<GalleryItem[]> {
|
|
70
|
-
const res = await wixRequest<Raw>(`/portfolio/v1/projectItems/${encodeURIComponent(projectId)}/items`, {
|
|
71
|
-
method: "GET",
|
|
72
|
-
query: { "paging.limit": "100" },
|
|
73
|
-
});
|
|
74
|
-
return galleryItems((res?.items ?? []) as Raw[], imgSrc, videoSrc);
|
|
75
|
-
}
|
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
# Portfolio — seeding
|
|
2
|
-
|
|
3
|
-
Seed by **running `seed-portfolio.mjs` with a plan file** — don't hand-write the REST calls.
|
|
4
|
-
The script mints its own site token via the Wix CLI (logged-in session + `wix.config.json`
|
|
5
|
-
required), installs the Portfolio app if needed, and creates everything in the right order:
|
|
6
|
-
collections first (a project's `collectionIds` are NOT validated — a wrong id silently
|
|
7
|
-
orphans the project), then projects, gallery items, and covers.
|
|
8
|
-
|
|
9
|
-
```bash
|
|
10
|
-
# from the project root (where wix.config.json lives):
|
|
11
|
-
node <SKILL_ROOT>/references/portfolio/seed/seed-portfolio.mjs plan.json
|
|
12
|
-
```
|
|
13
|
-
|
|
14
|
-
`plan.json` is plain data — write it from the brief. **Default to 2 collections × 2 projects
|
|
15
|
-
each** (the seed shows the shape; the owner adds the rest in the dashboard) and make them
|
|
16
|
-
exercise the UI: every collection and project gets a cover, every project gets 2–3 gallery
|
|
17
|
-
`items` (a portfolio without images looks broken), and a couple of projects get `details`
|
|
18
|
-
rows (Role, Year, Client…).
|
|
19
|
-
|
|
20
|
-
```json
|
|
21
|
-
{
|
|
22
|
-
"collections": [
|
|
23
|
-
{ "title": "Brand Identity", "description": "Logo systems and visual identities.",
|
|
24
|
-
"coverImageUrl": "https://…" },
|
|
25
|
-
{ "title": "Editorial", "description": "Print and digital editorial design.",
|
|
26
|
-
"coverImageUrl": "https://…" }
|
|
27
|
-
],
|
|
28
|
-
"projects": [
|
|
29
|
-
{ "title": "Northwind Rebrand", "description": "Full identity refresh for a logistics firm.",
|
|
30
|
-
"collection": "Brand Identity",
|
|
31
|
-
"details": [ { "label": "Role", "text": "Brand & Art Direction" }, { "label": "Year", "text": "2025" } ],
|
|
32
|
-
"coverImageUrl": "https://…",
|
|
33
|
-
"items": [
|
|
34
|
-
{ "sortOrder": 1, "title": "Logo system", "imageUrl": "https://…" },
|
|
35
|
-
{ "sortOrder": 2, "title": "Stationery", "imageUrl": "https://…" }
|
|
36
|
-
] },
|
|
37
|
-
{ "title": "Harbor Coffee", "description": "Packaging and label suite.",
|
|
38
|
-
"collection": "Brand Identity", "coverImageUrl": "https://…",
|
|
39
|
-
"items": [ { "sortOrder": 1, "title": "Label set", "imageUrl": "https://…" } ] },
|
|
40
|
-
{ "title": "Field Notes Quarterly", "description": "Magazine layout and typography.",
|
|
41
|
-
"collection": "Editorial", "coverImageUrl": "https://…",
|
|
42
|
-
"items": [ { "sortOrder": 1, "title": "Spread", "imageUrl": "https://…" } ] },
|
|
43
|
-
{ "title": "City Guides", "description": "Travel series covers.",
|
|
44
|
-
"collection": "Editorial", "coverImageUrl": "https://…",
|
|
45
|
-
"items": [ { "sortOrder": 1, "title": "Covers", "imageUrl": "https://…" } ] }
|
|
46
|
-
]
|
|
47
|
-
}
|
|
48
|
-
```
|
|
49
|
-
|
|
50
|
-
- `collection` — a collection **title from this plan**; resolved to its created id. A project
|
|
51
|
-
without one belongs to no collection (reachable only from an all-projects list).
|
|
52
|
-
- `details` — optional `[{ label, text }]` rows; render on the project page. Omit for none.
|
|
53
|
-
- Every image field's default is a prompt (`coverImagePrompt` / `items[].imagePrompt` —
|
|
54
|
-
AI-generated, ~1 Wix AI credit per image, account-billed): brand-contextual — subject,
|
|
55
|
-
aesthetic/mood, palette, lighting — always ending "no text, no watermarks". At least one image in the set shows the real subject of the business — the actual product/space/service, not abstract decoration. For an asset the user actually supplied
|
|
56
|
-
use a path (`coverImagePath` / `items[].imagePath` — a file on this machine, uploaded to
|
|
57
|
-
Wix Media) or a url (`coverImageUrl` / `items[].imageUrl` — their own hosted URL; verify it
|
|
58
|
-
with `curl -sI` → 200) — never a stock-photo or guessed URL. All images —
|
|
59
|
-
covers and gallery items alike — resolve in one parallel wave and never block the seed; a
|
|
60
|
-
failed image skips just that item/cover. The **cover** is the
|
|
61
|
-
listing thumbnail; **items** are the detail-page gallery — separate entities, both wanted.
|
|
62
|
-
If a project has only a cover, reuse its url as item 1 so the gallery isn't empty.
|
|
63
|
-
- `sortOrder` (1, 2, 3…) sets the gallery render order.
|
|
64
|
-
- `hidden` defaults to shown — omit it; send `hidden: true` only to hide an entity.
|
|
65
|
-
- Gallery items seed as images only; the owner adds videos in the dashboard.
|
|
66
|
-
- A fresh Portfolio install ships sample content ("My Portfolio" + sample projects). **Seeding
|
|
67
|
-
is additive — never delete or overwrite existing content**; if removing the samples seems
|
|
68
|
-
wanted, ask the owner first.
|
|
69
|
-
|
|
70
|
-
## Supplied content
|
|
71
|
-
|
|
72
|
-
The general rules are in `references/shared/SUPPLIED-CONTENT.md`. For a portfolio, each project the
|
|
73
|
-
user lists is one entry. Its title becomes `title`; its category or series becomes `collection`
|
|
74
|
-
(and joins the `collections` list); client, role, year and similar facts become `details`; their
|
|
75
|
-
cover image becomes `coverImageUrl`; their project images become `items` in the order given. A
|
|
76
|
-
photo with no caption gets its file name as `title`.
|
|
77
|
-
|
|
78
|
-
## Escape hatch — individual functions
|
|
79
|
-
`setupPortfolio` composes exported steps — `installPortfolioApp`, `createCollections`,
|
|
80
|
-
`createProjects`, `importImage`, `attachProjectCovers`, `attachCollectionCovers`,
|
|
81
|
-
`createProjectItems`, `listCollections`, `listProjects`, plus `makeCtx()` — import them only
|
|
82
|
-
for a partial re-seed.
|
|
83
|
-
|
|
84
|
-
## Reference
|
|
85
|
-
Unexpected shape or an uncovered operation → read the live Wix API reference; the
|
|
86
|
-
authoritative source recipe is `wix-headless/references/inline-recipes/setup-portfolio.md`.
|
|
@@ -1,258 +0,0 @@
|
|
|
1
|
-
// Portfolio seed — a BUILD-TIME script, never shipped in the app. Run from the project root
|
|
2
|
-
// (where wix.config.json lives) with a plan file:
|
|
3
|
-
//
|
|
4
|
-
// node <SKILL_ROOT>/references/portfolio/seed/seed-portfolio.mjs plan.json
|
|
5
|
-
//
|
|
6
|
-
// It mints its own site token via the Wix CLI, installs the Wix Portfolio app if needed,
|
|
7
|
-
// creates collections then projects (collections FIRST — a project's collectionIds are NOT
|
|
8
|
-
// validated, so a wrong id is silently accepted and orphans the project), creates each
|
|
9
|
-
// project's gallery items, and imports+attaches cover images. Prints a JSON result to stdout.
|
|
10
|
-
//
|
|
11
|
-
// Plan shape (see SEED.md):
|
|
12
|
-
// { "collections": [{ "title", "description"?, "hidden"?, "coverImageUrl"? | "coverImagePrompt"? }],
|
|
13
|
-
// "projects": [{ "title", "description"?, "hidden"?,
|
|
14
|
-
// "collection"? (title), // resolved to that collection's id
|
|
15
|
-
// "details"?: [{ "label", "text" }],
|
|
16
|
-
// "coverImageUrl"? | "coverImagePrompt"?,
|
|
17
|
-
// "items"?: [{ "sortOrder", "title"?, "imageUrl" | "imagePrompt" }] }] }
|
|
18
|
-
//
|
|
19
|
-
// Seeding is ADDITIVE — never deletes or overwrites existing content. A fresh Portfolio
|
|
20
|
-
// install ships its own sample content ("My Portfolio" + sample projects); removing it is the
|
|
21
|
-
// owner's call, not this script's. Unexpected shapes → read the live API reference;
|
|
22
|
-
// authoritative source recipe: wix-headless/references/inline-recipes/setup-portfolio.md.
|
|
23
|
-
import { execFileSync } from "node:child_process";
|
|
24
|
-
import { readFileSync } from "node:fs";
|
|
25
|
-
import { resolveItemImages } from "../../shared/seed/images.mjs";
|
|
26
|
-
|
|
27
|
-
const API = "https://www.wixapis.com";
|
|
28
|
-
const PORTFOLIO_APP_ID = "d90652a2-f5a1-4c7c-84c4-d4cdcc41f130";
|
|
29
|
-
|
|
30
|
-
export function makeCtx({ cwd = process.cwd() } = {}) {
|
|
31
|
-
const config = JSON.parse(readFileSync(`${cwd}/wix.config.json`, "utf8"));
|
|
32
|
-
const siteId = config.siteId ?? config.projectId;
|
|
33
|
-
if (!siteId) throw new Error("wix.config.json has no siteId — is this a Wix CLI project?");
|
|
34
|
-
const token = execFileSync("npx", ["@wix/cli@latest", "token", "--site", siteId], {
|
|
35
|
-
encoding: "utf8",
|
|
36
|
-
cwd,
|
|
37
|
-
}).trim();
|
|
38
|
-
if (!token) throw new Error("The Wix CLI returned no token — run `npx @wix/cli@latest login` first.");
|
|
39
|
-
return { token, siteId };
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
async function req(ctx, path, { method = "POST", body } = {}) {
|
|
43
|
-
const res = await fetch(API + path, {
|
|
44
|
-
method,
|
|
45
|
-
headers: {
|
|
46
|
-
Authorization: `Bearer ${ctx.token}`,
|
|
47
|
-
"wix-site-id": ctx.siteId,
|
|
48
|
-
"Content-Type": "application/json",
|
|
49
|
-
},
|
|
50
|
-
body: body ? JSON.stringify(body) : undefined,
|
|
51
|
-
});
|
|
52
|
-
const json = await res.json().catch(() => ({}));
|
|
53
|
-
if (!res.ok) throw new Error(`${method} ${path} -> ${res.status}: ${JSON.stringify(json).slice(0, 400)}`);
|
|
54
|
-
return json;
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
// ---- operations ----------------------------------------------------------------------------------
|
|
58
|
-
|
|
59
|
-
// Idempotent — re-installing returns 200.
|
|
60
|
-
// docs: https://dev.wix.com/docs/api-reference/articles/work-with-wix-apis/platform/about-apps-created-by-wix.md
|
|
61
|
-
export async function installPortfolioApp(ctx) {
|
|
62
|
-
try {
|
|
63
|
-
await req(ctx, "/apps-installer-service/v1/app-instance/install", { body: {
|
|
64
|
-
tenant: { tenantType: "SITE", id: ctx.siteId },
|
|
65
|
-
appInstance: { appDefId: PORTFOLIO_APP_ID, enabled: true },
|
|
66
|
-
} });
|
|
67
|
-
} catch {
|
|
68
|
-
/* already installed is fine */
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
// Read-only listing helpers (partial re-seeds, verification).
|
|
73
|
-
// docs: https://dev.wix.com/docs/api-reference/business-solutions/portfolio/collections/list-collections.md
|
|
74
|
-
export async function listCollections(ctx) {
|
|
75
|
-
const r = await req(ctx, "/portfolio/v1/collections", { method: "GET" });
|
|
76
|
-
return (r.collections ?? []).map((c) => ({ id: c.id, title: c.title, slug: c.slug }));
|
|
77
|
-
}
|
|
78
|
-
// docs: https://dev.wix.com/docs/api-reference/business-solutions/portfolio/projects/list-projects.md
|
|
79
|
-
export async function listProjects(ctx) {
|
|
80
|
-
const r = await req(ctx, "/portfolio/v1/projects", { method: "GET" });
|
|
81
|
-
return (r.projects ?? []).map((p) => ({ id: p.id, title: p.title, slug: p.slug }));
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
// STEP 1 — collections. The display name is `title`, not `name`; `slug` auto-generates from
|
|
85
|
-
// the title; `hidden` defaults to false = shown (omit it — send true only to hide). No
|
|
86
|
-
// bulk-create: one call per collection.
|
|
87
|
-
// docs: https://dev.wix.com/docs/api-reference/business-solutions/portfolio/collections/create-collection.md
|
|
88
|
-
export async function createCollections(ctx, collections) {
|
|
89
|
-
const out = [];
|
|
90
|
-
for (const c of collections) {
|
|
91
|
-
const body = { collection: { title: c.title, description: c.description } };
|
|
92
|
-
if (c.hidden) body.collection.hidden = true;
|
|
93
|
-
const r = await req(ctx, "/portfolio/v1/collections", { body });
|
|
94
|
-
out.push({ id: r.collection?.id, slug: r.collection?.slug, revision: r.collection?.revision });
|
|
95
|
-
}
|
|
96
|
-
return out;
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
// STEP 2 — projects, AFTER collections: collectionIds must hold real ids from createCollections
|
|
100
|
-
// (they are NOT validated — a wrong/missing id silently orphans the project). `details` is an
|
|
101
|
-
// optional [{ label, text }] array. No bulk-create: one call per project.
|
|
102
|
-
// docs: https://dev.wix.com/docs/api-reference/business-solutions/portfolio/projects/create-project.md
|
|
103
|
-
export async function createProjects(ctx, projects) {
|
|
104
|
-
const out = [];
|
|
105
|
-
for (const p of projects) {
|
|
106
|
-
const project = {
|
|
107
|
-
title: p.title,
|
|
108
|
-
description: p.description,
|
|
109
|
-
collectionIds: p.collectionIds ?? [],
|
|
110
|
-
};
|
|
111
|
-
if (p.details) project.details = p.details;
|
|
112
|
-
if (p.hidden) project.hidden = true;
|
|
113
|
-
const r = await req(ctx, "/portfolio/v1/projects", { body: { project } });
|
|
114
|
-
out.push({ id: r.project?.id, slug: r.project?.slug, revision: r.project?.revision });
|
|
115
|
-
}
|
|
116
|
-
return out;
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
// Portfolio binds covers + gallery items by Wix Media file ID — an external url must be
|
|
120
|
-
// imported first (a raw url renders nothing); a plan `imagePrompt`/`coverImagePrompt` is
|
|
121
|
-
// generated (Wix AI, 1 credit) then imported. Both live in the shared util (parallel,
|
|
122
|
-
// resilient, never blocks the seed).
|
|
123
|
-
export { importImage } from "../../shared/seed/images.mjs";
|
|
124
|
-
|
|
125
|
-
// Cover = the listing-card thumbnail. PATCH per entity, echoing the current revision (missing/
|
|
126
|
-
// stale revision fails); height + width are required alongside the imported file id.
|
|
127
|
-
// docs: https://dev.wix.com/docs/api-reference/business-solutions/portfolio/projects/update-project.md
|
|
128
|
-
export async function attachProjectCovers(ctx, items) {
|
|
129
|
-
for (const it of items) {
|
|
130
|
-
await req(ctx, `/portfolio/v1/projects/${it.id}`, {
|
|
131
|
-
method: "PATCH",
|
|
132
|
-
body: { project: { id: it.id, revision: it.revision, coverImage: { imageInfo: { id: it.imageId, height: it.height, width: it.width } } } },
|
|
133
|
-
});
|
|
134
|
-
}
|
|
135
|
-
}
|
|
136
|
-
// docs: https://dev.wix.com/docs/api-reference/business-solutions/portfolio/collections/update-collection.md
|
|
137
|
-
export async function attachCollectionCovers(ctx, items) {
|
|
138
|
-
for (const it of items) {
|
|
139
|
-
await req(ctx, `/portfolio/v1/collections/${it.id}`, {
|
|
140
|
-
method: "PATCH",
|
|
141
|
-
body: { collection: { id: it.id, revision: it.revision, coverImage: { imageInfo: { id: it.imageId, height: it.height, width: it.width } } } },
|
|
142
|
-
});
|
|
143
|
-
}
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
// The detail-page gallery is a SEPARATE `item` entity — one POST per image; sortOrder (1,2,3…)
|
|
147
|
-
// sets render order. Lowercase `items` — `/Items` 404s. There is NO public list endpoint.
|
|
148
|
-
// docs: https://dev.wix.com/docs/api-reference/business-solutions/portfolio/project-items/create-project-item.md
|
|
149
|
-
export async function createProjectItems(ctx, items) {
|
|
150
|
-
const out = [];
|
|
151
|
-
for (const it of items) {
|
|
152
|
-
const r = await req(ctx, "/portfolio/v1/items", {
|
|
153
|
-
body: { item: { projectId: it.projectId, sortOrder: it.sortOrder, title: it.title, image: { imageInfo: { id: it.imageId, height: it.height, width: it.width } } } },
|
|
154
|
-
});
|
|
155
|
-
out.push({ id: r.item?.id });
|
|
156
|
-
}
|
|
157
|
-
return out;
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
/**
|
|
161
|
-
* ONE-CALL seed: install → collections → projects (into collections) → gallery items →
|
|
162
|
-
* covers, ids threaded in memory. The default path.
|
|
163
|
-
*/
|
|
164
|
-
export async function setupPortfolio(ctx, { collections = [], projects = [] } = {}) {
|
|
165
|
-
await installPortfolioApp(ctx);
|
|
166
|
-
|
|
167
|
-
const cols = await createCollections(ctx, collections);
|
|
168
|
-
const idByTitle = new Map(collections.map((c, i) => [c.title, cols[i].id]));
|
|
169
|
-
|
|
170
|
-
const projs = await createProjects(
|
|
171
|
-
ctx,
|
|
172
|
-
projects.map((p) => ({
|
|
173
|
-
title: p.title,
|
|
174
|
-
description: p.description,
|
|
175
|
-
details: p.details,
|
|
176
|
-
hidden: p.hidden,
|
|
177
|
-
collectionIds: p.collection ? [idByTitle.get(p.collection)].filter(Boolean) : [],
|
|
178
|
-
})),
|
|
179
|
-
);
|
|
180
|
-
|
|
181
|
-
// Pass 2 — images: gallery items + project covers + collection covers, flattened into ONE
|
|
182
|
-
// parallel wave (import by url / generate by prompt), then mapped back to each attach.
|
|
183
|
-
// A failed image skips just that item/cover; the seed's exit never depends on images.
|
|
184
|
-
const specs = [];
|
|
185
|
-
const galleryRefs = [];
|
|
186
|
-
projects.forEach((p, pi) => {
|
|
187
|
-
for (const it of p.items ?? []) {
|
|
188
|
-
galleryRefs.push({ pi, it, spec: specs.length });
|
|
189
|
-
specs.push({ path: it.imagePath, url: it.imageUrl, prompt: it.imagePrompt, displayName: `${it.title || "item"}.png` });
|
|
190
|
-
}
|
|
191
|
-
});
|
|
192
|
-
const projCoverAt = specs.length;
|
|
193
|
-
projects.forEach((p) => specs.push({ path: p.coverImagePath, url: p.coverImageUrl, prompt: p.coverImagePrompt, displayName: `${p.title || "project"}-cover.png` }));
|
|
194
|
-
const colCoverAt = specs.length;
|
|
195
|
-
collections.forEach((c) => specs.push({ path: c.coverImagePath, url: c.coverImageUrl, prompt: c.coverImagePrompt, displayName: `${c.title || "collection"}-cover.png` }));
|
|
196
|
-
const files = await resolveItemImages(ctx, specs);
|
|
197
|
-
const dims = { height: 1024, width: 1024 };
|
|
198
|
-
|
|
199
|
-
const itemsFlat = galleryRefs
|
|
200
|
-
.map(({ pi, it, spec }) => (files[spec] && projs[pi]?.id
|
|
201
|
-
? { projectId: projs[pi].id, sortOrder: it.sortOrder, title: it.title, imageId: files[spec].id, ...dims }
|
|
202
|
-
: null))
|
|
203
|
-
.filter(Boolean);
|
|
204
|
-
let items = [];
|
|
205
|
-
try {
|
|
206
|
-
if (itemsFlat.length) items = await createProjectItems(ctx, itemsFlat);
|
|
207
|
-
} catch {
|
|
208
|
-
/* the remaining gallery items stay unseeded */
|
|
209
|
-
}
|
|
210
|
-
|
|
211
|
-
const projCovers = projs
|
|
212
|
-
.map((p, i) => (files[projCoverAt + i] && p.id
|
|
213
|
-
? { id: p.id, revision: p.revision, imageId: files[projCoverAt + i].id, ...dims }
|
|
214
|
-
: null))
|
|
215
|
-
.filter(Boolean);
|
|
216
|
-
const colCovers = cols
|
|
217
|
-
.map((c, i) => (files[colCoverAt + i] && c.id
|
|
218
|
-
? { id: c.id, revision: c.revision, imageId: files[colCoverAt + i].id, ...dims }
|
|
219
|
-
: null))
|
|
220
|
-
.filter(Boolean);
|
|
221
|
-
let coversAttached = 0;
|
|
222
|
-
try {
|
|
223
|
-
if (projCovers.length) { await attachProjectCovers(ctx, projCovers); coversAttached += projCovers.length; }
|
|
224
|
-
} catch {
|
|
225
|
-
/* those projects stay cover-less */
|
|
226
|
-
}
|
|
227
|
-
try {
|
|
228
|
-
if (colCovers.length) { await attachCollectionCovers(ctx, colCovers); coversAttached += colCovers.length; }
|
|
229
|
-
} catch {
|
|
230
|
-
/* those collections stay cover-less */
|
|
231
|
-
}
|
|
232
|
-
|
|
233
|
-
return {
|
|
234
|
-
collections: cols,
|
|
235
|
-
projects: projs,
|
|
236
|
-
itemsCreated: items.length,
|
|
237
|
-
coversAttached,
|
|
238
|
-
};
|
|
239
|
-
}
|
|
240
|
-
|
|
241
|
-
// ---- CLI entry ----------------------------------------------------------------------------------
|
|
242
|
-
|
|
243
|
-
const invokedDirectly = process.argv[1] && import.meta.url.endsWith(process.argv[1].split("/").pop());
|
|
244
|
-
if (invokedDirectly) {
|
|
245
|
-
const planPath = process.argv[2];
|
|
246
|
-
if (!planPath) {
|
|
247
|
-
console.error("usage: node seed-portfolio.mjs <plan.json> (run from the project root)");
|
|
248
|
-
process.exit(1);
|
|
249
|
-
}
|
|
250
|
-
const plan = JSON.parse(readFileSync(planPath, "utf8"));
|
|
251
|
-
const ctx = makeCtx();
|
|
252
|
-
setupPortfolio(ctx, plan)
|
|
253
|
-
.then((result) => console.log(JSON.stringify(result, null, 2)))
|
|
254
|
-
.catch((e) => {
|
|
255
|
-
console.error(e.message);
|
|
256
|
-
process.exit(1);
|
|
257
|
-
});
|
|
258
|
-
}
|