/*! 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. */ (window.cloudGainsight_bundle_jsonpfunction=window.cloudGainsight_bundle_jsonpfunction||[]).push([[1],{5:function(i,t,n){"use strict";n.r(t),n.d(t,"GainsightShipper",(function(){return gainsight_shipper_GainsightShipper}));var e=n(0),s=n.n(e);class gainsight_shipper_GainsightShipper{constructor(i,t){s()(this,"lastClusterName",void 0),s()(this,"gainsightApi",void 0),this.initContext=t;const{...n}=i;this.gainsightApi=function({gainsightOrgId:i,scriptUrl:t="web-sdk.aptrinsic.com/api/aptrinsic.js",cssFileEndpoint:n="web-sdk.aptrinsic.com/style.css",widgetFileEndpoint:e="web-sdk.aptrinsic.com/widget/aptrinsic-widget.js "}){!function(i,t,n,e,s){var o="aptrinsic";i[o]=i[o]||function(){(i[o].q=i[o].q||[]).push(arguments)},i[o].p=e,i[o].c=s;var r=t.createElement("script");r.async=!1,r.src=n+"?a="+e;var a=t.getElementsByTagName("script")[0];a.parentNode.insertBefore(r,a)}(window,document,t,i,{cssFileEndpoint:n,widgetFileEndpoint:e});const s=window.aptrinsic;if(!s||!s.init)throw new Error("Gainsight snippet failed to load. Check browser logs for more information.");return s}(n)}extendContext(i){this.initContext.logger.debug(`Received context ${JSON.stringify(i)}`);const{userId:t,cluster_name:n}=i;this.gainsightApi("set","globalContext",{kibanaUserId:t}),n&&n!==this.lastClusterName?(this.initContext.logger.debug(`Calling identify with userId ${t}`),this.gainsightApi("identify",{id:n,userType:"deployment"}),this.lastClusterName=n):this.initContext.logger.debug(`Identify has already been called with ${t} and ${n}`)}optIn(i){this.initContext.logger.debug(`Setting gainsight to optIn ${i}`),i?this.gainsightApi("config","enableTag",!0):this.gainsightApi("config","enableTag",!1)}reportEvents(i){this.initContext.logger.debug(`Reporting ${i.length} events to gainsight`),i.forEach((i=>{this.gainsightApi("track",i.event_type,i.properties)}))}async flush(){}shutdown(){}}s()(gainsight_shipper_GainsightShipper,"shipperName","Gainsight")}}]);