/** * Copyright (c) 2025-present, Goldman Sachs * * 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. */ import { type GeneratorFn, type LegendUser, ActionState } from '@finos/legend-shared'; import type { LegendMarketplaceBaseStore } from '../LegendMarketplaceBaseStore.js'; import { type OrderSearchStatus, type TerminalProductOrder } from '@finos/legend-server-marketplace'; export declare enum OrderTab { OPEN = "open", CLOSED = "closed" } /** * Input to `OrdersStore.searchOrders`, gathered from the advanced search form. * * `orderId` is mutually exclusive with the other fields (enforced in the UI * via separate search-mode tabs): when supplied, it is sent as the `order_id` * filter on its own, without `orderedBy`/`orderedFor`/`status`/`lastDays`. */ export interface OrderSearchFormValues { orderId: string | undefined; orderedBy: LegendUser | undefined; orderedFor: LegendUser | undefined; status: OrderSearchStatus; lastDays: number | undefined; } /** A snapshot of the last-applied advanced search filters, kept for rendering the filter summary bar. */ export interface AppliedOrderSearchFilters { orderId: string | undefined; orderedByLabel: string | undefined; orderedForLabel: string | undefined; status: OrderSearchStatus; lastDays: number; isLastDaysDefaulted: boolean; } export declare class OrdersStore { readonly baseStore: LegendMarketplaceBaseStore; openOrders: TerminalProductOrder[]; closedOrders: TerminalProductOrder[]; totalOpen: number; totalClosed: number; readonly fetchOpenOrdersState: ActionState; readonly fetchClosedOrdersState: ActionState; readonly cancelOrderState: ActionState; selectedTab: OrderTab; searchResults: TerminalProductOrder[]; searchTotalCount: number; appliedSearchFilters: AppliedOrderSearchFilters | undefined; readonly searchOrdersState: ActionState; searchOffset: number; searchPageSize: number; private lastSearchFormValues; constructor(baseStore: LegendMarketplaceBaseStore); setSelectedTab(tab: OrderTab): void; get isAdvancedSearchActive(): boolean; get hasPreviousSearchPage(): boolean; /** * Heuristic per the search API's documented pagination contract: a page * returning fewer orders than the requested page size means there are no * more results; a full page means there *might* be a next page (the next * fetch may come back empty, which is an accepted/expected edge case). */ get hasNextSearchPage(): boolean; /** 1-based page number implied by the current offset/page-size, for the "Page X of N" pagination label. */ get searchCurrentPage(): number; get currentOrders(): TerminalProductOrder[]; get currentFetchState(): ActionState; fetchOpenOrders(): GeneratorFn; fetchClosedOrders(): GeneratorFn; refreshCurrentOrders(): GeneratorFn; cancelOrder(orderId: string, processInstanceId: string, comments?: string): GeneratorFn; searchOrders(filters: OrderSearchFormValues, offset?: number): GeneratorFn; /** Re-issues the last submitted advanced search at a different offset (Previous/Next page navigation). */ goToSearchOffset(offset: number): GeneratorFn; /** Changes the advanced search page size and, if a search is active, re-fetches from the first page. */ setSearchPageSize(pageSize: number): GeneratorFn; clearSearch(): void; } //# sourceMappingURL=OrderStore.d.ts.map