@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
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { ErrorMessage, InputText } from "../../../shared/components";
|
|
2
|
+
import { useLocalization } from "../../../shared/localization/LocalizationContext";
|
|
2
3
|
import {
|
|
3
4
|
maskPhoneNumber,
|
|
4
5
|
normalizePhoneNumber,
|
|
@@ -12,8 +13,6 @@ export interface LoginFieldProps {
|
|
|
12
13
|
"data-testid"?: string;
|
|
13
14
|
}
|
|
14
15
|
|
|
15
|
-
const LOGIN_REQUIRED_MSG = "Login is required";
|
|
16
|
-
|
|
17
16
|
export const LoginField = ({
|
|
18
17
|
value,
|
|
19
18
|
onChange,
|
|
@@ -22,6 +21,7 @@ export const LoginField = ({
|
|
|
22
21
|
}: LoginFieldProps) => {
|
|
23
22
|
const hasError = isTouched && !value.trim();
|
|
24
23
|
const isPhone = detectLoginType(value) === "phone";
|
|
24
|
+
const { t } = useLocalization();
|
|
25
25
|
|
|
26
26
|
// TODO: Update country when implementing i18n
|
|
27
27
|
const displayValue = isPhone ? maskPhoneNumber(value, "USA") : value;
|
|
@@ -37,7 +37,7 @@ export const LoginField = ({
|
|
|
37
37
|
return (
|
|
38
38
|
<>
|
|
39
39
|
<InputText
|
|
40
|
-
label="
|
|
40
|
+
label={t("users.forms.login")}
|
|
41
41
|
value={displayValue}
|
|
42
42
|
hasError={hasError}
|
|
43
43
|
data-testid={testId}
|
|
@@ -46,7 +46,7 @@ export const LoginField = ({
|
|
|
46
46
|
/>
|
|
47
47
|
{hasError && (
|
|
48
48
|
<div id="login-error">
|
|
49
|
-
<ErrorMessage show message={
|
|
49
|
+
<ErrorMessage show message={t("users.validation.loginRequired")} />
|
|
50
50
|
</div>
|
|
51
51
|
)}
|
|
52
52
|
</>
|
|
@@ -10,8 +10,8 @@ import {
|
|
|
10
10
|
type BasicDrawerProps,
|
|
11
11
|
} from "../../../shared/components";
|
|
12
12
|
import { OptionSelected } from "../../../shared/components/OptionSelected/OptionSelected";
|
|
13
|
+
import { useLocalization } from "../../../shared/localization/LocalizationContext";
|
|
13
14
|
import { buyerPortalRoutes } from "../../../shared/utils/buyerPortalRoutes";
|
|
14
|
-
import { CHANGES_TIMEOUT_MESSAGE } from "../../../shared/utils/constants";
|
|
15
15
|
import { useDebouncedSearchOrgUnit, useReassignUser } from "../../hooks";
|
|
16
16
|
|
|
17
17
|
export type ReassignOrgUnitDrawerProps = Omit<BasicDrawerProps, "children"> & {
|
|
@@ -35,6 +35,7 @@ export const ReassignOrgUnitDrawer = ({
|
|
|
35
35
|
|
|
36
36
|
const { orgUnit } = useOrgUnitByUser(user.id);
|
|
37
37
|
const { pushToast } = useUI();
|
|
38
|
+
const { t } = useLocalization();
|
|
38
39
|
|
|
39
40
|
const { searchedOrgUnits } = useDebouncedSearchOrgUnit(
|
|
40
41
|
autocompleteInputValue
|
|
@@ -42,7 +43,9 @@ export const ReassignOrgUnitDrawer = ({
|
|
|
42
43
|
|
|
43
44
|
const handleReassignNewOrgUnitSuccess = () => {
|
|
44
45
|
pushToast({
|
|
45
|
-
message:
|
|
46
|
+
message: `${t("users.reassign.toasts.userSuccessfullyEdited")}\n${t(
|
|
47
|
+
"shared.messages.changesTimeout"
|
|
48
|
+
)}`,
|
|
46
49
|
status: "INFO",
|
|
47
50
|
});
|
|
48
51
|
onReassing?.();
|
|
@@ -53,7 +56,7 @@ export const ReassignOrgUnitDrawer = ({
|
|
|
53
56
|
onSuccess: handleReassignNewOrgUnitSuccess,
|
|
54
57
|
onError: () => {
|
|
55
58
|
pushToast({
|
|
56
|
-
message: "
|
|
59
|
+
message: t("users.reassign.errors.failedToReassign"),
|
|
57
60
|
status: "ERROR",
|
|
58
61
|
});
|
|
59
62
|
},
|
|
@@ -78,22 +81,22 @@ export const ReassignOrgUnitDrawer = ({
|
|
|
78
81
|
return (
|
|
79
82
|
<BasicDrawer data-fs-bp-reassign-user-drawer close={close} {...props}>
|
|
80
83
|
<BasicDrawer.Heading
|
|
81
|
-
title="
|
|
84
|
+
title={t("users.reassign.drawerTitle")}
|
|
82
85
|
onClose={close}
|
|
83
86
|
/>
|
|
84
87
|
<BasicDrawer.Body data-fs-bp-reassign-user-drawer-body>
|
|
85
88
|
<p>
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
89
|
+
{t("users.reassign.messages.selectNewUnit", [
|
|
90
|
+
<a
|
|
91
|
+
key="user-name"
|
|
92
|
+
href={buyerPortalRoutes.userDetails({
|
|
93
|
+
orgUnitId: orgUnit?.id || "",
|
|
94
|
+
userId: user.id,
|
|
95
|
+
})}
|
|
96
|
+
>
|
|
97
|
+
{user.name}
|
|
98
|
+
</a>,
|
|
99
|
+
])}
|
|
97
100
|
</p>
|
|
98
101
|
<br />
|
|
99
102
|
|
|
@@ -110,7 +113,7 @@ export const ReassignOrgUnitDrawer = ({
|
|
|
110
113
|
/>
|
|
111
114
|
) : (
|
|
112
115
|
<AutocompleteDropdown
|
|
113
|
-
label="
|
|
116
|
+
label={t("users.reassign.forms.searchOrganizationalUnits")}
|
|
114
117
|
value={autocompleteInputValue}
|
|
115
118
|
options={searchedOrgUnits}
|
|
116
119
|
onConfirmKeyPress={(option) => setNewOrgUnit(option)}
|
|
@@ -137,12 +140,12 @@ export const ReassignOrgUnitDrawer = ({
|
|
|
137
140
|
|
|
138
141
|
<ErrorMessage
|
|
139
142
|
show={isTouched && !newOrgUnit.name?.trim()}
|
|
140
|
-
message="
|
|
143
|
+
message={t("users.reassign.validation.newOrgUnitRequired")}
|
|
141
144
|
/>
|
|
142
145
|
</BasicDrawer.Body>
|
|
143
146
|
<BasicDrawer.Footer>
|
|
144
147
|
<BasicDrawer.Button variant="ghost" onClick={close}>
|
|
145
|
-
|
|
148
|
+
{t("shared.buttons.cancel")}
|
|
146
149
|
</BasicDrawer.Button>
|
|
147
150
|
<BasicDrawer.Button
|
|
148
151
|
variant="confirm"
|
|
@@ -150,7 +153,7 @@ export const ReassignOrgUnitDrawer = ({
|
|
|
150
153
|
onClick={handleConfirmClick}
|
|
151
154
|
isLoading={isReassignUserLoading}
|
|
152
155
|
>
|
|
153
|
-
|
|
156
|
+
{t("shared.buttons.save")}
|
|
154
157
|
</BasicDrawer.Button>
|
|
155
158
|
</BasicDrawer.Footer>
|
|
156
159
|
</BasicDrawer>
|
|
@@ -8,6 +8,7 @@ import {
|
|
|
8
8
|
type BasicDrawerProps,
|
|
9
9
|
} from "../../../shared/components";
|
|
10
10
|
import { useBuyerPortal } from "../../../shared/hooks";
|
|
11
|
+
import { useLocalization } from "../../../shared/localization/LocalizationContext";
|
|
11
12
|
import { useResetPassword } from "../../hooks";
|
|
12
13
|
|
|
13
14
|
type DrawerState = "CONFIRM_RESET" | "ACCESS_TOKEN_DISPLAY";
|
|
@@ -26,6 +27,7 @@ export const ResetPasswordDrawer = ({
|
|
|
26
27
|
}: ResetPasswordDrawerProps) => {
|
|
27
28
|
const { pushToast } = useUI();
|
|
28
29
|
const { currentOrgUnit } = useBuyerPortal();
|
|
30
|
+
const { t } = useLocalization();
|
|
29
31
|
|
|
30
32
|
const [drawerState, setDrawerState] = useState<DrawerState>("CONFIRM_RESET");
|
|
31
33
|
const [accessToken, setAccessToken] = useState<string>("");
|
|
@@ -41,10 +43,10 @@ export const ResetPasswordDrawer = ({
|
|
|
41
43
|
|
|
42
44
|
const handleResetPasswordError = useCallback(() => {
|
|
43
45
|
pushToast({
|
|
44
|
-
message: "
|
|
46
|
+
message: t("users.reset.errors.failedToResetPassword"),
|
|
45
47
|
status: "ERROR",
|
|
46
48
|
});
|
|
47
|
-
}, [pushToast]);
|
|
49
|
+
}, [pushToast, t]);
|
|
48
50
|
|
|
49
51
|
const { resetPassword, isResetPasswordLoading } = useResetPassword({
|
|
50
52
|
onSuccess: handleResetPasswordSuccess,
|
|
@@ -63,12 +65,12 @@ export const ResetPasswordDrawer = ({
|
|
|
63
65
|
await navigator.clipboard.writeText(accessToken);
|
|
64
66
|
setHasTokenBeenCopied(true);
|
|
65
67
|
pushToast({
|
|
66
|
-
message: "
|
|
68
|
+
message: t("users.reset.toasts.accessCodeCopied"),
|
|
67
69
|
status: "INFO",
|
|
68
70
|
});
|
|
69
71
|
} catch {
|
|
70
72
|
pushToast({
|
|
71
|
-
message: "
|
|
73
|
+
message: t("users.reset.toasts.failedToCopyAccessCode"),
|
|
72
74
|
status: "ERROR",
|
|
73
75
|
});
|
|
74
76
|
}
|
|
@@ -90,23 +92,23 @@ export const ResetPasswordDrawer = ({
|
|
|
90
92
|
>
|
|
91
93
|
{drawerState === "CONFIRM_RESET" && (
|
|
92
94
|
<>
|
|
93
|
-
<BasicDrawer.Heading
|
|
95
|
+
<BasicDrawer.Heading
|
|
96
|
+
title={t("users.reset.drawerTitle")}
|
|
97
|
+
onClose={close}
|
|
98
|
+
/>
|
|
94
99
|
<BasicDrawer.Body data-fs-bp-reset-password-drawer-body>
|
|
95
|
-
<p>
|
|
96
|
-
Are you sure you want to reset this user's password? The old
|
|
97
|
-
password will be deactivated immediately.
|
|
98
|
-
</p>
|
|
100
|
+
<p>{t("users.reset.messages.confirmResetPassword")}</p>
|
|
99
101
|
</BasicDrawer.Body>
|
|
100
102
|
<BasicDrawer.Footer>
|
|
101
103
|
<BasicDrawer.Button variant="ghost" onClick={close}>
|
|
102
|
-
|
|
104
|
+
{t("shared.buttons.cancel")}
|
|
103
105
|
</BasicDrawer.Button>
|
|
104
106
|
<BasicDrawer.Button
|
|
105
107
|
variant="confirm"
|
|
106
108
|
onClick={handleResetClick}
|
|
107
109
|
isLoading={isResetPasswordLoading}
|
|
108
110
|
>
|
|
109
|
-
|
|
111
|
+
{t("users.reset.buttons.reset")}
|
|
110
112
|
</BasicDrawer.Button>
|
|
111
113
|
</BasicDrawer.Footer>
|
|
112
114
|
</>
|
|
@@ -118,17 +120,10 @@ export const ResetPasswordDrawer = ({
|
|
|
118
120
|
<BasicDrawer.Body data-fs-bp-reset-password-access-token-body>
|
|
119
121
|
<AccessTokenDisplay
|
|
120
122
|
accessToken={accessToken}
|
|
121
|
-
title="
|
|
123
|
+
title={t("users.reset.messages.passwordResetSuccessfully")}
|
|
122
124
|
description={
|
|
123
125
|
<p>
|
|
124
|
-
|
|
125
|
-
Share it with the user, as they have no individual email
|
|
126
|
-
registered.
|
|
127
|
-
<br />
|
|
128
|
-
<br />
|
|
129
|
-
The code expires in 12 hours. Copy it before closing this
|
|
130
|
-
window. Once closed, access will be lost and a password reset
|
|
131
|
-
will be required.
|
|
126
|
+
{t("users.reset.messages.accessCodeGeneratedDescription")}
|
|
132
127
|
</p>
|
|
133
128
|
}
|
|
134
129
|
hasBeenCopied={hasTokenBeenCopied}
|
|
@@ -141,7 +136,7 @@ export const ResetPasswordDrawer = ({
|
|
|
141
136
|
onClick={handleClose}
|
|
142
137
|
disabled={!hasTokenBeenCopied}
|
|
143
138
|
>
|
|
144
|
-
|
|
139
|
+
{t("shared.buttons.done")}
|
|
145
140
|
</BasicDrawer.Button>
|
|
146
141
|
</BasicDrawer.Footer>
|
|
147
142
|
</>
|
|
@@ -11,9 +11,9 @@ import {
|
|
|
11
11
|
InputText,
|
|
12
12
|
} from "../../../shared/components";
|
|
13
13
|
import { useAnalytics } from "../../../shared/hooks";
|
|
14
|
+
import { useLocalization } from "../../../shared/localization/LocalizationContext";
|
|
14
15
|
import { ANALYTICS_EVENTS } from "../../../shared/services/logger/analytics/constants";
|
|
15
16
|
import { isValidEmail } from "../../../shared/utils";
|
|
16
|
-
import { CHANGES_TIMEOUT_MESSAGE } from "../../../shared/utils/constants";
|
|
17
17
|
import {
|
|
18
18
|
maskPhoneNumber,
|
|
19
19
|
normalizePhoneNumber,
|
|
@@ -36,6 +36,7 @@ export const UpdateUserDrawer = ({
|
|
|
36
36
|
...props
|
|
37
37
|
}: UpdateUserDrawerProps) => {
|
|
38
38
|
const { pushToast } = useUI();
|
|
39
|
+
const { t } = useLocalization();
|
|
39
40
|
const { trackEntityEdited, trackEntityEditError } = useAnalytics({
|
|
40
41
|
entityType: "user",
|
|
41
42
|
entityId: userId,
|
|
@@ -59,7 +60,7 @@ export const UpdateUserDrawer = ({
|
|
|
59
60
|
},
|
|
60
61
|
onError: () => {
|
|
61
62
|
pushToast({
|
|
62
|
-
message: "
|
|
63
|
+
message: t("users.update.errors.failedToFetchUserDetails"),
|
|
63
64
|
status: "ERROR",
|
|
64
65
|
});
|
|
65
66
|
},
|
|
@@ -104,7 +105,9 @@ export const UpdateUserDrawer = ({
|
|
|
104
105
|
});
|
|
105
106
|
|
|
106
107
|
pushToast({
|
|
107
|
-
message:
|
|
108
|
+
message: `${t("users.update.toasts.userSuccessfullyUpdated")}\n${t(
|
|
109
|
+
"shared.messages.changesTimeout"
|
|
110
|
+
)}`,
|
|
108
111
|
status: "INFO",
|
|
109
112
|
});
|
|
110
113
|
onUpdate?.();
|
|
@@ -125,7 +128,7 @@ export const UpdateUserDrawer = ({
|
|
|
125
128
|
);
|
|
126
129
|
|
|
127
130
|
pushToast({
|
|
128
|
-
message: "
|
|
131
|
+
message: t("users.update.errors.failedToUpdateUser"),
|
|
129
132
|
status: "ERROR",
|
|
130
133
|
});
|
|
131
134
|
},
|
|
@@ -145,7 +148,7 @@ export const UpdateUserDrawer = ({
|
|
|
145
148
|
);
|
|
146
149
|
|
|
147
150
|
pushToast({
|
|
148
|
-
message: "
|
|
151
|
+
message: t("users.update.errors.failedToUpdateUser"),
|
|
149
152
|
status: "ERROR",
|
|
150
153
|
});
|
|
151
154
|
},
|
|
@@ -199,14 +202,17 @@ export const UpdateUserDrawer = ({
|
|
|
199
202
|
|
|
200
203
|
return (
|
|
201
204
|
<BasicDrawer data-fs-bp-update-user-drawer close={close} {...props}>
|
|
202
|
-
<BasicDrawer.Heading
|
|
205
|
+
<BasicDrawer.Heading
|
|
206
|
+
title={t("users.edit.drawerTitle")}
|
|
207
|
+
onClose={close}
|
|
208
|
+
/>
|
|
203
209
|
|
|
204
210
|
<BasicDrawer.Body>
|
|
205
211
|
{isUserLoading ? (
|
|
206
212
|
<Skeleton size={{ width: "100%", height: "3.5rem" }} />
|
|
207
213
|
) : (
|
|
208
214
|
<InputText
|
|
209
|
-
label="
|
|
215
|
+
label={t("users.forms.fullName")}
|
|
210
216
|
value={name}
|
|
211
217
|
hasError={isTouched && !name?.trim()}
|
|
212
218
|
onChange={(event) => updateField("name", event.target.value)}
|
|
@@ -215,7 +221,7 @@ export const UpdateUserDrawer = ({
|
|
|
215
221
|
|
|
216
222
|
<ErrorMessage
|
|
217
223
|
show={isTouched && !name?.trim()}
|
|
218
|
-
message="
|
|
224
|
+
message={t("users.validation.fullNameRequired")}
|
|
219
225
|
/>
|
|
220
226
|
|
|
221
227
|
{isUserLoading ? (
|
|
@@ -230,7 +236,7 @@ export const UpdateUserDrawer = ({
|
|
|
230
236
|
/>
|
|
231
237
|
) : (
|
|
232
238
|
<InputText
|
|
233
|
-
label="
|
|
239
|
+
label={t("users.forms.email")}
|
|
234
240
|
value={email}
|
|
235
241
|
wrapperProps={{ style: { marginTop: 16, marginBottom: 16 } }}
|
|
236
242
|
hasError={isTouched && (emailMissing || emailInvalid)}
|
|
@@ -246,7 +252,11 @@ export const UpdateUserDrawer = ({
|
|
|
246
252
|
|
|
247
253
|
<ErrorMessage
|
|
248
254
|
show={isTouched && (emailMissing || emailInvalid)}
|
|
249
|
-
message={
|
|
255
|
+
message={
|
|
256
|
+
emailMissing
|
|
257
|
+
? t("users.validation.emailRequired")
|
|
258
|
+
: t("users.validation.emailInvalid")
|
|
259
|
+
}
|
|
250
260
|
/>
|
|
251
261
|
|
|
252
262
|
{isUserLoading ? (
|
|
@@ -261,17 +271,18 @@ export const UpdateUserDrawer = ({
|
|
|
261
271
|
/>
|
|
262
272
|
) : (
|
|
263
273
|
<InputText
|
|
264
|
-
label="
|
|
274
|
+
label={t("users.forms.phoneNumberOptional")}
|
|
265
275
|
value={maskPhoneNumber(phone, "USA")}
|
|
266
276
|
onChange={(event) =>
|
|
267
|
-
// TODO: Update this when implementing i18n
|
|
268
277
|
updateField("phone", normalizePhoneNumber(event.target.value))
|
|
269
278
|
}
|
|
270
279
|
/>
|
|
271
280
|
)}
|
|
272
281
|
|
|
273
282
|
<div data-fs-bp-update-user-roles>
|
|
274
|
-
<span data-fs-bp-update-user-roles-label>
|
|
283
|
+
<span data-fs-bp-update-user-roles-label>
|
|
284
|
+
{t("users.forms.roles")}
|
|
285
|
+
</span>
|
|
275
286
|
{rolesOptions &&
|
|
276
287
|
rolesOptions.map((role) => {
|
|
277
288
|
if (isUserLoading) {
|
|
@@ -309,7 +320,7 @@ export const UpdateUserDrawer = ({
|
|
|
309
320
|
</BasicDrawer.Body>
|
|
310
321
|
<BasicDrawer.Footer>
|
|
311
322
|
<BasicDrawer.Button variant="ghost" onClick={close}>
|
|
312
|
-
|
|
323
|
+
{t("shared.buttons.cancel")}
|
|
313
324
|
</BasicDrawer.Button>
|
|
314
325
|
<BasicDrawer.Button
|
|
315
326
|
variant="confirm"
|
|
@@ -317,7 +328,7 @@ export const UpdateUserDrawer = ({
|
|
|
317
328
|
onClick={handleConfirmClick}
|
|
318
329
|
isLoading={isLoading}
|
|
319
330
|
>
|
|
320
|
-
|
|
331
|
+
{t("shared.buttons.save")}
|
|
321
332
|
</BasicDrawer.Button>
|
|
322
333
|
</BasicDrawer.Footer>
|
|
323
334
|
</BasicDrawer>
|
package/src/features/users/components/UpdateUserDrawerWithUsername/UpdateUserDrawerWithUsername.tsx
CHANGED
|
@@ -6,9 +6,9 @@ import { useUpdateRoles } from "../../../roles/hooks";
|
|
|
6
6
|
import { RoleData, UserRoles } from "../../../roles/types";
|
|
7
7
|
import { type BasicDrawerProps, BasicDrawer } from "../../../shared/components";
|
|
8
8
|
import { useAnalytics } from "../../../shared/hooks";
|
|
9
|
+
import { useLocalization } from "../../../shared/localization/LocalizationContext";
|
|
9
10
|
import { ANALYTICS_EVENTS } from "../../../shared/services/logger/analytics/constants";
|
|
10
11
|
import { isValidEmail } from "../../../shared/utils";
|
|
11
|
-
import { CHANGES_TIMEOUT_MESSAGE } from "../../../shared/utils/constants";
|
|
12
12
|
import { normalizePhoneNumber } from "../../../shared/utils/phoneNumber";
|
|
13
13
|
import { useGetUserById, useUpdateUser } from "../../hooks";
|
|
14
14
|
import { detectLoginType } from "../../utils/detectLoginType";
|
|
@@ -46,6 +46,7 @@ export const UpdateUserDrawerWithUsername = ({
|
|
|
46
46
|
...props
|
|
47
47
|
}: UpdateUserDrawerWithUsernameProps) => {
|
|
48
48
|
const { pushToast } = useUI();
|
|
49
|
+
const { t } = useLocalization();
|
|
49
50
|
const { trackEntityEdited, trackEntityEditError } = useAnalytics({
|
|
50
51
|
entityType: "user",
|
|
51
52
|
entityId: userId,
|
|
@@ -87,7 +88,7 @@ export const UpdateUserDrawerWithUsername = ({
|
|
|
87
88
|
},
|
|
88
89
|
onError: () => {
|
|
89
90
|
pushToast({
|
|
90
|
-
message: "
|
|
91
|
+
message: t("users.update.errors.failedToFetchUserDetails"),
|
|
91
92
|
status: "ERROR",
|
|
92
93
|
});
|
|
93
94
|
},
|
|
@@ -154,7 +155,9 @@ export const UpdateUserDrawerWithUsername = ({
|
|
|
154
155
|
});
|
|
155
156
|
|
|
156
157
|
pushToast({
|
|
157
|
-
message:
|
|
158
|
+
message: `${t("users.update.toasts.userSuccessfullyUpdated")}\n${t(
|
|
159
|
+
"shared.messages.changesTimeout"
|
|
160
|
+
)}`,
|
|
158
161
|
status: "INFO",
|
|
159
162
|
});
|
|
160
163
|
onUpdate?.();
|
|
@@ -171,7 +174,11 @@ export const UpdateUserDrawerWithUsername = ({
|
|
|
171
174
|
error,
|
|
172
175
|
{ org_unit_id: orgUnitId }
|
|
173
176
|
);
|
|
174
|
-
|
|
177
|
+
|
|
178
|
+
pushToast({
|
|
179
|
+
message: t("users.update.errors.failedToUpdateUser"),
|
|
180
|
+
status: "ERROR",
|
|
181
|
+
});
|
|
175
182
|
},
|
|
176
183
|
});
|
|
177
184
|
|
|
@@ -185,7 +192,11 @@ export const UpdateUserDrawerWithUsername = ({
|
|
|
185
192
|
error,
|
|
186
193
|
{ org_unit_id: orgUnitId }
|
|
187
194
|
);
|
|
188
|
-
|
|
195
|
+
|
|
196
|
+
pushToast({
|
|
197
|
+
message: t("users.update.errors.failedToUpdateUser"),
|
|
198
|
+
status: "ERROR",
|
|
199
|
+
});
|
|
189
200
|
},
|
|
190
201
|
});
|
|
191
202
|
|
|
@@ -247,7 +258,10 @@ export const UpdateUserDrawerWithUsername = ({
|
|
|
247
258
|
close={close}
|
|
248
259
|
{...props}
|
|
249
260
|
>
|
|
250
|
-
<BasicDrawer.Heading
|
|
261
|
+
<BasicDrawer.Heading
|
|
262
|
+
title={t("users.edit.drawerTitle")}
|
|
263
|
+
onClose={close}
|
|
264
|
+
/>
|
|
251
265
|
|
|
252
266
|
<BasicDrawer.Body>
|
|
253
267
|
<UserFormFields
|
|
@@ -265,7 +279,7 @@ export const UpdateUserDrawerWithUsername = ({
|
|
|
265
279
|
|
|
266
280
|
<BasicDrawer.Footer>
|
|
267
281
|
<BasicDrawer.Button variant="ghost" onClick={close}>
|
|
268
|
-
|
|
282
|
+
{t("shared.buttons.cancel")}
|
|
269
283
|
</BasicDrawer.Button>
|
|
270
284
|
<BasicDrawer.Button
|
|
271
285
|
variant="confirm"
|
|
@@ -273,7 +287,7 @@ export const UpdateUserDrawerWithUsername = ({
|
|
|
273
287
|
onClick={handleConfirmClick}
|
|
274
288
|
isLoading={isLoading}
|
|
275
289
|
>
|
|
276
|
-
|
|
290
|
+
{t("shared.buttons.save")}
|
|
277
291
|
</BasicDrawer.Button>
|
|
278
292
|
</BasicDrawer.Footer>
|
|
279
293
|
</BasicDrawer>
|
|
@@ -4,6 +4,7 @@ import { DropdownItem } from "@faststore/ui";
|
|
|
4
4
|
|
|
5
5
|
import { BasicDropdownMenu, Icon } from "../../../shared/components";
|
|
6
6
|
import { useBuyerPortal, useDrawerProps } from "../../../shared/hooks";
|
|
7
|
+
import { useLocalization } from "../../../shared/localization/LocalizationContext";
|
|
7
8
|
import { buyerPortalRoutes } from "../../../shared/utils/buyerPortalRoutes";
|
|
8
9
|
import { DeleteUserDrawer } from "../DeleteUserDrawer/DeleteUserDrawer";
|
|
9
10
|
import { ReassignOrgUnitDrawer } from "../ReassignOrgUnitDrawer/ReassignOrgUnitDrawer";
|
|
@@ -30,6 +31,7 @@ export const UserDropdownMenu = ({
|
|
|
30
31
|
const route = useRouter();
|
|
31
32
|
|
|
32
33
|
const { currentOrgUnit, featureFlags } = useBuyerPortal();
|
|
34
|
+
const { t } = useLocalization();
|
|
33
35
|
|
|
34
36
|
const {
|
|
35
37
|
open: openReassignOrgUnitDrawer,
|
|
@@ -73,23 +75,23 @@ export const UserDropdownMenu = ({
|
|
|
73
75
|
}
|
|
74
76
|
>
|
|
75
77
|
<Icon name="OpenInNew" {...sizeProps} />
|
|
76
|
-
|
|
78
|
+
{t("users.dropdown.open")}
|
|
77
79
|
</DropdownItem>
|
|
78
80
|
<DropdownItem onClick={openUpdateUser}>
|
|
79
81
|
<Icon name="Edit" {...sizeProps} />
|
|
80
|
-
|
|
82
|
+
{t("users.actions.editDetails")}
|
|
81
83
|
</DropdownItem>
|
|
82
84
|
</>
|
|
83
85
|
)}
|
|
84
86
|
{featureFlags?.enableAlternativeLogin && (
|
|
85
87
|
<DropdownItem onClick={openResetPassword}>
|
|
86
88
|
<Icon name="ResetPassword" {...sizeProps} />
|
|
87
|
-
|
|
89
|
+
{t("users.dropdown.resetPassword")}
|
|
88
90
|
</DropdownItem>
|
|
89
91
|
)}
|
|
90
92
|
<DropdownItem onClick={openReassignOrgUnitDrawer}>
|
|
91
93
|
<Icon name="DriveFileMove" {...sizeProps} />
|
|
92
|
-
|
|
94
|
+
{t("users.dropdown.changeOrganizationalUnit")}
|
|
93
95
|
</DropdownItem>
|
|
94
96
|
<BasicDropdownMenu.Separator />
|
|
95
97
|
<DropdownItem
|
|
@@ -97,7 +99,7 @@ export const UserDropdownMenu = ({
|
|
|
97
99
|
data-fs-bp-dropdown-menu-item-mode="danger"
|
|
98
100
|
>
|
|
99
101
|
<Icon name="Delete" {...sizeProps} />
|
|
100
|
-
|
|
102
|
+
{t("shared.buttons.delete")}
|
|
101
103
|
</DropdownItem>
|
|
102
104
|
</BasicDropdownMenu>
|
|
103
105
|
{isDeleteUserDrawerOpen && (
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Alert, CheckboxField, Skeleton } from "@faststore/ui";
|
|
2
2
|
|
|
3
3
|
import { ErrorMessage, Icon, InputText } from "../../../shared/components";
|
|
4
|
+
import { useLocalization } from "../../../shared/localization/LocalizationContext";
|
|
4
5
|
import { isValidEmail } from "../../../shared/utils";
|
|
5
6
|
import {
|
|
6
7
|
maskPhoneNumber,
|
|
@@ -61,6 +62,7 @@ export const UserFormFields = ({
|
|
|
61
62
|
setIsLoginTouched,
|
|
62
63
|
loginTestId,
|
|
63
64
|
}: UserFormFieldsProps) => {
|
|
65
|
+
const { t } = useLocalization();
|
|
64
66
|
const {
|
|
65
67
|
login,
|
|
66
68
|
name,
|
|
@@ -98,7 +100,7 @@ export const UserFormFields = ({
|
|
|
98
100
|
/>
|
|
99
101
|
) : (
|
|
100
102
|
<InputText
|
|
101
|
-
label="
|
|
103
|
+
label={t("users.forms.fullNameOptional")}
|
|
102
104
|
value={name}
|
|
103
105
|
wrapperProps={{ style: { marginBottom: 16 } }}
|
|
104
106
|
onChange={(event) => updateField("name", event.target.value)}
|
|
@@ -146,7 +148,7 @@ export const UserFormFields = ({
|
|
|
146
148
|
/>
|
|
147
149
|
) : (
|
|
148
150
|
<InputText
|
|
149
|
-
label="
|
|
151
|
+
label={t("users.forms.phoneNumberOptional")}
|
|
150
152
|
value={maskPhoneNumber(phone, "USA")}
|
|
151
153
|
wrapperProps={{ style: { marginTop: 16 } }}
|
|
152
154
|
onChange={(event) =>
|
|
@@ -164,7 +166,7 @@ export const UserFormFields = ({
|
|
|
164
166
|
/>
|
|
165
167
|
) : (
|
|
166
168
|
<InputText
|
|
167
|
-
label="
|
|
169
|
+
label={t("users.forms.emailOptional")}
|
|
168
170
|
value={email}
|
|
169
171
|
type="email"
|
|
170
172
|
wrapperProps={{ style: { marginTop: 16 } }}
|
|
@@ -180,7 +182,7 @@ export const UserFormFields = ({
|
|
|
180
182
|
show={
|
|
181
183
|
isTouched && Boolean(trimmedEmail) && !isValidEmail(trimmedEmail)
|
|
182
184
|
}
|
|
183
|
-
message="
|
|
185
|
+
message={t("users.validation.emailInvalid")}
|
|
184
186
|
/>
|
|
185
187
|
)}
|
|
186
188
|
|
|
@@ -190,8 +192,7 @@ export const UserFormFields = ({
|
|
|
190
192
|
icon={<Icon name="WarningCircle" height={16} width={16} />}
|
|
191
193
|
style={{ marginTop: 16 }}
|
|
192
194
|
>
|
|
193
|
-
|
|
194
|
-
access (no SMS recovery available)
|
|
195
|
+
{t("users.validation.recoveryEmailRequired")}
|
|
195
196
|
</Alert>
|
|
196
197
|
)}
|
|
197
198
|
|
|
@@ -203,7 +204,7 @@ export const UserFormFields = ({
|
|
|
203
204
|
: "data-fs-bp-update-user-roles-label"]: true,
|
|
204
205
|
}}
|
|
205
206
|
>
|
|
206
|
-
|
|
207
|
+
{t("layouts.titles.roles")}
|
|
207
208
|
</span>
|
|
208
209
|
|
|
209
210
|
{rolesOptions &&
|
|
@@ -245,7 +246,7 @@ export const UserFormFields = ({
|
|
|
245
246
|
|
|
246
247
|
<ErrorMessage
|
|
247
248
|
show={isTouched && roles.length === 0}
|
|
248
|
-
message="
|
|
249
|
+
message={t("users.validation.atLeastOneRoleRequired")}
|
|
249
250
|
/>
|
|
250
251
|
</div>
|
|
251
252
|
</>
|
|
@@ -3,6 +3,7 @@ import { Dropdown, DropdownButton } from "@faststore/ui";
|
|
|
3
3
|
import { useGetRolesOptions } from "../../../roles/hooks";
|
|
4
4
|
import { BasicCard, Icon } from "../../../shared/components";
|
|
5
5
|
import { useDrawerProps } from "../../../shared/hooks";
|
|
6
|
+
import { useLocalization } from "../../../shared/localization/LocalizationContext";
|
|
6
7
|
import { CreateUserDrawerSelector } from "../CreateUserDrawerSelector/CreateUserDrawerSelector";
|
|
7
8
|
import { UserDropdownMenu } from "../UserDropdownMenu/UserDropdownMenu";
|
|
8
9
|
|
|
@@ -24,15 +25,16 @@ export default function UsersCard({ users = [], orgUnitData }: UsersCardProps) {
|
|
|
24
25
|
} = useDrawerProps();
|
|
25
26
|
|
|
26
27
|
const { rolesOptions } = useGetRolesOptions(orgUnitData?.id ?? "");
|
|
28
|
+
const { t } = useLocalization();
|
|
27
29
|
|
|
28
30
|
return (
|
|
29
31
|
<>
|
|
30
32
|
<BasicCard
|
|
31
33
|
footerLink={`/users${orgUnitData?.id ? `/${orgUnitData.id}` : ""}`}
|
|
32
|
-
footerMessage="
|
|
34
|
+
footerMessage={t("users.components.UsersCard.manageUsers")}
|
|
33
35
|
subTitle={users.length ?? 0}
|
|
34
36
|
onPlusIconClick={openCreateUserDrawer}
|
|
35
|
-
title="
|
|
37
|
+
title={t("users.titles.users")}
|
|
36
38
|
>
|
|
37
39
|
{users.length > 0 &&
|
|
38
40
|
users.slice(0, 3).map((user) => {
|