@beinformed/ui 1.18.4 → 1.18.5

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 (214) hide show
  1. package/CHANGELOG.md +9 -0
  2. package/esm/hooks/useAuthentication.js +7 -50
  3. package/esm/hooks/useAuthentication.js.map +1 -1
  4. package/esm/i18n/Locales.js.map +1 -1
  5. package/esm/models/concepts/ConceptDetailModel.js.map +1 -1
  6. package/esm/models/form/FormModel.js.map +1 -1
  7. package/esm/models/layouthint/LayoutHintCollection.js.map +1 -1
  8. package/esm/models/tab/TabModel.js.map +1 -1
  9. package/esm/modularui/Authenticate.js +2 -1
  10. package/esm/modularui/Authenticate.js.map +1 -1
  11. package/esm/redux/actions/SignOut.js +6 -2
  12. package/esm/redux/actions/SignOut.js.map +1 -1
  13. package/esm/redux/connectors/SignIn.js +3 -2
  14. package/esm/redux/connectors/SignIn.js.map +1 -1
  15. package/esm/redux/connectors/SignOut.js +4 -1
  16. package/esm/redux/connectors/SignOut.js.map +1 -1
  17. package/esm/redux/reducers/AuthReducer.js +0 -10
  18. package/esm/redux/reducers/AuthReducer.js.map +1 -1
  19. package/esm/redux/types.js.map +1 -1
  20. package/esm/utils/helpers/checkResource.js +2 -0
  21. package/esm/utils/helpers/checkResource.js.map +1 -1
  22. package/lib/constants/LayoutHints.js.map +1 -1
  23. package/lib/constants/Settings.js.map +1 -1
  24. package/lib/exceptions/FetchException.js.map +1 -1
  25. package/lib/hooks/__tests__/useAuthentication.spec.js.flow +15 -1
  26. package/lib/hooks/useAllFormsOnModel.js.map +1 -1
  27. package/lib/hooks/useAuthentication.js +7 -55
  28. package/lib/hooks/useAuthentication.js.flow +4 -37
  29. package/lib/hooks/useAuthentication.js.map +1 -1
  30. package/lib/hooks/useContent.js.map +1 -1
  31. package/lib/hooks/useDeepCompareEffect.js.map +1 -1
  32. package/lib/hooks/useForm.js.map +1 -1
  33. package/lib/hooks/useI18n.js.map +1 -1
  34. package/lib/hooks/useModal.js.map +1 -1
  35. package/lib/hooks/useModelCatalog.js.map +1 -1
  36. package/lib/hooks/useModels.js.map +1 -1
  37. package/lib/hooks/useModularUI.js.map +1 -1
  38. package/lib/hooks/useModularUIBasic.js.map +1 -1
  39. package/lib/hooks/useModularUIModel.js.map +1 -1
  40. package/lib/hooks/useModularUIRequest.js.map +1 -1
  41. package/lib/hooks/useNotification.js.map +1 -1
  42. package/lib/hooks/usePreference.js.map +1 -1
  43. package/lib/hooks/useProgressIndicator.js.map +1 -1
  44. package/lib/hooks/useRouter.js.map +1 -1
  45. package/lib/i18n/Locale.js.map +1 -1
  46. package/lib/i18n/Locales.js.map +1 -1
  47. package/lib/i18n/Message.js.map +1 -1
  48. package/lib/i18n/withMessage.js.map +1 -1
  49. package/lib/models/actions/ActionModel.js.map +1 -1
  50. package/lib/models/application/ApplicationModel.js.map +1 -1
  51. package/lib/models/attributes/AttributeCollection.js.map +1 -1
  52. package/lib/models/attributes/AttributeContent.js.map +1 -1
  53. package/lib/models/attributes/AttributeDataHelper.js.map +1 -1
  54. package/lib/models/attributes/AttributeModel.js.map +1 -1
  55. package/lib/models/attributes/AttributeSetModel.js.map +1 -1
  56. package/lib/models/attributes/BooleanAttributeModel.js.map +1 -1
  57. package/lib/models/attributes/ChoiceAttributeModel.js.map +1 -1
  58. package/lib/models/attributes/ChoiceAttributeOptionCollection.js.map +1 -1
  59. package/lib/models/attributes/ChoiceAttributeOptionModel.js.map +1 -1
  60. package/lib/models/attributes/CompositeAttributeChildCollection.js.map +1 -1
  61. package/lib/models/attributes/CompositeAttributeModel.js.map +1 -1
  62. package/lib/models/attributes/DatetimeAttributeModel.js.map +1 -1
  63. package/lib/models/attributes/HelptextAttributeModel.js.map +1 -1
  64. package/lib/models/attributes/MemoAttributeModel.js.map +1 -1
  65. package/lib/models/attributes/MoneyAttributeModel.js.map +1 -1
  66. package/lib/models/attributes/NumberAttributeModel.js.map +1 -1
  67. package/lib/models/attributes/StringAttributeModel.js.map +1 -1
  68. package/lib/models/attributes/XMLAttributeModel.js.map +1 -1
  69. package/lib/models/attributes/_createAttribute.js.map +1 -1
  70. package/lib/models/attributes/input-constraints/ConstraintCollection.js.map +1 -1
  71. package/lib/models/attributes/input-constraints/ConstraintModel.js.map +1 -1
  72. package/lib/models/attributes/input-constraints/DateTimeDateFormatConstraint.js.map +1 -1
  73. package/lib/models/attributes/input-constraints/DateTimeTimeFormatConstraint.js.map +1 -1
  74. package/lib/models/attributes/input-constraints/FileSizeConstraint.js.map +1 -1
  75. package/lib/models/attributes/input-constraints/IBANConstraint.js.map +1 -1
  76. package/lib/models/attributes/input-constraints/NumberBoundaryConstraint.js.map +1 -1
  77. package/lib/models/attributes/input-constraints/NumberFormatConstraint.js.map +1 -1
  78. package/lib/models/base/BaseCollection.js.map +1 -1
  79. package/lib/models/base/BaseModel.js.map +1 -1
  80. package/lib/models/caseview/CaseViewModel.js.map +1 -1
  81. package/lib/models/concepts/BusinessScenarioModel.js.map +1 -1
  82. package/lib/models/concepts/ConceptDetailModel.js.map +1 -1
  83. package/lib/models/concepts/ConceptLinkModel.js.map +1 -1
  84. package/lib/models/concepts/SourceReferenceModel.js.map +1 -1
  85. package/lib/models/content/ContentLinkModel.js.map +1 -1
  86. package/lib/models/content/ContentTOCModel.js.map +1 -1
  87. package/lib/models/content/SectionModel.js.map +1 -1
  88. package/lib/models/content/SubSectionModel.js.map +1 -1
  89. package/lib/models/contentconfiguration/ContentConfigurationResults.js.map +1 -1
  90. package/lib/models/detail/DetailModel.js.map +1 -1
  91. package/lib/models/filters/BaseFilterModel.js.map +1 -1
  92. package/lib/models/form/FormModel.js.map +1 -1
  93. package/lib/models/form/FormObjectModel.js.map +1 -1
  94. package/lib/models/href/Href.js.map +1 -1
  95. package/lib/models/layouthint/LayoutHintCollection.js.map +1 -1
  96. package/lib/models/links/LinkCollection.js.map +1 -1
  97. package/lib/models/links/LinkModel.js.map +1 -1
  98. package/lib/models/list/ListDetailModel.js.map +1 -1
  99. package/lib/models/list/ListHeaderModel.js.map +1 -1
  100. package/lib/models/list/ListItemCollection.js.map +1 -1
  101. package/lib/models/list/ListModel.js.map +1 -1
  102. package/lib/models/lookup/LookupOptionsModel.js.map +1 -1
  103. package/lib/models/paging/PagingModel.js.map +1 -1
  104. package/lib/models/panels/GroupingPanelModel.js.map +1 -1
  105. package/lib/models/parameter/Parameter.js.map +1 -1
  106. package/lib/models/process/ProcessStatusSettingsModel.js.map +1 -1
  107. package/lib/models/resolveModel.js.map +1 -1
  108. package/lib/models/sorting/SortingModel.js.map +1 -1
  109. package/lib/models/tab/TabModel.js.map +1 -1
  110. package/lib/models/user/UserProfileModel.js.map +1 -1
  111. package/lib/models/user/UserServicesModel.js.map +1 -1
  112. package/lib/modularui/Authenticate.js +3 -1
  113. package/lib/modularui/Authenticate.js.flow +3 -2
  114. package/lib/modularui/Authenticate.js.map +1 -1
  115. package/lib/modularui/ModularUIRequest.js.map +1 -1
  116. package/lib/modularui/ModularUIResponse.js.map +1 -1
  117. package/lib/react/ErrorBoundaryFallback.js.map +1 -1
  118. package/lib/react-client/client.js.map +1 -1
  119. package/lib/react-client/rehydrate.js.map +1 -1
  120. package/lib/react-server/createSSRComplete.js.map +1 -1
  121. package/lib/react-server/renderSSRComplete.js.map +1 -1
  122. package/lib/react-server/renderSSRMinimal.js.map +1 -1
  123. package/lib/react-server/serverNoSSR.js.map +1 -1
  124. package/lib/react-server/serverSSR.js.map +1 -1
  125. package/lib/react-server/serverUtil.js.map +1 -1
  126. package/lib/react-theme/ThemeProvider.js.map +1 -1
  127. package/lib/react-theme/createTheme.js.map +1 -1
  128. package/lib/react-theme/useTheme.js.map +1 -1
  129. package/lib/react-theme/utils/background.js.map +1 -1
  130. package/lib/react-theme/utils/colors.js.map +1 -1
  131. package/lib/react-theme/utils/contrast.js.map +1 -1
  132. package/lib/react-theme/utils/corners.js.map +1 -1
  133. package/lib/react-theme/utils/spacers.js.map +1 -1
  134. package/lib/react-theme/utils/themeProps.js.map +1 -1
  135. package/lib/redux/_i18n/actions.js.map +1 -1
  136. package/lib/redux/_i18n/reducer.js.map +1 -1
  137. package/lib/redux/_modularui/actions.js.map +1 -1
  138. package/lib/redux/_modularui/connector.js.map +1 -1
  139. package/lib/redux/_modularui/middleware.js.map +1 -1
  140. package/lib/redux/_modularui/modularuiUtils.js.map +1 -1
  141. package/lib/redux/_modularui/reducer.js.map +1 -1
  142. package/lib/redux/_modularui/selectors.js.map +1 -1
  143. package/lib/redux/_modularui/withModularUI.js.map +1 -1
  144. package/lib/redux/_router/connectors.js.map +1 -1
  145. package/lib/redux/actions/Application.js.map +1 -1
  146. package/lib/redux/actions/Authorization.js.map +1 -1
  147. package/lib/redux/actions/Error.js.map +1 -1
  148. package/lib/redux/actions/Form.js.map +1 -1
  149. package/lib/redux/actions/FormAttributeSet.js.map +1 -1
  150. package/lib/redux/actions/FormAttributeSetRepeatable.js.map +1 -1
  151. package/lib/redux/actions/FormAutosave.js.map +1 -1
  152. package/lib/redux/actions/FormAutosubmit.js.map +1 -1
  153. package/lib/redux/actions/FormValidations.js.map +1 -1
  154. package/lib/redux/actions/Notification.js.map +1 -1
  155. package/lib/redux/actions/Preferences.js.map +1 -1
  156. package/lib/redux/actions/SignIn.js.map +1 -1
  157. package/lib/redux/actions/SignOut.js +6 -1
  158. package/lib/redux/actions/SignOut.js.flow +9 -5
  159. package/lib/redux/actions/SignOut.js.map +1 -1
  160. package/lib/redux/connectors/Application.js.map +1 -1
  161. package/lib/redux/connectors/Breadcrumb.js.map +1 -1
  162. package/lib/redux/connectors/CaseView.js.map +1 -1
  163. package/lib/redux/connectors/ConceptDetail.js.map +1 -1
  164. package/lib/redux/connectors/ContentBrowser.js.map +1 -1
  165. package/lib/redux/connectors/ContentDetail.js.map +1 -1
  166. package/lib/redux/connectors/ContentDetailSection.js.map +1 -1
  167. package/lib/redux/connectors/Form.js.map +1 -1
  168. package/lib/redux/connectors/FormAttributeSet.js.map +1 -1
  169. package/lib/redux/connectors/ListDetail.js.map +1 -1
  170. package/lib/redux/connectors/Modal.js.map +1 -1
  171. package/lib/redux/connectors/ModelCatalog.js.map +1 -1
  172. package/lib/redux/connectors/Notification.js.map +1 -1
  173. package/lib/redux/connectors/PanelRenderer.js.map +1 -1
  174. package/lib/redux/connectors/Preferences.js.map +1 -1
  175. package/lib/redux/connectors/Progress.js.map +1 -1
  176. package/lib/redux/connectors/ProgressIndicator.js.map +1 -1
  177. package/lib/redux/connectors/QuickSearch.js.map +1 -1
  178. package/lib/redux/connectors/SignIn.js +3 -5
  179. package/lib/redux/connectors/SignIn.js.flow +1 -6
  180. package/lib/redux/connectors/SignIn.js.map +1 -1
  181. package/lib/redux/connectors/SignOut.js +5 -1
  182. package/lib/redux/connectors/SignOut.js.flow +2 -1
  183. package/lib/redux/connectors/SignOut.js.map +1 -1
  184. package/lib/redux/connectors/Tab.js.map +1 -1
  185. package/lib/redux/reducers/AuthReducer.js +0 -11
  186. package/lib/redux/reducers/AuthReducer.js.flow +0 -11
  187. package/lib/redux/reducers/AuthReducer.js.map +1 -1
  188. package/lib/redux/reducers/__tests__/AuthReducer.spec.js.flow +0 -9
  189. package/lib/redux/store/configureStore.js.map +1 -1
  190. package/lib/redux/types.js.flow +0 -1
  191. package/lib/redux/types.js.map +1 -1
  192. package/lib/utils/browser/Cookies.js.map +1 -1
  193. package/lib/utils/datetime/DateTimeUtil.js.map +1 -1
  194. package/lib/utils/fetch/universalFetch.js.map +1 -1
  195. package/lib/utils/fetch/xhr.js.map +1 -1
  196. package/lib/utils/helpers/checkResource.js +2 -0
  197. package/lib/utils/helpers/checkResource.js.flow +3 -0
  198. package/lib/utils/helpers/checkResource.js.map +1 -1
  199. package/lib/utils/helpers/objects.js.map +1 -1
  200. package/lib/utils/helpers/sanitizeHtml.js.map +1 -1
  201. package/lib/utils/helpers/text.js.map +1 -1
  202. package/lib/utils/number/formatValue.js.map +1 -1
  203. package/lib/utils/number/parseNumbers.js.map +1 -1
  204. package/package.json +17 -17
  205. package/src/hooks/__tests__/useAuthentication.spec.js +15 -1
  206. package/src/hooks/useAuthentication.js +4 -37
  207. package/src/modularui/Authenticate.js +3 -2
  208. package/src/redux/actions/SignOut.js +9 -5
  209. package/src/redux/connectors/SignIn.js +1 -6
  210. package/src/redux/connectors/SignOut.js +2 -1
  211. package/src/redux/reducers/AuthReducer.js +0 -11
  212. package/src/redux/reducers/__tests__/AuthReducer.spec.js +0 -9
  213. package/src/redux/types.js +0 -1
  214. package/src/utils/helpers/checkResource.js +3 -0
