Open admirkrilasevic opened 3 weeks ago
vite.config.lib.ts
yarn build:lib
that relies on this configdist/lib
package.json
has been modified to allow publishing from dist/lib
To test locally:
yarn build:lib
yalc publish --private
yalc link @dialob/dialob-composer-material
Config example:
const renderDialobComposer = (targetElement: HTMLElement, appConfig: any) => {
const FORM_ID = appConfig.formId;
const baseUrl = window.location.origin;
const DIALOB_COMPOSER_CONFIG: BackendTypes.DialobComposerConfig = {
transport: {
csrf: appConfig.csrfHeader ? {
headerName: appConfig.csrfHeader,
token: appConfig.csrf
} : undefined,
apiUrl: appConfig.backend_api_url.includes('://') ? appConfig.backend_api_url : baseUrl + appConfig.backend_api_url,
previewUrl: appConfig.filling_app_url,
tenantId: appConfig.tenantId || undefined,
credentialMode: appConfig.credentialMode || undefined,
},
documentationUrl: 'https://github.com/dialob/dialob-parent/wiki/',
itemEditors: ITEM_EDITORS,
itemTypes: ITEMTYPE_CONFIG,
closeHandler: () => window.location.href = appConfig.adminAppUrl,
};
ReactDOM.createRoot(targetElement!).render(
<React.StrictMode>
<ThemeProvider theme={siteTheme}>
<CssBaseline />
<DialobComposer config={DIALOB_COMPOSER_CONFIG} formId={FORM_ID} />
</ThemeProvider>
</React.StrictMode>,
)
};
window.renderDialobComposer = renderDialobComposer;
Custom app example (with new MUI theme, and phone inputs added):
/frontend
that shows integration of new library to target app with customization
yarn build:items
that creates a separate build for the contents of the items folder - Group, Item, Note etc