UNPKG

@spiffcommerce/core

Version:

Core client API for interacting with the Spiff Commerce backend.

1 lines • 1.66 MB
{"version":3,"file":"index.mjs","sources":["../src/types.ts","../src/util/exception.ts","../src/services/persistence.ts","../src/Configuration.ts","../src/util/crossplatform.ts","../src/services/server.ts","../src/customCanvas.ts","../src/util/image.ts","../src/util/color.ts","../src/util/illustration.ts","../src/services/asset.ts","../src/services/promiseCache.ts","../src/services/option.ts","../src/query.ts","../src/WorkflowManager/scenes/index.ts","../src/util/PromiseQueue/index.ts","../src/util/guid.ts","../src/Elements/SVGLayout.tsx","../src/util/math.ts","../src/Elements/Image.tsx","../src/Elements/Group.tsx","../src/Elements/Frame.tsx","../src/util/font.ts","../src/text/algorithm/traditional.ts","../src/text/shared.ts","../src/util/text.ts","../src/Elements/Textbox.tsx","../src/Elements/Illustration.tsx","../src/CommandContext.tsx","../src/util/frame.ts","../src/Elements/factory.ts","../src/LayoutsState.ts","../src/command.ts","../src/services/SilentStepHandler/index.ts","../src/services/shortener.ts","../src/util/Poller.ts","../src/services/steps/digitalContent.ts","../src/services/steps/frame/index.ts","../src/services/steps/illustration.ts","../src/services/steps/material.ts","../src/services/steps/model.ts","../src/services/steps/module.ts","../src/services/steps/picture.ts","../src/services/steps/question.ts","../src/services/steps/shape.ts","../src/services/toast.ts","../src/text/algorithm/autosize.ts","../src/services/steps/text/index.ts","../src/module/ModuleProduct.ts","../src/module/products/Vegemite/font.ts","../src/module/svg/elements.ts","../src/module/svg/modify.ts","../src/module/svg/Warp.ts","../src/module/products/Vegemite/index.ts","../src/module/resolver.ts","../src/generation/index.ts","../src/WorkflowManager/LayoutPreviewService/index.ts","../src/GlobalPropertyStateManager/query.ts","../src/Bundle/query.ts","../src/WorkflowManager/index.ts","../src/stepHandles/resource/variant.ts","../src/stepHandles/index.ts","../src/stepHandles/steps/illustration.ts","../src/stepHandles/steps/material.ts","../src/stepHandles/steps/model.ts","../src/stepHandles/steps/picture.ts","../src/stepHandles/steps/question.ts","../src/stepHandles/steps/shape.ts","../src/stepHandles/steps/text.ts","../src/stepHandles/steps/information.ts","../src/stepHandles/steps/digitalContent.ts","../src/stepHandles/steps/module.ts","../src/stepHandles/factory.ts","../src/services/design.ts","../src/WorkflowExperience/index.ts","../src/GlobalPropertyConfiguration/index.ts","../src/util/omitDeep.ts","../src/GlobalPropertyStateManager/index.ts","../src/Bundle/stateManager.ts","../src/services/metafield.ts","../src/productCollection.ts","../src/util/event.ts","../src/Bundle/index.ts","../src/flowService.ts","../src/integration.ts","../src/customer.ts","../src/services/graphql.ts","../src/services/userPool.ts","../src/currency.ts","../src/client.ts","../src/services/steps/frame/Service.ts","../src/WorkflowManager/mock.ts","../src/stepHandles/steps/frame.ts","../src/customerPortal/queries.ts","../src/customerPortal/functions.ts","../node_modules/@spiffcommerce/theme-bridge/dist/index.js","../src/addressValidation.ts","../src/util/integrationProduct.ts"],"sourcesContent":["import { FunctionComponent, ReactNode } from \"preact/compat\";\nimport { WorkflowManager } from \"./WorkflowManager\";\nimport type { RenderableContextService } from \"@spiffcommerce/preview\";\nimport type { ConversionConfiguration, ThemeInstallConfigurationGraphQl } from \"@spiffcommerce/theme-bridge\";\nimport { CanvasCommand } from \"./command\";\n\nexport enum AssetType {\n Data = \"Data\",\n Font = \"Font\",\n Frame = \"Frame\",\n Illustration = \"Illustration\",\n Image = \"Image\",\n Model = \"Model\",\n Material = \"Material\",\n Color = \"Color\",\n QuestionnaireCollateral = \"QuestionnaireCollateral\",\n RequestCollateral = \"RequestCollateral\",\n SignupCollateral = \"SignupCollateral\",\n Video = \"Video\",\n ColorProfile = \"ColorProfile\",\n Environment = \"Environment\",\n}\n\nexport interface Asset {\n /**\n * The path of the asset within the bucket.\n */\n key?: string;\n\n /**\n * The name of this asset, the file name by default, otherwise a name set by the user.\n */\n name?: string;\n\n /**\n * The time that this asset was uploaded.\n */\n createdAt?: string;\n\n /**\n * The ID of this asset's license.\n */\n licenseId?: string;\n\n /**\n * The content type registered with the bucket.\n */\n mimeType?: string;\n\n /**\n * The ID of the person that uploaded this asset.\n */\n ownerId?: string;\n\n /**\n * The price to use this asset.\n */\n price?: number;\n\n /**\n * The asset type being dealt with.\n */\n type?: AssetType;\n\n /**\n * True when this asset is publicly available to anyone.\n */\n public?: boolean;\n\n /**\n * All versions for this asset, including the \"latest\" one which is the default and represented\n * by the key of the asset itself.\n */\n objectVersions?: AssetObjectVersion[];\n\n /**\n * A list of tags for organisational purposes.\n */\n tags?: AssetTag[];\n\n hubLink?: string;\n\n fileLink?: string;\n\n newVersionLink?: string;\n\n invalidateLink?: string;\n\n versions?: AssetVersion[];\n\n metadata?: AssetMetadata[];\n\n assetConfiguration?: AssetConfiguration;\n}\n\nexport interface AssetConfiguration {\n colorOption?: OptionResource;\n channelNumbers: {\n id: string;\n number: number;\n }[];\n defaultColorVariants: {\n channelNumber: number;\n variant: VariantResource;\n }[];\n}\n\n/**\n * A tag for organisation of assets\n */\nexport interface AssetTag {\n /**\n * A unique ID.\n */\n id: string;\n /**\n * The human friendly display name of the tag.\n */\n name: string;\n /**\n * The key of the asset the tag is associated to.\n */\n assetKey: string;\n /**\n * The partner that owns that asset & tag.\n */\n partnerId: string;\n}\n\ninterface AssetMetadata {\n key: string;\n value: string;\n}\n\ninterface AssetVersion {\n name: string;\n\n link: string;\n}\n\n/**\n * An object version is a snapshow of an asset at a given point in time. Each time\n * the user updates the file associated to an asset a new object version is created.\n * Users can then see a timeline of all object versions and switch between them.\n */\nexport interface AssetObjectVersion {\n /**\n * The size of the file in bytes.\n */\n size: number;\n /**\n * A timestamp for when this version was created.\n */\n timestamp: string;\n /**\n * The id of the version, this is required in cases where we want to perform\n * specific operations on a version such as making it the latest one or deleting it.\n */\n versionId: string;\n /**\n * The url that this asset should be called on when we want to get it,\n * instead of the base key. This key is\n */\n versionedKey: string;\n}\n\nexport interface Step<T extends AnyStepData = AnyStepData> {\n conditions?: Condition[];\n data: T;\n globalPropertyAspectConfigurations?: GlobalPropertyAspectConfiguration[];\n conversionConfigurationFieldLinks?: ConversionConfigurationLink[];\n helpText?: string;\n mandatory?: boolean;\n relevantPanelName?: string;\n silent?: boolean;\n option?: OptionResource;\n overrideDefaultVariantId?: string;\n optionId?: string;\n stepName: string;\n stepTitle: string;\n tags?: string[];\n type: StepType;\n}\n\nexport interface GlobalPropertyAspectConfiguration {\n aspectName?: string;\n globalPropertyConfigurationId?: string;\n}\n\nexport interface ConversionConfigurationLink {\n identifier?: string;\n conversionConfigurationId?: string;\n}\n\nexport interface GlobalPropertyConfiguration {\n id: string;\n aspects: GlobalPropertyConfigurationAspect[];\n}\n\nexport enum GlobalPropertyConfigurationConditionMode {\n AND = \"AND\",\n OR = \"OR\",\n}\n\nexport interface GlobalPropertyConfigurationAspect {\n name: string;\n type: AspectType;\n title: string;\n description: string;\n entityId?: string;\n conditions?: GlobalPropertyConfigurationAspectCondition[];\n conditionMode?: GlobalPropertyConfigurationConditionMode;\n data?: GlobalPropertyConfigurationAspectData;\n mandatory?: boolean;\n}\n\nexport interface GlobalPropertyConfigurationAspectData {\n fileUpload?: GlobalPropertyConfigurationAspectFileUploadData;\n text?: GlobalPropertyConfigurationAspectTextData;\n}\n\nexport interface GlobalPropertyConfigurationAspectFileUploadData {\n colorPickerEnabled?: boolean;\n pmsPickerEnabled?: boolean;\n colorOptionId?: string;\n}\n\nexport interface GlobalPropertyConfigurationAspectTextData {\n templatingEnabled?: boolean;\n}\n\nexport interface GlobalPropertyConfigurationAspectCondition {\n targetAspectName?: string;\n action: AspectConditionAction;\n requiredVariantSelections: string[];\n}\n\nexport enum AspectConditionAction {\n Show = \"Show\",\n}\n\nexport enum AspectType {\n FileUpload = \"FileUpload\",\n Option = \"Option\",\n ColorOption = \"ColorOption\",\n Text = \"Text\",\n}\n\nexport enum StepType {\n Information = \"Information\",\n Bulk = \"Bulk\",\n DigitalContent = \"DigitalContent\",\n Finish = \"Finish\",\n Frame = \"Frame\",\n Illustration = \"Illustration\",\n Introduction = \"Introduction\",\n Material = \"Material\",\n Model = \"Model\",\n Module = \"Module\",\n Picture = \"Picture\",\n /**\n * @deprecated Use Frame instead.\n */\n Photo = \"Photo\",\n ProductOverlay = \"ProductOverlay\",\n Question = \"Question\",\n Shape = \"Shape\",\n SilentIllustration = \"SilentIllustration\",\n Text = \"Text\",\n}\n\nexport interface StepAspect {\n stepName: string;\n stepType: StepType;\n aspectType: StepAspectType;\n}\n\nexport enum StepAspectType {\n Color = \"Color\",\n Colors = \"Colors\",\n Selection = \"Selection\",\n Selections = \"Selections\",\n Text = \"Text\",\n Upload = \"Upload\",\n}\n\nexport interface Region {\n top: number;\n left: number;\n width: number;\n height: number;\n layer?: number;\n layerIndex?: number;\n rotation: number;\n panelId: string;\n immutable?: boolean;\n adjustmentBoundary?: { x: number; y: number; height: number; width: number };\n}\n\nexport interface Condition {\n requiredVariantSelections: string[];\n action: string;\n targetStepName: string;\n}\n\ninterface StepAsset {\n key: string;\n previewKey?: string;\n}\n\nexport interface OptionResource {\n id?: string;\n localId?: string;\n name: string;\n type?: string;\n variants?: VariantResource[];\n defaultVariant?: VariantResource;\n workflowId?: string;\n public?: boolean;\n displayType?: string;\n colorProfile?: Asset;\n integrationOptions?: IntegrationOptionResource[];\n}\n\nexport interface VariantResource {\n id?: string;\n name: string;\n enabled: boolean;\n priceModifier: number;\n\n asset?: Asset;\n material?: MaterialResource;\n thumbnail?: Asset;\n\n color?: string;\n localId?: string;\n default?: boolean;\n namedColor?: string;\n\n option?: OptionResource;\n}\n\nexport interface IntegrationOptionResource {\n id?: string;\n localId?: string;\n integrationId: string;\n externalProductId?: string;\n}\n\n/**\n * Represents a material resource that can be additively applied to\n * a material targeted in the scene.\n */\nexport type MaterialResource = {\n /**\n * A unique identified for this material.\n */\n id: string;\n /**\n * The name of this material\n */\n name: string;\n /**\n * Defines the base color of a surface before any other calculations are made.\n */\n albedoMapKey?: string;\n /**\n * Defines the transparency of a surface.\n */\n alphaMapKey?: string;\n /**\n * Defines shadowing on a surface.\n */\n ambientMapKey?: string;\n /**\n * Defines the amount of light being emitted from a surface.\n */\n emissionMapKey?: string;\n /**\n * Identical to roughness.\n */\n metallicMapKey?: string;\n /**\n * Defines the direction light will bounce in when it hits a point on a surface.\n */\n normalMapKey?: string;\n /**\n * Used to define how smooth a surface is.\n */\n roughnessMapKey?: string;\n /**\n * Used to define refraction of light on a surface.\n */\n refractionMapKey?: string;\n /**\n * The intensity of refraction, when refraction is enabled via a texture.\n */\n refractionIntensity?: number;\n /**\n * Use to define reflection of light on a surface.\n */\n reflectionMapKey?: string;\n /**\n * The intensity of reflection, when reflection is enabled via a texture.\n */\n reflectionIntensity?: number;\n /**\n * The rotation of the reflection map (around the up axis, in degrees), when reflection is enabled via a texture.\n */\n reflectionRotation?: number;\n /**\n * When enabled the material will be displayed with a clearcoat affect for simulating coated plastic surfaces.\n */\n clearCoat: MaterialEffectMode;\n /**\n * Index of refraction when clear coat is enabled.\n */\n clearCoatIOR?: number;\n /**\n * The date that this material resource was created\n */\n createdAt: string;\n /**\n * The date that this material resource was last updated.\n */\n updatedAt: string;\n};\n\n/**\n * Used to specify the behavior of a material effect such as clearcoat, sheen and translucency.\n */\nexport enum MaterialEffectMode {\n /**\n * When a material variant effect specifies 'None' the effect doesn't change in any way. This is the default behavior.\n */\n None = \"None\",\n /**\n * When a material variant effect specifies 'RemoveWhenSelected' the effect is removed.\n */\n RemoveWhenSelected = \"RemoveWhenSelected\",\n /**\n * When a material variant effect specifies 'ApplyWhenSelected' the effect is enabled.\n */\n ApplyWhenSelected = \"ApplyWhenSelected\",\n}\n\nexport type AnyStepData =\n | InformationStepData\n | BulkStepData\n | DigitalContentStepData\n | FinalizeStepData\n | FrameStepData\n | IllustrationStepData\n | MaterialStepData\n | ModelStepData\n | ModuleStepData\n | PictureStepData\n | QuestionStepData\n | ShapeStepData\n | SilentStepData\n | TextStepData;\n\nexport interface Animatable {\n lookAtAnimation?: CameraAnimation;\n modelAnimation?: ModelAnimation;\n}\n\nexport interface BulkStepData extends Animatable {\n aspects: StepAspect[];\n}\n\nexport interface InformationStepData extends Animatable, Placeable {\n content: string;\n}\n\nexport interface DigitalContentStepData extends Animatable, Placeable {\n baseUrl: string;\n varyUpload?: boolean;\n}\n\nexport interface FrameStepData extends Animatable, Placeable, Colorable {\n hideSelectionInCart?: boolean;\n hideImageInCart?: boolean;\n colorPickerEnabled?: boolean;\n displaySelectionOnFinishStep?: boolean;\n displayImageOnFinishStep?: boolean;\n disablePlaceholder?: boolean;\n initialZoomLevel?: number;\n markSelectionAsCustomField?: boolean;\n markImageAsCustomField?: boolean;\n maxColors?: number;\n focalBlur?: boolean;\n focalBlurRadius?: number;\n focalBlurStrength?: number;\n forceImageCover?: boolean;\n overlayImageKey?: string;\n placeholderImageKey?: string;\n placeholderImageUrl?: string;\n varySelection?: boolean;\n varyUpload?: boolean;\n whitelistedExtensions: string[];\n}\n\nexport interface IllustrationStepData extends Animatable, Placeable, Colorable {\n hideSelectionInCart?: boolean;\n hideColorsInCart?: boolean;\n displaySelectionOnFinishStep?: boolean;\n displayColorsOnFinishStep?: boolean;\n markSelectionAsCustomField?: boolean;\n markColorsAsCustomField?: boolean;\n assetKeys?: string[];\n assets?: StepAsset[];\n defaultAssetKey?: string;\n colorPickerEnabled?: boolean;\n pmsPickerEnabled?: boolean;\n varySelection?: boolean;\n varyColors?: boolean;\n}\n\nexport interface MaterialStepData extends Animatable {\n hideSelectionInCart?: boolean;\n displaySelectionOnFinishStep?: boolean;\n markSelectionAsCustomField?: boolean;\n targetMaterials: string[];\n varySelection?: boolean;\n}\n\nexport interface ModelStepData extends Animatable {\n replaceProductModel?: boolean;\n hideSelectionInCart?: boolean;\n displaySelectionOnFinishStep?: boolean;\n markSelectionAsCustomField?: boolean;\n varySelection?: boolean;\n}\n\nexport interface ModuleStepData extends Animatable, Placeable {\n hideTextInCart?: boolean;\n displayTextOnFinishStep?: boolean;\n markTextAsCustomField?: boolean;\n module: string;\n maxLength: number;\n varyText?: string;\n}\n\nexport interface PictureStepData extends Animatable, Placeable {\n hideSelectionInCart?: boolean;\n displaySelectionOnFinishStep?: boolean;\n markSelectionAsCustomField?: boolean;\n varySelection?: boolean;\n}\n\nexport interface QuestionStepData extends Animatable {\n hideSelectionsInCart?: boolean;\n displaySelectionsOnFinishStep?: boolean;\n markSelectionsAsCustomField?: boolean;\n varySelections?: boolean;\n}\n\nexport interface ShapeStepData extends Animatable, Placeable {\n hideSelectionInCart?: boolean;\n displaySelectionOnFinishStep?: boolean;\n markSelectionAsCustomField?: boolean;\n defaultColour?: string;\n excludeFromPrint?: boolean;\n varySelection?: boolean;\n}\n\nexport interface TextStepData extends Animatable, Placeable, Colorable {\n hideSelectionInCart?: boolean;\n hideFillImageInCart?: boolean;\n hideColorInCart?: boolean;\n hideStrokeInCart?: boolean;\n hideTextInCart?: boolean;\n displaySelectionOnFinishStep?: boolean;\n displayImageFillOnFinishStep?: boolean;\n displayColorOnFinishStep?: boolean;\n displayTextOnFinishStep?: boolean;\n displayStrokeOnFinishStep?: boolean;\n markSelectionAsCustomField?: boolean;\n markFillImageAsCustomField?: boolean;\n markColorAsCustomField?: boolean;\n markStrokeAsCustomField?: boolean;\n markTextAsCustomField?: boolean;\n allowNewlines?: boolean;\n defaultText: string;\n deleteDefaultOnFocus?: boolean;\n replaceableText?: string;\n font: string;\n colorPickerEnabled?: boolean;\n maxLength: number;\n maxSize?: number;\n minSize?: number;\n size: number;\n textAlign: string;\n colour: string;\n uppercase?: boolean;\n vertical?: boolean;\n verticalAlign: string;\n curved?: boolean;\n paths?: string[];\n userCanReplaceText?: boolean;\n varySelection?: boolean;\n varyText?: boolean;\n varyColor?: boolean;\n imageFillOption?: OptionResource;\n imageFillScale?: number;\n strokeEnabled?: boolean;\n strokeOption?: OptionResource;\n strokeThickness?: string;\n}\n\nexport interface SilentStepData extends Animatable, Placeable {\n asset?: Asset;\n excludeFromPrint?: boolean;\n}\n\ntype FinalizeStepData = Animatable;\n\n/**\n * A colorable step is a step that can have an optional color option assigned to help drive color palette choices.\n */\nexport interface Colorable {\n colorOption?: OptionResource;\n}\n\n/**\n * A placeable step is a step that can be placed on a canvas in a set of specific positions.\n */\nexport interface Placeable {\n regions: Region[];\n}\n\nexport interface StepService<T extends AnyStepData> {\n /**\n * Initialize the given step, or reload from serialized data if present.\n */\n init(stepData: Step<T>, workflowManager: WorkflowManager, reducerState?: LayoutsState): Promise<any>;\n}\n\nexport interface LayoutsState {\n layouts: { [id: string]: LayoutState };\n serializableWorkflow: SerializableWorkflow;\n}\n\n/**\n * A workflow step in the process of being serialized or deserialized.\n */\nexport interface SerializableStep {\n stepName: string;\n storage?: StepStorage;\n selectedVariants?: SerializableVariant[];\n}\n\nexport interface SerializableWorkflow {\n steps: SerializableStep[];\n}\n\nexport interface SerializableVariant {\n id: string;\n priceModifier: number;\n}\n\n// Non-variant information required to rehydrate a workflow step.\nexport interface StepStorage {\n bulkIsConnected?: boolean;\n color?: string;\n colorProfileAssetKey?: string;\n colors?: { [key: string]: IllustrationColorObject };\n colour?: string;\n currentFrameSources?: string[];\n customiseAllText?: boolean;\n defaultCleared?: boolean;\n fillImage?: TextFillImage;\n frameOffsetsList?: FrameOffsets[];\n framePatternData?: {\n originalAssetKey?: string;\n backgroundRemovedAssetKey?: string;\n useOriginalAsset?: boolean;\n };\n framePatternSrc?: string;\n inputText?: string;\n overrideGlobalConfiguration?: boolean;\n overrideGlobalConfigurations?: { [key: string]: boolean };\n strokeColor?: IllustrationColorObject;\n text?: string;\n videoShortUrl?: string;\n videoUrl?: string;\n}\n\nexport interface IllustrationColorObject {\n browserValue: string;\n spotColor?: { profileName: string; namedColor: string };\n pmsValue?: string;\n}\n\nexport interface FrameOffsets {\n regionIndex?: string;\n y: number;\n x: number;\n zoom: number;\n}\n\nexport interface LayoutState {\n /**\n * The elements currently on this layout.\n */\n elements: LayoutElement[];\n /**\n * A file describing the properties of this layout.\n */\n layout: ILayout;\n /**\n * A unique ID regenerated each time this layout is changed.\n */\n modificationID: string;\n}\n\n/**\n * Represents an element on the SVG canvas. This may comprise of multiple SVG elements when\n * output such as path elements, defs, etc. All concrete elements must implement this interface.\n */\nexport interface LayoutElement extends Layerable {\n /**\n * The unique identifier for this element.\n */\n id: string;\n /**\n * If the element was made from a workflow step, this is its step name.\n */\n stepName?: string;\n /**\n * If the element was made from a workflow step, this is its region.\n */\n stepRegion?: Region;\n /**\n * If the element was made from a workflow step, this the index of the region.\n */\n stepRegionIndex?: number;\n /**\n * The type of this element\n */\n type: LayoutElementType;\n /**\n * Horizontal offset from top left origin point.\n */\n x: number;\n /**\n * Vertical offset from top left origin point.\n */\n y: number;\n /**\n * The height in pixels of the element.\n */\n width: number;\n /**\n * The height in pixels of the element.\n */\n height: number;\n /**\n * The rotation in degrees.\n */\n rotation: number;\n\n /**\n * The element is considered immutable and shouldn't be modifiable by the user.\n */\n immutable?: boolean;\n /**\n * When true this element should be rendered on top of all other elements always.\n */\n productOverlay?: boolean;\n /**\n * When true, this element will be removed from SVGString output when\n * the removeExcludedElements flag is set to true.\n */\n excludeFromExport?: boolean;\n /**\n * Value to use as the mask attribute if the element does not correspond to a step.\n */\n mask?: string;\n /**\n * Injected by the LayoutsProvider if required. Shouldn't be\n * used by the user. This is a simple way to pass global rendering configuration\n * to individual elements without having to set up a react context.\n */\n _renderingConfiguration?: RenderingConfiguration;\n}\n\n/**\n * Represents a layerable entity. Layerable entities can be sorted within our system for rendering purposes.\n */\nexport interface Layerable {\n /**\n * The layer that this element exists on. Elements on a higher layer can never\n * be below an element on a lower layer. 0 by default.\n */\n layer?: number;\n /**\n * The index of this element on the current layer, if no layer is present it is assumed to be 0.\n * For the index 0 is lower, > 0 is higher\n */\n layerIndex?: number;\n}\n\nexport interface TextFillImage {\n src: string;\n width: number;\n height: number;\n scale: number;\n}\n\n/**\n * The reason we need to turn a layout into an SVG.\n */\nexport enum LayoutRenderingPurpose {\n ThreeD = \"ThreeD\",\n FreeDesign = \"FreeDesign\",\n Print = \"Print\",\n}\n\n/**\n * Specifies configuration for rendering a Papyrus canvas as an SVG string.\n */\nexport interface RenderingConfiguration {\n /**\n * Sets the viewbox to a custom value when subregions are desired.\n */\n region?: PreviewRegion;\n /**\n * Excludes marked elements from the SVG output when true.\n */\n removeExcludedElements?: boolean;\n\n purpose: LayoutRenderingPurpose;\n\n /**\n * When true any cached data will be ignored and assets will be rendered in full\n * with the properties they are provided.\n */\n omitCachedFields?: boolean;\n /**\n * When true, spot colors will be output, when provided, into any\n * fill or stroke style in an illustration.\n */\n spotColors?: boolean;\n\n colorProfiles?: ColorProfileProps[];\n\n /**\n * Allow for debug rendering on elements.\n */\n debug?: boolean;\n\n /**\n * Contents variables for templating text.\n */\n templatingContext?: { [key: string]: any };\n}\n\nexport interface ColorProfileProps {\n name: string;\n key: string;\n}\n\nexport interface PreviewRegion {\n top: number;\n left: number;\n width: number;\n height: number;\n}\n\n/**\n * The possible types for an element.\n */\nexport enum LayoutElementType {\n Frame = \"frame\",\n Group = \"group\",\n Image = \"image\",\n Pattern = \"pattern\",\n Illustration = \"illustration\",\n Textbox = \"textbox\",\n}\n\n/**\n * Represents a layout contained within a specific user created design.\n */\nexport interface ILayout {\n /**\n * The internal identifier for this layout.\n */\n id: string;\n\n /**\n * A link to the json resource describing this layout\n */\n layoutPath?: string;\n\n /**\n * The index this layout appears at in its design\n */\n index: number;\n\n /**\n * An id for the panel associated to this layout.\n */\n panelId: string;\n\n /**\n * The date this layout was created.\n */\n createdAt: Date;\n\n /**\n * The date this layout was last updated.\n */\n updatedAt: Date;\n\n /**\n * The height of the layout. This matches the background element on the canvas as a convenience.\n */\n height: number;\n\n /**\n * The width of the layout. This matches the background element on the canvas as a convenience.\n */\n width: number;\n /**\n * When true this layout should contain no background fill.\n */\n transparentBackground?: boolean;\n\n previewRegion?: {\n height: number;\n width: number;\n top: number;\n left: number;\n };\n\n useEditableArea?: boolean;\n editableArea?: {\n x: number;\n y: number;\n height: number;\n width: number;\n };\n\n name: string;\n title?: string;\n}\n\nexport interface FileInfo {\n /**\n * The name of the file.\n */\n name: string;\n\n /**\n * A blob object representing the\n * data of the file.\n */\n blob: Blob;\n}\n\n/**\n * A command along with a function to run afterwards.\n */\nexport interface CommandWithFollowup {\n command?: CanvasCommand;\n followup?: () => Promise<void>;\n}\n\nexport interface DesignResource {\n metadata?: { [key: string]: string };\n sku?: string;\n}\n\nexport interface DesignDetails {\n name: string;\n layouts: { index: number; panelId: string }[];\n workflowId: string;\n transactionId: string;\n previewImage?: string;\n useThreeDimPreview: boolean;\n metadata?: { key: string; value: string }[];\n selectedVariants?: { key: string; ids: string[] }[];\n}\n\n/**\n * The variant selections of a completed step.\n */\nexport interface SelectedVariants {\n [stepName: string]: {\n id: string;\n name: string;\n priceModifier: number;\n }[];\n}\n\n// The metadata and variant selections of a completed workflow.\nexport interface ExportedData {\n [name: string]: {\n value: string;\n priceModifier: number;\n };\n}\n\nexport interface DesignCreationMessage {\n additionalExternalProductId?: string;\n additionalExternalVariantId?: string;\n baseCost?: number;\n designExternalVariants?: DesignExternalVariant[];\n designProductId?: string;\n designProductVariantId?: string;\n event: string;\n exportedData: ExportedData;\n externalCartProductId?: string;\n externalCartProductVariantId?: string;\n lineItemImageUrl: string;\n metadata?: { [stepName: string]: string };\n optionsCost: number;\n processExecutionId?: string;\n quantity?: number;\n selectedVariants?: SelectedVariants;\n sku?: string;\n transactionId: string;\n transactionOwnerId?: string;\n weight?: number;\n workflowViewerLink: string;\n workflowViewerReadOnlyLink: string;\n}\n\nexport enum BundleDesignCreationCartAddMode {\n /** Uses default grouping method, which consolidates products into as few line items as possible */\n Default = \"Default\",\n /** Only adds the first transaction to the cart. */\n FirstTransaction = \"FirstTransaction\",\n /** Adds each transaction in the Bundle to the cart, without consolidation. */\n OneToOne = \"OneToOne\",\n}\n\nexport interface BundleDesignCreationMessage {\n bundleId: string;\n /**\n * The name assigned by the user for this design.\n */\n name: string;\n /**\n * The date this bundle is expected to be dispatched.\n */\n dispatchDate: string;\n /**\n * The purchase order associated with this bundle.\n */\n purchaseOrder: string;\n /**\n * The ID of the collection this bundle is using.\n */\n collectionId: string;\n /**\n * The name of the collection this bundle is using.\n */\n collectionName: string;\n /**\n * The line items associated with this bundle.\n */\n items: DesignCreationMessage[];\n /**\n * The ID of the user who owns this bundle.\n */\n bundleOwnerId?: string;\n /**\n * @deprecated\n */\n cartAddMode?: BundleDesignCreationCartAddMode;\n}\n\nexport interface DesignWorkflowMetadata {\n [key: string]: string;\n}\n\n/**\n * Represents a transaction.\n */\nexport interface Transaction {\n /**\n * A unique identifier for this transaction. Useful for reloading and\n * modifying state of the transaction.\n */\n id: string;\n\n /**\n * User-supplied name for the associated design.\n */\n designName?: string;\n\n /**\n * The workflow associated with this transaction.\n */\n workflowId?: string;\n\n /**\n * Temporary ID that grants write permission to the transaction.\n */\n transactionOwnerId?: string;\n\n /**\n * The current state of the design.\n */\n workflowState?: string;\n\n /**\n * URL to a partner-specific logo intended to display during the workflow experience.\n */\n customLogoLink?: string;\n\n /**\n * URL to a logo intended to display at the periphery of the workflow experience.\n */\n workflowFooterLogoLink?: string;\n\n /**\n * URL to the corresponding integration in the REST API.\n */\n restApiIntegrationLink?: string;\n\n /**\n * URL to redirect to when a workflow is finished.\n */\n callbackUrl?: string;\n\n /**\n * Product that this transaction belongs to.\n */\n product?: Product;\n\n /**\n * The ID of the product that this transaction belongs to.\n */\n productId?: string;\n\n /**\n * The integration product related to this lineitem.\n */\n integrationProduct?: IntegrationProductResource;\n\n /**\n * The ID of the integration product that this transaction belongs to.\n */\n integrationProductId?: string;\n\n /**\n * Whether this transaction has previously been ordered.\n */\n isOrdered?: boolean;\n\n /**\n * @deprecated use isOrdered to check whether transaction has been ordered instead.\n */\n lineItem?: LineItem;\n\n /**\n * The external product variant ID representing the design product related\n * to this transaction, null unless the createDesignProduct flag was set\n * and the design was finalized using createDesign operation.\n */\n /**@deprecated use externalCartProductVariantId or designExternalVariants[x].externalProductVariantId instead of this moving forward */\n externalDesignProductVariantId?: string;\n\n /**\n * The external product id representing the design product related\n * to this transaction, null unless the createDesignProduct flag was set\n * and the design was finalized using createDesign operation.\n */\n /**@deprecated use externalCartProductId or designExternalVariants[x].externalProductId instead of this moving forward. */\n externalDesignProductId?: string;\n\n /**\n * The external product id representing the product related to the transaction.\n * This value can hold any type of transaction such as design and standard products.\n */\n externalCartProductId?: string;\n\n /**\n * The external product variant id representing the product related to the transaction.\n * This value can hold any type of transaction such as design and standard products.\n */\n externalCartProductVariantId?: string;\n\n priceModifierTotal?: number;\n\n /**\n * URL to open the transaction in the workflow viewer.\n */\n workflowViewerLink?: string;\n\n workflowViewerReadOnlyLink?: string;\n\n previewImageLink?: string;\n\n lastSyncedAt?: string;\n\n /**\n * The users who have access to this transaction.\n */\n stakeholders?: Stakeholder[];\n\n /** The stakeholder of the currently logged in user, if applicable. */\n currentStakeholder?: Stakeholder;\n\n recipient?: Recipient;\n\n /**\n * The amount of this transaction that was, or will be, ordered\n */\n quantity?: number;\n\n createdAt?: string;\n\n printFileUrl1?: string;\n printFileUrl2?: string;\n printFileUrl3?: string;\n printFileUrl4?: string;\n printFileUrl5?: string;\n printFileName1?: string;\n printFileName2?: string;\n printFileName3?: string;\n printFileName4?: string;\n printFileName5?: string;\n\n /**\n * An array of objects containing information on additional products to add to the cart.\n * Typically only available when being passed to {@link DesignCreationMessage}\n */\n designExternalVariants?: DesignExternalVariant[];\n\n /**\n * A list of actions that have been associated to this transaction. To be used by the client to interact further post design.\n */\n transactionShareActions?: ShareAction[];\n\n /** Whether any share actions for this Transaction require the user to be authenticated as a stakeholder */\n hasAuthenticatedActions?: boolean;\n\n marketplaceThemeInstallConfiguration?: ThemeInstallConfigurationGraphQl;\n\n completed?: boolean;\n\n addressValidationStatus?: AddressValidationStatus;\n}\n\nexport enum AddressValidationStatus {\n Pending = \"Pending\",\n Failed = \"Failed\",\n Validated = \"Validated\",\n Overridden = \"Overridden\",\n}\n\nexport interface Recipient {\n id?: string;\n firstName?: string;\n lastName?: string;\n address?: string;\n suburb?: string;\n state?: string;\n email?: string;\n postalCode?: string;\n country?: string;\n mobile?: string;\n company?: string;\n apartment?: string;\n customField1?: string;\n customField2?: string;\n customField3?: string;\n customField4?: string;\n customField5?: string;\n conversionConfigurationId?: string;\n createdAt?: string;\n updatedAt?: string;\n deletedAt?: string;\n}\n\nexport interface ShareAction {\n id: string;\n type: ShareActionType;\n title?: string;\n precedence?: number;\n stakeholderType?: string;\n url?: string;\n}\n\nexport enum ShareActionType {\n Hyperlink = \"Hyperlink\",\n Edit = \"Edit\",\n Approve = \"Approve\",\n}\n\n/**\n * An object containing ids for an external product/variant that should be added to the cart alongside the base product/variant.\n */\nexport interface DesignExternalVariant {\n id?: string;\n externalProductId?: string;\n externalProductVariantId?: string;\n skuCode?: string;\n}\n\n/**\n * An integration product represents the connection of a product in SpiffCommerce with\n * a product on a third party platform.\n */\nexport interface IntegrationProductResource {\n /**\n * The ID of the IntegrationProduct entity. Used internally by SpiffCommerce.\n */\n id: string;\n /**\n * The ID of the product on the third party platform. For example a Shopify product ID.\n */\n externalProductId?: string;\n /**\n * The integration that this product is associated with. For example a Shopify integration.\n */\n integration?: Integration;\n\n /**\n * The ID of an additional product (on the third party platform) that should be added to the cart.\n */\n additionalExternalProductId?: string;\n\n /**\n * A supplementary ID for the additional product. Shopify uses the variant ids to add products to the cart.\n */\n additionalExternalVariantId?: string;\n\n /**\n * When the additionalExternalProductId is set, this is the IntegrationProduct that is associated with it.\n * If no Spiff product has been associated with the additionalExternalProductId, this will be null.\n */\n additionalIntegrationProduct?: IntegrationProductResource;\n\n /**\n * The product that this integration product is associated with.\n */\n product?: Product;\n}\n\nexport interface Integration {\n id: string;\n enabled: boolean;\n externalIntegrationId?: string;\n type?: IntegrationType;\n isCurrent?: boolean;\n theme: Theme;\n logo: string;\n partner: Partner;\n marketplaceThemeInstallConfiguration?: ThemeInstallConfigurationGraphQl;\n name?: string;\n}\n\nexport interface Theme {\n configuration?: string;\n fontAsset?: Asset;\n id?: string;\n name?: string;\n primaryColor?: string;\n secondaryColor?: string;\n textColor?: string;\n themeLayout?: {\n id?: string;\n name?: string;\n };\n}\n\nexport enum IntegrationType {\n Hub = \"Hub\",\n Shopify = \"Shopify\",\n}\n\n/**\n * Fields found in a variant within a line item resource.\n */\nexport interface LineItemVariant {\n currencyCode: string;\n optionName: string;\n priceModifier: number;\n stepName: string;\n variantName: string;\n}\n\nexport interface LineItem {\n id: string;\n transactionId?: string;\n previewImageUrl?: string;\n product: Product;\n quantity: number;\n metadata?: LineItemMetadata[];\n variants: LineItemVariant[];\n}\n\nexport interface LineItemMetadata {\n stepName: string;\n metadata: string;\n}\n\nexport interface ProductWorkflow {\n friendlyName: string;\n id: string;\n index?: number;\n present?: boolean;\n imageUrl: string;\n workflowName: string;\n}\n\nexport interface Partner {\n id?: string;\n name?: string;\n currencyCode?: string;\n customerDetailsPromptMarkdown?: string;\n activeAddons?: AddonHandle[];\n beta?: boolean;\n}\n\nexport enum AddonHandle {\n BackgroundRemover = \"BackgroundRemover\",\n ConversionAccelerator = \"Conversion Accelerator\",\n ProcessBuilder = \"ProcessBuilder\",\n}\n\nexport interface Product {\n /**\n * ID of the partner owner.\n */\n partnerId?: string;\n partner?: Partner;\n\n /**\n * Whether a line item for this product is delivered as soon as the order is received.\n */\n autoprint: boolean;\n\n /**\n * Whether this product can be quickprinted.\n */\n canQuickprint?: boolean;\n\n /**\n * The internal identifier for this product.\n */\n id: string;\n\n /**\n * The human friendly name of the product.\n */\n name: string;\n\n /**\n * A description of the Product, written in Markdown.\n */\n description?: string;\n\n /**\n * A URL to the image asset associated with this product.\n */\n imageUrl?: string;\n\n /**\n * A resource url for a 3D model used to represent this product\n * in the 3d editor. If not available we assume the product doesn't support 3D.\n */\n modelUrl?: string;\n\n /**\n * A URL for the image used as an overlay on any workflows\n * that incorporate a product overlay step.\n */\n overlayImageUrl?: string;\n\n /**\n * Words which can't be used in a workflow for this product.\n */\n profanities?: {\n id: string;\n createdAt: string;\n userId: string;\n word: string;\n }[];\n\n /**\n * The max characters that can be typed for quickprint.\n */\n quickprintMaxLength?: number;\n\n /**\n * The name of the module to use for quickprint.\n */\n quickprintModuleName?: string;\n\n /**\n * If true, the product should be displayed in the client as if it is available.\n * Should be displayed as if it is unavailable otherwise.\n */\n enabled: boolean;\n\n /**\n * Workflows which have been assigned to this product.\n */\n workflows?: ProductWorkflow[];\n\n /**\n * The base price of this product in sub units. Essentially the cost of the\n * product without any customisations applied.\n */\n basePrice?: number;\n\n /**\n * The weight of this product.\n */\n weight?: number;\n\n minimumOrderQuantity?: number;\n\n /**\n * When specified, represents a pre-rendered image of this product to be\n * displayed to customers while the 3D preview is loading.\n */\n preloadImageUrl?: string;\n\n /**\n * When set the store owner has configured this product to prompt for\n * customer details. In hosted experience, we'll offer to collect this information from the customer. In\n * bespoke UIs created using the Core SDK you will need to check this flag and request the data accordingly.\n * See attachCustomerDetails on the WorkflowExperience for how to supply us with the details you collect.\n */\n promptForCustomerDetails?: boolean;\n\n /**\n * Configuration for conversion. Optional.\n */\n conversionConfiguration?: ConversionConfiguration;\n\n integrationProducts?: IntegrationProductResource[];\n\n productTags?: ProductTag[];\n\n productImages?: ProductImage[];\n\n /**\n * The SKU of the product in the merchant's store.\n */\n sku?: string;\n\n /**\n * The Spiff SKU code for the product.\n */\n skuCode?: string;\n\n /**\n * Price breaks for this product when dealing with quantity.\n */\n priceBreaks?: ProductPriceBreak[];\n}\n\nexport interface ProductImage {\n id: string;\n precedence?: number;\n asset: Asset;\n}\n\n/**\n * A price break represents a minimum quantity of a product and the price that will be charged for that quantity.\n * This can be seen as an override for the base price of the product.\n */\nexport interface ProductPriceBreak {\n /**\n * The id of this price break.\n */\n id: string;\n /**\n * The minimum quantity of this price break. A positive integer.\n */\n minQty: number;\n /**\n * A percentage to apply to the overall price. A value between 0-1 where 1 retains 100% of the original price and 0 completely discounts it to free.\n */\n percentage: number;\n}\n\nexport interface ProductTag {\n id: string;\n name: string;\n}\n\nexport interface ColorOption {\n id?: string;\n fill?: string;\n stroke?: string;\n variant?: VariantResource;\n colorProfileAssetKey?: string;\n pmsValue?: string;\n}\n\nexport interface RegionElement {\n id: string;\n region?: Region;\n regionIndex?: number;\n}\n\nexport interface FrameMetadata {\n image: string;\n}\n\nexport interface IllustrationMetadata {\n colors: string[];\n}\n\nexport interface ModuleMetadata {\n text: string;\n}\n\nexport interface TextMetadata {\n color?: string;\n text: string;\n fillImage?: string;\n strokeColor?: string;\n}\n\nexport interface SelectionStorage {\n selectedVariants?: VariantResource[];\n}\n\nexport interface FrameStepStorage extends SelectionStorage {\n framePatternAsset?: Asset;\n currentFrameSources?: string[];\n framePatternData?: {\n originalAssetKey?: string;\n backgroundRemovedAssetKey?: string;\n useOriginalAsset?: boolean;\n };\n}\n\nexport interface TextStepStorage extends SelectionStorage {\n color?: string;\n defaultCleared?: boolean;\n inputText?: string;\n text?: string;\n customiseAllText?: boolean;\n}\n\nexport type StepSelections = {\n [key: string]: SelectionStorage;\n};\n\nexport interface FrameData {\n /**\n * The path data for a frame SVG\n */\n path: string;\n\n /**\n * The viewbox width\n */\n width: number;\n\n /**\n * The viewbox height.\n */\n height: number;\n}\n\nexport interface FrameThresholdSettings {\n // Whether to enable a black and white threshold.\n useThreshold: boolean;\n // If using threshold, whether to invert black and white.\n invertThreshold: boolean;\n // An integer from 0 to 256.\n threshold: number;\n // A number from 0 to 1.\n thresholdSaturation: number;\n}\n\n/**\n * Details relating to a model for use in the preview.\n */\nexport type ModelDetails = {\n readonly model?: string;\n readonly contextService: RenderableContextService;\n};\n\n/**\n * A renderable context represents the relationship of a texture in the 3D preview\n * with an external canvas. This context allows external clients to render to a texture\n * in the 3D preview with a simple interface.\n */\nexport type RenderableContext = {\n /**\n * A unique identifier for this renderable context.\n */\n getID(): string;\n\n /**\n * A name for this renderable.\n */\n getName(): string;\n\n /**\n * Sets the render context associated to this renderable.\n * @param ctx The context to use for rendering.\n */\n setStaticContext(ctx: CanvasRenderingContext2D): void;\n\n /**\n * Get the render context associated to this renderable.\n */\n getStaticContext(): CanvasRenderingContext2D | undefined;\n\n /**\n * Sets whether or not this renderable is dirty and will need re-rendering.\n * @param value The new value\n */\n setStaticContextDirty(value: boolean): void;\n\n /**\n * When this context has been set as dirty, returns true.\n */\n getStaticContextDirty(): boolean;\n\n /**\n * A timestamp for the last successful render of the context.\n */\n getLastCompletedStaticRender(): number | undefined;\n};\n\n/**\n * Represents a handle to a material in the 3D scene. The underlying complexity of materials is abstracted\n * away so the client doesn't need to know anything more than the ID they're given and the name.\n */\nexport type MaterialHandle = {\n /**\n * The identifier for the material.\n */\n readonly id: string;\n /**\n * The human readable name for the material.\n */\n readonly name: string;\n};\n\n/**\n * Settings related to the 3D preview.\n */\nexport type PreviewOptions = {\n /**\n * The color expected to be seen in the background of the product. Expects a hexadecimal value.\n */\n readonly backgroundColor?: string;\n /**\n * Image to be used as a background when running with transparency, the image\n * will be scaled and centered to fill the preview based on aspect ratio.\n */\n readonly backgroundImage?: string;\n /**\n * The closest zoom the camera can achieve to the product.\n */\n readonly maxZoomOverride?: number;\n /**\n * The furthest zoom the camera can achieve to the product.\n */\n readonly minZoomOverride?: number;\n /**\n * The environment file used to calculate product lighting.\n */\n readonly environmentFile?: string;\n /**\n * The intensity of the environment lighting.\n */\n readonly environmentIntensity?: number;\n /**\n * The rotation (around the y axis) of the environment lighting, in degrees.\n */\n readonly environmentRotationY?: number;\n\n /**\n * The lowest point, vertically, that the camera can rotate to.\n * https://doc.babylonjs.com/divingDeeper/cameras/camera_introduction\n */\n readonly lowerBetaLimitDeg?: number;\n\n /**\n * The highest point, vertically, that the