@omniumretail/shared-resources 0.1.9 → 0.1.11

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.
@@ -2,10 +2,10 @@ import { UseQueryOptions } from "@tanstack/react-query";
2
2
  import { Roles, ResponseList } from "../../../interfaces";
3
3
  interface RolesQueryProps extends UseQueryOptions<ResponseList<"Roles", Roles>> {
4
4
  records: number | string;
5
+ page: number;
5
6
  sortBy: string;
6
7
  sortDirection: string;
7
8
  tags?: string;
8
- page: number;
9
9
  }
10
10
  export declare const useAllRolesQuery: ({ records, sortBy, sortDirection, tags, page, ...options }: RolesQueryProps) => import("@tanstack/react-query").UseQueryResult<ResponseList<"Roles", Roles>, unknown>;
11
11
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@omniumretail/shared-resources",
3
- "version": "0.1.09",
3
+ "version": "0.1.11",
4
4
  "private": false,
5
5
  "description": "Shared Components and services or utils to the frontend versions",
6
6
  "main": "dist/bundle.js",
@@ -5,6 +5,6 @@ import { getAuth0 } from "../../services/ApiService";
5
5
  export const useApplicationDataQueryHook = () => {
6
6
  return useQuery(
7
7
  ['APPLICATIONS_QUERY'],
8
- () => getAuth0<ResponseList<"Categories", ApplicationsByCategory>>('/AACP/Applications/groupByCategory')
8
+ () => getAuth0<ResponseList<"Categories", ApplicationsByCategory>>('/Applications/groupByCategory')
9
9
  );
10
10
  }
