@vitalfit/sdk 0.1.3 → 0.1.5

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
@@ -250,6 +250,10 @@ type PaymentMethod = {
250
250
  type: string;
251
251
  description: string;
252
252
  processing_type: string;
253
+ configuration: PaymentConfiguration;
254
+ visibility: BranchPaymentVisibility;
255
+ surcharge_fixed: number;
256
+ surcharge_percentage: number;
253
257
  global_status: boolean;
254
258
  created_at: string;
255
259
  updated_at: string;
@@ -390,6 +394,19 @@ type Banner = {
390
394
  link_url?: string;
391
395
  name?: string;
392
396
  };
397
+ type Promotion = {
398
+ code: string;
399
+ created_at: string;
400
+ discount_type: string;
401
+ discount_value: number;
402
+ end_date: string;
403
+ is_active: boolean;
404
+ name: string;
405
+ promotion_id: string;
406
+ start_date: string;
407
+ updated_at: string;
408
+ };
409
+ type CreatePromotion = Omit<Promotion, 'promotion_id' | 'created_at' | 'updated_at'>;
393
410
  type CreateBanner = Omit<Banner, 'banner_id'>;
394
411
  type UpdateBanner = {
395
412
  image_url?: string;
@@ -464,6 +481,10 @@ type CancellationReason = {
464
481
  description: string;
465
482
  is_active: boolean;
466
483
  };
484
+ type CreateCancellationReason = {
485
+ description: string;
486
+ is_active: boolean;
487
+ };
467
488
  type ClientMembershipDetail = ClientMembershipItem & {
468
489
  cancellation_reason?: CancellationReason;
469
490
  };
@@ -773,6 +794,9 @@ type BranchScheduleResponse = {
773
794
  type BookClassRequest = {
774
795
  user_id: string;
775
796
  };
797
+ type ClassBookingCount = {
798
+ count: number;
799
+ };
776
800
 
777
801
  type CreateInvoiceItem = {
778
802
  item_id: string;
@@ -883,6 +907,19 @@ type GlobalStat = {
883
907
  trend: string;
884
908
  };
885
909
 
910
+ type BranchStaff = {
911
+ id: string;
912
+ name: string;
913
+ };
914
+ type Staff = {
915
+ email: string;
916
+ first_name: string;
917
+ last_name: string;
918
+ phone: string;
919
+ role: string;
920
+ user_id: string;
921
+ };
922
+
886
923
  declare class AuthService {
887
924
  private client;
888
925
  constructor(client: Client);
@@ -979,6 +1016,11 @@ declare class MarketingService {
979
1016
  getBannerByID(BannerId: string, jwt: string): Promise<DataResponse<Banner>>;
980
1017
  updateBanner(BannerId: string, BannerData: UpdateBanner, jwt: string): Promise<void>;
981
1018
  deleteBanner(BannerId: string, jwt: string): Promise<void>;
1019
+ createPromotion(promotionData: CreatePromotion, jwt: string): Promise<void>;
1020
+ getPromotion(jwt: string, { page, limit, sort, search }: PaginationRequest): Promise<PaginatedTotal<Promotion[]>>;
1021
+ getPromotionByID(promotionId: string, jwt: string): Promise<DataResponse<Promotion>>;
1022
+ updatePromotion(promotionId: string, promotionData: CreatePromotion, jwt: string): Promise<void>;
1023
+ deletePromotion(promotionId: string, jwt: string): Promise<void>;
982
1024
  }
983
1025
 
984
1026
  declare class MembershipService {
@@ -994,6 +1036,10 @@ declare class MembershipService {
994
1036
  getClientMemberships(jwt: string, { page, limit, sort, search }: PaginationRequest): Promise<PaginatedTotal<ClientMembershipItem[]>>;
995
1037
  getClientMembershipByID(membershipId: string, jwt: string): Promise<DataResponse<ClientMembershipDetail>>;
996
1038
  updateClientMembership(membershipId: string, data: UpdateClientMembershipRequest, jwt: string): Promise<void>;
1039
+ createCancelReason(data: CreateCancellationReason, jwt: string): Promise<void>;
1040
+ getCancelReasons(jwt: string, { page, limit, sort, search }: PaginationRequest): Promise<PaginatedTotal<CancellationReason[]>>;
1041
+ updateCancelReason(reasonId: string, data: CreateCancellationReason, jwt: string): Promise<void>;
1042
+ deleteCancelReason(reasonId: string, jwt: string): Promise<void>;
997
1043
  }
998
1044
 
999
1045
  declare class PublicService {
@@ -1066,7 +1112,7 @@ declare class BillingService {
1066
1112
  getPaymentByID(paymentId: string, jwt: string): Promise<DataResponse<PaymentDetail>>;
1067
1113
  updatePaymentStatus(paymentId: string, status: string, jwt: string): Promise<void>;
1068
1114
  getClientInvoices(jwt: string, { page, limit, sort, search }: PaginationRequest, userID?: string): Promise<PaginatedTotal<ClientInvoice[]>>;
1069
- getInvoices(jwt: string, { page, limit, sort, search, status, }: PaginationWithStatus): Promise<PaginatedTotal<InvoiceList[]>>;
1115
+ getInvoices(jwt: string, { page, limit, sort, search, status, }: PaginationWithStatus, branchID?: string): Promise<PaginatedTotal<InvoiceList[]>>;
1070
1116
  }
1071
1117
 
1072
1118
  declare class BookingService {
@@ -1076,6 +1122,7 @@ declare class BookingService {
1076
1122
  cancelBooking(bookingId: string, jwt: string): Promise<void>;
1077
1123
  getClientBooking(userID: string, jwt: string): Promise<DataResponse<ClientBookingResponse[]>>;
1078
1124
  getClientBranchBooking(branchID: string, userID: string, jwt: string): Promise<DataResponse<BranchScheduleResponse[]>>;
1125
+ getClassBookingCount(classID: string, jwt: string): Promise<ClassBookingCount>;
1079
1126
  }
1080
1127
 
1081
1128
  declare class AccessService {
@@ -1098,6 +1145,16 @@ declare class ReportService {
1098
1145
  totalClients(jwt: string): Promise<DataResponse<number>>;
1099
1146
  }
1100
1147
 
1148
+ declare class StaffService {
1149
+ private client;
1150
+ constructor(client: Client);
1151
+ getStaffBranches(jwt: string): Promise<DataResponse<BranchStaff[]>>;
1152
+ getManagedBranches(jwt: string): Promise<DataResponse<BranchStaff[]>>;
1153
+ getBranchstaff(branchId: string, jwt: string): Promise<DataResponse<Staff[]>>;
1154
+ AssignBranchStaff(branchId: string, staffIds: string[], jwt: string): Promise<void>;
1155
+ RemoveBranchStaff(branchId: string, staffId: string, jwt: string): Promise<void>;
1156
+ }
1157
+
1101
1158
  declare class APIError extends Error {
1102
1159
  status: number;
1103
1160
  messages: string[];
@@ -1125,9 +1182,10 @@ declare class VitalFit {
1125
1182
  booking: BookingService;
1126
1183
  access: AccessService;
1127
1184
  report: ReportService;
1185
+ staff: StaffService;
1128
1186
  constructor(isDevMode: boolean, origin?: string);
1129
1187
  static getInstance(isDevMode?: boolean): VitalFit;
1130
1188
  version(): string;
1131
1189
  }
1132
1190
 
1133
- 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 };
1191
+ 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 BranchStaff, type BranchStatusCount, type CancellationReason, type ChartData, type CheckIn, type CheckInResponse, type ClassBookingCount, type ClientBookingResponse, type ClientInvoice, type ClientMembership, type ClientMembershipDetail, type ClientMembershipItem, type ClientMembershipUser, type ClientProfile, type CreateBanner, type CreateBranchEquipment, type CreateBranchRequest, type CreateBranchServicePriceItem, type CreateCancellationReason, type CreateClassPayload, type CreateEquipment, type CreateInvoiceItem, type CreateInvoicePayload, type CreateInvoiceResponse, type CreateMembershipType, type CreatePackagePayload, type CreatePaymentMethod, type CreatePromotion, 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 Promotion, 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 Staff, 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
@@ -681,6 +681,11 @@ var MarketingService = class {
681
681
  this.getBannerByID = this.getBannerByID.bind(this);
682
682
  this.updateBanner = this.updateBanner.bind(this);
683
683
  this.deleteBanner = this.deleteBanner.bind(this);
684
+ this.createPromotion = this.createPromotion.bind(this);
685
+ this.getPromotion = this.getPromotion.bind(this);
686
+ this.getPromotionByID = this.getPromotionByID.bind(this);
687
+ this.updatePromotion = this.updatePromotion.bind(this);
688
+ this.deletePromotion = this.deletePromotion.bind(this);
684
689
  }
685
690
  async createBanners(BannerData, jwt) {
686
691
  await this.client.post({
@@ -716,6 +721,46 @@ var MarketingService = class {
716
721
  jwt
717
722
  });
718
723
  }
724
+ async createPromotion(promotionData, jwt) {
725
+ await this.client.post({
726
+ url: "/marketing/promotions",
727
+ jwt,
728
+ data: promotionData
729
+ });
730
+ }
731
+ async getPromotion(jwt, { page = 10, limit = 10, sort = "desc", search }) {
732
+ const response = await this.client.get({
733
+ url: "/marketing/promotions",
734
+ jwt,
735
+ params: {
736
+ page,
737
+ limit,
738
+ sort,
739
+ search
740
+ }
741
+ });
742
+ return response;
743
+ }
744
+ async getPromotionByID(promotionId, jwt) {
745
+ const response = await this.client.get({
746
+ url: `/marketing/promotions/${promotionId}`,
747
+ jwt
748
+ });
749
+ return response;
750
+ }
751
+ async updatePromotion(promotionId, promotionData, jwt) {
752
+ await this.client.put({
753
+ url: `/marketing/promotions/${promotionId}`,
754
+ jwt,
755
+ data: promotionData
756
+ });
757
+ }
758
+ async deletePromotion(promotionId, jwt) {
759
+ await this.client.delete({
760
+ url: `/marketing/promotions/${promotionId}`,
761
+ jwt
762
+ });
763
+ }
719
764
  };
720
765
 
721
766
  // src/services/memberships.ts
@@ -733,6 +778,10 @@ var MembershipService = class {
733
778
  this.getClientMemberships = this.getClientMemberships.bind(this);
734
779
  this.getClientMembershipByID = this.getClientMembershipByID.bind(this);
735
780
  this.updateClientMembership = this.updateClientMembership.bind(this);
781
+ this.createCancelReason = this.createCancelReason.bind(this);
782
+ this.getCancelReasons = this.getCancelReasons.bind(this);
783
+ this.updateCancelReason = this.updateCancelReason.bind(this);
784
+ this.deleteCancelReason = this.deleteCancelReason.bind(this);
736
785
  }
737
786
  async createMembershipType(data, jwt) {
738
787
  await this.client.post({
@@ -822,6 +871,39 @@ var MembershipService = class {
822
871
  data
823
872
  });
824
873
  }
874
+ async createCancelReason(data, jwt) {
875
+ await this.client.post({
876
+ url: "/memberships/cancellation-reasons",
877
+ jwt,
878
+ data
879
+ });
880
+ }
881
+ async getCancelReasons(jwt, { page = 10, limit = 10, sort = "desc", search }) {
882
+ const response = await this.client.get({
883
+ url: "/memberships/cancellation-reasons",
884
+ jwt,
885
+ params: {
886
+ page,
887
+ limit,
888
+ sort,
889
+ search
890
+ }
891
+ });
892
+ return response;
893
+ }
894
+ async updateCancelReason(reasonId, data, jwt) {
895
+ await this.client.put({
896
+ url: `/memberships/cancellation-reasons/${reasonId}`,
897
+ jwt,
898
+ data
899
+ });
900
+ }
901
+ async deleteCancelReason(reasonId, jwt) {
902
+ await this.client.delete({
903
+ url: `/memberships/cancellation-reasons/${reasonId}`,
904
+ jwt
905
+ });
906
+ }
825
907
  };
826
908
 
827
909
  // src/services/public.ts
@@ -1295,7 +1377,7 @@ var BillingService = class {
1295
1377
  sort = "desc",
1296
1378
  search,
1297
1379
  status
1298
- }) {
1380
+ }, branchID) {
1299
1381
  const response = await this.client.get({
1300
1382
  url: "/billing/invoices",
1301
1383
  jwt,
@@ -1304,7 +1386,8 @@ var BillingService = class {
1304
1386
  limit,
1305
1387
  sort,
1306
1388
  search,
1307
- status
1389
+ status,
1390
+ branch_id: branchID
1308
1391
  }
1309
1392
  });
1310
1393
  return response;
@@ -1320,6 +1403,7 @@ var BookingService = class {
1320
1403
  this.cancelBooking = this.cancelBooking.bind(this);
1321
1404
  this.getClientBooking = this.getClientBooking.bind(this);
1322
1405
  this.getClientBranchBooking = this.getClientBranchBooking.bind(this);
1406
+ this.getClassBookingCount = this.getClassBookingCount.bind(this);
1323
1407
  }
1324
1408
  async bookClass(data, classID, jwt) {
1325
1409
  await this.client.post({
@@ -1348,6 +1432,13 @@ var BookingService = class {
1348
1432
  });
1349
1433
  return response;
1350
1434
  }
1435
+ async getClassBookingCount(classID, jwt) {
1436
+ const response = await this.client.get({
1437
+ url: `/bookings/${classID}/count`,
1438
+ jwt
1439
+ });
1440
+ return response;
1441
+ }
1351
1442
  };
1352
1443
 
1353
1444
  // src/services/access.ts
@@ -1467,6 +1558,55 @@ var ReportService = class {
1467
1558
  }
1468
1559
  };
1469
1560
 
1561
+ // src/services/staff.ts
1562
+ var StaffService = class {
1563
+ client;
1564
+ constructor(client) {
1565
+ this.client = client;
1566
+ this.getStaffBranches = this.getStaffBranches.bind(this);
1567
+ this.getManagedBranches = this.getManagedBranches.bind(this);
1568
+ this.getBranchstaff = this.getBranchstaff.bind(this);
1569
+ this.AssignBranchStaff = this.AssignBranchStaff.bind(this);
1570
+ this.RemoveBranchStaff = this.RemoveBranchStaff.bind(this);
1571
+ }
1572
+ async getStaffBranches(jwt) {
1573
+ const response = await this.client.get({
1574
+ url: "/staff/branches",
1575
+ jwt
1576
+ });
1577
+ return response;
1578
+ }
1579
+ async getManagedBranches(jwt) {
1580
+ const response = await this.client.get({
1581
+ url: "/staff/managed-branches",
1582
+ jwt
1583
+ });
1584
+ return response;
1585
+ }
1586
+ async getBranchstaff(branchId, jwt) {
1587
+ const response = await this.client.get({
1588
+ url: `/branches/${branchId}/staff`,
1589
+ jwt
1590
+ });
1591
+ return response;
1592
+ }
1593
+ async AssignBranchStaff(branchId, staffIds, jwt) {
1594
+ await this.client.post({
1595
+ url: `/branches/${branchId}/staff`,
1596
+ jwt,
1597
+ data: {
1598
+ staff: staffIds
1599
+ }
1600
+ });
1601
+ }
1602
+ async RemoveBranchStaff(branchId, staffId, jwt) {
1603
+ await this.client.delete({
1604
+ url: `/branches/${branchId}/staff/${staffId}`,
1605
+ jwt
1606
+ });
1607
+ }
1608
+ };
1609
+
1470
1610
  // src/types/auth.ts
1471
1611
  var UserGender = /* @__PURE__ */ ((UserGender2) => {
1472
1612
  UserGender2["male"] = "male";
@@ -1588,6 +1728,7 @@ var VitalFit = class _VitalFit {
1588
1728
  booking;
1589
1729
  access;
1590
1730
  report;
1731
+ staff;
1591
1732
  constructor(isDevMode, origin) {
1592
1733
  this.client = new Client(isDevMode, origin);
1593
1734
  this.auth = new AuthService(this.client);
@@ -1607,6 +1748,7 @@ var VitalFit = class _VitalFit {
1607
1748
  this.booking = new BookingService(this.client);
1608
1749
  this.access = new AccessService(this.client);
1609
1750
  this.report = new ReportService(this.client);
1751
+ this.staff = new StaffService(this.client);
1610
1752
  }
1611
1753
  static getInstance(isDevMode = false) {
1612
1754
  if (!_VitalFit.instance) {
@@ -1615,7 +1757,7 @@ var VitalFit = class _VitalFit {
1615
1757
  return _VitalFit.instance;
1616
1758
  }
1617
1759
  version() {
1618
- return "0.1.3";
1760
+ return "0.1.5";
1619
1761
  }
1620
1762
  };
1621
1763
  export {