@faststore/core 3.44.1 → 3.45.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.
- package/.next/BUILD_ID +1 -1
- package/.next/build-manifest.json +122 -57
- package/.next/cache/.tsbuildinfo +1 -1
- package/.next/cache/config.json +3 -3
- package/.next/cache/webpack/client-production/0.pack +0 -0
- package/.next/cache/webpack/client-production/index.pack +0 -0
- package/.next/cache/webpack/server-production/0.pack +0 -0
- package/.next/cache/webpack/server-production/index.pack +0 -0
- package/.next/prerender-manifest.js +1 -1
- package/.next/prerender-manifest.json +1 -1
- package/.next/react-loadable-manifest.json +66 -74
- package/.next/routes-manifest.json +1 -1
- package/.next/server/chunks/129.js +1 -0
- package/.next/server/chunks/1506.js +1 -1
- package/.next/server/chunks/1999.js +1 -0
- package/.next/server/chunks/2091.js +1 -0
- package/.next/server/chunks/2230.js +1 -0
- package/.next/server/chunks/2773.js +1 -0
- package/.next/server/chunks/2880.js +1 -1
- package/.next/server/chunks/3006.js +1 -0
- package/.next/server/chunks/4289.js +2 -2
- package/.next/server/chunks/4559.js +16 -3
- package/.next/server/chunks/4746.js +1 -1
- package/.next/server/chunks/5636.js +2 -0
- package/.next/server/chunks/5772.js +1 -0
- package/.next/server/chunks/6594.js +1 -1
- package/.next/server/chunks/674.js +1 -1
- package/.next/server/chunks/7228.js +1 -1
- package/.next/server/chunks/8038.js +1 -0
- package/.next/server/chunks/804.js +1 -1
- package/.next/server/chunks/8307.js +1 -0
- package/.next/server/chunks/831.js +1 -1
- package/.next/server/chunks/8562.js +1 -1
- package/.next/server/chunks/8646.js +1 -1
- package/.next/server/chunks/9559.js +9 -0
- package/.next/server/chunks/9664.js +1 -0
- package/.next/server/chunks/UIBannerText.js +1 -1
- package/.next/server/functions-config-manifest.json +1 -1
- package/.next/server/middleware-build-manifest.js +1 -1
- package/.next/server/middleware-react-loadable-manifest.js +1 -1
- package/.next/server/pages/404.js +1 -1
- package/.next/server/pages/404.js.nft.json +1 -1
- package/.next/server/pages/500.js +1 -1
- package/.next/server/pages/500.js.nft.json +1 -1
- package/.next/server/pages/[...slug].js +1 -1
- package/.next/server/pages/[...slug].js.nft.json +1 -1
- package/.next/server/pages/[slug]/p.js +1 -1
- package/.next/server/pages/[slug]/p.js.nft.json +1 -1
- package/.next/server/pages/_app.js.nft.json +1 -1
- package/.next/server/pages/_document.js.nft.json +1 -1
- package/.next/server/pages/_error.js.nft.json +1 -1
- package/.next/server/pages/account/403.js +1 -0
- package/.next/server/pages/account/403.js.nft.json +1 -0
- package/.next/server/pages/account/404.js +1 -0
- package/.next/server/pages/account/404.js.nft.json +1 -0
- package/.next/server/pages/account/[...unknown].js +1 -0
- package/.next/server/pages/account/[...unknown].js.nft.json +1 -0
- package/.next/server/pages/account/orders/[id].js +1 -0
- package/.next/server/pages/account/orders/[id].js.nft.json +1 -0
- package/.next/server/pages/account/orders.js +1 -0
- package/.next/server/pages/account/orders.js.nft.json +1 -0
- package/.next/server/pages/account/profile.js +1 -1
- package/.next/server/pages/account/profile.js.nft.json +1 -1
- package/.next/server/pages/account/security.js +1 -0
- package/.next/server/pages/account/security.js.nft.json +1 -0
- package/.next/server/pages/account/user-details.js +1 -0
- package/.next/server/pages/account/user-details.js.nft.json +1 -0
- package/.next/server/pages/account.js +1 -1
- package/.next/server/pages/account.js.nft.json +1 -1
- package/.next/server/pages/api/graphql.js +2 -2
- package/.next/server/pages/api/graphql.js.nft.json +1 -1
- package/.next/server/pages/api/health/live.js.nft.json +1 -1
- package/.next/server/pages/api/health/ready.js.nft.json +1 -1
- package/.next/server/pages/api/preview.js +1 -1
- package/.next/server/pages/api/preview.js.nft.json +1 -1
- package/.next/server/pages/checkout.js +1 -1
- package/.next/server/pages/checkout.js.nft.json +1 -1
- package/.next/server/pages/en-US/404.html +2 -2
- package/.next/server/pages/en-US/500.html +2 -2
- package/.next/server/pages/en-US/account/403.html +28 -0
- package/.next/server/pages/en-US/account/403.json +1 -0
- package/.next/server/pages/en-US/account/404.html +28 -0
- package/.next/server/pages/en-US/account/404.json +1 -0
- package/.next/server/pages/en-US/checkout.html +2 -2
- package/.next/server/pages/en-US/login.html +2 -2
- package/.next/server/pages/en-US/s.html +2 -2
- package/.next/server/pages/en-US.html +2 -2
- package/.next/server/pages/index.js +1 -1
- package/.next/server/pages/index.js.nft.json +1 -1
- package/.next/server/pages/login.js +1 -1
- package/.next/server/pages/login.js.nft.json +1 -1
- package/.next/server/pages/s.js +1 -1
- package/.next/server/pages/s.js.nft.json +1 -1
- package/.next/server/pages-manifest.json +1 -1
- package/.next/static/chunks/{1552.8751332da83cadc5.js → 1552.2705dd1ff3aee879.js} +1 -1
- package/.next/static/chunks/4349-e6912711a345e5b6.js +1 -0
- package/.next/static/chunks/4625-a77d5db94b3a2b8f.js +1 -0
- package/.next/static/chunks/4746.f94ab461c31311bb.js +1 -0
- package/.next/static/chunks/4774.0450cb0efbfe76f4.js +1 -0
- package/.next/static/chunks/5836.92639eae2107d7af.js +1 -0
- package/.next/static/chunks/630.a3bf6c7cd8c945e1.js +6 -0
- package/.next/static/chunks/6335-580edc7c2c0fb418.js +1 -0
- package/.next/static/chunks/{2004.a778e11dd3802b72.js → 6410.bd3fa399df59cc80.js} +1 -1
- package/.next/static/chunks/6536.be112cd4a3efe253.js +1 -0
- package/.next/static/chunks/6867.27c1cb57ed76dd02.js +1 -0
- package/.next/static/chunks/7498-9b4ed9d4a65914cc.js +1 -0
- package/.next/static/chunks/7959.df78bb2e81b8d29c.js +1 -0
- package/.next/static/chunks/{9.89f24163370f3a22.js → 9.1db9e34673fbd5c9.js} +1 -1
- package/.next/static/chunks/9540.19d844fec8517602.js +1 -0
- package/.next/static/chunks/{1418-e86227bcf9a5d486.js → 9770-6f30493e3f7ab51b.js} +3 -3
- package/.next/static/chunks/BannerNewsletter.3031c9944928c34a.js +1 -0
- package/.next/static/chunks/BannerText.ca4ae220fed6bdd6.js +1 -0
- package/.next/static/chunks/CartSidebar.3d23093834f2c79a.js +1 -0
- package/.next/static/chunks/{Dropdown.7fe839c5ffce4687.js → Dropdown.534482865327310f.js} +1 -1
- package/.next/static/chunks/{DropdownButton.3991a37657e1d194.js → DropdownButton.90e7cb14e5866e74.js} +1 -1
- package/.next/static/chunks/{DropdownItem.0b3c39f881ca0832.js → DropdownItem.e74df13f69f8c3aa.js} +1 -1
- package/.next/static/chunks/{DropdownMenu.943b2d11ffa50ff6.js → DropdownMenu.56cde48e9fbbefe5.js} +1 -1
- package/.next/static/chunks/{Footer.1f83637df0884013.js → Footer.4bb5645e731073e7.js} +1 -1
- package/.next/static/chunks/Newsletter.f87cd1eca34af5e1.js +1 -0
- package/.next/static/chunks/ProductShelf.9b64813b3d1f4c9a.js +1 -0
- package/.next/static/chunks/ProductTiles.ebf02b46a32f5a53.js +1 -0
- package/.next/static/chunks/RegionModal.cdf4facd086a88e0.js +1 -0
- package/.next/static/chunks/Toast.fbfeced8149ed940.js +1 -0
- package/.next/static/chunks/{UIBannerText.45cf608e46cde628.js → UIBannerText.ef0582cb5cb01720.js} +1 -1
- package/.next/static/chunks/UISKUMatrixSidebar.64a50464062c77e9.js +1 -0
- package/.next/static/chunks/UIToast.22fea5cca8ee2b21.js +1 -0
- package/.next/static/chunks/pages/{404-6300c433469b7262.js → 404-e89b928faf6b9125.js} +1 -1
- package/.next/static/chunks/pages/{500-2d1dd344c8a8827f.js → 500-604704ba70e1e80a.js} +1 -1
- package/.next/static/chunks/pages/[...slug]-f80d7d8c8c7948a4.js +1 -0
- package/.next/static/chunks/pages/[slug]/p-748d6a1dbe59a2c8.js +1 -0
- package/.next/static/chunks/pages/_app-1be58ebde3e0b964.js +1 -0
- package/.next/static/chunks/pages/account/403-e4e6145815eeef01.js +1 -0
- package/.next/static/chunks/pages/account/404-ecfebfad41d655e9.js +1 -0
- package/.next/static/chunks/pages/account/[...unknown]-b233f92b64bd80cb.js +1 -0
- package/.next/static/chunks/pages/account/orders/[id]-8ab11c6c528911e9.js +1 -0
- package/.next/static/chunks/pages/account/orders-41bc5ef76c592a64.js +1 -0
- package/.next/static/chunks/pages/account/profile-2f501aabce910508.js +1 -0
- package/.next/static/chunks/pages/account/security-10e9e41318110950.js +1 -0
- package/.next/static/chunks/pages/account/user-details-5a7f30c290c25ec9.js +1 -0
- package/.next/static/chunks/pages/{checkout-93b647fc45454d97.js → checkout-cf3d3c3669a5e50b.js} +1 -1
- package/.next/static/chunks/pages/{index-07bc320fc045538c.js → index-e79b4e1ce52a8ea0.js} +1 -1
- package/.next/static/chunks/pages/{login-2454f1cd309c27d2.js → login-013b1f7a2b4bb9e0.js} +1 -1
- package/.next/static/chunks/pages/s-deeb7a0bdb02aaa9.js +1 -0
- package/.next/static/chunks/webpack-72d55466bef693ae.js +1 -0
- package/.next/static/css/2557aa3eaecf6ef0.css +1 -0
- package/.next/static/css/5347dbc8b71de47d.css +1 -0
- package/.next/static/css/84d35f475d0dc928.css +1 -0
- package/.next/static/css/9d1abf05f9ffaf8f.css +1 -0
- package/.next/static/css/b7bba8fce075688b.css +1 -0
- package/.next/static/css/{b8945ac5f5327c34.css → ec42ef906960d09f.css} +1 -1
- package/.next/static/iXgIvAYuYuXvEl83Xy7jT/_buildManifest.js +1 -0
- package/.next/static/iXgIvAYuYuXvEl83Xy7jT/_ssgManifest.js +1 -0
- package/.next/trace +129 -112
- package/.turbo/turbo-build.log +40 -30
- package/.turbo/turbo-test.log +5 -5
- package/@generated/gql.ts +34 -2
- package/@generated/graphql.ts +1566 -2
- package/@generated/persisted-documents.json +4 -1
- package/@generated/schema.graphql +748 -0
- package/CHANGELOG.md +12 -0
- package/discovery.config.default.js +1 -1
- package/package.json +7 -8
- package/public/icons.svg +106 -0
- package/src/components/account/MyAccountDrawer/OrganizationDrawer/OrganizationDrawer.tsx +68 -0
- package/src/components/account/MyAccountDrawer/OrganizationDrawer/OrganizationDrawerBody.tsx +21 -0
- package/src/components/account/MyAccountDrawer/OrganizationDrawer/OrganizationDrawerHeader.tsx +39 -0
- package/src/components/account/MyAccountDrawer/OrganizationDrawer/index.ts +3 -0
- package/src/components/account/MyAccountDrawer/OrganizationDrawer/section.module.scss +121 -0
- package/src/components/account/MyAccountDrawer/OrganizationSignInButton/OrganizationSignInButton.tsx +50 -0
- package/src/components/account/MyAccountDrawer/OrganizationSignInButton/index.ts +1 -0
- package/src/components/account/MyAccountDrawer/ProfileSummary/ProfileSummary.tsx +67 -0
- package/src/components/account/MyAccountDrawer/ProfileSummary/profile-summary.scss +91 -0
- package/src/components/account/MyAccountLayout/MyAccountLayout.tsx +2 -2
- package/src/components/account/MyAccountLayout/styles.scss +8 -4
- package/src/components/account/MyAccountMenu/styles.scss +3 -2
- package/src/components/account/components/BottomSheet/BottomSheet.tsx +58 -0
- package/src/components/account/components/BottomSheet/styles.scss +35 -0
- package/src/components/account/components/MyAccountAccordion/MyAccountAccordion.tsx +13 -0
- package/src/components/account/components/MyAccountAccordion/MyAccountAccordionButton.tsx +35 -0
- package/src/components/account/components/MyAccountAccordion/MyAccountAccordionItem.tsx +21 -0
- package/src/components/account/components/MyAccountAccordion/MyAccountAccordionPanel.tsx +16 -0
- package/src/components/account/components/MyAccountAccordion/index.ts +4 -0
- package/src/components/account/components/MyAccountAccordion/styles.scss +88 -0
- package/src/components/account/components/MyAccountCard/MyAccountCard.tsx +13 -0
- package/src/components/account/components/MyAccountCard/index.ts +1 -0
- package/src/components/account/components/MyAccountCard/styles.scss +23 -0
- package/src/components/account/components/MyAccountStatusBadge/MyAccountStatusBadge.tsx +28 -0
- package/src/components/account/components/MyAccountStatusBadge/index.ts +1 -0
- package/src/components/account/components/MyAccountStatusBadge/styles.scss +54 -0
- package/src/components/account/orders/MyAccountListOrders/MyAccountFilterSlider/MyAccountFilterFacetDateRange/MyAccountFilterFacetDateRange.tsx +113 -0
- package/src/components/account/orders/MyAccountListOrders/MyAccountFilterSlider/MyAccountFilterFacetDateRange/index.ts +2 -0
- package/src/components/account/orders/MyAccountListOrders/MyAccountFilterSlider/MyAccountFilterFacetDateRange/styles.scss +43 -0
- package/src/components/account/orders/MyAccountListOrders/MyAccountFilterSlider/MyAccountFilterSlider.tsx +209 -0
- package/src/components/account/orders/MyAccountListOrders/MyAccountFilterSlider/index.ts +1 -0
- package/src/components/account/orders/MyAccountListOrders/MyAccountFilterSlider/section.module.scss +24 -0
- package/src/components/account/orders/MyAccountListOrders/MyAccountListOrders.tsx +296 -0
- package/src/components/account/orders/MyAccountListOrders/MyAccountListOrdersEmptyState/MyAccountListOrdersEmptyState.tsx +20 -0
- package/src/components/account/orders/MyAccountListOrders/MyAccountListOrdersEmptyState/index.ts +1 -0
- package/src/components/account/orders/MyAccountListOrders/MyAccountListOrdersEmptyState/styles.scss +43 -0
- package/src/components/account/orders/MyAccountListOrders/MyAccountListOrdersTable/MyAccountListOrdersTable.tsx +210 -0
- package/src/components/account/orders/MyAccountListOrders/MyAccountListOrdersTable/index.ts +1 -0
- package/src/components/account/orders/MyAccountListOrders/MyAccountListOrdersTable/styles.scss +153 -0
- package/src/components/account/orders/MyAccountListOrders/MyAccountSelectedTags/MyAccountSelectedTags.tsx +119 -0
- package/src/components/account/orders/MyAccountListOrders/MyAccountSelectedTags/index.ts +1 -0
- package/src/components/account/orders/MyAccountListOrders/MyAccountSelectedTags/styles.scss +69 -0
- package/src/components/account/orders/MyAccountListOrders/index.ts +1 -0
- package/src/components/account/orders/MyAccountListOrders/styles.module.scss +100 -0
- package/src/components/account/orders/MyAccountOrderDetails/MyAccountDeliveryCard/MyAccountDeliveryCard.tsx +47 -0
- package/src/components/account/orders/MyAccountOrderDetails/MyAccountDeliveryCard/index.ts +1 -0
- package/src/components/account/orders/MyAccountOrderDetails/MyAccountDeliveryCard/styles.scss +44 -0
- package/src/components/account/orders/MyAccountOrderDetails/MyAccountDeliveryOptionAccordion/MyAccountDeliveryOptionAccordion.tsx +93 -0
- package/src/components/account/orders/MyAccountOrderDetails/MyAccountDeliveryOptionAccordion/MyAccountDeliveryOptionAccordionDeliveryInfo.tsx +86 -0
- package/src/components/account/orders/MyAccountOrderDetails/MyAccountDeliveryOptionAccordion/MyAccountDeliveryOptionAccordionProducts.tsx +74 -0
- package/src/components/account/orders/MyAccountOrderDetails/MyAccountDeliveryOptionAccordion/index.ts +6 -0
- package/src/components/account/orders/MyAccountOrderDetails/MyAccountDeliveryOptionAccordion/styles.scss +193 -0
- package/src/components/account/orders/MyAccountOrderDetails/MyAccountMoreInformationCard/MyAccountMoreInformationCard.tsx +31 -0
- package/src/components/account/orders/MyAccountOrderDetails/MyAccountMoreInformationCard/index.ts +1 -0
- package/src/components/account/orders/MyAccountOrderDetails/MyAccountMoreInformationCard/styles.scss +22 -0
- package/src/components/account/orders/MyAccountOrderDetails/MyAccountOrderActionModal/MyAccountOrderActionModal.tsx +121 -0
- package/src/components/account/orders/MyAccountOrderDetails/MyAccountOrderActionModal/index.ts +2 -0
- package/src/components/account/orders/MyAccountOrderDetails/MyAccountOrderActionModal/styles.module.scss +40 -0
- package/src/components/account/orders/MyAccountOrderDetails/MyAccountOrderActionModal/useOrderActionModal.ts +38 -0
- package/src/components/account/orders/MyAccountOrderDetails/MyAccountOrderActions/MyAccountOrderActions.tsx +154 -0
- package/src/components/account/orders/MyAccountOrderDetails/MyAccountOrderActions/index.ts +1 -0
- package/src/components/account/orders/MyAccountOrderDetails/MyAccountOrderActions/styles.scss +33 -0
- package/src/components/account/orders/MyAccountOrderDetails/MyAccountOrderDetails.tsx +106 -0
- package/src/components/account/orders/MyAccountOrderDetails/MyAccountOrderedByCard/MyAccountOrderedByCard.tsx +54 -0
- package/src/components/account/orders/MyAccountOrderDetails/MyAccountOrderedByCard/index.ts +1 -0
- package/src/components/account/orders/MyAccountOrderDetails/MyAccountOrderedByCard/styles.scss +65 -0
- package/src/components/account/orders/MyAccountOrderDetails/MyAccountPaymentCard/MyAccountPaymentCard.tsx +157 -0
- package/src/components/account/orders/MyAccountOrderDetails/MyAccountPaymentCard/MyAccountPaymentFlagsIcon.tsx +106 -0
- package/src/components/account/orders/MyAccountOrderDetails/MyAccountPaymentCard/index.ts +1 -0
- package/src/components/account/orders/MyAccountOrderDetails/MyAccountPaymentCard/styles.scss +76 -0
- package/src/components/account/orders/MyAccountOrderDetails/MyAccountStatusCard/MyAccountStatusCard.tsx +276 -0
- package/src/components/account/orders/MyAccountOrderDetails/MyAccountStatusCard/index.ts +1 -0
- package/src/components/account/orders/MyAccountOrderDetails/MyAccountStatusCard/styles.scss +205 -0
- package/src/components/account/orders/MyAccountOrderDetails/MyAccountStatusCard/useConnectorPositioning.ts +74 -0
- package/src/components/account/orders/MyAccountOrderDetails/MyAccountSummaryCard/MyAccountSummaryCard.tsx +92 -0
- package/src/components/account/orders/MyAccountOrderDetails/MyAccountSummaryCard/index.ts +1 -0
- package/src/components/account/orders/MyAccountOrderDetails/MyAccountSummaryCard/styles.scss +45 -0
- package/src/components/account/orders/MyAccountOrderDetails/index.ts +1 -0
- package/src/components/account/orders/MyAccountOrderDetails/section.module.scss +114 -0
- package/src/components/account/utils/useFormatPrice.ts +18 -0
- package/src/components/cms/RenderSections.tsx +1 -1
- package/src/components/navigation/Navbar/Navbar.tsx +16 -1
- package/src/components/navigation/NavbarSlider/NavbarSlider.tsx +18 -3
- package/src/customizations/src/myAccount/extensions/orders/[id]/after.tsx +7 -0
- package/src/customizations/src/myAccount/extensions/orders/[id]/before.tsx +7 -0
- package/src/customizations/src/myAccount/extensions/orders/after.tsx +7 -0
- package/src/customizations/src/myAccount/extensions/orders/before.tsx +7 -0
- package/src/customizations/src/myAccount/extensions/profile/after.tsx +7 -0
- package/src/customizations/src/myAccount/extensions/profile/before.tsx +7 -0
- package/src/customizations/src/myAccount/extensions/security/after.tsx +7 -0
- package/src/customizations/src/myAccount/extensions/security/before.tsx +7 -0
- package/src/customizations/src/myAccount/extensions/user-details/after.tsx +7 -0
- package/src/customizations/src/myAccount/extensions/user-details/before.tsx +7 -0
- package/src/experimental/myAccountSeverSideProps.ts +12 -1
- package/src/pages/account/403.tsx +103 -0
- package/src/pages/account/404.tsx +95 -0
- package/src/pages/account/[...unknown].tsx +39 -0
- package/src/pages/account/index.tsx +8 -16
- package/src/pages/account/orders/[id].tsx +764 -0
- package/src/pages/account/orders/index.tsx +273 -0
- package/src/pages/account/orders/styles.module.scss +35 -0
- package/src/pages/account/profile.tsx +62 -17
- package/src/pages/account/security.tsx +94 -0
- package/src/pages/account/user-details.tsx +94 -0
- package/src/sdk/account/getMyAccountRoutes.ts +13 -12
- package/src/sdk/account/useApproveOrder.ts +53 -0
- package/src/sdk/account/useCancelOrder.ts +34 -0
- package/src/sdk/account/useDebounce.ts +23 -0
- package/src/sdk/account/useRejectOrder.ts +53 -0
- package/src/sdk/error/MissingContentError/MissingContentError.ts +2 -2
- package/src/sdk/error/MultipleContentError/MultipleContentError.ts +2 -2
- package/src/sdk/search/useMyAccountFilter.ts +157 -0
- package/src/sdk/session/index.ts +8 -0
- package/src/utils/myAccountRedirect.tsx +36 -0
- package/src/utils/userOrderStatus.ts +141 -0
- package/src/utils/utilities.ts +35 -3
- package/test/server/index.test.ts +9 -1
- package/.next/server/chunks/1246.js +0 -1
- package/.next/server/chunks/2443.js +0 -1
- package/.next/server/chunks/4725.js +0 -1
- package/.next/server/chunks/563.js +0 -1
- package/.next/server/chunks/6968.js +0 -10
- package/.next/server/chunks/7468.js +0 -1
- package/.next/server/chunks/8355.js +0 -1
- package/.next/static/chunks/1173.ca14a5bc4e1264f4.js +0 -1
- package/.next/static/chunks/2206.44239ce81a09bc17.js +0 -1
- package/.next/static/chunks/4349-87a956a73b97519c.js +0 -1
- package/.next/static/chunks/4625-553d20c86b0ca577.js +0 -1
- package/.next/static/chunks/4746.2e16ec0663a3873f.js +0 -1
- package/.next/static/chunks/4774.8e70c01dcd0ed4b3.js +0 -1
- package/.next/static/chunks/4865.4017be0f8e7c8cf0.js +0 -1
- package/.next/static/chunks/5259-90f7ef92cf24e49a.js +0 -1
- package/.next/static/chunks/5836.c5c244a8cbfa7f7d.js +0 -1
- package/.next/static/chunks/630.13d3dd939b789798.js +0 -6
- package/.next/static/chunks/6335-6eb4ff84af184b88.js +0 -1
- package/.next/static/chunks/6536.d5260107222db13c.js +0 -1
- package/.next/static/chunks/7498-72289e704e7c7056.js +0 -1
- package/.next/static/chunks/7959.7c721505286572c0.js +0 -1
- package/.next/static/chunks/BannerNewsletter.8982f42e60ed8828.js +0 -1
- package/.next/static/chunks/BannerText.5b250db1cf67e44f.js +0 -1
- package/.next/static/chunks/CartSidebar.aa9e43be37034654.js +0 -1
- package/.next/static/chunks/Newsletter.9db4df2d4fb33227.js +0 -1
- package/.next/static/chunks/ProductShelf.9cea36116836c161.js +0 -1
- package/.next/static/chunks/ProductTiles.059a4a6360e1d4ea.js +0 -1
- package/.next/static/chunks/RegionModal.4594b707a1092551.js +0 -1
- package/.next/static/chunks/Toast.01d4ac8bf14c1be5.js +0 -1
- package/.next/static/chunks/UIButton.3186f933c0ecfb31.js +0 -1
- package/.next/static/chunks/UISKUMatrixSidebar.9ac3980a60cfc358.js +0 -1
- package/.next/static/chunks/UIToast.221eb10681d2f642.js +0 -1
- package/.next/static/chunks/pages/[...slug]-c1a62d58f5940747.js +0 -1
- package/.next/static/chunks/pages/[slug]/p-555dc09a5e78260e.js +0 -1
- package/.next/static/chunks/pages/_app-d5641120092ee13b.js +0 -1
- package/.next/static/chunks/pages/account/profile-23b2e9fbbd95a30b.js +0 -1
- package/.next/static/chunks/pages/s-9901e6857f517b8b.js +0 -1
- package/.next/static/chunks/webpack-11f8d9f83a4d695c.js +0 -1
- package/.next/static/css/249b9deaabc0d32d.css +0 -1
- package/.next/static/f3BfFJ3uIpcQCIGQ6fQQ4/_buildManifest.js +0 -1
- package/.next/static/f3BfFJ3uIpcQCIGQ6fQQ4/_ssgManifest.js +0 -1
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
import { InputField } from '@faststore/ui'
|
|
2
|
+
import { forwardRef, useImperativeHandle, useRef, useState } from 'react'
|
|
3
|
+
|
|
4
|
+
export interface MyAccountFilterFacetDateRangeProps {
|
|
5
|
+
/**
|
|
6
|
+
* The from value of the Range Facet
|
|
7
|
+
*/
|
|
8
|
+
from: string
|
|
9
|
+
/**
|
|
10
|
+
* The to value of the Range Facet
|
|
11
|
+
*/
|
|
12
|
+
to: string
|
|
13
|
+
/**
|
|
14
|
+
* The function to be called when the date range changes
|
|
15
|
+
*/
|
|
16
|
+
setDisabled: (disabled: boolean) => void
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
const MyAccountFilterFacetDateRange = forwardRef<
|
|
20
|
+
{
|
|
21
|
+
clear: () => void
|
|
22
|
+
getDataRangeFacet: () => {
|
|
23
|
+
key: string
|
|
24
|
+
value: { from: string; to: string }
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
MyAccountFilterFacetDateRangeProps
|
|
28
|
+
>(({ to, from, setDisabled }, ref) => {
|
|
29
|
+
const inputFromRef = useRef<HTMLInputElement>(null)
|
|
30
|
+
const inputToRef = useRef<HTMLInputElement>(null)
|
|
31
|
+
const [inputFromError, setInputFromError] = useState<string>()
|
|
32
|
+
const [inputToError, setInputToError] = useState<string>()
|
|
33
|
+
|
|
34
|
+
const [dateRange, setDateRange] = useState<{ from: string; to: string }>({
|
|
35
|
+
from,
|
|
36
|
+
to,
|
|
37
|
+
})
|
|
38
|
+
|
|
39
|
+
function onEnd(value: { from: string; to: string }) {
|
|
40
|
+
if (!value.from || !value.to) {
|
|
41
|
+
setInputFromError(undefined)
|
|
42
|
+
setInputToError(undefined)
|
|
43
|
+
setDisabled(false)
|
|
44
|
+
return
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
if (new Date(value.from) > new Date(value.to)) {
|
|
48
|
+
setInputFromError('Invalid date range')
|
|
49
|
+
setDisabled(true)
|
|
50
|
+
} else {
|
|
51
|
+
setInputFromError(undefined)
|
|
52
|
+
setInputToError(undefined)
|
|
53
|
+
setDisabled(false)
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
function onChangeInputFrom(value: string) {
|
|
58
|
+
setDateRange({ ...dateRange, from: String(value) })
|
|
59
|
+
onEnd?.({ ...dateRange, from: String(value) })
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
function onChangeInputTo(value: string) {
|
|
63
|
+
setDateRange({ ...dateRange, to: String(value) })
|
|
64
|
+
onEnd?.({ ...dateRange, to: String(value) })
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
useImperativeHandle(ref, () => ({
|
|
68
|
+
clear: () => {
|
|
69
|
+
setInputFromError(undefined)
|
|
70
|
+
setInputToError(undefined)
|
|
71
|
+
setDateRange({ from: '', to: '' })
|
|
72
|
+
if (inputFromRef.current) inputFromRef.current.value = ''
|
|
73
|
+
if (inputToRef.current) inputToRef.current.value = ''
|
|
74
|
+
},
|
|
75
|
+
getDataRangeFacet: () => {
|
|
76
|
+
return {
|
|
77
|
+
key: 'dateRange',
|
|
78
|
+
value: dateRange,
|
|
79
|
+
}
|
|
80
|
+
},
|
|
81
|
+
}))
|
|
82
|
+
|
|
83
|
+
return (
|
|
84
|
+
<div data-fs-list-orders-filters-date-range>
|
|
85
|
+
<div data-fs-list-orders-filters-date-range-inputs>
|
|
86
|
+
<InputField
|
|
87
|
+
id="date-range-from"
|
|
88
|
+
label="From"
|
|
89
|
+
type="date"
|
|
90
|
+
inputMode="text"
|
|
91
|
+
error={inputFromError}
|
|
92
|
+
inputRef={inputFromRef}
|
|
93
|
+
value={dateRange.from}
|
|
94
|
+
onChange={(e) => onChangeInputFrom(e.target.value)}
|
|
95
|
+
onBlur={() => !inputFromError && onEnd?.(dateRange)}
|
|
96
|
+
/>
|
|
97
|
+
<InputField
|
|
98
|
+
id="date-range-to"
|
|
99
|
+
label="To"
|
|
100
|
+
type="date"
|
|
101
|
+
inputMode="text"
|
|
102
|
+
error={inputToError}
|
|
103
|
+
inputRef={inputToRef}
|
|
104
|
+
value={dateRange.to}
|
|
105
|
+
onChange={(e) => onChangeInputTo(e.target.value)}
|
|
106
|
+
onBlur={() => !inputToError && onEnd?.(dateRange)}
|
|
107
|
+
/>
|
|
108
|
+
</div>
|
|
109
|
+
</div>
|
|
110
|
+
)
|
|
111
|
+
})
|
|
112
|
+
|
|
113
|
+
export default MyAccountFilterFacetDateRange
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
[data-fs-list-orders-filters-date-range] {
|
|
2
|
+
// --------------------------------------------------------
|
|
3
|
+
// Design Tokens
|
|
4
|
+
// --------------------------------------------------------
|
|
5
|
+
|
|
6
|
+
--fs-list-orders-filters-date-range-width: 100%;
|
|
7
|
+
--fs-list-orders-filters-date-range-input-width: 50%;
|
|
8
|
+
|
|
9
|
+
// --------------------------------------------------------
|
|
10
|
+
// Structural Styles
|
|
11
|
+
// --------------------------------------------------------
|
|
12
|
+
|
|
13
|
+
width: var(--fs-list-orders-filters-date-range-width);
|
|
14
|
+
|
|
15
|
+
[data-fs-list-orders-filters-date-range-inputs] {
|
|
16
|
+
display: flex;
|
|
17
|
+
|
|
18
|
+
[data-fs-input-field] {
|
|
19
|
+
width: var(--fs-list-orders-filters-date-range-input-width);
|
|
20
|
+
|
|
21
|
+
[data-fs-input]:hover,
|
|
22
|
+
[data-fs-input]:focus-visible,
|
|
23
|
+
[data-fs-input]:focus {
|
|
24
|
+
z-index: 1;
|
|
25
|
+
+ label { z-index: 1; }
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
&:first-of-type {
|
|
29
|
+
margin-right: -1px;
|
|
30
|
+
|
|
31
|
+
[data-fs-input] {
|
|
32
|
+
border-top-right-radius: 0;
|
|
33
|
+
border-bottom-right-radius: 0;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
&:last-of-type [data-fs-input] {
|
|
38
|
+
border-top-left-radius: 0;
|
|
39
|
+
border-bottom-left-radius: 0;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}
|
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+
import {
|
|
2
|
+
type SearchInputFieldRef,
|
|
3
|
+
Filter as UIFilter,
|
|
4
|
+
FilterFacetBoolean as UIFilterFacetBoolean,
|
|
5
|
+
FilterFacetBooleanItem as UIFilterFacetBooleanItem,
|
|
6
|
+
FilterFacets as UIFilterFacets,
|
|
7
|
+
FilterSlider as UIFilterSlider,
|
|
8
|
+
} from '@faststore/ui'
|
|
9
|
+
|
|
10
|
+
import router from 'next/router'
|
|
11
|
+
import { type MutableRefObject, useRef, useState } from 'react'
|
|
12
|
+
import type {
|
|
13
|
+
MyAccountFilter_FacetsFragment,
|
|
14
|
+
useMyAccountFilter,
|
|
15
|
+
} from 'src/sdk/search/useMyAccountFilter'
|
|
16
|
+
import FilterFacetDateRange from './MyAccountFilterFacetDateRange'
|
|
17
|
+
import styles from './section.module.scss'
|
|
18
|
+
|
|
19
|
+
export interface FilterSliderProps {
|
|
20
|
+
/**
|
|
21
|
+
* ID to find this component in testing tools (e.g.: cypress,
|
|
22
|
+
* testing-library, and jest).
|
|
23
|
+
*/
|
|
24
|
+
testId?: string
|
|
25
|
+
/**
|
|
26
|
+
* The array that represents the details of every facet.
|
|
27
|
+
*/
|
|
28
|
+
facets: MyAccountFilter_FacetsFragment[]
|
|
29
|
+
/**
|
|
30
|
+
* Title for the `Filter` component.
|
|
31
|
+
*/
|
|
32
|
+
title?: string
|
|
33
|
+
/**
|
|
34
|
+
* Defined label for the clear button component.
|
|
35
|
+
*/
|
|
36
|
+
clearButtonLabel?: string
|
|
37
|
+
/**
|
|
38
|
+
* Defined label for the apply button component.
|
|
39
|
+
*/
|
|
40
|
+
applyButtonLabel?: string
|
|
41
|
+
/**
|
|
42
|
+
* Ref to the search input field.
|
|
43
|
+
*/
|
|
44
|
+
searchInputRef?: MutableRefObject<SearchInputFieldRef>
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
function MyAccountFilterSlider({
|
|
48
|
+
facets,
|
|
49
|
+
testId,
|
|
50
|
+
dispatch,
|
|
51
|
+
expanded,
|
|
52
|
+
selected,
|
|
53
|
+
title,
|
|
54
|
+
clearButtonLabel,
|
|
55
|
+
applyButtonLabel,
|
|
56
|
+
searchInputRef,
|
|
57
|
+
}: FilterSliderProps & ReturnType<typeof useMyAccountFilter>) {
|
|
58
|
+
const dateRangeInputRef = useRef<{
|
|
59
|
+
clear: () => void
|
|
60
|
+
getDataRangeFacet: () => {
|
|
61
|
+
key: string
|
|
62
|
+
value: { from: string; to: string }
|
|
63
|
+
}
|
|
64
|
+
}>(null)
|
|
65
|
+
|
|
66
|
+
const [disabled, setDisabled] = useState(false)
|
|
67
|
+
|
|
68
|
+
const handleFilterChange = ({
|
|
69
|
+
selectedFacets,
|
|
70
|
+
text,
|
|
71
|
+
}: {
|
|
72
|
+
selectedFacets: {
|
|
73
|
+
key: string
|
|
74
|
+
value: string
|
|
75
|
+
}[]
|
|
76
|
+
text: string
|
|
77
|
+
}) => {
|
|
78
|
+
const facets = selectedFacets.reduce(
|
|
79
|
+
(acc, facet) => {
|
|
80
|
+
const { key, value } = facet
|
|
81
|
+
if (key === 'dateInitial') {
|
|
82
|
+
acc['dateInitial'] = value
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
if (key === 'dateFinal') {
|
|
86
|
+
acc['dateFinal'] = value
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
if (key === 'status') {
|
|
90
|
+
acc['status'] = Array.isArray(acc['status'])
|
|
91
|
+
? [...acc['status'], value]
|
|
92
|
+
: [value]
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
return acc
|
|
96
|
+
},
|
|
97
|
+
{} as Record<string, string | string[]>
|
|
98
|
+
)
|
|
99
|
+
|
|
100
|
+
router.push({
|
|
101
|
+
pathname: '/account/orders',
|
|
102
|
+
query: {
|
|
103
|
+
...(text ? { text } : {}),
|
|
104
|
+
...facets,
|
|
105
|
+
},
|
|
106
|
+
})
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
return (
|
|
110
|
+
<UIFilterSlider
|
|
111
|
+
overlayProps={{
|
|
112
|
+
className: `section ${styles.section} section-filter-slider`,
|
|
113
|
+
}}
|
|
114
|
+
title={title}
|
|
115
|
+
size="partial"
|
|
116
|
+
direction="rightSide"
|
|
117
|
+
clearBtnProps={{
|
|
118
|
+
variant: 'secondary',
|
|
119
|
+
onClick: () => {
|
|
120
|
+
dateRangeInputRef.current?.clear()
|
|
121
|
+
dispatch({ type: 'selectFacets', payload: [] })
|
|
122
|
+
},
|
|
123
|
+
children: clearButtonLabel ?? 'Clear All',
|
|
124
|
+
}}
|
|
125
|
+
applyBtnProps={{
|
|
126
|
+
variant: 'primary',
|
|
127
|
+
onClick: () => {
|
|
128
|
+
const dateRangeFacet = dateRangeInputRef.current?.getDataRangeFacet()
|
|
129
|
+
|
|
130
|
+
const selectedFacets = [
|
|
131
|
+
...selected,
|
|
132
|
+
dateRangeFacet.value.from.trim()
|
|
133
|
+
? {
|
|
134
|
+
key: 'dateInitial',
|
|
135
|
+
value: dateRangeFacet.value.from,
|
|
136
|
+
}
|
|
137
|
+
: undefined,
|
|
138
|
+
dateRangeFacet.value.to.trim()
|
|
139
|
+
? {
|
|
140
|
+
key: 'dateFinal',
|
|
141
|
+
value: dateRangeFacet.value.to,
|
|
142
|
+
}
|
|
143
|
+
: undefined,
|
|
144
|
+
].filter(Boolean)
|
|
145
|
+
|
|
146
|
+
handleFilterChange({
|
|
147
|
+
selectedFacets,
|
|
148
|
+
text: searchInputRef.current?.inputRef.value,
|
|
149
|
+
})
|
|
150
|
+
},
|
|
151
|
+
disabled: disabled,
|
|
152
|
+
children: applyButtonLabel ?? 'Apply',
|
|
153
|
+
}}
|
|
154
|
+
onClose={() => {}}
|
|
155
|
+
>
|
|
156
|
+
<UIFilter
|
|
157
|
+
testId={`mobile-${testId}`}
|
|
158
|
+
indicesExpanded={expanded}
|
|
159
|
+
onAccordionChange={(index: number) =>
|
|
160
|
+
dispatch({ type: 'toggleExpanded', payload: index })
|
|
161
|
+
}
|
|
162
|
+
>
|
|
163
|
+
{facets.map((facet, index) => {
|
|
164
|
+
const { __typename: type, label } = facet
|
|
165
|
+
const isExpanded = expanded.has(index)
|
|
166
|
+
return (
|
|
167
|
+
<UIFilterFacets
|
|
168
|
+
key={`${testId}-${label}-${index}`}
|
|
169
|
+
testId={`mobile-${testId}`}
|
|
170
|
+
index={index}
|
|
171
|
+
type={type}
|
|
172
|
+
label={label}
|
|
173
|
+
>
|
|
174
|
+
{type === 'StoreFacetBoolean' && isExpanded && (
|
|
175
|
+
<UIFilterFacetBoolean>
|
|
176
|
+
{facet.values.map((item) => (
|
|
177
|
+
<UIFilterFacetBooleanItem
|
|
178
|
+
key={`${testId}-${facet.label}-${item.label}`}
|
|
179
|
+
id={`${testId}-${facet.label}-${item.label}`}
|
|
180
|
+
testId={`mobile-${testId}`}
|
|
181
|
+
onFacetChange={(facet) =>
|
|
182
|
+
dispatch({ type: 'toggleFacet', payload: facet })
|
|
183
|
+
}
|
|
184
|
+
selected={item.selected}
|
|
185
|
+
value={item.value}
|
|
186
|
+
quantity={item.quantity}
|
|
187
|
+
facetKey={facet.key}
|
|
188
|
+
label={item.label}
|
|
189
|
+
/>
|
|
190
|
+
))}
|
|
191
|
+
</UIFilterFacetBoolean>
|
|
192
|
+
)}
|
|
193
|
+
{type === 'StoreFacetRange' && isExpanded && (
|
|
194
|
+
<FilterFacetDateRange
|
|
195
|
+
ref={dateRangeInputRef}
|
|
196
|
+
from={facet.from}
|
|
197
|
+
to={facet.to}
|
|
198
|
+
setDisabled={setDisabled}
|
|
199
|
+
/>
|
|
200
|
+
)}
|
|
201
|
+
</UIFilterFacets>
|
|
202
|
+
)
|
|
203
|
+
})}
|
|
204
|
+
</UIFilter>
|
|
205
|
+
</UIFilterSlider>
|
|
206
|
+
)
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
export default MyAccountFilterSlider
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './MyAccountFilterSlider'
|
package/src/components/account/orders/MyAccountListOrders/MyAccountFilterSlider/section.module.scss
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
.section {
|
|
2
|
+
@import "@faststore/ui/src/components/atoms/Button/styles.scss";
|
|
3
|
+
@import "@faststore/ui/src/components/atoms/Badge/styles.scss";
|
|
4
|
+
@import "@faststore/ui/src/components/atoms/Checkbox/styles.scss";
|
|
5
|
+
@import "@faststore/ui/src/components/atoms/Icon/styles.scss";
|
|
6
|
+
@import "@faststore/ui/src/components/atoms/Input/styles.scss";
|
|
7
|
+
@import "@faststore/ui/src/components/atoms/Link/styles.scss";
|
|
8
|
+
@import "@faststore/ui/src/components/atoms/List/styles.scss";
|
|
9
|
+
@import "@faststore/ui/src/components/atoms/Slider/styles.scss";
|
|
10
|
+
@import "@faststore/ui/src/components/molecules/DiscountBadge/styles.scss";
|
|
11
|
+
@import "@faststore/ui/src/components/molecules/Accordion/styles.scss";
|
|
12
|
+
@import "@faststore/ui/src/components/molecules/InputField/styles.scss";
|
|
13
|
+
@import "@faststore/ui/src/components/molecules/Modal/styles.scss";
|
|
14
|
+
@import "@faststore/ui/src/components/molecules/SelectField/styles.scss";
|
|
15
|
+
@import "@faststore/ui/src/components/organisms/Filter/styles.scss";
|
|
16
|
+
@import "@faststore/ui/src/components/organisms/FilterSlider/styles.scss";
|
|
17
|
+
@import "@faststore/ui/src/components/organisms/SlideOver/styles.scss";
|
|
18
|
+
@import "./MyAccountFilterFacetDateRange/styles.scss";
|
|
19
|
+
|
|
20
|
+
[data-fs-badge] {
|
|
21
|
+
display: none;
|
|
22
|
+
visibility: hidden;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
@@ -0,0 +1,296 @@
|
|
|
1
|
+
import { useRef, type MutableRefObject } from 'react'
|
|
2
|
+
|
|
3
|
+
import type { ServerListOrdersQueryQuery } from '@generated/graphql'
|
|
4
|
+
import { useRouter } from 'next/router'
|
|
5
|
+
|
|
6
|
+
import {
|
|
7
|
+
Button,
|
|
8
|
+
Icon,
|
|
9
|
+
SearchInputField,
|
|
10
|
+
useUI,
|
|
11
|
+
type SearchInputFieldRef,
|
|
12
|
+
} from '@faststore/ui'
|
|
13
|
+
import { useEffect } from 'react'
|
|
14
|
+
import MyAccountFilterSlider from 'src/components/account/orders/MyAccountListOrders/MyAccountFilterSlider'
|
|
15
|
+
import { useDebounce } from 'src/sdk/account/useDebounce'
|
|
16
|
+
import {
|
|
17
|
+
useMyAccountFilter,
|
|
18
|
+
type MyAccountFilter_FacetsFragment,
|
|
19
|
+
type SelectedFacet,
|
|
20
|
+
} from 'src/sdk/search/useMyAccountFilter'
|
|
21
|
+
import useScreenResize from 'src/sdk/ui/useScreenResize'
|
|
22
|
+
import { FastStoreOrderStatus } from 'src/utils/userOrderStatus'
|
|
23
|
+
import MyAccountListOrdersEmptyState from './MyAccountListOrdersEmptyState'
|
|
24
|
+
import MyAccountListOrdersTable, {
|
|
25
|
+
Pagination,
|
|
26
|
+
} from './MyAccountListOrdersTable/MyAccountListOrdersTable'
|
|
27
|
+
import SelectedFiltersTags from './MyAccountSelectedTags/MyAccountSelectedTags'
|
|
28
|
+
import styles from './styles.module.scss'
|
|
29
|
+
|
|
30
|
+
export type MyAccountListOrdersProps = {
|
|
31
|
+
listOrders: ServerListOrdersQueryQuery['listUserOrders']
|
|
32
|
+
total: number
|
|
33
|
+
perPage: number
|
|
34
|
+
filters: {
|
|
35
|
+
page: number
|
|
36
|
+
status: string[]
|
|
37
|
+
dateInitial: string
|
|
38
|
+
dateFinal: string
|
|
39
|
+
text: string
|
|
40
|
+
clientEmail: string
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
function getSelectedFacets({
|
|
45
|
+
filters,
|
|
46
|
+
}: {
|
|
47
|
+
filters: MyAccountListOrdersProps['filters']
|
|
48
|
+
}): SelectedFacet[] {
|
|
49
|
+
return Object.keys(filters).reduce((acc, filter) => {
|
|
50
|
+
// FilterSlider does not deal with these filters
|
|
51
|
+
if (filter === 'page' || filter === 'text' || filter === 'clientEmail') {
|
|
52
|
+
return acc
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
const value = filters[filter as keyof typeof filters] as string | string[]
|
|
56
|
+
|
|
57
|
+
if (filter === 'status' && value.length > 0) {
|
|
58
|
+
const status = Array.isArray(value) ? value : [value]
|
|
59
|
+
acc.push(
|
|
60
|
+
...status.map((statusValue) => ({
|
|
61
|
+
key: 'status',
|
|
62
|
+
value: statusValue.toLowerCase(),
|
|
63
|
+
}))
|
|
64
|
+
)
|
|
65
|
+
} else if (filter === 'dateInitial' && value) {
|
|
66
|
+
acc.push({
|
|
67
|
+
key: 'dateInitial',
|
|
68
|
+
value: String(value),
|
|
69
|
+
})
|
|
70
|
+
} else if (filter === 'dateFinal' && value) {
|
|
71
|
+
acc.push({
|
|
72
|
+
key: 'dateFinal',
|
|
73
|
+
value: String(value),
|
|
74
|
+
})
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
return acc
|
|
78
|
+
}, [] as SelectedFacet[])
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
function getAllFacets({
|
|
82
|
+
filters,
|
|
83
|
+
}: {
|
|
84
|
+
filters: MyAccountListOrdersProps['filters']
|
|
85
|
+
}): MyAccountFilter_FacetsFragment[] {
|
|
86
|
+
return [
|
|
87
|
+
{
|
|
88
|
+
__typename: 'StoreFacetBoolean',
|
|
89
|
+
key: 'status',
|
|
90
|
+
label: 'Status',
|
|
91
|
+
values: FastStoreOrderStatus.map((status) => ({
|
|
92
|
+
label: status,
|
|
93
|
+
quantity: 0,
|
|
94
|
+
selected: false,
|
|
95
|
+
value: status.toLowerCase(),
|
|
96
|
+
})),
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
__typename: 'StoreFacetRange',
|
|
100
|
+
key: 'dateRange',
|
|
101
|
+
label: 'Order Date',
|
|
102
|
+
from: filters.dateInitial,
|
|
103
|
+
to: filters.dateFinal,
|
|
104
|
+
},
|
|
105
|
+
]
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
export default function MyAccountListOrders({
|
|
109
|
+
listOrders,
|
|
110
|
+
total,
|
|
111
|
+
perPage,
|
|
112
|
+
filters,
|
|
113
|
+
}: MyAccountListOrdersProps) {
|
|
114
|
+
const router = useRouter()
|
|
115
|
+
const { isDesktop } = useScreenResize()
|
|
116
|
+
const searchInputRef = useRef(null) as MutableRefObject<SearchInputFieldRef>
|
|
117
|
+
|
|
118
|
+
// Set the initial value of the search input field based on server values
|
|
119
|
+
useEffect(() => {
|
|
120
|
+
if (!searchInputRef.current?.inputRef) return
|
|
121
|
+
|
|
122
|
+
if (filters?.text && searchInputRef.current?.inputRef) {
|
|
123
|
+
searchInputRef.current.inputRef.value = filters.text
|
|
124
|
+
} else {
|
|
125
|
+
searchInputRef.current.inputRef.value = ''
|
|
126
|
+
}
|
|
127
|
+
}, [filters?.text])
|
|
128
|
+
|
|
129
|
+
// Debounce the search input value to avoid too many requests
|
|
130
|
+
const handleSearchChange = useDebounce(
|
|
131
|
+
(value: string) => {
|
|
132
|
+
if (!value && !router.query.text) {
|
|
133
|
+
return
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
const searchInputValueChanged =
|
|
137
|
+
value.trim().toLowerCase() !==
|
|
138
|
+
router.query.text?.toString().trim().toLowerCase()
|
|
139
|
+
|
|
140
|
+
if (searchInputValueChanged) {
|
|
141
|
+
const { text, page, ...rest } = router.query
|
|
142
|
+
router.push({
|
|
143
|
+
pathname: '/account/orders',
|
|
144
|
+
query: {
|
|
145
|
+
...rest,
|
|
146
|
+
...(value ? { text: value } : {}),
|
|
147
|
+
},
|
|
148
|
+
})
|
|
149
|
+
}
|
|
150
|
+
},
|
|
151
|
+
300,
|
|
152
|
+
String(router.query.text)
|
|
153
|
+
)
|
|
154
|
+
|
|
155
|
+
const selectedFacets: SelectedFacet[] = getSelectedFacets({ filters })
|
|
156
|
+
const allFacets = getAllFacets({ filters })
|
|
157
|
+
|
|
158
|
+
const filter = useMyAccountFilter({
|
|
159
|
+
allFacets,
|
|
160
|
+
selectedFacets,
|
|
161
|
+
})
|
|
162
|
+
|
|
163
|
+
const { openFilter, filter: displayFilter } = useUI()
|
|
164
|
+
|
|
165
|
+
if (listOrders.list.length === 0) {
|
|
166
|
+
return (
|
|
167
|
+
<div className={styles.page}>
|
|
168
|
+
<MyAccountListOrdersEmptyState />
|
|
169
|
+
</div>
|
|
170
|
+
)
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
return (
|
|
174
|
+
<div className={styles.page}>
|
|
175
|
+
<div data-fs-list-orders>
|
|
176
|
+
<h1 data-fs-list-orders-title>Orders</h1>
|
|
177
|
+
<div data-fs-list-orders-header>
|
|
178
|
+
<div data-fs-list-orders-search-filters>
|
|
179
|
+
<SearchInputField
|
|
180
|
+
ref={searchInputRef}
|
|
181
|
+
data-fs-search-input-field-list-orders
|
|
182
|
+
placeholder="Search"
|
|
183
|
+
onBlur={(_) => {
|
|
184
|
+
handleSearchChange(searchInputRef.current.inputRef.value)
|
|
185
|
+
}}
|
|
186
|
+
onKeyDown={(e) => {
|
|
187
|
+
if (e.key === 'Enter') {
|
|
188
|
+
handleSearchChange(searchInputRef.current.inputRef.value)
|
|
189
|
+
}
|
|
190
|
+
}}
|
|
191
|
+
onSubmit={(_) => {
|
|
192
|
+
handleSearchChange(searchInputRef.current.inputRef.value)
|
|
193
|
+
}}
|
|
194
|
+
/>
|
|
195
|
+
<Button
|
|
196
|
+
data-fs-list-orders-search-filters-button
|
|
197
|
+
variant="tertiary"
|
|
198
|
+
icon={
|
|
199
|
+
<Icon
|
|
200
|
+
width={16}
|
|
201
|
+
height={16}
|
|
202
|
+
name="FadersHorizontal"
|
|
203
|
+
aria-label="Open Filters"
|
|
204
|
+
/>
|
|
205
|
+
}
|
|
206
|
+
iconPosition="left"
|
|
207
|
+
onClick={() => {
|
|
208
|
+
filter.dispatch({
|
|
209
|
+
type: 'selectFacets',
|
|
210
|
+
payload: getSelectedFacets({ filters }),
|
|
211
|
+
})
|
|
212
|
+
openFilter()
|
|
213
|
+
}}
|
|
214
|
+
>
|
|
215
|
+
Filters
|
|
216
|
+
</Button>
|
|
217
|
+
</div>
|
|
218
|
+
{isDesktop && (
|
|
219
|
+
<Pagination page={filters.page} total={total} perPage={perPage} />
|
|
220
|
+
)}
|
|
221
|
+
</div>
|
|
222
|
+
|
|
223
|
+
<SelectedFiltersTags
|
|
224
|
+
filters={{
|
|
225
|
+
status: filters.status,
|
|
226
|
+
dateInitial: filters.dateInitial,
|
|
227
|
+
dateFinal: filters.dateFinal,
|
|
228
|
+
}}
|
|
229
|
+
onClearAll={() => {
|
|
230
|
+
router.push({
|
|
231
|
+
pathname: '/account/orders',
|
|
232
|
+
query: {},
|
|
233
|
+
})
|
|
234
|
+
}}
|
|
235
|
+
onRemoveFilter={(key, value) => {
|
|
236
|
+
const { page, clientEmail, ...updatedFilters } = { ...filters }
|
|
237
|
+
|
|
238
|
+
if (key === 'status' && Array.isArray(updatedFilters[key])) {
|
|
239
|
+
updatedFilters[key] = updatedFilters[key].filter(
|
|
240
|
+
(v) => v !== value
|
|
241
|
+
)
|
|
242
|
+
} else if (key === 'dateInitial' || key === 'dateFinal') {
|
|
243
|
+
delete updatedFilters.dateInitial
|
|
244
|
+
delete updatedFilters.dateFinal
|
|
245
|
+
} else {
|
|
246
|
+
delete updatedFilters[key]
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
if (key === 'status' && Array.isArray(updatedFilters[key])) {
|
|
250
|
+
updatedFilters[key] = updatedFilters[key].filter(
|
|
251
|
+
(v) => v.toLowerCase() !== value.toLowerCase()
|
|
252
|
+
)
|
|
253
|
+
} else if (key === 'dateInitial' || key === 'dateFinal') {
|
|
254
|
+
delete updatedFilters.dateInitial
|
|
255
|
+
delete updatedFilters.dateFinal
|
|
256
|
+
} else {
|
|
257
|
+
delete updatedFilters[key]
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
// Remove filters with no values
|
|
261
|
+
const filteredQuery = Object.fromEntries(
|
|
262
|
+
Object.entries(updatedFilters).filter(([, v]) =>
|
|
263
|
+
Array.isArray(v) ? v.length > 0 : Boolean(v)
|
|
264
|
+
)
|
|
265
|
+
)
|
|
266
|
+
|
|
267
|
+
router.push({
|
|
268
|
+
pathname: '/account/orders',
|
|
269
|
+
query: filteredQuery,
|
|
270
|
+
})
|
|
271
|
+
}}
|
|
272
|
+
/>
|
|
273
|
+
|
|
274
|
+
{displayFilter && (
|
|
275
|
+
<MyAccountFilterSlider
|
|
276
|
+
{...filter}
|
|
277
|
+
title="Filters"
|
|
278
|
+
clearButtonLabel="Clear All"
|
|
279
|
+
applyButtonLabel="View Results"
|
|
280
|
+
searchInputRef={searchInputRef}
|
|
281
|
+
/>
|
|
282
|
+
)}
|
|
283
|
+
|
|
284
|
+
<MyAccountListOrdersTable
|
|
285
|
+
listOrders={listOrders}
|
|
286
|
+
total={total}
|
|
287
|
+
perPage={perPage}
|
|
288
|
+
filters={filters}
|
|
289
|
+
/>
|
|
290
|
+
</div>
|
|
291
|
+
{!isDesktop && (
|
|
292
|
+
<Pagination page={filters.page} total={total} perPage={perPage} />
|
|
293
|
+
)}
|
|
294
|
+
</div>
|
|
295
|
+
)
|
|
296
|
+
}
|