@vtex/faststore-plugin-buyer-portal 1.0.27 → 1.0.28

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 (215) hide show
  1. package/package.json +1 -1
  2. package/src/apis/new-route.ts +1 -1
  3. package/src/clients/BuyerPortalClient.ts +5 -5
  4. package/src/clients/Client.ts +1 -1
  5. package/src/components/overrides/Navbar.tsx +2 -2
  6. package/src/{components → features/addresses/components}/AddressLine/AddressLine.tsx +3 -4
  7. package/src/{components → features/addresses/components}/AddressesCard/AddressesCard.tsx +2 -4
  8. package/src/features/addresses/components/index.ts +2 -0
  9. package/src/features/addresses/hooks/index.ts +0 -0
  10. package/src/{layouts → features/addresses/layouts}/AddressDetailsLayout/AddressDetailsLayout.tsx +32 -23
  11. package/src/{layouts → features/addresses/layouts}/AddressDetailsLayout/address-details-layout.scss +1 -1
  12. package/src/{layouts → features/addresses/layouts}/AddressesLayout/AddressesLayout.tsx +13 -13
  13. package/src/{layouts → features/addresses/layouts}/AddressesLayout/addresses-layout.scss +7 -6
  14. package/src/features/addresses/layouts/index.ts +8 -0
  15. package/src/{mock → features/addresses/mocks}/addresses-data.ts +1 -1
  16. package/src/features/addresses/mocks/index.ts +1 -0
  17. package/src/features/addresses/services/get-address-details.service.ts +11 -0
  18. package/src/{services → features/addresses/services}/get-addresses.service.ts +2 -3
  19. package/src/features/addresses/services/index.ts +5 -0
  20. package/src/features/addresses/types/index.ts +1 -0
  21. package/src/{components → features/contracts/components}/ContractsCard/ContractsCard.tsx +2 -3
  22. package/src/features/contracts/components/index.ts +1 -0
  23. package/src/features/contracts/hooks/index.ts +0 -0
  24. package/src/{layouts → features/contracts/layouts}/ContractsLayout/ContractsLayout.tsx +12 -10
  25. package/src/{layouts → features/contracts/layouts}/ContractsLayout/contracts-layout.scss +5 -5
  26. package/src/features/contracts/layouts/index.ts +4 -0
  27. package/src/{mock → features/contracts/mocks}/contracts-data.ts +1 -1
  28. package/src/features/contracts/mocks/index.ts +1 -0
  29. package/src/{services → features/contracts/services}/get-contracts.service.ts +3 -4
  30. package/src/features/contracts/services/index.ts +4 -0
  31. package/src/{types → features/contracts/types}/ContractData.ts +1 -1
  32. package/src/features/contracts/types/index.ts +1 -0
  33. package/src/{components → features/org-units/components}/CreateOrgUnitDrawer/CreateOrgUnitDrawer.tsx +10 -6
  34. package/src/features/org-units/components/CreateOrgUnitDrawer/create-org-unit-drawer.scss +6 -0
  35. package/src/{components → features/org-units/components}/DeleteOrgUnitDrawer/DeleteOrgUnitDrawer.tsx +13 -8
  36. package/src/{components → features/org-units/components}/DeleteOrgUnitDrawer/delete-org-unit-drawer.scss +2 -2
  37. package/src/{components → features/org-units/components}/OrgUnitsDropdownMenu/OrgUnitsDropdownMenu.tsx +8 -6
  38. package/src/{components → features/org-units/components}/OrgUnitsDropdownMenu/org-units-dropdown-menu.scss +1 -1
  39. package/src/{components → features/org-units/components}/OrgUnitsHierarchyTree/OrgUnitsHierarchyTree.tsx +12 -10
  40. package/src/{components → features/org-units/components}/OrgUnitsHierarchyTree/org-units-hierarchy-tree.scss +1 -1
  41. package/src/{components → features/org-units/components}/OrganizationalUnitsCard/OrganizationalUnitsCard.tsx +4 -6
  42. package/src/{components → features/org-units/components}/UpdateOrgUnitDrawer/UpdateOrgUnitDrawer.tsx +12 -7
  43. package/src/features/org-units/components/UpdateOrgUnitDrawer/update-org-unit-drawer.scss +6 -0
  44. package/src/features/org-units/components/index.ts +21 -0
  45. package/src/features/org-units/hooks/index.ts +6 -0
  46. package/src/{hooks → features/org-units/hooks}/useChildrenOrgUnits.ts +2 -2
  47. package/src/{hooks → features/org-units/hooks}/useCreateNewOrgUnit.ts +4 -4
  48. package/src/{hooks → features/org-units/hooks}/useDeleteOrgUnit.ts +3 -3
  49. package/src/{hooks → features/org-units/hooks}/useOrgUnitStructure.ts +7 -3
  50. package/src/{hooks → features/org-units/hooks}/useRootOrgUnitByCustomer.ts +2 -2
  51. package/src/{hooks → features/org-units/hooks}/useUpdateOrgUnit.ts +3 -3
  52. package/src/{layouts → features/org-units/layouts}/OrgUnitDetailsLayout/OrgUnitDetailsLayout.tsx +11 -11
  53. package/src/{layouts → features/org-units/layouts}/OrgUnitsLayout/OrgUnitsLayout.tsx +15 -15
  54. package/src/{layouts → features/org-units/layouts}/OrgUnitsLayout/org-units-layout.scss +6 -5
  55. package/src/features/org-units/layouts/index.ts +8 -0
  56. package/src/features/org-units/mocks/index.ts +2 -0
  57. package/src/{mock → features/org-units/mocks}/org-units-data.ts +1 -1
  58. package/src/{mock → features/org-units/mocks}/organization-data.ts +4 -4
  59. package/src/{services → features/org-units/services}/create-new-org-unit.service.ts +1 -1
  60. package/src/{services → features/org-units/services}/delete-org-unit.service.ts +1 -1
  61. package/src/{services → features/org-units/services}/get-children-org-units.service.ts +1 -1
  62. package/src/{services → features/org-units/services}/get-org-unit-basic-data.service.ts +1 -1
  63. package/src/{services → features/org-units/services}/get-org-unit-by-id.service.ts +4 -3
  64. package/src/{services → features/org-units/services}/get-org-unit-summary.service.ts +1 -1
  65. package/src/{services → features/org-units/services}/get-organization.service.ts +2 -2
  66. package/src/{services → features/org-units/services}/get-root-org-unit-by-customer-id.service.ts +1 -1
  67. package/src/features/org-units/services/index.ts +24 -0
  68. package/src/{services → features/org-units/services}/update-org-unit.service.ts +1 -1
  69. package/src/{types → features/org-units/types}/OrgUnitSummaryData.ts +3 -3
  70. package/src/{types → features/org-units/types}/OrgUnitsData.ts +1 -1
  71. package/src/features/org-units/types/OrganizationData.ts +13 -0
  72. package/src/features/org-units/types/index.ts +6 -0
  73. package/src/{components → features/profile/components}/ProfileCard/ProfileCard.tsx +1 -1
  74. package/src/{components → features/profile/components}/ProfileSummary/ProfileSummary.tsx +3 -3
  75. package/src/features/profile/components/index.ts +5 -0
  76. package/src/features/profile/hooks/index.ts +0 -0
  77. package/src/{layouts → features/profile/layouts}/ProfileLayout/ProfileLayout.tsx +6 -6
  78. package/src/{layouts → features/profile/layouts}/ProfileLayout/profile-layout.scss +2 -2
  79. package/src/features/profile/layouts/index.ts +4 -0
  80. package/src/features/profile/mocks/index.ts +1 -0
  81. package/src/{mock → features/profile/mocks}/profile-data.ts +2 -2
  82. package/src/features/profile/services/index.ts +0 -0
  83. package/src/features/profile/types/index.ts +1 -0
  84. package/src/{components → features/shared/components}/AutocompleteDropdown/AutocompleteDropdown.tsx +3 -3
  85. package/src/{components → features/shared/components}/BuyerPortalProvider/BuyerPortalProvider.tsx +2 -2
  86. package/src/features/shared/components/Card/Card.tsx +17 -0
  87. package/src/{components → features/shared/components}/CustomerSwitch/CustomerSwitchDrawer.tsx +1 -1
  88. package/src/features/shared/components/CustomerSwitch/index.ts +13 -0
  89. package/src/{components → features/shared/components}/Navbar/Navbar.tsx +4 -4
  90. package/src/{components → features/shared/components}/SelfManagementDrawer/SelfManagementDrawer.tsx +8 -6
  91. package/src/features/shared/components/SelfManagementDrawer/SelfManagementDrawerBody.tsx +30 -0
  92. package/src/{components → features/shared/components}/SelfManagementDrawer/self-management-drawer.scss +2 -1
  93. package/src/{components → features/shared/components}/SortFilter/SortFilter.tsx +1 -1
  94. package/src/{components → features/shared/components}/Toast/Toast.tsx +4 -5
  95. package/src/features/shared/components/index.ts +55 -0
  96. package/src/features/shared/hooks/index.ts +5 -0
  97. package/src/{hooks → features/shared/hooks}/useBuyerPortal.ts +1 -1
  98. package/src/{hooks → features/shared/hooks}/useMutation.ts +5 -5
  99. package/src/{hooks → features/shared/hooks}/useQuery.ts +3 -2
  100. package/src/{layouts → features/shared/layouts}/HomeLayout/HomeLayout.tsx +6 -6
  101. package/src/{layouts → features/shared/layouts}/HomeLayout/home-layout.scss +1 -1
  102. package/src/features/shared/layouts/index.ts +5 -0
  103. package/src/features/shared/types/index.ts +2 -0
  104. package/src/{utils → features/shared/utils}/getClientContext.ts +8 -4
  105. package/src/features/shared/utils/index.ts +23 -0
  106. package/src/{components → features/users/components}/UsersCard/UsersCard.tsx +3 -5
  107. package/src/features/users/components/index.ts +1 -0
  108. package/src/features/users/hooks/index.ts +1 -0
  109. package/src/{hooks → features/users/hooks}/useUsersByOrgUnit.ts +2 -2
  110. package/src/{layouts → features/users/layouts}/UserDetailsLayout/UserDetailsLayout.tsx +11 -12
  111. package/src/{layouts → features/users/layouts}/UserDetailsLayout/user-details-layout.scss +1 -1
  112. package/src/{layouts → features/users/layouts}/UsersLayout/UsersLayout.tsx +13 -13
  113. package/src/{layouts → features/users/layouts}/UsersLayout/users-layout.scss +5 -5
  114. package/src/features/users/layouts/index.ts +5 -0
  115. package/src/features/users/mocks/index.ts +1 -0
  116. package/src/{mock → features/users/mocks}/users-data.ts +1 -1
  117. package/src/features/users/services/get-user-details.service.ts +6 -0
  118. package/src/{services → features/users/services}/get-users-by-org-unit-id.service.ts +2 -2
  119. package/src/{services → features/users/services}/get-users.service.ts +3 -4
  120. package/src/features/users/services/index.ts +6 -0
  121. package/src/features/users/types/index.ts +1 -0
  122. package/src/pages/address-details.tsx +7 -10
  123. package/src/pages/addresses.tsx +9 -10
  124. package/src/pages/contracts.tsx +6 -9
  125. package/src/pages/home.tsx +6 -9
  126. package/src/pages/org-unit-details.tsx +6 -9
  127. package/src/pages/org-units.tsx +6 -9
  128. package/src/pages/profile.tsx +7 -7
  129. package/src/pages/user-details.tsx +9 -10
  130. package/src/pages/users.tsx +8 -11
  131. package/src/themes/index.scss +2 -2
  132. package/src/themes/layouts.scss +22 -0
  133. package/src/components/Card/Card.tsx +0 -16
  134. package/src/components/CreateOrgUnitDrawer/create-org-unit-drawer.scss +0 -6
  135. package/src/components/SelfManagementDrawer/SelfManagementDrawerBody.tsx +0 -23
  136. package/src/components/UpdateOrgUnitDrawer/update-org-unit-drawer.scss +0 -6
  137. package/src/components/index.ts +0 -8
  138. package/src/layouts/index.scss +0 -9
  139. package/src/services/get-address-details.service.ts +0 -12
  140. package/src/services/get-user-details.service.ts +0 -6
  141. package/src/types/OrganizationData.ts +0 -13
  142. /package/src/{components → features/addresses/components}/AddressLine/address-line.scss +0 -0
  143. /package/src/{types → features/addresses/types}/AddressData.ts +0 -0
  144. /package/src/{components → features/profile/components}/ProfileSummary/profile-summary.scss +0 -0
  145. /package/src/{types → features/profile/types}/ProfileData.ts +0 -0
  146. /package/src/{components → features/shared/components}/AutocompleteDropdown/AutocompleteDropdownItem.tsx +0 -0
  147. /package/src/{components → features/shared/components}/AutocompleteDropdown/autocomplete-dropdown.scss +0 -0
  148. /package/src/{components → features/shared/components}/AutocompleteDropdown/useAutocompletePosition.ts +0 -0
  149. /package/src/{components → features/shared/components}/BasicCard/BasicCard.tsx +0 -0
  150. /package/src/{components → features/shared/components}/BasicDrawer/BasicDrawer.tsx +0 -0
  151. /package/src/{components → features/shared/components}/BasicDrawer/BasicDrawerBody.tsx +0 -0
  152. /package/src/{components → features/shared/components}/BasicDrawer/BasicDrawerButton.tsx +0 -0
  153. /package/src/{components → features/shared/components}/BasicDrawer/BasicDrawerFooter.tsx +0 -0
  154. /package/src/{components → features/shared/components}/BasicDrawer/BasicDrawerHeading.tsx +0 -0
  155. /package/src/{components → features/shared/components}/BasicDrawer/basic-drawer.scss +0 -0
  156. /package/src/{components → features/shared/components}/BasicDropdownMenu/BasicDropdownMenu.tsx +0 -0
  157. /package/src/{components → features/shared/components}/BasicDropdownMenu/basic-dropdown-menu.scss +0 -0
  158. /package/src/{components → features/shared/components}/Card/CardBody.tsx +0 -0
  159. /package/src/{components → features/shared/components}/Card/CardFooter.tsx +0 -0
  160. /package/src/{components → features/shared/components}/Card/CardHeader.tsx +0 -0
  161. /package/src/{components → features/shared/components}/Card/card.scss +0 -0
  162. /package/src/{components → features/shared/components}/Card/index.ts +0 -0
  163. /package/src/{components → features/shared/components}/CustomerSwitch/CustomerSwitchOption.tsx +0 -0
  164. /package/src/{components → features/shared/components}/CustomerSwitch/CustomerSwitchOptionsList.tsx +0 -0
  165. /package/src/{components → features/shared/components}/CustomerSwitch/CustomerSwitchSearch.tsx +0 -0
  166. /package/src/{components → features/shared/components}/CustomerSwitch/customer-switch.scss +0 -0
  167. /package/src/{components → features/shared/components}/DropdownFilter/DropdownFilter.tsx +0 -0
  168. /package/src/{components → features/shared/components}/DropdownFilter/dropdown-filter.scss +0 -0
  169. /package/src/{components → features/shared/components}/ErrorMessage/ErrorMessage.tsx +0 -0
  170. /package/src/{components → features/shared/components}/ErrorMessage/error-message.scss +0 -0
  171. /package/src/{components → features/shared/components}/HierarchyTree/HierarchyTree.tsx +0 -0
  172. /package/src/{components → features/shared/components}/HierarchyTree/hierarchy-tree.scss +0 -0
  173. /package/src/{components → features/shared/components}/Icon/Icon.tsx +0 -0
  174. /package/src/{components → features/shared/components}/Icon/index.ts +0 -0
  175. /package/src/{components → features/shared/components}/InputText/InputText.tsx +0 -0
  176. /package/src/{components → features/shared/components}/InputText/input-text.scss +0 -0
  177. /package/src/{components → features/shared/components}/InternalSearch/InternalSearch.tsx +0 -0
  178. /package/src/{components → features/shared/components}/InternalSearch/internal-search.scss +0 -0
  179. /package/src/{components → features/shared/components}/InternalTopbar/InternalTopbar.tsx +0 -0
  180. /package/src/{components → features/shared/components}/InternalTopbar/internal-top-bar.scss +0 -0
  181. /package/src/{components → features/shared/components}/Logo/Logo.tsx +0 -0
  182. /package/src/{components → features/shared/components}/MainLinksDropdownMenu/MainLinksDropdownMenu.tsx +0 -0
  183. /package/src/{components → features/shared/components}/MainLinksDropdownMenu/main-links-dropdown-menu.scss +0 -0
  184. /package/src/{components → features/shared/components}/Navbar/navbar.scss +0 -0
  185. /package/src/{components → features/shared/components}/SelfManagementDrawer/SelfManagementDrawerHeader.tsx +0 -0
  186. /package/src/{components → features/shared/components}/SelfManagementDrawer/index.ts +0 -0
  187. /package/src/{components → features/shared/components}/SelfManagementSignInButton/SelfManagementSignInButton.tsx +0 -0
  188. /package/src/{components → features/shared/components}/SelfManagementSignInButton/index.ts +0 -0
  189. /package/src/{components → features/shared/components}/SortFilter/sort-filter.scss +0 -0
  190. /package/src/{components → features/shared/components}/Tab/Tab.tsx +0 -0
  191. /package/src/{components → features/shared/components}/Tab/TabBar.tsx +0 -0
  192. /package/src/{components → features/shared/components}/Tab/TabContent.tsx +0 -0
  193. /package/src/{components → features/shared/components}/Tab/TabOption.tsx +0 -0
  194. /package/src/{components → features/shared/components}/Tab/tab.scss +0 -0
  195. /package/src/{components → features/shared/components}/Tag/Tag.tsx +0 -0
  196. /package/src/{components → features/shared/components}/Tag/tag.scss +0 -0
  197. /package/src/{components → features/shared/components}/Toast/toast.scss +0 -0
  198. /package/src/{hooks → features/shared/hooks}/useDrawerProps.ts +0 -0
  199. /package/src/{hooks → features/shared/hooks}/useQueryParams.ts +0 -0
  200. /package/src/{layouts → features/shared/layouts}/GlobalLayout/GlobalLayout.tsx +0 -0
  201. /package/src/{layouts → features/shared/layouts}/GlobalLayout/global-layout.scss +0 -0
  202. /package/src/{types → features/shared/types}/AwaitedType.d.ts +0 -0
  203. /package/src/{types → features/shared/types}/BreadcrumbData.ts +0 -0
  204. /package/src/{types → features/shared/types}/LoaderData.ts +0 -0
  205. /package/src/{utils → features/shared/utils}/addresLabelToPropMapping.ts +0 -0
  206. /package/src/{utils → features/shared/utils}/api.ts +0 -0
  207. /package/src/{utils → features/shared/utils}/compareItems.ts +0 -0
  208. /package/src/{utils → features/shared/utils}/constants.ts +0 -0
  209. /package/src/{utils → features/shared/utils}/cookie.ts +0 -0
  210. /package/src/{utils → features/shared/utils}/getTreeDepth.ts +0 -0
  211. /package/src/{utils → features/shared/utils}/logout.tsx +0 -0
  212. /package/src/{utils → features/shared/utils}/orders.tsx +0 -0
  213. /package/src/{utils → features/shared/utils}/search.tsx +0 -0
  214. /package/src/{utils → features/shared/utils}/toQueryParams.ts +0 -0
  215. /package/src/{types → features/users/types}/UserData.ts +0 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vtex/faststore-plugin-buyer-portal",
