@aws-amplify/notifications 2.0.1-server-generate-client.1e317a1.0 → 2.0.1-unstable.04fd02c.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
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@aws-amplify/notifications/in-app-messaging",
3
- "main": "../lib/inAppMessaging/providers/index.js",
4
- "browser": "../lib-esm/inAppMessaging/providers/index.js",
5
- "module": "../lib-esm/inAppMessaging/providers/index.js",
6
- "typings": "../lib-esm/inAppMessaging/providers/index.d.ts"
3
+ "main": "../lib/inAppMessaging/index.js",
4
+ "browser": "../lib-esm/inAppMessaging/index.js",
5
+ "module": "../lib-esm/inAppMessaging/index.js",
6
+ "typings": "../lib-esm/inAppMessaging/index.d.ts"
7
7
  }
@@ -2,55 +2,37 @@
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 eventListeners = {};
7
- exports.notifyEventListeners = function (type) {
8
- var args = [];
9
- for (var _i = 1; _i < arguments.length; _i++) {
10
- args[_i - 1] = arguments[_i];
11
- }
12
- var _a;
13
- (_a = eventListeners[type]) === null || _a === void 0 ? void 0 : _a.forEach(function (listener) {
14
- listener.handleEvent.apply(listener, tslib_1.__spread(args));
5
+ exports.addEventListener = exports.notifyEventListenersAndAwaitHandlers = exports.notifyEventListeners = void 0;
6
+ const eventListeners = {};
7
+ const notifyEventListeners = (type, ...args) => {
8
+ eventListeners[type]?.forEach(listener => {
9
+ listener.handleEvent(...args);
15
10
  });
16
11
  };
17
- exports.notifyEventListenersAndAwaitHandlers = function (type) {
18
- var args = [];
19
- for (var _i = 1; _i < arguments.length; _i++) {
20
- args[_i - 1] = arguments[_i];
12
+ exports.notifyEventListeners = notifyEventListeners;
13
+ const notifyEventListenersAndAwaitHandlers = (type, ...args) => Promise.all(Array.from(eventListeners[type] ?? []).map(async (listener) => {
14
+ try {
15
+ await listener.handleEvent(...args);
21
16
  }
22
- var _a;
23
- return Promise.all(Array.from((_a = eventListeners[type]) !== null && _a !== void 0 ? _a : []).map(function (listener) { return tslib_1.__awaiter(void 0, void 0, void 0, function () {
24
- var err_1;
25
- return tslib_1.__generator(this, function (_a) {
26
- switch (_a.label) {
27
- case 0:
28
- _a.trys.push([0, 2, , 3]);
29
- return [4 /*yield*/, listener.handleEvent.apply(listener, tslib_1.__spread(args))];
30
- case 1:
31
- _a.sent();
32
- return [3 /*break*/, 3];
33
- case 2:
34
- err_1 = _a.sent();
35
- throw err_1;
36
- case 3: return [2 /*return*/];
37
- }
38
- });
39
- }); }));
40
- };
41
- exports.addEventListener = function (type, handler) {
17
+ catch (err) {
18
+ throw err;
19
+ }
20
+ }));
21
+ exports.notifyEventListenersAndAwaitHandlers = notifyEventListenersAndAwaitHandlers;
22
+ const addEventListener = (type, handler) => {
42
23
  // If there is no listener set for the event type, just create it
43
24
  if (!eventListeners[type]) {
44
25
  eventListeners[type] = new Set();
45
26
  }
46
- var listener = {
27
+ const listener = {
47
28
  handleEvent: handler,
48
- remove: function () {
29
+ remove: () => {
49
30
  eventListeners[type].delete(listener);
50
31
  },
51
32
  };
52
33
  eventListeners[type].add(listener);
53
34
  return {
54
- remove: function () { return listener.remove(); },
35
+ remove: () => listener.remove(),
55
36
  };
56
37
  };
38
+ exports.addEventListener = addEventListener;
@@ -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
+ exports.notifyEventListenersAndAwaitHandlers = exports.notifyEventListeners = exports.addEventListener = void 0;
5
6
  var eventListeners_1 = require("./eventListeners");
6
- exports.addEventListener = eventListeners_1.addEventListener;
7
- exports.notifyEventListeners = eventListeners_1.notifyEventListeners;
8
- exports.notifyEventListenersAndAwaitHandlers = eventListeners_1.notifyEventListenersAndAwaitHandlers;
7
+ Object.defineProperty(exports, "addEventListener", { enumerable: true, get: function () { return eventListeners_1.addEventListener; } });
8
+ Object.defineProperty(exports, "notifyEventListeners", { enumerable: true, get: function () { return eventListeners_1.notifyEventListeners; } });
9
+ Object.defineProperty(exports, "notifyEventListenersAndAwaitHandlers", { enumerable: true, get: function () { return eventListeners_1.notifyEventListenersAndAwaitHandlers; } });
@@ -4,7 +4,7 @@ export interface EventListener<EventHandler extends Function> {
4
4
  handleEvent: EventHandler;
5
5
  remove: () => void;
6
6
  }
7
- export declare type EventType = InAppMessageInteractionEvent | PushNotificationEvent;
8
- export declare type EventListenerRemover = {
7
+ export type EventType = InAppMessageInteractionEvent | PushNotificationEvent;
8
+ export type EventListenerRemover = {
9
9
  remove: () => void;
10
10
  };
@@ -2,21 +2,18 @@
2
2
  // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3
3
  // SPDX-License-Identifier: Apache-2.0
4
4
  Object.defineProperty(exports, "__esModule", { value: true });
5
- var tslib_1 = require("tslib");
6
- var utils_1 = require("@aws-amplify/core/internals/utils");
5
+ exports.InAppMessagingError = void 0;
6
+ const utils_1 = require("@aws-amplify/core/internals/utils");
7
7
  /**
8
8
  * @internal
9
9
  */
10
- var InAppMessagingError = /** @class */ (function (_super) {
11
- tslib_1.__extends(InAppMessagingError, _super);
12
- function InAppMessagingError(params) {
13
- var _this = _super.call(this, params) || this;
10
+ class InAppMessagingError extends utils_1.AmplifyError {
11
+ constructor(params) {
12
+ super(params);
14
13
  // Hack for making the custom error class work when transpiled to es5
15
14
  // TODO: Delete the following 2 lines after we change the build target to >= es2015
16
- _this.constructor = InAppMessagingError;
17
- Object.setPrototypeOf(_this, InAppMessagingError.prototype);
18
- return _this;
15
+ this.constructor = InAppMessagingError;
16
+ Object.setPrototypeOf(this, InAppMessagingError.prototype);
19
17
  }
20
- return InAppMessagingError;
21
- }(utils_1.AmplifyError));
18
+ }
22
19
  exports.InAppMessagingError = InAppMessagingError;
@@ -2,8 +2,9 @@
2
2
  // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3
3
  // SPDX-License-Identifier: Apache-2.0
4
4
  Object.defineProperty(exports, "__esModule", { value: true });
5
- var utils_1 = require("@aws-amplify/core/internals/utils");
6
- var InAppMessagingError_1 = require("./InAppMessagingError");
5
+ exports.assertServiceError = void 0;
6
+ const utils_1 = require("@aws-amplify/core/internals/utils");
7
+ const InAppMessagingError_1 = require("./InAppMessagingError");
7
8
  function assertServiceError(error) {
8
9
  if (!error ||
9
10
  error.name === 'Error' ||
@@ -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
- var InAppMessagingError_1 = require("./InAppMessagingError");
6
- var validation_1 = require("./validation");
5
+ exports.assertValidationError = void 0;
6
+ const InAppMessagingError_1 = require("./InAppMessagingError");
7
+ const validation_1 = require("./validation");
7
8
  /**
8
9
  * @internal
9
10
  */
10
11
  function assertValidationError(assertion, name) {
11
- var _a = validation_1.validationErrorMap[name], message = _a.message, recoverySuggestion = _a.recoverySuggestion;
12
+ const { message, recoverySuggestion } = validation_1.validationErrorMap[name];
12
13
  if (!assertion) {
13
- throw new InAppMessagingError_1.InAppMessagingError({ name: name, message: message, recoverySuggestion: recoverySuggestion });
14
+ throw new InAppMessagingError_1.InAppMessagingError({ name, message, recoverySuggestion });
14
15
  }
15
16
  }
16
17
  exports.assertValidationError = assertValidationError;
@@ -2,12 +2,13 @@
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.validationErrorMap = exports.InAppMessagingValidationErrorCode = exports.assertServiceError = exports.assertValidationError = exports.InAppMessagingError = void 0;
5
6
  var InAppMessagingError_1 = require("./InAppMessagingError");
6
- exports.InAppMessagingError = InAppMessagingError_1.InAppMessagingError;
7
+ Object.defineProperty(exports, "InAppMessagingError", { enumerable: true, get: function () { return InAppMessagingError_1.InAppMessagingError; } });
7
8
  var assertValidationError_1 = require("./assertValidationError");
8
- exports.assertValidationError = assertValidationError_1.assertValidationError;
9
+ Object.defineProperty(exports, "assertValidationError", { enumerable: true, get: function () { return assertValidationError_1.assertValidationError; } });
9
10
  var assertServiceError_1 = require("./assertServiceError");
10
- exports.assertServiceError = assertServiceError_1.assertServiceError;
11
+ Object.defineProperty(exports, "assertServiceError", { enumerable: true, get: function () { return assertServiceError_1.assertServiceError; } });
11
12
  var validation_1 = require("./validation");
12
- exports.InAppMessagingValidationErrorCode = validation_1.InAppMessagingValidationErrorCode;
13
- exports.validationErrorMap = validation_1.validationErrorMap;
13
+ Object.defineProperty(exports, "InAppMessagingValidationErrorCode", { enumerable: true, get: function () { return validation_1.InAppMessagingValidationErrorCode; } });
14
+ Object.defineProperty(exports, "validationErrorMap", { enumerable: true, get: function () { return validation_1.validationErrorMap; } });
@@ -1,8 +1,8 @@
1
1
  "use strict";
2
2
  // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3
3
  // SPDX-License-Identifier: Apache-2.0
4
- var _a;
5
4
  Object.defineProperty(exports, "__esModule", { value: true });
5
+ exports.validationErrorMap = exports.InAppMessagingValidationErrorCode = void 0;
6
6
  var InAppMessagingValidationErrorCode;
7
7
  (function (InAppMessagingValidationErrorCode) {
8
8
  InAppMessagingValidationErrorCode["NoAppId"] = "NoAppId";
@@ -10,18 +10,18 @@ var InAppMessagingValidationErrorCode;
10
10
  InAppMessagingValidationErrorCode["NoRegion"] = "NoRegion";
11
11
  InAppMessagingValidationErrorCode["NotInitialized"] = "NotInitialized";
12
12
  })(InAppMessagingValidationErrorCode = exports.InAppMessagingValidationErrorCode || (exports.InAppMessagingValidationErrorCode = {}));
13
- exports.validationErrorMap = (_a = {},
14
- _a[InAppMessagingValidationErrorCode.NoAppId] = {
13
+ exports.validationErrorMap = {
14
+ [InAppMessagingValidationErrorCode.NoAppId]: {
15
15
  message: 'Missing application id.',
16
16
  },
17
- _a[InAppMessagingValidationErrorCode.NoCredentials] = {
17
+ [InAppMessagingValidationErrorCode.NoCredentials]: {
18
18
  message: 'Credentials should not be empty.',
19
19
  },
20
- _a[InAppMessagingValidationErrorCode.NoRegion] = {
20
+ [InAppMessagingValidationErrorCode.NoRegion]: {
21
21
  message: 'Missing region.',
22
22
  },
23
- _a[InAppMessagingValidationErrorCode.NotInitialized] = {
23
+ [InAppMessagingValidationErrorCode.NotInitialized]: {
24
24
  message: 'In-app messaging has not been initialized.',
25
25
  recoverySuggestion: 'Please make sure to first call `initializePushNotifications`.',
26
26
  },
27
- _a);
27
+ };
@@ -1 +1,2 @@
1
- export { identifyUser, syncMessages, dispatchEvent, setConflictHandler, initializeInAppMessaging, onMessageReceived, onMessageDisplayed, onMessageDismissed, onMessageActionTaken, notifyMessageInteraction, IdentifyUserInput, DispatchEventInput, SetConflictHandlerInput, OnMessageActionTakenInput, OnMessageDismissedInput, OnMessageDisplayedInput, OnMessageReceivedInput, NotifyMessageInteractionInput, OnMessageReceivedOutput, OnMessageActionTakenOutput, OnMessageDismissedOutput, OnMessageDisplayedOutput, } from './providers/pinpoint';
1
+ export { identifyUser, syncMessages, dispatchEvent, setConflictHandler, initializeInAppMessaging, onMessageReceived, onMessageDisplayed, onMessageDismissed, onMessageActionTaken, notifyMessageInteraction, clearMessages, IdentifyUserInput, DispatchEventInput, SetConflictHandlerInput, OnMessageActionTakenInput, OnMessageDismissedInput, OnMessageDisplayedInput, OnMessageReceivedInput, NotifyMessageInteractionInput, OnMessageReceivedOutput, OnMessageActionTakenOutput, OnMessageDismissedOutput, OnMessageDisplayedOutput, } from './providers/pinpoint';
2
+ export { InAppMessage, InAppMessageAction, InAppMessageContent, InAppMessageLayout, InAppMessageTextAlign, InAppMessageButton, InAppMessageImage, InAppMessageStyle, } from './types';
@@ -2,14 +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.clearMessages = exports.notifyMessageInteraction = exports.onMessageActionTaken = exports.onMessageDismissed = exports.onMessageDisplayed = exports.onMessageReceived = exports.initializeInAppMessaging = exports.setConflictHandler = exports.dispatchEvent = exports.syncMessages = exports.identifyUser = void 0;
5
6
  var pinpoint_1 = require("./providers/pinpoint");
6
- exports.identifyUser = pinpoint_1.identifyUser;
7
- exports.syncMessages = pinpoint_1.syncMessages;
8
- exports.dispatchEvent = pinpoint_1.dispatchEvent;
9
- exports.setConflictHandler = pinpoint_1.setConflictHandler;
10
- exports.initializeInAppMessaging = pinpoint_1.initializeInAppMessaging;
11
- exports.onMessageReceived = pinpoint_1.onMessageReceived;
12
- exports.onMessageDisplayed = pinpoint_1.onMessageDisplayed;
13
- exports.onMessageDismissed = pinpoint_1.onMessageDismissed;
14
- exports.onMessageActionTaken = pinpoint_1.onMessageActionTaken;
15
- exports.notifyMessageInteraction = pinpoint_1.notifyMessageInteraction;
7
+ Object.defineProperty(exports, "identifyUser", { enumerable: true, get: function () { return pinpoint_1.identifyUser; } });
8
+ Object.defineProperty(exports, "syncMessages", { enumerable: true, get: function () { return pinpoint_1.syncMessages; } });
9
+ Object.defineProperty(exports, "dispatchEvent", { enumerable: true, get: function () { return pinpoint_1.dispatchEvent; } });
10
+ Object.defineProperty(exports, "setConflictHandler", { enumerable: true, get: function () { return pinpoint_1.setConflictHandler; } });
11
+ Object.defineProperty(exports, "initializeInAppMessaging", { enumerable: true, get: function () { return pinpoint_1.initializeInAppMessaging; } });
12
+ Object.defineProperty(exports, "onMessageReceived", { enumerable: true, get: function () { return pinpoint_1.onMessageReceived; } });
13
+ Object.defineProperty(exports, "onMessageDisplayed", { enumerable: true, get: function () { return pinpoint_1.onMessageDisplayed; } });
14
+ Object.defineProperty(exports, "onMessageDismissed", { enumerable: true, get: function () { return pinpoint_1.onMessageDismissed; } });
15
+ Object.defineProperty(exports, "onMessageActionTaken", { enumerable: true, get: function () { return pinpoint_1.onMessageActionTaken; } });
16
+ Object.defineProperty(exports, "notifyMessageInteraction", { enumerable: true, get: function () { return pinpoint_1.notifyMessageInteraction; } });
17
+ Object.defineProperty(exports, "clearMessages", { enumerable: true, get: function () { return pinpoint_1.clearMessages; } });
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Clear locally cached messages.
3
+ *
4
+ * @throws validation: {@link InAppMessagingValidationErrorCode} - Thrown if In App messaging hasn't been initialized.
5
+ * @returns A promise that will resolve when the operation is complete.
6
+ * @example
7
+ * ```ts
8
+ * // Clear locally cached messages.
9
+ * await clearMessages();
10
+ *
11
+ * ```
12
+ */
13
+ export declare function clearMessages(): Promise<void>;
@@ -0,0 +1,26 @@
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.clearMessages = void 0;
6
+ const core_1 = require("@aws-amplify/core");
7
+ const utils_1 = require("../utils");
8
+ const utils_2 = require("../../../utils");
9
+ /**
10
+ * Clear locally cached messages.
11
+ *
12
+ * @throws validation: {@link InAppMessagingValidationErrorCode} - Thrown if In App messaging hasn't been initialized.
13
+ * @returns A promise that will resolve when the operation is complete.
14
+ * @example
15
+ * ```ts
16
+ * // Clear locally cached messages.
17
+ * await clearMessages();
18
+ *
19
+ * ```
20
+ */
21
+ async function clearMessages() {
22
+ (0, utils_2.assertIsInitialized)();
23
+ const key = `${utils_1.PINPOINT_KEY_PREFIX}${utils_1.STORAGE_KEY_SUFFIX}`;
24
+ return await core_1.defaultStorage.removeItem(key);
25
+ }
26
+ exports.clearMessages = clearMessages;
@@ -1,15 +1,18 @@
1
1
  "use strict";
2
2
  // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3
3
  // SPDX-License-Identifier: Apache-2.0
4
+ var __importDefault = (this && this.__importDefault) || function (mod) {
5
+ return (mod && mod.__esModule) ? mod : { "default": mod };
6
+ };
4
7
  Object.defineProperty(exports, "__esModule", { value: true });
5
- var tslib_1 = require("tslib");
6
- var utils_1 = require("../utils");
7
- var flatten_1 = tslib_1.__importDefault(require("lodash/flatten"));
8
- var core_1 = require("@aws-amplify/core");
9
- var eventListeners_1 = require("../../../../eventListeners");
10
- var errors_1 = require("../../../errors");
11
- var setConflictHandler_1 = require("./setConflictHandler");
12
- var utils_2 = require("../../../utils");
8
+ exports.dispatchEvent = void 0;
9
+ const utils_1 = require("../utils");
10
+ const flatten_1 = __importDefault(require("lodash/flatten"));
11
+ const core_1 = require("@aws-amplify/core");
12
+ const eventListeners_1 = require("../../../../eventListeners");
13
+ const errors_1 = require("../../../errors");
14
+ const setConflictHandler_1 = require("./setConflictHandler");
15
+ const utils_2 = require("../../../utils");
13
16
  /**
14
17
  * Triggers an In-App message to be displayed. Use this after your campaigns have been synced to the device using
15
18
  * {@link syncMessages}. Based on the messages synced and the event passed to this API, it triggers the display
@@ -34,35 +37,20 @@ var utils_2 = require("../../../utils");
34
37
  * await dispatchEvent({ name: 'test_event' });
35
38
  * ```
36
39
  */
37
- function dispatchEvent(input) {
38
- return tslib_1.__awaiter(this, void 0, void 0, function () {
39
- var key, cachedMessages, messages, flattenedMessages, error_1;
40
- return tslib_1.__generator(this, function (_a) {
41
- switch (_a.label) {
42
- case 0:
43
- utils_2.assertIsInitialized();
44
- _a.label = 1;
45
- case 1:
46
- _a.trys.push([1, 4, , 5]);
47
- key = "" + utils_1.PINPOINT_KEY_PREFIX + utils_1.STORAGE_KEY_SUFFIX;
48
- return [4 /*yield*/, core_1.defaultStorage.getItem(key)];
49
- case 2:
50
- cachedMessages = _a.sent();
51
- return [4 /*yield*/, utils_1.processInAppMessages(cachedMessages ? JSON.parse(cachedMessages) : [], input)];
52
- case 3:
53
- messages = _a.sent();
54
- flattenedMessages = flatten_1.default(messages);
55
- if (flattenedMessages.length > 0) {
56
- eventListeners_1.notifyEventListeners('messageReceived', setConflictHandler_1.conflictHandler(flattenedMessages));
57
- }
58
- return [3 /*break*/, 5];
59
- case 4:
60
- error_1 = _a.sent();
61
- errors_1.assertServiceError(error_1);
62
- throw error_1;
63
- case 5: return [2 /*return*/];
64
- }
65
- });
66
- });
40
+ async function dispatchEvent(input) {
41
+ (0, utils_2.assertIsInitialized)();
42
+ try {
43
+ const key = `${utils_1.PINPOINT_KEY_PREFIX}${utils_1.STORAGE_KEY_SUFFIX}`;
44
+ const cachedMessages = await core_1.defaultStorage.getItem(key);
45
+ const messages = await (0, utils_1.processInAppMessages)(cachedMessages ? JSON.parse(cachedMessages) : [], input);
46
+ const flattenedMessages = (0, flatten_1.default)(messages);
47
+ if (flattenedMessages.length > 0) {
48
+ (0, eventListeners_1.notifyEventListeners)('messageReceived', (0, setConflictHandler_1.conflictHandler)(flattenedMessages));
49
+ }
50
+ }
51
+ catch (error) {
52
+ (0, errors_1.assertServiceError)(error);
53
+ throw error;
54
+ }
67
55
  }
68
56
  exports.dispatchEvent = dispatchEvent;
@@ -1,3 +1,4 @@
1
+ import { IdentifyUserInput } from '../types';
1
2
  /**
2
3
  * Sends information about a user to Pinpoint. Sending user information allows you to associate a user to their user
3
4
  * profile and activities or actions in your application. Activity can be tracked across devices & platforms by using
@@ -47,4 +48,4 @@
47
48
  * },
48
49
  * });
49
50
  */
50
- export declare const identifyUser: ({ userId, userProfile, options, }: import("../../../types").InAppMessagingIdentifyUserInput<import("@aws-amplify/core/lib-esm/providers/pinpoint").PinpointServiceOptions>) => Promise<void>;
51
+ export declare const identifyUser: ({ userId, userProfile, options, }: IdentifyUserInput) => Promise<void>;
@@ -2,11 +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 tslib_1 = require("tslib");
6
- var utils_1 = require("@aws-amplify/core/internals/utils");
7
- var pinpoint_1 = require("@aws-amplify/core/internals/providers/pinpoint");
8
- var utils_2 = require("../utils");
9
- var utils_3 = require("../../../utils");
5
+ exports.identifyUser = void 0;
6
+ const utils_1 = require("@aws-amplify/core/internals/utils");
7
+ const pinpoint_1 = require("@aws-amplify/core/internals/providers/pinpoint");
8
+ const utils_2 = require("../utils");
9
+ const utils_3 = require("../../../utils");
10
10
  /**
11
11
  * Sends information about a user to Pinpoint. Sending user information allows you to associate a user to their user
12
12
  * profile and activities or actions in your application. Activity can be tracked across devices & platforms by using
@@ -56,35 +56,24 @@ var utils_3 = require("../../../utils");
56
56
  * },
57
57
  * });
58
58
  */
59
- exports.identifyUser = function (_a) {
60
- var userId = _a.userId, userProfile = _a.userProfile, options = _a.options;
61
- return tslib_1.__awaiter(void 0, void 0, void 0, function () {
62
- var _b, credentials, identityId, _c, appId, region, _d, address, optOut, userAttributes;
63
- return tslib_1.__generator(this, function (_e) {
64
- switch (_e.label) {
65
- case 0:
66
- utils_3.assertIsInitialized();
67
- return [4 /*yield*/, utils_2.resolveCredentials()];
68
- case 1:
69
- _b = _e.sent(), credentials = _b.credentials, identityId = _b.identityId;
70
- _c = utils_2.resolveConfig(), appId = _c.appId, region = _c.region;
71
- _d = options !== null && options !== void 0 ? options : {}, address = _d.address, optOut = _d.optOut, userAttributes = _d.userAttributes;
72
- pinpoint_1.updateEndpoint({
73
- address: address,
74
- channelType: utils_2.CHANNEL_TYPE,
75
- optOut: optOut,
76
- appId: appId,
77
- category: utils_2.CATEGORY,
78
- credentials: credentials,
79
- identityId: identityId,
80
- region: region,
81
- userAttributes: userAttributes,
82
- userId: userId,
83
- userProfile: userProfile,
84
- userAgentValue: utils_2.getInAppMessagingUserAgentString(utils_1.InAppMessagingAction.IdentifyUser),
85
- });
86
- return [2 /*return*/];
87
- }
88
- });
59
+ const identifyUser = async ({ userId, userProfile, options, }) => {
60
+ (0, utils_3.assertIsInitialized)();
61
+ const { credentials, identityId } = await (0, utils_2.resolveCredentials)();
62
+ const { appId, region } = (0, utils_2.resolveConfig)();
63
+ const { address, optOut, userAttributes } = options ?? {};
64
+ (0, pinpoint_1.updateEndpoint)({
65
+ address,
66
+ channelType: utils_2.CHANNEL_TYPE,
67
+ optOut,
68
+ appId,
69
+ category: utils_2.CATEGORY,
70
+ credentials,
71
+ identityId,
72
+ region,
73
+ userAttributes,
74
+ userId,
75
+ userProfile,
76
+ userAgentValue: (0, utils_2.getInAppMessagingUserAgentString)(utils_1.InAppMessagingAction.IdentifyUser),
89
77
  });
90
78
  };
79
+ exports.identifyUser = identifyUser;
@@ -8,3 +8,4 @@ export { onMessageDismissed } from './onMessageDismissed';
8
8
  export { onMessageDisplayed } from './onMessageDisplayed';
9
9
  export { onMessageActionTaken } from './onMessageActionTaken';
10
10
  export { notifyMessageInteraction } from './notifyMessageInteraction';
11
+ export { clearMessages } from './clearMessages';
@@ -2,23 +2,26 @@
2
2
  // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3
3
  // SPDX-License-Identifier: Apache-2.0
4
4
  Object.defineProperty(exports, "__esModule", { value: true });
5
+ exports.clearMessages = exports.notifyMessageInteraction = exports.onMessageActionTaken = exports.onMessageDisplayed = exports.onMessageDismissed = exports.onMessageReceived = exports.initializeInAppMessaging = exports.setConflictHandler = exports.dispatchEvent = exports.syncMessages = exports.identifyUser = void 0;
5
6
  var identifyUser_1 = require("./identifyUser");
6
- exports.identifyUser = identifyUser_1.identifyUser;
7
+ Object.defineProperty(exports, "identifyUser", { enumerable: true, get: function () { return identifyUser_1.identifyUser; } });
7
8
  var syncMessages_1 = require("./syncMessages");
8
- exports.syncMessages = syncMessages_1.syncMessages;
9
+ Object.defineProperty(exports, "syncMessages", { enumerable: true, get: function () { return syncMessages_1.syncMessages; } });
9
10
  var dispatchEvent_1 = require("./dispatchEvent");
10
- exports.dispatchEvent = dispatchEvent_1.dispatchEvent;
11
+ Object.defineProperty(exports, "dispatchEvent", { enumerable: true, get: function () { return dispatchEvent_1.dispatchEvent; } });
11
12
  var setConflictHandler_1 = require("./setConflictHandler");
12
- exports.setConflictHandler = setConflictHandler_1.setConflictHandler;
13
+ Object.defineProperty(exports, "setConflictHandler", { enumerable: true, get: function () { return setConflictHandler_1.setConflictHandler; } });
13
14
  var initializeInAppMessaging_1 = require("./initializeInAppMessaging");
14
- exports.initializeInAppMessaging = initializeInAppMessaging_1.initializeInAppMessaging;
15
+ Object.defineProperty(exports, "initializeInAppMessaging", { enumerable: true, get: function () { return initializeInAppMessaging_1.initializeInAppMessaging; } });
15
16
  var onMessageReceived_1 = require("./onMessageReceived");
16
- exports.onMessageReceived = onMessageReceived_1.onMessageReceived;
17
+ Object.defineProperty(exports, "onMessageReceived", { enumerable: true, get: function () { return onMessageReceived_1.onMessageReceived; } });
17
18
  var onMessageDismissed_1 = require("./onMessageDismissed");
18
- exports.onMessageDismissed = onMessageDismissed_1.onMessageDismissed;
19
+ Object.defineProperty(exports, "onMessageDismissed", { enumerable: true, get: function () { return onMessageDismissed_1.onMessageDismissed; } });
19
20
  var onMessageDisplayed_1 = require("./onMessageDisplayed");
20
- exports.onMessageDisplayed = onMessageDisplayed_1.onMessageDisplayed;
21
+ Object.defineProperty(exports, "onMessageDisplayed", { enumerable: true, get: function () { return onMessageDisplayed_1.onMessageDisplayed; } });
21
22
  var onMessageActionTaken_1 = require("./onMessageActionTaken");
22
- exports.onMessageActionTaken = onMessageActionTaken_1.onMessageActionTaken;
23
+ Object.defineProperty(exports, "onMessageActionTaken", { enumerable: true, get: function () { return onMessageActionTaken_1.onMessageActionTaken; } });
23
24
  var notifyMessageInteraction_1 = require("./notifyMessageInteraction");
24
- exports.notifyMessageInteraction = notifyMessageInteraction_1.notifyMessageInteraction;
25
+ Object.defineProperty(exports, "notifyMessageInteraction", { enumerable: true, get: function () { return notifyMessageInteraction_1.notifyMessageInteraction; } });
26
+ var clearMessages_1 = require("./clearMessages");
27
+ Object.defineProperty(exports, "clearMessages", { enumerable: true, get: function () { return clearMessages_1.clearMessages; } });
@@ -2,14 +2,15 @@
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 eventListeners_1 = require("../../../../eventListeners");
7
- var helpers_1 = require("../utils/helpers");
8
- var types_1 = require("../types");
9
- var core_1 = require("@aws-amplify/core");
10
- var dispatchEvent_1 = require("./dispatchEvent");
11
- var utils_2 = require("../utils");
12
- var utils_3 = require("../../../utils");
5
+ exports.initializeInAppMessaging = void 0;
6
+ const utils_1 = require("@aws-amplify/core/internals/utils");
7
+ const eventListeners_1 = require("../../../../eventListeners");
8
+ const helpers_1 = require("../utils/helpers");
9
+ const types_1 = require("../types");
10
+ const core_1 = require("@aws-amplify/core");
11
+ const dispatchEvent_1 = require("./dispatchEvent");
12
+ const utils_2 = require("../utils");
13
+ const utils_3 = require("../../../utils");
13
14
  /**
14
15
  * Initialize and set up in-app messaging category. This API needs to be called to enable other InAppMessaging APIs.
15
16
  *
@@ -22,33 +23,32 @@ var utils_3 = require("../../../utils");
22
23
  * ```
23
24
  */
24
25
  function initializeInAppMessaging() {
25
- if (utils_3.isInitialized()) {
26
+ if ((0, utils_3.isInitialized)()) {
26
27
  return;
27
28
  }
28
29
  // register with the session listener
29
30
  utils_1.sessionListener.addStateChangeListener(utils_2.sessionStateChangeHandler, true);
30
31
  // wire up default Pinpoint message event handling
31
- eventListeners_1.addEventListener('messageDisplayed', function (message) {
32
- helpers_1.recordAnalyticsEvent(types_1.PinpointMessageEvent.MESSAGE_DISPLAYED, message);
33
- utils_2.incrementMessageCounts(message.id);
32
+ (0, eventListeners_1.addEventListener)('messageDisplayed', (message) => {
33
+ (0, helpers_1.recordAnalyticsEvent)(types_1.PinpointMessageEvent.MESSAGE_DISPLAYED, message);
34
+ (0, utils_2.incrementMessageCounts)(message.id);
34
35
  });
35
- eventListeners_1.addEventListener('messageDismissed', function (message) {
36
- helpers_1.recordAnalyticsEvent(types_1.PinpointMessageEvent.MESSAGE_DISMISSED, message);
36
+ (0, eventListeners_1.addEventListener)('messageDismissed', (message) => {
37
+ (0, helpers_1.recordAnalyticsEvent)(types_1.PinpointMessageEvent.MESSAGE_DISMISSED, message);
37
38
  });
38
- eventListeners_1.addEventListener('messageActionTaken', function (message) {
39
- helpers_1.recordAnalyticsEvent(types_1.PinpointMessageEvent.MESSAGE_ACTION_TAKEN, message);
39
+ (0, eventListeners_1.addEventListener)('messageActionTaken', (message) => {
40
+ (0, helpers_1.recordAnalyticsEvent)(types_1.PinpointMessageEvent.MESSAGE_ACTION_TAKEN, message);
40
41
  });
41
42
  // listen to analytics hub events
42
43
  core_1.Hub.listen('analytics', analyticsListener);
43
- utils_3.initialize();
44
+ (0, utils_3.initialize)();
44
45
  }
45
46
  exports.initializeInAppMessaging = initializeInAppMessaging;
46
- function analyticsListener(_a) {
47
- var payload = _a.payload;
48
- var event = payload.event, data = payload.data;
47
+ function analyticsListener({ payload, }) {
48
+ const { event, data } = payload;
49
49
  switch (event) {
50
50
  case 'record': {
51
- dispatchEvent_1.dispatchEvent(data);
51
+ (0, dispatchEvent_1.dispatchEvent)(data);
52
52
  break;
53
53
  }
54
54
  default:
@@ -2,8 +2,9 @@
2
2
  // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3
3
  // SPDX-License-Identifier: Apache-2.0
4
4
  Object.defineProperty(exports, "__esModule", { value: true });
5
- var eventListeners_1 = require("../../../../eventListeners");
6
- var utils_1 = require("../../../utils");
5
+ exports.notifyMessageInteraction = void 0;
6
+ const eventListeners_1 = require("../../../../eventListeners");
7
+ const utils_1 = require("../../../utils");
7
8
  /**
8
9
  * Notifies the respective listener of the specified type with the message given.
9
10
  *
@@ -18,9 +19,8 @@ var utils_1 = require("../../../utils");
18
19
  * });
19
20
  * ```
20
21
  */
21
- function notifyMessageInteraction(_a) {
22
- var type = _a.type, message = _a.message;
23
- utils_1.assertIsInitialized();
24
- eventListeners_1.notifyEventListeners(type, message);
22
+ function notifyMessageInteraction({ type, message, }) {
23
+ (0, utils_1.assertIsInitialized)();
24
+ (0, eventListeners_1.notifyEventListeners)(type, message);
25
25
  }
26
26
  exports.notifyMessageInteraction = notifyMessageInteraction;