podverse-notifications 5.1.19-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.
@@ -9,6 +9,7 @@ type BaseNotificationOrchestratorParams = {
9
9
  locale: string;
10
10
  icon?: string;
11
11
  linkIdText?: string;
12
+ mediumId: number;
12
13
  data?: Record<string, unknown>;
13
14
  };
14
15
  type FirebaseNotificationOrchestratorParams = BaseNotificationOrchestratorParams & {
@@ -1 +1 @@
1
- {"version":3,"file":"notificationOrchestrator.d.ts","sourceRoot":"","sources":["../../../src/services/notifications/notificationOrchestrator.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AAEjD,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAChD,OAAO,EAAqB,uBAAuB,EAAE,MAAM,qBAAqB,CAAC;AAEjF,MAAM,MAAM,oBAAoB,GAAG,KAAK,GAAG,SAAS,GAAG,KAAK,CAAC;AAC7D,MAAM,MAAM,mBAAmB,GAAG,UAAU,GAAG,SAAS,GAAG,aAAa,CAAC;AA6BzE,KAAK,kCAAkC,GAAG;IACxC,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,uBAAuB,CAAC;IACrC,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAChC,CAAC;AAGF,KAAK,sCAAsC,GAAG,kCAAkC,GAAG;IACjF,OAAO,EAAE,UAAU,CAAC;IACpB,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,QAAQ,EAAE,oBAAoB,CAAC;IAC/B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC;AAGF,KAAK,qCAAqC,GAAG,kCAAkC,GAAG;IAChF,OAAO,EAAE,SAAS,CAAC;IACnB,aAAa,EAAE,mBAAmB,EAAE,CAAC;CACtC,CAAC;AAGF,KAAK,yCAAyC,GAAG,kCAAkC,GAAG;IACpF,OAAO,EAAE,aAAa,CAAC;IACvB,aAAa,EAAE,cAAc,EAAE,CAAC;CACjC,CAAC;AAEF,MAAM,MAAM,8BAA8B,GACtC,sCAAsC,GACtC,qCAAqC,GACrC,yCAAyC,CAAC;AAS9C,wBAAsB,wBAAwB,CAAC,MAAM,EAAE,8BAA8B,kBAoDpF"}
1
+ {"version":3,"file":"notificationOrchestrator.d.ts","sourceRoot":"","sources":["../../../src/services/notifications/notificationOrchestrator.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AAEjD,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAChD,OAAO,EAAqB,uBAAuB,EAAE,MAAM,qBAAqB,CAAC;AAEjF,MAAM,MAAM,oBAAoB,GAAG,KAAK,GAAG,SAAS,GAAG,KAAK,CAAC;AAC7D,MAAM,MAAM,mBAAmB,GAAG,UAAU,GAAG,SAAS,GAAG,aAAa,CAAC;AAmCzE,KAAK,kCAAkC,GAAG;IACxC,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,uBAAuB,CAAC;IACrC,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAChC,CAAC;AAGF,KAAK,sCAAsC,GAAG,kCAAkC,GAAG;IACjF,OAAO,EAAE,UAAU,CAAC;IACpB,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,QAAQ,EAAE,oBAAoB,CAAC;IAC/B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC;AAGF,KAAK,qCAAqC,GAAG,kCAAkC,GAAG;IAChF,OAAO,EAAE,SAAS,CAAC;IACnB,aAAa,EAAE,mBAAmB,EAAE,CAAC;CACtC,CAAC;AAGF,KAAK,yCAAyC,GAAG,kCAAkC,GAAG;IACpF,OAAO,EAAE,aAAa,CAAC;IACvB,aAAa,EAAE,cAAc,EAAE,CAAC;CACjC,CAAC;AAEF,MAAM,MAAM,8BAA8B,GACtC,sCAAsC,GACtC,qCAAqC,GACrC,yCAAyC,CAAC;AAS9C,wBAAsB,wBAAwB,CAAC,MAAM,EAAE,8BAA8B,kBAoDpF"}
@@ -10,14 +10,17 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.notificationOrchestrator = notificationOrchestrator;
13
+ const podverse_helpers_1 = require("podverse-helpers");
13
14
  const podverse_external_services_1 = require("podverse-external-services");
14
15
  const webpush_1 = require("../webpush");
15
16
  const unifiedpush_1 = require("../unifiedpush");
16
17
  const i18nNotifications_1 = require("./i18nNotifications");
17
18
  /**
18
19
  * Gets the URL path prefix for a given notification message type
20
+ * @param messageType - The type of notification message
21
+ * @param mediumId - Medium ID for medium-specific paths (e.g., livestreams)
19
22
  */
20
- function getLinkPathFromMessageType(messageType) {
23
+ function getLinkPathFromMessageType(messageType, mediumId) {
21
24
  switch (messageType) {
22
25
  case 'new-episode':
23
26
  return '/episode';
@@ -33,7 +36,11 @@ function getLinkPathFromMessageType(messageType) {
33
36
  return '/album';
34
37
  case 'livestream-started':
35
38
  case 'livestream-scheduled':
36
- return '/livestream';
39
+ // Music livestreams use /music/livestream, all others use /podcast/livestream
40
+ if (mediumId === podverse_helpers_1.MediumEnum.Music) {
41
+ return '/music/livestream';
42
+ }
43
+ return '/podcast/livestream';
37
44
  case 'new':
38
45
  default:
39
46
  return '';
@@ -47,12 +54,12 @@ function getFinalText(messageText, messageType, locale) {
47
54
  }
48
55
  function notificationOrchestrator(params) {
49
56
  return __awaiter(this, void 0, void 0, function* () {
50
- const { service, messageText, messageType, locale, linkIdText, icon, data } = params;
57
+ const { service, messageText, messageType, locale, linkIdText, mediumId, icon, data } = params;
51
58
  const finalText = getFinalText(messageText, messageType, locale);
52
- // Construct the link from messageType and linkIdText
59
+ // Construct the link from messageType, mediumId, and linkIdText
53
60
  let link;
54
61
  if (linkIdText) {
55
- const pathPrefix = getLinkPathFromMessageType(messageType);
62
+ const pathPrefix = getLinkPathFromMessageType(messageType, mediumId);
56
63
  link = pathPrefix ? `${pathPrefix}/${linkIdText}` : undefined;
57
64
  }
58
65
  switch (service) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "podverse-notifications",
3
- "version": "5.1.19-alpha.0",
3
+ "version": "5.1.20-alpha.0",
4
4
  "description": "Push notification helper module for Podverse use cases",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -17,8 +17,8 @@
17
17
  "license": "AGPLv3",
18
18
  "dependencies": {
19
19
  "module-alias": "^2.2.3",
20
- "podverse-external-services": "^5.1.19-alpha.0",
21
- "podverse-helpers": "^5.1.19-alpha.0",
20
+ "podverse-external-services": "^5.1.20-alpha.0",
21
+ "podverse-helpers": "^5.1.20-alpha.0",
22
22
  "web-push": "^3.6.7"
23
23
  },
24
24
  "devDependencies": {