@omniumretail/shared-resources 0.3.75 → 0.3.78

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.
@@ -1,3 +1,4 @@
1
1
  import { UseQueryOptions } from "@tanstack/react-query";
2
2
  import { NotificationApplication } from "../../../interfaces/Anot";
3
- export declare const getNotificationApplications: ({ ...options }: UseQueryOptions<NotificationApplication>) => import("@tanstack/react-query").UseQueryResult<NotificationApplication, unknown>;
3
+ import { ResponseList } from "../../../interfaces/ResponseList";
4
+ export declare const getNotificationApplications: ({ ...options }: Omit<UseQueryOptions<ResponseList<"Applications", NotificationApplication>>, "queryKey">) => import("@tanstack/react-query").UseQueryResult<ResponseList<"Applications", NotificationApplication>, unknown>;
@@ -0,0 +1,4 @@
1
+ import { UseQueryOptions } from "@tanstack/react-query";
2
+ import { ResponseList } from "../../../interfaces/ResponseList";
3
+ import { CriticalityInterface } from "../../../interfaces/Anot";
4
+ export declare const getNotificationCriticalities: ({ ...options }: Omit<UseQueryOptions<ResponseList<"Criticalities", CriticalityInterface>>, "queryKey">) => import("@tanstack/react-query").UseQueryResult<ResponseList<"Criticalities", CriticalityInterface>, unknown>;
@@ -0,0 +1,17 @@
1
+ import { UseQueryOptions } from "@tanstack/react-query";
2
+ import { AnotInterface, NotificationMetrics } from "../../../interfaces";
3
+ type NotificationHeadersResponse = {
4
+ Metrics: NotificationMetrics;
5
+ Notifications: AnotInterface[];
6
+ TotalCount: number;
7
+ };
8
+ export interface NotificationHeaderProps extends Omit<UseQueryOptions<NotificationHeadersResponse>, "queryKey" | "queryFn"> {
9
+ page: number;
10
+ records: number;
11
+ sortBy: string;
12
+ sortDirection: string;
13
+ terms?: string;
14
+ query?: string;
15
+ }
16
+ export declare const getNotificationHeadersQuery: ({ page, records, sortBy, sortDirection, terms, query, ...options }: NotificationHeaderProps) => import("@tanstack/react-query").UseQueryResult<NotificationHeadersResponse, unknown>;
17
+ export {};
@@ -0,0 +1,13 @@
1
+ import { UseQueryOptions } from "@tanstack/react-query";
2
+ import { AnotNotificationsInterface, ResponseList } from "../../../interfaces";
3
+ interface NotificationsProps extends Omit<UseQueryOptions<ResponseList<"Notifications", AnotNotificationsInterface>>, "queryKey"> {
4
+ page: number;
5
+ records: number;
6
+ sortBy: string;
7
+ sortDirection: string;
8
+ terms?: string;
9
+ query?: string;
10
+ language?: string;
11
+ }
12
+ export declare const getNotificationsQuery: ({ page, records, sortBy, sortDirection, terms, query, language, ...options }: NotificationsProps) => import("@tanstack/react-query").UseQueryResult<ResponseList<"Notifications", AnotNotificationsInterface>, unknown>;
13
+ export {};
@@ -402,6 +402,9 @@ export * from "./Anot/mutate/useNotificationTypeQuery.hook";
402
402
  export * from "./Anot/get/getNotificationTypeByIdQuery.hook";
403
403
  export * from "./Anot/get/getNotificationApplicationsQuery.hook";
404
404
  export * from "./Anot/get/getNotificationLanguagesQuery.hook";
405
+ export * from "./Anot/get/getNotificationCriticalitiesQuery.hook";
406
+ export * from "./Anot/get/getNotificationHeadersQuery.hook";
407
+ export * from "./Anot/get/getNotificationsQuery.hook";
405
408
  export * from "./Others/useJobTitlesQuery.hook";
406
409
  export * from "./Others/useContractStatesQuery.hook";
407
410
  export * from "./Others/useApplicationDataQuery.hook";
@@ -9,12 +9,20 @@ export interface AnotInterface {
9
9
  CreateDate: number;
10
10
  UpdateDate: number;
11
11
  Criticality: CriticalityInterface;
12
+ NotificationType: string;
13
+ Type: string;
14
+ SendingType: string;
15
+ State: string;
16
+ TotalUsers: number;
12
17
  NotificationContents: NotificationContentsInterface[];
13
18
  }
14
19
  export interface CriticalityInterface {
15
20
  Id: string;
16
21
  Name: string;
17
22
  ColorHex: string;
23
+ Status: string;
24
+ CreateDate: number;
25
+ UpdateDate: number;
18
26
  }
