@skodaflow/widget-loader
v0.0.15
Published
Common components for k2tool apps.
Downloads
267
Readme
Widget Loader
The loader widget helps with the integration of K2NGTolls applications. It loads the widget script, passes the widget configuration, inserts the necessary external dependencies, and finally connects the application to the integrator's page.
Installation
via npm
npm install @skodaflow/widget-loader --save
Usage
Widget Loader can be used as React component as following
import WidgetLoader from '@skodaflow/widget-loader';
import * as MaterialUI from '@mui/material';
import * as MaterialUIStyles from '@mui/material/styles';
import * as EmotionReact from '@emotion/react';
import * as EmotionStyled from '@emotion/styled';
<WidgetLoader
source='https://www.widgetLocation/script.min.js'
deps={{ MaterialUI, MaterialUIStyles, EmotionReact, EmotionStyled }}
options={{
endpoint: 'endpoint',
bid: 'bid',
culture: 'culture',
...otherWidgetSettings
}} />
- source - url - location of widget script
- deps - external widget dependencies
- options - widget options
- endpoint - url - widget api
- bid - importer code
- culture - culture code
- otherWidgetSettings - other optional widget settings