/*! * Jodit Editor (https://xdsoft.net/jodit/) * Released under MIT see LICENSE.txt in the project root for license information. * Copyright (c) 2013-2026 Valerii Chupurnov. All rights reserved. https://xdsoft.net */ /** * @module types */ import type { CanPromise, IDestructible, IDictionary } from "./types"; export type DataVariant = IDictionary | null | FormData | string | IDictionary; export interface IRequest { url: string; method: string; data: DataVariant; } export interface IResponse { readonly status: number; readonly statusText: string; readonly url: string; readonly request: IRequest; json(): Promise; text(): Promise; blob(): Promise; } export interface IAjax extends IDestructible { options: AjaxOptions; o: this['options']; abort(): IAjax; send(): Promise>; prepareRequest(): IRequest; } export interface AjaxOptions { successStatuses: number[]; /** * The HTTP method to use for the request * (e.g. "POST", "GET", "PUT") */ method?: string; /** * A string containing the URL which the request is sent. */ url?: string; /** * Data be sent to the server. * It is converted to a query string, if not already a string. It's appended to the url for GET-requests. */ data: DataVariant; /** * When sending data to the server, use this content type. Default is "application/x-www-form-urlencoded; * charset=UTF-8", which is fine for most cases */ contentType?: string | false; /** * An object (or a function which returns an object) of additional header key/value pairs to send along * with requests using the XMLHttpRequest transport. Uses in [[FileBrowser]] * and [[Uploader]] */ headers?: IDictionary | null | ((this: IAjax) => CanPromise | null>); responseType?: XMLHttpRequestResponseType; /** * Enable or disable Access-Control-Allow-Credentials client side. Useful for cross domain requests */ withCredentials?: boolean; queryBuild?: (this: IAjax, obj: string | IDictionary | FormData, prefix?: string) => string | FormData; xhr?: () => XMLHttpRequest; onProgress?: (percentage: number) => void; }