@omniumretail/shared-resources 0.2.43 → 0.2.44

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 { AttendancesSummary, ResponseList } from "../../../../interfaces";
3
+ interface EmployeeQueryOptions extends UseQueryOptions<ResponseList<'AttendanceSummarys', AttendancesSummary>> {
4
+ storeId?: string;
5
+ beginWorkPeriod?: number;
6
+ endWorkPeriod?: number;
7
+ page: number;
8
+ record: number;
9
+ }
10
+ export declare const useAttendancesSummarySearch: ({ storeId, beginWorkPeriod, endWorkPeriod, page, record, ...options }: EmployeeQueryOptions) => import("@tanstack/react-query").UseQueryResult<ResponseList<"AttendanceSummarys", AttendancesSummary>, unknown>;
11
+ export {};
@@ -0,0 +1,12 @@
1
+ import { UseQueryOptions } from "@tanstack/react-query";
2
+ import { Bwg } from "../../../interfaces";
3
+ export interface BwgAllEmployeesQueryQueryProps extends UseQueryOptions<Bwg> {
4
+ tags?: string;
5
+ page: number;
6
+ records: number;
7
+ sortBy?: string;
8
+ sortDirection?: string;
9
+ query?: string;
10
+ userId?: string;
11
+ }
12
+ export declare const getBwgAllEmployeesQuery: ({ tags, page, records, sortBy, sortDirection, query, userId, ...options }: BwgAllEmployeesQueryQueryProps) => import("@tanstack/react-query").UseQueryResult<Bwg, unknown>;
@@ -0,0 +1,12 @@
1
+ import { UseQueryOptions } from "@tanstack/react-query";
2
+ import { Bwg } from "../../../interfaces";
3
+ export interface BwgBackOfficeQueryQueryProps extends UseQueryOptions<Bwg> {
4
+ tags?: string;
5
+ page: number;
6
+ records: number;
7
+ sortBy?: string;
8
+ sortDirection?: string;
9
+ query?: string;
10
+ userId?: string;
11
+ }
12
+ export declare const getBwgBackOfficeQuery: ({ tags, page, records, sortBy, sortDirection, query, userId, ...options }: BwgBackOfficeQueryQueryProps) => import("@tanstack/react-query").UseQueryResult<Bwg, unknown>;
@@ -0,0 +1,7 @@
1
+ import { UseQueryOptions } from "@tanstack/react-query";
2
+ import { ErrorHistoryItem } from "../../../../interfaces";
3
+ interface GetErrorHistoryProps extends UseQueryOptions<ErrorHistoryItem[]> {
4
+ query?: string;
5
+ }
6
+ export declare const useErrorHistory: (options?: GetErrorHistoryProps) => import("@tanstack/react-query").UseQueryResult<ErrorHistoryItem[], unknown>;
7
+ export {};
@@ -0,0 +1,2 @@
1
+ import { IntegrationData } from "../../../../interfaces";
2
+ export declare const useIntegrationDataQuery: () => import("@tanstack/react-query").UseQueryResult<IntegrationData[], unknown>;
@@ -0,0 +1,2 @@
1
+ import { IntegrationData } from "../../../interfaces";
2
+ export declare const useSetIntegrationToFinished: () => import("@tanstack/react-query").UseMutationResult<IntegrationData, unknown, IntegrationData, unknown>;
@@ -233,6 +233,8 @@ export * from "./BigWin/others/publishMonthsManagerQuery.hook";
233
233
  export * from "./BigWin/get/getMonthsListQuery.hook";
234
234
  export * from "./BigWin/others/publishMonthsEmployeeQuery.hook";
235
235
  export * from "./BigWin/others/publishMonthsManagerQuery.hook";
236
+ export * from "./BigWin/get/getBwgAllEmployeesQuery.hook";
237
+ export * from "./BigWin/get/getBwgBackOfficeQuery.hook";
236
238
  export * from "./OSUA/get/documentos/getGngDocumentos.hook";
237
239
  export * from "./OSUA/get/documentos/getSitooDocumentos.hook";
238
240
  export * from "./OSUA/get/vouchers/getGngVoucher.hook";
@@ -240,7 +242,10 @@ export * from "./OSUA/get/vouchers/getSitooVouchers.hook";
240
242
  export * from "./OSUA/get/vouchers/getVoucherIntegrationRequestStatus.hook";
241
243
  export * from "./OSUA/get/orders/getOrderDocuments.hook";
242
244
  export * from "./OSUA/get/faqs/getFaqsQuery.hook";
245
+ export * from "./OSUA/get/mimo/useIntegrationDataQuery.hook";
246
+ export * from "./OSUA/get/mimo/useErrorHistory.hook";
243
247
  export * from "./OSUA/mutate/postCreateIntegrationRequest.hook";
