@integraciones_doc24/sdk 0.39.7 → 0.39.9

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,20 +2,26 @@
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', 'o']).optional();
6
- // const identificationType = zEnum(['ndi', 'passport', 'credential']);
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
+ ]);
7
15
  const sdkCredentials = zod_1.object({ iss: zod_1.string(), key: zod_1.string() });
8
16
  const basePersonData = zod_1.object({
9
17
  firstName: zod_1.string(),
10
18
  lastName: zod_1.string(),
11
- identificationType: zod_1.number().optional(),
12
- identificationValue: zod_1.string().optional(),
19
+ identificationType,
20
+ identificationValue: zod_1.string(),
13
21
  countryId: zod_1.string(),
14
22
  birthdate: zod_1.date(),
15
23
  gender,
16
24
  });
17
- const patient = basePersonData;
18
- const user = basePersonData.extend({ phone: zod_1.string().optional(), email: zod_1.string() });
19
25
  const specialtyMode = zod_1.enum(['appointment', 'chat', 'instant']);
20
26
  const specialty = zod_1.object({
21
27
  id: zod_1.number(),
@@ -24,7 +30,6 @@ const specialty = zod_1.object({
24
30
  const scheduleAvailabilityFilter = zod_1.object({
25
31
  specialtyId: zod_1.number().optional(),
26
32
  professionalId: zod_1.number().optional(),
27
- language: zod_1.string().optional(),
28
33
  });
29
34
  const availableAppointment = zod_1.object({
30
35
  id: zod_1.number().or(zod_1.string()),
@@ -41,7 +46,6 @@ const availableAppointment = zod_1.object({
41
46
  atentions: zod_1.number(),
42
47
  ranking: zod_1.unknown(),
43
48
  length: zod_1.number().nullish(),
44
- consultation_value: zod_1.string().optional().nullish()
45
49
  });
46
50
  const appointment = zod_1.object({
47
51
  id: zod_1.number(),
@@ -139,7 +143,7 @@ const diagnosticaPatient = zod_1.object({
139
143
  firstName: zod_1.string(),
140
144
  lastName: zod_1.string(),
141
145
  birthday: zod_1.date(),
142
- identificationType: zod_1.literal('DNI'),
146
+ identificationType: zod_1.literal('dni'),
143
147
  identificationValue: zod_1.string(),
144
148
  gender: gender,
145
149
  });
@@ -152,31 +156,6 @@ const diagnosticaDeepLinkResponse = zod_1.object({
152
156
  forwardingRequired: zod_1.literal(true),
153
157
  deepLink: zod_1.string().url(),
154
158
  }).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
- });
180
159
  const coverageInfo = zod_1.object({
181
160
  financerId: zod_1.number().nullable(),
182
161
  defaultAffiliationId: zod_1.number().nullable(),
@@ -201,109 +180,112 @@ const coverageInfo = zod_1.object({
201
180
  authorizationCode: zod_1.string().nullable(),
202
181
  authorizationCodeExpiration: zod_1.date().nullable(),
203
182
  }).nullable();
204
- const sendVerificationCodeParams = zod_1.object({
205
- identificationType: zod_1.number(),
183
+ const oldIdentificaiton = zod_1.object({
184
+ identificationType,
206
185
  identificationValue: zod_1.string(),
207
- channel: zod_1.enum(['1', '2']),
208
186
  });
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(),
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(),
235
224
  }),
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(),
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(),
301
282
  });
302
283
  exports.doc24Schemas = {
284
+ identificationType,
303
285
  sdkCredentials,
304
286
  sdkParams: zod_1.object({ url: zod_1.string(), credentials: sdkCredentials }),
305
- user,
306
- patient,
287
+ user: basePersonData.extend({ phone: zod_1.string(), email: zod_1.string() }),
288
+ patient: basePersonData,
307
289
  specialtyMode,
308
290
  specialty,
309
291
  scheduleAvailabilityFilter,
@@ -317,14 +299,32 @@ exports.doc24Schemas = {
317
299
  date: zod_1.date().optional(),
318
300
  startHour: zod_1.string().optional(),
319
301
  finishHour: zod_1.string().optional(),
320
- language: zod_1.string().optional(),
321
302
  }),
322
303
  scheduleParameters: zod_1.union([
323
304
  appointmentScheduleParameters,
324
305
  instantScheduleParameters,
325
306
  ]),
326
- videoVisit,
327
- historicalVideoVisit,
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
+ }),
328
328
  videoVisitDetails: zod_1.object({
329
329
  id: zod_1.number(),
330
330
  status: zod_1.string(),
@@ -364,6 +364,7 @@ exports.doc24Schemas = {
364
364
  patientId: zod_1.number(),
365
365
  vcToken: zod_1.string(),
366
366
  }),
367
+ consultation,
367
368
  professional: zod_1.object({
368
369
  id: zod_1.number(),
369
370
  firstName: zod_1.string(),
@@ -381,7 +382,6 @@ exports.doc24Schemas = {
381
382
  link: zod_1.string(),
382
383
  brief: zod_1.string(),
383
384
  }),
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: zod_1.literal('DNI'),
395
+ identificationType,
396
396
  identificationValue: zod_1.string(),
397
397
  }),
398
398
  diagnosticaHistoryAppointment,
@@ -400,21 +400,5 @@ exports.doc24Schemas = {
400
400
  diagnosticaPatient,
401
401
  diagnosticaDeepLinkResponse,
402
402
  coverageInfo,
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,
403
+ oldIdentificaiton,
420
404
  };
package/lib/types.d.ts CHANGED
@@ -1,6 +1,7 @@
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>;
4
5
  type SdkCredentials = TypeOf<typeof doc24Schemas.sdkCredentials>;
5
6
  type SdkParams = TypeOf<typeof doc24Schemas.sdkParams>;
6
7
  type User = TypeOf<typeof doc24Schemas.user>;
@@ -12,7 +13,6 @@ export declare namespace Doc24 {
12
13
  type ScheduleFilter = TypeOf<typeof doc24Schemas.scheduleFilter>;
13
14
  type ScheduleParameters = TypeOf<typeof doc24Schemas.scheduleParameters>;
14
15
  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,49 +25,28 @@ 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>;
28
29
  type DiagnosticaPatientFilter = TypeOf<typeof doc24Schemas.diagnosticaPatientFilter>;
29
30
  type DiagnosticaUser = TypeOf<typeof doc24Schemas.diagnosticaUser>;
30
31
  type DiagnosticaPatient = TypeOf<typeof doc24Schemas.diagnosticaPatient>;
31
32
  type DiagnosticaHistoryAppointment = TypeOf<typeof doc24Schemas.diagnosticaHistoryAppointment>;
32
33
  type DiagnosticaDeepLinkResponse = TypeOf<typeof doc24Schemas.diagnosticaDeepLinkResponse>;
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>;
34
+ type OldIdentificaiton = TypeOf<typeof doc24Schemas.oldIdentificaiton>;
48
35
  type BaseSdk = {
49
- declareUser: (params: DeclareUserParams) => Promise<DeclareUserResponse>;
50
- getUserId: (user: User) => Promise<number>;
36
+ declareUser: (user: User) => Promise<number>;
51
37
  getUserInstance: (user: User | number) => Promise<UserSdk>;
52
38
  getProfessional: (professionalId: number) => Promise<Professional>;
53
39
  getAvailableScheduleClinics: () => Promise<AvailableScheduleClinics>;
54
40
  enroll: (params: EnrollmentParams) => Promise<void>;
55
- getCoverageInfo: (identificationValue: string) => Promise<CoverageInfo>;
56
- sendVerificationCode: (params: SendVerificationCodeParams) => Promise<void>;
41
+ getConverageInfo: (identificationValue: string) => Promise<CoverageInfo>;
42
+ getConsultation: (consultationId: number) => Promise<Consultation | null>;
57
43
  getDiagnosticaHistory: (patient: DiagnosticaPatientFilter, from: Date, to: Date) => Promise<DiagnosticaHistoryAppointment[]>;
58
44
  getDiagnosticaDeepLink: (kiosk: string, user: DiagnosticaUser, patient: DiagnosticaPatient) => Promise<DiagnosticaDeepLinkResponse>;
59
45
  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>;
66
46
  };
67
47
  type UserSdk = {
68
- declarePatient: (params: DeclarePatientParams) => Promise<DeclarePatientResponse>;
69
- getPatientId: (patient: Patient) => Promise<number>;
70
- deletePatient: (patientId: number) => Promise<void>;
48
+ declarePatient: (patient: Patient) => Promise<number>;
49
+ updatePatient: (oldIdentification: OldIdentificaiton, patient: Patient) => Promise<number>;
71
50
  getSpecialties: (mode: SpecialtyMode, language: string) => Promise<Specialty[]>;
72
51
  getScheduleDates: (patientId: number, filter?: ScheduleAvailabilityFilter) => Promise<Date[]>;
73
52
  getSchedule: (patientId: number, specialtyId: number, filter?: ScheduleFilter) => Promise<AvailableAppointment[]>;
@@ -78,7 +57,7 @@ export declare namespace Doc24 {
78
57
  getVideoVisit: (vcToken: string, patientId: number) => Promise<VideoVisit>;
79
58
  getVideoVisitDetails: (vcId: number) => Promise<VideoVisitDetails>;
80
59
  getVideoVisitLink: (vcToken: string, patientId: number) => Promise<string | null>;
81
- getPatientVideoVisitHistory: (patientId: number) => Promise<HistoricalVideoVisit[]>;
60
+ getPatientVideoVisitHistory: (patientId: number) => Promise<VideoVisit[]>;
82
61
  getActiveVideoVisits: () => Promise<ActiveVideoVisitData[]>;
83
62
  getAvailableChatrooms: (patientId: number, specialtyId: number, filter: ChatroomAvailabilityFilter) => Promise<AvailableChatroom[]>;
84
63
  createNewChat: (chatParameters: ChatParameters) => Promise<number>;
@@ -86,10 +65,6 @@ export declare namespace Doc24 {
86
65
  getChatPosts: (chatId: number) => Promise<ChatPost[]>;
87
66
  cancelChat: (chatId: number) => Promise<void>;
88
67
  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>;
93
68
  userId: number;
94
69
  };
95
70
  namespace Webhook {
@@ -113,7 +88,6 @@ export declare namespace Doc24 {
113
88
  type AppointmentStatusChangeEvent = {
114
89
  id: number;
115
90
  status: StatusChangeEventStatus;
116
- vcToken?: string;
117
91
  changeDate: Date;
118
92
  };
119
93
  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;
27
28
  firstName: string;
28
29
  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;
38
37
  specialty: {
39
38
  id: number;
40
39
  description: string;
41
40
  };
41
+ paymentStatus: string;
42
42
  chatRoomId: number;
43
43
  startDate: Date;
44
44
  lastEventDate: Date;
@@ -3,7 +3,6 @@ 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");
7
6
  const patients_1 = require("./patients");
8
7
  const schedule_1 = require("./schedule");
9
8
  const specialties_1 = require("./specialties");
@@ -15,14 +14,12 @@ const userSdk = async (url, credentials, userId) => {
15
14
  const scheduleMethods = schedule_1.getScheduleMethods(makeRequest);
16
15
  const videoVisitMethods = videoVisit_1.getVideoVisitMethods(makeRequest);
17
16
  const chatMethods = chat_1.getChatMethods(makeRequest);
18
- const externalMethods = external_1.getExternalMethods(makeRequest);
19
17
  const sdk = {
20
18
  ...patientMethods,
21
19
  ...specialtyMethods,
22
20
  ...scheduleMethods,
23
21
  ...videoVisitMethods,
24
22
  ...chatMethods,
25
- ...externalMethods,
26
23
  userId,
27
24
  };
28
25
  return sdk;
@@ -1,38 +1,24 @@
1
1
  import { RequestMaker } from '../request';
2
2
  export declare const getPatientMethods: (makeRequest: RequestMaker) => {
3
- declarePatient: (params: {
4
- patient: {
5
- identificationType?: number | undefined;
6
- identificationValue?: string | undefined;
7
- gender?: "m" | "f" | "o" | undefined;
8
- firstName: string;
9
- lastName: string;
10
- countryId: string;
11
- birthdate: Date;
12
- };
13
- } & {
14
- code?: string | undefined;
15
- channel?: "1" | "2" | undefined;
16
- }) => Promise<{
17
- askCode: true;
18
- userInfo: {
19
- firstName: string;
20
- lastName: string;
21
- phone: string;
22
- email: string;
23
- };
24
- } | {
25
- patientId: number | null;
26
- askCode: false;
27
- }>;
28
- getPatientId: (patient: {
29
- identificationType?: number | undefined;
30
- identificationValue?: string | undefined;
31
- gender?: "m" | "f" | "o" | undefined;
3
+ declarePatient: (patient: {
32
4
  firstName: string;
33
5
  lastName: string;
6
+ identificationType: "dni" | "ndi" | "passport" | "credential" | "nn" | "cpf" | "rg";
7
+ identificationValue: string;
8
+ gender: "m" | "f";
9
+ countryId: string;
10
+ birthdate: Date;
11
+ }) => Promise<number>;
12
+ updatePatient: (oldIdentification: {
13
+ identificationType: "dni" | "ndi" | "passport" | "credential" | "nn" | "cpf" | "rg";
14
+ identificationValue: string;
15
+ }, patient: {
16
+ firstName: string;
17
+ lastName: string;
18
+ identificationType: "dni" | "ndi" | "passport" | "credential" | "nn" | "cpf" | "rg";
19
+ identificationValue: string;
20
+ gender: "m" | "f";
34
21
  countryId: string;
35
22
  birthdate: Date;
36
23
  }) => Promise<number>;
37
- deletePatient: (patientId: number) => Promise<void>;
38
24
  };
@@ -5,63 +5,42 @@ const date_fns_1 = require("date-fns");
5
5
  const zod_1 = require("zod");
6
6
  const validation_1 = require("../request/validation");
7
7
  const schemas_1 = require("../schemas");
8
+ const utils_1 = require("../utils");
8
9
  const getPatientMethods = (makeRequest) => {
9
- const declarePatient = async ({ patient, channel, code, }) => {
10
- var _a;
11
- const path = '/patient';
10
+ const declarePatient = async (patient) => {
12
11
  const mappedPatient = {
13
12
  lastname: patient.lastName,
14
13
  firstname: patient.firstName,
15
- identification_type: patient.identificationType,
14
+ identification_type: utils_1.getIndetificationTypeId(patient.identificationType),
16
15
  identification_value: patient.identificationValue,
17
16
  birthdate: date_fns_1.format(patient.birthdate, 'yyyy-MM-dd'),
18
- gender: (_a = patient.gender) === null || _a === void 0 ? void 0 : _a.toUpperCase(),
17
+ gender: patient.gender.toUpperCase(),
19
18
  country_id: patient.countryId,
20
19
  };
21
- const parsedChannel = channel ? parseInt(channel) : channel;
22
- const response = await makeRequest('POST', path, {
20
+ const response = await makeRequest('POST', '/patient', {
23
21
  user_data: mappedPatient,
24
- channel: parsedChannel,
25
- code,
26
22
  });
27
- const data = response.data;
28
- if (data.ask_code)
29
- return {
30
- userInfo: {
31
- firstName: data.user_info.firstname,
32
- lastName: data.user_info.lastname,
33
- phone: data.user_info.phone,
34
- email: data.user_info.email,
35
- },
36
- askCode: true,
37
- };
38
- return { askCode: false, patientId: data.patient_id };
23
+ return response.data.patient_id;
39
24
  };
40
- const getPatientId = async (patient) => {
41
- var _a;
42
- const path = '/search-patient';
25
+ const updatePatient = async (oldIdentificaiton, patient) => {
43
26
  const mappedPatient = {
44
27
  lastname: patient.lastName,
45
28
  firstname: patient.firstName,
46
- identification_type: patient.identificationType,
29
+ identification_type: utils_1.getIndetificationTypeId(patient.identificationType),
47
30
  identification_value: patient.identificationValue,
48
31
  birthdate: date_fns_1.format(patient.birthdate, 'yyyy-MM-dd'),
49
- gender: (_a = patient.gender) === null || _a === void 0 ? void 0 : _a.toUpperCase(),
50
- country_id: patient.countryId,
32
+ gender: patient.gender.toUpperCase(),
51
33
  };
52
- const response = await makeRequest('POST', path, {
34
+ const response = await makeRequest('POST', '/update-patient', {
35
+ old_identification_type: utils_1.getIndetificationTypeId(oldIdentificaiton.identificationType),
36
+ old_identification_value: oldIdentificaiton.identificationValue,
53
37
  user_data: mappedPatient,
54
38
  });
55
39
  return response.data.patient_id;
56
40
  };
57
- const deletePatient = async (patientId) => {
58
- const path = `/patient/${patientId}`;
59
- await makeRequest('DELETE', path);
60
- };
61
41
  return {
62
- declarePatient: validation_1.validateFunction(zod_1.tuple([schemas_1.doc24Schemas.declarePatientParams]), schemas_1.doc24Schemas.declarePatientResponse, declarePatient),
63
- getPatientId: validation_1.validateFunction(zod_1.tuple([schemas_1.doc24Schemas.patient]), zod_1.number(), getPatientId),
64
- deletePatient: validation_1.validateFunction(zod_1.tuple([zod_1.number()]), zod_1.void(), deletePatient),
42
+ declarePatient: validation_1.validateFunction(zod_1.tuple([schemas_1.doc24Schemas.patient]), zod_1.number(), declarePatient),
43
+ updatePatient: validation_1.validateFunction(zod_1.tuple([schemas_1.doc24Schemas.oldIdentificaiton, schemas_1.doc24Schemas.patient]), zod_1.number(), updatePatient),
65
44
  };
66
45
  };
67
46
  exports.getPatientMethods = getPatientMethods;