@integraciones_doc24/sdk 1.9.1 → 1.11.0

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.
Files changed (245) hide show
  1. package/lib/baseSdk/external.d.ts +29 -0
  2. package/lib/baseSdk/external.js +56 -0
  3. package/lib/index.d.ts +29 -0
  4. package/lib/schemas.d.ts +127 -0
  5. package/lib/schemas.js +23 -0
  6. package/lib/types.d.ts +6 -0
  7. package/lib/userSdk/videoVisit.d.ts +4 -0
  8. package/lib/userSdk/videoVisit.js +2 -0
  9. package/package.json +1 -1
  10. package/lib/lib/baseSdk/diagnostica.d.ts +0 -11
  11. package/lib/lib/baseSdk/diagnostica.js +0 -79
  12. package/lib/lib/baseSdk/index.d.ts +0 -161
  13. package/lib/lib/baseSdk/index.js +0 -66
  14. package/lib/lib/baseSdk/user.d.ts +0 -41
  15. package/lib/lib/baseSdk/user.js +0 -130
  16. package/lib/lib/index.d.ts +0 -182
  17. package/lib/lib/index.js +0 -22
  18. package/lib/lib/lib/baseSdk/diagnostica.d.ts +0 -6
  19. package/lib/lib/lib/baseSdk/diagnostica.js +0 -79
  20. package/lib/lib/lib/baseSdk/index.d.ts +0 -51
  21. package/lib/lib/lib/baseSdk/index.js +0 -66
  22. package/lib/lib/lib/baseSdk/user.d.ts +0 -9
  23. package/lib/lib/lib/baseSdk/user.js +0 -130
  24. package/lib/lib/lib/index.d.ts +0 -168
  25. package/lib/lib/lib/index.js +0 -22
  26. package/lib/lib/lib/lib/baseSdk/diagnostica.d.ts +0 -6
  27. package/lib/lib/lib/lib/baseSdk/diagnostica.js +0 -79
  28. package/lib/lib/lib/lib/baseSdk/index.d.ts +0 -14
  29. package/lib/lib/lib/lib/baseSdk/index.js +0 -66
  30. package/lib/lib/lib/lib/baseSdk/user.d.ts +0 -9
  31. package/lib/lib/lib/lib/baseSdk/user.js +0 -130
  32. package/lib/lib/lib/lib/index.d.ts +0 -58
  33. package/lib/lib/lib/lib/index.js +0 -22
  34. package/lib/lib/lib/lib/request/index.d.ts +0 -2
  35. package/lib/lib/lib/lib/request/index.js +0 -26
  36. package/lib/lib/lib/lib/request/token.d.ts +0 -2
  37. package/lib/lib/lib/lib/request/token.js +0 -34
  38. package/lib/lib/lib/lib/request/validation.d.ts +0 -10
  39. package/lib/lib/lib/lib/request/validation.js +0 -28
  40. package/lib/lib/lib/lib/schemas.d.ts +0 -1334
  41. package/lib/lib/lib/lib/schemas.js +0 -325
  42. package/lib/lib/lib/lib/test.d.ts +0 -1
  43. package/lib/lib/lib/lib/test.js +0 -55
  44. package/lib/lib/lib/lib/types.d.ts +0 -1
  45. package/lib/lib/lib/lib/types.js +0 -2
  46. package/lib/lib/lib/lib/userSdk/chat.d.ts +0 -9
  47. package/lib/lib/lib/lib/userSdk/chat.js +0 -98
  48. package/lib/lib/lib/lib/userSdk/index.d.ts +0 -24
  49. package/lib/lib/lib/lib/userSdk/index.js +0 -27
  50. package/lib/lib/lib/lib/userSdk/patients.d.ts +0 -5
  51. package/lib/lib/lib/lib/userSdk/patients.js +0 -55
  52. package/lib/lib/lib/lib/userSdk/schedule.d.ts +0 -7
  53. package/lib/lib/lib/lib/userSdk/schedule.js +0 -76
  54. package/lib/lib/lib/lib/userSdk/specialties.d.ts +0 -4
  55. package/lib/lib/lib/lib/userSdk/specialties.js +0 -19
  56. package/lib/lib/lib/lib/userSdk/videoVisit.d.ts +0 -10
  57. package/lib/lib/lib/lib/userSdk/videoVisit.js +0 -147
  58. package/lib/lib/lib/lib/utils.d.ts +0 -4
  59. package/lib/lib/lib/lib/utils.js +0 -19
  60. package/lib/lib/lib/lib/webhook/index.d.ts +0 -8
  61. package/lib/lib/lib/lib/webhook/index.js +0 -55
  62. package/lib/lib/lib/lib/webhook/responses.d.ts +0 -36
  63. package/lib/lib/lib/lib/webhook/responses.js +0 -42
  64. package/lib/lib/lib/lib/webhook/token.d.ts +0 -2
  65. package/lib/lib/lib/lib/webhook/token.js +0 -23
  66. package/lib/lib/lib/request/index.d.ts +0 -2
  67. package/lib/lib/lib/request/index.js +0 -26
  68. package/lib/lib/lib/request/token.d.ts +0 -2
  69. package/lib/lib/lib/request/token.js +0 -34
  70. package/lib/lib/lib/request/validation.d.ts +0 -10
  71. package/lib/lib/lib/request/validation.js +0 -28
  72. package/lib/lib/lib/schemas.d.ts +0 -1334
  73. package/lib/lib/lib/schemas.js +0 -325
  74. package/lib/lib/lib/src/baseSdk/diagnostica.d.ts +0 -6
  75. package/lib/lib/lib/src/baseSdk/diagnostica.js +0 -79
  76. package/lib/lib/lib/src/baseSdk/index.d.ts +0 -51
  77. package/lib/lib/lib/src/baseSdk/index.js +0 -66
  78. package/lib/lib/lib/src/baseSdk/user.d.ts +0 -9
  79. package/lib/lib/lib/src/baseSdk/user.js +0 -130
  80. package/lib/lib/lib/src/index.d.ts +0 -169
  81. package/lib/lib/lib/src/index.js +0 -22
  82. package/lib/lib/lib/src/request/index.d.ts +0 -2
  83. package/lib/lib/lib/src/request/index.js +0 -26
  84. package/lib/lib/lib/src/request/token.d.ts +0 -2
  85. package/lib/lib/lib/src/request/token.js +0 -34
  86. package/lib/lib/lib/src/request/validation.d.ts +0 -10
  87. package/lib/lib/lib/src/request/validation.js +0 -28
  88. package/lib/lib/lib/src/schemas.d.ts +0 -1340
  89. package/lib/lib/lib/src/schemas.js +0 -325
  90. package/lib/lib/lib/src/types.d.ts +0 -1
  91. package/lib/lib/lib/src/types.js +0 -2
  92. package/lib/lib/lib/src/userSdk/chat.d.ts +0 -9
  93. package/lib/lib/lib/src/userSdk/chat.js +0 -98
  94. package/lib/lib/lib/src/userSdk/index.d.ts +0 -102
  95. package/lib/lib/lib/src/userSdk/index.js +0 -27
  96. package/lib/lib/lib/src/userSdk/patients.d.ts +0 -5
  97. package/lib/lib/lib/src/userSdk/patients.js +0 -55
  98. package/lib/lib/lib/src/userSdk/schedule.d.ts +0 -7
  99. package/lib/lib/lib/src/userSdk/schedule.js +0 -76
  100. package/lib/lib/lib/src/userSdk/specialties.d.ts +0 -4
  101. package/lib/lib/lib/src/userSdk/specialties.js +0 -19
  102. package/lib/lib/lib/src/userSdk/videoVisit.d.ts +0 -10
  103. package/lib/lib/lib/src/userSdk/videoVisit.js +0 -147
  104. package/lib/lib/lib/src/utils.d.ts +0 -4
  105. package/lib/lib/lib/src/utils.js +0 -19
  106. package/lib/lib/lib/src/webhook/index.d.ts +0 -8
  107. package/lib/lib/lib/src/webhook/index.js +0 -55
  108. package/lib/lib/lib/src/webhook/responses.d.ts +0 -36
  109. package/lib/lib/lib/src/webhook/responses.js +0 -42
  110. package/lib/lib/lib/src/webhook/token.d.ts +0 -2
  111. package/lib/lib/lib/src/webhook/token.js +0 -23
  112. package/lib/lib/lib/test.d.ts +0 -1
  113. package/lib/lib/lib/test.js +0 -55
  114. package/lib/lib/lib/types.d.ts +0 -1
  115. package/lib/lib/lib/types.js +0 -2
  116. package/lib/lib/lib/userSdk/chat.d.ts +0 -9
  117. package/lib/lib/lib/userSdk/chat.js +0 -98
  118. package/lib/lib/lib/userSdk/index.d.ts +0 -102
  119. package/lib/lib/lib/userSdk/index.js +0 -27
  120. package/lib/lib/lib/userSdk/patients.d.ts +0 -5
  121. package/lib/lib/lib/userSdk/patients.js +0 -55
  122. package/lib/lib/lib/userSdk/schedule.d.ts +0 -7
  123. package/lib/lib/lib/userSdk/schedule.js +0 -76
  124. package/lib/lib/lib/userSdk/specialties.d.ts +0 -4
  125. package/lib/lib/lib/userSdk/specialties.js +0 -19
  126. package/lib/lib/lib/userSdk/videoVisit.d.ts +0 -10
  127. package/lib/lib/lib/userSdk/videoVisit.js +0 -147
  128. package/lib/lib/lib/utils.d.ts +0 -4
  129. package/lib/lib/lib/utils.js +0 -19
  130. package/lib/lib/lib/webhook/index.d.ts +0 -8
  131. package/lib/lib/lib/webhook/index.js +0 -55
  132. package/lib/lib/lib/webhook/responses.d.ts +0 -36
  133. package/lib/lib/lib/webhook/responses.js +0 -42
  134. package/lib/lib/lib/webhook/token.d.ts +0 -2
  135. package/lib/lib/lib/webhook/token.js +0 -23
  136. package/lib/lib/request/index.d.ts +0 -2
  137. package/lib/lib/request/index.js +0 -26
  138. package/lib/lib/request/token.d.ts +0 -2
  139. package/lib/lib/request/token.js +0 -34
  140. package/lib/lib/request/validation.d.ts +0 -10
  141. package/lib/lib/request/validation.js +0 -28
  142. package/lib/lib/schemas.d.ts +0 -1334
  143. package/lib/lib/schemas.js +0 -325
  144. package/lib/lib/src/baseSdk/diagnostica.d.ts +0 -11
  145. package/lib/lib/src/baseSdk/diagnostica.js +0 -79
  146. package/lib/lib/src/baseSdk/index.d.ts +0 -162
  147. package/lib/lib/src/baseSdk/index.js +0 -66
  148. package/lib/lib/src/baseSdk/user.d.ts +0 -41
  149. package/lib/lib/src/baseSdk/user.js +0 -130
  150. package/lib/lib/src/index.d.ts +0 -183
  151. package/lib/lib/src/index.js +0 -22
  152. package/lib/lib/src/request/index.d.ts +0 -2
  153. package/lib/lib/src/request/index.js +0 -26
  154. package/lib/lib/src/request/token.d.ts +0 -2
  155. package/lib/lib/src/request/token.js +0 -34
  156. package/lib/lib/src/request/validation.d.ts +0 -10
  157. package/lib/lib/src/request/validation.js +0 -28
  158. package/lib/lib/src/schemas.d.ts +0 -1340
  159. package/lib/lib/src/schemas.js +0 -325
  160. package/lib/lib/src/types.d.ts +0 -1
  161. package/lib/lib/src/types.js +0 -2
  162. package/lib/lib/src/userSdk/chat.d.ts +0 -9
  163. package/lib/lib/src/userSdk/chat.js +0 -98
  164. package/lib/lib/src/userSdk/index.d.ts +0 -241
  165. package/lib/lib/src/userSdk/index.js +0 -27
  166. package/lib/lib/src/userSdk/patients.d.ts +0 -13
  167. package/lib/lib/src/userSdk/patients.js +0 -55
  168. package/lib/lib/src/userSdk/schedule.d.ts +0 -15
  169. package/lib/lib/src/userSdk/schedule.js +0 -76
  170. package/lib/lib/src/userSdk/specialties.d.ts +0 -4
  171. package/lib/lib/src/userSdk/specialties.js +0 -19
  172. package/lib/lib/src/userSdk/videoVisit.d.ts +0 -72
  173. package/lib/lib/src/userSdk/videoVisit.js +0 -147
  174. package/lib/lib/src/utils.d.ts +0 -4
  175. package/lib/lib/src/utils.js +0 -19
  176. package/lib/lib/src/webhook/index.d.ts +0 -8
  177. package/lib/lib/src/webhook/index.js +0 -55
  178. package/lib/lib/src/webhook/responses.d.ts +0 -36
  179. package/lib/lib/src/webhook/responses.js +0 -42
  180. package/lib/lib/src/webhook/token.d.ts +0 -2
  181. package/lib/lib/src/webhook/token.js +0 -23
  182. package/lib/lib/test.d.ts +0 -1
  183. package/lib/lib/test.js +0 -55
  184. package/lib/lib/types.d.ts +0 -1
  185. package/lib/lib/types.js +0 -2
  186. package/lib/lib/userSdk/chat.d.ts +0 -9
  187. package/lib/lib/userSdk/chat.js +0 -98
  188. package/lib/lib/userSdk/index.d.ts +0 -240
  189. package/lib/lib/userSdk/index.js +0 -27
  190. package/lib/lib/userSdk/patients.d.ts +0 -13
  191. package/lib/lib/userSdk/patients.js +0 -55
  192. package/lib/lib/userSdk/schedule.d.ts +0 -15
  193. package/lib/lib/userSdk/schedule.js +0 -76
  194. package/lib/lib/userSdk/specialties.d.ts +0 -4
  195. package/lib/lib/userSdk/specialties.js +0 -19
  196. package/lib/lib/userSdk/videoVisit.d.ts +0 -72
  197. package/lib/lib/userSdk/videoVisit.js +0 -147
  198. package/lib/lib/utils.d.ts +0 -4
  199. package/lib/lib/utils.js +0 -19
  200. package/lib/lib/webhook/index.d.ts +0 -8
  201. package/lib/lib/webhook/index.js +0 -55
  202. package/lib/lib/webhook/responses.d.ts +0 -36
  203. package/lib/lib/webhook/responses.js +0 -42
  204. package/lib/lib/webhook/token.d.ts +0 -2
  205. package/lib/lib/webhook/token.js +0 -23
  206. package/lib/src/baseSdk/diagnostica.d.ts +0 -54
  207. package/lib/src/baseSdk/diagnostica.js +0 -79
  208. package/lib/src/baseSdk/index.d.ts +0 -2
  209. package/lib/src/baseSdk/index.js +0 -66
  210. package/lib/src/baseSdk/user.d.ts +0 -89
  211. package/lib/src/baseSdk/user.js +0 -130
  212. package/lib/src/index.d.ts +0 -188
  213. package/lib/src/index.js +0 -22
  214. package/lib/src/request/index.d.ts +0 -3
  215. package/lib/src/request/index.js +0 -26
  216. package/lib/src/request/token.d.ts +0 -2
  217. package/lib/src/request/token.js +0 -34
  218. package/lib/src/request/validation.d.ts +0 -10
  219. package/lib/src/request/validation.js +0 -28
  220. package/lib/src/schemas.d.ts +0 -1311
  221. package/lib/src/schemas.js +0 -325
  222. package/lib/src/types.d.ts +0 -124
  223. package/lib/src/types.js +0 -2
  224. package/lib/src/userSdk/chat.d.ts +0 -57
  225. package/lib/src/userSdk/chat.js +0 -98
  226. package/lib/src/userSdk/index.d.ts +0 -2
  227. package/lib/src/userSdk/index.js +0 -27
  228. package/lib/src/userSdk/patients.d.ts +0 -33
  229. package/lib/src/userSdk/patients.js +0 -55
  230. package/lib/src/userSdk/schedule.d.ts +0 -44
  231. package/lib/src/userSdk/schedule.js +0 -76
  232. package/lib/src/userSdk/specialties.d.ts +0 -7
  233. package/lib/src/userSdk/specialties.js +0 -19
  234. package/lib/src/userSdk/videoVisit.d.ts +0 -111
  235. package/lib/src/userSdk/videoVisit.js +0 -147
  236. package/lib/src/utils.d.ts +0 -4
  237. package/lib/src/utils.js +0 -19
  238. package/lib/src/webhook/index.d.ts +0 -2
  239. package/lib/src/webhook/index.js +0 -55
  240. package/lib/src/webhook/responses.d.ts +0 -35
  241. package/lib/src/webhook/responses.js +0 -42
  242. package/lib/src/webhook/token.d.ts +0 -2
  243. package/lib/src/webhook/token.js +0 -23
  244. package/lib/test.d.ts +0 -1
  245. package/lib/test.js +0 -21
