au-widget-preflight/au-widget-preflight
Classes
AuWidgetPreflight
A widget that is used to verify that pre-designed user files are compatible with your printing equipment.
For details, you can refer to the Preflight widget topic.
{
"widgets": [{
"name": "preflight",
"type": "preflight",
"params": {
"config": {
"backendUrl": "http://preflight.example.com",
"product": {
"dpi": 300,
"size": {
"width": 595,
"height": 842
},
"bleed": 20,
"safetyLines": `[{
"color": "#00ff00",
"altColor": "#00ff00",
"margin": 40
}]`
},
"rules": [
{
"type": "colorspace",
"severity": "error",
"enableFix": true,
"params": {
"allowedColorSpaces": [ "cmyk" ]
}
}
],
...
}
}]
}
You can find the detailed description of the preflight configuration in the config reference.
Extends
Implements
Properties
failedChecks
failedChecks: FailedChecksModel;
An object containing two arrays, errors and warnings, with failed validation rules.
hasEmptyPages
hasEmptyPages: boolean = false;
If true, user upload file for every page.
hasFiles
hasFiles: boolean = false;
If true, user upload at least one file.
hires
hires: string[] = [];
A string array of URLs that link to the print-ready file in PDF format.
origins
origins: OriginModel[] = [];
An array of links to origin images of product pages.
page
page: PreflightToolStep;
The current preflight page - either uploader or editor.
params
params: any;
Compiled widget configuration.
Inherited from
preview
preview: string[] = [];
A string array of URLs that link to proof images.
previews
previews: PreviewModel[] = [];
stateId
stateId: string = "";
The identifier of the last saved state file.
userId
userId: string = "";
The identifier of the user in the ecommerce system.
Accessors
pages
Get Signature
get pages(): number;
Gets the number of pages.
Returns
number
Methods
checkInitDependenciesWidgets()
checkInitDependenciesWidgets(): string[];
Returns an array of widget names, due to which the current widget cannot receive parameters.
Returns
string[]
Inherited from
AuBaseWidget.checkInitDependenciesWidgets
exportWidgetData()
exportWidgetData(force): Promise<PreflightExportData>;
Parameters
| Parameter | Type |
|---|---|
force | boolean |
Returns
Promise<PreflightExportData>
Implementation of
IRestorableWidget.exportWidgetData
getPreviews()
getPreviews(): Promise<PreviewModel[]>;
Gets preview images.
Returns
Promise<PreviewModel[]>
getResults()
getResults(renderPreview?): Promise<FinishModel>;
Gets links to print-ready and preview images and origin files.
Parameters
| Parameter | Type | Default value |
|---|---|---|
renderPreview | boolean | true |
Returns
Promise<FinishModel>
languageObserver()
languageObserver(lang): void;
Parameters
| Parameter | Type |
|---|---|
lang | string |
Returns
void
resetPreloaderState()
resetPreloaderState(): void;
Returns
void
Inherited from
AuBaseWidget.resetPreloaderState
restoreWidgetFromData()
restoreWidgetFromData(data, force): Promise<void>;
Parameters
| Parameter | Type |
|---|---|
data | PreflightExportData |
force | boolean |
Returns
Promise<void>
Implementation of
IRestorableWidget.restoreWidgetFromData
saveProduct()
saveProduct(renderPreview?): Promise<SaveProductModel>;
Saves the product to private state in Asset Storage and returns the state ID. Also return origin files and preview images if rendering is enabled by parameter renderPreview.
Parameters
| Parameter | Type | Default value |
|---|---|---|
renderPreview | boolean | false |
Returns
Promise<SaveProductModel>
setFiles()
setFiles(fileUrls): Promise<void>;
Inserts files into the current product starting from the first page.
Parameters
| Parameter | Type | Description |
|---|---|---|
fileUrls | string[] | An array of links to the files. |
Returns
Promise<void>
setStep()
setStep(step): Promise<void>;
Sets the current preflight page.
Parameters
| Parameter | Type | Description |
|---|---|---|
step | PreflightToolStep | You can enable either uploader or editor. |
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
| Parameter | Type | Default value | Description |
|---|---|---|---|
isPreload | boolean | undefined | If true, enables the preloader. |
message | string | string[] | ... | A text message that appears next to the preloader. |
timeout | number | 5 | - |
Returns
void
Inherited from
showToast()
showToast(data?, duration?): void;
Shows a toast.
return editor.loadUserInfo(data)
.catch(err => {
this.widget.showToast("Error: Invalid data");
console.log(err);
});
Parameters
| Parameter | Type | Description |
|---|---|---|
data? | string | A string message to display in the toast. |
duration? | number | Defines how long to show the toast for. |
Returns
void
Inherited from
References
widget
Renames and re-exports AuWidgetPreflight