@integraciones_doc24/sdk 0.35.1 → 0.37.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 (251) hide show
  1. package/lib/baseSdk/diagnostica.d.ts +1 -1
  2. package/lib/baseSdk/external.d.ts +206 -0
  3. package/lib/baseSdk/external.js +153 -0
  4. package/lib/baseSdk/user.d.ts +1 -1
  5. package/lib/index.d.ts +3 -3
  6. package/lib/schemas.d.ts +16 -10
  7. package/lib/schemas.js +2 -1
  8. package/lib/userSdk/patients.d.ts +1 -1
  9. package/lib/userSdk/sarasas.d.ts +6 -0
  10. package/lib/userSdk/sarasas.js +13 -0
  11. package/lib/userSdk/videoVisit.d.ts +2 -0
  12. package/lib/userSdk/videoVisit.js +1 -0
  13. package/lib/utils.d.ts +1 -1
  14. package/lib/utils.js +2 -0
  15. package/package.json +1 -1
  16. package/lib/lib/baseSdk/diagnostica.d.ts +0 -11
  17. package/lib/lib/baseSdk/diagnostica.js +0 -79
  18. package/lib/lib/baseSdk/index.d.ts +0 -161
  19. package/lib/lib/baseSdk/index.js +0 -66
  20. package/lib/lib/baseSdk/user.d.ts +0 -41
  21. package/lib/lib/baseSdk/user.js +0 -130
  22. package/lib/lib/index.d.ts +0 -182
  23. package/lib/lib/index.js +0 -22
  24. package/lib/lib/lib/baseSdk/diagnostica.d.ts +0 -6
  25. package/lib/lib/lib/baseSdk/diagnostica.js +0 -79
  26. package/lib/lib/lib/baseSdk/index.d.ts +0 -51
  27. package/lib/lib/lib/baseSdk/index.js +0 -66
  28. package/lib/lib/lib/baseSdk/user.d.ts +0 -9
  29. package/lib/lib/lib/baseSdk/user.js +0 -130
  30. package/lib/lib/lib/index.d.ts +0 -168
  31. package/lib/lib/lib/index.js +0 -22
  32. package/lib/lib/lib/lib/baseSdk/diagnostica.d.ts +0 -6
  33. package/lib/lib/lib/lib/baseSdk/diagnostica.js +0 -79
  34. package/lib/lib/lib/lib/baseSdk/index.d.ts +0 -14
  35. package/lib/lib/lib/lib/baseSdk/index.js +0 -66
  36. package/lib/lib/lib/lib/baseSdk/user.d.ts +0 -9
  37. package/lib/lib/lib/lib/baseSdk/user.js +0 -130
  38. package/lib/lib/lib/lib/index.d.ts +0 -58
  39. package/lib/lib/lib/lib/index.js +0 -22
  40. package/lib/lib/lib/lib/request/index.d.ts +0 -2
  41. package/lib/lib/lib/lib/request/index.js +0 -26
  42. package/lib/lib/lib/lib/request/token.d.ts +0 -2
  43. package/lib/lib/lib/lib/request/token.js +0 -34
  44. package/lib/lib/lib/lib/request/validation.d.ts +0 -10
  45. package/lib/lib/lib/lib/request/validation.js +0 -28
  46. package/lib/lib/lib/lib/schemas.d.ts +0 -1334
  47. package/lib/lib/lib/lib/schemas.js +0 -325
  48. package/lib/lib/lib/lib/test.d.ts +0 -1
  49. package/lib/lib/lib/lib/test.js +0 -55
  50. package/lib/lib/lib/lib/types.d.ts +0 -1
  51. package/lib/lib/lib/lib/types.js +0 -2
  52. package/lib/lib/lib/lib/userSdk/chat.d.ts +0 -9
  53. package/lib/lib/lib/lib/userSdk/chat.js +0 -98
  54. package/lib/lib/lib/lib/userSdk/index.d.ts +0 -24
  55. package/lib/lib/lib/lib/userSdk/index.js +0 -27
  56. package/lib/lib/lib/lib/userSdk/patients.d.ts +0 -5
  57. package/lib/lib/lib/lib/userSdk/patients.js +0 -55
  58. package/lib/lib/lib/lib/userSdk/schedule.d.ts +0 -7
  59. package/lib/lib/lib/lib/userSdk/schedule.js +0 -76
  60. package/lib/lib/lib/lib/userSdk/specialties.d.ts +0 -4
  61. package/lib/lib/lib/lib/userSdk/specialties.js +0 -19
  62. package/lib/lib/lib/lib/userSdk/videoVisit.d.ts +0 -10
  63. package/lib/lib/lib/lib/userSdk/videoVisit.js +0 -147
  64. package/lib/lib/lib/lib/utils.d.ts +0 -4
  65. package/lib/lib/lib/lib/utils.js +0 -19
  66. package/lib/lib/lib/lib/webhook/index.d.ts +0 -8
  67. package/lib/lib/lib/lib/webhook/index.js +0 -55
  68. package/lib/lib/lib/lib/webhook/responses.d.ts +0 -36
  69. package/lib/lib/lib/lib/webhook/responses.js +0 -42
  70. package/lib/lib/lib/lib/webhook/token.d.ts +0 -2
  71. package/lib/lib/lib/lib/webhook/token.js +0 -23
  72. package/lib/lib/lib/request/index.d.ts +0 -2
  73. package/lib/lib/lib/request/index.js +0 -26
  74. package/lib/lib/lib/request/token.d.ts +0 -2
  75. package/lib/lib/lib/request/token.js +0 -34
  76. package/lib/lib/lib/request/validation.d.ts +0 -10
  77. package/lib/lib/lib/request/validation.js +0 -28
  78. package/lib/lib/lib/schemas.d.ts +0 -1334
  79. package/lib/lib/lib/schemas.js +0 -325
  80. package/lib/lib/lib/src/baseSdk/diagnostica.d.ts +0 -6
  81. package/lib/lib/lib/src/baseSdk/diagnostica.js +0 -79
  82. package/lib/lib/lib/src/baseSdk/index.d.ts +0 -51
  83. package/lib/lib/lib/src/baseSdk/index.js +0 -66
  84. package/lib/lib/lib/src/baseSdk/user.d.ts +0 -9
  85. package/lib/lib/lib/src/baseSdk/user.js +0 -130
  86. package/lib/lib/lib/src/index.d.ts +0 -169
  87. package/lib/lib/lib/src/index.js +0 -22
  88. package/lib/lib/lib/src/request/index.d.ts +0 -2
  89. package/lib/lib/lib/src/request/index.js +0 -26
  90. package/lib/lib/lib/src/request/token.d.ts +0 -2
  91. package/lib/lib/lib/src/request/token.js +0 -34
  92. package/lib/lib/lib/src/request/validation.d.ts +0 -10
  93. package/lib/lib/lib/src/request/validation.js +0 -28
  94. package/lib/lib/lib/src/schemas.d.ts +0 -1340
  95. package/lib/lib/lib/src/schemas.js +0 -325
  96. package/lib/lib/lib/src/types.d.ts +0 -1
  97. package/lib/lib/lib/src/types.js +0 -2
  98. package/lib/lib/lib/src/userSdk/chat.d.ts +0 -9
  99. package/lib/lib/lib/src/userSdk/chat.js +0 -98
  100. package/lib/lib/lib/src/userSdk/index.d.ts +0 -102
  101. package/lib/lib/lib/src/userSdk/index.js +0 -27
  102. package/lib/lib/lib/src/userSdk/patients.d.ts +0 -5
  103. package/lib/lib/lib/src/userSdk/patients.js +0 -55
  104. package/lib/lib/lib/src/userSdk/schedule.d.ts +0 -7
  105. package/lib/lib/lib/src/userSdk/schedule.js +0 -76
  106. package/lib/lib/lib/src/userSdk/specialties.d.ts +0 -4
  107. package/lib/lib/lib/src/userSdk/specialties.js +0 -19
  108. package/lib/lib/lib/src/userSdk/videoVisit.d.ts +0 -10
  109. package/lib/lib/lib/src/userSdk/videoVisit.js +0 -147
  110. package/lib/lib/lib/src/utils.d.ts +0 -4
  111. package/lib/lib/lib/src/utils.js +0 -19
  112. package/lib/lib/lib/src/webhook/index.d.ts +0 -8
  113. package/lib/lib/lib/src/webhook/index.js +0 -55
  114. package/lib/lib/lib/src/webhook/responses.d.ts +0 -36
  115. package/lib/lib/lib/src/webhook/responses.js +0 -42
  116. package/lib/lib/lib/src/webhook/token.d.ts +0 -2
  117. package/lib/lib/lib/src/webhook/token.js +0 -23
  118. package/lib/lib/lib/test.d.ts +0 -1
  119. package/lib/lib/lib/test.js +0 -55
  120. package/lib/lib/lib/types.d.ts +0 -1
  121. package/lib/lib/lib/types.js +0 -2
  122. package/lib/lib/lib/userSdk/chat.d.ts +0 -9
  123. package/lib/lib/lib/userSdk/chat.js +0 -98
  124. package/lib/lib/lib/userSdk/index.d.ts +0 -102
  125. package/lib/lib/lib/userSdk/index.js +0 -27
  126. package/lib/lib/lib/userSdk/patients.d.ts +0 -5
  127. package/lib/lib/lib/userSdk/patients.js +0 -55
  128. package/lib/lib/lib/userSdk/schedule.d.ts +0 -7
  129. package/lib/lib/lib/userSdk/schedule.js +0 -76
  130. package/lib/lib/lib/userSdk/specialties.d.ts +0 -4
  131. package/lib/lib/lib/userSdk/specialties.js +0 -19
  132. package/lib/lib/lib/userSdk/videoVisit.d.ts +0 -10
  133. package/lib/lib/lib/userSdk/videoVisit.js +0 -147
  134. package/lib/lib/lib/utils.d.ts +0 -4
  135. package/lib/lib/lib/utils.js +0 -19
  136. package/lib/lib/lib/webhook/index.d.ts +0 -8
  137. package/lib/lib/lib/webhook/index.js +0 -55
  138. package/lib/lib/lib/webhook/responses.d.ts +0 -36
  139. package/lib/lib/lib/webhook/responses.js +0 -42
  140. package/lib/lib/lib/webhook/token.d.ts +0 -2
  141. package/lib/lib/lib/webhook/token.js +0 -23
  142. package/lib/lib/request/index.d.ts +0 -2
  143. package/lib/lib/request/index.js +0 -26
  144. package/lib/lib/request/token.d.ts +0 -2
  145. package/lib/lib/request/token.js +0 -34
  146. package/lib/lib/request/validation.d.ts +0 -10
  147. package/lib/lib/request/validation.js +0 -28
  148. package/lib/lib/schemas.d.ts +0 -1334
  149. package/lib/lib/schemas.js +0 -325
  150. package/lib/lib/src/baseSdk/diagnostica.d.ts +0 -11
  151. package/lib/lib/src/baseSdk/diagnostica.js +0 -79
  152. package/lib/lib/src/baseSdk/index.d.ts +0 -162
  153. package/lib/lib/src/baseSdk/index.js +0 -66
  154. package/lib/lib/src/baseSdk/user.d.ts +0 -41
  155. package/lib/lib/src/baseSdk/user.js +0 -130
  156. package/lib/lib/src/index.d.ts +0 -183
  157. package/lib/lib/src/index.js +0 -22
  158. package/lib/lib/src/request/index.d.ts +0 -2
  159. package/lib/lib/src/request/index.js +0 -26
  160. package/lib/lib/src/request/token.d.ts +0 -2
  161. package/lib/lib/src/request/token.js +0 -34
  162. package/lib/lib/src/request/validation.d.ts +0 -10
  163. package/lib/lib/src/request/validation.js +0 -28
  164. package/lib/lib/src/schemas.d.ts +0 -1340
  165. package/lib/lib/src/schemas.js +0 -325
  166. package/lib/lib/src/types.d.ts +0 -1
  167. package/lib/lib/src/types.js +0 -2
  168. package/lib/lib/src/userSdk/chat.d.ts +0 -9
  169. package/lib/lib/src/userSdk/chat.js +0 -98
  170. package/lib/lib/src/userSdk/index.d.ts +0 -241
  171. package/lib/lib/src/userSdk/index.js +0 -27
  172. package/lib/lib/src/userSdk/patients.d.ts +0 -13
  173. package/lib/lib/src/userSdk/patients.js +0 -55
  174. package/lib/lib/src/userSdk/schedule.d.ts +0 -15
  175. package/lib/lib/src/userSdk/schedule.js +0 -76
  176. package/lib/lib/src/userSdk/specialties.d.ts +0 -4
  177. package/lib/lib/src/userSdk/specialties.js +0 -19
  178. package/lib/lib/src/userSdk/videoVisit.d.ts +0 -72
  179. package/lib/lib/src/userSdk/videoVisit.js +0 -147
  180. package/lib/lib/src/utils.d.ts +0 -4
  181. package/lib/lib/src/utils.js +0 -19
  182. package/lib/lib/src/webhook/index.d.ts +0 -8
  183. package/lib/lib/src/webhook/index.js +0 -55
  184. package/lib/lib/src/webhook/responses.d.ts +0 -36
  185. package/lib/lib/src/webhook/responses.js +0 -42
  186. package/lib/lib/src/webhook/token.d.ts +0 -2
  187. package/lib/lib/src/webhook/token.js +0 -23
  188. package/lib/lib/test.d.ts +0 -1
  189. package/lib/lib/test.js +0 -55
  190. package/lib/lib/types.d.ts +0 -1
  191. package/lib/lib/types.js +0 -2
  192. package/lib/lib/userSdk/chat.d.ts +0 -9
  193. package/lib/lib/userSdk/chat.js +0 -98
  194. package/lib/lib/userSdk/index.d.ts +0 -240
  195. package/lib/lib/userSdk/index.js +0 -27
  196. package/lib/lib/userSdk/patients.d.ts +0 -13
  197. package/lib/lib/userSdk/patients.js +0 -55
  198. package/lib/lib/userSdk/schedule.d.ts +0 -15
  199. package/lib/lib/userSdk/schedule.js +0 -76
  200. package/lib/lib/userSdk/specialties.d.ts +0 -4
  201. package/lib/lib/userSdk/specialties.js +0 -19
  202. package/lib/lib/userSdk/videoVisit.d.ts +0 -72
  203. package/lib/lib/userSdk/videoVisit.js +0 -147
  204. package/lib/lib/utils.d.ts +0 -4
  205. package/lib/lib/utils.js +0 -19
  206. package/lib/lib/webhook/index.d.ts +0 -8
  207. package/lib/lib/webhook/index.js +0 -55
  208. package/lib/lib/webhook/responses.d.ts +0 -36
  209. package/lib/lib/webhook/responses.js +0 -42
  210. package/lib/lib/webhook/token.d.ts +0 -2
  211. package/lib/lib/webhook/token.js +0 -23
  212. package/lib/src/baseSdk/diagnostica.d.ts +0 -54
  213. package/lib/src/baseSdk/diagnostica.js +0 -79
  214. package/lib/src/baseSdk/index.d.ts +0 -2
  215. package/lib/src/baseSdk/index.js +0 -66
  216. package/lib/src/baseSdk/user.d.ts +0 -89
  217. package/lib/src/baseSdk/user.js +0 -130
  218. package/lib/src/index.d.ts +0 -188
  219. package/lib/src/index.js +0 -22
  220. package/lib/src/request/index.d.ts +0 -3
  221. package/lib/src/request/index.js +0 -26
  222. package/lib/src/request/token.d.ts +0 -2
  223. package/lib/src/request/token.js +0 -34
  224. package/lib/src/request/validation.d.ts +0 -10
  225. package/lib/src/request/validation.js +0 -28
  226. package/lib/src/schemas.d.ts +0 -1311
  227. package/lib/src/schemas.js +0 -325
  228. package/lib/src/types.d.ts +0 -124
  229. package/lib/src/types.js +0 -2
  230. package/lib/src/userSdk/chat.d.ts +0 -57
  231. package/lib/src/userSdk/chat.js +0 -98
  232. package/lib/src/userSdk/index.d.ts +0 -2
  233. package/lib/src/userSdk/index.js +0 -27
  234. package/lib/src/userSdk/patients.d.ts +0 -33
  235. package/lib/src/userSdk/patients.js +0 -55
  236. package/lib/src/userSdk/schedule.d.ts +0 -44
  237. package/lib/src/userSdk/schedule.js +0 -76
  238. package/lib/src/userSdk/specialties.d.ts +0 -7
  239. package/lib/src/userSdk/specialties.js +0 -19
  240. package/lib/src/userSdk/videoVisit.d.ts +0 -111
  241. package/lib/src/userSdk/videoVisit.js +0 -147
  242. package/lib/src/utils.d.ts +0 -4
  243. package/lib/src/utils.js +0 -19
  244. package/lib/src/webhook/index.d.ts +0 -2
  245. package/lib/src/webhook/index.js +0 -55
  246. package/lib/src/webhook/responses.d.ts +0 -35
  247. package/lib/src/webhook/responses.js +0 -42
  248. package/lib/src/webhook/token.d.ts +0 -2
  249. package/lib/src/webhook/token.js +0 -23
  250. package/lib/test.d.ts +0 -1
  251. package/lib/test.js +0 -21
