@aws-amplify/notifications 2.0.1-console-preview.8d88eef.0 → 2.0.1-console-preview.be08038.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/inAppMessaging/providers/pinpoint/apis/identifyUser.d.ts +4 -4
- package/lib/inAppMessaging/providers/pinpoint/apis/identifyUser.js +4 -4
- package/lib/inAppMessaging/providers/pinpoint/apis/initializeInAppMessaging.js +8 -10
- package/lib/inAppMessaging/providers/pinpoint/utils/messageProcessingHelpers.d.ts +1 -1
- package/lib/pushNotifications/errors/errorHelpers.d.ts +1 -0
- package/lib/pushNotifications/errors/errorHelpers.js +4 -0
- package/lib/pushNotifications/providers/pinpoint/apis/getBadgeCount.native.js +7 -3
- package/lib/pushNotifications/providers/pinpoint/apis/getLaunchNotification.native.js +2 -0
- package/lib/pushNotifications/providers/pinpoint/apis/getPermissionStatus.native.js +2 -0
- package/lib/pushNotifications/providers/pinpoint/apis/identifyUser.native.js +8 -4
- package/lib/pushNotifications/providers/pinpoint/apis/initializePushNotifications.native.js +8 -7
- package/lib/pushNotifications/providers/pinpoint/apis/onNotificationOpened.native.js +2 -0
- package/lib/pushNotifications/providers/pinpoint/apis/onNotificationReceivedInBackground.native.js +5 -1
- package/lib/pushNotifications/providers/pinpoint/apis/onNotificationReceivedInForeground.native.js +5 -1
- package/lib/pushNotifications/providers/pinpoint/apis/onTokenReceived.native.js +2 -0
- package/lib/pushNotifications/providers/pinpoint/apis/requestPermissions.native.js +2 -0
- package/lib/pushNotifications/providers/pinpoint/apis/setBadgeCount.native.js +5 -1
- package/lib/pushNotifications/providers/pinpoint/utils/createMessageEventRecorder.js +3 -4
- package/lib/pushNotifications/providers/pinpoint/utils/index.d.ts +0 -4
- package/lib/pushNotifications/providers/pinpoint/utils/index.js +0 -10
- package/lib/pushNotifications/utils/index.d.ts +4 -0
- package/lib/pushNotifications/utils/index.js +14 -0
- package/lib/pushNotifications/{providers/pinpoint/utils → utils}/resolveConfig.js +1 -1
- package/lib/pushNotifications/{providers/pinpoint/utils → utils}/resolveCredentials.js +1 -1
- package/lib/tsconfig.build.tsbuildinfo +330 -425
- package/lib-esm/inAppMessaging/providers/pinpoint/apis/identifyUser.d.ts +4 -4
- package/lib-esm/inAppMessaging/providers/pinpoint/apis/identifyUser.js +4 -4
- package/lib-esm/inAppMessaging/providers/pinpoint/apis/initializeInAppMessaging.js +3 -4
- package/lib-esm/inAppMessaging/providers/pinpoint/utils/helpers.js +1 -1
- package/lib-esm/inAppMessaging/providers/pinpoint/utils/messageProcessingHelpers.d.ts +1 -1
- package/lib-esm/pushNotifications/errors/errorHelpers.d.ts +1 -0
- package/lib-esm/pushNotifications/errors/errorHelpers.js +4 -0
- package/lib-esm/pushNotifications/providers/pinpoint/apis/getBadgeCount.native.js +7 -3
- package/lib-esm/pushNotifications/providers/pinpoint/apis/getLaunchNotification.native.js +2 -0
- package/lib-esm/pushNotifications/providers/pinpoint/apis/getPermissionStatus.native.js +2 -0
- package/lib-esm/pushNotifications/providers/pinpoint/apis/identifyUser.native.js +6 -2
- package/lib-esm/pushNotifications/providers/pinpoint/apis/initializePushNotifications.native.js +2 -1
- package/lib-esm/pushNotifications/providers/pinpoint/apis/onNotificationOpened.native.js +2 -0
- package/lib-esm/pushNotifications/providers/pinpoint/apis/onNotificationReceivedInBackground.native.js +5 -1
- package/lib-esm/pushNotifications/providers/pinpoint/apis/onNotificationReceivedInForeground.native.js +5 -1
- package/lib-esm/pushNotifications/providers/pinpoint/apis/onTokenReceived.native.js +2 -0
- package/lib-esm/pushNotifications/providers/pinpoint/apis/requestPermissions.native.js +2 -0
- package/lib-esm/pushNotifications/providers/pinpoint/apis/setBadgeCount.native.js +5 -1
- package/lib-esm/pushNotifications/providers/pinpoint/utils/createMessageEventRecorder.js +1 -2
- package/lib-esm/pushNotifications/providers/pinpoint/utils/index.d.ts +0 -4
- package/lib-esm/pushNotifications/providers/pinpoint/utils/index.js +0 -4
- package/lib-esm/pushNotifications/utils/index.d.ts +4 -0
- package/lib-esm/pushNotifications/utils/index.js +6 -0
- package/lib-esm/pushNotifications/{providers/pinpoint/utils → utils}/resolveConfig.js +1 -1
- package/lib-esm/pushNotifications/{providers/pinpoint/utils → utils}/resolveCredentials.js +1 -1
- package/lib-esm/tsconfig.build.tsbuildinfo +228 -233
- package/package.json +4 -4
- package/src/inAppMessaging/providers/pinpoint/apis/identifyUser.ts +4 -4
- package/src/inAppMessaging/providers/pinpoint/apis/initializeInAppMessaging.ts +3 -4
- package/src/inAppMessaging/providers/pinpoint/utils/helpers.ts +1 -3
- package/src/inAppMessaging/providers/pinpoint/utils/messageProcessingHelpers.ts +1 -1
- package/src/pushNotifications/errors/errorHelpers.ts +5 -0
- package/src/pushNotifications/providers/pinpoint/apis/getBadgeCount.native.ts +5 -1
- package/src/pushNotifications/providers/pinpoint/apis/getLaunchNotification.native.ts +5 -2
- package/src/pushNotifications/providers/pinpoint/apis/getPermissionStatus.native.ts +5 -2
- package/src/pushNotifications/providers/pinpoint/apis/identifyUser.native.ts +4 -6
- package/src/pushNotifications/providers/pinpoint/apis/initializePushNotifications.native.ts +5 -3
- package/src/pushNotifications/providers/pinpoint/apis/onNotificationOpened.native.ts +5 -2
- package/src/pushNotifications/providers/pinpoint/apis/onNotificationReceivedInBackground.native.ts +5 -1
- package/src/pushNotifications/providers/pinpoint/apis/onNotificationReceivedInForeground.native.ts +5 -1
- package/src/pushNotifications/providers/pinpoint/apis/onTokenReceived.native.ts +5 -2
- package/src/pushNotifications/providers/pinpoint/apis/requestPermissions.native.ts +5 -2
- package/src/pushNotifications/providers/pinpoint/apis/setBadgeCount.native.ts +5 -1
- package/src/pushNotifications/providers/pinpoint/utils/createMessageEventRecorder.ts +1 -2
- package/src/pushNotifications/providers/pinpoint/utils/index.ts +0 -4
- package/src/pushNotifications/utils/index.ts +7 -0
- package/src/pushNotifications/{providers/pinpoint/utils → utils}/resolveConfig.ts +1 -1
- package/src/pushNotifications/{providers/pinpoint/utils → utils}/resolveCredentials.ts +1 -1
- package/lib/inAppMessaging/sessionTracker/SessionTracker.d.ts +0 -9
- package/lib/inAppMessaging/sessionTracker/SessionTracker.js +0 -67
- package/lib/inAppMessaging/sessionTracker/SessionTracker.native.d.ts +0 -10
- package/lib/inAppMessaging/sessionTracker/SessionTracker.native.js +0 -52
- package/lib/inAppMessaging/sessionTracker/index.d.ts +0 -3
- package/lib/inAppMessaging/sessionTracker/index.js +0 -7
- package/lib/inAppMessaging/sessionTracker/types.d.ts +0 -6
- package/lib/inAppMessaging/sessionTracker/types.js +0 -4
- package/lib/pushNotifications/Platform/index.d.ts +0 -2
- package/lib/pushNotifications/Platform/index.js +0 -25
- package/lib/pushNotifications/Platform/index.native.d.ts +0 -2
- package/lib/pushNotifications/Platform/index.native.js +0 -7
- package/lib/pushNotifications/Platform/types.d.ts +0 -5
- package/lib/pushNotifications/Platform/types.js +0 -4
- package/lib-esm/inAppMessaging/sessionTracker/SessionTracker.d.ts +0 -9
- package/lib-esm/inAppMessaging/sessionTracker/SessionTracker.js +0 -64
- package/lib-esm/inAppMessaging/sessionTracker/SessionTracker.native.d.ts +0 -10
- package/lib-esm/inAppMessaging/sessionTracker/SessionTracker.native.js +0 -49
- package/lib-esm/inAppMessaging/sessionTracker/index.d.ts +0 -3
- package/lib-esm/inAppMessaging/sessionTracker/index.js +0 -4
- package/lib-esm/inAppMessaging/sessionTracker/types.d.ts +0 -6
- package/lib-esm/inAppMessaging/sessionTracker/types.js +0 -2
- package/lib-esm/pushNotifications/Platform/index.d.ts +0 -2
- package/lib-esm/pushNotifications/Platform/index.js +0 -23
- package/lib-esm/pushNotifications/Platform/index.native.d.ts +0 -2
- package/lib-esm/pushNotifications/Platform/index.native.js +0 -5
- package/lib-esm/pushNotifications/Platform/types.d.ts +0 -5
- package/lib-esm/pushNotifications/Platform/types.js +0 -2
- package/src/inAppMessaging/sessionTracker/SessionTracker.native.ts +0 -60
- package/src/inAppMessaging/sessionTracker/SessionTracker.ts +0 -78
- package/src/inAppMessaging/sessionTracker/index.ts +0 -6
- package/src/inAppMessaging/sessionTracker/types.ts +0 -11
- package/src/pushNotifications/Platform/index.native.ts +0 -9
- package/src/pushNotifications/Platform/index.ts +0 -22
- package/src/pushNotifications/Platform/types.ts +0 -15
- /package/lib/pushNotifications/{providers/pinpoint/utils → utils}/initializationManager.d.ts +0 -0
- /package/lib/pushNotifications/{providers/pinpoint/utils → utils}/initializationManager.js +0 -0
- /package/lib/pushNotifications/{providers/pinpoint/utils → utils}/resolveConfig.d.ts +0 -0
- /package/lib/pushNotifications/{providers/pinpoint/utils → utils}/resolveCredentials.d.ts +0 -0
- /package/lib/pushNotifications/{providers/pinpoint/utils → utils}/tokenManager.d.ts +0 -0
- /package/lib/pushNotifications/{providers/pinpoint/utils → utils}/tokenManager.js +0 -0
- /package/lib-esm/pushNotifications/{providers/pinpoint/utils → utils}/initializationManager.d.ts +0 -0
- /package/lib-esm/pushNotifications/{providers/pinpoint/utils → utils}/initializationManager.js +0 -0
- /package/lib-esm/pushNotifications/{providers/pinpoint/utils → utils}/resolveConfig.d.ts +0 -0
- /package/lib-esm/pushNotifications/{providers/pinpoint/utils → utils}/resolveCredentials.d.ts +0 -0
- /package/lib-esm/pushNotifications/{providers/pinpoint/utils → utils}/tokenManager.d.ts +0 -0
- /package/lib-esm/pushNotifications/{providers/pinpoint/utils → utils}/tokenManager.js +0 -0
- /package/src/pushNotifications/{providers/pinpoint/utils → utils}/initializationManager.ts +0 -0
- /package/src/pushNotifications/{providers/pinpoint/utils → utils}/tokenManager.ts +0 -0
|
@@ -49,10 +49,10 @@ var utils_3 = require("../../../utils");
|
|
|
49
49
|
* },
|
|
50
50
|
* options: {
|
|
51
51
|
* address: 'device-address',
|
|
52
|
-
*
|
|
53
|
-
*
|
|
54
|
-
*
|
|
55
|
-
*
|
|
52
|
+
* optOut: 'NONE',
|
|
53
|
+
* userAttributes: {
|
|
54
|
+
* interests: ['food']
|
|
55
|
+
* },
|
|
56
56
|
* },
|
|
57
57
|
* });
|
|
58
58
|
*/
|
|
@@ -2,15 +2,14 @@
|
|
|
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
|
|
6
|
-
var sessionTracker_1 = tslib_1.__importDefault(require("../../../sessionTracker"));
|
|
5
|
+
var utils_1 = require("@aws-amplify/core/internals/utils");
|
|
7
6
|
var eventListeners_1 = require("../../../../eventListeners");
|
|
8
7
|
var helpers_1 = require("../utils/helpers");
|
|
9
8
|
var types_1 = require("../types");
|
|
10
9
|
var core_1 = require("@aws-amplify/core");
|
|
11
10
|
var dispatchEvent_1 = require("./dispatchEvent");
|
|
12
|
-
var
|
|
13
|
-
var
|
|
11
|
+
var utils_2 = require("../utils");
|
|
12
|
+
var utils_3 = require("../../../utils");
|
|
14
13
|
/**
|
|
15
14
|
* Initialize and set up in-app messaging category. This API needs to be called to enable other InAppMessaging APIs.
|
|
16
15
|
*
|
|
@@ -23,16 +22,15 @@ var utils_2 = require("../../../utils");
|
|
|
23
22
|
* ```
|
|
24
23
|
*/
|
|
25
24
|
function initializeInAppMessaging() {
|
|
26
|
-
if (
|
|
25
|
+
if (utils_3.isInitialized()) {
|
|
27
26
|
return;
|
|
28
27
|
}
|
|
29
|
-
//
|
|
30
|
-
|
|
31
|
-
sessionTracker.start();
|
|
28
|
+
// register with the session listener
|
|
29
|
+
utils_1.sessionListener.addStateChangeListener(utils_2.sessionStateChangeHandler, true);
|
|
32
30
|
// wire up default Pinpoint message event handling
|
|
33
31
|
eventListeners_1.addEventListener('messageDisplayed', function (message) {
|
|
34
32
|
helpers_1.recordAnalyticsEvent(types_1.PinpointMessageEvent.MESSAGE_DISPLAYED, message);
|
|
35
|
-
|
|
33
|
+
utils_2.incrementMessageCounts(message.id);
|
|
36
34
|
});
|
|
37
35
|
eventListeners_1.addEventListener('messageDismissed', function (message) {
|
|
38
36
|
helpers_1.recordAnalyticsEvent(types_1.PinpointMessageEvent.MESSAGE_DISMISSED, message);
|
|
@@ -42,7 +40,7 @@ function initializeInAppMessaging() {
|
|
|
42
40
|
});
|
|
43
41
|
// listen to analytics hub events
|
|
44
42
|
core_1.Hub.listen('analytics', analyticsListener);
|
|
45
|
-
|
|
43
|
+
utils_3.initialize();
|
|
46
44
|
}
|
|
47
45
|
exports.initializeInAppMessaging = initializeInAppMessaging;
|
|
48
46
|
function analyticsListener(_a) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { InAppMessage, InAppMessagingEvent } from '../../../types';
|
|
2
2
|
import type { InAppMessageCampaign as PinpointInAppMessage } from '@aws-amplify/core/internals/aws-clients/pinpoint';
|
|
3
|
-
import { SessionState } from '
|
|
3
|
+
import { SessionState } from '@aws-amplify/core/internals/utils';
|
|
4
4
|
export declare function processInAppMessages(messages: PinpointInAppMessage[], event: InAppMessagingEvent): Promise<InAppMessage[]>;
|
|
5
5
|
export declare function sessionStateChangeHandler(state: SessionState): void;
|
|
6
6
|
export declare function incrementMessageCounts(messageId: string): Promise<void>;
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
var _a;
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
var utils_1 = require("@aws-amplify/core/internals/utils");
|
|
7
|
+
var utils_2 = require("../utils");
|
|
7
8
|
var PushNotificationError_1 = require("./PushNotificationError");
|
|
8
9
|
var PushNotificationValidationErrorCode;
|
|
9
10
|
(function (PushNotificationValidationErrorCode) {
|
|
@@ -28,3 +29,6 @@ var pushNotificationValidationErrorMap = (_a = {},
|
|
|
28
29
|
},
|
|
29
30
|
_a);
|
|
30
31
|
exports.assert = utils_1.createAssertionFunction(pushNotificationValidationErrorMap, PushNotificationError_1.PushNotificationError);
|
|
32
|
+
exports.assertIsInitialized = function () {
|
|
33
|
+
exports.assert(utils_2.isInitialized(), PushNotificationValidationErrorCode.NotInitialized);
|
|
34
|
+
};
|
|
@@ -4,7 +4,11 @@
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
5
|
var tslib_1 = require("tslib");
|
|
6
6
|
var react_native_1 = require("@aws-amplify/react-native");
|
|
7
|
+
var errorHelpers_1 = require("../../../errors/errorHelpers");
|
|
7
8
|
var getBadgeCountNative = react_native_1.loadAmplifyPushNotification().getBadgeCount;
|
|
8
|
-
exports.getBadgeCount = function () { return tslib_1.__awaiter(void 0, void 0, void 0, function () {
|
|
9
|
-
return
|
|
10
|
-
|
|
9
|
+
exports.getBadgeCount = function () { return tslib_1.__awaiter(void 0, void 0, void 0, function () {
|
|
10
|
+
return tslib_1.__generator(this, function (_a) {
|
|
11
|
+
errorHelpers_1.assertIsInitialized();
|
|
12
|
+
return [2 /*return*/, getBadgeCountNative()];
|
|
13
|
+
});
|
|
14
|
+
}); };
|
|
@@ -3,7 +3,9 @@
|
|
|
3
3
|
// SPDX-License-Identifier: Apache-2.0
|
|
4
4
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
5
|
var react_native_1 = require("@aws-amplify/react-native");
|
|
6
|
+
var errorHelpers_1 = require("../../../errors/errorHelpers");
|
|
6
7
|
var getLaunchNotificationNative = react_native_1.loadAmplifyPushNotification().getLaunchNotification;
|
|
7
8
|
exports.getLaunchNotification = function () {
|
|
9
|
+
errorHelpers_1.assertIsInitialized();
|
|
8
10
|
return getLaunchNotificationNative();
|
|
9
11
|
};
|
|
@@ -3,7 +3,9 @@
|
|
|
3
3
|
// SPDX-License-Identifier: Apache-2.0
|
|
4
4
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
5
|
var react_native_1 = require("@aws-amplify/react-native");
|
|
6
|
+
var errorHelpers_1 = require("../../../errors/errorHelpers");
|
|
6
7
|
var getPermissionStatusNative = react_native_1.loadAmplifyPushNotification().getPermissionStatus;
|
|
7
8
|
exports.getPermissionStatus = function () {
|
|
9
|
+
errorHelpers_1.assertIsInitialized();
|
|
8
10
|
return getPermissionStatusNative();
|
|
9
11
|
};
|
|
@@ -5,21 +5,25 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
5
5
|
var tslib_1 = require("tslib");
|
|
6
6
|
var utils_1 = require("@aws-amplify/core/internals/utils");
|
|
7
7
|
var pinpoint_1 = require("@aws-amplify/core/internals/providers/pinpoint");
|
|
8
|
-
var
|
|
8
|
+
var errorHelpers_1 = require("../../../errors/errorHelpers");
|
|
9
|
+
var utils_2 = require("../../../utils");
|
|
10
|
+
var utils_3 = require("../utils");
|
|
9
11
|
exports.identifyUser = function (_a) {
|
|
10
12
|
var userId = _a.userId, userProfile = _a.userProfile, options = _a.options;
|
|
11
13
|
return tslib_1.__awaiter(void 0, void 0, void 0, function () {
|
|
12
14
|
var _b, credentials, identityId, _c, appId, region, _d, address, optOut, userAttributes;
|
|
13
15
|
return tslib_1.__generator(this, function (_e) {
|
|
14
16
|
switch (_e.label) {
|
|
15
|
-
case 0:
|
|
17
|
+
case 0:
|
|
18
|
+
errorHelpers_1.assertIsInitialized();
|
|
19
|
+
return [4 /*yield*/, utils_2.resolveCredentials()];
|
|
16
20
|
case 1:
|
|
17
21
|
_b = _e.sent(), credentials = _b.credentials, identityId = _b.identityId;
|
|
18
22
|
_c = utils_2.resolveConfig(), appId = _c.appId, region = _c.region;
|
|
19
23
|
_d = options !== null && options !== void 0 ? options : {}, address = _d.address, optOut = _d.optOut, userAttributes = _d.userAttributes;
|
|
20
24
|
pinpoint_1.updateEndpoint({
|
|
21
25
|
address: address,
|
|
22
|
-
channelType:
|
|
26
|
+
channelType: utils_3.getChannelType(),
|
|
23
27
|
optOut: optOut,
|
|
24
28
|
appId: appId,
|
|
25
29
|
category: 'PushNotification',
|
|
@@ -29,7 +33,7 @@ exports.identifyUser = function (_a) {
|
|
|
29
33
|
userAttributes: userAttributes,
|
|
30
34
|
userId: userId,
|
|
31
35
|
userProfile: userProfile,
|
|
32
|
-
userAgentValue:
|
|
36
|
+
userAgentValue: utils_3.getPushNotificationUserAgentString(utils_1.PushNotificationAction.IdentifyUser),
|
|
33
37
|
});
|
|
34
38
|
return [2 /*return*/];
|
|
35
39
|
}
|
|
@@ -8,7 +8,8 @@ var utils_1 = require("@aws-amplify/core/internals/utils");
|
|
|
8
8
|
var pinpoint_1 = require("@aws-amplify/core/internals/providers/pinpoint");
|
|
9
9
|
var react_native_1 = require("@aws-amplify/react-native");
|
|
10
10
|
var eventListeners_1 = require("../../../../eventListeners");
|
|
11
|
-
var utils_2 = require("
|
|
11
|
+
var utils_2 = require("../../../utils");
|
|
12
|
+
var utils_3 = require("../utils");
|
|
12
13
|
var _a = react_native_1.loadAmplifyPushNotification(), addMessageEventListener = _a.addMessageEventListener, addTokenEventListener = _a.addTokenEventListener, completeNotification = _a.completeNotification, getConstants = _a.getConstants, registerHeadlessTask = _a.registerHeadlessTask;
|
|
13
14
|
var logger = new core_1.ConsoleLogger('Notifications.PushNotification');
|
|
14
15
|
var BACKGROUND_TASK_TIMEOUT = 25; // seconds
|
|
@@ -24,16 +25,16 @@ exports.initializePushNotifications = function () {
|
|
|
24
25
|
var addAnalyticsListeners = function () {
|
|
25
26
|
var launchNotificationOpenedListenerRemover;
|
|
26
27
|
// wire up default Pinpoint message event handling
|
|
27
|
-
eventListeners_1.addEventListener('backgroundMessageReceived',
|
|
28
|
-
eventListeners_1.addEventListener('foregroundMessageReceived',
|
|
29
|
-
launchNotificationOpenedListenerRemover = eventListeners_1.addEventListener('launchNotificationsOpened',
|
|
28
|
+
eventListeners_1.addEventListener('backgroundMessageReceived', utils_3.createMessageEventRecorder('backgroundMessageReceived'));
|
|
29
|
+
eventListeners_1.addEventListener('foregroundMessageReceived', utils_3.createMessageEventRecorder('foregroundMessageReceived'));
|
|
30
|
+
launchNotificationOpenedListenerRemover = eventListeners_1.addEventListener('launchNotificationsOpened', utils_3.createMessageEventRecorder('notificationOpened',
|
|
30
31
|
// once we are done with it we can remove the listener
|
|
31
32
|
launchNotificationOpenedListenerRemover === null ||
|
|
32
33
|
// once we are done with it we can remove the listener
|
|
33
34
|
launchNotificationOpenedListenerRemover === void 0 ? void 0 :
|
|
34
35
|
// once we are done with it we can remove the listener
|
|
35
36
|
launchNotificationOpenedListenerRemover.remove));
|
|
36
|
-
eventListeners_1.addEventListener('notificationOpened',
|
|
37
|
+
eventListeners_1.addEventListener('notificationOpened', utils_3.createMessageEventRecorder('notificationOpened',
|
|
37
38
|
// if we are in this state, we no longer need the listener as the app was launched via some other means
|
|
38
39
|
launchNotificationOpenedListenerRemover === null ||
|
|
39
40
|
// if we are in this state, we no longer need the listener as the app was launched via some other means
|
|
@@ -148,9 +149,9 @@ var registerDevice = function () { return tslib_1.__awaiter(void 0, void 0, void
|
|
|
148
149
|
category: 'PushNotification',
|
|
149
150
|
credentials: credentials,
|
|
150
151
|
region: region,
|
|
151
|
-
channelType:
|
|
152
|
+
channelType: utils_3.getChannelType(),
|
|
152
153
|
identityId: identityId,
|
|
153
|
-
userAgentValue:
|
|
154
|
+
userAgentValue: utils_3.getPushNotificationUserAgentString(utils_1.PushNotificationAction.InitializePushNotifications),
|
|
154
155
|
})];
|
|
155
156
|
}
|
|
156
157
|
});
|
|
@@ -3,6 +3,8 @@
|
|
|
3
3
|
// SPDX-License-Identifier: Apache-2.0
|
|
4
4
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
5
|
var eventListeners_1 = require("../../../../eventListeners");
|
|
6
|
+
var errorHelpers_1 = require("../../../errors/errorHelpers");
|
|
6
7
|
exports.onNotificationOpened = function (input) {
|
|
8
|
+
errorHelpers_1.assertIsInitialized();
|
|
7
9
|
return eventListeners_1.addEventListener('notificationOpened', input);
|
|
8
10
|
};
|
package/lib/pushNotifications/providers/pinpoint/apis/onNotificationReceivedInBackground.native.js
CHANGED
|
@@ -3,4 +3,8 @@
|
|
|
3
3
|
// SPDX-License-Identifier: Apache-2.0
|
|
4
4
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
5
|
var eventListeners_1 = require("../../../../eventListeners");
|
|
6
|
-
|
|
6
|
+
var errorHelpers_1 = require("../../../errors/errorHelpers");
|
|
7
|
+
exports.onNotificationReceivedInBackground = function (input) {
|
|
8
|
+
errorHelpers_1.assertIsInitialized();
|
|
9
|
+
return eventListeners_1.addEventListener('backgroundMessageReceived', input);
|
|
10
|
+
};
|
package/lib/pushNotifications/providers/pinpoint/apis/onNotificationReceivedInForeground.native.js
CHANGED
|
@@ -3,4 +3,8 @@
|
|
|
3
3
|
// SPDX-License-Identifier: Apache-2.0
|
|
4
4
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
5
|
var eventListeners_1 = require("../../../../eventListeners");
|
|
6
|
-
|
|
6
|
+
var errorHelpers_1 = require("../../../errors/errorHelpers");
|
|
7
|
+
exports.onNotificationReceivedInForeground = function (input) {
|
|
8
|
+
errorHelpers_1.assertIsInitialized();
|
|
9
|
+
return eventListeners_1.addEventListener('foregroundMessageReceived', input);
|
|
10
|
+
};
|
|
@@ -3,6 +3,8 @@
|
|
|
3
3
|
// SPDX-License-Identifier: Apache-2.0
|
|
4
4
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
5
|
var eventListeners_1 = require("../../../../eventListeners");
|
|
6
|
+
var errorHelpers_1 = require("../../../errors/errorHelpers");
|
|
6
7
|
exports.onTokenReceived = function (input) {
|
|
8
|
+
errorHelpers_1.assertIsInitialized();
|
|
7
9
|
return eventListeners_1.addEventListener('tokenReceived', input);
|
|
8
10
|
};
|
|
@@ -3,7 +3,9 @@
|
|
|
3
3
|
// SPDX-License-Identifier: Apache-2.0
|
|
4
4
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
5
|
var react_native_1 = require("@aws-amplify/react-native");
|
|
6
|
+
var errorHelpers_1 = require("../../../errors/errorHelpers");
|
|
6
7
|
var requestPermissionsNative = react_native_1.loadAmplifyPushNotification().requestPermissions;
|
|
7
8
|
exports.requestPermissions = function (input) {
|
|
9
|
+
errorHelpers_1.assertIsInitialized();
|
|
8
10
|
return requestPermissionsNative(input);
|
|
9
11
|
};
|
|
@@ -3,5 +3,9 @@
|
|
|
3
3
|
// SPDX-License-Identifier: Apache-2.0
|
|
4
4
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
5
|
var react_native_1 = require("@aws-amplify/react-native");
|
|
6
|
+
var errorHelpers_1 = require("../../../errors/errorHelpers");
|
|
6
7
|
var setBadgeCountNative = react_native_1.loadAmplifyPushNotification().setBadgeCount;
|
|
7
|
-
exports.setBadgeCount = function (input) {
|
|
8
|
+
exports.setBadgeCount = function (input) {
|
|
9
|
+
errorHelpers_1.assertIsInitialized();
|
|
10
|
+
setBadgeCountNative(input);
|
|
11
|
+
};
|
|
@@ -7,8 +7,7 @@ var pinpoint_1 = require("@aws-amplify/core/internals/providers/pinpoint");
|
|
|
7
7
|
var core_1 = require("@aws-amplify/core");
|
|
8
8
|
var getAnalyticsEvent_1 = require("./getAnalyticsEvent");
|
|
9
9
|
var getChannelType_1 = require("./getChannelType");
|
|
10
|
-
var
|
|
11
|
-
var resolveConfig_1 = require("./resolveConfig");
|
|
10
|
+
var utils_1 = require("../../../utils");
|
|
12
11
|
var logger = new core_1.ConsoleLogger('PushNotification.recordMessageEvent');
|
|
13
12
|
/**
|
|
14
13
|
* @internal
|
|
@@ -18,10 +17,10 @@ exports.createMessageEventRecorder = function (event, callback) {
|
|
|
18
17
|
var credentials, _a, appId, region;
|
|
19
18
|
return tslib_1.__generator(this, function (_b) {
|
|
20
19
|
switch (_b.label) {
|
|
21
|
-
case 0: return [4 /*yield*/,
|
|
20
|
+
case 0: return [4 /*yield*/, utils_1.resolveCredentials()];
|
|
22
21
|
case 1:
|
|
23
22
|
credentials = (_b.sent()).credentials;
|
|
24
|
-
_a =
|
|
23
|
+
_a = utils_1.resolveConfig(), appId = _a.appId, region = _a.region;
|
|
25
24
|
return [4 /*yield*/, recordMessageEvent({
|
|
26
25
|
appId: appId,
|
|
27
26
|
credentials: credentials,
|
|
@@ -1,7 +1,3 @@
|
|
|
1
1
|
export { createMessageEventRecorder } from './createMessageEventRecorder';
|
|
2
2
|
export { getChannelType } from './getChannelType';
|
|
3
3
|
export { getPushNotificationUserAgentString } from './getPushNotificationUserAgentString';
|
|
4
|
-
export { initialize, isInitialized } from './initializationManager';
|
|
5
|
-
export { resolveConfig } from './resolveConfig';
|
|
6
|
-
export { resolveCredentials } from './resolveCredentials';
|
|
7
|
-
export { getToken, setToken } from './tokenManager';
|
|
@@ -8,13 +8,3 @@ var getChannelType_1 = require("./getChannelType");
|
|
|
8
8
|
exports.getChannelType = getChannelType_1.getChannelType;
|
|
9
9
|
var getPushNotificationUserAgentString_1 = require("./getPushNotificationUserAgentString");
|
|
10
10
|
exports.getPushNotificationUserAgentString = getPushNotificationUserAgentString_1.getPushNotificationUserAgentString;
|
|
11
|
-
var initializationManager_1 = require("./initializationManager");
|
|
12
|
-
exports.initialize = initializationManager_1.initialize;
|
|
13
|
-
exports.isInitialized = initializationManager_1.isInitialized;
|
|
14
|
-
var resolveConfig_1 = require("./resolveConfig");
|
|
15
|
-
exports.resolveConfig = resolveConfig_1.resolveConfig;
|
|
16
|
-
var resolveCredentials_1 = require("./resolveCredentials");
|
|
17
|
-
exports.resolveCredentials = resolveCredentials_1.resolveCredentials;
|
|
18
|
-
var tokenManager_1 = require("./tokenManager");
|
|
19
|
-
exports.getToken = tokenManager_1.getToken;
|
|
20
|
-
exports.setToken = tokenManager_1.setToken;
|
|
@@ -0,0 +1,14 @@
|
|
|
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 initializationManager_1 = require("./initializationManager");
|
|
6
|
+
exports.initialize = initializationManager_1.initialize;
|
|
7
|
+
exports.isInitialized = initializationManager_1.isInitialized;
|
|
8
|
+
var resolveConfig_1 = require("./resolveConfig");
|
|
9
|
+
exports.resolveConfig = resolveConfig_1.resolveConfig;
|
|
10
|
+
var resolveCredentials_1 = require("./resolveCredentials");
|
|
11
|
+
exports.resolveCredentials = resolveCredentials_1.resolveCredentials;
|
|
12
|
+
var tokenManager_1 = require("./tokenManager");
|
|
13
|
+
exports.getToken = tokenManager_1.getToken;
|
|
14
|
+
exports.setToken = tokenManager_1.setToken;
|