@vtex/faststore-plugin-buyer-portal 1.3.46 → 1.3.47

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 (52) hide show
  1. package/CHANGELOG.md +8 -1
  2. package/package.json +1 -1
  3. package/public/buyer-portal-icons.svg +35 -13
  4. package/src/features/org-units/clients/OrgUnitClient.ts +17 -0
  5. package/src/features/org-units/components/AddAllToOrgUnitDropdown/AddAllToOrgUnitDropdown.tsx +2 -2
  6. package/src/features/org-units/components/AuthSetupDrawer/AuthSetupDrawer.tsx +346 -0
  7. package/src/features/org-units/components/AuthSetupDrawer/auth-setup-drawer.scss +138 -0
  8. package/src/features/org-units/components/AuthSetupDrawer/index.ts +1 -0
  9. package/src/features/org-units/components/OrgUnitDetailsDropdownMenu/OrgUnitDetailsDropdownMenu.tsx +80 -0
  10. package/src/features/org-units/components/OrgUnitDetailsDropdownMenu/index.ts +4 -0
  11. package/src/features/org-units/components/OrgUnitsDropdownMenu/OrgUnitsDropdownMenu.tsx +2 -2
  12. package/src/features/org-units/components/index.ts +8 -0
  13. package/src/features/org-units/hooks/index.ts +2 -0
  14. package/src/features/org-units/hooks/useGetOrgUnitSettings.ts +20 -0
  15. package/src/features/org-units/hooks/useUpdateOrgUnitSettings.ts +27 -0
  16. package/src/features/org-units/layouts/OrgUnitDetailsLayout/OrgUnitDetailsLayout.tsx +22 -1
  17. package/src/features/org-units/layouts/OrgUnitDetailsLayout/org-units-details.scss +1 -0
  18. package/src/features/org-units/services/get-org-unit-settings.service.ts +13 -0
  19. package/src/features/org-units/services/index.ts +8 -0
  20. package/src/features/org-units/services/update-org-unit-settings.service.ts +17 -0
  21. package/src/features/org-units/types/OrgUnitSettings.ts +25 -0
  22. package/src/features/org-units/types/index.ts +2 -0
  23. package/src/features/shared/components/BuyerPortalProvider/BuyerPortalProvider.tsx +5 -0
  24. package/src/features/shared/components/Toast/Toast.tsx +43 -2
  25. package/src/features/shared/components/Toast/toast.scss +23 -5
  26. package/src/features/shared/components/index.ts +1 -0
  27. package/src/features/shared/layouts/LoadingTabsLayout/LoadingTabsLayout.tsx +13 -0
  28. package/src/features/shared/utils/constants.ts +2 -2
  29. package/src/features/shared/utils/withBuyerPortal.tsx +4 -1
  30. package/src/features/users/clients/UsersClient.ts +105 -4
  31. package/src/features/users/components/CreateUserDrawer/CreateUserDrawer.tsx +1 -1
  32. package/src/features/users/components/CreateUserDrawerSelector/CreateUserDrawerSelector.tsx +20 -0
  33. package/src/features/users/components/CreateUserDrawerWithUsername/CreateUserDrawerWithUsername.tsx +696 -0
  34. package/src/features/users/components/CreateUserDrawerWithUsername/create-user-drawer-with-username.scss +116 -0
  35. package/src/features/users/components/UserDropdownMenu/user-dropdown-menu.scss +1 -0
  36. package/src/features/users/components/UsersCard/UsersCard.tsx +2 -2
  37. package/src/features/users/components/index.ts +5 -0
  38. package/src/features/users/hooks/index.ts +2 -0
  39. package/src/features/users/hooks/useAddUserToOrgUnit.ts +12 -5
  40. package/src/features/users/hooks/useResetPassword.ts +39 -0
  41. package/src/features/users/hooks/useValidateUsername.ts +38 -0
  42. package/src/features/users/layouts/UserDetailsLayout/UserDetailsLayout.tsx +10 -0
  43. package/src/features/users/layouts/UsersLayout/UsersLayout.tsx +55 -10
  44. package/src/features/users/layouts/UsersLayout/users-layout.scss +19 -0
  45. package/src/features/users/services/add-user-to-org-unit.service.ts +8 -6
  46. package/src/features/users/services/get-users-by-org-unit-id.service.ts +1 -0
  47. package/src/features/users/services/index.ts +10 -0
  48. package/src/features/users/services/reset-password.service.ts +24 -0
  49. package/src/features/users/services/validate-username.service.ts +25 -0
  50. package/src/features/users/types/UserData.ts +1 -0
  51. package/src/features/users/types/UserDataService.ts +1 -0
  52. package/src/pages/org-unit-details.tsx +20 -2
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.47] - 2025-12-19
11
+
12
+ - Alternative Login Keys:
13
+ - Add auth setup drawer
14
+ - Update AddUserDrawer to support username
15
+
10
16
  ## [1.3.46] - 2025-12-19
