@wix/agent-skills 1.21.0 → 1.22.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (258) hide show
  1. package/package.json +1 -1
  2. package/skills/wix-app/SKILL.md +60 -4
  3. package/skills/wix-app/references/DASHBOARD_PAGE.md +11 -25
  4. package/skills/wix-app/references/DATA_COLLECTION.md +16 -219
  5. package/skills/wix-app/references/dashboard-page/DATA_SOURCES.md +182 -0
  6. package/skills/wix-app/references/dashboard-page/DRAFT_TEMPLATE.md +97 -0
  7. package/skills/wix-app/references/dashboard-page/DRAFT_TEMPLATE_COLLECTION.md +184 -0
  8. package/skills/wix-app/references/dashboard-page/DRAFT_TEMPLATE_ROUTER.md +203 -0
  9. package/skills/wix-app/references/dashboard-page/DRAFT_TEMPLATE_SETTINGS.md +44 -0
  10. package/skills/wix-app/references/dashboard-page/QUERY_AND_PAGING.md +182 -0
  11. package/skills/wix-app/references/dashboard-page/TABLE_STATE.md +133 -0
  12. package/skills/wix-app/references/dashboard-page/UX_SUCCESS_MODEL.md +10 -5
  13. package/skills/wix-app/references/data-collection/LIFECYCLE.md +68 -0
  14. package/skills/wix-app/references/data-collection/PERMISSIONS.md +47 -0
  15. package/skills/wix-app/references/data-collection/SCHEMA.md +181 -0
  16. package/skills/wix-app/references/data-collection/WIX_DATA.md +38 -66
  17. package/skills/wix-headless-fast/SKILL.md +61 -223
  18. package/skills/wix-headless-fast/cold-start/bootstrap.mjs +156 -0
  19. package/skills/wix-headless-fast/{entry/skill.md → cold-start/cold-start.md} +11 -12
  20. package/skills/wix-headless-fast/guides/existing-site.md +76 -0
  21. package/skills/wix-headless-fast/guides/reference-mode.md +97 -0
  22. package/skills/wix-headless-fast/install/AGENTS.md +6 -3
  23. package/skills/wix-headless-fast/install/attach.mjs +15 -47
  24. package/skills/wix-headless-fast/install/deploy.mjs +21 -60
  25. package/skills/wix-headless-fast/install/lock.mjs +55 -0
  26. package/skills/wix-headless-fast/install/setup.mjs +32 -12
  27. package/skills/wix-headless-fast/install/templates.mjs +168 -0
  28. package/skills/wix-manage/references/google-ads/google-ads-dashboard-navigation.md +27 -0
  29. package/skills/wix-manage/references/google-ads/manage-campaign-success-guide.md +83 -37
  30. package/skills/wix-headless-fast/references/blog/INSTRUCTIONS.md +0 -303
  31. package/skills/wix-headless-fast/references/blog/app/components/blog/BlogFeedView.tsx +0 -136
  32. package/skills/wix-headless-fast/references/blog/app/components/blog/PostView.tsx +0 -112
  33. package/skills/wix-headless-fast/references/blog/app/components/blog/RichContent.tsx +0 -42
  34. package/skills/wix-headless-fast/references/blog/app/hooks/blog/useBlogFeed.ts +0 -31
  35. package/skills/wix-headless-fast/references/blog/app/hooks/blog/usePost.ts +0 -22
  36. package/skills/wix-headless-fast/references/blog/app/wix/blog/blog-feed-store.ts +0 -137
  37. package/skills/wix-headless-fast/references/blog/app/wix/blog/post-store.ts +0 -78
  38. package/skills/wix-headless-fast/references/blog/app/wix/blog/posts-core.ts +0 -117
  39. package/skills/wix-headless-fast/references/blog/app/wix/blog/posts.ts +0 -52
  40. package/skills/wix-headless-fast/references/blog/app/wix/blog/taxonomy-core.ts +0 -47
  41. package/skills/wix-headless-fast/references/blog/app/wix/blog/taxonomy.ts +0 -58
  42. package/skills/wix-headless-fast/references/blog/app/wix/blog/types.ts +0 -62
  43. package/skills/wix-headless-fast/references/blog/app-astro/layouts/SiteLayout.astro +0 -40
  44. package/skills/wix-headless-fast/references/blog/app-astro/pages/blog/[...slug].astro +0 -97
  45. package/skills/wix-headless-fast/references/blog/app-astro/pages/blog.astro +0 -24
  46. package/skills/wix-headless-fast/references/blog/lock/astro/package-lock.json +0 -16156
  47. package/skills/wix-headless-fast/references/blog/rest/posts.ts +0 -42
  48. package/skills/wix-headless-fast/references/blog/rest/taxonomy.ts +0 -62
  49. package/skills/wix-headless-fast/references/blog/seed/SEED.md +0 -81
  50. package/skills/wix-headless-fast/references/blog/seed/read-site.mjs +0 -22
  51. package/skills/wix-headless-fast/references/blog/seed/seed-blog.mjs +0 -287
  52. package/skills/wix-headless-fast/references/bookings/INSTRUCTIONS.md +0 -277
  53. package/skills/wix-headless-fast/references/bookings/app/components/bookings/ServiceBookingView.tsx +0 -144
  54. package/skills/wix-headless-fast/references/bookings/app/components/bookings/ServicesView.tsx +0 -119
  55. package/skills/wix-headless-fast/references/bookings/app/hooks/bookings/useBookingFlow.ts +0 -32
  56. package/skills/wix-headless-fast/references/bookings/app/hooks/bookings/useServices.ts +0 -23
  57. package/skills/wix-headless-fast/references/bookings/app/wix/bookings/booking-core.ts +0 -218
  58. package/skills/wix-headless-fast/references/bookings/app/wix/bookings/booking-flow-store.ts +0 -169
  59. package/skills/wix-headless-fast/references/bookings/app/wix/bookings/booking.ts +0 -121
  60. package/skills/wix-headless-fast/references/bookings/app/wix/bookings/services-core.ts +0 -92
  61. package/skills/wix-headless-fast/references/bookings/app/wix/bookings/services-store.ts +0 -90
  62. package/skills/wix-headless-fast/references/bookings/app/wix/bookings/services.ts +0 -57
  63. package/skills/wix-headless-fast/references/bookings/app/wix/bookings/types.ts +0 -72
  64. package/skills/wix-headless-fast/references/bookings/app-astro/layouts/SiteLayout.astro +0 -40
  65. package/skills/wix-headless-fast/references/bookings/app-astro/pages/services/[slug].astro +0 -76
  66. package/skills/wix-headless-fast/references/bookings/app-astro/pages/services.astro +0 -22
  67. package/skills/wix-headless-fast/references/bookings/lock/astro/package-lock.json +0 -11962
  68. package/skills/wix-headless-fast/references/bookings/rest/booking.ts +0 -113
  69. package/skills/wix-headless-fast/references/bookings/rest/services.ts +0 -55
  70. package/skills/wix-headless-fast/references/bookings/seed/SEED.md +0 -71
  71. package/skills/wix-headless-fast/references/bookings/seed/read-site.mjs +0 -28
  72. package/skills/wix-headless-fast/references/bookings/seed/seed-bookings.mjs +0 -302
  73. package/skills/wix-headless-fast/references/cms/INSTRUCTIONS.md +0 -355
  74. package/skills/wix-headless-fast/references/cms/app/hooks/cms/useCollection.ts +0 -50
  75. package/skills/wix-headless-fast/references/cms/app/hooks/cms/useItem.ts +0 -37
  76. package/skills/wix-headless-fast/references/cms/app/wix/cms/collection-store.ts +0 -158
  77. package/skills/wix-headless-fast/references/cms/app/wix/cms/item-store.ts +0 -93
  78. package/skills/wix-headless-fast/references/cms/app/wix/cms/items-core.ts +0 -177
  79. package/skills/wix-headless-fast/references/cms/app/wix/cms/items.ts +0 -123
  80. package/skills/wix-headless-fast/references/cms/app/wix/cms/types.ts +0 -75
  81. package/skills/wix-headless-fast/references/cms/app-astro/layouts/SiteLayout.astro +0 -41
  82. package/skills/wix-headless-fast/references/cms/lock/astro/package-lock.json +0 -11262
  83. package/skills/wix-headless-fast/references/cms/rest/items.ts +0 -125
  84. package/skills/wix-headless-fast/references/cms/seed/SEED.md +0 -112
  85. package/skills/wix-headless-fast/references/cms/seed/read-site.mjs +0 -20
  86. package/skills/wix-headless-fast/references/cms/seed/seed-cms.mjs +0 -324
  87. package/skills/wix-headless-fast/references/events/INSTRUCTIONS.md +0 -307
  88. package/skills/wix-headless-fast/references/events/app/components/events/EventConfirmationView.tsx +0 -66
  89. package/skills/wix-headless-fast/references/events/app/components/events/EventRegistrationView.tsx +0 -178
  90. package/skills/wix-headless-fast/references/events/app/components/events/EventsView.tsx +0 -118
  91. package/skills/wix-headless-fast/references/events/app/hooks/events/useEventRegistration.ts +0 -35
  92. package/skills/wix-headless-fast/references/events/app/hooks/events/useEvents.ts +0 -24
  93. package/skills/wix-headless-fast/references/events/app/wix/events/events-core.ts +0 -130
  94. package/skills/wix-headless-fast/references/events/app/wix/events/events-store.ts +0 -97
  95. package/skills/wix-headless-fast/references/events/app/wix/events/events.ts +0 -55
  96. package/skills/wix-headless-fast/references/events/app/wix/events/registration-core.ts +0 -113
  97. package/skills/wix-headless-fast/references/events/app/wix/events/registration-store.ts +0 -156
  98. package/skills/wix-headless-fast/references/events/app/wix/events/registration.ts +0 -97
  99. package/skills/wix-headless-fast/references/events/app/wix/events/types.ts +0 -61
  100. package/skills/wix-headless-fast/references/events/app-astro/layouts/SiteLayout.astro +0 -40
  101. package/skills/wix-headless-fast/references/events/app-astro/pages/event-confirmation.astro +0 -12
  102. package/skills/wix-headless-fast/references/events/app-astro/pages/events/[slug].astro +0 -80
  103. package/skills/wix-headless-fast/references/events/app-astro/pages/events.astro +0 -21
  104. package/skills/wix-headless-fast/references/events/lock/astro/package-lock.json +0 -11884
  105. package/skills/wix-headless-fast/references/events/rest/events.ts +0 -57
  106. package/skills/wix-headless-fast/references/events/rest/registration.ts +0 -83
  107. package/skills/wix-headless-fast/references/events/seed/SEED.md +0 -95
  108. package/skills/wix-headless-fast/references/events/seed/read-site.mjs +0 -26
  109. package/skills/wix-headless-fast/references/events/seed/seed-events.mjs +0 -276
  110. package/skills/wix-headless-fast/references/forms/INSTRUCTIONS.md +0 -340
  111. package/skills/wix-headless-fast/references/forms/app/hooks/forms/useWixForm.ts +0 -85
  112. package/skills/wix-headless-fast/references/forms/app/wix/forms/form-store.ts +0 -332
  113. package/skills/wix-headless-fast/references/forms/app/wix/forms/forms-core.ts +0 -238
  114. package/skills/wix-headless-fast/references/forms/app/wix/forms/forms.ts +0 -54
  115. package/skills/wix-headless-fast/references/forms/app/wix/forms/submissions-core.ts +0 -216
  116. package/skills/wix-headless-fast/references/forms/app/wix/forms/submissions.ts +0 -59
  117. package/skills/wix-headless-fast/references/forms/app/wix/forms/types.ts +0 -135
  118. package/skills/wix-headless-fast/references/forms/lock/astro/package-lock.json +0 -10593
  119. package/skills/wix-headless-fast/references/forms/rest/forms.ts +0 -34
  120. package/skills/wix-headless-fast/references/forms/rest/submissions.ts +0 -56
  121. package/skills/wix-headless-fast/references/forms/seed/SEED.md +0 -116
  122. package/skills/wix-headless-fast/references/forms/seed/read-site.mjs +0 -20
  123. package/skills/wix-headless-fast/references/forms/seed/seed-forms.mjs +0 -327
  124. package/skills/wix-headless-fast/references/members/INSTRUCTIONS.md +0 -316
  125. package/skills/wix-headless-fast/references/members/app/components/members/AccountView.tsx +0 -60
  126. package/skills/wix-headless-fast/references/members/app/components/members/LoginForm.tsx +0 -155
  127. package/skills/wix-headless-fast/references/members/app/components/members/MemberMenu.tsx +0 -78
  128. package/skills/wix-headless-fast/references/members/app/components/members/RequireAuth.tsx +0 -47
  129. package/skills/wix-headless-fast/references/members/app/hooks/members/useMember.ts +0 -66
  130. package/skills/wix-headless-fast/references/members/app/wix/members/auth-core.ts +0 -105
  131. package/skills/wix-headless-fast/references/members/app/wix/members/auth.ts +0 -59
  132. package/skills/wix-headless-fast/references/members/app/wix/members/client.ts +0 -53
  133. package/skills/wix-headless-fast/references/members/app/wix/members/member-store.ts +0 -122
  134. package/skills/wix-headless-fast/references/members/app/wix/members/members-core.ts +0 -43
  135. package/skills/wix-headless-fast/references/members/app/wix/members/members.ts +0 -29
  136. package/skills/wix-headless-fast/references/members/app/wix/members/types.ts +0 -21
  137. package/skills/wix-headless-fast/references/members/app-astro/layouts/SiteLayout.astro +0 -42
  138. package/skills/wix-headless-fast/references/members/app-astro/pages/account.astro +0 -10
  139. package/skills/wix-headless-fast/references/members/app-astro/pages/login.astro +0 -11
  140. package/skills/wix-headless-fast/references/members/lock/astro/package-lock.json +0 -10329
  141. package/skills/wix-headless-fast/references/members/rest/auth.ts +0 -215
  142. package/skills/wix-headless-fast/references/members/rest/members.ts +0 -26
  143. package/skills/wix-headless-fast/references/members/seed/SEED.md +0 -39
  144. package/skills/wix-headless-fast/references/members/seed/read-site.mjs +0 -15
  145. package/skills/wix-headless-fast/references/members/seed/seed-members.mjs +0 -94
  146. package/skills/wix-headless-fast/references/portfolio/INSTRUCTIONS.md +0 -315
  147. package/skills/wix-headless-fast/references/portfolio/app/components/portfolio/CollectionProjectsView.tsx +0 -110
  148. package/skills/wix-headless-fast/references/portfolio/app/components/portfolio/CollectionsView.tsx +0 -90
  149. package/skills/wix-headless-fast/references/portfolio/app/components/portfolio/GalleryMedia.tsx +0 -35
  150. package/skills/wix-headless-fast/references/portfolio/app/components/portfolio/ProjectDetailView.tsx +0 -85
  151. package/skills/wix-headless-fast/references/portfolio/app/hooks/portfolio/useCollectionProjects.ts +0 -32
  152. package/skills/wix-headless-fast/references/portfolio/app/hooks/portfolio/useCollections.ts +0 -21
  153. package/skills/wix-headless-fast/references/portfolio/app/hooks/portfolio/useProjectDetail.ts +0 -31
  154. package/skills/wix-headless-fast/references/portfolio/app/wix/portfolio/collection-projects-store.ts +0 -82
  155. package/skills/wix-headless-fast/references/portfolio/app/wix/portfolio/collections-store.ts +0 -58
  156. package/skills/wix-headless-fast/references/portfolio/app/wix/portfolio/portfolio-core.ts +0 -177
  157. package/skills/wix-headless-fast/references/portfolio/app/wix/portfolio/portfolio.ts +0 -78
  158. package/skills/wix-headless-fast/references/portfolio/app/wix/portfolio/project-detail-store.ts +0 -81
  159. package/skills/wix-headless-fast/references/portfolio/app/wix/portfolio/types.ts +0 -55
  160. package/skills/wix-headless-fast/references/portfolio/app-astro/layouts/SiteLayout.astro +0 -40
  161. package/skills/wix-headless-fast/references/portfolio/app-astro/pages/portfolio/[slug].astro +0 -30
  162. package/skills/wix-headless-fast/references/portfolio/app-astro/pages/portfolio.astro +0 -21
  163. package/skills/wix-headless-fast/references/portfolio/app-astro/pages/projects/[slug].astro +0 -29
  164. package/skills/wix-headless-fast/references/portfolio/lock/astro/package-lock.json +0 -10197
  165. package/skills/wix-headless-fast/references/portfolio/rest/portfolio.ts +0 -75
  166. package/skills/wix-headless-fast/references/portfolio/seed/SEED.md +0 -86
  167. package/skills/wix-headless-fast/references/portfolio/seed/read-site.mjs +0 -20
  168. package/skills/wix-headless-fast/references/portfolio/seed/seed-portfolio.mjs +0 -256
  169. package/skills/wix-headless-fast/references/pricing-plans/INSTRUCTIONS.md +0 -296
  170. package/skills/wix-headless-fast/references/pricing-plans/app/components/pricing-plans/PlanDetailView.tsx +0 -47
  171. package/skills/wix-headless-fast/references/pricing-plans/app/components/pricing-plans/PlansView.tsx +0 -101
  172. package/skills/wix-headless-fast/references/pricing-plans/app/components/pricing-plans/SubscribeButton.tsx +0 -41
  173. package/skills/wix-headless-fast/references/pricing-plans/app/hooks/pricing-plans/usePlanPurchase.ts +0 -16
  174. package/skills/wix-headless-fast/references/pricing-plans/app/hooks/pricing-plans/usePlans.ts +0 -22
  175. package/skills/wix-headless-fast/references/pricing-plans/app/wix/pricing-plans/plan-purchase-store.ts +0 -54
  176. package/skills/wix-headless-fast/references/pricing-plans/app/wix/pricing-plans/plans-core.ts +0 -106
  177. package/skills/wix-headless-fast/references/pricing-plans/app/wix/pricing-plans/plans-store.ts +0 -64
  178. package/skills/wix-headless-fast/references/pricing-plans/app/wix/pricing-plans/plans.ts +0 -27
  179. package/skills/wix-headless-fast/references/pricing-plans/app/wix/pricing-plans/purchase-core.ts +0 -43
  180. package/skills/wix-headless-fast/references/pricing-plans/app/wix/pricing-plans/purchase.ts +0 -22
  181. package/skills/wix-headless-fast/references/pricing-plans/app/wix/pricing-plans/types.ts +0 -30
  182. package/skills/wix-headless-fast/references/pricing-plans/app-astro/layouts/SiteLayout.astro +0 -41
  183. package/skills/wix-headless-fast/references/pricing-plans/app-astro/pages/plans/[slug].astro +0 -40
  184. package/skills/wix-headless-fast/references/pricing-plans/app-astro/pages/plans.astro +0 -21
  185. package/skills/wix-headless-fast/references/pricing-plans/lock/astro/package-lock.json +0 -11226
  186. package/skills/wix-headless-fast/references/pricing-plans/rest/plans.ts +0 -31
  187. package/skills/wix-headless-fast/references/pricing-plans/rest/purchase.ts +0 -20
  188. package/skills/wix-headless-fast/references/pricing-plans/seed/SEED.md +0 -79
  189. package/skills/wix-headless-fast/references/pricing-plans/seed/read-site.mjs +0 -21
  190. package/skills/wix-headless-fast/references/pricing-plans/seed/seed-pricing-plans.mjs +0 -279
  191. package/skills/wix-headless-fast/references/restaurants/INSTRUCTIONS.md +0 -360
  192. package/skills/wix-headless-fast/references/restaurants/app/components/restaurants/MenuView.tsx +0 -142
  193. package/skills/wix-headless-fast/references/restaurants/app/components/restaurants/OrderCartButton.tsx +0 -26
  194. package/skills/wix-headless-fast/references/restaurants/app/components/restaurants/OrderCartDrawer.tsx +0 -121
  195. package/skills/wix-headless-fast/references/restaurants/app/components/restaurants/ReservationView.tsx +0 -155
  196. package/skills/wix-headless-fast/references/restaurants/app/hooks/restaurants/useMenus.ts +0 -34
  197. package/skills/wix-headless-fast/references/restaurants/app/hooks/restaurants/useOrderCart.ts +0 -43
  198. package/skills/wix-headless-fast/references/restaurants/app/hooks/restaurants/useReservation.ts +0 -34
  199. package/skills/wix-headless-fast/references/restaurants/app/wix/restaurants/menu-core.ts +0 -155
  200. package/skills/wix-headless-fast/references/restaurants/app/wix/restaurants/menu-store.ts +0 -89
  201. package/skills/wix-headless-fast/references/restaurants/app/wix/restaurants/menu.ts +0 -71
  202. package/skills/wix-headless-fast/references/restaurants/app/wix/restaurants/order-store.ts +0 -103
  203. package/skills/wix-headless-fast/references/restaurants/app/wix/restaurants/ordering-core.ts +0 -124
  204. package/skills/wix-headless-fast/references/restaurants/app/wix/restaurants/ordering.ts +0 -185
  205. package/skills/wix-headless-fast/references/restaurants/app/wix/restaurants/reservation-store.ts +0 -193
  206. package/skills/wix-headless-fast/references/restaurants/app/wix/restaurants/reservations-core.ts +0 -94
  207. package/skills/wix-headless-fast/references/restaurants/app/wix/restaurants/reservations.ts +0 -74
  208. package/skills/wix-headless-fast/references/restaurants/app/wix/restaurants/types.ts +0 -168
  209. package/skills/wix-headless-fast/references/restaurants/app-astro/layouts/SiteLayout.astro +0 -47
  210. package/skills/wix-headless-fast/references/restaurants/app-astro/pages/menu.astro +0 -22
  211. package/skills/wix-headless-fast/references/restaurants/app-astro/pages/reservations.astro +0 -12
  212. package/skills/wix-headless-fast/references/restaurants/lock/astro/package-lock.json +0 -12560
  213. package/skills/wix-headless-fast/references/restaurants/rest/menu.ts +0 -60
  214. package/skills/wix-headless-fast/references/restaurants/rest/ordering.ts +0 -169
  215. package/skills/wix-headless-fast/references/restaurants/rest/reservations.ts +0 -68
  216. package/skills/wix-headless-fast/references/restaurants/seed/SEED.md +0 -89
  217. package/skills/wix-headless-fast/references/restaurants/seed/read-site.mjs +0 -25
  218. package/skills/wix-headless-fast/references/restaurants/seed/seed-restaurants.mjs +0 -499
  219. package/skills/wix-headless-fast/references/shared/CONTENT.md +0 -22
  220. package/skills/wix-headless-fast/references/shared/CUSTOM_OPERATIONS.md +0 -73
  221. package/skills/wix-headless-fast/references/shared/DESIGN.md +0 -26
  222. package/skills/wix-headless-fast/references/shared/SUPPLIED-CONTENT.md +0 -23
  223. package/skills/wix-headless-fast/references/shared/app/styles/global.css +0 -52
  224. package/skills/wix-headless-fast/references/shared/app/wix/config.ts +0 -15
  225. package/skills/wix-headless-fast/references/shared/app/wix/media.ts +0 -81
  226. package/skills/wix-headless-fast/references/shared/app/wix/money.ts +0 -24
  227. package/skills/wix-headless-fast/references/shared/app/wix/sdk.ts +0 -89
  228. package/skills/wix-headless-fast/references/shared/capabilities/media-upload/app/wix/media-upload/client.ts +0 -46
  229. package/skills/wix-headless-fast/references/shared/capabilities/media-upload/app-astro/pages/api/wix/media-upload.ts +0 -46
  230. package/skills/wix-headless-fast/references/shared/rest/client.ts +0 -155
  231. package/skills/wix-headless-fast/references/shared/rest/config.ts +0 -3
  232. package/skills/wix-headless-fast/references/shared/rest/media.ts +0 -65
  233. package/skills/wix-headless-fast/references/shared/seed/images.mjs +0 -145
  234. package/skills/wix-headless-fast/references/shared/seed/read-site.mjs +0 -99
  235. package/skills/wix-headless-fast/references/storefront/INSTRUCTIONS.md +0 -612
  236. package/skills/wix-headless-fast/references/storefront/app/components/storefront/CartButton.tsx +0 -26
  237. package/skills/wix-headless-fast/references/storefront/app/components/storefront/CartDrawer.tsx +0 -155
  238. package/skills/wix-headless-fast/references/storefront/app/components/storefront/FilterPanel.tsx +0 -266
  239. package/skills/wix-headless-fast/references/storefront/app/components/storefront/OptionPicker.tsx +0 -95
  240. package/skills/wix-headless-fast/references/storefront/app/components/storefront/QuickAdd.tsx +0 -136
  241. package/skills/wix-headless-fast/references/storefront/app/hooks/storefront/useCart.ts +0 -48
  242. package/skills/wix-headless-fast/references/storefront/app/hooks/storefront/useProductDetail.ts +0 -39
  243. package/skills/wix-headless-fast/references/storefront/app/hooks/storefront/useShop.ts +0 -34
  244. package/skills/wix-headless-fast/references/storefront/app/wix/storefront/cart-core.ts +0 -121
  245. package/skills/wix-headless-fast/references/storefront/app/wix/storefront/cart-store.ts +0 -107
  246. package/skills/wix-headless-fast/references/storefront/app/wix/storefront/cart.ts +0 -138
  247. package/skills/wix-headless-fast/references/storefront/app/wix/storefront/catalog-core.ts +0 -314
  248. package/skills/wix-headless-fast/references/storefront/app/wix/storefront/catalog.ts +0 -133
  249. package/skills/wix-headless-fast/references/storefront/app/wix/storefront/product-detail-store.ts +0 -147
  250. package/skills/wix-headless-fast/references/storefront/app/wix/storefront/shop-store.ts +0 -289
  251. package/skills/wix-headless-fast/references/storefront/app/wix/storefront/types.ts +0 -169
  252. package/skills/wix-headless-fast/references/storefront/app-astro/layouts/SiteLayout.astro +0 -65
  253. package/skills/wix-headless-fast/references/storefront/lock/astro/package-lock.json +0 -12247
  254. package/skills/wix-headless-fast/references/storefront/rest/cart.ts +0 -132
  255. package/skills/wix-headless-fast/references/storefront/rest/catalog.ts +0 -123
  256. package/skills/wix-headless-fast/references/storefront/seed/SEED.md +0 -130
  257. package/skills/wix-headless-fast/references/storefront/seed/read-site.mjs +0 -38
  258. package/skills/wix-headless-fast/references/storefront/seed/seed-store.mjs +0 -561
