import { Workflow, StepAspect, Step, AnyStepData, FrameOffsets, PatternImageData, IServerModel, Asset, MaterialResource, AssetType, ColorDefinition, IllustrationStepData, Region, ILayout, CreateElementCommand as _CreateElementCommand1, IllustrationElement as _IllustrationElement1, LayoutsState as _LayoutsState1, VariantResource, CanvasCommand, LayoutData as _LayoutData1, DigitalContentStepData, FrameStepData, FrameElement as _FrameElement1, MaterialStepData, ModelStepData, ModuleStepData, PatchworkStepData, PatchworkOffsets, PictureStepData, QuestionStepData, ShapeStepData, FontData, GroupCommand, TextboxElement as _TextboxElement1, TextStepData as _TextStepData1, StepStorage, SerializableStep, CommandState, OptionResource, CommandContext as _CommandContext1, Point, ScaleAxis, UnitOfMeasurement, StepType, CommandContext, CreateElementCommand, FontAlignmentCommand, FontColorCommand, FrameElement, generate, IllustrationElement, LayoutData, LayoutElement, LayoutElementFactory, LayoutsState, PatchworkElement, TextboxElement, TextChangeCommand, TextStepData } from "@spiffcommerce/papyrus";
import { ApolloClient } from "@apollo/client";
import { ThreeDPreviewService as _ThreeDPreviewService1, SpiffCommerce3DPreviewService, ThreeDPreviewService } from "@spiffcommerce/preview";
import { ReactNode, Dispatch, FunctionComponent, RefObject, PointerEvent, KeyboardEvent, MouseEvent } from "react";
import { ImageElement } from "canvg";
export const gatherVaryingStepAspects: (workflow: Workflow) => StepAspect[];
export interface WorkflowScene {
    name: string;
    title: string;
    renderableSteps: Step<AnyStepData>[];
    silentSteps: Step<AnyStepData>[];
}
interface WorkflowScenesConfiguration {
    bulkScene: boolean;
    bulkSceneTitle: string;
    finishScene: boolean;
    finishSceneTitle: string;
}
/**
 * A queue promise is a container for a promise that can be
 * executed at a later time.
 */
export abstract class QueueablePromise {
    readonly timestamp: number;
    abstract execute(): Promise<any>;
}
/**
 * A promise queue contains any number of QueuePromise objects. These objects are stored within a PromiseQueue and executed
 * as quickly as possible in order. This is ideal in situations where a specific operation should be
 * applied in an ordered way while still making.
 */
