@vtex/faststore-plugin-buyer-portal 1.3.80 → 1.3.81
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 +9 -1
- package/package.json +1 -1
- package/plugin.config.js +2 -2
- package/src/features/payment-methods/clients/PaymentMethodsClient.ts +5 -4
- package/src/features/payment-methods/components/AddPaymentMethodsDrawer/AddPaymentMethodsDrawer.tsx +3 -2
- package/src/features/payment-methods/components/RemovePaymentMethodsDrawer/RemovePaymentMethodsDrawer.tsx +2 -1
- package/src/features/payment-methods/hooks/useRemovePaymentMethodSubmit.ts +5 -2
- package/src/features/payment-methods/services/remove-payment-methods-from-unit.service.ts +3 -1
- package/src/features/payment-methods/types/PaymentMethod.ts +3 -1
- package/src/features/shared/types/PaymentMethodsClientTypes.ts +2 -1
- package/src/features/shared/types/index.ts +1 -0
- package/src/features/shared/utils/buyerPortalRoutes.ts +1 -1
- package/src/features/shared/utils/constants.ts +1 -1
- package/src/features/shared/utils/routeLayoutMapping.ts +1 -1
- /package/src/pages/{payment-methods.tsx → payment-groups.tsx} +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [1.3.81] - 2026-04-29
|
|
11
|
+
|
|
12
|
+
### Changed
|
|
13
|
+
|
|
14
|
+
- Switch payment methods route/api integration to `payment-groups` and support string-based ids in the add/remove flow (`B2BTEAM-3238`)
|
|
15
|
+
- Register the page in `plugin.config.js` as `payment-groups` with path `/pvt/organization-account/payment-groups/[orgUnitId]/[contractId]` so it matches `buyerPortalRoutes` and resolves navigation 404s. Bookmarks or deep links using the previous `/pvt/organization-account/payment-methods/...` path are no longer served by this plugin (`B2BTEAM-3238`)
|
|
16
|
+
|
|
10
17
|
## [1.3.80] - 2026-04-29
|
|
11
18
|
|
|
12
19
|
### Fixed
|
|
@@ -597,7 +604,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
597
604
|
- Add CHANGELOG file
|
|
598
605
|
- Add README file
|
|
599
606
|
|
|
600
|
-
[unreleased]: https://github.com/vtex/faststore-plugin-buyer-portal/compare/v1.3.
|
|
607
|
+
[unreleased]: https://github.com/vtex/faststore-plugin-buyer-portal/compare/v1.3.81...HEAD
|
|
601
608
|
[1.3.55]: https://github.com/vtex/faststore-plugin-buyer-portal/compare/v1.3.54...v1.3.55
|
|
602
609
|
[1.3.54]: https://github.com/vtex/faststore-plugin-buyer-portal/compare/v1.3.53...v1.3.54
|
|
603
610
|
[1.3.53]: https://github.com/vtex/faststore-plugin-buyer-portal/compare/v1.3.52...v1.3.53
|
|
@@ -665,6 +672,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
665
672
|
[1.3.65]: https://github.com/vtex/faststore-plugin-buyer-portal/compare/v1.3.64...v1.3.65
|
|
666
673
|
[1.3.64]: https://github.com/vtex/faststore-plugin-buyer-portal/releases/tag/1.3.64
|
|
667
674
|
[1.3.69]: https://github.com/vtex/faststore-plugin-buyer-portal/releases/tag/1.3.69
|
|
675
|
+
[1.3.81]: https://github.com/vtex/faststore-plugin-buyer-portal/compare/v1.3.80...v1.3.81
|
|
668
676
|
[1.3.80]: https://github.com/vtex/faststore-plugin-buyer-portal/compare/v1.3.79...v1.3.80
|
|
669
677
|
[1.3.79]: https://github.com/vtex/faststore-plugin-buyer-portal/compare/v1.3.78...v1.3.79
|
|
670
678
|
[1.3.78]: https://github.com/vtex/faststore-plugin-buyer-portal/compare/v1.3.77...v1.3.78
|
package/package.json
CHANGED
package/plugin.config.js
CHANGED
|
@@ -28,8 +28,8 @@ module.exports = {
|
|
|
28
28
|
path: "/pvt/organization-account/budgets/[orgUnitId]/[contractId]/[budgetId]",
|
|
29
29
|
appLayout: false,
|
|
30
30
|
},
|
|
31
|
-
"payment-
|
|
32
|
-
path: "/pvt/organization-account/payment-
|
|
31
|
+
"payment-groups": {
|
|
32
|
+
path: "/pvt/organization-account/payment-groups/[orgUnitId]/[contractId]",
|
|
33
33
|
appLayout: false,
|
|
34
34
|
},
|
|
35
35
|
"credit-cards": {
|
|
@@ -2,6 +2,7 @@ import { Client } from "../../shared/clients/Client";
|
|
|
2
2
|
import { getApiUrl } from "../../shared/utils";
|
|
3
3
|
|
|
4
4
|
import type {
|
|
5
|
+
PaymentMethodId,
|
|
5
6
|
PaymentMethodResponse,
|
|
6
7
|
PaymentMethodsIdArray,
|
|
7
8
|
PaymentMethodsReqCommonParams,
|
|
@@ -39,7 +40,7 @@ export default class PaymentMethodsClient extends Client {
|
|
|
39
40
|
}
|
|
40
41
|
|
|
41
42
|
const queryString = queryParams.toString();
|
|
42
|
-
const url = `customers/${customerId}/units/${unitId}/payment-
|
|
43
|
+
const url = `customers/${customerId}/units/${unitId}/payment-groups/paginated${
|
|
43
44
|
queryString ? `?${queryString}` : ""
|
|
44
45
|
}`;
|
|
45
46
|
|
|
@@ -58,7 +59,7 @@ export default class PaymentMethodsClient extends Client {
|
|
|
58
59
|
const { customerId, unitId, cookie, paymentMethodsIds } = data;
|
|
59
60
|
|
|
60
61
|
return await this.post<PaymentMethodResponse, PaymentMethodsIdArray>(
|
|
61
|
-
`customers/${customerId}/units/${unitId}/payment-
|
|
62
|
+
`customers/${customerId}/units/${unitId}/payment-groups`,
|
|
62
63
|
paymentMethodsIds,
|
|
63
64
|
{
|
|
64
65
|
headers: {
|
|
@@ -71,13 +72,13 @@ export default class PaymentMethodsClient extends Client {
|
|
|
71
72
|
|
|
72
73
|
async removePaymentMethodFromUnit(
|
|
73
74
|
data: PaymentMethodsReqCommonParams & {
|
|
74
|
-
paymentMethodId:
|
|
75
|
+
paymentMethodId: PaymentMethodId;
|
|
75
76
|
}
|
|
76
77
|
) {
|
|
77
78
|
const { customerId, unitId, cookie, paymentMethodId } = data;
|
|
78
79
|
|
|
79
80
|
return await this.delete(
|
|
80
|
-
`customers/${customerId}/units/${unitId}/payment-
|
|
81
|
+
`customers/${customerId}/units/${unitId}/payment-groups/${paymentMethodId}`,
|
|
81
82
|
null,
|
|
82
83
|
{
|
|
83
84
|
headers: {
|
package/src/features/payment-methods/components/AddPaymentMethodsDrawer/AddPaymentMethodsDrawer.tsx
CHANGED
|
@@ -19,6 +19,7 @@ import { useAddPaymentMethodsToUnit } from "../../hooks";
|
|
|
19
19
|
import { useDebouncedSearchPaymentMethods } from "../../hooks/useDebouncedSearchPaymentMethods";
|
|
20
20
|
|
|
21
21
|
import type { TableColumn } from "../../../shared/components/Table/TableHead/TableHead";
|
|
22
|
+
import type { PaymentMethodId } from "../../../shared/types";
|
|
22
23
|
|
|
23
24
|
export type AddPaymentMethodsDrawerProps = Omit<
|
|
24
25
|
BasicDrawerProps,
|
|
@@ -35,7 +36,7 @@ export const AddPaymentMethodsDrawer = ({
|
|
|
35
36
|
const [querySearch, setQuerySearch] = useState("");
|
|
36
37
|
const [drawerPage, setDrawerPage] = useState(1);
|
|
37
38
|
const [isLastPage, setIsLastPage] = useState(true);
|
|
38
|
-
const [selectedMethods, setSelectedMethods] = useState<Set<
|
|
39
|
+
const [selectedMethods, setSelectedMethods] = useState<Set<PaymentMethodId>>(
|
|
39
40
|
new Set()
|
|
40
41
|
);
|
|
41
42
|
|
|
@@ -116,7 +117,7 @@ export const AddPaymentMethodsDrawer = ({
|
|
|
116
117
|
}
|
|
117
118
|
}, [someSelected]);
|
|
118
119
|
|
|
119
|
-
const toggleItem = useCallback((id:
|
|
120
|
+
const toggleItem = useCallback((id: PaymentMethodId) => {
|
|
120
121
|
setSelectedMethods((prev) => {
|
|
121
122
|
const next = new Set(prev);
|
|
122
123
|
if (next.has(id)) next.delete(id);
|
|
@@ -2,6 +2,7 @@ import { type BasicDrawerProps, BasicDrawer } from "../../../shared/components";
|
|
|
2
2
|
import { useBuyerPortal } from "../../../shared/hooks";
|
|
3
3
|
import { useRemovePaymentMethod } from "../../hooks/useRemovePaymentMethodSubmit";
|
|
4
4
|
|
|
5
|
+
import type { PaymentMethodId } from "../../../shared/types";
|
|
5
6
|
import type { PaymentMethodData } from "../../types";
|
|
6
7
|
|
|
7
8
|
export type RemovePaymentMethodsDrawerProps = Omit<
|
|
@@ -27,7 +28,7 @@ export const RemovePaymentMethodsDrawer = ({
|
|
|
27
28
|
const { remove, isRemovingPaymentMethod } =
|
|
28
29
|
useRemovePaymentMethod(handleSuccess);
|
|
29
30
|
|
|
30
|
-
const handleSubmit = (paymentMethodId:
|
|
31
|
+
const handleSubmit = (paymentMethodId: PaymentMethodId) => {
|
|
31
32
|
remove(paymentMethodId);
|
|
32
33
|
};
|
|
33
34
|
|
|
@@ -7,6 +7,7 @@ import { CHANGES_TIMEOUT_MESSAGE } from "../../shared/utils/constants";
|
|
|
7
7
|
|
|
8
8
|
import { useRemovePaymentMethodFromUnit } from "./useRemovePaymentMethodsFromUnit";
|
|
9
9
|
|
|
10
|
+
import type { PaymentMethodId } from "../../shared/types";
|
|
10
11
|
import type { PaymentMethodData } from "../types";
|
|
11
12
|
|
|
12
13
|
export function useRemovePaymentMethod(onAfterSuccess?: () => void) {
|
|
@@ -38,12 +39,14 @@ export function useRemovePaymentMethod(onAfterSuccess?: () => void) {
|
|
|
38
39
|
},
|
|
39
40
|
});
|
|
40
41
|
|
|
41
|
-
const remove = (paymentMethod: PaymentMethodData |
|
|
42
|
+
const remove = (paymentMethod: PaymentMethodData | PaymentMethodId) => {
|
|
42
43
|
removePaymentMethod({
|
|
43
44
|
customerId,
|
|
44
45
|
unitId,
|
|
45
46
|
paymentMethodId:
|
|
46
|
-
typeof paymentMethod === "number"
|
|
47
|
+
typeof paymentMethod === "number" || typeof paymentMethod === "string"
|
|
48
|
+
? paymentMethod
|
|
49
|
+
: paymentMethod?.id,
|
|
47
50
|
});
|
|
48
51
|
};
|
|
49
52
|
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { paymentMethodsClient } from "../clients/PaymentMethodsClient";
|
|
2
2
|
|
|
3
|
+
import type { PaymentMethodId } from "../../shared/types";
|
|
4
|
+
|
|
3
5
|
export type RemovePaymentMethodFromUnitServiceProps = {
|
|
4
6
|
customerId: string;
|
|
5
7
|
unitId: string;
|
|
6
|
-
paymentMethodId:
|
|
8
|
+
paymentMethodId: PaymentMethodId;
|
|
7
9
|
cookie: string;
|
|
8
10
|
};
|
|
9
11
|
|
|
@@ -4,6 +4,7 @@ export type { CurrencyType, LocaleType } from "./CurrencyType";
|
|
|
4
4
|
export type { LoaderData } from "./LoaderData";
|
|
5
5
|
export type { IPagination } from "./Pagination";
|
|
6
6
|
export type {
|
|
7
|
+
PaymentMethodId,
|
|
7
8
|
PaymentMethodResponse,
|
|
8
9
|
PaymentMethodsIdArray,
|
|
9
10
|
PaymentMethodsReqCommonParams,
|
|
@@ -42,7 +42,7 @@ export const buyerPortalRoutes = {
|
|
|
42
42
|
),
|
|
43
43
|
|
|
44
44
|
paymentMethods: (params: { orgUnitId: string; contractId: string }) =>
|
|
45
|
-
replaceParams(`${base}/payment-
|
|
45
|
+
replaceParams(`${base}/payment-groups/[orgUnitId]/[contractId]`, params),
|
|
46
46
|
|
|
47
47
|
creditCards: (params: { orgUnitId: string; contractId: string }) =>
|
|
48
48
|
replaceParams(`${base}/credit-cards/[orgUnitId]/[contractId]`, params),
|
|
@@ -22,7 +22,7 @@ export const SCOPE_KEYS = {
|
|
|
22
22
|
CREDIT_CARDS: "creditCards",
|
|
23
23
|
} as const;
|
|
24
24
|
|
|
25
|
-
export const CURRENT_VERSION = "1.3.
|
|
25
|
+
export const CURRENT_VERSION = "1.3.81";
|
|
26
26
|
|
|
27
27
|
export const CHANGES_TIMEOUT_MESSAGE =
|
|
28
28
|
"Changes may take up to 10 minutes to apply.";
|
|
@@ -27,7 +27,7 @@ export const ROUTE_TABS_LAYOUT_MAPPING: Record<string, RouteTabsLayoutConfig> =
|
|
|
27
27
|
pageName: "Contract",
|
|
28
28
|
pageTitle: "Address Details",
|
|
29
29
|
},
|
|
30
|
-
"/pvt/organization-account/payment-
|
|
30
|
+
"/pvt/organization-account/payment-groups/[orgUnitId]/[contractId]": {
|
|
31
31
|
layout: "ContractTabsLayout",
|
|
32
32
|
pageName: "Contract",
|
|
33
33
|
pageTitle: "Payment Methods",
|
|
File without changes
|