@gymspace/shared 1.2.22 → 1.3.1

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