export class PromiseQueue<T extends QueueablePromise> {
    /**
     * Constructs a new promise queue.
     * @param queueMaxSize An optional maximum size, when the max size is hit.
     *                     The older promises will be discarded.
     */
    constructor(queueMaxSize?: number);
    /**
     * Enqueue a new promise.
     * @param promise A new promise to add to the queue.
     */
    enqueue(promise: T): Promise<void>;
    /**
     * @returns Returns true when work is being actively processed by this queue.
     */
    hasActivePromise(): boolean;
    /**
     * @returns The number of unexecuted jobs remaining in the queue. Not including the active job.
     */
    getRemainingQueueSize(): number;
    /**
     * Finalize the queue, any jobs that come in while this is in progress will result
     * in the promise being extended.
     */
    finalize(): Promise<void>;
}
export class FrameService {
    minZoomScale: number;
    maxZoomScale: number;
    constructor(forceImageCover?: boolean);
    /**
     * When we want to connect a workflow manager to the state of the image cropper we
     * can pass it to this function. Inside we'll attach any required event listeners.
     * @param workflowManager The workflow manager to attach.
     * @param stepName The specific step we want to attach to within the manager.
     */
    connectWorkflowManager(workflowManager: WorkflowManager, stepName?: string): void;
    /**
     * Sets the elements that should be update when changes are made to
     * the cropper that owns this service.
     * @param targetElements A list of element Ids to track
     */
    setTargetElements(targetElements: string[]): void;
    /**
     * Gets the current calculated frame data
     * @returns A FrameData object or undefined if no frame has been set.
     */
    getFrameData(): FrameData | undefined;
    /**
     * Sets the current frame data
     * @param path The path to lookup in our frame data cache.
     */
    setFrameData(path: string): Promise<void>;
    /**
     * Gets the currently set image of the frame..
     * @returns A PatternImageData object, or undefined if no image is set.
     */
    getImageData(): PatternImageData | undefined;
    /**
     * Gets the current calculated offsets of the pattern within the frame.
     * @returns A FrameOffsets object or undefined if no offsets are defined.
     */
    getOffsets(): FrameOffsets | undefined;
    /**
     * Updates the frame offsets explicitly.
     */
    setOffsets(offsets: FrameOffsets): void;
    /**
     * Sets the zoom of the cropper that owns this service.
     * @param zoom The new zoom value.
     * @param cX The center of zoom on x axis
     * @param cY The center of zoom on Y axis
     * @param onComplete A function to call when zoom changes have been completed
     */
    setZoom(zoom: number, cX: number, cY: number, onComplete?: () => void): void;
    /**
     * Sets the image currently contained by this frame.
     * @param value The new image as an ImageData property
     */
    setPatternData(value: PatternImageData): void;
    /**
     * Modify the offsets of the frame.
     * @param value The new FrameOffsets object.
     * @param onComplete A callback, called when the modification is complete
     */
    updateOffsets(value: FrameOffsets, onComplete?: () => void): void;
    onFrameDataChanged(newListener: (frameData: FrameData | undefined) => void): void;
    /**
     * Append a new listener to zoom events on this frame.
     * @param newListener
     */
    onZoom(newListener: (zoomValue: number) => void): void;
}
declare class Poller {
    /**
     * Constructs a new polling service.
     * @param predicate An async function that returns true when polling has returned a successful result.
     * @param onSuccess The callback to be called when polling has returned a successful result.
     * @param onFailure The callback to be called when polling has returned a failed result.
     * @param interval The number of milliseconds to wait between each poll.
     * @param maxAttempts The maximum amount of times to check the condition.
     */
    constructor(predicate: () => Promise<boolean>, onSuccess: () => void, onFailure: () => void, interval?: number, maxAttempts?: number);
}
declare class Configuration {
    constructor();
    getServerUrl(): string;
    getServicesApiUrl(): string;
    getHubUrl(): string;
    setServerUrl(serverUrl: string): void;
    setServicesApiUrl(servicesApiUrl: string): void;
    setHubUrl(hubUrl: string): void;
    addServerUrlCallback(callback: () => void): void;
}
export const spiffCoreConfiguration: Configuration;
declare class SwaggerServer implements ServerService {
    constructor();
    setUncachedOperations(operationIds: string[]): void;
    execute(operationName: string, parameters?: object): Promise<ServerResponse>;
}
export const server: SwaggerServer;
declare class GraphQlManager {
    constructor();
    getShadowGraphqlClient(): ApolloClient<any>;
}
export const graphQlManager: GraphQlManager;
declare class AssetService {
    constructor();
    /**
     * Allows for retrieving an asset, returns the option from a cache if possible.
     * @param server The server service for making the request.
     * @param id The asset key to be retrieved.
     */
    getLocalOrFromServer(assetKey: string): Promise<IServerModel<Asset>>;
    /**
     * Allows for retrieving amaterial, returns the option from a cache if possible.
     * @param server The server service for making the request.
     * @param id The option ID to be retrieved.
     */
    getMaterialLocalOrFromServer(id: string): Promise<IServerModel<MaterialResource>>;
    /**
     * Upload a user asset to the server. Using callbacks to notify important events.
     */
    uploadAssetWithProgress(file: FileInfo, assetType: AssetType, onProgress: (val: number) => void, onComplete: (asset: IServerModel<Asset>) => void, anonymous?: boolean, partnerId?: string): Promise<IServerModel<Asset>>;
    /**
     * Convert a File object for an image into a FileInfo.
     */
    loadImageAsFileInfo: (file: File) => Promise<FileInfo>;
}
export const assetService: AssetService;
interface SVGCreateOpts {
    stepName?: string;
    src: string;
    objectURL: string;
    svg: {
        svg: string;
        colors: {
            [key: string]: ColorDefinition;
        };
    };
}
declare class IllustrationStepService implements StepService<IllustrationStepData> {
    getIllustrationBody(src: string): Promise<string>;
    getCreateElementCommand(id: string, region: Region, layout: ILayout, options: SVGCreateOpts): _CreateElementCommand1<_IllustrationElement1>;
    init(stepData: Step<IllustrationStepData>, workflowManager: WorkflowManager, reducerState?: _LayoutsState1): Promise<CommandWithFollowup | null>;
    availableColors(stepData: Step<IllustrationStepData>): {
        fill: string;
        stroke: string;
    }[];
    changeColorsCommand(svg: string, illustrationWidth: number, illustrationHeight: number, elements: string[], newFills: Map<string, string>): Promise<CanvasCommand>;
    changeColors(stepData: Step<IllustrationStepData>, elements: RegionElement[], workflowManager: WorkflowManager, getAllLayouts: () => _LayoutData1[], newFills: Map<string, string>): Promise<void>;
    selectVariant(stepData: Step<IllustrationStepData>, variant: VariantResource, elements: RegionElement[], setIsUpdating: (isUpdating: boolean) => void, workflowManager: WorkflowManager): void;
}
export const svgObjectURL: (svg: string) => Promise<string>;
export const illustrationStepService: IllustrationStepService;
declare class DigitalContentStepService implements StepService<DigitalContentStepData> {
    init(stepData: Step<DigitalContentStepData>, workflowManager: WorkflowManager, reducerState?: _LayoutsState1): Promise<CommandWithFollowup | null>;
    regenerateQRCode(elements: RegionElement[], uploading: boolean, assetKey: string, url: string, workflowManager: WorkflowManager, stepData: Step<DigitalContentStepData>, setUrl: (finalUrl: string) => void, commandDispatcher: (command: CanvasCommand) => void, setIsRegenerating: (state: boolean) => void): Promise<void>;
}
export const digitalContentStepService: DigitalContentStepService;
interface FrameCreateOpts {
    stepName?: string;
    frameData: FrameData;
    disablePlaceholder?: boolean;
    focalBlur?: boolean;
    focalBlurStrength?: number;
    focalBlurRadius?: number;
    pattern?: any;
}
declare class FrameStepService implements StepService<FrameStepData> {
    init(stepData: Step<FrameStepData>, workflowManager: WorkflowManager, reducerState?: _LayoutsState1): Promise<CommandWithFollowup | null>;
    selectImage(stepData: Step<FrameStepData>, asset: IServerModel<Asset>, workflowManager: WorkflowManager): void;
    selectVariant(stepData: Step<FrameStepData>, variant: VariantResource | undefined, elements: RegionElement[], workflowManager: WorkflowManager, setFrameIsUpdating?: (status: boolean) => void): void;
    getCreateElementCommand(id: string, region: Region, layout: ILayout, options: FrameCreateOpts): _CreateElementCommand1<_FrameElement1>;
    loadPatternFromString(src: string, frameService: FrameService): Promise<void>;
}
export const frameStepService: FrameStepService;
declare class MaterialStepService implements StepService<MaterialStepData> {
    init(stepData: Step<MaterialStepData>, workflowManager: WorkflowManager, reducerState?: _LayoutsState1): Promise<null | (() => Promise<void>)>;
    selectVariant(step: Step<MaterialStepData>, variant: VariantResource, workflowManager: WorkflowManager, setApplying: (status: boolean) => void): void;
}
export const materialStepService: MaterialStepService;
declare class ModelStepService implements StepService<ModelStepData> {
    init(stepData: Step<ModelStepData>, workflowManager: WorkflowManager, reducerState?: _LayoutsState1): Promise<null | (() => Promise<void>)>;
    selectVariant(step: Step<ModelStepData>, variant: VariantResource, workflowManager: WorkflowManager, setApplying: (status: boolean) => void): void;
}
export const modelStepService: ModelStepService;
declare class ModuleStepService implements StepService<ModuleStepData> {
    init(stepData: Step<ModuleStepData>, workflowManager: WorkflowManager, reducerState?: _LayoutsState1): Promise<CommandWithFollowup | null>;
    changeText(stepData: Step<ModuleStepData>, input: string, workflowManager: WorkflowManager, error: string, setError: (e: string) => void): void;
}
export const moduleStepService: ModuleStepService;
declare class PatchworkStepService implements StepService<PatchworkStepData> {
    init(stepData: Step<PatchworkStepData>, workflowManager: WorkflowManager, reducerState?: _LayoutsState1): Promise<CommandWithFollowup | null>;
    recalculate(stepData: Step<PatchworkStepData>, elements: RegionElement[], workflowManager: WorkflowManager, setIsCalculating: (status: boolean) => void): void;
    selectVariant(stepData: Step<PatchworkStepData>, variant: VariantResource, elements: RegionElement[], workflowManager: WorkflowManager, setIsCalculating: (status: boolean) => void): void;
    /**
     * Constructs a preview SVG for a patchwork. Based on the configuration
     * of the given element.
     */
    constructPreviewSvg(stepData: Step<PatchworkStepData>, elements: RegionElement[], getAllLayouts: () => _LayoutData1[], offsets?: PatchworkOffsets): null | string;
}
export const patchworkStepService: PatchworkStepService;
declare class PictureStepService implements StepService<PictureStepData> {
    init(stepData: Step<PictureStepData>, workflowManager: WorkflowManager, reducerState?: _LayoutsState1): Promise<CommandWithFollowup | null>;
    selectVariant(stepData: Step<PictureStepData>, variant: VariantResource, workflowManager: WorkflowManager, setIsUpdating: (status: boolean) => void): void;
}
export const pictureStepService: PictureStepService;
declare class QuestionStepService implements StepService<QuestionStepData> {
    init(stepData: Step<QuestionStepData>, workflowManager: WorkflowManager, reducerState?: _LayoutsState1): Promise<null | (() => Promise<void>)>;
    selectVariant(stepData: Step<QuestionStepData>, variantId: string, workflowManager: WorkflowManager): void;
}
export const questionStepService: QuestionStepService;
declare class ShapeStepService implements StepService<ShapeStepData> {
    colourOptions(stepData: Step<ShapeStepData>): {
        fill: string;
        stroke: string;
    }[];
    init(stepData: Step<ShapeStepData>, workflowManager: WorkflowManager, reducerState?: _LayoutsState1): Promise<CommandWithFollowup | null>;
    selectVariant(stepData: Step<ShapeStepData>, colourOption: ColorOption, elements: RegionElement[], workflowManager: WorkflowManager): void;
}
export const shapeStepService: ShapeStepService;
type ToastCallback = (callbackOptions: {
    toastMessage: null | string;
    toastType: InformationMessageType | null;
}) => void;
declare class Toast {
    constructor();
    addToastCallback(callback: ToastCallback): void;
    setLatestToast(errorMessage: null | string, errorType: InformationMessageType | null): void;
}
export const toast: Toast;
interface TextUpdateResult {
    command?: GroupCommand;
    helperText: string;
    errors: TextError[];
}
interface TextError {
    localizationKey: string;
}
declare class TextStepService implements StepService<_TextStepData1> {
    init(stepData: Step<_TextStepData1>, workflowManager: WorkflowManager, reducerState?: _LayoutsState1): Promise<CommandWithFollowup | null>;
    /**
     * @deprecated Only returns the first element. see findLayoutElements. A step can have multiple and we should return all of them!
     */
    findLayoutElement(workflowManager: WorkflowManager, step: Step<_TextStepData1>, getAllLayouts: () => any[]): _TextboxElement1;
    findLayoutElements(workflowManager: WorkflowManager, step: Step<_TextStepData1>, getAllLayouts: () => any[]): _TextboxElement1[];
    /**
     * Get the colors that can be used for a given text step.
     * @param stepData The text step to get colors for.
     * @returns A list of color objects containg fill, stroke and variant if available.
     */
    availableColors(stepData: Step<_TextStepData1>): ColorOption[];
    changeColor(stepData: Step<_TextStepData1>, newColor: ColorOption, elements: RegionElement[], workflowManager: WorkflowManager): void;
    /**
     * Given an element and a string, filters any characters from the string that are
     * not supported by the font of the given element.
     * @param layoutElement The element to use for glyph lookup.
     * @param text The text string to filter.
     * @returns A new string representing the passed string with unsupported characters removed.
     */
    filterUnsupportedCharacters: (layoutElement: _TextboxElement1 | undefined, text: string) => string;
    updateInputText(input: string, customiseAllText: boolean, elements: _TextboxElement1[], step: Step<_TextStepData1>, storage: TextStepStorage, workflowManager: WorkflowManager): TextUpdateResult;
    /**
     * @deprecated
     */
    changeInputTextWithRegion(step: Step<_TextStepData1>, 
    /**
     * @deprecated
     */
    curFontSize: number, 
    /**
     * @deprecated
     */
    curFontData: FontData, input: string, storage: TextStepStorage, workflowManager: WorkflowManager, customiseAllText: boolean, setError: (status: boolean) => void, setHelperText: (text: string) => void, setFlashRedError?: (status: boolean) => void): Promise<GroupCommand | undefined>;
    selectVariant(step: Step<_TextStepData1>, variant: VariantResource, storage: TextStepStorage, elements: RegionElement[], workflowManager: WorkflowManager, customiseAllText: boolean, setError: (status: boolean) => void, setHelperText: (text: string) => void): void;
    fontDataFromVariant(variant: VariantResource): Promise<FontData>;
    findOrCreateElements(workflowManager: WorkflowManager, step: Step<_TextStepData1>, getAllLayouts: () => any[]): Promise<_TextboxElement1[]>;
    textAlign: (stepData: _TextStepData1) => string;
}
export const textStepService: TextStepService;
declare abstract class ModuleProduct {
    /**
     * Name used by class. Usually product or brand name.
     */
    abstract moduleName: string;
    /**
     * SVG with styled path positioned on a background image. To be displayed to user.
     */
    abstract svgPreview(text: string): string;
    /**
     * SVG with styled path positioned on a background image. To be submitted for print.
     */
    abstract svgPrint(text: string): string;
}
export interface EditedSteps {
    [stepName: string]: boolean;
}
export interface MandatorySteps {
    [stepName: string]: boolean;
}
export type StepElements = {
    [key: string]: RegionElement[];
};
type StepInitialised = {
    [key: string]: boolean;
};
type StepMetadata = FrameMetadata | IllustrationMetadata | ModuleMetadata | TextMetadata;
export interface WorkflowStorage {
    [stepName: string]: StepStorage;
}
export interface WorkflowMetadata {
    [stepName: string]: StepMetadata;
}
export interface WorkflowSelections {
    [stepName: string]: {
        groupName?: string;
        optionName: string;
        selections: VariantResource[];
    };
}
export interface InformationResult {
    message: string;
    messageType: InformationMessageType;
    stepID: string;
}
export enum InformationMessageType {
    Error = "Error",
    Warning = "Warning"
}
/**
 * Services required for the operaiton of individual steps.
 */
