@aws-amplify/analytics 7.0.1-console-preview.0bbe168.0 → 7.0.1-console-preview.deaebd5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/apis/disable.d.ts +8 -0
- package/lib/apis/disable.js +14 -0
- package/lib/apis/enable.d.ts +7 -0
- package/lib/apis/enable.js +13 -0
- package/lib/apis/index.d.ts +2 -0
- package/lib/apis/index.js +9 -0
- package/lib/index.d.ts +1 -0
- package/lib/index.js +4 -1
- package/lib/providers/kinesis/index.d.ts +1 -1
- package/lib/providers/kinesis/index.js +3 -2
- package/lib/providers/kinesis/types/index.d.ts +1 -1
- package/lib/providers/kinesis/types/index.js +0 -2
- package/lib/providers/kinesis-firehose/index.d.ts +1 -1
- package/lib/providers/kinesis-firehose/index.js +3 -2
- package/lib/providers/kinesis-firehose/types/index.d.ts +1 -1
- package/lib/providers/kinesis-firehose/types/index.js +0 -2
- package/lib/providers/personalize/apis/index.d.ts +1 -0
- package/lib/providers/personalize/apis/index.js +7 -0
- package/lib/providers/personalize/apis/record.d.ts +2 -0
- package/lib/providers/personalize/apis/record.js +9 -0
- package/lib/providers/personalize/index.d.ts +1 -0
- package/lib/providers/personalize/index.js +7 -0
- package/lib/providers/personalize/types/index.d.ts +1 -0
- package/lib/providers/personalize/types/index.js +4 -0
- package/lib/providers/personalize/types/inputs.d.ts +1 -0
- package/lib/providers/personalize/types/inputs.js +4 -0
- package/lib/providers/pinpoint/apis/identifyUser.js +5 -5
- package/lib/providers/pinpoint/apis/record.js +9 -5
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/lib/utils/index.d.ts +2 -0
- package/lib/utils/index.js +12 -0
- package/lib/utils/statusHelpers.d.ts +6 -0
- package/lib/utils/statusHelpers.js +19 -0
- package/lib-esm/apis/disable.d.ts +8 -0
- package/lib-esm/apis/disable.js +11 -0
- package/lib-esm/apis/enable.d.ts +7 -0
- package/lib-esm/apis/enable.js +10 -0
- package/lib-esm/apis/index.d.ts +2 -0
- package/lib-esm/apis/index.js +4 -0
- package/lib-esm/index.d.ts +1 -0
- package/lib-esm/index.js +1 -0
- package/lib-esm/providers/kinesis/index.d.ts +1 -1
- package/lib-esm/providers/kinesis/index.js +1 -1
- package/lib-esm/providers/kinesis/types/index.d.ts +1 -1
- package/lib-esm/providers/kinesis/types/index.js +1 -1
- package/lib-esm/providers/kinesis-firehose/index.d.ts +1 -1
- package/lib-esm/providers/kinesis-firehose/index.js +1 -1
- package/lib-esm/providers/kinesis-firehose/types/index.d.ts +1 -1
- package/lib-esm/providers/kinesis-firehose/types/index.js +1 -1
- package/lib-esm/providers/personalize/apis/index.d.ts +1 -0
- package/lib-esm/providers/personalize/apis/index.js +3 -0
- package/lib-esm/providers/personalize/apis/record.d.ts +2 -0
- package/lib-esm/providers/personalize/apis/record.js +5 -0
- package/lib-esm/providers/personalize/index.d.ts +1 -0
- package/lib-esm/providers/personalize/index.js +3 -0
- package/lib-esm/providers/personalize/types/index.d.ts +1 -0
- package/lib-esm/providers/personalize/types/index.js +3 -0
- package/lib-esm/providers/personalize/types/inputs.d.ts +1 -0
- package/lib-esm/providers/personalize/types/inputs.js +3 -0
- package/lib-esm/providers/pinpoint/apis/identifyUser.js +1 -1
- package/lib-esm/providers/pinpoint/apis/record.js +5 -1
- package/lib-esm/tsconfig.tsbuildinfo +1 -1
- package/lib-esm/utils/index.d.ts +2 -0
- package/lib-esm/utils/index.js +4 -0
- package/lib-esm/utils/statusHelpers.d.ts +6 -0
- package/lib-esm/utils/statusHelpers.js +13 -0
- package/package.json +15 -5
- package/personalize/package.json +7 -0
- package/src/apis/disable.ts +13 -0
- package/src/apis/enable.ts +12 -0
- package/src/apis/index.ts +5 -0
- package/src/index.ts +1 -0
- package/src/providers/kinesis/index.ts +1 -1
- package/src/providers/kinesis/types/index.ts +1 -1
- package/src/providers/kinesis-firehose/index.ts +1 -1
- package/src/providers/kinesis-firehose/types/index.ts +1 -1
- package/src/providers/personalize/apis/index.ts +4 -0
- package/src/providers/personalize/apis/record.ts +8 -0
- package/src/providers/personalize/index.ts +4 -0
- package/src/providers/personalize/types/index.ts +4 -0
- package/src/providers/personalize/types/inputs.ts +4 -0
- package/src/providers/pinpoint/apis/identifyUser.ts +1 -1
- package/src/providers/pinpoint/apis/record.ts +9 -1
- package/src/utils/index.ts +12 -0
- package/src/utils/statusHelpers.ts +17 -0
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
|
|
4
|
+
import { disableAnalytics } from '../utils';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Disables the Analytics category.
|
|
8
|
+
*
|
|
9
|
+
* @note
|
|
10
|
+
* When Analytics is disabled events will not be buffered or transmitted to your selected service. Any auto-tracking
|
|
11
|
+
* behavior that you have configured via `configureAutoTrack` will not have any effect while Analytics is disabled.
|
|
12
|
+
*/
|
|
13
|
+
export const disable = disableAnalytics;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
|
|
4
|
+
import { enableAnalytics } from '../utils';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Enables the Analytics category to permit the transmission of events.
|
|
8
|
+
*
|
|
9
|
+
* @note
|
|
10
|
+
* Analytics is enabled by default. You do not need to call this API unless you have disabled Analytics.
|
|
11
|
+
*/
|
|
12
|
+
export const enable = enableAnalytics;
|
package/src/index.ts
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
import { AnalyticsAction } from '@aws-amplify/core/internals/utils';
|
|
5
5
|
import { updateEndpoint } from '@aws-amplify/core/internals/providers/pinpoint';
|
|
6
6
|
import { AnalyticsValidationErrorCode } from '../../../errors';
|
|
7
|
-
import { getAnalyticsUserAgentString } from '../../../utils
|
|
7
|
+
import { getAnalyticsUserAgentString } from '../../../utils';
|
|
8
8
|
import { IdentifyUserInput, UpdateEndpointException } from '../types';
|
|
9
9
|
import { resolveConfig, resolveCredentials } from '../utils';
|
|
10
10
|
|
|
@@ -10,7 +10,10 @@ import {
|
|
|
10
10
|
AnalyticsValidationErrorCode,
|
|
11
11
|
assertValidationError,
|
|
12
12
|
} from '../../../errors';
|
|
13
|
-
import {
|
|
13
|
+
import {
|
|
14
|
+
getAnalyticsUserAgentString,
|
|
15
|
+
isAnalyticsEnabled,
|
|
16
|
+
} from '../../../utils';
|
|
14
17
|
import { RecordInput } from '../types';
|
|
15
18
|
import { resolveConfig, resolveCredentials } from '../utils';
|
|
16
19
|
|
|
@@ -47,6 +50,11 @@ const logger = new Logger('Analytics');
|
|
|
47
50
|
export const record = (input: RecordInput): void => {
|
|
48
51
|
const { appId, region } = resolveConfig();
|
|
49
52
|
|
|
53
|
+
if (!isAnalyticsEnabled()) {
|
|
54
|
+
logger.debug('Analytics is disabled, event will not be recorded.');
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
|
|
50
58
|
assertValidationError(!!input.name, AnalyticsValidationErrorCode.NoEventName);
|
|
51
59
|
|
|
52
60
|
resolveCredentials()
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
|
|
4
|
+
export {
|
|
5
|
+
enableAnalytics,
|
|
6
|
+
disableAnalytics,
|
|
7
|
+
isAnalyticsEnabled,
|
|
8
|
+
} from './statusHelpers';
|
|
9
|
+
export {
|
|
10
|
+
getAnalyticsUserAgent,
|
|
11
|
+
getAnalyticsUserAgentString,
|
|
12
|
+
} from './userAgent';
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
|
|
4
|
+
let analyticsEnabled = true;
|
|
5
|
+
|
|
6
|
+
export const enableAnalytics = () => {
|
|
7
|
+
analyticsEnabled = true;
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
export const disableAnalytics = () => {
|
|
11
|
+
analyticsEnabled = false;
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Returns the current status of the Analytics category.
|
|
16
|
+
*/
|
|
17
|
+
export const isAnalyticsEnabled = () => analyticsEnabled;
|