import { Theme } from '../style/Theming'; import { File, VideoPreset } from '../select/file.type'; import { AssetFilterJson } from '../filter/assetFilter.type'; import { AssetType } from '../views/asset/asset.type'; export type AdditionalInfo = { selectedFile?: File; }; interface OnSuccessAssetMetapropertyOption { name: string; displayLabel: string; } interface OnSuccessAssetMetaproperty { name: string; type: string; options: OnSuccessAssetMetapropertyOption[]; } interface OnSuccessAssetTextMetaproperty { name: string; value: string; label?: string; } interface OnSuccessAssetDerivatives { thumbnail?: string; webImage?: string; } interface OnSuccessAssetStreamingLinks { hls?: string; dash?: string; embedCode?: string; } /** * Asset returned to `onSuccess`. Field set reflects the default GraphQL * selection (see `defaultAssetFieldSelection` in `src/api/getAsset.ts`). * * If a custom `assetFieldSelection` is provided, fields not in the selection * will be `undefined` at runtime, and fields not declared on this type will * not be exposed. Cast to a custom interface to read additional fields you * requested via `assetFieldSelection`. */ export interface OnSuccessAsset { id: string; files: Record; name?: string; description?: string; databaseId?: string; createdAt?: string; originalUrl?: string; publishedAt?: string; tags?: string[]; type?: AssetType; updatedAt?: string; url?: string; extensions?: string[]; metaproperties?: { nodes: OnSuccessAssetMetaproperty[]; }; textMetaproperties?: OnSuccessAssetTextMetaproperty[]; derivatives?: OnSuccessAssetDerivatives; previewUrls?: string[]; streamingLinks?: OnSuccessAssetStreamingLinks; videoPresets?: VideoPreset[]; } export type OnSuccessCallback = (assets: OnSuccessAsset[], additionalInfo: AdditionalInfo) => void; export type SelectionMode = 'SingleSelect' | 'SingleSelectFile' | 'MultiSelect'; export interface PortalConfig { url: string; editable?: boolean; } /** * When starting the app or tests a .guard.ts file will be generated. This file * will contain a method which is able to validate if a variable is consistent * with the Config type. */ /** @see {validateConfig} ts-auto-guard:type-guard */ export interface Config { assetFieldSelection?: string; assetFilter?: AssetFilterJson; assetTypes?: AssetType[]; container?: HTMLElement; language?: string; onSuccess?: OnSuccessCallback; defaultImageDerivativeName?: string; defaultVideoDerivativeName?: string; mode?: SelectionMode; portal?: PortalConfig; defaultSearchTerm?: string; theme?: Theme; hideExternalAccess?: boolean; selectedAssets?: string[]; authentication?: { getAccessToken: () => string; hideLogout?: boolean; }; onLogout?: () => void; onClose?: () => void; hideLimitedUse?: boolean; isPersonal?: boolean; modalStyles?: { [key: string]: string; }; hideSwitch?: boolean; __shouldAddOriginal__?: boolean; noCache?: boolean; selectAllOption?: boolean; enableDASH?: boolean; embedType?: 'script' | 'iframe'; resetStoreOnMount?: boolean; enableDATPermissionManagement?: boolean; } export {};