@gymspace/sdk 1.1.0 → 1.1.1
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 +20 -2
- package/dist/index.d.ts +20 -2
- package/dist/index.js +26 -0
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +26 -0
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/client.ts +15 -0
- package/src/models/auth.ts +1 -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 +13 -0
package/dist/index.d.mts
CHANGED
|
@@ -35,6 +35,7 @@ type PaginationQueryDto = PaginationParams$1;
|
|
|
35
35
|
declare class ApiClient {
|
|
36
36
|
private axiosInstance;
|
|
37
37
|
private config;
|
|
38
|
+
private refreshToken;
|
|
38
39
|
constructor(config: GymSpaceConfig);
|
|
39
40
|
private setupInterceptors;
|
|
40
41
|
private handleError;
|
|
@@ -46,6 +47,8 @@ declare class ApiClient {
|
|
|
46
47
|
patch<T>(path: string, data?: any, options?: RequestOptions): Promise<T>;
|
|
47
48
|
delete<T>(path: string, options?: RequestOptions): Promise<T>;
|
|
48
49
|
setAuthToken(token: string): void;
|
|
50
|
+
setRefreshToken(token: string | null): void;
|
|
51
|
+
getRefreshToken(): string | null;
|
|
49
52
|
setGymId(gymId: string): void;
|
|
50
53
|
clearAuth(): void;
|
|
51
54
|
getBaseUrl(): string;
|
|
@@ -140,6 +143,7 @@ interface InvitationValidationResponse {
|
|
|
140
143
|
}
|
|
141
144
|
interface CurrentSessionResponse {
|
|
142
145
|
accessToken: string;
|
|
146
|
+
refreshToken?: string;
|
|
143
147
|
user: {
|
|
144
148
|
id: string;
|
|
145
149
|
email: string;
|
|
@@ -743,7 +747,7 @@ interface Contract {
|
|
|
743
747
|
status: ContractStatus;
|
|
744
748
|
price: number;
|
|
745
749
|
discountPercentage?: number;
|
|
746
|
-
|
|
750
|
+
finalAmount: number;
|
|
747
751
|
freezeStartDate?: string;
|
|
748
752
|
freezeEndDate?: string;
|
|
749
753
|
receiptIds?: string[];
|
|
@@ -1720,6 +1724,11 @@ interface UpdateSaleDto {
|
|
|
1720
1724
|
interface UpdatePaymentStatusDto {
|
|
1721
1725
|
paymentStatus: 'paid' | 'unpaid';
|
|
1722
1726
|
}
|
|
1727
|
+
interface PaySaleDto {
|
|
1728
|
+
paymentMethodId: string;
|
|
1729
|
+
notes?: string;
|
|
1730
|
+
fileIds?: string[];
|
|
1731
|
+
}
|
|
1723
1732
|
interface Sale {
|
|
1724
1733
|
id: string;
|
|
1725
1734
|
gymId: string;
|
|
@@ -1824,6 +1833,7 @@ declare class SalesResource extends BaseResource {
|
|
|
1824
1833
|
getSale(id: string, options?: RequestOptions): Promise<Sale>;
|
|
1825
1834
|
updateSale(id: string, data: UpdateSaleDto, options?: RequestOptions): Promise<Sale>;
|
|
1826
1835
|
updatePaymentStatus(id: string, paymentStatus: 'paid' | 'unpaid', options?: RequestOptions): Promise<Sale>;
|
|
1836
|
+
paySale(id: string, data: PaySaleDto, options?: RequestOptions): Promise<Sale>;
|
|
1827
1837
|
deleteSale(id: string, options?: RequestOptions): Promise<void>;
|
|
1828
1838
|
getSalesStats(startDate?: string, endDate?: string, options?: RequestOptions): Promise<SalesStats>;
|
|
1829
1839
|
getTopSellingProducts(limit?: number, startDate?: string, endDate?: string, options?: RequestOptions): Promise<TopSellingProduct[]>;
|
|
@@ -2021,6 +2031,14 @@ declare class GymSpaceSdk {
|
|
|
2021
2031
|
* Set the authentication token
|
|
2022
2032
|
*/
|
|
2023
2033
|
setAuthToken(token: string): void;
|
|
2034
|
+
/**
|
|
2035
|
+
* Set the refresh token
|
|
2036
|
+
*/
|
|
2037
|
+
setRefreshToken(token: string | null): void;
|
|
2038
|
+
/**
|
|
2039
|
+
* Get the current refresh token
|
|
2040
|
+
*/
|
|
2041
|
+
getRefreshToken(): string | null;
|
|
2024
2042
|
/**
|
|
2025
2043
|
* Set the current gym context
|
|
2026
2044
|
*/
|
|
@@ -2062,4 +2080,4 @@ declare class NetworkError extends GymSpaceError {
|
|
|
2062
2080
|
constructor(message?: string);
|
|
2063
2081
|
}
|
|
2064
2082
|
|
|
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 };
|
|
2083
|
+
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,7 @@ type PaginationQueryDto = PaginationParams$1;
|
|
|
35
35
|
declare class ApiClient {
|
|
36
36
|
private axiosInstance;
|
|
37
37
|
private config;
|
|
38
|
+
private refreshToken;
|
|
38
39
|
constructor(config: GymSpaceConfig);
|
|
39
40
|
private setupInterceptors;
|
|
40
41
|
private handleError;
|
|
@@ -46,6 +47,8 @@ declare class ApiClient {
|
|
|
46
47
|
patch<T>(path: string, data?: any, options?: RequestOptions): Promise<T>;
|
|
47
48
|
delete<T>(path: string, options?: RequestOptions): Promise<T>;
|
|
48
49
|
setAuthToken(token: string): void;
|
|
50
|
+
setRefreshToken(token: string | null): void;
|
|
51
|
+
getRefreshToken(): string | null;
|
|
49
52
|
setGymId(gymId: string): void;
|
|
50
53
|
clearAuth(): void;
|
|
51
54
|
getBaseUrl(): string;
|
|
@@ -140,6 +143,7 @@ interface InvitationValidationResponse {
|
|
|
140
143
|
}
|
|
141
144
|
interface CurrentSessionResponse {
|
|
142
145
|
accessToken: string;
|
|
146
|
+
refreshToken?: string;
|
|
143
147
|
user: {
|
|
144
148
|
id: string;
|
|
145
149
|
email: string;
|
|
@@ -743,7 +747,7 @@ interface Contract {
|
|
|
743
747
|
status: ContractStatus;
|
|
744
748
|
price: number;
|
|
745
749
|
discountPercentage?: number;
|
|
746
|
-
|
|
750
|
+
finalAmount: number;
|
|
747
751
|
freezeStartDate?: string;
|
|
748
752
|
freezeEndDate?: string;
|
|
749
753
|
receiptIds?: string[];
|
|
@@ -1720,6 +1724,11 @@ interface UpdateSaleDto {
|
|
|
1720
1724
|
interface UpdatePaymentStatusDto {
|
|
1721
1725
|
paymentStatus: 'paid' | 'unpaid';
|
|
1722
1726
|
}
|
|
1727
|
+
interface PaySaleDto {
|
|
1728
|
+
paymentMethodId: string;
|
|
1729
|
+
notes?: string;
|
|
1730
|
+
fileIds?: string[];
|
|
1731
|
+
}
|
|
1723
1732
|
interface Sale {
|
|
1724
1733
|
id: string;
|
|
1725
1734
|
gymId: string;
|
|
@@ -1824,6 +1833,7 @@ declare class SalesResource extends BaseResource {
|
|
|
1824
1833
|
getSale(id: string, options?: RequestOptions): Promise<Sale>;
|
|
1825
1834
|
updateSale(id: string, data: UpdateSaleDto, options?: RequestOptions): Promise<Sale>;
|
|
1826
1835
|
updatePaymentStatus(id: string, paymentStatus: 'paid' | 'unpaid', options?: RequestOptions): Promise<Sale>;
|
|
1836
|
+
paySale(id: string, data: PaySaleDto, options?: RequestOptions): Promise<Sale>;
|
|
1827
1837
|
deleteSale(id: string, options?: RequestOptions): Promise<void>;
|
|
1828
1838
|
getSalesStats(startDate?: string, endDate?: string, options?: RequestOptions): Promise<SalesStats>;
|
|
1829
1839
|
getTopSellingProducts(limit?: number, startDate?: string, endDate?: string, options?: RequestOptions): Promise<TopSellingProduct[]>;
|
|
@@ -2021,6 +2031,14 @@ declare class GymSpaceSdk {
|
|
|
2021
2031
|
* Set the authentication token
|
|
2022
2032
|
*/
|
|
2023
2033
|
setAuthToken(token: string): void;
|
|
2034
|
+
/**
|
|
2035
|
+
* Set the refresh token
|
|
2036
|
+
*/
|
|
2037
|
+
setRefreshToken(token: string | null): void;
|
|
2038
|
+
/**
|
|
2039
|
+
* Get the current refresh token
|
|
2040
|
+
*/
|
|
2041
|
+
getRefreshToken(): string | null;
|
|
2024
2042
|
/**
|
|
2025
2043
|
* Set the current gym context
|
|
2026
2044
|
*/
|
|
@@ -2062,4 +2080,4 @@ declare class NetworkError extends GymSpaceError {
|
|
|
2062
2080
|
constructor(message?: string);
|
|
2063
2081
|
}
|
|
2064
2082
|
|
|
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 };
|
|
2083
|
+
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,
|
|
@@ -70,6 +71,9 @@ var ApiClient = class {
|
|
|
70
71
|
if (this.config.apiKey && config.headers) {
|
|
71
72
|
config.headers["Authorization"] = `Bearer ${this.config.apiKey}`;
|
|
72
73
|
}
|
|
74
|
+
if (this.refreshToken && config.url?.includes("current-session") && config.headers) {
|
|
75
|
+
config.headers["X-Refresh-Token"] = this.refreshToken;
|
|
76
|
+
}
|
|
73
77
|
return config;
|
|
74
78
|
},
|
|
75
79
|
(error) => {
|
|
@@ -167,11 +171,18 @@ var ApiClient = class {
|
|
|
167
171
|
setAuthToken(token) {
|
|
168
172
|
this.config.apiKey = token;
|
|
169
173
|
}
|
|
174
|
+
setRefreshToken(token) {
|
|
175
|
+
this.refreshToken = token;
|
|
176
|
+
}
|
|
177
|
+
getRefreshToken() {
|
|
178
|
+
return this.refreshToken;
|
|
179
|
+
}
|
|
170
180
|
setGymId(gymId) {
|
|
171
181
|
this.axiosInstance.defaults.headers.common["X-Gym-Id"] = gymId;
|
|
172
182
|
}
|
|
173
183
|
clearAuth() {
|
|
174
184
|
delete this.config.apiKey;
|
|
185
|
+
this.refreshToken = null;
|
|
175
186
|
delete this.axiosInstance.defaults.headers.common["Authorization"];
|
|
176
187
|
delete this.axiosInstance.defaults.headers.common["X-Gym-Id"];
|
|
177
188
|
}
|
|
@@ -957,6 +968,9 @@ var SalesResource = class extends BaseResource {
|
|
|
957
968
|
async updatePaymentStatus(id, paymentStatus, options) {
|
|
958
969
|
return this.client.put(`${this.basePath}/${id}/payment-status`, { paymentStatus }, options);
|
|
959
970
|
}
|
|
971
|
+
async paySale(id, data, options) {
|
|
972
|
+
return this.client.post(`${this.basePath}/${id}/payment`, data, options);
|
|
973
|
+
}
|
|
960
974
|
async deleteSale(id, options) {
|
|
961
975
|
return this.client.delete(`${this.basePath}/${id}`, options);
|
|
962
976
|
}
|
|
@@ -1147,6 +1161,18 @@ var GymSpaceSdk = class {
|
|
|
1147
1161
|
setAuthToken(token) {
|
|
1148
1162
|
this.client.setAuthToken(token);
|
|
1149
1163
|
}
|
|
1164
|
+
/**
|
|
1165
|
+
* Set the refresh token
|
|
1166
|
+
*/
|
|
1167
|
+
setRefreshToken(token) {
|
|
1168
|
+
this.client.setRefreshToken(token);
|
|
1169
|
+
}
|
|
1170
|
+
/**
|
|
1171
|
+
* Get the current refresh token
|
|
1172
|
+
*/
|
|
1173
|
+
getRefreshToken() {
|
|
1174
|
+
return this.client.getRefreshToken();
|
|
1175
|
+
}
|
|
1150
1176
|
/**
|
|
1151
1177
|
* Set the current gym context
|
|
1152
1178
|
*/
|