@@ -9,6 +9,6 @@ interface ContractStatesQueryProps extends UseQueryOptions<ContractStates> {
9
9
  export const useContractStatesQuery = ({ records }: ContractStatesQueryProps) => {
10
10
  return useQuery(
11
11
  ['CONTRACTSTATES_QUERY', records],
12
- () => getAuth0<ResponseList<"ContractStates", ContractStates>>(`/AACP/ContractStates`, { pPage: 1, pRecords: records || 195 })
12
+ () => getAuth0<ResponseList<"ContractStates", ContractStates>>(`/ContractStates`, { pPage: 1, pRecords: records || 195 })
13
13
  );
14
14
  }
@@ -9,6 +9,6 @@ interface JobTitlesQueryProps extends UseQueryOptions<JobTitles> {
9
9
  export const useJobTitlesQuery = ({ records }: JobTitlesQueryProps) => {
10
10
  return useQuery(
11
11
  ['JOBTITLES_QUERY', records],
12
- () => getAuth0<ResponseList<"JobTitles", JobTitles>>(`/AACP/JobTitles`, { pPage: 1, pRecords: records || 195 })
12
+ () => getAuth0<ResponseList<"JobTitles", JobTitles>>(`/JobTitles`, { pPage: 1, pRecords: records || 195 })
13
13
  );
14
14
  }
@@ -4,16 +4,16 @@ import { getAuth0 } from "../../../services";
4
4
 
5
5
  interface RolesQueryProps extends UseQueryOptions<ResponseList<"Roles", Roles>> {
6
6
  records: number | string;
7
+ page: number;
7
8
  sortBy: string;
8
9
  sortDirection: string;
9
10
  tags?: string;
10
- page: number;
11
11
  }
12
12
 
13
13
  export const useAllRolesQuery = ({ records, sortBy, sortDirection, tags, page, ...options }: RolesQueryProps) => {
14
14
  const queryKey = ['ROLES_QUERY', records, sortBy, sortDirection, tags, page];
15
15
 
16
- const queryFn = () => getAuth0<ResponseList<"Roles", Roles>>(`/AACP/Roles`, {
16
+ const queryFn = () => getAuth0<ResponseList<"Roles", Roles>>(`/Roles`, {
17
17
  pPage: page || 1,
18
18
  pRecords: records || 50,
19
19
  pSortBy: sortBy,
@@ -5,7 +5,7 @@ import { getAuth0 } from "../../../services/ApiService";
5
5
  export const useSingleUserIdQueryHook = (userId: string) => {
6
6
  return useQuery(
7
7
  ['SINGLE_USER_ID_QUERY', userId],
8
- () => getAuth0<User>(`/AACP/Users/${userId}`),
8
+ () => getAuth0<User>(`/Users/${userId}`),
9
9
  {
10
10
  enabled: !!(userId),
11
11
  },
@@ -14,7 +14,7 @@ export interface UserListQuery extends UseQueryOptions<ResponseList<"Users", Use
14
14
  export const useUserListQueryHook = ({ tags, page, records, queryField, sortBy, sortDirection }: UserListQuery) => {
15
15
  return useQuery(
16
16
  ['USER_LIST_QUERY', tags, page, records, sortBy, sortDirection, queryField],
17
- () => getAuth0<ResponseList<"Users", User>>('/AACP/Users', {
17
+ () => getAuth0<ResponseList<"Users", User>>('/Users', {
18
18
  pPage: page || 1,
19
19
  pRecords: records || 50,
20
20
  pSortBy: sortBy || 'DisplayName',
@@ -7,8 +7,8 @@ export const useSingleUserIdMutateQuery = (bodyType?: string) => {
7
7
  return useMutation<SingleUser, unknown, SingleUser>((data: SingleUser | any) => {
8
8
  const userId = bodyType === 'formdata' ? data.get('UserId') : data.UserId
9
9
  return userId
10
- ? putAuth0(`/AACP/Users/${userId}`, undefined, data, bodyType)
11
- : postAuth0('/AACP/Users/', undefined, data, bodyType);
10
+ ? putAuth0(`/Users/${userId}`, undefined, data, bodyType)
11
+ : postAuth0('/Users/', undefined, data, bodyType);
12
12
  }, {
13
13
  onSuccess: (data: SingleUser) => {
14
14
  queryClient.setQueryData(
@@ -9,7 +9,7 @@ interface UserWithResetPasswordURL extends User {
9
9
  export const useSingleUserResetPasswordHook = () => {
10
10
  const queryClient = useQueryClient();
11
11
  return useMutation<UserWithResetPasswordURL, unknown, UserWithResetPasswordURL>((data: UserWithResetPasswordURL) => {
12
- return postAuth0(`/AACP/Users/${data.UserId}/resetPassword`);
12
+ return postAuth0(`/Users/${data.UserId}/resetPassword`);
13
13
  }, {
14
14
  onSuccess: (data: UserWithResetPasswordURL) => {
15
15
  queryClient.setQueryData(['USER_RESET_PASSWORD_QUERY'], data);
@@ -5,7 +5,7 @@ import { putAuth0 } from "../../../services/ApiService";
5
5
  export const useUserBlockQueryHook = () => {
6
6
  const queryClient = useQueryClient();
7
7
  return useMutation<User, unknown, User>((data: User) => {
8
- return putAuth0(`/AACP/Users/${data.UserId}/block`)
8
+ return putAuth0(`/Users/${data.UserId}/block`)
9
9
  }, {
10
10
  onSuccess: (data: User) => {
11
11
  queryClient.setQueryData(
@@ -5,7 +5,7 @@ import { postAuth0 } from "../../../services/ApiService";
5
5
  export const useUserEmailVerifQueryHook = () => {
6
6
  const queryClient = useQueryClient();
7
7
  return useMutation<User, unknown, User>((data: User) => {
8
- return postAuth0(`/AACP/Users/${data.UserId}/sendVerificationEmail`)
8
+ return postAuth0(`/Users/${data.UserId}/sendVerificationEmail`)
9
9
  }, {
10
10
  onSuccess: (data: User) => {
11
11
  queryClient.setQueryData(
@@ -5,7 +5,7 @@ import { postAuth0 } from "../../../services/ApiService";
5
5
  export const useUserResetPassByEmailHook = () => {
6
6
  const queryClient = useQueryClient();
7
7
  return useMutation<User, unknown, User>((data: User) => {
8
- return postAuth0(`/AACP/Users/${data.UserId}/resetPasswordEmail`);
8
+ return postAuth0(`/Users/${data.UserId}/resetPasswordEmail`);
9
9
  }, {
10
10
  onSuccess: (data: User) => {
11
11
  queryClient.setQueryData(['USER_RESET_PASSWORD_BY_EMAIL_QUERY'], data);
@@ -13,7 +13,7 @@ export const putAuth0 = <T>(path: string, params?: Record<string, unknown>, body
13
13
  return buildApiRequestForAuth0<T>(`${path}${buildParams(params || {})}`, 'PUT', body, bodyType);
14
14
  }
15
15
 
16
- export const postAuth0 = <T>(path: string, params?: Record<string, unknown>, body?: unknown,bodyType?: string): Promise<T> => {
16
+ export const postAuth0 = <T>(path: string, params?: Record<string, unknown>, body?: unknown, bodyType?: string): Promise<T> => {
17
17
  return buildApiRequestForAuth0<T>(`${path}${buildParams(params || {})}`, 'POST', body, bodyType);
18
18
  }
19
19
 
@@ -91,9 +91,6 @@ const buildApiRequestForAuth0 = <T>(path: string, method = 'GET', data?: unknown
91
91
  Authorization: appConfig.tokenAuth0 ? `Bearer ${appConfig.tokenAuth0}` : undefined,
92
92
  };
93
93
 
94
- console.log(appConfig.tokenAuth0);
95
- console.log(headers);
96
-
97
94
  let body: FormData | string | undefined | any;
98
95
 
99
96
  if (['POST', 'PUT'].includes(method)) {