@enadhq/enad-react-sdk 0.0.6 → 1.0.2

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 (870) hide show
  1. package/README.md +288 -0
  2. package/dist/client/cart/adapters/brink.d.ts +29 -0
  3. package/dist/client/cart/adapters/brink.d.ts.map +1 -0
  4. package/dist/client/cart/adapters/brink.mjs +154 -0
  5. package/dist/client/cart/adapters/brink.mjs.map +1 -0
  6. package/dist/client/cart/adapters/index.d.ts +3 -0
  7. package/dist/client/cart/adapters/index.d.ts.map +1 -0
  8. package/dist/client/cart/adapters/index.mjs +5 -0
  9. package/dist/client/cart/adapters/index.mjs.map +1 -0
  10. package/dist/client/cart/adapters/mock.d.ts +20 -0
  11. package/dist/client/cart/adapters/mock.d.ts.map +1 -0
  12. package/dist/client/cart/adapters/mock.mjs +76 -0
  13. package/dist/client/cart/adapters/mock.mjs.map +1 -0
  14. package/dist/client/cart/components/{cart-drawer.d.mts → cart-drawer.d.ts} +4 -6
  15. package/dist/client/cart/components/cart-drawer.d.ts.map +1 -0
  16. package/dist/client/cart/components/cart-drawer.mjs +269 -138
  17. package/dist/client/cart/components/cart-drawer.mjs.map +1 -1
  18. package/dist/client/cart/components/cart-trigger.d.ts +10 -0
  19. package/dist/client/cart/components/cart-trigger.d.ts.map +1 -0
  20. package/dist/client/cart/components/cart-trigger.mjs +26 -10
  21. package/dist/client/cart/components/cart-trigger.mjs.map +1 -1
  22. package/dist/client/cart/components/promo-code-input.d.ts +16 -0
  23. package/dist/client/cart/components/promo-code-input.d.ts.map +1 -0
  24. package/dist/client/cart/components/promo-code-input.mjs +92 -0
  25. package/dist/client/cart/components/promo-code-input.mjs.map +1 -0
  26. package/dist/client/cart/constants/session.d.ts +2 -0
  27. package/dist/client/cart/constants/session.d.ts.map +1 -0
  28. package/dist/client/cart/contexts/cart.d.ts +36 -0
  29. package/dist/client/cart/contexts/cart.d.ts.map +1 -0
  30. package/dist/client/cart/contexts/cart.mjs +14 -16
  31. package/dist/client/cart/contexts/cart.mjs.map +1 -1
  32. package/dist/client/cart/hooks/useCart.d.ts +26 -0
  33. package/dist/client/cart/hooks/useCart.d.ts.map +1 -0
  34. package/dist/client/cart/hooks/useCart.mjs +5 -6
  35. package/dist/client/cart/hooks/useCart.mjs.map +1 -1
  36. package/dist/client/cart/hooks/useCartActions.d.ts +25 -0
  37. package/dist/client/cart/hooks/useCartActions.d.ts.map +1 -0
  38. package/dist/client/cart/hooks/useCartActions.mjs +7 -16
  39. package/dist/client/cart/hooks/useCartActions.mjs.map +1 -1
  40. package/dist/client/cart/index.d.ts +12 -0
  41. package/dist/client/cart/index.d.ts.map +1 -0
  42. package/dist/client/cart/index.mjs +16 -0
  43. package/dist/client/cart/index.mjs.map +1 -0
  44. package/dist/client/cart/queries/addToCartQueryFn.d.ts +7 -0
  45. package/dist/client/cart/queries/addToCartQueryFn.d.ts.map +1 -0
  46. package/dist/client/cart/queries/addToCartQueryFn.mjs.map +1 -1
  47. package/dist/client/cart/queries/getCartQueryFn.d.ts +4 -0
  48. package/dist/client/cart/queries/getCartQueryFn.d.ts.map +1 -0
  49. package/dist/client/cart/queries/getCartQueryFn.mjs.map +1 -1
  50. package/dist/client/cart/queries/removeCartItemQueryFn.d.ts +6 -0
  51. package/dist/client/cart/queries/removeCartItemQueryFn.d.ts.map +1 -0
  52. package/dist/client/cart/queries/removeCartItemQueryFn.mjs.map +1 -1
  53. package/dist/client/cart/queries/updateCartItemQueryFn.d.ts +7 -0
  54. package/dist/client/cart/queries/updateCartItemQueryFn.d.ts.map +1 -0
  55. package/dist/client/cart/queries/updateCartItemQueryFn.mjs.map +1 -1
  56. package/dist/client/cart/types/adapter.d.ts +110 -0
  57. package/dist/client/cart/types/adapter.d.ts.map +1 -0
  58. package/dist/client/cart/types/adapter.mjs +12 -0
  59. package/dist/client/cart/types/adapter.mjs.map +1 -0
  60. package/dist/client/cart/types/{cart.d.mts → cart.d.ts} +21 -5
  61. package/dist/client/cart/types/cart.d.ts.map +1 -0
  62. package/dist/client/cart/utils/session.d.ts +5 -0
  63. package/dist/client/cart/utils/session.d.ts.map +1 -0
  64. package/dist/client/cart/utils/session.mjs +1 -1
  65. package/dist/client/cart/utils/session.mjs.map +1 -1
  66. package/dist/client/cms/storyblok/preview/registerStoryblokBridge.d.ts +7 -0
  67. package/dist/client/cms/storyblok/preview/registerStoryblokBridge.d.ts.map +1 -0
  68. package/dist/client/cms/storyblok/preview/registerStoryblokBridge.mjs +3 -2
  69. package/dist/client/cms/storyblok/preview/registerStoryblokBridge.mjs.map +1 -1
  70. package/dist/client/cms/storyblok/preview/{storyblok-preview-syncer.d.mts → storyblok-preview-syncer.d.ts} +4 -6
  71. package/dist/client/cms/storyblok/preview/storyblok-preview-syncer.d.ts.map +1 -0
  72. package/dist/client/cms/storyblok/preview/storyblok-preview-syncer.mjs.map +1 -1
  73. package/dist/client/global/auth/withAuth.d.ts +5 -0
  74. package/dist/client/global/auth/withAuth.d.ts.map +1 -0
  75. package/dist/client/global/components/error-boundary.d.ts +18 -0
  76. package/dist/client/global/components/error-boundary.d.ts.map +1 -0
  77. package/dist/client/global/components/error-boundary.mjs +41 -0
  78. package/dist/client/global/components/error-boundary.mjs.map +1 -0
  79. package/dist/client/global/config/{index.d.mts → index.d.ts} +3 -3
  80. package/dist/client/global/config/index.d.ts.map +1 -0
  81. package/dist/client/global/constants/{tags.d.mts → tags.d.ts} +2 -3
  82. package/dist/client/global/constants/tags.d.ts.map +1 -0
  83. package/dist/client/global/index.d.ts +6 -0
  84. package/dist/client/global/index.d.ts.map +1 -0
  85. package/dist/client/global/index.mjs +7 -0
  86. package/dist/client/global/index.mjs.map +1 -0
  87. package/dist/client/global/providers/enad-provider.d.ts +48 -0
  88. package/dist/client/global/providers/enad-provider.d.ts.map +1 -0
  89. package/dist/client/global/providers/enad-provider.mjs +32 -3
  90. package/dist/client/global/providers/enad-provider.mjs.map +1 -1
  91. package/dist/client/icons/adapters/hugeicons.d.ts +9 -0
  92. package/dist/client/icons/adapters/hugeicons.d.ts.map +1 -0
  93. package/dist/client/icons/adapters/hugeicons.mjs +117 -0
  94. package/dist/client/icons/adapters/hugeicons.mjs.map +1 -0
  95. package/dist/client/icons/adapters/lucide.d.ts +8 -0
  96. package/dist/client/icons/adapters/lucide.d.ts.map +1 -0
  97. package/dist/client/icons/adapters/lucide.mjs +108 -0
  98. package/dist/client/icons/adapters/lucide.mjs.map +1 -0
  99. package/dist/client/icons/adapters/phosphor.d.ts +11 -0
  100. package/dist/client/icons/adapters/phosphor.d.ts.map +1 -0
  101. package/dist/client/icons/adapters/phosphor.mjs +108 -0
  102. package/dist/client/icons/adapters/phosphor.mjs.map +1 -0
  103. package/dist/client/icons/icon-context.d.ts +13 -0
  104. package/dist/client/icons/icon-context.d.ts.map +1 -0
  105. package/dist/client/icons/icon-context.mjs +27 -0
  106. package/dist/client/icons/icon-context.mjs.map +1 -0
  107. package/dist/client/icons/index.d.ts +9 -0
  108. package/dist/client/icons/index.d.ts.map +1 -0
  109. package/dist/client/icons/index.mjs +16 -0
  110. package/dist/client/icons/index.mjs.map +1 -0
  111. package/dist/client/icons/types.d.ts +60 -0
  112. package/dist/client/icons/types.d.ts.map +1 -0
  113. package/dist/client/icons/types.mjs +1 -0
  114. package/dist/client/icons/types.mjs.map +1 -0
  115. package/dist/client/motion/config.d.ts +42 -0
  116. package/dist/client/motion/config.d.ts.map +1 -0
  117. package/dist/client/motion/config.mjs +44 -0
  118. package/dist/client/motion/config.mjs.map +1 -0
  119. package/dist/client/motion/hover.d.ts +36 -0
  120. package/dist/client/motion/hover.d.ts.map +1 -0
  121. package/dist/client/motion/hover.mjs +19 -0
  122. package/dist/client/motion/hover.mjs.map +1 -0
  123. package/dist/client/motion/index.d.ts +4 -0
  124. package/dist/client/motion/index.d.ts.map +1 -0
  125. package/dist/client/motion/index.mjs +13 -0
  126. package/dist/client/motion/index.mjs.map +1 -0
  127. package/dist/client/motion/stagger.d.ts +36 -0
  128. package/dist/client/motion/stagger.d.ts.map +1 -0
  129. package/dist/client/motion/stagger.mjs +17 -0
  130. package/dist/client/motion/stagger.mjs.map +1 -0
  131. package/dist/client/search/actions/searchAction.d.ts +2 -0
  132. package/dist/client/search/actions/searchAction.d.ts.map +1 -0
  133. package/dist/client/search/actions/searchAction.mjs.map +1 -1
  134. package/dist/client/search/components/search-bar.d.ts +8 -0
  135. package/dist/client/search/components/search-bar.d.ts.map +1 -0
  136. package/dist/client/search/components/search-bar.mjs +33 -0
  137. package/dist/client/search/components/search-bar.mjs.map +1 -1
  138. package/dist/client/search/hooks/useSearch.d.ts +14 -0
  139. package/dist/client/search/hooks/useSearch.d.ts.map +1 -0
  140. package/dist/client/search/hooks/useSearch.mjs +1 -1
  141. package/dist/client/search/hooks/useSearch.mjs.map +1 -1
  142. package/dist/client/search/index.d.ts +2 -0
  143. package/dist/client/search/index.d.ts.map +1 -0
  144. package/dist/client/search/index.mjs +5 -0
  145. package/dist/client/search/index.mjs.map +1 -0
  146. package/dist/client/storefront/blocks/accordion-block.d.ts +4 -0
  147. package/dist/client/storefront/blocks/accordion-block.d.ts.map +1 -0
  148. package/dist/client/storefront/blocks/accordion-block.mjs +43 -0
  149. package/dist/client/storefront/blocks/accordion-block.mjs.map +1 -0
  150. package/dist/client/storefront/blocks/card-image-with-caption.d.ts +4 -0
  151. package/dist/client/storefront/blocks/card-image-with-caption.d.ts.map +1 -0
  152. package/dist/client/storefront/blocks/card-image-with-caption.mjs +27 -0
  153. package/dist/client/storefront/blocks/card-image-with-caption.mjs.map +1 -0
  154. package/dist/client/storefront/blocks/card-video.d.ts +4 -0
  155. package/dist/client/storefront/blocks/card-video.d.ts.map +1 -0
  156. package/dist/client/storefront/blocks/card-video.mjs +43 -0
  157. package/dist/client/storefront/blocks/card-video.mjs.map +1 -0
  158. package/dist/client/storefront/blocks/content-with-gallery.d.ts +4 -0
  159. package/dist/client/storefront/blocks/content-with-gallery.d.ts.map +1 -0
  160. package/dist/client/storefront/blocks/content-with-gallery.mjs +48 -0
  161. package/dist/client/storefront/blocks/content-with-gallery.mjs.map +1 -0
  162. package/dist/client/storefront/blocks/content-with-image-product-data.d.ts +4 -0
  163. package/dist/client/storefront/blocks/content-with-image-product-data.d.ts.map +1 -0
  164. package/dist/client/storefront/blocks/content-with-image-product-data.mjs +45 -0
  165. package/dist/client/storefront/blocks/content-with-image-product-data.mjs.map +1 -0
  166. package/dist/client/storefront/blocks/gallery-with-caption.d.ts +4 -0
  167. package/dist/client/storefront/blocks/gallery-with-caption.d.ts.map +1 -0
  168. package/dist/client/storefront/blocks/gallery-with-caption.mjs +36 -0
  169. package/dist/client/storefront/blocks/gallery-with-caption.mjs.map +1 -0
  170. package/dist/client/storefront/blocks/gallery-with-link-blocks.d.ts +4 -0
  171. package/dist/client/storefront/blocks/gallery-with-link-blocks.d.ts.map +1 -0
  172. package/dist/client/storefront/blocks/gallery-with-link-blocks.mjs +24 -0
  173. package/dist/client/storefront/blocks/gallery-with-link-blocks.mjs.map +1 -0
  174. package/dist/client/storefront/blocks/gallery.d.ts +4 -0
  175. package/dist/client/storefront/blocks/gallery.d.ts.map +1 -0
  176. package/dist/client/storefront/blocks/gallery.mjs +47 -0
  177. package/dist/client/storefront/blocks/gallery.mjs.map +1 -0
  178. package/dist/client/storefront/blocks/hero.d.ts +4 -0
  179. package/dist/client/storefront/blocks/hero.d.ts.map +1 -0
  180. package/dist/client/storefront/blocks/hero.mjs +357 -0
  181. package/dist/client/storefront/blocks/hero.mjs.map +1 -0
  182. package/dist/client/storefront/blocks/image-block.d.ts +4 -0
  183. package/dist/client/storefront/blocks/image-block.d.ts.map +1 -0
  184. package/dist/client/storefront/blocks/image-block.mjs +29 -0
  185. package/dist/client/storefront/blocks/image-block.mjs.map +1 -0
  186. package/dist/client/storefront/blocks/index.d.ts +20 -0
  187. package/dist/client/storefront/blocks/index.d.ts.map +1 -0
  188. package/dist/client/storefront/blocks/index.mjs +41 -0
  189. package/dist/client/storefront/blocks/index.mjs.map +1 -0
  190. package/dist/client/storefront/blocks/link-block-small.d.ts +4 -0
  191. package/dist/client/storefront/blocks/link-block-small.d.ts.map +1 -0
  192. package/dist/client/storefront/blocks/link-block-small.mjs +35 -0
  193. package/dist/client/storefront/blocks/link-block-small.mjs.map +1 -0
  194. package/dist/client/storefront/blocks/link-block.d.ts +4 -0
  195. package/dist/client/storefront/blocks/link-block.d.ts.map +1 -0
  196. package/dist/client/storefront/blocks/link-block.mjs +150 -0
  197. package/dist/client/storefront/blocks/link-block.mjs.map +1 -0
  198. package/dist/client/storefront/blocks/product-card.d.ts +4 -0
  199. package/dist/client/storefront/blocks/product-card.d.ts.map +1 -0
  200. package/dist/client/storefront/blocks/product-card.mjs +228 -0
  201. package/dist/client/storefront/blocks/product-card.mjs.map +1 -0
  202. package/dist/client/storefront/blocks/product-image.d.ts +4 -0
  203. package/dist/client/storefront/blocks/product-image.d.ts.map +1 -0
  204. package/dist/client/storefront/blocks/product-image.mjs +109 -0
  205. package/dist/client/storefront/blocks/product-image.mjs.map +1 -0
  206. package/dist/client/storefront/blocks/spacer.d.ts +4 -0
  207. package/dist/client/storefront/blocks/spacer.d.ts.map +1 -0
  208. package/dist/client/storefront/blocks/spacer.mjs +14 -0
  209. package/dist/client/storefront/blocks/spacer.mjs.map +1 -0
  210. package/dist/client/storefront/blocks/text-content-with-image.d.ts +4 -0
  211. package/dist/client/storefront/blocks/text-content-with-image.d.ts.map +1 -0
  212. package/dist/client/storefront/blocks/text-content-with-image.mjs +225 -0
  213. package/dist/client/storefront/blocks/text-content-with-image.mjs.map +1 -0
  214. package/dist/client/storefront/blocks/text-content.d.ts +4 -0
  215. package/dist/client/storefront/blocks/text-content.d.ts.map +1 -0
  216. package/dist/client/storefront/blocks/text-content.mjs +150 -0
  217. package/dist/client/storefront/blocks/text-content.mjs.map +1 -0
  218. package/dist/client/storefront/blocks/truncated-text.d.ts +4 -0
  219. package/dist/client/storefront/blocks/truncated-text.d.ts.map +1 -0
  220. package/dist/client/storefront/blocks/truncated-text.mjs +36 -0
  221. package/dist/client/storefront/blocks/truncated-text.mjs.map +1 -0
  222. package/dist/client/storefront/blocks/variable-text-content.d.ts +4 -0
  223. package/dist/client/storefront/blocks/variable-text-content.d.ts.map +1 -0
  224. package/dist/client/storefront/blocks/variable-text-content.mjs +15 -0
  225. package/dist/client/storefront/blocks/variable-text-content.mjs.map +1 -0
  226. package/dist/client/storefront/carousel/index.d.ts +2 -0
  227. package/dist/client/storefront/carousel/index.d.ts.map +1 -0
  228. package/dist/client/storefront/carousel/index.mjs +5 -0
  229. package/dist/client/storefront/carousel/index.mjs.map +1 -0
  230. package/dist/client/storefront/carousel/swipeable-carousel.d.ts +14 -0
  231. package/dist/client/storefront/carousel/swipeable-carousel.d.ts.map +1 -0
  232. package/dist/client/storefront/carousel/swipeable-carousel.mjs +80 -0
  233. package/dist/client/storefront/carousel/swipeable-carousel.mjs.map +1 -0
  234. package/dist/client/storefront/checkout/address-form.d.ts +31 -0
  235. package/dist/client/storefront/checkout/address-form.d.ts.map +1 -0
  236. package/dist/client/storefront/checkout/address-form.mjs +124 -0
  237. package/dist/client/storefront/checkout/address-form.mjs.map +1 -0
  238. package/dist/client/storefront/checkout/cart-summary.d.ts +40 -0
  239. package/dist/client/storefront/checkout/cart-summary.d.ts.map +1 -0
  240. package/dist/client/storefront/checkout/cart-summary.mjs +150 -0
  241. package/dist/client/storefront/checkout/cart-summary.mjs.map +1 -0
  242. package/dist/client/storefront/checkout/checkout-stepper.d.ts +13 -0
  243. package/dist/client/storefront/checkout/checkout-stepper.d.ts.map +1 -0
  244. package/dist/client/storefront/checkout/checkout-stepper.mjs +58 -0
  245. package/dist/client/storefront/checkout/checkout-stepper.mjs.map +1 -0
  246. package/dist/client/storefront/checkout/index.d.ts +15 -0
  247. package/dist/client/storefront/checkout/index.d.ts.map +1 -0
  248. package/dist/client/storefront/checkout/index.mjs +17 -0
  249. package/dist/client/storefront/checkout/index.mjs.map +1 -0
  250. package/dist/client/storefront/checkout/order-confirmation.d.ts +10 -0
  251. package/dist/client/storefront/checkout/order-confirmation.d.ts.map +1 -0
  252. package/dist/client/storefront/checkout/order-confirmation.mjs +27 -0
  253. package/dist/client/storefront/checkout/order-confirmation.mjs.map +1 -0
  254. package/dist/client/storefront/checkout/order-summary.d.ts +29 -0
  255. package/dist/client/storefront/checkout/order-summary.d.ts.map +1 -0
  256. package/dist/client/storefront/checkout/order-summary.mjs +106 -0
  257. package/dist/client/storefront/checkout/order-summary.mjs.map +1 -0
  258. package/dist/client/storefront/checkout/payment-method-selector.d.ts +18 -0
  259. package/dist/client/storefront/checkout/payment-method-selector.d.ts.map +1 -0
  260. package/dist/client/storefront/checkout/payment-method-selector.mjs +61 -0
  261. package/dist/client/storefront/checkout/payment-method-selector.mjs.map +1 -0
  262. package/dist/client/storefront/checkout/shipping-method-selector.d.ts +23 -0
  263. package/dist/client/storefront/checkout/shipping-method-selector.d.ts.map +1 -0
  264. package/dist/client/storefront/checkout/shipping-method-selector.mjs +77 -0
  265. package/dist/client/storefront/checkout/shipping-method-selector.mjs.map +1 -0
  266. package/dist/client/storefront/components/badge.d.ts +8 -0
  267. package/dist/client/storefront/components/badge.d.ts.map +1 -0
  268. package/dist/client/storefront/components/badge.mjs +28 -0
  269. package/dist/client/storefront/components/badge.mjs.map +1 -0
  270. package/dist/client/storefront/components/country-redirect.d.ts +30 -0
  271. package/dist/client/storefront/components/country-redirect.d.ts.map +1 -0
  272. package/dist/client/storefront/components/country-redirect.mjs +121 -0
  273. package/dist/client/storefront/components/country-redirect.mjs.map +1 -0
  274. package/dist/client/storefront/components/empty-state.d.ts +38 -0
  275. package/dist/client/storefront/components/empty-state.d.ts.map +1 -0
  276. package/dist/client/storefront/components/empty-state.mjs +55 -0
  277. package/dist/client/storefront/components/empty-state.mjs.map +1 -0
  278. package/dist/client/storefront/components/image-lightbox.d.ts +13 -0
  279. package/dist/client/storefront/components/image-lightbox.d.ts.map +1 -0
  280. package/dist/client/storefront/components/image-lightbox.mjs +275 -0
  281. package/dist/client/storefront/components/image-lightbox.mjs.map +1 -0
  282. package/dist/client/storefront/components/infinite-scroll.d.ts +37 -0
  283. package/dist/client/storefront/components/infinite-scroll.d.ts.map +1 -0
  284. package/dist/client/storefront/components/infinite-scroll.mjs +83 -0
  285. package/dist/client/storefront/components/infinite-scroll.mjs.map +1 -0
  286. package/dist/client/storefront/components/language-selector.d.ts +5 -0
  287. package/dist/client/storefront/components/language-selector.d.ts.map +1 -0
  288. package/dist/client/storefront/components/language-selector.mjs +58 -0
  289. package/dist/client/storefront/components/language-selector.mjs.map +1 -0
  290. package/dist/client/storefront/components/newsletter-signup.d.ts +14 -0
  291. package/dist/client/storefront/components/newsletter-signup.d.ts.map +1 -0
  292. package/dist/client/storefront/components/newsletter-signup.mjs +81 -0
  293. package/dist/client/storefront/components/newsletter-signup.mjs.map +1 -0
  294. package/dist/client/storefront/components/price.d.ts +14 -0
  295. package/dist/client/storefront/components/price.d.ts.map +1 -0
  296. package/dist/client/storefront/components/price.mjs +46 -0
  297. package/dist/client/storefront/components/price.mjs.map +1 -0
  298. package/dist/client/storefront/components/product-recommendations.d.ts +18 -0
  299. package/dist/client/storefront/components/product-recommendations.d.ts.map +1 -0
  300. package/dist/client/storefront/components/product-recommendations.mjs +108 -0
  301. package/dist/client/storefront/components/product-recommendations.mjs.map +1 -0
  302. package/dist/client/storefront/components/product-tabs.d.ts +12 -0
  303. package/dist/client/storefront/components/product-tabs.d.ts.map +1 -0
  304. package/dist/client/storefront/components/product-tabs.mjs +64 -0
  305. package/dist/client/storefront/components/product-tabs.mjs.map +1 -0
  306. package/dist/client/storefront/components/quick-view.d.ts +25 -0
  307. package/dist/client/storefront/components/quick-view.d.ts.map +1 -0
  308. package/dist/client/storefront/components/quick-view.mjs +149 -0
  309. package/dist/client/storefront/components/quick-view.mjs.map +1 -0
  310. package/dist/client/storefront/components/review-summary.d.ts +17 -0
  311. package/dist/client/storefront/components/review-summary.d.ts.map +1 -0
  312. package/dist/client/storefront/components/review-summary.mjs +66 -0
  313. package/dist/client/storefront/components/review-summary.mjs.map +1 -0
  314. package/dist/client/storefront/components/search-autocomplete.d.ts +25 -0
  315. package/dist/client/storefront/components/search-autocomplete.d.ts.map +1 -0
  316. package/dist/client/storefront/components/search-autocomplete.mjs +183 -0
  317. package/dist/client/storefront/components/search-autocomplete.mjs.map +1 -0
  318. package/dist/client/storefront/components/section-nav.d.ts +20 -0
  319. package/dist/client/storefront/components/section-nav.d.ts.map +1 -0
  320. package/dist/client/storefront/components/section-nav.mjs +175 -0
  321. package/dist/client/storefront/components/section-nav.mjs.map +1 -0
  322. package/dist/client/storefront/components/share-button.d.ts +19 -0
  323. package/dist/client/storefront/components/share-button.d.ts.map +1 -0
  324. package/dist/client/storefront/components/share-button.mjs +95 -0
  325. package/dist/client/storefront/components/share-button.mjs.map +1 -0
  326. package/dist/client/storefront/components/skeleton.d.ts +12 -0
  327. package/dist/client/storefront/components/skeleton.d.ts.map +1 -0
  328. package/dist/client/storefront/components/skeleton.mjs +70 -0
  329. package/dist/client/storefront/components/skeleton.mjs.map +1 -0
  330. package/dist/client/storefront/components/star-rating.d.ts +13 -0
  331. package/dist/client/storefront/components/star-rating.d.ts.map +1 -0
  332. package/dist/client/storefront/components/star-rating.mjs +240 -0
  333. package/dist/client/storefront/components/star-rating.mjs.map +1 -0
  334. package/dist/client/storefront/components/testimonial.d.ts +20 -0
  335. package/dist/client/storefront/components/testimonial.d.ts.map +1 -0
  336. package/dist/client/storefront/components/testimonial.mjs +53 -0
  337. package/dist/client/storefront/components/testimonial.mjs.map +1 -0
  338. package/dist/client/storefront/components/trust-badges.d.ts +14 -0
  339. package/dist/client/storefront/components/trust-badges.d.ts.map +1 -0
  340. package/dist/client/storefront/components/trust-badges.mjs +25 -0
  341. package/dist/client/storefront/components/trust-badges.mjs.map +1 -0
  342. package/dist/client/storefront/components/variant-selector.d.ts +21 -0
  343. package/dist/client/storefront/components/variant-selector.d.ts.map +1 -0
  344. package/dist/client/storefront/components/variant-selector.mjs +41 -0
  345. package/dist/client/storefront/components/variant-selector.mjs.map +1 -0
  346. package/dist/client/storefront/components/wishlist-toggle.d.ts +12 -0
  347. package/dist/client/storefront/components/wishlist-toggle.d.ts.map +1 -0
  348. package/dist/client/storefront/components/wishlist-toggle.mjs +58 -0
  349. package/dist/client/storefront/components/wishlist-toggle.mjs.map +1 -0
  350. package/dist/client/storefront/filters/filter-chip.d.ts +10 -0
  351. package/dist/client/storefront/filters/filter-chip.d.ts.map +1 -0
  352. package/dist/client/storefront/filters/filter-chip.mjs +30 -0
  353. package/dist/client/storefront/filters/filter-chip.mjs.map +1 -0
  354. package/dist/client/storefront/filters/filter-group.d.ts +22 -0
  355. package/dist/client/storefront/filters/filter-group.d.ts.map +1 -0
  356. package/dist/client/storefront/filters/filter-group.mjs +102 -0
  357. package/dist/client/storefront/filters/filter-group.mjs.map +1 -0
  358. package/dist/client/storefront/filters/filter-panel.d.ts +25 -0
  359. package/dist/client/storefront/filters/filter-panel.d.ts.map +1 -0
  360. package/dist/client/storefront/filters/filter-panel.mjs +110 -0
  361. package/dist/client/storefront/filters/filter-panel.mjs.map +1 -0
  362. package/dist/client/storefront/filters/index.d.ts +6 -0
  363. package/dist/client/storefront/filters/index.d.ts.map +1 -0
  364. package/dist/client/storefront/filters/index.mjs +13 -0
  365. package/dist/client/storefront/filters/index.mjs.map +1 -0
  366. package/dist/client/storefront/filters/sort-select.d.ts +12 -0
  367. package/dist/client/storefront/filters/sort-select.d.ts.map +1 -0
  368. package/dist/client/storefront/filters/sort-select.mjs +34 -0
  369. package/dist/client/storefront/filters/sort-select.mjs.map +1 -0
  370. package/dist/client/storefront/filters/toggle-list-view.d.ts +8 -0
  371. package/dist/client/storefront/filters/toggle-list-view.d.ts.map +1 -0
  372. package/dist/client/storefront/filters/toggle-list-view.mjs +30 -0
  373. package/dist/client/storefront/filters/toggle-list-view.mjs.map +1 -0
  374. package/dist/client/storefront/hooks/use-section-observer.d.ts +12 -0
  375. package/dist/client/storefront/hooks/use-section-observer.d.ts.map +1 -0
  376. package/dist/client/storefront/hooks/use-section-observer.mjs +46 -0
  377. package/dist/client/storefront/hooks/use-section-observer.mjs.map +1 -0
  378. package/dist/client/storefront/index.d.ts +24 -0
  379. package/dist/client/storefront/index.d.ts.map +1 -0
  380. package/dist/client/storefront/index.mjs +26 -0
  381. package/dist/client/storefront/index.mjs.map +1 -0
  382. package/dist/client/storefront/layout/footer.d.ts +4 -0
  383. package/dist/client/storefront/layout/footer.d.ts.map +1 -0
  384. package/dist/client/storefront/layout/footer.mjs +56 -0
  385. package/dist/client/storefront/layout/footer.mjs.map +1 -0
  386. package/dist/client/storefront/layout/header.d.ts +4 -0
  387. package/dist/client/storefront/layout/header.d.ts.map +1 -0
  388. package/dist/client/storefront/layout/header.mjs +367 -0
  389. package/dist/client/storefront/layout/header.mjs.map +1 -0
  390. package/dist/client/storefront/layout/index.d.ts +5 -0
  391. package/dist/client/storefront/layout/index.d.ts.map +1 -0
  392. package/dist/client/storefront/layout/index.mjs +11 -0
  393. package/dist/client/storefront/layout/index.mjs.map +1 -0
  394. package/dist/client/storefront/layout/mobile-menu-drawer.d.ts +4 -0
  395. package/dist/client/storefront/layout/mobile-menu-drawer.d.ts.map +1 -0
  396. package/dist/client/storefront/layout/mobile-menu-drawer.mjs +93 -0
  397. package/dist/client/storefront/layout/mobile-menu-drawer.mjs.map +1 -0
  398. package/dist/client/storefront/layout/promotion-bar.d.ts +4 -0
  399. package/dist/client/storefront/layout/promotion-bar.d.ts.map +1 -0
  400. package/dist/client/storefront/layout/promotion-bar.mjs +79 -0
  401. package/dist/client/storefront/layout/promotion-bar.mjs.map +1 -0
  402. package/dist/client/storefront/primitives/breadcrumbs.d.ts +12 -0
  403. package/dist/client/storefront/primitives/breadcrumbs.d.ts.map +1 -0
  404. package/dist/client/storefront/primitives/breadcrumbs.mjs +37 -0
  405. package/dist/client/storefront/primitives/breadcrumbs.mjs.map +1 -0
  406. package/dist/client/storefront/primitives/button.d.ts +12 -0
  407. package/dist/client/storefront/primitives/button.d.ts.map +1 -0
  408. package/dist/client/storefront/primitives/button.mjs +51 -0
  409. package/dist/client/storefront/primitives/button.mjs.map +1 -0
  410. package/dist/client/storefront/primitives/checkbox.d.ts +10 -0
  411. package/dist/client/storefront/primitives/checkbox.d.ts.map +1 -0
  412. package/dist/client/storefront/primitives/checkbox.mjs +23 -0
  413. package/dist/client/storefront/primitives/checkbox.mjs.map +1 -0
  414. package/dist/client/storefront/primitives/download-item.d.ts +9 -0
  415. package/dist/client/storefront/primitives/download-item.d.ts.map +1 -0
  416. package/dist/client/storefront/primitives/download-item.mjs +28 -0
  417. package/dist/client/storefront/primitives/download-item.mjs.map +1 -0
  418. package/dist/client/storefront/primitives/index.d.ts +10 -0
  419. package/dist/client/storefront/primitives/index.d.ts.map +1 -0
  420. package/dist/client/storefront/primitives/index.mjs +21 -0
  421. package/dist/client/storefront/primitives/index.mjs.map +1 -0
  422. package/dist/client/storefront/primitives/input.d.ts +18 -0
  423. package/dist/client/storefront/primitives/input.d.ts.map +1 -0
  424. package/dist/client/storefront/primitives/input.mjs +118 -0
  425. package/dist/client/storefront/primitives/input.mjs.map +1 -0
  426. package/dist/client/storefront/primitives/pagination.d.ts +9 -0
  427. package/dist/client/storefront/primitives/pagination.d.ts.map +1 -0
  428. package/dist/client/storefront/primitives/pagination.mjs +86 -0
  429. package/dist/client/storefront/primitives/pagination.mjs.map +1 -0
  430. package/dist/client/storefront/primitives/quick-links.d.ts +11 -0
  431. package/dist/client/storefront/primitives/quick-links.d.ts.map +1 -0
  432. package/dist/client/storefront/primitives/quick-links.mjs +17 -0
  433. package/dist/client/storefront/primitives/quick-links.mjs.map +1 -0
  434. package/dist/client/storefront/primitives/select.d.ts +16 -0
  435. package/dist/client/storefront/primitives/select.d.ts.map +1 -0
  436. package/dist/client/storefront/primitives/select.mjs +35 -0
  437. package/dist/client/storefront/primitives/select.mjs.map +1 -0
  438. package/dist/client/storefront/primitives/text-link.d.ts +7 -0
  439. package/dist/client/storefront/primitives/text-link.d.ts.map +1 -0
  440. package/dist/client/storefront/primitives/text-link.mjs +10 -0
  441. package/dist/client/storefront/primitives/text-link.mjs.map +1 -0
  442. package/dist/client/storefront/product/color-swatch.d.ts +10 -0
  443. package/dist/client/storefront/product/color-swatch.d.ts.map +1 -0
  444. package/dist/client/storefront/product/color-swatch.mjs +32 -0
  445. package/dist/client/storefront/product/color-swatch.mjs.map +1 -0
  446. package/dist/client/storefront/product/index.d.ts +5 -0
  447. package/dist/client/storefront/product/index.d.ts.map +1 -0
  448. package/dist/client/storefront/product/index.mjs +11 -0
  449. package/dist/client/storefront/product/index.mjs.map +1 -0
  450. package/dist/client/storefront/product/material-selector.d.ts +15 -0
  451. package/dist/client/storefront/product/material-selector.d.ts.map +1 -0
  452. package/dist/client/storefront/product/material-selector.mjs +35 -0
  453. package/dist/client/storefront/product/material-selector.mjs.map +1 -0
  454. package/dist/client/storefront/product/product-usp.d.ts +7 -0
  455. package/dist/client/storefront/product/product-usp.d.ts.map +1 -0
  456. package/dist/client/storefront/product/product-usp.mjs +14 -0
  457. package/dist/client/storefront/product/product-usp.mjs.map +1 -0
  458. package/dist/client/storefront/product/quantity-picker.d.ts +10 -0
  459. package/dist/client/storefront/product/quantity-picker.d.ts.map +1 -0
  460. package/dist/client/storefront/product/quantity-picker.mjs +56 -0
  461. package/dist/client/storefront/product/quantity-picker.mjs.map +1 -0
  462. package/dist/client/storefront/types.d.ts +284 -0
  463. package/dist/client/storefront/types.d.ts.map +1 -0
  464. package/dist/client/storefront/types.mjs +20 -0
  465. package/dist/client/storefront/types.mjs.map +1 -0
  466. package/dist/client/theme/apply.d.ts +17 -0
  467. package/dist/client/theme/apply.d.ts.map +1 -0
  468. package/dist/client/theme/apply.mjs +133 -0
  469. package/dist/client/theme/apply.mjs.map +1 -0
  470. package/dist/client/theme/cli.d.ts +2 -0
  471. package/dist/client/theme/cli.d.ts.map +1 -0
  472. package/dist/client/theme/cli.mjs +453 -0
  473. package/dist/client/theme/cli.mjs.map +1 -0
  474. package/dist/client/theme/codec.d.ts +28 -0
  475. package/dist/client/theme/codec.d.ts.map +1 -0
  476. package/dist/client/theme/codec.mjs +88 -0
  477. package/dist/client/theme/codec.mjs.map +1 -0
  478. package/dist/client/theme/defaults.d.ts +64 -0
  479. package/dist/client/theme/defaults.d.ts.map +1 -0
  480. package/dist/client/theme/defaults.mjs +158 -0
  481. package/dist/client/theme/defaults.mjs.map +1 -0
  482. package/dist/client/theme/index.d.ts +8 -0
  483. package/dist/client/theme/index.d.ts.map +1 -0
  484. package/dist/client/theme/index.mjs +20 -0
  485. package/dist/client/theme/index.mjs.map +1 -0
  486. package/dist/client/theme/scan.d.ts +16 -0
  487. package/dist/client/theme/scan.d.ts.map +1 -0
  488. package/dist/client/theme/scan.mjs +25 -0
  489. package/dist/client/theme/scan.mjs.map +1 -0
  490. package/dist/client/ui/accordion.d.ts +8 -0
  491. package/dist/client/ui/accordion.d.ts.map +1 -0
  492. package/dist/client/ui/accordion.mjs +66 -0
  493. package/dist/client/ui/accordion.mjs.map +1 -0
  494. package/dist/client/ui/breadcrumb.d.ts +12 -0
  495. package/dist/client/ui/breadcrumb.d.ts.map +1 -0
  496. package/dist/client/ui/breadcrumb.mjs +104 -0
  497. package/dist/client/ui/breadcrumb.mjs.map +1 -0
  498. package/dist/client/ui/button.d.ts +11 -0
  499. package/dist/client/ui/button.d.ts.map +1 -0
  500. package/dist/client/ui/button.mjs +57 -0
  501. package/dist/client/ui/button.mjs.map +1 -0
  502. package/dist/client/ui/card.d.ts +10 -0
  503. package/dist/client/ui/card.d.ts.map +1 -0
  504. package/dist/client/ui/card.mjs +91 -0
  505. package/dist/client/ui/card.mjs.map +1 -0
  506. package/dist/client/ui/carousel.d.ts +20 -0
  507. package/dist/client/ui/carousel.d.ts.map +1 -0
  508. package/dist/client/ui/carousel.mjs +202 -0
  509. package/dist/client/ui/carousel.mjs.map +1 -0
  510. package/dist/client/ui/checkbox.d.ts +5 -0
  511. package/dist/client/ui/checkbox.d.ts.map +1 -0
  512. package/dist/client/ui/checkbox.mjs +34 -0
  513. package/dist/client/ui/checkbox.mjs.map +1 -0
  514. package/dist/client/ui/collapsible.d.ts +6 -0
  515. package/dist/client/ui/collapsible.d.ts.map +1 -0
  516. package/dist/client/ui/collapsible.mjs +36 -0
  517. package/dist/client/ui/collapsible.mjs.map +1 -0
  518. package/dist/client/ui/input.d.ts +4 -0
  519. package/dist/client/ui/input.d.ts.map +1 -0
  520. package/dist/client/ui/input.mjs +22 -0
  521. package/dist/client/ui/input.mjs.map +1 -0
  522. package/dist/client/ui/label.d.ts +5 -0
  523. package/dist/client/ui/label.d.ts.map +1 -0
  524. package/dist/client/ui/label.mjs +23 -0
  525. package/dist/client/ui/label.mjs.map +1 -0
  526. package/dist/client/ui/mid-truncate.d.ts +27 -0
  527. package/dist/client/ui/mid-truncate.d.ts.map +1 -0
  528. package/dist/client/ui/mid-truncate.mjs +25 -0
  529. package/dist/client/ui/mid-truncate.mjs.map +1 -0
  530. package/dist/client/ui/navigation-menu.d.ts +15 -0
  531. package/dist/client/ui/navigation-menu.d.ts.map +1 -0
  532. package/dist/client/ui/navigation-menu.mjs +172 -0
  533. package/dist/client/ui/navigation-menu.mjs.map +1 -0
  534. package/dist/client/ui/pagination.d.ts +14 -0
  535. package/dist/client/ui/pagination.d.ts.map +1 -0
  536. package/dist/client/ui/pagination.mjs +124 -0
  537. package/dist/client/ui/pagination.mjs.map +1 -0
  538. package/dist/client/ui/popover.d.ts +11 -0
  539. package/dist/client/ui/popover.d.ts.map +1 -0
  540. package/dist/client/ui/popover.mjs +82 -0
  541. package/dist/client/ui/popover.mjs.map +1 -0
  542. package/dist/client/ui/select.d.ts +16 -0
  543. package/dist/client/ui/select.d.ts.map +1 -0
  544. package/dist/client/ui/select.mjs +183 -0
  545. package/dist/client/ui/select.mjs.map +1 -0
  546. package/dist/client/ui/separator.d.ts +5 -0
  547. package/dist/client/ui/separator.d.ts.map +1 -0
  548. package/dist/client/ui/separator.mjs +27 -0
  549. package/dist/client/ui/separator.mjs.map +1 -0
  550. package/dist/client/ui/sheet.d.ts +15 -0
  551. package/dist/client/ui/sheet.d.ts.map +1 -0
  552. package/dist/client/ui/sheet.mjs +130 -0
  553. package/dist/client/ui/sheet.mjs.map +1 -0
  554. package/dist/client/ui/toggle-group.d.ts +10 -0
  555. package/dist/client/ui/toggle-group.d.ts.map +1 -0
  556. package/dist/client/ui/toggle-group.mjs +69 -0
  557. package/dist/client/ui/toggle-group.mjs.map +1 -0
  558. package/dist/client/ui/toggle.d.ts +10 -0
  559. package/dist/client/ui/toggle.d.ts.map +1 -0
  560. package/dist/client/ui/toggle.mjs +44 -0
  561. package/dist/client/ui/toggle.mjs.map +1 -0
  562. package/dist/client/ui/utils.d.ts +3 -0
  563. package/dist/client/ui/utils.d.ts.map +1 -0
  564. package/dist/client/ui/utils.mjs +9 -0
  565. package/dist/client/ui/utils.mjs.map +1 -0
  566. package/dist/client/ui-interfaces/accordion.d.ts +8 -0
  567. package/dist/client/ui-interfaces/accordion.d.ts.map +1 -0
  568. package/dist/client/ui-interfaces/accordion.mjs +72 -0
  569. package/dist/client/ui-interfaces/accordion.mjs.map +1 -0
  570. package/dist/client/ui-interfaces/breadcrumb.d.ts +12 -0
  571. package/dist/client/ui-interfaces/breadcrumb.d.ts.map +1 -0
  572. package/dist/client/ui-interfaces/breadcrumb.mjs +97 -0
  573. package/dist/client/ui-interfaces/breadcrumb.mjs.map +1 -0
  574. package/dist/client/ui-interfaces/button.d.ts +11 -0
  575. package/dist/client/ui-interfaces/button.d.ts.map +1 -0
  576. package/dist/client/ui-interfaces/button.mjs +57 -0
  577. package/dist/client/ui-interfaces/button.mjs.map +1 -0
  578. package/dist/client/ui-interfaces/card.d.ts +10 -0
  579. package/dist/client/ui-interfaces/card.d.ts.map +1 -0
  580. package/dist/client/ui-interfaces/card.mjs +78 -0
  581. package/dist/client/ui-interfaces/card.mjs.map +1 -0
  582. package/dist/client/ui-interfaces/carousel.d.ts +20 -0
  583. package/dist/client/ui-interfaces/carousel.d.ts.map +1 -0
  584. package/dist/client/ui-interfaces/carousel.mjs +188 -0
  585. package/dist/client/ui-interfaces/carousel.mjs.map +1 -0
  586. package/dist/client/ui-interfaces/checkbox.d.ts +5 -0
  587. package/dist/client/ui-interfaces/checkbox.d.ts.map +1 -0
  588. package/dist/client/ui-interfaces/checkbox.mjs +30 -0
  589. package/dist/client/ui-interfaces/checkbox.mjs.map +1 -0
  590. package/dist/client/ui-interfaces/collapsible.d.ts +7 -0
  591. package/dist/client/ui-interfaces/collapsible.d.ts.map +1 -0
  592. package/dist/client/ui-interfaces/collapsible.mjs +42 -0
  593. package/dist/client/ui-interfaces/collapsible.mjs.map +1 -0
  594. package/dist/client/ui-interfaces/index.d.ts +18 -0
  595. package/dist/client/ui-interfaces/index.d.ts.map +1 -0
  596. package/dist/client/ui-interfaces/index.mjs +18 -0
  597. package/dist/client/ui-interfaces/index.mjs.map +1 -0
  598. package/dist/client/ui-interfaces/input.d.ts +7 -0
  599. package/dist/client/ui-interfaces/input.d.ts.map +1 -0
  600. package/dist/client/ui-interfaces/input.mjs +39 -0
  601. package/dist/client/ui-interfaces/input.mjs.map +1 -0
  602. package/dist/client/ui-interfaces/label.d.ts +5 -0
  603. package/dist/client/ui-interfaces/label.d.ts.map +1 -0
  604. package/dist/client/ui-interfaces/label.mjs +23 -0
  605. package/dist/client/ui-interfaces/label.mjs.map +1 -0
  606. package/dist/client/ui-interfaces/navigation-menu.d.ts +15 -0
  607. package/dist/client/ui-interfaces/navigation-menu.d.ts.map +1 -0
  608. package/dist/client/ui-interfaces/navigation-menu.mjs +163 -0
  609. package/dist/client/ui-interfaces/navigation-menu.mjs.map +1 -0
  610. package/dist/client/ui-interfaces/pagination.d.ts +14 -0
  611. package/dist/client/ui-interfaces/pagination.d.ts.map +1 -0
  612. package/dist/client/ui-interfaces/pagination.mjs +103 -0
  613. package/dist/client/ui-interfaces/pagination.mjs.map +1 -0
  614. package/dist/client/ui-interfaces/popover.d.ts +8 -0
  615. package/dist/client/ui-interfaces/popover.d.ts.map +1 -0
  616. package/dist/client/ui-interfaces/popover.mjs +50 -0
  617. package/dist/client/ui-interfaces/popover.mjs.map +1 -0
  618. package/dist/client/ui-interfaces/select.d.ts +16 -0
  619. package/dist/client/ui-interfaces/select.d.ts.map +1 -0
  620. package/dist/client/ui-interfaces/select.mjs +159 -0
  621. package/dist/client/ui-interfaces/select.mjs.map +1 -0
  622. package/dist/client/ui-interfaces/separator.d.ts +5 -0
  623. package/dist/client/ui-interfaces/separator.d.ts.map +1 -0
  624. package/dist/client/ui-interfaces/separator.mjs +28 -0
  625. package/dist/client/ui-interfaces/separator.mjs.map +1 -0
  626. package/dist/client/ui-interfaces/sheet.d.ts +14 -0
  627. package/dist/client/ui-interfaces/sheet.d.ts.map +1 -0
  628. package/dist/client/ui-interfaces/sheet.mjs +140 -0
  629. package/dist/client/ui-interfaces/sheet.mjs.map +1 -0
  630. package/dist/client/ui-interfaces/toggle-group.d.ts +10 -0
  631. package/dist/client/ui-interfaces/toggle-group.d.ts.map +1 -0
  632. package/dist/client/ui-interfaces/toggle-group.mjs +67 -0
  633. package/dist/client/ui-interfaces/toggle-group.mjs.map +1 -0
  634. package/dist/client/ui-interfaces/toggle.d.ts +10 -0
  635. package/dist/client/ui-interfaces/toggle.d.ts.map +1 -0
  636. package/dist/client/ui-interfaces/toggle.mjs +45 -0
  637. package/dist/client/ui-interfaces/toggle.mjs.map +1 -0
  638. package/dist/client/ui-resolver/accordion.d.ts +11 -0
  639. package/dist/client/ui-resolver/accordion.d.ts.map +1 -0
  640. package/dist/client/ui-resolver/accordion.mjs +35 -0
  641. package/dist/client/ui-resolver/accordion.mjs.map +1 -0
  642. package/dist/client/ui-resolver/breadcrumb.d.ts +14 -0
  643. package/dist/client/ui-resolver/breadcrumb.d.ts.map +1 -0
  644. package/dist/client/ui-resolver/breadcrumb.mjs +53 -0
  645. package/dist/client/ui-resolver/breadcrumb.mjs.map +1 -0
  646. package/dist/client/ui-resolver/button.d.ts +12 -0
  647. package/dist/client/ui-resolver/button.d.ts.map +1 -0
  648. package/dist/client/ui-resolver/button.mjs +25 -0
  649. package/dist/client/ui-resolver/button.mjs.map +1 -0
  650. package/dist/client/ui-resolver/card.d.ts +14 -0
  651. package/dist/client/ui-resolver/card.d.ts.map +1 -0
  652. package/dist/client/ui-resolver/card.mjs +53 -0
  653. package/dist/client/ui-resolver/card.mjs.map +1 -0
  654. package/dist/client/ui-resolver/carousel.d.ts +13 -0
  655. package/dist/client/ui-resolver/carousel.d.ts.map +1 -0
  656. package/dist/client/ui-resolver/carousel.mjs +41 -0
  657. package/dist/client/ui-resolver/carousel.mjs.map +1 -0
  658. package/dist/client/ui-resolver/checkbox.d.ts +8 -0
  659. package/dist/client/ui-resolver/checkbox.d.ts.map +1 -0
  660. package/dist/client/ui-resolver/checkbox.mjs +17 -0
  661. package/dist/client/ui-resolver/checkbox.mjs.map +1 -0
  662. package/dist/client/ui-resolver/collapsible.d.ts +10 -0
  663. package/dist/client/ui-resolver/collapsible.d.ts.map +1 -0
  664. package/dist/client/ui-resolver/collapsible.mjs +29 -0
  665. package/dist/client/ui-resolver/collapsible.mjs.map +1 -0
  666. package/dist/client/ui-resolver/context.d.ts +10 -0
  667. package/dist/client/ui-resolver/context.d.ts.map +1 -0
  668. package/dist/client/ui-resolver/context.mjs +28 -0
  669. package/dist/client/ui-resolver/context.mjs.map +1 -0
  670. package/dist/client/ui-resolver/index.d.ts +19 -0
  671. package/dist/client/ui-resolver/index.d.ts.map +1 -0
  672. package/dist/client/ui-resolver/index.mjs +156 -0
  673. package/dist/client/ui-resolver/index.mjs.map +1 -0
  674. package/dist/client/ui-resolver/input.d.ts +8 -0
  675. package/dist/client/ui-resolver/input.d.ts.map +1 -0
  676. package/dist/client/ui-resolver/input.mjs +17 -0
  677. package/dist/client/ui-resolver/input.mjs.map +1 -0
  678. package/dist/client/ui-resolver/label.d.ts +8 -0
  679. package/dist/client/ui-resolver/label.d.ts.map +1 -0
  680. package/dist/client/ui-resolver/label.mjs +17 -0
  681. package/dist/client/ui-resolver/label.mjs.map +1 -0
  682. package/dist/client/ui-resolver/navigation-menu.d.ts +16 -0
  683. package/dist/client/ui-resolver/navigation-menu.d.ts.map +1 -0
  684. package/dist/client/ui-resolver/navigation-menu.mjs +64 -0
  685. package/dist/client/ui-resolver/navigation-menu.mjs.map +1 -0
  686. package/dist/client/ui-resolver/pagination.d.ts +14 -0
  687. package/dist/client/ui-resolver/pagination.d.ts.map +1 -0
  688. package/dist/client/ui-resolver/pagination.mjs +53 -0
  689. package/dist/client/ui-resolver/pagination.mjs.map +1 -0
  690. package/dist/client/ui-resolver/popover.d.ts +11 -0
  691. package/dist/client/ui-resolver/popover.d.ts.map +1 -0
  692. package/dist/client/ui-resolver/popover.mjs +35 -0
  693. package/dist/client/ui-resolver/popover.mjs.map +1 -0
  694. package/dist/client/ui-resolver/select.d.ts +15 -0
  695. package/dist/client/ui-resolver/select.d.ts.map +1 -0
  696. package/dist/client/ui-resolver/select.mjs +59 -0
  697. package/dist/client/ui-resolver/select.mjs.map +1 -0
  698. package/dist/client/ui-resolver/separator.d.ts +8 -0
  699. package/dist/client/ui-resolver/separator.d.ts.map +1 -0
  700. package/dist/client/ui-resolver/separator.mjs +17 -0
  701. package/dist/client/ui-resolver/separator.mjs.map +1 -0
  702. package/dist/client/ui-resolver/sheet.d.ts +15 -0
  703. package/dist/client/ui-resolver/sheet.d.ts.map +1 -0
  704. package/dist/client/ui-resolver/sheet.mjs +59 -0
  705. package/dist/client/ui-resolver/sheet.mjs.map +1 -0
  706. package/dist/client/ui-resolver/toggle-group.d.ts +9 -0
  707. package/dist/client/ui-resolver/toggle-group.d.ts.map +1 -0
  708. package/dist/client/ui-resolver/toggle-group.mjs +23 -0
  709. package/dist/client/ui-resolver/toggle-group.mjs.map +1 -0
  710. package/dist/client/ui-resolver/toggle.d.ts +12 -0
  711. package/dist/client/ui-resolver/toggle.d.ts.map +1 -0
  712. package/dist/client/ui-resolver/toggle.mjs +25 -0
  713. package/dist/client/ui-resolver/toggle.mjs.map +1 -0
  714. package/dist/client/user/actions/createResetPasswordLinkAction.d.ts +14 -0
  715. package/dist/client/user/actions/createResetPasswordLinkAction.d.ts.map +1 -0
  716. package/dist/client/user/actions/createResetPasswordLinkAction.mjs +1 -1
  717. package/dist/client/user/actions/createResetPasswordLinkAction.mjs.map +1 -1
  718. package/dist/client/user/actions/getUserAction.d.ts +3 -0
  719. package/dist/client/user/actions/getUserAction.d.ts.map +1 -0
  720. package/dist/client/user/actions/getUserAction.mjs.map +1 -1
  721. package/dist/client/user/actions/{logInUserAction.d.mts → logInUserAction.d.ts} +3 -3
  722. package/dist/client/user/actions/logInUserAction.d.ts.map +1 -0
  723. package/dist/client/user/actions/logoutUserAction.d.ts +2 -0
  724. package/dist/client/user/actions/logoutUserAction.d.ts.map +1 -0
  725. package/dist/client/user/actions/registerOrganisationAction.d.ts +9 -0
  726. package/dist/client/user/actions/registerOrganisationAction.d.ts.map +1 -0
  727. package/dist/client/user/actions/registerOrganisationAction.mjs.map +1 -1
  728. package/dist/client/user/actions/{registerUserAction.d.mts → registerUserAction.d.ts} +3 -3
  729. package/dist/client/user/actions/registerUserAction.d.ts.map +1 -0
  730. package/dist/client/user/actions/registerUserAction.mjs +1 -1
  731. package/dist/client/user/actions/registerUserAction.mjs.map +1 -1
  732. package/dist/client/user/actions/{registerUserWithoutRedirectAction.d.mts → registerUserWithoutRedirectAction.d.ts} +3 -6
  733. package/dist/client/user/actions/registerUserWithoutRedirectAction.d.ts.map +1 -0
  734. package/dist/client/user/actions/{updatePasswordAction.d.mts → updatePasswordAction.d.ts} +3 -3
  735. package/dist/client/user/actions/updatePasswordAction.d.ts.map +1 -0
  736. package/dist/client/user/actions/updatePasswordAction.mjs +1 -1
  737. package/dist/client/user/actions/updatePasswordAction.mjs.map +1 -1
  738. package/dist/client/user/api/userRoute.d.ts +7 -0
  739. package/dist/client/user/api/userRoute.d.ts.map +1 -0
  740. package/dist/client/user/clients/enad.d.ts +4 -0
  741. package/dist/client/user/clients/enad.d.ts.map +1 -0
  742. package/dist/client/user/components/login-form.d.ts +23 -0
  743. package/dist/client/user/components/login-form.d.ts.map +1 -0
  744. package/dist/client/user/components/login-form.mjs +77 -73
  745. package/dist/client/user/components/login-form.mjs.map +1 -1
  746. package/dist/client/user/components/reset-password-form.d.ts +20 -0
  747. package/dist/client/user/components/reset-password-form.d.ts.map +1 -0
  748. package/dist/client/user/components/reset-password-form.mjs +57 -50
  749. package/dist/client/user/components/reset-password-form.mjs.map +1 -1
  750. package/dist/client/user/components/sign-out.d.ts +8 -0
  751. package/dist/client/user/components/sign-out.d.ts.map +1 -0
  752. package/dist/client/user/components/sign-out.mjs +6 -3
  753. package/dist/client/user/components/sign-out.mjs.map +1 -1
  754. package/dist/client/user/components/signup-form.d.ts +27 -0
  755. package/dist/client/user/components/signup-form.d.ts.map +1 -0
  756. package/dist/client/user/components/signup-form.mjs +153 -120
  757. package/dist/client/user/components/signup-form.mjs.map +1 -1
  758. package/dist/client/user/components/signup-organisation-form.d.ts +55 -0
  759. package/dist/client/user/components/signup-organisation-form.d.ts.map +1 -0
  760. package/dist/client/user/components/signup-organisation-form.mjs +713 -662
  761. package/dist/client/user/components/signup-organisation-form.mjs.map +1 -1
  762. package/dist/client/user/components/update-password-form.d.ts +17 -0
  763. package/dist/client/user/components/update-password-form.d.ts.map +1 -0
  764. package/dist/client/user/components/update-password-form.mjs +26 -35
  765. package/dist/client/user/components/update-password-form.mjs.map +1 -1
  766. package/dist/client/user/hooks/index.d.ts +2 -0
  767. package/dist/client/user/hooks/index.d.ts.map +1 -0
  768. package/dist/client/user/hooks/useUser.d.ts +12 -0
  769. package/dist/client/user/hooks/useUser.d.ts.map +1 -0
  770. package/dist/client/user/hooks/useUser.mjs +1 -1
  771. package/dist/client/user/hooks/useUser.mjs.map +1 -1
  772. package/dist/client/user/index.d.ts +9 -0
  773. package/dist/client/user/index.d.ts.map +1 -0
  774. package/dist/client/user/index.mjs +17 -0
  775. package/dist/client/user/index.mjs.map +1 -0
  776. package/dist/client/user/types/{user.d.mts → user.d.ts} +25 -26
  777. package/dist/client/user/types/user.d.ts.map +1 -0
  778. package/dist/client/user/utils/{userCookieService.d.mts → userCookieService.d.ts} +2 -3
  779. package/dist/client/user/utils/userCookieService.d.ts.map +1 -0
  780. package/dist/client/wishlist/actions/addItemsToWishlistAction.d.ts +5 -0
  781. package/dist/client/wishlist/actions/addItemsToWishlistAction.d.ts.map +1 -0
  782. package/dist/client/wishlist/actions/addItemsToWishlistAction.mjs.map +1 -1
  783. package/dist/client/wishlist/actions/createOrGetShareTokenAction.d.ts +3 -0
  784. package/dist/client/wishlist/actions/createOrGetShareTokenAction.d.ts.map +1 -0
  785. package/dist/client/wishlist/actions/createOrGetShareTokenAction.mjs.map +1 -1
  786. package/dist/client/wishlist/actions/createWishlistAction.d.ts +3 -0
  787. package/dist/client/wishlist/actions/createWishlistAction.d.ts.map +1 -0
  788. package/dist/client/wishlist/actions/createWishlistAction.mjs.map +1 -1
  789. package/dist/client/wishlist/actions/deleteItemsFromWishlistAction.d.ts +5 -0
  790. package/dist/client/wishlist/actions/deleteItemsFromWishlistAction.d.ts.map +1 -0
  791. package/dist/client/wishlist/actions/deleteItemsFromWishlistAction.mjs.map +1 -1
  792. package/dist/client/wishlist/actions/deleteWishlistAction.d.ts +4 -0
  793. package/dist/client/wishlist/actions/deleteWishlistAction.d.ts.map +1 -0
  794. package/dist/client/wishlist/actions/getSharedWishlistAction.d.ts +3 -0
  795. package/dist/client/wishlist/actions/getSharedWishlistAction.d.ts.map +1 -0
  796. package/dist/client/wishlist/actions/getSharedWishlistAction.mjs.map +1 -1
  797. package/dist/client/wishlist/actions/getSpecificWishlistAction.d.ts +3 -0
  798. package/dist/client/wishlist/actions/getSpecificWishlistAction.d.ts.map +1 -0
  799. package/dist/client/wishlist/actions/getSpecificWishlistAction.mjs.map +1 -1
  800. package/dist/client/wishlist/actions/getUserWishlists.d.ts +4 -0
  801. package/dist/client/wishlist/actions/getUserWishlists.d.ts.map +1 -0
  802. package/dist/client/wishlist/actions/getUserWishlists.mjs.map +1 -1
  803. package/dist/client/wishlist/actions/revokeShareTokenAction.d.ts +4 -0
  804. package/dist/client/wishlist/actions/revokeShareTokenAction.d.ts.map +1 -0
  805. package/dist/client/wishlist/actions/updateWishlistAction.d.ts +3 -0
  806. package/dist/client/wishlist/actions/updateWishlistAction.d.ts.map +1 -0
  807. package/dist/client/wishlist/actions/updateWishlistAction.mjs.map +1 -1
  808. package/dist/client/wishlist/hooks/index.d.ts +2 -0
  809. package/dist/client/wishlist/hooks/index.d.ts.map +1 -0
  810. package/dist/client/wishlist/hooks/useWishlist.d.ts +95 -0
  811. package/dist/client/wishlist/hooks/useWishlist.d.ts.map +1 -0
  812. package/dist/client/wishlist/hooks/useWishlist.mjs +14 -4
  813. package/dist/client/wishlist/hooks/useWishlist.mjs.map +1 -1
  814. package/dist/client/wishlist/hooks/useWishlistActions.d.ts +44 -0
  815. package/dist/client/wishlist/hooks/useWishlistActions.d.ts.map +1 -0
  816. package/dist/client/wishlist/hooks/useWishlistActions.mjs.map +1 -1
  817. package/dist/client/wishlist/index.d.ts +5 -0
  818. package/dist/client/wishlist/index.d.ts.map +1 -0
  819. package/dist/client/wishlist/index.mjs +9 -0
  820. package/dist/client/wishlist/index.mjs.map +1 -0
  821. package/dist/client/wishlist/wishlist-drawer.d.ts +17 -0
  822. package/dist/client/wishlist/wishlist-drawer.d.ts.map +1 -0
  823. package/dist/client/wishlist/wishlist-drawer.mjs +189 -170
  824. package/dist/client/wishlist/wishlist-drawer.mjs.map +1 -1
  825. package/dist/styles.css +1 -958
  826. package/package.json +107 -33
  827. package/dist/client/cart/components/cart-trigger.d.mts +0 -5
  828. package/dist/client/cart/constants/session.d.mts +0 -3
  829. package/dist/client/cart/contexts/cart.d.mts +0 -27
  830. package/dist/client/cart/hooks/useCart.d.mts +0 -29
  831. package/dist/client/cart/hooks/useCartActions.d.mts +0 -26
  832. package/dist/client/cart/queries/addToCartQueryFn.d.mts +0 -10
  833. package/dist/client/cart/queries/getCartQueryFn.d.mts +0 -7
  834. package/dist/client/cart/queries/removeCartItemQueryFn.d.mts +0 -9
  835. package/dist/client/cart/queries/updateCartItemQueryFn.d.mts +0 -10
  836. package/dist/client/cart/utils/session.d.mts +0 -6
  837. package/dist/client/cms/storyblok/preview/registerStoryblokBridge.d.mts +0 -6
  838. package/dist/client/global/auth/withAuth.d.mts +0 -6
  839. package/dist/client/global/providers/enad-provider.d.mts +0 -23
  840. package/dist/client/search/actions/searchAction.d.mts +0 -5
  841. package/dist/client/search/components/search-bar.d.mts +0 -2
  842. package/dist/client/search/hooks/useSearch.d.mts +0 -18
  843. package/dist/client/user/actions/createResetPasswordLinkAction.d.mts +0 -14
  844. package/dist/client/user/actions/getUserAction.d.mts +0 -5
  845. package/dist/client/user/actions/logoutUserAction.d.mts +0 -3
  846. package/dist/client/user/actions/registerOrganisationAction.d.mts +0 -12
  847. package/dist/client/user/api/userRoute.d.mts +0 -9
  848. package/dist/client/user/clients/enad.d.mts +0 -6
  849. package/dist/client/user/components/login-form.d.mts +0 -20
  850. package/dist/client/user/components/reset-password-form.d.mts +0 -15
  851. package/dist/client/user/components/sign-out.d.mts +0 -5
  852. package/dist/client/user/components/signup-form.d.mts +0 -15
  853. package/dist/client/user/components/signup-organisation-form.d.mts +0 -20
  854. package/dist/client/user/components/update-password-form.d.mts +0 -11
  855. package/dist/client/user/hooks/index.d.mts +0 -3
  856. package/dist/client/user/hooks/useUser.d.mts +0 -16
  857. package/dist/client/wishlist/actions/addItemsToWishlistAction.d.mts +0 -7
  858. package/dist/client/wishlist/actions/createOrGetShareTokenAction.d.mts +0 -6
  859. package/dist/client/wishlist/actions/createWishlistAction.d.mts +0 -6
  860. package/dist/client/wishlist/actions/deleteItemsFromWishlistAction.d.mts +0 -7
  861. package/dist/client/wishlist/actions/deleteWishlistAction.d.mts +0 -5
  862. package/dist/client/wishlist/actions/getSharedWishlistAction.d.mts +0 -6
  863. package/dist/client/wishlist/actions/getSpecificWishlistAction.d.mts +0 -6
  864. package/dist/client/wishlist/actions/getUserWishlists.d.mts +0 -7
  865. package/dist/client/wishlist/actions/revokeShareTokenAction.d.mts +0 -5
  866. package/dist/client/wishlist/actions/updateWishlistAction.d.mts +0 -6
  867. package/dist/client/wishlist/hooks/index.d.mts +0 -3
  868. package/dist/client/wishlist/hooks/useWishlist.d.mts +0 -98
  869. package/dist/client/wishlist/hooks/useWishlistActions.d.mts +0 -48
  870. package/dist/client/wishlist/wishlist-drawer.d.mts +0 -19
