@wix/agent-skills 1.14.0 → 1.15.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 (268) hide show
  1. package/README.md +12 -1
  2. package/package.json +1 -1
  3. package/skills/README.md +23 -0
  4. package/skills/wix-app/SKILL.md +10 -2
  5. package/skills/wix-app/references/AUTO_PATTERNS_DASHBOARD.md +326 -0
  6. package/skills/wix-app/references/CODE_QUALITY.md +1 -0
  7. package/skills/wix-app/references/CUSTOM_ELEMENT_WIDGET.md +124 -115
  8. package/skills/wix-app/references/DASHBOARD_PAGE.md +3 -0
  9. package/skills/wix-app/references/DATA_COLLECTION.md +5 -3
  10. package/skills/wix-app/references/EDITOR_REACT_COMPONENT.md +25 -9
  11. package/skills/wix-app/references/SITE_PLUGIN.md +1 -1
  12. package/skills/wix-app/references/STORES_VERSIONING.md +9 -211
  13. package/skills/wix-app/references/auto-patterns-dashboard/action-cell.md +115 -0
  14. package/skills/wix-app/references/auto-patterns-dashboard/app-config-structure.md +264 -0
  15. package/skills/wix-app/references/auto-patterns-dashboard/app-context.md +37 -0
  16. package/skills/wix-app/references/auto-patterns-dashboard/bulk-actions.md +86 -0
  17. package/skills/wix-app/references/auto-patterns-dashboard/collection-page-actions.md +119 -0
  18. package/skills/wix-app/references/auto-patterns-dashboard/collection-page.md +103 -0
  19. package/skills/wix-app/references/auto-patterns-dashboard/custom-actions-override.md +76 -0
  20. package/skills/wix-app/references/auto-patterns-dashboard/custom-columns-override.md +82 -0
  21. package/skills/wix-app/references/auto-patterns-dashboard/custom-components-override.md +89 -0
  22. package/skills/wix-app/references/auto-patterns-dashboard/custom-header-override.md +124 -0
  23. package/skills/wix-app/references/auto-patterns-dashboard/custom-sections-override.md +91 -0
  24. package/skills/wix-app/references/auto-patterns-dashboard/custom-slots-override.md +71 -0
  25. package/skills/wix-app/references/auto-patterns-dashboard/entity-page-actions.md +70 -0
  26. package/skills/wix-app/references/auto-patterns-dashboard/entity-page-view-actions.md +73 -0
  27. package/skills/wix-app/references/auto-patterns-dashboard/entity-page.md +98 -0
  28. package/skills/wix-app/references/auto-patterns-dashboard/example-patterns.json +278 -0
  29. package/skills/wix-app/references/auto-patterns-dashboard/pages-configuration.md +94 -0
  30. package/skills/wix-app/references/auto-patterns-dashboard/resolved-action.md +43 -0
  31. package/skills/wix-app/references/auto-patterns-dashboard/sdk-utilities.md +66 -0
  32. package/skills/wix-app/references/auto-patterns-dashboard/views.md +76 -0
  33. package/skills/wix-app/references/backend-event/COMMON-EVENTS.md +5 -0
  34. package/skills/wix-app/references/editor-react-component/ACCESSIBILITY.md +1 -14
  35. package/skills/wix-app/references/editor-react-component/ANIMATED-COMPONENTS.md +151 -0
  36. package/skills/wix-app/references/editor-react-component/COMPONENT-API.md +54 -29
  37. package/skills/wix-app/references/editor-react-component/COMPONENT-CONFIGURATION.md +2 -2
  38. package/skills/wix-app/references/editor-react-component/COMPONENT-PREVIEW.md +57 -0
  39. package/skills/wix-app/references/editor-react-component/CSS-GUIDELINES.md +23 -105
  40. package/skills/wix-app/references/editor-react-component/DESIGN-STATES.md +127 -0
  41. package/skills/wix-app/references/editor-react-component/PARTS.md +2 -1
  42. package/skills/wix-app/references/editor-react-component/REACT-GUIDELINES.md +18 -16
  43. package/skills/wix-app/references/editor-react-component/REACT-PATTERNS.md +25 -53
  44. package/skills/wix-app/references/stores/CATEGORIES.md +22 -0
  45. package/skills/wix-app/references/stores/GET_PRODUCT.md +99 -0
  46. package/skills/wix-app/references/stores/INVENTORY.md +37 -0
  47. package/skills/wix-app/references/stores/QUERY.md +87 -0
  48. package/skills/wix-app/references/stores/WRITE.md +55 -0
  49. package/skills/wix-app/scripts/generate-auto-patterns.js +510 -0
  50. package/skills/wix-auth/SKILL.md +12 -0
  51. package/skills/wix-auth/references/device-flow.md +140 -0
  52. package/skills/wix-docs/SKILL.md +188 -0
  53. package/skills/wix-docs/references/API_SPEC_SEARCH.md +213 -0
  54. package/skills/wix-docs/references/EXTRACTING.md +120 -0
  55. package/skills/wix-headless/SKILL.md +89 -130
  56. package/skills/wix-headless/entry/bootstrap.mjs +93 -0
  57. package/skills/wix-headless/entry/skill.md +76 -0
  58. package/skills/wix-headless/references/AI_FEATURES.md +178 -0
  59. package/skills/wix-headless/references/CAPABILITIES.md +86 -0
  60. package/skills/wix-headless/references/DISCOVERY.md +34 -56
  61. package/skills/wix-headless/references/DOC_DISCOVERY.md +37 -0
  62. package/skills/wix-headless/references/FEEDBACK.md +129 -0
  63. package/skills/wix-headless/references/IMAGE_GENERATION.md +69 -0
  64. package/skills/wix-headless/references/SDK_HANDOFF.md +99 -0
  65. package/skills/wix-headless/references/SEED.md +45 -187
  66. package/skills/wix-headless/references/SETUP.md +32 -103
  67. package/skills/wix-headless/references/astro.md +98 -0
  68. package/skills/wix-headless/references/inline-recipes/how-to-code-a-blog.md +196 -0
  69. package/skills/wix-headless/references/inline-recipes/how-to-code-a-store.md +236 -0
  70. package/skills/wix-headless/references/inline-recipes/how-to-code-bookings.md +279 -0
  71. package/skills/wix-headless/references/inline-recipes/how-to-code-cms.md +163 -0
  72. package/skills/wix-headless/references/inline-recipes/how-to-code-events.md +203 -0
  73. package/skills/wix-headless/references/inline-recipes/how-to-code-forms.md +222 -0
  74. package/skills/wix-headless/references/inline-recipes/how-to-code-members-astro.md +124 -0
  75. package/skills/wix-headless/references/inline-recipes/how-to-code-members-custom-login.md +160 -0
  76. package/skills/wix-headless/references/inline-recipes/how-to-code-members-non-astro.md +118 -0
  77. package/skills/wix-headless/references/inline-recipes/how-to-code-portfolio.md +132 -0
  78. package/skills/wix-headless/references/inline-recipes/how-to-code-pricing-plans.md +124 -0
  79. package/skills/wix-headless/references/inline-recipes/how-to-code-restaurant-orders.md +188 -0
  80. package/skills/wix-headless/references/inline-recipes/how-to-code-restaurant-reservations.md +213 -0
  81. package/skills/wix-headless/references/inline-recipes/how-to-code-restaurants.md +161 -0
  82. package/skills/wix-headless/references/inline-recipes/setup-blog.md +175 -0
  83. package/skills/wix-headless/references/inline-recipes/setup-bookings.md +232 -0
  84. package/skills/wix-headless/references/inline-recipes/setup-cms.md +200 -0
  85. package/skills/wix-headless/references/inline-recipes/setup-events.md +196 -0
  86. package/skills/wix-headless/references/inline-recipes/setup-forms.md +174 -0
  87. package/skills/wix-headless/references/inline-recipes/setup-online-store.md +192 -0
  88. package/skills/wix-headless/references/inline-recipes/setup-portfolio.md +155 -0
  89. package/skills/wix-headless/references/inline-recipes/setup-pricing-plans.md +229 -0
  90. package/skills/wix-headless/references/inline-recipes/setup-restaurant-experiences.md +73 -0
  91. package/skills/wix-headless/references/inline-recipes/setup-restaurant-orders.md +197 -0
  92. package/skills/wix-headless/references/inline-recipes/setup-restaurant-reservations.md +136 -0
  93. package/skills/wix-headless/references/inline-recipes/setup-restaurants.md +152 -0
  94. package/skills/wix-headless/references/managed/AUTHENTICATION.md +57 -0
  95. package/skills/wix-headless/references/managed/CONNECT.md +74 -0
  96. package/skills/wix-headless/references/managed/CREATE.md +130 -0
  97. package/skills/wix-headless/references/managed/DEPLOYMENT.md +79 -0
  98. package/skills/wix-headless/references/non-astro.md +59 -0
  99. package/skills/wix-headless/references/self-managed/AUTHENTICATION.md +22 -0
  100. package/skills/wix-headless/references/self-managed/DEPLOYMENT.md +15 -0
  101. package/skills/wix-headless/references/stripe/AUTHENTICATION.md +55 -0
  102. package/skills/wix-headless/references/stripe/DEPLOYMENT.md +71 -0
  103. package/skills/wix-manage/SKILL.md +29 -3
  104. package/skills/wix-manage/references/analytics/query-site-analytics.md +298 -0
  105. package/skills/wix-manage/references/app-installation/install-wix-apps.md +3 -0
  106. package/skills/wix-manage/references/bookings/create-and-update-booking-services.md +1 -1
  107. package/skills/wix-manage/references/bookings/create-booking-service-from-prompt.md +6 -5
  108. package/skills/wix-manage/references/bookings/create-course-service.md +30 -5
  109. package/skills/wix-manage/references/bookings/diagnose-availability-issues.md +299 -0
  110. package/skills/wix-manage/references/cms/cms-schema-management.md +6 -0
  111. package/skills/wix-manage/references/get-paid/how-to-setup-wix-payments.md +30 -7
  112. package/skills/wix-manage/references/marketing/create-and-publish-social-post.md +517 -0
  113. package/skills/wix-manage/references/marketing/generate-and-publish-marketing-plan.md +218 -0
  114. package/skills/wix-manage/references/rich-content/author-ricos-rich-content.md +249 -0
  115. package/skills/wix-manage/references/sites/site-import.md +270 -0
  116. package/skills/wix-manage/references/stores/create-product-from-image.md +8 -6
  117. package/skills/wix-manage/references/stores/create-product-with-options-catalog-v3.md +57 -0
  118. package/skills/wix-vibe-headless/SKILL.md +142 -0
  119. package/skills/wix-vibe-headless/platforms/README.md +22 -0
  120. package/skills/wix-vibe-headless/platforms/base44.md +142 -0
  121. package/skills/wix-vibe-headless/platforms/generic.md +87 -0
  122. package/skills/wix-vibe-headless/references/blog/INSTRUCTIONS.md +128 -0
  123. package/skills/wix-vibe-headless/references/blog/wix-blog.js +217 -0
  124. package/skills/wix-vibe-headless/references/bookings/INSTRUCTIONS.md +157 -0
  125. package/skills/wix-vibe-headless/references/bookings/wix-bookings-checkout.js +147 -0
  126. package/skills/wix-vibe-headless/references/bookings/wix-bookings-services.js +217 -0
  127. package/skills/wix-vibe-headless/references/cms/INSTRUCTIONS.md +154 -0
  128. package/skills/wix-vibe-headless/references/cms/wix-cms.js +186 -0
  129. package/skills/wix-vibe-headless/references/events/INSTRUCTIONS.md +142 -0
  130. package/skills/wix-vibe-headless/references/events/wix-events-browse.js +136 -0
  131. package/skills/wix-vibe-headless/references/events/wix-events-registration.js +187 -0
  132. package/skills/wix-vibe-headless/references/members/INSTRUCTIONS.md +211 -0
  133. package/skills/wix-vibe-headless/references/members/wix-members-auth.js +387 -0
  134. package/skills/wix-vibe-headless/references/portfolio/INSTRUCTIONS.md +111 -0
  135. package/skills/wix-vibe-headless/references/portfolio/wix-portfolio.js +223 -0
  136. package/skills/wix-vibe-headless/references/pricing-plans/INSTRUCTIONS.md +127 -0
  137. package/skills/wix-vibe-headless/references/pricing-plans/wix-pricing-plans.js +157 -0
  138. package/skills/wix-vibe-headless/references/restaurants/INSTRUCTIONS.md +138 -0
  139. package/skills/wix-vibe-headless/references/restaurants/wix-restaurants-menu.js +224 -0
  140. package/skills/wix-vibe-headless/references/restaurants/wix-restaurants-ordering.js +156 -0
  141. package/skills/wix-vibe-headless/references/restaurants/wix-restaurants-reservations.js +107 -0
  142. package/skills/wix-vibe-headless/references/shared/wix-client.js +186 -0
  143. package/skills/wix-vibe-headless/references/storefront/INSTRUCTIONS.md +164 -0
  144. package/skills/wix-vibe-headless/references/storefront/wix-store-cart.js +147 -0
  145. package/skills/wix-vibe-headless/references/storefront/wix-store-catalog.js +146 -0
  146. package/skills/wix-headless/references/BUILD-astro.md +0 -253
  147. package/skills/wix-headless/references/BUILD-own-build.md +0 -167
  148. package/skills/wix-headless/references/BUILD.md +0 -105
  149. package/skills/wix-headless/references/DESIGN_SYSTEM.md +0 -165
  150. package/skills/wix-headless/references/DISCOVERY-connect.md +0 -55
  151. package/skills/wix-headless/references/DISCOVERY-create.md +0 -238
  152. package/skills/wix-headless/references/PLAN-connect.md +0 -19
  153. package/skills/wix-headless/references/PLAN-create.md +0 -17
  154. package/skills/wix-headless/references/PLAN.md +0 -92
  155. package/skills/wix-headless/references/astro/blog/BLOG_PAGES.md +0 -300
  156. package/skills/wix-headless/references/astro/blog/BLOG_SETUP.md +0 -218
  157. package/skills/wix-headless/references/astro/bookings/COMPONENTS.md +0 -45
  158. package/skills/wix-headless/references/astro/bookings/SERVICES_PAGES.md +0 -77
  159. package/skills/wix-headless/references/astro/cms/CMS_FOUNDATIONS.md +0 -214
  160. package/skills/wix-headless/references/astro/cms/FAQ_KNOWLEDGE_BASE.md +0 -231
  161. package/skills/wix-headless/references/astro/cms/PORTFOLIO.md +0 -453
  162. package/skills/wix-headless/references/astro/cms/RESOURCE_LIBRARY.md +0 -354
  163. package/skills/wix-headless/references/astro/cms/TEAM_DIRECTORY.md +0 -299
  164. package/skills/wix-headless/references/astro/designer/INSTRUCTIONS.md +0 -351
  165. package/skills/wix-headless/references/astro/ecom/CART_PAGES.md +0 -119
  166. package/skills/wix-headless/references/astro/ecom/CART_WIRING.md +0 -103
  167. package/skills/wix-headless/references/astro/ecom/COMPONENTS_CSS.md +0 -132
  168. package/skills/wix-headless/references/astro/forms/CONTACT_FORM.md +0 -463
  169. package/skills/wix-headless/references/astro/gift-cards/COMPONENTS.md +0 -119
  170. package/skills/wix-headless/references/astro/gift-cards/PAGES.md +0 -129
  171. package/skills/wix-headless/references/astro/stores/BACK_IN_STOCK.md +0 -178
  172. package/skills/wix-headless/references/astro/stores/CATEGORY_PAGES.md +0 -85
  173. package/skills/wix-headless/references/astro/stores/COMPONENTS_CSS.md +0 -129
  174. package/skills/wix-headless/references/astro/stores/HOME_AND_NAV.md +0 -229
  175. package/skills/wix-headless/references/astro/stores/PRODUCT_PAGES.md +0 -215
  176. package/skills/wix-headless/references/astro/stores/SHARED_WIRING.md +0 -165
  177. package/skills/wix-headless/references/astro/templates/Layout.astro +0 -132
  178. package/skills/wix-headless/references/astro/templates/astro.config.mjs +0 -41
  179. package/skills/wix-headless/references/astro/templates/bookings/AvailabilityCalendar.tsx +0 -374
  180. package/skills/wix-headless/references/astro/templates/bookings/BookingForm.tsx +0 -136
  181. package/skills/wix-headless/references/astro/templates/bookings/SeoTags.astro +0 -25
  182. package/skills/wix-headless/references/astro/templates/bookings/ServiceBookingFlow.tsx +0 -71
  183. package/skills/wix-headless/references/astro/templates/bookings/ServiceCard.astro +0 -54
  184. package/skills/wix-headless/references/astro/templates/bookings/booking-confirmation.astro +0 -49
  185. package/skills/wix-headless/references/astro/templates/bookings/bookingDriver.ts +0 -245
  186. package/skills/wix-headless/references/astro/templates/bookings/components-bookings.css +0 -424
  187. package/skills/wix-headless/references/astro/templates/bookings/services/[slug].astro +0 -176
  188. package/skills/wix-headless/references/astro/templates/bookings/services/index.astro +0 -181
  189. package/skills/wix-headless/references/astro/templates/ecom/CartBadge.tsx +0 -84
  190. package/skills/wix-headless/references/astro/templates/ecom/CartView.tsx +0 -543
  191. package/skills/wix-headless/references/astro/templates/ecom/cart.astro +0 -13
  192. package/skills/wix-headless/references/astro/templates/ecom/components-ecom.css +0 -302
  193. package/skills/wix-headless/references/astro/templates/ecom/discounts.ts +0 -71
  194. package/skills/wix-headless/references/astro/templates/ecom/thank-you.astro +0 -24
  195. package/skills/wix-headless/references/astro/templates/gift-cards/GiftCardPurchase.tsx +0 -172
  196. package/skills/wix-headless/references/astro/templates/gift-cards/_home-teaser-snippet.astro +0 -42
  197. package/skills/wix-headless/references/astro/templates/gift-cards/_nav-snippet.astro +0 -11
  198. package/skills/wix-headless/references/astro/templates/gift-cards/components-gift-cards.css +0 -220
  199. package/skills/wix-headless/references/astro/templates/gift-cards/gift-cards.astro +0 -51
  200. package/skills/wix-headless/references/astro/templates/gift-cards/gift-cards.ts +0 -75
  201. package/skills/wix-headless/references/astro/templates/global.css +0 -288
  202. package/skills/wix-headless/references/astro/templates/stores/AddToCartButton.tsx +0 -77
  203. package/skills/wix-headless/references/astro/templates/stores/BackInStockForm.tsx +0 -176
  204. package/skills/wix-headless/references/astro/templates/stores/CategoryRail.astro +0 -69
  205. package/skills/wix-headless/references/astro/templates/stores/ProductCard.astro +0 -79
  206. package/skills/wix-headless/references/astro/templates/stores/ProductPurchase.tsx +0 -397
  207. package/skills/wix-headless/references/astro/templates/stores/SeoTags.astro +0 -21
  208. package/skills/wix-headless/references/astro/templates/stores/back-in-stock.ts +0 -67
  209. package/skills/wix-headless/references/astro/templates/stores/categories.ts +0 -155
  210. package/skills/wix-headless/references/astro/templates/stores/category/[slug].astro +0 -130
  211. package/skills/wix-headless/references/astro/templates/stores/components-stores.css +0 -400
  212. package/skills/wix-headless/references/astro/templates/stores/products/[slug].astro +0 -128
  213. package/skills/wix-headless/references/astro/templates/stores/products/index.astro +0 -101
  214. package/skills/wix-headless/references/blog/BLOG_CONTENT.md +0 -161
  215. package/skills/wix-headless/references/blog/INSTRUCTIONS.md +0 -32
  216. package/skills/wix-headless/references/bookings/FLOW.md +0 -246
  217. package/skills/wix-headless/references/bookings/INSTRUCTIONS.md +0 -95
  218. package/skills/wix-headless/references/bookings/SERVICES_DATA.md +0 -355
  219. package/skills/wix-headless/references/cms/CMS_FOUNDATIONS.md +0 -176
  220. package/skills/wix-headless/references/cms/INSTRUCTIONS.md +0 -71
  221. package/skills/wix-headless/references/commands/known-apps.json +0 -6
  222. package/skills/wix-headless/references/custom/CONNECTION_PLAN.md +0 -142
  223. package/skills/wix-headless/references/custom/INSTRUCTIONS.md +0 -88
  224. package/skills/wix-headless/references/custom/blog/WIRING.md +0 -52
  225. package/skills/wix-headless/references/custom/bookings/WIRING.md +0 -197
  226. package/skills/wix-headless/references/custom/cms/WIRING.md +0 -97
  227. package/skills/wix-headless/references/custom/ecom/WIRING.md +0 -67
  228. package/skills/wix-headless/references/custom/forms/WIRING.md +0 -101
  229. package/skills/wix-headless/references/custom/stores/WIRING.md +0 -80
  230. package/skills/wix-headless/references/ecom/INSTRUCTIONS.md +0 -59
  231. package/skills/wix-headless/references/forms/INSTRUCTIONS.md +0 -43
  232. package/skills/wix-headless/references/gift-cards/INSTRUCTIONS.md +0 -51
  233. package/skills/wix-headless/references/images/INSTRUCTIONS.md +0 -357
  234. package/skills/wix-headless/references/seed-recipes.md +0 -49
  235. package/skills/wix-headless/references/shared/AGENTS_MD.md +0 -47
  236. package/skills/wix-headless/references/shared/AUTHENTICATION.md +0 -108
  237. package/skills/wix-headless/references/shared/BUILD_NOISE.md +0 -8
  238. package/skills/wix-headless/references/shared/DESIGN_MD.md +0 -84
  239. package/skills/wix-headless/references/shared/DOCS_SEARCH.md +0 -41
  240. package/skills/wix-headless/references/shared/IMAGE_GENERATION.md +0 -186
  241. package/skills/wix-headless/references/shared/IMPLEMENTER.md +0 -206
  242. package/skills/wix-headless/references/shared/PRODUCTION_SHARP_EDGES.md +0 -97
  243. package/skills/wix-headless/references/shared/RETURN_CONTRACT.md +0 -143
  244. package/skills/wix-headless/references/shared/STYLING.md +0 -140
  245. package/skills/wix-headless/references/stores/INSTRUCTIONS.md +0 -126
  246. package/skills/wix-headless/references/stores/PRODUCT_CATALOG_DATA.md +0 -252
  247. package/skills/wix-headless/references/verticals/_schema.json +0 -74
  248. package/skills/wix-headless/references/verticals/_schema.md +0 -95
  249. package/skills/wix-headless/references/verticals/blog.md +0 -31
  250. package/skills/wix-headless/references/verticals/bookings.md +0 -41
  251. package/skills/wix-headless/references/verticals/cms.md +0 -30
  252. package/skills/wix-headless/references/verticals/ecom.md +0 -25
  253. package/skills/wix-headless/references/verticals/forms.md +0 -26
  254. package/skills/wix-headless/references/verticals/gift-cards.md +0 -24
  255. package/skills/wix-headless/references/verticals/stores.md +0 -33
  256. package/skills/wix-headless/scripts/check-manifest.mjs +0 -335
  257. package/skills/wix-headless/scripts/compose.mjs +0 -520
  258. package/skills/wix-headless/scripts/emit-design-tokens.mjs +0 -157
  259. package/skills/wix-headless/scripts/flatten.sh +0 -61
  260. package/skills/wix-headless/scripts/generate-images.mjs +0 -242
  261. package/skills/wix-headless/scripts/patch-decorative-slots.mjs +0 -154
  262. package/skills/wix-headless/scripts/plan-entity-image-waves.mjs +0 -190
  263. package/skills/wix-headless/scripts/scaffold.sh +0 -139
  264. package/skills/wix-headless/scripts/seed-utilities.sh +0 -93
  265. package/skills/wix-headless/scripts/write-decorative-json.mjs +0 -62
  266. package/skills/wix-headless/shared-utilities/analytics.ts +0 -40
  267. package/skills/wix-headless/shared-utilities/ricos.ts +0 -179
  268. package/skills/wix-headless/shared-utilities/wix-image.ts +0 -72