248
+ export * from "./OSUA/mutate/useSetIntegrationToFinished.hook";
244
249
  export * from "./OSUA/MIMO/get/getIntegrationByName.hook";
245
250
  export * from "./OSUA/MIMO/get/getProductIntegrationHistory.hook";
246
251
  export * from "./OSUA/MIMO/mutate/postProductVendusIntegration.hook";
@@ -270,6 +275,7 @@ export * from "./ATIM/BackOffice/get/useStoresQueryHook.hook";
270
275
  export * from "./ATIM/BackOffice/mutate/postAttendanceRange.hook";
271
276
  export * from "./ATIM/BackOffice/get/useAbsenceTypes.hook";
272
277
  export * from "./ATIM/BackOffice/get/useAttendancesSummary.hook";
278
+ export * from "./ATIM/BackOffice/get/useAttendancesSummarySearch.hook";
273
279
  export * from "./ATIM/BackOffice/get/useWorkMonths.hook";
274
280
  export * from "./ATIM/BackOffice/mutate/useUpdateAttendancesSummary.hook";
275
281
  export * from "./Others/useJobTitlesQuery.hook";
@@ -0,0 +1,13 @@
1
+ export interface Bwg {
2
+ Score: number;
3
+ Points: number;
4
+ Position: number;
5
+ List: BwgList[];
6
+ }
7
+ export interface BwgList {
8
+ Id: string;
9
+ Score: number;
10
+ Name: string;
11
+ Position: number;
12
+ Points: number;
13
+ }
@@ -276,3 +276,19 @@ export interface Section {
276
276
  Tags: string[];
277
277
  Blocks: Block[];
278
278
  }
279
+ export interface IntegrationData {
280
+ Id: string;
281
+ Name: string;
282
+ DateToImport: number;
283
+ OrderIdFrom: string;
284
+ OrderIdTo: string;
285
+ Status: string;
286
+ LastSuccessfullDate: string;
287
+ }
288
+ export interface ErrorHistoryItem {
289
+ CreateDate: string;
290
+ ErrorMessage: string;
291
+ Flow: string;
292
+ Id: string;
293
+ Information: string;
294
+ }
@@ -57,3 +57,4 @@ export * from './ACB';
57
57
  export * from './MIMO';
58
58
  export * from './Bulk';
59
59
  export * from './AttendanceIssues';