@@ -6,6 +6,7 @@ import { useForm } from "react-hook-form";
6
6
  import * as z from "zod";
7
7
  import { registerOrganisationAction } from "../actions/registerOrganisationAction";
8
8
  import { registerUserWithoutRedirectAction } from "../actions/registerUserWithoutRedirectAction";
9
+ import { StorefrontButton } from "../../storefront/primitives/button";
9
10
  const addressSchema = z.object({
10
11
  street_address: z.string().min(1, "Street address is required"),
11
12
  house_number: z.string().optional(),
@@ -60,87 +61,430 @@ const formSchema = z.object({
60
61
  message: "You must accept the terms and conditions"
61
62
  })
62
63
  });
63
- const SignupOrganisationForm = ({
64
- title = "Create your organisation account",
65
- subtitle = "Sign up to get started",
66
- submitText = "Sign Up",
67
- extraLink = { href: "/login", text: "Already have an account? Sign in" },
68
- organisationStatus = "active",
69
- defaultMarket = "SE",
70
- defaultLanguage = "SV",
71
- defaultCountry = "SE",
72
- defaultStoreGroup = "default"
73
- }) => {
74
- const [errors, setErrors] = useState({});
75
- const [isPending, setIsPending] = useState(false);
76
- const [showPassword, setShowPassword] = useState(false);
77
- const [showConfirmPassword, setShowConfirmPassword] = useState(false);
78
- const [confirmMode, setConfirmMode] = useState(false);
79
- const form = useForm({
80
- resolver: zodResolver(formSchema),
81
- defaultValues: {
82
- user: {
83
- first_name: "",
84
- last_name: "",
85
- email: "",
86
- password: "",
87
- confirmPassword: "",
88
- phone_number: "",
89
- language: defaultLanguage,
90
- market: defaultMarket,
91
- country_code: defaultCountry,
92
- store_group: defaultStoreGroup,
93
- allow_email_notifications: false,
94
- allow_phone_notifications: false,
95
- allow_postal_notifications: false
96
- },
97
- organization: {
98
- name: "",
99
- organisation_number: "",
100
- tax_id_vat_number: "",
101
- contact_name: "",
102
- email: "",
103
- invoice_email: "",
104
- phone: "",
105
- external_ref: "",
106
- attribute: "",
107
- credit_check: false,
108
- custom_fields: {},
109
- billing_address: [
110
- {
111
- street_address: "",
112
- house_number: "",
113
- city: "",
114
- postal_code: "",
115
- country: defaultCountry,
116
- state_province: "",
117
- phone: "",
118
- co_address: "",
119
- name: "",
120
- is_default: true,
121
- shipping_type: "standard"
64
+ const INPUT_BASE_CLASSES = `
65
+ w-full px-4 py-2.5
66
+ border border-(--enad-border-color)
67
+ rounded-[var(--enad-input-radius)]
68
+ focus:ring-2 focus:ring-(--enad-button-bg)
69
+ focus:border-(--enad-button-bg)
70
+ outline-none transition
71
+ bg-(--enad-background)
72
+ text-(--enad-text-primary-color)
73
+ `;
74
+ const LABEL_CLASSES = `block text-sm font-medium text-(--enad-text-primary-color) mb-1`;
75
+ const ERROR_CLASSES = `text-(--enad-error-color) text-sm mt-1`;
76
+ const SECTION_TITLE_CLASSES = `text-xl font-semibold mb-4 pb-2 border-b border-(--enad-border-color)`;
77
+ function ariaError(error, id) {
78
+ return error ? id : void 0;
79
+ }
80
+ function FormField({ label, required, errorId, error, children }) {
81
+ return /* @__PURE__ */ jsxs("div", { children: [
82
+ /* @__PURE__ */ jsxs("label", { className: LABEL_CLASSES, children: [
83
+ label,
84
+ required && /* @__PURE__ */ jsx("span", { className: "text-(--enad-error-color)", children: " *" })
85
+ ] }),
86
+ children,
87
+ error && /* @__PURE__ */ jsx("p", { id: errorId, role: "alert", className: ERROR_CLASSES, children: error.message })
88
+ ] });
89
+ }
90
+ function ConfirmationView({ title, message }) {
91
+ return /* @__PURE__ */ jsx("main", { className: "flex items-center justify-center px-4", children: /* @__PURE__ */ jsxs("div", { className: "w-full max-w-md bg-(--enad-surface) shadow-lg p-8 border border-(--enad-border-color) rounded-(--enad-card-radius)", children: [
92
+ /* @__PURE__ */ jsx("h2", { className: "text-2xl font-semibold mb-2 text-center text-(--enad-text-primary-color)", children: title }),
93
+ /* @__PURE__ */ jsx("p", { className: "text-sm text-center text-(--enad-text-muted-color)", children: message })
94
+ ] }) });
95
+ }
96
+ function ContactNameFields({ form, firstNameLabel, lastNameLabel }) {
97
+ const errors = form.formState.errors;
98
+ return /* @__PURE__ */ jsxs("div", { className: "grid md:grid-cols-2 gap-4", children: [
99
+ /* @__PURE__ */ jsx(FormField, { label: firstNameLabel, required: true, errorId: "user-firstName-error", error: errors.user?.first_name, children: /* @__PURE__ */ jsx(
100
+ "input",
101
+ {
102
+ ...form.register("user.first_name"),
103
+ "aria-describedby": ariaError(errors.user?.first_name, "user-firstName-error"),
104
+ className: INPUT_BASE_CLASSES,
105
+ placeholder: "John"
106
+ }
107
+ ) }),
108
+ /* @__PURE__ */ jsx(FormField, { label: lastNameLabel, required: true, errorId: "user-lastName-error", error: errors.user?.last_name, children: /* @__PURE__ */ jsx(
109
+ "input",
110
+ {
111
+ ...form.register("user.last_name"),
112
+ "aria-describedby": ariaError(errors.user?.last_name, "user-lastName-error"),
113
+ className: INPUT_BASE_CLASSES,
114
+ placeholder: "Doe"
115
+ }
116
+ ) })
117
+ ] });
118
+ }
119
+ function ContactEmailPhoneFields({ form, emailLabel, phoneLabel }) {
120
+ const errors = form.formState.errors;
121
+ return /* @__PURE__ */ jsxs("div", { className: "grid md:grid-cols-2 gap-4", children: [
122
+ /* @__PURE__ */ jsx(FormField, { label: emailLabel, required: true, errorId: "user-email-error", error: errors.user?.email, children: /* @__PURE__ */ jsx(
123
+ "input",
124
+ {
125
+ type: "email",
126
+ ...form.register("user.email"),
127
+ "aria-describedby": ariaError(errors.user?.email, "user-email-error"),
128
+ className: INPUT_BASE_CLASSES,
129
+ placeholder: "you@example.com"
130
+ }
131
+ ) }),
132
+ /* @__PURE__ */ jsx(FormField, { label: phoneLabel, errorId: "user-phone-error", error: errors.user?.phone_number, children: /* @__PURE__ */ jsx(
133
+ "input",
134
+ {
135
+ type: "tel",
136
+ ...form.register("user.phone_number"),
137
+ "aria-describedby": ariaError(errors.user?.phone_number, "user-phone-error"),
138
+ className: INPUT_BASE_CLASSES,
139
+ placeholder: "+46 123 456 789"
140
+ }
141
+ ) })
142
+ ] });
143
+ }
144
+ function ContactPasswordFields({
145
+ form,
146
+ passwordLabel,
147
+ confirmPasswordLabel,
148
+ showPassword,
149
+ showConfirmPassword,
150
+ onTogglePassword,
151
+ onToggleConfirmPassword
152
+ }) {
153
+ const errors = form.formState.errors;
154
+ return /* @__PURE__ */ jsxs("div", { className: "grid md:grid-cols-2 gap-4", children: [
155
+ /* @__PURE__ */ jsx(FormField, { label: passwordLabel, required: true, errorId: "user-password-error", error: errors.user?.password, children: /* @__PURE__ */ jsxs("div", { className: "relative", children: [
156
+ /* @__PURE__ */ jsx(
157
+ "input",
158
+ {
159
+ type: showPassword ? "text" : "password",
160
+ ...form.register("user.password"),
161
+ "aria-describedby": ariaError(errors.user?.password, "user-password-error"),
162
+ className: `${INPUT_BASE_CLASSES} pr-10`,
163
+ placeholder: "\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022"
164
+ }
165
+ ),
166
+ /* @__PURE__ */ jsx(
167
+ "button",
168
+ {
169
+ type: "button",
170
+ onClick: onTogglePassword,
171
+ className: "absolute right-2 top-1/2 -translate-y-1/2 text-(--enad-text-muted-color)",
172
+ children: showPassword ? "Hide" : "Show"
173
+ }
174
+ )
175
+ ] }) }),
176
+ /* @__PURE__ */ jsx(FormField, { label: confirmPasswordLabel, required: true, errorId: "user-confirmPassword-error", error: errors.user?.confirmPassword, children: /* @__PURE__ */ jsxs("div", { className: "relative", children: [
177
+ /* @__PURE__ */ jsx(
178
+ "input",
179
+ {
180
+ type: showConfirmPassword ? "text" : "password",
181
+ ...form.register("user.confirmPassword"),
182
+ "aria-describedby": ariaError(errors.user?.confirmPassword, "user-confirmPassword-error"),
183
+ className: `${INPUT_BASE_CLASSES} pr-10`,
184
+ placeholder: "\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022"
185
+ }
186
+ ),
187
+ /* @__PURE__ */ jsx(
188
+ "button",
189
+ {
190
+ type: "button",
191
+ onClick: onToggleConfirmPassword,
192
+ className: "absolute right-2 top-1/2 -translate-y-1/2 text-(--enad-text-muted-color)",
193
+ children: showConfirmPassword ? "Hide" : "Show"
194
+ }
195
+ )
196
+ ] }) })
197
+ ] });
198
+ }
199
+ function CommunicationPrefsFields({
200
+ form,
201
+ communicationPreferences,
202
+ emailNotifications,
203
+ smsNotifications,
204
+ postalNotifications
205
+ }) {
206
+ return /* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
207
+ /* @__PURE__ */ jsx("p", { className: "text-sm font-medium text-(--enad-text-primary-color)", children: communicationPreferences }),
208
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
209
+ /* @__PURE__ */ jsx("input", { type: "checkbox", ...form.register("user.allow_email_notifications"), className: "h-4 w-4" }),
210
+ /* @__PURE__ */ jsx("label", { className: "text-sm text-(--enad-text-primary-color)", children: emailNotifications })
211
+ ] }),
212
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
213
+ /* @__PURE__ */ jsx("input", { type: "checkbox", ...form.register("user.allow_phone_notifications"), className: "h-4 w-4" }),
214
+ /* @__PURE__ */ jsx("label", { className: "text-sm text-(--enad-text-primary-color)", children: smsNotifications })
215
+ ] }),
216
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
217
+ /* @__PURE__ */ jsx("input", { type: "checkbox", ...form.register("user.allow_postal_notifications"), className: "h-4 w-4" }),
218
+ /* @__PURE__ */ jsx("label", { className: "text-sm text-(--enad-text-primary-color)", children: postalNotifications })
219
+ ] })
220
+ ] });
221
+ }
222
+ function ContactPersonSection({
223
+ form,
224
+ labels,
225
+ showPassword,
226
+ showConfirmPassword,
227
+ onTogglePassword,
228
+ onToggleConfirmPassword
229
+ }) {
230
+ return /* @__PURE__ */ jsxs("div", { className: "space-y-4", children: [
231
+ /* @__PURE__ */ jsx("h3", { className: SECTION_TITLE_CLASSES, children: labels.sectionTitle }),
232
+ /* @__PURE__ */ jsx(ContactNameFields, { form, firstNameLabel: labels.firstName, lastNameLabel: labels.lastName }),
233
+ /* @__PURE__ */ jsx(ContactEmailPhoneFields, { form, emailLabel: labels.email, phoneLabel: labels.phone }),
234
+ /* @__PURE__ */ jsx(
235
+ ContactPasswordFields,
236
+ {
237
+ form,
238
+ passwordLabel: labels.password,
239
+ confirmPasswordLabel: labels.confirmPassword,
240
+ showPassword,
241
+ showConfirmPassword,
242
+ onTogglePassword,
243
+ onToggleConfirmPassword
244
+ }
245
+ ),
246
+ /* @__PURE__ */ jsx(
247
+ CommunicationPrefsFields,
248
+ {
249
+ form,
250
+ communicationPreferences: labels.communicationPreferences,
251
+ emailNotifications: labels.emailNotifications,
252
+ smsNotifications: labels.smsNotifications,
253
+ postalNotifications: labels.postalNotifications
254
+ }
255
+ )
256
+ ] });
257
+ }
258
+ function CompanyIdentityFields({ form, labels }) {
259
+ const errors = form.formState.errors;
260
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
261
+ /* @__PURE__ */ jsx(FormField, { label: labels.companyName, required: true, errorId: "org-name-error", error: errors.organization?.name, children: /* @__PURE__ */ jsx(
262
+ "input",
263
+ {
264
+ ...form.register("organization.name"),
265
+ "aria-describedby": ariaError(errors.organization?.name, "org-name-error"),
266
+ className: INPUT_BASE_CLASSES,
267
+ placeholder: "Company Name"
268
+ }
269
+ ) }),
270
+ /* @__PURE__ */ jsxs("div", { className: "grid md:grid-cols-2 gap-4", children: [
271
+ /* @__PURE__ */ jsx(FormField, { label: labels.orgNumber, required: true, errorId: "org-number-error", error: errors.organization?.organisation_number, children: /* @__PURE__ */ jsx(
272
+ "input",
273
+ {
274
+ ...form.register("organization.organisation_number"),
275
+ "aria-describedby": ariaError(errors.organization?.organisation_number, "org-number-error"),
276
+ className: INPUT_BASE_CLASSES,
277
+ placeholder: "1234567890",
278
+ onChange: (e) => {
279
+ form.setValue("organization.organisation_number", e.target.value.replace(/\D/g, ""));
122
280
  }
281
+ }
282
+ ) }),
283
+ /* @__PURE__ */ jsx(FormField, { label: labels.vatNumber, required: true, errorId: "org-vat-error", error: errors.organization?.tax_id_vat_number, children: /* @__PURE__ */ jsx(
284
+ "input",
285
+ {
286
+ ...form.register("organization.tax_id_vat_number"),
287
+ "aria-describedby": ariaError(errors.organization?.tax_id_vat_number, "org-vat-error"),
288
+ className: INPUT_BASE_CLASSES,
289
+ placeholder: "SE123456789001"
290
+ }
291
+ ) })
292
+ ] })
293
+ ] });
294
+ }
295
+ function CompanyContactFields({ form, labels }) {
296
+ const errors = form.formState.errors;
297
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
298
+ /* @__PURE__ */ jsxs("div", { className: "grid md:grid-cols-2 gap-4", children: [
299
+ /* @__PURE__ */ jsx(FormField, { label: labels.companyEmail, required: true, errorId: "org-email-error", error: errors.organization?.email, children: /* @__PURE__ */ jsx(
300
+ "input",
301
+ {
302
+ type: "email",
303
+ ...form.register("organization.email"),
304
+ "aria-describedby": ariaError(errors.organization?.email, "org-email-error"),
305
+ className: INPUT_BASE_CLASSES,
306
+ placeholder: "company@example.com"
307
+ }
308
+ ) }),
309
+ /* @__PURE__ */ jsx(FormField, { label: labels.companyPhone, errorId: "org-phone-error", error: errors.organization?.phone, children: /* @__PURE__ */ jsx(
310
+ "input",
311
+ {
312
+ type: "tel",
313
+ ...form.register("organization.phone"),
314
+ "aria-describedby": ariaError(errors.organization?.phone, "org-phone-error"),
315
+ className: INPUT_BASE_CLASSES,
316
+ placeholder: "+46 123 456 789"
317
+ }
318
+ ) })
319
+ ] }),
320
+ /* @__PURE__ */ jsx(FormField, { label: labels.invoiceEmail, errorId: "org-invoiceEmail-error", error: errors.organization?.invoice_email, children: /* @__PURE__ */ jsx(
321
+ "input",
322
+ {
323
+ type: "email",
324
+ ...form.register("organization.invoice_email"),
325
+ "aria-describedby": ariaError(errors.organization?.invoice_email, "org-invoiceEmail-error"),
326
+ className: INPUT_BASE_CLASSES,
327
+ placeholder: "invoices@example.com"
328
+ }
329
+ ) })
330
+ ] });
331
+ }
332
+ function CompanyExtraFields({ form, labels }) {
333
+ const errors = form.formState.errors;
334
+ return /* @__PURE__ */ jsxs("div", { className: "grid md:grid-cols-2 gap-4", children: [
335
+ /* @__PURE__ */ jsx(FormField, { label: labels.contactName, errorId: "org-contactName-error", error: errors.organization?.contact_name, children: /* @__PURE__ */ jsx(
336
+ "input",
337
+ {
338
+ ...form.register("organization.contact_name"),
339
+ "aria-describedby": ariaError(errors.organization?.contact_name, "org-contactName-error"),
340
+ className: INPUT_BASE_CLASSES,
341
+ placeholder: "Contact Person"
342
+ }
343
+ ) }),
344
+ /* @__PURE__ */ jsx(FormField, { label: labels.externalRef, errorId: "org-externalRef-error", error: errors.organization?.external_ref, children: /* @__PURE__ */ jsx(
345
+ "input",
346
+ {
347
+ ...form.register("organization.external_ref"),
348
+ "aria-describedby": ariaError(errors.organization?.external_ref, "org-externalRef-error"),
349
+ className: INPUT_BASE_CLASSES,
350
+ placeholder: "External Ref"
351
+ }
352
+ ) })
353
+ ] });
354
+ }
355
+ function CompanyInfoSection({ form, labels }) {
356
+ return /* @__PURE__ */ jsxs("div", { className: "space-y-4", children: [
357
+ /* @__PURE__ */ jsx("h3", { className: SECTION_TITLE_CLASSES, children: labels.sectionTitle }),
358
+ /* @__PURE__ */ jsx(CompanyIdentityFields, { form, labels }),
359
+ /* @__PURE__ */ jsx(CompanyContactFields, { form, labels }),
360
+ /* @__PURE__ */ jsx(CompanyExtraFields, { form, labels })
361
+ ] });
362
+ }
363
+ function AddressStreetRow({ form, prefix, idPrefix, labels, addressErrors }) {
364
+ return /* @__PURE__ */ jsxs("div", { className: "grid md:grid-cols-2 gap-4", children: [
365
+ /* @__PURE__ */ jsx(FormField, { label: labels.streetAddress, required: true, errorId: `${idPrefix}-street-error`, error: addressErrors?.street_address, children: /* @__PURE__ */ jsx(
366
+ "input",
367
+ {
368
+ ...form.register(`${prefix}.street_address`),
369
+ "aria-describedby": ariaError(addressErrors?.street_address, `${idPrefix}-street-error`),
370
+ className: INPUT_BASE_CLASSES,
371
+ placeholder: "Street Address"
372
+ }
373
+ ) }),
374
+ /* @__PURE__ */ jsxs("div", { children: [
375
+ /* @__PURE__ */ jsx("label", { className: LABEL_CLASSES, children: labels.houseNumber }),
376
+ /* @__PURE__ */ jsx(
377
+ "input",
378
+ {
379
+ ...form.register(`${prefix}.house_number`),
380
+ className: INPUT_BASE_CLASSES,
381
+ placeholder: "123"
382
+ }
383
+ )
384
+ ] })
385
+ ] });
386
+ }
387
+ function AddressPostalRow({ form, prefix, idPrefix, labels, addressErrors }) {
388
+ return /* @__PURE__ */ jsxs("div", { className: "grid md:grid-cols-2 gap-4", children: [
389
+ /* @__PURE__ */ jsxs("div", { children: [
390
+ /* @__PURE__ */ jsx("label", { className: LABEL_CLASSES, children: labels.coAddress }),
391
+ /* @__PURE__ */ jsx(
392
+ "input",
393
+ {
394
+ ...form.register(`${prefix}.co_address`),
395
+ className: INPUT_BASE_CLASSES,
396
+ placeholder: "Co Address"
397
+ }
398
+ )
399
+ ] }),
400
+ /* @__PURE__ */ jsx(FormField, { label: labels.postalCode, required: true, errorId: `${idPrefix}-postal-error`, error: addressErrors?.postal_code, children: /* @__PURE__ */ jsx(
401
+ "input",
402
+ {
403
+ ...form.register(`${prefix}.postal_code`),
404
+ "aria-describedby": ariaError(addressErrors?.postal_code, `${idPrefix}-postal-error`),
405
+ className: INPUT_BASE_CLASSES,
406
+ placeholder: "12345"
407
+ }
408
+ ) })
409
+ ] });
410
+ }
411
+ function AddressCityRow({ form, prefix, idPrefix, labels, addressErrors }) {
412
+ return /* @__PURE__ */ jsxs("div", { className: "grid md:grid-cols-2 gap-4", children: [
413
+ /* @__PURE__ */ jsx(FormField, { label: labels.city, required: true, errorId: `${idPrefix}-city-error`, error: addressErrors?.city, children: /* @__PURE__ */ jsx(
414
+ "input",
415
+ {
416
+ ...form.register(`${prefix}.city`),
417
+ "aria-describedby": ariaError(addressErrors?.city, `${idPrefix}-city-error`),
418
+ className: INPUT_BASE_CLASSES,
419
+ placeholder: "City"
420
+ }
421
+ ) }),
422
+ /* @__PURE__ */ jsx(FormField, { label: labels.country, required: true, errorId: `${idPrefix}-country-error`, error: addressErrors?.country, children: /* @__PURE__ */ jsxs(
423
+ "select",
424
+ {
425
+ ...form.register(`${prefix}.country`),
426
+ "aria-describedby": ariaError(addressErrors?.country, `${idPrefix}-country-error`),
427
+ className: INPUT_BASE_CLASSES,
428
+ children: [
429
+ /* @__PURE__ */ jsx("option", { value: "SE", children: "Sweden" }),
430
+ /* @__PURE__ */ jsx("option", { value: "NO", children: "Norway" }),
431
+ /* @__PURE__ */ jsx("option", { value: "DK", children: "Denmark" }),
432
+ /* @__PURE__ */ jsx("option", { value: "FI", children: "Finland" })
123
433
  ]
124
- },
125
- shipping_address: [
434
+ }
435
+ ) })
436
+ ] });
437
+ }
438
+ function AddressFields({ form, prefix, idPrefix, labels }) {
439
+ const isBilling = prefix === "organization.billing_address.0";
440
+ const addressErrors = isBilling ? form.formState.errors.organization?.billing_address?.[0] : form.formState.errors.shipping_address?.[0];
441
+ const rowProps = { form, prefix, idPrefix, labels, addressErrors };
442
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
443
+ /* @__PURE__ */ jsx(AddressStreetRow, { ...rowProps }),
444
+ /* @__PURE__ */ jsx(AddressPostalRow, { ...rowProps }),
445
+ /* @__PURE__ */ jsx(AddressCityRow, { ...rowProps })
446
+ ] });
447
+ }
448
+ function BillingAddressSection({ form, labels }) {
449
+ return /* @__PURE__ */ jsxs("div", { className: "space-y-4", children: [
450
+ /* @__PURE__ */ jsx("h3", { className: SECTION_TITLE_CLASSES, children: labels.sectionTitle }),
451
+ /* @__PURE__ */ jsx(
452
+ AddressFields,
453
+ {
454
+ form,
455
+ prefix: "organization.billing_address.0",
456
+ idPrefix: "billing",
457
+ labels
458
+ }
459
+ )
460
+ ] });
461
+ }
462
+ function ShippingAddressSection({ form, useBillingAsShipping, labels }) {
463
+ return /* @__PURE__ */ jsxs("div", { className: "space-y-4", children: [
464
+ /* @__PURE__ */ jsx("h3", { className: SECTION_TITLE_CLASSES, children: labels.sectionTitle }),
465
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 mb-4", children: [
466
+ /* @__PURE__ */ jsx(
467
+ "input",
126
468
  {
127
- street_address: "",
128
- house_number: "",
129
- city: "",
130
- postal_code: "",
131
- country: defaultCountry,
132
- state_province: "",
133
- phone: "",
134
- co_address: "",
135
- name: "",
136
- is_default: true,
137
- shipping_type: "standard"
469
+ type: "checkbox",
470
+ ...form.register("use_billing_as_shipping"),
471
+ className: "h-4 w-4"
138
472
  }
139
- ],
140
- use_billing_as_shipping: false,
141
- terms_accepted: false
142
- }
143
- });
473
+ ),
474
+ /* @__PURE__ */ jsx("label", { className: "text-sm font-medium text-(--enad-text-primary-color)", children: labels.sameBillingAsShipping })
475
+ ] }),
476
+ !useBillingAsShipping && /* @__PURE__ */ jsx(
477
+ AddressFields,
478
+ {
479
+ form,
480
+ prefix: "shipping_address.0",
481
+ idPrefix: "shipping",
482
+ labels
483
+ }
484
+ )
485
+ ] });
486
+ }
487
+ function useAutoFillEffects(form) {
144
488
  const { watch, setValue } = form;
145
489
  const useBillingAsShipping = watch("use_billing_as_shipping");
146
490
  const billingAddress = watch("organization.billing_address.0");
@@ -195,592 +539,244 @@ const SignupOrganisationForm = ({
195
539
  lastAutoVat.current = computedVat;
196
540
  }
197
541
  }, [orgNumber, invoiceCountry, setValue, form]);
