@microsoft/feature-management-applicationinsights-browser 2.1.0-preview.1 → 2.2.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.
@@ -1 +1 @@
1
- {"version":3,"file":"telemetry.js","sources":["../../src/telemetry.ts"],"sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { EvaluationResult, createFeatureEvaluationEventProperties, ITargetingContextAccessor } from \"@microsoft/feature-management\";\nimport { ApplicationInsights, IEventTelemetry, ITelemetryItem } 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\n/**\n * Creates a telemetry initializer that adds targeting id to telemetry item's custom properties.\n * @param targetingContextAccessor The accessor function to get the targeting context.\n * @returns A telemetry initializer that attaches targeting id to telemetry items.\n */\nexport function createTargetingTelemetryInitializer(targetingContextAccessor: ITargetingContextAccessor): (item: ITelemetryItem) => void {\n return (item: ITelemetryItem) => {\n const targetingContext = targetingContextAccessor.getTargetingContext();\n if (targetingContext !== undefined) {\n if (targetingContext?.userId === undefined) {\n console.warn(\"Targeting id is undefined.\");\n }\n item.data = {...item.data, [TARGETING_ID]: targetingContext?.userId || \"\"};\n }\n };\n}\n"],"names":[],"mappings":";;AAAA;AACA;AAKA,MAAM,YAAY,GAAG,aAAa;AAClC,MAAM,6BAA6B,GAAG,mBAAmB;AAEzD;;;;AAIG;AACG,SAAU,wBAAwB,CAAC,MAA2B,EAAA;IAChE,OAAO,CAAC,MAAwB,KAAI;AAChC,QAAA,IAAI,MAAM,CAAC,OAAO,KAAK,SAAS,EAAE;YAC9B;;AAGJ,QAAA,MAAM,eAAe,GAAG,sCAAsC,CAAC,MAAM,CAAC;QACtE,MAAM,CAAC,UAAU,CAAC,EAAE,IAAI,EAAE,6BAA6B,EAAE,EAAE,eAAe,CAAC;AAC/E,KAAC;AACL;AAEA;;;;;;;;;AASG;AACG,SAAU,UAAU,CAAC,MAA2B,EAAE,WAAmB,EAAE,KAAsB,EAAE,gBAAuC,EAAA;AACxI,IAAA,MAAM,UAAU,GAAG,gBAAgB,GAAG,EAAE,GAAG,gBAAgB,EAAE,GAAG,EAAE;;AAElE,IAAA,UAAU,CAAC,YAAY,CAAC,GAAG,WAAW,GAAG,WAAW,CAAC,QAAQ,EAAE,GAAG,EAAE;AACpE,IAAA,MAAM,CAAC,UAAU,CAAC,KAAK,EAAE,UAAU,CAAC;AACxC;AAEA;;;;AAIG;AACG,SAAU,mCAAmC,CAAC,wBAAmD,EAAA;IACnG,OAAO,CAAC,IAAoB,KAAI;AAC5B,QAAA,MAAM,gBAAgB,GAAG,wBAAwB,CAAC,mBAAmB,EAAE;AACvE,QAAA,IAAI,gBAAgB,KAAK,SAAS,EAAE;AAChC,YAAA,IAAI,gBAAgB,EAAE,MAAM,KAAK,SAAS,EAAE;AACxC,gBAAA,OAAO,CAAC,IAAI,CAAC,4BAA4B,CAAC;;AAE9C,YAAA,IAAI,CAAC,IAAI,GAAG,EAAC,GAAG,IAAI,CAAC,IAAI,EAAE,CAAC,YAAY,GAAG,gBAAgB,EAAE,MAAM,IAAI,EAAE,EAAC;;AAElF,KAAC;AACL;;;;"}
1
+ {"version":3,"file":"telemetry.js","sources":["../../src/telemetry.ts"],"sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { EvaluationResult, createFeatureEvaluationEventProperties, ITargetingContextAccessor } from \"@microsoft/feature-management\";\nimport { ApplicationInsights, IEventTelemetry, ITelemetryItem } 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\n/**\n * Creates a telemetry initializer that adds targeting id to telemetry item's custom properties.\n * @param targetingContextAccessor The accessor function to get the targeting context.\n * @returns A telemetry initializer that attaches targeting id to telemetry items.\n */\nexport function createTargetingTelemetryInitializer(targetingContextAccessor: ITargetingContextAccessor): (item: ITelemetryItem) => void {\n return (item: ITelemetryItem) => {\n const targetingContext = targetingContextAccessor.getTargetingContext();\n if (targetingContext !== undefined) {\n if (targetingContext?.userId === undefined) {\n console.warn(\"Targeting id is undefined.\");\n }\n item.data = {...item.data, [TARGETING_ID]: targetingContext?.userId || \"\"};\n }\n };\n}\n"],"names":[],"mappings":";;AAAA;AACA;AAKA,MAAM,YAAY,GAAG,aAAa;AAClC,MAAM,6BAA6B,GAAG,mBAAmB;AAEzD;;;;AAIG;AACG,SAAU,wBAAwB,CAAC,MAA2B,EAAA;IAChE,OAAO,CAAC,MAAwB,KAAI;AAChC,QAAA,IAAI,MAAM,CAAC,OAAO,KAAK,SAAS,EAAE;YAC9B;QACJ;AAEA,QAAA,MAAM,eAAe,GAAG,sCAAsC,CAAC,MAAM,CAAC;QACtE,MAAM,CAAC,UAAU,CAAC,EAAE,IAAI,EAAE,6BAA6B,EAAE,EAAE,eAAe,CAAC;AAC/E,IAAA,CAAC;AACL;AAEA;;;;;;;;;AASG;AACG,SAAU,UAAU,CAAC,MAA2B,EAAE,WAAmB,EAAE,KAAsB,EAAE,gBAAuC,EAAA;AACxI,IAAA,MAAM,UAAU,GAAG,gBAAgB,GAAG,EAAE,GAAG,gBAAgB,EAAE,GAAG,EAAE;;AAElE,IAAA,UAAU,CAAC,YAAY,CAAC,GAAG,WAAW,GAAG,WAAW,CAAC,QAAQ,EAAE,GAAG,EAAE;AACpE,IAAA,MAAM,CAAC,UAAU,CAAC,KAAK,EAAE,UAAU,CAAC;AACxC;AAEA;;;;AAIG;AACG,SAAU,mCAAmC,CAAC,wBAAmD,EAAA;IACnG,OAAO,CAAC,IAAoB,KAAI;AAC5B,QAAA,MAAM,gBAAgB,GAAG,wBAAwB,CAAC,mBAAmB,EAAE;AACvE,QAAA,IAAI,gBAAgB,KAAK,SAAS,EAAE;AAChC,YAAA,IAAI,gBAAgB,EAAE,MAAM,KAAK,SAAS,EAAE;AACxC,gBAAA,OAAO,CAAC,IAAI,CAAC,4BAA4B,CAAC;YAC9C;AACA,YAAA,IAAI,CAAC,IAAI,GAAG,EAAC,GAAG,IAAI,CAAC,IAAI,EAAE,CAAC,YAAY,GAAG,gBAAgB,EAAE,MAAM,IAAI,EAAE,EAAC;QAC9E;AACJ,IAAA,CAAC;AACL;;;;"}
@@ -1,6 +1,6 @@
1
1
  // Copyright (c) Microsoft Corporation.
