@aws-amplify/notifications 2.0.80 → 2.0.81-local-stack.00864ae.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/dist/cjs/eventListeners/index.js +1 -1
- package/dist/cjs/eventListeners/index.js.map +1 -1
- package/dist/cjs/inAppMessaging/errors/assertServiceError.js +1 -2
- package/dist/cjs/inAppMessaging/errors/assertServiceError.js.map +1 -1
- package/dist/cjs/inAppMessaging/errors/assertValidationError.js +1 -2
- package/dist/cjs/inAppMessaging/errors/assertValidationError.js.map +1 -1
- package/dist/cjs/inAppMessaging/errors/validation.js +1 -1
- package/dist/cjs/inAppMessaging/errors/validation.js.map +1 -1
- package/dist/cjs/inAppMessaging/index.js +1 -1
- package/dist/cjs/inAppMessaging/index.js.map +1 -1
- package/dist/cjs/inAppMessaging/providers/pinpoint/apis/clearMessages.js +1 -2
- package/dist/cjs/inAppMessaging/providers/pinpoint/apis/clearMessages.js.map +1 -1
- package/dist/cjs/inAppMessaging/providers/pinpoint/apis/dispatchEvent.js +1 -2
- package/dist/cjs/inAppMessaging/providers/pinpoint/apis/dispatchEvent.js.map +1 -1
- package/dist/cjs/inAppMessaging/providers/pinpoint/apis/index.js +1 -1
- package/dist/cjs/inAppMessaging/providers/pinpoint/apis/index.js.map +1 -1
- package/dist/cjs/inAppMessaging/providers/pinpoint/apis/initializeInAppMessaging.js +1 -2
- package/dist/cjs/inAppMessaging/providers/pinpoint/apis/initializeInAppMessaging.js.map +1 -1
- package/dist/cjs/inAppMessaging/providers/pinpoint/apis/notifyMessageInteraction.js +1 -2
- package/dist/cjs/inAppMessaging/providers/pinpoint/apis/notifyMessageInteraction.js.map +1 -1
- package/dist/cjs/inAppMessaging/providers/pinpoint/apis/onMessageActionTaken.js +1 -2
- package/dist/cjs/inAppMessaging/providers/pinpoint/apis/onMessageActionTaken.js.map +1 -1
- package/dist/cjs/inAppMessaging/providers/pinpoint/apis/onMessageDismissed.js +1 -2
- package/dist/cjs/inAppMessaging/providers/pinpoint/apis/onMessageDismissed.js.map +1 -1
- package/dist/cjs/inAppMessaging/providers/pinpoint/apis/onMessageDisplayed.js +1 -2
- package/dist/cjs/inAppMessaging/providers/pinpoint/apis/onMessageDisplayed.js.map +1 -1
- package/dist/cjs/inAppMessaging/providers/pinpoint/apis/onMessageReceived.js +1 -2
- package/dist/cjs/inAppMessaging/providers/pinpoint/apis/onMessageReceived.js.map +1 -1
- package/dist/cjs/inAppMessaging/providers/pinpoint/apis/setConflictHandler.js +1 -2
- package/dist/cjs/inAppMessaging/providers/pinpoint/apis/setConflictHandler.js.map +1 -1
- package/dist/cjs/inAppMessaging/providers/pinpoint/apis/syncMessages.js +1 -2
- package/dist/cjs/inAppMessaging/providers/pinpoint/apis/syncMessages.js.map +1 -1
- package/dist/cjs/inAppMessaging/providers/pinpoint/index.js +1 -1
- package/dist/cjs/inAppMessaging/providers/pinpoint/index.js.map +1 -1
- package/dist/cjs/inAppMessaging/providers/pinpoint/types/types.js +2 -1
- package/dist/cjs/inAppMessaging/providers/pinpoint/types/types.js.map +1 -1
- package/dist/cjs/inAppMessaging/providers/pinpoint/utils/messageProcessingHelpers.js +3 -4
- package/dist/cjs/inAppMessaging/providers/pinpoint/utils/messageProcessingHelpers.js.map +1 -1
- package/dist/cjs/inAppMessaging/providers/pinpoint/utils/userAgent.js +2 -3
- package/dist/cjs/inAppMessaging/providers/pinpoint/utils/userAgent.js.map +1 -1
- package/dist/cjs/inAppMessaging/utils/statusHelpers.js +2 -2
- package/dist/cjs/inAppMessaging/utils/statusHelpers.js.map +1 -1
- package/dist/cjs/pushNotifications/errors/errorHelpers.js +1 -1
- package/dist/cjs/pushNotifications/errors/errorHelpers.js.map +1 -1
- package/dist/cjs/pushNotifications/types/errors.js +2 -1
- package/dist/cjs/pushNotifications/types/errors.js.map +1 -1
- package/dist/esm/inAppMessaging/providers/pinpoint/utils/helpers.d.ts +2 -2
- package/package.json +104 -105
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
4
4
|
// SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.notifyEventListenersAndAwaitHandlers = exports.notifyEventListeners =
|
|
6
|
+
exports.notifyEventListenersAndAwaitHandlers = exports.notifyEventListeners = void 0;
|
|
7
7
|
var eventListeners_1 = require("./eventListeners");
|
|
8
8
|
Object.defineProperty(exports, "addEventListener", { enumerable: true, get: function () { return eventListeners_1.addEventListener; } });
|
|
9
9
|
Object.defineProperty(exports, "notifyEventListeners", { enumerable: true, get: function () { return eventListeners_1.notifyEventListeners; } });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../src/eventListeners/index.ts"],"sourcesContent":["\"use strict\";\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.notifyEventListenersAndAwaitHandlers = exports.notifyEventListeners =
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../src/eventListeners/index.ts"],"sourcesContent":["\"use strict\";\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.notifyEventListenersAndAwaitHandlers = exports.notifyEventListeners = void 0;\nvar eventListeners_1 = require(\"./eventListeners\");\nObject.defineProperty(exports, \"addEventListener\", { enumerable: true, get: function () { return eventListeners_1.addEventListener; } });\nObject.defineProperty(exports, \"notifyEventListeners\", { enumerable: true, get: function () { return eventListeners_1.notifyEventListeners; } });\nObject.defineProperty(exports, \"notifyEventListenersAndAwaitHandlers\", { enumerable: true, get: function () { return eventListeners_1.notifyEventListenersAndAwaitHandlers; } });\n"],"names":[],"mappings":";;AACA;AACA;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;AAC7D,OAAO,CAAC,oCAAoC,GAAG,OAAO,CAAC,oBAAoB,GAAG,MAAM;AACpF,IAAI,gBAAgB,GAAG,OAAO,CAAC,kBAAkB,CAAC;AAClD,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,kBAAkB,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,EAAE,YAAY,EAAE,OAAO,gBAAgB,CAAC,gBAAgB,CAAC,EAAE,EAAE,CAAC;AACxI,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,sBAAsB,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,EAAE,YAAY,EAAE,OAAO,gBAAgB,CAAC,oBAAoB,CAAC,EAAE,EAAE,CAAC;AAChJ,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,sCAAsC,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,EAAE,YAAY,EAAE,OAAO,gBAAgB,CAAC,oCAAoC,CAAC,EAAE,EAAE,CAAC;;"}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
4
4
|
// SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.assertServiceError =
|
|
6
|
+
exports.assertServiceError = assertServiceError;
|
|
7
7
|
const utils_1 = require("@aws-amplify/core/internals/utils");
|
|
8
8
|
const InAppMessagingError_1 = require("./InAppMessagingError");
|
|
9
9
|
function assertServiceError(error) {
|
|
@@ -17,5 +17,4 @@ function assertServiceError(error) {
|
|
|
17
17
|
});
|
|
18
18
|
}
|
|
19
19
|
}
|
|
20
|
-
exports.assertServiceError = assertServiceError;
|
|
21
20
|
//# sourceMappingURL=assertServiceError.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"assertServiceError.js","sources":["../../../../src/inAppMessaging/errors/assertServiceError.ts"],"sourcesContent":["\"use strict\";\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.assertServiceError =
|
|
1
|
+
{"version":3,"file":"assertServiceError.js","sources":["../../../../src/inAppMessaging/errors/assertServiceError.ts"],"sourcesContent":["\"use strict\";\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.assertServiceError = assertServiceError;\nconst utils_1 = require(\"@aws-amplify/core/internals/utils\");\nconst InAppMessagingError_1 = require(\"./InAppMessagingError\");\nfunction assertServiceError(error) {\n if (!error ||\n error.name === 'Error' ||\n error instanceof TypeError) {\n throw new InAppMessagingError_1.InAppMessagingError({\n name: utils_1.AmplifyErrorCode.Unknown,\n message: 'An unknown error has occurred.',\n underlyingError: error,\n });\n }\n}\n"],"names":[],"mappings":";;AACA;AACA;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;AAC7D,OAAO,CAAC,kBAAkB,GAAG,kBAAkB;AAC/C,MAAM,OAAO,GAAG,OAAO,CAAC,mCAAmC,CAAC;AAC5D,MAAM,qBAAqB,GAAG,OAAO,CAAC,uBAAuB,CAAC;AAC9D,SAAS,kBAAkB,CAAC,KAAK,EAAE;AACnC,IAAI,IAAI,CAAC,KAAK;AACd,QAAQ,KAAK,CAAC,IAAI,KAAK,OAAO;AAC9B,QAAQ,KAAK,YAAY,SAAS,EAAE;AACpC,QAAQ,MAAM,IAAI,qBAAqB,CAAC,mBAAmB,CAAC;AAC5D,YAAY,IAAI,EAAE,OAAO,CAAC,gBAAgB,CAAC,OAAO;AAClD,YAAY,OAAO,EAAE,gCAAgC;AACrD,YAAY,eAAe,EAAE,KAAK;AAClC,SAAS,CAAC;AACV;AACA;;"}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
4
4
|
// SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.assertValidationError =
|
|
6
|
+
exports.assertValidationError = assertValidationError;
|
|
7
7
|
const InAppMessagingError_1 = require("./InAppMessagingError");
|
|
8
8
|
const validation_1 = require("./validation");
|
|
9
9
|
/**
|
|
@@ -15,5 +15,4 @@ function assertValidationError(assertion, name) {
|
|
|
15
15
|
throw new InAppMessagingError_1.InAppMessagingError({ name, message, recoverySuggestion });
|
|
16
16
|
}
|
|
17
17
|
}
|
|
18
|
-
exports.assertValidationError = assertValidationError;
|
|
19
18
|
//# sourceMappingURL=assertValidationError.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"assertValidationError.js","sources":["../../../../src/inAppMessaging/errors/assertValidationError.ts"],"sourcesContent":["\"use strict\";\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.assertValidationError =
|
|
1
|
+
{"version":3,"file":"assertValidationError.js","sources":["../../../../src/inAppMessaging/errors/assertValidationError.ts"],"sourcesContent":["\"use strict\";\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.assertValidationError = assertValidationError;\nconst InAppMessagingError_1 = require(\"./InAppMessagingError\");\nconst validation_1 = require(\"./validation\");\n/**\n * @internal\n */\nfunction assertValidationError(assertion, name) {\n const { message, recoverySuggestion } = validation_1.validationErrorMap[name];\n if (!assertion) {\n throw new InAppMessagingError_1.InAppMessagingError({ name, message, recoverySuggestion });\n }\n}\n"],"names":[],"mappings":";;AACA;AACA;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;AAC7D,OAAO,CAAC,qBAAqB,GAAG,qBAAqB;AACrD,MAAM,qBAAqB,GAAG,OAAO,CAAC,uBAAuB,CAAC;AAC9D,MAAM,YAAY,GAAG,OAAO,CAAC,cAAc,CAAC;AAC5C;AACA;AACA;AACA,SAAS,qBAAqB,CAAC,SAAS,EAAE,IAAI,EAAE;AAChD,IAAI,MAAM,EAAE,OAAO,EAAE,kBAAkB,EAAE,GAAG,YAAY,CAAC,kBAAkB,CAAC,IAAI,CAAC;AACjF,IAAI,IAAI,CAAC,SAAS,EAAE;AACpB,QAAQ,MAAM,IAAI,qBAAqB,CAAC,mBAAmB,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,kBAAkB,EAAE,CAAC;AAClG;AACA;;"}
|
|
@@ -10,7 +10,7 @@ var InAppMessagingValidationErrorCode;
|
|
|
10
10
|
InAppMessagingValidationErrorCode["NoCredentials"] = "NoCredentials";
|
|
11
11
|
InAppMessagingValidationErrorCode["NoRegion"] = "NoRegion";
|
|
12
12
|
InAppMessagingValidationErrorCode["NotInitialized"] = "NotInitialized";
|
|
13
|
-
})(InAppMessagingValidationErrorCode
|
|
13
|
+
})(InAppMessagingValidationErrorCode || (exports.InAppMessagingValidationErrorCode = InAppMessagingValidationErrorCode = {}));
|
|
14
14
|
exports.validationErrorMap = {
|
|
15
15
|
[InAppMessagingValidationErrorCode.NoAppId]: {
|
|
16
16
|
message: 'Missing application id.',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validation.js","sources":["../../../../src/inAppMessaging/errors/validation.ts"],"sourcesContent":["\"use strict\";\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.validationErrorMap = exports.InAppMessagingValidationErrorCode = void 0;\nvar InAppMessagingValidationErrorCode;\n(function (InAppMessagingValidationErrorCode) {\n InAppMessagingValidationErrorCode[\"NoAppId\"] = \"NoAppId\";\n InAppMessagingValidationErrorCode[\"NoCredentials\"] = \"NoCredentials\";\n InAppMessagingValidationErrorCode[\"NoRegion\"] = \"NoRegion\";\n InAppMessagingValidationErrorCode[\"NotInitialized\"] = \"NotInitialized\";\n})(InAppMessagingValidationErrorCode
|
|
1
|
+
{"version":3,"file":"validation.js","sources":["../../../../src/inAppMessaging/errors/validation.ts"],"sourcesContent":["\"use strict\";\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.validationErrorMap = exports.InAppMessagingValidationErrorCode = void 0;\nvar InAppMessagingValidationErrorCode;\n(function (InAppMessagingValidationErrorCode) {\n InAppMessagingValidationErrorCode[\"NoAppId\"] = \"NoAppId\";\n InAppMessagingValidationErrorCode[\"NoCredentials\"] = \"NoCredentials\";\n InAppMessagingValidationErrorCode[\"NoRegion\"] = \"NoRegion\";\n InAppMessagingValidationErrorCode[\"NotInitialized\"] = \"NotInitialized\";\n})(InAppMessagingValidationErrorCode || (exports.InAppMessagingValidationErrorCode = InAppMessagingValidationErrorCode = {}));\nexports.validationErrorMap = {\n [InAppMessagingValidationErrorCode.NoAppId]: {\n message: 'Missing application id.',\n },\n [InAppMessagingValidationErrorCode.NoCredentials]: {\n message: 'Credentials should not be empty.',\n },\n [InAppMessagingValidationErrorCode.NoRegion]: {\n message: 'Missing region.',\n },\n [InAppMessagingValidationErrorCode.NotInitialized]: {\n message: 'In-app messaging has not been initialized.',\n recoverySuggestion: 'Please make sure to first call `initializeInAppMessaging`.',\n },\n};\n"],"names":[],"mappings":";;AACA;AACA;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;AAC7D,OAAO,CAAC,kBAAkB,GAAG,OAAO,CAAC,iCAAiC,GAAG,MAAM;AAC/E,IAAI,iCAAiC;AACrC,CAAC,UAAU,iCAAiC,EAAE;AAC9C,IAAI,iCAAiC,CAAC,SAAS,CAAC,GAAG,SAAS;AAC5D,IAAI,iCAAiC,CAAC,eAAe,CAAC,GAAG,eAAe;AACxE,IAAI,iCAAiC,CAAC,UAAU,CAAC,GAAG,UAAU;AAC9D,IAAI,iCAAiC,CAAC,gBAAgB,CAAC,GAAG,gBAAgB;AAC1E,CAAC,EAAE,iCAAiC,KAAK,OAAO,CAAC,iCAAiC,GAAG,iCAAiC,GAAG,EAAE,CAAC,CAAC;AAC7H,OAAO,CAAC,kBAAkB,GAAG;AAC7B,IAAI,CAAC,iCAAiC,CAAC,OAAO,GAAG;AACjD,QAAQ,OAAO,EAAE,yBAAyB;AAC1C,KAAK;AACL,IAAI,CAAC,iCAAiC,CAAC,aAAa,GAAG;AACvD,QAAQ,OAAO,EAAE,kCAAkC;AACnD,KAAK;AACL,IAAI,CAAC,iCAAiC,CAAC,QAAQ,GAAG;AAClD,QAAQ,OAAO,EAAE,iBAAiB;AAClC,KAAK;AACL,IAAI,CAAC,iCAAiC,CAAC,cAAc,GAAG;AACxD,QAAQ,OAAO,EAAE,4CAA4C;AAC7D,QAAQ,kBAAkB,EAAE,4DAA4D;AACxF,KAAK;AACL,CAAC;;"}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
4
4
|
// SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.clearMessages = exports.notifyMessageInteraction = exports.onMessageActionTaken = exports.onMessageDismissed = exports.onMessageDisplayed = exports.onMessageReceived = exports.initializeInAppMessaging = exports.setConflictHandler = exports.
|
|
6
|
+
exports.clearMessages = exports.notifyMessageInteraction = exports.onMessageActionTaken = exports.onMessageDismissed = exports.onMessageDisplayed = exports.onMessageReceived = exports.initializeInAppMessaging = exports.setConflictHandler = exports.syncMessages = exports.identifyUser = void 0;
|
|
7
7
|
var pinpoint_1 = require("./providers/pinpoint");
|
|
8
8
|
Object.defineProperty(exports, "identifyUser", { enumerable: true, get: function () { return pinpoint_1.identifyUser; } });
|
|
9
9
|
Object.defineProperty(exports, "syncMessages", { enumerable: true, get: function () { return pinpoint_1.syncMessages; } });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../src/inAppMessaging/index.ts"],"sourcesContent":["\"use strict\";\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.clearMessages = exports.notifyMessageInteraction = exports.onMessageActionTaken = exports.onMessageDismissed = exports.onMessageDisplayed = exports.onMessageReceived = exports.initializeInAppMessaging = exports.setConflictHandler = exports.
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../src/inAppMessaging/index.ts"],"sourcesContent":["\"use strict\";\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.clearMessages = exports.notifyMessageInteraction = exports.onMessageActionTaken = exports.onMessageDismissed = exports.onMessageDisplayed = exports.onMessageReceived = exports.initializeInAppMessaging = exports.setConflictHandler = exports.syncMessages = exports.identifyUser = void 0;\nvar pinpoint_1 = require(\"./providers/pinpoint\");\nObject.defineProperty(exports, \"identifyUser\", { enumerable: true, get: function () { return pinpoint_1.identifyUser; } });\nObject.defineProperty(exports, \"syncMessages\", { enumerable: true, get: function () { return pinpoint_1.syncMessages; } });\nObject.defineProperty(exports, \"dispatchEvent\", { enumerable: true, get: function () { return pinpoint_1.dispatchEvent; } });\nObject.defineProperty(exports, \"setConflictHandler\", { enumerable: true, get: function () { return pinpoint_1.setConflictHandler; } });\nObject.defineProperty(exports, \"initializeInAppMessaging\", { enumerable: true, get: function () { return pinpoint_1.initializeInAppMessaging; } });\nObject.defineProperty(exports, \"onMessageReceived\", { enumerable: true, get: function () { return pinpoint_1.onMessageReceived; } });\nObject.defineProperty(exports, \"onMessageDisplayed\", { enumerable: true, get: function () { return pinpoint_1.onMessageDisplayed; } });\nObject.defineProperty(exports, \"onMessageDismissed\", { enumerable: true, get: function () { return pinpoint_1.onMessageDismissed; } });\nObject.defineProperty(exports, \"onMessageActionTaken\", { enumerable: true, get: function () { return pinpoint_1.onMessageActionTaken; } });\nObject.defineProperty(exports, \"notifyMessageInteraction\", { enumerable: true, get: function () { return pinpoint_1.notifyMessageInteraction; } });\nObject.defineProperty(exports, \"clearMessages\", { enumerable: true, get: function () { return pinpoint_1.clearMessages; } });\n"],"names":[],"mappings":";;AACA;AACA;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;AAC7D,OAAO,CAAC,aAAa,GAAG,OAAO,CAAC,wBAAwB,GAAG,OAAO,CAAC,oBAAoB,GAAG,OAAO,CAAC,kBAAkB,GAAG,OAAO,CAAC,kBAAkB,GAAG,OAAO,CAAC,iBAAiB,GAAG,OAAO,CAAC,wBAAwB,GAAG,OAAO,CAAC,kBAAkB,GAAG,OAAO,CAAC,YAAY,GAAG,OAAO,CAAC,YAAY,GAAG,MAAM;AACpS,IAAI,UAAU,GAAG,OAAO,CAAC,sBAAsB,CAAC;AAChD,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,cAAc,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,EAAE,YAAY,EAAE,OAAO,UAAU,CAAC,YAAY,CAAC,EAAE,EAAE,CAAC;AAC1H,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,cAAc,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,EAAE,YAAY,EAAE,OAAO,UAAU,CAAC,YAAY,CAAC,EAAE,EAAE,CAAC;AAC1H,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,eAAe,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,EAAE,YAAY,EAAE,OAA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EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,EAAE,YAAY,EAAE,OAAO,UAAU,CAAC,aAAa,CAAC,EAAE,EAAE,CAAC;;"}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
4
4
|
// SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.clearMessages =
|
|
6
|
+
exports.clearMessages = clearMessages;
|
|
7
7
|
const core_1 = require("@aws-amplify/core");
|
|
8
8
|
const utils_1 = require("../utils");
|
|
9
9
|
const utils_2 = require("../../../utils");
|
|
@@ -24,5 +24,4 @@ async function clearMessages() {
|
|
|
24
24
|
const key = `${utils_1.PINPOINT_KEY_PREFIX}${utils_1.STORAGE_KEY_SUFFIX}`;
|
|
25
25
|
await core_1.defaultStorage.removeItem(key);
|
|
26
26
|
}
|
|
27
|
-
exports.clearMessages = clearMessages;
|
|
28
27
|
//# sourceMappingURL=clearMessages.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"clearMessages.js","sources":["../../../../../../src/inAppMessaging/providers/pinpoint/apis/clearMessages.ts"],"sourcesContent":["\"use strict\";\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.clearMessages =
|
|
1
|
+
{"version":3,"file":"clearMessages.js","sources":["../../../../../../src/inAppMessaging/providers/pinpoint/apis/clearMessages.ts"],"sourcesContent":["\"use strict\";\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.clearMessages = clearMessages;\nconst core_1 = require(\"@aws-amplify/core\");\nconst utils_1 = require(\"../utils\");\nconst utils_2 = require(\"../../../utils\");\n/**\n * Clear locally cached messages.\n *\n * @throws validation: {@link InAppMessagingValidationErrorCode} - Thrown if In App messaging hasn't been initialized.\n * @returns A promise that will resolve when the operation is complete.\n * @example\n * ```ts\n * // Clear locally cached messages.\n * await clearMessages();\n *\n * ```\n */\nasync function clearMessages() {\n (0, utils_2.assertIsInitialized)();\n const key = `${utils_1.PINPOINT_KEY_PREFIX}${utils_1.STORAGE_KEY_SUFFIX}`;\n await core_1.defaultStorage.removeItem(key);\n}\n"],"names":[],"mappings":";;AACA;AACA;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;AAC7D,OAAO,CAAC,aAAa,GAAG,aAAa;AACrC,MAAM,MAAM,GAAG,OAAO,CAAC,mBAAmB,CAAC;AAC3C,MAAM,OAAO,GAAG,OAAO,CAAC,UAAU,CAAC;AACnC,MAAM,OAAO,GAAG,OAAO,CAAC,gBAAgB,CAAC;AACzC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,aAAa,GAAG;AAC/B,IAAI,IAAI,OAAO,CAAC,mBAAmB,GAAG;AACtC,IAAI,MAAM,GAAG,GAAG,CAAC,EAAE,OAAO,CAAC,mBAAmB,CAAC,EAAE,OAAO,CAAC,kBAAkB,CAAC,CAAC;AAC7E,IAAI,MAAM,MAAM,CAAC,cAAc,CAAC,UAAU,CAAC,GAAG,CAAC;AAC/C;;"}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
4
4
|
// SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.dispatchEvent =
|
|
6
|
+
exports.dispatchEvent = dispatchEvent;
|
|
7
7
|
const tslib_1 = require("tslib");
|
|
8
8
|
const flatten_js_1 = tslib_1.__importDefault(require("lodash/flatten.js"));
|
|
9
9
|
const core_1 = require("@aws-amplify/core");
|
|
@@ -55,5 +55,4 @@ async function dispatchEvent(input) {
|
|
|
55
55
|
throw error;
|
|
56
56
|
}
|
|
57
57
|
}
|
|
58
|
-
exports.dispatchEvent = dispatchEvent;
|
|
59
58
|
//# sourceMappingURL=dispatchEvent.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dispatchEvent.js","sources":["../../../../../../src/inAppMessaging/providers/pinpoint/apis/dispatchEvent.ts"],"sourcesContent":["\"use strict\";\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.dispatchEvent =
|
|
1
|
+
{"version":3,"file":"dispatchEvent.js","sources":["../../../../../../src/inAppMessaging/providers/pinpoint/apis/dispatchEvent.ts"],"sourcesContent":["\"use strict\";\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.dispatchEvent = dispatchEvent;\nconst tslib_1 = require(\"tslib\");\nconst flatten_js_1 = tslib_1.__importDefault(require(\"lodash/flatten.js\"));\nconst core_1 = require(\"@aws-amplify/core\");\nconst eventListeners_1 = require(\"../../../../eventListeners\");\nconst errors_1 = require(\"../../../errors\");\nconst utils_1 = require(\"../../../utils\");\nconst utils_2 = require(\"../utils\");\n/**\n * Triggers an In-App message to be displayed. Use this after your campaigns have been synced to the device using\n * {@link syncMessages}. Based on the messages synced and the event passed to this API, it triggers the display\n * of the In-App message that meets the criteria.\n *\n * @remark\n * If an event would trigger multiple messages, the message closest to expiry will be chosen by default.\n * To change this behavior, you can use the {@link setConflictHandler} API to provide\n * your own logic for resolving message conflicts.\n *\n * @param input The input object that holds the event to be dispatched.\n *\n * @throws validation: {@link InAppMessagingValidationErrorCode} - Thrown when the provided parameters or library\n * configuration is incorrect, or if In App messaging hasn't been initialized.\n * @throws service exceptions - Thrown when the underlying Pinpoint service returns an error.\n *\n * @returns A promise that will resolve when the operation is complete.\n *\n * @example\n * ```ts\n * // Sync message before disptaching an event\n * await syncMessages();\n *\n * // Dispatch an event\n * await dispatchEvent({ name: 'test_event' });\n * ```\n */\nasync function dispatchEvent(input) {\n (0, utils_1.assertIsInitialized)();\n try {\n const key = `${utils_2.PINPOINT_KEY_PREFIX}${utils_2.STORAGE_KEY_SUFFIX}`;\n const cachedMessages = await core_1.defaultStorage.getItem(key);\n const messages = await (0, utils_2.processInAppMessages)(cachedMessages ? JSON.parse(cachedMessages) : [], input);\n const flattenedMessages = (0, flatten_js_1.default)(messages);\n if (flattenedMessages.length > 0) {\n const conflictHandler = (0, utils_2.getConflictHandler)();\n (0, eventListeners_1.notifyEventListeners)('messageReceived', conflictHandler(flattenedMessages));\n }\n }\n catch (error) {\n (0, errors_1.assertServiceError)(error);\n throw error;\n }\n}\n"],"names":[],"mappings":";;AACA;AACA;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;AAC7D,OAAO,CAAC,aAAa,GAAG,aAAa;AACrC,MAAM,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC;AAChC,MAAM,YAAY,GAAG,OAAO,CAAC,eAAe,CAAC,OAAO,CAAC,mBAAmB,CAAC,CAAC;AAC1E,MAAM,MAAM,GAAG,OAAO,CAAC,mBAAmB,CAAC;AAC3C,MAAM,gBAAgB,GAAG,OAAO,CAAC,4BAA4B,CAAC;AAC9D,MAAM,QAAQ,GAAG,OAAO,CAAC,iBAAiB,CAAC;AAC3C,MAAM,OAAO,GAAG,OAAO,CAAC,gBAAgB,CAAC;AACzC,MAAM,OAAO,GAAG,OAAO,CAAC,UAAU,CAAC;AACnC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,aAAa,CAAC,KAAK,EAAE;AACpC,IAAI,IAAI,OAAO,CAAC,mBAAmB,GAAG;AACtC,IAAI,IAAI;AACR,QAAQ,MAAM,GAAG,GAAG,CAAC,EAAE,OAAO,CAAC,mBAAmB,CAAC,EAAE,OAAO,CAAC,kBAAkB,CAAC,CAAC;AACjF,QAAQ,MAAM,cAAc,GAAG,MAAM,MAAM,CAAC,cAAc,CAAC,OAAO,CAAC,GAAG,CAAC;AACvE,QAAQ,MAAM,QAAQ,GAAG,MAAM,CAAC,CAAC,EAAE,OAAO,CAAC,oBAAoB,EAAE,cAAc,GAAG,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,GAAG,EAAE,EAAE,KAAK,CAAC;AACzH,QAAQ,MAAM,iBAAiB,GAAG,CAAC,CAAC,EAAE,YAAY,CAAC,OAAO,EAAE,QAAQ,CAAC;AACrE,QAAQ,IAAI,iBAAiB,CAAC,MAAM,GAAG,CAAC,EAAE;AAC1C,YAAY,MAAM,eAAe,GAAG,CAAC,CAAC,EAAE,OAAO,CAAC,kBAAkB,GAAG;AACrE,YAAY,CAAC,CAAC,EAAE,gBAAgB,CAAC,oBAAoB,EAAE,iBAAiB,EAAE,eAAe,CAAC,iBAAiB,CAAC,CAAC;AAC7G;AACA;AACA,IAAI,OAAO,KAAK,EAAE;AAClB,QAAQ,IAAI,QAAQ,CAAC,kBAAkB,EAAE,KAAK,CAAC;AAC/C,QAAQ,MAAM,KAAK;AACnB;AACA;;"}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
4
4
|
// SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.clearMessages = exports.notifyMessageInteraction = exports.onMessageActionTaken = exports.onMessageDisplayed = exports.onMessageDismissed = exports.onMessageReceived = exports.initializeInAppMessaging = exports.setConflictHandler = exports.
|
|
6
|
+
exports.clearMessages = exports.notifyMessageInteraction = exports.onMessageActionTaken = exports.onMessageDisplayed = exports.onMessageDismissed = exports.onMessageReceived = exports.initializeInAppMessaging = exports.setConflictHandler = exports.syncMessages = exports.identifyUser = void 0;
|
|
7
7
|
var identifyUser_1 = require("./identifyUser");
|
|
8
8
|
Object.defineProperty(exports, "identifyUser", { enumerable: true, get: function () { return identifyUser_1.identifyUser; } });
|
|
9
9
|
var syncMessages_1 = require("./syncMessages");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../../../../src/inAppMessaging/providers/pinpoint/apis/index.ts"],"sourcesContent":["\"use strict\";\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.clearMessages = exports.notifyMessageInteraction = exports.onMessageActionTaken = exports.onMessageDisplayed = exports.onMessageDismissed = exports.onMessageReceived = exports.initializeInAppMessaging = exports.setConflictHandler = exports.
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../../../src/inAppMessaging/providers/pinpoint/apis/index.ts"],"sourcesContent":["\"use strict\";\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.clearMessages = exports.notifyMessageInteraction = exports.onMessageActionTaken = exports.onMessageDisplayed = exports.onMessageDismissed = exports.onMessageReceived = exports.initializeInAppMessaging = exports.setConflictHandler = exports.syncMessages = exports.identifyUser = void 0;\nvar identifyUser_1 = require(\"./identifyUser\");\nObject.defineProperty(exports, \"identifyUser\", { enumerable: true, get: function () { return identifyUser_1.identifyUser; } });\nvar syncMessages_1 = require(\"./syncMessages\");\nObject.defineProperty(exports, \"syncMessages\", { enumerable: true, get: function () { return syncMessages_1.syncMessages; } });\nvar dispatchEvent_1 = require(\"./dispatchEvent\");\nObject.defineProperty(exports, \"dispatchEvent\", { enumerable: true, get: function () { return dispatchEvent_1.dispatchEvent; } });\nvar setConflictHandler_1 = require(\"./setConflictHandler\");\nObject.defineProperty(exports, \"setConflictHandler\", { enumerable: true, get: function () { return setConflictHandler_1.setConflictHandler; } });\nvar initializeInAppMessaging_1 = require(\"./initializeInAppMessaging\");\nObject.defineProperty(exports, \"initializeInAppMessaging\", { enumerable: true, get: function () { return initializeInAppMessaging_1.initializeInAppMessaging; } });\nvar onMessageReceived_1 = require(\"./onMessageReceived\");\nObject.defineProperty(exports, \"onMessageReceived\", { enumerable: true, get: function () { return onMessageReceived_1.onMessageReceived; } });\nvar onMessageDismissed_1 = require(\"./onMessageDismissed\");\nObject.defineProperty(exports, \"onMessageDismissed\", { enumerable: true, get: function () { return onMessageDismissed_1.onMessageDismissed; } });\nvar onMessageDisplayed_1 = require(\"./onMessageDisplayed\");\nObject.defineProperty(exports, \"onMessageDisplayed\", { enumerable: true, get: function () { return onMessageDisplayed_1.onMessageDisplayed; } });\nvar onMessageActionTaken_1 = require(\"./onMessageActionTaken\");\nObject.defineProperty(exports, \"onMessageActionTaken\", { enumerable: true, get: function () { return onMessageActionTaken_1.onMessageActionTaken; } });\nvar notifyMessageInteraction_1 = require(\"./notifyMessageInteraction\");\nObject.defineProperty(exports, \"notifyMessageInteraction\", { enumerable: true, get: function () { return notifyMessageInteraction_1.notifyMessageInteraction; } });\nvar clearMessages_1 = require(\"./clearMessages\");\nObject.defineProperty(exports, \"clearMessages\", { enumerable: true, get: function () { return clearMessages_1.clearMessages; } });\n"],"names":[],"mappings":";;AACA;AACA;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;AAC7D,OAAO,CAAC,aAAa,GAAG,OAAO,CAAC,wBAAwB,GAAG,OAAO,CAAC,oBAAoB,GAAG,OAAO,CAAC,kBAAkB,GAAG,OAAO,CAAC,kBAAkB,GAAG,OAAO,CAAC,iBAAiB,GAAG,OAAO,CAAC,wBAAwB,GAAG,OAAO,CAAC,kBAAkB,GAAG,OAAO,CAAC,YAAY,GAAG,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ights Reserved.
|
|
4
4
|
// SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.initializeInAppMessaging =
|
|
6
|
+
exports.initializeInAppMessaging = initializeInAppMessaging;
|
|
7
7
|
const utils_1 = require("@aws-amplify/core/internals/utils");
|
|
8
8
|
const core_1 = require("@aws-amplify/core");
|
|
9
9
|
const eventListeners_1 = require("../../../../eventListeners");
|
|
@@ -44,7 +44,6 @@ function initializeInAppMessaging() {
|
|
|
44
44
|
core_1.Hub.listen('analytics', analyticsListener);
|
|
45
45
|
(0, utils_3.initialize)();
|
|
46
46
|
}
|
|
47
|
-
exports.initializeInAppMessaging = initializeInAppMessaging;
|
|
48
47
|
function analyticsListener({ payload, }) {
|
|
49
48
|
const { event, data } = payload;
|
|
50
49
|
switch (event) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"initializeInAppMessaging.js","sources":["../../../../../../src/inAppMessaging/providers/pinpoint/apis/initializeInAppMessaging.ts"],"sourcesContent":["\"use strict\";\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.initializeInAppMessaging =
|
|
1
|
+
{"version":3,"file":"initializeInAppMessaging.js","sources":["../../../../../../src/inAppMessaging/providers/pinpoint/apis/initializeInAppMessaging.ts"],"sourcesContent":["\"use strict\";\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.initializeInAppMessaging = initializeInAppMessaging;\nconst utils_1 = require(\"@aws-amplify/core/internals/utils\");\nconst core_1 = require(\"@aws-amplify/core\");\nconst eventListeners_1 = require(\"../../../../eventListeners\");\nconst helpers_1 = require(\"../utils/helpers\");\nconst types_1 = require(\"../types\");\nconst utils_2 = require(\"../utils\");\nconst utils_3 = require(\"../../../utils\");\nconst dispatchEvent_1 = require(\"./dispatchEvent\");\n/**\n * Initialize and set up in-app messaging category. This API needs to be called to enable other InAppMessaging APIs.\n *\n * @remarks\n * Make sure to call this early in your app at the root entry point after configuring Amplify.\n * @example\n * ```ts\n * Amplify.configure(config);\n * initializeInAppMessaging();\n * ```\n */\nfunction initializeInAppMessaging() {\n if ((0, utils_3.isInitialized)()) {\n return;\n }\n // register with the session listener\n utils_1.sessionListener.addStateChangeListener(utils_2.sessionStateChangeHandler, true);\n // wire up default Pinpoint message event handling\n (0, eventListeners_1.addEventListener)('messageDisplayed', (message) => {\n (0, helpers_1.recordAnalyticsEvent)(types_1.PinpointMessageEvent.MESSAGE_DISPLAYED, message);\n (0, utils_2.incrementMessageCounts)(message.id);\n });\n (0, eventListeners_1.addEventListener)('messageDismissed', (message) => {\n (0, helpers_1.recordAnalyticsEvent)(types_1.PinpointMessageEvent.MESSAGE_DISMISSED, message);\n });\n (0, eventListeners_1.addEventListener)('messageActionTaken', (message) => {\n (0, helpers_1.recordAnalyticsEvent)(types_1.PinpointMessageEvent.MESSAGE_ACTION_TAKEN, message);\n });\n // listen to analytics hub events\n core_1.Hub.listen('analytics', analyticsListener);\n (0, utils_3.initialize)();\n}\nfunction analyticsListener({ payload, }) {\n const { event, data } = payload;\n switch (event) {\n case 'record': {\n (0, dispatchEvent_1.dispatchEvent)(data);\n break;\n }\n default:\n break;\n }\n}\n"],"names":[],"mappings":";;AACA;AACA;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;AAC7D,OAAO,CAAC,wBAAwB,GAAG,wBAAwB;AAC3D,MAAM,OAAO,GAAG,OAAO,CAAC,mCAAmC,CAAC;AAC5D,MAAM,MAAM,GAAG,OAAO,CAAC,mBAAmB,CAAC;AAC3C,MAAM,gBAAgB,GAAG,OAAO,CAAC,4BAA4B,CAAC;AAC9D,MAAM,SAAS,GAAG,OAAO,CAAC,kBAAkB,CAAC;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7B;AACA,SAAS,iBAAiB,CAAC,EAAE,OAAO,GAAG,EAAE;AACzC,IAAI,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,GAAG,OAAO;AACnC,IAAI,QAAQ,KAAK;AACjB,QAAQ,KAAK,QAAQ,EAAE;AACvB,YAAY,IAAI,eAAe,CAAC,aAAa,EAAE,IAAI,CAAC;AACpD,YAAY;AACZ;AAGA;AACA;;"}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
4
4
|
// SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.notifyMessageInteraction =
|
|
6
|
+
exports.notifyMessageInteraction = notifyMessageInteraction;
|
|
7
7
|
const eventListeners_1 = require("../../../../eventListeners");
|
|
8
8
|
const utils_1 = require("../../../utils");
|
|
9
9
|
/**
|
|
@@ -24,5 +24,4 @@ function notifyMessageInteraction({ type, message, }) {
|
|
|
24
24
|
(0, utils_1.assertIsInitialized)();
|
|
25
25
|
(0, eventListeners_1.notifyEventListeners)(type, message);
|
|
26
26
|
}
|
|
27
|
-
exports.notifyMessageInteraction = notifyMessageInteraction;
|
|
28
27
|
//# sourceMappingURL=notifyMessageInteraction.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"notifyMessageInteraction.js","sources":["../../../../../../src/inAppMessaging/providers/pinpoint/apis/notifyMessageInteraction.ts"],"sourcesContent":["\"use strict\";\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.notifyMessageInteraction =
|
|
1
|
+
{"version":3,"file":"notifyMessageInteraction.js","sources":["../../../../../../src/inAppMessaging/providers/pinpoint/apis/notifyMessageInteraction.ts"],"sourcesContent":["\"use strict\";\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.notifyMessageInteraction = notifyMessageInteraction;\nconst eventListeners_1 = require(\"../../../../eventListeners\");\nconst utils_1 = require(\"../../../utils\");\n/**\n * Notifies the respective listener of the specified type with the message given.\n *\n * @param {NotifyMessageInteractionInput} input - The input object that holds the type and message.\n * @throws validation: {@link InAppMessagingValidationErrorCode} - Thrown when the provided parameters or library\n * configuration is incorrect, or if In App messaging hasn't been initialized.\n * @example\n * ```ts\n * onMessageRecieved((message) => {\n * // Show end users the In-App message and notify event listeners\n * notifyMessageInteraction({ type: 'messageDisplayed', message });\n * });\n * ```\n */\nfunction notifyMessageInteraction({ type, message, }) {\n (0, utils_1.assertIsInitialized)();\n (0, eventListeners_1.notifyEventListeners)(type, message);\n}\n"],"names":[],"mappings":";;AACA;AACA;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;AAC7D,OAAO,CAAC,wBAAwB,GAAG,wBAAwB;AAC3D,MAAM,gBAAgB,GAAG,OAAO,CAAC,4BAA4B,CAAC;AAC9D,MAAM,OAAO,GAAG,OAAO,CAAC,gBAAgB,CAAC;AACzC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS,wBAAwB,CAAC,EAAE,IAAI,EAAE,OAAO,GAAG,EAAE;AACtD,IAAI,IAAI,OAAO,CAAC,mBAAmB,GAAG;AACtC,IAAI,IAAI,gBAAgB,CAAC,oBAAoB,EAAE,IAAI,EAAE,OAAO,CAAC;AAC7D;;"}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
4
4
|
// SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.onMessageActionTaken =
|
|
6
|
+
exports.onMessageActionTaken = onMessageActionTaken;
|
|
7
7
|
const eventListeners_1 = require("../../../../eventListeners");
|
|
8
8
|
const utils_1 = require("../../../utils");
|
|
9
9
|
/**
|
|
@@ -25,5 +25,4 @@ function onMessageActionTaken(input) {
|
|
|
25
25
|
(0, utils_1.assertIsInitialized)();
|
|
26
26
|
return (0, eventListeners_1.addEventListener)('messageActionTaken', input);
|
|
27
27
|
}
|
|
28
|
-
exports.onMessageActionTaken = onMessageActionTaken;
|
|
29
28
|
//# sourceMappingURL=onMessageActionTaken.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"onMessageActionTaken.js","sources":["../../../../../../src/inAppMessaging/providers/pinpoint/apis/onMessageActionTaken.ts"],"sourcesContent":["\"use strict\";\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.onMessageActionTaken =
|
|
1
|
+
{"version":3,"file":"onMessageActionTaken.js","sources":["../../../../../../src/inAppMessaging/providers/pinpoint/apis/onMessageActionTaken.ts"],"sourcesContent":["\"use strict\";\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.onMessageActionTaken = onMessageActionTaken;\nconst eventListeners_1 = require(\"../../../../eventListeners\");\nconst utils_1 = require(\"../../../utils\");\n/**\n * Registers a callback that will be invoked on `messageActionTaken` events.\n *\n * @param {OnMessageActionTakenInput} input - The input object that holds the callback handler.\n * @throws validation: {@link InAppMessagingValidationErrorCode} - Thrown when the provided parameters or library\n * configuration is incorrect, or if In App messaging hasn't been initialized.\n * @returns {OnMessageActionTakenOutput} - An object that holds a remove method to stop listening to events.\n * @example\n * ```ts\n * onMessageActionTaken((message) => {\n * // use the message\n * console.log(message.id);\n * });\n * ```\n */\nfunction onMessageActionTaken(input) {\n (0, utils_1.assertIsInitialized)();\n return (0, eventListeners_1.addEventListener)('messageActionTaken', input);\n}\n"],"names":[],"mappings":";;AACA;AACA;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;AAC7D,OAAO,CAAC,oBAAoB,GAAG,oBAAoB;AACnD,MAAM,gBAAgB,GAAG,OAAO,CAAC,4BAA4B,CAAC;AAC9D,MAAM,OAAO,GAAG,OAAO,CAAC,gBAAgB,CAAC;AACzC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS,oBAAoB,CAAC,KAAK,EAAE;AACrC,IAAI,IAAI,OAAO,CAAC,mBAAmB,GAAG;AACtC,IAAI,OAAO,IAAI,gBAAgB,CAAC,gBAAgB,EAAE,oBAAoB,EAAE,KAAK,CAAC;AAC9E;;"}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
4
4
|
// SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.onMessageDismissed =
|
|
6
|
+
exports.onMessageDismissed = onMessageDismissed;
|
|
7
7
|
const eventListeners_1 = require("../../../../eventListeners");
|
|
8
8
|
const utils_1 = require("../../../utils");
|
|
9
9
|
/**
|
|
@@ -25,5 +25,4 @@ function onMessageDismissed(input) {
|
|
|
25
25
|
(0, utils_1.assertIsInitialized)();
|
|
26
26
|
return (0, eventListeners_1.addEventListener)('messageDismissed', input);
|
|
27
27
|
}
|
|
28
|
-
exports.onMessageDismissed = onMessageDismissed;
|
|
29
28
|
//# sourceMappingURL=onMessageDismissed.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"onMessageDismissed.js","sources":["../../../../../../src/inAppMessaging/providers/pinpoint/apis/onMessageDismissed.ts"],"sourcesContent":["\"use strict\";\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.onMessageDismissed =
|
|
1
|
+
{"version":3,"file":"onMessageDismissed.js","sources":["../../../../../../src/inAppMessaging/providers/pinpoint/apis/onMessageDismissed.ts"],"sourcesContent":["\"use strict\";\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.onMessageDismissed = onMessageDismissed;\nconst eventListeners_1 = require(\"../../../../eventListeners\");\nconst utils_1 = require(\"../../../utils\");\n/**\n * Registers a callback that will be invoked on `messageDismissed` events.\n *\n * @param {OnMessageDismissedInput} input - The input object that holds the callback handler.\n * @throws validation: {@link InAppMessagingValidationErrorCode} - Thrown when the provided parameters or library\n * configuration is incorrect, or if In App messaging hasn't been initialized.\n * @returns {OnMessageDismissedOutput} - An object that holds a remove method to stop listening to events.\n * @example\n * ```ts\n * onMessageDismissed((message) => {\n * // use the message\n * console.log(message.id);\n * });\n * ```\n */\nfunction onMessageDismissed(input) {\n (0, utils_1.assertIsInitialized)();\n return (0, eventListeners_1.addEventListener)('messageDismissed', input);\n}\n"],"names":[],"mappings":";;AACA;AACA;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;AAC7D,OAAO,CAAC,kBAAkB,GAAG,kBAAkB;AAC/C,MAAM,gBAAgB,GAAG,OAAO,CAAC,4BAA4B,CAAC;AAC9D,MAAM,OAAO,GAAG,OAAO,CAAC,gBAAgB,CAAC;AACzC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS,kBAAkB,CAAC,KAAK,EAAE;AACnC,IAAI,IAAI,OAAO,CAAC,mBAAmB,GAAG;AACtC,IAAI,OAAO,IAAI,gBAAgB,CAAC,gBAAgB,EAAE,kBAAkB,EAAE,KAAK,CAAC;AAC5E;;"}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
4
4
|
// SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.onMessageDisplayed =
|
|
6
|
+
exports.onMessageDisplayed = onMessageDisplayed;
|
|
7
7
|
const eventListeners_1 = require("../../../../eventListeners");
|
|
8
8
|
const utils_1 = require("../../../utils");
|
|
9
9
|
/**
|
|
@@ -25,5 +25,4 @@ function onMessageDisplayed(input) {
|
|
|
25
25
|
(0, utils_1.assertIsInitialized)();
|
|
26
26
|
return (0, eventListeners_1.addEventListener)('messageDisplayed', input);
|
|
27
27
|
}
|
|
28
|
-
exports.onMessageDisplayed = onMessageDisplayed;
|
|
29
28
|
//# sourceMappingURL=onMessageDisplayed.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"onMessageDisplayed.js","sources":["../../../../../../src/inAppMessaging/providers/pinpoint/apis/onMessageDisplayed.ts"],"sourcesContent":["\"use strict\";\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.onMessageDisplayed =
|
|
1
|
+
{"version":3,"file":"onMessageDisplayed.js","sources":["../../../../../../src/inAppMessaging/providers/pinpoint/apis/onMessageDisplayed.ts"],"sourcesContent":["\"use strict\";\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.onMessageDisplayed = onMessageDisplayed;\nconst eventListeners_1 = require(\"../../../../eventListeners\");\nconst utils_1 = require(\"../../../utils\");\n/**\n * Registers a callback that will be invoked on `messageDisplayed` events.\n *\n * @param {OnMessageDisplayedInput} input - The input object that holds the callback handler.\n * @throws validation: {@link InAppMessagingValidationErrorCode} - Thrown when the provided parameters or library\n * configuration is incorrect, or if In App messaging hasn't been initialized.\n * @returns {OnMessageDisplayedOutput} - An object that holds a remove method to stop listening to events.\n * @example\n * ```ts\n * onMessageDisplayed((message) => {\n * // use the message\n * \t console.log(message.id);\n * });\n * ```\n */\nfunction onMessageDisplayed(input) {\n (0, utils_1.assertIsInitialized)();\n return (0, eventListeners_1.addEventListener)('messageDisplayed', input);\n}\n"],"names":[],"mappings":";;AACA;AACA;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;AAC7D,OAAO,CAAC,kBAAkB,GAAG,kBAAkB;AAC/C,MAAM,gBAAgB,GAAG,OAAO,CAAC,4BAA4B,CAAC;AAC9D,MAAM,OAAO,GAAG,OAAO,CAAC,gBAAgB,CAAC;AACzC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS,kBAAkB,CAAC,KAAK,EAAE;AACnC,IAAI,IAAI,OAAO,CAAC,mBAAmB,GAAG;AACtC,IAAI,OAAO,IAAI,gBAAgB,CAAC,gBAAgB,EAAE,kBAAkB,EAAE,KAAK,CAAC;AAC5E;;"}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
4
4
|
// SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.onMessageReceived =
|
|
6
|
+
exports.onMessageReceived = onMessageReceived;
|
|
7
7
|
const eventListeners_1 = require("../../../../eventListeners");
|
|
8
8
|
const utils_1 = require("../../../utils");
|
|
9
9
|
/**
|
|
@@ -25,5 +25,4 @@ function onMessageReceived(input) {
|
|
|
25
25
|
(0, utils_1.assertIsInitialized)();
|
|
26
26
|
return (0, eventListeners_1.addEventListener)('messageReceived', input);
|
|
27
27
|
}
|
|
28
|
-
exports.onMessageReceived = onMessageReceived;
|
|
29
28
|
//# sourceMappingURL=onMessageReceived.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"onMessageReceived.js","sources":["../../../../../../src/inAppMessaging/providers/pinpoint/apis/onMessageReceived.ts"],"sourcesContent":["\"use strict\";\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.onMessageReceived =
|
|
1
|
+
{"version":3,"file":"onMessageReceived.js","sources":["../../../../../../src/inAppMessaging/providers/pinpoint/apis/onMessageReceived.ts"],"sourcesContent":["\"use strict\";\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.onMessageReceived = onMessageReceived;\nconst eventListeners_1 = require(\"../../../../eventListeners\");\nconst utils_1 = require(\"../../../utils\");\n/**\n * Registers a callback that will be invoked on `messageReceived` events.\n *\n * @param {OnMessageReceivedInput} input - The input object that holds the callback handler.\n * @throws validation: {@link InAppMessagingValidationErrorCode} - Thrown when the provided parameters or library\n * configuration is incorrect, or if In App messaging hasn't been initialized.\n * @returns {OnMessageReceivedOutput} - An object that holds a remove method to stop listening to events.\n * @example\n * ```ts\n * onMessageReceived((message) => {\n * // use the message\n * console.log(message.id);\n * });\n * ```\n */\nfunction onMessageReceived(input) {\n (0, utils_1.assertIsInitialized)();\n return (0, eventListeners_1.addEventListener)('messageReceived', input);\n}\n"],"names":[],"mappings":";;AACA;AACA;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;AAC7D,OAAO,CAAC,iBAAiB,GAAG,iBAAiB;AAC7C,MAAM,gBAAgB,GAAG,OAAO,CAAC,4BAA4B,CAAC;AAC9D,MAAM,OAAO,GAAG,OAAO,CAAC,gBAAgB,CAAC;AACzC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS,iBAAiB,CAAC,KAAK,EAAE;AAClC,IAAI,IAAI,OAAO,CAAC,mBAAmB,GAAG;AACtC,IAAI,OAAO,IAAI,gBAAgB,CAAC,gBAAgB,EAAE,iBAAiB,EAAE,KAAK,CAAC;AAC3E;;"}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
4
4
|
// SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.setConflictHandler =
|
|
6
|
+
exports.setConflictHandler = setConflictHandler;
|
|
7
7
|
const utils_1 = require("../../../utils");
|
|
8
8
|
const utils_2 = require("../utils");
|
|
9
9
|
/**
|
|
@@ -42,5 +42,4 @@ function setConflictHandler(input) {
|
|
|
42
42
|
(0, utils_1.assertIsInitialized)();
|
|
43
43
|
(0, utils_2.setConflictHandler)(input);
|
|
44
44
|
}
|
|
45
|
-
exports.setConflictHandler = setConflictHandler;
|
|
46
45
|
//# sourceMappingURL=setConflictHandler.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"setConflictHandler.js","sources":["../../../../../../src/inAppMessaging/providers/pinpoint/apis/setConflictHandler.ts"],"sourcesContent":["\"use strict\";\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.setConflictHandler =
|
|
1
|
+
{"version":3,"file":"setConflictHandler.js","sources":["../../../../../../src/inAppMessaging/providers/pinpoint/apis/setConflictHandler.ts"],"sourcesContent":["\"use strict\";\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.setConflictHandler = setConflictHandler;\nconst utils_1 = require(\"../../../utils\");\nconst utils_2 = require(\"../utils\");\n/**\n * Set a conflict handler that will be used to resolve conflicts that may emerge\n * when matching events with synced messages.\n *\n * @remark\n * The conflict handler is not persisted across app restarts and so must be set again before dispatching an event for\n * any custom handling to take effect.\n *\n * @throws validation: {@link InAppMessagingValidationErrorCode} - Thrown when the provided parameters or library\n * configuration is incorrect, or if In App messaging hasn't been initialized.\n *\n * @param input The input object that holds the conflict handler to be used.\n *\n * @example\n * ```ts\n * // Sync messages before dispatching an event\n * await syncMessages();\n *\n * // Example custom conflict handler\n * const myConflictHandler = (messages) => {\n * \t\t// Return a random message\n * \t\tconst randomIndex = Math.floor(Math.random() * messages.length);\n * \t\treturn messages[randomIndex];\n * };\n *\n * // Set the conflict handler\n * setConflictHandler(myConflictHandler);\n *\n * // Dispatch an event\n * await dispatchEvent({ name: 'test_event' });\n * ```\n */\nfunction setConflictHandler(input) {\n (0, utils_1.assertIsInitialized)();\n (0, utils_2.setConflictHandler)(input);\n}\n"],"names":[],"mappings":";;AACA;AACA;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;AAC7D,OAAO,CAAC,kBAAkB,GAAG,kBAAkB;AAC/C,MAAM,OAAO,GAAG,OAAO,CAAC,gBAAgB,CAAC;AACzC,MAAM,OAAO,GAAG,OAAO,CAAC,UAAU,CAAC;AACnC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS,kBAAkB,CAAC,KAAK,EAAE;AACnC,IAAI,IAAI,OAAO,CAAC,mBAAmB,GAAG;AACtC,IAAI,IAAI,OAAO,CAAC,kBAAkB,EAAE,KAAK,CAAC;AAC1C;;"}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
4
4
|
// SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.syncMessages =
|
|
6
|
+
exports.syncMessages = syncMessages;
|
|
7
7
|
const utils_1 = require("@aws-amplify/core/internals/utils");
|
|
8
8
|
const pinpoint_1 = require("@aws-amplify/core/internals/providers/pinpoint");
|
|
9
9
|
const core_1 = require("@aws-amplify/core");
|
|
@@ -41,7 +41,6 @@ async function syncMessages() {
|
|
|
41
41
|
throw error;
|
|
42
42
|
}
|
|
43
43
|
}
|
|
44
|
-
exports.syncMessages = syncMessages;
|
|
45
44
|
async function fetchInAppMessages() {
|
|
46
45
|
try {
|
|
47
46
|
const { credentials, identityId } = await (0, utils_2.resolveCredentials)();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"syncMessages.js","sources":["../../../../../../src/inAppMessaging/providers/pinpoint/apis/syncMessages.ts"],"sourcesContent":["\"use strict\";\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.syncMessages =
|
|
1
|
+
{"version":3,"file":"syncMessages.js","sources":["../../../../../../src/inAppMessaging/providers/pinpoint/apis/syncMessages.ts"],"sourcesContent":["\"use strict\";\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.syncMessages = syncMessages;\nconst utils_1 = require(\"@aws-amplify/core/internals/utils\");\nconst pinpoint_1 = require(\"@aws-amplify/core/internals/providers/pinpoint\");\nconst core_1 = require(\"@aws-amplify/core\");\nconst pinpoint_2 = require(\"@aws-amplify/core/internals/aws-clients/pinpoint\");\nconst utils_2 = require(\"../utils\");\nconst errors_1 = require(\"../../../errors\");\nconst utils_3 = require(\"../../../utils\");\n/**\n * Fetch and persist messages from Pinpoint campaigns.\n * Calling this API is necessary to trigger InApp messages on the device.\n *\n * @throws service exceptions - Thrown when the underlying Pinpoint service returns an error.\n * @throws validation: {@link InAppMessagingValidationErrorCode} - Thrown when the provided parameters or library\n * configuration is incorrect, or if In App messaging hasn't been initialized.\n * @returns A promise that will resolve when the operation is complete.\n * @example\n * ```ts\n * // Sync InApp messages with Pinpoint and device.\n * await syncMessages();\n *\n * ```\n */\nasync function syncMessages() {\n (0, utils_3.assertIsInitialized)();\n const messages = await fetchInAppMessages();\n if (!messages || messages.length === 0) {\n return;\n }\n try {\n const key = `${utils_2.PINPOINT_KEY_PREFIX}${utils_2.STORAGE_KEY_SUFFIX}`;\n await core_1.defaultStorage.setItem(key, JSON.stringify(messages));\n }\n catch (error) {\n (0, errors_1.assertServiceError)(error);\n throw error;\n }\n}\nasync function fetchInAppMessages() {\n try {\n const { credentials, identityId } = await (0, utils_2.resolveCredentials)();\n const { appId, region } = (0, utils_2.resolveConfig)();\n const endpointId = await (0, pinpoint_1.resolveEndpointId)({\n appId,\n category: utils_2.CATEGORY,\n channelType: utils_2.CHANNEL_TYPE,\n credentials,\n identityId,\n region,\n userAgentValue: (0, utils_2.getInAppMessagingUserAgentString)(utils_1.InAppMessagingAction.SyncMessages),\n });\n const input = {\n ApplicationId: appId,\n EndpointId: endpointId,\n };\n const response = await (0, pinpoint_2.getInAppMessages)({ credentials, region }, input);\n const { InAppMessageCampaigns: messages } = response.InAppMessagesResponse ?? {};\n return messages;\n }\n catch (error) {\n (0, errors_1.assertServiceError)(error);\n throw error;\n }\n}\n"],"names":[],"mappings":";;AACA;AACA;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;AAC7D,OAAO,CAAC,YAAY,GAAG,YAAY;AACnC,MAAM,OAAO,GAAG,OAAO,CAAC,mCAAmC,CAAC;AAC5D,MAAM,UAAU,GAAG,OAAO,CAAC,gDAAgD,CAAC;AAC5E,MAAM,MAAM,GAAG,OAAO,CAAC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Y,QAAQ,EAAE,OAAO,CAAC,QAAQ;AACtC,YAAY,WAAW,EAAE,OAAO,CAAC,YAAY;AAC7C,YAAY,WAAW;AACvB,YAAY,UAAU;AACtB,YAAY,MAAM;AAClB,YAAY,cAAc,EAAE,CAAC,CAAC,EAAE,OAAO,CAAC,gCAAgC,EAAE,OAAO,CAAC,oBAAoB,CAAC,YAAY,CAAC;AACpH,SAAS,CAAC;AACV,QAAQ,MAAM,KAAK,GAAG;AACtB,YAAY,aAAa,EAAE,KAAK;AAChC,YAAY,UAAU,EAAE,UAAU;AAClC,SAAS;AACT,QAAQ,MAAM,QAAQ,GAAG,MAAM,CAAC,CAAC,EAAE,UAAU,CAAC,gBAAgB,EAAE,EAAE,WAAW,EAAE,MAAM,EAAE,EAAE,KAAK,CAAC;AAC/F,QAAQ,MAAM,EAAE,qBAAqB,EAAE,QAAQ,EAAE,GAAG,QAAQ,CAAC,qBAAqB,IAAI,EAAE;AACxF,QAAQ,OAAO,QAAQ;AACvB;AACA,IAAI,OAAO,KAAK,EAAE;AAClB,QAAQ,IAAI,QAAQ,CAAC,kBAAkB,EAAE,KAAK,CAAC;AAC/C,QAAQ,MAAM,KAAK;AACnB;AACA;;"}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
4
4
|
// SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.clearMessages = exports.notifyMessageInteraction = exports.onMessageActionTaken = exports.onMessageDismissed = exports.onMessageDisplayed = exports.onMessageReceived = exports.initializeInAppMessaging = exports.setConflictHandler = exports.
|
|
6
|
+
exports.clearMessages = exports.notifyMessageInteraction = exports.onMessageActionTaken = exports.onMessageDismissed = exports.onMessageDisplayed = exports.onMessageReceived = exports.initializeInAppMessaging = exports.setConflictHandler = exports.syncMessages = exports.identifyUser = void 0;
|
|
7
7
|
var apis_1 = require("./apis");
|
|
8
8
|
Object.defineProperty(exports, "identifyUser", { enumerable: true, get: function () { return apis_1.identifyUser; } });
|
|
9
9
|
Object.defineProperty(exports, "syncMessages", { enumerable: true, get: function () { return apis_1.syncMessages; } });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../../../src/inAppMessaging/providers/pinpoint/index.ts"],"sourcesContent":["\"use strict\";\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.clearMessages = exports.notifyMessageInteraction = exports.onMessageActionTaken = exports.onMessageDismissed = exports.onMessageDisplayed = exports.onMessageReceived = exports.initializeInAppMessaging = exports.setConflictHandler = exports.
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../../src/inAppMessaging/providers/pinpoint/index.ts"],"sourcesContent":["\"use strict\";\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.clearMessages = exports.notifyMessageInteraction = exports.onMessageActionTaken = exports.onMessageDismissed = exports.onMessageDisplayed = exports.onMessageReceived = exports.initializeInAppMessaging = exports.setConflictHandler = exports.syncMessages = exports.identifyUser = void 0;\nvar apis_1 = require(\"./apis\");\nObject.defineProperty(exports, \"identifyUser\", { enumerable: true, get: function () { return apis_1.identifyUser; } });\nObject.defineProperty(exports, \"syncMessages\", { enumerable: true, get: function () { return apis_1.syncMessages; } });\nObject.defineProperty(exports, \"dispatchEvent\", { enumerable: true, get: function () { return apis_1.dispatchEvent; } });\nObject.defineProperty(exports, \"setConflictHandler\", { enumerable: true, get: function () { return apis_1.setConflictHandler; } });\nObject.defineProperty(exports, \"initializeInAppMessaging\", { enumerable: true, get: function () { return apis_1.initializeInAppMessaging; } });\nObject.defineProperty(exports, \"onMessageReceived\", { enumerable: true, get: function () { return apis_1.onMessageReceived; } });\nObject.defineProperty(exports, \"onMessageDisplayed\", { enumerable: true, get: function () { return apis_1.onMessageDisplayed; } });\nObject.defineProperty(exports, \"onMessageDismissed\", { enumerable: true, get: function () { return apis_1.onMessageDismissed; } });\nObject.defineProperty(exports, \"onMessageActionTaken\", { enumerable: true, get: function () { return apis_1.onMessageActionTaken; } });\nObject.defineProperty(exports, \"notifyMessageInteraction\", { enumerable: true, get: function () { return apis_1.notifyMessageInteraction; } });\nObject.defineProperty(exports, \"clearMessages\", { enumerable: true, get: function () { return apis_1.clearMessages; } });\n"],"names":[],"mappings":";;AACA;AACA;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;AAC7D,OAAO,CAAC,aAAa,GAAG,OAAO,CAAC,wBAAwB,GAAG,OAAO,CAAC,oBAAoB,GAAG,OAAO,CAAC,kBAAkB,GAAG,OAAO,CAAC,kBAAkB,GAAG,OAAO,CAAC,iBAAiB,GAAG,OAAO,CAAC,wBAAwB,GAAG,OAAO,CAAC,kBAAkB,GAAG,OAAO,CAAC,YAAY,GAAG,OAAO,CAAC,YAAY,GAAG,MAAM;AACpS,IAAI,MAAM,GAAG,OAAO,CAAC,QAAQ,CAAC;AAC9B,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,cAAc,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,EAAE,YAAY,EAAE,OAAO,MAAM,CAAC,YAAY,CAAC,EAAE,EAAE,CAAC;AACtH,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,cAAc,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,EAAE,YAAY,EAAE,OAAO,MAAM,CAAC,YAAY,CAAC,EAAE,EAAE,CAAC;AACtH,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,eAAe,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,EAAE,YAAY,EAAE,OAAO,MAAM,CAAC,aAAa,CAAC,EAAE,EAAE,CAAC;AACxH,MAAM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O,MAAM,CAAC,aAAa,CAAC,EAAE,EAAE,CAAC;;"}
|
|
@@ -4,9 +4,10 @@
|
|
|
4
4
|
// SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.PinpointMessageEvent = void 0;
|
|
7
|
+
var PinpointMessageEvent;
|
|
7
8
|
(function (PinpointMessageEvent) {
|
|
8
9
|
PinpointMessageEvent["MESSAGE_DISPLAYED"] = "_inapp.message_displayed";
|
|
9
10
|
PinpointMessageEvent["MESSAGE_DISMISSED"] = "_inapp.message_dismissed";
|
|
10
11
|
PinpointMessageEvent["MESSAGE_ACTION_TAKEN"] = "_inapp.message_clicked";
|
|
11
|
-
})(
|
|
12
|
+
})(PinpointMessageEvent || (exports.PinpointMessageEvent = PinpointMessageEvent = {}));
|
|
12
13
|
//# sourceMappingURL=types.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sources":["../../../../../../src/inAppMessaging/providers/pinpoint/types/types.ts"],"sourcesContent":["\"use strict\";\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.PinpointMessageEvent = void 0;\nvar PinpointMessageEvent;\n(function (PinpointMessageEvent) {\n PinpointMessageEvent[\"MESSAGE_DISPLAYED\"] = \"_inapp.message_displayed\";\n PinpointMessageEvent[\"MESSAGE_DISMISSED\"] = \"_inapp.message_dismissed\";\n PinpointMessageEvent[\"MESSAGE_ACTION_TAKEN\"] = \"_inapp.message_clicked\";\n})(PinpointMessageEvent
|
|
1
|
+
{"version":3,"file":"types.js","sources":["../../../../../../src/inAppMessaging/providers/pinpoint/types/types.ts"],"sourcesContent":["\"use strict\";\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.PinpointMessageEvent = void 0;\nvar PinpointMessageEvent;\n(function (PinpointMessageEvent) {\n PinpointMessageEvent[\"MESSAGE_DISPLAYED\"] = \"_inapp.message_displayed\";\n PinpointMessageEvent[\"MESSAGE_DISMISSED\"] = \"_inapp.message_dismissed\";\n PinpointMessageEvent[\"MESSAGE_ACTION_TAKEN\"] = \"_inapp.message_clicked\";\n})(PinpointMessageEvent || (exports.PinpointMessageEvent = PinpointMessageEvent = {}));\n"],"names":[],"mappings":";;AACA;AACA;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;AAC7D,OAAO,CAAC,oBAAoB,GAAG,MAAM;AACrC,IAAI,oBAAoB;AACxB,CAAC,UAAU,oBAAoB,EAAE;AACjC,IAAI,oBAAoB,CAAC,mBAAmB,CAAC,GAAG,0BAA0B;AAC1E,IAAI,oBAAoB,CAAC,mBAAmB,CAAC,GAAG,0BAA0B;AAC1E,IAAI,oBAAoB,CAAC,sBAAsB,CAAC,GAAG,wBAAwB;AAC3E,CAAC,EAAE,oBAAoB,KAAK,OAAO,CAAC,oBAAoB,GAAG,oBAAoB,GAAG,EAAE,CAAC,CAAC;;"}
|
|
@@ -3,7 +3,9 @@
|
|
|
3
3
|
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
4
4
|
// SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.
|
|
6
|
+
exports.processInAppMessages = processInAppMessages;
|
|
7
|
+
exports.sessionStateChangeHandler = sessionStateChangeHandler;
|
|
8
|
+
exports.incrementMessageCounts = incrementMessageCounts;
|
|
7
9
|
const core_1 = require("@aws-amplify/core");
|
|
8
10
|
const helpers_1 = require("./helpers");
|
|
9
11
|
const MESSAGE_DAILY_COUNT_KEY = 'pinpointProvider_inAppMessages_dailyCount';
|
|
@@ -49,21 +51,18 @@ async function processInAppMessages(messages, event) {
|
|
|
49
51
|
}
|
|
50
52
|
return normalizeMessages(acc);
|
|
51
53
|
}
|
|
52
|
-
exports.processInAppMessages = processInAppMessages;
|
|
53
54
|
function sessionStateChangeHandler(state) {
|
|
54
55
|
if (state === 'started') {
|
|
55
56
|
// reset all session counts
|
|
56
57
|
sessionMessageCountMap = {};
|
|
57
58
|
}
|
|
58
59
|
}
|
|
59
|
-
exports.sessionStateChangeHandler = sessionStateChangeHandler;
|
|
60
60
|
async function incrementMessageCounts(messageId) {
|
|
61
61
|
const { sessionCount, dailyCount, totalCount } = await getMessageCounts(messageId);
|
|
62
62
|
setSessionCount(messageId, sessionCount + 1);
|
|
63
63
|
setDailyCount(dailyCount + 1);
|
|
64
64
|
await setTotalCount(messageId, totalCount + 1);
|
|
65
65
|
}
|
|
66
|
-
exports.incrementMessageCounts = incrementMessageCounts;
|
|
67
66
|
function normalizeMessages(messages) {
|
|
68
67
|
return messages.map(message => {
|
|
69
68
|
const { CampaignId, InAppMessage: pinpointInAppMessage } = message;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"messageProcessingHelpers.js","sources":["../../../../../../src/inAppMessaging/providers/pinpoint/utils/messageProcessingHelpers.ts"],"sourcesContent":["\"use strict\";\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.incrementMessageCounts = exports.sessionStateChangeHandler = exports.processInAppMessages = void 0;\nconst core_1 = require(\"@aws-amplify/core\");\nconst helpers_1 = require(\"./helpers\");\nconst MESSAGE_DAILY_COUNT_KEY = 'pinpointProvider_inAppMessages_dailyCount';\nconst MESSAGE_TOTAL_COUNT_KEY = 'pinpointProvider_inAppMessages_totalCount';\nconst logger = new core_1.ConsoleLogger('InAppMessaging.processInAppMessages');\nlet sessionMessageCountMap = {};\nasync function processInAppMessages(messages, event) {\n let highestPrioritySeen;\n let acc = [];\n for (const message of messages) {\n const messageQualifies = (0, helpers_1.matchesEventType)(message, event) &&\n (0, helpers_1.matchesAttributes)(message, event) &&\n (0, helpers_1.matchesMetrics)(message, event) &&\n (0, helpers_1.isBeforeEndDate)(message) &&\n (await isBelowCap(message));\n // filter all qualifying messages returning only those that are of (relative) highest priority\n if (messageQualifies) {\n // have not yet encountered message with priority\n if (!highestPrioritySeen) {\n // this message has priority, so reset the accumulator with this message only\n if (message.Priority) {\n highestPrioritySeen = message.Priority;\n acc = [message];\n }\n else {\n // this message also has no priority, so just add this message to accumulator\n acc.push(message);\n }\n // have previously encountered message with priority, so only messages with priority matter now\n }\n else if (message.Priority) {\n // this message has higher priority (lower number), so reset the accumulator with this message only\n if (message.Priority < highestPrioritySeen) {\n highestPrioritySeen = message.Priority;\n acc = [message];\n // this message has the same priority, so just add this message to accumulator\n }\n else if (message.Priority === highestPrioritySeen) {\n acc.push(message);\n }\n }\n }\n }\n return normalizeMessages(acc);\n}\nexports.processInAppMessages = processInAppMessages;\nfunction sessionStateChangeHandler(state) {\n if (state === 'started') {\n // reset all session counts\n sessionMessageCountMap = {};\n }\n}\nexports.sessionStateChangeHandler = sessionStateChangeHandler;\nasync function incrementMessageCounts(messageId) {\n const { sessionCount, dailyCount, totalCount } = await getMessageCounts(messageId);\n setSessionCount(messageId, sessionCount + 1);\n setDailyCount(dailyCount + 1);\n await setTotalCount(messageId, totalCount + 1);\n}\nexports.incrementMessageCounts = incrementMessageCounts;\nfunction normalizeMessages(messages) {\n return messages.map(message => {\n const { CampaignId, InAppMessage: pinpointInAppMessage } = message;\n return {\n // Default to empty string in rare cases we don't have a campaignId\n id: CampaignId ?? '',\n content: (0, helpers_1.extractContent)(message),\n // Default to TOP_BANNER layout in rare cases we don't have a Layout\n layout: pinpointInAppMessage?.Layout\n ? (0, helpers_1.interpretLayout)(pinpointInAppMessage.Layout)\n : 'TOP_BANNER',\n metadata: (0, helpers_1.extractMetadata)(message),\n };\n });\n}\nasync function isBelowCap({ CampaignId, SessionCap, DailyCap, TotalCap, }) {\n const { sessionCount, dailyCount, totalCount } = await getMessageCounts(CampaignId);\n return ((!SessionCap || sessionCount < SessionCap) &&\n (!DailyCap || dailyCount < DailyCap) &&\n (!TotalCap || totalCount < TotalCap));\n}\nasync function getMessageCounts(messageId) {\n let messageCounts = {\n sessionCount: 0,\n dailyCount: 0,\n totalCount: 0,\n };\n try {\n // only return true counts if there is a messageId else default to 0\n if (messageId)\n messageCounts = {\n sessionCount: getSessionCount(messageId),\n dailyCount: await getDailyCount(),\n totalCount: await getTotalCount(messageId),\n };\n return messageCounts;\n }\n catch (err) {\n logger.error('Failed to get message counts from storage', err);\n // If there are no cached counts or there is an error,\n // we default to 0 allowing all the messages to be eligible\n return messageCounts;\n }\n}\nfunction getSessionCount(messageId) {\n return sessionMessageCountMap[messageId] ?? 0;\n}\nfunction setSessionCount(messageId, count) {\n sessionMessageCountMap[messageId] = count;\n}\nfunction setDailyCount(count) {\n const dailyCount = {\n count,\n lastCountTimestamp: getStartOfDay(),\n };\n try {\n core_1.defaultStorage.setItem(MESSAGE_DAILY_COUNT_KEY, JSON.stringify(dailyCount));\n }\n catch (err) {\n logger.error('Failed to save daily message count to storage', err);\n }\n}\nfunction setTotalCountMap(countMap) {\n try {\n core_1.defaultStorage.setItem(MESSAGE_TOTAL_COUNT_KEY, JSON.stringify(countMap));\n }\n catch (err) {\n logger.error('Failed to save total count to storage', err);\n }\n}\nasync function setTotalCount(messageId, count) {\n const totalCountMap = await getTotalCountMap();\n const updatedMap = {\n ...totalCountMap,\n [messageId]: count,\n };\n setTotalCountMap(updatedMap);\n}\nasync function getDailyCount() {\n const today = getStartOfDay();\n const item = await core_1.defaultStorage.getItem(MESSAGE_DAILY_COUNT_KEY);\n // Parse stored count or initialize as empty count\n const counter = item\n ? JSON.parse(item)\n : { count: 0, lastCountTimestamp: today };\n // If the stored counter timestamp is today, use it as the count, otherwise reset to 0\n return counter.lastCountTimestamp === today ? counter.count : 0;\n}\nasync function getTotalCountMap() {\n const item = await core_1.defaultStorage.getItem(MESSAGE_TOTAL_COUNT_KEY);\n // Parse stored count map or initialize as empty\n return item ? JSON.parse(item) : {};\n}\nasync function getTotalCount(messageId) {\n const countMap = await getTotalCountMap();\n // Return stored count or initialize as empty count\n return countMap[messageId] || 0;\n}\nconst getStartOfDay = () => {\n const now = new Date();\n now.setHours(0, 0, 0, 0);\n return now.toISOString();\n};\n"],"names":[],"mappings":";;AACA;AACA;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;AAC7D,OAAO,CAAC,sBAAsB,GAAG,OAAO,CAAC,yBAAyB,GAAG,OAAO,CAAC,oBAAoB,GAAG,MAAM;AAC1G,MAAM,MAAM,GAAG,OAAO,CAAC,mBAAmB,CAAC;AAC3C,MAAM,SAAS,GAAG,OAAO,CAAC,WAAW,CAAC;AACtC,MAAM,uBAAuB,GAAG,2CAA2C;AAC3E,MAAM,uBAAuB,GAAG,2CAA2C;AAC3E,MAAM,MAAM,GAAG,IAAI,MAAM,CAAC,aAAa,CAAC,qCAAqC,CAAC;AAC9E,IAAI,sBAAsB,GAAG,EAAE;AAC/B,eAAe,oBAAoB,CAAC,QAAQ,EAAE,KAAK,EAAE;AACrD,IAAI,IAAI,mBAAmB;AAC3B,IAAI,IAAI,GAAG,GAAG,EAAE;AAChB,IAAI,KAAK,MAAM,OAAO,IAAI,QAAQ,EAAE;AACpC,QAAQ,MAAM,gBAAgB,GAAG,IAAI,SAAS,CAAC,gBAAgB,EAAE,OAAO,EAAE,KAAK,CAAC;AAChF,YAAY,IAAI,SAAS,CAAC,iBAAiB,EAAE,OAAO,EAAE,KAAK,CAAC;AAC5D,YAAY,IAAI,SAAS,CAAC,cAAc,EAAE,OAAO,EAAE,KAAK,CAAC;AACzD,YAAY,IAAI,SAAS,CAAC,eAAe,EAAE,OAAO,CAAC;AACnD,aAAa,MAAM,UAAU,CAAC,OAAO,CAAC,CAAC;AACvC;AACA,QAAQ,IAAI,gBAAgB,EAAE;AAC9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GAAG;AACvB,QAAQ,GAAG,aAAa;AACxB,QAAQ,CAAC,SAAS,GAAG,KAAK;AAC1B,KAAK;AACL,IAAI,gBAAgB,CAAC,UAAU,CAAC;AAChC;AACA,eAAe,aAAa,GAAG;AAC/B,IAAI,MAAM,KAAK,GAAG,aAAa,EAAE;AACjC,IAAI,MAAM,IAAI,GAAG,MAAM,MAAM,CAAC,cAAc,CAAC,OAAO,CAAC,uBAAuB,CAAC;AAC7E;AACA,IAAI,MAAM,OAAO,GAAG;AACpB,UAAU,IAAI,CAAC,KAAK,CAAC,IAAI;AACzB,UAAU,EAAE,KAAK,EAAE,CAAC,EAAE,kBAAkB,EAAE,KAAK,EAAE;AACjD;AACA,IAAI,OAAO,OAAO,CAAC,kBAAkB,KAAK,KAAK,GAAG,OAAO,CAAC,KAAK,GAAG,CAAC;AACnE;AACA,eAAe,gBAAgB,GAAG;AAClC,IAAI,MAAM,IAAI,GAAG,MAAM,MAAM,CAAC,cAAc,CAAC,OAAO,CAAC,uBAAuB,CAAC;AAC7E;AACA,IAAI,OAAO,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,EAAE;AACvC;AACA,eAAe,aAAa,CAAC,SAAS,EAAE;AACxC,IAAI,MAAM,QAAQ,GAAG,MAAM,gBAAgB,EAAE;AAC7C;AACA,IAAI,OAAO,QAAQ,CAAC,SAAS,CAAC,IAAI,CAAC;AACnC;AACA,MAAM,aAAa,GAAG,MAAM;AAC5B,IAAI,MAAM,GAAG,GAAG,IAAI,IAAI,EAAE;AAC1B,IAAI,GAAG,CAAC,QAAQ,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;AAC5B,IAAI,OAAO,GAAG,CAAC,WAAW,EAAE;AAC5B,CAAC;;"}
|
|
1
|
+
{"version":3,"file":"messageProcessingHelpers.js","sources":["../../../../../../src/inAppMessaging/providers/pinpoint/utils/messageProcessingHelpers.ts"],"sourcesContent":["\"use strict\";\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.processInAppMessages = processInAppMessages;\nexports.sessionStateChangeHandler = sessionStateChangeHandler;\nexports.incrementMessageCounts = incrementMessageCounts;\nconst core_1 = require(\"@aws-amplify/core\");\nconst helpers_1 = require(\"./helpers\");\nconst MESSAGE_DAILY_COUNT_KEY = 'pinpointProvider_inAppMessages_dailyCount';\nconst MESSAGE_TOTAL_COUNT_KEY = 'pinpointProvider_inAppMessages_totalCount';\nconst logger = new core_1.ConsoleLogger('InAppMessaging.processInAppMessages');\nlet sessionMessageCountMap = {};\nasync function processInAppMessages(messages, event) {\n let highestPrioritySeen;\n let acc = [];\n for (const message of messages) {\n const messageQualifies = (0, helpers_1.matchesEventType)(message, event) &&\n (0, helpers_1.matchesAttributes)(message, event) &&\n (0, helpers_1.matchesMetrics)(message, event) &&\n (0, helpers_1.isBeforeEndDate)(message) &&\n (await isBelowCap(message));\n // filter all qualifying messages returning only those that are of (relative) highest priority\n if (messageQualifies) {\n // have not yet encountered message with priority\n if (!highestPrioritySeen) {\n // this message has priority, so reset the accumulator with this message only\n if (message.Priority) {\n highestPrioritySeen = message.Priority;\n acc = [message];\n }\n else {\n // this message also has no priority, so just add this message to accumulator\n acc.push(message);\n }\n // have previously encountered message with priority, so only messages with priority matter now\n }\n else if (message.Priority) {\n // this message has higher priority (lower number), so reset the accumulator with this message only\n if (message.Priority < highestPrioritySeen) {\n highestPrioritySeen = message.Priority;\n acc = [message];\n // this message has the same priority, so just add this message to accumulator\n }\n else if (message.Priority === highestPrioritySeen) {\n acc.push(message);\n }\n }\n }\n }\n return normalizeMessages(acc);\n}\nfunction sessionStateChangeHandler(state) {\n if (state === 'started') {\n // reset all session counts\n sessionMessageCountMap = {};\n }\n}\nasync function incrementMessageCounts(messageId) {\n const { sessionCount, dailyCount, totalCount } = await getMessageCounts(messageId);\n setSessionCount(messageId, sessionCount + 1);\n setDailyCount(dailyCount + 1);\n await setTotalCount(messageId, totalCount + 1);\n}\nfunction normalizeMessages(messages) {\n return messages.map(message => {\n const { CampaignId, InAppMessage: pinpointInAppMessage } = message;\n return {\n // Default to empty string in rare cases we don't have a campaignId\n id: CampaignId ?? '',\n content: (0, helpers_1.extractContent)(message),\n // Default to TOP_BANNER layout in rare cases we don't have a Layout\n layout: pinpointInAppMessage?.Layout\n ? (0, helpers_1.interpretLayout)(pinpointInAppMessage.Layout)\n : 'TOP_BANNER',\n metadata: (0, helpers_1.extractMetadata)(message),\n };\n });\n}\nasync function isBelowCap({ CampaignId, SessionCap, DailyCap, TotalCap, }) {\n const { sessionCount, dailyCount, totalCount } = await getMessageCounts(CampaignId);\n return ((!SessionCap || sessionCount < SessionCap) &&\n (!DailyCap || dailyCount < DailyCap) &&\n (!TotalCap || totalCount < TotalCap));\n}\nasync function getMessageCounts(messageId) {\n let messageCounts = {\n sessionCount: 0,\n dailyCount: 0,\n totalCount: 0,\n };\n try {\n // only return true counts if there is a messageId else default to 0\n if (messageId)\n messageCounts = {\n sessionCount: getSessionCount(messageId),\n dailyCount: await getDailyCount(),\n totalCount: await getTotalCount(messageId),\n };\n return messageCounts;\n }\n catch (err) {\n logger.error('Failed to get message counts from storage', err);\n // If there are no cached counts or there is an error,\n // we default to 0 allowing all the messages to be eligible\n return messageCounts;\n }\n}\nfunction getSessionCount(messageId) {\n return sessionMessageCountMap[messageId] ?? 0;\n}\nfunction setSessionCount(messageId, count) {\n sessionMessageCountMap[messageId] = count;\n}\nfunction setDailyCount(count) {\n const dailyCount = {\n count,\n lastCountTimestamp: getStartOfDay(),\n };\n try {\n core_1.defaultStorage.setItem(MESSAGE_DAILY_COUNT_KEY, JSON.stringify(dailyCount));\n }\n catch (err) {\n logger.error('Failed to save daily message count to storage', err);\n }\n}\nfunction setTotalCountMap(countMap) {\n try {\n core_1.defaultStorage.setItem(MESSAGE_TOTAL_COUNT_KEY, JSON.stringify(countMap));\n }\n catch (err) {\n logger.error('Failed to save total count to storage', err);\n }\n}\nasync function setTotalCount(messageId, count) {\n const totalCountMap = await getTotalCountMap();\n const updatedMap = {\n ...totalCountMap,\n [messageId]: count,\n };\n setTotalCountMap(updatedMap);\n}\nasync function getDailyCount() {\n const today = getStartOfDay();\n const item = await core_1.defaultStorage.getItem(MESSAGE_DAILY_COUNT_KEY);\n // Parse stored count or initialize as empty count\n const counter = item\n ? JSON.parse(item)\n : { count: 0, lastCountTimestamp: today };\n // If the stored counter timestamp is today, use it as the count, otherwise reset to 0\n return counter.lastCountTimestamp === today ? counter.count : 0;\n}\nasync function getTotalCountMap() {\n const item = await core_1.defaultStorage.getItem(MESSAGE_TOTAL_COUNT_KEY);\n // Parse stored count map or initialize as empty\n return item ? JSON.parse(item) : {};\n}\nasync function getTotalCount(messageId) {\n const countMap = await getTotalCountMap();\n // Return stored count or initialize as empty count\n return countMap[messageId] || 0;\n}\nconst getStartOfDay = () => {\n const now = new Date();\n now.setHours(0, 0, 0, 0);\n return now.toISOString();\n};\n"],"names":[],"mappings":";;AACA;AACA;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;AAC7D,OAAO,CAAC,oBAAoB,GAAG,oBAAoB;AACnD,OAAO,CAAC,yBAAyB,GAAG,yBAAyB;AAC7D,OAAO,CAAC,sBAAsB,GAAG,sBAAsB;AACvD,MAAM,MAAM,GAAG,OAAO,CAAC,mBAAmB,CAAC;AAC3C,MAAM,SAAS,GAAG,OAAO,CAAC,WAAW,CAAC;AACtC,MAAM,uBAAuB,GAAG,2CAA2C;AAC3E,MAAM,uBAAuB,GAAG,2CAA2C;AAC3E,MAAM,MAAM,GAAG,IAAI,MAAM,CAAC,aAAa,CAAC,qCAAqC,CAAC;AAC9E,IAAI,sBAAsB,GAAG,EAAE;AAC/B,eAAe,oBAAoB,CAAC,QAAQ,EAAE,KAAK,EAAE;AACrD,IAAI,IAAI,mBAAmB;AAC3B,I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;AAC5B,IAAI,MAAM,GAAG,GAAG,IAAI,IAAI,EAAE;AAC1B,IAAI,GAAG,CAAC,QAAQ,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;AAC5B,IAAI,OAAO,GAAG,CAAC,WAAW,EAAE;AAC5B,CAAC;;"}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.
|
|
4
|
+
exports.getInAppMessagingUserAgent = getInAppMessagingUserAgent;
|
|
5
|
+
exports.getInAppMessagingUserAgentString = getInAppMessagingUserAgentString;
|
|
5
6
|
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
6
7
|
// SPDX-License-Identifier: Apache-2.0
|
|
7
8
|
const utils_1 = require("@aws-amplify/core/internals/utils");
|
|
@@ -11,12 +12,10 @@ function getInAppMessagingUserAgent(action) {
|
|
|
11
12
|
action,
|
|
12
13
|
});
|
|
13
14
|
}
|
|
14
|
-
exports.getInAppMessagingUserAgent = getInAppMessagingUserAgent;
|
|
15
15
|
function getInAppMessagingUserAgentString(action) {
|
|
16
16
|
return (0, utils_1.getAmplifyUserAgent)({
|
|
17
17
|
category: utils_1.Category.InAppMessaging,
|
|
18
18
|
action,
|
|
19
19
|
});
|
|
20
20
|
}
|
|
21
|
-
exports.getInAppMessagingUserAgentString = getInAppMessagingUserAgentString;
|
|
22
21
|
//# sourceMappingURL=userAgent.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"userAgent.js","sources":["../../../../../../src/inAppMessaging/providers/pinpoint/utils/userAgent.ts"],"sourcesContent":["\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.
|
|
1
|
+
{"version":3,"file":"userAgent.js","sources":["../../../../../../src/inAppMessaging/providers/pinpoint/utils/userAgent.ts"],"sourcesContent":["\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.getInAppMessagingUserAgent = getInAppMessagingUserAgent;\nexports.getInAppMessagingUserAgentString = getInAppMessagingUserAgentString;\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nconst utils_1 = require(\"@aws-amplify/core/internals/utils\");\nfunction getInAppMessagingUserAgent(action) {\n return (0, utils_1.getAmplifyUserAgentObject)({\n category: utils_1.Category.InAppMessaging,\n action,\n });\n}\nfunction getInAppMessagingUserAgentString(action) {\n return (0, utils_1.getAmplifyUserAgent)({\n category: utils_1.Category.InAppMessaging,\n action,\n });\n}\n"],"names":[],"mappings":";;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;AAC7D,OAAO,CAAC,0BAA0B,GAAG,0BAA0B;AAC/D,OAAO,CAAC,gCAAgC,GAAG,gCAAgC;AAC3E;AACA;AACA,MAAM,OAAO,GAAG,OAAO,CAAC,mCAAmC,CAAC;AAC5D,SAAS,0BAA0B,CAAC,MAAM,EAAE;AAC5C,IAAI,OAAO,IAAI,OAAO,CAAC,yBAAyB,EAAE;AAClD,QAAQ,QAAQ,EAAE,OAAO,CAAC,QAAQ,CAAC,cAAc;AACjD,QAAQ,MAAM;AACd,KAAK,CAAC;AACN;AACA,SAAS,gCAAgC,CAAC,MAAM,EAAE;AAClD,IAAI,OAAO,IAAI,OAAO,CAAC,mBAAmB,EAAE;AAC5C,QAAQ,QAAQ,EAAE,OAAO,CAAC,QAAQ,CAAC,cAAc;AACjD,QAAQ,MAAM;AACd,KAAK,CAAC;AACN;;"}
|
|
@@ -3,7 +3,8 @@
|
|
|
3
3
|
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
4
4
|
// SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.
|
|
6
|
+
exports.isInitialized = exports.initialize = void 0;
|
|
7
|
+
exports.assertIsInitialized = assertIsInitialized;
|
|
7
8
|
const errors_1 = require("../errors");
|
|
8
9
|
let initialized = false;
|
|
9
10
|
/**
|
|
@@ -25,5 +26,4 @@ exports.isInitialized = isInitialized;
|
|
|
25
26
|
function assertIsInitialized() {
|
|
26
27
|
(0, errors_1.assertValidationError)((0, exports.isInitialized)(), errors_1.InAppMessagingValidationErrorCode.NotInitialized);
|
|
27
28
|
}
|
|
28
|
-
exports.assertIsInitialized = assertIsInitialized;
|
|
29
29
|
//# sourceMappingURL=statusHelpers.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"statusHelpers.js","sources":["../../../../src/inAppMessaging/utils/statusHelpers.ts"],"sourcesContent":["\"use strict\";\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.
|
|
1
|
+
{"version":3,"file":"statusHelpers.js","sources":["../../../../src/inAppMessaging/utils/statusHelpers.ts"],"sourcesContent":["\"use strict\";\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.isInitialized = exports.initialize = void 0;\nexports.assertIsInitialized = assertIsInitialized;\nconst errors_1 = require(\"../errors\");\nlet initialized = false;\n/**\n * Sets initialization status to true.\n *\n * @internal\n */\nconst initialize = () => {\n initialized = true;\n};\nexports.initialize = initialize;\n/**\n * Returns the initialization status of In-App Messaging.\n *\n * @internal\n */\nconst isInitialized = () => initialized;\nexports.isInitialized = isInitialized;\nfunction assertIsInitialized() {\n (0, errors_1.assertValidationError)((0, exports.isInitialized)(), errors_1.InAppMessagingValidationErrorCode.NotInitialized);\n}\n"],"names":[],"mappings":";;AACA;AACA;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;AAC7D,OAAO,CAAC,aAAa,GAAG,OAAO,CAAC,UAAU,GAAG,MAAM;AACnD,OAAO,CAAC,mBAAmB,GAAG,mBAAmB;AACjD,MAAM,QAAQ,GAAG,OAAO,CAAC,WAAW,CAAC;AACrC,IAAI,WAAW,GAAG,KAAK;AACvB;AACA;AACA;AACA;AACA;AACA,MAAM,UAAU,GAAG,MAAM;AACzB,IAAI,WAAW,GAAG,IAAI;AACtB,CAAC;AACD,OAAO,CAAC,UAAU,GAAG,UAAU;AAC/B;AACA;AACA;AACA;AACA;AACA,MAAM,aAAa,GAAG,MAAM,WAAW;AACvC,OAAO,CAAC,aAAa,GAAG,aAAa;AACrC,SAAS,mBAAmB,GAAG;AAC/B,IAAI,IAAI,QAAQ,CAAC,qBAAqB,EAAE,IAAI,OAAO,CAAC,aAAa,GAAG,EAAE,QAAQ,CAAC,iCAAiC,CAAC,cAAc,CAAC;AAChI;;"}
|
|
@@ -13,7 +13,7 @@ var PushNotificationValidationErrorCode;
|
|
|
13
13
|
PushNotificationValidationErrorCode["NoCredentials"] = "NoCredentials";
|
|
14
14
|
PushNotificationValidationErrorCode["NoRegion"] = "NoRegion";
|
|
15
15
|
PushNotificationValidationErrorCode["NotInitialized"] = "NotInitialized";
|
|
16
|
-
})(PushNotificationValidationErrorCode
|
|
16
|
+
})(PushNotificationValidationErrorCode || (exports.PushNotificationValidationErrorCode = PushNotificationValidationErrorCode = {}));
|
|
17
17
|
const pushNotificationValidationErrorMap = {
|
|
18
18
|
[PushNotificationValidationErrorCode.NoAppId]: {
|
|
19
19
|
message: 'Missing application id.',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errorHelpers.js","sources":["../../../../src/pushNotifications/errors/errorHelpers.ts"],"sourcesContent":["\"use strict\";\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.assertIsInitialized = exports.assert = exports.PushNotificationValidationErrorCode = void 0;\nconst utils_1 = require(\"@aws-amplify/core/internals/utils\");\nconst initializationManager_1 = require(\"../utils/initializationManager\");\nconst PushNotificationError_1 = require(\"./PushNotificationError\");\nvar PushNotificationValidationErrorCode;\n(function (PushNotificationValidationErrorCode) {\n PushNotificationValidationErrorCode[\"NoAppId\"] = \"NoAppId\";\n PushNotificationValidationErrorCode[\"NoCredentials\"] = \"NoCredentials\";\n PushNotificationValidationErrorCode[\"NoRegion\"] = \"NoRegion\";\n PushNotificationValidationErrorCode[\"NotInitialized\"] = \"NotInitialized\";\n})(PushNotificationValidationErrorCode
|
|
1
|
+
{"version":3,"file":"errorHelpers.js","sources":["../../../../src/pushNotifications/errors/errorHelpers.ts"],"sourcesContent":["\"use strict\";\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.assertIsInitialized = exports.assert = exports.PushNotificationValidationErrorCode = void 0;\nconst utils_1 = require(\"@aws-amplify/core/internals/utils\");\nconst initializationManager_1 = require(\"../utils/initializationManager\");\nconst PushNotificationError_1 = require(\"./PushNotificationError\");\nvar PushNotificationValidationErrorCode;\n(function (PushNotificationValidationErrorCode) {\n PushNotificationValidationErrorCode[\"NoAppId\"] = \"NoAppId\";\n PushNotificationValidationErrorCode[\"NoCredentials\"] = \"NoCredentials\";\n PushNotificationValidationErrorCode[\"NoRegion\"] = \"NoRegion\";\n PushNotificationValidationErrorCode[\"NotInitialized\"] = \"NotInitialized\";\n})(PushNotificationValidationErrorCode || (exports.PushNotificationValidationErrorCode = PushNotificationValidationErrorCode = {}));\nconst pushNotificationValidationErrorMap = {\n [PushNotificationValidationErrorCode.NoAppId]: {\n message: 'Missing application id.',\n },\n [PushNotificationValidationErrorCode.NoCredentials]: {\n message: 'Credentials should not be empty.',\n },\n [PushNotificationValidationErrorCode.NoRegion]: {\n message: 'Missing region.',\n },\n [PushNotificationValidationErrorCode.NotInitialized]: {\n message: 'Push notification has not been initialized.',\n recoverySuggestion: 'Please make sure to first call `initializePushNotifications`.',\n },\n};\nexports.assert = (0, utils_1.createAssertionFunction)(pushNotificationValidationErrorMap, PushNotificationError_1.PushNotificationError);\nconst assertIsInitialized = () => {\n (0, exports.assert)((0, initializationManager_1.isInitialized)(), PushNotificationValidationErrorCode.NotInitialized);\n};\nexports.assertIsInitialized = assertIsInitialized;\n"],"names":[],"mappings":";;AACA;AACA;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;AAC7D,OAAO,CAAC,mBAAmB,GAAG,OAAO,CAAC,MAAM,GAAG,OAAO,CAAC,mCAAmC,GAAG,MAAM;AACnG,MAAM,OAAO,GAAG,OAAO,CAAC,mCAAmC,CAAC;AAC5D,MAAM,uBAAuB,GAAG,OAAO,CAAC,gCAAgC,CAAC;AACzE,MAAM,uBAAuB,GAAG,OAAO,CAAC,yBAAyB,CAAC;AAClE,IAAI,mCAAmC;AACvC,CAAC,UAAU,mCAAmC,EAAE;AAChD,IAAI,mCAAmC,CAAC,SAAS,CAAC,GAAG,SAAS;AAC9D,IAAI,mCAAmC,CAAC,eAAe,CAAC,GAAG,eAAe;AAC1E,IAAI,mCAAmC,CAAC,UAAU,CAAC,GAAG,UAAU;AAChE,IAAI,mCAAmC,CAAC,gBAAgB,CAAC,GAAG,gBAAgB;AAC5E,CAAC,EAAE,mCAAmC,KAAK,OAAO,CAAC,mCAAmC,GAAG,mCAAmC,GAAG,EAAE,CAAC,CAAC;AACnI,MAAM,kCAAkC,GAAG;AAC3C,IAAI,CAAC,mCAAmC,CAAC,OAAO,GAAG;AACnD,QAAQ,OAAO,EAAE,yBAAyB;AAC1C,KAAK;AACL,IAAI,CAAC,mCAAmC,CAAC,aAAa,GAAG;AACzD,QAAQ,OAAO,EAAE,kCAAkC;AACnD,KAAK;AACL,IAAI,CAAC,mCAAmC,CAAC,QAAQ,GAAG;AACpD,QAAQ,OAAO,EAAE,iBAAiB;AAClC,KAAK;AACL,IAAI,CAAC,mCAAmC,CAAC,cAAc,GAAG;AAC1D,QAAQ,OAAO,EAAE,6CAA6C;AAC9D,QAAQ,kBAAkB,EAAE,+DAA+D;AAC3F,KAAK;AACL,CAAC;AACD,OAAO,CAAC,MAAM,GAAG,IAAI,OAAO,CAAC,uBAAuB,EAAE,kCAAkC,EAAE,uBAAuB,CAAC,qBAAqB,CAAC;AACxI,MAAM,mBAAmB,GAAG,MAAM;AAClC,IAAI,IAAI,OAAO,CAAC,MAAM,EAAE,IAAI,uBAAuB,CAAC,aAAa,GAAG,EAAE,mCAAmC,CAAC,cAAc,CAAC;AACzH,CAAC;AACD,OAAO,CAAC,mBAAmB,GAAG,mBAAmB;;"}
|
|
@@ -4,7 +4,8 @@
|
|
|
4
4
|
// SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.PushNotificationErrorCode = void 0;
|
|
7
|
+
var PushNotificationErrorCode;
|
|
7
8
|
(function (PushNotificationErrorCode) {
|
|
8
9
|
PushNotificationErrorCode["NotInitialized"] = "NotInitialized";
|
|
9
|
-
})(
|
|
10
|
+
})(PushNotificationErrorCode || (exports.PushNotificationErrorCode = PushNotificationErrorCode = {}));
|
|
10
11
|
//# sourceMappingURL=errors.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.js","sources":["../../../../src/pushNotifications/types/errors.ts"],"sourcesContent":["\"use strict\";\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.PushNotificationErrorCode = void 0;\nvar PushNotificationErrorCode;\n(function (PushNotificationErrorCode) {\n PushNotificationErrorCode[\"NotInitialized\"] = \"NotInitialized\";\n})(PushNotificationErrorCode
|
|
1
|
+
{"version":3,"file":"errors.js","sources":["../../../../src/pushNotifications/types/errors.ts"],"sourcesContent":["\"use strict\";\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.PushNotificationErrorCode = void 0;\nvar PushNotificationErrorCode;\n(function (PushNotificationErrorCode) {\n PushNotificationErrorCode[\"NotInitialized\"] = \"NotInitialized\";\n})(PushNotificationErrorCode || (exports.PushNotificationErrorCode = PushNotificationErrorCode = {}));\n"],"names":[],"mappings":";;AACA;AACA;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;AAC7D,OAAO,CAAC,yBAAyB,GAAG,MAAM;AAC1C,IAAI,yBAAyB;AAC7B,CAAC,UAAU,yBAAyB,EAAE;AACtC,IAAI,yBAAyB,CAAC,gBAAgB,CAAC,GAAG,gBAAgB;AAClE,CAAC,EAAE,yBAAyB,KAAK,OAAO,CAAC,yBAAyB,GAAG,yBAAyB,GAAG,EAAE,CAAC,CAAC;;"}
|
|
@@ -13,7 +13,7 @@ export declare const getComparator: (operator?: string) => MetricsComparator | u
|
|
|
13
13
|
export declare const isBeforeEndDate: ({ Schedule, }: PinpointInAppMessage) => boolean;
|
|
14
14
|
export declare const isQuietTime: (message: PinpointInAppMessage) => boolean;
|
|
15
15
|
export declare const clearMemo: () => void;
|
|
16
|
-
export declare const interpretLayout: (layout: NonNullable<PinpointInAppMessage[
|
|
16
|
+
export declare const interpretLayout: (layout: NonNullable<PinpointInAppMessage["InAppMessage"]>["Layout"]) => InAppMessageLayout;
|
|
17
17
|
export declare const extractContent: ({ InAppMessage: message, }: PinpointInAppMessage) => InAppMessageContent[];
|
|
18
|
-
export declare const extractMetadata: ({ InAppMessage: inAppMessage, Priority, Schedule, TreatmentId, }: PinpointInAppMessage) => InAppMessage[
|
|
18
|
+
export declare const extractMetadata: ({ InAppMessage: inAppMessage, Priority, Schedule, TreatmentId, }: PinpointInAppMessage) => InAppMessage["metadata"];
|
|
19
19
|
export declare const mapOSPlatform: (os?: string) => ButtonConfigPlatform;
|
package/package.json
CHANGED
|
@@ -1,107 +1,106 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
"gitHead": "f2ac9929610f7f878f124083ceaf03465113cd44"
|
|
2
|
+
"name": "@aws-amplify/notifications",
|
|
3
|
+
"version": "2.0.81-local-stack.00864ae.0+00864ae",
|
|
4
|
+
"description": "Notifications category of aws-amplify",
|
|
5
|
+
"main": "./dist/cjs/index.js",
|
|
6
|
+
"module": "./dist/esm/index.mjs",
|
|
7
|
+
"react-native": "./dist/cjs/index.js",
|
|
8
|
+
"typings": "./dist/esm/index.d.ts",
|
|
9
|
+
"sideEffects": false,
|
|
10
|
+
"publishConfig": {
|
|
11
|
+
"access": "public"
|
|
12
|
+
},
|
|
13
|
+
"scripts": {
|
|
14
|
+
"test": "npm run lint && jest -w 1 --coverage --logHeapUsage",
|
|
15
|
+
"test:watch": "jest -w 1 --watch",
|
|
16
|
+
"build-with-test": "npm run clean && npm run build",
|
|
17
|
+
"build:umd": "webpack && webpack --config ./webpack.config.dev.js",
|
|
18
|
+
"build:esm-cjs": "rollup --forceExit -c rollup.config.mjs",
|
|
19
|
+
"build:watch": "npm run build:esm-cjs -- --watch",
|
|
20
|
+
"build": "npm run clean && npm run build:esm-cjs && npm run build:umd",
|
|
21
|
+
"clean": "npm run clean:size && rimraf dist lib lib-esm",
|
|
22
|
+
"clean:size": "rimraf dual-publish-tmp tmp*",
|
|
23
|
+
"format": "echo \"Not implemented\"",
|
|
24
|
+
"lint": "eslint '**/*.{ts,tsx}' && npm run ts-coverage",
|
|
25
|
+
"lint:fix": "eslint '**/*.{ts,tsx}' --fix",
|
|
26
|
+
"ts-coverage": "typescript-coverage-report -p ./tsconfig.build.json -t 88.21"
|
|
27
|
+
},
|
|
28
|
+
"typesVersions": {
|
|
29
|
+
">=4.2": {
|
|
30
|
+
"in-app-messaging": [
|
|
31
|
+
"./dist/esm/inAppMessaging/index.d.ts"
|
|
32
|
+
],
|
|
33
|
+
"push-notifications": [
|
|
34
|
+
"./dist/esm/pushNotifications/providers/index.d.ts"
|
|
35
|
+
],
|
|
36
|
+
"in-app-messaging/pinpoint": [
|
|
37
|
+
"./dist/esm/inAppMessaging/providers/pinpoint/index.d.ts"
|
|
38
|
+
],
|
|
39
|
+
"push-notifications/pinpoint": [
|
|
40
|
+
"./dist/esm/pushNotifications/providers/pinpoint/index.d.ts"
|
|
41
|
+
]
|
|
42
|
+
}
|
|
43
|
+
},
|
|
44
|
+
"exports": {
|
|
45
|
+
".": {
|
|
46
|
+
"react-native": "./dist/cjs/index.js",
|
|
47
|
+
"import": "./dist/esm/index.mjs",
|
|
48
|
+
"require": "./dist/cjs/index.js"
|
|
49
|
+
},
|
|
50
|
+
"./in-app-messaging": {
|
|
51
|
+
"react-native": "./dist/cjs/inAppMessaging/index.js",
|
|
52
|
+
"types": "./dist/esm/inAppMessaging/index.d.ts",
|
|
53
|
+
"import": "./dist/esm/inAppMessaging/index.mjs",
|
|
54
|
+
"require": "./dist/cjs/inAppMessaging/index.js"
|
|
55
|
+
},
|
|
56
|
+
"./push-notifications": {
|
|
57
|
+
"react-native": "./dist/cjs/pushNotifications/index.js",
|
|
58
|
+
"types": "./dist/esm/pushNotifications/index.d.ts",
|
|
59
|
+
"import": "./dist/esm/pushNotifications/index.mjs",
|
|
60
|
+
"require": "./dist/cjs/pushNotifications/index.js"
|
|
61
|
+
},
|
|
62
|
+
"./in-app-messaging/pinpoint": {
|
|
63
|
+
"react-native": "./dist/cjs/inAppMessaging/providers/pinpoint/index.js",
|
|
64
|
+
"types": "./dist/esm/inAppMessaging/providers/pinpoint/index.d.ts",
|
|
65
|
+
"import": "./dist/esm/inAppMessaging/providers/pinpoint/index.mjs",
|
|
66
|
+
"require": "./dist/cjs/inAppMessaging/providers/pinpoint/index.js"
|
|
67
|
+
},
|
|
68
|
+
"./push-notifications/pinpoint": {
|
|
69
|
+
"react-native": "./dist/cjs/pushNotifications/providers/pinpoint/index.js",
|
|
70
|
+
"types": "./dist/esm/pushNotifications/providers/pinpoint/index.d.ts",
|
|
71
|
+
"import": "./dist/esm/pushNotifications/providers/pinpoint/index.mjs",
|
|
72
|
+
"require": "./dist/cjs/pushNotifications/providers/pinpoint/index.js"
|
|
73
|
+
},
|
|
74
|
+
"./package.json": "./package.json"
|
|
75
|
+
},
|
|
76
|
+
"repository": {
|
|
77
|
+
"type": "git",
|
|
78
|
+
"url": "https://github.com/aws-amplify/amplify-js.git"
|
|
79
|
+
},
|
|
80
|
+
"author": "Amazon Web Services",
|
|
81
|
+
"license": "Apache-2.0",
|
|
82
|
+
"bugs": {
|
|
83
|
+
"url": "https://github.com/aws/aws-amplify/issues"
|
|
84
|
+
},
|
|
85
|
+
"homepage": "https://docs.amplify.aws/",
|
|
86
|
+
"files": [
|
|
87
|
+
"dist/cjs",
|
|
88
|
+
"dist/esm",
|
|
89
|
+
"src",
|
|
90
|
+
"in-app-messaging",
|
|
91
|
+
"push-notifications"
|
|
92
|
+
],
|
|
93
|
+
"dependencies": {
|
|
94
|
+
"@aws-sdk/types": "3.398.0",
|
|
95
|
+
"lodash": "^4.17.21",
|
|
96
|
+
"tslib": "^2.5.0"
|
|
97
|
+
},
|
|
98
|
+
"peerDependencies": {
|
|
99
|
+
"@aws-amplify/core": "6.11.5-local-stack.00864ae.0+00864ae"
|
|
100
|
+
},
|
|
101
|
+
"devDependencies": {
|
|
102
|
+
"@aws-amplify/core": "6.11.5-local-stack.00864ae.0+00864ae",
|
|
103
|
+
"@aws-amplify/react-native": "1.1.10-local-stack.00864ae.0+00864ae"
|
|
104
|
+
},
|
|
105
|
+
"gitHead": "00864aec571d0509655eea0673e896d69d434972"
|
|
107
106
|
}
|