198
- const onSubmit = async (values) => {
199
- setIsPending(true);
200
- setErrors({});
201
- try {
202
- const userResult = await registerUserWithoutRedirectAction({
203
- firstName: values.user.first_name,
204
- lastName: values.user.last_name,
205
- email: values.user.email,
206
- password: values.user.password,
207
- phone_number: values.user.phone_number,
208
- language: values.user.language,
209
- country_code: values.user.country_code,
210
- market: values.user.market,
211
- store_group: values.user.store_group,
212
- allow_email_notifications: values.user.allow_email_notifications,
213
- allow_phone_notifications: values.user.allow_phone_notifications,
214
- allow_postal_notifications: values.user.allow_postal_notifications,
215
- status: organisationStatus
216
- });
217
- if (userResult?.errors) {
218
- setErrors(userResult.errors);
219
- setIsPending(false);
220
- return;
221
- }
222
- const userId = userResult?.data.id;
223
- if (!userId) {
224
- setErrors({ general: ["User registration failed. Please try again."] });
225
- setIsPending(false);
226
- return;
227
- }
228
- const organisationData = {
229
- billing_address: values.organization.billing_address,
230
- shipping_address: values.shipping_address,
231
- contact_name: values.organization.contact_name,
232
- credit_check: values.organization.credit_check,
233
- custom_fields: values.organization.custom_fields,
234
- email: values.organization.email.toLowerCase(),
235
- external_ref: values.organization.external_ref,
236
- invoice_email: values.organization.invoice_email?.toLowerCase(),
237
- name: values.organization.name,
238
- organisation_number: values.organization.organisation_number,
239
- phone: values.organization.phone,
240
- tax_id_vat_number: values.organization.tax_id_vat_number,
241
- user_id: userId,
242
- attribute_ids: values.organization.attribute ? [values.organization.attribute] : [],
243
- status: organisationStatus
244
- };
245
- const orgResult = await registerOrganisationAction(organisationData);
246
- if (orgResult?.error) {
247
- setErrors({ general: [orgResult.error] });
248
- setIsPending(false);
249
- return;
250
- }
251
- setConfirmMode(true);
252
- } catch (error) {
253
- console.error("Registration error:", error);
254
- setErrors({ general: ["Failed to register. Please try again."] });
255
- } finally {
256
- setIsPending(false);
257
- }
542
+ return { useBillingAsShipping };
543
+ }
544
+ const DEFAULT_LABELS = {
545
+ title: "Create your organisation account",
546
+ subtitle: "Sign up to get started",
547
+ submit: "Sign Up",
548
+ signingUp: "Signing up...",
549
+ contactPersonSection: "Contact Person",
550
+ companyInfoSection: "Company Information",
551
+ billingAddressSection: "Billing Address",
552
+ shippingAddressSection: "Shipping Address",
553
+ firstName: "First Name",
554
+ lastName: "Last Name",
555
+ email: "Email",
556
+ phoneNumber: "Phone Number",
557
+ password: "Password",
558
+ confirmPassword: "Confirm Password",
559
+ companyName: "Company Name",
560
+ organisationNumber: "Organisation Number",
561
+ taxIdVatNumber: "Tax ID/VAT Number",
562
+ companyEmail: "Company Email",
563
+ companyPhone: "Company Phone",
564
+ invoiceEmail: "Invoice Email",
565
+ contactName: "Contact Name",
566
+ externalRef: "External Reference",
567
+ streetAddress: "Street Address",
568
+ houseNumber: "House Number",
569
+ coAddress: "Co Address",
570
+ postalCode: "Postal Code",
571
+ city: "City",
572
+ country: "Country",
573
+ sameBillingAsShipping: "Same address as billing address",
574
+ emailNotifications: "Accept email notifications",
575
+ smsNotifications: "Accept SMS notifications",
576
+ postalNotifications: "Accept postal notifications",
577
+ communicationPreferences: "Communication Preferences",
578
+ acceptTerms: "I accept the",
579
+ termsLinkText: "terms and conditions",
580
+ verifyEmailTitle: "Verify your email",
581
+ verifyEmailMessage: "Please check your email to verify your account."
582
+ };
583
+ function resolveLabels(labels) {
584
+ return { ...DEFAULT_LABELS, ...labels };
585
+ }
586
+ function buildDefaultValues(defaultLanguage, defaultMarket, defaultCountry, defaultStoreGroup) {
587
+ const emptyAddress = {
588
+ street_address: "",
589
+ house_number: "",
590
+ city: "",
591
+ postal_code: "",
592
+ country: defaultCountry,
593
+ state_province: "",
594
+ phone: "",
595
+ co_address: "",
596
+ name: "",
597
+ is_default: true,
598
+ shipping_type: "standard"
258
599
  };
259
- const inputBaseClasses = `
260
- w-full px-4 py-2.5
261
- border border-(--enad-border-color)
262
- rounded-(--enad-border-radius)
263
- focus:ring-2 focus:ring-(--enad-button-bg)
264
- focus:border-(--enad-button-bg)
265
- outline-none transition
266
- bg-(--enad-background)
267
- text-(--enad-text-primary-color)
268
- `;
269
- const buttonBaseClasses = `
270
- w-full py-2.5
271
- bg-(--enad-button-bg)
272
- hover:bg-(--enad-button-hover-bg)
273
- text-(--enad-button-color)
274
- font-medium rounded-(--enad-border-radius)
275
- transition shadow-sm hover:shadow
276
- disabled:opacity-50 disabled:cursor-not-allowed
277
- `;
278
- const labelClasses = `block text-sm font-medium text-(--enad-text-primary-color) mb-1`;
279
- const errorClasses = `text-(--enad-error-color) text-sm mt-1`;
280
- const sectionTitleClasses = `text-xl font-semibold mb-4 pb-2 border-b border-(--enad-border-color)`;
281
- if (confirmMode) {
282
- return /* @__PURE__ */ jsx("main", { className: "flex items-center justify-center px-4", children: /* @__PURE__ */ jsxs("div", { className: "w-full max-w-md bg-(--enad-surface) shadow-lg p-8 border border-(--enad-border-color) rounded-(--enad-border-radius)", children: [
283
- /* @__PURE__ */ jsx("h2", { className: "text-2xl font-semibold mb-2 text-center text-(--enad-text-primary-color)", children: "Verify your email" }),
284
- /* @__PURE__ */ jsx("p", { className: "text-sm text-center text-(--enad-text-muted-color)", children: "Please check your email to verify your account." })
285
- ] }) });
600
+ return {
601
+ user: {
602
+ first_name: "",
603
+ last_name: "",
604
+ email: "",
605
+ password: "",
606
+ confirmPassword: "",
607
+ phone_number: "",
608
+ language: defaultLanguage,
609
+ market: defaultMarket,
610
+ country_code: defaultCountry,
611
+ store_group: defaultStoreGroup,
612
+ allow_email_notifications: false,
613
+ allow_phone_notifications: false,
614
+ allow_postal_notifications: false
615
+ },
616
+ organization: {
617
+ name: "",
618
+ organisation_number: "",
619
+ tax_id_vat_number: "",
620
+ contact_name: "",
621
+ email: "",
622
+ invoice_email: "",
623
+ phone: "",
624
+ external_ref: "",
625
+ attribute: "",
626
+ credit_check: false,
627
+ custom_fields: {},
628
+ billing_address: [emptyAddress]
629
+ },
630
+ shipping_address: [{ ...emptyAddress }],
631
+ use_billing_as_shipping: false,
632
+ terms_accepted: false
633
+ };
634
+ }
635
+ async function submitRegistration(values, organisationStatus, setErrors) {
636
+ const userResult = await registerUserWithoutRedirectAction({
637
+ firstName: values.user.first_name,
638
+ lastName: values.user.last_name,
639
+ email: values.user.email,
640
+ password: values.user.password,
641
+ phone_number: values.user.phone_number,
642
+ language: values.user.language,
643
+ country_code: values.user.country_code,
644
+ market: values.user.market,
645
+ store_group: values.user.store_group,
646
+ allow_email_notifications: values.user.allow_email_notifications,
647
+ allow_phone_notifications: values.user.allow_phone_notifications,
648
+ allow_postal_notifications: values.user.allow_postal_notifications,
649
+ status: organisationStatus
650
+ });
651
+ if (userResult?.errors) {
652
+ setErrors(userResult.errors);
653
+ return false;
286
654
  }
287
- return /* @__PURE__ */ jsx("main", { className: "flex items-center justify-center px-4 py-8", children: /* @__PURE__ */ jsxs("div", { className: "w-full max-w-4xl bg-(--enad-surface) shadow-lg p-8 border border-(--enad-border-color) rounded-(--enad-border-radius)", children: [
288
- /* @__PURE__ */ jsx("h2", { className: "text-2xl font-semibold mb-2 text-center text-(--enad-text-primary-color)", children: title }),
289
- /* @__PURE__ */ jsx("p", { className: "text-sm mb-8 text-center text-(--enad-text-muted-color)", children: subtitle }),
655
+ const userId = userResult?.data.id;
656
+ if (!userId) {
657
+ setErrors({ general: ["User registration failed. Please try again."] });
658
+ return false;
659
+ }
660
+ const organisationData = {
661
+ billing_address: values.organization.billing_address,
662
+ shipping_address: values.shipping_address,
663
+ contact_name: values.organization.contact_name,
664
+ credit_check: values.organization.credit_check,
665
+ custom_fields: values.organization.custom_fields,
666
+ email: values.organization.email.toLowerCase(),
667
+ external_ref: values.organization.external_ref,
668
+ invoice_email: values.organization.invoice_email?.toLowerCase(),
669
+ name: values.organization.name,
670
+ organisation_number: values.organization.organisation_number,
671
+ phone: values.organization.phone,
672
+ tax_id_vat_number: values.organization.tax_id_vat_number,
673
+ user_id: userId,
674
+ attribute_ids: values.organization.attribute ? [values.organization.attribute] : [],
675
+ status: organisationStatus
676
+ };
677
+ const orgResult = await registerOrganisationAction(organisationData);
678
+ if (orgResult?.error) {
679
+ setErrors({ general: [orgResult.error] });
680
+ return false;
681
+ }
682
+ return true;
683
+ }
684
+ function FormBody({
685
+ form,
686
+ l,
687
+ isPending,
688
+ showPassword,
689
+ showConfirmPassword,
690
+ setShowPassword,
691
+ setShowConfirmPassword,
692
+ useBillingAsShipping,
693
+ errors,
694
+ onSubmit,
695
+ extraLink
696
+ }) {
697
+ const addressLabels = {
698
+ streetAddress: l.streetAddress,
699
+ houseNumber: l.houseNumber,
700
+ coAddress: l.coAddress,
701
+ postalCode: l.postalCode,
702
+ city: l.city,
703
+ country: l.country
704
+ };
705
+ return /* @__PURE__ */ jsx("main", { className: "flex items-center justify-center px-4 py-8", children: /* @__PURE__ */ jsxs("div", { className: "w-full max-w-4xl bg-(--enad-surface) shadow-lg p-8 border border-(--enad-border-color) rounded-(--enad-card-radius)", children: [
706
+ /* @__PURE__ */ jsx("h2", { className: "text-2xl font-semibold mb-2 text-center text-(--enad-text-primary-color)", children: l.title }),
707
+ /* @__PURE__ */ jsx("p", { className: "text-sm mb-8 text-center text-(--enad-text-muted-color)", children: l.subtitle }),
290
708
  /* @__PURE__ */ jsxs("form", { onSubmit: form.handleSubmit(onSubmit), className: "space-y-8", children: [
291
- /* @__PURE__ */ jsxs("div", { className: "space-y-4", children: [
292
- /* @__PURE__ */ jsx("h3", { className: sectionTitleClasses, children: "Contact Person" }),
293
- /* @__PURE__ */ jsxs("div", { className: "grid md:grid-cols-2 gap-4", children: [
294
- /* @__PURE__ */ jsxs("div", { children: [
295
- /* @__PURE__ */ jsxs("label", { className: labelClasses, children: [
296
- "First Name ",
297
- /* @__PURE__ */ jsx("span", { className: "text-(--enad-error-color)", children: "*" })
298
- ] }),
299
- /* @__PURE__ */ jsx(
300
- "input",
301
- {
302
- ...form.register("user.first_name"),
303
- className: inputBaseClasses,
304
- placeholder: "John"
305
- }
306
- ),
307
- form.formState.errors.user?.first_name && /* @__PURE__ */ jsx("p", { className: errorClasses, children: form.formState.errors.user.first_name.message })
308
- ] }),
309
- /* @__PURE__ */ jsxs("div", { children: [
310
- /* @__PURE__ */ jsxs("label", { className: labelClasses, children: [
311
- "Last Name ",
312
- /* @__PURE__ */ jsx("span", { className: "text-(--enad-error-color)", children: "*" })
313
- ] }),
314
- /* @__PURE__ */ jsx(
315
- "input",
316
- {
317
- ...form.register("user.last_name"),
318
- className: inputBaseClasses,
319
- placeholder: "Doe"
320
- }
321
- ),
322
- form.formState.errors.user?.last_name && /* @__PURE__ */ jsx("p", { className: errorClasses, children: form.formState.errors.user.last_name.message })
323
- ] })
324
- ] }),
325
- /* @__PURE__ */ jsxs("div", { className: "grid md:grid-cols-2 gap-4", children: [
326
- /* @__PURE__ */ jsxs("div", { children: [
327
- /* @__PURE__ */ jsxs("label", { className: labelClasses, children: [
328
- "Email ",
329
- /* @__PURE__ */ jsx("span", { className: "text-(--enad-error-color)", children: "*" })
330
- ] }),
331
- /* @__PURE__ */ jsx(
332
- "input",
333
- {
334
- type: "email",
335
- ...form.register("user.email"),
336
- className: inputBaseClasses,
337
- placeholder: "you@example.com"
338
- }
339
- ),
340
- form.formState.errors.user?.email && /* @__PURE__ */ jsx("p", { className: errorClasses, children: form.formState.errors.user.email.message })
341
- ] }),
342
- /* @__PURE__ */ jsxs("div", { children: [
343
- /* @__PURE__ */ jsx("label", { className: labelClasses, children: "Phone Number" }),
344
- /* @__PURE__ */ jsx(
345
- "input",
346
- {
347
- type: "tel",
348
- ...form.register("user.phone_number"),
349
- className: inputBaseClasses,
350
- placeholder: "+46 123 456 789"
351
- }
352
- ),
353
- form.formState.errors.user?.phone_number && /* @__PURE__ */ jsx("p", { className: errorClasses, children: form.formState.errors.user.phone_number.message })
354
- ] })
355
- ] }),
356
- /* @__PURE__ */ jsxs("div", { className: "grid md:grid-cols-2 gap-4", children: [
357
- /* @__PURE__ */ jsxs("div", { children: [
358
- /* @__PURE__ */ jsxs("label", { className: labelClasses, children: [
359
- "Password ",
360
- /* @__PURE__ */ jsx("span", { className: "text-(--enad-error-color)", children: "*" })
361
- ] }),
362
- /* @__PURE__ */ jsxs("div", { className: "relative", children: [
363
- /* @__PURE__ */ jsx(
364
- "input",
365
- {
366
- type: showPassword ? "text" : "password",
367
- ...form.register("user.password"),
368
- className: inputBaseClasses + " pr-10",
369
- placeholder: "\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022"
370
- }
371
- ),
372
- /* @__PURE__ */ jsx(
373
- "button",
374
- {
375
- type: "button",
376
- onClick: () => setShowPassword(!showPassword),
377
- className: "absolute right-2 top-1/2 -translate-y-1/2 text-(--enad-text-muted-color)",
378
- children: showPassword ? "Hide" : "Show"
379
- }
380
- )
381
- ] }),
382
- form.formState.errors.user?.password && /* @__PURE__ */ jsx("p", { className: errorClasses, children: form.formState.errors.user.password.message })
383
- ] }),
384
- /* @__PURE__ */ jsxs("div", { children: [
385
- /* @__PURE__ */ jsxs("label", { className: labelClasses, children: [
386
- "Confirm Password ",
387
- /* @__PURE__ */ jsx("span", { className: "text-(--enad-error-color)", children: "*" })
388
- ] }),
389
- /* @__PURE__ */ jsxs("div", { className: "relative", children: [
390
- /* @__PURE__ */ jsx(
391
- "input",
392
- {
393
- type: showConfirmPassword ? "text" : "password",
394
- ...form.register("user.confirmPassword"),
395
- className: inputBaseClasses + " pr-10",
396
- placeholder: "\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022"
397
- }
398
- ),
399
- /* @__PURE__ */ jsx(
400
- "button",
401
- {
402
- type: "button",
403
- onClick: () => setShowConfirmPassword(!showConfirmPassword),
404
- className: "absolute right-2 top-1/2 -translate-y-1/2 text-(--enad-text-muted-color)",
405
- children: showConfirmPassword ? "Hide" : "Show"
406
- }
407
- )
408
- ] }),
409
- form.formState.errors.user?.confirmPassword && /* @__PURE__ */ jsx("p", { className: errorClasses, children: form.formState.errors.user.confirmPassword.message })
410
- ] })
411
- ] }),
412
- /* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
413
- /* @__PURE__ */ jsx("p", { className: "text-sm font-medium text-(--enad-text-primary-color)", children: "Communication Preferences" }),
414
- /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
415
- /* @__PURE__ */ jsx(
416
- "input",
417
- {
418
- type: "checkbox",
419
- ...form.register("user.allow_email_notifications"),
420
- className: "h-4 w-4"
421
- }
422
- ),
423
- /* @__PURE__ */ jsx("label", { className: "text-sm text-(--enad-text-primary-color)", children: "Accept email notifications" })
424
- ] }),
425
- /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
426
- /* @__PURE__ */ jsx(
427
- "input",
428
- {
429
- type: "checkbox",
430
- ...form.register("user.allow_phone_notifications"),
431
- className: "h-4 w-4"
432
- }
433
- ),
434
- /* @__PURE__ */ jsx("label", { className: "text-sm text-(--enad-text-primary-color)", children: "Accept SMS notifications" })
435
- ] }),
436
- /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
437
- /* @__PURE__ */ jsx(
438
- "input",
439
- {
440
- type: "checkbox",
441
- ...form.register("user.allow_postal_notifications"),
442
- className: "h-4 w-4"
443
- }
444
- ),
445
- /* @__PURE__ */ jsx("label", { className: "text-sm text-(--enad-text-primary-color)", children: "Accept postal notifications" })
446
- ] })
447
- ] })
448
- ] }),
449
- /* @__PURE__ */ jsxs("div", { className: "space-y-4", children: [
450
- /* @__PURE__ */ jsx("h3", { className: sectionTitleClasses, children: "Company Information" }),
451
- /* @__PURE__ */ jsxs("div", { children: [
452
- /* @__PURE__ */ jsxs("label", { className: labelClasses, children: [
453
- "Company Name ",
454
- /* @__PURE__ */ jsx("span", { className: "text-(--enad-error-color)", children: "*" })
455
- ] }),
456
- /* @__PURE__ */ jsx(
457
- "input",
458
- {
459
- ...form.register("organization.name"),
460
- className: inputBaseClasses,
461
- placeholder: "Company Name"
462
- }
463
- ),
464
- form.formState.errors.organization?.name && /* @__PURE__ */ jsx("p", { className: errorClasses, children: form.formState.errors.organization.name.message })
465
- ] }),
466
- /* @__PURE__ */ jsxs("div", { className: "grid md:grid-cols-2 gap-4", children: [
467
- /* @__PURE__ */ jsxs("div", { children: [
468
- /* @__PURE__ */ jsxs("label", { className: labelClasses, children: [
469
- "Organisation Number ",
470
- /* @__PURE__ */ jsx("span", { className: "text-(--enad-error-color)", children: "*" })
471
- ] }),
472
- /* @__PURE__ */ jsx(
473
- "input",
474
- {
475
- ...form.register("organization.organisation_number"),
476
- className: inputBaseClasses,
477
- placeholder: "1234567890",
478
- onChange: (e) => {
479
- form.setValue(
480
- "organization.organisation_number",
481
- e.target.value.replace(/\D/g, "")
482
- );
483
- }
484
- }
485
- ),
486
- form.formState.errors.organization?.organisation_number && /* @__PURE__ */ jsx("p", { className: errorClasses, children: form.formState.errors.organization.organisation_number.message })
487
- ] }),
488
- /* @__PURE__ */ jsxs("div", { children: [
489
- /* @__PURE__ */ jsxs("label", { className: labelClasses, children: [
490
- "Tax ID/VAT Number ",
491
- /* @__PURE__ */ jsx("span", { className: "text-(--enad-error-color)", children: "*" })
492
- ] }),
493
- /* @__PURE__ */ jsx(
494
- "input",
495
- {
496
- ...form.register("organization.tax_id_vat_number"),
497
- className: inputBaseClasses,
498
- placeholder: "SE123456789001"
499
- }
500
- ),
501
- form.formState.errors.organization?.tax_id_vat_number && /* @__PURE__ */ jsx("p", { className: errorClasses, children: form.formState.errors.organization.tax_id_vat_number.message })
502
- ] })
503
- ] }),
504
- /* @__PURE__ */ jsxs("div", { className: "grid md:grid-cols-2 gap-4", children: [
505
- /* @__PURE__ */ jsxs("div", { children: [
506
- /* @__PURE__ */ jsxs("label", { className: labelClasses, children: [
507
- "Company Email ",
508
- /* @__PURE__ */ jsx("span", { className: "text-(--enad-error-color)", children: "*" })
509
- ] }),
510
- /* @__PURE__ */ jsx(
511
- "input",
512
- {
513
- type: "email",
514
- ...form.register("organization.email"),
515
- className: inputBaseClasses,
516
- placeholder: "company@example.com"
517
- }
518
- ),
519
- form.formState.errors.organization?.email && /* @__PURE__ */ jsx("p", { className: errorClasses, children: form.formState.errors.organization.email.message })
520
- ] }),
521
- /* @__PURE__ */ jsxs("div", { children: [
522
- /* @__PURE__ */ jsx("label", { className: labelClasses, children: "Company Phone" }),
523
- /* @__PURE__ */ jsx(
524
- "input",
525
- {
526
- type: "tel",
527
- ...form.register("organization.phone"),
528
- className: inputBaseClasses,
529
- placeholder: "+46 123 456 789"
530
- }
531
- ),
532
- form.formState.errors.organization?.phone && /* @__PURE__ */ jsx("p", { className: errorClasses, children: form.formState.errors.organization.phone.message })
533
- ] })
534
- ] }),
535
- /* @__PURE__ */ jsxs("div", { children: [
536
- /* @__PURE__ */ jsx("label", { className: labelClasses, children: "Invoice Email" }),
537
- /* @__PURE__ */ jsx(
538
- "input",
539
- {
540
- type: "email",
541
- ...form.register("organization.invoice_email"),
542
- className: inputBaseClasses,
543
- placeholder: "invoices@example.com"
544
- }
545
- ),
546
- form.formState.errors.organization?.invoice_email && /* @__PURE__ */ jsx("p", { className: errorClasses, children: form.formState.errors.organization.invoice_email.message })
547
- ] }),
548
- /* @__PURE__ */ jsxs("div", { className: "grid md:grid-cols-2 gap-4", children: [
549
- /* @__PURE__ */ jsxs("div", { children: [
550
- /* @__PURE__ */ jsx("label", { className: labelClasses, children: "Contact Name" }),
551
- /* @__PURE__ */ jsx(
552
- "input",
553
- {
554
- ...form.register("organization.contact_name"),
555
- className: inputBaseClasses,
556
- placeholder: "Contact Person"
557
- }
558
- ),
559
- form.formState.errors.organization?.contact_name && /* @__PURE__ */ jsx("p", { className: errorClasses, children: form.formState.errors.organization.contact_name.message })
560
- ] }),
561
- /* @__PURE__ */ jsxs("div", { children: [
562
- /* @__PURE__ */ jsx("label", { className: labelClasses, children: "External Reference" }),
563
- /* @__PURE__ */ jsx(
564
- "input",
565
- {
566
- ...form.register("organization.external_ref"),
567
- className: inputBaseClasses,
568
- placeholder: "External Ref"
569
- }
570
- ),
571
- form.formState.errors.organization?.external_ref && /* @__PURE__ */ jsx("p", { className: errorClasses, children: form.formState.errors.organization.external_ref.message })
572
- ] })
573
- ] })
574
- ] }),
575
- /* @__PURE__ */ jsxs("div", { className: "space-y-4", children: [
576
- /* @__PURE__ */ jsx("h3", { className: sectionTitleClasses, children: "Billing Address" }),
577
- /* @__PURE__ */ jsxs("div", { className: "grid md:grid-cols-2 gap-4", children: [
578
- /* @__PURE__ */ jsxs("div", { children: [
579
- /* @__PURE__ */ jsxs("label", { className: labelClasses, children: [
580
- "Street Address ",
581
- /* @__PURE__ */ jsx("span", { className: "text-(--enad-error-color)", children: "*" })
582
- ] }),
583
- /* @__PURE__ */ jsx(
584
- "input",
585
- {
586
- ...form.register("organization.billing_address.0.street_address"),
587
- className: inputBaseClasses,
588
- placeholder: "Street Address"
589
- }
590
- ),
591
- form.formState.errors.organization?.billing_address?.[0]?.street_address && /* @__PURE__ */ jsx("p", { className: errorClasses, children: form.formState.errors.organization.billing_address[0]?.street_address?.message })
592
- ] }),
593
- /* @__PURE__ */ jsxs("div", { children: [
594
- /* @__PURE__ */ jsx("label", { className: labelClasses, children: "House Number" }),
595
- /* @__PURE__ */ jsx(
596
- "input",
597
- {
598
- ...form.register("organization.billing_address.0.house_number"),
599
- className: inputBaseClasses,
600
- placeholder: "123"
601
- }
602
- )
603
- ] })
604
- ] }),
605
- /* @__PURE__ */ jsxs("div", { className: "grid md:grid-cols-2 gap-4", children: [
606
- /* @__PURE__ */ jsxs("div", { children: [
607
- /* @__PURE__ */ jsx("label", { className: labelClasses, children: "Co Address" }),
608
- /* @__PURE__ */ jsx(
609
- "input",
610
- {
611
- ...form.register("organization.billing_address.0.co_address"),
612
- className: inputBaseClasses,
613
- placeholder: "Co Address"
614
- }
615
- )
616
- ] }),
617
- /* @__PURE__ */ jsxs("div", { children: [
618
- /* @__PURE__ */ jsxs("label", { className: labelClasses, children: [
619
- "Postal Code ",
620
- /* @__PURE__ */ jsx("span", { className: "text-(--enad-error-color)", children: "*" })
621
- ] }),
622
- /* @__PURE__ */ jsx(
623
- "input",
624
- {
625
- ...form.register("organization.billing_address.0.postal_code"),
626
- className: inputBaseClasses,
627
- placeholder: "12345"
628
- }
629
- ),
630
- form.formState.errors.organization?.billing_address?.[0]?.postal_code && /* @__PURE__ */ jsx("p", { className: errorClasses, children: form.formState.errors.organization.billing_address[0]?.postal_code?.message })
631
- ] })
632
- ] }),
633
- /* @__PURE__ */ jsxs("div", { className: "grid md:grid-cols-2 gap-4", children: [
634
- /* @__PURE__ */ jsxs("div", { children: [
635
- /* @__PURE__ */ jsxs("label", { className: labelClasses, children: [
636
- "City ",
637
- /* @__PURE__ */ jsx("span", { className: "text-(--enad-error-color)", children: "*" })
638
- ] }),
639
- /* @__PURE__ */ jsx(
640
- "input",
641
- {
642
- ...form.register("organization.billing_address.0.city"),
643
- className: inputBaseClasses,
644
- placeholder: "City"
645
- }
646
- ),
647
- form.formState.errors.organization?.billing_address?.[0]?.city && /* @__PURE__ */ jsx("p", { className: errorClasses, children: form.formState.errors.organization.billing_address[0]?.city?.message })
648
- ] }),
649
- /* @__PURE__ */ jsxs("div", { children: [
650
- /* @__PURE__ */ jsxs("label", { className: labelClasses, children: [
651
- "Country ",
652
- /* @__PURE__ */ jsx("span", { className: "text-(--enad-error-color)", children: "*" })
653
- ] }),
654
- /* @__PURE__ */ jsxs(
655
- "select",
656
- {
657
- ...form.register("organization.billing_address.0.country"),
658
- className: inputBaseClasses,
659
- children: [
660
- /* @__PURE__ */ jsx("option", { value: "SE", children: "Sweden" }),
661
- /* @__PURE__ */ jsx("option", { value: "NO", children: "Norway" }),
662
- /* @__PURE__ */ jsx("option", { value: "DK", children: "Denmark" }),
663
- /* @__PURE__ */ jsx("option", { value: "FI", children: "Finland" })
664
- ]
665
- }
666
- ),
667
- form.formState.errors.organization?.billing_address?.[0]?.country && /* @__PURE__ */ jsx("p", { className: errorClasses, children: form.formState.errors.organization.billing_address[0]?.country?.message })
668
- ] })
669
- ] })
670
- ] }),
671
- /* @__PURE__ */ jsxs("div", { className: "space-y-4", children: [
672
- /* @__PURE__ */ jsx("h3", { className: sectionTitleClasses, children: "Shipping Address" }),
673
- /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 mb-4", children: [
674
- /* @__PURE__ */ jsx(
675
- "input",
676
- {
677
- type: "checkbox",
678
- ...form.register("use_billing_as_shipping"),
679
- className: "h-4 w-4"
680
- }
681
- ),
682
- /* @__PURE__ */ jsx("label", { className: "text-sm font-medium text-(--enad-text-primary-color)", children: "Same address as billing address" })
683
- ] }),
684
- !useBillingAsShipping && /* @__PURE__ */ jsxs(Fragment, { children: [
685
- /* @__PURE__ */ jsxs("div", { className: "grid md:grid-cols-2 gap-4", children: [
686
- /* @__PURE__ */ jsxs("div", { children: [
687
- /* @__PURE__ */ jsxs("label", { className: labelClasses, children: [
688
- "Street Address ",
689
- /* @__PURE__ */ jsx("span", { className: "text-(--enad-error-color)", children: "*" })
690
- ] }),
691
- /* @__PURE__ */ jsx(
692
- "input",
693
- {
694
- ...form.register("shipping_address.0.street_address"),
695
- className: inputBaseClasses,
696
- placeholder: "Street Address"
697
- }
698
- ),
699
- form.formState.errors.shipping_address?.[0]?.street_address && /* @__PURE__ */ jsx("p", { className: errorClasses, children: form.formState.errors.shipping_address[0]?.street_address?.message })
700
- ] }),
701
- /* @__PURE__ */ jsxs("div", { children: [
702
- /* @__PURE__ */ jsx("label", { className: labelClasses, children: "House Number" }),
703
- /* @__PURE__ */ jsx(
704
- "input",
705
- {
706
- ...form.register("shipping_address.0.house_number"),
707
- className: inputBaseClasses,
708
- placeholder: "123"
709
- }
710
- )
711
- ] })
712
- ] }),
713
- /* @__PURE__ */ jsxs("div", { className: "grid md:grid-cols-2 gap-4", children: [
714
- /* @__PURE__ */ jsxs("div", { children: [
715
- /* @__PURE__ */ jsx("label", { className: labelClasses, children: "Co Address" }),
716
- /* @__PURE__ */ jsx(
717
- "input",
718
- {
719
- ...form.register("shipping_address.0.co_address"),
720
- className: inputBaseClasses,
721
- placeholder: "Co Address"
722
- }
723
- )
724
- ] }),
725
- /* @__PURE__ */ jsxs("div", { children: [
726
- /* @__PURE__ */ jsxs("label", { className: labelClasses, children: [
727
- "Postal Code ",
728
- /* @__PURE__ */ jsx("span", { className: "text-(--enad-error-color)", children: "*" })
729
- ] }),
730
- /* @__PURE__ */ jsx(
731
- "input",
732
- {
733
- ...form.register("shipping_address.0.postal_code"),
734
- className: inputBaseClasses,
735
- placeholder: "12345"
736
- }
737
- ),
738
- form.formState.errors.shipping_address?.[0]?.postal_code && /* @__PURE__ */ jsx("p", { className: errorClasses, children: form.formState.errors.shipping_address[0]?.postal_code?.message })
739
- ] })
740
- ] }),
741
- /* @__PURE__ */ jsxs("div", { className: "grid md:grid-cols-2 gap-4", children: [
742
- /* @__PURE__ */ jsxs("div", { children: [
743
- /* @__PURE__ */ jsxs("label", { className: labelClasses, children: [
744
- "City ",
745
- /* @__PURE__ */ jsx("span", { className: "text-(--enad-error-color)", children: "*" })
746
- ] }),
747
- /* @__PURE__ */ jsx(
748
- "input",
749
- {
750
- ...form.register("shipping_address.0.city"),
751
- className: inputBaseClasses,
752
- placeholder: "City"
753
- }
754
- ),
755
- form.formState.errors.shipping_address?.[0]?.city && /* @__PURE__ */ jsx("p", { className: errorClasses, children: form.formState.errors.shipping_address[0]?.city?.message })
756
- ] }),
757
- /* @__PURE__ */ jsxs("div", { children: [
758
- /* @__PURE__ */ jsxs("label", { className: labelClasses, children: [
759
- "Country ",
760
- /* @__PURE__ */ jsx("span", { className: "text-(--enad-error-color)", children: "*" })
761
- ] }),
762
- /* @__PURE__ */ jsxs(
763
- "select",
764
- {
765
- ...form.register("shipping_address.0.country"),
766
- className: inputBaseClasses,
767
- children: [
768
- /* @__PURE__ */ jsx("option", { value: "SE", children: "Sweden" }),
769
- /* @__PURE__ */ jsx("option", { value: "NO", children: "Norway" }),
770
- /* @__PURE__ */ jsx("option", { value: "DK", children: "Denmark" }),
771
- /* @__PURE__ */ jsx("option", { value: "FI", children: "Finland" })
772
- ]
773
- }
774
- ),
775
- form.formState.errors.shipping_address?.[0]?.country && /* @__PURE__ */ jsx("p", { className: errorClasses, children: form.formState.errors.shipping_address[0]?.country?.message })
776
- ] })
777
- ] })
778
- ] })
779
- ] }),
709
+ /* @__PURE__ */ jsx(
710
+ ContactPersonSection,
711
+ {
712
+ form,
713
+ labels: {
714
+ sectionTitle: l.contactPersonSection,
715
+ firstName: l.firstName,
716
+ lastName: l.lastName,
717
+ email: l.email,
718
+ phone: l.phoneNumber,
719
+ password: l.password,
720
+ confirmPassword: l.confirmPassword,
721
+ communicationPreferences: l.communicationPreferences,
722
+ emailNotifications: l.emailNotifications,
723
+ smsNotifications: l.smsNotifications,
724
+ postalNotifications: l.postalNotifications
725
+ },
726
+ showPassword,
727
+ showConfirmPassword,
728
+ onTogglePassword: () => setShowPassword(!showPassword),
729
+ onToggleConfirmPassword: () => setShowConfirmPassword(!showConfirmPassword)
730
+ }
731
+ ),
732
+ /* @__PURE__ */ jsx(
733
+ CompanyInfoSection,
734
+ {
735
+ form,
736
+ labels: {
737
+ sectionTitle: l.companyInfoSection,
738
+ companyName: l.companyName,
739
+ orgNumber: l.organisationNumber,
740
+ vatNumber: l.taxIdVatNumber,
741
+ companyEmail: l.companyEmail,
742
+ companyPhone: l.companyPhone,
743
+ invoiceEmail: l.invoiceEmail,
744
+ contactName: l.contactName,
745
+ externalRef: l.externalRef
746
+ }
747
+ }
748
+ ),
749
+ /* @__PURE__ */ jsx(
750
+ BillingAddressSection,
751
+ {
752
+ form,
753
+ labels: { sectionTitle: l.billingAddressSection, ...addressLabels }
754
+ }
755
+ ),
756
+ /* @__PURE__ */ jsx(
757
+ ShippingAddressSection,
758
+ {
759
+ form,
760
+ useBillingAsShipping,
761
+ labels: {
762
+ sectionTitle: l.shippingAddressSection,
763
+ sameBillingAsShipping: l.sameBillingAsShipping,
764
+ ...addressLabels
765
+ }
766
+ }
767
+ ),
780
768
  /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
