import React from 'react'; import { FlowStep, StateContextType } from '../StateProvider'; export interface ProductPersonalizationFlowConfig { /** * Lovepop API endpoint. */ endpoint: string; /** * Min image file size for resize to kick in (bytes). * @default 6e6 */ minImageFileResize: number; /** * Max image file size in bytes. * @default 40e6 */ maxImageFileSize: number; /** * Note resource to look up if editing an existing note. */ noteResourceId?: number | string; /** * Callback will be fired if the editor catches and handles an error. * Expected use case is for logging rather than error handling. Sasquatch * exposes more specific callbacks for handling unrecoverable errors. */ onError?: (error: Error | TypeError | DOMException) => void; /** * Specify the active step. Controlled by default. */ activeStep?: FlowStep; /** feature flag that controls wether the giftcard step is shown or not * @default false */ featureFlagGiftCards?: boolean; /** titles of the steps to use. its lenght also controls the end step of the flow * */ progressStepTitles: Array; /** max number of steps in the flow * */ progressMax: number; /** * Callback to be fired when the step changes. */ onStepChange?: (step: FlowStep) => void; /** * Temporary for testing photo editing. * @default 'both' */ layout?: 'image' | 'note' | 'both'; /** * Callback will be fired when note lookup either succeeds or fails. Always * expect it to be called if a `noteResourceId` is provided. Param indicates * success or failure. */ onNoteLookupComplete?: (success: boolean) => void; /** * Called when all critical resources (currently fonts and note in the editing * case) have finished attempting to load. */ onReady?: () => void; /** * Called when the note is saved via the remote service. Should be memoized. */ onNoteSaved?: ({ text, noteResourceId }: { text: string; noteResourceId: string | number; }) => void; /** * Callback fired when the close button is clicked. */ onClose?: () => void; /** * Set this to true if the flow is rendering in a container (like a modal) * such that all transitions should originate within the container (i.e. * drawer slide-in/out) as opposed to from within the viewport itself. * Making this flexible makes it possible to fix some buggy transitions * when constrained on mobile. * @default false */ isRenderingInStrictContainer?: boolean; /** * Currently steps the address and scheduling steps are expected to be * rendered by the consuming app. State and dispatch are provided to the * render function. */ renderAddressStep: (context: StateContextType) => JSX.Element; renderScheduleStep: (context: StateContextType) => JSX.Element; renderGiftCardStep: (context: StateContextType) => JSX.Element; /** * Configurable message idea categories. */ occasions: { value: string; label: string; }[]; /** * Configurable message idea values. */ messages: Record; /** * Disable the next button which allows the user to procede to the next step. * @default false */ disableNextButton?: boolean; /** * Words to filter (converted to asterisks) in the final note. * @default [] */ badWords: string[]; /** * If we fail to update or create a note and can't recover. This should be memoized. * Allows for doing things like returning to the first step of the flow, etc. */ onFailedToCreateOrUpdateNote?: () => void; /** * Called when entering image-editing mode. */ onStartEditImage?: () => void; /** * Called when exiting image-editing mode. */ onStopEditImage?: () => void; /** * Absolute URL for Lovepop ToS. */ termsOfServiceLink: string; /** * depending on this runs the animation and shows the components for customization */ showPersonalization: boolean; /** * @default 'Add to Cart' */ previewConfirmButtonText?: string; /** * Enables responding to internal error modal cancel click. */ onErrorModalCancel?: () => void; /** * Enables responding to internal error modal confirmation click. */ onErrorModalConfirm?: () => void; /** * Indicate whether the recipient address is complete. * @default false */ isAddressStepComplete?: boolean; /** * Indicate whether the shipping date has been scheduled. * @default false */ isScheduleStepComplete?: boolean; /** * Estimated arrival copy displayed in preview. */ shippingDateMessage?: string; /** * Delay (ms) before opening layouts drawer (step zero) on first render. If * `false`, it will not open the layouts drawer first render. * @default 400 */ stepZeroDelay?: number | false; /** * Callback fired when preview screen renders. Param indicates whether or not * the personalization is complete (for edge case tracking). */ onPreviewScreenView?: (canSaveNote: boolean) => void; } interface Props extends Omit { children: React.ReactNode; } export declare const ConfigurationContext: React.Context; declare const ConfigurationContextProvider: ({ endpoint, minImageFileResize, maxImageFileSize, layout, noteResourceId, onError, onNoteSaved, onClose, onNoteLookupComplete, onReady, children, isRenderingInStrictContainer, activeStep, featureFlagGiftCards, onStepChange, renderAddressStep, renderScheduleStep, renderGiftCardStep, occasions, messages, disableNextButton, badWords, onFailedToCreateOrUpdateNote, onStartEditImage, onStopEditImage, termsOfServiceLink, showPersonalization, previewConfirmButtonText, onErrorModalCancel, onErrorModalConfirm, isScheduleStepComplete, isAddressStepComplete, shippingDateMessage, stepZeroDelay, onPreviewScreenView }: Props) => JSX.Element; export declare const useConfigurationContext: () => ProductPersonalizationFlowConfig; export default ConfigurationContextProvider;