interface StepSpecificServices {
    frameService?: FrameService;
    module?: ModuleProduct;
}
type DesignCreationProgressUpdate = (message: string) => void;
type ConfirmCallback = (isConfirmed: boolean) => void;
type EditedCallback = (editedSteps: EditedSteps) => void;
type ElementsCallback = (elements: StepElements) => void;
type InformationResultCallback = (messages: InformationResult[]) => void;
type InitCallback = (stepInitialised: StepInitialised) => void;
type MakingAdjustmentsCallback = (makingAdjustments: string) => void;
type MandatoryCallback = (mandatorySteps: MandatorySteps) => void;
type MetadataCallback = (metadata: WorkflowMetadata) => void;
type SelectionCallback = (callbackOptions: {
    invalidModelVariants: string[];
    selectionCost: number;
    selections: StepSelections;
    traversableScenes: WorkflowScene[];
}) => void;
type StepSpecificStorageCallback = (selections: StepStorage) => void;
type StorageCallback = (storage: WorkflowStorage) => void;
type UpdateCallback = (isUpdating: boolean) => void;
type CurrentVariationRecordCallback = (variationRecord: null | VariationRecord) => void;
type VariationRecordsCallback = (records: VariationRecord[]) => void;
export interface WorkflowManager {
    addPoller: (poller: Poller) => void;
    addConfirmCallback: (callback: ConfirmCallback) => void;
    addCurrentVariationCallback: (callback: CurrentVariationRecordCallback) => void;
    addEditedCallback: (callback: EditedCallback) => void;
    addElementsCallback: (callback: ElementsCallback) => void;
    addInformationResultCallback: (callback: InformationResultCallback) => void;
    addInitCallback: (callback: InitCallback) => void;
    addMakingAdjustmentsCallback: (callback: MakingAdjustmentsCallback) => void;
    addMandatoryCallback: (callback: MandatoryCallback) => void;
    addMetadataCallback: (callback: MetadataCallback) => void;
    addSelectionCallback: (callback: SelectionCallback) => void;
    addStepSpecificStorageCallback: (callback: StepSpecificStorageCallback, stepName: string) => void;
    addStorageCallback: (callback: StorageCallback) => void;
    addUpdateCallback: (callback: UpdateCallback) => void;
    addVariationRecord: (variationRecord: Omit<VariationRecord, "recordNumber">) => VariationRecord;
    addVariationRecordsCallback: (callback: VariationRecordsCallback) => void;
    getCommandDispatcher: () => (command: CanvasCommand) => void;
    getCurrentVariationRecord: () => VariationRecord | undefined;
    getVariationRecords: () => VariationRecord[];
    getLayouts: () => ILayout[];
    getLayoutPreviewService: () => any;
    getPreviewService: () => _ThreeDPreviewService1 | undefined;
    getProductName: () => string | undefined;
    getProfanities: () => string[];
    getRegionElements: (stepName: string) => RegionElement[];
    getSerializedStep: (stepName: string, serializedSteps: SerializableStep[]) => SerializableStep | undefined;
    getStepSpecificServices: (stepName: string) => StepSpecificServices | undefined;
    getTransaction: () => Transaction;
    getWorkflow: () => Workflow;
    getWorkflowSelections: () => WorkflowSelections;
    markStepsAsInitialised: (stepNames: string[]) => void;
    markUpdateCompleted: (update: string) => void;
    markUpdatePending: (update: string) => void;
    outstandingRequestsPromise: () => Promise<void>;
    removeVariationRecord: (recordNumber: number) => VariationRecord[];
    reset: () => Promise<void>;
    setCurrentAdjustingStepId: (stepId: string) => void;
    setAllScenes: (config: WorkflowScenesConfiguration) => void;
    setCurrentVariationRecord: (variationRecord: null | VariationRecord) => void;
    setEditedStatus: (stepName: string, status: boolean) => void;
    setInformationResults: (results: InformationResult[]) => void;
    setMandatoryFulfilled: (stepName: string, status: boolean) => void;
    setSelectionsAndElements: (stepName: string, variants: VariantResource[], elements: RegionElement[]) => Promise<void>;
    setVariationRecords: (variationRecords: VariationRecord[]) => void;
    toggleDesignConfirmed: () => void;
    updateMetadata: (stepName: string, update: any) => void;
    updateStateWithServer: (getReducerState: () => CommandState) => void;
    updateStateWithServerImmediate: (getReducerState: () => CommandState) => Promise<void>;
    updateStorage: (stepName: string, update: StepStorage) => Promise<void>;
}
interface StepService<T extends AnyStepData> {
    /**
     * Initialize the given step, or reload from serialized data if present.
     */
    init(stepData: Step<T>, workflowManager: WorkflowManager, reducerState?: _LayoutsState1): Promise<any>;
}
interface FileInfo {
    /**
     * The name of the file.
     */
    name: string;
    /**
     * A blob object representing the
     * data of the file.
     */
    blob: Blob;
}
/**
 * A command along with a function to run afterwards.
 */