3
- "version": "1.0.27",
3
+ "version": "1.0.28",
4
4
  "description": "A plugin for faststore with buyer portal",
5
5
  "main": "index.js",
6
6
  "dependencies": {
@@ -1,4 +1,4 @@
1
- import { NextApiRequest, NextApiResponse } from "next/types";
1
+ import type { NextApiRequest, NextApiResponse } from "next/types";
2
2
 
3
3
  // TODO: Remove when Plugin API feature be merged
4
4
  export default function handle(req: NextApiRequest, res: NextApiResponse) {
@@ -1,11 +1,11 @@
1
- import type { AddressData } from "../types/AddressData";
2
- import type { ContractData } from "../types/ContractData";
3
- import type { OrgUnitData } from "../types/OrgUnitsData";
1
+ import type { AddressData } from "../features/addresses/types";
2
+ import type { ContractData } from "../features/contracts/types";
4
3
  import type {
5
4
  OrgUnitBasicData,
6
5
  OrgUnitSummaryData,
7
- } from "../types/OrgUnitSummaryData";
8
- import { getApiUrl } from "../utils/api";
6
+ OrgUnitData,
7
+ } from "../features/org-units/types";
8
+ import { getApiUrl } from "../features/shared/utils";
9
9
  import Client from "./Client";
10
10
 
11
11
  class BuyerPortalClient extends Client {
@@ -1,4 +1,4 @@
1
- import { toQueryParams } from "../utils/toQueryParams";
1
+ import { toQueryParams } from "../features/shared/utils";
2
2
 
3
3
  interface RequestConfig<T> {
4
4
  url: string;
@@ -1,6 +1,6 @@
1
- import { SectionOverride } from "@faststore/core";
1
+ import type { SectionOverride } from "@faststore/core";
2
2
  import { useSession_unstable as useSession } from "@faststore/core/experimental";
3
- import { SelfManagementSignInButton } from "../SelfManagementSignInButton";
3
+ import { SelfManagementSignInButton } from "../../features/shared/components";
4
4
 
5
5
  const SECTION: SectionOverride["section"] = "Navbar";
6
6
 
@@ -1,7 +1,6 @@
1
1
  import { Toggle } from "@faststore/ui";
2
2
  import Link from "next/link";
3
- import { Tag } from "../Tag/Tag";
4
- import { Icon } from "../Icon";
3
+ import { Icon, Tag } from "../../../shared/components";
5
4
 
6
5
  export type AddressLineProps = {
7
6
  id: string;
@@ -31,12 +30,12 @@ export const AddressLine = ({
31
30
  </span>
32
31
 
33
32
  {types.map((type, index) => (
34
- <Tag key={index}>{type}</Tag>
33
+ <Tag key={type}>{type}</Tag>
35
34
  ))}
36
35
  </Link>
37
36
 
38
37
  <Toggle id={id} defaultChecked={isActive} />
39
- <button data-fs-addresses-dropdown-trigger>
38
+ <button type="button" data-fs-addresses-dropdown-trigger>
40
39
  <Icon
41
40
  name="MoreVert"
42
41
  width={20}
@@ -5,10 +5,8 @@ import {
5
5
  DropdownMenu,
6
6
  DropdownButton,
7
7
  } from "@faststore/ui";
8
- import { Tag } from "../Tag/Tag";
9
- import type { AddressData } from "../../types/AddressData";
10
- import { Icon } from "../Icon";
11
- import { BasicCard } from "../BasicCard/BasicCard";
8
+ import type { AddressData } from "../../types";
9
+ import { BasicCard, Icon, Tag } from "../../../shared/components";
12
10
 
13
11
  type AddressesCardProps = {
14
12
  addresses?: AddressData[];
@@ -0,0 +1,2 @@
1
+ export { AddressLine, type AddressLineProps } from "./AddressLine/AddressLine";
2
+ export { default as AddressesCard } from "./AddressesCard/AddressesCard";
File without changes
@@ -1,16 +1,19 @@
1
1
  import { DropdownItem, DropdownMenu, Toggle } from "@faststore/ui";
2
- import { useState } from "react";
3
- import { InternalTopBar } from "../../components/InternalTopbar/InternalTopbar";
4
- import type { AddressData } from "../../types/AddressData";
5
- import { addressLabelToPropMapping } from "../../utils/addresLabelToPropMapping";
6
- import { GlobalLayout } from "../GlobalLayout/GlobalLayout";
7
- import { Icon } from "../../components/Icon";
2
+ import { useId, useState } from "react";
3
+ import { Icon, InternalTopBar } from "../../../shared/components";
4
+ import { GlobalLayout } from "../../../shared/layouts";
5
+ import { addressLabelToPropMapping } from "../../../shared/utils";
6
+ import type { AddressData } from "../../types";
8
7
 
9
- export type AddressDetailsLayoutProps = { data: AddressData };
8
+ export type AddressDetailsLayoutProps = { data: AddressData | null };
10
9
 
11
- export const AddressDetailsLayout = ({
12
- data: { id, isActive, ...addressData },
13
- }: AddressDetailsLayoutProps) => {
10
+ export const AddressDetailsLayout = ({ data }: AddressDetailsLayoutProps) => {
11
+ // TODO: Implement the AddressDetailsLayout Fallback component
12
+ if (!data) {
13
+ return null;
14
+ }
15
+
16
+ const { id, isActive, ...addressData } = data;
14
17
  const [checked, setChecked] = useState(isActive);
15
18
 
16
19
  const props = Object.keys(addressLabelToPropMapping) as Array<
@@ -104,19 +107,25 @@ export const AddressDetailsLayout = ({
104
107
  </div>
105
108
 
106
109
  <div data-fs-address-details-locations>
107
- {addressData.locations.map((location) => (
108
- <div key={location} data-fs-address-details-location>
109
- <span data-fs-address-details-location-name>{location}</span>
110
- <span data-fs-address-details-location-actions>
111
- <button type="button" data-fs-address-details-location-delete>
112
- <Icon name="Delete" width={24} height={24} />
113
- </button>
114
- <button type="button" data-fs-address-details-location-more>
115
- <Icon name="MoreVert" width={24} height={24} />
116
- </button>
117
- </span>
118
- </div>
119
- ))}
110
+ {addressData.locations.map((location) => {
111
+ const id = useId();
112
+ return (
113
+ <div key={`${location}-${id}`} data-fs-address-details-location>
114
+ <span data-fs-address-details-location-name>{location}</span>
115
+ <span data-fs-address-details-location-actions>
116
+ <button
117
+ type="button"
118
+ data-fs-address-details-location-delete
119
+ >
120
+ <Icon name="Delete" width={24} height={24} />
121
+ </button>
122
+ <button type="button" data-fs-address-details-location-more>
123
+ <Icon name="MoreVert" width={24} height={24} />
124
+ </button>
125
+ </span>
126
+ </div>
127
+ );
128
+ })}
120
129
  </div>
121
130
  </div>
122
131
  </section>
@@ -1,6 +1,6 @@
1
1
  [data-fs-address-details-section] {
2
2
  @import "@faststore/ui/src/components/molecules/Toggle/styles.scss";
3
- @import "../../components/InternalTopbar/internal-top-bar.scss";
3
+ @import "../../../shared/components/InternalTopbar/internal-top-bar.scss";
4
4
 
5
5
  width: 100%;
6
6
 
@@ -1,16 +1,16 @@
1
- import { AddressLine } from "../../components/AddressLine/AddressLine";
2
- import DropdownFilter from "../../components/DropdownFilter/DropdownFilter";
3
- import InternalSearch from "../../components/InternalSearch/InternalSearch";
4
- import { InternalTopBar } from "../../components/InternalTopbar/InternalTopbar";
5
- import SortFilter from "../../components/SortFilter/SortFilter";
6
- import { statusFilters } from "../../utils/search";
7
-
8
- import type { AddressSummaryData } from "../../types/AddressData";
9
- import { GlobalLayout } from "../GlobalLayout/GlobalLayout";
10
- import { Icon } from "../../components/Icon";
11
- import { useQueryParams } from "../../hooks/useQueryParams";
12
- import { DropdownItem, DropdownMenu } from "@faststore/ui";
13
- import { MainLinksDropdownMenu } from "../../components/MainLinksDropdownMenu/MainLinksDropdownMenu";
1
+ import {
2
+ InternalTopBar,
3
+ MainLinksDropdownMenu,
4
+ InternalSearch,
5
+ DropdownFilter,
6
+ SortFilter,
7
+ Icon,
8
+ } from "../../../shared/components";
9
+ import { useQueryParams } from "../../../shared/hooks";
10
+ import { GlobalLayout } from "../../../shared/layouts";
11
+ import { statusFilters } from "../../../shared/utils";
12
+ import { AddressLine } from "../../components";
13
+ import type { AddressSummaryData } from "../../types";
14
14
 
15
15
  export type AddressLayoutProps = {
16
16
  data: AddressSummaryData[];
@@ -1,14 +1,15 @@
1
- @import "../../components/MainLinksDropdownMenu/main-links-dropdown-menu.scss";
1
+ @import "../../../shared/components/MainLinksDropdownMenu/main-links-dropdown-menu.scss";
2
2
 
3
3
  [data-fs-addresses-section] {
4
4
  @import "@faststore/ui/src/components/molecules/Toggle/styles.scss";
5
5
 
6
6
  @import "../../components/AddressLine/address-line.scss";
7
- @import "../../components/InternalSearch/internal-search.scss";
8
- @import "../../components/DropdownFilter/dropdown-filter.scss";
9
- @import "../../components/Tag/tag.scss";
10
- @import "../../components/SortFilter/sort-filter.scss";
11
- @import "../../components/InternalTopbar/internal-top-bar.scss";
7
+
8
+ @import "../../../shared/components/InternalSearch/internal-search.scss";
9
+ @import "../../../shared/components/DropdownFilter/dropdown-filter.scss";
10
+ @import "../../../shared/components/Tag/tag.scss";
11
+ @import "../../../shared/components/SortFilter/sort-filter.scss";
12
+ @import "../../../shared/components/InternalTopbar/internal-top-bar.scss";
12
13
 
13
14
  [data-fs-topbar-actions-wrapper] {
14
15
  display: flex;
@@ -0,0 +1,8 @@
1
+ export {
2
+ AddressDetailsLayout,
3
+ type AddressDetailsLayoutProps,
4
+ } from "./AddressDetailsLayout/AddressDetailsLayout";
5
+ export {
6
+ AddressLayout,
7
+ type AddressLayoutProps,
8
+ } from "./AddressesLayout/AddressesLayout";
@@ -1,4 +1,4 @@
1
- import { AddressData } from "../types/AddressData";
1
+ import type { AddressData } from "../types";
2
2
 
3
3
  export const addressesData: AddressData[] = [
4
4
  {
@@ -0,0 +1 @@
1
+ export { addressesData } from "./addresses-data";
@@ -0,0 +1,11 @@
1
+ import { addressesData } from "../mocks";
2
+ import type { AddressData } from "../types/AddressData";
3
+
4
+ export const getAddressDetailsService = async (
5
+ id: string
6
+ ): Promise<AddressData | null> => {
7
+ // TODO: Need to create get of single address on api
8
+ const addressData =
9
+ addressesData.find((address) => String(address.id) === id) ?? null;
10
+ return addressData;
11
+ };
@@ -1,7 +1,6 @@
1
1
  import type { AddressSummaryData } from "../types/AddressData";
2
- import { statusFilters } from "../utils/search";
3
- import { buyerPortalClient } from "../clients/BuyerPortalClient";
4
- import { compareItems } from "../utils/compareItems";
2
+ import { buyerPortalClient } from "../../../clients/BuyerPortalClient";
3
+ import { compareItems, statusFilters } from "../../shared/utils";
5
4
 
6
5
  export type GetAddressesServiceProps = Partial<{
7
6
  search: string;
@@ -0,0 +1,5 @@
1
+ export { getAddressDetailsService } from "./get-address-details.service";
2
+ export {
3
+ getAddressesService,
4
+ type GetAddressesServiceProps,
5
+ } from "./get-addresses.service";
@@ -0,0 +1 @@
1
+ export { AddressData, AddressSummaryData } from "./AddressData";
@@ -6,9 +6,8 @@ import {
6
6
  DropdownMenu,
7
7
  DropdownButton,
8
8
  } from "@faststore/ui";
9
- import { Icon } from "../Icon";
10
- import { BasicCard } from "../BasicCard/BasicCard";
11
- import type { ContractData } from "../../types/ContractData";
9
+ import type { ContractData } from "../../types";
10
+ import { BasicCard, Icon } from "../../../shared/components";
12
11
 
13
12
  type ContractsCardProps = {
14
13
  orgUnitData?: {
@@ -0,0 +1 @@
1
+ export { default as ContractsCard } from "./ContractsCard/ContractsCard";
File without changes
@@ -1,15 +1,17 @@
1
- import { DropdownMenu, DropdownItem, Toggle } from "@faststore/ui";
2
- import DropdownFilter from "../../components/DropdownFilter/DropdownFilter";
3
- import InternalSearch from "../../components/InternalSearch/InternalSearch";
4
- import { InternalTopBar } from "../../components/InternalTopbar/InternalTopbar";
5
- import SortFilter from "../../components/SortFilter/SortFilter";
6
- import { statusFilters } from "../../utils/search";
1
+ import { Toggle } from "@faststore/ui";
7
2
 
8
3
  import type { ContractData } from "../../types/ContractData";
9
- import { GlobalLayout } from "../GlobalLayout/GlobalLayout";
10
- import { Icon } from "../../components/Icon";
11
- import { useQueryParams } from "../../hooks/useQueryParams";
12
- import { MainLinksDropdownMenu } from "../../components/MainLinksDropdownMenu/MainLinksDropdownMenu";
4
+ import {
5
+ InternalTopBar,
6
+ MainLinksDropdownMenu,
7
+ InternalSearch,
8
+ DropdownFilter,
9
+ SortFilter,
10
+ Icon,
11
+ } from "../../../shared/components";
12
+ import { useQueryParams } from "../../../shared/hooks";
13
+ import { GlobalLayout } from "../../../shared/layouts";
14
+ import { statusFilters } from "../../../shared/utils";
13
15
 
14
16
  export type ContractsLayoutProps = {
15
17
  data: ContractData[];
@@ -1,11 +1,11 @@
1
1
  [data-fs-contracts-section] {
2
2
  @import "@faststore/ui/src/components/molecules/Toggle/styles.scss";
3
3
 
4
- @import "../../components/InternalSearch/internal-search.scss";
5
- @import "../../components/DropdownFilter/dropdown-filter.scss";
6
- @import "../../components/Tag/tag.scss";
7
- @import "../../components/SortFilter/sort-filter.scss";
8
- @import "../../components/InternalTopbar/internal-top-bar.scss";
4
+ @import "../../../shared/components/InternalSearch/internal-search.scss";
5
+ @import "../../../shared/components/DropdownFilter/dropdown-filter.scss";
6
+ @import "../../../shared/components/Tag/tag.scss";
7
+ @import "../../../shared/components/SortFilter/sort-filter.scss";
8
+ @import "../../../shared/components/InternalTopbar/internal-top-bar.scss";
9
9
 
10
10
  [data-fs-contracts-page] {
11
11
  padding: 0 calc(var(--fs-spacing-8) + var(--fs-spacing-0));
@@ -0,0 +1,4 @@
1
+ export {
2
+ ContractsLayout,
3
+ type ContractsLayoutProps,
4
+ } from "./ContractsLayout/ContractsLayout";
@@ -1,4 +1,4 @@
1
- import { ContractData } from "../types/ContractData";
1
+ import type { ContractData } from "../types";
2
2
 
3
3
  export const contractsData: ContractData[] = [
4
4
  // Uncomment to test with a single contract
@@ -0,0 +1 @@
1
+ export { contractsData } from "./contracts-data";
@@ -1,7 +1,6 @@
1
- import { ContractData } from "../types/ContractData";
2
- import { statusFilters } from "../utils/search";
3
- import { buyerPortalClient } from "../clients/BuyerPortalClient";
4
- import { compareItems } from "../utils/compareItems";
1
+ import { buyerPortalClient } from "../../../clients/BuyerPortalClient";
2
+ import { compareItems, statusFilters } from "../../shared/utils";
3
+ import type { ContractData } from "../types";
5
4
 
6
5
  export type GetContractsServiceProps = {
7
6
  search?: string;
@@ -0,0 +1,4 @@
1
+ export {
2
+ getContractsService,
3
+ type GetContractsServiceProps,
4
+ } from "./get-contracts.service";
@@ -6,5 +6,5 @@ export type ContractData = {
6
6
  creationDate: string;
7
7
  salesRepresentative?: string;
8
8
  imageUrl?: string;
9
- assortment?: any[];
9
+ assortment?: unknown[];
10
10
  };
@@ -0,0 +1 @@
1
+ export type { ContractData } from "./ContractData";
@@ -1,12 +1,16 @@
1
1
  import { useState } from "react";
2
- import { AutocompleteDropdown } from "../AutocompleteDropdown/AutocompleteDropdown";
3
- import { BasicDrawer, BasicDrawerProps } from "../BasicDrawer/BasicDrawer";
4
- import { InputText } from "../InputText/InputText";
5
- import { Icon } from "../Icon";
6
- import { ErrorMessage } from "../ErrorMessage/ErrorMessage";
7
- import { useCreateNewOrgUnit } from "../../hooks/useCreateNewOrgUnit";
2
+
8
3
  import { useUI } from "@faststore/ui";
9
4
  import { useRouter } from "next/router";
5
+ import {
6
+ type BasicDrawerProps,
7
+ BasicDrawer,
8
+ AutocompleteDropdown,
9
+ ErrorMessage,
10
+ InputText,
11
+ Icon,
12
+ } from "../../../shared/components";
13
+ import { useCreateNewOrgUnit } from "../../hooks";
10
14
 
11
15
  export type CreateOrgUnitDrawerProps = Omit<BasicDrawerProps, "children"> & {
12
16
  options?: { id: string; name: string }[];
@@ -0,0 +1,6 @@
1
+ @import "../../../shared/components/BasicDrawer/basic-drawer.scss";
2
+
3
+ [data-fs-bp-create-org-unit-drawer] {
4
+ @import "../../../shared/components/InputText/input-text.scss";
5
+ @import "../../../shared/components/ErrorMessage/error-message.scss";
6
+ }
@@ -1,13 +1,18 @@
1
1
  import { useUI } from "@faststore/ui";
2
- import { useChildrenOrgUnits } from "../../hooks/useChildrenOrgUnits";
3
- import { useDeleteOrgUnit } from "../../hooks/useDeleteOrgUnit";
4
- import { useUsersByOrgUnit } from "../../hooks/useUsersByOrgUnit";
5
- import { BasicDrawer, BasicDrawerProps } from "../BasicDrawer/BasicDrawer";
6
- import { Icon } from "../Icon";
7
- import { OrgUnitsHierarchyTree } from "../OrgUnitsHierarchyTree/OrgUnitsHierarchyTree";
8
- import { Tab } from "../Tab/Tab";
2
+
9
3
  import { useRouter } from "next/router";
10
4
 
5
+ import { useDeleteOrgUnit } from "../../hooks/useDeleteOrgUnit";
6
+ import { OrgUnitsHierarchyTree } from "..";
7
+ import { useChildrenOrgUnits } from "../../hooks";
8
+ import { useUsersByOrgUnit } from "../../../users/hooks";
9
+ import {
10
+ BasicDrawer,
11
+ Icon,
12
+ Tab,
13
+ type BasicDrawerProps,
14
+ } from "../../../shared/components";
15
+
11
16
  export type DeleteOrgUnitDrawerProps = Omit<BasicDrawerProps, "children"> & {
12
17
  id: string;
13
18
  name: string;
@@ -116,7 +121,7 @@ export const DeleteOrgUnitDrawer = ({
116
121
  {user.name}
117
122
  </span>
118
123
  <span data-fs-bp-delete-org-unit-drawer-user-org>
119
- {user.orgUnit}
124
+ {user.orgUnit.name}
120
125
  </span>
121
126
  <span data-fs-bp-delete-org-unit-drawer-user-type>
122
127
  {user.userType}
@@ -1,7 +1,7 @@
1
- @import "../BasicDrawer/basic-drawer.scss";
1
+ @import "../../../shared/components/BasicDrawer/basic-drawer.scss";
2
2
 
3
3
  [data-fs-bp-basic-drawer][data-fs-bp-delete-org-unit-drawer] {
4
- @import "../Tab/tab.scss";
4
+ @import "../../../shared/components/Tab/tab.scss";
5
5
  @import "../OrgUnitsHierarchyTree/org-units-hierarchy-tree.scss";
6
6
 
7
7
  &[data-fs-bp-delete-org-unit-drawer-has-content="true"] {
@@ -1,11 +1,13 @@
1
1
  import { DropdownItem, Toggle } from "@faststore/ui";
2
- import { CreateOrgUnitDrawer } from "../CreateOrgUnitDrawer/CreateOrgUnitDrawer";
3
- import { useDrawerProps } from "../../hooks/useDrawerProps";
4
- import { Icon } from "../Icon";
5
- import { DeleteOrgUnitDrawer } from "../DeleteOrgUnitDrawer/DeleteOrgUnitDrawer";
6
- import { UpdateOrgUnitDrawer } from "../UpdateOrgUnitDrawer/UpdateOrgUnitDrawer";
7
2
  import { useRouter } from "next/router";
8
- import { BasicDropdownMenu } from "../BasicDropdownMenu/BasicDropdownMenu";
3
+
4
+ import {
5
+ CreateOrgUnitDrawer,
6
+ DeleteOrgUnitDrawer,
7
+ UpdateOrgUnitDrawer,
8
+ } from "..";
9
+ import { useDrawerProps } from "../../../shared/hooks";
10
+ import { BasicDropdownMenu, Icon } from "../../../shared/components";
9
11
 
10
12
  export type OrgUnitsDropdownMenuProps = {
11
13
  id: string;
@@ -1,4 +1,4 @@
1
- @import "../BasicDropdownMenu/basic-dropdown-menu.scss";
1
+ @import "../../../shared/components/BasicDropdownMenu/basic-dropdown-menu.scss";
2
2
  @import "../UpdateOrgUnitDrawer/update-org-unit-drawer.scss";
3
3
  @import "../CreateOrgUnitDrawer/create-org-unit-drawer.scss";
4
4
  @import "../DeleteOrgUnitDrawer/delete-org-unit-drawer.scss";
@@ -1,11 +1,9 @@
1
- import { Dropdown, DropdownButton, Toggle } from "@faststore/ui";
2
- import { HierarchyTree } from "../HierarchyTree/HierarchyTree";
3
- import { OrgUnitHierarchyData } from "../../types/OrgUnitsData";
4
- import { Icon } from "../Icon";
5
- import { useOrgUnitStructure } from "../../hooks/useOrgUnitStructure";
6
- import { useChildrenOrgUnits } from "../../hooks/useChildrenOrgUnits";
7
- import Link from "next/link";
8
- import { OrgUnitsDropdownMenu } from "../OrgUnitsDropdownMenu/OrgUnitsDropdownMenu";
1
+ import { Link, Toggle, Dropdown, DropdownButton } from "@faststore/ui";
2
+
3
+ import type { OrgUnitHierarchyData } from "../../types";
4
+ import { OrgUnitsDropdownMenu } from "..";
5
+ import { useChildrenOrgUnits, useOrgUnitStructure } from "../../hooks";
6
+ import { HierarchyTree, Icon } from "../../../shared/components";
9
7
 
10
8
  export type OrgUnitsHierarchyTreeProps = {
11
9
  orgUnitHierarchyData: OrgUnitHierarchyData;
@@ -26,7 +24,7 @@ export const OrgUnitsHierarchyTree = ({
26
24
  data-fs-org-units-hierarchy-root
27
25
  >
28
26
  {({ isRoot, isOpen, toggle, isLastNode, name, id }) => {
29
- const { refetchChildrenOrgUnits } = useChildrenOrgUnits(id, {
27
+ useChildrenOrgUnits(id, {
30
28
  onSuccess: (orgUnitHierarchyData) => {
31
29
  orgUnitHierarchyData?.nodes &&
32
30
  setNode(id, orgUnitHierarchyData.nodes);
@@ -45,6 +43,7 @@ export const OrgUnitsHierarchyTree = ({
45
43
  />
46
44
  )}
47
45
  <button
46
+ type="button"
48
47
  data-fs-org-unit-item-toggle
49
48
  disabled={isLastNode}
50
49
  onClick={toggle}
@@ -71,7 +70,10 @@ export const OrgUnitsHierarchyTree = ({
71
70
  {!isRoot && <Toggle id={id} />}
72
71
  <Dropdown>
73
72
  <DropdownButton asChild>
74
- <button data-fs-org-unit-item-content-actions-more-button>
73
+ <button
74
+ type="button"
75
+ data-fs-org-unit-item-content-actions-more-button
76
+ >
75
77
  <Icon name="MoreVert" width={24} height={24} />
76
78
  </button>
77
79
  </DropdownButton>
@@ -1,5 +1,5 @@
1
1
  [data-fs-org-units-hierarchy] {
2
- @import "../HierarchyTree/hierarchy-tree.scss";
2
+ @import "../../../shared/components/HierarchyTree/hierarchy-tree.scss";
3
3
 
4
4
  border-top: var(--fs-border-width) solid #e0e0e0;
5
5
 
@@ -1,11 +1,9 @@
1
1
  import { Toggle, Button, Dropdown, DropdownButton } from "@faststore/ui";
2
+ import { CreateOrgUnitDrawer, OrgUnitsDropdownMenu } from "..";
2
3
 
3
- import { OrgUnitData } from "../../types/OrgUnitsData";
4
- import { Icon } from "../Icon";
5
- import { BasicCard } from "../BasicCard/BasicCard";
6
- import { OrgUnitsDropdownMenu } from "../OrgUnitsDropdownMenu/OrgUnitsDropdownMenu";
7
- import { CreateOrgUnitDrawer } from "../CreateOrgUnitDrawer/CreateOrgUnitDrawer";
8
- import { useDrawerProps } from "../../hooks/useDrawerProps";
4
+ import type { OrgUnitData } from "../../types";
5
+ import { BasicCard, Icon } from "../../../shared/components";
6
+ import { useDrawerProps } from "../../../shared/hooks";
9
7
 
10
8
  type OrganizationalUnitsCardProps = {
11
9
  orgUnitData?: {
@@ -1,12 +1,17 @@
1
1
  import { useState } from "react";
2
- import { BasicDrawer, BasicDrawerProps } from "../BasicDrawer/BasicDrawer";
3
- import { InputText } from "../InputText/InputText";
4
- import { ErrorMessage } from "../ErrorMessage/ErrorMessage";
5
- import { useUI } from "@faststore/ui";
6
- import { useUpdateOrgUnit } from "../../hooks/useUpdateOrgUnit";
7
- import { AutocompleteDropdown } from "../AutocompleteDropdown/AutocompleteDropdown";
8
- import { Icon } from "../Icon";
2
+
9
3
  import { useRouter } from "next/router";
4
+ import { useUI } from "@faststore/ui";
5
+
6
+ import { useUpdateOrgUnit } from "../../hooks";
7
+ import {
8
+ AutocompleteDropdown,
9
+ BasicDrawer,
10
+ type BasicDrawerProps,
11
+ ErrorMessage,
12
+ Icon,
13
+ InputText,
14
+ } from "../../../shared/components";
10
15
 
11
16
  export type UpdateOrgUnitDrawerProps = Omit<BasicDrawerProps, "children"> & {
12
17
  options?: { id: string; name: string }[];
@@ -0,0 +1,6 @@
1
+ @import "../../../shared/components/BasicDrawer/basic-drawer.scss";
2
+
3
+ [data-fs-bp-update-org-unit-drawer] {
4
+ @import "../../../shared/components/InputText/input-text.scss";
5
+ @import "../../../shared/components/ErrorMessage/error-message.scss";
6
+ }