@wix/agent-skills 1.15.1 → 1.16.1

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.
Files changed (332) hide show
  1. package/README.md +3 -7
  2. package/package.json +1 -1
  3. package/skills/wix-app/SKILL.md +4 -1
  4. package/skills/wix-app/references/APP_TOOLS.md +134 -0
  5. package/skills/wix-app/references/CUSTOM_ELEMENT_WIDGET.md +1 -1
  6. package/skills/wix-app/references/DASHBOARD_PAGE.md +0 -10
  7. package/skills/wix-app/references/DATA_COLLECTION.md +1 -1
  8. package/skills/wix-app/references/EDITOR_REACT_COMPONENT.md +42 -8
  9. package/skills/wix-app/references/SERVICE_PLUGIN.md +12 -10
  10. package/skills/wix-app/references/app-tools/TOOLS.md +75 -0
  11. package/skills/wix-app/references/dashboard-page/DASHBOARD_API.md +2 -2
  12. package/skills/wix-app/references/editor-react-component/A11Y-REVIEW-REFERENCE.md +172 -0
  13. package/skills/wix-app/references/editor-react-component/A11Y-REVIEW.md +143 -0
  14. package/skills/wix-app/references/editor-react-component/ANIMATED-COMPONENTS.md +23 -2
  15. package/skills/wix-app/references/editor-react-component/BRANDED-COMPONENTS.md +29 -0
  16. package/skills/wix-app/references/editor-react-component/COMPONENT-API.md +1 -1
  17. package/skills/wix-app/references/editor-react-component/COMPONENT-CONFIGURATION.md +60 -0
  18. package/skills/wix-app/references/editor-react-component/CSS-GUIDELINES.md +27 -2
  19. package/skills/wix-app/references/editor-react-component/DESIGN-STATES.md +5 -3
  20. package/skills/wix-app/references/editor-react-component/DIRECTIONALITY.md +24 -7
  21. package/skills/wix-app/references/editor-react-component/PARTS.md +15 -2
  22. package/skills/wix-app/references/editor-react-component/REACT-GUIDELINES.md +2 -3
  23. package/skills/wix-app/references/editor-react-component/SITE-CONTEXT-HOOKS.md +187 -0
  24. package/skills/wix-app/references/service-plugin/BOOKINGS-STAFF-SORTING.md +13 -9
  25. package/skills/wix-app/references/service-plugin/DISCOUNT-TRIGGERS.md +4 -0
  26. package/skills/wix-app/references/service-plugin/GIFT-CARDS.md +4 -0
  27. package/skills/wix-app/references/service-plugin/PAYMENT-SETTINGS.md +3 -1
  28. package/skills/wix-app/references/service-plugin/SHIPPING-RATES.md +4 -0
  29. package/skills/wix-app/references/service-plugin/TOOLS_PROVIDER.md +54 -0
  30. package/skills/wix-app/references/stores/QUERY.md +32 -0
  31. package/skills/wix-app/scripts/scan-a11y-code.cjs +777 -0
  32. package/skills/wix-app/scripts/scan-a11y-eslint.cjs +201 -0
  33. package/skills/wix-docs/SKILL.md +35 -3
  34. package/skills/wix-headless/SKILL.md +3 -1
  35. package/skills/wix-headless/references/CAPABILITIES.md +16 -3
  36. package/skills/wix-headless/references/CONTENT.md +36 -0
  37. package/skills/wix-headless/references/DESIGN.md +54 -0
  38. package/skills/wix-headless/references/DISCOVERY.md +24 -0
  39. package/skills/wix-headless/references/IMAGE_GENERATION.md +10 -0
  40. package/skills/wix-headless/references/SDK_HANDOFF.md +1 -1
  41. package/skills/wix-headless/references/SEED.md +1 -1
  42. package/skills/wix-headless/references/inline-recipes/how-to-code-a-store.md +3 -2
  43. package/skills/wix-headless/references/inline-recipes/how-to-code-forms.md +560 -102
  44. package/skills/wix-headless/references/inline-recipes/setup-forms.md +210 -143
  45. package/skills/wix-headless/references/inline-recipes/setup-online-store.md +32 -23
  46. package/skills/wix-headless/references/managed/CONNECT.md +1 -1
  47. package/skills/wix-headless/references/managed/CREATE.md +14 -0
  48. package/skills/wix-headless/references/managed/DEPLOYMENT.md +25 -0
  49. package/skills/wix-manage/SKILL.md +130 -7
  50. package/skills/wix-manage/references/accessibility/scan-site-accessibility.md +98 -0
  51. package/skills/wix-manage/references/analytics/analytics-dashboard-navigation.md +40 -0
  52. package/skills/wix-manage/references/app-installation/app-installation-dashboard-navigation.md +28 -0
  53. package/skills/wix-manage/references/blog/blog-dashboard-navigation.md +56 -0
  54. package/skills/wix-manage/references/blog/how-to-create-blog-posts.md +31 -6
  55. package/skills/wix-manage/references/bookings/booking-service-policy-setup.md +3 -1
  56. package/skills/wix-manage/references/bookings/bookings-dashboard-navigation.md +63 -0
  57. package/skills/wix-manage/references/bookings/diagnose-availability-issues.md +10 -1
  58. package/skills/wix-manage/references/cms/cms-dashboard-navigation.md +44 -0
  59. package/skills/wix-manage/references/cms/cms-data-items-crud.md +31 -3
  60. package/skills/wix-manage/references/cms/cms-publishing-flow.md +287 -0
  61. package/skills/wix-manage/references/cms/cms-schema-management.md +27 -1
  62. package/skills/wix-manage/references/contacts/contacts-dashboard-navigation.md +46 -0
  63. package/skills/wix-manage/references/contacts/create-a-contact.md +82 -0
  64. package/skills/wix-manage/references/contacts/update-a-contact.md +119 -0
  65. package/skills/wix-manage/references/dashboard-navigation/dashboard-navigation.md +82 -0
  66. package/skills/wix-manage/references/dashboard-navigation/routes.json +1733 -0
  67. package/skills/wix-manage/references/domains/domains-dashboard-navigation.md +32 -0
  68. package/skills/wix-manage/references/ecommerce/ecom-pricing.md +4 -4
  69. package/skills/wix-manage/references/ecommerce/ecom-shipping.md +1 -1
  70. package/skills/wix-manage/references/ecommerce/gift-cards/ecom-gift-cards-goal-sell-gift-cards.md +338 -0
  71. package/skills/wix-manage/references/ecommerce/pricing-promotions/ecom-pricing-create-discount-rule.md +42 -78
  72. package/skills/wix-manage/references/ecommerce/pricing-promotions/ecom-pricing-flow-bundle-and-save.md +1 -1
  73. package/skills/wix-manage/references/ecommerce/pricing-promotions/ecom-pricing-flow-stock-mover.md +1 -1
  74. package/skills/wix-manage/references/ecommerce/pricing-promotions/ecom-pricing-flow-upsell-boost.md +1 -1
  75. package/skills/wix-manage/references/ecommerce/recommend-ecommerce-strategy.md +90 -92
  76. package/skills/wix-manage/references/events/create-wix-event.md +176 -0
  77. package/skills/wix-manage/references/events/manage-wix-events.md +174 -0
  78. package/skills/wix-manage/references/forms/forms-dashboard-navigation.md +44 -0
  79. package/skills/wix-manage/references/get-paid/get-paid-dashboard-navigation.md +52 -0
  80. package/skills/wix-manage/references/google-ads/billing-and-payment.md +80 -0
  81. package/skills/wix-manage/references/google-ads/create-performance-max-campaign.md +212 -0
  82. package/skills/wix-manage/references/google-ads/get-campaign-suggestions.md +110 -0
  83. package/skills/wix-manage/references/google-ads/google-ads-dashboard-navigation.md +25 -0
  84. package/skills/wix-manage/references/google-ads/install-and-create-account.md +155 -0
  85. package/skills/wix-manage/references/google-ads/manage-campaign-lifecycle.md +63 -0
  86. package/skills/wix-manage/references/google-ads/query-campaign-analytics.md +155 -0
  87. package/skills/wix-manage/references/marketing/marketing-dashboard-navigation.md +52 -0
  88. package/skills/wix-manage/references/pricing-plans/create-and-update-pricing-plans.md +99 -1
  89. package/skills/wix-manage/references/pricing-plans/pricing-plans-dashboard-navigation.md +45 -0
  90. package/skills/wix-manage/references/restaurants/restaurants-dashboard-navigation.md +68 -0
  91. package/skills/wix-manage/references/restaurants/wix-restaurants-setup.md +94 -125
  92. package/skills/wix-manage/references/site-properties/change-payment-currency-site-properties.md +48 -9
  93. package/skills/wix-manage/references/site-properties/site-properties-dashboard-navigation.md +31 -0
  94. package/skills/wix-manage/references/sites/create-headless-site.md +52 -0
  95. package/skills/wix-manage/references/sites/create-site-from-template.md +2 -25
  96. package/skills/wix-manage/references/sites/site-import.md +217 -192
  97. package/skills/wix-manage/references/sites/sites-dashboard-navigation.md +29 -0
  98. package/skills/wix-manage/references/stores/add-store-pages-to-site.md +17 -1
  99. package/skills/wix-manage/references/stores/find-products-query-and-search-catalog-v3.md +26 -8
  100. package/skills/wix-manage/references/stores/stores-dashboard-navigation.md +65 -0
  101. package/skills/wix-manage/references/stores/update-product-with-options.md +39 -7
  102. package/skills/wix-replatform/.publish-manifest.json +8 -0
  103. package/skills/wix-replatform/SKILL.md +693 -0
  104. package/skills/wix-replatform/lib/artifact-freshness.js +215 -0
  105. package/skills/wix-replatform/lib/completion-report.js +200 -0
  106. package/skills/wix-replatform/lib/config-env.js +59 -0
  107. package/skills/wix-replatform/lib/execution-manifest.js +185 -0
  108. package/skills/wix-replatform/lib/execution-state.js +173 -0
  109. package/skills/wix-replatform/lib/import-recovery.js +313 -0
  110. package/skills/wix-replatform/lib/local-state.js +642 -0
  111. package/skills/wix-replatform/lib/orchestration-preflight.js +143 -0
  112. package/skills/wix-replatform/lib/orchestration-router.js +122 -0
  113. package/skills/wix-replatform/lib/orchestration-state.js +455 -0
  114. package/skills/wix-replatform/lib/progress-log.js +224 -0
  115. package/skills/wix-replatform/lib/progress-log.sh +140 -0
  116. package/skills/wix-replatform/lib/url-preservation-state.js +391 -0
  117. package/skills/wix-replatform/resources/rp-discovery/SKILL.md +184 -0
  118. package/skills/wix-replatform/resources/rp-execute-import/SKILL.md +529 -0
  119. package/skills/wix-replatform/resources/rp-execute-setup/SKILL.md +316 -0
  120. package/skills/wix-replatform/resources/rp-execute-setup/scripts/mint-token.sh +64 -0
  121. package/skills/wix-replatform/resources/rp-import-codegen/SKILL.md +1114 -0
  122. package/skills/wix-replatform/resources/rp-mapper/SKILL.md +430 -0
  123. package/skills/wix-replatform/resources/rp-mapper/lib/mapping-resolve.js +217 -0
  124. package/skills/wix-replatform/resources/rp-mapper/scripts/resolve-mapping.js +148 -0
  125. package/skills/wix-replatform/resources/rp-mapper/wix-business-solutions-taxonomy.md +378 -0
  126. package/skills/wix-replatform/resources/rp-setup-discovery/SKILL.md +183 -0
  127. package/skills/wix-replatform/resources/rp-source-csv/SKILL.md +478 -0
  128. package/skills/wix-replatform/resources/rp-source-csv/lib/canonical-record.js +136 -0
  129. package/skills/wix-replatform/resources/rp-source-csv/lib/csv-fileset.js +0 -0
  130. package/skills/wix-replatform/resources/rp-source-csv/lib/csv-fingerprint.js +310 -0
  131. package/skills/wix-replatform/resources/rp-source-csv/lib/csv-layout.js +1081 -0
  132. package/skills/wix-replatform/resources/rp-source-csv/lib/csv-parse.js +618 -0
  133. package/skills/wix-replatform/resources/rp-source-csv/scripts/csv-discovery.js +949 -0
  134. package/skills/wix-replatform/resources/rp-source-csv/source-schema.example.json +196 -0
  135. package/skills/wix-replatform/resources/rp-source-csv/vendors/bigcommerce.json +66 -0
  136. package/skills/wix-replatform/resources/rp-source-csv/vendors/magento.json +60 -0
  137. package/skills/wix-replatform/resources/rp-source-csv/vendors/shopify.json +95 -0
  138. package/skills/wix-replatform/resources/rp-source-csv/vendors/woocommerce.json +82 -0
  139. package/skills/wix-replatform/resources/rp-source-wordpress/SKILL.md +256 -0
  140. package/skills/wix-replatform/resources/rp-source-wordpress/lib/wp-http.js +249 -0
  141. package/skills/wix-replatform/resources/rp-source-wordpress/lib/wp-route-classifier.js +444 -0
  142. package/skills/wix-replatform/resources/rp-source-wordpress/scripts/wp-discovery.js +774 -0
  143. package/skills/wix-replatform/resources/rp-source-wordpress/source-schema.example.json +71 -0
  144. package/skills/wix-replatform/resources/rp-target-wix/SKILL.md +632 -0
  145. package/skills/wix-replatform/resources/rp-target-wix/SPEC-product-reviews-and-blog-authorship.md +330 -0
  146. package/skills/wix-replatform/resources/rp-target-wix/domains/README.md +21 -0
  147. package/skills/wix-replatform/resources/rp-target-wix/domains/blog/domain.json +19 -0
  148. package/skills/wix-replatform/resources/rp-target-wix/domains/blog/entities/category.json +37 -0
  149. package/skills/wix-replatform/resources/rp-target-wix/domains/blog/entities/comment.json +37 -0
  150. package/skills/wix-replatform/resources/rp-target-wix/domains/blog/entities/post.json +39 -0
  151. package/skills/wix-replatform/resources/rp-target-wix/domains/blog/entities/tag.json +35 -0
  152. package/skills/wix-replatform/resources/rp-target-wix/domains/cms/domain.json +14 -0
  153. package/skills/wix-replatform/resources/rp-target-wix/domains/cms/entities/collection.json +35 -0
  154. package/skills/wix-replatform/resources/rp-target-wix/domains/cms/entities/data-item.json +36 -0
  155. package/skills/wix-replatform/resources/rp-target-wix/domains/cms/entities/reference.json +35 -0
  156. package/skills/wix-replatform/resources/rp-target-wix/domains/crm/domain.json +14 -0
  157. package/skills/wix-replatform/resources/rp-target-wix/domains/crm/entities/contact.json +131 -0
  158. package/skills/wix-replatform/resources/rp-target-wix/domains/crm/entities/email-subscription.json +37 -0
  159. package/skills/wix-replatform/resources/rp-target-wix/domains/crm/entities/label.json +37 -0
  160. package/skills/wix-replatform/resources/rp-target-wix/domains/ecom/domain.json +21 -0
  161. package/skills/wix-replatform/resources/rp-target-wix/domains/ecom/entities/order-line-item.json +37 -0
  162. package/skills/wix-replatform/resources/rp-target-wix/domains/ecom/entities/order-refund.json +37 -0
  163. package/skills/wix-replatform/resources/rp-target-wix/domains/ecom/entities/order.json +97 -0
  164. package/skills/wix-replatform/resources/rp-target-wix/domains/index.json +528 -0
  165. package/skills/wix-replatform/resources/rp-target-wix/domains/media/domain.json +14 -0
  166. package/skills/wix-replatform/resources/rp-target-wix/domains/media/entities/media-file.json +38 -0
  167. package/skills/wix-replatform/resources/rp-target-wix/domains/media/entities/media-folder.json +37 -0
  168. package/skills/wix-replatform/resources/rp-target-wix/domains/members/domain.json +13 -0
  169. package/skills/wix-replatform/resources/rp-target-wix/domains/members/entities/badge.json +37 -0
  170. package/skills/wix-replatform/resources/rp-target-wix/domains/members/entities/member.json +53 -0
  171. package/skills/wix-replatform/resources/rp-target-wix/domains/schema.json +84 -0
  172. package/skills/wix-replatform/resources/rp-target-wix/domains/stores/domain.json +25 -0
  173. package/skills/wix-replatform/resources/rp-target-wix/domains/stores/entities/category.json +37 -0
  174. package/skills/wix-replatform/resources/rp-target-wix/domains/stores/entities/coupon.json +37 -0
  175. package/skills/wix-replatform/resources/rp-target-wix/domains/stores/entities/inventory-item.json +38 -0
  176. package/skills/wix-replatform/resources/rp-target-wix/domains/stores/entities/product-tag.json +37 -0
  177. package/skills/wix-replatform/resources/rp-target-wix/domains/stores/entities/product.json +90 -0
  178. package/skills/wix-replatform/resources/rp-target-wix/lib/audit-summary.js +64 -0
  179. package/skills/wix-replatform/resources/rp-target-wix/lib/contract-ledger.js +141 -0
  180. package/skills/wix-replatform/resources/rp-target-wix/lib/domain-knowledge.js +384 -0
  181. package/skills/wix-replatform/resources/rp-target-wix/lib/ndjson.js +260 -0
  182. package/skills/wix-replatform/resources/rp-target-wix/lib/stores-verification.js +238 -0
  183. package/skills/wix-replatform/resources/rp-target-wix/lib/wix-build.js +237 -0
  184. package/skills/wix-replatform/resources/rp-target-wix/lib/wix-target-spec.js +238 -0
  185. package/skills/wix-replatform/resources/rp-target-wix/lib/wix-writers.js +2219 -0
  186. package/skills/wix-replatform/resources/rp-target-wix/scripts/domain-knowledge-validate.js +31 -0
  187. package/skills/wix-replatform/resources/rp-target-wix/scripts/domain-knowledge.js +100 -0
  188. package/skills/wix-replatform/resources/rp-target-wix/scripts/verify-stores.js +107 -0
  189. package/skills/wix-replatform/resources/rp-telemetry/SKILL.md +344 -0
  190. package/skills/wix-replatform/resources/rp-telemetry/lib/bi-sink.js +250 -0
  191. package/skills/wix-replatform/resources/rp-telemetry/lib/telemetry-recorder.js +1927 -0
  192. package/skills/wix-replatform/resources/rp-telemetry/scripts/meter-from-audit.js +83 -0
  193. package/skills/wix-replatform/resources/rp-telemetry/scripts/rp-telemetry.js +141 -0
  194. package/skills/wix-replatform/scripts/artifact-freshness.js +76 -0
  195. package/skills/wix-replatform/scripts/execution-manifest-validate.js +43 -0
  196. package/skills/wix-replatform/scripts/execution-state-prepare.js +128 -0
  197. package/skills/wix-replatform/scripts/orchestration-preflight.js +48 -0
  198. package/skills/wix-replatform/scripts/orchestration-route.js +46 -0
  199. package/skills/wix-replatform/scripts/orchestration-state.js +245 -0
  200. package/skills/wix-vibe-headless/SKILL.md +49 -25
  201. package/skills/wix-vibe-headless/install/deploy.cjs +156 -0
  202. package/skills/wix-vibe-headless/install/pin-agents-md.cjs +34 -0
  203. package/skills/wix-vibe-headless/platforms/README.md +8 -4
  204. package/skills/wix-vibe-headless/platforms/base44.md +111 -101
  205. package/skills/wix-vibe-headless/platforms/generic.md +99 -64
  206. package/skills/wix-vibe-headless/references/blog/INSTRUCTIONS.md +226 -119
  207. package/skills/wix-vibe-headless/references/blog/app/components/PostCard.jsx +43 -0
  208. package/skills/wix-vibe-headless/references/blog/app/components/PostChips.jsx +25 -0
  209. package/skills/wix-vibe-headless/references/blog/app/components/PostGrid.jsx +15 -0
  210. package/skills/wix-vibe-headless/references/blog/app/context/TaxonomyContext.jsx +35 -0
  211. package/skills/wix-vibe-headless/references/blog/app/hooks/usePostDetail.js +38 -0
  212. package/skills/wix-vibe-headless/references/blog/app/pages/Blog.jsx +40 -0
  213. package/skills/wix-vibe-headless/references/blog/app/pages/CategoryPage.jsx +54 -0
  214. package/skills/wix-vibe-headless/references/blog/app/pages/PostDetail.jsx +65 -0
  215. package/skills/wix-vibe-headless/references/blog/app/pages/TagPage.jsx +50 -0
  216. package/skills/wix-vibe-headless/references/blog/seed/SEED.md +103 -0
  217. package/skills/wix-vibe-headless/references/blog/seed/seed-blog.js +270 -0
  218. package/skills/wix-vibe-headless/references/bookings/INSTRUCTIONS.md +256 -149
  219. package/skills/wix-vibe-headless/references/bookings/app/components/BookingForm.jsx +65 -0
  220. package/skills/wix-vibe-headless/references/bookings/app/components/ServiceCard.jsx +47 -0
  221. package/skills/wix-vibe-headless/references/bookings/app/components/ServiceGrid.jsx +13 -0
  222. package/skills/wix-vibe-headless/references/bookings/app/components/SlotPicker.jsx +126 -0
  223. package/skills/wix-vibe-headless/references/bookings/app/hooks/useServiceDetail.js +108 -0
  224. package/skills/wix-vibe-headless/references/bookings/app/hooks/useServices.js +58 -0
  225. package/skills/wix-vibe-headless/references/bookings/app/lib/serviceFacts.js +95 -0
  226. package/skills/wix-vibe-headless/references/bookings/app/pages/ServiceDetail.jsx +94 -0
  227. package/skills/wix-vibe-headless/references/bookings/app/pages/Services.jsx +89 -0
  228. package/skills/wix-vibe-headless/references/bookings/{wix-bookings-checkout.js → app/rest/wix-bookings-checkout.js} +1 -1
  229. package/skills/wix-vibe-headless/references/bookings/{wix-bookings-services.js → app/rest/wix-bookings-services.js} +87 -11
  230. package/skills/wix-vibe-headless/references/bookings/seed/SEED.md +117 -0
  231. package/skills/wix-vibe-headless/references/bookings/seed/seed-bookings.js +333 -0
  232. package/skills/wix-vibe-headless/references/cms/INSTRUCTIONS.md +168 -147
  233. package/skills/wix-vibe-headless/references/cms/app/collection.config.js +31 -0
  234. package/skills/wix-vibe-headless/references/cms/app/lib/wixImage.js +18 -0
  235. package/skills/wix-vibe-headless/references/cms/{wix-cms.js → app/rest/wix-cms.js} +47 -2
  236. package/skills/wix-vibe-headless/references/cms/seed/SEED.md +145 -0
  237. package/skills/wix-vibe-headless/references/events/INSTRUCTIONS.md +223 -131
  238. package/skills/wix-vibe-headless/references/events/app/components/CategoryFilter.jsx +23 -0
  239. package/skills/wix-vibe-headless/references/events/app/components/EventCard.jsx +43 -0
  240. package/skills/wix-vibe-headless/references/events/app/components/EventGrid.jsx +13 -0
  241. package/skills/wix-vibe-headless/references/events/app/components/EventRegistration.jsx +29 -0
  242. package/skills/wix-vibe-headless/references/events/app/components/RsvpForm.jsx +57 -0
  243. package/skills/wix-vibe-headless/references/events/app/components/TicketPicker.jsx +78 -0
  244. package/skills/wix-vibe-headless/references/events/app/hooks/useEventDetail.js +27 -0
  245. package/skills/wix-vibe-headless/references/events/app/hooks/useEventsList.js +54 -0
  246. package/skills/wix-vibe-headless/references/events/app/hooks/useRsvpForm.js +40 -0
  247. package/skills/wix-vibe-headless/references/events/app/hooks/useTicketing.js +81 -0
  248. package/skills/wix-vibe-headless/references/events/app/pages/EventDetail.jsx +48 -0
  249. package/skills/wix-vibe-headless/references/events/app/pages/Events.jsx +36 -0
  250. package/skills/wix-vibe-headless/references/events/{wix-events-browse.js → app/rest/wix-events-browse.js} +1 -1
  251. package/skills/wix-vibe-headless/references/events/seed/SEED.md +107 -0
  252. package/skills/wix-vibe-headless/references/events/seed/seed-events.js +251 -0
  253. package/skills/wix-vibe-headless/references/members/INSTRUCTIONS.md +272 -188
  254. package/skills/wix-vibe-headless/references/members/app/components/LoginForm.jsx +101 -0
  255. package/skills/wix-vibe-headless/references/members/app/components/MemberMenu.jsx +33 -0
  256. package/skills/wix-vibe-headless/references/members/app/components/RequireAuth.jsx +21 -0
  257. package/skills/wix-vibe-headless/references/members/app/components/SocialButtons.jsx +29 -0
  258. package/skills/wix-vibe-headless/references/members/app/context/MemberContext.jsx +54 -0
  259. package/skills/wix-vibe-headless/references/members/app/hooks/useLoginForm.js +77 -0
  260. package/skills/wix-vibe-headless/references/members/app/pages/Account.jsx +36 -0
  261. package/skills/wix-vibe-headless/references/members/app/pages/Callback.jsx +32 -0
  262. package/skills/wix-vibe-headless/references/members/app/pages/Login.jsx +35 -0
  263. package/skills/wix-vibe-headless/references/members/{wix-members-auth.js → app/rest/wix-members-auth.js} +6 -3
  264. package/skills/wix-vibe-headless/references/members/install/Register.jsx +22 -0
  265. package/skills/wix-vibe-headless/references/members/seed/SEED.md +22 -0
  266. package/skills/wix-vibe-headless/references/portfolio/INSTRUCTIONS.md +229 -104
  267. package/skills/wix-vibe-headless/references/portfolio/app/components/CollectionCard.jsx +31 -0
  268. package/skills/wix-vibe-headless/references/portfolio/app/components/CollectionGrid.jsx +15 -0
  269. package/skills/wix-vibe-headless/references/portfolio/app/components/ProjectCard.jsx +39 -0
  270. package/skills/wix-vibe-headless/references/portfolio/app/components/ProjectGrid.jsx +15 -0
  271. package/skills/wix-vibe-headless/references/portfolio/app/components/ProjectMedia.jsx +29 -0
  272. package/skills/wix-vibe-headless/references/portfolio/app/hooks/useCollectionProjects.js +35 -0
  273. package/skills/wix-vibe-headless/references/portfolio/app/hooks/usePortfolioGallery.js +27 -0
  274. package/skills/wix-vibe-headless/references/portfolio/app/hooks/useProjectDetail.js +25 -0
  275. package/skills/wix-vibe-headless/references/portfolio/app/pages/CollectionPage.jsx +39 -0
  276. package/skills/wix-vibe-headless/references/portfolio/app/pages/Portfolio.jsx +27 -0
  277. package/skills/wix-vibe-headless/references/portfolio/app/pages/ProjectDetail.jsx +60 -0
  278. package/skills/wix-vibe-headless/references/portfolio/seed/SEED.md +94 -0
  279. package/skills/wix-vibe-headless/references/portfolio/seed/seed-portfolio.js +236 -0
  280. package/skills/wix-vibe-headless/references/pricing-plans/INSTRUCTIONS.md +236 -117
  281. package/skills/wix-vibe-headless/references/pricing-plans/app/components/OrderCard.jsx +35 -0
  282. package/skills/wix-vibe-headless/references/pricing-plans/app/components/PlanCard.jsx +48 -0
  283. package/skills/wix-vibe-headless/references/pricing-plans/app/components/PlanGrid.jsx +16 -0
  284. package/skills/wix-vibe-headless/references/pricing-plans/app/components/PlanPrice.jsx +35 -0
  285. package/skills/wix-vibe-headless/references/pricing-plans/app/hooks/useMyPlans.js +25 -0
  286. package/skills/wix-vibe-headless/references/pricing-plans/app/hooks/usePlanDetail.js +28 -0
  287. package/skills/wix-vibe-headless/references/pricing-plans/app/hooks/usePlans.js +30 -0
  288. package/skills/wix-vibe-headless/references/pricing-plans/app/pages/MyPlans.jsx +30 -0
  289. package/skills/wix-vibe-headless/references/pricing-plans/app/pages/PlanDetail.jsx +53 -0
  290. package/skills/wix-vibe-headless/references/pricing-plans/app/pages/Plans.jsx +28 -0
  291. package/skills/wix-vibe-headless/references/pricing-plans/seed/SEED.md +86 -0
  292. package/skills/wix-vibe-headless/references/pricing-plans/seed/seed-pricing-plans.js +251 -0
  293. package/skills/wix-vibe-headless/references/restaurants/INSTRUCTIONS.md +244 -124
  294. package/skills/wix-vibe-headless/references/restaurants/app/components/ItemDialog.jsx +81 -0
  295. package/skills/wix-vibe-headless/references/restaurants/app/components/MenuItemCard.jsx +71 -0
  296. package/skills/wix-vibe-headless/references/restaurants/app/components/MenuList.jsx +43 -0
  297. package/skills/wix-vibe-headless/references/restaurants/app/components/OrderCartButton.jsx +21 -0
  298. package/skills/wix-vibe-headless/references/restaurants/app/components/OrderCartDrawer.jsx +60 -0
  299. package/skills/wix-vibe-headless/references/restaurants/app/context/OrderCartContext.jsx +63 -0
  300. package/skills/wix-vibe-headless/references/restaurants/app/hooks/useItemOrder.js +32 -0
  301. package/skills/wix-vibe-headless/references/restaurants/app/hooks/useReservation.js +73 -0
  302. package/skills/wix-vibe-headless/references/restaurants/app/pages/Menu.jsx +28 -0
  303. package/skills/wix-vibe-headless/references/restaurants/app/pages/Reservations.jsx +102 -0
  304. package/skills/wix-vibe-headless/references/restaurants/seed/SEED.md +180 -0
  305. package/skills/wix-vibe-headless/references/restaurants/seed/seed-restaurants.js +452 -0
  306. package/skills/wix-vibe-headless/references/shared/app/components/WixManageBanner.jsx +56 -0
  307. package/skills/wix-vibe-headless/references/shared/{wix-client.js → app/rest/wix-client.js} +6 -8
  308. package/skills/wix-vibe-headless/references/shared/app/rest/wix-config.js +8 -0
  309. package/skills/wix-vibe-headless/references/storefront/INSTRUCTIONS.md +259 -157
  310. package/skills/wix-vibe-headless/references/storefront/app/components/CartButton.jsx +20 -0
  311. package/skills/wix-vibe-headless/references/storefront/app/components/CartDrawer.jsx +150 -0
  312. package/skills/wix-vibe-headless/references/storefront/app/components/ProductCard.jsx +167 -0
  313. package/skills/wix-vibe-headless/references/storefront/app/components/ProductGallery.jsx +51 -0
  314. package/skills/wix-vibe-headless/references/storefront/app/components/ProductGrid.jsx +54 -0
  315. package/skills/wix-vibe-headless/references/storefront/app/components/VariantPicker.jsx +119 -0
  316. package/skills/wix-vibe-headless/references/storefront/app/context/CartContext.jsx +71 -0
  317. package/skills/wix-vibe-headless/references/storefront/app/hooks/useProductDetail.js +109 -0
  318. package/skills/wix-vibe-headless/references/storefront/app/hooks/useShop.js +98 -0
  319. package/skills/wix-vibe-headless/references/storefront/app/lib/storeImage.js +27 -0
  320. package/skills/wix-vibe-headless/references/storefront/app/pages/ProductDetail.jsx +139 -0
  321. package/skills/wix-vibe-headless/references/storefront/app/pages/Shop.jsx +75 -0
  322. package/skills/wix-vibe-headless/references/storefront/{wix-store-cart.js → app/rest/wix-store-cart.js} +1 -1
  323. package/skills/wix-vibe-headless/references/storefront/{wix-store-catalog.js → app/rest/wix-store-catalog.js} +20 -1
  324. package/skills/wix-vibe-headless/references/storefront/seed/SEED.md +111 -0
  325. package/skills/wix-vibe-headless/references/storefront/seed/seed-store.js +338 -0
  326. /package/skills/wix-vibe-headless/references/blog/{wix-blog.js → app/rest/wix-blog.js} +0 -0
  327. /package/skills/wix-vibe-headless/references/events/{wix-events-registration.js → app/rest/wix-events-registration.js} +0 -0
  328. /package/skills/wix-vibe-headless/references/portfolio/{wix-portfolio.js → app/rest/wix-portfolio.js} +0 -0
  329. /package/skills/wix-vibe-headless/references/pricing-plans/{wix-pricing-plans.js → app/rest/wix-pricing-plans.js} +0 -0
  330. /package/skills/wix-vibe-headless/references/restaurants/{wix-restaurants-menu.js → app/rest/wix-restaurants-menu.js} +0 -0
  331. /package/skills/wix-vibe-headless/references/restaurants/{wix-restaurants-ordering.js → app/rest/wix-restaurants-ordering.js} +0 -0
  332. /package/skills/wix-vibe-headless/references/restaurants/{wix-restaurants-reservations.js → app/rest/wix-restaurants-reservations.js} +0 -0
