@faststore/core 3.44.2 → 3.46.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 (317) hide show
  1. package/.next/BUILD_ID +1 -1
  2. package/.next/build-manifest.json +122 -57
  3. package/.next/cache/.tsbuildinfo +1 -1
  4. package/.next/cache/config.json +3 -3
  5. package/.next/cache/webpack/client-production/0.pack +0 -0
  6. package/.next/cache/webpack/client-production/index.pack +0 -0
  7. package/.next/cache/webpack/server-production/0.pack +0 -0
  8. package/.next/cache/webpack/server-production/index.pack +0 -0
  9. package/.next/prerender-manifest.js +1 -1
  10. package/.next/prerender-manifest.json +1 -1
  11. package/.next/react-loadable-manifest.json +65 -73
  12. package/.next/routes-manifest.json +1 -1
  13. package/.next/server/chunks/129.js +1 -0
  14. package/.next/server/chunks/1506.js +1 -1
  15. package/.next/server/chunks/1999.js +1 -0
  16. package/.next/server/chunks/2091.js +1 -0
  17. package/.next/server/chunks/2230.js +1 -0
  18. package/.next/server/chunks/2773.js +1 -0
  19. package/.next/server/chunks/2880.js +1 -1
  20. package/.next/server/chunks/3006.js +1 -0
  21. package/.next/server/chunks/4289.js +2 -2
  22. package/.next/server/chunks/4559.js +16 -3
  23. package/.next/server/chunks/4746.js +1 -1
  24. package/.next/server/chunks/5636.js +2 -0
  25. package/.next/server/chunks/5772.js +1 -0
  26. package/.next/server/chunks/6594.js +1 -1
  27. package/.next/server/chunks/674.js +1 -1
  28. package/.next/server/chunks/7228.js +1 -1
  29. package/.next/server/chunks/8038.js +1 -0
  30. package/.next/server/chunks/804.js +1 -1
  31. package/.next/server/chunks/8307.js +1 -0
  32. package/.next/server/chunks/831.js +1 -1
  33. package/.next/server/chunks/8562.js +1 -1
  34. package/.next/server/chunks/8646.js +1 -1
  35. package/.next/server/chunks/9559.js +9 -0
  36. package/.next/server/chunks/9664.js +1 -0
  37. package/.next/server/chunks/UIBannerText.js +1 -1
  38. package/.next/server/functions-config-manifest.json +1 -1
  39. package/.next/server/middleware-build-manifest.js +1 -1
  40. package/.next/server/middleware-react-loadable-manifest.js +1 -1
  41. package/.next/server/pages/404.js +1 -1
  42. package/.next/server/pages/404.js.nft.json +1 -1
  43. package/.next/server/pages/500.js +1 -1
  44. package/.next/server/pages/500.js.nft.json +1 -1
  45. package/.next/server/pages/[...slug].js +1 -1
  46. package/.next/server/pages/[...slug].js.nft.json +1 -1
  47. package/.next/server/pages/[slug]/p.js +1 -1
  48. package/.next/server/pages/[slug]/p.js.nft.json +1 -1
  49. package/.next/server/pages/_app.js.nft.json +1 -1
  50. package/.next/server/pages/_document.js.nft.json +1 -1
  51. package/.next/server/pages/_error.js.nft.json +1 -1
  52. package/.next/server/pages/account/403.js +1 -0
  53. package/.next/server/pages/account/403.js.nft.json +1 -0
  54. package/.next/server/pages/account/404.js +1 -0
  55. package/.next/server/pages/account/404.js.nft.json +1 -0
  56. package/.next/server/pages/account/[...unknown].js +1 -0
  57. package/.next/server/pages/account/[...unknown].js.nft.json +1 -0
  58. package/.next/server/pages/account/orders/[id].js +1 -0
  59. package/.next/server/pages/account/orders/[id].js.nft.json +1 -0
  60. package/.next/server/pages/account/orders.js +1 -0
  61. package/.next/server/pages/account/orders.js.nft.json +1 -0
  62. package/.next/server/pages/account/profile.js +1 -1
  63. package/.next/server/pages/account/profile.js.nft.json +1 -1
  64. package/.next/server/pages/account/security.js +1 -0
  65. package/.next/server/pages/account/security.js.nft.json +1 -0
  66. package/.next/server/pages/account/user-details.js +1 -0
  67. package/.next/server/pages/account/user-details.js.nft.json +1 -0
  68. package/.next/server/pages/account.js +1 -1
  69. package/.next/server/pages/account.js.nft.json +1 -1
  70. package/.next/server/pages/api/graphql.js +2 -2
  71. package/.next/server/pages/api/graphql.js.nft.json +1 -1
  72. package/.next/server/pages/api/health/live.js.nft.json +1 -1
  73. package/.next/server/pages/api/health/ready.js.nft.json +1 -1
  74. package/.next/server/pages/api/preview.js.nft.json +1 -1
  75. package/.next/server/pages/checkout.js +1 -1
  76. package/.next/server/pages/checkout.js.nft.json +1 -1
  77. package/.next/server/pages/en-US/404.html +2 -2
  78. package/.next/server/pages/en-US/500.html +2 -2
  79. package/.next/server/pages/en-US/account/403.html +28 -0
  80. package/.next/server/pages/en-US/account/403.json +1 -0
  81. package/.next/server/pages/en-US/account/404.html +28 -0
  82. package/.next/server/pages/en-US/account/404.json +1 -0
  83. package/.next/server/pages/en-US/checkout.html +2 -2
  84. package/.next/server/pages/en-US/login.html +2 -2
  85. package/.next/server/pages/en-US/s.html +2 -2
  86. package/.next/server/pages/en-US.html +2 -2
  87. package/.next/server/pages/index.js +1 -1
  88. package/.next/server/pages/index.js.nft.json +1 -1
  89. package/.next/server/pages/login.js +1 -1
  90. package/.next/server/pages/login.js.nft.json +1 -1
  91. package/.next/server/pages/s.js +1 -1
  92. package/.next/server/pages/s.js.nft.json +1 -1
  93. package/.next/server/pages-manifest.json +1 -1
  94. package/.next/static/chunks/4349-e6912711a345e5b6.js +1 -0
  95. package/.next/static/chunks/4625-a77d5db94b3a2b8f.js +1 -0
  96. package/.next/static/chunks/4746.f94ab461c31311bb.js +1 -0
  97. package/.next/static/chunks/4774.0450cb0efbfe76f4.js +1 -0
  98. package/.next/static/chunks/5836.92639eae2107d7af.js +1 -0
  99. package/.next/static/chunks/630.a3bf6c7cd8c945e1.js +6 -0
  100. package/.next/static/chunks/6335-1380989b5cc84425.js +1 -0
  101. package/.next/static/chunks/{2004.a778e11dd3802b72.js → 6410.bd3fa399df59cc80.js} +1 -1
  102. package/.next/static/chunks/6536.be112cd4a3efe253.js +1 -0
  103. package/.next/static/chunks/6867.27c1cb57ed76dd02.js +1 -0
  104. package/.next/static/chunks/7498-9b4ed9d4a65914cc.js +1 -0
  105. package/.next/static/chunks/7959.df78bb2e81b8d29c.js +1 -0
  106. package/.next/static/chunks/{9.89f24163370f3a22.js → 9.1db9e34673fbd5c9.js} +1 -1
  107. package/.next/static/chunks/9540.19d844fec8517602.js +1 -0
  108. package/.next/static/chunks/{1418-e86227bcf9a5d486.js → 9770-6f30493e3f7ab51b.js} +3 -3
  109. package/.next/static/chunks/BannerNewsletter.3031c9944928c34a.js +1 -0
  110. package/.next/static/chunks/BannerText.ca4ae220fed6bdd6.js +1 -0
  111. package/.next/static/chunks/CartSidebar.3d23093834f2c79a.js +1 -0
  112. package/.next/static/chunks/{Dropdown.7fe839c5ffce4687.js → Dropdown.534482865327310f.js} +1 -1
  113. package/.next/static/chunks/{DropdownButton.3991a37657e1d194.js → DropdownButton.90e7cb14e5866e74.js} +1 -1
  114. package/.next/static/chunks/{DropdownItem.0b3c39f881ca0832.js → DropdownItem.e74df13f69f8c3aa.js} +1 -1
  115. package/.next/static/chunks/{DropdownMenu.943b2d11ffa50ff6.js → DropdownMenu.56cde48e9fbbefe5.js} +1 -1
  116. package/.next/static/chunks/{Footer.1f83637df0884013.js → Footer.4bb5645e731073e7.js} +1 -1
  117. package/.next/static/chunks/Newsletter.f87cd1eca34af5e1.js +1 -0
  118. package/.next/static/chunks/ProductShelf.9b64813b3d1f4c9a.js +1 -0
  119. package/.next/static/chunks/ProductTiles.ebf02b46a32f5a53.js +1 -0
  120. package/.next/static/chunks/RegionModal.cdf4facd086a88e0.js +1 -0
  121. package/.next/static/chunks/Toast.fbfeced8149ed940.js +1 -0
  122. package/.next/static/chunks/{UIBannerText.45cf608e46cde628.js → UIBannerText.ef0582cb5cb01720.js} +1 -1
  123. package/.next/static/chunks/UISKUMatrixSidebar.64a50464062c77e9.js +1 -0
  124. package/.next/static/chunks/UIToast.22fea5cca8ee2b21.js +1 -0
  125. package/.next/static/chunks/pages/{404-6300c433469b7262.js → 404-e89b928faf6b9125.js} +1 -1
  126. package/.next/static/chunks/pages/{500-2d1dd344c8a8827f.js → 500-604704ba70e1e80a.js} +1 -1
  127. package/.next/static/chunks/pages/[...slug]-f80d7d8c8c7948a4.js +1 -0
  128. package/.next/static/chunks/pages/[slug]/p-748d6a1dbe59a2c8.js +1 -0
  129. package/.next/static/chunks/pages/_app-e5a4d3ef47f1b5c3.js +1 -0
  130. package/.next/static/chunks/pages/account/403-e4e6145815eeef01.js +1 -0
  131. package/.next/static/chunks/pages/account/404-ecfebfad41d655e9.js +1 -0
  132. package/.next/static/chunks/pages/account/[...unknown]-b233f92b64bd80cb.js +1 -0
  133. package/.next/static/chunks/pages/account/orders/[id]-8ab11c6c528911e9.js +1 -0
  134. package/.next/static/chunks/pages/account/orders-41bc5ef76c592a64.js +1 -0
  135. package/.next/static/chunks/pages/account/profile-2f501aabce910508.js +1 -0
  136. package/.next/static/chunks/pages/account/security-10e9e41318110950.js +1 -0
  137. package/.next/static/chunks/pages/account/user-details-5a7f30c290c25ec9.js +1 -0
  138. package/.next/static/chunks/pages/{checkout-93b647fc45454d97.js → checkout-cf3d3c3669a5e50b.js} +1 -1
  139. package/.next/static/chunks/pages/{index-07bc320fc045538c.js → index-e79b4e1ce52a8ea0.js} +1 -1
  140. package/.next/static/chunks/pages/{login-2454f1cd309c27d2.js → login-013b1f7a2b4bb9e0.js} +1 -1
  141. package/.next/static/chunks/pages/s-deeb7a0bdb02aaa9.js +1 -0
  142. package/.next/static/chunks/webpack-889c9cccd383a436.js +1 -0
  143. package/.next/static/css/2557aa3eaecf6ef0.css +1 -0
  144. package/.next/static/css/{b8945ac5f5327c34.css → 25ded555cb9a704f.css} +1 -1
  145. package/.next/static/css/5347dbc8b71de47d.css +1 -0
  146. package/.next/static/css/84d35f475d0dc928.css +1 -0
  147. package/.next/static/css/9d1abf05f9ffaf8f.css +1 -0
  148. package/.next/static/css/b7bba8fce075688b.css +1 -0
  149. package/.next/static/ptJ56QsnBqlWtpbKOLiri/_buildManifest.js +1 -0
  150. package/.next/static/ptJ56QsnBqlWtpbKOLiri/_ssgManifest.js +1 -0
  151. package/.next/trace +129 -112
  152. package/.turbo/turbo-build.log +40 -30
  153. package/.turbo/turbo-test.log +5 -5
  154. package/@generated/gql.ts +34 -2
  155. package/@generated/graphql.ts +1569 -2
  156. package/@generated/persisted-documents.json +4 -1
  157. package/@generated/schema.graphql +750 -0
  158. package/CHANGELOG.md +12 -0
  159. package/discovery.config.default.js +1 -1
  160. package/package.json +7 -8
  161. package/public/icons.svg +106 -0
  162. package/src/components/account/MyAccountDrawer/OrganizationDrawer/OrganizationDrawer.tsx +68 -0
  163. package/src/components/account/MyAccountDrawer/OrganizationDrawer/OrganizationDrawerBody.tsx +21 -0
  164. package/src/components/account/MyAccountDrawer/OrganizationDrawer/OrganizationDrawerHeader.tsx +39 -0
  165. package/src/components/account/MyAccountDrawer/OrganizationDrawer/index.ts +3 -0
  166. package/src/components/account/MyAccountDrawer/OrganizationDrawer/section.module.scss +125 -0
  167. package/src/components/account/MyAccountDrawer/OrganizationSignInButton/OrganizationSignInButton.tsx +50 -0
  168. package/src/components/account/MyAccountDrawer/OrganizationSignInButton/index.ts +1 -0
  169. package/src/components/account/MyAccountDrawer/ProfileSummary/ProfileSummary.tsx +69 -0
  170. package/src/components/account/MyAccountDrawer/ProfileSummary/profile-summary.scss +128 -0
  171. package/src/components/account/MyAccountLayout/MyAccountLayout.tsx +2 -2
  172. package/src/components/account/MyAccountLayout/styles.scss +8 -4
  173. package/src/components/account/MyAccountMenu/styles.scss +3 -2
  174. package/src/components/account/components/BottomSheet/BottomSheet.tsx +58 -0
  175. package/src/components/account/components/BottomSheet/styles.scss +35 -0
  176. package/src/components/account/components/MyAccountAccordion/MyAccountAccordion.tsx +13 -0
  177. package/src/components/account/components/MyAccountAccordion/MyAccountAccordionButton.tsx +35 -0
  178. package/src/components/account/components/MyAccountAccordion/MyAccountAccordionItem.tsx +21 -0
  179. package/src/components/account/components/MyAccountAccordion/MyAccountAccordionPanel.tsx +16 -0
  180. package/src/components/account/components/MyAccountAccordion/index.ts +4 -0
  181. package/src/components/account/components/MyAccountAccordion/styles.scss +88 -0
  182. package/src/components/account/components/MyAccountCard/MyAccountCard.tsx +13 -0
  183. package/src/components/account/components/MyAccountCard/index.ts +1 -0
  184. package/src/components/account/components/MyAccountCard/styles.scss +23 -0
  185. package/src/components/account/components/MyAccountStatusBadge/MyAccountStatusBadge.tsx +28 -0
  186. package/src/components/account/components/MyAccountStatusBadge/index.ts +1 -0
  187. package/src/components/account/components/MyAccountStatusBadge/styles.scss +54 -0
  188. package/src/components/account/orders/MyAccountListOrders/MyAccountFilterSlider/MyAccountFilterFacetDateRange/MyAccountFilterFacetDateRange.tsx +113 -0
  189. package/src/components/account/orders/MyAccountListOrders/MyAccountFilterSlider/MyAccountFilterFacetDateRange/index.ts +2 -0
  190. package/src/components/account/orders/MyAccountListOrders/MyAccountFilterSlider/MyAccountFilterFacetDateRange/styles.scss +43 -0
  191. package/src/components/account/orders/MyAccountListOrders/MyAccountFilterSlider/MyAccountFilterSlider.tsx +209 -0
  192. package/src/components/account/orders/MyAccountListOrders/MyAccountFilterSlider/index.ts +1 -0
  193. package/src/components/account/orders/MyAccountListOrders/MyAccountFilterSlider/section.module.scss +24 -0
  194. package/src/components/account/orders/MyAccountListOrders/MyAccountListOrders.tsx +296 -0
  195. package/src/components/account/orders/MyAccountListOrders/MyAccountListOrdersEmptyState/MyAccountListOrdersEmptyState.tsx +20 -0
  196. package/src/components/account/orders/MyAccountListOrders/MyAccountListOrdersEmptyState/index.ts +1 -0
  197. package/src/components/account/orders/MyAccountListOrders/MyAccountListOrdersEmptyState/styles.scss +43 -0
  198. package/src/components/account/orders/MyAccountListOrders/MyAccountListOrdersTable/MyAccountListOrdersTable.tsx +210 -0
  199. package/src/components/account/orders/MyAccountListOrders/MyAccountListOrdersTable/index.ts +1 -0
  200. package/src/components/account/orders/MyAccountListOrders/MyAccountListOrdersTable/styles.scss +153 -0
  201. package/src/components/account/orders/MyAccountListOrders/MyAccountSelectedTags/MyAccountSelectedTags.tsx +119 -0
  202. package/src/components/account/orders/MyAccountListOrders/MyAccountSelectedTags/index.ts +1 -0
  203. package/src/components/account/orders/MyAccountListOrders/MyAccountSelectedTags/styles.scss +69 -0
  204. package/src/components/account/orders/MyAccountListOrders/index.ts +1 -0
  205. package/src/components/account/orders/MyAccountListOrders/styles.module.scss +100 -0
  206. package/src/components/account/orders/MyAccountOrderDetails/MyAccountDeliveryCard/MyAccountDeliveryCard.tsx +47 -0
  207. package/src/components/account/orders/MyAccountOrderDetails/MyAccountDeliveryCard/index.ts +1 -0
  208. package/src/components/account/orders/MyAccountOrderDetails/MyAccountDeliveryCard/styles.scss +44 -0
  209. package/src/components/account/orders/MyAccountOrderDetails/MyAccountDeliveryOptionAccordion/MyAccountDeliveryOptionAccordion.tsx +93 -0
  210. package/src/components/account/orders/MyAccountOrderDetails/MyAccountDeliveryOptionAccordion/MyAccountDeliveryOptionAccordionDeliveryInfo.tsx +86 -0
  211. package/src/components/account/orders/MyAccountOrderDetails/MyAccountDeliveryOptionAccordion/MyAccountDeliveryOptionAccordionProducts.tsx +74 -0
  212. package/src/components/account/orders/MyAccountOrderDetails/MyAccountDeliveryOptionAccordion/index.ts +6 -0
  213. package/src/components/account/orders/MyAccountOrderDetails/MyAccountDeliveryOptionAccordion/styles.scss +193 -0
  214. package/src/components/account/orders/MyAccountOrderDetails/MyAccountMoreInformationCard/MyAccountMoreInformationCard.tsx +31 -0
  215. package/src/components/account/orders/MyAccountOrderDetails/MyAccountMoreInformationCard/index.ts +1 -0
  216. package/src/components/account/orders/MyAccountOrderDetails/MyAccountMoreInformationCard/styles.scss +22 -0
  217. package/src/components/account/orders/MyAccountOrderDetails/MyAccountOrderActionModal/MyAccountOrderActionModal.tsx +121 -0
  218. package/src/components/account/orders/MyAccountOrderDetails/MyAccountOrderActionModal/index.ts +2 -0
  219. package/src/components/account/orders/MyAccountOrderDetails/MyAccountOrderActionModal/styles.module.scss +40 -0
  220. package/src/components/account/orders/MyAccountOrderDetails/MyAccountOrderActionModal/useOrderActionModal.ts +38 -0
  221. package/src/components/account/orders/MyAccountOrderDetails/MyAccountOrderActions/MyAccountOrderActions.tsx +154 -0
  222. package/src/components/account/orders/MyAccountOrderDetails/MyAccountOrderActions/index.ts +1 -0
  223. package/src/components/account/orders/MyAccountOrderDetails/MyAccountOrderActions/styles.scss +33 -0
  224. package/src/components/account/orders/MyAccountOrderDetails/MyAccountOrderDetails.tsx +106 -0
  225. package/src/components/account/orders/MyAccountOrderDetails/MyAccountOrderedByCard/MyAccountOrderedByCard.tsx +54 -0
  226. package/src/components/account/orders/MyAccountOrderDetails/MyAccountOrderedByCard/index.ts +1 -0
  227. package/src/components/account/orders/MyAccountOrderDetails/MyAccountOrderedByCard/styles.scss +65 -0
  228. package/src/components/account/orders/MyAccountOrderDetails/MyAccountPaymentCard/MyAccountPaymentCard.tsx +157 -0
  229. package/src/components/account/orders/MyAccountOrderDetails/MyAccountPaymentCard/MyAccountPaymentFlagsIcon.tsx +106 -0
  230. package/src/components/account/orders/MyAccountOrderDetails/MyAccountPaymentCard/index.ts +1 -0
  231. package/src/components/account/orders/MyAccountOrderDetails/MyAccountPaymentCard/styles.scss +76 -0
  232. package/src/components/account/orders/MyAccountOrderDetails/MyAccountStatusCard/MyAccountStatusCard.tsx +276 -0
  233. package/src/components/account/orders/MyAccountOrderDetails/MyAccountStatusCard/index.ts +1 -0
  234. package/src/components/account/orders/MyAccountOrderDetails/MyAccountStatusCard/styles.scss +205 -0
  235. package/src/components/account/orders/MyAccountOrderDetails/MyAccountStatusCard/useConnectorPositioning.ts +74 -0
  236. package/src/components/account/orders/MyAccountOrderDetails/MyAccountSummaryCard/MyAccountSummaryCard.tsx +92 -0
  237. package/src/components/account/orders/MyAccountOrderDetails/MyAccountSummaryCard/index.ts +1 -0
  238. package/src/components/account/orders/MyAccountOrderDetails/MyAccountSummaryCard/styles.scss +45 -0
  239. package/src/components/account/orders/MyAccountOrderDetails/index.ts +1 -0
  240. package/src/components/account/orders/MyAccountOrderDetails/section.module.scss +114 -0
  241. package/src/components/account/utils/useFormatPrice.ts +18 -0
  242. package/src/components/cms/RenderSections.tsx +1 -1
  243. package/src/components/navigation/Navbar/Navbar.tsx +16 -1
  244. package/src/components/navigation/NavbarSlider/NavbarSlider.tsx +18 -3
  245. package/src/customizations/src/myAccount/extensions/orders/[id]/after.tsx +7 -0
  246. package/src/customizations/src/myAccount/extensions/orders/[id]/before.tsx +7 -0
  247. package/src/customizations/src/myAccount/extensions/orders/after.tsx +7 -0
  248. package/src/customizations/src/myAccount/extensions/orders/before.tsx +7 -0
  249. package/src/customizations/src/myAccount/extensions/profile/after.tsx +7 -0
  250. package/src/customizations/src/myAccount/extensions/profile/before.tsx +7 -0
  251. package/src/customizations/src/myAccount/extensions/security/after.tsx +7 -0
  252. package/src/customizations/src/myAccount/extensions/security/before.tsx +7 -0
  253. package/src/customizations/src/myAccount/extensions/user-details/after.tsx +7 -0
  254. package/src/customizations/src/myAccount/extensions/user-details/before.tsx +7 -0
  255. package/src/experimental/myAccountSeverSideProps.ts +12 -1
  256. package/src/pages/account/403.tsx +103 -0
  257. package/src/pages/account/404.tsx +95 -0
  258. package/src/pages/account/[...unknown].tsx +39 -0
  259. package/src/pages/account/index.tsx +8 -16
  260. package/src/pages/account/orders/[id].tsx +764 -0
  261. package/src/pages/account/orders/index.tsx +273 -0
  262. package/src/pages/account/orders/styles.module.scss +35 -0
  263. package/src/pages/account/profile.tsx +62 -17
  264. package/src/pages/account/security.tsx +94 -0
  265. package/src/pages/account/user-details.tsx +94 -0
  266. package/src/sdk/account/getMyAccountRoutes.ts +13 -12
  267. package/src/sdk/account/useApproveOrder.ts +53 -0
  268. package/src/sdk/account/useCancelOrder.ts +34 -0
  269. package/src/sdk/account/useDebounce.ts +23 -0
  270. package/src/sdk/account/useRejectOrder.ts +53 -0
  271. package/src/sdk/search/useMyAccountFilter.ts +157 -0
  272. package/src/sdk/session/index.ts +9 -0
  273. package/src/utils/myAccountRedirect.tsx +36 -0
  274. package/src/utils/userOrderStatus.ts +141 -0
  275. package/src/utils/utilities.ts +35 -3
  276. package/test/server/index.test.ts +9 -1
  277. package/.next/server/chunks/1246.js +0 -1
  278. package/.next/server/chunks/2443.js +0 -1
  279. package/.next/server/chunks/4725.js +0 -1
  280. package/.next/server/chunks/563.js +0 -1
  281. package/.next/server/chunks/6968.js +0 -10
  282. package/.next/server/chunks/7468.js +0 -1
  283. package/.next/server/chunks/8355.js +0 -1
  284. package/.next/static/chunks/1173.ca14a5bc4e1264f4.js +0 -1
  285. package/.next/static/chunks/2206.44239ce81a09bc17.js +0 -1
  286. package/.next/static/chunks/4349-87a956a73b97519c.js +0 -1
  287. package/.next/static/chunks/4625-553d20c86b0ca577.js +0 -1
  288. package/.next/static/chunks/4746.2e16ec0663a3873f.js +0 -1
  289. package/.next/static/chunks/4774.8e70c01dcd0ed4b3.js +0 -1
  290. package/.next/static/chunks/4865.4017be0f8e7c8cf0.js +0 -1
  291. package/.next/static/chunks/5259-90f7ef92cf24e49a.js +0 -1
  292. package/.next/static/chunks/5836.48126b7866819f9e.js +0 -1
  293. package/.next/static/chunks/630.13d3dd939b789798.js +0 -6
  294. package/.next/static/chunks/6335-6eb4ff84af184b88.js +0 -1
  295. package/.next/static/chunks/6536.d5260107222db13c.js +0 -1
  296. package/.next/static/chunks/7498-72289e704e7c7056.js +0 -1
  297. package/.next/static/chunks/7959.7c721505286572c0.js +0 -1
  298. package/.next/static/chunks/BannerNewsletter.8982f42e60ed8828.js +0 -1
  299. package/.next/static/chunks/BannerText.5b250db1cf67e44f.js +0 -1
  300. package/.next/static/chunks/CartSidebar.aa9e43be37034654.js +0 -1
  301. package/.next/static/chunks/Newsletter.9db4df2d4fb33227.js +0 -1
  302. package/.next/static/chunks/ProductShelf.9cea36116836c161.js +0 -1
  303. package/.next/static/chunks/ProductTiles.059a4a6360e1d4ea.js +0 -1
  304. package/.next/static/chunks/RegionModal.4594b707a1092551.js +0 -1
  305. package/.next/static/chunks/Toast.01d4ac8bf14c1be5.js +0 -1
  306. package/.next/static/chunks/UIButton.3186f933c0ecfb31.js +0 -1
  307. package/.next/static/chunks/UISKUMatrixSidebar.9ac3980a60cfc358.js +0 -1
  308. package/.next/static/chunks/UIToast.221eb10681d2f642.js +0 -1
  309. package/.next/static/chunks/pages/[...slug]-c1a62d58f5940747.js +0 -1
  310. package/.next/static/chunks/pages/[slug]/p-555dc09a5e78260e.js +0 -1
  311. package/.next/static/chunks/pages/_app-d5641120092ee13b.js +0 -1
  312. package/.next/static/chunks/pages/account/profile-23b2e9fbbd95a30b.js +0 -1
  313. package/.next/static/chunks/pages/s-9901e6857f517b8b.js +0 -1
  314. package/.next/static/chunks/webpack-f338de6955d58a39.js +0 -1
  315. package/.next/static/css/249b9deaabc0d32d.css +0 -1
  316. package/.next/static/t5v5T1mAjzrYWEKaMk8mu/_buildManifest.js +0 -1
  317. package/.next/static/t5v5T1mAjzrYWEKaMk8mu/_ssgManifest.js +0 -1
