import { KMCRootObject } from "@klevu/core";
import { KlevuUIGlobalSettings } from "../../utils/utils";
import en from "../../translations/en.json";
/**
 * List of available translations
 */
export type Translations = "en" | "fi";
/**
 * Translation typing to auto complete
 */
export type Translation = typeof en;
/**
 *
 * `klevu-init` is the most important component of the whole library. Place one in your document. It should be
 * one of the first ones in the `<body>` tag. Currently only one `klevu-init` per page is supported. It is used to define
 * configuration for all components on the page and provide few global settings for all components:
 *
 * - **onItemClick:** what happens when product is clicked. Typically this places default action of
 *   _klevu-product_ click. For example you can make your own frontend router to act in this function. Is
 *   provided with product and click event as attributes. Remember to preventDefault and return false to prevent anchor
 *   link following.
 * - **generateProductUrl:** what kind of URL's should be generated for products. If _onItemClick_
 *   is not used this can be used for it. Has product as attribute.
 * - **renderPrice:** generic function for price rendering. If you wish to have your own formatting for price
 *   rendering then this is the place. Has two attribute amount and currency of item.
 * Initializes components to fetch data from correct Klevu backend
 *
 *
 * **Note: All global CSS variables are documented in `klevu-init` even thought they are not defined in it.**
 *
 */
export declare class KlevuInit {
  #private;
  /**
   * Read only API key to Klevu
   */
  apiKey: string;
  /**
   * Klevu Server URL
   */
  url: string;
  /**
   * Override the default events v1 URL
   */
  eventsV1Url?: string;
  /**
   * Override the default events v2 URL
   */
  eventsV2Url?: string;
  /**
   * Override the default recommendations API URL
   */
  recommendationsApiUrl?: string;
  /**
   * Global settings
   */
  settings?: KlevuUIGlobalSettings;
  /**
   * Which language to load
   */
  language: Translations;
  /**
   * Provide your own translations
   */
  translation?: Translation;
  /**
   * Override the default translation URL prefix. Will use format of
   * `${translationUrlPrefix}/translations/${lang}.json`
   */
  translationUrlPrefix?: string;
  kmcLoadDefaults?: boolean;
  connectedCallback(): Promise<void>;
  /**
   *
   * @returns KlevuConfig, but due to typescript problems it is any
   */
  getConfig(): Promise<any>;
  /**
   * Get settings defined in klevu-init
   *
   * @returns
   */
  getSettings(): Promise<KlevuUIGlobalSettings | undefined>;
  /**
   * To make sure that components in the page wait for klevu-init to run and set the settings this method is required to use.
   * In `connectedCallback()` function should call this method. So for example:
   *
   * ```
   * async connectedCallback() {
   *   await KlevuInit.ready()
   * }
   * ```
   *
   * @returns Promise when klevu-init is loaded
   */
  static ready(): Promise<HTMLKlevuInitElement> | undefined;
  render(): any;
}
declare global {
  interface Window {
    klevu_ui_settings?: KlevuUIGlobalSettings;
    klevu_ui_translations?: typeof en;
    klevu_page_meta?: {
      pageType?: string;
      itemName?: string;
      itemUrl?: string;
      itemId?: string;
      itemGroupId?: string;
      itemSalePrice?: string;
      itemCurrency?: string;
    };
    klevu_ui_kmc_settings?: KMCRootObject;
  }
}
