@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,30 @@
|
|
|
1
|
+
// usePlans — Plans-listing logic, no markup: load the first page of PUBLIC plans, page through with
|
|
2
|
+
// the cursor, and start a members-only hosted checkout. The destructure of queryPlans() (returns
|
|
3
|
+
// { plans, nextCursor }, NOT a bare array) and the checkout-then-redirect are load-bearing — keep
|
|
4
|
+
// them. The Plans page only renders what this returns.
|
|
5
|
+
import { useState, useEffect } from "react";
|
|
6
|
+
import { queryPlans, checkout } from "@/rest/wix-pricing-plans";
|
|
7
|
+
|
|
8
|
+
export function usePlans() {
|
|
9
|
+
const [plans, setPlans] = useState([]);
|
|
10
|
+
const [cursor, setCursor] = useState(null);
|
|
11
|
+
const [loaded, setLoaded] = useState(false);
|
|
12
|
+
|
|
13
|
+
useEffect(() => {
|
|
14
|
+
// NB: destructure — queryPlans returns { plans, nextCursor }, NOT a bare array.
|
|
15
|
+
queryPlans().then(({ plans, nextCursor }) => { setPlans(plans); setCursor(nextCursor); setLoaded(true); });
|
|
16
|
+
}, []);
|
|
17
|
+
|
|
18
|
+
const loadMore = () =>
|
|
19
|
+
queryPlans({ cursor }).then(({ plans: more, nextCursor }) => {
|
|
20
|
+
setPlans((p) => [...p, ...more]);
|
|
21
|
+
setCursor(nextCursor);
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
// members-only, Wix-hosted checkout; on success Wix returns to thankYouPageUrl with ?planOrderId=<GUID>
|
|
25
|
+
async function subscribe(plan) {
|
|
26
|
+
window.location.href = await checkout(plan.id, { thankYouPageUrl: `${window.location.origin}/my-plans` });
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
return { plans, cursor, loaded, loadMore, subscribe };
|
|
30
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
// My plans page — thin view over useMyPlans (all logic lives in the hook). Shows the logged-in
|
|
2
|
+
// member's active memberships and doubles as the post-checkout confirmation (re-syncs on
|
|
3
|
+
// visibilitychange). getMyPlanOrders() resolves to [] for anonymous visitors, so the empty branch
|
|
4
|
+
// covers both "not a member → log in" and "member with no active plans". Styled with base44 design
|
|
5
|
+
// tokens (shadcn Tailwind classes).
|
|
6
|
+
import { useMyPlans } from "@/hooks/useMyPlans";
|
|
7
|
+
import OrderCard from "@/components/OrderCard";
|
|
8
|
+
|
|
9
|
+
export default function MyPlans() {
|
|
10
|
+
const { orders, loaded } = useMyPlans({ orderStatuses: ["ACTIVE"] });
|
|
11
|
+
|
|
12
|
+
return (
|
|
13
|
+
<main className="max-w-[720px] mx-auto py-8 px-4">
|
|
14
|
+
<h1 className="font-display mb-4">My plans</h1>
|
|
15
|
+
{!loaded ? (
|
|
16
|
+
<p className="text-muted-foreground">Loading…</p>
|
|
17
|
+
) : orders.length === 0 ? (
|
|
18
|
+
// [] = anonymous visitor OR a member with no active plans. Wire log-in via the members
|
|
19
|
+
// vertical (references/members/) so a member can sign in on your own UI, then re-check.
|
|
20
|
+
<p className="text-muted-foreground">
|
|
21
|
+
No active plans. Log in to see your plans, or choose one from the pricing page.
|
|
22
|
+
</p>
|
|
23
|
+
) : (
|
|
24
|
+
<ul className="m-0 p-0 flex flex-col gap-4">
|
|
25
|
+
{orders.map((order) => <OrderCard key={order.id} order={order} />)}
|
|
26
|
+
</ul>
|
|
27
|
+
)}
|
|
28
|
+
</main>
|
|
29
|
+
);
|
|
30
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
// Plan detail page — thin view over usePlanDetail (all logic lives in the hook). Shows the full
|
|
2
|
+
// price/billing summary, perks, terms & conditions if present, and a Subscribe button (only when
|
|
3
|
+
// plan.buyable). Not-found state on a bad slug — never invent a plan. Styled with base44 design
|
|
4
|
+
// tokens (shadcn Tailwind classes). termsAndConditions is plain text; render as-is.
|
|
5
|
+
import { useParams } from "react-router-dom";
|
|
6
|
+
import { usePlanDetail } from "@/hooks/usePlanDetail";
|
|
7
|
+
import PlanPrice from "@/components/PlanPrice";
|
|
8
|
+
|
|
9
|
+
export default function PlanDetail() {
|
|
10
|
+
const { slug } = useParams();
|
|
11
|
+
const { plan, notFound, subscribe } = usePlanDetail(slug);
|
|
12
|
+
|
|
13
|
+
if (notFound) return <Centered>Plan not found.</Centered>;
|
|
14
|
+
if (!plan) return <Centered>Loading…</Centered>;
|
|
15
|
+
|
|
16
|
+
return (
|
|
17
|
+
<main className="max-w-[720px] mx-auto py-8 px-4">
|
|
18
|
+
<h1 className="font-display m-0 mb-2">{plan.name}</h1>
|
|
19
|
+
{plan.description && (
|
|
20
|
+
<p className="text-muted-foreground leading-[1.6] m-0 mb-4">{plan.description}</p>
|
|
21
|
+
)}
|
|
22
|
+
|
|
23
|
+
<div className="my-4"><PlanPrice plan={plan} /></div>
|
|
24
|
+
|
|
25
|
+
{(plan.perks || []).length > 0 && (
|
|
26
|
+
<ul className="my-4 p-0 list-none flex flex-col gap-2.5">
|
|
27
|
+
{plan.perks.map((perk) => (
|
|
28
|
+
<li key={perk.id} className="flex gap-2 leading-[1.4]">
|
|
29
|
+
<span className="text-primary" aria-hidden>✓</span>
|
|
30
|
+
<span>{perk.description}</span>
|
|
31
|
+
</li>
|
|
32
|
+
))}
|
|
33
|
+
</ul>
|
|
34
|
+
)}
|
|
35
|
+
|
|
36
|
+
{plan.buyable && (
|
|
37
|
+
<button onClick={subscribe}
|
|
38
|
+
className="py-3 px-8 cursor-pointer bg-primary text-primary-foreground rounded-sm text-[15px] font-semibold">Subscribe</button>
|
|
39
|
+
)}
|
|
40
|
+
|
|
41
|
+
{plan.termsAndConditions && (
|
|
42
|
+
<div className="mt-8 pt-4 border-t border-border">
|
|
43
|
+
<h2 className="font-display text-base">Terms & conditions</h2>
|
|
44
|
+
<p className="text-muted-foreground leading-[1.6] whitespace-pre-wrap">{plan.termsAndConditions}</p>
|
|
45
|
+
</div>
|
|
46
|
+
)}
|
|
47
|
+
</main>
|
|
48
|
+
);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
function Centered({ children }) {
|
|
52
|
+
return <div className="p-12 text-center text-muted-foreground">{children}</div>;
|
|
53
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
// Plans / pricing page — thin view over usePlans (all logic lives in the hook). Lists PUBLIC plans
|
|
2
|
+
// with an empty state, pages through with the cursor, and subscribes via the members-only hosted
|
|
3
|
+
// checkout. Styled with base44 design tokens (shadcn Tailwind classes).
|
|
4
|
+
import { usePlans } from "@/hooks/usePlans";
|
|
5
|
+
import PlanGrid from "@/components/PlanGrid";
|
|
6
|
+
|
|
7
|
+
export default function Plans() {
|
|
8
|
+
const { plans, cursor, loaded, loadMore, subscribe } = usePlans();
|
|
9
|
+
|
|
10
|
+
return (
|
|
11
|
+
<main className="max-w-[1200px] mx-auto p-4">
|
|
12
|
+
<h1 className="font-display mb-4">Plans & Pricing</h1>
|
|
13
|
+
{!loaded
|
|
14
|
+
? <p className="text-muted-foreground">Loading…</p>
|
|
15
|
+
: <PlanGrid
|
|
16
|
+
plans={plans}
|
|
17
|
+
onSubscribe={subscribe}
|
|
18
|
+
empty="No plans yet — create plans from your Wix dashboard."
|
|
19
|
+
/>}
|
|
20
|
+
{cursor && (
|
|
21
|
+
<div className="text-center mt-6">
|
|
22
|
+
<button onClick={loadMore}
|
|
23
|
+
className="py-2.5 px-6 cursor-pointer bg-card text-foreground border border-border rounded-sm font-semibold">Load more</button>
|
|
24
|
+
</div>
|
|
25
|
+
)}
|
|
26
|
+
</main>
|
|
27
|
+
);
|
|
28
|
+
}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
# Pricing Plans — seeding
|
|
2
|
+
|
|
3
|
+
Seed Wix Pricing Plans (Plans V3) by **calling `seed-pricing-plans.js`** — don't hand-write the
|
|
4
|
+
REST calls. It's a build-time module (run via `exec_tool`, not shipped in the app) that abstracts
|
|
5
|
+
every Pricing Plans + Benefit Programs seed operation. `require` it and call the functions with
|
|
6
|
+
plain data.
|
|
7
|
+
|
|
8
|
+
> **NOT yet live-verified — transcribed from `setup-pricing-plans.md`.**
|
|
9
|
+
|
|
10
|
+
```js
|
|
11
|
+
// build-time exec_tool
|
|
12
|
+
const { accessToken } = await base44.asServiceRole.connectors.getConnection("wix"); // Base44 (generic: use $TOKEN)
|
|
13
|
+
const fs = require("fs");
|
|
14
|
+
// exec_tool's require can return EMPTY exports for these build-time modules — load the file itself:
|
|
15
|
+
const seed = (() => { const m = { exports: {} };
|
|
16
|
+
new Function("module", "exports", "require", fs.readFileSync("/app/.agents/skills/wix-vibe-headless/references/pricing-plans/seed/seed-pricing-plans.js", "utf8"))(m, m.exports, require);
|
|
17
|
+
return m.exports; })();
|
|
18
|
+
const ctx = { token: accessToken, siteId: WIX_METASITE_ID };
|
|
19
|
+
|
|
20
|
+
// setupPricingPlans installs the Wix Pricing Plans app first (idempotent) — base44 sites may not have it.
|
|
21
|
+
|
|
22
|
+
// DEFAULT: one call. Creates the plan(s), keeps their ids in memory, and (per plan) wires bookings
|
|
23
|
+
// coverage when provided — createPlans then attachBookingsCoverage (2a→2b→2c), in order.
|
|
24
|
+
const { plans, coverageAttached, benefitsCreated } = await seed.setupPricingPlans(ctx, {
|
|
25
|
+
plans: [
|
|
26
|
+
{ name: "Studio Membership", description: "Unlimited group classes.", price: "20.00",
|
|
27
|
+
type: "recurring", billingCycle: { period: "MONTH", count: 1 },
|
|
28
|
+
perks: ["Unlimited group classes", "10% off workshops"],
|
|
29
|
+
coveredServiceIds: bookingsServiceIds }, // optional — only when this plan covers bookings services
|
|
30
|
+
// …just the plan data. price = decimal STRING; currency is site-derived (don't send it).
|
|
31
|
+
// limited pack instead of unlimited: bookingsCoverage: { serviceIds, creditAmount: 8 }
|
|
32
|
+
],
|
|
33
|
+
});
|
|
34
|
+
// A plans-only run (no bookings) just omits coveredServiceIds — STEP 2 is skipped automatically.
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
**Seeding is additive — never delete or overwrite existing content.** Don't clean up, don't remove
|
|
38
|
+
"sample" data, don't reset. Just add.
|
|
39
|
+
|
|
40
|
+
## Escape hatch — individual functions
|
|
41
|
+
Reach for the functions below only when the one-call `setupPricingPlans` doesn't fit (custom coverage,
|
|
42
|
+
step-by-step control). `setupPricingPlans` is built from them, in this order:
|
|
43
|
+
|
|
44
|
+
```js
|
|
45
|
+
const plans = await seed.createPlans(ctx, [
|
|
46
|
+
{ name: "Studio Membership", price: "20.00", perks: ["Unlimited group classes"],
|
|
47
|
+
coveredServiceIds: bookingsServiceIds },
|
|
48
|
+
]);
|
|
49
|
+
// STEP 2 — only when bookings is in the run AND the plan covers services (skip otherwise):
|
|
50
|
+
await seed.attachBookingsCoverage(ctx, plans[0].id, plans[0].coveredServiceIds);
|
|
51
|
+
// limited pack instead of unlimited: attachBookingsCoverage(ctx, id, ids, { creditAmount: 8 })
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
## Functions
|
|
55
|
+
| fn | does |
|
|
56
|
+
|---|---|
|
|
57
|
+
| `setupPricingPlans(ctx, {plans})` | **DEFAULT** one call: createPlans → per-plan attachBookingsCoverage → `{plans,coverageAttached,benefitsCreated}` |
|
|
58
|
+
| `createPlans(ctx, plans)` | one create call per plan (V3 has no bulk) → `[{id,name,coveredServiceIds}]` |
|
|
59
|
+
| `attachBookingsCoverage(ctx, planId, serviceIds, {creditAmount?})` | STEP 2: 2a→2b→2c in order → `{itemSetId,serviceIds}` |
|
|
60
|
+
| `getProgramDefinition(ctx, planId)` | 2a: READ the auto-created program definition (retry-once on 404) → `programDefinitionId` |
|
|
61
|
+
| `createPoolDefinition(ctx, programDefinitionId, {creditAmount?})` | 2b: one pool + one Bookings benefit → `itemSetId` |
|
|
62
|
+
| `createBenefitItems(ctx, itemSetId, serviceIds)` | 2c: bulk-create one benefit item per covered service |
|
|
63
|
+
|
|
64
|
+
Plan `type`: `"recurring"` (default; `billingCycle` defaults to `{MONTH,1}`), `"one-time"`
|
|
65
|
+
(bills once then ends; pass `billingCycle: null` for the unlimited one-time), or `"free"`
|
|
66
|
+
(amount forced to `"0"` + a per-member-lifetime purchase limit). Amounts are decimal **strings**;
|
|
67
|
+
`perks` are display-only bullets; plans default to `visibility: "PUBLIC"` + `buyable: true`.
|
|
68
|
+
|
|
69
|
+
## Bookings-first dependency
|
|
70
|
+
STEP 2 attaches **bookings service ids** to a plan through the Benefit Programs API (the coverage
|
|
71
|
+
is NOT a plan field or a perk). Those ids come from the **bookings seed**
|
|
72
|
+
(`seeded.bookings.serviceIds[]`), so **seed bookings before pricing-plans** and pass the ids in as
|
|
73
|
+
`coveredServiceIds`. A plans-only run (no bookings) stops after `createPlans` — skip STEP 2 entirely.
|
|
74
|
+
|
|
75
|
+
## Reference
|
|
76
|
+
If a call returns a shape you didn't expect, or you need an operation this module doesn't cover,
|
|
77
|
+
use the **`wix-docs`** skill to search + read the live Wix API reference — never guess. The
|
|
78
|
+
authoritative source recipe is `wix-headless/references/inline-recipes/setup-pricing-plans.md`.
|
|
79
|
+
|
|
80
|
+
Read a method's page before writing its call: it carries the exact body shape, the required
|
|
81
|
+
permission scope, and the response envelope.
|
|
82
|
+
- Install a Wix app onto the site: https://dev.wix.com/docs/api-reference/business-management/app-installation/app-installation/install-app.md
|
|
83
|
+
- Create Plan: https://dev.wix.com/docs/api-reference/business-solutions/pricing-plans/plans-v3/create-plan.md
|
|
84
|
+
- Create Pool Definition (benefits): https://dev.wix.com/docs/api-reference/business-solutions/benefit-programs/pool-definitions/create-pool-definition.md
|
|
85
|
+
- Bulk Create Items (benefits): https://dev.wix.com/docs/api-reference/business-solutions/benefit-programs/items/bulk-create-items.md
|
|
86
|
+
- Get Program Definition By External Id And Namespace: https://dev.wix.com/docs/api-reference/business-solutions/benefit-programs/program-definitions/get-program-definition-by-external-id-and-namespace.md
|
|
@@ -0,0 +1,251 @@
|
|
|
1
|
+
// Pricing-Plans 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 Pricing Plans (V3)
|
|
3
|
+
// + Benefit Programs request/response mechanics (the client-supplied GUID rule, the string-amount
|
|
4
|
+
// rule, the three ordered coverage sub-steps, the @wix/pricing-plans namespace) live here, once.
|
|
5
|
+
//
|
|
6
|
+
// **NOT yet live-verified — transcribed from setup-pricing-plans.md.**
|
|
7
|
+
//
|
|
8
|
+
// Usage (build-time exec_tool):
|
|
9
|
+
// const { accessToken } = await base44.asServiceRole.connectors.getConnection("wix"); // Base44
|
|
10
|
+
// const seed = require("/app/.agents/skills/wix-vibe-headless/references/pricing-plans/seed/seed-pricing-plans.js");
|
|
11
|
+
// const ctx = { token: accessToken, siteId: WIX_METASITE_ID };
|
|
12
|
+
//
|
|
13
|
+
// // Bookings is seeded FIRST — its service ids feed a plan's coverage (see SEED.md).
|
|
14
|
+
// const plans = await seed.createPlans(ctx, [
|
|
15
|
+
// { name: "Studio Membership", description: "Unlimited group classes.", price: "20.00",
|
|
16
|
+
// type: "recurring", billingCycle: { period: "MONTH", count: 1 },
|
|
17
|
+
// perks: ["Unlimited group classes", "10% off workshops"],
|
|
18
|
+
// coveredServiceIds: bookingsServiceIds }, // optional — only when this plan covers bookings
|
|
19
|
+
// ]);
|
|
20
|
+
// // Then, per plan that covers bookings services (STEP 2; skip entirely with no bookings):
|
|
21
|
+
// await seed.attachBookingsCoverage(ctx, plans[0].id, plans[0].coveredServiceIds);
|
|
22
|
+
//
|
|
23
|
+
// If any call fails with a shape the caller didn't expect, fall back to the wix-docs skill
|
|
24
|
+
// (search + read the live Wix API reference) — never guess. Source recipe (authoritative):
|
|
25
|
+
// wix-headless/references/inline-recipes/setup-pricing-plans.md.
|
|
26
|
+
|
|
27
|
+
const { randomUUID } = require("crypto");
|
|
28
|
+
|
|
29
|
+
const API = "https://www.wixapis.com";
|
|
30
|
+
const BOOKINGS_APP_ID = "13d21c63-b5ec-5912-8397-c3a5ddb27a97"; // per recipe: providerAppId for coverage
|
|
31
|
+
const PRICING_PLANS_APP_ID = "1522827f-c56c-a5c9-2ac9-00f9e6ae12d3"; // installPricingPlansApp installs this before seeding
|
|
32
|
+
const PP_NAMESPACE = "@wix/pricing-plans"; // per recipe: literal, with @ and slash, in every 2a–2c call
|
|
33
|
+
|
|
34
|
+
async function req(ctx, path, { method = "POST", body } = {}) {
|
|
35
|
+
const res = await fetch(API + path, {
|
|
36
|
+
method,
|
|
37
|
+
headers: {
|
|
38
|
+
Authorization: `Bearer ${ctx.token}`,
|
|
39
|
+
"wix-site-id": ctx.siteId,
|
|
40
|
+
"Content-Type": "application/json",
|
|
41
|
+
},
|
|
42
|
+
body: body ? JSON.stringify(body) : undefined,
|
|
43
|
+
});
|
|
44
|
+
const json = await res.json().catch(() => ({}));
|
|
45
|
+
if (!res.ok) throw new Error(`${method} ${path} -> ${res.status}: ${JSON.stringify(json).slice(0, 400)}`);
|
|
46
|
+
return json;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
const sleep = (ms) => new Promise((r) => setTimeout(r, ms));
|
|
50
|
+
|
|
51
|
+
// [ "text" | { description } ] -> Wix perks[]; each gets a fresh client-supplied GUID (required).
|
|
52
|
+
function buildPerks(perks = []) {
|
|
53
|
+
return perks.map((p) => ({
|
|
54
|
+
id: randomUUID(),
|
|
55
|
+
description: typeof p === "string" ? p : p.description,
|
|
56
|
+
}));
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
// billingTerms selects the plan type (recurring | one-time | free). Amounts are decimal STRINGS.
|
|
60
|
+
// recurring: billingCycle {period,count} (default MONTH/1) + startType ON_PURCHASE + endType UNTIL_CANCELLED.
|
|
61
|
+
// one-time: endType CYCLES_COMPLETED + cyclesCompletedDetails {billingCycleCount:1} (bill once, then ends);
|
|
62
|
+
// an unlimited one-time instead sets billingCycle:null + endType UNTIL_CANCELLED.
|
|
63
|
+
function buildBillingTerms(plan) {
|
|
64
|
+
const type = plan.type || "recurring";
|
|
65
|
+
if (type === "one-time") {
|
|
66
|
+
if (plan.billingCycle === null) {
|
|
67
|
+
return { billingCycle: null, startType: "ON_PURCHASE", endType: "UNTIL_CANCELLED" };
|
|
68
|
+
}
|
|
69
|
+
const cycle = plan.billingCycle || { period: "MONTH", count: 1 };
|
|
70
|
+
return {
|
|
71
|
+
billingCycle: cycle,
|
|
72
|
+
startType: "ON_PURCHASE",
|
|
73
|
+
endType: "CYCLES_COMPLETED",
|
|
74
|
+
cyclesCompletedDetails: { billingCycleCount: 1 },
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
// recurring (also the shape a free plan rides on)
|
|
78
|
+
const cycle = plan.billingCycle || { period: "MONTH", count: 1 };
|
|
79
|
+
return { billingCycle: cycle, startType: "ON_PURCHASE", endType: "UNTIL_CANCELLED" };
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
// one pricingVariant with one pricingStrategy (schema allows ≤20 but is "currently limited to 1").
|
|
83
|
+
function buildPricingVariant(plan) {
|
|
84
|
+
const free = (plan.type || "recurring") === "free";
|
|
85
|
+
const amount = free ? "0" : String(plan.price);
|
|
86
|
+
return {
|
|
87
|
+
id: randomUUID(), // required, client-supplied GUID — never model-typed
|
|
88
|
+
name: plan.variantName || "Standard",
|
|
89
|
+
billingTerms: buildBillingTerms(plan),
|
|
90
|
+
pricingStrategies: [{ flatRate: { amount } }],
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
// ---- exported operations ----
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* Create the plan(s). Plans V3 has NO bulk-create — one create call per plan.
|
|
98
|
+
* @param plans [{ name, description?, price, // price = decimal string ("20.00"); ignored for free
|
|
99
|
+
* type?: "recurring"|"one-time"|"free", // default "recurring"
|
|
100
|
+
* billingCycle?: { period: "DAY"|"WEEK"|"MONTH"|"YEAR", count } | null, // default { MONTH, 1 }
|
|
101
|
+
* perks?: ["..."] | [{ description }], // display-only bullets (no functional effect)
|
|
102
|
+
* visibility?, buyable?, // default "PUBLIC" / true (public + orderable)
|
|
103
|
+
* coveredServiceIds? }] // metadata for attachBookingsCoverage; not sent here
|
|
104
|
+
* @returns [{ id, name, coveredServiceIds }] (id = plan.id — orders by it AND is the coverage externalId)
|
|
105
|
+
*/
|
|
106
|
+
async function createPlans(ctx, plans) {
|
|
107
|
+
const out = [];
|
|
108
|
+
for (const plan of plans) {
|
|
109
|
+
const free = (plan.type || "recurring") === "free";
|
|
110
|
+
const body = {
|
|
111
|
+
plan: {
|
|
112
|
+
name: plan.name,
|
|
113
|
+
description: plan.description,
|
|
114
|
+
status: "ACTIVE", // REQUIRED — omitting returns 400 "status value is required"
|
|
115
|
+
visibility: plan.visibility || "PUBLIC",
|
|
116
|
+
buyable: plan.buyable ?? true,
|
|
117
|
+
buyerCanCancel: plan.buyerCanCancel ?? true,
|
|
118
|
+
pricingVariants: [buildPricingVariant(plan)],
|
|
119
|
+
perks: buildPerks(plan.perks),
|
|
120
|
+
// free: cap lifetime reuse (older maxPurchasesPerBuyer is deprecated — prefer purchaseLimits)
|
|
121
|
+
...(free ? { purchaseLimits: { type: "PER_MEMBER_LIFETIME", count: 1 } } : {}),
|
|
122
|
+
},
|
|
123
|
+
};
|
|
124
|
+
const r = await req(ctx, "/pricing-plans/v3/plans", { body });
|
|
125
|
+
out.push({ id: r.plan?.id, name: plan.name, coveredServiceIds: plan.coveredServiceIds });
|
|
126
|
+
}
|
|
127
|
+
return out;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
// ---- STEP 2: bookings coverage via Benefit Programs API (SKIP when no bookings in the run) ----
|
|
131
|
+
// Strictly ordered: plan.id -> programDefinition.id -> itemSetId -> items. Do NOT parallelize.
|
|
132
|
+
|
|
133
|
+
// 2a: READ the auto-created program definition (the Plans app creates it; you never create it).
|
|
134
|
+
// Provisioning is ~immediate but async — retry ONCE after a short backoff on 404/empty, don't loop.
|
|
135
|
+
async function getProgramDefinition(ctx, planId) {
|
|
136
|
+
const path = `/benefit-programs/v1/program-definitions/by-namespace-and-external-id?externalId=${planId}&namespace=${encodeURIComponent(PP_NAMESPACE)}`;
|
|
137
|
+
try {
|
|
138
|
+
const r = await req(ctx, path, { method: "GET" });
|
|
139
|
+
if (r.programDefinition?.id) return r.programDefinition.id;
|
|
140
|
+
} catch {
|
|
141
|
+
// fall through to the single insurance retry
|
|
142
|
+
}
|
|
143
|
+
await sleep(1000);
|
|
144
|
+
const r = await req(ctx, path, { method: "GET" });
|
|
145
|
+
return r.programDefinition?.id;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
// 2b: create ONE pool definition with EXACTLY ONE benefit naming Bookings as the provider.
|
|
149
|
+
// price "0" = unlimited (default; no creditConfiguration). Limited pack: pass creditAmount ->
|
|
150
|
+
// price "1" + details.creditConfiguration (SIBLING of benefits[], NOT inside a benefit).
|
|
151
|
+
async function createPoolDefinition(ctx, programDefinitionId, { creditAmount } = {}) {
|
|
152
|
+
const limited = creditAmount != null;
|
|
153
|
+
const details = {
|
|
154
|
+
...(limited ? { creditConfiguration: { amount: String(creditAmount) } } : {}),
|
|
155
|
+
benefits: [
|
|
156
|
+
{
|
|
157
|
+
benefitKey: randomUUID(), // freshly generated random UUID you supply
|
|
158
|
+
displayName: "Bookings sessions",
|
|
159
|
+
providerAppId: BOOKINGS_APP_ID,
|
|
160
|
+
price: limited ? "1" : "0",
|
|
161
|
+
},
|
|
162
|
+
],
|
|
163
|
+
};
|
|
164
|
+
const r = await req(ctx, "/benefit-programs/v1/pool-definitions", {
|
|
165
|
+
body: {
|
|
166
|
+
poolDefinition: {
|
|
167
|
+
namespace: PP_NAMESPACE,
|
|
168
|
+
displayName: "Bookings benefit",
|
|
169
|
+
programDefinitionIds: [programDefinitionId],
|
|
170
|
+
details,
|
|
171
|
+
},
|
|
172
|
+
cascade: "IMMEDIATELY",
|
|
173
|
+
},
|
|
174
|
+
});
|
|
175
|
+
// itemSetId lives at poolDefinition.details.benefits[i].itemSetId — one benefit here, so [0].
|
|
176
|
+
return r.poolDefinition?.details?.benefits?.[0]?.itemSetId;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
// 2c: bulk-create the benefit items — ONE item per covered service (externalId = bookings service id).
|
|
180
|
+
// Up to 100 items per call; category is an empty string; namespace/providerAppId repeat 2b's values.
|
|
181
|
+
async function createBenefitItems(ctx, itemSetId, serviceIds) {
|
|
182
|
+
return req(ctx, "/benefit-programs/v1/bulk/items/create", {
|
|
183
|
+
body: {
|
|
184
|
+
items: serviceIds.map((externalId) => ({
|
|
185
|
+
namespace: PP_NAMESPACE,
|
|
186
|
+
category: "",
|
|
187
|
+
providerAppId: BOOKINGS_APP_ID,
|
|
188
|
+
itemSetId,
|
|
189
|
+
externalId,
|
|
190
|
+
})),
|
|
191
|
+
returnEntity: true,
|
|
192
|
+
},
|
|
193
|
+
});
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
/**
|
|
197
|
+
* Wire a plan to COVER bookings services (STEP 2, per plan). Runs 2a -> 2b -> 2c in order.
|
|
198
|
+
* @param planId plan.id from createPlans
|
|
199
|
+
* @param serviceIds bookings service ids (seeded.bookings.serviceIds[]) the plan should cover
|
|
200
|
+
* @param creditAmount? session-count for a limited pack; omit for the default unlimited ("0") case
|
|
201
|
+
* @returns { itemSetId, serviceIds } — keep as seed-time linkage (bookingsCoverage[planId])
|
|
202
|
+
*/
|
|
203
|
+
async function attachBookingsCoverage(ctx, planId, serviceIds, { creditAmount } = {}) {
|
|
204
|
+
const programDefinitionId = await getProgramDefinition(ctx, planId);
|
|
205
|
+
const itemSetId = await createPoolDefinition(ctx, programDefinitionId, { creditAmount });
|
|
206
|
+
await createBenefitItems(ctx, itemSetId, serviceIds);
|
|
207
|
+
return { itemSetId, serviceIds };
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
/**
|
|
211
|
+
* DEFAULT one-call path — create plan(s) and, per plan, wire bookings coverage when provided.
|
|
212
|
+
* One call; created plan ids stay in memory so coverage never needs hand-threading of plan.id.
|
|
213
|
+
* Order: createPlans (all plans) -> per covering plan attachBookingsCoverage (2a->2b->2c, in order).
|
|
214
|
+
* The program definition is provisioned asynchronously ~1s after the plan; the retry-once-after-
|
|
215
|
+
* backoff on its 404 lives in getProgramDefinition and is preserved via attachBookingsCoverage.
|
|
216
|
+
* @param plan { plans: [{ ...createPlans fields (name, description?, price, type?, billingCycle?,
|
|
217
|
+
* perks?, visibility?, buyable?),
|
|
218
|
+
* coveredServiceIds?, // bookings service ids this plan covers
|
|
219
|
+
* bookingsCoverage?: { serviceIds?, creditAmount? } }] } // richer coverage; creditAmount = limited pack
|
|
220
|
+
* @returns { plans: [{id,name,coveredServiceIds}], coverageAttached: [{planId,itemSetId,serviceIds}], benefitsCreated }
|
|
221
|
+
*/
|
|
222
|
+
// Install the Wix Pricing Plans app before seeding — base44 sites aren't guaranteed to have it (no
|
|
223
|
+
// separate Setup step here, unlike the wix-headless recipe). Idempotent: re-installing returns 200.
|
|
224
|
+
async function installPricingPlansApp(ctx) {
|
|
225
|
+
return req(ctx, "/apps-installer-service/v1/app-instance/install", { body: {
|
|
226
|
+
tenant: { tenantType: "SITE", id: ctx.siteId },
|
|
227
|
+
appInstance: { appDefId: PRICING_PLANS_APP_ID, enabled: true },
|
|
228
|
+
} });
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
async function setupPricingPlans(ctx, { plans = [] } = {}) {
|
|
232
|
+
await installPricingPlansApp(ctx);
|
|
233
|
+
const created = await createPlans(ctx, plans); // ids kept in memory
|
|
234
|
+
const coverageAttached = [];
|
|
235
|
+
for (let i = 0; i < created.length; i++) {
|
|
236
|
+
const cov = plans[i].bookingsCoverage || {};
|
|
237
|
+
const serviceIds = cov.serviceIds || created[i].coveredServiceIds;
|
|
238
|
+
if (!serviceIds?.length) continue; // plans-only plan — skip STEP 2
|
|
239
|
+
const r = await attachBookingsCoverage(ctx, created[i].id, serviceIds, { creditAmount: cov.creditAmount });
|
|
240
|
+
coverageAttached.push({ planId: created[i].id, ...r });
|
|
241
|
+
}
|
|
242
|
+
const benefitsCreated = coverageAttached.reduce((n, c) => n + c.serviceIds.length, 0);
|
|
243
|
+
return { plans: created, coverageAttached, benefitsCreated };
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
module.exports = {
|
|
247
|
+
setupPricingPlans, installPricingPlansApp,
|
|
248
|
+
createPlans,
|
|
249
|
+
attachBookingsCoverage,
|
|
250
|
+
getProgramDefinition, createPoolDefinition, createBenefitItems,
|
|
251
|
+
};
|