@vitalfit/sdk 0.0.70 → 0.0.72

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.ts CHANGED
@@ -70,13 +70,14 @@ type SignUpRequest = {
70
70
  profile_picture_url?: string | null;
71
71
  role_name?: string | null;
72
72
  };
73
+ type Oauth = {
74
+ session_token: string;
75
+ };
73
76
 
74
77
  type ClientProfile = {
75
78
  user_id: string;
76
79
  qr_code: string;
77
80
  scoring: number;
78
- status: string;
79
- block_justification: string;
80
81
  category: string;
81
82
  created_at: string;
82
83
  updated_at: string;
@@ -89,6 +90,15 @@ type Role = {
89
90
  created_at: string;
90
91
  updated_at: string;
91
92
  };
93
+ type ClientMembership = {
94
+ client_membership_id: string;
95
+ user_id: string;
96
+ membership_type_id: string;
97
+ start_date: string;
98
+ end_date: string;
99
+ status: string;
100
+ invoice_id: string;
101
+ };
92
102
  type User = {
93
103
  user_id: string;
94
104
  first_name: string;
@@ -98,11 +108,14 @@ type User = {
98
108
  identity_document: string;
99
109
  birth_date: string;
100
110
  gender: string;
111
+ status: string;
112
+ block_justification: string;
101
113
  profile_picture_url: string;
102
114
  is_validated: boolean;
103
115
  ClientProfile: ClientProfile;
104
116
  role_id: string;
105
117
  role: Role;
118
+ client_membership?: ClientMembership;
106
119
  created_at: string;
107
120
  updated_at: string;
108
121
  deleted_at: string | null;
@@ -143,6 +156,9 @@ type UserPaginationOptions = {
143
156
  search?: string;
144
157
  role?: string;
145
158
  };
159
+ type QrToken = {
160
+ token: string;
161
+ };
146
162
 
147
163
  type PaginatedBranch = {
148
164
  branch_id: string;
@@ -417,6 +433,42 @@ type PublicMembershipResponse = {
417
433
  ref_currency: string;
418
434
  is_active: boolean;
419
435
  };
436
+ type ClientMembershipUser = {
437
+ user_id: string;
438
+ first_name: string;
439
+ last_name: string;
440
+ email: string;
441
+ };
442
+ type MembershipTypeDetail = MembershipType & {
443
+ created_at: string;
444
+ updated_at: string;
445
+ };
446
+ type ClientMembershipItem = {
447
+ client_membership_id: string;
448
+ user_id: string;
449
+ membership_type_id: string;
450
+ start_date: string;
451
+ end_date: string;
452
+ status: string;
453
+ invoice_id: string;
454
+ cancellation_reason_id?: string;
455
+ cancellation_notes?: string;
456
+ user: ClientMembershipUser;
457
+ membership_type: MembershipTypeDetail;
458
+ };
459
+ type CancellationReason = {
460
+ reason_id: string;
461
+ description: string;
462
+ is_active: boolean;
463
+ };
464
+ type ClientMembershipDetail = ClientMembershipItem & {
465
+ cancellation_reason?: CancellationReason;
466
+ };
467
+ type UpdateClientMembershipRequest = {
468
+ status?: string;
469
+ cancel_notes?: string;
470
+ cancel_reason_id?: string;
471
+ };
420
472
 
421
473
  type BranchInfo = {
422
474
  address: string;
@@ -677,6 +729,13 @@ declare const mainCurrencies: {
677
729
  name: string;
678
730
  symbol: string;
679
731
  }[];
732
+ type ClientInvoice = {
733
+ invoice_id: string;
734
+ branch_id: string;
735
+ issue_date: string;
736
+ total_amount: string;
737
+ status: string;
738
+ };
680
739
 
681
740
  type ClientBookingResponse = {
682
741
  booking_id: string;
@@ -783,6 +842,17 @@ type PaymentDetail = {
783
842
  receipt_url: string;
784
843
  };
785
844
 
845
+ type CheckIn = {
846
+ branch_id: string;
847
+ qr_jwt: string;
848
+ };
849
+ type CheckInResponse = {
850
+ access_type: string;
851
+ check_in_time: string;
852
+ message: string;
853
+ service_name: string;
854
+ };
855
+
786
856
  declare class AuthService {
787
857
  private client;
788
858
  constructor(client: Client);
@@ -796,6 +866,7 @@ declare class AuthService {
796
866
  validateResetToken(token: string): Promise<void>;
797
867
  verifyEmail(otp: string): Promise<void>;
798
868
  verifyStaff(token: string, password: string, repeatPassword: string): Promise<void>;
869
+ oAuthLogin(data: Oauth): Promise<LoginResponse>;
799
870
  }
800
871
 
801
872
  declare class UserService {
@@ -810,6 +881,7 @@ declare class UserService {
810
881
  updateUserStaff(userId: string, data: UpdateUserStaffRequest, jwt: string): Promise<void>;
811
882
  deleteUser(userId: string, jwt: string): Promise<void>;
812
883
  getUserByEmail(email: string, jwt: string): Promise<DataResponse<User>>;
884
+ QrToken(jwt: string): Promise<QrToken>;
813
885
  }
814
886
 
815
887
  declare class BranchService {
@@ -887,6 +959,9 @@ declare class MembershipService {
887
959
  updateMembershipType(membershipTypeId: string, data: UpdateMembershipType, jwt: string): Promise<void>;
888
960
  deleteMembershipType(membershipTypeId: string, jwt: string): Promise<void>;
889
961
  publicGetMemberships(jwt: string, { page, limit, sort, search }: PaginationRequest, currency: string): Promise<PaginatedTotal<PublicMembershipResponse[]>>;
962
+ getClientMemberships(jwt: string, { page, limit, sort, search }: PaginationRequest): Promise<PaginatedTotal<ClientMembershipItem>>;
963
+ getClientMembershipByID(membershipId: string, jwt: string): Promise<DataResponse<ClientMembershipDetail>>;
964
+ updateClientMembership(membershipId: string, data: UpdateClientMembershipRequest, jwt: string): Promise<void>;
890
965
  }
891
966
 
892
967
  declare class PublicService {
@@ -958,6 +1033,22 @@ declare class BillingService {
958
1033
  AddPaymentToInvoice(data: AddPaymentToInvoicePayload, jwt: string): Promise<AddPaymentToInvoiceResponse>;
959
1034
  getPaymentByID(paymentId: string, jwt: string): Promise<DataResponse<PaymentDetail>>;
960
1035
  updatePaymentStatus(paymentId: string, status: string, jwt: string): Promise<void>;
1036
+ getClientInvoices(jwt: string, { page, limit, sort, search }: PaginationRequest, userID?: string): Promise<PaginatedTotal<ClientInvoice>>;
1037
+ }
1038
+
1039
+ declare class BookingService {
1040
+ private client;
1041
+ constructor(client: Client);
1042
+ bookClass(data: BookClassRequest, classID: string, jwt: string): Promise<void>;
1043
+ cancelBooking(bookingId: string, jwt: string): Promise<void>;
1044
+ getClientBooking(userID: string, jwt: string): Promise<DataResponse<ClientBookingResponse[]>>;
1045
+ getClientBranchBooking(branchID: string, userID: string, jwt: string): Promise<DataResponse<BranchScheduleResponse[]>>;
1046
+ }
1047
+
1048
+ declare class AccessService {
1049
+ private client;
1050
+ constructor(client: Client);
1051
+ checkIn(jwt: string, data: CheckIn): Promise<CheckInResponse>;
961
1052
  }
962
1053
 
963
1054
  declare class APIError extends Error {
@@ -984,9 +1075,11 @@ declare class VitalFit {
984
1075
  schedule: ScheduleService;
985
1076
  packages: PackagesService;
986
1077
  billing: BillingService;
1078
+ booking: BookingService;
1079
+ access: AccessService;
987
1080
  constructor(isDevMode: boolean, origin?: string);
988
1081
  static getInstance(isDevMode?: boolean): VitalFit;
989
1082
  version(): string;
990
1083
  }
991
1084
 
992
- 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 ClientBookingResponse, 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 MembershipsSummary, 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 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 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 };
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 };
package/dist/index.js CHANGED
@@ -124,6 +124,7 @@ var AuthService = class {
124
124
  this.validateResetToken = this.validateResetToken.bind(this);
125
125
  this.verifyEmail = this.verifyEmail.bind(this);
126
126
  this.verifyStaff = this.verifyStaff.bind(this);
127
+ this.oAuthLogin = this.oAuthLogin.bind(this);
127
128
  this.logout = this.logout.bind(this);
128
129
  this.saveJWT = this.saveJWT.bind(this);
129
130
  }
@@ -208,6 +209,13 @@ var AuthService = class {
208
209
  }
209
210
  });
210
211
  }
212
+ async oAuthLogin(data) {
213
+ const response = await this.client.post({
214
+ url: "/auth/oauth-login",
215
+ data
216
+ });
217
+ return response;
218
+ }
211
219
  };
212
220
 
213
221
  // src/services/user.ts
@@ -220,6 +228,7 @@ var UserService = class {
220
228
  this.getClientUsers = this.getClientUsers.bind(this);
221
229
  this.getStaffUsers = this.getStaffUsers.bind(this);
222
230
  this.getUserByEmail = this.getUserByEmail.bind(this);
231
+ this.QrToken = this.QrToken.bind(this);
223
232
  this.GetUserByID = this.GetUserByID.bind(this);
224
233
  this.updateUserClient = this.updateUserClient.bind(this);
225
234
  this.updateUserStaff = this.updateUserStaff.bind(this);
@@ -295,6 +304,13 @@ var UserService = class {
295
304
  });
296
305
  return response;
297
306
  }
307
+ async QrToken(jwt) {
308
+ const response = await this.client.get({
309
+ url: `/user/qr-token`,
310
+ jwt
311
+ });
312
+ return response;
313
+ }
298
314
  };
299
315
 
300
316
  // src/services/branch.ts
@@ -691,6 +707,9 @@ var MembershipService = class {
691
707
  this.updateMembershipType = this.updateMembershipType.bind(this);
692
708
  this.deleteMembershipType = this.deleteMembershipType.bind(this);
693
709
  this.publicGetMemberships = this.publicGetMemberships.bind(this);
710
+ this.getClientMemberships = this.getClientMemberships.bind(this);
711
+ this.getClientMembershipByID = this.getClientMembershipByID.bind(this);
712
+ this.updateClientMembership = this.updateClientMembership.bind(this);
694
713
  }
695
714
  async createMembershipType(data, jwt) {
696
715
  await this.client.post({
@@ -753,6 +772,33 @@ var MembershipService = class {
753
772
  });
754
773
  return response;
755
774
  }
775
+ async getClientMemberships(jwt, { page = 10, limit = 10, sort = "desc", search }) {
776
+ const response = await this.client.get({
777
+ url: "/client-memberships",
778
+ jwt,
779
+ params: {
780
+ page,
781
+ limit,
782
+ sort,
783
+ search
784
+ }
785
+ });
786
+ return response;
787
+ }
788
+ async getClientMembershipByID(membershipId, jwt) {
789
+ const response = await this.client.get({
790
+ url: `/client-memberships/${membershipId}`,
791
+ jwt
792
+ });
793
+ return response;
794
+ }
795
+ async updateClientMembership(membershipId, data, jwt) {
796
+ await this.client.put({
797
+ url: `/client-memberships/${membershipId}`,
798
+ jwt,
799
+ data
800
+ });
801
+ }
756
802
  };
757
803
 
758
804
  // src/services/public.ts
@@ -1165,6 +1211,7 @@ var BillingService = class {
1165
1211
  this.getInvoiceByID = this.getInvoiceByID.bind(this);
1166
1212
  this.getPaymentByID = this.getPaymentByID.bind(this);
1167
1213
  this.updatePaymentStatus = this.updatePaymentStatus.bind(this);
1214
+ this.getClientInvoices = this.getClientInvoices.bind(this);
1168
1215
  }
1169
1216
  async createInvoice(data, jwt) {
1170
1217
  const response = await this.client.post({
@@ -1205,6 +1252,75 @@ var BillingService = class {
1205
1252
  }
1206
1253
  });
1207
1254
  }
1255
+ async getClientInvoices(jwt, { page = 1, limit = 10, sort = "desc", search }, userID) {
1256
+ const response = await this.client.get({
1257
+ url: `/billing/invoices/client/${userID}`,
1258
+ jwt,
1259
+ params: {
1260
+ page,
1261
+ limit,
1262
+ sort,
1263
+ search
1264
+ }
1265
+ });
1266
+ return response;
1267
+ }
1268
+ };
1269
+
1270
+ // src/services/booking.ts
1271
+ var BookingService = class {
1272
+ client;
1273
+ constructor(client) {
1274
+ this.client = client;
1275
+ this.bookClass = this.bookClass.bind(this);
1276
+ this.cancelBooking = this.cancelBooking.bind(this);
1277
+ this.getClientBooking = this.getClientBooking.bind(this);
1278
+ this.getClientBranchBooking = this.getClientBranchBooking.bind(this);
1279
+ }
1280
+ async bookClass(data, classID, jwt) {
1281
+ await this.client.post({
1282
+ url: `/bookings/${classID}/book`,
1283
+ jwt,
1284
+ data
1285
+ });
1286
+ }
1287
+ async cancelBooking(bookingId, jwt) {
1288
+ await this.client.delete({
1289
+ url: `/booking/${bookingId}/cancel`,
1290
+ jwt
1291
+ });
1292
+ }
1293
+ async getClientBooking(userID, jwt) {
1294
+ const response = await this.client.get({
1295
+ url: `/bookings/client/${userID}`,
1296
+ jwt
1297
+ });
1298
+ return response;
1299
+ }
1300
+ async getClientBranchBooking(branchID, userID, jwt) {
1301
+ const response = await this.client.get({
1302
+ url: `/schedule/branch/${branchID}/client/${userID}`,
1303
+ jwt
1304
+ });
1305
+ return response;
1306
+ }
1307
+ };
1308
+
1309
+ // src/services/access.ts
1310
+ var AccessService = class {
1311
+ client;
1312
+ constructor(client) {
1313
+ this.client = client;
1314
+ this.checkIn = this.checkIn.bind(this);
1315
+ }
1316
+ async checkIn(jwt, data) {
1317
+ const response = await this.client.post({
1318
+ url: "/access/check-in",
1319
+ jwt,
1320
+ data
1321
+ });
1322
+ return response;
1323
+ }
1208
1324
  };
1209
1325
 
1210
1326
  // src/types/auth.ts
@@ -1325,6 +1441,8 @@ var VitalFit = class _VitalFit {
1325
1441
  schedule;
1326
1442
  packages;
1327
1443
  billing;
1444
+ booking;
1445
+ access;
1328
1446
  constructor(isDevMode, origin) {
1329
1447
  this.client = new Client(isDevMode, origin);
1330
1448
  this.auth = new AuthService(this.client);
@@ -1341,6 +1459,8 @@ var VitalFit = class _VitalFit {
1341
1459
  this.schedule = new ScheduleService(this.client);
1342
1460
  this.packages = new PackagesService(this.client);
1343
1461
  this.billing = new BillingService(this.client);
1462
+ this.booking = new BookingService(this.client);
1463
+ this.access = new AccessService(this.client);
1344
1464
  }
1345
1465
  static getInstance(isDevMode = false) {
1346
1466
  if (!_VitalFit.instance) {
@@ -1349,7 +1469,7 @@ var VitalFit = class _VitalFit {
1349
1469
  return _VitalFit.instance;
1350
1470
  }
1351
1471
  version() {
1352
- return "0.0.70";
1472
+ return "0.0.72";
1353
1473
  }
1354
1474
  };
1355
1475
  export {