@beinformed/ui 1.25.6 → 1.27.0-beta.0

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 (215) hide show
  1. package/CHANGELOG.md +31 -0
  2. package/esm/constants/Constants.js +9 -35
  3. package/esm/constants/Constants.js.map +1 -1
  4. package/esm/constants/Settings.js +47 -1
  5. package/esm/constants/Settings.js.map +1 -1
  6. package/esm/hooks/useAuthentication.js +7 -6
  7. package/esm/hooks/useAuthentication.js.map +1 -1
  8. package/esm/models/application/ApplicationModel.js +2 -3
  9. package/esm/models/application/ApplicationModel.js.map +1 -1
  10. package/esm/models/attributes/ChoiceAttributeOptionCollection.js +3 -12
  11. package/esm/models/attributes/ChoiceAttributeOptionCollection.js.map +1 -1
  12. package/esm/models/attributes/UploadAttributeModel.js +15 -3
  13. package/esm/models/attributes/UploadAttributeModel.js.map +1 -1
  14. package/esm/models/error/ErrorModel.js +11 -0
  15. package/esm/models/error/ErrorModel.js.map +1 -1
  16. package/esm/models/href/Href.js +4 -4
  17. package/esm/models/href/Href.js.map +1 -1
  18. package/esm/modularui/Authenticate.js +6 -6
  19. package/esm/modularui/Authenticate.js.map +1 -1
  20. package/esm/modularui/CaptchaRequest.js +46 -0
  21. package/esm/modularui/CaptchaRequest.js.map +1 -0
  22. package/esm/modularui/ModularUIRequest.js +48 -6
  23. package/esm/modularui/ModularUIRequest.js.map +1 -1
  24. package/esm/modularui/UploadRequest.js +104 -0
  25. package/esm/modularui/UploadRequest.js.map +1 -0
  26. package/esm/modularui/index.js +2 -0
  27. package/esm/modularui/index.js.map +1 -1
  28. package/esm/react-client/client.js +2 -2
  29. package/esm/react-client/client.js.map +1 -1
  30. package/esm/react-server/contextPath.js +2 -2
  31. package/esm/react-server/contextPath.js.map +1 -1
  32. package/esm/react-server/renderSSRComplete.js +5 -4
  33. package/esm/react-server/renderSSRComplete.js.map +1 -1
  34. package/esm/react-server/renderSSRMinimal.js +2 -2
  35. package/esm/react-server/renderSSRMinimal.js.map +1 -1
  36. package/esm/react-server/serverNoSSR.js +2 -1
  37. package/esm/react-server/serverNoSSR.js.map +1 -1
  38. package/esm/react-server/serverUtil.js +31 -5
  39. package/esm/react-server/serverUtil.js.map +1 -1
  40. package/esm/redux/_modularui/ModularUIActions.js +7 -0
  41. package/esm/redux/_modularui/ModularUIActions.js.map +1 -1
  42. package/esm/redux/_modularui/ModularUIMiddleware.js.map +1 -1
  43. package/esm/redux/_modularui/ModularUIReducer.js +21 -1
  44. package/esm/redux/_modularui/ModularUIReducer.js.map +1 -1
  45. package/esm/redux/_modularui/types.js.map +1 -1
  46. package/esm/redux/store/configureStore.js +1 -1
  47. package/esm/redux/store/configureStore.js.map +1 -1
  48. package/esm/redux/types.js.map +1 -1
  49. package/esm/utils/browser/Cookies.js +6 -7
  50. package/esm/utils/browser/Cookies.js.map +1 -1
  51. package/esm/utils/fetch/serverFetch.js +2 -2
  52. package/esm/utils/fetch/serverFetch.js.map +1 -1
  53. package/esm/utils/fetch/types.js.map +1 -1
  54. package/esm/utils/fetch/universalFetch.js +4 -3
  55. package/esm/utils/fetch/universalFetch.js.map +1 -1
  56. package/esm/utils/fetch/xhr.js.map +1 -1
  57. package/esm/utils/helpers/checkResource.js +0 -3
  58. package/esm/utils/helpers/checkResource.js.map +1 -1
  59. package/esm/utils/helpers/index.js +8 -0
  60. package/esm/utils/helpers/index.js.map +1 -0
  61. package/esm/utils/helpers/repositoryResource.js +18 -0
  62. package/esm/utils/helpers/repositoryResource.js.map +1 -0
  63. package/esm/utils/index.js +1 -6
  64. package/esm/utils/index.js.map +1 -1
  65. package/lib/constants/Constants.js +13 -42
  66. package/lib/constants/Constants.js.flow +9 -41
  67. package/lib/constants/Constants.js.map +1 -1
  68. package/lib/constants/Settings.js +53 -1
  69. package/lib/constants/Settings.js.flow +60 -0
  70. package/lib/constants/Settings.js.map +1 -1
  71. package/lib/hooks/useAuthentication.js +6 -5
  72. package/lib/hooks/useAuthentication.js.flow +9 -8
  73. package/lib/hooks/useAuthentication.js.map +1 -1
  74. package/lib/models/application/ApplicationModel.js +1 -1
  75. package/lib/models/application/ApplicationModel.js.flow +3 -2
  76. package/lib/models/application/ApplicationModel.js.map +1 -1
  77. package/lib/models/attributes/ChoiceAttributeOptionCollection.js +3 -12
  78. package/lib/models/attributes/ChoiceAttributeOptionCollection.js.flow +3 -17
  79. package/lib/models/attributes/ChoiceAttributeOptionCollection.js.map +1 -1
  80. package/lib/models/attributes/UploadAttributeModel.js +15 -3
  81. package/lib/models/attributes/UploadAttributeModel.js.flow +21 -0
  82. package/lib/models/attributes/UploadAttributeModel.js.map +1 -1
  83. package/lib/models/error/ErrorModel.js +11 -0
  84. package/lib/models/error/ErrorModel.js.flow +12 -1
  85. package/lib/models/error/ErrorModel.js.map +1 -1
  86. package/lib/models/href/Href.js +6 -6
  87. package/lib/models/href/Href.js.flow +4 -4
  88. package/lib/models/href/Href.js.map +1 -1
  89. package/lib/models/href/__tests__/Href.spec.js.flow +2 -3
  90. package/lib/modularui/Authenticate.js +4 -4
  91. package/lib/modularui/Authenticate.js.flow +6 -5
  92. package/lib/modularui/Authenticate.js.map +1 -1
  93. package/lib/modularui/CaptchaRequest.js +54 -0
  94. package/lib/modularui/CaptchaRequest.js.flow +45 -0
  95. package/lib/modularui/CaptchaRequest.js.map +1 -0
  96. package/lib/modularui/ModularUIRequest.js +46 -4
  97. package/lib/modularui/ModularUIRequest.js.flow +49 -10
  98. package/lib/modularui/ModularUIRequest.js.map +1 -1
  99. package/lib/modularui/UploadRequest.js +112 -0
  100. package/lib/modularui/UploadRequest.js.flow +125 -0
  101. package/lib/modularui/UploadRequest.js.map +1 -0
  102. package/lib/modularui/index.js +14 -0
  103. package/lib/modularui/index.js.flow +2 -0
  104. package/lib/modularui/index.js.map +1 -1
  105. package/lib/react-client/client.js +2 -2
  106. package/lib/react-client/client.js.flow +2 -2
  107. package/lib/react-client/client.js.map +1 -1
  108. package/lib/react-server/contextPath.js +2 -2
  109. package/lib/react-server/contextPath.js.flow +2 -2
  110. package/lib/react-server/contextPath.js.map +1 -1
  111. package/lib/react-server/renderSSRComplete.js +5 -4
  112. package/lib/react-server/renderSSRComplete.js.flow +6 -4
  113. package/lib/react-server/renderSSRComplete.js.map +1 -1
  114. package/lib/react-server/renderSSRMinimal.js +2 -2
  115. package/lib/react-server/renderSSRMinimal.js.flow +2 -2
  116. package/lib/react-server/renderSSRMinimal.js.map +1 -1
  117. package/lib/react-server/serverNoSSR.js +1 -0
  118. package/lib/react-server/serverNoSSR.js.flow +5 -0
  119. package/lib/react-server/serverNoSSR.js.map +1 -1
  120. package/lib/react-server/serverUtil.js +32 -5
  121. package/lib/react-server/serverUtil.js.flow +40 -6
  122. package/lib/react-server/serverUtil.js.map +1 -1
  123. package/lib/redux/_modularui/ModularUIActions.js +9 -1
  124. package/lib/redux/_modularui/ModularUIActions.js.flow +10 -0
  125. package/lib/redux/_modularui/ModularUIActions.js.map +1 -1
  126. package/lib/redux/_modularui/ModularUIMiddleware.js.flow +1 -1
  127. package/lib/redux/_modularui/ModularUIMiddleware.js.map +1 -1
  128. package/lib/redux/_modularui/ModularUIReducer.js +21 -1
  129. package/lib/redux/_modularui/ModularUIReducer.js.flow +22 -0
  130. package/lib/redux/_modularui/ModularUIReducer.js.map +1 -1
  131. package/lib/redux/_modularui/types.js.flow +9 -1
  132. package/lib/redux/_modularui/types.js.map +1 -1
  133. package/lib/redux/store/configureStore.js +1 -1
  134. package/lib/redux/store/configureStore.js.flow +1 -1
  135. package/lib/redux/store/configureStore.js.map +1 -1
  136. package/lib/redux/types.js.flow +2 -0
  137. package/lib/redux/types.js.map +1 -1
  138. package/lib/utils/browser/Cookies.js +3 -3
  139. package/lib/utils/browser/Cookies.js.flow +10 -8
  140. package/lib/utils/browser/Cookies.js.map +1 -1
  141. package/lib/utils/fetch/serverFetch.js +2 -2
  142. package/lib/utils/fetch/serverFetch.js.flow +2 -2
  143. package/lib/utils/fetch/serverFetch.js.map +1 -1
  144. package/lib/utils/fetch/types.js.flow +1 -1
  145. package/lib/utils/fetch/types.js.map +1 -1
  146. package/lib/utils/fetch/universalFetch.js +3 -2
  147. package/lib/utils/fetch/universalFetch.js.flow +5 -3
  148. package/lib/utils/fetch/universalFetch.js.map +1 -1
  149. package/lib/utils/fetch/xhr.js.flow +1 -1
  150. package/lib/utils/fetch/xhr.js.map +1 -1
  151. package/lib/utils/helpers/checkResource.js +0 -3
  152. package/lib/utils/helpers/checkResource.js.flow +0 -2
  153. package/lib/utils/helpers/checkResource.js.map +1 -1
  154. package/lib/utils/helpers/index.js +90 -0
  155. package/lib/utils/helpers/index.js.flow +8 -0
  156. package/lib/utils/helpers/index.js.map +1 -0
  157. package/lib/utils/helpers/repositoryResource.js +25 -0
  158. package/lib/utils/helpers/repositoryResource.js.flow +20 -0
  159. package/lib/utils/helpers/repositoryResource.js.map +1 -0
  160. package/lib/utils/index.js +4 -60
  161. package/lib/utils/index.js.flow +1 -6
  162. package/lib/utils/index.js.map +1 -1
  163. package/package.json +1 -1
  164. package/src/constants/Constants.js +9 -41
  165. package/src/constants/Settings.js +60 -0
  166. package/src/hooks/useAuthentication.js +9 -8
  167. package/src/models/application/ApplicationModel.js +3 -2
  168. package/src/models/attributes/ChoiceAttributeOptionCollection.js +3 -17
  169. package/src/models/attributes/UploadAttributeModel.js +21 -0
  170. package/src/models/error/ErrorModel.js +12 -1
  171. package/src/models/href/Href.js +4 -4
  172. package/src/models/href/__tests__/Href.spec.js +2 -3
  173. package/src/modularui/Authenticate.js +6 -5
  174. package/src/modularui/CaptchaRequest.js +45 -0
  175. package/src/modularui/ModularUIRequest.js +49 -10
  176. package/src/modularui/UploadRequest.js +125 -0
  177. package/src/modularui/index.js +2 -0
  178. package/src/react-client/client.js +2 -2
  179. package/src/react-server/contextPath.js +2 -2
  180. package/src/react-server/renderSSRComplete.js +6 -4
  181. package/src/react-server/renderSSRMinimal.js +2 -2
  182. package/src/react-server/serverNoSSR.js +5 -0
  183. package/src/react-server/serverUtil.js +40 -6
  184. package/src/redux/_modularui/ModularUIActions.js +10 -0
  185. package/src/redux/_modularui/ModularUIMiddleware.js +1 -1
  186. package/src/redux/_modularui/ModularUIReducer.js +22 -0
  187. package/src/redux/_modularui/types.js +9 -1
  188. package/src/redux/store/configureStore.js +1 -1
  189. package/src/redux/types.js +2 -0
  190. package/src/utils/browser/Cookies.js +10 -8
  191. package/src/utils/fetch/serverFetch.js +2 -2
  192. package/src/utils/fetch/types.js +1 -1
  193. package/src/utils/fetch/universalFetch.js +5 -3
  194. package/src/utils/fetch/xhr.js +1 -1
  195. package/src/utils/helpers/checkResource.js +0 -2
  196. package/src/utils/helpers/index.js +8 -0
  197. package/src/utils/helpers/repositoryResource.js +20 -0
  198. package/src/utils/index.js +1 -6
  199. package/types/constants/Constants.d.ts +8 -24
  200. package/types/constants/Settings.d.ts +12 -0
  201. package/types/models/attributes/ChoiceAttributeOptionCollection.d.ts +0 -3
  202. package/types/models/attributes/UploadAttributeModel.d.ts +6 -0
  203. package/types/models/error/ErrorModel.d.ts +5 -0
  204. package/types/models/href/Href.d.ts +1 -1
  205. package/types/modularui/CaptchaRequest.d.ts +17 -0
  206. package/types/modularui/ModularUIRequest.d.ts +13 -0
  207. package/types/modularui/UploadRequest.d.ts +29 -0
  208. package/types/modularui/index.d.ts +2 -0
  209. package/types/redux/_modularui/types.d.ts +9 -3
  210. package/types/redux/types.d.ts +1 -1
  211. package/types/utils/browser/Cookies.d.ts +0 -6
  212. package/types/utils/fetch/types.d.ts +2 -3
  213. package/types/utils/helpers/index.d.ts +7 -0
  214. package/types/utils/helpers/repositoryResource.d.ts +1 -0
  215. package/types/utils/index.d.ts +1 -6