@@ -0,0 +1,142 @@
1
+ # Wix Managed Headless — Base44 build instructions
2
+
3
+ You are building a **Wix Managed** headless site inside Base44. The business to build is
4
+ described in your initial prompt. The Wix connector is already configured for this app — use
5
+ it for all Wix API calls.
6
+
7
+ Your Wix client id is given in your prompt. It's a public, buyer/visitor-facing credential (it
8
+ only mints anonymous visitor tokens), so it's safe in the frontend — use that value directly for
9
+ the Wix client setup.
10
+
11
+ Follow the steps below exactly.
12
+
13
+ ## STEP 0 — Install the Wix skills locally
14
+
15
+ Install three skills — they land under `.agents/skills/` as:
16
+ - **`wix-vibe-headless`** — the client build guide: how to build the frontend against the Wix
17
+ APIs. This is your main source of truth (STEP 1).
18
+ - **`wix-headless`** — a broad skill for building full Wix apps with the Wix SDK packages, **most
19
+ of which does not apply to how you build here**. Use it **only** as a seeding/admin recipe
20
+ reference — its `references/SEED.md` and `references/inline-recipes/`, for STEP 2. **Ignore
21
+ everything else in it** — in particular do **not** follow its authentication / `@wix/cli` /
22
+ "managed project" setup (e.g. anything under `references/managed/`, such as `AUTHENTICATION.md`).
23
+ That is **not** how auth works here — auth is handled per STEP 2 below.
24
+ - **`wix-docs`** — a **fallback**: how to search and read the Wix API reference docs, for anything
25
+ the seeding recipes above don't cover.
26
+
27
+ **Option A — skills CLI.** This is the Base44-verified install path — run it first via
28
+ exec_tool, exactly as written:
29
+
30
+ ```js
31
+ const { execSync } = require('child_process');
32
+ const { readdirSync } = require('fs');
33
+
34
+ const skills = ['wix-headless', 'wix-vibe-headless', 'wix-docs'];
35
+ const results = {};
36
+
37
+ for (const skill of skills) {
38
+ try {
39
+ const out = execSync(`CI=1 npx -y skills add wix/skills/skills/${skill} --yes 2>&1`, {
40
+ cwd: '/app', timeout: 60000, shell: '/bin/bash', stdio: ['pipe', 'pipe', 'pipe'],
41
+ });
42
+ const text = out.toString().replace(/\x1b\[[0-9;]*m/g, '');
43
+ results[skill] = /installed 1 skill|found 1 skill/i.test(text)
44
+ ? 'success'
45
+ : text.includes('No valid skills') ? 'not_found' : 'unknown';
46
+ } catch (e) {
47
+ results[skill] = 'error: ' + e.message;
48
+ }
49
+ }
50
+
51
+ return { results, installed: readdirSync('/app/.agents/skills') };
52
+ ```
53
+
54
+ **Option B — tarball.** Use this **only if Option A actually errored** (check its `results`) —
55
+ do not skip Option A on a guess. Run via exec_tool:
56
+
57
+ ```js
58
+ const { execSync } = require('child_process');
59
+ for (const s of ['headless', 'vibe-headless', 'docs']) {
60
+ execSync(`mkdir -p /app/.agents/skills/wix-${s} && curl -s "https://www.wix.com/skills/${s}.tgz" | tar xz -C /app/.agents/skills/wix-${s} --strip-components=1`);
61
+ }
62
+ return 'done';
63
+ ```
64
+
65
+ Either way you end up with `.agents/skills/{wix-headless,wix-vibe-headless,wix-docs}`. **Read them
66
+ with the `read_file` tool** — it caps by line (~5000, well above these docs, so each comes through
67
+ whole; page with offset/limit only if ever needed), whereas `cat` through exec_tool caps output at
68
+ ~5000 chars and silently truncates, and web-fetch tools truncate/summarise. The path form depends
69
+ on the tool:
70
+ - **`read_file` (preferred):** rooted at `/app`, so use the workspace-relative path
71
+ `.agents/skills/wix-vibe-headless/SKILL.md` — an absolute `/app/...` double-prefixes and fails.
72
+ - **exec_tool / shell** (only if you must): use the absolute path
73
+ `/app/.agents/skills/wix-vibe-headless/SKILL.md`.
74
+
75
+ ## STEP 1 — Build the client
76
+
77
+ Read `.agents/skills/wix-vibe-headless/SKILL.md` and follow it **EXACTLY** — it is the single
78
+ source of truth for how the client app is built. To save time, prefer copying ready-made files
79
+ the `wix-vibe-headless` skill provides (e.g. the Wix client setup) and adapting them over
80
+ re-generating them from scratch.
81
+
82
+ ## STEP 2 — Manage and seed the business
83
+
84
+ Seed the site with real content by following the **`wix-headless` skill**'s
85
+ `references/SEED.md` (`.agents/skills/wix-headless/references/SEED.md`). Where its seed recipes
86
+ don't cover what you need, **fall back to the `wix-docs` skill** (`.agents/skills/wix-docs`) to
87
+ search and read the relevant Wix API docs.
88
+
89
+ **Seeding is additive.** You may clean up the app install's **obvious default sample/mock data**
90
+ right after a fresh install, but the site may already hold **real content** (a prior run, or
91
+ owner-added) — if what's there isn't obviously install sample data, or you're unsure, **do not
92
+ delete or overwrite it without the user's explicit ask or approval** (ask first).
93
+
94
+ **Auth for these admin calls is the already-configured Wix connector — and nothing else.** Get the
95
+ access token from it and send it as a bearer token — do **not** hand-roll a token getter (e.g. a
96
+ custom `getAdminToken()`):
97
+
98
+ ```js
99
+ const { accessToken } = await base44.asServiceRole.connectors.getConnection("wix");
100
+ // then: fetch(url, { headers: { Authorization: `Bearer ${accessToken}`, "Content-Type": "application/json" }, ... })
101
+ ```
102
+
103
+ Do **not** install or run the Wix CLI (`@wix/cli`), do a device-login, or follow `wix-headless`'s
104
+ `references/managed/AUTHENTICATION.md` — that managed-project auth flow does not apply to Base44
105
+ and will send you down the wrong path.
106
+
107
+ When you run seed/management code **inline via exec_tool**, `base44` is already declared — use
108
+ it directly. Do **not** import `@base44/sdk`, re-declare `base44`, or call `createClient()` —
109
+ that pattern is only for standalone `.js` skill files, and inline it throws *"Identifier
110
+ 'base44' has already been declared."*
111
+
112
+ **IMPORTANT:** the Wix connector and the `wix-headless` skill's seeding instructions are for
113
+ management/admin operations only (STEP 2) — they are **NOT** part of the client. The client is
114
+ built solely per the `wix-vibe-headless` skill.
115
+
116
+ ## Parallelism
117
+
118
+ If possible, run STEP 1 and STEP 2 in parallel — building the client and seeding the business
119
+ are independent, so don't wait for one to start the other. Within each step, also work in
120
+ parallel where possible (e.g. independent API calls, seeding multiple entities) instead of
121
+ one-by-one, to finish faster.
122
+
123
+ ## STEP 3 — Wrap up
124
+
125
+ Once the site is built and seeded:
126
+
127
+ 1. **Leave a brief "Wix skills" note in `AGENTS.md`** (project root) so a future session has
128
+ context. If the file already exists, **`read_file` it first and only append your section** —
129
+ do **not** rewrite, reorder, or remove anything already there; if you can't append cleanly,
130
+ skip this rather than overwrite. Create the file only if none exists. Keep the note
131
+ high-level, e.g.: the Wix skills are installed under `.agents/skills/`; the client is built
132
+ per the `wix-vibe-headless` skill; seeding/management is done per the `wix-headless` +
133
+ `wix-docs` skills.
134
+ 2. **Ask the user to open** this URL to complete the setup in Wix (substitute the metasite id
135
+ you were given): `https://manage.wix.com/dashboard/{metaSiteId}`
136
+
137
+ ## Later admin requests
138
+
139
+ For any later admin/management request the user makes, work the same way as STEP 2: check the
140
+ `wix-headless` skill's inline recipes first (`.agents/skills/wix-headless/references/inline-recipes/`)
141
+ and, where the operation isn't documented there, fall back to the `wix-docs` skill to search the
142
+ Wix API docs — all over the Wix connector.
@@ -0,0 +1,87 @@
1
+ # Wix Managed Headless — build instructions
2
+
3
+ You are building a **Wix Managed** headless site. The business to build, and your Wix client id
4
+ and metasite id, are given in your initial prompt. Follow the steps below.
5
+
6
+ ## STEP 0 — Install the Wix skills locally
7
+
8
+ Install three skills — they land under `.agents/skills/` as:
9
+ - **`wix-vibe-headless`** — the client build guide: how to build the frontend against the Wix
10
+ APIs. This is your main source of truth (STEP 1).
11
+ - **`wix-headless`** — a broad skill for building full Wix apps with the Wix SDK packages, **most
12
+ of which does not apply to how you build here**. Use it **only** as a seeding/admin recipe
13
+ reference — its `references/SEED.md` and `references/inline-recipes/`, for STEP 2. **Ignore
14
+ everything else in it** — in particular do **not** follow its authentication / `@wix/cli` /
15
+ "managed project" setup (e.g. anything under `references/managed/`, such as `AUTHENTICATION.md`).
16
+ That is **not** how auth works here — auth is handled per STEP 2 below.
17
+ - **`wix-docs`** — a **fallback**: how to search and read the Wix API reference docs, for anything
18
+ the seeding recipes above don't cover.
19
+
20
+ Install them so you can read them from files as you go (fetching skill docs over the web
21
+ truncates or summarises large files).
22
+
23
+ **Run the Skills CLI** — this is the install path to use:
24
+ ```bash
25
+ CI=1 npx skills@latest add wix/skills/skills/wix-headless --yes
26
+ CI=1 npx skills@latest add wix/skills/skills/wix-vibe-headless --yes
27
+ CI=1 npx skills@latest add wix/skills/skills/wix-docs --yes
28
+ ```
29
+
30
+ **Only if the CLI above actually errors** (not on a guess), fall back to curl + gzip — download
31
+ each bundle and extract it into `.agents/skills/wix-<name>/`:
32
+ ```bash
33
+ for s in headless vibe-headless docs; do
34
+ mkdir -p ".agents/skills/wix-$s"
35
+ curl -s "https://www.wix.com/skills/$s.tgz" | tar xz -C ".agents/skills/wix-$s" --strip-components=1
36
+ done
37
+ ```
38
+
39
+ ## STEP 1 — Build the client
40
+
41
+ Read `.agents/skills/wix-vibe-headless/SKILL.md` and follow it **exactly** — it is the single
42
+ source of truth for how the client app is built against the Wix APIs (over the public
43
+ `WIX_CLIENT_ID`, which is a buyer/visitor-facing credential, safe in the frontend). To save time,
44
+ prefer copying the ready-made files the `wix-vibe-headless` skill provides (e.g. the Wix client
45
+ setup) and adapting them over re-generating them from scratch.
46
+
47
+ ## STEP 2 — Seed and manage the business
48
+
49
+ Seed the site with real content by following the `wix-headless` skill's `references/SEED.md`
50
+ (`.agents/skills/wix-headless/references/SEED.md`). Where its seed recipes don't cover what you
51
+ need, fall back to the `wix-docs` skill to search and read the relevant Wix API docs.
52
+
53
+ **Seeding is additive.** You may clean up the app install's **obvious default sample/mock data**
54
+ right after a fresh install, but the site may already hold **real content** (a prior run, or
55
+ owner-added) — if what's there isn't obviously install sample data, or you're unsure, **do not
56
+ delete or overwrite it without the user's explicit ask or approval** (ask first).
57
+
58
+ These management/admin calls need **elevated Wix credentials** — the public client id is not
59
+ enough. If you don't already have a way to authenticate them, either **connect your platform's
60
+ Wix connector** (if it has one) or **ask the user for a Wix API key / token** and store it in your
61
+ platform's built-in **connector / secrets (env) manager** — never hardcode or commit it. **Once
62
+ the connector is connected (or the API key is in place), you can make Wix REST admin calls
63
+ directly** — authenticate each call with that credential (the `wix-docs` skill covers Wix API-key
64
+ auth). Or, if the user prefers, tell them they can add this content themselves in the Wix
65
+ dashboard instead.
66
+
67
+ Authenticate admin calls with **only** that connector/API key. Do **not** install or run the Wix
68
+ CLI (`@wix/cli`), do a device-login, or follow `wix-headless`'s `references/managed/AUTHENTICATION.md`
69
+ — that managed-project auth flow does not apply here.
70
+
71
+ Management/admin operations (seeding, `wix-headless`, `wix-docs`) are **separate from the
72
+ client** — the client is built solely per the `wix-vibe-headless` skill.
73
+
74
+ If possible, run STEP 1 and STEP 2 in parallel — building the client and seeding the business
75
+ are independent. Within each, also parallelize independent work (API calls, seeding multiple
76
+ entities) to finish faster.
77
+
78
+ ## Later admin requests
79
+
80
+ For any later admin/management request, work the same way as STEP 2: check the `wix-headless`
81
+ skill's inline recipes first (`.agents/skills/wix-headless/references/inline-recipes/`) and fall
82
+ back to the `wix-docs` skill where the operation isn't documented there.
83
+
84
+ ## When done
85
+
86
+ After the site is built and seeded, ask the user to open this URL to complete the setup in Wix
87
+ (substitute the metasite id you were given): `https://manage.wix.com/dashboard/{metaSiteId}`
@@ -0,0 +1,128 @@
1
+
2
+ # Wix Blog Skill
3
+
4
+ > **Source files (in this skill):** the shared transport `references/shared/wix-client.js` and this vertical's `references/blog/wix-blog.js`. Copy **both** into your app's `src/rest/` side by side — the helper does `import { wixApiRequest } from "./wix-client.js"`, so they must land in the same folder.
5
+
6
+ Builds a real, client-only Wix blog reader. The browser talks to Wix directly over a
7
+ public `WIX_CLIENT_ID`. Never mock posts; never hand-build post/category/tag URLs — always
8
+ fetch live data through the official Blog REST endpoints and route by `slug`.
9
+
10
+ ## When to use
11
+ - User wants a Wix blog/news/articles section or asks to "connect my Wix blog".
12
+ - Replacing placeholder/mock articles with live Wix Blog posts.
13
+ - Adding a post feed, post detail pages, category pages, or tag pages over an existing
14
+ Wix Blog with published posts.
15
+
16
+ This skill is **read-only and visitor-facing**. It does not create, edit, publish, or
17
+ moderate posts — the author manages all content in the Wix dashboard.
18
+
19
+ ## Prerequisites
20
+ 1. A Wix site with **Wix Blog installed and posts already published** (this skill does
21
+ NOT provision — it's read-only over published content). Draft/unpublished posts are
22
+ never returned.
23
+ 2. The site's public headless **`WIX_CLIENT_ID`**, provided in the handoff prompt (the
24
+ Wix Business Manager surfaces a copyable prompt with the id filled in — see
25
+ the router `SKILL.md`). Paste it into `src/rest/wix-client.js` in place of the placeholder. It is
26
+ a visitor-facing credential (it only mints anonymous visitor tokens), **not** a secret,
27
+ so hardcoding/committing it is fine.
28
+
29
+ ## The API (copy as-is; do not re-derive it)
30
+ This skill ships only the REST layer — no UI components. Build the blog's UI however the
31
+ project wants; wire it to these two snippets. Copy them into the app (e.g. `src/api/`) and
32
+ only adjust import paths:
33
+ - `src/rest/wix-client.js` — visitor-token mint/refresh + transport. Set `WIX_CLIENT_ID` to
34
+ the id from the prompt (replace the `<YOUR-CLIENT-ID>` placeholder). The refresh token is
35
+ persisted to localStorage so the same anonymous visitor is reused across reloads; do not
36
+ re-mint anonymously per load.
37
+ - `src/rest/wix-blog.js` — exports:
38
+ - **Posts:** `queryPosts`, `getPostBySlug`, `queryPostsByCategory`, `queryPostsByTag`, `getTotalPosts`
39
+ - **Categories:** `queryCategories`, `getCategoryBySlug`
40
+ - **Tags:** `queryTags`, `getTagBySlug`
41
+
42
+ The Post, Category, and Tag shapes are documented as JSDoc comments at the top of
43
+ `wix-blog.js`. Read them before building the UI — they describe the key fields and link to
44
+ the full API reference for anything not shown.
45
+
46
+ ## How to wire it (UI is the project's choice)
47
+ - **Post feed** — `queryPosts()` for the listing (published posts only, newest first with
48
+ pinned posts leading); pass `nextCursor` back as `cursor` to load the next page. Render
49
+ `title`, `excerpt`, `firstPublishedDate`, `minutesToRead`, and the cover image from
50
+ **`post.media.wixMedia.image.url`** (see the cover-image note below). Route to the detail page by `slug`.
51
+ - **Post detail** — `getPostBySlug(slug)` keyed off the URL slug; returns `null` on miss —
52
+ show a not-found state, never invent a post. It returns full content:
53
+ - `contentText` — the body as plain text. Split on `"\n"` to render simple paragraphs.
54
+ - `richContent` — the body as a Ricos rich-content document (images, embeds, formatting).
55
+ Render it with a Ricos renderer for a faithful post. See "Beyond the snippets" if you
56
+ need rich rendering; `contentText` is the zero-dependency default.
57
+ - Resolve `categoryIds` / `tagIds` to labels with `queryCategories()` / `queryTags()`
58
+ (build an id→label map) to show category/tag chips.
59
+ - **Cover image** — use **`post.media.wixMedia.image.url`** (a ready-to-use https URL) for the card
60
+ thumbnail and post header. `media` is returned by default (including on the list query), so no extra
61
+ fieldset is needed. When `post.media?.wixMedia?.image` is absent, the cover is the first image inside
62
+ `richContent` — fall back to the first IMAGE node there, or show a text-only card. Never substitute a
63
+ stock/placeholder image.
64
+ - **Category page** — `queryCategories()` for a category menu (ordered by `displayPosition`;
65
+ hide categories with `postCount === 0` if you want); `getCategoryBySlug(slug)` for a
66
+ category landing page. Pass `category.id` to `queryPostsByCategory(categoryId, { limit?, cursor? })`
67
+ to list that category's posts; paginate exactly like `queryPosts`.
68
+ - **Tag page** — `queryTags()` for a tag cloud/list (most-used first); `getTagBySlug(slug)`
69
+ for a tag landing page. Pass `tag.id` to `queryPostsByTag(tagId, { limit?, cursor? })`.
70
+ - **Empty state** — if `getTotalPosts()` is 0, show an empty state telling the user to
71
+ publish posts in their Wix dashboard. Never invent posts.
72
+
73
+ ## Hard rules (do not violate)
74
+ - ✅ Fetch posts/categories/tags ONLY through the shipped helpers (the official Blog REST
75
+ endpoints). Route between screens by `slug`.
76
+ - ❌ Never hand-build post, category, or tag URLs to fetch content. Use `getPostBySlug`,
77
+ `getCategoryBySlug`, `getTagBySlug`. (For an outbound link to the live Wix page, use the
78
+ `url` field — `url.base + url.path` — returned on the object, not a string you assemble.)
79
+ - ❌ Never mock posts, authors, or content — render live Wix data or the empty state.
80
+ - ❌ Never generate fake comments, likes, view counts, or ratings. This skill is read-only
81
+ and does not expose engagement actions; leave such UI empty or omit it.
82
+ - ❌ Never use a placeholder/stock cover image. If `post.media?.wixMedia?.image` is missing, fall back
83
+ to the first richContent image or a text-only card.
84
+ - ✅ Set `WIX_CLIENT_ID` from the prompt's value (public client id — safe to hardcode).
85
+ - ✅ Use `post.media.wixMedia.image.url` for the cover image.
86
+ - The helpers fail soft on single-item lookups: `getPostBySlug` / `getCategoryBySlug` /
87
+ `getTagBySlug` return `null` on a miss so you can show a proper not-found state — don't
88
+ swallow that into a fake item.
89
+
90
+ ## Beyond the snippets
91
+ The snippets cover the common blog-reader paths. If you hit a use case they don't cover
92
+ (e.g. rendering `richContent` faithfully, full-text search/filtering, related posts,
93
+ post metrics, members-only/pricing-plan posts, multilingual posts), extend the client
94
+ yourself with `wixApiRequest` — but look up the exact endpoint, HTTP method, and request
95
+ body in the **official Wix API reference** first; never guess:
96
+ - Blog API reference: https://dev.wix.com/docs/api-reference/business-solutions/blog.md
97
+ - Query Posts (filters/sort: `categoryIds`, `tagIds`, `hashtags`, `title`, dates, `featured`):
98
+ https://dev.wix.com/docs/api-reference/business-solutions/blog/posts-stats/query-posts.md
99
+ - Rendering `richContent` (Ricos document format):
100
+ https://dev.wix.com/docs/ricos/api-reference/ricos-document
101
+ - **Members-only posts** → the **members** vertical (`references/members/INSTRUCTIONS.md`): once a
102
+ member is logged in (custom login on your own UI), the existing read helpers return the content
103
+ gated to members — no extra code. Note this blog helper is **read-only**: member *writes* (posting
104
+ a comment, liking a post) aren't included — add them as a beyond-the-snippets `wixApiRequest` call,
105
+ authenticated as the logged-in member.
106
+ - Each helper in `wix-blog.js` links its exact reference page inline.
107
+
108
+ Keep the snippets as the default for everything they already do; reach for the API
109
+ reference only for the gap.
110
+
111
+ ## Point the user to their dashboard
112
+ In some cases, users need to access the Wix dashboard in order to edit the blog content for their site. To facilitate this, provide the user with deep links directly to the relevant dashboard pages. For blog data those pages are:
113
+ - **Posts** — `https://manage.wix.com/dashboard/{metaSiteId}/blog/posts` (`Dashboard → Blog → Posts`; write, edit, and publish posts; only published posts appear in the app)
114
+ - **Categories** — `https://manage.wix.com/dashboard/{metaSiteId}/blog/categories` (`Dashboard → Blog → Categories`)
115
+
116
+ Substitute the site's `metaSiteId` to complete the links (you have it from the handoff / `ListWixSites`). Include the in-dashboard navigation as a fallback.
117
+
118
+ ## Verification checklist (before declaring done)
119
+ - [ ] `WIX_CLIENT_ID` set to the prompt's value (not the `<YOUR-CLIENT-ID>` placeholder)
120
+ - [ ] Visitor token persists across reload (no re-mint storm; same anonymous visitor)
121
+ - [ ] Post feed lists live published posts, newest first, and paginates via `nextCursor`
122
+ - [ ] Post detail loads by `slug` and renders real `contentText` (or rendered `richContent`)
123
+ - [ ] `getPostBySlug` on a bad slug shows a not-found state (no invented post)
124
+ - [ ] Cover images come from `post.media.wixMedia.image.url` (or richContent fallback) — no stock placeholders
125
+ - [ ] Category and tag pages list the right posts via `queryPostsByCategory` / `queryPostsByTag`
126
+ - [ ] Empty state shown when `getTotalPosts()` is 0
127
+ - [ ] No mock posts, authors, comments, likes, or view counts anywhere
128
+ - [ ] Told the user at least once that they can continue setting up their blog in the dashboard and provided deep links.
@@ -0,0 +1,217 @@
1
+ import { wixApiRequest } from "./wix-client.js";
2
+
3
+ /**
4
+ * Wix Blog Post — key fields.
5
+ * Full model: https://dev.wix.com/docs/api-reference/business-solutions/blog/posts-stats/post-object.md
6
+ *
7
+ * id {string}, title {string}, slug {string},
8
+ * excerpt {string} — short summary ≤500 chars (use for cards),
9
+ * firstPublishedDate {string} — ISO date, default sort key DESC,
10
+ * pinned {boolean}, featured {boolean}, minutesToRead {number},
11
+ * categoryIds {string[]}, tagIds {string[]}, hashtags {string[]},
12
+ * media {object} — cover image at media.wixMedia.image { id, url, height, width, filename, altText? };
13
+ * media.wixMedia.image.url is a ready-to-use https URL (returned by default, incl. the list query).
14
+ * media.displayed / media.custom are booleans,
15
+ * contentText {string} — plain text body (CONTENT_TEXT fieldset; getPostBySlug requests it),
16
+ * richContent {object} — Ricos document (RICH_CONTENT fieldset; getPostBySlug requests it),
17
+ * url {object} — { base, path } live post URL (URL fieldset; build full link as base+path)
18
+ * Available fieldsets: "URL" | "CONTENT_TEXT" | "RICH_CONTENT" | "METRICS" | "SEO"
19
+ *
20
+ * Category: { id, label, slug, description, postCount, displayPosition,
21
+ * coverImage: { id, url, height, width, altText }, url: { base, path } }
22
+ * Full model: https://dev.wix.com/docs/api-reference/business-solutions/blog/category/category-object.md
23
+ *
24
+ * Tag: { id, label, slug, publishedPostCount, url: { base, path } }
25
+ * Full model: https://dev.wix.com/docs/api-reference/business-solutions/blog/tags/tag-object.md
26
+ */
27
+
28
+ const POST_LIST_FIELDSETS = ["URL"];
29
+ const POST_FULL_FIELDSETS = ["URL", "CONTENT_TEXT", "RICH_CONTENT"];
30
+
31
+ /**
32
+ * Query published posts (one page), newest first (pinned posts lead).
33
+ * Pass `nextCursor` from a previous call back as `cursor` to load the next page.
34
+ * Reference: https://dev.wix.com/docs/api-reference/business-solutions/blog/posts-stats/query-posts.md
35
+ * @param {{ limit?: number, cursor?: string }} [options]
36
+ * @returns {Promise<{ posts: object[], nextCursor: string|null }>}
37
+ */
38
+ export async function queryPosts({ limit = 100, cursor } = {}) {
39
+ const res = await wixApiRequest("/v3/posts/query", {
40
+ method: "POST",
41
+ body: {
42
+ fieldsets: POST_LIST_FIELDSETS,
43
+ query: {
44
+ cursorPaging: cursor ? { limit, cursor } : { limit },
45
+ sort: [{ fieldName: "firstPublishedDate", order: "DESC" }],
46
+ },
47
+ },
48
+ });
49
+ return {
50
+ posts: res?.posts ?? [],
51
+ nextCursor: res?.pagingMetadata?.cursors?.next ?? null,
52
+ };
53
+ }
54
+
55
+ /**
56
+ * Fetch one post by its URL slug, with full content (contentText + richContent + url).
57
+ * Returns null if no post matches the slug — show a not-found state, never invent a post.
58
+ * Reference: https://dev.wix.com/docs/api-reference/business-solutions/blog/posts-stats/get-post-by-slug.md
59
+ * @param {string} slug
60
+ * @returns {Promise<object|null>}
61
+ */
62
+ export async function getPostBySlug(slug) {
63
+ try {
64
+ const res = await wixApiRequest(`/v3/posts/slugs/${encodeURIComponent(slug)}`, {
65
+ method: "GET",
66
+ query: { fieldsets: POST_FULL_FIELDSETS },
67
+ });
68
+ return res?.post ?? null;
69
+ } catch {
70
+ return null;
71
+ }
72
+ }
73
+
74
+ /**
75
+ * Query published posts in a given category (one page), newest first.
76
+ * Reference: https://dev.wix.com/docs/api-reference/business-solutions/blog/posts-stats/query-posts.md
77
+ * @param {string} categoryId Category GUID (`category.id` from queryCategories / getCategoryBySlug).
78
+ * @param {{ limit?: number, cursor?: string }} [options]
79
+ * @returns {Promise<{ posts: object[], nextCursor: string|null }>}
80
+ */
81
+ export async function queryPostsByCategory(categoryId, { limit = 100, cursor } = {}) {
82
+ const res = await wixApiRequest("/v3/posts/query", {
83
+ method: "POST",
84
+ body: {
85
+ fieldsets: POST_LIST_FIELDSETS,
86
+ query: {
87
+ ...(cursor ? {} : { filter: { categoryIds: { $hasSome: [categoryId] } } }),
88
+ cursorPaging: cursor ? { limit, cursor } : { limit },
89
+ sort: [{ fieldName: "firstPublishedDate", order: "DESC" }],
90
+ },
91
+ },
92
+ });
93
+ return {
94
+ posts: res?.posts ?? [],
95
+ nextCursor: res?.pagingMetadata?.cursors?.next ?? null,
96
+ };
97
+ }
98
+
99
+ /**
100
+ * Query published posts with a given tag (one page), newest first.
101
+ * Reference: https://dev.wix.com/docs/api-reference/business-solutions/blog/posts-stats/query-posts.md
102
+ * @param {string} tagId Tag GUID (`tag.id` from queryTags / getTagBySlug).
103
+ * @param {{ limit?: number, cursor?: string }} [options]
104
+ * @returns {Promise<{ posts: object[], nextCursor: string|null }>}
105
+ */
106
+ export async function queryPostsByTag(tagId, { limit = 100, cursor } = {}) {
107
+ const res = await wixApiRequest("/v3/posts/query", {
108
+ method: "POST",
109
+ body: {
110
+ fieldsets: POST_LIST_FIELDSETS,
111
+ query: {
112
+ ...(cursor ? {} : { filter: { tagIds: { $hasSome: [tagId] } } }),
113
+ cursorPaging: cursor ? { limit, cursor } : { limit },
114
+ sort: [{ fieldName: "firstPublishedDate", order: "DESC" }],
115
+ },
116
+ },
117
+ });
118
+ return {
119
+ posts: res?.posts ?? [],
120
+ nextCursor: res?.pagingMetadata?.cursors?.next ?? null,
121
+ };
122
+ }
123
+
124
+ /**
125
+ * Total number of published posts. Used for empty-state logic (0 → prompt the user to add
126
+ * posts in their Wix dashboard). Never invent posts.
127
+ * Reference: https://dev.wix.com/docs/api-reference/business-solutions/blog/posts-stats/get-total-posts.md
128
+ * @returns {Promise<number>}
129
+ */
130
+ export async function getTotalPosts() {
131
+ const res = await wixApiRequest("/blog/v2/stats/posts/total", { method: "GET" });
132
+ return res?.total ?? 0;
133
+ }
134
+
135
+ /**
136
+ * Query blog categories (one page), ordered by menu display position.
137
+ * Categories use offset paging (max 100 per page); most blogs have well under 100.
138
+ * Reference: https://dev.wix.com/docs/api-reference/business-solutions/blog/category/query-categories.md
139
+ * @param {{ limit?: number, offset?: number }} [options]
140
+ * @returns {Promise<{ categories: object[], total: number }>}
141
+ */
142
+ export async function queryCategories({ limit = 100, offset = 0 } = {}) {
143
+ const res = await wixApiRequest("/blog/v3/categories/query", {
144
+ method: "POST",
145
+ body: {
146
+ fieldsets: ["URL"],
147
+ query: {
148
+ paging: { limit, offset },
149
+ sort: [{ fieldName: "displayPosition", order: "ASC" }],
150
+ },
151
+ },
152
+ });
153
+ return {
154
+ categories: res?.categories ?? [],
155
+ total: res?.pagingMetadata?.total ?? (res?.categories?.length ?? 0),
156
+ };
157
+ }
158
+
159
+ /**
160
+ * Get one category by its URL slug. Returns null if not found.
161
+ * Reference: https://dev.wix.com/docs/api-reference/business-solutions/blog/category/get-category-by-slug.md
162
+ * @param {string} slug
163
+ * @returns {Promise<object|null>}
164
+ */
165
+ export async function getCategoryBySlug(slug) {
166
+ try {
167
+ const res = await wixApiRequest(`/blog/v3/categories/slugs/${encodeURIComponent(slug)}`, {
168
+ method: "GET",
169
+ query: { fieldsets: ["URL"] },
170
+ });
171
+ return res?.category ?? null;
172
+ } catch {
173
+ return null;
174
+ }
175
+ }
176
+
177
+ /**
178
+ * Query blog tags (one page), most-used first.
179
+ * Tags use offset paging (max 100 per page).
180
+ * Reference: https://dev.wix.com/docs/api-reference/business-solutions/blog/tags/query-tags.md
181
+ * @param {{ limit?: number, offset?: number }} [options]
182
+ * @returns {Promise<{ tags: object[], total: number }>}
183
+ */
184
+ export async function queryTags({ limit = 100, offset = 0 } = {}) {
185
+ const res = await wixApiRequest("/v3/tags/query", {
186
+ method: "POST",
187
+ body: {
188
+ fieldsets: ["URL"],
189
+ query: {
190
+ paging: { limit, offset },
191
+ sort: [{ fieldName: "publishedPostCount", order: "DESC" }],
192
+ },
193
+ },
194
+ });
195
+ return {
196
+ tags: res?.tags ?? [],
197
+ total: res?.pagingMetadata?.total ?? (res?.tags?.length ?? 0),
198
+ };
199
+ }
200
+
201
+ /**
202
+ * Get one tag by its URL slug. Returns null if not found.
203
+ * Reference: https://dev.wix.com/docs/api-reference/business-solutions/blog/tags/get-tag-by-slug.md
204
+ * @param {string} slug
205
+ * @returns {Promise<object|null>}
206
+ */
207
+ export async function getTagBySlug(slug) {
208
+ try {
209
+ const res = await wixApiRequest(`/v3/tags/slugs/${encodeURIComponent(slug)}`, {
210
+ method: "GET",
211
+ query: { fieldsets: ["URL"] },
212
+ });
213
+ return res?.tag ?? null;
214
+ } catch {
215
+ return null;
216
+ }
217
+ }