@gymspace/sdk 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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gymspace/sdk",
3
- "version": "1.2.12",
3
+ "version": "1.2.14",
4
4
  "description": "GymSpace TypeScript SDK for API integration",
5
5
  "author": "GymSpace Team",
6
6
  "license": "MIT",
@@ -0,0 +1,139 @@
1
+ export interface CreateActivityDto {
2
+ name: string;
3
+ description?: string;
4
+ imageId?: string;
5
+ startDateTime: string;
6
+ durationMinutes: number;
7
+ maxParticipants?: number;
8
+ recurrenceType?: 'daily' | 'weekly' | 'monthly';
9
+ recurrenceEndDate?: string;
10
+ planRestrictions?: string[];
11
+ }
12
+
13
+ export interface UpdateActivityDto {
14
+ name?: string;
15
+ description?: string;
16
+ imageId?: string;
17
+ startDateTime?: string;
18
+ durationMinutes?: number;
19
+ maxParticipants?: number;
20
+ recurrenceType?: 'daily' | 'weekly' | 'monthly';
21
+ recurrenceEndDate?: string;
22
+ planRestrictions?: string[];
23
+ isActive?: boolean;
24
+ }
25
+
26
+ export interface Activity {
27
+ id: string;
28
+ gymId: string;
29
+ name: string;
30
+ description?: string;
31
+ imageId?: string;
32
+ startDateTime: string;
33
+ durationMinutes: number;
34
+ maxParticipants?: number;
35
+ recurrenceType?: 'daily' | 'weekly' | 'monthly';
36
+ recurrenceEndDate?: string;
37
+ isActive: boolean;
38
+ planRestrictions: ActivityPlanRestriction[];
39
+ notifications?: ActivityNotification[];
40
+ createdByUserId: string;
41
+ updatedByUserId?: string;
42
+ createdAt: string;
43
+ updatedAt: string;
44
+ deletedAt?: string;
45
+ }
46
+
47
+ export interface ActivityPlanRestriction {
48
+ id: string;
49
+ membershipPlanId: string;
50
+ membershipPlan: {
51
+ id: string;
52
+ name: string;
53
+ };
54
+ }
55
+
56
+ export interface SearchActivitiesParams {
57
+ page?: number;
58
+ limit?: number;
59
+ search?: string;
60
+ startDate?: string;
61
+ endDate?: string;
62
+ recurrenceType?: 'daily' | 'weekly' | 'monthly';
63
+ planId?: string;
64
+ isActive?: boolean;
65
+ }
66
+
67
+ export interface CreateActivityNotificationDto {
68
+ templateId?: string;
69
+ customMessage?: string;
70
+ advanceTimeMinutes: number;
71
+ }
72
+
73
+ export interface UpdateActivityNotificationDto {
74
+ templateId?: string;
75
+ customMessage?: string;
76
+ advanceTimeMinutes?: number;
77
+ isActive?: boolean;
78
+ }
79
+
80
+ export interface ActivityNotification {
81
+ id: string;
82
+ activityId: string;
83
+ templateId?: string;
84
+ customMessage?: string;
85
+ advanceTimeMinutes: number;
86
+ isActive: boolean;
87
+ template?: {
88
+ id: string;
89
+ name: string;
90
+ message: string;
91
+ };
92
+ sentNotifications?: SentActivityNotification[];
93
+ createdByUserId: string;
94
+ createdAt: string;
95
+ updatedAt: string;
96
+ }
97
+
98
+ export interface SentActivityNotification {
99
+ id: string;
100
+ sendId: string;
101
+ recipientsCount: number;
102
+ sentAt: string;
103
+ status: string;
104
+ }
105
+
106
+ export interface ActivityStats {
107
+ totalActivities: number;
108
+ activeActivities: number;
109
+ upcomingActivities: number;
110
+ totalNotificationsSent: number;
111
+ notificationsByActivity: {
112
+ activityId: string;
113
+ activityName: string;
114
+ notificationsSent: number;
115
+ lastSentAt: string;
116
+ }[];
117
+ }
118
+
119
+ export interface ActivityStatsParams {
120
+ startDate?: string;
121
+ endDate?: string;
122
+ }
123
+
124
+ export interface EligibleClient {
125
+ id: string;
126
+ name: string;
127
+ phone: string;
128
+ email: string;
129
+ planName: string;
130
+ }
131
+
132
+ export interface EligibleClientsResponse {
133
+ total: number;
134
+ clients: EligibleClient[];
135
+ }
136
+
137
+ export interface DeleteActivityParams {
138
+ deleteRecurrence?: boolean;
139
+ }
@@ -0,0 +1,119 @@
1
+ export interface BulkTemplate {
2
+ id: string;
3
+ gymId: string;
4
+ name: string;
5
+ message: string;
6
+ description?: string;
7
+ tags: string[];
8
+ isActive: boolean;
9
+ usageCount: number;
10
+ lastUsedAt?: Date;
11
+ createdByUserId: string;
12
+ createdAt: Date;
13
+ updatedAt: Date;
14
+ }
15
+
16
+ export interface CreateBulkTemplateDto {
17
+ name: string;
18
+ message: string;
19
+ description?: string;
20
+ tags?: string[];
21
+ isActive?: boolean;
22
+ }
23
+
24
+ export interface UpdateBulkTemplateDto {
25
+ name?: string;
26
+ message?: string;
27
+ description?: string;
28
+ tags?: string[];
29
+ isActive?: boolean;
30
+ }
31
+
32
+ export interface BulkMessageVariable {
33
+ name: string;
34
+ placeholder: string;
35
+ description: string;
36
+ example: string;
37
+ category: 'client' | 'gym' | 'membership' | 'datetime' | 'custom';
38
+ required: boolean;
39
+ formatter?: 'text' | 'currency' | 'date' | 'number';
40
+ }
41
+
42
+ // DTO for sending bulk messages
43
+ // Note: SDK sends clientIds, API fetches full client and gym data before sending to agent
44
+
45
+ export interface SendBulkMessagesDto {
46
+ templateId?: string;
47
+ message: string;
48
+ clientIds: string[];
49
+ }
50
+
51
+ export interface RejectedClientDto {
52
+ clientId: string;
53
+ reason: string;
54
+ }
55
+
56
+ export interface BulkMessageResultDto {
57
+ sendId: string;
58
+ totalRecipients: number;
59
+ accepted: number;
60
+ rejected: number;
61
+ rejectedReasons: RejectedClientDto[];
62
+ estimatedTime: number;
63
+ }
64
+
65
+ // Legacy aliases for backward compatibility
66
+ export type RejectedClient = RejectedClientDto;
67
+ export type BulkMessageResult = BulkMessageResultDto;
68
+
69
+ export interface BulkMessageLogDto {
70
+ sendId: string;
71
+ clientId: string;
72
+ clientName: string;
73
+ phoneNumber: string;
74
+ message: string;
75
+ status: 'pending' | 'queued' | 'sent' | 'delivered' | 'failed';
76
+ sentAt?: string;
77
+ deliveredAt?: string;
78
+ failedAt?: string;
79
+ failureReason?: string;
80
+ retryCount: number;
81
+ timestamp: string;
82
+ }
83
+
84
+ export interface GetBulkLogsQueryDto {
85
+ sendId: string;
86
+ }
87
+
88
+ export interface BulkLogsResponseDto {
89
+ sendId: string;
90
+ totalRecipients: number;
91
+ sent: number;
92
+ delivered: number;
93
+ failed: number;
94
+ pending: number;
95
+ logs: BulkMessageLogDto[];
96
+ isComplete: boolean;
97
+ }
98
+
99
+ // Legacy aliases for backward compatibility
100
+ export type BulkMessageLog = BulkMessageLogDto;
101
+ export type BulkLogsResponse = BulkLogsResponseDto;
102
+
103
+ export interface GenerateAIMessageDto {
104
+ prompt: string;
105
+ tone?: 'promotional' | 'informational' | 'reminder' | 'greeting' | 'custom' | 'friendly';
106
+ includeVariables?: string[];
107
+ additionalRequirements?: string;
108
+ }
109
+
110
+ export interface GenerateAIMessageResponseDto {
111
+ message: string;
112
+ variables: string[];
113
+ tone: string;
114
+ suggestions?: string[];
115
+ }
116
+
117
+ // Legacy aliases for backward compatibility
118
+ export type GenerateAIMessageParams = GenerateAIMessageDto;
119
+ export type GenerateAIMessageResponse = GenerateAIMessageResponseDto;
@@ -14,6 +14,9 @@ export interface CreateClientDto {
14
14
  occupation?: string;
15
15
  notes?: string;
16
16
  profilePhotoId?: string;
17
+ emergencyContactName?: string;
18
+ emergencyContactPhone?: string;
19
+ medicalConditions?: string;
17
20
  customData?: Record<string, any>;
18
21
  }
