@vtex/faststore-plugin-buyer-portal 2.0.13 → 2.0.14
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/CHANGELOG.md +18 -1
- package/cms/b2b/components/.gitkeep +0 -0
- package/cms/b2b/pages/cms_content_type__i18n.jsonc +36 -0
- package/cypress/integration/localization.test.ts +482 -0
- package/cypress/support/commands.ts +8 -0
- package/docs/i18n/i18n-messages-format.md +391 -0
- package/docs/i18n/locales.json +701 -0
- package/docs/i18n/migration-inventory.md +959 -0
- package/package.json +3 -3
- package/specs/custom-localization-system.md +711 -0
- package/specs/multi-locale-e2e-validation.md +277 -0
- package/src/__mocks__/discovery.config.ts +12 -0
- package/src/features/accounting-fields/components/AccountingConfirmDelete/AccountingConfirmDelete.tsx +14 -4
- package/src/features/accounting-fields/components/AccountingFieldConfirmEdit/AccountingFieldConfirmEdit.tsx +11 -6
- package/src/features/accounting-fields/components/AccountingFieldDropdown/AccountingFieldDropdown.tsx +5 -3
- package/src/features/accounting-fields/components/AccountingFieldForm/AccountingFieldForm.tsx +33 -23
- package/src/features/accounting-fields/components/AccountingValueConfirmEdit/AccountingValueConfirmEdit.tsx +10 -6
- package/src/features/accounting-fields/components/AccountingValueDropdown/AccountingValueDropdown.tsx +19 -9
- package/src/features/accounting-fields/components/AccountingValueForm/AccountingValueForm.tsx +21 -10
- package/src/features/accounting-fields/components/CreateAccountingFieldDrawer/CreateAccountingFieldDrawer.tsx +11 -8
- package/src/features/accounting-fields/components/CreateAccountingValueDrawer/CreateAccountingValueDrawer.tsx +18 -7
- package/src/features/accounting-fields/components/DeleteAccountingFieldDrawer/DeleteAccountingFieldDrawer.tsx +14 -12
- package/src/features/accounting-fields/components/DeleteAccountingValueDrawer/DeleteAccountingValueDrawer.tsx +20 -10
- package/src/features/accounting-fields/components/EditAccountingFieldDrawer/EditAccountingFieldDrawer.tsx +5 -3
- package/src/features/accounting-fields/components/EditAccountingValueDrawer/EditAccountingValueDrawer.tsx +13 -6
- package/src/features/accounting-fields/components/RemoveValueFromUnitDrawer/RemoveValueFromUnitDrawer.tsx +19 -8
- package/src/features/accounting-fields/layouts/AccountingFieldLayout/AccountingFieldLayout.tsx +11 -9
- package/src/features/addresses/components/AddRecipientsDrawer/AddRecipientsDrawer.tsx +13 -7
- package/src/features/addresses/components/AddressDropdownMenu/AddressDropdownMenu.tsx +22 -20
- package/src/features/addresses/components/AddressForm/AddressForm.tsx +33 -22
- package/src/features/addresses/components/AddressLine/AddressLine.tsx +29 -25
- package/src/features/addresses/components/AddressLocationsList/AddressLocationsList.tsx +15 -6
- package/src/features/addresses/components/AddressRecipientsList/AddressRecipientsList.tsx +9 -4
- package/src/features/addresses/components/AddressesCard/AddressesCard.tsx +8 -5
- package/src/features/addresses/components/CreateAddressDrawer/CreateAddressDrawer.tsx +27 -14
- package/src/features/addresses/components/CreateAddressSettingsDrawer/CreateAddressSettingsDrawer.tsx +26 -21
- package/src/features/addresses/components/DeleteAddressDrawer/DeleteAddressDrawer.tsx +20 -16
- package/src/features/addresses/components/DeleteAddressLocationDrawer/DeleteAddressLocationDrawer.tsx +26 -14
- package/src/features/addresses/components/DeleteRecipientAddressDrawer/DeleteRecipientAddressDrawer.tsx +20 -17
- package/src/features/addresses/components/EditAddressDrawer/EditAddressDrawer.tsx +12 -6
- package/src/features/addresses/components/EditAddressLocationDrawer/EditAddressLocationDrawer.tsx +24 -17
- package/src/features/addresses/components/EditRecipientAddressDrawer/EditRecipientAddressDrawer.tsx +17 -15
- package/src/features/addresses/components/LocationForm/LocationField/LocationField.tsx +8 -5
- package/src/features/addresses/components/LocationForm/LocationForm.tsx +9 -3
- package/src/features/addresses/components/LocationsDrawer/LocationsDrawer.tsx +15 -9
- package/src/features/addresses/components/RecipientsForm/RecipientItem/RecipientItem.tsx +55 -46
- package/src/features/addresses/components/RecipientsForm/RecipientsForm.tsx +4 -1
- package/src/features/addresses/components/RemoveAddressDrawer/RemoveAddressDrawer.tsx +21 -14
- package/src/features/addresses/layouts/AddressDetailsLayout/AddressDetailsLayout.tsx +16 -9
- package/src/features/addresses/layouts/AddressesLayout/AddressesLayout.tsx +11 -8
- package/src/features/b2b-agent/layouts/B2BAgentLayout/B2BAgentLayout.tsx +3 -1
- package/src/features/budgets/components/BudgetAddForm/BudgetAddForm.tsx +14 -12
- package/src/features/budgets/components/BudgetAddSuccess/BudgetAddSuccess.tsx +16 -14
- package/src/features/budgets/components/BudgetAllocationsSelection/BudgetAllocationsSelection.tsx +8 -5
- package/src/features/budgets/components/BudgetAllocationsTable/BudgetAllocationsTable.tsx +9 -6
- package/src/features/budgets/components/BudgetDeleteDrawer/BudgetDeleteDrawer.tsx +23 -17
- package/src/features/budgets/components/BudgetEditNotificationDrawer/BudgetEditNotificationDrawer.tsx +13 -6
- package/src/features/budgets/components/BudgetNotificationForm/BudgetNotificationForm.tsx +31 -24
- package/src/features/budgets/components/BudgetNotificationsInfo/BudgetNotificationsInfo.tsx +15 -9
- package/src/features/budgets/components/BudgetRemainingBalance/BudgetRemainingBalance.tsx +6 -2
- package/src/features/budgets/components/BudgetSettingsInfo/BudgetSettingsInfo.tsx +27 -10
- package/src/features/budgets/components/BudgetUsersTable/BudgetUsersTable.tsx +14 -7
- package/src/features/budgets/components/BudgetsTable/BudgetsTable.tsx +11 -8
- package/src/features/budgets/components/CreateBudgetAllocationDrawer/CreateBudgetAllocationDrawer.tsx +8 -5
- package/src/features/budgets/components/CreateBudgetDrawer/CreateBudgetDrawer.tsx +31 -18
- package/src/features/budgets/components/DeleteBudgetAllocationDrawer/DeleteBudgetAllocationDrawer.tsx +17 -12
- package/src/features/budgets/components/EditBudgetDrawer/EditBudgetDrawer.tsx +14 -8
- package/src/features/budgets/components/EmptyState.tsx/EmptyState.tsx +4 -1
- package/src/features/budgets/layouts/BudgetsDetailsLayout/BudgetsDetailsLayout.tsx +7 -5
- package/src/features/budgets/layouts/BudgetsLayout/BudgetsLayout.tsx +5 -3
- package/src/features/budgets/messages/budgetNotifications.ts +5 -5
- package/src/features/budgets/utils/handleBudgetError.tsx +5 -8
- package/src/features/budgets/utils/handleBudgetError.types.ts +3 -0
- package/src/features/buying-policies/components/AccountingFieldCriteriaSelector/AccountingFieldCriteriaSelector.tsx +5 -3
- package/src/features/buying-policies/components/AccountingFieldCriteriaSelector/AccountingValueCriteriaSelector.tsx +20 -9
- package/src/features/buying-policies/components/AddBuyingPolicyDrawer/AddBuyingPolicyDrawer.tsx +8 -5
- package/src/features/buying-policies/components/BasicBuyingPolicyDrawer/BasicBuyingPolicyDrawer.tsx +49 -33
- package/src/features/buying-policies/components/BudgetCriteriaSelector/BudgetCriteriaSelector.tsx +8 -2
- package/src/features/buying-policies/components/BuyingPolicyDropdownMenu/BuyingPolicyDropdownMenu.tsx +5 -3
- package/src/features/buying-policies/components/DeleteBuyingPolicyDrawer/DeleteBuyingPolicyDrawer.tsx +28 -24
- package/src/features/buying-policies/components/UpdateBuyingPolicyDrawer/UpdateBuyingPolicyDrawer.tsx +10 -7
- package/src/features/buying-policies/layouts/BuyingPoliciesLayout/BuyingPoliciesLayout.tsx +11 -4
- package/src/features/buying-policies/layouts/BuyingPolicyDetailsLayout/BuyingPolicyDetailsLayout.tsx +26 -9
- package/src/features/buying-policies/utils/accountingFieldCriteriaHelpers.ts +2 -2
- package/src/features/buying-policies/utils/buyingPoliciesWorkflowTypes.ts +3 -3
- package/src/features/buying-policies/utils/orderFieldsCriteriaOptions.ts +8 -8
- package/src/features/buying-policies/utils/spendingLimitsCriteriaOptions.ts +6 -6
- package/src/features/contracts/components/ContractsCard/ContractsCard.tsx +7 -5
- package/src/features/contracts/layouts/ContractsLayout/ContractsLayout.tsx +9 -4
- package/src/features/credit-cards/components/CreateCreditCardDrawer/CreateCreditCardDrawer.tsx +17 -11
- package/src/features/credit-cards/components/CreditCardDropdownMenu/CreditCardDropdownMenu.tsx +17 -11
- package/src/features/credit-cards/components/CreditCardForm/CreditCardForm.tsx +8 -5
- package/src/features/credit-cards/components/CreditCardSettingsDrawer/CreditCardSettingsDrawer.tsx +10 -8
- package/src/features/credit-cards/components/DeleteCreditCardDrawer/DeleteCreditCardDrawer.tsx +19 -14
- package/src/features/credit-cards/components/EditCreditCardDrawer/EditCreditCardDrawer.tsx +14 -13
- package/src/features/credit-cards/components/RemoveCreditCardDrawer/RemoveCreditCardDrawer.tsx +18 -15
- package/src/features/credit-cards/layouts/CreditCardsLayout/CreditCardLayout.tsx +10 -4
- package/src/features/order-entry/layouts/OrderEntryLayout.tsx +3 -1
- package/src/features/org-units/components/AddAllToOrgUnitDropdown/AddAllToOrgUnitDropdown.tsx +11 -9
- package/src/features/org-units/components/AuthSetupDrawer/AuthSetupDrawer.tsx +28 -16
- package/src/features/org-units/components/CreateOrgUnitDrawer/CreateOrgUnitDrawer.tsx +18 -12
- package/src/features/org-units/components/DeleteOrgUnitDrawer/DeleteOrgUnitDrawer.tsx +28 -29
- package/src/features/org-units/components/OrgUnitBreadcrumb/OrgUnitBreadcrumbLink.tsx +4 -4
- package/src/features/org-units/components/OrgUnitDetailsDropdownMenu/OrgUnitDetailsDropdownMenu.tsx +4 -2
- package/src/features/org-units/components/OrgUnitDetailsNavbar/OrgUnitDetailsNavbar.tsx +23 -5
- package/src/features/org-units/components/OrgUnitDetailsNavbar/org-unit-details-navbar.scss +18 -2
- package/src/features/org-units/components/OrgUnitsDropdownMenu/OrgUnitsDropdownMenu.tsx +6 -4
- package/src/features/org-units/components/OrgUnitsHierarchyTree/OrgUnitsHierarchyTree.tsx +9 -6
- package/src/features/org-units/components/OrganizationalUnitsCard/OrganizationalUnitsCard.tsx +15 -7
- package/src/features/org-units/components/UpdateOrgUnitDrawer/UpdateOrgUnitDrawer.tsx +15 -9
- package/src/features/org-units/layouts/OrgUnitDetailsLayout/OrgUnitDetailsLayout.tsx +27 -26
- package/src/features/org-units/layouts/OrgUnitsLayout/OrgUnitsLayout.tsx +8 -3
- package/src/features/payment-methods/components/AddPaymentMethodsDrawer/AddPaymentMethodsDrawer.tsx +29 -18
- package/src/features/payment-methods/components/PaymentMethodSettingsDrawer/PaymentMethodSettingsDrawer.tsx +13 -9
- package/src/features/payment-methods/components/RemoveMethodButton/RemoveMethodButton.tsx +5 -2
- package/src/features/payment-methods/components/RemovePaymentMethodsDrawer/RemovePaymentMethodsDrawer.tsx +10 -7
- package/src/features/payment-methods/hooks/useRemovePaymentMethodSubmit.ts +6 -4
- package/src/features/payment-methods/layouts/PaymentMethodsLayout/PaymentMethodsLayout.tsx +21 -15
- package/src/features/product-assortment/components/ProductAssortmentTable/ProductAssortmentTable.tsx +11 -7
- package/src/features/product-assortment/layouts/ProductAssortmentLayout/ProductAssortmentLayout.tsx +9 -6
- package/src/features/profile/components/ProfileCard/ProfileCard.tsx +8 -5
- package/src/features/profile/components/ProfileSummary/ProfileSummary.tsx +13 -6
- package/src/features/profile/layouts/ProfileLayout/ProfileLayout.tsx +16 -6
- package/src/features/roles/layout/RoleDetailsLayout/RoleDetailsLayout.tsx +4 -2
- package/src/features/roles/layout/RolesLayout/RolesLayout.tsx +5 -3
- package/src/features/shared/components/BasicCard/BasicCard.tsx +6 -4
- package/src/features/shared/components/BasicCard/BasicCardLine.tsx +5 -4
- package/src/features/shared/components/CustomerSwitch/CustomerSwitchDrawer.tsx +10 -2
- package/src/features/shared/components/CustomerSwitch/CustomerSwitchSearch.tsx +4 -1
- package/src/features/shared/components/DropdownFilter/DropdownFilter.tsx +11 -7
- package/src/features/shared/components/Error/Error.tsx +13 -6
- package/src/features/shared/components/HeaderInside/HeaderInside.tsx +5 -2
- package/src/features/shared/components/InternalSearch/InternalSearch.tsx +4 -1
- package/src/features/shared/components/InternalTopbar/InternalTopbar.tsx +7 -5
- package/src/features/shared/components/MainLinksDropdownMenu/MainLinksDropdownMenu.tsx +23 -8
- package/src/features/shared/components/OrgUnitInputSearch/OrgUnitInputSearch.tsx +7 -2
- package/src/features/shared/components/Pagination/Pagination.tsx +6 -2
- package/src/features/shared/components/Paginator/Counter.tsx +11 -5
- package/src/features/shared/components/Paginator/Interval.tsx +4 -3
- package/src/features/shared/components/Paginator/NextPageButton.tsx +6 -2
- package/src/features/shared/components/SettingsDrawer/SettingsDrawer.tsx +6 -4
- package/src/features/shared/components/SettingsDrawer/SettingsDrawerListType.tsx +11 -10
- package/src/features/shared/components/SettingsDrawer/listTypeOptions.ts +10 -7
- package/src/features/shared/components/SortFilter/SortFilter.tsx +15 -8
- package/src/features/shared/components/Table/TableRow/TableRow.tsx +5 -1
- package/src/features/shared/components/VerticalNav/VerticalNavLink.tsx +7 -3
- package/src/features/shared/layouts/BaseTabsLayout/Navbar.tsx +28 -4
- package/src/features/shared/layouts/BaseTabsLayout/about-drawer/AboutDrawer.tsx +15 -5
- package/src/features/shared/layouts/BaseTabsLayout/base-tabs-layout.scss +24 -9
- package/src/features/shared/layouts/BaseTabsLayout/sidebar-drawer/SidebarDrawer.tsx +5 -2
- package/src/features/shared/layouts/ContractTabsLayout/ContractTabsLayout.tsx +10 -5
- package/src/features/shared/layouts/ErrorTabsLayout/ErrorTabsLayout.tsx +7 -4
- package/src/features/shared/layouts/FinanceTabsLayout/FinanceTabsLayout.tsx +9 -4
- package/src/features/shared/layouts/LoadingTabsLayout/LoadingTabsLayout.tsx +7 -4
- package/src/features/shared/layouts/OrgUnitTabsLayout/OrgUnitTabLayout.tsx +3 -0
- package/src/features/shared/layouts/SumaPageLayout/FullSidebarNav.tsx +13 -7
- package/src/features/shared/layouts/SumaPageLayout/SumaSidebar.tsx +9 -5
- package/src/features/shared/localization/LocalizationContext.tsx +35 -0
- package/src/features/shared/localization/__tests__/createLocalize.test.ts +166 -0
- package/src/features/shared/localization/__tests__/get-localization-labels.service.test.ts +202 -0
- package/src/features/shared/localization/clients/LocalizationClient.ts +19 -0
- package/src/features/shared/localization/constants.ts +31 -0
- package/src/features/shared/localization/createLocalize.ts +78 -0
- package/src/features/shared/localization/services/get-localization-labels.service.ts +76 -0
- package/src/features/shared/localization/types.ts +66 -0
- package/src/features/shared/localization/withLocalization.tsx +22 -0
- package/src/features/shared/types/AuthRouteProps.ts +5 -0
- package/src/features/shared/types/LoaderData.ts +1 -0
- package/src/features/shared/utils/addresLabelToPropMapping.ts +10 -10
- package/src/features/shared/utils/constants.ts +1 -4
- package/src/features/shared/utils/getContractSettingsLinks.ts +17 -12
- package/src/features/shared/utils/getFinanceSettingsLinks.ts +14 -9
- package/src/features/shared/utils/getKeyByValue.ts +2 -2
- package/src/features/shared/utils/getOrganizationSettingsLinks.ts +13 -3
- package/src/features/shared/utils/getSumaListingSidebarLinks.ts +15 -10
- package/src/features/shared/utils/index.ts +2 -0
- package/src/features/shared/utils/routeLayoutMapping.ts +30 -30
- package/src/features/shared/utils/search.tsx +10 -0
- package/src/features/shared/utils/withAuth.tsx +6 -0
- package/src/features/shared/utils/withAuthLoader.ts +11 -0
- package/src/features/shared/utils/withLoaderErrorBoundary.ts +9 -0
- package/src/features/shared/utils/withProviders.tsx +13 -2
- package/src/features/users/components/CreateUserDrawer/CreateUserDrawer.tsx +39 -27
- package/src/features/users/components/CreateUserDrawerWithUsername/CreateUserDrawerWithUsername.tsx +41 -39
- package/src/features/users/components/DeleteUserDrawer/DeleteUserDrawer.tsx +27 -23
- package/src/features/users/components/EmailTransactionalSection/EmailTransactionalSection.tsx +6 -8
- package/src/features/users/components/LoginField/LoginField.tsx +4 -4
- package/src/features/users/components/ReassignOrgUnitDrawer/ReassignOrgUnitDrawer.tsx +22 -19
- package/src/features/users/components/ResetPasswordDrawer/ResetPasswordDrawer.tsx +16 -21
- package/src/features/users/components/UpdateUserDrawer/UpdateUserDrawer.tsx +26 -15
- package/src/features/users/components/UpdateUserDrawerWithUsername/UpdateUserDrawerWithUsername.tsx +22 -8
- package/src/features/users/components/UserDropdownMenu/UserDropdownMenu.tsx +7 -5
- package/src/features/users/components/UserFormFields/UserFormFields.tsx +9 -8
- package/src/features/users/components/UsersCard/UsersCard.tsx +4 -2
- package/src/features/users/layouts/UserDetailsLayout/UserDetailsLayout.tsx +26 -10
- package/src/features/users/layouts/UsersLayout/UsersLayout.tsx +12 -8
- package/src/pages/accounting-field.tsx +28 -15
- package/src/pages/address-details.tsx +37 -26
- package/src/pages/addresses.tsx +27 -12
- package/src/pages/budgets-details.tsx +25 -15
- package/src/pages/budgets.tsx +31 -17
- package/src/pages/buyer-organization-manager.tsx +23 -12
- package/src/pages/buying-policies.tsx +38 -20
- package/src/pages/buying-policy-details.tsx +20 -19
- package/src/pages/contracts.tsx +15 -1
- package/src/pages/credit-cards.tsx +30 -17
- package/src/pages/order-entry.tsx +26 -15
- package/src/pages/org-unit-details.tsx +20 -6
- package/src/pages/org-units.tsx +20 -6
- package/src/pages/payment-groups.tsx +15 -12
- package/src/pages/productAssortment.tsx +10 -1
- package/src/pages/profile.tsx +14 -1
- package/src/pages/role-details.tsx +19 -6
- package/src/pages/roles.tsx +27 -14
- package/src/pages/user-details.tsx +29 -17
- package/src/pages/users.tsx +11 -0
- package/vitest.config.ts +13 -0
- package/src/features/addresses/constants/messages.ts +0 -8
- package/src/features/credit-cards/constants/messages.ts +0 -6
|
@@ -18,6 +18,7 @@ import {
|
|
|
18
18
|
SEARCH_PARAMS,
|
|
19
19
|
usePageItems,
|
|
20
20
|
} from "../../../shared/hooks/usePageItems";
|
|
21
|
+
import { useLocalization } from "../../../shared/localization/LocalizationContext";
|
|
21
22
|
import { maskPhoneNumber } from "../../../shared/utils/phoneNumber";
|
|
22
23
|
import { type CountryCodes } from "../../data/countries";
|
|
23
24
|
import { useSearchAddressRecipients } from "../../hooks/useSearchAddressRecipients";
|
|
@@ -53,6 +54,7 @@ export const AddressRecipientsList = forwardRef<
|
|
|
53
54
|
) => {
|
|
54
55
|
const router = useRouter();
|
|
55
56
|
const { currentOrgUnit } = useBuyerPortal();
|
|
57
|
+
const { t } = useLocalization();
|
|
56
58
|
|
|
57
59
|
const [totalRecipients, setTotalRecipients] = useState(total);
|
|
58
60
|
|
|
@@ -140,10 +142,11 @@ export const AddressRecipientsList = forwardRef<
|
|
|
140
142
|
const columns = getTableColumns({
|
|
141
143
|
actionsLength: 2,
|
|
142
144
|
nameColumnSize: "11.125rem",
|
|
145
|
+
nameColumnLabel: t("shared.labels.name"),
|
|
143
146
|
extraColumns: [
|
|
144
147
|
{
|
|
145
148
|
key: "phone",
|
|
146
|
-
label: "
|
|
149
|
+
label: t("addresses.table.phone"),
|
|
147
150
|
align: "left",
|
|
148
151
|
size: "100%",
|
|
149
152
|
hideOnScreenSize: "phonemid",
|
|
@@ -166,8 +169,8 @@ export const AddressRecipientsList = forwardRef<
|
|
|
166
169
|
</div>
|
|
167
170
|
{!isLoading && recipients.length === 0 && searchTerm.length > 0 ? (
|
|
168
171
|
<EmptyState
|
|
169
|
-
title="
|
|
170
|
-
description="
|
|
172
|
+
title={t("addresses.empty.noResults")}
|
|
173
|
+
description={t("addresses.empty.tryDifferentTerms")}
|
|
171
174
|
/>
|
|
172
175
|
) : (
|
|
173
176
|
<div data-fs-bp-address-tabs-table>
|
|
@@ -228,7 +231,9 @@ export const AddressRecipientsList = forwardRef<
|
|
|
228
231
|
onClick={increasePage}
|
|
229
232
|
disabled={isLoading}
|
|
230
233
|
>
|
|
231
|
-
{isLoading
|
|
234
|
+
{isLoading
|
|
235
|
+
? t("shared.labels.loading")
|
|
236
|
+
: t("shared.buttons.loadMore")}
|
|
232
237
|
</Paginator.NextPageButton>
|
|
233
238
|
)}
|
|
234
239
|
|
|
@@ -7,6 +7,7 @@ import {
|
|
|
7
7
|
} from "@faststore/ui";
|
|
8
8
|
|
|
9
9
|
import { BasicCard, Icon, Tag } from "../../../shared/components";
|
|
10
|
+
import { useLocalization } from "../../../shared/localization/LocalizationContext";
|
|
10
11
|
|
|
11
12
|
import type { AddressData } from "../../types";
|
|
12
13
|
|
|
@@ -22,11 +23,13 @@ export default function AddressesCard({
|
|
|
22
23
|
addresses = [],
|
|
23
24
|
orgUnitData,
|
|
24
25
|
}: AddressesCardProps) {
|
|
26
|
+
const { t } = useLocalization();
|
|
27
|
+
|
|
25
28
|
return (
|
|
26
29
|
<BasicCard
|
|
27
30
|
footerLink={`/addresses${orgUnitData?.id ? `/${orgUnitData.id}` : ""}`}
|
|
28
|
-
footerMessage="
|
|
29
|
-
title="
|
|
31
|
+
footerMessage={t("addresses.links.manageAddresses")}
|
|
32
|
+
title={t("addresses.titles.addresses")}
|
|
30
33
|
subTitle={addresses.length ?? 0}
|
|
31
34
|
onPlusIconClick={() => {}}
|
|
32
35
|
>
|
|
@@ -73,7 +76,7 @@ export default function AddressesCard({
|
|
|
73
76
|
height={24}
|
|
74
77
|
data-fs-dropdown-icon
|
|
75
78
|
/>
|
|
76
|
-
|
|
79
|
+
{t("shared.buttons.edit")}
|
|
77
80
|
</DropdownItem>
|
|
78
81
|
<DropdownItem data-fs-bp-dropdown-menu-item-mode="danger">
|
|
79
82
|
<Icon
|
|
@@ -82,7 +85,7 @@ export default function AddressesCard({
|
|
|
82
85
|
height={24}
|
|
83
86
|
data-fs-dropdown-icon
|
|
84
87
|
/>{" "}
|
|
85
|
-
|
|
88
|
+
{t("shared.buttons.delete")}
|
|
86
89
|
</DropdownItem>
|
|
87
90
|
<DropdownItem dismissOnClick={false}>
|
|
88
91
|
<div data-fs-dropdown-active-item>
|
|
@@ -93,7 +96,7 @@ export default function AddressesCard({
|
|
|
93
96
|
height={24}
|
|
94
97
|
data-fs-dropdown-icon
|
|
95
98
|
/>{" "}
|
|
96
|
-
|
|
99
|
+
{t("addresses.labels.active")}
|
|
97
100
|
</div>
|
|
98
101
|
<Toggle
|
|
99
102
|
id="addressActiveMenu"
|
|
@@ -17,8 +17,8 @@ import {
|
|
|
17
17
|
useAnalytics,
|
|
18
18
|
useBuyerPortal,
|
|
19
19
|
} from "../../../shared/hooks";
|
|
20
|
+
import { useLocalization } from "../../../shared/localization/LocalizationContext";
|
|
20
21
|
import { ANALYTICS_EVENTS } from "../../../shared/services/logger/analytics/constants";
|
|
21
|
-
import { CHANGES_TIMEOUT_MESSAGE } from "../../../shared/utils/constants";
|
|
22
22
|
import { useCreateNewAddress } from "../../hooks";
|
|
23
23
|
import { LocationInput } from "../../types/AddressData";
|
|
24
24
|
|
|
@@ -33,10 +33,11 @@ export type CreateAddressDrawerProps = Omit<BasicDrawerProps, "children"> & {
|
|
|
33
33
|
export const CreateAddressDrawer = ({
|
|
34
34
|
close,
|
|
35
35
|
onUpdate,
|
|
36
|
-
locationsLabel
|
|
36
|
+
locationsLabel,
|
|
37
37
|
...props
|
|
38
38
|
}: CreateAddressDrawerProps) => {
|
|
39
39
|
const { pushToast } = useUI();
|
|
40
|
+
const { t } = useLocalization();
|
|
40
41
|
const [isTouched, setIsTouched] = useState(false);
|
|
41
42
|
const [useExistingAddress, setUseExistingAddress] = useState(false);
|
|
42
43
|
const { currentOrgUnit } = useBuyerPortal();
|
|
@@ -47,6 +48,9 @@ export const CreateAddressDrawer = ({
|
|
|
47
48
|
shouldTrackDefaultTimer: true,
|
|
48
49
|
});
|
|
49
50
|
|
|
51
|
+
const resolvedLocationsLabel =
|
|
52
|
+
locationsLabel ?? t("addresses.labels.locations");
|
|
53
|
+
|
|
50
54
|
const [completedAddress, setCompletedAddress] = useState<AddressData>(
|
|
51
55
|
{} as AddressData
|
|
52
56
|
);
|
|
@@ -95,7 +99,9 @@ export const CreateAddressDrawer = ({
|
|
|
95
99
|
});
|
|
96
100
|
|
|
97
101
|
pushToast({
|
|
98
|
-
message:
|
|
102
|
+
message: `${t("addresses.toasts.addressAdded")}\n${t(
|
|
103
|
+
"shared.messages.changesTimeout"
|
|
104
|
+
)}`,
|
|
99
105
|
status: "INFO",
|
|
100
106
|
});
|
|
101
107
|
onUpdate?.();
|
|
@@ -110,7 +116,7 @@ export const CreateAddressDrawer = ({
|
|
|
110
116
|
});
|
|
111
117
|
|
|
112
118
|
pushToast({
|
|
113
|
-
message: "
|
|
119
|
+
message: t("addresses.errors.addressCreate"),
|
|
114
120
|
status: "ERROR",
|
|
115
121
|
});
|
|
116
122
|
},
|
|
@@ -125,7 +131,7 @@ export const CreateAddressDrawer = ({
|
|
|
125
131
|
});
|
|
126
132
|
|
|
127
133
|
pushToast({
|
|
128
|
-
message: "
|
|
134
|
+
message: t("addresses.errors.addressCreate"),
|
|
129
135
|
status: "ERROR",
|
|
130
136
|
});
|
|
131
137
|
},
|
|
@@ -172,12 +178,17 @@ export const CreateAddressDrawer = ({
|
|
|
172
178
|
|
|
173
179
|
return (
|
|
174
180
|
<BasicDrawer data-fs-bp-create-address-drawer close={close} {...props}>
|
|
175
|
-
<BasicDrawer.Heading
|
|
181
|
+
<BasicDrawer.Heading
|
|
182
|
+
title={t("addresses.drawers.addAddress")}
|
|
183
|
+
onClose={close}
|
|
184
|
+
/>
|
|
176
185
|
<Tab defaultTabId="address-tab" onChange={handleTabChange}>
|
|
177
186
|
<TabBar>
|
|
178
|
-
<TabOption id="address-tab">
|
|
179
|
-
<TabOption id="location-tab">{
|
|
180
|
-
<TabOption id="recipient-tab">
|
|
187
|
+
<TabOption id="address-tab">{t("addresses.tabs.details")}</TabOption>
|
|
188
|
+
<TabOption id="location-tab">{resolvedLocationsLabel}</TabOption>
|
|
189
|
+
<TabOption id="recipient-tab">
|
|
190
|
+
{t("addresses.tabs.recipients")}
|
|
191
|
+
</TabOption>
|
|
181
192
|
</TabBar>
|
|
182
193
|
|
|
183
194
|
{invalidAddress && (
|
|
@@ -193,7 +204,7 @@ export const CreateAddressDrawer = ({
|
|
|
193
204
|
onClose={() => setInvalidAddress(false)}
|
|
194
205
|
dismissible
|
|
195
206
|
>
|
|
196
|
-
|
|
207
|
+
{t("addresses.messages.invalidAddress")}
|
|
197
208
|
</Alert>
|
|
198
209
|
)}
|
|
199
210
|
|
|
@@ -215,8 +226,10 @@ export const CreateAddressDrawer = ({
|
|
|
215
226
|
<LocationForm
|
|
216
227
|
locations={locations}
|
|
217
228
|
onLocationsChange={setLocations}
|
|
218
|
-
locationsLabel={
|
|
219
|
-
description={
|
|
229
|
+
locationsLabel={resolvedLocationsLabel}
|
|
230
|
+
description={t("addresses.forms.addLocationsDescription", [
|
|
231
|
+
resolvedLocationsLabel,
|
|
232
|
+
])}
|
|
220
233
|
/>
|
|
221
234
|
</TabContent>
|
|
222
235
|
|
|
@@ -231,7 +244,7 @@ export const CreateAddressDrawer = ({
|
|
|
231
244
|
|
|
232
245
|
<BasicDrawer.Footer>
|
|
233
246
|
<BasicDrawer.Button variant="ghost" onClick={close}>
|
|
234
|
-
|
|
247
|
+
{t("shared.buttons.cancel")}
|
|
235
248
|
</BasicDrawer.Button>
|
|
236
249
|
<BasicDrawer.Button
|
|
237
250
|
variant="confirm"
|
|
@@ -239,7 +252,7 @@ export const CreateAddressDrawer = ({
|
|
|
239
252
|
onClick={handleConfirmClick}
|
|
240
253
|
isLoading={isCreateNewAddressLoading}
|
|
241
254
|
>
|
|
242
|
-
|
|
255
|
+
{t("shared.buttons.add")}
|
|
243
256
|
</BasicDrawer.Button>
|
|
244
257
|
</BasicDrawer.Footer>
|
|
245
258
|
</BasicDrawer>
|
|
@@ -15,8 +15,7 @@ import {
|
|
|
15
15
|
import { OptionSelected } from "../../../shared/components/OptionSelected/OptionSelected";
|
|
16
16
|
import { SearchHighlight } from "../../../shared/components/SearchHighlight/SearchHighlight";
|
|
17
17
|
import { useSetScopeConfig, SCOPE_KEYS } from "../../../shared/hooks";
|
|
18
|
-
import {
|
|
19
|
-
import { ADDRESS_MESSAGES } from "../../constants/messages";
|
|
18
|
+
import { useLocalization } from "../../../shared/localization/LocalizationContext";
|
|
20
19
|
import { useEditAddressLocationSettings } from "../../hooks";
|
|
21
20
|
import { useDebouncedSearchAddressByUnitId } from "../../hooks/useDebouncedSearchAddressByUnitId";
|
|
22
21
|
import { useGetDefaultAddress } from "../../hooks/useGetDefaultAddresses";
|
|
@@ -34,8 +33,6 @@ export type CreateAddressSettingsDrawerProps = Omit<
|
|
|
34
33
|
initialLocationsLabel: string;
|
|
35
34
|
};
|
|
36
35
|
|
|
37
|
-
export const ADDRESS_LIST_TYPE_OPTIONS = createListTypeOptions("addresses");
|
|
38
|
-
|
|
39
36
|
export const CreateAddressSettingsDrawer = ({
|
|
40
37
|
close,
|
|
41
38
|
onUpdate,
|
|
@@ -43,6 +40,8 @@ export const CreateAddressSettingsDrawer = ({
|
|
|
43
40
|
...otherProps
|
|
44
41
|
}: CreateAddressSettingsDrawerProps) => {
|
|
45
42
|
const { pushToast } = useUI();
|
|
43
|
+
const { t } = useLocalization();
|
|
44
|
+
const addressListTypeOptions = createListTypeOptions("addresses", t);
|
|
46
45
|
const router = useRouter();
|
|
47
46
|
const locationLabelText = initialLocationsLabel;
|
|
48
47
|
|
|
@@ -98,7 +97,9 @@ export const CreateAddressSettingsDrawer = ({
|
|
|
98
97
|
|
|
99
98
|
const handleCreateNewAddressSuccess = () => {
|
|
100
99
|
pushToast({
|
|
101
|
-
message: `${
|
|
100
|
+
message: `${t("addresses.toasts.defaultSaved")}\n${t(
|
|
101
|
+
"shared.messages.changesTimeout"
|
|
102
|
+
)}`,
|
|
102
103
|
status: "INFO",
|
|
103
104
|
});
|
|
104
105
|
onUpdate?.();
|
|
@@ -110,7 +111,7 @@ export const CreateAddressSettingsDrawer = ({
|
|
|
110
111
|
onSuccess: handleCreateNewAddressSuccess,
|
|
111
112
|
onError: () => {
|
|
112
113
|
pushToast({
|
|
113
|
-
message:
|
|
114
|
+
message: t("addresses.errors.defaultError"),
|
|
114
115
|
status: "ERROR",
|
|
115
116
|
});
|
|
116
117
|
},
|
|
@@ -121,7 +122,7 @@ export const CreateAddressSettingsDrawer = ({
|
|
|
121
122
|
lazy: true,
|
|
122
123
|
onError: () => {
|
|
123
124
|
pushToast({
|
|
124
|
-
message: "
|
|
125
|
+
message: t("addresses.errors.locationsSettingsUpdate"),
|
|
125
126
|
status: "ERROR",
|
|
126
127
|
});
|
|
127
128
|
},
|
|
@@ -130,13 +131,15 @@ export const CreateAddressSettingsDrawer = ({
|
|
|
130
131
|
const { setScopeConfig, isSetScopeConfigLoading } = useSetScopeConfig({
|
|
131
132
|
onSuccess: () => {
|
|
132
133
|
pushToast({
|
|
133
|
-
message:
|
|
134
|
+
message: `${t("addresses.toasts.scopeConfigUpdated")}\n${t(
|
|
135
|
+
"shared.messages.changesTimeout"
|
|
136
|
+
)}`,
|
|
134
137
|
status: "INFO",
|
|
135
138
|
});
|
|
136
139
|
},
|
|
137
140
|
onError: () => {
|
|
138
141
|
pushToast({
|
|
139
|
-
message: "
|
|
142
|
+
message: t("addresses.errors.scopeConfigUpdate"),
|
|
140
143
|
status: "ERROR",
|
|
141
144
|
});
|
|
142
145
|
},
|
|
@@ -204,7 +207,7 @@ export const CreateAddressSettingsDrawer = ({
|
|
|
204
207
|
|
|
205
208
|
return (
|
|
206
209
|
<SettingsDrawer
|
|
207
|
-
title="
|
|
210
|
+
title={t("addresses.drawers.addressSettings")}
|
|
208
211
|
{...otherProps}
|
|
209
212
|
close={close}
|
|
210
213
|
onPrimaryAction={handleConfirmClick}
|
|
@@ -214,21 +217,23 @@ export const CreateAddressSettingsDrawer = ({
|
|
|
214
217
|
data-fs-bp-create-address-settings-drawer
|
|
215
218
|
>
|
|
216
219
|
<SettingsDrawer.ListType
|
|
217
|
-
title="
|
|
220
|
+
title={t("addresses.forms.listType")}
|
|
218
221
|
name="listType"
|
|
219
222
|
value={listType}
|
|
220
223
|
onChange={setListType}
|
|
221
|
-
options={
|
|
224
|
+
options={addressListTypeOptions}
|
|
222
225
|
/>
|
|
223
226
|
|
|
224
227
|
<div data-fs-bp-default-addresses-section>
|
|
225
|
-
<h4 data-fs-bp-default-addresses-title>
|
|
228
|
+
<h4 data-fs-bp-default-addresses-title>
|
|
229
|
+
{t("addresses.titles.defaultAddresses")}
|
|
230
|
+
</h4>
|
|
226
231
|
<h4 data-fs-bp-default-addresses-subtitle>
|
|
227
|
-
|
|
232
|
+
{t("addresses.forms.selectDefaultAddresses")}
|
|
228
233
|
</h4>
|
|
229
234
|
|
|
230
235
|
<p data-fs-bp-default-address-label>
|
|
231
|
-
|
|
236
|
+
{t("addresses.forms.defaultShippingAddress")}
|
|
232
237
|
</p>
|
|
233
238
|
|
|
234
239
|
{isLoadingShipping ? (
|
|
@@ -244,7 +249,7 @@ export const CreateAddressSettingsDrawer = ({
|
|
|
244
249
|
/>
|
|
245
250
|
) : (
|
|
246
251
|
<AutocompleteDropdown
|
|
247
|
-
label="
|
|
252
|
+
label={t("addresses.forms.searchShippingAddresses")}
|
|
248
253
|
value={activeField === "Shipping" ? searchValue : ""}
|
|
249
254
|
options={searchedAddresses}
|
|
250
255
|
onFocus={() => setActiveField("Shipping")}
|
|
@@ -281,7 +286,7 @@ export const CreateAddressSettingsDrawer = ({
|
|
|
281
286
|
)}
|
|
282
287
|
|
|
283
288
|
<p data-fs-bp-default-address-label>
|
|
284
|
-
|
|
289
|
+
{t("addresses.forms.defaultBillingAddress")}
|
|
285
290
|
</p>
|
|
286
291
|
|
|
287
292
|
{isLoadingBilling ? (
|
|
@@ -297,7 +302,7 @@ export const CreateAddressSettingsDrawer = ({
|
|
|
297
302
|
/>
|
|
298
303
|
) : (
|
|
299
304
|
<AutocompleteDropdown
|
|
300
|
-
label="
|
|
305
|
+
label={t("addresses.forms.searchBillingAddresses")}
|
|
301
306
|
value={activeField === "Billing" ? searchValue : ""}
|
|
302
307
|
options={searchedAddresses}
|
|
303
308
|
onFocus={() => setActiveField("Billing")}
|
|
@@ -336,13 +341,13 @@ export const CreateAddressSettingsDrawer = ({
|
|
|
336
341
|
data-fs-bp-default-addresses-title
|
|
337
342
|
data-fs-bp-default-addresses-locations-field
|
|
338
343
|
>
|
|
339
|
-
|
|
344
|
+
{t("addresses.labels.locations")}
|
|
340
345
|
</h4>
|
|
341
346
|
<h4 data-fs-bp-default-addresses-subtitle>
|
|
342
|
-
|
|
347
|
+
{t("addresses.forms.setLocationsFieldName", [locationLabelText])}
|
|
343
348
|
</h4>
|
|
344
349
|
<InputText
|
|
345
|
-
label="
|
|
350
|
+
label={t("addresses.forms.fieldLabel")}
|
|
346
351
|
value={locationsLabel}
|
|
347
352
|
onChange={(event) => setLocationsLabel(event.target.value)}
|
|
348
353
|
name="locations-label"
|
|
@@ -8,8 +8,8 @@ import {
|
|
|
8
8
|
InputText,
|
|
9
9
|
} from "../../../shared/components";
|
|
10
10
|
import { useAnalytics, useBuyerPortal } from "../../../shared/hooks";
|
|
11
|
+
import { useLocalization } from "../../../shared/localization/LocalizationContext";
|
|
11
12
|
import { ANALYTICS_EVENTS } from "../../../shared/services/logger/analytics/constants";
|
|
12
|
-
import { CHANGES_TIMEOUT_MESSAGE } from "../../../shared/utils/constants";
|
|
13
13
|
import { useDeleteAddress } from "../../hooks";
|
|
14
14
|
|
|
15
15
|
export type DeleteAddressDrawerProps = Omit<BasicDrawerProps, "children"> & {
|
|
@@ -28,6 +28,7 @@ export const DeleteAddressDrawer = ({
|
|
|
28
28
|
}: DeleteAddressDrawerProps) => {
|
|
29
29
|
const { pushToast } = useUI();
|
|
30
30
|
const { currentOrgUnit } = useBuyerPortal();
|
|
31
|
+
const { t } = useLocalization();
|
|
31
32
|
const { trackEvent } = useAnalytics({
|
|
32
33
|
entityType: "address",
|
|
33
34
|
entityId: addressId,
|
|
@@ -45,7 +46,9 @@ export const DeleteAddressDrawer = ({
|
|
|
45
46
|
});
|
|
46
47
|
|
|
47
48
|
pushToast({
|
|
48
|
-
message:
|
|
49
|
+
message: `${t("addresses.toasts.addressDeleted")}\n${t(
|
|
50
|
+
"shared.messages.changesTimeout"
|
|
51
|
+
)}`,
|
|
49
52
|
status: "INFO",
|
|
50
53
|
});
|
|
51
54
|
onUpdate?.();
|
|
@@ -66,7 +69,7 @@ export const DeleteAddressDrawer = ({
|
|
|
66
69
|
});
|
|
67
70
|
|
|
68
71
|
pushToast({
|
|
69
|
-
message: "
|
|
72
|
+
message: t("addresses.errors.addressRemoveFromUnit"),
|
|
70
73
|
status: "ERROR",
|
|
71
74
|
});
|
|
72
75
|
},
|
|
@@ -83,25 +86,26 @@ export const DeleteAddressDrawer = ({
|
|
|
83
86
|
|
|
84
87
|
return (
|
|
85
88
|
<BasicDrawer data-fs-bp-remove-address-drawer close={close} {...props}>
|
|
86
|
-
<BasicDrawer.Heading
|
|
89
|
+
<BasicDrawer.Heading
|
|
90
|
+
title={t("addresses.drawers.deleteAddress")}
|
|
91
|
+
onClose={close}
|
|
92
|
+
/>
|
|
87
93
|
<BasicDrawer.Body>
|
|
88
94
|
<div>
|
|
89
95
|
<p>
|
|
90
|
-
|
|
91
|
-
|
|
96
|
+
{t("addresses.deleteAddress.confirmQuestion", [
|
|
97
|
+
<span key="address-name" data-fs-bp-drawer-label>
|
|
98
|
+
{addressName}
|
|
99
|
+
</span>,
|
|
100
|
+
])}
|
|
92
101
|
</p>
|
|
93
102
|
<br />
|
|
94
|
-
<p>
|
|
95
|
-
This address may be used by multiple units. Deleting it will
|
|
96
|
-
permanently remove it and all iits data from all associated units,
|
|
97
|
-
though usage history will be kept for audit. This action can't be
|
|
98
|
-
undone
|
|
99
|
-
</p>
|
|
103
|
+
<p>{t("addresses.deleteAddress.warning")}</p>
|
|
100
104
|
<br />
|
|
101
|
-
<p>
|
|
105
|
+
<p>{t("addresses.deleteAddress.confirmInstruction")}</p>
|
|
102
106
|
<br />
|
|
103
107
|
<InputText
|
|
104
|
-
label="
|
|
108
|
+
label={t("addresses.forms.addressName")}
|
|
105
109
|
className="address-name-confirmation"
|
|
106
110
|
value={addressNameConfirmation}
|
|
107
111
|
onChange={(event) =>
|
|
@@ -113,7 +117,7 @@ export const DeleteAddressDrawer = ({
|
|
|
113
117
|
|
|
114
118
|
<BasicDrawer.Footer>
|
|
115
119
|
<BasicDrawer.Button variant="ghost" onClick={close}>
|
|
116
|
-
|
|
120
|
+
{t("shared.buttons.cancel")}
|
|
117
121
|
</BasicDrawer.Button>
|
|
118
122
|
<BasicDrawer.Button
|
|
119
123
|
variant="danger"
|
|
@@ -121,7 +125,7 @@ export const DeleteAddressDrawer = ({
|
|
|
121
125
|
onClick={handleConfirmClick}
|
|
122
126
|
disabled={!isDeleteButtonEnabled}
|
|
123
127
|
>
|
|
124
|
-
|
|
128
|
+
{t("shared.buttons.remove")}
|
|
125
129
|
</BasicDrawer.Button>
|
|
126
130
|
</BasicDrawer.Footer>
|
|
127
131
|
</BasicDrawer>
|
|
@@ -4,8 +4,8 @@ import { useUI } from "@faststore/ui";
|
|
|
4
4
|
|
|
5
5
|
import { BasicDrawer, BasicDrawerProps } from "../../../shared/components";
|
|
6
6
|
import { useAnalytics, useBuyerPortal } from "../../../shared/hooks";
|
|
7
|
+
import { useLocalization } from "../../../shared/localization/LocalizationContext";
|
|
7
8
|
import { ANALYTICS_EVENTS } from "../../../shared/services/logger/analytics/constants";
|
|
8
|
-
import { CHANGES_TIMEOUT_MESSAGE } from "../../../shared/utils/constants";
|
|
9
9
|
import { useAddressLocationDelete } from "../../hooks";
|
|
10
10
|
import { LocationField } from "../LocationForm/LocationField/LocationField";
|
|
11
11
|
|
|
@@ -25,10 +25,11 @@ export const DeleteAddressLocationDrawer = ({
|
|
|
25
25
|
close,
|
|
26
26
|
location,
|
|
27
27
|
onDeleteSuccess,
|
|
28
|
-
locationsLabel
|
|
28
|
+
locationsLabel,
|
|
29
29
|
...props
|
|
30
30
|
}: DeleteAddressLocationDrawerProps) => {
|
|
31
31
|
const { pushToast } = useUI();
|
|
32
|
+
const { t } = useLocalization();
|
|
32
33
|
const [confirmationValue, setConfirmationValue] = useState({ name: "" });
|
|
33
34
|
const deleteIsDisable = confirmationValue.name !== location.value;
|
|
34
35
|
const { currentOrgUnit } = useBuyerPortal();
|
|
@@ -39,6 +40,9 @@ export const DeleteAddressLocationDrawer = ({
|
|
|
39
40
|
shouldTrackDefaultTimer: true,
|
|
40
41
|
});
|
|
41
42
|
|
|
43
|
+
const resolvedLocationsLabel =
|
|
44
|
+
locationsLabel ?? t("addresses.labels.locations");
|
|
45
|
+
|
|
42
46
|
const { deleteLocationMutate, deleteLocationLoading } =
|
|
43
47
|
useAddressLocationDelete({
|
|
44
48
|
onSuccess: () => {
|
|
@@ -51,7 +55,9 @@ export const DeleteAddressLocationDrawer = ({
|
|
|
51
55
|
});
|
|
52
56
|
|
|
53
57
|
pushToast({
|
|
54
|
-
message:
|
|
58
|
+
message: `${t("addresses.toasts.locationRemoved")}\n${t(
|
|
59
|
+
"shared.messages.changesTimeout"
|
|
60
|
+
)}`,
|
|
55
61
|
status: "INFO",
|
|
56
62
|
});
|
|
57
63
|
|
|
@@ -70,7 +76,9 @@ export const DeleteAddressLocationDrawer = ({
|
|
|
70
76
|
});
|
|
71
77
|
|
|
72
78
|
pushToast({
|
|
73
|
-
message:
|
|
79
|
+
message: t("addresses.errors.locationRemove", [
|
|
80
|
+
resolvedLocationsLabel,
|
|
81
|
+
]),
|
|
74
82
|
status: "ERROR",
|
|
75
83
|
});
|
|
76
84
|
},
|
|
@@ -86,32 +94,36 @@ export const DeleteAddressLocationDrawer = ({
|
|
|
86
94
|
|
|
87
95
|
return (
|
|
88
96
|
<BasicDrawer close={close} {...props}>
|
|
89
|
-
<BasicDrawer.Heading
|
|
97
|
+
<BasicDrawer.Heading
|
|
98
|
+
title={t("addresses.drawers.deleteLocation", [resolvedLocationsLabel])}
|
|
99
|
+
onClose={close}
|
|
100
|
+
/>
|
|
90
101
|
<BasicDrawer.Body>
|
|
91
102
|
<div data-fs-bp-delete-location-body>
|
|
92
103
|
<p>
|
|
93
|
-
|
|
104
|
+
{t("addresses.deleteLocation.confirmQuestion", [
|
|
105
|
+
<strong key="location-value">{location.value}</strong>,
|
|
106
|
+
])}
|
|
94
107
|
</p>
|
|
95
108
|
<p>
|
|
96
|
-
|
|
97
|
-
associated address. Deleting it will permanently remove it and all
|
|
98
|
-
its data from all associated units, though usage history will be
|
|
99
|
-
kept for audit. This action can't be undone.
|
|
109
|
+
{t("addresses.deleteLocation.warning", [resolvedLocationsLabel])}
|
|
100
110
|
</p>
|
|
101
111
|
<p data-fs-bp-delete-location-last-text>
|
|
102
|
-
|
|
112
|
+
{t("addresses.deleteLocation.confirmInstruction", [
|
|
113
|
+
resolvedLocationsLabel,
|
|
114
|
+
])}
|
|
103
115
|
</p>
|
|
104
116
|
<LocationField
|
|
105
117
|
index={0}
|
|
106
118
|
location={confirmationValue}
|
|
107
119
|
onChange={(value) => setConfirmationValue({ name: value })}
|
|
108
|
-
locationsLabel={
|
|
120
|
+
locationsLabel={resolvedLocationsLabel}
|
|
109
121
|
/>
|
|
110
122
|
</div>
|
|
111
123
|
</BasicDrawer.Body>
|
|
112
124
|
<BasicDrawer.Footer>
|
|
113
125
|
<BasicDrawer.Button variant="ghost" onClick={close}>
|
|
114
|
-
|
|
126
|
+
{t("shared.buttons.cancel")}
|
|
115
127
|
</BasicDrawer.Button>
|
|
116
128
|
<BasicDrawer.Button
|
|
117
129
|
variant="danger"
|
|
@@ -119,7 +131,7 @@ export const DeleteAddressLocationDrawer = ({
|
|
|
119
131
|
isLoading={deleteLocationLoading}
|
|
120
132
|
onClick={handleDeleteClick}
|
|
121
133
|
>
|
|
122
|
-
|
|
134
|
+
{t("shared.buttons.delete")}
|
|
123
135
|
</BasicDrawer.Button>
|
|
124
136
|
</BasicDrawer.Footer>
|
|
125
137
|
</BasicDrawer>
|
|
@@ -10,8 +10,8 @@ import {
|
|
|
10
10
|
InputText,
|
|
11
11
|
} from "../../../shared/components";
|
|
12
12
|
import { useAnalytics, useBuyerPortal } from "../../../shared/hooks";
|
|
13
|
+
import { useLocalization } from "../../../shared/localization/LocalizationContext";
|
|
13
14
|
import { ANALYTICS_EVENTS } from "../../../shared/services/logger/analytics/constants";
|
|
14
|
-
import { CHANGES_TIMEOUT_MESSAGE } from "../../../shared/utils/constants";
|
|
15
15
|
import { useDeleteRecipientAddress } from "../../hooks/useDeleteRecipientAddress";
|
|
16
16
|
|
|
17
17
|
export type DeleteRecipientAddressDrawerProps = Omit<
|
|
@@ -34,6 +34,7 @@ export const DeleteRecipientAddressDrawer = ({
|
|
|
34
34
|
const { pushToast } = useUI();
|
|
35
35
|
const router = useRouter();
|
|
36
36
|
const { currentOrgUnit } = useBuyerPortal();
|
|
37
|
+
const { t } = useLocalization();
|
|
37
38
|
const { trackEvent } = useAnalytics({
|
|
38
39
|
entityType: "recipient",
|
|
39
40
|
entityId: recipientAddressId,
|
|
@@ -53,7 +54,9 @@ export const DeleteRecipientAddressDrawer = ({
|
|
|
53
54
|
});
|
|
54
55
|
|
|
55
56
|
pushToast({
|
|
56
|
-
message:
|
|
57
|
+
message: `${t("addresses.toasts.recipientDeleted")}\n${t(
|
|
58
|
+
"shared.messages.changesTimeout"
|
|
59
|
+
)}`,
|
|
57
60
|
status: "INFO",
|
|
58
61
|
});
|
|
59
62
|
refetchRecipients();
|
|
@@ -72,8 +75,7 @@ export const DeleteRecipientAddressDrawer = ({
|
|
|
72
75
|
});
|
|
73
76
|
|
|
74
77
|
pushToast({
|
|
75
|
-
message:
|
|
76
|
-
"An error occurred while removing the recipient from address",
|
|
78
|
+
message: t("addresses.errors.recipientRemove"),
|
|
77
79
|
status: "ERROR",
|
|
78
80
|
});
|
|
79
81
|
},
|
|
@@ -94,25 +96,26 @@ export const DeleteRecipientAddressDrawer = ({
|
|
|
94
96
|
|
|
95
97
|
return (
|
|
96
98
|
<BasicDrawer data-fs-bp-remove-address-drawer close={close} {...props}>
|
|
97
|
-
<BasicDrawer.Heading
|
|
99
|
+
<BasicDrawer.Heading
|
|
100
|
+
title={t("addresses.drawers.deleteRecipient")}
|
|
101
|
+
onClose={close}
|
|
102
|
+
/>
|
|
98
103
|
<BasicDrawer.Body>
|
|
99
104
|
<div data-fs-bp-remove-recipient-form>
|
|
100
105
|
<p>
|
|
101
|
-
|
|
102
|
-
|
|
106
|
+
{t("addresses.deleteRecipient.confirmQuestion", [
|
|
107
|
+
<span key="recipient-name" data-fs-bp-drawer-label>
|
|
108
|
+
{recipientAddressName}
|
|
109
|
+
</span>,
|
|
110
|
+
])}
|
|
103
111
|
</p>
|
|
104
112
|
<br />
|
|
105
|
-
<p>
|
|
106
|
-
This recipient may be associated with multiple units through its
|
|
107
|
-
address. Deleting it will permanently remove it and all its data
|
|
108
|
-
from all associated units, though usage history will be kept for
|
|
109
|
-
audit. This action can't be undone.
|
|
110
|
-
</p>
|
|
113
|
+
<p>{t("addresses.deleteRecipient.warning")}</p>
|
|
111
114
|
<br />
|
|
112
|
-
<p>
|
|
115
|
+
<p>{t("addresses.deleteRecipient.confirmInstruction")}</p>
|
|
113
116
|
<br />
|
|
114
117
|
<InputText
|
|
115
|
-
label="
|
|
118
|
+
label={t("addresses.forms.recipientName")}
|
|
116
119
|
value={recipientNameConfirmation}
|
|
117
120
|
onChange={(event) =>
|
|
118
121
|
setRecipientNameConfirmation(event.currentTarget.value)
|
|
@@ -123,7 +126,7 @@ export const DeleteRecipientAddressDrawer = ({
|
|
|
123
126
|
|
|
124
127
|
<BasicDrawer.Footer>
|
|
125
128
|
<BasicDrawer.Button variant="ghost" onClick={close}>
|
|
126
|
-
|
|
129
|
+
{t("shared.buttons.cancel")}
|
|
127
130
|
</BasicDrawer.Button>
|
|
128
131
|
<BasicDrawer.Button
|
|
129
132
|
variant="danger"
|
|
@@ -131,7 +134,7 @@ export const DeleteRecipientAddressDrawer = ({
|
|
|
131
134
|
onClick={handleConfirmClick}
|
|
132
135
|
disabled={!isDeleteButtonEnabled}
|
|
133
136
|
>
|
|
134
|
-
|
|
137
|
+
{t("shared.buttons.remove")}
|
|
135
138
|
</BasicDrawer.Button>
|
|
136
139
|
</BasicDrawer.Footer>
|
|
137
140
|
</BasicDrawer>
|