@omniumretail/shared-resources 0.2.59 → 0.2.61

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.
@@ -5,4 +5,4 @@ export interface postAnswersExportQuery extends UseQueryOptions<ReportBuilder> {
5
5
  userId: string;
6
6
  language?: string;
7
7
  }
8
- export declare const postAnswersExportQueryHook: ({ evaluationId, language, userId, ...options }: postAnswersExportQuery) => import("@tanstack/react-query").UseQueryResult<ReportBuilder, unknown>;
8
+ export declare const postAnswersExportQueryHook: () => import("@tanstack/react-query").UseMutationResult<postAnswersExportQuery, unknown, postAnswersExportQuery, unknown>;
@@ -0,0 +1,11 @@
1
+ import { UseQueryOptions } from "@tanstack/react-query";
2
+ import { ReasonCodes, ResponseList } from "../../../interfaces";
3
+ export interface CriticalitiesQueryProps extends UseQueryOptions<ResponseList<"Criticalities", ReasonCodes>> {
4
+ tags?: string;
5
+ page?: number;
6
+ records?: number;
7
+ sortBy?: string;
8
+ sortDirection?: string;
9
+ query?: string;
10
+ }
11
+ export declare const getCriticalitiesQuery: ({ tags, page, records, sortBy, sortDirection, query, ...options }: CriticalitiesQueryProps) => import("@tanstack/react-query").UseQueryResult<ResponseList<"Criticalities", ReasonCodes>, unknown>;
@@ -0,0 +1,11 @@
1
+ import { UseQueryOptions } from "@tanstack/react-query";
2
+ import { ReasonCodes, ResponseList } from "../../../interfaces";
3
+ export interface ReasonCodesQueryProps extends UseQueryOptions<ResponseList<"ReasonCodes", ReasonCodes>> {
4
+ tags?: string;
5
+ page?: number;
6
+ records?: number;
7
+ sortBy?: string;
8
+ sortDirection?: string;
9
+ query?: string;
10
+ }
11
+ export declare const getReasonCodesQuery: ({ tags, page, records, sortBy, sortDirection, query, ...options }: ReasonCodesQueryProps) => import("@tanstack/react-query").UseQueryResult<ResponseList<"ReasonCodes", ReasonCodes>, unknown>;
@@ -143,6 +143,8 @@ export * from "./ATIM/PicaPonto/mutate/postAttendance.hook";
143
143
  export * from "./WidgetPicaPonto/get/getAttendanceIssuesByIdQuery.hook";
144
144
  export * from "./WidgetPicaPonto/get/getAttendanceIssuesQuery.hook";
145
145
  export * from "./WidgetPicaPonto/others/postAttendanceIssuesQuery.hook";
146
+ export * from "./WidgetPicaPonto/get/getCriticaliesQuery.hook";
147
+ export * from "./WidgetPicaPonto/get/getReasonCodesQuery.hook";
146
148
  export * from "./Asta/Template/get/getTemplateByIdQuery.hook";
147
149
  export * from "./Asta/Template/get/getTemplateHeadersQuery.hook";
148
150
  export * from "./Asta/Template/get/getTemplateQuery.hook";
@@ -0,0 +1,8 @@
1
+ export interface ReasonCodes {
2
+ Id: string;
3
+ Name: string;
4
+ Value: string;
5
+ CreateDate: number;
6
+ UpdateDate: number;
7
+ Status: string;
8
+ }
@@ -2,4 +2,5 @@ export type ResponseList<K extends string, T> = {
2
2
  [key in K]: T[];
3
3
  } & {
4
4
  Count: number;
5
+ TotalCount: number;
5
6
  };
@@ -58,3 +58,4 @@ export * from './MIMO';
58
58
  export * from './Bulk';
59
59
  export * from './AttendanceIssues';
60
60
  export * from './Bwg';
61
+ export * from './ReasonCodes';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@omniumretail/shared-resources",
3
- "version": "0.2.59",
3
+ "version": "0.2.61",
4
4
  "private": false,
5
5
  "description": "Shared Components and services or utils to the frontend versions",
6
6
  "main": "dist/bundle.js",
@@ -1,4 +1,4 @@
1
- import { useQuery, UseQueryOptions } from "@tanstack/react-query";
1
+ import { useMutation, useQuery, useQueryClient, UseQueryOptions } from "@tanstack/react-query";
2
2
  import { ReportBuilder } from "../../../interfaces";
3
3
  import { postAuth0 } from "../../../services/ApiService";
4
4
 
@@ -8,14 +8,19 @@ export interface postAnswersExportQuery extends UseQueryOptions<ReportBuilder> {
8
8
  language?: string;
9
9
  }
10
10
 