@@ -0,0 +1,273 @@
1
+ import type { Locator } from '@vtex/client-cms'
2
+ import type { GetServerSideProps } from 'next'
3
+ import { NextSeo } from 'next-seo'
4
+ import type { ComponentType } from 'react'
5
+ import { MyAccountLayout } from 'src/components/account'
6
+ import RenderSections from 'src/components/cms/RenderSections'
7
+ import { default as GLOBAL_COMPONENTS } from 'src/components/cms/global/Components'
8
+ import CUSTOM_COMPONENTS from 'src/customizations/src/components'
9
+
10
+ import { getGlobalSectionsData } from 'src/components/cms/GlobalSections'
11
+
12
+ import { gql } from '@generated/gql'
13
+ import type {
14
+ ServerListOrdersQueryQuery,
15
+ ServerListOrdersQueryQueryVariables,
16
+ } from '@generated/graphql'
17
+ import { default as AfterSection } from 'src/customizations/src/myAccount/extensions/orders/after'
18
+ import { default as BeforeSection } from 'src/customizations/src/myAccount/extensions/orders/before'
19
+ import type { MyAccountProps } from 'src/experimental/myAccountSeverSideProps'
20
+ import { execute } from 'src/server'
21
+ import { injectGlobalSections } from 'src/server/cms/global'
22
+ import { getMyAccountRedirect } from 'src/utils/myAccountRedirect'
23
+ import { groupOrderStatusByLabel } from 'src/utils/userOrderStatus'
24
+
25
+ import { MyAccountListOrders } from 'src/components/account/orders/MyAccountListOrders'
26
+
27
+ /* A list of components that can be used in the CMS. */
28
+ const COMPONENTS: Record<string, ComponentType<any>> = {
29
+ ...GLOBAL_COMPONENTS,
30
+ ...CUSTOM_COMPONENTS,
31
+ }
32
+
33
+ type ListOrdersPageProps = {
34
+ listOrders: ServerListOrdersQueryQuery['listUserOrders']
35
+ total: number
36
+ perPage: number
37
+ filters: {
38
+ page: number
39
+ status: string[]
40
+ dateInitial: string
41
+ dateFinal: string
42
+ text: string
43
+ clientEmail: string
44
+ }
45
+ } & MyAccountProps
46
+
47
+ export default function ListOrdersPage({
48
+ globalSections,
49
+ listOrders,
50
+ total,
51
+ perPage,
52
+ filters,
53
+ }: ListOrdersPageProps) {
54
+ return (
55
+ <RenderSections
56
+ globalSections={globalSections.sections}
57
+ components={COMPONENTS}
58
+ >
59
+ <NextSeo noindex nofollow />
60
+
61
+ <MyAccountLayout>
62
+ <BeforeSection />
63
+ <MyAccountListOrders
64
+ listOrders={listOrders}
65
+ filters={filters}
66
+ perPage={perPage}
67
+ total={total}
68
+ />
69
+ <AfterSection />
70
+ </MyAccountLayout>
71
+ </RenderSections>
72
+ )
73
+ }
74
+
75
+ const query = gql(`
76
+ query ServerListOrdersQuery ($page: Int,$perPage: Int, $status: [String], $dateInitial: String, $dateFinal: String, $text: String, $clientEmail: String) {
77
+ listUserOrders (page: $page, perPage: $perPage, status: $status, dateInitial: $dateInitial, dateFinal: $dateFinal, text: $text, clientEmail: $clientEmail) {
78
+ list {
79
+ orderId
80
+ creationDate
81
+ clientName
82
+ items {
83
+ seller
84
+ quantity
85
+ description
86
+ ean
87
+ refId
88
+ id
89
+ productId
90
+ sellingPrice
91
+ price
92
+ }
93
+ totalValue
94
+ paymentNames
95
+ status
96
+ statusDescription
97
+ marketPlaceOrderId
98
+ sequence
99
+ salesChannel
100
+ affiliateId
101
+ origin
102
+ workflowInErrorState
103
+ workflowInRetry
104
+ lastMessageUnread
105
+ ShippingEstimatedDate
106
+ ShippingEstimatedDateMax
107
+ ShippingEstimatedDateMin
108
+ orderIsComplete
109
+ listId
110
+ listType
111
+ authorizedDate
112
+ callCenterOperatorName
113
+ totalItems
114
+ currencyCode
115
+ hostname
116
+ invoiceOutput
117
+ invoiceInput
118
+ lastChange
119
+ isAllDelivered
120
+ isAnyDelivered
121
+ giftCardProviders
122
+ orderFormId
123
+ paymentApprovedDate
124
+ readyForHandlingDate
125
+ deliveryDates
126
+ }
127
+ paging {
128
+ total
129
+ pages
130
+ currentPage
131
+ perPage
132
+ }
133
+ stats {
134
+ stats {
135
+ totalValue {
136
+ Count
137
+ Max
138
+ Mean
139
+ Min
140
+ Missing
141
+ StdDev
142
+ Sum
143
+ SumOfSquares
144
+ Facets
145
+ }
146
+ totalItems {
147
+ Count
148
+ Max
149
+ Mean
150
+ Min
151
+ Missing
152
+ StdDev
153
+ Sum
154
+ SumOfSquares
155
+ Facets
156
+ }
157
+ }
158
+ }
159
+ facets
160
+ reportRecordsLimit
161
+ }
162
+ }
163
+ `)
164
+
165
+ export const getServerSideProps: GetServerSideProps<
166
+ MyAccountProps,
167
+ Record<string, string>,
168
+ Locator
169
+ > = async (context) => {
170
+ // TODO validate permissions here
171
+
172
+ const { previewData } = context
173
+
174
+ const { isFaststoreMyAccountEnabled, redirect } = getMyAccountRedirect({
175
+ query: context.query,
176
+ })
177
+
178
+ if (!isFaststoreMyAccountEnabled) {
179
+ return { redirect }
180
+ }
181
+
182
+ const [
183
+ globalSectionsPromise,
184
+ globalSectionsHeaderPromise,
185
+ globalSectionsFooterPromise,
186
+ ] = getGlobalSectionsData(previewData)
187
+
188
+ const page = Number(context.query.page as string | undefined) || 1
189
+ const perPage = 25 // TODO: make this configurable
190
+ const status =
191
+ (Array.isArray(context.query.status)
192
+ ? context.query.status
193
+ : [context.query.status]
194
+ ).filter(Boolean) || []
195
+ const dateInitial = (context.query.dateInitial as string | undefined) || ''
196
+ const dateFinal = (context.query.dateFinal as string | undefined) || ''
197
+ const text = (context.query.text as string | undefined) || ''
198
+ const clientEmail = (context.query.clientEmail as string | undefined) || ''
199
+
200
+ // Map labels from FastStore status to API status
201
+ const groupedStatus = groupOrderStatusByLabel()
202
+ const allStatuses =
203
+ status
204
+ .reduce((acc, item) => {
205
+ const statusGroup = Object.entries(groupedStatus).find(
206
+ ([key]) => key.toLowerCase() === item.toLowerCase()
207
+ )
208
+ if (statusGroup) {
209
+ const [, statusValues] = statusGroup
210
+ return [...acc, ...statusValues]
211
+ }
212
+ return acc
213
+ }, [] as string[])
214
+ .filter(Boolean) || []
215
+
216
+ const [
217
+ listOrders,
218
+ globalSections,
219
+ globalSectionsHeader,
220
+ globalSectionsFooter,
221
+ ] = await Promise.all([
222
+ execute<ServerListOrdersQueryQueryVariables, ServerListOrdersQueryQuery>(
223
+ {
224
+ variables: {
225
+ page,
226
+ perPage,
227
+ status: allStatuses,
228
+ dateInitial,
229
+ dateFinal,
230
+ text,
231
+ clientEmail,
232
+ },
233
+ operation: query,
234
+ },
235
+ { headers: { ...context.req.headers } }
236
+ ),
237
+ globalSectionsPromise,
238
+ globalSectionsHeaderPromise,
239
+ globalSectionsFooterPromise,
240
+ ])
241
+
242
+ if (listOrders.errors) {
243
+ return {
244
+ redirect: {
245
+ destination: '/account/404',
246
+ permanent: false,
247
+ },
248
+ }
249
+ }
250
+
251
+ const globalSectionsResult = injectGlobalSections({
252
+ globalSections,
253
+ globalSectionsHeader,
254
+ globalSectionsFooter,
255
+ })
256
+
257
+ return {
258
+ props: {
259
+ globalSections: globalSectionsResult,
260
+ listOrders: listOrders.data.listUserOrders,
261
+ total: listOrders.data.listUserOrders.paging.total,
262
+ perPage: listOrders.data.listUserOrders.paging.perPage,
263
+ filters: {
264
+ page: listOrders.data.listUserOrders.paging.currentPage ?? page,
265
+ status,
266
+ dateInitial,
267
+ dateFinal,
268
+ text,
269
+ clientEmail,
270
+ },
271
+ },
272
+ }
273
+ }
@@ -0,0 +1,35 @@
1
+ .container {
2
+ padding: 2rem;
3
+ }
4
+
5
+ .filters {
6
+ display: flex;
7
+ gap: 1rem;
8
+ margin-bottom: 1rem;
9
+ }
10
+
11
+ .table {
12
+ width: 100%;
13
+ border-collapse: collapse;
14
+ }
15
+
16
+ .table th, .table td {
17
+ padding: 0.5rem;
18
+ text-align: left;
19
+ border: 1px solid #ccc;
20
+ }
21
+
22
+ .pagination {
23
+ margin-top: 1rem;
24
+ }
25
+
26
+ .pagination button {
27
+ padding: 0.5rem 1rem;
28
+ margin-right: 0.5rem;
29
+ }
30
+
31
+ .pagination .active {
32
+ font-weight: bold;
33
+ color: white;
34
+ background-color: #0070f3;
35
+ }
@@ -1,16 +1,22 @@
1
1
  /* ######################################### */
