diff --git a/packages/kbn-doc-links/src/get_doc_links.ts b/packages/kbn-doc-links/src/get_doc_links.ts index 8c28cbfd2b9bb..9487b3559536e 100644 --- a/packages/kbn-doc-links/src/get_doc_links.ts +++ b/packages/kbn-doc-links/src/get_doc_links.ts @@ -602,5 +602,8 @@ export const getDocLinks = ({ kibanaBranch }: GetDocLinkOptions): DocLinks => { endpoints: { troubleshooting: `${ELASTIC_WEBSITE_URL}guide/en/security/${DOC_LINK_VERSION}/ts-management.html#ts-endpoints`, }, + legal: { + privacyStatement: `${ELASTIC_WEBSITE_URL}legal/privacy-statement`, + }, }); }; diff --git a/packages/kbn-doc-links/src/types.ts b/packages/kbn-doc-links/src/types.ts index 656dea5bc34e4..6d10dadcafaa3 100644 --- a/packages/kbn-doc-links/src/types.ts +++ b/packages/kbn-doc-links/src/types.ts @@ -364,4 +364,7 @@ export interface DocLinks { readonly endpoints: { readonly troubleshooting: string; }; + readonly legal: { + readonly privacyStatement: string; + }; } diff --git a/packages/kbn-shared-ux-services/src/services/mock/doc_links.mock.ts b/packages/kbn-shared-ux-services/src/services/mock/doc_links.mock.ts index 378ead63fbc9f..2ee0985d0a413 100644 --- a/packages/kbn-shared-ux-services/src/services/mock/doc_links.mock.ts +++ b/packages/kbn-shared-ux-services/src/services/mock/doc_links.mock.ts @@ -12,11 +12,11 @@ import type { SharedUxDocLinksService } from '../doc_links'; /** * A factory function for creating a Jest implementation of `SharedUxDocLinksService`. */ -export type MockDockLinksServiceFactory = ServiceFactory; +export type MockDocLinksServiceFactory = ServiceFactory; /** * A factory function for creating a Jest-based implementation of `SharedUxDocLinksService`. */ -export const docLinksServiceFactory: MockDockLinksServiceFactory = () => ({ +export const docLinksServiceFactory: MockDocLinksServiceFactory = () => ({ dataViewsDocLink: 'dummy link', }); diff --git a/packages/kbn-shared-ux-services/src/services/mock/index.ts b/packages/kbn-shared-ux-services/src/services/mock/index.ts index 2fc049a84aeb4..63256345d1bba 100644 --- a/packages/kbn-shared-ux-services/src/services/mock/index.ts +++ b/packages/kbn-shared-ux-services/src/services/mock/index.ts @@ -16,7 +16,7 @@ import { userPermissionsServiceFactory } from './permissions.mock'; import { platformServiceFactory } from './platform.mock'; export type { MockApplicationServiceFactory } from './application.mock'; -export type { MockDockLinksServiceFactory } from './doc_links.mock'; +export type { MockDocLinksServiceFactory } from './doc_links.mock'; export type { MockEditorsServiceFactory } from './editors.mock'; export type { MockHttpServiceFactory } from './http.mock'; export type { MockUserPermissionsServiceFactory } from './permissions.mock'; diff --git a/packages/kbn-shared-ux-services/src/services/stub/doc_links.ts b/packages/kbn-shared-ux-services/src/services/stub/doc_links.ts index 6d22eed944521..9bcfd7db78cfa 100644 --- a/packages/kbn-shared-ux-services/src/services/stub/doc_links.ts +++ b/packages/kbn-shared-ux-services/src/services/stub/doc_links.ts @@ -12,11 +12,11 @@ import type { SharedUxDocLinksService } from '../doc_links'; /** * A factory function for creating a stubbed implementation of `SharedUxDocLinksService`. */ -export type DockLinksServiceFactory = ServiceFactory; +export type DocLinksServiceFactory = ServiceFactory; /** * A factory function for creating a stubbed implementation of `SharedUxDocLinksService`. */ -export const docLinksServiceFactory: DockLinksServiceFactory = () => ({ +export const docLinksServiceFactory: DocLinksServiceFactory = () => ({ dataViewsDocLink: 'docs', }); diff --git a/src/plugins/advanced_settings/public/management_app/advanced_settings.test.tsx b/src/plugins/advanced_settings/public/management_app/advanced_settings.test.tsx index a804b55938861..7b294c609f31e 100644 --- a/src/plugins/advanced_settings/public/management_app/advanced_settings.test.tsx +++ b/src/plugins/advanced_settings/public/management_app/advanced_settings.test.tsx @@ -252,7 +252,7 @@ describe('AdvancedSettings', () => { history={mockHistory} enableSaving={true} toasts={notificationServiceMock.createStartContract().toasts} - dockLinks={docLinksServiceMock.createStartContract().links} + docLinks={docLinksServiceMock.createStartContract().links} uiSettings={mockConfig().core.uiSettings} componentRegistry={new ComponentRegistry().start} theme={themeServiceMock.createStartContract().theme$} @@ -275,7 +275,7 @@ describe('AdvancedSettings', () => { history={mockHistory} enableSaving={false} toasts={notificationServiceMock.createStartContract().toasts} - dockLinks={docLinksServiceMock.createStartContract().links} + docLinks={docLinksServiceMock.createStartContract().links} uiSettings={mockConfig().core.uiSettings} componentRegistry={new ComponentRegistry().start} theme={themeServiceMock.createStartContract().theme$} @@ -302,7 +302,7 @@ describe('AdvancedSettings', () => { history={mockHistory} enableSaving={false} toasts={toasts} - dockLinks={docLinksServiceMock.createStartContract().links} + docLinks={docLinksServiceMock.createStartContract().links} uiSettings={mockConfig().core.uiSettings} componentRegistry={new ComponentRegistry().start} theme={themeServiceMock.createStartContract().theme$} diff --git a/src/plugins/advanced_settings/public/management_app/advanced_settings.tsx b/src/plugins/advanced_settings/public/management_app/advanced_settings.tsx index e0966d70aeb98..ba3bb49790627 100644 --- a/src/plugins/advanced_settings/public/management_app/advanced_settings.tsx +++ b/src/plugins/advanced_settings/public/management_app/advanced_settings.tsx @@ -41,7 +41,7 @@ interface AdvancedSettingsProps { history: ScopedHistory; enableSaving: boolean; uiSettings: IUiSettingsClient; - dockLinks: DocLinksStart['links']; + docLinks: DocLinksStart['links']; toasts: ToastsStart; theme: ThemeServiceStart['theme$']; componentRegistry: ComponentRegistry['start']; @@ -270,7 +270,7 @@ export class AdvancedSettings extends Component { handleChange={handleChange} enableSaving={true} toasts={notificationServiceMock.createStartContract().toasts} - dockLinks={docLinksServiceMock.createStartContract().links} + docLinks={docLinksServiceMock.createStartContract().links} /> ); @@ -226,7 +226,7 @@ describe('Field', () => { handleChange={handleChange} enableSaving={true} toasts={notificationServiceMock.createStartContract().toasts} - dockLinks={docLinksServiceMock.createStartContract().links} + docLinks={docLinksServiceMock.createStartContract().links} /> ); @@ -240,7 +240,7 @@ describe('Field', () => { handleChange={handleChange} enableSaving={false} toasts={notificationServiceMock.createStartContract().toasts} - dockLinks={docLinksServiceMock.createStartContract().links} + docLinks={docLinksServiceMock.createStartContract().links} /> ); expect(component).toMatchSnapshot(); @@ -257,7 +257,7 @@ describe('Field', () => { handleChange={handleChange} enableSaving={true} toasts={notificationServiceMock.createStartContract().toasts} - dockLinks={docLinksServiceMock.createStartContract().links} + docLinks={docLinksServiceMock.createStartContract().links} /> ); @@ -274,7 +274,7 @@ describe('Field', () => { handleChange={handleChange} enableSaving={true} toasts={notificationServiceMock.createStartContract().toasts} - dockLinks={docLinksServiceMock.createStartContract().links} + docLinks={docLinksServiceMock.createStartContract().links} /> ); expect(component).toMatchSnapshot(); @@ -289,7 +289,7 @@ describe('Field', () => { handleChange={handleChange} enableSaving={true} toasts={notificationServiceMock.createStartContract().toasts} - dockLinks={docLinksServiceMock.createStartContract().links} + docLinks={docLinksServiceMock.createStartContract().links} unsavedChanges={{ // @ts-ignore value: exampleValues[setting.type], @@ -311,7 +311,7 @@ describe('Field', () => { handleChange={handleChange} enableSaving={true} toasts={notificationServiceMock.createStartContract().toasts} - dockLinks={docLinksServiceMock.createStartContract().links} + docLinks={docLinksServiceMock.createStartContract().links} /> ); const select = findTestSubject(component, `advancedSetting-editField-${setting.name}`); @@ -333,7 +333,7 @@ describe('Field', () => { handleChange={handleChange} enableSaving={true} toasts={notificationServiceMock.createStartContract().toasts} - dockLinks={docLinksServiceMock.createStartContract().links} + docLinks={docLinksServiceMock.createStartContract().links} {...props} /> diff --git a/src/plugins/advanced_settings/public/management_app/components/field/field.tsx b/src/plugins/advanced_settings/public/management_app/components/field/field.tsx index 0705201872493..62c000b3ce46f 100644 --- a/src/plugins/advanced_settings/public/management_app/components/field/field.tsx +++ b/src/plugins/advanced_settings/public/management_app/components/field/field.tsx @@ -41,7 +41,7 @@ interface FieldProps { setting: FieldSetting; handleChange: (name: string, value: FieldState) => void; enableSaving: boolean; - dockLinks: DocLinksStart['links']; + docLinks: DocLinksStart['links']; toasts: ToastsStart; clearChange?: (name: string) => void; unsavedChanges?: FieldState; @@ -459,7 +459,7 @@ export class Field extends PureComponent { let deprecation; if (setting.deprecation) { - const links = this.props.dockLinks; + const links = this.props.docLinks; deprecation = ( <> diff --git a/src/plugins/advanced_settings/public/management_app/components/form/__snapshots__/form.test.tsx.snap b/src/plugins/advanced_settings/public/management_app/components/form/__snapshots__/form.test.tsx.snap index 8e3aafa849ad1..064269f885cca 100644 --- a/src/plugins/advanced_settings/public/management_app/components/form/__snapshots__/form.test.tsx.snap +++ b/src/plugins/advanced_settings/public/management_app/components/form/__snapshots__/form.test.tsx.snap @@ -52,7 +52,7 @@ exports[`Form should not render no settings message when instructed not to 1`] = <_EuiSplitPanelInner> { showNoResultsMessage={true} enableSaving={true} toasts={{} as any} - dockLinks={{} as any} + docLinks={{} as any} theme={themeServiceMock.createStartContract().theme$} /> ); @@ -147,7 +145,7 @@ describe('Form', () => { showNoResultsMessage={true} enableSaving={false} toasts={{} as any} - dockLinks={{} as any} + docLinks={{} as any} theme={themeServiceMock.createStartContract().theme$} /> ); @@ -167,7 +165,7 @@ describe('Form', () => { showNoResultsMessage={true} enableSaving={true} toasts={{} as any} - dockLinks={{} as any} + docLinks={{} as any} theme={themeServiceMock.createStartContract().theme$} /> ); @@ -187,7 +185,7 @@ describe('Form', () => { showNoResultsMessage={false} enableSaving={true} toasts={{} as any} - dockLinks={{} as any} + docLinks={{} as any} theme={themeServiceMock.createStartContract().theme$} /> ); @@ -207,7 +205,7 @@ describe('Form', () => { showNoResultsMessage={true} enableSaving={false} toasts={{} as any} - dockLinks={{} as any} + docLinks={{} as any} theme={themeServiceMock.createStartContract().theme$} /> ); @@ -238,7 +236,7 @@ describe('Form', () => { showNoResultsMessage={true} enableSaving={false} toasts={toasts} - dockLinks={{} as any} + docLinks={{} as any} theme={themeServiceMock.createStartContract().theme$} /> ); @@ -275,7 +273,7 @@ describe('Form', () => { showNoResultsMessage={true} enableSaving={false} toasts={{} as any} - dockLinks={{} as any} + docLinks={{} as any} theme={themeServiceMock.createStartContract().theme$} /> ); @@ -304,7 +302,7 @@ describe('Form', () => { showNoResultsMessage={true} enableSaving={false} toasts={{} as any} - dockLinks={{} as any} + docLinks={{} as any} theme={themeServiceMock.createStartContract().theme$} /> ); diff --git a/src/plugins/advanced_settings/public/management_app/components/form/form.tsx b/src/plugins/advanced_settings/public/management_app/components/form/form.tsx index a398155131bd4..0d1e19b6c004d 100644 --- a/src/plugins/advanced_settings/public/management_app/components/form/form.tsx +++ b/src/plugins/advanced_settings/public/management_app/components/form/form.tsx @@ -44,7 +44,7 @@ interface FormProps { save: (changes: SettingsChanges) => Promise; showNoResultsMessage: boolean; enableSaving: boolean; - dockLinks: DocLinksStart['links']; + docLinks: DocLinksStart['links']; toasts: ToastsStart; theme: ThemeServiceStart['theme$']; trackUiMetric?: (metricType: UiCounterMetricType, eventName: string | string[]) => void; @@ -264,7 +264,7 @@ export class Form extends PureComponent { unsavedChanges={this.state.unsavedChanges[setting.name]} clearChange={this.clearChange} enableSaving={this.props.enableSaving} - dockLinks={this.props.dockLinks} + docLinks={this.props.docLinks} toasts={this.props.toasts} /> ); diff --git a/src/plugins/advanced_settings/public/management_app/mount_management_section.tsx b/src/plugins/advanced_settings/public/management_app/mount_management_section.tsx index baef0fe38e3fe..84eb0d4139fa0 100644 --- a/src/plugins/advanced_settings/public/management_app/mount_management_section.tsx +++ b/src/plugins/advanced_settings/public/management_app/mount_management_section.tsx @@ -82,7 +82,7 @@ export async function mountManagementSection( history={params.history} enableSaving={canSave} toasts={notifications.toasts} - dockLinks={docLinks.links} + docLinks={docLinks.links} uiSettings={uiSettings} theme={params.theme$} componentRegistry={componentRegistry} diff --git a/src/plugins/console/public/application/contexts/services_context.mock.ts b/src/plugins/console/public/application/contexts/services_context.mock.ts index 0b3e0fb3adec5..1f4a1ba415a68 100644 --- a/src/plugins/console/public/application/contexts/services_context.mock.ts +++ b/src/plugins/console/public/application/contexts/services_context.mock.ts @@ -6,9 +6,12 @@ * Side Public License, v 1. */ -import { notificationServiceMock } from '../../../../../core/public/mocks'; -import { httpServiceMock, themeServiceMock } from '../../../../../core/public/mocks'; -import { docLinksServiceMock } from '../../../../../core/public/mocks'; +import { + notificationServiceMock, + httpServiceMock, + themeServiceMock, + docLinksServiceMock, +} from '../../../../../core/public/mocks'; import type { ObjectStorageClient } from '../../../common/types'; import { HistoryMock } from '../../services/history.mock'; diff --git a/src/plugins/dashboard/public/application/lib/help_menu_util.ts b/src/plugins/dashboard/public/application/lib/help_menu_util.ts index 7963b1ef93bb3..adea5fdc84d47 100644 --- a/src/plugins/dashboard/public/application/lib/help_menu_util.ts +++ b/src/plugins/dashboard/public/application/lib/help_menu_util.ts @@ -7,12 +7,9 @@ */ import { i18n } from '@kbn/i18n'; -import { CoreStart } from 'kibana/public'; +import { ChromeStart, DocLinksStart } from 'kibana/public'; -export function addHelpMenuToAppChrome( - chrome: CoreStart['chrome'], - docLinks: CoreStart['docLinks'] -) { +export function addHelpMenuToAppChrome(chrome: ChromeStart, docLinks: DocLinksStart) { chrome.setHelpExtension({ appName: i18n.translate('dashboard.helpMenu.appName', { defaultMessage: 'Dashboards', diff --git a/src/plugins/data/public/search/errors/search_session_incomplete_warning.tsx b/src/plugins/data/public/search/errors/search_session_incomplete_warning.tsx index 20d89dd5dc842..868245e66bf4d 100644 --- a/src/plugins/data/public/search/errors/search_session_incomplete_warning.tsx +++ b/src/plugins/data/public/search/errors/search_session_incomplete_warning.tsx @@ -7,11 +7,11 @@ */ import { EuiLink, EuiSpacer, EuiText } from '@elastic/eui'; -import { CoreStart } from 'kibana/public'; +import { DocLinksStart } from 'kibana/public'; import React from 'react'; import { FormattedMessage } from '@kbn/i18n-react'; -export const SearchSessionIncompleteWarning = (docLinks: CoreStart['docLinks']) => ( +export const SearchSessionIncompleteWarning = (docLinks: DocLinksStart) => ( <> It needs more time to fully render. You can wait here or come back to it later. diff --git a/src/plugins/data/public/search/search_interceptor/search_interceptor.ts b/src/plugins/data/public/search/search_interceptor/search_interceptor.ts index 251e191d589e3..cebcf19317a8c 100644 --- a/src/plugins/data/public/search/search_interceptor/search_interceptor.ts +++ b/src/plugins/data/public/search/search_interceptor/search_interceptor.ts @@ -22,11 +22,15 @@ import { } from 'rxjs/operators'; import { PublicMethodsOf } from '@kbn/utility-types'; import { - CoreSetup, + ApplicationStart, CoreStart, + DocLinksStart, + HttpSetup, IHttpFetchError, + IUiSettingsClient, ThemeServiceSetup, ToastsSetup, + ExecutionContextSetup, } from 'kibana/public'; import { i18n } from '@kbn/i18n'; import { BatchedFunc, BfetchPublicSetup, DISABLE_BFETCH } from '../../../../bfetch/public'; @@ -60,9 +64,9 @@ import { SearchAbortController } from './search_abort_controller'; export interface SearchInterceptorDeps { bfetch: BfetchPublicSetup; - http: CoreSetup['http']; - executionContext: CoreSetup['executionContext']; - uiSettings: CoreSetup['uiSettings']; + http: HttpSetup; + executionContext: ExecutionContextSetup; + uiSettings: IUiSettingsClient; startServices: Promise<[CoreStart, any, unknown]>; toasts: ToastsSetup; usageCollector?: SearchUsageCollector; @@ -91,8 +95,8 @@ export class SearchInterceptor { /** * @internal */ - private application!: CoreStart['application']; - private docLinks!: CoreStart['docLinks']; + private application!: ApplicationStart; + private docLinks!: DocLinksStart; private batchedFetch!: BatchedFunc< { request: IKibanaSearchRequest; options: ISearchOptionsSerializable }, IKibanaSearchResponse diff --git a/src/plugins/interactive_setup/public/doc_link.tsx b/src/plugins/interactive_setup/public/doc_link.tsx index 883adde702b04..d283dd08b7f7c 100644 --- a/src/plugins/interactive_setup/public/doc_link.tsx +++ b/src/plugins/interactive_setup/public/doc_link.tsx @@ -11,11 +11,11 @@ import { EuiLink } from '@elastic/eui'; import type { FunctionComponent } from 'react'; import React, { useCallback } from 'react'; -import type { CoreStart } from 'src/core/public'; +import type { DocLinksStart } from 'kibana/public'; import { useKibana } from './use_kibana'; -export type DocLinks = CoreStart['docLinks']['links']; +export type DocLinks = DocLinksStart['links']; export type GetDocLinkFunction = (app: string, doc: string) => string; /** diff --git a/src/plugins/saved_objects_management/public/management_section/saved_objects_edition_page.tsx b/src/plugins/saved_objects_management/public/management_section/saved_objects_edition_page.tsx index 74d27199770b1..8d71a6429490e 100644 --- a/src/plugins/saved_objects_management/public/management_section/saved_objects_edition_page.tsx +++ b/src/plugins/saved_objects_management/public/management_section/saved_objects_edition_page.tsx @@ -26,7 +26,7 @@ const SavedObjectsEditionPage = ({ }) => { const { type, id } = useParams<{ type: string; id: string }>(); const capabilities = coreStart.application.capabilities; - const dockLinks = coreStart.docLinks.links; + const docLinks = coreStart.docLinks.links; const { search } = useLocation(); const query = parse(search); @@ -64,7 +64,7 @@ const SavedObjectsEditionPage = ({ notFoundType={query.notFound as string} uiSettings={coreStart.uiSettings} history={history} - docLinks={dockLinks} + docLinks={docLinks} /> ); diff --git a/src/plugins/telemetry/common/constants.ts b/src/plugins/telemetry/common/constants.ts index 5e7b52dd35cf7..7b7d0a0db5057 100644 --- a/src/plugins/telemetry/common/constants.ts +++ b/src/plugins/telemetry/common/constants.ts @@ -22,11 +22,6 @@ export const LOCALSTORAGE_KEY = 'telemetry.data'; */ export const PATH_TO_ADVANCED_SETTINGS = '/app/management/kibana/settings'; -/** - * Link to the Elastic Telemetry privacy statement. - */ -export const PRIVACY_STATEMENT_URL = `https://www.elastic.co/legal/privacy-statement`; - /** * The telemetry payload content encryption encoding */ diff --git a/src/plugins/telemetry/public/components/__snapshots__/opt_in_banner.test.tsx.snap b/src/plugins/telemetry/public/components/__snapshots__/opt_in_banner.test.tsx.snap index 87e60869f6c21..95995a9546584 100644 --- a/src/plugins/telemetry/public/components/__snapshots__/opt_in_banner.test.tsx.snap +++ b/src/plugins/telemetry/public/components/__snapshots__/opt_in_banner.test.tsx.snap @@ -11,7 +11,13 @@ exports[`OptInDetailsComponent renders as expected 1`] = ` /> } > - + diff --git a/src/plugins/telemetry/public/components/__snapshots__/opt_in_message.test.tsx.snap b/src/plugins/telemetry/public/components/__snapshots__/opt_in_message.test.tsx.snap index 4c151e44cbfea..ed0fbaa6407f0 100644 --- a/src/plugins/telemetry/public/components/__snapshots__/opt_in_message.test.tsx.snap +++ b/src/plugins/telemetry/public/components/__snapshots__/opt_in_message.test.tsx.snap @@ -8,7 +8,7 @@ exports[`OptInMessage renders as expected 1`] = ` values={ Object { "privacyStatementLink": diff --git a/src/plugins/telemetry/public/components/__snapshots__/opted_in_notice_banner.test.tsx.snap b/src/plugins/telemetry/public/components/__snapshots__/opted_in_notice_banner.test.tsx.snap index 897e3b2761c74..54e1b1ad17dde 100644 --- a/src/plugins/telemetry/public/components/__snapshots__/opted_in_notice_banner.test.tsx.snap +++ b/src/plugins/telemetry/public/components/__snapshots__/opted_in_notice_banner.test.tsx.snap @@ -20,7 +20,7 @@ exports[`OptInDetailsComponent renders as expected 1`] = ` /> , "privacyStatementLink": { + const telemetryConstants = mockTelemetryConstants(); + it('renders as expected', () => { - expect(shallowWithIntl( {}} />)).toMatchSnapshot(); + expect( + shallowWithIntl( + {}} telemetryConstants={telemetryConstants} /> + ) + ).toMatchSnapshot(); }); it('fires the "onChangeOptInClick" prop with true when a enable is clicked', () => { const onClick = jest.fn(); - const component = shallowWithIntl(); + const component = shallowWithIntl( + + ); const enableButton = component.findWhere((n) => { const props = n.props(); @@ -36,7 +45,9 @@ describe('OptInDetailsComponent', () => { it('fires the "onChangeOptInClick" with false when a disable is clicked', () => { const onClick = jest.fn(); - const component = shallowWithIntl(); + const component = shallowWithIntl( + + ); const disableButton = component.findWhere((n) => { const props = n.props(); diff --git a/src/plugins/telemetry/public/components/opt_in_banner.tsx b/src/plugins/telemetry/public/components/opt_in_banner.tsx index 0b13b8b792a4c..de45b4419a5ee 100644 --- a/src/plugins/telemetry/public/components/opt_in_banner.tsx +++ b/src/plugins/telemetry/public/components/opt_in_banner.tsx @@ -10,14 +10,16 @@ import * as React from 'react'; import { EuiButton, EuiCallOut, EuiFlexGroup, EuiFlexItem, EuiSpacer } from '@elastic/eui'; import { FormattedMessage } from '@kbn/i18n-react'; import { OptInMessage } from './opt_in_message'; +import { TelemetryConstants } from '..'; interface Props { onChangeOptInClick: (isOptIn: boolean) => void; + telemetryConstants: TelemetryConstants; } export class OptInBanner extends React.PureComponent { render() { - const { onChangeOptInClick } = this.props; + const { onChangeOptInClick, telemetryConstants } = this.props; const title = ( { ); return ( - + diff --git a/src/plugins/telemetry/public/components/opt_in_message.test.tsx b/src/plugins/telemetry/public/components/opt_in_message.test.tsx index 1196e36a1b424..ddba6cc517c2b 100644 --- a/src/plugins/telemetry/public/components/opt_in_message.test.tsx +++ b/src/plugins/telemetry/public/components/opt_in_message.test.tsx @@ -9,9 +9,14 @@ import React from 'react'; import { shallowWithIntl } from '@kbn/test-jest-helpers'; import { OptInMessage } from './opt_in_message'; +import { mockTelemetryConstants } from '../mocks'; + +const telemetryConstants = mockTelemetryConstants(); describe('OptInMessage', () => { it('renders as expected', () => { - expect(shallowWithIntl()).toMatchSnapshot(); + expect( + shallowWithIntl() + ).toMatchSnapshot(); }); }); diff --git a/src/plugins/telemetry/public/components/opt_in_message.tsx b/src/plugins/telemetry/public/components/opt_in_message.tsx index 0c03585a9eae4..32e58e6a71ca2 100644 --- a/src/plugins/telemetry/public/components/opt_in_message.tsx +++ b/src/plugins/telemetry/public/components/opt_in_message.tsx @@ -9,9 +9,13 @@ import * as React from 'react'; import { EuiLink } from '@elastic/eui'; import { FormattedMessage } from '@kbn/i18n-react'; -import { PRIVACY_STATEMENT_URL } from '../../common/constants'; +import { TelemetryConstants } from '..'; -export class OptInMessage extends React.PureComponent { +interface Props { + telemetryConstants: TelemetryConstants; +} + +export class OptInMessage extends React.PureComponent { render() { return ( @@ -20,7 +24,11 @@ export class OptInMessage extends React.PureComponent { defaultMessage="Want to help us improve the Elastic Stack? Data usage collection is currently disabled. Enabling data usage collection helps us manage and improve our products and services. See our {privacyStatementLink} for more details." values={{ privacyStatementLink: ( - + { it('renders as expected', () => { expect( - shallowWithIntl( {}} http={mockHttp} />) + shallowWithIntl( + {}} + http={mockHttp} + telemetryConstants={telemetryConstants} + /> + ) ).toMatchSnapshot(); }); it('fires the "onSeenBanner" prop when a link is clicked', () => { const onLinkClick = jest.fn(); const component = shallowWithIntl( - + ); const button = component.findWhere((n) => n.type() === EuiButton); diff --git a/src/plugins/telemetry/public/components/opted_in_notice_banner.tsx b/src/plugins/telemetry/public/components/opted_in_notice_banner.tsx index 1deccb9362c36..a68da24947844 100644 --- a/src/plugins/telemetry/public/components/opted_in_notice_banner.tsx +++ b/src/plugins/telemetry/public/components/opted_in_notice_banner.tsx @@ -12,17 +12,19 @@ import * as React from 'react'; import { EuiButton, EuiLink, EuiCallOut, EuiSpacer } from '@elastic/eui'; import { FormattedMessage } from '@kbn/i18n-react'; import { i18n } from '@kbn/i18n'; -import { PATH_TO_ADVANCED_SETTINGS, PRIVACY_STATEMENT_URL } from '../../common/constants'; -import { HttpSetup } from '../../../../core/public'; +import { HttpSetup } from 'kibana/public'; +import { PATH_TO_ADVANCED_SETTINGS } from '../../common/constants'; +import { TelemetryConstants } from '..'; interface Props { http: HttpSetup; onSeenBanner: () => unknown; + telemetryConstants: TelemetryConstants; } export class OptedInNoticeBanner extends React.PureComponent { render() { - const { onSeenBanner, http } = this.props; + const { onSeenBanner, http, telemetryConstants } = this.props; const basePath = http.basePath.get(); const bannerTitle = i18n.translate('telemetry.telemetryOptedInNoticeTitle', { @@ -38,7 +40,7 @@ export class OptedInNoticeBanner extends React.PureComponent { privacyStatementLink: ( diff --git a/src/plugins/telemetry/public/index.ts b/src/plugins/telemetry/public/index.ts index 8d1747d9c33f1..47b90ed13c96d 100644 --- a/src/plugins/telemetry/public/index.ts +++ b/src/plugins/telemetry/public/index.ts @@ -10,6 +10,7 @@ import type { PluginInitializerContext } from 'src/core/public'; import type { TelemetryPluginConfig } from './plugin'; import { TelemetryPlugin } from './plugin'; export type { + TelemetryConstants, TelemetryPluginStart, TelemetryPluginSetup, TelemetryPluginConfig, diff --git a/src/plugins/telemetry/public/mocks.ts b/src/plugins/telemetry/public/mocks.ts index 405c6620e802a..202c306c94020 100644 --- a/src/plugins/telemetry/public/mocks.ts +++ b/src/plugins/telemetry/public/mocks.ts @@ -6,15 +6,15 @@ * Side Public License, v 1. */ -// eslint-disable-next-line @kbn/eslint/no-restricted-paths -import { overlayServiceMock } from '../../../core/public/overlays/overlay_service.mock'; -// eslint-disable-next-line @kbn/eslint/no-restricted-paths -import { httpServiceMock } from '../../../core/public/http/http_service.mock'; -// eslint-disable-next-line @kbn/eslint/no-restricted-paths -import { notificationServiceMock } from '../../../core/public/notifications/notifications_service.mock'; +import { + overlayServiceMock, + httpServiceMock, + notificationServiceMock, +} from '../../../core/public/mocks'; import { TelemetryService } from './services/telemetry_service'; import { TelemetryNotifications } from './services/telemetry_notifications/telemetry_notifications'; import { TelemetryPluginStart, TelemetryPluginSetup, TelemetryPluginConfig } from './plugin'; +import { TelemetryConstants } from '.'; // The following is to be able to access private methods /* eslint-disable dot-notation */ @@ -61,6 +61,12 @@ export function mockTelemetryService({ return telemetryService; } +export function mockTelemetryConstants(): TelemetryConstants { + return { + getPrivacyStatementUrl: () => 'https://some-host/some-url', + }; +} + export function mockTelemetryNotifications({ telemetryService, }: { @@ -70,6 +76,7 @@ export function mockTelemetryNotifications({ http: httpServiceMock.createSetupContract(), overlays: overlayServiceMock.createStartContract(), telemetryService, + telemetryConstants: mockTelemetryConstants(), }); } @@ -94,13 +101,12 @@ function createSetupContract(): Setup { function createStartContract(): Start { const telemetryService = mockTelemetryService(); const telemetryNotifications = mockTelemetryNotifications({ telemetryService }); + const telemetryConstants = mockTelemetryConstants(); const startContract: Start = { telemetryService, telemetryNotifications, - telemetryConstants: { - getPrivacyStatementUrl: jest.fn(), - }, + telemetryConstants, }; return startContract; diff --git a/src/plugins/telemetry/public/plugin.ts b/src/plugins/telemetry/public/plugin.ts index 2df35b761d128..a758715e62ba8 100644 --- a/src/plugins/telemetry/public/plugin.ts +++ b/src/plugins/telemetry/public/plugin.ts @@ -15,6 +15,7 @@ import type { SavedObjectsClientContract, SavedObjectsBatchResponse, ApplicationStart, + DocLinksStart, } from 'src/core/public'; import type { ScreenshotModePluginSetup } from 'src/plugins/screenshot_mode/public'; @@ -30,7 +31,6 @@ import { getTelemetrySendUsageFrom, } from '../common/telemetry_config'; import { getNotifyUserAboutOptInDefault } from '../common/telemetry_config/get_telemetry_notify_user_about_optin_default'; -import { PRIVACY_STATEMENT_URL } from '../common/constants'; import { HomePublicPluginSetup } from '../../home/public'; import { renderWelcomeTelemetryNotice } from './render_welcome_telemetry_notice'; @@ -67,6 +67,11 @@ export interface TelemetryPluginSetup { /** * Public's start exposed APIs by the telemetry plugin */ +export interface TelemetryConstants { + /** Elastic's privacy statement url **/ + getPrivacyStatementUrl: () => string; +} + export interface TelemetryPluginStart { /** {@link TelemetryServicePublicApis} **/ telemetryService: TelemetryServicePublicApis; @@ -76,10 +81,7 @@ export interface TelemetryPluginStart { setOptedInNoticeSeen: () => Promise; }; /** Set of publicly exposed telemetry constants **/ - telemetryConstants: { - /** Elastic's privacy statement url **/ - getPrivacyStatementUrl: () => string; - }; + telemetryConstants: TelemetryConstants; } interface TelemetryPluginSetupDependencies { @@ -109,6 +111,12 @@ export interface TelemetryPluginConfig { userCanChangeSettings?: boolean; } +function getTelemetryConstants(docLinks: DocLinksStart): TelemetryConstants { + return { + getPrivacyStatementUrl: () => docLinks.links.legal.privacyStatement, + }; +} + export class TelemetryPlugin implements Plugin { private readonly currentKibanaVersion: string; private readonly config: TelemetryPluginConfig; @@ -124,7 +132,7 @@ export class TelemetryPlugin implements Plugin { + telemetryConstants = getTelemetryConstants(docLinks); + }); + this.telemetrySender = new TelemetrySender(this.telemetryService, async () => { await this.refreshConfig(); }); @@ -149,7 +163,11 @@ export class TelemetryPlugin implements Plugin - renderWelcomeTelemetryNotice(this.telemetryService!, http.basePath.prepend) + renderWelcomeTelemetryNotice( + this.telemetryService!, + http.basePath.prepend, + telemetryConstants + ) ); } @@ -158,18 +176,26 @@ export class TelemetryPlugin implements Plugin telemetryNotifications.setOptedInNoticeSeen(), }, - telemetryConstants: { - getPrivacyStatementUrl: () => PRIVACY_STATEMENT_URL, - }, + telemetryConstants, }; } diff --git a/src/plugins/telemetry/public/render_welcome_telemetry_notice.test.ts b/src/plugins/telemetry/public/render_welcome_telemetry_notice.test.ts index 6da76db915656..1bf4ccab56240 100644 --- a/src/plugins/telemetry/public/render_welcome_telemetry_notice.test.ts +++ b/src/plugins/telemetry/public/render_welcome_telemetry_notice.test.ts @@ -8,24 +8,32 @@ import { mountWithIntl } from '@kbn/test-jest-helpers'; import { renderWelcomeTelemetryNotice } from './render_welcome_telemetry_notice'; -import { mockTelemetryService } from './mocks'; +import { mockTelemetryConstants, mockTelemetryService } from './mocks'; describe('renderWelcomeTelemetryNotice', () => { + const telemetryConstants = mockTelemetryConstants(); + test('it should show the opt-out message', () => { const telemetryService = mockTelemetryService(); - const component = mountWithIntl(renderWelcomeTelemetryNotice(telemetryService, (url) => url)); + const component = mountWithIntl( + renderWelcomeTelemetryNotice(telemetryService, (url) => url, telemetryConstants) + ); expect(component.exists('[id="telemetry.dataManagementDisableCollectionLink"]')).toBe(true); }); test('it should show the opt-in message', () => { const telemetryService = mockTelemetryService({ config: { optIn: false } }); - const component = mountWithIntl(renderWelcomeTelemetryNotice(telemetryService, (url) => url)); + const component = mountWithIntl( + renderWelcomeTelemetryNotice(telemetryService, (url) => url, telemetryConstants) + ); expect(component.exists('[id="telemetry.dataManagementEnableCollectionLink"]')).toBe(true); }); test('it should not show opt-in/out options if user cannot change the settings', () => { const telemetryService = mockTelemetryService({ config: { allowChangingOptInStatus: false } }); - const component = mountWithIntl(renderWelcomeTelemetryNotice(telemetryService, (url) => url)); + const component = mountWithIntl( + renderWelcomeTelemetryNotice(telemetryService, (url) => url, telemetryConstants) + ); expect(component.exists('[id="telemetry.dataManagementDisableCollectionLink"]')).toBe(false); expect(component.exists('[id="telemetry.dataManagementEnableCollectionLink"]')).toBe(false); }); diff --git a/src/plugins/telemetry/public/render_welcome_telemetry_notice.tsx b/src/plugins/telemetry/public/render_welcome_telemetry_notice.tsx index 8ef26fb797d53..7d460ded2571e 100644 --- a/src/plugins/telemetry/public/render_welcome_telemetry_notice.tsx +++ b/src/plugins/telemetry/public/render_welcome_telemetry_notice.tsx @@ -10,11 +10,12 @@ import React from 'react'; import { EuiLink, EuiSpacer, EuiTextColor } from '@elastic/eui'; import { FormattedMessage } from '@kbn/i18n-react'; import type { TelemetryService } from './services'; -import { PRIVACY_STATEMENT_URL } from '../common/constants'; +import { TelemetryConstants } from './plugin'; export function renderWelcomeTelemetryNotice( telemetryService: TelemetryService, - addBasePath: (url: string) => string + addBasePath: (url: string) => string, + telemetryConstants: TelemetryConstants ) { return ( <> @@ -23,7 +24,7 @@ export function renderWelcomeTelemetryNotice( id="telemetry.dataManagementDisclaimerPrivacy" defaultMessage="To learn about how usage data helps us manage and improve our products and services, see our " /> - + { it('adds a banner to banners with priority of 10000', () => { const bannerID = 'brucer-wayne'; const overlays = overlayServiceMock.createStartContract(); + const telemetryConstants = mockTelemetryConstants(); overlays.banners.add.mockReturnValue(bannerID); const returnedBannerId = renderOptInBanner({ setOptIn: jest.fn(), overlays, + telemetryConstants, }); expect(overlays.banners.add).toBeCalledTimes(1); diff --git a/src/plugins/telemetry/public/services/telemetry_notifications/render_opt_in_banner.tsx b/src/plugins/telemetry/public/services/telemetry_notifications/render_opt_in_banner.tsx index f880aef3e3235..7626be56bfa46 100644 --- a/src/plugins/telemetry/public/services/telemetry_notifications/render_opt_in_banner.tsx +++ b/src/plugins/telemetry/public/services/telemetry_notifications/render_opt_in_banner.tsx @@ -7,17 +7,21 @@ */ import React from 'react'; -import { CoreStart } from 'kibana/public'; +import { OverlayStart } from 'kibana/public'; import { OptInBanner } from '../../components/opt_in_banner'; import { toMountPoint } from '../../../../kibana_react/public'; +import { TelemetryConstants } from '../..'; interface RenderBannerConfig { - overlays: CoreStart['overlays']; + overlays: OverlayStart; setOptIn: (isOptIn: boolean) => Promise; + telemetryConstants: TelemetryConstants; } -export function renderOptInBanner({ setOptIn, overlays }: RenderBannerConfig) { - const mount = toMountPoint(); +export function renderOptInBanner({ setOptIn, overlays, telemetryConstants }: RenderBannerConfig) { + const mount = toMountPoint( + + ); const bannerId = overlays.banners.add(mount, 10000); return bannerId; diff --git a/src/plugins/telemetry/public/services/telemetry_notifications/render_opted_in_notice_banner.test.ts b/src/plugins/telemetry/public/services/telemetry_notifications/render_opted_in_notice_banner.test.ts index 77c3a9854cc89..bc56f9ff6107f 100644 --- a/src/plugins/telemetry/public/services/telemetry_notifications/render_opted_in_notice_banner.test.ts +++ b/src/plugins/telemetry/public/services/telemetry_notifications/render_opted_in_notice_banner.test.ts @@ -7,22 +7,22 @@ */ import { renderOptedInNoticeBanner } from './render_opted_in_notice_banner'; -// eslint-disable-next-line @kbn/eslint/no-restricted-paths -import { overlayServiceMock } from '../../../../../core/public/overlays/overlay_service.mock'; -// eslint-disable-next-line @kbn/eslint/no-restricted-paths -import { httpServiceMock } from '../../../../../core/public/http/http_service.mock'; +import { overlayServiceMock, httpServiceMock } from '../../../../../core/public/mocks'; +import { mockTelemetryConstants } from '../../mocks'; describe('renderOptedInNoticeBanner', () => { it('adds a banner to banners with priority of 10000', () => { const bannerID = 'brucer-wayne'; const overlays = overlayServiceMock.createStartContract(); const mockHttp = httpServiceMock.createStartContract(); + const telemetryConstants = mockTelemetryConstants(); overlays.banners.add.mockReturnValue(bannerID); const returnedBannerId = renderOptedInNoticeBanner({ http: mockHttp, onSeen: jest.fn(), overlays, + telemetryConstants, }); expect(overlays.banners.add).toBeCalledTimes(1); diff --git a/src/plugins/telemetry/public/services/telemetry_notifications/render_opted_in_notice_banner.tsx b/src/plugins/telemetry/public/services/telemetry_notifications/render_opted_in_notice_banner.tsx index d8d8c28c01977..ca2b34de06afd 100644 --- a/src/plugins/telemetry/public/services/telemetry_notifications/render_opted_in_notice_banner.tsx +++ b/src/plugins/telemetry/public/services/telemetry_notifications/render_opted_in_notice_banner.tsx @@ -7,17 +7,30 @@ */ import React from 'react'; -import { CoreStart } from 'kibana/public'; +import { HttpStart, OverlayStart } from 'kibana/public'; import { OptedInNoticeBanner } from '../../components/opted_in_notice_banner'; import { toMountPoint } from '../../../../kibana_react/public'; +import { TelemetryConstants } from '../..'; interface RenderBannerConfig { - http: CoreStart['http']; - overlays: CoreStart['overlays']; + http: HttpStart; + overlays: OverlayStart; onSeen: () => void; + telemetryConstants: TelemetryConstants; } -export function renderOptedInNoticeBanner({ onSeen, overlays, http }: RenderBannerConfig) { - const mount = toMountPoint(); +export function renderOptedInNoticeBanner({ + onSeen, + overlays, + http, + telemetryConstants, +}: RenderBannerConfig) { + const mount = toMountPoint( + + ); const bannerId = overlays.banners.add(mount, 10000); return bannerId; diff --git a/src/plugins/telemetry/public/services/telemetry_notifications/telemetry_notifications.ts b/src/plugins/telemetry/public/services/telemetry_notifications/telemetry_notifications.ts index 0070cf7452767..e674942acb9bd 100644 --- a/src/plugins/telemetry/public/services/telemetry_notifications/telemetry_notifications.ts +++ b/src/plugins/telemetry/public/services/telemetry_notifications/telemetry_notifications.ts @@ -6,31 +6,40 @@ * Side Public License, v 1. */ -import { CoreStart } from 'kibana/public'; +import { HttpStart, OverlayStart } from 'kibana/public'; import { renderOptedInNoticeBanner } from './render_opted_in_notice_banner'; import { renderOptInBanner } from './render_opt_in_banner'; import { TelemetryService } from '../telemetry_service'; +import { TelemetryConstants } from '../..'; interface TelemetryNotificationsConstructor { - http: CoreStart['http']; - overlays: CoreStart['overlays']; + http: HttpStart; + overlays: OverlayStart; telemetryService: TelemetryService; + telemetryConstants: TelemetryConstants; } /** * Helpers to the Telemetry banners spread through the code base in Welcome and Home landing pages. */ export class TelemetryNotifications { - private readonly http: CoreStart['http']; - private readonly overlays: CoreStart['overlays']; + private readonly http: HttpStart; + private readonly overlays: OverlayStart; + private readonly telemetryConstants: TelemetryConstants; private readonly telemetryService: TelemetryService; private optedInNoticeBannerId?: string; private optInBannerId?: string; - constructor({ http, overlays, telemetryService }: TelemetryNotificationsConstructor) { + constructor({ + http, + overlays, + telemetryService, + telemetryConstants, + }: TelemetryNotificationsConstructor) { this.telemetryService = telemetryService; this.http = http; this.overlays = overlays; + this.telemetryConstants = telemetryConstants; } /** @@ -50,6 +59,7 @@ export class TelemetryNotifications { http: this.http, onSeen: this.setOptedInNoticeSeen, overlays: this.overlays, + telemetryConstants: this.telemetryConstants, }); this.optedInNoticeBannerId = bannerId; @@ -71,6 +81,7 @@ export class TelemetryNotifications { const bannerId = renderOptInBanner({ setOptIn: this.onSetOptInClick, overlays: this.overlays, + telemetryConstants: this.telemetryConstants, }); this.optInBannerId = bannerId; diff --git a/src/plugins/telemetry_management_section/public/components/__snapshots__/telemetry_management_section.test.tsx.snap b/src/plugins/telemetry_management_section/public/components/__snapshots__/telemetry_management_section.test.tsx.snap index cccbd07fe14b3..af96227c55284 100644 --- a/src/plugins/telemetry_management_section/public/components/__snapshots__/telemetry_management_section.test.tsx.snap +++ b/src/plugins/telemetry_management_section/public/components/__snapshots__/telemetry_management_section.test.tsx.snap @@ -47,7 +47,13 @@ exports[`TelemetryManagementSectionComponent renders as expected 1`] = ` size="s" /> { const coreStart = coreMock.createStart(); - const docLinks = {} as DocLinksStart['links']; + const docLinks = { + legal: { privacyStatement: 'https://some-host/some-url' }, + } as unknown as DocLinksStart['links']; const coreSetup = coreMock.createSetup(); it('renders as expected', () => { diff --git a/src/plugins/telemetry_management_section/public/components/telemetry_management_section.tsx b/src/plugins/telemetry_management_section/public/components/telemetry_management_section.tsx index 02e7e40528f68..331b9f895b8a5 100644 --- a/src/plugins/telemetry_management_section/public/components/telemetry_management_section.tsx +++ b/src/plugins/telemetry_management_section/public/components/telemetry_management_section.tsx @@ -13,7 +13,6 @@ import { FormattedMessage } from '@kbn/i18n-react'; import { i18n } from '@kbn/i18n'; import type { TelemetryPluginSetup } from 'src/plugins/telemetry/public'; import type { DocLinksStart, ToastsStart } from 'src/core/public'; -import { PRIVACY_STATEMENT_URL } from '../../../telemetry/common/constants'; import { OptInExampleFlyout } from './opt_in_example_flyout'; import { LazyField } from '../../../advanced_settings/public'; import { TrackApplicationView } from '../../../usage_collection/public'; @@ -131,7 +130,7 @@ export class TelemetryManagementSection extends Component { isCustom: true, }} loading={processing} - dockLinks={this.props.docLinks} + docLinks={this.props.docLinks} toasts={this.props.toasts} handleChange={this.toggleOptIn} enableSaving={this.props.enableSaving} @@ -174,6 +173,8 @@ export class TelemetryManagementSection extends Component { }; renderDescription = () => { + const { docLinks } = this.props; + const clusterDataLink = ( @@ -199,7 +200,7 @@ export class TelemetryManagementSection extends Component { See our {privacyStatementLink} for more details." values={{ privacyStatementLink: ( - + ; const TelemetryManagementSectionComponent = lazy(() => import('./telemetry_management_section')); export function telemetryManagementSectionWrapper( - telemetryService: TelemetryPluginSetup['telemetryService'] + telemetryService: TelemetryPluginSetup['telemetryService'], + docLinks: DocLinksStart['links'] ) { const TelemetryManagementSectionWrapper = (props: TelemetryManagementSectionWrapperProps) => ( }> diff --git a/src/plugins/telemetry_management_section/public/plugin.tsx b/src/plugins/telemetry_management_section/public/plugin.tsx index e75dbfe9d56b5..91e3d4b9422e0 100644 --- a/src/plugins/telemetry_management_section/public/plugin.tsx +++ b/src/plugins/telemetry_management_section/public/plugin.tsx @@ -10,7 +10,7 @@ import React from 'react'; import type { AdvancedSettingsSetup } from 'src/plugins/advanced_settings/public'; import type { TelemetryPluginSetup } from 'src/plugins/telemetry/public'; import type { UsageCollectionSetup } from 'src/plugins/usage_collection/public'; -import type { CoreStart, CoreSetup } from 'src/core/public'; +import type { CoreStart, CoreSetup, DocLinksStart } from 'src/core/public'; import { telemetryManagementSectionWrapper, @@ -32,6 +32,12 @@ export class TelemetryManagementSectionPlugin { usageCollection, }: TelemetryManagementSectionPluginDepsSetup ) { + let docLinksLinks: DocLinksStart['links']; + + core.getStartServices().then(([{ docLinks }]) => { + docLinksLinks = docLinks?.links; + }); + const ApplicationUsageTrackingProvider = usageCollection?.components.ApplicationUsageTrackingProvider ?? React.Fragment; advancedSettings.component.register( @@ -39,9 +45,10 @@ export class TelemetryManagementSectionPlugin { (props) => { return ( - {telemetryManagementSectionWrapper(telemetryService)( - props as TelemetryManagementSectionWrapperProps - )} + {telemetryManagementSectionWrapper( + telemetryService, + docLinksLinks + )(props as TelemetryManagementSectionWrapperProps)} ); }, diff --git a/x-pack/plugins/apm/public/components/fleet_integration/apm_agents/render_mustache.ts b/x-pack/plugins/apm/public/components/fleet_integration/apm_agents/render_mustache.ts index ebf5fea7f2b85..212bb9554dd05 100644 --- a/x-pack/plugins/apm/public/components/fleet_integration/apm_agents/render_mustache.ts +++ b/x-pack/plugins/apm/public/components/fleet_integration/apm_agents/render_mustache.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { CoreStart } from 'kibana/public'; +import { DocLinksStart } from 'kibana/public'; import Mustache from 'mustache'; const TEMPLATE_TAGS = ['{', '}']; @@ -15,7 +15,7 @@ export function renderMustache({ docLinks, }: { text: string | string[]; - docLinks?: CoreStart['docLinks']; + docLinks?: DocLinksStart; }) { const template = Array.isArray(text) ? text.join('\n') : text; diff --git a/x-pack/plugins/canvas/public/services/stubs/platform.ts b/x-pack/plugins/canvas/public/services/stubs/platform.ts index 71a252028a242..b50f2d3589827 100644 --- a/x-pack/plugins/canvas/public/services/stubs/platform.ts +++ b/x-pack/plugins/canvas/public/services/stubs/platform.ts @@ -22,7 +22,7 @@ const getUISetting = (setting: string) => uiSettings[setting]; export const platformServiceFactory: CanvasPlatformServiceFactory = () => ({ getBasePath: () => '/base/path', getBasePathInterface: noop, - getDocLinkVersion: () => 'dockLinkVersion', + getDocLinkVersion: () => 'docLinkVersion', getElasticWebsiteUrl: () => 'https://elastic.co', getKibanaVersion: () => 'kibanaVersion', getHasWriteAccess: () => true, diff --git a/x-pack/plugins/graph/public/components/search_bar.test.tsx b/x-pack/plugins/graph/public/components/search_bar.test.tsx index c16e661c85bf8..72f95ecb0dc10 100644 --- a/x-pack/plugins/graph/public/components/search_bar.test.tsx +++ b/x-pack/plugins/graph/public/components/search_bar.test.tsx @@ -8,7 +8,14 @@ import { mountWithIntl } from '@kbn/test-jest-helpers'; import { SearchBar, SearchBarProps, SearchBarComponent, SearchBarStateProps } from './search_bar'; import React, { Component, ReactElement } from 'react'; -import { CoreStart } from 'src/core/public'; +import { + DocLinksStart, + HttpStart, + IUiSettingsClient, + NotificationsStart, + OverlayStart, + SavedObjectsStart, +} from 'kibana/public'; import { act } from 'react-dom/test-utils'; import { IndexPattern, QueryStringInput } from '../../../../../src/plugins/data/public'; @@ -32,18 +39,18 @@ function getServiceMocks() { get: (key: string) => { return 10; }, - } as CoreStart['uiSettings'], - savedObjects: {} as CoreStart['savedObjects'], - notifications: {} as CoreStart['notifications'], + } as IUiSettingsClient, + savedObjects: {} as SavedObjectsStart, + notifications: {} as NotificationsStart, docLinks: { links: { query: { kueryQuerySyntax: '', }, }, - } as CoreStart['docLinks'], - http: {} as CoreStart['http'], - overlays: {} as CoreStart['overlays'], + } as DocLinksStart, + http: {} as HttpStart, + overlays: {} as OverlayStart, storage: { get: () => {}, }, diff --git a/x-pack/plugins/index_management/public/application/app_context.tsx b/x-pack/plugins/index_management/public/application/app_context.tsx index f44ff13b205db..b41e37a5f441c 100644 --- a/x-pack/plugins/index_management/public/application/app_context.tsx +++ b/x-pack/plugins/index_management/public/application/app_context.tsx @@ -10,7 +10,14 @@ import { Observable } from 'rxjs'; import SemVer from 'semver/classes/semver'; import { ManagementAppMountParams } from 'src/plugins/management/public'; import { UsageCollectionSetup } from 'src/plugins/usage_collection/public'; -import { CoreSetup, CoreStart, CoreTheme, ScopedHistory } from 'src/core/public'; +import { + ApplicationStart, + CoreTheme, + FatalErrorsStart, + ScopedHistory, + DocLinksStart, + IUiSettingsClient, +} from 'src/core/public'; import { SharePluginStart } from 'src/plugins/share/public'; import { ExtensionsService } from '../services'; @@ -20,8 +27,8 @@ const AppContext = createContext(undefined); export interface AppDependencies { core: { - fatalErrors: CoreStart['fatalErrors']; - getUrlForApp: CoreStart['application']['getUrlForApp']; + fatalErrors: FatalErrorsStart; + getUrlForApp: ApplicationStart['getUrlForApp']; }; plugins: { usageCollection: UsageCollectionSetup; @@ -35,9 +42,9 @@ export interface AppDependencies { }; history: ScopedHistory; setBreadcrumbs: ManagementAppMountParams['setBreadcrumbs']; - uiSettings: CoreSetup['uiSettings']; + uiSettings: IUiSettingsClient; url: SharePluginStart['url']; - docLinks: CoreStart['docLinks']; + docLinks: DocLinksStart; kibanaVersion: SemVer; theme$: Observable; } diff --git a/x-pack/plugins/monitoring/public/legacy_shims.ts b/x-pack/plugins/monitoring/public/legacy_shims.ts index d0f3cc669326d..ad1cba4620252 100644 --- a/x-pack/plugins/monitoring/public/legacy_shims.ts +++ b/x-pack/plugins/monitoring/public/legacy_shims.ts @@ -5,7 +5,17 @@ * 2.0. */ -import { CoreStart, HttpSetup, IUiSettingsClient, AppMountParameters } from 'kibana/public'; +import { + CoreStart, + HttpSetup, + IUiSettingsClient, + AppMountParameters, + NotificationsStart, + ApplicationStart, + DocLinksStart, + ChromeStart, + I18nStart, +} from 'kibana/public'; import { Observable } from 'rxjs'; import { HttpRequestInit } from '../../../../src/core/public'; import { @@ -41,17 +51,17 @@ export interface KFetchKibanaOptions { } export interface IShims { - toastNotifications: CoreStart['notifications']['toasts']; - capabilities: CoreStart['application']['capabilities']; + toastNotifications: NotificationsStart['toasts']; + capabilities: ApplicationStart['capabilities']; getBasePath: () => string; getInjected: (name: string, defaultValue?: unknown) => unknown; breadcrumbs: { set: (breadcrumbs: BreadcrumbItem[]) => void; update: (breadcrumbs?: BreadcrumbItem[]) => void; }; - I18nContext: CoreStart['i18n']['Context']; - docLinks: CoreStart['docLinks']; - docTitle: CoreStart['chrome']['docTitle']; + I18nContext: I18nStart['Context']; + docLinks: DocLinksStart; + docTitle: ChromeStart['docTitle']; timefilter: MonitoringStartPluginDependencies['data']['query']['timefilter']['timefilter']; actionTypeRegistry: TypeRegistry; ruleTypeRegistry: TypeRegistry; diff --git a/x-pack/plugins/security/public/components/doc_link.tsx b/x-pack/plugins/security/public/components/doc_link.tsx index b19883f6e58d7..c3565818090ee 100644 --- a/x-pack/plugins/security/public/components/doc_link.tsx +++ b/x-pack/plugins/security/public/components/doc_link.tsx @@ -9,11 +9,11 @@ import { EuiLink } from '@elastic/eui'; import type { FunctionComponent } from 'react'; import React, { useCallback } from 'react'; -import type { CoreStart } from 'src/core/public'; +import type { DocLinksStart } from 'kibana/public'; import { useKibana } from '../../../../../src/plugins/kibana_react/public'; -export type DocLinks = CoreStart['docLinks']['links']; +export type DocLinks = DocLinksStart['links']; export type GetDocLinkFunction = (app: string, doc: string) => string; /** diff --git a/x-pack/plugins/transform/public/app/app_dependencies.tsx b/x-pack/plugins/transform/public/app/app_dependencies.tsx index 89807fb2e1247..a89f8d5c944fa 100644 --- a/x-pack/plugins/transform/public/app/app_dependencies.tsx +++ b/x-pack/plugins/transform/public/app/app_dependencies.tsx @@ -5,9 +5,20 @@ * 2.0. */ -import type { CoreSetup, CoreStart } from 'src/core/public'; +import type { + ApplicationStart, + ChromeStart, + DocLinksStart, + HttpSetup, + I18nStart, + IUiSettingsClient, + NotificationsSetup, + OverlayStart, + SavedObjectsStart, + ThemeServiceStart, +} from 'kibana/public'; +import type { SavedObjectsStart as SavedObjectsPluginStart } from 'src/plugins/saved_objects/public'; import type { DataPublicPluginStart } from 'src/plugins/data/public'; -import type { SavedObjectsStart } from 'src/plugins/saved_objects/public'; import type { ScopedHistory } from 'kibana/public'; import type { SharePluginStart } from 'src/plugins/share/public'; import type { SpacesPluginStart } from '../../../spaces/public'; @@ -19,20 +30,20 @@ import type { GetMlSharedImportsReturnType } from '../shared_imports'; import type { TriggersAndActionsUIPublicPluginStart } from '../../../triggers_actions_ui/public'; export interface AppDependencies { - application: CoreStart['application']; - chrome: CoreStart['chrome']; + application: ApplicationStart; + chrome: ChromeStart; data: DataPublicPluginStart; - docLinks: CoreStart['docLinks']; - http: CoreSetup['http']; - i18n: CoreStart['i18n']; - notifications: CoreSetup['notifications']; - uiSettings: CoreStart['uiSettings']; - savedObjects: CoreStart['savedObjects']; + docLinks: DocLinksStart; + http: HttpSetup; + i18n: I18nStart; + notifications: NotificationsSetup; + uiSettings: IUiSettingsClient; + savedObjects: SavedObjectsStart; storage: Storage; - overlays: CoreStart['overlays']; - theme: CoreStart['theme']; + overlays: OverlayStart; + theme: ThemeServiceStart; history: ScopedHistory; - savedObjectsPlugin: SavedObjectsStart; + savedObjectsPlugin: SavedObjectsPluginStart; share: SharePluginStart; ml: GetMlSharedImportsReturnType; spaces?: SpacesPluginStart; diff --git a/x-pack/plugins/ux/public/hooks/use_kibana_services.tsx b/x-pack/plugins/ux/public/hooks/use_kibana_services.tsx index c1cf3d714df2c..d26499131a49d 100644 --- a/x-pack/plugins/ux/public/hooks/use_kibana_services.tsx +++ b/x-pack/plugins/ux/public/hooks/use_kibana_services.tsx @@ -5,15 +5,20 @@ * 2.0. */ -import { CoreStart } from 'kibana/public'; +import { + HttpStart, + DocLinksStart, + IUiSettingsClient, + ApplicationStart, +} from 'kibana/public'; import { useKibana } from '../../../../../src/plugins/kibana_react/public'; import { ApmPluginStartDeps } from '../plugin'; interface UxKibanaServices extends ApmPluginStartDeps { - http: CoreStart['http']; - docLinks: CoreStart['docLinks']; - uiSettings: CoreStart['uiSettings']; - application: CoreStart['application']; + http: HttpStart; + docLinks: DocLinksStart; + uiSettings: IUiSettingsClient; + application: ApplicationStart; } export function useKibanaServices() {