UNPKG

@websolutespa/payload-plugin-bowl

Version:

Bowl PayloadCms plugin of the BOM Repository

1,337 lines (1,238 loc) 54 kB
import { Resource } from 'i18next'; import { Endpoint, AdminView, Locale as Locale$1, Config } from 'payload/config'; import { FieldBase, Tab, UIField } from 'payload/dist/fields/config/types'; import * as payload_types from 'payload/types'; import { AccessArgs, CollectionConfig, PayloadRequest, SanitizedCollectionConfig, Field, CollectionAfterChangeHook, CollectionAfterDeleteHook, TypeWithID, BeforeDuplicate, Where, Block, GlobalConfig, FieldHook, RichTextField, RelationshipField, CheckboxField, BlockField, DateField, TextField, GroupField, UploadField, ArrayField, NumberField, SelectField, Option as Option$1, CollapsibleField, RowField, TabsField } from 'payload/types'; import * as payload_dist_admin_components_forms_FieldDescription_types from 'payload/dist/admin/components/forms/FieldDescription/types'; import * as React from 'react'; import React__default, { ReactNode } from 'react'; import * as _websolutespa_bom_core from '@websolutespa/bom-core'; import { UserWithRoles, IRoute, IEquatable, ICategory, ILocale, ICategorized, IEntity, IMarket, IMemoryStore, ILocalizable, IMedia, MenuCategoryStrategy, IPageRelation, ISchema, IMenuItem, IMenuGroup, IMenuLink, IMenuPage, IMenuRoute, IMenu } from '@websolutespa/bom-core'; import { DocumentDrawerProps } from 'payload/dist/admin/components/elements/DocumentDrawer/types'; import * as react_jsx_runtime from 'react/jsx-runtime'; import { TreeDataProvider, TreeItemIndex, TreeItem, Disposable, TreeItemRenderContext, TreeInformation } from 'react-complex-tree'; import { Props as Props$2 } from 'payload/dist/admin/components/views/collections/List/types'; import { User } from 'payload/dist/auth'; import { PaginatedDocs } from 'payload/database'; import { Response, NextFunction } from 'express'; import { RequestContext } from 'payload'; import { ContextType } from 'payload/dist/admin/components/utilities/DocumentInfo/types'; import { Props as Props$3 } from 'payload/components/views/Cell'; import { Props as Props$4 } from 'payload/components/fields/Text'; import { FieldTypes } from 'payload/dist/admin/components/forms/field-types'; declare const hasRole: (user: User, ...roles: BowlRole[]) => boolean; declare const isRole: (...roles: BowlRole[]) => (args: AccessArgs) => boolean; declare const isPageRole: (...roles: BowlRole[]) => (args: AccessArgs) => boolean | { or: ({ _status: { equals: string; exists?: undefined; }; } | { _status: { exists: boolean; equals?: undefined; }; })[]; }; declare const isAdmin: (args: AccessArgs) => boolean; declare const isSelf: (args: AccessArgs) => false | { id: { equals: any; }; }; declare const isOwn: (args: AccessArgs) => false | { 'user.id': { equals: any; }; }; declare const isAdminOrSelf: (args: AccessArgs) => boolean | { id: { equals: any; }; }; declare const isAdminOrOwn: (args: AccessArgs) => boolean | { 'user.id': { equals: any; }; }; declare const isTenant: (slug: string) => (args: AccessArgs) => false | { id: { in: string[]; }; } | { and: { or: ({ [x: string]: { in: string[]; }; } | { [x: string]: { exists: boolean; }; } | { [x: string]: { equals: string; }; } | { [x: string]: { equals: any[]; }; })[]; }[]; }; type IEndUserConsentPreference = { consentPreference: string; date: string | Date; }; type IEndUserData = Partial<UserWithRoles & { consentPreferences?: IEndUserConsentPreference[]; }>; declare const optinGet: Endpoint; declare const optoutGet: Endpoint; /** * beforeValidateActionHook: * check existing email address if createEndUser == 'user' */ declare const beforeValidateActionHook: (collectionConfig: CollectionConfig) => CollectionConfig['hooks']['beforeValidate'][number]; /** * beforeChangeActionHook: * assigning endUser id if user is logged in */ declare const beforeChangeActionHook: (collectionConfig: CollectionConfig) => CollectionConfig['hooks']['beforeChange'][number]; /** * afterChangeActionHook: * on operation create, send emails if the post data contains an emailData array */ declare const afterChangeActionHook: (collectionConfig: CollectionConfig) => CollectionConfig['hooks']['afterChange'][number]; type ICache<T = any> = { timestamp: number; data: T; }; type InMemoryCacheOptions = { duration?: number | false; }; declare class InMemoryCache<T = any> { duration: number | false; cache: Map<string, ICache<T>>; constructor(options?: InMemoryCacheOptions); private isExpired_; has(key: string): boolean; get(key: string): T; set(key: string, data: T): void; } declare function keyWithRequest(key: string, req: PayloadRequest<any>): string; type CategoryMenuProps = { collection: SanitizedCollectionConfig; }; declare const CategoryMenu: React__default.FC<CategoryMenuProps>; type CategoryTreeConflictProps = { conflicts: IRoute[][]; }; type RouteConflict = { schema: string; page: IEquatable; template: string; category: IEquatable; routes: IRoute[]; }; type CategoryTreeProps = { collection: SanitizedCollectionConfig; }; declare const CategoryTree: React__default.FC<CategoryTreeProps>; type CustomEditModalProps = DocumentDrawerProps & { filter?: (fields: Field[]) => Field[]; }; declare const CustomEditModal: React__default.FC<CustomEditModalProps>; type TreeItemData = { title: string; extra?: ReactNode; }; declare class DataTreeProvider<T extends TreeItemData> implements TreeDataProvider { private data; private onDidChangeTreeDataEmitter; private onSetData?; constructor(items: Record<TreeItemIndex, TreeItem<T>>, onSetData?: (item: TreeItem<T>, data: T) => TreeItem<T>); getTreeItem(itemId: TreeItemIndex): Promise<TreeItem>; onChangeItemChildren(itemId: TreeItemIndex, children: TreeItemIndex[]): Promise<void>; onRenameItem(item: TreeItem<T>, name: string): Promise<void>; onDidChangeTreeData(callback: (changedItemIds: TreeItemIndex[]) => void): Disposable; onItemsDidChange_(items: Record<TreeItemIndex, TreeItem<T>>): void; onItemsDidChange(callback: (items: Record<TreeItemIndex, TreeItem<T>>) => void): void; } type TreeItems<T extends TreeItemData> = Record<TreeItemIndex, TreeItem<T>>; type DataTreeItemProps<T extends TreeItemData = TreeItemData, C extends string = never> = { item: TreeItem<T>; depth: number; children: React__default.ReactNode | null; title: React__default.ReactNode; arrow: React__default.ReactNode; context: TreeItemRenderContext<C>; info: TreeInformation; }; declare function getTreeItemClassName(props: DataTreeItemProps): string; declare const DataTreeItemLi: (props: DataTreeItemProps & { interactive: ReactNode; }) => React__default.ReactElement; declare const DataTreeDragItem: (props: DataTreeItemProps) => React__default.ReactElement; declare const DataTreeRenameItem: (props: DataTreeItemProps) => React__default.ReactElement; declare const DataTreeItem: (props: DataTreeItemProps) => React__default.ReactElement; type DataTreeInstance<T extends TreeItemData> = { onSetData: (item: TreeItem<T>, data: T) => TreeItem<T>; }; type DataTreeProps<T extends TreeItemData> = { items: TreeItems<T>; rootItem?: string; treeId?: string; treeLabel?: string; onChange?: (items: TreeItems<T>) => void; onEdit?: (items: TreeItem<T>, treeId: string) => void; }; declare function DataTree_<T extends TreeItemData>(props: DataTreeProps<T>, ref: React__default.ForwardedRef<DataTreeInstance<T>>): react_jsx_runtime.JSX.Element; declare const DataTree: <T extends TreeItemData>(props: DataTreeProps<T> & { ref?: React__default.ForwardedRef<DataTreeInstance<T>>; }) => ReturnType<typeof DataTree_>; type DecoratedListProps = { props: Props$2; before?: ReactNode; after?: ReactNode; }; declare const DecoratedList: React__default.FC<DecoratedListProps>; type IImportItem = Record<string, string | number | boolean | Date>; type ImportExportListProps<T = any> = Props$2 & { parser?: (items: IImportItem[]) => T[]; }; declare const ImportExportList: React__default.FC<ImportExportListProps>; declare function importExportListWithParser<T>(parser: (items: IImportItem[]) => T[]): React__default.FC<Props$2>; declare const redirectParser: (items: IImportItem[]) => any[]; declare const ImportExportRedirectList: React__default.FC<ImportExportListProps>; declare const modalSlug = "leave-without-saving"; type LeaveWithoutSavingModalProps = { onConfirm: () => void; onCancel: () => void; }; declare const LeaveWithoutSavingModal: React__default.FC<LeaveWithoutSavingModalProps>; declare const LeaveModal: (props: { visible: boolean; }) => react_jsx_runtime.JSX.Element; type LocalizedDescriptionProps = { value?: unknown; callback: (value?: unknown) => string; }; declare const LocalizedDescription: React__default.FC<LocalizedDescriptionProps>; declare function withLocalizedDescription(callback: (value?: unknown) => string): React__default.FunctionComponent<{ path: string; value?: unknown; }>; type Props$1 = {}; declare const Publish: React__default.FC<Props$1>; type Props = {}; declare const Save: React__default.FC<Props>; declare const SaveDraft: React__default.FC; /** * afterCategoryChangeHook. */ declare const afterCategoryChangeHook: CollectionAfterChangeHook; /** * afterCategoryDeleteHook. */ declare const afterCategoryDeleteHook: CollectionAfterDeleteHook; declare const ROOT_ITEM = "_root"; type CategoryTreeItem = { title: string; conflicts: IRoute[][]; extra?: ReactNode; }; type CategoryTreeItems = TreeItems<CategoryTreeItem>; declare function getNewCategoriesFromChanges(categories: ICategory[], changes: CategoryTreeItems): { [x: string]: unknown; id: _websolutespa_bom_core.IEquatable; schema?: string; category?: _websolutespa_bom_core.IEquatable | ICategory; media?: _websolutespa_bom_core.IMedia; order?: number; slug: _websolutespa_bom_core.ILocalizable; /** * afterCategoryChangeHook. */ title: _websolutespa_bom_core.ILocalizable; isHidden?: boolean; }[]; declare function parseDepth(depth: unknown, defaultDepth?: number): number; declare function getCollectionItems<T extends TypeWithID & Record<string, unknown>>(req: PayloadRequest, slug: string, depth?: number): Promise<T[]>; declare function getCollectionItem<T extends TypeWithID & Record<string, unknown>>(req: PayloadRequest, slug: string, id: string, depth?: number): Promise<T>; declare function getGlobalItems<T extends TypeWithID & Record<string, unknown>>(req: PayloadRequest, slug: string, depth?: number): Promise<T[]>; /** * Rest api collection index get handler. */ declare const collectionIndexGet: ((slug: string) => Endpoint); /** * Rest api collection detail get handler. */ declare const collectionDetailGet: ((slug: string) => Endpoint); /** * Rest api collection bulk patch handler. */ declare const collectionBulkPatch: ((slug: string) => Endpoint); /** * Rest api collection update patch handler. * known issue: collectionUpdatePatch() does not work, needs to be fixed */ declare const collectionUpdatePatch: ((slug: string) => Endpoint); /** * Rest api collection export get handler. */ declare const collectionExportGet: ((slug: string) => Endpoint); declare enum ImportLogType { Duplicate = "duplicate", Invalid = "invalid", Required = "required", Unexpected = "unexpected", Optional = "optional" } declare const ImportLogInvalidTypes: ImportLogType[]; declare enum ImportMode { Append = "append", Replace = "replace", Update = "update" } /** * Rest api collection import post handler. */ declare const collectionImportPost: ((slug: string) => Endpoint); /** * Decorate record with static collection data. */ declare const afterCollectionReadHook: (collectionConfig: CollectionConfig) => CollectionConfig['hooks']['afterRead'][number]; /** * Enforce unique field values during duplication. */ declare const beforeDuplicateCollectionHook: BeforeDuplicate; declare function getLocale(req: PayloadRequest<any>): Promise<ILocale[]>; declare const localeGet: Endpoint; /** * Rest api menu get handler. */ declare const menuIndexGet: ((options: BowlOptions) => Endpoint); /** * Rest api menu detail get handler. */ declare const menuDetailGet: ((options: BowlOptions) => Endpoint); /** * Decorate record for Mixer when queried by market and locale. */ declare const afterMenuReadHook: (collectionConfig: CollectionConfig) => CollectionConfig['hooks']['afterRead'][number]; /** * Rest api page collection get handler. */ declare const pageIndexGet: ((slug: string) => Endpoint); /** * Rest api page collection detail get handler. */ declare const pageDetailGet: ((slug: string) => Endpoint); /** * Modify record for Mixer when queried by market and locale. */ declare const afterPageOperationHook: (collectionConfig: CollectionConfig) => CollectionConfig['hooks']['afterOperation'][number]; /** * Decorate record for Mixer when queried by market and locale. */ declare const afterPageReadHook: (collectionConfig: CollectionConfig) => CollectionConfig['hooks']['afterRead'][number]; /** * Create a record of the pages collection related to the created document. */ declare const afterPageChangeHook: CollectionAfterChangeHook<ICategorized>; /** * Delete records of the pages collection related to the deleted document. */ declare const afterPageDeleteHook: CollectionAfterDeleteHook; type IPagination = { hasNextPage: boolean; hasPrevPage: boolean; limit: number; nextPage: number | null; page: number; pagingCounter: number; prevPage: number | null; totalDocs: number; totalPages: number; }; declare function getPagination<T = IEntity>(items: T[], page?: number, limit?: number): Promise<PaginatedDocs<T>>; declare function getRoutes(req: PayloadRequest): Promise<IRoute[]>; declare function getRoute(req: PayloadRequest<any>, id: string): Promise<IRoute | null>; declare function getRouteByItemAndLocale(req: PayloadRequest<any>, item: ICategorized, localeId: string, slug: string): Promise<IRoute[]>; declare function getRouteByCategoryAndLocale(req: PayloadRequest<any>, item: ICategory, localeId: string, slug: string): Promise<IRoute[]>; declare const routeGet: Endpoint; declare const routePost: Endpoint; declare const routeChangesPost: Endpoint; declare function routePostHandler(request: PayloadRequest, response: Response, next: NextFunction): Promise<Response<any, Record<string, any>>>; declare function getEachMarketLocale(req: PayloadRequest<any>, callback: (market: IMarket, locale: ILocale, markets: IMarket[], locales: ILocale[]) => void): Promise<void>; declare function getPages(req: PayloadRequest<any>): Promise<IMemoryStore<ICategorized>>; type Option = { id: string; name: string; [key: string]: unknown; }; type KeyMapper = { [key: string]: string; }; declare const staticCollections: string[]; declare const staticCollectionLoaders: Record<string, () => Promise<Option[]>>; /** * Decorate record with static collection data. */ declare const afterStaticReadHook: (collectionConfig: CollectionConfig) => CollectionConfig['hooks']['afterRead'][number]; declare const afterReadItem: (req: PayloadRequest, collectionConfig: CollectionConfig, item: Option) => Promise<Option>; declare const afterReadItems: (req: PayloadRequest, collectionConfig: CollectionConfig, items: Option[]) => Promise<Option[]>; /** * Rest api static collection get handler. */ declare const staticIndexGet: ((collectionConfig: CollectionConfig) => Endpoint); /** * Rest api static collection detail get handler. */ declare const staticDetailGet: ((collectionConfig: CollectionConfig) => Endpoint); declare function getStaticLoader(slug: string): () => Promise<Option[]>; type FindOptions = { context?: RequestContext; currentDepth?: number; depth?: number; disableErrors?: boolean; draft?: boolean; fallbackLocale?: string; limit?: number; locale?: string; overrideAccess?: boolean; page?: number; pagination?: boolean; req?: PayloadRequest; showHiddenFields?: boolean; sort?: string; user?: any; where?: Where; }; declare function findCollection<T>(req: PayloadRequest, collection: string, findOptions?: Omit<FindOptions, 'req'>): Promise<T[]>; declare function getApiUrl(req: PayloadRequest): string; declare function getSearchUrl(req: PayloadRequest, overrideQuery?: {}): string; declare const storeGet: Endpoint; type IPage = { id: string; content: { value: string; relationTo: string; }; createdAt: Date; updatedAt: Date; }; type IPageFull = { id: string; content: { value: { id: string; slug: ILocalizable; category: string; category_index?: boolean; markets: string[]; template: string; title: ILocalizable; _status: string; createdAt: Date; updatedAt: Date; }; relationTo: string; }; createdAt: Date; updatedAt: Date; }; type IUndecoratedMenuBase = { id: IEquatable; type: string; items: IUndecoratedMenuItem[]; abstract?: string; customClass?: string; extra?: string; markets?: string[]; media?: IMedia; }; type IUndecoratedMenuCategory = Omit<IUndecoratedMenuBase, 'type'> & { type: 'category'; category: IEquatable | ICategory; maxDepth: number; strategy?: MenuCategoryStrategy; customTitle?: string; }; type IUndecoratedMenuGroup = Omit<IUndecoratedMenuBase, 'type'> & { type: 'group'; title: string; }; type IUndecoratedMenuLink = Omit<IUndecoratedMenuBase, 'type'> & { type: 'link'; title: string; href: string; target: string; }; type IUndecoratedMenuPage = Omit<IUndecoratedMenuBase, 'type'> & { type: 'page'; page: IPageRelation; customTitle?: string; }; type IUndecoratedMenuCustom = Record<string, unknown> & { id: IEquatable; type: 'custom'; blockType: string; }; type IUndecoratedMenuItem = IUndecoratedMenuCategory | IUndecoratedMenuGroup | IUndecoratedMenuLink | IUndecoratedMenuPage | IUndecoratedMenuCustom; type IUndecoratedNavItem = IUndecoratedMenuCategory | IUndecoratedMenuPage; type IUndecoratedMenu = { createdAt: Date; id: string; items: IUndecoratedMenuItem[]; markets?: string[]; updatedAt: Date; }; type MixerContext = { market?: string; locale?: string; routes?: IRoute[]; currentRoutes?: IRoute[]; categories?: ICategory[]; richText?: boolean; locales?: string[]; markets?: string[]; }; declare function getObjectParam(value: unknown): {} | undefined; declare function getNumericParam(value: unknown): number | undefined; declare function getStringParam(value: unknown): string | undefined; declare function getSubRequest(req: PayloadRequest): PayloadRequest; declare function setMixerContext(req: PayloadRequest, market: string, locale: string): Promise<MixerContext>; declare function filterRoutes(routes: IRoute[], market: string, locale: string): IRoute[]; declare function isMixerRequest(req: PayloadRequest): req is Omit<PayloadRequest, 'query'> & { query: PayloadRequest['query'] & { market: string; locale: string; }; }; declare function whereCollection<T = IEntity>(items: T[], where?: { [key: string]: any; }): Promise<T[]>; declare function sortCollection<T = IEntity>(items: T[], sort?: string): Promise<T[]>; type AfterOptHook<T extends TypeWithID = any> = (args: { collection: SanitizedCollectionConfig; doc: T; previousDoc: T; req: PayloadRequest; }) => any; type WithActionProps = (Omit<CollectionConfig, 'fields'> & { fields?: BowlField[]; views?: Record<string, AdminView>; custom?: { /** * * eg. * contacts * newsletter * registration * order guest * order logged */ createEndUser?: false | 'guest' | 'user'; afterOptin?: AfterOptHook; afterOptout?: AfterOptHook; [key: string]: unknown; }; }); type WithAction = WithActionProps & { type: 'withAction'; }; declare const ActionDefault: Partial<CollectionConfig>; /** * @param {CollectionConfig} config * @returns {CollectionConfig} Return a `CollectionConfig`. */ declare const withAction: (config: WithActionProps) => CollectionConfig; type WithAddressProps = (Omit<CollectionConfig, 'fields'> & { fields: BowlField[]; views?: Record<string, AdminView>; }); type WithAddress = WithAddressProps & { type: 'withAddress'; }; declare const AddressDefault: Partial<CollectionConfig>; /** * * @param {WithAddressProps} config * @returns {CollectionConfig} Return a `CollectionConfig` with inherited fields: `id`, `createdAt`, `updatedAt`. */ declare const withAddress: (config: WithAddressProps) => CollectionConfig; type WithBlockProps = (Omit<Block, 'fields'> & { fields: BowlField[]; }); type WithBlock = WithBlockProps & { type: 'withBlock'; }; declare const BlockDefaults: Partial<Block>; /** * * @param {Block} config * @returns {Block} Return a `Block` with inherited fields: `id`, `createdAt`, `updatedAt`. */ declare const withBlock: (options: BowlBlock) => Block; type WithCollectionProps = (Omit<CollectionConfig, 'fields'> & { fields: BowlField[]; views?: Record<string, AdminView>; }); type WithCollection = WithCollectionProps & { type: 'withCollection'; }; declare const CollectionDefault: Partial<CollectionConfig>; /** * * @param {CollectionConfig} config * @returns {CollectionConfig} Return a `CollectionConfig` with inherited fields: `id`, `createdAt`, `updatedAt`. */ declare const withCollection: (config: WithCollectionProps) => CollectionConfig; type WithEndUserProps = (Omit<CollectionConfig, 'fields'> & { fields?: BowlField[]; views?: Record<string, AdminView>; }); type WithEndUser = WithEndUserProps & { type: 'withEndUser'; }; declare const EndUserDefault: Partial<CollectionConfig>; declare const endUserForgotPost: ((slug: string) => Endpoint); declare const endUserResetPost: ((slug: string) => Endpoint); declare const endUserPasswordPost: ((slug: string) => Endpoint); declare const endUserExistPost: ((slug: string) => Endpoint); declare const withEndUser: (config: WithEndUserProps) => CollectionConfig; type WithGlobalProps = (Omit<GlobalConfig, 'fields'> & { fields: BowlField[]; views?: Record<string, AdminView>; }); type WithGlobal = WithGlobalProps & { type: 'withGlobal'; }; declare const GlobalDefault: Partial<GlobalConfig>; /** * * @param {GlobalConfig} config * @returns {GlobalConfig} Return a `GlobalConfig` with inherited fields: `id`, `createdAt`, `updatedAt`. */ declare const withGlobal: (config: WithGlobalProps) => GlobalConfig; type WithMenuProps = (Omit<CollectionConfig, 'fields'> & { fields: BowlField[]; views?: Record<string, AdminView>; }); type WithMenu = WithMenuProps & { type: 'withMenu'; }; declare const withMenu: (config: WithMenuProps) => CollectionConfig; type WithPageProps = (Omit<CollectionConfig, 'fields'> & { fields: BowlField[]; views?: Record<string, AdminView>; }); type WithPage = WithPageProps & { type: 'withPage'; }; declare const PageDefault: Partial<CollectionConfig>; /** * * @param {CollectionConfig} config * @returns {CollectionConfig} Return a `CollectionConfig` with inherited fields: `id`, `title`, `slug`, `category`, `markets`, `template`, `meta`, `status`, `createdAt`, `updatedAt`. */ declare const withPage: (config: CollectionConfig) => CollectionConfig; type WithStaticProps = (Omit<CollectionConfig, 'fields'> & StaticCollectionConfig & { fields: BowlField[]; views?: Record<string, AdminView>; }); type WithStatic = WithStaticProps & { type: 'withStatic'; }; type StaticCollectionSrc = string | Option[] | ((config: CollectionConfig) => Option[]) | ((config: CollectionConfig) => Promise<Option[]>); type StaticCollectionConfig = { src: StaticCollectionSrc; map?: KeyMapper; duration?: number | false; }; declare const StaticCollectionDefault: Partial<CollectionConfig>; /** * @param {CollectionConfig & StaticCollectionConfig} config * @returns {CollectionConfig} Return a `CollectionConfig` from static or remote dataset. */ declare const withStaticCollection: ({ src, map, duration, ...config }: WithStaticProps) => CollectionConfig; type WithUserProps = (Omit<CollectionConfig, 'fields'> & { fields?: BowlField[]; views?: Record<string, AdminView>; }); type WithUser = WithUserProps & { type: 'withUser'; }; declare const UserDefault: Partial<CollectionConfig>; declare const withUser: (config: WithUserProps) => CollectionConfig; declare function decorateCategory_<T extends ICategorized = ICategorized>(item: T, slug: string, context: MixerContext): Promise<T | T & { category: ICategory; }>; declare function decorateCategories_<T extends ICategorized = ICategorized>(items: T[], slug: string, context: MixerContext): Promise<(T | T & { category: ICategory; })[]>; declare function decorateHref_<T extends ISchema = ISchema>(item: T, slug: string, context: MixerContext): Promise<T & { href: string | null; }>; declare function decorateHrefs_<T extends ISchema = ISchema>(items: T[], slug: string, context: MixerContext): Promise<(T & { href: string | null; })[]>; declare function localizeItem<T = IEntity>(item: T, localizedFields: string[], locale: string): Promise<T>; declare function localizeCollection<T = IEntity>(items: T[], localizedFields: string[], locale?: string): Promise<T[]>; declare const MAX_INT = 1000000000000; declare function decorateMenuCategory_(item: IUndecoratedMenuCategory, categories: ICategory[], routes: IRoute[], market: string, depth?: number): IMenuItem | undefined; declare function decorateMenuGroup_(item: IUndecoratedMenuGroup, categories: ICategory[], routes: IRoute[], market: string): IMenuGroup; declare function decorateMenuLink_(item: IUndecoratedMenuLink, categories: ICategory[], routes: IRoute[], market: string): IMenuLink; declare function decorateMenuPage_(item: IUndecoratedMenuPage, categories: ICategory[], routes: IRoute[], market: string): IMenuPage; declare function decorateMenuRoute_(item: IRoute): IMenuRoute; declare function decorateMenuItem_(item: IUndecoratedMenuItem, categories: ICategory[], routes: IRoute[], market: string, depth?: number): IMenuItem; declare function decorateNavItem_(item: IUndecoratedNavItem, categories: ICategory[], routes: IRoute[], market: string, depth?: number): IMenuItem | IMenuItem[]; declare function hasMarket(item: IUndecoratedMenuItem, market: string): boolean; declare function decorateMenu_(item: IUndecoratedMenu, context: MixerContext): Promise<IMenu>; declare function decorateNav_<T extends ISchema = ISchema>(item: T, slug: string, context: MixerContext): Promise<T>; declare function decorateNavs_<T extends ISchema = ISchema>(items: T[], slug: string, context: MixerContext): Promise<T[]>; declare function isUndecoratedNavItem(item: unknown): item is IUndecoratedNavItem; declare function isRelation(item: unknown): item is IRelation; type IRelation = { relationTo: string; value: IEntity | IEntity[]; }; declare function decorateSchema_<T extends ISchema = ISchema>(item: T, slug: string): Promise<T & { schema: string; }>; declare function decorateSchemas_<T extends ISchema = ISchema>(items: T[], slug: string): Promise<(T & { schema: string; })[]>; declare const encrypt: (text: string) => string; declare const decrypt: (hash: string) => string; declare const encryptField: FieldHook; declare const decryptField: FieldHook; declare const encryptData: (collectionConfig: CollectionConfig) => void; type WithAbstractProps = (Omit<RichTextField, 'type' | 'name'> & { name?: string; }); type WithAbstract = WithAbstractProps & { type: 'withAbstract'; }; declare const withAbstract: (options?: WithAbstractProps) => RichTextField; declare const withAbstractRequired: (options?: WithAbstractProps) => RichTextField; type WithCategoryProps = (Omit<RelationshipField, 'type' | 'name' | 'relationTo'> & { name?: string; }); type WithCategory = WithCategoryProps & { type: 'withCategory'; }; declare const CategoryDefaults: RelationshipField; declare const withCategory: (options?: WithCategoryProps) => RelationshipField; declare const withCategoryRequired: (options?: WithCategoryProps) => RelationshipField; type WithCheckboxProps = (Omit<CheckboxField, 'type' | 'name'> & { name?: string; }); type WithCheckbox = WithCheckboxProps & { type: 'withCheckbox'; }; declare const CheckboxDefaults: CheckboxField; declare const withCheckbox: (options?: WithCheckboxProps) => CheckboxField; declare const withCheckboxRequired: (options?: WithCheckboxProps) => CheckboxField; type WithComponentsProps = Omit<Partial<BlockField>, 'type' | 'name' | 'blocks'> & { name?: string; blocks: BowlBlock[]; }; type WithComponents = WithComponentsProps & { type: 'withComponents'; }; declare const ComponentsDefaults: BlockField; declare const withComponents: (options: WithComponentsProps) => BlockField; type WithDateProps = (Omit<DateField, 'type' | 'name'> & { name?: string; }); type WithDate = WithDateProps & { type: 'withDate'; }; declare const DateDefaults: DateField; declare const withDate: (options?: WithDateProps) => DateField; declare const withDateRequired: (options?: WithDateProps) => DateField; type WithDescriptionProps = (Omit<RichTextField, 'type' | 'name'> & { name?: string; }); type WithDescription = WithDescriptionProps & { type: 'withDescription'; }; declare const withDescription: (options?: WithDescriptionProps) => RichTextField; declare const withDescriptionRequired: (options?: WithDescriptionProps) => RichTextField; type WithIdProps = (Omit<TextField, 'type' | 'name' | 'hasMany'> & { name?: string; }); type WithId = WithIdProps & { type: 'withId'; }; declare const withId: (options?: WithIdProps) => TextField; declare const withIdRequired: (options?: WithIdProps) => TextField; type WithIsActiveProps = (Omit<CheckboxField, 'type' | 'name'> & { name?: string; }); type WithIsActive = WithIsActiveProps & { type: 'withIsActive'; }; declare const withIsActive: (options?: WithIsActiveProps) => CheckboxField; declare const withIsActiveRequired: (options?: WithIsActiveProps) => CheckboxField; type WithIsDefaultProps = (Omit<CheckboxField, 'type' | 'name'> & { name?: string; }); type WithIsDefault = WithIsDefaultProps & { type: 'withIsDefault'; }; declare const withIsDefault: (options?: WithIsDefaultProps) => CheckboxField; declare const withIsDefaultRequired: (options?: WithIsDefaultProps) => CheckboxField; type WithLinkOptions = { appearances?: string[] | false; disableLabel?: boolean; }; type WithLinkProps = Omit<GroupField, 'type' | 'name' | 'fields'> & WithLinkOptions; type WithLink = WithLinkProps & { type: 'withLink'; }; declare const appearanceOptions: { text: { label: string; value: string; }; primaryButton: { label: string; value: string; }; secondaryButton: { label: string; value: string; }; }; declare const withLink: ({ appearances, disableLabel, ...props }?: WithLinkProps) => Omit<payload_types.FieldBase, "validation" | "required"> & { admin?: { className?: string; components?: { Cell?: React.ComponentType<any>; Field?: React.ComponentType<any>; Filter?: React.ComponentType<any>; }; condition?: payload_types.Condition<any, any>; description?: payload_dist_admin_components_forms_FieldDescription_types.Description; disableBulkEdit?: boolean; disableListColumn?: boolean; disableListFilter?: boolean; disabled?: boolean; hidden?: boolean; position?: "sidebar"; readOnly?: boolean; style?: React.CSSProperties; width?: string; } & { hideGutter?: boolean; }; fields: Field[]; interfaceName?: string; type: "group"; }; type WithMarketsProps = (Omit<RelationshipField, 'type' | 'name' | 'relationTo'> & { name?: string; }); type WithMarkets = WithMarketsProps & { type: 'withMarkets'; }; declare const MarketDefaults: RelationshipField; declare const withMarkets: (options?: WithMarketsProps) => RelationshipField; declare const withMarketsRequired: (options?: WithMarketsProps) => RelationshipField; type WithMediaProps = (Omit<UploadField, 'type' | 'name' | 'relationTo'> & { name?: string; relationTo?: string; }); type WithMedia = WithMediaProps & { type: 'withMedia'; }; declare const MediaDefaults: UploadField; declare const withMedia: (options?: WithMediaProps) => UploadField; declare const withMediaRequired: (options?: WithMediaProps) => UploadField; type WithMediasProps = (Omit<ArrayField, 'type' | 'name' | 'fields'> & { name?: string; }); type WithMedias = WithMediasProps & { type: 'withMedias'; }; declare const MediasDefaults: ArrayField; declare const withMedias: (options?: WithMediasProps) => ArrayField; declare const withMediasRequired: (options?: WithMediasProps) => ArrayField; type WithNameProps = (Omit<TextField, 'type' | 'name' | 'hasMany'> & { name?: string; }); type WithName = WithNameProps & { type: 'withName'; }; declare const withName: (options?: WithNameProps) => TextField; declare const withNameRequired: (options?: WithNameProps) => TextField; type WithOrderProps = (Omit<NumberField, 'type' | 'name'> & { name?: string; slug: string; }); type WithOrder = WithOrderProps & { type: 'withOrder'; }; declare const beforeValidate: (slug: string) => FieldHook; declare const OrderDefaults: NumberField; declare const withOrder: ({ slug, ...options }: WithOrderProps) => NumberField; declare const withOrderRequired: ({ slug, ...options }: WithOrderProps) => NumberField; type WithRelatedProps = Omit<Partial<BlockField>, 'type' | 'name' | 'blocks'> & { name?: string; blocks: BowlBlock[]; }; type WithRelated = WithRelatedProps & { type: 'withRelated'; }; declare const RelatedDefaults: BlockField; declare const withRelated: (options: WithRelatedProps) => BlockField; type WithRichTextProps = (Omit<RichTextField, 'type' | 'name'> & { name?: string; }); type WithRichText = WithRichTextProps & { type: 'withRichText'; }; declare const richTextAfterReadHook: FieldBase['hooks']['afterRead'][number]; declare const RichTextDefaults: RichTextField; declare const withRichText: (options?: Partial<RichTextField>) => RichTextField; declare const withRichTextRequired: (options?: Partial<RichTextField>) => RichTextField; type WithRolesProps = (Omit<SelectField, 'type' | 'name' | 'options'> & { name?: string; roles?: BowlRole[]; }); type WithRoles = WithRolesProps & { type: 'withRoles'; }; declare const UserRolesDefaults: SelectField; declare const withRoles: ({ roles, ...fieldOptions }?: WithRolesProps) => SelectField; type WithSelectProps = (Omit<SelectField, 'type' | 'name'> & { name?: string; }); type WithSelect = WithSelectProps & { type: 'withSelect'; }; declare const SelectDefaults: SelectField; declare const withSelect: (options?: Partial<SelectField>) => SelectField; declare const withSelectRequired: (options?: Partial<SelectField>) => SelectField; type WithSlugProps = (Omit<TextField, 'type' | 'name' | 'hasMany'> & { fieldToUse: string; }); type WithSlug = WithSlugProps & { type: 'withSlug'; }; declare const withSlug: ({ fieldToUse, ...options }?: WithSlugProps) => TextField; declare const withSlugRequired: ({ fieldToUse, ...options }?: WithSlugProps) => TextField; type WithTemplateProps = (Omit<RelationshipField, 'type' | 'name' | 'relationTo'> & { slugToUse: string; }); type WithTemplate = WithTemplateProps & { type: 'withTemplate'; }; declare const TemplateDefaults: RelationshipField; declare const withTemplate: ({ slugToUse, ...options }: WithTemplateProps) => RelationshipField; declare const withTemplateRequired: ({ slugToUse, ...options }: WithTemplateProps) => RelationshipField; type WithTenantsProps = (Omit<RelationshipField, 'type' | 'name' | 'hasMany' | 'relationTo'> & { name?: string; relationTo?: string | string[]; }); type WithTenants = WithTenantsProps & { type: 'withTenants'; }; declare const TenantsDefault: RelationshipField; declare const withTenants: (srcOptions?: WithTenantsProps) => RelationshipField; type WithTextProps = (Omit<TextField, 'type' | 'name' | 'hasMany'> & { name?: string; }); type WithText = WithTextProps & { type: 'withText'; }; declare const TextDefaults: TextField; declare const withText: (options?: WithTextProps) => TextField; declare const withTextRequired: (options?: WithTextProps) => TextField; type WithTitleProps = (Omit<TextField, 'type' | 'name' | 'hasMany'> & { name?: string; }); type WithTitle = WithTitleProps & { type: 'withTitle'; }; declare const withTitle: (options?: WithTitleProps) => TextField; declare const withTitleRequired: (options?: WithTitleProps) => TextField; declare function log(...rest: unknown[]): void; declare const locales: any[]; type Locale = typeof locales[number]; type LocalizedText = { [key in Locale]?: string; }; declare function getTranslation(path: string, defaultText: string | undefined, locale: Locale, node?: { [key: string]: any; }, fullPath?: string): string; declare function getTranslations(path: string, defaultText?: string): LocalizedText; declare function slugToLabels(slug: string): { singular: LocalizedText; plural: LocalizedText; }; declare function slugToLabel(slug: string): LocalizedText; declare function translateTab(tab: Tab): Tab; declare function translateTabs(tabs: Tab[]): Tab[]; declare function translateBlock(block: Block): Block; declare function translateBlocks(blocks: Block[]): Block[]; declare function translateField(field: Field): payload_types.CollapsibleField | payload_types.RowField | payload_types.TabsField | payload_types.UIField | payload_types.ArrayField | BlockField | payload_types.CheckboxField | payload_types.CodeField | payload_types.DateField | payload_types.EmailField | payload_types.GroupField | payload_types.JSONField | payload_types.NumberField | payload_types.PointField | payload_types.RadioField | payload_types.RelationshipField | payload_types.RichTextField<any, any, {}> | payload_types.SelectField | payload_types.TextField | payload_types.TextareaField | payload_types.UploadField; declare function translateFields(fields: Field[]): Field[]; declare function translateCollection(config: CollectionConfig): CollectionConfig; declare function translateGlobal(config: GlobalConfig): GlobalConfig; declare function logMissingTranslations(): void; type PublicURL = { marketId: string; localeId: string; templateId: string; documentId: string; _status?: string; _live?: boolean; _token?: string; }; declare function getPublicURL({ marketId, localeId, ...qs }: PublicURL): string; declare function getPreviewURL(doc: Record<string, any>, locale: string, _token?: string): string; declare function getLivePreviewURL(args: { data: Record<string, any>; documentInfo: ContextType; locale: Locale$1; }): string; declare function mergeCollections(source?: (BowlCollection | BowlCollectionFunction)[], target?: (BowlCollection | BowlCollectionFunction)[]): (BowlCollection | BowlCollectionFunction)[]; declare function mergeFields(source?: Field[], target?: Field[], reverse?: boolean): Field[]; declare function mergeGlobals(source?: (BowlGlobal | BowlGlobalFunction)[], target?: (BowlGlobal | BowlGlobalFunction)[]): (BowlGlobal | BowlGlobalFunction)[]; type GroupKey = { id: string; key?: string; value?: string; }; declare function sortByGroup<T extends (CollectionConfig | GlobalConfig) = CollectionConfig | GlobalConfig>(collectionsOrGlobals: T[]): T[]; type WithAnchorProps = (Omit<GroupField, 'type' | 'name' | 'fields'> & { name?: string; }); type WithAnchor = WithAnchorProps & { type: 'withAnchor'; }; type WithSeoWeightProps = (Omit<SelectField, 'type' | 'name' | 'options'> & { name?: string; options?: Option$1[]; }); type WithSeoWeight = WithSeoWeightProps & { type: 'withSeoWeight'; }; type WithColorProps = (Omit<TextField, 'type' | 'name' | 'hasMany'> & { name?: string; }); type WithColor = WithColorProps & { type: 'withColor'; }; declare const ColorConfig: TextField; declare const withColor: (options?: WithColorProps) => TextField; declare const withColorRequired: (options?: WithColorProps) => TextField; declare const ColorCell: React__default.FC<Props$3>; declare const ColorField: React__default.FC<Props$4>; type FieldPermissions$1 = { create: { permission: boolean; }; read: { permission: boolean; }; update: { permission: boolean; }; fields?: { [field: string]: FieldPermissions$1; }; }; type DebugFieldType = FieldBase & { type: keyof FieldTypes; }; type DebugFieldProps = DebugFieldType & { path?: string; fieldTypes: FieldTypes; permissions: FieldPermissions$1; detectLoop?: boolean; }; declare const debugField: (options?: Partial<DebugFieldType>) => DebugFieldType; declare const DebugField: React__default.FC<DebugFieldProps>; type FieldPermissions = { create: { permission: boolean; }; read: { permission: boolean; }; update: { permission: boolean; }; fields?: { [field: string]: FieldPermissions; }; }; type IStatic = FieldBase & { type: keyof FieldTypes; }; type StaticProps = IStatic & { path?: string; fieldTypes: FieldTypes; permissions: FieldPermissions; }; type StaticField = UIField & {}; declare const withUIStatic: (options?: Partial<UIField>) => StaticField; declare const UIStaticCell: React__default.FC<Props$3>; declare const UIStaticField: React__default.FC<StaticProps>; type BowlTab = Omit<Tab, 'fields'> & { fields: BowlField[]; name?: string; }; type BowlArrayField = Omit<ArrayField, 'fields'> & { fields: BowlField[]; }; type BowlBlockField = Omit<BlockField, 'blocks'> & { blocks: BowlBlock[]; }; type BowlCollapsibleField = Omit<CollapsibleField, 'fields'> & { fields: BowlField[]; }; type BowlGroupField = Omit<GroupField, 'fields'> & { fields: BowlField[]; }; type BowlRowField = Omit<RowField, 'fields'> & { fields: BowlField[]; }; type BowlTabsField = Omit<TabsField, 'tabs'> & { tabs: BowlTab[]; }; type BowlField = Exclude<Field, ArrayField | BlockField | CollapsibleField | GroupField | RowField | TabsField> | BowlArrayField | BowlBlockField | BowlCollapsibleField | BowlGroupField | BowlRowField | BowlTabsField | WithAbstract | WithAnchor | WithCategory | WithCheckbox | WithColor | WithComponents | WithDate | WithDescription | WithId | WithIsActive | WithIsDefault | WithLink | WithMarkets | WithMedia | WithMedias | WithName | WithOrder | WithRelated | WithRichText | WithSelect | WithSeoWeight | WithSlug | WithTemplate | WithTenants | WithText | WithTitle | WithRoles; type BowlBlock = Block | WithBlock; type BowlCollection = WithCollection | WithPage | WithStatic | WithMenu | WithAction | WithAddress | WithUser | WithEndUser | CollectionConfig & { type?: string; views?: Record<string, AdminView>; }; type BowlGlobal = WithGlobal | GlobalConfig & { type?: string; views?: Record<string, AdminView>; }; type BowlCollectionFunction = ((options: BowlOptions) => BowlCollection); type BowlGlobalFunction = (options: BowlOptions) => BowlGlobal; type BowlConfig = (Omit<Config, 'collections' | 'globals'> & { collections?: (BowlCollection | BowlCollectionFunction)[]; globals?: (BowlGlobal | BowlGlobalFunction)[]; }); type BowlSlug = { media: string; category: string; emailConfig: string; label: string; locale: string; market: string; menu: string; redirect: string; template: string; legalNotice: string; consentPreference: string; users: string; endUsers: string; continent: string; country: string; countryZone: string; language: string; municipality: string; province: string; region: string; subContinent: string; [key: string]: string; }; type BowlGroup = { content: string; nav: string; actions: string; gdpr: string; users: string; config: string; i18n: string; [key: string]: string; }; /** * Defaults user roles and endUser roles available on the bowl plugin configuration: * * admin: user role with super powers. * contributor: user role with minor powers. * editor: user role with content editing powers. * guest: endUser role with application reading capabilities. * user: endUser authenticated role with reserved data. * */ declare const roles: { readonly Admin: "admin"; readonly Contributor: "contributor"; readonly Editor: "editor"; readonly Guest: "guest"; readonly User: "user"; }; declare const rolesUser: BowlRole[]; declare const rolesEndUser: BowlRole[]; type Values<T> = T[keyof T]; type BowlRole = Values<typeof roles> | string; type BowlOptions = { actions: string[]; bowlCollections: BowlCollection[]; bowlGlobals: BowlGlobal[]; collections: string[]; defaultLocale: string; defaultMarket: string; group: BowlGroup; locales: string[] | Locale$1[]; menu: { blocks: BowlBlock[]; }; pages: string[]; plugins: BowlPlugin[]; roles: typeof roles & Record<string, string>; rolesEndUser: BowlRole[]; rolesList: BowlRole[]; rolesUser: BowlRole[]; slug: BowlSlug; translations: Resource; users: string[]; }; type BowlInitOptions = { defaultMarket?: string; group?: Partial<BowlGroup>; menu?: { blocks: BowlBlock[]; }; slug?: Partial<BowlSlug>; plugins?: BowlPlugin[]; roles?: typeof roles & Record<string, string>; rolesUser?: BowlRole[]; rolesEndUser?: BowlRole[]; }; type BowlPlugin = (config: BowlConfig, bowlOptions: BowlInitOptions) => BowlConfig; declare const MenuItem: (pages: string[], customBlocks?: BowlBlock[], depth?: number, maxDepth?: number) => BowlBlock; declare function withComponentBlock({ slug, fields, optionsFields }: { slug: string; fields?: BowlField[]; optionsFields?: BowlField[]; }): BowlBlock; declare const bowl: (sourceOptions?: BowlInitOptions) => (sourceConfig: BowlConfig) => Config; declare function toCollection(collection: BowlCollection): CollectionConfig; declare function toGlobal(collection: BowlGlobal): GlobalConfig; declare function toField(item: BowlField): Field; declare function toBlock(item: BowlBlock): Block; declare function toTab(item: BowlTab): Tab; declare const defaultSlug: BowlSlug; declare const defaultGroup: BowlGroup; declare const defaultLocales: string[]; declare const defaultLocale: string; declare const defaultMarket: string; declare const options: BowlOptions; declare const internalSlugs: string[]; declare const Icon: React__default.FC; declare const Logo: React__default.FC; declare function webpack(sourceConfig: BowlConfig): (config: any) => any; export { ActionDefault, AddressDefault, AfterOptHook, BlockDefaults, BowlArrayField, BowlBlock, BowlBlockField, BowlCollapsibleField, BowlCollection, BowlCollectionFunction, BowlConfig, BowlField, BowlGlobal, BowlGlobalFunction, BowlGroup, BowlGroupField, BowlInitOptions, BowlOptions, BowlPlugin, BowlRole, BowlRowField, BowlSlug, BowlTab, BowlTabsField, CategoryDefaults, CategoryMenu, CategoryMenuProps, CategoryTree, CategoryTreeConflictProps, CategoryTreeItem, CategoryTreeItems, CategoryTreeProps, CheckboxDefaults, CollectionDefault, ColorCell, ColorConfig, ColorField, ComponentsDefaults, CustomEditModal, CustomEditModalProps, DataTree, DataTreeDragItem, DataTreeInstance, DataTreeItem, DataTreeItemLi, DataTreeItemProps, DataTreeProps, DataTreeProvider, DataTreeRenameItem, DateDefaults, DebugField, DecoratedList, DecoratedListProps, EndUserDefault, FindOptions, GlobalDefault, GroupKey, ICache, IEndUserConsentPreference, IEndUserData, IImportItem, IPage, IPageFull, IPagination, IRelation, IUndecoratedMenu, IUndecoratedMenuBase, IUndecoratedMenuCategory, IUndecoratedMenuCustom, IUndecoratedMenuGroup, IUndecoratedMenuItem, IUndecoratedMenuLink, IUndecoratedMenuPage, IUndecoratedNavItem, Icon, ImportExportList, ImportExportListProps, ImportExportRedirectList, ImportLogInvalidTypes, ImportLogType, ImportMode, InMemoryCache, InMemoryCacheOptions, KeyMapper, LeaveModal, LeaveWithoutSavingModal, LeaveWithoutSavingModalProps, LocalizedDescription, LocalizedDescriptionProps, Logo, MAX_INT, MarketDefaults, MediaDefaults, MediasDefaults, MenuItem, MixerContext, Option, OrderDefaults, PageDefault, PublicURL, Publish, ROOT_ITEM, RelatedDefaults, RichTextDefaults, RouteConflict, Save, SaveDraft, SelectDefaults, StaticCollectionConfig, StaticCollectionDefault, TemplateDefaults, TenantsDefault, TextDefaults, TreeItemData, TreeItems, UIStaticCell, UIStaticField, UserDefault, UserRolesDefaults, WithAbstract, WithAbstractProps, WithAction, WithActionProps, WithAddress, WithAddressProps, WithBlock, WithBlockProps, WithCategory, WithCategoryProps, WithCheckbox, WithCheckboxProps, WithCollection, WithCollectionProps, WithColor, WithColorProps, WithComponents, WithComponentsProps, WithDate, WithDateProps, WithDescription, WithDe