@wix/agent-skills 1.20.1 → 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 (262) hide show
  1. package/package.json +1 -1
  2. package/skills/wix-app/SKILL.md +71 -113
  3. package/skills/wix-app/references/APP_TOOLS.md +2 -1
  4. package/skills/wix-app/references/BACKEND_EVENT.md +3 -3
  5. package/skills/wix-app/references/CUSTOM_ELEMENT_WIDGET.md +41 -152
  6. package/skills/wix-app/references/DASHBOARD_MODAL.md +4 -4
  7. package/skills/wix-app/references/DASHBOARD_PAGE.md +11 -25
  8. package/skills/wix-app/references/DATA_COLLECTION.md +16 -219
  9. package/skills/wix-app/references/SDK_MODULE_MAP.md +44 -0
  10. package/skills/wix-app/references/SITE_PLUGIN.md +36 -190
  11. package/skills/wix-app/references/app-tools/TOOLS.md +3 -1
  12. package/skills/wix-app/references/custom-element-widget/SETTINGS_PANEL.md +21 -0
  13. package/skills/wix-app/references/dashboard-page/DATA_SOURCES.md +182 -0
  14. package/skills/wix-app/references/dashboard-page/DRAFT_TEMPLATE.md +97 -0
  15. package/skills/wix-app/references/dashboard-page/DRAFT_TEMPLATE_COLLECTION.md +184 -0
  16. package/skills/wix-app/references/dashboard-page/DRAFT_TEMPLATE_ROUTER.md +203 -0
  17. package/skills/wix-app/references/dashboard-page/DRAFT_TEMPLATE_SETTINGS.md +44 -0
  18. package/skills/wix-app/references/dashboard-page/ECOM_NAVIGATION.md +17 -0
  19. package/skills/wix-app/references/dashboard-page/QUERY_AND_PAGING.md +182 -0
  20. package/skills/wix-app/references/dashboard-page/TABLE_STATE.md +133 -0
  21. package/skills/wix-app/references/dashboard-page/UX_SUCCESS_MODEL.md +10 -5
  22. package/skills/wix-app/references/dashboard-plugin/SLOTS.md +4 -18
  23. package/skills/wix-app/references/data-collection/LIFECYCLE.md +68 -0
  24. package/skills/wix-app/references/data-collection/PERMISSIONS.md +47 -0
  25. package/skills/wix-app/references/data-collection/SCHEMA.md +181 -0
  26. package/skills/wix-app/references/data-collection/WIX_DATA.md +38 -66
  27. package/skills/wix-app/references/site-plugin/EXAMPLES.md +1 -1
  28. package/skills/wix-headless-fast/SKILL.md +144 -221
  29. package/skills/wix-headless-fast/cold-start/bootstrap.mjs +156 -0
  30. package/skills/wix-headless-fast/{entry/skill.md → cold-start/cold-start.md} +15 -15
  31. package/skills/wix-headless-fast/guides/existing-site.md +76 -0
  32. package/skills/wix-headless-fast/guides/reference-mode.md +97 -0
  33. package/skills/wix-headless-fast/install/AGENTS.md +35 -0
  34. package/skills/wix-headless-fast/install/agents-md.mjs +39 -0
  35. package/skills/wix-headless-fast/install/attach.mjs +161 -86
  36. package/skills/wix-headless-fast/install/deploy.mjs +21 -60
  37. package/skills/wix-headless-fast/install/lock.mjs +55 -0
  38. package/skills/wix-headless-fast/install/setup.mjs +259 -0
  39. package/skills/wix-headless-fast/install/templates.mjs +168 -0
  40. package/skills/wix-manage/references/ecommerce/pricing-promotions/ecom-pricing-create-coupon.md +10 -19
  41. package/skills/wix-manage/references/events/create-wix-event.md +5 -1
  42. package/skills/wix-manage/references/google-ads/google-ads-dashboard-navigation.md +27 -0
  43. package/skills/wix-manage/references/google-ads/manage-campaign-success-guide.md +83 -37
  44. package/skills/wix-headless-fast/install/fast-path.mjs +0 -181
  45. package/skills/wix-headless-fast/references/blog/INSTRUCTIONS.md +0 -301
  46. package/skills/wix-headless-fast/references/blog/app/components/blog/BlogFeedView.tsx +0 -136
  47. package/skills/wix-headless-fast/references/blog/app/components/blog/PostView.tsx +0 -112
  48. package/skills/wix-headless-fast/references/blog/app/components/blog/RichContent.tsx +0 -42
  49. package/skills/wix-headless-fast/references/blog/app/hooks/blog/useBlogFeed.ts +0 -31
  50. package/skills/wix-headless-fast/references/blog/app/hooks/blog/usePost.ts +0 -22
  51. package/skills/wix-headless-fast/references/blog/app/wix/blog/blog-feed-store.ts +0 -137
  52. package/skills/wix-headless-fast/references/blog/app/wix/blog/post-store.ts +0 -78
  53. package/skills/wix-headless-fast/references/blog/app/wix/blog/posts-core.ts +0 -117
  54. package/skills/wix-headless-fast/references/blog/app/wix/blog/posts.ts +0 -52
  55. package/skills/wix-headless-fast/references/blog/app/wix/blog/taxonomy-core.ts +0 -47
  56. package/skills/wix-headless-fast/references/blog/app/wix/blog/taxonomy.ts +0 -58
  57. package/skills/wix-headless-fast/references/blog/app/wix/blog/types.ts +0 -62
  58. package/skills/wix-headless-fast/references/blog/app-astro/layouts/SiteLayout.astro +0 -40
  59. package/skills/wix-headless-fast/references/blog/app-astro/pages/blog/[...slug].astro +0 -97
  60. package/skills/wix-headless-fast/references/blog/app-astro/pages/blog.astro +0 -24
  61. package/skills/wix-headless-fast/references/blog/lock/astro/package-lock.json +0 -16156
  62. package/skills/wix-headless-fast/references/blog/rest/posts.ts +0 -42
  63. package/skills/wix-headless-fast/references/blog/rest/taxonomy.ts +0 -62
  64. package/skills/wix-headless-fast/references/blog/seed/SEED.md +0 -81
  65. package/skills/wix-headless-fast/references/blog/seed/seed-blog.mjs +0 -287
  66. package/skills/wix-headless-fast/references/bookings/INSTRUCTIONS.md +0 -275
  67. package/skills/wix-headless-fast/references/bookings/app/components/bookings/ServiceBookingView.tsx +0 -144
  68. package/skills/wix-headless-fast/references/bookings/app/components/bookings/ServicesView.tsx +0 -119
  69. package/skills/wix-headless-fast/references/bookings/app/hooks/bookings/useBookingFlow.ts +0 -32
  70. package/skills/wix-headless-fast/references/bookings/app/hooks/bookings/useServices.ts +0 -23
  71. package/skills/wix-headless-fast/references/bookings/app/wix/bookings/booking-core.ts +0 -218
  72. package/skills/wix-headless-fast/references/bookings/app/wix/bookings/booking-flow-store.ts +0 -169
  73. package/skills/wix-headless-fast/references/bookings/app/wix/bookings/booking.ts +0 -121
  74. package/skills/wix-headless-fast/references/bookings/app/wix/bookings/services-core.ts +0 -92
  75. package/skills/wix-headless-fast/references/bookings/app/wix/bookings/services-store.ts +0 -90
  76. package/skills/wix-headless-fast/references/bookings/app/wix/bookings/services.ts +0 -57
  77. package/skills/wix-headless-fast/references/bookings/app/wix/bookings/types.ts +0 -72
  78. package/skills/wix-headless-fast/references/bookings/app-astro/layouts/SiteLayout.astro +0 -40
  79. package/skills/wix-headless-fast/references/bookings/app-astro/pages/services/[slug].astro +0 -76
  80. package/skills/wix-headless-fast/references/bookings/app-astro/pages/services.astro +0 -22
  81. package/skills/wix-headless-fast/references/bookings/lock/astro/package-lock.json +0 -11962
  82. package/skills/wix-headless-fast/references/bookings/rest/booking.ts +0 -113
  83. package/skills/wix-headless-fast/references/bookings/rest/services.ts +0 -55
  84. package/skills/wix-headless-fast/references/bookings/seed/SEED.md +0 -71
  85. package/skills/wix-headless-fast/references/bookings/seed/seed-bookings.mjs +0 -302
  86. package/skills/wix-headless-fast/references/cms/INSTRUCTIONS.md +0 -353
  87. package/skills/wix-headless-fast/references/cms/app/hooks/cms/useCollection.ts +0 -50
  88. package/skills/wix-headless-fast/references/cms/app/hooks/cms/useItem.ts +0 -37
  89. package/skills/wix-headless-fast/references/cms/app/wix/cms/collection-store.ts +0 -158
  90. package/skills/wix-headless-fast/references/cms/app/wix/cms/item-store.ts +0 -93
  91. package/skills/wix-headless-fast/references/cms/app/wix/cms/items-core.ts +0 -177
  92. package/skills/wix-headless-fast/references/cms/app/wix/cms/items.ts +0 -123
  93. package/skills/wix-headless-fast/references/cms/app/wix/cms/types.ts +0 -75
  94. package/skills/wix-headless-fast/references/cms/app-astro/layouts/SiteLayout.astro +0 -41
  95. package/skills/wix-headless-fast/references/cms/lock/astro/package-lock.json +0 -11262
  96. package/skills/wix-headless-fast/references/cms/rest/items.ts +0 -125
  97. package/skills/wix-headless-fast/references/cms/seed/SEED.md +0 -112
  98. package/skills/wix-headless-fast/references/cms/seed/seed-cms.mjs +0 -324
  99. package/skills/wix-headless-fast/references/events/INSTRUCTIONS.md +0 -305
  100. package/skills/wix-headless-fast/references/events/app/components/events/EventConfirmationView.tsx +0 -66
  101. package/skills/wix-headless-fast/references/events/app/components/events/EventRegistrationView.tsx +0 -178
  102. package/skills/wix-headless-fast/references/events/app/components/events/EventsView.tsx +0 -118
  103. package/skills/wix-headless-fast/references/events/app/hooks/events/useEventRegistration.ts +0 -35
  104. package/skills/wix-headless-fast/references/events/app/hooks/events/useEvents.ts +0 -24
  105. package/skills/wix-headless-fast/references/events/app/wix/events/events-core.ts +0 -130
  106. package/skills/wix-headless-fast/references/events/app/wix/events/events-store.ts +0 -97
  107. package/skills/wix-headless-fast/references/events/app/wix/events/events.ts +0 -55
  108. package/skills/wix-headless-fast/references/events/app/wix/events/registration-core.ts +0 -113
  109. package/skills/wix-headless-fast/references/events/app/wix/events/registration-store.ts +0 -156
  110. package/skills/wix-headless-fast/references/events/app/wix/events/registration.ts +0 -97
  111. package/skills/wix-headless-fast/references/events/app/wix/events/types.ts +0 -61
  112. package/skills/wix-headless-fast/references/events/app-astro/layouts/SiteLayout.astro +0 -40
  113. package/skills/wix-headless-fast/references/events/app-astro/pages/event-confirmation.astro +0 -12
  114. package/skills/wix-headless-fast/references/events/app-astro/pages/events/[slug].astro +0 -80
  115. package/skills/wix-headless-fast/references/events/app-astro/pages/events.astro +0 -21
  116. package/skills/wix-headless-fast/references/events/lock/astro/package-lock.json +0 -11884
  117. package/skills/wix-headless-fast/references/events/rest/events.ts +0 -57
  118. package/skills/wix-headless-fast/references/events/rest/registration.ts +0 -83
  119. package/skills/wix-headless-fast/references/events/seed/SEED.md +0 -95
  120. package/skills/wix-headless-fast/references/events/seed/seed-events.mjs +0 -276
  121. package/skills/wix-headless-fast/references/forms/INSTRUCTIONS.md +0 -338
  122. package/skills/wix-headless-fast/references/forms/app/hooks/forms/useWixForm.ts +0 -85
  123. package/skills/wix-headless-fast/references/forms/app/wix/forms/form-store.ts +0 -332
  124. package/skills/wix-headless-fast/references/forms/app/wix/forms/forms-core.ts +0 -238
  125. package/skills/wix-headless-fast/references/forms/app/wix/forms/forms.ts +0 -54
  126. package/skills/wix-headless-fast/references/forms/app/wix/forms/submissions-core.ts +0 -216
  127. package/skills/wix-headless-fast/references/forms/app/wix/forms/submissions.ts +0 -59
  128. package/skills/wix-headless-fast/references/forms/app/wix/forms/types.ts +0 -135
  129. package/skills/wix-headless-fast/references/forms/lock/astro/package-lock.json +0 -10593
  130. package/skills/wix-headless-fast/references/forms/rest/forms.ts +0 -34
  131. package/skills/wix-headless-fast/references/forms/rest/submissions.ts +0 -56
  132. package/skills/wix-headless-fast/references/forms/seed/SEED.md +0 -116
  133. package/skills/wix-headless-fast/references/forms/seed/seed-forms.mjs +0 -327
  134. package/skills/wix-headless-fast/references/members/INSTRUCTIONS.md +0 -314
  135. package/skills/wix-headless-fast/references/members/app/components/members/AccountView.tsx +0 -60
  136. package/skills/wix-headless-fast/references/members/app/components/members/LoginForm.tsx +0 -155
  137. package/skills/wix-headless-fast/references/members/app/components/members/MemberMenu.tsx +0 -78
  138. package/skills/wix-headless-fast/references/members/app/components/members/RequireAuth.tsx +0 -47
  139. package/skills/wix-headless-fast/references/members/app/hooks/members/useMember.ts +0 -66
  140. package/skills/wix-headless-fast/references/members/app/wix/members/auth-core.ts +0 -105
  141. package/skills/wix-headless-fast/references/members/app/wix/members/auth.ts +0 -59
  142. package/skills/wix-headless-fast/references/members/app/wix/members/client.ts +0 -53
  143. package/skills/wix-headless-fast/references/members/app/wix/members/member-store.ts +0 -122
  144. package/skills/wix-headless-fast/references/members/app/wix/members/members-core.ts +0 -43
  145. package/skills/wix-headless-fast/references/members/app/wix/members/members.ts +0 -29
  146. package/skills/wix-headless-fast/references/members/app/wix/members/types.ts +0 -21
  147. package/skills/wix-headless-fast/references/members/app-astro/layouts/SiteLayout.astro +0 -42
  148. package/skills/wix-headless-fast/references/members/app-astro/pages/account.astro +0 -10
  149. package/skills/wix-headless-fast/references/members/app-astro/pages/login.astro +0 -11
  150. package/skills/wix-headless-fast/references/members/lock/astro/package-lock.json +0 -10329
  151. package/skills/wix-headless-fast/references/members/rest/auth.ts +0 -215
  152. package/skills/wix-headless-fast/references/members/rest/members.ts +0 -26
  153. package/skills/wix-headless-fast/references/members/seed/SEED.md +0 -39
  154. package/skills/wix-headless-fast/references/members/seed/seed-members.mjs +0 -94
  155. package/skills/wix-headless-fast/references/portfolio/INSTRUCTIONS.md +0 -313
  156. package/skills/wix-headless-fast/references/portfolio/app/components/portfolio/CollectionProjectsView.tsx +0 -110
  157. package/skills/wix-headless-fast/references/portfolio/app/components/portfolio/CollectionsView.tsx +0 -90
  158. package/skills/wix-headless-fast/references/portfolio/app/components/portfolio/GalleryMedia.tsx +0 -35
  159. package/skills/wix-headless-fast/references/portfolio/app/components/portfolio/ProjectDetailView.tsx +0 -85
  160. package/skills/wix-headless-fast/references/portfolio/app/hooks/portfolio/useCollectionProjects.ts +0 -32
  161. package/skills/wix-headless-fast/references/portfolio/app/hooks/portfolio/useCollections.ts +0 -21
  162. package/skills/wix-headless-fast/references/portfolio/app/hooks/portfolio/useProjectDetail.ts +0 -31
  163. package/skills/wix-headless-fast/references/portfolio/app/wix/portfolio/collection-projects-store.ts +0 -82
  164. package/skills/wix-headless-fast/references/portfolio/app/wix/portfolio/collections-store.ts +0 -58
  165. package/skills/wix-headless-fast/references/portfolio/app/wix/portfolio/portfolio-core.ts +0 -177
  166. package/skills/wix-headless-fast/references/portfolio/app/wix/portfolio/portfolio.ts +0 -78
  167. package/skills/wix-headless-fast/references/portfolio/app/wix/portfolio/project-detail-store.ts +0 -81
  168. package/skills/wix-headless-fast/references/portfolio/app/wix/portfolio/types.ts +0 -55
  169. package/skills/wix-headless-fast/references/portfolio/app-astro/layouts/SiteLayout.astro +0 -40
  170. package/skills/wix-headless-fast/references/portfolio/app-astro/pages/portfolio/[slug].astro +0 -30
  171. package/skills/wix-headless-fast/references/portfolio/app-astro/pages/portfolio.astro +0 -21
  172. package/skills/wix-headless-fast/references/portfolio/app-astro/pages/projects/[slug].astro +0 -29
  173. package/skills/wix-headless-fast/references/portfolio/lock/astro/package-lock.json +0 -10197
  174. package/skills/wix-headless-fast/references/portfolio/rest/portfolio.ts +0 -75
  175. package/skills/wix-headless-fast/references/portfolio/seed/SEED.md +0 -86
  176. package/skills/wix-headless-fast/references/portfolio/seed/seed-portfolio.mjs +0 -258
  177. package/skills/wix-headless-fast/references/pricing-plans/INSTRUCTIONS.md +0 -294
  178. package/skills/wix-headless-fast/references/pricing-plans/app/components/pricing-plans/PlanDetailView.tsx +0 -47
  179. package/skills/wix-headless-fast/references/pricing-plans/app/components/pricing-plans/PlansView.tsx +0 -101
  180. package/skills/wix-headless-fast/references/pricing-plans/app/components/pricing-plans/SubscribeButton.tsx +0 -41
  181. package/skills/wix-headless-fast/references/pricing-plans/app/hooks/pricing-plans/usePlanPurchase.ts +0 -16
  182. package/skills/wix-headless-fast/references/pricing-plans/app/hooks/pricing-plans/usePlans.ts +0 -22
  183. package/skills/wix-headless-fast/references/pricing-plans/app/wix/pricing-plans/plan-purchase-store.ts +0 -54
  184. package/skills/wix-headless-fast/references/pricing-plans/app/wix/pricing-plans/plans-core.ts +0 -106
  185. package/skills/wix-headless-fast/references/pricing-plans/app/wix/pricing-plans/plans-store.ts +0 -64
  186. package/skills/wix-headless-fast/references/pricing-plans/app/wix/pricing-plans/plans.ts +0 -27
  187. package/skills/wix-headless-fast/references/pricing-plans/app/wix/pricing-plans/purchase-core.ts +0 -43
  188. package/skills/wix-headless-fast/references/pricing-plans/app/wix/pricing-plans/purchase.ts +0 -22
  189. package/skills/wix-headless-fast/references/pricing-plans/app/wix/pricing-plans/types.ts +0 -30
  190. package/skills/wix-headless-fast/references/pricing-plans/app-astro/layouts/SiteLayout.astro +0 -41
  191. package/skills/wix-headless-fast/references/pricing-plans/app-astro/pages/plans/[slug].astro +0 -40
  192. package/skills/wix-headless-fast/references/pricing-plans/app-astro/pages/plans.astro +0 -21
  193. package/skills/wix-headless-fast/references/pricing-plans/lock/astro/package-lock.json +0 -11226
  194. package/skills/wix-headless-fast/references/pricing-plans/rest/plans.ts +0 -31
  195. package/skills/wix-headless-fast/references/pricing-plans/rest/purchase.ts +0 -20
  196. package/skills/wix-headless-fast/references/pricing-plans/seed/SEED.md +0 -79
  197. package/skills/wix-headless-fast/references/pricing-plans/seed/seed-pricing-plans.mjs +0 -279
  198. package/skills/wix-headless-fast/references/restaurants/INSTRUCTIONS.md +0 -358
  199. package/skills/wix-headless-fast/references/restaurants/app/components/restaurants/MenuView.tsx +0 -142
  200. package/skills/wix-headless-fast/references/restaurants/app/components/restaurants/OrderCartButton.tsx +0 -26
  201. package/skills/wix-headless-fast/references/restaurants/app/components/restaurants/OrderCartDrawer.tsx +0 -121
  202. package/skills/wix-headless-fast/references/restaurants/app/components/restaurants/ReservationView.tsx +0 -155
  203. package/skills/wix-headless-fast/references/restaurants/app/hooks/restaurants/useMenus.ts +0 -34
  204. package/skills/wix-headless-fast/references/restaurants/app/hooks/restaurants/useOrderCart.ts +0 -43
  205. package/skills/wix-headless-fast/references/restaurants/app/hooks/restaurants/useReservation.ts +0 -34
  206. package/skills/wix-headless-fast/references/restaurants/app/wix/restaurants/menu-core.ts +0 -155
  207. package/skills/wix-headless-fast/references/restaurants/app/wix/restaurants/menu-store.ts +0 -89
  208. package/skills/wix-headless-fast/references/restaurants/app/wix/restaurants/menu.ts +0 -71
  209. package/skills/wix-headless-fast/references/restaurants/app/wix/restaurants/order-store.ts +0 -103
  210. package/skills/wix-headless-fast/references/restaurants/app/wix/restaurants/ordering-core.ts +0 -124
  211. package/skills/wix-headless-fast/references/restaurants/app/wix/restaurants/ordering.ts +0 -185
  212. package/skills/wix-headless-fast/references/restaurants/app/wix/restaurants/reservation-store.ts +0 -193
  213. package/skills/wix-headless-fast/references/restaurants/app/wix/restaurants/reservations-core.ts +0 -94
  214. package/skills/wix-headless-fast/references/restaurants/app/wix/restaurants/reservations.ts +0 -74
  215. package/skills/wix-headless-fast/references/restaurants/app/wix/restaurants/types.ts +0 -168
  216. package/skills/wix-headless-fast/references/restaurants/app-astro/layouts/SiteLayout.astro +0 -47
  217. package/skills/wix-headless-fast/references/restaurants/app-astro/pages/menu.astro +0 -22
  218. package/skills/wix-headless-fast/references/restaurants/app-astro/pages/reservations.astro +0 -12
  219. package/skills/wix-headless-fast/references/restaurants/lock/astro/package-lock.json +0 -12560
  220. package/skills/wix-headless-fast/references/restaurants/rest/menu.ts +0 -60
  221. package/skills/wix-headless-fast/references/restaurants/rest/ordering.ts +0 -169
  222. package/skills/wix-headless-fast/references/restaurants/rest/reservations.ts +0 -68
  223. package/skills/wix-headless-fast/references/restaurants/seed/SEED.md +0 -89
  224. package/skills/wix-headless-fast/references/restaurants/seed/seed-restaurants.mjs +0 -479
  225. package/skills/wix-headless-fast/references/shared/CONTENT.md +0 -22
  226. package/skills/wix-headless-fast/references/shared/CUSTOM_OPERATIONS.md +0 -73
  227. package/skills/wix-headless-fast/references/shared/DESIGN.md +0 -26
  228. package/skills/wix-headless-fast/references/shared/SUPPLIED-CONTENT.md +0 -23
  229. package/skills/wix-headless-fast/references/shared/app/styles/global.css +0 -52
  230. package/skills/wix-headless-fast/references/shared/app/wix/config.ts +0 -15
  231. package/skills/wix-headless-fast/references/shared/app/wix/media.ts +0 -81
  232. package/skills/wix-headless-fast/references/shared/app/wix/money.ts +0 -24
  233. package/skills/wix-headless-fast/references/shared/app/wix/sdk.ts +0 -89
  234. package/skills/wix-headless-fast/references/shared/capabilities/media-upload/app/wix/media-upload/client.ts +0 -46
  235. package/skills/wix-headless-fast/references/shared/capabilities/media-upload/app-astro/pages/api/wix/media-upload.ts +0 -46
  236. package/skills/wix-headless-fast/references/shared/rest/client.ts +0 -155
  237. package/skills/wix-headless-fast/references/shared/rest/config.ts +0 -3
  238. package/skills/wix-headless-fast/references/shared/rest/media.ts +0 -65
  239. package/skills/wix-headless-fast/references/shared/seed/images.mjs +0 -145
  240. package/skills/wix-headless-fast/references/storefront/INSTRUCTIONS.md +0 -608
  241. package/skills/wix-headless-fast/references/storefront/app/components/storefront/CartButton.tsx +0 -26
  242. package/skills/wix-headless-fast/references/storefront/app/components/storefront/CartDrawer.tsx +0 -155
  243. package/skills/wix-headless-fast/references/storefront/app/components/storefront/FilterPanel.tsx +0 -266
  244. package/skills/wix-headless-fast/references/storefront/app/components/storefront/OptionPicker.tsx +0 -95
  245. package/skills/wix-headless-fast/references/storefront/app/components/storefront/QuickAdd.tsx +0 -136
  246. package/skills/wix-headless-fast/references/storefront/app/hooks/storefront/useCart.ts +0 -48
  247. package/skills/wix-headless-fast/references/storefront/app/hooks/storefront/useProductDetail.ts +0 -39
  248. package/skills/wix-headless-fast/references/storefront/app/hooks/storefront/useShop.ts +0 -34
  249. package/skills/wix-headless-fast/references/storefront/app/wix/storefront/cart-core.ts +0 -121
  250. package/skills/wix-headless-fast/references/storefront/app/wix/storefront/cart-store.ts +0 -107
  251. package/skills/wix-headless-fast/references/storefront/app/wix/storefront/cart.ts +0 -138
  252. package/skills/wix-headless-fast/references/storefront/app/wix/storefront/catalog-core.ts +0 -309
  253. package/skills/wix-headless-fast/references/storefront/app/wix/storefront/catalog.ts +0 -133
  254. package/skills/wix-headless-fast/references/storefront/app/wix/storefront/product-detail-store.ts +0 -147
  255. package/skills/wix-headless-fast/references/storefront/app/wix/storefront/shop-store.ts +0 -289
  256. package/skills/wix-headless-fast/references/storefront/app/wix/storefront/types.ts +0 -167
  257. package/skills/wix-headless-fast/references/storefront/app-astro/layouts/SiteLayout.astro +0 -65
  258. package/skills/wix-headless-fast/references/storefront/lock/astro/package-lock.json +0 -12247
  259. package/skills/wix-headless-fast/references/storefront/rest/cart.ts +0 -132
  260. package/skills/wix-headless-fast/references/storefront/rest/catalog.ts +0 -123
  261. package/skills/wix-headless-fast/references/storefront/seed/SEED.md +0 -124
  262. package/skills/wix-headless-fast/references/storefront/seed/seed-store.mjs +0 -525
