@omniumretail/shared-resources 0.1.82 → 0.1.84

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 (22) hide show
  1. package/dist/bundle.js +1 -1
  2. package/dist/types/hooks/Asta/Answer/get/getAstaAnswerByIdQuery.hook.d.ts +2 -0
  3. package/dist/types/hooks/Asta/AnswerType/get/getAllAnswerTypeQuery.hook.d.ts +11 -0
  4. package/dist/types/hooks/Asta/AnswerType/get/getAnswerColorsQuery.hook.d.ts +2 -0
  5. package/dist/types/hooks/Asta/AnswerType/get/getAnswerTypeByIdQuery.hook.d.ts +2 -0
  6. package/dist/types/hooks/Asta/AnswerType/mutate/useAnswerTypeMutateQuery.hook.d.ts +2 -0
  7. package/dist/types/hooks/Asta/AnswerType/others/deleteAnswerTypeQuery.hook.d.ts +6 -0
  8. package/dist/types/hooks/Asta/AnswerType/others/finishAnswerTypeQuery.hook.d.ts +2 -0
  9. package/dist/types/hooks/index.d.ts +8 -0
  10. package/dist/types/interfaces/AnswerType.d.ts +2 -0
  11. package/package.json +1 -1
  12. package/src/hooks/Asta/Answer/get/getAstaAnswerByIdQuery.hook.ts +15 -0
  13. package/src/hooks/Asta/Answer/get/getAstaAnswerQuery.hook.ts +1 -1
  14. package/src/hooks/Asta/Answer/others/finishAstaAnswersQuery.hook.ts +1 -1
  15. package/src/hooks/Asta/AnswerType/get/getAllAnswerTypeQuery.hook.ts +29 -0
  16. package/src/hooks/Asta/AnswerType/get/getAnswerColorsQuery.hook.ts +10 -0
  17. package/src/hooks/Asta/AnswerType/get/getAnswerTypeByIdQuery.hook.ts +15 -0
  18. package/src/hooks/Asta/AnswerType/mutate/useAnswerTypeMutateQuery.hook.ts +20 -0
  19. package/src/hooks/Asta/AnswerType/others/deleteAnswerTypeQuery.hook.ts +19 -0
  20. package/src/hooks/Asta/AnswerType/others/finishAnswerTypeQuery.hook.ts +17 -0
  21. package/src/hooks/index.ts +8 -0
  22. package/src/interfaces/AnswerType.ts +2 -0
@@ -0,0 +1,2 @@
1
+ import { Answer } from "../../../../interfaces";
2
+ export declare const getAnswerByIdQueryHook: (answerId: string) => import("@tanstack/react-query").UseQueryResult<Answer, unknown>;
@@ -0,0 +1,11 @@
1
+ import { UseQueryOptions } from "@tanstack/react-query";
2
+ import { AnswerType, ResponseList } from "../../../../interfaces";
3
+ export interface AnswerTypeQueryProps extends UseQueryOptions<ResponseList<"Value", AnswerType>> {
4
+ tags?: string;
5
+ page?: number;
6
+ records?: number;
7
+ sortBy?: string;
8
+ sortDirection?: string;
9
+ query?: string;
10
+ }
11
+ export declare const getAllAnswerTypeQueryHook: ({ tags, page, records, sortBy, sortDirection, query }: AnswerTypeQueryProps) => import("@tanstack/react-query").UseQueryResult<ResponseList<"Value", AnswerType>, unknown>;
@@ -0,0 +1,2 @@
1
+ import { HeadersInterface } from "../../../../interfaces";
2
+ export declare const getAnswerColorsQueryHook: () => import("@tanstack/react-query").UseQueryResult<HeadersInterface[], unknown>;
@@ -0,0 +1,2 @@
1
+ import { AnswerType } from "../../../../interfaces";
2
+ export declare const getAnswerTypeByIdQueryHook: (answerTypeId: string) => import("@tanstack/react-query").UseQueryResult<AnswerType, unknown>;
@@ -0,0 +1,2 @@
1
+ import { AnswerType } from '../../../../interfaces';
2
+ export declare const useAnswerTypeMutateHook: () => import("@tanstack/react-query").UseMutationResult<AnswerType, unknown, AnswerType, unknown>;
@@ -0,0 +1,6 @@
1
+ import { UseQueryOptions } from '@tanstack/react-query';
2
+ import { AnswerType } from '../../../../interfaces';
3
+ export interface DeleteAnswerTypeProps extends UseQueryOptions<AnswerType> {
4
+ answerTypeIds: string[];
5
+ }
6
+ export declare const deleteAnswerTypeHook: ({ answerTypeIds }: DeleteAnswerTypeProps) => import("@tanstack/react-query").UseMutationResult<AnswerType, unknown, string[], unknown>;
@@ -0,0 +1,2 @@
1
+ import { AnswerType } from '../../../../interfaces';
2
+ export declare const finishAnswerTypeQueryHook: () => import("@tanstack/react-query").UseMutationResult<AnswerType, unknown, AnswerType, unknown>;
@@ -76,10 +76,18 @@ export * from './Asta/Inspection/others/finishInspectionQuery.hook';
76
76
  export * from './Asta/Inspection/others/archiveTemplateQuery.hook';