11
- export const postAnswersExportQueryHook = ({ evaluationId, language, userId, ...options }: postAnswersExportQuery) => {
12
- return useQuery(
13
- ['POST_ANSWERS_EXPORT', evaluationId, language, userId, options],
14
- () => postAuth0<ReportBuilder>('/APE/EvaluationCycle/AnswerExport?', {
15
- pEvaluationCycleId: evaluationId,
16
- pLanguage: language || "PT",
17
- pUserId: userId
18
- }),
19
- options
20
- );
11
+ export const postAnswersExportQueryHook = () => {
12
+ const queryClient = useQueryClient();
13
+ return useMutation<postAnswersExportQuery, unknown, postAnswersExportQuery>((data: postAnswersExportQuery) => {
14
+ return postAuth0(`/APE/EvaluationCycle/AnswerExport?`, {
15
+ pEvaluationCycleId: data.evaluationId,
16
+ pLanguage: data.language || "PT",
17
+ pUserId: data.userId
18
+ }, data);
19
+ }, {
20
+ onSuccess: (data: postAnswersExportQuery) => {
21
+ queryClient.setQueryData(
22
+ ['POST_ANSWERS_EXPORT'], data);
23
+ },
24
+ });
21
25
  }
26
+
@@ -0,0 +1,27 @@
1
+ import { useQuery, UseQueryOptions } from "@tanstack/react-query";
2
+ import { ReasonCodes, ResponseList } from "../../../interfaces";
3
+ import { getAuth0 } from "../../../services/ApiService";
4
+
5
+ export interface CriticalitiesQueryProps extends UseQueryOptions<ResponseList<"Criticalities", ReasonCodes>> {
6
+ tags?: string;
7
+ page?: number;
8
+ records?: number;
9
+ sortBy?: string;
10
+ sortDirection?: string;
11
+ query?: string;
12
+ }
13
+
14
+ export const getCriticalitiesQuery = ({ tags, page, records, sortBy, sortDirection, query, ...options }: CriticalitiesQueryProps) => {
15
+ return useQuery(
16
+ ['CRITICALITIES_QUERY', tags, page, records, sortBy, sortDirection, query, options],
17
+ () => getAuth0<ResponseList<"Criticalities", ReasonCodes>>('/ATIM/Criticalities', {
18
+ pPage: page || 1,
19
+ pRecords: records || 50,
20
+ pSortBy: sortBy || 'Value',
21
+ pSortDirection: sortDirection || 'asc',
22
+ pTerms: tags,
23
+ pQuery: query,
24
+ }),
25
+ options
26
+ );
27
+ }
@@ -0,0 +1,27 @@
1
+ import { useQuery, UseQueryOptions } from "@tanstack/react-query";
2
+ import { ReasonCodes, ResponseList } from "../../../interfaces";
3
+ import { getAuth0 } from "../../../services/ApiService";
4
+
5
+ export interface ReasonCodesQueryProps extends UseQueryOptions<ResponseList<"ReasonCodes", ReasonCodes>> {
6
+ tags?: string;
7
+ page?: number;
8
+ records?: number;
9
+ sortBy?: string;
10
+ sortDirection?: string;
11
+ query?: string;
12
+ }
13
+
14
+ export const getReasonCodesQuery = ({ tags, page, records, sortBy, sortDirection, query, ...options }: ReasonCodesQueryProps) => {
15
+ return useQuery(
16
+ ['REASON_CODES_QUERY', tags, page, records, sortBy, sortDirection, query, options],
17
+ () => getAuth0<ResponseList<"ReasonCodes", ReasonCodes>>('/ATIM/ReasonCodes', {
18
+ pPage: page || 1,
19
+ pRecords: records || 50,
20
+ pSortBy: sortBy || 'Name',
21
+ pSortDirection: sortDirection || 'asc',
22
+ pTerms: tags,
23
+ pQuery: query,
24
+ }),
25
+ options
26
+ );
27
+ }
@@ -172,6 +172,8 @@ export * from "./ATIM/PicaPonto/mutate/postAttendance.hook";
172
172
  export * from "./WidgetPicaPonto/get/getAttendanceIssuesByIdQuery.hook";
173
173
  export * from "./WidgetPicaPonto/get/getAttendanceIssuesQuery.hook";
174
174
  export * from "./WidgetPicaPonto/others/postAttendanceIssuesQuery.hook";
175
+ export * from "./WidgetPicaPonto/get/getCriticaliesQuery.hook";
176
+ export * from "./WidgetPicaPonto/get/getReasonCodesQuery.hook";
175
177
 
176
178
  //ASTA
177
179
  export * from "./Asta/Template/get/getTemplateByIdQuery.hook";
@@ -0,0 +1,9 @@
1
+
2
+ export interface ReasonCodes {
3
+ Id: string;
4
+ Name: string;
5
+ Value: string;
6
+ CreateDate: number;
7
+ UpdateDate: number;
8
+ Status: string;
9
+ }
@@ -3,4 +3,5 @@ export type ResponseList<K extends string, T> = {
3
3
  [key in K]: T[];
4
4
  } & {
5
5
  Count: number;
6
+ TotalCount: number;
6
7
  };
@@ -58,3 +58,4 @@ export * from './MIMO';
58
58
  export * from './Bulk';
59
59
  export * from './AttendanceIssues';
60
60
  export * from './Bwg';
61
+ export * from './ReasonCodes';