@@ -1 +1 @@
1
- {"version":3,"file":"Authenticate.js","names":["BASE","HTTP_METHODS","universalFetch","Cache","UnauthorizedException","loginType","loginPath","loginPasswordField","loginUsernameField","logoutPath","Authenticate","_isBasic","type","Error","authenticationType","isBasicAuthentication","initLogin","resolve","url","method","GET","headers","Accept","catch","error","username","password","doFormLogin","doBasicAuthentication","doJaasAuthentication","encodedUsername","encodeURIComponent","encodedPassword","getFormLoginUrl","POST","data","getFormLoginData","addItem","btoa","then","clear"],"sources":["../../src/modularui/Authenticate.js"],"sourcesContent":["// @flow\nimport { BASE, HTTP_METHODS } from \"../constants/Constants\";\n\nimport universalFetch from \"../utils/fetch/universalFetch\";\nimport Cache from \"../utils/browser/Cache\";\n\nimport { UnauthorizedException } from \"../exceptions\";\nimport {\n loginType,\n loginPath,\n loginPasswordField,\n loginUsernameField,\n logoutPath,\n} from \"../constants\";\n\n/**\n */\nclass Authenticate {\n _isBasic: boolean;\n\n /**\n */\n constructor() {\n this._isBasic = false;\n }\n\n /**\n */\n get authenticationType(): \"JAAS\" | \"PAC4J_FORM\" | \"PAC4J_BASIC\" {\n const type = loginType();\n\n if (!type || type === \"JAAS\") {\n return \"JAAS\";\n }\n if (type.includes(\"FormClient\")) {\n return \"PAC4J_FORM\";\n } else if (type.includes(\"BasicClient\")) {\n return \"PAC4J_BASIC\";\n }\n\n throw new Error(`Unsupported login type found: ${type}`);\n }\n\n /**\n */\n get isBasicAuthentication(): boolean {\n return this._isBasic || this.authenticationType === \"PAC4J_BASIC\";\n }\n\n /**\n */\n set isBasicAuthentication(isBasicAuthentication: boolean) {\n this._isBasic = isBasicAuthentication;\n }\n\n /**\n */\n initLogin(initLogin: boolean): Promise<any> {\n if (this.isBasicAuthentication || !initLogin) {\n return Promise.resolve(true);\n }\n\n return universalFetch({\n url: `${BASE}/login`,\n method: HTTP_METHODS.GET,\n headers: {\n Accept: \"application/json\",\n \"Content-Type\": \"application/x-www-form-urlencoded\",\n },\n }).catch((error) => {\n // when an unauthorizedexception is received on a request to the login service,\n // this indicates a basic authorization scenario\n // in case of form based authentication other exceptions are thrown\n if (error instanceof UnauthorizedException) {\n this.isBasicAuthentication = true;\n }\n\n return Promise.resolve({});\n });\n }\n\n /**\n */\n login(username: string, password: string): Promise<any> {\n switch (this.authenticationType) {\n case \"PAC4J_FORM\":\n return this.doFormLogin(username, password);\n case \"PAC4J_BASIC\":\n return this.doBasicAuthentication(username, password);\n default:\n return this.doJaasAuthentication(username, password);\n }\n }\n\n /**\n */\n getFormLoginUrl(): string {\n switch (this.authenticationType) {\n case \"PAC4J_BASIC\":\n case \"PAC4J_FORM\":\n return `${BASE}${loginPath()}`;\n default:\n return `${BASE}/j_security_check`;\n }\n }\n\n /**\n */\n getFormLoginData(username: string, password: string): string {\n const encodedUsername = encodeURIComponent(username);\n const encodedPassword = encodeURIComponent(password);\n\n switch (this.authenticationType) {\n case \"PAC4J_BASIC\":\n case \"PAC4J_FORM\":\n return `${loginUsernameField()}=${encodedUsername}&${loginPasswordField()}=${encodedPassword}`;\n default:\n return `j_username=${encodedUsername}&j_password=${encodedPassword}`;\n }\n }\n\n /**\n */\n doFormLogin(username: string, password: string): Promise<any> {\n return universalFetch({\n url: this.getFormLoginUrl(),\n method: HTTP_METHODS.POST,\n headers: {\n Accept: \"application/json\",\n \"Content-Type\": \"application/x-www-form-urlencoded\",\n },\n data: this.getFormLoginData(username, password),\n });\n }\n\n /**\n */\n doBasicAuthentication(username: string, password: string): Promise<any> {\n Cache.addItem(\"basic\", btoa(`${username}:${password}`));\n return Promise.resolve();\n }\n\n /**\n */\n doJaasAuthentication(username: string, password: string): Promise<any> {\n return this.initLogin(true).then(() => {\n if (this.isBasicAuthentication) {\n return this.doBasicAuthentication(username, password);\n }\n return this.doFormLogin(username, password);\n });\n }\n\n /**\n */\n logout(): Promise<void> {\n return universalFetch({\n url: `${BASE}${logoutPath()}`,\n }).then(() => {\n // clear cache because of cached contributions\n Cache.clear();\n });\n }\n}\n\nexport default Authenticate;\n"],"mappings":";;;;;;AACA,SAASA,IAAT,EAAeC,YAAf,QAAmC,wBAAnC;AAEA,OAAOC,cAAP,MAA2B,+BAA3B;AACA,OAAOC,KAAP,MAAkB,wBAAlB;AAEA,SAASC,qBAAT,QAAsC,eAAtC;AACA,SACEC,SADF,EAEEC,SAFF,EAGEC,kBAHF,EAIEC,kBAJF,EAKEC,UALF,QAMO,cANP;AAQA;AACA;;IACMC,Y;EAGJ;AACF;EACE,wBAAc;IAAA;;IAAA;;IACZ,KAAKC,QAAL,GAAgB,KAAhB;EACD;EAED;AACF;;;;;SACE,eAAgE;MAC9D,IAAMC,IAAI,GAAGP,SAAS,EAAtB;;MAEA,IAAI,CAACO,IAAD,IAASA,IAAI,KAAK,MAAtB,EAA8B;QAC5B,OAAO,MAAP;MACD;;MACD,IAAI,0BAAAA,IAAI,MAAJ,CAAAA,IAAI,EAAU,YAAV,CAAR,EAAiC;QAC/B,OAAO,YAAP;MACD,CAFD,MAEO,IAAI,0BAAAA,IAAI,MAAJ,CAAAA,IAAI,EAAU,aAAV,CAAR,EAAkC;QACvC,OAAO,aAAP;MACD;;MAED,MAAM,IAAIC,KAAJ,yCAA2CD,IAA3C,EAAN;IACD;IAED;AACF;;;;SACE,eAAqC;MACnC,OAAO,KAAKD,QAAL,IAAiB,KAAKG,kBAAL,KAA4B,aAApD;IACD;IAED;AACF;;SACE,aAA0BC,qBAA1B,EAA0D;MACxD,KAAKJ,QAAL,GAAgBI,qBAAhB;IACD;IAED;AACF;;;;WACE,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AAP;IAMD;;;;;;AAGH,eAAe9B,YAAf"}
1
+ {"version":3,"file":"Authenticate.js","names":["BASE","HTTP_METHODS","universalFetch","Cache","UnauthorizedException","loginType","loginPath","loginPasswordField","loginUsernameField","logoutPath","Authenticate","_isBasic","type","Error","authenticationType","isBasicAuthentication","initLogin","resolve","url","method","GET","headers","Accept","catch","error","username","password","doFormLogin","doBasicAuthentication","doJaasAuthentication","encodedUsername","encodeURIComponent","encodedPassword","getFormLoginUrl","POST","data","getFormLoginData","addItem","btoa","then","response","clear"],"sources":["../../src/modularui/Authenticate.js"],"sourcesContent":["// @flow\nimport { BASE, HTTP_METHODS } from \"../constants/Constants\";\n\nimport universalFetch from \"../utils/fetch/universalFetch\";\nimport Cache from \"../utils/browser/Cache\";\n\nimport { UnauthorizedException } from \"../exceptions\";\nimport {\n loginType,\n loginPath,\n loginPasswordField,\n loginUsernameField,\n logoutPath,\n} from \"../constants\";\n\n/**\n */\nclass Authenticate {\n _isBasic: boolean;\n\n /**\n */\n constructor() {\n this._isBasic = false;\n }\n\n /**\n */\n get authenticationType(): \"JAAS\" | \"PAC4J_FORM\" | \"PAC4J_BASIC\" {\n const type = loginType();\n\n if (!type || type === \"JAAS\") {\n return \"JAAS\";\n }\n if (type.includes(\"FormClient\")) {\n return \"PAC4J_FORM\";\n } else if (type.includes(\"BasicClient\")) {\n return \"PAC4J_BASIC\";\n }\n\n throw new Error(`Unsupported login type found: ${type}`);\n }\n\n /**\n */\n get isBasicAuthentication(): boolean {\n return this._isBasic || this.authenticationType === \"PAC4J_BASIC\";\n }\n\n /**\n */\n set isBasicAuthentication(isBasicAuthentication: boolean) {\n this._isBasic = isBasicAuthentication;\n }\n\n /**\n */\n initLogin(initLogin: boolean): Promise<any> {\n if (this.isBasicAuthentication || !initLogin) {\n return Promise.resolve(true);\n }\n\n return universalFetch({\n url: `${BASE}/login`,\n method: HTTP_METHODS.GET,\n headers: {\n Accept: \"application/json\",\n \"Content-Type\": \"application/x-www-form-urlencoded\",\n },\n }).catch((error) => {\n // when an unauthorizedexception is received on a request to the login service,\n // this indicates a basic authorization scenario\n // in case of form based authentication other exceptions are thrown\n if (error instanceof UnauthorizedException) {\n this.isBasicAuthentication = true;\n }\n\n return Promise.resolve({});\n });\n }\n\n /**\n */\n login(username: string, password: string): Promise<any> {\n switch (this.authenticationType) {\n case \"PAC4J_FORM\":\n return this.doFormLogin(username, password);\n case \"PAC4J_BASIC\":\n return this.doBasicAuthentication(username, password);\n default:\n return this.doJaasAuthentication(username, password);\n }\n }\n\n /**\n */\n getFormLoginUrl(): string {\n switch (this.authenticationType) {\n case \"PAC4J_BASIC\":\n case \"PAC4J_FORM\":\n return `${BASE}${loginPath()}`;\n default:\n return `${BASE}/j_security_check`;\n }\n }\n\n /**\n */\n getFormLoginData(username: string, password: string): string {\n const encodedUsername = encodeURIComponent(username);\n const encodedPassword = encodeURIComponent(password);\n\n switch (this.authenticationType) {\n case \"PAC4J_BASIC\":\n case \"PAC4J_FORM\":\n return `${loginUsernameField()}=${encodedUsername}&${loginPasswordField()}=${encodedPassword}`;\n default:\n return `j_username=${encodedUsername}&j_password=${encodedPassword}`;\n }\n }\n\n /**\n */\n doFormLogin(username: string, password: string): Promise<any> {\n return universalFetch({\n url: this.getFormLoginUrl(),\n method: HTTP_METHODS.POST,\n headers: {\n Accept: \"application/json\",\n \"Content-Type\": \"application/x-www-form-urlencoded\",\n },\n data: this.getFormLoginData(username, password),\n });\n }\n\n /**\n */\n doBasicAuthentication(username: string, password: string): Promise<any> {\n Cache.addItem(\"basic\", btoa(`${username}:${password}`));\n return Promise.resolve();\n }\n\n /**\n */\n doJaasAuthentication(username: string, password: string): Promise<any> {\n return this.initLogin(true).then(() => {\n if (this.isBasicAuthentication) {\n return this.doBasicAuthentication(username, password);\n }\n return this.doFormLogin(username, password);\n });\n }\n\n /**\n */\n logout(): Promise<any> {\n return universalFetch({\n url: `${BASE}${logoutPath()}`,\n }).then((response) => {\n // clear cache because of cached contributions\n Cache.clear();\n return response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pBgB,GAAG,EAAE,KAAKe,eAAL,EADe;QAEpBd,MAAM,EAAElB,YAAY,CAACiC,IAFD;QAGpBb,OAAO,EAAE;UACPC,MAAM,EAAE,kBADD;UAEP,gBAAgB;QAFT,CAHW;QAOpBa,IAAI,EAAE,KAAKC,gBAAL,CAAsBX,QAAtB,EAAgCC,QAAhC;MAPc,CAAD,CAArB;IASD;IAED;AACF;;;;WACE,+BAAsBD,QAAtB,EAAwCC,QAAxC,EAAwE;MAAA;;MACtEvB,KAAK,CAACkC,OAAN,CAAc,OAAd,EAAuBC,IAAI,+CAAIb,QAAJ,wBAAgBC,QAAhB,EAA3B;MACA,OAAO,SAAQT,OAAR,EAAP;IACD;IAED;AACF;;;;WACE,8BAAqBQ,QAArB,EAAuCC,QAAvC,EAAuE;MAAA;;MACrE,OAAO,KAAKV,SAAL,CAAe,IAAf,EAAqBuB,IAArB,CAA0B,YAAM;QACrC,IAAI,MAAI,CAACxB,qBAAT,EAAgC;UAC9B,OAAO,MAAI,CAACa,qBAAL,CAA2BH,QAA3B,EAAqCC,QAArC,CAAP;QACD;;QACD,OAAO,MAAI,CAACC,WAAL,CAAiBF,QAAjB,EAA2BC,QAA3B,CAAP;MACD,CALM,CAAP;IAMD;IAED;AACF;;;;WACE,kBAAuB;MAAA;;MACrB,OAAOxB,cAAc,CAAC;QACpBgB,GAAG,gDAAKlB,IAAL,mBAAYS,UAAU,EAAtB;MADiB,CAAD,CAAd,CAEJ8B,IAFI,CAEC,UAACC,QAAD,EAAc;QACpB;QACArC,KAAK,CAACsC,KAAN;QACA,OAAOD,QAAP;MACD,CANM,CAAP;IAOD;;;;;;AAGH,eAAe9B,YAAf"}
@@ -1,10 +1,11 @@
1
1
  import Authenticate from "../../modularui/Authenticate";
2
2
  import { startProgress, finishProgress } from "./ProgressIndicator";
3
3
  import { resetModularUI } from "../_modularui/actions";
4
-
4
+ import { reloadApplication } from "./Application";
5
5
  /**
6
6
  * Send logout success action
7
7
  */
8
+
8
9
  export var logoutSuccess = function logoutSuccess() {
9
10
  return {
10
11
  type: "AUTHENTICATION_LOGOUT"
@@ -17,7 +18,10 @@ export var logout = function logout() {
17
18
  return function (dispatch) {
18
19
  dispatch(startProgress());
19
20
  return new Authenticate().logout().then(function () {
20
- dispatch(resetModularUI());
21
+ return dispatch(resetModularUI());
22
+ }).then(function () {
23
+ return dispatch(reloadApplication());
24
+ }).then(function () {
21
25
  dispatch(logoutSuccess());
22
26
  return dispatch(finishProgress());
23
27
  });
@@ -1 +1 @@
1
- {"version":3,"file":"SignOut.js","names":["Authenticate","startProgress","finishProgress","resetModularUI","logoutSuccess","type","logout","dispatch","then"],"sources":["../../../src/redux/actions/SignOut.js"],"sourcesContent":["// @flow\nimport Authenticate from \"../../modularui/Authenticate\";\nimport { startProgress, finishProgress } from \"./ProgressIndicator\";\nimport { resetModularUI } from \"../_modularui/actions\";\n\nimport type { Dispatch, LogoutSuccessAction, ThunkAction } from \"../types\";\n\n/**\n * Send logout success action\n */\nexport const logoutSuccess = (): LogoutSuccessAction => ({\n type: \"AUTHENTICATION_LOGOUT\",\n});\n\n/**\n */\nexport const logout = (): ThunkAction => (dispatch: Dispatch) => {\n dispatch(startProgress());\n\n return new Authenticate().logout().then(() => {\n dispatch(resetModularUI());\n dispatch(logoutSuccess());\n return dispatch(finishProgress());\n });\n};\n"],"mappings":"AACA,OAAOA,YAAP,MAAyB,8BAAzB;AACA,SAASC,aAAT,EAAwBC,cAAxB,QAA8C,qBAA9C;AACA,SAASC,cAAT,QAA+B,uBAA/B;;AAIA;AACA;AACA;AACA,OAAO,IAAMC,aAAa,GAAG,SAAhBA,aAAgB;EAAA,OAA4B;IACvDC,IAAI,EAAE;EADiD,CAA5B;AAAA,CAAtB;AAIP;AACA;;AACA,OAAO,IAAMC,MAAM,GAAG,SAATA,MAAS;EAAA,OAAmB,UAACC,QAAD,EAAwB;IAC/DA,QAAQ,CAACN,aAAa,EAAd,CAAR;IAEA,OAAO,IAAID,YAAJ,GAAmBM,MAAnB,GAA4BE,IAA5B,CAAiC,YAAM;MAC5CD,QAAQ,CAACJ,cAAc,EAAf,CAAR;MACAI,QAAQ,CAACH,aAAa,EAAd,CAAR;MACA,OAAOG,QAAQ,CAACL,cAAc,EAAf,CAAf;IACD,CAJM,CAAP;EAKD,CARqB;AAAA,CAAf"}
1
+ {"version":3,"file":"SignOut.js","names":["Authenticate","startProgress","finishProgress","resetModularUI","reloadApplication","logoutSuccess","type","logout","dispatch","then"],"sources":["../../../src/redux/actions/SignOut.js"],"sourcesContent":["// @flow\nimport Authenticate from \"../../modularui/Authenticate\";\nimport { startProgress, finishProgress } from \"./ProgressIndicator\";\nimport { resetModularUI } from \"../_modularui/actions\";\n\nimport type { Dispatch, LogoutSuccessAction, ThunkAction } from \"../types\";\nimport { reloadApplication } from \"./Application\";\n\n/**\n * Send logout success action\n */\nexport const logoutSuccess = (): LogoutSuccessAction => ({\n type: \"AUTHENTICATION_LOGOUT\",\n});\n\n/**\n */\nexport const logout = (): ThunkAction => (dispatch: Dispatch) => {\n dispatch(startProgress());\n\n return new Authenticate()\n .logout()\n .then(() => dispatch(resetModularUI()))\n .then(() => dispatch(reloadApplication()))\n .then(() => {\n dispatch(logoutSuccess());\n return dispatch(finishProgress());\n });\n};\n"],"mappings":"AACA,OAAOA,YAAP,MAAyB,8BAAzB;AACA,SAASC,aAAT,EAAwBC,cAAxB,QAA8C,qBAA9C;AACA,SAASC,cAAT,QAA+B,uBAA/B;AAGA,SAASC,iBAAT,QAAkC,eAAlC;AAEA;AACA;AACA;;AACA,OAAO,IAAMC,aAAa,GAAG,SAAhBA,aAAgB;EAAA,OAA4B;IACvDC,IAAI,EAAE;EADiD,CAA5B;AAAA,CAAtB;AAIP;AACA;;AACA,OAAO,IAAMC,MAAM,GAAG,SAATA,MAAS;EAAA,OAAmB,UAACC,QAAD,EAAwB;IAC/DA,QAAQ,CAACP,aAAa,EAAd,CAAR;IAEA,OAAO,IAAID,YAAJ,GACJO,MADI,GAEJE,IAFI,CAEC;MAAA,OAAMD,QAAQ,CAACL,cAAc,EAAf,CAAd;IAAA,CAFD,EAGJM,IAHI,CAGC;MAAA,OAAMD,QAAQ,CAACJ,iBAAiB,EAAlB,CAAd;IAAA,CAHD,EAIJK,IAJI,CAIC,YAAM;MACVD,QAAQ,CAACH,aAAa,EAAd,CAAR;MACA,OAAOG,QAAQ,CAACN,cAAc,EAAf,CAAf;IACD,CAPI,CAAP;EAQD,CAXqB;AAAA,CAAf"}
@@ -1,12 +1,13 @@
1
1
  import { connect } from "react-redux";
2
2
  import { login } from "../actions/SignIn";
3
3
  import { getApplication } from "../_modularui/selectors";
4
- import UserServicesModel from "../../models/user/UserServicesModel";
5
4
 
6
5
  var mapStateToProps = function mapStateToProps(state) {
6
+ var _application$isLogged;
7
+
7
8
  var application = getApplication(state);
8
9
  return {
9
- isAuthenticated: state.auth.isAuthenticated && (application === null || application === void 0 ? void 0 : application.userServices) instanceof UserServicesModel && application.userServices.isLoggedIn,
10
+ isAuthenticated: (_application$isLogged = application === null || application === void 0 ? void 0 : application.isLoggedIn) !== null && _application$isLogged !== void 0 ? _application$isLogged : false,
10
11
  errorMessage: state.auth.error
11
12
  };
12
13
  };
@@ -1 +1 @@
1
- {"version":3,"file":"SignIn.js","names":["connect","login","getApplication","UserServicesModel","mapStateToProps","state","application","isAuthenticated","auth","userServices","isLoggedIn","errorMessage","error","mapDispatchToProps","onSubmit","connectSignIn"],"sources":["../../../src/redux/connectors/SignIn.js"],"sourcesContent":["// @flow\nimport { connect } from \"react-redux\";\n\nimport { login } from \"../actions/SignIn\";\n\nimport { getApplication } from \"../_modularui/selectors\";\n\nimport UserServicesModel from \"../../models/user/UserServicesModel\";\n\nimport type { ReduxState, ThunkAction } from \"../types\";\nimport type { ComponentType } from \"react\";\n\ntype StateProps = {\n isAuthenticated: boolean,\n errorMessage: ?string,\n};\n\ntype DispatchProps = {\n onSubmit: (username: string, password: string) => ThunkAction,\n};\n\ntype Props = {\n ...StateProps,\n ...DispatchProps,\n};\n\nconst mapStateToProps = (state: ReduxState): StateProps => {\n const application = getApplication(state);\n\n return {\n isAuthenticated:\n state.auth.isAuthenticated &&\n application?.userServices instanceof UserServicesModel &&\n application.userServices.isLoggedIn,\n errorMessage: state.auth.error,\n };\n};\n\nconst mapDispatchToProps: DispatchProps = {\n onSubmit: login,\n};\n\n/**\n */\nexport const connectSignIn: ComponentType<any> = connect<\n Props,\n {},\n StateProps,\n _,\n _,\n _\n>(mapStateToProps, mapDispatchToProps);\n"],"mappings":"AACA,SAASA,OAAT,QAAwB,aAAxB;AAEA,SAASC,KAAT,QAAsB,mBAAtB;AAEA,SAASC,cAAT,QAA+B,yBAA/B;AAEA,OAAOC,iBAAP,MAA8B,qCAA9B;;AAmBA,IAAMC,eAAe,GAAG,SAAlBA,eAAkB,CAACC,KAAD,EAAmC;EACzD,IAAMC,WAAW,GAAGJ,cAAc,CAACG,KAAD,CAAlC;EAEA,OAAO;IACLE,eAAe,EACbF,KAAK,CAACG,IAAN,CAAWD,eAAX,IACA,CAAAD,WAAW,SAAX,IAAAA,WAAW,WAAX,YAAAA,WAAW,CAAEG,YAAb,aAAqCN,iBADrC,IAEAG,WAAW,CAACG,YAAZ,CAAyBC,UAJtB;IAKLC,YAAY,EAAEN,KAAK,CAACG,IAAN,CAAWI;EALpB,CAAP;AAOD,CAVD;;AAYA,IAAMC,kBAAiC,GAAG;EACxCC,QAAQ,EAAEb;AAD8B,CAA1C;AAIA;AACA;;AACA,OAAO,IAAMc,aAAiC,GAAGf,OAAO,CAOtDI,eAPsD,EAOrCS,kBAPqC,CAAjD"}
1
+ {"version":3,"file":"SignIn.js","names":["connect","login","getApplication","mapStateToProps","state","application","isAuthenticated","isLoggedIn","errorMessage","auth","error","mapDispatchToProps","onSubmit","connectSignIn"],"sources":["../../../src/redux/connectors/SignIn.js"],"sourcesContent":["// @flow\nimport { connect } from \"react-redux\";\n\nimport { login } from \"../actions/SignIn\";\n\nimport { getApplication } from \"../_modularui/selectors\";\n\nimport type { ReduxState, ThunkAction } from \"../types\";\nimport type { ComponentType } from \"react\";\n\ntype StateProps = {\n isAuthenticated: boolean,\n errorMessage: ?string,\n};\n\ntype DispatchProps = {\n onSubmit: (username: string, password: string) => ThunkAction,\n};\n\ntype Props = {\n ...StateProps,\n ...DispatchProps,\n};\n\nconst mapStateToProps = (state: ReduxState): StateProps => {\n const application = getApplication(state);\n\n return {\n isAuthenticated: application?.isLoggedIn ?? false,\n errorMessage: state.auth.error,\n };\n};\n\nconst mapDispatchToProps: DispatchProps = {\n onSubmit: login,\n};\n\n/**\n */\nexport const connectSignIn: ComponentType<any> = connect<\n Props,\n {},\n StateProps,\n _,\n _,\n _\n>(mapStateToProps, mapDispatchToProps);\n"],"mappings":"AACA,SAASA,OAAT,QAAwB,aAAxB;AAEA,SAASC,KAAT,QAAsB,mBAAtB;AAEA,SAASC,cAAT,QAA+B,yBAA/B;;AAmBA,IAAMC,eAAe,GAAG,SAAlBA,eAAkB,CAACC,KAAD,EAAmC;EAAA;;EACzD,IAAMC,WAAW,GAAGH,cAAc,CAACE,KAAD,CAAlC;EAEA,OAAO;IACLE,eAAe,2BAAED,WAAF,aAAEA,WAAF,uBAAEA,WAAW,CAAEE,UAAf,yEAA6B,KADvC;IAELC,YAAY,EAAEJ,KAAK,CAACK,IAAN,CAAWC;EAFpB,CAAP;AAID,CAPD;;AASA,IAAMC,kBAAiC,GAAG;EACxCC,QAAQ,EAAEX;AAD8B,CAA1C;AAIA;AACA;;AACA,OAAO,IAAMY,aAAiC,GAAGb,OAAO,CAOtDG,eAPsD,EAOrCQ,kBAPqC,CAAjD"}
@@ -1,9 +1,12 @@
1
1
  import { connect } from "react-redux";
2
2
  import { logout } from "../actions/SignOut";
3
+ import { getApplication } from "../_modularui";
3
4
 
4
5
  var mapStateToProps = function mapStateToProps(state) {
6
+ var _getApplication$isLog, _getApplication;
7
+
5
8
  return {
6
- isAuthenticated: state.auth.isAuthenticated
9
+ isAuthenticated: (_getApplication$isLog = (_getApplication = getApplication(state)) === null || _getApplication === void 0 ? void 0 : _getApplication.isLoggedIn) !== null && _getApplication$isLog !== void 0 ? _getApplication$isLog : false
7
10
  };
8
11
  };
9
12
 
@@ -1 +1 @@
1
- {"version":3,"file":"SignOut.js","names":["connect","logout","mapStateToProps","state","isAuthenticated","auth","mapDispatchToProps","doLogout","connectSignOut"],"sources":["../../../src/redux/connectors/SignOut.js"],"sourcesContent":["// @flow\nimport { connect } from \"react-redux\";\n\nimport { logout } from \"../actions/SignOut\";\n\nimport type { ThunkAction } from \"../types\";\nimport type { ComponentType } from \"react\";\n\ntype StateProps = {\n isAuthenticated: boolean,\n};\n\ntype DispatchProps = {\n doLogout: () => ThunkAction,\n};\n\ntype Props = {\n ...StateProps,\n ...DispatchProps,\n};\n\nconst mapStateToProps = (state): StateProps => ({\n isAuthenticated: state.auth.isAuthenticated,\n});\n\nconst mapDispatchToProps = { doLogout: logout };\n\n/**\n */\nexport const connectSignOut: ComponentType<any> = connect<\n Props,\n {},\n StateProps,\n _,\n _,\n _\n>(mapStateToProps, mapDispatchToProps);\n"],"mappings":"AACA,SAASA,OAAT,QAAwB,aAAxB;AAEA,SAASC,MAAT,QAAuB,oBAAvB;;AAkBA,IAAMC,eAAe,GAAG,SAAlBA,eAAkB,CAACC,KAAD;EAAA,OAAwB;IAC9CC,eAAe,EAAED,KAAK,CAACE,IAAN,CAAWD;EADkB,CAAxB;AAAA,CAAxB;;AAIA,IAAME,kBAAkB,GAAG;EAAEC,QAAQ,EAAEN;AAAZ,CAA3B;AAEA;AACA;;AACA,OAAO,IAAMO,cAAkC,GAAGR,OAAO,CAOvDE,eAPuD,EAOtCI,kBAPsC,CAAlD"}
1
+ {"version":3,"file":"SignOut.js","names":["connect","logout","getApplication","mapStateToProps","state","isAuthenticated","isLoggedIn","mapDispatchToProps","doLogout","connectSignOut"],"sources":["../../../src/redux/connectors/SignOut.js"],"sourcesContent":["// @flow\nimport { connect } from \"react-redux\";\n\nimport { logout } from \"../actions/SignOut\";\n\nimport type { ThunkAction } from \"../types\";\nimport type { ComponentType } from \"react\";\nimport { getApplication } from \"../_modularui\";\n\ntype StateProps = {\n isAuthenticated: boolean,\n};\n\ntype DispatchProps = {\n doLogout: () => ThunkAction,\n};\n\ntype Props = {\n ...StateProps,\n ...DispatchProps,\n};\n\nconst mapStateToProps = (state): StateProps => ({\n isAuthenticated: getApplication(state)?.isLoggedIn ?? false,\n});\n\nconst mapDispatchToProps = { doLogout: logout };\n\n/**\n */\nexport const connectSignOut: ComponentType<any> = connect<\n Props,\n {},\n StateProps,\n _,\n _,\n _\n>(mapStateToProps, mapDispatchToProps);\n"],"mappings":"AACA,SAASA,OAAT,QAAwB,aAAxB;AAEA,SAASC,MAAT,QAAuB,oBAAvB;AAIA,SAASC,cAAT,QAA+B,eAA/B;;AAeA,IAAMC,eAAe,GAAG,SAAlBA,eAAkB,CAACC,KAAD;EAAA;;EAAA,OAAwB;IAC9CC,eAAe,8CAAEH,cAAc,CAACE,KAAD,CAAhB,oDAAE,gBAAuBE,UAAzB,yEAAuC;EADR,CAAxB;AAAA,CAAxB;;AAIA,IAAMC,kBAAkB,GAAG;EAAEC,QAAQ,EAAEP;AAAZ,CAA3B;AAEA;AACA;;AACA,OAAO,IAAMQ,cAAkC,GAAGT,OAAO,CAOvDG,eAPuD,EAOtCI,kBAPsC,CAAlD"}
@@ -9,10 +9,8 @@ function ownKeys(object, enumerableOnly) { var keys = _Object$keys(object); if (
9
9
 
10
10
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : _Object$getOwnPropertyDescriptors ? Object.defineProperties(target, _Object$getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, _Object$getOwnPropertyDescriptor(source, key)); }); } return target; }
11
11
 
12
- import Cache from "../../utils/browser/Cache";
13
12
  // REDUCER
14
13
  var initialState = {
15
- isAuthenticated: false,
16
14
  mustChangePassword: false,
17
15
  error: null
18
16
  };
@@ -31,7 +29,6 @@ var AuthReducer = function AuthReducer() {
31
29
  switch (action.type) {
32
30
  case "AUTHENTICATION_SUCCESS":
33
31
  return _objectSpread(_objectSpread({}, state), {}, {
34
- isAuthenticated: true,
35
32
  error: null,
36
33
  mustChangePassword: false
37
34
  });
@@ -49,21 +46,14 @@ var AuthReducer = function AuthReducer() {
49
46
 
50
47
  case "AUTHENTICATION_LOGOUT":
51
48
  {
52
- // clear cache because of cached contributions
53
- if (state.isAuthenticated) {
54
- Cache.clear();
55
- }
56
-
57
49
  return _objectSpread(_objectSpread({}, state), {}, {
58
50
  mustChangePassword: false,
59
- isAuthenticated: false,
60
51
  error: null
61
52
  });
62
53
  }
63
54
 
64
55
  case "CHANGE_PASSWORD":
65
56
  return _objectSpread(_objectSpread({}, state), {}, {
66
- isAuthenticated: true,
67
57
  mustChangePassword: true,
68
58
  error: null
69
59
  });
@@ -1 +1 @@
1
- {"version":3,"file":"AuthReducer.js","names":["Cache","initialState","isAuthenticated","mustChangePassword","error","AuthReducer","state","action","type","payload","clear"],"sources":["../../../src/redux/reducers/AuthReducer.js"],"sourcesContent":["// @flow\nimport Cache from \"../../utils/browser/Cache\";\n\nimport type { Reducer } from \"redux\";\nimport type { AuthState, ReduxAction } from \"../types\";\n\n// REDUCER\nconst initialState: AuthState = {\n isAuthenticated: false,\n mustChangePassword: false,\n error: null,\n};\n\n/**\n * Auth reducer\n */\nconst AuthReducer: Reducer<AuthState, ReduxAction> = (\n state = initialState,\n action\n) => {\n if (!action) {\n return state;\n }\n\n switch (action.type) {\n case \"AUTHENTICATION_SUCCESS\":\n return {\n ...state,\n isAuthenticated: true,\n error: null,\n mustChangePassword: false,\n };\n\n case \"AUTHENTICATION_ERROR\":\n return { ...state, mustChangePassword: false, error: action.payload };\n\n case \"AUTHENTICATION_RESET_ERRORS\":\n return { ...state, error: null };\n\n case \"AUTHENTICATION_LOGOUT\": {\n // clear cache because of cached contributions\n if (state.isAuthenticated) {\n Cache.clear();\n }\n\n return {\n ...state,\n mustChangePassword: false,\n isAuthenticated: false,\n error: null,\n };\n }\n\n case \"CHANGE_PASSWORD\":\n return {\n ...state,\n isAuthenticated: true,\n mustChangePassword: true,\n error: null,\n };\n\n default:\n return state;\n }\n};\n\nexport default AuthReducer;\n"],"mappings":";;;;;;;;;;;AACA,OAAOA,KAAP,MAAkB,2BAAlB;AAKA;AACA,IAAMC,YAAuB,GAAG;EAC9BC,eAAe,EAAE,KADa;EAE9BC,kBAAkB,EAAE,KAFU;EAG9BC,KAAK,EAAE;AAHuB,CAAhC;AAMA;AACA;AACA;;AACA,IAAMC,WAA4C,GAAG,SAA/CA,WAA+C,GAGhD;EAAA,IAFHC,KAEG,uEAFKL,YAEL;EAAA,IADHM,MACG;;EACH,IAAI,CAACA,MAAL,EAAa;IACX,OAAOD,KAAP;EACD;;EAED,QAAQC,MAAM,CAACC,IAAf;IACE,KAAK,wBAAL;MACE,uCACKF,KADL;QAEEJ,eAAe,EAAE,IAFnB;QAGEE,KAAK,EAAE,IAHT;QAIED,kBAAkB,EAAE;MAJtB;;IAOF,KAAK,sBAAL;MACE,uCAAYG,KAAZ;QAAmBH,kBAAkB,EAAE,KAAvC;QAA8CC,KAAK,EAAEG,MAAM,CAACE;MAA5D;;IAEF,KAAK,6BAAL;MACE,uCAAYH,KAAZ;QAAmBF,KAAK,EAAE;MAA1B;;IAEF,KAAK,uBAAL;MAA8B;QAC5B;QACA,IAAIE,KAAK,CAACJ,eAAV,EAA2B;UACzBF,KAAK,CAACU,KAAN;QACD;;QAED,uCACKJ,KADL;UAEEH,kBAAkB,EAAE,KAFtB;UAGED,eAAe,EAAE,KAHnB;UAIEE,KAAK,EAAE;QAJT;MAMD;;IAED,KAAK,iBAAL;MACE,uCACKE,KADL;QAEEJ,eAAe,EAAE,IAFnB;QAGEC,kBAAkB,EAAE,IAHtB;QAIEC,KAAK,EAAE;MAJT;;IAOF;MACE,OAAOE,KAAP;EAtCJ;AAwCD,CAhDD;;AAkDA,eAAeD,WAAf"}
1
+ {"version":3,"file":"AuthReducer.js","names":["initialState","mustChangePassword","error","AuthReducer","state","action","type","payload"],"sources":["../../../src/redux/reducers/AuthReducer.js"],"sourcesContent":["// @flow\nimport type { Reducer } from \"redux\";\nimport type { AuthState, ReduxAction } from \"../types\";\n\n// REDUCER\nconst initialState: AuthState = {\n mustChangePassword: false,\n error: null,\n};\n\n/**\n * Auth reducer\n */\nconst AuthReducer: Reducer<AuthState, ReduxAction> = (\n state = initialState,\n action\n) => {\n if (!action) {\n return state;\n }\n\n switch (action.type) {\n case \"AUTHENTICATION_SUCCESS\":\n return {\n ...state,\n error: null,\n mustChangePassword: false,\n };\n\n case \"AUTHENTICATION_ERROR\":\n return { ...state, mustChangePassword: false, error: action.payload };\n\n case \"AUTHENTICATION_RESET_ERRORS\":\n return { ...state, error: null };\n\n case \"AUTHENTICATION_LOGOUT\": {\n return {\n ...state,\n mustChangePassword: false,\n error: null,\n };\n }\n\n case \"CHANGE_PASSWORD\":\n return {\n ...state,\n mustChangePassword: true,\n error: null,\n };\n\n default:\n return state;\n }\n};\n\nexport default AuthReducer;\n"],"mappings":";;;;;;;;;;;AAIA;AACA,IAAMA,YAAuB,GAAG;EAC9BC,kBAAkB,EAAE,KADU;EAE9BC,KAAK,EAAE;AAFuB,CAAhC;AAKA;AACA;AACA;;AACA,IAAMC,WAA4C,GAAG,SAA/CA,WAA+C,GAGhD;EAAA,IAFHC,KAEG,uEAFKJ,YAEL;EAAA,IADHK,MACG;;EACH,IAAI,CAACA,MAAL,EAAa;IACX,OAAOD,KAAP;EACD;;EAED,QAAQC,MAAM,CAACC,IAAf;IACE,KAAK,wBAAL;MACE,uCACKF,KADL;QAEEF,KAAK,EAAE,IAFT;QAGED,kBAAkB,EAAE;MAHtB;;IAMF,KAAK,sBAAL;MACE,uCAAYG,KAAZ;QAAmBH,kBAAkB,EAAE,KAAvC;QAA8CC,KAAK,EAAEG,MAAM,CAACE;MAA5D;;IAEF,KAAK,6BAAL;MACE,uCAAYH,KAAZ;QAAmBF,KAAK,EAAE;MAA1B;;IAEF,KAAK,uBAAL;MAA8B;QAC5B,uCACKE,KADL;UAEEH,kBAAkB,EAAE,KAFtB;UAGEC,KAAK,EAAE;QAHT;MAKD;;IAED,KAAK,iBAAL;MACE,uCACKE,KADL;QAEEH,kBAAkB,EAAE,IAFtB;QAGEC,KAAK,EAAE;MAHT;;IAMF;MACE,OAAOE,KAAP;EA9BJ;AAgCD,CAxCD;;AA0CA,eAAeD,WAAf"}
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","names":[],"sources":["../../src/redux/types.js"],"sourcesContent":["// @flow\nimport type { Store, DispatchAPI } from \"redux\";\n\nimport type ErrorResponse from \"../models/error/ErrorResponse\";\n\nimport type FormModel from \"../models/form/FormModel\";\nimport typeof {\n NOTIFICATION_TYPES,\n AUTOSAVE_STATUS,\n} from \"../constants/Constants\";\n\nimport type { MessageObject } from \"../i18n/types\";\nimport type {\n I18nState,\n UpdateLocaleAction,\n SetLocalesAction,\n} from \"./_i18n/types\";\nimport type {\n ModularUIState,\n ModularUIAction,\n UpdateStatusAction,\n SetModelAction,\n UpdateModelAction,\n RemoveModelByKeyAction,\n ResetModularUIAction,\n} from \"./_modularui/types\";\nimport type {\n RouterState,\n LocationChangeAction,\n PushAction,\n ReplaceAction,\n GoAction,\n GoBackAction,\n GoForwardAction,\n} from \"./_router/types\";\n\nexport type PreferenceValue =\n | null\n | string\n | boolean\n | { [key: string]: any }\n | Array<PreferenceValue>;\n\nexport type UpdateFormOptions = {\n autosubmit: boolean,\n autosave: boolean,\n forceUpdate?: boolean,\n /** Default true: Activate/deactivate the form object validate by an update */\n validate?: boolean,\n};\n\nexport type NoAction = {\n type: \"NO_ACTION\",\n};\n\nexport type SaveErrorAction = {\n type: \"SAVE_ERROR\",\n payload: ErrorResponse,\n};\n\nexport type ShowModalAction = {\n type: \"SHOW_MODAL\",\n payload: string,\n};\n\nexport type CloseModalAction = {\n type: \"CLOSE_MODAL\",\n payload: string,\n};\n\nexport type DismissNotificationAction = {\n type: \"DISMISS_NOTIFICATION\",\n};\nexport type ShowNotificationAction = {\n type: \"SHOW_NOTIFICATION\",\n payload: {\n type: $Keys<NOTIFICATION_TYPES>,\n message: MessageObject,\n error: ?ErrorResponse,\n },\n};\n\nexport type SetPreferenceAction = {\n type: \"SET_PREFERENCE\",\n payload: { [name: string]: PreferenceValue },\n};\nexport type SetPreferencesAction = {\n type: \"SET_PREFERENCES\",\n payload: { [name: string]: PreferenceValue },\n};\n\nexport type StartProgressAction = {\n type: \"START_PROGRESS\",\n};\nexport type FinishProgressAction = {\n type: \"FINISH_PROGRESS\",\n};\nexport type ResetProgressAction = {\n type: \"RESET_PROGRESS\",\n};\nexport type UpdateProgressAction = {\n type: \"UPDATE_PROGRESS\",\n payload: { percentComplete: number },\n};\n\nexport type LoginFailedAction = {\n type: \"AUTHENTICATION_ERROR\",\n payload: string,\n};\n\nexport type ResetAuthErrorsAction = {\n type: \"AUTHENTICATION_RESET_ERRORS\",\n};\n\nexport type LoginSuccessAction = {\n type: \"AUTHENTICATION_SUCCESS\",\n};\n\nexport type ChangePasswordAction = {\n type: \"CHANGE_PASSWORD\",\n};\n\nexport type LogoutSuccessAction = {\n type: \"AUTHENTICATION_LOGOUT\",\n};\n\nexport type UpdateAutosaveAction = {\n type: \"UPDATE_AUTOSAVE_STATUS\",\n payload: {\n status: $Keys<AUTOSAVE_STATUS>,\n model: FormModel,\n },\n};\n\nexport type ReduxAction =\n | UpdateStatusAction\n | SetModelAction\n | UpdateModelAction\n | RemoveModelByKeyAction\n | ResetModularUIAction\n | SaveErrorAction\n | UpdateLocaleAction\n | SetLocalesAction\n | ShowModalAction\n | CloseModalAction\n | DismissNotificationAction\n | ShowNotificationAction\n | SetPreferenceAction\n | SetPreferencesAction\n | StartProgressAction\n | FinishProgressAction\n | ResetProgressAction\n | UpdateProgressAction\n | LoginFailedAction\n | ResetAuthErrorsAction\n | LoginSuccessAction\n | ChangePasswordAction\n | LogoutSuccessAction\n | UpdateAutosaveAction\n | LocationChangeAction\n | PushAction\n | ReplaceAction\n | GoAction\n | GoBackAction\n | GoForwardAction\n | ModularUIAction\n | NoAction;\n\n// Redux state\nexport type AuthState = {\n +isAuthenticated: boolean,\n +mustChangePassword: boolean,\n +error: ?string,\n};\n\nexport type ErrorState = null | ErrorResponse;\n\nexport type ModalState = {\n +key: string,\n +visible: boolean,\n +size?: string,\n};\n\nexport type ModalsState = {\n +modals: Array<ModalState>,\n};\n\nexport type NotificationState = {\n +render: boolean,\n +messageType: string | null,\n +message: MessageObject | null,\n +error: ?ErrorResponse | null,\n};\n\nexport type PreferencesState = {\n +[name: string]: PreferenceValue,\n};\n\nexport type ProgressIndicatorState = {\n +count: number,\n +timestamp: number,\n +percentComplete: number,\n};\n\nexport type ReduxState = {\n +router: RouterState,\n +modularui: ModularUIState,\n +i18n: I18nState,\n +auth: AuthState,\n +error: ErrorState,\n +modals: ModalsState,\n +notification: NotificationState,\n +progressindicator: ProgressIndicatorState,\n +preferences: PreferencesState,\n ...\n};\n\nexport type GetState = () => ReduxState;\nexport type ThunkAction = (dispatch: Dispatch, getState: GetState) => any;\nexport type PromiseAction = Promise<PossibleAction>;\nexport type Dispatch = DispatchAPI<PossibleAction>;\nexport type ReduxStore = Store<ReduxState, ReduxAction, Dispatch>;\n\nexport type PossibleAction = ReduxAction | ThunkAction | PromiseAction;\n\nexport type CustomReducers = { [reducerKey: string]: any };\n"],"mappings":""}
1
+ {"version":3,"file":"types.js","names":[],"sources":["../../src/redux/types.js"],"sourcesContent":["// @flow\nimport type { Store, DispatchAPI } from \"redux\";\n\nimport type ErrorResponse from \"../models/error/ErrorResponse\";\n\nimport type FormModel from \"../models/form/FormModel\";\nimport typeof {\n NOTIFICATION_TYPES,\n AUTOSAVE_STATUS,\n} from \"../constants/Constants\";\n\nimport type { MessageObject } from \"../i18n/types\";\nimport type {\n I18nState,\n UpdateLocaleAction,\n SetLocalesAction,\n} from \"./_i18n/types\";\nimport type {\n ModularUIState,\n ModularUIAction,\n UpdateStatusAction,\n SetModelAction,\n UpdateModelAction,\n RemoveModelByKeyAction,\n ResetModularUIAction,\n} from \"./_modularui/types\";\nimport type {\n RouterState,\n LocationChangeAction,\n PushAction,\n ReplaceAction,\n GoAction,\n GoBackAction,\n GoForwardAction,\n} from \"./_router/types\";\n\nexport type PreferenceValue =\n | null\n | string\n | boolean\n | { [key: string]: any }\n | Array<PreferenceValue>;\n\nexport type UpdateFormOptions = {\n autosubmit: boolean,\n autosave: boolean,\n forceUpdate?: boolean,\n /** Default true: Activate/deactivate the form object validate by an update */\n validate?: boolean,\n};\n\nexport type NoAction = {\n type: \"NO_ACTION\",\n};\n\nexport type SaveErrorAction = {\n type: \"SAVE_ERROR\",\n payload: ErrorResponse,\n};\n\nexport type ShowModalAction = {\n type: \"SHOW_MODAL\",\n payload: string,\n};\n\nexport type CloseModalAction = {\n type: \"CLOSE_MODAL\",\n payload: string,\n};\n\nexport type DismissNotificationAction = {\n type: \"DISMISS_NOTIFICATION\",\n};\nexport type ShowNotificationAction = {\n type: \"SHOW_NOTIFICATION\",\n payload: {\n type: $Keys<NOTIFICATION_TYPES>,\n message: MessageObject,\n error: ?ErrorResponse,\n },\n};\n\nexport type SetPreferenceAction = {\n type: \"SET_PREFERENCE\",\n payload: { [name: string]: PreferenceValue },\n};\nexport type SetPreferencesAction = {\n type: \"SET_PREFERENCES\",\n payload: { [name: string]: PreferenceValue },\n};\n\nexport type StartProgressAction = {\n type: \"START_PROGRESS\",\n};\nexport type FinishProgressAction = {\n type: \"FINISH_PROGRESS\",\n};\nexport type ResetProgressAction = {\n type: \"RESET_PROGRESS\",\n};\nexport type UpdateProgressAction = {\n type: \"UPDATE_PROGRESS\",\n payload: { percentComplete: number },\n};\n\nexport type LoginFailedAction = {\n type: \"AUTHENTICATION_ERROR\",\n payload: string,\n};\n\nexport type ResetAuthErrorsAction = {\n type: \"AUTHENTICATION_RESET_ERRORS\",\n};\n\nexport type LoginSuccessAction = {\n type: \"AUTHENTICATION_SUCCESS\",\n};\n\nexport type ChangePasswordAction = {\n type: \"CHANGE_PASSWORD\",\n};\n\nexport type LogoutSuccessAction = {\n type: \"AUTHENTICATION_LOGOUT\",\n};\n\nexport type UpdateAutosaveAction = {\n type: \"UPDATE_AUTOSAVE_STATUS\",\n payload: {\n status: $Keys<AUTOSAVE_STATUS>,\n model: FormModel,\n },\n};\n\nexport type ReduxAction =\n | UpdateStatusAction\n | SetModelAction\n | UpdateModelAction\n | RemoveModelByKeyAction\n | ResetModularUIAction\n | SaveErrorAction\n | UpdateLocaleAction\n | SetLocalesAction\n | ShowModalAction\n | CloseModalAction\n | DismissNotificationAction\n | ShowNotificationAction\n | SetPreferenceAction\n | SetPreferencesAction\n | StartProgressAction\n | FinishProgressAction\n | ResetProgressAction\n | UpdateProgressAction\n | LoginFailedAction\n | ResetAuthErrorsAction\n | LoginSuccessAction\n | ChangePasswordAction\n | LogoutSuccessAction\n | UpdateAutosaveAction\n | LocationChangeAction\n | PushAction\n | ReplaceAction\n | GoAction\n | GoBackAction\n | GoForwardAction\n | ModularUIAction\n | NoAction;\n\n// Redux state\nexport type AuthState = {\n +mustChangePassword: boolean,\n +error: ?string,\n};\n\nexport type ErrorState = null | ErrorResponse;\n\nexport type ModalState = {\n +key: string,\n +visible: boolean,\n +size?: string,\n};\n\nexport type ModalsState = {\n +modals: Array<ModalState>,\n};\n\nexport type NotificationState = {\n +render: boolean,\n +messageType: string | null,\n +message: MessageObject | null,\n +error: ?ErrorResponse | null,\n};\n\nexport type PreferencesState = {\n +[name: string]: PreferenceValue,\n};\n\nexport type ProgressIndicatorState = {\n +count: number,\n +timestamp: number,\n +percentComplete: number,\n};\n\nexport type ReduxState = {\n +router: RouterState,\n +modularui: ModularUIState,\n +i18n: I18nState,\n +auth: AuthState,\n +error: ErrorState,\n +modals: ModalsState,\n +notification: NotificationState,\n +progressindicator: ProgressIndicatorState,\n +preferences: PreferencesState,\n ...\n};\n\nexport type GetState = () => ReduxState;\nexport type ThunkAction = (dispatch: Dispatch, getState: GetState) => any;\nexport type PromiseAction = Promise<PossibleAction>;\nexport type Dispatch = DispatchAPI<PossibleAction>;\nexport type ReduxStore = Store<ReduxState, ReduxAction, Dispatch>;\n\nexport type PossibleAction = ReduxAction | ThunkAction | PromiseAction;\n\nexport type CustomReducers = { [reducerKey: string]: any };\n"],"mappings":""}
@@ -15,6 +15,7 @@ export var resourceExists = function resourceExists(url) {
15
15
  xhr.open("HEAD", fullUrl, false);
16
16
  xhr.setRequestHeader("Accept", "application/json");
17
17
  xhr.setRequestHeader("Content-Type", "application/json");
18
+ xhr.setRequestHeader("X-Requested-With", "XMLHttpRequest");
18
19
  xhr.send();
19
20
  return xhr.status !== 404;
20
21
  };
@@ -32,6 +33,7 @@ export var resourceRedirectsToSecureLogin = function resourceRedirectsToSecureLo
32
33
  xhr.open("HEAD", fullUrl, false);
33
34
  xhr.setRequestHeader("Accept", "application/json");
34
35
  xhr.setRequestHeader("Content-Type", "application/json");
36
+ xhr.setRequestHeader("X-Requested-With", "XMLHttpRequest");
35
37
  xhr.send();
36
38
  var responseURL = (_xhr$responseURL = xhr.responseURL) !== null && _xhr$responseURL !== void 0 ? _xhr$responseURL : "";
37
39
  return xhr.status === 400 && _endsWithInstanceProperty(responseURL).call(responseURL, "/secureLogin");
@@ -1 +1 @@
1
- {"version":3,"file":"checkResource.js","names":["Href","resourceExists","url","fullUrl","absolutehref","xhr","XMLHttpRequest","open","setRequestHeader","send","status","resourceRedirectsToSecureLogin","responseURL"],"sources":["../../../src/utils/helpers/checkResource.js"],"sourcesContent":["// @flow\nimport Href from \"../../models/href/Href\";\n\n/**\n * Checks if a given url to a modular ui resource exists using a HEAD request to the resource (synchronous)\n * When the resource returns a 404, the resource does not exists and the method returns false\n *\n * @param url\n * @returns {boolean}\n */\nexport const resourceExists = (url: string | Href): boolean => {\n const fullUrl = new Href(url).absolutehref;\n\n // const fullUrl = `${BASE}/${url}`.replace(/\\/\\//g, \"/\");\n\n const xhr = new XMLHttpRequest();\n xhr.open(\"HEAD\", fullUrl, false);\n xhr.setRequestHeader(\"Accept\", \"application/json\");\n xhr.setRequestHeader(\"Content-Type\", \"application/json\");\n xhr.send();\n\n return xhr.status !== 404;\n};\n\n/**\n * Indicates if a request to the given url resuls in a redirect to /secureRedirect\n * @param url\n * @returns {boolean}\n */\nexport const resourceRedirectsToSecureLogin = (url: string | Href): boolean => {\n const fullUrl = new Href(url).absolutehref;\n\n const xhr = new XMLHttpRequest();\n xhr.open(\"HEAD\", fullUrl, false);\n xhr.setRequestHeader(\"Accept\", \"application/json\");\n xhr.setRequestHeader(\"Content-Type\", \"application/json\");\n xhr.send();\n\n const responseURL = xhr.responseURL ?? \"\";\n\n return xhr.status === 400 && responseURL.endsWith(\"/secureLogin\");\n};\n"],"mappings":";AACA,OAAOA,IAAP,MAAiB,wBAAjB;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,IAAMC,cAAc,GAAG,SAAjBA,cAAiB,CAACC,GAAD,EAAiC;EAC7D,IAAMC,OAAO,GAAG,IAAIH,IAAJ,CAASE,GAAT,EAAcE,YAA9B,CAD6D,CAG7D;;EAEA,IAAMC,GAAG,GAAG,IAAIC,cAAJ,EAAZ;EACAD,GAAG,CAACE,IAAJ,CAAS,MAAT,EAAiBJ,OAAjB,EAA0B,KAA1B;EACAE,GAAG,CAACG,gBAAJ,CAAqB,QAArB,EAA+B,kBAA/B;EACAH,GAAG,CAACG,gBAAJ,CAAqB,cAArB,EAAqC,kBAArC;EACAH,GAAG,CAACI,IAAJ;EAEA,OAAOJ,GAAG,CAACK,MAAJ,KAAe,GAAtB;AACD,CAZM;AAcP;AACA;AACA;AACA;AACA;;AACA,OAAO,IAAMC,8BAA8B,GAAG,SAAjCA,8BAAiC,CAACT,GAAD,EAAiC;EAAA;;EAC7E,IAAMC,OAAO,GAAG,IAAIH,IAAJ,CAASE,GAAT,EAAcE,YAA9B;EAEA,IAAMC,GAAG,GAAG,IAAIC,cAAJ,EAAZ;EACAD,GAAG,CAACE,IAAJ,CAAS,MAAT,EAAiBJ,OAAjB,EAA0B,KAA1B;EACAE,GAAG,CAACG,gBAAJ,CAAqB,QAArB,EAA+B,kBAA/B;EACAH,GAAG,CAACG,gBAAJ,CAAqB,cAArB,EAAqC,kBAArC;EACAH,GAAG,CAACI,IAAJ;EAEA,IAAMG,WAAW,uBAAGP,GAAG,CAACO,WAAP,+DAAsB,EAAvC;EAEA,OAAOP,GAAG,CAACK,MAAJ,KAAe,GAAf,IAAsB,0BAAAE,WAAW,MAAX,CAAAA,WAAW,EAAU,cAAV,CAAxC;AACD,CAZM"}
1
+ {"version":3,"file":"checkResource.js","names":["Href","resourceExists","url","fullUrl","absolutehref","xhr","XMLHttpRequest","open","setRequestHeader","send","status","resourceRedirectsToSecureLogin","responseURL"],"sources":["../../../src/utils/helpers/checkResource.js"],"sourcesContent":["// @flow\nimport Href from \"../../models/href/Href\";\n\n/**\n * Checks if a given url to a modular ui resource exists using a HEAD request to the resource (synchronous)\n * When the resource returns a 404, the resource does not exists and the method returns false\n *\n * @param url\n * @returns {boolean}\n */\nexport const resourceExists = (url: string | Href): boolean => {\n const fullUrl = new Href(url).absolutehref;\n\n // const fullUrl = `${BASE}/${url}`.replace(/\\/\\//g, \"/\");\n\n const xhr = new XMLHttpRequest();\n xhr.open(\"HEAD\", fullUrl, false);\n xhr.setRequestHeader(\"Accept\", \"application/json\");\n xhr.setRequestHeader(\"Content-Type\", \"application/json\");\n xhr.setRequestHeader(\"X-Requested-With\", \"XMLHttpRequest\");\n\n xhr.send();\n\n return xhr.status !== 404;\n};\n\n/**\n * Indicates if a request to the given url resuls in a redirect to /secureRedirect\n * @param url\n * @returns {boolean}\n */\nexport const resourceRedirectsToSecureLogin = (url: string | Href): boolean => {\n const fullUrl = new Href(url).absolutehref;\n\n const xhr = new XMLHttpRequest();\n xhr.open(\"HEAD\", fullUrl, false);\n xhr.setRequestHeader(\"Accept\", \"application/json\");\n xhr.setRequestHeader(\"Content-Type\", \"application/json\");\n xhr.setRequestHeader(\"X-Requested-With\", \"XMLHttpRequest\");\n xhr.send();\n\n const responseURL = xhr.responseURL ?? \"\";\n\n return xhr.status === 400 && responseURL.endsWith(\"/secureLogin\");\n};\n"],"mappings":";AACA,OAAOA,IAAP,MAAiB,wBAAjB;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,IAAMC,cAAc,GAAG,SAAjBA,cAAiB,CAACC,GAAD,EAAiC;EAC7D,IAAMC,OAAO,GAAG,IAAIH,IAAJ,CAASE,GAAT,EAAcE,YAA9B,CAD6D,CAG7D;;EAEA,IAAMC,GAAG,GAAG,IAAIC,cAAJ,EAAZ;EACAD,GAAG,CAACE,IAAJ,CAAS,MAAT,EAAiBJ,OAAjB,EAA0B,KAA1B;EACAE,GAAG,CAACG,gBAAJ,CAAqB,QAArB,EAA+B,kBAA/B;EACAH,GAAG,CAACG,gBAAJ,CAAqB,cAArB,EAAqC,kBAArC;EACAH,GAAG,CAACG,gBAAJ,CAAqB,kBAArB,EAAyC,gBAAzC;EAEAH,GAAG,CAACI,IAAJ;EAEA,OAAOJ,GAAG,CAACK,MAAJ,KAAe,GAAtB;AACD,CAdM;AAgBP;AACA;AACA;AACA;AACA;;AACA,OAAO,IAAMC,8BAA8B,GAAG,SAAjCA,8BAAiC,CAACT,GAAD,EAAiC;EAAA;;EAC7E,IAAMC,OAAO,GAAG,IAAIH,IAAJ,CAASE,GAAT,EAAcE,YAA9B;EAEA,IAAMC,GAAG,GAAG,IAAIC,cAAJ,EAAZ;EACAD,GAAG,CAACE,IAAJ,CAAS,MAAT,EAAiBJ,OAAjB,EAA0B,KAA1B;EACAE,GAAG,CAACG,gBAAJ,CAAqB,QAArB,EAA+B,kBAA/B;EACAH,GAAG,CAACG,gBAAJ,CAAqB,cAArB,EAAqC,kBAArC;EACAH,GAAG,CAACG,gBAAJ,CAAqB,kBAArB,EAAyC,gBAAzC;EACAH,GAAG,CAACI,IAAJ;EAEA,IAAMG,WAAW,uBAAGP,GAAG,CAACO,WAAP,+DAAsB,EAAvC;EAEA,OAAOP,GAAG,CAACK,MAAJ,KAAe,GAAf,IAAsB,0BAAAE,WAAW,MAAX,CAAAA,WAAW,EAAU,cAAV,CAAxC;AACD,CAbM"}
@@ -1 +1 @@
1
- {"version":3,"file":"LayoutHints.js","names":["getHint","hint","LayoutHintConfiguration","MANDATORY","DISABLED","DEPENDENT_ATTRIBUTE_CONTROL","DEPENDENT_ATTRIBUTE","CONFIRM_PASSWORD","SORT_OPTIONS","TITLE","IGNORE_FORMAT_SETTING","DELETE_ACTION","UPDATE_ACTION","CREATE_ACTION","INITIAL_TOTAL_FILESIZE","MAX_TOTAL_FILESIZE","SHOW_ONE_RESULT_AS_DETAIL","HIDE_WHEN_EMPTY","INITIAL_FILTER","CASEVIEW_LINK","RENDER_SECTION_LABEL","getLayoutHintConfiguration"],"sources":["../../src/constants/LayoutHints.js"],"sourcesContent":["// @flow\nimport { LayoutHintConfiguration } from \"./LayoutHintConfig\";\n\n/**\n * Retrieve layout hint by id from the layout hint configuration\n */\nconst getHint = (hint: string): string => {\n if (LayoutHintConfiguration[hint]) {\n return LayoutHintConfiguration[hint].hint;\n }\n\n return \"\";\n};\n\n/**\n * Layout-hint: Indicates a mandatory attribute. Should be used together with the dependency hint.\n */\nexport const MANDATORY: string = getHint(\"MANDATORY\");\n\n/**\n * Layout-hint: Indicates a disabled attribute.\n * @constant\n */\nexport const DISABLED: string = getHint(\"DISABLED\");\n\n/*\n * --------------------------------\n * SELECT DEPENDENT ATTRIBUTES\n * --------------------------------\n */\n/**\n * Layout-hint: Marks the choice attribute where other attributes depend on. The unique control id is a unique id that can be used in the hint for the show|hide action on the dependent attribute.\n */\nexport const DEPENDENT_ATTRIBUTE_CONTROL = \"dependent-control\";\n/**\n */\nexport const DEPENDENT_ATTRIBUTE = \"dependent-attribute:\";\n\n/*\n * --------------------------------\n * ATTRIBUTES\n * --------------------------------\n */\n/**\n * Layout-hint: Password attribute must be confirmed using a second password attribute.\n */\nexport const CONFIRM_PASSWORD: string = getHint(\"CONFIRM_PASSWORD\");\n/**\n * Layout-hint: Sort options alphabetically\n */\nexport const SORT_OPTIONS: string = getHint(\"SORT_OPTIONS\");\n/**\n * Layout-hint: Marks an attribute as a title attribute\n */\nexport const TITLE: string = getHint(\"TITLE\");\n/**\n * Layout-hint: Ignore the global input format for specific attribute\n */\nexport const IGNORE_FORMAT_SETTING: string = getHint(\"IGNORE_FORMAT_SETTING\");\n\n/*\n * --------------------------------\n * FORM\n * --------------------------------\n */\n/**\n * Layout-hint: Mark task as delete task\n */\nexport const DELETE_ACTION: string = getHint(\"DELETE_ACTION\");\n/**\n * Layout-hint: Mark task as update task\n */\nexport const UPDATE_ACTION: string = getHint(\"UPDATE_ACTION\");\n/**\n * Layout-hint: Mark task as create task\n */\nexport const CREATE_ACTION: string = getHint(\"CREATE_ACTION\");\n\n/*\n * --------------------------------\n * UPLOAD TOTAL FILE SIZE\n * --------------------------------\n */\n/**\n * Layout-hint: Used in conjunction with an upload attribute, this hint is set on a read only attribute containing the file size currently used.\n */\nexport const INITIAL_TOTAL_FILESIZE: string = getHint(\"INITIAL_TOTAL_FILESIZE\");\n/**\n * Layout-hint: Used in conjunction with an upload attribute, this hint is set on a read only attribute containing the maximum allowed total file size.\n */\nexport const MAX_TOTAL_FILESIZE: string = getHint(\"MAX_TOTAL_FILESIZE\");\n\n/*\n * --------------------------------\n * LISTS\n * --------------------------------\n */\n/**\n * Layout-hint: A list with only one detail must be shown as a detail\n */\nexport const SHOW_ONE_RESULT_AS_DETAIL: string = getHint(\n \"SHOW_ONE_RESULT_AS_DETAIL\"\n);\n/**\n * Layout-hint: A list without list-items and list-tasks should not be shown.\n */\nexport const HIDE_WHEN_EMPTY: string = getHint(\"HIDE_WHEN_EMPTY\");\n/**\n * Layout-hint: Sets a default value on a filter\n */\nexport const INITIAL_FILTER: string = \"initial-filter:\";\n/**\n * Layout-hint: Mark a case id reference attribute as the reference to the case view. Replaces the self link of a list item\n */\nexport const CASEVIEW_LINK: string = getHint(\"CASEVIEW_LINK\");\n\n/**\n * Layout-hint: Set on configuration of instruments to show content in a popover on a label\n */\nexport const RENDER_SECTION_LABEL = \"render-section-label\";\n\n/**\n */\nexport const getLayoutHintConfiguration = (): Object => LayoutHintConfiguration;\n\nexport default getHint;\n"],"mappings":";;;;;;;AACA;;AAEA;AACA;AACA;AACA,IAAMA,OAAO,GAAG,SAAVA,OAAU,CAACC,IAAD,EAA0B;EACxC,IAAIC,0CAAwBD,IAAxB,CAAJ,EAAmC;IACjC,OAAOC,0CAAwBD,IAAxB,EAA8BA,IAArC;EACD;;EAED,OAAO,EAAP;AACD,CAND;AAQA;AACA;AACA;;;AACO,IAAME,SAAiB,GAAGH,OAAO,CAAC,WAAD,CAAjC;AAEP;AACA;AACA;AACA;;;AACO,IAAMI,QAAgB,GAAGJ,OAAO,CAAC,UAAD,CAAhC;AAEP;AACA;AACA;AACA;AACA;;AACA;AACA;AACA;;;AACO,IAAMK,2BAA2B,GAAG,mBAApC;AACP;AACA;;;AACO,IAAMC,mBAAmB,GAAG,sBAA5B;AAEP;AACA;AACA;AACA;AACA;;AACA;AACA;AACA;;;AACO,IAAMC,gBAAwB,GAAGP,OAAO,CAAC,kBAAD,CAAxC;AACP;AACA;AACA;;;AACO,IAAMQ,YAAoB,GAAGR,OAAO,CAAC,cAAD,CAApC;AACP;AACA;AACA;;;AACO,IAAMS,KAAa,GAAGT,OAAO,CAAC,OAAD,CAA7B;AACP;AACA;AACA;;;AACO,IAAMU,qBAA6B,GAAGV,OAAO,CAAC,uBAAD,CAA7C;AAEP;AACA;AACA;AACA;AACA;;AACA;AACA;AACA;;;AACO,IAAMW,aAAqB,GAAGX,OAAO,CAAC,eAAD,CAArC;AACP;AACA;AACA;;;AACO,IAAMY,aAAqB,GAAGZ,OAAO,CAAC,eAAD,CAArC;AACP;AACA;AACA;;;AACO,IAAMa,aAAqB,GAAGb,OAAO,CAAC,eAAD,CAArC;AAEP;AACA;AACA;AACA;AACA;;AACA;AACA;AACA;;;AACO,IAAMc,sBAA8B,GAAGd,OAAO,CAAC,wBAAD,CAA9C;AACP;AACA;AACA;;;AACO,IAAMe,kBAA0B,GAAGf,OAAO,CAAC,oBAAD,CAA1C;AAEP;AACA;AACA;AACA;AACA;;AACA;AACA;AACA;;;AACO,IAAMgB,yBAAiC,GAAGhB,OAAO,CACtD,2BADsD,CAAjD;AAGP;AACA;AACA;;;AACO,IAAMiB,eAAuB,GAAGjB,OAAO,CAAC,iBAAD,CAAvC;AACP;AACA;AACA;;;AACO,IAAMkB,cAAsB,GAAG,iBAA/B;AACP;AACA;AACA;;;AACO,IAAMC,aAAqB,GAAGnB,OAAO,CAAC,eAAD,CAArC;AAEP;AACA;AACA;;;AACO,IAAMoB,oBAAoB,GAAG,sBAA7B;AAEP;AACA;;;;AACO,IAAMC,0BAA0B,GAAG,SAA7BA,0BAA6B;EAAA,OAAcnB,yCAAd;AAAA,CAAnC;;;eAEQF,O"}
1
+ {"version":3,"file":"LayoutHints.js","names":["getHint","hint","LayoutHintConfiguration","MANDATORY","DISABLED","DEPENDENT_ATTRIBUTE_CONTROL","DEPENDENT_ATTRIBUTE","CONFIRM_PASSWORD","SORT_OPTIONS","TITLE","IGNORE_FORMAT_SETTING","DELETE_ACTION","UPDATE_ACTION","CREATE_ACTION","INITIAL_TOTAL_FILESIZE","MAX_TOTAL_FILESIZE","SHOW_ONE_RESULT_AS_DETAIL","HIDE_WHEN_EMPTY","INITIAL_FILTER","CASEVIEW_LINK","RENDER_SECTION_LABEL","getLayoutHintConfiguration"],"sources":["../../src/constants/LayoutHints.js"],"sourcesContent":["// @flow\nimport { LayoutHintConfiguration } from \"./LayoutHintConfig\";\n\n/**\n * Retrieve layout hint by id from the layout hint configuration\n */\nconst getHint = (hint: string): string => {\n if (LayoutHintConfiguration[hint]) {\n return LayoutHintConfiguration[hint].hint;\n }\n\n return \"\";\n};\n\n/**\n * Layout-hint: Indicates a mandatory attribute. Should be used together with the dependency hint.\n */\nexport const MANDATORY: string = getHint(\"MANDATORY\");\n\n/**\n * Layout-hint: Indicates a disabled attribute.\n * @constant\n */\nexport const DISABLED: string = getHint(\"DISABLED\");\n\n/*\n * --------------------------------\n * SELECT DEPENDENT ATTRIBUTES\n * --------------------------------\n */\n/**\n * Layout-hint: Marks the choice attribute where other attributes depend on. The unique control id is a unique id that can be used in the hint for the show|hide action on the dependent attribute.\n */\nexport const DEPENDENT_ATTRIBUTE_CONTROL = \"dependent-control\";\n/**\n */\nexport const DEPENDENT_ATTRIBUTE = \"dependent-attribute:\";\n\n/*\n * --------------------------------\n * ATTRIBUTES\n * --------------------------------\n */\n/**\n * Layout-hint: Password attribute must be confirmed using a second password attribute.\n */\nexport const CONFIRM_PASSWORD: string = getHint(\"CONFIRM_PASSWORD\");\n/**\n * Layout-hint: Sort options alphabetically\n */\nexport const SORT_OPTIONS: string = getHint(\"SORT_OPTIONS\");\n/**\n * Layout-hint: Marks an attribute as a title attribute\n */\nexport const TITLE: string = getHint(\"TITLE\");\n/**\n * Layout-hint: Ignore the global input format for specific attribute\n */\nexport const IGNORE_FORMAT_SETTING: string = getHint(\"IGNORE_FORMAT_SETTING\");\n\n/*\n * --------------------------------\n * FORM\n * --------------------------------\n */\n/**\n * Layout-hint: Mark task as delete task\n */\nexport const DELETE_ACTION: string = getHint(\"DELETE_ACTION\");\n/**\n * Layout-hint: Mark task as update task\n */\nexport const UPDATE_ACTION: string = getHint(\"UPDATE_ACTION\");\n/**\n * Layout-hint: Mark task as create task\n */\nexport const CREATE_ACTION: string = getHint(\"CREATE_ACTION\");\n\n/*\n * --------------------------------\n * UPLOAD TOTAL FILE SIZE\n * --------------------------------\n */\n/**\n * Layout-hint: Used in conjunction with an upload attribute, this hint is set on a read only attribute containing the file size currently used.\n */\nexport const INITIAL_TOTAL_FILESIZE: string = getHint(\"INITIAL_TOTAL_FILESIZE\");\n/**\n * Layout-hint: Used in conjunction with an upload attribute, this hint is set on a read only attribute containing the maximum allowed total file size.\n */\nexport const MAX_TOTAL_FILESIZE: string = getHint(\"MAX_TOTAL_FILESIZE\");\n\n/*\n * --------------------------------\n * LISTS\n * --------------------------------\n */\n/**\n * Layout-hint: A list with only one detail must be shown as a detail\n */\nexport const SHOW_ONE_RESULT_AS_DETAIL: string = getHint(\n \"SHOW_ONE_RESULT_AS_DETAIL\"\n);\n/**\n * Layout-hint: A list without list-items and list-tasks should not be shown.\n */\nexport const HIDE_WHEN_EMPTY: string = getHint(\"HIDE_WHEN_EMPTY\");\n/**\n * Layout-hint: Sets a default value on a filter\n */\nexport const INITIAL_FILTER: string = \"initial-filter:\";\n/**\n * Layout-hint: Mark a case id reference attribute as the reference to the case view. Replaces the self link of a list item\n */\nexport const CASEVIEW_LINK: string = getHint(\"CASEVIEW_LINK\");\n\n/**\n * Layout-hint: Set on configuration of instruments to show content in a popover on a label\n */\nexport const RENDER_SECTION_LABEL = \"render-section-label\";\n\n/**\n */\nexport const getLayoutHintConfiguration = (): Object => LayoutHintConfiguration;\n\nexport default getHint;\n"],"mappings":";;;;;;;AACA;;AAEA;AACA;AACA;AACA,IAAMA,OAAO,GAAG,SAAVA,OAAU,CAACC,IAAD,EAA0B;EACxC,IAAIC,yCAAA,CAAwBD,IAAxB,CAAJ,EAAmC;IACjC,OAAOC,yCAAA,CAAwBD,IAAxB,EAA8BA,IAArC;EACD;;EAED,OAAO,EAAP;AACD,CAND;AAQA;AACA;AACA;;;AACO,IAAME,SAAiB,GAAGH,OAAO,CAAC,WAAD,CAAjC;AAEP;AACA;AACA;AACA;;;AACO,IAAMI,QAAgB,GAAGJ,OAAO,CAAC,UAAD,CAAhC;AAEP;AACA;AACA;AACA;AACA;;AACA;AACA;AACA;;;AACO,IAAMK,2BAA2B,GAAG,mBAApC;AACP;AACA;;;AACO,IAAMC,mBAAmB,GAAG,sBAA5B;AAEP;AACA;AACA;AACA;AACA;;AACA;AACA;AACA;;;AACO,IAAMC,gBAAwB,GAAGP,OAAO,CAAC,kBAAD,CAAxC;AACP;AACA;AACA;;;AACO,IAAMQ,YAAoB,GAAGR,OAAO,CAAC,cAAD,CAApC;AACP;AACA;AACA;;;AACO,IAAMS,KAAa,GAAGT,OAAO,CAAC,OAAD,CAA7B;AACP;AACA;AACA;;;AACO,IAAMU,qBAA6B,GAAGV,OAAO,CAAC,uBAAD,CAA7C;AAEP;AACA;AACA;AACA;AACA;;AACA;AACA;AACA;;;AACO,IAAMW,aAAqB,GAAGX,OAAO,CAAC,eAAD,CAArC;AACP;AACA;AACA;;;AACO,IAAMY,aAAqB,GAAGZ,OAAO,CAAC,eAAD,CAArC;AACP;AACA;AACA;;;AACO,IAAMa,aAAqB,GAAGb,OAAO,CAAC,eAAD,CAArC;AAEP;AACA;AACA;AACA;AACA;;AACA;AACA;AACA;;;AACO,IAAMc,sBAA8B,GAAGd,OAAO,CAAC,wBAAD,CAA9C;AACP;AACA;AACA;;;AACO,IAAMe,kBAA0B,GAAGf,OAAO,CAAC,oBAAD,CAA1C;AAEP;AACA;AACA;AACA;AACA;;AACA;AACA;AACA;;;AACO,IAAMgB,yBAAiC,GAAGhB,OAAO,CACtD,2BADsD,CAAjD;AAGP;AACA;AACA;;;AACO,IAAMiB,eAAuB,GAAGjB,OAAO,CAAC,iBAAD,CAAvC;AACP;AACA;AACA;;;AACO,IAAMkB,cAAsB,GAAG,iBAA/B;AACP;AACA;AACA;;;AACO,IAAMC,aAAqB,GAAGnB,OAAO,CAAC,eAAD,CAArC;AAEP;AACA;AACA;;;AACO,IAAMoB,oBAAoB,GAAG,sBAA7B;AAEP;AACA;;;;AACO,IAAMC,0BAA0B,GAAG,SAA7BA,0BAA6B;EAAA,OAAcnB,yCAAd;AAAA,CAAnC;;;eAEQF,O"}
@@ -1 +1 @@
1
- {"version":3,"file":"Settings.js","names":["defaultSettings","DEBUG_I18N_MESSAGE_NOT_FOUND","HIDE_NOTIFICATION_TIMEOUT","ALWAYS_COMMIT_FORM","RENDER_QUESTION_LABELS","RENDER_MANDATORY_ATTRIBUTE_INDICATION","RENDER_OPTIONAL_ATTRIBUTE_INDICATION","AVAILABLE_LIST_VIEWS","USE_CLIENTSIDE_VALIDATION","USE_INSTANT_SERVER_VALIDATION","ENABLED_LOCALES","RENDER_FORMS_IN_MODAL","SHOW_SUBMIT_WAIT_TIMEOUT","SWIM_LANE_DIAGRAM_CONFIGURATION","BUSINESS_SCENARIO_CONCEPT_TYPE","BUSINESS_SCENARIO_STEP_CONCEPT_TYPE","BUSINESS_SCENARIO_PERSONA_CONCEPT_TYPE","DATE_INPUT_FORMAT","DATE_READONLY_FORMAT","CALENDAR_WEEK_STARTS_ON","CALENDAR_FIRST_WEEK_CONTAINS_DATE","UI_PARAMETERS","ALLOW_HIDE_WHEN_EMPTY_ON_TABS","PAGE_RELOAD_ON_UNAUTHORIZED_ERROR","XHR_TIMEOUT_MS","settings","setSettings","config","getSetting","key","defaultValue","undefined","Error","setSetting","value","allSettings","hasAllContentInData","ALL_CONTENT_IN_DATA_SETTING","loginType","LOGIN_TYPE","loginPath","LOGIN_PATH_SETTING","loginUsernameField","LOGIN_USERNAME_SETTING","loginPasswordField","LOGIN_PASSWORD_SETTING","logoutPath","LOGOUT_PATH_SETTING"],"sources":["../../src/constants/Settings.js"],"sourcesContent":["// @flow\nimport { isPlainObject, has } from \"../utils/helpers/objects\";\nimport {\n ALL_CONTENT_IN_DATA_SETTING,\n LOGIN_TYPE,\n LOGIN_PATH_SETTING,\n LOGIN_USERNAME_SETTING,\n LOGIN_PASSWORD_SETTING,\n LOGOUT_PATH_SETTING,\n} from \"./Constants\";\n\ntype Setting = boolean | string | number | Array<string>;\n\nconst defaultSettings = {\n // Debug missing i18n messages in layout\n DEBUG_I18N_MESSAGE_NOT_FOUND: true,\n\n // Time to show the notification bar\n HIDE_NOTIFICATION_TIMEOUT: 5000,\n\n // Always commit form, does not show result pages for instruments\n ALWAYS_COMMIT_FORM: false,\n\n // Render instrument and event question labels on forms (might result in duplicate labels)\n RENDER_QUESTION_LABELS: true,\n\n // Render mandatory indications on attributes\n RENDER_MANDATORY_ATTRIBUTE_INDICATION: true,\n\n // Render optional indications on attributes\n RENDER_OPTIONAL_ATTRIBUTE_INDICATION: false,\n\n // Renders a toggle with supported list views, options are ListView and TableView\n AVAILABLE_LIST_VIEWS: [\"ListView\", \"TableView\"],\n\n // Toggle client side validation\n USE_CLIENTSIDE_VALIDATION: true,\n\n // Indicates if server validation should be used when a form field is changed\n USE_INSTANT_SERVER_VALIDATION: true,\n\n // Indicates which locales are enabled\n ENABLED_LOCALES: [\"en\", \"nl\"],\n\n // Render forms in a modal\n RENDER_FORMS_IN_MODAL: true,\n\n // Wait timeout before rendering submit wait icon\n SHOW_SUBMIT_WAIT_TIMEOUT: 300,\n\n // Swim lane diagram configuration file\n SWIM_LANE_DIAGRAM_CONFIGURATION: \"/Library/Diagrams/Overviews.json\",\n\n // Business scenario concept types\n BUSINESS_SCENARIO_CONCEPT_TYPE: [\n \"/Library/KMTs/Business scenarios.bixml/BusinessScenario\",\n ],\n BUSINESS_SCENARIO_STEP_CONCEPT_TYPE: [\n \"/Library/KMTs/Business scenarios.bixml/ScenarioStep\",\n ],\n BUSINESS_SCENARIO_PERSONA_CONCEPT_TYPE: [\n \"/Library/KMTs/Business scenarios.bixml/Persona\",\n ],\n\n // Input format for dates. Without this setting having a value, the contributions format is used\n DATE_INPUT_FORMAT: \"\",\n\n // Readonly format for dates. Without this setting having a value, the contributions format is used\n DATE_READONLY_FORMAT: \"\",\n\n // indicates on what day the week starts (0 = Sunday)\n CALENDAR_WEEK_STARTS_ON: 1,\n\n // indicates which date indicates the first week of the year\n CALENDAR_FIRST_WEEK_CONTAINS_DATE: 1,\n\n // parameters that are added for the ui state, but should not be send to the modular ui\n UI_PARAMETERS: [],\n\n // disable hide-when-empty hint for layouts running on Be Informed versions older than 21.1\n ALLOW_HIDE_WHEN_EMPTY_ON_TABS: true,\n\n // reload the complete page on signout, usefull when third party authentication is in place\n PAGE_RELOAD_ON_UNAUTHORIZED_ERROR: false,\n\n XHR_TIMEOUT_MS: 300000,\n};\n\nlet settings = defaultSettings;\n\n/**\n */\nexport const setSettings = (config: Object) => {\n if (isPlainObject(config)) {\n settings = Object.assign(defaultSettings, config);\n }\n};\n\n/**\n */\nexport const getSetting = (key: string, defaultValue?: any): any => {\n if (!has(settings, key) && defaultValue === undefined) {\n throw new Error(\n `Setting with name ${key} not found and no defaultValue given`\n );\n }\n\n return settings[key] ?? defaultValue;\n};\n\n/**\n */\nexport const setSetting = (key: string, value: any) => {\n settings[key] = value;\n};\n\n/**\n */\nexport const allSettings = (): { [name: string]: Setting } => settings;\n\n/**\n */\nexport const hasAllContentInData = (): boolean =>\n getSetting(ALL_CONTENT_IN_DATA_SETTING, true);\n\n/**\n * Login type, only available when pac4j is configured\n */\nexport const loginType = (): string => getSetting(LOGIN_TYPE, \"JAAS\");\n\n/**\n */\nexport const loginPath = (): string =>\n getSetting(LOGIN_PATH_SETTING, \"/j_security_check\");\n/**\n */\nexport const loginUsernameField = (): string =>\n getSetting(LOGIN_USERNAME_SETTING, \"j_username\");\n/**\n */\nexport const loginPasswordField = (): string =>\n getSetting(LOGIN_PASSWORD_SETTING, \"j_password\");\n/**\n */\nexport const logoutPath = (): string =>\n getSetting(LOGOUT_PATH_SETTING, \"/Logoff\");\n"],"mappings":";;;;;;;;;;;AACA;;AACA;;AAWA,IAAMA,eAAe,GAAG;EACtB;EACAC,4BAA4B,EAAE,IAFR;EAItB;EACAC,yBAAyB,EAAE,IALL;EAOtB;EACAC,kBAAkB,EAAE,KARE;EAUtB;EACAC,sBAAsB,EAAE,IAXF;EAatB;EACAC,qCAAqC,EAAE,IAdjB;EAgBtB;EACAC,oCAAoC,EAAE,KAjBhB;EAmBtB;EACAC,oBAAoB,EAAE,CAAC,UAAD,EAAa,WAAb,CApBA;EAsBtB;EACAC,yBAAyB,EAAE,IAvBL;EAyBtB;EACAC,6BAA6B,EAAE,IA1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AAD,CAAR,GAAgBK,KAAhB;AACD,CAFM;AAIP;AACA;;;;;AACO,IAAMC,WAAW,GAAG,SAAdA,WAAc;EAAA,OAAmCV,QAAnC;AAAA,CAApB;AAEP;AACA;;;;;AACO,IAAMW,mBAAmB,GAAG,SAAtBA,mBAAsB;EAAA,OACjCR,UAAU,CAACS,sCAAD,EAA8B,IAA9B,CADuB;AAAA,CAA5B;AAGP;AACA;AACA;;;;;AACO,IAAMC,SAAS,GAAG,SAAZA,SAAY;EAAA,OAAcV,UAAU,CAACW,qBAAD,EAAa,MAAb,CAAxB;AAAA,CAAlB;AAEP;AACA;;;;;AACO,IAAMC,SAAS,GAAG,SAAZA,SAAY;EAAA,OACvBZ,UAAU,CAACa,6BAAD,EAAqB,mBAArB,CADa;AAAA,CAAlB;AAEP;AACA;;;;;AACO,IAAMC,kBAAkB,GAAG,SAArBA,kBAAqB;EAAA,OAChCd,UAAU,CAACe,iCAAD,EAAyB,YAAzB,CADsB;AAAA,CAA3B;AAEP;AACA;;;;;AACO,IAAMC,kBAAkB,GAAG,SAArBA,kBAAqB;EAAA,OAChChB,UAAU,CAACiB,iCAAD,EAAyB,YAAzB,CADsB;AAAA,CAA3B;AAEP;AACA;;;;;AACO,IAAMC,UAAU,GAAG,SAAbA,UAAa;EAAA,OACxBlB,UAAU,CAACmB,8BAAD,EAAsB,SAAtB,CADc;AAAA,CAAnB"}
1
+ {"version":3,"file":"Settings.js","names":["defaultSettings","DEBUG_I18N_MESSAGE_NOT_FOUND","HIDE_NOTIFICATION_TIMEOUT","ALWAYS_COMMIT_FORM","RENDER_QUESTION_LABELS","RENDER_MANDATORY_ATTRIBUTE_INDICATION","RENDER_OPTIONAL_ATTRIBUTE_INDICATION","AVAILABLE_LIST_VIEWS","USE_CLIENTSIDE_VALIDATION","USE_INSTANT_SERVER_VALIDATION","ENABLED_LOCALES","RENDER_FORMS_IN_MODAL","SHOW_SUBMIT_WAIT_TIMEOUT","SWIM_LANE_DIAGRAM_CONFIGURATION","BUSINESS_SCENARIO_CONCEPT_TYPE","BUSINESS_SCENARIO_STEP_CONCEPT_TYPE","BUSINESS_SCENARIO_PERSONA_CONCEPT_TYPE","DATE_INPUT_FORMAT","DATE_READONLY_FORMAT","CALENDAR_WEEK_STARTS_ON","CALENDAR_FIRST_WEEK_CONTAINS_DATE","UI_PARAMETERS","ALLOW_HIDE_WHEN_EMPTY_ON_TABS","PAGE_RELOAD_ON_UNAUTHORIZED_ERROR","XHR_TIMEOUT_MS","settings","setSettings","config","isPlainObject","getSetting","key","defaultValue","has","undefined","Error","setSetting","value","allSettings","hasAllContentInData","ALL_CONTENT_IN_DATA_SETTING","loginType","LOGIN_TYPE","loginPath","LOGIN_PATH_SETTING","loginUsernameField","LOGIN_USERNAME_SETTING","loginPasswordField","LOGIN_PASSWORD_SETTING","logoutPath","LOGOUT_PATH_SETTING"],"sources":["../../src/constants/Settings.js"],"sourcesContent":["// @flow\nimport { isPlainObject, has } from \"../utils/helpers/objects\";\nimport {\n ALL_CONTENT_IN_DATA_SETTING,\n LOGIN_TYPE,\n LOGIN_PATH_SETTING,\n LOGIN_USERNAME_SETTING,\n LOGIN_PASSWORD_SETTING,\n LOGOUT_PATH_SETTING,\n} from \"./Constants\";\n\ntype Setting = boolean | string | number | Array<string>;\n\nconst defaultSettings = {\n // Debug missing i18n messages in layout\n DEBUG_I18N_MESSAGE_NOT_FOUND: true,\n\n // Time to show the notification bar\n HIDE_NOTIFICATION_TIMEOUT: 5000,\n\n // Always commit form, does not show result pages for instruments\n ALWAYS_COMMIT_FORM: false,\n\n // Render instrument and event question labels on forms (might result in duplicate labels)\n RENDER_QUESTION_LABELS: true,\n\n // Render mandatory indications on attributes\n RENDER_MANDATORY_ATTRIBUTE_INDICATION: true,\n\n // Render optional indications on attributes\n RENDER_OPTIONAL_ATTRIBUTE_INDICATION: false,\n\n // Renders a toggle with supported list views, options are ListView and TableView\n AVAILABLE_LIST_VIEWS: [\"ListView\", \"TableView\"],\n\n // Toggle client side validation\n USE_CLIENTSIDE_VALIDATION: true,\n\n // Indicates if server validation should be used when a form field is changed\n USE_INSTANT_SERVER_VALIDATION: true,\n\n // Indicates which locales are enabled\n ENABLED_LOCALES: [\"en\", \"nl\"],\n\n // Render forms in a modal\n RENDER_FORMS_IN_MODAL: true,\n\n // Wait timeout before rendering submit wait icon\n SHOW_SUBMIT_WAIT_TIMEOUT: 300,\n\n // Swim lane diagram configuration file\n SWIM_LANE_DIAGRAM_CONFIGURATION: \"/Library/Diagrams/Overviews.json\",\n\n // Business scenario concept types\n BUSINESS_SCENARIO_CONCEPT_TYPE: [\n \"/Library/KMTs/Business scenarios.bixml/BusinessScenario\",\n ],\n BUSINESS_SCENARIO_STEP_CONCEPT_TYPE: [\n \"/Library/KMTs/Business scenarios.bixml/ScenarioStep\",\n ],\n BUSINESS_SCENARIO_PERSONA_CONCEPT_TYPE: [\n \"/Library/KMTs/Business scenarios.bixml/Persona\",\n ],\n\n // Input format for dates. Without this setting having a value, the contributions format is used\n DATE_INPUT_FORMAT: \"\",\n\n // Readonly format for dates. Without this setting having a value, the contributions format is used\n DATE_READONLY_FORMAT: \"\",\n\n // indicates on what day the week starts (0 = Sunday)\n CALENDAR_WEEK_STARTS_ON: 1,\n\n // indicates which date indicates the first week of the year\n CALENDAR_FIRST_WEEK_CONTAINS_DATE: 1,\n\n // parameters that are added for the ui state, but should not be send to the modular ui\n UI_PARAMETERS: [],\n\n // disable hide-when-empty hint for layouts running on Be Informed versions older than 21.1\n ALLOW_HIDE_WHEN_EMPTY_ON_TABS: true,\n\n // reload the complete page on signout, usefull when third party authentication is in place\n PAGE_RELOAD_ON_UNAUTHORIZED_ERROR: false,\n\n XHR_TIMEOUT_MS: 300000,\n};\n\nlet settings = defaultSettings;\n\n/**\n */\nexport const setSettings = (config: Object) => {\n if (isPlainObject(config)) {\n settings = Object.assign(defaultSettings, config);\n }\n};\n\n/**\n */\nexport const getSetting = (key: string, defaultValue?: any): any => {\n if (!has(settings, key) && defaultValue === undefined) {\n throw new Error(\n `Setting with name ${key} not found and no defaultValue given`\n );\n }\n\n return settings[key] ?? defaultValue;\n};\n\n/**\n */\nexport const setSetting = (key: string, value: any) => {\n settings[key] = value;\n};\n\n/**\n */\nexport const allSettings = (): { [name: string]: Setting } => settings;\n\n/**\n */\nexport const hasAllContentInData = (): boolean =>\n getSetting(ALL_CONTENT_IN_DATA_SETTING, true);\n\n/**\n * Login type, only available when pac4j is configured\n */\nexport const loginType = (): string => getSetting(LOGIN_TYPE, \"JAAS\");\n\n/**\n */\nexport const loginPath = (): string =>\n getSetting(LOGIN_PATH_SETTING, \"/j_security_check\");\n/**\n */\nexport const loginUsernameField = (): string =>\n getSetting(LOGIN_USERNAME_SETTING, \"j_username\");\n/**\n */\nexport const loginPasswordField = (): string =>\n getSetting(LOGIN_PASSWORD_SETTING, \"j_password\");\n/**\n */\nexport const logoutPath = (): string =>\n getSetting(LOGOUT_PATH_SETTING, \"/Logoff\");\n"],"mappings":";;;;;;;;;;;AACA;;AACA;;AAWA,IAAMA,eAAe,GAAG;EACtB;EACAC,4BAA4B,EAAE,IAFR;EAItB;EACAC,yBAAyB,EAAE,IALL;EAOtB;EACAC,kBAAkB,EAAE,KARE;EAUtB;EACAC,sBAAsB,EAAE,IAXF;EAatB;EACAC,qCAAqC,EAAE,IAdjB;EAgBtB;EACAC,oCAAoC,EAAE,KAjBhB;EAmBtB;EACAC,oBAAoB,EAAE,CAAC,UAAD,EAAa,WAAb,CApBA;EAsBtB;EACAC,yBAAyB,EAAE,IAvBL;EAyBtB;EACAC,6BAA6B,EAAE,IA1BT;EA4BtB;EACAC,eAAe,EAAE,CAAC,IAAD,EAAO,IAAP,CA7BK;EA+BtB;EACAC,qBAAqB,EAAE,IAhCD;EAkCtB;EACAC,wBAAwB,EAAE,GAnCJ;EAqCtB;EACAC,+BAA+B,EAAE,kCAtCX;EAwCtB;EACAC,8BAA8B,EAAE,CAC9B,yDAD8B,CAzCV;EA4CtBC,mCAAmC,EAAE,CACnC,qDAD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B;AAAA,CAA5B;AAGP;AACA;AACA;;;;;AACO,IAAMC,SAAS,GAAG,SAAZA,SAAY;EAAA,OAAcX,UAAU,CAACY,qBAAD,EAAa,MAAb,CAAxB;AAAA,CAAlB;AAEP;AACA;;;;;AACO,IAAMC,SAAS,GAAG,SAAZA,SAAY;EAAA,OACvBb,UAAU,CAACc,6BAAD,EAAqB,mBAArB,CADa;AAAA,CAAlB;AAEP;AACA;;;;;AACO,IAAMC,kBAAkB,GAAG,SAArBA,kBAAqB;EAAA,OAChCf,UAAU,CAACgB,iCAAD,EAAyB,YAAzB,CADsB;AAAA,CAA3B;AAEP;AACA;;;;;AACO,IAAMC,kBAAkB,GAAG,SAArBA,kBAAqB;EAAA,OAChCjB,UAAU,CAACkB,iCAAD,EAAyB,YAAzB,CADsB;AAAA,CAA3B;AAEP;AACA;;;;;AACO,IAAMC,UAAU,GAAG,SAAbA,UAAa;EAAA,OACxBnB,UAAU,CAACoB,8BAAD,EAAsB,SAAtB,CADc;AAAA,CAAnB"}
@@ -1 +1 @@
1
- {"version":3,"file":"FetchException.js","names":["CLIENT_ERROR_CODE","getErrorInfo","errorResponse","requestOptions","defaultErrorInfo","id","defaultMessage","url","method","HTTP_METHODS","GET","properties","param","error","key","errors","FetchException","failedRequest","errorInfo","name","request","status","response","parameters","Error","captureStackTrace"],"sources":["../../src/exceptions/FetchException.js"],"sourcesContent":["// @flow\nimport { has } from \"../utils/helpers/objects\";\n\nimport { HTTP_METHODS } from \"../constants/Constants\";\n\nimport type { MessageParameters } from \"../i18n/types\";\nimport type { RequestOptions } from \"../utils/fetch/types\";\n\nexport type ModularUIErrorResponse = {\n error: {\n id: string,\n properties: {\n [propertyName: string]: string | number,\n ...\n },\n },\n};\n\ntype RequestResult = { status: number };\ntype RequestParameters = { [key: string]: any };\n\nconst CLIENT_ERROR_CODE = 400;\n\n/**\n * @private\n */\nconst getErrorInfo = (\n errorResponse: ?ModularUIErrorResponse,\n requestOptions: ?RequestOptions\n) => {\n const defaultErrorInfo = {\n id: \"Error.CannotRequestResource\",\n defaultMessage: `Cannot request resource ${\n requestOptions?.url ?? \"\"\n } with method ${requestOptions?.method ?? HTTP_METHODS.GET}`,\n properties: {},\n param: null,\n };\n\n if (!errorResponse) {\n return defaultErrorInfo;\n }\n\n if (has(errorResponse, \"error\")) {\n return {\n ...defaultErrorInfo,\n ...errorResponse.error,\n };\n }\n\n const [key] = Object.keys(errorResponse);\n if (has(errorResponse[key], \"errors\")) {\n return {\n ...defaultErrorInfo,\n // $FlowFixMe[prop-missing] - not sure in what case this could happen\n ...errorResponse[key].errors,\n };\n }\n\n return defaultErrorInfo;\n};\n\n/**\n * FetchException\n */\nexport default class FetchException extends Error {\n request: ?RequestResult | XMLHttpRequest;\n status: number;\n response: ?ModularUIErrorResponse;\n parameters: ?RequestParameters;\n properties: MessageParameters;\n requestOptions: ?RequestOptions;\n id: string;\n\n constructor(\n errorResponse: ?ModularUIErrorResponse,\n failedRequest?: ?RequestResult | XMLHttpRequest,\n requestOptions?: RequestOptions\n ) {\n const errorInfo = getErrorInfo(errorResponse, requestOptions);\n super(errorInfo.id);\n\n this.name = errorInfo.id;\n this.id = errorInfo.id;\n this.request = failedRequest;\n this.requestOptions = requestOptions;\n\n this.status =\n failedRequest && failedRequest.status\n ? failedRequest.status\n : CLIENT_ERROR_CODE;\n\n this.response = errorResponse;\n this.properties = errorInfo.properties ?? {};\n this.parameters = errorInfo.param ?? null;\n\n if (Error.captureStackTrace) {\n Error.captureStackTrace(this, FetchException);\n }\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA;;AAEA;;;;;;;;;;AAkBA,IAAMA,iBAAiB,GAAG,GAA1B;AAEA;AACA;AACA;;AACA,IAAMC,YAAY,GAAG,SAAfA,YAAe,CACnBC,aADmB,EAEnBC,cAFmB,EAGhB;EAAA;;EACH,IAAMC,gBAAgB,GAAG;IACvBC,EAAE,EAAE,6BADmB;IAEvBC,cAAc,2F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BAAkBL,SAAS,CAACN,KAA5B,+DAAqC,IAArC;;IAEA,IAAIY,KAAK,CAACC,iBAAV,EAA6B;MAC3BD,KAAK,CAACC,iBAAN,8CAA8BT,cAA9B;IACD;;IApBD;EAqBD;;;+CAlCyCQ,K"}
1
+ {"version":3,"file":"FetchException.js","names":["CLIENT_ERROR_CODE","getErrorInfo","errorResponse","requestOptions","defaultErrorInfo","id","defaultMessage","url","method","HTTP_METHODS","GET","properties","param","has","error","key","errors","FetchException","failedRequest","errorInfo","name","request","status","response","parameters","Error","captureStackTrace"],"sources":["../../src/exceptions/FetchException.js"],"sourcesContent":["// @flow\nimport { has } from \"../utils/helpers/objects\";\n\nimport { HTTP_METHODS } from \"../constants/Constants\";\n\nimport type { MessageParameters } from \"../i18n/types\";\nimport type { RequestOptions } from \"../utils/fetch/types\";\n\nexport type ModularUIErrorResponse = {\n error: {\n id: string,\n properties: {\n [propertyName: string]: string | number,\n ...\n },\n },\n};\n\ntype RequestResult = { status: number };\ntype RequestParameters = { [key: string]: any };\n\nconst CLIENT_ERROR_CODE = 400;\n\n/**\n * @private\n */\nconst getErrorInfo = (\n errorResponse: ?ModularUIErrorResponse,\n requestOptions: ?RequestOptions\n) => {\n const defaultErrorInfo = {\n id: \"Error.CannotRequestResource\",\n defaultMessage: `Cannot request resource ${\n requestOptions?.url ?? \"\"\n } with method ${requestOptions?.method ?? HTTP_METHODS.GET}`,\n properties: {},\n param: null,\n };\n\n if (!errorResponse) {\n return defaultErrorInfo;\n }\n\n if (has(errorResponse, \"error\")) {\n return {\n ...defaultErrorInfo,\n ...errorResponse.error,\n };\n }\n\n const [key] = Object.keys(errorResponse);\n if (has(errorResponse[key], \"errors\")) {\n return {\n ...defaultErrorInfo,\n // $FlowFixMe[prop-missing] - not sure in what case this could happen\n ...errorResponse[key].errors,\n };\n }\n\n return defaultErrorInfo;\n};\n\n/**\n * FetchException\n */\nexport default class FetchException extends Error {\n request: ?RequestResult | XMLHttpRequest;\n status: number;\n response: ?ModularUIErrorResponse;\n parameters: ?RequestParameters;\n properties: MessageParameters;\n requestOptions: ?RequestOptions;\n id: string;\n\n constructor(\n errorResponse: ?ModularUIErrorResponse,\n failedRequest?: ?RequestResult | XMLHttpRequest,\n requestOptions?: RequestOptions\n ) {\n const errorInfo = getErrorInfo(errorResponse, requestOptions);\n super(errorInfo.id);\n\n this.name = errorInfo.id;\n this.id = errorInfo.id;\n this.request = failedRequest;\n this.requestOptions = requestOptions;\n\n this.status =\n failedRequest && failedRequest.status\n ? failedRequest.status\n : CLIENT_ERROR_CODE;\n\n this.response = errorResponse;\n this.properties = errorInfo.properties ?? {};\n this.parameters = errorInfo.param ?? null;\n\n if (Error.captureStackTrace) {\n Error.captureStackTrace(this, FetchException);\n }\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA;;AAEA;;;;;;;;;;AAkBA,IAAMA,iBAAiB,GAAG,GAA1B;AAEA;AACA;AACA;;AACA,IAAMC,YAAY,GAAG,SAAfA,YAAe,CACnBC,aADmB,EAEnBC,cAFmB,EAGhB;EAAA;;EACH,IAAMC,gBAAgB,GAAG;IACvBC,EAAE,EAAE,6BADmB;IAEvBC,cAAc,2FACZH,cADY,aACZA,cADY,uBACZA,cAAc,CAAEI,GADJ,qEACW,EADX,4DAEEJ,cAFF,aAEEA,cAFF,uBAEEA,cAAc,CAAEK,MAFlB,yEAE4BC,uBAAA,CAAaC,GAFzC,CAFS;IAKvBC,UAAU,EAAE,EALW;IAMvBC,KAAK,EAAE;EANgB,CAAzB;;EASA,IAAI,CAACV,aAAL,EAAoB;IAClB,OAAOE,gBAAP;EACD;;EAED,IAAI,IAAAS,YAAA,EAAIX,aAAJ,EAAmB,OAAnB,CAAJ,EAAiC;IAC/B,uCACKE,gBADL,GAEKF,aAAa,CAACY,KAFnB;EAID;;EAED,mBAAc,mBAAYZ,aAAZ,CAAd;EAAA;EAAA,IAAOa,GAAP;;EACA,IAAI,IAAAF,YAAA,EAAIX,aAAa,CAACa,GAAD,CAAjB,EAAwB,QAAxB,CAAJ,EAAuC;IACrC,uCACKX,gBADL,GAGKF,aAAa,CAACa,GAAD,CAAb,CAAmBC,MAHxB;EAKD;;EAED,OAAOZ,gBAAP;AACD,CAlCD;AAoCA;AACA;AACA;;;IACqBa,c;;;;;EASnB,wBACEf,aADF,EAEEgB,aAFF,EAGEf,cAHF,EAIE;IAAA;;IAAA;;IAAA;IACA,IAAMgB,SAAS,GAAGlB,YAAY,CAACC,aAAD,EAAgBC,cAAhB,CAA9B;IACA,0BAAMgB,SAAS,CAACd,EAAhB;IAFA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAIA,MAAKe,IAAL,GAAYD,SAAS,CAACd,EAAtB;IACA,MAAKA,EAAL,GAAUc,SAAS,CAACd,EAApB;IACA,MAAKgB,OAAL,GAAeH,aAAf;IACA,MAAKf,cAAL,GAAsBA,cAAtB;IAEA,MAAKmB,MAAL,GACEJ,aAAa,IAAIA,aAAa,CAACI,MAA/B,GACIJ,aAAa,CAACI,MADlB,GAEItB,iBAHN;IAKA,MAAKuB,QAAL,GAAgBrB,aAAhB;IACA,MAAKS,UAAL,4BAAkBQ,SAAS,CAACR,UAA5B,yEAA0C,EAA1C;IACA,MAAKa,UAAL,uBAAkBL,SAAS,CAACP,KAA5B,+DAAqC,IAArC;;IAEA,IAAIa,KAAK,CAACC,iBAAV,EAA6B;MAC3BD,KAAK,CAACC,iBAAN,8CAA8BT,cAA9B;IACD;;IApBD;EAqBD;;;+CAlCyCQ,K"}
@@ -88,7 +88,8 @@ describe("authentication hooks", () => {
88
88
  return res.status(200).body({ data: "ok" });
89
89
  });
90
90
 
91
- const store = mockStore({ auth: {} });
91
+ const store = mockStore({ auth: {}, i18n: { locale: "en" } });
92
+
92
93
  /**
93
94
  */
94
95
  const wrapper = ({ children }) => (
@@ -107,6 +108,19 @@ describe("authentication hooks", () => {
107
108
  expect(store.getActions()).toStrictEqual([
108
109
  { type: "START_PROGRESS" },
109
110
  { type: "MODULARUI/RESET" },
111
+ {
112
+ type: "MODULARUI/STATUS",
113
+ payload: { key: "application(/)(en)", status: "LOADING" },
114
+ },
115
+ { type: "START_PROGRESS" },
116
+ expect.objectContaining({
117
+ type: "MODULARUI/FETCH",
118
+ payload: expect.objectContaining({
119
+ href: new Href("/", "Application"),
120
+ }),
121
+ }),
122
+ { type: "FINISH_PROGRESS" },
123
+
110
124
  { type: "AUTHENTICATION_LOGOUT" },
111
125
  { type: "FINISH_PROGRESS" },
112
126
  ]);
@@ -1 +1 @@
1
- {"version":3,"file":"useAllFormsOnModel.js","names":["useRetrieveFormsOnModel","model","modularui","forms","setForms","requestCount","setRequestCount","responseCount","setResponseCount","requests","getActions","action","href","selfhref","addParameter","method","HTTP_METHODS","POST","fetch","then","form","FormModel","tokens","name","length","all","responses","actionForms","Object","actionCollection","createActions","getActionsByType","isDisabled","allActions","ListModel","listItemCollection","forEach","listItem","updateActions","push","actions","unique"],"sources":["../../src/hooks/useAllFormsOnModel.js"],"sourcesContent":["// @flow\nimport { useState, useEffect } from \"react\";\n\nimport { useModularUIRequest } from \"./useModularUIRequest\";\n\nimport { HTTP_METHODS } from \"../constants\";\n\nimport ListModel from \"../models/list/ListModel\";\nimport FormModel from \"../models/form/FormModel\";\n\nimport type DetailModel from \"../models/detail/DetailModel\";\nimport type TabModel from \"../models/tab/TabModel\";\nimport type ActionModel from \"../models/actions/ActionModel\";\n\n/**\n * Retrieve all forms configured on a model with actions\n * @param model\n * @returns Object - { actionName: FormModel }\n */\nexport const useRetrieveFormsOnModel = (\n model: ListModel | DetailModel | TabModel\n): null | { [actionName: string]: FormModel } => {\n const modularui = useModularUIRequest();\n const [forms, setForms] = useState(null);\n const [requestCount, setRequestCount] = useState(0);\n const [responseCount, setResponseCount] = useState(0);\n\n useEffect(() => {\n const requests = getActions(model).map((action) => {\n const href = action.selfhref.addParameter(\"commit\", \"false\");\n\n return modularui(href, { method: HTTP_METHODS.POST })\n .fetch()\n .then((form) => {\n if (form instanceof FormModel) {\n form.tokens = [];\n }\n return { [action.name]: form };\n });\n });\n\n setRequestCount(requests.length);\n\n Promise.all(requests).then((responses) => {\n // put response array in object\n const actionForms = Object.assign({}, ...responses);\n setForms(actionForms);\n setResponseCount(responses.length);\n });\n }, [model, modularui]);\n\n if (responseCount === requestCount) {\n return forms;\n }\n\n return null;\n};\n\nconst getActions = (\n model: ListModel | DetailModel | TabModel\n): Array<ActionModel> => {\n if (!model.actionCollection) {\n return [];\n }\n\n const createActions = model.actionCollection\n .getActionsByType(\"create\")\n .filter((action) => !action.isDisabled);\n\n const allActions = [...createActions];\n\n if (model instanceof ListModel) {\n model.listItemCollection.forEach((listItem) => {\n const updateActions = listItem.actionCollection\n .getActionsByType(\"update\")\n .filter((action) => !action.isDisabled);\n\n allActions.push(...updateActions);\n });\n }\n\n const actions = [];\n const unique = [];\n allActions.forEach((action) => {\n if (!unique.includes(action.name)) {\n unique.push(action.name);\n actions.push(action);\n }\n });\n\n return actions;\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AACA;;AAEA;;AAEA;;AAEA;;AACA;;AAMA;AACA;AACA;AACA;AACA;AACO,IAAMA,uBAAuB,GAAG,SAA1BA,uBAA0B,CACrCC,KADqC,EAEU;EAC/C,IAAMC,SAAS,GAAG,+CAAlB;;EACA,gBAA0B,qBAAS,IAAT,CAA1B;EAAA;EAAA,IAAOC,KAAP;EAAA,IAAcC,QAAd;;EACA,iBAAwC,qBAAS,CAAT,CAAxC;EAAA;EAAA,IAAOC,YAAP;EAAA,IAAqBC,eAArB;;EACA,iBAA0C,qBAAS,CAAT,CAA1C;EAAA;EAAA,IAAOC,aAAP;EAAA,IAAsBC,gBAAtB;;EAEA,sBAAU,YAAM;IAAA;;IACd,IAAMC,QAAQ,GAAG,6BAAAC,UAAU,CAACT,KAAD,CAAV,iBAAsB,UAACU,MAAD,EAAY;MACjD,IAAMC,IAAI,GAAGD,MAAM,CAACE,QAAP,CAAgBC,YAA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C,UAACC,QAAD,EAAc;MAAA;;MAC7C,IAAMC,aAAa,GAAG,iCAAAD,QAAQ,CAACR,gBAAT,CACnBE,gBADmB,CACF,QADE,mBAEZ,UAACpB,MAAD;QAAA,OAAY,CAACA,MAAM,CAACqB,UAApB;MAAA,CAFY,CAAtB;MAIAC,UAAU,CAACM,IAAX,OAAAN,UAAU,mCAASK,aAAT,EAAV;IACD,CAND;EAOD;;EAED,IAAME,OAAO,GAAG,EAAhB;EACA,IAAMC,MAAM,GAAG,EAAf;EACAR,UAAU,CAACG,OAAX,CAAmB,UAACzB,MAAD,EAAY;IAC7B,IAAI,CAAC,uBAAA8B,MAAM,MAAN,CAAAA,MAAM,EAAU9B,MAAM,CAACY,IAAjB,CAAX,EAAmC;MACjCkB,MAAM,CAACF,IAAP,CAAY5B,MAAM,CAACY,IAAnB;MACAiB,OAAO,CAACD,IAAR,CAAa5B,MAAb;IACD;EACF,CALD;EAOA,OAAO6B,OAAP;AACD,CAjCD"}
1
+ {"version":3,"file":"useAllFormsOnModel.js","names":["useRetrieveFormsOnModel","model","modularui","useModularUIRequest","useState","forms","setForms","requestCount","setRequestCount","responseCount","setResponseCount","useEffect","requests","getActions","action","href","selfhref","addParameter","method","HTTP_METHODS","POST","fetch","then","form","FormModel","tokens","name","length","all","responses","actionForms","Object","actionCollection","createActions","getActionsByType","isDisabled","allActions","ListModel","listItemCollection","forEach","listItem","updateActions","push","actions","unique"],"sources":["../../src/hooks/useAllFormsOnModel.js"],"sourcesContent":["// @flow\nimport { useState, useEffect } from \"react\";\n\nimport { useModularUIRequest } from \"./useModularUIRequest\";\n\nimport { HTTP_METHODS } from \"../constants\";\n\nimport ListModel from \"../models/list/ListModel\";\nimport FormModel from \"../models/form/FormModel\";\n\nimport type DetailModel from \"../models/detail/DetailModel\";\nimport type TabModel from \"../models/tab/TabModel\";\nimport type ActionModel from \"../models/actions/ActionModel\";\n\n/**\n * Retrieve all forms configured on a model with actions\n * @param model\n * @returns Object - { actionName: FormModel }\n */\nexport const useRetrieveFormsOnModel = (\n model: ListModel | DetailModel | TabModel\n): null | { [actionName: string]: FormModel } => {\n const modularui = useModularUIRequest();\n const [forms, setForms] = useState(null);\n const [requestCount, setRequestCount] = useState(0);\n const [responseCount, setResponseCount] = useState(0);\n\n useEffect(() => {\n const requests = getActions(model).map((action) => {\n const href = action.selfhref.addParameter(\"commit\", \"false\");\n\n return modularui(href, { method: HTTP_METHODS.POST })\n .fetch()\n .then((form) => {\n if (form instanceof FormModel) {\n form.tokens = [];\n }\n return { [action.name]: form };\n });\n });\n\n setRequestCount(requests.length);\n\n Promise.all(requests).then((responses) => {\n // put response array in object\n const actionForms = Object.assign({}, ...responses);\n setForms(actionForms);\n setResponseCount(responses.length);\n });\n }, [model, modularui]);\n\n if (responseCount === requestCount) {\n return forms;\n }\n\n return null;\n};\n\nconst getActions = (\n model: ListModel | DetailModel | TabModel\n): Array<ActionModel> => {\n if (!model.actionCollection) {\n return [];\n }\n\n const createActions = model.actionCollection\n .getActionsByType(\"create\")\n .filter((action) => !action.isDisabled);\n\n const allActions = [...createActions];\n\n if (model instanceof ListModel) {\n model.listItemCollection.forEach((listItem) => {\n const updateActions = listItem.actionCollection\n .getActionsByType(\"update\")\n .filter((action) => !action.isDisabled);\n\n allActions.push(...updateActions);\n });\n }\n\n const actions = [];\n const unique = [];\n allActions.forEach((action) => {\n if (!unique.includes(action.name)) {\n unique.push(action.name);\n actions.push(action);\n }\n });\n\n return actions;\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AACA;;AAEA;;AAEA;;AAEA;;AACA;;AAMA;AACA;AACA;AACA;AACA;AACO,IAAMA,uBAAuB,GAAG,SAA1BA,uBAA0B,CACrCC,KADqC,EAEU;EAC/C,IAAMC,SAAS,GAAG,IAAAC,wCAAA,GAAlB;;EACA,gBAA0B,IAAAC,eAAA,EAAS,IAAT,CAA1B;EAAA;EAAA,IAAOC,KAAP;EAAA,IAAcC,QAAd;;EACA,iBAAwC,IAAAF,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AI,CAACA,KAAK,CAAC+B,gBAAX,EAA6B;IAC3B,OAAO,EAAP;EACD;;EAED,IAAMC,aAAa,GAAG,iCAAAhC,KAAK,CAAC+B,gBAAN,CACnBE,gBADmB,CACF,QADE,mBAEZ,UAACpB,MAAD;IAAA,OAAY,CAACA,MAAM,CAACqB,UAApB;EAAA,CAFY,CAAtB;EAIA,IAAMC,UAAU,oCAAOH,aAAP,CAAhB;;EAEA,IAAIhC,KAAK,YAAYoC,kBAArB,EAAgC;IAC9BpC,KAAK,CAACqC,kBAAN,CAAyBC,OAAzB,CAAiC,UAACC,QAAD,EAAc;MAAA;;MAC7C,IAAMC,aAAa,GAAG,iCAAAD,QAAQ,CAACR,gBAAT,CACnBE,gBADmB,CACF,QADE,mBAEZ,UAACpB,MAAD;QAAA,OAAY,CAACA,MAAM,CAACqB,UAApB;MAAA,CAFY,CAAtB;MAIAC,UAAU,CAACM,IAAX,OAAAN,UAAU,mCAASK,aAAT,EAAV;IACD,CAND;EAOD;;EAED,IAAME,OAAO,GAAG,EAAhB;EACA,IAAMC,MAAM,GAAG,EAAf;EACAR,UAAU,CAACG,OAAX,CAAmB,UAACzB,MAAD,EAAY;IAC7B,IAAI,CAAC,uBAAA8B,MAAM,MAAN,CAAAA,MAAM,EAAU9B,MAAM,CAACY,IAAjB,CAAX,EAAmC;MACjCkB,MAAM,CAACF,IAAP,CAAY5B,MAAM,CAACY,IAAnB;MACAiB,OAAO,CAACD,IAAR,CAAa5B,MAAb;IACD;EACF,CALD;EAOA,OAAO6B,OAAP;AACD,CAjCD"}
@@ -1,49 +1,28 @@
1
1
  "use strict";
2
2
 
3
- var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault");
4
-
5
3
  Object.defineProperty(exports, "__esModule", {
6
4
  value: true
7
5
  });
8
6
  exports.useLogout = exports.useLogin = void 0;
9
7
 
10
- var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/slicedToArray"));
11
-
12
8
  var _reactRedux = require("react-redux");
13
9
 
14
10
  var _selectors = require("../redux/_modularui/selectors");
15
11
 
16
12
  var _actions = require("../redux/actions");
17
13
 
18
- var _UserServicesModel = _interopRequireDefault(require("../models/user/UserServicesModel"));
19
-
20
- var _react = require("react");
21
-
22
- var getIsAuthenticated = function getIsAuthenticated(isAuthenticated, application) {
23
- if (!application) {
24
- return false;
25
- }
26
-
27
- var userServicesModel = application.userServices;
28
-
29
- if (userServicesModel instanceof _UserServicesModel.default) {
30
- return isAuthenticated && userServicesModel.isLoggedIn;
31
- }
32
-
33
- return false;
34
- };
35
14
  /**
36
15
  */
37
-
38
-
39
16
  var useLogin = function useLogin() {
17
+ var _application$isLogged;
18
+
40
19
  var dispatch = (0, _reactRedux.useDispatch)();
41
20
  var application = (0, _reactRedux.useSelector)(_selectors.getApplication);
42
21
  var auth = (0, _reactRedux.useSelector)(function (state) {
43
22
  return state.auth;
44
23
  });
45
24
  return {
46
- isAuthenticated: getIsAuthenticated(auth.isAuthenticated, application),
25
+ isAuthenticated: (_application$isLogged = application === null || application === void 0 ? void 0 : application.isLoggedIn) !== null && _application$isLogged !== void 0 ? _application$isLogged : false,
47
26
  errorMessage: auth.error,
48
27
  resetErrors: function resetErrors() {
49
28
  return dispatch((0, _actions.resetAuthErrors)());
@@ -60,41 +39,14 @@ var useLogin = function useLogin() {
60
39
  exports.useLogin = useLogin;
61
40
 
62
41
  var useLogout = function useLogout() {
42
+ var _application$isLogged2;
43
+
63
44
  var dispatch = (0, _reactRedux.useDispatch)();
64
45
  var application = (0, _reactRedux.useSelector)(_selectors.getApplication);
65
- var auth = (0, _reactRedux.useSelector)(function (state) {
66
- var _state$auth;
67
-
68
- return ((_state$auth = state.auth) === null || _state$auth === void 0 ? void 0 : _state$auth.isAuthenticated) || false;
69
- });
70
-
71
- var _useState = (0, _react.useState)(false),
72
- _useState2 = (0, _slicedToArray2.default)(_useState, 2),
73
- cancel = _useState2[0],
74
- setCancel = _useState2[1];
75
-
76
- var _useState3 = (0, _react.useState)(function () {
77
- return getIsAuthenticated(auth, application);
78
- }),
79
- _useState4 = (0, _slicedToArray2.default)(_useState3, 2),
80
- isAuthenticated = _useState4[0],
81
- setIsAuthenticated = _useState4[1]; // set cancel to true when the component this hook is used on, has been unmounted
82
- // prevents state changes after unmount
83
-
84
-
85
- (0, _react.useEffect)(function () {
86
- return function () {
87
- setCancel(true);
88
- };
89
- }, []);
90
46
  return {
91
- isAuthenticated: isAuthenticated,
47
+ isAuthenticated: (_application$isLogged2 = application === null || application === void 0 ? void 0 : application.isLoggedIn) !== null && _application$isLogged2 !== void 0 ? _application$isLogged2 : false,
92
48
  logout: function logout() {
93
- return dispatch((0, _actions.logout)()).then(function () {
94
- if (!cancel) {
95
- setIsAuthenticated(false);
96
- }
97
- });
49
+ return dispatch((0, _actions.logout)());
98
50
  }
99
51
  };
100
52
  };
@@ -1,9 +1,8 @@
1
1
  // @flow
2
2
  import { useSelector, useDispatch } from "react-redux";
3
+
3
4
  import { getApplication } from "../redux/_modularui/selectors";
4
5
  import { login, logout, resetAuthErrors } from "../redux/actions";
5
- import UserServicesModel from "../models/user/UserServicesModel";
6
- import { useState, useEffect } from "react";
7
6
 
8
7
  import type { ResetAuthErrorsAction } from "../redux/types";
9
8
  type LoginHook = {
@@ -17,19 +16,6 @@ type LogoutHook = {
17
16
  logout: () => void,
18
17
  };
19
18
 
20
- const getIsAuthenticated = (isAuthenticated, application) => {
21
- if (!application) {
22
- return false;
23
- }
24
-
25
- const userServicesModel = application.userServices;
26
- if (userServicesModel instanceof UserServicesModel) {
27
- return isAuthenticated && userServicesModel.isLoggedIn;
28
- }
29
-
30
- return false;
31
- };
32
-
33
19
  /**
34
20
  */
35
21
  export const useLogin = (): LoginHook => {
@@ -39,7 +25,7 @@ export const useLogin = (): LoginHook => {
39
25
  const auth = useSelector((state) => state.auth);
40
26
 
41
27
  return {
42
- isAuthenticated: getIsAuthenticated(auth.isAuthenticated, application),
28
+ isAuthenticated: application?.isLoggedIn ?? false,
43
29
  errorMessage: auth.error,
44
30
  resetErrors: () => dispatch(resetAuthErrors()),
45
31
  login: (username: string, password: string) =>
@@ -52,28 +38,9 @@ export const useLogin = (): LoginHook => {
52
38
  export const useLogout = (): LogoutHook => {
53
39
  const dispatch = useDispatch();
54
40
  const application = useSelector(getApplication);
55
- const auth = useSelector((state) => state.auth?.isAuthenticated || false);
56
-
57
- const [cancel, setCancel] = useState(false);
58
- const [isAuthenticated, setIsAuthenticated] = useState(() =>
59
- getIsAuthenticated(auth, application)
60
- );
61
-
62
- // set cancel to true when the component this hook is used on, has been unmounted
63
- // prevents state changes after unmount
64
- useEffect(() => {
65
- return () => {
66
- setCancel(true);
67
- };
68
- }, []);
69
41
 
70
42
  return {
71
- isAuthenticated,
72
- logout: () =>
73
- dispatch(logout()).then(() => {
74
- if (!cancel) {
75
- setIsAuthenticated(false);
76
- }
77
- }),
43
+ isAuthenticated: application?.isLoggedIn ?? false,
44
+ logout: () => dispatch(logout()),
78
45
  };
79
46
  };