@gymspace/shared 1.2.22 → 1.3.0

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/index.d.mts CHANGED
@@ -1,5 +1,266 @@
1
1
  import { z } from 'zod';
2
2
 
3
+ /**
4
+ * Template code constants
5
+ */
6
+ declare const TEMPLATE_CODES: {
7
+ readonly WELCOME: "WELCOME";
8
+ readonly MEMBERSHIP_PURCHASE: "MEMBERSHIP_PURCHASE";
9
+ readonly MEMBERSHIP_RENEWAL: "MEMBERSHIP_RENEWAL";
10
+ readonly MEMBERSHIP_EXPIRING: "MEMBERSHIP_EXPIRING";
11
+ readonly PAYMENT_REMINDER: "PAYMENT_REMINDER";
12
+ readonly BIRTHDAY: "BIRTHDAY";
13
+ readonly PAYMENT_RECEIPT: "PAYMENT_RECEIPT";
14
+ };
15
+ /**
16
+ * Event names for WhatsApp template events
17
+ */
18
+ declare const WHATSAPP_TEMPLATE_EVENTS: {
19
+ readonly SEND_TEMPLATE: "whatsapp/template.send";
20
+ readonly TEMPLATE_SENT: "whatsapp/template.sent";
21
+ readonly TEMPLATE_FAILED: "whatsapp/template.failed";
22
+ };
23
+ /**
24
+ * Template metadata mapping
25
+ */
26
+ declare const TEMPLATE_METADATA: {
27
+ readonly WELCOME: {
28
+ readonly code: "WELCOME";
29
+ readonly title: "Mensaje de Bienvenida";
30
+ readonly description: "Mensaje para nuevos clientes";
31
+ readonly icon: "UserPlus";
32
+ readonly variables: readonly ["clientName", "gymName", "registrationDate"];
33
+ readonly exampleValues: {
34
+ readonly clientName: "Juan Pérez";
35
+ readonly gymName: "GymSpace";
36
+ readonly registrationDate: "15/01/2024";
37
+ };
38
+ };
39
+ readonly MEMBERSHIP_PURCHASE: {
40
+ readonly code: "MEMBERSHIP_PURCHASE";
41
+ readonly title: "Compra de Membresía";
42
+ readonly description: "Confirmación de nueva membresía";
43
+ readonly icon: "ShoppingCart";
44
+ readonly variables: readonly ["clientName", "planName", "startDate", "endDate", "amount", "paymentFrequency"];
45
+ readonly exampleValues: {
46
+ readonly clientName: "María López";
47
+ readonly planName: "Premium";
48
+ readonly startDate: "01/02/2024";
49
+ readonly endDate: "01/03/2024";
50
+ readonly amount: "$50.00";
51
+ readonly paymentFrequency: "mensual";
52
+ };
53
+ };
54
+ readonly MEMBERSHIP_RENEWAL: {
55
+ readonly code: "MEMBERSHIP_RENEWAL";
56
+ readonly title: "Renovación de Membresía";
57
+ readonly description: "Confirmación de renovación";
58
+ readonly icon: "RefreshCw";
59
+ readonly variables: readonly ["clientName", "planName", "newEndDate", "amount"];
60
+ readonly exampleValues: {
61
+ readonly clientName: "Carlos Ruiz";
62
+ readonly planName: "Básico";
63
+ readonly newEndDate: "15/04/2024";
64
+ readonly amount: "$30.00";
65
+ };
66
+ };
67
+ readonly MEMBERSHIP_EXPIRING: {
68
+ readonly code: "MEMBERSHIP_EXPIRING";
69
+ readonly title: "Membresía Por Vencer";
70
+ readonly description: "Recordatorio de expiración próxima";
71
+ readonly icon: "AlertCircle";
72
+ readonly variables: readonly ["clientName", "planName", "expirationDate", "daysRemaining"];
73
+ readonly exampleValues: {
74
+ readonly clientName: "Ana García";
75
+ readonly planName: "Premium";
76
+ readonly expirationDate: "20/02/2024";
77
+ readonly daysRemaining: "3";
78
+ };
79
+ };
80
+ readonly PAYMENT_REMINDER: {
81
+ readonly code: "PAYMENT_REMINDER";
82
+ readonly title: "Recordatorio de Pago";
83
+ readonly description: "Recordatorio de pago pendiente";
84
+ readonly icon: "DollarSign";
85
+ readonly variables: readonly ["clientName", "amount", "dueDate", "planName"];
86
+ readonly exampleValues: {
87
+ readonly clientName: "Pedro Sánchez";
88
+ readonly amount: "$40.00";
89
+ readonly dueDate: "25/02/2024";
90
+ readonly planName: "Estándar";
91
+ };
92
+ };
93
+ readonly BIRTHDAY: {
94
+ readonly code: "BIRTHDAY";
95
+ readonly title: "Cumpleaños";
96
+ readonly description: "Felicitación de cumpleaños";
97
+ readonly icon: "Cake";
98
+ readonly variables: readonly ["clientName", "gymName", "age"];
99
+ readonly exampleValues: {
100
+ readonly clientName: "Laura Martínez";
101
+ readonly gymName: "GymSpace";
102
+ readonly age: "28";
103
+ };
104
+ };
105
+ readonly PAYMENT_RECEIPT: {
106
+ readonly code: "PAYMENT_RECEIPT";
107
+ readonly title: "Comprobante de Pago";
108
+ readonly description: "Comprobante de venta pagada";
109
+ readonly icon: "Receipt";
110
+ readonly variables: readonly ["gymName", "receiptNumber", "date", "clientName", "items", "amount", "paymentMethod"];
111
+ readonly exampleValues: {
112
+ readonly gymName: "GymSpace";
113
+ readonly receiptNumber: "V-001";
114
+ readonly date: "15/01/2024";
115
+ readonly clientName: "Juan Pérez";
116
+ readonly items: "• Proteína x2 = Q100.00\n• Creatina x1 = Q50.00";
117
+ readonly amount: "Q150.00";
118
+ readonly paymentMethod: "Efectivo";
119
+ };
120
+ };
121
+ };
122
+
123
+ interface BulkMessageVariable {
124
+ name: string;
125
+ placeholder: string;
126
+ description: string;
127
+ example: string;
128
+ category: 'client' | 'gym' | 'membership' | 'activity' | 'datetime';
129
+ required: boolean;
130
+ formatter?: 'text' | 'currency' | 'date' | 'datetime' | 'number';
131
+ }
132
+ declare const BULK_MESSAGE_VARIABLES: BulkMessageVariable[];
133
+ declare const ACTIVITY_MESSAGE_VARIABLES: BulkMessageVariable[];
134
+ type VariableContextType = 'bulk' | 'activity' | 'event' | 'reminder';
135
+ declare const VARIABLE_CONTEXT_MAP: Record<VariableContextType, BulkMessageVariable[]>;
136
+ declare function getVariablesByContext(context: VariableContextType): BulkMessageVariable[];
137
+ declare function validateVariablesInContext(message: string, context: VariableContextType): {
138
+ valid: boolean;
139
+ invalidVariables: string[];
140
+ };
141
+ declare const BULK_MESSAGE_VARIABLE_CATEGORIES: {
142
+ readonly client: "Cliente";
143
+ readonly gym: "Gimnasio";
144
+ readonly membership: "Membresía";
145
+ readonly activity: "Actividad";
146
+ readonly datetime: "Fecha/Hora";
147
+ };
148
+
149
+ declare const PERMISSIONS: {
150
+ readonly ORGANIZATIONS_CREATE: "ORGANIZATIONS_CREATE";
151
+ readonly ORGANIZATIONS_READ: "ORGANIZATIONS_READ";
152
+ readonly ORGANIZATIONS_UPDATE: "ORGANIZATIONS_UPDATE";
153
+ readonly ORGANIZATIONS_DELETE: "ORGANIZATIONS_DELETE";
154
+ readonly GYMS_CREATE: "GYMS_CREATE";
155
+ readonly GYMS_READ: "GYMS_READ";
156
+ readonly GYMS_UPDATE: "GYMS_UPDATE";
157
+ readonly GYMS_DELETE: "GYMS_DELETE";
158
+ readonly COLLABORATORS_CREATE: "COLLABORATORS_CREATE";
159
+ readonly COLLABORATORS_READ: "COLLABORATORS_READ";
160
+ readonly COLLABORATORS_UPDATE: "COLLABORATORS_UPDATE";
161
+ readonly COLLABORATORS_DELETE: "COLLABORATORS_DELETE";
162
+ readonly CLIENTS_CREATE: "CLIENTS_CREATE";
163
+ readonly CLIENTS_READ: "CLIENTS_READ";
164
+ readonly CLIENTS_UPDATE: "CLIENTS_UPDATE";
165
+ readonly CLIENTS_DELETE: "CLIENTS_DELETE";
166
+ readonly CONTRACTS_CREATE: "CONTRACTS_CREATE";
167
+ readonly CONTRACTS_READ: "CONTRACTS_READ";
168
+ readonly CONTRACTS_UPDATE: "CONTRACTS_UPDATE";
169
+ readonly CONTRACTS_APPROVE: "CONTRACTS_APPROVE";
170
+ readonly CONTRACTS_CANCEL: "CONTRACTS_CANCEL";
171
+ readonly CHECKINS_CREATE: "CHECKINS_CREATE";
172
+ readonly CHECKINS_READ: "CHECKINS_READ";
173
+ readonly REPORTS_VIEW: "REPORTS_VIEW";
174
+ readonly REPORTS_FINANCIAL: "REPORTS_FINANCIAL";
175
+ readonly SETTINGS_UPDATE: "SETTINGS_UPDATE";
176
+ readonly ASSETS_CREATE: "ASSETS_CREATE";
177
+ readonly ASSETS_READ: "ASSETS_READ";
178
+ readonly ASSETS_DELETE: "ASSETS_DELETE";
179
+ readonly FILES_CREATE: "FILES_CREATE";
180
+ readonly FILES_READ: "FILES_READ";
181
+ readonly FILES_DELETE: "FILES_DELETE";
182
+ readonly PRODUCTS_CREATE: "PRODUCTS_CREATE";
183
+ readonly PRODUCTS_READ: "PRODUCTS_READ";
184
+ readonly PRODUCTS_UPDATE: "PRODUCTS_UPDATE";
185
+ readonly PRODUCTS_DELETE: "PRODUCTS_DELETE";
186
+ readonly PRODUCT_CATEGORIES_CREATE: "PRODUCT_CATEGORIES_CREATE";
187
+ readonly PRODUCT_CATEGORIES_READ: "PRODUCT_CATEGORIES_READ";
188
+ readonly PRODUCT_CATEGORIES_UPDATE: "PRODUCT_CATEGORIES_UPDATE";
189
+ readonly PRODUCT_CATEGORIES_DELETE: "PRODUCT_CATEGORIES_DELETE";
190
+ readonly SALES_CREATE: "SALES_CREATE";
191
+ readonly SALES_READ: "SALES_READ";
192
+ readonly SALES_UPDATE: "SALES_UPDATE";
193
+ readonly SALES_DELETE: "SALES_DELETE";
194
+ readonly SUPPLIERS_CREATE: "SUPPLIERS_CREATE";
195
+ readonly SUPPLIERS_READ: "SUPPLIERS_READ";
196
+ readonly SUPPLIERS_UPDATE: "SUPPLIERS_UPDATE";
197
+ readonly SUPPLIERS_DELETE: "SUPPLIERS_DELETE";
198
+ readonly PAYMENT_METHODS_CREATE: "PAYMENT_METHODS_CREATE";
199
+ readonly PAYMENT_METHODS_READ: "PAYMENT_METHODS_READ";
200
+ readonly PAYMENT_METHODS_UPDATE: "PAYMENT_METHODS_UPDATE";
201
+ readonly PAYMENT_METHODS_DELETE: "PAYMENT_METHODS_DELETE";
202
+ readonly WHATSAPP_READ: "WHATSAPP_READ";
203
+ readonly WHATSAPP_SEND: "WHATSAPP_SEND";
204
+ readonly WHATSAPP_MANAGE: "WHATSAPP_MANAGE";
205
+ readonly WHATSAPP_BULK_SEND: "WHATSAPP_BULK_SEND";
206
+ readonly WHATSAPP_BULK_MANAGE: "WHATSAPP_BULK_MANAGE";
207
+ readonly ACTIVITIES_CREATE: "ACTIVITIES_CREATE";
208
+ readonly ACTIVITIES_READ: "ACTIVITIES_READ";
209
+ readonly ACTIVITIES_UPDATE: "ACTIVITIES_UPDATE";
210
+ readonly ACTIVITIES_DELETE: "ACTIVITIES_DELETE";
211
+ readonly ACTIVITIES_MANAGE_NOTIFICATIONS: "ACTIVITIES_MANAGE_NOTIFICATIONS";
212
+ readonly TAGS_CREATE: "TAGS_CREATE";
213
+ readonly TAGS_READ: "TAGS_READ";
214
+ readonly TAGS_UPDATE: "TAGS_UPDATE";
215
+ readonly TAGS_DELETE: "TAGS_DELETE";
216
+ readonly COMMISSIONS_CONFIG_CREATE: "COMMISSIONS_CONFIG_CREATE";
217
+ readonly COMMISSIONS_CONFIG_READ: "COMMISSIONS_CONFIG_READ";
218
+ readonly COMMISSIONS_CONFIG_UPDATE: "COMMISSIONS_CONFIG_UPDATE";
219
+ readonly COMMISSIONS_RULES_CREATE: "COMMISSIONS_RULES_CREATE";
220
+ readonly COMMISSIONS_RULES_READ: "COMMISSIONS_RULES_READ";
221
+ readonly COMMISSIONS_RULES_UPDATE: "COMMISSIONS_RULES_UPDATE";
222
+ readonly COMMISSIONS_RULES_DELETE: "COMMISSIONS_RULES_DELETE";
223
+ readonly COMMISSIONS_CALCULATIONS_READ: "COMMISSIONS_CALCULATIONS_READ";
224
+ readonly COMMISSIONS_REPORTS_VIEW: "COMMISSIONS_REPORTS_VIEW";
225
+ readonly CATALOG_READ: "CATALOG_READ";
226
+ readonly CATALOG_UPDATE: "CATALOG_UPDATE";
227
+ readonly CATALOG_MANAGE: "CATALOG_MANAGE";
228
+ readonly SUPER_ADMIN: "SUPER_ADMIN";
229
+ readonly OWNER: "OWNER";
230
+ readonly All: "ALL";
231
+ };
232
+ declare const ROLE_PERMISSIONS: {
233
+ readonly ADMIN: ("ORGANIZATIONS_CREATE" | "ORGANIZATIONS_READ" | "ORGANIZATIONS_UPDATE" | "ORGANIZATIONS_DELETE" | "GYMS_CREATE" | "GYMS_READ" | "GYMS_UPDATE" | "GYMS_DELETE" | "COLLABORATORS_CREATE" | "COLLABORATORS_READ" | "COLLABORATORS_UPDATE" | "COLLABORATORS_DELETE" | "CLIENTS_CREATE" | "CLIENTS_READ" | "CLIENTS_UPDATE" | "CLIENTS_DELETE" | "CONTRACTS_CREATE" | "CONTRACTS_READ" | "CONTRACTS_UPDATE" | "CONTRACTS_APPROVE" | "CONTRACTS_CANCEL" | "CHECKINS_CREATE" | "CHECKINS_READ" | "REPORTS_VIEW" | "REPORTS_FINANCIAL" | "SETTINGS_UPDATE" | "ASSETS_CREATE" | "ASSETS_READ" | "ASSETS_DELETE" | "FILES_CREATE" | "FILES_READ" | "FILES_DELETE" | "PRODUCTS_CREATE" | "PRODUCTS_READ" | "PRODUCTS_UPDATE" | "PRODUCTS_DELETE" | "PRODUCT_CATEGORIES_CREATE" | "PRODUCT_CATEGORIES_READ" | "PRODUCT_CATEGORIES_UPDATE" | "PRODUCT_CATEGORIES_DELETE" | "SALES_CREATE" | "SALES_READ" | "SALES_UPDATE" | "SALES_DELETE" | "SUPPLIERS_CREATE" | "SUPPLIERS_READ" | "SUPPLIERS_UPDATE" | "SUPPLIERS_DELETE" | "PAYMENT_METHODS_CREATE" | "PAYMENT_METHODS_READ" | "PAYMENT_METHODS_UPDATE" | "PAYMENT_METHODS_DELETE" | "WHATSAPP_READ" | "WHATSAPP_SEND" | "WHATSAPP_MANAGE" | "WHATSAPP_BULK_SEND" | "WHATSAPP_BULK_MANAGE" | "ACTIVITIES_CREATE" | "ACTIVITIES_READ" | "ACTIVITIES_UPDATE" | "ACTIVITIES_DELETE" | "ACTIVITIES_MANAGE_NOTIFICATIONS" | "TAGS_CREATE" | "TAGS_READ" | "TAGS_UPDATE" | "TAGS_DELETE" | "COMMISSIONS_CONFIG_CREATE" | "COMMISSIONS_CONFIG_READ" | "COMMISSIONS_CONFIG_UPDATE" | "COMMISSIONS_RULES_CREATE" | "COMMISSIONS_RULES_READ" | "COMMISSIONS_RULES_UPDATE" | "COMMISSIONS_RULES_DELETE" | "COMMISSIONS_CALCULATIONS_READ" | "COMMISSIONS_REPORTS_VIEW" | "CATALOG_READ" | "CATALOG_UPDATE" | "CATALOG_MANAGE" | "SUPER_ADMIN" | "OWNER" | "ALL")[];
234
+ readonly MANAGER: readonly ["GYMS_READ", "COLLABORATORS_READ", "CLIENTS_CREATE", "CLIENTS_READ", "CLIENTS_UPDATE", "CONTRACTS_CREATE", "CONTRACTS_READ", "CHECKINS_CREATE", "CHECKINS_READ", "REPORTS_VIEW", "ASSETS_CREATE", "ASSETS_READ", "ASSETS_DELETE", "FILES_CREATE", "FILES_READ", "FILES_DELETE", "PRODUCTS_CREATE", "PRODUCTS_READ", "PRODUCTS_UPDATE", "PRODUCTS_DELETE", "PRODUCT_CATEGORIES_CREATE", "PRODUCT_CATEGORIES_READ", "PRODUCT_CATEGORIES_UPDATE", "PRODUCT_CATEGORIES_DELETE", "SALES_CREATE", "SALES_READ", "SALES_UPDATE", "SUPPLIERS_CREATE", "SUPPLIERS_READ", "SUPPLIERS_UPDATE", "SUPPLIERS_DELETE", "PAYMENT_METHODS_CREATE", "PAYMENT_METHODS_READ", "PAYMENT_METHODS_UPDATE", "PAYMENT_METHODS_DELETE", "COMMISSIONS_RULES_READ", "COMMISSIONS_CALCULATIONS_READ"];
235
+ };
236
+ declare const CACHE_TTL: {
237
+ readonly USER_PERMISSIONS: 900000;
238
+ readonly GYM_DATA: 1800000;
239
+ readonly STATIC_DATA: 3600000;
240
+ readonly REPORTS: 300000;
241
+ readonly DASHBOARD: 180000;
242
+ readonly WHATSAPP_MESSAGE_STATUS: 300000;
243
+ };
244
+ declare const FILE_LIMITS: {
245
+ readonly MAX_FILE_SIZE: number;
246
+ readonly MAX_IMAGE_SIZE: number;
247
+ readonly MAX_DOCUMENT_SIZE: number;
248
+ };
249
+ declare const PAGINATION_DEFAULTS: {
250
+ readonly PAGE: 1;
251
+ readonly LIMIT: 20;
252
+ readonly MAX_LIMIT: 100;
253
+ };
254
+ declare const DATE_FORMATS: {
255
+ readonly DATE_ONLY: "YYYY-MM-DD";
256
+ readonly DATETIME: "YYYY-MM-DD HH:mm:ss";
257
+ readonly TIME_ONLY: "HH:mm:ss";
258
+ };
259
+ declare const HEADERS: {
260
+ readonly GYM_ID: "X-Gym-Id";
261
+ readonly REQUEST_ID: "X-Request-Id";
262
+ };
263
+
3
264
  declare enum UserType {
4
265
  OWNER = "owner",
5
266
  COLLABORATOR = "collaborator"
@@ -85,9 +346,104 @@ declare enum ContractAssetType {
85
346
  OTHER = "other"
86
347
  }
87
348
 
88
- type TemplateCodeValue = (typeof TemplateCode)[keyof typeof TemplateCode];
89
349
  /**
90
- * Template codes for WhatsApp messages
350
+ * Evento para enviar un mensaje de WhatsApp
351
+ */
352
+ interface WhatsAppMessageSendEventData {
353
+ gymId: string;
354
+ instanceName: string;
355
+ phoneNumber: string;
356
+ content: string;
357
+ clientId?: string;
358
+ templateId?: string;
359
+ variables?: Record<string, any>;
360
+ userId?: string;
361
+ }
362
+ /**
363
+ * Nombres de eventos de WhatsApp
364
+ */
365
+ declare const WHATSAPP_EVENTS: {
366
+ readonly MESSAGE_SEND: "whatsapp/message.send";
367
+ readonly MESSAGE_RECEIVED: "whatsapp/message.received";
368
+ readonly CONNECTION_UPDATE: "whatsapp/connection.update";
369
+ };
370
+
371
+ declare const BULK_MESSAGING_EVENTS: {
372
+ readonly SEND_BULK_MESSAGES: "whatsapp/bulk-messages.send";
373
+ };
374
+ interface BulkMessageEventData {
375
+ sendId: string;
376
+ gymId: string;
377
+ userId: string;
378
+ instanceName: string;
379
+ templateId?: string;
380
+ message: string;
381
+ variableContext?: VariableContextType;
382
+ clients: Array<{
383
+ clientId: string;
384
+ clientName: string;
385
+ phoneNumber: string;
386
+ data: Record<string, any>;
387
+ }>;
388
+ gymData: Record<string, any>;
389
+ contextData?: Record<string, any>;
390
+ }
391
+ interface SendBulkMessagesEvent {
392
+ name: typeof BULK_MESSAGING_EVENTS.SEND_BULK_MESSAGES;
393
+ data: BulkMessageEventData;
394
+ }
395
+
396
+ declare const ACTIVITY_EVENTS: {
397
+ readonly SEND_ACTIVITY_NOTIFICATION: "activity/notification.send";
398
+ };
399
+ interface SendActivityNotificationEvent {
400
+ name: typeof ACTIVITY_EVENTS.SEND_ACTIVITY_NOTIFICATION;
401
+ data: {
402
+ activityId: string;
403
+ notificationId: string;
404
+ gymId: string;
405
+ userId: string;
406
+ instanceName: string;
407
+ message: string;
408
+ clients: Array<{
409
+ clientId: string;
410
+ clientName: string;
411
+ phoneNumber: string;
412
+ data: {
413
+ id: string;
414
+ name: string;
415
+ email?: string;
416
+ phone: string;
417
+ activePlan?: {
418
+ name: string;
419
+ expirationDate?: Date;
420
+ amount?: number;
421
+ };
422
+ membershipStatus?: string;
423
+ metadata?: Record<string, any>;
424
+ };
425
+ }>;
426
+ gymData: {
427
+ name: string;
428
+ phone?: string;
429
+ address?: string;
430
+ countryConfig: {
431
+ currency: string;
432
+ locale: string;
433
+ };
434
+ };
435
+ activityData: {
436
+ name: string;
437
+ startDateTime: Date;
438
+ durationMinutes: number;
439
+ location: string;
440
+ };
441
+ };
442
+ }
443
+
444
+ type TemplateCodeValue = (typeof TemplateCode)[keyof typeof TemplateCode];
445
+ /**
446
+ * Template codes for WhatsApp messages
91
447
  */
92
448
  declare const TemplateCode: {
93
449
  readonly WELCOME: "WELCOME";
@@ -335,523 +691,130 @@ interface UpdateCollaboratorRoleDto {
335
691
  interface ListCollaboratorsParams extends PaginationParams {
336
692
  status?: CollaboratorStatus;
337
693
  roleId?: UUID;
338
- search?: string;
339
- }
340
- interface ActivityQueryParams {
341
- startDate?: string;
342
- endDate?: string;
343
- limit?: number;
344
- type?: string;
345
- }
346
- interface StatsQueryParams {
347
- startDate?: string;
348
- endDate?: string;
349
- }
350
- interface CollaboratorStats {
351
- contracts: {
352
- total: number;
353
- totalAmount: number;
354
- averageAmount: number;
355
- };
356
- checkIns: {
357
- total: number;
358
- };
359
- sales: {
360
- total: number;
361
- totalAmount: number;
362
- };
363
- clients: {
364
- created: number;
365
- };
366
- }
367
- interface ActivityItem {
368
- type: string;
369
- timestamp: Date;
370
- description: string;
371
- metadata: any;
372
- }
373
-
374
- interface IUser {
375
- id: UUID;
376
- email: string;
377
- name: string;
378
- phone?: string;
379
- userType: UserType;
380
- emailVerifiedAt?: Date;
381
- }
382
- interface IOrganization {
383
- id: UUID;
384
- ownerUserId: UUID;
385
- name: string;
386
- subscriptionPlanId: UUID;
387
- subscriptionStatus: string;
388
- subscriptionStart: Date;
389
- subscriptionEnd: Date;
390
- country: string;
391
- currency: string;
392
- timezone: string;
393
- settings?: Record<string, any>;
394
- }
395
- interface IGym {
396
- id: UUID;
397
- organizationId: UUID;
398
- name: string;
399
- address?: string;
400
- description?: string;
401
- phone?: string;
402
- gymCode: string;
403
- profileAssetId?: UUID;
404
- coverAssetId?: UUID;
405
- evaluationStructure?: Record<string, any>;
406
- }
407
- interface ICollaborator {
408
- id: UUID;
409
- userId: UUID;
410
- gymId: UUID;
411
- roleId: UUID;
412
- status: CollaboratorStatus;
413
- hiredDate?: Date;
414
- invitationId?: UUID;
415
- profileAssetId?: UUID;
416
- coverAssetId?: UUID;
417
- description?: string;
418
- specialties?: string[];
419
- }
420
- interface IRole {
421
- id: UUID;
422
- name: string;
423
- permissions: Permission[];
424
- description?: string;
425
- canManageEvaluations: boolean;
426
- }
427
- interface ISubscriptionPlan {
428
- id: UUID;
429
- name: string;
430
- price: any;
431
- billingFrequency: string;
432
- maxGyms: number;
433
- maxClientsPerGym: number;
434
- maxUsersPerGym: number;
435
- features: any;
436
- description?: string;
437
- }
438
- interface ISubscription {
439
- id: UUID;
440
- organizationId: UUID;
441
- subscriptionPlanId: UUID;
442
- subscriptionPlan?: ISubscriptionPlan;
443
- status: string;
444
- startDate: Date;
445
- endDate: Date;
446
- isActive: boolean;
447
- }
448
- interface IRequestContext {
449
- user?: IUser;
450
- gym?: IGym;
451
- organization?: IOrganization;
452
- subscription?: ISubscription;
453
- permissions: Permission[];
454
- hasPermission(permission: Permission): boolean;
455
- canAccess(resource: string, action: string): boolean;
456
- getGymId(): UUID | undefined;
457
- getOrganizationId(): UUID | undefined;
458
- getUserId(): UUID | undefined;
459
- getTimezone(): string;
460
- readonly isOwner: boolean;
461
- readonly isCollaborator: boolean;
462
- }
463
-
464
- /**
465
- * Template code constants
466
- */
467
- declare const TEMPLATE_CODES: {
468
- readonly WELCOME: "WELCOME";
469
- readonly MEMBERSHIP_PURCHASE: "MEMBERSHIP_PURCHASE";
470
- readonly MEMBERSHIP_RENEWAL: "MEMBERSHIP_RENEWAL";
471
- readonly MEMBERSHIP_EXPIRING: "MEMBERSHIP_EXPIRING";
472
- readonly PAYMENT_REMINDER: "PAYMENT_REMINDER";
473
- readonly BIRTHDAY: "BIRTHDAY";
474
- readonly PAYMENT_RECEIPT: "PAYMENT_RECEIPT";
475
- };
476
- /**
477
- * Event names for WhatsApp template events
478
- */
479
- declare const WHATSAPP_TEMPLATE_EVENTS: {
480
- readonly SEND_TEMPLATE: "whatsapp/template.send";
481
- readonly TEMPLATE_SENT: "whatsapp/template.sent";
482
- readonly TEMPLATE_FAILED: "whatsapp/template.failed";
483
- };
484
- /**
485
- * Template metadata mapping
486
- */
487
- declare const TEMPLATE_METADATA: {
488
- readonly WELCOME: {
489
- readonly code: "WELCOME";
490
- readonly title: "Mensaje de Bienvenida";
491
- readonly description: "Mensaje para nuevos clientes";
492
- readonly icon: "UserPlus";
493
- readonly variables: readonly ["clientName", "gymName", "registrationDate"];
494
- readonly exampleValues: {
495
- readonly clientName: "Juan Pérez";
496
- readonly gymName: "GymSpace";
497
- readonly registrationDate: "15/01/2024";
498
- };
499
- };
500
- readonly MEMBERSHIP_PURCHASE: {
501
- readonly code: "MEMBERSHIP_PURCHASE";
502
- readonly title: "Compra de Membresía";
503
- readonly description: "Confirmación de nueva membresía";
504
- readonly icon: "ShoppingCart";
505
- readonly variables: readonly ["clientName", "planName", "startDate", "endDate", "amount", "paymentFrequency"];
506
- readonly exampleValues: {
507
- readonly clientName: "María López";
508
- readonly planName: "Premium";
509
- readonly startDate: "01/02/2024";
510
- readonly endDate: "01/03/2024";
511
- readonly amount: "$50.00";
512
- readonly paymentFrequency: "mensual";
513
- };
514
- };
515
- readonly MEMBERSHIP_RENEWAL: {
516
- readonly code: "MEMBERSHIP_RENEWAL";
517
- readonly title: "Renovación de Membresía";
518
- readonly description: "Confirmación de renovación";
519
- readonly icon: "RefreshCw";
520
- readonly variables: readonly ["clientName", "planName", "newEndDate", "amount"];
521
- readonly exampleValues: {
522
- readonly clientName: "Carlos Ruiz";
523
- readonly planName: "Básico";
524
- readonly newEndDate: "15/04/2024";
525
- readonly amount: "$30.00";
526
- };
527
- };
528
- readonly MEMBERSHIP_EXPIRING: {
529
- readonly code: "MEMBERSHIP_EXPIRING";
530
- readonly title: "Membresía Por Vencer";
531
- readonly description: "Recordatorio de expiración próxima";
532
- readonly icon: "AlertCircle";
533
- readonly variables: readonly ["clientName", "planName", "expirationDate", "daysRemaining"];
534
- readonly exampleValues: {
535
- readonly clientName: "Ana García";
536
- readonly planName: "Premium";
537
- readonly expirationDate: "20/02/2024";
538
- readonly daysRemaining: "3";
539
- };
540
- };
541
- readonly PAYMENT_REMINDER: {
542
- readonly code: "PAYMENT_REMINDER";
543
- readonly title: "Recordatorio de Pago";
544
- readonly description: "Recordatorio de pago pendiente";
545
- readonly icon: "DollarSign";
546
- readonly variables: readonly ["clientName", "amount", "dueDate", "planName"];
547
- readonly exampleValues: {
548
- readonly clientName: "Pedro Sánchez";
549
- readonly amount: "$40.00";
550
- readonly dueDate: "25/02/2024";
551
- readonly planName: "Estándar";
552
- };
553
- };
554
- readonly BIRTHDAY: {
555
- readonly code: "BIRTHDAY";
556
- readonly title: "Cumpleaños";
557
- readonly description: "Felicitación de cumpleaños";
558
- readonly icon: "Cake";
559
- readonly variables: readonly ["clientName", "gymName", "age"];
560
- readonly exampleValues: {
561
- readonly clientName: "Laura Martínez";
562
- readonly gymName: "GymSpace";
563
- readonly age: "28";
564
- };
565
- };
566
- readonly PAYMENT_RECEIPT: {
567
- readonly code: "PAYMENT_RECEIPT";
568
- readonly title: "Comprobante de Pago";
569
- readonly description: "Comprobante de venta pagada";
570
- readonly icon: "Receipt";
571
- readonly variables: readonly ["gymName", "receiptNumber", "date", "clientName", "items", "amount", "paymentMethod"];
572
- readonly exampleValues: {
573
- readonly gymName: "GymSpace";
574
- readonly receiptNumber: "V-001";
575
- readonly date: "15/01/2024";
576
- readonly clientName: "Juan Pérez";
577
- readonly items: "• Proteína x2 = Q100.00\n• Creatina x1 = Q50.00";
578
- readonly amount: "Q150.00";
579
- readonly paymentMethod: "Efectivo";
580
- };
581
- };
582
- };
583
-
584
- interface BulkMessageVariable {
585
- name: string;
586
- placeholder: string;
587
- description: string;
588
- example: string;
589
- category: 'client' | 'gym' | 'membership' | 'activity' | 'datetime';
590
- required: boolean;
591
- formatter?: 'text' | 'currency' | 'date' | 'datetime' | 'number';
592
- }
593
- declare const BULK_MESSAGE_VARIABLES: BulkMessageVariable[];
594
- declare const ACTIVITY_MESSAGE_VARIABLES: BulkMessageVariable[];
595
- declare const BULK_MESSAGE_VARIABLE_CATEGORIES: {
596
- readonly client: "Cliente";
597
- readonly gym: "Gimnasio";
598
- readonly membership: "Membresía";
599
- readonly activity: "Actividad";
600
- readonly datetime: "Fecha/Hora";
601
- };
602
-
603
- declare const PERMISSIONS: {
604
- readonly ORGANIZATIONS_CREATE: "ORGANIZATIONS_CREATE";
605
- readonly ORGANIZATIONS_READ: "ORGANIZATIONS_READ";
606
- readonly ORGANIZATIONS_UPDATE: "ORGANIZATIONS_UPDATE";
607
- readonly ORGANIZATIONS_DELETE: "ORGANIZATIONS_DELETE";
608
- readonly GYMS_CREATE: "GYMS_CREATE";
609
- readonly GYMS_READ: "GYMS_READ";
610
- readonly GYMS_UPDATE: "GYMS_UPDATE";
611
- readonly GYMS_DELETE: "GYMS_DELETE";
612
- readonly COLLABORATORS_CREATE: "COLLABORATORS_CREATE";
613
- readonly COLLABORATORS_READ: "COLLABORATORS_READ";
614
- readonly COLLABORATORS_UPDATE: "COLLABORATORS_UPDATE";
615
- readonly COLLABORATORS_DELETE: "COLLABORATORS_DELETE";
616
- readonly CLIENTS_CREATE: "CLIENTS_CREATE";
617
- readonly CLIENTS_READ: "CLIENTS_READ";
618
- readonly CLIENTS_UPDATE: "CLIENTS_UPDATE";
619
- readonly CLIENTS_DELETE: "CLIENTS_DELETE";
620
- readonly CONTRACTS_CREATE: "CONTRACTS_CREATE";
621
- readonly CONTRACTS_READ: "CONTRACTS_READ";
622
- readonly CONTRACTS_UPDATE: "CONTRACTS_UPDATE";
623
- readonly CONTRACTS_APPROVE: "CONTRACTS_APPROVE";
624
- readonly CONTRACTS_CANCEL: "CONTRACTS_CANCEL";
625
- readonly CHECKINS_CREATE: "CHECKINS_CREATE";
626
- readonly CHECKINS_READ: "CHECKINS_READ";
627
- readonly REPORTS_VIEW: "REPORTS_VIEW";
628
- readonly REPORTS_FINANCIAL: "REPORTS_FINANCIAL";
629
- readonly SETTINGS_UPDATE: "SETTINGS_UPDATE";
630
- readonly ASSETS_CREATE: "ASSETS_CREATE";
631
- readonly ASSETS_READ: "ASSETS_READ";
632
- readonly ASSETS_DELETE: "ASSETS_DELETE";
633
- readonly FILES_CREATE: "FILES_CREATE";
634
- readonly FILES_READ: "FILES_READ";
635
- readonly FILES_DELETE: "FILES_DELETE";
636
- readonly PRODUCTS_CREATE: "PRODUCTS_CREATE";
637
- readonly PRODUCTS_READ: "PRODUCTS_READ";
638
- readonly PRODUCTS_UPDATE: "PRODUCTS_UPDATE";
639
- readonly PRODUCTS_DELETE: "PRODUCTS_DELETE";
640
- readonly PRODUCT_CATEGORIES_CREATE: "PRODUCT_CATEGORIES_CREATE";
641
- readonly PRODUCT_CATEGORIES_READ: "PRODUCT_CATEGORIES_READ";
642
- readonly PRODUCT_CATEGORIES_UPDATE: "PRODUCT_CATEGORIES_UPDATE";
643
- readonly PRODUCT_CATEGORIES_DELETE: "PRODUCT_CATEGORIES_DELETE";
644
- readonly SALES_CREATE: "SALES_CREATE";
645
- readonly SALES_READ: "SALES_READ";
646
- readonly SALES_UPDATE: "SALES_UPDATE";
647
- readonly SALES_DELETE: "SALES_DELETE";
648
- readonly SUPPLIERS_CREATE: "SUPPLIERS_CREATE";
649
- readonly SUPPLIERS_READ: "SUPPLIERS_READ";
650
- readonly SUPPLIERS_UPDATE: "SUPPLIERS_UPDATE";
651
- readonly SUPPLIERS_DELETE: "SUPPLIERS_DELETE";
652
- readonly PAYMENT_METHODS_CREATE: "PAYMENT_METHODS_CREATE";
653
- readonly PAYMENT_METHODS_READ: "PAYMENT_METHODS_READ";
654
- readonly PAYMENT_METHODS_UPDATE: "PAYMENT_METHODS_UPDATE";
655
- readonly PAYMENT_METHODS_DELETE: "PAYMENT_METHODS_DELETE";
656
- readonly WHATSAPP_READ: "WHATSAPP_READ";
657
- readonly WHATSAPP_SEND: "WHATSAPP_SEND";
658
- readonly WHATSAPP_MANAGE: "WHATSAPP_MANAGE";
659
- readonly WHATSAPP_BULK_SEND: "WHATSAPP_BULK_SEND";
660
- readonly WHATSAPP_BULK_MANAGE: "WHATSAPP_BULK_MANAGE";
661
- readonly ACTIVITIES_CREATE: "ACTIVITIES_CREATE";
662
- readonly ACTIVITIES_READ: "ACTIVITIES_READ";
663
- readonly ACTIVITIES_UPDATE: "ACTIVITIES_UPDATE";
664
- readonly ACTIVITIES_DELETE: "ACTIVITIES_DELETE";
665
- readonly ACTIVITIES_MANAGE_NOTIFICATIONS: "ACTIVITIES_MANAGE_NOTIFICATIONS";
666
- readonly TAGS_CREATE: "TAGS_CREATE";
667
- readonly TAGS_READ: "TAGS_READ";
668
- readonly TAGS_UPDATE: "TAGS_UPDATE";
669
- readonly TAGS_DELETE: "TAGS_DELETE";
670
- readonly COMMISSIONS_CONFIG_CREATE: "COMMISSIONS_CONFIG_CREATE";
671
- readonly COMMISSIONS_CONFIG_READ: "COMMISSIONS_CONFIG_READ";
672
- readonly COMMISSIONS_CONFIG_UPDATE: "COMMISSIONS_CONFIG_UPDATE";
673
- readonly COMMISSIONS_RULES_CREATE: "COMMISSIONS_RULES_CREATE";
674
- readonly COMMISSIONS_RULES_READ: "COMMISSIONS_RULES_READ";
675
- readonly COMMISSIONS_RULES_UPDATE: "COMMISSIONS_RULES_UPDATE";
676
- readonly COMMISSIONS_RULES_DELETE: "COMMISSIONS_RULES_DELETE";
677
- readonly COMMISSIONS_CALCULATIONS_READ: "COMMISSIONS_CALCULATIONS_READ";
678
- readonly COMMISSIONS_REPORTS_VIEW: "COMMISSIONS_REPORTS_VIEW";
679
- readonly CATALOG_READ: "CATALOG_READ";
680
- readonly CATALOG_UPDATE: "CATALOG_UPDATE";
681
- readonly CATALOG_MANAGE: "CATALOG_MANAGE";
682
- readonly SUPER_ADMIN: "SUPER_ADMIN";
683
- readonly OWNER: "OWNER";
684
- readonly All: "ALL";
685
- };
686
- declare const ROLE_PERMISSIONS: {
687
- readonly ADMIN: ("SUPER_ADMIN" | "OWNER" | "ORGANIZATIONS_CREATE" | "ORGANIZATIONS_READ" | "ORGANIZATIONS_UPDATE" | "ORGANIZATIONS_DELETE" | "GYMS_CREATE" | "GYMS_READ" | "GYMS_UPDATE" | "GYMS_DELETE" | "COLLABORATORS_CREATE" | "COLLABORATORS_READ" | "COLLABORATORS_UPDATE" | "COLLABORATORS_DELETE" | "CLIENTS_CREATE" | "CLIENTS_READ" | "CLIENTS_UPDATE" | "CLIENTS_DELETE" | "CONTRACTS_CREATE" | "CONTRACTS_READ" | "CONTRACTS_UPDATE" | "CONTRACTS_APPROVE" | "CONTRACTS_CANCEL" | "CHECKINS_CREATE" | "CHECKINS_READ" | "REPORTS_VIEW" | "REPORTS_FINANCIAL" | "SETTINGS_UPDATE" | "ASSETS_CREATE" | "ASSETS_READ" | "ASSETS_DELETE" | "FILES_CREATE" | "FILES_READ" | "FILES_DELETE" | "PRODUCTS_CREATE" | "PRODUCTS_READ" | "PRODUCTS_UPDATE" | "PRODUCTS_DELETE" | "PRODUCT_CATEGORIES_CREATE" | "PRODUCT_CATEGORIES_READ" | "PRODUCT_CATEGORIES_UPDATE" | "PRODUCT_CATEGORIES_DELETE" | "SALES_CREATE" | "SALES_READ" | "SALES_UPDATE" | "SALES_DELETE" | "SUPPLIERS_CREATE" | "SUPPLIERS_READ" | "SUPPLIERS_UPDATE" | "SUPPLIERS_DELETE" | "PAYMENT_METHODS_CREATE" | "PAYMENT_METHODS_READ" | "PAYMENT_METHODS_UPDATE" | "PAYMENT_METHODS_DELETE" | "WHATSAPP_READ" | "WHATSAPP_SEND" | "WHATSAPP_MANAGE" | "WHATSAPP_BULK_SEND" | "WHATSAPP_BULK_MANAGE" | "ACTIVITIES_CREATE" | "ACTIVITIES_READ" | "ACTIVITIES_UPDATE" | "ACTIVITIES_DELETE" | "ACTIVITIES_MANAGE_NOTIFICATIONS" | "TAGS_CREATE" | "TAGS_READ" | "TAGS_UPDATE" | "TAGS_DELETE" | "COMMISSIONS_CONFIG_CREATE" | "COMMISSIONS_CONFIG_READ" | "COMMISSIONS_CONFIG_UPDATE" | "COMMISSIONS_RULES_CREATE" | "COMMISSIONS_RULES_READ" | "COMMISSIONS_RULES_UPDATE" | "COMMISSIONS_RULES_DELETE" | "COMMISSIONS_CALCULATIONS_READ" | "COMMISSIONS_REPORTS_VIEW" | "CATALOG_READ" | "CATALOG_UPDATE" | "CATALOG_MANAGE" | "ALL")[];
688
- readonly MANAGER: readonly ["GYMS_READ", "COLLABORATORS_READ", "CLIENTS_CREATE", "CLIENTS_READ", "CLIENTS_UPDATE", "CONTRACTS_CREATE", "CONTRACTS_READ", "CHECKINS_CREATE", "CHECKINS_READ", "REPORTS_VIEW", "ASSETS_CREATE", "ASSETS_READ", "ASSETS_DELETE", "FILES_CREATE", "FILES_READ", "FILES_DELETE", "PRODUCTS_CREATE", "PRODUCTS_READ", "PRODUCTS_UPDATE", "PRODUCTS_DELETE", "PRODUCT_CATEGORIES_CREATE", "PRODUCT_CATEGORIES_READ", "PRODUCT_CATEGORIES_UPDATE", "PRODUCT_CATEGORIES_DELETE", "SALES_CREATE", "SALES_READ", "SALES_UPDATE", "SUPPLIERS_CREATE", "SUPPLIERS_READ", "SUPPLIERS_UPDATE", "SUPPLIERS_DELETE", "PAYMENT_METHODS_CREATE", "PAYMENT_METHODS_READ", "PAYMENT_METHODS_UPDATE", "PAYMENT_METHODS_DELETE", "COMMISSIONS_RULES_READ", "COMMISSIONS_CALCULATIONS_READ"];
689
- };
690
- declare const CACHE_TTL: {
691
- readonly USER_PERMISSIONS: 900000;
692
- readonly GYM_DATA: 1800000;
693
- readonly STATIC_DATA: 3600000;
694
- readonly REPORTS: 300000;
695
- readonly DASHBOARD: 180000;
696
- readonly WHATSAPP_MESSAGE_STATUS: 300000;
697
- };
698
- declare const FILE_LIMITS: {
699
- readonly MAX_FILE_SIZE: number;
700
- readonly MAX_IMAGE_SIZE: number;
701
- readonly MAX_DOCUMENT_SIZE: number;
702
- };
703
- declare const PAGINATION_DEFAULTS: {
704
- readonly PAGE: 1;
705
- readonly LIMIT: 20;
706
- readonly MAX_LIMIT: 100;
707
- };
708
- declare const DATE_FORMATS: {
709
- readonly DATE_ONLY: "YYYY-MM-DD";
710
- readonly DATETIME: "YYYY-MM-DD HH:mm:ss";
711
- readonly TIME_ONLY: "HH:mm:ss";
712
- };
713
- declare const HEADERS: {
714
- readonly GYM_ID: "X-Gym-Id";
715
- readonly REQUEST_ID: "X-Request-Id";
716
- };
717
-
718
- declare enum RoleNames {
719
- ADMIN = "Admin",
720
- ENCARGADO = "Encargado",
721
- OWNER = "OWNER"
694
+ search?: string;
722
695
  }
723
- declare const ROLE_NAMES: typeof RoleNames;
724
- type RoleName = RoleNames;
725
- declare function isAdminRole(roleName: string | null | undefined): boolean;
726
- declare function isEncargadoRole(roleName: string | null | undefined): boolean;
727
- declare function canAccessFeature(userRole: string | null | undefined, allowedRoles: string[] | RoleNames[]): boolean;
728
- declare function getRoleDisplayName(roleName: string | null | undefined): string;
729
- declare function getRoleDescription(roleName: string | null | undefined): string;
730
- declare function getRoleCapabilities(roleName: string | null | undefined): string[];
731
-
732
- /**
733
- * Evento para enviar un mensaje de WhatsApp
734
- */
735
- interface WhatsAppMessageSendEventData {
736
- gymId: string;
737
- instanceName: string;
738
- phoneNumber: string;
739
- content: string;
740
- clientId?: string;
741
- templateId?: string;
742
- variables?: Record<string, any>;
743
- userId?: string;
696
+ interface ActivityQueryParams {
697
+ startDate?: string;
698
+ endDate?: string;
699
+ limit?: number;
700
+ type?: string;
744
701
  }
745
- /**
746
- * Nombres de eventos de WhatsApp
747
- */
748
- declare const WHATSAPP_EVENTS: {
749
- readonly MESSAGE_SEND: "whatsapp/message.send";
750
- readonly MESSAGE_RECEIVED: "whatsapp/message.received";
751
- readonly CONNECTION_UPDATE: "whatsapp/connection.update";
752
- };
753
-
754
- declare const BULK_MESSAGING_EVENTS: {
755
- readonly GENERATE_BULK_MESSAGE: "whatsapp/bulk-message.generate";
756
- readonly SEND_BULK_MESSAGES: "whatsapp/bulk-messages.send";
757
- };
758
- interface GenerateBulkMessageEvent {
759
- name: typeof BULK_MESSAGING_EVENTS.GENERATE_BULK_MESSAGE;
760
- data: {
761
- gymId: string;
762
- userId: string;
763
- prompt: string;
764
- includeVariables?: string[];
765
- tone?: 'promotional' | 'informational' | 'reminder' | 'greeting' | 'custom' | 'friendly';
766
- language?: string;
767
- additionalRequirements?: string;
768
- };
702
+ interface StatsQueryParams {
703
+ startDate?: string;
704
+ endDate?: string;
769
705
  }
770
- interface SendBulkMessagesEvent {
771
- name: typeof BULK_MESSAGING_EVENTS.SEND_BULK_MESSAGES;
772
- data: {
773
- sendId: string;
774
- gymId: string;
775
- userId: string;
776
- instanceName: string;
777
- templateId?: string;
778
- message: string;
779
- clients: Array<{
780
- clientId: string;
781
- clientName: string;
782
- phoneNumber: string;
783
- data: {
784
- id: string;
785
- name: string;
786
- email?: string;
787
- phone: string;
788
- activePlan?: {
789
- name: string;
790
- expirationDate?: Date;
791
- amount?: number;
792
- };
793
- membershipStatus?: string;
794
- metadata?: Record<string, any>;
795
- };
796
- }>;
797
- gymData: {
798
- name: string;
799
- phone?: string;
800
- address?: string;
801
- countryConfig: {
802
- currency: string;
803
- locale: string;
804
- };
805
- };
706
+ interface CollaboratorStats {
707
+ contracts: {
708
+ total: number;
709
+ totalAmount: number;
710
+ averageAmount: number;
711
+ };
712
+ checkIns: {
713
+ total: number;
806
714
  };
715
+ sales: {
716
+ total: number;
717
+ totalAmount: number;
718
+ };
719
+ clients: {
720
+ created: number;
721
+ };
722
+ }
723
+ interface ActivityItem {
724
+ type: string;
725
+ timestamp: Date;
726
+ description: string;
727
+ metadata: any;
807
728
  }
808
729
 
809
- declare const ACTIVITY_EVENTS: {
810
- readonly SEND_ACTIVITY_NOTIFICATION: "activity/notification.send";
811
- };
812
- interface SendActivityNotificationEvent {
813
- name: typeof ACTIVITY_EVENTS.SEND_ACTIVITY_NOTIFICATION;
814
- data: {
815
- activityId: string;
816
- notificationId: string;
817
- gymId: string;
818
- userId: string;
819
- instanceName: string;
820
- message: string;
821
- clients: Array<{
822
- clientId: string;
823
- clientName: string;
824
- phoneNumber: string;
825
- data: {
826
- id: string;
827
- name: string;
828
- email?: string;
829
- phone: string;
830
- activePlan?: {
831
- name: string;
832
- expirationDate?: Date;
833
- amount?: number;
834
- };
835
- membershipStatus?: string;
836
- metadata?: Record<string, any>;
837
- };
838
- }>;
839
- gymData: {
840
- name: string;
841
- phone?: string;
842
- address?: string;
843
- countryConfig: {
844
- currency: string;
845
- locale: string;
846
- };
847
- };
848
- activityData: {
849
- name: string;
850
- startDateTime: Date;
851
- durationMinutes: number;
852
- location: string;
853
- };
854
- };
730
+ interface IUser {
731
+ id: UUID;
732
+ email: string;
733
+ name: string;
734
+ phone?: string;
735
+ userType: UserType;
736
+ emailVerifiedAt?: Date;
737
+ }
738
+ interface IOrganization {
739
+ id: UUID;
740
+ ownerUserId: UUID;
741
+ name: string;
742
+ subscriptionPlanId: UUID;
743
+ subscriptionStatus: string;
744
+ subscriptionStart: Date;
745
+ subscriptionEnd: Date;
746
+ country: string;
747
+ currency: string;
748
+ timezone: string;
749
+ settings?: Record<string, any>;
750
+ }
751
+ interface IGym {
752
+ id: UUID;
753
+ organizationId: UUID;
754
+ name: string;
755
+ address?: string;
756
+ description?: string;
757
+ phone?: string;
758
+ gymCode: string;
759
+ profileAssetId?: UUID;
760
+ coverAssetId?: UUID;
761
+ evaluationStructure?: Record<string, any>;
762
+ }
763
+ interface ICollaborator {
764
+ id: UUID;
765
+ userId: UUID;
766
+ gymId: UUID;
767
+ roleId: UUID;
768
+ status: CollaboratorStatus;
769
+ hiredDate?: Date;
770
+ invitationId?: UUID;
771
+ profileAssetId?: UUID;
772
+ coverAssetId?: UUID;
773
+ description?: string;
774
+ specialties?: string[];
775
+ }
776
+ interface IRole {
777
+ id: UUID;
778
+ name: string;
779
+ permissions: Permission[];
780
+ description?: string;
781
+ canManageEvaluations: boolean;
782
+ }
783
+ interface ISubscriptionPlan {
784
+ id: UUID;
785
+ name: string;
786
+ price: any;
787
+ billingFrequency: string;
788
+ maxGyms: number;
789
+ maxClientsPerGym: number;
790
+ maxUsersPerGym: number;
791
+ features: any;
792
+ description?: string;
793
+ }
794
+ interface ISubscription {
795
+ id: UUID;
796
+ organizationId: UUID;
797
+ subscriptionPlanId: UUID;
798
+ subscriptionPlan?: ISubscriptionPlan;
799
+ status: string;
800
+ startDate: Date;
801
+ endDate: Date;
802
+ isActive: boolean;
803
+ }
804
+ interface IRequestContext {
805
+ user?: IUser;
806
+ gym?: IGym;
807
+ organization?: IOrganization;
808
+ subscription?: ISubscription;
809
+ permissions: Permission[];
810
+ hasPermission(permission: Permission): boolean;
811
+ canAccess(resource: string, action: string): boolean;
812
+ getGymId(): UUID | undefined;
813
+ getOrganizationId(): UUID | undefined;
814
+ getUserId(): UUID | undefined;
815
+ getTimezone(): string;
816
+ readonly isOwner: boolean;
817
+ readonly isCollaborator: boolean;
855
818
  }
856
819
 
857
820
  declare const templateGenerationRequestSchema: z.ZodObject<{
@@ -902,12 +865,12 @@ declare const aiGeneratedTemplateSchema: z.ZodObject<{
902
865
  suggestions: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
903
866
  }, "strip", z.ZodTypeAny, {
904
867
  message: string;
905
- tone: "friendly" | "professional" | "casual" | "urgent";
868
+ tone: "professional" | "friendly" | "casual" | "urgent";
906
869
  usedVariables: string[];
907
870
  suggestions?: string[] | undefined;
908
871
  }, {
909
872
  message: string;
910
- tone: "friendly" | "professional" | "casual" | "urgent";
873
+ tone: "professional" | "friendly" | "casual" | "urgent";
911
874
  usedVariables: string[];
912
875
  suggestions?: string[] | undefined;
913
876
  }>;
@@ -923,13 +886,13 @@ declare const bulkMessageGenerationRequestSchema: z.ZodObject<{
923
886
  }, "strip", z.ZodTypeAny, {
924
887
  language: string;
925
888
  prompt: string;
926
- tone?: "promotional" | "informational" | "reminder" | "greeting" | "friendly" | undefined;
889
+ tone?: "reminder" | "friendly" | "promotional" | "informational" | "greeting" | undefined;
927
890
  includeVariables?: string[] | undefined;
928
891
  additionalRequirements?: string | undefined;
929
892
  }, {
930
893
  prompt: string;
931
894
  language?: string | undefined;
932
- tone?: "promotional" | "informational" | "reminder" | "greeting" | "friendly" | undefined;
895
+ tone?: "reminder" | "friendly" | "promotional" | "informational" | "greeting" | undefined;
933
896
  includeVariables?: string[] | undefined;
934
897
  additionalRequirements?: string | undefined;
935
898
  }>;
@@ -940,12 +903,12 @@ declare const bulkMessageSchema: z.ZodObject<{
940
903
  suggestions: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
941
904
  }, "strip", z.ZodTypeAny, {
942
905
  message: string;
943
- tone: "promotional" | "informational" | "reminder" | "greeting" | "friendly";
906
+ tone: "reminder" | "friendly" | "promotional" | "informational" | "greeting";
944
907
  usedVariables: string[];
945
908
  suggestions?: string[] | undefined;
946
909
  }, {
947
910
  message: string;
948
- tone: "promotional" | "informational" | "reminder" | "greeting" | "friendly";
911
+ tone: "reminder" | "friendly" | "promotional" | "informational" | "greeting";
949
912
  usedVariables: string[];
950
913
  suggestions?: string[] | undefined;
951
914
  }>;
@@ -981,4 +944,39 @@ declare const activityNotificationSchema: z.ZodObject<{
981
944
  type ActivityNotificationGenerationRequest = z.infer<typeof activityNotificationGenerationRequestSchema>;
982
945
  type ActivityNotification = z.infer<typeof activityNotificationSchema>;
983
946
 
984
- export { ACTIVITY_EVENTS, ACTIVITY_MESSAGE_VARIABLES, type AIGeneratedTemplate, type AcceptInvitationDto, type ActivityItem, type ActivityNotification, type ActivityNotificationGenerationRequest, type ActivityQueryParams, AssetCategory, AssetStatus, type AuditFields, BULK_MESSAGE_VARIABLES, BULK_MESSAGE_VARIABLE_CATEGORIES, BULK_MESSAGING_EVENTS, type BirthdayTemplateData, type BulkMessage, type BulkMessageGenerationRequest, type BulkMessageVariable, CACHE_TTL, CancellationReason, ClientStatus, type Collaborator, type CollaboratorStats, CollaboratorStatus, ContractAssetType, ContractStatus, type CreateInvitationDto, type Currency, DATE_FORMATS, type EntityType, FILE_LIMITS, type GenerateBulkMessageEvent, HEADERS, type ICollaborator, type IGym, type IOrganization, type IRequestContext, type IRole, type ISubscription, type ISubscriptionPlan, type IUser, type Invitation, InvitationStatus, type ListCollaboratorsParams, type MembershipExpiringTemplateData, type MembershipPurchaseTemplateData, type MembershipRenewalTemplateData, PAGINATION_DEFAULTS, PERMISSIONS, type PaginatedResponse, type PaginationMeta, type PaginationParams, PaymentFrequency, type PaymentReceiptTemplateData, type PaymentReminderTemplateData, type Permission, PlanStatus, PlanType, ROLE_NAMES, ROLE_PERMISSIONS, type Role, type RoleName, RoleNames, type SendActivityNotificationEvent, type SendBulkMessagesEvent, type StatsQueryParams, SubscriptionStatus, SuspensionType, TEMPLATE_CODES, TEMPLATE_METADATA, TemplateCode, type TemplateGenerationRequest, type TemplateMetadata, TemplateType, type UUID, type UpdateCollaboratorDto, type UpdateCollaboratorRoleDto, type UpdateCollaboratorStatusDto, type User, UserType, type ValidateByCodeDto, WHATSAPP_EVENTS, WHATSAPP_TEMPLATE_EVENTS, type WelcomeTemplateData, type WhatsAppMessageSendEventData, type WhatsAppTemplateData, type WhatsAppTemplateEventData, activityNotificationGenerationRequestSchema, activityNotificationSchema, aiGeneratedTemplateSchema, bulkMessageGenerationRequestSchema, bulkMessageSchema, canAccessFeature, getRoleCapabilities, getRoleDescription, getRoleDisplayName, isAdminRole, isEncargadoRole, templateGenerationRequestSchema };
947
+ declare enum RoleNames {
948
+ ADMIN = "Admin",
949
+ ENCARGADO = "Encargado",
950
+ OWNER = "OWNER"
951
+ }
952
+ declare const ROLE_NAMES: typeof RoleNames;
953
+ type RoleName = RoleNames;
954
+ declare function isAdminRole(roleName: string | null | undefined): boolean;
955
+ declare function isEncargadoRole(roleName: string | null | undefined): boolean;
956
+ declare function canAccessFeature(userRole: string | null | undefined, allowedRoles: string[] | RoleNames[]): boolean;
957
+ declare function getRoleDisplayName(roleName: string | null | undefined): string;
958
+ declare function getRoleDescription(roleName: string | null | undefined): string;
959
+ declare function getRoleCapabilities(roleName: string | null | undefined): string[];
960
+
961
+ /**
962
+ * Simple phone number utilities for WhatsApp Evolution API
963
+ */
964
+ /**
965
+ * Normalizes a phone number for Evolution API
966
+ * Adds country code +51 for Peru if missing and ensures + prefix
967
+ *
968
+ * @param phoneNumber - Phone number in various formats
969
+ * @returns Normalized phone number with + prefix
970
+ *
971
+ * Examples:
972
+ * - "987654321" -> "+51987654321"
973
+ * - "51987654321" -> "+51987654321"
974
+ * - "+51987654321" -> "+51987654321"
975
+ */
976
+ declare function normalizePhoneForEvolution(phoneNumber: string): string;
977
+ /**
978
+ * Validates if a phone number is valid for Peru
979
+ */
980
+ declare function isValidPeruvianPhone(phoneNumber: string): boolean;
981
+
982
+ export { ACTIVITY_EVENTS, ACTIVITY_MESSAGE_VARIABLES, type AIGeneratedTemplate, type AcceptInvitationDto, type ActivityItem, type ActivityNotification, type ActivityNotificationGenerationRequest, type ActivityQueryParams, AssetCategory, AssetStatus, type AuditFields, BULK_MESSAGE_VARIABLES, BULK_MESSAGE_VARIABLE_CATEGORIES, BULK_MESSAGING_EVENTS, type BirthdayTemplateData, type BulkMessage, type BulkMessageEventData, type BulkMessageGenerationRequest, type BulkMessageVariable, CACHE_TTL, CancellationReason, ClientStatus, type Collaborator, type CollaboratorStats, CollaboratorStatus, ContractAssetType, ContractStatus, type CreateInvitationDto, type Currency, DATE_FORMATS, type EntityType, FILE_LIMITS, HEADERS, type ICollaborator, type IGym, type IOrganization, type IRequestContext, type IRole, type ISubscription, type ISubscriptionPlan, type IUser, type Invitation, InvitationStatus, type ListCollaboratorsParams, type MembershipExpiringTemplateData, type MembershipPurchaseTemplateData, type MembershipRenewalTemplateData, PAGINATION_DEFAULTS, PERMISSIONS, type PaginatedResponse, type PaginationMeta, type PaginationParams, PaymentFrequency, type PaymentReceiptTemplateData, type PaymentReminderTemplateData, type Permission, PlanStatus, PlanType, ROLE_NAMES, ROLE_PERMISSIONS, type Role, type RoleName, RoleNames, type SendActivityNotificationEvent, type SendBulkMessagesEvent, type StatsQueryParams, SubscriptionStatus, SuspensionType, TEMPLATE_CODES, TEMPLATE_METADATA, TemplateCode, type TemplateGenerationRequest, type TemplateMetadata, TemplateType, type UUID, type UpdateCollaboratorDto, type UpdateCollaboratorRoleDto, type UpdateCollaboratorStatusDto, type User, UserType, VARIABLE_CONTEXT_MAP, type ValidateByCodeDto, type VariableContextType, WHATSAPP_EVENTS, WHATSAPP_TEMPLATE_EVENTS, type WelcomeTemplateData, type WhatsAppMessageSendEventData, type WhatsAppTemplateData, type WhatsAppTemplateEventData, activityNotificationGenerationRequestSchema, activityNotificationSchema, aiGeneratedTemplateSchema, bulkMessageGenerationRequestSchema, bulkMessageSchema, canAccessFeature, getRoleCapabilities, getRoleDescription, getRoleDisplayName, getVariablesByContext, isAdminRole, isEncargadoRole, isValidPeruvianPhone, normalizePhoneForEvolution, templateGenerationRequestSchema, validateVariablesInContext };