@aws-amplify/rtn-push-notification 1.1.8-api-v6-models.b3abc9b.0 → 1.2.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 (116) hide show
  1. package/android/build.gradle +16 -1
  2. package/android/gradle/wrapper/gradle-wrapper.properties +1 -1
  3. package/android/src/hasPackageName/AndroidManifest.xml +22 -0
  4. package/android/src/main/AndroidManifest.xml +1 -2
  5. package/lib/apis/addMessageEventListener.d.ts +3 -0
  6. package/lib/apis/addMessageEventListener.js +11 -0
  7. package/lib/apis/addTokenEventListener.d.ts +2 -0
  8. package/lib/apis/addTokenEventListener.js +10 -0
  9. package/lib/apis/completeNotification.d.ts +1 -0
  10. package/lib/apis/completeNotification.js +8 -0
  11. package/lib/apis/getBadgeCount.d.ts +1 -0
  12. package/lib/apis/getBadgeCount.js +8 -0
  13. package/lib/apis/getConstants.d.ts +10 -0
  14. package/lib/apis/getConstants.js +8 -0
  15. package/lib/apis/getLaunchNotification.d.ts +2 -0
  16. package/lib/apis/getLaunchNotification.js +9 -0
  17. package/lib/apis/getPermissionStatus.d.ts +2 -0
  18. package/lib/apis/getPermissionStatus.js +9 -0
  19. package/lib/apis/index.d.ts +10 -0
  20. package/lib/apis/index.js +25 -0
  21. package/lib/apis/registerHeadlessTask.d.ts +2 -0
  22. package/lib/apis/registerHeadlessTask.js +17 -0
  23. package/lib/apis/requestPermissions.d.ts +2 -0
  24. package/lib/apis/requestPermissions.js +16 -0
  25. package/lib/apis/setBadgeCount.d.ts +1 -0
  26. package/lib/apis/setBadgeCount.js +8 -0
  27. package/lib/constants.d.ts +2 -0
  28. package/lib/constants.js +12 -0
  29. package/lib/index.d.ts +24 -3
  30. package/lib/index.js +15 -3
  31. package/lib/nativeModule.d.ts +4 -0
  32. package/lib/nativeModule.js +15 -0
  33. package/lib/tsconfig.tsbuildinfo +1 -0
  34. package/lib/types/index.d.ts +2 -0
  35. package/lib/types/index.js +20 -0
  36. package/lib/types/module.d.ts +31 -0
  37. package/lib/{types.js → types/module.js} +0 -1
  38. package/lib/types/native.d.ts +69 -0
  39. package/lib/types/native.js +4 -0
  40. package/lib/utils/index.d.ts +2 -0
  41. package/lib/utils/index.js +9 -0
  42. package/lib/utils/normalizeNativeMessage.d.ts +5 -0
  43. package/lib/utils/normalizeNativeMessage.js +74 -0
  44. package/lib/utils/normalizeNativePermissionStatus.d.ts +5 -0
  45. package/lib/utils/normalizeNativePermissionStatus.js +23 -0
  46. package/lib-esm/apis/addMessageEventListener.d.ts +3 -0
  47. package/lib-esm/apis/addMessageEventListener.js +7 -0
  48. package/lib-esm/apis/addTokenEventListener.d.ts +2 -0
  49. package/lib-esm/apis/addTokenEventListener.js +6 -0
  50. package/lib-esm/apis/completeNotification.d.ts +1 -0
  51. package/lib-esm/apis/completeNotification.js +4 -0
  52. package/lib-esm/apis/getBadgeCount.d.ts +1 -0
  53. package/lib-esm/apis/getBadgeCount.js +4 -0
  54. package/lib-esm/apis/getConstants.d.ts +10 -0
  55. package/lib-esm/apis/getConstants.js +4 -0
  56. package/lib-esm/apis/getLaunchNotification.d.ts +2 -0
  57. package/lib-esm/apis/getLaunchNotification.js +5 -0
  58. package/lib-esm/apis/getPermissionStatus.d.ts +2 -0
  59. package/lib-esm/apis/getPermissionStatus.js +5 -0
  60. package/lib-esm/apis/index.d.ts +10 -0
  61. package/lib-esm/apis/index.js +12 -0
  62. package/lib-esm/apis/registerHeadlessTask.d.ts +2 -0
  63. package/lib-esm/apis/registerHeadlessTask.js +13 -0
  64. package/lib-esm/apis/requestPermissions.d.ts +2 -0
  65. package/lib-esm/apis/requestPermissions.js +12 -0
  66. package/lib-esm/apis/setBadgeCount.d.ts +1 -0
  67. package/lib-esm/apis/setBadgeCount.js +4 -0
  68. package/lib-esm/constants.d.ts +2 -0
  69. package/lib-esm/constants.js +9 -0
  70. package/lib-esm/index.d.ts +24 -3
  71. package/lib-esm/index.js +14 -3
  72. package/lib-esm/nativeModule.d.ts +4 -0
  73. package/lib-esm/nativeModule.js +12 -0
  74. package/lib-esm/tsconfig.tsbuildinfo +1 -0
  75. package/lib-esm/types/index.d.ts +2 -0
  76. package/lib-esm/types/index.js +4 -0
  77. package/lib-esm/types/module.d.ts +31 -0
  78. package/lib-esm/{types.js → types/module.js} +1 -1
  79. package/lib-esm/types/native.d.ts +69 -0
  80. package/lib-esm/types/native.js +3 -0
  81. package/lib-esm/utils/index.d.ts +2 -0
  82. package/lib-esm/utils/index.js +4 -0
  83. package/lib-esm/utils/normalizeNativeMessage.d.ts +5 -0
  84. package/lib-esm/utils/normalizeNativeMessage.js +70 -0
  85. package/lib-esm/utils/normalizeNativePermissionStatus.d.ts +5 -0
  86. package/lib-esm/utils/normalizeNativePermissionStatus.js +19 -0
  87. package/package.json +53 -8
  88. package/src/apis/addMessageEventListener.ts +21 -0
  89. package/src/apis/addTokenEventListener.ts +14 -0
  90. package/src/apis/completeNotification.ts +7 -0
  91. package/src/apis/getBadgeCount.ts +7 -0
  92. package/src/apis/getConstants.ts +6 -0
  93. package/src/apis/getLaunchNotification.ts +12 -0
  94. package/src/apis/getPermissionStatus.ts +10 -0
  95. package/src/apis/index.ts +13 -0
  96. package/src/apis/registerHeadlessTask.ts +21 -0
  97. package/src/apis/requestPermissions.ts +18 -0
  98. package/src/apis/setBadgeCount.ts +7 -0
  99. package/src/constants.ts +11 -0
  100. package/src/index.ts +33 -7
  101. package/src/nativeModule.ts +20 -0
  102. package/src/types/index.ts +5 -0
  103. package/src/types/module.ts +43 -0
  104. package/src/types/native.ts +92 -0
  105. package/src/utils/index.ts +5 -0
  106. package/src/utils/normalizeNativeMessage.ts +103 -0
  107. package/src/utils/normalizeNativePermissionStatus.ts +27 -0
  108. package/lib/.tsbuildinfo +0 -3
  109. package/lib/index.js.map +0 -1
  110. package/lib/types.d.ts +0 -18
  111. package/lib/types.js.map +0 -1
  112. package/lib-esm/.tsbuildinfo +0 -3
  113. package/lib-esm/index.js.map +0 -1
  114. package/lib-esm/types.d.ts +0 -18
  115. package/lib-esm/types.js.map +0 -1
  116. package/src/types.ts +0 -23
