@omniumretail/shared-resources 0.1.67 → 0.1.69

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.
@@ -10,5 +10,5 @@ interface EmployeesWithTimekeepingProps extends UseQueryOptions<ResponseList<"Em
10
10
  sortBy?: string;
11
11
  sortDirection?: string;
12
12
  }
13
- export declare const getEmployeesWithTimekeeping: ({ storeId, date, search, page, records, sortBy, sortDirection }: EmployeesWithTimekeepingProps) => import("@tanstack/react-query").UseQueryResult<ResponseList<"EmployeesWorkLogs", EmployeeTimeKeeping>, unknown>;
13
+ export declare const getEmployeesWithTimekeeping: ({ storeId, date, search, page, records, sortBy, sortDirection }: EmployeesWithTimekeepingProps) => import("@tanstack/react-query").UseQueryResult<ResponseList<"EmployeesWorkLog", EmployeeTimeKeeping>, unknown>;
14
14
  export {};
@@ -0,0 +1,13 @@
1
+ import { UseQueryOptions } from "@tanstack/react-query";
2
+ import { Store, ResponseList } from "../../interfaces";
3
+ interface LocationsByUserQueryProps extends UseQueryOptions<Store> {
4
+ records: number | string;
5
+ sortBy: string;
6
+ sortDirection: string;
7
+ page: number;
8
+ tags?: string;
9
+ advancedTags?: string;
10
+ filter?: any;
11
+ }
12
+ export declare const getLocationsByUserQuery: ({ records, sortBy, sortDirection, tags, advancedTags, filter, page, ...options }: LocationsByUserQueryProps, userId: string) => import("@tanstack/react-query").UseQueryResult<ResponseList<"UserLocations", Store>, unknown>;
13
+ export {};
@@ -0,0 +1,13 @@
1
+ import { UseQueryOptions } from "@tanstack/react-query";
2
+ import { Store, ResponseList } from "../../interfaces";
3
+ interface StoreQueryProps extends UseQueryOptions<Store> {
4
+ records: number | string;
5
+ sortBy: string;
6
+ sortDirection: string;
7
+ page: number;
8
+ tags?: string;
9
+ advancedTags?: string;
10
+ filter?: any;
11
+ }
12
+ export declare const useAllStoreQuery: ({ records, sortBy, sortDirection, tags, advancedTags, filter, page, ...options }: StoreQueryProps) => import("@tanstack/react-query").UseQueryResult<ResponseList<"Locations", Store>, unknown>;
13
+ export {};
@@ -1,5 +1,7 @@
1
1
  export * from './Store/useStoreQuery';
2
2
  export * from './Store/useStoreByCodeQuery.hook';
3
+ export * from './Store/useAllStoreQuery.hook';
4
+ export * from './Store/getLocationsByUser.hook';
3
5
  export * from './EvaluationCycle/get/useEvaluationCycleIdQuery.hook';
4
6
  export * from './EvaluationCycle/mutate/useEvaluationCycleMutateQuery.hook';
5
7
  export * from './EvaluationCycle/others/activateEvaluationCycleQuery.hook';
@@ -39,7 +41,6 @@ export * from './AprProduct/get/useProductsQuery.hook';
39
41
  export * from './AprProduct/get/useProductHierarchies.hook';
40
42
  export * from './AprProduct/get/useProductRecommendations.hook';
41
43
  export * from './AprProduct/get/useProductsByRefQuery.hook';
42
- export * from './Roles/get/useAllStoreQuery.hook';
43
44
  export * from './Roles/get/useAllRolesQuery.hook';
44
45
  export * from './AsvProduct/get/getProductsByRefQuery.hook';
45
46
  export * from './AsvProduct/get/getProductsByStoreQuery.hook';