@@ -174,4 +174,33 @@ export declare const getExternalMethods: (makeRequest: RequestMaker) => {
174
174
  emailCode?: undefined;
175
175
  phoneCode: string;
176
176
  })) => Promise<any>;
177
+ getExternalStudiesHistoryLink: (patient: {
178
+ identificationType: "DNI";
179
+ identificationValue: string;
180
+ birthdate: Date;
181
+ gender: "m" | "f";
182
+ }) => Promise<string>;
183
+ getExternalAppointmentsLink: (identificationValue: string, birthdate: Date) => Promise<string>;
184
+ getExternalAppointments: () => Promise<{
185
+ date: Date;
186
+ birthdate: Date;
187
+ appointment: string;
188
+ id: number;
189
+ specialty: string;
190
+ patientName: string;
191
+ clinic: string;
192
+ professionalName: string;
193
+ modality: string;
194
+ }[]>;
195
+ cancelExternalAppointment: (appointmentId: {
196
+ date: Date;
197
+ birthdate: Date;
198
+ appointment: string;
199
+ id: number;
200
+ specialty: string;
201
+ patientName: string;
202
+ clinic: string;
203
+ professionalName: string;
204
+ modality: string;
205
+ }) => Promise<void>;
177
206
  };
@@ -5,6 +5,7 @@ const date_fns_1 = require("date-fns");
5
5
  const zod_1 = require("zod");
