@integraciones_doc24/sdk 0.39.6 → 0.39.7

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/lib/schemas.js CHANGED
@@ -2,26 +2,20 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.doc24Schemas = void 0;
4
4
  const zod_1 = require("zod");
5
- const gender = zod_1.enum(['m', 'f']);
6
- const identificationType = zod_1.enum([
7
- 'dni',
8
- 'ndi',
9
- 'passport',
10
- 'credential',
11
- 'nn',
12
- 'cpf',
13
- 'rg',
14
- ]);
5
+ const gender = zod_1.enum(['m', 'f', 'o']).optional();
6
+ // const identificationType = zEnum(['ndi', 'passport', 'credential']);
15
7
  const sdkCredentials = zod_1.object({ iss: zod_1.string(), key: zod_1.string() });
16
8
  const basePersonData = zod_1.object({
17
9
  firstName: zod_1.string(),
18
10
  lastName: zod_1.string(),
19
- identificationType,
20
- identificationValue: zod_1.string(),
11
+ identificationType: zod_1.number().optional(),
12
+ identificationValue: zod_1.string().optional(),
21
13
  countryId: zod_1.string(),
22
14
  birthdate: zod_1.date(),
23
15
  gender,
24
16
  });
17
+ const patient = basePersonData;
18
+ const user = basePersonData.extend({ phone: zod_1.string().optional(), email: zod_1.string() });
25
19
  const specialtyMode = zod_1.enum(['appointment', 'chat', 'instant']);