11
17
 
12
18
  ### Fixed
@@ -400,7 +406,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
400
406
  - Add CHANGELOG file
401
407
  - Add README file
402
408
 
403
- [unreleased]: https://github.com/vtex/faststore-plugin-buyer-portal/compare/v1.3.46...HEAD
409
+ [unreleased]: https://github.com/vtex/faststore-plugin-buyer-portal/compare/v1.3.47...HEAD
404
410
  [1.2.3]: https://github.com/vtex/faststore-plugin-buyer-portal/compare/v1.2.2...1.2.3
405
411
  [1.2.3]: https://github.com/vtex/faststore-plugin-buyer-portal/releases/tag/1.2.3
406
412
  [1.2.4]: https://github.com/vtex/faststore-plugin-buyer-portal/releases/tag/1.2.4
@@ -450,6 +456,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
450
456
  [1.3.36]: https://github.com/vtex/faststore-plugin-buyer-portal/compare/v1.3.35...v1.3.36
451
457
  [1.3.35]: https://github.com/vtex/faststore-plugin-buyer-portal/releases/tag/1.3.35
452
458
 
459
+ [1.3.47]: https://github.com/vtex/faststore-plugin-buyer-portal/compare/v1.3.46...v1.3.47
453
460
  [1.3.46]: https://github.com/vtex/faststore-plugin-buyer-portal/compare/v1.3.45...v1.3.46
454
461
  [1.3.45]: https://github.com/vtex/faststore-plugin-buyer-portal/compare/v1.3.44...v1.3.45
455
462
  [1.3.44]: https://github.com/vtex/faststore-plugin-buyer-portal/compare/v1.3.43...v1.3.44
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vtex/faststore-plugin-buyer-portal",
3
- "version": "1.3.46",
3
+ "version": "1.3.47",
4
4
  "description": "A plugin for faststore with buyer portal",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -538,26 +538,48 @@
538
538
  />
539
539
  </symbol>
540
540
 
541
- <symbol id="CircleQuestionMark" viewBox="0 0 256 256" fill="none" xmlns="http://www.w3.org/2000/svg">
541
+ <symbol id="CircleQuestionMark" viewBox="0 0 256 256" fill="none"
542
+ xmlns="http://www.w3.org/2000/svg">
542
543
  <path
543
544
  d="M140,180a12,12,0,1,1-12-12A12,12,0,0,1,140,180ZM128,72c-22.06,0-40,16.15-40,36v4a8,8,0,0,0,16,0v-4c0-11,10.77-20,24-20s24,9,24,20-10.77,20-24,20a8,8,0,0,0-8,8v8a8,8,0,0,0,16,0v-.72c18.24-3.35,32-17.9,32-35.28C168,88.15,150.06,72,128,72Zm104,56A104,104,0,1,1,128,24,104.11,104.11,0,0,1,232,128Zm-16,0a88,88,0,1,0-88,88A88.1,88.1,0,0,0,216,128Z"
544
- fill="currentColor"/>
545
+ fill="currentColor" />
545
546
  </symbol>
546
547
 
547
- <symbol id="OpenNewTab" width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
548
+ <symbol id="OpenNewTab" width="20" height="20" viewBox="0 0 20 20" fill="none"
549
+ xmlns="http://www.w3.org/2000/svg">
548
550
  <g clip-path="url(#clip0_401_516)">
