{"version":3,"file":"process-feature-announcement.mjs","sourceRoot":"","sources":["../../../src/NotificationServicesController/processors/process-feature-announcement.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,gBAAgB,EAAE,wCAAoC;AAE/D;;;;;;;GAOG;AACH,MAAM,UAAU,yBAAyB,CACvC,YAAqD,EACrD,6BAAuC;IAEvC,IAAI,6BAA6B,CAAC,QAAQ,CAAC,YAAY,CAAC,EAAE,CAAC,EAAE,CAAC;QAC5D,OAAO,IAAI,CAAC;IACd,CAAC;IACD,OAAO,gBAAgB,CAAC,IAAI,IAAI,CAAC,YAAY,CAAC,SAAS,CAAC,CAAC,CAAC;AAC5D,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,0BAA0B,CACxC,YAAgD;IAEhD,OAAO;QACL,IAAI,EAAE,YAAY,CAAC,IAAI;QACvB,EAAE,EAAE,YAAY,CAAC,IAAI,CAAC,EAAE;QACxB,SAAS,EAAE,IAAI,IAAI,CAAC,YAAY,CAAC,SAAS,CAAC,CAAC,WAAW,EAAE;QACzD,IAAI,EAAE,YAAY,CAAC,IAAI;QACvB,MAAM,EAAE,KAAK;KACd,CAAC;AACJ,CAAC","sourcesContent":["import type { FeatureAnnouncementRawNotification } from '../types/feature-announcement/feature-announcement';\nimport type { INotification } from '../types/notification/notification';\nimport { shouldAutoExpire } from '../utils/should-auto-expire';\n\n/**\n * Checks if a feature announcement should be read.\n * Checks feature announcement state (from param), as well as if the notification is \"expired\"\n *\n * @param notification - notification to check\n * @param readPlatformNotificationsList - list of read notifications\n * @returns boolean if notification should be marked as read or unread\n */\nexport function isFeatureAnnouncementRead(\n  notification: Pick<INotification, 'id' | 'createdAt'>,\n  readPlatformNotificationsList: string[],\n): boolean {\n  if (readPlatformNotificationsList.includes(notification.id)) {\n    return true;\n  }\n  return shouldAutoExpire(new Date(notification.createdAt));\n}\n\n/**\n * Processes a feature announcement into a shared/normalised notification shape.\n *\n * @param notification - raw feature announcement\n * @returns a normalised feature announcement\n */\nexport function processFeatureAnnouncement(\n  notification: FeatureAnnouncementRawNotification,\n): INotification {\n  return {\n    type: notification.type,\n    id: notification.data.id,\n    createdAt: new Date(notification.createdAt).toISOString(),\n    data: notification.data,\n    isRead: false,\n  };\n}\n"]}