19
22
 
@@ -33,6 +36,9 @@ export interface UpdateClientDto {
33
36
  occupation?: string;
34
37
  notes?: string;
35
38
  profilePhotoId?: string;
39
+ emergencyContactName?: string;
40
+ emergencyContactPhone?: string;
41
+ medicalConditions?: string;
36
42
  customData?: Record<string, any>;
37
43
  }
38
44
 
@@ -124,7 +130,6 @@ export interface ClientStats {
124
130
 
125
131
  export interface SearchClientsParams {
126
132
  search?: string;
127
- activeOnly?: boolean;
128
133
  clientNumber?: string;
129
134
  documentId?: string;
130
135
  includeContractStatus?: boolean;
@@ -1,6 +1,24 @@
1
1
  import { ContractStatus } from '@gymspace/shared';
2
2
  import { PaginationQueryDto } from '../types';
3
3
 
4
+ // TODO: Import from @gymspace/shared once type resolution is fixed
5
+ export enum CancellationReason {
6
+ PRICE_TOO_HIGH = 'PRICE_TOO_HIGH',
7
+ NOT_USING_SERVICE = 'NOT_USING_SERVICE',
8
+ MOVING_LOCATION = 'MOVING_LOCATION',
9
+ FINANCIAL_ISSUES = 'FINANCIAL_ISSUES',
10
+ SERVICE_DISSATISFACTION = 'SERVICE_DISSATISFACTION',
11
+ TEMPORARY_BREAK = 'TEMPORARY_BREAK',
12
+ OTHER = 'OTHER',
13
+ }
14
+
15
+ export enum SuspensionType {
16
+ VACATION = 'vacation',
17
+ MEDICAL = 'medical',
18
+ FINANCIAL = 'financial',
19
+ OTHER = 'other',
20
+ }
21
+
4
22
  export interface CreateContractDto {
5
23
  gymClientId: string;
6
24
  gymMembershipPlanId: string;
@@ -30,6 +48,36 @@ export interface FreezeContractDto {
30
48
  reason?: string;
31
49
  }
32
50
 
51
+ export interface CancelContractDto {
52
+ reason: CancellationReason;
53
+ detailedFeedback?: string;
54
+ offeredAlternatives?: boolean;
55
+ wouldRecommend?: boolean;
56
+ satisfactionScore?: number;
57
+ }
58
+
59
+ export interface SuspendContractDto {
60
+ suspensionType: SuspensionType;
61
+ startDate: string;
62
+ endDate?: string;
63
+ reason?: string;
64
+ maintainBenefits?: boolean;
65
+ autoReactivate?: boolean;
66
+ }
67
+
68
+ export interface ResumeContractDto {
69
+ resumeDate?: string;
70
+ notes?: string;
71
+ }
72
+
73
+ export interface ReactivateContractDto {
74
+ newPlanId?: string;
75
+ startDate: string;
76
+ applyWinBackOffer?: boolean;
77
+ paymentMethodId: string;
78
+ notes?: string;
79
+ }
80
+
33
81
  export interface Contract {
34
82
  id: string;
35
83
  gymId: string;
@@ -41,35 +89,71 @@ export interface Contract {
41
89
  startDate: string;
42
90
  endDate: string;
43
91
  status: ContractStatus;
44
- price: number;
45
- discountPercentage?: number;
46
- finalAmount: number;
47
- freezeStartDate?: string;
48
- freezeEndDate?: string;
92
+ basePrice: string;
93
+ customPrice?: string | null;
94
+ finalAmount: string;
95
+ currency: string;
96
+ discountPercentage?: number | null;
97
+ discountAmount?: string | null;
98
+ paymentFrequency: string;
99
+ notes?: string | null;
100
+ termsAndConditions?: string | null;
101
+ freezeStartDate?: string | null;
102
+ freezeEndDate?: string | null;
103
+ contractDocumentId?: string | null;
104
+ paymentReceiptIds?: string[] | null;
49
105
  receiptIds?: string[];
50
106
  metadata?: Record<string, any>;
107
+ createdByUserId?: string;
108
+ updatedByUserId?: string | null;
109
+ approvedByUserId?: string | null;
110
+ approvedAt?: string | null;
111
+ cancelledByUserId?: string | null;
112
+ cancelledAt?: string | null;
51
113
  createdAt: string;
52
114
  updatedAt: string;
115
+ deletedAt?: string | null;
53
116
  // Relations
54
117
  gymClient?: {
55
118
  id: string;
56
119
  name: string;
57
- email: string;
120
+ email: string | null;
121
+ phone?: string;
122
+ gym?: {
123
+ id: string;
124
+ name: string;
125
+ };
58
126
  };
59
127
  gymMembershipPlan?: {
60
128
  id: string;
129
+ gymId: string;
61
130
  name: string;
62
- basePrice?: number;
63
- durationMonths?: number;
131
+ basePrice: string;
132
+ durationMonths?: number | null;
133
+ durationDays?: number | null;
134
+ description?: string;
135
+ features?: string[];
136
+ termsAndConditions?: string;
137
+ allowsCustomPricing?: boolean;
138
+ includesAdvisor?: boolean;
139
+ showInCatalog?: boolean;
140
+ assetsIds?: string[];
141
+ status?: string;
64
142
  };
65
143
  paymentMethod?: {
66
144
  id: string;
145
+ organizationId: string;
67
146
  name: string;
68
147
  description?: string;
69
148
  code: string;
70
149
  enabled: boolean;
150
+ metadata?: Record<string, any>;
71
151
  };
72
152
  renewals?: Contract[]; // Renewal contracts for this contract
153
+ createdBy?: {
154
+ id: string;
155
+ email: string;
156
+ };
73
157
  }
74
158
 
75
159
  export interface GetContractsParams extends PaginationQueryDto {
@@ -80,4 +164,38 @@ export interface GetContractsParams extends PaginationQueryDto {
80
164
  startDateTo?: string;
81
165
  endDateFrom?: string;
82
166
  endDateTo?: string;
83
- }
167
+ }
168
+
169
+ export interface ContractLifecycleEvent {
170
+ id: string;
171
+ contractId: string;
172
+ eventType: string;
173
+ previousStatus?: string;
174
+ newStatus?: string;
175
+ reason?: string;
176
+ metadata?: Record<string, any>;
177
+ createdAt: string;
178
+ createdBy?: {
179
+ id: string;
180
+ name: string;
181
+ email: string;
182
+ };
183
+ }
184
+
185
+ export interface CancellationAnalytics {
186
+ total: number;
187
+ reasonBreakdown: Record<string, number>;
188
+ averageSatisfaction: number | null;
189
+ recommendationRate: number;
190
+ feedbacks: Array<{
191
+ id: string;
192
+ contractId: string;
193
+ contractNumber: string;
194
+ clientName: string;
195
+ reason: string;
196
+ detailedFeedback?: string;
197
+ satisfactionScore?: number;
198
+ wouldRecommend?: boolean;
199
+ createdAt: string;
200
+ }>;
201
+ }
@@ -6,11 +6,10 @@ export interface CreateGymDto {
6
6
  postalCode?: string;
7
7
  phone?: string;
8
8
  email?: string;
9
- openingTime?: string;
10
- closingTime?: string;
11
9
  capacity?: number;
12
10
  amenities?: GymAmenities;
13
11
  settings?: GymSettings;
12
+ schedule?: GymSchedule;
14
13
  }
15
14
 
16
15
  export interface UpdateGymDto {
@@ -21,11 +20,10 @@ export interface UpdateGymDto {
21
20
  postalCode?: string;
22
21
  phone?: string;
23
22
  email?: string;
24
- openingTime?: string;
25
- closingTime?: string;
26
23
  capacity?: number;
27
24
  amenities?: GymAmenities;
28
25
  settings?: GymSettings;
26
+ schedule?: GymSchedule;
29
27
  }
30
28
 
31
29
  export interface GymAmenities {
@@ -36,11 +34,49 @@ export interface GymAmenities {
36
34
  }
37
35
 
38
36
  export interface GymSettings {
37
+ inventory?: InventorySettings;
38
+ contracts?: ContractSettings;
39
39
  logo?: string;
40
40
  primaryColor?: string;
41
41
  [key: string]: any;
42
42
  }
43
43
 
44
+ /**
45
+ * Inventory configuration settings
46
+ */
47
+ export interface InventorySettings {
48
+ defaultMinStock?: number;
49
+ defaultMaxStock?: number;
50
+ enableLowStockAlerts?: boolean;
51
+ }
52
+
53
+ /**
54
+ * Contract expiration configuration settings
55
+ */
56
+ export interface ContractSettings {
57
+ expiringSoonDays?: number;
58
+ gracePeriodDays?: number;
59
+ enableExpirationNotifications?: boolean;
60
+ }
61
+
62
+ /**
63
+ * Update gym inventory settings DTO
64
+ */
65
+ export interface UpdateGymInventorySettingsDto {
66
+ defaultMinStock?: number;
67
+ defaultMaxStock?: number;
68
+ enableLowStockAlerts?: boolean;
69
+ }
70
+
71
+ /**
72
+ * Update gym contract settings DTO
73
+ */
74
+ export interface UpdateGymContractSettingsDto {
75
+ expiringSoonDays?: number;
76
+ gracePeriodDays?: number;
77
+ enableExpirationNotifications?: boolean;
78
+ }
79
+
44
80
  export interface Gym {
45
81
  id: string;
46
82
  organizationId: string;
@@ -52,8 +88,6 @@ export interface Gym {
52
88
  postalCode?: string;
53
89
  phone?: string;
54
90
  email?: string;
55
- openingTime?: string;
56
- closingTime?: string;
57
91
  capacity?: number;
58
92
  amenities?: GymAmenities;
59
93
  settings?: GymSettings;
@@ -62,6 +96,11 @@ export interface Gym {
62
96
  isActive: boolean;
63
97
  createdAt: string;
64
98
  updatedAt: string;
99
+ _count?: {
100
+ gymClients: number;
101
+ collaborators: number;
102
+ contracts: number;
103
+ };
65
104
  }
66
105
 
67
106
  export interface TimeSlot {
@@ -122,4 +161,4 @@ export interface GymStats {
122
161
  monthlyRevenue: number;
123
162
  checkInsToday: number;
124
163
  checkInsMonth: number;
125
- }
164
+ }
@@ -22,6 +22,9 @@ export * from './admin-subscription-management';
22
22
  export * from './payment-methods';
23
23
  export * from './roles';
24
24
  export * from './whatsapp';
25
+ export * from './bulk-messaging';
26
+ export * from './activities';
27
+ export * from './tags';
25
28
 
26
29
  export interface ApiResponse<T> {
27
30
  data: T;
@@ -10,7 +10,6 @@ export interface StartOnboardingData {
10
10
  }
11
11
 
12
12
  export interface StartOnboardingResponse {
13
- success: boolean;
14
13
  access_token: string;
15
14
  refresh_token: string;
16
15
  user: {
@@ -19,6 +18,9 @@ export interface StartOnboardingResponse {
19
18
  name: string;
20
19
  userType: string;
21
20
  };
21
+ lastActiveGymId: string;
22
+ lastActiveOrganizationId: string;
23
+ // Additional fields for mobile app compatibility
22
24
  organization: {
23
25
  id: string;
24
26
  name: string;
@@ -107,7 +109,6 @@ export interface CheckInSystemFeatures {
107
109
  allowMultiplePerDay: boolean;
108
110
  }
109
111
 
110
-
111
112
  export interface NotificationSettings {
112
113
  emailEnabled: boolean;
113
114
  smsEnabled: boolean;
@@ -151,4 +152,4 @@ export interface OnboardingResponse {
151
152
  gym?: any;
152
153
  onboardingStatus: OnboardingStatus;
153
154
  message?: string;
154
- }
155
+ }
@@ -87,6 +87,14 @@ export interface Product {
87
87
  createdAt: string;
88
88
  updatedAt: string;
89
89
  category?: ProductCategory;
90
+ image?: {
91
+ id: string;
92
+ filename: string;
93
+ originalName: string;
94
+ fileSize: number;
95
+ mimeType: string;
96
+ previewUrl?: string;
97
+ };
90
98
  createdBy?: {
91
99
  id: string;
92
100
  name: string;