UNPKG

@elastic-suite/gally-admin-shared

Version:
1,586 lines (1,509 loc) 63.2 kB
import * as React from 'react'; import React__default, { MutableRefObject, ReactNode, CSSProperties, SyntheticEvent, FunctionComponent } from 'react'; import { DialogProps } from '@mui/material'; import * as _mui_material_styles from '@mui/material/styles'; import * as _emotion_serialize from '@emotion/serialize'; import { TFunction } from 'next-i18next'; import { TFunction as TFunction$1 } from 'i18next'; import { Theme } from '@mui/system'; declare const defaultApiRootPrefix = "api"; declare const apiUrl: string; declare const gqlUrl: string; declare const searchableAttributeUrl = "?isSearchable=true"; declare const authHeader = "Authorization"; declare const languageHeader = "Gally-Language"; declare const contentTypeHeader = "Content-Type"; declare const authErrorCodes: number[]; declare const currentPage = "currentPage"; declare const pageSize = "pageSize"; declare const usePagination = "pagination"; declare const searchParameter = "search"; declare const defaultPageSize = 50; declare const categoryEntityType = "category"; declare const cmsPageEntityType = "cms_page"; declare enum AggregationType { CATEGORY = "category", CHECKBOX = "checkbox", SLIDER = "slider", BOOLEAN = "boolean", HISTOGRAM = "histogram", HISTOGRAM_DATE = "date_histogram" } interface IGraphqlAggregation { count: number; field: string; label: string; type: AggregationType; options: IGraphqlAggregationOption[]; hasMore: boolean | null; date_format?: string; date_range_interval?: string; } interface IGraphqlAggregationOption { count: number; label: string; value: string; } declare class ApiError extends Error { } declare function isApiError<T extends object>(json: T | IResponseError): json is IResponseError; declare function getApiUrl(url?: string): string; declare function fetchApi<T extends object>(language: string, resource: IResource | string, searchParameters?: ISearchParameters, options?: RequestInit, secure?: boolean): Promise<T>; declare function removeEmptyParameters(searchParameters?: ISearchParameters): ISearchParameters; declare function getApiFilters(filters?: ISearchParameters): ISearchParameters; /** * Check if filters are applied in addition to fixed filters. */ declare function hasRealFilterApplied(searchParameters: ISearchParameters, fixedFilters: ISearchParameters): boolean; declare function fetchApiUsingPagination<T extends object>(fetchApi: IFetchApi, resource: IResource | string, searchParameters?: ISearchParameters, options?: RequestInit, rowsPerPage?: number): Promise<IFetch<T>>; declare class GraphqlError extends Error { errors: IGraphqlError[]; constructor(errors: IGraphqlError[]); } declare function isGraphqlError<T extends object>(json: T | IGraphqlError[]): json is IGraphqlError[]; declare function fetchGraphql<T>(language: string, query: string, variables?: Record<string, unknown>, options?: RequestInit, secure?: boolean): Promise<T>; declare class AuthError extends Error { } declare function isError<T extends object>(json: T | IError): json is IError; declare enum HttpCode { OK = "200", CREATED = "201", NO_CONTENT = "204", BAD_REQUEST = "400", NOT_FOUND = "404", UNPROCESSABLE_ENTITY = "422" } declare enum Method { DELETE = "DELETE", GET = "GET", PATCH = "PATCH", POST = "POST", PUT = "PUT" } interface IError { error?: Error; violations?: any; } declare type NetworkError = Error | ApiError | AuthError | GraphqlError | string; interface IJsonldContext { '@context': string; } interface IJsonldType { '@type': string | string[]; } interface IJsonldId { '@id': string; } interface IJsonldBase extends IJsonldType, IJsonldId { } interface IJsonldString { '@value': string; } interface IJsonldBoolean { '@value': boolean; } interface IJsonldNumber { '@value': number; } declare type IJsonldValue = IJsonldString | IJsonldBoolean | IJsonldNumber; interface IJsonldOwlEquivalentClass { 'http://www.w3.org/2002/07/owl#allValuesFrom': [IJsonldId]; 'http://www.w3.org/2002/07/owl#onProperty': [IJsonldId]; } interface IJsonldRange { 'http://www.w3.org/2002/07/owl#equivalentClass': [IJsonldOwlEquivalentClass]; } declare enum LoadStatus { FAILED = 0, IDLE = 1, LOADING = 2, SUCCEEDED = 3 } interface IFetch<D> { data?: D; error?: Error; status: LoadStatus; } interface IGraphqlResponse<D> { data: D; } declare type ISearchParameters = Record<string, string | number | boolean | (string | number | boolean)[]>; declare type IFetchApi = <T extends object>(resource: IResource | string, searchParameters?: ISearchParameters, options?: RequestInit) => Promise<T | IError>; interface IOption<T> { disabled?: boolean; id?: string | number; label?: string; value: T; default?: boolean; field?: string; input?: string; jsonKeyValue?: string; } declare type IOptions<T> = IOption<T>[]; declare type IFieldOptions = Map<string, IOptions<string | number>>; declare type ILoadStatuses = Map<string, LoadStatus>; interface IOptionsContext { load: (field: IField) => void; fieldOptions: IFieldOptions; statuses: MutableRefObject<ILoadStatuses>; } interface IApiSchemaOptions { code?: string; label: string; id?: string; value?: string; options?: IApiSchemaOptions[]; } interface IGraphqlNode<T> { node: T; } interface IGraphqlEdges<T> { edges: IGraphqlNode<T>[]; } interface IGraphqlErrorLocation { line: number; column: number; } interface IGraphqlExtensions { argumentName?: string; category?: string; code?: string; exception?: { stacktrace: string[]; }; } interface IGraphqlTrace { call: string; file: string; line: number; } interface IGraphqlError { debugMessage?: string; message: string; extensions: IGraphqlExtensions; locations: IGraphqlErrorLocation[]; path?: string[]; trace?: IGraphqlTrace[]; } interface IGraphql<D> { data?: D; errors?: IGraphqlError[]; } declare type IGraphqlApi = <T extends object>(query: string, variables?: Record<string, unknown>, options?: RequestInit) => Promise<T | IError>; interface IGraphqlQueryContent { variables?: Record<string, unknown>; args?: Record<string, unknown>; fields: Record<string, unknown>; } interface ILocalizedCatalog extends IJsonldBase { id: number | string; name: string; code: string; currency: string; locale: string; isDefault: boolean; localName: string; } interface IHydraLocalizedCatalog extends ILocalizedCatalog, IJsonldBase { } interface ICatalog { id: number | string; code: string; name: string; localizedCatalogs: ILocalizedCatalog[]; } interface IHydraCatalog extends ICatalog, IHydraMember { } interface IHydraSimpleCatalog extends Pick<ICatalog, 'code'>, IHydraMember { } interface IGraphqlCatalog extends Omit<ICatalog, 'localizedCatalogs'> { localizedCatalogs: IGraphqlEdges<Partial<ILocalizedCatalog>>; } interface IGraphqlCatalogs { catalogs: IGraphqlEdges<Partial<IGraphqlCatalog>>; } interface ICustomDialogStyles { paper?: React__default.CSSProperties; title?: React__default.CSSProperties; actions?: React__default.CSSProperties; content?: React__default.CSSProperties; } interface IPropsCustomDialog extends DialogProps { position: 'left' | 'right' | 'center'; styles?: ICustomDialogStyles; } interface ICustomDialog extends IPropsCustomDialog { handleClose: () => void; handleConfirm?: () => Promise<void>; confirmationPopIn?: boolean; actions?: ReactNode; titlePopIn?: string; cancelName?: string; confirmName?: string; loading?: boolean; } interface IPropsPopIn extends Omit<ICustomDialog, 'open' | 'handleClose'> { triggerElement: ReactNode; onConfirm?: () => void | Promise<void>; boxStyle?: React__default.CSSProperties; } declare enum MassiveSelectionType { ALL = "massiveselection.all", ALL_ON_CURRENT_PAGE = "massiveselection.allOnCurrentPage", NONE = "massiveselection.none" } declare enum DataContentType { BOOLEAN = "boolean", IMAGE = "image", LABEL = "label", NUMBER = "number", PRICE = "price", RANGE = "range", SCORE = "score", SELECT = "select", STOCK = "stock", STRING = "string", TAG = "tag", BUTTON = "button", OPTGROUP = "optgroup", RANGEDATE = "rangeDate", REQUESTTYPE = "requestType", RULEENGINE = "ruleEngine", SLIDER = "slider", MULTIPLEINPUT = "multipleInput", SYNONYM = "synonym", EXPANSION = "expansion", PRODUCTINFO = "productInfo", BOOSTPREVIEW = "boostPreview", POSITIONEFFECT = "positionEffect", PROPARTIONALTOATTRIBUTE = "proportionalToAttribute" } interface ITableHeader extends IFieldConfig { sticky?: boolean; } interface IBaseStyle { left: string; backgroundColor: string; zIndex: string; } interface INonStickyStyle { borderBottomColor: string; backgroundColor: string; overflow?: string; } interface ISelectionStyle extends IBaseStyle { stickyBorderStyle?: IStickyBorderStyle; } interface IStickyStyle extends IBaseStyle { minWidth: string; stickyBorderStyle?: IStickyBorderStyle; overflow?: string; } interface IDraggableColumnStyle extends IBaseStyle { minWidth: string; borderRight?: string; stickyBorderStyle?: IStickyBorderStyle; } interface IStickyBorderStyle { borderBottomColor: string; borderRight: string; borderRightColor: string; boxShadow?: string; clipPath?: string; } interface ITableRow { id: string | number; popIn?: ICustomDialog; [key: string]: string | boolean | number | IScore | IImage | IStock | IPrice[] | IProductInfo | ICustomDialog | IPositionEffect; } interface IHorizontalOverflow { isOverflow: boolean; shadow: boolean; } interface ITableHeaderSticky extends ITableHeader { isLastSticky: boolean; } declare type ITableConfig = Record<string, IFieldState>; declare type BoostType = 'up' | 'down' | 'straight'; declare type PositionEffectType = 'up' | 'down' | 'straight'; declare enum ImageIcon { PIN = "push-pin" } interface IBoost { type: BoostType; boostNumber?: number; boostMultiplicator?: number; } interface IStock { status: boolean; qty?: number; } interface IScore { scoreValue: number; boostInfos?: IBoost; } interface IImage { path: string; icons?: ImageIcon[]; } interface IPrice { price: number; } interface IProductInfo { productName: string; price: IPrice['price']; stockStatus: IStock['status']; } interface IPositionEffect { type: PositionEffectType; } interface IFieldState { disabled?: boolean; visible?: boolean; } interface IFieldCondition { field: string; value: any; } interface IFieldDepends { type: 'enabled' | 'visible'; conditions: (IFieldCondition | IFieldCondition[])[] | IFieldCondition; } interface IFieldConfig extends IFieldState { depends?: IFieldDepends; editable?: boolean; field?: IField; fieldset?: string; id: string; input?: DataContentType; label?: string; name: string; multiple?: boolean; options?: IOptions<unknown> | null; required?: boolean; suffix?: string; type?: DataContentType; validation?: Record<string, string | number>; multipleValueFormat?: IMultipleValueFormat; requestTypeConfigurations?: Record<string, string>; optionConfig?: IOption<string>; infoTooltip?: string; multipleInputConfiguration?: IMultipleInputConfiguration; placeholder?: string; defaultValue?: unknown; helperText?: string; error?: boolean; headerStyle?: CSSProperties; cellsStyle?: CSSProperties; showError?: boolean; replacementErrorsMessages?: Record<string, string>; gridHeaderInfoTooltip?: string; } interface IFieldConfigFormWithFieldset { position?: number; label?: string; tooltip?: string; code: string; children: IFieldConfig[]; external?: boolean; } interface IFieldGuesserProps extends IFieldConfig { diffValue?: unknown; onChange?: (name: string | IOption<string>, value: unknown, event?: SyntheticEvent) => void; showError?: boolean; useDropdownBoolean?: boolean; row?: ITableRow; value: unknown; data?: Record<string, unknown>; } declare enum HydraType { ARRAY = "array", BOOLEAN = "boolean", INTEGER = "integer", OBJECT = "object", STRING = "string" } interface IHydraPropertyTypeRef { $ref?: string; } interface IHydraPropertyTypeArray { type: HydraType.ARRAY; items: HydraPropertyType; } interface IHydraPropertyTypeBoolean { type: HydraType.BOOLEAN; } interface IHydraPropertyTypeInteger { type: HydraType.INTEGER; default?: number; minimum?: number; maximum?: number; } interface IHydraPropertyTypeObject { type: HydraType.OBJECT; properties: Record<string, HydraPropertyType>; required?: string[]; } interface IHydraPropertyTypeString { type: HydraType.STRING; format?: string; nullable?: boolean; } declare type HydraPropertyType = IHydraPropertyTypeRef | IHydraPropertyTypeArray | IHydraPropertyTypeBoolean | IHydraPropertyTypeInteger | IHydraPropertyTypeObject | IHydraPropertyTypeString; interface IOwlEquivalentClass { 'owl:onProperty': IJsonldId; 'owl:allValuesFrom': IJsonldId; } interface IRdfsRange { 'owl:equivalentClass': IOwlEquivalentClass; } interface IHydraSupportedOperation extends IJsonldType { expects?: string; 'hydra:method': Method; 'hydra:title'?: string; 'rdfs:label': string; returns: string; } interface IHydraProperty extends IJsonldBase { domain: string; 'hydra:supportedOperation'?: IHydraSupportedOperation | IHydraSupportedOperation[]; 'owl:maxCardinality'?: number; range?: string; 'rdfs:label': string; 'rdfs:range'?: (IJsonldId | IRdfsRange)[]; } interface IDependsForm { field?: string; value?: string; } interface IInputDependencies { field: string; value: string; input: string; jsonKeyValue: string; fieldProps: IFieldGuesserProps; } interface IMultipleInputConfiguration { inputDependencies: IInputDependencies[]; } interface IMultipleValueFormat { separator?: string; maxCount?: number; } interface IGallyProperty { context?: Record<string, IGallyProperty>; depends?: IFieldDepends; editable?: boolean; input?: string; options?: IDropdownOptions & (IDropdownStaticOptions | IDropdownApiOptions); position?: number; required?: boolean; type?: string; validation?: Record<string, string | number | boolean>; visible?: boolean; alias?: string; multipleValueFormat?: IMultipleValueFormat; fieldset?: string; rangeDateType?: string; rangeDateId?: number | string; requestTypeConfigurations?: Record<string, string>; form?: IGallyProperty; grid?: IGallyProperty; infoTooltip?: string; multipleInputConfiguration?: IMultipleInputConfiguration; placeholder?: string; defaultValue?: unknown; showError?: boolean; gridHeaderInfoTooltip?: string; } interface IDropdownOptions { objectKeyValue?: string; } interface IDropdownStaticOptions { values: IOptions<string>; } interface IDropdownApiOptions { api_rest: string; api_graphql: string; } interface IHydraSupportedProperty extends IJsonldType { 'hydra:description'?: string; 'hydra:property': IHydraProperty; 'hydra:readable': boolean; 'hydra:required'?: boolean; 'hydra:title': string; 'hydra:writeable': boolean; gally?: IGallyProperty; } interface IHydraSupportedClass extends IJsonldBase { 'hydra:description'?: string; 'hydra:supportedOperation'?: IHydraSupportedOperation | IHydraSupportedOperation[]; 'hydra:supportedProperty': IHydraSupportedProperty[]; 'hydra:title': string; 'rdfs:label'?: string; subClassOf?: string; } interface IHydraMember extends IJsonldBase { id: number | string; } interface IHydraLabelMember extends IHydraMember { localizedCatalog: IHydraSimpleCatalog; label: string; } interface IHydraTrace { args: [string, unknown][]; class: string; file: string; function: string; line: number; namespace: string; short_class: string; type: string; } interface IHydraError extends IJsonldType, IJsonldContext { '@context': '/contexts/Error'; '@type': 'hydra:Error'; 'hydra:description': string; 'hydra:title': string; trace: IHydraTrace[]; } interface IHydraMapping extends IJsonldType { variable: string; property: string; required: boolean; } interface IHydraSearch extends IJsonldType { 'hydra:mapping': IHydraMapping[]; 'hydra:template': string; 'hydra:variableRepresentation': string; } interface IHydraResponse<Member> extends IJsonldContext, IJsonldType, IJsonldId { 'hydra:member': Member[]; 'hydra:search'?: IHydraSearch; 'hydra:totalItems': number; } interface IExpandedHydraSupportedOperation extends IJsonldType { 'http://www.w3.org/2000/01/rdf-schema#label': [IJsonldString]; 'http://www.w3.org/ns/hydra/core#expects'?: [IJsonldString]; 'http://www.w3.org/ns/hydra/core#method': [IJsonldString]; 'http://www.w3.org/ns/hydra/core#returns': [IJsonldId]; 'http://www.w3.org/ns/hydra/core#title'?: [IJsonldString]; } interface IExpandedHydraProperty extends IJsonldBase { 'http://www.w3.org/2000/01/rdf-schema#domain': [IJsonldId]; 'http://www.w3.org/2000/01/rdf-schema#label': [IJsonldString]; 'http://www.w3.org/2000/01/rdf-schema#range': [IJsonldId] | [IJsonldId, IJsonldRange]; 'http://www.w3.org/2002/07/owl#maxCardinality'?: [IJsonldNumber]; 'http://www.w3.org/ns/hydra/core#supportedOperation'?: IExpandedHydraSupportedOperation[]; } interface IExpandedGallyProperty { 'https://localhost/docs.jsonld#editable'?: [IJsonldBoolean]; 'https://localhost/docs.jsonld#position'?: [IJsonldNumber]; 'https://localhost/docs.jsonld#visible'?: [IJsonldBoolean]; 'https://localhost/docs.jsonld#context'?: [ Record<string, [IExpandedGallyProperty]> ]; } interface IExpandedHydraSupportedProperty extends IJsonldType { 'http://www.w3.org/ns/hydra/core#property': IExpandedHydraProperty[]; 'http://www.w3.org/ns/hydra/core#readable': [IJsonldBoolean]; 'http://www.w3.org/ns/hydra/core#required'?: [IJsonldBoolean]; 'http://www.w3.org/ns/hydra/core#title': [IJsonldString]; 'http://www.w3.org/ns/hydra/core#writeable': [IJsonldBoolean]; 'https://localhost/docs.jsonld#gally'?: IExpandedGallyProperty; } interface IExpandedHydraSupportedClass extends IJsonldBase { 'http://www.w3.org/2000/01/rdf-schema#label'?: [IJsonldString]; 'http://www.w3.org/ns/hydra/core#supportedOperation': IExpandedHydraSupportedOperation[]; 'http://www.w3.org/ns/hydra/core#supportedProperty': IExpandedHydraSupportedProperty[]; 'http://www.w3.org/ns/hydra/core#title': [IJsonldString]; } interface IProperty extends IJsonldBase { domain: IJsonldId; label: string; range?: IJsonldId; } interface IField extends IJsonldType { description?: string; property: IProperty; readable: boolean; required: boolean; title: string; writeable: boolean; gally?: IGallyProperty; } interface IOperation extends IJsonldType { expects?: string; label: string; method: Method; returns: IJsonldId; title: string; } interface IGallyClass { fieldset: Record<string, { position: number; label?: string; tooltip?: string; }>; } interface IResource extends IJsonldBase { label?: string; supportedOperation: IOperation[]; supportedProperty: IField[]; title: string; url: string; gally?: IGallyClass; } declare type IApi = IResource[]; interface IResponseError { code: number; message: string; } interface IResourceOperations<T> { create?: (item: Omit<T, 'id' | '@id' | '@type'>) => Promise<T | IError>; remove?: (id: string | number) => Promise<T | IError>; replace?: (item: Partial<T>) => Promise<T | IError>; update?: (id: string | number, item: Partial<T>) => Promise<T | IError>; } declare type IResourceEditableCreate<T> = (item: Omit<T, 'id' | '@id' | '@type'>) => Promise<void>; declare type IResourceEditableMassUpdate<T> = (ids: (string | number)[], item: Partial<T>) => Promise<void>; declare type IResourceEditableMassReplace<T> = (ids: (string | number)[], item: Omit<T, '@id' | '@type'>) => Promise<void>; declare type IResourceEditableRemove = (id: string | number) => Promise<void>; declare type IResourceEditableReplace<T> = (item: Partial<T>, isValid?: boolean) => void; declare type IResourceEditableUpdate<T> = (id: string | number, item: Partial<T>, isValid?: boolean) => void; interface IResourceEditableOperations<T> { create?: IResourceEditableCreate<T>; massUpdate?: IResourceEditableMassUpdate<T>; massReplace?: IResourceEditableMassReplace<T>; remove?: IResourceEditableRemove; replace?: IResourceEditableReplace<T>; update?: IResourceEditableUpdate<T>; } declare type ILoadResource = () => void; declare enum SortOrder { ASC = "asc", DESC = "desc" } interface ISortingOption extends IJsonldBase { label: string; code: string; } interface IGraphqlSortingOptions { sortingOptions: ISortingOption[]; } interface IGraphqlSearchDocumentsVariables { entityType: string; localizedCatalog: string; currentPage?: number; filter?: IDocumentFieldFilterInput[] | IDocumentFieldFilterInput; pageSize?: number; search?: string; sort?: IGraphqlDocumentSort; } interface IGraphqlSearchDocuments { documents: IGraphqlSearchDocument; } interface IGraphqlVectorSearchDocuments { vectorSearchDocuments: IGraphqlSearchDocument; } interface IGraphqlSearchDocument { collection: IGraphqlDocument[]; paginationInfo: IGraphqlDocumentPaginationInfo; sortInfo: IGraphqlDocumentSortInfo; aggregations?: IGraphqlAggregation[]; } interface IGraphqlDocument { id: string; source: Record<string, any>; score: string; } interface IGraphqlDocumentPaginationInfo { lastPage: number; totalCount: number; } interface IGraphqlDocumentSort { field: string; direction: SortOrder; } interface IGraphqlDocumentSortInfo { current: IGraphqlDocumentSortInfoCurrent[]; } interface IGraphqlDocumentSortInfoCurrent { field: string; direction: SortOrder; } interface IDocumentBoolFilterInput { _must?: IDocumentFieldFilterInput[]; _should?: IDocumentFieldFilterInput[]; _not?: IDocumentFieldFilterInput[]; } interface IDocumentEqualFilterInput { field: string; eq?: string; in?: string[]; } interface IDocumentMatchFilterInput { field: string; match: string; } interface IDocumentRangeFilterInput { field: string; gte?: string; gt?: string; lt?: string; lte?: string; } interface IDocumentExistFilterInput { field: string; } interface IDocumentFieldFilterInput { boolFilter?: IDocumentBoolFilterInput; equalFilter?: IDocumentEqualFilterInput; matchFilter?: IDocumentMatchFilterInput; rangeFilter?: IDocumentRangeFilterInput; existFilter?: IDocumentExistFilterInput; } interface ICategory { id: string; isVirtual: boolean; name: string; path: string; level: number; children?: ICategory[]; catalogName?: string; } interface ICategories extends IJsonldBase { catalogId?: number; localizedCatalogId?: number; categories?: ICategory[]; } interface IGraphqlCategories { getCategoryTree: Partial<ICategories>; } interface IGraphqlSearchCategories { categories: IGraphqlSearchDocument; } declare type IOperatorsValueType<O extends string = string> = Record<string, Record<O, RuleValueType>>; interface IRuleEngineOperators<O extends string = string> extends IHydraMember, IJsonldContext { operators: Record<O, string>; operatorsBySourceFieldType: Record<string, O[]>; operatorsValueType: IOperatorsValueType; } interface ITreeItem { id: number | string; isVirtual: boolean; name: string; path: string; level: number; children?: ITreeItem[]; } declare enum RuleType { ATTRIBUTE = "attribute", COMBINATION = "combination" } declare enum RuleAttributeType { BOOLEAN = "boolean", CATEGORY = "category", FLOAT = "float", INT = "int", REFERENCE = "reference", SELECT = "select", TEXT = "text", DATE = "date" } declare enum RuleValueType { BOOLEAN = "Boolean", FLOAT = "Float", INT = "Int", STRING = "String", BOOLEAN_MULTIPLE = "[Boolean]", FLOAT_MULTIPLE = "[Float]", INT_MULTIPLE = "[Int]", STRING_MULTIPLE = "[String]", STRING_REQUIRED = "String!" } declare enum RuleCombinationOperator { ALL = "all", ANY = "any" } interface IRule { type: RuleType; value: string | string[] | number | number[] | boolean; } interface IRuleAttribute extends IRule { type: RuleType.ATTRIBUTE; field: string; operator: string; attribute_type: RuleAttributeType; } interface IRuleCombination extends IRule { type: RuleType.COMBINATION; operator: RuleCombinationOperator; children: IRule[]; } declare type IRuleOptions = Map<string, IOptions<unknown> | ITreeItem[]>; interface IRuleOptionsContext { getAttributeOperatorOptions: (field: string) => IOptions<string>; getAttributeType: (field: string) => RuleAttributeType; loadAttributeValueOptions: (field: string) => void; operatorsValueType: IOperatorsValueType; options: IRuleOptions; } interface ICategoryConfiguration extends IHydraMember { useNameInProductSearch: boolean; isActive: boolean; isVirtual: boolean; defaultSorting: string; name: string; category: string; virtualRule?: string; } interface IParsedCategoryConfiguration extends Omit<ICategoryConfiguration, 'virtualRule'> { virtualRule?: IRuleCombination; } interface IGraphqlSearchCmsPages { cmsPages: IGraphqlSearchDocument; } interface ICmsPage extends IGraphqlDocument { id: string; title: string; content: string; contentHeading: string; } interface IDocsJsonContent { schema: HydraPropertyType; } interface IDocsJsonBody { description: string; content: Record<string, IDocsJsonContent>; required: boolean; } interface IDocsJsonParameter { name: string; in: string; description: string; required: boolean; deprecated: boolean; allowEmptyValue: boolean; schema: HydraPropertyType; style: string; explode: boolean; allowReserved: boolean; } interface IDocsJsonLink { operationId: string; parameters: Record<string, string>; description: string; } interface IDocsJsonResponse { content?: Record<string, IDocsJsonContent>; description: string; links?: Record<string, IDocsJsonLink>; } declare type DocsJsonResponses = { [code in HttpCode]?: IDocsJsonResponse; }; interface IDocsJsonOperation { operationId?: string; tags?: string[]; responses?: DocsJsonResponses; summary?: string; description?: string; parameters: IDocsJsonParameter[]; requestBody?: IDocsJsonBody; deprecated?: boolean; } declare type DocsJsonMethods = { [method in Lowercase<Method>]?: IDocsJsonOperation; }; interface IDocsJsonPath extends DocsJsonMethods { parameters: string[]; ref?: string; } interface IDocsJsonSecurity { apiKey: string[]; } interface IDocsJsonServer { url: string; description: string; } interface IDocsJsonInfo { title: string; description: string; version: string; } interface IDocsJsonSecuritySchemes { type: string; description: string; name: string; in: string; } interface IDocsJsonComponents { schemas: Record<string, HydraPropertyType>; responses: DocsJsonResponses; parameters: Record<string, unknown>; examples: Record<string, unknown>; requestBodies: Record<string, unknown>; headers: Record<string, unknown>; securitySchemes: Record<string, IDocsJsonSecuritySchemes>; } interface IDocsJson { openapi: string; info: IDocsJsonInfo; servers: IDocsJsonServer[]; paths: Record<string, IDocsJsonPath>; components: Record<string, IDocsJsonComponents>; security: IDocsJsonSecurity[]; tags: string[]; } interface IDocsJsonldContext { '@vocab': string; domain: IJsonldBase; expects: IJsonldBase; hydra: string; owl: string; range: IJsonldBase; rdf: string; rdfs: string; returns: IJsonldBase; schema: string; subClassOf: IJsonldBase; xmls: string; } interface IDocsJsonld extends IJsonldBase { '@context': IDocsJsonldContext; 'hydra:entrypoint': string; 'hydra:supportedClass': IHydraSupportedClass[]; 'hydra:title': string; } interface IExpandedDocsJsonld extends IJsonldBase { 'http://www.w3.org/ns/hydra/core#entrypoint': [IJsonldString]; 'http://www.w3.org/ns/hydra/core#supportedClass': IExpandedHydraSupportedClass[]; 'http://www.w3.org/ns/hydra/core#title': [IJsonldString]; } declare type IEntrypoint = Record<string, string> & IJsonldBase & IJsonldContext; declare type IExpandedEntrypoint = Record<string, string | string[] | [IJsonldId]> & IJsonldBase; interface IExpansionTerm { '@id'?: string; '@type'?: string; term: string; } interface IExpansion { '@id'?: string; '@type'?: string; referenceTerm: string; terms: IExpansionTerm[]; } declare type IExpansions = IExpansion[]; interface IGraphqlViewMoreFacetOption { id: string; value: string; label: string; count: number; } interface IGraphqlViewMoreFacetOptionsVariables { entityType: string; aggregation: string; localizedCatalog: string; filter?: IDocumentFieldFilterInput[] | IDocumentFieldFilterInput; search?: string; } interface IGraphqlViewMoreFacetOptions { viewMoreFacetOptions: IGraphqlViewMoreFacetOption[]; } declare enum ProductRequestType { CATALOG = "product_catalog", SEARCH = "product_search", COVERAGE_RATE = "product_coverage_rate", AUTOCOMPLETE = "product_autocomplete" } interface IGraphqlSearchProductsVariables { localizedCatalog: string; currentCategoryId?: string; currentPage?: number; filter?: IProductFieldFilterInput[] | IProductFieldFilterInput; pageSize?: number; requestType: ProductRequestType; search?: string; sort?: Record<string, SortOrder>; } interface IGraphqlSearchProducts { products: IGraphqlSearchProduct; } interface IGraphqlSearchProduct { collection: IGraphqlProduct[]; paginationInfo: IGraphqlProductPaginationInfo; sortInfo: IGraphqlProductSortInfo; aggregations?: IGraphqlAggregation[]; } interface IGraphqlProduct { id: string; price?: IPrice[]; sku: string; name: string; brand?: string; stock: IStock; score: number; } interface IGraphqlProductPaginationInfo { lastPage: number; totalCount: number; } interface IGraphqlProductSortInfo { current: IGraphqlProductSortInfoCurrent[]; } interface IGraphqlProductSortInfoCurrent { field: string; direction: SortOrder; } interface IFetchParams { options: RequestInit; searchParameters: ISearchParameters; } interface IProductBoolFilterInput { _must?: IProductFieldFilterInput[]; _should?: IProductFieldFilterInput[]; _not?: IProductFieldFilterInput[]; } interface ICategoryTypeDefaultFilterInputType { eq: string; } interface IStockTypeDefaultFilterInputType { eq?: boolean; exist?: boolean; } interface ISelectTypeDefaultFilterInputType { eq?: string; in?: string[]; exist?: boolean; } interface IEntityTextTypeFilterInput extends ISelectTypeDefaultFilterInputType { match?: string; } interface IEntityIntegerTypeFilterInput { eq?: number; in?: number[]; gte?: number | string; gt?: number | string; lt?: number | string; lte?: number | string; exist?: boolean; } declare type ITypeFilterInput = IEntityIntegerTypeFilterInput | IEntityTextTypeFilterInput | ISelectTypeDefaultFilterInputType | IStockTypeDefaultFilterInputType | ICategoryTypeDefaultFilterInputType | IProductBoolFilterInput; interface IProductFieldFilterInput { boolFilter?: IProductBoolFilterInput; [key: string]: ITypeFilterInput; } interface IGraphqlViewMoreProductFacetOptionsVariables extends Omit<IGraphqlViewMoreFacetOptionsVariables, 'entityType'> { currentCategoryId?: string; filter?: IProductFieldFilterInput[] | IProductFieldFilterInput; } interface IGraphqlViewMoreProductFacetOptions { viewMoreProductFacetOptions: IGraphqlViewMoreFacetOption[]; } interface IGraphqlProductSortingOptions { productSortingOptions: ISortingOption[]; } interface IExplainVariables { localizedCatalog?: string; category?: ITreeItem; requestType?: string; search?: string; } interface IGraphqlSearchExplainProducts { explain: IGraphqlSearchExplainProduct; } interface IGraphqlSearchExplainProduct { collection: IGraphqlExplainProduct[]; paginationInfo: IGraphqlProductPaginationInfo; sortInfo: IGraphqlProductSortInfo; aggregations?: IGraphqlAggregation[]; explainData: IGraphqlProductExplainData; } interface IGraphqlExplainProduct extends Omit<IGraphqlProduct, 'score'> { image: IImage | string; score: IScore | number; explanation: Record<string, unknown>; sort: (string | number)[]; boosts: Record<string, unknown>; matches: Record<string, unknown>[]; highlights: Record<string, unknown>[]; legends: Record<string, Record<string, IGraphqlProductExplainLegend>>; fieldHighlights: Record<string, unknown>[]; } interface IGraphqlProductExplainData { elasticSearchQuery: IGraphqlProductExplainQuery; isSpellchecked: boolean; extraData: Record<string, unknown>; } interface IGraphqlProductExplainQuery { index: string; query: string; } interface IGraphqlProductExplainLegend { field: string; legend: string; } declare enum Bundle { VIRTUAL_CATEGORY = "GallyVirtualCategoryBundle", BOOST = "GallyBoostBundle", THESAURUS = "GallyThesaurusBundle", VECTOR_SEARCH = "GallyVectorSearchBundle" } interface IExtraBundle { id: Bundle; name: Bundle; } declare type IConfigurations = Record<string, string>; interface IErrorsForm { fields: Record<string, string>; global: string[]; } interface ILogin { token: string; } interface IMenuChild { code: string; label: string; children?: IMenuChild[]; path?: string; } interface IMenu { hierarchy: IMenuChild[]; } declare type MessageSeverity = 'error' | 'warning' | 'info' | 'success'; interface IMessage { id: number; message: string; severity?: MessageSeverity; } declare type IMessages = IMessage[]; interface IMetadata extends IHydraMember { entity: string; sourceFields: string[]; } interface IGraphqlProductPosition { getPositionsCategoryProductMerchandising: { result: string; }; } interface IProductPosition { productId: string; position: number; } declare type IProductPositions = IProductPosition[]; interface IRuleEngineGraphqlFilters extends IHydraMember, IJsonldContext { graphQlFilters: Record<string, unknown>; } interface ISourceFieldLabel extends IHydraLabelMember { sourceField: string; } interface ISourceFieldOption extends IJsonldContext, IHydraMember { code: string | number; defaultLabel: string; sourceField: string; position: number; labels: IHydraLabelMember[]; } interface ISourceFieldOptionLabel extends IHydraLabelMember { sourceFieldOption: Pick<ISourceFieldOption, '@id' | '@type' | 'code'>; } interface ISourceField extends IHydraMember { code: string; defaultLabel?: string; filterable?: boolean; labels?: string[]; metadata?: string; options?: string[]; searchable?: boolean; sortable?: boolean; spellchecked?: boolean; system?: boolean; type?: string; usedForRules?: boolean; weight?: number; } interface ISynonymTerm { '@id'?: string; '@type'?: string; term: string; } interface ISynonym { '@id'?: string; '@type'?: string; terms: ISynonymTerm[]; } declare type ISynonyms = ISynonym[]; interface ITabContentProps { active?: boolean; } interface ITab<P = ITabContentProps> { Component: FunctionComponent<P>; componentProps?: Omit<P, 'active'>; id: number; label: string; } interface IRouterTab extends ITab { actions?: JSX.Element; default?: true; url: string; } interface IOptionsTags { id: string; value: string; label: string; } interface ISearchLimitations { '@id'?: string; '@type'?: string; operator: string; queryText: string | null; } declare type ITransformedLimitations = Record<string, string[]>; interface ITextFieldTagsForm { disabled?: boolean; disabledValue?: string; error?: boolean; fullWidth?: boolean; infoTooltip?: string; helperText?: string; helperIcon?: string; label?: string; margin?: 'none' | 'dense' | 'normal'; required?: boolean; size?: 'small' | 'medium' | undefined; placeholder?: string; options: IOptionsTags[]; } declare enum LimitationType { SEARCH = "search", CATEGORY = "category" } interface ILimitationsTypes { label: string; id?: string; value: string; labelAll: string; } interface IRequestTypesOptions { label: string; previewLabel: string; limitationType: string; id: string; value: string; } interface IRequestTypes { '@id'?: string; '@type'?: string; requestType: string; applyToAll: boolean; } interface ICategoryLimitations { '@id'?: string; '@type'?: string; category: string; } interface IRequestType { requestTypes: IRequestTypes[]; categoryLimitations: ICategoryLimitations[]; searchLimitations: ISearchLimitations[]; createdAt?: string; updatedAt?: string; } declare enum Role { ADMIN = "ROLE_ADMIN", CONTRIBUTOR = "ROLE_CONTRIBUTOR" } interface IUser { exp: number; iat: number; roles: Role[]; username: string; } interface IPreviewProduct { id: string | number; image: string; name: string; price: IPrice[]; stock: IStock; score: IScore | number; effect?: -1 | 0 | 1; } interface IPreviewBoostingProducts { resultsBefore: IPreviewProduct[]; resultsAfter: IPreviewProduct[]; } interface IGraphQLPagination { totalItems: number; lastPage: number; itemsPerPage: number; } interface IGraphqlPreviewBoost { previewBoost: { id: string; } & IPreviewBoostingProducts & IGraphQLPagination; } declare const reorderingColumnWidth = 48; declare const selectionColumnWidth = 80; declare const stickyColunWidth = 180; declare const productTableheader: ITableHeader[]; declare const defaultRowsPerPageOptions: number[]; declare const imageIconLabels: { "push-pin": string; }; declare const getPreviewBoost = "query preview($localizedCatalog: String!, $search: String) {\n previewBoost(\n localizedCatalog: $localizedCatalog\n requestType: product_search\n search: $search\n ) {\n id,\n resultsBefore,\n resultsAfter\n }\n }"; declare function getPreviewBoostQuery(): string; declare function getSearchProductsQuery(filter?: IProductFieldFilterInput | IProductFieldFilterInput[], withAggregations?: boolean): string; declare function getSearchPreviewProductsQuery(filter?: IProductFieldFilterInput | IProductFieldFilterInput[], withAggregations?: boolean): string; declare function getSearchCategoryQueryContent(filter?: IDocumentFieldFilterInput | IDocumentFieldFilterInput[], withAggregations?: boolean): IGraphqlQueryContent; declare function getSearchDocumentsQuery(entityType: string, filter?: IDocumentFieldFilterInput | IDocumentFieldFilterInput[], withAggregations?: boolean): string; declare function getVectorSearchDocumentsQuery(entityType: string, filter?: IDocumentFieldFilterInput | IDocumentFieldFilterInput[], withAggregations?: boolean): string; declare function getSearchDocumentQueryContent(filter?: IDocumentFieldFilterInput | IDocumentFieldFilterInput[], withAggregations?: boolean, variablePrefix?: string, collectionEntityType?: string): IGraphqlQueryContent; declare function getAutoCompleteSearchQuery(productFilter?: IProductFieldFilterInput | IProductFieldFilterInput[], categoryFilter?: IDocumentFieldFilterInput | IDocumentFieldFilterInput[], withAggregations?: boolean): string; declare function getMoreFacetOptionsQuery(filter?: IDocumentFieldFilterInput | IDocumentFieldFilterInput[]): string; declare function getMoreFacetProductOptionsQuery(filter?: IProductFieldFilterInput | IProductFieldFilterInput[]): string; declare const getProductPosition = "query getPosition( $categoryId: String!, $localizedCatalogId : Int! ) {\n getPositionsCategoryProductMerchandising(categoryId: $categoryId, localizedCatalogId : $localizedCatalogId ) {\n result\n }\n}\n"; declare const savePositions = "mutation savePositionsCategoryProductMerchandising( $categoryId: String!, $savePositionsCategory : String! ){\n savePositionsCategoryProductMerchandising (\n input: {\n categoryId: $categoryId\n positions: $savePositionsCategory\n }\n )\n {categoryProductMerchandising {result}}\n}\n"; declare function getSearchExplainProductsQuery(filter?: IProductFieldFilterInput | IProductFieldFilterInput[], withAggregations?: boolean): string; declare const booleanRegexp: RegExp; declare const headerRegexp: RegExp; declare const productEntityType = "product"; declare const emptyCombinationRule: IRuleCombination; declare const emptyAttributeRule: IRuleAttribute; declare const ruleValueNumberTypes: RuleValueType[]; declare const ruleArrayValueSeparator = ","; declare const buttonEnterKeyframe: _emotion_serialize.Keyframes; declare const theme: _mui_material_styles.Theme; declare const rangeSeparator = "-"; declare const tokenStorageKey = "gallyToken"; declare const schemaContext: React.Context<IApi>; declare function useSchemaLoader(): IFetch<IApi>; declare const fieldDropdown: IField; declare const fieldDropdownWithContext: IField; declare const fieldWithContextAndMainContext: IField; declare const fieldDropdownWithApiOptions: IField; declare const resources: IResource[]; declare const resourceWithRef: IResource; declare const resource: IResource; declare const fieldString: IField; declare const fieldBoolean: IField; declare const fieldInteger: IField; declare const fieldRef: IField; declare const api: IApi; declare const expandedEntrypoint: IExpandedEntrypoint; declare const expandedDocs: IExpandedDocsJsonld; declare const expandedDocsEntrypoint: IExpandedHydraSupportedClass; declare const expandedProperty: IExpandedHydraProperty; declare const expandedRange: [IJsonldId] | [IJsonldId, IJsonldRange]; declare const complexRule: { type: string; operator: string; value: string; children: { type: string; operator: string; value: string; children: ({ type: string; field: string; operator: string; attribute_type: string; value: string; children?: undefined; } | { type: string; operator: string; value: string; children: { type: string; field: string; operator: string; attribute_type: string; value: string; }[]; field?: undefined; attribute_type?: undefined; })[]; }[]; }; declare const attributeRule: IRuleAttribute; declare const combinationRule: IRuleCombination; declare function getSlugArray(data: string[] | string): string[]; declare function findBreadcrumbLabel(findIndex: number, slug: string[], menu: IMenuChild[], deepIndex?: number): string; declare function isVirtualCategoryEnabled(bundles: Bundle[]): boolean; declare function getDefaultCatalog(catalogsData: ICatalog[]): ICatalog | null; declare function getDefaultLocalizedCatalog(catalogsData: ICatalog[]): ILocalizedCatalog; declare function getLocalizedCatalog(catalogsData: ICatalog[], catalog?: ICatalog, localizedCatalog?: ILocalizedCatalog): ILocalizedCatalog; declare function getLocalizedCatalogFromCatalogs(catalogs: ICatalog[], localizedCatalogId: string | number): ILocalizedCatalog | undefined; declare function flatTree(tree: ITreeItem[], flat: ITreeItem[]): void; declare function getCategoryPathLabel(path: string[], categories: ICategory[], separator?: string): string; declare function isGraphQLValidVariables(variables: IExplainVariables, limitationType: string): boolean; declare function cleanExplainGraphQLVariables(variables: IExplainVariables, limitationType: string): IExplainVariables; declare function normalizeUrl(url?: string): string; declare function fetchJson<T extends object>(url: string, options?: RequestInit): Promise<{ json: T; response: Response; }>; declare enum IMainContext { GRID = "grid", FORM = "form" } declare function updatePropertiesAccordingToPath(field: IField, path: string, mainContext: IMainContext): IField; declare function hasFieldOptions(field: IField): boolean; declare function isDropdownStaticOptions(options: IDropdownStaticOptions | IDropdownApiOptions): options is IDropdownStaticOptions; /** * Allows to return a state based on conditions dependent on another field. * The field [field name] depends on the condition [condition] to be [type]. */ declare function getFieldState(entity?: Record<string, unknown>, depends?: IFieldDepends, state?: IFieldState): IFieldState; /** * return fieldState without the states that are not field props like "visible" */ declare function getPropsFromFieldState(entity?: Record<string, unknown>, depends?: IFieldDepends, state?: IFieldState): Omit<IFieldState, 'visible'>; declare function isFieldConfigFormWithFieldset(fieldConfig: IFieldConfig | IFieldConfigFormWithFieldset): fieldConfig is IFieldConfigFormWithFieldset; declare function getFormValidityError(validity: ValidityState): string; declare function getRequestTypeErrorMessages(data: IRequestType, api: IRequestTypesOptions[], t: TFunction): string[]; declare function isRequestTypeValid(data: IRequestType, api: IRequestTypesOptions[], t: TFunction): boolean; declare function getSynonymsErrorMessages(synonyms: ISynonyms): string[]; declare function areSynonymsValid(synonyms: ISynonyms): boolean; declare function getExpansionsErrorMessages(expansions: IExpansions): string[]; declare function areExpansionsValid(expansions: IExpansions): boolean; declare function firstLetterUppercase(item: string): string; declare function firstLetterLowercase(item: string): string; declare function getNameFromDefault(name: string): string; declare function humanize(label: string): string; declare function getHeadTitle(title: string): string; declare function joinUrlPath(...parts: string[]): string; declare function isObjectEmpty(obj: Record<string, unknown>): boolean; declare function addPrefixKeyObject(obj: object, prefix: string): object; declare function concatenateValuesWithLineBreaks(global: string[]): string; declare function getFieldLabelTranslationArgs(source: string, resource?: string): [string, string]; declare function formatPrice(price: number, currency: string, countryCode: string): string; declare function removeFirstCharIfExist(word: string, name?: string): string | null; declare function getIdFromIri(iri: string): string; declare function getIri(api: string, id: string | number): string; declare function roundNumber(value: number, decimal: number, forceDecimalDisplay?: boolean): number | string; declare function getDisplayName<P>(Cmp: FunctionComponent<P>): string; declare class HydraError extends Error { error: IHydraError; constructor(error: IHydraError); } declare function isJSonldType<T extends object>(json: T | IJsonldType): json is IJsonldType; declare function isHydraError<T extends IJsonldType>(json: T | IHydraError): json is IHydraError; declare function getResource(api: IApi, resourceName: string): IResource; declare function getFieldName(property: string): string; declare function getField(resource: IResource, name: string): IField; declare function getFieldType(field: IField): string; declare function isReferenceField(field: IField): boolean; declare function getReferencedResource(api: IApi, field: IField): IResource; declare function getOptionsFromResource<T extends IHydraMember>(response: IHydraResponse<T>): IOptions<string | number>; declare function getOptionsFromLabelResource<T extends IHydraLabelMember>(response: IHydraResponse<T>): IOptions<string | number>; declare function getOptionsFromOptionResource(optionLabelsResponse: IHydraResponse<ISourceFieldOption>, localizedCatalogId?: number): IOptions<string | number>; declare function getOptionsFromOptionLabelResource(optionLabelsResponse: IHydraResponse<ISourceFieldOptionLabel>): IOptions<string | number>; declare function getOptionsFromApiSchema(response: IHydraResponse<IApiSchemaOptions>): IOptions<string | number>; declare function castFieldParameter(field: IField, value: string | string[]): string | number | boolean | (string | number | boolean)[]; declare function isFieldValueValid(field: IField, value: unknown): boolean; declare function getFilterParameters(resource: IResource, parameters: ISearchParameters): ISearchParameters; declare function inputInitializer(input: string): unknown; declare function valueInitializer(type: string, input?: string): unknown; declare function initResourceData(resource: IResource): Record<strin