@@ -1,296 +0,0 @@
1
- # Pricing Plans — playbook
2
-
3
- The plans machinery ships as files — plan reads (grid + by-slug), the hosted purchase redirect,
4
- the purchase control, typed end-to-end. **The presentation is yours**: you design and implement
5
- the plan card, the pricing grid, and the plan detail surface on the shipped hooks/DTOs, plus the
6
- home page and the brand. You never write purchase logic; you never skip designing.
7
-
8
- ## The file map (deployed into `src/`)
9
-
10
- **On Astro and React the shipped files are tested and work as they are** — this table and the
11
- contracts below are everything you need to use them, so don't spend the run reading their source;
12
- wire them and build your surfaces. Reading them is the right move when something is off (a runtime
13
- error, a field this playbook doesn't cover) or when the brief wants a behaviour they don't offer —
14
- then read the file that owns it and change or extend it. On `lib`, `static`, and a port the
15
- components don't deploy at all, and each wiring section below opens with the files to read before
16
- writing their equivalents. Files you edit: `SiteLayout.astro` and `styles/global.css`. Files you
17
- **create** (skeletons below): your pricing grid and plan detail islands, plus your home page.
18
-
19
- | file | what it is |
20
- |---|---|
21
- | `wix/config.ts` · `wix/sdk.ts` | shared auth seam (deploy configures it — nothing to set by hand) |
22
- | `wix/media.ts` · `wix/money.ts` | `imgAttrs(url, sizes)` — every `<img>` attribute for a DTO image (`src`, `srcSet`, `sizes`, lazy): `<img {...imgAttrs(plan.imageUrl, "50vw")} alt={plan.name} />`; `imgSrc()` / `imgSrcSet()` / `formatMoney()` underneath |
23
- | `wix/pricing-plans/types.ts` | the DTOs (`PlanSummary`, `PlanDetail`) — contracts inlined below |
24
- | `wix/pricing-plans/plans.ts` | `fetchPlans`, `fetchPlanBySlug` — the transport; the rules and DTO mappers are in `plans-core.ts` beside it (shared with the REST layer) |
25
- | `wix/pricing-plans/purchase.ts` | `purchasePlan` — the hosted-checkout redirect session; its body lives in `purchase-core.ts` (shared with the REST layer) |
26
- | `wix/pricing-plans/plans-store.ts` · `plan-purchase-store.ts` | the listing and purchase state machines, framework-free (`createPlansStore()`, `createPlanPurchaseStore()` — `getState`/`subscribe` + actions, one instance per surface); the hooks below bind them to React, every other stack uses them directly |
27
- | `hooks/pricing-plans/usePlans.ts` | React binding of `plans-store.ts`: the plans listing — contract below |
28
- | `hooks/pricing-plans/usePlanPurchase.ts` | React binding of `plan-purchase-store.ts`: the purchase action — contract below |
29
- | `components/pricing-plans/SubscribeButton.tsx` | the purchase control for one plan — rendered only when `buyable`, label from the DTO ("Get this plan" free / "Subscribe"), "Redirecting…" in flight, the failure inline — **wire as-is** on every card, the detail page, a home strip (`<SubscribeButton plan={p} />`) |
30
- | `components/pricing-plans/PlansView.tsx` (+ `PlanCard`) · `PlanDetailView.tsx` | **REFERENCE implementations** — correct, plain; build your own instead of shipping them (skeletons below) |
31
- | `styles/global.css` | **the design system**: Tailwind v4 + the `@theme` token block (colors, radii, fonts — shared across verticals). Everything, shipped and yours, styles from these tokens |
32
-
33
- Astro stack additionally gets:
34
-
35
- | file | what it is |
36
- |---|---|
37
- | `layouts/SiteLayout.astro` | site chrome — **yours to brand** (keep the `seo-tags` slot + global.css import). If another vertical is also deployed, its layout won — add a Plans nav link there |
38
- | `pages/plans.astro` | SSR pricing grid — **keep the frontmatter**, swap the island import to YOUR component |
39
- | `pages/plans/[slug].astro` | SSR plan detail, a real 404 on a bad slug — **keep the frontmatter** (plain `<title>`/`<meta>` from the DTO: Pricing Plans has no owner-editable SEO item type); swap the island import |
40
-
41
- ## What you build — the design job
42
-
43
- 1. **The plan card + pricing grid** — your tier card (name, price + billing cadence, trial
44
- badge, perks list, the shipped `SubscribeButton`) and grid rhythm (a highlighted recommended
45
- tier is a classic), with skeletons while loading and an honest empty state — on `usePlans`.
46
- 2. **The plan detail surface** — the full pitch: price block, perks, terms & conditions
47
- (plain text — render pre-wrap), the shipped `SubscribeButton` (the plan itself arrives as an
48
- SSR-fetched DTO prop).
49
- 3. **The home page** — hero, a featured-plans strip (fetch in frontmatter → your components),
50
- brand story.
51
-
52
- Plus the **theme** (`@theme` block, one edit) and the **chrome** (`SiteLayout`, one pass).
53
-
54
- ### What a complete pricing site shows (recommended defaults)
55
-
56
- Defaults for a brief that says nothing about them; the prompt wins where it differs. Look at the
57
- plans before designing (how many tiers, free/recurring/one-time mix, trials, perks, images).
58
-
59
- - **Pricing page:** every public plan as a card in the first screen on desktop — name, price with
60
- its cadence, perks, the CTA; a free plan reads "Free" with no cadence; a recommended tier may be
61
- highlighted, never invented; loading (`plans === null`), empty, and error states look different.
62
- - **Plan page:** name, price, cadence, the CTA in the first screen at 390px wide too; perks and
63
- terms after the CTA, never between the price and the action; a plan without an image renders no
64
- empty image box.
65
- - **CTA:** the shipped `SubscribeButton` on every purchase surface — it disappears for a plan that
66
- isn't buyable (`assignedText` or nothing), and a free plan's label is not "Subscribe".
67
- - **Copy:** nothing the merchant didn't supply — no invented savings, guarantees, or member counts;
68
- no Wix IDs or technical words in visible text.
69
-
70
- ### The contracts your components consume (tested and work as they are; read the source when something is off or the brief wants more)
71
-
72
- ```ts
73
- // PlanSummary (cards) — display-ready:
74
- // { id, slug, name, description, price /* "€29.00" | "Free" */, free,
75
- // billing /* "per month" | "every 3 months" | "one-time" | "per month × 6" | "" (free) */,
76
- // freeTrialDays: number|null, perks: string[], buyable, imageUrl /* "" when none */ }
77
- // PlanDetail adds: termsAndConditions (plain text; "" when not set).
78
-
79
- // usePlans({ initialPlans? }) →
80
- // { plans: PlanSummary[]|null /* null = loading → skeletons; [] after a failed load, with error */, error }
81
-
82
- // usePlanPurchase() →
83
- // { purchase(planId, { thankYouPageUrl?, postFlowUrl? }?): Promise<void>,
84
- // // resolves as the browser navigates to the Wix-hosted checkout;
85
- // // rejects with a visitor-facing message — surface it
86
- // purchasingId, // plan id in flight (null when idle) — key the CTA spinner off it
87
- // error }
88
- // <SubscribeButton plan={p} options? children? className? assignedText? /> wraps it: you only
89
- // place it; it decides whether to render, what to say, and shows its own error.
90
- ```
91
-
92
- ### The islands you create — skeletons
93
-
94
- The pages ship; the islands they mount are yours. Each island is a thin view over a hook. Hooks
95
- first, branches after (an early return above a hook changes hook order between renders and React
96
- throws). `client:load` islands render on the server too — render every state totally; nothing in
97
- a render path may throw. The class names are the Astro/React spelling of layout rules that hold on
98
- every stack; on a stack where the components don't deploy, keep the rule and write it in your CSS.
99
-
100
- ```tsx
101
- // src/components/pricing-plans/PricingGrid.tsx — YOU build it; pages/plans.astro mounts it
102
- // (swap its island import from PlansView to this).
103
- import { usePlans } from "../../hooks/pricing-plans/usePlans";
104
- import SubscribeButton from "./SubscribeButton";
105
- import type { PlanSummary } from "../../wix/pricing-plans/types";
106
-
107
- export default function PricingGrid(props: { initialPlans?: PlanSummary[] /* SSR prop — pass straight to usePlans; omitted in a SPA */ }) {
108
- const { plans, error } = usePlans(props);
109
- // …you implement the render:
110
- // • error → a short inline message
111
- // • plans === null → skeleton cards; [] → your honest empty state
112
- // • else YOUR grid of YOUR cards (PlanSummary contract above): name, price on its own line
113
- // with billing beside it (nothing beside "Free"), `${freeTrialDays}-day free trial` when not
114
- // null, every perk, a link to `/plans/${p.slug}`, and <SubscribeButton plan={p} assignedText={null} />
115
- // as the card's LAST ROW — the card root a flex column, the control pinned to the bottom
116
- // (mt-auto) so CTAs share one baseline across the row; never a button inside the card's <a>.
117
- // • the name WRAPS (`min-w-0`, `break-words`) — no truncation.
118
- }
119
- ```
120
-
121
- ```tsx
122
- // src/components/pricing-plans/PlanPitch.tsx — YOU build it; pages/plans/[slug].astro mounts it
123
- // with the server-fetched plan (swap its island import from PlanDetailView to this).
124
- import SubscribeButton from "./SubscribeButton";
125
- import type { PlanDetail } from "../../wix/pricing-plans/types";
126
-
127
- export default function PlanPitch({ plan }: { plan: PlanDetail }) {
128
- // …you implement the render, laid out for the brand: price + billing, the trial line, the
129
- // perks, <SubscribeButton plan={plan} /> right under the price (its label for a paid plan may
130
- // carry the price: `Subscribe · ${plan.price}` as children), then termsAndConditions pre-wrap.
131
- // Image via <img {...imgAttrs(plan.imageUrl, "(min-width: 768px) 50vw, 100vw")} /> only when
132
- // plan.imageUrl is non-empty — a bounded band on phones (`max-h-[40vh]`), not a full-screen hero.
133
- }
134
- ```
135
-
136
- ### The reference files for stacks where the components don't deploy
137
-
138
- On `lib`, `static`, and a port, nothing under `components/` or `hooks/` arrives. The state
139
- machines behind the hooks do arrive — `wix/pricing-plans/plans-store.ts`, `plan-purchase-store.ts`
140
- — so you never rewrite them: create a store per surface, `subscribe`, render from `getState()`,
141
- call its actions. Their `*State` interfaces are the render contract; read those. What you write is
142
- the rendering — grid, card, plan page, the CTA — and for that read first:
143
-
144
- 1. `components/pricing-plans/SubscribeButton.tsx` — the purchase control as working code: the
145
- `buyable` gate and what shows instead, the free/paid label, the in-flight label, the inline
146
- error; the reference views place it as the last row of a card and under the price on the page.
147
-
148
- Under `references/pricing-plans/app/`.
149
-
150
- ### Wiring — Astro (default)
151
-
152
- 1. Set the `@theme` tokens (one edit); brand `SiteLayout.astro` (one pass — merge into the
153
- other vertical's layout instead if both are deployed).
154
- 2. Write your islands under `src/components/pricing-plans/` per the skeletons (new names — don't
155
- overwrite the references), swap the island imports in `pages/plans.astro` and
156
- `pages/plans/[slug].astro`. Both islands: `client:load` with the SSR DTO props. Author your
157
- surfaces in as few messages as possible — batch multiple Writes per message.
158
- 3. Write `pages/index.astro` (home) — it exists from the scaffold; Read it before overwriting.
159
-
160
- ### Wiring — another JS framework (`--stack lib`: Vue, Svelte, Solid, plain Vite)
161
-
162
- Read the reference file listed above before writing any surface.
163
-
164
- `deploy.mjs pricing-plans --stack lib` put the data layer in `src/wix/` and nothing else: `sdk.ts`
165
- (the visitor client, configured with the public client id), `media.ts`, `money.ts`, and
166
- `wix/pricing-plans/` — `plans.ts`, `purchase.ts`, `types.ts`, the `*-core.ts` rules, and the two
167
- stores `plans-store.ts`, `plan-purchase-store.ts`. None of it is React. The hooks and components
168
- don't ship on this stack; the stores replace the hooks, and you write the components in your
169
- framework to the contracts on this page:
170
-
171
- - bind the stores with your framework's external-store primitive (Vue: `shallowRef` updated in
172
- `subscribe`; Svelte: `readable(store.getState(), (set) => store.subscribe(() => set(store.getState())))`;
173
- Solid: a signal set in `subscribe`). `createPlansStore({ initialPlans? })` per listing (`start()`
174
- when mounted, `stop()` when unmounted), `createPlanPurchaseStore()` per purchase surface
175
- (`purchase(planId, options?)` navigates the document itself). State in, actions out — exactly
176
- the hooks' contracts above;
177
- - your CTA to the `SubscribeButton.tsx` contract: rendered only when `buyable`, the DTO's label,
178
- disabled with "Redirecting…" while `purchasingId === plan.id`, `error` inline.
179
-
180
- Routes `/plans`, `/plans/:slug` (via `fetchPlanBySlug`, null → your 404); dev server on 4321; a
181
- static build goes through `npx @wix/cli@latest release` with `site.outputDirectory` pointing at the
182
- build folder, an SSR build is hosted by you. Page title and meta description from the DTO's `name`
183
- and `description` — plans carry no `seoData`.
184
-
185
- ### Wiring — static site (`--stack static`, no bundler)
186
-
187
- Read the reference file listed above before writing any surface.
188
-
189
- `deploy.mjs pricing-plans --stack static --out site` put the REST layer in `site/js/wix/` (browser
190
- ESM, the `.ts` beside each `.js` for reading). Everything the visitor loads lives under `site/` —
191
- pages, styles, `js/` — and `wix.config.json`'s `site.outputDirectory` is `"./site"`; the project
192
- root (config, plan, seed output) is never the upload. Same function names and DTOs as the table
193
- above, so the contracts on this page hold unchanged: `fetchPlans`, `fetchPlanBySlug` from
194
- `./js/wix/plans.js`; `purchasePlan` from `./js/wix/purchase.js`. The state machines ship too:
195
- `createPlansStore` from `./js/wix/plans-store.js` (the grid — `start()` once the page is up,
196
- render from `getState()` in `subscribe`) and `createPlanPurchaseStore` from
197
- `./js/wix/plan-purchase-store.js` (one per surface; its `purchase(planId)` sets `purchasingId`,
198
- then navigates the document to the hosted checkout, or records `error`). No components ship — you
199
- write the rendering in plain JS: one render function per surface that reads `getState()`, called
200
- from `subscribe`, with the CTA calling `purchase`. Pages are `plans.html` and `plan.html?slug=…`
201
- (Wix static hosting serves files, not directories — name the file and link to it); the plan page
202
- reads the slug, `fetchPlanBySlug`, renders its not-found state on null, and sets `document.title`
203
- and the meta description from the DTO's `name`/`description`. The visitor token persists in
204
- `localStorage` on its own; never mint per page. `npx @wix/cli@latest release` uploads `site/`.
205
-
206
- ### Wiring — server-rendered, another language (Flask, Laravel, Rails, …)
207
-
208
- Read the reference file listed above before writing any surface.
209
-
210
- Run `deploy.mjs pricing-plans --stack static` in the project folder anyway: `js/wix/` is both the
211
- browser-side code and the readable spec. Then split by where the call runs. **Reads on the
212
- server:** port `js/wix/plans.ts` and `plans-core.ts` to your language — the same two functions
213
- returning the same DTO shapes as dicts (one POST with the literal body in the file), one anonymous
214
- visitor token per process for these public reads (mint and refresh per `client.ts`) — and render
215
- the grid and the plan page in your templates to the contracts above, so plan names and prices are
216
- in the HTML; title and meta description from the DTO. **Purchasing in the browser:** the CTA on
217
- `./js/wix/plan-purchase-store.js` (pass the plan id rendered into the page), exactly as the static
218
- wiring above — the redirect session is created by the visitor's own token from the page, so the
219
- server never handles per-visitor tokens. Routes stay `/plans`, `/plans/<slug>`. Add your public
220
- https origin to the OAuth app's allowed domains before the hosted checkout can return.
221
-
222
- **Pre-rendered (Frozen-Flask, Pelican, any static-site generator) → Wix-hosted.** Same port for
223
- the reads, run at build time with one anonymous token; the generator emits `/plans` and one page
224
- per slug from `fetchPlans()` (at most 100 public plans — one call). Run `deploy.mjs pricing-plans
225
- --stack static --out <build dir>` so `js/wix/` is inside the output the pages import from, point
226
- `site.outputDirectory` at that folder, `wix release`. Pages sit at different depths (`/`,
227
- `/plans/…`): give the templates one base path to `js/wix/` (a template variable, or root-relative
228
- `/js/wix/…`), never a relative `./js/wix/` — it breaks one level down. The frozen page is the
229
- first paint; the CTA still runs client-side through `createPlanPurchaseStore()`. Close with the
230
- live URL, the rebuild + release command, and one line for the owner: dashboard edits to plans
231
- reach the site when that command runs; purchasing is live regardless.
232
-
233
- ### Wiring — React SPA (Vite etc.)
234
-
235
- Import `./styles/global.css` once at the app entry (needs `@tailwindcss/vite` in the vite
236
- plugins — deploy added the dep). Routes: `/plans` → your grid (`usePlans()` fetches client-side
237
- when no `initialPlans` is passed); `/plans/:slug` → fetch with `fetchPlanBySlug(slug)`
238
- client-side, then your detail surface (null → your not-found state). Deploy wrote the public
239
- client id into `wix/config.ts`; nothing else to configure.
240
-
241
- Routes on Wix hosting: the host serves files only, so a clean route answers 404 when loaded directly — hash routes, or one HTML file per route, decided before the first route is written; any URL handed to Wix as a return target must be one the host serves (SKILL.md step 1).
242
-
243
- ## Hard rules
244
-
245
- - **Purchase only through the shipped exports** — `SubscribeButton` / `usePlanPurchase` /
246
- `purchasePlan` own the hosted redirect session. Never hand-build a checkout URL, never call
247
- `orders.createOnlineOrder` (member-only, and it leaves payment unhandled), never mark
248
- anything paid.
249
- - **Purchasing is members-only, and that's fine as-is**: the hosted flow handles member
250
- login/signup, the order form, and payment, then returns to your site. Don't build a login
251
- gate in front of the CTA.
252
- - **No success theater.** Returning from checkout is NOT a success signal — `postFlowUrl` is
253
- hit on abandon too. Success arrives only at a `thankYouPageUrl` you pass, as
254
- `?planOrderId=<GUID>`; if you build a thank-you page, read that param — never fake a
255
- confirmation off the mere return.
256
- - **Prices are display-only.** `price`/`billing` come pre-formatted; never compute a charge,
257
- discount, or proration — Wix settles price, tax, and schedule at the hosted checkout.
258
- - **The CTA is the shipped `SubscribeButton`** — it alone decides to render (`buyable`) and what
259
- to say; a card never rebuilds that decision.
260
- - Don't wrap shipped calls in your own API routes — they run client-side by design.
261
- - Where the shipped components deploy (Astro, React): theme via the `@theme` tokens, and your
262
- markup uses Tailwind utilities on the same tokens — one design system across shipped and written
263
- code. No parallel theme files, no hardcoded palette values. Where they don't (`lib`, `static`, a
264
- port): style with whatever your stack does well, on one token set of your own.
265
- - Live data or an honest empty state — never mock plans, prices, or perks.
266
- - **Call every hook before any conditional return.** Hooks first, branches after.
267
-
268
- ## Out of scope (don't improvise these)
269
-
270
- Member-gated surfaces — a "my plans" page, the member's orders (`orders.memberListOrders`),
271
- cancel/pause flows, and booking a covered bookings service with a membership — require a
272
- logged-in member session this skill doesn't ship yet. Subscribers manage their plan through
273
- Wix's emails and hosted member flows. If the user asks for a member area, route to
274
- `wix-headless` (members recipes) rather than shipping code that returns nothing for visitors.
275
- Anything elevated (creating or editing plans) runs server-side per `references/shared/CUSTOM_OPERATIONS.md`.
276
-
277
- ## Point the user to their dashboard
278
-
279
- Hand the owner these links — `{siteId}` is `siteId` in `wix.config.json` (the deploy JSON prints it as
280
- `dashboardUrl`).
281
-
282
- | page | `https://manage.wix.com/dashboard/{siteId}/` + |
283
- |---|---|
284
- | Plans (purchases are a tab of this page) | `pricing-plans` |
285
- | Create a plan | `pricing-plans/new` |
286
- | Record a manual order | `pricing-plans/new-order` |
287
- | Settings | `pricing-plans/settings` |
288
-
289
- Editing a plan is reached from the list (no id path). Taking real payments needs a premium plan + a
290
- connected payment method — mention it.
291
-
292
- ## Seeding
293
-
294
- Per `seed/SEED.md` — plain-data `plan.json` into `seed-pricing-plans.mjs` from the project
295
- root. Seed a tier ladder that exercises the UI (a free tier, a monthly, a yearly or
296
- one-time; 3–4 perks each).
@@ -1,47 +0,0 @@
1
- // REFERENCE detail surface: price/billing block + perks + terms + the shipped SubscribeButton, on
2
- // the @theme tokens. Correct and complete; per the skill's model you design and build your own
3
- // (the plan itself arrives as an SSR-fetched DTO prop; the purchase control is SubscribeButton).
4
- import SubscribeButton from "./SubscribeButton";
5
- import type { PlanDetail } from "../../wix/pricing-plans/types";
6
-
7
- export default function PlanDetailView({ plan }: { plan: PlanDetail }) {
8
- return (
9
- <div>
10
- <p>
11
- <span className="text-4xl font-bold tracking-tight text-foreground">{plan.price}</span>
12
- {plan.billing && <span className="ml-2 text-muted-foreground">{plan.billing}</span>}
13
- </p>
14
- {plan.freeTrialDays !== null && (
15
- <p className="mt-1 text-sm text-muted-foreground">{plan.freeTrialDays}-day free trial</p>
16
- )}
17
-
18
- {plan.perks.length > 0 && (
19
- <ul className="mt-6 space-y-2.5">
20
- {plan.perks.map((perk) => (
21
- <li key={perk} className="flex gap-2 text-sm text-foreground">
22
- <span className="text-muted-foreground" aria-hidden="true">
23
- ✓
24
- </span>
25
- <span>{perk}</span>
26
- </li>
27
- ))}
28
- </ul>
29
- )}
30
-
31
- <div className="mt-6">
32
- <SubscribeButton plan={plan} className="rounded-full bg-primary px-8 py-3 text-sm font-semibold text-primary-foreground transition-opacity hover:opacity-90 disabled:opacity-50">
33
- {plan.free ? "Get this plan" : `Subscribe · ${plan.price}`}
34
- </SubscribeButton>
35
- </div>
36
-
37
- {plan.termsAndConditions && (
38
- <div className="mt-10 border-t border-border pt-5">
39
- <p className="eyebrow">Terms &amp; conditions</p>
40
- <p className="mt-2 whitespace-pre-wrap text-sm leading-relaxed text-muted-foreground">
41
- {plan.termsAndConditions}
42
- </p>
43
- </div>
44
- )}
45
- </div>
46
- );
47
- }
@@ -1,101 +0,0 @@
1
- // REFERENCE pricing surface: plan cards in a grid on the @theme tokens. Correct and
2
- // complete; per the skill's model you design and build your own on usePlans, with the shipped
3
- // SubscribeButton as each card's purchase control.
4
- import type { ComponentType, ReactNode } from "react";
5
- import { usePlans } from "../../hooks/pricing-plans/usePlans";
6
- import SubscribeButton from "./SubscribeButton";
7
- import type { PlanSummary } from "../../wix/pricing-plans/types";
8
-
9
- export interface LinkLikeProps {
10
- href: string;
11
- className?: string;
12
- children?: ReactNode;
13
- }
14
-
15
- const PlainLink = ({ href, className, children }: LinkLikeProps) => (
16
- <a href={href} className={className}>
17
- {children}
18
- </a>
19
- );
20
-
21
- export interface PlanCardProps {
22
- plan: PlanSummary;
23
- planHref?: (slug: string) => string;
24
- LinkComponent?: ComponentType<LinkLikeProps>;
25
- }
26
-
27
- export function PlanCard({ plan, planHref = (slug) => `/plans/${slug}`, LinkComponent = PlainLink }: PlanCardProps) {
28
- return (
29
- <div className="flex h-full flex-col rounded-lg border border-border bg-background p-6">
30
- <p className="text-base font-semibold text-foreground">{plan.name}</p>
31
- {plan.description && <p className="mt-1 text-sm text-muted-foreground">{plan.description}</p>}
32
- <p className="mt-4">
33
- <span className="text-3xl font-bold tracking-tight text-foreground">{plan.price}</span>
34
- {plan.billing && <span className="ml-1.5 text-sm text-muted-foreground">{plan.billing}</span>}
35
- </p>
36
- {plan.freeTrialDays !== null && (
37
- <p className="mt-1 text-xs font-medium text-muted-foreground">{plan.freeTrialDays}-day free trial</p>
38
- )}
39
- {plan.perks.length > 0 && (
40
- <ul className="mt-4 space-y-2">
41
- {plan.perks.map((perk) => (
42
- <li key={perk} className="flex gap-2 text-sm text-foreground">
43
- <span className="text-muted-foreground" aria-hidden="true">
44
- ✓
45
- </span>
46
- <span>{perk}</span>
47
- </li>
48
- ))}
49
- </ul>
50
- )}
51
- <div className="mt-auto grid gap-2 pt-6">
52
- <SubscribeButton plan={plan} assignedText={null} />
53
- <LinkComponent
54
- href={planHref(plan.slug)}
55
- className="rounded-full border border-border px-6 py-2.5 text-center text-sm font-semibold text-foreground no-underline transition-colors hover:bg-secondary"
56
- >
57
- View details
58
- </LinkComponent>
59
- </div>
60
- </div>
61
- );
62
- }
63
-
64
- export interface PlansViewProps {
65
- initialPlans?: PlanSummary[];
66
- emptyMessage?: string;
67
- planHref?: PlanCardProps["planHref"];
68
- LinkComponent?: ComponentType<LinkLikeProps>;
69
- CardComponent?: ComponentType<PlanCardProps>;
70
- }
71
-
72
- export default function PlansView({
73
- initialPlans,
74
- emptyMessage = "No plans yet — check back soon.",
75
- planHref,
76
- LinkComponent,
77
- CardComponent = PlanCard,
78
- }: PlansViewProps) {
79
- const { plans, error } = usePlans({ initialPlans });
80
-
81
- return (
82
- <div>
83
- {error && <p className="mb-4 text-sm text-red-600">{error}</p>}
84
- {plans === null ? (
85
- <div className="grid grid-cols-1 gap-6 sm:grid-cols-2 lg:grid-cols-3" aria-busy="true">
86
- {Array.from({ length: 3 }, (_, i) => (
87
- <div key={i} className="h-80 animate-pulse rounded-lg bg-secondary" />
88
- ))}
89
- </div>
90
- ) : plans.length === 0 ? (
91
- <p className="py-16 text-center text-muted-foreground">{emptyMessage}</p>
92
- ) : (
93
- <div className="grid grid-cols-1 gap-6 sm:grid-cols-2 lg:grid-cols-3">
94
- {plans.map((p) => (
95
- <CardComponent key={p.id} plan={p} planHref={planHref} LinkComponent={LinkComponent} />
96
- ))}
97
- </div>
98
- )}
99
- </div>
100
- );
101
- }
@@ -1,41 +0,0 @@
1
- // The purchase control for one plan — wire as-is on every card, detail page, and home strip.
2
- // It owns the rules a CTA gets wrong when rewritten: rendered only for a `buyable` plan (a PUBLIC
3
- // plan can be merchant-assigned — `assignedText` shows instead, or nothing when null), the label
4
- // from the DTO ("Get this plan" for a free plan, "Subscribe" otherwise, your children override it),
5
- // "Redirecting…" while the hosted checkout is starting, the failure inline. The redirect itself is
6
- // usePlanPurchase → purchasePlan; nothing here builds a URL or marks anything paid.
7
- import type { ReactNode } from "react";
8
- import { usePlanPurchase } from "../../hooks/pricing-plans/usePlanPurchase";
9
- import type { PurchaseOptions } from "../../wix/pricing-plans/purchase";
10
- import type { PlanSummary } from "../../wix/pricing-plans/types";
11
-
12
- export interface SubscribeButtonProps {
13
- plan: PlanSummary;
14
- /** thankYouPageUrl / postFlowUrl for the hosted flow — see purchase.ts; omit for the defaults. */
15
- options?: PurchaseOptions;
16
- /** Replaces the default label ("Get this plan" / "Subscribe"). */
17
- children?: ReactNode;
18
- className?: string;
19
- /** Shown for a plan that isn't buyable; null renders nothing (a grid card). */
20
- assignedText?: string | null;
21
- }
22
-
23
- export default function SubscribeButton({
24
- plan,
25
- options,
26
- children,
27
- className = "rounded-full bg-primary px-6 py-2.5 text-sm font-semibold text-primary-foreground transition-opacity hover:opacity-90 disabled:opacity-50",
28
- assignedText = "This plan is assigned by the site owner.",
29
- }: SubscribeButtonProps) {
30
- const { purchase, purchasingId, error } = usePlanPurchase();
31
- if (!plan.buyable) return assignedText ? <p className="text-sm text-muted-foreground">{assignedText}</p> : null;
32
- const purchasing = purchasingId === plan.id;
33
- return (
34
- <div className="grid gap-2">
35
- <button type="button" disabled={purchasing} onClick={() => void purchase(plan.id, options).catch(() => {})} className={className}>
36
- {purchasing ? "Redirecting…" : children ?? (plan.free ? "Get this plan" : "Subscribe")}
37
- </button>
38
- {error && <p className="text-sm text-red-600" role="alert">{error}</p>}
39
- </div>
40
- );
41
- }
@@ -1,16 +0,0 @@
1
- // React binding of the purchase store (wix/pricing-plans/plan-purchase-store.ts) — the purchase
2
- // action for any surface (grid card, detail CTA, home strip). All correctness (the hosted redirect
3
- // session, member login/signup, payment) lives in the data layer; the store tracks in-flight state;
4
- // you own how it looks.
5
- import { useRef, useSyncExternalStore } from "react";
6
- import { createPlanPurchaseStore, type PlanPurchaseState, type PlanPurchaseStore } from "../../wix/pricing-plans/plan-purchase-store";
7
-
8
- export type UsePlanPurchase = PlanPurchaseState & Pick<PlanPurchaseStore, "purchase">;
9
-
10
- export function usePlanPurchase(): UsePlanPurchase {
11
- const ref = useRef<PlanPurchaseStore | null>(null);
12
- if (!ref.current) ref.current = createPlanPurchaseStore();
13
- const store = ref.current;
14
- const state = useSyncExternalStore(store.subscribe, store.getState, store.getState);
15
- return { ...state, purchase: store.purchase };
16
- }
@@ -1,22 +0,0 @@
1
- // React binding of the plans store (wix/pricing-plans/plans-store.ts) — the listing logic lives
2
- // there, framework-free; this hook subscribes to one instance per mounted listing. SSR-friendly:
3
- // pass server-fetched data as `initialPlans` (Astro frontmatter / server component) and no client
4
- // fetch happens; a SPA passes nothing. Astro islands and React SPAs use this; a static page, Vue,
5
- // or Svelte uses the store directly.
6
- import { useEffect, useRef, useSyncExternalStore } from "react";
7
- import { createPlansStore, type PlansState, type PlansStore, type PlansStoreOptions } from "../../wix/pricing-plans/plans-store";
8
-
9
- export type UsePlansOptions = PlansStoreOptions;
10
-
11
- export type UsePlans = PlansState;
12
-
13
- export function usePlans(options: UsePlansOptions = {}): UsePlans {
14
- const ref = useRef<PlansStore | null>(null);
15
- if (!ref.current) ref.current = createPlansStore(options);
16
- const store = ref.current;
17
- useEffect(() => {
18
- store.start();
19
- return () => store.stop();
20
- }, [store]);
21
- return useSyncExternalStore(store.subscribe, store.getState, store.getState);
22
- }
@@ -1,54 +0,0 @@
1
- // The purchase action as a framework-free store — the logic behind usePlanPurchase, usable from
2
- // React (usePlanPurchase wraps it), from a static page's card or detail CTA, from Vue/Svelte, or
3
- // as the specification for a port. All correctness (the hosted redirect session, member
4
- // login/signup, payment) lives in the data layer; this store tracks the in-flight plan and the
5
- // last failure, and navigates the FULL document to the hosted checkout.
6
- //
7
- // One store per purchase surface (a grid and a detail CTA each key their own spinner):
8
- // createPlanPurchaseStore(), not a singleton. No async work on mount, so no start/stop.
9
- import { purchasePlan, type PurchaseOptions } from "./purchase";
10
-
11
- export interface PlanPurchaseState {
12
- /** The plan id a purchase is in flight for (null when idle) — key CTA spinners off it. */
13
- purchasingId: string | null;
14
- /** The last failed purchase's visitor-facing message; a new purchase clears it. */
15
- error: string | null;
16
- }
17
-
18
- export interface PlanPurchaseStore {
19
- getState(): PlanPurchaseState;
20
- subscribe(listener: () => void): () => void;
21
- /**
22
- * Starts the hosted checkout — when it resolves the browser is already navigating away, and
23
- * `purchasingId` stays set. Rejects (and records `error`) otherwise — surface it, don't swallow it.
24
- */
25
- purchase(planId: string, options?: PurchaseOptions): Promise<void>;
26
- }
27
-
28
- export function createPlanPurchaseStore(): PlanPurchaseStore {
29
- let state: PlanPurchaseState = { purchasingId: null, error: null };
30
- const listeners = new Set<() => void>();
31
-
32
- function setState(patch: Partial<PlanPurchaseState>): void {
33
- state = { ...state, ...patch };
34
- for (const fn of listeners) fn();
35
- }
36
-
37
- return {
38
- getState: () => state,
39
- subscribe(fn) {
40
- listeners.add(fn);
41
- return () => listeners.delete(fn);
42
- },
43
- async purchase(planId, options) {
44
- setState({ purchasingId: planId, error: null });
45
- try {
46
- window.location.href = await purchasePlan(planId, options);
47
- // stays "purchasing" — the browser is leaving for the hosted checkout
48
- } catch (e) {
49
- setState({ purchasingId: null, error: e instanceof Error ? e.message : String(e) });
50
- throw e;
51
- }
52
- },
53
- };
54
- }