@aws-amplify/notifications 1.0.25 → 1.0.26-unstable.1b5840e.8

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 (208) hide show
  1. package/lib/InAppMessaging/InAppMessaging.d.ts +10 -8
  2. package/lib/InAppMessaging/InAppMessaging.js +9 -11
  3. package/lib/InAppMessaging/InAppMessaging.js.map +1 -1
  4. package/lib/InAppMessaging/Providers/AWSPinpointProvider/index.d.ts +5 -25
  5. package/lib/InAppMessaging/Providers/AWSPinpointProvider/index.js +37 -252
  6. package/lib/InAppMessaging/Providers/AWSPinpointProvider/index.js.map +1 -1
  7. package/lib/InAppMessaging/Providers/AWSPinpointProvider/types.d.ts +0 -9
  8. package/lib/InAppMessaging/Providers/AWSPinpointProvider/types.js.map +1 -1
  9. package/lib/InAppMessaging/Providers/AWSPinpointProvider/utils.js +3 -9
  10. package/lib/InAppMessaging/Providers/AWSPinpointProvider/utils.js.map +1 -1
  11. package/lib/InAppMessaging/index.d.ts +1 -3
  12. package/lib/InAppMessaging/index.js +0 -2
  13. package/lib/InAppMessaging/index.js.map +1 -1
  14. package/lib/InAppMessaging/types.d.ts +30 -42
  15. package/lib/InAppMessaging/types.js +2 -0
  16. package/lib/InAppMessaging/types.js.map +1 -1
  17. package/lib/Notifications.d.ts +6 -2
  18. package/lib/Notifications.js +45 -0
  19. package/lib/Notifications.js.map +1 -1
  20. package/lib/PushNotification/NotEnabledError.d.ts +3 -0
  21. package/lib/PushNotification/NotEnabledError.js +16 -0
  22. package/lib/PushNotification/NotEnabledError.js.map +1 -0
  23. package/lib/PushNotification/Platform/index.d.ts +2 -0
  24. package/lib/PushNotification/Platform/index.js +26 -0
  25. package/lib/PushNotification/Platform/index.js.map +1 -0
  26. package/lib/PushNotification/Platform/index.native.d.ts +2 -0
  27. package/lib/PushNotification/Platform/index.native.js +8 -0
  28. package/lib/PushNotification/Platform/index.native.js.map +1 -0
  29. package/lib/PushNotification/Platform/types.d.ts +5 -0
  30. package/lib/PushNotification/Platform/types.js +5 -0
  31. package/lib/PushNotification/Platform/types.js.map +1 -0
  32. package/lib/PushNotification/PlatformNotSupportedError.d.ts +3 -0
  33. package/lib/PushNotification/PlatformNotSupportedError.js +16 -0
  34. package/lib/PushNotification/PlatformNotSupportedError.js.map +1 -0
  35. package/lib/PushNotification/Providers/AWSPinpointProvider/index.d.ts +15 -0
  36. package/lib/PushNotification/Providers/AWSPinpointProvider/index.js +115 -0
  37. package/lib/PushNotification/Providers/AWSPinpointProvider/index.js.map +1 -0
  38. package/lib/PushNotification/Providers/AWSPinpointProvider/types.d.ts +9 -0
  39. package/lib/PushNotification/Providers/AWSPinpointProvider/types.js +16 -0
  40. package/lib/PushNotification/Providers/AWSPinpointProvider/types.js.map +1 -0
  41. package/lib/PushNotification/Providers/AWSPinpointProvider/utils.d.ts +7 -0
  42. package/lib/PushNotification/Providers/AWSPinpointProvider/utils.js +58 -0
  43. package/lib/PushNotification/Providers/AWSPinpointProvider/utils.js.map +1 -0
  44. package/lib/PushNotification/Providers/index.d.ts +1 -0
  45. package/lib/PushNotification/Providers/index.js +7 -0
  46. package/lib/PushNotification/Providers/index.js.map +1 -0
  47. package/lib/PushNotification/PushNotification.d.ts +39 -0
  48. package/lib/PushNotification/PushNotification.js +91 -0
  49. package/lib/PushNotification/PushNotification.js.map +1 -0
  50. package/lib/PushNotification/PushNotification.native.d.ts +63 -0
  51. package/lib/PushNotification/PushNotification.native.js +327 -0
  52. package/lib/PushNotification/PushNotification.native.js.map +1 -0
  53. package/lib/PushNotification/index.d.ts +2 -0
  54. package/lib/PushNotification/index.js +9 -0
  55. package/lib/PushNotification/index.js.map +1 -0
  56. package/lib/PushNotification/types.d.ts +77 -0
  57. package/lib/PushNotification/types.js +12 -0
  58. package/lib/PushNotification/types.js.map +1 -0
  59. package/lib/PushNotification/utils.d.ts +3 -0
  60. package/lib/PushNotification/utils.js +81 -0
  61. package/lib/PushNotification/utils.js.map +1 -0
  62. package/lib/common/AWSPinpointProviderCommon/index.d.ts +34 -0
  63. package/lib/common/AWSPinpointProviderCommon/index.js +281 -0
  64. package/lib/common/AWSPinpointProviderCommon/index.js.map +1 -0
  65. package/lib/common/AWSPinpointProviderCommon/types.d.ts +9 -0
  66. package/lib/common/AWSPinpointProviderCommon/types.js +5 -0
  67. package/lib/common/AWSPinpointProviderCommon/types.js.map +1 -0
  68. package/lib/common/constants.d.ts +1 -0
  69. package/lib/common/constants.js +6 -0
  70. package/lib/common/constants.js.map +1 -0
  71. package/lib/common/eventListeners/index.d.ts +4 -0
  72. package/lib/common/eventListeners/index.js +55 -0
  73. package/lib/common/eventListeners/index.js.map +1 -0
  74. package/lib/common/eventListeners/types.d.ts +7 -0
  75. package/lib/common/eventListeners/types.js +5 -0
  76. package/lib/common/eventListeners/types.js.map +1 -0
  77. package/lib/common/index.d.ts +4 -0
  78. package/lib/common/index.js +13 -0
  79. package/lib/common/index.js.map +1 -0
  80. package/lib/index.d.ts +5 -2
  81. package/lib/index.js +4 -0
  82. package/lib/index.js.map +1 -1
  83. package/lib/types.d.ts +34 -2
  84. package/lib/types.js +2 -0
  85. package/lib/types.js.map +1 -1
  86. package/lib-esm/InAppMessaging/InAppMessaging.d.ts +10 -8
  87. package/lib-esm/InAppMessaging/InAppMessaging.js +9 -11
  88. package/lib-esm/InAppMessaging/InAppMessaging.js.map +1 -1
  89. package/lib-esm/InAppMessaging/Providers/AWSPinpointProvider/index.d.ts +5 -25
  90. package/lib-esm/InAppMessaging/Providers/AWSPinpointProvider/index.js +39 -254
  91. package/lib-esm/InAppMessaging/Providers/AWSPinpointProvider/index.js.map +1 -1
  92. package/lib-esm/InAppMessaging/Providers/AWSPinpointProvider/types.d.ts +0 -9
  93. package/lib-esm/InAppMessaging/Providers/AWSPinpointProvider/types.js.map +1 -1
  94. package/lib-esm/InAppMessaging/Providers/AWSPinpointProvider/utils.js +2 -8
  95. package/lib-esm/InAppMessaging/Providers/AWSPinpointProvider/utils.js.map +1 -1
  96. package/lib-esm/InAppMessaging/index.d.ts +1 -3
  97. package/lib-esm/InAppMessaging/index.js +0 -1
  98. package/lib-esm/InAppMessaging/index.js.map +1 -1
  99. package/lib-esm/InAppMessaging/types.d.ts +30 -42
  100. package/lib-esm/InAppMessaging/types.js +2 -0
  101. package/lib-esm/InAppMessaging/types.js.map +1 -1
  102. package/lib-esm/Notifications.d.ts +6 -2
  103. package/lib-esm/Notifications.js +48 -3
  104. package/lib-esm/Notifications.js.map +1 -1
  105. package/lib-esm/PushNotification/NotEnabledError.d.ts +3 -0
  106. package/lib-esm/PushNotification/NotEnabledError.js +14 -0
  107. package/lib-esm/PushNotification/NotEnabledError.js.map +1 -0
  108. package/lib-esm/PushNotification/Platform/index.d.ts +2 -0
  109. package/lib-esm/PushNotification/Platform/index.js +24 -0
  110. package/lib-esm/PushNotification/Platform/index.js.map +1 -0
  111. package/lib-esm/PushNotification/Platform/index.native.d.ts +2 -0
  112. package/lib-esm/PushNotification/Platform/index.native.js +6 -0
  113. package/lib-esm/PushNotification/Platform/index.native.js.map +1 -0
  114. package/lib-esm/PushNotification/Platform/types.d.ts +5 -0
  115. package/lib-esm/PushNotification/Platform/types.js +3 -0
  116. package/lib-esm/PushNotification/Platform/types.js.map +1 -0
  117. package/lib-esm/PushNotification/PlatformNotSupportedError.d.ts +3 -0
  118. package/lib-esm/PushNotification/PlatformNotSupportedError.js +14 -0
  119. package/lib-esm/PushNotification/PlatformNotSupportedError.js.map +1 -0
  120. package/lib-esm/PushNotification/Providers/AWSPinpointProvider/index.d.ts +15 -0
  121. package/lib-esm/PushNotification/Providers/AWSPinpointProvider/index.js +113 -0
  122. package/lib-esm/PushNotification/Providers/AWSPinpointProvider/index.js.map +1 -0
  123. package/lib-esm/PushNotification/Providers/AWSPinpointProvider/types.d.ts +9 -0
  124. package/lib-esm/PushNotification/Providers/AWSPinpointProvider/types.js +14 -0
  125. package/lib-esm/PushNotification/Providers/AWSPinpointProvider/types.js.map +1 -0
  126. package/lib-esm/PushNotification/Providers/AWSPinpointProvider/utils.d.ts +7 -0
  127. package/lib-esm/PushNotification/Providers/AWSPinpointProvider/utils.js +56 -0
  128. package/lib-esm/PushNotification/Providers/AWSPinpointProvider/utils.js.map +1 -0
  129. package/lib-esm/PushNotification/Providers/index.d.ts +1 -0
  130. package/lib-esm/PushNotification/Providers/index.js +4 -0
  131. package/lib-esm/PushNotification/Providers/index.js.map +1 -0
  132. package/lib-esm/PushNotification/PushNotification.d.ts +39 -0
  133. package/lib-esm/PushNotification/PushNotification.js +89 -0
  134. package/lib-esm/PushNotification/PushNotification.js.map +1 -0
  135. package/lib-esm/PushNotification/PushNotification.native.d.ts +63 -0
  136. package/lib-esm/PushNotification/PushNotification.native.js +325 -0
  137. package/lib-esm/PushNotification/PushNotification.native.js.map +1 -0
  138. package/lib-esm/PushNotification/index.d.ts +2 -0
  139. package/lib-esm/PushNotification/index.js +5 -0
  140. package/lib-esm/PushNotification/index.js.map +1 -0
  141. package/lib-esm/PushNotification/types.d.ts +77 -0
  142. package/lib-esm/PushNotification/types.js +10 -0
  143. package/lib-esm/PushNotification/types.js.map +1 -0
  144. package/lib-esm/PushNotification/utils.d.ts +3 -0
  145. package/lib-esm/PushNotification/utils.js +79 -0
  146. package/lib-esm/PushNotification/utils.js.map +1 -0
  147. package/lib-esm/common/AWSPinpointProviderCommon/index.d.ts +34 -0
  148. package/lib-esm/common/AWSPinpointProviderCommon/index.js +279 -0
  149. package/lib-esm/common/AWSPinpointProviderCommon/index.js.map +1 -0
  150. package/lib-esm/common/AWSPinpointProviderCommon/types.d.ts +9 -0
  151. package/lib-esm/common/AWSPinpointProviderCommon/types.js +3 -0
  152. package/lib-esm/common/AWSPinpointProviderCommon/types.js.map +1 -0
  153. package/lib-esm/common/constants.d.ts +1 -0
  154. package/lib-esm/common/constants.js +4 -0
  155. package/lib-esm/common/constants.js.map +1 -0
  156. package/lib-esm/common/eventListeners/index.d.ts +4 -0
  157. package/lib-esm/common/eventListeners/index.js +53 -0
  158. package/lib-esm/common/eventListeners/index.js.map +1 -0
  159. package/lib-esm/common/eventListeners/types.d.ts +7 -0
  160. package/lib-esm/common/eventListeners/types.js +3 -0
  161. package/lib-esm/common/eventListeners/types.js.map +1 -0
  162. package/lib-esm/common/index.d.ts +4 -0
  163. package/lib-esm/common/index.js +6 -0
  164. package/lib-esm/common/index.js.map +1 -0
  165. package/lib-esm/index.d.ts +5 -2
  166. package/lib-esm/index.js +2 -0
  167. package/lib-esm/index.js.map +1 -1
  168. package/lib-esm/types.d.ts +34 -2
  169. package/lib-esm/types.js +2 -0
  170. package/lib-esm/types.js.map +1 -1
  171. package/package.json +11 -50
  172. package/src/InAppMessaging/InAppMessaging.ts +27 -36
  173. package/src/InAppMessaging/Providers/AWSPinpointProvider/index.ts +45 -245
  174. package/src/InAppMessaging/Providers/AWSPinpointProvider/types.ts +0 -12
  175. package/src/InAppMessaging/Providers/AWSPinpointProvider/utils.ts +3 -12
  176. package/src/InAppMessaging/index.ts +0 -3
  177. package/src/InAppMessaging/types.ts +52 -56
  178. package/src/Notifications.ts +42 -4
  179. package/src/PushNotification/NotEnabledError.ts +11 -0
  180. package/src/PushNotification/Platform/index.native.ts +9 -0
  181. package/src/PushNotification/Platform/index.ts +22 -0
  182. package/src/PushNotification/Platform/types.ts +15 -0
  183. package/src/PushNotification/PlatformNotSupportedError.ts +9 -0
  184. package/src/PushNotification/Providers/AWSPinpointProvider/index.ts +137 -0
  185. package/src/PushNotification/Providers/AWSPinpointProvider/types.ts +13 -0
  186. package/src/PushNotification/Providers/AWSPinpointProvider/utils.ts +79 -0
  187. package/src/PushNotification/Providers/index.ts +4 -0
  188. package/src/PushNotification/PushNotification.native.ts +381 -0
  189. package/src/PushNotification/PushNotification.ts +107 -0
  190. package/src/PushNotification/index.ts +9 -0
  191. package/src/PushNotification/types.ts +114 -0
  192. package/src/PushNotification/utils.ts +112 -0
  193. package/src/common/AWSPinpointProviderCommon/index.ts +295 -0
  194. package/src/common/AWSPinpointProviderCommon/types.ts +14 -0
  195. package/src/common/constants.ts +5 -0
  196. package/src/common/eventListeners/index.ts +44 -0
  197. package/src/common/eventListeners/types.ts +12 -0
  198. package/src/common/index.ts +11 -0
  199. package/src/index.ts +9 -3
  200. package/src/types.ts +47 -2
  201. package/CHANGELOG.md +0 -215
  202. package/lib/InAppMessaging/eventListeners.d.ts +0 -3
  203. package/lib/InAppMessaging/eventListeners.js +0 -28
  204. package/lib/InAppMessaging/eventListeners.js.map +0 -1
  205. package/lib-esm/InAppMessaging/eventListeners.d.ts +0 -3
  206. package/lib-esm/InAppMessaging/eventListeners.js +0 -26
  207. package/lib-esm/InAppMessaging/eventListeners.js.map +0 -1
  208. package/src/InAppMessaging/eventListeners.ts +0 -42
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PushNotification.native.js","sourceRoot":"","sources":["../../src/PushNotification/PushNotification.native.ts"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;;;AAEtC,6CAA+D;AAC/D,0CAA4D;AAC5D,4EAG4C;AAE5C,oCAKmB;AAEnB,8EAAgD;AAChD,yCAAkD;AAalD,iCAGiB;AAEjB,IAAM,MAAM,GAAG,IAAI,oBAAM,CAAC,gCAAgC,CAAC,CAAC;AAC5D,IAAM,UAAU,GAAG,oCAAoC,CAAC;AACxD,IAAM,uBAAuB,GAAG,EAAE,CAAC,CAAC,UAAU;AAE9C;IAUC;QAAA,iBAcC;QAvBO,cAAS,GAAG,KAAK,CAAC;QAClB,WAAM,GAAwB,EAAE,CAAC;QAKjC,eAAU,GAA+B,EAAE,CAAC;QAmBpD;;;WAGG;QACH,cAAS,GAAG,UAAC,MAAmC;YAAnC,uBAAA,EAAA,WAAmC;YAC/C,KAAI,CAAC,MAAM,yCAAQ,KAAI,CAAC,MAAM,GAAK,MAAM,CAAE,CAAC;YAE5C,MAAM,CAAC,KAAK,CAAC,4BAA4B,EAAE,KAAI,CAAC,MAAM,CAAC,CAAC;YAExD,KAAI,CAAC,UAAU,CAAC,OAAO,CA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AkD,EAAE,KAAG,CAAC,CAAC;oCACtE,MAAM,KAAG,CAAC;;;;yBAEX,CAAC,CACF,EAAC;;aACF,CAAC;QAEM,oBAAe,GAAG;YACzB,IAAI,CAAC,KAAI,CAAC,SAAS,EAAE;gBACpB,MAAM,IAAI,yBAAe,EAAE,CAAC;aAC5B;QACF,CAAC,CAAC;QAxUD,IAAI;YACH,IAAI,CAAC,YAAY,GAAG,kDAA0B,CAAC;YACzC,IAAA,qCAC2B,EADzB,4BAAW,EAAE,gDACY,CAAC;YAClC,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;YAC/B,IAAI,CAAC,qBAAqB,GAAG,qBAAqB,CAAC;YACnD,IAAI,CAAC,kBAAkB,GAAG,IAAI,iCAAkB,CAC/C,kDAA0B,CAC1B,CAAC;SACF;QAAC,OAAO,GAAG,EAAE;YACb,GAAG,CAAC,OAAO,GAAG,oBAAkB,UAAU,UAAK,GAAG,CAAC,OAAS,CAAC;YAC7D,MAAM,GAAG,CAAC;SACV;IACF,CAAC;IAsBD;;;OAGG;IACH,wCAAa,GAAb;QACC,OAAO,kBAAkB,CAAC;IAC3B,CAAC;IAgSF,uBAAC;AAAD,CAAC,AApVD,IAoVC"}
@@ -0,0 +1,2 @@
1
+ export { default } from './PushNotification';
2
+ export { PushNotificationEvent, PushNotificationMessage, PushNotificationPermissionStatus, } from './types';
@@ -0,0 +1,9 @@
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
+ var PushNotification_1 = require("./PushNotification");
6
+ exports.default = PushNotification_1.default;
7
+ var types_1 = require("./types");
8
+ exports.PushNotificationPermissionStatus = types_1.PushNotificationPermissionStatus;
9
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/PushNotification/index.ts"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;;AAEtC,uDAA6C;AAApC,qCAAA,OAAO,CAAA;AAChB,iCAIiB;AADhB,mDAAA,gCAAgC,CAAA"}
@@ -0,0 +1,77 @@
1
+ import { EventListener } from '../common';
2
+ import { AWSPinpointProviderConfig } from '../common/AWSPinpointProviderCommon/types';
3
+ import { NotificationsProvider, NotificationsSubCategory as NotificationsSubCategories, UserInfo } from '../types';
4
+ export declare type NotificationsSubCategory = Extract<NotificationsSubCategories, 'PushNotification'>;
5
+ export interface PushNotificationInterface {
6
+ configure: (config: PushNotificationConfig) => PushNotificationConfig;
7
+ getModuleName: () => NotificationsSubCategory;
8
+ getPluggable: (providerName: string) => PushNotificationProvider;
9
+ addPluggable: (pluggable: PushNotificationProvider) => void;
10
+ removePluggable: (providerName: string) => void;
11
+ enable: () => void;
12
+ identifyUser: (userId: string, userInfo: UserInfo) => Promise<void[]>;
13
+ getLaunchNotification: () => Promise<PushNotificationMessage>;
14
+ getBadgeCount: () => Promise<number>;
15
+ setBadgeCount: (count: number) => void;
16
+ getPermissionStatus: () => Promise<PushNotificationPermissionStatus>;
17
+ requestPermissions: (permissions?: PushNotificationPermissions) => Promise<boolean>;
18
+ onNotificationReceivedInBackground: (handler: OnPushNotificationMessageHandler) => EventListener<OnPushNotificationMessageHandler>;
19
+ onNotificationReceivedInForeground: (handler: OnPushNotificationMessageHandler) => EventListener<OnPushNotificationMessageHandler>;
20
+ onNotificationOpened: (handler: OnPushNotificationMessageHandler) => EventListener<OnPushNotificationMessageHandler>;
21
+ onTokenReceived: (handler: OnTokenReceivedHandler) => EventListener<OnTokenReceivedHandler>;
22
+ }
23
+ export interface PushNotificationProvider extends NotificationsProvider {
24
+ getSubCategory(): NotificationsSubCategory;
25
+ registerDevice(token: string): Promise<void>;
26
+ }
27
+ export interface PushNotificationConfig {
28
+ AWSPinpoint?: AWSPinpointProviderConfig;
29
+ }
30
+ export interface PushNotificationMessage {
31
+ title?: string;
32
+ body?: string;
33
+ imageUrl?: string;
34
+ deeplinkUrl?: string;
35
+ goToUrl?: string;
36
+ fcmOptions?: FcmPlatformOptions;
37
+ apnsOptions?: ApnsPlatformOptions;
38
+ data?: Record<string, unknown>;
39
+ }
40
+ interface FcmPlatformOptions {
41
+ channelId: string;
42
+ messageId: string;
43
+ senderId: string;
44
+ sendTime: Date;
45
+ }
46
+ interface ApnsPlatformOptions {
47
+ subtitle?: string;
48
+ }
49
+ export interface PushNotificationPermissions extends Record<string, boolean> {
50
+ alert?: boolean;
51
+ badge?: boolean;
52
+ sound?: boolean;
53
+ }
54
+ export declare enum PushNotificationPermissionStatus {
55
+ DENIED = "DENIED",
56
+ GRANTED = "GRANTED",
57
+ SHOULD_REQUEST = "SHOULD_REQUEST",
58
+ SHOULD_EXPLAIN_THEN_REQUEST = "SHOULD_EXPLAIN_THEN_REQUEST"
59
+ }
60
+ export declare type OnTokenReceivedHandler = (token: string) => any;
61
+ export declare type OnPushNotificationMessageHandler = (message: PushNotificationMessage) => any;
62
+ export declare const enum PushNotificationEvent {
63
+ BACKGROUND_MESSAGE_RECEIVED = 0,
64
+ FOREGROUND_MESSAGE_RECEIVED = 1,
65
+ LAUNCH_NOTIFICATION_OPENED = 2,
66
+ NOTIFICATION_OPENED = 3,
67
+ TOKEN_RECEIVED = 4
68
+ }
69
+ export interface NormalizedValues {
70
+ body?: string;
71
+ imageUrl?: string;
72
+ title?: string;
73
+ action?: Pick<PushNotificationMessage, 'goToUrl' | 'deeplinkUrl'>;
74
+ options?: Pick<PushNotificationMessage, 'apnsOptions' | 'fcmOptions'>;
75
+ data?: Record<string, unknown>;
76
+ }
77
+ export {};
@@ -0,0 +1,12 @@
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
+ var PushNotificationPermissionStatus;
6
+ (function (PushNotificationPermissionStatus) {
7
+ PushNotificationPermissionStatus["DENIED"] = "DENIED";
8
+ PushNotificationPermissionStatus["GRANTED"] = "GRANTED";
9
+ PushNotificationPermissionStatus["SHOULD_REQUEST"] = "SHOULD_REQUEST";
10
+ PushNotificationPermissionStatus["SHOULD_EXPLAIN_THEN_REQUEST"] = "SHOULD_EXPLAIN_THEN_REQUEST";
11
+ })(PushNotificationPermissionStatus = exports.PushNotificationPermissionStatus || (exports.PushNotificationPermissionStatus = {}));
12
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/PushNotification/types.ts"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;;AAoFtC,IAAY,gCAKX;AALD,WAAY,gCAAgC;IAC3C,qDAAiB,CAAA;IACjB,uDAAmB,CAAA;IACnB,qEAAiC,CAAA;IACjC,+FAA2D,CAAA;AAC5D,CAAC,EALW,gCAAgC,GAAhC,wCAAgC,KAAhC,wCAAgC,QAK3C"}
@@ -0,0 +1,3 @@
1
+ import { PushNotificationMessage, PushNotificationPermissionStatus } from './types';
2
+ export declare const normalizeNativePermissionStatus: (nativeStatus?: any) => PushNotificationPermissionStatus;
3
+ export declare const normalizeNativeMessage: (nativeMessage?: any) => PushNotificationMessage;
@@ -0,0 +1,81 @@
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
+ var tslib_1 = require("tslib");
6
+ var lodash_1 = require("lodash");
7
+ var types_1 = require("./types");
8
+ var DEEP_LINK_ACTION = 'deeplink';
9
+ var URL_ACTION = 'url';
10
+ exports.normalizeNativePermissionStatus = function (nativeStatus) {
11
+ switch (nativeStatus) {
12
+ case 'ShouldRequest':
13
+ return types_1.PushNotificationPermissionStatus.SHOULD_REQUEST;
14
+ case 'NotDetermined':
15
+ case 'ShouldExplainThenRequest':
16
+ return types_1.PushNotificationPermissionStatus.SHOULD_EXPLAIN_THEN_REQUEST;
17
+ case 'Authorized':
18
+ case 'Granted':
19
+ return types_1.PushNotificationPermissionStatus.GRANTED;
20
+ case 'Denied':
21
+ return types_1.PushNotificationPermissionStatus.DENIED;
22
+ }
23
+ };
24
+ exports.normalizeNativeMessage = function (nativeMessage) {
25
+ var normalized;
26
+ if (nativeMessage === null || nativeMessage === void 0 ? void 0 : nativeMessage.aps) {
27
+ normalized = normalizeApnsMessage(nativeMessage);
28
+ }
29
+ if (nativeMessage === null || nativeMessage === void 0 ? void 0 : nativeMessage.rawData) {
30
+ normalized = normalizeFcmMessage(nativeMessage);
31
+ }
32
+ if (!normalized) {
33
+ return null;
34
+ }
35
+ var body = normalized.body, imageUrl = normalized.imageUrl, title = normalized.title, action = normalized.action, options = normalized.options, data = normalized.data;
36
+ return tslib_1.__assign(tslib_1.__assign(tslib_1.__assign(tslib_1.__assign(tslib_1.__assign(tslib_1.__assign({}, (body && { body: body })), (imageUrl && { imageUrl: imageUrl })), (title && { title: title })), action), options), (!lodash_1.isEmpty(data) && { data: data }));
37
+ };
38
+ var normalizeApnsMessage = function (apnsMessage) {
39
+ var _a, _b;
40
+ var aps = apnsMessage.aps, _c = apnsMessage.data, data = _c === void 0 ? {} : _c;
41
+ var _d = (_a = aps.alert) !== null && _a !== void 0 ? _a : {}, body = _d.body, title = _d.title;
42
+ var action = (_b = getApnsAction(data.pinpoint)) !== null && _b !== void 0 ? _b : {};
43
+ var imageUrl = data['media-url'];
44
+ var options = getApnsOptions(apnsMessage);
45
+ return { body: body, imageUrl: imageUrl, title: title, action: action, options: options, data: data };
46
+ };
47
+ var normalizeFcmMessage = function (fcmMessage) {
48
+ var _a;
49
+ var body = fcmMessage.body, imageUrl = fcmMessage.imageUrl, data = fcmMessage.rawData, title = fcmMessage.title;
50
+ var action = (_a = getFcmAction(fcmMessage.action)) !== null && _a !== void 0 ? _a : {};
51
+ var options = getFcmOptions(fcmMessage);
52
+ return { body: body, imageUrl: imageUrl, title: title, action: action, options: options, data: data };
53
+ };
54
+ var getApnsAction = function (action) {
55
+ if (action === void 0) { action = {}; }
56
+ if (action[DEEP_LINK_ACTION]) {
57
+ return { deeplinkUrl: action[DEEP_LINK_ACTION] };
58
+ }
59
+ };
60
+ var getFcmAction = function (action) {
61
+ if (action === void 0) { action = {}; }
62
+ if (action[URL_ACTION]) {
63
+ return { goToUrl: action[URL_ACTION] };
64
+ }
65
+ if (action[DEEP_LINK_ACTION]) {
66
+ return { deeplinkUrl: action[DEEP_LINK_ACTION] };
67
+ }
68
+ };
69
+ var getApnsOptions = function (_a) {
70
+ var aps = _a.aps;
71
+ var _b;
72
+ var subtitle = ((_b = aps.alert) !== null && _b !== void 0 ? _b : {}).subtitle;
73
+ var apnsOptions = tslib_1.__assign({}, (subtitle && { subtitle: subtitle }));
74
+ return tslib_1.__assign({}, (!lodash_1.isEmpty(apnsOptions) && { apnsOptions: apnsOptions }));
75
+ };
76
+ var getFcmOptions = function (_a) {
77
+ var channelId = _a.channelId, messageId = _a.messageId, senderId = _a.senderId, sendTime = _a.sendTime;
78
+ var fcmOptions = tslib_1.__assign(tslib_1.__assign(tslib_1.__assign(tslib_1.__assign({}, (channelId && { channelId: channelId })), (messageId && { messageId: messageId })), (senderId && { senderId: senderId })), (sendTime && { sendTime: new Date(sendTime) }));
79
+ return tslib_1.__assign({}, (!lodash_1.isEmpty(fcmOptions) && { fcmOptions: fcmOptions }));
80
+ };
81
+ //# sourceMappingURL=utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/PushNotification/utils.ts"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;;;AAEtC,iCAAiC;AAEjC,iCAIiB;AAEjB,IAAM,gBAAgB,GAAG,UAAU,CAAC;AACpC,IAAM,UAAU,GAAG,KAAK,CAAC;AAEZ,QAAA,+BAA+B,GAAG,UAC9C,YAAa;IAEb,QAAQ,YAAY,EAAE;QACrB,KAAK,eAAe;YACnB,OAAO,wCAAgC,CAAC,cAAc,CAAC;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qB;IACrC,IAAM,WAAW,wBAAQ,CAAC,QAAQ,IAAI,EAAE,QAAQ,UAAA,EAAE,CAAC,CAAE,CAAC;IACtD,4BAAY,CAAC,CAAC,gBAAO,CAAC,WAAW,CAAC,IAAI,EAAE,WAAW,aAAA,EAAE,CAAC,EAAG;AAC1D,CAAC,CAAC;AAEF,IAAM,aAAa,GAAG,UAAC,EAKtB;QAJA,wBAAS,EACT,wBAAS,EACT,sBAAQ,EACR,sBAAQ;IAER,IAAM,UAAU,2EACZ,CAAC,SAAS,IAAI,EAAE,SAAS,WAAA,EAAE,CAAC,GAC5B,CAAC,SAAS,IAAI,EAAE,SAAS,WAAA,EAAE,CAAC,GAC5B,CAAC,QAAQ,IAAI,EAAE,QAAQ,UAAA,EAAE,CAAC,GAC1B,CAAC,QAAQ,IAAI,EAAE,QAAQ,EAAE,IAAI,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC,CACjD,CAAC;IACF,4BAAY,CAAC,CAAC,gBAAO,CAAC,UAAU,CAAC,IAAI,EAAE,UAAU,YAAA,EAAE,CAAC,EAAG;AACxD,CAAC,CAAC"}
@@ -0,0 +1,34 @@
1
+ import { ConsoleLogger } from '@aws-amplify/core';
2
+ import { Event as AWSPinpointAnalyticsEvent } from '@aws-sdk/client-pinpoint';
3
+ import { NotificationsCategory, NotificationsSubCategory, NotificationsProvider, UserInfo } from '../../types';
4
+ import { AWSPinpointUserInfo } from './types';
5
+ export default abstract class AWSPinpointProviderCommon implements NotificationsProvider {
6
+ static category: NotificationsCategory;
7
+ static providerName: string;
8
+ protected clientInfo: any;
9
+ protected config: Record<string, any>;
10
+ protected endpointInitialized: boolean;
11
+ protected initialized: boolean;
12
+ protected logger: ConsoleLogger;
13
+ constructor(logger: any);
14
+ /**
15
+ * get the category of the plugin
16
+ */
17
+ getCategory(): "Notifications";
18
+ /**
19
+ * get the sub-category of the plugin
20
+ */
21
+ abstract getSubCategory(): NotificationsSubCategory;
22
+ /**
23
+ * get provider name of the plugin
24
+ */
25
+ getProviderName(): string;
26
+ configure(config?: {}): Record<string, any>;
27
+ identifyUser: (userId: string, userInfo: UserInfo) => Promise<void>;
28
+ protected init: () => Promise<void>;
29
+ protected recordAnalyticsEvent: (event: AWSPinpointAnalyticsEvent) => Promise<void>;
30
+ protected updateEndpoint: (userId?: string, userInfo?: AWSPinpointUserInfo) => Promise<void>;
31
+ private initPinpointClient;
32
+ private getEndpointId;
33
+ private getCredentials;
34
+ }
@@ -0,0 +1,281 @@
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
+ var tslib_1 = require("tslib");
6
+ var core_1 = require("@aws-amplify/core");
7
+ var cache_1 = require("@aws-amplify/cache");
8
+ var client_pinpoint_1 = require("@aws-sdk/client-pinpoint");
9
+ var uuid_1 = require("uuid");
10
+ var AWSPinpointProviderCommon = /** @class */ (function () {
11
+ function AWSPinpointProviderCommon(logger) {
12
+ var _this = this;
13
+ var _a;
14
+ this.config = {};
15
+ this.endpointInitialized = false;
16
+ this.initialized = false;
17
+ this.identifyUser = function (userId, userInfo) { return tslib_1.__awaiter(_this, void 0, void 0, function () {
18
+ var err_1;
19
+ return tslib_1.__generator(this, function (_a) {
20
+ switch (_a.label) {
21
+ case 0:
22
+ if (!!this.initialized) return [3 /*break*/, 2];
23
+ return [4 /*yield*/, this.init()];
24
+ case 1:
25
+ _a.sent();
26
+ _a.label = 2;
27
+ case 2:
28
+ _a.trys.push([2, 4, , 5]);
29
+ return [4 /*yield*/, this.updateEndpoint(userId, userInfo)];
30
+ case 3:
31
+ _a.sent();
32
+ return [3 /*break*/, 5];
33
+ case 4:
34
+ err_1 = _a.sent();
35
+ this.logger.error('Error identifying user', err_1);
36
+ throw err_1;
37
+ case 5: return [2 /*return*/];
38
+ }
39
+ });
40
+ }); };
41
+ this.init = function () { return tslib_1.__awaiter(_this, void 0, void 0, function () {
42
+ var _a, endpointId, storage, providerName, _b, err_2;
43
+ return tslib_1.__generator(this, function (_c) {
44
+ switch (_c.label) {
45
+ case 0:
46
+ _a = this.config, endpointId = _a.endpointId, storage = _a.storage;
47
+ providerName = this.getProviderName();
48
+ _c.label = 1;
49
+ case 1:
50
+ _c.trys.push([1, 6, , 7]);
51
+ if (!(typeof storage.sync === 'function')) return [3 /*break*/, 3];
52
+ return [4 /*yield*/, storage.sync()];
53
+ case 2:
54
+ _c.sent();
55
+ _c.label = 3;
56
+ case 3:
57
+ if (!!endpointId) return [3 /*break*/, 5];
58
+ _b = this.config;
59
+ return [4 /*yield*/, this.getEndpointId()];
60
+ case 4:
61
+ _b.endpointId = _c.sent();
62
+ _c.label = 5;
63
+ case 5:
64
+ this.initialized = true;
65
+ return [3 /*break*/, 7];
66
+ case 6:
67
+ err_2 = _c.sent();
68
+ this.logger.error("Failed to initialize " + providerName, err_2);
69
+ return [3 /*break*/, 7];
70
+ case 7: return [2 /*return*/];
71
+ }
72
+ });
73
+ }); };
74
+ this.recordAnalyticsEvent = function (event) { return tslib_1.__awaiter(_this, void 0, void 0, function () {
75
+ var _a, appId, credentials, endpointId, pinpointClient, currentCredentials, credentialsUpdated, input, command, err_3;
76
+ var _b, _c;
77
+ return tslib_1.__generator(this, function (_d) {
78
+ switch (_d.label) {
79
+ case 0:
80
+ _a = this.config, appId = _a.appId, credentials = _a.credentials, endpointId = _a.endpointId, pinpointClient = _a.pinpointClient;
81
+ return [4 /*yield*/, this.getCredentials()];
82
+ case 1:
83
+ currentCredentials = _d.sent();
84
+ credentialsUpdated = !credentials ||
85
+ Object.keys(currentCredentials).some(function (key) { return currentCredentials[key] !== credentials[key]; });
86
+ // Update credentials
87
+ this.config.credentials = currentCredentials;
88
+ _d.label = 2;
89
+ case 2:
90
+ _d.trys.push([2, 6, , 7]);
91
+ if (!(!pinpointClient || credentialsUpdated)) return [3 /*break*/, 4];
92
+ return [4 /*yield*/, this.initPinpointClient()];
93
+ case 3:
94
+ _d.sent();
95
+ _d.label = 4;
96
+ case 4:
97
+ input = {
98
+ ApplicationId: appId,
99
+ EventsRequest: {
100
+ BatchItem: (_b = {},
101
+ _b[endpointId] = {
102
+ Endpoint: {},
103
+ Events: (_c = {},
104
+ _c[uuid_1.v4()] = event,
105
+ _c),
106
+ },
107
+ _b),
108
+ },
109
+ };
110
+ command = new client_pinpoint_1.PutEventsCommand(input);
111
+ this.logger.debug('recording analytics event');
112
+ return [4 /*yield*/, this.config.pinpointClient.send(command)];
113
+ case 5:
114
+ _d.sent();
115
+ return [3 /*break*/, 7];
116
+ case 6:
117
+ err_3 = _d.sent();
118
+ this.logger.error('Error recording analytics event', err_3);
119
+ throw err_3;
120
+ case 7: return [2 /*return*/];
121
+ }
122
+ });
123
+ }); };
124
+ this.updateEndpoint = function (userId, userInfo) {
125
+ if (userId === void 0) { userId = null; }
126
+ if (userInfo === void 0) { userInfo = null; }
127
+ return tslib_1.__awaiter(_this, void 0, void 0, function () {
128
+ var _a, appId, credentials, endpointId, _b, endpointInfo, pinpointClient, currentCredentials, credentialsUpdated, _c, address, attributes, demographic, location_1, metrics, optOut, _d, appVersion, make, model, platform, version, input, command, err_4;
129
+ var _e;
130
+ return tslib_1.__generator(this, function (_f) {
131
+ switch (_f.label) {
132
+ case 0:
133
+ _a = this.config, appId = _a.appId, credentials = _a.credentials, endpointId = _a.endpointId, _b = _a.endpointInfo, endpointInfo = _b === void 0 ? {} : _b, pinpointClient = _a.pinpointClient;
134
+ return [4 /*yield*/, this.getCredentials()];
135
+ case 1:
136
+ currentCredentials = _f.sent();
137
+ credentialsUpdated = !credentials ||
138
+ Object.keys(currentCredentials).some(function (key) { return currentCredentials[key] !== credentials[key]; });
139
+ // If endpoint is already initialized, and nothing else is changing, just early return
140
+ if (this.endpointInitialized &&
141
+ !credentialsUpdated &&
142
+ !userId &&
143
+ !userInfo) {
144
+ return [2 /*return*/];
145
+ }
146
+ // Update credentials
147
+ this.config.credentials = currentCredentials;
148
+ _f.label = 2;
149
+ case 2:
150
+ _f.trys.push([2, 4, , 5]);
151
+ // Initialize a new pinpoint client if one isn't already configured or if credentials changed
152
+ if (!pinpointClient || credentialsUpdated) {
153
+ this.initPinpointClient();
154
+ }
155
+ _c = userInfo !== null && userInfo !== void 0 ? userInfo : {}, address = _c.address, attributes = _c.attributes, demographic = _c.demographic, location_1 = _c.location, metrics = _c.metrics, optOut = _c.optOut;
156
+ _d = this.clientInfo, appVersion = _d.appVersion, make = _d.make, model = _d.model, platform = _d.platform, version = _d.version;
157
+ input = {
158
+ ApplicationId: appId,
159
+ EndpointId: endpointId,
160
+ EndpointRequest: {
161
+ RequestId: uuid_1.v4(),
162
+ EffectiveDate: new Date().toISOString(),
163
+ ChannelType: endpointInfo.channelType,
164
+ Address: address !== null && address !== void 0 ? address : endpointInfo.address,
165
+ Attributes: tslib_1.__assign(tslib_1.__assign({}, endpointInfo.attributes), attributes),
166
+ Demographic: tslib_1.__assign({ AppVersion: appVersion, Make: make, Model: model, ModelVersion: version, Platform: platform }, core_1.transferKeyToUpperCase(tslib_1.__assign(tslib_1.__assign({}, endpointInfo.demographic), demographic))),
167
+ Location: core_1.transferKeyToUpperCase(tslib_1.__assign(tslib_1.__assign({}, endpointInfo.location), location_1)),
168
+ Metrics: tslib_1.__assign(tslib_1.__assign({}, endpointInfo.metrics), metrics),
169
+ OptOut: optOut !== null && optOut !== void 0 ? optOut : endpointInfo.optOut,
170
+ User: {
171
+ UserId: (_e = userId !== null && userId !== void 0 ? userId : endpointInfo.userId) !== null && _e !== void 0 ? _e : currentCredentials.identityId,
172
+ UserAttributes: attributes !== null && attributes !== void 0 ? attributes : endpointInfo.userAttributes,
173
+ },
174
+ },
175
+ };
176
+ command = new client_pinpoint_1.UpdateEndpointCommand(input);
177
+ this.logger.debug('updating endpoint');
178
+ return [4 /*yield*/, this.config.pinpointClient.send(command)];
179
+ case 3:
180
+ _f.sent();
181
+ this.endpointInitialized = true;
182
+ return [3 /*break*/, 5];
183
+ case 4:
184
+ err_4 = _f.sent();
185
+ throw err_4;
186
+ case 5: return [2 /*return*/];
187
+ }
188
+ });
189
+ });
190
+ };
191
+ this.initPinpointClient = function () {
192
+ var _a = _this.config, appId = _a.appId, credentials = _a.credentials, pinpointClient = _a.pinpointClient, region = _a.region;
193
+ if (!appId || !credentials || !region) {
194
+ throw new Error('One or more of credentials, appId or region is not configured');
195
+ }
196
+ if (pinpointClient) {
197
+ pinpointClient.destroy();
198
+ }
199
+ _this.config.pinpointClient = new client_pinpoint_1.PinpointClient({
200
+ region: region,
201
+ credentials: credentials,
202
+ customUserAgent: core_1.getAmplifyUserAgent("/" + _this.getSubCategory()),
203
+ });
204
+ };
205
+ this.getEndpointId = function () { return tslib_1.__awaiter(_this, void 0, void 0, function () {
206
+ var appId, cacheKey, cachedEndpointId, endpointId, ttl, expiration;
207
+ return tslib_1.__generator(this, function (_a) {
208
+ switch (_a.label) {
209
+ case 0:
210
+ appId = this.config.appId;
211
+ cacheKey = this.getSubCategory() === 'PushNotification'
212
+ ? this.getProviderName() + "_" + appId
213
+ : this.getSubCategory() + ":" + this.getProviderName() + ":" + appId;
214
+ return [4 /*yield*/, cache_1.Cache.getItem(cacheKey)];
215
+ case 1:
216
+ cachedEndpointId = _a.sent();
217
+ // Found in cache, just return it
218
+ if (cachedEndpointId) {
219
+ return [2 /*return*/, cachedEndpointId];
220
+ }
221
+ endpointId = uuid_1.v4();
222
+ ttl = 1000 * 60 * 60 * 24 * 365 * 100;
223
+ expiration = new Date().getTime() + ttl;
224
+ cache_1.Cache.setItem(cacheKey, endpointId, {
225
+ expires: expiration,
226
+ priority: 1,
227
+ });
228
+ return [2 /*return*/, endpointId];
229
+ }
230
+ });
231
+ }); };
232
+ this.getCredentials = function () { return tslib_1.__awaiter(_this, void 0, void 0, function () {
233
+ var credentials, err_5;
234
+ return tslib_1.__generator(this, function (_a) {
235
+ switch (_a.label) {
236
+ case 0:
237
+ _a.trys.push([0, 2, , 3]);
238
+ return [4 /*yield*/, core_1.Credentials.get()];
239
+ case 1:
240
+ credentials = _a.sent();
241
+ if (!credentials) {
242
+ this.logger.debug('no credentials found');
243
+ return [2 /*return*/, null];
244
+ }
245
+ return [2 /*return*/, core_1.Credentials.shear(credentials)];
246
+ case 2:
247
+ err_5 = _a.sent();
248
+ this.logger.error('Error getting credentials:', err_5);
249
+ return [2 /*return*/, null];
250
+ case 3: return [2 /*return*/];
251
+ }
252
+ });
253
+ }); };
254
+ this.config = { storage: new core_1.StorageHelper().getStorage() };
255
+ this.clientInfo = (_a = core_1.ClientDevice.clientInfo()) !== null && _a !== void 0 ? _a : {};
256
+ this.logger = logger;
257
+ }
258
+ /**
259
+ * get the category of the plugin
260
+ */
261
+ AWSPinpointProviderCommon.prototype.getCategory = function () {
262
+ return AWSPinpointProviderCommon.category;
263
+ };
264
+ /**
265
+ * get provider name of the plugin
266
+ */
267
+ AWSPinpointProviderCommon.prototype.getProviderName = function () {
268
+ return AWSPinpointProviderCommon.providerName;
269
+ };
270
+ AWSPinpointProviderCommon.prototype.configure = function (config) {
271
+ if (config === void 0) { config = {}; }
272
+ this.config = tslib_1.__assign(tslib_1.__assign({}, this.config), config);
273
+ this.logger.debug("configure " + this.getProviderName() + this.getSubCategory() + "Provider", this.config);
274
+ return this.config;
275
+ };
276
+ AWSPinpointProviderCommon.category = 'Notifications';
277
+ AWSPinpointProviderCommon.providerName = 'AWSPinpoint';
278
+ return AWSPinpointProviderCommon;
279
+ }());
280
+ exports.default = AWSPinpointProviderCommon;
281
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/common/AWSPinpointProviderCommon/index.ts"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;;;AAEtC,0CAO2B;AAC3B,4CAA2C;AAC3C,4DAOkC;AAClC,6BAAkC;AAUlC;IAYC,mCAAY,MAAM;QAAlB,iBAIC;;QATS,WAAM,GAAwB,EAAE,CAAC;QACjC,wBAAmB,GAAG,KAAK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CAAC,sBAAsB,CAAC,CAAC;4BAC1C,sBAAO,IAAI,EAAC;yBACZ;wBACD,sBAAO,kBAAW,CAAC,KAAK,CAAC,WAAW,CAAC,EAAC;;;wBAEtC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,4BAA4B,EAAE,KAAG,CAAC,CAAC;wBACrD,sBAAO,IAAI,EAAC;;;;aAEb,CAAC;QA1PD,IAAI,CAAC,MAAM,GAAG,EAAE,OAAO,EAAE,IAAI,oBAAa,EAAE,CAAC,UAAU,EAAE,EAAE,CAAC;QAC5D,IAAI,CAAC,UAAU,SAAG,mBAAY,CAAC,UAAU,EAAE,mCAAI,EAAE,CAAC;QAClD,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACtB,CAAC;IAED;;OAEG;IACH,+CAAW,GAAX;QACC,OAAO,yBAAyB,CAAC,QAAQ,CAAC;IAC3C,CAAC;IAOD;;OAEG;IACH,mDAAe,GAAf;QACC,OAAO,yBAAyB,CAAC,YAAY,CAAC;IAC/C,CAAC;IAED,6CAAS,GAAT,UAAU,MAAW;QAAX,uBAAA,EAAA,WAAW;QACpB,IAAI,CAAC,MAAM,yCAAQ,IAAI,CAAC,MAAM,GAAK,MAAM,CAAE,CAAC;QAC5C,IAAI,CAAC,MAAM,CAAC,KAAK,CAChB,eAAa,IAAI,CAAC,eAAe,EAAE,GAAG,IAAI,CAAC,cAAc,EAAE,aAAU,EACrE,IAAI,CAAC,MAAM,CACX,CAAC;QACF,OAAO,IAAI,CAAC,MAAM,CAAC;IACpB,CAAC;IAzCM,kCAAQ,GAA0B,eAAe,CAAC;IAClD,sCAAY,GAAG,aAAa,CAAC;IAoQrC,gCAAC;CAAA,AAxQD,IAwQC;kBAxQ6B,yBAAyB"}
@@ -0,0 +1,9 @@
1
+ import { UserInfo } from '../../types';
2
+ export interface AWSPinpointProviderConfig {
3
+ appId: string;
4
+ region: string;
5
+ }
6
+ export interface AWSPinpointUserInfo extends UserInfo {
7
+ address?: string;
8
+ optOut?: 'ALL' | 'NONE';
9
+ }
@@ -0,0 +1,5 @@
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
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/common/AWSPinpointProviderCommon/types.ts"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC"}
@@ -0,0 +1 @@
1
+ export declare const AMPLIFY_SYMBOL: Symbol;
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.AMPLIFY_SYMBOL = (typeof Symbol !== 'undefined' && typeof Symbol.for === 'function'
4
+ ? Symbol.for('amplify_default')
5
+ : '@@amplify_default');
6
+ //# sourceMappingURL=constants.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/common/constants.ts"],"names":[],"mappings":";;AAAa,QAAA,cAAc,GAAG,CAC7B,OAAO,MAAM,KAAK,WAAW,IAAI,OAAO,MAAM,CAAC,GAAG,KAAK,UAAU;IAChE,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,iBAAiB,CAAC;IAC/B,CAAC,CAAC,mBAAmB,CACZ,CAAC"}
@@ -0,0 +1,4 @@
1
+ import { EventListener, EventType } from './types';
2
+ export declare const notifyEventListeners: (type: EventType, ...args: any[]) => void;
3
+ export declare const notifyEventListenersAndAwaitHandlers: (type: EventType, ...args: any[]) => Promise<void[]>;
4
+ export declare const addEventListener: <EventHandler extends Function>(type: EventType, handler: EventHandler) => EventListener<EventHandler>;