@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
package/src/features/accounting-fields/layouts/AccountingFieldLayout/AccountingFieldLayout.tsx
CHANGED
|
@@ -22,6 +22,7 @@ import {
|
|
|
22
22
|
useQueryParams,
|
|
23
23
|
} from "../../../shared/hooks";
|
|
24
24
|
import { ContractTabsLayout, GlobalLayout } from "../../../shared/layouts";
|
|
25
|
+
import { useLocalization } from "../../../shared/localization/LocalizationContext";
|
|
25
26
|
import { getValidPage } from "../../../shared/utils";
|
|
26
27
|
import { buyerPortalRoutes } from "../../../shared/utils/buyerPortalRoutes";
|
|
27
28
|
import {
|
|
@@ -48,6 +49,7 @@ const PAGE_SIZE = 25;
|
|
|
48
49
|
export const AccountingFieldLayout = ({
|
|
49
50
|
accountingField,
|
|
50
51
|
}: AccountingFieldLayoutProps) => {
|
|
52
|
+
const { t } = useLocalization();
|
|
51
53
|
const router = useRouter();
|
|
52
54
|
const { setQueryStrings } = useQueryParams();
|
|
53
55
|
const [page, setPage] = useState(getValidPage(router.query.page));
|
|
@@ -104,10 +106,11 @@ export const AccountingFieldLayout = ({
|
|
|
104
106
|
const columns = getTableColumns({
|
|
105
107
|
actionsLength: 2,
|
|
106
108
|
nameColumnSize: "14.5rem",
|
|
109
|
+
nameColumnLabel: t("accountingFields.table.columnName"),
|
|
107
110
|
extraColumns: [
|
|
108
111
|
{
|
|
109
112
|
key: "description",
|
|
110
|
-
label: "
|
|
113
|
+
label: t("accountingFields.table.columnDescription"),
|
|
111
114
|
align: "left",
|
|
112
115
|
size: "100%",
|
|
113
116
|
hideOnScreenSize: "tablet",
|
|
@@ -164,7 +167,7 @@ export const AccountingFieldLayout = ({
|
|
|
164
167
|
orgUnitId={orgUnit?.id ?? ""}
|
|
165
168
|
contractName={contract?.name ?? ""}
|
|
166
169
|
contractId={contract?.id ?? ""}
|
|
167
|
-
pageName="
|
|
170
|
+
pageName={t("shared.labels.contract")}
|
|
168
171
|
>
|
|
169
172
|
<div data-fs-bp-accounting-field-container>
|
|
170
173
|
<HeaderInside
|
|
@@ -198,14 +201,13 @@ export const AccountingFieldLayout = ({
|
|
|
198
201
|
{checkAccountingFieldIsEmpty(accountingField!) && (
|
|
199
202
|
<AccountingFieldEmptyAlert flexContent>
|
|
200
203
|
<span data-fs-bp-accounting-field-empty-alert-message>
|
|
201
|
-
|
|
202
|
-
buyers to complete checkout.
|
|
204
|
+
{t("accountingFields.messages.emptyValueRequired")}
|
|
203
205
|
</span>
|
|
204
206
|
<button
|
|
205
207
|
data-fs-bp-accounting-field-empty-alert-btn
|
|
206
208
|
onClick={openCreateAccountingValueDrawer}
|
|
207
209
|
>
|
|
208
|
-
|
|
210
|
+
{t("accountingFields.buttons.addValue")}
|
|
209
211
|
</button>
|
|
210
212
|
</AccountingFieldEmptyAlert>
|
|
211
213
|
)}
|
|
@@ -214,12 +216,12 @@ export const AccountingFieldLayout = ({
|
|
|
214
216
|
<Paginator.Interval {...intervalData} />
|
|
215
217
|
</div>
|
|
216
218
|
{!listAccountingValuesLoading && intervalData.total === 0 ? (
|
|
217
|
-
<EmptyState title="
|
|
219
|
+
<EmptyState title={t("accountingFields.empty.noValuesTitle")}>
|
|
218
220
|
<button
|
|
219
221
|
data-fs-bp-accounting-field-empty-state-btn
|
|
220
222
|
onClick={openCreateAccountingValueDrawer}
|
|
221
223
|
>
|
|
222
|
-
|
|
224
|
+
{t("shared.buttons.add")}
|
|
223
225
|
</button>
|
|
224
226
|
</EmptyState>
|
|
225
227
|
) : (
|
|
@@ -261,14 +263,14 @@ export const AccountingFieldLayout = ({
|
|
|
261
263
|
onClick={previousPage}
|
|
262
264
|
disabled={isLoading || page <= 1}
|
|
263
265
|
>
|
|
264
|
-
|
|
266
|
+
{t("shared.pagination.previousPage")}
|
|
265
267
|
</Paginator.NextPageButton>
|
|
266
268
|
<Paginator.NextPageButton
|
|
267
269
|
data-fs-bp-accounting-field-next-page
|
|
268
270
|
onClick={nextPage}
|
|
269
271
|
disabled={isLoading || page >= totalPages}
|
|
270
272
|
>
|
|
271
|
-
|
|
273
|
+
{t("shared.pagination.nextPage")}
|
|
272
274
|
</Paginator.NextPageButton>
|
|
273
275
|
<Paginator.Interval {...intervalData} />
|
|
274
276
|
</div>
|
|
@@ -7,9 +7,9 @@ import { useUI } from "@faststore/ui";
|
|
|
7
7
|
import { RecipientsForm } 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 { useAddRecipientsToAddress } from "../../hooks/useAddRecipientsToAddress";
|
|
14
14
|
|
|
15
15
|
import type { RecipientInput } from "../../types";
|
|
@@ -32,6 +32,7 @@ export const AddRecipientsDrawer = ({
|
|
|
32
32
|
const router = useRouter();
|
|
33
33
|
const { pushToast } = useUI();
|
|
34
34
|
const { currentOrgUnit } = useBuyerPortal();
|
|
35
|
+
const { t } = useLocalization();
|
|
35
36
|
const { trackEvent, trackEntityCreateError } = useAnalytics({
|
|
36
37
|
entityType: "recipient",
|
|
37
38
|
defaultTimerName: "recipient_creation",
|
|
@@ -51,7 +52,9 @@ export const AddRecipientsDrawer = ({
|
|
|
51
52
|
});
|
|
52
53
|
|
|
53
54
|
pushToast({
|
|
54
|
-
message:
|
|
55
|
+
message: `${t("addresses.toasts.recipientsAdded")}\n${t(
|
|
56
|
+
"shared.messages.changesTimeout"
|
|
57
|
+
)}`,
|
|
55
58
|
status: "INFO",
|
|
56
59
|
icon: (
|
|
57
60
|
<button
|
|
@@ -67,7 +70,7 @@ export const AddRecipientsDrawer = ({
|
|
|
67
70
|
router.push(`${url}?tab=recipient-tab`);
|
|
68
71
|
}}
|
|
69
72
|
>
|
|
70
|
-
|
|
73
|
+
{t("shared.buttons.view")}
|
|
71
74
|
</button>
|
|
72
75
|
),
|
|
73
76
|
});
|
|
@@ -84,7 +87,7 @@ export const AddRecipientsDrawer = ({
|
|
|
84
87
|
});
|
|
85
88
|
|
|
86
89
|
pushToast({
|
|
87
|
-
message: "
|
|
90
|
+
message: t("addresses.errors.recipientsAdd"),
|
|
88
91
|
status: "ERROR",
|
|
89
92
|
});
|
|
90
93
|
},
|
|
@@ -111,14 +114,17 @@ export const AddRecipientsDrawer = ({
|
|
|
111
114
|
|
|
112
115
|
return (
|
|
113
116
|
<BasicDrawer data-fs-bp-create-address-drawer close={close} {...props}>
|
|
114
|
-
<BasicDrawer.Heading
|
|
117
|
+
<BasicDrawer.Heading
|
|
118
|
+
title={t("addresses.drawers.addRecipients")}
|
|
119
|
+
onClose={close}
|
|
120
|
+
/>
|
|
115
121
|
<BasicDrawer.Body>
|
|
116
122
|
<RecipientsForm recipients={recipients} setRecipients={setRecipients} />
|
|
117
123
|
</BasicDrawer.Body>
|
|
118
124
|
|
|
119
125
|
<BasicDrawer.Footer>
|
|
120
126
|
<BasicDrawer.Button variant="ghost" onClick={close}>
|
|
121
|
-
|
|
127
|
+
{t("shared.buttons.cancel")}
|
|
122
128
|
</BasicDrawer.Button>
|
|
123
129
|
<BasicDrawer.Button
|
|
124
130
|
variant="confirm"
|
|
@@ -126,7 +132,7 @@ export const AddRecipientsDrawer = ({
|
|
|
126
132
|
onClick={handleConfirmClick}
|
|
127
133
|
disabled={!isConfirmButtonEnabled}
|
|
128
134
|
>
|
|
129
|
-
|
|
135
|
+
{t("shared.buttons.save")}
|
|
130
136
|
</BasicDrawer.Button>
|
|
131
137
|
</BasicDrawer.Footer>
|
|
132
138
|
</BasicDrawer>
|
|
@@ -11,8 +11,7 @@ import {
|
|
|
11
11
|
} from "..";
|
|
12
12
|
import { BasicDropdownMenu, Icon } from "../../../shared/components";
|
|
13
13
|
import { useDrawerProps } from "../../../shared/hooks";
|
|
14
|
-
import {
|
|
15
|
-
import { ADDRESS_MESSAGES } from "../../constants/messages";
|
|
14
|
+
import { useLocalization } from "../../../shared/localization/LocalizationContext";
|
|
16
15
|
import { useSetDefaultAddress } from "../../hooks/useSetDefaultAddress";
|
|
17
16
|
import { useUnsetDefaultAddress } from "../../hooks/useUnsetDefaultAddress";
|
|
18
17
|
|
|
@@ -29,7 +28,7 @@ export type AddressDropdownMenuProps = {
|
|
|
29
28
|
};
|
|
30
29
|
|
|
31
30
|
export const AddressDropdownMenu = ({
|
|
32
|
-
locationsLabel
|
|
31
|
+
locationsLabel,
|
|
33
32
|
currentAddress,
|
|
34
33
|
onUpdate,
|
|
35
34
|
onOpen,
|
|
@@ -37,13 +36,18 @@ export const AddressDropdownMenu = ({
|
|
|
37
36
|
}: AddressDropdownMenuProps) => {
|
|
38
37
|
const router = useRouter();
|
|
39
38
|
const { pushToast } = useUI();
|
|
39
|
+
const { t } = useLocalization();
|
|
40
|
+
|
|
41
|
+
const resolvedLocationsLabel =
|
|
42
|
+
locationsLabel ?? t("addresses.labels.locations");
|
|
40
43
|
|
|
41
44
|
const orgUnitId = router.query.orgUnitId as string;
|
|
42
45
|
const customerId = router.query.contractId as string;
|
|
43
46
|
|
|
44
47
|
const handleCreateNewAddressSuccess = () => {
|
|
45
48
|
pushToast({
|
|
46
|
-
message: `${
|
|
49
|
+
message: `${t("addresses.toasts.defaultSaved")}
|
|
50
|
+
${t("shared.messages.changesTimeout")}`,
|
|
47
51
|
status: "INFO",
|
|
48
52
|
});
|
|
49
53
|
onUpdate?.();
|
|
@@ -51,7 +55,8 @@ export const AddressDropdownMenu = ({
|
|
|
51
55
|
|
|
52
56
|
const handleRemoveDefaultAddressSuccess = () => {
|
|
53
57
|
pushToast({
|
|
54
|
-
message: `${
|
|
58
|
+
message: `${t("addresses.toasts.defaultUnset")}
|
|
59
|
+
${t("shared.messages.changesTimeout")}`,
|
|
55
60
|
status: "INFO",
|
|
56
61
|
});
|
|
57
62
|
onUpdate?.();
|
|
@@ -61,7 +66,7 @@ export const AddressDropdownMenu = ({
|
|
|
61
66
|
onSuccess: handleRemoveDefaultAddressSuccess,
|
|
62
67
|
onError: () => {
|
|
63
68
|
pushToast({
|
|
64
|
-
message:
|
|
69
|
+
message: t("addresses.errors.defaultUnsetError"),
|
|
65
70
|
status: "ERROR",
|
|
66
71
|
});
|
|
67
72
|
},
|
|
@@ -71,7 +76,7 @@ export const AddressDropdownMenu = ({
|
|
|
71
76
|
onSuccess: handleCreateNewAddressSuccess,
|
|
72
77
|
onError: () => {
|
|
73
78
|
pushToast({
|
|
74
|
-
message:
|
|
79
|
+
message: t("addresses.errors.defaultError"),
|
|
75
80
|
status: "ERROR",
|
|
76
81
|
});
|
|
77
82
|
},
|
|
@@ -79,7 +84,7 @@ export const AddressDropdownMenu = ({
|
|
|
79
84
|
|
|
80
85
|
const handleSetAsDefault = () => {
|
|
81
86
|
pushToast({
|
|
82
|
-
message: "
|
|
87
|
+
message: t("addresses.toasts.settingDefault"),
|
|
83
88
|
status: "INFO",
|
|
84
89
|
icon: <Icon name="LoadingIndicator" data-fs-icon-loading="true" />,
|
|
85
90
|
});
|
|
@@ -100,7 +105,7 @@ export const AddressDropdownMenu = ({
|
|
|
100
105
|
|
|
101
106
|
const handleUnsetAsDefault = () => {
|
|
102
107
|
pushToast({
|
|
103
|
-
message: "
|
|
108
|
+
message: t("addresses.toasts.unsettingDefault"),
|
|
104
109
|
status: "INFO",
|
|
105
110
|
icon: <Icon name="LoadingIndicator" data-fs-icon-loading="true" />,
|
|
106
111
|
});
|
|
@@ -117,9 +122,6 @@ export const AddressDropdownMenu = ({
|
|
|
117
122
|
onOpen?.();
|
|
118
123
|
};
|
|
119
124
|
|
|
120
|
-
// const idsPath = currentOrgUnit?.path?.ids?.split("/") ?? [];
|
|
121
|
-
// const isRootLevelOrgUnit = idsPath.length === 2;
|
|
122
|
-
|
|
123
125
|
const {
|
|
124
126
|
open: openEditDrawerProps,
|
|
125
127
|
isOpen: isEditDrawerOpen,
|
|
@@ -161,31 +163,31 @@ export const AddressDropdownMenu = ({
|
|
|
161
163
|
</DropdownItem>
|
|
162
164
|
<DropdownItem onClick={openEditDrawerProps}>
|
|
163
165
|
<Icon name="Edit" {...sizeProps} />
|
|
164
|
-
|
|
166
|
+
{t("addresses.dropdown.editDetails")}
|
|
165
167
|
</DropdownItem>
|
|
166
168
|
<DropdownItem
|
|
167
169
|
data-fs-bp-testid="dropdown-item-add-location"
|
|
168
170
|
onClick={openLocationDrawer}
|
|
169
171
|
>
|
|
170
172
|
<UIIcon name="PlusCircle" {...sizeProps} />
|
|
171
|
-
|
|
173
|
+
{t("addresses.actions.addLocations", [resolvedLocationsLabel])}
|
|
172
174
|
</DropdownItem>
|
|
173
175
|
<DropdownItem
|
|
174
176
|
data-fs-bp-testid="dropdown-item-add-recipient"
|
|
175
177
|
onClick={openRecipientsDrawer}
|
|
176
178
|
>
|
|
177
179
|
<UIIcon name="PlusCircle" {...sizeProps} />
|
|
178
|
-
|
|
180
|
+
{t("addresses.actions.addRecipients")}
|
|
179
181
|
</DropdownItem>
|
|
180
182
|
{currentAddress.isDefault ? (
|
|
181
183
|
<DropdownItem onClick={handleUnsetAsDefault}>
|
|
182
184
|
<Icon name="BookmarkRemove" {...sizeProps} />
|
|
183
|
-
|
|
185
|
+
{t("addresses.actions.unsetAsDefault")}
|
|
184
186
|
</DropdownItem>
|
|
185
187
|
) : (
|
|
186
188
|
<DropdownItem onClick={handleSetAsDefault}>
|
|
187
189
|
<Icon name="BookmarkAdd" {...sizeProps} />
|
|
188
|
-
|
|
190
|
+
{t("addresses.actions.setAsDefault")}
|
|
189
191
|
</DropdownItem>
|
|
190
192
|
)}
|
|
191
193
|
|
|
@@ -195,7 +197,7 @@ export const AddressDropdownMenu = ({
|
|
|
195
197
|
data-fs-bp-dropdown-menu-item-disabled={isSyncMode}
|
|
196
198
|
>
|
|
197
199
|
<UIIcon name="MinusCircle" {...sizeProps} />
|
|
198
|
-
|
|
200
|
+
{t("addresses.actions.removeFromUnit")}
|
|
199
201
|
</DropdownItem>
|
|
200
202
|
{/* Remove validation while we reevaluate the rule */}
|
|
201
203
|
{/* {isRootLevelOrgUnit && ( */}
|
|
@@ -204,7 +206,7 @@ export const AddressDropdownMenu = ({
|
|
|
204
206
|
data-fs-bp-dropdown-menu-item-mode="danger"
|
|
205
207
|
>
|
|
206
208
|
<Icon name="Delete" {...sizeProps} data-fs-bp-delete-address />
|
|
207
|
-
<span data-fs-bp-delete-address>
|
|
209
|
+
<span data-fs-bp-delete-address>{t("shared.buttons.delete")}</span>
|
|
208
210
|
</DropdownItem>
|
|
209
211
|
{/* )} */}
|
|
210
212
|
</BasicDropdownMenu>
|
|
@@ -222,7 +224,7 @@ export const AddressDropdownMenu = ({
|
|
|
222
224
|
{...locationDrawerProps}
|
|
223
225
|
isOpen={isOpenLocationDrawer}
|
|
224
226
|
addressId={currentAddress.id}
|
|
225
|
-
locationsLabel={
|
|
227
|
+
locationsLabel={resolvedLocationsLabel}
|
|
226
228
|
/>
|
|
227
229
|
)}
|
|
228
230
|
{isOpenRecipientsDrawer && (
|
|
@@ -8,6 +8,7 @@ import {
|
|
|
8
8
|
Icon,
|
|
9
9
|
} from "../../../shared/components";
|
|
10
10
|
import { useBuyerPortal } from "../../../shared/hooks";
|
|
11
|
+
import { useLocalization } from "../../../shared/localization/LocalizationContext";
|
|
11
12
|
import { maskPostalCode } from "../../../shared/utils/postalCode";
|
|
12
13
|
import { CountryOptions, type CountryOption } from "../../data/countries";
|
|
13
14
|
import { useDebouncedSearchAddress } from "../../hooks/useDebouncedSearchAddress";
|
|
@@ -47,7 +48,10 @@ export const AddressForm = ({
|
|
|
47
48
|
setCompletedAddress,
|
|
48
49
|
fixedType = false,
|
|
49
50
|
}: AddressFormProps) => {
|
|
51
|
+
const { t } = useLocalization();
|
|
52
|
+
|
|
50
53
|
const addressTypeOptions = ["Shipping", "Billing"];
|
|
54
|
+
|
|
51
55
|
const { currentOrgUnit } = useBuyerPortal();
|
|
52
56
|
const [selectedState, setSelectedState] = useState(
|
|
53
57
|
address.state
|
|
@@ -61,6 +65,13 @@ export const AddressForm = ({
|
|
|
61
65
|
currentOrgUnit?.id ?? ""
|
|
62
66
|
);
|
|
63
67
|
|
|
68
|
+
const countryTranslations: Record<string, string> = {
|
|
69
|
+
BRA: t("addresses.forms.country.brazil"),
|
|
70
|
+
USA: t("addresses.forms.country.usa"),
|
|
71
|
+
CAN: t("addresses.forms.country.canada"),
|
|
72
|
+
MEX: t("addresses.forms.country.mexico"),
|
|
73
|
+
};
|
|
74
|
+
|
|
64
75
|
const cleanCompletedAddress = () => {
|
|
65
76
|
if (setCompletedAddress && setUseExistingAddress) {
|
|
66
77
|
setCompletedAddress({} as AddressData);
|
|
@@ -91,12 +102,12 @@ export const AddressForm = ({
|
|
|
91
102
|
<>
|
|
92
103
|
{!useExistingAddress ? (
|
|
93
104
|
<div data-fs-create-address-form>
|
|
94
|
-
{!hideLabel && <span>
|
|
105
|
+
{!hideLabel && <span>{t("addresses.forms.fillInDetails")}</span>}
|
|
95
106
|
|
|
96
107
|
<div key="country">
|
|
97
108
|
<AutocompleteDropdown
|
|
98
109
|
data-fs-bp-create-address-country-selector
|
|
99
|
-
label="
|
|
110
|
+
label={t("addresses.forms.country")}
|
|
100
111
|
className="address-country"
|
|
101
112
|
value={address.country}
|
|
102
113
|
options={CountryOptions}
|
|
@@ -114,7 +125,7 @@ export const AddressForm = ({
|
|
|
114
125
|
handleCountrySelect(option);
|
|
115
126
|
}}
|
|
116
127
|
>
|
|
117
|
-
{option
|
|
128
|
+
{countryTranslations[option.id] ?? option.name}
|
|
118
129
|
{address.country === option?.name && (
|
|
119
130
|
<Icon name="Check" width={12} height={12} />
|
|
120
131
|
)}
|
|
@@ -126,7 +137,7 @@ export const AddressForm = ({
|
|
|
126
137
|
{address.countryCode === "BRA" && (
|
|
127
138
|
<div key="zipCode">
|
|
128
139
|
<InputText
|
|
129
|
-
label="
|
|
140
|
+
label={t("addresses.forms.postalCode")}
|
|
130
141
|
value={address.zip}
|
|
131
142
|
className="address-postal-code"
|
|
132
143
|
hasError={isTouched && !address.zip?.trim()}
|
|
@@ -135,7 +146,7 @@ export const AddressForm = ({
|
|
|
135
146
|
/>
|
|
136
147
|
<ErrorMessage
|
|
137
148
|
show={isTouched && !address.zip?.trim()}
|
|
138
|
-
message="
|
|
149
|
+
message={t("addresses.validation.postalCodeRequired")}
|
|
139
150
|
/>
|
|
140
151
|
</div>
|
|
141
152
|
)}
|
|
@@ -143,7 +154,7 @@ export const AddressForm = ({
|
|
|
143
154
|
<div key="addressName">
|
|
144
155
|
{isEdit ? (
|
|
145
156
|
<InputText
|
|
146
|
-
label="
|
|
157
|
+
label={t("addresses.forms.addressName")}
|
|
147
158
|
value={address.name}
|
|
148
159
|
className="address-name"
|
|
149
160
|
hasError={isTouched && !address.name?.trim()}
|
|
@@ -153,13 +164,13 @@ export const AddressForm = ({
|
|
|
153
164
|
/>
|
|
154
165
|
) : (
|
|
155
166
|
<AutocompleteDropdown
|
|
156
|
-
label="
|
|
167
|
+
label={t("addresses.forms.addressName")}
|
|
157
168
|
value={autoCompleteAddressName}
|
|
158
169
|
className="address-name"
|
|
159
170
|
options={searchedAddresses}
|
|
160
171
|
shouldCloseOnSelect
|
|
161
172
|
shouldShowArrowDown={false}
|
|
162
|
-
placeholder="
|
|
173
|
+
placeholder={t("addresses.placeholders.selectExistingAddress")}
|
|
163
174
|
onChange={(event) => {
|
|
164
175
|
setAutoCompleteAddressName(event.currentTarget.value);
|
|
165
176
|
setAddress({ ...address, name: event.target.value });
|
|
@@ -196,7 +207,7 @@ export const AddressForm = ({
|
|
|
196
207
|
|
|
197
208
|
<div key="streetAddress">
|
|
198
209
|
<InputText
|
|
199
|
-
label="
|
|
210
|
+
label={t("addresses.forms.streetAddress")}
|
|
200
211
|
value={address.streetAddress}
|
|
201
212
|
className="street-address"
|
|
202
213
|
hasError={isTouched && !address.streetAddress?.trim()}
|
|
@@ -206,7 +217,7 @@ export const AddressForm = ({
|
|
|
206
217
|
/>
|
|
207
218
|
<ErrorMessage
|
|
208
219
|
show={isTouched && !address.streetAddress?.trim()}
|
|
209
|
-
message="
|
|
220
|
+
message={t("addresses.validation.streetAddressRequired")}
|
|
210
221
|
/>
|
|
211
222
|
</div>
|
|
212
223
|
|
|
@@ -215,7 +226,7 @@ export const AddressForm = ({
|
|
|
215
226
|
<div key="streetNumber">
|
|
216
227
|
<InputText
|
|
217
228
|
type="number"
|
|
218
|
-
label="
|
|
229
|
+
label={t("addresses.forms.number")}
|
|
219
230
|
value={address.streetNumber || ""}
|
|
220
231
|
className="address-number"
|
|
221
232
|
hasError={isTouched && !address.streetNumber?.trim()}
|
|
@@ -225,13 +236,13 @@ export const AddressForm = ({
|
|
|
225
236
|
/>
|
|
226
237
|
<ErrorMessage
|
|
227
238
|
show={isTouched && !address.streetNumber?.trim()}
|
|
228
|
-
message="
|
|
239
|
+
message={t("addresses.validation.numberRequired")}
|
|
229
240
|
/>
|
|
230
241
|
</div>
|
|
231
242
|
|
|
232
243
|
<div key="neighborhood">
|
|
233
244
|
<InputText
|
|
234
|
-
label="
|
|
245
|
+
label={t("addresses.forms.neighborhood")}
|
|
235
246
|
value={address.neighborhood || ""}
|
|
236
247
|
className="address-neighborhood"
|
|
237
248
|
hasError={isTouched && !address.neighborhood?.trim()}
|
|
@@ -241,7 +252,7 @@ export const AddressForm = ({
|
|
|
241
252
|
/>
|
|
242
253
|
<ErrorMessage
|
|
243
254
|
show={isTouched && !address.neighborhood?.trim()}
|
|
244
|
-
message="
|
|
255
|
+
message={t("addresses.validation.neighborhoodRequired")}
|
|
245
256
|
/>
|
|
246
257
|
</div>
|
|
247
258
|
</>
|
|
@@ -249,7 +260,7 @@ export const AddressForm = ({
|
|
|
249
260
|
|
|
250
261
|
<div key="streetAddress2">
|
|
251
262
|
<InputText
|
|
252
|
-
label="
|
|
263
|
+
label={t("addresses.forms.aptSuiteBuilding")}
|
|
253
264
|
className="street-address2"
|
|
254
265
|
value={address.streetAddress2}
|
|
255
266
|
onChange={(event) =>
|
|
@@ -260,7 +271,7 @@ export const AddressForm = ({
|
|
|
260
271
|
|
|
261
272
|
<div key="city">
|
|
262
273
|
<InputText
|
|
263
|
-
label="
|
|
274
|
+
label={t("addresses.forms.city")}
|
|
264
275
|
className="address-city"
|
|
265
276
|
value={address.city}
|
|
266
277
|
hasError={isTouched && !address.city?.trim()}
|
|
@@ -270,14 +281,14 @@ export const AddressForm = ({
|
|
|
270
281
|
/>
|
|
271
282
|
<ErrorMessage
|
|
272
283
|
show={isTouched && !address.city?.trim()}
|
|
273
|
-
message="
|
|
284
|
+
message={t("addresses.validation.cityRequired")}
|
|
274
285
|
/>
|
|
275
286
|
</div>
|
|
276
287
|
|
|
277
288
|
<div key="state">
|
|
278
289
|
<AutocompleteDropdown
|
|
279
290
|
data-fs-bp-create-address-state-selector
|
|
280
|
-
label="
|
|
291
|
+
label={t("addresses.forms.state")}
|
|
281
292
|
className="address-state"
|
|
282
293
|
value={selectedState}
|
|
283
294
|
options={getStateDisplayOptions(address.countryCode || "")}
|
|
@@ -332,7 +343,7 @@ export const AddressForm = ({
|
|
|
332
343
|
{address.countryCode !== "BRA" && (
|
|
333
344
|
<div key="zipCode">
|
|
334
345
|
<InputText
|
|
335
|
-
label="
|
|
346
|
+
label={t("addresses.forms.postalCode")}
|
|
336
347
|
value={address.zip}
|
|
337
348
|
className="address-postal-code"
|
|
338
349
|
hasError={isTouched && !address.zip?.trim()}
|
|
@@ -341,7 +352,7 @@ export const AddressForm = ({
|
|
|
341
352
|
/>
|
|
342
353
|
<ErrorMessage
|
|
343
354
|
show={isTouched && !address.zip?.trim()}
|
|
344
|
-
message="
|
|
355
|
+
message={t("addresses.validation.postalCodeRequired")}
|
|
345
356
|
/>
|
|
346
357
|
</div>
|
|
347
358
|
)}
|
|
@@ -349,7 +360,7 @@ export const AddressForm = ({
|
|
|
349
360
|
{isEdit && (
|
|
350
361
|
<div key="geoCoordinates">
|
|
351
362
|
<InputText
|
|
352
|
-
label="
|
|
363
|
+
label={t("addresses.forms.geoCoordinates")}
|
|
353
364
|
value={address.geoCoordinates}
|
|
354
365
|
onChange={(event) =>
|
|
355
366
|
setAddress({ ...address, geoCoordinates: event.target.value })
|
|
@@ -361,7 +372,7 @@ export const AddressForm = ({
|
|
|
361
372
|
{!fixedType && (
|
|
362
373
|
<div key="addressType">
|
|
363
374
|
<AutocompleteDropdown
|
|
364
|
-
label="
|
|
375
|
+
label={t("addresses.forms.addressType")}
|
|
365
376
|
value={address?.types.length > 0 ? address.types : ""}
|
|
366
377
|
className="address-type"
|
|
367
378
|
options={addressTypeOptions}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
import { Dropdown } from "@faststore/ui";
|
|
1
|
+
import { useLink_unstable as useLink } from "@faststore/core/experimental";
|
|
2
|
+
import { Dropdown, Link } from "@faststore/ui";
|
|
4
3
|
|
|
5
4
|
import { AddressDropdownMenu } from "..";
|
|
6
5
|
import { BasicDropdownMenu, Icon, Tag } from "../../../shared/components";
|
|
@@ -21,27 +20,32 @@ export const AddressLine = ({
|
|
|
21
20
|
types,
|
|
22
21
|
href,
|
|
23
22
|
currentAddress,
|
|
24
|
-
}: AddressLineProps) =>
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
23
|
+
}: AddressLineProps) => {
|
|
24
|
+
const { resolveLink } = useLink();
|
|
25
|
+
const resolvedHref = resolveLink(href);
|
|
26
|
+
|
|
27
|
+
return (
|
|
28
|
+
<li data-fs-addresses-line>
|
|
29
|
+
<Link href={resolvedHref} data-fs-addresses-line-link>
|
|
30
|
+
<Icon
|
|
31
|
+
name="LocalPostOffice"
|
|
32
|
+
width={20}
|
|
33
|
+
height={20}
|
|
34
|
+
data-fs-addresses-line-icon
|
|
35
|
+
/>
|
|
36
|
+
<span title={name} data-fs-addresses-line-name>
|
|
37
|
+
{name}
|
|
38
|
+
</span>
|
|
36
39
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
40
|
+
{types.map((type) => (
|
|
41
|
+
<Tag key={type}>{type}</Tag>
|
|
42
|
+
))}
|
|
43
|
+
</Link>
|
|
41
44
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
);
|
|
45
|
+
<Dropdown>
|
|
46
|
+
<BasicDropdownMenu.Trigger />
|
|
47
|
+
<AddressDropdownMenu currentAddress={currentAddress} />
|
|
48
|
+
</Dropdown>
|
|
49
|
+
</li>
|
|
50
|
+
);
|
|
51
|
+
};
|
|
@@ -18,6 +18,7 @@ import {
|
|
|
18
18
|
usePageItems,
|
|
19
19
|
} from "../../../shared/hooks";
|
|
20
20
|
import { PAGE_PARAMS, SEARCH_PARAMS } from "../../../shared/hooks/usePageItems";
|
|
21
|
+
import { useLocalization } from "../../../shared/localization/LocalizationContext";
|
|
21
22
|
import { useAddressLocationList } from "../../hooks";
|
|
22
23
|
import { DeleteAddressLocationDrawer } from "../DeleteAddressLocationDrawer/DeleteAddressLocationDrawer";
|
|
23
24
|
import { EditAddressLocationDrawer } from "../EditAddressLocationDrawer/EditAddressLocationDrawer";
|
|
@@ -47,11 +48,16 @@ export const AddressLocationsList = forwardRef<
|
|
|
47
48
|
total = 0,
|
|
48
49
|
search = "",
|
|
49
50
|
page = 1,
|
|
50
|
-
locationsLabel
|
|
51
|
+
locationsLabel,
|
|
51
52
|
onOpenAddDrawer,
|
|
52
53
|
}: AddressLocationsListProps,
|
|
53
54
|
ref
|
|
54
55
|
) => {
|
|
56
|
+
const { t } = useLocalization();
|
|
57
|
+
|
|
58
|
+
const resolvedLocationsLabel =
|
|
59
|
+
locationsLabel ?? t("addresses.labels.locations");
|
|
60
|
+
|
|
55
61
|
const {
|
|
56
62
|
isLoading,
|
|
57
63
|
items: locations,
|
|
@@ -114,6 +120,7 @@ export const AddressLocationsList = forwardRef<
|
|
|
114
120
|
|
|
115
121
|
const columns = getTableColumns({
|
|
116
122
|
actionsLength: 2,
|
|
123
|
+
nameColumnLabel: t("shared.labels.name"),
|
|
117
124
|
});
|
|
118
125
|
|
|
119
126
|
return (
|
|
@@ -132,14 +139,14 @@ export const AddressLocationsList = forwardRef<
|
|
|
132
139
|
<EmptyState
|
|
133
140
|
iconName="EmptyState"
|
|
134
141
|
iconSize={56}
|
|
135
|
-
title="
|
|
142
|
+
title={t("addresses.empty.noResults")}
|
|
136
143
|
>
|
|
137
144
|
<Button
|
|
138
145
|
variant="primary"
|
|
139
146
|
onClick={() => onOpenAddDrawer?.()}
|
|
140
147
|
data-fs-bp-address-tabs-empty-state
|
|
141
148
|
>
|
|
142
|
-
|
|
149
|
+
{t("addresses.buttons.addLocations")}
|
|
143
150
|
</Button>
|
|
144
151
|
</EmptyState>
|
|
145
152
|
) : (
|
|
@@ -188,7 +195,7 @@ export const AddressLocationsList = forwardRef<
|
|
|
188
195
|
isOpen={isOpenEditLocation}
|
|
189
196
|
location={selectedLocation}
|
|
190
197
|
onEditSuccess={handleRefreshLocations}
|
|
191
|
-
locationsLabel={
|
|
198
|
+
locationsLabel={resolvedLocationsLabel}
|
|
192
199
|
{...editLocationProps}
|
|
193
200
|
/>
|
|
194
201
|
)}
|
|
@@ -198,7 +205,7 @@ export const AddressLocationsList = forwardRef<
|
|
|
198
205
|
isOpen={isOpenDeleteLocation}
|
|
199
206
|
location={selectedLocation}
|
|
200
207
|
onDeleteSuccess={handleRefreshLocations}
|
|
201
|
-
locationsLabel={
|
|
208
|
+
locationsLabel={resolvedLocationsLabel}
|
|
202
209
|
{...deleteLocationProps}
|
|
203
210
|
/>
|
|
204
211
|
)}
|
|
@@ -208,7 +215,9 @@ export const AddressLocationsList = forwardRef<
|
|
|
208
215
|
onClick={increasePage}
|
|
209
216
|
disabled={isLoading}
|
|
210
217
|
>
|
|
211
|
-
{isLoading
|
|
218
|
+
{isLoading
|
|
219
|
+
? t("shared.labels.loading")
|
|
220
|
+
: t("shared.buttons.loadMore")}
|
|
212
221
|
</Paginator.NextPageButton>
|
|
213
222
|
)}
|
|
214
223
|
|