@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,7 +2,8 @@
2
2
  // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3
3
  // SPDX-License-Identifier: Apache-2.0
4
4
  Object.defineProperty(exports, "__esModule", { value: true });
5
- var utils_1 = require("@aws-amplify/core/internals/utils");
5
+ exports.onNotificationReceivedInBackground = void 0;
6
+ const utils_1 = require("@aws-amplify/core/internals/utils");
6
7
  /**
7
8
  * Registers a listener that will be triggered when a notification is received while app is in a background state.
8
9
  *
@@ -44,6 +45,7 @@ var utils_1 = require("@aws-amplify/core/internals/utils");
44
45
  * });
45
46
  * ```
46
47
  */
47
- exports.onNotificationReceivedInBackground = function () {
48
+ const onNotificationReceivedInBackground = () => {
48
49
  throw new utils_1.PlatformNotSupportedError();
49
50
  };
51
+ exports.onNotificationReceivedInBackground = onNotificationReceivedInBackground;
@@ -2,9 +2,11 @@
2
2
  // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3
3
  // SPDX-License-Identifier: Apache-2.0
4
4
  Object.defineProperty(exports, "__esModule", { value: true });
5
- var eventListeners_1 = require("../../../../eventListeners");
6
- var errorHelpers_1 = require("../../../errors/errorHelpers");
7
- exports.onNotificationReceivedInBackground = function (input) {
8
- errorHelpers_1.assertIsInitialized();
9
- return eventListeners_1.addEventListener('backgroundMessageReceived', input);
5
+ exports.onNotificationReceivedInBackground = void 0;
6
+ const eventListeners_1 = require("../../../../eventListeners");
7
+ const errorHelpers_1 = require("../../../errors/errorHelpers");
8
+ const onNotificationReceivedInBackground = input => {
9
+ (0, errorHelpers_1.assertIsInitialized)();
10
+ return (0, eventListeners_1.addEventListener)('backgroundMessageReceived', input);
10
11
  };
12
+ exports.onNotificationReceivedInBackground = onNotificationReceivedInBackground;
@@ -2,7 +2,8 @@
2
2
  // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3
3
  // SPDX-License-Identifier: Apache-2.0
4
4
  Object.defineProperty(exports, "__esModule", { value: true });
5
- var utils_1 = require("@aws-amplify/core/internals/utils");
5
+ exports.onNotificationReceivedInForeground = void 0;
6
+ const utils_1 = require("@aws-amplify/core/internals/utils");
6
7
  /**
7
8
  * Registers a listener that will be triggered when a notification is received while app is in a foreground state.
8
9
  *
@@ -28,6 +29,7 @@ var utils_1 = require("@aws-amplify/core/internals/utils");
28
29
  * });
29
30
  * ```
30
31
  */
31
- exports.onNotificationReceivedInForeground = function () {
32
+ const onNotificationReceivedInForeground = () => {
32
33
  throw new utils_1.PlatformNotSupportedError();
33
34
  };
35
+ exports.onNotificationReceivedInForeground = onNotificationReceivedInForeground;
@@ -2,9 +2,11 @@
2
2
  // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3
3
  // SPDX-License-Identifier: Apache-2.0
4
4
  Object.defineProperty(exports, "__esModule", { value: true });
5
- var eventListeners_1 = require("../../../../eventListeners");
6
- var errorHelpers_1 = require("../../../errors/errorHelpers");
7
- exports.onNotificationReceivedInForeground = function (input) {
8
- errorHelpers_1.assertIsInitialized();
9
- return eventListeners_1.addEventListener('foregroundMessageReceived', input);
5
+ exports.onNotificationReceivedInForeground = void 0;
6
+ const eventListeners_1 = require("../../../../eventListeners");
7
+ const errorHelpers_1 = require("../../../errors/errorHelpers");
8
+ const onNotificationReceivedInForeground = input => {
9
+ (0, errorHelpers_1.assertIsInitialized)();
10
+ return (0, eventListeners_1.addEventListener)('foregroundMessageReceived', input);
10
11
  };
12
+ exports.onNotificationReceivedInForeground = onNotificationReceivedInForeground;
@@ -2,7 +2,8 @@
2
2
  // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3
3
  // SPDX-License-Identifier: Apache-2.0
4
4
  Object.defineProperty(exports, "__esModule", { value: true });
5
- var utils_1 = require("@aws-amplify/core/internals/utils");
5
+ exports.onTokenReceived = void 0;
6
+ const utils_1 = require("@aws-amplify/core/internals/utils");
6
7
  /**
7
8
  * Registers a listener that will be triggered when a token is received. A token will be received:
8
9
  * 1. On every app launch, including the first install
@@ -29,6 +30,7 @@ var utils_1 = require("@aws-amplify/core/internals/utils");
29
30
  * });
30
31
  * ```
31
32
  */
32
- exports.onTokenReceived = function () {
33
+ const onTokenReceived = () => {
33
34
  throw new utils_1.PlatformNotSupportedError();
34
35
  };
36
+ exports.onTokenReceived = onTokenReceived;
@@ -2,9 +2,11 @@
2
2
  // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3
3
  // SPDX-License-Identifier: Apache-2.0
4
4
  Object.defineProperty(exports, "__esModule", { value: true });
5
- var eventListeners_1 = require("../../../../eventListeners");
6
- var errorHelpers_1 = require("../../../errors/errorHelpers");
7
- exports.onTokenReceived = function (input) {
8
- errorHelpers_1.assertIsInitialized();
9
- return eventListeners_1.addEventListener('tokenReceived', input);
5
+ exports.onTokenReceived = void 0;
6
+ const eventListeners_1 = require("../../../../eventListeners");
7
+ const errorHelpers_1 = require("../../../errors/errorHelpers");
8
+ const onTokenReceived = input => {
9
+ (0, errorHelpers_1.assertIsInitialized)();
10
+ return (0, eventListeners_1.addEventListener)('tokenReceived', input);
10
11
  };
12
+ exports.onTokenReceived = onTokenReceived;
@@ -2,7 +2,8 @@
2
2
  // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3
3
  // SPDX-License-Identifier: Apache-2.0
4
4
  Object.defineProperty(exports, "__esModule", { value: true });
5
- var utils_1 = require("@aws-amplify/core/internals/utils");
5
+ exports.requestPermissions = void 0;
6
+ const utils_1 = require("@aws-amplify/core/internals/utils");
6
7
  /**
7
8
  * Requests notification permissions from your user. By default, Amplify requests all supported permissions but you can
8
9
  * choose not to request specific permissions. The resulting promise will resolve to true if requested permissions are
@@ -33,6 +34,7 @@ var utils_1 = require("@aws-amplify/core/internals/utils");
33
34
  * });
34
35
  * ```
35
36
  */
36
- exports.requestPermissions = function () {
37
+ const requestPermissions = async () => {
37
38
  throw new utils_1.PlatformNotSupportedError();
38
39
  };
40
+ exports.requestPermissions = requestPermissions;
@@ -2,10 +2,12 @@
2
2
  // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3
3
  // SPDX-License-Identifier: Apache-2.0
4
4
  Object.defineProperty(exports, "__esModule", { value: true });
5
- var react_native_1 = require("@aws-amplify/react-native");
6
- var errorHelpers_1 = require("../../../errors/errorHelpers");
7
- var requestPermissionsNative = react_native_1.loadAmplifyPushNotification().requestPermissions;
8
- exports.requestPermissions = function (input) {
9
- errorHelpers_1.assertIsInitialized();
5
+ exports.requestPermissions = void 0;
6
+ const react_native_1 = require("@aws-amplify/react-native");
7
+ const errorHelpers_1 = require("../../../errors/errorHelpers");
8
+ const { requestPermissions: requestPermissionsNative } = (0, react_native_1.loadAmplifyPushNotification)();
9
+ const requestPermissions = async (input) => {
10
+ (0, errorHelpers_1.assertIsInitialized)();
10
11
  return requestPermissionsNative(input);
11
12
  };
13
+ exports.requestPermissions = requestPermissions;
@@ -2,7 +2,8 @@
2
2
  // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3
3
  // SPDX-License-Identifier: Apache-2.0
4
4
  Object.defineProperty(exports, "__esModule", { value: true });
5
- var utils_1 = require("@aws-amplify/core/internals/utils");
5
+ exports.setBadgeCount = void 0;
6
+ const utils_1 = require("@aws-amplify/core/internals/utils");
6
7
  /**
7
8
  * Sets the current badge count (the number on the top right corner of your app's icon). Setting the badge count
8
9
  * to 0 (zero) will remove the badge from your app's icon. This function is safe to call (but will be ignored) even
@@ -15,6 +16,7 @@ var utils_1 = require("@aws-amplify/core/internals/utils");
15
16
  * setBadgeCount(42);
16
17
  * ```
17
18
  */
18
- exports.setBadgeCount = function () {
19
+ const setBadgeCount = () => {
19
20
  throw new utils_1.PlatformNotSupportedError();
20
21
  };
22
+ exports.setBadgeCount = setBadgeCount;
@@ -2,10 +2,12 @@
2
2
  // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3
3
  // SPDX-License-Identifier: Apache-2.0
4
4
  Object.defineProperty(exports, "__esModule", { value: true });
5
- var react_native_1 = require("@aws-amplify/react-native");
6
- var errorHelpers_1 = require("../../../errors/errorHelpers");
7
- var setBadgeCountNative = react_native_1.loadAmplifyPushNotification().setBadgeCount;
8
- exports.setBadgeCount = function (input) {
9
- errorHelpers_1.assertIsInitialized();
5
+ exports.setBadgeCount = void 0;
6
+ const react_native_1 = require("@aws-amplify/react-native");
7
+ const errorHelpers_1 = require("../../../errors/errorHelpers");
8
+ const { setBadgeCount: setBadgeCountNative } = (0, react_native_1.loadAmplifyPushNotification)();
9
+ const setBadgeCount = input => {
10
+ (0, errorHelpers_1.assertIsInitialized)();
10
11
  setBadgeCountNative(input);
11
12
  };
13
+ exports.setBadgeCount = setBadgeCount;
@@ -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';
@@ -2,15 +2,16 @@
2
2
  // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3
3
  // SPDX-License-Identifier: Apache-2.0
4
4
  Object.defineProperty(exports, "__esModule", { value: true });
5
+ exports.setBadgeCount = exports.requestPermissions = exports.onTokenReceived = exports.onNotificationReceivedInForeground = exports.onNotificationReceivedInBackground = exports.onNotificationOpened = exports.initializePushNotifications = exports.identifyUser = exports.getPermissionStatus = exports.getLaunchNotification = exports.getBadgeCount = void 0;
5
6
  var apis_1 = require("./apis");
6
- exports.getBadgeCount = apis_1.getBadgeCount;
7
- exports.getLaunchNotification = apis_1.getLaunchNotification;
8
- exports.getPermissionStatus = apis_1.getPermissionStatus;
9
- exports.identifyUser = apis_1.identifyUser;
10
- exports.initializePushNotifications = apis_1.initializePushNotifications;
11
- exports.onNotificationOpened = apis_1.onNotificationOpened;
12
- exports.onNotificationReceivedInBackground = apis_1.onNotificationReceivedInBackground;
13
- exports.onNotificationReceivedInForeground = apis_1.onNotificationReceivedInForeground;
14
- exports.onTokenReceived = apis_1.onTokenReceived;
15
- exports.requestPermissions = apis_1.requestPermissions;
16
- exports.setBadgeCount = apis_1.setBadgeCount;
7
+ Object.defineProperty(exports, "getBadgeCount", { enumerable: true, get: function () { return apis_1.getBadgeCount; } });
8
+ Object.defineProperty(exports, "getLaunchNotification", { enumerable: true, get: function () { return apis_1.getLaunchNotification; } });
9
+ Object.defineProperty(exports, "getPermissionStatus", { enumerable: true, get: function () { return apis_1.getPermissionStatus; } });
10
+ Object.defineProperty(exports, "identifyUser", { enumerable: true, get: function () { return apis_1.identifyUser; } });
11
+ Object.defineProperty(exports, "initializePushNotifications", { enumerable: true, get: function () { return apis_1.initializePushNotifications; } });
12
+ Object.defineProperty(exports, "onNotificationOpened", { enumerable: true, get: function () { return apis_1.onNotificationOpened; } });
13
+ Object.defineProperty(exports, "onNotificationReceivedInBackground", { enumerable: true, get: function () { return apis_1.onNotificationReceivedInBackground; } });
14
+ Object.defineProperty(exports, "onNotificationReceivedInForeground", { enumerable: true, get: function () { return apis_1.onNotificationReceivedInForeground; } });
15
+ Object.defineProperty(exports, "onTokenReceived", { enumerable: true, get: function () { return apis_1.onTokenReceived; } });
16
+ Object.defineProperty(exports, "requestPermissions", { enumerable: true, get: function () { return apis_1.requestPermissions; } });
17
+ Object.defineProperty(exports, "setBadgeCount", { enumerable: true, get: function () { return apis_1.setBadgeCount; } });
@@ -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,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,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;
@@ -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,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,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,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;
@@ -2,58 +2,42 @@
2
2
  // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3
3
  // SPDX-License-Identifier: Apache-2.0
4
4
  Object.defineProperty(exports, "__esModule", { value: true });
5
- var tslib_1 = require("tslib");
6
- var pinpoint_1 = require("@aws-amplify/core/internals/providers/pinpoint");
7
- var core_1 = require("@aws-amplify/core");
8
- var getAnalyticsEvent_1 = require("./getAnalyticsEvent");
9
- var getChannelType_1 = require("./getChannelType");
10
- var utils_1 = require("../../../utils");
11
- var logger = new core_1.ConsoleLogger('PushNotification.recordMessageEvent');
5
+ exports.createMessageEventRecorder = void 0;
6
+ const pinpoint_1 = require("@aws-amplify/core/internals/providers/pinpoint");
7
+ const core_1 = require("@aws-amplify/core");
8
+ const utils_1 = require("../../../utils");
9
+ const getAnalyticsEvent_1 = require("./getAnalyticsEvent");
10
+ const getChannelType_1 = require("./getChannelType");
11
+ const resolveConfig_1 = require("./resolveConfig");
12
+ const logger = new core_1.ConsoleLogger('PushNotification.recordMessageEvent');
12
13
  /**
13
14
  * @internal
14
15
  */
15
- exports.createMessageEventRecorder = function (event, callback) {
16
- return function (message) { return tslib_1.__awaiter(void 0, void 0, void 0, function () {
17
- var credentials, _a, appId, region;
18
- return tslib_1.__generator(this, function (_b) {
19
- switch (_b.label) {
20
- case 0: return [4 /*yield*/, utils_1.resolveCredentials()];
21
- case 1:
22
- credentials = (_b.sent()).credentials;
23
- _a = utils_1.resolveConfig(), appId = _a.appId, region = _a.region;
24
- return [4 /*yield*/, recordMessageEvent({
25
- appId: appId,
26
- credentials: credentials,
27
- event: event,
28
- message: message,
29
- region: region,
30
- })];
31
- case 2:
32
- _b.sent();
33
- callback === null || callback === void 0 ? void 0 : callback();
34
- return [2 /*return*/];
35
- }
36
- });
37
- }); };
16
+ const createMessageEventRecorder = (event, callback) => async (message) => {
17
+ const { credentials } = await (0, utils_1.resolveCredentials)();
18
+ const { appId, region } = (0, resolveConfig_1.resolveConfig)();
19
+ await recordMessageEvent({
20
+ appId,
21
+ credentials,
22
+ event,
23
+ message,
24
+ region,
25
+ });
26
+ callback?.();
38
27
  };
39
- var recordMessageEvent = function (_a) {
40
- var appId = _a.appId, credentials = _a.credentials, event = _a.event, message = _a.message, region = _a.region;
41
- return tslib_1.__awaiter(void 0, void 0, void 0, function () {
42
- var analyticsEvent;
43
- return tslib_1.__generator(this, function (_b) {
44
- analyticsEvent = getAnalyticsEvent_1.getAnalyticsEvent(message, event);
45
- if (!analyticsEvent) {
46
- logger.debug('A notification missing event information was not recorded');
47
- return [2 /*return*/];
48
- }
49
- return [2 /*return*/, pinpoint_1.record({
50
- appId: appId,
51
- category: 'PushNotification',
52
- channelType: getChannelType_1.getChannelType(),
53
- credentials: credentials,
54
- event: analyticsEvent,
55
- region: region,
56
- })];
57
- });
28
+ exports.createMessageEventRecorder = createMessageEventRecorder;
29
+ const recordMessageEvent = async ({ appId, credentials, event, message, region, }) => {
30
+ const analyticsEvent = (0, getAnalyticsEvent_1.getAnalyticsEvent)(message, event);
31
+ if (!analyticsEvent) {
32
+ logger.debug('A notification missing event information was not recorded');
33
+ return;
34
+ }
35
+ return (0, pinpoint_1.record)({
36
+ appId,
37
+ category: 'PushNotification',
38
+ channelType: (0, getChannelType_1.getChannelType)(),
39
+ credentials,
40
+ event: analyticsEvent,
41
+ region,
58
42
  });
59
43
  };
@@ -1,6 +1,7 @@
1
1
  import { PinpointAnalyticsEvent } from '@aws-amplify/core/internals/providers/pinpoint';
2
- import { PushNotificationEvent, PushNotificationMessage } from '../../../types';
2
+ import { PinpointMessageEvent } from '../types';
3
+ import { PushNotificationMessage } from '../../../types';
3
4
  /**
4
5
  * @internal
5
6
  */
6
- export declare const getAnalyticsEvent: ({ data }: PushNotificationMessage, event: PushNotificationEvent) => PinpointAnalyticsEvent;
7
+ export declare const getAnalyticsEvent: ({ data }: PushNotificationMessage, event: PinpointMessageEvent) => PinpointAnalyticsEvent | null;
@@ -2,28 +2,32 @@
2
2
  // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3
3
  // SPDX-License-Identifier: Apache-2.0
4
4
  Object.defineProperty(exports, "__esModule", { value: true });
5
- var ANDROID_CAMPAIGN_ACTIVITY_ID_KEY = 'pinpoint.campaign.campaign_activity_id';
6
- var ANDROID_CAMPAIGN_ID_KEY = 'pinpoint.campaign.campaign_id';
7
- var ANDROID_CAMPAIGN_TREATMENT_ID_KEY = 'pinpoint.campaign.treatment_id';
5
+ exports.getAnalyticsEvent = void 0;
6
+ const ANDROID_CAMPAIGN_ACTIVITY_ID_KEY = 'pinpoint.campaign.campaign_activity_id';
7
+ const ANDROID_CAMPAIGN_ID_KEY = 'pinpoint.campaign.campaign_id';
8
+ const ANDROID_CAMPAIGN_TREATMENT_ID_KEY = 'pinpoint.campaign.treatment_id';
8
9
  /**
9
10
  * @internal
10
11
  */
11
- exports.getAnalyticsEvent = function (_a, event) {
12
- var data = _a.data;
12
+ const getAnalyticsEvent = ({ data }, event) => {
13
13
  if (!data) {
14
14
  return null;
15
15
  }
16
- var eventAttributes = getAnalyticsEventAttributes(data);
16
+ const eventAttributes = getAnalyticsEventAttributes(data);
17
17
  if (!eventAttributes) {
18
18
  return null;
19
19
  }
20
- var source = eventAttributes.source, attributes = eventAttributes.attributes;
20
+ const { source, attributes } = eventAttributes;
21
21
  return {
22
- attributes: attributes,
23
- name: source + "." + event,
22
+ attributes,
23
+ name: `${source}.${event}`,
24
24
  };
25
25
  };
26
- var getAnalyticsEventAttributes = function (data) {
26
+ exports.getAnalyticsEvent = getAnalyticsEvent;
27
+ const getAnalyticsEventAttributes = (data) => {
28
+ if (!data) {
29
+ return;
30
+ }
27
31
  if (data.hasOwnProperty(ANDROID_CAMPAIGN_ID_KEY)) {
28
32
  return {
29
33
  source: '_campaign',
@@ -34,16 +38,16 @@ var getAnalyticsEventAttributes = function (data) {
34
38
  },
35
39
  };
36
40
  }
37
- var pinpoint = typeof data.pinpoint === 'string'
41
+ const pinpoint = typeof data.pinpoint === 'string'
38
42
  ? JSON.parse(data.pinpoint)
39
43
  : data.pinpoint;
40
- if (pinpoint === null || pinpoint === void 0 ? void 0 : pinpoint.campaign) {
44
+ if (pinpoint?.campaign) {
41
45
  return {
42
46
  source: '_campaign',
43
47
  attributes: pinpoint.campaign,
44
48
  };
45
49
  }
46
- if (pinpoint === null || pinpoint === void 0 ? void 0 : pinpoint.journey) {
50
+ if (pinpoint?.journey) {
47
51
  return {
48
52
  source: '_journey',
49
53
  attributes: pinpoint.journey,
@@ -1,4 +1,5 @@
1
+ import { ChannelType } from '../types';
1
2
  /**
2
3
  * @internal
3
4
  */
4
- export declare const getChannelType: () => "IN_APP" | "APNS" | "APNS_SANDBOX" | "GCM";
5
+ export declare const getChannelType: () => ChannelType;
@@ -2,22 +2,24 @@
2
2
  // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3
3
  // SPDX-License-Identifier: Apache-2.0
4
4
  Object.defineProperty(exports, "__esModule", { value: true });
5
- var utils_1 = require("@aws-amplify/core/internals/utils");
6
- var react_native_1 = require("@aws-amplify/react-native");
7
- var operatingSystem = react_native_1.getOperatingSystem();
8
- var isAndroid = operatingSystem === 'android';
9
- var isIos = operatingSystem === 'ios';
5
+ exports.getChannelType = void 0;
6
+ const utils_1 = require("@aws-amplify/core/internals/utils");
7
+ const react_native_1 = require("@aws-amplify/react-native");
8
+ const operatingSystem = (0, react_native_1.getOperatingSystem)();
9
+ const isAndroid = operatingSystem === 'android';
10
+ const isIos = operatingSystem === 'ios';
10
11
  /**
11
12
  * @internal
12
13
  */
13
- exports.getChannelType = function () {
14
+ const getChannelType = () => {
14
15
  if (isAndroid) {
15
16
  // FCM was previously known as GCM and continues to be the channel type in Pinpoint
16
17
  return 'GCM';
17
18
  }
18
19
  if (isIos) {
19
20
  // If building in debug mode, use the APNs sandbox
20
- return global['__DEV__'] ? 'APNS_SANDBOX' : 'APNS';
21
+ return __DEV__ ? 'APNS_SANDBOX' : 'APNS';
21
22
  }
22
23
  throw new utils_1.PlatformNotSupportedError();
23
24
  };
25
+ exports.getChannelType = getChannelType;
@@ -1,3 +1,4 @@
1
1
  export { createMessageEventRecorder } from './createMessageEventRecorder';
2
+ export { getAnalyticsEvent } from './getAnalyticsEvent';
2
3
  export { getChannelType } from './getChannelType';
3
- export { getPushNotificationUserAgentString } from './getPushNotificationUserAgentString';
4
+ export { resolveConfig } from './resolveConfig';
@@ -2,9 +2,12 @@
2
2
  // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3
3
  // SPDX-License-Identifier: Apache-2.0
4
4
  Object.defineProperty(exports, "__esModule", { value: true });
5
+ exports.resolveConfig = exports.getChannelType = exports.getAnalyticsEvent = exports.createMessageEventRecorder = void 0;
5
6
  var createMessageEventRecorder_1 = require("./createMessageEventRecorder");
6
- exports.createMessageEventRecorder = createMessageEventRecorder_1.createMessageEventRecorder;
7
+ Object.defineProperty(exports, "createMessageEventRecorder", { enumerable: true, get: function () { return createMessageEventRecorder_1.createMessageEventRecorder; } });
8
+ var getAnalyticsEvent_1 = require("./getAnalyticsEvent");
9
+ Object.defineProperty(exports, "getAnalyticsEvent", { enumerable: true, get: function () { return getAnalyticsEvent_1.getAnalyticsEvent; } });
7
10
  var getChannelType_1 = require("./getChannelType");
8
- exports.getChannelType = getChannelType_1.getChannelType;
9
- var getPushNotificationUserAgentString_1 = require("./getPushNotificationUserAgentString");
10
- exports.getPushNotificationUserAgentString = getPushNotificationUserAgentString_1.getPushNotificationUserAgentString;
11
+ Object.defineProperty(exports, "getChannelType", { enumerable: true, get: function () { return getChannelType_1.getChannelType; } });
12
+ var resolveConfig_1 = require("./resolveConfig");
13
+ Object.defineProperty(exports, "resolveConfig", { enumerable: true, get: function () { return resolveConfig_1.resolveConfig; } });
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3
+ // SPDX-License-Identifier: Apache-2.0
4
+ Object.defineProperty(exports, "__esModule", { value: true });
5
+ exports.resolveConfig = void 0;
6
+ const core_1 = require("@aws-amplify/core");
7
+ const errors_1 = require("../../../errors");
8
+ /**
9
+ * @internal
10
+ */
11
+ const resolveConfig = () => {
12
+ const { appId, region } = core_1.Amplify.getConfig().Notifications?.PushNotification?.Pinpoint ?? {};
13
+ (0, errors_1.assert)(!!appId, errors_1.PushNotificationValidationErrorCode.NoAppId);
14
+ (0, errors_1.assert)(!!region, errors_1.PushNotificationValidationErrorCode.NoRegion);
15
+ return { appId, region };
16
+ };
17
+ exports.resolveConfig = resolveConfig;
@@ -2,6 +2,7 @@
2
2
  // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3
3
  // SPDX-License-Identifier: Apache-2.0
4
4
  Object.defineProperty(exports, "__esModule", { value: true });
5
+ exports.PushNotificationErrorCode = void 0;
5
6
  var PushNotificationErrorCode;
6
7
  (function (PushNotificationErrorCode) {
7
8
  PushNotificationErrorCode["NotInitialized"] = "NotInitialized";
@@ -1,5 +1,6 @@
1
1
  export * from './errors';
2
2
  export * from './inputs';
3
+ export * from './module';
3
4
  export * from './options';
4
5
  export * from './outputs';
5
6
  export * from './pushNotifications';