@wix/agent-skills 1.15.0 → 1.16.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -1
- package/package.json +1 -1
- package/skills/wix-app/SKILL.md +4 -1
- package/skills/wix-app/references/APP_TOOLS.md +134 -0
- package/skills/wix-app/references/CUSTOM_ELEMENT_WIDGET.md +1 -1
- package/skills/wix-app/references/DASHBOARD_PAGE.md +0 -10
- package/skills/wix-app/references/DATA_COLLECTION.md +6 -4
- package/skills/wix-app/references/EDITOR_REACT_COMPONENT.md +28 -7
- package/skills/wix-app/references/SERVICE_PLUGIN.md +12 -10
- package/skills/wix-app/references/STORES_VERSIONING.md +9 -211
- package/skills/wix-app/references/app-tools/TOOLS.md +75 -0
- package/skills/wix-app/references/backend-event/COMMON-EVENTS.md +5 -0
- package/skills/wix-app/references/dashboard-page/DASHBOARD_API.md +2 -2
- package/skills/wix-app/references/editor-react-component/A11Y-REVIEW-REFERENCE.md +172 -0
- package/skills/wix-app/references/editor-react-component/A11Y-REVIEW.md +138 -0
- package/skills/wix-app/references/editor-react-component/ANIMATED-COMPONENTS.md +172 -0
- package/skills/wix-app/references/editor-react-component/BRANDED-COMPONENTS.md +29 -0
- package/skills/wix-app/references/editor-react-component/COMPONENT-API.md +1 -1
- package/skills/wix-app/references/editor-react-component/COMPONENT-PREVIEW.md +57 -0
- package/skills/wix-app/references/editor-react-component/CSS-GUIDELINES.md +33 -2
- package/skills/wix-app/references/editor-react-component/DESIGN-STATES.md +5 -3
- package/skills/wix-app/references/editor-react-component/DIRECTIONALITY.md +18 -1
- package/skills/wix-app/references/editor-react-component/PARTS.md +15 -2
- package/skills/wix-app/references/editor-react-component/REACT-GUIDELINES.md +4 -3
- package/skills/wix-app/references/service-plugin/BOOKINGS-STAFF-SORTING.md +13 -9
- package/skills/wix-app/references/service-plugin/DISCOUNT-TRIGGERS.md +4 -0
- package/skills/wix-app/references/service-plugin/GIFT-CARDS.md +4 -0
- package/skills/wix-app/references/service-plugin/PAYMENT-SETTINGS.md +3 -1
- package/skills/wix-app/references/service-plugin/SHIPPING-RATES.md +4 -0
- package/skills/wix-app/references/service-plugin/TOOLS_PROVIDER.md +54 -0
- package/skills/wix-app/references/stores/CATEGORIES.md +22 -0
- package/skills/wix-app/references/stores/GET_PRODUCT.md +99 -0
- package/skills/wix-app/references/stores/INVENTORY.md +37 -0
- package/skills/wix-app/references/stores/QUERY.md +119 -0
- package/skills/wix-app/references/stores/WRITE.md +55 -0
- package/skills/wix-docs/SKILL.md +35 -3
- package/skills/wix-headless/SKILL.md +9 -2
- package/skills/wix-headless/entry/bootstrap.mjs +2 -2
- package/skills/wix-headless/entry/skill.md +0 -2
- package/skills/wix-headless/references/CAPABILITIES.md +6 -4
- package/skills/wix-headless/references/CONTENT.md +36 -0
- package/skills/wix-headless/references/DESIGN.md +54 -0
- package/skills/wix-headless/references/DISCOVERY.md +25 -1
- package/skills/wix-headless/references/FEEDBACK.md +16 -5
- package/skills/wix-headless/references/IMAGE_GENERATION.md +10 -0
- package/skills/wix-headless/references/SDK_HANDOFF.md +2 -0
- package/skills/wix-headless/references/SEED.md +3 -1
- package/skills/wix-headless/references/SETUP.md +1 -1
- package/skills/wix-headless/references/inline-recipes/how-to-code-a-store.md +3 -2
- package/skills/wix-headless/references/inline-recipes/how-to-code-restaurant-reservations.md +42 -2
- package/skills/wix-headless/references/inline-recipes/setup-bookings.md +5 -1
- package/skills/wix-headless/references/inline-recipes/setup-forms.md +1 -1
- package/skills/wix-headless/references/inline-recipes/setup-online-store.md +33 -8
- package/skills/wix-headless/references/inline-recipes/setup-portfolio.md +3 -1
- package/skills/wix-headless/references/inline-recipes/setup-restaurant-experiences.md +73 -0
- package/skills/wix-headless/references/inline-recipes/setup-restaurant-orders.md +38 -2
- package/skills/wix-headless/references/inline-recipes/setup-restaurant-reservations.md +20 -1
- package/skills/wix-headless/references/inline-recipes/setup-restaurants.md +1 -1
- package/skills/wix-headless/references/managed/CONNECT.md +2 -2
- package/skills/wix-headless/references/managed/CREATE.md +15 -1
- package/skills/wix-headless/references/managed/DEPLOYMENT.md +47 -0
- package/skills/wix-headless/references/self-managed/DEPLOYMENT.md +8 -0
- package/skills/wix-headless/references/stripe/DEPLOYMENT.md +8 -0
- package/skills/wix-manage/SKILL.md +131 -12
- package/skills/wix-manage/references/analytics/analytics-dashboard-navigation.md +41 -0
- package/skills/wix-manage/references/analytics/query-site-analytics.md +66 -9
- package/skills/wix-manage/references/app-installation/app-installation-dashboard-navigation.md +28 -0
- package/skills/wix-manage/references/app-installation/install-wix-apps.md +3 -0
- package/skills/wix-manage/references/blog/blog-dashboard-navigation.md +56 -0
- package/skills/wix-manage/references/blog/how-to-create-blog-posts.md +31 -6
- package/skills/wix-manage/references/bookings/booking-service-policy-setup.md +3 -1
- package/skills/wix-manage/references/bookings/bookings-dashboard-navigation.md +63 -0
- package/skills/wix-manage/references/bookings/create-booking-service-from-prompt.md +6 -5
- package/skills/wix-manage/references/bookings/create-course-service.md +30 -5
- package/skills/wix-manage/references/bookings/diagnose-availability-issues.md +85 -42
- package/skills/wix-manage/references/cms/cms-dashboard-navigation.md +44 -0
- package/skills/wix-manage/references/cms/cms-data-items-crud.md +31 -3
- package/skills/wix-manage/references/cms/cms-publishing-flow.md +287 -0
- package/skills/wix-manage/references/cms/cms-schema-management.md +33 -1
- package/skills/wix-manage/references/contacts/contacts-dashboard-navigation.md +46 -0
- package/skills/wix-manage/references/contacts/create-a-contact.md +82 -0
- package/skills/wix-manage/references/contacts/update-a-contact.md +119 -0
- package/skills/wix-manage/references/dashboard-navigation/dashboard-navigation.md +82 -0
- package/skills/wix-manage/references/dashboard-navigation/routes.json +1733 -0
- package/skills/wix-manage/references/domains/domains-dashboard-navigation.md +32 -0
- package/skills/wix-manage/references/ecommerce/ecom-pricing.md +4 -4
- package/skills/wix-manage/references/ecommerce/ecom-shipping.md +1 -1
- package/skills/wix-manage/references/ecommerce/gift-cards/ecom-gift-cards-goal-sell-gift-cards.md +338 -0
- package/skills/wix-manage/references/ecommerce/pricing-promotions/ecom-pricing-create-discount-rule.md +42 -78
- package/skills/wix-manage/references/ecommerce/pricing-promotions/ecom-pricing-flow-bundle-and-save.md +1 -1
- package/skills/wix-manage/references/ecommerce/pricing-promotions/ecom-pricing-flow-stock-mover.md +1 -1
- package/skills/wix-manage/references/ecommerce/pricing-promotions/ecom-pricing-flow-upsell-boost.md +1 -1
- package/skills/wix-manage/references/ecommerce/recommend-ecommerce-strategy.md +90 -92
- package/skills/wix-manage/references/events/create-wix-event.md +176 -0
- package/skills/wix-manage/references/events/manage-wix-events.md +174 -0
- package/skills/wix-manage/references/forms/forms-dashboard-navigation.md +44 -0
- package/skills/wix-manage/references/get-paid/get-paid-dashboard-navigation.md +52 -0
- package/skills/wix-manage/references/get-paid/how-to-setup-wix-payments.md +30 -7
- package/skills/wix-manage/references/google-ads/billing-and-payment.md +80 -0
- package/skills/wix-manage/references/google-ads/create-performance-max-campaign.md +212 -0
- package/skills/wix-manage/references/google-ads/get-campaign-suggestions.md +110 -0
- package/skills/wix-manage/references/google-ads/google-ads-dashboard-navigation.md +25 -0
- package/skills/wix-manage/references/google-ads/install-and-create-account.md +155 -0
- package/skills/wix-manage/references/google-ads/manage-campaign-lifecycle.md +63 -0
- package/skills/wix-manage/references/google-ads/query-campaign-analytics.md +155 -0
- package/skills/wix-manage/references/marketing/create-and-publish-social-post.md +225 -144
- package/skills/wix-manage/references/marketing/generate-and-publish-marketing-plan.md +19 -10
- package/skills/wix-manage/references/marketing/marketing-dashboard-navigation.md +52 -0
- package/skills/wix-manage/references/pricing-plans/create-and-update-pricing-plans.md +99 -1
- package/skills/wix-manage/references/pricing-plans/pricing-plans-dashboard-navigation.md +45 -0
- package/skills/wix-manage/references/restaurants/restaurants-dashboard-navigation.md +68 -0
- package/skills/wix-manage/references/restaurants/wix-restaurants-setup.md +94 -125
- package/skills/wix-manage/references/site-properties/change-payment-currency-site-properties.md +48 -9
- package/skills/wix-manage/references/site-properties/site-properties-dashboard-navigation.md +31 -0
- package/skills/wix-manage/references/sites/create-headless-site.md +52 -0
- package/skills/wix-manage/references/sites/create-site-from-template.md +2 -25
- package/skills/wix-manage/references/sites/site-import.md +243 -0
- package/skills/wix-manage/references/sites/sites-dashboard-navigation.md +29 -0
- package/skills/wix-manage/references/stores/add-store-pages-to-site.md +17 -1
- package/skills/wix-manage/references/stores/create-product-from-image.md +8 -6
- package/skills/wix-manage/references/stores/create-product-with-options-catalog-v3.md +16 -10
- package/skills/wix-manage/references/stores/find-products-query-and-search-catalog-v3.md +26 -8
- package/skills/wix-manage/references/stores/stores-dashboard-navigation.md +65 -0
- package/skills/wix-manage/references/stores/update-product-with-options.md +39 -7
- package/skills/wix-replatform/.publish-manifest.json +8 -0
- package/skills/wix-replatform/SKILL.md +693 -0
- package/skills/wix-replatform/lib/artifact-freshness.js +215 -0
- package/skills/wix-replatform/lib/completion-report.js +200 -0
- package/skills/wix-replatform/lib/config-env.js +59 -0
- package/skills/wix-replatform/lib/execution-manifest.js +185 -0
- package/skills/wix-replatform/lib/execution-state.js +173 -0
- package/skills/wix-replatform/lib/import-recovery.js +313 -0
- package/skills/wix-replatform/lib/local-state.js +642 -0
- package/skills/wix-replatform/lib/orchestration-preflight.js +143 -0
- package/skills/wix-replatform/lib/orchestration-router.js +122 -0
- package/skills/wix-replatform/lib/orchestration-state.js +455 -0
- package/skills/wix-replatform/lib/progress-log.js +224 -0
- package/skills/wix-replatform/lib/progress-log.sh +140 -0
- package/skills/wix-replatform/lib/url-preservation-state.js +391 -0
- package/skills/wix-replatform/resources/rp-discovery/SKILL.md +184 -0
- package/skills/wix-replatform/resources/rp-execute-import/SKILL.md +529 -0
- package/skills/wix-replatform/resources/rp-execute-setup/SKILL.md +316 -0
- package/skills/wix-replatform/resources/rp-execute-setup/scripts/mint-token.sh +64 -0
- package/skills/wix-replatform/resources/rp-import-codegen/SKILL.md +1114 -0
- package/skills/wix-replatform/resources/rp-mapper/SKILL.md +430 -0
- package/skills/wix-replatform/resources/rp-mapper/lib/mapping-resolve.js +217 -0
- package/skills/wix-replatform/resources/rp-mapper/scripts/resolve-mapping.js +148 -0
- package/skills/wix-replatform/resources/rp-mapper/wix-business-solutions-taxonomy.md +378 -0
- package/skills/wix-replatform/resources/rp-setup-discovery/SKILL.md +183 -0
- package/skills/wix-replatform/resources/rp-source-csv/SKILL.md +478 -0
- package/skills/wix-replatform/resources/rp-source-csv/lib/canonical-record.js +136 -0
- package/skills/wix-replatform/resources/rp-source-csv/lib/csv-fileset.js +0 -0
- package/skills/wix-replatform/resources/rp-source-csv/lib/csv-fingerprint.js +310 -0
- package/skills/wix-replatform/resources/rp-source-csv/lib/csv-layout.js +1081 -0
- package/skills/wix-replatform/resources/rp-source-csv/lib/csv-parse.js +618 -0
- package/skills/wix-replatform/resources/rp-source-csv/scripts/csv-discovery.js +949 -0
- package/skills/wix-replatform/resources/rp-source-csv/source-schema.example.json +196 -0
- package/skills/wix-replatform/resources/rp-source-csv/vendors/bigcommerce.json +66 -0
- package/skills/wix-replatform/resources/rp-source-csv/vendors/magento.json +60 -0
- package/skills/wix-replatform/resources/rp-source-csv/vendors/shopify.json +95 -0
- package/skills/wix-replatform/resources/rp-source-csv/vendors/woocommerce.json +82 -0
- package/skills/wix-replatform/resources/rp-source-wordpress/SKILL.md +256 -0
- package/skills/wix-replatform/resources/rp-source-wordpress/lib/wp-http.js +249 -0
- package/skills/wix-replatform/resources/rp-source-wordpress/lib/wp-route-classifier.js +444 -0
- package/skills/wix-replatform/resources/rp-source-wordpress/scripts/wp-discovery.js +774 -0
- package/skills/wix-replatform/resources/rp-source-wordpress/source-schema.example.json +71 -0
- package/skills/wix-replatform/resources/rp-target-wix/SKILL.md +632 -0
- package/skills/wix-replatform/resources/rp-target-wix/SPEC-product-reviews-and-blog-authorship.md +330 -0
- package/skills/wix-replatform/resources/rp-target-wix/domains/README.md +21 -0
- package/skills/wix-replatform/resources/rp-target-wix/domains/blog/domain.json +19 -0
- package/skills/wix-replatform/resources/rp-target-wix/domains/blog/entities/category.json +37 -0
- package/skills/wix-replatform/resources/rp-target-wix/domains/blog/entities/comment.json +37 -0
- package/skills/wix-replatform/resources/rp-target-wix/domains/blog/entities/post.json +39 -0
- package/skills/wix-replatform/resources/rp-target-wix/domains/blog/entities/tag.json +35 -0
- package/skills/wix-replatform/resources/rp-target-wix/domains/cms/domain.json +14 -0
- package/skills/wix-replatform/resources/rp-target-wix/domains/cms/entities/collection.json +35 -0
- package/skills/wix-replatform/resources/rp-target-wix/domains/cms/entities/data-item.json +36 -0
- package/skills/wix-replatform/resources/rp-target-wix/domains/cms/entities/reference.json +35 -0
- package/skills/wix-replatform/resources/rp-target-wix/domains/crm/domain.json +14 -0
- package/skills/wix-replatform/resources/rp-target-wix/domains/crm/entities/contact.json +131 -0
- package/skills/wix-replatform/resources/rp-target-wix/domains/crm/entities/email-subscription.json +37 -0
- package/skills/wix-replatform/resources/rp-target-wix/domains/crm/entities/label.json +37 -0
- package/skills/wix-replatform/resources/rp-target-wix/domains/ecom/domain.json +21 -0
- package/skills/wix-replatform/resources/rp-target-wix/domains/ecom/entities/order-line-item.json +37 -0
- package/skills/wix-replatform/resources/rp-target-wix/domains/ecom/entities/order-refund.json +37 -0
- package/skills/wix-replatform/resources/rp-target-wix/domains/ecom/entities/order.json +97 -0
- package/skills/wix-replatform/resources/rp-target-wix/domains/index.json +528 -0
- package/skills/wix-replatform/resources/rp-target-wix/domains/media/domain.json +14 -0
- package/skills/wix-replatform/resources/rp-target-wix/domains/media/entities/media-file.json +38 -0
- package/skills/wix-replatform/resources/rp-target-wix/domains/media/entities/media-folder.json +37 -0
- package/skills/wix-replatform/resources/rp-target-wix/domains/members/domain.json +13 -0
- package/skills/wix-replatform/resources/rp-target-wix/domains/members/entities/badge.json +37 -0
- package/skills/wix-replatform/resources/rp-target-wix/domains/members/entities/member.json +53 -0
- package/skills/wix-replatform/resources/rp-target-wix/domains/schema.json +84 -0
- package/skills/wix-replatform/resources/rp-target-wix/domains/stores/domain.json +25 -0
- package/skills/wix-replatform/resources/rp-target-wix/domains/stores/entities/category.json +37 -0
- package/skills/wix-replatform/resources/rp-target-wix/domains/stores/entities/coupon.json +37 -0
- package/skills/wix-replatform/resources/rp-target-wix/domains/stores/entities/inventory-item.json +38 -0
- package/skills/wix-replatform/resources/rp-target-wix/domains/stores/entities/product-tag.json +37 -0
- package/skills/wix-replatform/resources/rp-target-wix/domains/stores/entities/product.json +90 -0
- package/skills/wix-replatform/resources/rp-target-wix/lib/audit-summary.js +64 -0
- package/skills/wix-replatform/resources/rp-target-wix/lib/contract-ledger.js +141 -0
- package/skills/wix-replatform/resources/rp-target-wix/lib/domain-knowledge.js +384 -0
- package/skills/wix-replatform/resources/rp-target-wix/lib/ndjson.js +260 -0
- package/skills/wix-replatform/resources/rp-target-wix/lib/stores-verification.js +238 -0
- package/skills/wix-replatform/resources/rp-target-wix/lib/wix-build.js +237 -0
- package/skills/wix-replatform/resources/rp-target-wix/lib/wix-target-spec.js +238 -0
- package/skills/wix-replatform/resources/rp-target-wix/lib/wix-writers.js +2219 -0
- package/skills/wix-replatform/resources/rp-target-wix/scripts/domain-knowledge-validate.js +31 -0
- package/skills/wix-replatform/resources/rp-target-wix/scripts/domain-knowledge.js +100 -0
- package/skills/wix-replatform/resources/rp-target-wix/scripts/verify-stores.js +107 -0
- package/skills/wix-replatform/resources/rp-telemetry/SKILL.md +344 -0
- package/skills/wix-replatform/resources/rp-telemetry/lib/bi-sink.js +250 -0
- package/skills/wix-replatform/resources/rp-telemetry/lib/telemetry-recorder.js +1927 -0
- package/skills/wix-replatform/resources/rp-telemetry/scripts/meter-from-audit.js +83 -0
- package/skills/wix-replatform/resources/rp-telemetry/scripts/rp-telemetry.js +141 -0
- package/skills/wix-replatform/scripts/artifact-freshness.js +76 -0
- package/skills/wix-replatform/scripts/execution-manifest-validate.js +43 -0
- package/skills/wix-replatform/scripts/execution-state-prepare.js +128 -0
- package/skills/wix-replatform/scripts/orchestration-preflight.js +48 -0
- package/skills/wix-replatform/scripts/orchestration-route.js +46 -0
- package/skills/wix-replatform/scripts/orchestration-state.js +245 -0
- package/skills/wix-vibe-headless/SKILL.md +54 -25
- package/skills/wix-vibe-headless/install/deploy.cjs +95 -0
- package/skills/wix-vibe-headless/install/pin-agents-md.cjs +34 -0
- package/skills/wix-vibe-headless/platforms/README.md +26 -0
- package/skills/wix-vibe-headless/platforms/base44.md +177 -0
- package/skills/wix-vibe-headless/platforms/generic.md +122 -0
- package/skills/wix-vibe-headless/references/blog/INSTRUCTIONS.md +230 -119
- package/skills/wix-vibe-headless/references/blog/app/components/PostCard.jsx +43 -0
- package/skills/wix-vibe-headless/references/blog/app/components/PostChips.jsx +25 -0
- package/skills/wix-vibe-headless/references/blog/app/components/PostGrid.jsx +15 -0
- package/skills/wix-vibe-headless/references/blog/app/context/TaxonomyContext.jsx +35 -0
- package/skills/wix-vibe-headless/references/blog/app/hooks/usePostDetail.js +38 -0
- package/skills/wix-vibe-headless/references/blog/app/pages/Blog.jsx +40 -0
- package/skills/wix-vibe-headless/references/blog/app/pages/CategoryPage.jsx +54 -0
- package/skills/wix-vibe-headless/references/blog/app/pages/PostDetail.jsx +65 -0
- package/skills/wix-vibe-headless/references/blog/app/pages/TagPage.jsx +50 -0
- package/skills/wix-vibe-headless/references/blog/seed/SEED.md +103 -0
- package/skills/wix-vibe-headless/references/blog/seed/seed-blog.js +270 -0
- package/skills/wix-vibe-headless/references/bookings/INSTRUCTIONS.md +260 -145
- package/skills/wix-vibe-headless/references/bookings/app/components/BookingForm.jsx +65 -0
- package/skills/wix-vibe-headless/references/bookings/app/components/ServiceCard.jsx +47 -0
- package/skills/wix-vibe-headless/references/bookings/app/components/ServiceGrid.jsx +13 -0
- package/skills/wix-vibe-headless/references/bookings/app/components/SlotPicker.jsx +126 -0
- package/skills/wix-vibe-headless/references/bookings/app/hooks/useServiceDetail.js +108 -0
- package/skills/wix-vibe-headless/references/bookings/app/hooks/useServices.js +58 -0
- package/skills/wix-vibe-headless/references/bookings/app/lib/serviceFacts.js +95 -0
- package/skills/wix-vibe-headless/references/bookings/app/pages/ServiceDetail.jsx +94 -0
- package/skills/wix-vibe-headless/references/bookings/app/pages/Services.jsx +89 -0
- package/skills/wix-vibe-headless/references/bookings/{wix-bookings-checkout.js → app/rest/wix-bookings-checkout.js} +1 -1
- package/skills/wix-vibe-headless/references/bookings/{wix-bookings-services.js → app/rest/wix-bookings-services.js} +90 -12
- package/skills/wix-vibe-headless/references/bookings/seed/SEED.md +117 -0
- package/skills/wix-vibe-headless/references/bookings/seed/seed-bookings.js +333 -0
- package/skills/wix-vibe-headless/references/cms/INSTRUCTIONS.md +169 -147
- package/skills/wix-vibe-headless/references/cms/app/collection.config.js +31 -0
- package/skills/wix-vibe-headless/references/cms/app/lib/wixImage.js +18 -0
- package/skills/wix-vibe-headless/references/cms/{wix-cms.js → app/rest/wix-cms.js} +47 -2
- package/skills/wix-vibe-headless/references/cms/seed/SEED.md +145 -0
- package/skills/wix-vibe-headless/references/events/INSTRUCTIONS.md +228 -131
- package/skills/wix-vibe-headless/references/events/app/components/CategoryFilter.jsx +23 -0
- package/skills/wix-vibe-headless/references/events/app/components/EventCard.jsx +43 -0
- package/skills/wix-vibe-headless/references/events/app/components/EventGrid.jsx +13 -0
- package/skills/wix-vibe-headless/references/events/app/components/EventRegistration.jsx +29 -0
- package/skills/wix-vibe-headless/references/events/app/components/RsvpForm.jsx +57 -0
- package/skills/wix-vibe-headless/references/events/app/components/TicketPicker.jsx +78 -0
- package/skills/wix-vibe-headless/references/events/app/hooks/useEventDetail.js +27 -0
- package/skills/wix-vibe-headless/references/events/app/hooks/useEventsList.js +54 -0
- package/skills/wix-vibe-headless/references/events/app/hooks/useRsvpForm.js +40 -0
- package/skills/wix-vibe-headless/references/events/app/hooks/useTicketing.js +81 -0
- package/skills/wix-vibe-headless/references/events/app/pages/EventDetail.jsx +48 -0
- package/skills/wix-vibe-headless/references/events/app/pages/Events.jsx +36 -0
- package/skills/wix-vibe-headless/references/events/{wix-events-browse.js → app/rest/wix-events-browse.js} +3 -2
- package/skills/wix-vibe-headless/references/events/seed/SEED.md +107 -0
- package/skills/wix-vibe-headless/references/events/seed/seed-events.js +251 -0
- package/skills/wix-vibe-headless/references/members/INSTRUCTIONS.md +276 -188
- package/skills/wix-vibe-headless/references/members/app/components/LoginForm.jsx +101 -0
- package/skills/wix-vibe-headless/references/members/app/components/MemberMenu.jsx +33 -0
- package/skills/wix-vibe-headless/references/members/app/components/RequireAuth.jsx +21 -0
- package/skills/wix-vibe-headless/references/members/app/components/SocialButtons.jsx +29 -0
- package/skills/wix-vibe-headless/references/members/app/context/MemberContext.jsx +54 -0
- package/skills/wix-vibe-headless/references/members/app/hooks/useLoginForm.js +77 -0
- package/skills/wix-vibe-headless/references/members/app/pages/Account.jsx +36 -0
- package/skills/wix-vibe-headless/references/members/app/pages/Callback.jsx +32 -0
- package/skills/wix-vibe-headless/references/members/app/pages/Login.jsx +35 -0
- package/skills/wix-vibe-headless/references/members/{wix-members-auth.js → app/rest/wix-members-auth.js} +6 -3
- package/skills/wix-vibe-headless/references/members/install/Register.jsx +22 -0
- package/skills/wix-vibe-headless/references/members/seed/SEED.md +22 -0
- package/skills/wix-vibe-headless/references/portfolio/INSTRUCTIONS.md +233 -104
- package/skills/wix-vibe-headless/references/portfolio/app/components/CollectionCard.jsx +31 -0
- package/skills/wix-vibe-headless/references/portfolio/app/components/CollectionGrid.jsx +15 -0
- package/skills/wix-vibe-headless/references/portfolio/app/components/ProjectCard.jsx +39 -0
- package/skills/wix-vibe-headless/references/portfolio/app/components/ProjectGrid.jsx +15 -0
- package/skills/wix-vibe-headless/references/portfolio/app/components/ProjectMedia.jsx +29 -0
- package/skills/wix-vibe-headless/references/portfolio/app/hooks/useCollectionProjects.js +35 -0
- package/skills/wix-vibe-headless/references/portfolio/app/hooks/usePortfolioGallery.js +27 -0
- package/skills/wix-vibe-headless/references/portfolio/app/hooks/useProjectDetail.js +25 -0
- package/skills/wix-vibe-headless/references/portfolio/app/pages/CollectionPage.jsx +39 -0
- package/skills/wix-vibe-headless/references/portfolio/app/pages/Portfolio.jsx +27 -0
- package/skills/wix-vibe-headless/references/portfolio/app/pages/ProjectDetail.jsx +60 -0
- package/skills/wix-vibe-headless/references/portfolio/{wix-portfolio.js → app/rest/wix-portfolio.js} +84 -55
- package/skills/wix-vibe-headless/references/portfolio/seed/SEED.md +94 -0
- package/skills/wix-vibe-headless/references/portfolio/seed/seed-portfolio.js +236 -0
- package/skills/wix-vibe-headless/references/pricing-plans/INSTRUCTIONS.md +240 -117
- package/skills/wix-vibe-headless/references/pricing-plans/app/components/OrderCard.jsx +35 -0
- package/skills/wix-vibe-headless/references/pricing-plans/app/components/PlanCard.jsx +48 -0
- package/skills/wix-vibe-headless/references/pricing-plans/app/components/PlanGrid.jsx +16 -0
- package/skills/wix-vibe-headless/references/pricing-plans/app/components/PlanPrice.jsx +35 -0
- package/skills/wix-vibe-headless/references/pricing-plans/app/hooks/useMyPlans.js +25 -0
- package/skills/wix-vibe-headless/references/pricing-plans/app/hooks/usePlanDetail.js +28 -0
- package/skills/wix-vibe-headless/references/pricing-plans/app/hooks/usePlans.js +30 -0
- package/skills/wix-vibe-headless/references/pricing-plans/app/pages/MyPlans.jsx +30 -0
- package/skills/wix-vibe-headless/references/pricing-plans/app/pages/PlanDetail.jsx +53 -0
- package/skills/wix-vibe-headless/references/pricing-plans/app/pages/Plans.jsx +28 -0
- package/skills/wix-vibe-headless/references/pricing-plans/seed/SEED.md +86 -0
- package/skills/wix-vibe-headless/references/pricing-plans/seed/seed-pricing-plans.js +251 -0
- package/skills/wix-vibe-headless/references/restaurants/INSTRUCTIONS.md +248 -124
- package/skills/wix-vibe-headless/references/restaurants/app/components/ItemDialog.jsx +81 -0
- package/skills/wix-vibe-headless/references/restaurants/app/components/MenuItemCard.jsx +71 -0
- package/skills/wix-vibe-headless/references/restaurants/app/components/MenuList.jsx +43 -0
- package/skills/wix-vibe-headless/references/restaurants/app/components/OrderCartButton.jsx +21 -0
- package/skills/wix-vibe-headless/references/restaurants/app/components/OrderCartDrawer.jsx +60 -0
- package/skills/wix-vibe-headless/references/restaurants/app/context/OrderCartContext.jsx +63 -0
- package/skills/wix-vibe-headless/references/restaurants/app/hooks/useItemOrder.js +32 -0
- package/skills/wix-vibe-headless/references/restaurants/app/hooks/useReservation.js +73 -0
- package/skills/wix-vibe-headless/references/restaurants/app/pages/Menu.jsx +28 -0
- package/skills/wix-vibe-headless/references/restaurants/app/pages/Reservations.jsx +102 -0
- package/skills/wix-vibe-headless/references/restaurants/seed/SEED.md +180 -0
- package/skills/wix-vibe-headless/references/restaurants/seed/seed-restaurants.js +452 -0
- package/skills/wix-vibe-headless/references/shared/app/components/WixManageBanner.jsx +56 -0
- package/skills/wix-vibe-headless/references/shared/{wix-client.js → app/rest/wix-client.js} +6 -8
- package/skills/wix-vibe-headless/references/shared/app/rest/wix-config.js +6 -0
- package/skills/wix-vibe-headless/references/storefront/INSTRUCTIONS.md +263 -148
- package/skills/wix-vibe-headless/references/storefront/app/components/CartButton.jsx +20 -0
- package/skills/wix-vibe-headless/references/storefront/app/components/CartDrawer.jsx +150 -0
- package/skills/wix-vibe-headless/references/storefront/app/components/ProductCard.jsx +167 -0
- package/skills/wix-vibe-headless/references/storefront/app/components/ProductGallery.jsx +51 -0
- package/skills/wix-vibe-headless/references/storefront/app/components/ProductGrid.jsx +54 -0
- package/skills/wix-vibe-headless/references/storefront/app/components/VariantPicker.jsx +119 -0
- package/skills/wix-vibe-headless/references/storefront/app/context/CartContext.jsx +71 -0
- package/skills/wix-vibe-headless/references/storefront/app/hooks/useProductDetail.js +109 -0
- package/skills/wix-vibe-headless/references/storefront/app/hooks/useShop.js +98 -0
- package/skills/wix-vibe-headless/references/storefront/app/lib/storeImage.js +27 -0
- package/skills/wix-vibe-headless/references/storefront/app/pages/ProductDetail.jsx +139 -0
- package/skills/wix-vibe-headless/references/storefront/app/pages/Shop.jsx +75 -0
- package/skills/wix-vibe-headless/references/storefront/{wix-store-cart.js → app/rest/wix-store-cart.js} +1 -1
- package/skills/wix-vibe-headless/references/storefront/{wix-store-catalog.js → app/rest/wix-store-catalog.js} +25 -2
- package/skills/wix-vibe-headless/references/storefront/seed/SEED.md +111 -0
- package/skills/wix-vibe-headless/references/storefront/seed/seed-store.js +299 -0
- /package/skills/wix-vibe-headless/references/blog/{wix-blog.js → app/rest/wix-blog.js} +0 -0
- /package/skills/wix-vibe-headless/references/events/{wix-events-registration.js → app/rest/wix-events-registration.js} +0 -0
- /package/skills/wix-vibe-headless/references/pricing-plans/{wix-pricing-plans.js → app/rest/wix-pricing-plans.js} +0 -0
- /package/skills/wix-vibe-headless/references/restaurants/{wix-restaurants-menu.js → app/rest/wix-restaurants-menu.js} +0 -0
- /package/skills/wix-vibe-headless/references/restaurants/{wix-restaurants-ordering.js → app/rest/wix-restaurants-ordering.js} +0 -0
- /package/skills/wix-vibe-headless/references/restaurants/{wix-restaurants-reservations.js → app/rest/wix-restaurants-reservations.js} +0 -0
|
@@ -0,0 +1,299 @@
|
|
|
1
|
+
// Storefront seed helpers — run at BUILD TIME via exec_tool (NOT shipped in the app).
|
|
2
|
+
// The agent requires this and calls the functions with plain data; all Wix Stores
|
|
3
|
+
// request/response mechanics (bulk shapes, variant expansion, rich-text descriptions,
|
|
4
|
+
// the 409-serial category rule, the re-hosted-image quirk) live here, once.
|
|
5
|
+
//
|
|
6
|
+
// Usage (build-time exec_tool):
|
|
7
|
+
// const { accessToken } = await base44.asServiceRole.connectors.getConnection("wix"); // Base44
|
|
8
|
+
// const seed = require("/app/.agents/skills/wix-vibe-headless/references/storefront/seed/seed-store.js");
|
|
9
|
+
// const ctx = { token: accessToken, siteId: WIX_METASITE_ID };
|
|
10
|
+
// await seed.installStoresApp(ctx);
|
|
11
|
+
// const products = await seed.bulkCreateProducts(ctx, [{ name, description, price, quantity, options? }]);
|
|
12
|
+
// const cats = await seed.createCategories(ctx, ["Legends", "Rising Stars"]);
|
|
13
|
+
// await seed.addProductsToCategories(ctx, { [cats[0].id]: products.map(p => p.id) });
|
|
14
|
+
// await seed.attachProductImages(ctx, products.map((p,i) => ({ id:p.id, url:imageUrls[i], altText:p.slug })));
|
|
15
|
+
//
|
|
16
|
+
// If any call fails with a shape the caller didn't expect, fall back to the wix-docs skill
|
|
17
|
+
// (search + read the live Wix API reference) — never guess. Source recipe (authoritative):
|
|
18
|
+
// wix-headless/references/inline-recipes/setup-online-store.md.
|
|
19
|
+
|
|
20
|
+
const API = "https://www.wixapis.com";
|
|
21
|
+
const STORES_APP_ID = "215238eb-22a5-4c36-9e7b-e7c08025e04e";
|
|
22
|
+
|
|
23
|
+
async function req(ctx, path, { method = "POST", body } = {}) {
|
|
24
|
+
// Retry while the catalog is still provisioning: right after a fresh Stores install the V3 WRITE
|
|
25
|
+
// path becomes usable a bit later than the V3 read path, so even once waitForCatalogV3 (a read
|
|
26
|
+
// probe) returns, the first bulk-create can still 428. Wait it out (~80s budget); every other
|
|
27
|
+
// error throws on the first try as before.
|
|
28
|
+
for (let attempt = 0; ; attempt++) {
|
|
29
|
+
const res = await fetch(API + path, {
|
|
30
|
+
method,
|
|
31
|
+
headers: {
|
|
32
|
+
Authorization: `Bearer ${ctx.token}`,
|
|
33
|
+
"wix-site-id": ctx.siteId,
|
|
34
|
+
"Content-Type": "application/json",
|
|
35
|
+
},
|
|
36
|
+
body: body ? JSON.stringify(body) : undefined,
|
|
37
|
+
});
|
|
38
|
+
const json = await res.json().catch(() => ({}));
|
|
39
|
+
if (res.ok) return json;
|
|
40
|
+
if (isProvisioning(res.status, json) && attempt < 40) {
|
|
41
|
+
await sleep(2000);
|
|
42
|
+
continue;
|
|
43
|
+
}
|
|
44
|
+
throw new Error(`${method} ${path} -> ${res.status}: ${JSON.stringify(json).slice(0, 400)}`);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
const sleep = (ms) => new Promise((r) => setTimeout(r, ms));
|
|
49
|
+
|
|
50
|
+
// A freshly installed catalog isn't writable yet, and Wix has signalled that with two different
|
|
51
|
+
// 428s: the older CATALOG_V1_SITE_CALLING_CATALOG_V3_API (site still reports V1) and the current
|
|
52
|
+
// CATALOG_V3_SITE_PROVISIONING ("Site is currently being provisioned for CATALOG_V3"). Sites exist
|
|
53
|
+
// on both behaviours, so match either. The message check catches a further rename: on this endpoint
|
|
54
|
+
// a 428 means "not ready, retry", and treating an unknown one as fatal turns a wait into a failed
|
|
55
|
+
// seed — which is exactly how the V3 code slipped through when only the V1 code was matched.
|
|
56
|
+
const PROVISIONING_CODES = new Set(["CATALOG_V1_SITE_CALLING_CATALOG_V3_API", "CATALOG_V3_SITE_PROVISIONING"]);
|
|
57
|
+
|
|
58
|
+
function isProvisioning(status, json) {
|
|
59
|
+
if (PROVISIONING_CODES.has(json?.details?.applicationError?.code)) return true;
|
|
60
|
+
return status === 428 && /provision/i.test(json?.message || "");
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
// A freshly installed Stores catalog 428s on V3 calls until provisioning settles (see
|
|
64
|
+
// isProvisioning for the codes). Poll a cheap V3 read until that clears (bounded ~80s), so we don't
|
|
65
|
+
// fire the expensive bulk-create repeatedly during the window. This is a pre-gate on the READ path;
|
|
66
|
+
// the WRITE path clears slightly later, so the real guarantee is req()'s retry — this just minimizes
|
|
67
|
+
// how many times the actual write has to retry.
|
|
68
|
+
async function waitForCatalogV3(ctx, { attempts = 40, delayMs = 2000 } = {}) {
|
|
69
|
+
for (let i = 0; i < attempts; i++) {
|
|
70
|
+
const res = await fetch(`${API}/stores/v3/products/query`, {
|
|
71
|
+
method: "POST",
|
|
72
|
+
headers: { Authorization: `Bearer ${ctx.token}`, "wix-site-id": ctx.siteId, "Content-Type": "application/json" },
|
|
73
|
+
body: JSON.stringify({ query: { paging: { limit: 1 } } }),
|
|
74
|
+
});
|
|
75
|
+
if (res.ok) return;
|
|
76
|
+
const json = await res.json().catch(() => ({}));
|
|
77
|
+
// Anything that isn't a provisioning signal is a real error — return and let the caller's own
|
|
78
|
+
// request surface it. Matching only one of the two codes here made this exit the wait on the
|
|
79
|
+
// other one, handing the caller straight to a write that then 428'd.
|
|
80
|
+
if (!isProvisioning(res.status, json)) return;
|
|
81
|
+
await sleep(delayMs);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
// plain string -> Wix rich-text description node tree (plainDescription is HTML/nodes, not text)
|
|
86
|
+
function mkDesc(text, i) {
|
|
87
|
+
return {
|
|
88
|
+
nodes: [{
|
|
89
|
+
type: "PARAGRAPH", id: `desc-${i}`,
|
|
90
|
+
nodes: [{ type: "TEXT", textData: { text: text || "" } }],
|
|
91
|
+
paragraphData: { textStyle: { textAlignment: "AUTO" } },
|
|
92
|
+
}],
|
|
93
|
+
metadata: { version: 1, id: `desc-meta-${i}` },
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
// [{name, type?:"text"|"color", choices:["8","9"] | [{name,colorCode}]}] -> Wix options[]
|
|
98
|
+
function buildOptions(options = []) {
|
|
99
|
+
return options.map((o) => {
|
|
100
|
+
const color = o.type === "color";
|
|
101
|
+
return {
|
|
102
|
+
name: o.name,
|
|
103
|
+
optionRenderType: color ? "SWATCH_CHOICES" : "TEXT_CHOICES",
|
|
104
|
+
choicesSettings: {
|
|
105
|
+
choices: o.choices.map((c) =>
|
|
106
|
+
color
|
|
107
|
+
? { choiceType: "ONE_COLOR", name: c.name, colorCode: c.colorCode }
|
|
108
|
+
: { choiceType: "CHOICE_TEXT", name: typeof c === "string" ? c : c.name }),
|
|
109
|
+
},
|
|
110
|
+
};
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
// full Cartesian product of variants, each priced/stocked from the product; visible:true baked in
|
|
115
|
+
function expandVariants(options = [], { price, compareAtPrice, quantity }) {
|
|
116
|
+
const base = {
|
|
117
|
+
price: {
|
|
118
|
+
actualPrice: { amount: String(price) },
|
|
119
|
+
...(compareAtPrice ? { compareAtPrice: { amount: String(compareAtPrice) } } : {}),
|
|
120
|
+
},
|
|
121
|
+
visible: true,
|
|
122
|
+
physicalProperties: {},
|
|
123
|
+
inventoryItem: { quantity: quantity ?? 0, preorderInfo: { enabled: false } },
|
|
124
|
+
};
|
|
125
|
+
if (!options.length) return [base];
|
|
126
|
+
let combos = [[]];
|
|
127
|
+
for (const o of options) {
|
|
128
|
+
const rt = o.type === "color" ? "SWATCH_CHOICES" : "TEXT_CHOICES";
|
|
129
|
+
const names = o.choices.map((c) => (typeof c === "string" ? c : c.name));
|
|
130
|
+
combos = combos.flatMap((combo) =>
|
|
131
|
+
names.map((choiceName) => [...combo, { optionChoiceNames: { optionName: o.name, choiceName, renderType: rt } }]));
|
|
132
|
+
}
|
|
133
|
+
return combos.map((choices) => ({ ...base, choices }));
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
// ---- exported operations ----
|
|
137
|
+
|
|
138
|
+
async function installStoresApp(ctx) {
|
|
139
|
+
try {
|
|
140
|
+
await req(ctx, "/apps-installer-service/v1/app-instance/install", { body: {
|
|
141
|
+
tenant: { tenantType: "SITE", id: ctx.siteId },
|
|
142
|
+
appInstance: { appDefId: STORES_APP_ID, enabled: true },
|
|
143
|
+
} });
|
|
144
|
+
} catch {
|
|
145
|
+
// already installed is fine — the readiness wait below still confirms the V3 catalog is live
|
|
146
|
+
}
|
|
147
|
+
// Do NOT return to the caller until V3 is ready, else the first V3 seed call 428s on CATALOG_V1.
|
|
148
|
+
await waitForCatalogV3(ctx);
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
async function listProducts(ctx) {
|
|
152
|
+
const r = await req(ctx, "/stores/v3/products/query", { body: { query: { paging: { limit: 50 } } } });
|
|
153
|
+
return (r.products ?? []).map((p) => ({ id: p.id, name: p.name }));
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
/**
|
|
157
|
+
* Bulk-create products.
|
|
158
|
+
* @param products [{ name, description, price, compareAtPrice?, quantity,
|
|
159
|
+
* options?: [{ name, type?:"text"|"color", choices:["8","9"] | [{name,colorCode}] }] }]
|
|
160
|
+
* options = ONLY things the buyer selects-and-buys (Size, Color) -> become variants.
|
|
161
|
+
* Display-only attributes go in name/category/description, NOT options. Default: no options.
|
|
162
|
+
* visible/physicalProperties/variant-expansion handled here. `quantity` is the stock created.
|
|
163
|
+
* @returns [{ id, slug, revision }]
|
|
164
|
+
*/
|
|
165
|
+
async function bulkCreateProducts(ctx, products) {
|
|
166
|
+
const body = {
|
|
167
|
+
returnEntity: true,
|
|
168
|
+
products: products.map((p, i) => ({
|
|
169
|
+
name: p.name,
|
|
170
|
+
productType: "PHYSICAL",
|
|
171
|
+
physicalProperties: {},
|
|
172
|
+
visible: true,
|
|
173
|
+
visibleInPos: true,
|
|
174
|
+
description: mkDesc(p.description, i),
|
|
175
|
+
options: buildOptions(p.options),
|
|
176
|
+
variantsInfo: { variants: expandVariants(p.options, p) },
|
|
177
|
+
})),
|
|
178
|
+
};
|
|
179
|
+
const r = await req(ctx, "/stores/v3/bulk/products-with-inventory/create", { body });
|
|
180
|
+
// NB: results nest under productResults.results[].item — NOT a top-level `results`.
|
|
181
|
+
const created = (r.productResults?.results ?? []).map((x, i) => ({
|
|
182
|
+
id: x.item?.id, slug: x.item?.slug, revision: x.item?.revision,
|
|
183
|
+
variantId: x.item?.variantsInfo?.variants?.[0]?.id,
|
|
184
|
+
hasOptions: (products[i]?.options?.length ?? 0) > 0,
|
|
185
|
+
quantity: products[i]?.quantity ?? 0,
|
|
186
|
+
}));
|
|
187
|
+
await stockOptionlessProducts(ctx, created);
|
|
188
|
+
return created.map((p) => ({ id: p.id, slug: p.slug, revision: p.revision }));
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
// products-with-inventory/create stocks a variant via its choices; an OPTION-LESS product has a
|
|
192
|
+
// single choiceless (default) variant that the create does NOT stock — it lands OUT_OF_STOCK. So
|
|
193
|
+
// set stock on those default variants explicitly (bulk/inventory-items/create). Products WITH options
|
|
194
|
+
// are already stocked by the create above, so they're skipped. Backfills the default variantId from a
|
|
195
|
+
// query if the create response didn't return it.
|
|
196
|
+
async function stockOptionlessProducts(ctx, created) {
|
|
197
|
+
const need = created.filter((p) => !p.hasOptions && p.id);
|
|
198
|
+
if (!need.length) return;
|
|
199
|
+
const missing = need.filter((p) => !p.variantId).map((p) => p.id);
|
|
200
|
+
if (missing.length) {
|
|
201
|
+
const q = await req(ctx, "/stores/v3/products/query", { body: { query: { filter: { id: { $in: missing } }, paging: { limit: missing.length } } } });
|
|
202
|
+
const vById = new Map((q.products ?? []).map((p) => [p.id, p.variantsInfo?.variants?.[0]?.id]));
|
|
203
|
+
need.forEach((p) => { if (!p.variantId) p.variantId = vById.get(p.id); });
|
|
204
|
+
}
|
|
205
|
+
const inventoryItems = need
|
|
206
|
+
.filter((p) => p.variantId)
|
|
207
|
+
.map((p) => ({ productId: p.id, variantId: p.variantId, quantity: p.quantity }));
|
|
208
|
+
if (inventoryItems.length) {
|
|
209
|
+
await req(ctx, "/stores/v3/bulk/inventory-items/create", { body: { inventoryItems } });
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
// Categories: no bulk create, and MUST be sequential — they share the @wix/stores tree revision,
|
|
214
|
+
// so concurrent creates 409. Run after products (catalog can lag right after the Stores install).
|
|
215
|
+
async function createCategories(ctx, names) {
|
|
216
|
+
const out = [];
|
|
217
|
+
for (const name of names) {
|
|
218
|
+
const r = await req(ctx, "/categories/v1/categories", {
|
|
219
|
+
body: { category: { name, visible: true }, treeReference: { appNamespace: "@wix/stores", treeKey: null } },
|
|
220
|
+
});
|
|
221
|
+
out.push({ id: r.category?.id, name });
|
|
222
|
+
}
|
|
223
|
+
return out;
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
// mapping: { [categoryId]: [productId, ...] } — also sequential (same shared tree)
|
|
227
|
+
async function addProductsToCategories(ctx, mapping) {
|
|
228
|
+
for (const [categoryId, productIds] of Object.entries(mapping)) {
|
|
229
|
+
await req(ctx, `/categories/v1/bulk/categories/${categoryId}/add-items`, {
|
|
230
|
+
body: {
|
|
231
|
+
items: productIds.map((catalogItemId) => ({ catalogItemId, appId: STORES_APP_ID })),
|
|
232
|
+
treeReference: { appNamespace: "@wix/stores", treeKey: null },
|
|
233
|
+
},
|
|
234
|
+
});
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
// Bulk image attach in ONE call. items: [{ id, url, altText }] — NO revision.
|
|
239
|
+
// An attach bumps the product's revision, so a caller-supplied revision goes stale between passes
|
|
240
|
+
// (INVALID_REVISION); we read each product's CURRENT revision here, right before the update, so the
|
|
241
|
+
// caller never manages a revision token — attach any number of times, in any pass. Wix re-hosts the
|
|
242
|
+
// image from the url server-side; the re-hosted media can take a little while to appear on read-back
|
|
243
|
+
// (propagation) — that's normal, not a failure, so we don't block on it.
|
|
244
|
+
async function attachProductImages(ctx, items) {
|
|
245
|
+
if (!items?.length) return;
|
|
246
|
+
const ids = items.map((it) => it.id);
|
|
247
|
+
const q = await req(ctx, "/stores/v3/products/query", { body: { query: { filter: { id: { $in: ids } }, paging: { limit: ids.length } } } });
|
|
248
|
+
const revById = new Map((q.products ?? []).map((p) => [p.id, p.revision]));
|
|
249
|
+
return req(ctx, "/stores/v3/bulk/products/update", {
|
|
250
|
+
body: {
|
|
251
|
+
products: items.map((it) => ({
|
|
252
|
+
product: { id: it.id, revision: revById.get(it.id), media: { itemsInfo: { items: [{ url: it.url, altText: it.altText }] } } },
|
|
253
|
+
})),
|
|
254
|
+
},
|
|
255
|
+
});
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
/**
|
|
259
|
+
* ONE-CALL seed: install → create products → categories → attach images, in the correct order,
|
|
260
|
+
* keeping the created ids in memory (no hand-threading of product ids across exec calls). This is
|
|
261
|
+
* the DEFAULT path — call it once instead of the individual functions.
|
|
262
|
+
*
|
|
263
|
+
* @param plan {{
|
|
264
|
+
* products: [{ name, description, price, compareAtPrice?, quantity, options?, imageUrl?, altText? }],
|
|
265
|
+
* categories?: { [categoryName]: string[] }, // map of category name -> product NAMES in it
|
|
266
|
+
* }}
|
|
267
|
+
* @returns { products: [{id,slug,revision,name}], categories: [{id,name}], imagesAttached: number }
|
|
268
|
+
*/
|
|
269
|
+
async function setupStore(ctx, { products = [], categories = {} } = {}) {
|
|
270
|
+
await installStoresApp(ctx); // installs if needed AND waits for the V3 catalog to be ready
|
|
271
|
+
|
|
272
|
+
const created = await bulkCreateProducts(ctx, products);
|
|
273
|
+
const withNames = created.map((p, i) => ({ ...p, name: products[i]?.name }));
|
|
274
|
+
const idByName = new Map(withNames.map((p) => [p.name, p.id]));
|
|
275
|
+
|
|
276
|
+
const names = Object.keys(categories);
|
|
277
|
+
const cats = names.length ? await createCategories(ctx, names) : [];
|
|
278
|
+
if (cats.length) {
|
|
279
|
+
const mapping = {};
|
|
280
|
+
for (const c of cats) {
|
|
281
|
+
const ids = (categories[c.name] || []).map((n) => idByName.get(n)).filter(Boolean);
|
|
282
|
+
if (ids.length) mapping[c.id] = ids;
|
|
283
|
+
}
|
|
284
|
+
if (Object.keys(mapping).length) await addProductsToCategories(ctx, mapping);
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
const imageItems = withNames
|
|
288
|
+
.map((p, i) => ({ id: p.id, url: products[i]?.imageUrl, altText: products[i]?.altText ?? p.slug }))
|
|
289
|
+
.filter((it) => it.url);
|
|
290
|
+
if (imageItems.length) await attachProductImages(ctx, imageItems);
|
|
291
|
+
|
|
292
|
+
return { products: withNames, categories: cats, imagesAttached: imageItems.length };
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
module.exports = {
|
|
296
|
+
setupStore,
|
|
297
|
+
installStoresApp, listProducts,
|
|
298
|
+
bulkCreateProducts, createCategories, addProductsToCategories, attachProductImages,
|
|
299
|
+
};
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|