@integraciones_doc24/sdk 1.16.36 → 1.16.38
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/README.md +19 -0
- package/lib/baseSdk/index.js +1 -2
- package/lib/schemas.d.ts +6 -73
- package/lib/schemas.js +0 -19
- package/lib/types.d.ts +1 -4
- package/lib/userSdk/schedule.d.ts +3 -4
- package/lib/userSdk/schedule.js +2 -3
- package/lib/userSdk/videoVisit.d.ts +1 -22
- package/lib/userSdk/videoVisit.js +5 -29
- package/lib/utils.d.ts +0 -1
- package/lib/utils.js +1 -26
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -121,8 +121,27 @@ export type BaseSdk = {
|
|
|
121
121
|
cancelExternalAppointment: (
|
|
122
122
|
appointmentId: ExternalAppointment,
|
|
123
123
|
) => Promise<void>;
|
|
124
|
+
reportIntegrationError: (
|
|
125
|
+
params: ReportIntegrationErrorParams,
|
|
126
|
+
) => Promise<ReportIntegrationErrorResponse>;
|
|
124
127
|
};
|
|
125
128
|
|
|
129
|
+
type ReportIntegrationErrorParams = {
|
|
130
|
+
integration: string;
|
|
131
|
+
operation?: string;
|
|
132
|
+
severity?: 'INFO' | 'WARNING' | 'ERROR' | 'CRITICAL';
|
|
133
|
+
errorCode?: string;
|
|
134
|
+
httpStatus?: number;
|
|
135
|
+
// Payload of the request sent to the third party that ended in error
|
|
136
|
+
params: Record<string, unknown>;
|
|
137
|
+
occurredAt: Date;
|
|
138
|
+
// Idempotency key: reporting the same externalId again returns the same errorId
|
|
139
|
+
externalId?: string;
|
|
140
|
+
// Up to 64 KB once serialized. Never include credentials or tokens.
|
|
141
|
+
details?: Record<string, unknown>;
|
|
142
|
+
};
|
|
143
|
+
type ReportIntegrationErrorResponse = {errorId: number};
|
|
144
|
+
|
|
126
145
|
type RequestHandlerParams = {
|
|
127
146
|
// Credentials that doc24 should use when singing the jwt
|
|
128
147
|
credentials: SdkCredentials;
|
package/lib/baseSdk/index.js
CHANGED
|
@@ -19,7 +19,6 @@ const getBaseSdk = async (url, credentials) => {
|
|
|
19
19
|
...externalMethods,
|
|
20
20
|
...userMethods,
|
|
21
21
|
getProfessional: validation_1.validateFunction(zod_1.tuple([zod_1.number()]), schemas_1.doc24Schemas.professional, async (professionalId) => {
|
|
22
|
-
var _a;
|
|
23
22
|
const path = `/professional/${professionalId}`;
|
|
24
23
|
const response = await makeRequest('GET', path);
|
|
25
24
|
const raw = response.data;
|
|
@@ -28,7 +27,7 @@ const getBaseSdk = async (url, credentials) => {
|
|
|
28
27
|
firstName: raw.name,
|
|
29
28
|
lastName: raw.lastname,
|
|
30
29
|
birthdate: utils_1.parseDate(raw.birthdate),
|
|
31
|
-
gender:
|
|
30
|
+
gender: raw.gender.toLowerCase(),
|
|
32
31
|
email: raw.email,
|
|
33
32
|
phone: raw.phone,
|
|
34
33
|
logoUrl: raw.image,
|
package/lib/schemas.d.ts
CHANGED
|
@@ -216,17 +216,15 @@ export declare const doc24Schemas: {
|
|
|
216
216
|
province: import("zod").ZodNullable<import("zod").ZodOptional<import("zod").ZodString>>;
|
|
217
217
|
city: import("zod").ZodNullable<import("zod").ZodOptional<import("zod").ZodString>>;
|
|
218
218
|
address: import("zod").ZodNullable<import("zod").ZodOptional<import("zod").ZodString>>;
|
|
219
|
-
addressPhone: import("zod").ZodNullable<import("zod").ZodOptional<import("zod").ZodString>>;
|
|
220
219
|
}, "strip", import("zod").ZodTypeAny, {
|
|
221
220
|
length?: number | null | undefined;
|
|
222
|
-
address?: string | null | undefined;
|
|
223
|
-
city?: string | null | undefined;
|
|
224
|
-
province?: string | null | undefined;
|
|
225
221
|
ranking?: unknown;
|
|
226
222
|
consultation_value?: string | null | undefined;
|
|
227
223
|
inPerson?: boolean | null | undefined;
|
|
228
224
|
virtual?: boolean | null | undefined;
|
|
229
|
-
|
|
225
|
+
province?: string | null | undefined;
|
|
226
|
+
city?: string | null | undefined;
|
|
227
|
+
address?: string | null | undefined;
|
|
230
228
|
date: Date;
|
|
231
229
|
type: "appointment" | "chat" | "instant";
|
|
232
230
|
id: string | number;
|
|
@@ -247,14 +245,13 @@ export declare const doc24Schemas: {
|
|
|
247
245
|
atentions: number;
|
|
248
246
|
}, {
|
|
249
247
|
length?: number | null | undefined;
|
|
250
|
-
address?: string | null | undefined;
|
|
251
|
-
city?: string | null | undefined;
|
|
252
|
-
province?: string | null | undefined;
|
|
253
248
|
ranking?: unknown;
|
|
254
249
|
consultation_value?: string | null | undefined;
|
|
255
250
|
inPerson?: boolean | null | undefined;
|
|
256
251
|
virtual?: boolean | null | undefined;
|
|
257
|
-
|
|
252
|
+
province?: string | null | undefined;
|
|
253
|
+
city?: string | null | undefined;
|
|
254
|
+
address?: string | null | undefined;
|
|
258
255
|
date: Date;
|
|
259
256
|
type: "appointment" | "chat" | "instant";
|
|
260
257
|
id: string | number;
|
|
@@ -559,16 +556,11 @@ export declare const doc24Schemas: {
|
|
|
559
556
|
paymentStatus: import("zod").ZodOptional<import("zod").ZodString>;
|
|
560
557
|
atentionId: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
561
558
|
waitingTime: import("zod").ZodOptional<import("zod").ZodString>;
|
|
562
|
-
address: import("zod").ZodOptional<import("zod").ZodString>;
|
|
563
|
-
city: import("zod").ZodOptional<import("zod").ZodString>;
|
|
564
|
-
province: import("zod").ZodOptional<import("zod").ZodString>;
|
|
565
|
-
modality: import("zod").ZodOptional<import("zod").ZodEnum<["P", "V"]>>;
|
|
566
559
|
}, "strip", import("zod").ZodTypeAny, {
|
|
567
560
|
appointment?: {
|
|
568
561
|
date: Date;
|
|
569
562
|
id: number;
|
|
570
563
|
} | undefined;
|
|
571
|
-
modality?: "P" | "V" | undefined;
|
|
572
564
|
videoVisit?: {
|
|
573
565
|
id: number;
|
|
574
566
|
status: string;
|
|
@@ -576,9 +568,6 @@ export declare const doc24Schemas: {
|
|
|
576
568
|
paymentStatus?: string | undefined;
|
|
577
569
|
atentionId?: number | undefined;
|
|
578
570
|
waitingTime?: string | undefined;
|
|
579
|
-
address?: string | undefined;
|
|
580
|
-
city?: string | undefined;
|
|
581
|
-
province?: string | undefined;
|
|
582
571
|
id: number | null;
|
|
583
572
|
patientId: number;
|
|
584
573
|
creationDate: Date;
|
|
@@ -593,7 +582,6 @@ export declare const doc24Schemas: {
|
|
|
593
582
|
date: Date;
|
|
594
583
|
id: number;
|
|
595
584
|
} | undefined;
|
|
596
|
-
modality?: "P" | "V" | undefined;
|
|
597
585
|
videoVisit?: {
|
|
598
586
|
id: number;
|
|
599
587
|
status: string;
|
|
@@ -601,9 +589,6 @@ export declare const doc24Schemas: {
|
|
|
601
589
|
paymentStatus?: string | undefined;
|
|
602
590
|
atentionId?: number | undefined;
|
|
603
591
|
waitingTime?: string | undefined;
|
|
604
|
-
address?: string | undefined;
|
|
605
|
-
city?: string | undefined;
|
|
606
|
-
province?: string | undefined;
|
|
607
592
|
id: number | null;
|
|
608
593
|
patientId: number;
|
|
609
594
|
creationDate: Date;
|
|
@@ -655,21 +640,14 @@ export declare const doc24Schemas: {
|
|
|
655
640
|
paymentStatus: import("zod").ZodOptional<import("zod").ZodString>;
|
|
656
641
|
atentionId: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
657
642
|
waitingTime: import("zod").ZodOptional<import("zod").ZodString>;
|
|
658
|
-
address: import("zod").ZodOptional<import("zod").ZodString>;
|
|
659
|
-
city: import("zod").ZodOptional<import("zod").ZodString>;
|
|
660
|
-
province: import("zod").ZodOptional<import("zod").ZodString>;
|
|
661
|
-
modality: import("zod").ZodOptional<import("zod").ZodEnum<["P", "V"]>>;
|
|
662
643
|
}, {
|
|
663
644
|
specialty: import("zod").ZodString;
|
|
664
645
|
professional: import("zod").ZodString;
|
|
665
|
-
medications: import("zod").ZodOptional<import("zod").ZodBoolean>;
|
|
666
|
-
practices: import("zod").ZodOptional<import("zod").ZodBoolean>;
|
|
667
646
|
}>, "strip", import("zod").ZodTypeAny, {
|
|
668
647
|
appointment?: {
|
|
669
648
|
date: Date;
|
|
670
649
|
id: number;
|
|
671
650
|
} | undefined;
|
|
672
|
-
modality?: "P" | "V" | undefined;
|
|
673
651
|
videoVisit?: {
|
|
674
652
|
id: number;
|
|
675
653
|
status: string;
|
|
@@ -677,11 +655,6 @@ export declare const doc24Schemas: {
|
|
|
677
655
|
paymentStatus?: string | undefined;
|
|
678
656
|
atentionId?: number | undefined;
|
|
679
657
|
waitingTime?: string | undefined;
|
|
680
|
-
address?: string | undefined;
|
|
681
|
-
city?: string | undefined;
|
|
682
|
-
province?: string | undefined;
|
|
683
|
-
medications?: boolean | undefined;
|
|
684
|
-
practices?: boolean | undefined;
|
|
685
658
|
id: number | null;
|
|
686
659
|
patientId: number;
|
|
687
660
|
professional: string;
|
|
@@ -698,7 +671,6 @@ export declare const doc24Schemas: {
|
|
|
698
671
|
date: Date;
|
|
699
672
|
id: number;
|
|
700
673
|
} | undefined;
|
|
701
|
-
modality?: "P" | "V" | undefined;
|
|
702
674
|
videoVisit?: {
|
|
703
675
|
id: number;
|
|
704
676
|
status: string;
|
|
@@ -706,11 +678,6 @@ export declare const doc24Schemas: {
|
|
|
706
678
|
paymentStatus?: string | undefined;
|
|
707
679
|
atentionId?: number | undefined;
|
|
708
680
|
waitingTime?: string | undefined;
|
|
709
|
-
address?: string | undefined;
|
|
710
|
-
city?: string | undefined;
|
|
711
|
-
province?: string | undefined;
|
|
712
|
-
medications?: boolean | undefined;
|
|
713
|
-
practices?: boolean | undefined;
|
|
714
681
|
id: number | null;
|
|
715
682
|
patientId: number;
|
|
716
683
|
professional: string;
|
|
@@ -918,24 +885,17 @@ export declare const doc24Schemas: {
|
|
|
918
885
|
id: import("zod").ZodNumber;
|
|
919
886
|
status: import("zod").ZodString;
|
|
920
887
|
paymentStatus: import("zod").ZodString;
|
|
921
|
-
modality: import("zod").ZodOptional<import("zod").ZodEnum<["P", "V"]>>;
|
|
922
|
-
address: import("zod").ZodOptional<import("zod").ZodString>;
|
|
923
|
-
city: import("zod").ZodOptional<import("zod").ZodString>;
|
|
924
|
-
province: import("zod").ZodOptional<import("zod").ZodString>;
|
|
925
888
|
professional: import("zod").ZodOptional<import("zod").ZodObject<{
|
|
926
889
|
id: import("zod").ZodNumber;
|
|
927
890
|
fullName: import("zod").ZodString;
|
|
928
891
|
specialtyId: import("zod").ZodNumber;
|
|
929
892
|
specialty: import("zod").ZodString;
|
|
930
|
-
idPrestadorInterno: import("zod").ZodNullable<import("zod").ZodOptional<import("zod").ZodString>>;
|
|
931
893
|
}, "strip", import("zod").ZodTypeAny, {
|
|
932
|
-
idPrestadorInterno?: string | null | undefined;
|
|
933
894
|
id: number;
|
|
934
895
|
fullName: string;
|
|
935
896
|
specialtyId: number;
|
|
936
897
|
specialty: string;
|
|
937
898
|
}, {
|
|
938
|
-
idPrestadorInterno?: string | null | undefined;
|
|
939
899
|
id: number;
|
|
940
900
|
fullName: string;
|
|
941
901
|
specialtyId: number;
|
|
@@ -1091,17 +1051,12 @@ export declare const doc24Schemas: {
|
|
|
1091
1051
|
url: string;
|
|
1092
1052
|
}>, "many">;
|
|
1093
1053
|
}, "strip", import("zod").ZodTypeAny, {
|
|
1094
|
-
modality?: "P" | "V" | undefined;
|
|
1095
1054
|
professional?: {
|
|
1096
|
-
idPrestadorInterno?: string | null | undefined;
|
|
1097
1055
|
id: number;
|
|
1098
1056
|
fullName: string;
|
|
1099
1057
|
specialtyId: number;
|
|
1100
1058
|
specialty: string;
|
|
1101
1059
|
} | undefined;
|
|
1102
|
-
address?: string | undefined;
|
|
1103
|
-
city?: string | undefined;
|
|
1104
|
-
province?: string | undefined;
|
|
1105
1060
|
retries?: number | null | undefined;
|
|
1106
1061
|
id: number;
|
|
1107
1062
|
language: string;
|
|
@@ -1149,17 +1104,12 @@ export declare const doc24Schemas: {
|
|
|
1149
1104
|
url: string;
|
|
1150
1105
|
}[];
|
|
1151
1106
|
}, {
|
|
1152
|
-
modality?: "P" | "V" | undefined;
|
|
1153
1107
|
professional?: {
|
|
1154
|
-
idPrestadorInterno?: string | null | undefined;
|
|
1155
1108
|
id: number;
|
|
1156
1109
|
fullName: string;
|
|
1157
1110
|
specialtyId: number;
|
|
1158
1111
|
specialty: string;
|
|
1159
1112
|
} | undefined;
|
|
1160
|
-
address?: string | undefined;
|
|
1161
|
-
city?: string | undefined;
|
|
1162
|
-
province?: string | undefined;
|
|
1163
1113
|
retries?: number | null | undefined;
|
|
1164
1114
|
id: number;
|
|
1165
1115
|
language: string;
|
|
@@ -2516,23 +2466,6 @@ export declare const doc24Schemas: {
|
|
|
2516
2466
|
vcToken: string;
|
|
2517
2467
|
attachedFile: string;
|
|
2518
2468
|
}>;
|
|
2519
|
-
uploadFileConsultationResponse: import("zod").ZodObject<{
|
|
2520
|
-
fileId: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
2521
|
-
}, "strip", import("zod").ZodTypeAny, {
|
|
2522
|
-
fileId?: number | undefined;
|
|
2523
|
-
}, {
|
|
2524
|
-
fileId?: number | undefined;
|
|
2525
|
-
}>;
|
|
2526
|
-
deleteFileConsultationParams: import("zod").ZodObject<{
|
|
2527
|
-
vcToken: import("zod").ZodString;
|
|
2528
|
-
fileId: import("zod").ZodNumber;
|
|
2529
|
-
}, "strip", import("zod").ZodTypeAny, {
|
|
2530
|
-
vcToken: string;
|
|
2531
|
-
fileId: number;
|
|
2532
|
-
}, {
|
|
2533
|
-
vcToken: string;
|
|
2534
|
-
fileId: number;
|
|
2535
|
-
}>;
|
|
2536
2469
|
healthQuizParams: import("zod").ZodObject<{
|
|
2537
2470
|
patientId: import("zod").ZodNumber;
|
|
2538
2471
|
quiz: import("zod").ZodRecord<import("zod").ZodAny>;
|
package/lib/schemas.js
CHANGED
|
@@ -61,7 +61,6 @@ const availableAppointment = zod_1.object({
|
|
|
61
61
|
province: zod_1.string().nullish(),
|
|
62
62
|
city: zod_1.string().nullish(),
|
|
63
63
|
address: zod_1.string().nullish(),
|
|
64
|
-
addressPhone: zod_1.string().nullish(),
|
|
65
64
|
});
|
|
66
65
|
const appointment = zod_1.object({
|
|
67
66
|
id: zod_1.number(),
|
|
@@ -194,16 +193,10 @@ const videoVisit = zod_1.object({
|
|
|
194
193
|
paymentStatus: zod_1.string().optional(),
|
|
195
194
|
atentionId: zod_1.number().optional(),
|
|
196
195
|
waitingTime: zod_1.string().optional(),
|
|
197
|
-
address: zod_1.string().optional(),
|
|
198
|
-
city: zod_1.string().optional(),
|
|
199
|
-
province: zod_1.string().optional(),
|
|
200
|
-
modality: zod_1.enum(['P', 'V']).optional(),
|
|
201
196
|
});
|
|
202
197
|
const historicalVideoVisit = videoVisit.extend({
|
|
203
198
|
specialty: zod_1.string(),
|
|
204
199
|
professional: zod_1.string(),
|
|
205
|
-
medications: zod_1.boolean().optional(),
|
|
206
|
-
practices: zod_1.boolean().optional(),
|
|
207
200
|
});
|
|
208
201
|
const coverageInfo = zod_1.object({
|
|
209
202
|
financerId: zod_1.number().nullable(),
|
|
@@ -419,16 +412,11 @@ exports.doc24Schemas = {
|
|
|
419
412
|
id: zod_1.number(),
|
|
420
413
|
status: zod_1.string(),
|
|
421
414
|
paymentStatus: zod_1.string(),
|
|
422
|
-
modality: zod_1.enum(['P', 'V']).optional(),
|
|
423
|
-
address: zod_1.string().optional(),
|
|
424
|
-
city: zod_1.string().optional(),
|
|
425
|
-
province: zod_1.string().optional(),
|
|
426
415
|
professional: zod_1.object({
|
|
427
416
|
id: zod_1.number(),
|
|
428
417
|
fullName: zod_1.string(),
|
|
429
418
|
specialtyId: zod_1.number(),
|
|
430
419
|
specialty: zod_1.string(),
|
|
431
|
-
idPrestadorInterno: zod_1.string().nullish(),
|
|
432
420
|
}).optional(),
|
|
433
421
|
finishDate: zod_1.date().nullable(),
|
|
434
422
|
retries: zod_1.number().nullish(),
|
|
@@ -544,13 +532,6 @@ exports.doc24Schemas = {
|
|
|
544
532
|
attachedFile: zod_1.string(),
|
|
545
533
|
fileName: zod_1.string().optional(),
|
|
546
534
|
}),
|
|
547
|
-
uploadFileConsultationResponse: zod_1.object({
|
|
548
|
-
fileId: zod_1.number().optional(),
|
|
549
|
-
}),
|
|
550
|
-
deleteFileConsultationParams: zod_1.object({
|
|
551
|
-
vcToken: zod_1.string(),
|
|
552
|
-
fileId: zod_1.number(),
|
|
553
|
-
}),
|
|
554
535
|
healthQuizParams: zod_1.object({
|
|
555
536
|
patientId: zod_1.number(),
|
|
556
537
|
quiz: zod_1.record(zod_1.any()),
|
package/lib/types.d.ts
CHANGED
|
@@ -51,8 +51,6 @@ export declare namespace Doc24 {
|
|
|
51
51
|
type BinahWellnessResponse = TypeOf<typeof doc24Schemas.binahWellnessResponse>;
|
|
52
52
|
type ProfessionalsBySpecialtyFilter = TypeOf<typeof doc24Schemas.professionalsBySpecialtyFilter>;
|
|
53
53
|
type UploadFileConsultationParams = TypeOf<typeof doc24Schemas.uploadFileConsultationParams>;
|
|
54
|
-
type UploadFileConsultationResponse = TypeOf<typeof doc24Schemas.uploadFileConsultationResponse>;
|
|
55
|
-
type DeleteFileConsultationParams = TypeOf<typeof doc24Schemas.deleteFileConsultationParams>;
|
|
56
54
|
type HealthQuizParams = TypeOf<typeof doc24Schemas.healthQuizParams>;
|
|
57
55
|
type BaseSdk = {
|
|
58
56
|
declareUser: (params: DeclareUserParams) => Promise<DeclareUserResponse>;
|
|
@@ -105,8 +103,7 @@ export declare namespace Doc24 {
|
|
|
105
103
|
submitHealthQuiz: (params: HealthQuizParams) => Promise<void>;
|
|
106
104
|
userId: number;
|
|
107
105
|
getBinahWellnessLink: (body: BinahWellnessGetLinkParams) => Promise<BinahWellnessResponse>;
|
|
108
|
-
uploadFileConsultation: (params: UploadFileConsultationParams) => Promise<
|
|
109
|
-
deleteFileConsultation: (params: DeleteFileConsultationParams) => Promise<void>;
|
|
106
|
+
uploadFileConsultation: (params: UploadFileConsultationParams) => Promise<unknown>;
|
|
110
107
|
};
|
|
111
108
|
namespace Webhook {
|
|
112
109
|
type StatusChangeEventStatus = 'S' | 'C' | 'F' | 'A' | 'D' | 'L';
|
|
@@ -13,14 +13,13 @@ export declare const getScheduleMethods: (makeRequest: RequestMaker) => {
|
|
|
13
13
|
showAppointmentConfiguration?: boolean | undefined;
|
|
14
14
|
} | undefined) => Promise<{
|
|
15
15
|
length?: number | null | undefined;
|
|
16
|
-
address?: string | null | undefined;
|
|
17
|
-
city?: string | null | undefined;
|
|
18
|
-
province?: string | null | undefined;
|
|
19
16
|
ranking?: unknown;
|
|
20
17
|
consultation_value?: string | null | undefined;
|
|
21
18
|
inPerson?: boolean | null | undefined;
|
|
22
19
|
virtual?: boolean | null | undefined;
|
|
23
|
-
|
|
20
|
+
province?: string | null | undefined;
|
|
21
|
+
city?: string | null | undefined;
|
|
22
|
+
address?: string | null | undefined;
|
|
24
23
|
date: Date;
|
|
25
24
|
type: "appointment" | "chat" | "instant";
|
|
26
25
|
id: string | number;
|
package/lib/userSdk/schedule.js
CHANGED
|
@@ -17,7 +17,7 @@ const getScheduleMethods = (makeRequest) => {
|
|
|
17
17
|
};
|
|
18
18
|
const path = `/schedule/dates/${patientId}/${JSON.stringify(mappedFilter)}`;
|
|
19
19
|
const response = await makeRequest('GET', path);
|
|
20
|
-
return response.data.available_dates.map((o) => utils_1.parseDate(o.date,
|
|
20
|
+
return response.data.available_dates.map((o) => utils_1.parseDate(o.date, o.time_zone));
|
|
21
21
|
};
|
|
22
22
|
const getSchedule = async (patientId, specialtyId, filter = {}) => {
|
|
23
23
|
var _a;
|
|
@@ -37,7 +37,7 @@ const getScheduleMethods = (makeRequest) => {
|
|
|
37
37
|
const response = await makeRequest('GET', path);
|
|
38
38
|
return response.data.available_appointments.map((a) => ({
|
|
39
39
|
id: a.id,
|
|
40
|
-
date: utils_1.parseDateTime(`${a.date} ${a.hour}`,
|
|
40
|
+
date: utils_1.parseDateTime(`${a.date} ${a.hour}`, a.time_zone),
|
|
41
41
|
clinicId: a.clinic,
|
|
42
42
|
professional: {
|
|
43
43
|
id: a.professional_id,
|
|
@@ -59,7 +59,6 @@ const getScheduleMethods = (makeRequest) => {
|
|
|
59
59
|
province: a.province,
|
|
60
60
|
city: a.city,
|
|
61
61
|
address: a.address,
|
|
62
|
-
addressPhone: a.address_phone,
|
|
63
62
|
}));
|
|
64
63
|
};
|
|
65
64
|
const getAppointment = async (appointmentId) => {
|
|
@@ -23,7 +23,6 @@ export declare const getVideoVisitMethods: (makeRequest: RequestMaker) => {
|
|
|
23
23
|
date: Date;
|
|
24
24
|
id: number;
|
|
25
25
|
} | undefined;
|
|
26
|
-
modality?: "P" | "V" | undefined;
|
|
27
26
|
videoVisit?: {
|
|
28
27
|
id: number;
|
|
29
28
|
status: string;
|
|
@@ -31,9 +30,6 @@ export declare const getVideoVisitMethods: (makeRequest: RequestMaker) => {
|
|
|
31
30
|
paymentStatus?: string | undefined;
|
|
32
31
|
atentionId?: number | undefined;
|
|
33
32
|
waitingTime?: string | undefined;
|
|
34
|
-
address?: string | undefined;
|
|
35
|
-
city?: string | undefined;
|
|
36
|
-
province?: string | undefined;
|
|
37
33
|
id: number | null;
|
|
38
34
|
patientId: number;
|
|
39
35
|
creationDate: Date;
|
|
@@ -49,7 +45,6 @@ export declare const getVideoVisitMethods: (makeRequest: RequestMaker) => {
|
|
|
49
45
|
date: Date;
|
|
50
46
|
id: number;
|
|
51
47
|
} | undefined;
|
|
52
|
-
modality?: "P" | "V" | undefined;
|
|
53
48
|
videoVisit?: {
|
|
54
49
|
id: number;
|
|
55
50
|
status: string;
|
|
@@ -57,11 +52,6 @@ export declare const getVideoVisitMethods: (makeRequest: RequestMaker) => {
|
|
|
57
52
|
paymentStatus?: string | undefined;
|
|
58
53
|
atentionId?: number | undefined;
|
|
59
54
|
waitingTime?: string | undefined;
|
|
60
|
-
address?: string | undefined;
|
|
61
|
-
city?: string | undefined;
|
|
62
|
-
province?: string | undefined;
|
|
63
|
-
medications?: boolean | undefined;
|
|
64
|
-
practices?: boolean | undefined;
|
|
65
55
|
id: number | null;
|
|
66
56
|
patientId: number;
|
|
67
57
|
professional: string;
|
|
@@ -124,17 +114,12 @@ export declare const getVideoVisitMethods: (makeRequest: RequestMaker) => {
|
|
|
124
114
|
consultationId: number;
|
|
125
115
|
}[]>;
|
|
126
116
|
getCompleteVideoVisitDetails: (vcToken: string) => Promise<{
|
|
127
|
-
modality?: "P" | "V" | undefined;
|
|
128
117
|
professional?: {
|
|
129
|
-
idPrestadorInterno?: string | null | undefined;
|
|
130
118
|
id: number;
|
|
131
119
|
fullName: string;
|
|
132
120
|
specialtyId: number;
|
|
133
121
|
specialty: string;
|
|
134
122
|
} | undefined;
|
|
135
|
-
address?: string | undefined;
|
|
136
|
-
city?: string | undefined;
|
|
137
|
-
province?: string | undefined;
|
|
138
123
|
retries?: number | null | undefined;
|
|
139
124
|
id: number;
|
|
140
125
|
language: string;
|
|
@@ -186,11 +171,5 @@ export declare const getVideoVisitMethods: (makeRequest: RequestMaker) => {
|
|
|
186
171
|
fileName?: string | undefined;
|
|
187
172
|
vcToken: string;
|
|
188
173
|
attachedFile: string;
|
|
189
|
-
}) => Promise<
|
|
190
|
-
fileId?: number | undefined;
|
|
191
|
-
}>;
|
|
192
|
-
deleteFileConsultation: (params: {
|
|
193
|
-
vcToken: string;
|
|
194
|
-
fileId: number;
|
|
195
|
-
}) => Promise<void>;
|
|
174
|
+
}) => Promise<unknown>;
|
|
196
175
|
};
|
|
@@ -16,7 +16,7 @@ const getVideoVisitMethods = (makeRequest) => {
|
|
|
16
16
|
? {
|
|
17
17
|
type: 'P',
|
|
18
18
|
appointment_id: params.appointmentId,
|
|
19
|
-
|
|
19
|
+
modaility: params.modality || 'A',
|
|
20
20
|
}
|
|
21
21
|
: { type: 'E' };
|
|
22
22
|
const mappedParams = {
|
|
@@ -25,7 +25,7 @@ const getVideoVisitMethods = (makeRequest) => {
|
|
|
25
25
|
specialty_id: params.specialtyId,
|
|
26
26
|
language: params.language.toUpperCase(),
|
|
27
27
|
details: params.details,
|
|
28
|
-
extra_info:
|
|
28
|
+
extra_info: params.extraInfo,
|
|
29
29
|
};
|
|
30
30
|
const response = await makeRequest('POST', '/video-visit', mappedParams);
|
|
31
31
|
return response.data.vc_token;
|
|
@@ -126,19 +126,12 @@ const getVideoVisitMethods = (makeRequest) => {
|
|
|
126
126
|
id: response.data.id_consulta,
|
|
127
127
|
status: response.data.estado,
|
|
128
128
|
paymentStatus: response.data.estado_pago,
|
|
129
|
-
modality: response.data.modalidad,
|
|
130
|
-
address: response.data.direccion,
|
|
131
|
-
city: response.data.localidad,
|
|
132
|
-
province: response.data.provincia,
|
|
133
129
|
professional: response.data.id_profesional
|
|
134
130
|
? {
|
|
135
131
|
id: response.data.id_profesional,
|
|
136
132
|
fullName: response.data.profesional,
|
|
137
133
|
specialtyId: response.data.id_especialidad,
|
|
138
134
|
specialty: response.data.especialidad,
|
|
139
|
-
idPrestadorInterno: response.data.id_prestador_interno != null
|
|
140
|
-
? String(response.data.id_prestador_interno)
|
|
141
|
-
: undefined,
|
|
142
135
|
}
|
|
143
136
|
: undefined,
|
|
144
137
|
finishDate: response.data.fecha_fin && utils_1.parseDateTime(response.data.fecha_fin),
|
|
@@ -196,24 +189,14 @@ const getVideoVisitMethods = (makeRequest) => {
|
|
|
196
189
|
})),
|
|
197
190
|
};
|
|
198
191
|
});
|
|
199
|
-
const uploadFileConsultation = validation_1.validateFunction(zod_1.tuple([schemas_1.doc24Schemas.uploadFileConsultationParams]),
|
|
192
|
+
const uploadFileConsultation = validation_1.validateFunction(zod_1.tuple([schemas_1.doc24Schemas.uploadFileConsultationParams]), zod_1.any(), async (params) => {
|
|
200
193
|
const form = new form_data_1.default();
|
|
201
194
|
form.append('vc_token', params.vcToken);
|
|
202
195
|
form.append('attached_file', fs_1.default.createReadStream(params.attachedFile));
|
|
203
196
|
if (params.fileName)
|
|
204
197
|
form.append('file_name', params.fileName);
|
|
205
198
|
const response = await makeRequest('POST', '/upload-file-consultation', form);
|
|
206
|
-
|
|
207
|
-
// {status, message, file_id}.
|
|
208
|
-
return {
|
|
209
|
-
fileId: response.file_id != null ? Number(response.file_id) : undefined,
|
|
210
|
-
};
|
|
211
|
-
});
|
|
212
|
-
const deleteFileConsultation = validation_1.validateFunction(zod_1.tuple([schemas_1.doc24Schemas.deleteFileConsultationParams]), zod_1.undefined(), async (params) => {
|
|
213
|
-
await makeRequest('DELETE', '/delete-file-consultation', {
|
|
214
|
-
vc_token: params.vcToken,
|
|
215
|
-
file_id: params.fileId,
|
|
216
|
-
});
|
|
199
|
+
return response.data;
|
|
217
200
|
});
|
|
218
201
|
return {
|
|
219
202
|
scheduleVideoVisit,
|
|
@@ -225,12 +208,11 @@ const getVideoVisitMethods = (makeRequest) => {
|
|
|
225
208
|
getActiveVideoVisits,
|
|
226
209
|
getCompleteVideoVisitDetails,
|
|
227
210
|
uploadFileConsultation,
|
|
228
|
-
deleteFileConsultation,
|
|
229
211
|
};
|
|
230
212
|
};
|
|
231
213
|
exports.getVideoVisitMethods = getVideoVisitMethods;
|
|
232
214
|
const mapVideoVisit = (raw) => {
|
|
233
|
-
var _a, _b, _c
|
|
215
|
+
var _a, _b, _c;
|
|
234
216
|
return {
|
|
235
217
|
id: raw.vc_id,
|
|
236
218
|
creationDate: utils_1.parseDateTime(raw.creation_date),
|
|
@@ -249,10 +231,6 @@ const mapVideoVisit = (raw) => {
|
|
|
249
231
|
paymentStatus: (_a = raw.payment_status) !== null && _a !== void 0 ? _a : undefined,
|
|
250
232
|
atentionId: (_b = raw.atentionId) !== null && _b !== void 0 ? _b : undefined,
|
|
251
233
|
waitingTime: (_c = raw.waiting_time) !== null && _c !== void 0 ? _c : undefined,
|
|
252
|
-
address: (_d = raw.direccion) !== null && _d !== void 0 ? _d : undefined,
|
|
253
|
-
city: (_e = raw.localidad) !== null && _e !== void 0 ? _e : undefined,
|
|
254
|
-
province: (_f = raw.provincia) !== null && _f !== void 0 ? _f : undefined,
|
|
255
|
-
modality: (_g = raw.modalidad) !== null && _g !== void 0 ? _g : undefined,
|
|
256
234
|
};
|
|
257
235
|
};
|
|
258
236
|
const mapHistoricalVideoVisit = (raw) => {
|
|
@@ -260,7 +238,5 @@ const mapHistoricalVideoVisit = (raw) => {
|
|
|
260
238
|
...mapVideoVisit(raw),
|
|
261
239
|
professional: raw.professional,
|
|
262
240
|
specialty: raw.specialty,
|
|
263
|
-
medications: raw.medications != null ? Boolean(raw.medications) : undefined,
|
|
264
|
-
practices: raw.practices != null ? Boolean(raw.practices) : undefined,
|
|
265
241
|
};
|
|
266
242
|
};
|
package/lib/utils.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
1
|
export declare const parseDate: (str: string, timeZone?: string | null | undefined) => Date;
|
|
2
2
|
export declare const parseDateTime: (str: string, timeZone?: string | null | undefined) => Date;
|
|
3
|
-
export declare const getConvertedHourTimeZone: (userTimeZone?: string | null | undefined, professionalTimeZone?: string | null | undefined) => string;
|
|
4
3
|
export declare const normalizeTimezoneOffset: (raw?: string | undefined, defualtTimezone?: number) => string | undefined;
|
package/lib/utils.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.normalizeTimezoneOffset = exports.
|
|
3
|
+
exports.normalizeTimezoneOffset = exports.parseDateTime = exports.parseDate = void 0;
|
|
4
4
|
const date_fns_1 = require("date-fns");
|
|
5
5
|
// import {Doc24} from '.';
|
|
6
6
|
const defaultTimeZone = '-03';
|
|
@@ -8,31 +8,6 @@ const parseDate = (str, timeZone) => exports.parseDateTime(`${str} 00:00:00`, ti
|
|
|
8
8
|
exports.parseDate = parseDate;
|
|
9
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());
|
|
10
10
|
exports.parseDateTime = parseDateTime;
|
|
11
|
-
const offsetToMinutes = (offset) => {
|
|
12
|
-
var _a;
|
|
13
|
-
const match = offset === null || offset === void 0 ? void 0 : offset.trim().match(/^([+-])(\d{1,2}):?(\d{2})?$/);
|
|
14
|
-
if (!match)
|
|
15
|
-
return undefined;
|
|
16
|
-
const minutes = Number(match[2]) * 60 + Number((_a = match[3]) !== null && _a !== void 0 ? _a : 0);
|
|
17
|
-
return match[1] === '-' ? -minutes : minutes;
|
|
18
|
-
};
|
|
19
|
-
const minutesToOffset = (minutes) => {
|
|
20
|
-
const abs = Math.abs(minutes);
|
|
21
|
-
const hh = Math.floor(abs / 60).toString().padStart(2, '0');
|
|
22
|
-
const mm = (abs % 60).toString().padStart(2, '0');
|
|
23
|
-
return `${minutes < 0 ? '-' : '+'}${hh}${mm === '00' ? '' : mm}`;
|
|
24
|
-
};
|
|
25
|
-
// WEH-1702: doc24 convierte la hora local del médico (en `time_zone`) al
|
|
26
|
-
// user_time_zone como si estuviera en -03. Esta es la zona que deshace ese
|
|
27
|
-
// corrimiento. Revertir cuando doc24 convierta desde `time_zone`.
|
|
28
|
-
const getConvertedHourTimeZone = (userTimeZone, professionalTimeZone) => {
|
|
29
|
-
var _a, _b;
|
|
30
|
-
const ar = offsetToMinutes(defaultTimeZone);
|
|
31
|
-
const user = (_a = offsetToMinutes(userTimeZone)) !== null && _a !== void 0 ? _a : ar;
|
|
32
|
-
const professional = (_b = offsetToMinutes(professionalTimeZone)) !== null && _b !== void 0 ? _b : ar;
|
|
33
|
-
return minutesToOffset(user - ar + professional);
|
|
34
|
-
};
|
|
35
|
-
exports.getConvertedHourTimeZone = getConvertedHourTimeZone;
|
|
36
11
|
const normalizeTimezoneOffset = (raw, defualtTimezone = -3) => {
|
|
37
12
|
if (!raw)
|
|
38
13
|
return;
|