diff --git a/CHANGELOG.md b/CHANGELOG.md index 566b5364b..2a6135111 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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) diff --git a/packages/app/client/src/data/reducer/frameworkSettingsReducer.ts b/packages/app/client/src/data/reducer/frameworkSettingsReducer.ts index 7a6e78456..61b582983 100644 --- a/packages/app/client/src/data/reducer/frameworkSettingsReducer.ts +++ b/packages/app/client/src/data/reducer/frameworkSettingsReducer.ts @@ -38,7 +38,7 @@ const defaults: FS = { autoUpdate: true, bypassNgrokLocalhost: true, runNgrokAtStartup: false, - collectUsageData: true, + collectUsageData: false, locale: '', localhost: '', ngrokPath: '', diff --git a/packages/app/client/src/ui/editor/appSettingsEditor/appSettingsEditor.tsx b/packages/app/client/src/ui/editor/appSettingsEditor/appSettingsEditor.tsx index f26a9c4dc..7e9c8ed60 100644 --- a/packages/app/client/src/ui/editor/appSettingsEditor/appSettingsEditor.tsx +++ b/packages/app/client/src/ui/editor/appSettingsEditor/appSettingsEditor.tsx @@ -203,10 +203,11 @@ export class AppSettingsEditor extends React.ComponentData Collection Learn more. diff --git a/packages/app/main/src/telemetry/telemetryService.spec.ts b/packages/app/main/src/telemetry/telemetryService.spec.ts index 44c314959..008e73e10 100644 --- a/packages/app/main/src/telemetry/telemetryService.spec.ts +++ b/packages/app/main/src/telemetry/telemetryService.spec.ts @@ -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' }, }); }); + */ }); diff --git a/packages/app/main/src/telemetry/telemetryService.ts b/packages/app/main/src/telemetry/telemetryService.ts index f88b23283..4e83dee6e 100644 --- a/packages/app/main/src/telemetry/telemetryService.ts +++ b/packages/app/main/src/telemetry/telemetryService.ts @@ -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); diff --git a/packages/app/shared/src/types/serverSettingsTypes.ts b/packages/app/shared/src/types/serverSettingsTypes.ts index 2dd85d22c..18e4a22aa 100644 --- a/packages/app/shared/src/types/serverSettingsTypes.ts +++ b/packages/app/shared/src/types/serverSettingsTypes.ts @@ -131,7 +131,7 @@ export const frameworkDefault: FrameworkSettings = { locale: 'en-US', usePrereleases: false, autoUpdate: true, - collectUsageData: true, + collectUsageData: false, }; export const windowStateDefault: WindowStateSettings = { diff --git a/packages/sdk/ui-react/src/utils/filterChildren.spec.ts b/packages/sdk/ui-react/src/utils/filterChildren.spec.ts new file mode 100644 index 000000000..45dbb66e0 --- /dev/null +++ b/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); + }); +}); diff --git a/packages/sdk/ui-react/src/widget/checkbox/checkbox.tsx b/packages/sdk/ui-react/src/widget/checkbox/checkbox.tsx index efd4be61b..87e359eae 100644 --- a/packages/sdk/ui-react/src/widget/checkbox/checkbox.tsx +++ b/packages/sdk/ui-react/src/widget/checkbox/checkbox.tsx @@ -39,6 +39,7 @@ export interface CheckboxProps extends React.HTMLAttributes { label?: string; checkboxContainerClassName?: string; checked?: boolean; + disabled?: boolean; indeterminate?: boolean; name?: string; onChange?: (event: React.FormEvent) => void;