interface CommandWithFollowup {
    command: CanvasCommand;
    followup: () => Promise<void>;
}
/**
 * The variant selections of a completed step.
 */
interface SelectedVariants {
    [stepName: string]: {
        id: string;
        name: string;
        priceModifier: number;
    }[];
}
interface ExportedData {
    [name: string]: {
        value: string;
        priceModifier: number;
    };
}
export interface DesignCreationMessage {
    baseCost?: number;
    weight?: number;
    designProductId?: string;
    designProductVariantId?: string;
    event: string;
    exportedData: ExportedData;
    lineItemImageUrl: string;
    transactionId: string;
    metadata?: {
        [stepName: string]: string;
    };
    optionsCost: number;
    selectedVariants?: SelectedVariants;
    sku?: string;
    workflowViewerLink: string;
}
/**
 * Represents a transaction.
 */
export interface Transaction {
    id: string;
    /**
     * User-supplied name for the associated design.
     */
    designName?: string;
    bulk?: boolean;
    /**
     * The workflow associated with this transaction.
     */
    workflowId?: string;
    /**
     * Temporary ID that grants write permission to the transaction.
     */
    transactionOwnerId?: string;
    /**
     * The current state of the design.
     */
    workflowState?: string;
    /**
     * URL to a partner-specific logo intended to display during the workflow experience.
     */
    customLogoLink?: string;
    /**
     * URL to a logo intended to display at the periphery of the workflow experience.
     */
    workflowFooterLogoLink?: string;
    /**
     * URL to the corresponding integration in the REST API.
     */
    restApiIntegrationLink?: string;
    /**
     * URL to redirect to when a workflow is finished.
     */
    callbackUrl?: string;
    /**
     * Product that this transaction belongs to.
     */
    product?: Product;
    /**
     * The line item corresponding to this transaction.
     */
    lineItem?: LineItem;
    /**
     * The external product variant ID representing the design product related
     * to this transaction, null unless the createDesignProduct flag was set
     * and the design was finalized using createDesign operation.
     */
    externalDesignProductVariantId?: string;
    /**
     * The external product id representing the design product related
     * to this transaction, null unless the createDesignProduct flag was set
     * and the design was finalized using createDesign operation.
     */
    externalDesignProductId?: string;
    priceModifierTotal?: number;
    /**
     * The amount of variations associated with this transaction.
     */
    variationsCount?: number;
    /**
     * URL to open the transaction in the workflow viewer.
     */
    workflowViewerLink?: string;
    bulkSourceUrl?: string;
    bulkEmailAddress?: string;
    lastSyncedAt?: string;
}
/**
 * Fields found in a variant within a line item resource.
 */
