dialob / dialob-parent

Apache License 2.0
1 stars 1 forks source link

Vite component build #206

Open admirkrilasevic opened 3 weeks ago

admirkrilasevic commented 3 weeks ago
admirkrilasevic commented 2 weeks ago

To test locally:

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): image

baseline is now complete, but more testing needs to be done

TODO: