@aws-amplify/notifications 1.6.6-unstable.7762f1a.0 → 2.0.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 (691) hide show
  1. package/README.md +3 -0
  2. package/in-app-messaging/package.json +7 -0
  3. package/in-app-messaging/pinpoint/package.json +7 -0
  4. package/lib/{common/eventListeners/index.d.ts → eventListeners/eventListeners.d.ts} +2 -2
  5. package/lib/eventListeners/eventListeners.js +38 -0
  6. package/lib/eventListeners/index.d.ts +2 -0
  7. package/lib/eventListeners/index.js +9 -0
  8. package/lib/eventListeners/types.d.ts +10 -0
  9. package/lib/{InAppMessaging/SessionTracker → eventListeners}/types.js +0 -1
  10. package/lib/inAppMessaging/errors/InAppMessagingError.d.ts +7 -0
  11. package/lib/inAppMessaging/errors/InAppMessagingError.js +19 -0
  12. package/lib/inAppMessaging/errors/assertServiceError.d.ts +2 -0
  13. package/lib/inAppMessaging/errors/assertServiceError.js +19 -0
  14. package/lib/inAppMessaging/errors/assertValidationError.d.ts +5 -0
  15. package/lib/inAppMessaging/errors/assertValidationError.js +17 -0
  16. package/lib/inAppMessaging/errors/index.d.ts +4 -0
  17. package/lib/inAppMessaging/errors/index.js +14 -0
  18. package/lib/inAppMessaging/errors/validation.d.ts +8 -0
  19. package/lib/inAppMessaging/errors/validation.js +27 -0
  20. package/lib/inAppMessaging/index.d.ts +2 -0
  21. package/lib/inAppMessaging/index.js +17 -0
  22. package/lib/inAppMessaging/providers/pinpoint/apis/clearMessages.d.ts +13 -0
  23. package/lib/inAppMessaging/providers/pinpoint/apis/clearMessages.js +26 -0
  24. package/lib/inAppMessaging/providers/pinpoint/apis/dispatchEvent.d.ts +26 -0
  25. package/lib/inAppMessaging/providers/pinpoint/apis/dispatchEvent.js +56 -0
  26. package/lib/inAppMessaging/providers/pinpoint/apis/identifyUser.d.ts +51 -0
  27. package/lib/inAppMessaging/providers/pinpoint/apis/identifyUser.js +79 -0
  28. package/lib/inAppMessaging/providers/pinpoint/apis/index.d.ts +11 -0
  29. package/lib/inAppMessaging/providers/pinpoint/apis/index.js +27 -0
  30. package/lib/inAppMessaging/providers/pinpoint/apis/initializeInAppMessaging.d.ts +12 -0
  31. package/lib/inAppMessaging/providers/pinpoint/apis/initializeInAppMessaging.js +57 -0
  32. package/lib/inAppMessaging/providers/pinpoint/apis/notifyMessageInteraction.d.ts +16 -0
  33. package/lib/inAppMessaging/providers/pinpoint/apis/notifyMessageInteraction.js +26 -0
  34. package/lib/inAppMessaging/providers/pinpoint/apis/onMessageActionTaken.d.ts +18 -0
  35. package/lib/inAppMessaging/providers/pinpoint/apis/onMessageActionTaken.js +27 -0
  36. package/lib/inAppMessaging/providers/pinpoint/apis/onMessageDismissed.d.ts +18 -0
  37. package/lib/inAppMessaging/providers/pinpoint/apis/onMessageDismissed.js +27 -0
  38. package/lib/inAppMessaging/providers/pinpoint/apis/onMessageDisplayed.d.ts +18 -0
  39. package/lib/inAppMessaging/providers/pinpoint/apis/onMessageDisplayed.js +27 -0
  40. package/lib/inAppMessaging/providers/pinpoint/apis/onMessageReceived.d.ts +18 -0
  41. package/lib/inAppMessaging/providers/pinpoint/apis/onMessageReceived.js +27 -0
  42. package/lib/inAppMessaging/providers/pinpoint/apis/setConflictHandler.d.ts +32 -0
  43. package/lib/inAppMessaging/providers/pinpoint/apis/setConflictHandler.js +65 -0
  44. package/lib/inAppMessaging/providers/pinpoint/apis/syncMessages.d.ts +16 -0
  45. package/lib/inAppMessaging/providers/pinpoint/apis/syncMessages.js +69 -0
  46. package/lib/inAppMessaging/providers/pinpoint/index.d.ts +2 -0
  47. package/lib/inAppMessaging/providers/pinpoint/index.js +17 -0
  48. package/lib/inAppMessaging/providers/pinpoint/types/index.d.ts +4 -0
  49. package/lib/{InAppMessaging → inAppMessaging/providers/pinpoint/types}/index.js +2 -4
  50. package/lib/inAppMessaging/providers/pinpoint/types/inputs.d.ts +37 -0
  51. package/lib/{PushNotification/Platform/types.js → inAppMessaging/providers/pinpoint/types/inputs.js} +0 -1
  52. package/lib/inAppMessaging/providers/pinpoint/types/options.d.ts +5 -0
  53. package/lib/{common/AWSPinpointProviderCommon/types.js → inAppMessaging/providers/pinpoint/types/options.js} +0 -1
  54. package/lib/inAppMessaging/providers/pinpoint/types/outputs.d.ts +17 -0
  55. package/lib/{common/eventListeners/types.js → inAppMessaging/providers/pinpoint/types/outputs.js} +0 -1
  56. package/lib/inAppMessaging/providers/pinpoint/types/types.d.ts +19 -0
  57. package/lib/inAppMessaging/providers/pinpoint/types/types.js +11 -0
  58. package/lib/inAppMessaging/providers/pinpoint/utils/constants.d.ts +4 -0
  59. package/lib/inAppMessaging/providers/pinpoint/utils/constants.js +9 -0
  60. package/lib/{InAppMessaging/Providers/AWSPinpointProvider/utils.d.ts → inAppMessaging/providers/pinpoint/utils/helpers.d.ts} +6 -7
  61. package/lib/inAppMessaging/providers/pinpoint/utils/helpers.js +264 -0
  62. package/lib/inAppMessaging/providers/pinpoint/utils/index.d.ts +5 -0
  63. package/lib/inAppMessaging/providers/pinpoint/utils/index.js +20 -0
  64. package/lib/inAppMessaging/providers/pinpoint/utils/messageProcessingHelpers.d.ts +6 -0
  65. package/lib/inAppMessaging/providers/pinpoint/utils/messageProcessingHelpers.js +169 -0
  66. package/lib/inAppMessaging/providers/pinpoint/utils/resolveConfig.d.ts +7 -0
  67. package/lib/inAppMessaging/providers/pinpoint/utils/resolveConfig.js +17 -0
  68. package/lib/inAppMessaging/providers/pinpoint/utils/resolveCredentials.d.ts +7 -0
  69. package/lib/inAppMessaging/providers/pinpoint/utils/resolveCredentials.js +16 -0
  70. package/lib/inAppMessaging/providers/pinpoint/utils/userAgent.d.ts +4 -0
  71. package/lib/inAppMessaging/providers/pinpoint/utils/userAgent.js +20 -0
  72. package/lib/inAppMessaging/types/event.d.ts +6 -0
  73. package/lib/inAppMessaging/types/event.js +4 -0
  74. package/lib/inAppMessaging/types/index.d.ts +4 -0
  75. package/lib/inAppMessaging/types/index.js +4 -0
  76. package/lib/inAppMessaging/types/inputs.d.ts +19 -0
  77. package/lib/inAppMessaging/types/inputs.js +4 -0
  78. package/lib/inAppMessaging/types/message.d.ts +44 -0
  79. package/lib/inAppMessaging/types/message.js +4 -0
  80. package/lib/inAppMessaging/types/options.d.ts +4 -0
  81. package/lib/inAppMessaging/types/options.js +4 -0
  82. package/lib/inAppMessaging/utils/index.d.ts +1 -0
  83. package/lib/inAppMessaging/utils/index.js +9 -0
  84. package/lib/inAppMessaging/utils/statusHelpers.d.ts +13 -0
  85. package/lib/inAppMessaging/utils/statusHelpers.js +27 -0
  86. package/lib/index.d.ts +0 -6
  87. package/lib/index.js +0 -10
  88. package/lib/pushNotifications/errors/PushNotificationError.d.ts +4 -0
  89. package/lib/pushNotifications/errors/PushNotificationError.js +16 -0
  90. package/lib/pushNotifications/errors/errorHelpers.d.ts +9 -0
  91. package/lib/pushNotifications/errors/errorHelpers.js +35 -0
  92. package/lib/pushNotifications/errors/index.d.ts +2 -0
  93. package/lib/pushNotifications/errors/index.js +10 -0
  94. package/lib/pushNotifications/index.d.ts +3 -0
  95. package/lib/pushNotifications/index.js +19 -0
  96. package/lib/pushNotifications/providers/pinpoint/apis/getBadgeCount.d.ts +14 -0
  97. package/lib/pushNotifications/providers/pinpoint/apis/getBadgeCount.js +22 -0
  98. package/lib/pushNotifications/providers/pinpoint/apis/getBadgeCount.native.d.ts +2 -0
  99. package/lib/pushNotifications/providers/pinpoint/apis/getBadgeCount.native.js +13 -0
  100. package/lib/pushNotifications/providers/pinpoint/apis/getLaunchNotification.d.ts +18 -0
  101. package/lib/pushNotifications/providers/pinpoint/apis/getLaunchNotification.js +26 -0
  102. package/lib/pushNotifications/providers/pinpoint/apis/getLaunchNotification.native.d.ts +2 -0
  103. package/lib/pushNotifications/providers/pinpoint/apis/getLaunchNotification.native.js +13 -0
  104. package/lib/pushNotifications/providers/pinpoint/apis/getPermissionStatus.d.ts +27 -0
  105. package/lib/pushNotifications/providers/pinpoint/apis/getPermissionStatus.js +35 -0
  106. package/lib/pushNotifications/providers/pinpoint/apis/getPermissionStatus.native.d.ts +2 -0
  107. package/lib/pushNotifications/providers/pinpoint/apis/getPermissionStatus.native.js +13 -0
  108. package/lib/pushNotifications/providers/pinpoint/apis/identifyUser.d.ts +53 -0
  109. package/lib/pushNotifications/providers/pinpoint/apis/identifyUser.js +61 -0
  110. package/lib/pushNotifications/providers/pinpoint/apis/identifyUser.native.d.ts +2 -0
  111. package/lib/pushNotifications/providers/pinpoint/apis/identifyUser.native.js +31 -0
  112. package/lib/pushNotifications/providers/pinpoint/apis/index.d.ts +11 -0
  113. package/lib/pushNotifications/providers/pinpoint/apis/index.js +27 -0
  114. package/lib/pushNotifications/providers/pinpoint/apis/initializePushNotifications.d.ts +17 -0
  115. package/lib/pushNotifications/providers/pinpoint/apis/initializePushNotifications.js +25 -0
  116. package/lib/pushNotifications/providers/pinpoint/apis/initializePushNotifications.native.d.ts +1 -0
  117. package/lib/pushNotifications/providers/pinpoint/apis/initializePushNotifications.native.js +133 -0
  118. package/lib/pushNotifications/providers/pinpoint/apis/onNotificationOpened.d.ts +27 -0
  119. package/lib/pushNotifications/providers/pinpoint/apis/onNotificationOpened.js +35 -0
  120. package/lib/pushNotifications/providers/pinpoint/apis/onNotificationOpened.native.d.ts +2 -0
  121. package/lib/pushNotifications/providers/pinpoint/apis/onNotificationOpened.native.js +12 -0
  122. package/lib/pushNotifications/providers/pinpoint/apis/onNotificationReceivedInBackground.d.ts +43 -0
  123. package/lib/pushNotifications/providers/pinpoint/apis/onNotificationReceivedInBackground.js +51 -0
  124. package/lib/pushNotifications/providers/pinpoint/apis/onNotificationReceivedInBackground.native.d.ts +2 -0
  125. package/lib/pushNotifications/providers/pinpoint/apis/onNotificationReceivedInBackground.native.js +12 -0
  126. package/lib/pushNotifications/providers/pinpoint/apis/onNotificationReceivedInForeground.d.ts +27 -0
  127. package/lib/pushNotifications/providers/pinpoint/apis/onNotificationReceivedInForeground.js +35 -0
  128. package/lib/pushNotifications/providers/pinpoint/apis/onNotificationReceivedInForeground.native.d.ts +2 -0
  129. package/lib/pushNotifications/providers/pinpoint/apis/onNotificationReceivedInForeground.native.js +12 -0
  130. package/lib/pushNotifications/providers/pinpoint/apis/onTokenReceived.d.ts +28 -0
  131. package/lib/pushNotifications/providers/pinpoint/apis/onTokenReceived.js +36 -0
  132. package/lib/pushNotifications/providers/pinpoint/apis/onTokenReceived.native.d.ts +2 -0
  133. package/lib/pushNotifications/providers/pinpoint/apis/onTokenReceived.native.js +12 -0
  134. package/lib/pushNotifications/providers/pinpoint/apis/requestPermissions.d.ts +32 -0
  135. package/lib/pushNotifications/providers/pinpoint/apis/requestPermissions.js +40 -0
  136. package/lib/pushNotifications/providers/pinpoint/apis/requestPermissions.native.d.ts +2 -0
  137. package/lib/pushNotifications/providers/pinpoint/apis/requestPermissions.native.js +13 -0
  138. package/lib/pushNotifications/providers/pinpoint/apis/setBadgeCount.d.ts +14 -0
  139. package/lib/pushNotifications/providers/pinpoint/apis/setBadgeCount.js +22 -0
  140. package/lib/pushNotifications/providers/pinpoint/apis/setBadgeCount.native.d.ts +2 -0
  141. package/lib/pushNotifications/providers/pinpoint/apis/setBadgeCount.native.js +13 -0
  142. package/lib/pushNotifications/providers/pinpoint/index.d.ts +3 -0
  143. package/lib/pushNotifications/providers/pinpoint/index.js +17 -0
  144. package/lib/pushNotifications/providers/pinpoint/types/analytics.d.ts +6 -0
  145. package/lib/pushNotifications/providers/pinpoint/types/analytics.js +4 -0
  146. package/lib/pushNotifications/providers/pinpoint/types/apis.d.ts +13 -0
  147. package/lib/pushNotifications/providers/pinpoint/types/apis.js +4 -0
  148. package/lib/pushNotifications/providers/pinpoint/types/index.d.ts +6 -0
  149. package/lib/pushNotifications/providers/pinpoint/types/index.js +4 -0
  150. package/lib/pushNotifications/providers/pinpoint/types/inputs.d.ts +9 -0
  151. package/lib/pushNotifications/providers/pinpoint/types/inputs.js +4 -0
  152. package/lib/pushNotifications/providers/pinpoint/types/options.d.ts +5 -0
  153. package/lib/pushNotifications/providers/pinpoint/types/options.js +4 -0
  154. package/lib/pushNotifications/providers/pinpoint/types/outputs.d.ts +9 -0
  155. package/lib/pushNotifications/providers/pinpoint/types/outputs.js +4 -0
  156. package/lib/pushNotifications/providers/pinpoint/types/pushNotifications.d.ts +2 -0
  157. package/lib/pushNotifications/providers/pinpoint/types/pushNotifications.js +4 -0
  158. package/lib/pushNotifications/providers/pinpoint/utils/createMessageEventRecorder.d.ts +6 -0
  159. package/lib/pushNotifications/providers/pinpoint/utils/createMessageEventRecorder.js +43 -0
  160. package/lib/pushNotifications/providers/pinpoint/utils/getAnalyticsEvent.d.ts +7 -0
  161. package/lib/pushNotifications/providers/pinpoint/utils/getAnalyticsEvent.js +56 -0
  162. package/lib/pushNotifications/providers/pinpoint/utils/getChannelType.d.ts +5 -0
  163. package/lib/pushNotifications/providers/pinpoint/utils/getChannelType.js +25 -0
  164. package/lib/pushNotifications/providers/pinpoint/utils/index.d.ts +4 -0
  165. package/lib/pushNotifications/providers/pinpoint/utils/index.js +13 -0
  166. package/lib/pushNotifications/providers/pinpoint/utils/resolveConfig.d.ts +7 -0
  167. package/lib/pushNotifications/providers/pinpoint/utils/resolveConfig.js +17 -0
  168. package/lib/pushNotifications/types/errors.d.ts +3 -0
  169. package/lib/pushNotifications/types/errors.js +9 -0
  170. package/lib/pushNotifications/types/index.d.ts +6 -0
  171. package/lib/pushNotifications/types/index.js +24 -0
  172. package/lib/pushNotifications/types/inputs.d.ts +24 -0
  173. package/lib/pushNotifications/types/inputs.js +4 -0
  174. package/lib/pushNotifications/types/module.d.ts +31 -0
  175. package/lib/pushNotifications/types/module.js +4 -0
  176. package/lib/pushNotifications/types/options.d.ts +4 -0
  177. package/lib/pushNotifications/types/options.js +4 -0
  178. package/lib/pushNotifications/types/outputs.d.ts +10 -0
  179. package/lib/pushNotifications/types/outputs.js +4 -0
  180. package/lib/pushNotifications/types/pushNotifications.d.ts +4 -0
  181. package/lib/pushNotifications/types/pushNotifications.js +4 -0
  182. package/lib/pushNotifications/utils/getPushNotificationUserAgentString.d.ts +2 -0
  183. package/lib/pushNotifications/utils/getPushNotificationUserAgentString.js +11 -0
  184. package/lib/pushNotifications/utils/index.d.ts +4 -0
  185. package/lib/pushNotifications/utils/index.js +15 -0
  186. package/lib/pushNotifications/utils/initializationManager.d.ts +12 -0
  187. package/lib/pushNotifications/utils/initializationManager.js +22 -0
  188. package/lib/pushNotifications/utils/resolveCredentials.d.ts +7 -0
  189. package/lib/pushNotifications/utils/resolveCredentials.js +16 -0
  190. package/lib/pushNotifications/utils/tokenManager.d.ts +12 -0
  191. package/lib/pushNotifications/utils/tokenManager.js +22 -0
  192. package/lib/tsconfig.tsbuildinfo +1 -0
  193. package/lib-esm/{common/eventListeners/index.d.ts → eventListeners/eventListeners.d.ts} +2 -2
  194. package/lib-esm/eventListeners/eventListeners.js +32 -0
  195. package/lib-esm/eventListeners/index.d.ts +2 -0
  196. package/lib-esm/{common → eventListeners}/index.js +0 -3
  197. package/lib-esm/eventListeners/types.d.ts +10 -0
  198. package/lib-esm/{PushNotification/Platform → eventListeners}/types.js +1 -1
  199. package/lib-esm/inAppMessaging/errors/InAppMessagingError.d.ts +7 -0
  200. package/lib-esm/inAppMessaging/errors/InAppMessagingError.js +15 -0
  201. package/lib-esm/inAppMessaging/errors/assertServiceError.d.ts +2 -0
  202. package/lib-esm/inAppMessaging/errors/assertServiceError.js +15 -0
  203. package/lib-esm/inAppMessaging/errors/assertValidationError.d.ts +5 -0
  204. package/lib-esm/inAppMessaging/errors/assertValidationError.js +13 -0
  205. package/lib-esm/inAppMessaging/errors/index.d.ts +4 -0
  206. package/lib-esm/inAppMessaging/errors/index.js +6 -0
  207. package/lib-esm/inAppMessaging/errors/validation.d.ts +8 -0
  208. package/lib-esm/inAppMessaging/errors/validation.js +24 -0
  209. package/lib-esm/inAppMessaging/index.d.ts +2 -0
  210. package/lib-esm/inAppMessaging/index.js +3 -0
  211. package/lib-esm/inAppMessaging/providers/pinpoint/apis/clearMessages.d.ts +13 -0
  212. package/lib-esm/inAppMessaging/providers/pinpoint/apis/clearMessages.js +22 -0
  213. package/lib-esm/inAppMessaging/providers/pinpoint/apis/dispatchEvent.d.ts +26 -0
  214. package/lib-esm/inAppMessaging/providers/pinpoint/apis/dispatchEvent.js +49 -0
  215. package/lib-esm/inAppMessaging/providers/pinpoint/apis/identifyUser.d.ts +51 -0
  216. package/lib-esm/inAppMessaging/providers/pinpoint/apis/identifyUser.js +75 -0
  217. package/lib-esm/inAppMessaging/providers/pinpoint/apis/index.d.ts +11 -0
  218. package/lib-esm/inAppMessaging/providers/pinpoint/apis/index.js +13 -0
  219. package/lib-esm/inAppMessaging/providers/pinpoint/apis/initializeInAppMessaging.d.ts +12 -0
  220. package/lib-esm/inAppMessaging/providers/pinpoint/apis/initializeInAppMessaging.js +53 -0
  221. package/lib-esm/inAppMessaging/providers/pinpoint/apis/notifyMessageInteraction.d.ts +16 -0
  222. package/lib-esm/inAppMessaging/providers/pinpoint/apis/notifyMessageInteraction.js +22 -0
  223. package/lib-esm/inAppMessaging/providers/pinpoint/apis/onMessageActionTaken.d.ts +18 -0
  224. package/lib-esm/inAppMessaging/providers/pinpoint/apis/onMessageActionTaken.js +23 -0
  225. package/lib-esm/inAppMessaging/providers/pinpoint/apis/onMessageDismissed.d.ts +18 -0
  226. package/lib-esm/inAppMessaging/providers/pinpoint/apis/onMessageDismissed.js +23 -0
  227. package/lib-esm/inAppMessaging/providers/pinpoint/apis/onMessageDisplayed.d.ts +18 -0
  228. package/lib-esm/inAppMessaging/providers/pinpoint/apis/onMessageDisplayed.js +23 -0
  229. package/lib-esm/inAppMessaging/providers/pinpoint/apis/onMessageReceived.d.ts +18 -0
  230. package/lib-esm/inAppMessaging/providers/pinpoint/apis/onMessageReceived.js +23 -0
  231. package/lib-esm/inAppMessaging/providers/pinpoint/apis/setConflictHandler.d.ts +32 -0
  232. package/lib-esm/inAppMessaging/providers/pinpoint/apis/setConflictHandler.js +61 -0
  233. package/lib-esm/inAppMessaging/providers/pinpoint/apis/syncMessages.d.ts +16 -0
  234. package/lib-esm/inAppMessaging/providers/pinpoint/apis/syncMessages.js +65 -0
  235. package/lib-esm/inAppMessaging/providers/pinpoint/index.d.ts +2 -0
  236. package/lib-esm/inAppMessaging/providers/pinpoint/index.js +3 -0
  237. package/lib-esm/inAppMessaging/providers/pinpoint/types/index.d.ts +4 -0
  238. package/lib-esm/inAppMessaging/providers/pinpoint/types/index.js +3 -0
  239. package/lib-esm/inAppMessaging/providers/pinpoint/types/inputs.d.ts +37 -0
  240. package/lib-esm/{common/AWSPinpointProviderCommon/types.js → inAppMessaging/providers/pinpoint/types/inputs.js} +1 -1
  241. package/lib-esm/inAppMessaging/providers/pinpoint/types/options.d.ts +5 -0
  242. package/lib-esm/{common/eventListeners/types.js → inAppMessaging/providers/pinpoint/types/options.js} +1 -1
  243. package/lib-esm/inAppMessaging/providers/pinpoint/types/outputs.d.ts +17 -0
  244. package/lib-esm/{InAppMessaging/SessionTracker/types.js → inAppMessaging/providers/pinpoint/types/outputs.js} +1 -1
  245. package/lib-esm/inAppMessaging/providers/pinpoint/types/types.d.ts +19 -0
  246. package/lib-esm/inAppMessaging/providers/pinpoint/types/types.js +8 -0
  247. package/lib-esm/inAppMessaging/providers/pinpoint/utils/constants.d.ts +4 -0
  248. package/lib-esm/inAppMessaging/providers/pinpoint/utils/constants.js +6 -0
  249. package/lib-esm/{InAppMessaging/Providers/AWSPinpointProvider/utils.d.ts → inAppMessaging/providers/pinpoint/utils/helpers.d.ts} +6 -7
  250. package/lib-esm/inAppMessaging/providers/pinpoint/utils/helpers.js +246 -0
  251. package/lib-esm/inAppMessaging/providers/pinpoint/utils/index.d.ts +5 -0
  252. package/lib-esm/inAppMessaging/providers/pinpoint/utils/index.js +7 -0
  253. package/lib-esm/inAppMessaging/providers/pinpoint/utils/messageProcessingHelpers.d.ts +6 -0
  254. package/lib-esm/inAppMessaging/providers/pinpoint/utils/messageProcessingHelpers.js +163 -0
  255. package/lib-esm/inAppMessaging/providers/pinpoint/utils/resolveConfig.d.ts +7 -0
  256. package/lib-esm/inAppMessaging/providers/pinpoint/utils/resolveConfig.js +13 -0
  257. package/lib-esm/inAppMessaging/providers/pinpoint/utils/resolveCredentials.d.ts +7 -0
  258. package/lib-esm/inAppMessaging/providers/pinpoint/utils/resolveCredentials.js +12 -0
  259. package/lib-esm/inAppMessaging/providers/pinpoint/utils/userAgent.d.ts +4 -0
  260. package/lib-esm/inAppMessaging/providers/pinpoint/utils/userAgent.js +15 -0
  261. package/lib-esm/inAppMessaging/types/event.d.ts +6 -0
  262. package/lib-esm/inAppMessaging/types/event.js +3 -0
  263. package/lib-esm/inAppMessaging/types/index.d.ts +4 -0
  264. package/lib-esm/inAppMessaging/types/index.js +3 -0
  265. package/lib-esm/inAppMessaging/types/inputs.d.ts +19 -0
  266. package/lib-esm/inAppMessaging/types/inputs.js +3 -0
  267. package/lib-esm/inAppMessaging/types/message.d.ts +44 -0
  268. package/lib-esm/inAppMessaging/types/message.js +3 -0
  269. package/lib-esm/inAppMessaging/types/options.d.ts +4 -0
  270. package/lib-esm/inAppMessaging/types/options.js +3 -0
  271. package/lib-esm/inAppMessaging/utils/index.d.ts +1 -0
  272. package/lib-esm/inAppMessaging/utils/index.js +3 -0
  273. package/lib-esm/inAppMessaging/utils/statusHelpers.d.ts +13 -0
  274. package/lib-esm/inAppMessaging/utils/statusHelpers.js +21 -0
  275. package/lib-esm/index.d.ts +0 -6
  276. package/lib-esm/index.js +1 -5
  277. package/lib-esm/pushNotifications/errors/PushNotificationError.d.ts +4 -0
  278. package/lib-esm/pushNotifications/errors/PushNotificationError.js +12 -0
  279. package/lib-esm/pushNotifications/errors/errorHelpers.d.ts +9 -0
  280. package/lib-esm/pushNotifications/errors/errorHelpers.js +31 -0
  281. package/lib-esm/pushNotifications/errors/index.d.ts +2 -0
  282. package/lib-esm/pushNotifications/errors/index.js +4 -0
  283. package/lib-esm/pushNotifications/index.d.ts +3 -0
  284. package/lib-esm/pushNotifications/index.js +4 -0
  285. package/lib-esm/pushNotifications/providers/pinpoint/apis/getBadgeCount.d.ts +14 -0
  286. package/lib-esm/pushNotifications/providers/pinpoint/apis/getBadgeCount.js +18 -0
  287. package/lib-esm/pushNotifications/providers/pinpoint/apis/getBadgeCount.native.d.ts +2 -0
  288. package/lib-esm/pushNotifications/providers/pinpoint/apis/getBadgeCount.native.js +9 -0
  289. package/lib-esm/pushNotifications/providers/pinpoint/apis/getLaunchNotification.d.ts +18 -0
  290. package/lib-esm/pushNotifications/providers/pinpoint/apis/getLaunchNotification.js +22 -0
  291. package/lib-esm/pushNotifications/providers/pinpoint/apis/getLaunchNotification.native.d.ts +2 -0
  292. package/lib-esm/pushNotifications/providers/pinpoint/apis/getLaunchNotification.native.js +9 -0
  293. package/lib-esm/pushNotifications/providers/pinpoint/apis/getPermissionStatus.d.ts +27 -0
  294. package/lib-esm/pushNotifications/providers/pinpoint/apis/getPermissionStatus.js +31 -0
  295. package/lib-esm/pushNotifications/providers/pinpoint/apis/getPermissionStatus.native.d.ts +2 -0
  296. package/lib-esm/pushNotifications/providers/pinpoint/apis/getPermissionStatus.native.js +9 -0
  297. package/lib-esm/pushNotifications/providers/pinpoint/apis/identifyUser.d.ts +53 -0
  298. package/lib-esm/pushNotifications/providers/pinpoint/apis/identifyUser.js +57 -0
  299. package/lib-esm/pushNotifications/providers/pinpoint/apis/identifyUser.native.d.ts +2 -0
  300. package/lib-esm/pushNotifications/providers/pinpoint/apis/identifyUser.native.js +27 -0
  301. package/lib-esm/pushNotifications/providers/pinpoint/apis/index.d.ts +11 -0
  302. package/lib-esm/pushNotifications/providers/pinpoint/apis/index.js +13 -0
  303. package/lib-esm/pushNotifications/providers/pinpoint/apis/initializePushNotifications.d.ts +17 -0
  304. package/lib-esm/pushNotifications/providers/pinpoint/apis/initializePushNotifications.js +21 -0
  305. package/lib-esm/pushNotifications/providers/pinpoint/apis/initializePushNotifications.native.d.ts +1 -0
  306. package/lib-esm/pushNotifications/providers/pinpoint/apis/initializePushNotifications.native.js +129 -0
  307. package/lib-esm/pushNotifications/providers/pinpoint/apis/onNotificationOpened.d.ts +27 -0
  308. package/lib-esm/pushNotifications/providers/pinpoint/apis/onNotificationOpened.js +31 -0
  309. package/lib-esm/pushNotifications/providers/pinpoint/apis/onNotificationOpened.native.d.ts +2 -0
  310. package/lib-esm/pushNotifications/providers/pinpoint/apis/onNotificationOpened.native.js +8 -0
  311. package/lib-esm/pushNotifications/providers/pinpoint/apis/onNotificationReceivedInBackground.d.ts +43 -0
  312. package/lib-esm/pushNotifications/providers/pinpoint/apis/onNotificationReceivedInBackground.js +47 -0
  313. package/lib-esm/pushNotifications/providers/pinpoint/apis/onNotificationReceivedInBackground.native.d.ts +2 -0
  314. package/lib-esm/pushNotifications/providers/pinpoint/apis/onNotificationReceivedInBackground.native.js +8 -0
  315. package/lib-esm/pushNotifications/providers/pinpoint/apis/onNotificationReceivedInForeground.d.ts +27 -0
  316. package/lib-esm/pushNotifications/providers/pinpoint/apis/onNotificationReceivedInForeground.js +31 -0
  317. package/lib-esm/pushNotifications/providers/pinpoint/apis/onNotificationReceivedInForeground.native.d.ts +2 -0
  318. package/lib-esm/pushNotifications/providers/pinpoint/apis/onNotificationReceivedInForeground.native.js +8 -0
  319. package/lib-esm/pushNotifications/providers/pinpoint/apis/onTokenReceived.d.ts +28 -0
  320. package/lib-esm/pushNotifications/providers/pinpoint/apis/onTokenReceived.js +32 -0
  321. package/lib-esm/pushNotifications/providers/pinpoint/apis/onTokenReceived.native.d.ts +2 -0
  322. package/lib-esm/pushNotifications/providers/pinpoint/apis/onTokenReceived.native.js +8 -0
  323. package/lib-esm/pushNotifications/providers/pinpoint/apis/requestPermissions.d.ts +32 -0
  324. package/lib-esm/pushNotifications/providers/pinpoint/apis/requestPermissions.js +36 -0
  325. package/lib-esm/pushNotifications/providers/pinpoint/apis/requestPermissions.native.d.ts +2 -0
  326. package/lib-esm/pushNotifications/providers/pinpoint/apis/requestPermissions.native.js +9 -0
  327. package/lib-esm/pushNotifications/providers/pinpoint/apis/setBadgeCount.d.ts +14 -0
  328. package/lib-esm/pushNotifications/providers/pinpoint/apis/setBadgeCount.js +18 -0
  329. package/lib-esm/pushNotifications/providers/pinpoint/apis/setBadgeCount.native.d.ts +2 -0
  330. package/lib-esm/pushNotifications/providers/pinpoint/apis/setBadgeCount.native.js +9 -0
  331. package/lib-esm/pushNotifications/providers/pinpoint/index.d.ts +3 -0
  332. package/lib-esm/pushNotifications/providers/pinpoint/index.js +3 -0
  333. package/lib-esm/pushNotifications/providers/pinpoint/types/analytics.d.ts +6 -0
  334. package/lib-esm/pushNotifications/providers/pinpoint/types/analytics.js +3 -0
  335. package/lib-esm/pushNotifications/providers/pinpoint/types/apis.d.ts +13 -0
  336. package/lib-esm/pushNotifications/providers/pinpoint/types/apis.js +3 -0
  337. package/lib-esm/pushNotifications/providers/pinpoint/types/index.d.ts +6 -0
  338. package/lib-esm/pushNotifications/providers/pinpoint/types/index.js +3 -0
  339. package/lib-esm/pushNotifications/providers/pinpoint/types/inputs.d.ts +9 -0
  340. package/lib-esm/pushNotifications/providers/pinpoint/types/inputs.js +3 -0
  341. package/lib-esm/pushNotifications/providers/pinpoint/types/options.d.ts +5 -0
  342. package/lib-esm/pushNotifications/providers/pinpoint/types/options.js +3 -0
  343. package/lib-esm/pushNotifications/providers/pinpoint/types/outputs.d.ts +9 -0
  344. package/lib-esm/pushNotifications/providers/pinpoint/types/outputs.js +3 -0
  345. package/lib-esm/pushNotifications/providers/pinpoint/types/pushNotifications.d.ts +2 -0
  346. package/lib-esm/pushNotifications/providers/pinpoint/types/pushNotifications.js +3 -0
  347. package/lib-esm/pushNotifications/providers/pinpoint/utils/createMessageEventRecorder.d.ts +6 -0
  348. package/lib-esm/pushNotifications/providers/pinpoint/utils/createMessageEventRecorder.js +39 -0
  349. package/lib-esm/pushNotifications/providers/pinpoint/utils/getAnalyticsEvent.d.ts +7 -0
  350. package/lib-esm/pushNotifications/providers/pinpoint/utils/getAnalyticsEvent.js +52 -0
  351. package/lib-esm/pushNotifications/providers/pinpoint/utils/getChannelType.d.ts +5 -0
  352. package/lib-esm/pushNotifications/providers/pinpoint/utils/getChannelType.js +21 -0
  353. package/lib-esm/pushNotifications/providers/pinpoint/utils/index.d.ts +4 -0
  354. package/lib-esm/pushNotifications/providers/pinpoint/utils/index.js +6 -0
  355. package/lib-esm/pushNotifications/providers/pinpoint/utils/resolveConfig.d.ts +7 -0
  356. package/lib-esm/pushNotifications/providers/pinpoint/utils/resolveConfig.js +13 -0
  357. package/lib-esm/pushNotifications/types/errors.d.ts +3 -0
  358. package/lib-esm/pushNotifications/types/errors.js +6 -0
  359. package/lib-esm/pushNotifications/types/index.d.ts +6 -0
  360. package/lib-esm/pushNotifications/types/index.js +8 -0
  361. package/lib-esm/pushNotifications/types/inputs.d.ts +24 -0
  362. package/lib-esm/pushNotifications/types/inputs.js +3 -0
  363. package/lib-esm/pushNotifications/types/module.d.ts +31 -0
  364. package/lib-esm/pushNotifications/types/module.js +3 -0
  365. package/lib-esm/pushNotifications/types/options.d.ts +4 -0
  366. package/lib-esm/pushNotifications/types/options.js +3 -0
  367. package/lib-esm/pushNotifications/types/outputs.d.ts +10 -0
  368. package/lib-esm/pushNotifications/types/outputs.js +3 -0
  369. package/lib-esm/pushNotifications/types/pushNotifications.d.ts +4 -0
  370. package/lib-esm/pushNotifications/types/pushNotifications.js +3 -0
  371. package/lib-esm/pushNotifications/utils/getPushNotificationUserAgentString.d.ts +2 -0
  372. package/lib-esm/pushNotifications/utils/getPushNotificationUserAgentString.js +7 -0
  373. package/lib-esm/pushNotifications/utils/index.d.ts +4 -0
  374. package/lib-esm/pushNotifications/utils/index.js +6 -0
  375. package/lib-esm/pushNotifications/utils/initializationManager.d.ts +12 -0
  376. package/lib-esm/pushNotifications/utils/initializationManager.js +17 -0
  377. package/lib-esm/pushNotifications/utils/resolveCredentials.d.ts +7 -0
  378. package/lib-esm/pushNotifications/utils/resolveCredentials.js +12 -0
  379. package/lib-esm/pushNotifications/utils/tokenManager.d.ts +12 -0
  380. package/lib-esm/pushNotifications/utils/tokenManager.js +17 -0
  381. package/lib-esm/tsconfig.tsbuildinfo +1 -0
  382. package/package.json +104 -38
  383. package/push-notifications/package.json +7 -0
  384. package/push-notifications/pinpoint/package.json +7 -0
  385. package/src/{common/eventListeners/index.ts → eventListeners/eventListeners.ts} +5 -3
  386. package/src/{common → eventListeners}/index.ts +1 -3
  387. package/src/{common/eventListeners → eventListeners}/types.ts +6 -2
  388. package/src/inAppMessaging/errors/InAppMessagingError.ts +21 -0
  389. package/src/inAppMessaging/errors/assertServiceError.ts +24 -0
  390. package/src/inAppMessaging/errors/assertValidationError.ts +22 -0
  391. package/src/inAppMessaging/errors/index.ts +10 -0
  392. package/src/inAppMessaging/errors/validation.ts +29 -0
  393. package/src/inAppMessaging/index.ts +39 -0
  394. package/src/inAppMessaging/providers/pinpoint/apis/clearMessages.ts +26 -0
  395. package/src/inAppMessaging/providers/pinpoint/apis/dispatchEvent.ts +63 -0
  396. package/src/inAppMessaging/providers/pinpoint/apis/identifyUser.ts +94 -0
  397. package/src/inAppMessaging/providers/pinpoint/apis/index.ts +14 -0
  398. package/src/inAppMessaging/providers/pinpoint/apis/initializeInAppMessaging.ts +62 -0
  399. package/src/inAppMessaging/providers/pinpoint/apis/notifyMessageInteraction.ts +28 -0
  400. package/src/inAppMessaging/providers/pinpoint/apis/onMessageActionTaken.ts +29 -0
  401. package/src/inAppMessaging/providers/pinpoint/apis/onMessageDismissed.ts +29 -0
  402. package/src/inAppMessaging/providers/pinpoint/apis/onMessageDisplayed.ts +29 -0
  403. package/src/inAppMessaging/providers/pinpoint/apis/onMessageReceived.ts +29 -0
  404. package/src/inAppMessaging/providers/pinpoint/apis/setConflictHandler.ts +68 -0
  405. package/src/inAppMessaging/providers/pinpoint/apis/syncMessages.ts +88 -0
  406. package/src/inAppMessaging/providers/pinpoint/index.ts +31 -0
  407. package/src/inAppMessaging/providers/pinpoint/types/index.ts +29 -0
  408. package/src/inAppMessaging/providers/pinpoint/types/inputs.ts +58 -0
  409. package/src/inAppMessaging/providers/pinpoint/types/options.ts +9 -0
  410. package/src/inAppMessaging/providers/pinpoint/types/outputs.ts +24 -0
  411. package/src/{InAppMessaging/Providers/AWSPinpointProvider → inAppMessaging/providers/pinpoint/types}/types.ts +9 -1
  412. package/src/inAppMessaging/providers/pinpoint/utils/constants.ts +6 -0
  413. package/src/{InAppMessaging/Providers/AWSPinpointProvider/utils.ts → inAppMessaging/providers/pinpoint/utils/helpers.ts} +74 -58
  414. package/src/inAppMessaging/providers/pinpoint/utils/index.ts +18 -0
  415. package/src/inAppMessaging/providers/pinpoint/utils/messageProcessingHelpers.ts +210 -0
  416. package/src/inAppMessaging/providers/pinpoint/utils/resolveConfig.ts +19 -0
  417. package/src/inAppMessaging/providers/pinpoint/utils/resolveCredentials.ts +20 -0
  418. package/src/inAppMessaging/providers/pinpoint/utils/userAgent.ts +25 -0
  419. package/src/inAppMessaging/types/event.ts +14 -0
  420. package/src/{InAppMessaging → inAppMessaging/types}/index.ts +7 -8
  421. package/src/inAppMessaging/types/inputs.ts +27 -0
  422. package/src/inAppMessaging/types/message.ts +62 -0
  423. package/src/inAppMessaging/types/options.ts +7 -0
  424. package/src/{PushNotification/Providers → inAppMessaging/utils}/index.ts +5 -1
  425. package/src/inAppMessaging/utils/statusHelpers.ts +32 -0
  426. package/src/index.ts +0 -24
  427. package/src/pushNotifications/errors/PushNotificationError.ts +18 -0
  428. package/src/pushNotifications/errors/errorHelpers.ts +45 -0
  429. package/src/pushNotifications/errors/index.ts +5 -0
  430. package/src/pushNotifications/index.ts +32 -0
  431. package/src/pushNotifications/providers/pinpoint/apis/getBadgeCount.native.ts +13 -0
  432. package/src/pushNotifications/providers/pinpoint/apis/getBadgeCount.ts +21 -0
  433. package/src/pushNotifications/providers/pinpoint/apis/getLaunchNotification.native.ts +14 -0
  434. package/src/pushNotifications/providers/pinpoint/apis/getLaunchNotification.ts +26 -0
  435. package/src/pushNotifications/providers/pinpoint/apis/getPermissionStatus.native.ts +14 -0
  436. package/src/pushNotifications/providers/pinpoint/apis/getPermissionStatus.ts +34 -0
  437. package/src/pushNotifications/providers/pinpoint/apis/identifyUser.native.ts +39 -0
  438. package/src/pushNotifications/providers/pinpoint/apis/identifyUser.ts +62 -0
  439. package/src/pushNotifications/providers/pinpoint/apis/index.ts +14 -0
  440. package/src/pushNotifications/providers/pinpoint/apis/initializePushNotifications.native.ts +209 -0
  441. package/src/pushNotifications/providers/pinpoint/apis/initializePushNotifications.ts +24 -0
  442. package/src/pushNotifications/providers/pinpoint/apis/onNotificationOpened.native.ts +11 -0
  443. package/src/pushNotifications/providers/pinpoint/apis/onNotificationOpened.ts +39 -0
  444. package/src/pushNotifications/providers/pinpoint/apis/onNotificationReceivedInBackground.native.ts +12 -0
  445. package/src/pushNotifications/providers/pinpoint/apis/onNotificationReceivedInBackground.ts +56 -0
  446. package/src/pushNotifications/providers/pinpoint/apis/onNotificationReceivedInForeground.native.ts +12 -0
  447. package/src/pushNotifications/providers/pinpoint/apis/onNotificationReceivedInForeground.ts +40 -0
  448. package/src/pushNotifications/providers/pinpoint/apis/onTokenReceived.native.ts +11 -0
  449. package/src/pushNotifications/providers/pinpoint/apis/onTokenReceived.ts +39 -0
  450. package/src/pushNotifications/providers/pinpoint/apis/requestPermissions.native.ts +14 -0
  451. package/src/pushNotifications/providers/pinpoint/apis/requestPermissions.ts +39 -0
  452. package/src/pushNotifications/providers/pinpoint/apis/setBadgeCount.native.ts +13 -0
  453. package/src/pushNotifications/providers/pinpoint/apis/setBadgeCount.ts +21 -0
  454. package/src/pushNotifications/providers/pinpoint/index.ts +34 -0
  455. package/src/pushNotifications/providers/pinpoint/types/analytics.ts +14 -0
  456. package/src/pushNotifications/providers/pinpoint/types/apis.ts +54 -0
  457. package/src/pushNotifications/providers/pinpoint/types/index.ts +40 -0
  458. package/src/pushNotifications/providers/pinpoint/types/inputs.ts +31 -0
  459. package/src/pushNotifications/providers/pinpoint/types/options.ts +9 -0
  460. package/src/pushNotifications/providers/pinpoint/types/outputs.ts +34 -0
  461. package/src/pushNotifications/providers/pinpoint/types/pushNotifications.ts +6 -0
  462. package/src/pushNotifications/providers/pinpoint/utils/createMessageEventRecorder.ts +66 -0
  463. package/src/pushNotifications/providers/pinpoint/utils/getAnalyticsEvent.ts +66 -0
  464. package/src/pushNotifications/providers/pinpoint/utils/getChannelType.ts +25 -0
  465. package/src/pushNotifications/providers/pinpoint/utils/index.ts +7 -0
  466. package/src/pushNotifications/providers/pinpoint/utils/resolveConfig.ts +16 -0
  467. package/src/{InAppMessaging/Providers/index.ts → pushNotifications/types/errors.ts} +3 -1
  468. package/src/pushNotifications/types/index.ts +9 -0
  469. package/src/pushNotifications/types/inputs.ts +45 -0
  470. package/src/pushNotifications/types/module.ts +42 -0
  471. package/src/pushNotifications/types/options.ts +7 -0
  472. package/src/pushNotifications/types/outputs.ts +28 -0
  473. package/src/pushNotifications/types/pushNotifications.ts +17 -0
  474. package/src/pushNotifications/utils/getPushNotificationUserAgentString.ts +15 -0
  475. package/src/pushNotifications/utils/index.ts +7 -0
  476. package/src/pushNotifications/utils/initializationManager.ts +20 -0
  477. package/src/pushNotifications/utils/resolveCredentials.ts +14 -0
  478. package/src/pushNotifications/utils/tokenManager.ts +20 -0
  479. package/lib/.tsbuildinfo +0 -3
  480. package/lib/InAppMessaging/InAppMessaging.d.ts +0 -57
  481. package/lib/InAppMessaging/InAppMessaging.js +0 -340
  482. package/lib/InAppMessaging/InAppMessaging.js.map +0 -1
  483. package/lib/InAppMessaging/Providers/AWSPinpointProvider/index.d.ts +0 -31
  484. package/lib/InAppMessaging/Providers/AWSPinpointProvider/index.js +0 -266
  485. package/lib/InAppMessaging/Providers/AWSPinpointProvider/index.js.map +0 -1
  486. package/lib/InAppMessaging/Providers/AWSPinpointProvider/types.d.ts +0 -16
  487. package/lib/InAppMessaging/Providers/AWSPinpointProvider/types.js +0 -11
  488. package/lib/InAppMessaging/Providers/AWSPinpointProvider/types.js.map +0 -1
  489. package/lib/InAppMessaging/Providers/AWSPinpointProvider/utils.js +0 -247
  490. package/lib/InAppMessaging/Providers/AWSPinpointProvider/utils.js.map +0 -1
  491. package/lib/InAppMessaging/Providers/index.d.ts +0 -1
  492. package/lib/InAppMessaging/Providers/index.js +0 -7
  493. package/lib/InAppMessaging/Providers/index.js.map +0 -1
  494. package/lib/InAppMessaging/SessionTracker/SessionTracker.d.ts +0 -9
  495. package/lib/InAppMessaging/SessionTracker/SessionTracker.js +0 -68
  496. package/lib/InAppMessaging/SessionTracker/SessionTracker.js.map +0 -1
  497. package/lib/InAppMessaging/SessionTracker/SessionTracker.native.d.ts +0 -10
  498. package/lib/InAppMessaging/SessionTracker/SessionTracker.native.js +0 -53
  499. package/lib/InAppMessaging/SessionTracker/SessionTracker.native.js.map +0 -1
  500. package/lib/InAppMessaging/SessionTracker/index.d.ts +0 -3
  501. package/lib/InAppMessaging/SessionTracker/index.js +0 -8
  502. package/lib/InAppMessaging/SessionTracker/index.js.map +0 -1
  503. package/lib/InAppMessaging/SessionTracker/types.d.ts +0 -6
  504. package/lib/InAppMessaging/SessionTracker/types.js.map +0 -1
  505. package/lib/InAppMessaging/index.d.ts +0 -2
  506. package/lib/InAppMessaging/index.js.map +0 -1
  507. package/lib/InAppMessaging/types.d.ts +0 -87
  508. package/lib/InAppMessaging/types.js +0 -12
  509. package/lib/InAppMessaging/types.js.map +0 -1
  510. package/lib/Notifications.d.ts +0 -24
  511. package/lib/Notifications.js +0 -94
  512. package/lib/Notifications.js.map +0 -1
  513. package/lib/PushNotification/NotEnabledError.d.ts +0 -3
  514. package/lib/PushNotification/NotEnabledError.js +0 -16
  515. package/lib/PushNotification/NotEnabledError.js.map +0 -1
  516. package/lib/PushNotification/Platform/index.d.ts +0 -2
  517. package/lib/PushNotification/Platform/index.js +0 -26
  518. package/lib/PushNotification/Platform/index.js.map +0 -1
  519. package/lib/PushNotification/Platform/index.native.d.ts +0 -2
  520. package/lib/PushNotification/Platform/index.native.js +0 -8
  521. package/lib/PushNotification/Platform/index.native.js.map +0 -1
  522. package/lib/PushNotification/Platform/types.d.ts +0 -5
  523. package/lib/PushNotification/Platform/types.js.map +0 -1
  524. package/lib/PushNotification/PlatformNotSupportedError.d.ts +0 -3
  525. package/lib/PushNotification/PlatformNotSupportedError.js +0 -16
  526. package/lib/PushNotification/PlatformNotSupportedError.js.map +0 -1
  527. package/lib/PushNotification/Providers/AWSPinpointProvider/index.d.ts +0 -15
  528. package/lib/PushNotification/Providers/AWSPinpointProvider/index.js +0 -114
  529. package/lib/PushNotification/Providers/AWSPinpointProvider/index.js.map +0 -1
  530. package/lib/PushNotification/Providers/AWSPinpointProvider/types.d.ts +0 -9
  531. package/lib/PushNotification/Providers/AWSPinpointProvider/types.js +0 -16
  532. package/lib/PushNotification/Providers/AWSPinpointProvider/types.js.map +0 -1
  533. package/lib/PushNotification/Providers/AWSPinpointProvider/utils.d.ts +0 -7
  534. package/lib/PushNotification/Providers/AWSPinpointProvider/utils.js +0 -58
  535. package/lib/PushNotification/Providers/AWSPinpointProvider/utils.js.map +0 -1
  536. package/lib/PushNotification/Providers/index.d.ts +0 -1
  537. package/lib/PushNotification/Providers/index.js +0 -7
  538. package/lib/PushNotification/Providers/index.js.map +0 -1
  539. package/lib/PushNotification/PushNotification.d.ts +0 -39
  540. package/lib/PushNotification/PushNotification.js +0 -91
  541. package/lib/PushNotification/PushNotification.js.map +0 -1
  542. package/lib/PushNotification/PushNotification.native.d.ts +0 -63
  543. package/lib/PushNotification/PushNotification.native.js +0 -332
  544. package/lib/PushNotification/PushNotification.native.js.map +0 -1
  545. package/lib/PushNotification/index.d.ts +0 -2
  546. package/lib/PushNotification/index.js +0 -9
  547. package/lib/PushNotification/index.js.map +0 -1
  548. package/lib/PushNotification/types.d.ts +0 -77
  549. package/lib/PushNotification/types.js +0 -12
  550. package/lib/PushNotification/types.js.map +0 -1
  551. package/lib/PushNotification/utils.d.ts +0 -3
  552. package/lib/PushNotification/utils.js +0 -81
  553. package/lib/PushNotification/utils.js.map +0 -1
  554. package/lib/common/AWSPinpointProviderCommon/index.d.ts +0 -35
  555. package/lib/common/AWSPinpointProviderCommon/index.js +0 -280
  556. package/lib/common/AWSPinpointProviderCommon/index.js.map +0 -1
  557. package/lib/common/AWSPinpointProviderCommon/types.d.ts +0 -10
  558. package/lib/common/AWSPinpointProviderCommon/types.js.map +0 -1
  559. package/lib/common/constants.d.ts +0 -1
  560. package/lib/common/constants.js +0 -8
  561. package/lib/common/constants.js.map +0 -1
  562. package/lib/common/eventListeners/index.js +0 -55
  563. package/lib/common/eventListeners/index.js.map +0 -1
  564. package/lib/common/eventListeners/types.d.ts +0 -7
  565. package/lib/common/eventListeners/types.js.map +0 -1
  566. package/lib/common/index.d.ts +0 -4
  567. package/lib/common/index.js +0 -13
  568. package/lib/common/index.js.map +0 -1
  569. package/lib/index.js.map +0 -1
  570. package/lib/types.d.ts +0 -39
  571. package/lib/types.js +0 -5
  572. package/lib/types.js.map +0 -1
  573. package/lib-esm/.tsbuildinfo +0 -3
  574. package/lib-esm/InAppMessaging/InAppMessaging.d.ts +0 -57
  575. package/lib-esm/InAppMessaging/InAppMessaging.js +0 -338
  576. package/lib-esm/InAppMessaging/InAppMessaging.js.map +0 -1
  577. package/lib-esm/InAppMessaging/Providers/AWSPinpointProvider/index.d.ts +0 -31
  578. package/lib-esm/InAppMessaging/Providers/AWSPinpointProvider/index.js +0 -264
  579. package/lib-esm/InAppMessaging/Providers/AWSPinpointProvider/index.js.map +0 -1
  580. package/lib-esm/InAppMessaging/Providers/AWSPinpointProvider/types.d.ts +0 -16
  581. package/lib-esm/InAppMessaging/Providers/AWSPinpointProvider/types.js +0 -9
  582. package/lib-esm/InAppMessaging/Providers/AWSPinpointProvider/types.js.map +0 -1
  583. package/lib-esm/InAppMessaging/Providers/AWSPinpointProvider/utils.js +0 -245
  584. package/lib-esm/InAppMessaging/Providers/AWSPinpointProvider/utils.js.map +0 -1
  585. package/lib-esm/InAppMessaging/Providers/index.d.ts +0 -1
  586. package/lib-esm/InAppMessaging/Providers/index.js +0 -4
  587. package/lib-esm/InAppMessaging/Providers/index.js.map +0 -1
  588. package/lib-esm/InAppMessaging/SessionTracker/SessionTracker.d.ts +0 -9
  589. package/lib-esm/InAppMessaging/SessionTracker/SessionTracker.js +0 -65
  590. package/lib-esm/InAppMessaging/SessionTracker/SessionTracker.js.map +0 -1
  591. package/lib-esm/InAppMessaging/SessionTracker/SessionTracker.native.d.ts +0 -10
  592. package/lib-esm/InAppMessaging/SessionTracker/SessionTracker.native.js +0 -50
  593. package/lib-esm/InAppMessaging/SessionTracker/SessionTracker.native.js.map +0 -1
  594. package/lib-esm/InAppMessaging/SessionTracker/index.d.ts +0 -3
  595. package/lib-esm/InAppMessaging/SessionTracker/index.js +0 -5
  596. package/lib-esm/InAppMessaging/SessionTracker/index.js.map +0 -1
  597. package/lib-esm/InAppMessaging/SessionTracker/types.d.ts +0 -6
  598. package/lib-esm/InAppMessaging/SessionTracker/types.js.map +0 -1
  599. package/lib-esm/InAppMessaging/index.d.ts +0 -2
  600. package/lib-esm/InAppMessaging/index.js +0 -5
  601. package/lib-esm/InAppMessaging/index.js.map +0 -1
  602. package/lib-esm/InAppMessaging/types.d.ts +0 -87
  603. package/lib-esm/InAppMessaging/types.js +0 -10
  604. package/lib-esm/InAppMessaging/types.js.map +0 -1
  605. package/lib-esm/Notifications.d.ts +0 -24
  606. package/lib-esm/Notifications.js +0 -92
  607. package/lib-esm/Notifications.js.map +0 -1
  608. package/lib-esm/PushNotification/NotEnabledError.d.ts +0 -3
  609. package/lib-esm/PushNotification/NotEnabledError.js +0 -14
  610. package/lib-esm/PushNotification/NotEnabledError.js.map +0 -1
  611. package/lib-esm/PushNotification/Platform/index.d.ts +0 -2
  612. package/lib-esm/PushNotification/Platform/index.js +0 -24
  613. package/lib-esm/PushNotification/Platform/index.js.map +0 -1
  614. package/lib-esm/PushNotification/Platform/index.native.d.ts +0 -2
  615. package/lib-esm/PushNotification/Platform/index.native.js +0 -6
  616. package/lib-esm/PushNotification/Platform/index.native.js.map +0 -1
  617. package/lib-esm/PushNotification/Platform/types.d.ts +0 -5
  618. package/lib-esm/PushNotification/Platform/types.js.map +0 -1
  619. package/lib-esm/PushNotification/PlatformNotSupportedError.d.ts +0 -3
  620. package/lib-esm/PushNotification/PlatformNotSupportedError.js +0 -14
  621. package/lib-esm/PushNotification/PlatformNotSupportedError.js.map +0 -1
  622. package/lib-esm/PushNotification/Providers/AWSPinpointProvider/index.d.ts +0 -15
  623. package/lib-esm/PushNotification/Providers/AWSPinpointProvider/index.js +0 -112
  624. package/lib-esm/PushNotification/Providers/AWSPinpointProvider/index.js.map +0 -1
  625. package/lib-esm/PushNotification/Providers/AWSPinpointProvider/types.d.ts +0 -9
  626. package/lib-esm/PushNotification/Providers/AWSPinpointProvider/types.js +0 -14
  627. package/lib-esm/PushNotification/Providers/AWSPinpointProvider/types.js.map +0 -1
  628. package/lib-esm/PushNotification/Providers/AWSPinpointProvider/utils.d.ts +0 -7
  629. package/lib-esm/PushNotification/Providers/AWSPinpointProvider/utils.js +0 -56
  630. package/lib-esm/PushNotification/Providers/AWSPinpointProvider/utils.js.map +0 -1
  631. package/lib-esm/PushNotification/Providers/index.d.ts +0 -1
  632. package/lib-esm/PushNotification/Providers/index.js +0 -4
  633. package/lib-esm/PushNotification/Providers/index.js.map +0 -1
  634. package/lib-esm/PushNotification/PushNotification.d.ts +0 -39
  635. package/lib-esm/PushNotification/PushNotification.js +0 -89
  636. package/lib-esm/PushNotification/PushNotification.js.map +0 -1
  637. package/lib-esm/PushNotification/PushNotification.native.d.ts +0 -63
  638. package/lib-esm/PushNotification/PushNotification.native.js +0 -330
  639. package/lib-esm/PushNotification/PushNotification.native.js.map +0 -1
  640. package/lib-esm/PushNotification/index.d.ts +0 -2
  641. package/lib-esm/PushNotification/index.js +0 -5
  642. package/lib-esm/PushNotification/index.js.map +0 -1
  643. package/lib-esm/PushNotification/types.d.ts +0 -77
  644. package/lib-esm/PushNotification/types.js +0 -10
  645. package/lib-esm/PushNotification/types.js.map +0 -1
  646. package/lib-esm/PushNotification/utils.d.ts +0 -3
  647. package/lib-esm/PushNotification/utils.js +0 -79
  648. package/lib-esm/PushNotification/utils.js.map +0 -1
  649. package/lib-esm/common/AWSPinpointProviderCommon/index.d.ts +0 -35
  650. package/lib-esm/common/AWSPinpointProviderCommon/index.js +0 -278
  651. package/lib-esm/common/AWSPinpointProviderCommon/index.js.map +0 -1
  652. package/lib-esm/common/AWSPinpointProviderCommon/types.d.ts +0 -10
  653. package/lib-esm/common/AWSPinpointProviderCommon/types.js.map +0 -1
  654. package/lib-esm/common/constants.d.ts +0 -1
  655. package/lib-esm/common/constants.js +0 -6
  656. package/lib-esm/common/constants.js.map +0 -1
  657. package/lib-esm/common/eventListeners/index.js +0 -53
  658. package/lib-esm/common/eventListeners/index.js.map +0 -1
  659. package/lib-esm/common/eventListeners/types.d.ts +0 -7
  660. package/lib-esm/common/eventListeners/types.js.map +0 -1
  661. package/lib-esm/common/index.d.ts +0 -4
  662. package/lib-esm/common/index.js.map +0 -1
  663. package/lib-esm/index.js.map +0 -1
  664. package/lib-esm/types.d.ts +0 -39
  665. package/lib-esm/types.js +0 -3
  666. package/lib-esm/types.js.map +0 -1
  667. package/src/InAppMessaging/InAppMessaging.ts +0 -321
  668. package/src/InAppMessaging/Providers/AWSPinpointProvider/index.ts +0 -323
  669. package/src/InAppMessaging/SessionTracker/SessionTracker.native.ts +0 -60
  670. package/src/InAppMessaging/SessionTracker/SessionTracker.ts +0 -78
  671. package/src/InAppMessaging/SessionTracker/index.ts +0 -6
  672. package/src/InAppMessaging/SessionTracker/types.ts +0 -11
  673. package/src/InAppMessaging/types.ts +0 -142
  674. package/src/Notifications.ts +0 -90
  675. package/src/PushNotification/NotEnabledError.ts +0 -11
  676. package/src/PushNotification/Platform/index.native.ts +0 -9
  677. package/src/PushNotification/Platform/index.ts +0 -22
  678. package/src/PushNotification/Platform/types.ts +0 -15
  679. package/src/PushNotification/PlatformNotSupportedError.ts +0 -9
  680. package/src/PushNotification/Providers/AWSPinpointProvider/index.ts +0 -137
  681. package/src/PushNotification/Providers/AWSPinpointProvider/types.ts +0 -13
  682. package/src/PushNotification/Providers/AWSPinpointProvider/utils.ts +0 -79
  683. package/src/PushNotification/PushNotification.native.ts +0 -386
  684. package/src/PushNotification/PushNotification.ts +0 -107
  685. package/src/PushNotification/index.ts +0 -9
  686. package/src/PushNotification/types.ts +0 -115
  687. package/src/PushNotification/utils.ts +0 -112
  688. package/src/common/AWSPinpointProviderCommon/index.ts +0 -291
  689. package/src/common/AWSPinpointProviderCommon/types.ts +0 -29
  690. package/src/common/constants.ts +0 -7
  691. package/src/types.ts +0 -56