2
2
  /* Mocked Page until development is finished, it will be removed after */
3
3
 
4
+ import type { Locator } from '@vtex/client-cms'
5
+ import type { GetServerSideProps } from 'next'
4
6
  import { NextSeo } from 'next-seo'
5
7
  import type { ComponentType } from 'react'
6
8
  import { MyAccountLayout } from 'src/components/account'
7
9
  import RenderSections from 'src/components/cms/RenderSections'
8
10
  import { default as GLOBAL_COMPONENTS } from 'src/components/cms/global/Components'
9
11
  import CUSTOM_COMPONENTS from 'src/customizations/src/components'
10
- import {
11
- getServerSideProps,
12
- type MyAccountProps,
13
- } from 'src/experimental/myAccountSeverSideProps'
12
+
13
+ import { getGlobalSectionsData } from 'src/components/cms/GlobalSections'
14
+
15
+ import { default as AfterSection } from 'src/customizations/src/myAccount/extensions/profile/after'
16
+ import { default as BeforeSection } from 'src/customizations/src/myAccount/extensions/profile/before'
17
+ import type { MyAccountProps } from 'src/experimental/myAccountSeverSideProps'
18
+ import { injectGlobalSections } from 'src/server/cms/global'
19
+ import { getMyAccountRedirect } from 'src/utils/myAccountRedirect'
14
20
 