781
- /* @__PURE__ */ jsx("input", { type: "checkbox", ...form.register("terms_accepted"), className: "h-4 w-4" }),
769
+ /* @__PURE__ */ jsx(
770
+ "input",
771
+ {
772
+ type: "checkbox",
773
+ ...form.register("terms_accepted"),
774
+ "aria-describedby": ariaError(form.formState.errors.terms_accepted, "terms-error"),
775
+ className: "h-4 w-4"
776
+ }
777
+ ),
782
778
  /* @__PURE__ */ jsxs("label", { className: "text-sm text-(--enad-text-primary-color)", children: [
783
- "I accept the",
779
+ l.acceptTerms,
784
780
  " ",
785
781
  /* @__PURE__ */ jsx(
786
782
  "a",
@@ -788,14 +784,14 @@ const SignupOrganisationForm = ({
788
784
  href: "/terms",
789
785
  target: "_blank",
790
786
  className: "text-(--enad-link-color) hover:text-(--enad-link-hover-color) hover:underline",
791
- children: "terms and conditions"
787
+ children: l.termsLinkText
792
788
  }
793
789
  )
794
790
  ] })
795
791
  ] }),
796
- form.formState.errors.terms_accepted && /* @__PURE__ */ jsx("p", { className: errorClasses, children: form.formState.errors.terms_accepted.message }),
797
- /* @__PURE__ */ jsx("button", { type: "submit", disabled: isPending, className: buttonBaseClasses, children: isPending ? "Signing up..." : submitText }),
798
- errors.general && /* @__PURE__ */ jsx("p", { className: errorClasses + " mt-2 text-center", children: errors.general.join(", ") })
792
+ form.formState.errors.terms_accepted && /* @__PURE__ */ jsx("p", { id: "terms-error", role: "alert", className: ERROR_CLASSES, children: form.formState.errors.terms_accepted.message }),
793
+ /* @__PURE__ */ jsx(StorefrontButton, { type: "submit", disabled: isPending, className: "w-full", children: isPending ? l.signingUp : l.submit }),
794
+ errors.general && /* @__PURE__ */ jsx("p", { role: "alert", className: ERROR_CLASSES + " mt-2 text-center", children: errors.general.join(", ") })
799
795
  ] }),
