@integraciones_doc24/sdk 0.33.0 → 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.
@@ -14,12 +14,12 @@ export declare const getDiagnosticaMethods: (makeRequest: RequestMaker) => {
14
14
  language: string;
15
15
  firstName: string;
16
16
  lastName: string;
17
+ phone: string;
18
+ email: string;
17
19
  birthday: Date;
18
20
  identificationType: "dni";
19
21
  identificationValue: string;
20
22
  gender: "m" | "f";
21
- phone: string;
22
- email: string;
23
23
  }, patient: {
24
24
  firstName: string;
25
25
  lastName: string;
@@ -37,12 +37,12 @@ export declare const getDiagnosticaMethods: (makeRequest: RequestMaker) => {
37
37
  language: string;
38
38
  firstName: string;
39
39
  lastName: string;
40
+ phone: string;
41
+ email: string;
40
42
  birthday: Date;
41
43
  identificationType: "dni";
42
44
  identificationValue: string;
43
45
  gender: "m" | "f";
44
- phone: string;
45
- email: string;
46
46
  }, patient: {
47
47
  firstName: string;
48
48
  lastName: string;
@@ -32,7 +32,7 @@ const getDiagnosticaMethods = (makeRequest) => {
32
32
  schemas_1.doc24Schemas.diagnosticaUser,
33
33
  schemas_1.doc24Schemas.diagnosticaPatient,
34
34
  ]), schemas_1.doc24Schemas.diagnosticaDeepLinkResponse, async (kiosk, user, patient) => {
35
- const path = 'deeplink-diagnostica';
35
+ const path = '/deeplink-diagnostica';
36
36
  const response = await makeRequest('POST', path, {
37
37
  kiosk,
38
38
  user: mapUserData(user),
@@ -48,7 +48,7 @@ const getDiagnosticaMethods = (makeRequest) => {
48
48
  schemas_1.doc24Schemas.diagnosticaUser,
49
49
  schemas_1.doc24Schemas.diagnosticaPatient,
50
50
  ]), zod_1.void(), async (kiosk, user, patient) => {
51
- const path = 'access-diagnostica';
51
+ const path = '/access-diagnostica';
52
52
  await makeRequest('POST', path, {
53
53
  kiosk,
54
54
  user: mapUserData(user),
@@ -1,6 +1,28 @@
1
1
  import { RequestMaker } from '../request';
2
2
  export declare const getExternalMethods: (makeRequest: RequestMaker) => {
3
- externalLogin: any;
4
- preExternalEnroll: any;
5
- externalEnroll: any;
3
+ externalLogin: (user: string, password: string) => Promise<{
4
+ firstName: string;
5
+ lastName: string;
6
+ phone: string;
7
+ identificationNumber: string;
8
+ email: string;
9
+ birthday: Date;
10
+ gender: "m" | "f";
11
+ countryId: string;
12
+ }>;
13
+ preExternalEnroll: (params: {
14
+ phone: string;
15
+ identificationNumber: string;
16
+ birthdate: Date;
17
+ email: string;
18
+ }) => Promise<void>;
19
+ externalEnroll: (params: {
20
+ phone: string;
21
+ identificationNumber: string;
22
+ birthdate: Date;
23
+ email: string;
24
+ password: string;
25
+ emailCode: string;
26
+ phoneCode: string;
27
+ }) => Promise<void>;
6
28
  };
@@ -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
16
  gender: "m" | "f";
14
- phone: string;
15
- email: string;
16
17
  countryId: string;
17
- birthdate: Date;
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
27
  gender: "m" | "f";
25
- phone: string;
26
- email: string;
27
28
  countryId: string;
28
- birthdate: Date;
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
- gender: "m" | "f";
36
35
  phone: string | null;
37
- email: string;
38
36
  birthdate: Date;
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
- gender: "m" | "f";
73
- email: string;
72
+ identificationNumber: string;
74
73
  birthdate: Date;
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: {
@@ -90,12 +90,12 @@ export declare const doc24Sdk: (params: Doc24.SdkParams) => Promise<{
90
90
  language: string;
91
91
  firstName: string;
92
92
  lastName: string;
93
+ phone: string;
94
+ email: string;
93
95
  birthday: Date;
94
96
  identificationType: "dni";
95
97
  identificationValue: string;
96
98
  gender: "m" | "f";
97
- phone: string;
98
- email: string;
99
99
  }, patient: {
100
100
  firstName: string;
101
101
  lastName: string;
@@ -113,12 +113,12 @@ export declare const doc24Sdk: (params: Doc24.SdkParams) => Promise<{
113
113
  language: string;
114
114
  firstName: string;
115
115
  lastName: string;
116
+ phone: string;
117
+ email: string;
116
118
  birthday: Date;
117
119
  identificationType: "dni";
118
120
  identificationValue: string;
119
121
  gender: "m" | "f";
120
- phone: string;
121
- email: string;
122
122
  }, patient: {
123
123
  firstName: string;
124
124
  lastName: string;
@@ -127,5 +127,30 @@ export declare const doc24Sdk: (params: Doc24.SdkParams) => Promise<{
127
127
  identificationValue: string;
128
128
  gender: "m" | "f";
129
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>;
130
155
  }>;
131
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
57
  gender: "m" | "f";
55
- phone: string;
56
- email: string;
57
58
  countryId: string;
58
- birthdate: Date;
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
67
  gender: "m" | "f";
65
- phone: string;
66
- email: string;
67
68
  countryId: string;
68
- birthdate: Date;
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
84
  gender: "m" | "f";
84
85
  countryId: string;
85
- birthdate: Date;
86
86
  }, {
87
87
  firstName: string;
88
88
  lastName: string;
89
+ birthdate: Date;
89
90
  identificationType: "ndi" | "passport" | "credential";
90
91
  identificationValue: string;
91
92
  gender: "m" | "f";
92
93
  countryId: string;
93
- birthdate: Date;
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
- gender: "m" | "f";
661
660
  phone: string | null;
662
- email: string;
663
661
  birthdate: Date;
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
- gender: "m" | "f";
684
683
  phone: string | null;
685
- email: string;
686
684
  birthdate: Date;
685
+ email: string;
686
+ gender: "m" | "f";
687
687
  specialties: {
688
688
  id: number;
689
689
  description: string;
@@ -909,21 +909,91 @@ export declare const doc24Schemas: {
909
909
  }, "strip", import("zod").ZodTypeAny, {
910
910
  firstName: string;
911
911
  lastName: string;
912
- gender: "m" | "f";
913
- email: string;
912
+ identificationNumber: string;
914
913
  birthdate: Date;
914
+ email: string;
915
+ gender: "m" | "f";
915
916
  startDate: Date;
917
+ plan: string;
918
+ }, {
919
+ firstName: string;
920
+ lastName: string;
916
921
  identificationNumber: string;
922
+ birthdate: Date;
923
+ email: string;
924
+ gender: "m" | "f";
925
+ startDate: Date;
917
926
  plan: string;
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;
918
946
  }, {
919
947
  firstName: string;
920
948
  lastName: string;
949
+ phone: string;
950
+ identificationNumber: string;
951
+ email: string;
952
+ birthday: Date;
921
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;
922
965
  email: string;
966
+ }, {
967
+ phone: string;
968
+ identificationNumber: string;
923
969
  birthdate: Date;
924
- startDate: 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;
925
983
  identificationNumber: string;
926
- plan: 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;
927
997
  }>;
928
998
  diagnosticaPatientFilter: import("zod").ZodObject<{
929
999
  gender: import("zod").ZodEnum<["m", "f"]>;
@@ -969,22 +1039,22 @@ export declare const doc24Schemas: {
969
1039
  language: string;
970
1040
  firstName: string;
971
1041
  lastName: string;
1042
+ phone: string;
1043
+ email: string;
972
1044
  birthday: Date;
973
1045
  identificationType: "dni";
974
1046
  identificationValue: string;
975
1047
  gender: "m" | "f";
976
- phone: string;
977
- email: string;
978
1048
  }, {
979
1049
  language: string;
980
1050
  firstName: string;
981
1051
  lastName: string;
1052
+ phone: string;
1053
+ email: string;
982
1054
  birthday: Date;
983
1055
  identificationType: "dni";
984
1056
  identificationValue: string;
985
1057
  gender: "m" | "f";
986
- phone: string;
987
- email: string;
988
1058
  }>;
989
1059
  diagnosticaPatient: import("zod").ZodObject<{
990
1060
  firstName: import("zod").ZodString;
package/lib/schemas.js CHANGED
@@ -124,6 +124,27 @@ 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(),
@@ -256,6 +277,9 @@ exports.doc24Schemas = {
256
277
  chatDetails,
257
278
  chatPost,
258
279
  enrollmentParams,
280
+ externalLoginResponse,
281
+ preExternalEnrollmentParams,
282
+ externalEnrollmentParams,
259
283
  diagnosticaPatientFilter: zod_1.object({
260
284
  gender,
261
285
  identificationType,
package/lib/types.d.ts CHANGED
@@ -24,6 +24,9 @@ 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>;
28
31
  type DiagnosticaUser = TypeOf<typeof doc24Schemas.diagnosticaUser>;
29
32
  type DiagnosticaPatient = TypeOf<typeof doc24Schemas.diagnosticaPatient>;
@@ -38,6 +41,9 @@ export declare namespace Doc24 {
38
41
  getDiagnosticaHistory: (patient: DiagnosticaPatientFilter, from: Date, to: Date) => Promise<DiagnosticaHistoryAppointment[]>;
39
42
  getDiagnosticaDeepLink: (kiosk: string, user: DiagnosticaUser, patient: DiagnosticaPatient) => Promise<DiagnosticaDeepLinkResponse>;
40
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>;
41
47
  };
42
48
  type UserSdk = {
43
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
9
  gender: "m" | "f";
9
10
  countryId: string;
10
- birthdate: Date;
11
11
  }) => Promise<number>;
12
12
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@integraciones_doc24/sdk",
3
- "version": "0.33.0",
3
+ "version": "0.33.1",
4
4
  "description": "",
5
5
  "main": "lib/index.js",
6
6
  "scripts": {