@beinformed/ui 1.27.2 → 1.27.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (46) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/esm/constants/Constants.js +5 -0
  3. package/esm/constants/Constants.js.map +1 -1
  4. package/esm/constants/Settings.js +6 -4
  5. package/esm/constants/Settings.js.map +1 -1
  6. package/esm/models/application/ApplicationModel.js +6 -3
  7. package/esm/models/application/ApplicationModel.js.map +1 -1
  8. package/esm/modularui/Authenticate.js +25 -13
  9. package/esm/modularui/Authenticate.js.map +1 -1
  10. package/esm/react/ErrorBoundaryFallback.js +3 -0
  11. package/esm/react/ErrorBoundaryFallback.js.map +1 -1
  12. package/esm/react-server/serverNoSSR.js +5 -2
  13. package/esm/react-server/serverNoSSR.js.map +1 -1
  14. package/esm/react-server/serverUtil.js +1 -0
  15. package/esm/react-server/serverUtil.js.map +1 -1
  16. package/lib/constants/Constants.js +7 -1
  17. package/lib/constants/Constants.js.flow +5 -0
  18. package/lib/constants/Constants.js.map +1 -1
  19. package/lib/constants/Settings.js +5 -3
  20. package/lib/constants/Settings.js.flow +7 -3
  21. package/lib/constants/Settings.js.map +1 -1
  22. package/lib/models/application/ApplicationModel.js +6 -3
  23. package/lib/models/application/ApplicationModel.js.flow +10 -5
  24. package/lib/models/application/ApplicationModel.js.map +1 -1
  25. package/lib/modularui/Authenticate.js +24 -12
  26. package/lib/modularui/Authenticate.js.flow +30 -13
  27. package/lib/modularui/Authenticate.js.map +1 -1
  28. package/lib/react/ErrorBoundaryFallback.js +3 -0
  29. package/lib/react/ErrorBoundaryFallback.js.flow +2 -0
  30. package/lib/react/ErrorBoundaryFallback.js.map +1 -1
  31. package/lib/react-server/serverNoSSR.js +5 -2
  32. package/lib/react-server/serverNoSSR.js.flow +5 -1
  33. package/lib/react-server/serverNoSSR.js.map +1 -1
  34. package/lib/react-server/serverUtil.js +1 -0
  35. package/lib/react-server/serverUtil.js.flow +2 -0
  36. package/lib/react-server/serverUtil.js.map +1 -1
  37. package/package.json +3 -3
  38. package/src/constants/Constants.js +5 -0
  39. package/src/constants/Settings.js +7 -3
  40. package/src/models/application/ApplicationModel.js +10 -5
  41. package/src/modularui/Authenticate.js +30 -13
  42. package/src/react/ErrorBoundaryFallback.js +2 -0
  43. package/src/react-server/serverNoSSR.js +5 -1
  44. package/src/react-server/serverUtil.js +2 -0
  45. package/types/constants/Constants.d.ts +5 -0
  46. package/types/modularui/Authenticate.d.ts +8 -1
