@vtex/faststore-plugin-buyer-portal 1.3.45 → 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 (53) hide show
  1. package/CHANGELOG.md +15 -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 +5 -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/DeleteOrgUnitDrawer/DeleteOrgUnitDrawer.tsx +30 -5
  10. package/src/features/org-units/components/OrgUnitDetailsDropdownMenu/OrgUnitDetailsDropdownMenu.tsx +80 -0
  11. package/src/features/org-units/components/OrgUnitDetailsDropdownMenu/index.ts +4 -0
  12. package/src/features/org-units/components/OrgUnitsDropdownMenu/OrgUnitsDropdownMenu.tsx +5 -2
  13. package/src/features/org-units/components/index.ts +8 -0
  14. package/src/features/org-units/hooks/index.ts +2 -0
  15. package/src/features/org-units/hooks/useGetOrgUnitSettings.ts +20 -0
  16. package/src/features/org-units/hooks/useUpdateOrgUnitSettings.ts +27 -0
  17. package/src/features/org-units/layouts/OrgUnitDetailsLayout/OrgUnitDetailsLayout.tsx +23 -1
  18. package/src/features/org-units/layouts/OrgUnitDetailsLayout/org-units-details.scss +1 -0
  19. package/src/features/org-units/services/get-org-unit-settings.service.ts +13 -0
  20. package/src/features/org-units/services/index.ts +8 -0
  21. package/src/features/org-units/services/update-org-unit-settings.service.ts +17 -0
  22. package/src/features/org-units/types/OrgUnitSettings.ts +25 -0
  23. package/src/features/org-units/types/index.ts +2 -0
  24. package/src/features/shared/components/BuyerPortalProvider/BuyerPortalProvider.tsx +5 -0
  25. package/src/features/shared/components/Toast/Toast.tsx +43 -2
  26. package/src/features/shared/components/Toast/toast.scss +23 -5
  27. package/src/features/shared/components/index.ts +1 -0
  28. package/src/features/shared/layouts/LoadingTabsLayout/LoadingTabsLayout.tsx +13 -0
  29. package/src/features/shared/utils/constants.ts +2 -2
  30. package/src/features/shared/utils/withBuyerPortal.tsx +4 -1
  31. package/src/features/users/clients/UsersClient.ts +105 -4
  32. package/src/features/users/components/CreateUserDrawer/CreateUserDrawer.tsx +1 -1
  33. package/src/features/users/components/CreateUserDrawerSelector/CreateUserDrawerSelector.tsx +20 -0
  34. package/src/features/users/components/CreateUserDrawerWithUsername/CreateUserDrawerWithUsername.tsx +696 -0
  35. package/src/features/users/components/CreateUserDrawerWithUsername/create-user-drawer-with-username.scss +116 -0
  36. package/src/features/users/components/UserDropdownMenu/user-dropdown-menu.scss +1 -0
  37. package/src/features/users/components/UsersCard/UsersCard.tsx +2 -2
  38. package/src/features/users/components/index.ts +5 -0
  39. package/src/features/users/hooks/index.ts +2 -0
  40. package/src/features/users/hooks/useAddUserToOrgUnit.ts +12 -5
  41. package/src/features/users/hooks/useResetPassword.ts +39 -0
  42. package/src/features/users/hooks/useValidateUsername.ts +38 -0
  43. package/src/features/users/layouts/UserDetailsLayout/UserDetailsLayout.tsx +10 -0
  44. package/src/features/users/layouts/UsersLayout/UsersLayout.tsx +55 -10
  45. package/src/features/users/layouts/UsersLayout/users-layout.scss +19 -0
  46. package/src/features/users/services/add-user-to-org-unit.service.ts +8 -6
  47. package/src/features/users/services/get-users-by-org-unit-id.service.ts +1 -0
  48. package/src/features/users/services/index.ts +10 -0
  49. package/src/features/users/services/reset-password.service.ts +24 -0
  50. package/src/features/users/services/validate-username.service.ts +25 -0
  51. package/src/features/users/types/UserData.ts +1 -0
  52. package/src/features/users/types/UserDataService.ts +1 -0
  53. package/src/pages/org-unit-details.tsx +20 -2
@@ -11,8 +11,9 @@ import {
11
11
  InputText,
12
12
  type BasicDrawerProps,
13
13
  } from "../../../shared/components";
14
- import { useAnalytics } from "../../../shared/hooks";
14
+ import { useBuyerPortal, useAnalytics } from "../../../shared/hooks";
15
15
  import { ANALYTICS_EVENTS } from "../../../shared/services/logger/analytics/constants";
16
+ import { buyerPortalRoutes } from "../../../shared/utils/buyerPortalRoutes";
16
17
  import { useGetUserByOrgUnitId } from "../../../users/hooks/useGetUserByOrgUnitId";
17
18
  import { useChildrenOrgUnits } from "../../hooks";
18
19
  import { useDeleteOrgUnit } from "../../hooks/useDeleteOrgUnit";
@@ -21,15 +22,18 @@ import { useDeleteOrgUnit } from "../../hooks/useDeleteOrgUnit";
21
22
  export type DeleteOrgUnitDrawerProps = Omit<BasicDrawerProps, "children"> & {
22
23
  id: string;
23
24
  name: string;
25
+ pathIds?: string;
24
26
  };
25
27
 
