@aws-amplify/notifications 2.0.4-unstable.136f85f.0 → 2.0.4
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/package.json
CHANGED
|
@@ -1,148 +1,148 @@
|
|
|
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
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
2
|
+
"name": "@aws-amplify/notifications",
|
|
3
|
+
"version": "2.0.4",
|
|
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.0"
|
|
99
|
+
},
|
|
100
|
+
"devDependencies": {
|
|
101
|
+
"@aws-amplify/core": "6.0.4",
|
|
102
|
+
"@aws-amplify/react-native": "1.0.4",
|
|
103
|
+
"@rollup/plugin-typescript": "11.1.5",
|
|
104
|
+
"rollup": "3.29.4",
|
|
105
|
+
"typescript": "5.0.2"
|
|
106
|
+
},
|
|
107
|
+
"jest": {
|
|
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": "0a6bc80a5e2bbd9b6f0c8815f13e227cc54b7da1"
|
|
148
148
|
}
|
|
@@ -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
|
-
|
|
101
|
+
Object.entries(Attributes).every(([key, { Values }]) =>
|
|
102
|
+
Values?.includes(attributes[key])
|
|
103
103
|
);
|
|
104
104
|
}
|
|
105
105
|
return eventAttributesMemo[memoKey];
|
|
@@ -76,8 +76,9 @@ 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
|
-
|
|
79
|
+
const { sessionCount, dailyCount, totalCount } = await getMessageCounts(
|
|
80
|
+
messageId
|
|
81
|
+
);
|
|
81
82
|
setSessionCount(messageId, sessionCount + 1);
|
|
82
83
|
setDailyCount(dailyCount + 1);
|
|
83
84
|
await setTotalCount(messageId, totalCount + 1);
|
|
@@ -105,8 +106,9 @@ async function isBelowCap({
|
|
|
105
106
|
DailyCap,
|
|
106
107
|
TotalCap,
|
|
107
108
|
}: PinpointInAppMessage): Promise<Boolean> {
|
|
108
|
-
const { sessionCount, dailyCount, totalCount } =
|
|
109
|
-
|
|
109
|
+
const { sessionCount, dailyCount, totalCount } = await getMessageCounts(
|
|
110
|
+
CampaignId
|
|
111
|
+
);
|
|
110
112
|
|
|
111
113
|
return (
|
|
112
114
|
(!SessionCap || sessionCount < SessionCap) &&
|
|
@@ -8,8 +8,7 @@ import { InAppMessagingServiceOptions } from '.';
|
|
|
8
8
|
* Input type for `identifyUser`.
|
|
9
9
|
*/
|
|
10
10
|
export type InAppMessagingIdentifyUserInput<
|
|
11
|
-
ServiceOptions extends
|
|
12
|
-
InAppMessagingServiceOptions = InAppMessagingServiceOptions,
|
|
11
|
+
ServiceOptions extends InAppMessagingServiceOptions = InAppMessagingServiceOptions
|
|
13
12
|
> = {
|
|
14
13
|
/**
|
|
15
14
|
* A User ID associated to the current device.
|
|
@@ -10,8 +10,7 @@ import {
|
|
|
10
10
|
} from './pushNotifications';
|
|
11
11
|
|
|
12
12
|
export type PushNotificationIdentifyUserInput<
|
|
13
|
-
ServiceOptions extends
|
|
14
|
-
PushNotificationServiceOptions = PushNotificationServiceOptions,
|
|
13
|
+
ServiceOptions extends PushNotificationServiceOptions = PushNotificationServiceOptions
|
|
15
14
|
> = {
|
|
16
15
|
/**
|
|
17
16
|
* A User ID associated to the current device.
|