@faststore/core 4.4.0-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 +48 -48
- package/CHANGELOG.md +6 -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,13 +1,26 @@
|
|
|
1
|
-
interface Route {
|
|
1
|
+
export interface Route {
|
|
2
2
|
/* Page name, displayed in the sidebar */
|
|
3
3
|
title: string
|
|
4
4
|
/* Accessible path within My Account */
|
|
5
5
|
route: string
|
|
6
6
|
}
|
|
7
7
|
|
|
8
|
+
export type AccountNavigationLabels = Partial<{
|
|
9
|
+
profileLabel: string
|
|
10
|
+
ordersLabel: string
|
|
11
|
+
userDetailsLabel: string
|
|
12
|
+
securityLabel: string
|
|
13
|
+
manageLabel: string
|
|
14
|
+
logoutLabel: string
|
|
15
|
+
switchLabel: string
|
|
16
|
+
companyLabel: string
|
|
17
|
+
contractLabel: string
|
|
18
|
+
}>
|
|
19
|
+
|
|
8
20
|
interface GetMyAccountRouteParams {
|
|
9
21
|
/* Route list */
|
|
10
22
|
routes: Route[]
|
|
23
|
+
labels?: AccountNavigationLabels
|
|
11
24
|
}
|
|
12
25
|
|
|
13
26
|
export const PROFILE_ROUTE = '/pvt/account/profile'
|
|
@@ -15,6 +28,13 @@ export const ORDERS_ROUTE = '/pvt/account/orders'
|
|
|
15
28
|
export const USER_DETAILS_ROUTE = '/pvt/account/user-details'
|
|
16
29
|
export const SECURITY_ROUTE = '/pvt/account/security'
|
|
17
30
|
|
|
31
|
+
const ROUTE_LABEL_KEYS: Record<string, keyof AccountNavigationLabels> = {
|
|
32
|
+
[PROFILE_ROUTE]: 'profileLabel',
|
|
33
|
+
[ORDERS_ROUTE]: 'ordersLabel',
|
|
34
|
+
[USER_DETAILS_ROUTE]: 'userDetailsLabel',
|
|
35
|
+
[SECURITY_ROUTE]: 'securityLabel',
|
|
36
|
+
}
|
|
37
|
+
|
|
18
38
|
// This is the default route list for My Account, we should add then as the feature is implemented
|
|
19
39
|
const DEFAULT_ROUTES: Route[] = [
|
|
20
40
|
{
|
|
@@ -35,12 +55,37 @@ const DEFAULT_ROUTES: Route[] = [
|
|
|
35
55
|
},
|
|
36
56
|
]
|
|
37
57
|
|
|
38
|
-
|
|
58
|
+
function withNavigationLabels(
|
|
59
|
+
routes: Route[],
|
|
60
|
+
labels?: AccountNavigationLabels
|
|
61
|
+
): Route[] {
|
|
62
|
+
if (!labels) {
|
|
63
|
+
return routes
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
return routes.map((item) => {
|
|
67
|
+
const labelKey = ROUTE_LABEL_KEYS[item.route]
|
|
68
|
+
const title = labelKey ? (labels[labelKey] ?? item.title) : item.title
|
|
69
|
+
|
|
70
|
+
return { ...item, title }
|
|
71
|
+
})
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
export function getMyAccountRoutes({
|
|
75
|
+
routes,
|
|
76
|
+
labels,
|
|
77
|
+
}: GetMyAccountRouteParams) {
|
|
39
78
|
// Ensure all routes have the /pvt prefix
|
|
40
79
|
const normalizedRoutes = routes.map(({ route, ...rest }) => ({
|
|
41
80
|
...rest,
|
|
42
81
|
route: route.startsWith('/pvt') ? route : `/pvt${route}`,
|
|
43
82
|
}))
|
|
44
83
|
|
|
45
|
-
return [...DEFAULT_ROUTES, ...normalizedRoutes]
|
|
84
|
+
return withNavigationLabels([...DEFAULT_ROUTES, ...normalizedRoutes], labels)
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
export function getExtraMyAccountRoutes(routes: Route[]): Route[] {
|
|
88
|
+
const defaultPaths = new Set(DEFAULT_ROUTES.map(({ route }) => route))
|
|
89
|
+
|
|
90
|
+
return routes.filter(({ route }) => !defaultPaths.has(route))
|
|
46
91
|
}
|
|
@@ -8,8 +8,9 @@ import type {
|
|
|
8
8
|
import type { PropsWithChildren } from 'react'
|
|
9
9
|
import { createContext, useContext, useMemo } from 'react'
|
|
10
10
|
import type { SearchPageContextType } from 'src/pages/s'
|
|
11
|
+
import type { AccountPageContext } from 'src/sdk/account/accountPageContext'
|
|
11
12
|
|
|
12
|
-
interface PageGlobalContext {
|
|
13
|
+
export interface PageGlobalContext {
|
|
13
14
|
globalSettings?: Record<string, unknown>
|
|
14
15
|
}
|
|
15
16
|
|
|
@@ -42,6 +43,7 @@ export interface PageProviderContextValue {
|
|
|
42
43
|
|
|
43
44
|
type PageProviderContext =
|
|
44
45
|
| PageGlobalContext
|
|
46
|
+
| AccountPageContext
|
|
45
47
|
| PDPContext
|
|
46
48
|
| PLPContext
|
|
47
49
|
| SearchPageContext
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import type { Locator } from '@vtex/client-cms'
|
|
2
|
+
import type { PageContentType } from 'src/server/cms'
|
|
3
|
+
import { contentService } from 'src/server/content/service'
|
|
4
|
+
import {
|
|
5
|
+
type MyAccountContentType,
|
|
6
|
+
withDefaultMyAccountSections,
|
|
7
|
+
} from './myAccountDefaultSections'
|
|
8
|
+
|
|
9
|
+
type FetchMyAccountPageContentContext = {
|
|
10
|
+
previewData?: Locator
|
|
11
|
+
locale?: string
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export async function fetchMyAccountPageContent(
|
|
15
|
+
contentType: MyAccountContentType,
|
|
16
|
+
context: FetchMyAccountPageContentContext,
|
|
17
|
+
pagePath: string
|
|
18
|
+
) {
|
|
19
|
+
const pageContent = await contentService
|
|
20
|
+
.getSingleContent<PageContentType>({
|
|
21
|
+
contentType,
|
|
22
|
+
previewData: context.previewData,
|
|
23
|
+
locale: context.locale,
|
|
24
|
+
})
|
|
25
|
+
.catch((err) => {
|
|
26
|
+
console.warn('[MyAccount CMS fallback]', {
|
|
27
|
+
contentType,
|
|
28
|
+
locale: context.locale,
|
|
29
|
+
fallbackReason: err instanceof Error ? err.message : String(err),
|
|
30
|
+
page: pagePath,
|
|
31
|
+
})
|
|
32
|
+
|
|
33
|
+
return { sections: [], settings: {} } as PageContentType
|
|
34
|
+
})
|
|
35
|
+
|
|
36
|
+
const sections = withDefaultMyAccountSections(
|
|
37
|
+
contentType,
|
|
38
|
+
pageContent.sections
|
|
39
|
+
)
|
|
40
|
+
|
|
41
|
+
return {
|
|
42
|
+
...pageContent,
|
|
43
|
+
sections,
|
|
44
|
+
}
|
|
45
|
+
}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
export type MyAccountContentType =
|
|
2
|
+
| 'myAccountProfile'
|
|
3
|
+
| 'myAccountOrders'
|
|
4
|
+
| 'myAccountOrderDetails'
|
|
5
|
+
| 'myAccountUserDetails'
|
|
6
|
+
| 'myAccountSecurity'
|
|
7
|
+
| 'myAccountUnauthorized'
|
|
8
|
+
|
|
9
|
+
export type DefaultMyAccountSection = {
|
|
10
|
+
name: string
|
|
11
|
+
$componentKey: string
|
|
12
|
+
data: Record<string, unknown>
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
const DEFAULT_SECTION_KEYS: Record<MyAccountContentType, string[]> = {
|
|
16
|
+
myAccountProfile: ['AccountNavigation', 'AccountProfile'],
|
|
17
|
+
myAccountOrders: ['AccountNavigation', 'AccountOrdersList'],
|
|
18
|
+
myAccountOrderDetails: [
|
|
19
|
+
'AccountNavigation',
|
|
20
|
+
'AccountOrderDetails',
|
|
21
|
+
'AccountOrderStatus',
|
|
22
|
+
'AccountOrderPayment',
|
|
23
|
+
'AccountOrderDelivery',
|
|
24
|
+
'AccountOrderSummary',
|
|
25
|
+
'AccountOrderOrderedBy',
|
|
26
|
+
'AccountOrderBudgets',
|
|
27
|
+
'AccountOrderMoreInfo',
|
|
28
|
+
],
|
|
29
|
+
myAccountUserDetails: ['AccountNavigation', 'AccountUserDetails'],
|
|
30
|
+
myAccountSecurity: ['AccountNavigation', 'AccountSecurity'],
|
|
31
|
+
myAccountUnauthorized: ['AccountUnauthorized'],
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export function getDefaultMyAccountSections(
|
|
35
|
+
contentType: MyAccountContentType
|
|
36
|
+
): DefaultMyAccountSection[] {
|
|
37
|
+
return (DEFAULT_SECTION_KEYS[contentType] ?? []).map((key) => ({
|
|
38
|
+
name: key,
|
|
39
|
+
$componentKey: key,
|
|
40
|
+
data: {},
|
|
41
|
+
}))
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export function withDefaultMyAccountSections<
|
|
45
|
+
T extends { $componentKey?: string; name: string; data?: unknown },
|
|
46
|
+
>(contentType: MyAccountContentType, sections: T[] | undefined | null): T[] {
|
|
47
|
+
if (sections && sections.length > 0) {
|
|
48
|
+
return sections
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
return getDefaultMyAccountSections(contentType) as unknown as T[]
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
export function extractAccountNavigationData<
|
|
55
|
+
T extends { $componentKey?: string; name: string; data?: unknown },
|
|
56
|
+
>(sections: T[]) {
|
|
57
|
+
const navigationSection = sections.find(
|
|
58
|
+
(section) => (section.$componentKey ?? section.name) === 'AccountNavigation'
|
|
59
|
+
)
|
|
60
|
+
|
|
61
|
+
return {
|
|
62
|
+
navigationData: (navigationSection?.data ?? {}) as Record<string, string>,
|
|
63
|
+
pageSections: sections
|
|
64
|
+
.filter(
|
|
65
|
+
(section) =>
|
|
66
|
+
(section.$componentKey ?? section.name) !== 'AccountNavigation'
|
|
67
|
+
)
|
|
68
|
+
.map((section) => ({
|
|
69
|
+
...section,
|
|
70
|
+
data: (section.data ?? {}) as Record<string, unknown>,
|
|
71
|
+
})),
|
|
72
|
+
}
|
|
73
|
+
}
|
|
@@ -103,6 +103,135 @@ export type OrderStatusKey = keyof typeof orderStatusMap
|
|
|
103
103
|
export type OrderStatusVariant =
|
|
104
104
|
(typeof orderStatusMap)[OrderStatusKey]['variant']
|
|
105
105
|
|
|
106
|
+
export type OrderStatusCmsLabels = Partial<{
|
|
107
|
+
orderPlacedStatus: string
|
|
108
|
+
pendingApprovalStatus: string
|
|
109
|
+
paymentPendingStatus: string
|
|
110
|
+
paymentApprovedStatus: string
|
|
111
|
+
paymentDeniedStatus: string
|
|
112
|
+
readyForDeliveryStatus: string
|
|
113
|
+
invoicedStatus: string
|
|
114
|
+
cancellationRequestedStatus: string
|
|
115
|
+
canceledStatus: string
|
|
116
|
+
}>
|
|
117
|
+
|
|
118
|
+
const ORDER_STATUS_CMS_LABEL_KEYS = [
|
|
119
|
+
'orderPlacedStatus',
|
|
120
|
+
'pendingApprovalStatus',
|
|
121
|
+
'paymentPendingStatus',
|
|
122
|
+
'paymentApprovedStatus',
|
|
123
|
+
'paymentDeniedStatus',
|
|
124
|
+
'readyForDeliveryStatus',
|
|
125
|
+
'invoicedStatus',
|
|
126
|
+
'cancellationRequestedStatus',
|
|
127
|
+
'canceledStatus',
|
|
128
|
+
] as const satisfies readonly (keyof OrderStatusCmsLabels)[]
|
|
129
|
+
|
|
130
|
+
const CMS_LABEL_TO_CANONICAL: Record<
|
|
131
|
+
keyof Required<OrderStatusCmsLabels>,
|
|
132
|
+
string
|
|
133
|
+
> = {
|
|
134
|
+
orderPlacedStatus: 'Order Placed',
|
|
135
|
+
pendingApprovalStatus: 'Pending approval',
|
|
136
|
+
paymentPendingStatus: 'Payment Pending',
|
|
137
|
+
paymentApprovedStatus: 'Payment Approved',
|
|
138
|
+
paymentDeniedStatus: 'Payment Denied',
|
|
139
|
+
readyForDeliveryStatus: 'Ready for Delivery',
|
|
140
|
+
invoicedStatus: 'Invoiced',
|
|
141
|
+
cancellationRequestedStatus: 'Cancellation Requested',
|
|
142
|
+
canceledStatus: 'Canceled',
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
function cmsLabelsToDisplayOverrides(
|
|
146
|
+
cmsLabels?: OrderStatusCmsLabels
|
|
147
|
+
): Record<string, string> {
|
|
148
|
+
if (!cmsLabels) {
|
|
149
|
+
return {}
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
const overrides: Record<string, string> = {}
|
|
153
|
+
|
|
154
|
+
for (const key of ORDER_STATUS_CMS_LABEL_KEYS) {
|
|
155
|
+
const label = cmsLabels[key]
|
|
156
|
+
if (label) {
|
|
157
|
+
overrides[CMS_LABEL_TO_CANONICAL[key].toLowerCase()] = label
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
return overrides
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
export function pickOrderStatusCmsLabels(
|
|
165
|
+
data?: Record<string, unknown>
|
|
166
|
+
): OrderStatusCmsLabels | undefined {
|
|
167
|
+
if (!data) {
|
|
168
|
+
return undefined
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
const labels: OrderStatusCmsLabels = {}
|
|
172
|
+
let hasAny = false
|
|
173
|
+
|
|
174
|
+
for (const key of ORDER_STATUS_CMS_LABEL_KEYS) {
|
|
175
|
+
const value = data[key]
|
|
176
|
+
if (typeof value === 'string' && value.length > 0) {
|
|
177
|
+
labels[key] = value
|
|
178
|
+
hasAny = true
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
return hasAny ? labels : undefined
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
export function extractOrderStatusLabelsFromSections<
|
|
186
|
+
T extends { data?: unknown },
|
|
187
|
+
>(sections: T[]): OrderStatusCmsLabels | undefined {
|
|
188
|
+
const merged: OrderStatusCmsLabels = {}
|
|
189
|
+
let hasAny = false
|
|
190
|
+
|
|
191
|
+
for (const section of sections) {
|
|
192
|
+
const picked = pickOrderStatusCmsLabels(
|
|
193
|
+
(section.data ?? {}) as Record<string, unknown>
|
|
194
|
+
)
|
|
195
|
+
|
|
196
|
+
if (picked) {
|
|
197
|
+
Object.assign(merged, picked)
|
|
198
|
+
hasAny = true
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
return hasAny ? merged : undefined
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
export function getLocalizedOrderStatusMap(
|
|
206
|
+
cmsLabels?: OrderStatusCmsLabels
|
|
207
|
+
): Record<OrderStatusKey, OrderStatusMapValue> {
|
|
208
|
+
const overrides = cmsLabelsToDisplayOverrides(cmsLabels)
|
|
209
|
+
const localizedMap = {} as Record<OrderStatusKey, OrderStatusMapValue>
|
|
210
|
+
|
|
211
|
+
for (const [key, value] of Object.entries(orderStatusMap) as [
|
|
212
|
+
OrderStatusKey,
|
|
213
|
+
OrderStatusMapValue,
|
|
214
|
+
][]) {
|
|
215
|
+
const override = overrides[value.label.toLowerCase()]
|
|
216
|
+
localizedMap[key] = override ? { ...value, label: override } : value
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
return localizedMap
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
export function getOrderStatusLabel({
|
|
223
|
+
status,
|
|
224
|
+
cmsLabels,
|
|
225
|
+
statusFallback,
|
|
226
|
+
}: {
|
|
227
|
+
status: string
|
|
228
|
+
cmsLabels?: OrderStatusCmsLabels
|
|
229
|
+
statusFallback?: string
|
|
230
|
+
}): string {
|
|
231
|
+
const localizedMap = getLocalizedOrderStatusMap(cmsLabels)
|
|
232
|
+
return localizedMap[status as OrderStatusKey]?.label ?? statusFallback ?? '-'
|
|
233
|
+
}
|
|
234
|
+
|
|
106
235
|
export const groupOrderStatusByLabel = (): Record<string, string[]> => {
|
|
107
236
|
const groupedStatus: Record<string, string[]> = {}
|
|
108
237
|
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { describe, expect, it } from 'vitest'
|
|
2
|
+
|
|
3
|
+
import {
|
|
4
|
+
getLocalizedOrderStatusMap,
|
|
5
|
+
getOrderStatusLabel,
|
|
6
|
+
orderStatusMap,
|
|
7
|
+
} from 'src/utils/userOrderStatus'
|
|
8
|
+
|
|
9
|
+
describe('getLocalizedOrderStatusMap', () => {
|
|
10
|
+
it('returns default labels when CMS labels are not provided', () => {
|
|
11
|
+
const map = getLocalizedOrderStatusMap()
|
|
12
|
+
|
|
13
|
+
expect(map['payment-approved'].label).toBe(
|
|
14
|
+
orderStatusMap['payment-approved'].label
|
|
15
|
+
)
|
|
16
|
+
})
|
|
17
|
+
|
|
18
|
+
it('overrides labels for all statuses in the same group', () => {
|
|
19
|
+
const map = getLocalizedOrderStatusMap({
|
|
20
|
+
paymentApprovedStatus: 'Pagamento aprovado',
|
|
21
|
+
})
|
|
22
|
+
|
|
23
|
+
expect(map['payment-approved'].label).toBe('Pagamento aprovado')
|
|
24
|
+
expect(map['approve-payment'].label).toBe('Pagamento aprovado')
|
|
25
|
+
})
|
|
26
|
+
|
|
27
|
+
it('resolves display label with fallback for unmapped statuses', () => {
|
|
28
|
+
expect(
|
|
29
|
+
getOrderStatusLabel({
|
|
30
|
+
status: 'unknown-status',
|
|
31
|
+
cmsLabels: { canceledStatus: 'Cancelado' },
|
|
32
|
+
statusFallback: 'Custom fallback',
|
|
33
|
+
})
|
|
34
|
+
).toBe('Custom fallback')
|
|
35
|
+
})
|
|
36
|
+
})
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import type { PropsWithChildren } from 'react'
|
|
2
|
-
import menuRoutes from 'src/customizations/src/myAccount/navigation'
|
|
3
|
-
import { USER_DETAILS_ROUTE } from 'src/sdk/account/getMyAccountRoutes'
|
|
4
|
-
import MyAccountMenu from '../MyAccountMenu'
|
|
5
|
-
import styles from '../section.module.scss'
|
|
6
|
-
|
|
7
|
-
export type MyAccountLayoutProps = {
|
|
8
|
-
accountName: string
|
|
9
|
-
isRepresentative?: boolean
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
const ROUTES_ONLY_FOR_REPRESENTATIVE = [USER_DETAILS_ROUTE]
|
|
13
|
-
|
|
14
|
-
const MyAccountLayout = ({
|
|
15
|
-
children,
|
|
16
|
-
accountName,
|
|
17
|
-
isRepresentative = true,
|
|
18
|
-
}: PropsWithChildren<MyAccountLayoutProps>) => {
|
|
19
|
-
const routes = isRepresentative
|
|
20
|
-
? menuRoutes
|
|
21
|
-
: menuRoutes.filter(
|
|
22
|
-
({ route }) => !ROUTES_ONLY_FOR_REPRESENTATIVE.includes(route)
|
|
23
|
-
)
|
|
24
|
-
|
|
25
|
-
return (
|
|
26
|
-
<section className={styles.layout}>
|
|
27
|
-
<MyAccountMenu accountName={accountName} items={routes} />
|
|
28
|
-
<div data-fs-account-layout-content>{children}</div>
|
|
29
|
-
</section>
|
|
30
|
-
)
|
|
31
|
-
}
|
|
32
|
-
export default MyAccountLayout
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default } from './MyAccountLayout'
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default } from './MyAccountMenu'
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import Tag from '../components/MyAccountTag'
|
|
2
|
-
import AccountTable from '../components/MyAccountTable'
|
|
3
|
-
import AccountHeader from '../components/MyAccountHeader'
|
|
4
|
-
import styles from './styles.module.scss'
|
|
5
|
-
|
|
6
|
-
type MyAccountUserDetailsProps = {
|
|
7
|
-
userDetails: {
|
|
8
|
-
username: string
|
|
9
|
-
name: string
|
|
10
|
-
email: string
|
|
11
|
-
phone: string
|
|
12
|
-
role: string[]
|
|
13
|
-
orgUnit: string
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
export default function MyAccountUserDetails({
|
|
18
|
-
userDetails: { username, name, email, phone, role, orgUnit },
|
|
19
|
-
}: MyAccountUserDetailsProps) {
|
|
20
|
-
return (
|
|
21
|
-
<section className={styles.section}>
|
|
22
|
-
<AccountHeader pageTitle="User details" />
|
|
23
|
-
<div data-fs-user-details-container>
|
|
24
|
-
<AccountTable
|
|
25
|
-
rows={[
|
|
26
|
-
{ heading: 'Name', data: name ? name : '–' },
|
|
27
|
-
{ heading: 'Username', data: username ? username : '–' },
|
|
28
|
-
{ heading: 'Phone number', data: phone ? phone : '–' },
|
|
29
|
-
{ heading: 'Email', data: email },
|
|
30
|
-
{
|
|
31
|
-
heading: 'Role',
|
|
32
|
-
data: (
|
|
33
|
-
<span data-fs-user-details-row-tags>
|
|
34
|
-
{role.map((r) => (
|
|
35
|
-
<Tag key={r}>{r}</Tag>
|
|
36
|
-
))}
|
|
37
|
-
</span>
|
|
38
|
-
),
|
|
39
|
-
},
|
|
40
|
-
{ heading: 'Organizational unit', data: orgUnit },
|
|
41
|
-
]}
|
|
42
|
-
/>
|
|
43
|
-
</div>
|
|
44
|
-
</section>
|
|
45
|
-
)
|
|
46
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default } from './MyAccountUserDetails'
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
export { default as MyAccountAccordion } from './MyAccountAccordion'
|
|
2
|
-
export { default as MyAccountAccordionButton } from './MyAccountAccordionButton'
|
|
3
|
-
export { default as MyAccountAccordionItem } from './MyAccountAccordionItem'
|
|
4
|
-
export { default as MyAccountAccordionPanel } from './MyAccountAccordionPanel'
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default } from './MyAccountCard'
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default } from './MyAccountHeader'
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
orderStatusMap,
|
|
3
|
-
type OrderStatusKey,
|
|
4
|
-
type OrderStatusMapValue,
|
|
5
|
-
} from 'src/utils/userOrderStatus'
|
|
6
|
-
|
|
7
|
-
function getStatusVariant({ status }: { status: string }) {
|
|
8
|
-
return (
|
|
9
|
-
(orderStatusMap[status as OrderStatusKey] as OrderStatusMapValue)
|
|
10
|
-
?.variant || 'neutral'
|
|
11
|
-
)
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
function MyAccountStatusBadge({
|
|
15
|
-
status,
|
|
16
|
-
statusFallback,
|
|
17
|
-
}: { status: string; statusFallback?: string }) {
|
|
18
|
-
return (
|
|
19
|
-
<span
|
|
20
|
-
data-fs-my-account-badge
|
|
21
|
-
data-fs-my-account-badge-variant={getStatusVariant({ status })}
|
|
22
|
-
>
|
|
23
|
-
{orderStatusMap[status as OrderStatusKey]?.label || statusFallback || '-'}
|
|
24
|
-
</span>
|
|
25
|
-
)
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
export default MyAccountStatusBadge
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default } from './MyAccountStatusBadge'
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default } from './MyAccountTable'
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default } from './MyAccountTag'
|
|
@@ -1,113 +0,0 @@
|
|
|
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
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default } from './MyAccountFilterSlider'
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default } from './MyAccountListOrdersTable'
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default } from './MyAccountSelectedTags'
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default as MyAccountListOrders } from './MyAccountListOrders'
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default } from './MyAccountBudgetsCard'
|
package/src/components/account/orders/MyAccountOrderDetails/MyAccountBuyingPolicyAlert/index.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default } from './MyAccountBuyingPolicyAlert'
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default } from './MyAccountDeliveryCard'
|