549
- <mask id="mask0_401_516" style="mask-type:alpha" maskUnits="userSpaceOnUse" x="0" y="0" width="20" height="20">
550
- <rect width="20" height="20" fill="#D9D9D9"/>
551
- </mask>
552
- <g mask="url(#mask0_401_516)">
553
- <path d="M4.16667 17.5C3.70833 17.5 3.31597 17.3368 2.98958 17.0104C2.66319 16.684 2.5 16.2917 2.5 15.8333V4.16667C2.5 3.70833 2.66319 3.31597 2.98958 2.98958C3.31597 2.66319 3.70833 2.5 4.16667 2.5H10V4.16667H4.16667V15.8333H15.8333V10H17.5V15.8333C17.5 16.2917 17.3368 16.684 17.0104 17.0104C16.684 17.3368 16.2917 17.5 15.8333 17.5H4.16667ZM8.08333 13.0833L6.91667 11.9167L14.6667 4.16667H11.6667V2.5H17.5V8.33333H15.8333V5.33333L8.08333 13.0833Z" fill="#1F1F1F"/>
554
- </g>
551
+ <mask id="mask0_401_516" style="mask-type:alpha" maskUnits="userSpaceOnUse" x="0" y="0"
552
+ width="20" height="20">
553
+ <rect width="20" height="20" fill="#D9D9D9" />
554
+ </mask>
555
+ <g mask="url(#mask0_401_516)">
556
+ <path
557
+ d="M4.16667 17.5C3.70833 17.5 3.31597 17.3368 2.98958 17.0104C2.66319 16.684 2.5 16.2917 2.5 15.8333V4.16667C2.5 3.70833 2.66319 3.31597 2.98958 2.98958C3.31597 2.66319 3.70833 2.5 4.16667 2.5H10V4.16667H4.16667V15.8333H15.8333V10H17.5V15.8333C17.5 16.2917 17.3368 16.684 17.0104 17.0104C16.684 17.3368 16.2917 17.5 15.8333 17.5H4.16667ZM8.08333 13.0833L6.91667 11.9167L14.6667 4.16667H11.6667V2.5H17.5V8.33333H15.8333V5.33333L8.08333 13.0833Z"
558
+ fill="#1F1F1F" />
559
+ </g>
555
560
  </g>
556
561
  <defs>
557
- <clipPath id="clip0_401_516">
558
- <rect width="20" height="20" fill="white"/>
559
- </clipPath>
562
+ <clipPath id="clip0_401_516">
563
+ <rect width="20" height="20" fill="white" />
564
+ </clipPath>
560
565
  </defs>
561
566
  </symbol>
562
- </svg>
563
567
 