interface LineItemVariant {
    currencyCode: string;
    optionName: string;
    priceModifier: number;
    stepName: string;
    variantName: string;
}
interface LineItem {
    id: string;
    transactionId?: string;
    previewImageUrl?: string;
    product: Product;
    quantity: number;
    metadata?: LineItemMetadata[];
    variants: LineItemVariant[];
}
interface LineItemMetadata {
    stepName: string;
    metadata: string;
}
interface ProductWorkflow {
    friendlyName: string;
    id: string;
    present?: boolean;
    imageUrl: string;
    workflowName: string;
}
interface Product {
    /**
     * ID of the partner owner.
     */
    partnerId?: string;
    /**
     * Whether a line item for this product is delivered as soon as the order is received.
     */
    autoprint: boolean;
    /**
     * Whether this product can be quickprinted.
     */
    canQuickprint?: boolean;
    /**
     * The internal identifier for this product.
     */
    id: string;
    /**
     * The human friendly name of the product.
     */
    name: string;
    /**
     * A URL to the image asset associated with this product.
     */
    imageUrl?: string;
    /**
     * A resource url for a 3D model used to represent this product
     * in the 3d editor. If not available we assume the product doesn't support 3D.
     */
    modelUrl?: string;
    /**
     * A URL for the image used as an overlay on any workflows
     * that incorporate a product overlay step.
     */
    overlayImageUrl?: string;
    /**
     * Words which can't be used in a workflow for this product.
     */
    profanities?: {
        id: string;
        createdAt: string;
        userId: string;
        word: string;
    }[];
    /**
     * The max characters that can be typed for quickprint.
     */
    quickprintMaxLength?: number;
    /**
     * The name of the module to use for quickprint.
     */
    quickprintModuleName?: string;
    /**
     * If true, the product should be displayed in the client as if it is available.
     * Should be displayed as if it is unavailable otherwise.
     */
    enabled: boolean;
    /**
     * Workflows which have been assigned to this product.
     */
    workflows?: ProductWorkflow[];
    /**
     * The base price of this product in sub units. Essentially the cost of the
     * product without any customisations applied.
     */
    basePrice?: number;
    /**
     * The weight of this product.
     */
    weight?: number;
    /**
     * When specified, represents a pre-rendered image of this product to be
     * displayed to customers while the 3D preview is loading.
     */
    preloadImageUrl?: string;
}
interface ColorOption {
    id?: string;
    fill?: string;
    stroke?: string;
    variant?: VariantResource;
}
/**
 * Represents a variation as seen in Google sheets.
 * Record number = row# - 1
 */
