@omniumretail/shared-resources 0.1.82 → 0.1.83
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.
- package/dist/bundle.js +1 -1
- package/dist/types/hooks/Asta/AnswerType/get/getAllAnswerTypeQuery.hook.d.ts +11 -0
- package/dist/types/hooks/Asta/AnswerType/get/getAnswerColorsQuery.hook.d.ts +2 -0
- package/dist/types/hooks/Asta/AnswerType/get/getAnswerTypeByIdQuery.hook.d.ts +2 -0
- package/dist/types/hooks/Asta/AnswerType/mutate/useAnswerTypeMutateQuery.hook.d.ts +2 -0
- package/dist/types/hooks/Asta/AnswerType/others/deleteAnswerTypeQuery.hook.d.ts +6 -0
- package/dist/types/hooks/Asta/AnswerType/others/finishAnswerTypeQuery.hook.d.ts +2 -0
- package/dist/types/hooks/index.d.ts +7 -0
- package/dist/types/interfaces/AnswerType.d.ts +2 -0
- package/package.json +1 -1
- package/src/hooks/Asta/AnswerType/get/getAllAnswerTypeQuery.hook.ts +29 -0
- package/src/hooks/Asta/AnswerType/get/getAnswerColorsQuery.hook.ts +10 -0
- package/src/hooks/Asta/AnswerType/get/getAnswerTypeByIdQuery.hook.ts +15 -0
- package/src/hooks/Asta/AnswerType/mutate/useAnswerTypeMutateQuery.hook.ts +20 -0
- package/src/hooks/Asta/AnswerType/others/deleteAnswerTypeQuery.hook.ts +19 -0
- package/src/hooks/Asta/AnswerType/others/finishAnswerTypeQuery.hook.ts +17 -0
- package/src/hooks/index.ts +7 -0
- package/src/interfaces/AnswerType.ts +2 -0
|
@@ -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,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>;
|
|
@@ -80,6 +80,13 @@ export * from './Asta/Answer/mutate/useAstaAnswersMutateQuery.hook';
|
|
|
80
80
|
export * from './Asta/Answer/others/finishAstaAnswersQuery.hook';
|
|
81
81
|
export * from './Asta/Answer/others/putAnswerImageQuery.hook';
|
|
82
82
|
export * from './Asta/AnswerType/get/getAnswerTypeQuery.hook';
|
|
83
|
+
export * from './Asta/AnswerType/get/getAllAnswerTypeQuery.hook';
|
|
84
|
+
export * from './Asta/AnswerType/get/getAnswerColorsQuery.hook';
|
|
85
|
+
export * from './Asta/AnswerType/get/getAnswerTypeByIdQuery.hook';
|
|
86
|
+
export * from './Asta/AnswerType/mutate/useAnswerTypeMutateQuery.hook';
|
|
87
|
+
export * from './Asta/AnswerType/mutate/useAnswerTypeMutateQuery.hook';
|
|
88
|
+
export * from './Asta/AnswerType/others/deleteAnswerTypeQuery.hook';
|
|
89
|
+
export * from './Asta/AnswerType/others/finishAnswerTypeQuery.hook';
|
|
83
90
|
export * from './Asta/Actions/get/getActionByIdQuery.hook';
|
|
84
91
|
export * from './Asta/Actions/get/getActionPriorityQuery.hook';
|
|
85
92
|
export * from './Asta/Actions/get/getActionQuery.hook';
|
package/package.json
CHANGED
|
@@ -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
|
+
}
|
package/src/hooks/index.ts
CHANGED
|
@@ -106,6 +106,13 @@ export * from './Asta/Answer/others/finishAstaAnswersQuery.hook';
|
|
|
106
106
|
export * from './Asta/Answer/others/putAnswerImageQuery.hook';
|
|
107
107
|
|
|
108
108
|
export * from './Asta/AnswerType/get/getAnswerTypeQuery.hook';
|
|
109
|
+
export * from './Asta/AnswerType/get/getAllAnswerTypeQuery.hook';
|
|
110
|
+
export * from './Asta/AnswerType/get/getAnswerColorsQuery.hook';
|
|
111
|
+
export * from './Asta/AnswerType/get/getAnswerTypeByIdQuery.hook';
|
|
112
|
+
export * from './Asta/AnswerType/mutate/useAnswerTypeMutateQuery.hook';
|
|
113
|
+
export * from './Asta/AnswerType/mutate/useAnswerTypeMutateQuery.hook';
|
|
114
|
+
export * from './Asta/AnswerType/others/deleteAnswerTypeQuery.hook';
|
|
115
|
+
export * from './Asta/AnswerType/others/finishAnswerTypeQuery.hook';
|
|
109
116
|
|
|
110
117
|
export * from './Asta/Actions/get/getActionByIdQuery.hook';
|
|
111
118
|
export * from './Asta/Actions/get/getActionPriorityQuery.hook';
|