@aws-amplify/notifications 2.0.1-console-preview.d745d43.0 → 2.0.1-ssr-api.df60e41.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.
Files changed (458) hide show
  1. package/lib/eventListeners/eventListeners.js +7 -4
  2. package/lib/eventListeners/index.js +4 -4
  3. package/lib/eventListeners/types.d.ts +2 -2
  4. package/lib/eventListeners/types.js +0 -1
  5. package/lib/inAppMessaging/errors/InAppMessagingError.js +1 -1
  6. package/lib/inAppMessaging/errors/assertServiceError.js +1 -1
  7. package/lib/inAppMessaging/errors/assertValidationError.js +1 -1
  8. package/lib/inAppMessaging/errors/index.js +6 -6
  9. package/lib/inAppMessaging/errors/validation.js +1 -1
  10. package/lib/inAppMessaging/index.d.ts +1 -1
  11. package/lib/inAppMessaging/index.js +12 -11
  12. package/lib/inAppMessaging/providers/pinpoint/apis/clearMessages.d.ts +13 -0
  13. package/lib/inAppMessaging/providers/pinpoint/apis/clearMessages.js +26 -0
  14. package/lib/inAppMessaging/providers/pinpoint/apis/dispatchEvent.js +10 -8
  15. package/lib/inAppMessaging/providers/pinpoint/apis/identifyUser.d.ts +2 -1
  16. package/lib/inAppMessaging/providers/pinpoint/apis/identifyUser.js +8 -7
  17. package/lib/inAppMessaging/providers/pinpoint/apis/index.d.ts +1 -0
  18. package/lib/inAppMessaging/providers/pinpoint/apis/index.js +13 -11
  19. package/lib/inAppMessaging/providers/pinpoint/apis/initializeInAppMessaging.js +11 -11
  20. package/lib/inAppMessaging/providers/pinpoint/apis/notifyMessageInteraction.js +3 -3
  21. package/lib/inAppMessaging/providers/pinpoint/apis/onMessageActionTaken.js +3 -3
  22. package/lib/inAppMessaging/providers/pinpoint/apis/onMessageDismissed.js +3 -3
  23. package/lib/inAppMessaging/providers/pinpoint/apis/onMessageDisplayed.js +3 -3
  24. package/lib/inAppMessaging/providers/pinpoint/apis/onMessageReceived.js +3 -3
  25. package/lib/inAppMessaging/providers/pinpoint/apis/setConflictHandler.js +2 -2
  26. package/lib/inAppMessaging/providers/pinpoint/apis/syncMessages.js +9 -9
  27. package/lib/inAppMessaging/providers/pinpoint/index.d.ts +1 -1
  28. package/lib/inAppMessaging/providers/pinpoint/index.js +12 -11
  29. package/lib/inAppMessaging/providers/pinpoint/types/index.js +2 -2
  30. package/lib/inAppMessaging/providers/pinpoint/types/inputs.d.ts +8 -8
  31. package/lib/inAppMessaging/providers/pinpoint/types/inputs.js +0 -1
  32. package/lib/inAppMessaging/providers/pinpoint/types/options.d.ts +1 -1
  33. package/lib/inAppMessaging/providers/pinpoint/types/options.js +0 -1
  34. package/lib/inAppMessaging/providers/pinpoint/types/outputs.d.ts +4 -4
  35. package/lib/inAppMessaging/providers/pinpoint/types/outputs.js +0 -1
  36. package/lib/inAppMessaging/providers/pinpoint/types/types.d.ts +6 -6
  37. package/lib/inAppMessaging/providers/pinpoint/types/types.js +1 -1
  38. package/lib/inAppMessaging/providers/pinpoint/utils/constants.js +1 -1
  39. package/lib/inAppMessaging/providers/pinpoint/utils/helpers.d.ts +2 -2
  40. package/lib/inAppMessaging/providers/pinpoint/utils/helpers.js +38 -24
  41. package/lib/inAppMessaging/providers/pinpoint/utils/index.js +11 -11
  42. package/lib/inAppMessaging/providers/pinpoint/utils/messageProcessingHelpers.js +8 -8
  43. package/lib/inAppMessaging/providers/pinpoint/utils/resolveConfig.js +5 -4
  44. package/lib/inAppMessaging/providers/pinpoint/utils/resolveCredentials.js +5 -4
  45. package/lib/inAppMessaging/providers/pinpoint/utils/userAgent.js +3 -3
  46. package/lib/inAppMessaging/types/event.d.ts +2 -2
  47. package/lib/inAppMessaging/types/event.js +0 -1
  48. package/lib/inAppMessaging/types/index.js +0 -1
  49. package/lib/inAppMessaging/types/inputs.d.ts +1 -1
  50. package/lib/inAppMessaging/types/inputs.js +0 -1
  51. package/lib/inAppMessaging/types/message.d.ts +3 -3
  52. package/lib/inAppMessaging/types/message.js +0 -1
  53. package/lib/inAppMessaging/types/options.d.ts +1 -1
  54. package/lib/inAppMessaging/types/options.js +0 -1
  55. package/lib/inAppMessaging/utils/index.js +4 -4
  56. package/lib/inAppMessaging/utils/statusHelpers.js +6 -4
  57. package/lib/index.js +0 -1
  58. package/lib/pushNotifications/errors/PushNotificationError.js +1 -1
  59. package/lib/pushNotifications/errors/errorHelpers.js +5 -4
  60. package/lib/pushNotifications/errors/index.js +4 -4
  61. package/lib/pushNotifications/index.js +13 -13
  62. package/lib/pushNotifications/providers/pinpoint/apis/getBadgeCount.js +3 -2
  63. package/lib/pushNotifications/providers/pinpoint/apis/getBadgeCount.native.js +5 -4
  64. package/lib/pushNotifications/providers/pinpoint/apis/getLaunchNotification.js +3 -2
  65. package/lib/pushNotifications/providers/pinpoint/apis/getLaunchNotification.native.js +5 -4
  66. package/lib/pushNotifications/providers/pinpoint/apis/getPermissionStatus.js +3 -2
  67. package/lib/pushNotifications/providers/pinpoint/apis/getPermissionStatus.native.js +5 -4
  68. package/lib/pushNotifications/providers/pinpoint/apis/identifyUser.js +3 -2
  69. package/lib/pushNotifications/providers/pinpoint/apis/identifyUser.native.js +9 -8
  70. package/lib/pushNotifications/providers/pinpoint/apis/index.js +12 -12
  71. package/lib/pushNotifications/providers/pinpoint/apis/initializePushNotifications.js +3 -2
  72. package/lib/pushNotifications/providers/pinpoint/apis/initializePushNotifications.native.js +45 -36
  73. package/lib/pushNotifications/providers/pinpoint/apis/onNotificationOpened.js +3 -2
  74. package/lib/pushNotifications/providers/pinpoint/apis/onNotificationOpened.native.js +5 -4
  75. package/lib/pushNotifications/providers/pinpoint/apis/onNotificationReceivedInBackground.js +3 -2
  76. package/lib/pushNotifications/providers/pinpoint/apis/onNotificationReceivedInBackground.native.js +5 -4
  77. package/lib/pushNotifications/providers/pinpoint/apis/onNotificationReceivedInForeground.js +3 -2
  78. package/lib/pushNotifications/providers/pinpoint/apis/onNotificationReceivedInForeground.native.js +5 -4
  79. package/lib/pushNotifications/providers/pinpoint/apis/onTokenReceived.js +3 -2
  80. package/lib/pushNotifications/providers/pinpoint/apis/onTokenReceived.native.js +5 -4
  81. package/lib/pushNotifications/providers/pinpoint/apis/requestPermissions.js +3 -2
  82. package/lib/pushNotifications/providers/pinpoint/apis/requestPermissions.native.js +5 -4
  83. package/lib/pushNotifications/providers/pinpoint/apis/setBadgeCount.js +3 -2
  84. package/lib/pushNotifications/providers/pinpoint/apis/setBadgeCount.native.js +5 -4
  85. package/lib/pushNotifications/providers/pinpoint/index.js +12 -12
  86. package/lib/pushNotifications/providers/pinpoint/types/analytics.d.ts +3 -3
  87. package/lib/pushNotifications/providers/pinpoint/types/analytics.js +0 -1
  88. package/lib/pushNotifications/providers/pinpoint/types/apis.d.ts +11 -11
  89. package/lib/pushNotifications/providers/pinpoint/types/apis.js +0 -1
  90. package/lib/pushNotifications/providers/pinpoint/types/index.js +0 -1
  91. package/lib/pushNotifications/providers/pinpoint/types/inputs.d.ts +7 -7
  92. package/lib/pushNotifications/providers/pinpoint/types/inputs.js +0 -1
  93. package/lib/pushNotifications/providers/pinpoint/types/options.d.ts +1 -1
  94. package/lib/pushNotifications/providers/pinpoint/types/options.js +0 -1
  95. package/lib/pushNotifications/providers/pinpoint/types/outputs.d.ts +8 -8
  96. package/lib/pushNotifications/providers/pinpoint/types/outputs.js +0 -1
  97. package/lib/pushNotifications/providers/pinpoint/types/pushNotifications.d.ts +1 -1
  98. package/lib/pushNotifications/providers/pinpoint/types/pushNotifications.js +0 -1
  99. package/lib/pushNotifications/providers/pinpoint/utils/createMessageEventRecorder.d.ts +3 -2
  100. package/lib/pushNotifications/providers/pinpoint/utils/createMessageEventRecorder.js +10 -8
  101. package/lib/pushNotifications/providers/pinpoint/utils/getAnalyticsEvent.d.ts +3 -2
  102. package/lib/pushNotifications/providers/pinpoint/utils/getAnalyticsEvent.js +3 -2
  103. package/lib/pushNotifications/providers/pinpoint/utils/getChannelType.d.ts +2 -1
  104. package/lib/pushNotifications/providers/pinpoint/utils/getChannelType.js +4 -3
  105. package/lib/pushNotifications/providers/pinpoint/utils/index.d.ts +2 -1
  106. package/lib/pushNotifications/providers/pinpoint/utils/index.js +7 -5
  107. package/lib/pushNotifications/{utils → providers/pinpoint/utils}/resolveConfig.js +6 -5
  108. package/lib/pushNotifications/types/errors.js +1 -1
  109. package/lib/pushNotifications/types/index.js +19 -3
  110. package/lib/pushNotifications/types/inputs.d.ts +7 -7
  111. package/lib/pushNotifications/types/inputs.js +0 -1
  112. package/lib/pushNotifications/types/options.d.ts +1 -1
  113. package/lib/pushNotifications/types/options.js +0 -1
  114. package/lib/pushNotifications/types/outputs.d.ts +8 -8
  115. package/lib/pushNotifications/types/outputs.js +0 -1
  116. package/lib/pushNotifications/types/pushNotifications.d.ts +3 -3
  117. package/lib/pushNotifications/types/pushNotifications.js +0 -1
  118. package/lib/pushNotifications/{providers/pinpoint/utils → utils}/getPushNotificationUserAgentString.js +3 -2
  119. package/lib/pushNotifications/utils/index.d.ts +1 -1
  120. package/lib/pushNotifications/utils/index.js +8 -8
  121. package/lib/pushNotifications/utils/initializationManager.js +5 -3
  122. package/lib/pushNotifications/utils/resolveCredentials.js +5 -4
  123. package/lib/pushNotifications/utils/tokenManager.js +5 -3
  124. package/lib/tsconfig.tsbuildinfo +1 -7201
  125. package/lib-esm/eventListeners/eventListeners.js +0 -1
  126. package/lib-esm/eventListeners/index.js +0 -1
  127. package/lib-esm/eventListeners/types.d.ts +2 -2
  128. package/lib-esm/eventListeners/types.js +1 -1
  129. package/lib-esm/inAppMessaging/errors/InAppMessagingError.js +0 -1
  130. package/lib-esm/inAppMessaging/errors/assertServiceError.js +0 -1
  131. package/lib-esm/inAppMessaging/errors/assertValidationError.js +0 -1
  132. package/lib-esm/inAppMessaging/errors/index.js +0 -1
  133. package/lib-esm/inAppMessaging/errors/validation.js +0 -1
  134. package/lib-esm/inAppMessaging/index.d.ts +1 -1
  135. package/lib-esm/inAppMessaging/index.js +1 -2
  136. package/lib-esm/inAppMessaging/providers/pinpoint/apis/clearMessages.d.ts +13 -0
  137. package/lib-esm/inAppMessaging/providers/pinpoint/apis/clearMessages.js +22 -0
  138. package/lib-esm/inAppMessaging/providers/pinpoint/apis/dispatchEvent.js +0 -1
  139. package/lib-esm/inAppMessaging/providers/pinpoint/apis/identifyUser.d.ts +2 -1
  140. package/lib-esm/inAppMessaging/providers/pinpoint/apis/identifyUser.js +0 -1
  141. package/lib-esm/inAppMessaging/providers/pinpoint/apis/index.d.ts +1 -0
  142. package/lib-esm/inAppMessaging/providers/pinpoint/apis/index.js +1 -1
  143. package/lib-esm/inAppMessaging/providers/pinpoint/apis/initializeInAppMessaging.js +0 -1
  144. package/lib-esm/inAppMessaging/providers/pinpoint/apis/notifyMessageInteraction.js +0 -1
  145. package/lib-esm/inAppMessaging/providers/pinpoint/apis/onMessageActionTaken.js +0 -1
  146. package/lib-esm/inAppMessaging/providers/pinpoint/apis/onMessageDismissed.js +0 -1
  147. package/lib-esm/inAppMessaging/providers/pinpoint/apis/onMessageDisplayed.js +0 -1
  148. package/lib-esm/inAppMessaging/providers/pinpoint/apis/onMessageReceived.js +0 -1
  149. package/lib-esm/inAppMessaging/providers/pinpoint/apis/setConflictHandler.js +0 -1
  150. package/lib-esm/inAppMessaging/providers/pinpoint/apis/syncMessages.js +0 -1
  151. package/lib-esm/inAppMessaging/providers/pinpoint/index.d.ts +1 -1
  152. package/lib-esm/inAppMessaging/providers/pinpoint/index.js +1 -2
  153. package/lib-esm/inAppMessaging/providers/pinpoint/types/index.js +0 -1
  154. package/lib-esm/inAppMessaging/providers/pinpoint/types/inputs.d.ts +8 -8
  155. package/lib-esm/inAppMessaging/providers/pinpoint/types/inputs.js +1 -1
  156. package/lib-esm/inAppMessaging/providers/pinpoint/types/options.d.ts +1 -1
  157. package/lib-esm/inAppMessaging/providers/pinpoint/types/options.js +1 -1
  158. package/lib-esm/inAppMessaging/providers/pinpoint/types/outputs.d.ts +4 -4
  159. package/lib-esm/inAppMessaging/providers/pinpoint/types/outputs.js +1 -1
  160. package/lib-esm/inAppMessaging/providers/pinpoint/types/types.d.ts +6 -6
  161. package/lib-esm/inAppMessaging/providers/pinpoint/types/types.js +0 -1
  162. package/lib-esm/inAppMessaging/providers/pinpoint/utils/constants.js +0 -1
  163. package/lib-esm/inAppMessaging/providers/pinpoint/utils/helpers.d.ts +2 -2
  164. package/lib-esm/inAppMessaging/providers/pinpoint/utils/helpers.js +0 -1
  165. package/lib-esm/inAppMessaging/providers/pinpoint/utils/index.js +0 -1
  166. package/lib-esm/inAppMessaging/providers/pinpoint/utils/messageProcessingHelpers.js +0 -1
  167. package/lib-esm/inAppMessaging/providers/pinpoint/utils/resolveConfig.js +0 -1
  168. package/lib-esm/inAppMessaging/providers/pinpoint/utils/resolveCredentials.js +0 -1
  169. package/lib-esm/inAppMessaging/providers/pinpoint/utils/userAgent.js +0 -1
  170. package/lib-esm/inAppMessaging/types/event.d.ts +2 -2
  171. package/lib-esm/inAppMessaging/types/event.js +1 -1
  172. package/lib-esm/inAppMessaging/types/index.js +1 -1
  173. package/lib-esm/inAppMessaging/types/inputs.d.ts +1 -1
  174. package/lib-esm/inAppMessaging/types/inputs.js +1 -1
  175. package/lib-esm/inAppMessaging/types/message.d.ts +3 -3
  176. package/lib-esm/inAppMessaging/types/message.js +1 -1
  177. package/lib-esm/inAppMessaging/types/options.d.ts +1 -1
  178. package/lib-esm/inAppMessaging/types/options.js +1 -1
  179. package/lib-esm/inAppMessaging/utils/index.js +0 -1
  180. package/lib-esm/inAppMessaging/utils/statusHelpers.js +0 -1
  181. package/lib-esm/index.js +0 -1
  182. package/lib-esm/pushNotifications/errors/PushNotificationError.js +0 -1
  183. package/lib-esm/pushNotifications/errors/errorHelpers.js +0 -1
  184. package/lib-esm/pushNotifications/errors/index.js +0 -1
  185. package/lib-esm/pushNotifications/index.js +0 -1
  186. package/lib-esm/pushNotifications/providers/pinpoint/apis/getBadgeCount.js +1 -2
  187. package/lib-esm/pushNotifications/providers/pinpoint/apis/getBadgeCount.native.js +0 -1
  188. package/lib-esm/pushNotifications/providers/pinpoint/apis/getLaunchNotification.js +1 -2
  189. package/lib-esm/pushNotifications/providers/pinpoint/apis/getLaunchNotification.native.js +1 -2
  190. package/lib-esm/pushNotifications/providers/pinpoint/apis/getPermissionStatus.js +1 -2
  191. package/lib-esm/pushNotifications/providers/pinpoint/apis/getPermissionStatus.native.js +1 -2
  192. package/lib-esm/pushNotifications/providers/pinpoint/apis/identifyUser.js +1 -2
  193. package/lib-esm/pushNotifications/providers/pinpoint/apis/identifyUser.native.js +2 -3
  194. package/lib-esm/pushNotifications/providers/pinpoint/apis/index.js +0 -1
  195. package/lib-esm/pushNotifications/providers/pinpoint/apis/initializePushNotifications.js +0 -1
  196. package/lib-esm/pushNotifications/providers/pinpoint/apis/initializePushNotifications.native.js +30 -23
  197. package/lib-esm/pushNotifications/providers/pinpoint/apis/onNotificationOpened.js +0 -1
  198. package/lib-esm/pushNotifications/providers/pinpoint/apis/onNotificationOpened.native.js +0 -1
  199. package/lib-esm/pushNotifications/providers/pinpoint/apis/onNotificationReceivedInBackground.js +0 -1
  200. package/lib-esm/pushNotifications/providers/pinpoint/apis/onNotificationReceivedInBackground.native.js +0 -1
  201. package/lib-esm/pushNotifications/providers/pinpoint/apis/onNotificationReceivedInForeground.js +0 -1
  202. package/lib-esm/pushNotifications/providers/pinpoint/apis/onNotificationReceivedInForeground.native.js +0 -1
  203. package/lib-esm/pushNotifications/providers/pinpoint/apis/onTokenReceived.js +0 -1
  204. package/lib-esm/pushNotifications/providers/pinpoint/apis/onTokenReceived.native.js +0 -1
  205. package/lib-esm/pushNotifications/providers/pinpoint/apis/requestPermissions.js +1 -2
  206. package/lib-esm/pushNotifications/providers/pinpoint/apis/requestPermissions.native.js +1 -2
  207. package/lib-esm/pushNotifications/providers/pinpoint/apis/setBadgeCount.js +0 -1
  208. package/lib-esm/pushNotifications/providers/pinpoint/apis/setBadgeCount.native.js +0 -1
  209. package/lib-esm/pushNotifications/providers/pinpoint/index.js +0 -1
  210. package/lib-esm/pushNotifications/providers/pinpoint/types/analytics.d.ts +3 -3
  211. package/lib-esm/pushNotifications/providers/pinpoint/types/analytics.js +1 -1
  212. package/lib-esm/pushNotifications/providers/pinpoint/types/apis.d.ts +11 -11
  213. package/lib-esm/pushNotifications/providers/pinpoint/types/apis.js +1 -1
  214. package/lib-esm/pushNotifications/providers/pinpoint/types/index.js +1 -1
  215. package/lib-esm/pushNotifications/providers/pinpoint/types/inputs.d.ts +7 -7
  216. package/lib-esm/pushNotifications/providers/pinpoint/types/inputs.js +1 -1
  217. package/lib-esm/pushNotifications/providers/pinpoint/types/options.d.ts +1 -1
  218. package/lib-esm/pushNotifications/providers/pinpoint/types/options.js +1 -1
  219. package/lib-esm/pushNotifications/providers/pinpoint/types/outputs.d.ts +8 -8
  220. package/lib-esm/pushNotifications/providers/pinpoint/types/outputs.js +1 -1
  221. package/lib-esm/pushNotifications/providers/pinpoint/types/pushNotifications.d.ts +1 -1
  222. package/lib-esm/pushNotifications/providers/pinpoint/types/pushNotifications.js +1 -1
  223. package/lib-esm/pushNotifications/providers/pinpoint/utils/createMessageEventRecorder.d.ts +3 -2
  224. package/lib-esm/pushNotifications/providers/pinpoint/utils/createMessageEventRecorder.js +2 -2
  225. package/lib-esm/pushNotifications/providers/pinpoint/utils/getAnalyticsEvent.d.ts +3 -2
  226. package/lib-esm/pushNotifications/providers/pinpoint/utils/getAnalyticsEvent.js +0 -1
  227. package/lib-esm/pushNotifications/providers/pinpoint/utils/getChannelType.d.ts +2 -1
  228. package/lib-esm/pushNotifications/providers/pinpoint/utils/getChannelType.js +0 -1
  229. package/lib-esm/pushNotifications/providers/pinpoint/utils/index.d.ts +2 -1
  230. package/lib-esm/pushNotifications/providers/pinpoint/utils/index.js +2 -2
  231. package/lib-esm/pushNotifications/{utils → providers/pinpoint/utils}/resolveConfig.js +1 -2
  232. package/lib-esm/pushNotifications/types/errors.js +0 -1
  233. package/lib-esm/pushNotifications/types/index.js +4 -1
  234. package/lib-esm/pushNotifications/types/inputs.d.ts +7 -7
  235. package/lib-esm/pushNotifications/types/inputs.js +1 -1
  236. package/lib-esm/pushNotifications/types/options.d.ts +1 -1
  237. package/lib-esm/pushNotifications/types/options.js +1 -1
  238. package/lib-esm/pushNotifications/types/outputs.d.ts +8 -8
  239. package/lib-esm/pushNotifications/types/outputs.js +1 -1
  240. package/lib-esm/pushNotifications/types/pushNotifications.d.ts +3 -3
  241. package/lib-esm/pushNotifications/types/pushNotifications.js +1 -1
  242. package/lib-esm/pushNotifications/{providers/pinpoint/utils → utils}/getPushNotificationUserAgentString.js +0 -1
  243. package/lib-esm/pushNotifications/utils/index.d.ts +1 -1
  244. package/lib-esm/pushNotifications/utils/index.js +1 -2
  245. package/lib-esm/pushNotifications/utils/initializationManager.js +0 -1
  246. package/lib-esm/pushNotifications/utils/resolveCredentials.js +0 -1
  247. package/lib-esm/pushNotifications/utils/tokenManager.js +0 -1
  248. package/lib-esm/tsconfig.tsbuildinfo +1 -7201
  249. package/package.json +51 -14
  250. package/src/inAppMessaging/index.ts +1 -0
  251. package/src/inAppMessaging/providers/pinpoint/apis/clearMessages.ts +26 -0
  252. package/src/inAppMessaging/providers/pinpoint/apis/index.ts +1 -0
  253. package/src/inAppMessaging/providers/pinpoint/index.ts +1 -0
  254. package/src/pushNotifications/providers/pinpoint/apis/getBadgeCount.ts +1 -1
  255. package/src/pushNotifications/providers/pinpoint/apis/getLaunchNotification.native.ts +1 -1
  256. package/src/pushNotifications/providers/pinpoint/apis/getLaunchNotification.ts +1 -1
  257. package/src/pushNotifications/providers/pinpoint/apis/getPermissionStatus.native.ts +1 -1
  258. package/src/pushNotifications/providers/pinpoint/apis/getPermissionStatus.ts +1 -1
  259. package/src/pushNotifications/providers/pinpoint/apis/identifyUser.native.ts +5 -2
  260. package/src/pushNotifications/providers/pinpoint/apis/identifyUser.ts +1 -1
  261. package/src/pushNotifications/providers/pinpoint/apis/initializePushNotifications.native.ts +50 -40
  262. package/src/pushNotifications/providers/pinpoint/apis/requestPermissions.native.ts +1 -1
  263. package/src/pushNotifications/providers/pinpoint/apis/requestPermissions.ts +1 -1
  264. package/src/pushNotifications/providers/pinpoint/utils/createMessageEventRecorder.ts +5 -4
  265. package/src/pushNotifications/providers/pinpoint/utils/getAnalyticsEvent.ts +3 -3
  266. package/src/pushNotifications/providers/pinpoint/utils/index.ts +2 -1
  267. package/src/pushNotifications/{utils → providers/pinpoint/utils}/resolveConfig.ts +1 -1
  268. package/src/pushNotifications/types/pushNotifications.ts +1 -1
  269. package/src/pushNotifications/utils/index.ts +1 -1
  270. package/lib/eventListeners/eventListeners.js.map +0 -1
  271. package/lib/eventListeners/index.js.map +0 -1
  272. package/lib/eventListeners/types.js.map +0 -1
  273. package/lib/inAppMessaging/errors/InAppMessagingError.js.map +0 -1
  274. package/lib/inAppMessaging/errors/assertServiceError.js.map +0 -1
  275. package/lib/inAppMessaging/errors/assertValidationError.js.map +0 -1
  276. package/lib/inAppMessaging/errors/index.js.map +0 -1
  277. package/lib/inAppMessaging/errors/validation.js.map +0 -1
  278. package/lib/inAppMessaging/index.js.map +0 -1
  279. package/lib/inAppMessaging/providers/pinpoint/apis/dispatchEvent.js.map +0 -1
  280. package/lib/inAppMessaging/providers/pinpoint/apis/identifyUser.js.map +0 -1
  281. package/lib/inAppMessaging/providers/pinpoint/apis/index.js.map +0 -1
  282. package/lib/inAppMessaging/providers/pinpoint/apis/initializeInAppMessaging.js.map +0 -1
  283. package/lib/inAppMessaging/providers/pinpoint/apis/notifyMessageInteraction.js.map +0 -1
  284. package/lib/inAppMessaging/providers/pinpoint/apis/onMessageActionTaken.js.map +0 -1
  285. package/lib/inAppMessaging/providers/pinpoint/apis/onMessageDismissed.js.map +0 -1
  286. package/lib/inAppMessaging/providers/pinpoint/apis/onMessageDisplayed.js.map +0 -1
  287. package/lib/inAppMessaging/providers/pinpoint/apis/onMessageReceived.js.map +0 -1
  288. package/lib/inAppMessaging/providers/pinpoint/apis/setConflictHandler.js.map +0 -1
  289. package/lib/inAppMessaging/providers/pinpoint/apis/syncMessages.js.map +0 -1
  290. package/lib/inAppMessaging/providers/pinpoint/index.js.map +0 -1
  291. package/lib/inAppMessaging/providers/pinpoint/types/index.js.map +0 -1
  292. package/lib/inAppMessaging/providers/pinpoint/types/inputs.js.map +0 -1
  293. package/lib/inAppMessaging/providers/pinpoint/types/options.js.map +0 -1
  294. package/lib/inAppMessaging/providers/pinpoint/types/outputs.js.map +0 -1
  295. package/lib/inAppMessaging/providers/pinpoint/types/types.js.map +0 -1
  296. package/lib/inAppMessaging/providers/pinpoint/utils/constants.js.map +0 -1
  297. package/lib/inAppMessaging/providers/pinpoint/utils/helpers.js.map +0 -1
  298. package/lib/inAppMessaging/providers/pinpoint/utils/index.js.map +0 -1
  299. package/lib/inAppMessaging/providers/pinpoint/utils/messageProcessingHelpers.js.map +0 -1
  300. package/lib/inAppMessaging/providers/pinpoint/utils/resolveConfig.js.map +0 -1
  301. package/lib/inAppMessaging/providers/pinpoint/utils/resolveCredentials.js.map +0 -1
  302. package/lib/inAppMessaging/providers/pinpoint/utils/userAgent.js.map +0 -1
  303. package/lib/inAppMessaging/types/event.js.map +0 -1
  304. package/lib/inAppMessaging/types/index.js.map +0 -1
  305. package/lib/inAppMessaging/types/inputs.js.map +0 -1
  306. package/lib/inAppMessaging/types/message.js.map +0 -1
  307. package/lib/inAppMessaging/types/options.js.map +0 -1
  308. package/lib/inAppMessaging/utils/index.js.map +0 -1
  309. package/lib/inAppMessaging/utils/statusHelpers.js.map +0 -1
  310. package/lib/index.js.map +0 -1
  311. package/lib/pushNotifications/errors/PushNotificationError.js.map +0 -1
  312. package/lib/pushNotifications/errors/errorHelpers.js.map +0 -1
  313. package/lib/pushNotifications/errors/index.js.map +0 -1
  314. package/lib/pushNotifications/index.js.map +0 -1
  315. package/lib/pushNotifications/providers/pinpoint/apis/getBadgeCount.js.map +0 -1
  316. package/lib/pushNotifications/providers/pinpoint/apis/getBadgeCount.native.js.map +0 -1
  317. package/lib/pushNotifications/providers/pinpoint/apis/getLaunchNotification.js.map +0 -1
  318. package/lib/pushNotifications/providers/pinpoint/apis/getLaunchNotification.native.js.map +0 -1
  319. package/lib/pushNotifications/providers/pinpoint/apis/getPermissionStatus.js.map +0 -1
  320. package/lib/pushNotifications/providers/pinpoint/apis/getPermissionStatus.native.js.map +0 -1
  321. package/lib/pushNotifications/providers/pinpoint/apis/identifyUser.js.map +0 -1
  322. package/lib/pushNotifications/providers/pinpoint/apis/identifyUser.native.js.map +0 -1
  323. package/lib/pushNotifications/providers/pinpoint/apis/index.js.map +0 -1
  324. package/lib/pushNotifications/providers/pinpoint/apis/initializePushNotifications.js.map +0 -1
  325. package/lib/pushNotifications/providers/pinpoint/apis/initializePushNotifications.native.js.map +0 -1
  326. package/lib/pushNotifications/providers/pinpoint/apis/onNotificationOpened.js.map +0 -1
  327. package/lib/pushNotifications/providers/pinpoint/apis/onNotificationOpened.native.js.map +0 -1
  328. package/lib/pushNotifications/providers/pinpoint/apis/onNotificationReceivedInBackground.js.map +0 -1
  329. package/lib/pushNotifications/providers/pinpoint/apis/onNotificationReceivedInBackground.native.js.map +0 -1
  330. package/lib/pushNotifications/providers/pinpoint/apis/onNotificationReceivedInForeground.js.map +0 -1
  331. package/lib/pushNotifications/providers/pinpoint/apis/onNotificationReceivedInForeground.native.js.map +0 -1
  332. package/lib/pushNotifications/providers/pinpoint/apis/onTokenReceived.js.map +0 -1
  333. package/lib/pushNotifications/providers/pinpoint/apis/onTokenReceived.native.js.map +0 -1
  334. package/lib/pushNotifications/providers/pinpoint/apis/requestPermissions.js.map +0 -1
  335. package/lib/pushNotifications/providers/pinpoint/apis/requestPermissions.native.js.map +0 -1
  336. package/lib/pushNotifications/providers/pinpoint/apis/setBadgeCount.js.map +0 -1
  337. package/lib/pushNotifications/providers/pinpoint/apis/setBadgeCount.native.js.map +0 -1
  338. package/lib/pushNotifications/providers/pinpoint/index.js.map +0 -1
  339. package/lib/pushNotifications/providers/pinpoint/types/analytics.js.map +0 -1
  340. package/lib/pushNotifications/providers/pinpoint/types/apis.js.map +0 -1
  341. package/lib/pushNotifications/providers/pinpoint/types/index.js.map +0 -1
  342. package/lib/pushNotifications/providers/pinpoint/types/inputs.js.map +0 -1
  343. package/lib/pushNotifications/providers/pinpoint/types/options.js.map +0 -1
  344. package/lib/pushNotifications/providers/pinpoint/types/outputs.js.map +0 -1
  345. package/lib/pushNotifications/providers/pinpoint/types/pushNotifications.js.map +0 -1
  346. package/lib/pushNotifications/providers/pinpoint/utils/createMessageEventRecorder.js.map +0 -1
  347. package/lib/pushNotifications/providers/pinpoint/utils/getAnalyticsEvent.js.map +0 -1
  348. package/lib/pushNotifications/providers/pinpoint/utils/getChannelType.js.map +0 -1
  349. package/lib/pushNotifications/providers/pinpoint/utils/getPushNotificationUserAgentString.js.map +0 -1
  350. package/lib/pushNotifications/providers/pinpoint/utils/index.js.map +0 -1
  351. package/lib/pushNotifications/types/errors.js.map +0 -1
  352. package/lib/pushNotifications/types/index.js.map +0 -1
  353. package/lib/pushNotifications/types/inputs.js.map +0 -1
  354. package/lib/pushNotifications/types/options.js.map +0 -1
  355. package/lib/pushNotifications/types/outputs.js.map +0 -1
  356. package/lib/pushNotifications/types/pushNotifications.js.map +0 -1
  357. package/lib/pushNotifications/utils/index.js.map +0 -1
  358. package/lib/pushNotifications/utils/initializationManager.js.map +0 -1
  359. package/lib/pushNotifications/utils/resolveConfig.js.map +0 -1
  360. package/lib/pushNotifications/utils/resolveCredentials.js.map +0 -1
  361. package/lib/pushNotifications/utils/tokenManager.js.map +0 -1
  362. package/lib-esm/eventListeners/eventListeners.js.map +0 -1
  363. package/lib-esm/eventListeners/index.js.map +0 -1
  364. package/lib-esm/eventListeners/types.js.map +0 -1
  365. package/lib-esm/inAppMessaging/errors/InAppMessagingError.js.map +0 -1
  366. package/lib-esm/inAppMessaging/errors/assertServiceError.js.map +0 -1
  367. package/lib-esm/inAppMessaging/errors/assertValidationError.js.map +0 -1
  368. package/lib-esm/inAppMessaging/errors/index.js.map +0 -1
  369. package/lib-esm/inAppMessaging/errors/validation.js.map +0 -1
  370. package/lib-esm/inAppMessaging/index.js.map +0 -1
  371. package/lib-esm/inAppMessaging/providers/pinpoint/apis/dispatchEvent.js.map +0 -1
  372. package/lib-esm/inAppMessaging/providers/pinpoint/apis/identifyUser.js.map +0 -1
  373. package/lib-esm/inAppMessaging/providers/pinpoint/apis/index.js.map +0 -1
  374. package/lib-esm/inAppMessaging/providers/pinpoint/apis/initializeInAppMessaging.js.map +0 -1
  375. package/lib-esm/inAppMessaging/providers/pinpoint/apis/notifyMessageInteraction.js.map +0 -1
  376. package/lib-esm/inAppMessaging/providers/pinpoint/apis/onMessageActionTaken.js.map +0 -1
  377. package/lib-esm/inAppMessaging/providers/pinpoint/apis/onMessageDismissed.js.map +0 -1
  378. package/lib-esm/inAppMessaging/providers/pinpoint/apis/onMessageDisplayed.js.map +0 -1
  379. package/lib-esm/inAppMessaging/providers/pinpoint/apis/onMessageReceived.js.map +0 -1
  380. package/lib-esm/inAppMessaging/providers/pinpoint/apis/setConflictHandler.js.map +0 -1
  381. package/lib-esm/inAppMessaging/providers/pinpoint/apis/syncMessages.js.map +0 -1
  382. package/lib-esm/inAppMessaging/providers/pinpoint/index.js.map +0 -1
  383. package/lib-esm/inAppMessaging/providers/pinpoint/types/index.js.map +0 -1
  384. package/lib-esm/inAppMessaging/providers/pinpoint/types/inputs.js.map +0 -1
  385. package/lib-esm/inAppMessaging/providers/pinpoint/types/options.js.map +0 -1
  386. package/lib-esm/inAppMessaging/providers/pinpoint/types/outputs.js.map +0 -1
  387. package/lib-esm/inAppMessaging/providers/pinpoint/types/types.js.map +0 -1
  388. package/lib-esm/inAppMessaging/providers/pinpoint/utils/constants.js.map +0 -1
  389. package/lib-esm/inAppMessaging/providers/pinpoint/utils/helpers.js.map +0 -1
  390. package/lib-esm/inAppMessaging/providers/pinpoint/utils/index.js.map +0 -1
  391. package/lib-esm/inAppMessaging/providers/pinpoint/utils/messageProcessingHelpers.js.map +0 -1
  392. package/lib-esm/inAppMessaging/providers/pinpoint/utils/resolveConfig.js.map +0 -1
  393. package/lib-esm/inAppMessaging/providers/pinpoint/utils/resolveCredentials.js.map +0 -1
  394. package/lib-esm/inAppMessaging/providers/pinpoint/utils/userAgent.js.map +0 -1
  395. package/lib-esm/inAppMessaging/types/event.js.map +0 -1
  396. package/lib-esm/inAppMessaging/types/index.js.map +0 -1
  397. package/lib-esm/inAppMessaging/types/inputs.js.map +0 -1
  398. package/lib-esm/inAppMessaging/types/message.js.map +0 -1
  399. package/lib-esm/inAppMessaging/types/options.js.map +0 -1
  400. package/lib-esm/inAppMessaging/utils/index.js.map +0 -1
  401. package/lib-esm/inAppMessaging/utils/statusHelpers.js.map +0 -1
  402. package/lib-esm/index.js.map +0 -1
  403. package/lib-esm/pushNotifications/errors/PushNotificationError.js.map +0 -1
  404. package/lib-esm/pushNotifications/errors/errorHelpers.js.map +0 -1
  405. package/lib-esm/pushNotifications/errors/index.js.map +0 -1
  406. package/lib-esm/pushNotifications/index.js.map +0 -1
  407. package/lib-esm/pushNotifications/providers/pinpoint/apis/getBadgeCount.js.map +0 -1
  408. package/lib-esm/pushNotifications/providers/pinpoint/apis/getBadgeCount.native.js.map +0 -1
  409. package/lib-esm/pushNotifications/providers/pinpoint/apis/getLaunchNotification.js.map +0 -1
  410. package/lib-esm/pushNotifications/providers/pinpoint/apis/getLaunchNotification.native.js.map +0 -1
  411. package/lib-esm/pushNotifications/providers/pinpoint/apis/getPermissionStatus.js.map +0 -1
  412. package/lib-esm/pushNotifications/providers/pinpoint/apis/getPermissionStatus.native.js.map +0 -1
  413. package/lib-esm/pushNotifications/providers/pinpoint/apis/identifyUser.js.map +0 -1
  414. package/lib-esm/pushNotifications/providers/pinpoint/apis/identifyUser.native.js.map +0 -1
  415. package/lib-esm/pushNotifications/providers/pinpoint/apis/index.js.map +0 -1
  416. package/lib-esm/pushNotifications/providers/pinpoint/apis/initializePushNotifications.js.map +0 -1
  417. package/lib-esm/pushNotifications/providers/pinpoint/apis/initializePushNotifications.native.js.map +0 -1
  418. package/lib-esm/pushNotifications/providers/pinpoint/apis/onNotificationOpened.js.map +0 -1
  419. package/lib-esm/pushNotifications/providers/pinpoint/apis/onNotificationOpened.native.js.map +0 -1
  420. package/lib-esm/pushNotifications/providers/pinpoint/apis/onNotificationReceivedInBackground.js.map +0 -1
  421. package/lib-esm/pushNotifications/providers/pinpoint/apis/onNotificationReceivedInBackground.native.js.map +0 -1
  422. package/lib-esm/pushNotifications/providers/pinpoint/apis/onNotificationReceivedInForeground.js.map +0 -1
  423. package/lib-esm/pushNotifications/providers/pinpoint/apis/onNotificationReceivedInForeground.native.js.map +0 -1
  424. package/lib-esm/pushNotifications/providers/pinpoint/apis/onTokenReceived.js.map +0 -1
  425. package/lib-esm/pushNotifications/providers/pinpoint/apis/onTokenReceived.native.js.map +0 -1
  426. package/lib-esm/pushNotifications/providers/pinpoint/apis/requestPermissions.js.map +0 -1
  427. package/lib-esm/pushNotifications/providers/pinpoint/apis/requestPermissions.native.js.map +0 -1
  428. package/lib-esm/pushNotifications/providers/pinpoint/apis/setBadgeCount.js.map +0 -1
  429. package/lib-esm/pushNotifications/providers/pinpoint/apis/setBadgeCount.native.js.map +0 -1
  430. package/lib-esm/pushNotifications/providers/pinpoint/index.js.map +0 -1
  431. package/lib-esm/pushNotifications/providers/pinpoint/types/analytics.js.map +0 -1
  432. package/lib-esm/pushNotifications/providers/pinpoint/types/apis.js.map +0 -1
  433. package/lib-esm/pushNotifications/providers/pinpoint/types/index.js.map +0 -1
  434. package/lib-esm/pushNotifications/providers/pinpoint/types/inputs.js.map +0 -1
  435. package/lib-esm/pushNotifications/providers/pinpoint/types/options.js.map +0 -1
  436. package/lib-esm/pushNotifications/providers/pinpoint/types/outputs.js.map +0 -1
  437. package/lib-esm/pushNotifications/providers/pinpoint/types/pushNotifications.js.map +0 -1
  438. package/lib-esm/pushNotifications/providers/pinpoint/utils/createMessageEventRecorder.js.map +0 -1
  439. package/lib-esm/pushNotifications/providers/pinpoint/utils/getAnalyticsEvent.js.map +0 -1
  440. package/lib-esm/pushNotifications/providers/pinpoint/utils/getChannelType.js.map +0 -1
  441. package/lib-esm/pushNotifications/providers/pinpoint/utils/getPushNotificationUserAgentString.js.map +0 -1
  442. package/lib-esm/pushNotifications/providers/pinpoint/utils/index.js.map +0 -1
  443. package/lib-esm/pushNotifications/types/errors.js.map +0 -1
  444. package/lib-esm/pushNotifications/types/index.js.map +0 -1
  445. package/lib-esm/pushNotifications/types/inputs.js.map +0 -1
  446. package/lib-esm/pushNotifications/types/options.js.map +0 -1
  447. package/lib-esm/pushNotifications/types/outputs.js.map +0 -1
  448. package/lib-esm/pushNotifications/types/pushNotifications.js.map +0 -1
  449. package/lib-esm/pushNotifications/utils/index.js.map +0 -1
  450. package/lib-esm/pushNotifications/utils/initializationManager.js.map +0 -1
  451. package/lib-esm/pushNotifications/utils/resolveConfig.js.map +0 -1
  452. package/lib-esm/pushNotifications/utils/resolveCredentials.js.map +0 -1
  453. package/lib-esm/pushNotifications/utils/tokenManager.js.map +0 -1
  454. /package/lib/pushNotifications/{utils → providers/pinpoint/utils}/resolveConfig.d.ts +0 -0
  455. /package/lib/pushNotifications/{providers/pinpoint/utils → utils}/getPushNotificationUserAgentString.d.ts +0 -0
  456. /package/lib-esm/pushNotifications/{utils → providers/pinpoint/utils}/resolveConfig.d.ts +0 -0
  457. /package/lib-esm/pushNotifications/{providers/pinpoint/utils → utils}/getPushNotificationUserAgentString.d.ts +0 -0
  458. /package/src/pushNotifications/{providers/pinpoint/utils → utils}/getPushNotificationUserAgentString.ts +0 -0
