@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,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Disables the Analytics category.
|
|
3
|
+
*
|
|
4
|
+
* @note
|
|
5
|
+
* When Analytics is disabled events will not be buffered or transmitted to your selected service. Any auto-tracking
|
|
6
|
+
* behavior that you have configured via `configureAutoTrack` will not have any effect while Analytics is disabled.
|
|
7
|
+
*/
|
|
8
|
+
export declare const disable: () => void;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
3
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
4
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
+
exports.disable = void 0;
|
|
6
|
+
var utils_1 = require("../utils");
|
|
7
|
+
/**
|
|
8
|
+
* Disables the Analytics category.
|
|
9
|
+
*
|
|
10
|
+
* @note
|
|
11
|
+
* When Analytics is disabled events will not be buffered or transmitted to your selected service. Any auto-tracking
|
|
12
|
+
* behavior that you have configured via `configureAutoTrack` will not have any effect while Analytics is disabled.
|
|
13
|
+
*/
|
|
14
|
+
exports.disable = utils_1.disableAnalytics;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
3
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
4
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
+
exports.enable = void 0;
|
|
6
|
+
var utils_1 = require("../utils");
|
|
7
|
+
/**
|
|
8
|
+
* Enables the Analytics category to permit the transmission of events.
|
|
9
|
+
*
|
|
10
|
+
* @note
|
|
11
|
+
* Analytics is enabled by default. You do not need to call this API unless you have disabled Analytics.
|
|
12
|
+
*/
|
|
13
|
+
exports.enable = utils_1.enableAnalytics;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
3
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
4
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
+
exports.disable = exports.enable = void 0;
|
|
6
|
+
var enable_1 = require("./enable");
|
|
7
|
+
Object.defineProperty(exports, "enable", { enumerable: true, get: function () { return enable_1.enable; } });
|
|
8
|
+
var disable_1 = require("./disable");
|
|
9
|
+
Object.defineProperty(exports, "disable", { enumerable: true, get: function () { return disable_1.disable; } });
|
package/lib/index.d.ts
CHANGED
package/lib/index.js
CHANGED
|
@@ -2,9 +2,12 @@
|
|
|
2
2
|
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
3
3
|
// SPDX-License-Identifier: Apache-2.0
|
|
4
4
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
-
exports.AnalyticsError = exports.identifyUser = exports.record = void 0;
|
|
5
|
+
exports.AnalyticsError = exports.disable = exports.enable = exports.identifyUser = exports.record = void 0;
|
|
6
6
|
var pinpoint_1 = require("./providers/pinpoint");
|
|
7
7
|
Object.defineProperty(exports, "record", { enumerable: true, get: function () { return pinpoint_1.record; } });
|
|
8
8
|
Object.defineProperty(exports, "identifyUser", { enumerable: true, get: function () { return pinpoint_1.identifyUser; } });
|
|
9
|
+
var apis_1 = require("./apis");
|
|
10
|
+
Object.defineProperty(exports, "enable", { enumerable: true, get: function () { return apis_1.enable; } });
|
|
11
|
+
Object.defineProperty(exports, "disable", { enumerable: true, get: function () { return apis_1.disable; } });
|
|
9
12
|
var errors_1 = require("./errors");
|
|
10
13
|
Object.defineProperty(exports, "AnalyticsError", { enumerable: true, get: function () { return errors_1.AnalyticsError; } });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export
|
|
1
|
+
export { record } from './apis';
|
|
@@ -2,5 +2,6 @@
|
|
|
2
2
|
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
3
3
|
// SPDX-License-Identifier: Apache-2.0
|
|
4
4
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
exports.record = void 0;
|
|
6
|
+
var apis_1 = require("./apis");
|
|
7
|
+
Object.defineProperty(exports, "record", { enumerable: true, get: function () { return apis_1.record; } });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export
|
|
1
|
+
export { RecordInput } from './inputs';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export
|
|
1
|
+
export { record } from './apis';
|
|
@@ -2,5 +2,6 @@
|
|
|
2
2
|
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
3
3
|
// SPDX-License-Identifier: Apache-2.0
|
|
4
4
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
exports.record = void 0;
|
|
6
|
+
var apis_1 = require("./apis");
|
|
7
|
+
Object.defineProperty(exports, "record", { enumerable: true, get: function () { return apis_1.record; } });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export
|
|
1
|
+
export { RecordInput } from './inputs';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { record } from './record';
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
3
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
4
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
+
exports.record = void 0;
|
|
6
|
+
var record_1 = require("./record");
|
|
7
|
+
Object.defineProperty(exports, "record", { enumerable: true, get: function () { return record_1.record; } });
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
3
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
4
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
+
exports.record = void 0;
|
|
6
|
+
var record = function (input) {
|
|
7
|
+
throw new Error('Not Yet Implemented');
|
|
8
|
+
};
|
|
9
|
+
exports.record = record;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { record } from './apis';
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
3
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
4
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
+
exports.record = void 0;
|
|
6
|
+
var apis_1 = require("./apis");
|
|
7
|
+
Object.defineProperty(exports, "record", { enumerable: true, get: function () { return apis_1.record; } });
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { RecordInput } from './inputs';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type RecordInput = {};
|
|
@@ -6,8 +6,8 @@ exports.identifyUser = void 0;
|
|
|
6
6
|
var tslib_1 = require("tslib");
|
|
7
7
|
var utils_1 = require("@aws-amplify/core/internals/utils");
|
|
8
8
|
var pinpoint_1 = require("@aws-amplify/core/internals/providers/pinpoint");
|
|
9
|
-
var
|
|
10
|
-
var
|
|
9
|
+
var utils_2 = require("../../../utils");
|
|
10
|
+
var utils_3 = require("../utils");
|
|
11
11
|
/**
|
|
12
12
|
* Sends information about a user to Pinpoint. Sending user information allows you to associate a user to their user
|
|
13
13
|
* profile and activities or actions in your application. Activity can be tracked across devices & platforms by using
|
|
@@ -60,10 +60,10 @@ var identifyUser = function (_a) {
|
|
|
60
60
|
var _d;
|
|
61
61
|
return tslib_1.__generator(this, function (_e) {
|
|
62
62
|
switch (_e.label) {
|
|
63
|
-
case 0: return [4 /*yield*/, (0,
|
|
63
|
+
case 0: return [4 /*yield*/, (0, utils_3.resolveCredentials)()];
|
|
64
64
|
case 1:
|
|
65
65
|
_b = _e.sent(), credentials = _b.credentials, identityId = _b.identityId;
|
|
66
|
-
_c = (0,
|
|
66
|
+
_c = (0, utils_3.resolveConfig)(), appId = _c.appId, region = _c.region;
|
|
67
67
|
userAttributes = ((_d = options === null || options === void 0 ? void 0 : options.serviceOptions) !== null && _d !== void 0 ? _d : {}).userAttributes;
|
|
68
68
|
(0, pinpoint_1.updateEndpoint)({
|
|
69
69
|
appId: appId,
|
|
@@ -74,7 +74,7 @@ var identifyUser = function (_a) {
|
|
|
74
74
|
userAttributes: userAttributes,
|
|
75
75
|
userId: userId,
|
|
76
76
|
userProfile: userProfile,
|
|
77
|
-
userAgentValue: (0,
|
|
77
|
+
userAgentValue: (0, utils_2.getAnalyticsUserAgentString)(utils_1.AnalyticsAction.UpdateEndpoint),
|
|
78
78
|
});
|
|
79
79
|
return [2 /*return*/];
|
|
80
80
|
}
|
|
@@ -6,8 +6,8 @@ exports.record = void 0;
|
|
|
6
6
|
var utils_1 = require("@aws-amplify/core/internals/utils");
|
|
7
7
|
var pinpoint_1 = require("@aws-amplify/core/internals/providers/pinpoint");
|
|
8
8
|
var errors_1 = require("../../../errors");
|
|
9
|
-
var
|
|
10
|
-
var
|
|
9
|
+
var utils_2 = require("../../../utils");
|
|
10
|
+
var utils_3 = require("../utils");
|
|
11
11
|
var logger = new utils_1.ConsoleLogger('Analytics');
|
|
12
12
|
/**
|
|
13
13
|
* Records an Analytic event to Pinpoint. Events will be buffered and periodically sent to Pinpoint.
|
|
@@ -38,9 +38,13 @@ var logger = new utils_1.ConsoleLogger('Analytics');
|
|
|
38
38
|
* ```
|
|
39
39
|
*/
|
|
40
40
|
var record = function (input) {
|
|
41
|
-
var _a = (0,
|
|
41
|
+
var _a = (0, utils_3.resolveConfig)(), appId = _a.appId, region = _a.region;
|
|
42
|
+
if (!(0, utils_2.isAnalyticsEnabled)()) {
|
|
43
|
+
logger.debug('Analytics is disabled, event will not be recorded.');
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
42
46
|
(0, errors_1.assertValidationError)(!!input.name, errors_1.AnalyticsValidationErrorCode.NoEventName);
|
|
43
|
-
(0,
|
|
47
|
+
(0, utils_3.resolveCredentials)()
|
|
44
48
|
.then(function (_a) {
|
|
45
49
|
var credentials = _a.credentials, identityId = _a.identityId;
|
|
46
50
|
(0, pinpoint_1.record)({
|
|
@@ -50,7 +54,7 @@ var record = function (input) {
|
|
|
50
54
|
event: input,
|
|
51
55
|
identityId: identityId,
|
|
52
56
|
region: region,
|
|
53
|
-
userAgentValue: (0,
|
|
57
|
+
userAgentValue: (0, utils_2.getAnalyticsUserAgentString)(utils_1.AnalyticsAction.Record),
|
|
54
58
|
});
|
|
55
59
|
})
|
|
56
60
|
.catch(function (e) {
|