@vtex/faststore-plugin-buyer-portal 1.0.38 → 1.0.39

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vtex/faststore-plugin-buyer-portal",
3
- "version": "1.0.38",
3
+ "version": "1.0.39",
4
4
  "description": "A plugin for faststore with buyer portal",
5
5
  "main": "index.js",
6
6
  "dependencies": {
@@ -7,17 +7,6 @@ class ContractsClient extends Client {
7
7
  super(getApiUrl());
8
8
  }
9
9
 
10
- getContractsByCustomerId(customerId: string, cookie: string) {
11
- return this.get<{ data: { contracts: ContractData[]; total: number } }>(
12
- `contracts/${customerId}/list`,
13
- {
14
- headers: {
15
- Cookie: cookie,
16
- },
17
- }
18
- );
19
- }
20
-
21
10
  getContractsByOrgUnitId(orgUnitId: string, cookie: string) {
22
11
  return this.get<{ contracts: ContractData[]; total: number }>(
23
12
  `contracts/${orgUnitId}`,
@@ -1,8 +1,3 @@
1
- export {
2
- getContractsByCustomerIdService,
3
- type GetContractsByCustomerIdServiceProps,
4
- } from "./get-contracts-by-customer-id.service";
5
-
6
1
  export {
7
2
  getContractsByOrgUnitIdService,
8
3
  type GetContractsByOrgUnitIdServiceProps,
@@ -27,17 +27,6 @@ export class OrgUnitClient extends Client {
27
27
  });
28
28
  }
29
29
 
30
- getRootOrgUnitByCustomerId(customerId: string, cookie: string) {
31
- return this.get<{ organizationalUnits: OrgUnitData[]; total: number }>(
32
- `units/root/${customerId}`,
33
- {
34
- headers: {
35
- Cookie: cookie,
36
- },
37
- }
38
- );
39
- }
40
-
41
30
  getOrgUnitByUserId(userId: string, cookie: string) {
42
31
  return this.get<{
43
32
  orgUnit: {
@@ -1,7 +1,6 @@
1
1
  export { useCreateNewOrgUnit } from "./useCreateNewOrgUnit";
2
2
  export { useDeleteOrgUnit } from "./useDeleteOrgUnit";
3
3
  export { useOrgUnitStructure } from "./useOrgUnitStructure";
4
- export { useRootOrgUnitByCustomerId } from "./useRootOrgUnitByCustomer";
5
4
  export { useUpdateOrgUnit } from "./useUpdateOrgUnit";
6
5
  export { useChildrenOrgUnits } from "./useChildrenOrgUnits";
7
6
  export { useOrgUnitByUser } from "./useOrgUnitByUser";
@@ -14,10 +14,6 @@ export {
14
14
  getOrgUnitSummaryService,
15
15
  } from "./get-org-unit-summary.service";
16
16
  export { getOrganizationService } from "./get-organization.service";
17
- export {
18
- type GetRootOrgUnitByCustomerIdServiceProps,
19
- getRootOrgUnitByCustomerIdService,
20
- } from "./get-root-org-unit-by-customer-id.service";
21
17
  export {
22
18
  type UpdateOrgUnitServiceProps,
23
19
  updateOrgUnitService,
@@ -1,37 +0,0 @@
1
- import { contractsClient } from "../clients/ContractsClient";
2
- import type { ContractData } from "../types";
3
-
4
- export type GetContractsByCustomerIdServiceProps = {
5
- search?: string;
6
- customerId?: string;
7
- status?: string;
8
- sort?: string;
9
- cookie: string;
10
- };
11
-
12
- export const getContractsByCustomerIdService = async ({
13
- search = "",
14
- customerId,
15
- status,
16
- sort,
17
- cookie,
18
- }: GetContractsByCustomerIdServiceProps): Promise<ContractData[]> => {
19
- const contractsData: ContractData[] = [];
20
-
21
- if (!customerId) {
22
- return contractsData;
23
- }
24
-
25
- try {
26
- const {
27
- data: { contracts },
28
- } = await contractsClient.getContractsByCustomerId(customerId, cookie);
29
-
30
- contractsData.push(...contracts);
31
- } catch (err) {
32
- console.error("Failed to fetch contracts", err);
33
- return contractsData;
34
- }
35
-
36
- return contractsData;
37
- };
@@ -1,19 +0,0 @@
1
- import { type QueryOptions, useQuery } from "../../shared/hooks";
2
- import { getRootOrgUnitByCustomerIdService } from "../services";
3
-
4
- export const useRootOrgUnitByCustomerId = (
5
- customerId: string,
6
- options?: QueryOptions<AwaitedType<typeof getRootOrgUnitByCustomerIdService>>
7
- ) => {
8
- const { data, error, isLoading, refetch } = useQuery(
9
- `units/root/${customerId}`,
10
- ({ cookie }) => getRootOrgUnitByCustomerIdService({ customerId }, cookie),
11
- options
12
- );
13
- return {
14
- rootOrgUnit: data,
15
- hasRootOrgUnitError: error,
16
- isRootOrgUnitLoading: isLoading,
17
- refetchRootOrgUnit: refetch,
18
- };
19
- };
@@ -1,10 +0,0 @@
1
- import { orgUnitClient } from "../clients/OrgUnitClient";
2
-
3
- export type GetRootOrgUnitByCustomerIdServiceProps = {
4
- customerId: string;
5
- };
6
-
7
- export const getRootOrgUnitByCustomerIdService = async (
8
- { customerId }: GetRootOrgUnitByCustomerIdServiceProps,
9
- cookie: string
10
- ) => orgUnitClient.getRootOrgUnitByCustomerId(customerId, cookie);