568
+ <symbol id="Refresh" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
569
+ <path
570
+ d="M8 16C5.76667 16 3.875 15.225 2.325 13.675C0.775 12.125 0 10.2333 0 8C0 5.76667 0.775 3.875 2.325 2.325C3.875 0.775 5.76667 0 8 0C9.15 0 10.25 0.2375 11.3 0.7125C12.35 1.1875 13.25 1.86667 14 2.75V0H16V7H9V5H13.2C12.6667 4.06667 11.9375 3.33333 11.0125 2.8C10.0875 2.26667 9.08333 2 8 2C6.33333 2 4.91667 2.58333 3.75 3.75C2.58333 4.91667 2 6.33333 2 8C2 9.66667 2.58333 11.0833 3.75 12.25C4.91667 13.4167 6.33333 14 8 14C9.28333 14 10.4417 13.6333 11.475 12.9C12.5083 12.1667 13.2333 11.2 13.65 10H15.75C15.2833 11.7667 14.3333 13.2083 12.9 14.325C11.4667 15.4417 9.83333 16 8 16Z"
571
+ fill="currentColor" />
572
+ </symbol>
573
+
574
+ <symbol id="Copy" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
575
+ <path
576
+ d="M7.5 14.9998C7.04167 14.9998 6.64931 14.8366 6.32292 14.5103C5.99653 14.1839 5.83333 13.7915 5.83333 13.3332V3.33317C5.83333 2.87484 5.99653 2.48248 6.32292 2.15609C6.64931 1.8297 7.04167 1.6665 7.5 1.6665H15C15.4583 1.6665 15.8507 1.8297 16.1771 2.15609C16.5035 2.48248 16.6667 2.87484 16.6667 3.33317V13.3332C16.6667 13.7915 16.5035 14.1839 16.1771 14.5103C15.8507 14.8366 15.4583 14.9998 15 14.9998H7.5ZM7.5 13.3332H15V3.33317H7.5V13.3332ZM4.16667 18.3332C3.70833 18.3332 3.31597 18.17 2.98958 17.8436C2.66319 17.5172 2.5 17.1248 2.5 16.6665V4.99984H4.16667V16.6665H13.3333V18.3332H4.16667Z"
577
+ fill="currentColor" />
578
+ </symbol>
579
+
580
+ <symbol id="2FAEnabled" viewBox="0 0 13 16" fill="none" xmlns="http://www.w3.org/2000/svg">
581
+ <path
582
+ d="M6.5 16C4.625 15.5417 3.07292 14.4803 1.84375 12.8158C0.614583 11.1513 0 9.30292 0 7.27083V2.5L6.5 0L13 2.5V7.27083C13 9.30292 12.3854 11.1513 11.1562 12.8158C9.92708 14.4803 8.375 15.5417 6.5 16ZM4.5 10.5H8.5C8.64167 10.5 8.76042 10.4521 8.85625 10.3563C8.95208 10.2604 9 10.1417 9 10V7C9 6.85833 8.95208 6.73958 8.85625 6.64375C8.76042 6.54792 8.64167 6.5 8.5 6.5H8V6C8 5.5875 7.85271 5.23438 7.55812 4.94063C7.26354 4.64688 6.90938 4.5 6.49563 4.5C6.08188 4.5 5.72917 4.64688 5.4375 4.94063C5.14583 5.23438 5 5.5875 5 6V6.5H4.5C4.35833 6.5 4.23958 6.54792 4.14375 6.64375C4.04792 6.73958 4 6.85833 4 7V10C4 10.1417 4.04792 10.2604 4.14375 10.3563C4.23958 10.4521 4.35833 10.5 4.5 10.5ZM5.75 6.5V6C5.75 5.7875 5.82146 5.60938 5.96438 5.46562C6.10729 5.32187 6.28438 5.25 6.49563 5.25C6.70688 5.25 6.88542 5.32187 7.03125 5.46562C7.17708 5.60938 7.25 5.7875 7.25 6V6.5H5.75Z"
583
+ fill="#157BF4" />
584
+ </symbol>
585
+ </svg>
@@ -6,6 +6,7 @@ import type {
6
6
  OrgUnitSummaryData,
7
7
  OrgUnitSearchParams,
8
8
  OrgUnitSearchResponse,
9
+ OrgUnitSettings,
9
10
  } from "../types";
10
11
 
11
12
  export class OrgUnitClient extends Client {
@@ -124,6 +125,22 @@ export class OrgUnitClient extends Client {
124
125
  }
125
126
  );
126
127
  }
128
+
129
+ getOrgUnitSettings(unitId: string, cookie: string) {
130
+ return this.get<OrgUnitSettings>(`units/${unitId}/settings`, {
131
+ headers: {
132
+ Cookie: cookie,
133
+ },
134
+ });
135
+ }
136
+
137
+ updateOrgUnitSettings(unitId: string, data: OrgUnitSettings, cookie: string) {
138
+ return this.patch<null, OrgUnitSettings>(`units/${unitId}/settings`, data, {
139
+ headers: {
140
+ Cookie: cookie,
141
+ },
142
+ });
143
+ }
127
144
  }
128
145
 
129
146
  const orgUnitClient = new OrgUnitClient();
