@finos/legend-application-marketplace
Version:
Legend Marketplace application core
76 lines • 3.33 kB
TypeScript
/**
* 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, ActionState } from '@finos/legend-shared';
import { type CartItem, type CartItemRequest, type CartSummary, type TerminalResult, type TraderProfile, type TraderProfileItem } from '@finos/legend-server-marketplace';
import type { LegendMarketplaceBaseStore } from '../LegendMarketplaceBaseStore.js';
declare enum BUSINESS_REASONS {
NEW_HIRE = "New Hire",
NEW_ROLE = "New Role",
USER_MOVE = "User Move",
TRANSFER = "Transfer",
OTHER_REASON = "Other Reason"
}
export declare class CartStore {
readonly baseStore: LegendMarketplaceBaseStore;
items: Record<number, CartItem[]>;
targetUser: string | undefined;
businessReason: string | undefined;
readonly initState: ActionState;
readonly loadingState: ActionState;
readonly submitState: ActionState;
open: boolean;
cartSummary: CartSummary;
constructor(baseStore: LegendMarketplaceBaseStore);
private get currentUser();
get cartUser(): string;
get cartItemIds(): Set<number>;
setOpen(val: boolean): void;
setTargetUser(val: string | undefined): GeneratorFn<void>;
setBusinessReason(val: string | undefined): void;
isItemInCart(itemId: number): boolean;
/**
* Returns the add-on items that depend on the given cart item.
* When a Terminal is deleted, its associated add-ons (same vendor) must also be removed.
*/
getDependentAddOns(cartId: number): CartItem[];
addToCartWithAPI(cartItemData: CartItemRequest, suppressSuccessToast?: boolean): GeneratorFn<{
success: boolean;
recommendations?: TerminalResult[];
message: string;
totalCount?: number | null;
}>;
/**
* Adds a list of order-profile items to the cart, skipping already-owned ones.
* Each item is added sequentially so that vendor-profile items can be added
* before their associated add-ons.
*/
addOrderProfileItemsToCart(items: TraderProfileItem[], suppressSuccessToast?: boolean): GeneratorFn<void>;
/**
* Returns true when all non-owned items of the profile are present in the
* cart. For multiselect profiles, at least one complete terminal bundle
* (terminal + its associated add-ons) must be fully in the cart.
*/
isOrderProfileInCart(profile: TraderProfile): boolean;
providerToCartRequest(provider: TerminalResult): CartItemRequest;
initialize(): GeneratorFn<void>;
refresh(): GeneratorFn<void>;
submitOrder(): GeneratorFn<void>;
clearCart(): GeneratorFn<void>;
deleteCartItem(cartId: number, confirmDelete?: boolean): GeneratorFn<void>;
static readonly BUSINESS_REASONS: typeof BUSINESS_REASONS;
}
export {};
//# sourceMappingURL=CartStore.d.ts.map