Skip to main content

au-widget-design-editor/au-widget-design-editor

Classes

AuWidgetDesignEditor

A widget that is used to integrate Design Editor 5+.

For details, you can refer to the DesignEditor widget topic.

{
"widgets": [
{
"name": "editor",
"type": "design-editor",
"title": "Personalize your flyer",
"params": {
"initial": {
"productDefinition": {
"surfaces": `[{
"width": 436.6,
"height": 612.2
}]`
},
"editorConfig": { "initialMode": "Advanced" }
}
}
},
{
"name": "preview",
"type": "image-carousel",
"params": {
"containerColor": "#ccc",
"images": [{ "url": "{{$['editor'].proofImageUrls[0][0]}}" }]
}
}
],
"steps": [
{
"name": "design",
"title": "1. Design",
"mainPanel": { "name": "editor" }
},
{
"name": "approve",
"title": "2. Preview",
"mainPanel": { "name": "preview" },
"onActivate": "{{#function $['editor'].getHiResImages(800,800)}}"
}
]
}

Extends

Implements

Constructors

Constructor
new AuWidgetDesignEditor(): AuWidgetDesignEditor;
Returns

AuWidgetDesignEditor

Inherited from

AuDesignEditor.constructor

Properties

actionsFinished
actionsFinished: boolean = false;

This property is set to true when the editor enters the idle state.

actionsFinishedPromise
actionsFinishedPromise: Deferred<string>;
customButtonCb
customButtonCb: (sender, customData) => void;
Parameters
ParameterType
senderstring
customDataany
Returns

void

dpApi
dpApi: PrivateDesignProcessorApiClient;
isRestored
isRestored: boolean = false;
itemsData
itemsData: kvObject<string, CanvasItemData> = {};

Personalization data for design elements.

itemsOnSurfacesCount
itemsOnSurfacesCount: number[] = [];
modifiedItem?
optional modifiedItem?: DesignEditorItemChanges = null;

Last modified item on the canvas.

params
params: IDesignEditorDefinitionParams;

Compiled widget configuration.

Overrides

AuDesignEditor.params

selectedGroupBoundsData?
optional selectedGroupBoundsData?: IBoundsData;

Accessors

allItems
Get Signature
get allItems(): Item[];

Gets all design elements in the product.

Returns

Item[]

An array of ObjectModel.Item elements.

artLinkItems
Get Signature
get artLinkItems(): IArtLinkItem[];

Gets all images added from ArtLink

Returns

IArtLinkItem[]

boundsData
Get Signature
get boundsData(): Object;

Width, height, and upper-left corner coordinates of the bounding rectangle of all items in a group, in points. For details, see the Calculating Area of Design Layers topic.

Returns

Object

currentSurfaceIndex
Get Signature
get currentSurfaceIndex(): number;

Gets the index of the current surface.

Returns

number

currentSurfaceName
Get Signature
get currentSurfaceName(): string;

Gets the name of the current surface.

Returns

string

depositPhotos
Get Signature
get depositPhotos(): IDepositPhotosItem[];

Gets all images added from DepositPhotos.

Returns

IDepositPhotosItem[]

finishProductDesignResult
Get Signature
get finishProductDesignResult(): IFinishDesignResult;

Return last computed value by calculateIdentifyingString(string)

Returns

IFinishDesignResult

hiResUrls
Get Signature
get hiResUrls(): string[];

Gets URLs that link to high-resolution print files.

Returns

string[]

identifyingString
Get Signature
get identifyingString(): string;

Return last computed value by calculateIdentifyingString(string)

Returns

string

proofImageUrls
Get Signature
get proofImageUrls(): string[][];

Gets temporary URLs that link to proof images.

Returns

string[][]

proofPdfUrls
Get Signature
get proofPdfUrls(): string[];

Gets temporary URLs that link to proof PDF images.

Returns

string[]

sourcedItems
Get Signature
get sourcedItems(): ISourcedItemsInfo;

Gets all items by source

Returns

ISourcedItemsInfo

stateId
Get Signature
get stateId(): string;

Gets the identifier of the last saved state file.

Returns

string

Set Signature
set stateId(value): void;

Sets the identifier of the last saved state file.

Parameters
ParameterType
valuestring
Returns

void

surfaceCount
Get Signature
get surfaceCount(): number;

Get the count of surfaces in product.

Returns

number

tags
Get Signature
get tags(): ITagsDictionary;

Gets product tags.

Returns

ITagsDictionary

An ObjectModel.ITagsDictionary.