@@ -0,0 +1,31 @@
1
+ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
+ // SPDX-License-Identifier: Apache-2.0
3
+ import { PlatformNotSupportedError } from '@aws-amplify/core/internals/utils';
4
+ /**
5
+ * Returns a string representing the current status of user permissions to display push notifications. The possible
6
+ * statuses are as follows:
7
+ *
8
+ * * `'shouldRequest'` - No permissions have been requested yet. It is idiomatic at this time to simply request for
9
+ * permissions from the user.
10
+ *
11
+ * * `'shouldExplainThenRequest'` - It is recommended at this time to provide some context or rationale to the user
12
+ * explaining why you want to send them push notifications before requesting for permissions.
13
+ *
14
+ * * `'granted'` - Permissions have been granted by the user. No further actions are needed and their app is ready to
15
+ * display notifications.
16
+ *
17
+ * * `'denied'` - Permissions have been denied by the user. Further attempts to request permissions will no longer
18
+ * trigger a permission dialog. Your app should now either degrade gracefully or prompt your user to grant the
19
+ * permissions needed in their device settings.
20
+ *
21
+ * @throws platform: {@link PlatformNotSupportedError} - Thrown if called against an unsupported platform. Currently,
22
+ * only React Native is supported by this API.
23
+ * @return {Promise<GetPermissionStatusOutput>} a promise resolving to a string representing the current status of user
24
+ * selected notification permissions.
25
+ * @example
26
+ * ```ts
27
+ * const permissionStatus = await getPermissionStatus();
28
+ */
29
+ export const getPermissionStatus = async () => {
30
+ throw new PlatformNotSupportedError();
31
+ };
@@ -0,0 +1,2 @@
1
+ import { GetPermissionStatus } from '../types';
2
+ export declare const getPermissionStatus: GetPermissionStatus;
@@ -0,0 +1,9 @@
1
+ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
+ // SPDX-License-Identifier: Apache-2.0
3
+ import { loadAmplifyPushNotification } from '@aws-amplify/react-native';
4
+ import { assertIsInitialized } from '../../../errors/errorHelpers';
5
+ const { getPermissionStatus: getPermissionStatusNative } = loadAmplifyPushNotification();
6
+ export const getPermissionStatus = async () => {
7
+ assertIsInitialized();
8
+ return getPermissionStatusNative();
9
+ };
@@ -0,0 +1,53 @@
1
+ import { IdentifyUser } from '../types';
2
+ /**
3
+ * Sends information about a user to Pinpoint. Sending user information allows you to associate a user to their user
4
+ * profile and activities or actions in your application. Activity can be tracked across devices & platforms by using
5
+ * the same `userId`.
6
+ *
7
+ * @param {IdentifyUserInput} input The input object used to construct requests sent to Pinpoint's UpdateEndpoint
8
+ * API.
9
+ * @throws service: {@link UpdateEndpointException} - Thrown when the underlying Pinpoint service returns an error.
10
+ * @throws validation: {@link PushNotificationValidationErrorCode} - Thrown when the provided parameters or library
11
+ * configuration is incorrect.
12
+ * @throws platform: {@link PlatformNotSupportedError} - Thrown if called against an unsupported platform. Currently,
13
+ * only React Native is supported by this API.
14
+ * @returns A promise that will resolve when the operation is complete.
15
+ * @example
16
+ * ```ts
17
+ * // Identify a user with Pinpoint
18
+ * await identifyUser({
19
+ * userId,
20
+ * userProfile: {
21
+ * email: 'userEmail@example.com'
22
+ * customProperties: {
23
+ * phoneNumber: ['555-555-5555'],
24
+ * },
25
+ * }
26
+ * });
27
+ * ```
28
+ *
29
+ * @example
30
+ * ```ts
31
+ * // Identify a user with Pinpoint specific options
32
+ * await identifyUser({
33
+ * userId,
34
+ * userProfile: {
35
+ * email: 'userEmail@example.com'
36
+ * customProperties: {
37
+ * phoneNumber: ['555-555-5555'],
38
+ * },
39
+ * demographic: {
40
+ * platform: 'ios',
41
+ * timezone: 'America/Los_Angeles'
42
+ * }
43
+ * },
44
+ * options: {
45
+ * address: 'device-address',
46
+ * optOut: 'NONE',
47
+ * userAttributes: {
48
+ * interests: ['food']
49
+ * },
50
+ * },
51
+ * });
52
+ */
53
+ export declare const identifyUser: IdentifyUser;
@@ -0,0 +1,57 @@
1
+ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
+ // SPDX-License-Identifier: Apache-2.0
3
+ import { PlatformNotSupportedError } from '@aws-amplify/core/internals/utils';
4
+ /**
5
+ * Sends information about a user to Pinpoint. Sending user information allows you to associate a user to their user
6
+ * profile and activities or actions in your application. Activity can be tracked across devices & platforms by using
7
+ * the same `userId`.
8
+ *
9
+ * @param {IdentifyUserInput} input The input object used to construct requests sent to Pinpoint's UpdateEndpoint
10
+ * API.
11
+ * @throws service: {@link UpdateEndpointException} - Thrown when the underlying Pinpoint service returns an error.
12
+ * @throws validation: {@link PushNotificationValidationErrorCode} - Thrown when the provided parameters or library
13
+ * configuration is incorrect.
14
+ * @throws platform: {@link PlatformNotSupportedError} - Thrown if called against an unsupported platform. Currently,
15
+ * only React Native is supported by this API.
16
+ * @returns A promise that will resolve when the operation is complete.
17
+ * @example
18
+ * ```ts
19
+ * // Identify a user with Pinpoint
20
+ * await identifyUser({
21
+ * userId,
22
+ * userProfile: {
23
+ * email: 'userEmail@example.com'
24
+ * customProperties: {
25
+ * phoneNumber: ['555-555-5555'],
26
+ * },
27
+ * }
28
+ * });
29
+ * ```
30
+ *
31
+ * @example
32
+ * ```ts
33
+ * // Identify a user with Pinpoint specific options
34
+ * await identifyUser({
35
+ * userId,
36
+ * userProfile: {
37
+ * email: 'userEmail@example.com'
38
+ * customProperties: {
39
+ * phoneNumber: ['555-555-5555'],
40
+ * },
41
+ * demographic: {
42
+ * platform: 'ios',
43
+ * timezone: 'America/Los_Angeles'
44
+ * }
45
+ * },
46
+ * options: {
47
+ * address: 'device-address',
48
+ * optOut: 'NONE',
49
+ * userAttributes: {
50
+ * interests: ['food']
51
+ * },
52
+ * },
53
+ * });
54
+ */
55
+ export const identifyUser = async () => {
56
+ throw new PlatformNotSupportedError();
57
+ };
@@ -0,0 +1,2 @@
1
+ import { IdentifyUser } from '../types';
2
+ export declare const identifyUser: IdentifyUser;
@@ -0,0 +1,27 @@
1
+ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
+ // SPDX-License-Identifier: Apache-2.0
3
+ import { PushNotificationAction } from '@aws-amplify/core/internals/utils';
4
+ import { updateEndpoint } from '@aws-amplify/core/internals/providers/pinpoint';
5
+ import { assertIsInitialized } from '../../../errors/errorHelpers';
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),
26
+ });
27
+ };
@@ -0,0 +1,11 @@
1
+ export { getBadgeCount } from './getBadgeCount';
2
+ export { getLaunchNotification } from './getLaunchNotification';
3
+ export { getPermissionStatus } from './getPermissionStatus';
4
+ export { identifyUser } from './identifyUser';
5
+ export { initializePushNotifications } from './initializePushNotifications';
6
+ export { onNotificationOpened } from './onNotificationOpened';
7
+ export { onNotificationReceivedInBackground } from './onNotificationReceivedInBackground';
8
+ export { onNotificationReceivedInForeground } from './onNotificationReceivedInForeground';
9
+ export { onTokenReceived } from './onTokenReceived';
10
+ export { requestPermissions } from './requestPermissions';
11
+ export { setBadgeCount } from './setBadgeCount';
@@ -0,0 +1,13 @@
1
+ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
+ // SPDX-License-Identifier: Apache-2.0
3
+ export { getBadgeCount } from './getBadgeCount';
4
+ export { getLaunchNotification } from './getLaunchNotification';
5
+ export { getPermissionStatus } from './getPermissionStatus';
6
+ export { identifyUser } from './identifyUser';
7
+ export { initializePushNotifications } from './initializePushNotifications';
8
+ export { onNotificationOpened } from './onNotificationOpened';
9
+ export { onNotificationReceivedInBackground } from './onNotificationReceivedInBackground';
10
+ export { onNotificationReceivedInForeground } from './onNotificationReceivedInForeground';
11
+ export { onTokenReceived } from './onTokenReceived';
12
+ export { requestPermissions } from './requestPermissions';
13
+ export { setBadgeCount } from './setBadgeCount';
@@ -0,0 +1,17 @@
1
+ import { InitializePushNotifications } from '../types';
2
+ /**
3
+ * Initialize and set up the push notification category. The category must be first initialized before all other
4
+ * functionalities become available.
5
+ *
6
+ * @throws platform: {@link PlatformNotSupportedError} - Thrown if called against an unsupported platform. Currently,
7
+ * only React Native is supported by this API.
8
+ * @remarks
9
+ * It is recommended that this be called as early in your app as possible at the root of your application to allow
10
+ * background processing of notifications.
11
+ * @example
12
+ * ```ts
13
+ * Amplify.configure(config);
14
+ * initializePushNotifications();
15
+ * ```
16
+ */
17
+ export declare const initializePushNotifications: InitializePushNotifications;
@@ -0,0 +1,21 @@
1
+ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
+ // SPDX-License-Identifier: Apache-2.0
3
+ import { PlatformNotSupportedError } from '@aws-amplify/core/internals/utils';
4
+ /**
5
+ * Initialize and set up the push notification category. The category must be first initialized before all other
6
+ * functionalities become available.
7
+ *
8
+ * @throws platform: {@link PlatformNotSupportedError} - Thrown if called against an unsupported platform. Currently,
9
+ * only React Native is supported by this API.
10
+ * @remarks
11
+ * It is recommended that this be called as early in your app as possible at the root of your application to allow
12
+ * background processing of notifications.
13
+ * @example
14
+ * ```ts
15
+ * Amplify.configure(config);
16
+ * initializePushNotifications();
17
+ * ```
18
+ */
19
+ export const initializePushNotifications = () => {
20
+ throw new PlatformNotSupportedError();
21
+ };
@@ -0,0 +1 @@
1
+ export declare const initializePushNotifications: () => void;
@@ -0,0 +1,129 @@
1
+ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
+ // SPDX-License-Identifier: Apache-2.0
3
+ import { ConsoleLogger } from '@aws-amplify/core';
4
+ import { PushNotificationAction } from '@aws-amplify/core/internals/utils';
5
+ import { updateEndpoint } from '@aws-amplify/core/internals/providers/pinpoint';
6
+ import { loadAmplifyPushNotification } from '@aws-amplify/react-native';
7
+ import { addEventListener, notifyEventListeners, notifyEventListenersAndAwaitHandlers, } from '../../../../eventListeners';
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 = () => {
14
+ if (isInitialized()) {
15
+ logger.info('Push notifications have already been enabled');
16
+ return;
17
+ }
18
+ addNativeListeners();
19
+ addAnalyticsListeners();
20
+ initialize();
21
+ };
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;
26
+ // on platforms that can handle headless tasks, register one to broadcast background message received to
27
+ // library listeners
28
+ if (NativeHeadlessTaskKey) {
29
+ registerHeadlessTask(async (message) => {
30
+ // keep headless task running until handlers have completed their work
31
+ await notifyEventListenersAndAwaitHandlers('backgroundMessageReceived', message);
32
+ });
33
+ }
34
+ else if (BACKGROUND_MESSAGE_RECEIVED) {
35
+ // on platforms that can't handle headless tasks, listen for native background message received event and
36
+ // broadcast to library listeners
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);
57
+ }
58
+ }
59
+ });
60
+ }
61
+ addMessageEventListener(
62
+ // listen for native foreground message received event and broadcast to library listeners
63
+ FOREGROUND_MESSAGE_RECEIVED, message => {
64
+ notifyEventListeners('foregroundMessageReceived', message);
65
+ });
66
+ launchNotificationOpenedListener = LAUNCH_NOTIFICATION_OPENED
67
+ ? addMessageEventListener(
68
+ // listen for native notification opened app (user tapped on notification, opening the app from quit -
69
+ // not background - state) event. This is broadcasted to an internal listener only as it is not intended
70
+ // for use otherwise as it produces inconsistent results when used within React Native app context
71
+ LAUNCH_NOTIFICATION_OPENED, message => {
72
+ notifyEventListeners('launchNotificationOpened', message);
73
+ // once we are done with it we can remove the listener
74
+ launchNotificationOpenedListener?.remove();
75
+ })
76
+ : null;
77
+ addMessageEventListener(
78
+ // listen for native notification opened (user tapped on notification, opening the app from background -
79
+ // not quit - state) event and broadcast to library listeners
80
+ NOTIFICATION_OPENED, message => {
81
+ notifyEventListeners('notificationOpened', message);
82
+ // if we are in this state, we no longer need the listener as the app was launched via some other means
83
+ launchNotificationOpenedListener?.remove();
84
+ });
85
+ addTokenEventListener(
86
+ // listen for native new token event, automatically re-register device with provider using new token and
87
+ // broadcast to library listeners
88
+ TOKEN_RECEIVED, async (token) => {
89
+ // avoid a race condition where two endpoints are created with the same token on a fresh install
90
+ if (getToken() === token) {
91
+ return;
92
+ }
93
+ setToken(token);
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
+ }
102
+ });
103
+ };
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),
128
+ });
129
+ };
@@ -0,0 +1,27 @@
1
+ import { OnNotificationOpened } from '../types';
2
+ /**
3
+ * Registers a listener that will be triggered when a notification is opened by user.
4
+ *
5
+ * @param {OnNotificationOpenedInput} input - A callback handler to be invoked with the opened
6
+ * {@link PushNotificationMessage}.
7
+ * @returns {OnNotificationOpenedOutput} - An object with a remove function to remove the listener.
8
+ * @example
9
+ * ```ts
10
+ * // Register a listener
11
+ * onNotificationOpened(message => {
12
+ * doSomething(message);
13
+ * });
14
+ * ```
15
+ * @example
16
+ * ```ts
17
+ * // Register multiple listeners
18
+ * onNotificationOpened(message => {
19
+ * doSomething(message);
20
+ * });
21
+ *
22
+ * onNotificationOpened(message => {
23
+ * doSomethingElse(message);
24
+ * });
25
+ * ```
26
+ */
27
+ export declare const onNotificationOpened: OnNotificationOpened;
@@ -0,0 +1,31 @@
1
+ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
+ // SPDX-License-Identifier: Apache-2.0
3
+ import { PlatformNotSupportedError } from '@aws-amplify/core/internals/utils';
4
+ /**
5
+ * Registers a listener that will be triggered when a notification is opened by user.
6
+ *
7
+ * @param {OnNotificationOpenedInput} input - A callback handler to be invoked with the opened
8
+ * {@link PushNotificationMessage}.
9
+ * @returns {OnNotificationOpenedOutput} - An object with a remove function to remove the listener.
10
+ * @example
11
+ * ```ts
12
+ * // Register a listener
13
+ * onNotificationOpened(message => {
14
+ * doSomething(message);
15
+ * });
16
+ * ```
17
+ * @example
18
+ * ```ts
19
+ * // Register multiple listeners
20
+ * onNotificationOpened(message => {
21
+ * doSomething(message);
22
+ * });
23
+ *
24
+ * onNotificationOpened(message => {
25
+ * doSomethingElse(message);
26
+ * });
27
+ * ```
28
+ */
29
+ export const onNotificationOpened = () => {
30
+ throw new PlatformNotSupportedError();
31
+ };
@@ -0,0 +1,2 @@
1
+ import { OnNotificationOpened } from '../types';
2
+ export declare const onNotificationOpened: OnNotificationOpened;
@@ -0,0 +1,8 @@
1
+ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
+ // SPDX-License-Identifier: Apache-2.0
3
+ import { addEventListener } from '../../../../eventListeners';
4
+ import { assertIsInitialized } from '../../../errors/errorHelpers';
5
+ export const onNotificationOpened = input => {
6
+ assertIsInitialized();
7
+ return addEventListener('notificationOpened', input);
8
+ };
@@ -0,0 +1,43 @@
1
+ import { OnNotificationReceivedInBackground } from '../types';
2
+ /**
3
+ * Registers a listener that will be triggered when a notification is received while app is in a background state.
4
+ *
5
+ * @throws platform: {@link PlatformNotSupportedError} - Thrown if called against an unsupported platform. Currently,
6
+ * only React Native is supported by this API.
7
+ * @param {OnNotificationReceivedInBackgroundInput} input - A callback handler to be invoked with the received
8
+ * {@link PushNotificationMessage}.
9
+ * @returns {OnNotificationReceivedInBackgroundOutput} - An object with a remove function to remove the listener.
10
+ * @remarks Notifications received while app is in a quit state will start the app (as a headless JS instance running
11
+ * on a background service on Android) in the background. Handlers registered via this function should return promises
12
+ * if it needs to be asynchronous (e.g. to perform some network requests). The app should run in the background as long
13
+ * as there are handlers still running (however, if they run for more than 30 seconds on iOS, subsequent tasks could
14
+ * get deprioritized!). If it is necessary for a handler to execute while the app is in quit state, it should be
15
+ * registered in the application entry point (e.g. index.js) since the application will not fully mount in that case.
16
+ * @example
17
+ * ```ts
18
+ * // Register a listener
19
+ * onNotificationReceivedInBackground(message => {
20
+ * doSomething(message);
21
+ * });
22
+ * ```
23
+ * @example
24
+ * ```ts
25
+ * // Register multiple listeners
26
+ * onNotificationReceivedInBackground(message => {
27
+ * doSomething(message);
28
+ * });
29
+ *
30
+ * onNotificationReceivedInBackground(message => {
31
+ * doSomethingElse(message);
32
+ * });
33
+ * ```
34
+ * @example
35
+ * ```ts
36
+ * // Register async listener
37
+ * onNotificationReceivedInBackground(async message => {
38
+ * await doSomething(message);
39
+ * console.log(`did something with ${message}`);
40
+ * });
41
+ * ```
42
+ */
43
+ export declare const onNotificationReceivedInBackground: OnNotificationReceivedInBackground;
@@ -0,0 +1,47 @@
1
+ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
+ // SPDX-License-Identifier: Apache-2.0
3
+ import { PlatformNotSupportedError } from '@aws-amplify/core/internals/utils';
4
+ /**
5
+ * Registers a listener that will be triggered when a notification is received while app is in a background state.
6
+ *
7
+ * @throws platform: {@link PlatformNotSupportedError} - Thrown if called against an unsupported platform. Currently,
8
+ * only React Native is supported by this API.
9
+ * @param {OnNotificationReceivedInBackgroundInput} input - A callback handler to be invoked with the received
10
+ * {@link PushNotificationMessage}.
11
+ * @returns {OnNotificationReceivedInBackgroundOutput} - An object with a remove function to remove the listener.
12
+ * @remarks Notifications received while app is in a quit state will start the app (as a headless JS instance running
13
+ * on a background service on Android) in the background. Handlers registered via this function should return promises
14
+ * if it needs to be asynchronous (e.g. to perform some network requests). The app should run in the background as long
15
+ * as there are handlers still running (however, if they run for more than 30 seconds on iOS, subsequent tasks could
16
+ * get deprioritized!). If it is necessary for a handler to execute while the app is in quit state, it should be
17
+ * registered in the application entry point (e.g. index.js) since the application will not fully mount in that case.
18
+ * @example
19
+ * ```ts
20
+ * // Register a listener
21
+ * onNotificationReceivedInBackground(message => {
22
+ * doSomething(message);
23
+ * });
24
+ * ```
25
+ * @example
26
+ * ```ts
27
+ * // Register multiple listeners
28
+ * onNotificationReceivedInBackground(message => {
29
+ * doSomething(message);
30
+ * });
31
+ *
32
+ * onNotificationReceivedInBackground(message => {
33
+ * doSomethingElse(message);
34
+ * });
35
+ * ```
36
+ * @example
37
+ * ```ts
38
+ * // Register async listener
39
+ * onNotificationReceivedInBackground(async message => {
40
+ * await doSomething(message);
41
+ * console.log(`did something with ${message}`);
42
+ * });
43
+ * ```
44
+ */
45
+ export const onNotificationReceivedInBackground = () => {
46
+ throw new PlatformNotSupportedError();
47
+ };
@@ -0,0 +1,2 @@
1
+ import { OnNotificationReceivedInBackground } from '../types';
2
+ export declare const onNotificationReceivedInBackground: OnNotificationReceivedInBackground;
@@ -0,0 +1,8 @@
1
+ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
+ // SPDX-License-Identifier: Apache-2.0
3
+ import { addEventListener } from '../../../../eventListeners';
4
+ import { assertIsInitialized } from '../../../errors/errorHelpers';
5
+ export const onNotificationReceivedInBackground = input => {
6
+ assertIsInitialized();
7
+ return addEventListener('backgroundMessageReceived', input);
8
+ };
@@ -0,0 +1,27 @@
1
+ import { OnNotificationReceivedInForeground } from '../types';
2
+ /**
3
+ * Registers a listener that will be triggered when a notification is received while app is in a foreground state.
4
+ *
5
+ * @param {OnNotificationReceivedInForegroundInput} input - A callback handler to be invoked with the received
6
+ * {@link PushNotificationMessage}.
7
+ * @returns {OnNotificationReceivedInForegroundOutput} - An object with a remove function to remove the listener.
8
+ * @example
9
+ * ```ts
10
+ * // Register a listener
11
+ * onNotificationReceivedInForeground(message => {
12
+ * doSomething(message);
13
+ * });
14
+ * ```
15
+ * @example
16
+ * ```ts
17
+ * // Register multiple listeners
18
+ * onNotificationReceivedInForeground(message => {
19
+ * doSomething(message);
20
+ * });
21
+ *
22
+ * onNotificationReceivedInForeground(message => {
23
+ * doSomethingElse(message);
24
+ * });
25
+ * ```
26
+ */
27
+ export declare const onNotificationReceivedInForeground: OnNotificationReceivedInForeground;
@@ -0,0 +1,31 @@
1
+ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
+ // SPDX-License-Identifier: Apache-2.0
3
+ import { PlatformNotSupportedError } from '@aws-amplify/core/internals/utils';
4
+ /**
5
+ * Registers a listener that will be triggered when a notification is received while app is in a foreground state.
6
+ *
7
+ * @param {OnNotificationReceivedInForegroundInput} input - A callback handler to be invoked with the received
8
+ * {@link PushNotificationMessage}.
9
+ * @returns {OnNotificationReceivedInForegroundOutput} - An object with a remove function to remove the listener.
10
+ * @example
11
+ * ```ts
12
+ * // Register a listener
13
+ * onNotificationReceivedInForeground(message => {
14
+ * doSomething(message);
15
+ * });
16
+ * ```
17
+ * @example
18
+ * ```ts
19
+ * // Register multiple listeners
20
+ * onNotificationReceivedInForeground(message => {
21
+ * doSomething(message);
22
+ * });
23
+ *
24
+ * onNotificationReceivedInForeground(message => {
25
+ * doSomethingElse(message);
26
+ * });
27
+ * ```
28
+ */
29
+ export const onNotificationReceivedInForeground = () => {
30
+ throw new PlatformNotSupportedError();
31
+ };
@@ -0,0 +1,2 @@
1
+ import { OnNotificationReceivedInForeground } from '../types';
2
+ export declare const onNotificationReceivedInForeground: OnNotificationReceivedInForeground;
@@ -0,0 +1,8 @@
1
+ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
+ // SPDX-License-Identifier: Apache-2.0
3
+ import { addEventListener } from '../../../../eventListeners';
4
+ import { assertIsInitialized } from '../../../errors/errorHelpers';
5
+ export const onNotificationReceivedInForeground = input => {
6
+ assertIsInitialized();
7
+ return addEventListener('foregroundMessageReceived', input);
8
+ };