@@ -36,6 +36,14 @@ export type SetModelAction = {
36
36
  },
37
37
  };
38
38
 
39
+ export type InitModelAction = {
40
+ type: "MODULARUI/INIT",
41
+ payload: Array<{
42
+ key: string,
43
+ model: ModularUIModel,
44
+ }>,
45
+ };
46
+
39
47
  export type UpdateModelAction = {
40
48
  type: "MODULARUI/UPDATE",
41
49
  payload: ModularUIModel,
@@ -54,7 +62,7 @@ export type ModularUIAction = {
54
62
  payload: {
55
63
  href: Href,
56
64
  method?: $Keys<HTTP_METHODS>,
57
- data?: string | { [key: string]: string },
65
+ data?: any,
58
66
  locale: string,
59
67
  childmodels?: boolean,
60
68
  targetModel?: TargetModel,
@@ -49,7 +49,7 @@ const configureStore = (
49
49
  enhancers
50
50
  );
51
51
 
52
- if (!initialState) {
52
+ if (!initialState?.router) {
53
53
  store.dispatch(locationChange(history.location, "PUSH"));
54
54
  }
55
55
  return { history, store };
@@ -23,6 +23,7 @@ import type {
23
23
  UpdateModelAction,
24
24
  RemoveModelByKeyAction,
25
25
  ResetModularUIAction,
26
+ InitModelAction,
26
27
  } from "./_modularui/types";
27
28
  import type {
28
29
  RouterState,
@@ -135,6 +136,7 @@ export type UpdateAutosaveAction = {
135
136
  export type ReduxAction =
136
137
  | UpdateStatusAction
137
138
  | SetModelAction
139
+ | InitModelAction
138
140
  | UpdateModelAction
139
141
  | RemoveModelByKeyAction
140
142
  | ResetModularUIAction
@@ -1,7 +1,7 @@
1
1
  // @flow
2
2
  import Cookies from "js-cookie";
3
3
 
4
- import { BASE } from "../../constants/Constants";
4
+ import { getBasePath } from "../../constants/Settings";
5
5
 
6
6
  type CookieOptions = {
7
7
  days?: number,
@@ -18,14 +18,18 @@ type CookieAttributes = {
18
18
 
19
19
  /**
20
20
  */
21
- const getCookie = (name: string): null | string => {
21
+ export const getCookie = (name: string): null | string => {
22
22
  return Cookies.get(name);
23
23
  };
24
24
 
25
25
  /**
26
26
  */
27
- const setCookie = (name: string, value: any, options?: CookieOptions) => {
28
- const attributes: CookieAttributes = { path: BASE };
27
+ export const setCookie = (
28
+ name: string,
29
+ value: any,
30
+ options?: CookieOptions
31
+ ) => {
32
+ const attributes: CookieAttributes = { path: getBasePath() };
29
33
  attributes.expires = options?.days;
30
34
  attributes.sameSite = options?.sameSite ?? "Strict";
31
35
  attributes.secure = options?.secure;
@@ -35,8 +39,6 @@ const setCookie = (name: string, value: any, options?: CookieOptions) => {
35
39
 
36
40
  /**
37
41
  */
38
- const clearCookie = (name: string) => {
39
- Cookies.remove(name, { path: BASE });
42
+ export const clearCookie = (name: string) => {
43
+ Cookies.remove(name, { path: getBasePath() });
40
44
  };
41
-
42
- export { getCookie, setCookie, clearCookie };
@@ -1,5 +1,5 @@
1
1
  // @flow
2
- import { BASE } from "../../constants/Constants";
2
+ import { getBasePath } from "../../constants/Settings";
3
3
  import { FetchException } from "../../exceptions";
4
4
 
5
5
  import type { RequestOptions } from "./types";
@@ -11,7 +11,7 @@ export default function serverFetch(args: RequestOptions): Promise<any> {
11
11
  // remove contextPath of url, when the request is internal the context path is not needed
12
12
  const urlNoBase = args.url.includes("http")
13
13
  ? args.url
14
- : args.url.replace(BASE, "");
14
+ : args.url.replace(getBasePath(), "");
15
15
  const params = args.params
16
16
  ? args.params.replace("includeContext=true", "")
17
17
  : "";
@@ -10,7 +10,7 @@ export type RequestURLOptions = {
10
10
  export type RequestBaseOptions = {
11
11
  method?: $Keys<HTTP_METHODS>,
12
12
  params?: string,
13
- data?: string | { [key: string]: string },
13
+ data?: any,
14
14
  timeout?: number,
15
15
  responseType?: string,
16
16
  headers?: {
@@ -1,7 +1,9 @@
1
1
  // @flow
2
2
  import { isPlainObject } from "../helpers/objects";
3
3
 
4
- import { IS_SYNC, USE_CACHE } from "../../constants/Constants";
4
+ import { IS_SYNC } from "../../constants/Constants";
5
+ import { cacheContributions } from "../../constants";
6
+
5
7
  import serverFetch from "./serverFetch";
6
8
  import xhr from "./xhr";
7
9
  import Cache from "../browser/Cache";
@@ -45,7 +47,7 @@ const waitForCachedItem = (cacheKey: string) => {
45
47
  * @private
46
48
  */
47
49
  const browserFetch = (args: RequestOptions) => {
48
- if (USE_CACHE && args.cache) {
50
+ if (cacheContributions() && args.cache) {
49
51
  const cacheKey = Cache.createResourceKey(args);
50
52
 
51
53
  if (Cache.hasItem(cacheKey)) {
@@ -64,7 +66,7 @@ const browserFetch = (args: RequestOptions) => {
64
66
  }
65
67
 
66
68
  return xhr(args).then((response) => {
67
- if (USE_CACHE && args.cache) {
69
+ if (cacheContributions() && args.cache) {
68
70
  const cacheKey = Cache.createResourceKey(args);
69
71
 
70
72
  Cache.addItem(cacheKey, response);
@@ -105,7 +105,7 @@ class XHR {
105
105
 
106
106
  /**
107
107
  */
108
- get data(): string | { [key: string]: string } | null {
108
+ get data(): any | null {
109
109
  return this.options.data || null;
110
110
  }
111
111
 
@@ -11,8 +11,6 @@ import Href from "../../models/href/Href";
11
11
  export const resourceExists = (url: string | Href): boolean => {
12
12
  const fullUrl = new Href(url).absolutehref;
13
13
 
14
- // const fullUrl = `${BASE}/${url}`.replace(/\/\//g, "/");
15
-
16
14
  const xhr = new XMLHttpRequest();
17
15
  xhr.open("HEAD", fullUrl, false);
18
16
  xhr.setRequestHeader("Accept", "application/json");
@@ -0,0 +1,8 @@
1
+ // @flow
2
+ export * from "./createHash";
3
+ export { default as createUUID } from "./createUUID";
4
+ export * from "./sanitizeHtml";
5
+ export * from "./objects";
6
+ export * from "./text";
7
+ export * from "./checkResource";
8
+ export * from "./repositoryResource";
@@ -0,0 +1,20 @@
1
+ // @flow
2
+ import { getBasePath, RESOURCE_PATH } from "../../constants";
3
+
4
+ /**
5
+ * Creates an url to a resource in the Be Informed repository
6
+ * Only possible when serving using the UI Servlet of Be Informed
7
+ */
8
+ export const getRepositoryResourceUrl = (resourceUrl: string): string => {
9
+ const basePath = getBasePath();
10
+
11
+ if (resourceUrl.startsWith(basePath)) {
12
+ return resourceUrl;
13
+ }
14
+
15
+ if (resourceUrl.startsWith(RESOURCE_PATH)) {
16
+ return `${basePath}${resourceUrl}`;
17
+ }
18
+
19
+ return `${basePath}${RESOURCE_PATH}${resourceUrl}`;
20
+ };
@@ -14,12 +14,7 @@ export { default as xhr } from "./fetch/xhr";
14
14
  export type * from "./fetch/types";
15
15
 
16
16
  // helpers
17
- export * from "./helpers/createHash";
18
- export { default as createUUID } from "./helpers/createUUID";
19
- export * from "./helpers/sanitizeHtml";
20
- export * from "./helpers/objects";
21
- export * from "./helpers/text";
22
- export * from "./helpers/checkResource";
17
+ export * from "./helpers";
23
18
 
24
19
  // number
25
20
  export { default as DecimalFormat } from "./number/DecimalFormat";
@@ -1,35 +1,15 @@
1
- /**
2
- * Indicates if contributions should be cached
3
- */
4
- export const USE_CACHE: true;
5
- /**
6
- * Base path
7
- * This uses contextPath set from property from server
8
- * When requesting a remote server with CORS enabled, add the origin, for example:
9
- * export const BEINFORMED_PATH = 'http://192.168.128.61:8080/BeInformed';
10
- */
11
- export const BASE: string;
12
- /**
13
- * Path to the contributions api end point
14
- * /contributions uri part is added through the _links in the data service
15
- */
16
- export const MODULARUI_CONTRIBUTIONS: "/contributions";
17
- /**
18
- * Base Path
19
- */
20
- export const APPLICATION_PATH: string;
21
1
  /**
22
2
  * path to content service
23
3
  */
24
- export const CONTENT_PATH: string;
4
+ export const CONTENT_PATH: "/content";
25
5
  /**
26
6
  * Upload Path
27
7
  */
28
- export const UPLOAD_PATH: string;
8
+ export const UPLOAD_PATH: "/uploadFile";
29
9
  /**
30
10
  * Captcha Path
31
11
  */
32
- export const CAPTCHA_PATH: string;
12
+ export const CAPTCHA_PATH: "/captchaServices";
33
13
  /**
34
14
  * Path to change password page / component
35
15
  */
@@ -38,6 +18,10 @@ export const CHANGEPASSWORD_PATH: "/change-password";
38
18
  * Path to user profile page / component
39
19
  */
40
20
  export const USERPROFILE_PATH: "/user";
21
+ /**
22
+ * Path to resources in the Be Informed repository
23
+ */
24
+ export const RESOURCE_PATH: "/resource";
41
25
  /**
42
26
  * Separator for parameters of a list, makes it possible to render multiple lists on a page in a non-js environment
43
27
  */
@@ -149,7 +133,7 @@ export const LOGIN_PATH_SETTING: "FormClient.login_url";
149
133
  export const LOGIN_USERNAME_SETTING: "FormClient.username_field_name";
150
134
  export const LOGIN_PASSWORD_SETTING: "FormClient.password_field_name";
151
135
  export const LOGOUT_PATH_SETTING: "FormClient.logout_url";
152
- export namespace fallbackDefaultAuthenticationType {
136
+ export namespace DEFAULT_AUTHENTICATION_TYPE {
153
137
  const name: string;
154
138
  const authentication: string;
155
139
  const isPrimary: boolean;
@@ -4,6 +4,10 @@ export function setSetting(key: string, value: any): void;
4
4
  export function allSettings(): {
5
5
  [name: string]: Setting;
6
6
  };
7
+ export function cacheContributions(): boolean;
8
+ export function getBasePath(): string;
9
+ export function getUploadPath(): string;
10
+ export function getCaptchaPath(): string;
7
11
  export function hasAllContentInData(): boolean;
8
12
  export function loginType(): string;
9
13
  export function loginPath(): string;
@@ -12,5 +16,13 @@ export function loginPasswordField(): string;
12
16
  export function logoutPath(): string;
13
17
  export const LOGIN_PATH: string;
14
18
  export const LOGOUT_PATH: string;
19
+ /**
20
+ * Model overview swim lane configuration
21
+ */
22
+ export const getSwimLaneDiagramConfiguration: Object;
23
+ /**
24
+ * Backwards compatible export of BASE constant
25
+ */
26
+ export const BASE: string;
15
27
  type Setting = string | number | boolean | string[];
16
28
  export {};
@@ -30,9 +30,6 @@ declare class ChoiceAttributeOptionCollection extends ResourceCollection<ChoiceA
30
30
  /**
31
31
  */
32
32
  addBooleanOption(code: "true" | "false", defaultLabel: string, data: string | Array<string>, options?: Array<Object>): void;
33
- /**
34
- */
35
- getDefaultValueForOption(value: any, contributions: Object): string;
36
33
  /**
37
34
  * Create two static options for true and false,
38
35
  * there might be alternative labels configured for each option value
@@ -36,7 +36,13 @@ export default class UploadAttributeModel extends StringAttributeModel {
36
36
  get uploadConstraints(): {
37
37
  fileTypes: FiletypeConstraintsType;
38
38
  maxFileSize: FilesizeConstraintsType;
39
+ acceptedFiles: Array<string>;
39
40
  };
41
+ /**
42
+ * Array of accepted file extensions and mime types.
43
+ * Convenience method for accept attribute of file input html control
44
+ */
45
+ get acceptedFiles(): string[];
40
46
  /**
41
47
  */
42
48
  set files(arg: FilesType);
@@ -31,6 +31,11 @@ declare class ErrorModel {
31
31
  /**
32
32
  */
33
33
  get isMandatoryConstraint(): boolean;
34
+ /**
35
+ * Returns a message object from the error
36
+ */
37
+ getMessage(): MessageObject;
34
38
  }
35
39
  import { MessageParameters } from "../../i18n/types";
36
40
  import LayoutHintCollection from "../layouthint/LayoutHintCollection";
41
+ import { MessageObject } from "../../i18n/types";
@@ -141,7 +141,7 @@ declare class Href {
141
141
  */
142
142
  setState(state: any): Href;
143
143
  /**
144
- * Retrieve the path combined with the BASE of the application, e.g. /BeInformed
144
+ * Retrieve the path combined with the base path (context-path) of the application, e.g. /BeInformed
145
145
  */
146
146
  get absolutepath(): string;
147
147
  /**
@@ -0,0 +1,17 @@
1
+ export default CaptchaRequest;
2
+ /**
3
+ */
4
+ declare class CaptchaRequest {
5
+ /**
6
+ */
7
+ init(): Promise<CaptchaResponse>;
8
+ /**
9
+ */
10
+ send(answer: string): Promise<CaptchaResponse>;
11
+ #private;
12
+ }
13
+ type CaptchaResponse = {
14
+ tokenId: string;
15
+ image: any;
16
+ valid: boolean;
17
+ };
@@ -11,6 +11,7 @@ declare class ModularUIRequest {
11
11
  _href: Href;
12
12
  _options: RequestModularUIOptions;
13
13
  _targetModel: TargetModel | null;
14
+ _forceTargetModel: boolean;
14
15
  _contributionsHref: string;
15
16
  _locale: string;
16
17
  _method: $Keys<{
@@ -69,6 +70,12 @@ declare class ModularUIRequest {
69
70
  /**
70
71
  */
71
72
  get withChildModels(): boolean;
73
+ /**
74
+ */
75
+ set forceTargetModel(arg: boolean);
76
+ /**
77
+ */
78
+ get forceTargetModel(): boolean;
72
79
  /**
73
80
  */
74
81
  resolveModel(): Class<ModularUIModel>;
@@ -174,6 +181,12 @@ declare class ModularUIRequest {
174
181
  * @returns {Promise<FormModel>}
175
182
  */
176
183
  postForm(form: FormModel): Promise<FormModel>;
184
+ /**
185
+ * Simplified synchronous version of fetch (returns the model, not a Promise)
186
+ * This can be used on the server to retrieve a model. It only loads the request url and it's child models
187
+ */
188
+ fetchSync(): ModularUIModel;
189
+ #private;
177
190
  }
178
191
  import ModularUIResponse from "./ModularUIResponse";
179
192
  import Href from "../models/href/Href";
@@ -0,0 +1,29 @@
1
+ export default UploadRequest;
2
+ /**
3
+ * Upload a file to the upload file service of Be Informed
4
+ */
5
+ declare class UploadRequest {
6
+ constructor(uploadConstraints: {
7
+ fileTypes: FiletypeConstraintsType;
8
+ maxFileSize: FilesizeConstraintsType;
9
+ }, progressHandler: ProgressHandler);
10
+ /**
11
+ */
12
+ getFileExtension(file: File): string;
13
+ /**
14
+ */
15
+ isNotAllowedFileType(file: File): boolean;
16
+ /**
17
+ */
18
+ exceedsMaxFileSize(file: File): boolean;
19
+ /**
20
+ */
21
+ uploadFile(file: File): Promise<UploadResponse>;
22
+ #private;
23
+ }
24
+ type UploadResponse = {
25
+ token: string;
26
+ };
27
+ import { FiletypeConstraintsType } from "../models/types";
28
+ import { FilesizeConstraintsType } from "../models/types";
29
+ type ProgressHandler = (file: File, uploadInfo: Object) => void;
@@ -1,3 +1,5 @@
1
1
  export { default as Authenticate } from "./Authenticate";
2
2
  export { default as ModularUIRequest } from "./ModularUIRequest";
3
3
  export { default as ModularUIResponse } from "./ModularUIResponse";
4
+ export { default as UploadRequest } from "./UploadRequest";
5
+ export { default as CaptchaRequest } from "./CaptchaRequest";
@@ -12,6 +12,13 @@ type SetModelAction = {
12
12
  model: ModularUIModel;
13
13
  };
14
14
  };
15
+ type InitModelAction = {
16
+ type: "MODULARUI/INIT";
17
+ payload: {
18
+ key: string;
19
+ model: ModularUIModel;
20
+ }[];
21
+ };
15
22
  type UpdateModelAction = {
16
23
  type: "MODULARUI/UPDATE";
17
24
  payload: ModularUIModel;
@@ -23,12 +30,11 @@ type ModularUIAction = {
23
30
  payload: {
24
31
  href: Href;
25
32
  method?: $Keys<HTTP_METHODS>;
26
- data?: string | {
27
- [key: string]: string;
28
- };
33
+ data?: any;
29
34
  locale: string;
30
35
  childmodels?: boolean;
31
36
  targetModel?: any;
37
+ forceTargetModel?: boolean;
32
38
  successAction: (model: ModularUIModel) => SetModelAction | UpdateModelAction;
33
39
  errorAction?: ErrorAction;
34
40
  };
@@ -84,7 +84,7 @@ type UpdateAutosaveAction = {
84
84
  model: FormModel;
85
85
  };
86
86
  };
87
- type ReduxAction = UpdateLocaleAction | SetLocalesAction | SetModelAction | UpdateModelAction | UpdateStatusAction | RemoveModelByKeyAction | NoAction | ModularUIAction | ResetModularUIAction | LocationChangeAction | PushAction | ReplaceAction | GoAction | GoBackAction | GoForwardAction | SaveErrorAction | ShowModalAction | CloseModalAction | DismissNotificationAction | ShowNotificationAction | SetPreferenceAction | SetPreferencesAction | StartProgressAction | FinishProgressAction | ResetProgressAction | UpdateProgressAction | SendAuthenticationErrorAction | ResetAuthErrorsAction | LoginSuccessAction | ChangePasswordAction | LogoutSuccessAction | UpdateAutosaveAction;
87
+ type ReduxAction = UpdateLocaleAction | SetLocalesAction | SetModelAction | InitModelAction | UpdateModelAction | UpdateStatusAction | RemoveModelByKeyAction | NoAction | ModularUIAction | ResetModularUIAction | LocationChangeAction | PushAction | ReplaceAction | GoAction | GoBackAction | GoForwardAction | SaveErrorAction | ShowModalAction | CloseModalAction | DismissNotificationAction | ShowNotificationAction | SetPreferenceAction | SetPreferencesAction | StartProgressAction | FinishProgressAction | ResetProgressAction | UpdateProgressAction | SendAuthenticationErrorAction | ResetAuthErrorsAction | LoginSuccessAction | ChangePasswordAction | LogoutSuccessAction | UpdateAutosaveAction;
88
88
  type AuthState = {};
89
89
  type ErrorState = ErrorResponse;
90
90
  type ModalState = {};
@@ -1,11 +1,5 @@
1
- /**
2
- */
3
1
  export function getCookie(name: string): null | string;
4
- /**
5
- */
6
2
  export function setCookie(name: string, value: any, options?: CookieOptions): void;
7
- /**
8
- */
9
3
  export function clearCookie(name: string): void;
10
4
  type CookieOptions = {
11
5
  days?: number;
@@ -4,9 +4,7 @@ type RequestURLOptions = {
4
4
  type RequestBaseOptions = {
5
5
  method?: $Keys<HTTP_METHODS>;
6
6
  params?: string;
7
- data?: string | {
8
- [key: string]: string;
9
- };
7
+ data?: any;
10
8
  timeout?: number;
11
9
  responseType?: string;
12
10
  headers?: {
@@ -33,6 +31,7 @@ type RequestOptions = {
33
31
  type RequestModularUIOptions = {
34
32
  RequestBaseOptions: any;
35
33
  targetModel?: any;
34
+ forceTargetModel?: boolean;
36
35
  updateModel?: ModularUIModel;
37
36
  childmodels?: boolean;
38
37
  isValidationRequest?: boolean;
@@ -0,0 +1,7 @@
1
+ export * from "./createHash";
2
+ export * from "./sanitizeHtml";
3
+ export * from "./objects";
4
+ export * from "./text";
5
+ export * from "./checkResource";
6
+ export * from "./repositoryResource";
7
+ export { default as createUUID } from "./createUUID";
@@ -0,0 +1 @@
1
+ export function getRepositoryResourceUrl(resourceUrl: string): string;
@@ -2,15 +2,10 @@ export { default as Cache } from "./browser/Cache";
2
2
  export * from "./browser/Cookies";
3
3
  export * from "./datetime/DateTimeUtil";
4
4
  export * from "./fetch/types";
5
- export * from "./helpers/createHash";
6
- export * from "./helpers/sanitizeHtml";
7
- export * from "./helpers/objects";
8
- export * from "./helpers/text";
9
- export * from "./helpers/checkResource";
5
+ export * from "./helpers";
10
6
  export * from "./number/parseNumbers";
11
7
  export { default as serverFetch } from "./fetch/serverFetch";
12
8
  export { default as universalFetch } from "./fetch/universalFetch";
13
9
  export { default as xhr } from "./fetch/xhr";
14
- export { default as createUUID } from "./helpers/createUUID";
15
10
  export { default as DecimalFormat } from "./number/DecimalFormat";
16
11
  export { default as formatValue } from "./number/formatValue";