@gymspace/sdk 1.2.20 → 1.2.22

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.20",
3
+ "version": "1.2.22",
4
4
  "description": "GymSpace TypeScript SDK for API integration",
5
5
  "author": "GymSpace Team",
6
6
  "license": "MIT",
@@ -65,14 +65,13 @@ export interface SearchActivitiesParams {
65
65
  }
66
66
 
67
67
  export interface CreateActivityNotificationDto {
68
- templateId?: string;
69
- customMessage?: string;
68
+ message: string;
70
69
  advanceTimeMinutes: number;
70
+ isActive?: boolean;
71
71
  }
72
72
 
73
73
  export interface UpdateActivityNotificationDto {
74
- templateId?: string;
75
- customMessage?: string;
74
+ message?: string;
76
75
  advanceTimeMinutes?: number;
77
76
  isActive?: boolean;
78
77
  }
@@ -80,11 +79,10 @@ export interface UpdateActivityNotificationDto {
80
79
  export interface ActivityNotification {
81
80
  id: string;
82
81
  activityId: string;
83
- templateId?: string;
84
- customMessage?: string;
82
+ templateId: string;
85
83
  advanceTimeMinutes: number;
86
84
  isActive: boolean;
87
- template?: {
85
+ template: {
88
86
  id: string;
89
87
  name: string;
90
88
  message: string;
@@ -6,6 +6,7 @@ export interface BulkTemplate {
6
6
  description?: string;
7
7
  tags: string[];
8
8
  isActive: boolean;
9
+ isHide: boolean;
9
10
  usageCount: number;
10
11
  lastUsedAt?: Date;
11
12
  createdByUserId: string;
@@ -0,0 +1,236 @@
1
+ // ============================================================================
2
+ // Public Catalog Types
3
+ // ============================================================================
4
+
5
+ /**
6
+ * Hero section of the catalog
7
+ */
8
+ export interface CatalogHeroSection {
9
+ logo: string | null;
10
+ banner: string | null;
11
+ heroMessage: string | null;
12
+ ctaButtonText: string;
13
+ whatsappUrl: string | null;
14
+ }
15
+
16
+ /**
17
+ * Activity/class offered by the gym
18
+ */
19
+ export interface CatalogActivity {
20
+ id: string;
21
+ name: string;
22
+ description: string | null;
23
+ startTime: string;
24
+ duration: number;
25
+ days: string[];
26
+ imageUrl: string | null;
27
+ }
28
+
29
+ /**
30
+ * Membership plan offered by the gym
31
+ */
32
+ export interface CatalogPlan {
33
+ id: string;
34
+ name: string;
35
+ description: string | null;
36
+ price: number;
37
+ currency: string;
38
+ duration: string;
39
+ features: any;
40
+ whatsappUrl: string | null;
41
+ }
42
+
43
+ /**
44
+ * Social media links
45
+ */
46
+ export interface CatalogSocialMedia {
47
+ instagram: string | null;
48
+ facebook: string | null;
49
+ tiktok: string | null;
50
+ whatsapp: string | null;
51
+ }
52
+
53
+ /**
54
+ * Gym location information
55
+ */
56
+ export interface CatalogLocation {
57
+ address: string | null;
58
+ city: string | null;
59
+ state: string | null;
60
+ latitude: number | null;
61
+ longitude: number | null;
62
+ }
63
+
64
+ /**
65
+ * Formatted schedule for a day
66
+ */
67
+ export interface FormattedSchedule {
68
+ day: string;
69
+ hours: string;
70
+ }
71
+
72
+ /**
73
+ * Complete catalog response
74
+ */
75
+ export interface CatalogResponse {
76
+ gym: {
77
+ id: string;
78
+ name: string;
79
+ slug: string;
80
+ description: string | null;
81
+ phone: string | null;
82
+ email: string | null;
83
+ currency: string;
84
+ };
85
+ hero: CatalogHeroSection;
86
+ plans: CatalogPlan[];
87
+ activities: CatalogActivity[];
88
+ schedule: FormattedSchedule[];
89
+ socialMedia: CatalogSocialMedia;
90
+ location: CatalogLocation;
91
+ }
92
+
93
+ /**
94
+ * City with gym count
95
+ */
96
+ export interface CityWithGyms {
97
+ city: string;
98
+ state: string;
99
+ count: number;
100
+ }
101
+
102
+ /**
103
+ * Search catalog parameters
104
+ */
105
+ export interface SearchCatalogParams {
106
+ search?: string;
107
+ city?: string;
108
+ state?: string;
109
+ latitude?: string;
110
+ longitude?: string;
111
+ radius?: string;
112
+ limit?: number;
113
+ offset?: number;
114
+ }
115
+
116
+ /**
117
+ * Catalog gym in search results
118
+ */
119
+ export interface CatalogGym {
120
+ id: string;
121
+ name: string;
122
+ slug: string;
123
+ address?: string;
124
+ city?: string;
125
+ state?: string;
126
+ phone?: string;
127
+ email?: string;
128
+ amenities?: any;
129
+ settings?: any;
130
+ }
131
+
132
+ /**
133
+ * Search catalog response
134
+ */
135
+ export interface SearchCatalogResponse {
136
+ gyms: CatalogGym[];
137
+ pagination: {
138
+ total: number;
139
+ limit: number;
140
+ offset: number;
141
+ };
142
+ }
143
+
144
+ // ============================================================================
145
+ // Lead Management Types
146
+ // ============================================================================
147
+
148
+ /**
149
+ * Lead gender enum
150
+ */
151
+ export enum LeadGender {
152
+ MALE = 'male',
153
+ FEMALE = 'female',
154
+ OTHER = 'other',
155
+ }
156
+
157
+ /**
158
+ * Create lead DTO
159
+ */
160
+ export interface CreateLeadDto {
161
+ fullName: string;
162
+ age: number;
163
+ phone: string;
164
+ gender: LeadGender;
165
+ objective: string;
166
+ }
167
+
168
+ /**
169
+ * Catalog lead entity
170
+ */
171
+ export interface CatalogLead {
172
+ id: string;
173
+ catalogId: string;
174
+ fullName: string;
175
+ age: number;
176
+ phone: string;
177
+ gender: string;
178
+ objective: string;
179
+ source: string;
180
+ ipAddress: string | null;
181
+ userAgent: string | null;
182
+ isContacted: boolean;
183
+ contactedAt: string | null;
184
+ createdAt: string;
185
+ updatedAt: string;
186
+ }
187
+
188
+ /**
189
+ * Lead filters for querying
190
+ */
191
+ export interface LeadFiltersDto {
192
+ startDate?: string;
193
+ endDate?: string;
194
+ isContacted?: boolean;
195
+ limit?: number;
196
+ offset?: number;
197
+ }
198
+
199
+ /**
200
+ * Lead submission response
201
+ */
202
+ export interface LeadSubmissionResponse {
203
+ message: string;
204
+ }
205
+
206
+ // ============================================================================
207
+ // Admin Catalog Configuration Types
208
+ // ============================================================================
209
+
210
+ /**
211
+ * Gym catalog configuration
212
+ */
213
+ export interface GymCatalog {
214
+ id: string;
215
+ gymId: string;
216
+ slug: string;
217
+ logo: string | null; // Deprecated: kept for backward compatibility
218
+ banner: string | null; // Deprecated: kept for backward compatibility
219
+ logoFileId: string | null;
220
+ bannerFileId: string | null;
221
+ heroMessage: string | null;
222
+ ctaButtonText: string;
223
+ createdAt: string;
224
+ updatedAt: string;
225
+ }
226
+
227
+ /**
228
+ * Update catalog configuration DTO
229
+ */
230
+ export interface UpdateCatalogConfigDto {
231
+ slug?: string;
232
+ heroMessage?: string;
233
+ ctaButtonText?: string;
234
+ logoFileId?: string;
235
+ bannerFileId?: string;
236
+ }
@@ -26,6 +26,7 @@ export * from './bulk-messaging';
26
26
  export * from './activities';
27
27
  export * from './tags';
28
28
  export * from './commissions';
29
+ export * from './catalog';
29
30
 
30
31
  export interface ApiResponse<T> {
31
32
  data: T;
@@ -19,6 +19,7 @@ export interface Subscription {
19
19
  startDate: Date;
20
20
  endDate: Date;
21
21
  isActive: boolean;
22
+ isTrial?: boolean;
22
23
  }
23
24
 
24
25
  export interface AvailablePlanDto {
@@ -71,4 +72,4 @@ export interface CheckLimitResponse {
71
72
  currentUsage: number;
72
73
  limit: number;
73
74
  message?: string;
74
- }
75
+ }
@@ -0,0 +1,46 @@
1
+ import { BaseResource } from './base';
2
+ import { RequestOptions } from '../types';
3
+ import {
4
+ GymCatalog,
5
+ UpdateCatalogConfigDto,
6
+ CatalogLead,
7
+ LeadFiltersDto,
8
+ } from '../models/catalog';
9
+
10
+ /**
11
+ * Admin Catalog Resource
12
+ * Handles catalog administration operations (requires authentication and CATALOG permissions)
13
+ */
14
+ export class AdminCatalogResource extends BaseResource {
15
+ private basePath = 'admin/catalog';
16
+
17
+ /**
18
+ * Get catalog configuration for the current gym
19
+ * Requires: CATALOG_READ permission
20
+ */
21
+ async getCatalogConfig(options?: RequestOptions): Promise<GymCatalog> {
22
+ return this.client.get<GymCatalog>(this.basePath, undefined, options);
23
+ }
24
+
25
+ /**
26
+ * Update catalog configuration
27
+ * Requires: CATALOG_UPDATE permission
28
+ */
29
+ async updateCatalogConfig(
30
+ data: UpdateCatalogConfigDto,
31
+ options?: RequestOptions
32
+ ): Promise<GymCatalog> {
33
+ return this.client.put<GymCatalog>(this.basePath, data, options);
34
+ }
35
+
36
+ /**
37
+ * Get catalog leads with optional filtering
38
+ * Requires: CATALOG_READ permission
39
+ */
40
+ async getLeads(
41
+ filters?: LeadFiltersDto,
42
+ options?: RequestOptions
43
+ ): Promise<CatalogLead[]> {
44
+ return this.client.get<CatalogLead[]>(`${this.basePath}/leads`, filters, options);
45
+ }
46
+ }
@@ -12,6 +12,7 @@ export * from './invitations';
12
12
  export * from './assets';
13
13
  export * from './files';
14
14
  export * from './public-catalog';
15
+ export * from './admin-catalog';
15
16
  export * from './health';
16
17
  export * from './onboarding';
17
18
  export * from './products';
@@ -39,4 +39,8 @@ export class InvitationsResource extends BaseResource {
39
39
  async cancelInvitation(id: string, options?: RequestOptions): Promise<void> {
40
40
  return this.client.put<void>(`${this.basePath}/${id}/cancel`, undefined, options);
41
41
  }
42
+
43
+ async resendInvitation(id: string, options?: RequestOptions): Promise<void> {
44
+ return this.client.post<void>(`${this.basePath}/${id}/resend`, undefined, options);
45
+ }
42
46
  }
@@ -1,61 +1,62 @@
1
1
  import { BaseResource } from './base';
2
- import { RequestOptions, PaginatedResponseDto } from '../types';
3
- import { PaginationQueryDto } from '../types';
4
-
5
- export interface SearchCatalogParams extends PaginationQueryDto {
6
- search?: string;
7
- city?: string;
8
- state?: string;
9
- latitude?: string;
10
- longitude?: string;
11
- radius?: string;
12
- }
13
-
14
- export interface GetFeaturedGymsParams {
15
- limit: string;
16
- }
17
-
18
- export interface CatalogGym {
19
- id: string;
20
- name: string;
21
- slug: string;
22
- address?: string;
23
- city?: string;
24
- state?: string;
25
- phone?: string;
26
- email?: string;
27
- amenities?: any;
28
- settings?: any;
29
- }
30
-
31
- export interface CityWithGyms {
32
- city: string;
33
- state: string;
34
- count: number;
35
- }
36
-
2
+ import { RequestOptions } from '../types';
3
+ import {
4
+ CatalogResponse,
5
+ CatalogGym,
6
+ CityWithGyms,
7
+ SearchCatalogParams,
8
+ SearchCatalogResponse,
9
+ CreateLeadDto,
10
+ LeadSubmissionResponse,
11
+ } from '../models/catalog';
12
+
13
+ /**
14
+ * Public Catalog Resource
15
+ * Handles public-facing catalog operations (no authentication required)
16
+ */
37
17
  export class PublicCatalogResource extends BaseResource {
38
18
  private basePath = 'catalog';
39
19
 
20
+ /**
21
+ * Search gyms in the public catalog
22
+ */
40
23
  async searchCatalog(
41
24
  params?: SearchCatalogParams,
42
25
  options?: RequestOptions
43
- ): Promise<PaginatedResponseDto<CatalogGym>> {
44
- return this.paginate<CatalogGym>(`${this.basePath}/search`, params, options);
26
+ ): Promise<SearchCatalogResponse> {
27
+ return this.client.get<SearchCatalogResponse>(`${this.basePath}/search`, params, options);
45
28
  }
46
29
 
47
- async getFeaturedGyms(
48
- params: GetFeaturedGymsParams,
49
- options?: RequestOptions
50
- ): Promise<CatalogGym[]> {
30
+ /**
31
+ * Get featured gyms
32
+ */
33
+ async getFeaturedGyms(limit?: number, options?: RequestOptions): Promise<CatalogGym[]> {
34
+ const params = limit ? { limit: String(limit) } : undefined;
51
35
  return this.client.get<CatalogGym[]>(`${this.basePath}/featured`, params, options);
52
36
  }
53
37
 
38
+ /**
39
+ * Get list of cities with available gyms
40
+ */
54
41
  async getCitiesWithGyms(options?: RequestOptions): Promise<CityWithGyms[]> {
55
42
  return this.client.get<CityWithGyms[]>(`${this.basePath}/cities`, undefined, options);
56
43
  }
57
44
 
58
- async getGymBySlug(slug: string, options?: RequestOptions): Promise<CatalogGym> {
59
- return this.client.get<CatalogGym>(`${this.basePath}/${slug}`, undefined, options);
45
+ /**
46
+ * Get complete catalog details by gym slug
47
+ */
48
+ async getCatalogBySlug(slug: string, options?: RequestOptions): Promise<CatalogResponse> {
49
+ return this.client.get<CatalogResponse>(`${this.basePath}/${slug}`, undefined, options);
60
50
  }
61
- }
51
+
52
+ /**
53
+ * Submit a lead form for a specific gym
54
+ */
55
+ async submitLead(
56
+ slug: string,
57
+ data: CreateLeadDto,
58
+ options?: RequestOptions
59
+ ): Promise<LeadSubmissionResponse> {
60
+ return this.client.post<LeadSubmissionResponse>(`${this.basePath}/${slug}/lead`, data, options);
61
+ }
62
+ }
@@ -5,6 +5,7 @@ import { RequestOptions } from '../types';
5
5
  export interface SubscriptionPlanDto {
6
6
  id: string;
7
7
  name: string;
8
+ planType?: string;
8
9
  price: {
9
10
  PEN?: { currency: 'PEN'; value: number };
10
11
  USD?: { currency: 'USD'; value: number };
@@ -20,6 +21,7 @@ export interface SubscriptionPlanDto {
20
21
  features: Record<string, any>;
21
22
  description?: string;
22
23
  isActive: boolean;
24
+ isVisibleToPublic: boolean;
23
25
  createdAt: Date;
24
26
  updatedAt: Date;
25
27
  activeSubscriptions?: number;
@@ -37,6 +39,7 @@ export interface PricingDto {
37
39
 
38
40
  export interface CreateSubscriptionPlanDto {
39
41
  name: string;
42
+ planType?: string;
40
43
  price: PricingDto;
41
44
  billingFrequency: string;
42
45
  duration?: number;
@@ -47,10 +50,12 @@ export interface CreateSubscriptionPlanDto {
47
50
  features: Record<string, any>;
48
51
  description?: string;
49
52
  isActive?: boolean;
53
+ isVisibleToPublic?: boolean;
50
54
  }
51
55
 
52
56
  export interface UpdateSubscriptionPlanDto {
53
57
  name?: string;
58
+ planType?: string;
54
59
  price?: PricingDto;
55
60
  billingFrequency?: string;
56
61
  duration?: number;
@@ -61,6 +66,7 @@ export interface UpdateSubscriptionPlanDto {
61
66
  features?: Record<string, any>;
62
67
  description?: string;
63
68
  isActive?: boolean;
69
+ isVisibleToPublic?: boolean;
64
70
  }
65
71
 
66
72
  export class SubscriptionPlansResource extends BaseResource {
package/src/sdk.ts CHANGED
@@ -16,6 +16,7 @@ import {
16
16
  AssetsResource,
17
17
  FilesResource,
18
18
  PublicCatalogResource,
19
+ AdminCatalogResource,
19
20
  HealthResource,
20
21
  OnboardingResource,
21
22
  ProductsResource,
@@ -57,6 +58,7 @@ export class GymSpaceSdk {
57
58
  public assets: AssetsResource;
58
59
  public files: FilesResource;
59
60
  public publicCatalog: PublicCatalogResource;
61
+ public adminCatalog: AdminCatalogResource;
60
62
  public health: HealthResource;
61
63
  public onboarding: OnboardingResource;
62
64
  public products: ProductsResource;
@@ -96,6 +98,7 @@ export class GymSpaceSdk {
96
98
  this.assets = new AssetsResource(this.client);
97
99
  this.files = new FilesResource(this.client);
98
100
  this.publicCatalog = new PublicCatalogResource(this.client);
101
+ this.adminCatalog = new AdminCatalogResource(this.client);
99
102
  this.health = new HealthResource(this.client);
100
103
  this.onboarding = new OnboardingResource(this.client);
101
104
  this.products = new ProductsResource(this.client);