@@ -1,3 +1,8 @@
1
+ import com.android.Version
2
+
3
+ def agpVersion = Version.ANDROID_GRADLE_PLUGIN_VERSION.tokenize('.')[0].toInteger()
4
+ def androidManifestPath = agpVersion >= 7 ? 'src/main/AndroidManifest.xml' : 'src/hasPackageName/AndroidManifest.xml'
5
+
1
6
  buildscript {
2
7
  def kotlin_version = rootProject.ext.has('kotlinVersion')
3
8
  ? rootProject.ext.get('kotlinVersion')
@@ -10,7 +15,7 @@ buildscript {
10
15
 
11
16
  dependencies {
12
17
  if (project == rootProject) {
13
- classpath 'com.android.tools.build:gradle:7.3.1'
18
+ classpath 'com.android.tools.build:gradle:8.0.2'
14
19
  }
15
20
  classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
16
21
  classpath "org.jetbrains.kotlin:kotlin-serialization:$kotlin_version"
@@ -26,6 +31,10 @@ def getExtOrDefault(prop) {
26
31
  }
27
32
 
28
33
  android {
34
+ if (agpVersion >= 7) {
35
+ namespace 'com.amazonaws.amplify'
36
+ }
37
+
29
38
  compileSdkVersion getExtOrDefault('compileSdkVersion')
30
39
 
31
40
  defaultConfig {
@@ -33,6 +42,12 @@ android {
33
42
  targetSdkVersion getExtOrDefault('targetSdkVersion')
34
43
  }
35
44
 
45
+ sourceSets {
46
+ main {
47
+ manifest.srcFile androidManifestPath
48
+ }
49
+ }
50
+
36
51
  compileOptions {
37
52
  sourceCompatibility JavaVersion.VERSION_1_8
38
53
  targetCompatibility JavaVersion.VERSION_1_8
@@ -1,5 +1,5 @@
1
1
  distributionBase=GRADLE_USER_HOME
2
2
  distributionPath=wrapper/dists
3
- distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-bin.zip
3
+ distributionUrl=https\://services.gradle.org/distributions/gradle-8.0.1-bin.zip
4
4
  zipStoreBase=GRADLE_USER_HOME
5
5
  zipStorePath=wrapper/dists
@@ -0,0 +1,22 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <manifest xmlns:android="http://schemas.android.com/apk/res/android"
3
+ package="com.amazonaws.amplify.rtnpushnotification">
4
+
5
+ <uses-permission android:name="android.permission.POST_NOTIFICATIONS" />
6
+ <application>
7
+ <activity
8
+ android:name=".PushNotificationLaunchActivity"
9
+ android:launchMode="singleInstance"
10
+ android:exported="false" />
11
+
12
+ <service android:name=".PushNotificationHeadlessTaskService" />
13
+
14
+ <service
15
+ android:name=".PushNotificationFirebaseMessagingService"
16
+ android:exported="false">
17
+ <intent-filter>
18
+ <action android:name="com.google.firebase.MESSAGING_EVENT" />
19
+ </intent-filter>
20
+ </service>
21
+ </application>
22
+ </manifest>
@@ -1,6 +1,5 @@
1
1
  <?xml version="1.0" encoding="utf-8"?>
2
- <manifest xmlns:android="http://schemas.android.com/apk/res/android"
3
- package="com.amazonaws.amplify.rtnpushnotification">
2
+ <manifest xmlns:android="http://schemas.android.com/apk/res/android">
4
3
 
5
4
  <uses-permission android:name="android.permission.POST_NOTIFICATIONS" />
6
5
  <application>
@@ -0,0 +1,3 @@
1
+ import { EmitterSubscription } from 'react-native';
2
+ import { PushNotificationMessage } from '../types';
3
+ export declare const addMessageEventListener: (event: string, listener: (message: PushNotificationMessage | null, completionHandlerId?: string) => void) => EmitterSubscription;
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3
+ // SPDX-License-Identifier: Apache-2.0
4
+ Object.defineProperty(exports, "__esModule", { value: true });
5
+ exports.addMessageEventListener = void 0;
6
+ const nativeModule_1 = require("../nativeModule");
7
+ const utils_1 = require("../utils");
8
+ const addMessageEventListener = (event, listener) => nativeModule_1.nativeEventEmitter.addListener(event, (nativeMessage) => {
9
+ listener((0, utils_1.normalizeNativeMessage)(nativeMessage), nativeMessage.completionHandlerId);
10
+ });
11
+ exports.addMessageEventListener = addMessageEventListener;
@@ -0,0 +1,2 @@
1
+ import { EmitterSubscription } from 'react-native';
2
+ export declare const addTokenEventListener: (event: string, listener: (token: string) => void) => EmitterSubscription;
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3
+ // SPDX-License-Identifier: Apache-2.0
4
+ Object.defineProperty(exports, "__esModule", { value: true });
5
+ exports.addTokenEventListener = void 0;
6
+ const nativeModule_1 = require("../nativeModule");
7
+ const addTokenEventListener = (event, listener) => nativeModule_1.nativeEventEmitter.addListener(event, ({ token }) => {
8
+ listener(token);
9
+ });
10
+ exports.addTokenEventListener = addTokenEventListener;
@@ -0,0 +1 @@
1
+ export declare const completeNotification: (completionHandlerId: string) => void;
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3
+ // SPDX-License-Identifier: Apache-2.0
4
+ Object.defineProperty(exports, "__esModule", { value: true });
5
+ exports.completeNotification = void 0;
6
+ const nativeModule_1 = require("../nativeModule");
7
+ const completeNotification = (completionHandlerId) => nativeModule_1.nativeModule.completeNotification?.(completionHandlerId);
8
+ exports.completeNotification = completeNotification;
@@ -0,0 +1 @@
1
+ export declare const getBadgeCount: () => void | Promise<number | null>;
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3
+ // SPDX-License-Identifier: Apache-2.0
4
+ Object.defineProperty(exports, "__esModule", { value: true });
5
+ exports.getBadgeCount = void 0;
6
+ const nativeModule_1 = require("../nativeModule");
7
+ const getBadgeCount = () => nativeModule_1.nativeModule.getBadgeCount?.();
8
+ exports.getBadgeCount = getBadgeCount;
@@ -0,0 +1,10 @@
1
+ export declare const getConstants: () => {
2
+ NativeEvent: {
3
+ BACKGROUND_MESSAGE_RECEIVED?: string | undefined;
4
+ FOREGROUND_MESSAGE_RECEIVED: string;
5
+ LAUNCH_NOTIFICATION_OPENED: string;
6
+ NOTIFICATION_OPENED: string;
7
+ TOKEN_RECEIVED: string;
8
+ };
9
+ NativeHeadlessTaskKey?: string | undefined;
10
+ };
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3
+ // SPDX-License-Identifier: Apache-2.0
4
+ Object.defineProperty(exports, "__esModule", { value: true });
5
+ exports.getConstants = void 0;
6
+ const nativeModule_1 = require("../nativeModule");
7
+ const getConstants = () => nativeModule_1.nativeModule.getConstants();
8
+ exports.getConstants = getConstants;
@@ -0,0 +1,2 @@
1
+ import { PushNotificationMessage } from '../types';
2
+ export declare const getLaunchNotification: () => Promise<PushNotificationMessage | null>;
@@ -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
+ exports.getLaunchNotification = void 0;
6
+ const nativeModule_1 = require("../nativeModule");
7
+ const utils_1 = require("../utils");
8
+ const getLaunchNotification = async () => (0, utils_1.normalizeNativeMessage)((await nativeModule_1.nativeModule.getLaunchNotification()) ?? undefined);
9
+ exports.getLaunchNotification = getLaunchNotification;
@@ -0,0 +1,2 @@
1
+ import { PushNotificationPermissionStatus } from '../types';
2
+ export declare const getPermissionStatus: () => Promise<PushNotificationPermissionStatus>;
@@ -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
+ exports.getPermissionStatus = void 0;
6
+ const nativeModule_1 = require("../nativeModule");
7
+ const utils_1 = require("../utils");
8
+ const getPermissionStatus = async () => (0, utils_1.normalizeNativePermissionStatus)(await nativeModule_1.nativeModule.getPermissionStatus());
9
+ exports.getPermissionStatus = getPermissionStatus;
@@ -0,0 +1,10 @@
1
+ export { addMessageEventListener } from './addMessageEventListener';
2
+ export { addTokenEventListener } from './addTokenEventListener';
3
+ export { completeNotification } from './completeNotification';
4
+ export { getBadgeCount } from './getBadgeCount';
5
+ export { getConstants } from './getConstants';
6
+ export { getLaunchNotification } from './getLaunchNotification';
7
+ export { getPermissionStatus } from './getPermissionStatus';
8
+ export { registerHeadlessTask } from './registerHeadlessTask';
9
+ export { requestPermissions } from './requestPermissions';
10
+ export { setBadgeCount } from './setBadgeCount';
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3
+ // SPDX-License-Identifier: Apache-2.0
4
+ Object.defineProperty(exports, "__esModule", { value: true });
5
+ exports.setBadgeCount = exports.requestPermissions = exports.registerHeadlessTask = exports.getPermissionStatus = exports.getLaunchNotification = exports.getConstants = exports.getBadgeCount = exports.completeNotification = exports.addTokenEventListener = exports.addMessageEventListener = void 0;
6
+ var addMessageEventListener_1 = require("./addMessageEventListener");
7
+ Object.defineProperty(exports, "addMessageEventListener", { enumerable: true, get: function () { return addMessageEventListener_1.addMessageEventListener; } });
8
+ var addTokenEventListener_1 = require("./addTokenEventListener");
9
+ Object.defineProperty(exports, "addTokenEventListener", { enumerable: true, get: function () { return addTokenEventListener_1.addTokenEventListener; } });
10
+ var completeNotification_1 = require("./completeNotification");
11
+ Object.defineProperty(exports, "completeNotification", { enumerable: true, get: function () { return completeNotification_1.completeNotification; } });
12
+ var getBadgeCount_1 = require("./getBadgeCount");
13
+ Object.defineProperty(exports, "getBadgeCount", { enumerable: true, get: function () { return getBadgeCount_1.getBadgeCount; } });
14
+ var getConstants_1 = require("./getConstants");
15
+ Object.defineProperty(exports, "getConstants", { enumerable: true, get: function () { return getConstants_1.getConstants; } });
16
+ var getLaunchNotification_1 = require("./getLaunchNotification");
17
+ Object.defineProperty(exports, "getLaunchNotification", { enumerable: true, get: function () { return getLaunchNotification_1.getLaunchNotification; } });
18
+ var getPermissionStatus_1 = require("./getPermissionStatus");
19
+ Object.defineProperty(exports, "getPermissionStatus", { enumerable: true, get: function () { return getPermissionStatus_1.getPermissionStatus; } });
20
+ var registerHeadlessTask_1 = require("./registerHeadlessTask");
21
+ Object.defineProperty(exports, "registerHeadlessTask", { enumerable: true, get: function () { return registerHeadlessTask_1.registerHeadlessTask; } });
22
+ var requestPermissions_1 = require("./requestPermissions");
23
+ Object.defineProperty(exports, "requestPermissions", { enumerable: true, get: function () { return requestPermissions_1.requestPermissions; } });
24
+ var setBadgeCount_1 = require("./setBadgeCount");
25
+ Object.defineProperty(exports, "setBadgeCount", { enumerable: true, get: function () { return setBadgeCount_1.setBadgeCount; } });
@@ -0,0 +1,2 @@
1
+ import { PushNotificationMessage } from '../types';
2
+ export declare const registerHeadlessTask: (task: (message: PushNotificationMessage | null) => Promise<void>) => void;
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3
+ // SPDX-License-Identifier: Apache-2.0
4
+ Object.defineProperty(exports, "__esModule", { value: true });
5
+ exports.registerHeadlessTask = void 0;
6
+ const react_native_1 = require("react-native");
7
+ const getConstants_1 = require("./getConstants");
8
+ const utils_1 = require("../utils");
9
+ const registerHeadlessTask = (task) => {
10
+ const { NativeHeadlessTaskKey } = (0, getConstants_1.getConstants)();
11
+ if (NativeHeadlessTaskKey) {
12
+ react_native_1.AppRegistry.registerHeadlessTask(NativeHeadlessTaskKey, () => async (nativeMessage) => {
13
+ await task((0, utils_1.normalizeNativeMessage)(nativeMessage));
14
+ });
15
+ }
16
+ };
17
+ exports.registerHeadlessTask = registerHeadlessTask;
@@ -0,0 +1,2 @@
1
+ import { PushNotificationPermissions } from '../types';
2
+ export declare const requestPermissions: ({ alert, badge, sound }?: PushNotificationPermissions) => Promise<boolean>;
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3
+ // SPDX-License-Identifier: Apache-2.0
4
+ Object.defineProperty(exports, "__esModule", { value: true });
5
+ exports.requestPermissions = void 0;
6
+ const nativeModule_1 = require("../nativeModule");
7
+ const requestPermissions = async ({ alert = true, badge = true, sound = true } = {
8
+ alert: true,
9
+ badge: true,
10
+ sound: true,
11
+ }) => nativeModule_1.nativeModule.requestPermissions({
12
+ alert,
13
+ badge,
14
+ sound,
15
+ });
16
+ exports.requestPermissions = requestPermissions;
@@ -0,0 +1 @@
1
+ export declare const setBadgeCount: (count: number) => void;
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3
+ // SPDX-License-Identifier: Apache-2.0
4
+ Object.defineProperty(exports, "__esModule", { value: true });
5
+ exports.setBadgeCount = void 0;
6
+ const nativeModule_1 = require("../nativeModule");
7
+ const setBadgeCount = (count) => nativeModule_1.nativeModule.setBadgeCount?.(count);
8
+ exports.setBadgeCount = setBadgeCount;
@@ -0,0 +1,2 @@
1
+ export declare const PACKAGE_NAME = "@aws-amplify/rtn-push-notification";
2
+ export declare const LINKING_ERROR: string;
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.LINKING_ERROR = exports.PACKAGE_NAME = void 0;
4
+ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
5
+ // SPDX-License-Identifier: Apache-2.0
6
+ const react_native_1 = require("react-native");
7
+ // General
8
+ exports.PACKAGE_NAME = '@aws-amplify/rtn-push-notification';
9
+ exports.LINKING_ERROR = `The ${exports.PACKAGE_NAME} package doesn't seem to be linked. Make sure: \n\n` +
10
+ react_native_1.Platform.select({ ios: "- You have run 'pod install'\n", default: '' }) +
11
+ '- You rebuilt the app after installing the package\n' +
12
+ '- You are not using Expo Go\n';
package/lib/index.d.ts CHANGED
@@ -1,3 +1,24 @@
1
- import { PushNotificationNativeModule } from './types';
2
- export { PushNotificationNativeModule } from './types';
3
- export declare const AmplifyRTNPushNotification: PushNotificationNativeModule;
1
+ export { PushNotificationMessage, PushNotificationPermissionStatus, PushNotificationPermissions, } from './types';
2
+ declare const module: {
3
+ addMessageEventListener: (event: string, listener: (message: import("./types").PushNotificationMessage | null, completionHandlerId?: string | undefined) => void) => import("react-native").EmitterSubscription;
4
+ addTokenEventListener: (event: string, listener: (token: string) => void) => import("react-native").EmitterSubscription;
5
+ completeNotification: (completionHandlerId: string) => void;
6
+ getBadgeCount: () => void | Promise<number | null>;
7
+ getConstants: () => {
8
+ NativeEvent: {
9
+ BACKGROUND_MESSAGE_RECEIVED?: string | undefined;
10
+ FOREGROUND_MESSAGE_RECEIVED: string;
11
+ LAUNCH_NOTIFICATION_OPENED: string;
12
+ NOTIFICATION_OPENED: string;
13
+ TOKEN_RECEIVED: string;
14
+ };
15
+ NativeHeadlessTaskKey?: string | undefined;
16
+ };
17
+ getLaunchNotification: () => Promise<import("./types").PushNotificationMessage | null>;
18
+ getPermissionStatus: () => Promise<import("./types").PushNotificationPermissionStatus>;
19
+ registerHeadlessTask: (task: (message: import("./types").PushNotificationMessage | null) => Promise<void>) => void;
20
+ requestPermissions: ({ alert, badge, sound }?: import("./types").PushNotificationPermissions) => Promise<boolean>;
21
+ setBadgeCount: (count: number) => void;
22
+ };
23
+ export type PushNotificationModule = typeof module;
24
+ export { module };
package/lib/index.js CHANGED
@@ -2,6 +2,18 @@
2
2
  // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3
3
  // SPDX-License-Identifier: Apache-2.0
4
4
  Object.defineProperty(exports, "__esModule", { value: true });
5
- var react_native_1 = require("react-native");
6
- exports.AmplifyRTNPushNotification = react_native_1.NativeModules.AmplifyRTNPushNotification;
7
- //# sourceMappingURL=index.js.map
5
+ exports.module = void 0;
6
+ const apis_1 = require("./apis");
7
+ const module = {
8
+ addMessageEventListener: apis_1.addMessageEventListener,
9
+ addTokenEventListener: apis_1.addTokenEventListener,
10
+ completeNotification: apis_1.completeNotification,
11
+ getBadgeCount: apis_1.getBadgeCount,
12
+ getConstants: apis_1.getConstants,
13
+ getLaunchNotification: apis_1.getLaunchNotification,
14
+ getPermissionStatus: apis_1.getPermissionStatus,
15
+ registerHeadlessTask: apis_1.registerHeadlessTask,
16
+ requestPermissions: apis_1.requestPermissions,
17
+ setBadgeCount: apis_1.setBadgeCount,
18
+ };
19
+ exports.module = module;
@@ -0,0 +1,4 @@
1
+ import { NativeEventEmitter } from 'react-native';
2
+ import { PushNotificationNativeModule } from './types';
3
+ export declare const nativeModule: PushNotificationNativeModule;
4
+ export declare const nativeEventEmitter: NativeEventEmitter;
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3
+ // SPDX-License-Identifier: Apache-2.0
4
+ Object.defineProperty(exports, "__esModule", { value: true });
5
+ exports.nativeEventEmitter = exports.nativeModule = void 0;
6
+ const react_native_1 = require("react-native");
7
+ const constants_1 = require("./constants");
8
+ exports.nativeModule = react_native_1.NativeModules.AmplifyRTNPushNotification
9
+ ? react_native_1.NativeModules.AmplifyRTNPushNotification
10
+ : new Proxy({}, {
11
+ get() {
12
+ throw new Error(constants_1.LINKING_ERROR);
13
+ },
14
+ });
15
+ exports.nativeEventEmitter = new react_native_1.NativeEventEmitter(exports.nativeModule);
@@ -0,0 +1 @@
1
+ {"program":{"fileNames":["../node_modules/typescript/lib/lib.es5.d.ts","../node_modules/typescript/lib/lib.es2015.d.ts","../node_modules/typescript/lib/lib.es2016.d.ts","../node_modules/typescript/lib/lib.es2017.d.ts","../node_modules/typescript/lib/lib.es2018.d.ts","../node_modules/typescript/lib/lib.es2019.d.ts","../node_modules/typescript/lib/lib.es2020.d.ts","../node_modules/typescript/lib/lib.es2021.d.ts","../node_modules/typescript/lib/lib.es2022.d.ts","../node_modules/typescript/lib/lib.es2023.d.ts","../node_modules/typescript/lib/lib.esnext.d.ts","../node_modules/typescript/lib/lib.dom.d.ts","../node_modules/typescript/lib/lib.es2015.core.d.ts","../node_modules/typescript/lib/lib.es2015.collection.d.ts","../node_modules/typescript/lib/lib.es2015.generator.d.ts","../node_modules/typescript/lib/lib.es2015.iterable.d.ts","../node_modules/typescript/lib/lib.es2015.promise.d.ts","../node_modules/typescript/lib/lib.es2015.proxy.d.ts","../node_modules/typescript/lib/lib.es2015.reflect.d.ts","../node_modules/typescript/lib/lib.es2015.symbol.d.ts","../node_modules/typescript/lib/lib.es2015.symbol.wellknown.d.ts","../node_modules/typescript/lib/lib.es2016.array.include.d.ts","../node_modules/typescript/lib/lib.es2017.object.d.ts","../node_modules/typescript/lib/lib.es2017.sharedmemory.d.ts","../node_modules/typescript/lib/lib.es2017.string.d.ts","../node_modules/typescript/lib/lib.es2017.intl.d.ts","../node_modules/typescript/lib/lib.es2017.typedarrays.d.ts","../node_modules/typescript/lib/lib.es2018.asyncgenerator.d.ts","../node_modules/typescript/lib/lib.es2018.asynciterable.d.ts","../node_modules/typescript/lib/lib.es2018.intl.d.ts","../node_modules/typescript/lib/lib.es2018.promise.d.ts","../node_modules/typescript/lib/lib.es2018.regexp.d.ts","../node_modules/typescript/lib/lib.es2019.array.d.ts","../node_modules/typescript/lib/lib.es2019.object.d.ts","../node_modules/typescript/lib/lib.es2019.string.d.ts","../node_modules/typescript/lib/lib.es2019.symbol.d.ts","../node_modules/typescript/lib/lib.es2019.intl.d.ts","../node_modules/typescript/lib/lib.es2020.bigint.d.ts","../node_modules/typescript/lib/lib.es2020.date.d.ts","../node_modules/typescript/lib/lib.es2020.promise.d.ts","../node_modules/typescript/lib/lib.es2020.sharedmemory.d.ts","../node_modules/typescript/lib/lib.es2020.string.d.ts","../node_modules/typescript/lib/lib.es2020.symbol.wellknown.d.ts","../node_modules/typescript/lib/lib.es2020.intl.d.ts","../node_modules/typescript/lib/lib.es2020.number.d.ts","../node_modules/typescript/lib/lib.es2021.promise.d.ts","../node_modules/typescript/lib/lib.es2021.string.d.ts","../node_modules/typescript/lib/lib.es2021.weakref.d.ts","../node_modules/typescript/lib/lib.es2021.intl.d.ts","../node_modules/typescript/lib/lib.es2022.array.d.ts","../node_modules/typescript/lib/lib.es2022.error.d.ts","../node_modules/typescript/lib/lib.es2022.intl.d.ts","../node_modules/typescript/lib/lib.es2022.object.d.ts","../node_modules/typescript/lib/lib.es2022.sharedmemory.d.ts","../node_modules/typescript/lib/lib.es2022.string.d.ts","../node_modules/typescript/lib/lib.es2022.regexp.d.ts","../node_modules/typescript/lib/lib.es2023.array.d.ts","../node_modules/typescript/lib/lib.esnext.intl.d.ts","../node_modules/typescript/lib/lib.decorators.d.ts","../node_modules/typescript/lib/lib.decorators.legacy.d.ts","../node_modules/@types/react-native/globals.d.ts","../node_modules/@types/react-native/legacy-properties.d.ts","../node_modules/@types/react-native/BatchedBridge.d.ts","../node_modules/@types/react-native/Codegen.d.ts","../node_modules/@types/react-native/Devtools.d.ts","../node_modules/@types/react-native/LaunchScreen.d.ts","../node_modules/@types/react/ts5.0/global.d.ts","../node_modules/csstype/index.d.ts","../node_modules/@types/prop-types/index.d.ts","../node_modules/@types/scheduler/tracing.d.ts","../node_modules/@types/react/ts5.0/index.d.ts","../node_modules/@types/react-native/index.d.ts","../src/constants.ts","../src/types/module.ts","../src/types/native.ts","../src/types/index.ts","../src/nativeModule.ts","../../../node_modules/@types/lodash/common/common.d.ts","../../../node_modules/@types/lodash/common/array.d.ts","../../../node_modules/@types/lodash/common/collection.d.ts","../../../node_modules/@types/lodash/common/date.d.ts","../../../node_modules/@types/lodash/common/function.d.ts","../../../node_modules/@types/lodash/common/lang.d.ts","../../../node_modules/@types/lodash/common/math.d.ts","../../../node_modules/@types/lodash/common/number.d.ts","../../../node_modules/@types/lodash/common/object.d.ts","../../../node_modules/@types/lodash/common/seq.d.ts","../../../node_modules/@types/lodash/common/string.d.ts","../../../node_modules/@types/lodash/common/util.d.ts","../../../node_modules/@types/lodash/index.d.ts","../src/utils/normalizeNativeMessage.ts","../src/utils/normalizeNativePermissionStatus.ts","../src/utils/index.ts","../src/apis/addMessageEventListener.ts","../src/apis/addTokenEventListener.ts","../src/apis/completeNotification.ts","../src/apis/getBadgeCount.ts","../src/apis/getConstants.ts","../src/apis/getLaunchNotification.ts","../src/apis/getPermissionStatus.ts","../src/apis/registerHeadlessTask.ts","../src/apis/requestPermissions.ts","../src/apis/setBadgeCount.ts","../src/apis/index.ts","../src/index.ts","../../../node_modules/@types/events/index.d.ts","../../../node_modules/@types/node/inspector.d.ts","../../../node_modules/@types/node/base.d.ts","../../../node_modules/@types/node/index.d.ts"],"fileInfos":[{"version":"6a6b471e7e43e15ef6f8fe617a22ce4ecb0e34efa6c3dfcfe7cebd392bcca9d2","affectsGlobalScope":true},"45b7ab580deca34ae9729e97c13cfd999df04416a79116c3bfb483804f85ded4","dc48272d7c333ccf58034c0026162576b7d50ea0e69c3b9292f803fc20720fd5","27147504487dc1159369da4f4da8a26406364624fa9bc3db632f7d94a5bae2c3","5e1c4c362065a6b95ff952c0eab010f04dcd2c3494e813b493ecfd4fcb9fc0d8","68d73b4a11549f9c0b7d352d10e91e5dca8faa3322bfb77b661839c42b1ddec7","5efce4fc3c29ea84e8928f97adec086e3dc876365e0982cc8479a07954a3efd4","feecb1be483ed332fad555aff858affd90a48ab19ba7272ee084704eb7167569","5514e54f17d6d74ecefedc73c504eadffdeda79c7ea205cf9febead32d45c4bc","f4e736d6c8d69ae5b3ab0ddfcaa3dc365c3e76909d6660af5b4e979b3934ac20","eeeb3aca31fbadef8b82502484499dfd1757204799a6f5b33116201c810676ec",{"version":"fcd3ecc9f764f06f4d5c467677f4f117f6abf49dee6716283aa204ff1162498b","affectsGlobalScope":true},{"version":"f296963760430fb65b4e5d91f0ed770a91c6e77455bacf8fa23a1501654ede0e","affectsGlobalScope":true},{"version":"5114a95689b63f96b957e00216bc04baf9e1a1782aa4d8ee7e5e9acbf768e301","affectsGlobalScope":true},{"version":"4443e68b35f3332f753eacc66a04ac1d2053b8b035a0e0ac1d455392b5e243b3","affectsGlobalScope":true},{"version":"ab22100fdd0d24cfc2cc59d0a00fc8cf449830d9c4030dc54390a46bd562e929","affectsGlobalScope":true},{"version":"f7bd636ae3a4623c503359ada74510c4005df5b36de7f23e1db8a5c543fd176b","affectsGlobalScope":true},{"version":"ce691fb9e5c64efb9547083e4a34091bcbe5bdb41027e310ebba8f7d96a98671","affectsGlobalScope":true},{"version":"8d697a2a929a5fcb38b7a65594020fcef05ec1630804a33748829c5ff53640d0","affectsGlobalScope":true},{"version":"0c20f4d2358eb679e4ae8a4432bdd96c857a2960fd6800b21ec4008ec59d60ea","affectsGlobalScope":true},{"version":"36ae84ccc0633f7c0787bc6108386c8b773e95d3b052d9464a99cd9b8795fbec","affectsGlobalScope":true},{"version":"82d0d8e269b9eeac02c3bd1c9e884e85d483fcb2cd168bccd6bc54df663da031","affectsGlobalScope":true},{"version":"b8deab98702588840be73d67f02412a2d45a417a3c097b2e96f7f3a42ac483d1","affectsGlobalScope":true},{"version":"4738f2420687fd85629c9efb470793bb753709c2379e5f85bc1815d875ceadcd","affectsGlobalScope":true},{"version":"2f11ff796926e0832f9ae148008138ad583bd181899ab7dd768a2666700b1893","affectsGlobalScope":true},{"version":"376d554d042fb409cb55b5cbaf0b2b4b7e669619493c5d18d5fa8bd67273f82a","affectsGlobalScope":true},{"version":"9fc46429fbe091ac5ad2608c657201eb68b6f1b8341bd6d670047d32ed0a88fa","affectsGlobalScope":true},{"version":"61c37c1de663cf4171e1192466e52c7a382afa58da01b1dc75058f032ddf0839","affectsGlobalScope":true},{"version":"c4138a3dd7cd6cf1f363ca0f905554e8d81b45844feea17786cdf1626cb8ea06","affectsGlobalScope":true},{"version":"6ff3e2452b055d8f0ec026511c6582b55d935675af67cdb67dd1dc671e8065df","affectsGlobalScope":true},{"version":"03de17b810f426a2f47396b0b99b53a82c1b60e9cba7a7edda47f9bb077882f4","affectsGlobalScope":true},{"version":"8184c6ddf48f0c98429326b428478ecc6143c27f79b79e85740f17e6feb090f1","affectsGlobalScope":true},{"version":"261c4d2cf86ac5a89ad3fb3fafed74cbb6f2f7c1d139b0540933df567d64a6ca","affectsGlobalScope":true},{"version":"6af1425e9973f4924fca986636ac19a0cf9909a7e0d9d3009c349e6244e957b6","affectsGlobalScope":true},{"version":"576711e016cf4f1804676043e6a0a5414252560eb57de9faceee34d79798c850","affectsGlobalScope":true},{"version":"89c1b1281ba7b8a96efc676b11b264de7a8374c5ea1e6617f11880a13fc56dc6","affectsGlobalScope":true},{"version":"15a630d6817718a2ddd7088c4f83e4673fde19fa992d2eae2cf51132a302a5d3","affectsGlobalScope":true},{"version":"b7e9f95a7387e3f66be0ed6db43600c49cec33a3900437ce2fd350d9b7cb16f2","affectsGlobalScope":true},{"version":"01e0ee7e1f661acedb08b51f8a9b7d7f959e9cdb6441360f06522cc3aea1bf2e","affectsGlobalScope":true},{"version":"ac17a97f816d53d9dd79b0d235e1c0ed54a8cc6a0677e9a3d61efb480b2a3e4e","affectsGlobalScope":true},{"version":"bf14a426dbbf1022d11bd08d6b8e709a2e9d246f0c6c1032f3b2edb9a902adbe","affectsGlobalScope":true},{"version":"ec0104fee478075cb5171e5f4e3f23add8e02d845ae0165bfa3f1099241fa2aa","affectsGlobalScope":true},{"version":"2b72d528b2e2fe3c57889ca7baef5e13a56c957b946906d03767c642f386bbc3","affectsGlobalScope":true},{"version":"9cc66b0513ad41cb5f5372cca86ef83a0d37d1c1017580b7dace3ea5661836df","affectsGlobalScope":true},{"version":"368af93f74c9c932edd84c58883e736c9e3d53cec1fe24c0b0ff451f529ceab1","affectsGlobalScope":true},{"version":"709efdae0cb5df5f49376cde61daacc95cdd44ae4671da13a540da5088bf3f30","affectsGlobalScope":true},{"version":"995c005ab91a498455ea8dfb63aa9f83fa2ea793c3d8aa344be4a1678d06d399","affectsGlobalScope":true},{"version":"61ed9b6d07af959e745fb11f9593ecd743b279418cc8a99448ea3cd5f3b3eb22","affectsGlobalScope":true},{"version":"038a2f66a34ee7a9c2fbc3584c8ab43dff2995f8c68e3f566f4c300d2175e31e","affectsGlobalScope":true},{"version":"4fa6ed14e98aa80b91f61b9805c653ee82af3502dc21c9da5268d3857772ca05","affectsGlobalScope":true},{"version":"f5c92f2c27b06c1a41b88f6db8299205aee52c2a2943f7ed29bd585977f254e8","affectsGlobalScope":true},{"version":"b7feb7967c6c6003e11f49efa8f5de989484e0a6ba2e5a6c41b55f8b8bd85dba","affectsGlobalScope":true},{"version":"8444af78980e3b20b49324f4a16ba35024fef3ee069a0eb67616ea6ca821c47a","affectsGlobalScope":true},{"version":"b9ea5778ff8b50d7c04c9890170db34c26a5358cccba36844fe319f50a43a61a","affectsGlobalScope":true},{"version":"3287d9d085fbd618c3971944b65b4be57859f5415f495b33a6adc994edd2f004","affectsGlobalScope":true},{"version":"50d53ccd31f6667aff66e3d62adf948879a3a16f05d89882d1188084ee415bbc","affectsGlobalScope":true},{"version":"25de46552b782d43cb7284df22fe2a265de387cf0248b747a7a1b647d81861f6","affectsGlobalScope":true},{"version":"307c8b7ebbd7f23a92b73a4c6c0a697beca05b06b036c23a34553e5fe65e4fdc","affectsGlobalScope":true},{"version":"189c0703923150aa30673fa3de411346d727cc44a11c75d05d7cf9ef095daa22","affectsGlobalScope":true},{"version":"95f22ce5f9dbcfc757ff850e7326a1ba1bc69806f1e70f48caefa824819d6f4f","affectsGlobalScope":true},{"version":"a76bbd53b4eafb985c6200962d1c9ec1ded8fa80c06ade7488be971e9eaa0e2d","affectsGlobalScope":true},"840dd3c9c22dc9f99d2cd7861d105f2275ba34b40c01a65f3a0f33b07b09ab4b",{"version":"efd32b1ab5e3897f64ed3d0f236657c3c9c7bcc669449e608ebee1ad9dbe396a","affectsGlobalScope":true},"ec8c27fd889adbf6a774c7915d25030f19adf16143bce0cbc42b566762e0b5a9","7fb3279c4bf36d993b1e8b339cded5908f7b2ec1b6e0ac2feaa842b5b6b143f1","234b97ac9af46707f2315ff395a9b340d37b7dbc8290d91f5d6bd97189d220f3",{"version":"0bd5e7096c7bc02bf70b2cc017fc45ef489cb19bd2f32a71af39ff5787f1b56a","affectsGlobalScope":true},"4c68749a564a6facdf675416d75789ee5a557afda8960e0803cf6711fa569288","8c6aac56e9dddb1f02d8e75478b79da0d25a1d0e38e75d5b8947534f61f3785e","5f8f00356f6a82e21493b2d57b2178f11b00cf8960df00bd37bdcae24c9333ca",{"version":"a694c85180021f7681f98dbde94b648b4e1483ad6fad4afc1d217619613f833a","affectsGlobalScope":true},{"version":"ec098916e691815f53433757e1b42b2c759b244027341ce52f51f68a4290cedc","affectsGlobalScope":true},{"version":"ad63f36e6b2b8bc81210018822b92a0a6aac0fa146ff1b4dd1f1756f910e6a38","signature":"af07bd1cc663dea0aaee9d2bbb8747edd005c603b2b496092b7c12eb0e9467ba"},{"version":"80f14a6f48880f4740bdec4beea7554cafd35870da0ce5508f0fcb666f17cbae","signature":"3b8ca1a74249f4e58e2012857e6b153954b80dd0d7ad0d6a2bd5db332f60be61"},{"version":"22ff79c193c7d425a9ec3ad451ae3eb30aeaf9c1f374b0df8906bcfb65b4722b","signature":"11b2f8da4815926e445ea2fb5b1c6b5dfba0e106a5764cc709e7eae14b3f8b6d"},{"version":"eb275b6026e1b89c5a948d6b789018f295c08d3ebb326c278b39bb898aacea0b","signature":"495145ff7a10f8dfdfcd5a85b641eabdffb504bc84d979fbb459de8a2a096a40"},{"version":"843d6dbabae3b4bd6fcb57287c4364d4d07acce351537faecb701952a4de0d5b","signature":"6510d3e1a557b12a29bb09210a0336c14d2edcbc130b862ee2a3f35ae03f54bb"},"675e702f2032766a91eeadee64f51014c64688525da99dccd8178f0c599f13a8","fe4a2042d087990ebfc7dc0142d5aaf5a152e4baea86b45f283f103ec1e871ea","d70c026dd2eeaa974f430ea229230a1897fdb897dc74659deebe2afd4feeb08f","187119ff4f9553676a884e296089e131e8cc01691c546273b1d0089c3533ce42","febf0b2de54781102b00f61653b21377390a048fbf5262718c91860d11ff34a6","ca59fe42b81228a317812e95a2e72ccc8c7f1911b5f0c2a032adf41a0161ec5d","9364c7566b0be2f7b70ff5285eb34686f83ccb01bda529b82d23b2a844653bfb","00baffbe8a2f2e4875367479489b5d43b5fc1429ecb4a4cc98cfc3009095f52a","ae9930989ed57478eb03b9b80ad3efa7a3eacdfeff0f78ecf7894c4963a64f93","3c92b6dfd43cc1c2485d9eba5ff0b74a19bb8725b692773ef1d66dac48cda4bd","3e59f00ab03c33717b3130066d4debb272da90eeded4935ff0604c2bc25a5cae","df996e25faa505f85aeb294d15ebe61b399cf1d1e49959cdfaf2cc0815c203f9",{"version":"f2eff8704452659641164876c1ef0df4174659ce7311b0665798ea3f556fa9ad","affectsGlobalScope":true},{"version":"3e0f22dc99e53928eeef56e3cf59bf9b9178735726a8523afa9a9cba95f561ce","signature":"93d1427f4f6fcde3dccdb5f6d8729c918330a335bb9a9f50f4337a518436ec19"},{"version":"565bcee4eab10c7c7b6072086c0ec6be4c075c70f7a8c06e20aee360e92864c8","signature":"8f45aa7fd7b455c02ffe0942b9a8c7cad3d8fa0368a97accaf754695d78e8b22"},{"version":"74ed1d7aedb506b6fcf08da40c5547b3d90a1bbe1c7f9b788af9154a6fa364a5","signature":"6075db412fa82ddb92b3ba6e273731e0285e5526950007ac617618f714ed2576"},{"version":"14f71fc0d5cddee2b25fb1e6e34a16b74477697a25d1e39b84ab9ad7aa562306","signature":"573ea4ca6792e46121e672d0d030da1252963c58854e98c347a1fa07ec34bc9d"},{"version":"70006c7d64656bf04d398d6188ef93d3d545a45c0f78203e89ec910b381f54b6","signature":"90e5dac1da43d2080be5171752d3fcc1fa503cc46263fca43b56979e508cf9e4"},{"version":"f27c6ffc94ce1debc8b46a34bdcb90fc90400841a15cb4df474149fbd22ba3ef","signature":"a9ffec24475367b03e7c293e9d02d33e22962cbda10b6129207dda18da0cfed6"},{"version":"f2c3fe3276aabfbd252e6c53c93c7a2d2ca3f2e034cd4d2b0b87de7aa41b6405","signature":"8510fdad58d17bd4d7a5cdef9d2c5b342e3d3106a8e25725ad3a97c8bfecad43"},{"version":"26e3f8327ba70ae7cb667cf88cbb0812bfdfe095cbe984996b8ce3f10d28aff2","signature":"59bb79a1ef176e353316dd1f499cfc9413d734e08b374480422fca91409e10e5"},{"version":"a095b440048e15932b88c300b142881ee2e6b0053dbc7eec58c483ef9da6c059","signature":"0cf256af183775b09e98271b84afd8c6655fea1abdc92ad7fe3149a643722f5a"},{"version":"f56ad54283e8d995cffa319d107ff3bbe7a2eadb9058306389ebfe3fdeea73c7","signature":"468e3b775d115f243b9b050b4a0a14d5d5319eb6a11631abb87a3af106d1e166"},{"version":"d7503fb99d03e628fb5b3805edf84ec623450d72423db46179cfc4fa60c649df","signature":"f2017f5610f1507e63f8f53c30ebca0f0a9a89fc8048b532a69253b3320f8c97"},{"version":"ed2ad7986be2f42eb71520f24882082e05b84641536fecf62aabf94c02fe79f1","signature":"0b091d5d86c48a1638cde9c24c40072fd7cbc8383596a2a60fa8c5740e8e3465"},{"version":"a59751c9afb49dea0bfa44bfa020ae3662be01ccc994c0c68e51d349ad52abf3","signature":"0723d06ffaee4c650470960527472a592f2e461956222b3f07cc012f5862681a"},{"version":"9cac713000bef957ae9bbf21746f06784b93eb1b362d6383e5c2316e1688c653","signature":"7df266f6512f80f7bed470b2225886f7c3759053ded4a49bec7ae2e0e19b7ecc"},{"version":"bfff0f1d3bd943a4d12a09b9bf634e6650a2e25c9ab387e43220c63886b40d10","signature":"50da250cfd99d5497756be8380f1bc6d28a3b3f5c529256f6bccf7f3b01e2555"},"93d28b4eb12c68fccc1f2fc04a4ef83ea3b2a03b18055d3bf29cab267aa7042e","7e49dbf1543b3ee54853ade4c5e9fa460b6a4eca967efe6bf943e0c505d087ed",{"version":"4450cc7b485b116b876cfe3e57d82b76464d6aee1ecefe0bf5ffc03ad9f13cf7","affectsGlobalScope":true},"9f0963be7caec23db8944f66bacb623a7bc7391520125845087241a270e9b3ce"],"root":[[73,77],[91,105]],"options":{"declaration":true,"downlevelIteration":true,"esModuleInterop":true,"importHelpers":false,"module":1,"noEmitOnError":true,"noImplicitAny":true,"outDir":"./","skipLibCheck":true,"strict":true,"target":99},"fileIdsList":[[108,109],[78,80,81,82,83,84,85,86,87,88,89,90,108,109],[78,79,81,82,83,84,85,86,87,88,89,90,108,109],[79,80,81,82,83,84,85,86,87,88,89,90,108,109],[78,79,80,82,83,84,85,86,87,88,89,90,108,109],[78,79,80,81,83,84,85,86,87,88,89,90,108,109],[78,79,80,81,82,84,85,86,87,88,89,90,108,109],[78,79,80,81,82,83,85,86,87,88,89,90,108,109],[78,79,80,81,82,83,84,86,87,88,89,90,108,109],[78,79,80,81,82,83,84,85,87,88,89,90,108,109],[78,79,80,81,82,83,84,85,86,88,89,90,108,109],[78,79,80,81,82,83,84,85,86,87,89,90,108,109],[78,79,80,81,82,83,84,85,86,87,88,90,108,109],[78,79,80,81,82,83,84,85,86,87,88,89,108,109],[107,108,109],[108],[62,72,108,109],[65,108,109],[61,62,63,64,65,66,71,108,109],[67,68,69,70,108,109],[62,72,76,77,93,108,109],[62,72,76,77,108,109],[77,108,109],[76,77,93,108,109],[94,95,96,97,98,99,100,101,102,103,108,109],[62,72,76,93,98,108,109],[76,77,108,109],[76,104,108,109],[62,72,73,76,108,109],[74,75,108,109],[62,72,74,108,109],[91,92,108,109],[76,90,108,109],[76,108,109],[62,72,76],[62,72],[76],[94,95,96,97,98,99,100,101,102,103],[74,75],[62,72,74],[91,92]],"referencedMap":[[106,1],[79,2],[80,3],[78,4],[81,5],[82,6],[83,7],[84,8],[85,9],[86,10],[87,11],[88,12],[89,13],[90,14],[108,15],[109,16],[107,1],[69,1],[63,1],[64,17],[65,18],[66,1],[61,1],[72,19],[62,17],[67,1],[71,20],[70,1],[68,1],[59,1],[60,1],[12,1],[14,1],[13,1],[2,1],[15,1],[16,1],[17,1],[18,1],[19,1],[20,1],[21,1],[22,1],[3,1],[4,1],[26,1],[23,1],[24,1],[25,1],[27,1],[28,1],[29,1],[5,1],[30,1],[31,1],[32,1],[33,1],[6,1],[37,1],[34,1],[35,1],[36,1],[38,1],[7,1],[39,1],[44,1],[45,1],[40,1],[41,1],[42,1],[43,1],[8,1],[49,1],[46,1],[47,1],[48,1],[50,1],[9,1],[51,1],[52,1],[53,1],[56,1],[54,1],[55,1],[57,1],[10,1],[1,1],[11,1],[58,1],[94,21],[95,22],[96,23],[97,23],[98,23],[99,24],[100,24],[104,25],[101,26],[102,27],[103,23],[73,17],[105,28],[77,29],[76,30],[74,1],[75,31],[93,32],[91,33],[92,34]],"exportedModulesMap":[[106,1],[79,2],[80,3],[78,4],[81,5],[82,6],[83,7],[84,8],[85,9],[86,10],[87,11],[88,12],[89,13],[90,14],[108,15],[109,16],[107,1],[69,1],[63,1],[64,17],[65,18],[66,1],[61,1],[72,19],[62,17],[67,1],[71,20],[70,1],[68,1],[59,1],[60,1],[12,1],[14,1],[13,1],[2,1],[15,1],[16,1],[17,1],[18,1],[19,1],[20,1],[21,1],[22,1],[3,1],[4,1],[26,1],[23,1],[24,1],[25,1],[27,1],[28,1],[29,1],[5,1],[30,1],[31,1],[32,1],[33,1],[6,1],[37,1],[34,1],[35,1],[36,1],[38,1],[7,1],[39,1],[44,1],[45,1],[40,1],[41,1],[42,1],[43,1],[8,1],[49,1],[46,1],[47,1],[48,1],[50,1],[9,1],[51,1],[52,1],[53,1],[56,1],[54,1],[55,1],[57,1],[10,1],[1,1],[11,1],[58,1],[94,35],[95,36],[99,37],[100,37],[104,38],[101,37],[102,37],[105,35],[77,35],[76,39],[75,40],[93,41],[91,37],[92,37]],"semanticDiagnosticsPerFile":[106,79,80,78,81,82,83,84,85,86,87,88,89,90,108,109,107,69,63,64,65,66,61,72,62,67,71,70,68,59,60,12,14,13,2,15,16,17,18,19,20,21,22,3,4,26,23,24,25,27,28,29,5,30,31,32,33,6,37,34,35,36,38,7,39,44,45,40,41,42,43,8,49,46,47,48,50,9,51,52,53,56,54,55,57,10,1,11,58,94,95,96,97,98,99,100,104,101,102,103,73,105,77,76,74,75,93,91,92]},"version":"5.0.2"}
@@ -0,0 +1,2 @@
1
+ export * from './module';
2
+ export * from './native';
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3
+ // SPDX-License-Identifier: Apache-2.0
4
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
5
+ if (k2 === undefined) k2 = k;
6
+ var desc = Object.getOwnPropertyDescriptor(m, k);
7
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
8
+ desc = { enumerable: true, get: function() { return m[k]; } };
9
+ }
10
+ Object.defineProperty(o, k2, desc);
11
+ }) : (function(o, m, k, k2) {
12
+ if (k2 === undefined) k2 = k;
13
+ o[k2] = m[k];
14
+ }));
15
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
16
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
17
+ };
18
+ Object.defineProperty(exports, "__esModule", { value: true });
19
+ __exportStar(require("./module"), exports);
20
+ __exportStar(require("./native"), exports);
@@ -0,0 +1,31 @@
1
+ /**
2
+ * Types here are duplicated to the push notificaiton category within Amplify as it is not possible to share a
3
+ * source of truth with a package that may conditionally not exist for developers not using push notifications.
4
+ * Modifications made to these types should be reflected in the Amplify library and vice-versa!
5
+ */
6
+ export interface PushNotificationPermissions extends Partial<Record<string, boolean>> {
7
+ alert?: boolean;
8
+ badge?: boolean;
9
+ sound?: boolean;
10
+ }
11
+ export interface PushNotificationMessage {
12
+ title?: string;
13
+ body?: string;
14
+ imageUrl?: string;
15
+ deeplinkUrl?: string;
16
+ goToUrl?: string;
17
+ fcmOptions?: FcmPlatformOptions;
18
+ apnsOptions?: ApnsPlatformOptions;
19
+ data?: Record<string, unknown>;
20
+ }
21
+ export type PushNotificationPermissionStatus = 'denied' | 'granted' | 'shouldRequest' | 'shouldExplainThenRequest';
22
+ interface ApnsPlatformOptions {
23
+ subtitle?: string;
24
+ }
25
+ interface FcmPlatformOptions {
26
+ channelId: string;
27
+ messageId: string;
28
+ senderId: string;
29
+ sendTime: Date;
30
+ }
31
+ export {};
@@ -2,4 +2,3 @@
2
2
  // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3
3
  // SPDX-License-Identifier: Apache-2.0
4
4
  Object.defineProperty(exports, "__esModule", { value: true });
5
- //# sourceMappingURL=types.js.map
@@ -0,0 +1,69 @@
1
+ import { NativeModule } from 'react-native';
2
+ import { PushNotificationMessage, PushNotificationPermissions } from './module';
3
+ export interface PushNotificationNativeModule extends NativeModule {
4
+ completeNotification?: (completionHandlerId: string) => void;
5
+ getConstants: () => {
6
+ NativeEvent: {
7
+ BACKGROUND_MESSAGE_RECEIVED?: string;
8
+ FOREGROUND_MESSAGE_RECEIVED: string;
9
+ LAUNCH_NOTIFICATION_OPENED: string;
10
+ NOTIFICATION_OPENED: string;
11
+ TOKEN_RECEIVED: string;
12
+ };
13
+ NativeHeadlessTaskKey?: string;
14
+ };
15
+ getLaunchNotification: () => Promise<NativeMessage | null>;
16
+ getBadgeCount?: () => Promise<number>;
17
+ setBadgeCount?: (count: number) => void;
18
+ getPermissionStatus: () => Promise<NativePermissionStatus>;
19
+ requestPermissions: (permissions: PushNotificationPermissions) => Promise<boolean>;
20
+ }
21
+ export type NativeAction = {
22
+ deeplink?: string;
23
+ url?: string;
24
+ };
25
+ export type NativeMessage = (ApnsMessage | FcmMessage) & {
26
+ token?: never;
27
+ };
28
+ export type NativePermissionStatus = AndroidPermissionStatus | IosPermissionStatus;
29
+ export interface NormalizedValues {
30
+ body?: string;
31
+ imageUrl?: string;
32
+ title?: string;
33
+ action?: Pick<PushNotificationMessage, 'goToUrl' | 'deeplinkUrl'>;
34
+ options?: Pick<PushNotificationMessage, 'apnsOptions' | 'fcmOptions'>;
35
+ data?: Record<string, unknown>;
36
+ }
37
+ export type ApnsMessage = {
38
+ aps: {
39
+ alert?: {
40
+ body?: string;
41
+ title?: string;
42
+ subtitle?: string;
43
+ };
44
+ };
45
+ data?: {
46
+ pinpoint?: NativeAction;
47
+ 'media-url'?: string;
48
+ };
49
+ rawData?: never;
50
+ completionHandlerId?: string;
51
+ };
52
+ export type IosPermissionStatus = 'NotDetermined' | 'Authorized' | 'Denied';
53
+ export type FcmMessage = {
54
+ action?: NativeAction;
55
+ aps?: never;
56
+ body?: string;
57
+ imageUrl?: string;
58
+ rawData?: Record<string, unknown>;
59
+ title?: string;
60
+ channelId?: string;
61
+ messageId?: string;
62
+ senderId?: string;
63
+ sendTime?: number;
64
+ completionHandlerId?: never;
65
+ };
66
+ export type AndroidPermissionStatus = 'ShouldRequest' | 'ShouldExplainThenRequest' | 'Granted' | 'Denied';
67
+ export type TokenPayload = {
68
+ token: string;
69
+ };
@@ -0,0 +1,4 @@
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 });
@@ -0,0 +1,2 @@
1
+ export { normalizeNativeMessage } from './normalizeNativeMessage';
2
+ export { normalizeNativePermissionStatus } from './normalizeNativePermissionStatus';
@@ -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
+ exports.normalizeNativePermissionStatus = exports.normalizeNativeMessage = void 0;
6
+ var normalizeNativeMessage_1 = require("./normalizeNativeMessage");
7
+ Object.defineProperty(exports, "normalizeNativeMessage", { enumerable: true, get: function () { return normalizeNativeMessage_1.normalizeNativeMessage; } });
8
+ var normalizeNativePermissionStatus_1 = require("./normalizeNativePermissionStatus");
9
+ Object.defineProperty(exports, "normalizeNativePermissionStatus", { enumerable: true, get: function () { return normalizeNativePermissionStatus_1.normalizeNativePermissionStatus; } });
@@ -0,0 +1,5 @@
1
+ import { NativeMessage, PushNotificationMessage } from '../types';
2
+ /**
3
+ * @internal
4
+ */
5
+ export declare const normalizeNativeMessage: (nativeMessage?: NativeMessage) => PushNotificationMessage | null;