@finos/legend-application-marketplace
Version:
Legend Marketplace application core
71 lines • 3.09 kB
TypeScript
/**
* Copyright (c) 2026-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 { TraderProfileItem } from '@finos/legend-server-marketplace';
export declare enum OrderProfileLabel {
CHIP_LABEL = "Order Profile",
ALREADY_HAVE_ACCESS = "Already have access",
ADD_TO_CART = "Add to cart",
IN_CART = "In Cart",
ADDING = "Adding...",
SELECT_TERMINAL_TITLE = "Select Terminal",
SELECT_TERMINAL_DESCRIPTION = "All Add-Ons will be added automatically after the terminal is confirmed.",
CANCEL = "Cancel",
CLOSE = "Close",
OWNED_SUFFIX = "(Owned)",
IN_CART_SUFFIX = "(In Cart)",
MODEL_PREFIX = "Model: ",
PRICE_TOTAL_SEPARATOR = " \u00B7 Total: ",
VIEW_DETAILS = "View details"
}
export declare enum OrderProfileTableHeader {
PRODUCT_NAME = "PRODUCT NAME",
PROVIDER = "PROVIDER",
CATEGORY = "CATEGORY",
COST_MONTHLY = "COST (Monthly)"
}
/**
* Returns a stable random product image URL for a given asset base URL.
* Intended to be called once inside a `useState` initialiser so the image
* does not change on re-renders.
*/
export declare const getRandomImageUrl: (assetUrl: string) => string;
/** Formats a price as a plain USD string, e.g. "$1,234.56". Used in detail tables. */
export declare const formatItemPrice: (price: number) => string;
/** Formats a price with a "/month" suffix for display on cards. */
export declare const formatCardPrice: (price: number) => string;
export declare const formatAddToCartSuccessMessage: (productName: string) => string;
export declare const formatAddToCartErrorMessage: (productName: string, errorMessage: string) => string;
export declare const getItemSummary: (items: TraderProfileItem[]) => {
terminalCount: number;
addOnCount: number;
};
export declare const formatProfileSummaryLine: (terminalCount: number, addOnCount: number) => string;
/**
* Calculates the total price for a multiselect order profile.
* Finds the highest-priced terminal and sums it with its associated add-ons.
* Returns `undefined` when there are no terminal items.
*/
export declare const calculateMultiselectTotalPrice: (items: TraderProfileItem[]) => number | undefined;
/**
* Groups items so that each vendor-profile (terminal) is immediately followed
* by its associated add-ons (matched by item.model). Unmatched add-ons are
* appended at the end.
*/
export declare const groupOrderProfileItems: (items: TraderProfileItem[]) => {
item: TraderProfileItem;
isSubItem: boolean;
}[];
//# sourceMappingURL=orderProfileUtils.d.ts.map