Skip to content
Permalink
Browse files

Disabled telemetry.

  • Loading branch information...
tonyanziano committed Feb 20, 2019
1 parent 57b1776 commit 2cbf9c3f2675159c8cbdb3be09610d6aed874f5c
@@ -8,6 +8,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## Fixed
- [client] Use correct casing for user id prop for web chat in PR [#1374](https://github.com/Microsoft/BotFramework-Emulator/pull/1374)

## Removed
- [telemetry] Disabled telemetry and the ability to opt-in to collect usage data in PR [#1375](https://github.com/Microsoft/BotFramework-Emulator/pull/1375)

## Fixed
- [luis / qnamaker] Addressed npm security vulnerabilities in luis & qnamaker extensions in PR [#1371](https://github.com/Microsoft/BotFramework-Emulator/pull/1371)

@@ -38,7 +38,7 @@ const defaults: FS = {
autoUpdate: true,
bypassNgrokLocalhost: true,
runNgrokAtStartup: false,
collectUsageData: true,
collectUsageData: false,
locale: '',
localhost: '',
ngrokPath: '',
@@ -203,10 +203,11 @@ export class AppSettingsEditor extends React.Component<AppSettingsEditorProps, A
<SmallHeader>Data Collection</SmallHeader>
<Checkbox
className={styles.checkboxOverrides}
checked={state.collectUsageData}
checked={false}
onChange={this.onChangeCheckBox}
label="Help improve the Emulator by allowing us to collect usage data."
name="collectUsageData"
disabled={true}
/>
<a target="_blank" href="https://aka.ms/bot-framework-emulator-data-collection" rel="noopener noreferrer">
Learn more.
@@ -124,6 +124,8 @@ describe('TelemetryService', () => {
expect(mockAITrackEvent).not.toHaveBeenCalled();
});

// NOTE: Disabled for v4.3
/*
it('should track events', () => {
const mockStartup = jest.fn(() => null);
(TelemetryService as any).startup = mockStartup;
@@ -145,4 +147,5 @@ describe('TelemetryService', () => {
properties: { some: 'property' },
});
});
*/
});
@@ -42,6 +42,15 @@ export class TelemetryService {
private static _client: AppInsights.TelemetryClient;
private static _hasStarted: boolean = false;

public static trackEvent(..._args: any[]): void {
// no-op until telemetry is re-enabled
if (this._client || this.enabled || this.startup) {
return;
}
}

// NOTE: Disabled for v4.3
/*
public static trackEvent(name: string, properties?: { [key: string]: any }): void {
if (!this.enabled || !name) {
return;
@@ -55,7 +64,7 @@ export class TelemetryService {
// swallow the exception; we don't want to crash the app
// on a failed attempt to collect usage data
}
}
}*/

private static get enabled(): boolean {
const settings: SettingsImpl = getSettings() || ({} as SettingsImpl);
@@ -131,7 +131,7 @@ export const frameworkDefault: FrameworkSettings = {
locale: 'en-US',
usePrereleases: false,
autoUpdate: true,
collectUsageData: true,
collectUsageData: false,
};

export const windowStateDefault: WindowStateSettings = {
@@ -0,0 +1,65 @@
//
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license.
//
// Microsoft Bot Framework: http://botframework.com
//
// Bot Framework Emulator Github:
// https://github.com/Microsoft/BotFramwork-Emulator
//
// Copyright (c) Microsoft Corporation
// All rights reserved.
//
// MIT License:
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED ""AS IS"", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//

import { filterChildren, hmrSafeNameComparison } from './filterChildren';

jest.mock('react', () => ({
Children: {
map: (array, fn) => array.map(fn),
},
}));

describe('filterChildren', () => {
it('should compare element names safely', () => {
// test all cases of || operator (no matching names or display names)
const child1 = { name: 'name1', displayName: 'dispalyName1' };
const child2 = { name: 'name2', displayName: 'displayName2' };

expect(hmrSafeNameComparison(child1, child2)).toBe(false);

// invert result
expect(hmrSafeNameComparison(child1, child2, true)).toBe(true);
});

it('should filterChildren according to a predicate', () => {
const child1 = { name: 'someChild' };
const child2 = { name: 'otherChild' };
const predicate = child => child.name.startsWith('some');

const filteredChildren = filterChildren([child1, child2], predicate);

expect(filteredChildren).toHaveLength(2);
expect(filteredChildren[0]).toBe(child1);
expect(filteredChildren[1]).toBe(false);
});
});
@@ -39,6 +39,7 @@ export interface CheckboxProps extends React.HTMLAttributes<HTMLInputElement> {
label?: string;
checkboxContainerClassName?: string;
checked?: boolean;
disabled?: boolean;
indeterminate?: boolean;
name?: string;
onChange?: (event: React.FormEvent<HTMLInputElement>) => void;

0 comments on commit 2cbf9c3

Please sign in to comment.
You can’t perform that action at this time.