@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.
@@ -0,0 +1,2 @@
1
+ import { PrinceChange } from "../../../interfaces";
2
+ export declare const getPriceChangePinQueryHook: (storeId: string) => import("@tanstack/react-query").UseQueryResult<PrinceChange, unknown>;
@@ -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';
@@ -2,4 +2,5 @@ export interface PrinceChange {
2
2
  Pin: string;
3
3
  ExpirationDate: number;
4
4
  CreationDate: number;
5
+ StoreExternalId: string;
5
6
  }
@@ -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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@omniumretail/shared-resources",
3
- "version": "0.1.90",
3
+ "version": "0.1.92",
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,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
+ }
@@ -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';
@@ -3,4 +3,5 @@ export interface PrinceChange {
3
3
  Pin: string;
4
4
  ExpirationDate: number;
5
5
  CreationDate: number;
6
+ StoreExternalId: string;
6
7
  }
@@ -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
-