6
6
  const validation_1 = require("../request/validation");
7
7
  const schemas_1 = require("../schemas");
8
+ const utils_1 = require("../utils");
8
9
  const getExternalMethods = (makeRequest) => {
9
10
  const externalLogin = async ({ user, password, }) => {
10
11
  const path = '/external-login';
@@ -84,6 +85,49 @@ const getExternalMethods = (makeRequest) => {
84
85
  });
85
86
  return response.data;
86
87
  };
88
+ const getExternalStudiesHistoryLink = async (patient) => {
89
+ const path = '/history-external-studies';
90
+ const response = await makeRequest('POST', path, {
91
+ patient: mapPatientData(patient),
92
+ });
93
+ return response.data.info.link;
94
+ };
95
+ const getExternalAppointmentsLink = async (identificationValue, birthdate) => {
96
+ const path = `/external-appointments-link/${identificationValue}/${date_fns_1.format(birthdate, 'yyyy-MM-dd')}`;
97
+ const response = await makeRequest('GET', path);
98
+ return response.data.link;
99
+ };
100
+ const getExternalAppointments = async () => {
101
+ const path = '/external-appointments';
102
+ const response = await makeRequest('GET', path);
103
+ return response.data.appointments.map((a) => ({
104
+ id: a.appointment_id,
105
+ patientName: a.patient_name,
106
+ birthdate: utils_1.parseDate(a.birthdate),
107
+ appointment: a.appointment,
108
+ clinic: a.clinic,
109
+ professionalName: a.professional,
110
+ date: utils_1.parseDateTime(`${a.day} ${a.hour}:00`),
111
+ specialty: a.specialty,
112
+ modality: a.modality,
113
+ }));
114
+ };
115
+ const cancelExternalAppointment = async (appointment) => {
116
+ const path = `/cancel-external-appointment`;
117
+ await makeRequest('POST', path, {
118
+ appointment_id: appointment.id,
119
+ patient_name: appointment.patientName,
120
+ birthdate: date_fns_1.format(appointment.birthdate, 'yyyy-MM-dd'),
121
+ appointment: appointment.appointment,
122
+ clinic: appointment.clinic,
123
+ professional: appointment.professionalName,
124
+ day: date_fns_1.format(appointment.date, 'yyyy-MM-dd'),
125
+ hour: date_fns_1.format(appointment.date, 'HH:mm'),
126
+ specialty: appointment.specialty,
127
+ modality: appointment.modality,
128
+ });
129
+ return;
130
+ };
87
131
  return {
88
132
  externalLogin: validation_1.validateFunction(zod_1.tuple([schemas_1.doc24Schemas.externalLoginParams]), schemas_1.doc24Schemas.externalLoginResponse, externalLogin),
89
133
  preExternalEnrollment: validation_1.validateFunction(zod_1.tuple([schemas_1.doc24Schemas.preExternalEnrollmentParams]), zod_1.void(), preExternalEnrollment),
@@ -91,6 +135,18 @@ const getExternalMethods = (makeRequest) => {
91
135
  sendExternalVerificationCode: validation_1.validateFunction(zod_1.tuple([schemas_1.doc24Schemas.sendExternalVerificationCodeParams]), zod_1.void(), sendExternalVerificationCode),
92
136
  verifyExternalVerificationCode: validation_1.validateFunction(zod_1.tuple([schemas_1.doc24Schemas.verifyExternalVerificationCodeParams]), zod_1.any(), verifyExternalVerificationCode),
93
137
  externalResetPassword: validation_1.validateFunction(zod_1.tuple([schemas_1.doc24Schemas.externalResetPasswordParams]), zod_1.any(), externalResetPassword),
138
+ getExternalStudiesHistoryLink: validation_1.validateFunction(zod_1.tuple([schemas_1.doc24Schemas.externalPatient]), zod_1.string(), getExternalStudiesHistoryLink),
139
+ getExternalAppointmentsLink: validation_1.validateFunction(zod_1.tuple([zod_1.string(), zod_1.date()]), zod_1.string(), getExternalAppointmentsLink),
140
+ getExternalAppointments: validation_1.validateFunction(zod_1.tuple([]), zod_1.array(schemas_1.doc24Schemas.externalAppointment), getExternalAppointments),
141
+ cancelExternalAppointment: validation_1.validateFunction(zod_1.tuple([schemas_1.doc24Schemas.externalAppointment]), zod_1.void(), cancelExternalAppointment),
94
142
  };
95
143
  };
