@vtex/faststore-plugin-buyer-portal 1.0.33 → 1.0.35

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 ADDED
@@ -0,0 +1,13 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
+
8
+ ## [Unreleased]
9
+
10
+ ### Added
11
+
12
+ - Add CHANGELOG file
13
+ - Add README file
package/README.md ADDED
@@ -0,0 +1,29 @@
1
+ # How to Run the project locally
2
+
3
+ - Step 1: Clone this repo, the Buyer Portal
4
+ - Step 2: Clone the [store repo](https://github.com/vtex-sites/b2bfaststoredev.store)
5
+ - Open two terminals, one at the Buyer Portal Repo, one at the Store Repo
6
+
7
+ ### On the Buyer Portal Repo:
8
+
9
+ - Run `yarn`
10
+ - Run `yarn link` - You will get a return with `@vtex/faststore-plugin-buyer-portal`
11
+
12
+ ### On the Store Repo:
13
+
14
+ - Run `yarn link @vtex/faststore-plugin-buyer-portal`
15
+ - Run `yarn`
16
+ - Run `yarn dev` to start your local server
17
+ - You will acess the buyer-portal via: localhost:3000/buyer-portal
18
+
19
+ ### Generating a Cookie
20
+
21
+ - Go to `b2bdev.vtexfaststore.com/login` and log-in as a user that has already been added to an Unit. If you don't have one, contact someone on the B2B - Enabler
22
+ - Go to copy your `VtexIdclientAutCookie_b2bfaststoredev` cookie
23
+ - Create a cookie in your `localhost:3000` with the `VtexIdclientAutCookie_b2bfaststoredev` key and the value you just copied
24
+ - Go to `localhost:3000/buyer-portal`
25
+
26
+ ## Developing
27
+
28
+ - Make your changes at the Buyer Portal repo
29
+ - To test your changes, stop your local server and start it again with the `yarn dev` on the Store Repo
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vtex/faststore-plugin-buyer-portal",
3
- "version": "1.0.33",
3
+ "version": "1.0.35",
4
4
  "description": "A plugin for faststore with buyer portal",
5
5
  "main": "index.js",
6
6
  "dependencies": {
@@ -1 +1 @@
1
- export { AddressData, AddressSummaryData } from "./AddressData";
1
+ export type { AddressData, AddressSummaryData } from "./AddressData";
@@ -10,7 +10,7 @@ export {
10
10
 
11
11
  export {
12
12
  updateContractStatusService,
13
- UpdateContractStatusServiceProps,
13
+ type UpdateContractStatusServiceProps,
14
14
  } from "./update-contract-status.service";
15
15
 
16
16
  export { getContractDetailsService } from "./get-contract-details.service";
@@ -51,7 +51,7 @@ export const UpdateOrgUnitDrawer = ({
51
51
  ),
52
52
  });
53
53
  close();
54
- onSuccess?.() ?? router.reload();
54
+ onSuccess ? onSuccess() : router.reload();
55
55
  };
56
56
 
57
57
  const { updateOrgUnit, isUpdateOrgUnitLoading } = useUpdateOrgUnit({
@@ -1,11 +1,11 @@
1
1
  export { CustomerSwitchDrawer } from "./CustomerSwitchDrawer";
2
2
  export {
3
3
  CustomerSwitchOption,
4
- CustomerSwitchOptionProps,
4
+ type CustomerSwitchOptionProps,
5
5
  } from "./CustomerSwitchOption";
6
6
  export {
7
7
  CustomerSwitchOptionsList,
8
- CustomerSwitchOptionsListProps,
8
+ type CustomerSwitchOptionsListProps,
9
9
  } from "./CustomerSwitchOptionsList";
10
10
  export {
11
11
  CustomerSwitchSearch,
@@ -7,6 +7,8 @@ import {
7
7
  useImperativeHandle,
8
8
  useRef,
9
9
  useState,
10
+ type KeyboardEvent,
11
+ type MouseEvent,
10
12
  } from "react";
11
13
 
12
14
  export type InputTextProps = ComponentProps<"input"> & {
@@ -44,7 +46,11 @@ export const InputText = forwardRef<HTMLInputElement, InputTextProps>(
44
46
 
45
47
  useImperativeHandle(ref, () => inputRef?.current!);
46
48
 
47
- const handleWrapperClick = (event?: MouseEvent) => {
49
+ const handleWrapperClick = (
50
+ event?:
51
+ | MouseEvent<HTMLLabelElement, globalThis.MouseEvent>
52
+ | KeyboardEvent<HTMLLabelElement>
53
+ ) => {
48
54
  event?.preventDefault();
49
55
  !disabled && setIsFocused(true);
50
56
  };
@@ -68,6 +74,7 @@ export const InputText = forwardRef<HTMLInputElement, InputTextProps>(
68
74
  data-fs-bp-input-text-label
69
75
  htmlFor={id}
70
76
  onClick={(event) => handleWrapperClick(event)}
77
+ onKeyDown={handleWrapperClick}
71
78
  >
72
79
  {label}
73
80
  </label>
@@ -6,7 +6,7 @@ export {
6
6
  } from "./AutocompleteDropdown/AutocompleteDropdown";
7
7
  export { useAutocompletePosition } from "./AutocompleteDropdown/useAutocompletePosition";
8
8
  export { BasicCard, type BasicCardProps } from "./BasicCard/BasicCard";
9
- export { BasicDrawer, BasicDrawerProps } from "./BasicDrawer/BasicDrawer";
9
+ export { BasicDrawer, type BasicDrawerProps } from "./BasicDrawer/BasicDrawer";
10
10
  export {
11
11
  BasicDropdownMenu,
12
12
  type BasicDropdownMenuProps,
@@ -36,7 +36,7 @@ export {
36
36
  HierarchyTree,
37
37
  type HierarchyTreeLevelProps,
38
38
  type HierarchyTreeProps,
39
- Structure,
39
+ type Structure,
40
40
  } from "./HierarchyTree/HierarchyTree";
41
41
  export { Icon } from "./Icon";
42
42
  export { InputText, type InputTextProps } from "./InputText/InputText";
@@ -52,6 +52,6 @@ export {
52
52
  } from "./SelfManagementDrawer";
53
53
  export { SelfManagementSignInButton } from "./SelfManagementSignInButton";
54
54
  export { default as SortFilter } from "./SortFilter/SortFilter";
55
- export { Tab, TabProps, useTab } from "./Tab/Tab";
55
+ export { Tab, type TabProps, useTab } from "./Tab/Tab";
56
56
  export { Tag, type TagProps } from "./Tag/Tag";
57
57
  export { default as Toast } from "./Toast/Toast";
@@ -1,6 +1,10 @@
1
1
  export { useBuyerPortal } from "./useBuyerPortal";
2
2
  export { useDrawerProps, type DrawerProps } from "./useDrawerProps";
3
- export { useMutation, MutationResult, MutationOptions } from "./useMutation";
4
- export { useQuery, QueryOptions } from "./useQuery";
3
+ export {
4
+ useMutation,
5
+ type MutationResult,
6
+ type MutationOptions,
7
+ } from "./useMutation";
8
+ export { useQuery, type QueryOptions } from "./useQuery";
5
9
  export { useQueryParams } from "./useQueryParams";
6
10
  export { useDebounce } from "./useDebounce";
@@ -10,6 +10,7 @@ import { ProfileCard } from "../../../profile/components";
10
10
  import { UsersCard } from "../../../users/components";
11
11
  import { GlobalLayout } from "../GlobalLayout/GlobalLayout";
12
12
  import { Icon } from "../../components";
13
+ import type { UserSummary } from "../../../users/types";
13
14
 
14
15
  export type HomeLayoutProps = {
15
16
  data: OrganizationData;
@@ -38,7 +39,7 @@ export const HomeLayout = ({ data }: HomeLayoutProps) => {
38
39
  ) : (
39
40
  <ContractsCard contracts={data.contracts} />
40
41
  )}
41
- <UsersCard users={data.users} />
42
+ <UsersCard users={data.users as unknown as UserSummary[]} />
42
43
 
43
44
  {/* Remove this comments when mocks be removed */}
44
45
  {data.contracts.length === 1 && (
@@ -7,7 +7,7 @@ export {
7
7
  getCookieAsString,
8
8
  getCustomerIdFromCookieServerSide,
9
9
  } from "./cookie";
10
- export { getClientContext, ClientContext } from "./getClientContext";
10
+ export { getClientContext, type ClientContext } from "./getClientContext";
11
11
  export { getTreeDepth } from "./getTreeDepth";
12
12
  export { doLogout } from "./logout";
13
13
  export { goToOrders } from "./orders";
@@ -7,7 +7,7 @@ export const useUsersByOrgUnit = (
7
7
  ) => {
8
8
  const { data, error, isLoading, refetch } = useQuery(
9
9
  `org-unit/users${orgUnitId}`,
10
- () => getUsersByOrgUnitIdService(orgUnitId),
10
+ ({ cookie }) => getUsersByOrgUnitIdService({ orgUnitId, cookie }),
11
11
  options
12
12
  );
13
13