TrophyCustomer's Canvas is honored with a 2020 InterTech Technology Award! Learn more 

Class: AuWizard

Implements a multi-step editor.

Hierarchy

  • any

    AuWizard

Implements

Index

Properties

Methods

Properties

downloadUrl

downloadUrl: string = ""

Url of the blob object to download by the user, which is created in downloadFilesAsZip.


driver

driver: IDriver

Implementation of IEditorElement.driver

A reference to an e-commerce driver.


editorState

editorState: string = ""

An editor state calculated in createEditorSnapshot.


varManager

varManager: IVariableManager = new VariableManager(this)

An object for managing variables.

Methods

addCustomPropertyInScope

addCustomPropertyInScope(name: string, property: any): void

Adds a custom property to the compilation scope.

Parameters:

Name Type Description
name string The property name.
property any A value of the property.

Returns:void


appendVars

appendVars(varsDictionary: kvObject‹string, any›): void

Deprecated, use varManager.append() instead. Appends values to the current vars object.

Parameters:

Name Type Description
varsDictionary kvObject‹string, any› An object, which will be merged with the current vars.

Returns:void


createEditorSnapshot

createEditorSnapshot(force: boolean): Promise‹string›

Creates an editor snapshot, which can be used to restore the editor state.

Parameters:

Name Type Default Description
force boolean false If true, then this method also saves the product by using the Customer's Canvas IFrame API.

Returns:Promise‹string›

A compressed Base64 string, which can be passed to restoreEditor.


debug

debug(name: string | string[]): void

Debugs widgets.

Parameters:

Name Type Description
name string | string[] The widget name or an array of widget names for debugging.

Returns:void


downloadFile

downloadFile(url: string, filename: string, newTab: boolean): Promise‹void›

Downloads a file by URL.

Parameters:

Name Type Default Description
url string - The URL of the file that should be downloaded.
filename string - The name to be assigned to the downloaded file.
newTab boolean false If true, opens the link in a new tab.

Returns:Promise‹void›


downloadFilesAsZip

downloadFilesAsZip(files: Array‹DownloadingModel›): Promise‹string›

Downloads multiple files and packs them to a ZIP archive.

Parameters:

Name Type Description
files Array‹DownloadingModel An array of objects {url:string, filename:string} describing files that should be downloaded and zipped.

Returns:Promise‹string›

The URL of the archive.


getJsonProcessor

getJsonProcessor(): JsonProcessor

Returns an instance of the JsonProcessor.

Returns:JsonProcessor


getUncompiledWidgetNames

getUncompiledWidgetNames(): string[]

Returns:string[]


nextStep

nextStep(): void

Activates the next step in the editor.

Returns:void


prevStep

prevStep(): void

Activates the previous step in the editor.

Returns:void


restoreEditor

restoreEditor(snapshot: string): Promise‹void›

Restores the editor state.

Parameters:

Name Type Description
snapshot string A compressed Base64 string representing the editor snapshot. You can obtain this string in createEditorSnapshot.

Returns:Promise‹void›


showModal

showModal(name: string, isAutoStart: boolean): Promise‹void›

Shows a modal window by its name.

Parameters:

Name Type Default Description
name string - The name of the modal window.
isAutoStart boolean false If true, shows the modal window after initializing the editor.

Returns:Promise‹void›


showPreloader

showPreloader(isPreload: boolean, message: string): void

Shows and hides a preloader.

Under the hood, this method uses a counter to manage the preloader. If counter > 0, then it shows the preloader, otherwise, it hides the preloader. The default value of the counter is 0.

"onClick": [
  "{{#function main.showPreloader(true, 'Creating print files...')}}",
  "{{#function $['editor'].getHiResImages(800,800)}}",
  "{{#function main.showPreloader(false)}}"
]

Parameters:

Name Type Description
isPreload boolean If true, increments the counter. If false, decrements the counter.
message string A text message that appears next to the preloader icon.

Returns:void


switchToStep

switchToStep(index: number): void

Activates a step by its index.

Parameters:

Name Type Description
index number The zero-based index of the required step.

Returns:void