@omniumretail/shared-resources 0.2.24 → 0.2.26

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.
@@ -0,0 +1,11 @@
1
+ import { UseQueryOptions } from '@tanstack/react-query';
2
+ import { ResponseList, UserBackoffice } from '../../../../interfaces';
3
+ interface EmployeeQueryOptions extends UseQueryOptions<ResponseList<'Users', UserBackoffice>> {
4
+ query?: string;
5
+ page?: number;
6
+ records?: number;
7
+ sortBy?: string;
8
+ sortDirection?: string;
9
+ }
10
+ export declare const useEmployeeQueryHook: ({ query, page, records, sortBy, sortDirection, ...options }: EmployeeQueryOptions) => import("@tanstack/react-query").UseQueryResult<ResponseList<"Users", UserBackoffice>, unknown>;
11
+ export {};
@@ -0,0 +1,14 @@
1
+ import { UseQueryOptions } from '@tanstack/react-query';
2
+ import { ResponseList, EmployeesWorklog } from '../../../../interfaces';
3
+ interface EmployeesWithTimekeepingProps extends UseQueryOptions<ResponseList<"EmployeesWorkLog", EmployeesWorklog>> {
4
+ storeId?: string;
5
+ startDate?: number;
6
+ endDate?: number;
7
+ search?: string;
8
+ page?: number;
9
+ records?: number;
10
+ sortBy?: string;
11
+ sortDirection?: string;
12
+ }
13
+ export declare const useEmployeeWorklogDetails: ({ storeId, startDate, endDate, search, page, records, sortBy, sortDirection, ...options }: EmployeesWithTimekeepingProps) => import("@tanstack/react-query").UseQueryResult<ResponseList<"EmployeesWorklog", EmployeesWorklog>, unknown>;
14
+ export {};
@@ -0,0 +1,8 @@
1
+ import { AstsStock } from "../../../interfaces";
2
+ export declare const getProductInfoQueryHook: (barcode: string) => import("@tanstack/react-query").UseQueryResult<{
3
+ Product: AstsStock;
4
+ ProductList: AstsStock[];
5
+ Color: string[];
6
+ Size: string[];
7
+ Size2: string[];
8
+ }, unknown>;
@@ -1,15 +1,7 @@
1
1
  import { UseQueryOptions } from "@tanstack/react-query";
