@faststore/core 4.3.1-dev.0 → 4.4.0-dev.1
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/.turbo/turbo-generate.log +3 -3
- package/.turbo/turbo-test.log +43 -43
- package/CHANGELOG.md +10 -0
- package/README.md +2 -1
- package/cms/faststore/my-account/README.md +36 -0
- package/cms/faststore/my-account/components/cms_component__accountnavigation.jsonc +59 -0
- package/cms/faststore/my-account/components/cms_component__accountorderbudgets.jsonc +39 -0
- package/cms/faststore/my-account/components/cms_component__accountorderdelivery.jsonc +69 -0
- package/cms/faststore/my-account/components/cms_component__accountorderdetails.jsonc +79 -0
- package/cms/faststore/my-account/components/cms_component__accountordermoreinfo.jsonc +19 -0
- package/cms/faststore/my-account/components/cms_component__accountorderorderedby.jsonc +19 -0
- package/cms/faststore/my-account/components/cms_component__accountorderpayment.jsonc +69 -0
- package/cms/faststore/my-account/components/cms_component__accountorderslist.jsonc +154 -0
- package/cms/faststore/my-account/components/cms_component__accountorderstatus.jsonc +44 -0
- package/cms/faststore/my-account/components/cms_component__accountordersummary.jsonc +29 -0
- package/cms/faststore/my-account/components/cms_component__accountprofile.jsonc +39 -0
- package/cms/faststore/my-account/components/cms_component__accountsecurity.jsonc +104 -0
- package/cms/faststore/my-account/components/cms_component__accountunauthorized.jsonc +29 -0
- package/cms/faststore/my-account/components/cms_component__accountuserdetails.jsonc +49 -0
- package/cms/faststore/my-account/pages/cms_content_type__myaccountorderdetails.jsonc +18 -0
- package/cms/faststore/my-account/pages/cms_content_type__myaccountorders.jsonc +18 -0
- package/cms/faststore/my-account/pages/cms_content_type__myaccountprofile.jsonc +18 -0
- package/cms/faststore/my-account/pages/cms_content_type__myaccountsecurity.jsonc +18 -0
- package/cms/faststore/my-account/pages/cms_content_type__myaccountunauthorized.jsonc +18 -0
- package/cms/faststore/my-account/pages/cms_content_type__myaccountuserdetails.jsonc +18 -0
- package/package.json +6 -6
- package/src/components/account/{MyAccountDrawer → Drawer}/OrganizationDrawer/OrganizationDrawerBody.tsx +15 -3
- package/src/components/account/{MyAccountDrawer → Drawer}/OrganizationSignInButton/OrganizationSignInButton.tsx +5 -1
- package/src/components/account/{MyAccountDrawer → Drawer}/ProfileSummary/ProfileSummary.tsx +12 -2
- package/src/components/account/Layout/Layout.tsx +46 -0
- package/src/components/account/Layout/index.ts +1 -0
- package/src/components/account/{MyAccountLayout → Layout}/styles.scss +2 -2
- package/src/components/account/{MyAccountMenu/MyAccountMenu.tsx → Menu/Menu.tsx} +8 -10
- package/src/components/account/Menu/index.ts +1 -0
- package/src/components/account/UserDetails/UserDetails.tsx +54 -0
- package/src/components/account/UserDetails/index.ts +1 -0
- package/src/components/account/{MyAccountUserDetails → UserDetails}/styles.module.scss +2 -2
- package/src/components/account/UserDetails/userDetailsLabels.ts +25 -0
- package/src/components/account/components/{MyAccountAccordion/MyAccountAccordion.tsx → Accordion/Accordion.tsx} +2 -4
- package/src/components/account/components/{MyAccountAccordion/MyAccountAccordionButton.tsx → Accordion/AccordionButton.tsx} +3 -7
- package/src/components/account/components/{MyAccountAccordion/MyAccountAccordionItem.tsx → Accordion/AccordionItem.tsx} +3 -7
- package/src/components/account/components/{MyAccountAccordion/MyAccountAccordionPanel.tsx → Accordion/AccordionPanel.tsx} +3 -3
- package/src/components/account/components/Accordion/index.ts +4 -0
- package/src/components/account/components/{MyAccountCard/MyAccountCard.tsx → Card/Card.tsx} +2 -4
- package/src/components/account/components/Card/index.ts +1 -0
- package/src/components/account/components/{MyAccountHeader/MyAccountHeader.tsx → Header/Header.tsx} +3 -3
- package/src/components/account/components/Header/index.ts +1 -0
- package/src/components/account/components/StatusBadge/StatusBadge.tsx +43 -0
- package/src/components/account/components/StatusBadge/index.ts +1 -0
- package/src/components/account/components/{MyAccountTable/MyAccountTable.tsx → Table/Table.tsx} +3 -3
- package/src/components/account/components/Table/index.ts +1 -0
- package/src/components/account/components/Tag/index.ts +1 -0
- package/src/components/account/index.ts +2 -2
- package/src/components/account/orders/ListOrders/FilterSlider/FilterFacetDateRange/FilterFacetDateRange.tsx +128 -0
- package/src/components/account/orders/ListOrders/FilterSlider/FilterFacetDateRange/index.ts +2 -0
- package/src/components/account/orders/{MyAccountListOrders/MyAccountFilterSlider/MyAccountFilterFacetPendingApproval/MyAccountFilterFacetPendingApproval.tsx → ListOrders/FilterSlider/FilterFacetPendingApproval/FilterFacetPendingApproval.tsx} +4 -4
- package/src/components/account/orders/ListOrders/FilterSlider/FilterFacetPendingApproval/index.ts +2 -0
- package/src/components/account/orders/{MyAccountListOrders/MyAccountFilterSlider/MyAccountFilterSlider.tsx → ListOrders/FilterSlider/FilterSlider.tsx} +13 -4
- package/src/components/account/orders/ListOrders/FilterSlider/index.ts +1 -0
- package/src/components/account/orders/{MyAccountListOrders/MyAccountFilterSlider → ListOrders/FilterSlider}/section.module.scss +2 -2
- package/src/components/account/orders/{MyAccountListOrders/MyAccountListOrders.tsx → ListOrders/ListOrders.tsx} +53 -30
- package/src/components/account/orders/{MyAccountListOrders/MyAccountListOrdersTable → ListOrders/ListOrdersTable}/ExpandButton/ExpandButton.tsx +5 -1
- package/src/components/account/orders/{MyAccountListOrders/MyAccountListOrdersTable/MyAccountListOrdersTable.tsx → ListOrders/ListOrdersTable/ListOrdersTable.tsx} +35 -12
- package/src/components/account/orders/ListOrders/ListOrdersTable/index.ts +1 -0
- package/src/components/account/orders/{MyAccountListOrders/MyAccountSelectedTags/MyAccountSelectedTags.tsx → ListOrders/SelectedTags/SelectedTags.tsx} +24 -14
- package/src/components/account/orders/ListOrders/SelectedTags/index.ts +1 -0
- package/src/components/account/orders/ListOrders/index.ts +1 -0
- package/src/components/account/orders/ListOrders/listOrdersLabels.ts +112 -0
- package/src/components/account/orders/{MyAccountListOrders → ListOrders}/styles.module.scss +3 -3
- package/src/components/account/orders/{MyAccountOrderDetails/MyAccountBudgetsCard/MyAccountBudgetsCard.tsx → OrderDetails/BudgetsCard/BudgetsCard.tsx} +18 -11
- package/src/components/account/orders/OrderDetails/BudgetsCard/index.ts +1 -0
- package/src/components/account/orders/{MyAccountOrderDetails/MyAccountBuyingPolicyAlert/MyAccountBuyingPolicyAlert.tsx → OrderDetails/BuyingPolicyAlert/BuyingPolicyAlert.tsx} +46 -20
- package/src/components/account/orders/OrderDetails/BuyingPolicyAlert/index.ts +1 -0
- package/src/components/account/orders/{MyAccountOrderDetails/MyAccountDeliveryCard/MyAccountDeliveryCard.tsx → OrderDetails/DeliveryCard/DeliveryCard.tsx} +16 -15
- package/src/components/account/orders/OrderDetails/DeliveryCard/index.ts +1 -0
- package/src/components/account/orders/{MyAccountOrderDetails/MyAccountDeliveryOptionAccordion/MyAccountDeliveryOptionAccordion.tsx → OrderDetails/DeliveryOptionAccordion/DeliveryOptionAccordion.tsx} +38 -25
- package/src/components/account/orders/{MyAccountOrderDetails/MyAccountDeliveryOptionAccordion/MyAccountDeliveryOptionAccordionDeliveryInfo.tsx → OrderDetails/DeliveryOptionAccordion/DeliveryOptionAccordionDeliveryInfo.tsx} +4 -4
- package/src/components/account/orders/{MyAccountOrderDetails/MyAccountDeliveryOptionAccordion/MyAccountDeliveryOptionAccordionProducts.tsx → OrderDetails/DeliveryOptionAccordion/DeliveryOptionAccordionProducts.tsx} +7 -10
- package/src/components/account/orders/OrderDetails/DeliveryOptionAccordion/index.ts +6 -0
- package/src/components/account/orders/{MyAccountOrderDetails/MyAccountMoreInformationCard/MyAccountMoreInformationCard.tsx → OrderDetails/MoreInformationCard/MoreInformationCard.tsx} +10 -7
- package/src/components/account/orders/OrderDetails/MoreInformationCard/index.ts +1 -0
- package/src/components/account/orders/{MyAccountOrderDetails/MyAccountOrderActionModal/MyAccountOrderActionModal.tsx → OrderDetails/OrderActionModal/OrderActionModal.tsx} +3 -3
- package/src/components/account/orders/OrderDetails/OrderActionModal/index.ts +1 -0
- package/src/components/account/orders/{MyAccountOrderDetails/MyAccountOrderActions/MyAccountOrderActions.tsx → OrderDetails/OrderActions/OrderActions.tsx} +19 -12
- package/src/components/account/orders/OrderDetails/OrderActions/index.ts +1 -0
- package/src/components/account/orders/OrderDetails/OrderDetails.tsx +92 -0
- package/src/components/account/orders/OrderDetails/OrderDetailsHeader.tsx +89 -0
- package/src/components/account/orders/{MyAccountOrderDetails/MyAccountOrderedByCard/MyAccountOrderedByCard.tsx → OrderDetails/OrderedByCard/OrderedByCard.tsx} +9 -7
- package/src/components/account/orders/OrderDetails/OrderedByCard/index.ts +1 -0
- package/src/components/account/orders/{MyAccountOrderDetails/MyAccountPaymentCard/MyAccountPaymentCard.tsx → OrderDetails/PaymentCard/PaymentCard.tsx} +42 -27
- package/src/components/account/orders/{MyAccountOrderDetails/MyAccountPaymentCard/MyAccountPaymentFlagsIcon.tsx → OrderDetails/PaymentCard/PaymentFlagsIcon.tsx} +3 -3
- package/src/components/account/orders/OrderDetails/PaymentCard/index.ts +1 -0
- package/src/components/account/orders/{MyAccountOrderDetails/MyAccountReorderButton/MyAccountReorderButton.tsx → OrderDetails/ReorderButton/ReorderButton.tsx} +6 -4
- package/src/components/account/orders/OrderDetails/ReorderButton/index.ts +2 -0
- package/src/components/account/orders/{MyAccountOrderDetails/MyAccountStatusCard/MyAccountStatusCard.tsx → OrderDetails/StatusCard/StatusCard.tsx} +29 -8
- package/src/components/account/orders/OrderDetails/StatusCard/index.ts +1 -0
- package/src/components/account/orders/{MyAccountOrderDetails/MyAccountSummaryCard/MyAccountSummaryCard.tsx → OrderDetails/SummaryCard/SummaryCard.tsx} +16 -9
- package/src/components/account/orders/OrderDetails/SummaryCard/index.ts +1 -0
- package/src/components/account/orders/OrderDetails/index.ts +10 -0
- package/src/components/account/orders/OrderDetails/orderDetailsLabels.ts +204 -0
- package/src/components/account/orders/{MyAccountOrderDetails → OrderDetails}/section.module.scss +14 -14
- package/src/components/account/profile/profile.module.scss +1 -1
- package/src/components/account/profile/profile.tsx +31 -8
- package/src/components/account/section.module.scss +1 -1
- package/src/components/account/security/SecurityDrawer.tsx +29 -20
- package/src/components/account/security/SecuritySection.tsx +17 -6
- package/src/components/account/security/securityLabels.ts +47 -0
- package/src/components/account/security/styles.module.scss +1 -1
- package/src/components/cms/account/Components.ts +53 -0
- package/src/components/navigation/Navbar/Navbar.tsx +1 -1
- package/src/components/navigation/NavbarSlider/NavbarSlider.tsx +1 -1
- package/src/components/sections/Account/AccountNavigation.tsx +5 -0
- package/src/components/sections/Account/AccountOrderBudgets.tsx +35 -0
- package/src/components/sections/Account/AccountOrderDelivery.tsx +57 -0
- package/src/components/sections/Account/AccountOrderDetails.tsx +57 -0
- package/src/components/sections/Account/AccountOrderMoreInfo.tsx +39 -0
- package/src/components/sections/Account/AccountOrderOrderedBy.tsx +36 -0
- package/src/components/sections/Account/AccountOrderPayment.tsx +36 -0
- package/src/components/sections/Account/AccountOrderStatus.tsx +49 -0
- package/src/components/sections/Account/AccountOrderSummary.tsx +36 -0
- package/src/components/sections/Account/AccountOrdersList.tsx +89 -0
- package/src/components/sections/Account/AccountProfile.tsx +46 -0
- package/src/components/sections/Account/AccountSecurity.tsx +65 -0
- package/src/components/sections/Account/AccountUnauthorized.tsx +40 -0
- package/src/components/sections/Account/AccountUserDetails.tsx +43 -0
- package/src/experimental/index.ts +1 -1
- package/src/pages/_app.tsx +1 -1
- package/src/pages/pvt/account/403.tsx +43 -50
- package/src/pages/pvt/account/404.tsx +3 -3
- package/src/pages/pvt/account/orders/[id].tsx +58 -13
- package/src/pages/pvt/account/orders/index.tsx +59 -48
- package/src/pages/pvt/account/profile.tsx +64 -33
- package/src/pages/pvt/account/security.tsx +66 -32
- package/src/pages/pvt/account/user-details.tsx +67 -37
- package/src/sdk/account/accountPageContext.ts +73 -0
- package/src/sdk/account/getMyAccountRoutes.ts +48 -3
- package/src/sdk/overrides/PageProvider.tsx +3 -1
- package/src/server/cms/fetchMyAccountPageContent.ts +45 -0
- package/src/server/cms/myAccountDefaultSections.ts +73 -0
- package/src/utils/userOrderStatus.ts +129 -0
- package/test/utils/userOrderStatus.test.ts +36 -0
- package/src/components/account/MyAccountLayout/MyAccountLayout.tsx +0 -32
- package/src/components/account/MyAccountLayout/index.ts +0 -1
- package/src/components/account/MyAccountMenu/index.ts +0 -1
- package/src/components/account/MyAccountUserDetails/MyAccountUserDetails.tsx +0 -46
- package/src/components/account/MyAccountUserDetails/index.ts +0 -1
- package/src/components/account/components/MyAccountAccordion/index.ts +0 -4
- package/src/components/account/components/MyAccountCard/index.ts +0 -1
- package/src/components/account/components/MyAccountHeader/index.ts +0 -1
- package/src/components/account/components/MyAccountStatusBadge/MyAccountStatusBadge.tsx +0 -28
- package/src/components/account/components/MyAccountStatusBadge/index.ts +0 -1
- package/src/components/account/components/MyAccountTable/index.ts +0 -1
- package/src/components/account/components/MyAccountTag/index.ts +0 -1
- package/src/components/account/orders/MyAccountListOrders/MyAccountFilterSlider/MyAccountFilterFacetDateRange/MyAccountFilterFacetDateRange.tsx +0 -113
- package/src/components/account/orders/MyAccountListOrders/MyAccountFilterSlider/MyAccountFilterFacetDateRange/index.ts +0 -2
- package/src/components/account/orders/MyAccountListOrders/MyAccountFilterSlider/MyAccountFilterFacetPendingApproval/index.ts +0 -2
- package/src/components/account/orders/MyAccountListOrders/MyAccountFilterSlider/index.ts +0 -1
- package/src/components/account/orders/MyAccountListOrders/MyAccountListOrdersTable/index.ts +0 -1
- package/src/components/account/orders/MyAccountListOrders/MyAccountSelectedTags/index.ts +0 -1
- package/src/components/account/orders/MyAccountListOrders/index.ts +0 -1
- package/src/components/account/orders/MyAccountOrderDetails/MyAccountBudgetsCard/index.ts +0 -1
- package/src/components/account/orders/MyAccountOrderDetails/MyAccountBuyingPolicyAlert/index.ts +0 -1
- package/src/components/account/orders/MyAccountOrderDetails/MyAccountDeliveryCard/index.ts +0 -1
- package/src/components/account/orders/MyAccountOrderDetails/MyAccountDeliveryOptionAccordion/index.ts +0 -6
- package/src/components/account/orders/MyAccountOrderDetails/MyAccountMoreInformationCard/index.ts +0 -1
- package/src/components/account/orders/MyAccountOrderDetails/MyAccountOrderActionModal/index.ts +0 -1
- package/src/components/account/orders/MyAccountOrderDetails/MyAccountOrderActions/index.ts +0 -1
- package/src/components/account/orders/MyAccountOrderDetails/MyAccountOrderDetails.tsx +0 -136
- package/src/components/account/orders/MyAccountOrderDetails/MyAccountOrderedByCard/index.ts +0 -1
- package/src/components/account/orders/MyAccountOrderDetails/MyAccountPaymentCard/index.ts +0 -1
- package/src/components/account/orders/MyAccountOrderDetails/MyAccountReorderButton/index.ts +0 -2
- package/src/components/account/orders/MyAccountOrderDetails/MyAccountStatusCard/index.ts +0 -1
- package/src/components/account/orders/MyAccountOrderDetails/MyAccountSummaryCard/index.ts +0 -1
- package/src/components/account/orders/MyAccountOrderDetails/index.ts +0 -1
- package/src/components/account/profile/i18n.ts +0 -7
- /package/src/components/account/{MyAccountDrawer → Drawer}/OrganizationDrawer/OrganizationDrawer.tsx +0 -0
- /package/src/components/account/{MyAccountDrawer → Drawer}/OrganizationDrawer/OrganizationDrawerHeader.tsx +0 -0
- /package/src/components/account/{MyAccountDrawer → Drawer}/OrganizationDrawer/index.ts +0 -0
- /package/src/components/account/{MyAccountDrawer → Drawer}/OrganizationDrawer/section.module.scss +0 -0
- /package/src/components/account/{MyAccountDrawer → Drawer}/OrganizationDrawer/useReloadAfterLogoutReturn.ts +0 -0
- /package/src/components/account/{MyAccountDrawer → Drawer}/OrganizationSignInButton/index.ts +0 -0
- /package/src/components/account/{MyAccountDrawer → Drawer}/ProfileSummary/profile-summary.scss +0 -0
- /package/src/components/account/{MyAccountMenu → Menu}/styles.scss +0 -0
- /package/src/components/account/components/{MyAccountAccordion → Accordion}/styles.scss +0 -0
- /package/src/components/account/components/{MyAccountCard → Card}/styles.scss +0 -0
- /package/src/components/account/components/{MyAccountHeader → Header}/styles.scss +0 -0
- /package/src/components/account/components/{MyAccountStatusBadge → StatusBadge}/styles.scss +0 -0
- /package/src/components/account/components/{MyAccountTable → Table}/styles.scss +0 -0
- /package/src/components/account/components/{MyAccountTag/MyAccountTag.tsx → Tag/Tag.tsx} +0 -0
- /package/src/components/account/components/{MyAccountTag → Tag}/styles.scss +0 -0
- /package/src/components/account/orders/{MyAccountListOrders/MyAccountFilterSlider/MyAccountFilterFacetDateRange → ListOrders/FilterSlider/FilterFacetDateRange}/styles.scss +0 -0
- /package/src/components/account/orders/{MyAccountListOrders/MyAccountFilterSlider/MyAccountFilterFacetPendingApproval → ListOrders/FilterSlider/FilterFacetPendingApproval}/styles.scss +0 -0
- /package/src/components/account/orders/{MyAccountListOrders/MyAccountListOrdersTable → ListOrders/ListOrdersTable}/styles.scss +0 -0
- /package/src/components/account/orders/{MyAccountListOrders/MyAccountSelectedTags → ListOrders/SelectedTags}/styles.scss +0 -0
- /package/src/components/account/orders/{MyAccountOrderDetails/MyAccountBudgetsCard → OrderDetails/BudgetsCard}/styles.scss +0 -0
- /package/src/components/account/orders/{MyAccountOrderDetails/MyAccountBuyingPolicyAlert → OrderDetails/BuyingPolicyAlert}/styles.scss +0 -0
- /package/src/components/account/orders/{MyAccountOrderDetails/MyAccountDeliveryCard → OrderDetails/DeliveryCard}/styles.scss +0 -0
- /package/src/components/account/orders/{MyAccountOrderDetails/MyAccountDeliveryOptionAccordion → OrderDetails/DeliveryOptionAccordion}/styles.scss +0 -0
- /package/src/components/account/orders/{MyAccountOrderDetails/MyAccountMoreInformationCard → OrderDetails/MoreInformationCard}/styles.scss +0 -0
- /package/src/components/account/orders/{MyAccountOrderDetails/MyAccountOrderActionModal → OrderDetails/OrderActionModal}/styles.module.scss +0 -0
- /package/src/components/account/orders/{MyAccountOrderDetails/MyAccountOrderActions → OrderDetails/OrderActions}/styles.scss +0 -0
- /package/src/components/account/orders/{MyAccountOrderDetails/MyAccountOrderedByCard → OrderDetails/OrderedByCard}/styles.scss +0 -0
- /package/src/components/account/orders/{MyAccountOrderDetails/MyAccountPaymentCard → OrderDetails/PaymentCard}/styles.scss +0 -0
- /package/src/components/account/orders/{MyAccountOrderDetails/MyAccountReorderButton → OrderDetails/ReorderButton}/styles.scss +0 -0
- /package/src/components/account/orders/{MyAccountOrderDetails/MyAccountStatusCard → OrderDetails/StatusCard}/styles.scss +0 -0
- /package/src/components/account/orders/{MyAccountOrderDetails/MyAccountStatusCard → OrderDetails/StatusCard}/useConnectorPositioning.ts +0 -0
- /package/src/components/account/orders/{MyAccountOrderDetails/MyAccountSummaryCard → OrderDetails/SummaryCard}/styles.scss +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Locator } from '@vtex/client-cms'
|
|
1
|
+
import type { Locator, Section } from '@vtex/client-cms'
|
|
2
2
|
import type { GetServerSideProps } from 'next'
|
|
3
3
|
import { NextSeo } from 'next-seo'
|
|
4
4
|
import type { ComponentType } from 'react'
|
|
@@ -7,22 +7,23 @@ import {
|
|
|
7
7
|
getGlobalSectionsData,
|
|
8
8
|
} from 'src/components/cms/GlobalSections'
|
|
9
9
|
|
|
10
|
-
import { LinkButton } from '@faststore/ui'
|
|
11
10
|
import { gql } from '@generated/gql'
|
|
12
11
|
import type {
|
|
13
12
|
ServerAccountPageQueryQuery,
|
|
14
13
|
ServerAccountPageQueryQueryVariables,
|
|
15
14
|
} from '@generated/graphql'
|
|
16
|
-
import {
|
|
15
|
+
import RenderSections, {
|
|
16
|
+
RenderSectionsBase,
|
|
17
|
+
} from 'src/components/cms/RenderSections'
|
|
18
|
+
import ACCOUNT_COMPONENTS from 'src/components/cms/account/Components'
|
|
17
19
|
import { default as GLOBAL_COMPONENTS } from 'src/components/cms/global/Components'
|
|
18
|
-
import RenderSections from 'src/components/cms/RenderSections'
|
|
19
|
-
import { OverriddenDefaultEmptyState as EmptyState } from 'src/components/sections/EmptyState/OverriddenDefaultEmptyState'
|
|
20
20
|
import CUSTOM_COMPONENTS from 'src/customizations/src/components'
|
|
21
21
|
import PLUGINS_COMPONENTS from 'src/plugins'
|
|
22
22
|
import { useRefreshToken } from 'src/sdk/account/useRefreshToken'
|
|
23
23
|
import PageProvider from 'src/sdk/overrides/PageProvider'
|
|
24
24
|
import { execute } from 'src/server'
|
|
25
25
|
import { injectGlobalSections } from 'src/server/cms/global'
|
|
26
|
+
import { fetchMyAccountPageContent } from 'src/server/cms/fetchMyAccountPageContent'
|
|
26
27
|
import { getRequestHostname } from 'src/utils/getRequestHostname'
|
|
27
28
|
import { isLocalHost } from 'src/utils/isLocalHost'
|
|
28
29
|
import { withLocaleValidationSSR } from 'src/utils/localization/withLocaleValidation'
|
|
@@ -30,7 +31,6 @@ import { getMyAccountRedirect } from 'src/utils/myAccountRedirect'
|
|
|
30
31
|
|
|
31
32
|
import storeConfig from 'discovery.config'
|
|
32
33
|
|
|
33
|
-
/* A list of components that can be used in the CMS. */
|
|
34
34
|
const COMPONENTS: Record<string, ComponentType<any>> = {
|
|
35
35
|
...GLOBAL_COMPONENTS,
|
|
36
36
|
...PLUGINS_COMPONENTS,
|
|
@@ -39,47 +39,36 @@ const COMPONENTS: Record<string, ComponentType<any>> = {
|
|
|
39
39
|
|
|
40
40
|
type Props = {
|
|
41
41
|
globalSections?: GlobalSectionsData
|
|
42
|
-
|
|
42
|
+
pageSections: Section[]
|
|
43
43
|
needsRefreshToken?: boolean
|
|
44
44
|
fromPage?: string
|
|
45
45
|
}
|
|
46
46
|
|
|
47
47
|
function Page({
|
|
48
48
|
globalSections: globalSectionsProp,
|
|
49
|
-
|
|
49
|
+
pageSections,
|
|
50
50
|
needsRefreshToken,
|
|
51
51
|
fromPage,
|
|
52
52
|
}: Props) {
|
|
53
53
|
const { sections: globalSections, settings: globalSettings } =
|
|
54
54
|
globalSectionsProp ?? { sections: [], settings: {} }
|
|
55
55
|
|
|
56
|
-
// Use the new hook to handle refresh token with session management
|
|
57
56
|
const { shouldShow403 } = useRefreshToken(needsRefreshToken, fromPage)
|
|
58
57
|
|
|
59
|
-
// Handle refresh token case - show loading while attempting refresh
|
|
60
58
|
if (needsRefreshToken && !shouldShow403) {
|
|
61
59
|
console.info('Refreshing authentication...')
|
|
62
60
|
return <></>
|
|
63
61
|
}
|
|
64
62
|
|
|
65
|
-
// Show 403 page if refresh failed or if we don't need refresh token
|
|
66
63
|
return (
|
|
67
|
-
<PageProvider context={{ globalSettings }}>
|
|
64
|
+
<PageProvider context={{ globalSettings, accountPageData: {} }}>
|
|
68
65
|
<RenderSections globalSections={globalSections} components={COMPONENTS}>
|
|
69
66
|
<NextSeo noindex nofollow />
|
|
70
67
|
|
|
71
|
-
<
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
subtitle="You don't have permission to access this page."
|
|
76
|
-
showLoader={false}
|
|
77
|
-
>
|
|
78
|
-
<LinkButton variant="secondary" href="/pvt/account">
|
|
79
|
-
Back to Account
|
|
80
|
-
</LinkButton>
|
|
81
|
-
</EmptyState>
|
|
82
|
-
</MyAccountLayout>
|
|
68
|
+
<RenderSectionsBase
|
|
69
|
+
sections={pageSections}
|
|
70
|
+
components={ACCOUNT_COMPONENTS}
|
|
71
|
+
/>
|
|
83
72
|
</RenderSections>
|
|
84
73
|
</PageProvider>
|
|
85
74
|
)
|
|
@@ -102,28 +91,36 @@ const getServerSidePropsBase: GetServerSideProps<
|
|
|
102
91
|
previewData: context.previewData,
|
|
103
92
|
locale: context.locale,
|
|
104
93
|
}
|
|
94
|
+
|
|
105
95
|
const [
|
|
106
96
|
globalSectionsPromise,
|
|
107
97
|
globalSectionsHeaderPromise,
|
|
108
98
|
globalSectionsFooterPromise,
|
|
109
99
|
] = getGlobalSectionsData(contentContext)
|
|
110
100
|
|
|
111
|
-
const [
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
101
|
+
const [
|
|
102
|
+
pageContent,
|
|
103
|
+
account,
|
|
104
|
+
globalSections,
|
|
105
|
+
globalSectionsHeader,
|
|
106
|
+
globalSectionsFooter,
|
|
107
|
+
] = await Promise.all([
|
|
108
|
+
fetchMyAccountPageContent(
|
|
109
|
+
'myAccountUnauthorized',
|
|
110
|
+
contentContext,
|
|
111
|
+
'/pvt/account/403'
|
|
112
|
+
),
|
|
113
|
+
execute<ServerAccountPageQueryQueryVariables, ServerAccountPageQueryQuery>(
|
|
114
|
+
{
|
|
115
|
+
variables: {},
|
|
116
|
+
operation: query,
|
|
117
|
+
},
|
|
118
|
+
{ headers: { ...context.req.headers } }
|
|
119
|
+
),
|
|
120
|
+
globalSectionsPromise,
|
|
121
|
+
globalSectionsHeaderPromise,
|
|
122
|
+
globalSectionsFooterPromise,
|
|
123
|
+
])
|
|
127
124
|
|
|
128
125
|
const globalSectionsResult = injectGlobalSections({
|
|
129
126
|
globalSections,
|
|
@@ -131,24 +128,20 @@ const getServerSidePropsBase: GetServerSideProps<
|
|
|
131
128
|
globalSectionsFooter,
|
|
132
129
|
})
|
|
133
130
|
|
|
131
|
+
const fromPage =
|
|
132
|
+
typeof context.query.from === 'string' ? context.query.from : ''
|
|
133
|
+
|
|
134
134
|
if (account.errors) {
|
|
135
135
|
console.error(...account.errors)
|
|
136
136
|
|
|
137
137
|
const statusCode: number = (account.errors[0] as any)?.extensions?.status
|
|
138
138
|
|
|
139
|
-
const fromPage =
|
|
140
|
-
typeof context.query.from === 'string' ? context.query.from : ''
|
|
141
|
-
|
|
142
|
-
// The refresh-token round-trip is unreachable from localhost (cross-origin
|
|
143
|
-
// POST that drops the `vid_rt` cookie), and forcing it would clear the
|
|
144
|
-
// manually injected `VtexIdclientAutCookie_<account>`. Render the static
|
|
145
|
-
// 403 view instead so developers can keep testing logged-in scenarios
|
|
146
|
-
// regardless of the `experimental.refreshToken` flag.
|
|
147
139
|
const isLocal = isLocalHost(getRequestHostname(context.req.headers.host))
|
|
148
140
|
|
|
149
141
|
return {
|
|
150
142
|
props: {
|
|
151
143
|
globalSections: globalSectionsResult,
|
|
144
|
+
pageSections: pageContent.sections,
|
|
152
145
|
needsRefreshToken:
|
|
153
146
|
!isLocal &&
|
|
154
147
|
(statusCode === 401 || statusCode === 403) &&
|
|
@@ -168,9 +161,9 @@ const getServerSidePropsBase: GetServerSideProps<
|
|
|
168
161
|
|
|
169
162
|
return {
|
|
170
163
|
props: {
|
|
171
|
-
// The sections from the CMS page are not utilized here for the My Account page.
|
|
172
164
|
globalSections: globalSectionsResult,
|
|
173
|
-
|
|
165
|
+
pageSections: pageContent.sections,
|
|
166
|
+
fromPage,
|
|
174
167
|
},
|
|
175
168
|
}
|
|
176
169
|
}
|
|
@@ -12,7 +12,7 @@ import type {
|
|
|
12
12
|
ServerAccountPageQueryQuery,
|
|
13
13
|
ServerAccountPageQueryQueryVariables,
|
|
14
14
|
} from '@generated/graphql'
|
|
15
|
-
import {
|
|
15
|
+
import { Layout } from 'src/components/account'
|
|
16
16
|
import { default as GLOBAL_COMPONENTS } from 'src/components/cms/global/Components'
|
|
17
17
|
import RenderSections, {
|
|
18
18
|
RenderSectionsBase,
|
|
@@ -54,11 +54,11 @@ function Page({
|
|
|
54
54
|
<RenderSections globalSections={globalSections} components={COMPONENTS}>
|
|
55
55
|
<NextSeo noindex nofollow />
|
|
56
56
|
|
|
57
|
-
<
|
|
57
|
+
<Layout accountName={accountName}>
|
|
58
58
|
{sections && sections.length > 0 && (
|
|
59
59
|
<RenderSectionsBase sections={sections} components={COMPONENTS} />
|
|
60
60
|
)}
|
|
61
|
-
</
|
|
61
|
+
</Layout>
|
|
62
62
|
</RenderSections>
|
|
63
63
|
</PageProvider>
|
|
64
64
|
)
|
|
@@ -1,13 +1,18 @@
|
|
|
1
|
-
import type { Locator } from '@vtex/client-cms'
|
|
1
|
+
import type { Locator, Section } from '@vtex/client-cms'
|
|
2
2
|
import type { GetServerSideProps } from 'next'
|
|
3
3
|
import { NextSeo } from 'next-seo'
|
|
4
4
|
import type { ComponentType } from 'react'
|
|
5
|
-
import {
|
|
6
|
-
import
|
|
7
|
-
import RenderSections
|
|
5
|
+
import { Layout } from 'src/components/account'
|
|
6
|
+
import { OrderDetailsPageShell } from 'src/components/account/orders/OrderDetails'
|
|
7
|
+
import RenderSections, {
|
|
8
|
+
RenderSectionsBase,
|
|
9
|
+
} from 'src/components/cms/RenderSections'
|
|
10
|
+
import ACCOUNT_COMPONENTS from 'src/components/cms/account/Components'
|
|
8
11
|
import { default as GLOBAL_COMPONENTS } from 'src/components/cms/global/Components'
|
|
9
12
|
import CUSTOM_COMPONENTS from 'src/customizations/src/components'
|
|
10
13
|
import type { MyAccountProps } from 'src/experimental/myAccountServerSideProps'
|
|
14
|
+
import type { AccountOrderDetailsPageData } from 'src/sdk/account/accountPageContext'
|
|
15
|
+
import type { AccountNavigationLabels } from 'src/sdk/account/getMyAccountRoutes'
|
|
11
16
|
|
|
12
17
|
import { gql } from '@generated'
|
|
13
18
|
import type {
|
|
@@ -22,6 +27,9 @@ import { getIsRepresentative } from 'src/sdk/account/getIsRepresentative'
|
|
|
22
27
|
import PageProvider from 'src/sdk/overrides/PageProvider'
|
|
23
28
|
import { execute } from 'src/server'
|
|
24
29
|
import { injectGlobalSections } from 'src/server/cms/global'
|
|
30
|
+
import { extractAccountNavigationData } from 'src/server/cms/myAccountDefaultSections'
|
|
31
|
+
import { fetchMyAccountPageContent } from 'src/server/cms/fetchMyAccountPageContent'
|
|
32
|
+
import { extractOrderStatusLabelsFromSections } from 'src/utils/userOrderStatus'
|
|
25
33
|
import { getMyAccountRedirect } from 'src/utils/myAccountRedirect'
|
|
26
34
|
import { extractStatusFromError } from 'src/utils/utilities'
|
|
27
35
|
import { withLocaleValidationSSR } from 'src/utils/localization/withLocaleValidation'
|
|
@@ -32,12 +40,16 @@ const COMPONENTS: Record<string, ComponentType<any>> = {
|
|
|
32
40
|
}
|
|
33
41
|
|
|
34
42
|
type OrderDetailsPageProps = {
|
|
35
|
-
|
|
43
|
+
pageSections: Section[]
|
|
44
|
+
navigationLabels: AccountNavigationLabels
|
|
45
|
+
accountPageData: AccountOrderDetailsPageData
|
|
36
46
|
} & MyAccountProps
|
|
37
47
|
|
|
38
48
|
export default function OrderDetailsPage({
|
|
39
49
|
globalSections: globalSectionsProp,
|
|
40
|
-
|
|
50
|
+
pageSections,
|
|
51
|
+
navigationLabels,
|
|
52
|
+
accountPageData,
|
|
41
53
|
accountName,
|
|
42
54
|
isRepresentative,
|
|
43
55
|
}: OrderDetailsPageProps) {
|
|
@@ -45,18 +57,32 @@ export default function OrderDetailsPage({
|
|
|
45
57
|
globalSectionsProp ?? {}
|
|
46
58
|
|
|
47
59
|
return (
|
|
48
|
-
<PageProvider
|
|
60
|
+
<PageProvider
|
|
61
|
+
context={{
|
|
62
|
+
globalSettings,
|
|
63
|
+
accountPageData,
|
|
64
|
+
navigationLabels,
|
|
65
|
+
}}
|
|
66
|
+
>
|
|
49
67
|
<RenderSections globalSections={globalSections} components={COMPONENTS}>
|
|
50
68
|
<NextSeo noindex nofollow />
|
|
51
69
|
|
|
52
|
-
<
|
|
70
|
+
<Layout
|
|
53
71
|
isRepresentative={isRepresentative}
|
|
54
72
|
accountName={accountName}
|
|
73
|
+
navigationLabels={navigationLabels}
|
|
55
74
|
>
|
|
56
75
|
<BeforeSection />
|
|
57
|
-
<
|
|
76
|
+
<OrderDetailsPageShell>
|
|
77
|
+
<main data-fs-order-details-content>
|
|
78
|
+
<RenderSectionsBase
|
|
79
|
+
sections={pageSections}
|
|
80
|
+
components={ACCOUNT_COMPONENTS}
|
|
81
|
+
/>
|
|
82
|
+
</main>
|
|
83
|
+
</OrderDetailsPageShell>
|
|
58
84
|
<AfterSection />
|
|
59
|
-
</
|
|
85
|
+
</Layout>
|
|
60
86
|
</RenderSections>
|
|
61
87
|
</PageProvider>
|
|
62
88
|
)
|
|
@@ -313,12 +339,20 @@ const getServerSidePropsBase: GetServerSideProps<
|
|
|
313
339
|
globalSectionsFooterPromise,
|
|
314
340
|
] = getGlobalSectionsData(contentContext)
|
|
315
341
|
|
|
342
|
+
const orderPath = `/pvt/account/orders/${id}`
|
|
343
|
+
|
|
316
344
|
const [
|
|
345
|
+
pageContent,
|
|
317
346
|
orderDetails,
|
|
318
347
|
globalSections,
|
|
319
348
|
globalSectionsHeader,
|
|
320
349
|
globalSectionsFooter,
|
|
321
350
|
] = await Promise.all([
|
|
351
|
+
fetchMyAccountPageContent(
|
|
352
|
+
'myAccountOrderDetails',
|
|
353
|
+
contentContext,
|
|
354
|
+
orderPath
|
|
355
|
+
),
|
|
322
356
|
execute<
|
|
323
357
|
ServerOrderDetailsQueryQueryVariables,
|
|
324
358
|
ServerOrderDetailsQueryQuery
|
|
@@ -359,13 +393,24 @@ const getServerSidePropsBase: GetServerSideProps<
|
|
|
359
393
|
globalSectionsFooter,
|
|
360
394
|
})
|
|
361
395
|
|
|
362
|
-
const
|
|
396
|
+
const { pageSections, navigationData } = extractAccountNavigationData(
|
|
397
|
+
pageContent.sections
|
|
398
|
+
)
|
|
399
|
+
|
|
400
|
+
const orderStatusLabels = extractOrderStatusLabelsFromSections(
|
|
401
|
+
pageContent.sections
|
|
402
|
+
)
|
|
363
403
|
|
|
364
404
|
return {
|
|
365
405
|
props: {
|
|
366
406
|
globalSections: globalSectionsResult,
|
|
367
|
-
|
|
368
|
-
|
|
407
|
+
accountName: orderDetails.data.accountProfile.name ?? '',
|
|
408
|
+
navigationLabels: navigationData as AccountNavigationLabels,
|
|
409
|
+
accountPageData: {
|
|
410
|
+
order: orderDetails.data.userOrder,
|
|
411
|
+
orderStatusLabels,
|
|
412
|
+
},
|
|
413
|
+
pageSections,
|
|
369
414
|
isRepresentative,
|
|
370
415
|
},
|
|
371
416
|
}
|
|
@@ -1,9 +1,12 @@
|
|
|
1
|
-
import type { Locator } from '@vtex/client-cms'
|
|
1
|
+
import type { Locator, Section } from '@vtex/client-cms'
|
|
2
2
|
import type { GetServerSideProps } from 'next'
|
|
3
3
|
import { NextSeo } from 'next-seo'
|
|
4
4
|
import type { ComponentType } from 'react'
|
|
5
|
-
import {
|
|
6
|
-
import RenderSections
|
|
5
|
+
import { Layout } from 'src/components/account'
|
|
6
|
+
import RenderSections, {
|
|
7
|
+
RenderSectionsBase,
|
|
8
|
+
} from 'src/components/cms/RenderSections'
|
|
9
|
+
import ACCOUNT_COMPONENTS from 'src/components/cms/account/Components'
|
|
7
10
|
import { default as GLOBAL_COMPONENTS } from 'src/components/cms/global/Components'
|
|
8
11
|
import CUSTOM_COMPONENTS from 'src/customizations/src/components'
|
|
9
12
|
|
|
@@ -17,69 +20,66 @@ import type {
|
|
|
17
20
|
import { default as AfterSection } from 'src/customizations/src/myAccount/extensions/orders/after'
|
|
18
21
|
import { default as BeforeSection } from 'src/customizations/src/myAccount/extensions/orders/before'
|
|
19
22
|
import type { MyAccountProps } from 'src/experimental/myAccountServerSideProps'
|
|
23
|
+
import type { AccountOrdersListPageData } from 'src/sdk/account/accountPageContext'
|
|
24
|
+
import type { AccountNavigationLabels } from 'src/sdk/account/getMyAccountRoutes'
|
|
25
|
+
import { getIsRepresentative } from 'src/sdk/account/getIsRepresentative'
|
|
20
26
|
import { execute } from 'src/server'
|
|
21
27
|
import { injectGlobalSections } from 'src/server/cms/global'
|
|
28
|
+
import { extractAccountNavigationData } from 'src/server/cms/myAccountDefaultSections'
|
|
29
|
+
import { fetchMyAccountPageContent } from 'src/server/cms/fetchMyAccountPageContent'
|
|
22
30
|
import { withLocaleValidationSSR } from 'src/utils/localization/withLocaleValidation'
|
|
23
31
|
import { getMyAccountRedirect } from 'src/utils/myAccountRedirect'
|
|
24
32
|
import { groupOrderStatusByLabel } from 'src/utils/userOrderStatus'
|
|
25
33
|
|
|
26
34
|
import storeConfig from 'discovery.config'
|
|
27
|
-
import { MyAccountListOrders } from 'src/components/account/orders/MyAccountListOrders'
|
|
28
|
-
import { getIsRepresentative } from 'src/sdk/account/getIsRepresentative'
|
|
29
35
|
import PageProvider from 'src/sdk/overrides/PageProvider'
|
|
30
36
|
import { extractStatusFromError } from 'src/utils/utilities'
|
|
31
37
|
|
|
32
|
-
/* A list of components that can be used in the CMS. */
|
|
33
38
|
const COMPONENTS: Record<string, ComponentType<any>> = {
|
|
34
39
|
...GLOBAL_COMPONENTS,
|
|
35
40
|
...CUSTOM_COMPONENTS,
|
|
36
41
|
}
|
|
37
42
|
|
|
38
43
|
type ListOrdersPageProps = {
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
filters: {
|
|
43
|
-
page: number
|
|
44
|
-
status: string[]
|
|
45
|
-
dateInitial: string
|
|
46
|
-
dateFinal: string
|
|
47
|
-
text: string
|
|
48
|
-
clientEmail: string
|
|
49
|
-
pendingMyApproval?: boolean
|
|
50
|
-
}
|
|
44
|
+
pageSections: Section[]
|
|
45
|
+
navigationLabels: AccountNavigationLabels
|
|
46
|
+
accountPageData: AccountOrdersListPageData
|
|
51
47
|
} & MyAccountProps
|
|
52
48
|
|
|
53
49
|
export default function ListOrdersPage({
|
|
54
50
|
globalSections: globalSectionsProp,
|
|
51
|
+
pageSections,
|
|
52
|
+
navigationLabels,
|
|
53
|
+
accountPageData,
|
|
55
54
|
accountName,
|
|
56
|
-
listOrders,
|
|
57
|
-
total,
|
|
58
|
-
perPage,
|
|
59
|
-
filters,
|
|
60
55
|
isRepresentative,
|
|
61
56
|
}: ListOrdersPageProps) {
|
|
62
57
|
const { sections: globalSections, settings: globalSettings } =
|
|
63
58
|
globalSectionsProp ?? {}
|
|
64
59
|
|
|
65
60
|
return (
|
|
66
|
-
<PageProvider
|
|
61
|
+
<PageProvider
|
|
62
|
+
context={{
|
|
63
|
+
globalSettings,
|
|
64
|
+
accountPageData,
|
|
65
|
+
navigationLabels,
|
|
66
|
+
}}
|
|
67
|
+
>
|
|
67
68
|
<RenderSections globalSections={globalSections} components={COMPONENTS}>
|
|
68
69
|
<NextSeo noindex nofollow />
|
|
69
70
|
|
|
70
|
-
<
|
|
71
|
+
<Layout
|
|
71
72
|
isRepresentative={isRepresentative}
|
|
72
73
|
accountName={accountName}
|
|
74
|
+
navigationLabels={navigationLabels}
|
|
73
75
|
>
|
|
74
76
|
<BeforeSection />
|
|
75
|
-
<
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
perPage={perPage}
|
|
79
|
-
total={total}
|
|
77
|
+
<RenderSectionsBase
|
|
78
|
+
sections={pageSections}
|
|
79
|
+
components={ACCOUNT_COMPONENTS}
|
|
80
80
|
/>
|
|
81
81
|
<AfterSection />
|
|
82
|
-
</
|
|
82
|
+
</Layout>
|
|
83
83
|
</RenderSections>
|
|
84
84
|
</PageProvider>
|
|
85
85
|
)
|
|
@@ -127,7 +127,7 @@ const query = gql(`
|
|
|
127
127
|
`)
|
|
128
128
|
|
|
129
129
|
const getServerSidePropsBase: GetServerSideProps<
|
|
130
|
-
|
|
130
|
+
ListOrdersPageProps,
|
|
131
131
|
Record<string, string>,
|
|
132
132
|
Locator
|
|
133
133
|
> = async (context) => {
|
|
@@ -168,7 +168,6 @@ const getServerSidePropsBase: GetServerSideProps<
|
|
|
168
168
|
const clientEmail = (context.query.clientEmail as string | undefined) || ''
|
|
169
169
|
const pendingMyApproval = context.query.pendingMyApproval === 'true'
|
|
170
170
|
|
|
171
|
-
// Map labels from FastStore status to API status
|
|
172
171
|
const groupedStatus = groupOrderStatusByLabel()
|
|
173
172
|
const allStatuses =
|
|
174
173
|
status
|
|
@@ -185,11 +184,17 @@ const getServerSidePropsBase: GetServerSideProps<
|
|
|
185
184
|
.filter(Boolean) || []
|
|
186
185
|
|
|
187
186
|
const [
|
|
187
|
+
pageContent,
|
|
188
188
|
listOrders,
|
|
189
189
|
globalSections,
|
|
190
190
|
globalSectionsHeader,
|
|
191
191
|
globalSectionsFooter,
|
|
192
192
|
] = await Promise.all([
|
|
193
|
+
fetchMyAccountPageContent(
|
|
194
|
+
'myAccountOrders',
|
|
195
|
+
contentContext,
|
|
196
|
+
'/pvt/account/orders'
|
|
197
|
+
),
|
|
193
198
|
execute<ServerListOrdersQueryQueryVariables, ServerListOrdersQueryQuery>(
|
|
194
199
|
{
|
|
195
200
|
variables: {
|
|
@@ -214,12 +219,10 @@ const getServerSidePropsBase: GetServerSideProps<
|
|
|
214
219
|
if (listOrders.errors) {
|
|
215
220
|
console.error(...listOrders.errors)
|
|
216
221
|
|
|
217
|
-
const
|
|
222
|
+
const statusCode = extractStatusFromError(listOrders.errors[0])
|
|
218
223
|
|
|
219
|
-
// Redirect to 403 for authentication errors (401/403) to handle token refresh
|
|
220
|
-
// Redirect to 404 for other errors
|
|
221
224
|
const destination =
|
|
222
|
-
|
|
225
|
+
statusCode === 403 || statusCode === 401
|
|
223
226
|
? `/pvt/account/403?from=${encodeURIComponent('/pvt/account/orders')}`
|
|
224
227
|
: '/pvt/account/404'
|
|
225
228
|
|
|
@@ -231,6 +234,10 @@ const getServerSidePropsBase: GetServerSideProps<
|
|
|
231
234
|
}
|
|
232
235
|
}
|
|
233
236
|
|
|
237
|
+
const { pageSections, navigationData } = extractAccountNavigationData(
|
|
238
|
+
pageContent.sections
|
|
239
|
+
)
|
|
240
|
+
|
|
234
241
|
const globalSectionsResult = injectGlobalSections({
|
|
235
242
|
globalSections,
|
|
236
243
|
globalSectionsHeader,
|
|
@@ -240,19 +247,23 @@ const getServerSidePropsBase: GetServerSideProps<
|
|
|
240
247
|
return {
|
|
241
248
|
props: {
|
|
242
249
|
globalSections: globalSectionsResult,
|
|
243
|
-
accountName: listOrders.data.accountProfile.name,
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
250
|
+
accountName: listOrders.data.accountProfile.name ?? '',
|
|
251
|
+
navigationLabels: navigationData as AccountNavigationLabels,
|
|
252
|
+
accountPageData: {
|
|
253
|
+
listOrders: listOrders.data.listUserOrders,
|
|
254
|
+
total: listOrders.data.listUserOrders.paging.total,
|
|
255
|
+
perPage: listOrders.data.listUserOrders.paging.perPage,
|
|
256
|
+
filters: {
|
|
257
|
+
page: listOrders.data.listUserOrders.paging.currentPage ?? page,
|
|
258
|
+
status,
|
|
259
|
+
dateInitial,
|
|
260
|
+
dateFinal,
|
|
261
|
+
text,
|
|
262
|
+
clientEmail,
|
|
263
|
+
pendingMyApproval,
|
|
264
|
+
},
|
|
255
265
|
},
|
|
266
|
+
pageSections,
|
|
256
267
|
isRepresentative,
|
|
257
268
|
},
|
|
258
269
|
}
|