UI Object

The ui object of the { api, ui } pair that printessLoader.load() returns, as declared by iPrintessComponent in printess-editor.d.ts. Printess calls most of that interface itself; the members below are the ones a shop page calls. See Printess Editor Integration for the embedding they belong to. Custom types referenced below (parameter and return shapes) are documented on the Types reference.

addToBasket

addToBasket(): Promise<void>

Runs the add-to-basket flow of the editor’s basket button, for a website which triggers the checkout from a button of its own. It waits for running image uploads, validates all inputs - a validation error shows the validation dialog and ends the flow here -, runs the “onCheckout” script, saves the design and finally calls the addToBasketCallback of your attach parameters. It does nothing before a template has loaded.

Returns: Promise<void>

Used in these examples:

closeGenericDialog

closeGenericDialog(): void

Closes the dialog that openGenericDialog() opened. Your cancelCallback does not run.

Returns: void

currentTheme

currentTheme(): string

Returns the name of the theme the editor shows at the moment.

Returns: string

disableGenericDialogButtons

disableGenericDialogButtons()

Greys out the OK and the Cancel button of the open dialog and stops them from reacting to a click. Use it while your own code is working on what the Buyer entered.

Returns: void

enableGenericDialogButtons

enableGenericDialogButtons()

Makes the OK and the Cancel button of the open dialog clickable again after disableGenericDialogButtons().

Returns: void

hide

hide(): void

Hides the fullscreen editor and closes its open dialogs. Printess also detaches its event handlers, so your page works normally again while the editor is hidden. In an integration with a container your page owns that element, so nothing is hidden here.

Returns: void

Used in these examples:

hideProgressOverlay

hideProgressOverlay(): void

Removes the progress overlay that showProgressOverlay() opened.

Returns: void

loadTheme

loadTheme(themeName: string): Promise<void>

Loads another Buyer Side UI theme into the open editor, by its name in the Theme Manager. The design of the Buyer stays as it is, only the user interface around it changes.

Parameter Type Description
themeName string The name of the theme, or an empty string for the default theme.

Returns: Promise<void>

openGenericDialog

openGenericDialog(options: IGenericDialogOptions): Promise<HTMLDivElement>

Opens a dialog in the style of the editor, with your headline, your message and an OK and a Cancel button. Your callback runs when the Buyer presses OK, your cancelCallback when they press Cancel. Return "keep-open" from either one to leave the dialog open.

Parameter Type Description
options IGenericDialogOptions The headline, the labels, the message and the callbacks of the dialog.

Returns: Promise<HTMLDivElement> — The content element of the open dialog, so you can put your own HTML into it.

refreshPriceDisplay

refreshPriceDisplay(info: iExternalPriceDisplay): void

Writes the price, the old price and the legal notice into the basket panel of the editor. Call this from your priceChangeCallback as soon as your shop has calculated the new price.

Parameter Type Description
info iExternalPriceDisplay The price to show, and optionally an old price, a legal notice and the product name.

Returns: void

Used in these examples:

show

show(): void

Shows the fullscreen editor again after hide(), and attaches its event handlers again. The design stays as the Buyer left it. In an integration with a container your page owns that element, so nothing is shown here.

Returns: void

Used in these examples:

showProgressOverlay

showProgressOverlay(msg: string): void

Covers the editor with a progress overlay and shows your message in it. Use it while your own shop code is working, for example after the add-to-basket callback, and always end with hideProgressOverlay().

Parameter Type Description
msg string The message to show in the overlay.

Returns: void