@omniumretail/shared-resources 0.2.29 → 0.2.31

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.
Files changed (32) hide show
  1. package/dist/bundle.js +1 -1
  2. package/dist/types/hooks/ATIM/BackOffice/get/useAbsenceTypes.hook.d.ts +10 -0
  3. package/dist/types/hooks/ATIM/BackOffice/get/useAttendancesSummary.hook.d.ts +10 -0
  4. package/dist/types/hooks/ATIM/BackOffice/get/useEmployeeWorklogDetails.hook.d.ts +5 -3
  5. package/dist/types/hooks/ATIM/BackOffice/get/useWorkMonths.hook.d.ts +9 -0
  6. package/dist/types/hooks/ATIM/BackOffice/mutate/postAttendanceSummary.hook.d.ts +2 -0
  7. package/dist/types/hooks/OSUA/MIMO/get/getIntegrationByName.hook.d.ts +6 -0
  8. package/dist/types/hooks/OSUA/MIMO/mutate/postDagsAdjustStock.hook.d.ts +1 -0
  9. package/dist/types/hooks/OSUA/MIMO/mutate/postProductVendusIntegration.hook.d.ts +2 -0
  10. package/dist/types/hooks/OSUA/get/documentos/getGngDocumentos.hook.d.ts +2 -2
  11. package/dist/types/hooks/OSUA/get/faqs/getFaqsQuery.hook.d.ts +11 -0
  12. package/dist/types/hooks/index.d.ts +295 -144
  13. package/dist/types/interfaces/BackofficeAtim.d.ts +68 -0
  14. package/dist/types/interfaces/MIMO.d.ts +12 -0
  15. package/dist/types/interfaces/OUSA.d.ts +11 -0
  16. package/dist/types/interfaces/index.d.ts +1 -0
  17. package/package.json +1 -1
  18. package/src/hooks/ATIM/BackOffice/get/useAbsenceTypes.hook.ts +33 -0
  19. package/src/hooks/ATIM/BackOffice/get/useAttendancesSummary.hook.ts +40 -0
  20. package/src/hooks/ATIM/BackOffice/get/useEmployeeWorklogDetails.hook.ts +63 -38
  21. package/src/hooks/ATIM/BackOffice/get/useWorkMonths.hook.ts +31 -0
  22. package/src/hooks/ATIM/BackOffice/mutate/postAttendanceSummary.hook.ts +17 -0
  23. package/src/hooks/OSUA/MIMO/get/getIntegrationByName.hook.ts +19 -0
  24. package/src/hooks/OSUA/MIMO/mutate/postDagsAdjustStock.hook.ts +13 -0
  25. package/src/hooks/OSUA/MIMO/mutate/postProductVendusIntegration.hook.ts +15 -0
  26. package/src/hooks/OSUA/get/documentos/getGngDocumentos.hook.ts +17 -10
  27. package/src/hooks/OSUA/get/faqs/getFaqsQuery.hook.ts +33 -0
  28. package/src/hooks/index.ts +306 -148
  29. package/src/interfaces/BackofficeAtim.ts +106 -31
  30. package/src/interfaces/MIMO.ts +13 -0
  31. package/src/interfaces/OUSA.ts +15 -0
  32. package/src/interfaces/index.ts +2 -1
@@ -34,3 +34,71 @@ export interface UserBackoffice {
34
34
  FullName: string;
35
35
  DisplayName: string;
36
36
  }
