@wix/agent-skills 1.14.0 → 1.15.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (268) hide show
  1. package/README.md +12 -1
  2. package/package.json +1 -1
  3. package/skills/README.md +23 -0
  4. package/skills/wix-app/SKILL.md +10 -2
  5. package/skills/wix-app/references/AUTO_PATTERNS_DASHBOARD.md +326 -0
  6. package/skills/wix-app/references/CODE_QUALITY.md +1 -0
  7. package/skills/wix-app/references/CUSTOM_ELEMENT_WIDGET.md +124 -115
  8. package/skills/wix-app/references/DASHBOARD_PAGE.md +3 -0
  9. package/skills/wix-app/references/DATA_COLLECTION.md +5 -3
  10. package/skills/wix-app/references/EDITOR_REACT_COMPONENT.md +25 -9
  11. package/skills/wix-app/references/SITE_PLUGIN.md +1 -1
  12. package/skills/wix-app/references/STORES_VERSIONING.md +9 -211
  13. package/skills/wix-app/references/auto-patterns-dashboard/action-cell.md +115 -0
  14. package/skills/wix-app/references/auto-patterns-dashboard/app-config-structure.md +264 -0
  15. package/skills/wix-app/references/auto-patterns-dashboard/app-context.md +37 -0
  16. package/skills/wix-app/references/auto-patterns-dashboard/bulk-actions.md +86 -0
  17. package/skills/wix-app/references/auto-patterns-dashboard/collection-page-actions.md +119 -0
  18. package/skills/wix-app/references/auto-patterns-dashboard/collection-page.md +103 -0
  19. package/skills/wix-app/references/auto-patterns-dashboard/custom-actions-override.md +76 -0
  20. package/skills/wix-app/references/auto-patterns-dashboard/custom-columns-override.md +82 -0
  21. package/skills/wix-app/references/auto-patterns-dashboard/custom-components-override.md +89 -0
  22. package/skills/wix-app/references/auto-patterns-dashboard/custom-header-override.md +124 -0
  23. package/skills/wix-app/references/auto-patterns-dashboard/custom-sections-override.md +91 -0
  24. package/skills/wix-app/references/auto-patterns-dashboard/custom-slots-override.md +71 -0
  25. package/skills/wix-app/references/auto-patterns-dashboard/entity-page-actions.md +70 -0
  26. package/skills/wix-app/references/auto-patterns-dashboard/entity-page-view-actions.md +73 -0
  27. package/skills/wix-app/references/auto-patterns-dashboard/entity-page.md +98 -0
  28. package/skills/wix-app/references/auto-patterns-dashboard/example-patterns.json +278 -0
  29. package/skills/wix-app/references/auto-patterns-dashboard/pages-configuration.md +94 -0
  30. package/skills/wix-app/references/auto-patterns-dashboard/resolved-action.md +43 -0
  31. package/skills/wix-app/references/auto-patterns-dashboard/sdk-utilities.md +66 -0
  32. package/skills/wix-app/references/auto-patterns-dashboard/views.md +76 -0
  33. package/skills/wix-app/references/backend-event/COMMON-EVENTS.md +5 -0
  34. package/skills/wix-app/references/editor-react-component/ACCESSIBILITY.md +1 -14
  35. package/skills/wix-app/references/editor-react-component/ANIMATED-COMPONENTS.md +151 -0
  36. package/skills/wix-app/references/editor-react-component/COMPONENT-API.md +54 -29
  37. package/skills/wix-app/references/editor-react-component/COMPONENT-CONFIGURATION.md +2 -2
  38. package/skills/wix-app/references/editor-react-component/COMPONENT-PREVIEW.md +57 -0
  39. package/skills/wix-app/references/editor-react-component/CSS-GUIDELINES.md +23 -105
  40. package/skills/wix-app/references/editor-react-component/DESIGN-STATES.md +127 -0
  41. package/skills/wix-app/references/editor-react-component/PARTS.md +2 -1
  42. package/skills/wix-app/references/editor-react-component/REACT-GUIDELINES.md +18 -16
  43. package/skills/wix-app/references/editor-react-component/REACT-PATTERNS.md +25 -53
  44. package/skills/wix-app/references/stores/CATEGORIES.md +22 -0
  45. package/skills/wix-app/references/stores/GET_PRODUCT.md +99 -0
  46. package/skills/wix-app/references/stores/INVENTORY.md +37 -0
  47. package/skills/wix-app/references/stores/QUERY.md +87 -0
  48. package/skills/wix-app/references/stores/WRITE.md +55 -0
  49. package/skills/wix-app/scripts/generate-auto-patterns.js +510 -0
  50. package/skills/wix-auth/SKILL.md +12 -0
  51. package/skills/wix-auth/references/device-flow.md +140 -0
  52. package/skills/wix-docs/SKILL.md +188 -0
  53. package/skills/wix-docs/references/API_SPEC_SEARCH.md +213 -0
  54. package/skills/wix-docs/references/EXTRACTING.md +120 -0
  55. package/skills/wix-headless/SKILL.md +89 -130
  56. package/skills/wix-headless/entry/bootstrap.mjs +93 -0
  57. package/skills/wix-headless/entry/skill.md +76 -0
  58. package/skills/wix-headless/references/AI_FEATURES.md +178 -0
  59. package/skills/wix-headless/references/CAPABILITIES.md +86 -0
  60. package/skills/wix-headless/references/DISCOVERY.md +34 -56
  61. package/skills/wix-headless/references/DOC_DISCOVERY.md +37 -0
  62. package/skills/wix-headless/references/FEEDBACK.md +129 -0
  63. package/skills/wix-headless/references/IMAGE_GENERATION.md +69 -0
  64. package/skills/wix-headless/references/SDK_HANDOFF.md +99 -0
  65. package/skills/wix-headless/references/SEED.md +45 -187
  66. package/skills/wix-headless/references/SETUP.md +32 -103
  67. package/skills/wix-headless/references/astro.md +98 -0
  68. package/skills/wix-headless/references/inline-recipes/how-to-code-a-blog.md +196 -0
  69. package/skills/wix-headless/references/inline-recipes/how-to-code-a-store.md +236 -0
  70. package/skills/wix-headless/references/inline-recipes/how-to-code-bookings.md +279 -0
  71. package/skills/wix-headless/references/inline-recipes/how-to-code-cms.md +163 -0
  72. package/skills/wix-headless/references/inline-recipes/how-to-code-events.md +203 -0
  73. package/skills/wix-headless/references/inline-recipes/how-to-code-forms.md +222 -0
  74. package/skills/wix-headless/references/inline-recipes/how-to-code-members-astro.md +124 -0
  75. package/skills/wix-headless/references/inline-recipes/how-to-code-members-custom-login.md +160 -0
  76. package/skills/wix-headless/references/inline-recipes/how-to-code-members-non-astro.md +118 -0
  77. package/skills/wix-headless/references/inline-recipes/how-to-code-portfolio.md +132 -0
  78. package/skills/wix-headless/references/inline-recipes/how-to-code-pricing-plans.md +124 -0
  79. package/skills/wix-headless/references/inline-recipes/how-to-code-restaurant-orders.md +188 -0
  80. package/skills/wix-headless/references/inline-recipes/how-to-code-restaurant-reservations.md +213 -0
  81. package/skills/wix-headless/references/inline-recipes/how-to-code-restaurants.md +161 -0
  82. package/skills/wix-headless/references/inline-recipes/setup-blog.md +175 -0
  83. package/skills/wix-headless/references/inline-recipes/setup-bookings.md +232 -0
  84. package/skills/wix-headless/references/inline-recipes/setup-cms.md +200 -0
  85. package/skills/wix-headless/references/inline-recipes/setup-events.md +196 -0
  86. package/skills/wix-headless/references/inline-recipes/setup-forms.md +174 -0
  87. package/skills/wix-headless/references/inline-recipes/setup-online-store.md +192 -0
  88. package/skills/wix-headless/references/inline-recipes/setup-portfolio.md +155 -0
  89. package/skills/wix-headless/references/inline-recipes/setup-pricing-plans.md +229 -0
  90. package/skills/wix-headless/references/inline-recipes/setup-restaurant-experiences.md +73 -0
  91. package/skills/wix-headless/references/inline-recipes/setup-restaurant-orders.md +197 -0
  92. package/skills/wix-headless/references/inline-recipes/setup-restaurant-reservations.md +136 -0
  93. package/skills/wix-headless/references/inline-recipes/setup-restaurants.md +152 -0
  94. package/skills/wix-headless/references/managed/AUTHENTICATION.md +57 -0
  95. package/skills/wix-headless/references/managed/CONNECT.md +74 -0
  96. package/skills/wix-headless/references/managed/CREATE.md +130 -0
  97. package/skills/wix-headless/references/managed/DEPLOYMENT.md +79 -0
  98. package/skills/wix-headless/references/non-astro.md +59 -0
  99. package/skills/wix-headless/references/self-managed/AUTHENTICATION.md +22 -0
  100. package/skills/wix-headless/references/self-managed/DEPLOYMENT.md +15 -0
  101. package/skills/wix-headless/references/stripe/AUTHENTICATION.md +55 -0
  102. package/skills/wix-headless/references/stripe/DEPLOYMENT.md +71 -0
  103. package/skills/wix-manage/SKILL.md +29 -3
  104. package/skills/wix-manage/references/analytics/query-site-analytics.md +298 -0
  105. package/skills/wix-manage/references/app-installation/install-wix-apps.md +3 -0
  106. package/skills/wix-manage/references/bookings/create-and-update-booking-services.md +1 -1
  107. package/skills/wix-manage/references/bookings/create-booking-service-from-prompt.md +6 -5
  108. package/skills/wix-manage/references/bookings/create-course-service.md +30 -5
  109. package/skills/wix-manage/references/bookings/diagnose-availability-issues.md +299 -0
  110. package/skills/wix-manage/references/cms/cms-schema-management.md +6 -0
  111. package/skills/wix-manage/references/get-paid/how-to-setup-wix-payments.md +30 -7
  112. package/skills/wix-manage/references/marketing/create-and-publish-social-post.md +517 -0
  113. package/skills/wix-manage/references/marketing/generate-and-publish-marketing-plan.md +218 -0
  114. package/skills/wix-manage/references/rich-content/author-ricos-rich-content.md +249 -0
  115. package/skills/wix-manage/references/sites/site-import.md +270 -0
  116. package/skills/wix-manage/references/stores/create-product-from-image.md +8 -6
  117. package/skills/wix-manage/references/stores/create-product-with-options-catalog-v3.md +57 -0
  118. package/skills/wix-vibe-headless/SKILL.md +142 -0
  119. package/skills/wix-vibe-headless/platforms/README.md +22 -0
  120. package/skills/wix-vibe-headless/platforms/base44.md +142 -0
  121. package/skills/wix-vibe-headless/platforms/generic.md +87 -0
  122. package/skills/wix-vibe-headless/references/blog/INSTRUCTIONS.md +128 -0
  123. package/skills/wix-vibe-headless/references/blog/wix-blog.js +217 -0
  124. package/skills/wix-vibe-headless/references/bookings/INSTRUCTIONS.md +157 -0
  125. package/skills/wix-vibe-headless/references/bookings/wix-bookings-checkout.js +147 -0
  126. package/skills/wix-vibe-headless/references/bookings/wix-bookings-services.js +217 -0
  127. package/skills/wix-vibe-headless/references/cms/INSTRUCTIONS.md +154 -0
  128. package/skills/wix-vibe-headless/references/cms/wix-cms.js +186 -0
  129. package/skills/wix-vibe-headless/references/events/INSTRUCTIONS.md +142 -0
  130. package/skills/wix-vibe-headless/references/events/wix-events-browse.js +136 -0
  131. package/skills/wix-vibe-headless/references/events/wix-events-registration.js +187 -0
  132. package/skills/wix-vibe-headless/references/members/INSTRUCTIONS.md +211 -0
  133. package/skills/wix-vibe-headless/references/members/wix-members-auth.js +387 -0
  134. package/skills/wix-vibe-headless/references/portfolio/INSTRUCTIONS.md +111 -0
  135. package/skills/wix-vibe-headless/references/portfolio/wix-portfolio.js +223 -0
  136. package/skills/wix-vibe-headless/references/pricing-plans/INSTRUCTIONS.md +127 -0
  137. package/skills/wix-vibe-headless/references/pricing-plans/wix-pricing-plans.js +157 -0
  138. package/skills/wix-vibe-headless/references/restaurants/INSTRUCTIONS.md +138 -0
  139. package/skills/wix-vibe-headless/references/restaurants/wix-restaurants-menu.js +224 -0
  140. package/skills/wix-vibe-headless/references/restaurants/wix-restaurants-ordering.js +156 -0
  141. package/skills/wix-vibe-headless/references/restaurants/wix-restaurants-reservations.js +107 -0
  142. package/skills/wix-vibe-headless/references/shared/wix-client.js +186 -0
  143. package/skills/wix-vibe-headless/references/storefront/INSTRUCTIONS.md +164 -0
  144. package/skills/wix-vibe-headless/references/storefront/wix-store-cart.js +147 -0
  145. package/skills/wix-vibe-headless/references/storefront/wix-store-catalog.js +146 -0
  146. package/skills/wix-headless/references/BUILD-astro.md +0 -253
  147. package/skills/wix-headless/references/BUILD-own-build.md +0 -167
  148. package/skills/wix-headless/references/BUILD.md +0 -105
  149. package/skills/wix-headless/references/DESIGN_SYSTEM.md +0 -165
  150. package/skills/wix-headless/references/DISCOVERY-connect.md +0 -55
  151. package/skills/wix-headless/references/DISCOVERY-create.md +0 -238
  152. package/skills/wix-headless/references/PLAN-connect.md +0 -19
  153. package/skills/wix-headless/references/PLAN-create.md +0 -17
  154. package/skills/wix-headless/references/PLAN.md +0 -92
  155. package/skills/wix-headless/references/astro/blog/BLOG_PAGES.md +0 -300
  156. package/skills/wix-headless/references/astro/blog/BLOG_SETUP.md +0 -218
  157. package/skills/wix-headless/references/astro/bookings/COMPONENTS.md +0 -45
  158. package/skills/wix-headless/references/astro/bookings/SERVICES_PAGES.md +0 -77
  159. package/skills/wix-headless/references/astro/cms/CMS_FOUNDATIONS.md +0 -214
  160. package/skills/wix-headless/references/astro/cms/FAQ_KNOWLEDGE_BASE.md +0 -231
  161. package/skills/wix-headless/references/astro/cms/PORTFOLIO.md +0 -453
  162. package/skills/wix-headless/references/astro/cms/RESOURCE_LIBRARY.md +0 -354
  163. package/skills/wix-headless/references/astro/cms/TEAM_DIRECTORY.md +0 -299
  164. package/skills/wix-headless/references/astro/designer/INSTRUCTIONS.md +0 -351
  165. package/skills/wix-headless/references/astro/ecom/CART_PAGES.md +0 -119
  166. package/skills/wix-headless/references/astro/ecom/CART_WIRING.md +0 -103
  167. package/skills/wix-headless/references/astro/ecom/COMPONENTS_CSS.md +0 -132
  168. package/skills/wix-headless/references/astro/forms/CONTACT_FORM.md +0 -463
  169. package/skills/wix-headless/references/astro/gift-cards/COMPONENTS.md +0 -119
  170. package/skills/wix-headless/references/astro/gift-cards/PAGES.md +0 -129
  171. package/skills/wix-headless/references/astro/stores/BACK_IN_STOCK.md +0 -178
  172. package/skills/wix-headless/references/astro/stores/CATEGORY_PAGES.md +0 -85
  173. package/skills/wix-headless/references/astro/stores/COMPONENTS_CSS.md +0 -129
  174. package/skills/wix-headless/references/astro/stores/HOME_AND_NAV.md +0 -229
  175. package/skills/wix-headless/references/astro/stores/PRODUCT_PAGES.md +0 -215
  176. package/skills/wix-headless/references/astro/stores/SHARED_WIRING.md +0 -165
  177. package/skills/wix-headless/references/astro/templates/Layout.astro +0 -132
  178. package/skills/wix-headless/references/astro/templates/astro.config.mjs +0 -41
  179. package/skills/wix-headless/references/astro/templates/bookings/AvailabilityCalendar.tsx +0 -374
  180. package/skills/wix-headless/references/astro/templates/bookings/BookingForm.tsx +0 -136
  181. package/skills/wix-headless/references/astro/templates/bookings/SeoTags.astro +0 -25
  182. package/skills/wix-headless/references/astro/templates/bookings/ServiceBookingFlow.tsx +0 -71
  183. package/skills/wix-headless/references/astro/templates/bookings/ServiceCard.astro +0 -54
  184. package/skills/wix-headless/references/astro/templates/bookings/booking-confirmation.astro +0 -49
  185. package/skills/wix-headless/references/astro/templates/bookings/bookingDriver.ts +0 -245
  186. package/skills/wix-headless/references/astro/templates/bookings/components-bookings.css +0 -424
  187. package/skills/wix-headless/references/astro/templates/bookings/services/[slug].astro +0 -176
  188. package/skills/wix-headless/references/astro/templates/bookings/services/index.astro +0 -181
  189. package/skills/wix-headless/references/astro/templates/ecom/CartBadge.tsx +0 -84
  190. package/skills/wix-headless/references/astro/templates/ecom/CartView.tsx +0 -543
  191. package/skills/wix-headless/references/astro/templates/ecom/cart.astro +0 -13
  192. package/skills/wix-headless/references/astro/templates/ecom/components-ecom.css +0 -302
  193. package/skills/wix-headless/references/astro/templates/ecom/discounts.ts +0 -71
  194. package/skills/wix-headless/references/astro/templates/ecom/thank-you.astro +0 -24
  195. package/skills/wix-headless/references/astro/templates/gift-cards/GiftCardPurchase.tsx +0 -172
  196. package/skills/wix-headless/references/astro/templates/gift-cards/_home-teaser-snippet.astro +0 -42
  197. package/skills/wix-headless/references/astro/templates/gift-cards/_nav-snippet.astro +0 -11
  198. package/skills/wix-headless/references/astro/templates/gift-cards/components-gift-cards.css +0 -220
  199. package/skills/wix-headless/references/astro/templates/gift-cards/gift-cards.astro +0 -51
  200. package/skills/wix-headless/references/astro/templates/gift-cards/gift-cards.ts +0 -75
  201. package/skills/wix-headless/references/astro/templates/global.css +0 -288
  202. package/skills/wix-headless/references/astro/templates/stores/AddToCartButton.tsx +0 -77
  203. package/skills/wix-headless/references/astro/templates/stores/BackInStockForm.tsx +0 -176
  204. package/skills/wix-headless/references/astro/templates/stores/CategoryRail.astro +0 -69
  205. package/skills/wix-headless/references/astro/templates/stores/ProductCard.astro +0 -79
  206. package/skills/wix-headless/references/astro/templates/stores/ProductPurchase.tsx +0 -397
  207. package/skills/wix-headless/references/astro/templates/stores/SeoTags.astro +0 -21
  208. package/skills/wix-headless/references/astro/templates/stores/back-in-stock.ts +0 -67
  209. package/skills/wix-headless/references/astro/templates/stores/categories.ts +0 -155
  210. package/skills/wix-headless/references/astro/templates/stores/category/[slug].astro +0 -130
  211. package/skills/wix-headless/references/astro/templates/stores/components-stores.css +0 -400
  212. package/skills/wix-headless/references/astro/templates/stores/products/[slug].astro +0 -128
  213. package/skills/wix-headless/references/astro/templates/stores/products/index.astro +0 -101
  214. package/skills/wix-headless/references/blog/BLOG_CONTENT.md +0 -161
  215. package/skills/wix-headless/references/blog/INSTRUCTIONS.md +0 -32
  216. package/skills/wix-headless/references/bookings/FLOW.md +0 -246
  217. package/skills/wix-headless/references/bookings/INSTRUCTIONS.md +0 -95
  218. package/skills/wix-headless/references/bookings/SERVICES_DATA.md +0 -355
  219. package/skills/wix-headless/references/cms/CMS_FOUNDATIONS.md +0 -176
  220. package/skills/wix-headless/references/cms/INSTRUCTIONS.md +0 -71
  221. package/skills/wix-headless/references/commands/known-apps.json +0 -6
  222. package/skills/wix-headless/references/custom/CONNECTION_PLAN.md +0 -142
  223. package/skills/wix-headless/references/custom/INSTRUCTIONS.md +0 -88
  224. package/skills/wix-headless/references/custom/blog/WIRING.md +0 -52
  225. package/skills/wix-headless/references/custom/bookings/WIRING.md +0 -197
  226. package/skills/wix-headless/references/custom/cms/WIRING.md +0 -97
  227. package/skills/wix-headless/references/custom/ecom/WIRING.md +0 -67
  228. package/skills/wix-headless/references/custom/forms/WIRING.md +0 -101
  229. package/skills/wix-headless/references/custom/stores/WIRING.md +0 -80
  230. package/skills/wix-headless/references/ecom/INSTRUCTIONS.md +0 -59
  231. package/skills/wix-headless/references/forms/INSTRUCTIONS.md +0 -43
  232. package/skills/wix-headless/references/gift-cards/INSTRUCTIONS.md +0 -51
  233. package/skills/wix-headless/references/images/INSTRUCTIONS.md +0 -357
  234. package/skills/wix-headless/references/seed-recipes.md +0 -49
  235. package/skills/wix-headless/references/shared/AGENTS_MD.md +0 -47
  236. package/skills/wix-headless/references/shared/AUTHENTICATION.md +0 -108
  237. package/skills/wix-headless/references/shared/BUILD_NOISE.md +0 -8
  238. package/skills/wix-headless/references/shared/DESIGN_MD.md +0 -84
  239. package/skills/wix-headless/references/shared/DOCS_SEARCH.md +0 -41
  240. package/skills/wix-headless/references/shared/IMAGE_GENERATION.md +0 -186
  241. package/skills/wix-headless/references/shared/IMPLEMENTER.md +0 -206
  242. package/skills/wix-headless/references/shared/PRODUCTION_SHARP_EDGES.md +0 -97
  243. package/skills/wix-headless/references/shared/RETURN_CONTRACT.md +0 -143
  244. package/skills/wix-headless/references/shared/STYLING.md +0 -140
  245. package/skills/wix-headless/references/stores/INSTRUCTIONS.md +0 -126
  246. package/skills/wix-headless/references/stores/PRODUCT_CATALOG_DATA.md +0 -252
  247. package/skills/wix-headless/references/verticals/_schema.json +0 -74
  248. package/skills/wix-headless/references/verticals/_schema.md +0 -95
  249. package/skills/wix-headless/references/verticals/blog.md +0 -31
  250. package/skills/wix-headless/references/verticals/bookings.md +0 -41
  251. package/skills/wix-headless/references/verticals/cms.md +0 -30
  252. package/skills/wix-headless/references/verticals/ecom.md +0 -25
  253. package/skills/wix-headless/references/verticals/forms.md +0 -26
  254. package/skills/wix-headless/references/verticals/gift-cards.md +0 -24
  255. package/skills/wix-headless/references/verticals/stores.md +0 -33
  256. package/skills/wix-headless/scripts/check-manifest.mjs +0 -335
  257. package/skills/wix-headless/scripts/compose.mjs +0 -520
  258. package/skills/wix-headless/scripts/emit-design-tokens.mjs +0 -157
  259. package/skills/wix-headless/scripts/flatten.sh +0 -61
  260. package/skills/wix-headless/scripts/generate-images.mjs +0 -242
  261. package/skills/wix-headless/scripts/patch-decorative-slots.mjs +0 -154
  262. package/skills/wix-headless/scripts/plan-entity-image-waves.mjs +0 -190
  263. package/skills/wix-headless/scripts/scaffold.sh +0 -139
  264. package/skills/wix-headless/scripts/seed-utilities.sh +0 -93
  265. package/skills/wix-headless/scripts/write-decorative-json.mjs +0 -62
  266. package/skills/wix-headless/shared-utilities/analytics.ts +0 -40
  267. package/skills/wix-headless/shared-utilities/ricos.ts +0 -179
  268. package/skills/wix-headless/shared-utilities/wix-image.ts +0 -72
