@trii/components 2.0.85 → 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.
@@ -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
- /** Tipo de diálogo: 'event' | 'task' */
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
- /** Tabs a ocultar: 'details', 'reminders', 'tasks' */
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
- * @example
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;
@@ -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>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trii/components",
3
- "version": "2.0.85",
3
+ "version": "2.0.86",
4
4
  "description": "Trii components package",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",