@runnerpro/backend 1.8.2 → 1.8.3
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/api/conversation.js +2 -2
- package/lib/cjs/chat/sendMessageChatToClient.js +1 -1
- package/lib/cjs/sendNotification/index.js +6 -2
- package/lib/cjs/types/chat/sendMessageChatToClient.d.ts.map +1 -1
- package/lib/cjs/types/sendNotification/index.d.ts +3 -1
- package/lib/cjs/types/sendNotification/index.d.ts.map +1 -1
- package/package.json +2 -2
|
@@ -180,7 +180,7 @@ const sendMessage = (req, res, { sendNotification, firebaseMessaging, query, isC
|
|
|
180
180
|
firebaseMessaging,
|
|
181
181
|
idCliente,
|
|
182
182
|
body: `Rubén: ${textPreferredLanguage || textSpanish}`,
|
|
183
|
-
|
|
183
|
+
screen: common_1.NOTIFICATION_SCREEN_TYPES.CHAT,
|
|
184
184
|
});
|
|
185
185
|
}
|
|
186
186
|
res.send({ status: 'ok' });
|
|
@@ -234,7 +234,7 @@ const sendFile = (req, res, { sendNotification, firebaseMessaging, query, isClie
|
|
|
234
234
|
firebaseMessaging,
|
|
235
235
|
idCliente,
|
|
236
236
|
body: `Rubén: ${(0, index_2.t)(Number(type) === 4 ? 'Audio' : 'Archivo adjunto', cliente.preferredLanguage)}`,
|
|
237
|
-
|
|
237
|
+
screen: common_1.NOTIFICATION_SCREEN_TYPES.CHAT,
|
|
238
238
|
});
|
|
239
239
|
}
|
|
240
240
|
res.send({ idFile });
|
|
@@ -10,7 +10,6 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.sendMessageChatToClient = void 0;
|
|
13
|
-
// eslint-disable-next-line node/no-missing-require
|
|
14
13
|
const messaging_1 = require("firebase-admin/messaging");
|
|
15
14
|
const index_1 = require("../err/index");
|
|
16
15
|
const index_2 = require("../sendNotification/index");
|
|
@@ -27,6 +26,7 @@ const sendMessageChatToClient = (idCliente, text, textPreferredLanguage, preferr
|
|
|
27
26
|
firebaseMessaging: (0, messaging_1.getMessaging)(),
|
|
28
27
|
idCliente,
|
|
29
28
|
body: (0, common_1.removeAccent)((textPreferredLanguage || text).substring(0, 50)) + ((textPreferredLanguage || text).length > 50 ? '...' : ''),
|
|
29
|
+
screen: common_1.NOTIFICATION_SCREEN_TYPES.CHAT,
|
|
30
30
|
});
|
|
31
31
|
}
|
|
32
32
|
catch (e) {
|
|
@@ -11,12 +11,16 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.sendNotification = void 0;
|
|
13
13
|
const index_1 = require("../db/index");
|
|
14
|
-
const
|
|
14
|
+
const common_1 = require("@runnerpro/common");
|
|
15
|
+
const sendNotification = ({ firebaseMessaging, idCliente, title, body, screen = common_1.NOTIFICATION_SCREEN_TYPES.HOME, screenParams = {}, }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
15
16
|
const devices = yield (0, index_1.query)('SELECT [SUBSCRIPTION], [TYPE] FROM [PUSH MANAGER] WHERE [ID CLIENTE] = ?', [idCliente]);
|
|
17
|
+
const screenParamsString = JSON.stringify(screenParams);
|
|
16
18
|
for (const device of devices) {
|
|
17
19
|
notificationWEB(firebaseMessaging, {
|
|
18
20
|
title,
|
|
19
21
|
body,
|
|
22
|
+
screen,
|
|
23
|
+
screenParams: screenParamsString,
|
|
20
24
|
}, device.subscription);
|
|
21
25
|
}
|
|
22
26
|
});
|
|
@@ -29,7 +33,7 @@ function notificationWEB(firebaseMessaging, msg, token) {
|
|
|
29
33
|
.send({
|
|
30
34
|
token,
|
|
31
35
|
notification: msg,
|
|
32
|
-
data: msg,
|
|
36
|
+
data: Object.assign(Object.assign({}, msg), { screen: msg.screen, screenParams: msg.screenParams }),
|
|
33
37
|
})
|
|
34
38
|
.catch((error) => {
|
|
35
39
|
if (error.errorInfo.code === 'messaging/registration-token-not-registered') {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sendMessageChatToClient.d.ts","sourceRoot":"","sources":["../../../../src/chat/sendMessageChatToClient.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"sendMessageChatToClient.d.ts","sourceRoot":"","sources":["../../../../src/chat/sendMessageChatToClient.ts"],"names":[],"mappings":"AAMA,QAAA,MAAM,uBAAuB,gHAsB5B,CAAC;AAEF,OAAO,EAAE,uBAAuB,EAAE,CAAC"}
|
|
@@ -3,7 +3,9 @@ interface Notification {
|
|
|
3
3
|
idCliente: number;
|
|
4
4
|
title?: string;
|
|
5
5
|
body: string;
|
|
6
|
+
screen?: string;
|
|
7
|
+
screenParams?: any;
|
|
6
8
|
}
|
|
7
|
-
declare const sendNotification: ({ firebaseMessaging, idCliente, title, body }: Notification) => Promise<void>;
|
|
9
|
+
declare const sendNotification: ({ firebaseMessaging, idCliente, title, body, screen, screenParams, }: Notification) => Promise<void>;
|
|
8
10
|
export { sendNotification };
|
|
9
11
|
//# 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;
|
|
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,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,YAAY,CAAC,EAAE,GAAG,CAAC;CACpB;AAED,QAAA,MAAM,gBAAgB,yEAOnB,YAAY,kBAgBd,CAAC;AAyBF,OAAO,EAAE,gBAAgB,EAAE,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@runnerpro/backend",
|
|
3
|
-
"version": "1.8.
|
|
3
|
+
"version": "1.8.3",
|
|
4
4
|
"description": "A collection of common backend functions",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": "./lib/cjs/index.js"
|
|
@@ -53,7 +53,7 @@
|
|
|
53
53
|
},
|
|
54
54
|
"peerDependencies": {
|
|
55
55
|
"@napi-rs/canvas": "^0.1.53",
|
|
56
|
-
"@runnerpro/common": "^1.5.
|
|
56
|
+
"@runnerpro/common": "^1.5.10",
|
|
57
57
|
"axios": "^1.6.7",
|
|
58
58
|
"image-size": "^1.0.2",
|
|
59
59
|
"jimp": "^0.22.10",
|