@microsoft/feature-management-applicationinsights-browser 2.0.0-preview.3 → 2.0.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/README.md +1 -1
- package/dist/esm/version.js +1 -1
- package/dist/esm/version.js.map +1 -1
- package/package.json +7 -3
- package/types/index.d.ts +1 -1
- package/dist/umd/index.js +0 -51
- package/dist/umd/index.js.map +0 -1
package/README.md
CHANGED
|
@@ -9,7 +9,7 @@ Feature Management Application Insights Plugin for Browser provides a solution f
|
|
|
9
9
|
``` javascript
|
|
10
10
|
import { ApplicationInsights } from "@microsoft/applicationinsights-web"
|
|
11
11
|
import { FeatureManager, ConfigurationObjectFeatureFlagProvider } from "@microsoft/feature-management";
|
|
12
|
-
import {
|
|
12
|
+
import { createTelemetryPublisher, trackEvent } from "@microsoft/feature-management-applicationinsights-browser";
|
|
13
13
|
|
|
14
14
|
const appInsights = new ApplicationInsights({ config: {
|
|
15
15
|
connectionString: CONNECTION_STRING
|
package/dist/esm/version.js
CHANGED
package/dist/esm/version.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"version.js","sources":["../../src/version.ts"],"sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nexport const VERSION = \"2.0.0
|
|
1
|
+
{"version":3,"file":"version.js","sources":["../../src/version.ts"],"sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nexport const VERSION = \"2.0.0\";\n"],"names":[],"mappings":"AAAA;AACA;AAEO,MAAM,OAAO,GAAG;;;;"}
|
package/package.json
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@microsoft/feature-management-applicationinsights-browser",
|
|
3
|
-
"version": "2.0.0
|
|
3
|
+
"version": "2.0.0",
|
|
4
4
|
"description": "Feature Management Application Insights Plugin for Browser provides a solution for sending feature flag evaluation events produced by the Feature Management library.",
|
|
5
|
-
"main": "./dist/
|
|
5
|
+
"main": "./dist/esm/index.js",
|
|
6
6
|
"module": "./dist/esm/index.js",
|
|
7
|
+
"type": "module",
|
|
7
8
|
"types": "types/index.d.ts",
|
|
8
9
|
"files": [
|
|
9
10
|
"dist/",
|
|
@@ -24,6 +25,9 @@
|
|
|
24
25
|
"url": "git+https://github.com/microsoft/FeatureManagement-JavaScript.git"
|
|
25
26
|
},
|
|
26
27
|
"license": "MIT",
|
|
28
|
+
"publishConfig": {
|
|
29
|
+
"tag": "latest"
|
|
30
|
+
},
|
|
27
31
|
"bugs": {
|
|
28
32
|
"url": "https://github.com/microsoft/FeatureManagement-JavaScript/issues"
|
|
29
33
|
},
|
|
@@ -42,7 +46,7 @@
|
|
|
42
46
|
},
|
|
43
47
|
"dependencies": {
|
|
44
48
|
"@microsoft/applicationinsights-web": "^3.3.2",
|
|
45
|
-
"@microsoft/feature-management": "2.0.0
|
|
49
|
+
"@microsoft/feature-management": "2.0.0"
|
|
46
50
|
}
|
|
47
51
|
}
|
|
48
52
|
|
package/types/index.d.ts
CHANGED
|
@@ -21,6 +21,6 @@ declare function trackEvent(client: ApplicationInsights, targetingId: string, ev
|
|
|
21
21
|
[key: string]: any;
|
|
22
22
|
}): void;
|
|
23
23
|
|
|
24
|
-
declare const VERSION = "2.0.0
|
|
24
|
+
declare const VERSION = "2.0.0";
|
|
25
25
|
|
|
26
26
|
export { VERSION, createTelemetryPublisher, trackEvent };
|
package/dist/umd/index.js
DELETED
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
(function (global, factory) {
|
|
2
|
-
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@microsoft/feature-management')) :
|
|
3
|
-
typeof define === 'function' && define.amd ? define(['exports', '@microsoft/feature-management'], factory) :
|
|
4
|
-
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.FeatureManagementApplicationInsights = {}, global.featureManagement));
|
|
5
|
-
})(this, (function (exports, featureManagement) { 'use strict';
|
|
6
|
-
|
|
7
|
-
// Copyright (c) Microsoft Corporation.
|
|
8
|
-
// Licensed under the MIT license.
|
|
9
|
-
const TARGETING_ID = "TargetingId";
|
|
10
|
-
const FEATURE_EVALUATION_EVENT_NAME = "FeatureEvaluation";
|
|
11
|
-
/**
|
|
12
|
-
* Creates a telemetry publisher that sends feature evaluation events to Application Insights.
|
|
13
|
-
* @param client The Application Insights telemetry client.
|
|
14
|
-
* @returns A callback function that takes an evaluation result and tracks an event with the evaluation details.
|
|
15
|
-
*/
|
|
16
|
-
function createTelemetryPublisher(client) {
|
|
17
|
-
return (result) => {
|
|
18
|
-
if (result.feature === undefined) {
|
|
19
|
-
return;
|
|
20
|
-
}
|
|
21
|
-
const eventProperties = featureManagement.createFeatureEvaluationEventProperties(result);
|
|
22
|
-
client.trackEvent({ name: FEATURE_EVALUATION_EVENT_NAME }, eventProperties);
|
|
23
|
-
};
|
|
24
|
-
}
|
|
25
|
-
/**
|
|
26
|
-
* Tracks a custom event using Application Insights, ensuring that the "TargetingId"
|
|
27
|
-
* is included in the custom properties. If the "TargetingId" already exists in
|
|
28
|
-
* the provided custom properties, it will be overwritten.
|
|
29
|
-
*
|
|
30
|
-
* @param client The Application Insights client instance used to track the event.
|
|
31
|
-
* @param targetingId The unique targeting identifier that will be included in the custom properties.
|
|
32
|
-
* @param event The event telemetry object to be tracked, containing event details.
|
|
33
|
-
* @param customProperties (Optional) Additional properties to include in the event telemetry.
|
|
34
|
-
*/
|
|
35
|
-
function trackEvent(client, targetingId, event, customProperties) {
|
|
36
|
-
const properties = customProperties ? { ...customProperties } : {};
|
|
37
|
-
// Ensure targetingId is string so that it will be placed in customDimensions
|
|
38
|
-
properties[TARGETING_ID] = targetingId ? targetingId.toString() : "";
|
|
39
|
-
client.trackEvent(event, properties);
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
// Copyright (c) Microsoft Corporation.
|
|
43
|
-
// Licensed under the MIT license.
|
|
44
|
-
const VERSION = "2.0.0-preview.3";
|
|
45
|
-
|
|
46
|
-
exports.VERSION = VERSION;
|
|
47
|
-
exports.createTelemetryPublisher = createTelemetryPublisher;
|
|
48
|
-
exports.trackEvent = trackEvent;
|
|
49
|
-
|
|
50
|
-
}));
|
|
51
|
-
//# sourceMappingURL=index.js.map
|
package/dist/umd/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../src/telemetry.ts","../../src/version.ts"],"sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { EvaluationResult, createFeatureEvaluationEventProperties } from \"@microsoft/feature-management\";\nimport { ApplicationInsights, IEventTelemetry } from \"@microsoft/applicationinsights-web\";\n\nconst TARGETING_ID = \"TargetingId\";\nconst FEATURE_EVALUATION_EVENT_NAME = \"FeatureEvaluation\";\n\n/**\n * Creates a telemetry publisher that sends feature evaluation events to Application Insights.\n * @param client The Application Insights telemetry client.\n * @returns A callback function that takes an evaluation result and tracks an event with the evaluation details.\n */\nexport function createTelemetryPublisher(client: ApplicationInsights): (result: EvaluationResult) => void {\n return (result: EvaluationResult) => {\n if (result.feature === undefined) {\n return;\n }\n\n const eventProperties = createFeatureEvaluationEventProperties(result);\n client.trackEvent({ name: FEATURE_EVALUATION_EVENT_NAME }, eventProperties);\n };\n}\n\n/**\n * Tracks a custom event using Application Insights, ensuring that the \"TargetingId\"\n * is included in the custom properties. If the \"TargetingId\" already exists in\n * the provided custom properties, it will be overwritten.\n *\n * @param client The Application Insights client instance used to track the event.\n * @param targetingId The unique targeting identifier that will be included in the custom properties.\n * @param event The event telemetry object to be tracked, containing event details.\n * @param customProperties (Optional) Additional properties to include in the event telemetry.\n */\nexport function trackEvent(client: ApplicationInsights, targetingId: string, event: IEventTelemetry, customProperties?: {[key: string]: any}): void {\n const properties = customProperties ? { ...customProperties } : {};\n // Ensure targetingId is string so that it will be placed in customDimensions\n properties[TARGETING_ID] = targetingId ? targetingId.toString() : \"\";\n client.trackEvent(event, properties);\n}\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nexport const VERSION = \"2.0.0-preview.3\";\n"],"names":["createFeatureEvaluationEventProperties"],"mappings":";;;;;;IAAA;IACA;IAKA,MAAM,YAAY,GAAG,aAAa;IAClC,MAAM,6BAA6B,GAAG,mBAAmB;IAEzD;;;;IAIG;IACG,SAAU,wBAAwB,CAAC,MAA2B,EAAA;QAChE,OAAO,CAAC,MAAwB,KAAI;IAChC,QAAA,IAAI,MAAM,CAAC,OAAO,KAAK,SAAS,EAAE;gBAC9B;;IAGJ,QAAA,MAAM,eAAe,GAAGA,wDAAsC,CAAC,MAAM,CAAC;YACtE,MAAM,CAAC,UAAU,CAAC,EAAE,IAAI,EAAE,6BAA6B,EAAE,EAAE,eAAe,CAAC;IAC/E,KAAC;IACL;IAEA;;;;;;;;;IASG;IACG,SAAU,UAAU,CAAC,MAA2B,EAAE,WAAmB,EAAE,KAAsB,EAAE,gBAAuC,EAAA;IACxI,IAAA,MAAM,UAAU,GAAG,gBAAgB,GAAG,EAAE,GAAG,gBAAgB,EAAE,GAAG,EAAE;;IAElE,IAAA,UAAU,CAAC,YAAY,CAAC,GAAG,WAAW,GAAG,WAAW,CAAC,QAAQ,EAAE,GAAG,EAAE;IACpE,IAAA,MAAM,CAAC,UAAU,CAAC,KAAK,EAAE,UAAU,CAAC;IACxC;;ICxCA;IACA;AAEO,UAAM,OAAO,GAAG;;;;;;;;;;"}
|