Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disabled telemetry and fixed tslint errors. #1375

Merged
merged 2 commits into from Mar 14, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
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
156 changes: 0 additions & 156 deletions packages/app/client/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Expand Up @@ -38,7 +38,7 @@ const defaults: FS = {
autoUpdate: true,
bypassNgrokLocalhost: true,
runNgrokAtStartup: false,
collectUsageData: true,
collectUsageData: false,
locale: '',
localhost: '',
ngrokPath: '',
Expand Down
Expand Up @@ -48,7 +48,7 @@ import { RootState } from '../store';

import { call, ForkEffect, put, select, takeEvery } from 'redux-saga/effects';

export const normalizeSettingsData = async (settings: FrameworkSettings): FrameworkSettings => {
export const normalizeSettingsData = async (settings: FrameworkSettings): Promise<FrameworkSettings> => {
// trim keys that do not belong and generate a hash
const keys = Object.keys(frameworkDefault).sort();
const newState = keys.reduce((s, key) => ((s[key] = settings[key]), s), {}) as FrameworkSettings;
Expand Down
Expand Up @@ -63,6 +63,7 @@ export interface AppSettingsEditorProps {

export interface AppSettingsEditorState extends Partial<FrameworkSettings> {
dirty?: boolean;
pendingUpdate?: boolean;
}

function shallowEqual(x: any, y: any) {
Expand Down Expand Up @@ -202,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
2 changes: 1 addition & 1 deletion packages/app/main/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions packages/app/main/src/telemetry/telemetryService.spec.ts
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
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
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
@@ -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);
});
});
2 changes: 2 additions & 0 deletions packages/sdk/ui-react/src/widget/checkbox/checkbox.tsx
Expand Up @@ -39,7 +39,9 @@ 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
2 changes: 1 addition & 1 deletion packages/sdk/ui-react/src/widget/textField/textField.tsx
Expand Up @@ -42,7 +42,7 @@ export interface TextFieldProps extends InputHTMLAttributes<HTMLInputElement> {
label?: string;
errorMessage?: string;
inputContainerClassName?: string;
inputRef: React.Ref<HTMLInputElement>;
inputRef?: React.Ref<HTMLInputElement>;
}

export class TextField extends Component<TextFieldProps, {}> {
Expand Down