@aws-amplify/notifications 2.0.5 → 2.0.6-unstable.1c5010c.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/inAppMessaging/errors/assertServiceError.js +1 -1
- package/dist/cjs/inAppMessaging/errors/assertServiceError.js.map +1 -1
- package/dist/esm/inAppMessaging/errors/assertServiceError.mjs +1 -1
- package/dist/esm/inAppMessaging/errors/assertServiceError.mjs.map +1 -1
- package/dist/esm/inAppMessaging/providers/pinpoint/types/inputs.d.ts +2 -1
- package/dist/esm/inAppMessaging/types/inputs.d.ts +1 -1
- package/package.json +106 -146
- package/src/inAppMessaging/errors/assertServiceError.ts +1 -1
- package/src/inAppMessaging/providers/pinpoint/types/inputs.ts +2 -2
- package/src/inAppMessaging/providers/pinpoint/utils/helpers.ts +2 -2
- package/src/inAppMessaging/providers/pinpoint/utils/messageProcessingHelpers.ts +4 -6
- package/src/inAppMessaging/types/inputs.ts +3 -2
- package/src/pushNotifications/types/inputs.ts +2 -1
|
@@ -12,7 +12,7 @@ function assertServiceError(error) {
|
|
|
12
12
|
error instanceof TypeError) {
|
|
13
13
|
throw new InAppMessagingError_1.InAppMessagingError({
|
|
14
14
|
name: utils_1.AmplifyErrorCode.Unknown,
|
|
15
|
-
message: 'An unknown error has
|
|
15
|
+
message: 'An unknown error has occurred.',
|
|
16
16
|
underlyingError: error,
|
|
17
17
|
});
|
|
18
18
|
}
|
|
@@ -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 = void 0;\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
|
|
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 = void 0;\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}\nexports.assertServiceError = assertServiceError;\n"],"names":[],"mappings":";;AACA;AACA;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;AAC9D,OAAO,CAAC,kBAAkB,GAAG,KAAK,CAAC,CAAC;AACpC,MAAM,OAAO,GAAG,OAAO,CAAC,mCAAmC,CAAC,CAAC;AAC7D,MAAM,qBAAqB,GAAG,OAAO,CAAC,uBAAuB,CAAC,CAAC;AAC/D,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,CAAC;AACX,KAAK;AACL,CAAC;AACD,OAAO,CAAC,kBAAkB,GAAG,kBAAkB;;"}
|
|
@@ -9,7 +9,7 @@ function assertServiceError(error) {
|
|
|
9
9
|
error instanceof TypeError) {
|
|
10
10
|
throw new InAppMessagingError({
|
|
11
11
|
name: AmplifyErrorCode.Unknown,
|
|
12
|
-
message: 'An unknown error has
|
|
12
|
+
message: 'An unknown error has occurred.',
|
|
13
13
|
underlyingError: error,
|
|
14
14
|
});
|
|
15
15
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"assertServiceError.mjs","sources":["../../../../src/inAppMessaging/errors/assertServiceError.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { AmplifyErrorCode, } from '@aws-amplify/core/internals/utils';\nimport { InAppMessagingError } from './InAppMessagingError';\nexport function assertServiceError(error) {\n if (!error ||\n error.name === 'Error' ||\n error instanceof TypeError) {\n throw new InAppMessagingError({\n name: AmplifyErrorCode.Unknown,\n message: 'An unknown error has
|
|
1
|
+
{"version":3,"file":"assertServiceError.mjs","sources":["../../../../src/inAppMessaging/errors/assertServiceError.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { AmplifyErrorCode, } from '@aws-amplify/core/internals/utils';\nimport { InAppMessagingError } from './InAppMessagingError';\nexport function assertServiceError(error) {\n if (!error ||\n error.name === 'Error' ||\n error instanceof TypeError) {\n throw new InAppMessagingError({\n name: AmplifyErrorCode.Unknown,\n message: 'An unknown error has occurred.',\n underlyingError: error,\n });\n }\n}\n"],"names":[],"mappings":";;;AAAA;AACA;AAGO,SAAS,kBAAkB,CAAC,KAAK,EAAE;AAC1C,IAAI,IAAI,CAAC,KAAK;AACd,QAAQ,KAAK,CAAC,IAAI,KAAK,OAAO;AAC9B,QAAQ,KAAK,YAAY,SAAS,EAAE;AACpC,QAAQ,MAAM,IAAI,mBAAmB,CAAC;AACtC,YAAY,IAAI,EAAE,gBAAgB,CAAC,OAAO;AAC1C,YAAY,OAAO,EAAE,gCAAgC;AACrD,YAAY,eAAe,EAAE,KAAK;AAClC,SAAS,CAAC,CAAC;AACX,KAAK;AACL;;;;"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { IdentifyUserOptions
|
|
1
|
+
import { IdentifyUserOptions } from './options';
|
|
2
|
+
import { InAppMessageConflictHandler, OnMessageInteractionEventHandler } from './types';
|
|
2
3
|
import { InAppMessage, InAppMessageInteractionEvent, InAppMessagingEvent, InAppMessagingIdentifyUserInput } from '../../../types';
|
|
3
4
|
/**
|
|
4
5
|
* Input type for Pinpoint identifyUser API.
|
package/package.json
CHANGED
|
@@ -1,148 +1,108 @@
|
|
|
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
|
-
|
|
107
|
-
|
|
108
|
-
"globals": {
|
|
109
|
-
"__DEV__": true,
|
|
110
|
-
"ts-jest": {
|
|
111
|
-
"diagnostics": false,
|
|
112
|
-
"tsConfig": {
|
|
113
|
-
"allowJs": true,
|
|
114
|
-
"noEmitOnError": false
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
},
|
|
118
|
-
"transform": {
|
|
119
|
-
"^.+\\.(js|jsx|ts|tsx)$": "ts-jest"
|
|
120
|
-
},
|
|
121
|
-
"testPathIgnorePatterns": [
|
|
122
|
-
"/testUtils/"
|
|
123
|
-
],
|
|
124
|
-
"testRegex": "(/__tests__/.*|\\.(test|spec))\\.(tsx?|jsx?)$",
|
|
125
|
-
"moduleFileExtensions": [
|
|
126
|
-
"ts",
|
|
127
|
-
"tsx",
|
|
128
|
-
"js",
|
|
129
|
-
"json",
|
|
130
|
-
"jsx"
|
|
131
|
-
],
|
|
132
|
-
"testEnvironment": "jsdom",
|
|
133
|
-
"testURL": "http://localhost/",
|
|
134
|
-
"coverageThreshold": {
|
|
135
|
-
"global": {
|
|
136
|
-
"branches": 70,
|
|
137
|
-
"functions": 85,
|
|
138
|
-
"lines": 85,
|
|
139
|
-
"statements": 85
|
|
140
|
-
}
|
|
141
|
-
},
|
|
142
|
-
"coveragePathIgnorePatterns": [
|
|
143
|
-
"node_modules",
|
|
144
|
-
"dist"
|
|
145
|
-
]
|
|
146
|
-
},
|
|
147
|
-
"gitHead": "1c545f4a0c111245a66d489aeb01a0c0f78cf7cb"
|
|
2
|
+
"name": "@aws-amplify/notifications",
|
|
3
|
+
"version": "2.0.6-unstable.1c5010c.0+1c5010c",
|
|
4
|
+
"description": "Notifications category of aws-amplify",
|
|
5
|
+
"main": "./dist/cjs/index.js",
|
|
6
|
+
"module": "./dist/esm/index.mjs",
|
|
7
|
+
"react-native": "./src/index.ts",
|
|
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",
|
|
15
|
+
"test:watch": "tslint 'src/**/*.ts' && 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 -c rollup.config.mjs",
|
|
19
|
+
"build:cjs:watch": "rimraf dist/cjs && tsc -m commonjs --outDir dist/cjs --watch",
|
|
20
|
+
"build:esm:watch": "rimraf dist/esm && tsc -m esnext --outDir dist/esm --watch",
|
|
21
|
+
"build": "npm run clean && npm run build:esm-cjs && npm run build:umd",
|
|
22
|
+
"clean": "npm run clean:size && rimraf dist lib lib-esm",
|
|
23
|
+
"clean:size": "rimraf dual-publish-tmp tmp*",
|
|
24
|
+
"format": "echo \"Not implemented\"",
|
|
25
|
+
"lint": "tslint 'src/**/*.ts' && npm run ts-coverage",
|
|
26
|
+
"ts-coverage": "typescript-coverage-report -p ./tsconfig.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
|
+
"import": "./dist/esm/index.mjs",
|
|
47
|
+
"require": "./dist/cjs/index.js",
|
|
48
|
+
"react-native": "./src/index.ts"
|
|
49
|
+
},
|
|
50
|
+
"./in-app-messaging": {
|
|
51
|
+
"types": "./dist/esm/inAppMessaging/index.d.ts",
|
|
52
|
+
"import": "./dist/esm/inAppMessaging/index.mjs",
|
|
53
|
+
"require": "./dist/cjs/inAppMessaging/index.js",
|
|
54
|
+
"react-native": "./src/inAppMessaging/index.ts"
|
|
55
|
+
},
|
|
56
|
+
"./push-notifications": {
|
|
57
|
+
"types": "./dist/esm/pushNotifications/index.d.ts",
|
|
58
|
+
"import": "./dist/esm/pushNotifications/index.mjs",
|
|
59
|
+
"require": "./dist/cjs/pushNotifications/index.js",
|
|
60
|
+
"react-native": "./src/pushNotifications/index.ts"
|
|
61
|
+
},
|
|
62
|
+
"./in-app-messaging/pinpoint": {
|
|
63
|
+
"types": "./dist/esm/inAppMessaging/providers/pinpoint/index.d.ts",
|
|
64
|
+
"import": "./dist/esm/inAppMessaging/providers/pinpoint/index.mjs",
|
|
65
|
+
"require": "./dist/cjs/inAppMessaging/providers/pinpoint/index.js",
|
|
66
|
+
"react-native": "./src/inAppMessaging/providers/pinpoint/index.ts"
|
|
67
|
+
},
|
|
68
|
+
"./push-notifications/pinpoint": {
|
|
69
|
+
"types": "./dist/esm/pushNotifications/providers/pinpoint/index.d.ts",
|
|
70
|
+
"import": "./dist/esm/pushNotifications/providers/pinpoint/index.mjs",
|
|
71
|
+
"require": "./dist/cjs/pushNotifications/providers/pinpoint/index.js",
|
|
72
|
+
"react-native": "./src/pushNotifications/providers/pinpoint/index.ts"
|
|
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
|
+
"lodash": "^4.17.21",
|
|
95
|
+
"tslib": "^2.5.0"
|
|
96
|
+
},
|
|
97
|
+
"peerDependencies": {
|
|
98
|
+
"@aws-amplify/core": "6.0.6-unstable.1c5010c.0+1c5010c"
|
|
99
|
+
},
|
|
100
|
+
"devDependencies": {
|
|
101
|
+
"@aws-amplify/core": "6.0.6-unstable.1c5010c.0+1c5010c",
|
|
102
|
+
"@aws-amplify/react-native": "1.0.6-unstable.1c5010c.0+1c5010c",
|
|
103
|
+
"@rollup/plugin-typescript": "11.1.5",
|
|
104
|
+
"rollup": "3.29.4",
|
|
105
|
+
"typescript": "5.0.2"
|
|
106
|
+
},
|
|
107
|
+
"gitHead": "1c5010cfa02a646f88315464fa1ed8b8dc8cdc72"
|
|
148
108
|
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
3
|
|
|
4
|
+
import { IdentifyUserOptions } from './options';
|
|
4
5
|
import {
|
|
5
|
-
IdentifyUserOptions,
|
|
6
6
|
InAppMessageConflictHandler,
|
|
7
7
|
OnMessageInteractionEventHandler,
|
|
8
|
-
} from '
|
|
8
|
+
} from './types';
|
|
9
9
|
import {
|
|
10
10
|
InAppMessage,
|
|
11
11
|
InAppMessageInteractionEvent,
|
|
@@ -98,8 +98,8 @@ export const matchesAttributes = (
|
|
|
98
98
|
if (!eventAttributesMemo.hasOwnProperty(memoKey)) {
|
|
99
99
|
eventAttributesMemo[memoKey] =
|
|
100
100
|
!Attributes ||
|
|
101
|
-
Object.entries(Attributes).every(
|
|
102
|
-
Values?.includes(attributes[key])
|
|
101
|
+
Object.entries(Attributes).every(
|
|
102
|
+
([key, { Values }]) => Values?.includes(attributes[key])
|
|
103
103
|
);
|
|
104
104
|
}
|
|
105
105
|
return eventAttributesMemo[memoKey];
|
|
@@ -76,9 +76,8 @@ export function sessionStateChangeHandler(state: SessionState): void {
|
|
|
76
76
|
}
|
|
77
77
|
|
|
78
78
|
export async function incrementMessageCounts(messageId: string): Promise<void> {
|
|
79
|
-
const { sessionCount, dailyCount, totalCount } =
|
|
80
|
-
messageId
|
|
81
|
-
);
|
|
79
|
+
const { sessionCount, dailyCount, totalCount } =
|
|
80
|
+
await getMessageCounts(messageId);
|
|
82
81
|
setSessionCount(messageId, sessionCount + 1);
|
|
83
82
|
setDailyCount(dailyCount + 1);
|
|
84
83
|
await setTotalCount(messageId, totalCount + 1);
|
|
@@ -106,9 +105,8 @@ async function isBelowCap({
|
|
|
106
105
|
DailyCap,
|
|
107
106
|
TotalCap,
|
|
108
107
|
}: PinpointInAppMessage): Promise<Boolean> {
|
|
109
|
-
const { sessionCount, dailyCount, totalCount } =
|
|
110
|
-
CampaignId
|
|
111
|
-
);
|
|
108
|
+
const { sessionCount, dailyCount, totalCount } =
|
|
109
|
+
await getMessageCounts(CampaignId);
|
|
112
110
|
|
|
113
111
|
return (
|
|
114
112
|
(!SessionCap || sessionCount < SessionCap) &&
|
|
@@ -2,13 +2,14 @@
|
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
3
|
|
|
4
4
|
import { UserProfile } from '@aws-amplify/core';
|
|
5
|
-
import { InAppMessagingServiceOptions } from '
|
|
5
|
+
import { InAppMessagingServiceOptions } from './options';
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* Input type for `identifyUser`.
|
|
9
9
|
*/
|
|
10
10
|
export type InAppMessagingIdentifyUserInput<
|
|
11
|
-
ServiceOptions extends
|
|
11
|
+
ServiceOptions extends
|
|
12
|
+
InAppMessagingServiceOptions = InAppMessagingServiceOptions,
|
|
12
13
|
> = {
|
|
13
14
|
/**
|
|
14
15
|
* A User ID associated to the current device.
|
|
@@ -10,7 +10,8 @@ import {
|
|
|
10
10
|
} from './pushNotifications';
|
|
11
11
|
|
|
12
12
|
export type PushNotificationIdentifyUserInput<
|
|
13
|
-
ServiceOptions extends
|
|
13
|
+
ServiceOptions extends
|
|
14
|
+
PushNotificationServiceOptions = PushNotificationServiceOptions,
|
|
14
15
|
> = {
|
|
15
16
|
/**
|
|
16
17
|
* A User ID associated to the current device.
|