@aws-amplify/notifications 1.6.6-unstable.7762f1a.0 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (691) hide show
  1. package/README.md +3 -0
  2. package/in-app-messaging/package.json +7 -0
  3. package/in-app-messaging/pinpoint/package.json +7 -0
  4. package/lib/{common/eventListeners/index.d.ts → eventListeners/eventListeners.d.ts} +2 -2
  5. package/lib/eventListeners/eventListeners.js +38 -0
  6. package/lib/eventListeners/index.d.ts +2 -0
  7. package/lib/eventListeners/index.js +9 -0
  8. package/lib/eventListeners/types.d.ts +10 -0
  9. package/lib/{InAppMessaging/SessionTracker → eventListeners}/types.js +0 -1
  10. package/lib/inAppMessaging/errors/InAppMessagingError.d.ts +7 -0
  11. package/lib/inAppMessaging/errors/InAppMessagingError.js +19 -0
  12. package/lib/inAppMessaging/errors/assertServiceError.d.ts +2 -0
  13. package/lib/inAppMessaging/errors/assertServiceError.js +19 -0
  14. package/lib/inAppMessaging/errors/assertValidationError.d.ts +5 -0
  15. package/lib/inAppMessaging/errors/assertValidationError.js +17 -0
  16. package/lib/inAppMessaging/errors/index.d.ts +4 -0
  17. package/lib/inAppMessaging/errors/index.js +14 -0
  18. package/lib/inAppMessaging/errors/validation.d.ts +8 -0
  19. package/lib/inAppMessaging/errors/validation.js +27 -0
  20. package/lib/inAppMessaging/index.d.ts +2 -0
  21. package/lib/inAppMessaging/index.js +17 -0
  22. package/lib/inAppMessaging/providers/pinpoint/apis/clearMessages.d.ts +13 -0
  23. package/lib/inAppMessaging/providers/pinpoint/apis/clearMessages.js +26 -0
  24. package/lib/inAppMessaging/providers/pinpoint/apis/dispatchEvent.d.ts +26 -0
  25. package/lib/inAppMessaging/providers/pinpoint/apis/dispatchEvent.js +56 -0
  26. package/lib/inAppMessaging/providers/pinpoint/apis/identifyUser.d.ts +51 -0
  27. package/lib/inAppMessaging/providers/pinpoint/apis/identifyUser.js +79 -0
  28. package/lib/inAppMessaging/providers/pinpoint/apis/index.d.ts +11 -0
  29. package/lib/inAppMessaging/providers/pinpoint/apis/index.js +27 -0
  30. package/lib/inAppMessaging/providers/pinpoint/apis/initializeInAppMessaging.d.ts +12 -0
  31. package/lib/inAppMessaging/providers/pinpoint/apis/initializeInAppMessaging.js +57 -0
  32. package/lib/inAppMessaging/providers/pinpoint/apis/notifyMessageInteraction.d.ts +16 -0
  33. package/lib/inAppMessaging/providers/pinpoint/apis/notifyMessageInteraction.js +26 -0
  34. package/lib/inAppMessaging/providers/pinpoint/apis/onMessageActionTaken.d.ts +18 -0
  35. package/lib/inAppMessaging/providers/pinpoint/apis/onMessageActionTaken.js +27 -0
  36. package/lib/inAppMessaging/providers/pinpoint/apis/onMessageDismissed.d.ts +18 -0
  37. package/lib/inAppMessaging/providers/pinpoint/apis/onMessageDismissed.js +27 -0
  38. package/lib/inAppMessaging/providers/pinpoint/apis/onMessageDisplayed.d.ts +18 -0
  39. package/lib/inAppMessaging/providers/pinpoint/apis/onMessageDisplayed.js +27 -0
  40. package/lib/inAppMessaging/providers/pinpoint/apis/onMessageReceived.d.ts +18 -0
  41. package/lib/inAppMessaging/providers/pinpoint/apis/onMessageReceived.js +27 -0
  42. package/lib/inAppMessaging/providers/pinpoint/apis/setConflictHandler.d.ts +32 -0
  43. package/lib/inAppMessaging/providers/pinpoint/apis/setConflictHandler.js +65 -0
  44. package/lib/inAppMessaging/providers/pinpoint/apis/syncMessages.d.ts +16 -0
  45. package/lib/inAppMessaging/providers/pinpoint/apis/syncMessages.js +69 -0
  46. package/lib/inAppMessaging/providers/pinpoint/index.d.ts +2 -0
  47. package/lib/inAppMessaging/providers/pinpoint/index.js +17 -0
  48. package/lib/inAppMessaging/providers/pinpoint/types/index.d.ts +4 -0
  49. package/lib/{InAppMessaging → inAppMessaging/providers/pinpoint/types}/index.js +2 -4
  50. package/lib/inAppMessaging/providers/pinpoint/types/inputs.d.ts +37 -0
  51. package/lib/{PushNotification/Platform/types.js → inAppMessaging/providers/pinpoint/types/inputs.js} +0 -1
  52. package/lib/inAppMessaging/providers/pinpoint/types/options.d.ts +5 -0
  53. package/lib/{common/AWSPinpointProviderCommon/types.js → inAppMessaging/providers/pinpoint/types/options.js} +0 -1
  54. package/lib/inAppMessaging/providers/pinpoint/types/outputs.d.ts +17 -0
  55. package/lib/{common/eventListeners/types.js → inAppMessaging/providers/pinpoint/types/outputs.js} +0 -1
  56. package/lib/inAppMessaging/providers/pinpoint/types/types.d.ts +19 -0
  57. package/lib/inAppMessaging/providers/pinpoint/types/types.js +11 -0
  58. package/lib/inAppMessaging/providers/pinpoint/utils/constants.d.ts +4 -0
  59. package/lib/inAppMessaging/providers/pinpoint/utils/constants.js +9 -0
  60. package/lib/{InAppMessaging/Providers/AWSPinpointProvider/utils.d.ts → inAppMessaging/providers/pinpoint/utils/helpers.d.ts} +6 -7
  61. package/lib/inAppMessaging/providers/pinpoint/utils/helpers.js +264 -0
  62. package/lib/inAppMessaging/providers/pinpoint/utils/index.d.ts +5 -0
  63. package/lib/inAppMessaging/providers/pinpoint/utils/index.js +20 -0
  64. package/lib/inAppMessaging/providers/pinpoint/utils/messageProcessingHelpers.d.ts +6 -0
  65. package/lib/inAppMessaging/providers/pinpoint/utils/messageProcessingHelpers.js +169 -0
  66. package/lib/inAppMessaging/providers/pinpoint/utils/resolveConfig.d.ts +7 -0
  67. package/lib/inAppMessaging/providers/pinpoint/utils/resolveConfig.js +17 -0
  68. package/lib/inAppMessaging/providers/pinpoint/utils/resolveCredentials.d.ts +7 -0
  69. package/lib/inAppMessaging/providers/pinpoint/utils/resolveCredentials.js +16 -0
  70. package/lib/inAppMessaging/providers/pinpoint/utils/userAgent.d.ts +4 -0
  71. package/lib/inAppMessaging/providers/pinpoint/utils/userAgent.js +20 -0
  72. package/lib/inAppMessaging/types/event.d.ts +6 -0
  73. package/lib/inAppMessaging/types/event.js +4 -0
  74. package/lib/inAppMessaging/types/index.d.ts +4 -0
  75. package/lib/inAppMessaging/types/index.js +4 -0
  76. package/lib/inAppMessaging/types/inputs.d.ts +19 -0
  77. package/lib/inAppMessaging/types/inputs.js +4 -0
  78. package/lib/inAppMessaging/types/message.d.ts +44 -0
  79. package/lib/inAppMessaging/types/message.js +4 -0
  80. package/lib/inAppMessaging/types/options.d.ts +4 -0
  81. package/lib/inAppMessaging/types/options.js +4 -0
  82. package/lib/inAppMessaging/utils/index.d.ts +1 -0
  83. package/lib/inAppMessaging/utils/index.js +9 -0
  84. package/lib/inAppMessaging/utils/statusHelpers.d.ts +13 -0
  85. package/lib/inAppMessaging/utils/statusHelpers.js +27 -0
  86. package/lib/index.d.ts +0 -6
  87. package/lib/index.js +0 -10
  88. package/lib/pushNotifications/errors/PushNotificationError.d.ts +4 -0
  89. package/lib/pushNotifications/errors/PushNotificationError.js +16 -0
  90. package/lib/pushNotifications/errors/errorHelpers.d.ts +9 -0
  91. package/lib/pushNotifications/errors/errorHelpers.js +35 -0
  92. package/lib/pushNotifications/errors/index.d.ts +2 -0
  93. package/lib/pushNotifications/errors/index.js +10 -0
  94. package/lib/pushNotifications/index.d.ts +3 -0
  95. package/lib/pushNotifications/index.js +19 -0
  96. package/lib/pushNotifications/providers/pinpoint/apis/getBadgeCount.d.ts +14 -0
  97. package/lib/pushNotifications/providers/pinpoint/apis/getBadgeCount.js +22 -0
  98. package/lib/pushNotifications/providers/pinpoint/apis/getBadgeCount.native.d.ts +2 -0
  99. package/lib/pushNotifications/providers/pinpoint/apis/getBadgeCount.native.js +13 -0
  100. package/lib/pushNotifications/providers/pinpoint/apis/getLaunchNotification.d.ts +18 -0
  101. package/lib/pushNotifications/providers/pinpoint/apis/getLaunchNotification.js +26 -0
  102. package/lib/pushNotifications/providers/pinpoint/apis/getLaunchNotification.native.d.ts +2 -0
  103. package/lib/pushNotifications/providers/pinpoint/apis/getLaunchNotification.native.js +13 -0
  104. package/lib/pushNotifications/providers/pinpoint/apis/getPermissionStatus.d.ts +27 -0
  105. package/lib/pushNotifications/providers/pinpoint/apis/getPermissionStatus.js +35 -0
  106. package/lib/pushNotifications/providers/pinpoint/apis/getPermissionStatus.native.d.ts +2 -0
  107. package/lib/pushNotifications/providers/pinpoint/apis/getPermissionStatus.native.js +13 -0
  108. package/lib/pushNotifications/providers/pinpoint/apis/identifyUser.d.ts +53 -0
  109. package/lib/pushNotifications/providers/pinpoint/apis/identifyUser.js +61 -0
  110. package/lib/pushNotifications/providers/pinpoint/apis/identifyUser.native.d.ts +2 -0
  111. package/lib/pushNotifications/providers/pinpoint/apis/identifyUser.native.js +31 -0
  112. package/lib/pushNotifications/providers/pinpoint/apis/index.d.ts +11 -0
  113. package/lib/pushNotifications/providers/pinpoint/apis/index.js +27 -0
  114. package/lib/pushNotifications/providers/pinpoint/apis/initializePushNotifications.d.ts +17 -0
  115. package/lib/pushNotifications/providers/pinpoint/apis/initializePushNotifications.js +25 -0
  116. package/lib/pushNotifications/providers/pinpoint/apis/initializePushNotifications.native.d.ts +1 -0
  117. package/lib/pushNotifications/providers/pinpoint/apis/initializePushNotifications.native.js +133 -0
  118. package/lib/pushNotifications/providers/pinpoint/apis/onNotificationOpened.d.ts +27 -0
  119. package/lib/pushNotifications/providers/pinpoint/apis/onNotificationOpened.js +35 -0
  120. package/lib/pushNotifications/providers/pinpoint/apis/onNotificationOpened.native.d.ts +2 -0
  121. package/lib/pushNotifications/providers/pinpoint/apis/onNotificationOpened.native.js +12 -0
  122. package/lib/pushNotifications/providers/pinpoint/apis/onNotificationReceivedInBackground.d.ts +43 -0
  123. package/lib/pushNotifications/providers/pinpoint/apis/onNotificationReceivedInBackground.js +51 -0
  124. package/lib/pushNotifications/providers/pinpoint/apis/onNotificationReceivedInBackground.native.d.ts +2 -0
  125. package/lib/pushNotifications/providers/pinpoint/apis/onNotificationReceivedInBackground.native.js +12 -0
  126. package/lib/pushNotifications/providers/pinpoint/apis/onNotificationReceivedInForeground.d.ts +27 -0
  127. package/lib/pushNotifications/providers/pinpoint/apis/onNotificationReceivedInForeground.js +35 -0
  128. package/lib/pushNotifications/providers/pinpoint/apis/onNotificationReceivedInForeground.native.d.ts +2 -0
  129. package/lib/pushNotifications/providers/pinpoint/apis/onNotificationReceivedInForeground.native.js +12 -0
  130. package/lib/pushNotifications/providers/pinpoint/apis/onTokenReceived.d.ts +28 -0
  131. package/lib/pushNotifications/providers/pinpoint/apis/onTokenReceived.js +36 -0
  132. package/lib/pushNotifications/providers/pinpoint/apis/onTokenReceived.native.d.ts +2 -0
  133. package/lib/pushNotifications/providers/pinpoint/apis/onTokenReceived.native.js +12 -0
  134. package/lib/pushNotifications/providers/pinpoint/apis/requestPermissions.d.ts +32 -0
  135. package/lib/pushNotifications/providers/pinpoint/apis/requestPermissions.js +40 -0
  136. package/lib/pushNotifications/providers/pinpoint/apis/requestPermissions.native.d.ts +2 -0
  137. package/lib/pushNotifications/providers/pinpoint/apis/requestPermissions.native.js +13 -0
  138. package/lib/pushNotifications/providers/pinpoint/apis/setBadgeCount.d.ts +14 -0
  139. package/lib/pushNotifications/providers/pinpoint/apis/setBadgeCount.js +22 -0
  140. package/lib/pushNotifications/providers/pinpoint/apis/setBadgeCount.native.d.ts +2 -0
  141. package/lib/pushNotifications/providers/pinpoint/apis/setBadgeCount.native.js +13 -0
  142. package/lib/pushNotifications/providers/pinpoint/index.d.ts +3 -0
  143. package/lib/pushNotifications/providers/pinpoint/index.js +17 -0
  144. package/lib/pushNotifications/providers/pinpoint/types/analytics.d.ts +6 -0
  145. package/lib/pushNotifications/providers/pinpoint/types/analytics.js +4 -0
  146. package/lib/pushNotifications/providers/pinpoint/types/apis.d.ts +13 -0
  147. package/lib/pushNotifications/providers/pinpoint/types/apis.js +4 -0
  148. package/lib/pushNotifications/providers/pinpoint/types/index.d.ts +6 -0
  149. package/lib/pushNotifications/providers/pinpoint/types/index.js +4 -0
  150. package/lib/pushNotifications/providers/pinpoint/types/inputs.d.ts +9 -0
  151. package/lib/pushNotifications/providers/pinpoint/types/inputs.js +4 -0
  152. package/lib/pushNotifications/providers/pinpoint/types/options.d.ts +5 -0
  153. package/lib/pushNotifications/providers/pinpoint/types/options.js +4 -0
  154. package/lib/pushNotifications/providers/pinpoint/types/outputs.d.ts +9 -0
  155. package/lib/pushNotifications/providers/pinpoint/types/outputs.js +4 -0
  156. package/lib/pushNotifications/providers/pinpoint/types/pushNotifications.d.ts +2 -0
  157. package/lib/pushNotifications/providers/pinpoint/types/pushNotifications.js +4 -0
  158. package/lib/pushNotifications/providers/pinpoint/utils/createMessageEventRecorder.d.ts +6 -0
  159. package/lib/pushNotifications/providers/pinpoint/utils/createMessageEventRecorder.js +43 -0
  160. package/lib/pushNotifications/providers/pinpoint/utils/getAnalyticsEvent.d.ts +7 -0
  161. package/lib/pushNotifications/providers/pinpoint/utils/getAnalyticsEvent.js +56 -0
  162. package/lib/pushNotifications/providers/pinpoint/utils/getChannelType.d.ts +5 -0
  163. package/lib/pushNotifications/providers/pinpoint/utils/getChannelType.js +25 -0
  164. package/lib/pushNotifications/providers/pinpoint/utils/index.d.ts +4 -0
  165. package/lib/pushNotifications/providers/pinpoint/utils/index.js +13 -0
  166. package/lib/pushNotifications/providers/pinpoint/utils/resolveConfig.d.ts +7 -0
  167. package/lib/pushNotifications/providers/pinpoint/utils/resolveConfig.js +17 -0
  168. package/lib/pushNotifications/types/errors.d.ts +3 -0
  169. package/lib/pushNotifications/types/errors.js +9 -0
  170. package/lib/pushNotifications/types/index.d.ts +6 -0
  171. package/lib/pushNotifications/types/index.js +24 -0
  172. package/lib/pushNotifications/types/inputs.d.ts +24 -0
  173. package/lib/pushNotifications/types/inputs.js +4 -0
  174. package/lib/pushNotifications/types/module.d.ts +31 -0
  175. package/lib/pushNotifications/types/module.js +4 -0
  176. package/lib/pushNotifications/types/options.d.ts +4 -0
  177. package/lib/pushNotifications/types/options.js +4 -0
  178. package/lib/pushNotifications/types/outputs.d.ts +10 -0
  179. package/lib/pushNotifications/types/outputs.js +4 -0
  180. package/lib/pushNotifications/types/pushNotifications.d.ts +4 -0
  181. package/lib/pushNotifications/types/pushNotifications.js +4 -0
  182. package/lib/pushNotifications/utils/getPushNotificationUserAgentString.d.ts +2 -0
  183. package/lib/pushNotifications/utils/getPushNotificationUserAgentString.js +11 -0
  184. package/lib/pushNotifications/utils/index.d.ts +4 -0
  185. package/lib/pushNotifications/utils/index.js +15 -0
  186. package/lib/pushNotifications/utils/initializationManager.d.ts +12 -0
  187. package/lib/pushNotifications/utils/initializationManager.js +22 -0
  188. package/lib/pushNotifications/utils/resolveCredentials.d.ts +7 -0
  189. package/lib/pushNotifications/utils/resolveCredentials.js +16 -0
  190. package/lib/pushNotifications/utils/tokenManager.d.ts +12 -0
  191. package/lib/pushNotifications/utils/tokenManager.js +22 -0
  192. package/lib/tsconfig.tsbuildinfo +1 -0
  193. package/lib-esm/{common/eventListeners/index.d.ts → eventListeners/eventListeners.d.ts} +2 -2
  194. package/lib-esm/eventListeners/eventListeners.js +32 -0
  195. package/lib-esm/eventListeners/index.d.ts +2 -0
  196. package/lib-esm/{common → eventListeners}/index.js +0 -3
  197. package/lib-esm/eventListeners/types.d.ts +10 -0
  198. package/lib-esm/{PushNotification/Platform → eventListeners}/types.js +1 -1
  199. package/lib-esm/inAppMessaging/errors/InAppMessagingError.d.ts +7 -0
  200. package/lib-esm/inAppMessaging/errors/InAppMessagingError.js +15 -0
  201. package/lib-esm/inAppMessaging/errors/assertServiceError.d.ts +2 -0
  202. package/lib-esm/inAppMessaging/errors/assertServiceError.js +15 -0
  203. package/lib-esm/inAppMessaging/errors/assertValidationError.d.ts +5 -0
  204. package/lib-esm/inAppMessaging/errors/assertValidationError.js +13 -0
  205. package/lib-esm/inAppMessaging/errors/index.d.ts +4 -0
  206. package/lib-esm/inAppMessaging/errors/index.js +6 -0
  207. package/lib-esm/inAppMessaging/errors/validation.d.ts +8 -0
  208. package/lib-esm/inAppMessaging/errors/validation.js +24 -0
  209. package/lib-esm/inAppMessaging/index.d.ts +2 -0
  210. package/lib-esm/inAppMessaging/index.js +3 -0
  211. package/lib-esm/inAppMessaging/providers/pinpoint/apis/clearMessages.d.ts +13 -0
  212. package/lib-esm/inAppMessaging/providers/pinpoint/apis/clearMessages.js +22 -0
  213. package/lib-esm/inAppMessaging/providers/pinpoint/apis/dispatchEvent.d.ts +26 -0
  214. package/lib-esm/inAppMessaging/providers/pinpoint/apis/dispatchEvent.js +49 -0
  215. package/lib-esm/inAppMessaging/providers/pinpoint/apis/identifyUser.d.ts +51 -0
  216. package/lib-esm/inAppMessaging/providers/pinpoint/apis/identifyUser.js +75 -0
  217. package/lib-esm/inAppMessaging/providers/pinpoint/apis/index.d.ts +11 -0
  218. package/lib-esm/inAppMessaging/providers/pinpoint/apis/index.js +13 -0
  219. package/lib-esm/inAppMessaging/providers/pinpoint/apis/initializeInAppMessaging.d.ts +12 -0
  220. package/lib-esm/inAppMessaging/providers/pinpoint/apis/initializeInAppMessaging.js +53 -0
  221. package/lib-esm/inAppMessaging/providers/pinpoint/apis/notifyMessageInteraction.d.ts +16 -0
  222. package/lib-esm/inAppMessaging/providers/pinpoint/apis/notifyMessageInteraction.js +22 -0
  223. package/lib-esm/inAppMessaging/providers/pinpoint/apis/onMessageActionTaken.d.ts +18 -0
  224. package/lib-esm/inAppMessaging/providers/pinpoint/apis/onMessageActionTaken.js +23 -0
  225. package/lib-esm/inAppMessaging/providers/pinpoint/apis/onMessageDismissed.d.ts +18 -0
  226. package/lib-esm/inAppMessaging/providers/pinpoint/apis/onMessageDismissed.js +23 -0
  227. package/lib-esm/inAppMessaging/providers/pinpoint/apis/onMessageDisplayed.d.ts +18 -0
  228. package/lib-esm/inAppMessaging/providers/pinpoint/apis/onMessageDisplayed.js +23 -0
  229. package/lib-esm/inAppMessaging/providers/pinpoint/apis/onMessageReceived.d.ts +18 -0
  230. package/lib-esm/inAppMessaging/providers/pinpoint/apis/onMessageReceived.js +23 -0
  231. package/lib-esm/inAppMessaging/providers/pinpoint/apis/setConflictHandler.d.ts +32 -0
  232. package/lib-esm/inAppMessaging/providers/pinpoint/apis/setConflictHandler.js +61 -0
  233. package/lib-esm/inAppMessaging/providers/pinpoint/apis/syncMessages.d.ts +16 -0
  234. package/lib-esm/inAppMessaging/providers/pinpoint/apis/syncMessages.js +65 -0
  235. package/lib-esm/inAppMessaging/providers/pinpoint/index.d.ts +2 -0
  236. package/lib-esm/inAppMessaging/providers/pinpoint/index.js +3 -0
  237. package/lib-esm/inAppMessaging/providers/pinpoint/types/index.d.ts +4 -0
  238. package/lib-esm/inAppMessaging/providers/pinpoint/types/index.js +3 -0
  239. package/lib-esm/inAppMessaging/providers/pinpoint/types/inputs.d.ts +37 -0
  240. package/lib-esm/{common/AWSPinpointProviderCommon/types.js → inAppMessaging/providers/pinpoint/types/inputs.js} +1 -1
  241. package/lib-esm/inAppMessaging/providers/pinpoint/types/options.d.ts +5 -0
  242. package/lib-esm/{common/eventListeners/types.js → inAppMessaging/providers/pinpoint/types/options.js} +1 -1
  243. package/lib-esm/inAppMessaging/providers/pinpoint/types/outputs.d.ts +17 -0
  244. package/lib-esm/{InAppMessaging/SessionTracker/types.js → inAppMessaging/providers/pinpoint/types/outputs.js} +1 -1
  245. package/lib-esm/inAppMessaging/providers/pinpoint/types/types.d.ts +19 -0
  246. package/lib-esm/inAppMessaging/providers/pinpoint/types/types.js +8 -0
  247. package/lib-esm/inAppMessaging/providers/pinpoint/utils/constants.d.ts +4 -0
  248. package/lib-esm/inAppMessaging/providers/pinpoint/utils/constants.js +6 -0
  249. package/lib-esm/{InAppMessaging/Providers/AWSPinpointProvider/utils.d.ts → inAppMessaging/providers/pinpoint/utils/helpers.d.ts} +6 -7
  250. package/lib-esm/inAppMessaging/providers/pinpoint/utils/helpers.js +246 -0
  251. package/lib-esm/inAppMessaging/providers/pinpoint/utils/index.d.ts +5 -0
  252. package/lib-esm/inAppMessaging/providers/pinpoint/utils/index.js +7 -0
  253. package/lib-esm/inAppMessaging/providers/pinpoint/utils/messageProcessingHelpers.d.ts +6 -0
  254. package/lib-esm/inAppMessaging/providers/pinpoint/utils/messageProcessingHelpers.js +163 -0
  255. package/lib-esm/inAppMessaging/providers/pinpoint/utils/resolveConfig.d.ts +7 -0
  256. package/lib-esm/inAppMessaging/providers/pinpoint/utils/resolveConfig.js +13 -0
  257. package/lib-esm/inAppMessaging/providers/pinpoint/utils/resolveCredentials.d.ts +7 -0
  258. package/lib-esm/inAppMessaging/providers/pinpoint/utils/resolveCredentials.js +12 -0
  259. package/lib-esm/inAppMessaging/providers/pinpoint/utils/userAgent.d.ts +4 -0
  260. package/lib-esm/inAppMessaging/providers/pinpoint/utils/userAgent.js +15 -0
  261. package/lib-esm/inAppMessaging/types/event.d.ts +6 -0
  262. package/lib-esm/inAppMessaging/types/event.js +3 -0
  263. package/lib-esm/inAppMessaging/types/index.d.ts +4 -0
  264. package/lib-esm/inAppMessaging/types/index.js +3 -0
  265. package/lib-esm/inAppMessaging/types/inputs.d.ts +19 -0
  266. package/lib-esm/inAppMessaging/types/inputs.js +3 -0
  267. package/lib-esm/inAppMessaging/types/message.d.ts +44 -0
  268. package/lib-esm/inAppMessaging/types/message.js +3 -0
  269. package/lib-esm/inAppMessaging/types/options.d.ts +4 -0
  270. package/lib-esm/inAppMessaging/types/options.js +3 -0
  271. package/lib-esm/inAppMessaging/utils/index.d.ts +1 -0
  272. package/lib-esm/inAppMessaging/utils/index.js +3 -0
  273. package/lib-esm/inAppMessaging/utils/statusHelpers.d.ts +13 -0
  274. package/lib-esm/inAppMessaging/utils/statusHelpers.js +21 -0
  275. package/lib-esm/index.d.ts +0 -6
  276. package/lib-esm/index.js +1 -5
  277. package/lib-esm/pushNotifications/errors/PushNotificationError.d.ts +4 -0
  278. package/lib-esm/pushNotifications/errors/PushNotificationError.js +12 -0
  279. package/lib-esm/pushNotifications/errors/errorHelpers.d.ts +9 -0
  280. package/lib-esm/pushNotifications/errors/errorHelpers.js +31 -0
  281. package/lib-esm/pushNotifications/errors/index.d.ts +2 -0
  282. package/lib-esm/pushNotifications/errors/index.js +4 -0
  283. package/lib-esm/pushNotifications/index.d.ts +3 -0
  284. package/lib-esm/pushNotifications/index.js +4 -0
  285. package/lib-esm/pushNotifications/providers/pinpoint/apis/getBadgeCount.d.ts +14 -0
  286. package/lib-esm/pushNotifications/providers/pinpoint/apis/getBadgeCount.js +18 -0
  287. package/lib-esm/pushNotifications/providers/pinpoint/apis/getBadgeCount.native.d.ts +2 -0
  288. package/lib-esm/pushNotifications/providers/pinpoint/apis/getBadgeCount.native.js +9 -0
  289. package/lib-esm/pushNotifications/providers/pinpoint/apis/getLaunchNotification.d.ts +18 -0
  290. package/lib-esm/pushNotifications/providers/pinpoint/apis/getLaunchNotification.js +22 -0
  291. package/lib-esm/pushNotifications/providers/pinpoint/apis/getLaunchNotification.native.d.ts +2 -0
  292. package/lib-esm/pushNotifications/providers/pinpoint/apis/getLaunchNotification.native.js +9 -0
  293. package/lib-esm/pushNotifications/providers/pinpoint/apis/getPermissionStatus.d.ts +27 -0
  294. package/lib-esm/pushNotifications/providers/pinpoint/apis/getPermissionStatus.js +31 -0
  295. package/lib-esm/pushNotifications/providers/pinpoint/apis/getPermissionStatus.native.d.ts +2 -0
  296. package/lib-esm/pushNotifications/providers/pinpoint/apis/getPermissionStatus.native.js +9 -0
  297. package/lib-esm/pushNotifications/providers/pinpoint/apis/identifyUser.d.ts +53 -0
  298. package/lib-esm/pushNotifications/providers/pinpoint/apis/identifyUser.js +57 -0
  299. package/lib-esm/pushNotifications/providers/pinpoint/apis/identifyUser.native.d.ts +2 -0
  300. package/lib-esm/pushNotifications/providers/pinpoint/apis/identifyUser.native.js +27 -0
  301. package/lib-esm/pushNotifications/providers/pinpoint/apis/index.d.ts +11 -0
  302. package/lib-esm/pushNotifications/providers/pinpoint/apis/index.js +13 -0
  303. package/lib-esm/pushNotifications/providers/pinpoint/apis/initializePushNotifications.d.ts +17 -0
  304. package/lib-esm/pushNotifications/providers/pinpoint/apis/initializePushNotifications.js +21 -0
  305. package/lib-esm/pushNotifications/providers/pinpoint/apis/initializePushNotifications.native.d.ts +1 -0
  306. package/lib-esm/pushNotifications/providers/pinpoint/apis/initializePushNotifications.native.js +129 -0
  307. package/lib-esm/pushNotifications/providers/pinpoint/apis/onNotificationOpened.d.ts +27 -0
  308. package/lib-esm/pushNotifications/providers/pinpoint/apis/onNotificationOpened.js +31 -0
  309. package/lib-esm/pushNotifications/providers/pinpoint/apis/onNotificationOpened.native.d.ts +2 -0
  310. package/lib-esm/pushNotifications/providers/pinpoint/apis/onNotificationOpened.native.js +8 -0
  311. package/lib-esm/pushNotifications/providers/pinpoint/apis/onNotificationReceivedInBackground.d.ts +43 -0
  312. package/lib-esm/pushNotifications/providers/pinpoint/apis/onNotificationReceivedInBackground.js +47 -0
  313. package/lib-esm/pushNotifications/providers/pinpoint/apis/onNotificationReceivedInBackground.native.d.ts +2 -0
  314. package/lib-esm/pushNotifications/providers/pinpoint/apis/onNotificationReceivedInBackground.native.js +8 -0
  315. package/lib-esm/pushNotifications/providers/pinpoint/apis/onNotificationReceivedInForeground.d.ts +27 -0
  316. package/lib-esm/pushNotifications/providers/pinpoint/apis/onNotificationReceivedInForeground.js +31 -0
  317. package/lib-esm/pushNotifications/providers/pinpoint/apis/onNotificationReceivedInForeground.native.d.ts +2 -0
  318. package/lib-esm/pushNotifications/providers/pinpoint/apis/onNotificationReceivedInForeground.native.js +8 -0
  319. package/lib-esm/pushNotifications/providers/pinpoint/apis/onTokenReceived.d.ts +28 -0
  320. package/lib-esm/pushNotifications/providers/pinpoint/apis/onTokenReceived.js +32 -0
  321. package/lib-esm/pushNotifications/providers/pinpoint/apis/onTokenReceived.native.d.ts +2 -0
  322. package/lib-esm/pushNotifications/providers/pinpoint/apis/onTokenReceived.native.js +8 -0
  323. package/lib-esm/pushNotifications/providers/pinpoint/apis/requestPermissions.d.ts +32 -0
  324. package/lib-esm/pushNotifications/providers/pinpoint/apis/requestPermissions.js +36 -0
  325. package/lib-esm/pushNotifications/providers/pinpoint/apis/requestPermissions.native.d.ts +2 -0
  326. package/lib-esm/pushNotifications/providers/pinpoint/apis/requestPermissions.native.js +9 -0
  327. package/lib-esm/pushNotifications/providers/pinpoint/apis/setBadgeCount.d.ts +14 -0
  328. package/lib-esm/pushNotifications/providers/pinpoint/apis/setBadgeCount.js +18 -0
  329. package/lib-esm/pushNotifications/providers/pinpoint/apis/setBadgeCount.native.d.ts +2 -0
  330. package/lib-esm/pushNotifications/providers/pinpoint/apis/setBadgeCount.native.js +9 -0
  331. package/lib-esm/pushNotifications/providers/pinpoint/index.d.ts +3 -0
  332. package/lib-esm/pushNotifications/providers/pinpoint/index.js +3 -0
  333. package/lib-esm/pushNotifications/providers/pinpoint/types/analytics.d.ts +6 -0
  334. package/lib-esm/pushNotifications/providers/pinpoint/types/analytics.js +3 -0
  335. package/lib-esm/pushNotifications/providers/pinpoint/types/apis.d.ts +13 -0
  336. package/lib-esm/pushNotifications/providers/pinpoint/types/apis.js +3 -0
  337. package/lib-esm/pushNotifications/providers/pinpoint/types/index.d.ts +6 -0
  338. package/lib-esm/pushNotifications/providers/pinpoint/types/index.js +3 -0
  339. package/lib-esm/pushNotifications/providers/pinpoint/types/inputs.d.ts +9 -0
  340. package/lib-esm/pushNotifications/providers/pinpoint/types/inputs.js +3 -0
  341. package/lib-esm/pushNotifications/providers/pinpoint/types/options.d.ts +5 -0
  342. package/lib-esm/pushNotifications/providers/pinpoint/types/options.js +3 -0
  343. package/lib-esm/pushNotifications/providers/pinpoint/types/outputs.d.ts +9 -0
  344. package/lib-esm/pushNotifications/providers/pinpoint/types/outputs.js +3 -0
  345. package/lib-esm/pushNotifications/providers/pinpoint/types/pushNotifications.d.ts +2 -0
  346. package/lib-esm/pushNotifications/providers/pinpoint/types/pushNotifications.js +3 -0
  347. package/lib-esm/pushNotifications/providers/pinpoint/utils/createMessageEventRecorder.d.ts +6 -0
  348. package/lib-esm/pushNotifications/providers/pinpoint/utils/createMessageEventRecorder.js +39 -0
  349. package/lib-esm/pushNotifications/providers/pinpoint/utils/getAnalyticsEvent.d.ts +7 -0
  350. package/lib-esm/pushNotifications/providers/pinpoint/utils/getAnalyticsEvent.js +52 -0
  351. package/lib-esm/pushNotifications/providers/pinpoint/utils/getChannelType.d.ts +5 -0
  352. package/lib-esm/pushNotifications/providers/pinpoint/utils/getChannelType.js +21 -0
  353. package/lib-esm/pushNotifications/providers/pinpoint/utils/index.d.ts +4 -0
  354. package/lib-esm/pushNotifications/providers/pinpoint/utils/index.js +6 -0
  355. package/lib-esm/pushNotifications/providers/pinpoint/utils/resolveConfig.d.ts +7 -0
  356. package/lib-esm/pushNotifications/providers/pinpoint/utils/resolveConfig.js +13 -0
  357. package/lib-esm/pushNotifications/types/errors.d.ts +3 -0
  358. package/lib-esm/pushNotifications/types/errors.js +6 -0
  359. package/lib-esm/pushNotifications/types/index.d.ts +6 -0
  360. package/lib-esm/pushNotifications/types/index.js +8 -0
  361. package/lib-esm/pushNotifications/types/inputs.d.ts +24 -0
  362. package/lib-esm/pushNotifications/types/inputs.js +3 -0
  363. package/lib-esm/pushNotifications/types/module.d.ts +31 -0
  364. package/lib-esm/pushNotifications/types/module.js +3 -0
  365. package/lib-esm/pushNotifications/types/options.d.ts +4 -0
  366. package/lib-esm/pushNotifications/types/options.js +3 -0
  367. package/lib-esm/pushNotifications/types/outputs.d.ts +10 -0
  368. package/lib-esm/pushNotifications/types/outputs.js +3 -0
  369. package/lib-esm/pushNotifications/types/pushNotifications.d.ts +4 -0
  370. package/lib-esm/pushNotifications/types/pushNotifications.js +3 -0
  371. package/lib-esm/pushNotifications/utils/getPushNotificationUserAgentString.d.ts +2 -0
  372. package/lib-esm/pushNotifications/utils/getPushNotificationUserAgentString.js +7 -0
  373. package/lib-esm/pushNotifications/utils/index.d.ts +4 -0
  374. package/lib-esm/pushNotifications/utils/index.js +6 -0
  375. package/lib-esm/pushNotifications/utils/initializationManager.d.ts +12 -0
  376. package/lib-esm/pushNotifications/utils/initializationManager.js +17 -0
  377. package/lib-esm/pushNotifications/utils/resolveCredentials.d.ts +7 -0
  378. package/lib-esm/pushNotifications/utils/resolveCredentials.js +12 -0
  379. package/lib-esm/pushNotifications/utils/tokenManager.d.ts +12 -0
  380. package/lib-esm/pushNotifications/utils/tokenManager.js +17 -0
  381. package/lib-esm/tsconfig.tsbuildinfo +1 -0
  382. package/package.json +104 -38
  383. package/push-notifications/package.json +7 -0
  384. package/push-notifications/pinpoint/package.json +7 -0
  385. package/src/{common/eventListeners/index.ts → eventListeners/eventListeners.ts} +5 -3
  386. package/src/{common → eventListeners}/index.ts +1 -3
  387. package/src/{common/eventListeners → eventListeners}/types.ts +6 -2
  388. package/src/inAppMessaging/errors/InAppMessagingError.ts +21 -0
  389. package/src/inAppMessaging/errors/assertServiceError.ts +24 -0
  390. package/src/inAppMessaging/errors/assertValidationError.ts +22 -0
  391. package/src/inAppMessaging/errors/index.ts +10 -0
  392. package/src/inAppMessaging/errors/validation.ts +29 -0
  393. package/src/inAppMessaging/index.ts +39 -0
  394. package/src/inAppMessaging/providers/pinpoint/apis/clearMessages.ts +26 -0
  395. package/src/inAppMessaging/providers/pinpoint/apis/dispatchEvent.ts +63 -0
  396. package/src/inAppMessaging/providers/pinpoint/apis/identifyUser.ts +94 -0
  397. package/src/inAppMessaging/providers/pinpoint/apis/index.ts +14 -0
  398. package/src/inAppMessaging/providers/pinpoint/apis/initializeInAppMessaging.ts +62 -0
  399. package/src/inAppMessaging/providers/pinpoint/apis/notifyMessageInteraction.ts +28 -0
  400. package/src/inAppMessaging/providers/pinpoint/apis/onMessageActionTaken.ts +29 -0
  401. package/src/inAppMessaging/providers/pinpoint/apis/onMessageDismissed.ts +29 -0
  402. package/src/inAppMessaging/providers/pinpoint/apis/onMessageDisplayed.ts +29 -0
  403. package/src/inAppMessaging/providers/pinpoint/apis/onMessageReceived.ts +29 -0
  404. package/src/inAppMessaging/providers/pinpoint/apis/setConflictHandler.ts +68 -0
  405. package/src/inAppMessaging/providers/pinpoint/apis/syncMessages.ts +88 -0
  406. package/src/inAppMessaging/providers/pinpoint/index.ts +31 -0
  407. package/src/inAppMessaging/providers/pinpoint/types/index.ts +29 -0
  408. package/src/inAppMessaging/providers/pinpoint/types/inputs.ts +58 -0
  409. package/src/inAppMessaging/providers/pinpoint/types/options.ts +9 -0
  410. package/src/inAppMessaging/providers/pinpoint/types/outputs.ts +24 -0
  411. package/src/{InAppMessaging/Providers/AWSPinpointProvider → inAppMessaging/providers/pinpoint/types}/types.ts +9 -1
  412. package/src/inAppMessaging/providers/pinpoint/utils/constants.ts +6 -0
  413. package/src/{InAppMessaging/Providers/AWSPinpointProvider/utils.ts → inAppMessaging/providers/pinpoint/utils/helpers.ts} +74 -58
  414. package/src/inAppMessaging/providers/pinpoint/utils/index.ts +18 -0
  415. package/src/inAppMessaging/providers/pinpoint/utils/messageProcessingHelpers.ts +210 -0
  416. package/src/inAppMessaging/providers/pinpoint/utils/resolveConfig.ts +19 -0
  417. package/src/inAppMessaging/providers/pinpoint/utils/resolveCredentials.ts +20 -0
  418. package/src/inAppMessaging/providers/pinpoint/utils/userAgent.ts +25 -0
  419. package/src/inAppMessaging/types/event.ts +14 -0
  420. package/src/{InAppMessaging → inAppMessaging/types}/index.ts +7 -8
  421. package/src/inAppMessaging/types/inputs.ts +27 -0
  422. package/src/inAppMessaging/types/message.ts +62 -0
  423. package/src/inAppMessaging/types/options.ts +7 -0
  424. package/src/{PushNotification/Providers → inAppMessaging/utils}/index.ts +5 -1
  425. package/src/inAppMessaging/utils/statusHelpers.ts +32 -0
  426. package/src/index.ts +0 -24
  427. package/src/pushNotifications/errors/PushNotificationError.ts +18 -0
  428. package/src/pushNotifications/errors/errorHelpers.ts +45 -0
  429. package/src/pushNotifications/errors/index.ts +5 -0
  430. package/src/pushNotifications/index.ts +32 -0
  431. package/src/pushNotifications/providers/pinpoint/apis/getBadgeCount.native.ts +13 -0
  432. package/src/pushNotifications/providers/pinpoint/apis/getBadgeCount.ts +21 -0
  433. package/src/pushNotifications/providers/pinpoint/apis/getLaunchNotification.native.ts +14 -0
  434. package/src/pushNotifications/providers/pinpoint/apis/getLaunchNotification.ts +26 -0
  435. package/src/pushNotifications/providers/pinpoint/apis/getPermissionStatus.native.ts +14 -0
  436. package/src/pushNotifications/providers/pinpoint/apis/getPermissionStatus.ts +34 -0
  437. package/src/pushNotifications/providers/pinpoint/apis/identifyUser.native.ts +39 -0
  438. package/src/pushNotifications/providers/pinpoint/apis/identifyUser.ts +62 -0
  439. package/src/pushNotifications/providers/pinpoint/apis/index.ts +14 -0
  440. package/src/pushNotifications/providers/pinpoint/apis/initializePushNotifications.native.ts +209 -0
  441. package/src/pushNotifications/providers/pinpoint/apis/initializePushNotifications.ts +24 -0
  442. package/src/pushNotifications/providers/pinpoint/apis/onNotificationOpened.native.ts +11 -0
  443. package/src/pushNotifications/providers/pinpoint/apis/onNotificationOpened.ts +39 -0
  444. package/src/pushNotifications/providers/pinpoint/apis/onNotificationReceivedInBackground.native.ts +12 -0
  445. package/src/pushNotifications/providers/pinpoint/apis/onNotificationReceivedInBackground.ts +56 -0
  446. package/src/pushNotifications/providers/pinpoint/apis/onNotificationReceivedInForeground.native.ts +12 -0
  447. package/src/pushNotifications/providers/pinpoint/apis/onNotificationReceivedInForeground.ts +40 -0
  448. package/src/pushNotifications/providers/pinpoint/apis/onTokenReceived.native.ts +11 -0
  449. package/src/pushNotifications/providers/pinpoint/apis/onTokenReceived.ts +39 -0
  450. package/src/pushNotifications/providers/pinpoint/apis/requestPermissions.native.ts +14 -0
  451. package/src/pushNotifications/providers/pinpoint/apis/requestPermissions.ts +39 -0
  452. package/src/pushNotifications/providers/pinpoint/apis/setBadgeCount.native.ts +13 -0
  453. package/src/pushNotifications/providers/pinpoint/apis/setBadgeCount.ts +21 -0
  454. package/src/pushNotifications/providers/pinpoint/index.ts +34 -0
  455. package/src/pushNotifications/providers/pinpoint/types/analytics.ts +14 -0
  456. package/src/pushNotifications/providers/pinpoint/types/apis.ts +54 -0
  457. package/src/pushNotifications/providers/pinpoint/types/index.ts +40 -0
  458. package/src/pushNotifications/providers/pinpoint/types/inputs.ts +31 -0
  459. package/src/pushNotifications/providers/pinpoint/types/options.ts +9 -0
  460. package/src/pushNotifications/providers/pinpoint/types/outputs.ts +34 -0
  461. package/src/pushNotifications/providers/pinpoint/types/pushNotifications.ts +6 -0
  462. package/src/pushNotifications/providers/pinpoint/utils/createMessageEventRecorder.ts +66 -0
  463. package/src/pushNotifications/providers/pinpoint/utils/getAnalyticsEvent.ts +66 -0
  464. package/src/pushNotifications/providers/pinpoint/utils/getChannelType.ts +25 -0
  465. package/src/pushNotifications/providers/pinpoint/utils/index.ts +7 -0
  466. package/src/pushNotifications/providers/pinpoint/utils/resolveConfig.ts +16 -0
  467. package/src/{InAppMessaging/Providers/index.ts → pushNotifications/types/errors.ts} +3 -1
  468. package/src/pushNotifications/types/index.ts +9 -0
  469. package/src/pushNotifications/types/inputs.ts +45 -0
  470. package/src/pushNotifications/types/module.ts +42 -0
  471. package/src/pushNotifications/types/options.ts +7 -0
  472. package/src/pushNotifications/types/outputs.ts +28 -0
  473. package/src/pushNotifications/types/pushNotifications.ts +17 -0
  474. package/src/pushNotifications/utils/getPushNotificationUserAgentString.ts +15 -0
  475. package/src/pushNotifications/utils/index.ts +7 -0
  476. package/src/pushNotifications/utils/initializationManager.ts +20 -0
  477. package/src/pushNotifications/utils/resolveCredentials.ts +14 -0
  478. package/src/pushNotifications/utils/tokenManager.ts +20 -0
  479. package/lib/.tsbuildinfo +0 -3
  480. package/lib/InAppMessaging/InAppMessaging.d.ts +0 -57
  481. package/lib/InAppMessaging/InAppMessaging.js +0 -340
  482. package/lib/InAppMessaging/InAppMessaging.js.map +0 -1
  483. package/lib/InAppMessaging/Providers/AWSPinpointProvider/index.d.ts +0 -31
  484. package/lib/InAppMessaging/Providers/AWSPinpointProvider/index.js +0 -266
  485. package/lib/InAppMessaging/Providers/AWSPinpointProvider/index.js.map +0 -1
  486. package/lib/InAppMessaging/Providers/AWSPinpointProvider/types.d.ts +0 -16
  487. package/lib/InAppMessaging/Providers/AWSPinpointProvider/types.js +0 -11
  488. package/lib/InAppMessaging/Providers/AWSPinpointProvider/types.js.map +0 -1
  489. package/lib/InAppMessaging/Providers/AWSPinpointProvider/utils.js +0 -247
  490. package/lib/InAppMessaging/Providers/AWSPinpointProvider/utils.js.map +0 -1
  491. package/lib/InAppMessaging/Providers/index.d.ts +0 -1
  492. package/lib/InAppMessaging/Providers/index.js +0 -7
  493. package/lib/InAppMessaging/Providers/index.js.map +0 -1
  494. package/lib/InAppMessaging/SessionTracker/SessionTracker.d.ts +0 -9
  495. package/lib/InAppMessaging/SessionTracker/SessionTracker.js +0 -68
  496. package/lib/InAppMessaging/SessionTracker/SessionTracker.js.map +0 -1
  497. package/lib/InAppMessaging/SessionTracker/SessionTracker.native.d.ts +0 -10
  498. package/lib/InAppMessaging/SessionTracker/SessionTracker.native.js +0 -53
  499. package/lib/InAppMessaging/SessionTracker/SessionTracker.native.js.map +0 -1
  500. package/lib/InAppMessaging/SessionTracker/index.d.ts +0 -3
  501. package/lib/InAppMessaging/SessionTracker/index.js +0 -8
  502. package/lib/InAppMessaging/SessionTracker/index.js.map +0 -1
  503. package/lib/InAppMessaging/SessionTracker/types.d.ts +0 -6
  504. package/lib/InAppMessaging/SessionTracker/types.js.map +0 -1
  505. package/lib/InAppMessaging/index.d.ts +0 -2
  506. package/lib/InAppMessaging/index.js.map +0 -1
  507. package/lib/InAppMessaging/types.d.ts +0 -87
  508. package/lib/InAppMessaging/types.js +0 -12
  509. package/lib/InAppMessaging/types.js.map +0 -1
  510. package/lib/Notifications.d.ts +0 -24
  511. package/lib/Notifications.js +0 -94
  512. package/lib/Notifications.js.map +0 -1
  513. package/lib/PushNotification/NotEnabledError.d.ts +0 -3
  514. package/lib/PushNotification/NotEnabledError.js +0 -16
  515. package/lib/PushNotification/NotEnabledError.js.map +0 -1
  516. package/lib/PushNotification/Platform/index.d.ts +0 -2
  517. package/lib/PushNotification/Platform/index.js +0 -26
  518. package/lib/PushNotification/Platform/index.js.map +0 -1
  519. package/lib/PushNotification/Platform/index.native.d.ts +0 -2
  520. package/lib/PushNotification/Platform/index.native.js +0 -8
  521. package/lib/PushNotification/Platform/index.native.js.map +0 -1
  522. package/lib/PushNotification/Platform/types.d.ts +0 -5
  523. package/lib/PushNotification/Platform/types.js.map +0 -1
  524. package/lib/PushNotification/PlatformNotSupportedError.d.ts +0 -3
  525. package/lib/PushNotification/PlatformNotSupportedError.js +0 -16
  526. package/lib/PushNotification/PlatformNotSupportedError.js.map +0 -1
  527. package/lib/PushNotification/Providers/AWSPinpointProvider/index.d.ts +0 -15
  528. package/lib/PushNotification/Providers/AWSPinpointProvider/index.js +0 -114
  529. package/lib/PushNotification/Providers/AWSPinpointProvider/index.js.map +0 -1
  530. package/lib/PushNotification/Providers/AWSPinpointProvider/types.d.ts +0 -9
  531. package/lib/PushNotification/Providers/AWSPinpointProvider/types.js +0 -16
  532. package/lib/PushNotification/Providers/AWSPinpointProvider/types.js.map +0 -1
  533. package/lib/PushNotification/Providers/AWSPinpointProvider/utils.d.ts +0 -7
  534. package/lib/PushNotification/Providers/AWSPinpointProvider/utils.js +0 -58
  535. package/lib/PushNotification/Providers/AWSPinpointProvider/utils.js.map +0 -1
  536. package/lib/PushNotification/Providers/index.d.ts +0 -1
  537. package/lib/PushNotification/Providers/index.js +0 -7
  538. package/lib/PushNotification/Providers/index.js.map +0 -1
  539. package/lib/PushNotification/PushNotification.d.ts +0 -39
  540. package/lib/PushNotification/PushNotification.js +0 -91
  541. package/lib/PushNotification/PushNotification.js.map +0 -1
  542. package/lib/PushNotification/PushNotification.native.d.ts +0 -63
  543. package/lib/PushNotification/PushNotification.native.js +0 -332
  544. package/lib/PushNotification/PushNotification.native.js.map +0 -1
  545. package/lib/PushNotification/index.d.ts +0 -2
  546. package/lib/PushNotification/index.js +0 -9
  547. package/lib/PushNotification/index.js.map +0 -1
  548. package/lib/PushNotification/types.d.ts +0 -77
  549. package/lib/PushNotification/types.js +0 -12
  550. package/lib/PushNotification/types.js.map +0 -1
  551. package/lib/PushNotification/utils.d.ts +0 -3
  552. package/lib/PushNotification/utils.js +0 -81
  553. package/lib/PushNotification/utils.js.map +0 -1
  554. package/lib/common/AWSPinpointProviderCommon/index.d.ts +0 -35
  555. package/lib/common/AWSPinpointProviderCommon/index.js +0 -280
  556. package/lib/common/AWSPinpointProviderCommon/index.js.map +0 -1
  557. package/lib/common/AWSPinpointProviderCommon/types.d.ts +0 -10
  558. package/lib/common/AWSPinpointProviderCommon/types.js.map +0 -1
  559. package/lib/common/constants.d.ts +0 -1
  560. package/lib/common/constants.js +0 -8
  561. package/lib/common/constants.js.map +0 -1
  562. package/lib/common/eventListeners/index.js +0 -55
  563. package/lib/common/eventListeners/index.js.map +0 -1
  564. package/lib/common/eventListeners/types.d.ts +0 -7
  565. package/lib/common/eventListeners/types.js.map +0 -1
  566. package/lib/common/index.d.ts +0 -4
  567. package/lib/common/index.js +0 -13
  568. package/lib/common/index.js.map +0 -1
  569. package/lib/index.js.map +0 -1
  570. package/lib/types.d.ts +0 -39
  571. package/lib/types.js +0 -5
  572. package/lib/types.js.map +0 -1
  573. package/lib-esm/.tsbuildinfo +0 -3
  574. package/lib-esm/InAppMessaging/InAppMessaging.d.ts +0 -57
  575. package/lib-esm/InAppMessaging/InAppMessaging.js +0 -338
  576. package/lib-esm/InAppMessaging/InAppMessaging.js.map +0 -1
  577. package/lib-esm/InAppMessaging/Providers/AWSPinpointProvider/index.d.ts +0 -31
  578. package/lib-esm/InAppMessaging/Providers/AWSPinpointProvider/index.js +0 -264
  579. package/lib-esm/InAppMessaging/Providers/AWSPinpointProvider/index.js.map +0 -1
  580. package/lib-esm/InAppMessaging/Providers/AWSPinpointProvider/types.d.ts +0 -16
  581. package/lib-esm/InAppMessaging/Providers/AWSPinpointProvider/types.js +0 -9
  582. package/lib-esm/InAppMessaging/Providers/AWSPinpointProvider/types.js.map +0 -1
  583. package/lib-esm/InAppMessaging/Providers/AWSPinpointProvider/utils.js +0 -245
  584. package/lib-esm/InAppMessaging/Providers/AWSPinpointProvider/utils.js.map +0 -1
  585. package/lib-esm/InAppMessaging/Providers/index.d.ts +0 -1
  586. package/lib-esm/InAppMessaging/Providers/index.js +0 -4
  587. package/lib-esm/InAppMessaging/Providers/index.js.map +0 -1
  588. package/lib-esm/InAppMessaging/SessionTracker/SessionTracker.d.ts +0 -9
  589. package/lib-esm/InAppMessaging/SessionTracker/SessionTracker.js +0 -65
  590. package/lib-esm/InAppMessaging/SessionTracker/SessionTracker.js.map +0 -1
  591. package/lib-esm/InAppMessaging/SessionTracker/SessionTracker.native.d.ts +0 -10
  592. package/lib-esm/InAppMessaging/SessionTracker/SessionTracker.native.js +0 -50
  593. package/lib-esm/InAppMessaging/SessionTracker/SessionTracker.native.js.map +0 -1
  594. package/lib-esm/InAppMessaging/SessionTracker/index.d.ts +0 -3
  595. package/lib-esm/InAppMessaging/SessionTracker/index.js +0 -5
  596. package/lib-esm/InAppMessaging/SessionTracker/index.js.map +0 -1
  597. package/lib-esm/InAppMessaging/SessionTracker/types.d.ts +0 -6
  598. package/lib-esm/InAppMessaging/SessionTracker/types.js.map +0 -1
  599. package/lib-esm/InAppMessaging/index.d.ts +0 -2
  600. package/lib-esm/InAppMessaging/index.js +0 -5
  601. package/lib-esm/InAppMessaging/index.js.map +0 -1
  602. package/lib-esm/InAppMessaging/types.d.ts +0 -87
  603. package/lib-esm/InAppMessaging/types.js +0 -10
  604. package/lib-esm/InAppMessaging/types.js.map +0 -1
  605. package/lib-esm/Notifications.d.ts +0 -24
  606. package/lib-esm/Notifications.js +0 -92
  607. package/lib-esm/Notifications.js.map +0 -1
  608. package/lib-esm/PushNotification/NotEnabledError.d.ts +0 -3
  609. package/lib-esm/PushNotification/NotEnabledError.js +0 -14
  610. package/lib-esm/PushNotification/NotEnabledError.js.map +0 -1
  611. package/lib-esm/PushNotification/Platform/index.d.ts +0 -2
  612. package/lib-esm/PushNotification/Platform/index.js +0 -24
  613. package/lib-esm/PushNotification/Platform/index.js.map +0 -1
  614. package/lib-esm/PushNotification/Platform/index.native.d.ts +0 -2
  615. package/lib-esm/PushNotification/Platform/index.native.js +0 -6
  616. package/lib-esm/PushNotification/Platform/index.native.js.map +0 -1
  617. package/lib-esm/PushNotification/Platform/types.d.ts +0 -5
  618. package/lib-esm/PushNotification/Platform/types.js.map +0 -1
  619. package/lib-esm/PushNotification/PlatformNotSupportedError.d.ts +0 -3
  620. package/lib-esm/PushNotification/PlatformNotSupportedError.js +0 -14
  621. package/lib-esm/PushNotification/PlatformNotSupportedError.js.map +0 -1
  622. package/lib-esm/PushNotification/Providers/AWSPinpointProvider/index.d.ts +0 -15
  623. package/lib-esm/PushNotification/Providers/AWSPinpointProvider/index.js +0 -112
  624. package/lib-esm/PushNotification/Providers/AWSPinpointProvider/index.js.map +0 -1
  625. package/lib-esm/PushNotification/Providers/AWSPinpointProvider/types.d.ts +0 -9
  626. package/lib-esm/PushNotification/Providers/AWSPinpointProvider/types.js +0 -14
  627. package/lib-esm/PushNotification/Providers/AWSPinpointProvider/types.js.map +0 -1
  628. package/lib-esm/PushNotification/Providers/AWSPinpointProvider/utils.d.ts +0 -7
  629. package/lib-esm/PushNotification/Providers/AWSPinpointProvider/utils.js +0 -56
  630. package/lib-esm/PushNotification/Providers/AWSPinpointProvider/utils.js.map +0 -1
  631. package/lib-esm/PushNotification/Providers/index.d.ts +0 -1
  632. package/lib-esm/PushNotification/Providers/index.js +0 -4
  633. package/lib-esm/PushNotification/Providers/index.js.map +0 -1
  634. package/lib-esm/PushNotification/PushNotification.d.ts +0 -39
  635. package/lib-esm/PushNotification/PushNotification.js +0 -89
  636. package/lib-esm/PushNotification/PushNotification.js.map +0 -1
  637. package/lib-esm/PushNotification/PushNotification.native.d.ts +0 -63
  638. package/lib-esm/PushNotification/PushNotification.native.js +0 -330
  639. package/lib-esm/PushNotification/PushNotification.native.js.map +0 -1
  640. package/lib-esm/PushNotification/index.d.ts +0 -2
  641. package/lib-esm/PushNotification/index.js +0 -5
  642. package/lib-esm/PushNotification/index.js.map +0 -1
  643. package/lib-esm/PushNotification/types.d.ts +0 -77
  644. package/lib-esm/PushNotification/types.js +0 -10
  645. package/lib-esm/PushNotification/types.js.map +0 -1
  646. package/lib-esm/PushNotification/utils.d.ts +0 -3
  647. package/lib-esm/PushNotification/utils.js +0 -79
  648. package/lib-esm/PushNotification/utils.js.map +0 -1
  649. package/lib-esm/common/AWSPinpointProviderCommon/index.d.ts +0 -35
  650. package/lib-esm/common/AWSPinpointProviderCommon/index.js +0 -278
  651. package/lib-esm/common/AWSPinpointProviderCommon/index.js.map +0 -1
  652. package/lib-esm/common/AWSPinpointProviderCommon/types.d.ts +0 -10
  653. package/lib-esm/common/AWSPinpointProviderCommon/types.js.map +0 -1
  654. package/lib-esm/common/constants.d.ts +0 -1
  655. package/lib-esm/common/constants.js +0 -6
  656. package/lib-esm/common/constants.js.map +0 -1
  657. package/lib-esm/common/eventListeners/index.js +0 -53
  658. package/lib-esm/common/eventListeners/index.js.map +0 -1
  659. package/lib-esm/common/eventListeners/types.d.ts +0 -7
  660. package/lib-esm/common/eventListeners/types.js.map +0 -1
  661. package/lib-esm/common/index.d.ts +0 -4
  662. package/lib-esm/common/index.js.map +0 -1
  663. package/lib-esm/index.js.map +0 -1
  664. package/lib-esm/types.d.ts +0 -39
  665. package/lib-esm/types.js +0 -3
  666. package/lib-esm/types.js.map +0 -1
  667. package/src/InAppMessaging/InAppMessaging.ts +0 -321
  668. package/src/InAppMessaging/Providers/AWSPinpointProvider/index.ts +0 -323
  669. package/src/InAppMessaging/SessionTracker/SessionTracker.native.ts +0 -60
  670. package/src/InAppMessaging/SessionTracker/SessionTracker.ts +0 -78
  671. package/src/InAppMessaging/SessionTracker/index.ts +0 -6
  672. package/src/InAppMessaging/SessionTracker/types.ts +0 -11
  673. package/src/InAppMessaging/types.ts +0 -142
  674. package/src/Notifications.ts +0 -90
  675. package/src/PushNotification/NotEnabledError.ts +0 -11
  676. package/src/PushNotification/Platform/index.native.ts +0 -9
  677. package/src/PushNotification/Platform/index.ts +0 -22
  678. package/src/PushNotification/Platform/types.ts +0 -15
  679. package/src/PushNotification/PlatformNotSupportedError.ts +0 -9
  680. package/src/PushNotification/Providers/AWSPinpointProvider/index.ts +0 -137
  681. package/src/PushNotification/Providers/AWSPinpointProvider/types.ts +0 -13
  682. package/src/PushNotification/Providers/AWSPinpointProvider/utils.ts +0 -79
  683. package/src/PushNotification/PushNotification.native.ts +0 -386
  684. package/src/PushNotification/PushNotification.ts +0 -107
  685. package/src/PushNotification/index.ts +0 -9
  686. package/src/PushNotification/types.ts +0 -115
  687. package/src/PushNotification/utils.ts +0 -112
  688. package/src/common/AWSPinpointProviderCommon/index.ts +0 -291
  689. package/src/common/AWSPinpointProviderCommon/types.ts +0 -29
  690. package/src/common/constants.ts +0 -7
  691. package/src/types.ts +0 -56
