📘

Examples available

https://github.com/claspo/claspo-plugin-examples

We provide a set of JavaScript objects to manage website widgets.

Main script STATIC_RESOURCES_URL/script.esm.js includes WidgetAPI class.


WidgetAPI

constructor

Parameters

ParameterTypeDescription
configobject

config example

{
  staticResourcesUrl: 'STATIC_RESOURCES_URL'
}

showWidget

Parameters

ParameterTypeDescription
documentModelobjectAppearance model that was saved from the editor
widgetConfigobjectSet of widget specific parameters, see below

widgetConfig

{
      type: 'BUILT_IN',
      placements: [{
        selector: '#widget',
        insertType: 'AFTER_BEGIN'
      }]
    }

Example

https://github.com/Claspo/claspo-plugin-examples/blob/main/basic/script.html#L17-L24