Skip to content

Commit

Permalink
Disabled telemetry.
Browse files Browse the repository at this point in the history
  • Loading branch information
tonyanziano committed Mar 14, 2019
1 parent 57b1776 commit 2cbf9c3
Show file tree
Hide file tree
Showing 8 changed files with 86 additions and 4 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ const defaults: FS = {
autoUpdate: true,
bypassNgrokLocalhost: true,
runNgrokAtStartup: false,
collectUsageData: true,
collectUsageData: false,
locale: '',
localhost: '',
ngrokPath: '',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
3 changes: 3 additions & 0 deletions packages/app/main/src/telemetry/telemetryService.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -145,4 +147,5 @@ describe('TelemetryService', () => {
properties: { some: 'property' },
});
});
*/
});
11 changes: 10 additions & 1 deletion packages/app/main/src/telemetry/telemetryService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion packages/app/shared/src/types/serverSettingsTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ export const frameworkDefault: FrameworkSettings = {
locale: 'en-US',
usePrereleases: false,
autoUpdate: true,
collectUsageData: true,
collectUsageData: false,
};

export const windowStateDefault: WindowStateSettings = {
Expand Down
65 changes: 65 additions & 0 deletions packages/sdk/ui-react/src/utils/filterChildren.spec.ts
Original file line number Diff line number Diff line change
@@ -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);
});
});
1 change: 1 addition & 0 deletions packages/sdk/ui-react/src/widget/checkbox/checkbox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 2cbf9c3

Please sign in to comment.