@gymspace/sdk 1.5.2 → 1.7.0
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 +145 -6
- package/dist/index.d.ts +145 -6
- package/dist/index.js +84 -3
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +83 -4
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/models/index.ts +1 -0
- package/src/models/membership-plans.ts +63 -5
- package/src/models/messages.ts +40 -0
- package/src/resources/gyms.ts +17 -0
- package/src/resources/index.ts +1 -0
- package/src/resources/invitations.ts +8 -0
- package/src/resources/messages.ts +28 -0
- package/src/resources/sales.ts +18 -0
- package/src/sdk.ts +3 -0
- package/dist/.tsbuildinfo +0 -1
package/dist/index.d.mts
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, CancellationReason, SuspensionType, CreateInvitationDto, Invitation, ValidateByCodeDto, AcceptInvitationDto, BulkMessageVariable } from '@gymspace/shared';
|
|
2
|
+
import { PaginationParams as PaginationParams$1, ListCollaboratorsParams, Collaborator, UpdateCollaboratorDto, UpdateCollaboratorRoleDto, UpdateCollaboratorStatusDto, ActivityQueryParams, ActivityItem, StatsQueryParams, CollaboratorStats, Role, ContractStatus, CancellationReason, SuspensionType, CreateInvitationDto, Invitation, ValidateByCodeDto, ValidateByTokenDto, AcceptInvitationDto, BulkMessageVariable } from '@gymspace/shared';
|
|
3
3
|
export * from '@gymspace/shared';
|
|
4
4
|
export { BulkMessageVariable } from '@gymspace/shared';
|
|
5
5
|
|
|
@@ -657,6 +657,22 @@ declare class GymsResource extends BaseResource {
|
|
|
657
657
|
* ```
|
|
658
658
|
*/
|
|
659
659
|
updateContractSettings(data: UpdateGymContractSettingsDto, options?: RequestOptions): Promise<Gym>;
|
|
660
|
+
/**
|
|
661
|
+
* Soft delete a gym
|
|
662
|
+
* Cannot delete gym with active contracts or collaborators
|
|
663
|
+
* @param id Gym ID
|
|
664
|
+
* @param options Request options
|
|
665
|
+
* @returns Success response
|
|
666
|
+
*
|
|
667
|
+
* @example
|
|
668
|
+
* ```typescript
|
|
669
|
+
* const result = await sdk.gyms.deleteGym('gym-id');
|
|
670
|
+
* console.log(result.success); // true
|
|
671
|
+
* ```
|
|
672
|
+
*/
|
|
673
|
+
deleteGym(id: string, options?: RequestOptions): Promise<{
|
|
674
|
+
success: boolean;
|
|
675
|
+
}>;
|
|
660
676
|
}
|
|
661
677
|
|
|
662
678
|
declare class CollaboratorsResource extends BaseResource {
|
|
@@ -908,10 +924,68 @@ interface MembershipPlan {
|
|
|
908
924
|
updatedAt: string;
|
|
909
925
|
}
|
|
910
926
|
interface MembershipPlanStats {
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
927
|
+
plan: {
|
|
928
|
+
id: string;
|
|
929
|
+
name: string;
|
|
930
|
+
basePrice: string;
|
|
931
|
+
durationMonths: number | null;
|
|
932
|
+
durationDays: number | null;
|
|
933
|
+
status: string;
|
|
934
|
+
};
|
|
935
|
+
contracts: {
|
|
936
|
+
total: number;
|
|
937
|
+
active: number;
|
|
938
|
+
cancelled: number;
|
|
939
|
+
retentionRate: string;
|
|
940
|
+
};
|
|
941
|
+
revenue: {
|
|
942
|
+
monthly: number;
|
|
943
|
+
projected: number;
|
|
944
|
+
};
|
|
945
|
+
metrics: {
|
|
946
|
+
averageRetentionDays: number;
|
|
947
|
+
};
|
|
948
|
+
recentContracts: Array<{
|
|
949
|
+
id: string;
|
|
950
|
+
gymClientId: string;
|
|
951
|
+
gymMembershipPlanId: string;
|
|
952
|
+
paymentMethodId: string;
|
|
953
|
+
parentId: string | null;
|
|
954
|
+
startDate: string;
|
|
955
|
+
endDate: string;
|
|
956
|
+
basePrice: string;
|
|
957
|
+
customPrice: string | null;
|
|
958
|
+
finalAmount: string;
|
|
959
|
+
currency: string;
|
|
960
|
+
discountPercentage: string | null;
|
|
961
|
+
discountAmount: string | null;
|
|
962
|
+
status: string;
|
|
963
|
+
paymentFrequency: string;
|
|
964
|
+
notes: string | null;
|
|
965
|
+
termsAndConditions: string | null;
|
|
966
|
+
freezeStartDate: string | null;
|
|
967
|
+
freezeEndDate: string | null;
|
|
968
|
+
contractDocumentId: string | null;
|
|
969
|
+
paymentReceiptIds: string[] | null;
|
|
970
|
+
receiptIds: string[];
|
|
971
|
+
metadata: Record<string, unknown>;
|
|
972
|
+
createdByUserId: string;
|
|
973
|
+
updatedByUserId: string | null;
|
|
974
|
+
approvedByUserId: string | null;
|
|
975
|
+
approvedAt: string | null;
|
|
976
|
+
cancelledByUserId: string | null;
|
|
977
|
+
cancelledAt: string | null;
|
|
978
|
+
createdAt: string;
|
|
979
|
+
updatedAt: string;
|
|
980
|
+
deletedAt: string | null;
|
|
981
|
+
gymId: string | null;
|
|
982
|
+
contractNumber: string;
|
|
983
|
+
gymClient: {
|
|
984
|
+
id: string;
|
|
985
|
+
name: string;
|
|
986
|
+
email: string;
|
|
987
|
+
};
|
|
988
|
+
}>;
|
|
915
989
|
}
|
|
916
990
|
interface GetMembershipPlansParams {
|
|
917
991
|
activeOnly?: boolean;
|
|
@@ -1375,6 +1449,12 @@ declare class InvitationsResource extends BaseResource {
|
|
|
1375
1449
|
roleName: string;
|
|
1376
1450
|
token: string;
|
|
1377
1451
|
}>;
|
|
1452
|
+
validateByToken(data: ValidateByTokenDto, options?: RequestOptions): Promise<{
|
|
1453
|
+
email: string;
|
|
1454
|
+
gymName: string;
|
|
1455
|
+
roleName: string;
|
|
1456
|
+
token: string;
|
|
1457
|
+
}>;
|
|
1378
1458
|
acceptInvitation(data: AcceptInvitationDto, options?: RequestOptions): Promise<void>;
|
|
1379
1459
|
cancelInvitation(id: string, options?: RequestOptions): Promise<void>;
|
|
1380
1460
|
resendInvitation(id: string, options?: RequestOptions): Promise<void>;
|
|
@@ -2329,6 +2409,17 @@ declare class SalesResource extends BaseResource {
|
|
|
2329
2409
|
success: boolean;
|
|
2330
2410
|
message: string;
|
|
2331
2411
|
}>;
|
|
2412
|
+
/**
|
|
2413
|
+
* Send payment reminder for unpaid sale via WhatsApp
|
|
2414
|
+
* @param saleId - ID of the sale
|
|
2415
|
+
* @param options - Request options
|
|
2416
|
+
* @returns Promise with success status and message
|
|
2417
|
+
* @throws {ApiError} If sale is already paid, customer has no phone, or sale not found
|
|
2418
|
+
*/
|
|
2419
|
+
sendPaymentReminder(saleId: string, options?: RequestOptions): Promise<{
|
|
2420
|
+
success: boolean;
|
|
2421
|
+
message: string;
|
|
2422
|
+
}>;
|
|
2332
2423
|
}
|
|
2333
2424
|
|
|
2334
2425
|
interface CreateSupplierDto {
|
|
@@ -3770,6 +3861,53 @@ declare class CommissionPromotionsResource extends BaseResource {
|
|
|
3770
3861
|
}>;
|
|
3771
3862
|
}
|
|
3772
3863
|
|
|
3864
|
+
interface Message {
|
|
3865
|
+
id: string;
|
|
3866
|
+
gymId: string;
|
|
3867
|
+
clientId?: string;
|
|
3868
|
+
recipientPhone: string;
|
|
3869
|
+
recipientName?: string;
|
|
3870
|
+
content?: string;
|
|
3871
|
+
templateId?: string;
|
|
3872
|
+
status: string;
|
|
3873
|
+
scheduledFor?: string;
|
|
3874
|
+
queuedAt?: string;
|
|
3875
|
+
sentAt?: string;
|
|
3876
|
+
failedAt?: string;
|
|
3877
|
+
cancelledAt?: string;
|
|
3878
|
+
errorMessage?: string;
|
|
3879
|
+
errorCode?: string;
|
|
3880
|
+
retryCount: number;
|
|
3881
|
+
maxRetries: number;
|
|
3882
|
+
externalMessageId?: string;
|
|
3883
|
+
metadata?: Record<string, any>;
|
|
3884
|
+
createdAt: string;
|
|
3885
|
+
updatedAt: string;
|
|
3886
|
+
}
|
|
3887
|
+
interface GetMessagesParams {
|
|
3888
|
+
status?: string;
|
|
3889
|
+
clientId?: string;
|
|
3890
|
+
startDate?: string;
|
|
3891
|
+
endDate?: string;
|
|
3892
|
+
search?: string;
|
|
3893
|
+
page?: number;
|
|
3894
|
+
limit?: number;
|
|
3895
|
+
}
|
|
3896
|
+
interface MessageStatusUpdate {
|
|
3897
|
+
status: string;
|
|
3898
|
+
externalMessageId?: string;
|
|
3899
|
+
errorMessage?: string;
|
|
3900
|
+
errorCode?: string;
|
|
3901
|
+
}
|
|
3902
|
+
|
|
3903
|
+
declare class MessagesResource extends BaseResource {
|
|
3904
|
+
private basePath;
|
|
3905
|
+
getMessages(params?: GetMessagesParams, options?: RequestOptions): Promise<Message[]>;
|
|
3906
|
+
getMessage(id: string, options?: RequestOptions): Promise<Message>;
|
|
3907
|
+
retryMessage(id: string, options?: RequestOptions): Promise<Message>;
|
|
3908
|
+
cancelMessage(id: string, options?: RequestOptions): Promise<Message>;
|
|
3909
|
+
}
|
|
3910
|
+
|
|
3773
3911
|
declare class GymSpaceSdk {
|
|
3774
3912
|
client: ApiClient;
|
|
3775
3913
|
private expoFetch?;
|
|
@@ -3808,6 +3946,7 @@ declare class GymSpaceSdk {
|
|
|
3808
3946
|
commissionCalculations: CommissionCalculationsResource;
|
|
3809
3947
|
commissionReports: CommissionReportsResource;
|
|
3810
3948
|
commissionPromotions: CommissionPromotionsResource;
|
|
3949
|
+
messages: MessagesResource;
|
|
3811
3950
|
constructor(config: GymSpaceConfig);
|
|
3812
3951
|
/**
|
|
3813
3952
|
* Set the authentication token
|
|
@@ -3877,4 +4016,4 @@ declare class NetworkError extends GymSpaceError {
|
|
|
3877
4016
|
constructor(message?: string);
|
|
3878
4017
|
}
|
|
3879
4018
|
|
|
3880
|
-
export { type ActivateRenewalDto, ActivitiesResource, type Activity, type ActivityNotificationDto, type ActivityPlanRestriction, type ActivityStats, type ActivityStatsParams, AdminCatalogResource, AdminSubscriptionManagementResource, type AdminSubscriptionStatusDto, type AffiliateOrganizationDto, type Amenities, ApiClient, type ApiResponse, type AssetResponseDto, AssetsResource, type AssignTagsDto, type AssignTagsResponse, AuthResource, AuthenticationError, AuthorizationError, type AvailablePlanDto, type BulkLogsResponse, type BulkLogsResponseDto, type BulkMessageLog, type BulkMessageLogDto, type BulkMessageResult, type BulkMessageResultDto, BulkMessagingResource, type BulkTemplate, type BusinessHours, type CancelContractDto, type CancelSubscriptionDto, type CancellationAnalytics, type CatalogActivity, type CatalogGym, type CatalogHeroSection, type CatalogLead, type CatalogLocation, type CatalogPlan, type CatalogResponse, type CatalogSocialMedia, 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, type ClientTag, type ClientTagsResponse, ClientsResource, type CollaboratorReportDto, type CollaboratorRoleDto, CollaboratorsResource, type CommissionCalculationDto, CommissionCalculationsResource, CommissionChangeType, type CommissionComparisonDto, type CommissionConfigDto, CommissionConfigResource, CommissionEntityType, type CommissionFiltersDto, type CommissionHistoryDto, type CommissionHistoryFiltersDto, CommissionPromotionsResource, CommissionReportsResource, type CommissionRuleDto, type CommissionRuleFiltersDto, CommissionRuleType, CommissionRulesResource, type CommissionSimulationDto, CommissionStatus, type CommissionSummaryDto, type CommissionSummaryReportDto, type CompleteGuidedSetupData, type ConfigureFeaturesData, type ConnectionStatusResponse, type Contact, type Contract, type ContractLifecycleEvent, type ContractSettings, ContractsResource, type ContractsRevenue, type CreateActivityDto, type CreateActivityNotificationDto, type CreateBulkTemplateDto, type CreateCheckInDto, type CreateClientDto, type CreateCommissionConfigDto, type CreateCommissionRuleDto, type CreateContractDto, type CreateGymDto, type CreateLeadDto, type CreateMembershipPlanDto, type CreatePaymentMethodDto, type CreateProductCategoryDto, type CreateProductDto, type CreateSaleDto, type CreateServiceDto, type CreateSubscriptionPlanDto, type CreateSupplierDto, type CreateTagDto, type CreateTemplateDto, type CreateWhatsAppConfigDto, type CurrentSessionResponse, type CurrentlyInGymResponse, type CustomerSalesReport, DashboardResource, type DashboardStats, type DateRangeParams, type DaySchedule, type Debts, type DeleteActivityParams, type DeleteTagResponse, type DisconnectResponse, type EligibleClient, type EligibleClientsResponse, type ExpiringContract, type FileResponseDto, FilesResource, type FormattedSchedule, type FreezeContractDto, type GenerateAIMessageDto, type GenerateAIMessageParams, type GenerateAIMessageResponse, type GenerateAIMessageResponseDto, type GetBulkLogsQueryDto, type GetCheckInStatsParams, type GetClientCheckInHistoryParams, type GetContractsParams, type GetGymInvitationsParams, type GetMembershipPlansParams, type GetTagClientsParams, type Gym, type GymAmenities, type GymCatalog, type GymSchedule, type GymSettings, type GymSocialMedia, type GymSpaceConfig, GymSpaceError, GymSpaceSdk, type GymStats, GymsResource, HealthResource, type HealthResponse, type InitializeConnectionResponse, type InventorySettings, type InvitationValidationResponse, InvitationsResource, type LeadFiltersDto, LeadGender, type LeadSubmissionResponse, type ListContactsResponse, type LoginDto, type LoginResponseDto, type MembershipManagementFeatures, type MembershipPlan, type MembershipPlanStats, MembershipPlansResource, type MyOrganization, NetworkError, type NewClients, NotFoundError, type NotificationSettings, OnboardingCacheStatus, OnboardingResource, type OnboardingResponse, type OnboardingStatus, type OnboardingStatusResponse, OnboardingStep, type Organization, type OrganizationAdminDetails, type OrganizationStats, type OrganizationWithDetails, OrganizationsResource, type PaginatedCommissionResult, 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, type PromotionReportDto, type PromotionReportFiltersDto, PublicCatalogResource, type ReactivateContractDto, type ReadyResponse, type RegisterCollaboratorDto, type RegisterOwnerDto, type RejectedClient, type RejectedClientDto, type RemoveTagsDto, type RemoveTagsResponse, type RenewContractDto, type ReorderCommissionRulesDto, type ReportFiltersDto, type RequestOptions, type RequestPasswordResetDto, type RequestPasswordResetResponseDto, type ResendResetCodeDto, type ResendResetCodeResponseDto, type ResendVerificationDto, type ResetPasswordDto, type ResetPasswordResponseDto, type ResumeContractDto, RolesResource, type RuleCriteria, type RuleReportDto, type Sale, type SaleItem, type SaleItemDto, SalesResource, type SalesRevenue, type SalesStats, type SearchActivitiesParams, type SearchCatalogParams, type SearchCatalogResponse, type SearchCheckInsParams, type SearchClientsParams, type SearchPaymentMethodsParams, type SearchProductsParams, type SearchSalesParams, type SearchSuppliersParams, type SearchTagsParams, type SearchTemplatesDto, type SearchWhatsAppMessagesDto, type SendBulkMessagesDto, type SendCatalogMessageDto, type SendCatalogMessageResponse, type SendWhatsAppMessageDto, type SentActivityNotification, type SimulateCommissionDto, 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 SuspendContractDto, type SwitchOrganizationDto, type SwitchOrganizationResponse, type Tag, type TagClientsResponse, type TagStatsResponse, type TagWithAssignment, TagsResource, type TimeSlot, type TopSellingProduct, type UpdateActivityDto, type UpdateActivityNotificationDto, type UpdateBulkTemplateDto, type UpdateCatalogConfigDto, type UpdateClientDto, type UpdateCommissionConfigDto, type UpdateCommissionRuleDto, type UpdateGymContractSettingsDto, type UpdateGymDto, type UpdateGymInventorySettingsDto, 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 UpdateTagDto, 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 };
|
|
4019
|
+
export { type ActivateRenewalDto, ActivitiesResource, type Activity, type ActivityNotificationDto, type ActivityPlanRestriction, type ActivityStats, type ActivityStatsParams, AdminCatalogResource, AdminSubscriptionManagementResource, type AdminSubscriptionStatusDto, type AffiliateOrganizationDto, type Amenities, ApiClient, type ApiResponse, type AssetResponseDto, AssetsResource, type AssignTagsDto, type AssignTagsResponse, AuthResource, AuthenticationError, AuthorizationError, type AvailablePlanDto, type BulkLogsResponse, type BulkLogsResponseDto, type BulkMessageLog, type BulkMessageLogDto, type BulkMessageResult, type BulkMessageResultDto, BulkMessagingResource, type BulkTemplate, type BusinessHours, type CancelContractDto, type CancelSubscriptionDto, type CancellationAnalytics, type CatalogActivity, type CatalogGym, type CatalogHeroSection, type CatalogLead, type CatalogLocation, type CatalogPlan, type CatalogResponse, type CatalogSocialMedia, 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, type ClientTag, type ClientTagsResponse, ClientsResource, type CollaboratorReportDto, type CollaboratorRoleDto, CollaboratorsResource, type CommissionCalculationDto, CommissionCalculationsResource, CommissionChangeType, type CommissionComparisonDto, type CommissionConfigDto, CommissionConfigResource, CommissionEntityType, type CommissionFiltersDto, type CommissionHistoryDto, type CommissionHistoryFiltersDto, CommissionPromotionsResource, CommissionReportsResource, type CommissionRuleDto, type CommissionRuleFiltersDto, CommissionRuleType, CommissionRulesResource, type CommissionSimulationDto, CommissionStatus, type CommissionSummaryDto, type CommissionSummaryReportDto, type CompleteGuidedSetupData, type ConfigureFeaturesData, type ConnectionStatusResponse, type Contact, type Contract, type ContractLifecycleEvent, type ContractSettings, ContractsResource, type ContractsRevenue, type CreateActivityDto, type CreateActivityNotificationDto, type CreateBulkTemplateDto, type CreateCheckInDto, type CreateClientDto, type CreateCommissionConfigDto, type CreateCommissionRuleDto, type CreateContractDto, type CreateGymDto, type CreateLeadDto, type CreateMembershipPlanDto, type CreatePaymentMethodDto, type CreateProductCategoryDto, type CreateProductDto, type CreateSaleDto, type CreateServiceDto, type CreateSubscriptionPlanDto, type CreateSupplierDto, type CreateTagDto, type CreateTemplateDto, type CreateWhatsAppConfigDto, type CurrentSessionResponse, type CurrentlyInGymResponse, type CustomerSalesReport, DashboardResource, type DashboardStats, type DateRangeParams, type DaySchedule, type Debts, type DeleteActivityParams, type DeleteTagResponse, type DisconnectResponse, type EligibleClient, type EligibleClientsResponse, type ExpiringContract, type FileResponseDto, FilesResource, type FormattedSchedule, type FreezeContractDto, type GenerateAIMessageDto, type GenerateAIMessageParams, type GenerateAIMessageResponse, type GenerateAIMessageResponseDto, type GetBulkLogsQueryDto, type GetCheckInStatsParams, type GetClientCheckInHistoryParams, type GetContractsParams, type GetGymInvitationsParams, type GetMembershipPlansParams, type GetMessagesParams, type GetTagClientsParams, type Gym, type GymAmenities, type GymCatalog, type GymSchedule, type GymSettings, type GymSocialMedia, type GymSpaceConfig, GymSpaceError, GymSpaceSdk, type GymStats, GymsResource, HealthResource, type HealthResponse, type InitializeConnectionResponse, type InventorySettings, type InvitationValidationResponse, InvitationsResource, type LeadFiltersDto, LeadGender, type LeadSubmissionResponse, type ListContactsResponse, type LoginDto, type LoginResponseDto, type MembershipManagementFeatures, type MembershipPlan, type MembershipPlanStats, MembershipPlansResource, type Message, type MessageStatusUpdate, MessagesResource, type MyOrganization, NetworkError, type NewClients, NotFoundError, type NotificationSettings, OnboardingCacheStatus, OnboardingResource, type OnboardingResponse, type OnboardingStatus, type OnboardingStatusResponse, OnboardingStep, type Organization, type OrganizationAdminDetails, type OrganizationStats, type OrganizationWithDetails, OrganizationsResource, type PaginatedCommissionResult, 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, type PromotionReportDto, type PromotionReportFiltersDto, PublicCatalogResource, type ReactivateContractDto, type ReadyResponse, type RegisterCollaboratorDto, type RegisterOwnerDto, type RejectedClient, type RejectedClientDto, type RemoveTagsDto, type RemoveTagsResponse, type RenewContractDto, type ReorderCommissionRulesDto, type ReportFiltersDto, type RequestOptions, type RequestPasswordResetDto, type RequestPasswordResetResponseDto, type ResendResetCodeDto, type ResendResetCodeResponseDto, type ResendVerificationDto, type ResetPasswordDto, type ResetPasswordResponseDto, type ResumeContractDto, RolesResource, type RuleCriteria, type RuleReportDto, type Sale, type SaleItem, type SaleItemDto, SalesResource, type SalesRevenue, type SalesStats, type SearchActivitiesParams, type SearchCatalogParams, type SearchCatalogResponse, type SearchCheckInsParams, type SearchClientsParams, type SearchPaymentMethodsParams, type SearchProductsParams, type SearchSalesParams, type SearchSuppliersParams, type SearchTagsParams, type SearchTemplatesDto, type SearchWhatsAppMessagesDto, type SendBulkMessagesDto, type SendCatalogMessageDto, type SendCatalogMessageResponse, type SendWhatsAppMessageDto, type SentActivityNotification, type SimulateCommissionDto, 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 SuspendContractDto, type SwitchOrganizationDto, type SwitchOrganizationResponse, type Tag, type TagClientsResponse, type TagStatsResponse, type TagWithAssignment, TagsResource, type TimeSlot, type TopSellingProduct, type UpdateActivityDto, type UpdateActivityNotificationDto, type UpdateBulkTemplateDto, type UpdateCatalogConfigDto, type UpdateClientDto, type UpdateCommissionConfigDto, type UpdateCommissionRuleDto, type UpdateGymContractSettingsDto, type UpdateGymDto, type UpdateGymInventorySettingsDto, 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 UpdateTagDto, 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.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, CancellationReason, SuspensionType, CreateInvitationDto, Invitation, ValidateByCodeDto, AcceptInvitationDto, BulkMessageVariable } from '@gymspace/shared';
|
|
2
|
+
import { PaginationParams as PaginationParams$1, ListCollaboratorsParams, Collaborator, UpdateCollaboratorDto, UpdateCollaboratorRoleDto, UpdateCollaboratorStatusDto, ActivityQueryParams, ActivityItem, StatsQueryParams, CollaboratorStats, Role, ContractStatus, CancellationReason, SuspensionType, CreateInvitationDto, Invitation, ValidateByCodeDto, ValidateByTokenDto, AcceptInvitationDto, BulkMessageVariable } from '@gymspace/shared';
|
|
3
3
|
export * from '@gymspace/shared';
|
|
4
4
|
export { BulkMessageVariable } from '@gymspace/shared';
|
|
5
5
|
|
|
@@ -657,6 +657,22 @@ declare class GymsResource extends BaseResource {
|
|
|
657
657
|
* ```
|
|
658
658
|
*/
|
|
659
659
|
updateContractSettings(data: UpdateGymContractSettingsDto, options?: RequestOptions): Promise<Gym>;
|
|
660
|
+
/**
|
|
661
|
+
* Soft delete a gym
|
|
662
|
+
* Cannot delete gym with active contracts or collaborators
|
|
663
|
+
* @param id Gym ID
|
|
664
|
+
* @param options Request options
|
|
665
|
+
* @returns Success response
|
|
666
|
+
*
|
|
667
|
+
* @example
|
|
668
|
+
* ```typescript
|
|
669
|
+
* const result = await sdk.gyms.deleteGym('gym-id');
|
|
670
|
+
* console.log(result.success); // true
|
|
671
|
+
* ```
|
|
672
|
+
*/
|
|
673
|
+
deleteGym(id: string, options?: RequestOptions): Promise<{
|
|
674
|
+
success: boolean;
|
|
675
|
+
}>;
|
|
660
676
|
}
|
|
661
677
|
|
|
662
678
|
declare class CollaboratorsResource extends BaseResource {
|
|
@@ -908,10 +924,68 @@ interface MembershipPlan {
|
|
|
908
924
|
updatedAt: string;
|
|
909
925
|
}
|
|
910
926
|
interface MembershipPlanStats {
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
927
|
+
plan: {
|
|
928
|
+
id: string;
|
|
929
|
+
name: string;
|
|
930
|
+
basePrice: string;
|
|
931
|
+
durationMonths: number | null;
|
|
932
|
+
durationDays: number | null;
|
|
933
|
+
status: string;
|
|
934
|
+
};
|
|
935
|
+
contracts: {
|
|
936
|
+
total: number;
|
|
937
|
+
active: number;
|
|
938
|
+
cancelled: number;
|
|
939
|
+
retentionRate: string;
|
|
940
|
+
};
|
|
941
|
+
revenue: {
|
|
942
|
+
monthly: number;
|
|
943
|
+
projected: number;
|
|
944
|
+
};
|
|
945
|
+
metrics: {
|
|
946
|
+
averageRetentionDays: number;
|
|
947
|
+
};
|
|
948
|
+
recentContracts: Array<{
|
|
949
|
+
id: string;
|
|
950
|
+
gymClientId: string;
|
|
951
|
+
gymMembershipPlanId: string;
|
|
952
|
+
paymentMethodId: string;
|
|
953
|
+
parentId: string | null;
|
|
954
|
+
startDate: string;
|
|
955
|
+
endDate: string;
|
|
956
|
+
basePrice: string;
|
|
957
|
+
customPrice: string | null;
|
|
958
|
+
finalAmount: string;
|
|
959
|
+
currency: string;
|
|
960
|
+
discountPercentage: string | null;
|
|
961
|
+
discountAmount: string | null;
|
|
962
|
+
status: string;
|
|
963
|
+
paymentFrequency: string;
|
|
964
|
+
notes: string | null;
|
|
965
|
+
termsAndConditions: string | null;
|
|
966
|
+
freezeStartDate: string | null;
|
|
967
|
+
freezeEndDate: string | null;
|
|
968
|
+
contractDocumentId: string | null;
|
|
969
|
+
paymentReceiptIds: string[] | null;
|
|
970
|
+
receiptIds: string[];
|
|
971
|
+
metadata: Record<string, unknown>;
|
|
972
|
+
createdByUserId: string;
|
|
973
|
+
updatedByUserId: string | null;
|
|
974
|
+
approvedByUserId: string | null;
|
|
975
|
+
approvedAt: string | null;
|
|
976
|
+
cancelledByUserId: string | null;
|
|
977
|
+
cancelledAt: string | null;
|
|
978
|
+
createdAt: string;
|
|
979
|
+
updatedAt: string;
|
|
980
|
+
deletedAt: string | null;
|
|
981
|
+
gymId: string | null;
|
|
982
|
+
contractNumber: string;
|
|
983
|
+
gymClient: {
|
|
984
|
+
id: string;
|
|
985
|
+
name: string;
|
|
986
|
+
email: string;
|
|
987
|
+
};
|
|
988
|
+
}>;
|
|
915
989
|
}
|
|
916
990
|
interface GetMembershipPlansParams {
|
|
917
991
|
activeOnly?: boolean;
|
|
@@ -1375,6 +1449,12 @@ declare class InvitationsResource extends BaseResource {
|
|
|
1375
1449
|
roleName: string;
|
|
1376
1450
|
token: string;
|
|
1377
1451
|
}>;
|
|
1452
|
+
validateByToken(data: ValidateByTokenDto, options?: RequestOptions): Promise<{
|
|
1453
|
+
email: string;
|
|
1454
|
+
gymName: string;
|
|
1455
|
+
roleName: string;
|
|
1456
|
+
token: string;
|
|
1457
|
+
}>;
|
|
1378
1458
|
acceptInvitation(data: AcceptInvitationDto, options?: RequestOptions): Promise<void>;
|
|
1379
1459
|
cancelInvitation(id: string, options?: RequestOptions): Promise<void>;
|
|
1380
1460
|
resendInvitation(id: string, options?: RequestOptions): Promise<void>;
|
|
@@ -2329,6 +2409,17 @@ declare class SalesResource extends BaseResource {
|
|
|
2329
2409
|
success: boolean;
|
|
2330
2410
|
message: string;
|
|
2331
2411
|
}>;
|
|
2412
|
+
/**
|
|
2413
|
+
* Send payment reminder for unpaid sale via WhatsApp
|
|
2414
|
+
* @param saleId - ID of the sale
|
|
2415
|
+
* @param options - Request options
|
|
2416
|
+
* @returns Promise with success status and message
|
|
2417
|
+
* @throws {ApiError} If sale is already paid, customer has no phone, or sale not found
|
|
2418
|
+
*/
|
|
2419
|
+
sendPaymentReminder(saleId: string, options?: RequestOptions): Promise<{
|
|
2420
|
+
success: boolean;
|
|
2421
|
+
message: string;
|
|
2422
|
+
}>;
|
|
2332
2423
|
}
|
|
2333
2424
|
|
|
2334
2425
|
interface CreateSupplierDto {
|
|
@@ -3770,6 +3861,53 @@ declare class CommissionPromotionsResource extends BaseResource {
|
|
|
3770
3861
|
}>;
|
|
3771
3862
|
}
|
|
3772
3863
|
|
|
3864
|
+
interface Message {
|
|
3865
|
+
id: string;
|
|
3866
|
+
gymId: string;
|
|
3867
|
+
clientId?: string;
|
|
3868
|
+
recipientPhone: string;
|
|
3869
|
+
recipientName?: string;
|
|
3870
|
+
content?: string;
|
|
3871
|
+
templateId?: string;
|
|
3872
|
+
status: string;
|
|
3873
|
+
scheduledFor?: string;
|
|
3874
|
+
queuedAt?: string;
|
|
3875
|
+
sentAt?: string;
|
|
3876
|
+
failedAt?: string;
|
|
3877
|
+
cancelledAt?: string;
|
|
3878
|
+
errorMessage?: string;
|
|
3879
|
+
errorCode?: string;
|
|
3880
|
+
retryCount: number;
|
|
3881
|
+
maxRetries: number;
|
|
3882
|
+
externalMessageId?: string;
|
|
3883
|
+
metadata?: Record<string, any>;
|
|
3884
|
+
createdAt: string;
|
|
3885
|
+
updatedAt: string;
|
|
3886
|
+
}
|
|
3887
|
+
interface GetMessagesParams {
|
|
3888
|
+
status?: string;
|
|
3889
|
+
clientId?: string;
|
|
3890
|
+
startDate?: string;
|
|
3891
|
+
endDate?: string;
|
|
3892
|
+
search?: string;
|
|
3893
|
+
page?: number;
|
|
3894
|
+
limit?: number;
|
|
3895
|
+
}
|
|
3896
|
+
interface MessageStatusUpdate {
|
|
3897
|
+
status: string;
|
|
3898
|
+
externalMessageId?: string;
|
|
3899
|
+
errorMessage?: string;
|
|
3900
|
+
errorCode?: string;
|
|
3901
|
+
}
|
|
3902
|
+
|
|
3903
|
+
declare class MessagesResource extends BaseResource {
|
|
3904
|
+
private basePath;
|
|
3905
|
+
getMessages(params?: GetMessagesParams, options?: RequestOptions): Promise<Message[]>;
|
|
3906
|
+
getMessage(id: string, options?: RequestOptions): Promise<Message>;
|
|
3907
|
+
retryMessage(id: string, options?: RequestOptions): Promise<Message>;
|
|
3908
|
+
cancelMessage(id: string, options?: RequestOptions): Promise<Message>;
|
|
3909
|
+
}
|
|
3910
|
+
|
|
3773
3911
|
declare class GymSpaceSdk {
|
|
3774
3912
|
client: ApiClient;
|
|
3775
3913
|
private expoFetch?;
|
|
@@ -3808,6 +3946,7 @@ declare class GymSpaceSdk {
|
|
|
3808
3946
|
commissionCalculations: CommissionCalculationsResource;
|
|
3809
3947
|
commissionReports: CommissionReportsResource;
|
|
3810
3948
|
commissionPromotions: CommissionPromotionsResource;
|
|
3949
|
+
messages: MessagesResource;
|
|
3811
3950
|
constructor(config: GymSpaceConfig);
|
|
3812
3951
|
/**
|
|
3813
3952
|
* Set the authentication token
|
|
@@ -3877,4 +4016,4 @@ declare class NetworkError extends GymSpaceError {
|
|
|
3877
4016
|
constructor(message?: string);
|
|
3878
4017
|
}
|
|
3879
4018
|
|
|
3880
|
-
export { type ActivateRenewalDto, ActivitiesResource, type Activity, type ActivityNotificationDto, type ActivityPlanRestriction, type ActivityStats, type ActivityStatsParams, AdminCatalogResource, AdminSubscriptionManagementResource, type AdminSubscriptionStatusDto, type AffiliateOrganizationDto, type Amenities, ApiClient, type ApiResponse, type AssetResponseDto, AssetsResource, type AssignTagsDto, type AssignTagsResponse, AuthResource, AuthenticationError, AuthorizationError, type AvailablePlanDto, type BulkLogsResponse, type BulkLogsResponseDto, type BulkMessageLog, type BulkMessageLogDto, type BulkMessageResult, type BulkMessageResultDto, BulkMessagingResource, type BulkTemplate, type BusinessHours, type CancelContractDto, type CancelSubscriptionDto, type CancellationAnalytics, type CatalogActivity, type CatalogGym, type CatalogHeroSection, type CatalogLead, type CatalogLocation, type CatalogPlan, type CatalogResponse, type CatalogSocialMedia, 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, type ClientTag, type ClientTagsResponse, ClientsResource, type CollaboratorReportDto, type CollaboratorRoleDto, CollaboratorsResource, type CommissionCalculationDto, CommissionCalculationsResource, CommissionChangeType, type CommissionComparisonDto, type CommissionConfigDto, CommissionConfigResource, CommissionEntityType, type CommissionFiltersDto, type CommissionHistoryDto, type CommissionHistoryFiltersDto, CommissionPromotionsResource, CommissionReportsResource, type CommissionRuleDto, type CommissionRuleFiltersDto, CommissionRuleType, CommissionRulesResource, type CommissionSimulationDto, CommissionStatus, type CommissionSummaryDto, type CommissionSummaryReportDto, type CompleteGuidedSetupData, type ConfigureFeaturesData, type ConnectionStatusResponse, type Contact, type Contract, type ContractLifecycleEvent, type ContractSettings, ContractsResource, type ContractsRevenue, type CreateActivityDto, type CreateActivityNotificationDto, type CreateBulkTemplateDto, type CreateCheckInDto, type CreateClientDto, type CreateCommissionConfigDto, type CreateCommissionRuleDto, type CreateContractDto, type CreateGymDto, type CreateLeadDto, type CreateMembershipPlanDto, type CreatePaymentMethodDto, type CreateProductCategoryDto, type CreateProductDto, type CreateSaleDto, type CreateServiceDto, type CreateSubscriptionPlanDto, type CreateSupplierDto, type CreateTagDto, type CreateTemplateDto, type CreateWhatsAppConfigDto, type CurrentSessionResponse, type CurrentlyInGymResponse, type CustomerSalesReport, DashboardResource, type DashboardStats, type DateRangeParams, type DaySchedule, type Debts, type DeleteActivityParams, type DeleteTagResponse, type DisconnectResponse, type EligibleClient, type EligibleClientsResponse, type ExpiringContract, type FileResponseDto, FilesResource, type FormattedSchedule, type FreezeContractDto, type GenerateAIMessageDto, type GenerateAIMessageParams, type GenerateAIMessageResponse, type GenerateAIMessageResponseDto, type GetBulkLogsQueryDto, type GetCheckInStatsParams, type GetClientCheckInHistoryParams, type GetContractsParams, type GetGymInvitationsParams, type GetMembershipPlansParams, type GetTagClientsParams, type Gym, type GymAmenities, type GymCatalog, type GymSchedule, type GymSettings, type GymSocialMedia, type GymSpaceConfig, GymSpaceError, GymSpaceSdk, type GymStats, GymsResource, HealthResource, type HealthResponse, type InitializeConnectionResponse, type InventorySettings, type InvitationValidationResponse, InvitationsResource, type LeadFiltersDto, LeadGender, type LeadSubmissionResponse, type ListContactsResponse, type LoginDto, type LoginResponseDto, type MembershipManagementFeatures, type MembershipPlan, type MembershipPlanStats, MembershipPlansResource, type MyOrganization, NetworkError, type NewClients, NotFoundError, type NotificationSettings, OnboardingCacheStatus, OnboardingResource, type OnboardingResponse, type OnboardingStatus, type OnboardingStatusResponse, OnboardingStep, type Organization, type OrganizationAdminDetails, type OrganizationStats, type OrganizationWithDetails, OrganizationsResource, type PaginatedCommissionResult, 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, type PromotionReportDto, type PromotionReportFiltersDto, PublicCatalogResource, type ReactivateContractDto, type ReadyResponse, type RegisterCollaboratorDto, type RegisterOwnerDto, type RejectedClient, type RejectedClientDto, type RemoveTagsDto, type RemoveTagsResponse, type RenewContractDto, type ReorderCommissionRulesDto, type ReportFiltersDto, type RequestOptions, type RequestPasswordResetDto, type RequestPasswordResetResponseDto, type ResendResetCodeDto, type ResendResetCodeResponseDto, type ResendVerificationDto, type ResetPasswordDto, type ResetPasswordResponseDto, type ResumeContractDto, RolesResource, type RuleCriteria, type RuleReportDto, type Sale, type SaleItem, type SaleItemDto, SalesResource, type SalesRevenue, type SalesStats, type SearchActivitiesParams, type SearchCatalogParams, type SearchCatalogResponse, type SearchCheckInsParams, type SearchClientsParams, type SearchPaymentMethodsParams, type SearchProductsParams, type SearchSalesParams, type SearchSuppliersParams, type SearchTagsParams, type SearchTemplatesDto, type SearchWhatsAppMessagesDto, type SendBulkMessagesDto, type SendCatalogMessageDto, type SendCatalogMessageResponse, type SendWhatsAppMessageDto, type SentActivityNotification, type SimulateCommissionDto, 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 SuspendContractDto, type SwitchOrganizationDto, type SwitchOrganizationResponse, type Tag, type TagClientsResponse, type TagStatsResponse, type TagWithAssignment, TagsResource, type TimeSlot, type TopSellingProduct, type UpdateActivityDto, type UpdateActivityNotificationDto, type UpdateBulkTemplateDto, type UpdateCatalogConfigDto, type UpdateClientDto, type UpdateCommissionConfigDto, type UpdateCommissionRuleDto, type UpdateGymContractSettingsDto, type UpdateGymDto, type UpdateGymInventorySettingsDto, 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 UpdateTagDto, 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 };
|
|
4019
|
+
export { type ActivateRenewalDto, ActivitiesResource, type Activity, type ActivityNotificationDto, type ActivityPlanRestriction, type ActivityStats, type ActivityStatsParams, AdminCatalogResource, AdminSubscriptionManagementResource, type AdminSubscriptionStatusDto, type AffiliateOrganizationDto, type Amenities, ApiClient, type ApiResponse, type AssetResponseDto, AssetsResource, type AssignTagsDto, type AssignTagsResponse, AuthResource, AuthenticationError, AuthorizationError, type AvailablePlanDto, type BulkLogsResponse, type BulkLogsResponseDto, type BulkMessageLog, type BulkMessageLogDto, type BulkMessageResult, type BulkMessageResultDto, BulkMessagingResource, type BulkTemplate, type BusinessHours, type CancelContractDto, type CancelSubscriptionDto, type CancellationAnalytics, type CatalogActivity, type CatalogGym, type CatalogHeroSection, type CatalogLead, type CatalogLocation, type CatalogPlan, type CatalogResponse, type CatalogSocialMedia, 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, type ClientTag, type ClientTagsResponse, ClientsResource, type CollaboratorReportDto, type CollaboratorRoleDto, CollaboratorsResource, type CommissionCalculationDto, CommissionCalculationsResource, CommissionChangeType, type CommissionComparisonDto, type CommissionConfigDto, CommissionConfigResource, CommissionEntityType, type CommissionFiltersDto, type CommissionHistoryDto, type CommissionHistoryFiltersDto, CommissionPromotionsResource, CommissionReportsResource, type CommissionRuleDto, type CommissionRuleFiltersDto, CommissionRuleType, CommissionRulesResource, type CommissionSimulationDto, CommissionStatus, type CommissionSummaryDto, type CommissionSummaryReportDto, type CompleteGuidedSetupData, type ConfigureFeaturesData, type ConnectionStatusResponse, type Contact, type Contract, type ContractLifecycleEvent, type ContractSettings, ContractsResource, type ContractsRevenue, type CreateActivityDto, type CreateActivityNotificationDto, type CreateBulkTemplateDto, type CreateCheckInDto, type CreateClientDto, type CreateCommissionConfigDto, type CreateCommissionRuleDto, type CreateContractDto, type CreateGymDto, type CreateLeadDto, type CreateMembershipPlanDto, type CreatePaymentMethodDto, type CreateProductCategoryDto, type CreateProductDto, type CreateSaleDto, type CreateServiceDto, type CreateSubscriptionPlanDto, type CreateSupplierDto, type CreateTagDto, type CreateTemplateDto, type CreateWhatsAppConfigDto, type CurrentSessionResponse, type CurrentlyInGymResponse, type CustomerSalesReport, DashboardResource, type DashboardStats, type DateRangeParams, type DaySchedule, type Debts, type DeleteActivityParams, type DeleteTagResponse, type DisconnectResponse, type EligibleClient, type EligibleClientsResponse, type ExpiringContract, type FileResponseDto, FilesResource, type FormattedSchedule, type FreezeContractDto, type GenerateAIMessageDto, type GenerateAIMessageParams, type GenerateAIMessageResponse, type GenerateAIMessageResponseDto, type GetBulkLogsQueryDto, type GetCheckInStatsParams, type GetClientCheckInHistoryParams, type GetContractsParams, type GetGymInvitationsParams, type GetMembershipPlansParams, type GetMessagesParams, type GetTagClientsParams, type Gym, type GymAmenities, type GymCatalog, type GymSchedule, type GymSettings, type GymSocialMedia, type GymSpaceConfig, GymSpaceError, GymSpaceSdk, type GymStats, GymsResource, HealthResource, type HealthResponse, type InitializeConnectionResponse, type InventorySettings, type InvitationValidationResponse, InvitationsResource, type LeadFiltersDto, LeadGender, type LeadSubmissionResponse, type ListContactsResponse, type LoginDto, type LoginResponseDto, type MembershipManagementFeatures, type MembershipPlan, type MembershipPlanStats, MembershipPlansResource, type Message, type MessageStatusUpdate, MessagesResource, type MyOrganization, NetworkError, type NewClients, NotFoundError, type NotificationSettings, OnboardingCacheStatus, OnboardingResource, type OnboardingResponse, type OnboardingStatus, type OnboardingStatusResponse, OnboardingStep, type Organization, type OrganizationAdminDetails, type OrganizationStats, type OrganizationWithDetails, OrganizationsResource, type PaginatedCommissionResult, 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, type PromotionReportDto, type PromotionReportFiltersDto, PublicCatalogResource, type ReactivateContractDto, type ReadyResponse, type RegisterCollaboratorDto, type RegisterOwnerDto, type RejectedClient, type RejectedClientDto, type RemoveTagsDto, type RemoveTagsResponse, type RenewContractDto, type ReorderCommissionRulesDto, type ReportFiltersDto, type RequestOptions, type RequestPasswordResetDto, type RequestPasswordResetResponseDto, type ResendResetCodeDto, type ResendResetCodeResponseDto, type ResendVerificationDto, type ResetPasswordDto, type ResetPasswordResponseDto, type ResumeContractDto, RolesResource, type RuleCriteria, type RuleReportDto, type Sale, type SaleItem, type SaleItemDto, SalesResource, type SalesRevenue, type SalesStats, type SearchActivitiesParams, type SearchCatalogParams, type SearchCatalogResponse, type SearchCheckInsParams, type SearchClientsParams, type SearchPaymentMethodsParams, type SearchProductsParams, type SearchSalesParams, type SearchSuppliersParams, type SearchTagsParams, type SearchTemplatesDto, type SearchWhatsAppMessagesDto, type SendBulkMessagesDto, type SendCatalogMessageDto, type SendCatalogMessageResponse, type SendWhatsAppMessageDto, type SentActivityNotification, type SimulateCommissionDto, 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 SuspendContractDto, type SwitchOrganizationDto, type SwitchOrganizationResponse, type Tag, type TagClientsResponse, type TagStatsResponse, type TagWithAssignment, TagsResource, type TimeSlot, type TopSellingProduct, type UpdateActivityDto, type UpdateActivityNotificationDto, type UpdateBulkTemplateDto, type UpdateCatalogConfigDto, type UpdateClientDto, type UpdateCommissionConfigDto, type UpdateCommissionRuleDto, type UpdateGymContractSettingsDto, type UpdateGymDto, type UpdateGymInventorySettingsDto, 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 UpdateTagDto, 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
|
@@ -482,6 +482,22 @@ var GymsResource = class extends BaseResource {
|
|
|
482
482
|
async updateContractSettings(data, options) {
|
|
483
483
|
return this.client.patch(`${this.basePath}/current/contract-settings`, data, options);
|
|
484
484
|
}
|
|
485
|
+
/**
|
|
486
|
+
* Soft delete a gym
|
|
487
|
+
* Cannot delete gym with active contracts or collaborators
|
|
488
|
+
* @param id Gym ID
|
|
489
|
+
* @param options Request options
|
|
490
|
+
* @returns Success response
|
|
491
|
+
*
|
|
492
|
+
* @example
|
|
493
|
+
* ```typescript
|
|
494
|
+
* const result = await sdk.gyms.deleteGym('gym-id');
|
|
495
|
+
* console.log(result.success); // true
|
|
496
|
+
* ```
|
|
497
|
+
*/
|
|
498
|
+
async deleteGym(id, options) {
|
|
499
|
+
return this.client.delete(`${this.basePath}/${id}`, options);
|
|
500
|
+
}
|
|
485
501
|
};
|
|
486
502
|
|
|
487
503
|
// src/resources/collaborators.ts
|
|
@@ -829,6 +845,9 @@ var InvitationsResource = class extends BaseResource {
|
|
|
829
845
|
async validateByCode(data, options) {
|
|
830
846
|
return this.client.post(`${this.basePath}/validate-by-code`, data, options);
|
|
831
847
|
}
|
|
848
|
+
async validateByToken(data, options) {
|
|
849
|
+
return this.client.post(`${this.basePath}/validate-by-token`, data, options);
|
|
850
|
+
}
|
|
832
851
|
async acceptInvitation(data, options) {
|
|
833
852
|
return this.client.post(`${this.basePath}/accept`, data, options);
|
|
834
853
|
}
|
|
@@ -1318,6 +1337,20 @@ var SalesResource = class extends BaseResource {
|
|
|
1318
1337
|
options
|
|
1319
1338
|
);
|
|
1320
1339
|
}
|
|
1340
|
+
/**
|
|
1341
|
+
* Send payment reminder for unpaid sale via WhatsApp
|
|
1342
|
+
* @param saleId - ID of the sale
|
|
1343
|
+
* @param options - Request options
|
|
1344
|
+
* @returns Promise with success status and message
|
|
1345
|
+
* @throws {ApiError} If sale is already paid, customer has no phone, or sale not found
|
|
1346
|
+
*/
|
|
1347
|
+
async sendPaymentReminder(saleId, options) {
|
|
1348
|
+
return this.client.post(
|
|
1349
|
+
`${this.basePath}/${saleId}/send-payment-reminder`,
|
|
1350
|
+
{},
|
|
1351
|
+
options
|
|
1352
|
+
);
|
|
1353
|
+
}
|
|
1321
1354
|
};
|
|
1322
1355
|
|
|
1323
1356
|
// src/resources/suppliers.ts
|
|
@@ -2100,6 +2133,27 @@ var CommissionPromotionsResource = class extends BaseResource {
|
|
|
2100
2133
|
}
|
|
2101
2134
|
};
|
|
2102
2135
|
|
|
2136
|
+
// src/resources/messages.ts
|
|
2137
|
+
var MessagesResource = class extends BaseResource {
|
|
2138
|
+
constructor() {
|
|
2139
|
+
super(...arguments);
|
|
2140
|
+
this.basePath = "messages";
|
|
2141
|
+
}
|
|
2142
|
+
async getMessages(params, options) {
|
|
2143
|
+
const response = await this.client.get(this.basePath, params, options);
|
|
2144
|
+
return response.data;
|
|
2145
|
+
}
|
|
2146
|
+
async getMessage(id, options) {
|
|
2147
|
+
return this.client.get(`${this.basePath}/${id}`, void 0, options);
|
|
2148
|
+
}
|
|
2149
|
+
async retryMessage(id, options) {
|
|
2150
|
+
return this.client.post(`${this.basePath}/${id}/retry`, void 0, options);
|
|
2151
|
+
}
|
|
2152
|
+
async cancelMessage(id, options) {
|
|
2153
|
+
return this.client.post(`${this.basePath}/${id}/cancel`, void 0, options);
|
|
2154
|
+
}
|
|
2155
|
+
};
|
|
2156
|
+
|
|
2103
2157
|
// src/sdk.ts
|
|
2104
2158
|
var GymSpaceSdk = class {
|
|
2105
2159
|
constructor(config) {
|
|
@@ -2139,6 +2193,7 @@ var GymSpaceSdk = class {
|
|
|
2139
2193
|
this.commissionCalculations = new CommissionCalculationsResource(this.client);
|
|
2140
2194
|
this.commissionReports = new CommissionReportsResource(this.client);
|
|
2141
2195
|
this.commissionPromotions = new CommissionPromotionsResource(this.client);
|
|
2196
|
+
this.messages = new MessagesResource(this.client);
|
|
2142
2197
|
}
|
|
2143
2198
|
/**
|
|
2144
2199
|
* Set the authentication token
|
|
@@ -2570,16 +2625,24 @@ function getVariablesByContext(context) {
|
|
|
2570
2625
|
return VARIABLE_CONTEXT_MAP[context] || BULK_MESSAGE_VARIABLES;
|
|
2571
2626
|
}
|
|
2572
2627
|
function validateVariablesInContext(message, context) {
|
|
2573
|
-
const
|
|
2574
|
-
const
|
|
2628
|
+
const doubleBracePattern = /\{\{(\w+)\}\}/g;
|
|
2629
|
+
const singleBracePattern = /\{(\w+)\}/g;
|
|
2630
|
+
const doubleBraceMatches = message.matchAll(doubleBracePattern);
|
|
2631
|
+
const singleBraceMatches = message.matchAll(singleBracePattern);
|
|
2575
2632
|
const invalidVariables = [];
|
|
2576
2633
|
const validVariables = getVariablesByContext(context).map((v) => v.name);
|
|
2577
|
-
for (const match of
|
|
2634
|
+
for (const match of doubleBraceMatches) {
|
|
2578
2635
|
const variableName = match[1];
|
|
2579
2636
|
if (!validVariables.includes(variableName)) {
|
|
2580
2637
|
invalidVariables.push(variableName);
|
|
2581
2638
|
}
|
|
2582
2639
|
}
|
|
2640
|
+
for (const match of singleBraceMatches) {
|
|
2641
|
+
const variableName = match[1];
|
|
2642
|
+
if (!validVariables.includes(variableName) && !invalidVariables.includes(variableName)) {
|
|
2643
|
+
invalidVariables.push(variableName);
|
|
2644
|
+
}
|
|
2645
|
+
}
|
|
2583
2646
|
return {
|
|
2584
2647
|
valid: invalidVariables.length === 0,
|
|
2585
2648
|
invalidVariables
|
|
@@ -2666,6 +2729,11 @@ var PERMISSIONS = {
|
|
|
2666
2729
|
WHATSAPP_MANAGE: "WHATSAPP_MANAGE",
|
|
2667
2730
|
WHATSAPP_BULK_SEND: "WHATSAPP_BULK_SEND",
|
|
2668
2731
|
WHATSAPP_BULK_MANAGE: "WHATSAPP_BULK_MANAGE",
|
|
2732
|
+
// Messages
|
|
2733
|
+
MESSAGES_READ: "MESSAGES_READ",
|
|
2734
|
+
MESSAGES_CREATE: "MESSAGES_CREATE",
|
|
2735
|
+
MESSAGES_RETRY: "MESSAGES_RETRY",
|
|
2736
|
+
MESSAGES_CANCEL: "MESSAGES_CANCEL",
|
|
2669
2737
|
// Activities
|
|
2670
2738
|
ACTIVITIES_CREATE: "ACTIVITIES_CREATE",
|
|
2671
2739
|
ACTIVITIES_READ: "ACTIVITIES_READ",
|
|
@@ -2876,8 +2944,19 @@ var ContractAssetType = /* @__PURE__ */ ((ContractAssetType2) => {
|
|
|
2876
2944
|
ContractAssetType2["OTHER"] = "other";
|
|
2877
2945
|
return ContractAssetType2;
|
|
2878
2946
|
})(ContractAssetType || {});
|
|
2947
|
+
var MessageStatus = /* @__PURE__ */ ((MessageStatus2) => {
|
|
2948
|
+
MessageStatus2["PENDING"] = "pending";
|
|
2949
|
+
MessageStatus2["SCHEDULED"] = "scheduled";
|
|
2950
|
+
MessageStatus2["QUEUED"] = "queued";
|
|
2951
|
+
MessageStatus2["SENDING"] = "sending";
|
|
2952
|
+
MessageStatus2["SENT"] = "sent";
|
|
2953
|
+
MessageStatus2["FAILED"] = "failed";
|
|
2954
|
+
MessageStatus2["CANCELLED"] = "cancelled";
|
|
2955
|
+
return MessageStatus2;
|
|
2956
|
+
})(MessageStatus || {});
|
|
2879
2957
|
var WHATSAPP_EVENTS = {
|
|
2880
2958
|
MESSAGE_SEND: "whatsapp/message.send",
|
|
2959
|
+
MESSAGE_RETRY: "whatsapp/message.retry",
|
|
2881
2960
|
MESSAGE_RECEIVED: "whatsapp/message.received",
|
|
2882
2961
|
CONNECTION_UPDATE: "whatsapp/connection.update"
|
|
2883
2962
|
};
|
|
@@ -3129,6 +3208,8 @@ exports.InvitationStatus = InvitationStatus;
|
|
|
3129
3208
|
exports.InvitationsResource = InvitationsResource;
|
|
3130
3209
|
exports.LeadGender = LeadGender;
|
|
3131
3210
|
exports.MembershipPlansResource = MembershipPlansResource;
|
|
3211
|
+
exports.MessageStatus = MessageStatus;
|
|
3212
|
+
exports.MessagesResource = MessagesResource;
|
|
3132
3213
|
exports.NetworkError = NetworkError;
|
|
3133
3214
|
exports.NotFoundError = NotFoundError;
|
|
3134
3215
|
exports.OnboardingCacheStatus = OnboardingCacheStatus;
|