@@ -18,7 +18,7 @@ import {
18
18
  import { useGetRolesOptions } from "../../../roles/hooks";
19
19
  import { BasicDropdownMenu, Icon } from "../../../shared/components";
20
20
  import { useDrawerProps } from "../../../shared/hooks";
21
- import { CreateUserDrawer } from "../../../users/components";
21
+ import { CreateUserDrawerSelector } from "../../../users/components";
22
22
 
23
23
  export type AddAllToOrgUnitDropdownProps = {
24
24
  isSingleContract: boolean;
@@ -223,7 +223,7 @@ export const AddAllToOrgUnitDropdown = ({
223
223
  />
224
224
  )}
225
225
  {isOpenUserDrawer && (
226
- <CreateUserDrawer
226
+ <CreateUserDrawerSelector
227
227
  orgUnit={{ id: unitId, name: unitName }}
228
228
  {...userDrawerProps}
229
229
  isOpen={isOpenUserDrawer}
@@ -0,0 +1,346 @@
1
+ import { useState } from "react";
2
+
3
+ import { useRouter } from "next/router";
4
+
5
+ import {
6
+ Checkbox,
7
+ RadioGroup,
8
+ RadioOption,
9
+ Tooltip,
10
+ useUI,
11
+ } from "@faststore/ui";
12
+
13
+ import {
14
+ BasicDrawer,
15
+ type BasicDrawerProps,
16
+ ErrorMessage,
17
+ Icon,
18
+ } from "../../../shared/components";
19
+ import { useAnalytics } from "../../../shared/hooks";
20
+ import { useUpdateOrgUnitSettings } from "../../hooks";
21
+ import {
22
+ AuthenticationMethod,
23
+ type Identifier,
24
+ type OrgUnitSettings,
25
+ } from "../../types";
26
+
27
+ export type AuthSetupDrawerProps = Omit<BasicDrawerProps, "children"> & {
28
+ id: string;
29
+ name: string;
30
+ settings: OrgUnitSettings;
31
+ onSuccess?: () => void;
32
+ };
33
+
34
+ const IDENTIFIERS: Identifier[] = [
35
+ {
36
+ id: "userName",
37
+ name: "Username",
38
+ disabled: true,
39
+ defaultChecked: true,
40
+ },
41
+ {
42
+ id: "email",
43
+ name: "Email",
44
+ disabled: false,
45
+ defaultChecked: false,
46
+ },
47
+ {
48
+ id: "phone",
49
+ name: "Phone",
50
+ disabled: false,
51
+ defaultChecked: false,
52
+ },
53
+ ];
54
+
55
+ type AuthMethod = "password" | "ping-federate";
56
+
57
+ const getInitialIdentifiers = (settings: OrgUnitSettings): string[] => {
58
+ const identifiers: string[] = [];
59
+ if (settings.userIdentification.userName) identifiers.push("userName");
60
+ if (settings.userIdentification.email) identifiers.push("email");
61
+ if (settings.userIdentification.phone) identifiers.push("phone");
62
+ return identifiers;
63
+ };
64
+
65
+ const getInitialAuthMethod = (settings: OrgUnitSettings): AuthMethod => {
66
+ return settings.authenticationMethods.method === AuthenticationMethod.PASSWORD
67
+ ? "password"
68
+ : "ping-federate";
69
+ };
70
+
71
+ export const AuthSetupDrawer = ({
72
+ close,
73
+ id,
74
+ name,
75
+ settings,
76
+ onSuccess,
77
+ ...props
78
+ }: AuthSetupDrawerProps) => {
79
+ const router = useRouter();
80
+ const { pushToast } = useUI();
81
+ const { trackEntityEdited, trackEntityEditError } = useAnalytics({
82
+ entityType: "org_unit_auth",
83
+ entityId: id,
84
+ defaultTimerName: "org_unit_auth_setup",
85
+ shouldTrackDefaultTimer: true,
86
+ });
87
+
88
+ const [selectedIdentifiers, setSelectedIdentifiers] = useState<string[]>(() =>
89
+ getInitialIdentifiers(settings)
90
+ );
91
+ const [authMethod, setAuthMethod] = useState<AuthMethod>(() =>
92
+ getInitialAuthMethod(settings)
93
+ );
94
+ const [is2faEnabled, setIs2faEnabled] = useState(
95
+ () => settings["2FA"].verificationCode
96
+ );
97
+ const [isTouched, setIsTouched] = useState(false);
98
+
99
+ const handleSuccess = () => {
100
+ trackEntityEdited("auth_setup_configured", {
101
+ org_unit_id: id,
102
+ org_unit_name: name,
103
+ auth_method: authMethod,
104
+ identifiers: selectedIdentifiers,
105
+ two_factor_enabled: is2faEnabled,
106
+ });
107
+
108
+ pushToast({
109
+ message: "Authentication settings saved successfully",
110
+ status: "INFO",
111
+ });
112
+
113
+ close();
114
+ if (onSuccess) {
115
+ onSuccess();
116
+ } else {
117
+ router.reload();
118
+ }
119
+ };
120
+
121
+ const { updateOrgUnitSettings, isUpdateOrgUnitSettingsLoading } =
122
+ useUpdateOrgUnitSettings({
123
+ onSuccess: handleSuccess,
124
+ onError: (error) => {
125
+ trackEntityEditError(
126
+ "auth_setup_error",
127
+ "org_unit_auth",
128
+ id,
129
+ error,
130
+ {}
131
+ );
132
+
133
+ pushToast({
134
+ message: "An error occurred while updating authentication settings",
135
+ status: "ERROR",
136
+ });
137
+ },
138
+ });
139
+
140
+ const handleIdentifierChange = (identifierId: string) => {
141
+ if (identifierId === "userName") return; // Username is always required
142
+
143
+ setSelectedIdentifiers((prev) =>
144
+ prev.includes(identifierId)
145
+ ? prev.filter((id) => id !== identifierId)
146
+ : [...prev, identifierId]
147
+ );
148
+ };
149
+
150
+ const handleConfirmClick = () => {
151
+ setIsTouched(true);
152
+
153
+ if (!selectedIdentifiers.includes("userName")) {
154
+ return;
155
+ }
156
+
157
+ const updatedSettings: OrgUnitSettings = {
158
+ userIdentification: {
159
+ userName: selectedIdentifiers.includes("userName"),
160
+ email: selectedIdentifiers.includes("email"),
161
+ phone: selectedIdentifiers.includes("phone"),
162
+ },
163
+ authenticationMethods: {
164
+ method:
165
+ authMethod === "password"
166
+ ? AuthenticationMethod.PASSWORD
167
+ : AuthenticationMethod.SSO,
168
+ },
169
+ "2FA": {
170
+ verificationCode: is2faEnabled,
171
+ },
172
+ };
173
+
174
+ updateOrgUnitSettings({
175
+ unitId: id,
176
+ data: updatedSettings,
177
+ });
178
+ };
179
+
180
+ const isConfirmButtonEnabled =
181
+ !isUpdateOrgUnitSettingsLoading && selectedIdentifiers.includes("userName");
182
+
183
+ return (
184
+ <BasicDrawer data-fs-bp-auth-setup-drawer close={close} {...props}>
185
+ <BasicDrawer.Heading title="Authentication" onClose={close} />
186
+ <BasicDrawer.Body>
187
+ <section data-fs-bp-auth-setup-section>
188
+ <div data-fs-bp-auth-setup-section-header>
189
+ <h2 data-fs-bp-auth-setup-section-title>User identification</h2>
190
+ </div>
191
+ <p data-fs-bp-auth-setup-section-description>
192
+ Select the identifiers allowed for sign-in
193
+ </p>
194
+
195
+ <div data-fs-bp-auth-setup-identifiers>
196
+ {IDENTIFIERS.map((identifier) => (
197
+ <div data-fs-bp-auth-setup-identifier-group-item>
198
+ <label
199
+ key={identifier.id}
200
+ data-fs-bp-auth-setup-identifier
201
+ data-disabled={identifier.disabled}
202
+ >
203
+ <Checkbox
204
+ id={identifier.id}
205
+ checked={selectedIdentifiers.includes(identifier.id)}
206
+ disabled={identifier.disabled}
207
+ onChange={() => handleIdentifierChange(identifier.id)}
208
+ />
209
+ <span data-fs-bp-auth-setup-identifier-label>
210
+ {identifier.name}
211
+ </span>
212
+ </label>
213
+ <Tooltip
214
+ content="Enables login through external identity providers, such as Google, Microsoft, or other supported IdPs"
215
+ placement="left-center"
216
+ >
217
+ <Icon
218
+ name="InfoFilled"
219
+ width={16}
220
+ height={16}
221
+ data-fs-bp-auth-setup-info-icon
222
+ />
223
+ </Tooltip>
224
+ </div>
225
+ ))}
226
+ </div>
227
+
228
+ <ErrorMessage
229
+ show={isTouched && !selectedIdentifiers.includes("userName")}
230
+ message="Username is required"
231
+ />
232
+ </section>
233
+
234
+ <section data-fs-bp-auth-setup-section>
235
+ <div data-fs-bp-auth-setup-section-header>
236
+ <h2 data-fs-bp-auth-setup-section-title>Authentication methods</h2>
237
+ </div>
238
+ <p data-fs-bp-auth-setup-section-description>
239
+ Control which authentication methods are available
240
+ </p>
241
+
242
+ <div data-fs-bp-auth-setup-radio-group role="radiogroup">
243
+ <RadioGroup
244
+ name="authMethod"
245
+ selectedValue={authMethod}
246
+ onChange={(e) => {
247
+ setAuthMethod(e.target.value as AuthMethod);
248
+ }}
249
+ >
250
+ <div data-fs-bp-auth-setup-radio-group-item>
251
+ <RadioOption
252
+ value="password"
253
+ label="Password"
254
+ name="authMethod"
255
+ >
256
+ Password
257
+ </RadioOption>
258
+ <Tooltip
259
+ content="Enables login through external identity providers, such as Google, Microsoft, or other supported IdPs"
260
+ placement="left-center"
261
+ >
262
+ <Icon
263
+ name="InfoFilled"
264
+ width={20}
265
+ height={20}
266
+ data-fs-bp-auth-setup-info-icon
267
+ />
268
+ </Tooltip>
269
+ </div>
270
+
271
+ <div data-fs-bp-auth-setup-radio-group-item>
272
+ <RadioOption
273
+ value="ping-federate"
274
+ label="Ping federate (SSO)"
275
+ name="authMethod"
276
+ >
277
+ Ping federate (SSO)
278
+ </RadioOption>
279
+ <Tooltip
280
+ content="Enables login through external identity providers, such as Google, Microsoft, or other supported IdPs"
281
+ placement="left-center"
282
+ >
283
+ <Icon
284
+ name="InfoFilled"
285
+ width={20}
286
+ height={20}
287
+ data-fs-bp-auth-setup-info-icon
288
+ />
289
+ </Tooltip>
290
+ </div>
291
+ </RadioGroup>
292
+ </div>
293
+ </section>
294
+
295
+ <section data-fs-bp-auth-setup-section>
296
+ <div data-fs-bp-auth-setup-section-header>
297
+ <h2 data-fs-bp-auth-setup-section-title>
298
+ Two-factor authentication (2FA)
299
+ </h2>
300
+ </div>
301
+ <p data-fs-bp-auth-setup-section-description>
302
+ Require an additional factor for higher security
303
+ </p>
304
+
305
+ <div data-fs-bp-auth-setup-checkbox-group-item>
306
+ <label data-fs-bp-auth-setup-checkbox-label>
307
+ <Checkbox
308
+ id="2fa"
309
+ checked={is2faEnabled}
310
+ onChange={() => setIs2faEnabled(!is2faEnabled)}
311
+ />
312
+ <span data-fs-bp-auth-setup-checkbox-label-text>
313
+ Verification code
314
+ </span>
315
+ </label>
316
+ <Tooltip
317
+ content="Requires an additional factor for higher security"
318
+ placement="left-center"
319
+ >
320
+ <Icon
321
+ name="InfoFilled"
322
+ width={20}
323
+ height={20}
324
+ data-fs-bp-auth-setup-info-icon
325
+ />
326
+ </Tooltip>
327
+ </div>
328
+ </section>
329
+ </BasicDrawer.Body>
330
+
331
+ <BasicDrawer.Footer>
332
+ <BasicDrawer.Button variant="ghost" onClick={close}>
333
+ Cancel
334
+ </BasicDrawer.Button>
335
+ <BasicDrawer.Button
336
+ variant="confirm"
337
+ disabled={!isConfirmButtonEnabled}
338
+ onClick={handleConfirmClick}
339
+ isLoading={isUpdateOrgUnitSettingsLoading}
340
+ >
341
+ Save
342
+ </BasicDrawer.Button>
343
+ </BasicDrawer.Footer>
344
+ </BasicDrawer>
345
+ );
346
+ };
@@ -0,0 +1,138 @@
1
+ @import "@faststore/ui/src/components/molecules/Tooltip/styles.scss";
2
+
3
+ [data-fs-bp-auth-setup-drawer] {
4
+ @import "@faststore/ui/src/components/atoms/Checkbox/styles.scss";
5
+ @import "@faststore/ui/src/components/atoms/Radio/styles.scss";
6
+
7
+ [data-fs-checkbox]:disabled {
8
+ border-color: var(--fs-bp-color-neutral-3);
9
+ background-color: var(--fs-bp-color-neutral-1);
10
+
11
+ &::before {
12
+ border-color: var(--fs-bp-color-neutral-5);
13
+ }
14
+ }
15
+
16
+ [data-fs-bp-auth-setup-section] {
17
+ padding: var(--fs-spacing-3) 0;
18
+
19
+ &:first-child {
20
+ padding-top: 0;
21
+ }
22
+
23
+ &:last-child {
24
+ border-bottom: none;
25
+ }
26
+ }
27
+
28
+ [data-fs-bp-auth-setup-section-header] {
29
+ display: flex;
30
+ align-items: center;
31
+ gap: var(--fs-spacing-1);
32
+ margin-bottom: var(--fs-spacing-1);
33
+ }
34
+
35
+ [data-fs-bp-auth-setup-section-title] {
36
+ font-size: var(--fs-text-size-2);
37
+ font-weight: var(--fs-bp-weight-semibold);
38
+ font-style: normal;
39
+ line-height: 120%;
40
+ letter-spacing: -0.02em;
41
+ vertical-align: middle;
42
+ color: var(--fs-bp-color-neutral-9);
43
+ margin: 0;
44
+ }
45
+
46
+ [data-fs-bp-auth-setup-section-description] {
47
+ font-size: var(--fs-text-size-0);
48
+ font-weight: 400;
49
+ font-style: normal;
50
+ line-height: 120%;
51
+ letter-spacing: 0;
52
+ vertical-align: middle;
53
+ color: var(--fs-bp-color-neutral-6);
54
+ margin: 0 0 var(--fs-spacing-3) 0;
55
+ }
56
+
57
+ [data-fs-bp-auth-setup-identifiers] {
58
+ display: flex;
59
+ flex-direction: column;
60
+ margin-top: var(--fs-spacing-3);
61
+ }
62
+
63
+ [data-fs-bp-auth-setup-identifier] {
64
+ display: flex;
65
+ align-items: center;
66
+ gap: var(--fs-spacing-2);
67
+ cursor: pointer;
68
+ color: var(--fs-bp-color-neutral-9);
69
+ font-size: var(--fs-text-size-1);
70
+ padding: var(--fs-spacing-3) 0;
71
+
72
+ &[data-disabled="true"] {
73
+ color: var(--fs-bp-color-neutral-7)
74
+ }
75
+ }
76
+
77
+ // Radio Group
78
+ [data-fs-bp-auth-setup-radio-group] {
79
+ display: flex;
80
+ margin-top: var(--fs-spacing-3);
81
+ flex-wrap: wrap;
82
+ flex-direction: column;
83
+
84
+ label {
85
+ display: flex;
86
+ flex-direction: row;
87
+ gap: var(--fs-spacing-2);
88
+ cursor: pointer;
89
+ padding: var(--fs-spacing-3) 0;
90
+ color: var(--fs-bp-color-neutral-9);
91
+ font-size: var(--fs-text-size-1);
92
+
93
+ &:last-child {
94
+ border-top: 1px solid var(--fs-bp-color-neutral-1);
95
+ }
96
+ }
97
+ }
98
+
99
+ // Checkbox Label
100
+ [data-fs-bp-auth-setup-checkbox-label] {
101
+ display: flex;
102
+ align-items: center;
103
+ gap: var(--fs-spacing-2);
104
+ cursor: pointer;
105
+ padding: var(--fs-spacing-2) 0;
106
+ color: var(--fs-bp-color-neutral-9);
107
+
108
+ span {
109
+ font-size: var(--fs-text-size-1);
110
+ color: var(--fs-bp-color-neutral-9);
111
+ user-select: none;
112
+ }
113
+ }
114
+
115
+ [data-fs-bp-auth-setup-radio-group-item],
116
+ [data-fs-bp-auth-setup-checkbox-group-item],
117
+ [data-fs-bp-auth-setup-identifier-group-item] {
118
+ display: flex;
119
+ flex-direction: row;
120
+ align-items: center;
121
+ justify-content: space-between;
122
+ border-bottom: 1px solid var(--fs-bp-color-neutral-1);
123
+ &:last-child {
124
+ border-bottom: none;
125
+ }
126
+ }
127
+
128
+ [data-fs-bp-auth-setup-info-icon] {
129
+ color: var(--fs-bp-color-neutral-4);
130
+ }
131
+
132
+ // Tooltip Styles
133
+ [data-fs-tooltip] {
134
+ [data-fs-tooltip-wrapper] {
135
+ z-index: 9999;
136
+ }
137
+ }
138
+ }
@@ -0,0 +1 @@
1
+ export { AuthSetupDrawer, type AuthSetupDrawerProps } from "./AuthSetupDrawer";