@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
|
@@ -12,8 +12,8 @@ import type {
|
|
|
12
12
|
MyAccountFilter_FacetsFragment,
|
|
13
13
|
useMyAccountFilter,
|
|
14
14
|
} from 'src/sdk/search/useMyAccountFilter'
|
|
15
|
-
import FilterFacetDateRange from './
|
|
16
|
-
import FilterFacetPendingApproval from './
|
|
15
|
+
import FilterFacetDateRange from './FilterFacetDateRange'
|
|
16
|
+
import FilterFacetPendingApproval from './FilterFacetPendingApproval'
|
|
17
17
|
import styles from './section.module.scss'
|
|
18
18
|
|
|
19
19
|
export interface FilterSliderProps {
|
|
@@ -42,9 +42,12 @@ export interface FilterSliderProps {
|
|
|
42
42
|
* Ref to the search input field.
|
|
43
43
|
*/
|
|
44
44
|
searchInputRef?: MutableRefObject<SearchInputFieldRef>
|
|
45
|
+
fromLabel?: string
|
|
46
|
+
toLabel?: string
|
|
47
|
+
invalidDateRangeLabel?: string
|
|
45
48
|
}
|
|
46
49
|
|
|
47
|
-
function
|
|
50
|
+
function FilterSlider({
|
|
48
51
|
facets,
|
|
49
52
|
testId,
|
|
50
53
|
dispatch,
|
|
@@ -54,6 +57,9 @@ function MyAccountFilterSlider({
|
|
|
54
57
|
clearButtonLabel,
|
|
55
58
|
applyButtonLabel,
|
|
56
59
|
searchInputRef,
|
|
60
|
+
fromLabel,
|
|
61
|
+
toLabel,
|
|
62
|
+
invalidDateRangeLabel,
|
|
57
63
|
}: FilterSliderProps & ReturnType<typeof useMyAccountFilter>) {
|
|
58
64
|
const dateRangeInputRef = useRef<{
|
|
59
65
|
clear: () => void
|
|
@@ -220,6 +226,9 @@ function MyAccountFilterSlider({
|
|
|
220
226
|
from={facet.from}
|
|
221
227
|
to={facet.to}
|
|
222
228
|
setDisabled={setDisabled}
|
|
229
|
+
fromLabel={fromLabel}
|
|
230
|
+
toLabel={toLabel}
|
|
231
|
+
invalidDateRangeLabel={invalidDateRangeLabel}
|
|
223
232
|
/>
|
|
224
233
|
)}
|
|
225
234
|
</UIFilterFacets>
|
|
@@ -230,4 +239,4 @@ function MyAccountFilterSlider({
|
|
|
230
239
|
)
|
|
231
240
|
}
|
|
232
241
|
|
|
233
|
-
export default
|
|
242
|
+
export default FilterSlider
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './FilterSlider'
|
|
@@ -18,8 +18,8 @@
|
|
|
18
18
|
@include meta.load-css("~@faststore/ui/src/components/organisms/Filter/styles.scss");
|
|
19
19
|
@include meta.load-css("~@faststore/ui/src/components/organisms/FilterSlider/styles.scss");
|
|
20
20
|
@include meta.load-css("~@faststore/ui/src/components/organisms/SlideOver/styles.scss");
|
|
21
|
-
@include meta.load-css("./
|
|
22
|
-
@include meta.load-css("./
|
|
21
|
+
@include meta.load-css("./FilterFacetDateRange/styles.scss");
|
|
22
|
+
@include meta.load-css("./FilterFacetPendingApproval/styles.scss");
|
|
23
23
|
|
|
24
24
|
[data-fs-badge] {
|
|
25
25
|
display: none;
|
|
@@ -13,7 +13,7 @@ import {
|
|
|
13
13
|
type SearchInputFieldRef,
|
|
14
14
|
} from '@faststore/ui'
|
|
15
15
|
import { useEffect } from 'react'
|
|
16
|
-
import
|
|
16
|
+
import FilterSlider from 'src/components/account/orders/ListOrders/FilterSlider'
|
|
17
17
|
import { useDebounce } from 'src/sdk/account/useDebounce'
|
|
18
18
|
import {
|
|
19
19
|
useMyAccountFilter,
|
|
@@ -22,14 +22,17 @@ import {
|
|
|
22
22
|
} from 'src/sdk/search/useMyAccountFilter'
|
|
23
23
|
import useScreenResize from 'src/sdk/ui/useScreenResize'
|
|
24
24
|
import { FastStoreOrderStatus } from 'src/utils/userOrderStatus'
|
|
25
|
-
import AccountHeader from '../../components/
|
|
26
|
-
import
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
25
|
+
import AccountHeader from '../../components/Header'
|
|
26
|
+
import {
|
|
27
|
+
type ListOrdersSectionLabels,
|
|
28
|
+
getStatusFacetLabels,
|
|
29
|
+
resolveListOrdersLabels,
|
|
30
|
+
} from './listOrdersLabels'
|
|
31
|
+
import ListOrdersTable, { Pagination } from './ListOrdersTable/ListOrdersTable'
|
|
32
|
+
import SelectedFiltersTags from './SelectedTags/SelectedTags'
|
|
30
33
|
import styles from './styles.module.scss'
|
|
31
34
|
|
|
32
|
-
export type
|
|
35
|
+
export type ListOrdersProps = {
|
|
33
36
|
listOrders: ServerListOrdersQueryQuery['listUserOrders']
|
|
34
37
|
total: number
|
|
35
38
|
perPage: number
|
|
@@ -42,12 +45,13 @@ export type MyAccountListOrdersProps = {
|
|
|
42
45
|
clientEmail: string
|
|
43
46
|
pendingMyApproval?: boolean
|
|
44
47
|
}
|
|
48
|
+
labels?: ListOrdersSectionLabels
|
|
45
49
|
}
|
|
46
50
|
|
|
47
51
|
function getSelectedFacets({
|
|
48
52
|
filters,
|
|
49
53
|
}: {
|
|
50
|
-
filters:
|
|
54
|
+
filters: ListOrdersProps['filters']
|
|
51
55
|
}): SelectedFacet[] {
|
|
52
56
|
return Object.keys(filters).reduce((acc, filter) => {
|
|
53
57
|
// FilterSlider does not deal with these filters
|
|
@@ -88,21 +92,25 @@ function getSelectedFacets({
|
|
|
88
92
|
|
|
89
93
|
function getAllFacets({
|
|
90
94
|
filters,
|
|
95
|
+
labels,
|
|
91
96
|
}: {
|
|
92
|
-
filters:
|
|
97
|
+
filters: ListOrdersProps['filters']
|
|
98
|
+
labels: ReturnType<typeof resolveListOrdersLabels>
|
|
93
99
|
}): MyAccountFilter_FacetsFragment[] {
|
|
100
|
+
const statusFacetLabels = getStatusFacetLabels(labels)
|
|
101
|
+
|
|
94
102
|
return [
|
|
95
103
|
{
|
|
96
104
|
__typename: 'StoreFacetPendingApproval',
|
|
97
105
|
key: 'pendingMyApproval',
|
|
98
|
-
label:
|
|
106
|
+
label: labels.pendingApprovalLabel,
|
|
99
107
|
} as any,
|
|
100
108
|
{
|
|
101
109
|
__typename: 'StoreFacetBoolean',
|
|
102
110
|
key: 'status',
|
|
103
111
|
label: 'Status',
|
|
104
|
-
values: FastStoreOrderStatus.map((status) => ({
|
|
105
|
-
label: status,
|
|
112
|
+
values: FastStoreOrderStatus.map((status, index) => ({
|
|
113
|
+
label: statusFacetLabels[index] ?? status,
|
|
106
114
|
quantity: 0,
|
|
107
115
|
selected: false,
|
|
108
116
|
value: status.toLowerCase(),
|
|
@@ -118,9 +126,7 @@ function getAllFacets({
|
|
|
118
126
|
]
|
|
119
127
|
}
|
|
120
128
|
|
|
121
|
-
function hasActiveFilters(
|
|
122
|
-
filters: MyAccountListOrdersProps['filters']
|
|
123
|
-
): boolean {
|
|
129
|
+
function hasActiveFilters(filters: ListOrdersProps['filters']): boolean {
|
|
124
130
|
return (
|
|
125
131
|
filters.status.length > 0 ||
|
|
126
132
|
Boolean(filters.dateInitial) ||
|
|
@@ -130,12 +136,14 @@ function hasActiveFilters(
|
|
|
130
136
|
)
|
|
131
137
|
}
|
|
132
138
|
|
|
133
|
-
export default function
|
|
139
|
+
export default function ListOrders({
|
|
134
140
|
listOrders,
|
|
135
141
|
total,
|
|
136
142
|
perPage,
|
|
137
143
|
filters,
|
|
138
|
-
|
|
144
|
+
labels: labelsProp,
|
|
145
|
+
}: ListOrdersProps) {
|
|
146
|
+
const labels = resolveListOrdersLabels(labelsProp)
|
|
139
147
|
const router = useRouter()
|
|
140
148
|
const { isDesktop } = useScreenResize()
|
|
141
149
|
const searchInputRef = useRef(null) as MutableRefObject<SearchInputFieldRef>
|
|
@@ -179,7 +187,7 @@ export default function MyAccountListOrders({
|
|
|
179
187
|
)
|
|
180
188
|
|
|
181
189
|
const selectedFacets: SelectedFacet[] = getSelectedFacets({ filters })
|
|
182
|
-
const allFacets = getAllFacets({ filters })
|
|
190
|
+
const allFacets = getAllFacets({ filters, labels })
|
|
183
191
|
|
|
184
192
|
const filter = useMyAccountFilter({
|
|
185
193
|
allFacets,
|
|
@@ -193,13 +201,13 @@ export default function MyAccountListOrders({
|
|
|
193
201
|
|
|
194
202
|
return (
|
|
195
203
|
<div className={styles.page}>
|
|
196
|
-
<AccountHeader pageTitle=
|
|
204
|
+
<AccountHeader pageTitle={labels.pageTitle} />
|
|
197
205
|
<div data-fs-list-orders-controls>
|
|
198
206
|
<div data-fs-list-orders-search-filters>
|
|
199
207
|
<SearchInputField
|
|
200
208
|
ref={searchInputRef}
|
|
201
209
|
data-fs-search-input-field-list-orders
|
|
202
|
-
placeholder=
|
|
210
|
+
placeholder={labels.searchPlaceholder}
|
|
203
211
|
onBlur={(_) => {
|
|
204
212
|
handleSearchChange(searchInputRef.current.inputRef.value)
|
|
205
213
|
}}
|
|
@@ -233,15 +241,21 @@ export default function MyAccountListOrders({
|
|
|
233
241
|
openFilter()
|
|
234
242
|
}}
|
|
235
243
|
>
|
|
236
|
-
|
|
244
|
+
{labels.filtersLabel}
|
|
237
245
|
</Button>
|
|
238
246
|
</div>
|
|
239
247
|
{isDesktop && (
|
|
240
|
-
<Pagination
|
|
248
|
+
<Pagination
|
|
249
|
+
page={filters.page}
|
|
250
|
+
total={total}
|
|
251
|
+
perPage={perPage}
|
|
252
|
+
labels={labels}
|
|
253
|
+
/>
|
|
241
254
|
)}
|
|
242
255
|
</div>
|
|
243
256
|
|
|
244
257
|
<SelectedFiltersTags
|
|
258
|
+
labels={labels}
|
|
245
259
|
filters={{
|
|
246
260
|
status: filters.status,
|
|
247
261
|
dateInitial: filters.dateInitial,
|
|
@@ -280,11 +294,14 @@ export default function MyAccountListOrders({
|
|
|
280
294
|
/>
|
|
281
295
|
|
|
282
296
|
{displayFilter && (
|
|
283
|
-
<
|
|
297
|
+
<FilterSlider
|
|
284
298
|
{...filter}
|
|
285
|
-
title=
|
|
286
|
-
clearButtonLabel=
|
|
287
|
-
applyButtonLabel=
|
|
299
|
+
title={labels.filtersLabel}
|
|
300
|
+
clearButtonLabel={labels.clearAllLabel}
|
|
301
|
+
applyButtonLabel={labels.viewResultsLabel}
|
|
302
|
+
fromLabel={labels.fromLabel}
|
|
303
|
+
toLabel={labels.toLabel}
|
|
304
|
+
invalidDateRangeLabel={labels.invalidDateRangeLabel}
|
|
288
305
|
searchInputRef={searchInputRef}
|
|
289
306
|
testId="my-account-filter-slider"
|
|
290
307
|
/>
|
|
@@ -300,7 +317,7 @@ export default function MyAccountListOrders({
|
|
|
300
317
|
weight="thin"
|
|
301
318
|
/>
|
|
302
319
|
}
|
|
303
|
-
title={hasFilters ?
|
|
320
|
+
title={hasFilters ? labels.noResultsLabel : labels.noOrdersLabel}
|
|
304
321
|
bkgColor="light"
|
|
305
322
|
>
|
|
306
323
|
{!hasFilters && (
|
|
@@ -309,20 +326,26 @@ export default function MyAccountListOrders({
|
|
|
309
326
|
href="/"
|
|
310
327
|
variant="secondary"
|
|
311
328
|
>
|
|
312
|
-
|
|
329
|
+
{labels.startShoppingLabel}
|
|
313
330
|
</LinkButton>
|
|
314
331
|
)}
|
|
315
332
|
</EmptyState>
|
|
316
333
|
) : (
|
|
317
|
-
<
|
|
334
|
+
<ListOrdersTable
|
|
318
335
|
listOrders={listOrders}
|
|
319
336
|
total={total}
|
|
320
337
|
perPage={perPage}
|
|
321
338
|
filters={filters}
|
|
339
|
+
labels={labels}
|
|
322
340
|
/>
|
|
323
341
|
)}
|
|
324
342
|
{!isDesktop && (
|
|
325
|
-
<Pagination
|
|
343
|
+
<Pagination
|
|
344
|
+
page={filters.page}
|
|
345
|
+
total={total}
|
|
346
|
+
perPage={perPage}
|
|
347
|
+
labels={labels}
|
|
348
|
+
/>
|
|
326
349
|
)}
|
|
327
350
|
</div>
|
|
328
351
|
)
|
|
@@ -5,6 +5,8 @@ type ExpandButtonProps = {
|
|
|
5
5
|
onToggle: (e: React.MouseEvent<HTMLButtonElement>) => void
|
|
6
6
|
count: number
|
|
7
7
|
label?: string
|
|
8
|
+
viewAllLabel?: string
|
|
9
|
+
viewLessLabel?: string
|
|
8
10
|
ariaControls?: string
|
|
9
11
|
}
|
|
10
12
|
|
|
@@ -12,6 +14,8 @@ export function ExpandButton({
|
|
|
12
14
|
isExpanded,
|
|
13
15
|
onToggle,
|
|
14
16
|
label,
|
|
17
|
+
viewAllLabel = 'View all',
|
|
18
|
+
viewLessLabel = 'View less',
|
|
15
19
|
ariaControls,
|
|
16
20
|
}: ExpandButtonProps) {
|
|
17
21
|
return (
|
|
@@ -36,7 +40,7 @@ export function ExpandButton({
|
|
|
36
40
|
onToggle(e)
|
|
37
41
|
}}
|
|
38
42
|
>
|
|
39
|
-
{isExpanded ?
|
|
43
|
+
{isExpanded ? viewLessLabel : (label ?? viewAllLabel)}
|
|
40
44
|
</Button>
|
|
41
45
|
)
|
|
42
46
|
}
|
|
@@ -2,13 +2,18 @@ import { Icon, IconButton } from '@faststore/ui'
|
|
|
2
2
|
|
|
3
3
|
import { useState } from 'react'
|
|
4
4
|
|
|
5
|
-
import
|
|
5
|
+
import StatusBadge from 'src/components/account/components/StatusBadge'
|
|
6
6
|
import { useFormatPrice } from 'src/components/account/utils/useFormatPrice'
|
|
7
7
|
import { useSession } from 'src/sdk/session'
|
|
8
8
|
import useScreenResize from 'src/sdk/ui/useScreenResize'
|
|
9
9
|
import { ExpandButton } from './ExpandButton/ExpandButton'
|
|
10
10
|
|
|
11
11
|
import type { ServerListOrdersQueryQuery } from '@generated/graphql'
|
|
12
|
+
import type { ListOrdersSectionLabels } from '../listOrdersLabels'
|
|
13
|
+
import {
|
|
14
|
+
pickOrderStatusCmsLabels,
|
|
15
|
+
resolveListOrdersLabels,
|
|
16
|
+
} from '../listOrdersLabels'
|
|
12
17
|
|
|
13
18
|
const MAX_ITEM_FIELDS = 5
|
|
14
19
|
const MAX_ORDER_FIELDS = 5
|
|
@@ -21,7 +26,7 @@ function formatOrderDate(date: string, locale: string) {
|
|
|
21
26
|
})
|
|
22
27
|
}
|
|
23
28
|
|
|
24
|
-
type
|
|
29
|
+
type ListOrdersTableProps = {
|
|
25
30
|
listOrders: ServerListOrdersQueryQuery['listUserOrders']
|
|
26
31
|
total: number
|
|
27
32
|
perPage: number
|
|
@@ -40,11 +45,14 @@ export function Pagination({
|
|
|
40
45
|
page,
|
|
41
46
|
total,
|
|
42
47
|
perPage,
|
|
48
|
+
labels: labelsProp,
|
|
43
49
|
}: {
|
|
44
50
|
page: number
|
|
45
51
|
total: number
|
|
46
52
|
perPage: number
|
|
53
|
+
labels?: ListOrdersSectionLabels
|
|
47
54
|
}) {
|
|
55
|
+
const labels = resolveListOrdersLabels(labelsProp)
|
|
48
56
|
const totalPages = Math.ceil(total / perPage)
|
|
49
57
|
const firstIndexLabel = page === 1 ? 1 : (page - 1) * perPage + 1
|
|
50
58
|
const lastIndexLabel =
|
|
@@ -64,14 +72,14 @@ export function Pagination({
|
|
|
64
72
|
|
|
65
73
|
return (
|
|
66
74
|
<div data-fs-list-orders-table-pagination>
|
|
67
|
-
<p>{`${firstIndexLabel} — ${lastIndexLabel}
|
|
75
|
+
<p>{`${firstIndexLabel} — ${lastIndexLabel} ${labels.paginationOfLabel} ${total}`}</p>
|
|
68
76
|
<IconButton
|
|
69
77
|
size="small"
|
|
70
78
|
variant="tertiary"
|
|
71
79
|
disabled={page === 1}
|
|
72
80
|
onClick={() => handlePageChange(page - 1)}
|
|
73
81
|
icon={<Icon name="CaretLeft" />}
|
|
74
|
-
aria-label=
|
|
82
|
+
aria-label={labels.previousPageLabel}
|
|
75
83
|
/>
|
|
76
84
|
<IconButton
|
|
77
85
|
size="small"
|
|
@@ -79,18 +87,23 @@ export function Pagination({
|
|
|
79
87
|
disabled={page === totalPages}
|
|
80
88
|
onClick={() => handlePageChange(page + 1)}
|
|
81
89
|
icon={<Icon name="CaretRight" />}
|
|
82
|
-
aria-label=
|
|
90
|
+
aria-label={labels.nextPageLabel}
|
|
83
91
|
/>
|
|
84
92
|
</div>
|
|
85
93
|
)
|
|
86
94
|
}
|
|
87
95
|
|
|
88
|
-
export default function
|
|
96
|
+
export default function ListOrdersTable({
|
|
89
97
|
listOrders,
|
|
90
98
|
total,
|
|
91
99
|
perPage,
|
|
92
100
|
filters,
|
|
93
|
-
|
|
101
|
+
labels: labelsProp,
|
|
102
|
+
}: ListOrdersTableProps & {
|
|
103
|
+
labels?: ListOrdersSectionLabels
|
|
104
|
+
}) {
|
|
105
|
+
const labels = resolveListOrdersLabels(labelsProp)
|
|
106
|
+
const statusLabels = pickOrderStatusCmsLabels(labels)
|
|
94
107
|
const { isDesktop } = useScreenResize()
|
|
95
108
|
const { locale } = useSession()
|
|
96
109
|
const formatPrice = useFormatPrice()
|
|
@@ -157,7 +170,7 @@ export default function MyAccountListOrdersTable({
|
|
|
157
170
|
: '-'
|
|
158
171
|
const totalPrice = formatPrice(item.totalValue, item.currencyCode)
|
|
159
172
|
const deliveryBy = item.ShippingEstimatedDate
|
|
160
|
-
?
|
|
173
|
+
? `${labels.deliveryByLabel} ${formatOrderDate(
|
|
161
174
|
item.ShippingEstimatedDate,
|
|
162
175
|
locale
|
|
163
176
|
)}`
|
|
@@ -208,7 +221,7 @@ export default function MyAccountListOrdersTable({
|
|
|
208
221
|
<td data-fs-list-orders-table-cell>
|
|
209
222
|
<div data-fs-list-orders-table-product-info>
|
|
210
223
|
<p data-fs-list-orders-table-product-info-label>
|
|
211
|
-
|
|
224
|
+
{labels.placedOnLabel}
|
|
212
225
|
</p>
|
|
213
226
|
<p
|
|
214
227
|
data-fs-list-orders-table-product-info-value
|
|
@@ -220,7 +233,7 @@ export default function MyAccountListOrdersTable({
|
|
|
220
233
|
{hasOrderOrItemCustomFields && (
|
|
221
234
|
<div data-fs-list-orders-table-product-info>
|
|
222
235
|
<p data-fs-list-orders-table-product-info-label>
|
|
223
|
-
|
|
236
|
+
{labels.deliveryByLabel}
|
|
224
237
|
</p>
|
|
225
238
|
<p
|
|
226
239
|
data-fs-list-orders-table-product-info-value
|
|
@@ -259,6 +272,8 @@ export default function MyAccountListOrdersTable({
|
|
|
259
272
|
ariaControls={additionalInfoIdOrder}
|
|
260
273
|
isExpanded={isOrderFieldsExpanded}
|
|
261
274
|
count={orderLevel.length - MAX_ORDER_FIELDS}
|
|
275
|
+
viewAllLabel={labels.viewAllLabel}
|
|
276
|
+
viewLessLabel={labels.viewLessLabel}
|
|
262
277
|
onToggle={() =>
|
|
263
278
|
handleToggle(item.orderId, 'order')
|
|
264
279
|
}
|
|
@@ -295,6 +310,8 @@ export default function MyAccountListOrdersTable({
|
|
|
295
310
|
ariaControls={additionalInfoIdItem}
|
|
296
311
|
isExpanded={isItemFieldsExpanded}
|
|
297
312
|
count={itemLevel.length - MAX_ITEM_FIELDS}
|
|
313
|
+
viewAllLabel={labels.viewAllLabel}
|
|
314
|
+
viewLessLabel={labels.viewLessLabel}
|
|
298
315
|
onToggle={() =>
|
|
299
316
|
handleToggle(item.orderId, 'item')
|
|
300
317
|
}
|
|
@@ -307,9 +324,10 @@ export default function MyAccountListOrdersTable({
|
|
|
307
324
|
)}
|
|
308
325
|
|
|
309
326
|
<td data-fs-list-orders-table-cell>
|
|
310
|
-
<
|
|
327
|
+
<StatusBadge
|
|
311
328
|
status={item.status}
|
|
312
329
|
statusFallback={item.statusDescription}
|
|
330
|
+
statusLabels={statusLabels}
|
|
313
331
|
/>
|
|
314
332
|
{!isDesktop && <p>{deliveryBy}</p>}
|
|
315
333
|
</td>
|
|
@@ -319,7 +337,12 @@ export default function MyAccountListOrdersTable({
|
|
|
319
337
|
</tbody>
|
|
320
338
|
</table>
|
|
321
339
|
{isDesktop && (
|
|
322
|
-
<Pagination
|
|
340
|
+
<Pagination
|
|
341
|
+
page={filters.page}
|
|
342
|
+
total={total}
|
|
343
|
+
perPage={perPage}
|
|
344
|
+
labels={labels}
|
|
345
|
+
/>
|
|
323
346
|
)}
|
|
324
347
|
</>
|
|
325
348
|
)
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './ListOrdersTable'
|
|
@@ -1,8 +1,13 @@
|
|
|
1
1
|
import { Button } from '@faststore/ui'
|
|
2
2
|
import { useSession } from 'src/sdk/session'
|
|
3
|
-
import {
|
|
3
|
+
import {
|
|
4
|
+
type ListOrdersSectionLabels,
|
|
5
|
+
getStatusDisplayLabels,
|
|
6
|
+
resolveListOrdersLabels,
|
|
7
|
+
} from '../listOrdersLabels'
|
|
4
8
|
|
|
5
|
-
type
|
|
9
|
+
type SelectedTagsProps = {
|
|
10
|
+
labels?: ListOrdersSectionLabels
|
|
6
11
|
filters: {
|
|
7
12
|
status?: string[]
|
|
8
13
|
dateInitial?: string
|
|
@@ -39,7 +44,10 @@ function formatFilterDate(date: string, locale: string) {
|
|
|
39
44
|
function Tags({
|
|
40
45
|
filters,
|
|
41
46
|
onRemoveFilter,
|
|
42
|
-
|
|
47
|
+
labels: labelsProp,
|
|
48
|
+
}: Pick<SelectedTagsProps, 'filters' | 'onRemoveFilter' | 'labels'>) {
|
|
49
|
+
const labels = resolveListOrdersLabels(labelsProp)
|
|
50
|
+
const statusDisplayLabels = getStatusDisplayLabels(labels)
|
|
43
51
|
const { locale } = useSession()
|
|
44
52
|
const { dateInitial, dateFinal, status, pendingMyApproval } = filters
|
|
45
53
|
|
|
@@ -73,11 +81,7 @@ function Tags({
|
|
|
73
81
|
|
|
74
82
|
const statusTags = (status || []).map((value) => (
|
|
75
83
|
<div key={`status-${value}`} data-fs-list-orders-selected-tag>
|
|
76
|
-
<span>
|
|
77
|
-
{FastStoreOrderStatusWithLabels[
|
|
78
|
-
value.toLowerCase() as keyof typeof FastStoreOrderStatusWithLabels
|
|
79
|
-
] || value}
|
|
80
|
-
</span>
|
|
84
|
+
<span>{statusDisplayLabels[value.toLowerCase()] || value}</span>
|
|
81
85
|
<button
|
|
82
86
|
data-fs-list-orders-selected-tag-clear
|
|
83
87
|
onClick={() => onRemoveFilter('status', value)}
|
|
@@ -89,7 +93,7 @@ function Tags({
|
|
|
89
93
|
|
|
90
94
|
const pendingMyApprovalTag = pendingMyApproval && (
|
|
91
95
|
<div key="pending-approval" data-fs-list-orders-selected-tag>
|
|
92
|
-
<span>
|
|
96
|
+
<span>{labels.pendingApprovalLabel}</span>
|
|
93
97
|
<button
|
|
94
98
|
data-fs-list-orders-selected-tag-clear
|
|
95
99
|
onClick={() => onRemoveFilter('pendingMyApproval', pendingMyApproval)}
|
|
@@ -108,11 +112,13 @@ function Tags({
|
|
|
108
112
|
)
|
|
109
113
|
}
|
|
110
114
|
|
|
111
|
-
function
|
|
115
|
+
function SelectedTags({
|
|
112
116
|
filters,
|
|
113
117
|
onClearAll,
|
|
114
118
|
onRemoveFilter,
|
|
115
|
-
|
|
119
|
+
labels: labelsProp,
|
|
120
|
+
}: SelectedTagsProps) {
|
|
121
|
+
const labels = resolveListOrdersLabels(labelsProp)
|
|
116
122
|
const hasFilters = Object.entries(filters).some(
|
|
117
123
|
([key, values]) =>
|
|
118
124
|
(key === 'status' ||
|
|
@@ -127,14 +133,18 @@ function MyAccountSelectedTags({
|
|
|
127
133
|
<>
|
|
128
134
|
{hasFilters && (
|
|
129
135
|
<div data-fs-list-orders-selected-tags>
|
|
130
|
-
<Tags
|
|
136
|
+
<Tags
|
|
137
|
+
filters={filters}
|
|
138
|
+
onRemoveFilter={onRemoveFilter}
|
|
139
|
+
labels={labels}
|
|
140
|
+
/>
|
|
131
141
|
<Button
|
|
132
142
|
variant="tertiary"
|
|
133
143
|
size="small"
|
|
134
144
|
data-fs-list-orders-selected-tags-clear-all-button
|
|
135
145
|
onClick={onClearAll}
|
|
136
146
|
>
|
|
137
|
-
|
|
147
|
+
{labels.clearAllLabel}
|
|
138
148
|
</Button>
|
|
139
149
|
</div>
|
|
140
150
|
)}
|
|
@@ -142,4 +152,4 @@ function MyAccountSelectedTags({
|
|
|
142
152
|
)
|
|
143
153
|
}
|
|
144
154
|
|
|
145
|
-
export default
|
|
155
|
+
export default SelectedTags
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './SelectedTags'
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as ListOrders } from './ListOrders'
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import type { OrderStatusCmsLabels } from 'src/utils/userOrderStatus'
|
|
2
|
+
import { pickOrderStatusCmsLabels as pickOrderStatusCmsLabelsFromData } from 'src/utils/userOrderStatus'
|
|
3
|
+
|
|
4
|
+
export type ListOrdersSectionLabels = {
|
|
5
|
+
pageTitle?: string
|
|
6
|
+
searchPlaceholder?: string
|
|
7
|
+
filtersLabel?: string
|
|
8
|
+
clearAllLabel?: string
|
|
9
|
+
viewResultsLabel?: string
|
|
10
|
+
noResultsLabel?: string
|
|
11
|
+
noOrdersLabel?: string
|
|
12
|
+
startShoppingLabel?: string
|
|
13
|
+
placedOnLabel?: string
|
|
14
|
+
deliveryByLabel?: string
|
|
15
|
+
pendingApprovalLabel?: string
|
|
16
|
+
paginationOfLabel?: string
|
|
17
|
+
previousPageLabel?: string
|
|
18
|
+
nextPageLabel?: string
|
|
19
|
+
viewAllLabel?: string
|
|
20
|
+
viewLessLabel?: string
|
|
21
|
+
fromLabel?: string
|
|
22
|
+
toLabel?: string
|
|
23
|
+
invalidDateRangeLabel?: string
|
|
24
|
+
orderPlacedStatus?: string
|
|
25
|
+
pendingApprovalStatus?: string
|
|
26
|
+
paymentPendingStatus?: string
|
|
27
|
+
paymentApprovedStatus?: string
|
|
28
|
+
paymentDeniedStatus?: string
|
|
29
|
+
readyForDeliveryStatus?: string
|
|
30
|
+
invoicedStatus?: string
|
|
31
|
+
cancellationRequestedStatus?: string
|
|
32
|
+
canceledStatus?: string
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export const defaultListOrdersLabels: Required<ListOrdersSectionLabels> = {
|
|
36
|
+
pageTitle: 'Orders',
|
|
37
|
+
searchPlaceholder: 'Search',
|
|
38
|
+
filtersLabel: 'Filters',
|
|
39
|
+
clearAllLabel: 'Clear All',
|
|
40
|
+
viewResultsLabel: 'View Results',
|
|
41
|
+
noResultsLabel: 'No results found',
|
|
42
|
+
noOrdersLabel: "You don't have any orders",
|
|
43
|
+
startShoppingLabel: 'Start shopping',
|
|
44
|
+
placedOnLabel: 'Placed on',
|
|
45
|
+
deliveryByLabel: 'Delivery by',
|
|
46
|
+
pendingApprovalLabel: 'Pending my approval',
|
|
47
|
+
paginationOfLabel: 'of',
|
|
48
|
+
previousPageLabel: 'Previous Page',
|
|
49
|
+
nextPageLabel: 'Next Page',
|
|
50
|
+
viewAllLabel: 'View all',
|
|
51
|
+
viewLessLabel: 'View less',
|
|
52
|
+
fromLabel: 'From',
|
|
53
|
+
toLabel: 'To',
|
|
54
|
+
invalidDateRangeLabel: 'Invalid date range',
|
|
55
|
+
orderPlacedStatus: 'Order Placed',
|
|
56
|
+
pendingApprovalStatus: 'Pending approval',
|
|
57
|
+
paymentPendingStatus: 'Payment Pending',
|
|
58
|
+
paymentApprovedStatus: 'Payment Approved',
|
|
59
|
+
paymentDeniedStatus: 'Payment Denied',
|
|
60
|
+
readyForDeliveryStatus: 'Ready for Delivery',
|
|
61
|
+
invoicedStatus: 'Invoiced',
|
|
62
|
+
cancellationRequestedStatus: 'Cancellation Requested',
|
|
63
|
+
canceledStatus: 'Canceled',
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
const STATUS_LABEL_KEYS = [
|
|
67
|
+
'orderPlacedStatus',
|
|
68
|
+
'pendingApprovalStatus',
|
|
69
|
+
'paymentPendingStatus',
|
|
70
|
+
'paymentApprovedStatus',
|
|
71
|
+
'paymentDeniedStatus',
|
|
72
|
+
'readyForDeliveryStatus',
|
|
73
|
+
'invoicedStatus',
|
|
74
|
+
'cancellationRequestedStatus',
|
|
75
|
+
'canceledStatus',
|
|
76
|
+
] as const satisfies readonly (keyof ListOrdersSectionLabels)[]
|
|
77
|
+
|
|
78
|
+
export function resolveListOrdersLabels(
|
|
79
|
+
labels?: ListOrdersSectionLabels
|
|
80
|
+
): Required<ListOrdersSectionLabels> {
|
|
81
|
+
return { ...defaultListOrdersLabels, ...labels }
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
export function getStatusDisplayLabels(
|
|
85
|
+
labels: Required<ListOrdersSectionLabels>
|
|
86
|
+
): Record<string, string> {
|
|
87
|
+
return {
|
|
88
|
+
'order placed': labels.orderPlacedStatus,
|
|
89
|
+
'pending approval': labels.pendingApprovalStatus,
|
|
90
|
+
'payment pending': labels.paymentPendingStatus,
|
|
91
|
+
'payment approved': labels.paymentApprovedStatus,
|
|
92
|
+
'payment denied': labels.paymentDeniedStatus,
|
|
93
|
+
'ready for delivery': labels.readyForDeliveryStatus,
|
|
94
|
+
invoiced: labels.invoicedStatus,
|
|
95
|
+
'cancellation requested': labels.cancellationRequestedStatus,
|
|
96
|
+
canceled: labels.canceledStatus,
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
export function getStatusFacetLabels(
|
|
101
|
+
labels: Required<ListOrdersSectionLabels>
|
|
102
|
+
): string[] {
|
|
103
|
+
return STATUS_LABEL_KEYS.map((key) => labels[key])
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
export function pickOrderStatusCmsLabels(
|
|
107
|
+
labels?: ListOrdersSectionLabels
|
|
108
|
+
): OrderStatusCmsLabels | undefined {
|
|
109
|
+
return pickOrderStatusCmsLabelsFromData(
|
|
110
|
+
labels as Record<string, unknown> | undefined
|
|
111
|
+
)
|
|
112
|
+
}
|