@vitalfit/sdk 0.0.75 → 0.0.77
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.cjs +126 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +48 -2
- package/dist/index.d.ts +48 -2
- package/dist/index.js +126 -2
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -44,6 +44,9 @@ type BaseModel = UUIDModel & {
|
|
|
44
44
|
type DataResponse<T> = {
|
|
45
45
|
data: T;
|
|
46
46
|
};
|
|
47
|
+
type PaginationWithStatus = PaginationRequest & {
|
|
48
|
+
status?: string;
|
|
49
|
+
};
|
|
47
50
|
|
|
48
51
|
declare enum UserGender {
|
|
49
52
|
male = "male",
|
|
@@ -736,6 +739,14 @@ type ClientInvoice = {
|
|
|
736
739
|
total_amount: string;
|
|
737
740
|
status: string;
|
|
738
741
|
};
|
|
742
|
+
type InvoiceList = {
|
|
743
|
+
client_name: string;
|
|
744
|
+
invoice_id: string;
|
|
745
|
+
invoice_number: string;
|
|
746
|
+
issue_date: string;
|
|
747
|
+
status: string;
|
|
748
|
+
total_amount: number;
|
|
749
|
+
};
|
|
739
750
|
|
|
740
751
|
type ClientBookingResponse = {
|
|
741
752
|
booking_id: string;
|
|
@@ -853,6 +864,25 @@ type CheckInResponse = {
|
|
|
853
864
|
service_name: string;
|
|
854
865
|
};
|
|
855
866
|
|
|
867
|
+
type ChartData = {
|
|
868
|
+
hour?: number;
|
|
869
|
+
label: string;
|
|
870
|
+
value: number;
|
|
871
|
+
};
|
|
872
|
+
type TopBranch = {
|
|
873
|
+
branch_name: string;
|
|
874
|
+
total_sales: string;
|
|
875
|
+
percent_change: number;
|
|
876
|
+
label: string;
|
|
877
|
+
trend: 'up' | 'down' | string;
|
|
878
|
+
};
|
|
879
|
+
type GlobalStat = {
|
|
880
|
+
percentage_change: number;
|
|
881
|
+
total_current_month: number;
|
|
882
|
+
total_last_month: number;
|
|
883
|
+
trend: string;
|
|
884
|
+
};
|
|
885
|
+
|
|
856
886
|
declare class AuthService {
|
|
857
887
|
private client;
|
|
858
888
|
constructor(client: Client);
|
|
@@ -860,7 +890,7 @@ declare class AuthService {
|
|
|
860
890
|
logout(): void;
|
|
861
891
|
saveJWT(jwt: string): void;
|
|
862
892
|
signUp(signUpData: SignUpRequest): Promise<void>;
|
|
863
|
-
signUpStaff(signUpData: SignUpRequest): Promise<void>;
|
|
893
|
+
signUpStaff(signUpData: SignUpRequest, jwt: string): Promise<void>;
|
|
864
894
|
forgotPassword(email: string): Promise<void>;
|
|
865
895
|
resetPassword(otp: string, password: string, repeatPassword: string): Promise<void>;
|
|
866
896
|
validateResetToken(token: string): Promise<void>;
|
|
@@ -1034,6 +1064,7 @@ declare class BillingService {
|
|
|
1034
1064
|
getPaymentByID(paymentId: string, jwt: string): Promise<DataResponse<PaymentDetail>>;
|
|
1035
1065
|
updatePaymentStatus(paymentId: string, status: string, jwt: string): Promise<void>;
|
|
1036
1066
|
getClientInvoices(jwt: string, { page, limit, sort, search }: PaginationRequest, userID?: string): Promise<PaginatedTotal<ClientInvoice[]>>;
|
|
1067
|
+
getInvoices(jwt: string, { page, limit, sort, search, status, }: PaginationWithStatus): Promise<PaginatedTotal<InvoiceList[]>>;
|
|
1037
1068
|
}
|
|
1038
1069
|
|
|
1039
1070
|
declare class BookingService {
|
|
@@ -1051,6 +1082,20 @@ declare class AccessService {
|
|
|
1051
1082
|
checkIn(jwt: string, data: CheckIn): Promise<CheckInResponse>;
|
|
1052
1083
|
}
|
|
1053
1084
|
|
|
1085
|
+
declare class ReportService {
|
|
1086
|
+
client: Client;
|
|
1087
|
+
constructor(client: Client);
|
|
1088
|
+
mostUsedServices(jwt: string, start: string, end: string): Promise<DataResponse<ChartData[]>>;
|
|
1089
|
+
salesByCategory(jwt: string, start: string, end: string): Promise<DataResponse<ChartData[]>>;
|
|
1090
|
+
salesByHour(jwt: string, start: string, end: string): Promise<DataResponse<ChartData[]>>;
|
|
1091
|
+
salesByPaymentMethod(jwt: string, start: string, end: string): Promise<DataResponse<ChartData[]>>;
|
|
1092
|
+
topInstructors(jwt: string, start: string, end: string): Promise<DataResponse<ChartData[]>>;
|
|
1093
|
+
topBranches(jwt: string): Promise<DataResponse<TopBranch[]>>;
|
|
1094
|
+
globalStats(jwt: string): Promise<DataResponse<TopBranch[]>>;
|
|
1095
|
+
totalActiveBranches(jwt: string): Promise<DataResponse<number>>;
|
|
1096
|
+
totalClients(jwt: string): Promise<DataResponse<number>>;
|
|
1097
|
+
}
|
|
1098
|
+
|
|
1054
1099
|
declare class APIError extends Error {
|
|
1055
1100
|
status: number;
|
|
1056
1101
|
messages: string[];
|
|
@@ -1077,9 +1122,10 @@ declare class VitalFit {
|
|
|
1077
1122
|
billing: BillingService;
|
|
1078
1123
|
booking: BookingService;
|
|
1079
1124
|
access: AccessService;
|
|
1125
|
+
report: ReportService;
|
|
1080
1126
|
constructor(isDevMode: boolean, origin?: string);
|
|
1081
1127
|
static getInstance(isDevMode?: boolean): VitalFit;
|
|
1082
1128
|
version(): string;
|
|
1083
1129
|
}
|
|
1084
1130
|
|
|
1085
|
-
export { APIError, type AddPaymentToInvoicePayload, type AddPaymentToInvoiceResponse, type BankTransferConfig, type Banner, type BannerResponse, type BaseModel, type BookClassRequest, type BranchClassInfo, type BranchDetails, type BranchEquipmentInventory, type BranchInfo, type BranchInstructorInfo, type BranchPaymentMethod, type BranchPaymentMethodInfo, type BranchPaymentVisibility, type BranchScheduleResponse, type BranchServicePrice, type BranchStatusCount, type CancellationReason, type CheckIn, type CheckInResponse, type ClientBookingResponse, type ClientInvoice, type ClientMembership, type ClientMembershipDetail, type ClientMembershipItem, type ClientMembershipUser, type ClientProfile, type CreateBanner, type CreateBranchEquipment, type CreateBranchRequest, type CreateBranchServicePriceItem, type CreateClassPayload, type CreateEquipment, type CreateInvoiceItem, type CreateInvoicePayload, type CreateInvoiceResponse, type CreateMembershipType, type CreatePackagePayload, type CreatePaymentMethod, type CreateRole, type CreateService, type CreateServiceImage, type DataResponse, type Equipment, type EquipmentCategory, type EquipmentInfo, type EquipmentStatus, type GetUserResponse, type Instructor, type InstructorData, type InstructorDataList, type InstructorsSummary, type InvoiceDetail, type InvoiceItemDetail, type InvoicePaymentDetail, type LoginRequest, type LoginResponse, type MembershipType, type MembershipTypeDetail, type MembershipsSummary, type Oauth, type OperatingHour, type PackageDetail, type PackageItemDetail, type PackageItemInput, type PackageListItem, type PackagePublicItem, type PaginatedBranch, type PaginatedEquipmentRequest, type PaginatedInstructor, type PaginatedServiceRequest, type PaginatedTotal, type Pagination, type PaginationBranchRequest, type PaginationRequest, type PagoMovilConfig, type PaymentConfiguration, type PaymentDetail, type PaymentMethod, type PaymentMethodTypes, type Permission, type PublicMembershipResponse, type PublicPaginatedPackage, type PublicPaginationService, type QrToken, type Role, type RoleResponse, type ServiceCategoryInfo, type ServiceFullDetail, type ServiceImageResponse, type ServicePublicItem, type ServicesSummary, type SignUpRequest, type Specialty, type UUIDModel, type UpdateBanner, type UpdateBranchEquipmentDetails, type UpdateBranchPaymentMethod, type UpdateBranchRequest, type UpdateBranchServicePrice, type UpdateClassPayload, type UpdateClientMembershipRequest, type UpdateEquipment, type UpdateMembershipType, type UpdateOperatingHour, type UpdatePackagePayload, type UpdateServiceImageManual, type UpdateServiceManual, type UpdateUserRequest, type UpdateUserStaffRequest, type User, type UserApiResponse, UserGender, type UserPaginationOptions, VitalFit, type ZelleConfig, isAPIError, mainCurrencies };
|
|
1131
|
+
export { APIError, type AddPaymentToInvoicePayload, type AddPaymentToInvoiceResponse, type BankTransferConfig, type Banner, type BannerResponse, type BaseModel, type BookClassRequest, type BranchClassInfo, type BranchDetails, type BranchEquipmentInventory, type BranchInfo, type BranchInstructorInfo, type BranchPaymentMethod, type BranchPaymentMethodInfo, type BranchPaymentVisibility, type BranchScheduleResponse, type BranchServicePrice, type BranchStatusCount, type CancellationReason, type ChartData, type CheckIn, type CheckInResponse, type ClientBookingResponse, type ClientInvoice, type ClientMembership, type ClientMembershipDetail, type ClientMembershipItem, type ClientMembershipUser, type ClientProfile, type CreateBanner, type CreateBranchEquipment, type CreateBranchRequest, type CreateBranchServicePriceItem, type CreateClassPayload, type CreateEquipment, type CreateInvoiceItem, type CreateInvoicePayload, type CreateInvoiceResponse, type CreateMembershipType, type CreatePackagePayload, type CreatePaymentMethod, type CreateRole, type CreateService, type CreateServiceImage, type DataResponse, type Equipment, type EquipmentCategory, type EquipmentInfo, type EquipmentStatus, type GetUserResponse, type GlobalStat, type Instructor, type InstructorData, type InstructorDataList, type InstructorsSummary, type InvoiceDetail, type InvoiceItemDetail, type InvoiceList, type InvoicePaymentDetail, type LoginRequest, type LoginResponse, type MembershipType, type MembershipTypeDetail, type MembershipsSummary, type Oauth, type OperatingHour, type PackageDetail, type PackageItemDetail, type PackageItemInput, type PackageListItem, type PackagePublicItem, type PaginatedBranch, type PaginatedEquipmentRequest, type PaginatedInstructor, type PaginatedServiceRequest, type PaginatedTotal, type Pagination, type PaginationBranchRequest, type PaginationRequest, type PaginationWithStatus, type PagoMovilConfig, type PaymentConfiguration, type PaymentDetail, type PaymentMethod, type PaymentMethodTypes, type Permission, type PublicMembershipResponse, type PublicPaginatedPackage, type PublicPaginationService, type QrToken, type Role, type RoleResponse, type ServiceCategoryInfo, type ServiceFullDetail, type ServiceImageResponse, type ServicePublicItem, type ServicesSummary, type SignUpRequest, type Specialty, type TopBranch, type UUIDModel, type UpdateBanner, type UpdateBranchEquipmentDetails, type UpdateBranchPaymentMethod, type UpdateBranchRequest, type UpdateBranchServicePrice, type UpdateClassPayload, type UpdateClientMembershipRequest, type UpdateEquipment, type UpdateMembershipType, type UpdateOperatingHour, type UpdatePackagePayload, type UpdateServiceImageManual, type UpdateServiceManual, type UpdateUserRequest, type UpdateUserStaffRequest, type User, type UserApiResponse, UserGender, type UserPaginationOptions, VitalFit, type ZelleConfig, isAPIError, mainCurrencies };
|
package/dist/index.d.ts
CHANGED
|
@@ -44,6 +44,9 @@ type BaseModel = UUIDModel & {
|
|
|
44
44
|
type DataResponse<T> = {
|
|
45
45
|
data: T;
|
|
46
46
|
};
|
|
47
|
+
type PaginationWithStatus = PaginationRequest & {
|
|
48
|
+
status?: string;
|
|
49
|
+
};
|
|
47
50
|
|
|
48
51
|
declare enum UserGender {
|
|
49
52
|
male = "male",
|
|
@@ -736,6 +739,14 @@ type ClientInvoice = {
|
|
|
736
739
|
total_amount: string;
|
|
737
740
|
status: string;
|
|
738
741
|
};
|
|
742
|
+
type InvoiceList = {
|
|
743
|
+
client_name: string;
|
|
744
|
+
invoice_id: string;
|
|
745
|
+
invoice_number: string;
|
|
746
|
+
issue_date: string;
|
|
747
|
+
status: string;
|
|
748
|
+
total_amount: number;
|
|
749
|
+
};
|
|
739
750
|
|
|
740
751
|
type ClientBookingResponse = {
|
|
741
752
|
booking_id: string;
|
|
@@ -853,6 +864,25 @@ type CheckInResponse = {
|
|
|
853
864
|
service_name: string;
|
|
854
865
|
};
|
|
855
866
|
|
|
867
|
+
type ChartData = {
|
|
868
|
+
hour?: number;
|
|
869
|
+
label: string;
|
|
870
|
+
value: number;
|
|
871
|
+
};
|
|
872
|
+
type TopBranch = {
|
|
873
|
+
branch_name: string;
|
|
874
|
+
total_sales: string;
|
|
875
|
+
percent_change: number;
|
|
876
|
+
label: string;
|
|
877
|
+
trend: 'up' | 'down' | string;
|
|
878
|
+
};
|
|
879
|
+
type GlobalStat = {
|
|
880
|
+
percentage_change: number;
|
|
881
|
+
total_current_month: number;
|
|
882
|
+
total_last_month: number;
|
|
883
|
+
trend: string;
|
|
884
|
+
};
|
|
885
|
+
|
|
856
886
|
declare class AuthService {
|
|
857
887
|
private client;
|
|
858
888
|
constructor(client: Client);
|
|
@@ -860,7 +890,7 @@ declare class AuthService {
|
|
|
860
890
|
logout(): void;
|
|
861
891
|
saveJWT(jwt: string): void;
|
|
862
892
|
signUp(signUpData: SignUpRequest): Promise<void>;
|
|
863
|
-
signUpStaff(signUpData: SignUpRequest): Promise<void>;
|
|
893
|
+
signUpStaff(signUpData: SignUpRequest, jwt: string): Promise<void>;
|
|
864
894
|
forgotPassword(email: string): Promise<void>;
|
|
865
895
|
resetPassword(otp: string, password: string, repeatPassword: string): Promise<void>;
|
|
866
896
|
validateResetToken(token: string): Promise<void>;
|
|
@@ -1034,6 +1064,7 @@ declare class BillingService {
|
|
|
1034
1064
|
getPaymentByID(paymentId: string, jwt: string): Promise<DataResponse<PaymentDetail>>;
|
|
1035
1065
|
updatePaymentStatus(paymentId: string, status: string, jwt: string): Promise<void>;
|
|
1036
1066
|
getClientInvoices(jwt: string, { page, limit, sort, search }: PaginationRequest, userID?: string): Promise<PaginatedTotal<ClientInvoice[]>>;
|
|
1067
|
+
getInvoices(jwt: string, { page, limit, sort, search, status, }: PaginationWithStatus): Promise<PaginatedTotal<InvoiceList[]>>;
|
|
1037
1068
|
}
|
|
1038
1069
|
|
|
1039
1070
|
declare class BookingService {
|
|
@@ -1051,6 +1082,20 @@ declare class AccessService {
|
|
|
1051
1082
|
checkIn(jwt: string, data: CheckIn): Promise<CheckInResponse>;
|
|
1052
1083
|
}
|
|
1053
1084
|
|
|
1085
|
+
declare class ReportService {
|
|
1086
|
+
client: Client;
|
|
1087
|
+
constructor(client: Client);
|
|
1088
|
+
mostUsedServices(jwt: string, start: string, end: string): Promise<DataResponse<ChartData[]>>;
|
|
1089
|
+
salesByCategory(jwt: string, start: string, end: string): Promise<DataResponse<ChartData[]>>;
|
|
1090
|
+
salesByHour(jwt: string, start: string, end: string): Promise<DataResponse<ChartData[]>>;
|
|
1091
|
+
salesByPaymentMethod(jwt: string, start: string, end: string): Promise<DataResponse<ChartData[]>>;
|
|
1092
|
+
topInstructors(jwt: string, start: string, end: string): Promise<DataResponse<ChartData[]>>;
|
|
1093
|
+
topBranches(jwt: string): Promise<DataResponse<TopBranch[]>>;
|
|
1094
|
+
globalStats(jwt: string): Promise<DataResponse<TopBranch[]>>;
|
|
1095
|
+
totalActiveBranches(jwt: string): Promise<DataResponse<number>>;
|
|
1096
|
+
totalClients(jwt: string): Promise<DataResponse<number>>;
|
|
1097
|
+
}
|
|
1098
|
+
|
|
1054
1099
|
declare class APIError extends Error {
|
|
1055
1100
|
status: number;
|
|
1056
1101
|
messages: string[];
|
|
@@ -1077,9 +1122,10 @@ declare class VitalFit {
|
|
|
1077
1122
|
billing: BillingService;
|
|
1078
1123
|
booking: BookingService;
|
|
1079
1124
|
access: AccessService;
|
|
1125
|
+
report: ReportService;
|
|
1080
1126
|
constructor(isDevMode: boolean, origin?: string);
|
|
1081
1127
|
static getInstance(isDevMode?: boolean): VitalFit;
|
|
1082
1128
|
version(): string;
|
|
1083
1129
|
}
|
|
1084
1130
|
|
|
1085
|
-
export { APIError, type AddPaymentToInvoicePayload, type AddPaymentToInvoiceResponse, type BankTransferConfig, type Banner, type BannerResponse, type BaseModel, type BookClassRequest, type BranchClassInfo, type BranchDetails, type BranchEquipmentInventory, type BranchInfo, type BranchInstructorInfo, type BranchPaymentMethod, type BranchPaymentMethodInfo, type BranchPaymentVisibility, type BranchScheduleResponse, type BranchServicePrice, type BranchStatusCount, type CancellationReason, type CheckIn, type CheckInResponse, type ClientBookingResponse, type ClientInvoice, type ClientMembership, type ClientMembershipDetail, type ClientMembershipItem, type ClientMembershipUser, type ClientProfile, type CreateBanner, type CreateBranchEquipment, type CreateBranchRequest, type CreateBranchServicePriceItem, type CreateClassPayload, type CreateEquipment, type CreateInvoiceItem, type CreateInvoicePayload, type CreateInvoiceResponse, type CreateMembershipType, type CreatePackagePayload, type CreatePaymentMethod, type CreateRole, type CreateService, type CreateServiceImage, type DataResponse, type Equipment, type EquipmentCategory, type EquipmentInfo, type EquipmentStatus, type GetUserResponse, type Instructor, type InstructorData, type InstructorDataList, type InstructorsSummary, type InvoiceDetail, type InvoiceItemDetail, type InvoicePaymentDetail, type LoginRequest, type LoginResponse, type MembershipType, type MembershipTypeDetail, type MembershipsSummary, type Oauth, type OperatingHour, type PackageDetail, type PackageItemDetail, type PackageItemInput, type PackageListItem, type PackagePublicItem, type PaginatedBranch, type PaginatedEquipmentRequest, type PaginatedInstructor, type PaginatedServiceRequest, type PaginatedTotal, type Pagination, type PaginationBranchRequest, type PaginationRequest, type PagoMovilConfig, type PaymentConfiguration, type PaymentDetail, type PaymentMethod, type PaymentMethodTypes, type Permission, type PublicMembershipResponse, type PublicPaginatedPackage, type PublicPaginationService, type QrToken, type Role, type RoleResponse, type ServiceCategoryInfo, type ServiceFullDetail, type ServiceImageResponse, type ServicePublicItem, type ServicesSummary, type SignUpRequest, type Specialty, type UUIDModel, type UpdateBanner, type UpdateBranchEquipmentDetails, type UpdateBranchPaymentMethod, type UpdateBranchRequest, type UpdateBranchServicePrice, type UpdateClassPayload, type UpdateClientMembershipRequest, type UpdateEquipment, type UpdateMembershipType, type UpdateOperatingHour, type UpdatePackagePayload, type UpdateServiceImageManual, type UpdateServiceManual, type UpdateUserRequest, type UpdateUserStaffRequest, type User, type UserApiResponse, UserGender, type UserPaginationOptions, VitalFit, type ZelleConfig, isAPIError, mainCurrencies };
|
|
1131
|
+
export { APIError, type AddPaymentToInvoicePayload, type AddPaymentToInvoiceResponse, type BankTransferConfig, type Banner, type BannerResponse, type BaseModel, type BookClassRequest, type BranchClassInfo, type BranchDetails, type BranchEquipmentInventory, type BranchInfo, type BranchInstructorInfo, type BranchPaymentMethod, type BranchPaymentMethodInfo, type BranchPaymentVisibility, type BranchScheduleResponse, type BranchServicePrice, type BranchStatusCount, type CancellationReason, type ChartData, type CheckIn, type CheckInResponse, type ClientBookingResponse, type ClientInvoice, type ClientMembership, type ClientMembershipDetail, type ClientMembershipItem, type ClientMembershipUser, type ClientProfile, type CreateBanner, type CreateBranchEquipment, type CreateBranchRequest, type CreateBranchServicePriceItem, type CreateClassPayload, type CreateEquipment, type CreateInvoiceItem, type CreateInvoicePayload, type CreateInvoiceResponse, type CreateMembershipType, type CreatePackagePayload, type CreatePaymentMethod, type CreateRole, type CreateService, type CreateServiceImage, type DataResponse, type Equipment, type EquipmentCategory, type EquipmentInfo, type EquipmentStatus, type GetUserResponse, type GlobalStat, type Instructor, type InstructorData, type InstructorDataList, type InstructorsSummary, type InvoiceDetail, type InvoiceItemDetail, type InvoiceList, type InvoicePaymentDetail, type LoginRequest, type LoginResponse, type MembershipType, type MembershipTypeDetail, type MembershipsSummary, type Oauth, type OperatingHour, type PackageDetail, type PackageItemDetail, type PackageItemInput, type PackageListItem, type PackagePublicItem, type PaginatedBranch, type PaginatedEquipmentRequest, type PaginatedInstructor, type PaginatedServiceRequest, type PaginatedTotal, type Pagination, type PaginationBranchRequest, type PaginationRequest, type PaginationWithStatus, type PagoMovilConfig, type PaymentConfiguration, type PaymentDetail, type PaymentMethod, type PaymentMethodTypes, type Permission, type PublicMembershipResponse, type PublicPaginatedPackage, type PublicPaginationService, type QrToken, type Role, type RoleResponse, type ServiceCategoryInfo, type ServiceFullDetail, type ServiceImageResponse, type ServicePublicItem, type ServicesSummary, type SignUpRequest, type Specialty, type TopBranch, type UUIDModel, type UpdateBanner, type UpdateBranchEquipmentDetails, type UpdateBranchPaymentMethod, type UpdateBranchRequest, type UpdateBranchServicePrice, type UpdateClassPayload, type UpdateClientMembershipRequest, type UpdateEquipment, type UpdateMembershipType, type UpdateOperatingHour, type UpdatePackagePayload, type UpdateServiceImageManual, type UpdateServiceManual, type UpdateUserRequest, type UpdateUserStaffRequest, type User, type UserApiResponse, UserGender, type UserPaginationOptions, VitalFit, type ZelleConfig, isAPIError, mainCurrencies };
|
package/dist/index.js
CHANGED
|
@@ -159,13 +159,14 @@ var AuthService = class {
|
|
|
159
159
|
data: signUpData
|
|
160
160
|
});
|
|
161
161
|
}
|
|
162
|
-
async signUpStaff(signUpData) {
|
|
162
|
+
async signUpStaff(signUpData, jwt) {
|
|
163
163
|
const birthDateRegex = /^\d{4}-\d{2}-\d{2}$/;
|
|
164
164
|
if (!birthDateRegex.test(signUpData.birth_date)) {
|
|
165
165
|
throw new Error("Birth date must be in the format YYYY-MM-DD");
|
|
166
166
|
}
|
|
167
167
|
await this.client.post({
|
|
168
168
|
url: "/auth/register-staff",
|
|
169
|
+
jwt,
|
|
169
170
|
data: signUpData
|
|
170
171
|
});
|
|
171
172
|
}
|
|
@@ -1213,6 +1214,7 @@ var BillingService = class {
|
|
|
1213
1214
|
this.getPaymentByID = this.getPaymentByID.bind(this);
|
|
1214
1215
|
this.updatePaymentStatus = this.updatePaymentStatus.bind(this);
|
|
1215
1216
|
this.getClientInvoices = this.getClientInvoices.bind(this);
|
|
1217
|
+
this.getInvoices = this.getInvoices.bind(this);
|
|
1216
1218
|
}
|
|
1217
1219
|
async createInvoice(data, jwt) {
|
|
1218
1220
|
const response = await this.client.post({
|
|
@@ -1266,6 +1268,26 @@ var BillingService = class {
|
|
|
1266
1268
|
});
|
|
1267
1269
|
return response;
|
|
1268
1270
|
}
|
|
1271
|
+
async getInvoices(jwt, {
|
|
1272
|
+
page = 1,
|
|
1273
|
+
limit = 10,
|
|
1274
|
+
sort = "desc",
|
|
1275
|
+
search,
|
|
1276
|
+
status
|
|
1277
|
+
}) {
|
|
1278
|
+
const response = await this.client.get({
|
|
1279
|
+
url: "/billing/invoices",
|
|
1280
|
+
jwt,
|
|
1281
|
+
params: {
|
|
1282
|
+
page,
|
|
1283
|
+
limit,
|
|
1284
|
+
sort,
|
|
1285
|
+
search,
|
|
1286
|
+
status
|
|
1287
|
+
}
|
|
1288
|
+
});
|
|
1289
|
+
return response;
|
|
1290
|
+
}
|
|
1269
1291
|
};
|
|
1270
1292
|
|
|
1271
1293
|
// src/services/booking.ts
|
|
@@ -1324,6 +1346,106 @@ var AccessService = class {
|
|
|
1324
1346
|
}
|
|
1325
1347
|
};
|
|
1326
1348
|
|
|
1349
|
+
// src/services/reports.ts
|
|
1350
|
+
var ReportService = class {
|
|
1351
|
+
client;
|
|
1352
|
+
constructor(client) {
|
|
1353
|
+
this.client = client;
|
|
1354
|
+
this.mostUsedServices = this.mostUsedServices.bind(this);
|
|
1355
|
+
this.salesByCategory = this.salesByCategory.bind(this);
|
|
1356
|
+
this.salesByHour = this.salesByHour.bind(this);
|
|
1357
|
+
this.salesByPaymentMethod = this.salesByPaymentMethod.bind(this);
|
|
1358
|
+
this.topInstructors = this.topInstructors.bind(this);
|
|
1359
|
+
this.topBranches = this.topBranches.bind(this);
|
|
1360
|
+
this.globalStats = this.globalStats.bind(this);
|
|
1361
|
+
this.totalActiveBranches = this.totalActiveBranches.bind(this);
|
|
1362
|
+
this.totalClients = this.totalClients.bind(this);
|
|
1363
|
+
}
|
|
1364
|
+
async mostUsedServices(jwt, start, end) {
|
|
1365
|
+
const response = await this.client.get({
|
|
1366
|
+
url: "/reports/charts/most-used-services",
|
|
1367
|
+
jwt,
|
|
1368
|
+
params: {
|
|
1369
|
+
start,
|
|
1370
|
+
end
|
|
1371
|
+
}
|
|
1372
|
+
});
|
|
1373
|
+
return response;
|
|
1374
|
+
}
|
|
1375
|
+
async salesByCategory(jwt, start, end) {
|
|
1376
|
+
const response = await this.client.get({
|
|
1377
|
+
url: "/reports/charts/sales-by-category",
|
|
1378
|
+
jwt,
|
|
1379
|
+
params: {
|
|
1380
|
+
start,
|
|
1381
|
+
end
|
|
1382
|
+
}
|
|
1383
|
+
});
|
|
1384
|
+
return response;
|
|
1385
|
+
}
|
|
1386
|
+
async salesByHour(jwt, start, end) {
|
|
1387
|
+
const response = await this.client.get({
|
|
1388
|
+
url: "/reports/charts/sales-by-hour",
|
|
1389
|
+
jwt,
|
|
1390
|
+
params: {
|
|
1391
|
+
start,
|
|
1392
|
+
end
|
|
1393
|
+
}
|
|
1394
|
+
});
|
|
1395
|
+
return response;
|
|
1396
|
+
}
|
|
1397
|
+
async salesByPaymentMethod(jwt, start, end) {
|
|
1398
|
+
const response = await this.client.get({
|
|
1399
|
+
url: "/reports/charts/sales-by-payment-method",
|
|
1400
|
+
jwt,
|
|
1401
|
+
params: {
|
|
1402
|
+
start,
|
|
1403
|
+
end
|
|
1404
|
+
}
|
|
1405
|
+
});
|
|
1406
|
+
return response;
|
|
1407
|
+
}
|
|
1408
|
+
async topInstructors(jwt, start, end) {
|
|
1409
|
+
const response = await this.client.get({
|
|
1410
|
+
url: "/reports/charts/sales-by-payment-method",
|
|
1411
|
+
jwt,
|
|
1412
|
+
params: {
|
|
1413
|
+
start,
|
|
1414
|
+
end
|
|
1415
|
+
}
|
|
1416
|
+
});
|
|
1417
|
+
return response;
|
|
1418
|
+
}
|
|
1419
|
+
async topBranches(jwt) {
|
|
1420
|
+
const response = await this.client.get({
|
|
1421
|
+
url: "/reports/stats/top-branches",
|
|
1422
|
+
jwt
|
|
1423
|
+
});
|
|
1424
|
+
return response;
|
|
1425
|
+
}
|
|
1426
|
+
async globalStats(jwt) {
|
|
1427
|
+
const response = await this.client.get({
|
|
1428
|
+
url: "/reports/stats/global",
|
|
1429
|
+
jwt
|
|
1430
|
+
});
|
|
1431
|
+
return response;
|
|
1432
|
+
}
|
|
1433
|
+
async totalActiveBranches(jwt) {
|
|
1434
|
+
const response = await this.client.get({
|
|
1435
|
+
url: "/reports/stats/total-active-branches",
|
|
1436
|
+
jwt
|
|
1437
|
+
});
|
|
1438
|
+
return response;
|
|
1439
|
+
}
|
|
1440
|
+
async totalClients(jwt) {
|
|
1441
|
+
const response = await this.client.get({
|
|
1442
|
+
url: "/reports/stats/total-clients",
|
|
1443
|
+
jwt
|
|
1444
|
+
});
|
|
1445
|
+
return response;
|
|
1446
|
+
}
|
|
1447
|
+
};
|
|
1448
|
+
|
|
1327
1449
|
// src/types/auth.ts
|
|
1328
1450
|
var UserGender = /* @__PURE__ */ ((UserGender2) => {
|
|
1329
1451
|
UserGender2["male"] = "male";
|
|
@@ -1444,6 +1566,7 @@ var VitalFit = class _VitalFit {
|
|
|
1444
1566
|
billing;
|
|
1445
1567
|
booking;
|
|
1446
1568
|
access;
|
|
1569
|
+
report;
|
|
1447
1570
|
constructor(isDevMode, origin) {
|
|
1448
1571
|
this.client = new Client(isDevMode, origin);
|
|
1449
1572
|
this.auth = new AuthService(this.client);
|
|
@@ -1462,6 +1585,7 @@ var VitalFit = class _VitalFit {
|
|
|
1462
1585
|
this.billing = new BillingService(this.client);
|
|
1463
1586
|
this.booking = new BookingService(this.client);
|
|
1464
1587
|
this.access = new AccessService(this.client);
|
|
1588
|
+
this.report = new ReportService(this.client);
|
|
1465
1589
|
}
|
|
1466
1590
|
static getInstance(isDevMode = false) {
|
|
1467
1591
|
if (!_VitalFit.instance) {
|
|
@@ -1470,7 +1594,7 @@ var VitalFit = class _VitalFit {
|
|
|
1470
1594
|
return _VitalFit.instance;
|
|
1471
1595
|
}
|
|
1472
1596
|
version() {
|
|
1473
|
-
return "0.0.
|
|
1597
|
+
return "0.0.77";
|
|
1474
1598
|
}
|
|
1475
1599
|
};
|
|
1476
1600
|
export {
|