@gymspace/shared 1.2.12 → 1.2.14
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 +194 -6
- package/dist/index.d.ts +194 -6
- package/dist/index.js +216 -0
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +209 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/constants/bulk-message-variables.ts +164 -0
- package/src/constants.ts +16 -0
- package/src/enums.ts +20 -2
- package/src/events/activity.events.ts +48 -0
- package/src/events/bulk-messaging.events.ts +56 -0
- package/src/events/index.ts +2 -0
- package/src/index.ts +4 -0
- package/src/schemas/bulk-message.schema.ts +24 -0
- package/src/schemas/index.ts +1 -0
- package/src/types.ts +12 -1
package/src/enums.ts
CHANGED
|
@@ -42,6 +42,26 @@ export enum ContractStatus {
|
|
|
42
42
|
EXPIRED = 'expired',
|
|
43
43
|
CANCELLED = 'cancelled',
|
|
44
44
|
FOR_RENEW = 'for_renew',
|
|
45
|
+
SUSPENDED = 'suspended',
|
|
46
|
+
GRACE_PERIOD = 'grace_period',
|
|
47
|
+
TERMINATED = 'terminated',
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export 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
|
+
|
|
60
|
+
export enum SuspensionType {
|
|
61
|
+
VACATION = 'vacation',
|
|
62
|
+
MEDICAL = 'medical',
|
|
63
|
+
FINANCIAL = 'financial',
|
|
64
|
+
OTHER = 'other',
|
|
45
65
|
}
|
|
46
66
|
|
|
47
67
|
export enum PaymentFrequency {
|
|
@@ -55,7 +75,6 @@ export enum AssetStatus {
|
|
|
55
75
|
DELETED = 'deleted',
|
|
56
76
|
}
|
|
57
77
|
|
|
58
|
-
|
|
59
78
|
export enum AssetCategory {
|
|
60
79
|
MEDICAL_DOCUMENT = 'medical_document',
|
|
61
80
|
IDENTIFICATION = 'identification',
|
|
@@ -70,4 +89,3 @@ export enum ContractAssetType {
|
|
|
70
89
|
IDENTIFICATION = 'identification',
|
|
71
90
|
OTHER = 'other',
|
|
72
91
|
}
|
|
73
|
-
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
export const ACTIVITY_EVENTS = {
|
|
2
|
+
SEND_ACTIVITY_NOTIFICATION: 'activity/notification.send',
|
|
3
|
+
} as const;
|
|
4
|
+
|
|
5
|
+
export interface SendActivityNotificationEvent {
|
|
6
|
+
name: typeof ACTIVITY_EVENTS.SEND_ACTIVITY_NOTIFICATION;
|
|
7
|
+
data: {
|
|
8
|
+
activityId: string;
|
|
9
|
+
notificationId: string;
|
|
10
|
+
gymId: string;
|
|
11
|
+
userId: string;
|
|
12
|
+
instanceName: string;
|
|
13
|
+
message: string;
|
|
14
|
+
clients: Array<{
|
|
15
|
+
clientId: string;
|
|
16
|
+
clientName: string;
|
|
17
|
+
phoneNumber: string;
|
|
18
|
+
data: {
|
|
19
|
+
id: string;
|
|
20
|
+
name: string;
|
|
21
|
+
email?: string;
|
|
22
|
+
phone: string;
|
|
23
|
+
activePlan?: {
|
|
24
|
+
name: string;
|
|
25
|
+
expirationDate?: Date;
|
|
26
|
+
amount?: number;
|
|
27
|
+
};
|
|
28
|
+
membershipStatus?: string;
|
|
29
|
+
metadata?: Record<string, any>;
|
|
30
|
+
};
|
|
31
|
+
}>;
|
|
32
|
+
gymData: {
|
|
33
|
+
name: string;
|
|
34
|
+
phone?: string;
|
|
35
|
+
address?: string;
|
|
36
|
+
countryConfig: {
|
|
37
|
+
currency: string;
|
|
38
|
+
locale: string;
|
|
39
|
+
};
|
|
40
|
+
};
|
|
41
|
+
activityData: {
|
|
42
|
+
name: string;
|
|
43
|
+
startDateTime: Date;
|
|
44
|
+
durationMinutes: number;
|
|
45
|
+
location: string;
|
|
46
|
+
};
|
|
47
|
+
};
|
|
48
|
+
}
|
|
@@ -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
|
+
}
|
package/src/events/index.ts
CHANGED
package/src/index.ts
CHANGED
|
@@ -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>;
|
package/src/schemas/index.ts
CHANGED
package/src/types.ts
CHANGED
|
@@ -70,7 +70,18 @@ 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'
|
|
76
|
+
| 'ACTIVITIES_CREATE'
|
|
77
|
+
| 'ACTIVITIES_READ'
|
|
78
|
+
| 'ACTIVITIES_UPDATE'
|
|
79
|
+
| 'ACTIVITIES_DELETE'
|
|
80
|
+
| 'ACTIVITIES_MANAGE_NOTIFICATIONS'
|
|
81
|
+
| 'TAGS_CREATE'
|
|
82
|
+
| 'TAGS_READ'
|
|
83
|
+
| 'TAGS_UPDATE'
|
|
84
|
+
| 'TAGS_DELETE';
|
|
74
85
|
|
|
75
86
|
export interface AuditFields {
|
|
76
87
|
createdByUserId: UUID;
|