Web-component API
The Web Component API allows you to interact with a web component by calling its methods or receiving and modifying data using its properties, as well as events that the web component sends.
To work with the Web Component API, you need to obtain the appropriate HTML element using any method available in the Document Object Model (DOM). For example, you can use the getElementsByTagName method:
const editor = document.getElementsByTagName("au-template-editor")[0];
After obtaining the element, you can use the API as follows:
const imageResolutionsData = editor.getImagesResolution();
The API of the web component will only be available after it has been loaded and initialized.
Methods
init(configuration)
Description: Initializes the component after reading parameters from the workflow and opening a design.
Arguments:
configuration:ITemplateEditorInitArgs
Returns: void
The configuration object includes integration settings, the design to open, and editor settings. For details, refer to the Initialization, Settings, and Resources topics.
Example:
editor.init({
configVersion: 2,
integration: {
tenantId: <yourTenantId>,
user: {
id: <userId>,
token: <userToken>
},
storefrontId: <yourStorefrontId>,
cchubApiGatewayUrl: "https://api.customerscanvashub.com"
},
input: {
designTemplateId: <templateId>
},
settings: {
itemBuilder: {
image: { borderWidth: 10, borderColor: "rgb(255, 0, 13)" }
},
listSettings: { bulletChar: "*" }
}
});