37
+ export interface WorkMonths {
38
+ BeginDate: number;
39
+ EndDate: number;
40
+ }
41
+ export interface AbsenceTypes {
42
+ CreateDate: number;
43
+ Id: string;
44
+ Name: string;
45
+ Status: string;
46
+ UpdateDate: number;
47
+ }
48
+ export interface AbsenceOthers {
49
+ Days: number;
50
+ Notes: string;
51
+ }
52
+ export interface AbsenceInterval {
53
+ BeginDate: number;
54
+ EndDate: number;
55
+ }
56
+ export interface AbsenceDetail {
57
+ LineNumber: number;
58
+ AbsenceTypeId: string;
59
+ Name: string;
60
+ Notes: string;
61
+ Interval: AbsenceInterval;
62
+ }
63
+ export interface AbsenceDetails {
64
+ Justified: number;
65
+ Unjustified: number;
66
+ Others: AbsenceOthers[];
67
+ }
68
+ export interface ExtraHours {
69
+ Hours: string;
70
+ AuthorizedBy: string | null;
71
+ }
72
+ export interface WorkPeriod {
73
+ Begin: number;
74
+ End: number;
75
+ }
76
+ export interface ScheduleWorkHours {
77
+ Daily: string;
78
+ Night: string;
79
+ Total: string;
80
+ Stocktaking: string;
81
+ }
82
+ export interface WorkedHours {
83
+ Total: string;
84
+ Daily: string;
85
+ Night: string;
86
+ }
87
+ export interface AttendancesSummary {
88
+ Id: string | null;
89
+ StoreId: string;
90
+ Absences: AbsenceDetails;
91
+ CreateDate: number;
92
+ Delay: string;
93
+ EmployeeId: string;
94
+ Extra: ExtraHours;
95
+ Others: {
96
+ Hours: string;
97
+ Notes: string | null;
98
+ };
99
+ ScheduleWorkHours: ScheduleWorkHours;
100
+ WorkPeriod: WorkPeriod;
101
+ WorkedHours: WorkedHours;
102
+ UpdateDate: number;
103
+ Observations: string | null;
104
+ }
@@ -0,0 +1,12 @@
1
+ export interface ImportData {
2
+ Id: string;
3
+ Name: string;
4
+ DateToImport: number;
5
+ OrderIdFrom: string;
6
+ OrderIdTo: string;
7
+ Status: string;
8
+ LastSuccessfullDate: number;
9
+ }
10
+ export interface VendusIntegration {
11
+ Result: boolean;
12
+ }
@@ -260,3 +260,14 @@ export interface DocumentSitoo {
260
260
  OrderItems: OrderItems;
261
261
  Payments: Payment;
262
262
  }
263
+ export interface Block {
264
+ PT: string;
265
+ ES: string;
266
+ }
267
+ export interface Section {
268
+ Title: string;
269
+ Description: string;
270
+ Icon: string;
271
+ Tags: string[];
272
+ Blocks: Block[];
273
+ }
@@ -54,3 +54,4 @@ export * from './UserAuthentication';
54
54
  export * from './OUSA';
55
55
  export * from './BackofficeAtim';
56
56
  export * from './ACB';
57
+ export * from './MIMO';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@omniumretail/shared-resources",
3
- "version": "0.2.29",
3
+ "version": "0.2.31",
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,33 @@
1
+ import { useQuery, UseQueryOptions } from "@tanstack/react-query";
2
+ import { get } from "../../../../services/ApiService";
3
+ import { ResponseList, AbsenceTypes } from "../../../../interfaces";
4
+
5
+ interface AbsenceTypesQueryOptions
6
+ extends UseQueryOptions<ResponseList<"AbsenceTypes", AbsenceTypes>> {
7
+ page?: number;
8
+ records?: number;
9
+ sortBy?: string;
10
+ sortDirection?: string;
11
+ }
12
+
13
+ export const useAbsenceTypes = ({
14
+ page,
15
+ records,
16
+ sortBy,
17
+ sortDirection,
18
+ ...options
19
+ }: AbsenceTypesQueryOptions) => {
20
+ return useQuery<ResponseList<"AbsenceTypes", AbsenceTypes>>(
21
+ ["EMPLOYEES_QUERY", page, records, sortBy, sortDirection],
22
+ () =>
23
+ get("/ATIM/AbsenceTypes", {
24
+ pPage: page,
25
+ pRecords: records,
26
+ pSortBy: sortBy,
27
+ pSortDirection: sortDirection,
28
+ }),
29
+ {
30
+ ...options,
31
+ }
32
+ );
33
+ };
@@ -0,0 +1,40 @@
1
+ import { useQuery, UseQueryOptions } from "@tanstack/react-query";
2
+ import { getAuth0 } from "../../../../services/ApiService";
3
+ import { ResponseList, AttendancesSummary } from "../../../../interfaces";
4
+
5
+ interface EmployeeQueryOptions
6
+ extends UseQueryOptions<
7
+ ResponseList<"AttendancesSummary", AttendancesSummary>
8
+ > {
9
+ employeeId?: string;
10
+ storeId?: string;
11
+ beginWorkPeriod?: number;
12
+ endWorkPeriod?: number;
13
+ }
14
+
15
+ export const useAttendancesSummary = ({
16
+ employeeId,
17
+ storeId,
18
+ beginWorkPeriod,
19
+ endWorkPeriod,
20
+ ...options
21
+ }: EmployeeQueryOptions) => {
22
+ return useQuery<ResponseList<"AttendancesSummary", AttendancesSummary>>(
23
+ [
24
+ "ATTENDANCES_SUMMARY",
25
+ employeeId,
26
+ storeId,
27
+ beginWorkPeriod,
28
+ endWorkPeriod,
29
+ ],
30
+ () =>
31
+ getAuth0(`/ATIM/AttendancesSummary/${employeeId}`, {
32
+ pStoreId: storeId,
33
+ pBeginWorkPeriod: beginWorkPeriod,
34
+ pEndWorkPeriod: endWorkPeriod,
35
+ }),
36
+ {
37
+ ...options,
38
+ }
39
+ );
40
+ };
@@ -1,41 +1,66 @@
1
- import { useQuery , UseQueryOptions} from '@tanstack/react-query';
1
+ import { useQuery, UseQueryOptions } from "@tanstack/react-query";
2
2
  import { getDateToUnix } from "../../../../helpers/date-unix.helper";
