@omniumretail/shared-resources 0.3.14 → 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.
Files changed (28) hide show
  1. package/dist/bundle.js +1 -1
  2. package/dist/types/hooks/Aexp/get/getFlowExecutionByIdQuery.hook.d.ts +3 -0
  3. package/dist/types/hooks/Aexp/get/getFlowListByIdQuery.hook.d.ts +3 -0
  4. package/dist/types/hooks/Aexp/mutate/deleteFlowConfigurationQuery.hook.d.ts +2 -0
  5. package/dist/types/hooks/Aexp/mutate/runFlowExecutionQuery.hook.d.ts +2 -0
  6. package/dist/types/hooks/Aexp/mutate/useFlowConfigurationQuery.hook.d.ts +2 -0
  7. package/dist/types/hooks/Aexp/mutate/useFlowExecutionQuery.hook.d.ts +2 -0
  8. package/dist/types/hooks/Aexp/mutate/validateExecutionFileQuery.hook.d.ts +2 -0
  9. package/dist/types/hooks/Watson/get/getCloseSession.hook.d.ts +3 -0
  10. package/dist/types/hooks/Watson/mutate/mutateCloseSession.hook.d.ts +2 -0
  11. package/dist/types/hooks/index.d.ts +9 -0
  12. package/dist/types/interfaces/FlowList.d.ts +1 -0
  13. package/dist/types/interfaces/Watson.d.ts +49 -0
  14. package/dist/types/interfaces/index.d.ts +1 -0
  15. package/package.json +1 -1
  16. package/src/hooks/Aexp/get/getFlowExecutionByIdQuery.hook.ts +13 -0
  17. package/src/hooks/Aexp/get/getFlowListByIdQuery.hook.ts +13 -0
  18. package/src/hooks/Aexp/mutate/deleteFlowConfigurationQuery.hook.ts +18 -0
  19. package/src/hooks/Aexp/mutate/runFlowExecutionQuery.hook.ts +18 -0
  20. package/src/hooks/Aexp/mutate/useFlowConfigurationQuery.hook.ts +17 -0
  21. package/src/hooks/Aexp/mutate/useFlowExecutionQuery.hook.ts +21 -0
  22. package/src/hooks/Aexp/mutate/validateExecutionFileQuery.hook.ts +15 -0
  23. package/src/hooks/Watson/get/getCloseSession.hook.ts +15 -0
  24. package/src/hooks/Watson/mutate/mutateCloseSession.hook.ts +18 -0
  25. package/src/hooks/index.ts +11 -0
  26. package/src/interfaces/FlowList.ts +1 -0
  27. package/src/interfaces/Watson.ts +52 -0
  28. package/src/interfaces/index.ts +2 -1
@@ -0,0 +1,3 @@
1
+ import { UseQueryOptions } from "@tanstack/react-query";
2
+ import { FlowExecution } from "../../../interfaces";
3
+ export declare const getFlowExecutionById: (executionId: string, { ...options }: UseQueryOptions<FlowExecution>) => import("@tanstack/react-query").UseQueryResult<FlowExecution, unknown>;
@@ -0,0 +1,3 @@
1
+ import { UseQueryOptions } from "@tanstack/react-query";
2
+ import { FlowList } from "../../../interfaces";
3
+ export declare const getFlowListById: (flowId: string, { ...options }: UseQueryOptions<FlowList>) => import("@tanstack/react-query").UseQueryResult<FlowList, unknown>;
@@ -0,0 +1,2 @@
1
+ import { FlowList } from '../../../interfaces';
2
+ export declare const deleteFlowConfigurationQuery: () => import("@tanstack/react-query").UseMutationResult<FlowList, unknown, FlowList, unknown>;
@@ -0,0 +1,2 @@
1
+ import { FlowExecution } from '../../../interfaces';
2
+ export declare const runFlowExecutionQuery: () => import("@tanstack/react-query").UseMutationResult<FlowExecution, unknown, FlowExecution, unknown>;
@@ -0,0 +1,2 @@
1
+ import { FlowList } from '../../../interfaces';
2
+ export declare const useFlowConfigurationQuery: (bodyType?: string) => import("@tanstack/react-query").UseMutationResult<FlowList, unknown, FlowList, unknown>;
@@ -0,0 +1,2 @@
1
+ import { FlowExecution } from '../../../interfaces';
2
+ export declare const useFlowExecutionQuery: () => import("@tanstack/react-query").UseMutationResult<FlowExecution, unknown, FlowExecution, unknown>;
@@ -0,0 +1,2 @@
1
+ import { FlowExecution } from '../../../interfaces';
2
+ export declare const validateExecutionFileQuery: (bodyType?: string) => import("@tanstack/react-query").UseMutationResult<FlowExecution, unknown, FlowExecution, unknown>;
@@ -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";
@@ -356,6 +358,13 @@ export * from "./ATIM/BackOffice/mutate/useAttendancesById.hook";
356
358
  export * from "./ATIM/BackOffice/mutate/useScheduleMutateQuery.hook";
