podverse-external-services 5.1.17-alpha.0 → 5.1.20-alpha.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.
- package/dist/services/google/firebase/firebaseNotificationAndroid.d.ts.map +1 -1
- package/dist/services/google/firebase/firebaseNotificationAndroid.js +3 -4
- package/dist/services/google/firebase/firebaseNotificationGeneric.js +4 -4
- package/dist/services/google/firebase/firebaseNotificationIOS.js +3 -3
- package/dist/services/google/firebase/firebaseNotificationOrchestrator.d.ts +1 -1
- package/dist/services/google/firebase/firebaseNotificationOrchestrator.d.ts.map +1 -1
- package/dist/services/google/firebase/firebaseNotificationOrchestrator.js +0 -15
- package/dist/services/google/firebase/firebaseNotificationWeb.js +3 -3
- package/dist/services/google/firebase/index.d.ts +7 -0
- package/dist/services/google/firebase/index.d.ts.map +1 -0
- package/dist/services/google/firebase/index.js +15 -0
- package/dist/services/index.d.ts +3 -3
- package/dist/services/index.d.ts.map +1 -1
- package/dist/services/index.js +3 -6
- package/dist/services/podcast-index/index.js +5 -5
- package/package.json +3 -3
- package/dist/services/google/firebase/firebaseHelpers.d.ts +0 -3
- package/dist/services/google/firebase/firebaseHelpers.d.ts.map +0 -1
- package/dist/services/google/firebase/firebaseHelpers.js +0 -16
- package/dist/services/notifications/i18nNotifications.d.ts +0 -4
- package/dist/services/notifications/i18nNotifications.d.ts.map +0 -1
- package/dist/services/notifications/i18nNotifications.js +0 -49
- package/dist/services/notifications/index.d.ts +0 -3
- package/dist/services/notifications/index.d.ts.map +0 -1
- package/dist/services/notifications/index.js +0 -18
- package/dist/services/notifications/notificationOrchestrator.d.ts +0 -20
- package/dist/services/notifications/notificationOrchestrator.d.ts.map +0 -1
- package/dist/services/notifications/notificationOrchestrator.js +0 -96
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"firebaseNotificationAndroid.d.ts","sourceRoot":"","sources":["../../../../src/services/google/firebase/firebaseNotificationAndroid.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"firebaseNotificationAndroid.d.ts","sourceRoot":"","sources":["../../../../src/services/google/firebase/firebaseNotificationAndroid.ts"],"names":[],"mappings":"AAIA,KAAK,cAAc,GAAG;IACpB,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;CAC5B,CAAC;AAEF,wBAAsB,oCAAoC,CAAC,MAAM,EAAE,MAAM,EAAE,EAAE,OAAO,EAAE,IAAI,CAAC,cAAc,EAAE,UAAU,CAAC,kBA+BrH"}
|
|
@@ -10,15 +10,14 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.sendFirebaseNotificationBatchAndroid = sendFirebaseNotificationBatchAndroid;
|
|
13
|
+
const podverse_helpers_1 = require("podverse-helpers");
|
|
13
14
|
const web_1 = require("@external-services/config/web");
|
|
14
15
|
const firebaseAdmin_1 = require("./firebaseAdmin");
|
|
15
|
-
const firebaseHelpers_1 = require("./firebaseHelpers");
|
|
16
|
-
const firebaseHelpers_2 = require("./firebaseHelpers");
|
|
17
16
|
function sendFirebaseNotificationBatchAndroid(tokens, payload) {
|
|
18
17
|
return __awaiter(this, void 0, void 0, function* () {
|
|
19
18
|
if (!firebaseAdmin_1.firebaseAdmin)
|
|
20
19
|
throw new Error("Firebase Admin is not initialized");
|
|
21
|
-
const chunks = (0,
|
|
20
|
+
const chunks = (0, podverse_helpers_1.chunkArray)(tokens, 500);
|
|
22
21
|
const results = [];
|
|
23
22
|
for (const chunk of chunks) {
|
|
24
23
|
const multicastMessage = {
|
|
@@ -32,7 +31,7 @@ function sendFirebaseNotificationBatchAndroid(tokens, payload) {
|
|
|
32
31
|
image: payload.image || (0, web_1.getWebIconImageUrl)(),
|
|
33
32
|
},
|
|
34
33
|
},
|
|
35
|
-
data: (0,
|
|
34
|
+
data: (0, podverse_helpers_1.stringifyData)(payload.data),
|
|
36
35
|
};
|
|
37
36
|
try {
|
|
38
37
|
const resp = yield firebaseAdmin_1.firebaseAdmin.messaging().sendEachForMulticast(multicastMessage);
|
|
@@ -10,21 +10,21 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.sendFirebaseNotificationBatchGeneric = sendFirebaseNotificationBatchGeneric;
|
|
13
|
+
const podverse_helpers_1 = require("podverse-helpers");
|
|
13
14
|
const firebaseAdmin_1 = require("./firebaseAdmin");
|
|
14
15
|
const web_1 = require("@external-services/config/web");
|
|
15
|
-
const firebaseHelpers_1 = require("./firebaseHelpers");
|
|
16
16
|
function sendFirebaseNotificationBatchGeneric(tokens, payload) {
|
|
17
17
|
return __awaiter(this, void 0, void 0, function* () {
|
|
18
18
|
if (!firebaseAdmin_1.firebaseAdmin)
|
|
19
19
|
throw new Error("Firebase Admin is not initialized");
|
|
20
|
-
const chunks = (0,
|
|
20
|
+
const chunks = (0, podverse_helpers_1.chunkArray)(tokens, 500);
|
|
21
21
|
const results = [];
|
|
22
22
|
for (const chunk of chunks) {
|
|
23
23
|
const multicastMessage = {
|
|
24
24
|
tokens: chunk,
|
|
25
25
|
webpush: {
|
|
26
26
|
headers: { Urgency: "normal" },
|
|
27
|
-
data: Object.assign({ title: payload.title, body: payload.body || "", icon: payload.icon || (0, web_1.getWebIconImageUrl)(), image: payload.image || undefined, link: payload.link ? (0, web_1.getWebBaseUrlWithPath)(payload.link) : (0, web_1.getWebBaseUrl)() }, (0,
|
|
27
|
+
data: Object.assign({ title: payload.title, body: payload.body || "", icon: payload.icon || (0, web_1.getWebIconImageUrl)(), image: payload.image || undefined, link: payload.link ? (0, web_1.getWebBaseUrlWithPath)(payload.link) : (0, web_1.getWebBaseUrl)() }, (0, podverse_helpers_1.stringifyData)(payload.data)),
|
|
28
28
|
},
|
|
29
29
|
android: {
|
|
30
30
|
priority: "high",
|
|
@@ -44,7 +44,7 @@ function sendFirebaseNotificationBatchGeneric(tokens, payload) {
|
|
|
44
44
|
"mutable-content": 1,
|
|
45
45
|
} }, (payload.data || {})), { image: payload.image || (0, web_1.getWebIconImageUrl)() }),
|
|
46
46
|
},
|
|
47
|
-
data: (0,
|
|
47
|
+
data: (0, podverse_helpers_1.stringifyData)(payload.data),
|
|
48
48
|
};
|
|
49
49
|
try {
|
|
50
50
|
const resp = yield firebaseAdmin_1.firebaseAdmin.messaging().sendEachForMulticast(multicastMessage);
|
|
@@ -10,14 +10,14 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.sendFirebaseNotificationBatchIOS = sendFirebaseNotificationBatchIOS;
|
|
13
|
+
const podverse_helpers_1 = require("podverse-helpers");
|
|
13
14
|
const web_1 = require("@external-services/config/web");
|
|
14
15
|
const firebaseAdmin_1 = require("./firebaseAdmin");
|
|
15
|
-
const firebaseHelpers_1 = require("./firebaseHelpers");
|
|
16
16
|
function sendFirebaseNotificationBatchIOS(tokens, payload) {
|
|
17
17
|
return __awaiter(this, void 0, void 0, function* () {
|
|
18
18
|
if (!firebaseAdmin_1.firebaseAdmin)
|
|
19
19
|
throw new Error("Firebase Admin is not initialized");
|
|
20
|
-
const chunks = (0,
|
|
20
|
+
const chunks = (0, podverse_helpers_1.chunkArray)(tokens, 500);
|
|
21
21
|
const results = [];
|
|
22
22
|
for (const chunk of chunks) {
|
|
23
23
|
const multicastMessage = {
|
|
@@ -31,7 +31,7 @@ function sendFirebaseNotificationBatchIOS(tokens, payload) {
|
|
|
31
31
|
"mutable-content": 1,
|
|
32
32
|
} }, (payload.data || {})), { image: payload.image || (0, web_1.getWebIconImageUrl)() }),
|
|
33
33
|
},
|
|
34
|
-
data: (0,
|
|
34
|
+
data: (0, podverse_helpers_1.stringifyData)(payload.data),
|
|
35
35
|
};
|
|
36
36
|
try {
|
|
37
37
|
const resp = yield firebaseAdmin_1.firebaseAdmin.messaging().sendEachForMulticast(multicastMessage);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"firebaseNotificationOrchestrator.d.ts","sourceRoot":"","sources":["../../../../src/services/google/firebase/firebaseNotificationOrchestrator.ts"],"names":[],"mappings":"AAKA,KAAK,oBAAoB,GAAG,KAAK,GAAG,SAAS,GAAG,KAAK,
|
|
1
|
+
{"version":3,"file":"firebaseNotificationOrchestrator.d.ts","sourceRoot":"","sources":["../../../../src/services/google/firebase/firebaseNotificationOrchestrator.ts"],"names":[],"mappings":"AAKA,KAAK,oBAAoB,GAAG,KAAK,GAAG,SAAS,GAAG,KAAK,CAAC;AAEtD,KAAK,kBAAkB,GAAG;IACxB,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,oBAAoB,CAAC;IAE/B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;CAC5B,CAAC;AAEF,wBAAsB,qCAAqC,CAAC,MAAM,EAAE,kBAAkB,kBAuCrF"}
|
|
@@ -13,7 +13,6 @@ exports.firebaseNotificationBatchOrchestrator = firebaseNotificationBatchOrchest
|
|
|
13
13
|
const firebaseNotificationWeb_1 = require("./firebaseNotificationWeb");
|
|
14
14
|
const firebaseNotificationAndroid_1 = require("./firebaseNotificationAndroid");
|
|
15
15
|
const firebaseNotificationIOS_1 = require("./firebaseNotificationIOS");
|
|
16
|
-
const firebaseNotificationGeneric_1 = require("./firebaseNotificationGeneric");
|
|
17
16
|
function firebaseNotificationBatchOrchestrator(params) {
|
|
18
17
|
return __awaiter(this, void 0, void 0, function* () {
|
|
19
18
|
const { tokens, finalText, platform } = params;
|
|
@@ -26,7 +25,6 @@ function firebaseNotificationBatchOrchestrator(params) {
|
|
|
26
25
|
link: params.link,
|
|
27
26
|
data: params.data,
|
|
28
27
|
};
|
|
29
|
-
console.log(`Sending web notification with payload: ${JSON.stringify(payload)}`);
|
|
30
28
|
return yield (0, firebaseNotificationWeb_1.sendFirebaseNotificationBatchWeb)(tokens, payload);
|
|
31
29
|
}
|
|
32
30
|
case 'android': {
|
|
@@ -48,19 +46,6 @@ function firebaseNotificationBatchOrchestrator(params) {
|
|
|
48
46
|
};
|
|
49
47
|
return yield (0, firebaseNotificationIOS_1.sendFirebaseNotificationBatchIOS)(tokens, payload);
|
|
50
48
|
}
|
|
51
|
-
case 'generic': {
|
|
52
|
-
const payload = {
|
|
53
|
-
title: finalText,
|
|
54
|
-
body: '',
|
|
55
|
-
icon: params.icon,
|
|
56
|
-
link: params.link,
|
|
57
|
-
badge: params.badge,
|
|
58
|
-
channelId: params.channelId,
|
|
59
|
-
sound: params.sound,
|
|
60
|
-
data: params.data,
|
|
61
|
-
};
|
|
62
|
-
return yield (0, firebaseNotificationGeneric_1.sendFirebaseNotificationBatchGeneric)(tokens, payload);
|
|
63
|
-
}
|
|
64
49
|
default:
|
|
65
50
|
throw new Error(`Unsupported platform: ${platform}`);
|
|
66
51
|
}
|
|
@@ -10,14 +10,14 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.sendFirebaseNotificationBatchWeb = sendFirebaseNotificationBatchWeb;
|
|
13
|
-
const
|
|
13
|
+
const podverse_helpers_1 = require("podverse-helpers");
|
|
14
14
|
const web_1 = require("@external-services/config/web");
|
|
15
|
-
const
|
|
15
|
+
const firebaseAdmin_1 = require("./firebaseAdmin");
|
|
16
16
|
function sendFirebaseNotificationBatchWeb(tokens, payload) {
|
|
17
17
|
return __awaiter(this, void 0, void 0, function* () {
|
|
18
18
|
if (!firebaseAdmin_1.firebaseAdmin)
|
|
19
19
|
throw new Error("Firebase Admin is not initialized");
|
|
20
|
-
const chunks = (0,
|
|
20
|
+
const chunks = (0, podverse_helpers_1.chunkArray)(tokens, 500);
|
|
21
21
|
const results = [];
|
|
22
22
|
for (const chunk of chunks) {
|
|
23
23
|
const data = {
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export { firebaseAdmin } from './firebaseAdmin';
|
|
2
|
+
export { firebaseNotificationBatchOrchestrator } from './firebaseNotificationOrchestrator';
|
|
3
|
+
export { sendFirebaseNotificationBatchWeb } from './firebaseNotificationWeb';
|
|
4
|
+
export { sendFirebaseNotificationBatchAndroid } from './firebaseNotificationAndroid';
|
|
5
|
+
export { sendFirebaseNotificationBatchIOS } from './firebaseNotificationIOS';
|
|
6
|
+
export { sendFirebaseNotificationBatchGeneric } from './firebaseNotificationGeneric';
|
|
7
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/services/google/firebase/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,qCAAqC,EAAE,MAAM,oCAAoC,CAAC;AAC3F,OAAO,EAAE,gCAAgC,EAAE,MAAM,2BAA2B,CAAC;AAC7E,OAAO,EAAE,oCAAoC,EAAE,MAAM,+BAA+B,CAAC;AACrF,OAAO,EAAE,gCAAgC,EAAE,MAAM,2BAA2B,CAAC;AAC7E,OAAO,EAAE,oCAAoC,EAAE,MAAM,+BAA+B,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.sendFirebaseNotificationBatchGeneric = exports.sendFirebaseNotificationBatchIOS = exports.sendFirebaseNotificationBatchAndroid = exports.sendFirebaseNotificationBatchWeb = exports.firebaseNotificationBatchOrchestrator = exports.firebaseAdmin = void 0;
|
|
4
|
+
var firebaseAdmin_1 = require("./firebaseAdmin");
|
|
5
|
+
Object.defineProperty(exports, "firebaseAdmin", { enumerable: true, get: function () { return firebaseAdmin_1.firebaseAdmin; } });
|
|
6
|
+
var firebaseNotificationOrchestrator_1 = require("./firebaseNotificationOrchestrator");
|
|
7
|
+
Object.defineProperty(exports, "firebaseNotificationBatchOrchestrator", { enumerable: true, get: function () { return firebaseNotificationOrchestrator_1.firebaseNotificationBatchOrchestrator; } });
|
|
8
|
+
var firebaseNotificationWeb_1 = require("./firebaseNotificationWeb");
|
|
9
|
+
Object.defineProperty(exports, "sendFirebaseNotificationBatchWeb", { enumerable: true, get: function () { return firebaseNotificationWeb_1.sendFirebaseNotificationBatchWeb; } });
|
|
10
|
+
var firebaseNotificationAndroid_1 = require("./firebaseNotificationAndroid");
|
|
11
|
+
Object.defineProperty(exports, "sendFirebaseNotificationBatchAndroid", { enumerable: true, get: function () { return firebaseNotificationAndroid_1.sendFirebaseNotificationBatchAndroid; } });
|
|
12
|
+
var firebaseNotificationIOS_1 = require("./firebaseNotificationIOS");
|
|
13
|
+
Object.defineProperty(exports, "sendFirebaseNotificationBatchIOS", { enumerable: true, get: function () { return firebaseNotificationIOS_1.sendFirebaseNotificationBatchIOS; } });
|
|
14
|
+
var firebaseNotificationGeneric_1 = require("./firebaseNotificationGeneric");
|
|
15
|
+
Object.defineProperty(exports, "sendFirebaseNotificationBatchGeneric", { enumerable: true, get: function () { return firebaseNotificationGeneric_1.sendFirebaseNotificationBatchGeneric; } });
|
package/dist/services/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export * from './
|
|
2
|
-
export
|
|
3
|
-
export
|
|
1
|
+
export * from './google/firebase';
|
|
2
|
+
export * from './paypal';
|
|
3
|
+
export * from './podcast-index';
|
|
4
4
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/services/index.ts"],"names":[],"mappings":"AAAA,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/services/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC;AAClC,cAAc,UAAU,CAAC;AACzB,cAAc,iBAAiB,CAAC"}
|
package/dist/services/index.js
CHANGED
|
@@ -14,9 +14,6 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
|
|
18
|
-
__exportStar(require("./
|
|
19
|
-
|
|
20
|
-
Object.defineProperty(exports, "PayPalService", { enumerable: true, get: function () { return paypal_1.PayPalService; } });
|
|
21
|
-
var podcast_index_1 = require("./podcast-index");
|
|
22
|
-
Object.defineProperty(exports, "PodcastIndexService", { enumerable: true, get: function () { return podcast_index_1.PodcastIndexService; } });
|
|
17
|
+
__exportStar(require("./google/firebase"), exports);
|
|
18
|
+
__exportStar(require("./paypal"), exports);
|
|
19
|
+
__exportStar(require("./podcast-index"), exports);
|
|
@@ -29,7 +29,7 @@ class PodcastIndexService {
|
|
|
29
29
|
constructor({ userAgent, authKey, baseUrl, secretKey, loggerService }) {
|
|
30
30
|
// Request handler
|
|
31
31
|
this.podcastIndexAPIRequest = (url, config) => __awaiter(this, void 0, void 0, function* () {
|
|
32
|
-
var _a, _b
|
|
32
|
+
var _a, _b;
|
|
33
33
|
const apiHeaderTime = Math.floor(Date.now() / 1000);
|
|
34
34
|
const hash = (0, sha1_1.default)(this.authKey + this.secretKey + apiHeaderTime).toString(enc_hex_1.default);
|
|
35
35
|
try {
|
|
@@ -42,14 +42,14 @@ class PodcastIndexService {
|
|
|
42
42
|
return response === null || response === void 0 ? void 0 : response.data;
|
|
43
43
|
}
|
|
44
44
|
catch (error) {
|
|
45
|
-
|
|
45
|
+
const errorDetails = {
|
|
46
46
|
url,
|
|
47
47
|
errorMessage: error === null || error === void 0 ? void 0 : error.message,
|
|
48
48
|
errorStack: error === null || error === void 0 ? void 0 : error.stack,
|
|
49
49
|
errorResponse: (_a = error === null || error === void 0 ? void 0 : error.response) === null || _a === void 0 ? void 0 : _a.data,
|
|
50
|
-
errorStatus: (_b = error === null || error === void 0 ? void 0 : error.response) === null || _b === void 0 ? void 0 : _b.status
|
|
51
|
-
|
|
52
|
-
});
|
|
50
|
+
errorStatus: (_b = error === null || error === void 0 ? void 0 : error.response) === null || _b === void 0 ? void 0 : _b.status
|
|
51
|
+
};
|
|
52
|
+
this.loggerService.logError(`[PodcastIndex] Request failed: ${JSON.stringify(errorDetails, null, 2)}`);
|
|
53
53
|
throw error;
|
|
54
54
|
}
|
|
55
55
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "podverse-external-services",
|
|
3
|
-
"version": "5.1.
|
|
3
|
+
"version": "5.1.20-alpha.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -35,9 +35,9 @@
|
|
|
35
35
|
"eslint": "^9.35.0",
|
|
36
36
|
"nodemon": "^3.1.10",
|
|
37
37
|
"typescript": "^5.9.2",
|
|
38
|
-
"podverse-helpers": "5.1.
|
|
38
|
+
"podverse-helpers": "5.1.20-alpha.0"
|
|
39
39
|
},
|
|
40
40
|
"peerDependencies": {
|
|
41
|
-
"podverse-helpers": "5.1.
|
|
41
|
+
"podverse-helpers": "5.1.20-alpha.0"
|
|
42
42
|
}
|
|
43
43
|
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"firebaseHelpers.d.ts","sourceRoot":"","sources":["../../../../src/services/google/firebase/firebaseHelpers.ts"],"names":[],"mappings":"AAAA,wBAAgB,aAAa,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAKhF;AAED,wBAAgB,UAAU,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,EAAE,IAAI,SAAM,GAAG,CAAC,EAAE,EAAE,CAMzD"}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.stringifyData = stringifyData;
|
|
4
|
-
exports.chunkArray = chunkArray;
|
|
5
|
-
function stringifyData(data) {
|
|
6
|
-
if (!data)
|
|
7
|
-
return {};
|
|
8
|
-
return Object.fromEntries(Object.entries(data).map(([k, v]) => [k, typeof v === "string" ? v : JSON.stringify(v)]));
|
|
9
|
-
}
|
|
10
|
-
function chunkArray(arr, size = 500) {
|
|
11
|
-
const chunks = [];
|
|
12
|
-
for (let i = 0; i < arr.length; i += size) {
|
|
13
|
-
chunks.push(arr.slice(i, i + size));
|
|
14
|
-
}
|
|
15
|
-
return chunks;
|
|
16
|
-
}
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
export type NotificationMessageType = 'new' | 'new-episode' | 'new-podcast' | 'new-video' | 'new-video-channel' | 'new-track' | 'new-album' | 'livestream-started' | 'livestream-scheduled';
|
|
2
|
-
export type NotificationLocaleMap = Record<NotificationMessageType, string>;
|
|
3
|
-
export declare const i18nNotifications: Record<string, NotificationLocaleMap>;
|
|
4
|
-
//# sourceMappingURL=i18nNotifications.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"i18nNotifications.d.ts","sourceRoot":"","sources":["../../../src/services/notifications/i18nNotifications.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,uBAAuB,GAAG,KAAK,GACvC,aAAa,GAAG,aAAa,GAC7B,WAAW,GAAG,mBAAmB,GACjC,WAAW,GAAG,WAAW,GACzB,oBAAoB,GAAG,sBAAsB,CAAC;AAElD,MAAM,MAAM,qBAAqB,GAAG,MAAM,CAAC,uBAAuB,EAAE,MAAM,CAAC,CAAC;AAE5E,eAAO,MAAM,iBAAiB,EAAE,MAAM,CAAC,MAAM,EAAE,qBAAqB,CA6CnE,CAAA"}
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.i18nNotifications = void 0;
|
|
4
|
-
exports.i18nNotifications = {
|
|
5
|
-
"en": {
|
|
6
|
-
"new": "",
|
|
7
|
-
"new-episode": "",
|
|
8
|
-
"new-podcast": "",
|
|
9
|
-
"new-video": "",
|
|
10
|
-
"new-video-channel": "",
|
|
11
|
-
"new-track": "",
|
|
12
|
-
"new-album": "",
|
|
13
|
-
"livestream-started": "Live: ",
|
|
14
|
-
"livestream-scheduled": "Live Scheduled: "
|
|
15
|
-
},
|
|
16
|
-
"es": {
|
|
17
|
-
"new": "",
|
|
18
|
-
"new-episode": "",
|
|
19
|
-
"new-podcast": "",
|
|
20
|
-
"new-video": "",
|
|
21
|
-
"new-video-channel": "",
|
|
22
|
-
"new-track": "",
|
|
23
|
-
"new-album": "",
|
|
24
|
-
"livestream-started": "En vivo: ",
|
|
25
|
-
"livestream-scheduled": "En vivo programado: "
|
|
26
|
-
},
|
|
27
|
-
"fr": {
|
|
28
|
-
"new": "",
|
|
29
|
-
"new-episode": "",
|
|
30
|
-
"new-podcast": "",
|
|
31
|
-
"new-video": "",
|
|
32
|
-
"new-video-channel": "",
|
|
33
|
-
"new-track": "",
|
|
34
|
-
"new-album": "",
|
|
35
|
-
"livestream-started": "En direct: ",
|
|
36
|
-
"livestream-scheduled": "En direct programmé: "
|
|
37
|
-
},
|
|
38
|
-
"el-GR": {
|
|
39
|
-
"new": "",
|
|
40
|
-
"new-episode": "",
|
|
41
|
-
"new-podcast": "",
|
|
42
|
-
"new-video": "",
|
|
43
|
-
"new-video-channel": "",
|
|
44
|
-
"new-track": "",
|
|
45
|
-
"new-album": "",
|
|
46
|
-
"livestream-started": "Ζωντανά: ",
|
|
47
|
-
"livestream-scheduled": "Προγραμματισμένα ζωντανά: "
|
|
48
|
-
}
|
|
49
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/services/notifications/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAC;AACpC,cAAc,4BAA4B,CAAC"}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./i18nNotifications"), exports);
|
|
18
|
-
__exportStar(require("./notificationOrchestrator"), exports);
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { NotificationMessageType } from './i18nNotifications';
|
|
2
|
-
export type NotificationPlatform = 'web' | 'android' | 'ios' | 'generic';
|
|
3
|
-
export type NotificationService = 'firebase';
|
|
4
|
-
type NotificationOrchestratorParams = {
|
|
5
|
-
service: NotificationService;
|
|
6
|
-
tokens: string[];
|
|
7
|
-
messageText: string;
|
|
8
|
-
messageType: NotificationMessageType;
|
|
9
|
-
locale: string;
|
|
10
|
-
platform: NotificationPlatform;
|
|
11
|
-
icon?: string;
|
|
12
|
-
linkIdText?: string;
|
|
13
|
-
channelId?: string;
|
|
14
|
-
badge?: number;
|
|
15
|
-
sound?: string;
|
|
16
|
-
data?: Record<string, any>;
|
|
17
|
-
};
|
|
18
|
-
export declare function notificationOrchestrator(params: NotificationOrchestratorParams): Promise<any[]>;
|
|
19
|
-
export {};
|
|
20
|
-
//# sourceMappingURL=notificationOrchestrator.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"notificationOrchestrator.d.ts","sourceRoot":"","sources":["../../../src/services/notifications/notificationOrchestrator.ts"],"names":[],"mappings":"AACA,OAAO,EAAqB,uBAAuB,EAAE,MAAM,qBAAqB,CAAC;AAEjF,MAAM,MAAM,oBAAoB,GAAG,KAAK,GAAG,SAAS,GAAG,KAAK,GAAG,SAAS,CAAC;AACzE,MAAM,MAAM,mBAAmB,GAAG,UAAU,CAAC;AA4B7C,KAAK,8BAA8B,GAAG;IACpC,OAAO,EAAE,mBAAmB,CAAC;IAC7B,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,uBAAuB,CAAC;IACrC,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,oBAAoB,CAAC;IAE/B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;CAC5B,CAAC;AASF,wBAAsB,wBAAwB,CAAC,MAAM,EAAE,8BAA8B,kBA6CpF"}
|
|
@@ -1,96 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
12
|
-
var t = {};
|
|
13
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
14
|
-
t[p] = s[p];
|
|
15
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
16
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
17
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
18
|
-
t[p[i]] = s[p[i]];
|
|
19
|
-
}
|
|
20
|
-
return t;
|
|
21
|
-
};
|
|
22
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
23
|
-
exports.notificationOrchestrator = notificationOrchestrator;
|
|
24
|
-
const firebaseNotificationOrchestrator_1 = require("../google/firebase/firebaseNotificationOrchestrator");
|
|
25
|
-
const i18nNotifications_1 = require("./i18nNotifications");
|
|
26
|
-
/**
|
|
27
|
-
* Gets the URL path prefix for a given notification message type
|
|
28
|
-
*/
|
|
29
|
-
function getLinkPathFromMessageType(messageType) {
|
|
30
|
-
switch (messageType) {
|
|
31
|
-
case 'new-episode':
|
|
32
|
-
return '/episode';
|
|
33
|
-
case 'new-podcast':
|
|
34
|
-
return '/podcast';
|
|
35
|
-
case 'new-video':
|
|
36
|
-
return '/video';
|
|
37
|
-
case 'new-video-channel':
|
|
38
|
-
return '/channel';
|
|
39
|
-
case 'new-track':
|
|
40
|
-
return '/track';
|
|
41
|
-
case 'new-album':
|
|
42
|
-
return '/album';
|
|
43
|
-
case 'livestream-started':
|
|
44
|
-
case 'livestream-scheduled':
|
|
45
|
-
return '/livestream';
|
|
46
|
-
case 'new':
|
|
47
|
-
default:
|
|
48
|
-
return '';
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
function getFinalText(messageText, messageType, locale) {
|
|
52
|
-
const baseLocale = locale.includes('-') ? locale.split('-')[0] : locale;
|
|
53
|
-
const localeMap = i18nNotifications_1.i18nNotifications[locale] || i18nNotifications_1.i18nNotifications[baseLocale] || i18nNotifications_1.i18nNotifications.en;
|
|
54
|
-
const prefix = localeMap[messageType] || i18nNotifications_1.i18nNotifications.en[messageType];
|
|
55
|
-
return `${prefix}${messageText}`;
|
|
56
|
-
}
|
|
57
|
-
function notificationOrchestrator(params) {
|
|
58
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
59
|
-
const { service, messageText, messageType, locale, linkIdText } = params, serviceParams = __rest(params, ["service", "messageText", "messageType", "locale", "linkIdText"]);
|
|
60
|
-
const finalText = getFinalText(messageText, messageType, locale);
|
|
61
|
-
// Construct the link from messageType and linkIdText
|
|
62
|
-
let link;
|
|
63
|
-
if (linkIdText) {
|
|
64
|
-
const pathPrefix = getLinkPathFromMessageType(messageType);
|
|
65
|
-
link = pathPrefix ? `${pathPrefix}/${linkIdText}` : undefined;
|
|
66
|
-
}
|
|
67
|
-
console.log('[notificationOrchestrator] params:', {
|
|
68
|
-
service,
|
|
69
|
-
tokens: params.tokens,
|
|
70
|
-
messageText,
|
|
71
|
-
messageType,
|
|
72
|
-
locale,
|
|
73
|
-
platform: params.platform,
|
|
74
|
-
icon: params.icon,
|
|
75
|
-
linkIdText,
|
|
76
|
-
channelId: params.channelId,
|
|
77
|
-
badge: params.badge,
|
|
78
|
-
sound: params.sound,
|
|
79
|
-
data: params.data,
|
|
80
|
-
finalText,
|
|
81
|
-
link
|
|
82
|
-
});
|
|
83
|
-
switch (service) {
|
|
84
|
-
case 'firebase':
|
|
85
|
-
return yield (0, firebaseNotificationOrchestrator_1.firebaseNotificationBatchOrchestrator)(Object.assign(Object.assign({}, serviceParams), { finalText,
|
|
86
|
-
link }));
|
|
87
|
-
// Future services can be added here:
|
|
88
|
-
// case 'onesignal':
|
|
89
|
-
// return await onesignalNotificationOrchestrator(serviceParams);
|
|
90
|
-
// case 'pusher':
|
|
91
|
-
// return await pusherNotificationOrchestrator(serviceParams);
|
|
92
|
-
default:
|
|
93
|
-
throw new Error(`Unsupported notification service: ${service}`);
|
|
94
|
-
}
|
|
95
|
-
});
|
|
96
|
-
}
|