@@ -1,176 +0,0 @@
1
- import { useState } from "react";
2
- import { backInStockNotifications } from "@wix/ecom";
3
- import { WIX_STORES_BACK_IN_STOCK_APP_ID } from "../utils/back-in-stock";
4
-
5
- interface BackInStockFormProps {
6
- productId: string;
7
- variantId?: string;
8
- productName: string;
9
- // Numeric price (number or numeric string). The Wix backend validates
10
- // `itemDetails.price >= 0` against the parsed decimal, so currency-
11
- // formatted strings ("$695") are stripped here before submission.
12
- productPrice: number | string;
13
- variantLabel?: string;
14
- }
15
-
16
- type Status =
17
- | { kind: "idle" }
18
- | { kind: "submitting" }
19
- | { kind: "success"; alreadySubscribed?: boolean }
20
- | { kind: "error"; message: string };
21
-
22
- const EMAIL_RE = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
23
-
24
- function normalizePrice(raw: number | string): string {
25
- const s =
26
- typeof raw === "number" ? String(raw) : String(raw).replace(/[^0-9.]/g, "");
27
- const n = Number(s);
28
- return Number.isFinite(n) && n >= 0 ? s : "0";
29
- }
30
-
31
- function readErrorCode(err: unknown): string | undefined {
32
- if (!err || typeof err !== "object") return undefined;
33
- // Wix SDK errors expose details.applicationError.code; some shapes also
34
- // surface a top-level details.code or http status. Try the common ones.
35
- const e = err as Record<string, any>;
36
- return (
37
- e?.details?.applicationError?.code ??
38
- e?.details?.code ??
39
- e?.applicationError?.code ??
40
- undefined
41
- );
42
- }
43
-
44
- export default function BackInStockForm({
45
- productId,
46
- variantId,
47
- productName,
48
- productPrice,
49
- variantLabel,
50
- }: BackInStockFormProps) {
51
- const [email, setEmail] = useState("");
52
- const [status, setStatus] = useState<Status>({ kind: "idle" });
53
-
54
- const submitting = status.kind === "submitting";
55
- const success = status.kind === "success";
56
-
57
- async function handleSubmit(e: React.FormEvent<HTMLFormElement>) {
58
- e.preventDefault();
59
- if (submitting) return;
60
- if (!EMAIL_RE.test(email)) {
61
- setStatus({ kind: "error", message: "Enter a valid email." });
62
- return;
63
- }
64
- setStatus({ kind: "submitting" });
65
-
66
- // Bare-fields rule: the SDK throws an opaque
67
- // "TypeError: Failed to construct 'URL': Invalid URL" when the optional
68
- // request.itemUrl or itemDetails.image fields are present, even with
69
- // browser-valid URLs. Send only the four required fields:
70
- // catalogReference, email, name, price. The dashboard's Back-in-Stock
71
- // Requests view + the customer notification email both work without
72
- // them; the email just won't have a thumbnail and the dashboard uses
73
- // its default item URL.
74
- const request = {
75
- catalogReference: {
76
- appId: WIX_STORES_BACK_IN_STOCK_APP_ID,
77
- catalogItemId: productId,
78
- ...(variantId ? { options: { variantId } } : {}),
79
- },
80
- email,
81
- };
82
- const itemDetails = {
83
- name: productName,
84
- price: normalizePrice(productPrice),
85
- };
86
-
87
- try {
88
- await backInStockNotifications.createBackInStockNotificationRequest(
89
- request,
90
- itemDetails,
91
- );
92
- setStatus({ kind: "success" });
93
- } catch (err) {
94
- const code = readErrorCode(err);
95
- if (code === "BACK_IN_STOCK_NOTIFICATION_REQUEST_ALREADY_EXISTS") {
96
- setStatus({ kind: "success", alreadySubscribed: true });
97
- return;
98
- }
99
- if (code === "REQUEST_COLLECTION_DISABLED") {
100
- setStatus({
101
- kind: "error",
102
- message: "Notifications aren't being collected right now.",
103
- });
104
- return;
105
- }
106
- console.error("[back-in-stock] subscribe failed:", err);
107
- setStatus({
108
- kind: "error",
109
- message: "Something went wrong. Please try again.",
110
- });
111
- }
112
- }
113
-
114
- if (success) {
115
- return (
116
- <div className="back-in-stock-success" role="status" aria-live="polite">
117
- <p className="back-in-stock-success-headline">
118
- {status.alreadySubscribed
119
- ? "You're already on the list."
120
- : "We'll let you know."}
121
- </p>
122
- <p className="back-in-stock-success-detail">
123
- {status.alreadySubscribed
124
- ? `We had your note for ${productName}${variantLabel ? ` (${variantLabel})` : ""}. We'll email ${email} the moment it's back.`
125
- : `We'll email ${email} the moment ${productName}${variantLabel ? ` (${variantLabel})` : ""} is back in stock.`}
126
- </p>
127
- </div>
128
- );
129
- }
130
-
131
- return (
132
- <form className="back-in-stock-form" onSubmit={handleSubmit} noValidate>
133
- <div className="back-in-stock-headline">
134
- <span className="back-in-stock-eyebrow">Currently sold out</span>
135
- <p className="back-in-stock-lede">
136
- Leave your email and we'll notify you the moment
137
- {variantLabel ? ` ${variantLabel.toLowerCase()}` : ""} is back in
138
- stock.
139
- </p>
140
- </div>
141
- <label className="back-in-stock-label" htmlFor="back-in-stock-email">
142
- Email
143
- </label>
144
- <div className="back-in-stock-row">
145
- <input
146
- id="back-in-stock-email"
147
- type="email"
148
- inputMode="email"
149
- autoComplete="email"
150
- required
151
- placeholder="you@example.com"
152
- value={email}
153
- onChange={(e) => {
154
- setEmail(e.target.value);
155
- if (status.kind === "error") setStatus({ kind: "idle" });
156
- }}
157
- className="back-in-stock-input"
158
- aria-invalid={status.kind === "error"}
159
- disabled={submitting}
160
- />
161
- <button
162
- type="submit"
163
- className="back-in-stock-submit"
164
- disabled={submitting || email.trim().length === 0}
165
- >
166
- {submitting ? "Sending…" : "Notify me"}
167
- </button>
168
- </div>
169
- {status.kind === "error" && (
170
- <p className="back-in-stock-error" role="alert">
171
- {status.message}
172
- </p>
173
- )}
174
- </form>
175
- );
176
- }
@@ -1,69 +0,0 @@
1
- ---
2
- // Shared category-rail + Prev/Next pagination for /products and
3
- // /category/[slug]. Persists across <ClientRouter /> swaps so pill clicks
4
- // feel like an in-place filter, not a navigation. The active pill is
5
- // recomputed from the URL by an astro:after-swap hook in Layout.astro.
6
- //
7
- // Owned by the stores pack. Ecom/blog/etc. do NOT write to this file.
8
- import type { StoreCategory } from "../utils/categories";
9
-
10
- interface Props {
11
- categories: StoreCategory[];
12
- // null = "All" view; otherwise the slug of the active category.
13
- activeSlug: string | null;
14
- prevHref: string | null;
15
- nextHref: string | null;
16
- }
17
-
18
- const { categories, activeSlug, prevHref, nextHref } = Astro.props;
19
- ---
20
-
21
- {categories.length > 0 && (
22
- <nav
23
- class="category-rail"
24
- aria-label="Browse by category"
25
- data-category-rail
26
- transition:persist="category-rail"
27
- transition:name="category-rail"
28
- >
29
- <div class="container-page category-rail-inner">
30
- <a
31
- href="/products"
32
- class="category-pill"
33
- data-category-slug=""
34
- data-astro-prefetch="hover"
35
- aria-current={activeSlug ? undefined : "page"}
36
- >All</a>
37
- {categories.map((cat) => (
38
- <a
39
- href={`/category/${cat.slug}`}
40
- class="category-pill"
41
- data-category-slug={cat.slug}
42
- data-astro-prefetch="hover"
43
- aria-current={activeSlug === cat.slug ? "page" : undefined}
44
- >{cat.name}</a>
45
- ))}
46
- </div>
47
- </nav>
48
- )}
49
-
50
- {(prevHref || nextHref) && (
51
- <nav class="pagination" aria-label="Listing pagination">
52
- <div class="container-page pagination-inner">
53
- {prevHref ? (
54
- <a href={prevHref} class="pagination-link" data-astro-prefetch="hover" rel="prev">
55
- &larr; Previous
56
- </a>
57
- ) : (
58
- <span class="pagination-link is-disabled" aria-disabled="true">&larr; Previous</span>
59
- )}
60
- {nextHref ? (
61
- <a href={nextHref} class="pagination-link" data-astro-prefetch="hover" rel="next">
62
- Next &rarr;
63
- </a>
64
- ) : (
65
- <span class="pagination-link is-disabled" aria-disabled="true">Next &rarr;</span>
66
- )}
67
- </div>
68
- </nav>
69
- )}
@@ -1,79 +0,0 @@
1
- ---
2
- import { resolveWixImageUrl } from "../utils/wix-image";
3
- import { fetchLiveOffers, offersForProduct } from "../utils/discounts";
4
-
5
- interface Props {
6
- product: {
7
- _id?: string;
8
- name?: string;
9
- slug?: string;
10
- media?: { main?: { image?: string }; items?: any[] };
11
- actualPriceRange?: {
12
- minValue?: { formattedAmount?: string; amount?: string; currency?: string };
13
- };
14
- };
15
- // Optional editorial ordinal (01 / 02 / 03). Listings that want it should
16
- // pass their own index; home grids typically omit it.
17
- index?: number;
18
- }
19
-
20
- const { product, index } = Astro.props;
21
-
22
- // fetchLiveOffers is memoized per request via auth.elevate's caching, so
23
- // rendering N ProductCards in one page does NOT fan out N discount-rule
24
- // queries. Pages that mount ProductCard never fetch offers themselves —
25
- // the component owns that concern.
26
- let primaryOffer: { name: string; offer?: string } | undefined;
27
- try {
28
- const offers = await fetchLiveOffers();
29
- primaryOffer = offersForProduct(offers, product._id)[0];
30
- } catch (err) {
31
- console.error("[ProductCard] fetchLiveOffers failed:", err);
32
- }
33
-
34
- const imageUrl = resolveWixImageUrl(product.media?.main?.image, 600, 800);
35
- const price = product.actualPriceRange?.minValue?.formattedAmount;
36
- const amount = product.actualPriceRange?.minValue?.amount;
37
- const currency = product.actualPriceRange?.minValue?.currency;
38
- const indexLabel =
39
- typeof index === "number" ? String(index + 1).padStart(2, "0") : null;
40
- ---
41
-
42
- <a
43
- href={`/products/${product.slug}`}
44
- class="product-card"
45
- data-analytics-product
46
- data-id={product._id}
47
- data-name={product.name}
48
- data-price={amount}
49
- data-currency={currency}
50
- >
51
- <div class="product-card-media">
52
- {imageUrl && <img src={imageUrl} alt={product.name ?? "Product"} loading="lazy" />}
53
- {indexLabel && <span class="product-card-index">N°&nbsp;{indexLabel}</span>}
54
- {primaryOffer && (
55
- <span class="product-card-ribbon" title={primaryOffer.offer}>
56
- {primaryOffer.name}
57
- </span>
58
- )}
59
- </div>
60
- <div class="product-card-body">
61
- <h3 class="product-card-name">{product.name}</h3>
62
- {price && <p class="product-card-price">{price}</p>}
63
- </div>
64
- </a>
65
-
66
- <script>
67
- import { trackEvent } from "../utils/analytics";
68
- document.addEventListener("click", (event) => {
69
- const anchor = (event.target as HTMLElement)?.closest("a[data-analytics-product]") as HTMLAnchorElement | null;
70
- if (!anchor) return;
71
- trackEvent("ClickProduct", {
72
- id: anchor.dataset.id,
73
- name: anchor.dataset.name,
74
- price: anchor.dataset.price ? Number(anchor.dataset.price) : undefined,
75
- currency: anchor.dataset.currency,
76
- origin: "Product Listing",
77
- });
78
- });
79
- </script>