@integraciones_doc24/sdk 1.15.5 → 1.15.6

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.
@@ -33,10 +33,10 @@ const getVideoVisitMethods = (makeRequest) => {
33
33
  const response = await makeRequest('GET', path);
34
34
  return mapVideoVisit(response.data);
35
35
  });
36
- const getPatientVideoVisitHistory = validation_1.validateFunction(zod_1.tuple([zod_1.number()]), zod_1.array(schemas_1.doc24Schemas.historicalVideoVisit), async (patientId) => {
36
+ const getPatientVideoVisitHistory = validation_1.validateFunction(zod_1.tuple([zod_1.number()]), zod_1.array(schemas_1.doc24Schemas.videoVisit), async (patientId) => {
37
37
  const path = `/video-visit-history/${patientId}`;
38
38
  const response = await makeRequest('GET', path);
39
- return response.data.map((raw) => mapHistoricalVideoVisit(raw));
39
+ return response.data.map((raw) => mapVideoVisit(raw));
40
40
  });
41
41
  const getVideoVisitDetails = validation_1.validateFunction(zod_1.tuple([zod_1.number()]), schemas_1.doc24Schemas.videoVisitDetails, async (vcId) => {
42
42
  const path = `/video-visit-records/${vcId}`;
@@ -65,7 +65,7 @@ const getVideoVisitMethods = (makeRequest) => {
65
65
  appointment: response.data.appointment_id
66
66
  ? {
67
67
  id: response.data.appointment_id,
68
- date: utils_1.parseDateTime(`${response.data.appointment_date} ${response.data.appointment_time}`, response.data.time_zone),
68
+ date: utils_1.parseDateTime(`${response.data.appointment_date} ${response.data.appointment_time}`),
69
69
  }
70
70
  : null,
71
71
  report: {
@@ -135,7 +135,7 @@ const mapVideoVisit = (raw) => {
135
135
  appointment: raw.appointment_id
136
136
  ? {
137
137
  id: raw.appointment_id,
138
- date: utils_1.parseDateTime(`${raw.appointment_date} ${raw.appointment_time}`, raw.time_zone),
138
+ date: utils_1.parseDateTime(`${raw.appointment_date} ${raw.appointment_time}`),
139
139
  }
140
140
  : undefined,
141
141
  videoVisit: raw.video_visit_id
@@ -145,10 +145,3 @@ const mapVideoVisit = (raw) => {
145
145
  atentionId: (_b = raw.atentionId) !== null && _b !== void 0 ? _b : undefined,
146
146
  };
147
147
  };
148
- const mapHistoricalVideoVisit = (raw) => {
149
- return {
150
- ...mapVideoVisit(raw),
151
- professional: raw.professional,
152
- specialty: raw.specialty,
153
- };
154
- };
package/lib/utils.d.ts CHANGED
@@ -1,2 +1,4 @@
1
- export declare const parseDate: (str: string, timeZone?: string | null | undefined) => Date;
2
- export declare const parseDateTime: (str: string, timeZone?: string | null | undefined) => Date;
1
+ import { Doc24 } from '.';
2
+ export declare const parseDate: (str: string) => Date;
3
+ export declare const parseDateTime: (str: string) => Date;
4
+ export declare const getIndetificationTypeId: (type: Doc24.IdentificationType) => 1 | 6 | 5 | 999 | 1000 | 9 | 7;
package/lib/utils.js CHANGED
@@ -1,16 +1,27 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.parseDateTime = exports.parseDate = void 0;
3
+ exports.getIndetificationTypeId = exports.parseDateTime = exports.parseDate = void 0;
4
4
  const date_fns_1 = require("date-fns");
5
- // import {Doc24} from '.';
6
- const defaultTimeZone = '-03';
7
- const parseDate = (str, timeZone) => exports.parseDateTime(`${str} 00:00:00`, timeZone);
5
+ const timeZone = '-03';
6
+ const parseDate = (str) => exports.parseDateTime(`${str} 00:00:00`);
8
7
  exports.parseDate = parseDate;
9
- const parseDateTime = (str, timeZone) => date_fns_1.parse(`${str} ${timeZone !== null && timeZone !== void 0 ? timeZone : defaultTimeZone}`, 'yyyy-MM-dd HH:mm:ss X', new Date());
8
+ const parseDateTime = (str) => date_fns_1.parse(`${str} ${timeZone}`, 'yyyy-MM-dd HH:mm:ss X', new Date());
10
9
  exports.parseDateTime = parseDateTime;
11
- // export const getIdetificationTypeId = (type: Doc24.IdentificationType) => {
12
- // if (type === 'ndi') return 6;
13
- // if (type === 'passport') return 5;
14
- // if (type === 'credential') return 999;
15
- // throw new Error('Invalid identificationType');
16
- // };
10
+ const getIndetificationTypeId = (type) => {
11
+ if (type === 'dni')
12
+ return 1;
13
+ if (type === 'ndi')
14
+ return 6;
15
+ if (type === 'passport')
16
+ return 5;
17
+ if (type === 'credential')
18
+ return 999;
19
+ if (type === 'nn')
20
+ return 1000;
21
+ if (type === 'cpf')
22
+ return 9;
23
+ if (type === 'rg')
24
+ return 7;
25
+ throw new Error('Invalid identificationType');
26
+ };
27
+ exports.getIndetificationTypeId = getIndetificationTypeId;
@@ -41,7 +41,6 @@ const handleEvent = async (body, _baseSdk, eventHandlers) => {
41
41
  return (_c = eventHandlers.onAppointmentStatusChange) === null || _c === void 0 ? void 0 : _c.call(eventHandlers, {
42
42
  id: Number(body.id_turno),
43
43
  status: body.id_estado,
44
- vcToken: body.vc_token,
45
44
  changeDate: date,
46
45
  });
47
46
  if (body.tipo === 'chat')
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@integraciones_doc24/sdk",
3
- "version": "1.15.5",
3
+ "version": "1.15.6",
4
4
  "publishConfig": {
5
5
  "tag": "latest"
6
6
  },