@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.
- package/CHANGELOG.md +8 -1
- package/package.json +1 -1
- package/public/buyer-portal-icons.svg +35 -13
- package/src/features/org-units/clients/OrgUnitClient.ts +17 -0
- package/src/features/org-units/components/AddAllToOrgUnitDropdown/AddAllToOrgUnitDropdown.tsx +2 -2
- package/src/features/org-units/components/AuthSetupDrawer/AuthSetupDrawer.tsx +346 -0
- package/src/features/org-units/components/AuthSetupDrawer/auth-setup-drawer.scss +138 -0
- package/src/features/org-units/components/AuthSetupDrawer/index.ts +1 -0
- package/src/features/org-units/components/OrgUnitDetailsDropdownMenu/OrgUnitDetailsDropdownMenu.tsx +80 -0
- package/src/features/org-units/components/OrgUnitDetailsDropdownMenu/index.ts +4 -0
- package/src/features/org-units/components/OrgUnitsDropdownMenu/OrgUnitsDropdownMenu.tsx +2 -2
- package/src/features/org-units/components/index.ts +8 -0
- package/src/features/org-units/hooks/index.ts +2 -0
- package/src/features/org-units/hooks/useGetOrgUnitSettings.ts +20 -0
- package/src/features/org-units/hooks/useUpdateOrgUnitSettings.ts +27 -0
- package/src/features/org-units/layouts/OrgUnitDetailsLayout/OrgUnitDetailsLayout.tsx +22 -1
- package/src/features/org-units/layouts/OrgUnitDetailsLayout/org-units-details.scss +1 -0
- package/src/features/org-units/services/get-org-unit-settings.service.ts +13 -0
- package/src/features/org-units/services/index.ts +8 -0
- package/src/features/org-units/services/update-org-unit-settings.service.ts +17 -0
- package/src/features/org-units/types/OrgUnitSettings.ts +25 -0
- package/src/features/org-units/types/index.ts +2 -0
- package/src/features/shared/components/BuyerPortalProvider/BuyerPortalProvider.tsx +5 -0
- package/src/features/shared/components/Toast/Toast.tsx +43 -2
- package/src/features/shared/components/Toast/toast.scss +23 -5
- package/src/features/shared/components/index.ts +1 -0
- package/src/features/shared/layouts/LoadingTabsLayout/LoadingTabsLayout.tsx +13 -0
- package/src/features/shared/utils/constants.ts +2 -2
- package/src/features/shared/utils/withBuyerPortal.tsx +4 -1
- package/src/features/users/clients/UsersClient.ts +105 -4
- package/src/features/users/components/CreateUserDrawer/CreateUserDrawer.tsx +1 -1
- package/src/features/users/components/CreateUserDrawerSelector/CreateUserDrawerSelector.tsx +20 -0
- package/src/features/users/components/CreateUserDrawerWithUsername/CreateUserDrawerWithUsername.tsx +696 -0
- package/src/features/users/components/CreateUserDrawerWithUsername/create-user-drawer-with-username.scss +116 -0
- package/src/features/users/components/UserDropdownMenu/user-dropdown-menu.scss +1 -0
- package/src/features/users/components/UsersCard/UsersCard.tsx +2 -2
- package/src/features/users/components/index.ts +5 -0
- package/src/features/users/hooks/index.ts +2 -0
- package/src/features/users/hooks/useAddUserToOrgUnit.ts +12 -5
- package/src/features/users/hooks/useResetPassword.ts +39 -0
- package/src/features/users/hooks/useValidateUsername.ts +38 -0
- package/src/features/users/layouts/UserDetailsLayout/UserDetailsLayout.tsx +10 -0
- package/src/features/users/layouts/UsersLayout/UsersLayout.tsx +55 -10
- package/src/features/users/layouts/UsersLayout/users-layout.scss +19 -0
- package/src/features/users/services/add-user-to-org-unit.service.ts +8 -6
- package/src/features/users/services/get-users-by-org-unit-id.service.ts +1 -0
- package/src/features/users/services/index.ts +10 -0
- package/src/features/users/services/reset-password.service.ts +24 -0
- package/src/features/users/services/validate-username.service.ts +25 -0
- package/src/features/users/types/UserData.ts +1 -0
- package/src/features/users/types/UserDataService.ts +1 -0
- package/src/pages/org-unit-details.tsx +20 -2
package/src/features/org-units/components/OrgUnitDetailsDropdownMenu/OrgUnitDetailsDropdownMenu.tsx
ADDED
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { DropdownItem } from "@faststore/ui";
|
|
2
|
+
|
|
3
|
+
import { BasicDropdownMenu, Icon } from "../../../shared/components";
|
|
4
|
+
import { useDrawerProps } from "../../../shared/hooks";
|
|
5
|
+
// TODO[2FA]: Uncomment when Authentication settings are ready
|
|
6
|
+
// import { AuthSetupDrawer } from "../AuthSetupDrawer";
|
|
7
|
+
import { UpdateOrgUnitDrawer } from "../UpdateOrgUnitDrawer/UpdateOrgUnitDrawer";
|
|
8
|
+
|
|
9
|
+
// TODO[2FA]: Uncomment when Authentication settings are ready
|
|
10
|
+
// import type { OrgUnitSettings } from "../../types";
|
|
11
|
+
|
|
12
|
+
export type OrgUnitDetailsDropdownMenuProps = {
|
|
13
|
+
id: string;
|
|
14
|
+
name: string;
|
|
15
|
+
// TODO[2FA]: Uncomment when Authentication settings are ready
|
|
16
|
+
// settings: OrgUnitSettings;
|
|
17
|
+
onUpdate?: () => void;
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
export const OrgUnitDetailsDropdownMenu = ({
|
|
21
|
+
id,
|
|
22
|
+
name,
|
|
23
|
+
// TODO[2FA]: Uncomment when Authentication settings are ready
|
|
24
|
+
// settings,
|
|
25
|
+
onUpdate,
|
|
26
|
+
}: OrgUnitDetailsDropdownMenuProps) => {
|
|
27
|
+
const {
|
|
28
|
+
open: openUpdateDrawerProps,
|
|
29
|
+
isOpen: isUpdateDrawerOpen,
|
|
30
|
+
...updateDrawerProps
|
|
31
|
+
} = useDrawerProps();
|
|
32
|
+
|
|
33
|
+
// TODO[2FA]: Uncomment when Authentication settings are ready
|
|
34
|
+
// const {
|
|
35
|
+
// open: openAuthSetupDrawerProps,
|
|
36
|
+
// isOpen: isAuthSetupDrawerOpen,
|
|
37
|
+
// ...authSetupDrawerProps
|
|
38
|
+
// } = useDrawerProps();
|
|
39
|
+
|
|
40
|
+
const sizeProps = { width: 20, height: 20 };
|
|
41
|
+
|
|
42
|
+
return (
|
|
43
|
+
<>
|
|
44
|
+
<BasicDropdownMenu>
|
|
45
|
+
<DropdownItem onClick={openUpdateDrawerProps}>
|
|
46
|
+
<Icon name="FormatSize" {...sizeProps} />
|
|
47
|
+
Rename
|
|
48
|
+
</DropdownItem>
|
|
49
|
+
{/* TODO[2FA]: Uncomment when 2FA settings are ready
|
|
50
|
+
<BasicDropdownMenu.Separator />
|
|
51
|
+
<DropdownItem onClick={openAuthSetupDrawerProps}>
|
|
52
|
+
<Icon name="Settings" {...sizeProps} />
|
|
53
|
+
Authentication
|
|
54
|
+
</DropdownItem>
|
|
55
|
+
*/}
|
|
56
|
+
</BasicDropdownMenu>
|
|
57
|
+
{isUpdateDrawerOpen && (
|
|
58
|
+
<UpdateOrgUnitDrawer
|
|
59
|
+
readonly
|
|
60
|
+
id={id}
|
|
61
|
+
name={name}
|
|
62
|
+
onSuccess={onUpdate}
|
|
63
|
+
{...updateDrawerProps}
|
|
64
|
+
isOpen={isUpdateDrawerOpen}
|
|
65
|
+
/>
|
|
66
|
+
)}
|
|
67
|
+
{/* TODO[2FA]: Uncomment when 2FA settings are ready
|
|
68
|
+
{isAuthSetupDrawerOpen && (
|
|
69
|
+
<AuthSetupDrawer
|
|
70
|
+
id={id}
|
|
71
|
+
name={name}
|
|
72
|
+
settings={settings}
|
|
73
|
+
{...authSetupDrawerProps}
|
|
74
|
+
isOpen={isAuthSetupDrawerOpen}
|
|
75
|
+
/>
|
|
76
|
+
)}
|
|
77
|
+
*/}
|
|
78
|
+
</>
|
|
79
|
+
);
|
|
80
|
+
};
|
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
import { useGetRolesOptions } from "../../../roles/hooks";
|
|
9
9
|
import { BasicDropdownMenu, Icon } from "../../../shared/components";
|
|
10
10
|
import { useDrawerProps } from "../../../shared/hooks";
|
|
11
|
-
import {
|
|
11
|
+
import { CreateUserDrawerSelector } from "../../../users/components";
|
|
12
12
|
|
|
13
13
|
export type OrgUnitsDropdownMenuProps = {
|
|
14
14
|
id: string;
|
|
@@ -114,7 +114,7 @@ export const OrgUnitsDropdownMenu = ({
|
|
|
114
114
|
/>
|
|
115
115
|
)}
|
|
116
116
|
{isCreateUserDrawerOpen && (
|
|
117
|
-
<
|
|
117
|
+
<CreateUserDrawerSelector
|
|
118
118
|
orgUnit={{ id, name }}
|
|
119
119
|
rolesOptions={rolesOptions}
|
|
120
120
|
{...createUserDrawerProps}
|
|
@@ -28,3 +28,11 @@ export {
|
|
|
28
28
|
type OrgUnitDetailsNavbarProps,
|
|
29
29
|
} from "./OrgUnitDetailsNavbar/OrgUnitDetailsNavbar";
|
|
30
30
|
export { OrgUnitBreadcrumb } from "./OrgUnitBreadcrumb/OrgUnitBreadcrumb";
|
|
31
|
+
export {
|
|
32
|
+
AuthSetupDrawer,
|
|
33
|
+
type AuthSetupDrawerProps,
|
|
34
|
+
} from "./AuthSetupDrawer/AuthSetupDrawer";
|
|
35
|
+
export {
|
|
36
|
+
OrgUnitDetailsDropdownMenu,
|
|
37
|
+
type OrgUnitDetailsDropdownMenuProps,
|
|
38
|
+
} from "./OrgUnitDetailsDropdownMenu/OrgUnitDetailsDropdownMenu";
|
|
@@ -2,6 +2,8 @@ export { useCreateNewOrgUnit } from "./useCreateNewOrgUnit";
|
|
|
2
2
|
export { useDeleteOrgUnit } from "./useDeleteOrgUnit";
|
|
3
3
|
export { useOrgUnitStructure } from "./useOrgUnitStructure";
|
|
4
4
|
export { useUpdateOrgUnit } from "./useUpdateOrgUnit";
|
|
5
|
+
export { useUpdateOrgUnitSettings } from "./useUpdateOrgUnitSettings";
|
|
5
6
|
export { useChildrenOrgUnits } from "./useChildrenOrgUnits";
|
|
6
7
|
export { useOrgUnitByUser } from "./useOrgUnitByUser";
|
|
7
8
|
export { useSearchOrgUnits } from "./useSearchOrgUnits";
|
|
9
|
+
export { useGetOrgUnitSettings } from "./useGetOrgUnitSettings";
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { type QueryOptions, useQuery } from "../../shared/hooks";
|
|
2
|
+
import { getOrgUnitSettingsService } from "../services";
|
|
3
|
+
|
|
4
|
+
export const useGetOrgUnitSettings = (
|
|
5
|
+
unitId: string,
|
|
6
|
+
options?: QueryOptions<AwaitedType<typeof getOrgUnitSettingsService>>
|
|
7
|
+
) => {
|
|
8
|
+
const { data, error, isLoading, refetch } = useQuery(
|
|
9
|
+
`api/org-unit-settings/${unitId}`,
|
|
10
|
+
({ cookie }) => getOrgUnitSettingsService({ cookie, unitId }),
|
|
11
|
+
options
|
|
12
|
+
);
|
|
13
|
+
|
|
14
|
+
return {
|
|
15
|
+
settings: data,
|
|
16
|
+
hasSettingsError: error,
|
|
17
|
+
isSettingsLoading: isLoading,
|
|
18
|
+
refetchSettings: refetch,
|
|
19
|
+
};
|
|
20
|
+
};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { type MutationOptions, useMutation } from "../../shared/hooks";
|
|
2
|
+
import {
|
|
3
|
+
updateOrgUnitSettingsService,
|
|
4
|
+
type UpdateOrgUnitSettingsServiceProps,
|
|
5
|
+
} from "../services/update-org-unit-settings.service";
|
|
6
|
+
|
|
7
|
+
export const useUpdateOrgUnitSettings = (
|
|
8
|
+
options?: MutationOptions<AwaitedType<typeof updateOrgUnitSettingsService>>
|
|
9
|
+
) => {
|
|
10
|
+
const { mutate, isLoading, error } = useMutation<
|
|
11
|
+
null,
|
|
12
|
+
Omit<UpdateOrgUnitSettingsServiceProps, "cookie">
|
|
13
|
+
>(
|
|
14
|
+
(variables, clientContext) =>
|
|
15
|
+
updateOrgUnitSettingsService({
|
|
16
|
+
...variables,
|
|
17
|
+
cookie: clientContext.cookie,
|
|
18
|
+
}),
|
|
19
|
+
options
|
|
20
|
+
);
|
|
21
|
+
|
|
22
|
+
return {
|
|
23
|
+
updateOrgUnitSettings: mutate,
|
|
24
|
+
isUpdateOrgUnitSettingsLoading: isLoading,
|
|
25
|
+
hasUpdateOrgUnitSettingsError: error,
|
|
26
|
+
};
|
|
27
|
+
};
|
|
@@ -13,6 +13,7 @@ import {
|
|
|
13
13
|
LetterHighlight,
|
|
14
14
|
VerticalNav,
|
|
15
15
|
} from "../../../shared/components";
|
|
16
|
+
import { BasicDropdownMenuTrigger } from "../../../shared/components/BasicDropdownMenu/BasicDropdownMenuTrigger";
|
|
16
17
|
import { useMediaQuery } from "../../../shared/hooks/useMediaQuery";
|
|
17
18
|
import { GlobalLayout } from "../../../shared/layouts";
|
|
18
19
|
import {
|
|
@@ -25,6 +26,7 @@ import {
|
|
|
25
26
|
AddAllToOrgUnitDropdown,
|
|
26
27
|
OrgUnitBreadcrumb,
|
|
27
28
|
OrgUnitDetailsNavbar,
|
|
29
|
+
OrgUnitDetailsDropdownMenu,
|
|
28
30
|
} from "../../components";
|
|
29
31
|
import { useOrgUnitByUser } from "../../hooks";
|
|
30
32
|
|
|
@@ -43,12 +45,19 @@ export type OrgUnitsDetailsLayoutProps = {
|
|
|
43
45
|
orgUnit: OrgUnitBasicData;
|
|
44
46
|
contracts: ContractData[];
|
|
45
47
|
user: UserData | null;
|
|
48
|
+
// TODO[2FA]: Uncomment when Authentication settings are ready
|
|
49
|
+
// settings: OrgUnitSettings;
|
|
46
50
|
};
|
|
47
51
|
loading?: boolean;
|
|
48
52
|
};
|
|
49
53
|
|
|
50
54
|
export const OrgUnitsDetailsLayout = ({
|
|
51
|
-
data: {
|
|
55
|
+
data: {
|
|
56
|
+
orgUnit,
|
|
57
|
+
contracts,
|
|
58
|
+
user, // TODO[2FA]: Uncomment when Authentication settings are ready
|
|
59
|
+
// settings,
|
|
60
|
+
},
|
|
52
61
|
loading = false,
|
|
53
62
|
}: OrgUnitsDetailsLayoutProps) => {
|
|
54
63
|
const isMobile = useMediaQuery(QUERY_TABLET);
|
|
@@ -104,10 +113,22 @@ export const OrgUnitsDetailsLayout = ({
|
|
|
104
113
|
/>
|
|
105
114
|
)}
|
|
106
115
|
|
|
116
|
+
<Dropdown>
|
|
117
|
+
<BasicDropdownMenuTrigger />
|
|
118
|
+
|
|
119
|
+
<OrgUnitDetailsDropdownMenu
|
|
120
|
+
id={orgUnit?.id}
|
|
121
|
+
name={orgUnit?.name}
|
|
122
|
+
// TODO[2FA]: Uncomment when Authentication settings are ready
|
|
123
|
+
// settings={settings}
|
|
124
|
+
/>
|
|
125
|
+
</Dropdown>
|
|
126
|
+
|
|
107
127
|
<Dropdown>
|
|
108
128
|
<DropdownButton asChild>
|
|
109
129
|
<HeaderInside.Button />
|
|
110
130
|
</DropdownButton>
|
|
131
|
+
|
|
111
132
|
<AddAllToOrgUnitDropdown
|
|
112
133
|
isSingleContract={isSingleContract}
|
|
113
134
|
contractId={contracts[0]?.id}
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
@import "../../../shared/layouts/BaseTabsLayout/about-drawer/about-drawer.scss";
|
|
6
6
|
@import "../../../credit-cards/components/CreateCreditCardDrawer/create-credit-card-drawer.scss";
|
|
7
7
|
@import "../../components/OrgUnitBreadcrumb/org-unit-breadcrumb.scss";
|
|
8
|
+
@import "../../components/AuthSetupDrawer/auth-setup-drawer.scss";
|
|
8
9
|
|
|
9
10
|
[data-fs-org-units-details-section] {
|
|
10
11
|
@import "../../../shared/components/BasicCard/basic-card.scss";
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { orgUnitClient } from "../clients/OrgUnitClient";
|
|
2
|
+
|
|
3
|
+
export type GetOrgUnitSettingsServiceProps = {
|
|
4
|
+
unitId: string;
|
|
5
|
+
cookie: string;
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
export const getOrgUnitSettingsService = async ({
|
|
9
|
+
unitId,
|
|
10
|
+
cookie,
|
|
11
|
+
}: GetOrgUnitSettingsServiceProps) => {
|
|
12
|
+
return orgUnitClient.getOrgUnitSettings(unitId, cookie);
|
|
13
|
+
};
|
|
@@ -19,3 +19,11 @@ export {
|
|
|
19
19
|
} from "./update-org-unit.service";
|
|
20
20
|
export { getOrgUnitByUserIdService } from "./get-org-unit-by-user-id.service";
|
|
21
21
|
export { searchOrgUnitsByNameService } from "./search-org-units-by-name.service";
|
|
22
|
+
export {
|
|
23
|
+
type GetOrgUnitSettingsServiceProps,
|
|
24
|
+
getOrgUnitSettingsService,
|
|
25
|
+
} from "./get-org-unit-settings.service";
|
|
26
|
+
export {
|
|
27
|
+
type UpdateOrgUnitSettingsServiceProps,
|
|
28
|
+
updateOrgUnitSettingsService,
|
|
29
|
+
} from "./update-org-unit-settings.service";
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { orgUnitClient } from "../clients/OrgUnitClient";
|
|
2
|
+
|
|
3
|
+
import type { OrgUnitSettings } from "../types";
|
|
4
|
+
|
|
5
|
+
export type UpdateOrgUnitSettingsServiceProps = {
|
|
6
|
+
unitId: string;
|
|
7
|
+
data: OrgUnitSettings;
|
|
8
|
+
cookie: string;
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
export const updateOrgUnitSettingsService = async ({
|
|
12
|
+
unitId,
|
|
13
|
+
data,
|
|
14
|
+
cookie,
|
|
15
|
+
}: UpdateOrgUnitSettingsServiceProps) => {
|
|
16
|
+
return orgUnitClient.updateOrgUnitSettings(unitId, data, cookie);
|
|
17
|
+
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export enum AuthenticationMethod {
|
|
2
|
+
PASSWORD = "PASSWORD",
|
|
3
|
+
SSO = "SSO",
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
export type OrgUnitSettings = {
|
|
7
|
+
userIdentification: {
|
|
8
|
+
userName: boolean;
|
|
9
|
+
email: boolean;
|
|
10
|
+
phone: boolean;
|
|
11
|
+
};
|
|
12
|
+
authenticationMethods: {
|
|
13
|
+
method: AuthenticationMethod;
|
|
14
|
+
};
|
|
15
|
+
"2FA": {
|
|
16
|
+
verificationCode: boolean;
|
|
17
|
+
};
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
export type Identifier = {
|
|
21
|
+
id: string;
|
|
22
|
+
name: string;
|
|
23
|
+
disabled: boolean;
|
|
24
|
+
defaultChecked?: boolean;
|
|
25
|
+
};
|
|
@@ -7,6 +7,10 @@ import type { ContractData } from "../../../contracts/types";
|
|
|
7
7
|
import type { OrgUnitBasicData } from "../../../org-units/types";
|
|
8
8
|
import type { ClientContext } from "../../utils";
|
|
9
9
|
|
|
10
|
+
export type FeatureFlags = {
|
|
11
|
+
enableUsernameCreation?: boolean;
|
|
12
|
+
};
|
|
13
|
+
|
|
10
14
|
export type BuyerPortalContextType = {
|
|
11
15
|
clientContext: ClientContext;
|
|
12
16
|
currentOrgUnit?: OrgUnitBasicData | null;
|
|
@@ -16,6 +20,7 @@ export type BuyerPortalContextType = {
|
|
|
16
20
|
name: string;
|
|
17
21
|
role?: string;
|
|
18
22
|
} | null;
|
|
23
|
+
featureFlags?: FeatureFlags;
|
|
19
24
|
};
|
|
20
25
|
|
|
21
26
|
export const BuyerPortalContext = createContext<
|
|
@@ -4,6 +4,42 @@ import { useUI } from "@faststore/ui";
|
|
|
4
4
|
|
|
5
5
|
import { Icon } from "../Icon";
|
|
6
6
|
|
|
7
|
+
const LINK_REGEX = /\[([^\]]+)\]\(([^)]+)\)/g;
|
|
8
|
+
|
|
9
|
+
function parseMessageWithLinks(message: string): (string | JSX.Element)[] {
|
|
10
|
+
const parts: (string | JSX.Element)[] = [];
|
|
11
|
+
let lastIndex = 0;
|
|
12
|
+
let match;
|
|
13
|
+
|
|
14
|
+
while ((match = LINK_REGEX.exec(message)) !== null) {
|
|
15
|
+
if (match.index > lastIndex) {
|
|
16
|
+
parts.push(message.slice(lastIndex, match.index));
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
const [, linkText, url] = match;
|
|
20
|
+
|
|
21
|
+
parts.push(
|
|
22
|
+
<a
|
|
23
|
+
key={match.index}
|
|
24
|
+
href={url}
|
|
25
|
+
target="_blank"
|
|
26
|
+
rel="noopener noreferrer"
|
|
27
|
+
data-fs-bp-toast-link
|
|
28
|
+
>
|
|
29
|
+
{linkText}
|
|
30
|
+
</a>
|
|
31
|
+
);
|
|
32
|
+
|
|
33
|
+
lastIndex = match.index + match[0].length;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
if (lastIndex < message.length) {
|
|
37
|
+
parts.push(message.slice(lastIndex));
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
return parts;
|
|
41
|
+
}
|
|
42
|
+
|
|
7
43
|
function Toast() {
|
|
8
44
|
const { toasts, popToast } = useUI();
|
|
9
45
|
const toast = toasts[toasts.length - 1];
|
|
@@ -39,9 +75,14 @@ function Toast() {
|
|
|
39
75
|
>
|
|
40
76
|
<div data-fs-bp-toast-content>
|
|
41
77
|
{toast.title && <p data-fs-bp-toast-title>{toast.title}</p>}
|
|
42
|
-
<p
|
|
78
|
+
<p
|
|
79
|
+
data-fs-bp-toast-message
|
|
80
|
+
data-fs-bp-toast-message-has-title={!!toast.title}
|
|
81
|
+
>
|
|
82
|
+
{parseMessageWithLinks(toast.message)}
|
|
83
|
+
</p>
|
|
84
|
+
{!!toast.icon && toast.icon}
|
|
43
85
|
</div>
|
|
44
|
-
{!!toast.icon && toast.icon}
|
|
45
86
|
<button type="button" data-fs-bp-toast-dismiss onClick={popToast}>
|
|
46
87
|
<Icon name="Close" width={10} height={10} />
|
|
47
88
|
</button>
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
--fs-toast-border-color: transparent;
|
|
17
17
|
|
|
18
18
|
--fs-toast-shadow: 0 0.063rem 0.188rem rgba(0, 0, 0, 0.1);
|
|
19
|
-
--fs-toast-bkg-color: #
|
|
19
|
+
--fs-toast-bkg-color: #1f1f1f;
|
|
20
20
|
|
|
21
21
|
--fs-toast-transition-property: var(--fs-transition-property);
|
|
22
22
|
--fs-toast-transition-timing: var(--fs-transition-timing);
|
|
@@ -93,6 +93,7 @@
|
|
|
93
93
|
[data-fs-bp-toast-content] {
|
|
94
94
|
display: block;
|
|
95
95
|
overflow: hidden;
|
|
96
|
+
padding: var(--fs-spacing-1) var(--fs-spacing-2);
|
|
96
97
|
}
|
|
97
98
|
|
|
98
99
|
[data-fs-icon] {
|
|
@@ -115,27 +116,44 @@
|
|
|
115
116
|
}
|
|
116
117
|
|
|
117
118
|
[data-fs-bp-toast-view-button] {
|
|
118
|
-
color:
|
|
119
|
+
color: var(--fs-bp-color-neutral-0);
|
|
119
120
|
font-weight: var(--fs-text-weight-semibold);
|
|
120
121
|
font-size: var(--fs-text-size-1);
|
|
121
122
|
line-height: calc(var(--fs-spacing-4) - var(--fs-spacing-0));
|
|
122
123
|
cursor: pointer;
|
|
124
|
+
padding: 0;
|
|
125
|
+
margin-top: var(--fs-spacing-1);
|
|
123
126
|
}
|
|
124
127
|
|
|
125
128
|
[data-fs-bp-toast-title] {
|
|
126
|
-
margin-left: var(--fs-toast-title-margin-left);
|
|
127
129
|
overflow: hidden;
|
|
128
130
|
font-size: var(--fs-toast-title-size);
|
|
129
131
|
font-weight: var(--fs-toast-title-weight);
|
|
130
132
|
line-height: var(--fs-toast-title-line-height);
|
|
133
|
+
margin-bottom: var(--fs-spacing-0);
|
|
131
134
|
}
|
|
132
135
|
|
|
133
136
|
[data-fs-bp-toast-message] {
|
|
134
|
-
margin-left: var(--fs-toast-message-margin-left);
|
|
135
137
|
overflow: hidden;
|
|
136
|
-
font-weight:
|
|
138
|
+
font-weight: var(--fs-bp-weight-regular);
|
|
137
139
|
font-size: var(--fs-text-size-1);
|
|
138
140
|
line-height: calc(var(--fs-spacing-3) + var(--fs-spacing-0));
|
|
141
|
+
color: var(--fs-bp-color-neutral-0);
|
|
142
|
+
|
|
143
|
+
&[data-fs-bp-toast-message-has-title="true"] {
|
|
144
|
+
color: var(--fs-bp-color-neutral-5);
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
[data-fs-bp-toast-link] {
|
|
148
|
+
color: var(--fs-bp-color-neutral-0);
|
|
149
|
+
text-decoration: none;
|
|
150
|
+
transition: opacity var(--fs-toast-transition-timing)
|
|
151
|
+
var(--fs-toast-transition-function);
|
|
152
|
+
|
|
153
|
+
&:hover {
|
|
154
|
+
opacity: 0.8;
|
|
155
|
+
}
|
|
156
|
+
}
|
|
139
157
|
}
|
|
140
158
|
|
|
141
159
|
[data-fs-bp-toast-dismiss] {
|
|
@@ -124,6 +124,19 @@ export const LoadingTabsLayout = ({ children }: LoadingTabsLayoutProps) => {
|
|
|
124
124
|
name: "",
|
|
125
125
|
},
|
|
126
126
|
},
|
|
127
|
+
settings: {
|
|
128
|
+
userIdentification: {
|
|
129
|
+
userName: false,
|
|
130
|
+
email: false,
|
|
131
|
+
phone: false,
|
|
132
|
+
},
|
|
133
|
+
authenticationMethods: {
|
|
134
|
+
method: "PASSWORD",
|
|
135
|
+
},
|
|
136
|
+
"2FA": {
|
|
137
|
+
verificationCode: false,
|
|
138
|
+
},
|
|
139
|
+
},
|
|
127
140
|
}}
|
|
128
141
|
/>
|
|
129
142
|
);
|
|
@@ -2,7 +2,7 @@ export const AUT_COOKIE_KEY = "VtexIdclientAutCookie";
|
|
|
2
2
|
// PROD URL
|
|
3
3
|
export const API_URL = (checkoutUrl: string, operation?: string) =>
|
|
4
4
|
`${checkoutUrl}/_v/store-front/${operation}`;
|
|
5
|
-
// DEV URL - CHANGE BEFORE MERGE
|
|
5
|
+
// // DEV URL - CHANGE BEFORE MERGE
|
|
6
6
|
// export const API_URL = (checkoutUrl?: string, operation?: string) =>
|
|
7
7
|
// `https://{{workspace}}--b2bfaststoredev.myvtex.com/_v/store-front/${operation}`;
|
|
8
8
|
|
|
@@ -22,4 +22,4 @@ export const SCOPE_KEYS = {
|
|
|
22
22
|
CREDIT_CARDS: "creditCards",
|
|
23
23
|
} as const;
|
|
24
24
|
|
|
25
|
-
export const CURRENT_VERSION = "1.3.
|
|
25
|
+
export const CURRENT_VERSION = "1.3.47";
|
|
@@ -16,7 +16,10 @@ export const withBuyerPortal = <T extends Record<string, unknown>>(
|
|
|
16
16
|
const { context, ...componentProps } = props;
|
|
17
17
|
|
|
18
18
|
return (
|
|
19
|
-
<BuyerPortalProvider
|
|
19
|
+
<BuyerPortalProvider
|
|
20
|
+
featureFlags={{ enableUsernameCreation: true }}
|
|
21
|
+
{...context}
|
|
22
|
+
>
|
|
20
23
|
<Component {...(componentProps as unknown as T)} />
|
|
21
24
|
</BuyerPortalProvider>
|
|
22
25
|
);
|
|
@@ -57,8 +57,9 @@ class UsersClient extends Client {
|
|
|
57
57
|
props: {
|
|
58
58
|
orgUnitId: string;
|
|
59
59
|
role: number[];
|
|
60
|
-
email
|
|
61
|
-
name
|
|
60
|
+
email?: string;
|
|
61
|
+
name?: string;
|
|
62
|
+
userName: string;
|
|
62
63
|
},
|
|
63
64
|
cookie: string
|
|
64
65
|
) {
|
|
@@ -78,8 +79,9 @@ class UsersClient extends Client {
|
|
|
78
79
|
{
|
|
79
80
|
orgUnitId: string;
|
|
80
81
|
role: number[];
|
|
81
|
-
email
|
|
82
|
-
name
|
|
82
|
+
email?: string;
|
|
83
|
+
name?: string;
|
|
84
|
+
userName: string;
|
|
83
85
|
}
|
|
84
86
|
>(
|
|
85
87
|
`units/${orgUnitId}/users`,
|
|
@@ -96,6 +98,54 @@ class UsersClient extends Client {
|
|
|
96
98
|
);
|
|
97
99
|
}
|
|
98
100
|
|
|
101
|
+
addUserToOrgUnitV2(
|
|
102
|
+
props: {
|
|
103
|
+
orgUnitId: string;
|
|
104
|
+
role: number[];
|
|
105
|
+
email?: string;
|
|
106
|
+
name?: string;
|
|
107
|
+
phone?: string;
|
|
108
|
+
userName: string;
|
|
109
|
+
},
|
|
110
|
+
cookie: string
|
|
111
|
+
) {
|
|
112
|
+
const { orgUnitId, ...data } = props;
|
|
113
|
+
|
|
114
|
+
return this.post<
|
|
115
|
+
{
|
|
116
|
+
message:
|
|
117
|
+
| "User already exists and is attached to a unit"
|
|
118
|
+
| "User Created, Sucessfully attached to Org Unit";
|
|
119
|
+
user: {
|
|
120
|
+
id: string;
|
|
121
|
+
email: string;
|
|
122
|
+
name: string;
|
|
123
|
+
};
|
|
124
|
+
accessToken?: string;
|
|
125
|
+
},
|
|
126
|
+
{
|
|
127
|
+
orgUnitId: string;
|
|
128
|
+
role: number[];
|
|
129
|
+
email?: string;
|
|
130
|
+
name?: string;
|
|
131
|
+
phone?: string;
|
|
132
|
+
userName: string;
|
|
133
|
+
}
|
|
134
|
+
>(
|
|
135
|
+
`v2/units/${orgUnitId}/users`,
|
|
136
|
+
{
|
|
137
|
+
...data,
|
|
138
|
+
orgUnitId,
|
|
139
|
+
},
|
|
140
|
+
{
|
|
141
|
+
headers: {
|
|
142
|
+
Cookie: cookie,
|
|
143
|
+
},
|
|
144
|
+
ignoreContentType: true,
|
|
145
|
+
}
|
|
146
|
+
);
|
|
147
|
+
}
|
|
148
|
+
|
|
99
149
|
removeUserFromOrgUnit(
|
|
100
150
|
props: {
|
|
101
151
|
orgUnitId: string;
|
|
@@ -169,6 +219,57 @@ class UsersClient extends Client {
|
|
|
169
219
|
}
|
|
170
220
|
);
|
|
171
221
|
}
|
|
222
|
+
|
|
223
|
+
validateUsername(
|
|
224
|
+
props: {
|
|
225
|
+
orgUnitId: string;
|
|
226
|
+
userName: string;
|
|
227
|
+
},
|
|
228
|
+
cookie: string
|
|
229
|
+
) {
|
|
230
|
+
const { orgUnitId, userName } = props;
|
|
231
|
+
|
|
232
|
+
return this.post<
|
|
233
|
+
{
|
|
234
|
+
valid: boolean;
|
|
235
|
+
userNameSuggestions?: string[];
|
|
236
|
+
},
|
|
237
|
+
{
|
|
238
|
+
userName: string;
|
|
239
|
+
}
|
|
240
|
+
>(
|
|
241
|
+
`units/${orgUnitId}/users/validate`,
|
|
242
|
+
{
|
|
243
|
+
userName,
|
|
244
|
+
},
|
|
245
|
+
{
|
|
246
|
+
headers: {
|
|
247
|
+
Cookie: cookie,
|
|
248
|
+
},
|
|
249
|
+
}
|
|
250
|
+
);
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
resetPassword(
|
|
254
|
+
props: {
|
|
255
|
+
orgUnitId: string;
|
|
256
|
+
userId: string;
|
|
257
|
+
},
|
|
258
|
+
cookie: string
|
|
259
|
+
) {
|
|
260
|
+
const { orgUnitId, userId } = props;
|
|
261
|
+
|
|
262
|
+
return this.post<
|
|
263
|
+
{
|
|
264
|
+
accessCode: string;
|
|
265
|
+
},
|
|
266
|
+
null
|
|
267
|
+
>(`units/${orgUnitId}/users/${userId}/reset-password`, null, {
|
|
268
|
+
headers: {
|
|
269
|
+
Cookie: cookie,
|
|
270
|
+
},
|
|
271
|
+
});
|
|
272
|
+
}
|
|
172
273
|
}
|
|
173
274
|
|
|
174
275
|
const usersClient = new UsersClient();
|