2
2
  // Licensed under the MIT license.
3
- const VERSION = "2.1.0-preview.1";
3
+ const VERSION = "2.2.0";
4
4
 
5
5
  export { VERSION };
6
6
  //# sourceMappingURL=version.js.map
@@ -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.1.0-preview.1\";\n"],"names":[],"mappings":"AAAA;AACA;AAEO,MAAM,OAAO,GAAG;;;;"}
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.2.0\";\n"],"names":[],"mappings":"AAAA;AACA;AAEO,MAAM,OAAO,GAAG;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@microsoft/feature-management-applicationinsights-browser",
3
- "version": "2.1.0-preview.1",
3
+ "version": "2.2.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
5
  "main": "./dist/esm/index.js",
6
6
  "module": "./dist/esm/index.js",
@@ -26,7 +26,7 @@
26
26
  },
27
27
  "license": "MIT",
28
28
  "publishConfig": {
29
- "tag": "preview"
29
+ "tag": "latest"
30
30
  },
31
31
  "bugs": {
32
32
  "url": "https://github.com/microsoft/FeatureManagement-JavaScript/issues"
@@ -46,7 +46,7 @@
46
46
  },
47
47
  "dependencies": {
48
48
  "@microsoft/applicationinsights-web": "^3.3.2",
49
- "@microsoft/feature-management": "2.1.0-preview.1"
49
+ "@microsoft/feature-management": "2.2.0"
50
50
  }
51
51
  }
52
52
 
package/types/index.d.ts CHANGED
@@ -27,6 +27,6 @@ declare function trackEvent(client: ApplicationInsights, targetingId: string, ev
27
27
  */
28
28
  declare function createTargetingTelemetryInitializer(targetingContextAccessor: ITargetingContextAccessor): (item: ITelemetryItem) => void;
29
29
 
30
- declare const VERSION = "2.1.0-preview.1";
30
+ declare const VERSION = "2.2.0";
31
31
 
32
32
  export { VERSION, createTargetingTelemetryInitializer, createTelemetryPublisher, trackEvent };