@trii/components 2.0.84 → 2.0.86
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.
- package/dist/cjs/index.js +9 -9
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/index.js +10 -10
- package/dist/esm/index.js.map +1 -1
- package/dist/index.d.ts +3 -0
- package/dist/types/components/EventsDialog/EventsDialog.d.ts +64 -3
- package/dist/types/components/EventsDialog/context/CalendarContext.d.ts +0 -2
- package/dist/types/components/EventsDialog/hooks/useEvent.d.ts +2 -16
- package/dist/types/components/EventsDialog/hooks/useTask.d.ts +1 -4
- package/dist/types/components/EventsDialog/services/calendarApi.d.ts +67 -0
- package/dist/types/components/EventsDialog/types.d.ts +2 -10
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
2
|
import { IContact, IBusiness } from '@trii/types/dist/Contacts';
|
|
3
|
+
import { Spaces } from '@trii/types';
|
|
3
4
|
import { SxProps, Theme } from '@mui/material';
|
|
4
5
|
import { IContact as IContact$1, IBusiness as IBusiness$1 } from '@trii/types/dist/Contacts/contacts';
|
|
5
6
|
import React from 'react';
|
|
@@ -17,6 +18,7 @@ interface ContactInfoPopupProps {
|
|
|
17
18
|
avatarImgUrl?: string;
|
|
18
19
|
sx?: SxProps<Theme>;
|
|
19
20
|
navigate: (path: string) => void;
|
|
21
|
+
contactNameFormat?: Spaces.nameFormat;
|
|
20
22
|
}
|
|
21
23
|
declare const ContactInfoPopup: (props: ContactInfoPopupProps) => react_jsx_runtime.JSX.Element;
|
|
22
24
|
|
|
@@ -31,6 +33,7 @@ interface Props {
|
|
|
31
33
|
navigate: (path: string) => void;
|
|
32
34
|
googleMapsApiKey?: string;
|
|
33
35
|
onEntityUpdated?: (entity: IContact$1 | IBusiness$1) => void;
|
|
36
|
+
contactNameFormat?: Spaces.nameFormat;
|
|
34
37
|
}
|
|
35
38
|
declare const EditContactModal: (props: Props) => react_jsx_runtime.JSX.Element;
|
|
36
39
|
|
|
@@ -19,7 +19,11 @@ export interface EventsDialogProps {
|
|
|
19
19
|
language?: 'en' | 'es';
|
|
20
20
|
/** Modo del diálogo: 'create' | 'edit' | 'view' */
|
|
21
21
|
mode?: Mode;
|
|
22
|
-
/**
|
|
22
|
+
/**
|
|
23
|
+
* Tipo de diálogo: 'event' | 'task'
|
|
24
|
+
* Define si el modal trabaja con eventos o tareas.
|
|
25
|
+
* Cuando se combina con hiddenTabs=true, permite contextos específicos (solo eventos o solo tareas).
|
|
26
|
+
*/
|
|
23
27
|
type?: DialogType;
|
|
24
28
|
/** ID del calendario seleccionado para eventos (usado en modo view/edit) */
|
|
25
29
|
eventCalendarId?: string;
|
|
@@ -33,7 +37,12 @@ export interface EventsDialogProps {
|
|
|
33
37
|
sx?: SxProps<Theme>;
|
|
34
38
|
/** ID del contacto a vincular automáticamente al crear un evento o tarea */
|
|
35
39
|
contactId?: string;
|
|
36
|
-
/**
|
|
40
|
+
/**
|
|
41
|
+
* Oculta las tabs de cambio entre evento/tarea.
|
|
42
|
+
* Útil cuando la aplicación consumidora separa eventos y tareas en diferentes áreas.
|
|
43
|
+
* Ejemplo: Una vista de "Mis Eventos" solo debería mostrar eventos (type='event', hiddenTabs=true)
|
|
44
|
+
* Una vista de "Mis Tareas" solo debería mostrar tareas (type='task', hiddenTabs=true)
|
|
45
|
+
*/
|
|
37
46
|
hiddenTabs?: boolean;
|
|
38
47
|
/** Callback invocado tras cada operación CRUD exitosa (crear, editar, eliminar) */
|
|
39
48
|
onActionComplete?: (action: 'created' | 'updated' | 'deleted', type: 'event' | 'task', data: any) => void;
|
|
@@ -49,7 +58,11 @@ export interface EventsDialogProps {
|
|
|
49
58
|
* mediante las APIs. Solo requiere las props esenciales: baseUrl, spaceId, open, onClose.
|
|
50
59
|
* Los calendarios, eventos y tareas se cargan automáticamente desde las APIs.
|
|
51
60
|
*
|
|
52
|
-
*
|
|
61
|
+
* ═══════════════════════════════════════════════════════════════════════════════
|
|
62
|
+
* MODOS DE USO
|
|
63
|
+
* ═══════════════════════════════════════════════════════════════════════════════
|
|
64
|
+
*
|
|
65
|
+
* 1. MODO UNIFICADO (eventos y tareas juntos):
|
|
53
66
|
* ```tsx
|
|
54
67
|
* <EventsDialog
|
|
55
68
|
* open={isOpen}
|
|
@@ -61,6 +74,54 @@ export interface EventsDialogProps {
|
|
|
61
74
|
* type="event"
|
|
62
75
|
* />
|
|
63
76
|
* ```
|
|
77
|
+
* En este modo, el usuario puede alternar entre crear eventos o tareas usando las tabs.
|
|
78
|
+
*
|
|
79
|
+
* 2. MODO SEPARADO (solo eventos O solo tareas):
|
|
80
|
+
* ```tsx
|
|
81
|
+
* // Vista de "Mis Eventos" - solo muestra eventos
|
|
82
|
+
* <EventsDialog
|
|
83
|
+
* open={isEventDialogOpen}
|
|
84
|
+
* onClose={handleClose}
|
|
85
|
+
* baseUrl="https://api.trii.app/api/v1"
|
|
86
|
+
* spaceId={spaceId}
|
|
87
|
+
* type="event"
|
|
88
|
+
* hiddenTabs={true} // Oculta las tabs de cambio
|
|
89
|
+
* mode="create"
|
|
90
|
+
* />
|
|
91
|
+
*
|
|
92
|
+
* // Vista de "Mis Tareas" - solo muestra tareas
|
|
93
|
+
* <EventsDialog
|
|
94
|
+
* open={isTaskDialogOpen}
|
|
95
|
+
* onClose={handleClose}
|
|
96
|
+
* baseUrl="https://api.trii.app/api/v1"
|
|
97
|
+
* spaceId={spaceId}
|
|
98
|
+
* type="task"
|
|
99
|
+
* hiddenTabs={true} // Oculta las tabs de cambio
|
|
100
|
+
* mode="create"
|
|
101
|
+
* />
|
|
102
|
+
* ```
|
|
103
|
+
* Este modo es útil cuando la aplicación consumidora separa eventos y tareas
|
|
104
|
+
* en diferentes secciones de la interfaz.
|
|
105
|
+
*
|
|
106
|
+
* ═══════════════════════════════════════════════════════════════════════════════
|
|
107
|
+
* ENDPOINTS UTILIZADOS
|
|
108
|
+
* ═══════════════════════════════════════════════════════════════════════════════
|
|
109
|
+
* Ver documentación completa en: src/components/EventsDialog/services/calendarApi.ts
|
|
110
|
+
*
|
|
111
|
+
* Eventos:
|
|
112
|
+
* - POST /api/v1/calendar/{spaceId}/events
|
|
113
|
+
* - GET /api/v1/calendar/{spaceId}/Events?start={start}&end={end}
|
|
114
|
+
* - GET /api/v1/calendar/{spaceId}/events/{eventId}
|
|
115
|
+
* - PUT /api/v1/calendar/{spaceId}/events/{eventId}
|
|
116
|
+
* - PUT /api/v1/calendar/{spaceId}/events/occurrence/{eventId}
|
|
117
|
+
* - DELETE /api/v1/calendar/{spaceId}/events/{eventId}
|
|
118
|
+
*
|
|
119
|
+
* Tareas:
|
|
120
|
+
* - POST /api/v1/calendar/{spaceId}/Task
|
|
121
|
+
* - GET /api/v1/calendar/{spaceId}/Task/{calendarId}
|
|
122
|
+
* - GET /api/v1/calendar/{spaceId}/Task/detail/{taskId}
|
|
123
|
+
* - PUT /api/v1/calendar/{spaceId}/Task/{taskId}
|
|
124
|
+
* - DELETE /api/v1/calendar/{spaceId}/Task/{taskId}
|
|
64
125
|
*/
|
|
65
126
|
declare const EventsDialog: React.FC<EventsDialogProps>;
|
|
66
127
|
export default EventsDialog;
|
|
@@ -59,10 +59,8 @@ export type CalendarContextType = {
|
|
|
59
59
|
isLoadingCalendars: boolean;
|
|
60
60
|
isCreatingEvent: boolean;
|
|
61
61
|
isUpdatingEvent: boolean;
|
|
62
|
-
isDeletingEvent: boolean;
|
|
63
62
|
isCreatingTask: boolean;
|
|
64
63
|
isUpdatingTask: boolean;
|
|
65
|
-
isDeletingTask: boolean;
|
|
66
64
|
handleSaveUpdatedTask: () => void;
|
|
67
65
|
handleDeleteTask: () => void;
|
|
68
66
|
handleToggleTaskCompleted: () => void;
|
|
@@ -22,7 +22,7 @@ export interface SelectedContact {
|
|
|
22
22
|
export interface UseLinkContact {
|
|
23
23
|
state: {
|
|
24
24
|
search: string;
|
|
25
|
-
|
|
25
|
+
selectedContact: SelectedContact | null;
|
|
26
26
|
};
|
|
27
27
|
action: {
|
|
28
28
|
handleSelectContact: (contact: IContact) => void;
|
|
@@ -31,15 +31,6 @@ export interface UseLinkContact {
|
|
|
31
31
|
resetField: () => void;
|
|
32
32
|
};
|
|
33
33
|
}
|
|
34
|
-
export interface UseShareWithUsers {
|
|
35
|
-
field: {
|
|
36
|
-
userIds: string[];
|
|
37
|
-
};
|
|
38
|
-
action: {
|
|
39
|
-
setUserIds: (ids: string[]) => void;
|
|
40
|
-
resetField: () => void;
|
|
41
|
-
};
|
|
42
|
-
}
|
|
43
34
|
export interface UseEvent {
|
|
44
35
|
titleField: UseFieldType;
|
|
45
36
|
descriptionField: UseFieldType;
|
|
@@ -53,7 +44,6 @@ export interface UseEvent {
|
|
|
53
44
|
recurrenceRule: string;
|
|
54
45
|
setRecurrenceRule: (rule: string) => void;
|
|
55
46
|
notifications: UseNotificationsType;
|
|
56
|
-
shareWithUsers: UseShareWithUsers;
|
|
57
47
|
linkContact: UseLinkContact;
|
|
58
48
|
create: () => {
|
|
59
49
|
title: string;
|
|
@@ -65,12 +55,8 @@ export interface UseEvent {
|
|
|
65
55
|
startAt: string;
|
|
66
56
|
endAt: string;
|
|
67
57
|
notifications: any[];
|
|
68
|
-
sharedWith: string[];
|
|
69
58
|
rule: string;
|
|
70
|
-
|
|
71
|
-
id: string;
|
|
72
|
-
name: string;
|
|
73
|
-
};
|
|
59
|
+
contactId: string | null;
|
|
74
60
|
};
|
|
75
61
|
resetFields: () => void;
|
|
76
62
|
}
|
|
@@ -3,17 +3,84 @@ import { ICalendar } from '@trii/types/dist/Calendar/Calendar';
|
|
|
3
3
|
import { ITask } from '@trii/types/dist/Calendar';
|
|
4
4
|
import { UserTrii } from '@trii/types/dist/Users';
|
|
5
5
|
import type { AddActivityRequestData, UpdatedActivityRequestData, AddTaskRequestData, AddCalendarRequestData } from '../types';
|
|
6
|
+
/**
|
|
7
|
+
* API Service para operaciones de Calendar, Events y Tasks
|
|
8
|
+
*
|
|
9
|
+
* ENDPOINTS UTILIZADOS:
|
|
10
|
+
*
|
|
11
|
+
* ═══════════════════════════════════════════════════════════
|
|
12
|
+
* EVENTOS (Events)
|
|
13
|
+
* ═══════════════════════════════════════════════════════════
|
|
14
|
+
* GET /api/v1/calendar/{spaceId}/Events?start={start}&end={end}
|
|
15
|
+
* - Lista eventos en un rango de fechas
|
|
16
|
+
*
|
|
17
|
+
* GET /api/v1/calendar/{spaceId}/events/{eventId}
|
|
18
|
+
* - Obtiene un evento específico por ID
|
|
19
|
+
*
|
|
20
|
+
* POST /api/v1/calendar/{spaceId}/events
|
|
21
|
+
* - Crea un nuevo evento
|
|
22
|
+
*
|
|
23
|
+
* PUT /api/v1/calendar/{spaceId}/events/{eventId}
|
|
24
|
+
* - Actualiza un evento existente
|
|
25
|
+
*
|
|
26
|
+
* PUT /api/v1/calendar/{spaceId}/events/occurrence/{eventId}?occurrence={date}
|
|
27
|
+
* - Actualiza una ocurrencia específica de un evento recurrente
|
|
28
|
+
*
|
|
29
|
+
* DELETE /api/v1/calendar/{spaceId}/events/{eventId}
|
|
30
|
+
* - Elimina un evento
|
|
31
|
+
*
|
|
32
|
+
* DELETE /api/v1/calendar/{spaceId}/events/{eventId}?occurrence={date}
|
|
33
|
+
* - Elimina una ocurrencia específica de un evento recurrente
|
|
34
|
+
*
|
|
35
|
+
* ═══════════════════════════════════════════════════════════
|
|
36
|
+
* TAREAS (Tasks)
|
|
37
|
+
* ═══════════════════════════════════════════════════════════
|
|
38
|
+
* GET /api/v1/calendar/{spaceId}/Task/{calendarId}
|
|
39
|
+
* - Lista todas las tareas de un calendario
|
|
40
|
+
*
|
|
41
|
+
* GET /api/v1/calendar/{spaceId}/Task/detail/{taskId}
|
|
42
|
+
* - Obtiene una tarea específica por ID
|
|
43
|
+
*
|
|
44
|
+
* POST /api/v1/calendar/{spaceId}/Task
|
|
45
|
+
* - Crea una nueva tarea
|
|
46
|
+
*
|
|
47
|
+
* PUT /api/v1/calendar/{spaceId}/Task/{taskId}
|
|
48
|
+
* - Actualiza una tarea existente
|
|
49
|
+
*
|
|
50
|
+
* DELETE /api/v1/calendar/{spaceId}/Task/{taskId}
|
|
51
|
+
* - Elimina una tarea
|
|
52
|
+
*
|
|
53
|
+
* ═══════════════════════════════════════════════════════════
|
|
54
|
+
* CALENDARIOS (Calendars)
|
|
55
|
+
* ═══════════════════════════════════════════════════════════
|
|
56
|
+
* GET /api/v1/calendar/{spaceId}/Calendar
|
|
57
|
+
* - Lista todos los calendarios del espacio
|
|
58
|
+
*
|
|
59
|
+
* POST /api/v1/calendar/{spaceId}/Calendar
|
|
60
|
+
* - Crea un nuevo calendario
|
|
61
|
+
*
|
|
62
|
+
* PUT /api/v1/calendar/{spaceId}/Calendar/{calendarId}
|
|
63
|
+
* - Actualiza un calendario existente
|
|
64
|
+
*
|
|
65
|
+
* ═══════════════════════════════════════════════════════════
|
|
66
|
+
* USUARIO (User)
|
|
67
|
+
* ═══════════════════════════════════════════════════════════
|
|
68
|
+
* GET /api/v1/settings/{spaceId}/user
|
|
69
|
+
* - Obtiene información del usuario actual
|
|
70
|
+
*/
|
|
6
71
|
type ApiContext = {
|
|
7
72
|
baseUrl: string;
|
|
8
73
|
spaceId: string;
|
|
9
74
|
};
|
|
10
75
|
export declare function fetchUserTrii(ctx: ApiContext): Promise<UserTrii>;
|
|
11
76
|
export declare function fetchActivities(ctx: ApiContext, start: string, end: string): Promise<IEvent[]>;
|
|
77
|
+
export declare function fetchEventById(ctx: ApiContext, eventId: string): Promise<IEvent>;
|
|
12
78
|
export declare function addActivity(ctx: ApiContext, data: AddActivityRequestData): Promise<IEvent>;
|
|
13
79
|
export declare function updateActivity(ctx: ApiContext, data: UpdatedActivityRequestData): Promise<IEvent>;
|
|
14
80
|
export declare function deleteActivity(ctx: ApiContext, activityId: string, originalOccurrenceDate?: Date | string): Promise<void>;
|
|
15
81
|
export declare function endActivity(ctx: ApiContext, activityId: string): Promise<IEvent>;
|
|
16
82
|
export declare function fetchTasks(ctx: ApiContext, calendarId: string): Promise<ITask[]>;
|
|
83
|
+
export declare function fetchTaskById(ctx: ApiContext, taskId: string): Promise<ITask>;
|
|
17
84
|
export declare function addTask(ctx: ApiContext, data: AddTaskRequestData): Promise<ITask>;
|
|
18
85
|
export declare function updateTaskApi(ctx: ApiContext, taskId: string, updatedTask: Record<string, unknown>): Promise<ITask>;
|
|
19
86
|
export declare function deleteTaskApi(ctx: ApiContext, taskId: string): Promise<void>;
|
|
@@ -52,7 +52,6 @@ export interface EventData {
|
|
|
52
52
|
rule?: string;
|
|
53
53
|
notifications?: Notification[];
|
|
54
54
|
relatedContactId?: string;
|
|
55
|
-
sharedWith?: string[];
|
|
56
55
|
}
|
|
57
56
|
/**
|
|
58
57
|
* Datos de una tarea
|
|
@@ -83,10 +82,7 @@ export type AddActivityRequestData = {
|
|
|
83
82
|
endAt: Date;
|
|
84
83
|
allDay: boolean;
|
|
85
84
|
notifications: EventNotificationFront[];
|
|
86
|
-
|
|
87
|
-
id: string;
|
|
88
|
-
name: string;
|
|
89
|
-
};
|
|
85
|
+
contactId?: string | null;
|
|
90
86
|
title: string;
|
|
91
87
|
details: string;
|
|
92
88
|
location: string;
|
|
@@ -94,7 +90,6 @@ export type AddActivityRequestData = {
|
|
|
94
90
|
eventTypeId: string;
|
|
95
91
|
calendarId: string;
|
|
96
92
|
repeatId: string;
|
|
97
|
-
sharedWith: string[];
|
|
98
93
|
rule?: string;
|
|
99
94
|
originalOccurrenceDate?: Date | string;
|
|
100
95
|
};
|
|
@@ -110,10 +105,7 @@ export type AddTaskRequestData = {
|
|
|
110
105
|
calendarId: string;
|
|
111
106
|
startAt: string;
|
|
112
107
|
description?: string;
|
|
113
|
-
|
|
114
|
-
id: string;
|
|
115
|
-
name: string;
|
|
116
|
-
};
|
|
108
|
+
contactId?: string | null;
|
|
117
109
|
};
|
|
118
110
|
/** Payload para actualizar una tarea */
|
|
119
111
|
export type UpdateTaskRequestData = {
|