77
77
  export * from './Asta/Inspection/others/extractTemplateQuery.hook';
78
78
  export * from './Asta/Answer/get/getAstaAnswerQuery.hook';
79
+ export * from './Asta/Answer/get/getAstaAnswerByIdQuery.hook';
79
80
  export * from './Asta/Answer/mutate/useAstaAnswersMutateQuery.hook';
80
81
  export * from './Asta/Answer/others/finishAstaAnswersQuery.hook';
81
82
  export * from './Asta/Answer/others/putAnswerImageQuery.hook';
82
83
  export * from './Asta/AnswerType/get/getAnswerTypeQuery.hook';
84
+ export * from './Asta/AnswerType/get/getAllAnswerTypeQuery.hook';
85
+ export * from './Asta/AnswerType/get/getAnswerColorsQuery.hook';
86
+ export * from './Asta/AnswerType/get/getAnswerTypeByIdQuery.hook';
87
+ export * from './Asta/AnswerType/mutate/useAnswerTypeMutateQuery.hook';
88
+ export * from './Asta/AnswerType/mutate/useAnswerTypeMutateQuery.hook';
89
+ export * from './Asta/AnswerType/others/deleteAnswerTypeQuery.hook';
90
+ export * from './Asta/AnswerType/others/finishAnswerTypeQuery.hook';
83
91
  export * from './Asta/Actions/get/getActionByIdQuery.hook';
84
92
  export * from './Asta/Actions/get/getActionPriorityQuery.hook';
85
93
  export * from './Asta/Actions/get/getActionQuery.hook';