96
144
  exports.getExternalMethods = getExternalMethods;
145
+ const mapPatientData = (patient) => {
146
+ return {
147
+ birthdate: date_fns_1.format(patient.birthdate, 'yyyy-MM-dd'),
148
+ id_type: 'dni',
149
+ id_value: patient.identificationValue,
150
+ gender: patient.gender.toLocaleUpperCase(),
151
+ };
152
+ };
package/lib/index.d.ts CHANGED
@@ -360,5 +360,34 @@ export declare const doc24Sdk: (params: Doc24.SdkParams) => Promise<{
360
360
  emailCode?: undefined;
361
361
  phoneCode: string;
362
362
  })) => Promise<any>;
363
+ getExternalStudiesHistoryLink: (patient: {
364
+ identificationType: "DNI";
365
+ identificationValue: string;
366
+ birthdate: Date;
367
+ gender: "m" | "f";
368
+ }) => Promise<string>;
369
+ getExternalAppointmentsLink: (identificationValue: string, birthdate: Date) => Promise<string>;
370
+ getExternalAppointments: () => Promise<{
371
+ date: Date;
372
+ birthdate: Date;
373
+ appointment: string;
374
+ id: number;
375
+ specialty: string;
376
+ patientName: string;
377
+ clinic: string;
378
+ professionalName: string;
379
+ modality: string;
380
+ }[]>;
381
+ cancelExternalAppointment: (appointmentId: {
382
+ date: Date;
383
+ birthdate: Date;
384
+ appointment: string;
385
+ id: number;
386
+ specialty: string;
387
+ patientName: string;
388
+ clinic: string;
389
+ professionalName: string;
390
+ modality: string;
391
+ }) => Promise<void>;
363
392
  }>;
