@aws-amplify/rtn-push-notification 1.2.1-console-preview.8f82e46.0 → 1.2.1-console-preview.b278dcb.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.
- package/lib/apis/addMessageEventListener.d.ts +3 -0
- package/lib/apis/addMessageEventListener.js +10 -0
- package/lib/apis/addMessageEventListener.js.map +1 -0
- package/lib/apis/addTokenEventListener.d.ts +2 -0
- package/lib/apis/addTokenEventListener.js +9 -0
- package/lib/apis/addTokenEventListener.js.map +1 -0
- package/lib/apis/completeNotification.d.ts +1 -0
- package/lib/apis/completeNotification.js +7 -0
- package/lib/apis/completeNotification.js.map +1 -0
- package/lib/apis/getBadgeCount.d.ts +1 -0
- package/lib/apis/getBadgeCount.js +7 -0
- package/lib/apis/getBadgeCount.js.map +1 -0
- package/lib/apis/getConstants.d.ts +10 -0
- package/lib/apis/getConstants.js +7 -0
- package/lib/apis/getConstants.js.map +1 -0
- package/lib/apis/getLaunchNotification.d.ts +2 -0
- package/lib/apis/getLaunchNotification.js +8 -0
- package/lib/apis/getLaunchNotification.js.map +1 -0
- package/lib/apis/getPermissionStatus.d.ts +2 -0
- package/lib/apis/getPermissionStatus.js +8 -0
- package/lib/apis/getPermissionStatus.js.map +1 -0
- package/lib/apis/index.d.ts +10 -0
- package/lib/apis/index.js +25 -0
- package/lib/apis/index.js.map +1 -0
- package/lib/apis/registerHeadlessTask.d.ts +2 -0
- package/lib/apis/registerHeadlessTask.js +16 -0
- package/lib/apis/registerHeadlessTask.js.map +1 -0
- package/lib/apis/requestPermissions.d.ts +2 -0
- package/lib/apis/requestPermissions.js +11 -0
- package/lib/apis/requestPermissions.js.map +1 -0
- package/lib/apis/setBadgeCount.d.ts +1 -0
- package/lib/apis/setBadgeCount.js +7 -0
- package/lib/apis/setBadgeCount.js.map +1 -0
- package/lib/constants.d.ts +2 -0
- package/lib/constants.js +12 -0
- package/lib/constants.js.map +1 -0
- package/lib/index.d.ts +24 -3
- package/lib/index.js +14 -2
- package/lib/index.js.map +1 -1
- package/lib/nativeModule.d.ts +4 -0
- package/lib/nativeModule.js +15 -0
- package/lib/nativeModule.js.map +1 -0
- package/lib/types/index.d.ts +2 -0
- package/lib/{types.js → types/index.js} +1 -1
- package/lib/types/index.js.map +1 -0
- package/lib/types/module.d.ts +26 -0
- package/lib/types/module.js +5 -0
- package/lib/types/module.js.map +1 -0
- package/lib/types/native.d.ts +69 -0
- package/lib/types/native.js +5 -0
- package/lib/types/native.js.map +1 -0
- package/lib/utils/index.d.ts +2 -0
- package/lib/utils/index.js +9 -0
- package/lib/utils/index.js.map +1 -0
- package/lib/utils/normalizeNativeMessage.d.ts +9 -0
- package/lib/utils/normalizeNativeMessage.js +73 -0
- package/lib/utils/normalizeNativeMessage.js.map +1 -0
- package/lib/utils/normalizeNativePermissionStatus.d.ts +5 -0
- package/lib/utils/normalizeNativePermissionStatus.js +22 -0
- package/lib/utils/normalizeNativePermissionStatus.js.map +1 -0
- package/lib-esm/apis/addMessageEventListener.d.ts +3 -0
- package/lib-esm/apis/addMessageEventListener.js +8 -0
- package/lib-esm/apis/addMessageEventListener.js.map +1 -0
- package/lib-esm/apis/addTokenEventListener.d.ts +2 -0
- package/lib-esm/apis/addTokenEventListener.js +7 -0
- package/lib-esm/apis/addTokenEventListener.js.map +1 -0
- package/lib-esm/apis/completeNotification.d.ts +1 -0
- package/lib-esm/apis/completeNotification.js +5 -0
- package/lib-esm/apis/completeNotification.js.map +1 -0
- package/lib-esm/apis/getBadgeCount.d.ts +1 -0
- package/lib-esm/apis/getBadgeCount.js +5 -0
- package/lib-esm/apis/getBadgeCount.js.map +1 -0
- package/lib-esm/apis/getConstants.d.ts +10 -0
- package/lib-esm/apis/getConstants.js +5 -0
- package/lib-esm/apis/getConstants.js.map +1 -0
- package/lib-esm/apis/getLaunchNotification.d.ts +2 -0
- package/lib-esm/apis/getLaunchNotification.js +6 -0
- package/lib-esm/apis/getLaunchNotification.js.map +1 -0
- package/lib-esm/apis/getPermissionStatus.d.ts +2 -0
- package/lib-esm/apis/getPermissionStatus.js +6 -0
- package/lib-esm/apis/getPermissionStatus.js.map +1 -0
- package/lib-esm/apis/index.d.ts +10 -0
- package/lib-esm/apis/index.js +13 -0
- package/lib-esm/apis/index.js.map +1 -0
- package/lib-esm/apis/registerHeadlessTask.d.ts +2 -0
- package/lib-esm/apis/registerHeadlessTask.js +14 -0
- package/lib-esm/apis/registerHeadlessTask.js.map +1 -0
- package/lib-esm/apis/requestPermissions.d.ts +2 -0
- package/lib-esm/apis/requestPermissions.js +9 -0
- package/lib-esm/apis/requestPermissions.js.map +1 -0
- package/lib-esm/apis/setBadgeCount.d.ts +1 -0
- package/lib-esm/apis/setBadgeCount.js +5 -0
- package/lib-esm/apis/setBadgeCount.js.map +1 -0
- package/lib-esm/constants.d.ts +2 -0
- package/lib-esm/constants.js +10 -0
- package/lib-esm/constants.js.map +1 -0
- package/lib-esm/index.d.ts +24 -3
- package/lib-esm/index.js +14 -2
- package/lib-esm/index.js.map +1 -1
- package/lib-esm/nativeModule.d.ts +4 -0
- package/lib-esm/nativeModule.js +13 -0
- package/lib-esm/nativeModule.js.map +1 -0
- package/lib-esm/types/index.d.ts +2 -0
- package/lib-esm/{types.js → types/index.js} +1 -1
- package/lib-esm/types/index.js.map +1 -0
- package/lib-esm/types/module.d.ts +26 -0
- package/lib-esm/types/module.js +3 -0
- package/lib-esm/types/module.js.map +1 -0
- package/lib-esm/types/native.d.ts +69 -0
- package/lib-esm/types/native.js +3 -0
- package/lib-esm/types/native.js.map +1 -0
- package/lib-esm/utils/index.d.ts +2 -0
- package/lib-esm/utils/index.js +5 -0
- package/lib-esm/utils/index.js.map +1 -0
- package/lib-esm/utils/normalizeNativeMessage.d.ts +9 -0
- package/lib-esm/utils/normalizeNativeMessage.js +71 -0
- package/lib-esm/utils/normalizeNativeMessage.js.map +1 -0
- package/lib-esm/utils/normalizeNativePermissionStatus.d.ts +5 -0
- package/lib-esm/utils/normalizeNativePermissionStatus.js +20 -0
- package/lib-esm/utils/normalizeNativePermissionStatus.js.map +1 -0
- package/package.json +10 -7
- package/src/apis/addMessageEventListener.ts +21 -0
- package/src/apis/addTokenEventListener.ts +14 -0
- package/src/apis/completeNotification.ts +7 -0
- package/src/apis/getBadgeCount.ts +7 -0
- package/src/apis/getConstants.ts +6 -0
- package/src/apis/getLaunchNotification.ts +12 -0
- package/src/apis/getPermissionStatus.ts +10 -0
- package/src/apis/index.ts +13 -0
- package/src/apis/registerHeadlessTask.ts +21 -0
- package/src/apis/requestPermissions.ts +13 -0
- package/src/apis/setBadgeCount.ts +7 -0
- package/src/constants.ts +11 -0
- package/src/index.ts +33 -7
- package/src/nativeModule.ts +20 -0
- package/src/types/index.ts +5 -0
- package/src/types/module.ts +37 -0
- package/src/types/native.ts +92 -0
- package/src/utils/index.ts +5 -0
- package/src/utils/normalizeNativeMessage.ts +103 -0
- package/src/utils/normalizeNativePermissionStatus.ts +27 -0
- package/lib/.tsbuildinfo +0 -3
- package/lib/types.d.ts +0 -18
- package/lib/types.js.map +0 -1
- package/lib-esm/.tsbuildinfo +0 -3
- package/lib-esm/types.d.ts +0 -18
- package/lib-esm/types.js.map +0 -1
- package/src/types.ts +0 -23
|
@@ -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 | undefined) => 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
|
+
const nativeModule_1 = require("../nativeModule");
|
|
6
|
+
const utils_1 = require("../utils");
|
|
7
|
+
exports.addMessageEventListener = (event, listener) => nativeModule_1.nativeEventEmitter.addListener(event, (nativeMessage) => {
|
|
8
|
+
listener(utils_1.normalizeNativeMessage(nativeMessage), nativeMessage.completionHandlerId);
|
|
9
|
+
});
|
|
10
|
+
//# sourceMappingURL=addMessageEventListener.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"addMessageEventListener.js","sourceRoot":"","sources":["../../src/apis/addMessageEventListener.ts"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;;AAGtC,kDAAqD;AAErD,oCAAkD;AAErC,QAAA,uBAAuB,GAAG,CACtC,KAAa,EACb,QAGS,EACa,EAAE,CACxB,iCAAkB,CAAC,WAAW,CAAC,KAAK,EAAE,CAAC,aAA4B,EAAE,EAAE;IACtE,QAAQ,CACP,8BAAsB,CAAC,aAAa,CAAC,EACrC,aAAa,CAAC,mBAAmB,CACjC,CAAC;AACH,CAAC,CAAC,CAAC"}
|
|
@@ -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
|
+
const nativeModule_1 = require("../nativeModule");
|
|
6
|
+
exports.addTokenEventListener = (event, listener) => nativeModule_1.nativeEventEmitter.addListener(event, ({ token }) => {
|
|
7
|
+
listener(token);
|
|
8
|
+
});
|
|
9
|
+
//# sourceMappingURL=addTokenEventListener.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"addTokenEventListener.js","sourceRoot":"","sources":["../../src/apis/addTokenEventListener.ts"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;;AAGtC,kDAAqD;AAGxC,QAAA,qBAAqB,GAAG,CACpC,KAAa,EACb,QAAiC,EACX,EAAE,CACxB,iCAAkB,CAAC,WAAW,CAAC,KAAK,EAAE,CAAC,EAAE,KAAK,EAAgB,EAAE,EAAE;IACjE,QAAQ,CAAC,KAAK,CAAC,CAAC;AACjB,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const completeNotification: (completionHandlerId: string) => void;
|
|
@@ -0,0 +1,7 @@
|
|
|
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
|
+
const nativeModule_1 = require("../nativeModule");
|
|
6
|
+
exports.completeNotification = (completionHandlerId) => nativeModule_1.nativeModule.completeNotification?.(completionHandlerId);
|
|
7
|
+
//# sourceMappingURL=completeNotification.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"completeNotification.js","sourceRoot":"","sources":["../../src/apis/completeNotification.ts"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;;AAEtC,kDAA+C;AAElC,QAAA,oBAAoB,GAAG,CAAC,mBAA2B,EAAQ,EAAE,CACzE,2BAAY,CAAC,oBAAoB,EAAE,CAAC,mBAAmB,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const getBadgeCount: () => void | Promise<number | null>;
|
|
@@ -0,0 +1,7 @@
|
|
|
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
|
+
const nativeModule_1 = require("../nativeModule");
|
|
6
|
+
exports.getBadgeCount = () => nativeModule_1.nativeModule.getBadgeCount?.();
|
|
7
|
+
//# sourceMappingURL=getBadgeCount.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getBadgeCount.js","sourceRoot":"","sources":["../../src/apis/getBadgeCount.ts"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;;AAEtC,kDAA+C;AAElC,QAAA,aAAa,GAAG,GAAkC,EAAE,CAChE,2BAAY,CAAC,aAAa,EAAE,EAAE,CAAC"}
|
|
@@ -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,7 @@
|
|
|
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
|
+
const nativeModule_1 = require("../nativeModule");
|
|
6
|
+
exports.getConstants = () => nativeModule_1.nativeModule.getConstants();
|
|
7
|
+
//# sourceMappingURL=getConstants.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getConstants.js","sourceRoot":"","sources":["../../src/apis/getConstants.ts"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;;AAEtC,kDAA+C;AAElC,QAAA,YAAY,GAAG,GAAG,EAAE,CAAC,2BAAY,CAAC,YAAY,EAAE,CAAC"}
|
|
@@ -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
|
+
const nativeModule_1 = require("../nativeModule");
|
|
6
|
+
const utils_1 = require("../utils");
|
|
7
|
+
exports.getLaunchNotification = async () => utils_1.normalizeNativeMessage((await nativeModule_1.nativeModule.getLaunchNotification()) ?? undefined);
|
|
8
|
+
//# sourceMappingURL=getLaunchNotification.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getLaunchNotification.js","sourceRoot":"","sources":["../../src/apis/getLaunchNotification.ts"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;;AAEtC,kDAA+C;AAE/C,oCAAkD;AAErC,QAAA,qBAAqB,GACjC,KAAK,IAA6C,EAAE,CACnD,8BAAsB,CACrB,CAAC,MAAM,2BAAY,CAAC,qBAAqB,EAAE,CAAC,IAAI,SAAS,CACzD,CAAC"}
|
|
@@ -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
|
+
const nativeModule_1 = require("../nativeModule");
|
|
6
|
+
const utils_1 = require("../utils");
|
|
7
|
+
exports.getPermissionStatus = async () => utils_1.normalizeNativePermissionStatus(await nativeModule_1.nativeModule.getPermissionStatus());
|
|
8
|
+
//# sourceMappingURL=getPermissionStatus.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getPermissionStatus.js","sourceRoot":"","sources":["../../src/apis/getPermissionStatus.ts"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;;AAEtC,kDAA+C;AAE/C,oCAA2D;AAE9C,QAAA,mBAAmB,GAC/B,KAAK,IAA+C,EAAE,CACrD,uCAA+B,CAAC,MAAM,2BAAY,CAAC,mBAAmB,EAAE,CAAC,CAAC"}
|
|
@@ -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
|
+
var addMessageEventListener_1 = require("./addMessageEventListener");
|
|
6
|
+
exports.addMessageEventListener = addMessageEventListener_1.addMessageEventListener;
|
|
7
|
+
var addTokenEventListener_1 = require("./addTokenEventListener");
|
|
8
|
+
exports.addTokenEventListener = addTokenEventListener_1.addTokenEventListener;
|
|
9
|
+
var completeNotification_1 = require("./completeNotification");
|
|
10
|
+
exports.completeNotification = completeNotification_1.completeNotification;
|
|
11
|
+
var getBadgeCount_1 = require("./getBadgeCount");
|
|
12
|
+
exports.getBadgeCount = getBadgeCount_1.getBadgeCount;
|
|
13
|
+
var getConstants_1 = require("./getConstants");
|
|
14
|
+
exports.getConstants = getConstants_1.getConstants;
|
|
15
|
+
var getLaunchNotification_1 = require("./getLaunchNotification");
|
|
16
|
+
exports.getLaunchNotification = getLaunchNotification_1.getLaunchNotification;
|
|
17
|
+
var getPermissionStatus_1 = require("./getPermissionStatus");
|
|
18
|
+
exports.getPermissionStatus = getPermissionStatus_1.getPermissionStatus;
|
|
19
|
+
var registerHeadlessTask_1 = require("./registerHeadlessTask");
|
|
20
|
+
exports.registerHeadlessTask = registerHeadlessTask_1.registerHeadlessTask;
|
|
21
|
+
var requestPermissions_1 = require("./requestPermissions");
|
|
22
|
+
exports.requestPermissions = requestPermissions_1.requestPermissions;
|
|
23
|
+
var setBadgeCount_1 = require("./setBadgeCount");
|
|
24
|
+
exports.setBadgeCount = setBadgeCount_1.setBadgeCount;
|
|
25
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/apis/index.ts"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;;AAEtC,qEAAoE;AAA3D,4DAAA,uBAAuB,CAAA;AAChC,iEAAgE;AAAvD,wDAAA,qBAAqB,CAAA;AAC9B,+DAA8D;AAArD,sDAAA,oBAAoB,CAAA;AAC7B,iDAAgD;AAAvC,wCAAA,aAAa,CAAA;AACtB,+CAA8C;AAArC,sCAAA,YAAY,CAAA;AACrB,iEAAgE;AAAvD,wDAAA,qBAAqB,CAAA;AAC9B,6DAA4D;AAAnD,oDAAA,mBAAmB,CAAA;AAC5B,+DAA8D;AAArD,sDAAA,oBAAoB,CAAA;AAC7B,2DAA0D;AAAjD,kDAAA,kBAAkB,CAAA;AAC3B,iDAAgD;AAAvC,wCAAA,aAAa,CAAA"}
|
|
@@ -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
|
+
const react_native_1 = require("react-native");
|
|
6
|
+
const getConstants_1 = require("./getConstants");
|
|
7
|
+
const utils_1 = require("../utils");
|
|
8
|
+
exports.registerHeadlessTask = (task) => {
|
|
9
|
+
const { NativeHeadlessTaskKey } = getConstants_1.getConstants();
|
|
10
|
+
if (NativeHeadlessTaskKey) {
|
|
11
|
+
react_native_1.AppRegistry.registerHeadlessTask(NativeHeadlessTaskKey, () => async (nativeMessage) => {
|
|
12
|
+
await task(utils_1.normalizeNativeMessage(nativeMessage));
|
|
13
|
+
});
|
|
14
|
+
}
|
|
15
|
+
};
|
|
16
|
+
//# sourceMappingURL=registerHeadlessTask.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"registerHeadlessTask.js","sourceRoot":"","sources":["../../src/apis/registerHeadlessTask.ts"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;;AAEtC,+CAA2C;AAC3C,iDAA8C;AAE9C,oCAAkD;AAErC,QAAA,oBAAoB,GAAG,CACnC,IAAgE,EACzD,EAAE;IACT,MAAM,EAAE,qBAAqB,EAAE,GAAG,2BAAY,EAAE,CAAC;IACjD,IAAI,qBAAqB,EAAE;QAC1B,0BAAW,CAAC,oBAAoB,CAC/B,qBAAqB,EACrB,GAAG,EAAE,CAAC,KAAK,EAAE,aAA4B,EAAE,EAAE;YAC5C,MAAM,IAAI,CAAC,8BAAsB,CAAC,aAAa,CAAC,CAAC,CAAC;QACnD,CAAC,CACD,CAAC;KACF;AACF,CAAC,CAAC"}
|
|
@@ -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
|
+
const nativeModule_1 = require("../nativeModule");
|
|
6
|
+
exports.requestPermissions = async (permissions = {
|
|
7
|
+
alert: true,
|
|
8
|
+
badge: true,
|
|
9
|
+
sound: true,
|
|
10
|
+
}) => nativeModule_1.nativeModule.requestPermissions(permissions);
|
|
11
|
+
//# sourceMappingURL=requestPermissions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"requestPermissions.js","sourceRoot":"","sources":["../../src/apis/requestPermissions.ts"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;;AAEtC,kDAA+C;AAGlC,QAAA,kBAAkB,GAAG,KAAK,EACtC,cAA2C;IAC1C,KAAK,EAAE,IAAI;IACX,KAAK,EAAE,IAAI;IACX,KAAK,EAAE,IAAI;CACX,EACkB,EAAE,CAAC,2BAAY,CAAC,kBAAkB,CAAC,WAAW,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const setBadgeCount: (count: number) => void;
|
|
@@ -0,0 +1,7 @@
|
|
|
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
|
+
const nativeModule_1 = require("../nativeModule");
|
|
6
|
+
exports.setBadgeCount = (count) => nativeModule_1.nativeModule.setBadgeCount?.(count);
|
|
7
|
+
//# sourceMappingURL=setBadgeCount.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"setBadgeCount.js","sourceRoot":"","sources":["../../src/apis/setBadgeCount.ts"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;;AAEtC,kDAA+C;AAElC,QAAA,aAAa,GAAG,CAAC,KAAa,EAAQ,EAAE,CACpD,2BAAY,CAAC,aAAa,EAAE,CAAC,KAAK,CAAC,CAAC"}
|
package/lib/constants.js
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
4
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
const react_native_1 = require("react-native");
|
|
6
|
+
// General
|
|
7
|
+
exports.PACKAGE_NAME = '@aws-amplify/rtn-push-notification';
|
|
8
|
+
exports.LINKING_ERROR = `The ${exports.PACKAGE_NAME} package doesn't seem to be linked. Make sure: \n\n` +
|
|
9
|
+
react_native_1.Platform.select({ ios: "- You have run 'pod install'\n", default: '' }) +
|
|
10
|
+
'- You rebuilt the app after installing the package\n' +
|
|
11
|
+
'- You are not using Expo Go\n';
|
|
12
|
+
//# sourceMappingURL=constants.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":";;AAAA,qEAAqE;AACrE,sCAAsC;AACtC,+CAAwC;AAExC,UAAU;AACG,QAAA,YAAY,GAAG,oCAAoC,CAAC;AACpD,QAAA,aAAa,GACzB,OAAO,oBAAY,qDAAqD;IACxE,uBAAQ,CAAC,MAAM,CAAC,EAAE,GAAG,EAAE,gCAAgC,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC;IACvE,sDAAsD;IACtD,+BAA+B,CAAC"}
|
package/lib/index.d.ts
CHANGED
|
@@ -1,3 +1,24 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
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: (permissions?: import("./types").PushNotificationPermissions) => Promise<boolean>;
|
|
21
|
+
setBadgeCount: (count: number) => void;
|
|
22
|
+
};
|
|
23
|
+
export declare 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
|
-
|
|
6
|
-
|
|
5
|
+
const apis_1 = require("./apis");
|
|
6
|
+
const module = {
|
|
7
|
+
addMessageEventListener: apis_1.addMessageEventListener,
|
|
8
|
+
addTokenEventListener: apis_1.addTokenEventListener,
|
|
9
|
+
completeNotification: apis_1.completeNotification,
|
|
10
|
+
getBadgeCount: apis_1.getBadgeCount,
|
|
11
|
+
getConstants: apis_1.getConstants,
|
|
12
|
+
getLaunchNotification: apis_1.getLaunchNotification,
|
|
13
|
+
getPermissionStatus: apis_1.getPermissionStatus,
|
|
14
|
+
registerHeadlessTask: apis_1.registerHeadlessTask,
|
|
15
|
+
requestPermissions: apis_1.requestPermissions,
|
|
16
|
+
setBadgeCount: apis_1.setBadgeCount,
|
|
17
|
+
};
|
|
18
|
+
exports.module = module;
|
|
7
19
|
//# sourceMappingURL=index.js.map
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;;AAEtC,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;;AAEtC,iCAWgB;AAOhB,MAAM,MAAM,GAAG;IACd,uBAAuB,EAAvB,8BAAuB;IACvB,qBAAqB,EAArB,4BAAqB;IACrB,oBAAoB,EAApB,2BAAoB;IACpB,aAAa,EAAb,oBAAa;IACb,YAAY,EAAZ,mBAAY;IACZ,qBAAqB,EAArB,4BAAqB;IACrB,mBAAmB,EAAnB,0BAAmB;IACnB,oBAAoB,EAApB,2BAAoB;IACpB,kBAAkB,EAAlB,yBAAkB;IAClB,aAAa,EAAb,oBAAa;CACb,CAAC;AAGO,wBAAM"}
|
|
@@ -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
|
+
const react_native_1 = require("react-native");
|
|
6
|
+
const constants_1 = require("./constants");
|
|
7
|
+
exports.nativeModule = react_native_1.NativeModules.AmplifyRTNPushNotification
|
|
8
|
+
? react_native_1.NativeModules.AmplifyRTNPushNotification
|
|
9
|
+
: new Proxy({}, {
|
|
10
|
+
get() {
|
|
11
|
+
throw new Error(constants_1.LINKING_ERROR);
|
|
12
|
+
},
|
|
13
|
+
});
|
|
14
|
+
exports.nativeEventEmitter = new react_native_1.NativeEventEmitter(exports.nativeModule);
|
|
15
|
+
//# sourceMappingURL=nativeModule.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nativeModule.js","sourceRoot":"","sources":["../src/nativeModule.ts"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;;AAEtC,+CAAiE;AACjE,2CAA4C;AAG/B,QAAA,YAAY,GACxB,4BAAa,CAAC,0BAA0B;IACvC,CAAC,CAAC,4BAAa,CAAC,0BAA0B;IAC1C,CAAC,CAAC,IAAI,KAAK,CACT,EAAE,EACF;QACC,GAAG;YACF,MAAM,IAAI,KAAK,CAAC,yBAAa,CAAC,CAAC;QAChC,CAAC;KACD,CACA,CAAC;AAEO,QAAA,kBAAkB,GAAG,IAAI,iCAAkB,CAAC,oBAAY,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export interface PushNotificationPermissions extends Partial<Record<string, boolean>> {
|
|
2
|
+
alert?: boolean;
|
|
3
|
+
badge?: boolean;
|
|
4
|
+
sound?: boolean;
|
|
5
|
+
}
|
|
6
|
+
export interface PushNotificationMessage {
|
|
7
|
+
title?: string;
|
|
8
|
+
body?: string;
|
|
9
|
+
imageUrl?: string;
|
|
10
|
+
deeplinkUrl?: string;
|
|
11
|
+
goToUrl?: string;
|
|
12
|
+
fcmOptions?: FcmPlatformOptions;
|
|
13
|
+
apnsOptions?: ApnsPlatformOptions;
|
|
14
|
+
data?: Record<string, unknown>;
|
|
15
|
+
}
|
|
16
|
+
export declare type PushNotificationPermissionStatus = 'denied' | 'granted' | 'shouldRequest' | 'shouldExplainThenRequest';
|
|
17
|
+
interface ApnsPlatformOptions {
|
|
18
|
+
subtitle?: string;
|
|
19
|
+
}
|
|
20
|
+
interface FcmPlatformOptions {
|
|
21
|
+
channelId: string;
|
|
22
|
+
messageId: string;
|
|
23
|
+
senderId: string;
|
|
24
|
+
sendTime: Date;
|
|
25
|
+
}
|
|
26
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"module.js","sourceRoot":"","sources":["../../src/types/module.ts"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC"}
|
|
@@ -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 declare type NativeAction = {
|
|
22
|
+
deeplink?: string;
|
|
23
|
+
url?: string;
|
|
24
|
+
};
|
|
25
|
+
export declare type NativeMessage = (ApnsMessage | FcmMessage) & {
|
|
26
|
+
token?: never;
|
|
27
|
+
};
|
|
28
|
+
export declare 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 declare 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 declare type IosPermissionStatus = 'NotDetermined' | 'Authorized' | 'Denied';
|
|
53
|
+
export declare 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?: string;
|
|
64
|
+
completionHandlerId?: never;
|
|
65
|
+
};
|
|
66
|
+
export declare type AndroidPermissionStatus = 'ShouldRequest' | 'ShouldExplainThenRequest' | 'Granted' | 'Denied';
|
|
67
|
+
export declare type TokenPayload = {
|
|
68
|
+
token: string;
|
|
69
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"native.js","sourceRoot":"","sources":["../../src/types/native.ts"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC"}
|
|
@@ -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 normalizeNativeMessage_1 = require("./normalizeNativeMessage");
|
|
6
|
+
exports.normalizeNativeMessage = normalizeNativeMessage_1.normalizeNativeMessage;
|
|
7
|
+
var normalizeNativePermissionStatus_1 = require("./normalizeNativePermissionStatus");
|
|
8
|
+
exports.normalizeNativePermissionStatus = normalizeNativePermissionStatus_1.normalizeNativePermissionStatus;
|
|
9
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;;AAEtC,mEAAkE;AAAzD,0DAAA,sBAAsB,CAAA;AAC/B,qFAAoF;AAA3E,4EAAA,+BAA+B,CAAA"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ApnsMessage, FcmMessage, PushNotificationMessage } from '../types';
|
|
2
|
+
/**
|
|
3
|
+
* @internal
|
|
4
|
+
*/
|
|
5
|
+
export declare const normalizeNativeMessage: (nativeMessage?: (ApnsMessage & {
|
|
6
|
+
token?: undefined;
|
|
7
|
+
}) | (FcmMessage & {
|
|
8
|
+
token?: undefined;
|
|
9
|
+
}) | undefined) => PushNotificationMessage | null;
|
|
@@ -0,0 +1,73 @@
|
|
|
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
|
+
const lodash_1 = require("lodash");
|
|
6
|
+
/**
|
|
7
|
+
* @internal
|
|
8
|
+
*/
|
|
9
|
+
exports.normalizeNativeMessage = (nativeMessage) => {
|
|
10
|
+
let normalized;
|
|
11
|
+
if (isApnsMessage(nativeMessage)) {
|
|
12
|
+
normalized = normalizeApnsMessage(nativeMessage);
|
|
13
|
+
}
|
|
14
|
+
else if (isFcmMessage(nativeMessage)) {
|
|
15
|
+
normalized = normalizeFcmMessage(nativeMessage);
|
|
16
|
+
}
|
|
17
|
+
else {
|
|
18
|
+
return null;
|
|
19
|
+
}
|
|
20
|
+
const { body, imageUrl, title, action, options, data } = normalized;
|
|
21
|
+
return {
|
|
22
|
+
body,
|
|
23
|
+
data,
|
|
24
|
+
imageUrl,
|
|
25
|
+
title,
|
|
26
|
+
...action,
|
|
27
|
+
...options,
|
|
28
|
+
};
|
|
29
|
+
};
|
|
30
|
+
const normalizeApnsMessage = (apnsMessage) => {
|
|
31
|
+
const { aps, data } = apnsMessage;
|
|
32
|
+
const { body, title } = aps.alert ?? {};
|
|
33
|
+
const action = getApnsAction(data?.pinpoint) ?? {};
|
|
34
|
+
const imageUrl = data?.['media-url'];
|
|
35
|
+
const options = getApnsOptions(apnsMessage);
|
|
36
|
+
return { body, imageUrl, title, action, options, data };
|
|
37
|
+
};
|
|
38
|
+
const normalizeFcmMessage = (fcmMessage) => {
|
|
39
|
+
const { body, imageUrl, rawData: data, title } = fcmMessage;
|
|
40
|
+
const action = getFcmAction(fcmMessage.action) ?? {};
|
|
41
|
+
const options = getFcmOptions(fcmMessage);
|
|
42
|
+
return { body, imageUrl, title, action, options, data };
|
|
43
|
+
};
|
|
44
|
+
const getApnsAction = (action) => {
|
|
45
|
+
if (action?.deeplink) {
|
|
46
|
+
return { deeplinkUrl: action.deeplink };
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
const getFcmAction = (action) => {
|
|
50
|
+
if (action?.url) {
|
|
51
|
+
return { goToUrl: action.url };
|
|
52
|
+
}
|
|
53
|
+
if (action?.deeplink) {
|
|
54
|
+
return { deeplinkUrl: action.deeplink };
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
const getApnsOptions = ({ aps, }) => {
|
|
58
|
+
const { subtitle } = aps.alert ?? {};
|
|
59
|
+
const apnsOptions = { ...(subtitle && { subtitle }) };
|
|
60
|
+
return { ...(!lodash_1.isEmpty(apnsOptions) && { apnsOptions }) };
|
|
61
|
+
};
|
|
62
|
+
const getFcmOptions = ({ channelId = '', messageId = '', senderId = '', sendTime = '', }) => {
|
|
63
|
+
const fcmOptions = {
|
|
64
|
+
channelId,
|
|
65
|
+
messageId,
|
|
66
|
+
senderId,
|
|
67
|
+
sendTime: new Date(sendTime),
|
|
68
|
+
};
|
|
69
|
+
return { ...(!lodash_1.isEmpty(fcmOptions) && { fcmOptions }) };
|
|
70
|
+
};
|
|
71
|
+
const isApnsMessage = (nativeMessage) => !!nativeMessage?.aps;
|
|
72
|
+
const isFcmMessage = (nativeMessage) => !!nativeMessage?.rawData;
|
|
73
|
+
//# sourceMappingURL=normalizeNativeMessage.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"normalizeNativeMessage.js","sourceRoot":"","sources":["../../src/utils/normalizeNativeMessage.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,22 @@
|
|
|
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
|
+
/**
|
|
6
|
+
* @internal
|
|
7
|
+
*/
|
|
8
|
+
exports.normalizeNativePermissionStatus = (nativeStatus) => {
|
|
9
|
+
switch (nativeStatus) {
|
|
10
|
+
case 'ShouldRequest':
|
|
11
|
+
return 'shouldRequest';
|
|
12
|
+
case 'NotDetermined':
|
|
13
|
+
case 'ShouldExplainThenRequest':
|
|
14
|
+
return 'shouldExplainThenRequest';
|
|
15
|
+
case 'Authorized':
|
|
16
|
+
case 'Granted':
|
|
17
|
+
return 'granted';
|
|
18
|
+
case 'Denied':
|
|
19
|
+
return 'denied';
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
//# sourceMappingURL=normalizeNativePermissionStatus.js.map
|