@@ -5,6 +5,8 @@ export interface AnswerType {
5
5
  IsCheckBox: boolean;
6
6
  IsNumeric: boolean;
7
7
  HasGrade: boolean;
8
+ isMandatory: boolean;
9
+ isEmphasis: boolean;
8
10
  State: string;
9
11
  Grade: number;
10
12
  Options: AnswerTypeOptions[];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@omniumretail/shared-resources",
3
- "version": "0.1.82",
3
+ "version": "0.1.84",
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,15 @@
1
+ import { useQuery } from "@tanstack/react-query";
2
+ import { Answer } from "../../../../interfaces";
3
+ import { getAuth0 } from "../../../../services/ApiService";
4
+
5
+ export const getAnswerByIdQueryHook = (answerId: string) => {
6
+ return useQuery(
7
+ ['ANSWER_ID_QUERY', answerId],
8
+ () => getAuth0<Answer>(`/ASTA/Answers/GetAnswerById`, {
9
+ pId: answerId
10
+ }),
11
+ {
12
+ enabled: !!(answerId),
13
+ },
14
+ );
15
+ }
@@ -14,7 +14,7 @@ export interface AstaAnswersQueryProps extends UseQueryOptions<ResponseList<"Ans
14
14
  export const getAstaAnswersQueryHook = ({ tags, page, records, sortBy, sortDirection, query }: AstaAnswersQueryProps) => {
15
15
  return useQuery(
16
16
  ['ASTA_ANSWERS_QUERY', tags, page, records, sortBy, sortDirection, query],
17
- () => getAuth0<ResponseList<"Answers", Answer>>('/ASTA/Answers/GetInspection', {
17
+ () => getAuth0<ResponseList<"Answers", Answer>>('/ASTA/Answers/GetAnswers', {
18
18
  pPage: page || 1,
19
19
  pRecords: records || 50,
20
20
  pSortBy: sortBy || 'Type',
@@ -5,7 +5,7 @@ import { putAuth0 } from '../../../../services/ApiService';
5
5
  export const finishAstaAnswersQueryHook = () => {
6
6
  const queryClient = useQueryClient();
7
7
  return useMutation<Answer, unknown, Answer>((data: Answer) => {
8
- return putAuth0(`/ASTA/Answers/FinishQuestionnaire/${data.Id}`, undefined, data)
8
+ return putAuth0(`/ASTA/Answers/FinishInspectionAnswer/${data.Id}`, undefined, data)
9
9
  }, {
10
10
  onSuccess: (data: Answer) => {
11
11
  queryClient.setQueryData(
@@ -0,0 +1,29 @@
1
+ import { useQuery, UseQueryOptions } from "@tanstack/react-query";
2
+ import { AnswerType, ResponseList } from "../../../../interfaces";
3
+ import { getAuth0 } from "../../../../services/ApiService";
4
+
5
+ export interface AnswerTypeQueryProps extends UseQueryOptions<ResponseList<"Value", AnswerType>> {
6
+ tags?: string;
7
+ page?: number;
8
+ records?: number;
9
+ sortBy?: string;
10
+ sortDirection?: string;
11
+ query?: string;
12
+ }
13
+
14
+ export const getAllAnswerTypeQueryHook = ({ tags, page, records, sortBy, sortDirection, query }: AnswerTypeQueryProps) => {
15
+ return useQuery(
16
+ ['ALL_ANSWER_TYPE_QUERY', tags, page, records, sortBy, sortDirection, query],
17
+ () => getAuth0<ResponseList<"Value", AnswerType>>('/ASTA/AnswerType/GetByQuery', {
18
+ pPage: page || 1,
19
+ pRecords: records || 50,
20
+ pSortBy: sortBy || 'Type',
21
+ pSortDirection: sortDirection || 'asc',
22
+ pTerms: tags,
23
+ pQuery: query
24
+ }),
25
+ {
26
+ keepPreviousData: true,
27
+ }
28
+ );
29
+ }
@@ -0,0 +1,10 @@
1
+ import { useQuery } from "@tanstack/react-query";
2
+ import { HeadersInterface } from "../../../../interfaces";
3
+ import { getAuth0 } from "../../../../services/ApiService";
4
+
5
+ export const getAnswerColorsQueryHook = () => {
6
+ return useQuery(
7
+ ['ANSWER_COLORS_QUERY'],
8
+ () => getAuth0<HeadersInterface[]>(`/ASTA/AnswerType/Colors`),
9
+ );
10
+ }
@@ -0,0 +1,15 @@
1
+ import { useQuery } from "@tanstack/react-query";
2
+ import { AnswerType } from "../../../../interfaces";
3
+ import { getAuth0 } from "../../../../services/ApiService";
4
+
5
+ export const getAnswerTypeByIdQueryHook = (answerTypeId: string) => {
6
+ return useQuery(
7
+ ['ANSWER_TYPE_ID_QUERY', answerTypeId],
8
+ () => getAuth0<AnswerType>(`/ASTA/AnswerType/GetById`, {
9
+ pId: answerTypeId
10
+ }),
11
+ {
12
+ enabled: !!(answerTypeId),
13
+ },
14
+ );
15
+ }
@@ -0,0 +1,20 @@
1
+ import { useMutation, useQueryClient } from '@tanstack/react-query';
2
+ import { AnswerType } from '../../../../interfaces';
3
+ import { putAuth0, postAuth0 } from '../../../../services/ApiService';
4
+
5
+ export const useAnswerTypeMutateHook = () => {
6
+ const queryClient = useQueryClient();
7
+ return useMutation<AnswerType, unknown, AnswerType>((data: AnswerType) => {
8
+ return data.Id ?
9
+ putAuth0(`/ASTA/AnswerType?`, {
10
+ pId: data.Id
11
+ }, data)
12
+
13
+ : postAuth0('/ASTA/AnswerType', undefined, data);
14
+ }, {
15
+ onSuccess: (data: AnswerType) => {
16
+ queryClient.setQueryData(
17
+ ['ANSWER_TYPE_ID_QUERY'], data);
18
+ },
19
+ });
20
+ }
@@ -0,0 +1,19 @@
1
+ import { UseQueryOptions, useMutation, useQueryClient } from '@tanstack/react-query';
2
+ import { AnswerType } from '../../../../interfaces';
3
+ import { toDeleteAuth0 } from '../../../../services/ApiService';
4
+
5
+ export interface DeleteAnswerTypeProps extends UseQueryOptions<AnswerType> {
6
+ answerTypeIds: string[];
7
+ }
8
+
9
+ export const deleteAnswerTypeHook = ({ answerTypeIds }: DeleteAnswerTypeProps) => {
10
+ const queryClient = useQueryClient();
11
+ return useMutation<AnswerType, unknown, string[]>(() => {
12
+ return toDeleteAuth0(`/ASTA/AnswerType/Delete`, undefined, answerTypeIds)
13
+ }, {
14
+ onSuccess: () => {
15
+ queryClient.invalidateQueries(
16
+ ['ALL_ANSWER_TYPE_QUERY']);
17
+ },
18
+ });
19
+ }
@@ -0,0 +1,17 @@
1
+ import { useMutation, useQueryClient } from '@tanstack/react-query';
2
+ import { AnswerType } from '../../../../interfaces';
3
+ import { putAuth0 } from '../../../../services/ApiService';
4
+
5
+ export const finishAnswerTypeQueryHook = () => {
6
+ const queryClient = useQueryClient();
7
+ return useMutation<AnswerType, unknown, AnswerType>((data: AnswerType) => {
8
+ return putAuth0(`/ASTA/AnswerType/Finished?`, {
9
+ pId: data.Id
10
+ }, data);
11
+ }, {
12
+ onSuccess: (data: AnswerType) => {
13
+ queryClient.setQueryData(
14
+ ['ANSWER_TYPE_ID_QUERY'], data);
15
+ },
16
+ });
17
+ }
@@ -101,11 +101,19 @@ export * from './Asta/Inspection/others/archiveTemplateQuery.hook';
101
101
  export * from './Asta/Inspection/others/extractTemplateQuery.hook';
102
102
 
103
103
  export * from './Asta/Answer/get/getAstaAnswerQuery.hook';
104
+ export * from './Asta/Answer/get/getAstaAnswerByIdQuery.hook';
104
105
  export * from './Asta/Answer/mutate/useAstaAnswersMutateQuery.hook';
105
106
  export * from './Asta/Answer/others/finishAstaAnswersQuery.hook';
106
107
  export * from './Asta/Answer/others/putAnswerImageQuery.hook';
107
108
 
108
109
  export * from './Asta/AnswerType/get/getAnswerTypeQuery.hook';
110
+ export * from './Asta/AnswerType/get/getAllAnswerTypeQuery.hook';
111
+ export * from './Asta/AnswerType/get/getAnswerColorsQuery.hook';
112
+ export * from './Asta/AnswerType/get/getAnswerTypeByIdQuery.hook';
113
+ export * from './Asta/AnswerType/mutate/useAnswerTypeMutateQuery.hook';
114
+ export * from './Asta/AnswerType/mutate/useAnswerTypeMutateQuery.hook';
115
+ export * from './Asta/AnswerType/others/deleteAnswerTypeQuery.hook';
116
+ export * from './Asta/AnswerType/others/finishAnswerTypeQuery.hook';
109
117
 
110
118
  export * from './Asta/Actions/get/getActionByIdQuery.hook';
111
119
  export * from './Asta/Actions/get/getActionPriorityQuery.hook';
@@ -6,6 +6,8 @@ export interface AnswerType {
6
6
  IsCheckBox: boolean;
7
7
  IsNumeric: boolean;
8
8
  HasGrade: boolean;
9
+ isMandatory: boolean;
10
+ isEmphasis: boolean;
9
11
  State: string;
10
12
  Grade: number;
11
13
  Options: AnswerTypeOptions[];