/** * @license * Copyright 2026 Aglyn LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** * SEARCH A STOCK PHOTO LIBRARY AND CHOOSE ONE (AGL-4066): the media picker's * Stock photos tab, and the details of the photo chosen. * * Presentation only. What a search asks and where a photo goes are the * caller's: it hands in a {@link StockPhotoSearchClient} (the console binds * its route and the member's credentials) and receives the photo clicked, * which it places the way it places a library file. Every result shows its * photographer and the library it comes from, since a library's terms ask * that its results say where they are from. * * Thumbnails arrive as image bytes from the caller's server and are shown * through object URLs this component owns, so no address at the library is * ever loaded by the browser; it fetches them a few at a time, only for the * results on screen. */ /** The shapes the search offers. */ export type StockPhotoSearchOrientation = 'any' | 'horizontal' | 'vertical'; /** One result, as much of it as this shows. */ export interface StockPhotoSearchHit { /** What the caller names the photo by when it asks for its preview. */ ref: unknown; /** Unique among the results. */ sourceKey: string; width: number; height: number; photographer: string; tags: string[]; alt?: string; } /** The details panel's further facts about a result. */ export interface StockPhotoDetailsHit extends StockPhotoSearchHit { photographerUrl?: string; pageUrl: string; /** "Photo by … on …". */ credit: string; license: string; licenseUrl: string; } type Refusal = { status: 'busy' | 'unconfigured' | 'refused' | 'gone'; message: string; }; /** What the caller's client answers. */ export interface StockPhotoSearchClient { status(): Promise<{ status: 'ready'; library: { label: string; }; } | Refusal>; search(query: string, orientation: StockPhotoSearchOrientation): Promise<{ status: 'ok'; library: { label: string; }; hits: Hit[]; } | Refusal>; preview(ref: Hit['ref']): Promise; } export interface StockPhotoSearchPanelProps { client: StockPhotoSearchClient; /** Where a used photo is saved, as a sentence ends: "this site's library". */ libraryName: string; /** The longest search the library takes. */ maxQueryLength: number; /** The result currently chosen. */ selectedKey?: string | null; /** A result was clicked; `previewUrl` is its thumbnail, when it has loaded. */ onSelect: (hit: Hit, context: { previewUrl: string | null; libraryLabel: string; }) => void; } /** Results shown at first, and added by each Show more. */ export declare const STOCK_PHOTO_SEARCH_PAGE = 20; /** * The Stock photos tab: a search box, the shape, and the results. Asks the * client for its status once, on mount, so a deployment with no library, or * a member who cannot add files here, is told so before typing anything. */ export declare function StockPhotoSearchPanel(props: StockPhotoSearchPanelProps): import("react").JSX.Element; export interface StockPhotoDetailsProps { hit: StockPhotoDetailsHit; previewUrl: string | null; /** The library's name: "Pixabay". */ libraryLabel: string; /** Where using the photo saves it, as a sentence ends: "this site's library". */ libraryName: string; /** Why using it failed, said above the facts. */ error?: string | null; /** Small screens, where the details replace the results: back to them. */ onBack?: () => void; } /** * The stock photo clicked, before it is used: a larger look, who took it, * the license and where it will be saved. Nothing is copied until the * caller's confirm button is pressed. */ export declare function StockPhotoDetails(props: StockPhotoDetailsProps): import("react").JSX.Element; export {};