@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/baseSdk/diagnostica.d.ts +16 -16
- package/lib/baseSdk/diagnostica.js +22 -19
- package/lib/baseSdk/external.d.ts +177 -0
- package/lib/baseSdk/external.js +96 -0
- package/lib/baseSdk/index.js +4 -3
- package/lib/baseSdk/user.d.ts +60 -10
- package/lib/baseSdk/user.js +74 -26
- package/lib/index.d.ts +243 -133
- package/lib/schemas.d.ts +776 -411
- package/lib/schemas.js +152 -136
- package/lib/types.d.ts +35 -9
- package/lib/userSdk/chat.d.ts +2 -2
- package/lib/userSdk/external.d.ts +34 -0
- package/lib/userSdk/external.js +72 -0
- package/lib/userSdk/index.js +3 -0
- package/lib/userSdk/patients.d.ts +30 -16
- package/lib/userSdk/patients.js +35 -14
- package/lib/userSdk/schedule.d.ts +5 -2
- package/lib/userSdk/schedule.js +21 -16
- package/lib/userSdk/videoVisit.d.ts +4 -2
- package/lib/userSdk/videoVisit.js +11 -4
- package/lib/utils.d.ts +2 -4
- package/lib/utils.js +11 -22
- package/lib/webhook/index.js +1 -0
- package/package.json +1 -1
- package/lib/baseSdk/consultation.d.ts +0 -99
- package/lib/baseSdk/consultation.js +0 -23
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 =
|
|
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('
|
|
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
|
|
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
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
email: zod_1.string()
|
|
212
|
-
|
|
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
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
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
|
|
288
|
-
patient
|
|
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
|
|
308
|
-
|
|
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
|
-
|
|
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
|
|
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: (
|
|
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
|
-
|
|
42
|
-
|
|
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: (
|
|
49
|
-
|
|
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<
|
|
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 = {
|
package/lib/userSdk/chat.d.ts
CHANGED
|
@@ -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
|
+
};
|
package/lib/userSdk/index.js
CHANGED
|
@@ -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;
|