export interface VariationRecord {
    recordNumber: number;
    transactionId: string;
    values: {
        stepName: string;
        aspect: string;
        value: string;
    }[];
}
export interface RegionElement {
    id: string;
    region?: Region;
}
interface FrameMetadata {
    image: string;
}
interface IllustrationMetadata {
    colors: string[];
}
interface ModuleMetadata {
    text: string;
}
interface TextMetadata {
    color?: string;
    text: string;
}
export interface SelectionStorage {
    selectedVariants?: VariantResource[];
}
interface TextStepStorage extends SelectionStorage {
    color?: string;
    defaultCleared?: boolean;
    inputText?: string;
    text?: string;
}
type StepSelections = {
    [key: string]: SelectionStorage;
};
interface ServerResponse {
    /**
     * Will contain error information if an error was recieved
     */
    errors?: string[];
    /**
     * The body of the response containing any return data.
     */
    body: object;
    headers: {
        "content-type": string;
    };
}
interface ServerService {
    /**
     * Sets the operation names that should be converted to their correspondingun-cached equivelants.
     */
    setUncachedOperations: (operationIds: string[]) => void;
    /**
     * Execute an operation against the server.
     */
    execute: (operationId: string, operationParameters?: object, anonymous?: boolean) => Promise<ServerResponse>;
}
interface FrameData {
    /**
     * The path data for a frame SVG
     */
    path: string;
    /**
     *  The viewbox width
     */
    width: number;
    /**
     * The viewbox height.
     */
    height: number;
}
/**
 * Defines the different behaviors supported by the camera system
 * for control when viewing a product.
 */
export enum ProductCameraRig {
    Orbit = 0,
    Pan = 1
}
export type LoadProgressEventData = {
    /**
     * The total load value of the scene, this is an average of all
     * 'in progress' loading events. when all events are fully loaded this value will be 100.
     */
    readonly loadValue: number;
    /**
     * This value is true when the base model and scene have been initialized.
     */
    readonly sceneInitialized: boolean;
};
declare class OptionService {
    /**
     * Returns a promise that resolves once all options required for a given workflow
     * have been loaded and cached ready for use.
     * @param workflow The workflow to load options for.
     */
    cacheRequiredOptions(workflow: Workflow): Promise<void>;
    /**
     * Allows for retrieving an option, returns the option from a cache if possible.
     * @param server The server service for making the request.
     * @param id The option ID to be retrieved.
     */
    getLocalOrFromServer(server: ServerService, id: string): Promise<IServerModel<OptionResource>>;
    /**
     * Returns an option from the cache, or null
     * @param id The ID to search for.
     */
    getLocalOrUndefined(id?: string): IServerModel<OptionResource>;
    getAssetTileImageForVariant(variant: VariantResource): Promise<string>;
    getDefaultVariant(option: OptionResource): VariantResource | undefined;
    getDisplayImageSource: (variant?: VariantResource) => undefined | string;
    /**
     * Returns the first variant marked as selected. This is used by most steps.
     */
    getSelectedVariant: (option: OptionResource | undefined, selectedVariantIds: string[]) => VariantResource | undefined;
    /**
     * Returns all selected variants. This is used by the question step as multiple selections can be made.
     */
    getSelectedVariants: (option: OptionResource | undefined, selectedVariantIds: string[]) => VariantResource[];
}
export const optionService: OptionService;
export const CommandContextContext: import("react").Context<_CommandContext1>;
export const useLayouts: () => {
    commandDispatcher: (command: CanvasCommand) => void;
    getLayoutById: (id: string) => _LayoutData1;
    getAllLayouts: () => _LayoutData1[];
    getReducerState: () => CommandState;
    lastUpdated: Date;
    flattenSequence: (sequenceId: string, initialState: _LayoutsState1) => void;
};
export type CommandDispatcher = (command: CanvasCommand) => void;
export type LayoutGetter = (layoutId: string) => _LayoutData1;
export type LayoutsGetter = () => _LayoutData1[];
/**
 * Details about a guideline that can be drawn on the canvas.
 */
interface SnapPoint {
    type: "x" | "y" | "rotation";
    value: number;
    svgNode?: ReactNode;
    anchorPoint: number;
    guidelineCoordinates?: Point[];
}
export enum ElementEventType {
    Translate = "Translate",
    Rotate = "Rotate",
    Resize = "Resize"
}
export enum KeyEvent {
    ControlLeft = "ControlLeft",
    ControlRight = "ControlRight",
    Equal = "Equal",
    MetaLeft = "MetaLeft",
    MetaRight = "MetaRight",
    Minus = "Minus",
    ArrowLeft = "ArrowLeft",
    ArrowRight = "ArrowRight",
    ArrowUp = "ArrowUp",
    ArrowDown = "ArrowDown",
    AltLeft = "AltLeft",
    AltRight = "AltRight",
    Delete = "Delete",
    Backspace = "Backspace"
}
type ElementEvent = {
    type: ElementEventType.Translate;
} | {
    type: ElementEventType.Rotate;
} | {
    type: ElementEventType.Resize;
    relativeAxis: ScaleAxis;
    screenAxis: ScaleAxis;
};
export enum EditorSubMenu {
    None = "None",
    FrameAdjustment = "FrameAdjustment",
    FinalizeDesign = "FinalizeDesign"
}
interface UIState {
}
/**
 * This context stores global state for
 */
export interface AdvancedEditorState extends UIState {
    /**
     * The layout currently being displayed in the editor.
     */
    layoutId: string;
    /**
     * Returns the id of the currently selected element. Or undefined if no element is selected.
     */
    selectedElement?: string;
    /**
     * The current zoom level of the editor.
     */
    zoom: number;
    /**
     * The maxiumum zoom possible based on current canvas content.
     */
    maxZoom: number;
    /**
     * The current measurement system used for display of coordinates and dimensions.
     */
    units: UnitOfMeasurement;
    /**
     * The sub menu to be displayed to the user in place of the canvas.
     */
    subMenu: EditorSubMenu;
    /**
     * Any modifier keys that are currently pressed
     */
    activeModifierKeys: KeyEvent[];
    /**
     * WHether or not a meta key is pressed.
     */
    metaPressed: boolean;
    /**
     * Any active element event.
     */
    elementEvent?: ElementEvent;
    /**
     * If movement should assume that it's operating in a scrolled environment.
     * FIXME: Can we get rid of this somehow.
     */
    scrolledMovement: boolean;
}
export const getDefaultState: (getLayouts: LayoutsGetter, defaultZoom: number) => {
    layoutId: string;
    selectedElement: any;
    zoom: number;
    maxZoom: number;
    units: UnitOfMeasurement;
    subMenu: EditorSubMenu;
    activeModifierKeys: any[];
    metaPressed: boolean;
    elementEvent: any;
    scrolledMovement: boolean;
};
export const commandReducer: (state: AdvancedEditorState, command: UICommand) => AdvancedEditorState;
export const AdvancedEditorContext: import("react").Context<{
    uiDispatcher: Dispatch<UICommand>;
    state: AdvancedEditorState;
}>;
export const AdvancedEditorStateProvider: FunctionComponent<{
    defaultZoom?: number;
    children: ReactNode;
}>;
export class UICommand {
    constructor(changes: Partial<AdvancedEditorState>);
    apply(state: AdvancedEditorState): {
        layoutId: string;
        selectedElement?: string;
        zoom: number;
        maxZoom: number;
        units: UnitOfMeasurement;
        subMenu: EditorSubMenu;
        activeModifierKeys: KeyEvent[];
        metaPressed: boolean;
        elementEvent?: ElementEvent;
        scrolledMovement: boolean;
    };
}
export const useEditorState: () => {
    uiDispatcher: Dispatch<UICommand>;
    state: AdvancedEditorState;
};
/**
 * The minimum zoom that can be applied to a canvas.
 */
