import { ComponentType, ReactNode } from 'react'; import type { ApplicationWindow } from '@commercetools-frontend/constants'; import type { TFetchLoggedInUserQuery, TFetchProjectQuery, TIdTokenUserInfo } from "../../types/generated/mc.js"; type TFetchedUser = TFetchLoggedInUserQuery['user']; type TFetchedProject = TFetchProjectQuery['project']; type TApplicationContextPermissions = { [key: string]: boolean; }; type TActionRight = { [key: string]: boolean; }; type TApplicationContextActionRights = { [key: string]: TActionRight; }; type TApplicationContextGroupedByPermission = { [key: string]: { values: string[]; } | null; }; type TApplicationContextGroupedByResourceType = { [key: string]: TApplicationContextGroupedByPermission | null; }; /** * dataFence: { * store: { * orders: { * canManageOrders: { values: ['usa', 'germany'] }, * canViewOrders: { values: ['canada'] }, * } * } * } */ type TApplicationContextDataFenceType = 'store'; type TApplicationContextDataFences = Partial>; type TApplicationContextEnvironment = ApplicationWindow['app']; type TApplicationContextUser = Pick, 'id' | 'email' | 'createdAt' | 'firstName' | 'lastName' | 'businessRole' | 'projects'> & { locale: string; timeZone: string; idTokenUserInfo?: Omit & { additionalClaims: Record; }; }; declare const Context: import("react").Context<{}>; export declare const mapUserToApplicationContextUser: (user?: TFetchedUser) => TApplicationContextUser | null; export declare const mapEnvironmentToApplicationContextEnvironment: (environment: AdditionalEnvironmentProperties & TApplicationContextEnvironment, origin?: string) => AdditionalEnvironmentProperties & { mcApiUrl: string; applicationId: string; applicationIdentifier: string; applicationName: string; entryPointUriPath: string; customViewId?: string; revision: string; env: string; location: string; cdnUrl: string; frontendHost: string; servedByProxy: boolean; ldClientSideId?: string; trackingSentry?: string; __DEVELOPMENT__?: import("@commercetools-frontend/constants").ApplicationRuntimeEnvironmentForDevelopment; }; export declare const mapProjectToApplicationContextProject: (project?: TFetchedProject) => { key: string; version: number | null | undefined; name: string; countries: string[]; currencies: string[]; languages: string[]; ownerId: string; ownerName: string; sampleDataImportDataset: string | null | undefined; isUserAdminOfCurrentProject: boolean | null | undefined; isProductionProject: boolean; productCatalogModel: import("../../types/generated/mc.js").TProductCatalogModel | null | undefined; } | null; export type TApplicationContext = { environment: AdditionalEnvironmentProperties & TApplicationContextEnvironment; user: ReturnType; project: ReturnType; permissions: TApplicationContextPermissions | null; actionRights: TApplicationContextActionRights | null; dataFences: TApplicationContextDataFences | null; dataLocale: string | null; }; export type ProviderProps = { environment: AdditionalEnvironmentProperties & TApplicationContextEnvironment; user?: TFetchedUser; project?: TFetchedProject; projectDataLocale?: string; children: ReactNode; }; type ConsumerProps = { render: (context: TApplicationContext) => ReactNode; children?: never; }; declare const ApplicationContextProvider: { (props: ProviderProps): import("@emotion/react/jsx-runtime").JSX.Element; displayName: string; }; declare const ApplicationContext: { (props: ConsumerProps): import("@emotion/react/jsx-runtime").JSX.Element; displayName: string; }; declare function withApplicationContext; }>(mapApplicationContextToProps?: (context: TApplicationContext) => MappedProps): (Component: ComponentType) => ComponentType; declare function useApplicationContextHook(): TApplicationContext; declare function useApplicationContextHook(selector: (context: TApplicationContext) => SelectedContext): SelectedContext; declare const useApplicationContext: typeof useApplicationContextHook; export { Context, ApplicationContext, ApplicationContextProvider, withApplicationContext, useApplicationContext, };