token
Get Signature
get token(): string;

Returns the current user token.

Returns

string

userChanges
Get Signature
get userChanges(): IUserChanges;

Gets an object containing all changes made by the user when personalizing the product.

Returns

IUserChanges

An object representing IUserChanges.

userId
Get Signature
get userId(): string;

Gets the identifier of the user who currently works with the editor.

Returns

string

variableData
Get Signature
get variableData(): IVariable[];

Gets all variable items in the product.

Returns

IVariable[]

An array of ObjectModel.IVariable elements.

violationData
Get Signature
get violationData(): IViolationWarningData[];
Returns

IViolationWarningData[]

violationWarningData
Get Signature
get violationWarningData(): IViolationWarningData[];

For items having preflight problems, it provides the item name, item type, corresponding surface name and index, and states of violation warnings. This array allows for detecting products that have violations of the image resolution, safety lines, regions, and text clipping.

Returns

IViolationWarningData[]

Methods

addSurface()
addSurface(surface, position?): Promise<Product>;

Adds a product surface.

Parameters
ParameterTypeDescription
surfaceanyA surface (page) to add.
position?numberSurface position (zero-based, optional). By default, this method adds pages to the end of the surface array.
Returns

Promise<Product>

addSurfaces()
addSurfaces(surfaces, position?): Promise<Product>;

Adds product surfaces.

Parameters
ParameterTypeDescription
surfacesanySurfaces (pages) to add.
position?numberSurfaces position (zero-based, optional).
Returns

Promise<Product>

applyViewerSettings()
applyViewerSettings(params): Promise<any>;

Executes the setViewerSettings command.

Parameters
ParameterTypeDescription
paramsIDesignEditorDefinitionSetViewerSettingsThe settings of the zoom level in the editor.
Returns

Promise<any>

calculateIdentifyingString()
calculateIdentifyingString(template): Promise<string>;

Calculate identifyig string by template.

Parameters
ParameterTypeDescription
templatestringtemplate string
Returns

Promise<string>

checkInitDependenciesWidgets()
checkInitDependenciesWidgets(): string[];

Returns an array of widget names, due to which the current widget cannot receive parameters.

Returns

string[]

Inherited from

AuDesignEditor.checkInitDependenciesWidgets

colorToHex()
colorToHex(color): Promise<string>;
Parameters
ParameterType
colorColor
Returns

Promise<string>

Inherited from

AuDesignEditor.colorToHex

countItemsOnSurfaces()
countItemsOnSurfaces(onPrintArea?): Promise<void>;

Count items on surfaces and push counters to this.itemsOnSurfacesCount

Parameters
ParameterTypeDefault valueDescription
onPrintAreabooleanfalseboolean flag showing if we should count only items laying inside print areas; working only with DE 6.3.0+
Returns

Promise<void>

createPrivateDesignFromPublicDesign()
createPrivateDesignFromPublicDesign(stateId): Promise<string>;
Parameters
ParameterType
stateIdstring
Returns

Promise<string>

createPrivateDesignFromResources()
createPrivateDesignFromResources(resourceId): Promise<string>;
Parameters
ParameterType
resourceIdstring
Returns

Promise<string>

exportWidgetData()
exportWidgetData(force): Promise<CanvasData>;

Serializes the DesignEditor widget.

Parameters
ParameterTypeDescription
forcebooleanIf true, saves the product to a state file and returns its ID. If false, only returns the identifier of a previously saved state.
Returns

Promise<CanvasData>

A promise with the stateId property.

{ stateId: string }
Implementation of

IRestorableWidget.exportWidgetData

finishProductDesign()
finishProductDesign(options?, data?): Promise<any>;

Call finishProductDesign from Editor.

Parameters
ParameterType
options?IFinishProductDesignOptions
data?IVdpData
Returns

Promise<any>

getAllItems()
getAllItems(): Promise<Item[]>;

Gets all design elements in the product.

Returns

Promise<Item[]>

A promise with an array of ObjectModel.Item elements.

getArtLinkItems()
getArtLinkItems(): Promise<IArtLinkItem[]>;

Gets info about images added from ArtLink.

For more details, you can refer to the topic describing how Customers's Canvas works with Depositphotos Assets.

Returns

Promise<IArtLinkItem[]>

A promise with an array of names and values of the variable fields.

getDepositPhotos()
getDepositPhotos(): Promise<IDepositPhotosItem[]>;

Gets info about images added from DepositPhotos.

For more details, you can refer to the topic describing how Customers's Canvas works with Depositphotos Assets.

Returns

