@akinon/projectzero 1.32.0 → 1.33.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (506) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/app-template/.editorconfig +7 -0
  3. package/app-template/.env.example +9 -0
  4. package/app-template/.eslintignore +1 -0
  5. package/app-template/.eslintrc.js +31 -0
  6. package/app-template/.gitattributes +18 -0
  7. package/app-template/.husky/pre-commit +4 -0
  8. package/app-template/.lintstagedrc.js +12 -0
  9. package/app-template/.prettierrc +13 -0
  10. package/app-template/.releaserc.json +49 -0
  11. package/app-template/.stylelintrc.json +37 -0
  12. package/app-template/.vscode/extensions.json +11 -0
  13. package/app-template/.vscode/launch.json +29 -0
  14. package/app-template/.yarnrc +1 -0
  15. package/app-template/CHANGELOG.md +636 -0
  16. package/app-template/LICENSE +21 -0
  17. package/app-template/Procfile +1 -0
  18. package/app-template/README.md +29 -0
  19. package/app-template/akinon.json +28 -0
  20. package/app-template/bitbucket-pipelines.yml +54 -0
  21. package/app-template/build.sh +7 -0
  22. package/app-template/docs/CHANGELOG.md +85 -0
  23. package/app-template/docs/advanced-usage.md +43 -0
  24. package/app-template/docs/basic-setup.md +59 -0
  25. package/app-template/docs/data-fetching/client/account.md +1064 -0
  26. package/app-template/docs/data-fetching/client/address.md +805 -0
  27. package/app-template/docs/data-fetching/client/basket.md +107 -0
  28. package/app-template/docs/data-fetching/client/checkout.md +904 -0
  29. package/app-template/docs/data-fetching/client/misc.md +135 -0
  30. package/app-template/docs/data-fetching/client/product.md +284 -0
  31. package/app-template/docs/data-fetching/client/user.md +56 -0
  32. package/app-template/docs/data-fetching/client/wishlist.md +111 -0
  33. package/app-template/docs/data-fetching/server/category.md +324 -0
  34. package/app-template/docs/data-fetching/server/flat-page.md +42 -0
  35. package/app-template/docs/data-fetching/server/list.md +353 -0
  36. package/app-template/docs/data-fetching/server/menu.md +363 -0
  37. package/app-template/docs/data-fetching/server/product.md +131 -0
  38. package/app-template/docs/data-fetching/server/seo.md +44 -0
  39. package/app-template/docs/data-fetching/server/special-page.md +79 -0
  40. package/app-template/docs/data-fetching/server/widget.md +218 -0
  41. package/app-template/docs/delete-account.md +25 -0
  42. package/app-template/docs/deployment.md +46 -0
  43. package/app-template/docs/dynamic-route.md +33 -0
  44. package/app-template/docs/icons.md +52 -0
  45. package/app-template/docs/localization.md +204 -0
  46. package/app-template/docs/logging.md +48 -0
  47. package/app-template/docs/plugins.md +76 -0
  48. package/app-template/docs/seo-management.md +125 -0
  49. package/app-template/docs/static-assets.md +36 -0
  50. package/app-template/docs/widgets.md +127 -0
  51. package/app-template/global.d.ts +1 -0
  52. package/app-template/jest.config.ts +34 -0
  53. package/app-template/next-env.d.ts +6 -0
  54. package/app-template/next.config.mjs +34 -0
  55. package/app-template/package.json +97 -0
  56. package/app-template/plugins.d.ts +1 -0
  57. package/app-template/postcss.config.js +6 -0
  58. package/app-template/public/404.png +0 -0
  59. package/app-template/public/500.png +0 -0
  60. package/app-template/public/apple-splash-1125-2436.jpg +0 -0
  61. package/app-template/public/apple-splash-1136-640.jpg +0 -0
  62. package/app-template/public/apple-splash-1170-2532.jpg +0 -0
  63. package/app-template/public/apple-splash-1242-2208.jpg +0 -0
  64. package/app-template/public/apple-splash-1242-2688.jpg +0 -0
  65. package/app-template/public/apple-splash-1284-2778.jpg +0 -0
  66. package/app-template/public/apple-splash-1334-750.jpg +0 -0
  67. package/app-template/public/apple-splash-1536-2048.jpg +0 -0
  68. package/app-template/public/apple-splash-1620-2160.jpg +0 -0
  69. package/app-template/public/apple-splash-1668-2224.jpg +0 -0
  70. package/app-template/public/apple-splash-1668-2388.jpg +0 -0
  71. package/app-template/public/apple-splash-1792-828.jpg +0 -0
  72. package/app-template/public/apple-splash-2048-1536.jpg +0 -0
  73. package/app-template/public/apple-splash-2048-2732.jpg +0 -0
  74. package/app-template/public/apple-splash-2160-1620.jpg +0 -0
  75. package/app-template/public/apple-splash-2208-1242.jpg +0 -0
  76. package/app-template/public/apple-splash-2224-1668.jpg +0 -0
  77. package/app-template/public/apple-splash-2388-1668.jpg +0 -0
  78. package/app-template/public/apple-splash-2436-1125.jpg +0 -0
  79. package/app-template/public/apple-splash-2532-1170.jpg +0 -0
  80. package/app-template/public/apple-splash-2688-1242.jpg +0 -0
  81. package/app-template/public/apple-splash-2732-2048.jpg +0 -0
  82. package/app-template/public/apple-splash-2778-1284.jpg +0 -0
  83. package/app-template/public/apple-splash-640-1136.jpg +0 -0
  84. package/app-template/public/apple-splash-750-1334.jpg +0 -0
  85. package/app-template/public/apple-splash-828-1792.jpg +0 -0
  86. package/app-template/public/apple-touch-icon-152x152.png +0 -0
  87. package/app-template/public/apple-touch-icon-167x167.png +0 -0
  88. package/app-template/public/apple-touch-icon-180x180.png +0 -0
  89. package/app-template/public/apple-touch-icon.png +0 -0
  90. package/app-template/public/apple.svg +47 -0
  91. package/app-template/public/cvv.jpg +0 -0
  92. package/app-template/public/facebook.svg +3 -0
  93. package/app-template/public/google.svg +12 -0
  94. package/app-template/public/icon-192x192.png +0 -0
  95. package/app-template/public/icon-256x256.png +0 -0
  96. package/app-template/public/icon-384x384.png +0 -0
  97. package/app-template/public/icon-512x512.png +0 -0
  98. package/app-template/public/icon-sprite.svg +528 -0
  99. package/app-template/public/locales/en/account.json +490 -0
  100. package/app-template/public/locales/en/auth.json +100 -0
  101. package/app-template/public/locales/en/basket.json +50 -0
  102. package/app-template/public/locales/en/category.json +26 -0
  103. package/app-template/public/locales/en/checkout.json +152 -0
  104. package/app-template/public/locales/en/common.json +65 -0
  105. package/app-template/public/locales/en/forgot_password.json +41 -0
  106. package/app-template/public/locales/en/form.json +5 -0
  107. package/app-template/public/locales/en/product.json +39 -0
  108. package/app-template/public/locales/tr/account.json +490 -0
  109. package/app-template/public/locales/tr/auth.json +100 -0
  110. package/app-template/public/locales/tr/basket.json +50 -0
  111. package/app-template/public/locales/tr/category.json +26 -0
  112. package/app-template/public/locales/tr/checkout.json +152 -0
  113. package/app-template/public/locales/tr/common.json +65 -0
  114. package/app-template/public/locales/tr/forgot_password.json +41 -0
  115. package/app-template/public/locales/tr/form.json +5 -0
  116. package/app-template/public/locales/tr/product.json +39 -0
  117. package/app-template/public/logo.svg +29 -0
  118. package/app-template/public/manifest.json +35 -0
  119. package/app-template/public/mastercard.png +0 -0
  120. package/app-template/public/mastersecure.png +0 -0
  121. package/app-template/public/mfs-client.min.js +3 -0
  122. package/app-template/public/noimage.jpg +0 -0
  123. package/app-template/public/safari-pinned-tab.svg +320 -0
  124. package/app-template/public/ssl-secure.png +0 -0
  125. package/app-template/public/vbv.png +0 -0
  126. package/app-template/public/visa.png +0 -0
  127. package/app-template/public/zepto.min.js +2 -0
  128. package/app-template/sentry.client.config.ts +16 -0
  129. package/app-template/sentry.edge.config.ts +3 -0
  130. package/app-template/sentry.properties +4 -0
  131. package/app-template/sentry.server.config.ts +3 -0
  132. package/app-template/setupTests.ts +4 -0
  133. package/app-template/src/__tests__/index.test.tsx +7 -0
  134. package/app-template/src/__tests__/tsconfig.json +7 -0
  135. package/app-template/src/app/[commerce]/[locale]/[currency]/account/address/page.tsx +74 -0
  136. package/app-template/src/app/[commerce]/[locale]/[currency]/account/change-email/page.tsx +174 -0
  137. package/app-template/src/app/[commerce]/[locale]/[currency]/account/change-password/page.tsx +206 -0
  138. package/app-template/src/app/[commerce]/[locale]/[currency]/account/contact/page.tsx +7 -0
  139. package/app-template/src/app/[commerce]/[locale]/[currency]/account/coupons/page.tsx +210 -0
  140. package/app-template/src/app/[commerce]/[locale]/[currency]/account/email-verification/page.tsx +5 -0
  141. package/app-template/src/app/[commerce]/[locale]/[currency]/account/faq/page.tsx +23 -0
  142. package/app-template/src/app/[commerce]/[locale]/[currency]/account/favourite-products/page.tsx +32 -0
  143. package/app-template/src/app/[commerce]/[locale]/[currency]/account/layout.tsx +28 -0
  144. package/app-template/src/app/[commerce]/[locale]/[currency]/account/my-quotations/page.tsx +7 -0
  145. package/app-template/src/app/[commerce]/[locale]/[currency]/account/orders/[id]/cancellation/page.tsx +255 -0
  146. package/app-template/src/app/[commerce]/[locale]/[currency]/account/orders/[id]/layout.tsx +5 -0
  147. package/app-template/src/app/[commerce]/[locale]/[currency]/account/orders/[id]/page.tsx +309 -0
  148. package/app-template/src/app/[commerce]/[locale]/[currency]/account/orders/page.tsx +137 -0
  149. package/app-template/src/app/[commerce]/[locale]/[currency]/account/page.tsx +226 -0
  150. package/app-template/src/app/[commerce]/[locale]/[currency]/account/profile/page.tsx +399 -0
  151. package/app-template/src/app/[commerce]/[locale]/[currency]/address/stores/page.tsx +271 -0
  152. package/app-template/src/app/[commerce]/[locale]/[currency]/anonymous-tracking/page.tsx +33 -0
  153. package/app-template/src/app/[commerce]/[locale]/[currency]/auth/oauth-login/page.tsx +3 -0
  154. package/app-template/src/app/[commerce]/[locale]/[currency]/auth/page.tsx +76 -0
  155. package/app-template/src/app/[commerce]/[locale]/[currency]/basket/page.tsx +77 -0
  156. package/app-template/src/app/[commerce]/[locale]/[currency]/basket-b2b/page.tsx +7 -0
  157. package/app-template/src/app/[commerce]/[locale]/[currency]/category/[pk]/loading.tsx +53 -0
  158. package/app-template/src/app/[commerce]/[locale]/[currency]/category/[pk]/page.tsx +16 -0
  159. package/app-template/src/app/[commerce]/[locale]/[currency]/client-root.tsx +9 -0
  160. package/app-template/src/app/[commerce]/[locale]/[currency]/contact-us/page.tsx +11 -0
  161. package/app-template/src/app/[commerce]/[locale]/[currency]/error.tsx +20 -0
  162. package/app-template/src/app/[commerce]/[locale]/[currency]/flat-page/[pk]/loading.tsx +5 -0
  163. package/app-template/src/app/[commerce]/[locale]/[currency]/flat-page/[pk]/page.tsx +18 -0
  164. package/app-template/src/app/[commerce]/[locale]/[currency]/forms/[pk]/generate/page.tsx +48 -0
  165. package/app-template/src/app/[commerce]/[locale]/[currency]/group-product/[pk]/loading.tsx +5 -0
  166. package/app-template/src/app/[commerce]/[locale]/[currency]/group-product/[pk]/page.tsx +72 -0
  167. package/app-template/src/app/[commerce]/[locale]/[currency]/landing-page/[pk]/loading.tsx +5 -0
  168. package/app-template/src/app/[commerce]/[locale]/[currency]/landing-page/[pk]/page.tsx +23 -0
  169. package/app-template/src/app/[commerce]/[locale]/[currency]/layout.tsx +78 -0
  170. package/app-template/src/app/[commerce]/[locale]/[currency]/list/loading.tsx +53 -0
  171. package/app-template/src/app/[commerce]/[locale]/[currency]/list/page.tsx +16 -0
  172. package/app-template/src/app/[commerce]/[locale]/[currency]/orders/checkout/page.tsx +140 -0
  173. package/app-template/src/app/[commerce]/[locale]/[currency]/orders/completed/[token]/layout.tsx +5 -0
  174. package/app-template/src/app/[commerce]/[locale]/[currency]/orders/completed/[token]/page.tsx +284 -0
  175. package/app-template/src/app/[commerce]/[locale]/[currency]/page.tsx +50 -0
  176. package/app-template/src/app/[commerce]/[locale]/[currency]/product/[pk]/loading.tsx +67 -0
  177. package/app-template/src/app/[commerce]/[locale]/[currency]/product/[pk]/page.tsx +81 -0
  178. package/app-template/src/app/[commerce]/[locale]/[currency]/special-page/[pk]/loading.tsx +53 -0
  179. package/app-template/src/app/[commerce]/[locale]/[currency]/special-page/[pk]/page.tsx +25 -0
  180. package/app-template/src/app/[commerce]/[locale]/[currency]/template.tsx +75 -0
  181. package/app-template/src/app/[commerce]/[locale]/[currency]/users/email-set-primary/[[...id]]/page.tsx +43 -0
  182. package/app-template/src/app/[commerce]/[locale]/[currency]/users/password/reset/page.tsx +79 -0
  183. package/app-template/src/app/[commerce]/[locale]/[currency]/users/registration/account-confirm-email/[[...id]]/page.tsx +43 -0
  184. package/app-template/src/app/[commerce]/[locale]/[currency]/users/reset/[[...id]]/page.tsx +110 -0
  185. package/app-template/src/app/[commerce]/[locale]/[currency]/xml-sitemap/[node]/route.ts +25 -0
  186. package/app-template/src/app/[commerce]/[locale]/[currency]/xml-sitemap/route.ts +37 -0
  187. package/app-template/src/app/api/cache/route.ts +1 -0
  188. package/app-template/src/app/api/client/[...slug]/route.ts +1 -0
  189. package/app-template/src/app/api/form/[...id]/route.ts +7 -0
  190. package/app-template/src/app/api/logout/route.ts +1 -0
  191. package/app-template/src/app/api/sentry/route.ts +9 -0
  192. package/app-template/src/app/api/web-vitals/route.ts +1 -0
  193. package/app-template/src/app/favicon.ico +0 -0
  194. package/app-template/src/assets/fonts/Jost/Jost-Black.eot +0 -0
  195. package/app-template/src/assets/fonts/Jost/Jost-Black.ttf +0 -0
  196. package/app-template/src/assets/fonts/Jost/Jost-Black.woff +0 -0
  197. package/app-template/src/assets/fonts/Jost/Jost-Black.woff2 +0 -0
  198. package/app-template/src/assets/fonts/Jost/Jost-BlackItalic.eot +0 -0
  199. package/app-template/src/assets/fonts/Jost/Jost-BlackItalic.ttf +0 -0
  200. package/app-template/src/assets/fonts/Jost/Jost-BlackItalic.woff +0 -0
  201. package/app-template/src/assets/fonts/Jost/Jost-BlackItalic.woff2 +0 -0
  202. package/app-template/src/assets/fonts/Jost/Jost-Bold.eot +0 -0
  203. package/app-template/src/assets/fonts/Jost/Jost-Bold.ttf +0 -0
  204. package/app-template/src/assets/fonts/Jost/Jost-Bold.woff +0 -0
  205. package/app-template/src/assets/fonts/Jost/Jost-Bold.woff2 +0 -0
  206. package/app-template/src/assets/fonts/Jost/Jost-BoldItalic.eot +0 -0
  207. package/app-template/src/assets/fonts/Jost/Jost-BoldItalic.ttf +0 -0
  208. package/app-template/src/assets/fonts/Jost/Jost-BoldItalic.woff +0 -0
  209. package/app-template/src/assets/fonts/Jost/Jost-BoldItalic.woff2 +0 -0
  210. package/app-template/src/assets/fonts/Jost/Jost-ExtraBold.eot +0 -0
  211. package/app-template/src/assets/fonts/Jost/Jost-ExtraBold.ttf +0 -0
  212. package/app-template/src/assets/fonts/Jost/Jost-ExtraBold.woff +0 -0
  213. package/app-template/src/assets/fonts/Jost/Jost-ExtraBold.woff2 +0 -0
  214. package/app-template/src/assets/fonts/Jost/Jost-ExtraBoldItalic.eot +0 -0
  215. package/app-template/src/assets/fonts/Jost/Jost-ExtraBoldItalic.ttf +0 -0
  216. package/app-template/src/assets/fonts/Jost/Jost-ExtraBoldItalic.woff +0 -0
  217. package/app-template/src/assets/fonts/Jost/Jost-ExtraBoldItalic.woff2 +0 -0
  218. package/app-template/src/assets/fonts/Jost/Jost-ExtraLight.eot +0 -0
  219. package/app-template/src/assets/fonts/Jost/Jost-ExtraLight.ttf +0 -0
  220. package/app-template/src/assets/fonts/Jost/Jost-ExtraLight.woff +0 -0
  221. package/app-template/src/assets/fonts/Jost/Jost-ExtraLight.woff2 +0 -0
  222. package/app-template/src/assets/fonts/Jost/Jost-ExtraLightItalic.eot +0 -0
  223. package/app-template/src/assets/fonts/Jost/Jost-ExtraLightItalic.ttf +0 -0
  224. package/app-template/src/assets/fonts/Jost/Jost-ExtraLightItalic.woff +0 -0
  225. package/app-template/src/assets/fonts/Jost/Jost-ExtraLightItalic.woff2 +0 -0
  226. package/app-template/src/assets/fonts/Jost/Jost-Italic.eot +0 -0
  227. package/app-template/src/assets/fonts/Jost/Jost-Italic.ttf +0 -0
  228. package/app-template/src/assets/fonts/Jost/Jost-Italic.woff +0 -0
  229. package/app-template/src/assets/fonts/Jost/Jost-Italic.woff2 +0 -0
  230. package/app-template/src/assets/fonts/Jost/Jost-Light.eot +0 -0
  231. package/app-template/src/assets/fonts/Jost/Jost-Light.ttf +0 -0
  232. package/app-template/src/assets/fonts/Jost/Jost-Light.woff +0 -0
  233. package/app-template/src/assets/fonts/Jost/Jost-Light.woff2 +0 -0
  234. package/app-template/src/assets/fonts/Jost/Jost-LightItalic.eot +0 -0
  235. package/app-template/src/assets/fonts/Jost/Jost-LightItalic.ttf +0 -0
  236. package/app-template/src/assets/fonts/Jost/Jost-LightItalic.woff +0 -0
  237. package/app-template/src/assets/fonts/Jost/Jost-LightItalic.woff2 +0 -0
  238. package/app-template/src/assets/fonts/Jost/Jost-Medium.eot +0 -0
  239. package/app-template/src/assets/fonts/Jost/Jost-Medium.ttf +0 -0
  240. package/app-template/src/assets/fonts/Jost/Jost-Medium.woff +0 -0
  241. package/app-template/src/assets/fonts/Jost/Jost-Medium.woff2 +0 -0
  242. package/app-template/src/assets/fonts/Jost/Jost-MediumItalic.eot +0 -0
  243. package/app-template/src/assets/fonts/Jost/Jost-MediumItalic.ttf +0 -0
  244. package/app-template/src/assets/fonts/Jost/Jost-MediumItalic.woff +0 -0
  245. package/app-template/src/assets/fonts/Jost/Jost-MediumItalic.woff2 +0 -0
  246. package/app-template/src/assets/fonts/Jost/Jost-Regular.eot +0 -0
  247. package/app-template/src/assets/fonts/Jost/Jost-Regular.ttf +0 -0
  248. package/app-template/src/assets/fonts/Jost/Jost-Regular.woff +0 -0
  249. package/app-template/src/assets/fonts/Jost/Jost-Regular.woff2 +0 -0
  250. package/app-template/src/assets/fonts/Jost/Jost-SemiBold.eot +0 -0
  251. package/app-template/src/assets/fonts/Jost/Jost-SemiBold.ttf +0 -0
  252. package/app-template/src/assets/fonts/Jost/Jost-SemiBold.woff +0 -0
  253. package/app-template/src/assets/fonts/Jost/Jost-SemiBold.woff2 +0 -0
  254. package/app-template/src/assets/fonts/Jost/Jost-SemiBoldItalic.eot +0 -0
  255. package/app-template/src/assets/fonts/Jost/Jost-SemiBoldItalic.ttf +0 -0
  256. package/app-template/src/assets/fonts/Jost/Jost-SemiBoldItalic.woff +0 -0
  257. package/app-template/src/assets/fonts/Jost/Jost-SemiBoldItalic.woff2 +0 -0
  258. package/app-template/src/assets/fonts/Jost/Jost-Thin.eot +0 -0
  259. package/app-template/src/assets/fonts/Jost/Jost-Thin.ttf +0 -0
  260. package/app-template/src/assets/fonts/Jost/Jost-Thin.woff +0 -0
  261. package/app-template/src/assets/fonts/Jost/Jost-Thin.woff2 +0 -0
  262. package/app-template/src/assets/fonts/Jost/Jost-ThinItalic.eot +0 -0
  263. package/app-template/src/assets/fonts/Jost/Jost-ThinItalic.ttf +0 -0
  264. package/app-template/src/assets/fonts/Jost/Jost-ThinItalic.woff +0 -0
  265. package/app-template/src/assets/fonts/Jost/Jost-ThinItalic.woff2 +0 -0
  266. package/app-template/src/assets/fonts/Jost/index.scss +269 -0
  267. package/app-template/src/assets/fonts/index.scss +1 -0
  268. package/app-template/src/assets/fonts/pz-icon.css +154 -0
  269. package/app-template/src/assets/fonts/pz-icon.eot +0 -0
  270. package/app-template/src/assets/fonts/pz-icon.html +456 -0
  271. package/app-template/src/assets/fonts/pz-icon.scss +300 -0
  272. package/app-template/src/assets/fonts/pz-icon.svg +144 -0
  273. package/app-template/src/assets/fonts/pz-icon.ttf +0 -0
  274. package/app-template/src/assets/fonts/pz-icon.woff +0 -0
  275. package/app-template/src/assets/fonts/pz-icon.woff2 +0 -0
  276. package/app-template/src/assets/globals.scss +65 -0
  277. package/app-template/src/assets/icons/akinon.svg +11 -0
  278. package/app-template/src/assets/icons/arrow-up.svg +11 -0
  279. package/app-template/src/assets/icons/bell.svg +1 -0
  280. package/app-template/src/assets/icons/cart.svg +13 -0
  281. package/app-template/src/assets/icons/check.svg +19 -0
  282. package/app-template/src/assets/icons/chevron-down.svg +8 -0
  283. package/app-template/src/assets/icons/chevron-end.svg +8 -0
  284. package/app-template/src/assets/icons/chevron-start.svg +8 -0
  285. package/app-template/src/assets/icons/chevron-up.svg +8 -0
  286. package/app-template/src/assets/icons/close.svg +12 -0
  287. package/app-template/src/assets/icons/cvc.svg +54 -0
  288. package/app-template/src/assets/icons/default.svg +6 -0
  289. package/app-template/src/assets/icons/directions.svg +14 -0
  290. package/app-template/src/assets/icons/eye-off.svg +10 -0
  291. package/app-template/src/assets/icons/eye-on.svg +17 -0
  292. package/app-template/src/assets/icons/facebook-login.svg +11 -0
  293. package/app-template/src/assets/icons/facebook.svg +9 -0
  294. package/app-template/src/assets/icons/giftbox.svg +22 -0
  295. package/app-template/src/assets/icons/globe.svg +12 -0
  296. package/app-template/src/assets/icons/google-login.svg +19 -0
  297. package/app-template/src/assets/icons/google.svg +9 -0
  298. package/app-template/src/assets/icons/hamburger.svg +5 -0
  299. package/app-template/src/assets/icons/heart-full.svg +20 -0
  300. package/app-template/src/assets/icons/heart-stroke.svg +22 -0
  301. package/app-template/src/assets/icons/info.svg +1 -0
  302. package/app-template/src/assets/icons/instagram.svg +14 -0
  303. package/app-template/src/assets/icons/layout-2.svg +7 -0
  304. package/app-template/src/assets/icons/layout-3.svg +4 -0
  305. package/app-template/src/assets/icons/logo.svg +24 -0
  306. package/app-template/src/assets/icons/mail.svg +1 -0
  307. package/app-template/src/assets/icons/minus.svg +4 -0
  308. package/app-template/src/assets/icons/money.svg +4 -0
  309. package/app-template/src/assets/icons/mp-otp.svg +1 -0
  310. package/app-template/src/assets/icons/pin.svg +16 -0
  311. package/app-template/src/assets/icons/pinterest.svg +12 -0
  312. package/app-template/src/assets/icons/plus.svg +5 -0
  313. package/app-template/src/assets/icons/search.svg +13 -0
  314. package/app-template/src/assets/icons/share.svg +10 -0
  315. package/app-template/src/assets/icons/spinner.svg +6 -0
  316. package/app-template/src/assets/icons/store-pin.svg +14 -0
  317. package/app-template/src/assets/icons/track-order.svg +1 -0
  318. package/app-template/src/assets/icons/twitter.svg +11 -0
  319. package/app-template/src/assets/icons/user.svg +14 -0
  320. package/app-template/src/assets/icons/whatsapp.svg +45 -0
  321. package/app-template/src/components/__tests__/Modal.test.tsx +103 -0
  322. package/app-template/src/components/__tests__/accordion.test.tsx +65 -0
  323. package/app-template/src/components/__tests__/badge.test.tsx +20 -0
  324. package/app-template/src/components/__tests__/button.test.tsx +59 -0
  325. package/app-template/src/components/__tests__/checkbox.test.tsx +57 -0
  326. package/app-template/src/components/__tests__/file-input.test.tsx +42 -0
  327. package/app-template/src/components/__tests__/icon.test.tsx +39 -0
  328. package/app-template/src/components/__tests__/input.test.tsx +69 -0
  329. package/app-template/src/components/__tests__/language-select.test.tsx +81 -0
  330. package/app-template/src/components/__tests__/link.test.tsx +65 -0
  331. package/app-template/src/components/__tests__/price.test.tsx +72 -0
  332. package/app-template/src/components/__tests__/radio.test.tsx +52 -0
  333. package/app-template/src/components/__tests__/select.test.tsx +115 -0
  334. package/app-template/src/components/__tests__/tab.test.tsx +101 -0
  335. package/app-template/src/components/accordion.tsx +64 -0
  336. package/app-template/src/components/badge.tsx +21 -0
  337. package/app-template/src/components/button.tsx +46 -0
  338. package/app-template/src/components/canonical-url.tsx +21 -0
  339. package/app-template/src/components/carousel-core.tsx +42 -0
  340. package/app-template/src/components/checkbox.tsx +28 -0
  341. package/app-template/src/components/currency-select.tsx +81 -0
  342. package/app-template/src/components/custom-loader.tsx +21 -0
  343. package/app-template/src/components/dynamic-form.tsx +17 -0
  344. package/app-template/src/components/file-input.tsx +8 -0
  345. package/app-template/src/components/generate-form-fields.tsx +349 -0
  346. package/app-template/src/components/icon.tsx +18 -0
  347. package/app-template/src/components/index.ts +41 -0
  348. package/app-template/src/components/input.tsx +110 -0
  349. package/app-template/src/components/language-select.tsx +33 -0
  350. package/app-template/src/components/link.tsx +53 -0
  351. package/app-template/src/components/loader-spinner.tsx +23 -0
  352. package/app-template/src/components/modal.tsx +66 -0
  353. package/app-template/src/components/pagination.tsx +267 -0
  354. package/app-template/src/components/password-rules-feedback.tsx +60 -0
  355. package/app-template/src/components/price.tsx +54 -0
  356. package/app-template/src/components/pwa-tags.tsx +233 -0
  357. package/app-template/src/components/radio.tsx +18 -0
  358. package/app-template/src/components/react-portal.tsx +47 -0
  359. package/app-template/src/components/select.tsx +70 -0
  360. package/app-template/src/components/shimmer.tsx +21 -0
  361. package/app-template/src/components/skeleton-article.tsx +15 -0
  362. package/app-template/src/components/skeleton-product.tsx +14 -0
  363. package/app-template/src/components/skeleton-profile.tsx +19 -0
  364. package/app-template/src/components/skeleton-wrapper.tsx +19 -0
  365. package/app-template/src/components/skeleton.tsx +37 -0
  366. package/app-template/src/components/source.tsx +12 -0
  367. package/app-template/src/components/tab-panel.tsx +10 -0
  368. package/app-template/src/components/tab.tsx +58 -0
  369. package/app-template/src/components/tabs.tsx +58 -0
  370. package/app-template/src/components/types/index.ts +89 -0
  371. package/app-template/src/hooks/index.ts +1 -0
  372. package/app-template/src/hooks/use-add-product-to-basket.ts +48 -0
  373. package/app-template/src/hooks/use-contract.tsx +58 -0
  374. package/app-template/src/hooks/use-fav-button.tsx +99 -0
  375. package/app-template/src/instrumentation.ts +1 -0
  376. package/app-template/src/middleware.ts +33 -0
  377. package/app-template/src/pages/_error.js +14 -0
  378. package/app-template/src/pages/api/auth/[...nextauth].ts +3 -0
  379. package/app-template/src/plugins.js +14 -0
  380. package/app-template/src/redux/middlewares/category.ts +42 -0
  381. package/app-template/src/redux/reducers/category.ts +67 -0
  382. package/app-template/src/redux/store.ts +47 -0
  383. package/app-template/src/routes/index.ts +46 -0
  384. package/app-template/src/settings.js +62 -0
  385. package/app-template/src/theme.js +1 -0
  386. package/app-template/src/types/index.ts +72 -0
  387. package/app-template/src/types/next-auth.d.ts +24 -0
  388. package/app-template/src/types/widgets.ts +115 -0
  389. package/app-template/src/utils/convert-facet-search-params.ts +15 -0
  390. package/app-template/src/utils/generate-jsonld.ts +23 -0
  391. package/app-template/src/utils/gtm.ts +247 -0
  392. package/app-template/src/utils/index.ts +60 -0
  393. package/app-template/src/views/account/account-menu.tsx +117 -0
  394. package/app-template/src/views/account/address-card.tsx +157 -0
  395. package/app-template/src/views/account/address-form.tsx +374 -0
  396. package/app-template/src/views/account/back-button.tsx +27 -0
  397. package/app-template/src/views/account/contact-form.tsx +283 -0
  398. package/app-template/src/views/account/content-header.tsx +52 -0
  399. package/app-template/src/views/account/faq/faq-footer.tsx +30 -0
  400. package/app-template/src/views/account/faq/faq-search.tsx +35 -0
  401. package/app-template/src/views/account/faq/faq-tabs.tsx +54 -0
  402. package/app-template/src/views/account/faq/index.ts +3 -0
  403. package/app-template/src/views/account/favorite-item.tsx +191 -0
  404. package/app-template/src/views/account/favourite-products/favourite-products-list.tsx +65 -0
  405. package/app-template/src/views/account/index.ts +4 -0
  406. package/app-template/src/views/account/order.tsx +89 -0
  407. package/app-template/src/views/account/orders/order-cancellation-item.tsx +99 -0
  408. package/app-template/src/views/account/orders/order-detail-header.tsx +39 -0
  409. package/app-template/src/views/anonymous-tracking/index.tsx +109 -0
  410. package/app-template/src/views/anonymous-tracking/order-detail/index.tsx +318 -0
  411. package/app-template/src/views/basket/basket-item.tsx +231 -0
  412. package/app-template/src/views/basket/index.ts +2 -0
  413. package/app-template/src/views/basket/summary.tsx +220 -0
  414. package/app-template/src/views/breadcrumb.tsx +35 -0
  415. package/app-template/src/views/category/category-active-filters.tsx +98 -0
  416. package/app-template/src/views/category/category-banner.tsx +34 -0
  417. package/app-template/src/views/category/category-header.tsx +143 -0
  418. package/app-template/src/views/category/category-info.tsx +123 -0
  419. package/app-template/src/views/category/filters/index.tsx +163 -0
  420. package/app-template/src/views/category/filters/size-filter.tsx +27 -0
  421. package/app-template/src/views/category/layout.tsx +38 -0
  422. package/app-template/src/views/checkout/auth.tsx +54 -0
  423. package/app-template/src/views/checkout/index.tsx +3 -0
  424. package/app-template/src/views/checkout/layout/footer.tsx +48 -0
  425. package/app-template/src/views/checkout/layout/header.tsx +38 -0
  426. package/app-template/src/views/checkout/step-button.tsx +69 -0
  427. package/app-template/src/views/checkout/step-list.tsx +51 -0
  428. package/app-template/src/views/checkout/steps/payment/agreements.tsx +42 -0
  429. package/app-template/src/views/checkout/steps/payment/index.tsx +31 -0
  430. package/app-template/src/views/checkout/steps/payment/options/credit-card/index.tsx +382 -0
  431. package/app-template/src/views/checkout/steps/payment/options/credit-card/installments.tsx +100 -0
  432. package/app-template/src/views/checkout/steps/payment/options/credit-payment.tsx +14 -0
  433. package/app-template/src/views/checkout/steps/payment/options/funds-transfer.tsx +174 -0
  434. package/app-template/src/views/checkout/steps/payment/options/loyalty.tsx +19 -0
  435. package/app-template/src/views/checkout/steps/payment/options/pay-on-delivery.tsx +15 -0
  436. package/app-template/src/views/checkout/steps/payment/options/redirection.tsx +94 -0
  437. package/app-template/src/views/checkout/steps/payment/payment-header.tsx +17 -0
  438. package/app-template/src/views/checkout/steps/payment/payment-option-buttons.tsx +73 -0
  439. package/app-template/src/views/checkout/steps/shipping/address-box.tsx +244 -0
  440. package/app-template/src/views/checkout/steps/shipping/addresses.tsx +189 -0
  441. package/app-template/src/views/checkout/steps/shipping/index.tsx +27 -0
  442. package/app-template/src/views/checkout/steps/shipping/shipping-options.tsx +72 -0
  443. package/app-template/src/views/checkout/summary.tsx +181 -0
  444. package/app-template/src/views/coupon-item/index.tsx +80 -0
  445. package/app-template/src/views/find-in-store/index.tsx +183 -0
  446. package/app-template/src/views/footer.tsx +21 -0
  447. package/app-template/src/views/guest-login/index.tsx +130 -0
  448. package/app-template/src/views/header/action-menu.tsx +117 -0
  449. package/app-template/src/views/header/band.tsx +32 -0
  450. package/app-template/src/views/header/index.tsx +66 -0
  451. package/app-template/src/views/header/mini-basket.tsx +267 -0
  452. package/app-template/src/views/header/mobile-hamburger-button.tsx +35 -0
  453. package/app-template/src/views/header/mobile-menu.tsx +144 -0
  454. package/app-template/src/views/header/navbar.tsx +186 -0
  455. package/app-template/src/views/header/pwa-back-button.tsx +60 -0
  456. package/app-template/src/views/header/search/index.tsx +82 -0
  457. package/app-template/src/views/header/search/results.tsx +123 -0
  458. package/app-template/src/views/header/user-menu.tsx +72 -0
  459. package/app-template/src/views/index.tsx +2 -0
  460. package/app-template/src/views/installment-options/index.tsx +127 -0
  461. package/app-template/src/views/login/index.tsx +233 -0
  462. package/app-template/src/views/otp-login/index.tsx +152 -0
  463. package/app-template/src/views/page-loader-spinner/index.tsx +9 -0
  464. package/app-template/src/views/product/accordion-wrapper.tsx +59 -0
  465. package/app-template/src/views/product/combine-product-card.tsx +82 -0
  466. package/app-template/src/views/product/index.ts +8 -0
  467. package/app-template/src/views/product/layout.tsx +40 -0
  468. package/app-template/src/views/product/misc-buttons.tsx +65 -0
  469. package/app-template/src/views/product/price-wrapper.tsx +41 -0
  470. package/app-template/src/views/product/product-group-info.tsx +63 -0
  471. package/app-template/src/views/product/product-info.tsx +273 -0
  472. package/app-template/src/views/product/slider.tsx +124 -0
  473. package/app-template/src/views/product/variant.tsx +104 -0
  474. package/app-template/src/views/product-item/index.tsx +96 -0
  475. package/app-template/src/views/product-pointer-banner-item.tsx +243 -0
  476. package/app-template/src/views/register/index.tsx +417 -0
  477. package/app-template/src/views/root-modal.tsx +21 -0
  478. package/app-template/src/views/sales-contract-modal/index.tsx +288 -0
  479. package/app-template/src/views/share/index.tsx +71 -0
  480. package/app-template/src/views/widgets/home-hero-slider-content.tsx +54 -0
  481. package/app-template/src/views/widgets/recommendation-content.tsx +86 -0
  482. package/app-template/src/widgets/footer-copyright.tsx +25 -0
  483. package/app-template/src/widgets/footer-info.tsx +78 -0
  484. package/app-template/src/widgets/footer-menu.tsx +258 -0
  485. package/app-template/src/widgets/footer-social.tsx +53 -0
  486. package/app-template/src/widgets/footer-subscription/footer-subscription-form.tsx +110 -0
  487. package/app-template/src/widgets/footer-subscription/index.tsx +30 -0
  488. package/app-template/src/widgets/header-band-text.tsx +21 -0
  489. package/app-template/src/widgets/home-discovery.tsx +191 -0
  490. package/app-template/src/widgets/home-hero-slider.tsx +36 -0
  491. package/app-template/src/widgets/home-product-recommendation.tsx +18 -0
  492. package/app-template/src/widgets/home-single-banner.tsx +87 -0
  493. package/app-template/src/widgets/home-stories-eng.tsx +112 -0
  494. package/app-template/src/widgets/index.ts +25 -0
  495. package/app-template/src/widgets/product-pointer-banners.tsx +35 -0
  496. package/app-template/src/widgets/special-page-banner.tsx +49 -0
  497. package/app-template/src/widgets/special-page-carousel.tsx +68 -0
  498. package/app-template/src/widgets/widget-order.tsx +1 -0
  499. package/app-template/tailwind.config.js +170 -0
  500. package/app-template/tsconfig.json +44 -0
  501. package/app-template/tsconfig.test.json +6 -0
  502. package/app-template/yarn.lock +11278 -0
  503. package/commands/create.ts +49 -118
  504. package/dist/commands/create.js +32 -68
  505. package/package.json +1 -1
  506. package/tsconfig.json +9 -8