26
20
  const specialty = zod_1.object({
27
21
  id: zod_1.number(),
@@ -30,6 +24,7 @@ const specialty = zod_1.object({
30
24
  const scheduleAvailabilityFilter = zod_1.object({
31
25
  specialtyId: zod_1.number().optional(),
32
26
  professionalId: zod_1.number().optional(),
27
+ language: zod_1.string().optional(),
33
28
  });
34
29
  const availableAppointment = zod_1.object({
35
30
  id: zod_1.number().or(zod_1.string()),
@@ -46,6 +41,7 @@ const availableAppointment = zod_1.object({
46
41
  atentions: zod_1.number(),
47
42
  ranking: zod_1.unknown(),
48
43
  length: zod_1.number().nullish(),
44
+ consultation_value: zod_1.string().optional().nullish()
49
45
  });
50
46
  const appointment = zod_1.object({
51
47
  id: zod_1.number(),
@@ -143,7 +139,7 @@ const diagnosticaPatient = zod_1.object({
143
139
  firstName: zod_1.string(),
144
140
  lastName: zod_1.string(),
145
141
  birthday: zod_1.date(),
146
- identificationType: zod_1.literal('dni'),
142
+ identificationType: zod_1.literal('DNI'),
147
143
  identificationValue: zod_1.string(),
148
144
  gender: gender,
149
145
  });
@@ -156,6 +152,31 @@ const diagnosticaDeepLinkResponse = zod_1.object({
156
152
  forwardingRequired: zod_1.literal(true),
157
153
  deepLink: zod_1.string().url(),
158
154
  }).or(zod_1.object({ forwardingRequired: zod_1.literal(false) }));
155
+ const videoVisit = zod_1.object({
156
+ id: zod_1.number().nullable(),
157
+ creationDate: zod_1.date(),
158
+ patientId: zod_1.number(),
159
+ user: zod_1.object({
160
+ id: zod_1.number(),
161
+ email: zod_1.string().nullable(),
162
+ phone: zod_1.string().nullable(),
163
+ }),
164
+ vcToken: zod_1.string(),
165
+ appointment: zod_1.object({
166
+ id: zod_1.number(),
167
+ date: zod_1.date(),
168
+ }).optional(),
169
+ videoVisit: zod_1.object({
170
+ id: zod_1.number(),
171
+ status: zod_1.string(),
172
+ }).optional(),
173
+ paymentStatus: zod_1.string().optional(),
174
+ atentionId: zod_1.number().optional(),
175
+ });
176
+ const historicalVideoVisit = videoVisit.extend({
177
+ specialty: zod_1.string(),
178
+ professional: zod_1.string(),
179
+ });
159
180
  const coverageInfo = zod_1.object({
160
181
  financerId: zod_1.number().nullable(),
161
182
  defaultAffiliationId: zod_1.number().nullable(),
@@ -180,112 +201,109 @@ const coverageInfo = zod_1.object({
180
201
  authorizationCode: zod_1.string().nullable(),
181
202
  authorizationCodeExpiration: zod_1.date().nullable(),
182
203
  }).nullable();
183
- const oldIdentificaiton = zod_1.object({
184
- identificationType,
204
+ const sendVerificationCodeParams = zod_1.object({
205
+ identificationType: zod_1.number(),
185
206
  identificationValue: zod_1.string(),
207
+ channel: zod_1.enum(['1', '2']),
186
208
  });
187
- const consultation = zod_1.object({
188
- id_consulta: zod_1.number(),
189
- tipo_consulta: zod_1.string(),
190
- estado: zod_1.string(),
191
- tipo_usuario_cancelacion: zod_1.string().nullable(),
192
- fecha_cancelacion: zod_1.string().nullable(),
193
- estado_pago: zod_1.string(),
194
- referencia_mercadopago: zod_1.string().nullable(),
195
- id_atencion: zod_1.number(),
196
- id_profesional: zod_1.number(),
197
- profesional: zod_1.string(),
198
- modalidad_paciente_turno: zod_1.string().nullable(),
199
- provincia_consultorio: zod_1.string().nullable(),
200
- localidad_consultorio: zod_1.string().nullable(),
201
- domicilio_consultorio: zod_1.string().nullable(),
202
- marketplace: zod_1.string(),
203
- profesional_matriculas: zod_1.array(zod_1.any()),
204
- info_paciente: zod_1.object({
205
- id_paciente: zod_1.number(),
206
- apellido: zod_1.string().optional().nullable(),
207
- nombre: zod_1.string().optional().nullable(),
208
- genero: zod_1.string().optional().nullable(),
209
- id_tipo_de_identificacion: zod_1.number(),
210
- valor_identificacion: zod_1.string().optional().nullable(),
211
- email: zod_1.string().optional().nullable(),
212
- telefono: zod_1.string().optional().nullable(),
213
- id_pais: zod_1.string().optional().nullable(),
214
- provincia: zod_1.string().optional().nullable(),
215
- localidad: zod_1.string().optional().nullable(),
216
- domicilio: zod_1.string().optional().nullable(),
217
- fecha_de_nacimiento: zod_1.string().optional().nullable(),
218
- tag_idioma: zod_1.number().optional().nullable(),
219
- estado_paciente: zod_1.number().optional().nullable(),
220
- fecha_suspension: zod_1.string().optional().nullable(),
221
- fecha_activacion: zod_1.string().optional().nullable(),
222
- fecha_modificacion: zod_1.string().optional().nullable(),
223
- fecha_baja: zod_1.string().optional().nullable(),
209
+ const verificationCodeParams = zod_1.object({
210
+ channel: zod_1.enum(['1', '2']).optional(),
211
+ code: zod_1.string().optional(),
212
+ });
213
+ const declareUserParams = zod_1.object({
214
+ user,
215
+ }).and(verificationCodeParams);
216
+ const declarePatientParams = zod_1.object({
217
+ patient,
218
+ }).and(verificationCodeParams);
219
+ const declarePatientResponse = zod_1.object({
220
+ userInfo: zod_1.object({
221
+ firstName: zod_1.string(),
222
+ lastName: zod_1.string(),
223
+ email: zod_1.string(),
224
+ phone: zod_1.string(),
225
+ }),
226
+ askCode: zod_1.literal(true),
227
+ }).or(zod_1.object({
228
+ askCode: zod_1.literal(false),
229
+ patientId: zod_1.number().nullable(),
230
+ }));
231
+ const declareUserResponse = zod_1.object({
232
+ userInfo: zod_1.object({
233
+ email: zod_1.string(),
234
+ phone: zod_1.string(),
224
235
  }),
225
- fecha_primer_llamado_profesional: zod_1.string(),
226
- fecha_inicio: zod_1.string(),
227
- fecha_primer_acceso_paciente: zod_1.string(),
228
- fecha_ultimo_acceso_paciente: zod_1.string(),
229
- fecha_corte_medico: zod_1.string(),
230
- fecha_fin: zod_1.string(),
231
- intentos_conexion: zod_1.number(),
232
- tag_idioma: zod_1.string(),
233
- id_turno: zod_1.number().nullable(),
234
- fecha_turno_invitacion: zod_1.string().nullable(),
235
- hora_turno_invitacion: zod_1.string().nullable(),
236
- firma_profesional: zod_1.string().nullable(),
237
- id_especialidad: zod_1.number(),
238
- especialidad: zod_1.string(),
239
- motivo: zod_1.string(),
240
- enfermedad_actual: zod_1.string(),
241
- conducta_terapeutica: zod_1.string(),
242
- signos_alerta: zod_1.string(),
243
- motivo_extendido_consulta: zod_1.string(),
244
- presencial_requerida: zod_1.string(),
245
- derivada: zod_1.string(),
246
- derivada_id_especialidad: zod_1.string(),
247
- derivada_presencial_obligatoria: zod_1.string(),
248
- derivada_comentarios: zod_1.string().nullable(),
249
- diagnostico: zod_1.array(zod_1.any()),
250
- practicas: zod_1.array(zod_1.any()),
251
- link_medicacion: zod_1.array(zod_1.any()),
252
- medicacion: zod_1.array(zod_1.any()),
253
- link_receta: zod_1.string().nullable(),
254
- link_compra: zod_1.string().nullable(),
255
- identificador_receta: zod_1.string().nullable(),
256
- codigo_verificacion_receta: zod_1.string().nullable(),
257
- financiador: zod_1.string(),
258
- registro_custom: zod_1.array(zod_1.any()),
259
- pdf_medicacion: zod_1.array(zod_1.any()),
260
- pdf_laboratorios: zod_1.any(),
261
- pdf_otras: zod_1.any(),
262
- pdf_imagenes: zod_1.any(),
263
- uploads: zod_1.array(zod_1.any()),
264
- files_atencion: zod_1.array(zod_1.any()),
265
- motivo_cancelacion: zod_1.string().nullable(),
266
- detalle_cancelacion: zod_1.string().nullable(),
267
- documentos: zod_1.string(),
268
- snapshot_paciente: zod_1.any().nullable(),
269
- snapshot_profesional: zod_1.any().nullable(),
270
- id_consultorio: zod_1.number(),
271
- token: zod_1.string(),
272
- tipo_protocolo_seguimiento: zod_1.string().nullable(),
273
- custom_1: zod_1.any().nullable(),
274
- custom_2: zod_1.any().nullable(),
275
- custom_3: zod_1.any().nullable(),
276
- custom_4: zod_1.any().nullable(),
277
- custom_5: zod_1.any().nullable(),
278
- form_data: zod_1.object({}),
279
- ubicacion: zod_1.string(),
280
- link_full: zod_1.string(),
281
- timestamp: zod_1.string(),
236
+ askCode: zod_1.literal(true),
237
+ }).or(zod_1.object({
238
+ askCode: zod_1.literal(false),
239
+ patientId: zod_1.number().nullable(),
240
+ userId: zod_1.number(),
241
+ }));
242
+ const externalLoginParams = zod_1.object({
243
+ user: zod_1.string(),
244
+ password: zod_1.string(),
245
+ });
246
+ const externalLoginResponse = zod_1.object({
247
+ firstName: zod_1.string(),
248
+ lastName: zod_1.string(),
249
+ countryId: zod_1.string(),
250
+ birthday: zod_1.date(),
251
+ identificationNumber: zod_1.string(),
252
+ gender,
253
+ email: zod_1.string().email(),
254
+ phone: zod_1.string(),
255
+ });
256
+ const emailOrPhone = zod_1.union([
257
+ zod_1.object({ email: zod_1.string(), phone: zod_1.string() }),
258
+ zod_1.object({ email: zod_1.string(), phone: zod_1.undefined() }),
259
+ zod_1.object({ email: zod_1.undefined(), phone: zod_1.string() }),
260
+ ]).refine((data) => data.email || data.phone, 'Either phone or email is required');
261
+ const preExternalEnrollmentParams = zod_1.object({
262
+ identificationNumber: zod_1.string(),
263
+ birthdate: zod_1.date(),
264
+ }).and(emailOrPhone);
265
+ const emailOrPhoneCode = zod_1.union([
266
+ zod_1.object({ emailCode: zod_1.string(), phoneCode: zod_1.string() }),
267
+ zod_1.object({ emailCode: zod_1.string(), phoneCode: zod_1.undefined() }),
268
+ zod_1.object({ emailCode: zod_1.undefined(), phoneCode: zod_1.string() }),
269
+ ]).refine((data) => data.emailCode || data.phoneCode, 'Either phone code or email code is required');
270
+ const externalEnrollmentParams = preExternalEnrollmentParams
271
+ .and(zod_1.object({ password: zod_1.string() }))
272
+ .and(emailOrPhoneCode);
273
+ const sendExternalVerificationCodeParams = zod_1.object({
274
+ identificationNumber: zod_1.string(),
275
+ birthdate: zod_1.date(),
276
+ channel: zod_1.enum(['1', '2']),
277
+ });
278
+ const verifyExternalVerificationCodeParams = sendExternalVerificationCodeParams.extend({ code: zod_1.string() });
279
+ const externalResetPasswordParams = zod_1.object({
280
+ identificationNumber: zod_1.string(),
281
+ birthdate: zod_1.date(),
282
+ password: zod_1.string(),
283
+ }).and(emailOrPhoneCode);
284
+ const externalPatient = zod_1.object({
285
+ birthdate: zod_1.date(),
286
+ identificationType: zod_1.literal('DNI'),
287
+ identificationValue: zod_1.string(),
288
+ gender: gender,
289
+ });
290
+ const externalAppointment = zod_1.object({
291
+ id: zod_1.number(),
292
+ patientIdentification: zod_1.string().optional(),
293
+ patientName: zod_1.string(),
294
+ birthdate: zod_1.date(),
295
+ appointment: zod_1.string(),
296
+ clinic: zod_1.string(),
297
+ professionalName: zod_1.string(),
298
+ date: zod_1.date(),
299
+ specialty: zod_1.string(),
300
+ modality: zod_1.string(),
282
301
  });
283
302
  exports.doc24Schemas = {
284
- identificationType,
285
303
  sdkCredentials,
286
304
  sdkParams: zod_1.object({ url: zod_1.string(), credentials: sdkCredentials }),
287
- user: basePersonData.extend({ phone: zod_1.string(), email: zod_1.string() }),
288
- patient: basePersonData,
305
+ user,
306
+ patient,
289
307
  specialtyMode,
290
308
  specialty,
291
309
  scheduleAvailabilityFilter,
@@ -299,32 +317,14 @@ exports.doc24Schemas = {
299
317
  date: zod_1.date().optional(),
300
318
  startHour: zod_1.string().optional(),
301
319
  finishHour: zod_1.string().optional(),
320
+ language: zod_1.string().optional(),
302
321
  }),
303
322
  scheduleParameters: zod_1.union([
304
323
  appointmentScheduleParameters,
305
324
  instantScheduleParameters,
306
325
  ]),
307
- videoVisit: zod_1.object({
308
- id: zod_1.number().nullable(),
309
- creationDate: zod_1.date(),
310
- patientId: zod_1.number(),
311
- user: zod_1.object({
312
- id: zod_1.number(),
313
- email: zod_1.string().nullable(),
314
- phone: zod_1.string().nullable(),
315
- }),
316
- vcToken: zod_1.string(),
317
- appointment: zod_1.object({
318
- id: zod_1.number(),
319
- date: zod_1.date(),
320
- }).optional(),
321
- videoVisit: zod_1.object({
322
- id: zod_1.number(),
323
- status: zod_1.string(),
324
- }).optional(),
325
- paymentStatus: zod_1.string().optional(),
326
- atentionId: zod_1.number().optional(),
327
- }),
326
+ videoVisit,
327
+ historicalVideoVisit,
328
328
  videoVisitDetails: zod_1.object({
329
329
  id: zod_1.number(),
330
330
  status: zod_1.string(),
@@ -364,7 +364,6 @@ exports.doc24Schemas = {
364
364
  patientId: zod_1.number(),
365
365
  vcToken: zod_1.string(),
366
366
  }),
367
- consultation,
368
367
  professional: zod_1.object({
369
368
  id: zod_1.number(),
370
369
  firstName: zod_1.string(),
@@ -382,6 +381,7 @@ exports.doc24Schemas = {
382
381
  link: zod_1.string(),
383
382
  brief: zod_1.string(),
384
383
  }),
384
+ consultation_value: zod_1.string().optional().nullish()
385
385
  }),
386
386
  appointment,
387
387
  chatroomAvailabilityFilter,
@@ -392,7 +392,7 @@ exports.doc24Schemas = {
392
392
  enrollmentParams,
393
393
  diagnosticaPatientFilter: zod_1.object({
394
394
  gender,
395
- identificationType,
395
+ identificationType: zod_1.literal('DNI'),
396
396
  identificationValue: zod_1.string(),
397
397
  }),
398
398
  diagnosticaHistoryAppointment,
@@ -400,5 +400,21 @@ exports.doc24Schemas = {
400
400
  diagnosticaPatient,
401
401
  diagnosticaDeepLinkResponse,
402
402
  coverageInfo,
403
- oldIdentificaiton,
403
+ sendVerificationCodeParams,
404
+ declareUserParams,
405
+ declareUserResponse,
406
+ declarePatientParams,
407
+ declarePatientResponse,
408
+ verificationCodeParams,
409
+ externalLoginParams,
410
+ externalLoginResponse,
411
+ preExternalEnrollmentParams,
412
+ externalEnrollmentParams,
413
+ sendExternalVerificationCodeParams,
414
+ verifyExternalVerificationCodeParams,
415
+ externalResetPasswordParams,
416
+ externalPatient,
417
+ externalAppointment,
418
+ emailOrPhone,
419
+ emailOrPhoneCode,
404
420
  };
package/lib/types.d.ts CHANGED
@@ -1,7 +1,6 @@
1
1
  import { TypeOf } from 'zod';
2
2
  import { doc24Schemas } from './schemas';
3
3
  export declare namespace Doc24 {
4
- type IdentificationType = TypeOf<typeof doc24Schemas.identificationType>;
5
4
  type SdkCredentials = TypeOf<typeof doc24Schemas.sdkCredentials>;
6
5
  type SdkParams = TypeOf<typeof doc24Schemas.sdkParams>;
7
6
  type User = TypeOf<typeof doc24Schemas.user>;
@@ -13,6 +12,7 @@ export declare namespace Doc24 {
13
12
  type ScheduleFilter = TypeOf<typeof doc24Schemas.scheduleFilter>;
14
13
  type ScheduleParameters = TypeOf<typeof doc24Schemas.scheduleParameters>;
15
14
  type VideoVisit = TypeOf<typeof doc24Schemas.videoVisit>;
15
+ type HistoricalVideoVisit = TypeOf<typeof doc24Schemas.historicalVideoVisit>;
16
16
  type VideoVisitDetails = TypeOf<typeof doc24Schemas.videoVisitDetails>;
17
17
  type ActiveVideoVisitData = TypeOf<typeof doc24Schemas.activeVideoVisitData>;
18
18
  type SpecialtyMode = TypeOf<typeof doc24Schemas.specialtyMode>;
@@ -25,28 +25,49 @@ export declare namespace Doc24 {
25
25
  type ChatPost = TypeOf<typeof doc24Schemas.chatPost>;
26
26
  type EnrollmentParams = TypeOf<typeof doc24Schemas.enrollmentParams>;
27
27
  type CoverageInfo = TypeOf<typeof doc24Schemas.coverageInfo>;
28
- type Consultation = TypeOf<typeof doc24Schemas.consultation>;
29
28
  type DiagnosticaPatientFilter = TypeOf<typeof doc24Schemas.diagnosticaPatientFilter>;
30
29
  type DiagnosticaUser = TypeOf<typeof doc24Schemas.diagnosticaUser>;
31
30
  type DiagnosticaPatient = TypeOf<typeof doc24Schemas.diagnosticaPatient>;
32
31
  type DiagnosticaHistoryAppointment = TypeOf<typeof doc24Schemas.diagnosticaHistoryAppointment>;
33
32
  type DiagnosticaDeepLinkResponse = TypeOf<typeof doc24Schemas.diagnosticaDeepLinkResponse>;
34
- type OldIdentificaiton = TypeOf<typeof doc24Schemas.oldIdentificaiton>;
33
+ type SendVerificationCodeParams = TypeOf<typeof doc24Schemas.sendVerificationCodeParams>;
34
+ type DeclareUserParams = TypeOf<typeof doc24Schemas.declareUserParams>;
35
+ type DeclareUserResponse = TypeOf<typeof doc24Schemas.declareUserResponse>;
36
+ type DeclarePatientParams = TypeOf<typeof doc24Schemas.declarePatientParams>;
37
+ type DeclarePatientResponse = TypeOf<typeof doc24Schemas.declarePatientResponse>;
38
+ type VerificationCodeParams = TypeOf<typeof doc24Schemas.verificationCodeParams>;
39
+ type ExternalLoginParams = TypeOf<typeof doc24Schemas.externalLoginParams>;
40
+ type ExternalLoginResponse = TypeOf<typeof doc24Schemas.externalLoginResponse>;
41
+ type PreExternalEnrollmentParams = TypeOf<typeof doc24Schemas.preExternalEnrollmentParams>;
42
+ type ExternalEnrollmentParams = TypeOf<typeof doc24Schemas.externalEnrollmentParams>;
43
+ type SendExternalVerificationCodeParams = TypeOf<typeof doc24Schemas.sendExternalVerificationCodeParams>;
44
+ type VerifyExternalVerificationCodeParams = TypeOf<typeof doc24Schemas.verifyExternalVerificationCodeParams>;
45
+ type ExternalResetPasswordParams = TypeOf<typeof doc24Schemas.externalResetPasswordParams>;
46
+ type ExternalPatient = TypeOf<typeof doc24Schemas.externalPatient>;
47
+ type ExternalAppointment = TypeOf<typeof doc24Schemas.externalAppointment>;
35
48
  type BaseSdk = {
36
- declareUser: (user: User) => Promise<number>;
49
+ declareUser: (params: DeclareUserParams) => Promise<DeclareUserResponse>;
50
+ getUserId: (user: User) => Promise<number>;
37
51
  getUserInstance: (user: User | number) => Promise<UserSdk>;
38
52
  getProfessional: (professionalId: number) => Promise<Professional>;
39
53
  getAvailableScheduleClinics: () => Promise<AvailableScheduleClinics>;
40
54
  enroll: (params: EnrollmentParams) => Promise<void>;
41
- getConverageInfo: (identificationValue: string) => Promise<CoverageInfo>;
42
- getConsultation: (consultationId: number) => Promise<Consultation | null>;
55
+ getCoverageInfo: (identificationValue: string) => Promise<CoverageInfo>;
56
+ sendVerificationCode: (params: SendVerificationCodeParams) => Promise<void>;
43
57
  getDiagnosticaHistory: (patient: DiagnosticaPatientFilter, from: Date, to: Date) => Promise<DiagnosticaHistoryAppointment[]>;
44
58
  getDiagnosticaDeepLink: (kiosk: string, user: DiagnosticaUser, patient: DiagnosticaPatient) => Promise<DiagnosticaDeepLinkResponse>;
45
59
  getDiagnosticaAccess: (kiosk: string, user: DiagnosticaUser, patient: DiagnosticaPatient) => Promise<void>;
60
+ externalLogin: (params: ExternalLoginParams) => Promise<ExternalLoginResponse>;
61
+ preExternalEnrollment: (params: PreExternalEnrollmentParams) => Promise<void>;
62
+ externalEnrollment: (params: ExternalEnrollmentParams) => Promise<ExternalLoginResponse>;
63
+ sendExternalVerificationCode: (params: SendExternalVerificationCodeParams) => Promise<void>;
64
+ verifyExternalVerificationCode: (params: VerifyExternalVerificationCodeParams) => Promise<any>;
65
+ externalResetPassword: (params: ExternalResetPasswordParams) => Promise<any>;
46
66
  };
47
67
  type UserSdk = {
48
- declarePatient: (patient: Patient) => Promise<number>;
49
- updatePatient: (oldIdentification: OldIdentificaiton, patient: Patient) => Promise<number>;
68
+ declarePatient: (params: DeclarePatientParams) => Promise<DeclarePatientResponse>;
69
+ getPatientId: (patient: Patient) => Promise<number>;
70
+ deletePatient: (patientId: number) => Promise<void>;
50
71
  getSpecialties: (mode: SpecialtyMode, language: string) => Promise<Specialty[]>;
51
72
  getScheduleDates: (patientId: number, filter?: ScheduleAvailabilityFilter) => Promise<Date[]>;
52
73
  getSchedule: (patientId: number, specialtyId: number, filter?: ScheduleFilter) => Promise<AvailableAppointment[]>;
@@ -57,7 +78,7 @@ export declare namespace Doc24 {
57
78
  getVideoVisit: (vcToken: string, patientId: number) => Promise<VideoVisit>;
58
79
  getVideoVisitDetails: (vcId: number) => Promise<VideoVisitDetails>;
59
80
  getVideoVisitLink: (vcToken: string, patientId: number) => Promise<string | null>;
60
- getPatientVideoVisitHistory: (patientId: number) => Promise<VideoVisit[]>;
81
+ getPatientVideoVisitHistory: (patientId: number) => Promise<HistoricalVideoVisit[]>;
61
82
  getActiveVideoVisits: () => Promise<ActiveVideoVisitData[]>;
62
83
  getAvailableChatrooms: (patientId: number, specialtyId: number, filter: ChatroomAvailabilityFilter) => Promise<AvailableChatroom[]>;
63
84
  createNewChat: (chatParameters: ChatParameters) => Promise<number>;
@@ -65,6 +86,10 @@ export declare namespace Doc24 {
65
86
  getChatPosts: (chatId: number) => Promise<ChatPost[]>;
66
87
  cancelChat: (chatId: number) => Promise<void>;
67
88
  sendChatMessage: (chatId: number, message: string) => Promise<number>;
89
+ getExternalStudiesHistoryLink: (patient: ExternalPatient) => Promise<string | null>;
90
+ getExternalAppointmentsLink: (identificationValue: string, birthdate: Date) => Promise<string | null>;
91
+ getExternalAppointments: () => Promise<ExternalAppointment[]>;
92
+ cancelExternalAppointment: (appointmentId: ExternalAppointment) => Promise<void>;
68
93
  userId: number;
69
94
  };
70
95
  namespace Webhook {
@@ -88,6 +113,7 @@ export declare namespace Doc24 {
88
113
  type AppointmentStatusChangeEvent = {
89
114
  id: number;
90
115
  status: StatusChangeEventStatus;
116
+ vcToken?: string;
91
117
  changeDate: Date;
92
118
  };
93
119
  type ChatUpdateEvent = {
@@ -24,9 +24,9 @@ export declare const getChatMethods: (makeRequest: RequestMaker) => {
24
24
  getPatientChats: (patientId: number) => Promise<{
25
25
  id: number;
26
26
  patient: {
27
- id: number;
28
27
  firstName: string;
29
28
  lastName: string;
29
+ id: number;
30
30
  };
31
31
  professional: {
32
32
  id: number;
@@ -34,11 +34,11 @@ export declare const getChatMethods: (makeRequest: RequestMaker) => {
34
34
  logoUrl: string;
35
35
  };
36
36
  status: string;
37
+ paymentStatus: string;
37
38
  specialty: {
38
39
  id: number;
39
40
  description: string;
40
41
  };
41
- paymentStatus: string;
42
42
  chatRoomId: number;
43
43
  startDate: Date;
44
44
  lastEventDate: Date;
@@ -0,0 +1,34 @@
1
+ import { RequestMaker } from '../request';
2
+ export declare const getExternalMethods: (makeRequest: RequestMaker) => {
3
+ getExternalStudiesHistoryLink: (patient: {
4
+ gender?: "m" | "f" | "o" | undefined;
5
+ identificationType: "DNI";
6
+ identificationValue: string;
7
+ birthdate: Date;
8
+ }) => Promise<string | null>;
9
+ getExternalAppointmentsLink: (identificationValue: string, birthdate: Date) => Promise<string | null>;
10
+ getExternalAppointments: () => Promise<{
11
+ patientIdentification?: string | undefined;
12
+ date: Date;
13
+ birthdate: Date;
14
+ appointment: string;
15
+ id: number;
16
+ specialty: string;
17
+ patientName: string;
18
+ clinic: string;
19
+ professionalName: string;
20
+ modality: string;
21
+ }[]>;
22
+ cancelExternalAppointment: (appointmentId: {
23
+ patientIdentification?: string | undefined;
24
+ date: Date;
25
+ birthdate: Date;
26
+ appointment: string;
27
+ id: number;
28
+ specialty: string;
29
+ patientName: string;
30
+ clinic: string;
31
+ professionalName: string;
32
+ modality: string;
33
+ }) => Promise<void>;
34
+ };
@@ -0,0 +1,72 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getExternalMethods = void 0;
4
+ const date_fns_1 = require("date-fns");
5
+ const zod_1 = require("zod");
6
+ const validation_1 = require("../request/validation");
7
+ const schemas_1 = require("../schemas");
8
+ const utils_1 = require("../utils");
9
+ const getExternalMethods = (makeRequest) => {
10
+ const getExternalStudiesHistoryLink = async (patient) => {
11
+ var _a, _b;
12
+ const path = '/history-external-studies';
13
+ const response = await makeRequest('POST', path, {
14
+ patient: mapPatientData(patient),
15
+ });
16
+ return (_b = (_a = response.data.info) === null || _a === void 0 ? void 0 : _a.link) !== null && _b !== void 0 ? _b : null;
17
+ };
18
+ const getExternalAppointmentsLink = async (identificationValue, birthdate) => {
19
+ const path = `/external-appointments-link/${identificationValue}/${date_fns_1.format(birthdate, 'yyyy-MM-dd')}`;
20
+ const response = await makeRequest('GET', path);
21
+ return response.data.link;
22
+ };
23
+ const getExternalAppointments = async () => {
24
+ const path = '/external-appointments';
25
+ const response = await makeRequest('GET', path);
26
+ return response.data.appointments.map((a) => ({
27
+ id: a.appointment_id,
28
+ patientIdentification: a.patient_id,
29
+ patientName: a.patient_name,
30
+ birthdate: utils_1.parseDate(a.birthdate),
31
+ appointment: a.appointment,
32
+ clinic: a.clinic,
33
+ professionalName: a.professional,
34
+ date: utils_1.parseDateTime(`${a.day} ${a.hour}:00`),
35
+ specialty: a.specialty,
36
+ modality: a.modality,
37
+ }));
38
+ };
39
+ const cancelExternalAppointment = async (appointment) => {
40
+ const path = `/cancel-external-appointment`;
41
+ await makeRequest('POST', path, {
42
+ appointment_id: appointment.id,
43
+ patient_id: appointment.patientIdentification,
44
+ patient_name: appointment.patientName,
45
+ birthdate: date_fns_1.format(appointment.birthdate, 'yyyy-MM-dd'),
46
+ appointment: appointment.appointment,
47
+ clinic: appointment.clinic,
48
+ professional: appointment.professionalName,
49
+ day: date_fns_1.format(appointment.date, 'yyyy-MM-dd'),
50
+ hour: date_fns_1.format(appointment.date, 'HH:mm'),
51
+ specialty: appointment.specialty,
52
+ modality: appointment.modality,
53
+ });
54
+ return;
55
+ };
56
+ return {
57
+ getExternalStudiesHistoryLink: validation_1.validateFunction(zod_1.tuple([schemas_1.doc24Schemas.externalPatient]), zod_1.string().nullable(), getExternalStudiesHistoryLink),
58
+ getExternalAppointmentsLink: validation_1.validateFunction(zod_1.tuple([zod_1.string(), zod_1.date()]), zod_1.string().nullable(), getExternalAppointmentsLink),
59
+ getExternalAppointments: validation_1.validateFunction(zod_1.tuple([]), zod_1.array(schemas_1.doc24Schemas.externalAppointment), getExternalAppointments),
60
+ cancelExternalAppointment: validation_1.validateFunction(zod_1.tuple([schemas_1.doc24Schemas.externalAppointment]), zod_1.void(), cancelExternalAppointment),
61
+ };
62
+ };
63
+ exports.getExternalMethods = getExternalMethods;
64
+ const mapPatientData = (patient) => {
65
+ var _a;
66
+ return {
67
+ birthdate: date_fns_1.format(patient.birthdate, 'yyyy-MM-dd'),
68
+ id_type: 'dni',
69
+ id_value: patient.identificationValue,
70
+ gender: (_a = patient.gender) === null || _a === void 0 ? void 0 : _a.toLocaleUpperCase(),
71
+ };
72
+ };
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.userSdk = void 0;
4
4
  const request_1 = require("../request");
5
5
  const chat_1 = require("./chat");
6
+ const external_1 = require("./external");
6
7
  const patients_1 = require("./patients");
7
8
  const schedule_1 = require("./schedule");
8
9
  const specialties_1 = require("./specialties");
@@ -14,12 +15,14 @@ const userSdk = async (url, credentials, userId) => {
14
15
  const scheduleMethods = schedule_1.getScheduleMethods(makeRequest);
15
16
  const videoVisitMethods = videoVisit_1.getVideoVisitMethods(makeRequest);
16
17
  const chatMethods = chat_1.getChatMethods(makeRequest);
18
+ const externalMethods = external_1.getExternalMethods(makeRequest);
17
19
  const sdk = {
18
20
  ...patientMethods,
19
21
  ...specialtyMethods,
20
22
  ...scheduleMethods,
21
23
  ...videoVisitMethods,
22
24
  ...chatMethods,
25
+ ...externalMethods,
23
26
  userId,
24
27
  };
25
28
  return sdk;