@@ -0,0 +1,338 @@
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
+ // description string -> Wix rich-text node tree.
86
+ //
87
+ // Descriptions arrive as HTML as often as not: asked to describe a product, a model writes
88
+ // <p>…</p><strong>Care:</strong><br/>. The writable field is `description` (Ricos nodes) — the HTML
89
+ // `plainDescription` the storefront renders is read-only, derived from them. So markup dropped into
90
+ // a single TEXT node is stored as literal text, comes back escaped, and the PDP shows the tags to
91
+ // the buyer. Convert the tags a model actually emits; a string with no tags stays one paragraph.
92
+ const HTML_ENTITIES = { "&amp;": "&", "&lt;": "<", "&gt;": ">", "&quot;": '"', "&#39;": "'", "&nbsp;": " " };
93
+
94
+ function decodeEntities(s) {
95
+ return s.replace(/&(?:amp|lt|gt|quot|#39|nbsp);/g, (m) => HTML_ENTITIES[m] ?? m);
96
+ }
97
+
98
+ // One paragraph's inner HTML -> TEXT nodes, carrying bold/italic as Ricos decorations.
99
+ function mkTextNodes(html) {
100
+ const nodes = [];
101
+ let bold = 0, italic = 0, last = 0, m;
102
+ const tag = /<(\/?)(strong|b|em|i)\s*\/?>/gi;
103
+ const push = (raw) => {
104
+ const text = decodeEntities(raw.replace(/<[^>]*>/g, ""));
105
+ if (!text) return;
106
+ const decorations = [];
107
+ if (bold > 0) decorations.push({ type: "BOLD" });
108
+ if (italic > 0) decorations.push({ type: "ITALIC" });
109
+ nodes.push({ type: "TEXT", textData: { text, decorations } });
110
+ };
111
+ while ((m = tag.exec(html)) !== null) {
112
+ push(html.slice(last, m.index));
113
+ const step = m[1] ? -1 : 1;
114
+ if (/^(strong|b)$/i.test(m[2])) bold = Math.max(0, bold + step);
115
+ else italic = Math.max(0, italic + step);
116
+ last = tag.lastIndex;
117
+ }
118
+ push(html.slice(last));
119
+ return nodes.length ? nodes : [{ type: "TEXT", textData: { text: "", decorations: [] } }];
120
+ }
121
+
122
+ function mkDesc(text, i) {
123
+ const blocks = String(text ?? "").split(/<\/p\s*>|<br\s*\/?>/i).map((b) => b.trim()).filter(Boolean);
124
+ return {
125
+ nodes: (blocks.length ? blocks : [""]).map((block, n) => ({
126
+ type: "PARAGRAPH", id: `desc-${i}-${n}`,
127
+ nodes: mkTextNodes(block),
128
+ paragraphData: { textStyle: { textAlignment: "AUTO" } },
129
+ })),
130
+ metadata: { version: 1, id: `desc-meta-${i}` },
131
+ };
132
+ }
133
+
134
+ // [{name, type?:"text"|"color", choices:["8","9"] | [{name,colorCode}]}] -> Wix options[]
135
+ function buildOptions(options = []) {
136
+ return options.map((o) => {
137
+ const color = o.type === "color";
138
+ return {
139
+ name: o.name,
140
+ optionRenderType: color ? "SWATCH_CHOICES" : "TEXT_CHOICES",
141
+ choicesSettings: {
142
+ choices: o.choices.map((c) =>
143
+ color
144
+ ? { choiceType: "ONE_COLOR", name: c.name, colorCode: c.colorCode }
145
+ : { choiceType: "CHOICE_TEXT", name: typeof c === "string" ? c : c.name }),
146
+ },
147
+ };
148
+ });
149
+ }
150
+
151
+ // full Cartesian product of variants, each priced/stocked from the product; visible:true baked in
152
+ function expandVariants(options = [], { price, compareAtPrice, quantity }) {
153
+ const base = {
154
+ price: {
155
+ actualPrice: { amount: String(price) },
156
+ ...(compareAtPrice ? { compareAtPrice: { amount: String(compareAtPrice) } } : {}),
157
+ },
158
+ visible: true,
159
+ physicalProperties: {},
160
+ inventoryItem: { quantity: quantity ?? 0, preorderInfo: { enabled: false } },
161
+ };
162
+ if (!options.length) return [base];
163
+ let combos = [[]];
164
+ for (const o of options) {
165
+ const rt = o.type === "color" ? "SWATCH_CHOICES" : "TEXT_CHOICES";
166
+ const names = o.choices.map((c) => (typeof c === "string" ? c : c.name));
167
+ combos = combos.flatMap((combo) =>
168
+ names.map((choiceName) => [...combo, { optionChoiceNames: { optionName: o.name, choiceName, renderType: rt } }]));
169
+ }
170
+ return combos.map((choices) => ({ ...base, choices }));
171
+ }
172
+
173
+ // ---- exported operations ----
174
+
175
+ async function installStoresApp(ctx) {
176
+ try {
177
+ await req(ctx, "/apps-installer-service/v1/app-instance/install", { body: {
178
+ tenant: { tenantType: "SITE", id: ctx.siteId },
179
+ appInstance: { appDefId: STORES_APP_ID, enabled: true },
180
+ } });
181
+ } catch {
182
+ // already installed is fine — the readiness wait below still confirms the V3 catalog is live
183
+ }
184
+ // Do NOT return to the caller until V3 is ready, else the first V3 seed call 428s on CATALOG_V1.
185
+ await waitForCatalogV3(ctx);
186
+ }
187
+
188
+ async function listProducts(ctx) {
189
+ const r = await req(ctx, "/stores/v3/products/query", { body: { query: { paging: { limit: 50 } } } });
190
+ return (r.products ?? []).map((p) => ({ id: p.id, name: p.name }));
191
+ }
192
+
193
+ /**
194
+ * Bulk-create products.
195
+ * @param products [{ name, description, price, compareAtPrice?, quantity,
196
+ * options?: [{ name, type?:"text"|"color", choices:["8","9"] | [{name,colorCode}] }] }]
197
+ * description: plain text, or simple HTML (`<p>`, `<br/>`, `<strong>`, `<em>`) — converted to
198
+ * Wix rich text here, so the storefront renders paragraphs and bold rather than tag text.
199
+ * options = ONLY things the buyer selects-and-buys (Size, Color) -> become variants.
200
+ * Display-only attributes go in name/category/description, NOT options. Default: no options.
201
+ * visible/physicalProperties/variant-expansion handled here. `quantity` is the stock created.
202
+ * @returns [{ id, slug, revision }]
203
+ */
204
+ async function bulkCreateProducts(ctx, products) {
205
+ const body = {
206
+ returnEntity: true,
207
+ products: products.map((p, i) => ({
208
+ name: p.name,
209
+ productType: "PHYSICAL",
210
+ physicalProperties: {},
211
+ visible: true,
212
+ visibleInPos: true,
213
+ description: mkDesc(p.description, i),
214
+ options: buildOptions(p.options),
215
+ variantsInfo: { variants: expandVariants(p.options, p) },
216
+ })),
217
+ };
218
+ const r = await req(ctx, "/stores/v3/bulk/products-with-inventory/create", { body });
219
+ // NB: results nest under productResults.results[].item — NOT a top-level `results`.
220
+ const created = (r.productResults?.results ?? []).map((x, i) => ({
221
+ id: x.item?.id, slug: x.item?.slug, revision: x.item?.revision,
222
+ variantId: x.item?.variantsInfo?.variants?.[0]?.id,
223
+ hasOptions: (products[i]?.options?.length ?? 0) > 0,
224
+ quantity: products[i]?.quantity ?? 0,
225
+ }));
226
+ await stockOptionlessProducts(ctx, created);
227
+ return created.map((p) => ({ id: p.id, slug: p.slug, revision: p.revision }));
228
+ }
229
+
230
+ // products-with-inventory/create stocks a variant via its choices; an OPTION-LESS product has a
231
+ // single choiceless (default) variant that the create does NOT stock — it lands OUT_OF_STOCK. So
232
+ // set stock on those default variants explicitly (bulk/inventory-items/create). Products WITH options
233
+ // are already stocked by the create above, so they're skipped. Backfills the default variantId from a
234
+ // query if the create response didn't return it.
235
+ async function stockOptionlessProducts(ctx, created) {
236
+ const need = created.filter((p) => !p.hasOptions && p.id);
237
+ if (!need.length) return;
238
+ const missing = need.filter((p) => !p.variantId).map((p) => p.id);
239
+ if (missing.length) {
240
+ const q = await req(ctx, "/stores/v3/products/query", { body: { query: { filter: { id: { $in: missing } }, paging: { limit: missing.length } } } });
241
+ const vById = new Map((q.products ?? []).map((p) => [p.id, p.variantsInfo?.variants?.[0]?.id]));
242
+ need.forEach((p) => { if (!p.variantId) p.variantId = vById.get(p.id); });
243
+ }
244
+ const inventoryItems = need
245
+ .filter((p) => p.variantId)
246
+ .map((p) => ({ productId: p.id, variantId: p.variantId, quantity: p.quantity }));
247
+ if (inventoryItems.length) {
248
+ await req(ctx, "/stores/v3/bulk/inventory-items/create", { body: { inventoryItems } });
249
+ }
250
+ }
251
+
252
+ // Categories: no bulk create, and MUST be sequential — they share the @wix/stores tree revision,
253
+ // so concurrent creates 409. Run after products (catalog can lag right after the Stores install).
254
+ async function createCategories(ctx, names) {
255
+ const out = [];
256
+ for (const name of names) {
257
+ const r = await req(ctx, "/categories/v1/categories", {
258
+ body: { category: { name, visible: true }, treeReference: { appNamespace: "@wix/stores", treeKey: null } },
259
+ });
260
+ out.push({ id: r.category?.id, name });
261
+ }
262
+ return out;
263
+ }
264
+
265
+ // mapping: { [categoryId]: [productId, ...] } — also sequential (same shared tree)
266
+ async function addProductsToCategories(ctx, mapping) {
267
+ for (const [categoryId, productIds] of Object.entries(mapping)) {
268
+ await req(ctx, `/categories/v1/bulk/categories/${categoryId}/add-items`, {
269
+ body: {
270
+ items: productIds.map((catalogItemId) => ({ catalogItemId, appId: STORES_APP_ID })),
271
+ treeReference: { appNamespace: "@wix/stores", treeKey: null },
272
+ },
273
+ });
274
+ }
275
+ }
276
+
277
+ // Bulk image attach in ONE call. items: [{ id, url, altText }] — NO revision.
278
+ // An attach bumps the product's revision, so a caller-supplied revision goes stale between passes
279
+ // (INVALID_REVISION); we read each product's CURRENT revision here, right before the update, so the
280
+ // caller never manages a revision token — attach any number of times, in any pass. Wix re-hosts the
281
+ // image from the url server-side; the re-hosted media can take a little while to appear on read-back
282
+ // (propagation) — that's normal, not a failure, so we don't block on it.
283
+ async function attachProductImages(ctx, items) {
284
+ if (!items?.length) return;
285
+ const ids = items.map((it) => it.id);
286
+ const q = await req(ctx, "/stores/v3/products/query", { body: { query: { filter: { id: { $in: ids } }, paging: { limit: ids.length } } } });
287
+ const revById = new Map((q.products ?? []).map((p) => [p.id, p.revision]));
288
+ return req(ctx, "/stores/v3/bulk/products/update", {
289
+ body: {
290
+ products: items.map((it) => ({
291
+ product: { id: it.id, revision: revById.get(it.id), media: { itemsInfo: { items: [{ url: it.url, altText: it.altText }] } } },
292
+ })),
293
+ },
294
+ });
295
+ }
296
+
297
+ /**
298
+ * ONE-CALL seed: install → create products → categories → attach images, in the correct order,
299
+ * keeping the created ids in memory (no hand-threading of product ids across exec calls). This is
300
+ * the DEFAULT path — call it once instead of the individual functions.
301
+ *
302
+ * @param plan {{
303
+ * products: [{ name, description, price, compareAtPrice?, quantity, options?, imageUrl?, altText? }],
304
+ * categories?: { [categoryName]: string[] }, // map of category name -> product NAMES in it
305
+ * }}
306
+ * @returns { products: [{id,slug,revision,name}], categories: [{id,name}], imagesAttached: number }
307
+ */
308
+ async function setupStore(ctx, { products = [], categories = {} } = {}) {
309
+ await installStoresApp(ctx); // installs if needed AND waits for the V3 catalog to be ready
310
+
311
+ const created = await bulkCreateProducts(ctx, products);
312
+ const withNames = created.map((p, i) => ({ ...p, name: products[i]?.name }));
313
+ const idByName = new Map(withNames.map((p) => [p.name, p.id]));
314
+
315
+ const names = Object.keys(categories);
316
+ const cats = names.length ? await createCategories(ctx, names) : [];
317
+ if (cats.length) {
318
+ const mapping = {};
319
+ for (const c of cats) {
320
+ const ids = (categories[c.name] || []).map((n) => idByName.get(n)).filter(Boolean);
321
+ if (ids.length) mapping[c.id] = ids;
322
+ }
323
+ if (Object.keys(mapping).length) await addProductsToCategories(ctx, mapping);
324
+ }
325
+
326
+ const imageItems = withNames
327
+ .map((p, i) => ({ id: p.id, url: products[i]?.imageUrl, altText: products[i]?.altText ?? p.slug }))
328
+ .filter((it) => it.url);
329
+ if (imageItems.length) await attachProductImages(ctx, imageItems);
330
+
331
+ return { products: withNames, categories: cats, imagesAttached: imageItems.length };
332
+ }
333
+
334
+ module.exports = {
335
+ setupStore,
336
+ installStoresApp, listProducts,
337
+ bulkCreateProducts, createCategories, addProductsToCategories, attachProductImages,
338
+ };