@integraciones_doc24/sdk 0.32.1 → 0.33.1
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 +41 -0
- package/lib/baseSdk/diagnostica.js +49 -1
- package/lib/baseSdk/external.d.ts +2 -2
- package/lib/baseSdk/index.js +3 -0
- package/lib/index.d.ts +78 -12
- package/lib/schemas.d.ts +160 -20
- package/lib/schemas.js +44 -0
- package/lib/types.d.ts +11 -0
- package/lib/userSdk/patients.d.ts +2 -2
- package/package.json +1 -1
|
@@ -10,4 +10,45 @@ export declare const getDiagnosticaMethods: (makeRequest: RequestMaker) => {
|
|
|
10
10
|
exams: string[];
|
|
11
11
|
deepLink: string;
|
|
12
12
|
}[]>;
|
|
13
|
+
getDiagnosticaDeepLink: (kiosk: string, user: {
|
|
14
|
+
language: string;
|
|
15
|
+
firstName: string;
|
|
16
|
+
lastName: string;
|
|
17
|
+
phone: string;
|
|
18
|
+
email: string;
|
|
19
|
+
birthday: Date;
|
|
20
|
+
identificationType: "dni";
|
|
21
|
+
identificationValue: string;
|
|
22
|
+
gender: "m" | "f";
|
|
23
|
+
}, patient: {
|
|
24
|
+
firstName: string;
|
|
25
|
+
lastName: string;
|
|
26
|
+
birthday: Date;
|
|
27
|
+
identificationType: "dni";
|
|
28
|
+
identificationValue: string;
|
|
29
|
+
gender: "m" | "f";
|
|
30
|
+
}) => Promise<{
|
|
31
|
+
forwardingRequired: true;
|
|
32
|
+
deepLink: string;
|
|
33
|
+
} | {
|
|
34
|
+
forwardingRequired: false;
|
|
35
|
+
}>;
|
|
36
|
+
getDiagnosticaAccess: (kiosk: string, user: {
|
|
37
|
+
language: string;
|
|
38
|
+
firstName: string;
|
|
39
|
+
lastName: string;
|
|
40
|
+
phone: string;
|
|
41
|
+
email: string;
|
|
42
|
+
birthday: Date;
|
|
43
|
+
identificationType: "dni";
|
|
44
|
+
identificationValue: string;
|
|
45
|
+
gender: "m" | "f";
|
|
46
|
+
}, patient: {
|
|
47
|
+
firstName: string;
|
|
48
|
+
lastName: string;
|
|
49
|
+
birthday: Date;
|
|
50
|
+
identificationType: "dni";
|
|
51
|
+
identificationValue: string;
|
|
52
|
+
gender: "m" | "f";
|
|
53
|
+
}) => Promise<void>;
|
|
13
54
|
};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getDiagnosticaMethods = void 0;
|
|
4
|
+
const date_fns_1 = require("date-fns");
|
|
4
5
|
const zod_1 = require("zod");
|
|
5
6
|
const validation_1 = require("../request/validation");
|
|
6
7
|
const schemas_1 = require("../schemas");
|
|
@@ -26,6 +27,53 @@ const getDiagnosticaMethods = (makeRequest) => {
|
|
|
26
27
|
deepLink: i.deeplink,
|
|
27
28
|
}));
|
|
28
29
|
});
|
|
29
|
-
|
|
30
|
+
const getDiagnosticaDeepLink = validation_1.validateFunction(zod_1.tuple([
|
|
31
|
+
zod_1.string(),
|
|
32
|
+
schemas_1.doc24Schemas.diagnosticaUser,
|
|
33
|
+
schemas_1.doc24Schemas.diagnosticaPatient,
|
|
34
|
+
]), schemas_1.doc24Schemas.diagnosticaDeepLinkResponse, async (kiosk, user, patient) => {
|
|
35
|
+
const path = '/deeplink-diagnostica';
|
|
36
|
+
const response = await makeRequest('POST', path, {
|
|
37
|
+
kiosk,
|
|
38
|
+
user: mapUserData(user),
|
|
39
|
+
patient: mapPatientData(patient),
|
|
40
|
+
});
|
|
41
|
+
const data = response.data.data.info.data;
|
|
42
|
+
if (data.forwarding_required)
|
|
43
|
+
return { forwardingRequired: true, deepLink: data.deeplink };
|
|
44
|
+
return { forwardingRequired: false };
|
|
45
|
+
});
|
|
46
|
+
const getDiagnosticaAccess = validation_1.validateFunction(zod_1.tuple([
|
|
47
|
+
zod_1.string(),
|
|
48
|
+
schemas_1.doc24Schemas.diagnosticaUser,
|
|
49
|
+
schemas_1.doc24Schemas.diagnosticaPatient,
|
|
50
|
+
]), zod_1.void(), async (kiosk, user, patient) => {
|
|
51
|
+
const path = '/access-diagnostica';
|
|
52
|
+
await makeRequest('POST', path, {
|
|
53
|
+
kiosk,
|
|
54
|
+
user: mapUserData(user),
|
|
55
|
+
patient: mapPatientData(patient),
|
|
56
|
+
});
|
|
57
|
+
return;
|
|
58
|
+
});
|
|
59
|
+
return { getDiagnosticaHistory, getDiagnosticaDeepLink, getDiagnosticaAccess };
|
|
30
60
|
};
|
|
31
61
|
exports.getDiagnosticaMethods = getDiagnosticaMethods;
|
|
62
|
+
const mapPatientData = (patient) => {
|
|
63
|
+
return {
|
|
64
|
+
name: patient.firstName,
|
|
65
|
+
surname: patient.lastName,
|
|
66
|
+
birthday: date_fns_1.format(patient.birthday, 'yyyy-MM-dd'),
|
|
67
|
+
id_type: 'DNI',
|
|
68
|
+
id_value: patient.identificationValue,
|
|
69
|
+
gender: patient.gender.toLocaleUpperCase(),
|
|
70
|
+
};
|
|
71
|
+
};
|
|
72
|
+
const mapUserData = (user) => {
|
|
73
|
+
return {
|
|
74
|
+
...mapPatientData(user),
|
|
75
|
+
phone: user.phone,
|
|
76
|
+
email: user.email,
|
|
77
|
+
language: user.language,
|
|
78
|
+
};
|
|
79
|
+
};
|
|
@@ -6,9 +6,9 @@ export declare const getExternalMethods: (makeRequest: RequestMaker) => {
|
|
|
6
6
|
phone: string;
|
|
7
7
|
identificationNumber: string;
|
|
8
8
|
email: string;
|
|
9
|
-
countryId: string;
|
|
10
|
-
gender: "m" | "f";
|
|
11
9
|
birthday: Date;
|
|
10
|
+
gender: "m" | "f";
|
|
11
|
+
countryId: string;
|
|
12
12
|
}>;
|
|
13
13
|
preExternalEnroll: (params: {
|
|
14
14
|
phone: string;
|
package/lib/baseSdk/index.js
CHANGED
|
@@ -9,6 +9,7 @@ const schemas_1 = require("../schemas");
|
|
|
9
9
|
const userSdk_1 = require("../userSdk");
|
|
10
10
|
const utils_1 = require("../utils");
|
|
11
11
|
const diagnostica_1 = require("./diagnostica");
|
|
12
|
+
const external_1 = require("./external");
|
|
12
13
|
const getBaseSdk = async (url, credentials) => {
|
|
13
14
|
const makeRequest = await request_1.getRequestFactory(url, credentials);
|
|
14
15
|
const getUserId = async (user) => {
|
|
@@ -29,8 +30,10 @@ const getBaseSdk = async (url, credentials) => {
|
|
|
29
30
|
return response.data.user_id;
|
|
30
31
|
};
|
|
31
32
|
const diagnosticaMethods = diagnostica_1.getDiagnosticaMethods(makeRequest);
|
|
33
|
+
const externalMethods = external_1.getExternalMethods(makeRequest);
|
|
32
34
|
const baseSdk = {
|
|
33
35
|
...diagnosticaMethods,
|
|
36
|
+
...externalMethods,
|
|
34
37
|
declareUser: validation_1.validateFunction(zod_1.tuple([schemas_1.doc24Schemas.user]), zod_1.number(), getUserId),
|
|
35
38
|
getUserInstance: validation_1.validateFunction(zod_1.tuple([zod_1.union([schemas_1.doc24Schemas.user, zod_1.number()])]),
|
|
36
39
|
// TODO: validate?
|
package/lib/index.d.ts
CHANGED
|
@@ -8,34 +8,34 @@ export declare const doc24Sdk: (params: Doc24.SdkParams) => Promise<{
|
|
|
8
8
|
declareUser: (user: {
|
|
9
9
|
firstName: string;
|
|
10
10
|
lastName: string;
|
|
11
|
+
phone: string;
|
|
12
|
+
birthdate: Date;
|
|
13
|
+
email: string;
|
|
11
14
|
identificationType: "ndi" | "passport" | "credential";
|
|
12
15
|
identificationValue: string;
|
|
13
|
-
countryId: string;
|
|
14
|
-
birthdate: Date;
|
|
15
16
|
gender: "m" | "f";
|
|
16
|
-
|
|
17
|
-
email: string;
|
|
17
|
+
countryId: string;
|
|
18
18
|
}) => Promise<number>;
|
|
19
19
|
getUserInstance: (user: number | {
|
|
20
20
|
firstName: string;
|
|
21
21
|
lastName: string;
|
|
22
|
+
phone: string;
|
|
23
|
+
birthdate: Date;
|
|
24
|
+
email: string;
|
|
22
25
|
identificationType: "ndi" | "passport" | "credential";
|
|
23
26
|
identificationValue: string;
|
|
24
|
-
countryId: string;
|
|
25
|
-
birthdate: Date;
|
|
26
27
|
gender: "m" | "f";
|
|
27
|
-
|
|
28
|
-
email: string;
|
|
28
|
+
countryId: string;
|
|
29
29
|
}) => Promise<Doc24.UserSdk>;
|
|
30
30
|
getProfessional: (professionalId: number) => Promise<{
|
|
31
31
|
id: number;
|
|
32
32
|
logoUrl: string;
|
|
33
33
|
firstName: string;
|
|
34
34
|
lastName: string;
|
|
35
|
-
birthdate: Date;
|
|
36
|
-
gender: "m" | "f";
|
|
37
35
|
phone: string | null;
|
|
36
|
+
birthdate: Date;
|
|
38
37
|
email: string;
|
|
38
|
+
gender: "m" | "f";
|
|
39
39
|
specialties: {
|
|
40
40
|
id: number;
|
|
41
41
|
description: string;
|
|
@@ -69,11 +69,11 @@ export declare const doc24Sdk: (params: Doc24.SdkParams) => Promise<{
|
|
|
69
69
|
enroll: (params: {
|
|
70
70
|
firstName: string;
|
|
71
71
|
lastName: string;
|
|
72
|
+
identificationNumber: string;
|
|
72
73
|
birthdate: Date;
|
|
73
|
-
gender: "m" | "f";
|
|
74
74
|
email: string;
|
|
75
|
+
gender: "m" | "f";
|
|
75
76
|
startDate: Date;
|
|
76
|
-
identificationNumber: string;
|
|
77
77
|
plan: string;
|
|
78
78
|
}) => Promise<void>;
|
|
79
79
|
getDiagnosticaHistory: (patient: {
|
|
@@ -86,5 +86,71 @@ export declare const doc24Sdk: (params: Doc24.SdkParams) => Promise<{
|
|
|
86
86
|
exams: string[];
|
|
87
87
|
deepLink: string;
|
|
88
88
|
}[]>;
|
|
89
|
+
getDiagnosticaDeepLink: (kiosk: string, user: {
|
|
90
|
+
language: string;
|
|
91
|
+
firstName: string;
|
|
92
|
+
lastName: string;
|
|
93
|
+
phone: string;
|
|
94
|
+
email: string;
|
|
95
|
+
birthday: Date;
|
|
96
|
+
identificationType: "dni";
|
|
97
|
+
identificationValue: string;
|
|
98
|
+
gender: "m" | "f";
|
|
99
|
+
}, patient: {
|
|
100
|
+
firstName: string;
|
|
101
|
+
lastName: string;
|
|
102
|
+
birthday: Date;
|
|
103
|
+
identificationType: "dni";
|
|
104
|
+
identificationValue: string;
|
|
105
|
+
gender: "m" | "f";
|
|
106
|
+
}) => Promise<{
|
|
107
|
+
forwardingRequired: true;
|
|
108
|
+
deepLink: string;
|
|
109
|
+
} | {
|
|
110
|
+
forwardingRequired: false;
|
|
111
|
+
}>;
|
|
112
|
+
getDiagnosticaAccess: (kiosk: string, user: {
|
|
113
|
+
language: string;
|
|
114
|
+
firstName: string;
|
|
115
|
+
lastName: string;
|
|
116
|
+
phone: string;
|
|
117
|
+
email: string;
|
|
118
|
+
birthday: Date;
|
|
119
|
+
identificationType: "dni";
|
|
120
|
+
identificationValue: string;
|
|
121
|
+
gender: "m" | "f";
|
|
122
|
+
}, patient: {
|
|
123
|
+
firstName: string;
|
|
124
|
+
lastName: string;
|
|
125
|
+
birthday: Date;
|
|
126
|
+
identificationType: "dni";
|
|
127
|
+
identificationValue: string;
|
|
128
|
+
gender: "m" | "f";
|
|
129
|
+
}) => Promise<void>;
|
|
130
|
+
externalLogin: (user: string, password: string) => Promise<{
|
|
131
|
+
firstName: string;
|
|
132
|
+
lastName: string;
|
|
133
|
+
phone: string;
|
|
134
|
+
identificationNumber: string;
|
|
135
|
+
email: string;
|
|
136
|
+
birthday: Date;
|
|
137
|
+
gender: "m" | "f";
|
|
138
|
+
countryId: string;
|
|
139
|
+
}>;
|
|
140
|
+
preExternalEnroll: (params: {
|
|
141
|
+
phone: string;
|
|
142
|
+
identificationNumber: string;
|
|
143
|
+
birthdate: Date;
|
|
144
|
+
email: string;
|
|
145
|
+
}) => Promise<void>;
|
|
146
|
+
externalEnroll: (params: {
|
|
147
|
+
phone: string;
|
|
148
|
+
identificationNumber: string;
|
|
149
|
+
birthdate: Date;
|
|
150
|
+
email: string;
|
|
151
|
+
password: string;
|
|
152
|
+
emailCode: string;
|
|
153
|
+
phoneCode: string;
|
|
154
|
+
}) => Promise<void>;
|
|
89
155
|
}>;
|
|
90
156
|
export type { Doc24 } from './types';
|
package/lib/schemas.d.ts
CHANGED
|
@@ -49,23 +49,23 @@ export declare const doc24Schemas: {
|
|
|
49
49
|
}>, "strip", import("zod").ZodTypeAny, {
|
|
50
50
|
firstName: string;
|
|
51
51
|
lastName: string;
|
|
52
|
+
phone: string;
|
|
53
|
+
birthdate: Date;
|
|
54
|
+
email: string;
|
|
52
55
|
identificationType: "ndi" | "passport" | "credential";
|
|
53
56
|
identificationValue: string;
|
|
54
|
-
countryId: string;
|
|
55
|
-
birthdate: Date;
|
|
56
57
|
gender: "m" | "f";
|
|
57
|
-
|
|
58
|
-
email: string;
|
|
58
|
+
countryId: string;
|
|
59
59
|
}, {
|
|
60
60
|
firstName: string;
|
|
61
61
|
lastName: string;
|
|
62
|
+
phone: string;
|
|
63
|
+
birthdate: Date;
|
|
64
|
+
email: string;
|
|
62
65
|
identificationType: "ndi" | "passport" | "credential";
|
|
63
66
|
identificationValue: string;
|
|
64
|
-
countryId: string;
|
|
65
|
-
birthdate: Date;
|
|
66
67
|
gender: "m" | "f";
|
|
67
|
-
|
|
68
|
-
email: string;
|
|
68
|
+
countryId: string;
|
|
69
69
|
}>;
|
|
70
70
|
patient: import("zod").ZodObject<{
|
|
71
71
|
firstName: import("zod").ZodString;
|
|
@@ -78,19 +78,19 @@ export declare const doc24Schemas: {
|
|
|
78
78
|
}, "strip", import("zod").ZodTypeAny, {
|
|
79
79
|
firstName: string;
|
|
80
80
|
lastName: string;
|
|
81
|
+
birthdate: Date;
|
|
81
82
|
identificationType: "ndi" | "passport" | "credential";
|
|
82
83
|
identificationValue: string;
|
|
83
|
-
countryId: string;
|
|
84
|
-
birthdate: Date;
|
|
85
84
|
gender: "m" | "f";
|
|
85
|
+
countryId: string;
|
|
86
86
|
}, {
|
|
87
87
|
firstName: string;
|
|
88
88
|
lastName: string;
|
|
89
|
+
birthdate: Date;
|
|
89
90
|
identificationType: "ndi" | "passport" | "credential";
|
|
90
91
|
identificationValue: string;
|
|
91
|
-
countryId: string;
|
|
92
|
-
birthdate: Date;
|
|
93
92
|
gender: "m" | "f";
|
|
93
|
+
countryId: string;
|
|
94
94
|
}>;
|
|
95
95
|
specialtyMode: import("zod").ZodEnum<["appointment", "chat", "instant"]>;
|
|
96
96
|
specialty: import("zod").ZodObject<{
|
|
@@ -657,10 +657,10 @@ export declare const doc24Schemas: {
|
|
|
657
657
|
logoUrl: string;
|
|
658
658
|
firstName: string;
|
|
659
659
|
lastName: string;
|
|
660
|
-
birthdate: Date;
|
|
661
|
-
gender: "m" | "f";
|
|
662
660
|
phone: string | null;
|
|
661
|
+
birthdate: Date;
|
|
663
662
|
email: string;
|
|
663
|
+
gender: "m" | "f";
|
|
664
664
|
specialties: {
|
|
665
665
|
id: number;
|
|
666
666
|
description: string;
|
|
@@ -680,10 +680,10 @@ export declare const doc24Schemas: {
|
|
|
680
680
|
logoUrl: string;
|
|
681
681
|
firstName: string;
|
|
682
682
|
lastName: string;
|
|
683
|
-
birthdate: Date;
|
|
684
|
-
gender: "m" | "f";
|
|
685
683
|
phone: string | null;
|
|
684
|
+
birthdate: Date;
|
|
686
685
|
email: string;
|
|
686
|
+
gender: "m" | "f";
|
|
687
687
|
specialties: {
|
|
688
688
|
id: number;
|
|
689
689
|
description: string;
|
|
@@ -909,22 +909,92 @@ export declare const doc24Schemas: {
|
|
|
909
909
|
}, "strip", import("zod").ZodTypeAny, {
|
|
910
910
|
firstName: string;
|
|
911
911
|
lastName: string;
|
|
912
|
+
identificationNumber: string;
|
|
912
913
|
birthdate: Date;
|
|
913
|
-
gender: "m" | "f";
|
|
914
914
|
email: string;
|
|
915
|
+
gender: "m" | "f";
|
|
915
916
|
startDate: Date;
|
|
916
|
-
identificationNumber: string;
|
|
917
917
|
plan: string;
|
|
918
918
|
}, {
|
|
919
919
|
firstName: string;
|
|
920
920
|
lastName: string;
|
|
921
|
+
identificationNumber: string;
|
|
921
922
|
birthdate: Date;
|
|
922
|
-
gender: "m" | "f";
|
|
923
923
|
email: string;
|
|
924
|
+
gender: "m" | "f";
|
|
924
925
|
startDate: Date;
|
|
925
|
-
identificationNumber: string;
|
|
926
926
|
plan: string;
|
|
927
927
|
}>;
|
|
928
|
+
externalLoginResponse: import("zod").ZodObject<{
|
|
929
|
+
firstName: import("zod").ZodString;
|
|
930
|
+
lastName: import("zod").ZodString;
|
|
931
|
+
countryId: import("zod").ZodString;
|
|
932
|
+
birthday: import("zod").ZodDate;
|
|
933
|
+
identificationNumber: import("zod").ZodString;
|
|
934
|
+
gender: import("zod").ZodEnum<["m", "f"]>;
|
|
935
|
+
email: import("zod").ZodString;
|
|
936
|
+
phone: import("zod").ZodString;
|
|
937
|
+
}, "strip", import("zod").ZodTypeAny, {
|
|
938
|
+
firstName: string;
|
|
939
|
+
lastName: string;
|
|
940
|
+
phone: string;
|
|
941
|
+
identificationNumber: string;
|
|
942
|
+
email: string;
|
|
943
|
+
birthday: Date;
|
|
944
|
+
gender: "m" | "f";
|
|
945
|
+
countryId: string;
|
|
946
|
+
}, {
|
|
947
|
+
firstName: string;
|
|
948
|
+
lastName: string;
|
|
949
|
+
phone: string;
|
|
950
|
+
identificationNumber: string;
|
|
951
|
+
email: string;
|
|
952
|
+
birthday: Date;
|
|
953
|
+
gender: "m" | "f";
|
|
954
|
+
countryId: string;
|
|
955
|
+
}>;
|
|
956
|
+
preExternalEnrollmentParams: import("zod").ZodObject<{
|
|
957
|
+
phone: import("zod").ZodString;
|
|
958
|
+
identificationNumber: import("zod").ZodString;
|
|
959
|
+
birthdate: import("zod").ZodDate;
|
|
960
|
+
email: import("zod").ZodString;
|
|
961
|
+
}, "strip", import("zod").ZodTypeAny, {
|
|
962
|
+
phone: string;
|
|
963
|
+
identificationNumber: string;
|
|
964
|
+
birthdate: Date;
|
|
965
|
+
email: string;
|
|
966
|
+
}, {
|
|
967
|
+
phone: string;
|
|
968
|
+
identificationNumber: string;
|
|
969
|
+
birthdate: Date;
|
|
970
|
+
email: string;
|
|
971
|
+
}>;
|
|
972
|
+
externalEnrollmentParams: import("zod").ZodObject<import("zod").extendShape<{
|
|
973
|
+
phone: import("zod").ZodString;
|
|
974
|
+
identificationNumber: import("zod").ZodString;
|
|
975
|
+
birthdate: import("zod").ZodDate;
|
|
976
|
+
email: import("zod").ZodString;
|
|
977
|
+
}, {
|
|
978
|
+
password: import("zod").ZodString;
|
|
979
|
+
emailCode: import("zod").ZodString;
|
|
980
|
+
phoneCode: import("zod").ZodString;
|
|
981
|
+
}>, "strip", import("zod").ZodTypeAny, {
|
|
982
|
+
phone: string;
|
|
983
|
+
identificationNumber: string;
|
|
984
|
+
birthdate: Date;
|
|
985
|
+
email: string;
|
|
986
|
+
password: string;
|
|
987
|
+
emailCode: string;
|
|
988
|
+
phoneCode: string;
|
|
989
|
+
}, {
|
|
990
|
+
phone: string;
|
|
991
|
+
identificationNumber: string;
|
|
992
|
+
birthdate: Date;
|
|
993
|
+
email: string;
|
|
994
|
+
password: string;
|
|
995
|
+
emailCode: string;
|
|
996
|
+
phoneCode: string;
|
|
997
|
+
}>;
|
|
928
998
|
diagnosticaPatientFilter: import("zod").ZodObject<{
|
|
929
999
|
gender: import("zod").ZodEnum<["m", "f"]>;
|
|
930
1000
|
identificationType: import("zod").ZodEnum<["ndi", "passport", "credential"]>;
|
|
@@ -954,4 +1024,74 @@ export declare const doc24Schemas: {
|
|
|
954
1024
|
exams: string[];
|
|
955
1025
|
deepLink: string;
|
|
956
1026
|
}>;
|
|
1027
|
+
diagnosticaUser: import("zod").ZodObject<import("zod").extendShape<{
|
|
1028
|
+
firstName: import("zod").ZodString;
|
|
1029
|
+
lastName: import("zod").ZodString;
|
|
1030
|
+
birthday: import("zod").ZodDate;
|
|
1031
|
+
identificationType: import("zod").ZodLiteral<"dni">;
|
|
1032
|
+
identificationValue: import("zod").ZodString;
|
|
1033
|
+
gender: import("zod").ZodEnum<["m", "f"]>;
|
|
1034
|
+
}, {
|
|
1035
|
+
phone: import("zod").ZodString;
|
|
1036
|
+
email: import("zod").ZodString;
|
|
1037
|
+
language: import("zod").ZodString;
|
|
1038
|
+
}>, "strip", import("zod").ZodTypeAny, {
|
|
1039
|
+
language: string;
|
|
1040
|
+
firstName: string;
|
|
1041
|
+
lastName: string;
|
|
1042
|
+
phone: string;
|
|
1043
|
+
email: string;
|
|
1044
|
+
birthday: Date;
|
|
1045
|
+
identificationType: "dni";
|
|
1046
|
+
identificationValue: string;
|
|
1047
|
+
gender: "m" | "f";
|
|
1048
|
+
}, {
|
|
1049
|
+
language: string;
|
|
1050
|
+
firstName: string;
|
|
1051
|
+
lastName: string;
|
|
1052
|
+
phone: string;
|
|
1053
|
+
email: string;
|
|
1054
|
+
birthday: Date;
|
|
1055
|
+
identificationType: "dni";
|
|
1056
|
+
identificationValue: string;
|
|
1057
|
+
gender: "m" | "f";
|
|
1058
|
+
}>;
|
|
1059
|
+
diagnosticaPatient: import("zod").ZodObject<{
|
|
1060
|
+
firstName: import("zod").ZodString;
|
|
1061
|
+
lastName: import("zod").ZodString;
|
|
1062
|
+
birthday: import("zod").ZodDate;
|
|
1063
|
+
identificationType: import("zod").ZodLiteral<"dni">;
|
|
1064
|
+
identificationValue: import("zod").ZodString;
|
|
1065
|
+
gender: import("zod").ZodEnum<["m", "f"]>;
|
|
1066
|
+
}, "strip", import("zod").ZodTypeAny, {
|
|
1067
|
+
firstName: string;
|
|
1068
|
+
lastName: string;
|
|
1069
|
+
birthday: Date;
|
|
1070
|
+
identificationType: "dni";
|
|
1071
|
+
identificationValue: string;
|
|
1072
|
+
gender: "m" | "f";
|
|
1073
|
+
}, {
|
|
1074
|
+
firstName: string;
|
|
1075
|
+
lastName: string;
|
|
1076
|
+
birthday: Date;
|
|
1077
|
+
identificationType: "dni";
|
|
1078
|
+
identificationValue: string;
|
|
1079
|
+
gender: "m" | "f";
|
|
1080
|
+
}>;
|
|
1081
|
+
diagnosticaDeepLinkResponse: import("zod").ZodUnion<[import("zod").ZodObject<{
|
|
1082
|
+
forwardingRequired: import("zod").ZodLiteral<true>;
|
|
1083
|
+
deepLink: import("zod").ZodString;
|
|
1084
|
+
}, "strip", import("zod").ZodTypeAny, {
|
|
1085
|
+
forwardingRequired: true;
|
|
1086
|
+
deepLink: string;
|
|
1087
|
+
}, {
|
|
1088
|
+
forwardingRequired: true;
|
|
1089
|
+
deepLink: string;
|
|
1090
|
+
}>, import("zod").ZodObject<{
|
|
1091
|
+
forwardingRequired: import("zod").ZodLiteral<false>;
|
|
1092
|
+
}, "strip", import("zod").ZodTypeAny, {
|
|
1093
|
+
forwardingRequired: false;
|
|
1094
|
+
}, {
|
|
1095
|
+
forwardingRequired: false;
|
|
1096
|
+
}>]>;
|
|
957
1097
|
};
|
package/lib/schemas.js
CHANGED
|
@@ -124,12 +124,50 @@ const enrollmentParams = zod_1.object({
|
|
|
124
124
|
plan: zod_1.string(),
|
|
125
125
|
startDate: zod_1.date(),
|
|
126
126
|
});
|
|
127
|
+
const externalLoginResponse = zod_1.object({
|
|
128
|
+
firstName: zod_1.string(),
|
|
129
|
+
lastName: zod_1.string(),
|
|
130
|
+
countryId: zod_1.string(),
|
|
131
|
+
birthday: zod_1.date(),
|
|
132
|
+
identificationNumber: zod_1.string(),
|
|
133
|
+
gender,
|
|
134
|
+
email: zod_1.string().email(),
|
|
135
|
+
phone: zod_1.string(),
|
|
136
|
+
});
|
|
137
|
+
const preExternalEnrollmentParams = zod_1.object({
|
|
138
|
+
phone: zod_1.string(),
|
|
139
|
+
identificationNumber: zod_1.string(),
|
|
140
|
+
birthdate: zod_1.date(),
|
|
141
|
+
email: zod_1.string().email(),
|
|
142
|
+
});
|
|
143
|
+
const externalEnrollmentParams = preExternalEnrollmentParams.merge(zod_1.object({
|
|
144
|
+
password: zod_1.string(),
|
|
145
|
+
emailCode: zod_1.string(),
|
|
146
|
+
phoneCode: zod_1.string(),
|
|
147
|
+
}));
|
|
127
148
|
const diagnosticaHistoryAppointment = zod_1.object({
|
|
128
149
|
date: zod_1.date(),
|
|
129
150
|
location: zod_1.string(),
|
|
130
151
|
exams: zod_1.string().array(),
|
|
131
152
|
deepLink: zod_1.string().url(),
|
|
132
153
|
});
|
|
154
|
+
const diagnosticaPatient = zod_1.object({
|
|
155
|
+
firstName: zod_1.string(),
|
|
156
|
+
lastName: zod_1.string(),
|
|
157
|
+
birthday: zod_1.date(),
|
|
158
|
+
identificationType: zod_1.literal('dni'),
|
|
159
|
+
identificationValue: zod_1.string(),
|
|
160
|
+
gender: gender,
|
|
161
|
+
});
|
|
162
|
+
const diagnosticaUser = diagnosticaPatient.merge(zod_1.object({
|
|
163
|
+
phone: zod_1.string(),
|
|
164
|
+
email: zod_1.string().email(),
|
|
165
|
+
language: zod_1.string(),
|
|
166
|
+
}));
|
|
167
|
+
const diagnosticaDeepLinkResponse = zod_1.object({
|
|
168
|
+
forwardingRequired: zod_1.literal(true),
|
|
169
|
+
deepLink: zod_1.string().url(),
|
|
170
|
+
}).or(zod_1.object({ forwardingRequired: zod_1.literal(false) }));
|
|
133
171
|
exports.doc24Schemas = {
|
|
134
172
|
identificationType,
|
|
135
173
|
sdkCredentials,
|
|
@@ -239,10 +277,16 @@ exports.doc24Schemas = {
|
|
|
239
277
|
chatDetails,
|
|
240
278
|
chatPost,
|
|
241
279
|
enrollmentParams,
|
|
280
|
+
externalLoginResponse,
|
|
281
|
+
preExternalEnrollmentParams,
|
|
282
|
+
externalEnrollmentParams,
|
|
242
283
|
diagnosticaPatientFilter: zod_1.object({
|
|
243
284
|
gender,
|
|
244
285
|
identificationType,
|
|
245
286
|
identificationValue: zod_1.string(),
|
|
246
287
|
}),
|
|
247
288
|
diagnosticaHistoryAppointment,
|
|
289
|
+
diagnosticaUser,
|
|
290
|
+
diagnosticaPatient,
|
|
291
|
+
diagnosticaDeepLinkResponse,
|
|
248
292
|
};
|
package/lib/types.d.ts
CHANGED
|
@@ -24,8 +24,14 @@ export declare namespace Doc24 {
|
|
|
24
24
|
type ChatDetails = TypeOf<typeof doc24Schemas.chatDetails>;
|
|
25
25
|
type ChatPost = TypeOf<typeof doc24Schemas.chatPost>;
|
|
26
26
|
type EnrollmentParams = TypeOf<typeof doc24Schemas.enrollmentParams>;
|
|
27
|
+
type ExternalLoginResponse = TypeOf<typeof doc24Schemas.externalLoginResponse>;
|
|
28
|
+
type PreExternalEnrollmentParams = TypeOf<typeof doc24Schemas.preExternalEnrollmentParams>;
|
|
29
|
+
type ExternalEnrollmentParams = TypeOf<typeof doc24Schemas.externalEnrollmentParams>;
|
|
27
30
|
type DiagnosticaPatientFilter = TypeOf<typeof doc24Schemas.diagnosticaPatientFilter>;
|
|
31
|
+
type DiagnosticaUser = TypeOf<typeof doc24Schemas.diagnosticaUser>;
|
|
32
|
+
type DiagnosticaPatient = TypeOf<typeof doc24Schemas.diagnosticaPatient>;
|
|
28
33
|
type DiagnosticaHistoryAppointment = TypeOf<typeof doc24Schemas.diagnosticaHistoryAppointment>;
|
|
34
|
+
type DiagnosticaDeepLinkResponse = TypeOf<typeof doc24Schemas.diagnosticaDeepLinkResponse>;
|
|
29
35
|
type BaseSdk = {
|
|
30
36
|
declareUser: (user: User) => Promise<number>;
|
|
31
37
|
getUserInstance: (user: User | number) => Promise<UserSdk>;
|
|
@@ -33,6 +39,11 @@ export declare namespace Doc24 {
|
|
|
33
39
|
getAvailableScheduleClinics: () => Promise<AvailableScheduleClinics>;
|
|
34
40
|
enroll: (params: EnrollmentParams) => Promise<void>;
|
|
35
41
|
getDiagnosticaHistory: (patient: DiagnosticaPatientFilter, from: Date, to: Date) => Promise<DiagnosticaHistoryAppointment[]>;
|
|
42
|
+
getDiagnosticaDeepLink: (kiosk: string, user: DiagnosticaUser, patient: DiagnosticaPatient) => Promise<DiagnosticaDeepLinkResponse>;
|
|
43
|
+
getDiagnosticaAccess: (kiosk: string, user: DiagnosticaUser, patient: DiagnosticaPatient) => Promise<void>;
|
|
44
|
+
externalLogin: (user: string, password: string) => Promise<ExternalLoginResponse>;
|
|
45
|
+
preExternalEnroll: (params: PreExternalEnrollmentParams) => Promise<void>;
|
|
46
|
+
externalEnroll: (params: ExternalEnrollmentParams) => Promise<void>;
|
|
36
47
|
};
|
|
37
48
|
type UserSdk = {
|
|
38
49
|
declarePatient: (patient: Patient) => Promise<number>;
|
|
@@ -3,10 +3,10 @@ export declare const getPatientMethods: (makeRequest: RequestMaker) => {
|
|
|
3
3
|
declarePatient: (patient: {
|
|
4
4
|
firstName: string;
|
|
5
5
|
lastName: string;
|
|
6
|
+
birthdate: Date;
|
|
6
7
|
identificationType: "ndi" | "passport" | "credential";
|
|
7
8
|
identificationValue: string;
|
|
8
|
-
countryId: string;
|
|
9
|
-
birthdate: Date;
|
|
10
9
|
gender: "m" | "f";
|
|
10
|
+
countryId: string;
|
|
11
11
|
}) => Promise<number>;
|
|
12
12
|
};
|