import { LengthUnit, Observable, SingleArgCallback } from "@configura/web-utilities"; import { DtoFeature, DtoMiscFile, DtoNote, DtoOption, DtoOptionConf, DtoPartsConstrainedOption, DtoSelectedOption } from "../CatalogueAPI.js"; import { CfgProduct, _CfgProductInternal } from "../CfgProduct.js"; import { CfgMtrlApplication } from "../material/CfgMtrlApplication.js"; import { NumericValuesSelection } from "../utilitiesNumericValues.js"; import { CfgFeature, _CfgFeatureInternal } from "./CfgFeature.js"; import { _CfgProductConfigurationInternal } from "./CfgProductConfiguration.js"; export declare type OptionChangeNotification = { freshRef: CfgOption; committed: boolean; }; export declare enum ProductConfigurationBubbleMode { /** * If this is select it will turns on all ancestors all the way up. */ BubbleSelected = "BubbleSelected", /** * Bubble to the closest CfgProduct, let it revalidate, then that will continue the bubble * after validate. */ Validate = "Validate", /** * Bubble to the closest CfgProduct, let it revalidate, then that will continue the bubble * after validate. If this is select it will turn on all ancestors all the way up. * So with this mode it is possible to select an option where its parents are not selected. */ ValidateAndBubbleSelected = "ValidateAndBubbleSelected", /** * Like ValidateAndBubbleSelected, but SyncGroups are applied after ValidateAndBubbleSelected * has been done */ ValidateAndBubbleSelectedAndApplySyncGroups = "ValidateAndBubbleSelectedAndApplySyncGroups", /** * Stop bubbling * This mode supports internal functionality and is not expected to be used by integrators. */ Stop = "Stop", /** * Bubble to the next level up the tree. In features-options the next level is considered * the next feature, so option levels are skipped over. The node we call from notifies its * parent, and the parent switches out the reference to the node. Then bubbling stops. * This mode supports internal functionality and is not expected to be used by integrators. */ OneLevel = "OneLevel", /** * Bubble to the closest CfgProduct without doing any validation * This mode supports internal functionality and is not expected to be used by integrators. */ ToParentProduct = "ToParentProduct", /** * Bubble to the root CfgProduct * This mode supports internal functionality and is not expected to be used by integrators. */ ToRoot = "ToRoot" } /** * This class is only meant to be used through CfgOption. It should never be instantiated on its * own. Normally the internal state of this class should never be directly modified. CfgOption is * the class that should be used and interacted with. */ export declare class _CfgOptionInternal { readonly rawOption: DtoOption; private readonly rawFeatures; readonly parent: _CfgFeatureInternal; readonly parentConfiguration: _CfgProductConfigurationInternal; readonly parentProduct: _CfgProductInternal; readonly rootProduct: _CfgProductInternal; constructor(rawOption: DtoOption, rawFeatures: DtoFeature[], siblingHasDuplicateDescription: boolean, parent: _CfgFeatureInternal, parentConfiguration: _CfgProductConfigurationInternal, parentProduct: _CfgProductInternal, rootProduct: _CfgProductInternal); private _features; private _mtrlApplications; readonly key: string; private _upcharge; private _numericValue; readonly allowedNumericValues: NumericValuesSelection | undefined; isAllowedNumericValue(val: number): boolean; readonly changeObservable: Observable; get code(): string; get notes(): DtoNote[]; get miscFiles(): DtoMiscFile[]; get isUseNumericValue(): boolean; get numericValue(): number | undefined; setNumericValue(val: number, doSelectOption: boolean): Promise; get unit(): LengthUnit; get description(): string; get selected(): boolean; get disabled(): boolean; /** * An option is unresolvable when it is constrained from any possible value. */ get unresolvable(): boolean; get selectedChangeInProgress(): boolean; get ancestorsSelected(): boolean; get mtrlApplications(): CfgMtrlApplication[]; get thumbnail(): string | undefined; private _calculateUpcharge; get upcharge(): number; get priceChangeAtSelectChange(): number; /** * Get the child features that are contained within this option. * * Safe to call outside of the sync process, but may not contain any * children until the sync process is complete. */ getFeaturesOutsideSync(): CfgFeature[]; /** * Get the child features that are contained within this option. * * ONLY ACCESS THIS PROPERTY UNDER THESE CONDITIONS: * 1. The product is undergoing the sync group sync process. * 2. AND you are operating on the new "target" product. * * Explanation: This method will generate all children if they have not been * generated yet, which breaks sync group syncing, due to the presence of * these children being used to determine if the sync should happen at all. */ get features(): CfgFeature[]; /** Called by child to tell its parent that it has changed. */ _childHasChanged: (freshRef: CfgFeature, bubbleMode: ProductConfigurationBubbleMode, committed: boolean) => Promise; getDtoConf: (includeExtendedData: boolean) => DtoOptionConf; setApiSelection: (apiOptionSelection: DtoSelectedOption | undefined, apiOptionConstraint: DtoPartsConstrainedOption | undefined) => Promise; getApiConstrained: (constrOptions: CfgOption[]) => DtoPartsConstrainedOption; structureCompare: (other: _CfgOptionInternal, strictOrder?: boolean, descriptionMatch?: boolean) => boolean; tryMatchSelection: (other: CfgOption, descriptionMatch?: boolean) => Promise; keyMatch: (other: _CfgOptionInternal, descriptionMatch?: boolean) => boolean; _getFeaturesWithCode: (code: string) => _CfgFeatureInternal[]; } export declare class CfgOption { readonly _internal: _CfgOptionInternal; static make(rawOption: DtoOption, rawFeatures: DtoFeature[], siblingHasDuplicateDescription: boolean, parent: _CfgFeatureInternal, parentConfiguration: _CfgProductConfigurationInternal, parentProduct: _CfgProductInternal, rootProduct: _CfgProductInternal): CfgOption; /** * Makes an object wrapping the passed object. This is not a clone method, * it is a method to make a new outer reference. Like a shallow copy. * We use this to help frameworks that are build around using equals to detect change. */ static _makeNewRefFrom(internal: _CfgOptionInternal): CfgOption; /** * Private constructor and make-method because make new ref requires the constructor to * take an internal and we don't want those who instantiate CfgOption to have to be aware * of the internal. */ private constructor(); isBackedBySame: (other: CfgOption) => boolean; get parentProduct(): CfgProduct; get parent(): CfgFeature; get rootProduct(): CfgProduct; get rawOption(): DtoOption; get key(): string; get code(): string; get notes(): DtoNote[]; get miscFiles(): DtoMiscFile[]; get isUseNumericValue(): boolean; get numericValue(): number | undefined; setNumericValue: (val: number, doSelectOption: boolean) => Promise; get allowedNumericValues(): NumericValuesSelection | undefined; isAllowedNumericValue: (val: number) => boolean; get unit(): LengthUnit; get description(): string; get selected(): boolean; get disabled(): boolean; /** * An option is unresolvable when it is constrained from any possible value. */ get unresolvable(): boolean; /** * Selection state is in progress to be changed. This can be used in GUI * to display the state as transitioning, or as already changed. * If selectedChangeInProgress and: * selected is true, it means that this is about to get unselected * selected is false, it means that this is about to get selected */ get selectedChangeInProgress(): boolean; /** Are all ancestors up to the CfgProductConfiguration selected? Includes self. */ get ancestorsSelected(): boolean; /** * Selects this Option. * Only Options belonging to Features that are "select many" can be deselected. * Calling this will cause a validation call to the server. */ setSelected: (on: boolean) => Promise; get thumbnail(): string | undefined; get upcharge(): number; get priceChangeAtSelectChange(): number; /** * Get the child features that are contained within this option. * * Safe to call outside of the sync process, but may not contain any * children until the sync process is complete. */ getFeaturesOutsideSync(): CfgFeature[]; /** * Get the child features that are contained within this option. * * ONLY ACCESS THIS PROPERTY UNDER THESE CONDITIONS: * 1. The product is undergoing the sync group sync process. * 2. AND you are operating on the new "target" product. * * Explanation: This method will generate all children if they have not been * generated yet, which breaks sync group syncing, due to the presence of * these children being used to determine if the sync should happen at all. */ get features(): CfgFeature[]; listenForChange: (l: SingleArgCallback) => void; stopListenForChange: (l: SingleArgCallback) => void; } //# sourceMappingURL=CfgOption.d.ts.map