@@ -1,7 +1,7 @@
1
1
  import { RequestMaker } from '../request';
2
2
  export declare const getDiagnosticaMethods: (makeRequest: RequestMaker) => {
3
3
  getDiagnosticaHistory: (patient: {
4
- identificationType: "ndi" | "passport" | "credential";
4
+ identificationType: "dni" | "ndi" | "passport" | "credential";
5
5
  identificationValue: string;
6
6
  gender: "m" | "f";
7
7
  }, from: Date, to: Date) => Promise<{
@@ -0,0 +1,206 @@
1
+ import { RequestMaker } from '../request';
2
+ export declare const getExternalMethods: (makeRequest: RequestMaker) => {
3
+ externalLogin: (params: {
4
+ user: string;
5
+ password: string;
6
+ }) => Promise<{
7
+ firstName: string;
8
+ lastName: string;
9
+ countryId: string;
10
+ gender: "m" | "f";
11
+ phone: string;
12
+ email: string;
13
+ birthday: Date;
14
+ identificationNumber: string;
15
+ }>;
16
+ preExternalEnrollment: (params: ({
17
+ birthdate: Date;
18
+ identificationNumber: string;
19
+ } & {
20
+ phone: string;
21
+ email: string;
22
+ }) | ({
23
+ birthdate: Date;
24
+ identificationNumber: string;
25
+ } & {
26
+ phone?: undefined;
27
+ email: string;
28
+ }) | ({
29
+ birthdate: Date;
30
+ identificationNumber: string;
31
+ } & {
32
+ email?: undefined;
33
+ phone: string;
34
+ })) => Promise<void>;
35
+ externalEnrollment: (params: ({
36
+ birthdate: Date;
37
+ identificationNumber: string;
38
+ } & {
39
+ phone: string;
40
+ email: string;
41
+ } & {
42
+ password: string;
43
+ } & {
44
+ emailCode: string;
45
+ phoneCode: string;
46
+ }) | ({
47
+ birthdate: Date;
48
+ identificationNumber: string;
49
+ } & {
50
+ phone: string;
51
+ email: string;
52
+ } & {
53
+ password: string;
54
+ } & {
55
+ phoneCode?: undefined;
56
+ emailCode: string;
57
+ }) | ({
58
+ birthdate: Date;
59
+ identificationNumber: string;
60
+ } & {
61
+ phone: string;
62
+ email: string;
63
+ } & {
64
+ password: string;
65
+ } & {
66
+ emailCode?: undefined;
67
+ phoneCode: string;
68
+ }) | ({
69
+ birthdate: Date;
70
+ identificationNumber: string;
71
+ } & {
72
+ phone?: undefined;
73
+ email: string;
74
+ } & {
75
+ password: string;
76
+ } & {
77
+ emailCode: string;
78
+ phoneCode: string;
79
+ }) | ({
80
+ birthdate: Date;
81
+ identificationNumber: string;
82
+ } & {
83
+ phone?: undefined;
84
+ email: string;
85
+ } & {
86
+ password: string;
87
+ } & {
88
+ phoneCode?: undefined;
89
+ emailCode: string;
90
+ }) | ({
91
+ birthdate: Date;
92
+ identificationNumber: string;
93
+ } & {
94
+ phone?: undefined;
95
+ email: string;
96
+ } & {
97
+ password: string;
98
+ } & {
99
+ emailCode?: undefined;
100
+ phoneCode: string;
101
+ }) | ({
102
+ birthdate: Date;
103
+ identificationNumber: string;
104
+ } & {
105
+ email?: undefined;
106
+ phone: string;
107
+ } & {
108
+ password: string;
109
+ } & {
110
+ emailCode: string;
111
+ phoneCode: string;
112
+ }) | ({
113
+ birthdate: Date;
114
+ identificationNumber: string;
115
+ } & {
116
+ email?: undefined;
117
+ phone: string;
118
+ } & {
119
+ password: string;
120
+ } & {
121
+ phoneCode?: undefined;
122
+ emailCode: string;
123
+ }) | ({
124
+ birthdate: Date;
125
+ identificationNumber: string;
126
+ } & {
127
+ email?: undefined;
128
+ phone: string;
129
+ } & {
130
+ password: string;
131
+ } & {
132
+ emailCode?: undefined;
133
+ phoneCode: string;
134
+ })) => Promise<{
135
+ firstName: string;
136
+ lastName: string;
137
+ countryId: string;
138
+ gender: "m" | "f";
139
+ phone: string;
140
+ email: string;
141
+ birthday: Date;
142
+ identificationNumber: string;
143
+ }>;
144
+ sendExternalVerificationCode: (params: {
145
+ birthdate: Date;
146
+ channel: "1" | "2";
147
+ identificationNumber: string;
148
+ }) => Promise<void>;
149
+ verifyExternalVerificationCode: (params: {
150
+ code: string;
151
+ birthdate: Date;
152
+ channel: "1" | "2";
153
+ identificationNumber: string;
154
+ }) => Promise<any>;
155
+ externalResetPassword: (params: ({
156
+ birthdate: Date;
157
+ password: string;
158
+ identificationNumber: string;
159
+ } & {
160
+ emailCode: string;
161
+ phoneCode: string;
162
+ }) | ({
163
+ birthdate: Date;
164
+ password: string;
165
+ identificationNumber: string;
166
+ } & {
167
+ phoneCode?: undefined;
168
+ emailCode: string;
169
+ }) | ({
170
+ birthdate: Date;
171
+ password: string;
172
+ identificationNumber: string;
173
+ } & {
174
+ emailCode?: undefined;
175
+ phoneCode: string;
176
+ })) => Promise<any>;
177
+ getExternalStudiesHistoryLink: (patient: {
178
+ identificationType: "DNI";
179
+ identificationValue: string;
180
+ birthdate: Date;
181
+ gender: "m" | "f";
182
+ }) => Promise<string | null>;
183
+ getExternalAppointmentsLink: (identificationValue: string, birthdate: Date) => Promise<string | null>;
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>;
206
+ };
@@ -0,0 +1,153 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getExternalMethods = void 0;
4
+ const date_fns_1 = require("date-fns");
5
+ const zod_1 = require("zod");
6
+ const validation_1 = require("../request/validation");
7
+ const schemas_1 = require("../schemas");
8
+ const utils_1 = require("../utils");
9
+ const getExternalMethods = (makeRequest) => {
10
+ const externalLogin = async ({ user, password, }) => {
11
+ const path = '/external-login';
12
+ const response = await makeRequest('POST', path, { user, password });
13
+ const info = response.data.login_info;
14
+ return {
15
+ firstName: info.firstname,
16
+ lastName: info.lastname,
17
+ countryId: info.country_id,
18
+ birthday: new Date(Date.parse(info.birthdate)),
19
+ identificationNumber: info.identification_number,
20
+ gender: info.gender.toLowerCase(),
21
+ email: info.email,
22
+ phone: info.telephone,
23
+ };
24
+ };
25
+ const preExternalEnrollment = async (params) => {
26
+ const path = '/pre-external-enrollment';
27
+ await makeRequest('POST', path, {
28
+ identification_number: params.identificationNumber,
29
+ birthdate: date_fns_1.format(params.birthdate, 'yyyy-MM-dd'),
30
+ email: params.email,
31
+ telephone: params.phone,
32
+ });
33
+ return;
34
+ };
35
+ const externalEnrollment = async (params) => {
36
+ const path = '/external-enrollment';
37
+ const response = await makeRequest('POST', path, {
38
+ identification_number: params.identificationNumber,
39
+ birthdate: date_fns_1.format(params.birthdate, 'yyyy-MM-dd'),
40
+ email: params.email,
41
+ telephone: params.phone,
42
+ password: params.password,
43
+ email_code: params.emailCode,
44
+ telephone_code: params.phoneCode,
45
+ });
46
+ const info = response.data.info;
47
+ return {
48
+ firstName: info.firstname,
49
+ lastName: info.lastname,
50
+ countryId: info.country_id,
51
+ birthday: new Date(Date.parse(info.birthdate)),
52
+ identificationNumber: info.identification_number,
53
+ gender: info.gender.toLowerCase(),
54
+ email: info.email,
55
+ phone: info.telephone,
56
+ };
57
+ };
58
+ const sendExternalVerificationCode = async (params) => {
59
+ const path = '/send-external-verification-code';
60
+ await makeRequest('POST', path, {
61
+ identification_number: params.identificationNumber,
62
+ birthdate: date_fns_1.format(params.birthdate, 'yyyy-MM-dd'),
63
+ channel: params.channel,
64
+ });
65
+ return;
66
+ };
67
+ const verifyExternalVerificationCode = async (params) => {
68
+ const path = '/verify-external-verification-code';
69
+ const response = await makeRequest('POST', path, {
70
+ identification_number: params.identificationNumber,
71
+ birthdate: date_fns_1.format(params.birthdate, 'yyyy-MM-dd'),
72
+ channel: params.channel,
73
+ code: params.code,
74
+ });
75
+ return response.data;
76
+ };
77
+ const externalResetPassword = async (params) => {
78
+ const path = '/external-reset';
79
+ const response = await makeRequest('POST', path, {
80
+ identification_number: params.identificationNumber,
81
+ birthdate: date_fns_1.format(params.birthdate, 'yyyy-MM-dd'),
82
+ password: params.password,
83
+ email_code: params.emailCode,
84
+ telephone_code: params.phoneCode,
85
+ });
86
+ return response.data;
87
+ };
88
+ const getExternalStudiesHistoryLink = async (patient) => {
89
+ var _a, _b;
90
+ const path = '/history-external-studies';
91
+ const response = await makeRequest('POST', path, {
92
+ patient: mapPatientData(patient),
93
+ });
94
+ return (_b = (_a = response.data.info) === null || _a === void 0 ? void 0 : _a.link) !== null && _b !== void 0 ? _b : null;
95
+ };
96
+ const getExternalAppointmentsLink = async (identificationValue, birthdate) => {
97
+ const path = `/external-appointments-link/${identificationValue}/${date_fns_1.format(birthdate, 'yyyy-MM-dd')}`;
98
+ const response = await makeRequest('GET', path);
99
+ return response.data.link;
100
+ };
101
+ const getExternalAppointments = async () => {
102
+ const path = '/external-appointments';
103
+ const response = await makeRequest('GET', path);
104
+ return response.data.appointments.map((a) => ({
105
+ id: a.appointment_id,
106
+ patientName: a.patient_name,
107
+ birthdate: utils_1.parseDate(a.birthdate),
108
+ appointment: a.appointment,
109
+ clinic: a.clinic,
110
+ professionalName: a.professional,
111
+ date: utils_1.parseDateTime(`${a.day} ${a.hour}:00`),
112
+ specialty: a.specialty,
113
+ modality: a.modality,
114
+ }));
115
+ };
116
+ const cancelExternalAppointment = async (appointment) => {
117
+ const path = `/cancel-external-appointment`;
118
+ await makeRequest('POST', path, {
119
+ appointment_id: appointment.id,
120
+ patient_name: appointment.patientName,
121
+ birthdate: date_fns_1.format(appointment.birthdate, 'yyyy-MM-dd'),
122
+ appointment: appointment.appointment,
123
+ clinic: appointment.clinic,
124
+ professional: appointment.professionalName,
125
+ day: date_fns_1.format(appointment.date, 'yyyy-MM-dd'),
126
+ hour: date_fns_1.format(appointment.date, 'HH:mm'),
127
+ specialty: appointment.specialty,
128
+ modality: appointment.modality,
129
+ });
130
+ return;
131
+ };
132
+ return {
133
+ externalLogin: validation_1.validateFunction(zod_1.tuple([schemas_1.doc24Schemas.externalLoginParams]), schemas_1.doc24Schemas.externalLoginResponse, externalLogin),
134
+ preExternalEnrollment: validation_1.validateFunction(zod_1.tuple([schemas_1.doc24Schemas.preExternalEnrollmentParams]), zod_1.void(), preExternalEnrollment),
135
+ externalEnrollment: validation_1.validateFunction(zod_1.tuple([schemas_1.doc24Schemas.externalEnrollmentParams]), schemas_1.doc24Schemas.externalLoginResponse, externalEnrollment),
136
+ sendExternalVerificationCode: validation_1.validateFunction(zod_1.tuple([schemas_1.doc24Schemas.sendExternalVerificationCodeParams]), zod_1.void(), sendExternalVerificationCode),
137
+ verifyExternalVerificationCode: validation_1.validateFunction(zod_1.tuple([schemas_1.doc24Schemas.verifyExternalVerificationCodeParams]), zod_1.any(), verifyExternalVerificationCode),
138
+ externalResetPassword: validation_1.validateFunction(zod_1.tuple([schemas_1.doc24Schemas.externalResetPasswordParams]), zod_1.any(), externalResetPassword),
139
+ getExternalStudiesHistoryLink: validation_1.validateFunction(zod_1.tuple([schemas_1.doc24Schemas.externalPatient]), zod_1.string().nullable(), getExternalStudiesHistoryLink),
140
+ getExternalAppointmentsLink: validation_1.validateFunction(zod_1.tuple([zod_1.string(), zod_1.date()]), zod_1.string().nullable(), getExternalAppointmentsLink),
141
+ getExternalAppointments: validation_1.validateFunction(zod_1.tuple([]), zod_1.array(schemas_1.doc24Schemas.externalAppointment), getExternalAppointments),
142
+ cancelExternalAppointment: validation_1.validateFunction(zod_1.tuple([schemas_1.doc24Schemas.externalAppointment]), zod_1.void(), cancelExternalAppointment),
143
+ };
144
+ };
145
+ exports.getExternalMethods = getExternalMethods;
146
+ const mapPatientData = (patient) => {
147
+ return {
148
+ birthdate: date_fns_1.format(patient.birthdate, 'yyyy-MM-dd'),
149
+ id_type: 'dni',
150
+ id_value: patient.identificationValue,
151
+ gender: patient.gender.toLocaleUpperCase(),
152
+ };
153
+ };
@@ -4,7 +4,7 @@ export declare const getUserMethods: (makeRequest: RequestMaker, url: string, cr
4
4
  declareUser: (user: {
5
5
  firstName: string;
6
6
  lastName: string;
7
- identificationType: "ndi" | "passport" | "credential";
7
+ identificationType: "dni" | "ndi" | "passport" | "credential";
8
8
  identificationValue: string;
9
9
  gender: "m" | "f";
10
10
  phone: string;
package/lib/index.d.ts CHANGED
@@ -8,7 +8,7 @@ export declare const doc24Sdk: (params: Doc24.SdkParams) => Promise<{
8
8
  declareUser: (user: {
9
9
  firstName: string;
10
10
  lastName: string;
11
- identificationType: "ndi" | "passport" | "credential";
11
+ identificationType: "dni" | "ndi" | "passport" | "credential";
12
12
  identificationValue: string;
13
13
  gender: "m" | "f";
14
14
  phone: string;
@@ -19,7 +19,7 @@ export declare const doc24Sdk: (params: Doc24.SdkParams) => Promise<{
19
19
  getUserInstance: (user: number | {
20
20
  firstName: string;
21
21
  lastName: string;
22
- identificationType: "ndi" | "passport" | "credential";
22
+ identificationType: "dni" | "ndi" | "passport" | "credential";
23
23
  identificationValue: string;
24
24
  gender: "m" | "f";
25
25
  phone: string;
@@ -105,7 +105,7 @@ export declare const doc24Sdk: (params: Doc24.SdkParams) => Promise<{
105
105
  authorizationCodeExpiration: Date | null;
106
106
  } | null>;
107
107
  getDiagnosticaHistory: (patient: {
108
- identificationType: "ndi" | "passport" | "credential";
108
+ identificationType: "dni" | "ndi" | "passport" | "credential";
109
109
  identificationValue: string;
110
110
  gender: "m" | "f";
111
111
  }, from: Date, to: Date) => Promise<{
package/lib/schemas.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  export declare const doc24Schemas: {
2
- identificationType: import("zod").ZodEnum<["ndi", "passport", "credential"]>;
2
+ identificationType: import("zod").ZodEnum<["dni", "ndi", "passport", "credential"]>;
3
3
  sdkCredentials: import("zod").ZodObject<{
4
4
  iss: import("zod").ZodString;
5
5
  key: import("zod").ZodString;
@@ -38,7 +38,7 @@ export declare const doc24Schemas: {
38
38
  user: import("zod").ZodObject<import("zod").extendShape<{
39
39
  firstName: import("zod").ZodString;
40
40
  lastName: import("zod").ZodString;
41
- identificationType: import("zod").ZodEnum<["ndi", "passport", "credential"]>;
41
+ identificationType: import("zod").ZodEnum<["dni", "ndi", "passport", "credential"]>;
42
42
  identificationValue: import("zod").ZodString;
43
43
  countryId: import("zod").ZodString;
44
44
  birthdate: import("zod").ZodDate;
@@ -49,7 +49,7 @@ export declare const doc24Schemas: {
49
49
  }>, "strip", import("zod").ZodTypeAny, {
50
50
  firstName: string;
51
51
  lastName: string;
52
- identificationType: "ndi" | "passport" | "credential";
52
+ identificationType: "dni" | "ndi" | "passport" | "credential";
53
53
  identificationValue: string;
54
54
  gender: "m" | "f";
55
55
  phone: string;
@@ -59,7 +59,7 @@ export declare const doc24Schemas: {
59
59
  }, {
60
60
  firstName: string;
61
61
  lastName: string;
62
- identificationType: "ndi" | "passport" | "credential";
62
+ identificationType: "dni" | "ndi" | "passport" | "credential";
63
63
  identificationValue: string;
64
64
  gender: "m" | "f";
65
65
  phone: string;
@@ -70,7 +70,7 @@ export declare const doc24Schemas: {
70
70
  patient: import("zod").ZodObject<{
71
71
  firstName: import("zod").ZodString;
72
72
  lastName: import("zod").ZodString;
73
- identificationType: import("zod").ZodEnum<["ndi", "passport", "credential"]>;
73
+ identificationType: import("zod").ZodEnum<["dni", "ndi", "passport", "credential"]>;
74
74
  identificationValue: import("zod").ZodString;
75
75
  countryId: import("zod").ZodString;
76
76
  birthdate: import("zod").ZodDate;
@@ -78,7 +78,7 @@ export declare const doc24Schemas: {
78
78
  }, "strip", import("zod").ZodTypeAny, {
79
79
  firstName: string;
80
80
  lastName: string;
81
- identificationType: "ndi" | "passport" | "credential";
81
+ identificationType: "dni" | "ndi" | "passport" | "credential";
82
82
  identificationValue: string;
83
83
  gender: "m" | "f";
84
84
  countryId: string;
@@ -86,7 +86,7 @@ export declare const doc24Schemas: {
86
86
  }, {
87
87
  firstName: string;
88
88
  lastName: string;
89
- identificationType: "ndi" | "passport" | "credential";
89
+ identificationType: "dni" | "ndi" | "passport" | "credential";
90
90
  identificationValue: string;
91
91
  gender: "m" | "f";
92
92
  countryId: string;
@@ -302,11 +302,13 @@ export declare const doc24Schemas: {
302
302
  language: import("zod").ZodString;
303
303
  details: import("zod").ZodString;
304
304
  extraInfo: import("zod").ZodAny;
305
+ origin: import("zod").ZodOptional<import("zod").ZodString>;
305
306
  }, {
306
307
  type: import("zod").ZodLiteral<"appointment">;
307
308
  appointmentId: import("zod").ZodUnion<[import("zod").ZodNumber, import("zod").ZodString]>;
308
309
  }>, "strip", import("zod").ZodTypeAny, {
309
310
  extraInfo?: any;
311
+ origin?: string | undefined;
310
312
  type: "appointment";
311
313
  patientId: number;
312
314
  specialtyId: number;
@@ -315,6 +317,7 @@ export declare const doc24Schemas: {
315
317
  appointmentId: string | number;
316
318
  }, {
317
319
  extraInfo?: any;
320
+ origin?: string | undefined;
318
321
  type: "appointment";
319
322
  patientId: number;
320
323
  specialtyId: number;
@@ -327,10 +330,12 @@ export declare const doc24Schemas: {
327
330
  language: import("zod").ZodString;
328
331
  details: import("zod").ZodString;
329
332
  extraInfo: import("zod").ZodAny;
333
+ origin: import("zod").ZodOptional<import("zod").ZodString>;
330
334
  }, {
331
335
  type: import("zod").ZodLiteral<"instant">;
332
336
  }>, "strip", import("zod").ZodTypeAny, {
333
337
  extraInfo?: any;
338
+ origin?: string | undefined;
334
339
  type: "instant";
335
340
  patientId: number;
336
341
  specialtyId: number;
@@ -338,6 +343,7 @@ export declare const doc24Schemas: {
338
343
  details: string;
339
344
  }, {
340
345
  extraInfo?: any;
346
+ origin?: string | undefined;
341
347
  type: "instant";
342
348
  patientId: number;
343
349
  specialtyId: number;
@@ -945,14 +951,14 @@ export declare const doc24Schemas: {
945
951
  }>;
946
952
  diagnosticaPatientFilter: import("zod").ZodObject<{
947
953
  gender: import("zod").ZodEnum<["m", "f"]>;
948
- identificationType: import("zod").ZodEnum<["ndi", "passport", "credential"]>;
954
+ identificationType: import("zod").ZodEnum<["dni", "ndi", "passport", "credential"]>;
949
955
  identificationValue: import("zod").ZodString;
950
956
  }, "strip", import("zod").ZodTypeAny, {
951
- identificationType: "ndi" | "passport" | "credential";
957
+ identificationType: "dni" | "ndi" | "passport" | "credential";
952
958
  identificationValue: string;
953
959
  gender: "m" | "f";
954
960
  }, {
955
- identificationType: "ndi" | "passport" | "credential";
961
+ identificationType: "dni" | "ndi" | "passport" | "credential";
956
962
  identificationValue: string;
957
963
  gender: "m" | "f";
958
964
  }>;
package/lib/schemas.js CHANGED
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.doc24Schemas = void 0;
4
4
  const zod_1 = require("zod");
5
5
  const gender = zod_1.enum(['m', 'f']);
6
- const identificationType = zod_1.enum(['ndi', 'passport', 'credential']);
6
+ const identificationType = zod_1.enum(['dni', 'ndi', 'passport', 'credential']);
7
7
  const sdkCredentials = zod_1.object({ iss: zod_1.string(), key: zod_1.string() });
8
8
  const basePersonData = zod_1.object({
9
9
  firstName: zod_1.string(),
@@ -60,6 +60,7 @@ const baseScheduleParameters = zod_1.object({
60
60
  language: zod_1.string(),
61
61
  details: zod_1.string(),
62
62
  extraInfo: zod_1.any(),
63
+ origin: zod_1.string().optional(),
63
64
  });
64
65
  const appointmentScheduleParameters = baseScheduleParameters.extend({
65
66
  type: zod_1.literal('appointment'),
@@ -3,7 +3,7 @@ export declare const getPatientMethods: (makeRequest: RequestMaker) => {
3
3
  declarePatient: (patient: {
4
4
  firstName: string;
5
5
  lastName: string;
6
- identificationType: "ndi" | "passport" | "credential";
6
+ identificationType: "dni" | "ndi" | "passport" | "credential";
7
7
  identificationValue: string;
8
8
  gender: "m" | "f";
9
9
  countryId: string;
@@ -0,0 +1,6 @@
1
+ import { RequestMaker } from '../request';
2
+ export declare const getSarasaMethods: (_makeRequest: RequestMaker) => {
3
+ getSarasa: (userId: string) => Promise<{
4
+ id: string;
5
+ }>;
6
+ };
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getSarasaMethods = void 0;
4
+ const zod_1 = require("zod");
5
+ const validation_1 = require("../request/validation");
6
+ const schemas_1 = require("../schemas");
7
+ const getSarasaMethods = (_makeRequest) => {
8
+ const getSarasa = validation_1.validateFunction(zod_1.tuple([zod_1.string()]), schemas_1.doc24Schemas.sarasa, async (userId) => {
9
+ return { id: userId };
10
+ });
11
+ return { getSarasa };
12
+ };
13
+ exports.getSarasaMethods = getSarasaMethods;
@@ -2,6 +2,7 @@ import { RequestMaker } from '../request';
2
2
  export declare const getVideoVisitMethods: (makeRequest: RequestMaker) => {
3
3
  scheduleVideoVisit: (params: {
4
4
  extraInfo?: any;
5
+ origin?: string | undefined;
5
6
  type: "appointment";
6
7
  patientId: number;
7
8
  specialtyId: number;
@@ -10,6 +11,7 @@ export declare const getVideoVisitMethods: (makeRequest: RequestMaker) => {
10
11
  appointmentId: string | number;
11
12
  } | {
12
13
  extraInfo?: any;
14
+ origin?: string | undefined;
13
15
  type: "instant";
14
16
  patientId: number;
15
17
  specialtyId: number;
@@ -20,6 +20,7 @@ const getVideoVisitMethods = (makeRequest) => {
20
20
  language: params.language.toUpperCase(),
21
21
  details: params.details,
22
22
  extra_info: params.extraInfo,
23
+ origin: params.origin,
23
24
  };
24
25
  const response = await makeRequest('POST', '/video-visit', mappedParams);
25
26
  return response.data.vc_token;
package/lib/utils.d.ts CHANGED
@@ -1,4 +1,4 @@
1
1
  import { Doc24 } from '.';
2
2
  export declare const parseDate: (str: string) => Date;
3
3
  export declare const parseDateTime: (str: string) => Date;
4
- export declare const getIndetificationTypeId: (type: Doc24.IdentificationType) => 6 | 5 | 999;
4
+ export declare const getIndetificationTypeId: (type: Doc24.IdentificationType) => 1 | 6 | 5 | 999;
package/lib/utils.js CHANGED
@@ -8,6 +8,8 @@ exports.parseDate = parseDate;
8
8
  const parseDateTime = (str) => date_fns_1.parse(`${str} ${timeZone}`, 'yyyy-MM-dd HH:mm:ss X', new Date());
9
9
  exports.parseDateTime = parseDateTime;
10
10
  const getIndetificationTypeId = (type) => {
11
+ if (type === 'dni')
12
+ return 1;
11
13
  if (type === 'ndi')
12
14
  return 6;
13
15
  if (type === 'passport')
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@integraciones_doc24/sdk",
3
- "version": "0.35.1",
3
+ "version": "0.37.0",
4
4
  "publishConfig": {
5
5
  "tag": "0.x"
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
- };