@omniumretail/shared-resources 0.3.72 → 0.3.74

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,3 @@
1
+ import { UseQueryOptions } from "@tanstack/react-query";
2
+ import { NotificationApplication } from "../../../interfaces/Anot";
3
+ export declare const getNotificationApplications: ({ ...options }: UseQueryOptions<NotificationApplication>) => import("@tanstack/react-query").UseQueryResult<NotificationApplication, unknown>;
@@ -0,0 +1,6 @@
1
+ import { UseQueryOptions } from "@tanstack/react-query";
2
+ interface SupportedLanguagesResponse {
3
+ SupportedLanguages: string[];
4
+ }
5
+ export declare const getNotificationLanguages: ({ ...options }: UseQueryOptions<SupportedLanguagesResponse>) => import("@tanstack/react-query").UseQueryResult<SupportedLanguagesResponse, unknown>;
6
+ export {};
@@ -0,0 +1,2 @@
1
+ import { AnotInterface } from '../../../interfaces/Anot';
2
+ export declare const createNotificationTypeQuery: () => import("@tanstack/react-query").UseMutationResult<AnotInterface, unknown, AnotInterface, unknown>;
@@ -398,9 +398,10 @@ export * from "./ASAEGNG/get/getCustomerHistoryQuery.hook";
398
398
  export * from "./ASAEGNG/get/getCustomerVouchersQuery.hook";
399
399
  export * from "./ASAEGNG/get/getCustomersQuery.hook";
400
400
  export * from "./Anot/get/getNotificationsTypeQuery.hook";
401
- export * from "./Anot/mutate/createNotificationTypeQuery.hook";
402
- export * from "./Anot/mutate/editNotificationTypeQuery.hook";
401
+ export * from "./Anot/mutate/useNotificationTypeQuery.hook";
403
402
  export * from "./Anot/get/getNotificationTypeByIdQuery.hook";
403
+ export * from "./Anot/get/getNotificationApplicationsQuery.hook";
404
+ export * from "./Anot/get/getNotificationLanguagesQuery.hook";
404
405
  export * from "./Others/useJobTitlesQuery.hook";
405
406
  export * from "./Others/useContractStatesQuery.hook";
406
407
  export * from "./Others/useApplicationDataQuery.hook";
@@ -21,3 +21,9 @@ export interface NotificationContentsInterface {
21
21
  Description: string;
22
22
  LanguageISO2: string;
23
23
  }
24
+ export interface NotificationApplication {
25
+ Id: string;
26
+ Key: string;
27
+ Name: string;
28
+ Status: string;
29
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@omniumretail/shared-resources",
3
- "version": "0.3.72",
3
+ "version": "0.3.74",
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,11 @@
1
+ import { useQuery, UseQueryOptions } from "@tanstack/react-query";
2
+ import { getAuth0 } from "../../../services/ApiService";
3
+ import { NotificationApplication } from "../../../interfaces/Anot";
4
+
5
+ export const getNotificationApplications = ({...options} : UseQueryOptions<NotificationApplication>) => {
6
+ return useQuery(
7
+ ['NOTIFICATION_APPLICATIONS', options],
8
+ () => getAuth0<NotificationApplication>(`/AACP/Applications`),
9
+ options
10
+ );
11
+ }
@@ -0,0 +1,15 @@
1
+ import { useQuery, UseQueryOptions } from "@tanstack/react-query";
2
+ import { getAuth0 } from "../../../services/ApiService";
3
+
4
+ interface SupportedLanguagesResponse {
5
+ SupportedLanguages: string[];
6
+ }
7
+
8
+ export const getNotificationLanguages = ({...options} : UseQueryOptions<SupportedLanguagesResponse>) => {
9
+ return useQuery(
10
+ ['NOTIFICATION_LANGUAGES', options],
11
+ () => getAuth0<SupportedLanguagesResponse>(`/ANOT/Configurations/SupportedLanguages`),
12
+ options
13
+ );
14
+ }
15
+
@@ -1,15 +1,18 @@
1
1
  import { useMutation, useQueryClient } from '@tanstack/react-query';
2
- import { postAuth0 } from '../../../services/ApiService';
2
+ import { postAuth0, putAuth0 } from '../../../services/ApiService';
3
3
  import { AnotInterface } from '../../../interfaces/Anot';
4
4
 
5
5
  export const createNotificationTypeQuery = () => {
6
6
  const queryClient = useQueryClient();
7
7
  return useMutation<AnotInterface, unknown, AnotInterface>((data: AnotInterface) => {
8
- return postAuth0('/ANOT/NotificationTypes', undefined, data);
8
+ return data.Id ?
9
+ putAuth0(`/ANOT/NotificationTypes/${data.Id}`, undefined, data)
10
+ :
11
+ postAuth0('/ANOT/NotificationTypes', undefined, data);
9
12
  }, {
10
13
  onSuccess: (data: AnotInterface) => {
11
14
  queryClient.setQueryData(
12
- ['CREATE_NOTIFICATION_TYPE_QUERY'], data);
15
+ ['USE_NOTIFICATION_TYPE_QUERY'], data);
13
16
  },
14
17
  });
15
18
  }
@@ -467,9 +467,10 @@ export * from "./ASAEGNG/get/getCustomersQuery.hook";
467
467
 
468
468
  //ANOT
469
469
  export * from "./Anot/get/getNotificationsTypeQuery.hook";
470
- export * from "./Anot/mutate/createNotificationTypeQuery.hook";
471
- export * from "./Anot/mutate/editNotificationTypeQuery.hook";
470
+ export * from "./Anot/mutate/useNotificationTypeQuery.hook";
472
471
  export * from "./Anot/get/getNotificationTypeByIdQuery.hook";
472
+ export * from "./Anot/get/getNotificationApplicationsQuery.hook";
473
+ export * from "./Anot/get/getNotificationLanguagesQuery.hook";
473
474
 
474
475
  //Others
475
476
  export * from "./Others/useJobTitlesQuery.hook";
@@ -22,4 +22,11 @@ export interface NotificationContentsInterface {
22
22
  Title: string;
23
23
  Description: string;
24
24
  LanguageISO2: string;
25
- }
25
+ }
26
+
27
+ export interface NotificationApplication {
28
+ Id: string;
29
+ Key: string;
30
+ Name: string;
31
+ Status: string;
32
+ }
@@ -1,15 +0,0 @@
1
- import { useMutation, useQueryClient } from '@tanstack/react-query';
2
- import { putAuth0 } from '../../../services/ApiService';
3
- import { AnotInterface } from '../../../interfaces/Anot';
4
-
5
- export const editNotificationTypeQuery = () => {
6
- const queryClient = useQueryClient();
7
- return useMutation<AnotInterface, unknown, AnotInterface>((data: AnotInterface) => {
8
- return putAuth0(`/ANOT/NotificationTypes/${data.Id}`, undefined, data);
9
- }, {
10
- onSuccess: (data: AnotInterface) => {
11
- queryClient.setQueryData(
12
- ['EDIT_NOTIFICATION_TYPE_QUERY'], data);
13
- },
14
- });
15
- }