@omniumretail/shared-resources 0.2.71 → 0.2.73

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,2 @@
1
+ import { Inspection } from '../../../../interfaces';
2
+ export declare const sendInspectionEmailMutateHook: (answerId: string, userName: string, email: string, storeId: string, pdfUrl: string) => import("@tanstack/react-query").UseMutationResult<Inspection, unknown, Inspection, unknown>;
@@ -0,0 +1,2 @@
1
+ import { Inspection } from '../../../../interfaces';
2
+ export declare const exportInspectionMutateHook: (inspectionId: string, userName: string, language?: string) => import("@tanstack/react-query").UseMutationResult<Inspection, unknown, Inspection, unknown>;
@@ -0,0 +1,10 @@
1
+ import { UseQueryOptions } from '@tanstack/react-query';
2
+ import { ResponseList, DocumentErrorEvent } from '../../../../interfaces';
3
+ interface GetSitooErrorEventsProps extends UseQueryOptions<ResponseList<"Events", DocumentErrorEvent>> {
4
+ page?: number;
5
+ records?: number;
6
+ sortBy?: string;
7
+ sortDirection?: string;
8
+ }
9
+ export declare const getSitooErrorEvents: ({ page, records, sortBy, sortDirection, ...options }: GetSitooErrorEventsProps) => import("@tanstack/react-query").UseQueryResult<ResponseList<"Events", DocumentErrorEvent>, unknown>;
10
+ export {};
@@ -0,0 +1 @@
1
+ export declare const postEventsRep: () => import("@tanstack/react-query").UseMutationResult<string, unknown, void, unknown>;
@@ -177,6 +177,7 @@ export * from "./Asta/Inspection/others/deleteInspectionQuery.hook";
177
177
  export * from "./Asta/Inspection/others/finishInspectionQuery.hook";
178
178
  export * from "./Asta/Inspection/others/archiveTemplateQuery.hook";
179
179
  export * from "./Asta/Inspection/others/extractTemplateQuery.hook";
180
+ export * from "./Asta/Inspection/others/exportInspectionQuery.hook";
180
181
  export * from "./Asta/Answer/get/getAstaAnswerQuery.hook";
181
182
  export * from "./Asta/Answer/get/getAstaAnswerByIdQuery.hook";
182
183
  export * from "./Asta/Answer/mutate/useAstaAnswersMutateQuery.hook";
@@ -187,6 +188,7 @@ export * from "./Asta/Answer/get/getAstaAnswerByIdQuery.hook";
187
188
  export * from "./Asta/Answer/mutate/useAstaAnswersMutateQuery.hook";
188
189
  export * from "./Asta/Answer/others/finishAstaAnswersQuery.hook";
189
190
  export * from "./Asta/Answer/others/putAnswerImageQuery.hook";
191
+ export * from "./Asta/Answer/others/sendInspectionEmailQuery.hook";
190
192
  export * from "./Asta/AnswerType/get/getAnswerTypeQuery.hook";
191
193
  export * from "./Asta/AnswerType/get/getAllAnswerTypeQuery.hook";
192
194
  export * from "./Asta/AnswerType/get/getAnswerColorsQuery.hook";
@@ -249,10 +251,12 @@ export * from "./OSUA/get/vouchers/getSitooVouchers.hook";
249
251
  export * from "./OSUA/get/vouchers/getVoucherIntegrationRequestStatus.hook";
250
252
  export * from "./OSUA/get/orders/getOrderDocuments.hook";
251
253
  export * from "./OSUA/get/faqs/getFaqsQuery.hook";
254
+ export * from "./OSUA/get/eventos/getSitooErrorEvents.hook";
252
255
  export * from "./OSUA/mutate/postCreateIntegrationRequest.hook";
253
256
  export * from "./OSUA/mutate/useSetIntegrationToFinished.hook";
254
257
  export * from "./OSUA/mutate/postCreateIntegrationRequest.hook";
255
258
  export * from "./OSUA/mutate/postCreateIntegrationRequest.hook";
