@integraciones_doc24/sdk 0.41.0 → 0.42.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/schemas.d.ts +58 -0
- package/lib/schemas.js +13 -0
- package/lib/types.d.ts +2 -0
- package/lib/userSdk/videoVisit.d.ts +4 -0
- package/lib/userSdk/videoVisit.js +17 -0
- package/lib/utils.d.ts +1 -1
- package/lib/utils.js +4 -3
- package/package.json +1 -1
package/lib/schemas.d.ts
CHANGED
|
@@ -1451,4 +1451,62 @@ export declare const doc24Schemas: {
|
|
|
1451
1451
|
identificationType: "dni" | "ndi" | "passport" | "credential" | "nn" | "cpf" | "rg" | "rut" | "cuit";
|
|
1452
1452
|
identificationValue: string;
|
|
1453
1453
|
}>;
|
|
1454
|
+
videoCallLink: import("zod").ZodObject<{
|
|
1455
|
+
deeplink: import("zod").ZodString;
|
|
1456
|
+
codigo: import("zod").ZodNullable<import("zod").ZodString>;
|
|
1457
|
+
}, "strip", import("zod").ZodTypeAny, {
|
|
1458
|
+
deeplink: string;
|
|
1459
|
+
codigo: string | null;
|
|
1460
|
+
}, {
|
|
1461
|
+
deeplink: string;
|
|
1462
|
+
codigo: string | null;
|
|
1463
|
+
}>;
|
|
1464
|
+
videoCallLinkResponse: import("zod").ZodObject<{
|
|
1465
|
+
data: import("zod").ZodObject<{
|
|
1466
|
+
code: import("zod").ZodLiteral<200>;
|
|
1467
|
+
message: import("zod").ZodLiteral<"OK">;
|
|
1468
|
+
link: import("zod").ZodObject<{
|
|
1469
|
+
deeplink: import("zod").ZodString;
|
|
1470
|
+
codigo: import("zod").ZodNullable<import("zod").ZodString>;
|
|
1471
|
+
}, "strip", import("zod").ZodTypeAny, {
|
|
1472
|
+
deeplink: string;
|
|
1473
|
+
codigo: string | null;
|
|
1474
|
+
}, {
|
|
1475
|
+
deeplink: string;
|
|
1476
|
+
codigo: string | null;
|
|
1477
|
+
}>;
|
|
1478
|
+
}, "strip", import("zod").ZodTypeAny, {
|
|
1479
|
+
code: 200;
|
|
1480
|
+
message: "OK";
|
|
1481
|
+
link: {
|
|
1482
|
+
deeplink: string;
|
|
1483
|
+
codigo: string | null;
|
|
1484
|
+
};
|
|
1485
|
+
}, {
|
|
1486
|
+
code: 200;
|
|
1487
|
+
message: "OK";
|
|
1488
|
+
link: {
|
|
1489
|
+
deeplink: string;
|
|
1490
|
+
codigo: string | null;
|
|
1491
|
+
};
|
|
1492
|
+
}>;
|
|
1493
|
+
}, "strip", import("zod").ZodTypeAny, {
|
|
1494
|
+
data: {
|
|
1495
|
+
code: 200;
|
|
1496
|
+
message: "OK";
|
|
1497
|
+
link: {
|
|
1498
|
+
deeplink: string;
|
|
1499
|
+
codigo: string | null;
|
|
1500
|
+
};
|
|
1501
|
+
};
|
|
1502
|
+
}, {
|
|
1503
|
+
data: {
|
|
1504
|
+
code: 200;
|
|
1505
|
+
message: "OK";
|
|
1506
|
+
link: {
|
|
1507
|
+
deeplink: string;
|
|
1508
|
+
codigo: string | null;
|
|
1509
|
+
};
|
|
1510
|
+
};
|
|
1511
|
+
}>;
|
|
1454
1512
|
};
|
package/lib/schemas.js
CHANGED
|
@@ -186,6 +186,17 @@ const oldIdentificaiton = zod_1.object({
|
|
|
186
186
|
identificationType,
|
|
187
187
|
identificationValue: zod_1.string(),
|
|
188
188
|
});
|
|
189
|
+
const videoCallLink = zod_1.object({
|
|
190
|
+
deeplink: zod_1.string().url(),
|
|
191
|
+
codigo: zod_1.string().nullable(),
|
|
192
|
+
});
|
|
193
|
+
const videoCallLinkResponse = zod_1.object({
|
|
194
|
+
data: zod_1.object({
|
|
195
|
+
code: zod_1.literal(200),
|
|
196
|
+
message: zod_1.literal('OK'),
|
|
197
|
+
link: videoCallLink,
|
|
198
|
+
}),
|
|
199
|
+
});
|
|
189
200
|
const consultation = zod_1.object({
|
|
190
201
|
id_consulta: zod_1.number(),
|
|
191
202
|
tipo_consulta: zod_1.string(),
|
|
@@ -404,4 +415,6 @@ exports.doc24Schemas = {
|
|
|
404
415
|
diagnosticaDeepLinkResponse,
|
|
405
416
|
coverageInfo,
|
|
406
417
|
oldIdentificaiton,
|
|
418
|
+
videoCallLink,
|
|
419
|
+
videoCallLinkResponse,
|
|
407
420
|
};
|
package/lib/types.d.ts
CHANGED
|
@@ -32,6 +32,7 @@ export declare namespace Doc24 {
|
|
|
32
32
|
type DiagnosticaHistoryAppointment = TypeOf<typeof doc24Schemas.diagnosticaHistoryAppointment>;
|
|
33
33
|
type DiagnosticaDeepLinkResponse = TypeOf<typeof doc24Schemas.diagnosticaDeepLinkResponse>;
|
|
34
34
|
type OldIdentificaiton = TypeOf<typeof doc24Schemas.oldIdentificaiton>;
|
|
35
|
+
type VideoCallLink = TypeOf<typeof doc24Schemas.videoCallLink>;
|
|
35
36
|
type BaseSdk = {
|
|
36
37
|
declareUser: (user: User) => Promise<number>;
|
|
37
38
|
getUserInstance: (user: User | number) => Promise<UserSdk>;
|
|
@@ -65,6 +66,7 @@ export declare namespace Doc24 {
|
|
|
65
66
|
getChatPosts: (chatId: number) => Promise<ChatPost[]>;
|
|
66
67
|
cancelChat: (chatId: number) => Promise<void>;
|
|
67
68
|
sendChatMessage: (chatId: number, message: string) => Promise<number>;
|
|
69
|
+
getVideoCallLink: (vcToken: string, name: string) => Promise<VideoCallLink>;
|
|
68
70
|
userId: number;
|
|
69
71
|
};
|
|
70
72
|
namespace Webhook {
|
|
@@ -108,4 +108,8 @@ export declare const getVideoVisitMethods: (makeRequest: RequestMaker) => {
|
|
|
108
108
|
vcToken: string;
|
|
109
109
|
consultationId: number;
|
|
110
110
|
}[]>;
|
|
111
|
+
getVideoCallLink: (vcToken: string, name: string) => Promise<{
|
|
112
|
+
deeplink: string;
|
|
113
|
+
codigo: string | null;
|
|
114
|
+
}>;
|
|
111
115
|
};
|
|
@@ -113,6 +113,22 @@ const getVideoVisitMethods = (makeRequest) => {
|
|
|
113
113
|
const response = await makeRequest('GET', path);
|
|
114
114
|
return response.data.link;
|
|
115
115
|
});
|
|
116
|
+
const getVideoCallLink = validation_1.validateFunction(zod_1.tuple([zod_1.string(), zod_1.string()]), schemas_1.doc24Schemas.videoCallLink, async (vcToken, name) => {
|
|
117
|
+
try {
|
|
118
|
+
const path = `/attend-video-visit`;
|
|
119
|
+
const response = await makeRequest('POST', path, {
|
|
120
|
+
vc_token: vcToken,
|
|
121
|
+
name,
|
|
122
|
+
});
|
|
123
|
+
const parsedResponse = schemas_1.doc24Schemas.videoCallLinkResponse.safeParse(response);
|
|
124
|
+
if (!parsedResponse.success)
|
|
125
|
+
throw new Error('Invalid telecommand link response');
|
|
126
|
+
return parsedResponse.data.data.link;
|
|
127
|
+
}
|
|
128
|
+
catch (error) {
|
|
129
|
+
throw new Error('Error getting telecommand link');
|
|
130
|
+
}
|
|
131
|
+
});
|
|
116
132
|
return {
|
|
117
133
|
scheduleVideoVisit,
|
|
118
134
|
cancelVideoVisit,
|
|
@@ -121,6 +137,7 @@ const getVideoVisitMethods = (makeRequest) => {
|
|
|
121
137
|
getVideoVisitDetails,
|
|
122
138
|
getVideoVisitLink,
|
|
123
139
|
getActiveVideoVisits,
|
|
140
|
+
getVideoCallLink,
|
|
124
141
|
};
|
|
125
142
|
};
|
|
126
143
|
exports.getVideoVisitMethods = getVideoVisitMethods;
|
package/lib/utils.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Doc24 } from '.';
|
|
2
2
|
export declare const parseDate: (str: string) => Date;
|
|
3
|
-
export declare const parseDateTime: (str: string, timeZone
|
|
3
|
+
export declare const parseDateTime: (str: string, timeZone?: string | null | undefined) => Date;
|
|
4
4
|
export declare const parseDateTimeTzAR: (str: string) => Date;
|
|
5
5
|
export declare const getIndetificationTypeId: (type: Doc24.IdentificationType) => number;
|
package/lib/utils.js
CHANGED
|
@@ -2,10 +2,11 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getIndetificationTypeId = exports.parseDateTimeTzAR = exports.parseDateTime = exports.parseDate = void 0;
|
|
4
4
|
const date_fns_1 = require("date-fns");
|
|
5
|
-
//
|
|
6
|
-
const
|
|
5
|
+
// Offset por defecto cuando Doc24 no envia time_zone en la respuesta
|
|
6
|
+
const DEFAULT_TIME_ZONE = '-03';
|
|
7
|
+
const parseDate = (str) => exports.parseDateTime(`${str} 00:00:00`, DEFAULT_TIME_ZONE);
|
|
7
8
|
exports.parseDate = parseDate;
|
|
8
|
-
const parseDateTime = (str, timeZone) => date_fns_1.parse(`${str} ${timeZone}`, 'yyyy-MM-dd HH:mm:ss X', new Date());
|
|
9
|
+
const parseDateTime = (str, timeZone) => date_fns_1.parse(`${str} ${timeZone || DEFAULT_TIME_ZONE}`, 'yyyy-MM-dd HH:mm:ss X', new Date());
|
|
9
10
|
exports.parseDateTime = parseDateTime;
|
|
10
11
|
const parseDateTimeTzAR = (str) => date_fns_1.parse(`${str} -03`, 'yyyy-MM-dd HH:mm:ss X', new Date());
|
|
11
12
|
exports.parseDateTimeTzAR = parseDateTimeTzAR;
|