@aws-amplify/notifications 2.0.1-api-v6-models.9351bcf.0 → 2.0.1-api-v6-models.891fe0d.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 (287) hide show
  1. package/in-app-messaging/package.json +4 -4
  2. package/lib/eventListeners/eventListeners.js +19 -37
  3. package/lib/eventListeners/index.js +4 -3
  4. package/lib/eventListeners/types.d.ts +2 -2
  5. package/lib/inAppMessaging/errors/InAppMessagingError.js +8 -11
  6. package/lib/inAppMessaging/errors/assertServiceError.js +3 -2
  7. package/lib/inAppMessaging/errors/assertValidationError.js +5 -4
  8. package/lib/inAppMessaging/errors/index.js +6 -5
  9. package/lib/inAppMessaging/errors/validation.js +7 -7
  10. package/lib/inAppMessaging/index.d.ts +2 -1
  11. package/lib/inAppMessaging/index.js +12 -10
  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 +26 -38
  15. package/lib/inAppMessaging/providers/pinpoint/apis/identifyUser.d.ts +2 -1
  16. package/lib/inAppMessaging/providers/pinpoint/apis/identifyUser.js +24 -35
  17. package/lib/inAppMessaging/providers/pinpoint/apis/index.d.ts +1 -0
  18. package/lib/inAppMessaging/providers/pinpoint/apis/index.js +13 -10
  19. package/lib/inAppMessaging/providers/pinpoint/apis/initializeInAppMessaging.js +21 -21
  20. package/lib/inAppMessaging/providers/pinpoint/apis/notifyMessageInteraction.js +6 -6
  21. package/lib/inAppMessaging/providers/pinpoint/apis/onMessageActionTaken.js +5 -4
  22. package/lib/inAppMessaging/providers/pinpoint/apis/onMessageDismissed.js +5 -4
  23. package/lib/inAppMessaging/providers/pinpoint/apis/onMessageDisplayed.js +5 -4
  24. package/lib/inAppMessaging/providers/pinpoint/apis/onMessageReceived.js +5 -4
  25. package/lib/inAppMessaging/providers/pinpoint/apis/setConflictHandler.js +6 -6
  26. package/lib/inAppMessaging/providers/pinpoint/apis/syncMessages.js +46 -76
  27. package/lib/inAppMessaging/providers/pinpoint/index.d.ts +1 -1
  28. package/lib/inAppMessaging/providers/pinpoint/index.js +12 -10
  29. package/lib/inAppMessaging/providers/pinpoint/types/index.js +2 -1
  30. package/lib/inAppMessaging/providers/pinpoint/types/inputs.d.ts +8 -8
  31. package/lib/inAppMessaging/providers/pinpoint/types/options.d.ts +1 -1
  32. package/lib/inAppMessaging/providers/pinpoint/types/outputs.d.ts +4 -4
  33. package/lib/inAppMessaging/providers/pinpoint/types/types.d.ts +6 -6
  34. package/lib/inAppMessaging/providers/pinpoint/types/types.js +1 -0
  35. package/lib/inAppMessaging/providers/pinpoint/utils/constants.js +1 -0
  36. package/lib/inAppMessaging/providers/pinpoint/utils/helpers.d.ts +3 -3
  37. package/lib/inAppMessaging/providers/pinpoint/utils/helpers.js +114 -110
  38. package/lib/inAppMessaging/providers/pinpoint/utils/index.js +11 -10
  39. package/lib/inAppMessaging/providers/pinpoint/utils/messageProcessingHelpers.js +116 -191
  40. package/lib/inAppMessaging/providers/pinpoint/utils/resolveConfig.js +9 -8
  41. package/lib/inAppMessaging/providers/pinpoint/utils/resolveCredentials.d.ts +1 -1
  42. package/lib/inAppMessaging/providers/pinpoint/utils/resolveCredentials.js +9 -15
  43. package/lib/inAppMessaging/providers/pinpoint/utils/userAgent.js +6 -5
  44. package/lib/inAppMessaging/types/event.d.ts +2 -2
  45. package/lib/inAppMessaging/types/inputs.d.ts +1 -1
  46. package/lib/inAppMessaging/types/message.d.ts +3 -3
  47. package/lib/inAppMessaging/types/options.d.ts +1 -1
  48. package/lib/inAppMessaging/utils/index.js +4 -3
  49. package/lib/inAppMessaging/utils/statusHelpers.js +8 -5
  50. package/lib/index.js +1 -0
  51. package/lib/pushNotifications/errors/PushNotificationError.js +8 -11
  52. package/lib/pushNotifications/errors/errorHelpers.js +14 -13
  53. package/lib/pushNotifications/errors/index.js +4 -3
  54. package/lib/pushNotifications/index.d.ts +1 -1
  55. package/lib/pushNotifications/index.js +13 -12
  56. package/lib/pushNotifications/providers/pinpoint/apis/getBadgeCount.js +4 -2
  57. package/lib/pushNotifications/providers/pinpoint/apis/getBadgeCount.native.js +9 -10
  58. package/lib/pushNotifications/providers/pinpoint/apis/getLaunchNotification.js +4 -2
  59. package/lib/pushNotifications/providers/pinpoint/apis/getLaunchNotification.native.js +7 -5
  60. package/lib/pushNotifications/providers/pinpoint/apis/getPermissionStatus.js +4 -2
  61. package/lib/pushNotifications/providers/pinpoint/apis/getPermissionStatus.native.js +7 -5
  62. package/lib/pushNotifications/providers/pinpoint/apis/identifyUser.js +4 -2
  63. package/lib/pushNotifications/providers/pinpoint/apis/identifyUser.native.js +25 -36
  64. package/lib/pushNotifications/providers/pinpoint/apis/index.js +12 -11
  65. package/lib/pushNotifications/providers/pinpoint/apis/initializePushNotifications.js +4 -2
  66. package/lib/pushNotifications/providers/pinpoint/apis/initializePushNotifications.native.d.ts +1 -1
  67. package/lib/pushNotifications/providers/pinpoint/apis/initializePushNotifications.native.js +90 -115
  68. package/lib/pushNotifications/providers/pinpoint/apis/onNotificationOpened.js +4 -2
  69. package/lib/pushNotifications/providers/pinpoint/apis/onNotificationOpened.native.js +7 -5
  70. package/lib/pushNotifications/providers/pinpoint/apis/onNotificationReceivedInBackground.js +4 -2
  71. package/lib/pushNotifications/providers/pinpoint/apis/onNotificationReceivedInBackground.native.js +7 -5
  72. package/lib/pushNotifications/providers/pinpoint/apis/onNotificationReceivedInForeground.js +4 -2
  73. package/lib/pushNotifications/providers/pinpoint/apis/onNotificationReceivedInForeground.native.js +7 -5
  74. package/lib/pushNotifications/providers/pinpoint/apis/onTokenReceived.js +4 -2
  75. package/lib/pushNotifications/providers/pinpoint/apis/onTokenReceived.native.js +7 -5
  76. package/lib/pushNotifications/providers/pinpoint/apis/requestPermissions.js +4 -2
  77. package/lib/pushNotifications/providers/pinpoint/apis/requestPermissions.native.js +7 -5
  78. package/lib/pushNotifications/providers/pinpoint/apis/setBadgeCount.js +4 -2
  79. package/lib/pushNotifications/providers/pinpoint/apis/setBadgeCount.native.js +7 -5
  80. package/lib/pushNotifications/providers/pinpoint/index.d.ts +1 -1
  81. package/lib/pushNotifications/providers/pinpoint/index.js +12 -11
  82. package/lib/pushNotifications/providers/pinpoint/types/analytics.d.ts +3 -3
  83. package/lib/pushNotifications/providers/pinpoint/types/apis.d.ts +11 -11
  84. package/lib/pushNotifications/providers/pinpoint/types/inputs.d.ts +7 -7
  85. package/lib/pushNotifications/providers/pinpoint/types/options.d.ts +1 -1
  86. package/lib/pushNotifications/providers/pinpoint/types/outputs.d.ts +8 -8
  87. package/lib/pushNotifications/providers/pinpoint/types/pushNotifications.d.ts +1 -1
  88. package/lib/pushNotifications/providers/pinpoint/utils/createMessageEventRecorder.d.ts +3 -2
  89. package/lib/pushNotifications/providers/pinpoint/utils/createMessageEventRecorder.js +33 -49
  90. package/lib/pushNotifications/providers/pinpoint/utils/getAnalyticsEvent.d.ts +3 -2
  91. package/lib/pushNotifications/providers/pinpoint/utils/getAnalyticsEvent.js +17 -13
  92. package/lib/pushNotifications/providers/pinpoint/utils/getChannelType.d.ts +2 -1
  93. package/lib/pushNotifications/providers/pinpoint/utils/getChannelType.js +9 -7
  94. package/lib/pushNotifications/providers/pinpoint/utils/index.d.ts +2 -1
  95. package/lib/pushNotifications/providers/pinpoint/utils/index.js +7 -4
  96. package/lib/pushNotifications/providers/pinpoint/utils/resolveConfig.js +17 -0
  97. package/lib/pushNotifications/types/errors.js +1 -0
  98. package/lib/pushNotifications/types/index.d.ts +1 -0
  99. package/lib/pushNotifications/types/index.js +20 -2
  100. package/lib/pushNotifications/types/inputs.d.ts +9 -8
  101. package/lib/pushNotifications/types/module.d.ts +31 -0
  102. package/lib/pushNotifications/types/options.d.ts +1 -1
  103. package/lib/pushNotifications/types/outputs.d.ts +8 -8
  104. package/lib/pushNotifications/types/pushNotifications.d.ts +4 -5
  105. package/lib/pushNotifications/utils/getPushNotificationUserAgentString.js +11 -0
  106. package/lib/pushNotifications/utils/index.d.ts +1 -1
  107. package/lib/pushNotifications/utils/index.js +8 -7
  108. package/lib/pushNotifications/utils/initializationManager.js +8 -9
  109. package/lib/pushNotifications/utils/resolveCredentials.d.ts +1 -1
  110. package/lib/pushNotifications/utils/resolveCredentials.js +9 -15
  111. package/lib/pushNotifications/utils/tokenManager.js +6 -3
  112. package/lib/tsconfig.tsbuildinfo +1 -0
  113. package/lib-esm/eventListeners/eventListeners.js +15 -37
  114. package/lib-esm/eventListeners/types.d.ts +2 -2
  115. package/lib-esm/eventListeners/types.js +1 -0
  116. package/lib-esm/inAppMessaging/errors/InAppMessagingError.js +6 -11
  117. package/lib-esm/inAppMessaging/errors/assertValidationError.js +2 -2
  118. package/lib-esm/inAppMessaging/errors/validation.js +6 -7
  119. package/lib-esm/inAppMessaging/index.d.ts +2 -1
  120. package/lib-esm/inAppMessaging/index.js +1 -1
  121. package/lib-esm/inAppMessaging/providers/pinpoint/apis/clearMessages.d.ts +13 -0
  122. package/lib-esm/inAppMessaging/providers/pinpoint/apis/clearMessages.js +22 -0
  123. package/lib-esm/inAppMessaging/providers/pinpoint/apis/dispatchEvent.js +15 -31
  124. package/lib-esm/inAppMessaging/providers/pinpoint/apis/identifyUser.d.ts +2 -1
  125. package/lib-esm/inAppMessaging/providers/pinpoint/apis/identifyUser.js +18 -31
  126. package/lib-esm/inAppMessaging/providers/pinpoint/apis/index.d.ts +1 -0
  127. package/lib-esm/inAppMessaging/providers/pinpoint/apis/index.js +1 -0
  128. package/lib-esm/inAppMessaging/providers/pinpoint/apis/initializeInAppMessaging.js +5 -6
  129. package/lib-esm/inAppMessaging/providers/pinpoint/apis/notifyMessageInteraction.js +1 -2
  130. package/lib-esm/inAppMessaging/providers/pinpoint/apis/setConflictHandler.js +4 -5
  131. package/lib-esm/inAppMessaging/providers/pinpoint/apis/syncMessages.js +38 -69
  132. package/lib-esm/inAppMessaging/providers/pinpoint/index.d.ts +1 -1
  133. package/lib-esm/inAppMessaging/providers/pinpoint/index.js +1 -1
  134. package/lib-esm/inAppMessaging/providers/pinpoint/types/inputs.d.ts +8 -8
  135. package/lib-esm/inAppMessaging/providers/pinpoint/types/inputs.js +1 -0
  136. package/lib-esm/inAppMessaging/providers/pinpoint/types/options.d.ts +1 -1
  137. package/lib-esm/inAppMessaging/providers/pinpoint/types/options.js +1 -0
  138. package/lib-esm/inAppMessaging/providers/pinpoint/types/outputs.d.ts +4 -4
  139. package/lib-esm/inAppMessaging/providers/pinpoint/types/outputs.js +1 -0
  140. package/lib-esm/inAppMessaging/providers/pinpoint/types/types.d.ts +6 -6
  141. package/lib-esm/inAppMessaging/providers/pinpoint/utils/constants.js +4 -4
  142. package/lib-esm/inAppMessaging/providers/pinpoint/utils/helpers.d.ts +3 -3
  143. package/lib-esm/inAppMessaging/providers/pinpoint/utils/helpers.js +85 -97
  144. package/lib-esm/inAppMessaging/providers/pinpoint/utils/messageProcessingHelpers.js +111 -187
  145. package/lib-esm/inAppMessaging/providers/pinpoint/utils/resolveConfig.js +3 -4
  146. package/lib-esm/inAppMessaging/providers/pinpoint/utils/resolveCredentials.d.ts +1 -1
  147. package/lib-esm/inAppMessaging/providers/pinpoint/utils/resolveCredentials.js +5 -13
  148. package/lib-esm/inAppMessaging/providers/pinpoint/utils/userAgent.js +2 -2
  149. package/lib-esm/inAppMessaging/types/event.d.ts +2 -2
  150. package/lib-esm/inAppMessaging/types/event.js +1 -0
  151. package/lib-esm/inAppMessaging/types/index.js +1 -0
  152. package/lib-esm/inAppMessaging/types/inputs.d.ts +1 -1
  153. package/lib-esm/inAppMessaging/types/inputs.js +1 -0
  154. package/lib-esm/inAppMessaging/types/message.d.ts +3 -3
  155. package/lib-esm/inAppMessaging/types/message.js +1 -0
  156. package/lib-esm/inAppMessaging/types/options.d.ts +1 -1
  157. package/lib-esm/inAppMessaging/types/options.js +1 -0
  158. package/lib-esm/inAppMessaging/utils/statusHelpers.js +3 -3
  159. package/lib-esm/index.js +1 -0
  160. package/lib-esm/pushNotifications/errors/PushNotificationError.js +6 -11
  161. package/lib-esm/pushNotifications/errors/errorHelpers.js +8 -9
  162. package/lib-esm/pushNotifications/index.d.ts +1 -1
  163. package/lib-esm/pushNotifications/providers/pinpoint/apis/getBadgeCount.js +1 -1
  164. package/lib-esm/pushNotifications/providers/pinpoint/apis/getBadgeCount.native.js +5 -8
  165. package/lib-esm/pushNotifications/providers/pinpoint/apis/getLaunchNotification.js +1 -1
  166. package/lib-esm/pushNotifications/providers/pinpoint/apis/getLaunchNotification.native.js +2 -2
  167. package/lib-esm/pushNotifications/providers/pinpoint/apis/getPermissionStatus.js +1 -1
  168. package/lib-esm/pushNotifications/providers/pinpoint/apis/getPermissionStatus.native.js +2 -2
  169. package/lib-esm/pushNotifications/providers/pinpoint/apis/identifyUser.js +1 -1
  170. package/lib-esm/pushNotifications/providers/pinpoint/apis/identifyUser.native.js +20 -33
  171. package/lib-esm/pushNotifications/providers/pinpoint/apis/initializePushNotifications.js +1 -1
  172. package/lib-esm/pushNotifications/providers/pinpoint/apis/initializePushNotifications.native.d.ts +1 -1
  173. package/lib-esm/pushNotifications/providers/pinpoint/apis/initializePushNotifications.native.js +76 -103
  174. package/lib-esm/pushNotifications/providers/pinpoint/apis/onNotificationOpened.js +1 -1
  175. package/lib-esm/pushNotifications/providers/pinpoint/apis/onNotificationOpened.native.js +1 -1
  176. package/lib-esm/pushNotifications/providers/pinpoint/apis/onNotificationReceivedInBackground.js +1 -1
  177. package/lib-esm/pushNotifications/providers/pinpoint/apis/onNotificationReceivedInBackground.native.js +1 -1
  178. package/lib-esm/pushNotifications/providers/pinpoint/apis/onNotificationReceivedInForeground.js +1 -1
  179. package/lib-esm/pushNotifications/providers/pinpoint/apis/onNotificationReceivedInForeground.native.js +1 -1
  180. package/lib-esm/pushNotifications/providers/pinpoint/apis/onTokenReceived.js +1 -1
  181. package/lib-esm/pushNotifications/providers/pinpoint/apis/onTokenReceived.native.js +1 -1
  182. package/lib-esm/pushNotifications/providers/pinpoint/apis/requestPermissions.js +1 -1
  183. package/lib-esm/pushNotifications/providers/pinpoint/apis/requestPermissions.native.js +2 -2
  184. package/lib-esm/pushNotifications/providers/pinpoint/apis/setBadgeCount.js +1 -1
  185. package/lib-esm/pushNotifications/providers/pinpoint/apis/setBadgeCount.native.js +2 -2
  186. package/lib-esm/pushNotifications/providers/pinpoint/index.d.ts +1 -1
  187. package/lib-esm/pushNotifications/providers/pinpoint/types/analytics.d.ts +3 -3
  188. package/lib-esm/pushNotifications/providers/pinpoint/types/analytics.js +1 -0
  189. package/lib-esm/pushNotifications/providers/pinpoint/types/apis.d.ts +11 -11
  190. package/lib-esm/pushNotifications/providers/pinpoint/types/apis.js +1 -0
  191. package/lib-esm/pushNotifications/providers/pinpoint/types/index.js +1 -0
  192. package/lib-esm/pushNotifications/providers/pinpoint/types/inputs.d.ts +7 -7
  193. package/lib-esm/pushNotifications/providers/pinpoint/types/inputs.js +1 -0
  194. package/lib-esm/pushNotifications/providers/pinpoint/types/options.d.ts +1 -1
  195. package/lib-esm/pushNotifications/providers/pinpoint/types/options.js +1 -0
  196. package/lib-esm/pushNotifications/providers/pinpoint/types/outputs.d.ts +8 -8
  197. package/lib-esm/pushNotifications/providers/pinpoint/types/outputs.js +1 -0
  198. package/lib-esm/pushNotifications/providers/pinpoint/types/pushNotifications.d.ts +1 -1
  199. package/lib-esm/pushNotifications/providers/pinpoint/types/pushNotifications.js +1 -0
  200. package/lib-esm/pushNotifications/providers/pinpoint/utils/createMessageEventRecorder.d.ts +3 -2
  201. package/lib-esm/pushNotifications/providers/pinpoint/utils/createMessageEventRecorder.js +27 -45
  202. package/lib-esm/pushNotifications/providers/pinpoint/utils/getAnalyticsEvent.d.ts +3 -2
  203. package/lib-esm/pushNotifications/providers/pinpoint/utils/getAnalyticsEvent.js +15 -13
  204. package/lib-esm/pushNotifications/providers/pinpoint/utils/getChannelType.d.ts +2 -1
  205. package/lib-esm/pushNotifications/providers/pinpoint/utils/getChannelType.js +5 -5
  206. package/lib-esm/pushNotifications/providers/pinpoint/utils/index.d.ts +2 -1
  207. package/lib-esm/pushNotifications/providers/pinpoint/utils/index.js +2 -1
  208. package/lib-esm/pushNotifications/{utils → providers/pinpoint/utils}/resolveConfig.js +4 -5
  209. package/lib-esm/pushNotifications/types/index.d.ts +1 -0
  210. package/lib-esm/pushNotifications/types/index.js +5 -0
  211. package/lib-esm/pushNotifications/types/inputs.d.ts +9 -8
  212. package/lib-esm/pushNotifications/types/inputs.js +1 -0
  213. package/lib-esm/pushNotifications/types/module.d.ts +31 -0
  214. package/lib-esm/pushNotifications/{Platform/types.js → types/module.js} +1 -0
  215. package/lib-esm/pushNotifications/types/options.d.ts +1 -1
  216. package/lib-esm/pushNotifications/types/options.js +1 -0
  217. package/lib-esm/pushNotifications/types/outputs.d.ts +8 -8
  218. package/lib-esm/pushNotifications/types/outputs.js +1 -0
  219. package/lib-esm/pushNotifications/types/pushNotifications.d.ts +4 -5
  220. package/lib-esm/pushNotifications/types/pushNotifications.js +1 -0
  221. package/lib-esm/pushNotifications/{providers/pinpoint/utils → utils}/getPushNotificationUserAgentString.js +4 -6
  222. package/lib-esm/pushNotifications/utils/index.d.ts +1 -1
  223. package/lib-esm/pushNotifications/utils/index.js +1 -1
  224. package/lib-esm/pushNotifications/utils/initializationManager.js +5 -9
  225. package/lib-esm/pushNotifications/utils/resolveCredentials.d.ts +1 -1
  226. package/lib-esm/pushNotifications/utils/resolveCredentials.js +5 -13
  227. package/lib-esm/pushNotifications/utils/tokenManager.js +3 -3
  228. package/lib-esm/tsconfig.tsbuildinfo +1 -0
  229. package/package.json +63 -30
  230. package/src/inAppMessaging/index.ts +12 -0
  231. package/src/inAppMessaging/providers/pinpoint/apis/clearMessages.ts +26 -0
  232. package/src/inAppMessaging/providers/pinpoint/apis/index.ts +1 -0
  233. package/src/inAppMessaging/providers/pinpoint/index.ts +1 -0
  234. package/src/inAppMessaging/providers/pinpoint/utils/helpers.ts +38 -28
  235. package/src/inAppMessaging/providers/pinpoint/utils/messageProcessingHelpers.ts +25 -9
  236. package/src/inAppMessaging/providers/pinpoint/utils/resolveConfig.ts +1 -1
  237. package/src/pushNotifications/index.ts +1 -0
  238. package/src/pushNotifications/providers/pinpoint/apis/getBadgeCount.ts +1 -1
  239. package/src/pushNotifications/providers/pinpoint/apis/getLaunchNotification.native.ts +1 -1
  240. package/src/pushNotifications/providers/pinpoint/apis/getLaunchNotification.ts +1 -1
  241. package/src/pushNotifications/providers/pinpoint/apis/getPermissionStatus.native.ts +1 -1
  242. package/src/pushNotifications/providers/pinpoint/apis/getPermissionStatus.ts +1 -1
  243. package/src/pushNotifications/providers/pinpoint/apis/identifyUser.native.ts +5 -2
  244. package/src/pushNotifications/providers/pinpoint/apis/identifyUser.ts +1 -1
  245. package/src/pushNotifications/providers/pinpoint/apis/initializePushNotifications.native.ts +51 -41
  246. package/src/pushNotifications/providers/pinpoint/apis/requestPermissions.native.ts +1 -1
  247. package/src/pushNotifications/providers/pinpoint/apis/requestPermissions.ts +1 -1
  248. package/src/pushNotifications/providers/pinpoint/index.ts +1 -0
  249. package/src/pushNotifications/providers/pinpoint/utils/createMessageEventRecorder.ts +5 -4
  250. package/src/pushNotifications/providers/pinpoint/utils/getAnalyticsEvent.ts +7 -4
  251. package/src/pushNotifications/providers/pinpoint/utils/getChannelType.ts +1 -1
  252. package/src/pushNotifications/providers/pinpoint/utils/index.ts +2 -1
  253. package/src/pushNotifications/{utils → providers/pinpoint/utils}/resolveConfig.ts +2 -2
  254. package/src/pushNotifications/types/index.ts +1 -0
  255. package/src/pushNotifications/types/inputs.ts +1 -1
  256. package/src/pushNotifications/types/module.ts +42 -0
  257. package/src/pushNotifications/types/outputs.ts +1 -1
  258. package/src/pushNotifications/types/pushNotifications.ts +2 -7
  259. package/src/pushNotifications/utils/index.ts +1 -1
  260. package/lib/inAppMessaging/providers/index.d.ts +0 -2
  261. package/lib/inAppMessaging/providers/index.js +0 -15
  262. package/lib/pushNotifications/Platform/index.d.ts +0 -2
  263. package/lib/pushNotifications/Platform/index.js +0 -25
  264. package/lib/pushNotifications/Platform/index.native.d.ts +0 -2
  265. package/lib/pushNotifications/Platform/index.native.js +0 -7
  266. package/lib/pushNotifications/Platform/types.d.ts +0 -5
  267. package/lib/pushNotifications/providers/pinpoint/utils/getPushNotificationUserAgentString.js +0 -11
  268. package/lib/pushNotifications/utils/resolveConfig.js +0 -16
  269. package/lib/tsconfig.build.tsbuildinfo +0 -8667
  270. package/lib-esm/inAppMessaging/providers/index.d.ts +0 -2
  271. package/lib-esm/inAppMessaging/providers/index.js +0 -3
  272. package/lib-esm/pushNotifications/Platform/index.d.ts +0 -2
  273. package/lib-esm/pushNotifications/Platform/index.js +0 -23
  274. package/lib-esm/pushNotifications/Platform/index.native.d.ts +0 -2
  275. package/lib-esm/pushNotifications/Platform/index.native.js +0 -5
  276. package/lib-esm/pushNotifications/Platform/types.d.ts +0 -5
  277. package/lib-esm/tsconfig.build.tsbuildinfo +0 -7115
  278. package/src/inAppMessaging/providers/index.ts +0 -38
  279. package/src/pushNotifications/Platform/index.native.ts +0 -9
  280. package/src/pushNotifications/Platform/index.ts +0 -22
  281. package/src/pushNotifications/Platform/types.ts +0 -15
  282. /package/lib/pushNotifications/{utils → providers/pinpoint/utils}/resolveConfig.d.ts +0 -0
  283. /package/lib/pushNotifications/{Platform/types.js → types/module.js} +0 -0
  284. /package/lib/pushNotifications/{providers/pinpoint/utils → utils}/getPushNotificationUserAgentString.d.ts +0 -0
  285. /package/lib-esm/pushNotifications/{utils → providers/pinpoint/utils}/resolveConfig.d.ts +0 -0
  286. /package/lib-esm/pushNotifications/{providers/pinpoint/utils → utils}/getPushNotificationUserAgentString.d.ts +0 -0
  287. /package/src/pushNotifications/{providers/pinpoint/utils → utils}/getPushNotificationUserAgentString.ts +0 -0
