import { ICurrentTenant, ICustomProperties, IIdentified, IUser } from '@c8y/client';
import { TranslateService } from '@ngx-translate/core';
import { BehaviorSubject, Subject } from 'rxjs';
import { CookieBannerService } from '../bootstrap/cookie-banner/cookie-banner.service';
import { OptionsService } from '../common/options.service';
import { AppStateService } from '../common/ui-state.service';
import { UserPreferencesService } from '../common/user-preferences/user-preferences.service';
import { PxEventData } from './product-experience.model';
import * as i0 from "@angular/core";
/**
 * @property user The user which is given to Gainsight.
 * @property tenant The tenant which is given to Gainsight.
 * @property instanceId Extracted domain part of an URL.
 * @property versionUI The UI version used.
 * @property versionBE The BE version used.
 */
interface IdentifyData {
    user: IUser;
    currentTenant: ICurrentTenant;
    instanceId: string;
    versionUI?: string;
    versionBE?: string;
}
/**
 * A service to manage the Gainsight integration. It allows to load the
 * tag and
 */
export declare class GainsightService {
    private appState;
    private options;
    private cookieBannerService;
    private userPreferencesService;
    private translateService;
    /**
     * A subject that emits the tag function as soon as a new tag is set.
     */
    tagFunction$: BehaviorSubject<any>;
    trackingLoaded$: Subject<boolean>;
    /**
     * Gainsight is activated only when the cookie banner is present. If functional cookies are enabled, both personally identifiable information (PII) and required data are sent.
     * Otherwise, only the required data is transmitted during the identity step execution.
     */
    readonly USER_PREFERENCES_GAINSIGHT_KEY = "gainsightEnabled";
    /**
     * The name of the key remained unchanged, but applies to all engagements.
     */
    readonly USER_PREFERENCES_GAINSIGHT_ENGAGEMENTS_KEY = "gainsightBotEnabled";
    readonly HIDE_GAINSIGHT_BOT_STYLE_ID = "hide-gs-bot";
    private readonly GAINSIGHT_URL;
    private readonly GAINSIGHT_GLOBAL_SCOPE;
    private readonly SCRIPT_EXECUTION_WAIT_TIME;
    private readonly OPTIONS_KEY_CATEGORY;
    private readonly OPTIONS_KEY_NAME;
    private isScriptLoaded;
    private gainsightKey;
    private cachedRevertedTranslations;
    private cachedLanguage;
    constructor(appState: AppStateService, options: OptionsService, cookieBannerService: CookieBannerService, userPreferencesService: UserPreferencesService, translateService: TranslateService);
    /**
     * Checks if the specified Gainsight preference is disabled in user preferences.
     * @param preferenceName - Name of the Gainsight preference.
     * @returns A promise that resolves to `true` if the preference is disabled, otherwise `false`.
     */
    isGainsightPreferenceDisabledInUserPreferences(preferenceName: string): Promise<boolean>;
    /**
     * Sets the state of the functional cookie.
     * @param value - A boolean value to indicate whether the functional cookie should be enabled (`true`) or disabled (`false`).
     */
    setFunctionalCookie(value: boolean): void;
    getGainsightKey(): Promise<string>;
    /**
     * Returns the tag global function which can be used to identify user
     * or add special events.
     */
    get tagFunction(): any;
    /**
     * Load the script tag and calls the identify function to start the tracking.
     * @param currentTenant The current tenant.
     * @param sendPiiData Flag for sending personally identifiable information (PII) during identification in Gainsight.
     */
    loadTag(currentTenant: ICurrentTenant, sendPiiData: boolean): Promise<void>;
    /**
     * Identifies the user/account at Gainsight.
     * @param sendPiiData Flag for sending personally identifiable information.
     * @param identifyData Object containing identification data.
     */
    identify(sendPiiData: boolean, identifyData: IdentifyData): void;
    /**
     * Triggers an event to be recorded by Gainsight PX.
     * This method calls the Gainsight PX's tracking mechanism to log a specific event
     * along with its associated properties.
     * @param eventName - Name of the event to be triggered.
     * @param props - Optional properties associated with the event.
     */
    triggerEvent(eventName: string, props?: PxEventData): void;
    translateToEnglish(textToTranslate: string): string;
    /**
     * Determines whether personally identifiable information (PII) should be sent while loading a tag.
     * The decision to activate Gainsight and send PII relies on whether the cookiePreferences option is defined in the application settings,
     * if the functional cookie is enabled, and if the user grants permission.
     */
    shouldSendPiiData(): Promise<boolean>;
    /**
     * Updates a specific user attribute in the Gainsight global scope.
     * This method interfaces with the Gainsight global object to set a user's specific attribute with a provided value.
     * @param name - Name of the user attribute to be updated.
     * @param value - Value to set for the specified user attribute.
     */
    updateUserAttribute(name: string, value: string | Date | number | boolean): void;
    /**
     * Determines if the current user has the capability to modify Gainsight PX settings.
     *
     * This method checks multiple conditions:
     * 1. Whether tracking has been disabled globally via application options.
     * 2. Whether Gainsight is disabled at the tenant level through custom properties.
     * 3. Whether a Gainsight key is available, either currently loaded or fetched asynchronously.
     * 4. Whether cookie preferences are defined and available for the user.
     *
     * @returns Promise that resolves to a boolean. True indicates the user can edit product experience settings, and false otherwise.
     */
    canEditProductExperienceSettings(): Promise<boolean>;
    hashGroupName(groupName: string): Promise<string>;
    /**
     * Sets the global context for Gainsight with the current application name.
     * The global context can be utilized by Gainsight for various purposes, such as segmenting users.
     */
    setGlobalContext(): void;
    transformUserRolesToStr(userRoles?: IIdentified[]): string;
    /**
     * Checks if Gainsight is disabled based on tenant custom properties.
     *
     * @param customProperties - The custom properties of the tenant.
     * @returns {boolean} - True if Gainsight is disabled, false otherwise.
     */
    isGainsightDisabledAtTenantCustomProperties(customProperties: ICustomProperties): boolean;
    /**
     * Determines if custom branding is enabled based on the presence of a brand logo.
     *
     * @returns {boolean} - True if custom branding is applied, false otherwise.
     */
    isCustomBranding(): boolean;
    /**
     * Determines if tracking is disabled based on the application options.
     * @returns `true` if tracking is disabled, otherwise `false`.
     */
    isTrackingDisabled(): boolean;
    private prepareEventName;
    private loadScriptTag;
    private getInstanceIdFromUrl;
    /**
     * Reverses the translation object.
     *
     * **Example**
     * { Add widget: "Widget hinzufügen" }
     *
     * will be changed to:
     *
     * { Widget hinzufügen: "Add widget" }
     *
     * @param currentLang Language whose translated values are to be placed in the object key.
     * @returns Returns an inverted object where the keys have been swapped with the values.
     */
    private getRevertedTranslations;
    /**Translates string back into English.
     * If the current application language is set to English, the string passed as an argument is returned.
     * @param textToTranslate string to translate.
     * @returns Returns the string translated into English.
     */
    private getEnTranslation;
    static ɵfac: i0.ɵɵFactoryDeclaration<GainsightService, never>;
    static ɵprov: i0.ɵɵInjectableDeclaration<GainsightService>;
}
export {};
//# sourceMappingURL=gainsight.service.d.ts.map