@@ -0,0 +1,157 @@
1
+ 'use client';
2
+
3
+ import React, { useState } from 'react';
4
+ import {
5
+ useEditAddressMutation,
6
+ useRemoveAddressMutation,
7
+ useSetDefaultAddressMutation
8
+ } from '@akinon/next/data/client/address';
9
+ import { Address } from '@akinon/next/types';
10
+ import { AddressForm } from './address-form';
11
+ import { Button, Modal, Radio } from '@theme/components';
12
+ import { useLocalization } from '@akinon/next/hooks';
13
+
14
+ export interface Props {
15
+ address: Address;
16
+ index: number;
17
+ }
18
+
19
+ export const AddressCard = (props: Props) => {
20
+ const { t } = useLocalization();
21
+ const { address, index } = props;
22
+ const [isEditAddressModalOpen, setIsEditAddressModalOpen] = useState(false);
23
+ const [editAddress] = useEditAddressMutation();
24
+ const [removeAddress, { isLoading: removeAddressLoading }] =
25
+ useRemoveAddressMutation();
26
+ const [setDefaultAddress] = useSetDefaultAddressMutation();
27
+ const [isRemoveAddressModalOpen, setRemoveAddressModalOpen] = useState(false);
28
+
29
+ const onSubmit = async (data) => {
30
+ await editAddress(data);
31
+ setIsEditAddressModalOpen(false);
32
+ };
33
+
34
+ const handleRemoveAddress = async (pk: number) => {
35
+ try {
36
+ await removeAddress(pk)
37
+ .unwrap()
38
+ .then(() => setRemoveAddressModalOpen(false))
39
+ .catch((err) => console.error(err));
40
+ } catch (error) {
41
+ console.error('Error in operation:', error);
42
+ }
43
+ };
44
+
45
+ return (
46
+ <div key={address.pk} className="border border-gray-200 p-6 relative">
47
+ <div className="bg-black w-12 h-12 text-white rounded-full text-center -top-6 absolute left-1/2 -translate-x-1/2">
48
+ <span
49
+ className="top-1/2 relative block -translate-y-1/2"
50
+ data-testid="address-card-count"
51
+ >
52
+ {index + 1}
53
+ </span>
54
+ </div>
55
+ <h2
56
+ className="text-center text-xl my-4 break-all"
57
+ data-testid="address-card-title"
58
+ >
59
+ {address.title}
60
+ </h2>
61
+ <Radio
62
+ className="mb-4 accent-primary"
63
+ name="address"
64
+ defaultChecked={address.primary}
65
+ onChange={() => setDefaultAddress({ pk: address.pk, primary: true })}
66
+ >
67
+ {t('account.address_book.card.default_address')}
68
+ </Radio>
69
+
70
+ <div className="mb-5">
71
+ <p
72
+ title={address.line}
73
+ className="text-xs leading-5 break-all mb-2 font-medium truncate"
74
+ >
75
+ {address.line}
76
+ </p>
77
+
78
+ <p className="text-xs leading-5 break-all font-medium">
79
+ {address.township.name}/{address.city.name}
80
+ </p>
81
+ </div>
82
+
83
+ <div className="text-xs flex justify-between pt-5 border-t border-gray-200 mt-auto">
84
+ <Button
85
+ appearance="ghost"
86
+ className="underline p-0 h-auto border-none hover:bg-transparent hover:text-secondary"
87
+ onClick={() => setIsEditAddressModalOpen(true)}
88
+ >
89
+ {t('account.address_book.card.edit')}
90
+ </Button>
91
+ <Modal
92
+ portalId={`account-address-edit-address-modal-${address.pk}`}
93
+ title={t('account.address_book.modal.edit_address')}
94
+ open={isEditAddressModalOpen}
95
+ setOpen={setIsEditAddressModalOpen}
96
+ className="w-full sm:w-[28rem] max-h-[90vh] overflow-y-auto"
97
+ >
98
+ <AddressForm
99
+ data={{
100
+ ...address,
101
+ country: address.country.pk,
102
+ city: address.city.pk,
103
+ township: address.township.pk,
104
+ district: address.district.pk
105
+ }}
106
+ onSubmit={onSubmit}
107
+ />
108
+ </Modal>
109
+ <Button
110
+ appearance="ghost"
111
+ className="underline p-0 h-auto border-none hover:bg-transparent hover:text-secondary"
112
+ onClick={() => setRemoveAddressModalOpen(true)}
113
+ data-testid="address-card-remove"
114
+ >
115
+ {t('account.address_book.card.remove')}
116
+ </Button>
117
+ </div>
118
+ <Modal
119
+ portalId="remove-address-item"
120
+ className="w-4/5 sm:w-96 max-h-[90vh] overflow-y-auto"
121
+ open={isRemoveAddressModalOpen}
122
+ setOpen={setRemoveAddressModalOpen}
123
+ showCloseButton={false}
124
+ >
125
+ <div className="text-center px-6 py-10">
126
+ <p className="mb-4">
127
+ {t('account.address_book.modal.delete_description')}
128
+ </p>
129
+ <div className="space-x-3 flex justify-center">
130
+ <Button
131
+ appearance="outlined"
132
+ onClick={() => {
133
+ setRemoveAddressModalOpen(false);
134
+ }}
135
+ data-testid="remove-address-modal-cancel"
136
+ >
137
+ {t('account.address_book.modal.close')}
138
+ </Button>
139
+ <Button
140
+ appearance="filled"
141
+ disabled={removeAddressLoading}
142
+ onClick={() => {
143
+ handleRemoveAddress(address.pk);
144
+ }}
145
+ className={
146
+ removeAddressLoading && 'opacity-50 cursor-not-allowed'
147
+ }
148
+ data-testid="remove-address-modal-delete"
149
+ >
150
+ {t('account.address_book.modal.delete_address')}
151
+ </Button>
152
+ </div>
153
+ </div>
154
+ </Modal>
155
+ </div>
156
+ );
157
+ };
@@ -0,0 +1,374 @@
1
+ import React, { useEffect, useMemo } from 'react';
2
+ import { useForm } from 'react-hook-form';
3
+ import { yupResolver } from '@hookform/resolvers/yup';
4
+ import * as yup from 'yup';
5
+ import clsx from 'clsx';
6
+ import { AddressType, AddressFormType } from '@akinon/next/types';
7
+ import {
8
+ Button,
9
+ Checkbox,
10
+ Icon,
11
+ Input,
12
+ Radio,
13
+ Select
14
+ } from '@theme/components';
15
+ import {
16
+ useGetCountriesQuery,
17
+ useGetCitiesQuery,
18
+ useGetTownshipsQuery,
19
+ useGetDistrictsQuery
20
+ } from '@akinon/next/data/client/address';
21
+ import { useAppSelector } from '@akinon/next/redux/hooks';
22
+ import { useLocalization } from '@akinon/next/hooks';
23
+
24
+ type SelectOptionType = {
25
+ label: string;
26
+ value: string | number;
27
+ };
28
+
29
+ interface Props {
30
+ data?: any;
31
+ onSubmit: (data: any) => void;
32
+ }
33
+
34
+ const makeAddressFormSchema = (t, { phoneNumberLength }) =>
35
+ yup.object().shape({
36
+ title: yup.string().required(t('account.address_book.form.error.required')),
37
+ first_name: yup
38
+ .string()
39
+ .required(t('account.address_book.form.error.required')),
40
+ last_name: yup
41
+ .string()
42
+ .required(t('account.address_book.form.error.required')),
43
+ phone_number: yup
44
+ .string()
45
+ .transform((value: string) => value.replace(/_/g, '').replace(/ /g, ''))
46
+ .length(
47
+ phoneNumberLength,
48
+ t('account.address_book.form.error.phone_length')
49
+ )
50
+ .required(t('account.address_book.form.error.required')),
51
+ country: yup
52
+ .string()
53
+ .required(t('account.address_book.form.error.required')),
54
+ city: yup.string().required(t('account.address_book.form.error.required')),
55
+ township: yup
56
+ .string()
57
+ .required(t('account.address_book.form.error.required')),
58
+ district: yup
59
+ .string()
60
+ .required(t('account.address_book.form.error.required')),
61
+ line: yup
62
+ .string()
63
+ .required(t('account.address_book.form.error.required'))
64
+ .min(10, t('account.address_book.form.error.line_min'))
65
+ .max(255, t('account.address_book.form.error.line_max')),
66
+ postcode: yup
67
+ .string()
68
+ .min(5, t('account.address_book.form.error.postcode_min'))
69
+ .max(5, t('account.address_book.form.error.postcode_max'))
70
+ .required(t('account.address_book.form.error.required')),
71
+ company_name: yup.string().nullable(),
72
+ tax_no: yup.string().nullable(),
73
+ tax_office: yup.string().nullable(),
74
+ e_bill_taxpayer: yup.boolean().nullable()
75
+ });
76
+
77
+ export const AddressForm = (props: Props) => {
78
+ const { t } = useLocalization();
79
+
80
+ const { data, onSubmit } = props;
81
+ const config = useAppSelector((state) => state.config);
82
+ const addressFormSchema = makeAddressFormSchema(t, {
83
+ phoneNumberLength: config.user_phone_format.length
84
+ });
85
+ const {
86
+ register,
87
+ handleSubmit,
88
+ watch,
89
+ control,
90
+ reset,
91
+ formState: { errors }
92
+ } = useForm<AddressFormType>({
93
+ resolver: yupResolver(addressFormSchema),
94
+ defaultValues: { is_corporate: AddressType.individual, type: 'customer' }
95
+ });
96
+
97
+ const selectedFormType = watch('is_corporate');
98
+ const selectedCountry = watch('country');
99
+ const selectedCity = watch('city');
100
+ const selectedTownship = watch('township');
101
+
102
+ const { data: country } = useGetCountriesQuery();
103
+ const { data: city } = useGetCitiesQuery(selectedCountry, {
104
+ skip: !selectedCountry
105
+ });
106
+ const { data: township } = useGetTownshipsQuery(selectedCity, {
107
+ skip: !selectedCity
108
+ });
109
+ const { data: district } = useGetDistrictsQuery(selectedTownship, {
110
+ skip: !selectedTownship
111
+ });
112
+
113
+ const countryOptions = useMemo(() => {
114
+ if (country) {
115
+ const options: SelectOptionType[] = [
116
+ { label: t('account.address_book.form.country.placeholder'), value: '' }
117
+ ];
118
+ options.push(
119
+ ...country.results.map((item) => ({ label: item.name, value: item.pk }))
120
+ );
121
+ return options;
122
+ }
123
+ return [];
124
+ }, [country]);
125
+
126
+ const cityOptions = useMemo(() => {
127
+ if (city) {
128
+ const options: SelectOptionType[] = [
129
+ {
130
+ label: t('account.address_book.form.province.placeholder'),
131
+ value: ''
132
+ }
133
+ ];
134
+ options.push(
135
+ ...city.results.map((item) => ({ label: item.name, value: item.pk }))
136
+ );
137
+ return options;
138
+ }
139
+ return [];
140
+ }, [city]);
141
+
142
+ const townshipOptions = useMemo(() => {
143
+ if (township) {
144
+ const options: SelectOptionType[] = [
145
+ {
146
+ label: t('account.address_book.form.township.placeholder'),
147
+ value: ''
148
+ }
149
+ ];
150
+ options.push(
151
+ ...township.results.map((item) => ({
152
+ label: item.name,
153
+ value: item.pk
154
+ }))
155
+ );
156
+ return options;
157
+ }
158
+ return [];
159
+ }, [township]);
160
+
161
+ const districtOptions = useMemo(() => {
162
+ if (district) {
163
+ const options: SelectOptionType[] = [
164
+ {
165
+ label: t('account.address_book.form.district.placeholder'),
166
+ value: ''
167
+ }
168
+ ];
169
+ options.push(
170
+ ...district.results.map((item) => ({
171
+ label: item.name,
172
+ value: item.pk
173
+ }))
174
+ );
175
+ return options;
176
+ }
177
+ return [];
178
+ }, [district]);
179
+
180
+ useEffect(() => {
181
+ if (data && country) {
182
+ reset({
183
+ ...data,
184
+ is_corporate:
185
+ String(data.is_corporate) === AddressType.company ? 'true' : 'false' // TODO: Fix this! This hack for radio buttons can't be set to boolean value
186
+ });
187
+ }
188
+ }, [data, country, reset]);
189
+
190
+ return (
191
+ <form
192
+ onSubmit={handleSubmit(onSubmit)}
193
+ className="flex flex-col py-4 px-6 gap-6"
194
+ >
195
+ <div className="flex gap-8">
196
+ <Radio
197
+ {...register('is_corporate')}
198
+ value="false"
199
+ data-testid="address-form-personal"
200
+ >
201
+ <span className="text-base">
202
+ {t('account.address_book.form.type.personal')}
203
+ </span>
204
+ </Radio>
205
+ <Radio
206
+ {...register('is_corporate')}
207
+ value="true"
208
+ data-testid="address-form-corporate"
209
+ >
210
+ <span className="text-base">
211
+ {t('account.address_book.form.type.corporate')}
212
+ </span>
213
+ </Radio>
214
+ </div>
215
+ <Input
216
+ label={t('account.address_book.form.address_title.placeholder')}
217
+ {...register('title')}
218
+ error={errors.title}
219
+ data-testid="address-form-title"
220
+ required
221
+ />
222
+ <Input
223
+ label={t('account.address_book.form.name.placeholder')}
224
+ {...register('first_name')}
225
+ error={errors.first_name}
226
+ data-testid="address-form-first-name"
227
+ required
228
+ />
229
+ <Input
230
+ label={t('account.address_book.form.surname.placeholder')}
231
+ {...register('last_name')}
232
+ error={errors.last_name}
233
+ data-testid="address-form-last-name"
234
+ required
235
+ />
236
+ <Input
237
+ label={t('account.address_book.form.phone.placeholder')}
238
+ format={config.user_phone_format.replaceAll(/\9/g, '#')}
239
+ mask="_"
240
+ allowEmptyFormatting={true}
241
+ control={control}
242
+ {...register('phone_number')}
243
+ error={errors.phone_number}
244
+ data-testid="address-form-phone"
245
+ required
246
+ />
247
+ {/* TODO: Fix select and textarea components */}
248
+
249
+ <Select
250
+ className="w-full border-gray-500 text-sm mt-2"
251
+ options={countryOptions}
252
+ {...register('country')}
253
+ error={errors.country}
254
+ data-testid="address-form-country"
255
+ label={t('account.address_book.form.country.title')}
256
+ required
257
+ />
258
+
259
+ {city && (
260
+ <Select
261
+ className="w-full border-gray-500 text-sm mt-2"
262
+ options={cityOptions}
263
+ {...register('city')}
264
+ error={errors.city}
265
+ data-testid="address-form-city"
266
+ label={t('account.address_book.form.province.title')}
267
+ required
268
+ />
269
+ )}
270
+ {township && (
271
+ <div className="flex gap-4">
272
+ <div className="flex-1">
273
+ <Select
274
+ className="w-full border-gray-500 text-sm mt-2"
275
+ options={townshipOptions}
276
+ {...register('township')}
277
+ error={errors.township}
278
+ data-testid="address-form-township"
279
+ label={t('account.address_book.form.township.title')}
280
+ required
281
+ />
282
+ </div>
283
+ {district && (
284
+ <div className="flex-1">
285
+ <Select
286
+ className="w-full border-gray-500 text-sm mt-2"
287
+ options={districtOptions}
288
+ {...register('district')}
289
+ error={errors.district}
290
+ data-testid="address-form-district"
291
+ label={t('account.address_book.form.district.title')}
292
+ required
293
+ />
294
+ </div>
295
+ )}
296
+ </div>
297
+ )}
298
+ <label className="text-xs text-gray-800 relative">
299
+ <>
300
+ <span>{t('account.address_book.form.address.title')}</span>
301
+ <span className="text-secondary"> *</span>
302
+ </>
303
+
304
+ <textarea
305
+ {...register('line')}
306
+ rows={6}
307
+ className={clsx(
308
+ 'block w-full mt-2 border p-2',
309
+ errors.line
310
+ ? 'border-error focus:border-error'
311
+ : 'border-gray-500 hover:border-black focus:border-black'
312
+ )}
313
+ data-testid="address-form-address-field"
314
+ />
315
+ {errors.line && (
316
+ <span
317
+ className="absolute -bottom-5 left-0 text-sm text-error"
318
+ data-testid="address-form-address-field-error"
319
+ >
320
+ {errors.line.message}
321
+ </span>
322
+ )}
323
+ </label>
324
+ <Input
325
+ type="number"
326
+ label={t('account.address_book.form.post_code.placeholder')}
327
+ {...register('postcode')}
328
+ error={errors.postcode}
329
+ data-testid="address-form-post-code"
330
+ required
331
+ />
332
+ {selectedFormType === AddressType.company && (
333
+ <>
334
+ <Input
335
+ type="text"
336
+ label={t('account.address_book.form.company_name.placeholder')}
337
+ {...register('company_name')}
338
+ error={errors.company_name}
339
+ data-testid="address-form-company-name"
340
+ />
341
+ <Input
342
+ type="number"
343
+ label={t('account.address_book.form.tax_no.placeholder')}
344
+ {...register('tax_no')}
345
+ error={errors.tax_no}
346
+ data-testid="address-form-tax-no"
347
+ />
348
+ <Input
349
+ type="text"
350
+ label={t('account.address_book.form.tax_office.placeholder')}
351
+ {...register('tax_office')}
352
+ error={errors.tax_office}
353
+ data-testid="address-form-tax-office"
354
+ />
355
+ <Checkbox
356
+ className="accent-primary"
357
+ {...register('e_bill_taxpayer')}
358
+ data-testid="address-form-taxpayer"
359
+ >
360
+ {t('account.address_book.form.taxpayer.title')}
361
+ </Checkbox>
362
+ </>
363
+ )}
364
+ <Button
365
+ type="submit"
366
+ className="flex items-center justify-center font-semibold gap-2"
367
+ data-testid="address-form-submit"
368
+ >
369
+ <span>{t('account.address_book.form.submit_button')}</span>
370
+ <Icon name="chevron-end" size={12} className="fill-white" />
371
+ </Button>
372
+ </form>
373
+ );
374
+ };
@@ -0,0 +1,27 @@
1
+ 'use client';
2
+
3
+ import clsx from 'clsx';
4
+ import { Icon, Link } from '@theme/components';
5
+ import { usePathname } from 'next/navigation';
6
+ import { ROUTES } from 'routes';
7
+
8
+ export default function AccountBackButton() {
9
+ const pathname = usePathname();
10
+ const accountMenuRegex = new RegExp(`^${ROUTES.ACCOUNT}/?$`).test(pathname);
11
+
12
+ return (
13
+ <div
14
+ className={clsx(
15
+ 'w-full flex items-center bg-gray-150 p-6 pb-0 md:hidden',
16
+ {
17
+ hidden: accountMenuRegex
18
+ }
19
+ )}
20
+ >
21
+ <Link className="flex items-center" href={ROUTES.ACCOUNT} passHref>
22
+ <Icon name="chevron-start" size={12} className="fill-primary" />
23
+ <Icon name="user" size={23} className="fill-primary ml-1" />
24
+ </Link>
25
+ </div>
26
+ );
27
+ }