@gymspace/sdk 1.1.0 → 1.1.2
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 +30 -3
- package/dist/index.d.ts +30 -3
- package/dist/index.js +29 -0
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +29 -0
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/client.ts +19 -1
- package/src/models/auth.ts +1 -0
- package/src/models/clients.ts +8 -0
- package/src/models/contracts.ts +1 -1
- package/src/models/sales.ts +6 -0
- package/src/resources/sales.ts +11 -2
- package/src/sdk.ts +14 -1
package/dist/index.d.mts
CHANGED
|
@@ -35,6 +35,8 @@ type PaginationQueryDto = PaginationParams$1;
|
|
|
35
35
|
declare class ApiClient {
|
|
36
36
|
private axiosInstance;
|
|
37
37
|
private config;
|
|
38
|
+
private refreshToken;
|
|
39
|
+
getAccessToken(): string | null;
|
|
38
40
|
constructor(config: GymSpaceConfig);
|
|
39
41
|
private setupInterceptors;
|
|
40
42
|
private handleError;
|
|
@@ -46,6 +48,8 @@ declare class ApiClient {
|
|
|
46
48
|
patch<T>(path: string, data?: any, options?: RequestOptions): Promise<T>;
|
|
47
49
|
delete<T>(path: string, options?: RequestOptions): Promise<T>;
|
|
48
50
|
setAuthToken(token: string): void;
|
|
51
|
+
setRefreshToken(token: string | null): void;
|
|
52
|
+
getRefreshToken(): string | null;
|
|
49
53
|
setGymId(gymId: string): void;
|
|
50
54
|
clearAuth(): void;
|
|
51
55
|
getBaseUrl(): string;
|
|
@@ -140,6 +144,7 @@ interface InvitationValidationResponse {
|
|
|
140
144
|
}
|
|
141
145
|
interface CurrentSessionResponse {
|
|
142
146
|
accessToken: string;
|
|
147
|
+
refreshToken?: string;
|
|
143
148
|
user: {
|
|
144
149
|
id: string;
|
|
145
150
|
email: string;
|
|
@@ -559,6 +564,12 @@ interface Client {
|
|
|
559
564
|
evaluations: number;
|
|
560
565
|
checkIns: number;
|
|
561
566
|
};
|
|
567
|
+
hasCheckedInToday?: boolean;
|
|
568
|
+
lastCheckIn?: {
|
|
569
|
+
id: string;
|
|
570
|
+
timestamp: string;
|
|
571
|
+
createdAt: string;
|
|
572
|
+
};
|
|
562
573
|
}
|
|
563
574
|
interface ClientStat {
|
|
564
575
|
key: string;
|
|
@@ -602,6 +613,8 @@ interface SearchClientsParams extends PaginationQueryDto {
|
|
|
602
613
|
clientNumber?: string;
|
|
603
614
|
documentId?: string;
|
|
604
615
|
includeContractStatus?: boolean;
|
|
616
|
+
notCheckedInToday?: boolean;
|
|
617
|
+
checkedInToday?: boolean;
|
|
605
618
|
}
|
|
606
619
|
interface ClientSearchForCheckInResponse {
|
|
607
620
|
data: Client[];
|
|
@@ -743,7 +756,7 @@ interface Contract {
|
|
|
743
756
|
status: ContractStatus;
|
|
744
757
|
price: number;
|
|
745
758
|
discountPercentage?: number;
|
|
746
|
-
|
|
759
|
+
finalAmount: number;
|
|
747
760
|
freezeStartDate?: string;
|
|
748
761
|
freezeEndDate?: string;
|
|
749
762
|
receiptIds?: string[];
|
|
@@ -1720,6 +1733,11 @@ interface UpdateSaleDto {
|
|
|
1720
1733
|
interface UpdatePaymentStatusDto {
|
|
1721
1734
|
paymentStatus: 'paid' | 'unpaid';
|
|
1722
1735
|
}
|
|
1736
|
+
interface PaySaleDto {
|
|
1737
|
+
paymentMethodId: string;
|
|
1738
|
+
notes?: string;
|
|
1739
|
+
fileIds?: string[];
|
|
1740
|
+
}
|
|
1723
1741
|
interface Sale {
|
|
1724
1742
|
id: string;
|
|
1725
1743
|
gymId: string;
|
|
@@ -1824,6 +1842,7 @@ declare class SalesResource extends BaseResource {
|
|
|
1824
1842
|
getSale(id: string, options?: RequestOptions): Promise<Sale>;
|
|
1825
1843
|
updateSale(id: string, data: UpdateSaleDto, options?: RequestOptions): Promise<Sale>;
|
|
1826
1844
|
updatePaymentStatus(id: string, paymentStatus: 'paid' | 'unpaid', options?: RequestOptions): Promise<Sale>;
|
|
1845
|
+
paySale(id: string, data: PaySaleDto, options?: RequestOptions): Promise<Sale>;
|
|
1827
1846
|
deleteSale(id: string, options?: RequestOptions): Promise<void>;
|
|
1828
1847
|
getSalesStats(startDate?: string, endDate?: string, options?: RequestOptions): Promise<SalesStats>;
|
|
1829
1848
|
getTopSellingProducts(limit?: number, startDate?: string, endDate?: string, options?: RequestOptions): Promise<TopSellingProduct[]>;
|
|
@@ -1993,7 +2012,7 @@ declare class PaymentMethodsResource extends BaseResource {
|
|
|
1993
2012
|
}
|
|
1994
2013
|
|
|
1995
2014
|
declare class GymSpaceSdk {
|
|
1996
|
-
|
|
2015
|
+
client: ApiClient;
|
|
1997
2016
|
auth: AuthResource;
|
|
1998
2017
|
organizations: OrganizationsResource;
|
|
1999
2018
|
gyms: GymsResource;
|
|
@@ -2021,6 +2040,14 @@ declare class GymSpaceSdk {
|
|
|
2021
2040
|
* Set the authentication token
|
|
2022
2041
|
*/
|
|
2023
2042
|
setAuthToken(token: string): void;
|
|
2043
|
+
/**
|
|
2044
|
+
* Set the refresh token
|
|
2045
|
+
*/
|
|
2046
|
+
setRefreshToken(token: string | null): void;
|
|
2047
|
+
/**
|
|
2048
|
+
* Get the current refresh token
|
|
2049
|
+
*/
|
|
2050
|
+
getRefreshToken(): string | null;
|
|
2024
2051
|
/**
|
|
2025
2052
|
* Set the current gym context
|
|
2026
2053
|
*/
|
|
@@ -2062,4 +2089,4 @@ declare class NetworkError extends GymSpaceError {
|
|
|
2062
2089
|
constructor(message?: string);
|
|
2063
2090
|
}
|
|
2064
2091
|
|
|
2065
|
-
export { type AcceptInvitationDto, type AffiliateOrganizationDto, type Amenities, ApiClient, type ApiResponse, type AssetResponseDto, AssetsResource, AuthResource, AuthenticationError, AuthorizationError, type AvailablePlanDto, type BusinessHours, 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 ClientSearchForCheckInResponse, type ClientStat, type ClientStats, ClientsResource, type CompleteGuidedSetupData, type ConfigureFeaturesData, type Contract, ContractsResource, type ContractsRevenue, type CreateCheckInDto, type CreateClientDto, type CreateContractDto, type CreateEvaluationDto, type CreateGymDto, type CreateInvitationDto, type CreateLeadDto, type CreateMembershipPlanDto, type CreatePaymentMethodDto, type CreateProductCategoryDto, type CreateProductDto, type CreateSaleDto, type CreateServiceDto, type CreateSupplierDto, type CurrentSessionResponse, type CurrentlyInGymResponse, type CustomerSalesReport, DashboardResource, type DashboardStats, type DateRangeParams, type DaySchedule, type Debts, type Evaluation, type EvaluationHealthMetrics, type EvaluationMeasurements, type EvaluationPerformanceMetrics, type EvaluationReport, type EvaluationSystemFeatures, EvaluationsResource, type ExpiringContract, type FileResponseDto, FilesResource, type FreezeContractDto, type GetCheckInStatsParams, type GetClientCheckInHistoryParams, type GetClientEvaluationsParams, 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 Invitation, type InvitationValidationResponse, InvitationsResource, type Lead, type LeadManagementFeatures, type LeadStats, LeadsResource, 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 OrganizationStats, type OrganizationWithDetails, OrganizationsResource, type PaginatedResponse, type PaginatedResponseDto, type PaginationParams, type PaginationQueryDto, type PaymentMethod, type PaymentMethodStats, PaymentMethodsResource, 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, type Sale, type SaleItem, type SaleItemDto, SalesResource, type SalesRevenue, type SalesStats, type SearchCatalogParams, type SearchCheckInsParams, type SearchClientsParams, type SearchLeadsParams, type SearchPaymentMethodsParams, type SearchProductsParams, type SearchSalesParams, type SearchSuppliersParams, type SocialMedia, type StartOnboardingData, type StartOnboardingResponse, type StockMovement, type Subscription, type SubscriptionPlan, type SubscriptionStatusDto, SubscriptionsResource, type Supplier, SuppliersResource, type SuppliersStats, type TimeSlot, type TopSellingProduct, type UpdateClientDto, type UpdateEvaluationDto, type UpdateGymDto, type UpdateGymScheduleDto, type UpdateGymSettingsData, type UpdateGymSocialMediaDto, type UpdateLeadDto, type UpdateMembershipPlanDto, type UpdateOrganizationDto, type UpdatePaymentMethodDto, type UpdatePaymentStatusDto, type UpdateProductCategoryDto, type UpdateProductDto, type UpdateProfileDto, type UpdateSaleDto, type UpdateStockDto, type UpdateSupplierDto, type UploadAssetDto, type UploadFileDto, type UserProfileDto, UsersResource, ValidationError, type VerifyEmailDto, type VerifyResetCodeDto, type VerifyResetCodeResponseDto, type WeeklySchedule };
|
|
2092
|
+
export { type AcceptInvitationDto, type AffiliateOrganizationDto, type Amenities, ApiClient, type ApiResponse, type AssetResponseDto, AssetsResource, AuthResource, AuthenticationError, AuthorizationError, type AvailablePlanDto, type BusinessHours, 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 ClientSearchForCheckInResponse, type ClientStat, type ClientStats, ClientsResource, type CompleteGuidedSetupData, type ConfigureFeaturesData, type Contract, ContractsResource, type ContractsRevenue, type CreateCheckInDto, type CreateClientDto, type CreateContractDto, type CreateEvaluationDto, type CreateGymDto, type CreateInvitationDto, type CreateLeadDto, type CreateMembershipPlanDto, type CreatePaymentMethodDto, type CreateProductCategoryDto, type CreateProductDto, type CreateSaleDto, type CreateServiceDto, type CreateSupplierDto, type CurrentSessionResponse, type CurrentlyInGymResponse, type CustomerSalesReport, DashboardResource, type DashboardStats, type DateRangeParams, type DaySchedule, type Debts, type Evaluation, type EvaluationHealthMetrics, type EvaluationMeasurements, type EvaluationPerformanceMetrics, type EvaluationReport, type EvaluationSystemFeatures, EvaluationsResource, type ExpiringContract, type FileResponseDto, FilesResource, type FreezeContractDto, type GetCheckInStatsParams, type GetClientCheckInHistoryParams, type GetClientEvaluationsParams, 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 Invitation, type InvitationValidationResponse, InvitationsResource, type Lead, type LeadManagementFeatures, type LeadStats, LeadsResource, 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 OrganizationStats, type OrganizationWithDetails, OrganizationsResource, type PaginatedResponse, type PaginatedResponseDto, type PaginationParams, type PaginationQueryDto, type PaySaleDto, type PaymentMethod, type PaymentMethodStats, PaymentMethodsResource, 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, type Sale, type SaleItem, type SaleItemDto, SalesResource, type SalesRevenue, type SalesStats, type SearchCatalogParams, type SearchCheckInsParams, type SearchClientsParams, type SearchLeadsParams, type SearchPaymentMethodsParams, type SearchProductsParams, type SearchSalesParams, type SearchSuppliersParams, type SocialMedia, type StartOnboardingData, type StartOnboardingResponse, type StockMovement, type Subscription, type SubscriptionPlan, type SubscriptionStatusDto, SubscriptionsResource, type Supplier, SuppliersResource, type SuppliersStats, type TimeSlot, type TopSellingProduct, type UpdateClientDto, type UpdateEvaluationDto, type UpdateGymDto, type UpdateGymScheduleDto, type UpdateGymSettingsData, type UpdateGymSocialMediaDto, type UpdateLeadDto, type UpdateMembershipPlanDto, type UpdateOrganizationDto, type UpdatePaymentMethodDto, type UpdatePaymentStatusDto, type UpdateProductCategoryDto, type UpdateProductDto, type UpdateProfileDto, type UpdateSaleDto, type UpdateStockDto, type UpdateSupplierDto, type UploadAssetDto, type UploadFileDto, type UserProfileDto, UsersResource, ValidationError, type VerifyEmailDto, type VerifyResetCodeDto, type VerifyResetCodeResponseDto, type WeeklySchedule };
|
package/dist/index.d.ts
CHANGED
|
@@ -35,6 +35,8 @@ type PaginationQueryDto = PaginationParams$1;
|
|
|
35
35
|
declare class ApiClient {
|
|
36
36
|
private axiosInstance;
|
|
37
37
|
private config;
|
|
38
|
+
private refreshToken;
|
|
39
|
+
getAccessToken(): string | null;
|
|
38
40
|
constructor(config: GymSpaceConfig);
|
|
39
41
|
private setupInterceptors;
|
|
40
42
|
private handleError;
|
|
@@ -46,6 +48,8 @@ declare class ApiClient {
|
|
|
46
48
|
patch<T>(path: string, data?: any, options?: RequestOptions): Promise<T>;
|
|
47
49
|
delete<T>(path: string, options?: RequestOptions): Promise<T>;
|
|
48
50
|
setAuthToken(token: string): void;
|
|
51
|
+
setRefreshToken(token: string | null): void;
|
|
52
|
+
getRefreshToken(): string | null;
|
|
49
53
|
setGymId(gymId: string): void;
|
|
50
54
|
clearAuth(): void;
|
|
51
55
|
getBaseUrl(): string;
|
|
@@ -140,6 +144,7 @@ interface InvitationValidationResponse {
|
|
|
140
144
|
}
|
|
141
145
|
interface CurrentSessionResponse {
|
|
142
146
|
accessToken: string;
|
|
147
|
+
refreshToken?: string;
|
|
143
148
|
user: {
|
|
144
149
|
id: string;
|
|
145
150
|
email: string;
|
|
@@ -559,6 +564,12 @@ interface Client {
|
|
|
559
564
|
evaluations: number;
|
|
560
565
|
checkIns: number;
|
|
561
566
|
};
|
|
567
|
+
hasCheckedInToday?: boolean;
|
|
568
|
+
lastCheckIn?: {
|
|
569
|
+
id: string;
|
|
570
|
+
timestamp: string;
|
|
571
|
+
createdAt: string;
|
|
572
|
+
};
|
|
562
573
|
}
|
|
563
574
|
interface ClientStat {
|
|
564
575
|
key: string;
|
|
@@ -602,6 +613,8 @@ interface SearchClientsParams extends PaginationQueryDto {
|
|
|
602
613
|
clientNumber?: string;
|
|
603
614
|
documentId?: string;
|
|
604
615
|
includeContractStatus?: boolean;
|
|
616
|
+
notCheckedInToday?: boolean;
|
|
617
|
+
checkedInToday?: boolean;
|
|
605
618
|
}
|
|
606
619
|
interface ClientSearchForCheckInResponse {
|
|
607
620
|
data: Client[];
|
|
@@ -743,7 +756,7 @@ interface Contract {
|
|
|
743
756
|
status: ContractStatus;
|
|
744
757
|
price: number;
|
|
745
758
|
discountPercentage?: number;
|
|
746
|
-
|
|
759
|
+
finalAmount: number;
|
|
747
760
|
freezeStartDate?: string;
|
|
748
761
|
freezeEndDate?: string;
|
|
749
762
|
receiptIds?: string[];
|
|
@@ -1720,6 +1733,11 @@ interface UpdateSaleDto {
|
|
|
1720
1733
|
interface UpdatePaymentStatusDto {
|
|
1721
1734
|
paymentStatus: 'paid' | 'unpaid';
|
|
1722
1735
|
}
|
|
1736
|
+
interface PaySaleDto {
|
|
1737
|
+
paymentMethodId: string;
|
|
1738
|
+
notes?: string;
|
|
1739
|
+
fileIds?: string[];
|
|
1740
|
+
}
|
|
1723
1741
|
interface Sale {
|
|
1724
1742
|
id: string;
|
|
1725
1743
|
gymId: string;
|
|
@@ -1824,6 +1842,7 @@ declare class SalesResource extends BaseResource {
|
|
|
1824
1842
|
getSale(id: string, options?: RequestOptions): Promise<Sale>;
|
|
1825
1843
|
updateSale(id: string, data: UpdateSaleDto, options?: RequestOptions): Promise<Sale>;
|
|
1826
1844
|
updatePaymentStatus(id: string, paymentStatus: 'paid' | 'unpaid', options?: RequestOptions): Promise<Sale>;
|
|
1845
|
+
paySale(id: string, data: PaySaleDto, options?: RequestOptions): Promise<Sale>;
|
|
1827
1846
|
deleteSale(id: string, options?: RequestOptions): Promise<void>;
|
|
1828
1847
|
getSalesStats(startDate?: string, endDate?: string, options?: RequestOptions): Promise<SalesStats>;
|
|
1829
1848
|
getTopSellingProducts(limit?: number, startDate?: string, endDate?: string, options?: RequestOptions): Promise<TopSellingProduct[]>;
|
|
@@ -1993,7 +2012,7 @@ declare class PaymentMethodsResource extends BaseResource {
|
|
|
1993
2012
|
}
|
|
1994
2013
|
|
|
1995
2014
|
declare class GymSpaceSdk {
|
|
1996
|
-
|
|
2015
|
+
client: ApiClient;
|
|
1997
2016
|
auth: AuthResource;
|
|
1998
2017
|
organizations: OrganizationsResource;
|
|
1999
2018
|
gyms: GymsResource;
|
|
@@ -2021,6 +2040,14 @@ declare class GymSpaceSdk {
|
|
|
2021
2040
|
* Set the authentication token
|
|
2022
2041
|
*/
|
|
2023
2042
|
setAuthToken(token: string): void;
|
|
2043
|
+
/**
|
|
2044
|
+
* Set the refresh token
|
|
2045
|
+
*/
|
|
2046
|
+
setRefreshToken(token: string | null): void;
|
|
2047
|
+
/**
|
|
2048
|
+
* Get the current refresh token
|
|
2049
|
+
*/
|
|
2050
|
+
getRefreshToken(): string | null;
|
|
2024
2051
|
/**
|
|
2025
2052
|
* Set the current gym context
|
|
2026
2053
|
*/
|
|
@@ -2062,4 +2089,4 @@ declare class NetworkError extends GymSpaceError {
|
|
|
2062
2089
|
constructor(message?: string);
|
|
2063
2090
|
}
|
|
2064
2091
|
|
|
2065
|
-
export { type AcceptInvitationDto, type AffiliateOrganizationDto, type Amenities, ApiClient, type ApiResponse, type AssetResponseDto, AssetsResource, AuthResource, AuthenticationError, AuthorizationError, type AvailablePlanDto, type BusinessHours, 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 ClientSearchForCheckInResponse, type ClientStat, type ClientStats, ClientsResource, type CompleteGuidedSetupData, type ConfigureFeaturesData, type Contract, ContractsResource, type ContractsRevenue, type CreateCheckInDto, type CreateClientDto, type CreateContractDto, type CreateEvaluationDto, type CreateGymDto, type CreateInvitationDto, type CreateLeadDto, type CreateMembershipPlanDto, type CreatePaymentMethodDto, type CreateProductCategoryDto, type CreateProductDto, type CreateSaleDto, type CreateServiceDto, type CreateSupplierDto, type CurrentSessionResponse, type CurrentlyInGymResponse, type CustomerSalesReport, DashboardResource, type DashboardStats, type DateRangeParams, type DaySchedule, type Debts, type Evaluation, type EvaluationHealthMetrics, type EvaluationMeasurements, type EvaluationPerformanceMetrics, type EvaluationReport, type EvaluationSystemFeatures, EvaluationsResource, type ExpiringContract, type FileResponseDto, FilesResource, type FreezeContractDto, type GetCheckInStatsParams, type GetClientCheckInHistoryParams, type GetClientEvaluationsParams, 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 Invitation, type InvitationValidationResponse, InvitationsResource, type Lead, type LeadManagementFeatures, type LeadStats, LeadsResource, 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 OrganizationStats, type OrganizationWithDetails, OrganizationsResource, type PaginatedResponse, type PaginatedResponseDto, type PaginationParams, type PaginationQueryDto, type PaymentMethod, type PaymentMethodStats, PaymentMethodsResource, 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, type Sale, type SaleItem, type SaleItemDto, SalesResource, type SalesRevenue, type SalesStats, type SearchCatalogParams, type SearchCheckInsParams, type SearchClientsParams, type SearchLeadsParams, type SearchPaymentMethodsParams, type SearchProductsParams, type SearchSalesParams, type SearchSuppliersParams, type SocialMedia, type StartOnboardingData, type StartOnboardingResponse, type StockMovement, type Subscription, type SubscriptionPlan, type SubscriptionStatusDto, SubscriptionsResource, type Supplier, SuppliersResource, type SuppliersStats, type TimeSlot, type TopSellingProduct, type UpdateClientDto, type UpdateEvaluationDto, type UpdateGymDto, type UpdateGymScheduleDto, type UpdateGymSettingsData, type UpdateGymSocialMediaDto, type UpdateLeadDto, type UpdateMembershipPlanDto, type UpdateOrganizationDto, type UpdatePaymentMethodDto, type UpdatePaymentStatusDto, type UpdateProductCategoryDto, type UpdateProductDto, type UpdateProfileDto, type UpdateSaleDto, type UpdateStockDto, type UpdateSupplierDto, type UploadAssetDto, type UploadFileDto, type UserProfileDto, UsersResource, ValidationError, type VerifyEmailDto, type VerifyResetCodeDto, type VerifyResetCodeResponseDto, type WeeklySchedule };
|
|
2092
|
+
export { type AcceptInvitationDto, type AffiliateOrganizationDto, type Amenities, ApiClient, type ApiResponse, type AssetResponseDto, AssetsResource, AuthResource, AuthenticationError, AuthorizationError, type AvailablePlanDto, type BusinessHours, 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 ClientSearchForCheckInResponse, type ClientStat, type ClientStats, ClientsResource, type CompleteGuidedSetupData, type ConfigureFeaturesData, type Contract, ContractsResource, type ContractsRevenue, type CreateCheckInDto, type CreateClientDto, type CreateContractDto, type CreateEvaluationDto, type CreateGymDto, type CreateInvitationDto, type CreateLeadDto, type CreateMembershipPlanDto, type CreatePaymentMethodDto, type CreateProductCategoryDto, type CreateProductDto, type CreateSaleDto, type CreateServiceDto, type CreateSupplierDto, type CurrentSessionResponse, type CurrentlyInGymResponse, type CustomerSalesReport, DashboardResource, type DashboardStats, type DateRangeParams, type DaySchedule, type Debts, type Evaluation, type EvaluationHealthMetrics, type EvaluationMeasurements, type EvaluationPerformanceMetrics, type EvaluationReport, type EvaluationSystemFeatures, EvaluationsResource, type ExpiringContract, type FileResponseDto, FilesResource, type FreezeContractDto, type GetCheckInStatsParams, type GetClientCheckInHistoryParams, type GetClientEvaluationsParams, 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 Invitation, type InvitationValidationResponse, InvitationsResource, type Lead, type LeadManagementFeatures, type LeadStats, LeadsResource, 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 OrganizationStats, type OrganizationWithDetails, OrganizationsResource, type PaginatedResponse, type PaginatedResponseDto, type PaginationParams, type PaginationQueryDto, type PaySaleDto, type PaymentMethod, type PaymentMethodStats, PaymentMethodsResource, 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, type Sale, type SaleItem, type SaleItemDto, SalesResource, type SalesRevenue, type SalesStats, type SearchCatalogParams, type SearchCheckInsParams, type SearchClientsParams, type SearchLeadsParams, type SearchPaymentMethodsParams, type SearchProductsParams, type SearchSalesParams, type SearchSuppliersParams, type SocialMedia, type StartOnboardingData, type StartOnboardingResponse, type StockMovement, type Subscription, type SubscriptionPlan, type SubscriptionStatusDto, SubscriptionsResource, type Supplier, SuppliersResource, type SuppliersStats, type TimeSlot, type TopSellingProduct, type UpdateClientDto, type UpdateEvaluationDto, type UpdateGymDto, type UpdateGymScheduleDto, type UpdateGymSettingsData, type UpdateGymSocialMediaDto, type UpdateLeadDto, type UpdateMembershipPlanDto, type UpdateOrganizationDto, type UpdatePaymentMethodDto, type UpdatePaymentStatusDto, type UpdateProductCategoryDto, type UpdateProductDto, type UpdateProfileDto, type UpdateSaleDto, type UpdateStockDto, type UpdateSupplierDto, type UploadAssetDto, type UploadFileDto, type UserProfileDto, UsersResource, ValidationError, type VerifyEmailDto, type VerifyResetCodeDto, type VerifyResetCodeResponseDto, type WeeklySchedule };
|
package/dist/index.js
CHANGED
|
@@ -53,6 +53,7 @@ var NetworkError = class extends GymSpaceError {
|
|
|
53
53
|
// src/client.ts
|
|
54
54
|
var ApiClient = class {
|
|
55
55
|
constructor(config) {
|
|
56
|
+
this.refreshToken = null;
|
|
56
57
|
this.config = config;
|
|
57
58
|
this.axiosInstance = axios__default.default.create({
|
|
58
59
|
baseURL: config.baseURL,
|
|
@@ -64,12 +65,18 @@ var ApiClient = class {
|
|
|
64
65
|
});
|
|
65
66
|
this.setupInterceptors();
|
|
66
67
|
}
|
|
68
|
+
getAccessToken() {
|
|
69
|
+
return this.config.apiKey || null;
|
|
70
|
+
}
|
|
67
71
|
setupInterceptors() {
|
|
68
72
|
this.axiosInstance.interceptors.request.use(
|
|
69
73
|
(config) => {
|
|
70
74
|
if (this.config.apiKey && config.headers) {
|
|
71
75
|
config.headers["Authorization"] = `Bearer ${this.config.apiKey}`;
|
|
72
76
|
}
|
|
77
|
+
if (this.refreshToken && config.url?.includes("current-session") && config.headers) {
|
|
78
|
+
config.headers["X-Refresh-Token"] = this.refreshToken;
|
|
79
|
+
}
|
|
73
80
|
return config;
|
|
74
81
|
},
|
|
75
82
|
(error) => {
|
|
@@ -167,11 +174,18 @@ var ApiClient = class {
|
|
|
167
174
|
setAuthToken(token) {
|
|
168
175
|
this.config.apiKey = token;
|
|
169
176
|
}
|
|
177
|
+
setRefreshToken(token) {
|
|
178
|
+
this.refreshToken = token;
|
|
179
|
+
}
|
|
180
|
+
getRefreshToken() {
|
|
181
|
+
return this.refreshToken;
|
|
182
|
+
}
|
|
170
183
|
setGymId(gymId) {
|
|
171
184
|
this.axiosInstance.defaults.headers.common["X-Gym-Id"] = gymId;
|
|
172
185
|
}
|
|
173
186
|
clearAuth() {
|
|
174
187
|
delete this.config.apiKey;
|
|
188
|
+
this.refreshToken = null;
|
|
175
189
|
delete this.axiosInstance.defaults.headers.common["Authorization"];
|
|
176
190
|
delete this.axiosInstance.defaults.headers.common["X-Gym-Id"];
|
|
177
191
|
}
|
|
@@ -957,6 +971,9 @@ var SalesResource = class extends BaseResource {
|
|
|
957
971
|
async updatePaymentStatus(id, paymentStatus, options) {
|
|
958
972
|
return this.client.put(`${this.basePath}/${id}/payment-status`, { paymentStatus }, options);
|
|
959
973
|
}
|
|
974
|
+
async paySale(id, data, options) {
|
|
975
|
+
return this.client.post(`${this.basePath}/${id}/payment`, data, options);
|
|
976
|
+
}
|
|
960
977
|
async deleteSale(id, options) {
|
|
961
978
|
return this.client.delete(`${this.basePath}/${id}`, options);
|
|
962
979
|
}
|
|
@@ -1147,6 +1164,18 @@ var GymSpaceSdk = class {
|
|
|
1147
1164
|
setAuthToken(token) {
|
|
1148
1165
|
this.client.setAuthToken(token);
|
|
1149
1166
|
}
|
|
1167
|
+
/**
|
|
1168
|
+
* Set the refresh token
|
|
1169
|
+
*/
|
|
1170
|
+
setRefreshToken(token) {
|
|
1171
|
+
this.client.setRefreshToken(token);
|
|
1172
|
+
}
|
|
1173
|
+
/**
|
|
1174
|
+
* Get the current refresh token
|
|
1175
|
+
*/
|
|
1176
|
+
getRefreshToken() {
|
|
1177
|
+
return this.client.getRefreshToken();
|
|
1178
|
+
}
|
|
1150
1179
|
/**
|
|
1151
1180
|
* Set the current gym context
|
|
1152
1181
|
*/
|