@vtex/faststore-plugin-buyer-portal 1.3.20 → 1.3.21
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 +8 -1
- package/package.json +1 -1
- package/src/features/payment-methods/components/RemovePaymentMethodsDrawer/RemovePaymentMethodsDrawer.tsx +1 -22
- package/src/features/payment-methods/layouts/PaymentMethodsLayout/PaymentMethodsLayout.tsx +2 -8
- package/src/features/shared/utils/constants.ts +1 -1
- package/src/features/payment-methods/hooks/useCookiePreferenceHideDrawer.ts +0 -34
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [1.3.21] - 2025-11-05
|
|
11
|
+
|
|
12
|
+
### Removed
|
|
13
|
+
|
|
14
|
+
- Remove cookie-based preference validation on Payment Methods remove Drawer.
|
|
15
|
+
|
|
10
16
|
## [1.3.20] - 2025-11-05
|
|
11
17
|
|
|
12
18
|
### Added
|
|
@@ -223,7 +229,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
223
229
|
- Add CHANGELOG file
|
|
224
230
|
- Add README file
|
|
225
231
|
|
|
226
|
-
[unreleased]: https://github.com/vtex/faststore-plugin-buyer-portal/compare/v1.3.
|
|
232
|
+
[unreleased]: https://github.com/vtex/faststore-plugin-buyer-portal/compare/v1.3.21...HEAD
|
|
227
233
|
[1.2.3]: https://github.com/vtex/faststore-plugin-buyer-portal/compare/v1.2.2...1.2.3
|
|
228
234
|
[1.2.3]: https://github.com/vtex/faststore-plugin-buyer-portal/releases/tag/1.2.3
|
|
229
235
|
[1.2.4]: https://github.com/vtex/faststore-plugin-buyer-portal/releases/tag/1.2.4
|
|
@@ -238,6 +244,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
238
244
|
|
|
239
245
|
# <<<<<<< HEAD
|
|
240
246
|
|
|
247
|
+
[1.3.21]: https://github.com/vtex/faststore-plugin-buyer-portal/compare/v1.3.20...v1.3.21
|
|
241
248
|
[1.3.20]: https://github.com/vtex/faststore-plugin-buyer-portal/compare/v1.3.19...v1.3.20
|
|
242
249
|
[1.3.19]: https://github.com/vtex/faststore-plugin-buyer-portal/compare/v1.3.18...v1.3.19
|
|
243
250
|
[1.3.18]: https://github.com/vtex/faststore-plugin-buyer-portal/compare/v1.3.17...v1.3.18
|
package/package.json
CHANGED
|
@@ -1,10 +1,5 @@
|
|
|
1
|
-
import { useState } from "react";
|
|
2
|
-
|
|
3
|
-
import { CheckboxField } from "@faststore/ui";
|
|
4
|
-
|
|
5
1
|
import { type BasicDrawerProps, BasicDrawer } from "../../../shared/components";
|
|
6
2
|
import { useBuyerPortal } from "../../../shared/hooks";
|
|
7
|
-
import { useCookiePreferenceHideDrawer } from "../../hooks/useCookiePreferenceHideDrawer";
|
|
8
3
|
import { useRemovePaymentMethod } from "../../hooks/useRemovePaymentMethodSubmit";
|
|
9
4
|
|
|
10
5
|
import type { PaymentMethodData } from "../../types";
|
|
@@ -24,17 +19,9 @@ export const RemovePaymentMethodsDrawer = ({
|
|
|
24
19
|
...props
|
|
25
20
|
}: RemovePaymentMethodsDrawerProps) => {
|
|
26
21
|
const { currentOrgUnit: orgUnit } = useBuyerPortal();
|
|
27
|
-
const { hideMessage, isMessageHidden } = useCookiePreferenceHideDrawer();
|
|
28
|
-
|
|
29
|
-
const [dontShowAgain, setDontShowAgain] = useState<boolean>(
|
|
30
|
-
isMessageHidden || false
|
|
31
|
-
);
|
|
32
22
|
|
|
33
23
|
const handleSuccess = () => {
|
|
34
24
|
close();
|
|
35
|
-
if (dontShowAgain) {
|
|
36
|
-
hideMessage();
|
|
37
|
-
}
|
|
38
25
|
};
|
|
39
26
|
|
|
40
27
|
const { remove, isRemovingPaymentMethod } =
|
|
@@ -44,7 +31,7 @@ export const RemovePaymentMethodsDrawer = ({
|
|
|
44
31
|
remove(paymentMethodId);
|
|
45
32
|
};
|
|
46
33
|
|
|
47
|
-
if (!paymentMethod
|
|
34
|
+
if (!paymentMethod) {
|
|
48
35
|
return null;
|
|
49
36
|
}
|
|
50
37
|
|
|
@@ -68,14 +55,6 @@ export const RemovePaymentMethodsDrawer = ({
|
|
|
68
55
|
This action will prevent users in this unit from acessing this
|
|
69
56
|
payment method during checkout.
|
|
70
57
|
</p>
|
|
71
|
-
<CheckboxField
|
|
72
|
-
data-fs-checkbox-field-content
|
|
73
|
-
data-fs-bp-payment-methods-checkbox
|
|
74
|
-
label="Don't show this message again"
|
|
75
|
-
id="prevent-message"
|
|
76
|
-
checked={dontShowAgain}
|
|
77
|
-
onChange={(e) => setDontShowAgain(e.target.checked)}
|
|
78
|
-
/>
|
|
79
58
|
</section>
|
|
80
59
|
</BasicDrawer.Body>
|
|
81
60
|
|
|
@@ -16,7 +16,6 @@ import {
|
|
|
16
16
|
RemovePaymentMethodsDrawer,
|
|
17
17
|
SearchPaymentMethods,
|
|
18
18
|
} from "../../components";
|
|
19
|
-
import { useCookiePreferenceHideDrawer } from "../../hooks/useCookiePreferenceHideDrawer";
|
|
20
19
|
import { useDebouncedSearchPaymentMethods } from "../../hooks/useDebouncedSearchPaymentMethods";
|
|
21
20
|
import { useRemovePaymentMethod } from "../../hooks/useRemovePaymentMethodSubmit";
|
|
22
21
|
|
|
@@ -39,8 +38,7 @@ export const PaymentMethodsLayout = ({
|
|
|
39
38
|
const [querySearch, setQuerySearch] = useState(search ?? "");
|
|
40
39
|
|
|
41
40
|
const { setQueryString, removeQueryString } = useQueryParams();
|
|
42
|
-
const {
|
|
43
|
-
const { remove, isRemovingPaymentMethod } = useRemovePaymentMethod(() => {
|
|
41
|
+
const { isRemovingPaymentMethod } = useRemovePaymentMethod(() => {
|
|
44
42
|
setSelectedMethod(undefined);
|
|
45
43
|
});
|
|
46
44
|
|
|
@@ -98,11 +96,7 @@ export const PaymentMethodsLayout = ({
|
|
|
98
96
|
|
|
99
97
|
const onRemoveClick = (method: PaymentMethodData) => {
|
|
100
98
|
setSelectedMethod(method);
|
|
101
|
-
|
|
102
|
-
remove(method);
|
|
103
|
-
} else {
|
|
104
|
-
openRemoveDrawer();
|
|
105
|
-
}
|
|
99
|
+
openRemoveDrawer();
|
|
106
100
|
};
|
|
107
101
|
|
|
108
102
|
const columns = getTableColumns({ actionsLength: 1 });
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import { useEffect, useState } from "react";
|
|
2
|
-
|
|
3
|
-
const COOKIE_NAME = "hideMessage";
|
|
4
|
-
const MAX_AGE = 60 * 60 * 24 * 365; // a year
|
|
5
|
-
|
|
6
|
-
type UseCookiePreferenceHideDrawerResult = {
|
|
7
|
-
isMessageHidden: boolean;
|
|
8
|
-
hideMessage: () => void;
|
|
9
|
-
};
|
|
10
|
-
|
|
11
|
-
export function useCookiePreferenceHideDrawer(): UseCookiePreferenceHideDrawerResult {
|
|
12
|
-
const [isMessageHidden, setIsMessageHidden] = useState(false);
|
|
13
|
-
|
|
14
|
-
useEffect(() => {
|
|
15
|
-
const cookie = document.cookie
|
|
16
|
-
.split("; ")
|
|
17
|
-
.find((row) => row.startsWith(`${COOKIE_NAME}=`));
|
|
18
|
-
|
|
19
|
-
if (cookie) {
|
|
20
|
-
const value = cookie.split("=")[1];
|
|
21
|
-
setIsMessageHidden(value === "true");
|
|
22
|
-
}
|
|
23
|
-
}, []);
|
|
24
|
-
|
|
25
|
-
const hideMessage = () => {
|
|
26
|
-
document.cookie = `${COOKIE_NAME}=true; path=/; max-age=${MAX_AGE}`;
|
|
27
|
-
setIsMessageHidden(true);
|
|
28
|
-
};
|
|
29
|
-
|
|
30
|
-
return {
|
|
31
|
-
isMessageHidden,
|
|
32
|
-
hideMessage,
|
|
33
|
-
};
|
|
34
|
-
}
|