60
+ export * from './Bwg';
@@ -8,6 +8,7 @@ export declare const postAuth0: <T>(path: string, params?: Record<string, unknow
8
8
  export declare const toDeleteAuth0: <T>(path: string, params?: Record<string, unknown>, body?: unknown) => Promise<T>;
9
9
  export declare const post: <T>(path: string, body?: unknown) => Promise<T>;
10
10
  export declare const postWithParameters: <T>(path: string, params?: Record<string, unknown>, body?: unknown) => Promise<T>;
11
+ export declare const putWithParameters: <T>(path: string, params?: Record<string, unknown>, body?: unknown) => Promise<T>;
11
12
  export declare const put: <T>(path: string, body?: unknown) => Promise<T>;
12
13
  export declare const patch: <T>(path: string, body?: unknown) => Promise<T>;
13
14
  export declare const toDelete: <T>(path: string, body?: unknown) => Promise<T>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@omniumretail/shared-resources",
3
- "version": "0.2.43",
3
+ "version": "0.2.44",
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,43 @@
1
+ import { useQuery, UseQueryOptions } from "@tanstack/react-query";
2
+ import { getAuth0 } from "../../../../services/ApiService";
3
+ import { AttendancesSummary, ResponseList } from "../../../../interfaces";
4
+
5
+ interface EmployeeQueryOptions
6
+ extends UseQueryOptions<ResponseList<'AttendanceSummarys', AttendancesSummary>>{
7
+ storeId?: string;
8
+ beginWorkPeriod?: number;
9
+ endWorkPeriod?: number;
10
+ page: number;
11
+ record: number;
12
+ }
13
+
14
+ export const useAttendancesSummarySearch = ({
15
+ storeId,
16
+ beginWorkPeriod,
17
+ endWorkPeriod,
18
+ page,
19
+ record,
20
+ ...options
21
+ }: EmployeeQueryOptions) => {
22
+ return useQuery<ResponseList<'AttendanceSummarys', AttendancesSummary>>(
23
+ [
24
+ "ATTENDANCES_SUMMARY",
25
+ storeId,
26
+ beginWorkPeriod,
27
+ endWorkPeriod,
28
+ page,
29
+ record,
30
+ ],
31
+ () =>
32
+ getAuth0<ResponseList<'AttendanceSummarys', AttendancesSummary>>(`/ATIM/AttendancesSummary`, {
33
+ pStoreId: storeId,
34
+ pBeginWorkDate: beginWorkPeriod,
35
+ pEndWorkDate: endWorkPeriod,
36
+ pPage: page,
37
+ pRecords: record,
38
+ }),
39
+ {
40
+ ...options,
41
+ }
42
+ );
43
+ };
@@ -0,0 +1,28 @@
1
+ import { useQuery, UseQueryOptions } from "@tanstack/react-query";
2
+ import { Bwg } from "../../../interfaces";
3
+ import { getAuth0 } from "../../../services/ApiService";
4
+
5
+ export interface BwgAllEmployeesQueryQueryProps extends UseQueryOptions<Bwg> {
6
+ tags?: string;
7
+ page: number;
8
+ records: number;
9
+ sortBy?: string;
10
+ sortDirection?: string;
11
+ query?: string;
12
+ userId?: string;
13
+ }
14
+
15
+ export const getBwgAllEmployeesQuery = ({ tags, page, records, sortBy, sortDirection, query, userId, ...options }: BwgAllEmployeesQueryQueryProps) => {
16
+ return useQuery(
17
+ ['BWG_ALL_EMPLOYEES', tags, page, records, sortBy, sortDirection, query, options],
18
+ () => getAuth0<Bwg>('/ABWG/BWGEmployees/AllEmployees/Omnium', {
19
+ pPage: page || 1,
20
+ pRecords: records || 50,
21
+ pSortBy: sortBy || 'Points',
22
+ pSortDirection: sortDirection || 'asc',
23
+ pTerms: tags,
24
+ pQuery: query,
25
+ }),
26
+ options
27
+ );
28
+ }
@@ -0,0 +1,28 @@
1
+ import { useQuery, UseQueryOptions } from "@tanstack/react-query";
2
+ import { Bwg } from "../../../interfaces";
3
+ import { getAuth0 } from "../../../services/ApiService";
4
+
5
+ export interface BwgBackOfficeQueryQueryProps extends UseQueryOptions<Bwg> {
6
+ tags?: string;
7
+ page: number;
8
+ records: number;
9
+ sortBy?: string;
10
+ sortDirection?: string;
11
+ query?: string;
12
+ userId?: string;
13
+ }
14
+
15
+ export const getBwgBackOfficeQuery = ({ tags, page, records, sortBy, sortDirection, query, userId, ...options }: BwgBackOfficeQueryQueryProps) => {
16
+ return useQuery(
17
+ ['BWG_BACK_OFFICE', tags, page, records, sortBy, sortDirection, query, options],
18
+ () => getAuth0<Bwg>('/ABWG/BWGEmployees/BackOffice/Omnium', {
19
+ pPage: page || 1,
20
+ pRecords: records || 50,
21
+ pSortBy: sortBy || 'Points',
22
+ pSortDirection: sortDirection || 'asc',
23
+ pTerms: tags,
24
+ pQuery: query,
25
+ }),
26
+ options
27
+ );
28
+ }
@@ -0,0 +1,21 @@
1
+ import { useQuery, UseQueryOptions } from "@tanstack/react-query";
2
+ import { get } from "../../../../services/ApiService";
3
+ import { ErrorHistoryItem } from "../../../../interfaces";
4
+
5
+ interface GetErrorHistoryProps extends UseQueryOptions<ErrorHistoryItem[]> {
6
+ query?: string;
7
+ }
8
+
9
+ export const useErrorHistory = (options?: GetErrorHistoryProps) => {
10
+ const { query, ...restOptions } = options || {};
11
+
12
+ return useQuery(
13
+ ["MIMO_ERROR_HISTORY", query],
14
+ () =>
15
+ get<ErrorHistoryItem[]>(
16
+ "/MIMO/ErrorHistory",
17
+ query ? { pTerms: query } : {}
18
+ ),
19
+ restOptions
20
+ );
21
+ };
@@ -0,0 +1,15 @@
1
+ import { useQuery } from "@tanstack/react-query";
2
+ import { get} from "../../../../services/ApiService";
3
+ import { IntegrationData } from "../../../../interfaces";
4
+
5
+ export const useIntegrationDataQuery = () => {
6
+ return useQuery(
7
+ ['MIMO_INTEGRATION_DATA'],
8
+ () => get<IntegrationData[]>('/MIMO/IntegrationData/ALL'),
9
+ {
10
+ enabled: true,
11
+
12
+ retry: 1
13
+ }
14
+ );
15
+ };
@@ -0,0 +1,21 @@
1
+ import { useMutation, useQueryClient } from "@tanstack/react-query";
2
+ import { putWithParameters } from "../../../services/ApiService";
3
+ import { IntegrationData } from "../../../interfaces";
4
+
5
+
6
+ export const useSetIntegrationToFinished = () => {
7
+ const queryClient = useQueryClient();
8
+
9
+ return useMutation<IntegrationData, unknown, IntegrationData>(
10
+ (data: IntegrationData) => {
11
+ return putWithParameters(`/MIMO/IntegrationData/SetToFinished?`, {
12
+ pName: data.Name,
13
+ }, data);
14
+ },
15
+ {
16
+ onSuccess: (data: IntegrationData) => {
17
+ queryClient.setQueryData(["INTEGRATION_DATA_QUERY"], data);
18
+ }
19
+ }
20
+ );
21
+ };
@@ -270,6 +270,8 @@ export * from "./BigWin/others/publishMonthsManagerQuery.hook";
270
270
  export * from "./BigWin/get/getMonthsListQuery.hook";
271
271
  export * from "./BigWin/others/publishMonthsEmployeeQuery.hook";
272
272
  export * from "./BigWin/others/publishMonthsManagerQuery.hook";
273
+ export * from "./BigWin/get/getBwgAllEmployeesQuery.hook";
274
+ export * from "./BigWin/get/getBwgBackOfficeQuery.hook";
273
275
 
274
276
  //OSUA
275
277
  export * from "./OSUA/get/documentos/getGngDocumentos.hook";
@@ -279,8 +281,11 @@ export * from "./OSUA/get/vouchers/getSitooVouchers.hook";
279
281
  export * from "./OSUA/get/vouchers/getVoucherIntegrationRequestStatus.hook";
280
282
  export * from "./OSUA/get/orders/getOrderDocuments.hook";
281
283
  export * from "./OSUA/get/faqs/getFaqsQuery.hook";
284
+ export * from "./OSUA/get/mimo/useIntegrationDataQuery.hook";
285
+ export * from "./OSUA/get/mimo/useErrorHistory.hook";
282
286
 
283
287
  export * from "./OSUA/mutate/postCreateIntegrationRequest.hook";
288
+ export * from "./OSUA/mutate/useSetIntegrationToFinished.hook";
284
289
 
285
290
  //MIMO
286
291
  export * from "./OSUA/MIMO/get/getIntegrationByName.hook";
@@ -320,6 +325,7 @@ export * from "./ATIM/BackOffice/get/useStoresQueryHook.hook";
320
325
  export * from "./ATIM/BackOffice/mutate/postAttendanceRange.hook";
321
326
  export * from "./ATIM/BackOffice/get/useAbsenceTypes.hook";
322
327
  export * from "./ATIM/BackOffice/get/useAttendancesSummary.hook";
328
+ export * from "./ATIM/BackOffice/get/useAttendancesSummarySearch.hook";
323
329
  export * from "./ATIM/BackOffice/get/useWorkMonths.hook";
324
330
  export * from "./ATIM/BackOffice/mutate/useUpdateAttendancesSummary.hook";
325
331
 
@@ -0,0 +1,14 @@
1
+ export interface Bwg {
2
+ Score: number;
3
+ Points: number;
4
+ Position: number;
5
+ List: BwgList[];
6
+ }
7
+
8
+ export interface BwgList {
9
+ Id: string;
10
+ Score: number;
11
+ Name: string;
12
+ Position: number;
13
+ Points: number;
14
+ }
@@ -301,8 +301,26 @@ export interface Section {
301
301
  Icon: string;
302
302
  Tags: string[];
303
303
  Blocks: Block[];
304
- }
305
-
304
+ }
305
+
306
+ export interface IntegrationData {
307
+ Id: string;
308
+ Name: string;
309
+ DateToImport: number;
310
+ OrderIdFrom: string;
311
+ OrderIdTo: string;
312
+ Status: string;
313
+ LastSuccessfullDate: string;
314
+ }
315
+
316
+ export interface ErrorHistoryItem {
317
+ CreateDate: string;
318
+ ErrorMessage: string;
319
+ Flow: string;
320
+ Id: string;
321
+ Information: string;
322
+ }
323
+
306
324
 
307
325
 
308
326
 
@@ -56,4 +56,5 @@ export * from './BackofficeAtim';
56
56
  export * from './ACB';
57
57
  export * from './MIMO';
58
58
  export * from './Bulk';
59
- export * from './AttendanceIssues';
59
+ export * from './AttendanceIssues';
60
+ export * from './Bwg';
@@ -37,6 +37,11 @@ export const postWithParameters = <T>(path: string, params?: Record<string, unkn
37
37
  return buildApiRequest<T>(`${path}${buildParams(params || {})}`, 'POST', body);
38
38
  }
39
39
 
40
+ export const putWithParameters = <T>(path: string, params?: Record<string, unknown>, body?: unknown): Promise<T> => {
41
+ return buildApiRequest<T>(`${path}${buildParams(params || {})}`, 'PUT', body);
42
+ }
43
+
44
+
40
45
  export const put = <T>(path: string, body?: unknown): Promise<T> => {
41
46
  return buildApiRequest<T>(path, 'PUT', body);
42
47
  }