364
393
  export type { Doc24 } from './types';
package/lib/schemas.d.ts CHANGED
@@ -389,6 +389,8 @@ export declare const doc24Schemas: {
389
389
  }>>;
390
390
  paymentStatus: import("zod").ZodOptional<import("zod").ZodString>;
391
391
  atentionId: import("zod").ZodOptional<import("zod").ZodNumber>;
392
+ specialty: import("zod").ZodString;
393
+ professional: import("zod").ZodString;
392
394
  }, "strip", import("zod").ZodTypeAny, {
393
395
  appointment?: {
394
396
  date: Date;
@@ -402,6 +404,8 @@ export declare const doc24Schemas: {
402
404
  atentionId?: number | undefined;
403
405
  id: number | null;
404
406
  patientId: number;
407
+ professional: string;
408
+ specialty: string;
405
409
  creationDate: Date;
406
410
  user: {
407
411
  phone: string | null;
@@ -422,6 +426,8 @@ export declare const doc24Schemas: {
422
426
  atentionId?: number | undefined;
423
427
  id: number | null;
424
428
  patientId: number;
429
+ professional: string;
430
+ specialty: string;
425
431
  creationDate: Date;
426
432
  user: {
427
433
  phone: string | null;
@@ -1595,4 +1601,125 @@ export declare const doc24Schemas: {
1595
1601
  emailCode?: undefined;
1596
1602
  phoneCode: string;
1597
1603
  }>>;
1604
+ externalPatient: import("zod").ZodObject<{
1605
+ birthdate: import("zod").ZodDate;
1606
+ identificationType: import("zod").ZodLiteral<"DNI">;
1607
+ identificationValue: import("zod").ZodString;
1608
+ gender: import("zod").ZodEnum<["m", "f"]>;
1609
+ }, "strip", import("zod").ZodTypeAny, {
1610
+ identificationType: "DNI";
1611
+ identificationValue: string;
1612
+ birthdate: Date;
1613
+ gender: "m" | "f";
1614
+ }, {
1615
+ identificationType: "DNI";
1616
+ identificationValue: string;
1617
+ birthdate: Date;
1618
+ gender: "m" | "f";
1619
+ }>;
1620
+ externalAppointment: import("zod").ZodObject<{
1621
+ id: import("zod").ZodNumber;
1622
+ patientName: import("zod").ZodString;
1623
+ birthdate: import("zod").ZodDate;
1624
+ appointment: import("zod").ZodString;
1625
+ clinic: import("zod").ZodString;
1626
+ professionalName: import("zod").ZodString;
1627
+ date: import("zod").ZodDate;
1628
+ specialty: import("zod").ZodString;
1629
+ modality: import("zod").ZodString;
1630
+ }, "strip", import("zod").ZodTypeAny, {
1631
+ date: Date;
1632
+ birthdate: Date;
1633
+ appointment: string;
1634
+ id: number;
1635
+ specialty: string;
1636
+ patientName: string;
1637
+ clinic: string;
1638
+ professionalName: string;
1639
+ modality: string;
1640
+ }, {
1641
+ date: Date;
1642
+ birthdate: Date;
1643
+ appointment: string;
1644
+ id: number;
1645
+ specialty: string;
1646
+ patientName: string;
1647
+ clinic: string;
1648
+ professionalName: string;
1649
+ modality: string;
1650
+ }>;
1651
+ emailOrPhone: import("zod").ZodEffects<import("zod").ZodUnion<[import("zod").ZodObject<{
1652
+ email: import("zod").ZodString;
1653
+ phone: import("zod").ZodString;
1654
+ }, "strip", import("zod").ZodTypeAny, {
1655
+ phone: string;
1656
+ email: string;
1657
+ }, {
1658
+ phone: string;
1659
+ email: string;
1660
+ }>, import("zod").ZodObject<{
1661
+ email: import("zod").ZodString;
1662
+ phone: import("zod").ZodUndefined;
1663
+ }, "strip", import("zod").ZodTypeAny, {
1664
+ phone?: undefined;
1665
+ email: string;
1666
+ }, {
1667
+ phone?: undefined;
1668
+ email: string;
1669
+ }>, import("zod").ZodObject<{
1670
+ email: import("zod").ZodUndefined;
1671
+ phone: import("zod").ZodString;
1672
+ }, "strip", import("zod").ZodTypeAny, {
1673
+ email?: undefined;
1674
+ phone: string;
1675
+ }, {
1676
+ email?: undefined;
1677
+ phone: string;
1678
+ }>]>, {
1679
+ phone: string;
1680
+ email: string;
1681
+ } | {
1682
+ phone?: undefined;
1683
+ email: string;
1684
+ } | {
1685
+ email?: undefined;
1686
+ phone: string;
1687
+ }>;
1688
+ emailOrPhoneCode: import("zod").ZodEffects<import("zod").ZodUnion<[import("zod").ZodObject<{
1689
+ emailCode: import("zod").ZodString;
1690
+ phoneCode: import("zod").ZodString;
1691
+ }, "strip", import("zod").ZodTypeAny, {
1692
+ emailCode: string;
1693
+ phoneCode: string;
1694
+ }, {
1695
+ emailCode: string;
1696
+ phoneCode: string;
1697
+ }>, import("zod").ZodObject<{
1698
+ emailCode: import("zod").ZodString;
1699
+ phoneCode: import("zod").ZodUndefined;
1700
+ }, "strip", import("zod").ZodTypeAny, {
1701
+ phoneCode?: undefined;
1702
+ emailCode: string;
1703
+ }, {
1704
+ phoneCode?: undefined;
1705
+ emailCode: string;
1706
+ }>, import("zod").ZodObject<{
1707
+ emailCode: import("zod").ZodUndefined;
1708
+ phoneCode: import("zod").ZodString;
1709
+ }, "strip", import("zod").ZodTypeAny, {
1710
+ emailCode?: undefined;
1711
+ phoneCode: string;
1712
+ }, {
1713
+ emailCode?: undefined;
1714
+ phoneCode: string;
1715
+ }>]>, {
1716
+ emailCode: string;
1717
+ phoneCode: string;
1718
+ } | {
1719
+ phoneCode?: undefined;
1720
+ emailCode: string;
1721
+ } | {
1722
+ emailCode?: undefined;
1723
+ phoneCode: string;
1724
+ }>;
1598
1725
  };
package/lib/schemas.js CHANGED
@@ -255,6 +255,23 @@ const externalResetPasswordParams = zod_1.object({
255
255
  birthdate: zod_1.date(),
256
256
  password: zod_1.string(),
257
257
  }).and(emailOrPhoneCode);
258
+ const externalPatient = zod_1.object({
259
+ birthdate: zod_1.date(),
260
+ identificationType: zod_1.literal('DNI'),
261
+ identificationValue: zod_1.string(),
262
+ gender: gender,
263
+ });
264
+ const externalAppointment = zod_1.object({
265
+ id: zod_1.number(),
266
+ patientName: zod_1.string(),
267
+ birthdate: zod_1.date(),
268
+ appointment: zod_1.string(),
269
+ clinic: zod_1.string(),
270
+ professionalName: zod_1.string(),
271
+ date: zod_1.date(),
272
+ specialty: zod_1.string(),
273
+ modality: zod_1.string(),
274
+ });
258
275
  exports.doc24Schemas = {
259
276
  sdkCredentials,
260
277
  sdkParams: zod_1.object({ url: zod_1.string(), credentials: sdkCredentials }),
@@ -299,6 +316,8 @@ exports.doc24Schemas = {
299
316
  }).optional(),
300
317
  paymentStatus: zod_1.string().optional(),
301
318
  atentionId: zod_1.number().optional(),
319
+ specialty: zod_1.string(),
320
+ professional: zod_1.string(),
302
321
  }),
303
322
  videoVisitDetails: zod_1.object({
304
323
  id: zod_1.number(),
@@ -387,4 +406,8 @@ exports.doc24Schemas = {
387
406
  sendExternalVerificationCodeParams,
388
407
  verifyExternalVerificationCodeParams,
389
408
  externalResetPasswordParams,
409
+ externalPatient,
410
+ externalAppointment,
411
+ emailOrPhone,
412
+ emailOrPhoneCode,
390
413
  };
package/lib/types.d.ts CHANGED
@@ -42,6 +42,8 @@ export declare namespace Doc24 {
42
42
  type SendExternalVerificationCodeParams = TypeOf<typeof doc24Schemas.sendExternalVerificationCodeParams>;
43
43
  type VerifyExternalVerificationCodeParams = TypeOf<typeof doc24Schemas.verifyExternalVerificationCodeParams>;
44
44
  type ExternalResetPasswordParams = TypeOf<typeof doc24Schemas.externalResetPasswordParams>;
45
+ type ExternalPatient = TypeOf<typeof doc24Schemas.externalPatient>;
46
+ type ExternalAppointment = TypeOf<typeof doc24Schemas.externalAppointment>;
45
47
  type BaseSdk = {
46
48
  declareUser: (params: DeclareUserParams) => Promise<DeclareUserResponse>;
47
49
  getUserId: (user: User) => Promise<number>;
@@ -60,6 +62,10 @@ export declare namespace Doc24 {
60
62
  sendExternalVerificationCode: (params: SendExternalVerificationCodeParams) => Promise<void>;
61
63
  verifyExternalVerificationCode: (params: VerifyExternalVerificationCodeParams) => Promise<any>;
62
64
  externalResetPassword: (params: ExternalResetPasswordParams) => Promise<any>;
65
+ getExternalStudiesHistoryLink: (patient: ExternalPatient) => Promise<string>;
66
+ getExternalAppointmentsLink: (identificationValue: string, birthdate: Date) => Promise<string>;
67
+ getExternalAppointments: () => Promise<ExternalAppointment[]>;
68
+ cancelExternalAppointment: (appointmentId: ExternalAppointment) => Promise<void>;
63
69
  };
64
70
  type UserSdk = {
65
71
  declarePatient: (params: DeclarePatientParams) => Promise<DeclarePatientResponse>;
@@ -30,6 +30,8 @@ export declare const getVideoVisitMethods: (makeRequest: RequestMaker) => {
30
30
  atentionId?: number | undefined;
31
31
  id: number | null;
32
32
  patientId: number;
33
+ professional: string;
34
+ specialty: string;
33
35
  creationDate: Date;
34
36
  user: {
35
37
  phone: string | null;
@@ -51,6 +53,8 @@ export declare const getVideoVisitMethods: (makeRequest: RequestMaker) => {
51
53
  atentionId?: number | undefined;
52
54
  id: number | null;
53
55
  patientId: number;
56
+ professional: string;
57
+ specialty: string;
54
58
  creationDate: Date;
55
59
  user: {
56
60
  phone: string | null;
@@ -143,5 +143,7 @@ const mapVideoVisit = (raw) => {
143
143
  : undefined,
144
144
  paymentStatus: (_a = raw.payment_status) !== null && _a !== void 0 ? _a : undefined,
145
145
  atentionId: (_b = raw.atentionId) !== null && _b !== void 0 ? _b : undefined,
146
+ professional: raw.professional,
147
+ specialty: raw.specialty,
146
148
  };
147
149
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@integraciones_doc24/sdk",
3
- "version": "1.9.1",
3
+ "version": "1.11.0",
4
4
  "publishConfig": {
5
5
  "tag": "latest"
6
6
  },
@@ -1,11 +0,0 @@
1
- export var __esModule: boolean;
2
- export function getDiagnosticaMethods(makeRequest: any): {
3
- getDiagnosticaHistory: (...params: any) => Promise<any>;
4
- getDiagnosticaDeepLink: (...params: any) => Promise<{
5
- forwardingRequired: true;
6
- deepLink: string;
7
- } | {
8
- forwardingRequired: false;
9
- }>;
10
- getDiagnosticaAccess: (...params: any) => Promise<void>;
11
- };
@@ -1,79 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getDiagnosticaMethods = 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 getDiagnosticaMethods = (makeRequest) => {
9
- const getDiagnosticaHistory = validation_1.validateFunction(zod_1.tuple([schemas_1.doc24Schemas.diagnosticaPatientFilter, zod_1.date(), zod_1.date()]), schemas_1.doc24Schemas.diagnosticaHistoryAppointment.array(), async (patient, from, to) => {
10
- const path = '/history-diagnostica';
11
- const response = await makeRequest('POST', path, {
12
- patient: {
13
- gender: patient.gender,
14
- id_type: patient.identificationType === 'ndi'
15
- ? 'DNI'
16
- : patient.identificationType,
17
- id_value: patient.identificationValue,
18
- },
19
- dateFrom: from.toISOString(),
20
- dateTo: to.toISOString(),
21
- });
22
- const list = response.data.info;
23
- return list.map((i) => ({
24
- date: new Date(Date.parse(i.date)),
25
- location: i.location,
26
- exams: i.exams,
27
- deepLink: i.deeplink,
28
- }));
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.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 };
60
- };
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
- };
@@ -1,161 +0,0 @@
1
- export var __esModule: boolean;
2
- export function getBaseSdk(url: any, credentials: any): Promise<{
3
- getProfessional: (...params: any) => Promise<{
4
- id: any;
5
- firstName: any;
6
- lastName: any;
7
- birthdate: Date;
8
- gender: any;
9
- email: any;
10
- phone: any;
11
- logoUrl: any;
12
- matriculation: any;
13
- specialties: any;
14
- degree: any;
15
- languages: any;
16
- resume: {
17
- link: any;
18
- brief: any;
19
- };
20
- }>;
21
- getAvailableScheduleClinics: () => Promise<{
22
- specialties: any;
23
- specialtiesER: any;
24
- professionals: any;
25
- }>;
26
- declareUser: (params: {
27
- code?: string | undefined;
28
- channel?: "1" | "2" | undefined;
29
- user: {
30
- firstName: string;
31
- lastName: string;
32
- identificationType: "ndi" | "passport" | "credential";
33
- identificationValue: string;
34
- countryId: string;
35
- birthdate: Date;
36
- gender: "m" | "f";
37
- phone: string;
38
- email: string;
39
- };
40
- }) => Promise<{
41
- patientId: number | null;
42
- userInfo: {
43
- phone: string;
44
- email: string;
45
- };
46
- askCode: boolean;
47
- userId: number;
48
- }>;
49
- getUserId: (user: {
50
- firstName: string;
51
- lastName: string;
52
- identificationType: "ndi" | "passport" | "credential";
53
- identificationValue: string;
54
- countryId: string;
55
- birthdate: Date;
56
- gender: "m" | "f";
57
- phone: string;
58
- email: string;
59
- }) => Promise<number>;
60
- sendVerificationCode: (params: {
61
- identificationType: "ndi" | "passport" | "credential";
62
- identificationValue: string;
63
- channel: "1" | "2";
64
- }) => Promise<any>;
65
- getUserInstance: (user: number | {
66
- firstName: string;
67
- lastName: string;
68
- identificationType: "ndi" | "passport" | "credential";
69
- identificationValue: string;
70
- countryId: string;
71
- birthdate: Date;
72
- gender: "m" | "f";
73
- phone: string;
74
- email: string;
75
- }) => Promise<any>;
76
- enroll: (params: {
77
- firstName: string;
78
- lastName: string;
79
- birthdate: Date;
80
- gender: "m" | "f";
81
- email: string;
82
- startDate: Date;
83
- identificationNumber: string;
84
- plan: string;
85
- }) => Promise<void>;
86
- getConverageInfo: (identificationValue: string) => Promise<{
87
- firstName: string | null;
88
- lastName: string | null;
89
- birthdate: Date;
90
- gender: "m" | "f";
91
- email: string | null;
92
- identificationNumber: string;
93
- plan: string | null;
94
- financerId: number | null;
95
- defaultAffiliationId: number | null;
96
- credentialNumber: string | null;
97
- financerPlanId: number | null;
98
- brand: number | null;
99
- holderIdentificationNumber: string | null;
100
- copaymentValue: number | null;
101
- mobilePhone: string | null;
102
- company: string | null;
103
- dischargeDate: Date | null;
104
- leavingDate: Date | null;
105
- identificacion_tributaria: string | null;
106
- deregistrationDate: Date | null;
107
- authorizationCode: string | null;
108
- authorizationCodeExpiration: Date | null;
109
- } | null>;
110
- getDiagnosticaHistory: (patient: {
111
- identificationType: "ndi" | "passport" | "credential";
112
- identificationValue: string;
113
- gender: "m" | "f";
114
- }, from: Date, to: Date) => Promise<{
115
- date: Date;
116
- location: string;
117
- exams: string[];
118
- deepLink: string;
119
- }[]>;
120
- getDiagnosticaDeepLink: (kiosk: string, user: {
121
- firstName: string;
122
- lastName: string;
123
- identificationType: "dni";
124
- identificationValue: string;
125
- gender: "m" | "f";
126
- phone: string;
127
- email: string;
128
- language: string;
129
- birthday: Date;
130
- }, patient: {
131
- firstName: string;
132
- lastName: string;
133
- identificationType: "dni";
134
- identificationValue: string;
135
- gender: "m" | "f";
136
- birthday: Date;
137
- }) => Promise<{
138
- forwardingRequired: true;
139
- deepLink: string;
140
- } | {
141
- forwardingRequired: false;
142
- }>;
143
- getDiagnosticaAccess: (kiosk: string, user: {
144
- firstName: string;
145
- lastName: string;
146
- identificationType: "dni";
147
- identificationValue: string;
148
- gender: "m" | "f";
149
- phone: string;
150
- email: string;
151
- language: string;
152
- birthday: Date;
153
- }, patient: {
154
- firstName: string;
155
- lastName: string;
156
- identificationType: "dni";
157
- identificationValue: string;
158
- gender: "m" | "f";
159
- birthday: Date;
160
- }) => Promise<void>;
161
- }>;