Promise<IDepositPhotosItem[]>

A promise with an array of names and values of the variable fields.

getDesignEditorItemModel()
getDesignEditorItemModel(item): Promise<DesignEditorItemChanges>;
Parameters
ParameterType
itemany
Returns

Promise<DesignEditorItemChanges>

Inherited from

AuDesignEditor.getDesignEditorItemModel

getEditor()
getEditor(): Promise<Editor>;

Returns a promise with an instance of the DesignEditor.

Returns

Promise<Editor>

Inherited from

AuDesignEditor.getEditor

getHiResImages()
getHiResImages(
width?,
height?,
stateId?,
pregeneratePreviewImages?,
filename?,
data?,
options?): Promise<string[]>;

Saves a state, renders print files and proof images, and returns links to the print files.

This method is equivalent to editor.finishProductDesign from the IFrame API.

Parameters
ParameterTypeDefault valueDescription
widthnumber800The maximum width of proof images.
heightnumber800The maximum height of proof images.
stateId?string | objectundefinedA custom state file name without an extension, up to 36 symbols length.
pregeneratePreviewImages?booleanfalseIf true, this method starts generating preview images in the background when called. In this case, the resulting links to these images will be obtained before the image generation is complete. If false, this method only updates links to these images and starts generating the preview images when a request to download them is received.
filename?stringundefinedThe name of the downloaded file
data?IVdpDataundefinedThe VDP data.
options?THiResImagesOptionsundefined-
Returns

Promise<string[]>

A promise with an array of URLs that link to the rendered print files.

getItemsBySource()
getItemsBySource(sourceType): Promise<ISourcedItemsInfo>;
Parameters
ParameterType
sourceTypestring
Returns

Promise<ISourcedItemsInfo>

getItemText()
getItemText(itemName): Promise<string>;

Returns the content of a text item.

Parameters
ParameterTypeDescription
itemNamestringThe name of the text item.
Returns

Promise<string>

getProduct()
getProduct(): Promise<Product>;

Returns a promise with the product opened in the DesignEditor.

Returns

Promise<Product>

Inherited from

AuDesignEditor.getProduct

getProofImages()
getProofImages(
width?,
height?,
pregeneratePreviewImages?,
generateProductProof?,
generateLargePreviews?,
largePreviewMaxWidth?,
largePreviewMaxHeight?,
data?,
options?): Promise<string[]>;

Renders proof images and returns URLs that link to these images.

This method is equivalent to editor.getProofImages in the IFrame API.

Parameters
ParameterTypeDefault valueDescription
widthnumber | Object800If number, defines the maximum width of proof images. If object, contains parameters for the editor.getProofImages() method; in this case, other parameters will be ignored.
heightnumber800The maximum height of proof images.
pregeneratePreviewImagesboolean | objecttrueIf true, this method starts generating preview images in the background when called. In this case, the resulting links to these images will be returned before the image generation is complete. If false, this method only returns links to these images and starts generating the preview images when a request to download them is received.
generateProductProofbooleanfalseIf true, this method renders previews of all product pages to a multi-page PDF file.
generateLargePreviewsbooleanfalseIf true, this method renders real-size preview images.
largePreviewMaxWidthnumber1000The maximum width of large preview images.
largePreviewMaxHeightnumber1000The maximum height of large preview images.
data?IVdpDataundefinedThe VDP data.
options?TProofImagesOptionsundefined-
Returns

Promise<string[]>

A promise with an array of temporary links to proof images.

getProofPdf()
getProofPdf(
data?,
paramsObj?,
isForce?): Promise<string[]>;

Renders proof PDF images and returns URLs that link to these images.

This method is equivalent to editor.getProofImages in the IFrame API when the param generateProductProof is true.

Parameters
ParameterTypeDefault valueDescription
data?IVdpDataundefinedThe VDP data.
paramsObj?IGetProofImagesOptions{}-
isForce?booleanfalse-
Returns

Promise<string[]>

getSurfaceCount()
getSurfaceCount(): Promise<number>;

Get the surface count from product and set surfaceCount prop value

Returns

Promise<number>

getTags()
getTags(): Promise<ITagsDictionary>;

Gets product tags.

Returns

Promise<ITagsDictionary>

A promise with an ObjectModel.ITagsDictionary.

getToken()
getToken(): Promise<string>;

Generates the current user token based on the token property.

Returns

Promise<string>

getVariableData()
getVariableData(): Promise<IVariable[]>;

Detects what particular variable fields are used in the design and returns an array of such fields.

