@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
|
@@ -17,6 +17,7 @@ import {
|
|
|
17
17
|
} from "../../../shared/hooks";
|
|
18
18
|
import { FinanceTabsLayout, GlobalLayout } from "../../../shared/layouts";
|
|
19
19
|
import { SumaPageLayout } from "../../../shared/layouts/SumaPageLayout/SumaPageLayout";
|
|
20
|
+
import { useLocalization } from "../../../shared/localization/LocalizationContext";
|
|
20
21
|
import { buyerPortalRoutes } from "../../../shared/utils/buyerPortalRoutes";
|
|
21
22
|
import { BuyingPolicyDropdownMenu } from "../../components";
|
|
22
23
|
import { AddBuyingPolicyDrawer } from "../../components/AddBuyingPolicyDrawer/AddBuyingPolicyDrawer";
|
|
@@ -37,6 +38,7 @@ export const BuyingPoliciesLayout = ({
|
|
|
37
38
|
page,
|
|
38
39
|
}: BuyingPoliciesLayoutProps) => {
|
|
39
40
|
const { currentContract, currentOrgUnit, featureFlags } = useBuyerPortal();
|
|
41
|
+
const { t } = useLocalization();
|
|
40
42
|
|
|
41
43
|
const router = useRouter();
|
|
42
44
|
|
|
@@ -85,6 +87,7 @@ export const BuyingPoliciesLayout = ({
|
|
|
85
87
|
|
|
86
88
|
const columns = getTableColumns({
|
|
87
89
|
actionsLength: 1,
|
|
90
|
+
nameColumnLabel: t("shared.labels.name"),
|
|
88
91
|
});
|
|
89
92
|
|
|
90
93
|
const renderLoading = () => (
|
|
@@ -98,7 +101,7 @@ export const BuyingPoliciesLayout = ({
|
|
|
98
101
|
|
|
99
102
|
const renderEmptyState = () => (
|
|
100
103
|
<EmptyState
|
|
101
|
-
title="
|
|
104
|
+
title={t("buyingPolicies.empty.noBuyingPoliciesYet")}
|
|
102
105
|
iconName="Rebase"
|
|
103
106
|
iconSize={40}
|
|
104
107
|
/>
|
|
@@ -145,7 +148,7 @@ export const BuyingPoliciesLayout = ({
|
|
|
145
148
|
|
|
146
149
|
const buyingPoliciesSection = (
|
|
147
150
|
<section data-fs-buying-policies-section>
|
|
148
|
-
<HeaderInside title="
|
|
151
|
+
<HeaderInside title={t("buyingPolicies.titles.buyingPolicies")}>
|
|
149
152
|
<HeaderInside.Button onClick={openAddBuyingPolicyDrawer} />
|
|
150
153
|
</HeaderInside>
|
|
151
154
|
|
|
@@ -162,7 +165,9 @@ export const BuyingPoliciesLayout = ({
|
|
|
162
165
|
<div data-fs-bp-buying-policies-paginator>
|
|
163
166
|
{totalBuyingPolicies > buyingPolicies.length ? (
|
|
164
167
|
<Paginator.NextPageButton onClick={increasePage} disabled={isLoading}>
|
|
165
|
-
{isLoading
|
|
168
|
+
{isLoading
|
|
169
|
+
? t("shared.labels.loading")
|
|
170
|
+
: t("shared.buttons.loadMore")}
|
|
166
171
|
</Paginator.NextPageButton>
|
|
167
172
|
) : (
|
|
168
173
|
<span />
|
|
@@ -192,7 +197,9 @@ export const BuyingPoliciesLayout = ({
|
|
|
192
197
|
)}
|
|
193
198
|
</SumaPageLayout>
|
|
194
199
|
) : (
|
|
195
|
-
<FinanceTabsLayout
|
|
200
|
+
<FinanceTabsLayout
|
|
201
|
+
pageName={t("buyingPolicies.titles.financeAndCompliance")}
|
|
202
|
+
>
|
|
196
203
|
{buyingPoliciesSection}
|
|
197
204
|
{isAddBuyingPolicyDrawerOpen && (
|
|
198
205
|
<AddBuyingPolicyDrawer
|
package/src/features/buying-policies/layouts/BuyingPolicyDetailsLayout/BuyingPolicyDetailsLayout.tsx
CHANGED
|
@@ -9,6 +9,7 @@ import {
|
|
|
9
9
|
import { BasicDropdownMenu, HeaderInside } from "../../../shared/components";
|
|
10
10
|
import { useBuyerPortal, useDrawerProps } from "../../../shared/hooks";
|
|
11
11
|
import { FinanceTabsLayout, GlobalLayout } from "../../../shared/layouts";
|
|
12
|
+
import { useLocalization } from "../../../shared/localization/LocalizationContext";
|
|
12
13
|
import { buyerPortalRoutes } from "../../../shared/utils/buyerPortalRoutes";
|
|
13
14
|
import {
|
|
14
15
|
BuyingPolicyDropdownMenu,
|
|
@@ -18,6 +19,7 @@ import {
|
|
|
18
19
|
extractFieldValueFromCriteria,
|
|
19
20
|
mountFieldValueCriteriaString,
|
|
20
21
|
} from "../../utils";
|
|
22
|
+
import { BUYING_POLICIES_WORKFLOW_LABELS } from "../../utils/buyingPoliciesWorkflowTypes";
|
|
21
23
|
import { getHighlightedText } from "../../utils/criteriaHighlightSyntax";
|
|
22
24
|
|
|
23
25
|
import type { BuyingPolicy } from "../../types";
|
|
@@ -29,6 +31,7 @@ export type BuyingPolicyDetailsLayoutProps = {
|
|
|
29
31
|
export const BuyingPolicyDetailsLayout = ({
|
|
30
32
|
data: { buyingPolicy },
|
|
31
33
|
}: BuyingPolicyDetailsLayoutProps) => {
|
|
34
|
+
const { t } = useLocalization();
|
|
32
35
|
const { currentContract, currentOrgUnit } = useBuyerPortal();
|
|
33
36
|
|
|
34
37
|
const accountFieldCriteria = extractFieldValueFromCriteria(
|
|
@@ -90,7 +93,9 @@ export const BuyingPolicyDetailsLayout = ({
|
|
|
90
93
|
|
|
91
94
|
return (
|
|
92
95
|
<GlobalLayout>
|
|
93
|
-
<FinanceTabsLayout
|
|
96
|
+
<FinanceTabsLayout
|
|
97
|
+
pageName={t("buyingPolicies.titles.financeAndCompliance")}
|
|
98
|
+
>
|
|
94
99
|
<section data-fs-buying-policy-details-section>
|
|
95
100
|
<HeaderInside
|
|
96
101
|
title={buyingPolicy?.name ?? ""}
|
|
@@ -109,44 +114,56 @@ export const BuyingPolicyDetailsLayout = ({
|
|
|
109
114
|
</HeaderInside>
|
|
110
115
|
|
|
111
116
|
<div data-fs-buying-policy-details-line-initial>
|
|
112
|
-
<span data-fs-buying-policy-details-title>
|
|
117
|
+
<span data-fs-buying-policy-details-title>
|
|
118
|
+
{t("buyingPolicies.details.settings")}
|
|
119
|
+
</span>
|
|
113
120
|
<button
|
|
114
121
|
type="button"
|
|
115
122
|
data-fs-buying-policy-details-edit-button
|
|
116
123
|
onClick={openUpdateBuyingPolicyDrawerProps}
|
|
117
124
|
>
|
|
118
|
-
|
|
125
|
+
{t("shared.buttons.edit")}
|
|
119
126
|
</button>
|
|
120
127
|
</div>
|
|
121
128
|
<div data-fs-buying-policy-details-line>
|
|
122
|
-
<span data-fs-buying-policy-details-field-label>
|
|
129
|
+
<span data-fs-buying-policy-details-field-label>
|
|
130
|
+
{t("buyingPolicies.labels.name")}
|
|
131
|
+
</span>
|
|
123
132
|
<span data-fs-buying-policy-details-field-content>
|
|
124
133
|
{buyingPolicy?.name}
|
|
125
134
|
</span>
|
|
126
135
|
</div>
|
|
127
136
|
<div data-fs-buying-policy-details-line>
|
|
128
|
-
<span data-fs-buying-policy-details-field-label>
|
|
137
|
+
<span data-fs-buying-policy-details-field-label>
|
|
138
|
+
{t("buyingPolicies.labels.description")}
|
|
139
|
+
</span>
|
|
129
140
|
<span data-fs-buying-policy-details-field-content>
|
|
130
141
|
{buyingPolicy?.description}
|
|
131
142
|
</span>
|
|
132
143
|
</div>
|
|
133
144
|
<div data-fs-buying-policy-details-line>
|
|
134
|
-
<span data-fs-buying-policy-details-field-label>
|
|
145
|
+
<span data-fs-buying-policy-details-field-label>
|
|
146
|
+
{t("buyingPolicies.labels.criteria")}
|
|
147
|
+
</span>
|
|
135
148
|
<span data-fs-buying-policy-details-field-content>
|
|
136
149
|
{renderCriteria()}
|
|
137
150
|
</span>
|
|
138
151
|
</div>
|
|
139
152
|
<div data-fs-buying-policy-details-line>
|
|
140
|
-
<span data-fs-buying-policy-details-field-label>
|
|
153
|
+
<span data-fs-buying-policy-details-field-label>
|
|
154
|
+
{t("buyingPolicies.labels.action")}
|
|
155
|
+
</span>
|
|
141
156
|
<span data-fs-buying-policy-details-field-content>
|
|
142
|
-
{buyingPolicy?.action.
|
|
157
|
+
{buyingPolicy?.action.type
|
|
158
|
+
? t(BUYING_POLICIES_WORKFLOW_LABELS[buyingPolicy.action.type])
|
|
159
|
+
: buyingPolicy?.action.label}
|
|
143
160
|
{buyingPolicy?.action.levels?.map((level, index) => (
|
|
144
161
|
<>
|
|
145
162
|
<span
|
|
146
163
|
key={level.id}
|
|
147
164
|
data-fs-buying-policy-details-level-title
|
|
148
165
|
>
|
|
149
|
-
|
|
166
|
+
{t("buyingPolicies.details.level", [index + 1])}
|
|
150
167
|
</span>
|
|
151
168
|
<span
|
|
152
169
|
key={level.id}
|
|
@@ -61,14 +61,14 @@ export const mountFieldValueCriteriaString = ({
|
|
|
61
61
|
|
|
62
62
|
export const loadingOption = [
|
|
63
63
|
{
|
|
64
|
-
label: "
|
|
64
|
+
label: "shared.labels.loading",
|
|
65
65
|
value: "",
|
|
66
66
|
},
|
|
67
67
|
];
|
|
68
68
|
|
|
69
69
|
export const emptyOption = [
|
|
70
70
|
{
|
|
71
|
-
label: "
|
|
71
|
+
label: "buyingPolicies.messages.noOptionFound",
|
|
72
72
|
value: "",
|
|
73
73
|
},
|
|
74
74
|
];
|
|
@@ -8,9 +8,9 @@ export const BUYING_POLICIES_WORKFLOW_LABELS: Record<
|
|
|
8
8
|
BuyingPoliciesWorkflowType,
|
|
9
9
|
string
|
|
10
10
|
> = {
|
|
11
|
-
SEQUENTIAL_WORKFLOW: "
|
|
12
|
-
DENY_ORDER: "
|
|
13
|
-
BYPASS_ALL: "
|
|
11
|
+
SEQUENTIAL_WORKFLOW: "buyingPolicies.workflow.sequentialWorkflow",
|
|
12
|
+
DENY_ORDER: "buyingPolicies.workflow.denyOrder",
|
|
13
|
+
BYPASS_ALL: "buyingPolicies.workflow.bypassAllBuyingPolicies",
|
|
14
14
|
};
|
|
15
15
|
|
|
16
16
|
export type BuyingPoliciesWorkflowType =
|
|
@@ -6,38 +6,38 @@ export const ACCOUNTING_VALUE_CRITERIA =
|
|
|
6
6
|
|
|
7
7
|
export const orderFieldsCriteriaOptions = [
|
|
8
8
|
{
|
|
9
|
-
label: "
|
|
9
|
+
label: "buyingPolicies.criteria.orderContainsBudget",
|
|
10
10
|
criteria: "$exists(budgetData.budgets.*[])",
|
|
11
11
|
},
|
|
12
12
|
{
|
|
13
|
-
label: "
|
|
13
|
+
label: "buyingPolicies.criteria.orderContainsBudgetsXyz",
|
|
14
14
|
criteria: BUDGET_CRITERIA,
|
|
15
15
|
},
|
|
16
16
|
{
|
|
17
|
-
label: "
|
|
17
|
+
label: "buyingPolicies.criteria.orderContainsExceededBudget",
|
|
18
18
|
criteria:
|
|
19
19
|
"$exists(budgetData.budgets.**.allocations[balance.remaining < 0])",
|
|
20
20
|
},
|
|
21
21
|
{
|
|
22
|
-
label: "
|
|
22
|
+
label: "buyingPolicies.criteria.orderContainsExpiredBudget",
|
|
23
23
|
criteria:
|
|
24
24
|
"$exists(budgetData.budgets.**.cycleConfiguration[$toMillis(endDate) < $millis()])",
|
|
25
25
|
},
|
|
26
26
|
{
|
|
27
|
-
label: "
|
|
27
|
+
label: "buyingPolicies.criteria.orderContainsAccountingField",
|
|
28
28
|
criteria: ACCOUNTING_FIELD_CRITERIA,
|
|
29
29
|
},
|
|
30
30
|
{
|
|
31
|
-
label: "
|
|
31
|
+
label: "buyingPolicies.criteria.orderContainsAccountingFieldsXyz",
|
|
32
32
|
criteria: ACCOUNTING_VALUE_CRITERIA,
|
|
33
33
|
},
|
|
34
34
|
{
|
|
35
|
-
label: "
|
|
35
|
+
label: "buyingPolicies.criteria.allOrderItemsNegotiated",
|
|
36
36
|
criteria:
|
|
37
37
|
'customData.customApps[id.$contains("vtex.customorderfields")].fields[name="allContractItems"].value = "1"',
|
|
38
38
|
},
|
|
39
39
|
{
|
|
40
|
-
label: "
|
|
40
|
+
label: "buyingPolicies.criteria.restrictedItemsInOrder",
|
|
41
41
|
criteria:
|
|
42
42
|
'customData.customApps[id.$contains("vtex.customorderfields")].fields[name="hasRestrictItems"].value = "1"',
|
|
43
43
|
},
|
|
@@ -1,26 +1,26 @@
|
|
|
1
1
|
export const spendingLimitsCriteriaOptions = [
|
|
2
2
|
{
|
|
3
|
-
label: "
|
|
3
|
+
label: "buyingPolicies.criteria.orderValueGreaterThanX",
|
|
4
4
|
criteria: "value > 10000",
|
|
5
5
|
},
|
|
6
6
|
{
|
|
7
|
-
label: "
|
|
7
|
+
label: "buyingPolicies.criteria.orderValueGreaterThanXAndLessThanY",
|
|
8
8
|
criteria: "value > 500 and value < 2000",
|
|
9
9
|
},
|
|
10
10
|
{
|
|
11
|
-
label: "
|
|
11
|
+
label: "buyingPolicies.criteria.unitPriceGreaterThanX",
|
|
12
12
|
criteria: "items.price > 200",
|
|
13
13
|
},
|
|
14
14
|
{
|
|
15
|
-
label: "
|
|
15
|
+
label: "buyingPolicies.criteria.unitPriceGreaterThanXAndLessThanY",
|
|
16
16
|
criteria: "items.price > 200 and items.price < 350",
|
|
17
17
|
},
|
|
18
18
|
{
|
|
19
|
-
label: "
|
|
19
|
+
label: "buyingPolicies.criteria.extendedLineItemGreaterThanX",
|
|
20
20
|
criteria: "items.priceDefinition.total > 300",
|
|
21
21
|
},
|
|
22
22
|
{
|
|
23
|
-
label: "
|
|
23
|
+
label: "buyingPolicies.criteria.extendedLineItemGreaterThanXAndLessThanY",
|
|
24
24
|
criteria:
|
|
25
25
|
"items.priceDefinition.total > 300 and items.priceDefinition.total < 600",
|
|
26
26
|
},
|
|
@@ -10,6 +10,7 @@ import {
|
|
|
10
10
|
} from "@faststore/ui";
|
|
11
11
|
|
|
12
12
|
import { BasicCard, Icon } from "../../../shared/components";
|
|
13
|
+
import { useLocalization } from "../../../shared/localization/LocalizationContext";
|
|
13
14
|
import { useUpdateContractStatus } from "../../hooks";
|
|
14
15
|
|
|
15
16
|
import type { ContractData } from "../../types";
|
|
@@ -26,6 +27,7 @@ export default function ContractsCard({
|
|
|
26
27
|
contracts,
|
|
27
28
|
orgUnitData,
|
|
28
29
|
}: ContractsCardProps) {
|
|
30
|
+
const { t } = useLocalization();
|
|
29
31
|
const route = useRouter();
|
|
30
32
|
|
|
31
33
|
const { updateContractStatus } = useUpdateContractStatus();
|
|
@@ -33,8 +35,8 @@ export default function ContractsCard({
|
|
|
33
35
|
return (
|
|
34
36
|
<BasicCard
|
|
35
37
|
footerLink={`/contracts${orgUnitData?.id ? `/${orgUnitData.id}` : ""}`}
|
|
36
|
-
footerMessage="
|
|
37
|
-
title="
|
|
38
|
+
footerMessage={t("contracts.actions.viewContracts")}
|
|
39
|
+
title={t("contracts.titles.contracts")}
|
|
38
40
|
subTitle={contracts.length ?? 0}
|
|
39
41
|
icon={<Icon name="Info" width={20} height={20} />}
|
|
40
42
|
onPlusIconClick={() => {}}
|
|
@@ -78,7 +80,7 @@ export default function ContractsCard({
|
|
|
78
80
|
}}
|
|
79
81
|
>
|
|
80
82
|
<UIIcon name="ArrowSquareOut" data-fs-dropdown-icon />
|
|
81
|
-
|
|
83
|
+
{t("contracts.dropdown.open")}
|
|
82
84
|
</DropdownItem>
|
|
83
85
|
<DropdownItem>
|
|
84
86
|
<Icon
|
|
@@ -87,7 +89,7 @@ export default function ContractsCard({
|
|
|
87
89
|
height={24}
|
|
88
90
|
data-fs-dropdown-icon
|
|
89
91
|
/>
|
|
90
|
-
|
|
92
|
+
{t("contracts.dropdown.edit")}
|
|
91
93
|
</DropdownItem>
|
|
92
94
|
<DropdownItem data-fs-bp-dropdown-menu-item-mode="danger">
|
|
93
95
|
<Icon
|
|
@@ -96,7 +98,7 @@ export default function ContractsCard({
|
|
|
96
98
|
height={24}
|
|
97
99
|
data-fs-dropdown-icon
|
|
98
100
|
/>{" "}
|
|
99
|
-
|
|
101
|
+
{t("shared.buttons.delete")}
|
|
100
102
|
</DropdownItem>
|
|
101
103
|
</DropdownMenu>
|
|
102
104
|
</Dropdown>
|
|
@@ -13,7 +13,8 @@ import {
|
|
|
13
13
|
import { useQueryParams } from "../../../shared/hooks";
|
|
14
14
|
import { useBuyerPortal } from "../../../shared/hooks";
|
|
15
15
|
import { GlobalLayout } from "../../../shared/layouts";
|
|
16
|
-
import {
|
|
16
|
+
import { useLocalization } from "../../../shared/localization/LocalizationContext";
|
|
17
|
+
import { statusFilters, statusFilterI18nKeys } from "../../../shared/utils";
|
|
17
18
|
import { useUpdateContractStatus } from "../../hooks";
|
|
18
19
|
|
|
19
20
|
import type { ContractData } from "../../types/ContractData";
|
|
@@ -23,6 +24,7 @@ export type ContractsLayoutProps = {
|
|
|
23
24
|
};
|
|
24
25
|
|
|
25
26
|
export const ContractsLayout = ({ data }: ContractsLayoutProps) => {
|
|
27
|
+
const { t } = useLocalization();
|
|
26
28
|
const route = useRouter();
|
|
27
29
|
const { currentOrgUnit } = useBuyerPortal();
|
|
28
30
|
|
|
@@ -34,7 +36,7 @@ export const ContractsLayout = ({ data }: ContractsLayoutProps) => {
|
|
|
34
36
|
<GlobalLayout>
|
|
35
37
|
<section data-fs-contracts-section>
|
|
36
38
|
<InternalTopBar
|
|
37
|
-
title="
|
|
39
|
+
title={t("contracts.titles.contracts")}
|
|
38
40
|
titleDropDownItems={<MainLinksDropdownMenu />}
|
|
39
41
|
/>
|
|
40
42
|
|
|
@@ -52,8 +54,11 @@ export const ContractsLayout = ({ data }: ContractsLayoutProps) => {
|
|
|
52
54
|
/>
|
|
53
55
|
|
|
54
56
|
<DropdownFilter
|
|
55
|
-
label="
|
|
56
|
-
filterOptions={Object.keys(statusFilters)
|
|
57
|
+
label={t("contracts.labels.status")}
|
|
58
|
+
filterOptions={Object.keys(statusFilters).map((value) => ({
|
|
59
|
+
value,
|
|
60
|
+
label: t(statusFilterI18nKeys[value]),
|
|
61
|
+
}))}
|
|
57
62
|
updateFilter={(inputFilter) => {
|
|
58
63
|
setQueryString("status", inputFilter);
|
|
59
64
|
}}
|
package/src/features/credit-cards/components/CreateCreditCardDrawer/CreateCreditCardDrawer.tsx
CHANGED
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
InputText,
|
|
13
13
|
} from "../../../shared/components";
|
|
14
14
|
import { useBuyerPortal, useDebounce } from "../../../shared/hooks";
|
|
15
|
-
import {
|
|
15
|
+
import { useLocalization } from "../../../shared/localization/LocalizationContext";
|
|
16
16
|
import { findCardNetwork } from "../../../shared/utils/creditCard";
|
|
17
17
|
import {
|
|
18
18
|
useTokenizeCreditCard,
|
|
@@ -48,6 +48,7 @@ export const CreateCreditCardDrawer = ({
|
|
|
48
48
|
}: CreateCreditCardDrawerProps) => {
|
|
49
49
|
const { pushToast } = useUI();
|
|
50
50
|
const { clientContext, currentOrgUnit } = useBuyerPortal();
|
|
51
|
+
const { t } = useLocalization();
|
|
51
52
|
const [isTouched, setIsTouched] = useState(false);
|
|
52
53
|
const [useExistingAddress, setUseExistingAddress] = useState(false);
|
|
53
54
|
const [completedAddress, setCompletedAddress] = useState<AddressData>(
|
|
@@ -104,7 +105,9 @@ export const CreateCreditCardDrawer = ({
|
|
|
104
105
|
const handleSaveCrediCardSuccess = () => {
|
|
105
106
|
setIsLoading(false);
|
|
106
107
|
pushToast({
|
|
107
|
-
message:
|
|
108
|
+
message: `${t("creditCards.toasts.creditCardAdded")}\n${t(
|
|
109
|
+
"shared.messages.changesTimeout"
|
|
110
|
+
)}`,
|
|
108
111
|
status: "INFO",
|
|
109
112
|
});
|
|
110
113
|
router.reload();
|
|
@@ -116,7 +119,7 @@ export const CreateCreditCardDrawer = ({
|
|
|
116
119
|
onError: () => {
|
|
117
120
|
setIsLoading(false);
|
|
118
121
|
pushToast({
|
|
119
|
-
message: "
|
|
122
|
+
message: t("creditCards.errors.createCreditCard"),
|
|
120
123
|
status: "ERROR",
|
|
121
124
|
});
|
|
122
125
|
},
|
|
@@ -127,7 +130,7 @@ export const CreateCreditCardDrawer = ({
|
|
|
127
130
|
onError: () => {
|
|
128
131
|
setIsLoading(false);
|
|
129
132
|
pushToast({
|
|
130
|
-
message: "
|
|
133
|
+
message: t("creditCards.errors.createCreditCard"),
|
|
131
134
|
status: "ERROR",
|
|
132
135
|
});
|
|
133
136
|
},
|
|
@@ -144,7 +147,7 @@ export const CreateCreditCardDrawer = ({
|
|
|
144
147
|
|
|
145
148
|
if (!paymentSession?.id || !creditCardValidators) {
|
|
146
149
|
pushToast({
|
|
147
|
-
message: "
|
|
150
|
+
message: t("creditCards.errors.saveCreditCardFailed"),
|
|
148
151
|
status: "ERROR",
|
|
149
152
|
});
|
|
150
153
|
|
|
@@ -232,13 +235,16 @@ export const CreateCreditCardDrawer = ({
|
|
|
232
235
|
|
|
233
236
|
return (
|
|
234
237
|
<BasicDrawer data-fs-bp-create-credit-card-drawer close={close} {...props}>
|
|
235
|
-
<BasicDrawer.Heading
|
|
238
|
+
<BasicDrawer.Heading
|
|
239
|
+
title={t("creditCards.create.title")}
|
|
240
|
+
onClose={close}
|
|
241
|
+
/>
|
|
236
242
|
<BasicDrawer.Body>
|
|
237
243
|
<div data-fs-bp-create-credit-card-drawer-section-label>
|
|
238
|
-
<span>
|
|
244
|
+
<span>{t("creditCards.forms.cardNickname")}</span>
|
|
239
245
|
</div>
|
|
240
246
|
<InputText
|
|
241
|
-
label="
|
|
247
|
+
label={t("creditCards.forms.cardNickname")}
|
|
242
248
|
value={newCard.cardLabel}
|
|
243
249
|
wrapperProps={{ style: { marginTop: 16 } }}
|
|
244
250
|
onChange={(event) =>
|
|
@@ -249,7 +255,7 @@ export const CreateCreditCardDrawer = ({
|
|
|
249
255
|
<CreditCardForm creditCard={newCard} setNewCard={setNewCard} />
|
|
250
256
|
|
|
251
257
|
<div data-fs-bp-create-credit-card-drawer-section-label>
|
|
252
|
-
<span>
|
|
258
|
+
<span>{t("creditCards.forms.billingAddress")}</span>
|
|
253
259
|
</div>
|
|
254
260
|
<AddressForm
|
|
255
261
|
address={address}
|
|
@@ -266,7 +272,7 @@ export const CreateCreditCardDrawer = ({
|
|
|
266
272
|
|
|
267
273
|
<BasicDrawer.Footer>
|
|
268
274
|
<BasicDrawer.Button variant="ghost" onClick={close}>
|
|
269
|
-
|
|
275
|
+
{t("shared.buttons.cancel")}
|
|
270
276
|
</BasicDrawer.Button>
|
|
271
277
|
<BasicDrawer.Button
|
|
272
278
|
variant="confirm"
|
|
@@ -274,7 +280,7 @@ export const CreateCreditCardDrawer = ({
|
|
|
274
280
|
onClick={handleConfirmClick}
|
|
275
281
|
isLoading={isLoading}
|
|
276
282
|
>
|
|
277
|
-
|
|
283
|
+
{t("shared.buttons.save")}
|
|
278
284
|
</BasicDrawer.Button>
|
|
279
285
|
</BasicDrawer.Footer>
|
|
280
286
|
</BasicDrawer>
|
package/src/features/credit-cards/components/CreditCardDropdownMenu/CreditCardDropdownMenu.tsx
CHANGED
|
@@ -5,8 +5,7 @@ import { DropdownItem, useUI } from "@faststore/ui";
|
|
|
5
5
|
import { DeleteCreditCardDrawer } from "..";
|
|
6
6
|
import { BasicDropdownMenu, Icon } from "../../../shared/components";
|
|
7
7
|
import { useDrawerProps } from "../../../shared/hooks";
|
|
8
|
-
import {
|
|
9
|
-
import { CREDIT_CARD_MESSAGES } from "../../constants/messages";
|
|
8
|
+
import { useLocalization } from "../../../shared/localization/LocalizationContext";
|
|
10
9
|
import { useSetDefaultCreditCard } from "../../hooks/useSetDefaultsCreditCard";
|
|
11
10
|
import { useUnsetDefaultCreditCard } from "../../hooks/useUnsetDefaultsCreditCard";
|
|
12
11
|
|
|
@@ -31,6 +30,7 @@ export const CreditCardDropdownMenu = ({
|
|
|
31
30
|
|
|
32
31
|
const router = useRouter();
|
|
33
32
|
const { pushToast } = useUI();
|
|
33
|
+
const { t } = useLocalization();
|
|
34
34
|
|
|
35
35
|
const orgUnitId = router.query.orgUnitId as string;
|
|
36
36
|
const customerId = router.query.contractId as string;
|
|
@@ -43,7 +43,9 @@ export const CreditCardDropdownMenu = ({
|
|
|
43
43
|
|
|
44
44
|
const handleCreateNewCreditCardSuccess = () => {
|
|
45
45
|
pushToast({
|
|
46
|
-
message: `${
|
|
46
|
+
message: `${t("creditCards.toasts.defaultSaved")}\n${t(
|
|
47
|
+
"shared.messages.changesTimeout"
|
|
48
|
+
)}`,
|
|
47
49
|
status: "INFO",
|
|
48
50
|
});
|
|
49
51
|
onUpdate?.();
|
|
@@ -51,7 +53,9 @@ export const CreditCardDropdownMenu = ({
|
|
|
51
53
|
|
|
52
54
|
const handleRemoveDefaultCreditCardSuccess = () => {
|
|
53
55
|
pushToast({
|
|
54
|
-
message: `${
|
|
56
|
+
message: `${t("creditCards.toasts.defaultUnset")}\n${t(
|
|
57
|
+
"shared.messages.changesTimeout"
|
|
58
|
+
)}`,
|
|
55
59
|
status: "INFO",
|
|
56
60
|
});
|
|
57
61
|
onUpdate?.();
|
|
@@ -61,7 +65,7 @@ export const CreditCardDropdownMenu = ({
|
|
|
61
65
|
onSuccess: handleRemoveDefaultCreditCardSuccess,
|
|
62
66
|
onError: () => {
|
|
63
67
|
pushToast({
|
|
64
|
-
message:
|
|
68
|
+
message: t("creditCards.toasts.defaultUnsetError"),
|
|
65
69
|
status: "ERROR",
|
|
66
70
|
});
|
|
67
71
|
},
|
|
@@ -71,7 +75,7 @@ export const CreditCardDropdownMenu = ({
|
|
|
71
75
|
onSuccess: handleCreateNewCreditCardSuccess,
|
|
72
76
|
onError: () => {
|
|
73
77
|
pushToast({
|
|
74
|
-
message:
|
|
78
|
+
message: t("creditCards.toasts.defaultError"),
|
|
75
79
|
status: "ERROR",
|
|
76
80
|
});
|
|
77
81
|
},
|
|
@@ -79,7 +83,7 @@ export const CreditCardDropdownMenu = ({
|
|
|
79
83
|
|
|
80
84
|
const handleSetAsDefault = () => {
|
|
81
85
|
pushToast({
|
|
82
|
-
message: "
|
|
86
|
+
message: t("creditCards.toasts.settingDefault"),
|
|
83
87
|
status: "INFO",
|
|
84
88
|
icon: <Icon name="LoadingIndicator" data-fs-icon-loading="true" />,
|
|
85
89
|
});
|
|
@@ -94,7 +98,7 @@ export const CreditCardDropdownMenu = ({
|
|
|
94
98
|
|
|
95
99
|
const handleUnsetAsDefault = () => {
|
|
96
100
|
pushToast({
|
|
97
|
-
message: "
|
|
101
|
+
message: t("creditCards.toasts.unsettingDefault"),
|
|
98
102
|
status: "INFO",
|
|
99
103
|
icon: <Icon name="LoadingIndicator" data-fs-icon-loading="true" />,
|
|
100
104
|
});
|
|
@@ -119,12 +123,12 @@ export const CreditCardDropdownMenu = ({
|
|
|
119
123
|
(currentCreditCard.isDefault ? (
|
|
120
124
|
<DropdownItem onClick={handleUnsetAsDefault}>
|
|
121
125
|
<Icon name="BookmarkRemove" {...sizeProps} />
|
|
122
|
-
|
|
126
|
+
{t("creditCards.actions.unsetAsDefault")}
|
|
123
127
|
</DropdownItem>
|
|
124
128
|
) : (
|
|
125
129
|
<DropdownItem onClick={handleSetAsDefault}>
|
|
126
130
|
<Icon name="BookmarkAdd" {...sizeProps} />
|
|
127
|
-
|
|
131
|
+
{t("creditCards.actions.setAsDefault")}
|
|
128
132
|
</DropdownItem>
|
|
129
133
|
))}
|
|
130
134
|
|
|
@@ -143,7 +147,9 @@ export const CreditCardDropdownMenu = ({
|
|
|
143
147
|
data-fs-bp-dropdown-menu-item-mode="danger"
|
|
144
148
|
>
|
|
145
149
|
<Icon name="Delete" {...sizeProps} data-fs-bp-delete-dropdown />
|
|
146
|
-
<span data-fs-bp-delete-dropdown>
|
|
150
|
+
<span data-fs-bp-delete-dropdown>
|
|
151
|
+
{t("shared.buttons.delete")}
|
|
152
|
+
</span>
|
|
147
153
|
</DropdownItem>
|
|
148
154
|
</>
|
|
149
155
|
//)
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { InputText } from "../../../shared/components";
|
|
2
|
+
import { useLocalization } from "../../../shared/localization/LocalizationContext";
|
|
2
3
|
import {
|
|
3
4
|
maskCardNumber,
|
|
4
5
|
maskExpirationDate,
|
|
@@ -16,6 +17,8 @@ export const CreditCardForm = ({
|
|
|
16
17
|
creditCard,
|
|
17
18
|
setNewCard,
|
|
18
19
|
}: CreditCardFormProps) => {
|
|
20
|
+
const { t } = useLocalization();
|
|
21
|
+
|
|
19
22
|
const handleChangeNumber = (cardNumber: string) => {
|
|
20
23
|
setNewCard({
|
|
21
24
|
...creditCard,
|
|
@@ -40,11 +43,11 @@ export const CreditCardForm = ({
|
|
|
40
43
|
return (
|
|
41
44
|
<>
|
|
42
45
|
<div data-fs-bp-create-credit-card-drawer-section-label>
|
|
43
|
-
<span>
|
|
46
|
+
<span>{t("creditCards.forms.cardDetails")}</span>
|
|
44
47
|
</div>
|
|
45
48
|
|
|
46
49
|
<InputText
|
|
47
|
-
label="
|
|
50
|
+
label={t("creditCards.labels.cardNumber")}
|
|
48
51
|
value={creditCard.number}
|
|
49
52
|
wrapperProps={{ style: { marginTop: 16 } }}
|
|
50
53
|
onChange={(event) => handleChangeNumber(event.target.value)}
|
|
@@ -52,14 +55,14 @@ export const CreditCardForm = ({
|
|
|
52
55
|
|
|
53
56
|
<div data-fs-bp-create-credit-card-security-line>
|
|
54
57
|
<InputText
|
|
55
|
-
label="
|
|
58
|
+
label={t("creditCards.labels.expirationDate")}
|
|
56
59
|
value={creditCard.expirationDate}
|
|
57
60
|
wrapperProps={{ style: { marginTop: 16 } }}
|
|
58
61
|
onChange={(event) => handleChangeExpirationDate(event.target.value)}
|
|
59
62
|
/>
|
|
60
63
|
|
|
61
64
|
<InputText
|
|
62
|
-
label="
|
|
65
|
+
label={t("creditCards.labels.cvv")}
|
|
63
66
|
value={creditCard.cvv}
|
|
64
67
|
wrapperProps={{ style: { marginTop: 16 } }}
|
|
65
68
|
onChange={(event) => handleChangeVerificationCode(event.target.value)}
|
|
@@ -68,7 +71,7 @@ export const CreditCardForm = ({
|
|
|
68
71
|
</div>
|
|
69
72
|
|
|
70
73
|
<InputText
|
|
71
|
-
label="
|
|
74
|
+
label={t("creditCards.labels.cardholderName")}
|
|
72
75
|
value={creditCard.cardholder}
|
|
73
76
|
wrapperProps={{ style: { marginTop: 16 } }}
|
|
74
77
|
onChange={(event) =>
|