@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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vtex/faststore-plugin-buyer-portal",
3
- "version": "2.0.39",
3
+ "version": "2.0.41",
4
4
  "description": "A plugin for faststore with buyer portal",
5
5
  "main": "index.js",
6
6
  "files": [
@@ -123,7 +123,7 @@ export function AccountingFieldForm({
123
123
  icon={
124
124
  <Tooltip
125
125
  placement="left-center"
126
- content="" // TODO: Add message
126
+ content={t("accountingFields.tooltips.fieldLabelInfo")}
127
127
  >
128
128
  <Icon name="InfoFilled" width={20} height={20} />
129
129
  </Tooltip>
@@ -33,4 +33,4 @@ export const STOREFRONT_RESOURCE_NAMES = {
33
33
  export type StorefrontResourceName =
34
34
  (typeof STOREFRONT_RESOURCE_NAMES)[keyof typeof STOREFRONT_RESOURCE_NAMES];
35
35
 
36
- export const CURRENT_VERSION = "2.0.39";
36
+ export const CURRENT_VERSION = "2.0.41";
@@ -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 || undefined,
111
+ name: name.trim(),
111
112
  roles,
112
113
  orgUnitId,
113
114
  };
@@ -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
- <InputText
104
- label={t("users.forms.fullNameOptional")}
105
- value={name}
106
- wrapperProps={{ style: { marginBottom: 16 } }}
107
- onChange={(event) => updateField("name", event.target.value)}
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 ? (