@vitalfit/sdk 0.3.13 → 0.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -212,6 +212,37 @@ var Client = class {
212
212
  async delete(config) {
213
213
  return this.call("delete", config);
214
214
  }
215
+ async upload(config) {
216
+ const tokenToUse = config.jwt || this.accessToken;
217
+ const axiosConfig = {
218
+ method: "post",
219
+ url: config.url,
220
+ data: config.data,
221
+ params: config.params,
222
+ headers: {
223
+ "Content-Type": "multipart/form-data"
224
+ }
225
+ };
226
+ if (tokenToUse && axiosConfig.headers) {
227
+ axiosConfig.headers["Authorization"] = `Bearer ${tokenToUse}`;
228
+ }
229
+ try {
230
+ const response = await this.client.request(axiosConfig);
231
+ return response.data;
232
+ } catch (error) {
233
+ if (import_axios.default.isAxiosError(error)) {
234
+ const errorMessage = error.response?.data?.error;
235
+ if (typeof errorMessage === "string") {
236
+ throw new APIError([errorMessage], error.response?.status ?? 500);
237
+ }
238
+ throw new APIError(
239
+ ["Ocurri\xF3 un error inesperado"],
240
+ error.response?.status ?? 500
241
+ );
242
+ }
243
+ throw new Error(error);
244
+ }
245
+ }
215
246
  async download(config) {
216
247
  const tokenToUse = config.jwt || this.accessToken;
217
248
  const axiosConfig = {
@@ -443,6 +474,8 @@ var UserService = class {
443
474
  this.resendActivateOtp = this.resendActivateOtp.bind(this);
444
475
  this.UpgradePassword = this.UpgradePassword.bind(this);
445
476
  this.blockUser = this.blockUser.bind(this);
477
+ this.unblockUser = this.unblockUser.bind(this);
478
+ this.enrollFace = this.enrollFace.bind(this);
446
479
  this.createMedicalProfile = this.createMedicalProfile.bind(this);
447
480
  this.getMedicalProfile = this.getMedicalProfile.bind(this);
448
481
  this.updateMedicalProfile = this.updateMedicalProfile.bind(this);
@@ -559,6 +592,22 @@ var UserService = class {
559
592
  data
560
593
  });
561
594
  }
595
+ async unblockUser(userId, jwt) {
596
+ await this.client.put({
597
+ url: `/user/${userId}/unblock`,
598
+ jwt
599
+ });
600
+ }
601
+ async enrollFace(jwt, photo) {
602
+ const formData = new FormData();
603
+ formData.append("selfie", photo);
604
+ const response = await this.client.upload({
605
+ url: "/face-auth/enroll",
606
+ jwt,
607
+ data: formData
608
+ });
609
+ return response;
610
+ }
562
611
  //medical
563
612
  async createMedicalProfile(userId, data, jwt) {
564
613
  await this.client.post({
@@ -1826,6 +1875,7 @@ var AccessService = class {
1826
1875
  this.client = client;
1827
1876
  this.checkIn = this.checkIn.bind(this);
1828
1877
  this.checkInManual = this.checkInManual.bind(this);
1878
+ this.checkInFace = this.checkInFace.bind(this);
1829
1879
  this.getClientAttendanceHistory = this.getClientAttendanceHistory.bind(this);
1830
1880
  this.getClientServiceUsage = this.getClientServiceUsage.bind(this);
1831
1881
  this.getClassAttendanceHistory = this.getClassAttendanceHistory.bind(this);
@@ -1846,6 +1896,17 @@ var AccessService = class {
1846
1896
  });
1847
1897
  return response;
1848
1898
  }
1899
+ async checkInFace(jwt, branchId, photo) {
1900
+ const formData = new FormData();
1901
+ formData.append("branch_id", branchId);
1902
+ formData.append("checkin_photo", photo);
1903
+ const response = await this.client.upload({
1904
+ url: "/access/check-in/face",
1905
+ jwt,
1906
+ data: formData
1907
+ });
1908
+ return response;
1909
+ }
1849
1910
  async getClientAttendanceHistory(jwt, userId, start, end, { page = 1, limit = 10, sort = "desc" } = {}) {
1850
1911
  const response = await this.client.get({
1851
1912
  url: `/clients/${userId}/attendance-history`,
@@ -1936,6 +1997,7 @@ var ReportService = class {
1936
1997
  this.financialSummary = this.financialSummary.bind(this);
1937
1998
  this.salesByDemography = this.salesByDemography.bind(this);
1938
1999
  this.churnRateKPI = this.churnRateKPI.bind(this);
2000
+ this.rfmAnalysis = this.rfmAnalysis.bind(this);
1939
2001
  }
1940
2002
  async mostUsedServices(jwt, start, end) {
1941
2003
  const response = await this.client.get({
@@ -2294,6 +2356,14 @@ var ReportService = class {
2294
2356
  });
2295
2357
  return response;
2296
2358
  }
2359
+ async rfmAnalysis(jwt, branchId) {
2360
+ const response = await this.client.get({
2361
+ url: "/reports/analysis/rfm",
2362
+ jwt,
2363
+ params: branchId ? { branch_id: branchId } : void 0
2364
+ });
2365
+ return response;
2366
+ }
2297
2367
  };
2298
2368
 
2299
2369
  // src/services/staff.ts
@@ -2802,7 +2872,7 @@ var VitalFit = class _VitalFit {
2802
2872
  return _VitalFit.instance;
2803
2873
  }
2804
2874
  version() {
2805
- return "0.3.13";
2875
+ return "0.4.1";
2806
2876
  }
2807
2877
  };
2808
2878
  // Annotate the CommonJS export names for ESM import in node: