@vtex/faststore-plugin-buyer-portal 2.0.5 → 2.0.6

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.
Files changed (32) hide show
  1. package/CHANGELOG.md +8 -1
  2. package/package.json +1 -1
  3. package/specs/refactor-add-user-form.md +371 -0
  4. package/src/features/org-units/components/AuthSetupDrawer/AuthSetupDrawer.tsx +3 -103
  5. package/src/features/org-units/types/OrgUnitSettings.ts +0 -12
  6. package/src/features/org-units/types/index.ts +1 -1
  7. package/src/features/shared/layouts/LoadingTabsLayout/LoadingTabsLayout.tsx +2 -2
  8. package/src/features/shared/utils/constants.ts +2 -2
  9. package/src/features/users/clients/UsersClient.ts +10 -6
  10. package/src/features/users/components/CreateUserDrawer/CreateUserDrawer.tsx +2 -2
  11. package/src/features/users/components/CreateUserDrawerWithUsername/CreateUserDrawerWithUsername.tsx +112 -380
  12. package/src/features/users/components/CreateUserDrawerWithUsername/create-user-drawer-with-username.scss +1 -0
  13. package/src/features/users/components/EmailTransactionalSection/EmailTransactionalSection.tsx +69 -0
  14. package/src/features/users/components/LoginField/LoginField.tsx +54 -0
  15. package/src/features/users/components/LoginField/__tests__/LoginField.test.ts +89 -0
  16. package/src/features/users/components/UpdateUserDrawer/UpdateUserDrawer.tsx +2 -2
  17. package/src/features/users/components/UpdateUserDrawerWithUsername/UpdateUserDrawerWithUsername.tsx +132 -211
  18. package/src/features/users/components/UpdateUserDrawerWithUsername/update-user-drawer-with-username.scss +1 -0
  19. package/src/features/users/components/UserFormFields/UserFormFields.tsx +253 -0
  20. package/src/features/users/components/UserFormFields/user-form-fields.scss +13 -0
  21. package/src/features/users/hooks/useAddUserToOrgUnit.ts +33 -10
  22. package/src/features/users/layouts/UsersLayout/UsersLayout.tsx +4 -4
  23. package/src/features/users/mocks/users-data.ts +4 -2
  24. package/src/features/users/services/add-user-to-org-unit.service.ts +51 -12
  25. package/src/features/users/services/get-user-by-id.service.ts +13 -3
  26. package/src/features/users/services/get-users-by-org-unit-id.service.ts +3 -2
  27. package/src/features/users/services/index.ts +1 -0
  28. package/src/features/users/services/update-user.service.ts +6 -3
  29. package/src/features/users/types/UserData.ts +4 -2
  30. package/src/features/users/types/UserDataService.ts +2 -0
  31. package/src/features/users/utils/__tests__/detectLoginType.test.ts +79 -0
  32. package/src/features/users/utils/detectLoginType.ts +36 -0
@@ -4,7 +4,7 @@ export const API_URL = (checkoutUrl: string, operation?: string) =>
4
4
  `${checkoutUrl}/_v/store-front/${operation}`;
5
5
  // DEV URL - CHANGE BEFORE MERGE
6
6
  // export const API_URL = (checkoutUrl?: string, operation?: string) =>
7
- // `https://customfieldsv2--b2bfaststoredev.myvtex.com/_v/store-front/${operation}`;
7
+ // `https://altphonenumber--b2bfaststoredev.myvtex.com/_v/store-front/${operation}`;
8
8
 
9
9
  export const DEBOUNCE_TIMEOUT = 500;
10
10
 
@@ -22,7 +22,7 @@ export const SCOPE_KEYS = {
22
22
  CREDIT_CARDS: "creditCards",
23
23
  } as const;
24
24
 
25
- export const CURRENT_VERSION = "2.0.5";
25
+ export const CURRENT_VERSION = "2.0.6";
26
26
 
27
27
  export const CHANGES_TIMEOUT_MESSAGE =
28
28
  "Changes may take up to 10 minutes to apply.";
@@ -36,7 +36,7 @@ class UsersClient extends Client {
36
36
  headers: { Cookie: cookie },
37
37
  params: {
38
38
  page: index + 1,
39
- name: search,
39
+ login: search,
40
40
  },
41
41
  })
42
42
  )
@@ -102,10 +102,11 @@ class UsersClient extends Client {
102
102
  props: {
103
103
  orgUnitId: string;
104
104
  role: number[];
105
+ login: string;
105
106
  email?: string;
106
107
  name?: string;
107
108
  phone?: string;
108
- userName: string;
109
+ transactionalEmail?: string;
109
110
  },
110
111
  cookie: string
111
112
  ) {
@@ -126,13 +127,14 @@ class UsersClient extends Client {
126
127
  {
127
128
  orgUnitId: string;
128
129
  role: number[];
130
+ login: string;
129
131
  email?: string;
130
132
  name?: string;
131
133
  phone?: string;
132
- userName: string;
134
+ transactionalEmail?: string;
133
135
  }
134
136
  >(
135
- `v2/units/${orgUnitId}/users`,
137
+ `v3/units/${orgUnitId}/users`,
136
138
  {
137
139
  ...data,
138
140
  orgUnitId,
@@ -196,7 +198,8 @@ class UsersClient extends Client {
196
198
  name?: string;
197
199
  email?: string;
198
200
  role?: string;
199
- userName?: string;
201
+ login?: string;
202
+ transactionalEmail?: string;
200
203
  },
201
204
  cookie: string
202
205
  ) {
@@ -209,7 +212,8 @@ class UsersClient extends Client {
209
212
  email?: string;
210
213
  phone?: string;
211
214
  role?: string;
212
- userName?: string;
215
+ login?: string;
216
+ transactionalEmail?: string;
213
217
  }
214
218
  >(
215
219
  `units/${orgUnitId}/users/${userId}`,
@@ -253,7 +253,7 @@ export const CreateUserDrawer = ({
253
253
  />
254
254
 
255
255
  <InputText
256
- label="Email"
256
+ label="E-mail"
257
257
  value={email}
258
258
  wrapperProps={{ style: { marginTop: 16, marginBottom: 16 } }}
259
259
  hasError={isTouched && emailInvalid}
@@ -264,7 +264,7 @@ export const CreateUserDrawer = ({
264
264
  <ErrorMessage
265
265
  show={isTouched && emailInvalid}
266
266
  message={
267
- !email.trim() ? "Email is required" : "Email is invalid"
267
+ !email.trim() ? "E-mail is required" : "E-mail is invalid"
268
268
  }
269
269
  />
270
270