2
- import { AstsStock, ResponseList } from "../../../interfaces";
3
- export interface StockQueryProps extends UseQueryOptions<ResponseList<"", AstsStock>> {
4
- page?: number;
5
- records?: number;
6
- sortBy?: string;
7
- sortDirection?: string;
8
- storeCode?: string;
9
- size?: string;
10
- color?: string;
2
+ import { AstsStockInfo } from "../../../interfaces";
3
+ export interface StockQueryProps extends UseQueryOptions<AstsStockInfo[]> {
11
4
  reference?: string;
12
- userId?: string;
13
- barcode?: string;
5
+ countryId?: string;
14
6
  }
15
- export declare const getStockQueryHook: ({ page, records, sortBy, sortDirection, storeCode, size, color, reference, userId, barcode }: StockQueryProps) => import("@tanstack/react-query").UseQueryResult<ResponseList<"", AstsStock>, unknown>;
7
+ export declare const getStockQueryHook: ({ reference, countryId }: StockQueryProps) => import("@tanstack/react-query").UseQueryResult<AstsStockInfo[], unknown>;
@@ -51,7 +51,7 @@ export * from './AsvProduct/get/getProductsStockDetailsQuery.hook';
51
51
  export * from './Ass/get/getAssProductsByRefQuery.hook';
52
52
  export * from './Ass/get/getAssProductsByStoreQuery.hook';
53
53
  export * from './Ass/get/getAssProductsStockDetailsQuery.hook';
54
- export * from './Asts/get/getStockInfoQuery.hook';
54
+ export * from './Asts/get/getProductInfoQuery.hook';
55
55
  export * from './Asts/get/getStockQuery.hook';
56
56
  export * from './Astt/get/getTransferDocumentsQuery.hook';
57
57
  export * from './Astt/get/getTransferDocumentsByIdQuery.hook';
@@ -120,7 +120,8 @@ export * from './OSUA/get/vouchers/getVoucherIntegrationRequestStatus.hook';
120
120
  export * from './OSUA/mutate/postCreateIntegrationRequest.hook';
121
121
  export * from './ACB/get/getClientBalance.hook';
122
122
  export * from './ACB/mutate/postClientBalance.hook';
123
- export * from './ATIM/BackOffice/get/useEmployeeTimekeepingDetails.hook';
123
+ export * from './ATIM/BackOffice/get/useEmployeeWorklogDetails.hook';
124
+ export * from './ATIM/BackOffice/get/useEmployeeQueryHook.hook';
124
125
  export * from './ATIM/BackOffice/get/useStoresQueryHook.hook';
125
126
  export * from './ATIM/BackOffice/mutate/postAttendanceRange.hook';
126
127
  export * from './Others/useJobTitlesQuery.hook';
@@ -1,14 +1,16 @@
1
1
  export interface AstsStock {
2
- StoreCode: number;
2
+ Id: string;
3
+ ParentName: string;
4
+ ParentDescription: string;
3
5
  Name: string;
4
6
  Description: string;
7
+ Barcode: string;
5
8
  Reference: string;
6
- Ean: string;
7
- Image: string;
9
+ InternalReference: string;
10
+ Sku: string;
8
11
  Size: string;
9
- StockQty: number;
10
- LegSize: string;
11
- StockOnlineQty: number;
12
12
  Color: string;
13
- StoreName: string;
13
+ Image: string;
14
+ Price: number;
15
+ Company: string;
14
16
  }
@@ -1,5 +1,12 @@
1
1
  export interface AstsStockInfo {
2
- Stores: string[];
3
- Sizes: string[];
4
- Colors: string[];
2
+ StoreCode: string;
3
+ Stocks: StockInterface[];
4
+ }
5
+ export interface StockInterface {
6
+ SKU: string;
7
+ Values: {
8
+ ValueStore: string;
9
+ ValueOnline: string;
10
+ ValueWarehouse: string;
11
+ };
5
12
  }
@@ -32,4 +32,5 @@ export interface Location {
32
32
  export interface UserBackoffice {
33
33
  UserId: string;
34
34
  FullName: string;
35
+ DisplayName: string;
35
36
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@omniumretail/shared-resources",
3
- "version": "0.2.24",
3
+ "version": "0.2.26",
4
4
  "private": false,
5
5
  "description": "Shared Components and services or utils to the frontend versions",
6
6
  "main": "dist/bundle.js",
@@ -0,0 +1,30 @@
1
+ import { useQuery, UseQueryOptions } from '@tanstack/react-query';
2
+ import { getAuth0 } from '../../../../services/ApiService';
3
+ import { Store, ResponseList, UserBackoffice } from '../../../../interfaces';
4
+
5
+ interface EmployeeQueryOptions extends UseQueryOptions<ResponseList<'Users', UserBackoffice >> {
6
+ query?: string;
7
+ page?: number;
8
+ records?: number;
9
+ sortBy?: string;
10
+ sortDirection?: string;
11
+ }
12
+
13
+ export const useEmployeeQueryHook = ({ query, page, records, sortBy, sortDirection, ...options }: EmployeeQueryOptions) => {
14
+ return useQuery<ResponseList<'Users', UserBackoffice >>(
15
+ ['EMPLOYEES_QUERY', query, page, records, sortBy, sortDirection],
16
+ () =>
17
+ getAuth0('/AACP/Users', {
18
+ pPage: page,
19
+ pRecords: records,
20
+ pSortBy: sortBy,
21
+ pSortDirection: sortDirection,
22
+ pQuery: query ,
23
+ }),
24
+ {
25
+
26
+ ...options
27
+ }
28
+ );
29
+ };
30
+
@@ -1,6 +1,6 @@
1
1
  import { useQuery , UseQueryOptions} from '@tanstack/react-query';
2
2
  import { getDateToUnix } from "../../../../helpers/date-unix.helper";
3
- import { getAuth0 } from "../../../../services/ApiService";
3
+ import { get, getAuth0} from "../../../../services/ApiService";
4
4
  import { ResponseList, EmployeesWorklog } from '../../../../interfaces';
5
5
 
6
6
 
@@ -13,26 +13,29 @@ interface EmployeesWithTimekeepingProps extends UseQueryOptions<ResponseList<"Em
13
13
  records?: number;
14
14
  sortBy?: string;
15
15
  sortDirection?: string;
16
- employeeId?: string;
16
+
17
+
17
18
 
18
19
  }
19
20
 
20
- export const useEmployeeTimekeepingDetails = ({storeId, startDate, endDate, search, employeeId, page, records, sortBy, sortDirection, ...options}: EmployeesWithTimekeepingProps) => {
21
- return useQuery(
21
+ export const useEmployeeWorklogDetails = ({storeId, startDate, endDate, search, page, records, sortBy, sortDirection, ...options}: EmployeesWithTimekeepingProps) => {
22
+ return useQuery<ResponseList<"EmployeesWorklog", EmployeesWorklog>>(
22
23
  ['EMPLOYEES_WITH_TIMEKEEPING', storeId, startDate, endDate, search, page, records, sortBy, sortDirection],
23
24
  () => getAuth0<ResponseList<"EmployeesWorklog", EmployeesWorklog>>('/ATIM/EmployeesWorklogDetails', {
24
25
  pStoreId: storeId,
25
- pStartDate: startDate || getDateToUnix(new Date()),
26
- pEndDate: endDate || getDateToUnix(new Date()),
27
- pEmployeeId: employeeId,
28
26
  pPage: page || 1,
29
27
  pRecords: records,
28
+ pStartDate: startDate || getDateToUnix(new Date()),
29
+ pEndDate: endDate || getDateToUnix(new Date()),
30
30
  pSortBy: sortBy,
31
31
  pSortDirection: sortDirection,
32
- pSearch: search
32
+ pDisplayName: search,
33
+
33
34
  }),
34
35
  {
35
- keepPreviousData: true,
36
+ suspense: false,
37
+ enabled: (!!storeId && !!startDate && !!endDate),
38
+
36
39
  }
37
40
  );
38
41
  }
@@ -0,0 +1,15 @@
1
+ import { useQuery } from "@tanstack/react-query";
2
+ import { AstsStock } from "../../../interfaces";
3
+ import { getAuth0 } from "../../../services/ApiService";
4
+
5
+ export const getProductInfoQueryHook = (barcode: string) => {
6
+ return useQuery(
7
+ ['ASTS_PRODUCT_INFO_QUERY', barcode],
8
+ () => getAuth0<{ Product: AstsStock, ProductList: AstsStock[], Color: string[], Size: string[], Size2: string[] }>(`/ASTS/Product`, {
9
+ pBarcode: barcode
10
+ }),
11
+ {
12
+ enabled: !!(barcode),
13
+ },
14
+ );
15
+ }
@@ -1,34 +1,18 @@
1
1
  import { useQuery, UseQueryOptions } from "@tanstack/react-query";
2
- import { AstsStock, ResponseList } from "../../../interfaces";
2
+ import { AstsStockInfo } from "../../../interfaces";
3
3
  import { getAuth0 } from "../../../services/ApiService";
4
4
 
5
- export interface StockQueryProps extends UseQueryOptions<ResponseList<"", AstsStock>> {
6
- page?: number;
7
- records?: number;
8
- sortBy?: string;
9
- sortDirection?: string;
10
- storeCode?: string;
11
- size?: string;
12
- color?: string;
5
+ export interface StockQueryProps extends UseQueryOptions<AstsStockInfo[]> {
13
6
  reference?: string;
14
- userId?: string;
15
- barcode?: string;
7
+ countryId?: string;
16
8
  }
17
9
 
18
- export const getStockQueryHook = ({ page, records, sortBy, sortDirection, storeCode, size, color, reference, userId, barcode }: StockQueryProps) => {
10
+ export const getStockQueryHook = ({ reference, countryId }: StockQueryProps) => {
19
11
  return useQuery(
20
- ['ASTS_STOCK_QUERY', page, records, sortBy, sortDirection, storeCode, size, color, reference, userId, barcode],
21
- () => getAuth0<ResponseList<"", AstsStock>>('/ASTS/Stock', {
22
- pPage: page || 1,
23
- pRecords: records || 50,
24
- pSortBy: sortBy || 'Reference',
25
- pSortDirection: sortDirection || 'asc',
26
- pStoreCode: storeCode,
27
- pSize: size,
28
- pColor: color,
12
+ ['ASTS_STOCK_QUERY', reference, countryId],
13
+ () => getAuth0<AstsStockInfo[]>('/ASTS/Stock', {
29
14
  pReference: reference,
30
- pUserId: userId,
31
- pBarcode: barcode
15
+ pCountryId: countryId || "PT"
32
16
  })
33
17
  );
34
18
  }
@@ -72,7 +72,7 @@ export * from './Ass/get/getAssProductsByStoreQuery.hook';
72
72
  export * from './Ass/get/getAssProductsStockDetailsQuery.hook';
73
73
 
74
74
  //ASTS
75
- export * from './Asts/get/getStockInfoQuery.hook';
75
+ export * from './Asts/get/getProductInfoQuery.hook';
76
76
  export * from './Asts/get/getStockQuery.hook';
77
77
 
78
78
  //Astt
@@ -154,23 +154,18 @@ export * from './OSUA/get/documentos/getSitooDocumentos.hook';
154
154
  export * from './OSUA/get/vouchers/getGngVoucher.hook';
155
155
  export * from './OSUA/get/vouchers/getSitooVouchers.hook';
156
156
  export * from './OSUA/get/vouchers/getVoucherIntegrationRequestStatus.hook';
157
-
158
157
  export * from './OSUA/mutate/postCreateIntegrationRequest.hook';
159
158
 
160
159
  //ACB
161
160
  export * from './ACB/get/getClientBalance.hook';
162
161
  export * from './ACB/mutate/postClientBalance.hook';
163
162
 
164
-
165
-
166
163
  //BackofficeAtim
167
-
168
- export * from './ATIM/BackOffice/get/useEmployeeTimekeepingDetails.hook';
169
-
164
+ export * from './ATIM/BackOffice/get/useEmployeeWorklogDetails.hook';
165
+ export * from './ATIM/BackOffice/get/useEmployeeQueryHook.hook';
170
166
  export * from './ATIM/BackOffice/get/useStoresQueryHook.hook';
171
167
  export * from './ATIM/BackOffice/mutate/postAttendanceRange.hook';
172
168
 
173
-
174
169
  //Others
175
170
  export * from './Others/useJobTitlesQuery.hook';
176
171
  export * from './Others/useContractStatesQuery.hook';
@@ -1,15 +1,17 @@
1
1
 
2
2
  export interface AstsStock {
3
- StoreCode: number;
3
+ Id: string;
4
+ ParentName: string;
5
+ ParentDescription: string;
4
6
  Name: string;
5
7
  Description: string;
8
+ Barcode: string;
6
9
  Reference: string;
7
- Ean: string;
8
- Image: string;
10
+ InternalReference: string;
11
+ Sku: string;
9
12
  Size: string;
10
- StockQty: number;
11
- LegSize: string;
12
- StockOnlineQty: number;
13
13
  Color: string;
14
- StoreName: string;
14
+ Image: string;
15
+ Price: number;
16
+ Company: string;
15
17
  }
@@ -1,6 +1,14 @@
1
1
 
2
2
  export interface AstsStockInfo {
3
- Stores: string[];
4
- Sizes: string[];
5
- Colors: string[];
3
+ StoreCode: string;
4
+ Stocks: StockInterface[];
5
+ }
6
+
7
+ export interface StockInterface {
8
+ SKU: string;
9
+ Values: {
10
+ ValueStore: string;
11
+ ValueOnline: string;
12
+ ValueWarehouse: string;
13
+ }
6
14
  }
@@ -1,7 +1,3 @@
1
- import { Store } from './Store';
2
-
3
-
4
-
5
1
  export interface WorkLogDetail {
6
2
  Id: string;
7
3
  Type: number;
@@ -29,6 +25,7 @@ export interface EmployeesWorklog {
29
25
  TimeWorked: number;
30
26
  Breaks: Breaks;
31
27
  WorkDayLogs: WorkDayLog[];
28
+
32
29
  }
33
30
 
34
31
 
@@ -43,6 +40,6 @@ export interface Location {
43
40
  export interface UserBackoffice {
44
41
  UserId: string;
45
42
  FullName: string;
43
+ DisplayName: string;
46
44
 
47
-
48
45
  }
@@ -1,15 +0,0 @@
1
- import { useQuery } from "@tanstack/react-query";
2
- import { AstsStockInfo } from "../../../interfaces";
3
- import { getAuth0 } from "../../../services/ApiService";
4
-
5
- export const getStockInfoQueryHook = (barcode: string) => {
6
- return useQuery(
7
- ['STOCK_INFO_QUERY', barcode],
8
- () => getAuth0<AstsStockInfo>(`/ASTS/Stock/Information`, {
9
- pBarcode: barcode
10
- }),
11
- {
12
- enabled: !!(barcode),
13
- },
14
- );
15
- }