@omniumretail/shared-resources 0.3.15 → 0.3.16

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 { Session } from "../../../interfaces";
3
+ export declare const getCloseSession: (SessionId: string, options?: UseQueryOptions<Session, Error>) => import("@tanstack/react-query").UseQueryResult<Session, Error>;
@@ -0,0 +1,2 @@
1
+ import { Session } from '../../../interfaces';
2
+ export declare const mutateCloseSession: (id: string) => import("@tanstack/react-query").UseMutationResult<Session, unknown, Session, unknown>;
@@ -331,6 +331,8 @@ export * from './Orch/others/runMacrosQuery.hook';
331
331
  export * from './Orch/others/reprocessingInstanceQuery.hook';
332
332
  export * from './Orch/get/getMacrosUserQuery.hook';
333
333
  export * from './Orch/get/getMonitoringComponents.hook';
334
+ export * from "./Watson/get/getCloseSession.hook";
335
+ export * from "./Watson/mutate/mutateCloseSession.hook";
334
336
  export * from "./ATIM/BackOffice/get/useEmployeeWorklogDetails.hook";
335
337
  export * from "./ATIM/BackOffice/get/useEmployeeQueryHook.hook";
336
338
  export * from "./ATIM/BackOffice/get/useStoresQueryHook.hook";
@@ -0,0 +1,49 @@
1
+ export interface Session {
2
+ id: string;
3
+ store_id: string;
4
+ store_staff_id: string;
5
+ client_email: string | null;
6
+ client_satisfied: boolean;
7
+ create_date: string;
8
+ update_date: string;
9
+ exchanged_messages: number;
10
+ is_alive: boolean;
11
+ language: string;
12
+ message_history: Message[];
13
+ notifications: Notification[];
14
+ recommendations: Recommendation[];
15
+ }
16
+ export interface Message {
17
+ message_author: 'WATSON' | 'USER';
18
+ message_body: string;
19
+ message_timestamp: string;
20
+ }
21
+ export interface Notification {
22
+ session_id: string;
23
+ origin_store: string;
24
+ employee_code: string;
25
+ client_email: string | null;
26
+ date_limit: string | null;
27
+ reception_store: string | null;
28
+ register_date: string | null;
29
+ notification_id: string;
30
+ message_format: string;
31
+ features: {
32
+ include: {
33
+ color_group?: string;
34
+ neckline?: string;
35
+ fit?: string;
36
+ gender?: string;
37
+ };
38
+ exclude?: Record<string, any>;
39
+ };
40
+ sku: string | null;
41
+ images_url: string[];
42
+ }
43
+ export interface Recommendation {
44
+ occurrence: number;
45
+ recommended_reference: string;
46
+ liked_recommendation: boolean;
47
+ images_url: string[];
48
+ product_name: string;
49
+ }
@@ -72,3 +72,4 @@ export * from './Instances';
72
72
  export * from './MonitoringComponent';
73
73
  export * from './FlowList';
74
74
  export * from './FlowExecution';
75
+ export * from './Watson';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@omniumretail/shared-resources",
3
- "version": "0.3.15",
3
+ "version": "0.3.16",
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,15 @@
1
+ import { useQuery, UseQueryOptions } from "@tanstack/react-query";
2
+ import { Session } from "../../../interfaces";
3
+ import { get } from "../../../services/ApiService";
4
+
5
+ export const getCloseSession = (SessionId: string, options?: UseQueryOptions<Session, Error>) => {
6
+ return useQuery(
7
+ ['SESSION_ID', SessionId],
8
+ () => get<Session>(`/sessions/${SessionId}`),
9
+ {
10
+ enabled: !!(SessionId),
11
+ suspense:false,
12
+ ...options,
13
+ },
14
+ );
15
+ }
@@ -0,0 +1,18 @@
1
+ import { useMutation, useQueryClient } from '@tanstack/react-query';
2
+ import { patch } from '../../../services/ApiService';
3
+ import { Session } from '../../../interfaces';
4
+
5
+
6
+ export const mutateCloseSession = (id: string) => {
7
+ const queryClient = useQueryClient();
8
+
9
+ return useMutation<Session, unknown, Session>((data: Session) => {
10
+
11
+ return patch(`/sessions/${id}`, data);
12
+ }, {
13
+ onSuccess: (data: Session) => {
14
+ queryClient.setQueryData(['SESSIONS'], data);
15
+ },
16
+ });
17
+ };
18
+
@@ -389,6 +389,10 @@ export * from './Orch/others/reprocessingInstanceQuery.hook';
389
389
  export * from './Orch/get/getMacrosUserQuery.hook';
390
390
  export * from './Orch/get/getMonitoringComponents.hook';
391
391
 
392
+ //Watson
393
+ export * from "./Watson/get/getCloseSession.hook";
394
+ export * from "./Watson/mutate/mutateCloseSession.hook";
395
+
392
396
  //BackofficeAtim
393
397
  export * from "./ATIM/BackOffice/get/useEmployeeWorklogDetails.hook";
394
398
  export * from "./ATIM/BackOffice/get/useEmployeeQueryHook.hook";
@@ -0,0 +1,52 @@
1
+ export interface Session {
2
+ id: string;
3
+ store_id: string;
4
+ store_staff_id: string;
5
+ client_email: string | null;
6
+ client_satisfied: boolean;
7
+ create_date: string;
8
+ update_date: string;
9
+ exchanged_messages: number;
10
+ is_alive: boolean;
11
+ language: string;
12
+ message_history: Message[];
13
+ notifications: Notification[];
14
+ recommendations: Recommendation[];
15
+ }
16
+
17
+ export interface Message {
18
+ message_author: 'WATSON' | 'USER';
19
+ message_body: string;
20
+ message_timestamp: string;
21
+ }
22
+
23
+ export interface Notification {
24
+ session_id: string;
25
+ origin_store: string;
26
+ employee_code: string;
27
+ client_email: string | null;
28
+ date_limit: string | null;
29
+ reception_store: string | null;
30
+ register_date: string | null;
31
+ notification_id: string;
32
+ message_format: string;
33
+ features: {
34
+ include: {
35
+ color_group?: string;
36
+ neckline?: string;
37
+ fit?: string;
38
+ gender?: string;
39
+ };
40
+ exclude?: Record<string, any>;
41
+ };
42
+ sku: string | null;
43
+ images_url: string[];
44
+ }
45
+
46
+ export interface Recommendation {
47
+ occurrence: number;
48
+ recommended_reference: string;
49
+ liked_recommendation: boolean;
50
+ images_url: string[];
51
+ product_name: string;
52
+ }
@@ -71,4 +71,5 @@ export * from './Macros';
71
71
  export * from './Instances';
72
72
  export * from './MonitoringComponent';
73
73
  export * from './FlowList';
74
- export * from './FlowExecution';
74
+ export * from './FlowExecution';
75
+ export * from './Watson';