@integraciones_doc24/sdk 0.35.0 → 0.36.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 (98) hide show
  1. package/lib/baseSdk/diagnostica.d.ts +1 -1
  2. package/lib/baseSdk/index.js +5 -1
  3. package/lib/baseSdk/user.d.ts +1 -1
  4. package/lib/index.d.ts +3 -3
  5. package/lib/schemas.d.ts +10 -10
  6. package/lib/schemas.js +1 -1
  7. package/lib/userSdk/patients.d.ts +1 -1
  8. package/lib/utils.d.ts +1 -1
  9. package/lib/utils.js +2 -0
  10. package/package.json +4 -1
  11. package/lib/baseSdk/external.d.ts +0 -28
  12. package/lib/baseSdk/external.js +0 -73
  13. package/lib/lib/baseSdk/diagnostica.d.ts +0 -11
  14. package/lib/lib/baseSdk/diagnostica.js +0 -79
  15. package/lib/lib/baseSdk/external.d.ts +0 -15
  16. package/lib/lib/baseSdk/external.js +0 -73
  17. package/lib/lib/baseSdk/index.d.ts +0 -114
  18. package/lib/lib/baseSdk/index.js +0 -66
  19. package/lib/lib/baseSdk/user.d.ts +0 -30
  20. package/lib/lib/baseSdk/user.js +0 -88
  21. package/lib/lib/index.d.ts +0 -154
  22. package/lib/lib/index.js +0 -22
  23. package/lib/lib/request/index.d.ts +0 -2
  24. package/lib/lib/request/index.js +0 -26
  25. package/lib/lib/request/token.d.ts +0 -2
  26. package/lib/lib/request/token.js +0 -34
  27. package/lib/lib/request/validation.d.ts +0 -10
  28. package/lib/lib/request/validation.js +0 -28
  29. package/lib/lib/schemas.d.ts +0 -1138
  30. package/lib/lib/schemas.js +0 -294
  31. package/lib/lib/test.d.ts +0 -1
  32. package/lib/lib/test.js +0 -55
  33. package/lib/lib/types.d.ts +0 -1
  34. package/lib/lib/types.js +0 -2
  35. package/lib/lib/userSdk/chat.d.ts +0 -9
  36. package/lib/lib/userSdk/chat.js +0 -98
  37. package/lib/lib/userSdk/index.d.ts +0 -220
  38. package/lib/lib/userSdk/index.js +0 -27
  39. package/lib/lib/userSdk/patients.d.ts +0 -4
  40. package/lib/lib/userSdk/patients.js +0 -27
  41. package/lib/lib/userSdk/sarasas.d.ts +0 -6
  42. package/lib/lib/userSdk/sarasas.js +0 -13
  43. package/lib/lib/userSdk/schedule.d.ts +0 -15
  44. package/lib/lib/userSdk/schedule.js +0 -76
  45. package/lib/lib/userSdk/specialties.d.ts +0 -4
  46. package/lib/lib/userSdk/specialties.js +0 -19
  47. package/lib/lib/userSdk/videoVisit.d.ts +0 -72
  48. package/lib/lib/userSdk/videoVisit.js +0 -147
  49. package/lib/lib/utils.d.ts +0 -4
  50. package/lib/lib/utils.js +0 -19
  51. package/lib/lib/webhook/index.d.ts +0 -8
  52. package/lib/lib/webhook/index.js +0 -55
  53. package/lib/lib/webhook/responses.d.ts +0 -36
  54. package/lib/lib/webhook/responses.js +0 -42
  55. package/lib/lib/webhook/token.d.ts +0 -2
  56. package/lib/lib/webhook/token.js +0 -23
  57. package/lib/src/baseSdk/diagnostica.d.ts +0 -54
  58. package/lib/src/baseSdk/diagnostica.js +0 -79
  59. package/lib/src/baseSdk/index.d.ts +0 -2
  60. package/lib/src/baseSdk/index.js +0 -66
  61. package/lib/src/baseSdk/user.d.ts +0 -41
  62. package/lib/src/baseSdk/user.js +0 -88
  63. package/lib/src/index.d.ts +0 -159
  64. package/lib/src/index.js +0 -22
  65. package/lib/src/request/index.d.ts +0 -3
  66. package/lib/src/request/index.js +0 -26
  67. package/lib/src/request/token.d.ts +0 -2
  68. package/lib/src/request/token.js +0 -34
  69. package/lib/src/request/validation.d.ts +0 -10
  70. package/lib/src/request/validation.js +0 -28
  71. package/lib/src/schemas.d.ts +0 -1115
  72. package/lib/src/schemas.js +0 -294
  73. package/lib/src/types.d.ts +0 -116
  74. package/lib/src/types.js +0 -2
  75. package/lib/src/userSdk/chat.d.ts +0 -57
  76. package/lib/src/userSdk/chat.js +0 -98
  77. package/lib/src/userSdk/index.d.ts +0 -2
  78. package/lib/src/userSdk/index.js +0 -27
  79. package/lib/src/userSdk/patients.d.ts +0 -12
  80. package/lib/src/userSdk/patients.js +0 -27
  81. package/lib/src/userSdk/schedule.d.ts +0 -44
  82. package/lib/src/userSdk/schedule.js +0 -76
  83. package/lib/src/userSdk/specialties.d.ts +0 -7
  84. package/lib/src/userSdk/specialties.js +0 -19
  85. package/lib/src/userSdk/videoVisit.d.ts +0 -111
  86. package/lib/src/userSdk/videoVisit.js +0 -147
  87. package/lib/src/utils.d.ts +0 -4
  88. package/lib/src/utils.js +0 -19
  89. package/lib/src/webhook/index.d.ts +0 -2
  90. package/lib/src/webhook/index.js +0 -55
  91. package/lib/src/webhook/responses.d.ts +0 -35
  92. package/lib/src/webhook/responses.js +0 -42
  93. package/lib/src/webhook/token.d.ts +0 -2
  94. package/lib/src/webhook/token.js +0 -23
  95. package/lib/test.d.ts +0 -1
  96. package/lib/test.js +0 -55
  97. package/lib/userSdk/sarasas.d.ts +0 -6
  98. package/lib/userSdk/sarasas.js +0 -13