26
28
  export const DeleteOrgUnitDrawer = ({
27
29
  id,
28
30
  name,
31
+ pathIds,
29
32
  close,
30
33
  ...props
31
34
  }: DeleteOrgUnitDrawerProps) => {
32
35
  const router = useRouter();
36
+ const { currentOrgUnit } = useBuyerPortal();
33
37
  const { childrenOrgUnits } = useChildrenOrgUnits(id, name);
34
38
  const { users } = useGetUserByOrgUnitId(id);
35
39
  const { pushToast } = useUI();
@@ -58,14 +62,35 @@ export const DeleteOrgUnitDrawer = ({
58
62
  message: "Organizational unit deleted successfully",
59
63
  status: "INFO",
60
64
  });
61
- close();
62
65
 
63
- if (router.asPath === `/org-unit/${id}`) {
64
- router.replace("/org-units/${id}");
65
- return;
66
+ const currentPath = router.asPath;
67
+ const isOnDetailsPage = currentPath.includes(`/org-unit/${id}`);
68
+ const isOnListPageOfDeletedUnit =
69
+ currentPath === `/pvt/organization-account/org-units/${id}`;
70
+
71
+ const effectivePathIds =
72
+ pathIds ||
73
+ (id === currentOrgUnit?.id ? currentOrgUnit?.path?.ids : undefined);
74
+
75
+ if ((isOnDetailsPage || isOnListPageOfDeletedUnit) && effectivePathIds) {
76
+ const ids = effectivePathIds.split("/").filter(Boolean);
77
+
78
+ if (ids.length >= 2) {
79
+ const parentId = ids[ids.length - 2];
80
+ const redirectUrl = buyerPortalRoutes.orgUnitDetails({
81
+ orgUnitId: parentId,
82
+ });
83
+ router.replace(redirectUrl);
84
+ } else {
85
+ router.replace(`/pvt/organization-account`);
86
+ }
87
+ } else if (isOnDetailsPage || isOnListPageOfDeletedUnit) {
88
+ router.replace(`/pvt/organization-account`);
66
89
  } else {
67
90
  router.reload();
68
91
  }
92
+
93
+ close();
69
94
  };
70
95
 
71
96
  const { deleteOrgUnit, isDeleteOrgUnitLoading } = useDeleteOrgUnit({
@@ -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
+ };
@@ -0,0 +1,4 @@
1
+ export {
2
+ OrgUnitDetailsDropdownMenu,
3
+ type OrgUnitDetailsDropdownMenuProps,
4
+ } from "./OrgUnitDetailsDropdownMenu";
@@ -8,13 +8,14 @@ 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 { CreateUserDrawer } from "../../../users/components";
11
+ import { CreateUserDrawerSelector } from "../../../users/components";
12
12
 
13
13
  export type OrgUnitsDropdownMenuProps = {
14
14
  id: string;
15
15
  name: string;
16
16
  onCreate?: () => void;
17
17
  isComplete?: boolean;
18
+ pathIds?: string;
18
19
  };
19
20
 
20
21
  export const OrgUnitsDropdownMenu = ({
@@ -22,6 +23,7 @@ export const OrgUnitsDropdownMenu = ({
22
23
  name,
23
24
  onCreate,
24
25
  isComplete = true,
26
+ pathIds,
25
27
  }: OrgUnitsDropdownMenuProps) => {
26
28
  const { rolesOptions } = useGetRolesOptions(id);
27
29
  const {
@@ -97,6 +99,7 @@ export const OrgUnitsDropdownMenu = ({
97
99
  <DeleteOrgUnitDrawer
98
100
  id={id}
99
101
  name={name}
102
+ pathIds={pathIds}
100
103
  {...deleteDrawerProps}
101
104
  isOpen={isDeleteDrawerOpen}
102
105
  />
@@ -111,7 +114,7 @@ export const OrgUnitsDropdownMenu = ({
111
114
  />
112
115
  )}
113
116
  {isCreateUserDrawerOpen && (
114
- <CreateUserDrawer
117
+ <CreateUserDrawerSelector
115
118
  orgUnit={{ id, name }}
116
119
  rolesOptions={rolesOptions}
117
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: { orgUnit, contracts, user },
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,15 +113,28 @@ 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}
114
135
  unitId={orgUnit?.id}
115
136
  unitName={orgUnit?.name}
137
+ pathIds={orgUnit?.path?.ids}
116
138
  />
117
139
  </Dropdown>
118
140
  </HeaderInside>
@@ -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
+ };
@@ -14,3 +14,5 @@ export type {
14
14
  OrgUnitSearchParams,
15
15
  OrgUnitSearchResponse,
16
16
  } from "./OrgUnitSearch";
17
+ export { AuthenticationMethod } from "./OrgUnitSettings";
18
+ export type { OrgUnitSettings, Identifier } from "./OrgUnitSettings";
@@ -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 data-fs-bp-toast-message>{toast.message}</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: #000000;
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: #ffffff;
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: 400;
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] {
@@ -23,6 +23,7 @@ export {
23
23
  BuyerPortalProvider,
24
24
  type BuyerPortalContextType,
25
25
  type BuyerPortalProviderProps,
26
+ type FeatureFlags,
26
27
  } from "./BuyerPortalProvider/BuyerPortalProvider";
27
28
  export { Card, CardBody, CardFooter, CardHeader } from "./Card";
28
29
  export {
@@ -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.45";
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 {...context}>
19
+ <BuyerPortalProvider
20
+ featureFlags={{ enableUsernameCreation: true }}
21
+ {...context}
22
+ >
20
23
  <Component {...(componentProps as unknown as T)} />
21
24
  </BuyerPortalProvider>
22
25
  );