@vtex/faststore-plugin-buyer-portal 2.0.39 → 2.0.41
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/package.json +1 -1
- package/src/features/accounting-fields/components/AccountingFieldForm/AccountingFieldForm.tsx +1 -1
- package/src/features/shared/utils/constants.ts +1 -1
- package/src/features/users/components/CreateUserDrawerWithUsername/CreateUserDrawerWithUsername.tsx +2 -1
- package/src/features/users/components/UpdateUserDrawerWithUsername/UpdateUserDrawerWithUsername.tsx +2 -1
- package/src/features/users/components/UserFormFields/UserFormFields.tsx +21 -6
package/package.json
CHANGED
package/src/features/accounting-fields/components/AccountingFieldForm/AccountingFieldForm.tsx
CHANGED
|
@@ -123,7 +123,7 @@ export function AccountingFieldForm({
|
|
|
123
123
|
icon={
|
|
124
124
|
<Tooltip
|
|
125
125
|
placement="left-center"
|
|
126
|
-
content=""
|
|
126
|
+
content={t("accountingFields.tooltips.fieldLabelInfo")}
|
|
127
127
|
>
|
|
128
128
|
<Icon name="InfoFilled" width={20} height={20} />
|
|
129
129
|
</Tooltip>
|
package/src/features/users/components/CreateUserDrawerWithUsername/CreateUserDrawerWithUsername.tsx
CHANGED
|
@@ -92,6 +92,7 @@ export const CreateUserDrawerWithUsername = ({
|
|
|
92
92
|
};
|
|
93
93
|
|
|
94
94
|
const isFormValid = () => {
|
|
95
|
+
if (!name.trim()) return false;
|
|
95
96
|
if (!trimmedLogin) return false;
|
|
96
97
|
if (roles.length === 0) return false;
|
|
97
98
|
if (loginType === "email" && !isTransactionalEmailValid()) return false;
|
|
@@ -107,7 +108,7 @@ export const CreateUserDrawerWithUsername = ({
|
|
|
107
108
|
: trimmedLogin;
|
|
108
109
|
const base = {
|
|
109
110
|
login: payloadLogin,
|
|
110
|
-
name: name
|
|
111
|
+
name: name.trim(),
|
|
111
112
|
roles,
|
|
112
113
|
orgUnitId,
|
|
113
114
|
};
|
package/src/features/users/components/UpdateUserDrawerWithUsername/UpdateUserDrawerWithUsername.tsx
CHANGED
|
@@ -135,6 +135,7 @@ export const UpdateUserDrawerWithUsername = ({
|
|
|
135
135
|
};
|
|
136
136
|
|
|
137
137
|
const isFormValid = () => {
|
|
138
|
+
if (!name.trim()) return false;
|
|
138
139
|
if (!trimmedLogin) return false;
|
|
139
140
|
if (roles.length === 0) return false;
|
|
140
141
|
if (loginType === "email" && !isTransactionalEmailValid()) return false;
|
|
@@ -240,7 +241,7 @@ export const UpdateUserDrawerWithUsername = ({
|
|
|
240
241
|
|
|
241
242
|
updateUser({
|
|
242
243
|
userId,
|
|
243
|
-
name,
|
|
244
|
+
name: name.trim(),
|
|
244
245
|
email: emailForPayload,
|
|
245
246
|
phone: phoneForPayload,
|
|
246
247
|
roles: roleNamesForPayload,
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { useState } from "react";
|
|
2
|
+
|
|
1
3
|
import { Alert, Skeleton } from "@faststore/ui";
|
|
2
4
|
|
|
3
5
|
import { ErrorMessage, Icon, InputText } from "../../../shared/components";
|
|
@@ -64,6 +66,7 @@ export const UserFormFields = ({
|
|
|
64
66
|
loginTestId,
|
|
65
67
|
}: UserFormFieldsProps) => {
|
|
66
68
|
const { t } = useLocalization();
|
|
69
|
+
const [isNameTouched, setIsNameTouched] = useState(false);
|
|
67
70
|
const {
|
|
68
71
|
login,
|
|
69
72
|
name,
|
|
@@ -86,6 +89,7 @@ export const UserFormFields = ({
|
|
|
86
89
|
!isEmpty &&
|
|
87
90
|
(loginType === "phone" || loginType === "username") &&
|
|
88
91
|
!isValidEmail(trimmedEmail);
|
|
92
|
+
const showNameError = (isTouched || isNameTouched) && !name.trim();
|
|
89
93
|
|
|
90
94
|
const rolesAttr =
|
|
91
95
|
mode === "create"
|
|
@@ -100,12 +104,23 @@ export const UserFormFields = ({
|
|
|
100
104
|
style={{ marginBottom: "1rem" }}
|
|
101
105
|
/>
|
|
102
106
|
) : (
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
107
|
+
<>
|
|
108
|
+
<InputText
|
|
109
|
+
label={t("users.forms.fullName")}
|
|
110
|
+
value={name}
|
|
111
|
+
wrapperProps={{ style: { marginBottom: 16 } }}
|
|
112
|
+
hasError={showNameError}
|
|
113
|
+
onBlur={() => setIsNameTouched(true)}
|
|
114
|
+
onChange={(event) => {
|
|
115
|
+
setIsNameTouched(true);
|
|
116
|
+
updateField("name", event.target.value);
|
|
117
|
+
}}
|
|
118
|
+
/>
|
|
119
|
+
<ErrorMessage
|
|
120
|
+
show={showNameError}
|
|
121
|
+
message={t("users.validation.fullNameRequired")}
|
|
122
|
+
/>
|
|
123
|
+
</>
|
|
109
124
|
)}
|
|
110
125
|
|
|
111
126
|
{isFieldLoading ? (
|