357
359
  export * from "./Aexp/get/getFlowExecutionQuery.hook";
358
360
  export * from "./Aexp/get/getFlowListQuery.hook";
361
+ export * from "./Aexp/get/getFlowListByIdQuery.hook";
362
+ export * from "./Aexp/get/getFlowExecutionByIdQuery.hook";
363
+ export * from "./Aexp/mutate/deleteFlowConfigurationQuery.hook";
364
+ export * from "./Aexp/mutate/runFlowExecutionQuery.hook";
365
+ export * from "./Aexp/mutate/useFlowConfigurationQuery.hook";
366
+ export * from "./Aexp/mutate/useFlowExecutionQuery.hook";
367
+ export * from "./Aexp/mutate/validateExecutionFileQuery.hook";
359
368
  export * from "./Others/useJobTitlesQuery.hook";
360
369
  export * from "./Others/useContractStatesQuery.hook";
361
370
  export * from "./Others/useApplicationDataQuery.hook";
@@ -12,6 +12,7 @@ export interface FlowList {
12
12
  TimeOutDuration: string;
13
13
  Parameters: Parameter[];
14
14
  State: string;
15
+ IsActive: any;
15
16
  }
16
17
  interface Parameter {
17
18
  Id: string;
@@ -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.14",
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,13 @@
1
+ import { useQuery, UseQueryOptions } from "@tanstack/react-query";
2
+ import { FlowExecution } from "../../../interfaces";
3
+ import { getAuth0 } from "../../../services/ApiService";
4
+
5
+ export const getFlowExecutionById = (executionId: string, {...options} : UseQueryOptions<FlowExecution>) => {
6
+ return useQuery(
7
+ ['FLOW_EXECUTION_QUERY', options],
8
+ () => getAuth0<FlowExecution>(`/AEXP/Execution/GetById`, {
9
+ pId: executionId,
10
+ }),
11
+ options
12
+ );
13
+ }
@@ -0,0 +1,13 @@
1
+ import { useQuery, UseQueryOptions } from "@tanstack/react-query";
2
+ import { FlowList } from "../../../interfaces";
3
+ import { getAuth0 } from "../../../services/ApiService";
4
+
5
+ export const getFlowListById = (flowId: string, {...options} : UseQueryOptions<FlowList>) => {
6
+ return useQuery(
7
+ ['FLOW_QUERY', options],
8
+ () => getAuth0<FlowList>(`/AEXP/FlowConfiguration/GetById`, {
9
+ pId: flowId,
10
+ }),
11
+ options
12
+ );
13
+ }
@@ -0,0 +1,18 @@
1
+ import { useMutation, useQueryClient } from '@tanstack/react-query';
2
+ import { FlowList } from '../../../interfaces';
3
+ import { putAuth0 } from '../../../services/ApiService';
4
+
5
+ export const deleteFlowConfigurationQuery = () => {
6
+ const queryClient = useQueryClient();
7
+ return useMutation<FlowList, unknown, FlowList>((data: FlowList) => {
8
+ return putAuth0(`/AEXP/FlowConfiguration/Deleted?`, {
9
+ pId: data.Id,
10
+ pIsActive: data.IsActive
11
+ }, data)
12
+ }, {
13
+ onSuccess: (data: FlowList) => {
14
+ queryClient.setQueryData(
15
+ ['FLOW_DELETE_QUERY'], data);
16
+ },
17
+ });
18
+ }
@@ -0,0 +1,18 @@
1
+ import { useMutation, useQueryClient } from '@tanstack/react-query';
2
+ import { FlowExecution } from '../../../interfaces';
3
+ import { postAuth0 } from '../../../services/ApiService';
4
+
5
+ export const runFlowExecutionQuery = () => {
6
+ const queryClient = useQueryClient();
7
+ return useMutation<FlowExecution, unknown, FlowExecution>((data: FlowExecution) => {
8
+ return postAuth0('/AEXP/Execution/RunExecution', {
9
+ pExecutionId: data.Id,
10
+ pUserId: data.UserId
11
+ }, data);
12
+ }, {
13
+ onSuccess: (data: FlowExecution) => {
14
+ queryClient.setQueryData(
15
+ ['RUN_FLOW_EXECUTION_QUERY'], data);
16
+ },
17
+ });
18
+ }
@@ -0,0 +1,17 @@
1
+ import { useMutation, useQueryClient } from '@tanstack/react-query';
2
+ import { FlowList } from '../../../interfaces';
3
+ import { putAuth0, postAuth0 } from '../../../services/ApiService';
4
+
5
+ export const useFlowConfigurationQuery = (bodyType?: string) => {
6
+ const queryClient = useQueryClient();
7
+ return useMutation<FlowList, unknown, FlowList>((data: FlowList | any) => {
8
+ return data.Id ?
9
+ putAuth0(`/AEXP/FlowConfiguration`, undefined, data, bodyType) :
10
+ postAuth0('/AEXP/FlowConfiguration', undefined, data, bodyType);
11
+ }, {
12
+ onSuccess: (data: FlowList) => {
13
+ queryClient.setQueryData(
14
+ ['FLOW_CONFIGURATION_QUERY'], data);
15
+ },
16
+ });
17
+ }
@@ -0,0 +1,21 @@
1
+ import { useMutation, useQueryClient } from '@tanstack/react-query';
2
+ import { FlowExecution } from '../../../interfaces';
3
+ import { putAuth0, postAuth0 } from '../../../services/ApiService';
4
+
5
+ export const useFlowExecutionQuery = () => {
6
+ const queryClient = useQueryClient();
7
+ return useMutation<FlowExecution, unknown, FlowExecution>((data: FlowExecution) => {
8
+ return data.Id ?
9
+ putAuth0(`/AEXP/Execution`, undefined, data)
10
+ :
11
+ postAuth0('/AEXP/Execution', {
12
+ pUserId: data.UserId,
13
+ pFlowId: data.FlowId
14
+ }, data);
15
+ }, {
16
+ onSuccess: (data: FlowExecution) => {
17
+ queryClient.setQueryData(
18
+ ['FLOW_EXECUTION_QUERY'], data);
19
+ },
20
+ });
21
+ }
@@ -0,0 +1,15 @@
1
+ import { useMutation, useQueryClient } from '@tanstack/react-query';
2
+ import { FlowExecution } from '../../../interfaces';
3
+ import { postAuth0 } from '../../../services/ApiService';
4
+
5
+ export const validateExecutionFileQuery = (bodyType?: string) => {
6
+ const queryClient = useQueryClient();
7
+ return useMutation<FlowExecution, unknown, FlowExecution>((data: FlowExecution | any) => {
8
+ return postAuth0('/AEXP/Execution/FileValidation', undefined, data, bodyType);
9
+ }, {
10
+ onSuccess: (data: FlowExecution) => {
11
+ queryClient.setQueryData(
12
+ ['VALIDATE_EXECUTION_FILE_QUERY'], data);
13
+ },
14
+ });
15
+ }
@@ -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";
@@ -419,6 +423,13 @@ export * from "./ATIM/BackOffice/mutate/useScheduleMutateQuery.hook";
419
423
  //Aexp
420
424
  export * from "./Aexp/get/getFlowExecutionQuery.hook";
421
425
  export * from "./Aexp/get/getFlowListQuery.hook";
426
+ export * from "./Aexp/get/getFlowListByIdQuery.hook";
427
+ export * from "./Aexp/get/getFlowExecutionByIdQuery.hook";
428
+ export * from "./Aexp/mutate/deleteFlowConfigurationQuery.hook";
429
+ export * from "./Aexp/mutate/runFlowExecutionQuery.hook";
430
+ export * from "./Aexp/mutate/useFlowConfigurationQuery.hook";
431
+ export * from "./Aexp/mutate/useFlowExecutionQuery.hook";
432
+ export * from "./Aexp/mutate/validateExecutionFileQuery.hook";
422
433
 
423
434
  //Others
424
435
  export * from "./Others/useJobTitlesQuery.hook";
@@ -12,6 +12,7 @@ export interface FlowList {
12
12
  TimeOutDuration: string;
13
13
  Parameters: Parameter[];
14
14
  State: string;
15
+ IsActive;
15
16
  }
16
17
 
17
18
  interface Parameter {
@@ -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';