This method is equivalent to product.getVariableItems from the IFrame API.

Returns

Promise<IVariable[]>

A promise with an array of names and values of the variable fields.

getViolationData()
getViolationData(): Promise<IViolationWarningData[]>;

Get violation data from DesignEditor.

Returns

Promise<IViolationWarningData[]>

initDpApi()
initDpApi(): void;
Returns

void

openAssetManagerFor()
openAssetManagerFor(itemName): Promise<void>;

Opens the Asset manager to select the content of an image placeholder.

Parameters
ParameterTypeDescription
itemNamestringThe name of the placeholder item.
Returns

Promise<void>

openGalleryForBackground()
openGalleryForBackground(): Promise<void>;

Opens the Asset manager to select the background.

Returns

Promise<void>

removeSurface()
removeSurface(surfaceIndex): Promise<Product>;

Removes a product surface.

Parameters
ParameterTypeDescription
surfaceIndexnumberA zero-based index of the surface which you want to remove.
Returns

Promise<Product>

resetPreloaderState()
resetPreloaderState(): void;
Returns

void

Inherited from

AuDesignEditor.resetPreloaderState

restoreWidgetFromData()
restoreWidgetFromData(widgetData, force?): Promise<void>;

Deserializes the DesignEditor widget.

In a common scenario, the multistep editor restores a canvas when it is initialized.

Parameters
ParameterTypeDefault valueDescription
widgetDataCanvasDataundefinedAn object containing the stateId property.
forcebooleanfalseIf true, gets a product definition from the state file and then executes the initial command. If false, it does nothing.
Returns

Promise<void>

Implementation of

IRestorableWidget.restoreWidgetFromData

saveProduct()
saveProduct(stateId?, data?): Promise<ISaveProductResult>;

Saves a product.

This method is equivalent to editor.saveProduct from the IFrame API.

Parameters
ParameterTypeDescription
stateId?stringA custom state file name without an extension, up to 36 symbols length.
data?IVdpDataThe VDP data.
Returns

Promise<ISaveProductResult>

A promise with identifiers of the user and the saved state file.

setTags()
setTags(newTags): Promise<void>;

Sets product tags.

This method is equivalent to product.setTags from the IFrame API.

Parameters
ParameterTypeDescription
newTagsanyThe tags that you want to specify for the product. These tags will reset existing product tags.
Returns

Promise<void>

showPreloader()
showPreloader(
isPreload,
message?,
timeout?): void;

Shows a preloader.

"onClick": [
"{{#function main.showPreloader(true, 'Creating print files...')}}",
"{{#function $['editor'].getHiResImages(800,800)}}",
"{{#function main.showPreloader(false)}}"
]
Parameters
ParameterTypeDefault valueDescription
isPreloadbooleanundefinedIf true, enables the preloader.
messagestring | string[]...A text message that appears next to the preloader.
timeoutnumber5-
Returns

void

Inherited from

AuDesignEditor.showPreloader

showToast()
showToast(data?, duration?): void;

Shows a toast.

return editor.loadUserInfo(data)
.catch(err => {
this.widget.showToast("Error: Invalid data");
console.log(err);
});
Parameters
ParameterTypeDescription
data?stringA string message to display in the toast.
duration?numberDefines how long to show the toast for.
Returns

void

Inherited from

AuDesignEditor.showToast

swapSurfaces()
swapSurfaces(lhsSurfaceIndex, rhsSurfaceIndex): Promise<Product>;

Swaps two surfaces (pages) in the product.

Parameters
ParameterTypeDescription
lhsSurfaceIndexnumberIndex of the first surface (page) to swap.
rhsSurfaceIndexnumberIndex of the second surface (page) to swap.
Returns

Promise<Product>

switchItemContent()
switchItemContent(model): Promise<void>;
Parameters
ParameterType
modelSwitchItemContentModel
Returns

Promise<void>

switchSurfaceTo()
switchSurfaceTo(surfaceIndex): Promise<Product>;

Changes product pages in Customer's Canvas.

Parameters
ParameterTypeDescription
surfaceIndexnumberA zero-based index of the surface on which you want to switch.
Returns

Promise<Product>

updateSurfaces()
updateSurfaces(mode, update): Promise<Product>;

Adds or removes a surface.

Parameters
ParameterTypeDescription
modestringUpdate mode - 'add' or 'remove'.
updateanyThe index of a surface to be removed or a surface to be added (depends on the mode).
Returns

Promise<Product>

References

widget

Renames and re-exports AuWidgetDesignEditor

Was this page helpful?