@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/product-assortment/layouts/ProductAssortmentLayout/ProductAssortmentLayout.tsx
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { EmptyState, HeaderInside } from "../../../shared/components";
|
|
2
2
|
import { useBuyerPortal } from "../../../shared/hooks";
|
|
3
3
|
import { ContractTabsLayout, GlobalLayout } from "../../../shared/layouts";
|
|
4
|
+
import { useLocalization } from "../../../shared/localization/LocalizationContext";
|
|
4
5
|
import { ProductAssortmentTable } from "../../components/ProductAssortmentTable/ProductAssortmentTable";
|
|
5
6
|
import { useGetProductAssortment } from "../../hooks/useGetProductAssortment";
|
|
6
7
|
|
|
@@ -10,6 +11,7 @@ export const ProductAssortmentLayout = ({
|
|
|
10
11
|
orgUnitId,
|
|
11
12
|
contractId,
|
|
12
13
|
}: ProductAssortmentLayoutProps) => {
|
|
14
|
+
const { t } = useLocalization();
|
|
13
15
|
const { currentOrgUnit: orgUnit, currentContract: contract } =
|
|
14
16
|
useBuyerPortal();
|
|
15
17
|
|
|
@@ -29,21 +31,22 @@ export const ProductAssortmentLayout = ({
|
|
|
29
31
|
orgUnitId={orgUnitId ?? orgUnit?.id ?? ""}
|
|
30
32
|
contractName={contract?.name ?? ""}
|
|
31
33
|
contractId={contract?.id ?? ""}
|
|
32
|
-
pageName="
|
|
34
|
+
pageName={t("shared.labels.contract")}
|
|
33
35
|
>
|
|
34
36
|
<section data-fs-bp-product-assortment-container>
|
|
35
|
-
<HeaderInside title="
|
|
37
|
+
<HeaderInside title={t("productAssortment.titles.assortments")} />
|
|
36
38
|
|
|
37
39
|
<p data-fs-bp-assortments-subtitle>
|
|
38
|
-
|
|
39
|
-
should access
|
|
40
|
+
{t("productAssortment.messages.subtitle")}
|
|
40
41
|
</p>
|
|
41
42
|
|
|
42
43
|
{isEmpty ? (
|
|
43
44
|
<EmptyState
|
|
44
45
|
iconName="Shapes"
|
|
45
|
-
title="
|
|
46
|
-
description=
|
|
46
|
+
title={t("productAssortment.empty.noAssortmentsTitle")}
|
|
47
|
+
description={t(
|
|
48
|
+
"productAssortment.empty.noAssortmentsDescription"
|
|
49
|
+
)}
|
|
47
50
|
/>
|
|
48
51
|
) : (
|
|
49
52
|
<ProductAssortmentTable
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { BasicCard } from "../../../shared/components";
|
|
2
|
+
import { useLocalization } from "../../../shared/localization/LocalizationContext";
|
|
2
3
|
|
|
3
4
|
type ProfileCardProps = {
|
|
4
5
|
name: string | null;
|
|
@@ -9,25 +10,27 @@ type ProfileCardProps = {
|
|
|
9
10
|
};
|
|
10
11
|
|
|
11
12
|
export default function ProfileCard({ name, email, id }: ProfileCardProps) {
|
|
13
|
+
const { t } = useLocalization();
|
|
14
|
+
|
|
12
15
|
return (
|
|
13
16
|
<BasicCard
|
|
14
17
|
footerLink={`/profile/${id}`}
|
|
15
|
-
footerMessage="
|
|
16
|
-
title="
|
|
18
|
+
footerMessage={t("profile.actions.viewProfile")}
|
|
19
|
+
title={t("profile.titles.profile")}
|
|
17
20
|
>
|
|
18
21
|
<hr data-fs-divider />
|
|
19
22
|
<div data-fs-profile-card-row>
|
|
20
|
-
<h1 data-fs-card-row-label>
|
|
23
|
+
<h1 data-fs-card-row-label>{t("shared.labels.name")}</h1>
|
|
21
24
|
<h1 data-fs-profile-name>{name}</h1>
|
|
22
25
|
</div>
|
|
23
26
|
<hr data-fs-divider />
|
|
24
27
|
<div data-fs-profile-card-row>
|
|
25
|
-
<h1 data-fs-card-row-label>
|
|
28
|
+
<h1 data-fs-card-row-label>{t("shared.labels.email")}</h1>
|
|
26
29
|
<h1 data-fs-email-text>{email}</h1>
|
|
27
30
|
</div>
|
|
28
31
|
<hr data-fs-divider />
|
|
29
32
|
<div data-fs-profile-card-row>
|
|
30
|
-
<h1 data-fs-card-row-label>
|
|
33
|
+
<h1 data-fs-card-row-label>{t("shared.labels.id")}</h1>
|
|
31
34
|
<h1>{id}</h1>
|
|
32
35
|
</div>
|
|
33
36
|
</BasicCard>
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import type { ReactNode } from "react";
|
|
2
2
|
|
|
3
|
-
import
|
|
4
|
-
|
|
5
|
-
import { Button } from "@faststore/ui";
|
|
3
|
+
import { useLink_unstable as useLink } from "@faststore/core/experimental";
|
|
4
|
+
import { Button, Link } from "@faststore/ui";
|
|
6
5
|
|
|
7
6
|
import { Icon } from "../../../shared/components";
|
|
7
|
+
import { useLocalization } from "../../../shared/localization/LocalizationContext";
|
|
8
8
|
|
|
9
9
|
export type ProfileSummaryProps = {
|
|
10
10
|
onLogoutClick?: (storeConfig: unknown) => void;
|
|
@@ -27,6 +27,9 @@ export const ProfileSummary = ({
|
|
|
27
27
|
showManageLink = false,
|
|
28
28
|
...otherProps
|
|
29
29
|
}: ProfileSummaryProps) => {
|
|
30
|
+
const { t } = useLocalization();
|
|
31
|
+
const { resolveLink } = useLink();
|
|
32
|
+
|
|
30
33
|
return (
|
|
31
34
|
<section
|
|
32
35
|
data-fs-self-profile-summary
|
|
@@ -36,8 +39,12 @@ export const ProfileSummary = ({
|
|
|
36
39
|
<div data-fs-self-profile-summary-header>
|
|
37
40
|
<h2 data-fs-self-profile-summary-org-name>{orgName}</h2>
|
|
38
41
|
{showManageLink && (
|
|
39
|
-
<Link
|
|
40
|
-
|
|
42
|
+
<Link
|
|
43
|
+
data-fs-self-profile-summary-org-link
|
|
44
|
+
href={resolveLink("/buyer-portal")}
|
|
45
|
+
>
|
|
46
|
+
{t("shared.actions.manageOrganization")}{" "}
|
|
47
|
+
<Icon name="OpenInNew" width={23} height={23} />
|
|
41
48
|
</Link>
|
|
42
49
|
)}
|
|
43
50
|
</div>
|
|
@@ -51,7 +58,7 @@ export const ProfileSummary = ({
|
|
|
51
58
|
onClick={onLogoutClick}
|
|
52
59
|
variant="tertiary"
|
|
53
60
|
>
|
|
54
|
-
|
|
61
|
+
{t("shared.buttons.logout")}
|
|
55
62
|
</Button>
|
|
56
63
|
</div>
|
|
57
64
|
</section>
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { HeaderInside } from "../../../shared/components";
|
|
2
2
|
import { useBuyerPortal } from "../../../shared/hooks";
|
|
3
3
|
import { GlobalLayout, ContractTabsLayout } from "../../../shared/layouts";
|
|
4
|
+
import { useLocalization } from "../../../shared/localization/LocalizationContext";
|
|
4
5
|
|
|
5
6
|
import type { ContractData } from "../../../contracts/types";
|
|
6
7
|
|
|
@@ -9,6 +10,7 @@ export type ProfileLayoutProps = {
|
|
|
9
10
|
};
|
|
10
11
|
|
|
11
12
|
export const ProfileLayout = ({ data }: ProfileLayoutProps) => {
|
|
13
|
+
const { t } = useLocalization();
|
|
12
14
|
const { currentOrgUnit: orgUnit } = useBuyerPortal();
|
|
13
15
|
|
|
14
16
|
const creationDate = data
|
|
@@ -26,20 +28,24 @@ export const ProfileLayout = ({ data }: ProfileLayoutProps) => {
|
|
|
26
28
|
orgUnitId={orgUnit?.id ?? ""}
|
|
27
29
|
contractName={data?.name ?? ""}
|
|
28
30
|
contractId={data?.id ?? ""}
|
|
29
|
-
pageName="
|
|
31
|
+
pageName={t("shared.labels.contract")}
|
|
30
32
|
>
|
|
31
33
|
<section data-fs-bp-profile>
|
|
32
|
-
<HeaderInside title="
|
|
34
|
+
<HeaderInside title={t("profile.titles.profile")} />
|
|
33
35
|
|
|
34
36
|
{data && (
|
|
35
37
|
<div data-fs-bp-profile-details>
|
|
36
|
-
<span data-fs-bp-profile-details-title>
|
|
38
|
+
<span data-fs-bp-profile-details-title>
|
|
39
|
+
{t("profile.titles.details")}
|
|
40
|
+
</span>
|
|
37
41
|
|
|
38
42
|
{!!data.name && (
|
|
39
43
|
<>
|
|
40
44
|
<hr data-fs-bp-profile-divider />
|
|
41
45
|
<div data-fs-bp-profile-details-row>
|
|
42
|
-
<span data-fs-bp-profile-details-row-label>
|
|
46
|
+
<span data-fs-bp-profile-details-row-label>
|
|
47
|
+
{t("shared.labels.name")}
|
|
48
|
+
</span>
|
|
43
49
|
<span data-fs-bp-profile-details-row-value>
|
|
44
50
|
{data.name}
|
|
45
51
|
</span>
|
|
@@ -50,7 +56,9 @@ export const ProfileLayout = ({ data }: ProfileLayoutProps) => {
|
|
|
50
56
|
<hr data-fs-bp-profile-divider />
|
|
51
57
|
|
|
52
58
|
<div data-fs-bp-profile-details-row>
|
|
53
|
-
<span data-fs-bp-profile-details-row-label>
|
|
59
|
+
<span data-fs-bp-profile-details-row-label>
|
|
60
|
+
{t("shared.labels.email")}
|
|
61
|
+
</span>
|
|
54
62
|
<span data-fs-bp-profile-details-row-value>
|
|
55
63
|
<a href={`mailto:${data.email}`}>{data.email}</a>
|
|
56
64
|
</span>
|
|
@@ -59,7 +67,9 @@ export const ProfileLayout = ({ data }: ProfileLayoutProps) => {
|
|
|
59
67
|
<hr data-fs-bp-profile-divider />
|
|
60
68
|
|
|
61
69
|
<div data-fs-bp-profile-details-row>
|
|
62
|
-
<span data-fs-bp-profile-details-row-label>
|
|
70
|
+
<span data-fs-bp-profile-details-row-label>
|
|
71
|
+
{t("profile.labels.creationDate")}
|
|
72
|
+
</span>
|
|
63
73
|
<span data-fs-bp-profile-details-row-value>{creationDate}</span>
|
|
64
74
|
</div>
|
|
65
75
|
|
|
@@ -4,6 +4,7 @@ import { getTableColumns } from "../../../shared/components/Table/utils/tableCol
|
|
|
4
4
|
import { useBuyerPortal } from "../../../shared/hooks";
|
|
5
5
|
import { GlobalLayout } from "../../../shared/layouts";
|
|
6
6
|
import { OrgUnitTabsLayout } from "../../../shared/layouts/OrgUnitTabsLayout/OrgUnitTabLayout";
|
|
7
|
+
import { useLocalization } from "../../../shared/localization/LocalizationContext";
|
|
7
8
|
import { buyerPortalRoutes } from "../../../shared/utils/buyerPortalRoutes";
|
|
8
9
|
|
|
9
10
|
import type { RolePermission } from "../../types";
|
|
@@ -18,6 +19,7 @@ export type RoleDetailsLayoutProps = {
|
|
|
18
19
|
export const RoleDetailsLayout = ({
|
|
19
20
|
data: { roleName, roles },
|
|
20
21
|
}: RoleDetailsLayoutProps) => {
|
|
22
|
+
const { t } = useLocalization();
|
|
21
23
|
const { currentOrgUnit } = useBuyerPortal();
|
|
22
24
|
|
|
23
25
|
const columns = getTableColumns({
|
|
@@ -38,7 +40,7 @@ export const RoleDetailsLayout = ({
|
|
|
38
40
|
|
|
39
41
|
return (
|
|
40
42
|
<GlobalLayout>
|
|
41
|
-
<OrgUnitTabsLayout pageName="
|
|
43
|
+
<OrgUnitTabsLayout pageName={t("shared.labels.organization")}>
|
|
42
44
|
<section data-fs-bp-roles-details-section>
|
|
43
45
|
<HeaderInside
|
|
44
46
|
title={roleName}
|
|
@@ -49,7 +51,7 @@ export const RoleDetailsLayout = ({
|
|
|
49
51
|
|
|
50
52
|
<div data-fs-role-details-page>
|
|
51
53
|
<div data-fs-role-header>
|
|
52
|
-
<span>
|
|
54
|
+
<span>{t("roles.titles.permissions")}</span>
|
|
53
55
|
<div data-fs-role-status>
|
|
54
56
|
<span data-fs-role-active>{count}</span>/
|
|
55
57
|
<span data-fs-role-not-active>{roles.length}</span>
|
|
@@ -5,6 +5,7 @@ import { useBuyerPortal } from "../../../shared/hooks";
|
|
|
5
5
|
import { GlobalLayout } from "../../../shared/layouts";
|
|
6
6
|
import { OrgUnitTabsLayout } from "../../../shared/layouts/OrgUnitTabsLayout/OrgUnitTabLayout";
|
|
7
7
|
import { SumaPageLayout } from "../../../shared/layouts/SumaPageLayout/SumaPageLayout";
|
|
8
|
+
import { useLocalization } from "../../../shared/localization/LocalizationContext";
|
|
8
9
|
import { buyerPortalRoutes } from "../../../shared/utils/buyerPortalRoutes";
|
|
9
10
|
|
|
10
11
|
import type { RolePermission } from "../../types";
|
|
@@ -19,12 +20,13 @@ export const RolesLayout = ({
|
|
|
19
20
|
data: { rolesAndPermissions },
|
|
20
21
|
}: RolesLayoutProps) => {
|
|
21
22
|
const { currentOrgUnit, featureFlags } = useBuyerPortal();
|
|
23
|
+
const { t } = useLocalization();
|
|
22
24
|
|
|
23
|
-
const columns = getTableColumns({});
|
|
25
|
+
const columns = getTableColumns({ nameColumnLabel: t("shared.labels.name") });
|
|
24
26
|
|
|
25
27
|
const rolesSection = (
|
|
26
28
|
<section data-fs-bp-roles-section>
|
|
27
|
-
<HeaderInside title="
|
|
29
|
+
<HeaderInside title={t("roles.titles.roles")} />
|
|
28
30
|
<Table layoutFixed>
|
|
29
31
|
<Table.Head columns={columns} />
|
|
30
32
|
<Table.Body>
|
|
@@ -50,7 +52,7 @@ export const RolesLayout = ({
|
|
|
50
52
|
{featureFlags?.suma ? (
|
|
51
53
|
<SumaPageLayout>{rolesSection}</SumaPageLayout>
|
|
52
54
|
) : (
|
|
53
|
-
<OrgUnitTabsLayout pageName="
|
|
55
|
+
<OrgUnitTabsLayout pageName={t("shared.labels.organization")}>
|
|
54
56
|
{rolesSection}
|
|
55
57
|
</OrgUnitTabsLayout>
|
|
56
58
|
)}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import type { ReactNode } from "react";
|
|
2
2
|
|
|
3
|
-
import Link from "next/link";
|
|
4
3
|
import { useRouter } from "next/router";
|
|
5
4
|
|
|
6
|
-
import {
|
|
5
|
+
import { useLink_unstable as useLink } from "@faststore/core/experimental";
|
|
6
|
+
import { Icon as UIIcon, IconButton, Link } from "@faststore/ui";
|
|
7
7
|
|
|
8
8
|
import { Card, CardBody, CardFooter, CardHeader } from "../Card";
|
|
9
9
|
import { Icon } from "../Icon";
|
|
@@ -35,6 +35,8 @@ export const BasicCard = ({
|
|
|
35
35
|
...otherProps
|
|
36
36
|
}: BasicCardProps) => {
|
|
37
37
|
const { push } = useRouter();
|
|
38
|
+
const { resolveLink } = useLink();
|
|
39
|
+
const resolvedFooterLink = resolveLink(footerLink);
|
|
38
40
|
|
|
39
41
|
return (
|
|
40
42
|
<Card data-fs-bp-basic-card {...otherProps}>
|
|
@@ -58,12 +60,12 @@ export const BasicCard = ({
|
|
|
58
60
|
<CardBody>{children}</CardBody>
|
|
59
61
|
{enableFooter && (
|
|
60
62
|
<CardFooter>
|
|
61
|
-
<Link href={
|
|
63
|
+
<Link href={resolvedFooterLink} data-fs-card-footer-link>
|
|
62
64
|
<span>{footerMessage}</span>
|
|
63
65
|
</Link>
|
|
64
66
|
<IconButton
|
|
65
67
|
onClick={() => {
|
|
66
|
-
push(
|
|
68
|
+
push(resolvedFooterLink ?? "");
|
|
67
69
|
}}
|
|
68
70
|
icon={
|
|
69
71
|
<Icon
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import type { ReactNode } from "react";
|
|
2
2
|
|
|
3
|
-
import
|
|
4
|
-
|
|
5
|
-
import { Dropdown } from "@faststore/ui";
|
|
3
|
+
import { useLink_unstable as useLink } from "@faststore/core/experimental";
|
|
4
|
+
import { Dropdown, Link } from "@faststore/ui";
|
|
6
5
|
|
|
7
6
|
import { BasicDropdownMenu } from "../BasicDropdownMenu/BasicDropdownMenu";
|
|
8
7
|
|
|
@@ -19,9 +18,11 @@ export const BasicCardLine = ({
|
|
|
19
18
|
menu,
|
|
20
19
|
href,
|
|
21
20
|
}: BasicCardLineProps) => {
|
|
21
|
+
const { resolveLink } = useLink();
|
|
22
|
+
|
|
22
23
|
return (
|
|
23
24
|
<span data-fs-basic-card-line title={title}>
|
|
24
|
-
{href && <Link data-fs-basic-card-line-link href={href} />}
|
|
25
|
+
{href && <Link data-fs-basic-card-line-link href={resolveLink(href)} />}
|
|
25
26
|
{!!icon && <span data-fs-basic-card-line-icon>{icon}</span>}
|
|
26
27
|
<span data-fs-basic-card-line-title>{title}</span>
|
|
27
28
|
{!!menu && (
|
|
@@ -3,6 +3,7 @@ import { useMemo, useState } from "react";
|
|
|
3
3
|
import { SlideOver, useFadeEffect } from "@faststore/ui";
|
|
4
4
|
import { Button, SlideOverHeader } from "@faststore/ui";
|
|
5
5
|
|
|
6
|
+
import { useLocalization } from "../../localization/LocalizationContext";
|
|
6
7
|
import { Icon } from "../Icon";
|
|
7
8
|
|
|
8
9
|
import { CustomerSwitchOptionsList } from "./CustomerSwitchOptionsList";
|
|
@@ -53,6 +54,7 @@ export const CustomerSwitchDrawer = ({
|
|
|
53
54
|
isOpen,
|
|
54
55
|
onCloseDrawer,
|
|
55
56
|
}: CustomerSwitchDrawerProps) => {
|
|
57
|
+
const { t } = useLocalization();
|
|
56
58
|
const { fade, fadeOut } = useFadeEffect();
|
|
57
59
|
|
|
58
60
|
const [option, setOption] = useState<CustomerSwitchOptionData>(options[0]);
|
|
@@ -90,7 +92,9 @@ export const CustomerSwitchDrawer = ({
|
|
|
90
92
|
data-fs-customer-switch-drawer-header
|
|
91
93
|
onClose={() => onCloseDrawer?.()}
|
|
92
94
|
>
|
|
93
|
-
<h1 data-fs-customer-switch-drawer-title>
|
|
95
|
+
<h1 data-fs-customer-switch-drawer-title>
|
|
96
|
+
{t("layouts.drawers.switchCustomerId")}
|
|
97
|
+
</h1>
|
|
94
98
|
</SlideOverHeader>
|
|
95
99
|
|
|
96
100
|
<section data-fs-customer-switch-drawer-body>
|
|
@@ -108,7 +112,11 @@ export const CustomerSwitchDrawer = ({
|
|
|
108
112
|
onClick={handleSubmitCustomer}
|
|
109
113
|
disabled={option.id === options[0].id || loading}
|
|
110
114
|
>
|
|
111
|
-
{loading ?
|
|
115
|
+
{loading ? (
|
|
116
|
+
<Icon name="Load" width={16} height={16} />
|
|
117
|
+
) : (
|
|
118
|
+
t("shared.buttons.confirm")
|
|
119
|
+
)}
|
|
112
120
|
</Button>
|
|
113
121
|
</footer>
|
|
114
122
|
</SlideOver>
|
|
@@ -2,6 +2,8 @@ import { useRef, type FormEvent } from "react";
|
|
|
2
2
|
|
|
3
3
|
import { Input, IconButton, Icon as UIIcon } from "@faststore/ui";
|
|
4
4
|
|
|
5
|
+
import { useLocalization } from "../../localization/LocalizationContext";
|
|
6
|
+
|
|
5
7
|
export type CustomerSwitchSearchProps = {
|
|
6
8
|
onSearch?: (term: string) => void;
|
|
7
9
|
};
|
|
@@ -9,6 +11,7 @@ export type CustomerSwitchSearchProps = {
|
|
|
9
11
|
export const CustomerSwitchSearch = ({
|
|
10
12
|
onSearch,
|
|
11
13
|
}: CustomerSwitchSearchProps) => {
|
|
14
|
+
const { t } = useLocalization();
|
|
12
15
|
const inputRef = useRef<HTMLInputElement>(null);
|
|
13
16
|
|
|
14
17
|
const handleSubmit = (event: FormEvent<HTMLFormElement>) => {
|
|
@@ -28,7 +31,7 @@ export const CustomerSwitchSearch = ({
|
|
|
28
31
|
/>
|
|
29
32
|
<Input
|
|
30
33
|
data-fs-customer-switch-search-input
|
|
31
|
-
placeholder="
|
|
34
|
+
placeholder={t("shared.placeholders.search")}
|
|
32
35
|
ref={inputRef}
|
|
33
36
|
/>
|
|
34
37
|
</form>
|
|
@@ -7,11 +7,14 @@ import {
|
|
|
7
7
|
DropdownMenu,
|
|
8
8
|
} from "@faststore/ui";
|
|
9
9
|
|
|
10
|
+
import { useLocalization } from "../../localization/LocalizationContext";
|
|
10
11
|
import { Icon } from "../Icon";
|
|
11
12
|
|
|
13
|
+
type DropdownFilterOption = { value: string; label: string };
|
|
14
|
+
|
|
12
15
|
type DropdownFilterProps = {
|
|
13
16
|
label: string;
|
|
14
|
-
filterOptions:
|
|
17
|
+
filterOptions: DropdownFilterOption[];
|
|
15
18
|
showClear?: boolean;
|
|
16
19
|
updateFilter: (inputFilter: string) => void;
|
|
17
20
|
clearFilter?: () => void;
|
|
@@ -23,12 +26,13 @@ const DropdownFilter = ({
|
|
|
23
26
|
updateFilter,
|
|
24
27
|
clearFilter,
|
|
25
28
|
}: DropdownFilterProps) => {
|
|
29
|
+
const { t } = useLocalization();
|
|
26
30
|
const [currentLabel, setCurrentLabel] = useState(label);
|
|
27
31
|
|
|
28
|
-
const updateLabel = (option:
|
|
29
|
-
setCurrentLabel(
|
|
32
|
+
const updateLabel = (option: DropdownFilterOption) => {
|
|
33
|
+
setCurrentLabel(t("shared.dropdown.filterLabel", [label, option.label]));
|
|
30
34
|
|
|
31
|
-
updateFilter(option);
|
|
35
|
+
updateFilter(option.value);
|
|
32
36
|
};
|
|
33
37
|
|
|
34
38
|
const clearLabel = () => {
|
|
@@ -47,15 +51,15 @@ const DropdownFilter = ({
|
|
|
47
51
|
</DropdownButton>
|
|
48
52
|
<DropdownMenu data-fs-buyer-portal-filter-menu>
|
|
49
53
|
<DropdownItem data-fs-buyer-portal-filter-item onClick={clearLabel}>
|
|
50
|
-
|
|
54
|
+
{t("shared.dropdown.noFilter")}
|
|
51
55
|
</DropdownItem>
|
|
52
56
|
{filterOptions.map((option) => (
|
|
53
57
|
<DropdownItem
|
|
54
58
|
data-fs-buyer-portal-filter-item
|
|
55
|
-
key={option}
|
|
59
|
+
key={option.value}
|
|
56
60
|
onClick={() => updateLabel(option)}
|
|
57
61
|
>
|
|
58
|
-
{option}
|
|
62
|
+
{option.label}
|
|
59
63
|
</DropdownItem>
|
|
60
64
|
))}
|
|
61
65
|
</DropdownMenu>
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { useLocalization } from "../../localization/LocalizationContext";
|
|
1
2
|
import { isDevelopment } from "../../utils/environment";
|
|
2
3
|
import { Icon } from "../Icon";
|
|
3
4
|
|
|
@@ -13,24 +14,30 @@ export type ErrorProps = {
|
|
|
13
14
|
};
|
|
14
15
|
|
|
15
16
|
export default function Error({ error }: ErrorProps) {
|
|
17
|
+
const { t } = useLocalization();
|
|
18
|
+
|
|
16
19
|
return (
|
|
17
20
|
<div data-fs-bp-error>
|
|
18
21
|
<Icon name="Warning" width={48} height={48} data-fs-icon-loading="true" />
|
|
19
|
-
<h2 data-fs-bp-error-title>
|
|
22
|
+
<h2 data-fs-bp-error-title>{t("shared.errors.somethingWentWrong")}</h2>
|
|
20
23
|
<button data-fs-bp-error-button onClick={() => window.location.reload()}>
|
|
21
|
-
|
|
24
|
+
{t("shared.buttons.tryAgain")}
|
|
22
25
|
</button>
|
|
23
26
|
{isDevelopment() && (
|
|
24
27
|
<div data-fs-bp-error-details>
|
|
25
28
|
<span data-fs-bp-error-details-type>{error?.tags?.errorType}</span>
|
|
26
|
-
<h2 data-fs-bp-error-details-title>
|
|
29
|
+
<h2 data-fs-bp-error-details-title>
|
|
30
|
+
{t("shared.errors.errorDetails")}
|
|
31
|
+
</h2>
|
|
27
32
|
<p data-fs-bp-error-details-message>{error?.error.message}</p>
|
|
28
|
-
<p data-fs-bp-error-details-stack>
|
|
33
|
+
<p data-fs-bp-error-details-stack>
|
|
34
|
+
{t("shared.errors.stackLabel")} {error?.error.stack}
|
|
35
|
+
</p>
|
|
29
36
|
<p data-fs-bp-error-details-component>
|
|
30
|
-
|
|
37
|
+
{t("shared.errors.componentLabel")} {error?.tags?.component}
|
|
31
38
|
</p>
|
|
32
39
|
<p data-fs-bp-error-details-query>
|
|
33
|
-
|
|
40
|
+
{t("shared.errors.queryLabel")} {JSON.stringify(error?.query)}
|
|
34
41
|
</p>
|
|
35
42
|
</div>
|
|
36
43
|
)}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { ReactNode } from "react";
|
|
2
2
|
|
|
3
|
-
import
|
|
3
|
+
import { useLink_unstable as useLink } from "@faststore/core/experimental";
|
|
4
|
+
import { Link } from "@faststore/ui";
|
|
4
5
|
|
|
5
6
|
import { Icon } from "../Icon";
|
|
6
7
|
|
|
@@ -20,10 +21,12 @@ export const HeaderInside = ({
|
|
|
20
21
|
info,
|
|
21
22
|
...otherProps
|
|
22
23
|
}: HeaderInsideProps) => {
|
|
24
|
+
const { resolveLink } = useLink();
|
|
25
|
+
|
|
23
26
|
return (
|
|
24
27
|
<header data-fs-bp-header-inside {...otherProps}>
|
|
25
28
|
{!!backLink && (
|
|
26
|
-
<Link href={backLink} data-fs-bp-back-link>
|
|
29
|
+
<Link href={resolveLink(backLink)} data-fs-bp-back-link>
|
|
27
30
|
<Icon name="Back" />
|
|
28
31
|
</Link>
|
|
29
32
|
)}
|
|
@@ -2,12 +2,15 @@ import { useEffect, useState } from "react";
|
|
|
2
2
|
|
|
3
3
|
import { Icon as UIIcon } from "@faststore/ui";
|
|
4
4
|
|
|
5
|
+
import { useLocalization } from "../../localization/LocalizationContext";
|
|
6
|
+
|
|
5
7
|
export type InternalSearchProps = {
|
|
6
8
|
textSearch: (searchTerm: string) => void;
|
|
7
9
|
defaultValue?: string;
|
|
8
10
|
};
|
|
9
11
|
|
|
10
12
|
const InternalSearch = ({ textSearch, defaultValue }: InternalSearchProps) => {
|
|
13
|
+
const { t } = useLocalization();
|
|
11
14
|
const [searchTerm, setSearchTerm] = useState(defaultValue || "");
|
|
12
15
|
const [isFocused, setIsFocused] = useState(false);
|
|
13
16
|
|
|
@@ -29,7 +32,7 @@ const InternalSearch = ({ textSearch, defaultValue }: InternalSearchProps) => {
|
|
|
29
32
|
<input
|
|
30
33
|
data-fs-buyer-portal-internal-search-input
|
|
31
34
|
value={searchTerm}
|
|
32
|
-
placeholder="
|
|
35
|
+
placeholder={t("shared.placeholders.search")}
|
|
33
36
|
onChange={handleInputChange}
|
|
34
37
|
onFocus={() => setIsFocused(true)}
|
|
35
38
|
onBlur={() => setIsFocused(false)}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import type { ReactNode } from "react";
|
|
2
2
|
import type { HTMLAttributes } from "react";
|
|
3
3
|
|
|
4
|
-
import
|
|
5
|
-
|
|
6
|
-
import { IconButton, Dropdown, DropdownButton } from "@faststore/ui";
|
|
4
|
+
import { useLink_unstable as useLink } from "@faststore/core/experimental";
|
|
5
|
+
import { IconButton, Dropdown, DropdownButton, Link } from "@faststore/ui";
|
|
7
6
|
|
|
8
7
|
import { useBuyerPortal } from "../../hooks/useBuyerPortal";
|
|
8
|
+
import { useLocalization } from "../../localization/LocalizationContext";
|
|
9
9
|
import { Icon } from "../Icon";
|
|
10
10
|
|
|
11
11
|
interface InternapTopBarProps
|
|
@@ -28,11 +28,13 @@ export const InternalTopBar = ({
|
|
|
28
28
|
href = "/pvt/organization-account",
|
|
29
29
|
}: InternapTopBarProps) => {
|
|
30
30
|
const { currentOrgUnit } = useBuyerPortal();
|
|
31
|
+
const { t } = useLocalization();
|
|
32
|
+
const { resolveLink } = useLink();
|
|
31
33
|
|
|
32
34
|
return (
|
|
33
35
|
<header data-fs-buyer-portal-topbar>
|
|
34
36
|
<div data-fs-buyer-portal-topbar-navigation>
|
|
35
|
-
<Link href={href}>
|
|
37
|
+
<Link href={resolveLink(href)}>
|
|
36
38
|
<IconButton
|
|
37
39
|
size="small"
|
|
38
40
|
icon={
|
|
@@ -49,7 +51,7 @@ export const InternalTopBar = ({
|
|
|
49
51
|
<div data-fs-internal-topbar-icon-wrapper>
|
|
50
52
|
<Icon name="StarFolder" height={24} width={24} />
|
|
51
53
|
</div>
|
|
52
|
-
{currentOrgUnit?.name ?? "
|
|
54
|
+
{currentOrgUnit?.name ?? t("shared.labels.buyerPortal")}
|
|
53
55
|
</div>
|
|
54
56
|
|
|
55
57
|
<div data-fs-buyer-portal-topbar-wrapper>
|
|
@@ -3,21 +3,32 @@ import { useRouter } from "next/router";
|
|
|
3
3
|
import { DropdownItem, DropdownMenu } from "@faststore/ui";
|
|
4
4
|
|
|
5
5
|
import { useBuyerPortal } from "../../hooks/useBuyerPortal";
|
|
6
|
+
import { useLocalization } from "../../localization/LocalizationContext";
|
|
6
7
|
import { Icon } from "../Icon";
|
|
7
8
|
|
|
8
9
|
import type { OrgUnitBasicData } from "../../../org-units/types";
|
|
10
|
+
import type { LocalizeFn } from "../../localization/types";
|
|
9
11
|
|
|
10
|
-
const getMenuItems = (
|
|
12
|
+
const getMenuItems = (
|
|
13
|
+
orgUnit: OrgUnitBasicData | null | undefined,
|
|
14
|
+
t: LocalizeFn
|
|
15
|
+
) => {
|
|
11
16
|
const contractsOrProfileOption =
|
|
12
17
|
orgUnit?.contractMode === "Single"
|
|
13
|
-
? {
|
|
14
|
-
|
|
18
|
+
? {
|
|
19
|
+
name: t("layouts.navigation.profile"),
|
|
20
|
+
link: `/profile/${orgUnit.id}`,
|
|
21
|
+
}
|
|
22
|
+
: {
|
|
23
|
+
name: t("layouts.navigation.contracts"),
|
|
24
|
+
link: `/contracts/${orgUnit?.id}`,
|
|
25
|
+
};
|
|
15
26
|
|
|
16
27
|
const menuItems = [
|
|
17
|
-
{ name: "
|
|
18
|
-
{ name: "
|
|
28
|
+
{ name: t("layouts.navigation.users"), link: "/users" },
|
|
29
|
+
{ name: t("layouts.navigation.organizationalUnits"), link: "/org-units" },
|
|
19
30
|
contractsOrProfileOption,
|
|
20
|
-
{ name: "
|
|
31
|
+
{ name: t("layouts.navigation.addresses"), link: "/addresses" },
|
|
21
32
|
].map((item) => ({
|
|
22
33
|
...item,
|
|
23
34
|
link: orgUnit ? `${item.link}/${orgUnit.id}` : item.link,
|
|
@@ -25,7 +36,10 @@ const getMenuItems = (orgUnit?: OrgUnitBasicData | null) => {
|
|
|
25
36
|
|
|
26
37
|
const firstOption = orgUnit
|
|
27
38
|
? { name: orgUnit.name, link: `/org-unit/${orgUnit.id}` }
|
|
28
|
-
: {
|
|
39
|
+
: {
|
|
40
|
+
name: t("layouts.navigation.organizationAccount"),
|
|
41
|
+
link: "/pvt/organization-account",
|
|
42
|
+
};
|
|
29
43
|
|
|
30
44
|
return [firstOption, ...menuItems];
|
|
31
45
|
};
|
|
@@ -33,10 +47,11 @@ const getMenuItems = (orgUnit?: OrgUnitBasicData | null) => {
|
|
|
33
47
|
export const MainLinksDropdownMenu = () => {
|
|
34
48
|
const { push, asPath } = useRouter();
|
|
35
49
|
const { currentOrgUnit } = useBuyerPortal();
|
|
50
|
+
const { t } = useLocalization();
|
|
36
51
|
|
|
37
52
|
return (
|
|
38
53
|
<DropdownMenu align="center" data-fs-bp-main-links-dropdown-menu>
|
|
39
|
-
{getMenuItems(currentOrgUnit).map(({ name, link }) => {
|
|
54
|
+
{getMenuItems(currentOrgUnit, t).map(({ name, link }) => {
|
|
40
55
|
const isActive = asPath === link;
|
|
41
56
|
|
|
42
57
|
return (
|