@@ -0,0 +1,22 @@
1
+ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
+ // SPDX-License-Identifier: Apache-2.0
3
+ import { defaultStorage } from '@aws-amplify/core';
4
+ import { STORAGE_KEY_SUFFIX, PINPOINT_KEY_PREFIX } from '../utils';
5
+ import { assertIsInitialized } from '../../../utils';
6
+ /**
7
+ * Clear locally cached messages.
8
+ *
9
+ * @throws validation: {@link InAppMessagingValidationErrorCode} - Thrown if In App messaging hasn't been initialized.
10
+ * @returns A promise that will resolve when the operation is complete.
11
+ * @example
12
+ * ```ts
13
+ * // Clear locally cached messages.
14
+ * await clearMessages();
15
+ *
16
+ * ```
17
+ */
18
+ export async function clearMessages() {
19
+ assertIsInitialized();
20
+ const key = `${PINPOINT_KEY_PREFIX}${STORAGE_KEY_SUFFIX}`;
21
+ return await defaultStorage.removeItem(key);
22
+ }
@@ -0,0 +1,26 @@
1
+ import { DispatchEventInput } from '../types';
2
+ /**
3
+ * Triggers an In-App message to be displayed. Use this after your campaigns have been synced to the device using
4
+ * {@link syncMessages}. Based on the messages synced and the event passed to this API, it triggers the display
5
+ * of the In-App message that meets the criteria.
6
+ *
7
+ * @remark
8
+ * If an event would trigger multiple messages, the message closest to expiry will be chosen by default.
9
+ * To change this behavior, you can use the {@link setConflictHandler} API to provide
10
+ * your own logic for resolving message conflicts.
11
+ *
12
+ * @param DispatchEventInput The input object that holds the event to be dispatched.
13
+ * @throws validation: {@link InAppMessagingValidationErrorCode} - Thrown when the provided parameters or library
14
+ * configuration is incorrect, or if In App messaging hasn't been initialized.
15
+ * @throws service exceptions - Thrown when the underlying Pinpoint service returns an error.
16
+ * @returns A promise that will resolve when the operation is complete.
17
+ * @example
18
+ * ```ts
19
+ * // Sync message before disptaching an event
20
+ * await syncMessages();
21
+ *
22
+ * // Dispatch an event
23
+ * await dispatchEvent({ name: 'test_event' });
24
+ * ```
25
+ */
26
+ export declare function dispatchEvent(input: DispatchEventInput): Promise<void>;
@@ -0,0 +1,49 @@
1
+ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
+ // SPDX-License-Identifier: Apache-2.0
3
+ import { PINPOINT_KEY_PREFIX, STORAGE_KEY_SUFFIX, processInAppMessages, } from '../utils';
4
+ import flatten from 'lodash/flatten';
5
+ import { defaultStorage } from '@aws-amplify/core';
6
+ import { notifyEventListeners } from '../../../../eventListeners';
7
+ import { assertServiceError } from '../../../errors';
8
+ import { conflictHandler } from './setConflictHandler';
9
+ import { assertIsInitialized } from '../../../utils';
10
+ /**
11
+ * Triggers an In-App message to be displayed. Use this after your campaigns have been synced to the device using
12
+ * {@link syncMessages}. Based on the messages synced and the event passed to this API, it triggers the display
13
+ * of the In-App message that meets the criteria.
14
+ *
15
+ * @remark
16
+ * If an event would trigger multiple messages, the message closest to expiry will be chosen by default.
17
+ * To change this behavior, you can use the {@link setConflictHandler} API to provide
18
+ * your own logic for resolving message conflicts.
19
+ *
20
+ * @param DispatchEventInput The input object that holds the event to be dispatched.
21
+ * @throws validation: {@link InAppMessagingValidationErrorCode} - Thrown when the provided parameters or library
22
+ * configuration is incorrect, or if In App messaging hasn't been initialized.
23
+ * @throws service exceptions - Thrown when the underlying Pinpoint service returns an error.
24
+ * @returns A promise that will resolve when the operation is complete.
25
+ * @example
26
+ * ```ts
27
+ * // Sync message before disptaching an event
28
+ * await syncMessages();
29
+ *
30
+ * // Dispatch an event
31
+ * await dispatchEvent({ name: 'test_event' });
32
+ * ```
33
+ */
34
+ export async function dispatchEvent(input) {
35
+ assertIsInitialized();
36
+ try {
37
+ const key = `${PINPOINT_KEY_PREFIX}${STORAGE_KEY_SUFFIX}`;
38
+ const cachedMessages = await defaultStorage.getItem(key);
39
+ const messages = await processInAppMessages(cachedMessages ? JSON.parse(cachedMessages) : [], input);
40
+ const flattenedMessages = flatten(messages);
41
+ if (flattenedMessages.length > 0) {
42
+ notifyEventListeners('messageReceived', conflictHandler(flattenedMessages));
43
+ }
44
+ }
45
+ catch (error) {
46
+ assertServiceError(error);
47
+ throw error;
48
+ }
49
+ }
@@ -0,0 +1,51 @@
1
+ import { IdentifyUserInput } from '../types';
2
+ /**
3
+ * Sends information about a user to Pinpoint. Sending user information allows you to associate a user to their user
4
+ * profile and activities or actions in your application. Activity can be tracked across devices & platforms by using
5
+ * the same `userId`.
6
+ *
7
+ * @param {IdentifyUserParameters} params The input object used to construct requests sent to Pinpoint's UpdateEndpoint
8
+ * API.
9
+ * @throws service: {@link UpdateEndpointException} - Thrown when the underlying Pinpoint service returns an error.
10
+ * @throws validation: {@link InAppMessagingValidationErrorCode} - Thrown when the provided parameters or library
11
+ * configuration is incorrect, or if In App messaging hasn't been initialized.
12
+ * @returns A promise that will resolve when the operation is complete.
13
+ * @example
14
+ * ```ts
15
+ * // Identify a user with Pinpoint
16
+ * await identifyUser({
17
+ * userId,
18
+ * userProfile: {
19
+ * email: 'userEmail@example.com'
20
+ * customProperties: {
21
+ * phoneNumber: ['555-555-5555'],
22
+ * },
23
+ * }
24
+ * });
25
+ * ```
26
+ *
27
+ * @example
28
+ * ```ts
29
+ * // Identify a user with Pinpoint specific options
30
+ * await identifyUser({
31
+ * userId,
32
+ * userProfile: {
33
+ * email: 'userEmail@example.com'
34
+ * customProperties: {
35
+ * phoneNumber: ['555-555-5555'],
36
+ * },
37
+ * demographic: {
38
+ * platform: 'ios',
39
+ * timezone: 'America/Los_Angeles'
40
+ * }
41
+ * },
42
+ * options: {
43
+ * address: 'device-address',
44
+ * optOut: 'NONE',
45
+ * userAttributes: {
46
+ * interests: ['food']
47
+ * },
48
+ * },
49
+ * });
50
+ */
51
+ export declare const identifyUser: ({ userId, userProfile, options, }: IdentifyUserInput) => Promise<void>;
@@ -0,0 +1,75 @@
1
+ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
+ // SPDX-License-Identifier: Apache-2.0
3
+ import { InAppMessagingAction } from '@aws-amplify/core/internals/utils';
4
+ import { updateEndpoint, } from '@aws-amplify/core/internals/providers/pinpoint';
5
+ import { CATEGORY, CHANNEL_TYPE, getInAppMessagingUserAgentString, resolveConfig, resolveCredentials, } from '../utils';
6
+ import { assertIsInitialized } from '../../../utils';
7
+ /**
8
+ * Sends information about a user to Pinpoint. Sending user information allows you to associate a user to their user
9
+ * profile and activities or actions in your application. Activity can be tracked across devices & platforms by using
10
+ * the same `userId`.
11
+ *
12
+ * @param {IdentifyUserParameters} params The input object used to construct requests sent to Pinpoint's UpdateEndpoint
13
+ * API.
14
+ * @throws service: {@link UpdateEndpointException} - Thrown when the underlying Pinpoint service returns an error.
15
+ * @throws validation: {@link InAppMessagingValidationErrorCode} - Thrown when the provided parameters or library
16
+ * configuration is incorrect, or if In App messaging hasn't been initialized.
17
+ * @returns A promise that will resolve when the operation is complete.
18
+ * @example
19
+ * ```ts
20
+ * // Identify a user with Pinpoint
21
+ * await identifyUser({
22
+ * userId,
23
+ * userProfile: {
24
+ * email: 'userEmail@example.com'
25
+ * customProperties: {
26
+ * phoneNumber: ['555-555-5555'],
27
+ * },
28
+ * }
29
+ * });
30
+ * ```
31
+ *
32
+ * @example
33
+ * ```ts
34
+ * // Identify a user with Pinpoint specific options
35
+ * await identifyUser({
36
+ * userId,
37
+ * userProfile: {
38
+ * email: 'userEmail@example.com'
39
+ * customProperties: {
40
+ * phoneNumber: ['555-555-5555'],
41
+ * },
42
+ * demographic: {
43
+ * platform: 'ios',
44
+ * timezone: 'America/Los_Angeles'
45
+ * }
46
+ * },
47
+ * options: {
48
+ * address: 'device-address',
49
+ * optOut: 'NONE',
50
+ * userAttributes: {
51
+ * interests: ['food']
52
+ * },
53
+ * },
54
+ * });
55
+ */
56
+ export const identifyUser = async ({ userId, userProfile, options, }) => {
57
+ assertIsInitialized();
58
+ const { credentials, identityId } = await resolveCredentials();
59
+ const { appId, region } = resolveConfig();
60
+ const { address, optOut, userAttributes } = options ?? {};
61
+ updateEndpoint({
62
+ address,
63
+ channelType: CHANNEL_TYPE,
64
+ optOut,
65
+ appId,
66
+ category: CATEGORY,
67
+ credentials,
68
+ identityId,
69
+ region,
70
+ userAttributes,
71
+ userId,
72
+ userProfile,
73
+ userAgentValue: getInAppMessagingUserAgentString(InAppMessagingAction.IdentifyUser),
74
+ });
75
+ };
@@ -0,0 +1,11 @@
1
+ export { identifyUser } from './identifyUser';
2
+ export { syncMessages } from './syncMessages';
3
+ export { dispatchEvent } from './dispatchEvent';
4
+ export { setConflictHandler } from './setConflictHandler';
5
+ export { initializeInAppMessaging } from './initializeInAppMessaging';
6
+ export { onMessageReceived } from './onMessageReceived';
7
+ export { onMessageDismissed } from './onMessageDismissed';
8
+ export { onMessageDisplayed } from './onMessageDisplayed';
9
+ export { onMessageActionTaken } from './onMessageActionTaken';
10
+ export { notifyMessageInteraction } from './notifyMessageInteraction';
11
+ export { clearMessages } from './clearMessages';
@@ -0,0 +1,13 @@
1
+ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
+ // SPDX-License-Identifier: Apache-2.0
3
+ export { identifyUser } from './identifyUser';
4
+ export { syncMessages } from './syncMessages';
5
+ export { dispatchEvent } from './dispatchEvent';
6
+ export { setConflictHandler } from './setConflictHandler';
7
+ export { initializeInAppMessaging } from './initializeInAppMessaging';
8
+ export { onMessageReceived } from './onMessageReceived';
9
+ export { onMessageDismissed } from './onMessageDismissed';
10
+ export { onMessageDisplayed } from './onMessageDisplayed';
11
+ export { onMessageActionTaken } from './onMessageActionTaken';
12
+ export { notifyMessageInteraction } from './notifyMessageInteraction';
13
+ export { clearMessages } from './clearMessages';
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Initialize and set up in-app messaging category. This API needs to be called to enable other InAppMessaging APIs.
3
+ *
4
+ * @remarks
5
+ * Make sure to call this early in your app at the root entry point after configuring Amplify.
6
+ * @example
7
+ * ```ts
8
+ * Amplify.configure(config);
9
+ * initializeInAppMessaging();
10
+ * ```
11
+ */
12
+ export declare function initializeInAppMessaging(): void;
@@ -0,0 +1,53 @@
1
+ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
+ // SPDX-License-Identifier: Apache-2.0
3
+ import { sessionListener } from '@aws-amplify/core/internals/utils';
4
+ import { addEventListener } from '../../../../eventListeners';
5
+ import { recordAnalyticsEvent } from '../utils/helpers';
6
+ import { PinpointMessageEvent } from '../types';
7
+ import { Hub } from '@aws-amplify/core';
8
+ import { dispatchEvent } from './dispatchEvent';
9
+ import { incrementMessageCounts, sessionStateChangeHandler } from '../utils';
10
+ import { isInitialized, initialize } from '../../../utils';
11
+ /**
12
+ * Initialize and set up in-app messaging category. This API needs to be called to enable other InAppMessaging APIs.
13
+ *
14
+ * @remarks
15
+ * Make sure to call this early in your app at the root entry point after configuring Amplify.
16
+ * @example
17
+ * ```ts
18
+ * Amplify.configure(config);
19
+ * initializeInAppMessaging();
20
+ * ```
21
+ */
22
+ export function initializeInAppMessaging() {
23
+ if (isInitialized()) {
24
+ return;
25
+ }
26
+ // register with the session listener
27
+ sessionListener.addStateChangeListener(sessionStateChangeHandler, true);
28
+ // wire up default Pinpoint message event handling
29
+ addEventListener('messageDisplayed', (message) => {
30
+ recordAnalyticsEvent(PinpointMessageEvent.MESSAGE_DISPLAYED, message);
31
+ incrementMessageCounts(message.id);
32
+ });
33
+ addEventListener('messageDismissed', (message) => {
34
+ recordAnalyticsEvent(PinpointMessageEvent.MESSAGE_DISMISSED, message);
35
+ });
36
+ addEventListener('messageActionTaken', (message) => {
37
+ recordAnalyticsEvent(PinpointMessageEvent.MESSAGE_ACTION_TAKEN, message);
38
+ });
39
+ // listen to analytics hub events
40
+ Hub.listen('analytics', analyticsListener);
41
+ initialize();
42
+ }
43
+ function analyticsListener({ payload, }) {
44
+ const { event, data } = payload;
45
+ switch (event) {
46
+ case 'record': {
47
+ dispatchEvent(data);
48
+ break;
49
+ }
50
+ default:
51
+ break;
52
+ }
53
+ }
@@ -0,0 +1,16 @@
1
+ import { NotifyMessageInteractionInput } from '../types/inputs';
2
+ /**
3
+ * Notifies the respective listener of the specified type with the message given.
4
+ *
5
+ * @param {NotifyMessageInteractionInput} input - The input object that holds the type and message.
6
+ * @throws validation: {@link InAppMessagingValidationErrorCode} - Thrown when the provided parameters or library
7
+ * configuration is incorrect, or if In App messaging hasn't been initialized.
8
+ * @example
9
+ * ```ts
10
+ * onMessageRecieved((message) => {
11
+ * // Show end users the In-App message and notify event listeners
12
+ * notifyMessageInteraction({ type: 'messageDisplayed', message });
13
+ * });
14
+ * ```
15
+ */
16
+ export declare function notifyMessageInteraction({ type, message, }: NotifyMessageInteractionInput): void;
@@ -0,0 +1,22 @@
1
+ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
+ // SPDX-License-Identifier: Apache-2.0
3
+ import { notifyEventListeners } from '../../../../eventListeners';
4
+ import { assertIsInitialized } from '../../../utils';
5
+ /**
6
+ * Notifies the respective listener of the specified type with the message given.
7
+ *
8
+ * @param {NotifyMessageInteractionInput} input - The input object that holds the type and message.
9
+ * @throws validation: {@link InAppMessagingValidationErrorCode} - Thrown when the provided parameters or library
10
+ * configuration is incorrect, or if In App messaging hasn't been initialized.
11
+ * @example
12
+ * ```ts
13
+ * onMessageRecieved((message) => {
14
+ * // Show end users the In-App message and notify event listeners
15
+ * notifyMessageInteraction({ type: 'messageDisplayed', message });
16
+ * });
17
+ * ```
18
+ */
19
+ export function notifyMessageInteraction({ type, message, }) {
20
+ assertIsInitialized();
21
+ notifyEventListeners(type, message);
22
+ }
@@ -0,0 +1,18 @@
1
+ import { OnMessageActionTakenInput } from '../types/inputs';
2
+ import { OnMessageActionTakenOutput } from '../types/outputs';
3
+ /**
4
+ * Registers a callback that will be invoked on `messageActionTaken` events.
5
+ *
6
+ * @param {OnMessageActionTakenInput} input - The input object that holds the callback handler.
7
+ * @throws validation: {@link InAppMessagingValidationErrorCode} - Thrown when the provided parameters or library
8
+ * configuration is incorrect, or if In App messaging hasn't been initialized.
9
+ * @returns {OnMessageActionTakenOutput} - An object that holds a remove method to stop listening to events.
10
+ * @example
11
+ * ```ts
12
+ * onMessageActionTaken((message) => {
13
+ * // use the message
14
+ * console.log(message.id);
15
+ * });
16
+ * ```
17
+ */
18
+ export declare function onMessageActionTaken(input: OnMessageActionTakenInput): OnMessageActionTakenOutput;
@@ -0,0 +1,23 @@
1
+ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
+ // SPDX-License-Identifier: Apache-2.0
3
+ import { addEventListener } from '../../../../eventListeners';
4
+ import { assertIsInitialized } from '../../../utils';
5
+ /**
6
+ * Registers a callback that will be invoked on `messageActionTaken` events.
7
+ *
8
+ * @param {OnMessageActionTakenInput} input - The input object that holds the callback handler.
9
+ * @throws validation: {@link InAppMessagingValidationErrorCode} - Thrown when the provided parameters or library
10
+ * configuration is incorrect, or if In App messaging hasn't been initialized.
11
+ * @returns {OnMessageActionTakenOutput} - An object that holds a remove method to stop listening to events.
12
+ * @example
13
+ * ```ts
14
+ * onMessageActionTaken((message) => {
15
+ * // use the message
16
+ * console.log(message.id);
17
+ * });
18
+ * ```
19
+ */
20
+ export function onMessageActionTaken(input) {
21
+ assertIsInitialized();
22
+ return addEventListener('messageActionTaken', input);
23
+ }
@@ -0,0 +1,18 @@
1
+ import { OnMessageDismissedOutput } from '../types/outputs';
2
+ import { OnMessageDismissedInput } from '../types/inputs';
3
+ /**
4
+ * Registers a callback that will be invoked on `messageDismissed` events.
5
+ *
6
+ * @param {OnMessageDismissedInput} input - The input object that holds the callback handler.
7
+ * @throws validation: {@link InAppMessagingValidationErrorCode} - Thrown when the provided parameters or library
8
+ * configuration is incorrect, or if In App messaging hasn't been initialized.
9
+ * @returns {OnMessageDismissedOutput} - An object that holds a remove method to stop listening to events.
10
+ * @example
11
+ * ```ts
12
+ * onMessageDismissed((message) => {
13
+ * // use the message
14
+ * console.log(message.id);
15
+ * });
16
+ * ```
17
+ */
18
+ export declare function onMessageDismissed(input: OnMessageDismissedInput): OnMessageDismissedOutput;
@@ -0,0 +1,23 @@
1
+ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
+ // SPDX-License-Identifier: Apache-2.0
3
+ import { addEventListener } from '../../../../eventListeners';
4
+ import { assertIsInitialized } from '../../../utils';
5
+ /**
6
+ * Registers a callback that will be invoked on `messageDismissed` events.
7
+ *
8
+ * @param {OnMessageDismissedInput} input - The input object that holds the callback handler.
9
+ * @throws validation: {@link InAppMessagingValidationErrorCode} - Thrown when the provided parameters or library
10
+ * configuration is incorrect, or if In App messaging hasn't been initialized.
11
+ * @returns {OnMessageDismissedOutput} - An object that holds a remove method to stop listening to events.
12
+ * @example
13
+ * ```ts
14
+ * onMessageDismissed((message) => {
15
+ * // use the message
16
+ * console.log(message.id);
17
+ * });
18
+ * ```
19
+ */
20
+ export function onMessageDismissed(input) {
21
+ assertIsInitialized();
22
+ return addEventListener('messageDismissed', input);
23
+ }
@@ -0,0 +1,18 @@
1
+ import { OnMessageDisplayedOutput } from '../types/outputs';
2
+ import { OnMessageDisplayedInput } from '../types/inputs';
3
+ /**
4
+ * Registers a callback that will be invoked on `messageDisplayed` events.
5
+ *
6
+ * @param {OnMessageDisplayedInput} input - The input object that holds the callback handler.
7
+ * @throws validation: {@link InAppMessagingValidationErrorCode} - Thrown when the provided parameters or library
8
+ * configuration is incorrect, or if In App messaging hasn't been initialized.
9
+ * @returns {OnMessageDismissedOutput} - An object that holds a remove method to stop listening to events.
10
+ * @example
11
+ * ```ts
12
+ * onMessageDisplayed((message) => {
13
+ * // use the message
14
+ * console.log(message.id);
15
+ * });
16
+ * ```
17
+ */
18
+ export declare function onMessageDisplayed(input: OnMessageDisplayedInput): OnMessageDisplayedOutput;
@@ -0,0 +1,23 @@
1
+ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
+ // SPDX-License-Identifier: Apache-2.0
3
+ import { addEventListener } from '../../../../eventListeners';
4
+ import { assertIsInitialized } from '../../../utils';
5
+ /**
6
+ * Registers a callback that will be invoked on `messageDisplayed` events.
7
+ *
8
+ * @param {OnMessageDisplayedInput} input - The input object that holds the callback handler.
9
+ * @throws validation: {@link InAppMessagingValidationErrorCode} - Thrown when the provided parameters or library
10
+ * configuration is incorrect, or if In App messaging hasn't been initialized.
11
+ * @returns {OnMessageDismissedOutput} - An object that holds a remove method to stop listening to events.
12
+ * @example
13
+ * ```ts
14
+ * onMessageDisplayed((message) => {
15
+ * // use the message
16
+ * console.log(message.id);
17
+ * });
18
+ * ```
19
+ */
20
+ export function onMessageDisplayed(input) {
21
+ assertIsInitialized();
22
+ return addEventListener('messageDisplayed', input);
23
+ }
@@ -0,0 +1,18 @@
1
+ import { OnMessageReceivedInput } from '../types/inputs';
2
+ import { OnMessageReceivedOutput } from '../types/outputs';
3
+ /**
4
+ * Registers a callback that will be invoked on `messageReceived` events.
5
+ *
6
+ * @param {OnMessageReceivedInput} input - The input object that holds the callback handler.
7
+ * @throws validation: {@link InAppMessagingValidationErrorCode} - Thrown when the provided parameters or library
8
+ * configuration is incorrect, or if In App messaging hasn't been initialized.
9
+ * @returns {OnMessageReceivedOutput} - An object that holds a remove method to stop listening to events.
10
+ * @example
11
+ * ```ts
12
+ * onMessageReceived((message) => {
13
+ * // use the message
14
+ * console.log(message.id);
15
+ * });
16
+ * ```
17
+ */
18
+ export declare function onMessageReceived(input: OnMessageReceivedInput): OnMessageReceivedOutput;
@@ -0,0 +1,23 @@
1
+ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
+ // SPDX-License-Identifier: Apache-2.0
3
+ import { addEventListener } from '../../../../eventListeners';
4
+ import { assertIsInitialized } from '../../../utils';
5
+ /**
6
+ * Registers a callback that will be invoked on `messageReceived` events.
7
+ *
8
+ * @param {OnMessageReceivedInput} input - The input object that holds the callback handler.
9
+ * @throws validation: {@link InAppMessagingValidationErrorCode} - Thrown when the provided parameters or library
10
+ * configuration is incorrect, or if In App messaging hasn't been initialized.
11
+ * @returns {OnMessageReceivedOutput} - An object that holds a remove method to stop listening to events.
12
+ * @example
13
+ * ```ts
14
+ * onMessageReceived((message) => {
15
+ * // use the message
16
+ * console.log(message.id);
17
+ * });
18
+ * ```
19
+ */
20
+ export function onMessageReceived(input) {
21
+ assertIsInitialized();
22
+ return addEventListener('messageReceived', input);
23
+ }
@@ -0,0 +1,32 @@
1
+ import { InAppMessageConflictHandler, SetConflictHandlerInput } from '../types';
2
+ export declare let conflictHandler: InAppMessageConflictHandler;
3
+ /**
4
+ * Set a conflict handler that will be used to resolve conflicts that may emerge
5
+ * when matching events with synced messages.
6
+ *
7
+ * @remark
8
+ * The conflict handler is not persisted across app restarts and so must be set again before dispatching an event for
9
+ * any custom handling to take effect.
10
+ * @throws validation: {@link InAppMessagingValidationErrorCode} - Thrown when the provided parameters or library
11
+ * configuration is incorrect, or if In App messaging hasn't been initialized.
12
+ * @param SetConflictHandlerInput: The input object that holds the conflict handler to be used.
13
+ * @example
14
+ * ```ts
15
+ * // Sync messages before dispatching an event
16
+ * await syncMessages();
17
+ *
18
+ * // Example custom conflict handler
19
+ * const myConflictHandler = (messages) => {
20
+ * // Return a random message
21
+ * const randomIndex = Math.floor(Math.random() * messages.length);
22
+ * return messages[randomIndex];
23
+ * };
24
+ *
25
+ * // Set the conflict handler
26
+ * setConflictHandler(myConflictHandler);
27
+ *
28
+ * // Dispatch an event
29
+ * await dispatchEvent({ name: 'test_event' });
30
+ * ```
31
+ */
32
+ export declare function setConflictHandler(input: SetConflictHandlerInput): void;
@@ -0,0 +1,61 @@
1
+ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
+ // SPDX-License-Identifier: Apache-2.0
3
+ import { assertIsInitialized } from '../../../utils';
4
+ export let conflictHandler = defaultConflictHandler;
5
+ /**
6
+ * Set a conflict handler that will be used to resolve conflicts that may emerge
7
+ * when matching events with synced messages.
8
+ *
9
+ * @remark
10
+ * The conflict handler is not persisted across app restarts and so must be set again before dispatching an event for
11
+ * any custom handling to take effect.
12
+ * @throws validation: {@link InAppMessagingValidationErrorCode} - Thrown when the provided parameters or library
13
+ * configuration is incorrect, or if In App messaging hasn't been initialized.
14
+ * @param SetConflictHandlerInput: The input object that holds the conflict handler to be used.
15
+ * @example
16
+ * ```ts
17
+ * // Sync messages before dispatching an event
18
+ * await syncMessages();
19
+ *
20
+ * // Example custom conflict handler
21
+ * const myConflictHandler = (messages) => {
22
+ * // Return a random message
23
+ * const randomIndex = Math.floor(Math.random() * messages.length);
24
+ * return messages[randomIndex];
25
+ * };
26
+ *
27
+ * // Set the conflict handler
28
+ * setConflictHandler(myConflictHandler);
29
+ *
30
+ * // Dispatch an event
31
+ * await dispatchEvent({ name: 'test_event' });
32
+ * ```
33
+ */
34
+ export function setConflictHandler(input) {
35
+ assertIsInitialized();
36
+ conflictHandler = input;
37
+ }
38
+ function defaultConflictHandler(messages) {
39
+ // default behavior is to return the message closest to expiry
40
+ // this function assumes that messages processed by providers already filters out expired messages
41
+ const sorted = messages.sort((a, b) => {
42
+ const endDateA = a.metadata?.endDate;
43
+ const endDateB = b.metadata?.endDate;
44
+ // if both message end dates are falsy or have the same date string, treat them as equal
45
+ if (endDateA === endDateB) {
46
+ return 0;
47
+ }
48
+ // if only message A has an end date, treat it as closer to expiry
49
+ if (endDateA && !endDateB) {
50
+ return -1;
51
+ }
52
+ // if only message B has an end date, treat it as closer to expiry
53
+ if (!endDateA && endDateB) {
54
+ return 1;
55
+ }
56
+ // otherwise, compare them
57
+ return new Date(endDateA) < new Date(endDateB) ? -1 : 1;
58
+ });
59
+ // always return the top sorted
60
+ return sorted[0];
61
+ }
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Fetch and persist messages from Pinpoint campaigns.
3
+ * Calling this API is necessary to trigger InApp messages on the device.
4
+ *
5
+ * @throws service exceptions - Thrown when the underlying Pinpoint service returns an error.
6
+ * @throws validation: {@link InAppMessagingValidationErrorCode} - Thrown when the provided parameters or library
7
+ * configuration is incorrect, or if In App messaging hasn't been initialized.
8
+ * @returns A promise that will resolve when the operation is complete.
9
+ * @example
10
+ * ```ts
11
+ * // Sync InApp messages with Pinpoint and device.
12
+ * await syncMessages();
13
+ *
14
+ * ```
15
+ */
16
+ export declare function syncMessages(): Promise<void>;