@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
|
@@ -5,8 +5,8 @@ import { useUI } from "@faststore/ui";
|
|
|
5
5
|
import { AddressForm } from "..";
|
|
6
6
|
import { type BasicDrawerProps, BasicDrawer } from "../../../shared/components";
|
|
7
7
|
import { useAnalytics, useBuyerPortal } from "../../../shared/hooks";
|
|
8
|
+
import { useLocalization } from "../../../shared/localization/LocalizationContext";
|
|
8
9
|
import { ANALYTICS_EVENTS } from "../../../shared/services/logger/analytics/constants";
|
|
9
|
-
import { CHANGES_TIMEOUT_MESSAGE } from "../../../shared/utils/constants";
|
|
10
10
|
import { useEditAddress } from "../../hooks";
|
|
11
11
|
|
|
12
12
|
import type { AddressInput, AddressData } from "../../types";
|
|
@@ -24,6 +24,7 @@ export const EditAddressDrawer = ({
|
|
|
24
24
|
...props
|
|
25
25
|
}: EditAddressDrawerProps) => {
|
|
26
26
|
const { pushToast } = useUI();
|
|
27
|
+
const { t } = useLocalization();
|
|
27
28
|
const [isTouched, setIsTouched] = useState(false);
|
|
28
29
|
const { currentOrgUnit } = useBuyerPortal();
|
|
29
30
|
const { trackEntityEdited, trackEntityEditError } = useAnalytics({
|
|
@@ -51,7 +52,9 @@ export const EditAddressDrawer = ({
|
|
|
51
52
|
});
|
|
52
53
|
|
|
53
54
|
pushToast({
|
|
54
|
-
message:
|
|
55
|
+
message: `${t("addresses.toasts.addressUpdated")}\n${t(
|
|
56
|
+
"shared.messages.changesTimeout"
|
|
57
|
+
)}`,
|
|
55
58
|
status: "INFO",
|
|
56
59
|
});
|
|
57
60
|
onUpdate?.();
|
|
@@ -72,7 +75,7 @@ export const EditAddressDrawer = ({
|
|
|
72
75
|
);
|
|
73
76
|
|
|
74
77
|
pushToast({
|
|
75
|
-
message: "
|
|
78
|
+
message: t("addresses.errors.addressUpdate"),
|
|
76
79
|
status: "ERROR",
|
|
77
80
|
});
|
|
78
81
|
},
|
|
@@ -112,7 +115,10 @@ export const EditAddressDrawer = ({
|
|
|
112
115
|
|
|
113
116
|
return (
|
|
114
117
|
<BasicDrawer data-fs-bp-edit-address-drawer close={close} {...props}>
|
|
115
|
-
<BasicDrawer.Heading
|
|
118
|
+
<BasicDrawer.Heading
|
|
119
|
+
title={t("addresses.drawers.editAddressDetails")}
|
|
120
|
+
onClose={close}
|
|
121
|
+
/>
|
|
116
122
|
<BasicDrawer.Body>
|
|
117
123
|
<AddressForm
|
|
118
124
|
address={address}
|
|
@@ -125,7 +131,7 @@ export const EditAddressDrawer = ({
|
|
|
125
131
|
|
|
126
132
|
<BasicDrawer.Footer>
|
|
127
133
|
<BasicDrawer.Button variant="ghost" onClick={close}>
|
|
128
|
-
|
|
134
|
+
{t("shared.buttons.cancel")}
|
|
129
135
|
</BasicDrawer.Button>
|
|
130
136
|
<BasicDrawer.Button
|
|
131
137
|
variant="confirm"
|
|
@@ -133,7 +139,7 @@ export const EditAddressDrawer = ({
|
|
|
133
139
|
onClick={handleConfirmClick}
|
|
134
140
|
isLoading={isEditAddressLoading}
|
|
135
141
|
>
|
|
136
|
-
|
|
142
|
+
{t("shared.buttons.save")}
|
|
137
143
|
</BasicDrawer.Button>
|
|
138
144
|
</BasicDrawer.Footer>
|
|
139
145
|
</BasicDrawer>
|
package/src/features/addresses/components/EditAddressLocationDrawer/EditAddressLocationDrawer.tsx
CHANGED
|
@@ -4,11 +4,9 @@ import { CheckboxField, 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 {
|
|
9
|
-
CHANGES_TIMEOUT_MESSAGE,
|
|
10
|
-
LOCAL_STORAGE_LOCATION_EDIT_KEY,
|
|
11
|
-
} from "../../../shared/utils/constants";
|
|
9
|
+
import { LOCAL_STORAGE_LOCATION_EDIT_KEY } from "../../../shared/utils/constants";
|
|
12
10
|
import { useAddressLocationEdit } from "../../hooks";
|
|
13
11
|
import { LocationField } from "../LocationForm/LocationField/LocationField";
|
|
14
12
|
|
|
@@ -28,7 +26,7 @@ export const EditAddressLocationDrawer = ({
|
|
|
28
26
|
close,
|
|
29
27
|
location,
|
|
30
28
|
onEditSuccess,
|
|
31
|
-
locationsLabel
|
|
29
|
+
locationsLabel,
|
|
32
30
|
...props
|
|
33
31
|
}: EditAddressLocationDrawerProps) => {
|
|
34
32
|
if (!location) {
|
|
@@ -36,15 +34,21 @@ export const EditAddressLocationDrawer = ({
|
|
|
36
34
|
}
|
|
37
35
|
|
|
38
36
|
const { pushToast } = useUI();
|
|
37
|
+
const { t } = useLocalization();
|
|
39
38
|
const [field, setField] = useState<LocationInput>({ name: location.value });
|
|
40
39
|
const [confirmView, setConfirmView] = useState(false);
|
|
41
40
|
const [skipConfirm, setSkipConfirm] = useState(
|
|
42
41
|
localStorage.getItem(LOCAL_STORAGE_LOCATION_EDIT_KEY) === "true"
|
|
43
42
|
);
|
|
44
43
|
const saveIsDisable = location.value === field.name;
|
|
44
|
+
|
|
45
|
+
const resolvedLocationsLabel =
|
|
46
|
+
locationsLabel ?? t("addresses.labels.locations");
|
|
47
|
+
|
|
45
48
|
const drawerTitle = confirmView
|
|
46
|
-
?
|
|
47
|
-
:
|
|
49
|
+
? t("addresses.drawers.confirmLocationUpdate", [resolvedLocationsLabel])
|
|
50
|
+
: t("addresses.drawers.editLocation", [resolvedLocationsLabel]);
|
|
51
|
+
|
|
48
52
|
const { currentOrgUnit } = useBuyerPortal();
|
|
49
53
|
const { trackEntityEdited, trackEntityEditError } = useAnalytics({
|
|
50
54
|
entityType: "location",
|
|
@@ -64,7 +68,9 @@ export const EditAddressLocationDrawer = ({
|
|
|
64
68
|
});
|
|
65
69
|
|
|
66
70
|
pushToast({
|
|
67
|
-
message:
|
|
71
|
+
message: `${t("addresses.toasts.locationEdited")}\n${t(
|
|
72
|
+
"shared.messages.changesTimeout"
|
|
73
|
+
)}`,
|
|
68
74
|
status: "INFO",
|
|
69
75
|
});
|
|
70
76
|
|
|
@@ -83,7 +89,7 @@ export const EditAddressLocationDrawer = ({
|
|
|
83
89
|
);
|
|
84
90
|
|
|
85
91
|
pushToast({
|
|
86
|
-
message:
|
|
92
|
+
message: t("addresses.errors.locationEdit", [resolvedLocationsLabel]),
|
|
87
93
|
status: "ERROR",
|
|
88
94
|
});
|
|
89
95
|
},
|
|
@@ -115,17 +121,18 @@ export const EditAddressLocationDrawer = ({
|
|
|
115
121
|
|
|
116
122
|
return (
|
|
117
123
|
<BasicDrawer data-fs-bp-edit-location-drawer close={close} {...props}>
|
|
118
|
-
<BasicDrawer.Heading title={drawerTitle} onClose={close} />
|
|
124
|
+
<BasicDrawer.Heading title={drawerTitle as string} onClose={close} />
|
|
119
125
|
<BasicDrawer.Body>
|
|
120
126
|
{confirmView ? (
|
|
121
127
|
<div data-fs-bp-edit-location-confirm>
|
|
122
128
|
<p>
|
|
123
|
-
|
|
124
|
-
|
|
129
|
+
{t("addresses.editLocation.multiUnitWarning", [
|
|
130
|
+
resolvedLocationsLabel,
|
|
131
|
+
])}
|
|
125
132
|
</p>
|
|
126
|
-
<p>
|
|
133
|
+
<p>{t("addresses.editLocation.proceedQuestion")}</p>
|
|
127
134
|
<CheckboxField
|
|
128
|
-
label=
|
|
135
|
+
label={t("addresses.forms.dontShowAgain")}
|
|
129
136
|
id="confirm-change"
|
|
130
137
|
defaultChecked={skipConfirm}
|
|
131
138
|
onChange={(e) => setSkipConfirm(e.target.checked)}
|
|
@@ -136,13 +143,13 @@ export const EditAddressLocationDrawer = ({
|
|
|
136
143
|
index={0}
|
|
137
144
|
location={field}
|
|
138
145
|
onChange={(value) => setField({ name: value })}
|
|
139
|
-
locationsLabel={
|
|
146
|
+
locationsLabel={resolvedLocationsLabel}
|
|
140
147
|
/>
|
|
141
148
|
)}
|
|
142
149
|
</BasicDrawer.Body>
|
|
143
150
|
<BasicDrawer.Footer>
|
|
144
151
|
<BasicDrawer.Button variant="ghost" onClick={close}>
|
|
145
|
-
|
|
152
|
+
{t("shared.buttons.cancel")}
|
|
146
153
|
</BasicDrawer.Button>
|
|
147
154
|
<BasicDrawer.Button
|
|
148
155
|
variant="confirm"
|
|
@@ -150,7 +157,7 @@ export const EditAddressLocationDrawer = ({
|
|
|
150
157
|
onClick={handleSaveClick}
|
|
151
158
|
isLoading={editLocationLoading}
|
|
152
159
|
>
|
|
153
|
-
|
|
160
|
+
{t("shared.buttons.save")}
|
|
154
161
|
</BasicDrawer.Button>
|
|
155
162
|
</BasicDrawer.Footer>
|
|
156
163
|
</BasicDrawer>
|
package/src/features/addresses/components/EditRecipientAddressDrawer/EditRecipientAddressDrawer.tsx
CHANGED
|
@@ -6,11 +6,9 @@ import { CheckboxField, useUI } from "@faststore/ui";
|
|
|
6
6
|
|
|
7
7
|
import { type BasicDrawerProps, BasicDrawer } from "../../../shared/components";
|
|
8
8
|
import { useAnalytics, useBuyerPortal } from "../../../shared/hooks";
|
|
9
|
+
import { useLocalization } from "../../../shared/localization/LocalizationContext";
|
|
9
10
|
import { ANALYTICS_EVENTS } from "../../../shared/services/logger/analytics/constants";
|
|
10
|
-
import {
|
|
11
|
-
CHANGES_TIMEOUT_MESSAGE,
|
|
12
|
-
LOCAL_STORAGE_RECIPIENT_EDIT_KEY,
|
|
13
|
-
} from "../../../shared/utils/constants";
|
|
11
|
+
import { LOCAL_STORAGE_RECIPIENT_EDIT_KEY } from "../../../shared/utils/constants";
|
|
14
12
|
import { useEditRecipientsToAddress } from "../../hooks/useEditRecipientsToAddress";
|
|
15
13
|
import { type RecipientData, RecipientInput } from "../../types";
|
|
16
14
|
import { RecipientItem } from "../RecipientsForm/RecipientItem/RecipientItem";
|
|
@@ -33,6 +31,7 @@ export const EditRecipientAddressDrawer = ({
|
|
|
33
31
|
const { pushToast } = useUI();
|
|
34
32
|
const router = useRouter();
|
|
35
33
|
const { currentOrgUnit } = useBuyerPortal();
|
|
34
|
+
const { t } = useLocalization();
|
|
36
35
|
const { trackEntityEdited, trackEntityEditError } = useAnalytics({
|
|
37
36
|
entityType: "recipient",
|
|
38
37
|
entityId: recipient.id,
|
|
@@ -67,7 +66,9 @@ export const EditRecipientAddressDrawer = ({
|
|
|
67
66
|
});
|
|
68
67
|
|
|
69
68
|
pushToast({
|
|
70
|
-
message:
|
|
69
|
+
message: `${t("addresses.toasts.recipientEdited")}\n${t(
|
|
70
|
+
"shared.messages.changesTimeout"
|
|
71
|
+
)}`,
|
|
71
72
|
status: "INFO",
|
|
72
73
|
});
|
|
73
74
|
refetchRecipients();
|
|
@@ -89,7 +90,7 @@ export const EditRecipientAddressDrawer = ({
|
|
|
89
90
|
);
|
|
90
91
|
|
|
91
92
|
pushToast({
|
|
92
|
-
message: "
|
|
93
|
+
message: t("addresses.errors.recipientEdit"),
|
|
93
94
|
status: "ERROR",
|
|
94
95
|
});
|
|
95
96
|
},
|
|
@@ -143,8 +144,12 @@ export const EditRecipientAddressDrawer = ({
|
|
|
143
144
|
initialRecipientName !== newRecipient.name ||
|
|
144
145
|
newRecipient.phone !== recipient.phone;
|
|
145
146
|
|
|
146
|
-
const drawerTitle = confirmChange
|
|
147
|
-
|
|
147
|
+
const drawerTitle = confirmChange
|
|
148
|
+
? t("addresses.drawers.confirmChanges")
|
|
149
|
+
: t("addresses.drawers.editRecipient");
|
|
150
|
+
const actionButtonLabel = confirmChange
|
|
151
|
+
? t("shared.buttons.confirm")
|
|
152
|
+
: t("shared.buttons.save");
|
|
148
153
|
|
|
149
154
|
return (
|
|
150
155
|
<BasicDrawer
|
|
@@ -156,15 +161,12 @@ export const EditRecipientAddressDrawer = ({
|
|
|
156
161
|
<BasicDrawer.Body>
|
|
157
162
|
{confirmChange ? (
|
|
158
163
|
<div data-fs-bp-edit-address-recipient-drawer-body>
|
|
159
|
-
<p>
|
|
160
|
-
This recipient may be used by multiple units through its
|
|
161
|
-
associated address. Updates will affect all of them.
|
|
162
|
-
</p>
|
|
164
|
+
<p>{t("addresses.editRecipient.multiUnitWarning")}</p>
|
|
163
165
|
<br />
|
|
164
|
-
<p>
|
|
166
|
+
<p>{t("addresses.editRecipient.proceedQuestion")}</p>
|
|
165
167
|
<br />
|
|
166
168
|
<CheckboxField
|
|
167
|
-
label=
|
|
169
|
+
label={t("addresses.forms.dontShowAgain")}
|
|
168
170
|
id="confirm-change"
|
|
169
171
|
defaultChecked={dontShowAgain}
|
|
170
172
|
onChange={handleCheckboxChange}
|
|
@@ -186,7 +188,7 @@ export const EditRecipientAddressDrawer = ({
|
|
|
186
188
|
|
|
187
189
|
<BasicDrawer.Footer>
|
|
188
190
|
<BasicDrawer.Button variant="ghost" onClick={close}>
|
|
189
|
-
|
|
191
|
+
{t("shared.buttons.cancel")}
|
|
190
192
|
</BasicDrawer.Button>
|
|
191
193
|
<BasicDrawer.Button
|
|
192
194
|
variant="confirm"
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { IconButton } from "@faststore/ui";
|
|
2
2
|
|
|
3
3
|
import { Icon, InputText } from "../../../../shared/components";
|
|
4
|
+
import { useLocalization } from "../../../../shared/localization/LocalizationContext";
|
|
4
5
|
|
|
5
6
|
import type { LocationInput } from "../../../types/AddressData";
|
|
6
7
|
|
|
@@ -19,14 +20,16 @@ export const LocationField = ({
|
|
|
19
20
|
onChange,
|
|
20
21
|
onDelete,
|
|
21
22
|
canRemove = false,
|
|
22
|
-
locationsLabel
|
|
23
|
+
locationsLabel,
|
|
23
24
|
}: LocationFieldProps) => {
|
|
25
|
+
const { t } = useLocalization();
|
|
26
|
+
|
|
27
|
+
const resolvedLabel = locationsLabel ?? t("addresses.labels.locations");
|
|
28
|
+
|
|
24
29
|
return (
|
|
25
30
|
<div data-fs-bp-location-form-field={index === 0}>
|
|
26
31
|
<div data-fs-bp-location-form-label>
|
|
27
|
-
<p>
|
|
28
|
-
{locationsLabel} {index + 1}
|
|
29
|
-
</p>
|
|
32
|
+
<p>{t("addresses.forms.locationNumber", [resolvedLabel, index + 1])}</p>
|
|
30
33
|
{canRemove && (
|
|
31
34
|
<IconButton
|
|
32
35
|
data-fs-bp-location-form-remove-btn
|
|
@@ -37,7 +40,7 @@ export const LocationField = ({
|
|
|
37
40
|
)}
|
|
38
41
|
</div>
|
|
39
42
|
<InputText
|
|
40
|
-
label={
|
|
43
|
+
label={t("addresses.forms.locationName", [resolvedLabel])}
|
|
41
44
|
className="location-input"
|
|
42
45
|
value={location.name}
|
|
43
46
|
onChange={(event) => onChange(event.target.value)}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { Button } from "@faststore/ui";
|
|
2
2
|
|
|
3
|
+
import { useLocalization } from "../../../shared/localization/LocalizationContext";
|
|
4
|
+
|
|
3
5
|
import { LocationField } from "./LocationField/LocationField";
|
|
4
6
|
|
|
5
7
|
import type { LocationInput } from "../../types/AddressData";
|
|
@@ -15,8 +17,12 @@ export const LocationForm = ({
|
|
|
15
17
|
locations,
|
|
16
18
|
onLocationsChange,
|
|
17
19
|
description = "",
|
|
18
|
-
locationsLabel
|
|
20
|
+
locationsLabel,
|
|
19
21
|
}: LocationFormProps) => {
|
|
22
|
+
const { t } = useLocalization();
|
|
23
|
+
|
|
24
|
+
const resolvedLabel = locationsLabel ?? t("addresses.labels.locations");
|
|
25
|
+
|
|
20
26
|
const onChangeField = (value: string, index: number) => {
|
|
21
27
|
const locationsCopy = [...locations];
|
|
22
28
|
locationsCopy[index].name = value;
|
|
@@ -39,7 +45,7 @@ export const LocationForm = ({
|
|
|
39
45
|
key={`location-${index}`}
|
|
40
46
|
index={index}
|
|
41
47
|
location={location}
|
|
42
|
-
locationsLabel={
|
|
48
|
+
locationsLabel={resolvedLabel}
|
|
43
49
|
canRemove
|
|
44
50
|
onDelete={() => onDelete(index)}
|
|
45
51
|
onChange={(value: string) => onChangeField(value, index)}
|
|
@@ -50,7 +56,7 @@ export const LocationForm = ({
|
|
|
50
56
|
data-fs-bp-add-location={locations.length > 0}
|
|
51
57
|
onClick={onAddLocations}
|
|
52
58
|
>
|
|
53
|
-
|
|
59
|
+
{t("addresses.buttons.addLocation", [resolvedLabel])}
|
|
54
60
|
</Button>
|
|
55
61
|
</div>
|
|
56
62
|
);
|
|
@@ -7,9 +7,9 @@ import { useUI } from "@faststore/ui";
|
|
|
7
7
|
import { LocationForm } from "../";
|
|
8
8
|
import { type BasicDrawerProps, BasicDrawer } from "../../../shared/components";
|
|
9
9
|
import { useAnalytics, useBuyerPortal } from "../../../shared/hooks";
|
|
10
|
+
import { useLocalization } from "../../../shared/localization/LocalizationContext";
|
|
10
11
|
import { ANALYTICS_EVENTS } from "../../../shared/services/logger/analytics/constants";
|
|
11
12
|
import { buyerPortalRoutes } from "../../../shared/utils/buyerPortalRoutes";
|
|
12
|
-
import { CHANGES_TIMEOUT_MESSAGE } from "../../../shared/utils/constants";
|
|
13
13
|
import { useAddLocationsToAddress } from "../../hooks";
|
|
14
14
|
|
|
15
15
|
import type { LocationInput } from "../../types/AddressData";
|
|
@@ -25,12 +25,13 @@ export const LocationDrawer = ({
|
|
|
25
25
|
close,
|
|
26
26
|
addressId,
|
|
27
27
|
onAddLocationSuccess,
|
|
28
|
-
locationsLabel
|
|
28
|
+
locationsLabel,
|
|
29
29
|
...props
|
|
30
30
|
}: LocationDrawerProps) => {
|
|
31
31
|
const { currentOrgUnit } = useBuyerPortal();
|
|
32
32
|
const [locations, setLocations] = useState<LocationInput[]>([{ name: "" }]);
|
|
33
33
|
const { pushToast } = useUI();
|
|
34
|
+
const { t } = useLocalization();
|
|
34
35
|
const router = useRouter();
|
|
35
36
|
const { trackEvent, trackEntityCreated, trackEntityCreateError } =
|
|
36
37
|
useAnalytics({
|
|
@@ -39,6 +40,9 @@ export const LocationDrawer = ({
|
|
|
39
40
|
shouldTrackDefaultTimer: true,
|
|
40
41
|
});
|
|
41
42
|
|
|
43
|
+
const resolvedLocationsLabel =
|
|
44
|
+
locationsLabel ?? t("addresses.labels.locations");
|
|
45
|
+
|
|
42
46
|
const saveIsDisabled = locations.filter(({ name }) => !!name).length === 0;
|
|
43
47
|
|
|
44
48
|
const { addLocationsMutate, addLocationsLoading } = useAddLocationsToAddress({
|
|
@@ -61,7 +65,9 @@ export const LocationDrawer = ({
|
|
|
61
65
|
});
|
|
62
66
|
|
|
63
67
|
pushToast({
|
|
64
|
-
message:
|
|
68
|
+
message: `${t("addresses.toasts.locationsAdded")}\n${t(
|
|
69
|
+
"shared.messages.changesTimeout"
|
|
70
|
+
)}`,
|
|
65
71
|
status: "INFO",
|
|
66
72
|
icon: (
|
|
67
73
|
<button
|
|
@@ -77,7 +83,7 @@ export const LocationDrawer = ({
|
|
|
77
83
|
router.push(`${url}?tab=location-tab`);
|
|
78
84
|
}}
|
|
79
85
|
>
|
|
80
|
-
|
|
86
|
+
{t("shared.buttons.view")}
|
|
81
87
|
</button>
|
|
82
88
|
),
|
|
83
89
|
});
|
|
@@ -94,7 +100,7 @@ export const LocationDrawer = ({
|
|
|
94
100
|
});
|
|
95
101
|
|
|
96
102
|
pushToast({
|
|
97
|
-
message:
|
|
103
|
+
message: t("addresses.errors.locationsAdd", [resolvedLocationsLabel]),
|
|
98
104
|
status: "ERROR",
|
|
99
105
|
});
|
|
100
106
|
},
|
|
@@ -127,20 +133,20 @@ export const LocationDrawer = ({
|
|
|
127
133
|
{...props}
|
|
128
134
|
>
|
|
129
135
|
<BasicDrawer.Heading
|
|
130
|
-
title={
|
|
136
|
+
title={t("addresses.drawers.addLocations", [resolvedLocationsLabel])}
|
|
131
137
|
onClose={clearAndClose}
|
|
132
138
|
/>
|
|
133
139
|
<BasicDrawer.Body>
|
|
134
140
|
<LocationForm
|
|
135
141
|
locations={locations}
|
|
136
142
|
onLocationsChange={setLocations}
|
|
137
|
-
locationsLabel={
|
|
143
|
+
locationsLabel={resolvedLocationsLabel}
|
|
138
144
|
/>
|
|
139
145
|
</BasicDrawer.Body>
|
|
140
146
|
|
|
141
147
|
<BasicDrawer.Footer>
|
|
142
148
|
<BasicDrawer.Button variant="ghost" onClick={clearAndClose}>
|
|
143
|
-
|
|
149
|
+
{t("shared.buttons.cancel")}
|
|
144
150
|
</BasicDrawer.Button>
|
|
145
151
|
<BasicDrawer.Button
|
|
146
152
|
variant="confirm"
|
|
@@ -148,7 +154,7 @@ export const LocationDrawer = ({
|
|
|
148
154
|
onClick={handleConfirmClick}
|
|
149
155
|
isLoading={addLocationsLoading}
|
|
150
156
|
>
|
|
151
|
-
|
|
157
|
+
{t("shared.buttons.save")}
|
|
152
158
|
</BasicDrawer.Button>
|
|
153
159
|
</BasicDrawer.Footer>
|
|
154
160
|
</BasicDrawer>
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Icon, InputText } from "../../../../shared/components";
|
|
2
|
+
import { useLocalization } from "../../../../shared/localization/LocalizationContext";
|
|
2
3
|
import {
|
|
3
4
|
maskPhoneNumber,
|
|
4
5
|
normalizePhoneNumber,
|
|
@@ -20,51 +21,59 @@ export const RecipientItem = ({
|
|
|
20
21
|
onChange,
|
|
21
22
|
onDelete,
|
|
22
23
|
editSingle = false,
|
|
23
|
-
}: RecipientItemProps) =>
|
|
24
|
-
|
|
25
|
-
{!editSingle && onDelete && (
|
|
26
|
-
<div data-fs-recipients-separator-wrapper>
|
|
27
|
-
<span data-fs-recipients-item-title>Recipient {index + 1}</span>
|
|
28
|
-
<Icon
|
|
29
|
-
name="Trash"
|
|
30
|
-
width={15}
|
|
31
|
-
height={15}
|
|
32
|
-
onClick={() => onDelete(index)}
|
|
33
|
-
style={{ cursor: "pointer" }}
|
|
34
|
-
/>
|
|
35
|
-
</div>
|
|
36
|
-
)}
|
|
24
|
+
}: RecipientItemProps) => {
|
|
25
|
+
const { t } = useLocalization();
|
|
37
26
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
27
|
+
return (
|
|
28
|
+
<div data-fs-recipient-item>
|
|
29
|
+
{!editSingle && onDelete && (
|
|
30
|
+
<div data-fs-recipients-separator-wrapper>
|
|
31
|
+
<span data-fs-recipients-item-title>
|
|
32
|
+
{t("addresses.forms.recipientNumber", [index + 1])}
|
|
33
|
+
</span>
|
|
34
|
+
<Icon
|
|
35
|
+
name="Trash"
|
|
36
|
+
width={15}
|
|
37
|
+
height={15}
|
|
38
|
+
onClick={() => onDelete(index)}
|
|
39
|
+
style={{ cursor: "pointer" }}
|
|
40
|
+
/>
|
|
41
|
+
</div>
|
|
42
|
+
)}
|
|
50
43
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
44
|
+
<InputText
|
|
45
|
+
label={t("shared.labels.name")}
|
|
46
|
+
value={recipient.recipientName}
|
|
47
|
+
className="recipients-name"
|
|
48
|
+
wrapperProps={{
|
|
49
|
+
style: {
|
|
50
|
+
borderBottomLeftRadius: 0,
|
|
51
|
+
borderBottomRightRadius: 0,
|
|
52
|
+
},
|
|
53
|
+
}}
|
|
54
|
+
onChange={(event) =>
|
|
55
|
+
onChange(index, "recipientName", event.target.value)
|
|
56
|
+
}
|
|
57
|
+
/>
|
|
58
|
+
|
|
59
|
+
<InputText
|
|
60
|
+
label={t("addresses.forms.phoneNumber")}
|
|
61
|
+
className="recipients-phone"
|
|
62
|
+
value={maskPhoneNumber(recipient.recipientPhone, "USA")}
|
|
63
|
+
wrapperProps={{
|
|
64
|
+
style: {
|
|
65
|
+
borderTopLeftRadius: 0,
|
|
66
|
+
borderTopRightRadius: 0,
|
|
67
|
+
},
|
|
68
|
+
}}
|
|
69
|
+
onChange={(event) =>
|
|
70
|
+
onChange(
|
|
71
|
+
index,
|
|
72
|
+
"recipientPhone",
|
|
73
|
+
normalizePhoneNumber(event.target.value)
|
|
74
|
+
)
|
|
75
|
+
}
|
|
76
|
+
/>
|
|
77
|
+
</div>
|
|
78
|
+
);
|
|
79
|
+
};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Button } from "@faststore/ui";
|
|
2
2
|
|
|
3
|
+
import { useLocalization } from "../../../shared/localization/LocalizationContext";
|
|
3
4
|
import { RecipientInput } from "../../types";
|
|
4
5
|
|
|
5
6
|
import { RecipientItem } from "./RecipientItem/RecipientItem";
|
|
@@ -13,6 +14,8 @@ export const RecipientsForm = ({
|
|
|
13
14
|
recipients,
|
|
14
15
|
setRecipients,
|
|
15
16
|
}: RecipientsFormProps) => {
|
|
17
|
+
const { t } = useLocalization();
|
|
18
|
+
|
|
16
19
|
const handleChange = (
|
|
17
20
|
index: number,
|
|
18
21
|
field: keyof RecipientInput,
|
|
@@ -53,7 +56,7 @@ export const RecipientsForm = ({
|
|
|
53
56
|
</div>
|
|
54
57
|
|
|
55
58
|
<Button data-fs-bp-add-recipients onClick={handleAddRecipient}>
|
|
56
|
-
|
|
59
|
+
{t("addresses.buttons.addRecipient")}
|
|
57
60
|
</Button>
|
|
58
61
|
</div>
|
|
59
62
|
);
|
|
@@ -2,7 +2,7 @@ import { useUI } from "@faststore/ui";
|
|
|
2
2
|
|
|
3
3
|
import { type BasicDrawerProps, BasicDrawer } from "../../../shared/components";
|
|
4
4
|
import { useRemoveFromScope, useBuyerPortal } from "../../../shared/hooks";
|
|
5
|
-
import {
|
|
5
|
+
import { useLocalization } from "../../../shared/localization/LocalizationContext";
|
|
6
6
|
|
|
7
7
|
export type RemoveAddressDrawerProps = Omit<BasicDrawerProps, "children"> & {
|
|
8
8
|
readonly?: boolean;
|
|
@@ -20,10 +20,13 @@ export const RemoveAddressDrawer = ({
|
|
|
20
20
|
}: RemoveAddressDrawerProps) => {
|
|
21
21
|
const { pushToast } = useUI();
|
|
22
22
|
const { currentOrgUnit } = useBuyerPortal();
|
|
23
|
+
const { t } = useLocalization();
|
|
23
24
|
|
|
24
25
|
const handeRemoveFromScopeSuccess = () => {
|
|
25
26
|
pushToast({
|
|
26
|
-
message:
|
|
27
|
+
message: `${t("addresses.toasts.addressRemoved")}\n${t(
|
|
28
|
+
"shared.messages.changesTimeout"
|
|
29
|
+
)}`,
|
|
27
30
|
status: "INFO",
|
|
28
31
|
});
|
|
29
32
|
onUpdate?.();
|
|
@@ -34,7 +37,7 @@ export const RemoveAddressDrawer = ({
|
|
|
34
37
|
onSuccess: handeRemoveFromScopeSuccess,
|
|
35
38
|
onError: () => {
|
|
36
39
|
pushToast({
|
|
37
|
-
message: "
|
|
40
|
+
message: t("addresses.errors.addressRemoveFromUnit"),
|
|
38
41
|
status: "ERROR",
|
|
39
42
|
});
|
|
40
43
|
},
|
|
@@ -50,29 +53,33 @@ export const RemoveAddressDrawer = ({
|
|
|
50
53
|
|
|
51
54
|
return (
|
|
52
55
|
<BasicDrawer data-fs-bp-remove-address-drawer close={close} {...props}>
|
|
53
|
-
<BasicDrawer.Heading
|
|
56
|
+
<BasicDrawer.Heading
|
|
57
|
+
title={t("addresses.drawers.removeAddressFromUnit")}
|
|
58
|
+
onClose={close}
|
|
59
|
+
/>
|
|
54
60
|
<BasicDrawer.Body>
|
|
55
61
|
<div>
|
|
56
62
|
<p>
|
|
57
|
-
{"
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
63
|
+
{t("addresses.removeAddress.confirmQuestion", [
|
|
64
|
+
<span key="address-name" data-fs-bp-drawer-label>
|
|
65
|
+
{addressName}
|
|
66
|
+
</span>,
|
|
67
|
+
<span key="unit-name" data-fs-bp-drawer-label>
|
|
68
|
+
{currentOrgUnit?.name}
|
|
69
|
+
</span>,
|
|
70
|
+
])}
|
|
61
71
|
</p>
|
|
62
72
|
<br />
|
|
63
|
-
<p>
|
|
64
|
-
This action will prevent users in this unit from accessing this
|
|
65
|
-
address during store navigation and checkout
|
|
66
|
-
</p>
|
|
73
|
+
<p>{t("addresses.removeAddress.warning")}</p>
|
|
67
74
|
</div>
|
|
68
75
|
</BasicDrawer.Body>
|
|
69
76
|
|
|
70
77
|
<BasicDrawer.Footer>
|
|
71
78
|
<BasicDrawer.Button variant="ghost" onClick={close}>
|
|
72
|
-
|
|
79
|
+
{t("shared.buttons.cancel")}
|
|
73
80
|
</BasicDrawer.Button>
|
|
74
81
|
<BasicDrawer.Button variant="confirm" onClick={handleConfirmClick}>
|
|
75
|
-
|
|
82
|
+
{t("shared.buttons.remove")}
|
|
76
83
|
</BasicDrawer.Button>
|
|
77
84
|
</BasicDrawer.Footer>
|
|
78
85
|
</BasicDrawer>
|