800
796
  extraLink && /* @__PURE__ */ jsx("p", { className: "text-sm text-(--enad-text-muted-color) text-center mt-6", children: /* @__PURE__ */ jsx(
801
797
  "a",
@@ -806,6 +802,61 @@ const SignupOrganisationForm = ({
806
802
  }
807
803
  ) })
808
804
  ] }) });
805
+ }
806
+ const SignupOrganisationForm = ({
807
+ labels = {},
808
+ extraLink = { href: "/login", text: "Already have an account? Sign in" },
809
+ organisationStatus = "active",
810
+ defaultMarket = "SE",
811
+ defaultLanguage = "SV",
812
+ defaultCountry = "SE",
813
+ defaultStoreGroup = "default"
814
+ }) => {
815
+ const l = resolveLabels(labels);
816
+ const [errors, setErrors] = useState({});
817
+ const [isPending, setIsPending] = useState(false);
818
+ const [showPassword, setShowPassword] = useState(false);
819
+ const [showConfirmPassword, setShowConfirmPassword] = useState(false);
820
+ const [confirmMode, setConfirmMode] = useState(false);
821
+ const form = useForm({
822
+ resolver: zodResolver(formSchema),
823
+ defaultValues: buildDefaultValues(defaultLanguage, defaultMarket, defaultCountry, defaultStoreGroup)
824
+ });
825
+ const { useBillingAsShipping } = useAutoFillEffects(form);
826
+ const onSubmit = async (values) => {
827
+ setIsPending(true);
828
+ setErrors({});
829
+ try {
830
+ const success = await submitRegistration(values, organisationStatus, setErrors);
831
+ if (success) {
832
+ setConfirmMode(true);
833
+ }
834
+ } catch (error) {
835
+ console.error("Registration error:", error);
836
+ setErrors({ general: ["Failed to register. Please try again."] });
837
+ } finally {
838
+ setIsPending(false);
839
+ }
840
+ };
841
+ if (confirmMode) {
842
+ return /* @__PURE__ */ jsx(ConfirmationView, { title: l.verifyEmailTitle, message: l.verifyEmailMessage });
843
+ }
844
+ return /* @__PURE__ */ jsx(
845
+ FormBody,
846
+ {
847
+ form,
848
+ l,
849
+ isPending,
850
+ showPassword,
851
+ showConfirmPassword,
852
+ setShowPassword,
853
+ setShowConfirmPassword,
854
+ useBillingAsShipping,
855
+ errors,
856
+ onSubmit,
857
+ extraLink
858
+ }
859
+ );
809
860
  };
810
861
  export {
811
862
  SignupOrganisationForm