@@ -1,7 +1,31 @@
1
1
  export interface Store {
2
2
  Id: string;
3
3
  Name: string;
4
- Address: string;
5
4
  City: string;
6
5
  ZipCode: string;
6
+ Code: string;
7
+ CompanyId: string;
8
+ ParentLocationId: string;
9
+ Type: StoreType;
10
+ Address: StoreAdress;
11
+ Phone: string;
12
+ Email: string;
13
+ AdditionalFields: StoreAdditionalFields[];
14
+ Status: string;
15
+ IsSelected: boolean;
16
+ }
17
+ export interface StoreType {
18
+ Id: string;
19
+ Name: string;
20
+ Type: string;
21
+ }
22
+ export interface StoreAdress {
23
+ Street: string;
24
+ CountryISO2: string;
25
+ ZipCode: string;
26
+ City: string;
27
+ }
28
+ export interface StoreAdditionalFields {
29
+ Name: string;
30
+ Value: string;
7
31
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@omniumretail/shared-resources",
3
- "version": "0.1.67",
3
+ "version": "0.1.69",
4
4
  "private": false,
5
5
  "description": "Shared Components and services or utils to the frontend versions",
6
6
  "main": "dist/bundle.js",
@@ -10,7 +10,7 @@ interface EmployeesWithTimekeepingProps extends UseQueryOptions<ResponseList<"Em
10
10
  date?: number;
11
11
  search?: string;
12
12
  page?: number;
13
- records?: number;
13
+ records?: number;
14
14
  sortBy?: string;
15
15
  sortDirection?: string;
16
16
 
@@ -19,12 +19,12 @@ interface EmployeesWithTimekeepingProps extends UseQueryOptions<ResponseList<"Em
19
19
  export const getEmployeesWithTimekeeping = ({storeId, date, search, page, records, sortBy, sortDirection}: EmployeesWithTimekeepingProps) => {
20
20
  return useQuery(
21
21
  ['EMPLOYEES_WITH_TIMEKEEPING', storeId, date, search, page, records, sortBy, sortDirection],
22
- () => getAuth0<ResponseList<"EmployeesWorkLogs", EmployeeTimeKeeping>>('/EmployeesWorklog', {
22
+ () => getAuth0<ResponseList<"EmployeesWorkLog", EmployeeTimeKeeping>>('/ATIM/EmployeesWorklog', {
23
23
  pStoreId: storeId,
24
24
  pDate: date || getDateToUnix(new Date()),
25
25
  pPage: page || 1,
26
26
  pRecords: records || 50,
27
- pSortBy: sortBy || "Name",
27
+ pSortBy: sortBy || "Name" ,
28
28
  pSortDirection: sortDirection || "asc",
29
29
  pSearch: search
30
30
  }),
@@ -13,7 +13,7 @@ export interface PostAttendance extends UseQueryOptions<Attendance>{
13
13
  export const usePostAttendance = ({ storeId, employeeId, isWorking}: PostAttendance) => {
14
14
  const queryClient = useQueryClient();
15
15
  return useMutation<Attendance, unknown, Attendance>((data: Attendance) => {
16
- return postAuth0('/Attendances', {
16
+ return postAuth0('/ATIM/Attendances', {
17
17
  StoreId: storeId,
18
18
  EmployeeId: employeeId,
19
19
  Date: getDateToUnix(new Date()),
@@ -5,7 +5,7 @@ import { post } from '../../../../services/ApiService';
5
5
  export const postVerifyUserQueryHook = () => {
6
6
  const queryClient = useQueryClient();
7
7
  return useMutation<VerifyUser, unknown, VerifyUser>((data: VerifyUser) => {
8
- return post('/Youverse/Verify_User', data);
8
+ return post('/ATIM/Youverse/Verify_User', data);
9
9
  }, {
10
10
  onSuccess: (data: VerifyUser) => {
11
11
  queryClient.setQueryData(
@@ -0,0 +1,39 @@
1
+ import { useQuery, UseQueryOptions } from "@tanstack/react-query";
2
+ import { Store, ResponseList } from "../../interfaces";
3
+ import { get } from "../../services";
4
+
5
+ interface LocationsByUserQueryProps extends UseQueryOptions<Store> {
6
+ records: number | string;
7
+ sortBy: string;
8
+ sortDirection: string;
9
+ page: number;
10
+ tags?: string;
11
+ advancedTags?: string;
12
+ filter?: any;
13
+ }
14
+
15
+ export const getLocationsByUserQuery = ({ records, sortBy, sortDirection, tags, advancedTags, filter, page, ...options }: LocationsByUserQueryProps, userId: string) => {
16
+ const pQueryValue = advancedTags && filter
17
+ ? `${advancedTags} and ${filter}`
18
+ : advancedTags
19
+ ? advancedTags
20
+ : filter
21
+ ? filter
22
+ : null;
23
+
24
+ return useQuery(['LOCATIONS_BY_USER_QUERY', records, sortBy, sortDirection, tags, advancedTags, filter, page, userId],
25
+ () => get<ResponseList<"UserLocations", Store>>(`/AACP/Users/${userId}/Locations`, {
26
+ pPage: page || 1,
27
+ pRecords: records || 50,
28
+ pSortBy: sortBy,
29
+ pSortDirection: sortDirection,
30
+ pTerms: tags,
31
+ ...(pQueryValue ? { pQuery: pQueryValue } : {}),
32
+ }),
33
+ {
34
+ keepPreviousData: true,
35
+ }
36
+ );
37
+ }
38
+
39
+
@@ -1,6 +1,6 @@
1
1
  import { useQuery, UseQueryOptions } from "@tanstack/react-query";
2
- import { Store, ResponseList } from "../../../interfaces";
3
- import { get } from "../../../services";
2
+ import { Store, ResponseList } from "../../interfaces";
3
+ import { get } from "../../services";
4
4
 
5
5
  interface StoreQueryProps extends UseQueryOptions<Store> {
6
6
  records: number | string;
@@ -1,6 +1,8 @@
1
1
  //Stores
2
2
  export * from './Store/useStoreQuery';
3
3
  export * from './Store/useStoreByCodeQuery.hook'
4
+ export * from './Store/useAllStoreQuery.hook';
5
+ export * from './Store/getLocationsByUser.hook';
4
6
 
5
7
  //EvaluationCycle
6
8
  export * from './EvaluationCycle/get/useEvaluationCycleIdQuery.hook';
@@ -54,7 +56,6 @@ export * from './AprProduct/get/useProductRecommendations.hook';
54
56
  export * from './AprProduct/get/useProductsByRefQuery.hook';
55
57
 
56
58
  //Roles
57
- export * from './Roles/get/useAllStoreQuery.hook';
58
59
  export * from './Roles/get/useAllRolesQuery.hook';
59
60
 
60
61
  //AsvProduct
@@ -2,7 +2,34 @@
2
2
  export interface Store {
3
3
  Id: string;
4
4
  Name: string;
5
- Address: string;
6
5
  City: string;
7
6
  ZipCode: string;
7
+ Code: string;
8
+ CompanyId: string;
9
+ ParentLocationId: string;
10
+ Type: StoreType;
11
+ Address: StoreAdress;
12
+ Phone: string;
13
+ Email: string;
14
+ AdditionalFields: StoreAdditionalFields[];
15
+ Status: string;
16
+ IsSelected: boolean;
8
17
  }
18
+
19
+ export interface StoreType {
20
+ Id: string;
21
+ Name: string;
22
+ Type: string;
23
+ }
24
+
25
+ export interface StoreAdress {
26
+ Street: string;
27
+ CountryISO2: string;
28
+ ZipCode: string;
29
+ City: string;
30
+ }
31
+
32
+ export interface StoreAdditionalFields {
33
+ Name: string;
34
+ Value: string;
35
+ }