@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,157 @@
|
|
|
1
|
+
import { useSession } from 'src/sdk/session'
|
|
2
|
+
import MyAccountCard from '../../../components/MyAccountCard'
|
|
3
|
+
import MyAccountPaymentFlagsIcon from './MyAccountPaymentFlagsIcon'
|
|
4
|
+
import { useCallback } from 'react'
|
|
5
|
+
import { Link } from '@faststore/ui'
|
|
6
|
+
import type { ServerOrderDetailsQueryQuery } from '@generated/graphql'
|
|
7
|
+
import { useFormatPrice } from '../../../utils/useFormatPrice'
|
|
8
|
+
|
|
9
|
+
export type OrderPaymentData =
|
|
10
|
+
ServerOrderDetailsQueryQuery['userOrder']['paymentData']
|
|
11
|
+
export type OrderPaymentDataTransaction =
|
|
12
|
+
OrderPaymentData['transactions'][number]
|
|
13
|
+
export type OrderPaymentDataTransactionPayment =
|
|
14
|
+
OrderPaymentDataTransaction['payments'][number]
|
|
15
|
+
|
|
16
|
+
interface MyAccountPaymentCardProps {
|
|
17
|
+
paymentData?: OrderPaymentData
|
|
18
|
+
currencyCode: string
|
|
19
|
+
allowCancellation?: boolean
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
const getPaymentMethodInfo = (
|
|
23
|
+
payment: OrderPaymentDataTransaction['payments'][number]
|
|
24
|
+
) => {
|
|
25
|
+
const baseInfo = {
|
|
26
|
+
type: 'Billing',
|
|
27
|
+
methodName: '',
|
|
28
|
+
icon: payment.paymentSystemName,
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
switch (payment.group) {
|
|
32
|
+
case 'creditCard':
|
|
33
|
+
case 'debitCard':
|
|
34
|
+
return {
|
|
35
|
+
...baseInfo,
|
|
36
|
+
methodName: `${payment.paymentSystemName} ending in ${payment.lastDigits}`,
|
|
37
|
+
}
|
|
38
|
+
case 'bankInvoice':
|
|
39
|
+
return {
|
|
40
|
+
...baseInfo,
|
|
41
|
+
type: 'Bank Invoice',
|
|
42
|
+
methodName: 'Bank Invoice',
|
|
43
|
+
}
|
|
44
|
+
case 'payPal':
|
|
45
|
+
return {
|
|
46
|
+
...baseInfo,
|
|
47
|
+
methodName: 'PayPal',
|
|
48
|
+
}
|
|
49
|
+
case 'giftCard':
|
|
50
|
+
return {
|
|
51
|
+
...baseInfo,
|
|
52
|
+
type: 'Gift Card',
|
|
53
|
+
methodName: 'Gift Card',
|
|
54
|
+
}
|
|
55
|
+
default:
|
|
56
|
+
return {
|
|
57
|
+
...baseInfo,
|
|
58
|
+
methodName: payment.paymentSystemName,
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
const getBankInvoiceUrl = (transactions: OrderPaymentDataTransaction[]) => {
|
|
64
|
+
for (const transaction of transactions) {
|
|
65
|
+
for (const payment of transaction.payments) {
|
|
66
|
+
if (payment.url) {
|
|
67
|
+
return payment.url.replace('{Installment}', '1')
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
return null
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
function MyAccountPaymentCard({
|
|
76
|
+
paymentData,
|
|
77
|
+
currencyCode,
|
|
78
|
+
allowCancellation = false,
|
|
79
|
+
}: MyAccountPaymentCardProps) {
|
|
80
|
+
const formatPrice = useFormatPrice()
|
|
81
|
+
|
|
82
|
+
const bankInvoiceUrl = getBankInvoiceUrl(paymentData?.transactions)
|
|
83
|
+
|
|
84
|
+
const showPrintBankInvoiceButton = allowCancellation && bankInvoiceUrl
|
|
85
|
+
|
|
86
|
+
return (
|
|
87
|
+
<MyAccountCard title="Payment" data-fs-order-payment-card>
|
|
88
|
+
<div data-fs-payment-details>
|
|
89
|
+
{paymentData?.transactions[0]?.payments.map((payment) => {
|
|
90
|
+
const methodInfo = getPaymentMethodInfo(payment)
|
|
91
|
+
// Check if redemptionCode exists on payment
|
|
92
|
+
const hasRedemptionCode =
|
|
93
|
+
payment.group === 'giftCard' && payment.redemptionCode
|
|
94
|
+
|
|
95
|
+
return (
|
|
96
|
+
<div key={payment.id} data-fs-payment-info>
|
|
97
|
+
<div data-fs-payment-method>
|
|
98
|
+
<div data-fs-payment-method-info>
|
|
99
|
+
<p data-fs-payment-name>{methodInfo.methodName}</p>
|
|
100
|
+
<MyAccountPaymentFlagsIcon payment={payment} />
|
|
101
|
+
</div>
|
|
102
|
+
<div data-fs-payment-value>
|
|
103
|
+
{hasRedemptionCode ? (
|
|
104
|
+
<span>
|
|
105
|
+
{payment.redemptionCode} -{' '}
|
|
106
|
+
{formatPrice(payment.value, currencyCode)}
|
|
107
|
+
</span>
|
|
108
|
+
) : payment.installments > 1 ? (
|
|
109
|
+
<span>
|
|
110
|
+
{payment.installments}x of{' '}
|
|
111
|
+
{formatPrice(
|
|
112
|
+
payment.value / payment.installments,
|
|
113
|
+
currencyCode
|
|
114
|
+
)}
|
|
115
|
+
</span>
|
|
116
|
+
) : (
|
|
117
|
+
<span>{formatPrice(payment.value, currencyCode)}</span>
|
|
118
|
+
)}
|
|
119
|
+
</div>
|
|
120
|
+
</div>
|
|
121
|
+
|
|
122
|
+
<div data-fs-payment-transaction-info>
|
|
123
|
+
{payment.tid && (
|
|
124
|
+
<span data-fs-payment-tid>Tid: {payment.tid}</span>
|
|
125
|
+
)}
|
|
126
|
+
{payment.connectorResponses?.authId && (
|
|
127
|
+
<span data-fs-payment-authid>
|
|
128
|
+
AuthId: {String(payment.connectorResponses.authId)}
|
|
129
|
+
</span>
|
|
130
|
+
)}
|
|
131
|
+
<div data-fs-payment-bank-invoice>
|
|
132
|
+
{payment.bankIssuedInvoiceIdentificationNumber && (
|
|
133
|
+
<span data-fs-payment-bank-invoice-number>
|
|
134
|
+
Invoice Number:{' '}
|
|
135
|
+
{payment.bankIssuedInvoiceIdentificationNumber}
|
|
136
|
+
</span>
|
|
137
|
+
)}
|
|
138
|
+
{showPrintBankInvoiceButton && (
|
|
139
|
+
<Link
|
|
140
|
+
data-fs-payment-invoice-link
|
|
141
|
+
href={bankInvoiceUrl}
|
|
142
|
+
target="_blank"
|
|
143
|
+
>
|
|
144
|
+
Print Bank Invoice
|
|
145
|
+
</Link>
|
|
146
|
+
)}
|
|
147
|
+
</div>
|
|
148
|
+
</div>
|
|
149
|
+
</div>
|
|
150
|
+
)
|
|
151
|
+
})}
|
|
152
|
+
</div>
|
|
153
|
+
</MyAccountCard>
|
|
154
|
+
)
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
export default MyAccountPaymentCard
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import { Icon as UIIcon } from '@faststore/ui'
|
|
2
|
+
import type { OrderPaymentDataTransactionPayment } from './MyAccountPaymentCard'
|
|
3
|
+
|
|
4
|
+
interface PaymentFlagsIconProps {
|
|
5
|
+
payment: Pick<
|
|
6
|
+
OrderPaymentDataTransactionPayment,
|
|
7
|
+
'group' | 'paymentSystemName' | 'paymentOrigin'
|
|
8
|
+
>
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
const PAYMENT_GROUPS = {
|
|
12
|
+
BANK_INVOICE: 'bankInvoice',
|
|
13
|
+
PAYPAL: 'payPal',
|
|
14
|
+
GIFT_CARD: 'giftCard',
|
|
15
|
+
DEBIT_CARD: 'debitCard',
|
|
16
|
+
} as const
|
|
17
|
+
|
|
18
|
+
// Map for icons names
|
|
19
|
+
const PAYMENT_FLAGS = {
|
|
20
|
+
visa: 'Visa',
|
|
21
|
+
mastercard: 'Mastercard',
|
|
22
|
+
diners: 'Diners',
|
|
23
|
+
american: 'Amex',
|
|
24
|
+
hipercard: 'Hipercard',
|
|
25
|
+
discover: 'Discover',
|
|
26
|
+
banricompras: 'Banricompras',
|
|
27
|
+
aura: 'Aura',
|
|
28
|
+
elo: 'EloCard',
|
|
29
|
+
jcb: 'JCB',
|
|
30
|
+
bankinvoice: 'FileText',
|
|
31
|
+
paypal: 'PayPal',
|
|
32
|
+
giftcard: 'Gift',
|
|
33
|
+
cash: 'Currency',
|
|
34
|
+
applepay: 'ApplePay',
|
|
35
|
+
googlepay: 'GooglePay',
|
|
36
|
+
} as const
|
|
37
|
+
|
|
38
|
+
function shouldShowFlag(
|
|
39
|
+
payment: Pick<OrderPaymentDataTransactionPayment, 'paymentSystemName'>
|
|
40
|
+
) {
|
|
41
|
+
if (!payment.paymentSystemName || payment.paymentSystemName === 'Free') {
|
|
42
|
+
return false
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
return true
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
function MyAccountPaymentFlagsIcon({ payment }: PaymentFlagsIconProps) {
|
|
49
|
+
const getPaymentFlag = () => {
|
|
50
|
+
const { group, paymentSystemName, paymentOrigin } = payment
|
|
51
|
+
|
|
52
|
+
// Handle Google Pay and Apple Pay based on paymentOrigin
|
|
53
|
+
if (paymentOrigin) {
|
|
54
|
+
if (paymentOrigin === 'Google Pay') {
|
|
55
|
+
return PAYMENT_FLAGS.googlepay
|
|
56
|
+
}
|
|
57
|
+
if (paymentOrigin === 'Apple Pay') {
|
|
58
|
+
return PAYMENT_FLAGS.applepay
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
let slug: string
|
|
63
|
+
|
|
64
|
+
switch (group) {
|
|
65
|
+
case PAYMENT_GROUPS.BANK_INVOICE:
|
|
66
|
+
slug = 'bankinvoice'
|
|
67
|
+
break
|
|
68
|
+
case PAYMENT_GROUPS.PAYPAL:
|
|
69
|
+
slug = 'paypal'
|
|
70
|
+
break
|
|
71
|
+
case PAYMENT_GROUPS.GIFT_CARD:
|
|
72
|
+
slug = 'giftcard'
|
|
73
|
+
break
|
|
74
|
+
case PAYMENT_GROUPS.DEBIT_CARD:
|
|
75
|
+
slug = 'cash'
|
|
76
|
+
break
|
|
77
|
+
default:
|
|
78
|
+
slug = paymentSystemName.toLowerCase().split(' ')[0]
|
|
79
|
+
break
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
if (!(slug in PAYMENT_FLAGS)) {
|
|
83
|
+
return null
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
return PAYMENT_FLAGS[slug as keyof typeof PAYMENT_FLAGS]
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
if (!shouldShowFlag(payment)) {
|
|
90
|
+
return null
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
const flagName = getPaymentFlag()
|
|
94
|
+
|
|
95
|
+
if (!flagName) {
|
|
96
|
+
return null
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
return (
|
|
100
|
+
<div data-fs-payment-flag>
|
|
101
|
+
<UIIcon name={flagName} height={22} />
|
|
102
|
+
</div>
|
|
103
|
+
)
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
export default MyAccountPaymentFlagsIcon
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './MyAccountPaymentCard'
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
[data-fs-order-payment-card] {
|
|
2
|
+
// --------------------------------------------------------
|
|
3
|
+
// Design Tokens for Order Payment Card
|
|
4
|
+
// --------------------------------------------------------
|
|
5
|
+
|
|
6
|
+
// Default properties
|
|
7
|
+
--fs-order-payment-card-gap : var(--fs-spacing-3);
|
|
8
|
+
--fs-order-payment-card-info-gap : var(--fs-spacing-1);
|
|
9
|
+
--fs-order-payment-card-info-color : var(--fs-color-text);
|
|
10
|
+
--fs-order-payment-card-font-size : var(--fs-text-size-2);
|
|
11
|
+
--fs-order-payment-card-line-height : 1.5;
|
|
12
|
+
--fs-order-payment-card-font-weight : var(--fs-text-weight-regular);
|
|
13
|
+
--fs-order-payment-card-datetime-font-size : var(--fs-text-size-2);
|
|
14
|
+
--fs-order-payment-card-datetime-font-weight : var(--fs-text-weight-medium);
|
|
15
|
+
--fs-order-payment-card-tid-color : var(--fs-color-text-light);
|
|
16
|
+
--fs-order-payment-card-tid-font-size : var(--fs-text-size-1);
|
|
17
|
+
|
|
18
|
+
[data-fs-card-body] {
|
|
19
|
+
display: flex;
|
|
20
|
+
flex-direction: column;
|
|
21
|
+
gap: var(--fs-order-payment-card-gap);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
[data-fs-payment-details] {
|
|
25
|
+
display: flex;
|
|
26
|
+
flex-direction: column;
|
|
27
|
+
gap: var(--fs-spacing-3);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
[data-fs-payment-info] {
|
|
31
|
+
display: flex;
|
|
32
|
+
flex-direction: column;
|
|
33
|
+
gap: var(--fs-order-payment-card-info-gap);
|
|
34
|
+
font-size: var(--fs-order-payment-card-font-size);
|
|
35
|
+
line-height: var(--fs-order-payment-card-line-height);
|
|
36
|
+
color: var(--fs-order-payment-card-info-color);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
[data-fs-payment-method] {
|
|
40
|
+
display: flex;
|
|
41
|
+
flex-direction: column;
|
|
42
|
+
|
|
43
|
+
[data-fs-payment-method-info] {
|
|
44
|
+
display: flex;
|
|
45
|
+
flex-wrap: wrap;
|
|
46
|
+
gap: var(--fs-spacing-1);
|
|
47
|
+
align-items: flex-start;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
[data-fs-payment-flag] {
|
|
51
|
+
display: flex;
|
|
52
|
+
align-items: center;
|
|
53
|
+
justify-content: center;
|
|
54
|
+
width: var(--fs-spacing-5);
|
|
55
|
+
height: var(--fs-spacing-4);
|
|
56
|
+
padding: 2px 0;
|
|
57
|
+
color: var(--fs-color-neutral-4);
|
|
58
|
+
border: var(--fs-border-width) solid var(--fs-border-color-light);
|
|
59
|
+
border-radius: var(--fs-border-radius);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
[data-fs-payment-transaction-info] {
|
|
64
|
+
display: flex;
|
|
65
|
+
flex-wrap: wrap;
|
|
66
|
+
gap: var(--fs-spacing-0);
|
|
67
|
+
font-size: var(--fs-order-payment-card-tid-font-size);
|
|
68
|
+
color: var(--fs-order-payment-card-tid-color);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
[data-fs-payment-bank-invoice] {
|
|
72
|
+
display: flex;
|
|
73
|
+
flex-direction: column;
|
|
74
|
+
gap: var(--fs-spacing-0);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
@@ -0,0 +1,276 @@
|
|
|
1
|
+
import { Skeleton as UISkeleton, Icon as UIIcon } from '@faststore/ui'
|
|
2
|
+
import { type ReactNode, useEffect, useRef } from 'react'
|
|
3
|
+
import MyAccountCard from 'src/components/account/components/MyAccountCard'
|
|
4
|
+
import { orderStatusMap, type OrderStatusKey } from 'src/utils/userOrderStatus'
|
|
5
|
+
import { useConnectorPositioning } from './useConnectorPositioning'
|
|
6
|
+
|
|
7
|
+
export type StepStatus = 'completed' | 'loading' | 'not-started' | 'failed'
|
|
8
|
+
export type StepKey =
|
|
9
|
+
| 'order'
|
|
10
|
+
| 'approval'
|
|
11
|
+
| 'payment'
|
|
12
|
+
| 'processing'
|
|
13
|
+
| 'shipping'
|
|
14
|
+
|
|
15
|
+
interface Step {
|
|
16
|
+
label: ReactNode
|
|
17
|
+
status: StepStatus
|
|
18
|
+
completedAt?: string
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
interface MyAccountStatusCardProps {
|
|
22
|
+
status: OrderStatusKey
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
// Define custom labels for each step based on their status
|
|
26
|
+
// This allows us to show different text for the same step depending on its current state
|
|
27
|
+
const STEP_LABELS: Record<StepKey, Record<StepStatus, string>> = {
|
|
28
|
+
order: {
|
|
29
|
+
completed: 'Order Placed',
|
|
30
|
+
loading: 'Order Placed',
|
|
31
|
+
'not-started': 'Order Placed',
|
|
32
|
+
failed: 'Order Placed',
|
|
33
|
+
},
|
|
34
|
+
approval: {
|
|
35
|
+
completed: 'Approved', // Custom
|
|
36
|
+
loading: 'Approval Pending', // Use from orderStatusMap
|
|
37
|
+
'not-started': 'Approval Pending',
|
|
38
|
+
failed: 'Denied', // Custom
|
|
39
|
+
},
|
|
40
|
+
payment: {
|
|
41
|
+
completed: 'Payment Approved', // Use from orderStatusMap
|
|
42
|
+
loading: 'Payment Pending', // Use from orderStatusMap
|
|
43
|
+
'not-started': 'Payment authorization', // Custom
|
|
44
|
+
failed: 'Payment Denied', // Use from orderStatusMap
|
|
45
|
+
},
|
|
46
|
+
processing: {
|
|
47
|
+
completed: 'Ready for Delivery', // Use from orderStatusMap
|
|
48
|
+
loading: 'Handling order', // Custom
|
|
49
|
+
'not-started': 'Handling order', // Custom
|
|
50
|
+
failed: 'Canceled', // Use from orderStatusMap
|
|
51
|
+
},
|
|
52
|
+
shipping: {
|
|
53
|
+
completed: 'Invoiced', // Use from orderStatusMap
|
|
54
|
+
loading: 'Shipping order', // Custom
|
|
55
|
+
'not-started': 'Ship order', // Custom
|
|
56
|
+
failed: 'Canceled', // Use from orderStatusMap
|
|
57
|
+
},
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
// Define the visual progression of order steps from start to finish
|
|
61
|
+
const VISUAL_STEPS = [
|
|
62
|
+
{
|
|
63
|
+
label: (stepStatus: StepStatus) => STEP_LABELS.order[stepStatus],
|
|
64
|
+
key: 'order',
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
label: (stepStatus: StepStatus) => STEP_LABELS.approval[stepStatus],
|
|
68
|
+
key: 'approval',
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
label: (stepStatus: StepStatus) => STEP_LABELS.payment[stepStatus],
|
|
72
|
+
key: 'payment',
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
label: (stepStatus: StepStatus) => STEP_LABELS.processing[stepStatus],
|
|
76
|
+
key: 'processing',
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
label: (stepStatus: StepStatus) => STEP_LABELS.shipping[stepStatus],
|
|
80
|
+
key: 'shipping',
|
|
81
|
+
},
|
|
82
|
+
] as const
|
|
83
|
+
|
|
84
|
+
// Map labels from userOrderStatus.ts to step keys
|
|
85
|
+
const LABEL_TO_STEP_MAPPING: Record<string, StepKey> = {
|
|
86
|
+
'Order Placed': 'order',
|
|
87
|
+
'Approval Pending': 'approval',
|
|
88
|
+
'Payment Pending': 'payment',
|
|
89
|
+
'Payment Approved': 'processing',
|
|
90
|
+
'Payment Denied': 'payment',
|
|
91
|
+
'Ready for Delivery': 'processing',
|
|
92
|
+
Invoiced: 'shipping',
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
// Define which order status labels indicate a canceled state
|
|
96
|
+
const CANCELED_LABELS = ['Cancellation Requested', 'Canceled']
|
|
97
|
+
|
|
98
|
+
// Define which order status labels indicate a failed state
|
|
99
|
+
const FAILED_LABELS = ['Payment Denied']
|
|
100
|
+
|
|
101
|
+
const formatDate = (date: string) => {
|
|
102
|
+
return new Intl.DateTimeFormat('en-US', {
|
|
103
|
+
month: '2-digit',
|
|
104
|
+
day: '2-digit',
|
|
105
|
+
year: 'numeric',
|
|
106
|
+
hour: 'numeric',
|
|
107
|
+
minute: '2-digit',
|
|
108
|
+
hour12: true,
|
|
109
|
+
}).format(new Date(date))
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
const StepIcon = ({ status }: { status: StepStatus }) => {
|
|
113
|
+
if (status === 'completed') {
|
|
114
|
+
return (
|
|
115
|
+
<div data-fs-shipping-step-icon data-fs-shipping-step-completed>
|
|
116
|
+
<UIIcon name="Checked" height={16} width={16} />
|
|
117
|
+
</div>
|
|
118
|
+
)
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
if (status === 'loading') {
|
|
122
|
+
return (
|
|
123
|
+
<div data-fs-shipping-step-icon data-fs-shipping-step-loading>
|
|
124
|
+
<UIIcon name="DotsThree" height={16} width={16} />
|
|
125
|
+
</div>
|
|
126
|
+
)
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
if (status === 'failed') {
|
|
130
|
+
return (
|
|
131
|
+
<div data-fs-shipping-step-icon data-fs-shipping-step-failed>
|
|
132
|
+
<UIIcon name="X" height={16} width={16} />
|
|
133
|
+
</div>
|
|
134
|
+
)
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
return <div data-fs-shipping-step-icon />
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
// Determine the visual status (completed, loading, not-started, or failed) of a specific step based on the current order status
|
|
141
|
+
const getStepStatus = ({
|
|
142
|
+
stepKey,
|
|
143
|
+
currentStatus,
|
|
144
|
+
isCanceled,
|
|
145
|
+
isFailed,
|
|
146
|
+
}: {
|
|
147
|
+
stepKey: StepKey
|
|
148
|
+
currentStatus: OrderStatusKey
|
|
149
|
+
isCanceled: boolean
|
|
150
|
+
isFailed: boolean
|
|
151
|
+
}): StepStatus => {
|
|
152
|
+
// Get the label for the current status from userOrderStatus.ts
|
|
153
|
+
const currentStatusLabel = orderStatusMap[currentStatus]?.label
|
|
154
|
+
|
|
155
|
+
// If order is canceled, handle it specially
|
|
156
|
+
if (isCanceled) {
|
|
157
|
+
// For canceled orders, only the middle step (payment) will be marked as failed and the rest as not-started
|
|
158
|
+
if (stepKey === 'payment') {
|
|
159
|
+
return 'failed'
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
return 'not-started'
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
// Get the step key for the current status
|
|
166
|
+
const currentStepKey = currentStatusLabel
|
|
167
|
+
? LABEL_TO_STEP_MAPPING[currentStatusLabel]
|
|
168
|
+
: undefined
|
|
169
|
+
|
|
170
|
+
if (isFailed && stepKey === currentStepKey) {
|
|
171
|
+
return 'failed'
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
const currentStepIndex = VISUAL_STEPS.findIndex(
|
|
175
|
+
(step) => step.key === currentStepKey
|
|
176
|
+
)
|
|
177
|
+
|
|
178
|
+
const thisStepIndex = VISUAL_STEPS.findIndex((step) => step.key === stepKey)
|
|
179
|
+
|
|
180
|
+
// If we couldn't find the current step in our mapping
|
|
181
|
+
if (currentStepIndex === -1) {
|
|
182
|
+
// If this is the first step, it should be loading (order is in progress)
|
|
183
|
+
if (thisStepIndex === 0) {
|
|
184
|
+
return 'loading'
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
// All other steps haven't started yet
|
|
188
|
+
return 'not-started'
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
// If this is the current step, show it as loading/in progress
|
|
192
|
+
if (thisStepIndex === currentStepIndex) {
|
|
193
|
+
return 'loading'
|
|
194
|
+
}
|
|
195
|
+
// Steps before the current step are completed, steps after are not started
|
|
196
|
+
return thisStepIndex < currentStepIndex ? 'completed' : 'not-started'
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
function MyAccountStatusCard({ status }: MyAccountStatusCardProps) {
|
|
200
|
+
const containerRef = useRef<HTMLDivElement>(null)
|
|
201
|
+
|
|
202
|
+
useConnectorPositioning(containerRef)
|
|
203
|
+
|
|
204
|
+
// Get the label for the current status and check if it's a failed status
|
|
205
|
+
const currentStatusLabel = orderStatusMap[status]?.label
|
|
206
|
+
const isCanceled = currentStatusLabel
|
|
207
|
+
? CANCELED_LABELS.includes(currentStatusLabel)
|
|
208
|
+
: false
|
|
209
|
+
const isFailed = currentStatusLabel
|
|
210
|
+
? FAILED_LABELS.includes(currentStatusLabel)
|
|
211
|
+
: false
|
|
212
|
+
|
|
213
|
+
const steps: Step[] = VISUAL_STEPS.map((step) => {
|
|
214
|
+
const stepStatus = getStepStatus({
|
|
215
|
+
stepKey: step.key,
|
|
216
|
+
currentStatus: status,
|
|
217
|
+
isCanceled,
|
|
218
|
+
isFailed,
|
|
219
|
+
})
|
|
220
|
+
|
|
221
|
+
const stepLabel = isCanceled ? (
|
|
222
|
+
step.key === 'payment' ? (
|
|
223
|
+
currentStatusLabel
|
|
224
|
+
) : (
|
|
225
|
+
<UISkeleton
|
|
226
|
+
key={step.key}
|
|
227
|
+
size={{ width: '100px', height: '14px' }}
|
|
228
|
+
shimmer={false}
|
|
229
|
+
/>
|
|
230
|
+
)
|
|
231
|
+
) : (
|
|
232
|
+
step.label(stepStatus)
|
|
233
|
+
)
|
|
234
|
+
|
|
235
|
+
return {
|
|
236
|
+
label: stepLabel,
|
|
237
|
+
status: stepStatus,
|
|
238
|
+
}
|
|
239
|
+
})
|
|
240
|
+
|
|
241
|
+
return (
|
|
242
|
+
<MyAccountCard title="Status" data-fs-order-status-card>
|
|
243
|
+
<div data-fs-order-status-content ref={containerRef}>
|
|
244
|
+
{steps.map((step, index) => (
|
|
245
|
+
<div
|
|
246
|
+
key={`${step.label}-${index}`}
|
|
247
|
+
data-fs-shipping-step
|
|
248
|
+
data-fs-shipping-status={step.status}
|
|
249
|
+
>
|
|
250
|
+
<StepIcon status={step.status} />
|
|
251
|
+
<div data-fs-shipping-step-content>
|
|
252
|
+
<p data-fs-shipping-step-label>{step.label}</p>
|
|
253
|
+
{step.completedAt && (
|
|
254
|
+
<div data-fs-shipping-step-details>
|
|
255
|
+
<span data-fs-shipping-step-date>
|
|
256
|
+
{formatDate(step.completedAt)}
|
|
257
|
+
</span>
|
|
258
|
+
</div>
|
|
259
|
+
)}
|
|
260
|
+
</div>
|
|
261
|
+
{index < steps.length - 1 && (
|
|
262
|
+
<div
|
|
263
|
+
data-fs-shipping-connector
|
|
264
|
+
data-fs-shipping-connector-status={
|
|
265
|
+
step.status === 'completed' ? 'completed' : 'not-started'
|
|
266
|
+
}
|
|
267
|
+
/>
|
|
268
|
+
)}
|
|
269
|
+
</div>
|
|
270
|
+
))}
|
|
271
|
+
</div>
|
|
272
|
+
</MyAccountCard>
|
|
273
|
+
)
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
export default MyAccountStatusCard
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './MyAccountStatusCard'
|