15
21
  /* A list of components that can be used in the CMS. */
16
22
  const COMPONENTS: Record<string, ComponentType<any>> = {
@@ -18,16 +24,6 @@ const COMPONENTS: Record<string, ComponentType<any>> = {
18
24
  ...CUSTOM_COMPONENTS,
19
25
  }
20
26
 
21
- const style = {
22
- alignContent: 'center',
23
- justifyContent: 'center',
24
- alignItems: 'center',
25
- display: 'flex',
26
- h1: {
27
- fontSize: '100px',
28
- },
29
- }
30
-
31
27
  export default function Profile({ globalSections }: MyAccountProps) {
32
28
  return (
33
29
  <RenderSections
@@ -37,12 +33,61 @@ export default function Profile({ globalSections }: MyAccountProps) {
37
33
  <NextSeo noindex nofollow />
38
34
 
39
35
  <MyAccountLayout>
40
- <div style={style}>
41
- <h1 style={style.h1}>Profile</h1>
36
+ <BeforeSection />
37
+ <div>
38
+ <h1>Profile</h1>
42
39
  </div>
40
+ <AfterSection />
43
41
  </MyAccountLayout>
44
42
  </RenderSections>
45
43
  )
46
44
  }
47
45
 
48
- export { getServerSideProps }
46
+ export const getServerSideProps: GetServerSideProps<
47
+ MyAccountProps,
48
+ Record<string, string>,
49
+ Locator
50
+ > = async ({ previewData, query }) => {
51
+ // TODO validate permissions here
52
+
53
+ const { isFaststoreMyAccountEnabled, redirect } = getMyAccountRedirect({
54
+ query,
55
+ })
56
+
57
+ if (!isFaststoreMyAccountEnabled) {
58
+ return { redirect }
59
+ }
60
+
61
+ const [
62
+ globalSectionsPromise,
63
+ globalSectionsHeaderPromise,
64
+ globalSectionsFooterPromise,
65
+ ] = getGlobalSectionsData(previewData)
66
+
67
+ const [globalSections, globalSectionsHeader, globalSectionsFooter] =
68
+ await Promise.all([
69
+ globalSectionsPromise,
70
+ globalSectionsHeaderPromise,
71
+ globalSectionsFooterPromise,
72
+ ])
73
+
74
+ // TODO handle 404 when profile request is made
75
+ // if (profile.errors) {
76
+ // return {
77
+ // redirect: {
78
+ // destination: '/account/404',
79
+ // permanent: false,
80
+ // },
81
+ // }
82
+ // }
83
+
84
+ const globalSectionsResult = injectGlobalSections({
85
+ globalSections,
86
+ globalSectionsHeader,
87
+ globalSectionsFooter,
88
+ })
89
+
90
+ return {
91
+ props: { globalSections: globalSectionsResult },
92
+ }
93
+ }
@@ -0,0 +1,94 @@
1
+ /* ######################################### */
2
+ /* Mocked Page until development is finished, it will be removed after */
3
+
4
+ import { NextSeo } from 'next-seo'
5
+ import type { ComponentType } from 'react'
6
+ import { MyAccountLayout } from 'src/components/account'
7
+ import RenderSections from 'src/components/cms/RenderSections'
8
+ import { default as GLOBAL_COMPONENTS } from 'src/components/cms/global/Components'
9
+ import CUSTOM_COMPONENTS from 'src/customizations/src/components'
10
+
11
+ import type { Locator } from '@vtex/client-cms'
12
+ import type { GetServerSideProps } from 'next'
13
+
14
+ import { getGlobalSectionsData } from 'src/components/cms/GlobalSections'
15
+
16
+ import { default as AfterSection } from 'src/customizations/src/myAccount/extensions/security/after'
17
+ import { default as BeforeSection } from 'src/customizations/src/myAccount/extensions/security/before'
18
+ import type { MyAccountProps } from 'src/experimental/myAccountSeverSideProps'
19
+ import { injectGlobalSections } from 'src/server/cms/global'
20
+ import { getMyAccountRedirect } from 'src/utils/myAccountRedirect'
21
+
22
+ /* A list of components that can be used in the CMS. */
23
+ const COMPONENTS: Record<string, ComponentType<any>> = {
24
+ ...GLOBAL_COMPONENTS,
25
+ ...CUSTOM_COMPONENTS,
26
+ }
27
+
28
+ export default function Page({ globalSections }: MyAccountProps) {
29
+ return (
30
+ <RenderSections
31
+ globalSections={globalSections.sections}
32
+ components={COMPONENTS}
33
+ >
34
+ <NextSeo noindex nofollow />
35
+
36
+ <MyAccountLayout>
37
+ <BeforeSection />
38
+ <div>
39
+ <h1>Security</h1>
40
+ </div>
41
+ <AfterSection />
42
+ </MyAccountLayout>
43
+ </RenderSections>
44
+ )
45
+ }
46
+
47
+ export const getServerSideProps: GetServerSideProps<
48
+ MyAccountProps,
49
+ Record<string, string>,
50
+ Locator
51
+ > = async ({ previewData, query }) => {
52
+ // TODO validate permissions here
53
+
54
+ const { isFaststoreMyAccountEnabled, redirect } = getMyAccountRedirect({
55
+ query,
56
+ })
57
+
58
+ if (!isFaststoreMyAccountEnabled) {
59
+ return { redirect }
60
+ }
61
+
62
+ const [
63
+ globalSectionsPromise,
64
+ globalSectionsHeaderPromise,
65
+ globalSectionsFooterPromise,
66
+ ] = getGlobalSectionsData(previewData)
67
+
68
+ const [globalSections, globalSectionsHeader, globalSectionsFooter] =
69
+ await Promise.all([
70
+ globalSectionsPromise,
71
+ globalSectionsHeaderPromise,
72
+ globalSectionsFooterPromise,
73
+ ])
74
+
75
+ // TODO handle 404 when security request is made
76
+ // if (security.errors) {
77
+ // return {
78
+ // redirect: {
79
+ // destination: '/account/404',
80
+ // permanent: false,
81
+ // },
82
+ // }
83
+ // }
84
+
85
+ const globalSectionsResult = injectGlobalSections({
86
+ globalSections,
87
+ globalSectionsHeader,
88
+ globalSectionsFooter,
89
+ })
90
+
91
+ return {
92
+ props: { globalSections: globalSectionsResult },
93
+ }
94
+ }
@@ -0,0 +1,94 @@
1
+ /* ######################################### */
2
+ /* Mocked Page until development is finished, it will be removed after */
3
+
4
+ import { NextSeo } from 'next-seo'
5
+ import type { ComponentType } from 'react'
6
+ import { MyAccountLayout } from 'src/components/account'
7
+ import RenderSections from 'src/components/cms/RenderSections'
8
+ import { default as GLOBAL_COMPONENTS } from 'src/components/cms/global/Components'
9
+ import CUSTOM_COMPONENTS from 'src/customizations/src/components'
10
+
11
+ import type { Locator } from '@vtex/client-cms'
12
+ import type { GetServerSideProps } from 'next'
13
+
14
+ import { getGlobalSectionsData } from 'src/components/cms/GlobalSections'
15
+
16
+ import { default as AfterSection } from 'src/customizations/src/myAccount/extensions/user-details/after'
17
+ import { default as BeforeSection } from 'src/customizations/src/myAccount/extensions/user-details/before'
18
+ import type { MyAccountProps } from 'src/experimental/myAccountSeverSideProps'
19
+ import { injectGlobalSections } from 'src/server/cms/global'
20
+ import { getMyAccountRedirect } from 'src/utils/myAccountRedirect'
21
+
22
+ /* A list of components that can be used in the CMS. */
23
+ const COMPONENTS: Record<string, ComponentType<any>> = {
24
+ ...GLOBAL_COMPONENTS,
25
+ ...CUSTOM_COMPONENTS,
26
+ }
27
+
28
+ export default function Page({ globalSections }: MyAccountProps) {
29
+ return (
30
+ <RenderSections
31
+ globalSections={globalSections.sections}
32
+ components={COMPONENTS}
33
+ >
34
+ <NextSeo noindex nofollow />
35
+
36
+ <MyAccountLayout>
37
+ <BeforeSection />
38
+ <div>
39
+ <h1>User Details</h1>
40
+ </div>
41
+ <AfterSection />
42
+ </MyAccountLayout>
43
+ </RenderSections>
44
+ )
45
+ }
46
+
47
+ export const getServerSideProps: GetServerSideProps<
48
+ MyAccountProps,
49
+ Record<string, string>,
50
+ Locator
51
+ > = async ({ previewData, query }) => {
52
+ // TODO validate permissions here
53
+
54
+ const { isFaststoreMyAccountEnabled, redirect } = getMyAccountRedirect({
55
+ query,
56
+ })
57
+
58
+ if (!isFaststoreMyAccountEnabled) {
59
+ return { redirect }
60
+ }
61
+
62
+ const [
63
+ globalSectionsPromise,
64
+ globalSectionsHeaderPromise,
65
+ globalSectionsFooterPromise,
66
+ ] = getGlobalSectionsData(previewData)
67
+
68
+ const [globalSections, globalSectionsHeader, globalSectionsFooter] =
69
+ await Promise.all([
70
+ globalSectionsPromise,
71
+ globalSectionsHeaderPromise,
72
+ globalSectionsFooterPromise,
73
+ ])
74
+
75
+ // TODO handle 404 when userDetails request is made
76
+ // if (userDetails.errors) {
77
+ // return {
78
+ // redirect: {
79
+ // destination: '/account/404',
80
+ // permanent: false,
81
+ // },
82
+ // }
83
+ // }
84
+
85
+ const globalSectionsResult = injectGlobalSections({
86
+ globalSections,
87
+ globalSectionsHeader,
88
+ globalSectionsFooter,
89
+ })
90
+
91
+ return {
92
+ props: { globalSections: globalSectionsResult },
93
+ }
94
+ }
@@ -10,23 +10,24 @@ interface GetMyAccountRouteParams {
10
10
  routes: Route[]
11
11
  }
12
12
 
13
+ // This is the default route list for My Account, we should add then as the feature is implemented
13
14
  const DEFAULT_ROUTES: Route[] = [
14
- {
15
- title: 'Profile',
16
- route: '/account/profile',
17
- },
15
+ // {
16
+ // title: 'Profile',
17
+ // route: '/account/profile',
18
+ // },
18
19
  {
19
20
  title: 'Orders',
20
21
  route: '/account/orders',
21
22
  },
22
- {
23
- title: 'User Details',
24
- route: '/account/user-details',
25
- },
26
- {
27
- title: 'Security',
28
- route: '/account/security',
29
- },
23
+ // {
24
+ // title: 'User Details',
25
+ // route: '/account/user-details',
26
+ // },
27
+ // {
28
+ // title: 'Security',
29
+ // route: '/account/security',
30
+ // },
30
31
  ]
31
32
 
32
33
  export function getMyAccountRoutes({ routes }: GetMyAccountRouteParams) {
@@ -0,0 +1,53 @@
1
+ import { useState } from 'react'
2
+
3
+ interface ApproveOrderVariables {
4
+ data: {
5
+ orderId: string
6
+ customerEmail?: string
7
+ }
8
+ }
9
+
10
+ export const useApproveOrder = () => {
11
+ const [data, setData] = useState<any>(null)
12
+ const [error, setError] = useState<Error | null>(null)
13
+ const [loading, setLoading] = useState(false)
14
+
15
+ // TODO: Replace with actual GraphQL mutation when its ready
16
+ const approveOrder = async (variables: ApproveOrderVariables) => {
17
+ setLoading(true)
18
+
19
+ try {
20
+ await new Promise((resolve) => setTimeout(resolve, 800))
21
+
22
+ const shouldSucceed = Math.random() > 0.1
23
+ if (!shouldSucceed) {
24
+ throw new Error('Failed to approve order')
25
+ }
26
+
27
+ const mockResponse = {
28
+ data: {
29
+ success: true,
30
+ orderId: variables.data.orderId,
31
+ },
32
+ }
33
+
34
+ setData(mockResponse)
35
+ setLoading(false)
36
+
37
+ return mockResponse
38
+ } catch (err) {
39
+ const error =
40
+ err instanceof Error ? err : new Error('Failed to approve order')
41
+ setError(error)
42
+ setLoading(false)
43
+ throw error
44
+ }
45
+ }
46
+
47
+ return {
48
+ approveOrder,
49
+ data,
50
+ error,
51
+ loading,
52
+ }
53
+ }