@@ -2,6 +2,7 @@
2
2
  // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3
3
  // SPDX-License-Identifier: Apache-2.0
4
4
  Object.defineProperty(exports, "__esModule", { value: true });
5
+ exports.assertIsInitialized = exports.isInitialized = exports.initialize = void 0;
5
6
  const errors_1 = require("../errors");
6
7
  let initialized = false;
7
8
  /**
@@ -9,17 +10,18 @@ let initialized = false;
9
10
  *
10
11
  * @internal
11
12
  */
12
- exports.initialize = () => {
13
+ const initialize = () => {
13
14
  initialized = true;
14
15
  };
16
+ exports.initialize = initialize;
15
17
  /**
16
18
  * Returns the initialization status of In-App Messaging.
17
19
  *
18
20
  * @internal
19
21
  */
20
- exports.isInitialized = () => initialized;
22
+ const isInitialized = () => initialized;
23
+ exports.isInitialized = isInitialized;
21
24
  function assertIsInitialized() {
22
- errors_1.assertValidationError(exports.isInitialized(), errors_1.InAppMessagingValidationErrorCode.NotInitialized);
25
+ (0, errors_1.assertValidationError)((0, exports.isInitialized)(), errors_1.InAppMessagingValidationErrorCode.NotInitialized);
23
26
  }
24
27
  exports.assertIsInitialized = assertIsInitialized;
25
- //# sourceMappingURL=statusHelpers.js.map
package/lib/index.js CHANGED
@@ -1,4 +1,3 @@
1
1
  "use strict";
2
2
  // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3
3
  // SPDX-License-Identifier: Apache-2.0
4
- //# sourceMappingURL=index.js.map
@@ -2,6 +2,7 @@
2
2
  // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3
3
  // SPDX-License-Identifier: Apache-2.0
4
4
  Object.defineProperty(exports, "__esModule", { value: true });
5
+ exports.PushNotificationError = void 0;
5
6
  const utils_1 = require("@aws-amplify/core/internals/utils");
6
7
  class PushNotificationError extends utils_1.AmplifyError {
7
8
  constructor(params) {
@@ -13,4 +14,3 @@ class PushNotificationError extends utils_1.AmplifyError {
13
14
  }
14
15
  }
15
16
  exports.PushNotificationError = PushNotificationError;
16
- //# sourceMappingURL=PushNotificationError.js.map
@@ -2,6 +2,7 @@
2
2
  // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3
3
  // SPDX-License-Identifier: Apache-2.0
4
4
  Object.defineProperty(exports, "__esModule", { value: true });
5
+ exports.assertIsInitialized = exports.assert = exports.PushNotificationValidationErrorCode = void 0;
5
6
  const utils_1 = require("@aws-amplify/core/internals/utils");
6
7
  const utils_2 = require("../utils");
7
8
  const PushNotificationError_1 = require("./PushNotificationError");
@@ -27,8 +28,8 @@ const pushNotificationValidationErrorMap = {
27
28
  recoverySuggestion: 'Please make sure to first call `initializePushNotifications`.',
28
29
  },
29
30
  };
30
- exports.assert = utils_1.createAssertionFunction(pushNotificationValidationErrorMap, PushNotificationError_1.PushNotificationError);
31
- exports.assertIsInitialized = () => {
32
- exports.assert(utils_2.isInitialized(), PushNotificationValidationErrorCode.NotInitialized);
31
+ exports.assert = (0, utils_1.createAssertionFunction)(pushNotificationValidationErrorMap, PushNotificationError_1.PushNotificationError);
32
+ const assertIsInitialized = () => {
33
+ (0, exports.assert)((0, utils_2.isInitialized)(), PushNotificationValidationErrorCode.NotInitialized);
33
34
  };
34
- //# sourceMappingURL=errorHelpers.js.map
35
+ exports.assertIsInitialized = assertIsInitialized;
@@ -2,9 +2,9 @@
2
2
  // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3
3
  // SPDX-License-Identifier: Apache-2.0
4
4
  Object.defineProperty(exports, "__esModule", { value: true });
5
+ exports.PushNotificationValidationErrorCode = exports.assert = exports.PushNotificationError = void 0;
5
6
  var PushNotificationError_1 = require("./PushNotificationError");
6
- exports.PushNotificationError = PushNotificationError_1.PushNotificationError;
7
+ Object.defineProperty(exports, "PushNotificationError", { enumerable: true, get: function () { return PushNotificationError_1.PushNotificationError; } });
7
8
  var errorHelpers_1 = require("./errorHelpers");
8
- exports.assert = errorHelpers_1.assert;
9
- exports.PushNotificationValidationErrorCode = errorHelpers_1.PushNotificationValidationErrorCode;
10
- //# sourceMappingURL=index.js.map
9
+ Object.defineProperty(exports, "assert", { enumerable: true, get: function () { return errorHelpers_1.assert; } });
10
+ Object.defineProperty(exports, "PushNotificationValidationErrorCode", { enumerable: true, get: function () { return errorHelpers_1.PushNotificationValidationErrorCode; } });
@@ -2,18 +2,18 @@
2
2
  // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3
3
  // SPDX-License-Identifier: Apache-2.0
4
4
  Object.defineProperty(exports, "__esModule", { value: true });
5
+ exports.PushNotificationError = exports.setBadgeCount = exports.requestPermissions = exports.onTokenReceived = exports.onNotificationReceivedInForeground = exports.onNotificationReceivedInBackground = exports.onNotificationOpened = exports.initializePushNotifications = exports.identifyUser = exports.getPermissionStatus = exports.getLaunchNotification = exports.getBadgeCount = void 0;
5
6
  var pinpoint_1 = require("./providers/pinpoint");
6
- exports.getBadgeCount = pinpoint_1.getBadgeCount;
7
- exports.getLaunchNotification = pinpoint_1.getLaunchNotification;
8
- exports.getPermissionStatus = pinpoint_1.getPermissionStatus;
9
- exports.identifyUser = pinpoint_1.identifyUser;
10
- exports.initializePushNotifications = pinpoint_1.initializePushNotifications;
11
- exports.onNotificationOpened = pinpoint_1.onNotificationOpened;
12
- exports.onNotificationReceivedInBackground = pinpoint_1.onNotificationReceivedInBackground;
13
- exports.onNotificationReceivedInForeground = pinpoint_1.onNotificationReceivedInForeground;
14
- exports.onTokenReceived = pinpoint_1.onTokenReceived;
15
- exports.requestPermissions = pinpoint_1.requestPermissions;
16
- exports.setBadgeCount = pinpoint_1.setBadgeCount;
7
+ Object.defineProperty(exports, "getBadgeCount", { enumerable: true, get: function () { return pinpoint_1.getBadgeCount; } });
8
+ Object.defineProperty(exports, "getLaunchNotification", { enumerable: true, get: function () { return pinpoint_1.getLaunchNotification; } });
9
+ Object.defineProperty(exports, "getPermissionStatus", { enumerable: true, get: function () { return pinpoint_1.getPermissionStatus; } });
10
+ Object.defineProperty(exports, "identifyUser", { enumerable: true, get: function () { return pinpoint_1.identifyUser; } });
11
+ Object.defineProperty(exports, "initializePushNotifications", { enumerable: true, get: function () { return pinpoint_1.initializePushNotifications; } });
12
+ Object.defineProperty(exports, "onNotificationOpened", { enumerable: true, get: function () { return pinpoint_1.onNotificationOpened; } });
13
+ Object.defineProperty(exports, "onNotificationReceivedInBackground", { enumerable: true, get: function () { return pinpoint_1.onNotificationReceivedInBackground; } });
14
+ Object.defineProperty(exports, "onNotificationReceivedInForeground", { enumerable: true, get: function () { return pinpoint_1.onNotificationReceivedInForeground; } });
15
+ Object.defineProperty(exports, "onTokenReceived", { enumerable: true, get: function () { return pinpoint_1.onTokenReceived; } });
16
+ Object.defineProperty(exports, "requestPermissions", { enumerable: true, get: function () { return pinpoint_1.requestPermissions; } });
17
+ Object.defineProperty(exports, "setBadgeCount", { enumerable: true, get: function () { return pinpoint_1.setBadgeCount; } });
17
18
  var errors_1 = require("./errors");
18
- exports.PushNotificationError = errors_1.PushNotificationError;
19
- //# sourceMappingURL=index.js.map
19
+ Object.defineProperty(exports, "PushNotificationError", { enumerable: true, get: function () { return errors_1.PushNotificationError; } });
@@ -2,6 +2,7 @@
2
2
  // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3
3
  // SPDX-License-Identifier: Apache-2.0
4
4
  Object.defineProperty(exports, "__esModule", { value: true });
5
+ exports.getBadgeCount = void 0;
5
6
  const utils_1 = require("@aws-amplify/core/internals/utils");
6
7
  /**
7
8
  * Returns the current badge count (the number next to your app's icon). This function is safe to call (but will be
@@ -15,7 +16,7 @@ const utils_1 = require("@aws-amplify/core/internals/utils");
15
16
  * const badgeCount = await getBadgeCount();
16
17
  * ```
17
18
  */
18
- exports.getBadgeCount = () => {
19
+ const getBadgeCount = async () => {
19
20
  throw new utils_1.PlatformNotSupportedError();
20
21
  };
21
- //# sourceMappingURL=getBadgeCount.js.map
22
+ exports.getBadgeCount = getBadgeCount;
@@ -2,11 +2,12 @@
2
2
  // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3
3
  // SPDX-License-Identifier: Apache-2.0
4
4
  Object.defineProperty(exports, "__esModule", { value: true });
5
+ exports.getBadgeCount = void 0;
5
6
  const react_native_1 = require("@aws-amplify/react-native");
6
7
  const errorHelpers_1 = require("../../../errors/errorHelpers");
7
- const { getBadgeCount: getBadgeCountNative } = react_native_1.loadAmplifyPushNotification();
8
- exports.getBadgeCount = async () => {
9
- errorHelpers_1.assertIsInitialized();
8
+ const { getBadgeCount: getBadgeCountNative } = (0, react_native_1.loadAmplifyPushNotification)();
9
+ const getBadgeCount = async () => {
10
+ (0, errorHelpers_1.assertIsInitialized)();
10
11
  return getBadgeCountNative();
11
12
  };
12
- //# sourceMappingURL=getBadgeCount.native.js.map
13
+ exports.getBadgeCount = getBadgeCount;
@@ -2,6 +2,7 @@
2
2
  // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3
3
  // SPDX-License-Identifier: Apache-2.0
4
4
  Object.defineProperty(exports, "__esModule", { value: true });
5
+ exports.getLaunchNotification = void 0;
5
6
  const utils_1 = require("@aws-amplify/core/internals/utils");
6
7
  /**
7
8
  * Returns the notification which launched your app from a terminated state. The launch notification is consumed by
@@ -19,7 +20,7 @@ const utils_1 = require("@aws-amplify/core/internals/utils");
19
20
  * const launchNotification = await getLaunchNotification();
20
21
  * ```
21
22
  */
22
- exports.getLaunchNotification = () => {
23
+ const getLaunchNotification = async () => {
23
24
  throw new utils_1.PlatformNotSupportedError();
24
25
  };
25
- //# sourceMappingURL=getLaunchNotification.js.map
26
+ exports.getLaunchNotification = getLaunchNotification;
@@ -2,11 +2,12 @@
2
2
  // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3
3
  // SPDX-License-Identifier: Apache-2.0
4
4
  Object.defineProperty(exports, "__esModule", { value: true });
5
+ exports.getLaunchNotification = void 0;
5
6
  const react_native_1 = require("@aws-amplify/react-native");
6
7
  const errorHelpers_1 = require("../../../errors/errorHelpers");
7
- const { getLaunchNotification: getLaunchNotificationNative } = react_native_1.loadAmplifyPushNotification();
8
- exports.getLaunchNotification = () => {
9
- errorHelpers_1.assertIsInitialized();
8
+ const { getLaunchNotification: getLaunchNotificationNative } = (0, react_native_1.loadAmplifyPushNotification)();
9
+ const getLaunchNotification = async () => {
10
+ (0, errorHelpers_1.assertIsInitialized)();
10
11
  return getLaunchNotificationNative();
11
12
  };
12
- //# sourceMappingURL=getLaunchNotification.native.js.map
13
+ exports.getLaunchNotification = getLaunchNotification;
@@ -2,6 +2,7 @@
2
2
  // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3
3
  // SPDX-License-Identifier: Apache-2.0
4
4
  Object.defineProperty(exports, "__esModule", { value: true });
5
+ exports.getPermissionStatus = void 0;
5
6
  const utils_1 = require("@aws-amplify/core/internals/utils");
6
7
  /**
7
8
  * Returns a string representing the current status of user permissions to display push notifications. The possible
@@ -28,7 +29,7 @@ const utils_1 = require("@aws-amplify/core/internals/utils");
28
29
  * ```ts
29
30
  * const permissionStatus = await getPermissionStatus();
30
31
  */
31
- exports.getPermissionStatus = () => {
32
+ const getPermissionStatus = async () => {
32
33
  throw new utils_1.PlatformNotSupportedError();
33
34
  };
34
- //# sourceMappingURL=getPermissionStatus.js.map
35
+ exports.getPermissionStatus = getPermissionStatus;
@@ -2,11 +2,12 @@
2
2
  // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3
3
  // SPDX-License-Identifier: Apache-2.0
4
4
  Object.defineProperty(exports, "__esModule", { value: true });
5
+ exports.getPermissionStatus = void 0;
5
6
  const react_native_1 = require("@aws-amplify/react-native");
6
7
  const errorHelpers_1 = require("../../../errors/errorHelpers");
7
- const { getPermissionStatus: getPermissionStatusNative } = react_native_1.loadAmplifyPushNotification();
8
- exports.getPermissionStatus = () => {
9
- errorHelpers_1.assertIsInitialized();
8
+ const { getPermissionStatus: getPermissionStatusNative } = (0, react_native_1.loadAmplifyPushNotification)();
9
+ const getPermissionStatus = async () => {
10
+ (0, errorHelpers_1.assertIsInitialized)();
10
11
  return getPermissionStatusNative();
11
12
  };
12
- //# sourceMappingURL=getPermissionStatus.native.js.map
13
+ exports.getPermissionStatus = getPermissionStatus;
@@ -2,6 +2,7 @@
2
2
  // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3
3
  // SPDX-License-Identifier: Apache-2.0
4
4
  Object.defineProperty(exports, "__esModule", { value: true });
5
+ exports.identifyUser = void 0;
5
6
  const utils_1 = require("@aws-amplify/core/internals/utils");
6
7
  /**
7
8
  * Sends information about a user to Pinpoint. Sending user information allows you to associate a user to their user
@@ -54,7 +55,7 @@ const utils_1 = require("@aws-amplify/core/internals/utils");
54
55
  * },
55
56
  * });
56
57
  */
57
- exports.identifyUser = () => {
58
+ const identifyUser = async () => {
58
59
  throw new utils_1.PlatformNotSupportedError();
59
60
  };
60
- //# sourceMappingURL=identifyUser.js.map
61
+ exports.identifyUser = identifyUser;
@@ -2,19 +2,20 @@
2
2
  // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3
3
  // SPDX-License-Identifier: Apache-2.0
4
4
  Object.defineProperty(exports, "__esModule", { value: true });
5
+ exports.identifyUser = void 0;
5
6
  const utils_1 = require("@aws-amplify/core/internals/utils");
6
7
  const pinpoint_1 = require("@aws-amplify/core/internals/providers/pinpoint");
7
8
  const errorHelpers_1 = require("../../../errors/errorHelpers");
8
9
  const utils_2 = require("../../../utils");
9
10
  const utils_3 = require("../utils");
10
- exports.identifyUser = async ({ userId, userProfile, options, }) => {
11
- errorHelpers_1.assertIsInitialized();
12
- const { credentials, identityId } = await utils_2.resolveCredentials();
13
- const { appId, region } = utils_2.resolveConfig();
11
+ const identifyUser = async ({ userId, userProfile, options, }) => {
12
+ (0, errorHelpers_1.assertIsInitialized)();
13
+ const { credentials, identityId } = await (0, utils_2.resolveCredentials)();
14
+ const { appId, region } = (0, utils_3.resolveConfig)();
14
15
  const { address, optOut, userAttributes } = options ?? {};
15
- pinpoint_1.updateEndpoint({
16
+ (0, pinpoint_1.updateEndpoint)({
16
17
  address,
17
- channelType: utils_3.getChannelType(),
18
+ channelType: (0, utils_3.getChannelType)(),
18
19
  optOut,
19
20
  appId,
20
21
  category: 'PushNotification',
@@ -24,7 +25,7 @@ exports.identifyUser = async ({ userId, userProfile, options, }) => {
24
25
  userAttributes,
25
26
  userId,
26
27
  userProfile,
27
- userAgentValue: utils_3.getPushNotificationUserAgentString(utils_1.PushNotificationAction.IdentifyUser),
28
+ userAgentValue: (0, utils_2.getPushNotificationUserAgentString)(utils_1.PushNotificationAction.IdentifyUser),
28
29
  });
29
30
  };
30
- //# sourceMappingURL=identifyUser.native.js.map
31
+ exports.identifyUser = identifyUser;
@@ -2,26 +2,26 @@
2
2
  // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3
3
  // SPDX-License-Identifier: Apache-2.0
4
4
  Object.defineProperty(exports, "__esModule", { value: true });
5
+ exports.setBadgeCount = exports.requestPermissions = exports.onTokenReceived = exports.onNotificationReceivedInForeground = exports.onNotificationReceivedInBackground = exports.onNotificationOpened = exports.initializePushNotifications = exports.identifyUser = exports.getPermissionStatus = exports.getLaunchNotification = exports.getBadgeCount = void 0;
5
6
  var getBadgeCount_1 = require("./getBadgeCount");
6
- exports.getBadgeCount = getBadgeCount_1.getBadgeCount;
7
+ Object.defineProperty(exports, "getBadgeCount", { enumerable: true, get: function () { return getBadgeCount_1.getBadgeCount; } });
7
8
  var getLaunchNotification_1 = require("./getLaunchNotification");
8
- exports.getLaunchNotification = getLaunchNotification_1.getLaunchNotification;
9
+ Object.defineProperty(exports, "getLaunchNotification", { enumerable: true, get: function () { return getLaunchNotification_1.getLaunchNotification; } });
9
10
  var getPermissionStatus_1 = require("./getPermissionStatus");
10
- exports.getPermissionStatus = getPermissionStatus_1.getPermissionStatus;
11
+ Object.defineProperty(exports, "getPermissionStatus", { enumerable: true, get: function () { return getPermissionStatus_1.getPermissionStatus; } });
11
12
  var identifyUser_1 = require("./identifyUser");
12
- exports.identifyUser = identifyUser_1.identifyUser;
13
+ Object.defineProperty(exports, "identifyUser", { enumerable: true, get: function () { return identifyUser_1.identifyUser; } });
13
14
  var initializePushNotifications_1 = require("./initializePushNotifications");
14
- exports.initializePushNotifications = initializePushNotifications_1.initializePushNotifications;
15
+ Object.defineProperty(exports, "initializePushNotifications", { enumerable: true, get: function () { return initializePushNotifications_1.initializePushNotifications; } });
15
16
  var onNotificationOpened_1 = require("./onNotificationOpened");
16
- exports.onNotificationOpened = onNotificationOpened_1.onNotificationOpened;
17
+ Object.defineProperty(exports, "onNotificationOpened", { enumerable: true, get: function () { return onNotificationOpened_1.onNotificationOpened; } });
17
18
  var onNotificationReceivedInBackground_1 = require("./onNotificationReceivedInBackground");
18
- exports.onNotificationReceivedInBackground = onNotificationReceivedInBackground_1.onNotificationReceivedInBackground;
19
+ Object.defineProperty(exports, "onNotificationReceivedInBackground", { enumerable: true, get: function () { return onNotificationReceivedInBackground_1.onNotificationReceivedInBackground; } });
19
20
  var onNotificationReceivedInForeground_1 = require("./onNotificationReceivedInForeground");
20
- exports.onNotificationReceivedInForeground = onNotificationReceivedInForeground_1.onNotificationReceivedInForeground;
21
+ Object.defineProperty(exports, "onNotificationReceivedInForeground", { enumerable: true, get: function () { return onNotificationReceivedInForeground_1.onNotificationReceivedInForeground; } });
21
22
  var onTokenReceived_1 = require("./onTokenReceived");
22
- exports.onTokenReceived = onTokenReceived_1.onTokenReceived;
23
+ Object.defineProperty(exports, "onTokenReceived", { enumerable: true, get: function () { return onTokenReceived_1.onTokenReceived; } });
23
24
  var requestPermissions_1 = require("./requestPermissions");
24
- exports.requestPermissions = requestPermissions_1.requestPermissions;
25
+ Object.defineProperty(exports, "requestPermissions", { enumerable: true, get: function () { return requestPermissions_1.requestPermissions; } });
25
26
  var setBadgeCount_1 = require("./setBadgeCount");
26
- exports.setBadgeCount = setBadgeCount_1.setBadgeCount;
27
- //# sourceMappingURL=index.js.map
27
+ Object.defineProperty(exports, "setBadgeCount", { enumerable: true, get: function () { return setBadgeCount_1.setBadgeCount; } });
@@ -2,6 +2,7 @@
2
2
  // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3
3
  // SPDX-License-Identifier: Apache-2.0
4
4
  Object.defineProperty(exports, "__esModule", { value: true });
5
+ exports.initializePushNotifications = void 0;
5
6
  const utils_1 = require("@aws-amplify/core/internals/utils");
6
7
  /**
7
8
  * Initialize and set up the push notification category. The category must be first initialized before all other
@@ -18,7 +19,7 @@ const utils_1 = require("@aws-amplify/core/internals/utils");
18
19
  * initializePushNotifications();
19
20
  * ```
20
21
  */
21
- exports.initializePushNotifications = () => {
22
+ const initializePushNotifications = () => {
22
23
  throw new utils_1.PlatformNotSupportedError();
23
24
  };
24
- //# sourceMappingURL=initializePushNotifications.js.map
25
+ exports.initializePushNotifications = initializePushNotifications;
@@ -2,6 +2,7 @@
2
2
  // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3
3
  // SPDX-License-Identifier: Apache-2.0
4
4
  Object.defineProperty(exports, "__esModule", { value: true });
5
+ exports.initializePushNotifications = void 0;
5
6
  const core_1 = require("@aws-amplify/core");
6
7
  const utils_1 = require("@aws-amplify/core/internals/utils");
7
8
  const pinpoint_1 = require("@aws-amplify/core/internals/providers/pinpoint");
@@ -9,31 +10,21 @@ const react_native_1 = require("@aws-amplify/react-native");
9
10
  const eventListeners_1 = require("../../../../eventListeners");
10
11
  const utils_2 = require("../../../utils");
11
12
  const utils_3 = require("../utils");
12
- const { addMessageEventListener, addTokenEventListener, completeNotification, getConstants, registerHeadlessTask, } = react_native_1.loadAmplifyPushNotification();
13
+ const { addMessageEventListener, addTokenEventListener, completeNotification, getConstants, registerHeadlessTask, } = (0, react_native_1.loadAmplifyPushNotification)();
13
14
  const logger = new core_1.ConsoleLogger('Notifications.PushNotification');
14
15
  const BACKGROUND_TASK_TIMEOUT = 25; // seconds
15
- exports.initializePushNotifications = () => {
16
- if (utils_2.isInitialized()) {
16
+ const initializePushNotifications = () => {
17
+ if ((0, utils_2.isInitialized)()) {
17
18
  logger.info('Push notifications have already been enabled');
18
19
  return;
19
20
  }
20
21
  addNativeListeners();
21
22
  addAnalyticsListeners();
22
- utils_2.initialize();
23
- };
24
- const addAnalyticsListeners = () => {
25
- let launchNotificationOpenedListenerRemover;
26
- // wire up default Pinpoint message event handling
27
- eventListeners_1.addEventListener('backgroundMessageReceived', utils_3.createMessageEventRecorder('backgroundMessageReceived'));
28
- eventListeners_1.addEventListener('foregroundMessageReceived', utils_3.createMessageEventRecorder('foregroundMessageReceived'));
29
- launchNotificationOpenedListenerRemover = eventListeners_1.addEventListener('launchNotificationsOpened', utils_3.createMessageEventRecorder('notificationOpened',
30
- // once we are done with it we can remove the listener
31
- launchNotificationOpenedListenerRemover?.remove));
32
- eventListeners_1.addEventListener('notificationOpened', utils_3.createMessageEventRecorder('notificationOpened',
33
- // if we are in this state, we no longer need the listener as the app was launched via some other means
34
- launchNotificationOpenedListenerRemover?.remove));
23
+ (0, utils_2.initialize)();
35
24
  };
25
+ exports.initializePushNotifications = initializePushNotifications;
36
26
  const addNativeListeners = () => {
27
+ let launchNotificationOpenedListener;
37
28
  const { NativeEvent, NativeHeadlessTaskKey } = getConstants();
38
29
  const { BACKGROUND_MESSAGE_RECEIVED, FOREGROUND_MESSAGE_RECEIVED, LAUNCH_NOTIFICATION_OPENED, NOTIFICATION_OPENED, TOKEN_RECEIVED, } = NativeEvent;
39
30
  // on platforms that can handle headless tasks, register one to broadcast background message received to
@@ -41,7 +32,7 @@ const addNativeListeners = () => {
41
32
  if (NativeHeadlessTaskKey) {
42
33
  registerHeadlessTask(async (message) => {
43
34
  // keep headless task running until handlers have completed their work
44
- await eventListeners_1.notifyEventListenersAndAwaitHandlers('backgroundMessageReceived', message);
35
+ await (0, eventListeners_1.notifyEventListenersAndAwaitHandlers)('backgroundMessageReceived', message);
45
36
  });
46
37
  }
47
38
  else if (BACKGROUND_MESSAGE_RECEIVED) {
@@ -51,7 +42,7 @@ const addNativeListeners = () => {
51
42
  // keep background task running until handlers have completed their work
52
43
  try {
53
44
  await Promise.race([
54
- eventListeners_1.notifyEventListenersAndAwaitHandlers('backgroundMessageReceived', message),
45
+ (0, eventListeners_1.notifyEventListenersAndAwaitHandlers)('backgroundMessageReceived', message),
55
46
  // background tasks will get suspended and all future tasks be deprioritized by the OS if they run for
56
47
  // more than 30 seconds so we reject with a error in a shorter amount of time to prevent this from
57
48
  // happening
@@ -65,23 +56,24 @@ const addNativeListeners = () => {
65
56
  }
66
57
  finally {
67
58
  // notify native module that handlers have completed their work (or timed out)
68
- if (completionHandlerId)
59
+ if (completionHandlerId) {
69
60
  completeNotification(completionHandlerId);
61
+ }
70
62
  }
71
63
  });
72
64
  }
73
65
  addMessageEventListener(
74
66
  // listen for native foreground message received event and broadcast to library listeners
75
67
  FOREGROUND_MESSAGE_RECEIVED, message => {
76
- eventListeners_1.notifyEventListeners('foregroundMessageReceived', message);
68
+ (0, eventListeners_1.notifyEventListeners)('foregroundMessageReceived', message);
77
69
  });
78
- const launchNotificationOpenedListener = LAUNCH_NOTIFICATION_OPENED
70
+ launchNotificationOpenedListener = LAUNCH_NOTIFICATION_OPENED
79
71
  ? addMessageEventListener(
80
72
  // listen for native notification opened app (user tapped on notification, opening the app from quit -
81
73
  // not background - state) event. This is broadcasted to an internal listener only as it is not intended
82
74
  // for use otherwise as it produces inconsistent results when used within React Native app context
83
75
  LAUNCH_NOTIFICATION_OPENED, message => {
84
- eventListeners_1.notifyEventListeners('launchNotificationsOpened', message);
76
+ (0, eventListeners_1.notifyEventListeners)('launchNotificationOpened', message);
85
77
  // once we are done with it we can remove the listener
86
78
  launchNotificationOpenedListener?.remove();
87
79
  })
@@ -90,35 +82,52 @@ const addNativeListeners = () => {
90
82
  // listen for native notification opened (user tapped on notification, opening the app from background -
91
83
  // not quit - state) event and broadcast to library listeners
92
84
  NOTIFICATION_OPENED, message => {
93
- eventListeners_1.notifyEventListeners('notificationOpened', message);
85
+ (0, eventListeners_1.notifyEventListeners)('notificationOpened', message);
94
86
  // if we are in this state, we no longer need the listener as the app was launched via some other means
95
87
  launchNotificationOpenedListener?.remove();
96
88
  });
97
89
  addTokenEventListener(
98
90
  // listen for native new token event, automatically re-register device with provider using new token and
99
91
  // broadcast to library listeners
100
- TOKEN_RECEIVED, token => {
92
+ TOKEN_RECEIVED, async (token) => {
101
93
  // avoid a race condition where two endpoints are created with the same token on a fresh install
102
- if (utils_2.getToken() === token) {
94
+ if ((0, utils_2.getToken)() === token) {
103
95
  return;
104
96
  }
105
- utils_2.setToken(token);
106
- registerDevice();
107
- eventListeners_1.notifyEventListeners('tokenReceived', token);
97
+ (0, utils_2.setToken)(token);
98
+ (0, eventListeners_1.notifyEventListeners)('tokenReceived', token);
99
+ try {
100
+ await registerDevice(token);
101
+ }
102
+ catch (err) {
103
+ logger.error('Failed to register device for push notifications', err);
104
+ throw err;
105
+ }
108
106
  });
109
107
  };
110
- const registerDevice = async () => {
111
- const { credentials, identityId } = await utils_2.resolveCredentials();
112
- const { appId, region } = utils_2.resolveConfig();
113
- return pinpoint_1.updateEndpoint({
114
- address: utils_2.getToken(),
108
+ const addAnalyticsListeners = () => {
109
+ let launchNotificationOpenedListenerRemover;
110
+ // wire up default Pinpoint message event handling
111
+ (0, eventListeners_1.addEventListener)('backgroundMessageReceived', (0, utils_3.createMessageEventRecorder)('received_background'));
112
+ (0, eventListeners_1.addEventListener)('foregroundMessageReceived', (0, utils_3.createMessageEventRecorder)('received_foreground'));
113
+ launchNotificationOpenedListenerRemover = (0, eventListeners_1.addEventListener)('launchNotificationOpened', (0, utils_3.createMessageEventRecorder)('opened_notification',
114
+ // once we are done with it we can remove the listener
115
+ launchNotificationOpenedListenerRemover?.remove));
116
+ (0, eventListeners_1.addEventListener)('notificationOpened', (0, utils_3.createMessageEventRecorder)('opened_notification',
117
+ // if we are in this state, we no longer need the listener as the app was launched via some other means
118
+ launchNotificationOpenedListenerRemover?.remove));
119
+ };
120
+ const registerDevice = async (address) => {
121
+ const { credentials, identityId } = await (0, utils_2.resolveCredentials)();
122
+ const { appId, region } = (0, utils_3.resolveConfig)();
123
+ await (0, pinpoint_1.updateEndpoint)({
124
+ address,
115
125
  appId,
116
126
  category: 'PushNotification',
117
127
  credentials,
118
128
  region,
119
- channelType: utils_3.getChannelType(),
129
+ channelType: (0, utils_3.getChannelType)(),
120
130
  identityId,
121
- userAgentValue: utils_3.getPushNotificationUserAgentString(utils_1.PushNotificationAction.InitializePushNotifications),
131
+ userAgentValue: (0, utils_2.getPushNotificationUserAgentString)(utils_1.PushNotificationAction.InitializePushNotifications),
122
132
  });
123
133
  };
124
- //# sourceMappingURL=initializePushNotifications.native.js.map
@@ -2,6 +2,7 @@
2
2
  // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3
3
  // SPDX-License-Identifier: Apache-2.0
4
4
  Object.defineProperty(exports, "__esModule", { value: true });
5
+ exports.onNotificationOpened = void 0;
5
6
  const utils_1 = require("@aws-amplify/core/internals/utils");
6
7
  /**
7
8
  * Registers a listener that will be triggered when a notification is opened by user.
@@ -28,7 +29,7 @@ const utils_1 = require("@aws-amplify/core/internals/utils");
28
29
  * });
29
30
  * ```
30
31
  */
31
- exports.onNotificationOpened = () => {
32
+ const onNotificationOpened = () => {
32
33
  throw new utils_1.PlatformNotSupportedError();
33
34
  };
34
- //# sourceMappingURL=onNotificationOpened.js.map
35
+ exports.onNotificationOpened = onNotificationOpened;
@@ -2,10 +2,11 @@
2
2
  // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3
3
  // SPDX-License-Identifier: Apache-2.0
4
4
  Object.defineProperty(exports, "__esModule", { value: true });
5
+ exports.onNotificationOpened = void 0;
5
6
  const eventListeners_1 = require("../../../../eventListeners");
6
7
  const errorHelpers_1 = require("../../../errors/errorHelpers");
7
- exports.onNotificationOpened = input => {
8
- errorHelpers_1.assertIsInitialized();
9
- return eventListeners_1.addEventListener('notificationOpened', input);
8
+ const onNotificationOpened = input => {
9
+ (0, errorHelpers_1.assertIsInitialized)();
10
+ return (0, eventListeners_1.addEventListener)('notificationOpened', input);
10
11
  };
11
- //# sourceMappingURL=onNotificationOpened.native.js.map
12
+ exports.onNotificationOpened = onNotificationOpened;
@@ -2,6 +2,7 @@
2
2
  // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3
3
  // SPDX-License-Identifier: Apache-2.0
4
4
  Object.defineProperty(exports, "__esModule", { value: true });
5
+ exports.onNotificationReceivedInBackground = void 0;
5
6
  const utils_1 = require("@aws-amplify/core/internals/utils");
6
7
  /**
7
8
  * Registers a listener that will be triggered when a notification is received while app is in a background state.
@@ -44,7 +45,7 @@ const utils_1 = require("@aws-amplify/core/internals/utils");
44
45
  * });
45
46
  * ```
46
47
  */
47
- exports.onNotificationReceivedInBackground = () => {
48
+ const onNotificationReceivedInBackground = () => {
48
49
  throw new utils_1.PlatformNotSupportedError();
49
50
  };
50
- //# sourceMappingURL=onNotificationReceivedInBackground.js.map
51
+ exports.onNotificationReceivedInBackground = onNotificationReceivedInBackground;
@@ -2,10 +2,11 @@
2
2
  // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3
3
  // SPDX-License-Identifier: Apache-2.0
4
4
  Object.defineProperty(exports, "__esModule", { value: true });
5
+ exports.onNotificationReceivedInBackground = void 0;
5
6
  const eventListeners_1 = require("../../../../eventListeners");
6
7
  const errorHelpers_1 = require("../../../errors/errorHelpers");
7
- exports.onNotificationReceivedInBackground = input => {
8
- errorHelpers_1.assertIsInitialized();
9
- return eventListeners_1.addEventListener('backgroundMessageReceived', input);
8
+ const onNotificationReceivedInBackground = input => {
9
+ (0, errorHelpers_1.assertIsInitialized)();
10
+ return (0, eventListeners_1.addEventListener)('backgroundMessageReceived', input);
10
11
  };
11
- //# sourceMappingURL=onNotificationReceivedInBackground.native.js.map
12
+ exports.onNotificationReceivedInBackground = onNotificationReceivedInBackground;
@@ -2,6 +2,7 @@
2
2
  // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3
3
  // SPDX-License-Identifier: Apache-2.0
4
4
  Object.defineProperty(exports, "__esModule", { value: true });
5
+ exports.onNotificationReceivedInForeground = void 0;
5
6
  const utils_1 = require("@aws-amplify/core/internals/utils");
6
7
  /**
7
8
  * Registers a listener that will be triggered when a notification is received while app is in a foreground state.
@@ -28,7 +29,7 @@ const utils_1 = require("@aws-amplify/core/internals/utils");
28
29
  * });
29
30
  * ```
30
31
  */
31
- exports.onNotificationReceivedInForeground = () => {
32
+ const onNotificationReceivedInForeground = () => {
32
33
  throw new utils_1.PlatformNotSupportedError();
33
34
  };
34
- //# sourceMappingURL=onNotificationReceivedInForeground.js.map
35
+ exports.onNotificationReceivedInForeground = onNotificationReceivedInForeground;
@@ -2,10 +2,11 @@
2
2
  // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3
3
  // SPDX-License-Identifier: Apache-2.0
4
4
  Object.defineProperty(exports, "__esModule", { value: true });
5
+ exports.onNotificationReceivedInForeground = void 0;
5
6
  const eventListeners_1 = require("../../../../eventListeners");
6
7
  const errorHelpers_1 = require("../../../errors/errorHelpers");
7
- exports.onNotificationReceivedInForeground = input => {
8
- errorHelpers_1.assertIsInitialized();
9
- return eventListeners_1.addEventListener('foregroundMessageReceived', input);
8
+ const onNotificationReceivedInForeground = input => {
9
+ (0, errorHelpers_1.assertIsInitialized)();
10
+ return (0, eventListeners_1.addEventListener)('foregroundMessageReceived', input);
10
11
  };
11
- //# sourceMappingURL=onNotificationReceivedInForeground.native.js.map
12
+ exports.onNotificationReceivedInForeground = onNotificationReceivedInForeground;