( targetedNotifications: $ReadOnlyArray<TargetedWebNotification>, notificationInfo: NotificationInfo, )
| 1301 | +invalidTokens?: $ReadOnlyArray<string>, |
| 1302 | }; |
| 1303 | async function sendWebNotifications( |
| 1304 | targetedNotifications: $ReadOnlyArray<TargetedWebNotification>, |
| 1305 | notificationInfo: NotificationInfo, |
| 1306 | ): Promise<WebResult> { |
| 1307 | const { source, codeVersion, stateVersion } = notificationInfo; |
| 1308 | |
| 1309 | const response = await webPush(targetedNotifications); |
| 1310 | |
| 1311 | const deviceTokens = targetedNotifications.map( |
| 1312 | ({ deliveryID }) => deliveryID, |
| 1313 | ); |
| 1314 | const delivery: WebDelivery = { |
| 1315 | source, |
| 1316 | deviceType: 'web', |
| 1317 | deviceTokens, |
| 1318 | codeVersion, |
| 1319 | errors: response.errors, |
| 1320 | stateVersion, |
| 1321 | }; |
| 1322 | const result: WebResult = { |
| 1323 | info: notificationInfo, |
| 1324 | delivery, |
| 1325 | invalidTokens: response.invalidTokens, |
| 1326 | }; |
| 1327 | return result; |
| 1328 | } |
| 1329 | |
| 1330 | type WNSDelivery = { |
| 1331 | +source: NotificationInfo['source'], |
no test coverage detected