@@ -1,314 +0,0 @@
1
- # Members — playbook
2
-
3
- The account machinery ships as files — the custom credential login (sign in, sign up, email
4
- verification, owner approval, logout), the session store, the current-member read, typed
5
- end-to-end. Members sign up and sign in **on your site**, never on a Wix-hosted login page: the
6
- shipped client exchanges a credential login into member tokens, and on managed Astro writes them
7
- into the `wixSession` cookie so the next server render and every island run as that member.
8
- **The presentation doesn't ship — you build it** on the shipped hook/DTOs: the login page around
9
- the shipped form, the account page, the header control, and whatever the brief gates behind a
10
- login. You never write auth code; you never skip designing the surfaces.
11
-
12
- ## The file map (deployed into `src/`)
13
-
14
- **On Astro and React the shipped files are tested and work as they are** — this table and the
15
- contracts below are everything you need to use them, so don't spend the run reading their source;
16
- wire them and build your surfaces. Reading them is the right move when something is off (a runtime
17
- error, a field this playbook doesn't cover) or when the brief wants a behaviour they don't offer —
18
- then read the file that owns it and change or extend it. On `lib`, `static`, and a port the
19
- components don't deploy at all, and each wiring section below opens with the files to read before
20
- writing their equivalents. Files you edit: `SiteLayout.astro` and `styles/global.css`.
21
- Files you **create**: your home page, any gated page the brief asks for, and your own account
22
- surface if the reference one doesn't fit the brand.
23
-
24
- | file | what it is |
25
- |---|---|
26
- | `wix/config.ts` · `wix/sdk.ts` | shared auth seam (deploy configures it, `WIX_MEMBERS_CLIENT_ID` included — nothing to set by hand) |
27
- | `wix/media.ts` | `imgAttrs(url, sizes)` / `imgSrc()` — the member photo is already an https URL in the DTO |
28
- | `wix/members/types.ts` | the DTO (`CurrentMember`) — contract inlined below |
29
- | `wix/members/client.ts` | the one explicit `OAuthStrategy` client the credential flow needs; on Astro it stores member tokens in the `wixSession` cookie so ambient SDK calls run as the member |
30
- | `wix/members/auth.ts` | `loginMember`, `registerMember`, `verifyMemberEmail`, `logoutMember`, `loggedInHint` — the transport; what a response means (the four states, the error-code names) is in `auth-core.ts` beside it (shared with the REST layer) |
31
- | `wix/members/members.ts` | `fetchCurrentMember` — the transport; the DTO mapper is in `members-core.ts` beside it (shared with the REST layer) |
32
- | `wix/members/member-store.ts` | the session state machine, framework-free: one per visitor (a module singleton — it spans Astro islands, which a React context can't); `getMemberState`/`subscribeMember`, `login`, `register`, `verifyEmail`, `logout`, `refreshMember`, `hydrateMember`; the hook below binds it to React, every other stack uses it directly |
33
- | `hooks/members/useMember.ts` | React binding of `member-store.ts`: session state + the credential actions — contract below |
34
- | `components/members/LoginForm.tsx` | the credential form — sign in / sign up toggle, the verification-code step, the pending-approval notice, the inline error, `returnTo` — **wire as-is** on your login page |
35
- | `components/members/MemberMenu.tsx` | header control reference on the tokens: skeleton while loading, "Log in" for a visitor, name/avatar + "Log out" for a member — wire as-is or design your own on `useMember` |
36
- | `components/members/RequireAuth.tsx` | the gate for member-only surfaces: waits for the first session read, then children for a member, a login prompt with `returnTo` for a visitor — **wire as-is** around gated content |
37
- | `components/members/AccountView.tsx` | account surface reference: profile card + log out; design your own on `useMember` when the brand asks |
38
- | `styles/global.css` | **the design system**: Tailwind v4 + the `@theme` token block (colors, radii, fonts — same token family as the official Wix templates). Everything, shipped and yours, styles from these tokens |
39
-
40
- Astro stack additionally gets:
41
-
42
- | file | what it is |
43
- |---|---|
44
- | `layouts/SiteLayout.astro` | the site chrome — **yours to brand**: header, footer, nav. Keep the `<slot name="seo-tags" />`, the global.css import, and one `<MemberMenu client:only="react" />` in the header (if another vertical's layout won, mount `MemberMenu` in that header instead) |
45
- | `pages/login.astro` · `pages/account.astro` | the login and account routes — thin shells mounting `LoginForm` and `RequireAuth` + `AccountView` `client:only="react"`; brand the chrome around them, keep the mounts |
46
-
47
- ## What you build — this is the design job, not optional polish
48
-
49
- You implement the surfaces yourself, styled with Tailwind utilities on the `@theme` tokens,
50
- designed to fit the brief (a members-only club and a course platform should not get the same
51
- account area):
52
-
53
- 1. **The login page** — the chrome around the shipped `LoginForm` (`pages/login.astro`): heading,
54
- what membership gives, the brand. The form's four states already render; you own the page.
55
- 2. **The account page** — `pages/account.astro` mounts `RequireAuth` around `AccountView`; keep the
56
- gate, and replace `AccountView` with your own surface on `useMember` when the brief wants more
57
- than the profile card (orders, bookings, saved items — each from its own vertical's data layer).
58
- 3. **The header control** — the shipped `MemberMenu` or your own on `useMember`: it is the one
59
- surface every page shows, so it carries the brand.
60
- 4. **Gated content** the brief asks for — a page inside `RequireAuth`, or a member-only section on a
61
- public page rendered from `loggedIn`.
62
- 5. **The home page** — on `SiteLayout`, with the way in (log in / join) visible.
63
-
64
- Plus the **theme** (edit the `@theme` block in `styles/global.css` — one edit) and the **chrome**
65
- (header/footer in `SiteLayout.astro`, one edit pass).
66
-
67
- ### What a complete members site shows (recommended defaults)
68
-
69
- Defaults for a brief that says nothing about them; the prompt wins when it asks for something
70
- else. Then, by default:
71
-
72
- - **Header:** a skeleton while the session read settles, "Log in" for a visitor, the member's
73
- name or avatar plus "Log out" for a member — never a flash of "Log in" for someone who is in.
74
- - **Login page:** sign in and sign up on one page; email verification and owner approval rendered
75
- as states (a code field, a "pending approval" notice), a failed login as an inline message next
76
- to the form; `?returnTo=` honoured after success (the shipped form does all of this).
77
- - **Account page:** gated — a visitor sees the login prompt in place, a member their real profile
78
- (`displayName`, `loginEmail`, `memberSince`, photo when there is one); a logged-in member with
79
- `member === null` gets the one honest line ("profile details unavailable") — the Members Area app
80
- isn't installed, which the seed does.
81
- - **Logout:** returns to the page that offered it, or the home page.
82
- - **Copy:** nothing the owner didn't supply — no invented perks, member counts, or testimonials;
83
- no Wix IDs or technical words in visible text.
84
-
85
- ### The contracts your components consume (everything you need — don't read the source)
86
-
87
- ```ts
88
- // CurrentMember — display-ready:
89
- // { id, loginEmail /* "" when hidden */, displayName /* nickname → "first last" → email local part → "Member" */,
90
- // firstName, lastName, nickname, photoUrl /* https or "" */, contactId /* the key for member-owned content */,
91
- // memberSince /* "YYYY-MM-DD" or "" */ }
92
-
93
- // useMember({ initialMember? /* SSR-resolved member or null; omit to resolve client-side */ }) →
94
- // { member: CurrentMember|null, loggedIn, loading /* true until the first session read settles — skeletons, not the logged-out state */,
95
- // error /* last failed operation's message; a new operation clears it */,
96
- // login(email, password), register(email, password, { firstName?, lastName? }?), verifyEmail(code),
97
- // logout(returnTo?) /* navigates away */, refresh() }
98
- // loggedIn can be true with member === null: the caller is a member but the site has no Members Area app (profile layer).
99
- // Several islands on one page share one session — the store is a module singleton.
100
-
101
- // login / register / verifyEmail resolve to LoginResult:
102
- // { state: "SUCCESS" | "EMAIL_VERIFICATION_REQUIRED" | "OWNER_APPROVAL_REQUIRED" | "FAILURE",
103
- // errorCode? /* invalidPassword | invalidEmail | emailAlreadyExists | resetPassword | missingCaptchaToken | invalidCaptchaToken */,
104
- // error? /* Wix's message — render it */ }
105
- // SUCCESS has already refreshed the session: member and loggedIn are set when the promise resolves.
106
- // EMAIL_VERIFICATION_REQUIRED → show a code field and call verifyEmail(code); the state token is kept for you.
107
- // OWNER_APPROVAL_REQUIRED → a pending notice; the member logs in once the owner approves (dashboard).
108
- // Which of the three a sign-up ends in is the site's signup policy (dashboard), not your code.
109
- ```
110
-
111
- ### The pages — the shipped shells and a gated page
112
-
113
- Hooks first, branches after (an early return above a hook changes hook order between renders and
114
- React throws). Session-reading islands mount `client:only="react"` — they read browser state and
115
- must not server-render; a `client:load` gate would flash the logged-out state.
116
-
117
- ```astro
118
- ---
119
- // src/pages/login.astro — ships; brand the chrome, keep the mount.
120
- import SiteLayout from "../layouts/SiteLayout.astro";
121
- import LoginForm from "../components/members/LoginForm";
122
- ---
123
- <SiteLayout title="Log in">
124
- <section class="mx-auto max-w-md"> {/* one narrow column: the form is the page */}
125
- <h1 class="mb-6 text-2xl font-semibold">Welcome</h1>
126
- <LoginForm client:only="react" />
127
- </section>
128
- </SiteLayout>
129
- ```
130
-
131
- ```astro
132
- ---
133
- // src/pages/account.astro — ships; the gate stays, the surface inside is yours to replace.
134
- import SiteLayout from "../layouts/SiteLayout.astro";
135
- import AccountView from "../components/members/AccountView";
136
- import RequireAuth from "../components/members/RequireAuth";
137
- ---
138
- <SiteLayout title="My account">
139
- <h1 class="mb-8 text-2xl font-semibold tracking-tight">My account</h1>
140
- <RequireAuth client:only="react"><AccountView /></RequireAuth>
141
- </SiteLayout>
142
- ```
143
-
144
- ```tsx
145
- // src/components/members/MembersOnly.tsx — YOU create it when the brief gates content: a view over
146
- // useMember inside RequireAuth. The gate decides; the view renders the member's things.
147
- import RequireAuth from "./RequireAuth";
148
- import { useMember } from "../../hooks/members/useMember";
149
-
150
- function Inner() {
151
- const { member } = useMember();
152
- return <section>{/* your gated content; member?.displayName, member?.contactId for member-owned lookups */}</section>;
153
- }
154
- export default function MembersOnly() {
155
- return <RequireAuth><Inner /></RequireAuth>;
156
- }
157
- ```
158
-
159
- ### The reference files for stacks where the components don't deploy
160
-
161
- On `lib`, `static`, and a port, nothing under `components/` or `hooks/` arrives. The state machine
162
- behind the hook does arrive — `wix/members/member-store.ts` — so you never rewrite it: `subscribe`,
163
- render from `getMemberState()`, call its actions; `MemberState` is the render contract. What you
164
- write is the rendering — the form, the gate, the header control — and for that read these first;
165
- they are tested code for exactly that behaviour, and rewriting them from the prose above is where
166
- the bugs come from:
167
-
168
- 1. `components/members/LoginForm.tsx` — the four states as working code: the sign-in/sign-up
169
- toggle, the name fields only on sign-up, the verification-code step, the pending notice, the
170
- inline error, the button disabled while busy, `returnTo` after success (only a same-site path).
171
- 2. `components/members/RequireAuth.tsx` — wait for `loading` to settle before deciding (deciding
172
- early bounces a member on first paint); the visitor's prompt links to the login page with the
173
- current path as `returnTo`.
174
- 3. `components/members/MemberMenu.tsx` — the three renders (skeleton, "Log in", name/avatar +
175
- "Log out") and the avatar fallback (first letter of `displayName`).
176
-
177
- All under `references/members/app/`.
178
-
179
- ### Wiring — Astro (default)
180
-
181
- 1. Set the `@theme` tokens (one edit); brand `SiteLayout.astro` (one pass), keeping one
182
- `<MemberMenu client:only="react" />` in the header.
183
- 2. Keep `/login` and `/account` as shipped — the only login surface is `/login`; never link to
184
- `/api/auth/login`, build an OAuth callback page, or redirect to a Wix login page. Brand the
185
- chrome around the mounts; replace `AccountView` with your own surface on `useMember` when the
186
- brief wants more.
187
- 3. Gated content: `RequireAuth` around it, `client:only="react"`.
188
- 4. Write `pages/index.astro` (home) on `SiteLayout`.
189
-
190
- ### Wiring — another JS framework (`--stack lib`: Vue, Svelte, Solid, plain Vite)
191
-
192
- Read the reference files listed above before writing any surface.
193
-
194
- `deploy.mjs members --stack lib` put the data layer in `src/wix/` and nothing else: `sdk.ts`,
195
- `config.ts` (deploy wrote the public client id into both `WIX_CLIENT_ID` and
196
- `WIX_MEMBERS_CLIENT_ID`), `media.ts`, and `wix/members/` — `client.ts`, `auth.ts`, `members.ts`,
197
- `types.ts`, the `*-core.ts` rules, and `member-store.ts`. None of it is React. The hook and the
198
- components don't ship on this stack; the store replaces the hook, and you write the components in
199
- your framework to the contracts on this page:
200
-
201
- - bind the store with your framework's external-store primitive (Vue: `shallowRef` updated in
202
- `subscribeMember`; Svelte: `readable(getMemberState(), (set) => subscribeMember(() => set(getMemberState())))`;
203
- Solid: a signal set in `subscribeMember`). One store for the whole app (module-level); the first
204
- subscriber triggers the session read. State in, actions out — exactly `useMember`'s contract;
205
- - your login form, gate, and header control to the defaults above — `LoginForm.tsx`,
206
- `RequireAuth.tsx`, `MemberMenu.tsx` are readable as behaviour specs.
207
-
208
- Routes `/login`, `/account` (gated in the component, not the router — the session is browser
209
- state); dev server on 4321; a static build goes through `npx @wix/cli@latest release` with
210
- `site.outputDirectory` pointing at the build folder, an SSR build is hosted by you.
211
-
212
- ### Wiring — static site (`--stack static`, no bundler)
213
-
214
- Read the reference files listed above before writing any surface.
215
-
216
- `deploy.mjs members --stack static --out site` put the REST layer in `site/js/wix/` (browser ESM,
217
- the `.ts` beside each `.js` for reading). Everything the visitor loads lives under `site/` — pages,
218
- styles, `js/` — and `wix.config.json`'s `site.outputDirectory` is `"./site"`; the project root
219
- (config, seed output) is never the upload. Same function names and DTOs as the table above, so the
220
- contracts on this page hold unchanged: `loginMember`, `registerMember`, `verifyMemberEmail`,
221
- `logoutMember`, `loggedInHint` from `./js/wix/auth.js`; `fetchCurrentMember` from
222
- `./js/wix/members.js`. The state machine ships too: `./js/wix/member-store.js`
223
- (`subscribeMember` — the first subscriber triggers the session read — `getMemberState`, `login`,
224
- `register`, `verifyEmail`, `logout`, `refreshMember`). No components ship — you write the rendering
225
- in plain JS: one render function per surface that reads `getMemberState()`, called from
226
- `subscribeMember`, with the form's submit calling the store's actions and rendering the
227
- `LoginResult` state it resolves to. Pages are `login.html` (`?returnTo=` a same-site path) and
228
- `account.html`, gated in the page: `loading` → a skeleton, anonymous → a link to
229
- `login.html?returnTo=account.html`, a member → the profile. The header control is the same store
230
- on every page.
231
-
232
- How the session works here: the login runs over the IAM authentication API with the visitor token
233
- and exchanges the result into member tokens, which replace the visitor token in `localStorage`
234
- (`role: "member"`) — every later call runs as the member and the refresh keeps the member; never
235
- mint per page. The exchange completes in a hidden iframe on the page's own origin, so **the page's
236
- origin must be one of the OAuth app's allowed domains** (`localhost:4321` and the Wix-hosted origin
237
- already are; a custom domain is added in the dashboard's Headless Settings) — otherwise the login
238
- resolves nothing and times out with "Login timed out". Logout navigates to Wix and returns to the
239
- URL you pass (`logout("account.html")` resolves against the page). Gated pages carry no SEO — there
240
- is nothing to index. `npx @wix/cli@latest release` uploads `site/`.
241
-
242
- ### Wiring — server-rendered, another language (Flask, Laravel, Rails, …)
243
-
244
- Read the reference files listed above before writing any surface.
245
-
246
- Run `deploy.mjs members --stack static` in the project folder anyway: `js/wix/` is both the
247
- browser-side code and the readable spec. This vertical has no public reads — everything is the
248
- visitor's own state — so the whole flow runs **in the browser** from `./js/wix/` exactly as the
249
- static wiring above: the login form, the gate, the header control on `member-store.js`; the
250
- browser owns the member token, so the server handles no per-visitor tokens, and a member-only page
251
- is a page whose content renders once `getMemberState().loggedIn` is true. Add your public https
252
- origin to the OAuth app's allowed domains before the login can complete (the iframe exchange) and
253
- before logout can return.
254
-
255
- If the server itself must know the member (server-rendered member-only pages, member-owned data
256
- joined server-side), port `js/wix/auth.ts` and `auth-core.ts`: the same three calls — login with a
257
- visitor token, the redirect session, `POST /oauth2/token` with `grantType: "authorization_code"` —
258
- and the no-DOM branch of the exchange (fetch the authorize page, read `code` and `state` from it) is
259
- the server's path; or use the docs' full-page variant (`responseMode: "query"` plus a `redirectUri`
260
- on the allowed list). Then `client.ts`'s header applies: one token set per visitor in the visitor's
261
- session, never one process-wide token, and `GET /members/v1/members/my?fieldsets=FULL` with that
262
- token on each request (`members.ts` + `members-core.ts` as the port).
263
-
264
- ### Wiring — React SPA (Vite etc.)
265
-
266
- Import `./styles/global.css` once at the app entry (needs `@tailwindcss/vite` in the vite config
267
- plugins — deploy already added the dep). Write route wrappers in the project's router: `/login` →
268
- a page mounting `LoginForm` (pass `onSuccess` to navigate with your router, or let it use
269
- `?returnTo=`); `/account` → `RequireAuth` around your account surface; gated routes → the same.
270
- Mount `MemberMenu` in the header (pass `LinkComponent` for router links). Deploy wrote the public
271
- client id into `wix/config.ts` (`WIX_CLIENT_ID` and `WIX_MEMBERS_CLIENT_ID`); nothing else to
272
- configure.
273
-
274
- ## Hard rules
275
-
276
- - **No Wix-hosted login flow** — no `/api/auth/login`, no OAuth callback page, no callback URI for
277
- credential login. Password-reset emails and logout are the only redirect surfaces, and both
278
- return to a URL you pass.
279
- - **Auth only through the shipped exports** — `useMember` / the store's actions; never call the
280
- IAM API or the OAuth client yourself, never rewrite the exchange. Extend by adding a function in
281
- `wix/members/` for what they don't cover (API contracts: the `wix-docs` skill).
282
- - **One explicit members client** (`wix/members/client.ts`) — never instantiate another, never one
283
- per component.
284
- - **Session state only through the store** — no React context, no copy of `loggedIn` in component
285
- state, no identity inferred from local UI state.
286
- - **Every state is rendered**: a failed login shows `error` next to the form; verification and
287
- owner approval are states, not errors; `loading` is a skeleton, never the logged-out UI.
288
- - **Identity vs profile**: `loggedIn` needs no app install; `member` (profile data) needs the Wix
289
- Members Area app — the seed installs it. A member with `member === null` gets the honest line,
290
- not a fake profile.
291
- - **Gate only what the brief gates.** Public pages stay public; browsing never needs a login.
292
- - Don't use `auth.elevate()` for a member reading their own records — the member token is the
293
- right identity.
294
- - **Live data or an honest empty state** — never mock a member, a name, or a member count.
295
- - **The token is the session** — it persists on its own (cookie on Astro, `localStorage`
296
- elsewhere); never mint per page, never store credentials.
297
- - Where the shipped components deploy (Astro, React): theme via the `@theme` tokens, and your
298
- markup uses Tailwind utilities on the same tokens — one design system across shipped and written
299
- code. Where they don't (`lib`, `static`, a port): style with whatever your stack does well, on one
300
- token set of your own; the rule that survives is the token set, not Tailwind.
301
- - **Call every hook before any conditional return.** Hooks first, branches after.
302
-
303
- ## Point the user to their dashboard
304
-
305
- Give the owner the dashboard link — **the deploy step's JSON output already printed it**
306
- (`dashboardUrl`); copy, don't re-derive. Members are managed under Contacts → Site Members there,
307
- and the signup policy — email verification, owner approval, reCAPTCHA — is set under Settings →
308
- Member signup; it decides which state a sign-up ends in.
309
-
310
- ## Seeding
311
-
312
- Per `seed/SEED.md` — `seed-members.mjs`, run from the project root. It installs the Wix Members
313
- Area app (the profile layer) and nothing else: members self-register at runtime, never at build
314
- time. Independent of the frontend work.
@@ -1,60 +0,0 @@
1
- // REFERENCE account surface: profile card + log-out on the @theme tokens. Correct and
2
- // complete; per the skill's model you design your own on useMember. On Astro the page
3
- // passes the SSR-resolved member as initialMember; a SPA mounts it inside <RequireAuth>.
4
- import { useMember } from "../../hooks/members/useMember";
5
- import type { CurrentMember } from "../../wix/members/types";
6
-
7
- export interface AccountViewProps {
8
- initialMember?: CurrentMember | null;
9
- }
10
-
11
- export default function AccountView({ initialMember }: AccountViewProps) {
12
- const { member, loggedIn, loading, error, logout } = useMember({ initialMember });
13
-
14
- if (loading) {
15
- return (
16
- <div className="mx-auto max-w-md" aria-busy="true">
17
- <div className="h-40 animate-pulse rounded-lg bg-secondary" />
18
- </div>
19
- );
20
- }
21
-
22
- if (!loggedIn) {
23
- return <p className="py-16 text-center text-muted-foreground">You're logged out.</p>;
24
- }
25
-
26
- return (
27
- <div className="mx-auto max-w-md rounded-lg border border-border p-8">
28
- <div className="flex items-center gap-4">
29
- {member?.photoUrl ? (
30
- <img src={member.photoUrl} alt="" className="h-16 w-16 rounded-full object-cover" />
31
- ) : (
32
- <span className="flex h-16 w-16 items-center justify-center rounded-full bg-secondary text-xl font-semibold">
33
- {(member?.displayName ?? "M").slice(0, 1).toUpperCase()}
34
- </span>
35
- )}
36
- <div>
37
- <p className="text-lg font-semibold text-foreground">{member?.displayName ?? "Member"}</p>
38
- {member?.loginEmail && <p className="text-sm text-muted-foreground">{member.loginEmail}</p>}
39
- {member?.memberSince && (
40
- <p className="mt-0.5 text-xs text-muted-foreground">Member since {member.memberSince}</p>
41
- )}
42
- </div>
43
- </div>
44
- {!member && (
45
- <p className="mt-4 text-sm text-muted-foreground">
46
- Logged in, but profile details are unavailable — the Wix Members Area app isn't installed
47
- on this site.
48
- </p>
49
- )}
50
- {error && <p className="mt-4 text-sm text-red-600">{error}</p>}
51
- <button
52
- type="button"
53
- onClick={() => void logout()}
54
- className="mt-6 rounded-full border border-border px-5 py-2 text-sm font-medium text-foreground transition-colors hover:bg-secondary"
55
- >
56
- Log out
57
- </button>
58
- </div>
59
- );
60
- }
@@ -1,155 +0,0 @@
1
- // Shipped custom login form. The member stays on this site: credential calls exchange
2
- // directly into member tokens; only logout leaves the app.
3
- import { type FormEvent, useState } from "react";
4
- import { useMember } from "../../hooks/members/useMember";
5
-
6
- export interface LoginFormProps {
7
- onSuccess?: () => void;
8
- }
9
-
10
- export default function LoginForm({ onSuccess }: LoginFormProps) {
11
- const { login, register, verifyEmail, error } = useMember();
12
- const [mode, setMode] = useState<"login" | "register">("login");
13
- const [email, setEmail] = useState("");
14
- const [password, setPassword] = useState("");
15
- const [firstName, setFirstName] = useState("");
16
- const [lastName, setLastName] = useState("");
17
- const [code, setCode] = useState("");
18
- const [verification, setVerification] = useState(false);
19
- const [pending, setPending] = useState(false);
20
- const [busy, setBusy] = useState(false);
21
-
22
- function done() {
23
- if (onSuccess) return onSuccess();
24
- const returnTo = new URLSearchParams(window.location.search).get(
25
- "returnTo",
26
- );
27
- window.location.assign(returnTo?.startsWith("/") ? returnTo : "/account");
28
- }
29
-
30
- async function submit(event: FormEvent) {
31
- event.preventDefault();
32
- setBusy(true);
33
- try {
34
- const result =
35
- mode === "login"
36
- ? await login(email, password)
37
- : await register(email, password, { firstName, lastName });
38
- if (result.state === "SUCCESS") done();
39
- if (result.state === "EMAIL_VERIFICATION_REQUIRED") setVerification(true);
40
- if (result.state === "OWNER_APPROVAL_REQUIRED") setPending(true);
41
- } finally {
42
- setBusy(false);
43
- }
44
- }
45
-
46
- async function submitCode(event: FormEvent) {
47
- event.preventDefault();
48
- setBusy(true);
49
- try {
50
- const result = await verifyEmail(code);
51
- if (result.state === "SUCCESS") done();
52
- if (result.state === "OWNER_APPROVAL_REQUIRED") setPending(true);
53
- } finally {
54
- setBusy(false);
55
- }
56
- }
57
-
58
- if (pending)
59
- return (
60
- <p className="rounded-lg border border-border p-4 text-sm">
61
- Your account is awaiting approval.
62
- </p>
63
- );
64
- if (verification) {
65
- return (
66
- <form onSubmit={submitCode} className="space-y-4">
67
- <label className="block text-sm">
68
- Verification code
69
- <input
70
- required
71
- value={code}
72
- onChange={(event) => setCode(event.target.value)}
73
- className="mt-1 w-full rounded border border-border bg-background p-2"
74
- />
75
- </label>
76
- {error && <p className="text-sm text-red-600">{error}</p>}
77
- <button
78
- disabled={busy}
79
- className="rounded bg-primary px-4 py-2 text-primary-foreground"
80
- >
81
- {busy ? "Verifying…" : "Verify"}
82
- </button>
83
- </form>
84
- );
85
- }
86
- return (
87
- <form onSubmit={submit} className="space-y-4">
88
- <div className="flex gap-2">
89
- <button
90
- type="button"
91
- onClick={() => setMode("login")}
92
- className="text-sm underline"
93
- >
94
- Sign in
95
- </button>
96
- <button
97
- type="button"
98
- onClick={() => setMode("register")}
99
- className="text-sm underline"
100
- >
101
- Sign up
102
- </button>
103
- </div>
104
- {mode === "register" && (
105
- <div className="grid gap-3 sm:grid-cols-2">
106
- <label className="text-sm">
107
- First name
108
- <input
109
- value={firstName}
110
- onChange={(event) => setFirstName(event.target.value)}
111
- className="mt-1 w-full rounded border border-border bg-background p-2"
112
- />
113
- </label>
114
- <label className="text-sm">
115
- Last name
116
- <input
117
- value={lastName}
118
- onChange={(event) => setLastName(event.target.value)}
119
- className="mt-1 w-full rounded border border-border bg-background p-2"
120
- />
121
- </label>
122
- </div>
123
- )}
124
- <label className="block text-sm">
125
- Email
126
- <input
127
- required
128
- type="email"
129
- autoComplete="email"
130
- value={email}
131
- onChange={(event) => setEmail(event.target.value)}
132
- className="mt-1 w-full rounded border border-border bg-background p-2"
133
- />
134
- </label>
135
- <label className="block text-sm">
136
- Password
137
- <input
138
- required
139
- type="password"
140
- autoComplete={mode === "login" ? "current-password" : "new-password"}
141
- value={password}
142
- onChange={(event) => setPassword(event.target.value)}
143
- className="mt-1 w-full rounded border border-border bg-background p-2"
144
- />
145
- </label>
146
- {error && <p className="text-sm text-red-600">{error}</p>}
147
- <button
148
- disabled={busy}
149
- className="rounded bg-primary px-4 py-2 text-primary-foreground"
150
- >
151
- {busy ? "Working…" : mode === "login" ? "Sign in" : "Create account"}
152
- </button>
153
- </form>
154
- );
155
- }
@@ -1,78 +0,0 @@
1
- // REFERENCE header account control on the @theme tokens: "Log in" for a visitor; account
2
- // link + log-out for a member. Correct and complete; per the skill's model you design your
3
- // own on useMember. Mount client:only="react" — it reads browser session state.
4
- import type { ComponentType, ReactNode } from "react";
5
- import { useMember } from "../../hooks/members/useMember";
6
-
7
- export interface LinkLikeProps {
8
- href: string;
9
- className?: string;
10
- children?: ReactNode;
11
- }
12
-
13
- const PlainLink = ({ href, className, children }: LinkLikeProps) => (
14
- <a href={href} className={className}>
15
- {children}
16
- </a>
17
- );
18
-
19
- export interface MemberMenuProps {
20
- accountHref?: string;
21
- LinkComponent?: ComponentType<LinkLikeProps>;
22
- }
23
-
24
- export default function MemberMenu({
25
- accountHref = "/account",
26
- LinkComponent = PlainLink,
27
- }: MemberMenuProps) {
28
- const { member, loggedIn, loading, logout } = useMember();
29
-
30
- if (loading) {
31
- return (
32
- <span
33
- className="inline-block h-8 w-16 animate-pulse rounded-full bg-secondary"
34
- aria-hidden="true"
35
- />
36
- );
37
- }
38
-
39
- if (!loggedIn) {
40
- return (
41
- <a
42
- href="/login"
43
- className="rounded-full bg-primary px-4 py-1.5 text-sm font-medium text-primary-foreground transition-opacity hover:opacity-90"
44
- >
45
- Log in
46
- </a>
47
- );
48
- }
49
-
50
- return (
51
- <span className="flex items-center gap-3">
52
- <LinkComponent
53
- href={accountHref}
54
- className="flex items-center gap-2 text-sm font-medium text-foreground no-underline transition-colors hover:text-muted-foreground"
55
- >
56
- {member?.photoUrl ? (
57
- <img
58
- src={member.photoUrl}
59
- alt=""
60
- className="h-7 w-7 rounded-full object-cover"
61
- />
62
- ) : (
63
- <span className="flex h-7 w-7 items-center justify-center rounded-full bg-secondary text-xs font-semibold">
64
- {(member?.displayName ?? "M").slice(0, 1).toUpperCase()}
65
- </span>
66
- )}
67
- {member?.displayName ?? "My account"}
68
- </LinkComponent>
69
- <button
70
- type="button"
71
- onClick={() => void logout()}
72
- className="text-sm text-muted-foreground transition-colors hover:text-foreground"
73
- >
74
- Log out
75
- </button>
76
- </span>
77
- );
78
- }
@@ -1,47 +0,0 @@
1
- // REFERENCE gate for member-only surfaces on the REACT stack — on Astro, gate server-side
2
- // in frontmatter instead (pages/account.astro shows the shape); a client-side check there
3
- // flashes gated UI. Renders children only for a logged-in member; a visitor gets a login
4
- // prompt in place (routing-free — no router or redirect assumptions).
5
- import type { ReactNode } from "react";
6
- import { useMember } from "../../hooks/members/useMember";
7
-
8
- export interface RequireAuthProps {
9
- children: ReactNode;
10
- /** Rendered for an anonymous visitor instead of the default login prompt. */
11
- fallback?: ReactNode;
12
- }
13
-
14
- export default function RequireAuth({ children, fallback }: RequireAuthProps) {
15
- const { loggedIn, loading } = useMember();
16
-
17
- // Wait for the initial session read — deciding early bounces a logged-in member on first paint.
18
- if (loading) {
19
- return (
20
- <div className="py-16 text-center text-muted-foreground" aria-busy="true">
21
- Loading…
22
- </div>
23
- );
24
- }
25
-
26
- if (!loggedIn) {
27
- return (
28
- <>
29
- {fallback ?? (
30
- <div className="mx-auto max-w-md rounded-lg border border-border p-8 text-center">
31
- <p className="text-sm text-muted-foreground">
32
- This page is for members.
33
- </p>
34
- <a
35
- href={`/login?returnTo=${encodeURIComponent(window.location.pathname)}`}
36
- className="mt-4 rounded-full bg-primary px-5 py-2 text-sm font-medium text-primary-foreground transition-opacity hover:opacity-90"
37
- >
38
- Log in / Sign up
39
- </a>
40
- </div>
41
- )}
42
- </>
43
- );
44
- }
45
-
46
- return <>{children}</>;
47
- }