export const minZoom = 0.5;
export const useEditorInteraction: (editorRef: RefObject<SVGRectElement>, interactionRef: RefObject<HTMLDivElement>, zoomableElementRef: RefObject<HTMLDivElement>, defaultAdjustmentZoom: number | undefined, mode: "adjustment" | "advanced", canvasDispatcher: CommandDispatcher, guidelinePrimaryColor?: string) => {
    guidelines: SnapPoint[];
    scale: number;
    zoomableElementRef: RefObject<HTMLDivElement>;
    setElementEvent: (newEvent: ElementEvent | undefined) => void;
    handleZoom: (_event: any, value: any) => void;
    handleKeyDown: (event: KeyboardEvent, adjustmentBoundary?: Region) => void;
    handleKeyUp: (event: KeyboardEvent) => void;
    handlePointerPressedBackground: () => void;
    handlePointerReleased: () => void;
    handlePointerMove: (e: PointerEvent, adjustmentBoundary?: Region) => void;
    handleScroll: () => void;
    handleSequenceStart: () => void;
};
export const EditorCore: FunctionComponent<{
    color?: string;
    editorRef: RefObject<SVGRectElement>;
    zoomableElementRef: RefObject<HTMLDivElement>;
    interactionElementRef: RefObject<HTMLDivElement>;
    guidelines: SnapPoint[];
    isMakingAdjustments?: boolean;
    viewmask?: {
        x: number;
        y: number;
        height: number;
        width: number;
    };
    visibleLayoutId: string;
    xTranslation: number;
    yTranslation: number;
    targetedElements?: string[];
    borderRadius?: number;
    handleContextMenu?: (e: any) => void;
    handleKeyDown: (event: KeyboardEvent, adjustmentBoundary?: Region) => void;
    handleKeyUp: (event: KeyboardEvent) => void;
    handlePointerMove: (e: PointerEvent, adjustmentBoundary?: Region) => void;
    handlePointerPressedBackground: () => void;
    handlePointerReleased: () => void;
    handleScroll: () => void;
    onSequenceStart: () => void;
    setElementEvent: (e: ElementEvent | undefined) => void;
    onElementSelected: (elementId: string | undefined, event: PointerEvent) => void;
}>;
/**
 * The advanced editor encapsulates the logic required to allow users to manipulate a design
 * with more granular control such as toolbars, direct element manipulation, and more.
 */
export const AdvancedEditor: FunctionComponent<{
    color?: string;
    guidelineColor?: string;
    borderRadius?: number;
    handleContextMenu?: (event: MouseEvent) => void;
    onElementSelected?: (id: string | undefined, element: PointerEvent) => void;
}>;
interface StorageService {
    /**
     * Get a value.
     * @param key The key to lookup the value with.
     */
    get(key: string): string | undefined;
    /**
     * Set a value.
     * @param key The key to set.
     * @param val The new value.
     */
    set(key: string, val: string): void;
    /**
     * Remove a value.
     * @param key The key to remove, does nothing if the key doesn't exist.
     */
    remove(key: string): void;
    getMap(key: string): Map<any, any> | undefined;
    setMap(key: string, val: Map<any, any>): void;
}
export const persistenceService: StorageService;
/**
 * A StepHandle allows for managing the state of a specific step in a workflow. This class
 * abstracts away the complexities of dealing with a step directly and allows for using high level
 * concepts instead of dealing with the underlying data structures.
 */
interface StepHandle {
    /**
     * Gets the currently selected variant, or undefined if no variant is selected.
     */
    getCurrentVariant(): any;
    /**
     * Returns a list of valid variants for this step.
     */
    getAvailableVariants(): Promise<VariantResource[]>;
    /**
     * Selects a specific variant for this step.
     */
    selectVariant(variant: VariantResource): any;
}
/**
 * A Workflow experience encapsulates the workflow manager and command context. It
 * provides a simplified interface for interacting with the workflow manager. You
 * should get an instance of this class from a Client you have constructed previously.
 */
export interface WorkflowExperience {
    /**
     * State related to the design of the user.
     */
    getCommandContext(): CommandContext;
    /**
     * Returns true when the user may only view the design.
     */
    getIsReadOnly(): boolean;
    /**
     * Get the low level workflow amanager instance for this experience. Don't touch this unless you're willing to break things.
     */
    getWorkflowManager(): WorkflowManager;
    /**
     * Bulk workflow operation, used to update multiple variations at once.
     */
    updateVariationRecords(variationRecords: VariationRecord[]): Promise<void>;
    /**
     * Returns the step matching a given name, undefined if not found.
     * @param id The id the step must match.
     */
    getStepById(id: string): StepHandle | undefined;
    /**
     * Returns the step matching a given name, undefined if not found.
     * @param name The name the step must match.
     */
    getStepByName(name: string): StepHandle | undefined;
    /**
     * Returns all steps matching a specific type in the workflow. These steps
     * may be across multiple scenes and may or may not be active based on condition state.
     */
    getStepsByType(type: StepType): StepHandle[];
    /**
     * Creates a data URL preview for the current design.
     */
    createPreviewImage(): Promise<string>;
    /**
     * To be called when the workflow experience is considered completed by the user.
     * @param product
     * @param onProgressUpdate Progress callback for finalizing the design.
     * @param selections
     * @param metadata
     */
    onDesignFinished(product: Product, onProgressUpdate: DesignCreationProgressUpdate, selections: WorkflowSelections, metadata?: WorkflowMetadata | undefined): Promise<DesignCreationMessage>;
}
/**
 * Options that can be used during instantiation of the SpiffCommerce Javascript Client.
 * Please refer to the documentation for more information.
 */