@@ -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<{
@@ -48,9 +48,13 @@ const getBaseSdk = async (url, credentials) => {
48
48
  id: s.id_especialidad,
49
49
  description: s.especialidad,
50
50
  });
51
+ const mapSpecialityER = (s) => ({
52
+ id: s.specialty_id,
53
+ description: s.specialty,
54
+ });
51
55
  const mapped = {
52
56
  specialties: response.data.specialties.map(mapSpeciality),
53
- specialtiesER: response.data.specialties_er.map(mapSpeciality),
57
+ specialtiesER: response.data.specialties_er.map(mapSpecialityER),
54
58
  professionals: response.data.professionals.map((p) => ({
55
59
  id: p.id_profesional,
56
60
  fullName: p.denominacion,
@@ -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;
@@ -945,14 +945,14 @@ export declare const doc24Schemas: {
945
945
  }>;
946
946
  diagnosticaPatientFilter: import("zod").ZodObject<{
947
947
  gender: import("zod").ZodEnum<["m", "f"]>;
948
- identificationType: import("zod").ZodEnum<["ndi", "passport", "credential"]>;
948
+ identificationType: import("zod").ZodEnum<["dni", "ndi", "passport", "credential"]>;
949
949
  identificationValue: import("zod").ZodString;
950
950
  }, "strip", import("zod").ZodTypeAny, {
951
- identificationType: "ndi" | "passport" | "credential";
951
+ identificationType: "dni" | "ndi" | "passport" | "credential";
952
952
  identificationValue: string;
953
953
  gender: "m" | "f";
954
954
  }, {
955
- identificationType: "ndi" | "passport" | "credential";
955
+ identificationType: "dni" | "ndi" | "passport" | "credential";
956
956
  identificationValue: string;
957
957
  gender: "m" | "f";
958
958
  }>;
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(),
@@ -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;
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,9 @@
1
1
  {
2
2
  "name": "@integraciones_doc24/sdk",
3
- "version": "0.35.0",
3
+ "version": "0.36.0",
4
+ "publishConfig": {
5
+ "tag": "0.x"
6
+ },
4
7
  "description": "",
5
8
  "main": "lib/index.js",
6
9
  "scripts": {
@@ -1,28 +0,0 @@
1
- import { RequestMaker } from '../request';
2
- export declare const getExternalMethods: (makeRequest: RequestMaker) => {
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>;
28
- };
@@ -1,73 +0,0 @@
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 getExternalMethods = (makeRequest) => {
9
- const externalLogin = validation_1.validateFunction(zod_1.tuple([zod_1.string(), zod_1.string()]), schemas_1.doc24Schemas.externalLoginResponse, async (user, password) => {
10
- const path = '/external-login';
11
- const response = await makeRequest('POST', path, { user, password });
12
- /* {
13
- data: {
14
- login_info: {
15
- firstname: 'Nieves Iris',
16
- lastname: 'Veiga',
17
- birthdate: '1964-03-18T00:00:00',
18
- identification_number: '16766094',
19
- identification_type: 1,
20
- country_id: 'AR',
21
- gender: 'F',
22
- address: 'Av. Pte Illia 13267',
23
- city: 'Buenos Aires',
24
- province: 'José C. Paz',
25
- email: 'carlosiosella@gmail.com',
26
- email_validated: true,
27
- telephone: '3426310240',
28
- cellphoneValidated: true,
29
- external_id: null,
30
- external_uid: 'srfoTzzYcE9',
31
- },
32
- },
33
- }; */
34
- console.log(response);
35
- const info = response.data.login_info;
36
- return {
37
- firstName: info.firstname,
38
- lastName: info.lastname,
39
- countryId: info.country_id,
40
- birthday: new Date(Date.parse(info.birthdate)),
41
- identificationNumber: info.identification_number,
42
- gender: info.gender === 'F' ? 'f' : 'm',
43
- email: info.email,
44
- phone: info.telephone,
45
- };
46
- });
47
- const preExternalEnroll = validation_1.validateFunction(zod_1.tuple([schemas_1.doc24Schemas.preExternalEnrollmentParams]), zod_1.void(), async (params) => {
48
- const path = '/pre-external-enrollment';
49
- await makeRequest('POST', path, {
50
- identification_number: params.identificationNumber,
51
- birthdate: date_fns_1.format(params.birthdate, 'yyyy-MM-dd'),
52
- email: params.email,
53
- telephone: params.phone,
54
- });
55
- return;
56
- });
57
- const externalEnroll = validation_1.validateFunction(zod_1.tuple([schemas_1.doc24Schemas.externalEnrollmentParams]), zod_1.void(), async (params) => {
58
- const path = '/external-enrollment';
59
- const response = await makeRequest('POST', path, {
60
- identification_number: params.identificationNumber,
61
- birthdate: date_fns_1.format(params.birthdate, 'yyyy-MM-dd'),
62
- email: params.email,
63
- telephone: params.phone,
64
- email_code: params.emailCode,
65
- telephone_code: params.phoneCode,
66
- password: params.password,
67
- });
68
- console.log(response);
69
- return;
70
- });
71
- return { externalLogin, preExternalEnroll, externalEnroll };
72
- };
73
- exports.getExternalMethods = getExternalMethods;
@@ -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,15 +0,0 @@
1
- export var __esModule: boolean;
2
- export function getExternalMethods(makeRequest: any): {
3
- externalLogin: (...params: any) => Promise<{
4
- firstName: any;
5
- lastName: any;
6
- countryId: any;
7
- birthday: Date;
8
- identificationNumber: any;
9
- gender: string;
10
- email: any;
11
- phone: any;
12
- }>;
13
- preExternalEnroll: (...params: any) => Promise<void>;
14
- externalEnroll: (...params: any) => Promise<void>;
15
- };
@@ -1,73 +0,0 @@
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 getExternalMethods = (makeRequest) => {
9
- const externalLogin = validation_1.validateFunction(zod_1.tuple([zod_1.string(), zod_1.string()]), schemas_1.doc24Schemas.externalLoginResponse, async (user, password) => {
10
- const path = '/external-login';
11
- const response = await makeRequest('POST', path, { user, password });
12
- /* {
13
- data: {
14
- login_info: {
15
- firstname: 'Nieves Iris',
16
- lastname: 'Veiga',
17
- birthdate: '1964-03-18T00:00:00',
18
- identification_number: '16766094',
19
- identification_type: 1,
20
- country_id: 'AR',
21
- gender: 'F',
22
- address: 'Av. Pte Illia 13267',
23
- city: 'Buenos Aires',
24
- province: 'José C. Paz',
25
- email: 'carlosiosella@gmail.com',
26
- email_validated: true,
27
- telephone: '3426310240',
28
- cellphoneValidated: true,
29
- external_id: null,
30
- external_uid: 'srfoTzzYcE9',
31
- },
32
- },
33
- }; */
34
- console.log(response);
35
- const info = response.data.login_info;
36
- return {
37
- firstName: info.firstname,
38
- lastName: info.lastname,
39
- countryId: info.country_id,
40
- birthday: new Date(Date.parse(info.birthdate)),
41
- identificationNumber: info.identification_number,
42
- gender: info.gender === 'F' ? 'f' : 'm',
43
- email: info.email,
44
- phone: info.telephone,
45
- };
46
- });
47
- const preExternalEnroll = validation_1.validateFunction(zod_1.tuple([schemas_1.doc24Schemas.preExternalEnrollmentParams]), zod_1.void(), async (params) => {
48
- const path = '/pre-external-enrollment';
49
- await makeRequest('POST', path, {
50
- identification_number: params.identificationNumber,
51
- birthdate: date_fns_1.format(params.birthdate, 'yyyy-MM-dd'),
52
- email: params.email,
53
- telephone: params.phone,
54
- });
55
- return;
56
- });
57
- const externalEnroll = validation_1.validateFunction(zod_1.tuple([schemas_1.doc24Schemas.externalEnrollmentParams]), zod_1.void(), async (params) => {
58
- const path = '/external-enrollment';
59
- const response = await makeRequest('POST', path, {
60
- identification_number: params.identificationNumber,
61
- birthdate: date_fns_1.format(params.birthdate, 'yyyy-MM-dd'),
62
- email: params.email,
63
- telephone: params.phone,
64
- email_code: params.emailCode,
65
- telephone_code: params.phoneCode,
66
- password: params.password,
67
- });
68
- console.log(response);
69
- return;
70
- });
71
- return { externalLogin, preExternalEnroll, externalEnroll };
72
- };
73
- exports.getExternalMethods = getExternalMethods;
@@ -1,114 +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: (user: {
27
- firstName: string;
28
- lastName: string;
29
- identificationType: "ndi" | "passport" | "credential";
30
- identificationValue: string;
31
- gender: "m" | "f";
32
- phone: string;
33
- email: string;
34
- countryId: string;
35
- birthdate: Date;
36
- }) => Promise<any>;
37
- getUserInstance: (...params: any) => Promise<any>;
38
- enroll: (...params: any) => Promise<void>;
39
- getConverageInfo: (identificationValue: string) => Promise<{
40
- firstName: string | null;
41
- lastName: string | null;
42
- gender: "m" | "f";
43
- email: string | null;
44
- birthdate: Date;
45
- identificationNumber: string;
46
- plan: string | null;
47
- financerId: number | null;
48
- defaultAffiliationId: number | null;
49
- credentialNumber: string | null;
50
- financerPlanId: number | null;
51
- brand: number | null;
52
- holderIdentificationNumber: string | null;
53
- copaymentValue: number | null;
54
- mobilePhone: string | null;
55
- company: string | null;
56
- dischargeDate: Date | null;
57
- leavingDate: Date | null;
58
- identificacion_tributaria: string | null;
59
- deregistrationDate: Date | null;
60
- authorizationCode: string | null;
61
- authorizationCodeExpiration: Date | null;
62
- } | null>;
63
- getDiagnosticaHistory: (patient: {
64
- identificationType: "ndi" | "passport" | "credential";
65
- identificationValue: string;
66
- gender: "m" | "f";
67
- }, from: Date, to: Date) => Promise<{
68
- date: Date;
69
- location: string;
70
- exams: string[];
71
- deepLink: string;
72
- }[]>;
73
- getDiagnosticaDeepLink: (kiosk: string, user: {
74
- language: string;
75
- firstName: string;
76
- lastName: string;
77
- birthday: Date;
78
- identificationType: "dni";
79
- identificationValue: string;
80
- gender: "m" | "f";
81
- phone: string;
82
- email: string;
83
- }, patient: {
84
- firstName: string;
85
- lastName: string;
86
- birthday: Date;
87
- identificationType: "dni";
88
- identificationValue: string;
89
- gender: "m" | "f";
90
- }) => Promise<{
91
- forwardingRequired: true;
92
- deepLink: string;
93
- } | {
94
- forwardingRequired: false;
95
- }>;
96
- getDiagnosticaAccess: (kiosk: string, user: {
97
- language: string;
98
- firstName: string;
99
- lastName: string;
100
- birthday: Date;
101
- identificationType: "dni";
102
- identificationValue: string;
103
- gender: "m" | "f";
104
- phone: string;
105
- email: string;
106
- }, patient: {
107
- firstName: string;
108
- lastName: string;
109
- birthday: Date;
110
- identificationType: "dni";
111
- identificationValue: string;
112
- gender: "m" | "f";
113
- }) => Promise<void>;
114
- }>;
@@ -1,66 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getBaseSdk = void 0;
4
- const zod_1 = require("zod");
5
- const request_1 = require("../request");
6
- const validation_1 = require("../request/validation");
7
- const schemas_1 = require("../schemas");
8
- const utils_1 = require("../utils");
9
- const diagnostica_1 = require("./diagnostica");
10
- const user_1 = require("./user");
11
- const getBaseSdk = async (url, credentials) => {
12
- const makeRequest = await request_1.getRequestFactory(url, credentials);
13
- const diagnosticaMethods = diagnostica_1.getDiagnosticaMethods(makeRequest);
14
- const userMethods = user_1.getUserMethods(makeRequest, url, credentials);
15
- const baseSdk = {
16
- ...diagnosticaMethods,
17
- ...userMethods,
18
- getProfessional: validation_1.validateFunction(zod_1.tuple([zod_1.number()]), schemas_1.doc24Schemas.professional, async (professionalId) => {
19
- const path = `/professional/${professionalId}`;
20
- const response = await makeRequest('GET', path);
21
- const raw = response.data;
22
- return {
23
- id: raw.professional_id,
24
- firstName: raw.name,
25
- lastName: raw.lastname,
26
- birthdate: utils_1.parseDate(raw.birthdate),
27
- gender: raw.gender.toLowerCase(),
28
- email: raw.email,
29
- phone: raw.phone,
30
- logoUrl: raw.image,
31
- matriculation: raw.matriculation,
32
- specialties: raw.specialties.map((s) => ({
33
- id: s.specialty_id,
34
- description: s.specialty,
35
- })),
36
- degree: raw.degree,
37
- languages: raw.languages.map((l) => l.languages),
38
- resume: {
39
- link: raw.resume_link,
40
- brief: raw.resume_brief,
41
- },
42
- };
43
- }),
44
- getAvailableScheduleClinics: validation_1.validateFunction(zod_1.tuple([]), schemas_1.doc24Schemas.availableScheduleClinics, async () => {
45
- const path = `/schedule/clinics`;
46
- const response = await makeRequest('GET', path);
47
- const mapSpeciality = (s) => ({
48
- id: s.id_especialidad,
49
- description: s.especialidad,
50
- });
51
- const mapped = {
52
- specialties: response.data.specialties.map(mapSpeciality),
53
- specialtiesER: response.data.specialties_er.map(mapSpeciality),
54
- professionals: response.data.professionals.map((p) => ({
55
- id: p.id_profesional,
56
- fullName: p.denominacion,
57
- clinicId: p.id_consultorio,
58
- specialties: p.especialidades.map(mapSpeciality),
59
- })),
60
- };
61
- return mapped;
62
- }),
63
- };
64
- return baseSdk;
65
- };
66
- exports.getBaseSdk = getBaseSdk;