@omniumretail/shared-resources 0.1.90 → 0.1.92
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/Aprc/get/getPriceChangePinQuery.hook.d.ts +2 -0
- package/dist/types/hooks/Aprc/others/postPriceChangePinQuery.hook.d.ts +6 -0
- package/dist/types/hooks/Aprc/others/sendEmailWithPinQuery.hook.d.ts +6 -0
- package/dist/types/hooks/index.d.ts +3 -1
- package/dist/types/interfaces/PriceChange.d.ts +1 -0
- package/dist/types/services/ApiService/index.d.ts +1 -0
- package/package.json +1 -1
- package/src/hooks/Aprc/get/getPriceChangePinQuery.hook.ts +14 -0
- package/src/hooks/Aprc/others/postPriceChangePinQuery.hook.ts +19 -0
- package/src/hooks/Aprc/others/sendEmailWithPinQuery.hook.ts +19 -0
- package/src/hooks/index.ts +5 -1
- package/src/interfaces/PriceChange.ts +1 -0
- package/src/services/ApiService/index.ts +6 -1
- package/src/hooks/Others/getPriceChangePinQuery.hook.ts +0 -11
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { UseQueryOptions } from "@tanstack/react-query";
|
|
2
|
+
import { PrinceChange } from "../../../interfaces";
|
|
3
|
+
export interface PriceChangeProps extends UseQueryOptions<PrinceChange> {
|
|
4
|
+
storeId: string;
|
|
5
|
+
}
|
|
6
|
+
export declare const postPriceChangePinQueryHook: ({ storeId }: PriceChangeProps) => import("@tanstack/react-query").UseMutationResult<PrinceChange, unknown, PrinceChange, unknown>;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { UseQueryOptions } from "@tanstack/react-query";
|
|
2
|
+
import { PrinceChange } from "../../../interfaces";
|
|
3
|
+
export interface EmailWithPinChangeProps extends UseQueryOptions<PrinceChange> {
|
|
4
|
+
storeId: string;
|
|
5
|
+
}
|
|
6
|
+
export declare const sendEmailWithPinQueryHook: ({ storeId }: EmailWithPinChangeProps) => import("@tanstack/react-query").UseMutationResult<PrinceChange, unknown, PrinceChange, unknown>;
|
|
@@ -99,6 +99,9 @@ export * from './Asta/Actions/others/deleteActionQuery.hook';
|
|
|
99
99
|
export * from './Asta/Actions/others/extractActionQuery.hook';
|
|
100
100
|
export * from './Asta/Actions/others/archiveActionQuery.hook';
|
|
101
101
|
export * from './Asta/Actions/others/finishActionQuery.hook';
|
|
102
|
+
export * from './Aprc/get/getPriceChangePinQuery.hook';
|
|
103
|
+
export * from './Aprc/others/postPriceChangePinQuery.hook';
|
|
104
|
+
export * from './Aprc/others/sendEmailWithPinQuery.hook';
|
|
102
105
|
export * from './Others/useJobTitlesQuery.hook';
|
|
103
106
|
export * from './Others/useContractStatesQuery.hook';
|
|
104
107
|
export * from './Others/useApplicationDataQuery.hook';
|
|
@@ -111,6 +114,5 @@ export * from './Others/postVerifyImageQuery.hook';
|
|
|
111
114
|
export * from './Others/getWeeklyWorkloadQuery.hook';
|
|
112
115
|
export * from './Others/getNotificationTitleQuery.hook';
|
|
113
116
|
export * from './Others/getUserEmailStatusQuery.hook';
|
|
114
|
-
export * from './Others/getPriceChangePinQuery.hook';
|
|
115
117
|
export * from './Others/getRegulationQuery.hook';
|
|
116
118
|
export * from './Others/useRegulationQuery.hook';
|
|
@@ -7,4 +7,5 @@ export declare const postAuth0: <T>(path: string, params?: Record<string, unknow
|
|
|
7
7
|
export declare const toDeleteAuth0: <T>(path: string, params?: Record<string, unknown>, body?: unknown) => Promise<T>;
|
|
8
8
|
export declare const post: <T>(path: string, body?: unknown) => Promise<T>;
|
|
9
9
|
export declare const put: <T>(path: string, body?: unknown) => Promise<T>;
|
|
10
|
+
export declare const patch: <T>(path: string, body?: unknown) => Promise<T>;
|
|
10
11
|
export declare const toDelete: <T>(path: string, body?: unknown) => Promise<T>;
|
package/package.json
CHANGED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { useQuery } from "@tanstack/react-query";
|
|
2
|
+
import { PrinceChange } from "../../../interfaces";
|
|
3
|
+
import { getAuth0 } from "../../../services/ApiService";
|
|
4
|
+
|
|
5
|
+
export const getPriceChangePinQueryHook = (storeId: string) => {
|
|
6
|
+
return useQuery(
|
|
7
|
+
['PRICE_CHANGE_PIN_QUERY', storeId],
|
|
8
|
+
() => getAuth0<PrinceChange>(`/GNG/Users/Pin/${storeId}`),
|
|
9
|
+
{
|
|
10
|
+
enabled: !!(storeId),
|
|
11
|
+
},
|
|
12
|
+
);
|
|
13
|
+
}
|
|
14
|
+
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { UseQueryOptions, useMutation, useQueryClient } from "@tanstack/react-query";
|
|
2
|
+
import { PrinceChange } from "../../../interfaces";
|
|
3
|
+
import { postAuth0 } from "../../../services/ApiService";
|
|
4
|
+
|
|
5
|
+
export interface PriceChangeProps extends UseQueryOptions<PrinceChange> {
|
|
6
|
+
storeId: string;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export const postPriceChangePinQueryHook = ({ storeId }: PriceChangeProps) => {
|
|
10
|
+
const queryClient = useQueryClient();
|
|
11
|
+
return useMutation<PrinceChange, unknown, PrinceChange>(() => {
|
|
12
|
+
return postAuth0(`/GNG/Users/Pin/${storeId}`)
|
|
13
|
+
}, {
|
|
14
|
+
onSuccess: (data: PrinceChange) => {
|
|
15
|
+
queryClient.setQueryData(
|
|
16
|
+
['PRICE_CHANGE_PIN_QUERY'], data);
|
|
17
|
+
},
|
|
18
|
+
});
|
|
19
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { UseQueryOptions, useMutation, useQueryClient } from "@tanstack/react-query";
|
|
2
|
+
import { PrinceChange } from "../../../interfaces";
|
|
3
|
+
import { postAuth0 } from "../../../services/ApiService";
|
|
4
|
+
|
|
5
|
+
export interface EmailWithPinChangeProps extends UseQueryOptions<PrinceChange> {
|
|
6
|
+
storeId: string;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export const sendEmailWithPinQueryHook = ({ storeId }: EmailWithPinChangeProps) => {
|
|
10
|
+
const queryClient = useQueryClient();
|
|
11
|
+
return useMutation<PrinceChange, unknown, PrinceChange>(() => {
|
|
12
|
+
return postAuth0(`/GNG/Users/Pin/Email/${storeId}`)
|
|
13
|
+
}, {
|
|
14
|
+
onSuccess: (data: PrinceChange) => {
|
|
15
|
+
queryClient.setQueryData(
|
|
16
|
+
['EMAIL_PIN_QUERY'], data);
|
|
17
|
+
},
|
|
18
|
+
});
|
|
19
|
+
}
|
package/src/hooks/index.ts
CHANGED
|
@@ -129,6 +129,11 @@ export * from './Asta/Actions/others/extractActionQuery.hook';
|
|
|
129
129
|
export * from './Asta/Actions/others/archiveActionQuery.hook';
|
|
130
130
|
export * from './Asta/Actions/others/finishActionQuery.hook';
|
|
131
131
|
|
|
132
|
+
//APRC
|
|
133
|
+
export * from './Aprc/get/getPriceChangePinQuery.hook';
|
|
134
|
+
export * from './Aprc/others/postPriceChangePinQuery.hook';
|
|
135
|
+
export * from './Aprc/others/sendEmailWithPinQuery.hook';
|
|
136
|
+
|
|
132
137
|
//Others
|
|
133
138
|
export * from './Others/useJobTitlesQuery.hook';
|
|
134
139
|
export * from './Others/useContractStatesQuery.hook';
|
|
@@ -142,6 +147,5 @@ export * from './Others/postVerifyImageQuery.hook';
|
|
|
142
147
|
export * from './Others/getWeeklyWorkloadQuery.hook';
|
|
143
148
|
export * from './Others/getNotificationTitleQuery.hook';
|
|
144
149
|
export * from './Others/getUserEmailStatusQuery.hook';
|
|
145
|
-
export * from './Others/getPriceChangePinQuery.hook';
|
|
146
150
|
export * from './Others/getRegulationQuery.hook';
|
|
147
151
|
export * from './Others/useRegulationQuery.hook';
|
|
@@ -33,6 +33,11 @@ export const put = <T>(path: string, body?: unknown): Promise<T> => {
|
|
|
33
33
|
return buildApiRequest<T>(path, 'PUT', body);
|
|
34
34
|
}
|
|
35
35
|
|
|
36
|
+
export const patch = <T>(path: string, body?: unknown): Promise<T> => {
|
|
37
|
+
return buildApiRequest<T>(path, 'PATCH', body);
|
|
38
|
+
|
|
39
|
+
}
|
|
40
|
+
|
|
36
41
|
export const toDelete = <T>(path: string, body?: unknown): Promise<T> => {
|
|
37
42
|
return buildApiRequest<T>(path, 'DELETE', body);
|
|
38
43
|
}
|
|
@@ -97,7 +102,7 @@ const buildApiRequestForAuth0 = <T>(path: string, method = 'GET', data?: unknown
|
|
|
97
102
|
|
|
98
103
|
let body: FormData | string | undefined | any;
|
|
99
104
|
|
|
100
|
-
if (['POST', 'PUT'].includes(method)) {
|
|
105
|
+
if (['POST', 'PUT', 'PATCH'].includes(method)) {
|
|
101
106
|
if (bodyType === 'formdata') {
|
|
102
107
|
// Não é necessário dar set do contentType porque o fetch faz isso por nós quando usamos o fetch
|
|
103
108
|
body = data;
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { useQuery } from "@tanstack/react-query";
|
|
2
|
-
import { PrinceChange } from "../../interfaces";
|
|
3
|
-
import { getAuth0 } from "../../services/ApiService";
|
|
4
|
-
|
|
5
|
-
export const getPriceChangePinQueryHook = () => {
|
|
6
|
-
return useQuery(
|
|
7
|
-
['PRICE_CHANGE_PIN_QUERY'],
|
|
8
|
-
() => getAuth0<PrinceChange>(`/GNG/Users/Pin`),
|
|
9
|
-
);
|
|
10
|
-
}
|
|
11
|
-
|