3
- import { get, getAuth0} from "../../../../services/ApiService";
4
- import { ResponseList, EmployeesWorklog } from '../../../../interfaces';
3
+ import { get, getAuth0 } from "../../../../services/ApiService";
4
+ import { ResponseList, EmployeesWorklog } from "../../../../interfaces";
5
5
 
6
-
7
- interface EmployeesWithTimekeepingProps extends UseQueryOptions<ResponseList<"EmployeesWorkLog", EmployeesWorklog>> {
8
- storeId?: string;
9
- startDate?: number;
10
- endDate?: number;
11
- search?: string;
12
- page?: number;
13
- records?: number;
14
- sortBy?: string;
15
- sortDirection?: string;
16
-
17
-
18
-
19
- }
20
-
21
- export const useEmployeeWorklogDetails = ({storeId, startDate, endDate, search, page, records, sortBy, sortDirection, ...options}: EmployeesWithTimekeepingProps) => {
22
- return useQuery<ResponseList<"EmployeesWorklog", EmployeesWorklog>>(
23
- ['EMPLOYEES_WITH_TIMEKEEPING', storeId, startDate, endDate, search, page, records, sortBy, sortDirection],
24
- () => getAuth0<ResponseList<"EmployeesWorklog", EmployeesWorklog>>('/ATIM/EmployeesWorklogDetails', {
25
- pStoreId: storeId,
26
- pPage: page || 1,
27
- pRecords: records,
28
- pStartDate: startDate || getDateToUnix(new Date()),
29
- pEndDate: endDate || getDateToUnix(new Date()),
30
- pSortBy: sortBy,
31
- pSortDirection: sortDirection,
32
- pDisplayName: search,
33
-
34
- }),
35
- {
36
- suspense: false,
37
- enabled: (!!storeId && !!startDate && !!endDate),
38
-
39
- }
40
- );
6
+ interface EmployeesWithTimekeepingProps
7
+ extends UseQueryOptions<ResponseList<"EmployeesWorkLog", EmployeesWorklog>> {
8
+ storeId?: string;
9
+ startDate?: number;
10
+ endDate?: number;
11
+ search?: string;
12
+ page?: number;
13
+ records?: number;
14
+ sortBy?: string;
15
+ sortDirection?: string;
16
+ terms?: string;
17
+ query?: string;
41
18
  }
19
+
20
+ export const useEmployeeWorklogDetails = ({
21
+ storeId,
22
+ startDate,
23
+ endDate,
24
+ search,
25
+ page,
26
+ records,
27
+ sortBy,
28
+ sortDirection,
29
+ terms,
30
+ query,
31
+ }: EmployeesWithTimekeepingProps) => {
32
+ return useQuery<ResponseList<"EmployeesWorklog", EmployeesWorklog>>(
33
+ [
34
+ "EMPLOYEES_WITH_TIMEKEEPING",
35
+ storeId,
36
+ startDate,
37
+ endDate,
38
+ search,
39
+ page,
40
+ records,
41
+ sortBy,
42
+ sortDirection,
43
+ terms,
44
+ query,
45
+ ],
46
+ () =>
47
+ getAuth0<ResponseList<"EmployeesWorklog", EmployeesWorklog>>(
48
+ "/ATIM/EmployeesWorklogDetails",
49
+ {
50
+ pStoreId: storeId,
51
+ pPage: page || 1,
52
+ pRecords: records,
53
+ pStartDate: startDate || getDateToUnix(new Date()),
54
+ pEndDate: endDate || getDateToUnix(new Date()),
55
+ pSortBy: sortBy,
56
+ pSortDirection: sortDirection,
57
+ pTerms: terms,
58
+ pQuery: query,
59
+ }
60
+ ),
61
+ {
62
+ suspense: false,
63
+ enabled: !!storeId && !!startDate && !!endDate,
64
+ }
65
+ );
66
+ };
@@ -0,0 +1,31 @@
1
+ import { useQuery, UseQueryOptions } from "@tanstack/react-query";
2
+ import { getDateToUnix } from "../../../../helpers/date-unix.helper";
3
+ import { get, getAuth0 } from "../../../../services/ApiService";
4
+ import { ResponseList, WorkMonths } from "../../../../interfaces";
5
+
6
+ interface WorkMonthsQueryOptions
7
+ extends UseQueryOptions<ResponseList<"WorkMonths", WorkMonths>> {
8
+ year?: number;
9
+ page?: number;
10
+ records?: number;
11
+ }
12
+
13
+ export const useWorkMonths = ({
14
+ year,
15
+ page,
16
+ records,
17
+ ...options
18
+ }: WorkMonthsQueryOptions) => {
19
+ return useQuery<ResponseList<"WorkMonths", WorkMonths>>(
20
+ ["WorkMonths", year, page, records],
21
+ () =>
22
+ get("/ATIM/WorkMonths", {
23
+ pYear: year,
24
+ pPage: page,
25
+ pRecords: records,
26
+ }),
27
+ {
28
+ ...options,
29
+ }
30
+ );
31
+ };
@@ -0,0 +1,17 @@
1
+ import { useQueryClient, useMutation } from "@tanstack/react-query";
2
+ import { AttendancesSummary } from "../../../../interfaces";
3
+ import { postAuth0 } from "../../../../services/ApiService";
4
+
5
+ export const postAttendanceRange = () => {
6
+ const queryClient = useQueryClient();
7
+ return useMutation<AttendancesSummary , unknown, AttendancesSummary >(
8
+ (data: AttendancesSummary ) => {
9
+ return postAuth0("/ATIM/AttendancesSummary", undefined, data);
10
+ },
11
+ {
12
+ onSuccess: (data: AttendancesSummary ) => {
13
+ queryClient.setQueryData(["POST_ATTENDANCES_SUMMARY"], data);
14
+ },
15
+ }
16
+ );
17
+ };
@@ -0,0 +1,19 @@
1
+ import { useQuery, UseQueryOptions } from "@tanstack/react-query";
2
+ import { ImportData } from "../../../../interfaces";
3
+ import { get } from "../../../../services/ApiService";
4
+
5
+ export interface getIntegrationByNameProps extends UseQueryOptions<ImportData> {
6
+ name: string;
7
+ }
8
+
9
+ export const getIntegrationByName = ({ name }: getIntegrationByNameProps) => {
10
+ return useQuery(
11
+ ['GET_MIMO_INTEGRATION_BY_NAME', name],
12
+ () => get<ImportData>('/MIMO/IntegrationData/ByName', {
13
+ pName: name,
14
+ }),
15
+ {
16
+ keepPreviousData: true,
17
+ }
18
+ );
19
+ }
@@ -0,0 +1,13 @@
1
+ import { useMutation, useQueryClient } from '@tanstack/react-query';
2
+ import { post } from '../../../../services/ApiService';
3
+
4
+ export const postDagsAdjustStock = () => {
5
+ const queryClient = useQueryClient();
6
+ return useMutation<string, unknown, void>(() => {
7
+ return post('/MIMO/Dags/AdjustStock');
8
+ }, {
9
+ onSuccess: (data: string) => {
10
+ queryClient.setQueryData(['DAGS_ADJUST_STOCK'], data);
11
+ },
12
+ });
13
+ }
@@ -0,0 +1,15 @@
1
+ import { useMutation, useQueryClient } from '@tanstack/react-query';
2
+ import { VendusIntegration } from '../../../../interfaces';
3
+ import { post } from '../../../../services/ApiService';
4
+
5
+ export const postVendusIntegration= () => {
6
+ const queryClient = useQueryClient();
7
+ return useMutation<VendusIntegration, unknown, VendusIntegration>((data: VendusIntegration) => {
8
+ return post('/MIMO/VendusIntegration/Full', data);
9
+ }, {
10
+ onSuccess: (data: VendusIntegration) => {
11
+ queryClient.setQueryData(
12
+ ['VENDUS_INTEGRATION'], data);
13
+ },
14
+ });
15
+ }
@@ -1,21 +1,28 @@
1
- import { useQuery, UseQueryOptions } from '@tanstack/react-query';
2
- import { get } from '../../../../services/ApiService';
3
- import { DocumentGng , ResponseList} from '../../../../interfaces';
1
+ import { useQuery, UseQueryOptions } from "@tanstack/react-query";
2
+ import { get } from "../../../../services/ApiService";
3
+ import { DocumentGng, ResponseList } from "../../../../interfaces";
4
4
 
5
- interface GetGNGDocumentosProps extends UseQueryOptions<ResponseList<"Documents", DocumentGng>> {
5
+ interface GetGNGDocumentosProps
6
+ extends UseQueryOptions<ResponseList<"Documents", DocumentGng>> {
6
7
  page?: number;
7
8
  records?: number;
8
9
  query?: string;
9
10
  }
10
11
 
11
- export const getGngDocumentos = ({ page, records , query, ...options }: GetGNGDocumentosProps) => {
12
+ export const getGngDocumentos = ({
13
+ page,
14
+ records,
15
+ query,
16
+ ...options
17
+ }: GetGNGDocumentosProps) => {
12
18
  return useQuery(
13
- ['GNG_DOCUMENTOS', page, records, query],
14
- () => get<ResponseList<"Documents", DocumentGng>>('/GNG/Document/Documents', {
19
+ ["GNG_DOCUMENTOS", page, records, query],
20
+ () =>
21
+ get<ResponseList<"Documents", DocumentGng>>("/GNG/Document/Documents", {
15
22
  pPage: page || 1,
16
23
  pRecords: records || 50,
17
- pQuery: query
18
- }),
24
+ pQuery: query,
25
+ }),
19
26
  options
20
27
  );
21
- }
28
+ };
@@ -0,0 +1,33 @@
1
+ import { useQuery, UseQueryOptions } from "@tanstack/react-query";
2
+ import { get, getAuth0 } from "../../../../services/ApiService";
3
+ import {ResponseList, Section } from "../../../../interfaces"; // Assuming Section is in the interfaces
4
+
5
+ interface GetSectionProps extends UseQueryOptions<ResponseList< "Sections", Section>> {
6
+ page?: number;
7
+ records?: number;
8
+ sortBy?: string;
9
+ sortDirection?: string;
10
+ terms?: string;
11
+ }
12
+
13
+ export const getFaqsQuery = ({
14
+ page,
15
+ records,
16
+ sortBy,
17
+ sortDirection,
18
+ terms,
19
+ ...options
20
+ }: GetSectionProps) => {
21
+ return useQuery(
22
+ ["FAQS_DATA", page, records, sortBy, sortDirection, terms],
23
+ () =>
24
+ getAuth0<ResponseList< "Sections", Section>>("/OSUA/Pages", {
25
+ pPage: page || 1,
26
+ pRecords: records || 10,
27
+ pSortBy: sortBy || "Title",
28
+ pSortDirection: sortDirection || "asc",
29
+ pTerms: terms,
30
+ }),
31
+ options
32
+ );
33
+ };