@aws-amplify/notifications 2.0.5 → 2.0.6-unstable.f2b7a8d.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.
@@ -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 ocurred.',
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 ocurred.',\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,+BAA+B;AACpD,YAAY,eAAe,EAAE,KAAK;AAClC,SAAS,CAAC,CAAC;AACX,KAAK;AACL,CAAC;AACD,OAAO,CAAC,kBAAkB,GAAG,kBAAkB;;"}
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 ocurred.',
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 ocurred.',\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,+BAA+B;AACpD,YAAY,eAAe,EAAE,KAAK;AAClC,SAAS,CAAC,CAAC;AACX,KAAK;AACL;;;;"}
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;;;;"}
package/package.json CHANGED
@@ -1,148 +1,148 @@
1
1
  {
2
- "name": "@aws-amplify/notifications",
3
- "version": "2.0.5",
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.5",
102
- "@aws-amplify/react-native": "1.0.5",
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": "1c545f4a0c111245a66d489aeb01a0c0f78cf7cb"
2
+ "name": "@aws-amplify/notifications",
3
+ "version": "2.0.6-unstable.f2b7a8d.0+f2b7a8d",
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.f2b7a8d.0+f2b7a8d"
99
+ },
100
+ "devDependencies": {
101
+ "@aws-amplify/core": "6.0.6-unstable.f2b7a8d.0+f2b7a8d",
102
+ "@aws-amplify/react-native": "1.0.6-unstable.f2b7a8d.0+f2b7a8d",
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": "f2b7a8d78058af2e1c04f7d507525641def667c3"
148
148
  }
@@ -17,7 +17,7 @@ export function assertServiceError(
17
17
  ) {
18
18
  throw new InAppMessagingError({
19
19
  name: AmplifyErrorCode.Unknown,
20
- message: 'An unknown error has ocurred.',
20
+ message: 'An unknown error has occurred.',
21
21
  underlyingError: error,
22
22
  });
23
23
  }
@@ -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(([key, { Values }]) =>
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 } = await getMessageCounts(
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 } = await getMessageCounts(
110
- CampaignId
111
- );
108
+ const { sessionCount, dailyCount, totalCount } =
109
+ await getMessageCounts(CampaignId);
112
110
 
113
111
  return (
114
112
  (!SessionCap || sessionCount < SessionCap) &&
@@ -8,7 +8,8 @@ import { InAppMessagingServiceOptions } from '.';
8
8
  * Input type for `identifyUser`.
9
9
  */
10
10
  export type InAppMessagingIdentifyUserInput<
11
- ServiceOptions extends InAppMessagingServiceOptions = InAppMessagingServiceOptions
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 PushNotificationServiceOptions = PushNotificationServiceOptions
13
+ ServiceOptions extends
14
+ PushNotificationServiceOptions = PushNotificationServiceOptions,
14
15
  > = {
15
16
  /**
16
17
  * A User ID associated to the current device.