@gymspace/shared 1.2.11 → 1.2.13

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.
@@ -0,0 +1,164 @@
1
+ export interface BulkMessageVariable {
2
+ name: string;
3
+ placeholder: string;
4
+ description: string;
5
+ example: string;
6
+ category: 'client' | 'gym' | 'membership' | 'datetime' | 'custom';
7
+ required: boolean;
8
+ formatter?: 'text' | 'currency' | 'date' | 'number';
9
+ }
10
+
11
+ export const BULK_MESSAGE_VARIABLES: BulkMessageVariable[] = [
12
+ // Variables de Cliente
13
+ {
14
+ name: 'clientName',
15
+ placeholder: '{{clientName}}',
16
+ description: 'Nombre completo del cliente',
17
+ example: 'Juan Pérez',
18
+ category: 'client',
19
+ required: false,
20
+ formatter: 'text',
21
+ },
22
+ {
23
+ name: 'clientEmail',
24
+ placeholder: '{{clientEmail}}',
25
+ description: 'Email del cliente',
26
+ example: 'juan@example.com',
27
+ category: 'client',
28
+ required: false,
29
+ formatter: 'text',
30
+ },
31
+ {
32
+ name: 'clientPhone',
33
+ placeholder: '{{clientPhone}}',
34
+ description: 'Teléfono del cliente',
35
+ example: '+51 999 999 999',
36
+ category: 'client',
37
+ required: false,
38
+ formatter: 'text',
39
+ },
40
+
41
+ // Variables de Gimnasio
42
+ {
43
+ name: 'gymName',
44
+ placeholder: '{{gymName}}',
45
+ description: 'Nombre del gimnasio',
46
+ example: 'Gym Fitness',
47
+ category: 'gym',
48
+ required: false,
49
+ formatter: 'text',
50
+ },
51
+ {
52
+ name: 'gymPhone',
53
+ placeholder: '{{gymPhone}}',
54
+ description: 'Teléfono del gimnasio',
55
+ example: '+51 999 888 777',
56
+ category: 'gym',
57
+ required: false,
58
+ formatter: 'text',
59
+ },
60
+ {
61
+ name: 'gymAddress',
62
+ placeholder: '{{gymAddress}}',
63
+ description: 'Dirección del gimnasio',
64
+ example: 'Av. Principal 123',
65
+ category: 'gym',
66
+ required: false,
67
+ formatter: 'text',
68
+ },
69
+
70
+ // Variables de Membresía
71
+ {
72
+ name: 'planName',
73
+ placeholder: '{{planName}}',
74
+ description: 'Nombre del plan de membresía',
75
+ example: 'Plan Premium',
76
+ category: 'membership',
77
+ required: false,
78
+ formatter: 'text',
79
+ },
80
+ {
81
+ name: 'membershipStatus',
82
+ placeholder: '{{membershipStatus}}',
83
+ description: 'Estado de la membresía',
84
+ example: 'Activa',
85
+ category: 'membership',
86
+ required: false,
87
+ formatter: 'text',
88
+ },
89
+ {
90
+ name: 'daysUntilExpiration',
91
+ placeholder: '{{daysUntilExpiration}}',
92
+ description: 'Días restantes hasta vencimiento',
93
+ example: '15',
94
+ category: 'membership',
95
+ required: false,
96
+ formatter: 'number',
97
+ },
98
+ {
99
+ name: 'expirationDate',
100
+ placeholder: '{{expirationDate}}',
101
+ description: 'Fecha de vencimiento',
102
+ example: '31/12/2024',
103
+ category: 'membership',
104
+ required: false,
105
+ formatter: 'date',
106
+ },
107
+ {
108
+ name: 'amount',
109
+ placeholder: '{{amount}}',
110
+ description: 'Monto con formato de moneda',
111
+ example: 'S/ 150.00',
112
+ category: 'membership',
113
+ required: false,
114
+ formatter: 'currency',
115
+ },
116
+
117
+ // Variables de Fecha/Hora
118
+ {
119
+ name: 'date',
120
+ placeholder: '{{date}}',
121
+ description: 'Fecha actual',
122
+ example: '15/10/2024',
123
+ category: 'datetime',
124
+ required: false,
125
+ formatter: 'date',
126
+ },
127
+ {
128
+ name: 'time',
129
+ placeholder: '{{time}}',
130
+ description: 'Hora actual',
131
+ example: '14:30',
132
+ category: 'datetime',
133
+ required: false,
134
+ formatter: 'text',
135
+ },
136
+ {
137
+ name: 'dayOfWeek',
138
+ placeholder: '{{dayOfWeek}}',
139
+ description: 'Día de la semana',
140
+ example: 'Lunes',
141
+ category: 'datetime',
142
+ required: false,
143
+ formatter: 'text',
144
+ },
145
+
146
+ // Variables Personalizadas
147
+ {
148
+ name: 'customField',
149
+ placeholder: '{{customField}}',
150
+ description: 'Campo personalizado del cliente',
151
+ example: 'Valor personalizado',
152
+ category: 'custom',
153
+ required: false,
154
+ formatter: 'text',
155
+ },
156
+ ];
157
+
158
+ export const BULK_MESSAGE_VARIABLE_CATEGORIES = {
159
+ client: 'Cliente',
160
+ gym: 'Gimnasio',
161
+ membership: 'Membresía',
162
+ datetime: 'Fecha/Hora',
163
+ custom: 'Personalizado',
164
+ } as const;
package/src/constants.ts CHANGED
@@ -86,6 +86,8 @@ export const PERMISSIONS = {
86
86
  WHATSAPP_READ: 'WHATSAPP_READ',
87
87
  WHATSAPP_SEND: 'WHATSAPP_SEND',
88
88
  WHATSAPP_MANAGE: 'WHATSAPP_MANAGE',
89
+ WHATSAPP_BULK_SEND: 'WHATSAPP_BULK_SEND',
90
+ WHATSAPP_BULK_MANAGE: 'WHATSAPP_BULK_MANAGE',
89
91
 
90
92
  // Special permissions
91
93
  SUPER_ADMIN: 'SUPER_ADMIN',
@@ -174,3 +176,4 @@ export const HEADERS = {
174
176
 
175
177
  // Re-export template constants
176
178
  export * from './constants/template-codes.constants';
179
+ export * from './constants/bulk-message-variables';
@@ -0,0 +1,56 @@
1
+ export const BULK_MESSAGING_EVENTS = {
2
+ GENERATE_BULK_MESSAGE: 'whatsapp/bulk-message.generate',
3
+ SEND_BULK_MESSAGES: 'whatsapp/bulk-messages.send',
4
+ } as const;
5
+
6
+ export interface GenerateBulkMessageEvent {
7
+ name: typeof BULK_MESSAGING_EVENTS.GENERATE_BULK_MESSAGE;
8
+ data: {
9
+ gymId: string;
10
+ userId: string;
11
+ prompt: string;
12
+ includeVariables?: string[];
13
+ tone?: 'promotional' | 'informational' | 'reminder' | 'greeting' | 'custom' | 'friendly';
14
+ language?: string;
15
+ additionalRequirements?: string;
16
+ };
17
+ }
18
+
19
+ export interface SendBulkMessagesEvent {
20
+ name: typeof BULK_MESSAGING_EVENTS.SEND_BULK_MESSAGES;
21
+ data: {
22
+ sendId: string;
23
+ gymId: string;
24
+ userId: string;
25
+ instanceName: string;
26
+ templateId?: string;
27
+ message: string;
28
+ clients: Array<{
29
+ clientId: string;
30
+ clientName: string;
31
+ phoneNumber: string;
32
+ data: {
33
+ id: string;
34
+ name: string;
35
+ email?: string;
36
+ phone: string;
37
+ activePlan?: {
38
+ name: string;
39
+ expirationDate?: Date;
40
+ amount?: number;
41
+ };
42
+ membershipStatus?: string;
43
+ metadata?: Record<string, any>;
44
+ };
45
+ }>;
46
+ gymData: {
47
+ name: string;
48
+ phone?: string;
49
+ address?: string;
50
+ countryConfig: {
51
+ currency: string;
52
+ locale: string;
53
+ };
54
+ };
55
+ };
56
+ }
@@ -1 +1,2 @@
1
1
  export * from './whatsapp.events';
2
+ export * from './bulk-messaging.events';
package/src/index.ts CHANGED
@@ -5,3 +5,7 @@ export * from './constants';
5
5
  export * from './utils/roleHelpers';
6
6
  export * from './events';
7
7
  export * from './schemas';
8
+
9
+ // Bulk Messaging
10
+ export * from './constants/bulk-message-variables';
11
+ export * from './events/bulk-messaging.events';
@@ -0,0 +1,24 @@
1
+ import { z } from 'zod';
2
+
3
+ export const bulkMessageGenerationRequestSchema = z.object({
4
+ prompt: z.string().describe('Prompt or context for message generation'),
5
+ tone: z
6
+ .enum(['promotional', 'informational', 'reminder', 'greeting', 'friendly'])
7
+ .optional()
8
+ .describe('Tone of the message'),
9
+ includeVariables: z.array(z.string()).optional().describe('Variables to include in the message'),
10
+ additionalRequirements: z.string().optional().describe('Additional requirements for the message'),
11
+ language: z.string().default('es').describe('Language for generation'),
12
+ });
13
+
14
+ export const bulkMessageSchema = z.object({
15
+ message: z.string().describe('Generated message with variables'),
16
+ tone: z
17
+ .enum(['promotional', 'informational', 'reminder', 'greeting', 'friendly'])
18
+ .describe('Tone of the message'),
19
+ usedVariables: z.array(z.string()).describe('Variables used in the message'),
20
+ suggestions: z.array(z.string()).optional().describe('Additional message suggestions'),
21
+ });
22
+
23
+ export type BulkMessageGenerationRequest = z.infer<typeof bulkMessageGenerationRequestSchema>;
24
+ export type BulkMessage = z.infer<typeof bulkMessageSchema>;
@@ -1 +1,2 @@
1
1
  export * from './ai-template.schema';
2
+ export * from './bulk-message.schema';
package/src/types.ts CHANGED
@@ -70,7 +70,9 @@ export type Permission =
70
70
  | 'PAYMENT_METHODS_DELETE'
71
71
  | 'WHATSAPP_READ'
72
72
  | 'WHATSAPP_SEND'
73
- | 'WHATSAPP_MANAGE';
73
+ | 'WHATSAPP_MANAGE'
74
+ | 'WHATSAPP_BULK_SEND'
75
+ | 'WHATSAPP_BULK_MANAGE';
74
76
 
75
77
  export interface AuditFields {
76
78
  createdByUserId: UUID;