@gymspace/sdk 1.2.8 → 1.2.11
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 +54 -183
- package/dist/index.d.ts +54 -183
- package/dist/index.js +45 -78
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +46 -77
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/client.ts +36 -4
- package/src/models/check-ins.ts +6 -4
- package/src/models/dashboard.ts +26 -1
- package/src/models/index.ts +0 -2
- package/src/models/onboarding.ts +0 -17
- package/src/models/payment-methods.ts +2 -2
- package/src/models/products.ts +2 -10
- package/src/resources/admin-subscription-management.ts +1 -1
- package/src/resources/dashboard.ts +11 -1
- package/src/resources/index.ts +0 -2
- package/src/resources/payment-methods.ts +3 -3
- package/src/resources/products.ts +21 -31
- package/src/sdk.ts +7 -6
- package/src/models/evaluations.ts +0 -91
- package/src/models/leads.ts +0 -52
- package/src/resources/evaluations.ts +0 -63
- package/src/resources/leads.ts +0 -48
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { AxiosRequestConfig } from 'axios';
|
|
2
|
-
import { PaginationParams as PaginationParams$1, ListCollaboratorsParams, Collaborator, UpdateCollaboratorDto, UpdateCollaboratorRoleDto, UpdateCollaboratorStatusDto, ActivityQueryParams, ActivityItem, StatsQueryParams, CollaboratorStats, Role, ContractStatus, CreateInvitationDto, Invitation, ValidateByCodeDto, AcceptInvitationDto
|
|
2
|
+
import { PaginationParams as PaginationParams$1, ListCollaboratorsParams, Collaborator, UpdateCollaboratorDto, UpdateCollaboratorRoleDto, UpdateCollaboratorStatusDto, ActivityQueryParams, ActivityItem, StatsQueryParams, CollaboratorStats, Role, ContractStatus, CreateInvitationDto, Invitation, ValidateByCodeDto, AcceptInvitationDto } from '@gymspace/shared';
|
|
3
3
|
export * from '@gymspace/shared';
|
|
4
4
|
|
|
5
5
|
interface GymSpaceConfig {
|
|
@@ -36,6 +36,7 @@ declare class ApiClient {
|
|
|
36
36
|
private axiosInstance;
|
|
37
37
|
private config;
|
|
38
38
|
private refreshToken;
|
|
39
|
+
private onTokenRefreshed?;
|
|
39
40
|
getAccessToken(): string | null;
|
|
40
41
|
constructor(config: GymSpaceConfig);
|
|
41
42
|
private setupInterceptors;
|
|
@@ -50,6 +51,14 @@ declare class ApiClient {
|
|
|
50
51
|
setAuthToken(token: string): void;
|
|
51
52
|
setRefreshToken(token: string | null): void;
|
|
52
53
|
getRefreshToken(): string | null;
|
|
54
|
+
/**
|
|
55
|
+
* Set callback for when tokens are refreshed by backend
|
|
56
|
+
*/
|
|
57
|
+
setOnTokenRefreshed(callback: (accessToken: string, refreshToken?: string) => void): void;
|
|
58
|
+
/**
|
|
59
|
+
* Get the token refresh callback
|
|
60
|
+
*/
|
|
61
|
+
getOnTokenRefreshed(): ((accessToken: string, refreshToken?: string) => void) | undefined;
|
|
53
62
|
setGymId(gymId: string): void;
|
|
54
63
|
clearAuth(): void;
|
|
55
64
|
getBaseUrl(): string;
|
|
@@ -949,6 +958,29 @@ interface DateRangeParams {
|
|
|
949
958
|
startDate?: string;
|
|
950
959
|
endDate?: string;
|
|
951
960
|
}
|
|
961
|
+
interface CheckInDetail {
|
|
962
|
+
id: string;
|
|
963
|
+
timestamp: string;
|
|
964
|
+
gymClientId: string;
|
|
965
|
+
client: {
|
|
966
|
+
id: string;
|
|
967
|
+
name: string;
|
|
968
|
+
clientNumber: string;
|
|
969
|
+
status: string;
|
|
970
|
+
profilePhotoId: string | null;
|
|
971
|
+
};
|
|
972
|
+
notes: string | null;
|
|
973
|
+
registeredBy: {
|
|
974
|
+
id: string;
|
|
975
|
+
name: string;
|
|
976
|
+
};
|
|
977
|
+
}
|
|
978
|
+
interface CheckInsList {
|
|
979
|
+
checkIns: CheckInDetail[];
|
|
980
|
+
total: number;
|
|
981
|
+
startDate: string;
|
|
982
|
+
endDate: string;
|
|
983
|
+
}
|
|
952
984
|
|
|
953
985
|
declare class DashboardResource extends BaseResource {
|
|
954
986
|
/**
|
|
@@ -993,99 +1025,12 @@ declare class DashboardResource extends BaseResource {
|
|
|
993
1025
|
* @returns List of contracts expiring in the specified period
|
|
994
1026
|
*/
|
|
995
1027
|
getExpiringContracts(limit?: number, params?: DateRangeParams): Promise<ExpiringContract[]>;
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
bodyFatPercentage?: number;
|
|
1003
|
-
muscleMassPercentage?: number;
|
|
1004
|
-
measurements?: EvaluationMeasurements;
|
|
1005
|
-
healthMetrics?: EvaluationHealthMetrics;
|
|
1006
|
-
performanceMetrics?: EvaluationPerformanceMetrics;
|
|
1007
|
-
notes?: string;
|
|
1008
|
-
goals?: string;
|
|
1009
|
-
recommendations?: string;
|
|
1010
|
-
}
|
|
1011
|
-
interface UpdateEvaluationDto {
|
|
1012
|
-
gymClientId?: string;
|
|
1013
|
-
weight?: number;
|
|
1014
|
-
height?: number;
|
|
1015
|
-
bodyFatPercentage?: number;
|
|
1016
|
-
muscleMassPercentage?: number;
|
|
1017
|
-
measurements?: EvaluationMeasurements;
|
|
1018
|
-
healthMetrics?: EvaluationHealthMetrics;
|
|
1019
|
-
performanceMetrics?: EvaluationPerformanceMetrics;
|
|
1020
|
-
notes?: string;
|
|
1021
|
-
goals?: string;
|
|
1022
|
-
recommendations?: string;
|
|
1023
|
-
}
|
|
1024
|
-
interface EvaluationMeasurements {
|
|
1025
|
-
chest?: number;
|
|
1026
|
-
waist?: number;
|
|
1027
|
-
hips?: number;
|
|
1028
|
-
leftArm?: number;
|
|
1029
|
-
rightArm?: number;
|
|
1030
|
-
leftThigh?: number;
|
|
1031
|
-
rightThigh?: number;
|
|
1032
|
-
[key: string]: number | undefined;
|
|
1033
|
-
}
|
|
1034
|
-
interface EvaluationHealthMetrics {
|
|
1035
|
-
bloodPressure?: string;
|
|
1036
|
-
restingHeartRate?: number;
|
|
1037
|
-
vo2Max?: number;
|
|
1038
|
-
[key: string]: any;
|
|
1039
|
-
}
|
|
1040
|
-
interface EvaluationPerformanceMetrics {
|
|
1041
|
-
benchPress?: number;
|
|
1042
|
-
squat?: number;
|
|
1043
|
-
deadlift?: number;
|
|
1044
|
-
[key: string]: number | undefined;
|
|
1045
|
-
}
|
|
1046
|
-
interface Evaluation {
|
|
1047
|
-
id: string;
|
|
1048
|
-
gymId: string;
|
|
1049
|
-
gymClientId: string;
|
|
1050
|
-
evaluatorId: string;
|
|
1051
|
-
evaluationDate: string;
|
|
1052
|
-
weight: number;
|
|
1053
|
-
height: number;
|
|
1054
|
-
bmi: number;
|
|
1055
|
-
bodyFatPercentage?: number;
|
|
1056
|
-
muscleMassPercentage?: number;
|
|
1057
|
-
measurements?: EvaluationMeasurements;
|
|
1058
|
-
healthMetrics?: EvaluationHealthMetrics;
|
|
1059
|
-
performanceMetrics?: EvaluationPerformanceMetrics;
|
|
1060
|
-
notes?: string;
|
|
1061
|
-
goals?: string;
|
|
1062
|
-
recommendations?: string;
|
|
1063
|
-
createdAt: string;
|
|
1064
|
-
updatedAt: string;
|
|
1065
|
-
}
|
|
1066
|
-
interface GetClientEvaluationsParams extends PaginationQueryDto {
|
|
1067
|
-
}
|
|
1068
|
-
interface EvaluationReport {
|
|
1069
|
-
evaluation: Evaluation;
|
|
1070
|
-
client: any;
|
|
1071
|
-
previousEvaluation?: Evaluation;
|
|
1072
|
-
evolution?: {
|
|
1073
|
-
weight: number;
|
|
1074
|
-
bodyFat: number;
|
|
1075
|
-
muscleMass: number;
|
|
1076
|
-
measurements: Record<string, number>;
|
|
1077
|
-
};
|
|
1078
|
-
}
|
|
1079
|
-
|
|
1080
|
-
declare class EvaluationsResource extends BaseResource {
|
|
1081
|
-
private basePath;
|
|
1082
|
-
createEvaluation(data: CreateEvaluationDto, options?: RequestOptions): Promise<Evaluation>;
|
|
1083
|
-
getEvaluation(id: string, options?: RequestOptions): Promise<Evaluation>;
|
|
1084
|
-
updateEvaluation(id: string, data: UpdateEvaluationDto, options?: RequestOptions): Promise<Evaluation>;
|
|
1085
|
-
deleteEvaluation(id: string, options?: RequestOptions): Promise<void>;
|
|
1086
|
-
getClientEvaluations(clientId: string, params?: GetClientEvaluationsParams, options?: RequestOptions): Promise<PaginatedResponseDto<Evaluation>>;
|
|
1087
|
-
getGymEvaluationStats(options?: RequestOptions): Promise<any>;
|
|
1088
|
-
generateEvaluationReport(id: string, options?: RequestOptions): Promise<EvaluationReport>;
|
|
1028
|
+
/**
|
|
1029
|
+
* Get detailed list of check-ins within date range
|
|
1030
|
+
* @param params Optional date range parameters (defaults to current day)
|
|
1031
|
+
* @returns Detailed list of check-ins with client and registeredBy information
|
|
1032
|
+
*/
|
|
1033
|
+
getCheckInsList(params?: DateRangeParams): Promise<CheckInsList>;
|
|
1089
1034
|
}
|
|
1090
1035
|
|
|
1091
1036
|
interface CreateCheckInDto {
|
|
@@ -1113,10 +1058,12 @@ interface CheckIn {
|
|
|
1113
1058
|
name: string;
|
|
1114
1059
|
};
|
|
1115
1060
|
}
|
|
1116
|
-
interface SearchCheckInsParams
|
|
1061
|
+
interface SearchCheckInsParams {
|
|
1117
1062
|
clientId?: string;
|
|
1118
1063
|
startDate?: string;
|
|
1119
1064
|
endDate?: string;
|
|
1065
|
+
limit?: number;
|
|
1066
|
+
offset?: number;
|
|
1120
1067
|
}
|
|
1121
1068
|
interface GetCheckInStatsParams {
|
|
1122
1069
|
period: 'day' | 'week' | 'month';
|
|
@@ -1129,7 +1076,9 @@ interface CheckInStats {
|
|
|
1129
1076
|
peakHours: Record<string, number>;
|
|
1130
1077
|
dayDistribution: Record<string, number>;
|
|
1131
1078
|
}
|
|
1132
|
-
interface GetClientCheckInHistoryParams
|
|
1079
|
+
interface GetClientCheckInHistoryParams {
|
|
1080
|
+
limit?: number;
|
|
1081
|
+
offset?: number;
|
|
1133
1082
|
}
|
|
1134
1083
|
interface CurrentlyInGymResponse {
|
|
1135
1084
|
total: number;
|
|
@@ -1181,64 +1130,6 @@ declare class InvitationsResource extends BaseResource {
|
|
|
1181
1130
|
cancelInvitation(id: string, options?: RequestOptions): Promise<void>;
|
|
1182
1131
|
}
|
|
1183
1132
|
|
|
1184
|
-
interface CreateLeadDto {
|
|
1185
|
-
name: string;
|
|
1186
|
-
email: string;
|
|
1187
|
-
phone: string;
|
|
1188
|
-
gymId: string;
|
|
1189
|
-
message?: string;
|
|
1190
|
-
source?: string;
|
|
1191
|
-
metadata?: Record<string, any>;
|
|
1192
|
-
}
|
|
1193
|
-
interface UpdateLeadDto {
|
|
1194
|
-
status?: LeadStatus;
|
|
1195
|
-
notes?: string;
|
|
1196
|
-
assignedToUserId?: string;
|
|
1197
|
-
metadata?: Record<string, any>;
|
|
1198
|
-
}
|
|
1199
|
-
interface Lead {
|
|
1200
|
-
id: string;
|
|
1201
|
-
gymId: string;
|
|
1202
|
-
name: string;
|
|
1203
|
-
email: string;
|
|
1204
|
-
phone: string;
|
|
1205
|
-
status: LeadStatus;
|
|
1206
|
-
source?: string;
|
|
1207
|
-
message?: string;
|
|
1208
|
-
notes?: string;
|
|
1209
|
-
assignedToUserId?: string;
|
|
1210
|
-
convertedToClientId?: string;
|
|
1211
|
-
metadata?: Record<string, any>;
|
|
1212
|
-
createdAt: string;
|
|
1213
|
-
updatedAt: string;
|
|
1214
|
-
}
|
|
1215
|
-
interface SearchLeadsParams extends PaginationQueryDto {
|
|
1216
|
-
status?: LeadStatus;
|
|
1217
|
-
search?: string;
|
|
1218
|
-
assignedToUserId?: string;
|
|
1219
|
-
startDate?: string;
|
|
1220
|
-
endDate?: string;
|
|
1221
|
-
}
|
|
1222
|
-
interface LeadStats {
|
|
1223
|
-
total: number;
|
|
1224
|
-
byStatus: Record<LeadStatus, number>;
|
|
1225
|
-
conversionRate: number;
|
|
1226
|
-
averageResponseTime: number;
|
|
1227
|
-
bySource: Record<string, number>;
|
|
1228
|
-
}
|
|
1229
|
-
|
|
1230
|
-
declare class LeadsResource extends BaseResource {
|
|
1231
|
-
private basePath;
|
|
1232
|
-
createLead(data: CreateLeadDto, options?: RequestOptions): Promise<Lead>;
|
|
1233
|
-
searchLeads(params?: SearchLeadsParams, options?: RequestOptions): Promise<PaginatedResponseDto<Lead>>;
|
|
1234
|
-
getLead(id: string, options?: RequestOptions): Promise<Lead>;
|
|
1235
|
-
updateLead(id: string, data: UpdateLeadDto, options?: RequestOptions): Promise<Lead>;
|
|
1236
|
-
getLeadStats(options?: RequestOptions): Promise<LeadStats>;
|
|
1237
|
-
convertLead(id: string, options?: RequestOptions): Promise<{
|
|
1238
|
-
clientId: string;
|
|
1239
|
-
}>;
|
|
1240
|
-
}
|
|
1241
|
-
|
|
1242
1133
|
/**
|
|
1243
1134
|
* Asset models for file management
|
|
1244
1135
|
*/
|
|
@@ -1523,33 +1414,17 @@ interface CheckInSystemFeatures {
|
|
|
1523
1414
|
trackCheckInTime: boolean;
|
|
1524
1415
|
allowMultiplePerDay: boolean;
|
|
1525
1416
|
}
|
|
1526
|
-
interface EvaluationSystemFeatures {
|
|
1527
|
-
enabled: boolean;
|
|
1528
|
-
trackMeasurements: boolean;
|
|
1529
|
-
trackBodyComposition: boolean;
|
|
1530
|
-
trackPerformance: boolean;
|
|
1531
|
-
defaultFrequencyDays: number;
|
|
1532
|
-
}
|
|
1533
|
-
interface LeadManagementFeatures {
|
|
1534
|
-
enabled: boolean;
|
|
1535
|
-
publicCatalogListing: boolean;
|
|
1536
|
-
enableOnlineForm: boolean;
|
|
1537
|
-
autoAssignLeads: boolean;
|
|
1538
|
-
}
|
|
1539
1417
|
interface NotificationSettings {
|
|
1540
1418
|
emailEnabled: boolean;
|
|
1541
1419
|
smsEnabled: boolean;
|
|
1542
1420
|
welcomeEmails: boolean;
|
|
1543
1421
|
contractExpiryAlerts: boolean;
|
|
1544
|
-
evaluationReminders: boolean;
|
|
1545
1422
|
}
|
|
1546
1423
|
interface ConfigureFeaturesData {
|
|
1547
1424
|
gymId: string;
|
|
1548
1425
|
clientManagement: ClientManagementFeatures;
|
|
1549
1426
|
membershipManagement: MembershipManagementFeatures;
|
|
1550
1427
|
checkInSystem: CheckInSystemFeatures;
|
|
1551
|
-
evaluationSystem: EvaluationSystemFeatures;
|
|
1552
|
-
leadManagement: LeadManagementFeatures;
|
|
1553
1428
|
notifications: NotificationSettings;
|
|
1554
1429
|
}
|
|
1555
1430
|
interface CompleteGuidedSetupData {
|
|
@@ -1643,12 +1518,9 @@ interface CreateProductDto {
|
|
|
1643
1518
|
description?: string;
|
|
1644
1519
|
price: number;
|
|
1645
1520
|
stock?: number;
|
|
1646
|
-
minStock?: number;
|
|
1647
|
-
maxStock?: number;
|
|
1648
1521
|
categoryId?: string;
|
|
1649
1522
|
imageId?: string;
|
|
1650
1523
|
status?: 'active' | 'inactive';
|
|
1651
|
-
trackInventory?: 'none' | 'simple' | 'advanced' | 'capacity';
|
|
1652
1524
|
}
|
|
1653
1525
|
interface CreateServiceDto {
|
|
1654
1526
|
name: string;
|
|
@@ -1662,12 +1534,9 @@ interface UpdateProductDto {
|
|
|
1662
1534
|
description?: string;
|
|
1663
1535
|
price?: number;
|
|
1664
1536
|
stock?: number;
|
|
1665
|
-
minStock?: number;
|
|
1666
|
-
maxStock?: number;
|
|
1667
1537
|
categoryId?: string;
|
|
1668
1538
|
imageId?: string;
|
|
1669
1539
|
status?: 'active' | 'inactive';
|
|
1670
|
-
trackInventory?: 'none' | 'simple' | 'advanced' | 'capacity';
|
|
1671
1540
|
}
|
|
1672
1541
|
interface UpdateStockDto {
|
|
1673
1542
|
quantity: number;
|
|
@@ -1706,7 +1575,7 @@ interface Product {
|
|
|
1706
1575
|
saleItems: number;
|
|
1707
1576
|
};
|
|
1708
1577
|
}
|
|
1709
|
-
interface SearchProductsParams
|
|
1578
|
+
interface SearchProductsParams {
|
|
1710
1579
|
search?: string;
|
|
1711
1580
|
categoryId?: string;
|
|
1712
1581
|
type?: 'Product' | 'Service';
|
|
@@ -1747,7 +1616,7 @@ declare class ProductsResource extends BaseResource {
|
|
|
1747
1616
|
deleteCategory(id: string, options?: RequestOptions): Promise<void>;
|
|
1748
1617
|
createProduct(data: CreateProductDto, options?: RequestOptions): Promise<Product>;
|
|
1749
1618
|
createService(data: CreateServiceDto, options?: RequestOptions): Promise<Product>;
|
|
1750
|
-
searchProducts(params?: SearchProductsParams, options?: RequestOptions): Promise<
|
|
1619
|
+
searchProducts(params?: SearchProductsParams, options?: RequestOptions): Promise<Product[]>;
|
|
1751
1620
|
getProduct(id: string, options?: RequestOptions): Promise<Product>;
|
|
1752
1621
|
updateProduct(id: string, data: UpdateProductDto, options?: RequestOptions): Promise<Product>;
|
|
1753
1622
|
deleteProduct(id: string, options?: RequestOptions): Promise<void>;
|
|
@@ -2234,7 +2103,7 @@ interface PaymentMethod {
|
|
|
2234
2103
|
email: string;
|
|
2235
2104
|
} | null;
|
|
2236
2105
|
}
|
|
2237
|
-
interface SearchPaymentMethodsParams
|
|
2106
|
+
interface SearchPaymentMethodsParams {
|
|
2238
2107
|
search?: string;
|
|
2239
2108
|
enabledOnly?: boolean;
|
|
2240
2109
|
code?: string;
|
|
@@ -2248,7 +2117,7 @@ interface PaymentMethodStats {
|
|
|
2248
2117
|
declare class PaymentMethodsResource extends BaseResource {
|
|
2249
2118
|
private basePath;
|
|
2250
2119
|
createPaymentMethod(data: CreatePaymentMethodDto, options?: RequestOptions): Promise<PaymentMethod>;
|
|
2251
|
-
searchPaymentMethods(params?: SearchPaymentMethodsParams, options?: RequestOptions): Promise<
|
|
2120
|
+
searchPaymentMethods(params?: SearchPaymentMethodsParams, options?: RequestOptions): Promise<PaymentMethod[]>;
|
|
2252
2121
|
getPaymentMethod(id: string, options?: RequestOptions): Promise<PaymentMethod>;
|
|
2253
2122
|
updatePaymentMethod(id: string, data: UpdatePaymentMethodDto, options?: RequestOptions): Promise<PaymentMethod>;
|
|
2254
2123
|
deletePaymentMethod(id: string, options?: RequestOptions): Promise<void>;
|
|
@@ -2459,10 +2328,8 @@ declare class GymSpaceSdk {
|
|
|
2459
2328
|
membershipPlans: MembershipPlansResource;
|
|
2460
2329
|
contracts: ContractsResource;
|
|
2461
2330
|
dashboard: DashboardResource;
|
|
2462
|
-
evaluations: EvaluationsResource;
|
|
2463
2331
|
checkIns: CheckInsResource;
|
|
2464
2332
|
invitations: InvitationsResource;
|
|
2465
|
-
leads: LeadsResource;
|
|
2466
2333
|
assets: AssetsResource;
|
|
2467
2334
|
files: FilesResource;
|
|
2468
2335
|
publicCatalog: PublicCatalogResource;
|
|
@@ -2510,6 +2377,10 @@ declare class GymSpaceSdk {
|
|
|
2510
2377
|
* Automatically uses Expo fetch if set
|
|
2511
2378
|
*/
|
|
2512
2379
|
createAgentFetch(): (path: string, options?: RequestInit) => Promise<Response>;
|
|
2380
|
+
/**
|
|
2381
|
+
* Set callback for when tokens are refreshed by backend
|
|
2382
|
+
*/
|
|
2383
|
+
setOnTokenRefreshed(callback: (accessToken: string, refreshToken?: string) => void): void;
|
|
2513
2384
|
/**
|
|
2514
2385
|
* Get the underlying API client
|
|
2515
2386
|
*/
|
|
@@ -2543,4 +2414,4 @@ declare class NetworkError extends GymSpaceError {
|
|
|
2543
2414
|
constructor(message?: string);
|
|
2544
2415
|
}
|
|
2545
2416
|
|
|
2546
|
-
export { type ActivateRenewalDto, AdminSubscriptionManagementResource, type AdminSubscriptionStatusDto, type AffiliateOrganizationDto, type Amenities, ApiClient, type ApiResponse, type AssetResponseDto, AssetsResource, AuthResource, AuthenticationError, AuthorizationError, type AvailablePlanDto, type BusinessHours, type CancelSubscriptionDto, type CatalogGym, type ChangePasswordDto, type ChangePasswordResponseDto, type CheckIn, type CheckInListResponse, type CheckInStats, type CheckInSystemFeatures, type CheckIns, CheckInsResource, type CheckLimitResponse, type CityWithGyms, type Client, type ClientCheckInHistory, type ClientManagementFeatures, type ClientStat, type ClientStats, ClientsResource, type CollaboratorRoleDto, CollaboratorsResource, type CompleteGuidedSetupData, type ConfigureFeaturesData, type ConnectionStatusResponse, type Contact, type Contract, ContractsResource, type ContractsRevenue, type CreateCheckInDto, type CreateClientDto, type CreateContractDto, type
|
|
2417
|
+
export { type ActivateRenewalDto, AdminSubscriptionManagementResource, type AdminSubscriptionStatusDto, type AffiliateOrganizationDto, type Amenities, ApiClient, type ApiResponse, type AssetResponseDto, AssetsResource, AuthResource, AuthenticationError, AuthorizationError, type AvailablePlanDto, type BusinessHours, type CancelSubscriptionDto, type CatalogGym, type ChangePasswordDto, type ChangePasswordResponseDto, type CheckIn, type CheckInDetail, type CheckInListResponse, type CheckInStats, type CheckInSystemFeatures, type CheckIns, type CheckInsList, CheckInsResource, type CheckLimitResponse, type CityWithGyms, type Client, type ClientCheckInHistory, type ClientManagementFeatures, type ClientStat, type ClientStats, ClientsResource, type CollaboratorRoleDto, CollaboratorsResource, type CompleteGuidedSetupData, type ConfigureFeaturesData, type ConnectionStatusResponse, type Contact, type Contract, ContractsResource, type ContractsRevenue, type CreateCheckInDto, type CreateClientDto, type CreateContractDto, type CreateGymDto, type CreateMembershipPlanDto, type CreatePaymentMethodDto, type CreateProductCategoryDto, type CreateProductDto, type CreateSaleDto, type CreateServiceDto, type CreateSubscriptionPlanDto, type CreateSupplierDto, type CreateTemplateDto, type CreateWhatsAppConfigDto, type CurrentSessionResponse, type CurrentlyInGymResponse, type CustomerSalesReport, DashboardResource, type DashboardStats, type DateRangeParams, type DaySchedule, type Debts, type DisconnectResponse, type ExpiringContract, type FileResponseDto, FilesResource, type FreezeContractDto, type GetCheckInStatsParams, type GetClientCheckInHistoryParams, type GetContractsParams, type GetFeaturedGymsParams, type GetGymInvitationsParams, type GetMembershipPlansParams, type Gym, type GymAmenities, type GymSchedule, type GymSettings, type GymSocialMedia, type GymSpaceConfig, GymSpaceError, GymSpaceSdk, type GymStats, GymsResource, HealthResource, type HealthResponse, type InitializeConnectionResponse, type InvitationValidationResponse, InvitationsResource, type ListContactsResponse, type LoginDto, type LoginResponseDto, type MembershipManagementFeatures, type MembershipPlan, type MembershipPlanStats, MembershipPlansResource, NetworkError, type NewClients, NotFoundError, type NotificationSettings, OnboardingResource, type OnboardingResponse, type OnboardingStatus, OnboardingStep, type Organization, type OrganizationAdminDetails, type OrganizationStats, type OrganizationWithDetails, OrganizationsResource, type PaginatedResponse, type PaginatedResponseDto, type PaginationParams, type PaginationQueryDto, type PaySaleDto, type PaymentMethod, type PaymentMethodStats, PaymentMethodsResource, type PermissionsGroup, type PreviewTemplateResponse, type PriceDto, type PricingDto, type Product, type ProductCategory, ProductsResource, PublicCatalogResource, type ReadyResponse, type RegisterCollaboratorDto, type RegisterOwnerDto, type RenewContractDto, type RequestOptions, type RequestPasswordResetDto, type RequestPasswordResetResponseDto, type ResendResetCodeDto, type ResendResetCodeResponseDto, type ResendVerificationDto, type ResetPasswordDto, type ResetPasswordResponseDto, RolesResource, type Sale, type SaleItem, type SaleItemDto, SalesResource, type SalesRevenue, type SalesStats, type SearchCatalogParams, type SearchCheckInsParams, type SearchClientsParams, type SearchPaymentMethodsParams, type SearchProductsParams, type SearchSalesParams, type SearchSuppliersParams, type SearchTemplatesDto, type SearchWhatsAppMessagesDto, type SendWhatsAppMessageDto, type SocialMedia, type StartOnboardingData, type StartOnboardingResponse, type StockMovement, type Subscription, type SubscriptionHistoryDto, type SubscriptionPlan, type SubscriptionPlanDto, SubscriptionPlansResource, type SubscriptionStatusDto, SubscriptionsResource, type Supplier, SuppliersResource, type SuppliersStats, type TimeSlot, type TopSellingProduct, type UpdateClientDto, type UpdateGymDto, type UpdateGymScheduleDto, type UpdateGymSettingsData, type UpdateGymSocialMediaDto, type UpdateMembershipPlanDto, type UpdateOrganizationDto, type UpdatePaymentMethodDto, type UpdatePaymentStatusDto, type UpdateProductCategoryDto, type UpdateProductDto, type UpdateProfileDto, type UpdateSaleDto, type UpdateStockDto, type UpdateSubscriptionPlanDto, type UpdateSupplierDto, type UpdateTemplateDto, type UpdateWhatsAppConfigDto, type UpgradeSubscriptionDto, type UploadAssetDto, type UploadFileDto, type UserProfileDto, UsersResource, ValidationError, type VerifyEmailDto, type VerifyResetCodeDto, type VerifyResetCodeResponseDto, type WeeklySchedule, type WhatsAppConfig, type WhatsAppMessage, WhatsAppResource, type WhatsAppTemplate, WhatsAppTemplatesResource };
|
package/dist/index.js
CHANGED
|
@@ -74,7 +74,7 @@ var ApiClient = class {
|
|
|
74
74
|
if (this.config.apiKey && config.headers) {
|
|
75
75
|
config.headers["Authorization"] = `Bearer ${this.config.apiKey}`;
|
|
76
76
|
}
|
|
77
|
-
if (this.refreshToken && config.
|
|
77
|
+
if (this.refreshToken && this.config.apiKey && config.headers) {
|
|
78
78
|
config.headers["X-Refresh-Token"] = this.refreshToken;
|
|
79
79
|
}
|
|
80
80
|
return config;
|
|
@@ -85,6 +85,18 @@ var ApiClient = class {
|
|
|
85
85
|
);
|
|
86
86
|
this.axiosInstance.interceptors.response.use(
|
|
87
87
|
(response) => {
|
|
88
|
+
const newAccessToken = response.headers["x-new-access-token"];
|
|
89
|
+
const newRefreshToken = response.headers["x-new-refresh-token"];
|
|
90
|
+
if (newAccessToken) {
|
|
91
|
+
console.log("Tokens refreshed by backend, updating SDK...");
|
|
92
|
+
this.setAuthToken(newAccessToken);
|
|
93
|
+
if (newRefreshToken) {
|
|
94
|
+
this.setRefreshToken(newRefreshToken);
|
|
95
|
+
}
|
|
96
|
+
if (this.onTokenRefreshed) {
|
|
97
|
+
this.onTokenRefreshed(newAccessToken, newRefreshToken);
|
|
98
|
+
}
|
|
99
|
+
}
|
|
88
100
|
return response;
|
|
89
101
|
},
|
|
90
102
|
async (error) => {
|
|
@@ -180,6 +192,18 @@ var ApiClient = class {
|
|
|
180
192
|
getRefreshToken() {
|
|
181
193
|
return this.refreshToken;
|
|
182
194
|
}
|
|
195
|
+
/**
|
|
196
|
+
* Set callback for when tokens are refreshed by backend
|
|
197
|
+
*/
|
|
198
|
+
setOnTokenRefreshed(callback) {
|
|
199
|
+
this.onTokenRefreshed = callback;
|
|
200
|
+
}
|
|
201
|
+
/**
|
|
202
|
+
* Get the token refresh callback
|
|
203
|
+
*/
|
|
204
|
+
getOnTokenRefreshed() {
|
|
205
|
+
return this.onTokenRefreshed;
|
|
206
|
+
}
|
|
183
207
|
setGymId(gymId) {
|
|
184
208
|
this.axiosInstance.defaults.headers.common["X-Gym-Id"] = gymId;
|
|
185
209
|
}
|
|
@@ -619,42 +643,13 @@ var DashboardResource = class extends BaseResource {
|
|
|
619
643
|
...params
|
|
620
644
|
});
|
|
621
645
|
}
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
this.
|
|
629
|
-
}
|
|
630
|
-
async createEvaluation(data, options) {
|
|
631
|
-
return this.client.post(this.basePath, data, options);
|
|
632
|
-
}
|
|
633
|
-
async getEvaluation(id, options) {
|
|
634
|
-
return this.client.get(`${this.basePath}/${id}`, void 0, options);
|
|
635
|
-
}
|
|
636
|
-
async updateEvaluation(id, data, options) {
|
|
637
|
-
return this.client.put(`${this.basePath}/${id}`, data, options);
|
|
638
|
-
}
|
|
639
|
-
async deleteEvaluation(id, options) {
|
|
640
|
-
return this.client.delete(`${this.basePath}/${id}`, options);
|
|
641
|
-
}
|
|
642
|
-
async getClientEvaluations(clientId, params, options) {
|
|
643
|
-
return this.paginate(
|
|
644
|
-
`${this.basePath}/client/${clientId}`,
|
|
645
|
-
params,
|
|
646
|
-
options
|
|
647
|
-
);
|
|
648
|
-
}
|
|
649
|
-
async getGymEvaluationStats(options) {
|
|
650
|
-
return this.client.get(`${this.basePath}/gym/stats`, void 0, options);
|
|
651
|
-
}
|
|
652
|
-
async generateEvaluationReport(id, options) {
|
|
653
|
-
return this.client.get(
|
|
654
|
-
`${this.basePath}/${id}/report`,
|
|
655
|
-
void 0,
|
|
656
|
-
options
|
|
657
|
-
);
|
|
646
|
+
/**
|
|
647
|
+
* Get detailed list of check-ins within date range
|
|
648
|
+
* @param params Optional date range parameters (defaults to current day)
|
|
649
|
+
* @returns Detailed list of check-ins with client and registeredBy information
|
|
650
|
+
*/
|
|
651
|
+
async getCheckInsList(params) {
|
|
652
|
+
return this.client.get("/dashboard/check-ins/list", params);
|
|
658
653
|
}
|
|
659
654
|
};
|
|
660
655
|
|
|
@@ -718,36 +713,6 @@ var InvitationsResource = class extends BaseResource {
|
|
|
718
713
|
}
|
|
719
714
|
};
|
|
720
715
|
|
|
721
|
-
// src/resources/leads.ts
|
|
722
|
-
var LeadsResource = class extends BaseResource {
|
|
723
|
-
constructor() {
|
|
724
|
-
super(...arguments);
|
|
725
|
-
this.basePath = "leads";
|
|
726
|
-
}
|
|
727
|
-
async createLead(data, options) {
|
|
728
|
-
return this.client.post(this.basePath, data, options);
|
|
729
|
-
}
|
|
730
|
-
async searchLeads(params, options) {
|
|
731
|
-
return this.paginate(this.basePath, params, options);
|
|
732
|
-
}
|
|
733
|
-
async getLead(id, options) {
|
|
734
|
-
return this.client.get(`${this.basePath}/${id}`, void 0, options);
|
|
735
|
-
}
|
|
736
|
-
async updateLead(id, data, options) {
|
|
737
|
-
return this.client.put(`${this.basePath}/${id}`, data, options);
|
|
738
|
-
}
|
|
739
|
-
async getLeadStats(options) {
|
|
740
|
-
return this.client.get(`${this.basePath}/stats/gym`, void 0, options);
|
|
741
|
-
}
|
|
742
|
-
async convertLead(id, options) {
|
|
743
|
-
return this.client.post(
|
|
744
|
-
`${this.basePath}/${id}/convert`,
|
|
745
|
-
void 0,
|
|
746
|
-
options
|
|
747
|
-
);
|
|
748
|
-
}
|
|
749
|
-
};
|
|
750
|
-
|
|
751
716
|
// src/resources/assets.ts
|
|
752
717
|
var AssetsResource = class extends BaseResource {
|
|
753
718
|
/**
|
|
@@ -1009,7 +974,7 @@ var ProductsResource = class extends BaseResource {
|
|
|
1009
974
|
return this.client.post(`${this.basePath}/services`, data, options);
|
|
1010
975
|
}
|
|
1011
976
|
async searchProducts(params, options) {
|
|
1012
|
-
return this.
|
|
977
|
+
return this.client.get(this.basePath, params, options);
|
|
1013
978
|
}
|
|
1014
979
|
async getProduct(id, options) {
|
|
1015
980
|
return this.client.get(`${this.basePath}/${id}`, void 0, options);
|
|
@@ -1027,15 +992,15 @@ var ProductsResource = class extends BaseResource {
|
|
|
1027
992
|
return this.client.patch(`${this.basePath}/${id}/stock`, data, options);
|
|
1028
993
|
}
|
|
1029
994
|
async getLowStockProducts(threshold = 10, options) {
|
|
995
|
+
return this.client.get(`${this.basePath}/low-stock`, { threshold }, options);
|
|
996
|
+
}
|
|
997
|
+
async getProductStockMovements(id, options) {
|
|
1030
998
|
return this.client.get(
|
|
1031
|
-
`${this.basePath}/
|
|
1032
|
-
|
|
999
|
+
`${this.basePath}/${id}/stock-movements`,
|
|
1000
|
+
void 0,
|
|
1033
1001
|
options
|
|
1034
1002
|
);
|
|
1035
1003
|
}
|
|
1036
|
-
async getProductStockMovements(id, options) {
|
|
1037
|
-
return this.client.get(`${this.basePath}/${id}/stock-movements`, void 0, options);
|
|
1038
|
-
}
|
|
1039
1004
|
};
|
|
1040
1005
|
|
|
1041
1006
|
// src/resources/sales.ts
|
|
@@ -1293,7 +1258,7 @@ var PaymentMethodsResource = class extends BaseResource {
|
|
|
1293
1258
|
return this.client.post(this.basePath, data, options);
|
|
1294
1259
|
}
|
|
1295
1260
|
async searchPaymentMethods(params, options) {
|
|
1296
|
-
return this.
|
|
1261
|
+
return this.client.get(this.basePath, params, options);
|
|
1297
1262
|
}
|
|
1298
1263
|
async getPaymentMethod(id, options) {
|
|
1299
1264
|
return this.client.get(`${this.basePath}/${id}`, void 0, options);
|
|
@@ -1448,10 +1413,8 @@ var GymSpaceSdk = class {
|
|
|
1448
1413
|
this.membershipPlans = new MembershipPlansResource(this.client);
|
|
1449
1414
|
this.contracts = new ContractsResource(this.client);
|
|
1450
1415
|
this.dashboard = new DashboardResource(this.client);
|
|
1451
|
-
this.evaluations = new EvaluationsResource(this.client);
|
|
1452
1416
|
this.checkIns = new CheckInsResource(this.client);
|
|
1453
1417
|
this.invitations = new InvitationsResource(this.client);
|
|
1454
|
-
this.leads = new LeadsResource(this.client);
|
|
1455
1418
|
this.assets = new AssetsResource(this.client);
|
|
1456
1419
|
this.files = new FilesResource(this.client);
|
|
1457
1420
|
this.publicCatalog = new PublicCatalogResource(this.client);
|
|
@@ -1513,6 +1476,12 @@ var GymSpaceSdk = class {
|
|
|
1513
1476
|
createAgentFetch() {
|
|
1514
1477
|
return createAgentFetch(this.client, this.expoFetch);
|
|
1515
1478
|
}
|
|
1479
|
+
/**
|
|
1480
|
+
* Set callback for when tokens are refreshed by backend
|
|
1481
|
+
*/
|
|
1482
|
+
setOnTokenRefreshed(callback) {
|
|
1483
|
+
this.client.setOnTokenRefreshed(callback);
|
|
1484
|
+
}
|
|
1516
1485
|
/**
|
|
1517
1486
|
* Get the underlying API client
|
|
1518
1487
|
*/
|
|
@@ -1920,7 +1889,6 @@ exports.EvaluationAssetCategory = EvaluationAssetCategory;
|
|
|
1920
1889
|
exports.EvaluationAssetStage = EvaluationAssetStage;
|
|
1921
1890
|
exports.EvaluationStatus = EvaluationStatus;
|
|
1922
1891
|
exports.EvaluationType = EvaluationType;
|
|
1923
|
-
exports.EvaluationsResource = EvaluationsResource;
|
|
1924
1892
|
exports.FILE_LIMITS = FILE_LIMITS;
|
|
1925
1893
|
exports.FilesResource = FilesResource;
|
|
1926
1894
|
exports.GymSpaceError = GymSpaceError;
|
|
@@ -1931,7 +1899,6 @@ exports.HealthResource = HealthResource;
|
|
|
1931
1899
|
exports.InvitationStatus = InvitationStatus;
|
|
1932
1900
|
exports.InvitationsResource = InvitationsResource;
|
|
1933
1901
|
exports.LeadStatus = LeadStatus;
|
|
1934
|
-
exports.LeadsResource = LeadsResource;
|
|
1935
1902
|
exports.MembershipPlansResource = MembershipPlansResource;
|
|
1936
1903
|
exports.NetworkError = NetworkError;
|
|
1937
1904
|
exports.NotFoundError = NotFoundError;
|