259
+ export * from "./OSUA/mutate/postEventsRep.hook";
256
260
  export * from "./OSUA/MIMO/get/getIntegrationByName.hook";
257
261
  export * from "./OSUA/MIMO/get/getProductIntegrationHistory.hook";
258
262
  export * from "./OSUA/MIMO/get/useIntegrationDataQuery.hook";
@@ -17,4 +17,5 @@ export interface Inspection {
17
17
  EmployeeId: string;
18
18
  EmployeeName: string;
19
19
  CategoriesDTO: AstaCategories[];
20
+ AnswerExportURL: string;
20
21
  }
@@ -292,3 +292,9 @@ export interface ErrorHistoryItem {
292
292
  Id: string;
293
293
  Information: string;
294
294
  }
295
+ export interface DocumentErrorEvent {
296
+ EventId: string;
297
+ EventDate: string;
298
+ EventType: string;
299
+ ErrorMessage: string;
300
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@omniumretail/shared-resources",
3
- "version": "0.2.71",
3
+ "version": "0.2.73",
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,21 @@
1
+ import { useMutation, useQueryClient } from '@tanstack/react-query';
2
+ import { Inspection } from '../../../../interfaces';
3
+ import { postAuth0 } from '../../../../services/ApiService';
4
+
5
+ export const sendInspectionEmailMutateHook = (answerId: string, userName: string, email: string, storeId: string, pdfUrl: string) => {
6
+ const queryClient = useQueryClient();
7
+ return useMutation<Inspection, unknown, Inspection>((data: Inspection) => {
8
+ return postAuth0(`/ASTA/Answers/SendEmail?`, {
9
+ pAnswerId: answerId,
10
+ pUserName: userName,
11
+ pEmail: email,
12
+ pStoreId: storeId,
13
+ pPDFUrl: pdfUrl
14
+ }, data);
15
+ }, {
16
+ onSuccess: (data: Inspection) => {
17
+ queryClient.setQueryData(
18
+ ['SEND_INSPECTION_EMAIL_QUERY'], data);
19
+ },
20
+ });
21
+ }
@@ -0,0 +1,19 @@
1
+ import { useMutation, useQueryClient } from '@tanstack/react-query';
2
+ import { Inspection } from '../../../../interfaces';
3
+ import { postAuth0 } from '../../../../services/ApiService';
4
+
5
+ export const exportInspectionMutateHook = (inspectionId: string, userName: string, language?: string) => {
6
+ const queryClient = useQueryClient();
7
+ return useMutation<Inspection, unknown, Inspection>((data: Inspection) => {
8
+ return postAuth0(`/ASTA/Inspection/AnswerExport?`, {
9
+ pInspectionId: inspectionId,
10
+ pUserName: userName,
11
+ pLanguage: language || "PT"
12
+ }, data);
13
+ }, {
14
+ onSuccess: (data: Inspection) => {
15
+ queryClient.setQueryData(
16
+ ['EXPORT_INSPECTION_QUERY'], data);
17
+ },
18
+ });
19
+ }
@@ -0,0 +1,30 @@
1
+ import { useQuery, UseQueryOptions } from '@tanstack/react-query';
2
+ import { get } from "../../../../services/ApiService";
3
+ import { ResponseList, DocumentErrorEvent} from '../../../../interfaces';
4
+
5
+
6
+ interface GetSitooErrorEventsProps extends UseQueryOptions<ResponseList<"Events", DocumentErrorEvent>> {
7
+ page?: number;
8
+ records?: number;
9
+ sortBy?: string;
10
+ sortDirection?: string;
11
+ }
12
+
13
+ export const getSitooErrorEvents = ({
14
+ page,
15
+ records,
16
+ sortBy,
17
+ sortDirection,
18
+ ...options
19
+ }: GetSitooErrorEventsProps) => {
20
+ return useQuery(
21
+ ['SITOO_ERROR_EVENTS', page, records, sortBy, sortDirection],
22
+ () => get<ResponseList<"Events", DocumentErrorEvent>>('/Sitoo/Document/Events/Error', {
23
+ pPage: page,
24
+ pRecords: records,
25
+ pSortBy: sortBy || "EventDate",
26
+ pSortDirection: sortDirection || "desc",
27
+ }),
28
+ options
29
+ );
30
+ };
@@ -0,0 +1,16 @@
1
+ import { useQueryClient, useMutation } from "@tanstack/react-query";
2
+ import { post } from "../../../services/ApiService";
3
+
4
+ export const postEventsRep = () => {
5
+ const queryClient = useQueryClient();
6
+ return useMutation<string, unknown, void>(
7
+ () => {
8
+ return post("/Sitoo/Document/EventsReprocessing");
9
+ },
10
+ {
11
+ onSuccess: (data: string) => {
12
+ queryClient.setQueryData(["POST_EVENTS_REPROCESSING"], data);
13
+ },
14
+ }
15
+ );
16
+ };
@@ -209,6 +209,7 @@ export * from "./Asta/Inspection/others/deleteInspectionQuery.hook";
209
209
  export * from "./Asta/Inspection/others/finishInspectionQuery.hook";
210
210
  export * from "./Asta/Inspection/others/archiveTemplateQuery.hook";
211
211
  export * from "./Asta/Inspection/others/extractTemplateQuery.hook";
212
+ export * from "./Asta/Inspection/others/exportInspectionQuery.hook";
212
213
 
213
214
  export * from "./Asta/Answer/get/getAstaAnswerQuery.hook";
214
215
  export * from "./Asta/Answer/get/getAstaAnswerByIdQuery.hook";
@@ -220,6 +221,7 @@ export * from "./Asta/Answer/get/getAstaAnswerByIdQuery.hook";
220
221
  export * from "./Asta/Answer/mutate/useAstaAnswersMutateQuery.hook";
221
222
  export * from "./Asta/Answer/others/finishAstaAnswersQuery.hook";
222
223
  export * from "./Asta/Answer/others/putAnswerImageQuery.hook";
224
+ export * from "./Asta/Answer/others/sendInspectionEmailQuery.hook";
223
225
 
224
226
  export * from "./Asta/AnswerType/get/getAnswerTypeQuery.hook";
225
227
  export * from "./Asta/AnswerType/get/getAllAnswerTypeQuery.hook";
@@ -290,11 +292,14 @@ export * from "./OSUA/get/vouchers/getSitooVouchers.hook";
290
292
  export * from "./OSUA/get/vouchers/getVoucherIntegrationRequestStatus.hook";
291
293
  export * from "./OSUA/get/orders/getOrderDocuments.hook";
292
294
  export * from "./OSUA/get/faqs/getFaqsQuery.hook";
295
+ export * from "./OSUA/get/eventos/getSitooErrorEvents.hook";
293
296
 
294
297
  export * from "./OSUA/mutate/postCreateIntegrationRequest.hook";
295
298
  export * from "./OSUA/mutate/useSetIntegrationToFinished.hook";
296
299
  export * from "./OSUA/mutate/postCreateIntegrationRequest.hook";
297
300
  export * from "./OSUA/mutate/postCreateIntegrationRequest.hook";
301
+ export * from "./OSUA/mutate/postEventsRep.hook";
302
+
298
303
 
299
304
  //MIMO
300
305
  export * from "./OSUA/MIMO/get/getIntegrationByName.hook";
@@ -18,4 +18,5 @@ export interface Inspection {
18
18
  EmployeeId: string;
19
19
  EmployeeName: string;
20
20
  CategoriesDTO: AstaCategories[];
21
+ AnswerExportURL: string;
21
22
  }
@@ -321,6 +321,14 @@ export interface ErrorHistoryItem {
321
321
  Information: string;
322
322
  }
323
323
 
324
+ export interface DocumentErrorEvent {
325
+ EventId: string;
326
+ EventDate: string;
327
+ EventType: string;
328
+ ErrorMessage: string;
329
+
330
+ }
331
+
324
332
 
325
333
 
326
334
 
@@ -4,3 +4,4 @@ export type ResponseList<K extends string, T> = {
4
4
  Count: number;
5
5
  TotalCount: number;
6
6
  };
7
+