@@ -2,8 +2,8 @@
2
2
  // SPDX-License-Identifier: Apache-2.0
3
3
  import { loadAmplifyPushNotification } from '@aws-amplify/react-native';
4
4
  import { assertIsInitialized } from '../../../errors/errorHelpers';
5
- var getPermissionStatusNative = loadAmplifyPushNotification().getPermissionStatus;
6
- export var getPermissionStatus = function () {
5
+ const { getPermissionStatus: getPermissionStatusNative } = loadAmplifyPushNotification();
6
+ export const getPermissionStatus = async () => {
7
7
  assertIsInitialized();
8
8
  return getPermissionStatusNative();
9
9
  };
@@ -52,6 +52,6 @@ import { PlatformNotSupportedError } from '@aws-amplify/core/internals/utils';
52
52
  * },
53
53
  * });
54
54
  */
55
- export var identifyUser = function () {
55
+ export const identifyUser = async () => {
56
56
  throw new PlatformNotSupportedError();
57
57
  };
@@ -1,40 +1,27 @@
1
1
  // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
2
  // SPDX-License-Identifier: Apache-2.0
3
- import { __awaiter, __generator } from "tslib";
4
3
  import { PushNotificationAction } from '@aws-amplify/core/internals/utils';
5
4
  import { updateEndpoint } from '@aws-amplify/core/internals/providers/pinpoint';
6
5
  import { assertIsInitialized } from '../../../errors/errorHelpers';
7
- import { resolveConfig, resolveCredentials } from '../../../utils';
8
- import { getChannelType, getPushNotificationUserAgentString } from '../utils';
9
- export var identifyUser = function (_a) {
10
- var userId = _a.userId, userProfile = _a.userProfile, options = _a.options;
11
- return __awaiter(void 0, void 0, void 0, function () {
12
- var _b, credentials, identityId, _c, appId, region, _d, address, optOut, userAttributes;
13
- return __generator(this, function (_e) {
14
- switch (_e.label) {
15
- case 0:
16
- assertIsInitialized();
17
- return [4 /*yield*/, resolveCredentials()];
18
- case 1:
19
- _b = _e.sent(), credentials = _b.credentials, identityId = _b.identityId;
20
- _c = resolveConfig(), appId = _c.appId, region = _c.region;
21
- _d = options !== null && options !== void 0 ? options : {}, address = _d.address, optOut = _d.optOut, userAttributes = _d.userAttributes;
22
- updateEndpoint({
23
- address: address,
24
- channelType: getChannelType(),
25
- optOut: optOut,
26
- appId: appId,
27
- category: 'PushNotification',
28
- credentials: credentials,
29
- identityId: identityId,
30
- region: region,
31
- userAttributes: userAttributes,
32
- userId: userId,
33
- userProfile: userProfile,
34
- userAgentValue: getPushNotificationUserAgentString(PushNotificationAction.IdentifyUser),
35
- });
36
- return [2 /*return*/];
37
- }
38
- });
6
+ import { getPushNotificationUserAgentString, resolveCredentials, } from '../../../utils';
7
+ import { getChannelType, resolveConfig } from '../utils';
8
+ export const identifyUser = async ({ userId, userProfile, options, }) => {
9
+ assertIsInitialized();
10
+ const { credentials, identityId } = await resolveCredentials();
11
+ const { appId, region } = resolveConfig();
12
+ const { address, optOut, userAttributes } = options ?? {};
13
+ updateEndpoint({
14
+ address,
15
+ channelType: getChannelType(),
16
+ optOut,
17
+ appId,
18
+ category: 'PushNotification',
19
+ credentials,
20
+ identityId,
21
+ region,
22
+ userAttributes,
23
+ userId,
24
+ userProfile,
25
+ userAgentValue: getPushNotificationUserAgentString(PushNotificationAction.IdentifyUser),
39
26
  });
40
27
  };
@@ -16,6 +16,6 @@ import { PlatformNotSupportedError } from '@aws-amplify/core/internals/utils';
16
16
  * initializePushNotifications();
17
17
  * ```
18
18
  */
19
- export var initializePushNotifications = function () {
19
+ export const initializePushNotifications = () => {
20
20
  throw new PlatformNotSupportedError();
21
21
  };
@@ -1 +1 @@
1
- export declare const initializePushNotifications: () => Promise<void>;
1
+ export declare const initializePushNotifications: () => void;
@@ -1,17 +1,16 @@
1
1
  // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
2
  // SPDX-License-Identifier: Apache-2.0
3
- import { __awaiter, __generator } from "tslib";
4
3
  import { ConsoleLogger } from '@aws-amplify/core';
5
4
  import { PushNotificationAction } from '@aws-amplify/core/internals/utils';
6
5
  import { updateEndpoint } from '@aws-amplify/core/internals/providers/pinpoint';
7
6
  import { loadAmplifyPushNotification } from '@aws-amplify/react-native';
8
7
  import { addEventListener, notifyEventListeners, notifyEventListenersAndAwaitHandlers, } from '../../../../eventListeners';
9
- import { getToken, initialize, isInitialized, resolveConfig, resolveCredentials, setToken, } from '../../../utils';
10
- import { createMessageEventRecorder, getChannelType, getPushNotificationUserAgentString, } from '../utils';
11
- var _a = loadAmplifyPushNotification(), addMessageEventListener = _a.addMessageEventListener, addTokenEventListener = _a.addTokenEventListener, completeNotification = _a.completeNotification, getConstants = _a.getConstants, registerHeadlessTask = _a.registerHeadlessTask;
12
- var logger = new ConsoleLogger('Notifications.PushNotification');
13
- var BACKGROUND_TASK_TIMEOUT = 25; // seconds
14
- export var initializePushNotifications = function () {
8
+ import { getPushNotificationUserAgentString, getToken, initialize, isInitialized, resolveCredentials, setToken, } from '../../../utils';
9
+ import { createMessageEventRecorder, getChannelType, resolveConfig, } from '../utils';
10
+ const { addMessageEventListener, addTokenEventListener, completeNotification, getConstants, registerHeadlessTask, } = loadAmplifyPushNotification();
11
+ const logger = new ConsoleLogger('Notifications.PushNotification');
12
+ const BACKGROUND_TASK_TIMEOUT = 25; // seconds
13
+ export const initializePushNotifications = () => {
15
14
  if (isInitialized()) {
16
15
  logger.info('Push notifications have already been enabled');
17
16
  return;
@@ -20,137 +19,111 @@ export var initializePushNotifications = function () {
20
19
  addAnalyticsListeners();
21
20
  initialize();
22
21
  };
23
- var addAnalyticsListeners = function () {
24
- var launchNotificationOpenedListenerRemover;
25
- // wire up default Pinpoint message event handling
26
- addEventListener('backgroundMessageReceived', createMessageEventRecorder('backgroundMessageReceived'));
27
- addEventListener('foregroundMessageReceived', createMessageEventRecorder('foregroundMessageReceived'));
28
- launchNotificationOpenedListenerRemover = addEventListener('launchNotificationsOpened', createMessageEventRecorder('notificationOpened',
29
- // once we are done with it we can remove the listener
30
- launchNotificationOpenedListenerRemover === null ||
31
- // once we are done with it we can remove the listener
32
- launchNotificationOpenedListenerRemover === void 0 ? void 0 :
33
- // once we are done with it we can remove the listener
34
- launchNotificationOpenedListenerRemover.remove));
35
- addEventListener('notificationOpened', createMessageEventRecorder('notificationOpened',
36
- // if we are in this state, we no longer need the listener as the app was launched via some other means
37
- launchNotificationOpenedListenerRemover === null ||
38
- // if we are in this state, we no longer need the listener as the app was launched via some other means
39
- launchNotificationOpenedListenerRemover === void 0 ? void 0 :
40
- // if we are in this state, we no longer need the listener as the app was launched via some other means
41
- launchNotificationOpenedListenerRemover.remove));
42
- };
43
- var addNativeListeners = function () {
44
- var _a = getConstants(), NativeEvent = _a.NativeEvent, NativeHeadlessTaskKey = _a.NativeHeadlessTaskKey;
45
- var BACKGROUND_MESSAGE_RECEIVED = NativeEvent.BACKGROUND_MESSAGE_RECEIVED, FOREGROUND_MESSAGE_RECEIVED = NativeEvent.FOREGROUND_MESSAGE_RECEIVED, LAUNCH_NOTIFICATION_OPENED = NativeEvent.LAUNCH_NOTIFICATION_OPENED, NOTIFICATION_OPENED = NativeEvent.NOTIFICATION_OPENED, TOKEN_RECEIVED = NativeEvent.TOKEN_RECEIVED;
22
+ const addNativeListeners = () => {
23
+ let launchNotificationOpenedListener;
24
+ const { NativeEvent, NativeHeadlessTaskKey } = getConstants();
25
+ const { BACKGROUND_MESSAGE_RECEIVED, FOREGROUND_MESSAGE_RECEIVED, LAUNCH_NOTIFICATION_OPENED, NOTIFICATION_OPENED, TOKEN_RECEIVED, } = NativeEvent;
46
26
  // on platforms that can handle headless tasks, register one to broadcast background message received to
47
27
  // library listeners
48
28
  if (NativeHeadlessTaskKey) {
49
- registerHeadlessTask(function (message) { return __awaiter(void 0, void 0, void 0, function () {
50
- return __generator(this, function (_a) {
51
- switch (_a.label) {
52
- case 0:
53
- // keep headless task running until handlers have completed their work
54
- return [4 /*yield*/, notifyEventListenersAndAwaitHandlers('backgroundMessageReceived', message)];
55
- case 1:
56
- // keep headless task running until handlers have completed their work
57
- _a.sent();
58
- return [2 /*return*/];
59
- }
60
- });
61
- }); });
29
+ registerHeadlessTask(async (message) => {
30
+ // keep headless task running until handlers have completed their work
31
+ await notifyEventListenersAndAwaitHandlers('backgroundMessageReceived', message);
32
+ });
62
33
  }
63
34
  else if (BACKGROUND_MESSAGE_RECEIVED) {
64
35
  // on platforms that can't handle headless tasks, listen for native background message received event and
65
36
  // broadcast to library listeners
66
- addMessageEventListener(BACKGROUND_MESSAGE_RECEIVED, function (message, completionHandlerId) { return __awaiter(void 0, void 0, void 0, function () {
67
- var err_1;
68
- return __generator(this, function (_a) {
69
- switch (_a.label) {
70
- case 0:
71
- _a.trys.push([0, 2, 3, 4]);
72
- return [4 /*yield*/, Promise.race([
73
- notifyEventListenersAndAwaitHandlers('backgroundMessageReceived', message),
74
- // background tasks will get suspended and all future tasks be deprioritized by the OS if they run for
75
- // more than 30 seconds so we reject with a error in a shorter amount of time to prevent this from
76
- // happening
77
- new Promise(function (_, reject) {
78
- setTimeout(function () {
79
- return reject("onNotificationReceivedInBackground handlers should complete their work within " + BACKGROUND_TASK_TIMEOUT + " seconds, but they did not.");
80
- }, BACKGROUND_TASK_TIMEOUT * 1000);
81
- }),
82
- ])];
83
- case 1:
84
- _a.sent();
85
- return [3 /*break*/, 4];
86
- case 2:
87
- err_1 = _a.sent();
88
- logger.error(err_1);
89
- return [3 /*break*/, 4];
90
- case 3:
91
- // notify native module that handlers have completed their work (or timed out)
92
- completeNotification(completionHandlerId);
93
- return [7 /*endfinally*/];
94
- case 4: return [2 /*return*/];
37
+ addMessageEventListener(BACKGROUND_MESSAGE_RECEIVED, async (message, completionHandlerId) => {
38
+ // keep background task running until handlers have completed their work
39
+ try {
40
+ await Promise.race([
41
+ notifyEventListenersAndAwaitHandlers('backgroundMessageReceived', message),
42
+ // background tasks will get suspended and all future tasks be deprioritized by the OS if they run for
43
+ // more than 30 seconds so we reject with a error in a shorter amount of time to prevent this from
44
+ // happening
45
+ new Promise((_, reject) => {
46
+ setTimeout(() => reject(`onNotificationReceivedInBackground handlers should complete their work within ${BACKGROUND_TASK_TIMEOUT} seconds, but they did not.`), BACKGROUND_TASK_TIMEOUT * 1000);
47
+ }),
48
+ ]);
49
+ }
50
+ catch (err) {
51
+ logger.error(err);
52
+ }
53
+ finally {
54
+ // notify native module that handlers have completed their work (or timed out)
55
+ if (completionHandlerId) {
56
+ completeNotification(completionHandlerId);
95
57
  }
96
- });
97
- }); });
58
+ }
59
+ });
98
60
  }
99
61
  addMessageEventListener(
100
62
  // listen for native foreground message received event and broadcast to library listeners
101
- FOREGROUND_MESSAGE_RECEIVED, function (message) {
63
+ FOREGROUND_MESSAGE_RECEIVED, message => {
102
64
  notifyEventListeners('foregroundMessageReceived', message);
103
65
  });
104
- var launchNotificationOpenedListener = LAUNCH_NOTIFICATION_OPENED
66
+ launchNotificationOpenedListener = LAUNCH_NOTIFICATION_OPENED
105
67
  ? addMessageEventListener(
106
68
  // listen for native notification opened app (user tapped on notification, opening the app from quit -
107
69
  // not background - state) event. This is broadcasted to an internal listener only as it is not intended
108
70
  // for use otherwise as it produces inconsistent results when used within React Native app context
109
- LAUNCH_NOTIFICATION_OPENED, function (message) {
110
- notifyEventListeners('launchNotificationsOpened', message);
71
+ LAUNCH_NOTIFICATION_OPENED, message => {
72
+ notifyEventListeners('launchNotificationOpened', message);
111
73
  // once we are done with it we can remove the listener
112
- launchNotificationOpenedListener === null || launchNotificationOpenedListener === void 0 ? void 0 : launchNotificationOpenedListener.remove();
74
+ launchNotificationOpenedListener?.remove();
113
75
  })
114
76
  : null;
115
77
  addMessageEventListener(
116
78
  // listen for native notification opened (user tapped on notification, opening the app from background -
117
79
  // not quit - state) event and broadcast to library listeners
118
- NOTIFICATION_OPENED, function (message) {
80
+ NOTIFICATION_OPENED, message => {
119
81
  notifyEventListeners('notificationOpened', message);
120
82
  // if we are in this state, we no longer need the listener as the app was launched via some other means
121
- launchNotificationOpenedListener === null || launchNotificationOpenedListener === void 0 ? void 0 : launchNotificationOpenedListener.remove();
83
+ launchNotificationOpenedListener?.remove();
122
84
  });
123
85
  addTokenEventListener(
124
86
  // listen for native new token event, automatically re-register device with provider using new token and
125
87
  // broadcast to library listeners
126
- TOKEN_RECEIVED, function (token) {
88
+ TOKEN_RECEIVED, async (token) => {
127
89
  // avoid a race condition where two endpoints are created with the same token on a fresh install
128
90
  if (getToken() === token) {
129
91
  return;
130
92
  }
131
93
  setToken(token);
132
- registerDevice();
133
94
  notifyEventListeners('tokenReceived', token);
95
+ try {
96
+ await registerDevice(token);
97
+ }
98
+ catch (err) {
99
+ logger.error('Failed to register device for push notifications', err);
100
+ throw err;
101
+ }
134
102
  });
135
103
  };
136
- var registerDevice = function () { return __awaiter(void 0, void 0, void 0, function () {
137
- var _a, credentials, identityId, _b, appId, region;
138
- return __generator(this, function (_c) {
139
- switch (_c.label) {
140
- case 0: return [4 /*yield*/, resolveCredentials()];
141
- case 1:
142
- _a = _c.sent(), credentials = _a.credentials, identityId = _a.identityId;
143
- _b = resolveConfig(), appId = _b.appId, region = _b.region;
144
- return [2 /*return*/, updateEndpoint({
145
- address: getToken(),
146
- appId: appId,
147
- category: 'PushNotification',
148
- credentials: credentials,
149
- region: region,
150
- channelType: getChannelType(),
151
- identityId: identityId,
152
- userAgentValue: getPushNotificationUserAgentString(PushNotificationAction.InitializePushNotifications),
153
- })];
154
- }
104
+ const addAnalyticsListeners = () => {
105
+ let launchNotificationOpenedListenerRemover;
106
+ // wire up default Pinpoint message event handling
107
+ addEventListener('backgroundMessageReceived', createMessageEventRecorder('received_background'));
108
+ addEventListener('foregroundMessageReceived', createMessageEventRecorder('received_foreground'));
109
+ launchNotificationOpenedListenerRemover = addEventListener('launchNotificationOpened', createMessageEventRecorder('opened_notification',
110
+ // once we are done with it we can remove the listener
111
+ launchNotificationOpenedListenerRemover?.remove));
112
+ addEventListener('notificationOpened', createMessageEventRecorder('opened_notification',
113
+ // if we are in this state, we no longer need the listener as the app was launched via some other means
114
+ launchNotificationOpenedListenerRemover?.remove));
115
+ };
116
+ const registerDevice = async (address) => {
117
+ const { credentials, identityId } = await resolveCredentials();
118
+ const { appId, region } = resolveConfig();
119
+ await updateEndpoint({
120
+ address,
121
+ appId,
122
+ category: 'PushNotification',
123
+ credentials,
124
+ region,
125
+ channelType: getChannelType(),
126
+ identityId,
127
+ userAgentValue: getPushNotificationUserAgentString(PushNotificationAction.InitializePushNotifications),
155
128
  });
156
- }); };
129
+ };
@@ -26,6 +26,6 @@ import { PlatformNotSupportedError } from '@aws-amplify/core/internals/utils';
26
26
  * });
27
27
  * ```
28
28
  */
29
- export var onNotificationOpened = function () {
29
+ export const onNotificationOpened = () => {
30
30
  throw new PlatformNotSupportedError();
31
31
  };
@@ -2,7 +2,7 @@
2
2
  // SPDX-License-Identifier: Apache-2.0
3
3
  import { addEventListener } from '../../../../eventListeners';
4
4
  import { assertIsInitialized } from '../../../errors/errorHelpers';
5
- export var onNotificationOpened = function (input) {
5
+ export const onNotificationOpened = input => {
6
6
  assertIsInitialized();
7
7
  return addEventListener('notificationOpened', input);
8
8
  };
@@ -42,6 +42,6 @@ import { PlatformNotSupportedError } from '@aws-amplify/core/internals/utils';
42
42
  * });
43
43
  * ```
44
44
  */
45
- export var onNotificationReceivedInBackground = function () {
45
+ export const onNotificationReceivedInBackground = () => {
46
46
  throw new PlatformNotSupportedError();
47
47
  };
@@ -2,7 +2,7 @@
2
2
  // SPDX-License-Identifier: Apache-2.0
3
3
  import { addEventListener } from '../../../../eventListeners';
4
4
  import { assertIsInitialized } from '../../../errors/errorHelpers';
5
- export var onNotificationReceivedInBackground = function (input) {
5
+ export const onNotificationReceivedInBackground = input => {
6
6
  assertIsInitialized();
7
7
  return addEventListener('backgroundMessageReceived', input);
8
8
  };
@@ -26,6 +26,6 @@ import { PlatformNotSupportedError } from '@aws-amplify/core/internals/utils';
26
26
  * });
27
27
  * ```
28
28
  */
29
- export var onNotificationReceivedInForeground = function () {
29
+ export const onNotificationReceivedInForeground = () => {
30
30
  throw new PlatformNotSupportedError();
31
31
  };
@@ -2,7 +2,7 @@
2
2
  // SPDX-License-Identifier: Apache-2.0
3
3
  import { addEventListener } from '../../../../eventListeners';
4
4
  import { assertIsInitialized } from '../../../errors/errorHelpers';
5
- export var onNotificationReceivedInForeground = function (input) {
5
+ export const onNotificationReceivedInForeground = input => {
6
6
  assertIsInitialized();
7
7
  return addEventListener('foregroundMessageReceived', input);
8
8
  };
@@ -27,6 +27,6 @@ import { PlatformNotSupportedError } from '@aws-amplify/core/internals/utils';
27
27
  * });
28
28
  * ```
29
29
  */
30
- export var onTokenReceived = function () {
30
+ export const onTokenReceived = () => {
31
31
  throw new PlatformNotSupportedError();
32
32
  };
@@ -2,7 +2,7 @@
2
2
  // SPDX-License-Identifier: Apache-2.0
3
3
  import { addEventListener } from '../../../../eventListeners';
4
4
  import { assertIsInitialized } from '../../../errors/errorHelpers';
5
- export var onTokenReceived = function (input) {
5
+ export const onTokenReceived = input => {
6
6
  assertIsInitialized();
7
7
  return addEventListener('tokenReceived', input);
8
8
  };
@@ -31,6 +31,6 @@ import { PlatformNotSupportedError } from '@aws-amplify/core/internals/utils';
31
31
  * });
32
32
  * ```
33
33
  */
34
- export var requestPermissions = function () {
34
+ export const requestPermissions = async () => {
35
35
  throw new PlatformNotSupportedError();
36
36
  };
@@ -2,8 +2,8 @@
2
2
  // SPDX-License-Identifier: Apache-2.0
3
3
  import { loadAmplifyPushNotification } from '@aws-amplify/react-native';
4
4
  import { assertIsInitialized } from '../../../errors/errorHelpers';
5
- var requestPermissionsNative = loadAmplifyPushNotification().requestPermissions;
6
- export var requestPermissions = function (input) {
5
+ const { requestPermissions: requestPermissionsNative } = loadAmplifyPushNotification();
6
+ export const requestPermissions = async (input) => {
7
7
  assertIsInitialized();
8
8
  return requestPermissionsNative(input);
9
9
  };
@@ -13,6 +13,6 @@ import { PlatformNotSupportedError } from '@aws-amplify/core/internals/utils';
13
13
  * setBadgeCount(42);
14
14
  * ```
15
15
  */
16
- export var setBadgeCount = function () {
16
+ export const setBadgeCount = () => {
17
17
  throw new PlatformNotSupportedError();
18
18
  };
@@ -2,8 +2,8 @@
2
2
  // SPDX-License-Identifier: Apache-2.0
3
3
  import { loadAmplifyPushNotification } from '@aws-amplify/react-native';
4
4
  import { assertIsInitialized } from '../../../errors/errorHelpers';
5
- var setBadgeCountNative = loadAmplifyPushNotification().setBadgeCount;
6
- export var setBadgeCount = function (input) {
5
+ const { setBadgeCount: setBadgeCountNative } = loadAmplifyPushNotification();
6
+ export const setBadgeCount = input => {
7
7
  assertIsInitialized();
8
8
  setBadgeCountNative(input);
9
9
  };
@@ -1,3 +1,3 @@
1
1
  export { getBadgeCount, getLaunchNotification, getPermissionStatus, identifyUser, initializePushNotifications, onNotificationOpened, onNotificationReceivedInBackground, onNotificationReceivedInForeground, onTokenReceived, requestPermissions, setBadgeCount, } from './apis';
2
2
  export { IdentifyUserInput, OnNotificationOpenedInput, OnNotificationReceivedInBackgroundInput, OnNotificationReceivedInForegroundInput, OnTokenReceivedInput, RequestPermissionsInput, SetBadgeCountInput, } from './types/inputs';
3
- export { GetLaunchNotificationOutput, GetPermissionStatusOutput, OnNotificationOpenedOutput, OnNotificationReceivedInBackgroundOutput, OnNotificationReceivedInForegroundOutput, OnTokenReceivedOutput, } from './types/outputs';
3
+ export { GetBadgeCountOutput, GetLaunchNotificationOutput, GetPermissionStatusOutput, OnNotificationOpenedOutput, OnNotificationReceivedInBackgroundOutput, OnNotificationReceivedInForegroundOutput, OnTokenReceivedOutput, } from './types/outputs';
@@ -1,6 +1,6 @@
1
- export declare type PinpointMessageEvent = 'opened_notification' | 'received_background' | 'received_foreground';
2
- export declare type PinpointMessageEventSource = '_campaign' | '_journey';
3
- export declare type AnalyticsEventAttributes = {
1
+ export type PinpointMessageEvent = 'opened_notification' | 'received_background' | 'received_foreground';
2
+ export type PinpointMessageEventSource = '_campaign' | '_journey';
3
+ export type AnalyticsEventAttributes = {
4
4
  source: PinpointMessageEventSource;
5
5
  attributes: Record<string, string>;
6
6
  };
@@ -1,2 +1,3 @@
1
1
  // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
2
  // SPDX-License-Identifier: Apache-2.0
3
+ export {};
@@ -1,13 +1,13 @@
1
1
  import { IdentifyUserInput, OnNotificationOpenedInput, OnNotificationReceivedInBackgroundInput, OnNotificationReceivedInForegroundInput, OnTokenReceivedInput, RequestPermissionsInput, SetBadgeCountInput } from './inputs';
2
2
  import { GetBadgeCountOutput, GetLaunchNotificationOutput, GetPermissionStatusOutput, OnNotificationOpenedOutput, OnNotificationReceivedInBackgroundOutput, OnNotificationReceivedInForegroundOutput, OnTokenReceivedOutput, RequestPermissionsOutput } from './outputs';
3
- export declare type GetBadgeCount = () => Promise<void | GetBadgeCountOutput>;
4
- export declare type GetLaunchNotification = () => Promise<GetLaunchNotificationOutput>;
5
- export declare type GetPermissionStatus = () => Promise<GetPermissionStatusOutput>;
6
- export declare type IdentifyUser = (input: IdentifyUserInput) => Promise<void>;
7
- export declare type InitializePushNotifications = () => void;
8
- export declare type RequestPermissions = (input?: RequestPermissionsInput) => Promise<RequestPermissionsOutput>;
9
- export declare type SetBadgeCount = (input: SetBadgeCountInput) => void;
10
- export declare type OnNotificationOpened = (input: OnNotificationOpenedInput) => OnNotificationOpenedOutput;
11
- export declare type OnNotificationReceivedInBackground = (input: OnNotificationReceivedInBackgroundInput) => OnNotificationReceivedInBackgroundOutput;
12
- export declare type OnNotificationReceivedInForeground = (input: OnNotificationReceivedInForegroundInput) => OnNotificationReceivedInForegroundOutput;
13
- export declare type OnTokenReceived = (input: OnTokenReceivedInput) => OnTokenReceivedOutput;
3
+ export type GetBadgeCount = () => Promise<void | GetBadgeCountOutput>;
4
+ export type GetLaunchNotification = () => Promise<GetLaunchNotificationOutput>;
5
+ export type GetPermissionStatus = () => Promise<GetPermissionStatusOutput>;
6
+ export type IdentifyUser = (input: IdentifyUserInput) => Promise<void>;
7
+ export type InitializePushNotifications = () => void;
8
+ export type RequestPermissions = (input?: RequestPermissionsInput) => Promise<RequestPermissionsOutput>;
9
+ export type SetBadgeCount = (input: SetBadgeCountInput) => void;
10
+ export type OnNotificationOpened = (input: OnNotificationOpenedInput) => OnNotificationOpenedOutput;
11
+ export type OnNotificationReceivedInBackground = (input: OnNotificationReceivedInBackgroundInput) => OnNotificationReceivedInBackgroundOutput;
12
+ export type OnNotificationReceivedInForeground = (input: OnNotificationReceivedInForegroundInput) => OnNotificationReceivedInForegroundOutput;
13
+ export type OnTokenReceived = (input: OnTokenReceivedInput) => OnTokenReceivedOutput;
@@ -1,2 +1,3 @@
1
1
  // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
2
  // SPDX-License-Identifier: Apache-2.0
3
+ export {};
@@ -1,2 +1,3 @@
1
1
  // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
2
  // SPDX-License-Identifier: Apache-2.0
3
+ export {};
@@ -1,9 +1,9 @@
1
1
  import { IdentifyUserOptions } from './options';
2
2
  import { PushNotificationIdentifyUserInput, PushNotificationRequestPermissionsInput, PushNotificationSetBadgeCountInput, PushNotificationOnNotificationOpenedInput, PushNotificationOnNotificationReceivedInBackgroundInput, PushNotificationOnNotificationReceivedInForegroundInput, PushNotificationOnTokenReceivedInput } from '../../../types';
3
- export declare type IdentifyUserInput = PushNotificationIdentifyUserInput<IdentifyUserOptions>;
4
- export declare type RequestPermissionsInput = PushNotificationRequestPermissionsInput;
5
- export declare type SetBadgeCountInput = PushNotificationSetBadgeCountInput;
6
- export declare type OnNotificationOpenedInput = PushNotificationOnNotificationOpenedInput;
7
- export declare type OnNotificationReceivedInBackgroundInput = PushNotificationOnNotificationReceivedInBackgroundInput;
8
- export declare type OnNotificationReceivedInForegroundInput = PushNotificationOnNotificationReceivedInForegroundInput;
9
- export declare type OnTokenReceivedInput = PushNotificationOnTokenReceivedInput;
3
+ export type IdentifyUserInput = PushNotificationIdentifyUserInput<IdentifyUserOptions>;
4
+ export type RequestPermissionsInput = PushNotificationRequestPermissionsInput;
5
+ export type SetBadgeCountInput = PushNotificationSetBadgeCountInput;
6
+ export type OnNotificationOpenedInput = PushNotificationOnNotificationOpenedInput;
7
+ export type OnNotificationReceivedInBackgroundInput = PushNotificationOnNotificationReceivedInBackgroundInput;
8
+ export type OnNotificationReceivedInForegroundInput = PushNotificationOnNotificationReceivedInForegroundInput;
9
+ export type OnTokenReceivedInput = PushNotificationOnTokenReceivedInput;
@@ -1,2 +1,3 @@
1
1
  // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
2
  // SPDX-License-Identifier: Apache-2.0
3
+ export {};
@@ -2,4 +2,4 @@ import { PinpointServiceOptions } from '@aws-amplify/core/internals/providers/pi
2
2
  /**
3
3
  * Options specific to Pinpoint identityUser.
4
4
  */
5
- export declare type IdentifyUserOptions = PinpointServiceOptions;
5
+ export type IdentifyUserOptions = PinpointServiceOptions;
@@ -1,2 +1,3 @@
1
1
  // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
2
  // SPDX-License-Identifier: Apache-2.0
3
+ export {};
@@ -1,9 +1,9 @@
1
1
  import { PushNotificationGetBadgeCountOutput, PushNotificationGetLaunchNotificationOutput, PushNotificationGetPermissionStatusOutput, PushNotificationOnNotificationOpenedOutput, PushNotificationOnNotificationReceivedInBackgroundOutput, PushNotificationOnNotificationReceivedInForegroundOutput, PushNotificationOnTokenReceivedOutput, PushNotificationRequestPermissionsOutput } from '../../../types';
2
- export declare type GetBadgeCountOutput = PushNotificationGetBadgeCountOutput;
3
- export declare type GetLaunchNotificationOutput = PushNotificationGetLaunchNotificationOutput;
4
- export declare type GetPermissionStatusOutput = PushNotificationGetPermissionStatusOutput;
5
- export declare type RequestPermissionsOutput = PushNotificationRequestPermissionsOutput;
6
- export declare type OnNotificationOpenedOutput = PushNotificationOnNotificationOpenedOutput;
7
- export declare type OnNotificationReceivedInBackgroundOutput = PushNotificationOnNotificationReceivedInBackgroundOutput;
8
- export declare type OnNotificationReceivedInForegroundOutput = PushNotificationOnNotificationReceivedInForegroundOutput;
9
- export declare type OnTokenReceivedOutput = PushNotificationOnTokenReceivedOutput;
2
+ export type GetBadgeCountOutput = PushNotificationGetBadgeCountOutput;
3
+ export type GetLaunchNotificationOutput = PushNotificationGetLaunchNotificationOutput;
4
+ export type GetPermissionStatusOutput = PushNotificationGetPermissionStatusOutput;
5
+ export type RequestPermissionsOutput = PushNotificationRequestPermissionsOutput;
6
+ export type OnNotificationOpenedOutput = PushNotificationOnNotificationOpenedOutput;
7
+ export type OnNotificationReceivedInBackgroundOutput = PushNotificationOnNotificationReceivedInBackgroundOutput;
8
+ export type OnNotificationReceivedInForegroundOutput = PushNotificationOnNotificationReceivedInForegroundOutput;
9
+ export type OnTokenReceivedOutput = PushNotificationOnTokenReceivedOutput;
@@ -1,2 +1,3 @@
1
1
  // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
2
  // SPDX-License-Identifier: Apache-2.0
3
+ export {};
@@ -1,2 +1,2 @@
1
1
  import { updateEndpoint } from '@aws-amplify/core/internals/providers/pinpoint';
2
- export declare type ChannelType = Parameters<typeof updateEndpoint>[0]['channelType'];
2
+ export type ChannelType = Parameters<typeof updateEndpoint>[0]['channelType'];
@@ -1,2 +1,3 @@
1
1
  // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
2
  // SPDX-License-Identifier: Apache-2.0
3
+ export {};
@@ -1,5 +1,6 @@
1
- import { OnPushNotificationMessageHandler, PushNotificationEvent } from '../../../types';
1
+ import { PinpointMessageEvent } from '../types';
2
+ import { OnPushNotificationMessageHandler } from '../../../types';
2
3
  /**
3
4
  * @internal
4
5
  */
5
- export declare const createMessageEventRecorder: (event: PushNotificationEvent, callback?: Function) => OnPushNotificationMessageHandler;
6
+ export declare const createMessageEventRecorder: (event: PinpointMessageEvent, callback?: Function) => OnPushNotificationMessageHandler;