interface ClientOptions {
    /**
     * When set to true, the client will treat the workflow as a bulk order
     * containing multiple variations of the base design.
     */
    bulk?: boolean;
    /**
     * When set to true caching will be disabled. This is only useful for debugging. Don't use in production code!
     */
    useUncachedEndpoints?: boolean;
}
/**
 * The Spiff Commerce Javascript Client. Required for
 * creating workflow experiences.
 */
export class Client {
    constructor(options: ClientOptions);
    /**
     * Initialize the client from an integration product.
     * @param integrationProductId The integration product to use.
     */
    initFromIntegrationProduct(integrationProductId: string): Promise<void>;
    /**
     * Initialize the client from an existing transaction.
     * @param transactionId The id of the transaction
     * @returns A promise resolving at initialization completion.
     */
    initFromTransaction(transactionId: string): Promise<void>;
    /**
     * Creates a new instance of WorkflowExperience. A high level wrapper for workflows.
     * @param workflowId The id of the workflow to be run.
     * @param workflowState An existing workflow state if available.
     * @param previewServiceConstructor A function called during initialization. Takes a class implementing ThreeDPreviewService in return.
     * @returns A workflow experience configured as requested.
     */
    getWorkflowExperience(workflowId?: string, workflowState?: string, previewServiceConstructor?: (workflow: Workflow) => _ThreeDPreviewService1): Promise<WorkflowExperience>;
    /**
     * @returns The preview service that was provided during construction.
     */
    getPreviewService(): _ThreeDPreviewService1;
    /**
     * @returns The product associated with this client.
     */
    getProduct(): Product;
    /**
     * @returns The transaction associated with this client.
     */
    getTransaction(): Transaction;
}
export class MockWorkflowManager implements WorkflowManager {
    getVariationRecords(): VariationRecord[];
    reset(): Promise<void>;
    updateStateWithServer(_getReducerState: () => CommandState): void;
    addVariationRecord(_variationRecord: Omit<VariationRecord, "recordNumber">): {
        recordNumber: number;
        transactionId: string;
        values: any[];
    };
    getCurrentVariationRecord(): any;
    removeVariationRecord(_recordNumber: number): any[];
    outstandingRequestsPromise(): Promise<void>;
    updateStateWithServerImmediate(_getReducerState: () => CommandState): Promise<void>;
    addPoller(_poller: Poller): void;
    addConfirmCallback(_callback: ConfirmCallback): void;
    addCurrentVariationCallback(_callback: CurrentVariationRecordCallback): void;
    addEditedCallback(_callback: EditedCallback): void;
    addElementsCallback(_callback: ElementsCallback): void;
    addInformationResultCallback(_callback: InformationResultCallback): void;
    addInitCallback(_callback: InitCallback): void;
    addMakingAdjustmentsCallback(_callback: MakingAdjustmentsCallback): void;
    addMandatoryCallback(_callback: MandatoryCallback): void;
    addMetadataCallback(_callback: MetadataCallback): void;
    addSelectionCallback(_callback: SelectionCallback): void;
    addStepSpecificStorageCallback(_callback: StepSpecificStorageCallback, _stepName: string): void;
    addStorageCallback(_callback: StorageCallback): void;
    addUpdateCallback(_callback: UpdateCallback): void;
    addVariationRecordsCallback(_callback: VariationRecordsCallback): void;
    getCommandDispatcher(): (_command: CanvasCommand) => void;
    getLayouts(): any[];
    getLayoutPreviewService(): {
        getAll: () => Map<any, any>;
    };
    getPreviewService(): any;
    getProductName(): string;
    getProfanities(): any[];
    getRegionElements(_stepName: string): any[];
    getSerializedStep(_stepName: string, _serializedSteps: SerializableStep[]): any;
    getStepSpecificServices(_stepName: string): any;
    getTransaction(): {
        id: string;
    };
    getWorkflow(): {
        id: string;
        name: string;
        panels: any[];
        steps: any[];
        showModelOnFinishStep: boolean;
        allowProofDownload: boolean;
        introduction: string;
        stepGroups: any[];
    };
    markStepsAsInitialised(_stepNames: string[]): void;
    markUpdateCompleted(_update: string): void;
    markUpdatePending(_update: string): void;
    getWorkflowSelections(): {};
    setCurrentAdjustingStepId(_stepId: string): void;
    setAllScenes(_config: WorkflowScenesConfiguration): void;
    setCurrentVariationRecord(_variationRecord: VariationRecord | null): void;
    setEditedStatus(_stepName: string, _status: boolean): void;
    setInformationResults(_results: InformationResult[]): void;
    setMandatoryFulfilled(_stepName: string, _status: boolean): void;
    setSelectionsAndElements(_stepName: string, _variants: VariantResource[], _elements: RegionElement[]): Promise<void>;
    setVariationRecords(_variationRecords: VariationRecord[]): void;
    toggleDesignConfirmed(): void;
    updateMetadata(_stepName: string, _update: any): void;
    updateStorage(_stepName: string, _update: StepStorage): Promise<void>;
}
export { CommandContext };
export { generate, CreateElementCommand, TextChangeCommand, FontAlignmentCommand, FontColorCommand, LayoutElementFactory };
export { LayoutElement, ImageElement, TextboxElement, TextStepData, FrameElement, PatchworkElement, IllustrationElement, LayoutData, LayoutsState };
export { SpiffCommerce3DPreviewService };
export { ThreeDPreviewService };

//# sourceMappingURL=types.d.ts.map
