@runnerpro/backend 1.8.15 → 1.8.16
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/cjs/chat/sendMessageChatToClient.js +1 -13
- package/lib/cjs/sendNotification/index.js +2 -8
- package/lib/cjs/types/chat/sendMessageChatToClient.d.ts +1 -1
- package/lib/cjs/types/chat/sendMessageChatToClient.d.ts.map +1 -1
- package/lib/cjs/types/sendNotification/index.d.ts +1 -6
- package/lib/cjs/types/sendNotification/index.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -26,10 +26,9 @@ const sendMessageChatToClient = (idCliente, text, textPreferredLanguage, preferr
|
|
|
26
26
|
return;
|
|
27
27
|
idEntrenador = entrenadorBBDD.idEntrenador;
|
|
28
28
|
}
|
|
29
|
-
let result;
|
|
30
29
|
if (notification) {
|
|
31
30
|
try {
|
|
32
|
-
|
|
31
|
+
yield (0, index_2.sendNotification)({
|
|
33
32
|
firebaseMessaging: (0, messaging_1.getMessaging)(),
|
|
34
33
|
idCliente,
|
|
35
34
|
body: (0, common_1.removeAccent)((textPreferredLanguage || text).substring(0, 50)) + ((textPreferredLanguage || text).length > 50 ? '...' : ''),
|
|
@@ -37,20 +36,9 @@ const sendMessageChatToClient = (idCliente, text, textPreferredLanguage, preferr
|
|
|
37
36
|
});
|
|
38
37
|
}
|
|
39
38
|
catch (e) {
|
|
40
|
-
console.log('Error al enviar notificación', e);
|
|
41
39
|
(0, index_1.err)(null, null, e, null);
|
|
42
|
-
return e;
|
|
43
40
|
}
|
|
44
41
|
}
|
|
45
42
|
yield (0, index_3.query)('INSERT INTO [CHAT MESSAGE] ([ID CLIENTE], [ID SENDER], [TEXT], [TEXT PREFERRED LANGUAGE], [PREFERRED LANGUAGE], [TYPE]) VALUES (?, ?, ?, ?, ?, 1)', [idCliente, idEntrenador, text, textPreferredLanguage, preferredLanguage]);
|
|
46
|
-
return {
|
|
47
|
-
// status: 'success',
|
|
48
|
-
// notification,
|
|
49
|
-
// options,
|
|
50
|
-
// firebaseMessaging: getMessaging(),
|
|
51
|
-
// body: removeAccent((textPreferredLanguage || text).substring(0, 50)) + ((textPreferredLanguage || text).length > 50 ? '...' : ''),
|
|
52
|
-
// screen: NOTIFICATION_SCREEN_TYPES.CHAT,
|
|
53
|
-
result,
|
|
54
|
-
};
|
|
55
43
|
});
|
|
56
44
|
exports.sendMessageChatToClient = sendMessageChatToClient;
|
|
@@ -24,19 +24,15 @@ const sendNotification = ({ firebaseMessaging, idCliente, title, body, screen =
|
|
|
24
24
|
}),
|
|
25
25
|
]);
|
|
26
26
|
const screenParamsString = JSON.stringify(screenParams);
|
|
27
|
-
const resultsDevices = [];
|
|
28
27
|
for (const device of devices) {
|
|
29
|
-
|
|
28
|
+
yield notificationWEB(firebaseMessaging, {
|
|
30
29
|
title,
|
|
31
30
|
body,
|
|
32
31
|
idNotification: (idNotification || '0').toString(),
|
|
33
32
|
screen,
|
|
34
33
|
screenParams: screenParamsString,
|
|
35
34
|
}, device.subscription);
|
|
36
|
-
// @ts-ignore
|
|
37
|
-
resultsDevices.push(resultDevice);
|
|
38
35
|
}
|
|
39
|
-
return { status: 'success', idNotification, devices, resultsDevices };
|
|
40
36
|
});
|
|
41
37
|
exports.sendNotification = sendNotification;
|
|
42
38
|
function notificationWEB(firebaseMessaging, msg, token) {
|
|
@@ -44,7 +40,7 @@ function notificationWEB(firebaseMessaging, msg, token) {
|
|
|
44
40
|
if (!msg.title)
|
|
45
41
|
msg.title = '';
|
|
46
42
|
try {
|
|
47
|
-
|
|
43
|
+
yield firebaseMessaging.send({
|
|
48
44
|
token,
|
|
49
45
|
notification: {
|
|
50
46
|
title: msg.title,
|
|
@@ -52,11 +48,9 @@ function notificationWEB(firebaseMessaging, msg, token) {
|
|
|
52
48
|
},
|
|
53
49
|
data: msg,
|
|
54
50
|
});
|
|
55
|
-
return result;
|
|
56
51
|
}
|
|
57
52
|
catch (error) {
|
|
58
53
|
console.log('Error al enviar notificación', error);
|
|
59
|
-
return error;
|
|
60
54
|
}
|
|
61
55
|
});
|
|
62
56
|
}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
declare const sendMessageChatToClient: (idCliente: any, text: any, textPreferredLanguage: any, preferredLanguage: any, options: any) => Promise<
|
|
1
|
+
declare const sendMessageChatToClient: (idCliente: any, text: any, textPreferredLanguage: any, preferredLanguage: any, options: any) => Promise<void>;
|
|
2
2
|
export { sendMessageChatToClient };
|
|
3
3
|
//# sourceMappingURL=sendMessageChatToClient.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sendMessageChatToClient.d.ts","sourceRoot":"","sources":["../../../../src/chat/sendMessageChatToClient.ts"],"names":[],"mappings":"AAMA,QAAA,MAAM,uBAAuB
|
|
1
|
+
{"version":3,"file":"sendMessageChatToClient.d.ts","sourceRoot":"","sources":["../../../../src/chat/sendMessageChatToClient.ts"],"names":[],"mappings":"AAMA,QAAA,MAAM,uBAAuB,gHA2B5B,CAAC;AAEF,OAAO,EAAE,uBAAuB,EAAE,CAAC"}
|
|
@@ -7,11 +7,6 @@ interface Notification {
|
|
|
7
7
|
screen?: string;
|
|
8
8
|
screenParams?: any;
|
|
9
9
|
}
|
|
10
|
-
declare const sendNotification: ({ firebaseMessaging, idCliente, title, body, screen, screenParams, }: Notification) => Promise<
|
|
11
|
-
status: string;
|
|
12
|
-
idNotification: any;
|
|
13
|
-
devices: any;
|
|
14
|
-
resultsDevices: any[];
|
|
15
|
-
}>;
|
|
10
|
+
declare const sendNotification: ({ firebaseMessaging, idCliente, title, body, screen, screenParams, }: Notification) => Promise<void>;
|
|
16
11
|
export { sendNotification };
|
|
17
12
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/sendNotification/index.ts"],"names":[],"mappings":"AAEA,UAAU,YAAY;IACpB,iBAAiB,EAAE,GAAG,CAAC;IACvB,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,YAAY,CAAC,EAAE,GAAG,CAAC;CACpB;AAED,QAAA,MAAM,gBAAgB,yEAOnB,YAAY
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/sendNotification/index.ts"],"names":[],"mappings":"AAEA,UAAU,YAAY;IACpB,iBAAiB,EAAE,GAAG,CAAC;IACvB,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,YAAY,CAAC,EAAE,GAAG,CAAC;CACpB;AAED,QAAA,MAAM,gBAAgB,yEAOnB,YAAY,kBA8Bd,CAAC;AAuBF,OAAO,EAAE,gBAAgB,EAAE,CAAC"}
|