@@ -1 +1 @@
1
- {"version":3,"file":"serverUtil.js","names":["createReduxStore","requestHref","customReducers","initialState","history","createMemoryHistory","initialEntries","toString","store","configureStore","setI18n","locales","request","Array","isArray","IllegalArgumentException","mergedLocales","availableLocales","locale","code","customLocale","custLocale","deepmerge","forEach","some","push","enabledLocales","getSetting","localesInstance","Locales","preferredLocale","getPreferredLocale","dispatch","setLocales","setServerPreferencesFromArray","serverPreferences","serverPreference","name","defaultValue","type","setServerPreference","setServerPreferences","setAllContentInDataSetting","setLoginPreferences","preferencesProvider","isStudioContext","setPreference","setConfigurationTheme","configTheme","configFileLocation","getLayoutConfigFileLocation","configFilePath","dataFetcher","fetch","setThemePreference","Error","setApplication","getLocale","getState","application","ModularUIRequest","fetchSync","initModels","key","model","e","console","info","handleErrors","state","error","shouldThrowOnServer","has","dehydrate","modularui","status","lastModification","undefined","filteredState","replace","createHead","sheet","UUID","helmetContext","style","getStyleTags","meta","helmet"],"sources":["../../src/react-server/serverUtil.js"],"sourcesContent":["// @flow\nimport { createMemoryHistory } from \"history\";\nimport { has } from \"../utils/helpers/objects\";\nimport deepmerge from \"deepmerge\";\n\nimport configureStore from \"../redux/store/configureStore\";\n\nimport { availableLocales } from \"../i18n/Locales\";\nimport Locales from \"../i18n/Locales\";\n\nimport { getPreferredLocale } from \"./requestInformation\";\nimport { setLocales } from \"../redux/_i18n/I18nActions\";\n\nimport {\n setServerPreference,\n setThemePreference,\n setPreference,\n setAllContentInDataSetting,\n setLoginPreferences,\n} from \"../redux/actions/Preferences\";\n\nimport { getSetting } from \"../constants/Settings\";\n\nimport { IllegalArgumentException } from \"../exceptions\";\n\nimport { initModels } from \"../redux\";\nimport { getLocale } from \"../redux/selectors/i18n\";\n\nimport ModularUIRequest from \"../modularui/ModularUIRequest\";\n\nimport type { LocaleConfiguration } from \"../i18n/types\";\nimport type { ReduxState, ReduxStore } from \"../redux/types\";\nimport type Href from \"../models/href/Href\";\nimport type { RouterHistory } from \"react-router\";\n\nexport type PreferenceValue = {\n name: string,\n defaultValue?: string | null,\n type?: string,\n};\n\n/**\n */\nconst createReduxStore = (\n requestHref: Href,\n customReducers: Object,\n initialState?: $Shape<ReduxState>\n): ReduxStore => {\n // $FlowExpectedError\n const history: RouterHistory = createMemoryHistory({\n initialEntries: [requestHref.toString()],\n });\n\n const { store } = configureStore(history, customReducers, initialState);\n\n return store;\n};\n\n/**\n */\nconst setI18n = (\n store: ReduxStore,\n locales: Array<LocaleConfiguration> = [],\n request: HttpServletRequestJava\n) => {\n if (!Array.isArray(locales)) {\n throw new IllegalArgumentException(\"locales must be an array of objects\");\n }\n if (!request) {\n throw new IllegalArgumentException(\"missing request argument\");\n }\n\n const mergedLocales = availableLocales.map((locale) => {\n const code = locale.code;\n const customLocale = locales.find((custLocale) => custLocale.code === code);\n\n if (customLocale) {\n return deepmerge(locale, customLocale);\n }\n\n return locale;\n });\n\n locales.forEach((customLocale) => {\n if (!mergedLocales.some((locale) => locale.code === customLocale.code)) {\n mergedLocales.push(customLocale);\n }\n });\n\n const enabledLocales = mergedLocales.filter((locale: LocaleConfiguration) =>\n getSetting(\"ENABLED_LOCALES\").includes(locale.code)\n );\n\n const localesInstance = new Locales(enabledLocales);\n const preferredLocale = getPreferredLocale(request, localesInstance);\n store.dispatch(setLocales(localesInstance, preferredLocale ?? \"en\"));\n};\n\nconst setServerPreferencesFromArray = (\n store: ReduxStore,\n serverPreferences: Array<string | PreferenceValue>\n) => {\n serverPreferences.forEach((serverPreference) => {\n if (typeof serverPreference === \"object\") {\n const { name, defaultValue, type } = serverPreference;\n store.dispatch(setServerPreference(name, defaultValue, type));\n } else {\n store.dispatch(setServerPreference(serverPreference, null));\n }\n });\n};\n\n/**\n * Server preferences can be suplied by an array of preference names,\n * or an array of objects which has the name, an optional default value and an optional type.<br>\n * When the type is set to string, a comma separated value is not converted to an array:\n *\n * @example\n * // value becomes an array [default1, default2]\n * { name: \"prefName\", defaultValue: \"default1, default2\" }\n * // value remains a string \"default1, default2\"\n * { name: \"prefName\", defaultValue: \"default1, default2\", type: \"string\" }\n *\n * @param store\n * @param serverPreferences\n */\nconst setServerPreferences = (\n store: ReduxStore,\n serverPreferences: Array<string | PreferenceValue>\n) => {\n if (Array.isArray(serverPreferences)) {\n setServerPreferencesFromArray(store, serverPreferences);\n }\n\n store.dispatch(setAllContentInDataSetting());\n store.dispatch(setLoginPreferences());\n\n if (\n preferencesProvider &&\n preferencesProvider.isStudioContext &&\n preferencesProvider.isStudioContext()\n ) {\n store.dispatch(setPreference(\"isStudioContext\", true));\n }\n};\n\n/**\n */\nconst setConfigurationTheme = (store: ReduxStore) => {\n let configTheme = null;\n\n const configFileLocation = preferencesProvider.getLayoutConfigFileLocation();\n if (typeof configFileLocation === \"string\") {\n const configFilePath = configFileLocation.startsWith(\"/\")\n ? `/resource${configFileLocation}`\n : `/resource/${configFileLocation}`;\n\n configTheme = dataFetcher.fetch(configFilePath);\n\n if (configTheme) {\n store.dispatch(setThemePreference(configTheme));\n } else {\n throw new Error(\n `Could not read theme configuration file from: ${configFilePath}`\n );\n }\n }\n};\n\n/**\n */\nconst setApplication = (store: ReduxStore) => {\n try {\n const locale = getLocale(store.getState());\n const application = new ModularUIRequest(\"/\", {\n locale: locale,\n }).fetchSync();\n\n store.dispatch(\n initModels([\n {\n key: `application(/)(${locale})`,\n model: application,\n },\n ])\n );\n } catch (e) {\n // eslint-disable-next-line no-console\n console.info(\"Could not load webapplication on server\");\n }\n};\n\n/**\n */\nconst handleErrors = (store: ReduxStore) => {\n const state = store.getState();\n\n if (\n state.error &&\n (state.error.shouldThrowOnServer ||\n !has(state.error, \"shouldThrowOnServer\"))\n ) {\n throw state.error;\n }\n};\n\n/**\n */\nconst dehydrate = (store: ReduxStore): string => {\n const state = store.getState();\n\n const modularui: {\n [key: string]: { status: string, lastModification: number, model: ?Object },\n } = {};\n\n for (const key in state.modularui) {\n const { status, model, lastModification } = state.modularui[key];\n\n if (model) {\n modularui[key] = {\n status,\n lastModification,\n model: model.dehydrate(),\n };\n } else {\n modularui[key] = {\n status,\n lastModification,\n model: undefined,\n };\n }\n }\n\n const filteredState = {\n ...state,\n modularui,\n };\n\n return JSON.stringify(filteredState).replace(/</g, \"\\\\u003c\");\n};\n\n/**\n */\nconst createHead = (\n sheet: any,\n UUID: string,\n helmetContext?: Object\n): Object => {\n const style = sheet.getStyleTags();\n const meta = helmetContext ? [...helmetContext.helmet.meta] : [];\n\n if (helmetContext) {\n return {\n ...helmetContext.helmet,\n style,\n meta,\n };\n }\n\n return {\n style,\n meta,\n };\n};\n\nexport {\n createReduxStore,\n setI18n,\n setApplication,\n setServerPreferences,\n setConfigurationTheme,\n createHead,\n handleErrors,\n dehydrate,\n};\n"],"mappings":";;;;;;;;;;;;;;;AACA;AACA;AACA;AAEA;AAEA;AAGA;AACA;AAEA;AAQA;AAEA;AAEA;AACA;AAEA;AAA6D;AAAA;AAa7D;AACA;AACA,MAAMA,gBAAgB,GAAG,CACvBC,WAAiB,EACjBC,cAAsB,EACtBC,YAAiC,KAClB;EACf;EACA,MAAMC,OAAsB,GAAG,IAAAC,4BAAmB,EAAC;IACjDC,cAAc,EAAE,CAACL,WAAW,CAACM,QAAQ,EAAE;EACzC,CAAC,CAAC;EAEF,MAAM;IAAEC;EAAM,CAAC,GAAG,IAAAC,uBAAc,EAACL,OAAO,EAAEF,cAAc,EAAEC,YAAY,CAAC;EAEvE,OAAOK,KAAK;AACd,CAAC;;AAED;AACA;AADA;AAEA,MAAME,OA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C,CAAC,EAC3C;IACA,MAAMD,KAAK,CAACC,KAAK;EACnB;AACF,CAAC;;AAED;AACA;AADA;AAEA,MAAMG,SAAS,GAAIjE,KAAiB,IAAa;EAC/C,MAAM6D,KAAK,GAAG7D,KAAK,CAACkD,QAAQ,EAAE;EAE9B,MAAMgB,SAEL,GAAG,CAAC,CAAC;EAEN,KAAK,MAAMX,GAAG,IAAIM,KAAK,CAACK,SAAS,EAAE;IACjC,MAAM;MAAEC,MAAM;MAAEX,KAAK;MAAEY;IAAiB,CAAC,GAAGP,KAAK,CAACK,SAAS,CAACX,GAAG,CAAC;IAEhE,IAAIC,KAAK,EAAE;MACTU,SAAS,CAACX,GAAG,CAAC,GAAG;QACfY,MAAM;QACNC,gBAAgB;QAChBZ,KAAK,EAAEA,KAAK,CAACS,SAAS;MACxB,CAAC;IACH,CAAC,MAAM;MACLC,SAAS,CAACX,GAAG,CAAC,GAAG;QACfY,MAAM;QACNC,gBAAgB;QAChBZ,KAAK,EAAEa;MACT,CAAC;IACH;EACF;EAEA,MAAMC,aAAa,GAAG;IACpB,GAAGT,KAAK;IACRK;EACF,CAAC;EAED,OAAO,wBAAeI,aAAa,CAAC,CAACC,OAAO,CAAC,IAAI,EAAE,SAAS,CAAC;AAC/D,CAAC;;AAED;AACA;AADA;AAEA,MAAMC,UAAU,GAAG,CACjBC,KAAU,EACVC,IAAY,EACZC,aAAsB,KACX;EACX,MAAMC,KAAK,GAAGH,KAAK,CAACI,YAAY,EAAE;EAClC,MAAMC,IAAI,GAAGH,aAAa,GAAG,CAAC,GAAGA,aAAa,CAACI,MAAM,CAACD,IAAI,CAAC,GAAG,EAAE;EAEhE,IAAIH,aAAa,EAAE;IACjB,OAAO;MACL,GAAGA,aAAa,CAACI,MAAM;MACvBH,KAAK;MACLE;IACF,CAAC;EACH;EAEA,OAAO;IACLF,KAAK;IACLE;EACF,CAAC;AACH,CAAC;AAAC"}
1
+ {"version":3,"file":"serverUtil.js","names":["createReduxStore","requestHref","customReducers","initialState","history","createMemoryHistory","initialEntries","toString","store","configureStore","setI18n","locales","request","Array","isArray","IllegalArgumentException","mergedLocales","availableLocales","locale","code","customLocale","custLocale","deepmerge","forEach","some","push","enabledLocales","getSetting","localesInstance","Locales","preferredLocale","getPreferredLocale","dispatch","setLocales","setServerPreferencesFromArray","serverPreferences","serverPreference","name","defaultValue","type","setServerPreference","setServerPreferences","setAllContentInDataSetting","setLoginPreferences","preferencesProvider","isStudioContext","setPreference","setConfigurationTheme","configTheme","configFileLocation","getLayoutConfigFileLocation","configFilePath","dataFetcher","fetch","setThemePreference","Error","setApplication","getLocale","getState","application","ModularUIRequest","fetchSync","connectKey","initModels","key","model","e","console","info","handleErrors","state","error","shouldThrowOnServer","has","dehydrate","modularui","status","lastModification","undefined","filteredState","replace","createHead","sheet","UUID","helmetContext","style","getStyleTags","meta","helmet"],"sources":["../../src/react-server/serverUtil.js"],"sourcesContent":["// @flow\nimport { createMemoryHistory } from \"history\";\nimport { has } from \"../utils/helpers/objects\";\nimport deepmerge from \"deepmerge\";\n\nimport configureStore from \"../redux/store/configureStore\";\n\nimport { availableLocales } from \"../i18n/Locales\";\nimport Locales from \"../i18n/Locales\";\n\nimport { getPreferredLocale } from \"./requestInformation\";\nimport { setLocales } from \"../redux/_i18n/I18nActions\";\n\nimport {\n setServerPreference,\n setThemePreference,\n setPreference,\n setAllContentInDataSetting,\n setLoginPreferences,\n} from \"../redux/actions/Preferences\";\n\nimport { getSetting } from \"../constants/Settings\";\n\nimport { IllegalArgumentException } from \"../exceptions\";\n\nimport { initModels } from \"../redux\";\nimport { getLocale } from \"../redux/selectors/i18n\";\n\nimport ModularUIRequest from \"../modularui/ModularUIRequest\";\n\nimport type { LocaleConfiguration } from \"../i18n/types\";\nimport type { ReduxState, ReduxStore } from \"../redux/types\";\nimport type Href from \"../models/href/Href\";\nimport type { RouterHistory } from \"react-router\";\n\nexport type PreferenceValue = {\n name: string,\n defaultValue?: string | null,\n type?: string,\n};\n\n/**\n */\nconst createReduxStore = (\n requestHref: Href,\n customReducers: Object,\n initialState?: $Shape<ReduxState>\n): ReduxStore => {\n // $FlowExpectedError\n const history: RouterHistory = createMemoryHistory({\n initialEntries: [requestHref.toString()],\n });\n\n const { store } = configureStore(history, customReducers, initialState);\n\n return store;\n};\n\n/**\n */\nconst setI18n = (\n store: ReduxStore,\n locales: Array<LocaleConfiguration> = [],\n request: HttpServletRequestJava\n) => {\n if (!Array.isArray(locales)) {\n throw new IllegalArgumentException(\"locales must be an array of objects\");\n }\n if (!request) {\n throw new IllegalArgumentException(\"missing request argument\");\n }\n\n const mergedLocales = availableLocales.map((locale) => {\n const code = locale.code;\n const customLocale = locales.find((custLocale) => custLocale.code === code);\n\n if (customLocale) {\n return deepmerge(locale, customLocale);\n }\n\n return locale;\n });\n\n locales.forEach((customLocale) => {\n if (!mergedLocales.some((locale) => locale.code === customLocale.code)) {\n mergedLocales.push(customLocale);\n }\n });\n\n const enabledLocales = mergedLocales.filter((locale: LocaleConfiguration) =>\n getSetting(\"ENABLED_LOCALES\").includes(locale.code)\n );\n\n const localesInstance = new Locales(enabledLocales);\n const preferredLocale = getPreferredLocale(request, localesInstance);\n store.dispatch(setLocales(localesInstance, preferredLocale ?? \"en\"));\n};\n\nconst setServerPreferencesFromArray = (\n store: ReduxStore,\n serverPreferences: Array<string | PreferenceValue>\n) => {\n serverPreferences.forEach((serverPreference) => {\n if (typeof serverPreference === \"object\") {\n const { name, defaultValue, type } = serverPreference;\n store.dispatch(setServerPreference(name, defaultValue, type));\n } else {\n store.dispatch(setServerPreference(serverPreference, null));\n }\n });\n};\n\n/**\n * Server preferences can be suplied by an array of preference names,\n * or an array of objects which has the name, an optional default value and an optional type.<br>\n * When the type is set to string, a comma separated value is not converted to an array:\n *\n * @example\n * // value becomes an array [default1, default2]\n * { name: \"prefName\", defaultValue: \"default1, default2\" }\n * // value remains a string \"default1, default2\"\n * { name: \"prefName\", defaultValue: \"default1, default2\", type: \"string\" }\n *\n * @param store\n * @param serverPreferences\n */\nconst setServerPreferences = (\n store: ReduxStore,\n serverPreferences: Array<string | PreferenceValue>\n) => {\n if (Array.isArray(serverPreferences)) {\n setServerPreferencesFromArray(store, serverPreferences);\n }\n\n store.dispatch(setAllContentInDataSetting());\n store.dispatch(setLoginPreferences());\n\n if (\n preferencesProvider &&\n preferencesProvider.isStudioContext &&\n preferencesProvider.isStudioContext()\n ) {\n store.dispatch(setPreference(\"isStudioContext\", true));\n }\n};\n\n/**\n */\nconst setConfigurationTheme = (store: ReduxStore) => {\n let configTheme = null;\n\n const configFileLocation = preferencesProvider.getLayoutConfigFileLocation();\n if (typeof configFileLocation === \"string\") {\n const configFilePath = configFileLocation.startsWith(\"/\")\n ? `/resource${configFileLocation}`\n : `/resource/${configFileLocation}`;\n\n configTheme = dataFetcher.fetch(configFilePath);\n\n if (configTheme) {\n store.dispatch(setThemePreference(configTheme));\n } else {\n throw new Error(\n `Could not read theme configuration file from: ${configFilePath}`\n );\n }\n }\n};\n\n/**\n */\nconst setApplication = (store: ReduxStore) => {\n try {\n const locale = getLocale(store.getState());\n const application = new ModularUIRequest(\"/\", {\n locale: locale,\n }).fetchSync();\n\n application.connectKey = `application(/)(${locale})`;\n\n store.dispatch(\n initModels([\n {\n key: `application(/)(${locale})`,\n model: application,\n },\n ])\n );\n } catch (e) {\n // eslint-disable-next-line no-console\n console.info(\"Could not load webapplication on server\");\n }\n};\n\n/**\n */\nconst handleErrors = (store: ReduxStore) => {\n const state = store.getState();\n\n if (\n state.error &&\n (state.error.shouldThrowOnServer ||\n !has(state.error, \"shouldThrowOnServer\"))\n ) {\n throw state.error;\n }\n};\n\n/**\n */\nconst dehydrate = (store: ReduxStore): string => {\n const state = store.getState();\n\n const modularui: {\n [key: string]: { status: string, lastModification: number, model: ?Object },\n } = {};\n\n for (const key in state.modularui) {\n const { status, model, lastModification } = state.modularui[key];\n\n if (model) {\n modularui[key] = {\n status,\n lastModification,\n model: model.dehydrate(),\n };\n } else {\n modularui[key] = {\n status,\n lastModification,\n model: undefined,\n };\n }\n }\n\n const filteredState = {\n ...state,\n modularui,\n };\n\n return JSON.stringify(filteredState).replace(/</g, \"\\\\u003c\");\n};\n\n/**\n */\nconst createHead = (\n sheet: any,\n UUID: string,\n helmetContext?: Object\n): Object => {\n const style = sheet.getStyleTags();\n const meta = helmetContext ? [...helmetContext.helmet.meta] : [];\n\n if (helmetContext) {\n return {\n ...helmetContext.helmet,\n style,\n meta,\n };\n }\n\n return {\n style,\n meta,\n };\n};\n\nexport {\n createReduxStore,\n setI18n,\n setApplication,\n setServerPreferences,\n setConfigurationTheme,\n createHead,\n handleErrors,\n dehydrate,\n};\n"],"mappings":";;;;;;;;;;;;;;;AACA;AACA;AACA;AAEA;AAEA;AAGA;AACA;AAEA;AAQA;AAEA;AAEA;AACA;AAEA;AAA6D;AAAA;AAa7D;AACA;AACA,MAAMA,gBAAgB,GAAG,CACvBC,WAAiB,EACjBC,cAAsB,EACtBC,YAAiC,KAClB;EACf;EACA,MAAMC,OAAsB,GAAG,IAAAC,4BAAmB,EAAC;IACjDC,cAAc,EAAE,CAACL,WAAW,CAACM,QAAQ,EAAE;EACzC,CAAC,CAAC;EAEF,MAAM;IAAEC;EAAM,CAAC,GAAG,IAAAC,uBAAc,EAACL,OAAO,EAAEF,cAAc,EAAEC,YAAY,CAAC;EAEvE,OAAOK,KAAK;AACd,CAAC;;AAED;AACA;AADA;AAEA,MAAME,OAAO,GAAG,UACdF,KAAiB,EAGd;EAAA,IAFHG,OAAmC,uEAAG,EAAE;EAAA,IACxCC,OAA+B;EAE/B,IAAI,CAACC,KAAK,CAACC,OAAO,CAACH,OAAO,CAAC,EAAE;IAC3B,MAAM,IAAII,oCAAwB,CAAC,qCAAqC,CAAC;EAC3E;EACA,IAAI,CAACH,OAAO,EAAE;IACZ,MAAM,IAAIG,oCAAwB,CAAC,0BAA0B,CAAC;EAChE;EAEA,MAAMC,aAAa,GAAG,kBAAAC,yBAAgB,OAAhBA,yBAAgB,EAAMC,MAAM,IAAK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AAK;MAAEY;IAAiB,CAAC,GAAGP,KAAK,CAACK,SAAS,CAACX,GAAG,CAAC;IAEhE,IAAIC,KAAK,EAAE;MACTU,SAAS,CAACX,GAAG,CAAC,GAAG;QACfY,MAAM;QACNC,gBAAgB;QAChBZ,KAAK,EAAEA,KAAK,CAACS,SAAS;MACxB,CAAC;IACH,CAAC,MAAM;MACLC,SAAS,CAACX,GAAG,CAAC,GAAG;QACfY,MAAM;QACNC,gBAAgB;QAChBZ,KAAK,EAAEa;MACT,CAAC;IACH;EACF;EAEA,MAAMC,aAAa,GAAG;IACpB,GAAGT,KAAK;IACRK;EACF,CAAC;EAED,OAAO,wBAAeI,aAAa,CAAC,CAACC,OAAO,CAAC,IAAI,EAAE,SAAS,CAAC;AAC/D,CAAC;;AAED;AACA;AADA;AAEA,MAAMC,UAAU,GAAG,CACjBC,KAAU,EACVC,IAAY,EACZC,aAAsB,KACX;EACX,MAAMC,KAAK,GAAGH,KAAK,CAACI,YAAY,EAAE;EAClC,MAAMC,IAAI,GAAGH,aAAa,GAAG,CAAC,GAAGA,aAAa,CAACI,MAAM,CAACD,IAAI,CAAC,GAAG,EAAE;EAEhE,IAAIH,aAAa,EAAE;IACjB,OAAO;MACL,GAAGA,aAAa,CAACI,MAAM;MACvBH,KAAK;MACLE;IACF,CAAC;EACH;EAEA,OAAO;IACLF,KAAK;IACLE;EACF,CAAC;AACH,CAAC;AAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@beinformed/ui",
3
- "version": "1.27.2",
3
+ "version": "1.27.4",
4
4
  "description": "Toolbox for be informed javascript layouts",
5
5
  "license": "SEE LICENSE IN LICENSE.md",
6
6
  "bugs": "http://support.beinformed.com",
@@ -125,11 +125,11 @@
125
125
  "eslint-plugin-ft-flow": "^2.0.3",
126
126
  "eslint-plugin-import": "^2.27.5",
127
127
  "eslint-plugin-jest": "^27.2.1",
128
- "eslint-plugin-jsdoc": "^39.7.4",
128
+ "eslint-plugin-jsdoc": "^39.8.0",
129
129
  "eslint-plugin-react": "^7.32.2",
130
130
  "eslint-plugin-react-hooks": "^4.5.0",
131
131
  "eslint-plugin-you-dont-need-lodash-underscore": "^6.12.0",
132
- "flow-bin": "^0.198.2",
132
+ "flow-bin": "^0.199.1",
133
133
  "flow-copy-source": "^2.0.9",
134
134
  "flow-typed": "^3.8.0",
135
135
  "glob": "^8.1.0",
@@ -156,6 +156,11 @@ export const ATTRIBUTE_WIDTH = {
156
156
 
157
157
  export const ALL_CONTENT_IN_DATA_SETTING = "hasAllContentInData";
158
158
 
159
+ export const INTERNAL_LOGIN_TYPE = {
160
+ JAAS: "JAAS",
161
+ PAC4J_FORM: "PAC4J_FORM",
162
+ PAC4J_BASIC: "PAC4J_BASIC",
163
+ };
159
164
  export const LOGIN_TYPE = "security.clients";
160
165
  export const LOGIN_PATH_SETTING = "FormClient.login_url";
161
166
  export const LOGIN_USERNAME_SETTING = "FormClient.username_field_name";
@@ -3,6 +3,7 @@ import { isPlainObject, has } from "../utils/helpers/objects";
3
3
  import { getRepositoryResourceUrl } from "../utils/helpers/repositoryResource";
4
4
  import {
5
5
  ALL_CONTENT_IN_DATA_SETTING,
6
+ INTERNAL_LOGIN_TYPE,
6
7
  LOGIN_TYPE,
7
8
  LOGIN_PATH_SETTING,
8
9
  LOGIN_USERNAME_SETTING,
@@ -186,13 +187,16 @@ export const hasAllContentInData = (): boolean =>
186
187
 
187
188
  /**
188
189
  * Login type, only available when pac4j is configured
190
+ *
191
+ * Preview does not support pac4j, thus is probably not configured when started, which results in login type JAAS
189
192
  */
190
- export const loginType = (): string => getSetting(LOGIN_TYPE, "JAAS");
193
+ export const loginType = (): string =>
194
+ getSetting(LOGIN_TYPE, INTERNAL_LOGIN_TYPE.JAAS);
191
195
 
192
196
  /**
193
197
  */
194
198
  export const loginPath = (): string =>
195
- getSetting(LOGIN_PATH_SETTING, "/j_security_check");
199
+ getSetting(LOGIN_PATH_SETTING, "/callback?client_name=FormClient");
196
200
  /**
197
201
  */
198
202
  export const loginUsernameField = (): string =>
@@ -204,7 +208,7 @@ export const loginPasswordField = (): string =>
204
208
  /**
205
209
  */
206
210
  export const logoutPath = (): string =>
207
- getSetting(LOGOUT_PATH_SETTING, "/Logoff");
211
+ getSetting(LOGOUT_PATH_SETTING, "/logout");
208
212
 
209
213
  export const LOGIN_PATH: string = loginPath();
210
214
  export const LOGOUT_PATH: string = logoutPath();
@@ -80,12 +80,17 @@ export default class ApplicationModel extends ResourceModel {
80
80
  DEFAULT_AUTHENTICATION_TYPE,
81
81
  ]);
82
82
 
83
- //put primary first
84
- return authenticationTypes?.sort(
85
- (a: AuthenticationType, b: AuthenticationType) =>
86
- a.isPrimary === b.isPrimary ? 0 : a.isPrimary ? -1 : 1
87
- );
83
+ if (authenticationTypes) {
84
+ //put primary first
85
+ return authenticationTypes?.sort(
86
+ (a: AuthenticationType, b: AuthenticationType) =>
87
+ a.isPrimary === b.isPrimary ? 0 : a.isPrimary ? -1 : 1
88
+ );
89
+ }
90
+
91
+ return [DEFAULT_AUTHENTICATION_TYPE];
88
92
  }
93
+
89
94
  /**
90
95
  * Getting the tab links
91
96
  */
@@ -6,6 +6,7 @@ import Cache from "../utils/browser/Cache";
6
6
 
7
7
  import { UnauthorizedException } from "../exceptions";
8
8
  import {
9
+ INTERNAL_LOGIN_TYPE,
9
10
  loginType,
10
11
  loginPath,
11
12
  loginPasswordField,
@@ -27,16 +28,17 @@ class Authenticate {
27
28
 
28
29
  /**
29
30
  */
30
- get authenticationType(): "JAAS" | "PAC4J_FORM" | "PAC4J_BASIC" {
31
+ get authenticationType(): $Keys<typeof INTERNAL_LOGIN_TYPE> {
31
32
  const type = loginType();
32
33
 
33
- if (!type || type === "JAAS") {
34
- return "JAAS";
34
+ if (!type || type === INTERNAL_LOGIN_TYPE.JAAS) {
35
+ return INTERNAL_LOGIN_TYPE.JAAS;
35
36
  }
37
+
36
38
  if (type.includes("FormClient")) {
37
- return "PAC4J_FORM";
39
+ return INTERNAL_LOGIN_TYPE.PAC4J_FORM;
38
40
  } else if (type.includes("BasicClient")) {
39
- return "PAC4J_BASIC";
41
+ return INTERNAL_LOGIN_TYPE.PAC4J_BASIC;
40
42
  }
41
43
 
42
44
  throw new Error(`Unsupported login type found: ${type}`);
@@ -45,7 +47,10 @@ class Authenticate {
45
47
  /**
46
48
  */
47
49
  get isBasicAuthentication(): boolean {
48
- return this._isBasic || this.authenticationType === "PAC4J_BASIC";
50
+ return (
51
+ this._isBasic ||
52
+ this.authenticationType === INTERNAL_LOGIN_TYPE.PAC4J_BASIC
53
+ );
49
54
  }
50
55
 
51
56
  /**
@@ -90,9 +95,9 @@ class Authenticate {
90
95
  */
91
96
  login(username: string, password: string): Promise<any> {
92
97
  switch (this.authenticationType) {
93
- case "PAC4J_FORM":
98
+ case INTERNAL_LOGIN_TYPE.PAC4J_FORM:
94
99
  return this.doFormLogin(username, password);
95
- case "PAC4J_BASIC":
100
+ case INTERNAL_LOGIN_TYPE.PAC4J_BASIC:
96
101
  return this.doBasicAuthentication(username, password);
97
102
  default:
98
103
  return this.doJaasAuthentication(username, password);
@@ -103,8 +108,8 @@ class Authenticate {
103
108
  */
104
109
  getFormLoginUrl(): string {
105
110
  switch (this.authenticationType) {
106
- case "PAC4J_BASIC":
107
- case "PAC4J_FORM":
111
+ case INTERNAL_LOGIN_TYPE.PAC4J_BASIC:
112
+ case INTERNAL_LOGIN_TYPE.PAC4J_FORM:
108
113
  return `${getBasePath()}${loginPath()}`;
109
114
  default:
110
115
  return `${getBasePath()}/j_security_check`;
@@ -118,8 +123,8 @@ class Authenticate {
118
123
  const encodedPassword = encodeURIComponent(password);
119
124
 
120
125
  switch (this.authenticationType) {
121
- case "PAC4J_BASIC":
122
- case "PAC4J_FORM":
126
+ case INTERNAL_LOGIN_TYPE.PAC4J_BASIC:
127
+ case INTERNAL_LOGIN_TYPE.PAC4J_FORM:
123
128
  return `${loginUsernameField()}=${encodedUsername}&${loginPasswordField()}=${encodedPassword}`;
124
129
  default:
125
130
  return `j_username=${encodedUsername}&j_password=${encodedPassword}`;
@@ -158,11 +163,23 @@ class Authenticate {
158
163
  });
159
164
  }
160
165
 
166
+ /**
167
+ */
168
+ getLogoutUrl(): string {
169
+ switch (this.authenticationType) {
170
+ case INTERNAL_LOGIN_TYPE.PAC4J_BASIC:
171
+ case INTERNAL_LOGIN_TYPE.PAC4J_FORM:
172
+ return `${getBasePath()}${logoutPath()}`;
173
+ default:
174
+ return `${getBasePath()}/Logoff`;
175
+ }
176
+ }
177
+
161
178
  /**
162
179
  */
163
180
  logout(): Promise<any> {
164
181
  return universalFetch({
165
- url: `${getBasePath()}${logoutPath()}`,
182
+ url: this.getLogoutUrl(),
166
183
  }).then((response) => {
167
184
  // clear cache because of cached contributions
168
185
  Cache.clear();
@@ -12,6 +12,7 @@ export type Props = {
12
12
  +error: Error,
13
13
  };
14
14
 
15
+ // $FlowFixMe
15
16
  const StyledBoundary: StyledComponent<{}, Theme, *> = styled.div`
16
17
  padding: ${spacers(2, 1)};
17
18
  margin-bottom: ${spacer(2)};
@@ -19,6 +20,7 @@ const StyledBoundary: StyledComponent<{}, Theme, *> = styled.div`
19
20
  border-radius: 0.3em;
20
21
  `;
21
22
 
23
+ // $FlowFixMe
22
24
  const StyledStack = styled.pre`
23
25
  display: block;
24
26
  font-size: 87.5%;
@@ -34,6 +34,7 @@ type serverProps = {
34
34
  render: Function,
35
35
  template?: (TemplateProps) => string,
36
36
  beforeRenderHooks?: Array<BeforeRenderHook>,
37
+ preloadApplication?: boolean,
37
38
  };
38
39
 
39
40
  /**
@@ -47,6 +48,7 @@ const serverNoSSR = ({
47
48
  render,
48
49
  template,
49
50
  beforeRenderHooks,
51
+ preloadApplication = true,
50
52
  }: serverProps): string => {
51
53
  const UUID = createUUID();
52
54
  __webpack_nonce__ = UUID; // NOSONAR
@@ -66,7 +68,9 @@ const serverNoSSR = ({
66
68
 
67
69
  setI18n(store, locales, request);
68
70
 
69
- setApplication(store);
71
+ if (preloadApplication) {
72
+ setApplication(store);
73
+ }
70
74
 
71
75
  handleErrors(store);
72
76
 
@@ -176,6 +176,8 @@ const setApplication = (store: ReduxStore) => {
176
176
  locale: locale,
177
177
  }).fetchSync();
178
178
 
179
+ application.connectKey = `application(/)(${locale})`;
180
+
179
181
  store.dispatch(
180
182
  initModels([
181
183
  {
@@ -128,6 +128,11 @@ export namespace ATTRIBUTE_WIDTH {
128
128
  const EXTRA_LARGE: string;
129
129
  }
130
130
  export const ALL_CONTENT_IN_DATA_SETTING: "hasAllContentInData";
131
+ export namespace INTERNAL_LOGIN_TYPE {
132
+ const JAAS: string;
133
+ const PAC4J_FORM: string;
134
+ const PAC4J_BASIC: string;
135
+ }
131
136
  export const LOGIN_TYPE: "security.clients";
132
137
  export const LOGIN_PATH_SETTING: "FormClient.login_url";
133
138
  export const LOGIN_USERNAME_SETTING: "FormClient.username_field_name";
@@ -5,7 +5,11 @@ declare class Authenticate {
5
5
  _isBasic: boolean;
6
6
  /**
7
7
  */
8
- get authenticationType(): "JAAS" | "PAC4J_FORM" | "PAC4J_BASIC";
8
+ get authenticationType(): $Keys<{
9
+ JAAS: string;
10
+ PAC4J_FORM: string;
11
+ PAC4J_BASIC: string;
12
+ }>;
9
13
  /**
10
14
  */
11
15
  set isBasicAuthentication(arg: boolean);
@@ -36,6 +40,9 @@ declare class Authenticate {
36
40
  /**
37
41
  */
38
42
  doJaasAuthentication(username: string, password: string): Promise<any>;
43
+ /**
44
+ */
45
+ getLogoutUrl(): string;
39
46
  /**
40
47
  */
41
48
  logout(): Promise<any>;