19
27
  export interface NotificationContentsInterface {
20
28
  Title: string;
@@ -27,3 +35,38 @@ export interface NotificationApplication {
27
35
  Name: string;
28
36
  Status: string;
29
37
  }
38
+ export interface NotificationMetrics {
39
+ TotalUsers: number;
40
+ ReadPercentage: string;
41
+ TotalNotifications: number;
42
+ NotificationsToBeSent: number;
43
+ }
44
+ export interface AnotNotificationsInterface {
45
+ Id: string;
46
+ NotificationsTypeInterface: NotificationsTypeInterface;
47
+ Title: string;
48
+ Description: string;
49
+ RedirectURL: string;
50
+ Icon: string;
51
+ ExpirationDate: number;
52
+ ScheduleDate: number;
53
+ State: string;
54
+ Criticality: CriticalityInterface;
55
+ UpdateDate: number;
56
+ CreateDate: number;
57
+ NotifiedUsers: NotifiedUsersInterface[];
58
+ }
59
+ export interface NotificationsTypeInterface {
60
+ Application: string;
61
+ TotalUsers: number;
62
+ SendingType: string;
63
+ OperationName: string;
64
+ NotificationType: string;
65
+ }
66
+ export interface NotifiedUsersInterface {
67
+ Id: string;
68
+ DisplayName: string;
69
+ Code: string;
70
+ IsRead: boolean;
71
+ ReadDate: number;
72
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@omniumretail/shared-resources",
3
- "version": "0.3.75",
3
+ "version": "0.3.78",
4
4
  "private": false,
5
5
  "description": "Shared Components and services or utils to the frontend versions",
6
6
  "main": "dist/bundle.js",
@@ -1,11 +1,13 @@
1
1
  import { useQuery, UseQueryOptions } from "@tanstack/react-query";
2
2
  import { getAuth0 } from "../../../services/ApiService";
3
3
  import { NotificationApplication } from "../../../interfaces/Anot";
4
+ import { ResponseList } from "../../../interfaces/ResponseList";
4
5
 
5
- export const getNotificationApplications = ({...options} : UseQueryOptions<NotificationApplication>) => {
6
+ export const getNotificationApplications = ({...options} : Omit<UseQueryOptions<ResponseList<"Applications", NotificationApplication>>, "queryKey">) => {
6
7
  return useQuery(
7
8
  ['NOTIFICATION_APPLICATIONS', options],
8
- () => getAuth0<NotificationApplication>(`/AACP/Applications`),
9
+ () => getAuth0<ResponseList<"Applications", NotificationApplication>>(`/AACP/Applications`),
9
10
  options
10
11
  );
11
12
  }
13
+
@@ -0,0 +1,13 @@
1
+ import { useQuery, UseQueryOptions } from "@tanstack/react-query";
2
+ import { getAuth0 } from "../../../services/ApiService";
3
+ import { ResponseList } from "../../../interfaces/ResponseList";
4
+ import { CriticalityInterface } from "../../../interfaces/Anot";
5
+
6
+ export const getNotificationCriticalities = ({...options} : Omit<UseQueryOptions<ResponseList<"Criticalities", CriticalityInterface>>, "queryKey">) => {
7
+ return useQuery(
8
+ ['NOTIFICATION_CRITICALITIES', options],
9
+ () => getAuth0<ResponseList<"Criticalities", CriticalityInterface>>(`/ANOT/Criticalities`),
10
+ options
11
+ );
12
+ }
13
+
@@ -0,0 +1,33 @@
1
+ import { useQuery, UseQueryOptions } from "@tanstack/react-query";
2
+ import { AnotInterface, NotificationMetrics } from "../../../interfaces";
3
+ import { getAuth0 } from "../../../services/ApiService";
4
+
5
+ type NotificationHeadersResponse = {
6
+ Metrics: NotificationMetrics;
7
+ Notifications: AnotInterface[];
8
+ TotalCount: number;
9
+ };
10
+
11
+ export interface NotificationHeaderProps extends Omit<UseQueryOptions<NotificationHeadersResponse>, "queryKey" | "queryFn"> {
12
+ page: number;
13
+ records: number;
14
+ sortBy: string;
15
+ sortDirection: string;
16
+ terms?: string;
17
+ query?: string;
18
+ }
19
+
20
+ export const getNotificationHeadersQuery = ({ page, records, sortBy, sortDirection, terms, query, ...options }: NotificationHeaderProps) => {
21
+ return useQuery(
22
+ ['NOTIFICATION_HEADERS', page, records, sortBy, sortDirection, terms, query, options],
23
+ () => getAuth0<NotificationHeadersResponse>(`/ANOT/Notifications/Headers`, {
24
+ pPage: page || 1,
25
+ pRecords: records || 50,
26
+ pSortBy: sortBy || "Application",
27
+ pSortDirection: sortDirection || "asc",
28
+ pTerms: terms || "",
29
+ pQuery: query || ""
30
+ }),
31
+ options
32
+ );
33
+ }
@@ -0,0 +1,29 @@
1
+ import { useQuery, UseQueryOptions } from "@tanstack/react-query";
2
+ import { AnotNotificationsInterface, ResponseList } from "../../../interfaces";
3
+ import { getAuth0 } from "../../../services/ApiService";
4
+
5
+ interface NotificationsProps extends Omit<UseQueryOptions<ResponseList<"Notifications", AnotNotificationsInterface>>, "queryKey"> {
6
+ page: number;
7
+ records: number;
8
+ sortBy: string;
9
+ sortDirection: string;
10
+ terms?: string;
11
+ query?: string;
12
+ language?: string;
13
+ }
14
+
15
+ export const getNotificationsQuery = ({ page, records, sortBy, sortDirection, terms, query, language, ...options }: NotificationsProps) => {
16
+ return useQuery(
17
+ ['NOTIFICATIONS_QUERY', page, records, sortBy, sortDirection, terms, query, language, options],
18
+ () => getAuth0<ResponseList<"Notifications", AnotNotificationsInterface>>(`/ANOT/Notifications`, {
19
+ pPage: page || 1,
20
+ pRecords: records || 50,
21
+ pSortBy: sortBy || "Name",
22
+ pSortDirection: sortDirection || "asc",
23
+ pTerms: terms || "",
24
+ pQuery: query || "",
25
+ pLanguage: language || "PT"
26
+ }),
27
+ options
28
+ );
29
+ }
@@ -471,6 +471,9 @@ export * from "./Anot/mutate/useNotificationTypeQuery.hook";
471
471
  export * from "./Anot/get/getNotificationTypeByIdQuery.hook";
472
472
  export * from "./Anot/get/getNotificationApplicationsQuery.hook";
473
473
  export * from "./Anot/get/getNotificationLanguagesQuery.hook";
474
+ export * from "./Anot/get/getNotificationCriticalitiesQuery.hook";
475
+ export * from "./Anot/get/getNotificationHeadersQuery.hook";
476
+ export * from "./Anot/get/getNotificationsQuery.hook";
474
477
 
475
478
  //Others
476
479
  export * from "./Others/useJobTitlesQuery.hook";
@@ -9,6 +9,11 @@ export interface AnotInterface {
9
9
  CreateDate: number;
10
10
  UpdateDate: number;
11
11
  Criticality: CriticalityInterface;
12
+ NotificationType: string;
13
+ Type: string;
14
+ SendingType: string;
15
+ State: string;
16
+ TotalUsers: number;
12
17
  NotificationContents: NotificationContentsInterface[];
13
18
  }
14
19
 
@@ -16,6 +21,9 @@ export interface CriticalityInterface {
16
21
  Id: string;
17
22
  Name: string;
18
23
  ColorHex: string;
24
+ Status: string;
25
+ CreateDate: number;
26
+ UpdateDate: number;
19
27
  }
20
28
 
21
29
  export interface NotificationContentsInterface {
@@ -30,3 +38,42 @@ export interface NotificationApplication {
30
38
  Name: string;
31
39
  Status: string;
32
40
  }
41
+
42
+ export interface NotificationMetrics {
43
+ TotalUsers: number;
44
+ ReadPercentage: string;
45
+ TotalNotifications: number;
46
+ NotificationsToBeSent: number;
47
+ }
48
+
49
+ export interface AnotNotificationsInterface {
50
+ Id: string;
51
+ NotificationsTypeInterface: NotificationsTypeInterface;
52
+ Title: string;
53
+ Description: string;
54
+ RedirectURL: string;
55
+ Icon: string;
56
+ ExpirationDate: number;
57
+ ScheduleDate: number;
58
+ State: string;
59
+ Criticality: CriticalityInterface;
60
+ UpdateDate: number;
61
+ CreateDate: number;
62
+ NotifiedUsers: NotifiedUsersInterface[];
63
+ }
64
+
65
+ export interface NotificationsTypeInterface {
66
+ Application: string;
67
+ TotalUsers: number;
68
+ SendingType: string;
69
+ OperationName: string;
70
+ NotificationType: string;
71
+ }
72
+
73
+ export interface NotifiedUsersInterface {
74
+ Id: string;
75
+ DisplayName: string;
76
+ Code: string;
77
+ IsRead: boolean;
78
+ ReadDate: number;
79
+ }