diff --git a/.eslintignore b/.eslintignore index 24a3214126de4..211ee52634a04 100644 --- a/.eslintignore +++ b/.eslintignore @@ -29,7 +29,6 @@ snapshots.js /x-pack/plugins/reporting/server/export_types/printable_pdf/server/lib/pdf/assets/** /x-pack/plugins/reporting/server/export_types/printable_pdf_v2/server/lib/pdf/assets/** /x-pack/plugins/cloud_integrations/cloud_full_story/server/assets/** -/x-pack/plugins/cloud_integrations/cloud_gain_sight/server/assets/** # package overrides /packages/kbn-eslint-config diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 74beea70c0a01..25072d13147de 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -39,7 +39,6 @@ packages/analytics/shippers/elastic_v3/browser @elastic/kibana-core packages/analytics/shippers/elastic_v3/common @elastic/kibana-core packages/analytics/shippers/elastic_v3/server @elastic/kibana-core packages/analytics/shippers/fullstory @elastic/kibana-core -packages/analytics/shippers/gainsight @elastic/kibana-core packages/kbn-apm-config-loader @elastic/kibana-core @vigneshshanmugam x-pack/plugins/apm_data_access @elastic/obs-knowledge-team @elastic/obs-ux-infra_services-team x-pack/plugins/apm @elastic/obs-ux-infra_services-team @@ -81,7 +80,6 @@ x-pack/plugins/cloud_integrations/cloud_data_migration @elastic/platform-onboard x-pack/plugins/cloud_defend @elastic/kibana-cloud-security-posture x-pack/plugins/cloud_integrations/cloud_experiments @elastic/kibana-core x-pack/plugins/cloud_integrations/cloud_full_story @elastic/kibana-core -x-pack/plugins/cloud_integrations/cloud_gain_sight @elastic/kibana-core x-pack/test/cloud_integration/plugins/saml_provider @elastic/kibana-core x-pack/plugins/cloud_integrations/cloud_links @elastic/kibana-core x-pack/plugins/cloud @elastic/kibana-core diff --git a/NOTICE.txt b/NOTICE.txt index d02031c4b5a2b..0f79b16b0b043 100644 --- a/NOTICE.txt +++ b/NOTICE.txt @@ -225,11 +225,6 @@ 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. ---- -Portions of this code are licensed under the following license: -Gainsight PX Agent Wrapper Agent Version: 0.46.0 Installed: 2022-08-25 08:07 -https://www.gainsight.com/policy/gainsight-px-license-agreement/ - --- This code includes a copy of the `normalize-path` https://github.com/jonschlinkert/normalize-path/blob/52c3a95ebebc2d98c1ad7606cbafa7e658656899/index.js @@ -347,9 +342,3 @@ LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ---- -Copyright (c) 2013 HubSpot, Inc. -Released under the MIT license - -https://github.com/HubSpot/vex/blob/master/LICENSE - diff --git a/docs/developer/plugin-list.asciidoc b/docs/developer/plugin-list.asciidoc index e50cadb8f1398..a9e7593d11a54 100644 --- a/docs/developer/plugin-list.asciidoc +++ b/docs/developer/plugin-list.asciidoc @@ -502,10 +502,6 @@ The plugin exposes the static DefaultEditorController class to consume. |Integrates with FullStory in order to provide better product analytics, so we can understand how our users make use of Kibana. This plugin should only run on Elastic Cloud. -|{kib-repo}blob/{branch}/x-pack/plugins/cloud_integrations/cloud_gain_sight/README.md[cloudGainsight] -|Integrates with Gainsight in order to provide better product analytics, so we can understand how our users make use of Kibana. This plugin should only run on Elastic Cloud. - - |{kib-repo}blob/{branch}/x-pack/plugins/cloud_integrations/cloud_links/README.md[cloudLinks] |Adds all the links to the Elastic Cloud console. diff --git a/package.json b/package.json index d1e552344a70c..b5968e48b79e1 100644 --- a/package.json +++ b/package.json @@ -158,7 +158,6 @@ "@kbn/analytics-shippers-elastic-v3-common": "link:packages/analytics/shippers/elastic_v3/common", "@kbn/analytics-shippers-elastic-v3-server": "link:packages/analytics/shippers/elastic_v3/server", "@kbn/analytics-shippers-fullstory": "link:packages/analytics/shippers/fullstory", - "@kbn/analytics-shippers-gainsight": "link:packages/analytics/shippers/gainsight", "@kbn/apm-config-loader": "link:packages/kbn-apm-config-loader", "@kbn/apm-data-access-plugin": "link:x-pack/plugins/apm_data_access", "@kbn/apm-plugin": "link:x-pack/plugins/apm", @@ -187,7 +186,6 @@ "@kbn/cloud-defend-plugin": "link:x-pack/plugins/cloud_defend", "@kbn/cloud-experiments-plugin": "link:x-pack/plugins/cloud_integrations/cloud_experiments", "@kbn/cloud-full-story-plugin": "link:x-pack/plugins/cloud_integrations/cloud_full_story", - "@kbn/cloud-gainsight-plugin": "link:x-pack/plugins/cloud_integrations/cloud_gain_sight", "@kbn/cloud-integration-saml-provider-plugin": "link:x-pack/test/cloud_integration/plugins/saml_provider", "@kbn/cloud-links-plugin": "link:x-pack/plugins/cloud_integrations/cloud_links", "@kbn/cloud-plugin": "link:x-pack/plugins/cloud", diff --git a/packages/analytics/shippers/README.md b/packages/analytics/shippers/README.md index 109bdd64700ab..5ab85d08ff2ca 100644 --- a/packages/analytics/shippers/README.md +++ b/packages/analytics/shippers/README.md @@ -3,6 +3,5 @@ This directory holds the implementation of the _built-in_ shippers provided by the Analytics client. At the moment, the shippers are: * [FullStory](./fullstory/README.md) -* [Gainsight](./gainsight/README.md) * [Elastic V3 (Browser shipper)](./elastic_v3/browser/README.md) * [Elastic V3 (Server-side shipper)](./elastic_v3/server/README.md) diff --git a/packages/analytics/shippers/gainsight/README.md b/packages/analytics/shippers/gainsight/README.md deleted file mode 100644 index 3baed8dcdf479..0000000000000 --- a/packages/analytics/shippers/gainsight/README.md +++ /dev/null @@ -1,14 +0,0 @@ -# @kbn/analytics-shippers-gainsight - -Gainsight implementation as a shipper for the `@kbn/analytics-client`. - -## How to use it - -This module is intended to be used **on the browser only**. It does not support server-side events. - -```typescript -import { GainsightShipper } from "@kbn/analytics-shippers-gainsight"; - -analytics.registerShipper(GainsightShipper, { gainsightOrgId: '12345' }) -``` - diff --git a/packages/analytics/shippers/gainsight/index.ts b/packages/analytics/shippers/gainsight/index.ts deleted file mode 100644 index 87f83aa109450..0000000000000 --- a/packages/analytics/shippers/gainsight/index.ts +++ /dev/null @@ -1,10 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0 and the Server Side Public License, v 1; you may not use this file except - * in compliance with, at your election, the Elastic License 2.0 or the Server - * Side Public License, v 1. - */ - -export { GainsightShipper } from './src/gainsight_shipper'; -export type { GainsightSnippetConfig } from './src/load_snippet'; diff --git a/packages/analytics/shippers/gainsight/jest.config.js b/packages/analytics/shippers/gainsight/jest.config.js deleted file mode 100644 index da1d4447637d5..0000000000000 --- a/packages/analytics/shippers/gainsight/jest.config.js +++ /dev/null @@ -1,13 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0 and the Server Side Public License, v 1; you may not use this file except - * in compliance with, at your election, the Elastic License 2.0 or the Server - * Side Public License, v 1. - */ - -module.exports = { - preset: '@kbn/test/jest_node', - rootDir: '../../../../', - roots: ['/packages/analytics/shippers/gainsight'], -}; diff --git a/packages/analytics/shippers/gainsight/kibana.jsonc b/packages/analytics/shippers/gainsight/kibana.jsonc deleted file mode 100644 index 3731f34d34ad1..0000000000000 --- a/packages/analytics/shippers/gainsight/kibana.jsonc +++ /dev/null @@ -1,5 +0,0 @@ -{ - "type": "shared-browser", - "id": "@kbn/analytics-shippers-gainsight", - "owner": "@elastic/kibana-core" -} diff --git a/packages/analytics/shippers/gainsight/package.json b/packages/analytics/shippers/gainsight/package.json deleted file mode 100644 index 8b68459c29bfe..0000000000000 --- a/packages/analytics/shippers/gainsight/package.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "name": "@kbn/analytics-shippers-gainsight", - "private": true, - "version": "1.0.0", - "author": "Kibana Core", - "license": "SSPL-1.0 OR Elastic License 2.0" -} \ No newline at end of file diff --git a/packages/analytics/shippers/gainsight/src/gainsight_shipper.test.mocks.ts b/packages/analytics/shippers/gainsight/src/gainsight_shipper.test.mocks.ts deleted file mode 100644 index 8e5f16e320c8c..0000000000000 --- a/packages/analytics/shippers/gainsight/src/gainsight_shipper.test.mocks.ts +++ /dev/null @@ -1,18 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0 and the Server Side Public License, v 1; you may not use this file except - * in compliance with, at your election, the Elastic License 2.0 or the Server - * Side Public License, v 1. - */ - -import type { GainsightApi } from './types'; - -export const gainsightApiMock: GainsightApi = jest.fn(); -gainsightApiMock.init = true; - -jest.doMock('./load_snippet', () => { - return { - loadSnippet: () => gainsightApiMock, - }; -}); diff --git a/packages/analytics/shippers/gainsight/src/gainsight_shipper.test.ts b/packages/analytics/shippers/gainsight/src/gainsight_shipper.test.ts deleted file mode 100644 index 9d646203dff1e..0000000000000 --- a/packages/analytics/shippers/gainsight/src/gainsight_shipper.test.ts +++ /dev/null @@ -1,102 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0 and the Server Side Public License, v 1; you may not use this file except - * in compliance with, at your election, the Elastic License 2.0 or the Server - * Side Public License, v 1. - */ - -import { loggerMock } from '@kbn/logging-mocks'; -import { gainsightApiMock } from './gainsight_shipper.test.mocks'; -import { GainsightShipper } from './gainsight_shipper'; - -describe('gainsightShipper', () => { - let gainsightShipper: GainsightShipper; - - beforeEach(() => { - jest.resetAllMocks(); - gainsightShipper = new GainsightShipper( - { - gainsightOrgId: 'test-org-id', - }, - { - logger: loggerMock.create(), - sendTo: 'staging', - isDev: true, - } - ); - }); - - describe('extendContext', () => { - describe('identify', () => { - test('calls `identify` when the clusterName is provided', () => { - const userId = 'test-user-id'; - const clusterName = '123654'; - gainsightShipper.extendContext({ userId, cluster_name: clusterName }); - expect(gainsightApiMock).toHaveBeenCalledWith('identify', { - id: clusterName, - userType: 'deployment', - }); - }); - - test('calls `identify` again only if the clusterName changes', () => { - const userId = 'test-user-id'; - const clusterName = '123654'; - gainsightShipper.extendContext({ userId, cluster_name: clusterName }); - expect(gainsightApiMock).toHaveBeenCalledTimes(2); - expect(gainsightApiMock).toHaveBeenCalledWith('identify', { - id: clusterName, - userType: 'deployment', - }); - expect(gainsightApiMock).toHaveBeenCalledWith('set', 'globalContext', { - kibanaUserId: userId, - }); - - gainsightShipper.extendContext({ userId, cluster_name: clusterName }); - expect(gainsightApiMock).toHaveBeenCalledTimes(3); - - gainsightShipper.extendContext({ userId, cluster_name: `${clusterName}-1` }); - expect(gainsightApiMock).toHaveBeenCalledTimes(5); // called again because the user changed - }); - }); - }); - - describe('optIn', () => { - test('should call consent true and restart when isOptIn: true', () => { - gainsightShipper.optIn(true); - expect(gainsightApiMock).toHaveBeenCalledWith('config', 'enableTag', true); - }); - - test('should call consent false and shutdown when isOptIn: false', () => { - gainsightShipper.optIn(false); - expect(gainsightApiMock).toHaveBeenCalledWith('config', 'enableTag', false); - }); - }); - - describe('reportEvents', () => { - test('calls the API once per event in the array with the properties transformed', () => { - gainsightShipper.reportEvents([ - { - event_type: 'test-event-1', - timestamp: '2020-01-01T00:00:00.000Z', - properties: { test: 'test-1' }, - context: { pageName: 'test-page-1' }, - }, - { - event_type: 'test-event-2', - timestamp: '2020-01-01T00:00:00.000Z', - properties: { other_property: 'test-2' }, - context: { pageName: 'test-page-1' }, - }, - ]); - - expect(gainsightApiMock).toHaveBeenCalledTimes(2); - expect(gainsightApiMock).toHaveBeenCalledWith('track', 'test-event-1', { - test: 'test-1', - }); - expect(gainsightApiMock).toHaveBeenCalledWith('track', 'test-event-2', { - other_property: 'test-2', - }); - }); - }); -}); diff --git a/packages/analytics/shippers/gainsight/src/gainsight_shipper.ts b/packages/analytics/shippers/gainsight/src/gainsight_shipper.ts deleted file mode 100644 index 157cfaee22f0c..0000000000000 --- a/packages/analytics/shippers/gainsight/src/gainsight_shipper.ts +++ /dev/null @@ -1,109 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0 and the Server Side Public License, v 1; you may not use this file except - * in compliance with, at your election, the Elastic License 2.0 or the Server - * Side Public License, v 1. - */ - -import type { - AnalyticsClientInitContext, - EventContext, - Event, - IShipper, -} from '@kbn/analytics-client'; -import type { GainsightApi } from './types'; -import type { GainsightSnippetConfig } from './load_snippet'; -import { loadSnippet } from './load_snippet'; - -/** - * gainsight shipper. - */ -export class GainsightShipper implements IShipper { - /** Shipper's unique name */ - public static shipperName = 'Gainsight'; - private lastClusterName: string | undefined; - private readonly gainsightApi: GainsightApi; - - /** - * Creates a new instance of the gainsightShipper. - * @param config {@link GainsightSnippetConfig} - * @param initContext {@link AnalyticsClientInitContext} - */ - constructor( - config: GainsightSnippetConfig, - private readonly initContext: AnalyticsClientInitContext - ) { - const { ...snippetConfig } = config; - this.gainsightApi = loadSnippet(snippetConfig); - } - - /** - * Calls track or set on the fields provided in the newContext. - * @param newContext The full new context to set {@link EventContext} - */ - public extendContext(newContext: EventContext): void { - this.initContext.logger.debug(`Received context ${JSON.stringify(newContext)}`); - - // gainsight requires different APIs for different type of contexts. - const { userId, cluster_name: clusterName } = newContext; - - this.gainsightApi('set', 'globalContext', { - kibanaUserId: userId, - }); - - if (clusterName && clusterName !== this.lastClusterName) { - this.initContext.logger.debug(`Calling identify with userId ${userId}`); - // We need to call the API for every new userId (restarting the session). - this.gainsightApi('identify', { - id: clusterName, - userType: 'deployment', - }); - this.lastClusterName = clusterName; - } else { - this.initContext.logger.debug( - `Identify has already been called with ${userId} and ${clusterName}` - ); - } - } - - /** - * Stops/restarts the shipping mechanism based on the value of isOptedIn - * @param isOptedIn `true` for resume sending events. `false` to stop. - */ - public optIn(isOptedIn: boolean): void { - this.initContext.logger.debug(`Setting gainsight to optIn ${isOptedIn}`); - - if (isOptedIn) { - this.gainsightApi('config', 'enableTag', true); - } else { - this.gainsightApi('config', 'enableTag', false); - } - } - - /** - * Transforms the event into a valid format and calls `track`. - * @param events batched events {@link Event} - */ - public reportEvents(events: Event[]): void { - this.initContext.logger.debug(`Reporting ${events.length} events to gainsight`); - events.forEach((event) => { - // We only read event.properties and discard the rest because the context is already sent in the other APIs. - this.gainsightApi('track', event.event_type, event.properties); - }); - } - - /** - * Flushes all internal queues of the shipper. - * It doesn't really do anything inside because this shipper doesn't hold any internal queues. - */ - public async flush() {} - - /** - * Shuts down the shipper. - * It doesn't really do anything inside because this shipper doesn't hold any internal queues. - */ - public shutdown() { - // No need to do anything here for now. - } -} diff --git a/packages/analytics/shippers/gainsight/src/load_snippet.test.ts b/packages/analytics/shippers/gainsight/src/load_snippet.test.ts deleted file mode 100644 index b2e10eca2e4cf..0000000000000 --- a/packages/analytics/shippers/gainsight/src/load_snippet.test.ts +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0 and the Server Side Public License, v 1; you may not use this file except - * in compliance with, at your election, the Elastic License 2.0 or the Server - * Side Public License, v 1. - */ - -import { loadSnippet } from './load_snippet'; - -describe('loadSnippet', () => { - beforeAll(() => { - // Define necessary window and document global variables for the tests - Object.defineProperty(global, 'window', { - writable: true, - value: { - aptrinsic: { - init: true, - }, - }, - }); - - Object.defineProperty(global, 'document', { - writable: true, - value: { - createElement: jest.fn().mockReturnValue({}), - getElementsByTagName: jest - .fn() - .mockReturnValue([{ parentNode: { insertBefore: jest.fn() } }]), - }, - }); - - Object.defineProperty(global, 'aptrinsic', { - writable: true, - value: { - init: true, - }, - }); - }); - - it('should return the gainsight API', () => { - const gainsightApi = loadSnippet({ gainsightOrgId: 'foo' }); - expect(gainsightApi).toBeDefined(); - }); -}); diff --git a/packages/analytics/shippers/gainsight/src/load_snippet.ts b/packages/analytics/shippers/gainsight/src/load_snippet.ts deleted file mode 100644 index 0bb4e67a9a493..0000000000000 --- a/packages/analytics/shippers/gainsight/src/load_snippet.ts +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0 and the Server Side Public License, v 1; you may not use this file except - * in compliance with, at your election, the Elastic License 2.0 or the Server - * Side Public License, v 1. - */ - -import type { GainsightApi } from './types'; - -/** - * gainsight basic configuration. - */ -export interface GainsightSnippetConfig { - /** - * The gainsight account id. - */ - gainsightOrgId: string; - /** - * The URL to load the gainsight client from. Falls back to `web-sdk.aptrinsic.com` if not specified. - */ - scriptUrl?: string; - cssFileEndpoint?: string; - widgetFileEndpoint?: string; -} -export function loadSnippet({ - gainsightOrgId, - scriptUrl = 'web-sdk.aptrinsic.com/api/aptrinsic.js', - cssFileEndpoint = 'web-sdk.aptrinsic.com/style.css', - widgetFileEndpoint = 'web-sdk.aptrinsic.com/widget/aptrinsic-widget.js ', -}: GainsightSnippetConfig): GainsightApi { - /* eslint-disable no-var,dot-notation,prefer-rest-params,@typescript-eslint/no-unused-expressions */ - (function (n, t, a, e, co) { - var i = 'aptrinsic'; - // @ts-expect-error - (n[i] = - // @ts-expect-error - n[i] || - function () { - // @ts-expect-error - (n[i].q = n[i].q || []).push(arguments); - }), - // @ts-expect-error - (n[i].p = e); - // @ts-expect-error - n[i].c = co; - var r = t.createElement('script'); - (r.async = !1), (r.src = a + '?a=' + e); - var c = t.getElementsByTagName('script')[0]; - // @ts-expect-error - c.parentNode.insertBefore(r, c); - })(window, document, scriptUrl, gainsightOrgId, { - cssFileEndpoint, - widgetFileEndpoint, - }); - - const gainsightApi = window['aptrinsic']; - - if (!gainsightApi || !gainsightApi.init) { - throw new Error('Gainsight snippet failed to load. Check browser logs for more information.'); - } - - return gainsightApi; -} diff --git a/packages/analytics/shippers/gainsight/src/types.ts b/packages/analytics/shippers/gainsight/src/types.ts deleted file mode 100644 index 561e5d3302e18..0000000000000 --- a/packages/analytics/shippers/gainsight/src/types.ts +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0 and the Server Side Public License, v 1; you may not use this file except - * in compliance with, at your election, the Elastic License 2.0 or the Server - * Side Public License, v 1. - */ - -/** - * Definition of the gainsight API. - */ -export interface GainsightApi { - init?: boolean; - (functionId: keyof Mapping, ...options: any): void; -} - -interface Mapping { - identify: (id: string, userVars?: Record) => void; - track: (event: string, data?: any) => void; - set: (event: string, data?: any) => void; - reset: () => void; - config: (options: any) => void; -} - -declare global { - interface Window { - aptrinsic: GainsightApi; - } -} diff --git a/packages/analytics/shippers/gainsight/tsconfig.json b/packages/analytics/shippers/gainsight/tsconfig.json deleted file mode 100644 index f3b62b9be125f..0000000000000 --- a/packages/analytics/shippers/gainsight/tsconfig.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "extends": "../../../../tsconfig.base.json", - "compilerOptions": { - "outDir": "target/types", - "types": [ - "jest", - "node" - ] - }, - "include": [ - "**/*.ts" - ], - "kbn_references": [ - "@kbn/analytics-client", - "@kbn/logging-mocks" - ], - "exclude": [ - "target/**/*", - ] -} diff --git a/packages/kbn-optimizer/limits.yml b/packages/kbn-optimizer/limits.yml index dae455d8bb8ac..7dae6af0bb0a7 100644 --- a/packages/kbn-optimizer/limits.yml +++ b/packages/kbn-optimizer/limits.yml @@ -18,7 +18,6 @@ pageLoadAssetSize: cloudDefend: 18697 cloudExperiments: 59358 cloudFullStory: 18493 - cloudGainsight: 18710 cloudLinks: 55984 cloudSecurityPosture: 19109 console: 46091 diff --git a/test/plugin_functional/config.ts b/test/plugin_functional/config.ts index fa3e6d072a230..7b967b8591bf4 100644 --- a/test/plugin_functional/config.ts +++ b/test/plugin_functional/config.ts @@ -63,8 +63,6 @@ export default async function ({ readConfigFile }: FtrConfigProviderContext) { '--xpack.cloud_integrations.experiments.launch_darkly.client_id=a_string', '--xpack.cloud_integrations.full_story.enabled=true', '--xpack.cloud_integrations.full_story.org_id=a_string', - '--xpack.cloud_integrations.gain_sight.enabled=true', - '--xpack.cloud_integrations.gain_sight.org_id=a_string', ...findTestPluginPaths(path.resolve(__dirname, 'plugins')), ], }, diff --git a/test/plugin_functional/test_suites/core_plugins/rendering.ts b/test/plugin_functional/test_suites/core_plugins/rendering.ts index 8b248c5bccc68..bbe39f4ea50fb 100644 --- a/test/plugin_functional/test_suites/core_plugins/rendering.ts +++ b/test/plugin_functional/test_suites/core_plugins/rendering.ts @@ -239,7 +239,6 @@ export default function ({ getService }: PluginFunctionalProviderContext) { // No PII. Just the list of event types we want to forward to FullStory. 'xpack.cloud_integrations.full_story.eventTypesAllowlist (array)', 'xpack.cloud_integrations.full_story.pageVarsDebounceTime (duration)', - 'xpack.cloud_integrations.gain_sight.org_id (any)', 'xpack.cloud.id (string)', 'xpack.cloud.organization_url (string)', 'xpack.cloud.billing_url (string)', diff --git a/tsconfig.base.json b/tsconfig.base.json index b8c20aa8d2da3..406b2f3dda838 100644 --- a/tsconfig.base.json +++ b/tsconfig.base.json @@ -72,8 +72,6 @@ "@kbn/analytics-shippers-elastic-v3-server/*": ["packages/analytics/shippers/elastic_v3/server/*"], "@kbn/analytics-shippers-fullstory": ["packages/analytics/shippers/fullstory"], "@kbn/analytics-shippers-fullstory/*": ["packages/analytics/shippers/fullstory/*"], - "@kbn/analytics-shippers-gainsight": ["packages/analytics/shippers/gainsight"], - "@kbn/analytics-shippers-gainsight/*": ["packages/analytics/shippers/gainsight/*"], "@kbn/apm-config-loader": ["packages/kbn-apm-config-loader"], "@kbn/apm-config-loader/*": ["packages/kbn-apm-config-loader/*"], "@kbn/apm-data-access-plugin": ["x-pack/plugins/apm_data_access"], @@ -156,8 +154,6 @@ "@kbn/cloud-experiments-plugin/*": ["x-pack/plugins/cloud_integrations/cloud_experiments/*"], "@kbn/cloud-full-story-plugin": ["x-pack/plugins/cloud_integrations/cloud_full_story"], "@kbn/cloud-full-story-plugin/*": ["x-pack/plugins/cloud_integrations/cloud_full_story/*"], - "@kbn/cloud-gainsight-plugin": ["x-pack/plugins/cloud_integrations/cloud_gain_sight"], - "@kbn/cloud-gainsight-plugin/*": ["x-pack/plugins/cloud_integrations/cloud_gain_sight/*"], "@kbn/cloud-integration-saml-provider-plugin": ["x-pack/test/cloud_integration/plugins/saml_provider"], "@kbn/cloud-integration-saml-provider-plugin/*": ["x-pack/test/cloud_integration/plugins/saml_provider/*"], "@kbn/cloud-links-plugin": ["x-pack/plugins/cloud_integrations/cloud_links"], diff --git a/x-pack/plugins/cloud_integrations/cloud_full_story/server/config.ts b/x-pack/plugins/cloud_integrations/cloud_full_story/server/config.ts index 8c6eb180f1db6..09d7e08826c0f 100644 --- a/x-pack/plugins/cloud_integrations/cloud_full_story/server/config.ts +++ b/x-pack/plugins/cloud_integrations/cloud_full_story/server/config.ts @@ -64,6 +64,8 @@ export const config: PluginConfigDescriptor = { { path: 'xpack.cloud.full_story.enabled' }, { path: 'xpack.cloud.full_story.org_id' }, { path: 'xpack.cloud.full_story.eventTypesAllowlist' }, + { path: 'xpack.cloud_integrations.gain_sight.org_id' }, + { path: 'xpack.cloud_integrations.gain_sight.enabled' }, ], }; }, diff --git a/x-pack/plugins/cloud_integrations/cloud_gain_sight/README.md b/x-pack/plugins/cloud_integrations/cloud_gain_sight/README.md deleted file mode 100755 index e8789a3dd7a5f..0000000000000 --- a/x-pack/plugins/cloud_integrations/cloud_gain_sight/README.md +++ /dev/null @@ -1,3 +0,0 @@ -# Cloud Gainsight - -Integrates with Gainsight in order to provide better product analytics, so we can understand how our users make use of Kibana. This plugin should only run on Elastic Cloud. diff --git a/x-pack/plugins/cloud_integrations/cloud_gain_sight/jest.config.js b/x-pack/plugins/cloud_integrations/cloud_gain_sight/jest.config.js deleted file mode 100644 index ce0c3dfd8b520..0000000000000 --- a/x-pack/plugins/cloud_integrations/cloud_gain_sight/jest.config.js +++ /dev/null @@ -1,18 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -module.exports = { - preset: '@kbn/test', - rootDir: '../../../../', - roots: ['/x-pack/plugins/cloud_integrations/cloud_gain_sight'], - coverageDirectory: - '/target/kibana-coverage/jest/x-pack/plugins/cloud_integrations/cloud_gain_sight', - coverageReporters: ['text', 'html'], - collectCoverageFrom: [ - '/x-pack/plugins/cloud_integrations/cloud_gain_sight/{common,public,server}/**/*.{ts,tsx}', - ], -}; diff --git a/x-pack/plugins/cloud_integrations/cloud_gain_sight/kibana.jsonc b/x-pack/plugins/cloud_integrations/cloud_gain_sight/kibana.jsonc deleted file mode 100644 index a33915fd2b264..0000000000000 --- a/x-pack/plugins/cloud_integrations/cloud_gain_sight/kibana.jsonc +++ /dev/null @@ -1,19 +0,0 @@ -{ - "type": "plugin", - "id": "@kbn/cloud-gainsight-plugin", - "owner": "@elastic/kibana-core", - "description": "When Kibana runs on Elastic Cloud, this plugin registers Gainsight as a shipper for telemetry.", - "plugin": { - "id": "cloudGainsight", - "server": true, - "browser": true, - "configPath": [ - "xpack", - "cloud_integrations", - "gain_sight" - ], - "requiredPlugins": [ - "cloud" - ] - } -} diff --git a/x-pack/plugins/cloud_integrations/cloud_gain_sight/public/index.ts b/x-pack/plugins/cloud_integrations/cloud_gain_sight/public/index.ts deleted file mode 100755 index 5d6e7c00552fb..0000000000000 --- a/x-pack/plugins/cloud_integrations/cloud_gain_sight/public/index.ts +++ /dev/null @@ -1,13 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -import type { PluginInitializerContext } from '@kbn/core/public'; -import { CloudGainsightPlugin } from './plugin'; - -export function plugin(initializerContext: PluginInitializerContext) { - return new CloudGainsightPlugin(initializerContext); -} diff --git a/x-pack/plugins/cloud_integrations/cloud_gain_sight/public/plugin.test.ts b/x-pack/plugins/cloud_integrations/cloud_gain_sight/public/plugin.test.ts deleted file mode 100644 index c9a10c2391b7e..0000000000000 --- a/x-pack/plugins/cloud_integrations/cloud_gain_sight/public/plugin.test.ts +++ /dev/null @@ -1,71 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -import { coreMock } from '@kbn/core/public/mocks'; -import type { CloudGainsightConfigType } from '../server/config'; -import { CloudGainsightPlugin } from './plugin'; -import { cloudMock } from '@kbn/cloud-plugin/public/mocks'; - -describe('Cloud Plugin', () => { - describe('#setup', () => { - describe('setupGainsight', () => { - beforeEach(() => { - jest.clearAllMocks(); - }); - - const setupPlugin = async ({ - config = {}, - isCloudEnabled = true, - }: { - config?: Partial; - isCloudEnabled?: boolean; - }) => { - const initContext = coreMock.createPluginInitializerContext(config); - - const plugin = new CloudGainsightPlugin(initContext); - - const coreSetup = coreMock.createSetup(); - - const cloud = { ...cloudMock.createSetup(), isCloudEnabled }; - - plugin.setup(coreSetup, { cloud }); - - // Wait for Gainsight dynamic import to resolve - await new Promise((r) => setImmediate(r)); - - return { initContext, plugin, coreSetup }; - }; - - test('register the shipper Gainsight with correct args when enabled and org_id are set', async () => { - const { coreSetup } = await setupPlugin({ - config: { org_id: 'foo' }, - }); - - expect(coreSetup.analytics.registerShipper).toHaveBeenCalled(); - expect(coreSetup.analytics.registerShipper).toHaveBeenCalledWith(expect.anything(), { - gainsightOrgId: 'foo', - scriptUrl: '/internal/cloud/100/gainsight.js', - cssFileEndpoint: '/internal/cloud/100/gainsight.css', - widgetFileEndpoint: '/internal/cloud/100/gainsight_widget.js', - }); - }); - - it('does not call initializeGainsight when isCloudEnabled=false', async () => { - const { coreSetup } = await setupPlugin({ - config: { org_id: 'foo' }, - isCloudEnabled: false, - }); - expect(coreSetup.analytics.registerShipper).not.toHaveBeenCalled(); - }); - - it('does not call initializeGainsight when org_id is undefined', async () => { - const { coreSetup } = await setupPlugin({ config: {} }); - expect(coreSetup.analytics.registerShipper).not.toHaveBeenCalled(); - }); - }); - }); -}); diff --git a/x-pack/plugins/cloud_integrations/cloud_gain_sight/public/plugin.ts b/x-pack/plugins/cloud_integrations/cloud_gain_sight/public/plugin.ts deleted file mode 100755 index 0f3ab5107d089..0000000000000 --- a/x-pack/plugins/cloud_integrations/cloud_gain_sight/public/plugin.ts +++ /dev/null @@ -1,78 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -import type { - AnalyticsServiceSetup, - IBasePath, - PluginInitializerContext, - CoreSetup, - Plugin, -} from '@kbn/core/public'; -import type { CloudSetup } from '@kbn/cloud-plugin/public'; - -interface SetupGainsightDeps { - analytics: AnalyticsServiceSetup; - basePath: IBasePath; -} - -interface CloudGainsightConfig { - org_id?: string; -} - -interface CloudGainsightSetupDeps { - cloud: CloudSetup; -} - -export class CloudGainsightPlugin implements Plugin { - private readonly config: CloudGainsightConfig; - - constructor(private readonly initializerContext: PluginInitializerContext) { - this.config = this.initializerContext.config.get(); - } - - public setup(core: CoreSetup, { cloud }: CloudGainsightSetupDeps) { - if (cloud.isCloudEnabled) { - this.setupGainsight({ analytics: core.analytics, basePath: core.http.basePath }).catch((e) => - // eslint-disable-next-line no-console - console.debug(`Error setting up Gainsight: ${e.toString()}`) - ); - } - } - - public start() {} - - public stop() {} - - /** - * If the right config is provided, register the Gainsight shipper to the analytics client. - * @param analytics Core's Analytics service's setup contract. - * @param basePath Core's http.basePath helper. - * @private - */ - private async setupGainsight({ analytics, basePath }: SetupGainsightDeps) { - const { org_id: gainsightOrgId } = this.config; - if (!gainsightOrgId) { - return; // do not load any Gainsight code in the browser if not enabled - } - - // Keep this import async so that we do not load any Gainsight code into the browser when it is disabled. - const { GainsightShipper } = await import('@kbn/analytics-shippers-gainsight'); - analytics.registerShipper(GainsightShipper, { - gainsightOrgId, - // Load an Elastic-internally audited script. Ideally, it should be hosted on a CDN. - scriptUrl: basePath.prepend( - `/internal/cloud/${this.initializerContext.env.packageInfo.buildNum}/gainsight.js` - ), - cssFileEndpoint: basePath.prepend( - `/internal/cloud/${this.initializerContext.env.packageInfo.buildNum}/gainsight.css` - ), - widgetFileEndpoint: basePath.prepend( - `/internal/cloud/${this.initializerContext.env.packageInfo.buildNum}/gainsight_widget.js` - ), - }); - } -} diff --git a/x-pack/plugins/cloud_integrations/cloud_gain_sight/server/assets/gainsight_library.js b/x-pack/plugins/cloud_integrations/cloud_gain_sight/server/assets/gainsight_library.js deleted file mode 100644 index d43637fb41c07..0000000000000 --- a/x-pack/plugins/cloud_integrations/cloud_gain_sight/server/assets/gainsight_library.js +++ /dev/null @@ -1,53 +0,0 @@ -/* @notice - * Portions of this code are licensed under the following license: - * Gainsight PX Agent Wrapper Agent Version: 0.46.0 Installed: 2022-08-25 08:07 - * https://www.gainsight.com/policy/gainsight-px-license-agreement/ - */ -/* eslint-disable prettier/prettier,no-var,eqeqeq,new-cap,no-nested-ternary,no-use-before-define,no-sequences,block-scoped-var,one-var, - dot-notation,no-script-url,no-restricted-globals,no-unused-vars,guard-for-in,no-proto,camelcase,no-empty,no-redeclare,no-caller, - strict,no-extend-native,no-undef,no-loop-func */ -!function(t){function e(r){if(n[r])return n[r].exports;var i=n[r]={i:r,l:!1,exports:{}};return t[r].call(i.exports,i,i.exports,e),i.l=!0,i.exports}var n={};e.m=t,e.c=n,e.i=function(t){return t},e.d=function(t,n,r){e.o(t,n)||Object.defineProperty(t,n,{configurable:!1,enumerable:!0,get:r})},e.n=function(t){var n=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(n,"a",n),n},e.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},e.p="",e(e.s=592)}([function(t,e,n){"use strict";function r(t){return void 0!==t&&null!==t&&"string"==typeof t}function i(t){return void 0===t||null===t||"string"!=typeof t}function o(t){return!t||"string"!=typeof t||""==t.trim()}function a(t){return o(t)?t:t.trim()}function s(t){return t&&Array.isArray(t)&&t.length>0}function u(t){if(t){var e=t;return Array.isArray(e)||(e=(0,At.arrayFrom)(t)),Array.isArray(e)&&0==e.length}return!0}function l(t,e,n){var r=t[e];if(n&&{}.hasOwnProperty.call(t,"Zone")){r=t[t.Zone.__symbol__(e)]||t[e]}return r}function c(t,e,n){var r=!(arguments.length>3&&void 0!==arguments[3])||arguments[3],i=l(t,"addEventListener",(0,Ot.getConfig)("angularAddEventListener"));if(i)i.call(t,e,n,r);else{if(!t.attachEvent)return!1;t.attachEvent("on"+e,n)}return!0}function d(t,e,n){var r=!(arguments.length>3&&void 0!==arguments[3])||arguments[3],i=l(t,"removeEventListener",(0,Ot.getConfig)("angularAddEventListener"));i?i.call(t,e,n,r):t.detachEvent&&t.detachEvent("on"+e,n)}function h(t){var e=document.createElement("div");return e.innerHTML=t.trim(),e.firstChild}function f(t,e,n){var r=document.getElementById(e);r?r.styleSheet?r.styleSheet.cssText=t:(r.innerHTML="",r.appendChild(document.createTextNode(t))):r=Gt(t,e),n?n.parentNode.insertBefore(r,n):(0,Ot.getBody)().appendChild(r)}function p(t){return t.join("&")}function m(t,e,n){return n||(n=[]),n.push(t+(""!==e?"="+encodeURIComponent(e):"")),n}function g(t){var e=(new Date).getTime()+"-"+Ct.UUIDGenerator.generateRandom(4);return Object.assign(t,{cb:e}),t}function v(t,e){for(var n in t)t.hasOwnProperty(n)&&(e=m(n,t[n],e));return e}function b(t,e){return e&&y(e)||(e={}),t.forEach(function(t){var n=t.split("=");n.length<2||(e[n[0]]=n.slice(1).join(""))}),e}function y(t){return void 0!==t&&null!=t&&"[object Object]"==Object.prototype.toString.call(t)}function w(t){for(;t.firstChild;)t.removeChild(t.firstChild)}function E(t,e,n,r,i){e.parentNode;if(e.getAttribute("apt-ignore")!==r){var o=parseInt(e.getAttribute("apt-original")||n.getPropertyValue("top"),10);o!==r&&!i&&(e.style.top=o+r+"px")&&e.setAttribute("apt-original",o),e.setAttribute("apt-ignore",r)}}function M(t,e){for(var n=Pt.body.getElementsByTagName("*"),r=n.length,i=void 0,o=[],a=(0,Ot.getConfig)("mapperResizeFullHeightElements"),s=(0,Ot.getConfig)("mapperResizeFullHeightBody"),u=0;u-1||n[u].className.indexOf("tippy-popper")>-1))continue;E(o,n[u],i,t,e)}if(i&&"absolute"===i.getPropertyValue("position")){if(B(n[u].className)&&(n[u].className.indexOf("apt")>-1||n[u].className.indexOf("tippy-popper")>-1))continue;for(var l=n[u].parentNode,c=!1,d=void 0;l&&"body"!==l.tagName.toLowerCase();){d=xt.windowRef.getComputedStyle(l,null);var h=d.getPropertyValue("position");if("relative"===h||"fixed"===h||o.indexOf(l)>-1){c=!0;break}l=l.parentNode,!1}if(!c&&n[u].getAttribute("apt-ignore")!==t){o.push(n[u]),n[u].style.marginTop=t+"px";var f=i.getPropertyValue("top");!e&&(n[u].style.top=f),n[u].setAttribute("apt-ignore",t)}}}i=window.getComputedStyle(Pt.body,null),s&&i&&parseInt(i.getPropertyValue("height"))===Pt.body.clientHeight&&Pt.body.style.setProperty("box-sizing","border-box","important"),Pt.body.style.setProperty("padding-top",t+"px","important")}function _(t,e){if(!("style"in t))throw new Error("object "+t+" has no 'style' property");t.style.webkitTransform=e,t.style.MozTransform=e,t.style.msTransform=e,t.style.OTransform=e,t.style.transform=e}function S(t,e){var n=t.replace("#","");return"rgba("+parseInt(n.substring(0,2),16)+","+parseInt(n.substring(2,4),16)+","+parseInt(n.substring(4,6),16)+","+e+")"}function I(t){var e=t.replace("#","");return(parseInt(e.substring(0,2),16)+parseInt(e.substring(2,4),16)+parseInt(e.substring(4,6),16))/3<128}function k(t){for(var e=document.querySelectorAll(t),n=0,r=0;rn&&(n=i)}return n}function T(t,e){var n=!0;if(e){var r={x:t.left+t.width/2,y:t.top+t.height/2},i=document.elementFromPoint(r.x,r.y),o="true"===i.getAttribute("data-apt-ignore-visible"),a=i.getAttribute("class")||"",s=i!==(0,Ot.getBody)()&&a.indexOf("apt")>-1;n=i===e||o||s}return n}function C(t,e,n){if(!t)return!1;var r=window.getComputedStyle(t);if("none"===r.display)return!1;if("visible"!==r.visibility)return!1;if(r.opacity<.1)return!1;if(t.offsetWidth+t.offsetHeight+t.getBoundingClientRect().height+t.getBoundingClientRect().width===0)return!1;if(e){var i=t.getBoundingClientRect(),o={x:i.left+t.offsetWidth/2,y:i.top+t.offsetHeight/2};if(o.x<0)return!1;if(o.x>(document.documentElement.clientWidth||window.innerWidth))return!1;if(o.y<0)return!1;if(o.y>(document.documentElement.clientHeight||window.innerHeight))return!1;if((0,Lt.elementContainsChild)(t,(0,Lt.documentElementFromPoint)(document,o.x,o.y))||(0,Lt.elementContainsChild)(t,(0,Lt.documentElementFromPoint)(document,i.left,i.top))||(0,Lt.elementContainsChild)(t,(0,Lt.documentElementFromPoint)(document,i.right,i.top))||(0,Lt.elementContainsChild)(t,(0,Lt.documentElementFromPoint)(document,i.right,i.bottom))||(0,Lt.elementContainsChild)(t,(0,Lt.documentElementFromPoint)(document,i.left,i.bottom)))return!0;var a=document.elementFromPoint(o.x,o.y);do{var s=!1;if(a){var u="true"===a.getAttribute("data-apt-ignore-visible"),l=a===t,c=a.getAttribute("class")||"",d=n&&a!==(0,Ot.getBody)()&&c.indexOf("apt")>-1;s=u||l||d}if(s)return!0}while(a&&(a=a.parentNode)&&a.tagName);return!1}return!0}function x(t){var e=window.getComputedStyle(t),n=e.getPropertyValue("margin-top");n=n.substring(0,n.length-2),n=Number(n);var r=e.getPropertyValue("margin-bottom");return r=r.substring(0,r.length-2),(r=Number(r))+n}function A(t){return t.getBoundingClientRect().top+t.offsetHeight/2}function R(t){var e=x((0,Ot.getBody)()),n=(window.innerHeight-e)/2,r=A(t);return Math.abs(n-r)<10}function O(t){if(!t)return!1;var e=t.getBoundingClientRect(),n=e.left,r=e.top,i={x:n+t.offsetWidth/2,y:r+t.offsetHeight/2};return!R(t)||i.x<0||i.x>Math.min(document.documentElement.clientWidth,window.innerWidth)||i.y<0||i.y>Math.min(document.documentElement.clientHeight,window.innerHeight)}function B(t){return t&&("string"==typeof t||t instanceof String)}function L(t){return t&&("function"==typeof t||t instanceof Function)}function P(t){return["body","#document","frameset","html"].indexOf(t.nodeName.toLowerCase())>-1}function N(t){return t===document||["body","frameset","html"].indexOf(t.tagName.toLowerCase())>-1}function D(t,e){for(var n=t;n&&!P(n);){if(n.classList.contains(e))return!0;n=(0,Lt.getParentNode)(n)}return!1}function j(t,e,n){for(var r=t;r&&!P(r);){if(r[e]===n)return!0;r=(0,Lt.getParentNode)(r)}return!1}function U(t,e){for(var n=e;n&&!N(n);){if(n===t)return!0;n=(0,Lt.getParentNode)(n)}return!1}function q(t,e,n){var r=Pt.createElement("a");r.href=t;var i=pt(r),a=mt(r),s=o(r.search)?"?":"";return s+=m(e,n,r.search?r.search.split("&"):null).join("&"),[i,a,s,r.hash].join("")}function F(t,e){var n=Pt.createElement("a");n.href=t;var r=pt(n),i=mt(n),a=o(n.search)?"?":"";return a+=v(e,n.search?n.search.split("&"):[]).join("&"),[r,i,a,n.hash].join("")}function V(t){for(var e=window.location.search.substring(1),n=e.split("&"),r=0;r0?"?"+r.join("&"):"")+location.hash}function W(t){return void 0!==Vt.find(function(e){return e.test(t)})}function z(t,e){t&&(t.innerText=e.toLowerCase(),t.classList.contains("strong")&&t.classList.remove("strong"),t.classList.contains("medium")&&t.classList.remove("medium"),t.classList.contains("weak")&&t.classList.remove("weak"),t.classList.add(e.toLowerCase()))}function K(t,e){function n(t){t=t||window.event,t.target.classList.add("dragging"),s=t.clientX,u=t.clientY,c(document,"mouseup",i),c(document,"mousemove",r)}function r(e){e=e||window.event,o=s-e.clientX,a=u-e.clientY,s=e.clientX,u=e.clientY,t.style.top=t.offsetTop-a+"px",t.style.left=t.offsetLeft-o+"px"}function i(t){t.target.classList.remove("dragging"),d(document,"mouseup",i),d(document,"mousemove",r)}var o=0,a=0,s=0,u=0;e?c(e,"mousedown",n):c(t,"mousedown",n)}function G(t){if(t)for(var e in t)if(t.hasOwnProperty(e))return!1;return!0}function Y(t,e){for(var n=t;n!=Pt;){if(n&&n.tagName&&n.tagName.toLowerCase()===e)return n;n=n.parentNode}return null}function Z(){xt.windowRef.sessionStorage.removeItem("apt.prevStepMap"),xt.windowRef.sessionStorage.removeItem("apt.stepId"),xt.windowRef.sessionStorage.removeItem("aptCurrentGuideUrl"),xt.windowRef.sessionStorage.removeItem("aptGuideSelectedLanguage"),xt.windowRef.sessionStorage.removeItem("apt.engagementSessionId"),xt.windowRef.sessionStorage.removeItem("aptMapperDockingPosition")}function J(t,e,n){for(var r=0;re&&(i.scrollTop+=a)}function Q(t,e,n){try{if(t){var r=t.getBoundingClientRect(),i=window.innerHeight,o=(i-r.height)/2,a=Math.max((0,Ot.getBody)().scrollHeight,(0,Ot.getBody)().offsetHeight,document.documentElement.clientHeight,document.documentElement.scrollHeight,document.documentElement.offsetHeight),s=a-(window.scrollY+r.bottom),u=r.top1&&void 0!==arguments[1])||arguments[1];return function(n){n=n||xt.windowRef.event;var r=!1;(r="key"in n?"Escape"===n.key||"Esc"===n.key:27===n.keyCode)&&(e&&n.preventDefault(),t())}}function ct(t){return function(e){13===e.keyCode&&t()}}function dt(t,e){var n=ct(e);return c(t,"keydown",n),n}function ht(t,e){e||(e=["click","mousedown","mouseup"]),t.forEach(function(t){e.forEach(function(e){return c(t,e,function(t){t.stopImmediatePropagation()})})})}function ft(t,e){var n=this,r=Ct.UUIDGenerator.generateV4Id(),i=[];return arguments.length>2&&(i=Array.prototype.slice.call(arguments,2)),t?(i.unshift(r),[r,function(t){var r=(0,At.arrayFrom)(i);r.unshift(t),e.apply(n,r)}]):[r,function(){var t=(0,At.arrayFrom)(i);t.unshift(r),e.apply(n,t)}]}function pt(t){if(!t||!t.href)throw new Error("getOriginFromAnchorElement - Wrong element was provided, missing href");return t.origin?t.origin:t.protocol+"//"+t.hostname}function mt(t){if(!t||!t.href)throw new Error("getPathnameFromAnchorElement - Wrong element was provided, missing href");return t.origin?t.pathname:t.pathname?"/"+t.pathname:""}function gt(t){return-1===[null,void 0].indexOf(t)}function vt(t){return[null,void 0].indexOf(t)>-1}function bt(t){return t&&"INPUT"===t.nodeName&&"text"===t.type}function yt(t,e){return isNaN(t)||!t&&0!==t?e:t}function wt(t){return/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/.test(t)}function Et(t,e){var n=void 0;return function(){var r=arguments,i=this;clearTimeout(n),n=setTimeout(function(){return t.apply(i,r)},e)}}function Mt(t,e){var n=t.substring(t.indexOf(e),t.length);return n=n.substring(0,n.indexOf("}")+1)}function _t(t){var e=[];return t.substring(t.indexOf("{")+1,t.indexOf("}")).split(";").map(function(t){return t.trim()}).forEach(function(t){if(t){var n=t.split(":");n&&2===n.length&&e.push({inlineProperty:n[0],value:n[1]})}}),e}function St(t,e){var n={},r=0;for(var i in t)if({}.hasOwnProperty.call(t,i)){if(r++>=e)break;n[i]=t[i]}return n}function It(t){return null!==t&&"object"===(void 0===t?"undefined":Tt(t))&&/^\[object (HTMLCollection|NodeList|Object)\]$/.test(Object.prototype.toString.call(t))&&"number"==typeof t.length&&(0===t.length||"object"===Tt(t[0])&&t[0].nodeType>0)}function kt(t){if(Array.prototype.toJSON){var e=null,n=Array.prototype.toJSON;return delete Array.prototype.toJSON,e=JSON.stringify(t),Array.prototype.toJSON=n,e}return JSON.stringify(t)}Object.defineProperty(e,"__esModule",{value:!0}),e.isElementInIframeVisible=e.isValidPort=e.isRootTag=e.isRootNode=e.isEmail=e.getNumberWithFallback=e.trimString=e.paramToObject=e.isNotNullOrUndefined=e.isNullOrUndefined=e.isFunction=e.addEnterKeyDownListener=e.getEnterHandler=e.getUrlParts=e.addStopClickListeners=e.hasElement=e.getHandler=e.addStyle=e.getEscHandlerCallback=e.safeUrl=e.isDefinedStr=e.isUndefinedStr=e.getPageUrl=e.isWebApp=e.matchUrl=e.escapeRegex=e.matchEither=e.scrollElementToCenter=e.needToScroll=e.createInputConfig=e.isRandomIdSelector=e.retryFunction=e.createElementFromString=e.clearAptrinsicSessionStorage=e.searchElementInParentTree=e.checkDarkColor=e.hasParentField=e.isObjectEmpty=e.isEmptyArr=e.makeDraggable=e.setSelectorStrengthLabel=e.removeFromQueryParam=e.getQueryParam=e.addParametersToUrl=e.addParameterToUrl=e.hasParentClass=e.isString=e.isElementVisible=e.findHighestZIndex=e.hexToRgba=e.setCrossBrowserTransform=e.pushElements=e.createStyle=e.removeChildren=e.isObject=e.addCacheBuster=e.addParameters=e.addParameter=e.convert2Parameters=e.MILLISEC=e.removeEventListener=e.isNotEmptyArr=e.createInput=e.appendElements=e.createElement=e.addEventListener=e.isBlank=e.isEnterAllowedElement=void 0;var Tt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t};e.getNativeFunction=l,e.debounce=Et,e.extractStyleString=Mt,e.extractStyleProperties=_t,e.limitJsonKeys=St,e.isNodeList=It,e.jsonStringify=kt;var Ct=n(20),xt=n(5),At=n(15),Rt=n(11),Ot=n(2),Bt=n(10),Lt=n(24),Pt=document,Nt=new RegExp(/(^| )[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i),Dt=new RegExp(/(^| )#.+_(?=.*[0-9])(?=.*[a-zA-Z])([a-zA-Z0-9]+){8,}$/),jt=new RegExp(/(^| )#.+gen[0-9]{4}/),Ut=new RegExp(/(^| )#.+-[0-9]{4}.*$/),qt=new RegExp(/(^| )#ember[0-9]{4}$/),Ft=new RegExp(/(^| )#id[0-9a-zA-Z]{3}$/),Vt=[Nt,Dt,jt,Ut,qt,Ft],Ht=function(t,e,n,r){if("text"===t)return Pt.createTextNode(n);var i=Pt.createElement(t);switch(void 0!==e&&null!=e&&(i.className=s(e)?e.join(" "):e),t){case"option":i.value=n.value,i.text=n.name,n.selected&&i.setAttribute("selected",n.selected);break;case"a":i.href=n.href,n.blank&&(i.target="_blank");break;case"textarea":i.rows=n.rows,i.cols=n.cols;break;case"input":i.value=n.value;break;case"p":i.innerHTML=n.value;break;case"label":n&&n.for&&i.setAttribute("for",n.for);break;case"img":n&&n.src&&(i.src=n.src)}if(void 0!==n&&null!=n&&(void 0!==n.text&&i.appendChild(Pt.createTextNode(n.text)),n.title&&(i.title=n.title),n.dataAtt))for(var o=0;o-1&&("identify"!==t||!r("enableIdentifyFromIFrame"))}function c(t){return void 0!==t&&"[object Object]"==Object.prototype.toString.call(t)}function d(){k.enableTag=!1}function h(t){return("string"!=typeof t||!(0,S.isBlank)(t))&&(!Array.isArray(t)||!(0,S.isEmptyArr)(t))}function f(t,e,n,r){var o=i();if(c(t))for(var a in t)t.hasOwnProperty(a)&&k.hasOwnProperty(a)&&h(t[a])&&(-1===T.indexOf(a)||r)&&(k[a]=t[a],n&&T.push(a));k.autoTrack?k.autoClickTrack||(k.trackLevel=1):k.trackLevel=0,e&&g(o,k),u(k.espProxyDomain,k.contentProxyDomain)}function p(t){return(!o()||!l(t))&&("pageView"===t?k.trackLevel>0&&r("autoTrackPage"):Mt[t]<=k.trackLevel)}function m(t,e){if(!k.hasOwnProperty(t))return void _.logger.logInternalError(new Error("Unrecognized config field: "+t+". Cannot set config change handler"));St[t]=e}function g(t,e){for(var n in St)St.hasOwnProperty(n)&&t[n]!==e[n]&&St[n](t[n],e[n])}function v(t,e){Ct.setdata(t,e)}function b(t){return Ct.getKey(t)}function y(){return It}function w(t){if(It=t,Tt)for(var e in Tt)t.hasOwnProperty(e)||(It[e]=Tt[e])}function E(t,e){c(It)&&(It[t]=e),-1!==kt.indexOf(t)&&(Tt=Tt||{},Tt[t]=e)}function M(){return{enableTag:!0,maxEngagementCalls:2,engagementCallDelay:500,filterType:"mask",filterUrls:[],nameParamFilterType:"mask",namedParamFilter:[],autoTrackHash:!1,widgetEnabled:!1,trackLevel:3,autoClickTrack:1,autoTrack:1,autoTrackPage:!0,iframeModeEnabled:!0}}Object.defineProperty(e,"__esModule",{value:!0}),e.getCachedConfig=e.setCachedConfig=e.getAssetEndpoint=e.disableTag=e.setKcConfigByName=e.setKcConfig=e.getKcConfig=e.getDefaultConfiguration=e.registerConfigChangeHandler=e.getConfigObj=e.isIframe=e.isIframeDisabled=e.featureEnabled=e.getConfig=e.overrideConfig=e.fetchFeatureRuleEndpoint=e.desktopEngagementTrackEndpoint=e.trackKcEndpoint=e.widgetUrl=e.staticContentHost=e.getAllInAppEndpoint=e.refreshBadgeEndpoint=e.badgeTrackEndpoint=e.fetchBadgeEndpoint=e.trackStepEndpoint=e.trackMultiStepEndpoint=e.getWidgetSingleDocEndpoint=e.getWidgetDocsEndpoint=e.getWidgetContentEndpoint=e.getWidgetConfigUrl=e.getKnowledceCenterConfigEndpoint=e.getConfigEndpoint=e.ongoingEngagementEndpoint=e.ondemandEndpoint=e.internalErrorEndpoint=e.logErrorEndpoint=e.accountEndpoint=e.engagementTrackEndpoint=e.notificationStateEndpoint=e.notificationEndpoint=e.campaignEndpoint=e.commandEndPointV2=e.commandEndpoint=e.serverEndpoint=e.serverEndpointBase=e.trackWidgetExternalArticleInfix=void 0,e.getBody=a;var _=n(4),S=n(0),I=n(7),k={enableTag:!0,maxEngagementCalls:1,engagementCallDelay:750,filterType:"mask",filterUrls:[],nameParamFilterType:"mask",namedParamFilter:[],autoTrackHash:!1,widgetEnabled:!1,trackLevel:3,autoClickTrack:!0,autoTrack:!0,autoTrackPage:!0,iframeModeEnabled:!0,elementAttributeWhitelist:[],engagementExcludeUrl:[],delayClickEvent:!1,delayClickEventTime:2e3,textMatchEnabled:!1,guideAdvanceOnHover:!1,espProxyDomain:void 0,contentProxyDomain:void 0,enableBadge:!0,badgeRefreshInterval:5,setSessionExternally:!1,usePOST:!1,allowCrossDomain:!1,enableFullStory:!1,fullDomainCookie:!1,cssFileEndpoint:void 0,widgetFileEndpoint:void 0,multipleProductsPerDomain:!0,fetchKcType:"automatic",kcDisplayType:"default",kcPositionType:"injection",sfdcTemplate:void 0,overrideBotSearchContextUrl:void 0,htmlSanitization:!1,htmlSanitizationAllowedDomains:void 0,mapperResizeFullHeightElements:!1,sessionCookieTTL:18e5,enableIdentifyFromIFrame:!1,engagementChecksumFileUrl:void 0,cssNonce:void 0,enableKcSecureArticle:!1,useSessionStorageEditorToken:!1,secureCookie:!1,mapperResizeFullHeightBody:!1,stripSafeUrlProtocol:!0,elementAttributeDenyMap:{},maskUrlFunction:void 0,trustedOrigin:void 0,angularMutationObserver:!1,badgeUseInterval:!1,badgeRepositionInterval:500,enableModalBodyScroll:!0,evaluateEngRuleOnNavigation:!1,usesShadowDom:!1,dockMapper:!1,kcAllowedFuncNames:[],usePointerEvent:!0,badgesUseFixedPosition:!1,crossOriginStyle:!1,viewAlignedScroll:!1,newProductMapper:!0,framesetMode:!1,angularAddEventListener:!1,queryParamsInHash:!1,clientSideEngagementTracking:!1,engagementEditorV2AutoSave:!1},T=[],C="/rte",x="/v1",A="/command",R="/engagements/single",O="/inapp",B="/notification/list",L="/notification/state",P="/engagement/track",N="/account",D="/error/log",j="/activity/error",U="/engagement/ondemand",q="/engagement/ongoing",F="/configuration",V="/v2/kc",H="/kc/config",W=V+"/content",z=V+"/docs",K=V+"/doc",G="/v1/desktop/engagement",Y="/api/v1/feature/client",Z=(e.trackWidgetExternalArticleInfix="track/article/external",e.serverEndpointBase='https://esp.aptrinsic.com'+C),J=e.serverEndpoint=Z+x,X=e.commandEndpoint=J+A,Q=e.commandEndPointV2=Z+"/v2/command",$=e.campaignEndpoint=J+R,tt=e.notificationEndpoint=J+B,et=e.notificationStateEndpoint=J+L,nt=e.engagementTrackEndpoint=J+P,rt=e.accountEndpoint=J+N,it=e.logErrorEndpoint=J+D,ot=e.internalErrorEndpoint=J+j,at=e.ondemandEndpoint=J+U,st=e.ongoingEngagementEndpoint=J+q,ut=e.getConfigEndpoint=J+F,lt=e.getKnowledceCenterConfigEndpoint=Z+V,ct=e.getWidgetConfigUrl=J+H,dt=e.getWidgetContentEndpoint=Z+W,ht=e.getWidgetDocsEndpoint=Z+z,ft=e.getWidgetSingleDocEndpoint=Z+K,pt=e.trackMultiStepEndpoint=J+"/engagement/multistep/track",mt=e.trackStepEndpoint=J+"/engagement/multistep/step/track",gt=(e.fetchBadgeEndpoint=J+"/badges",e.badgeTrackEndpoint=J+"/badge/track",e.refreshBadgeEndpoint=J+"/badges/full/sync",e.getAllInAppEndpoint=J+O),vt=e.staticContentHost='https://web-sdk.aptrinsic.com',bt=e.widgetUrl='https://web-sdk.aptrinsic.com'+"/widget/aptrinsic-widget.js",yt=e.trackKcEndpoint=J+"/kc",wt=e.desktopEngagementTrackEndpoint=""+Z+G,Et=e.fetchFeatureRuleEndpoint=""+Z+Y,Mt={click:2,pageView:1,form:1,identify:0,engagementPull:0},_t=["pageView","identify","sessionInitialized","engagementPull"],St={},It=void 0,kt=["labels"],Tt=void 0,Ct=new I.LocalCache;e.overrideConfig=f,e.getConfig=r,e.featureEnabled=p,e.isIframeDisabled=l,e.isIframe=o,e.getConfigObj=i,e.registerConfigChangeHandler=m,e.getDefaultConfiguration=M,e.getKcConfig=y,e.setKcConfig=w,e.setKcConfigByName=E,e.disableTag=d,e.getAssetEndpoint=s,e.setCachedConfig=v,e.getCachedConfig=b},function(t,e,n){"use strict";"function"==typeof Object.create?t.exports=function(t,e){e&&(t.super_=e,t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}))}:t.exports=function(t,e){if(e){t.super_=e;var n=function(){};n.prototype=e.prototype,t.prototype=new n,t.prototype.constructor=t}}},function(t,e,n){"use strict";function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(e,"__esModule",{value:!0}),e.logger=void 0;var i=function(){function t(t,e){for(var n=0;n0;)h(t,{error:"PX_INCREMENT_STATE_TIMEOUT_"+n.counter})},e))}function p(t){_[t]=Date.now()}function m(){Object.entries(_).map(function(t){if(t[1]|[ ]+[^>]*>)/g;t=t.replace(n,'
∑aåāБδ ⷺ
∑aåāБδ ⷺ
'}function g(t){at=t}function v(){return at}function b(t){null===st&&(st=t)}function y(){return st}function w(t){return-1!==["ZSBMJTAYEANS","ALAZMN715YZH","PDCNS0SWT1ZP","RR8EQLTW2VP9","TGAN0LMXA1BX","XIKPBREHZXOJ","GLSDIDVBIAVK","AKKBV8ECO1E8","FAP8QPGYKUVA","GZKRSU61EUCU","OJY7IO6BCAAN","RMACDJOEHAEG","X4TBJOVYHWVS","ZJQOCZEF9PIR","DQ1NRPVT7VG1","9APX3RS6VUQK","ZSSKB3VPJSDK","EOLIULDC9NMZ","AS1CEZNAOYLR"].indexOf(t)}Object.defineProperty(e,"__esModule",{value:!0}),e.KnowledgeCenterManager=e.KcSessionStorage=void 0;var E=function(){function t(t,e){var n=[],r=!0,i=!1,o=void 0;try{for(var a,s=t[Symbol.iterator]();!(r=(a=s.next()).done)&&(n.push(a.value),!e||n.length!==e);r=!0);}catch(t){i=!0,o=t}finally{try{!r&&s.return&&s.return()}finally{if(i)throw o}}return n}return function(e,n){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return t(e,n);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}();e.getKcDataFromSessionStorage=i,e.loadOnDemandEngagement=o,e.getKcEngagement=a,e.fetchKnowledgeCenterConfig=l,e.setKcIsShownViaAPI=g,e.getKcIsShownViaAPI=v,e.setIsNewAPI=b,e.getIsNewAPI=y,e.productNeedsExtraLogging=w;var M=n(36),_=n(5),S=n(2),I=n(4),k=n(12),T=n(14),C=n(35),x=n(107),A=n(0),R=n(72),O=n(50),B=n(326),L=n(18),P=r(L),N=n(74),D=n(58),j=n(181),U=n(7),q=n(110),F=n(30),V=n(26),H=n(111),W=n(322),z=n(100),K=r(z),G=n(29),Y=n(17),Z=n(8),J=n(101),X=r(J),Q=n(99),$=r(Q),tt=n(10),et=n(323),nt=n(25),rt="apt_track_external_article",it="apt_log",ot=["apt_get_engagement","APT_WIDGET_LOADED","apt_get_user_data","apt_send_feedback","apt_search_articles","apt_get_article","apt_track_internal_article","apt_tracking_toggle_widget","apt_kc_func_click","apt_kc_link_click",rt,it],at=!1,st=null,ut=e.KcSessionStorage={setKcId:function(t){_.windowRef.sessionStorage.setItem("apt.kcId",t)},setIsDefaultKc:function(t){_.windowRef.sessionStorage.setItem("apt.isDefaultKc",t)},getIsDefaultKc:function(t){return _.windowRef.sessionStorage.getItem("apt.isDefaultKc")},getKcId:function(){return _.windowRef.sessionStorage.getItem("apt.kcId")}},lt=e.KnowledgeCenterManager=new function(){function t(t){return function(){v(t.apply(this,arguments))}}function e(t,e){if(!document.querySelector(".apt-widget-frame")){I.logger.log("SDK Creating KC iframe"),ct=!1,ht=M.UserData.getUserId();var n=document.createElement("iframe");n.className="apt-widget-frame",n.style.opacity="0",n.style.transform="scale(0)",n.style.visibility="hidden",n.style.position="absolute",n.style.top="-9999px",n.style.left="-9999px",(0,S.getBody)().appendChild(n);var r=JSON.stringify(Object.assign(e,{enableKcSecureArticle:(0,S.getConfig)("enableKcSecureArticle"),contentProxyDomain:(0,S.getConfig)("contentProxyDomain")}));n.setAttribute("data-sdkconfig",r);var i=e.initialConfig.windowSettings.textFont,o=e.initialConfig.onBoardingSettings.textFont,a=p(i),s=p(o),u=a?f(i):"",l=s?f(o):"",c=a?m(i,1):"",d=s?m(o,2):"",h=""+(u+l)+'