@beinformed/ui 1.26.0 → 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 (173) hide show
  1. package/CHANGELOG.md +19 -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/UploadAttributeModel.js +15 -3
  11. package/esm/models/attributes/UploadAttributeModel.js.map +1 -1
  12. package/esm/models/error/ErrorModel.js +11 -0
  13. package/esm/models/error/ErrorModel.js.map +1 -1
  14. package/esm/models/href/Href.js +4 -4
  15. package/esm/models/href/Href.js.map +1 -1
  16. package/esm/modularui/Authenticate.js +6 -6
  17. package/esm/modularui/Authenticate.js.map +1 -1
  18. package/esm/modularui/CaptchaRequest.js +46 -0
  19. package/esm/modularui/CaptchaRequest.js.map +1 -0
  20. package/esm/modularui/ModularUIRequest.js +17 -6
  21. package/esm/modularui/ModularUIRequest.js.map +1 -1
  22. package/esm/modularui/UploadRequest.js +104 -0
  23. package/esm/modularui/UploadRequest.js.map +1 -0
  24. package/esm/modularui/index.js +2 -0
  25. package/esm/modularui/index.js.map +1 -1
  26. package/esm/react-client/client.js +2 -2
  27. package/esm/react-client/client.js.map +1 -1
  28. package/esm/react-server/contextPath.js +2 -2
  29. package/esm/react-server/contextPath.js.map +1 -1
  30. package/esm/react-server/renderSSRComplete.js +5 -4
  31. package/esm/react-server/renderSSRComplete.js.map +1 -1
  32. package/esm/react-server/renderSSRMinimal.js +2 -2
  33. package/esm/react-server/renderSSRMinimal.js.map +1 -1
  34. package/esm/redux/_modularui/ModularUIMiddleware.js.map +1 -1
  35. package/esm/redux/_modularui/types.js.map +1 -1
  36. package/esm/utils/browser/Cookies.js +6 -7
  37. package/esm/utils/browser/Cookies.js.map +1 -1
  38. package/esm/utils/fetch/serverFetch.js +2 -2
  39. package/esm/utils/fetch/serverFetch.js.map +1 -1
  40. package/esm/utils/fetch/types.js.map +1 -1
  41. package/esm/utils/fetch/universalFetch.js +4 -3
  42. package/esm/utils/fetch/universalFetch.js.map +1 -1
  43. package/esm/utils/fetch/xhr.js.map +1 -1
  44. package/esm/utils/helpers/checkResource.js +0 -3
  45. package/esm/utils/helpers/checkResource.js.map +1 -1
  46. package/esm/utils/helpers/index.js +8 -0
  47. package/esm/utils/helpers/index.js.map +1 -0
  48. package/esm/utils/helpers/repositoryResource.js +18 -0
  49. package/esm/utils/helpers/repositoryResource.js.map +1 -0
  50. package/esm/utils/index.js +1 -6
  51. package/esm/utils/index.js.map +1 -1
  52. package/lib/constants/Constants.js +13 -42
  53. package/lib/constants/Constants.js.flow +9 -41
  54. package/lib/constants/Constants.js.map +1 -1
  55. package/lib/constants/Settings.js +53 -1
  56. package/lib/constants/Settings.js.flow +60 -0
  57. package/lib/constants/Settings.js.map +1 -1
  58. package/lib/hooks/useAuthentication.js +6 -5
  59. package/lib/hooks/useAuthentication.js.flow +9 -8
  60. package/lib/hooks/useAuthentication.js.map +1 -1
  61. package/lib/models/application/ApplicationModel.js +1 -1
  62. package/lib/models/application/ApplicationModel.js.flow +3 -2
  63. package/lib/models/application/ApplicationModel.js.map +1 -1
  64. package/lib/models/attributes/UploadAttributeModel.js +15 -3
  65. package/lib/models/attributes/UploadAttributeModel.js.flow +21 -0
  66. package/lib/models/attributes/UploadAttributeModel.js.map +1 -1
  67. package/lib/models/error/ErrorModel.js +11 -0
  68. package/lib/models/error/ErrorModel.js.flow +12 -1
  69. package/lib/models/error/ErrorModel.js.map +1 -1
  70. package/lib/models/href/Href.js +6 -6
  71. package/lib/models/href/Href.js.flow +4 -4
  72. package/lib/models/href/Href.js.map +1 -1
  73. package/lib/models/href/__tests__/Href.spec.js.flow +2 -3
  74. package/lib/modularui/Authenticate.js +4 -4
  75. package/lib/modularui/Authenticate.js.flow +6 -5
  76. package/lib/modularui/Authenticate.js.map +1 -1
  77. package/lib/modularui/CaptchaRequest.js +54 -0
  78. package/lib/modularui/CaptchaRequest.js.flow +45 -0
  79. package/lib/modularui/CaptchaRequest.js.map +1 -0
  80. package/lib/modularui/ModularUIRequest.js +15 -4
  81. package/lib/modularui/ModularUIRequest.js.flow +10 -10
  82. package/lib/modularui/ModularUIRequest.js.map +1 -1
  83. package/lib/modularui/UploadRequest.js +112 -0
  84. package/lib/modularui/UploadRequest.js.flow +125 -0
  85. package/lib/modularui/UploadRequest.js.map +1 -0
  86. package/lib/modularui/index.js +14 -0
  87. package/lib/modularui/index.js.flow +2 -0
  88. package/lib/modularui/index.js.map +1 -1
  89. package/lib/react-client/client.js +2 -2
  90. package/lib/react-client/client.js.flow +2 -2
  91. package/lib/react-client/client.js.map +1 -1
  92. package/lib/react-server/contextPath.js +2 -2
  93. package/lib/react-server/contextPath.js.flow +2 -2
  94. package/lib/react-server/contextPath.js.map +1 -1
  95. package/lib/react-server/renderSSRComplete.js +5 -4
  96. package/lib/react-server/renderSSRComplete.js.flow +6 -4
  97. package/lib/react-server/renderSSRComplete.js.map +1 -1
  98. package/lib/react-server/renderSSRMinimal.js +2 -2
  99. package/lib/react-server/renderSSRMinimal.js.flow +2 -2
  100. package/lib/react-server/renderSSRMinimal.js.map +1 -1
  101. package/lib/redux/_modularui/ModularUIMiddleware.js.flow +1 -1
  102. package/lib/redux/_modularui/ModularUIMiddleware.js.map +1 -1
  103. package/lib/redux/_modularui/types.js.flow +1 -1
  104. package/lib/redux/_modularui/types.js.map +1 -1
  105. package/lib/utils/browser/Cookies.js +3 -3
  106. package/lib/utils/browser/Cookies.js.flow +10 -8
  107. package/lib/utils/browser/Cookies.js.map +1 -1
  108. package/lib/utils/fetch/serverFetch.js +2 -2
  109. package/lib/utils/fetch/serverFetch.js.flow +2 -2
  110. package/lib/utils/fetch/serverFetch.js.map +1 -1
  111. package/lib/utils/fetch/types.js.flow +1 -1
  112. package/lib/utils/fetch/types.js.map +1 -1
  113. package/lib/utils/fetch/universalFetch.js +3 -2
  114. package/lib/utils/fetch/universalFetch.js.flow +5 -3
  115. package/lib/utils/fetch/universalFetch.js.map +1 -1
  116. package/lib/utils/fetch/xhr.js.flow +1 -1
  117. package/lib/utils/fetch/xhr.js.map +1 -1
  118. package/lib/utils/helpers/checkResource.js +0 -3
  119. package/lib/utils/helpers/checkResource.js.flow +0 -2
  120. package/lib/utils/helpers/checkResource.js.map +1 -1
  121. package/lib/utils/helpers/index.js +90 -0
  122. package/lib/utils/helpers/index.js.flow +8 -0
  123. package/lib/utils/helpers/index.js.map +1 -0
  124. package/lib/utils/helpers/repositoryResource.js +25 -0
  125. package/lib/utils/helpers/repositoryResource.js.flow +20 -0
  126. package/lib/utils/helpers/repositoryResource.js.map +1 -0
  127. package/lib/utils/index.js +4 -60
  128. package/lib/utils/index.js.flow +1 -6
  129. package/lib/utils/index.js.map +1 -1
  130. package/package.json +1 -1
  131. package/src/constants/Constants.js +9 -41
  132. package/src/constants/Settings.js +60 -0
  133. package/src/hooks/useAuthentication.js +9 -8
  134. package/src/models/application/ApplicationModel.js +3 -2
  135. package/src/models/attributes/UploadAttributeModel.js +21 -0
  136. package/src/models/error/ErrorModel.js +12 -1
  137. package/src/models/href/Href.js +4 -4
  138. package/src/models/href/__tests__/Href.spec.js +2 -3
  139. package/src/modularui/Authenticate.js +6 -5
  140. package/src/modularui/CaptchaRequest.js +45 -0
  141. package/src/modularui/ModularUIRequest.js +10 -10
  142. package/src/modularui/UploadRequest.js +125 -0
  143. package/src/modularui/index.js +2 -0
  144. package/src/react-client/client.js +2 -2
  145. package/src/react-server/contextPath.js +2 -2
  146. package/src/react-server/renderSSRComplete.js +6 -4
  147. package/src/react-server/renderSSRMinimal.js +2 -2
  148. package/src/redux/_modularui/ModularUIMiddleware.js +1 -1
  149. package/src/redux/_modularui/types.js +1 -1
  150. package/src/utils/browser/Cookies.js +10 -8
  151. package/src/utils/fetch/serverFetch.js +2 -2
  152. package/src/utils/fetch/types.js +1 -1
  153. package/src/utils/fetch/universalFetch.js +5 -3
  154. package/src/utils/fetch/xhr.js +1 -1
  155. package/src/utils/helpers/checkResource.js +0 -2
  156. package/src/utils/helpers/index.js +8 -0
  157. package/src/utils/helpers/repositoryResource.js +20 -0
  158. package/src/utils/index.js +1 -6
  159. package/types/constants/Constants.d.ts +8 -24
  160. package/types/constants/Settings.d.ts +12 -0
  161. package/types/models/attributes/UploadAttributeModel.d.ts +6 -0
  162. package/types/models/error/ErrorModel.d.ts +5 -0
  163. package/types/models/href/Href.d.ts +1 -1
  164. package/types/modularui/CaptchaRequest.d.ts +17 -0
  165. package/types/modularui/ModularUIRequest.d.ts +4 -6
  166. package/types/modularui/UploadRequest.d.ts +29 -0
  167. package/types/modularui/index.d.ts +2 -0
  168. package/types/redux/_modularui/types.d.ts +1 -3
  169. package/types/utils/browser/Cookies.d.ts +0 -6
  170. package/types/utils/fetch/types.d.ts +1 -3
  171. package/types/utils/helpers/index.d.ts +7 -0
  172. package/types/utils/helpers/repositoryResource.d.ts +1 -0
  173. package/types/utils/index.d.ts +1 -6
@@ -0,0 +1,104 @@
1
+ import _classPrivateFieldGet from "@babel/runtime-corejs3/helpers/esm/classPrivateFieldGet";
2
+ import _classPrivateFieldSet from "@babel/runtime-corejs3/helpers/esm/classPrivateFieldSet";
3
+ import _includesInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/includes";
4
+ import _Promise from "@babel/runtime-corejs3/core-js-stable/promise";
5
+ import _WeakMap from "@babel/runtime-corejs3/core-js-stable/weak-map";
6
+ function _classPrivateFieldInitSpec(obj, privateMap, value) { _checkPrivateRedeclaration(obj, privateMap); privateMap.set(obj, value); }
7
+ function _checkPrivateRedeclaration(obj, privateCollection) { if (privateCollection.has(obj)) { throw new TypeError("Cannot initialize the same private elements twice on an object"); } }
8
+ import { getUploadPath, HTTP_METHODS } from "../constants";
9
+ import xhr from "../utils/fetch/xhr";
10
+ import ErrorModel from "../models/error/ErrorModel";
11
+ var _uploadConstraints = /*#__PURE__*/new _WeakMap();
12
+ var _progressHandler = /*#__PURE__*/new _WeakMap();
13
+ /**
14
+ * Upload a file to the upload file service of Be Informed
15
+ */
16
+ class UploadRequest {
17
+ constructor(uploadConstraints, progressHandler) {
18
+ _classPrivateFieldInitSpec(this, _uploadConstraints, {
19
+ writable: true,
20
+ value: void 0
21
+ });
22
+ _classPrivateFieldInitSpec(this, _progressHandler, {
23
+ writable: true,
24
+ value: void 0
25
+ });
26
+ _classPrivateFieldSet(this, _uploadConstraints, uploadConstraints);
27
+ _classPrivateFieldSet(this, _progressHandler, progressHandler);
28
+ }
29
+
30
+ /**
31
+ */
32
+ getFileExtension(file) {
33
+ return file.name.split(".").pop().toLowerCase();
34
+ }
35
+
36
+ /**
37
+ */
38
+ isNotAllowedFileType(file) {
39
+ const allowedFileTypes = _classPrivateFieldGet(this, _uploadConstraints).fileTypes;
40
+ if (allowedFileTypes.length > 0) {
41
+ const fileExtension = this.getFileExtension(file);
42
+ return !allowedFileTypes.some(fileType => {
43
+ var _context;
44
+ return _includesInstanceProperty(_context = fileType.extensions).call(_context, fileExtension);
45
+ });
46
+ }
47
+ return false;
48
+ }
49
+
50
+ /**
51
+ */
52
+ exceedsMaxFileSize(file) {
53
+ const maxFileSize = _classPrivateFieldGet(this, _uploadConstraints)?.maxFileSize?.fileSize ?? -1;
54
+ return maxFileSize > -1 && file.size > maxFileSize;
55
+ }
56
+
57
+ /**
58
+ */
59
+ uploadFile(file) {
60
+ const maxFileSize = _classPrivateFieldGet(this, _uploadConstraints)?.maxFileSize?.fileSize ?? -1;
61
+ if (this.exceedsMaxFileSize(file)) {
62
+ _classPrivateFieldGet(this, _progressHandler).call(this, file, {
63
+ error: "errorExceedsMaxFileSize"
64
+ });
65
+ return _Promise.reject(new ErrorModel("Constraint.File.MaxFileSizeExceeded", "Maximum file upload size is ${max-filesize}", {
66
+ "max-filesize": maxFileSize
67
+ }, true));
68
+ }
69
+ if (this.isNotAllowedFileType(file)) {
70
+ _classPrivateFieldGet(this, _progressHandler).call(this, file, {
71
+ error: "errorExtensionNotAllowed"
72
+ });
73
+ return _Promise.reject(new ErrorModel("Constraint.File.InvalidExtension", "Allowed extensions are: ${extensions}", {
74
+ extension: this.getFileExtension(file),
75
+ extensions: _classPrivateFieldGet(this, _uploadConstraints).fileTypes.join(", ")
76
+ }, true));
77
+ }
78
+ return xhr({
79
+ url: getUploadPath(),
80
+ method: HTTP_METHODS.POST,
81
+ headers: {
82
+ "Content-Type": file.type,
83
+ "x-filename": encodeURIComponent(file.name),
84
+ "x-filesize": file.size.toString()
85
+ },
86
+ onProgress: e => {
87
+ if (_classPrivateFieldGet(this, _progressHandler) && e.lengthComputable) {
88
+ _classPrivateFieldGet(this, _progressHandler).call(this, file, {
89
+ progress: Math.ceil(e.loaded / e.total * 100)
90
+ });
91
+ }
92
+ },
93
+ data: file
94
+ }).then(response => {
95
+ _classPrivateFieldGet(this, _progressHandler).call(this, file, {
96
+ progress: 100,
97
+ token: response.token
98
+ });
99
+ return response;
100
+ });
101
+ }
102
+ }
103
+ export default UploadRequest;
104
+ //# sourceMappingURL=UploadRequest.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"UploadRequest.js","names":["getUploadPath","HTTP_METHODS","xhr","ErrorModel","UploadRequest","constructor","uploadConstraints","progressHandler","getFileExtension","file","name","split","pop","toLowerCase","isNotAllowedFileType","allowedFileTypes","fileTypes","length","fileExtension","some","fileType","extensions","exceedsMaxFileSize","maxFileSize","fileSize","size","uploadFile","error","reject","extension","join","url","method","POST","headers","type","encodeURIComponent","toString","onProgress","e","lengthComputable","progress","Math","ceil","loaded","total","data","then","response","token"],"sources":["../../src/modularui/UploadRequest.js"],"sourcesContent":["// @flow\nimport { getUploadPath, HTTP_METHODS } from \"../constants\";\n\nimport xhr from \"../utils/fetch/xhr\";\n\nimport type {\n FilesizeConstraintsType,\n FiletypeConstraintsType,\n} from \"../models\";\nimport ErrorModel from \"../models/error/ErrorModel\";\n\ntype ProgressHandler = (file: File, uploadInfo: Object) => void;\n\ntype UploadResponse = {\n token: string,\n};\n\n/**\n * Upload a file to the upload file service of Be Informed\n */\nclass UploadRequest {\n #uploadConstraints: {\n fileTypes: FiletypeConstraintsType,\n maxFileSize: FilesizeConstraintsType,\n };\n #progressHandler: ProgressHandler;\n\n constructor(\n uploadConstraints: {\n fileTypes: FiletypeConstraintsType,\n maxFileSize: FilesizeConstraintsType,\n },\n progressHandler: ProgressHandler\n ) {\n this.#uploadConstraints = uploadConstraints;\n this.#progressHandler = progressHandler;\n }\n\n /**\n */\n getFileExtension(file: File): string {\n return file.name.split(\".\").pop().toLowerCase();\n }\n\n /**\n */\n isNotAllowedFileType(file: File): boolean {\n const allowedFileTypes = this.#uploadConstraints.fileTypes;\n\n if (allowedFileTypes.length > 0) {\n const fileExtension = this.getFileExtension(file);\n\n return !allowedFileTypes.some((fileType) =>\n fileType.extensions.includes(fileExtension)\n );\n }\n\n return false;\n }\n\n /**\n */\n exceedsMaxFileSize(file: File): boolean {\n const maxFileSize = this.#uploadConstraints?.maxFileSize?.fileSize ?? -1;\n return maxFileSize > -1 && file.size > maxFileSize;\n }\n\n /**\n */\n uploadFile(file: File): Promise<UploadResponse> {\n const maxFileSize = this.#uploadConstraints?.maxFileSize?.fileSize ?? -1;\n\n if (this.exceedsMaxFileSize(file)) {\n this.#progressHandler(file, { error: \"errorExceedsMaxFileSize\" });\n return Promise.reject(\n new ErrorModel(\n \"Constraint.File.MaxFileSizeExceeded\",\n \"Maximum file upload size is ${max-filesize}\",\n {\n \"max-filesize\": maxFileSize,\n },\n true\n )\n );\n }\n\n if (this.isNotAllowedFileType(file)) {\n this.#progressHandler(file, { error: \"errorExtensionNotAllowed\" });\n return Promise.reject(\n new ErrorModel(\n \"Constraint.File.InvalidExtension\",\n \"Allowed extensions are: ${extensions}\",\n {\n extension: this.getFileExtension(file),\n extensions: this.#uploadConstraints.fileTypes.join(\", \"),\n },\n true\n )\n );\n }\n\n return xhr({\n url: getUploadPath(),\n method: HTTP_METHODS.POST,\n headers: {\n \"Content-Type\": file.type,\n \"x-filename\": encodeURIComponent(file.name),\n \"x-filesize\": file.size.toString(),\n },\n onProgress: (e: ProgressEvent) => {\n if (this.#progressHandler && e.lengthComputable) {\n this.#progressHandler(file, {\n progress: Math.ceil((e.loaded / e.total) * 100),\n });\n }\n },\n data: file,\n }).then((response) => {\n this.#progressHandler(file, { progress: 100, token: response.token });\n return response;\n });\n }\n}\n\nexport default UploadRequest;\n"],"mappings":";;;;;;;AACA,SAASA,aAAa,EAAEC,YAAY,QAAQ,cAAc;AAE1D,OAAOC,GAAG,MAAM,oBAAoB;AAMpC,OAAOC,UAAU,MAAM,4BAA4B;AAAC;AAAA;AAQpD;AACA;AACA;AACA,MAAMC,aAAa,CAAC;EAOlBC,WAAW,CACTC,iBAGC,EACDC,eAAgC,EAChC;IAAA;MAAA;MAAA;IAAA;IAAA;MAAA;MAAA;IAAA;IACA,0BAAI,sBAAsBD,iBAAiB;IAC3C,0BAAI,oBAAoBC,eAAe;EACzC;;EAEA;AACF;EACEC,gBAAgB,CAACC,IAAU,EAAU;IACnC,OAAOA,IAAI,CAACC,IAAI,CAACC,KAAK,CAAC,GAAG,CAAC,CAACC,GAAG,EAAE,CAACC,WAAW,EAAE;EACjD;;EAEA;AACF;EACEC,oBAAoB,CAACL,IAAU,EAAW;IACxC,MAAMM,gBAAgB,GAAG,0BAAI,sBAAoBC,SAAS;IAE1D,IAAID,gBAAgB,CAACE,MAAM,GAAG,CAAC,EAAE;MAC/B,MAAMC,aAAa,GAAG,IAAI,CAACV,gBAAgB,CAACC,IAAI,CAAC;MAEjD,OAAO,CAACM,gBAAgB,CAACI,IAAI,CAAEC,QAAQ;QAAA;QAAA,OACrC,qCAAAA,QAAQ,CAACC,UAAU,iBAAUH,aAAa,CAAC;MAAA,EAC5C;IACH;I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C;QAC3C,YAAY,EAAED,IAAI,CAACgB,IAAI,CAACY,QAAQ;MAClC,CAAC;MACDC,UAAU,EAAGC,CAAgB,IAAK;QAChC,IAAI,0BAAI,uBAAqBA,CAAC,CAACC,gBAAgB,EAAE;UAC/C,0BAAI,yBAAJ,IAAI,EAAkB/B,IAAI,EAAE;YAC1BgC,QAAQ,EAAEC,IAAI,CAACC,IAAI,CAAEJ,CAAC,CAACK,MAAM,GAAGL,CAAC,CAACM,KAAK,GAAI,GAAG;UAChD,CAAC;QACH;MACF,CAAC;MACDC,IAAI,EAAErC;IACR,CAAC,CAAC,CAACsC,IAAI,CAAEC,QAAQ,IAAK;MACpB,0BAAI,yBAAJ,IAAI,EAAkBvC,IAAI,EAAE;QAAEgC,QAAQ,EAAE,GAAG;QAAEQ,KAAK,EAAED,QAAQ,CAACC;MAAM,CAAC;MACpE,OAAOD,QAAQ;IACjB,CAAC,CAAC;EACJ;AACF;AAEA,eAAe5C,aAAa"}
@@ -1,4 +1,6 @@
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";
4
6
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["default","Authenticate","ModularUIRequest","ModularUIResponse"],"sources":["../../src/modularui/index.js"],"sourcesContent":["// @flow\nexport { default as Authenticate } from \"./Authenticate\";\nexport { default as ModularUIRequest } from \"./ModularUIRequest\";\nexport { default as ModularUIResponse } from \"./ModularUIResponse\";\n"],"mappings":"AACA,SAASA,OAAO,IAAIC,YAAY,QAAQ,gBAAgB;AACxD,SAASD,OAAO,IAAIE,gBAAgB,QAAQ,oBAAoB;AAChE,SAASF,OAAO,IAAIG,iBAAiB,QAAQ,qBAAqB"}
1
+ {"version":3,"file":"index.js","names":["default","Authenticate","ModularUIRequest","ModularUIResponse","UploadRequest","CaptchaRequest"],"sources":["../../src/modularui/index.js"],"sourcesContent":["// @flow\nexport { default as Authenticate } from \"./Authenticate\";\nexport { default as ModularUIRequest } from \"./ModularUIRequest\";\nexport { default as ModularUIResponse } from \"./ModularUIResponse\";\nexport { default as UploadRequest } from \"./UploadRequest\";\nexport { default as CaptchaRequest } from \"./CaptchaRequest\";\n"],"mappings":"AACA,SAASA,OAAO,IAAIC,YAAY,QAAQ,gBAAgB;AACxD,SAASD,OAAO,IAAIE,gBAAgB,QAAQ,oBAAoB;AAChE,SAASF,OAAO,IAAIG,iBAAiB,QAAQ,qBAAqB;AAClE,SAASH,OAAO,IAAII,aAAa,QAAQ,iBAAiB;AAC1D,SAASJ,OAAO,IAAIK,cAAc,QAAQ,kBAAkB"}
@@ -12,7 +12,7 @@ import Cache from "../utils/browser/Cache";
12
12
  import { createBrowserHistory } from "history";
13
13
  import configureStore from "../redux/store/configureStore";
14
14
  import rehydrate from "./rehydrate";
15
- import { BASE } from "../constants/Constants";
15
+ import { getBasePath } from "../constants/Settings";
16
16
  import { setAllContentInDataSetting, setLoginPreferences } from "../redux/actions/Preferences";
17
17
  import { showXHRErrorNotification } from "../redux/actions/Notification";
18
18
  import { handleError } from "../redux/actions/Error";
@@ -56,7 +56,7 @@ const client = props => {
56
56
 
57
57
  // $FlowExpectedError
58
58
  const browserHistory = createBrowserHistory({
59
- basename: BASE
59
+ basename: getBasePath()
60
60
  });
61
61
  const {
62
62
  history,
@@ -1 +1 @@
1
- {"version":3,"file":"client.js","names":["elementClosest","window","hydrate","render","reactRender","has","setImmediate","Cache","createBrowserHistory","configureStore","rehydrate","BASE","setAllContentInDataSetting","setLoginPreferences","showXHRErrorNotification","handleError","loginSuccess","locationChange","JsonParseException","FetchException","Init","handleBeforeRenderHooks","parseDataToJSON","data","JSON","parse","error","client","props","contextPath","Error","dataElement","document","querySelector","textContent","clear","browserHistory","basename","history","store","customReducers","getState","loadOtherBrowserTabs","getItem","dispatch","response","listen","location","action","onunhandledrejection","event","detail","errorMessage","reason","message","toString","body","className","beforeRenderHooks","addContentLoadedEvent","theme","ErrorFallbackComponent","addEventListener","applicationNode","isSSR","mount"],"sources":["../../src/react-client/client.js"],"sourcesContent":["// @flow\n/* polyfills needed for ie11 */\nimport elementClosest from \"element-closest\";\nelementClosest(window);\n\n/* polyfill for focus-visible */\nimport \"focus-visible\";\n\nimport { hydrate, render as reactRender } from \"react-dom\";\n\nimport { has } from \"../utils/helpers/objects\";\nimport setImmediate from \"setimmediate\";\n\nimport Cache from \"../utils/browser/Cache\";\n\nimport { createBrowserHistory } from \"history\";\nimport configureStore from \"../redux/store/configureStore\";\n\nimport rehydrate from \"./rehydrate\";\nimport { BASE } from \"../constants/Constants\";\n\nimport {\n setAllContentInDataSetting,\n setLoginPreferences,\n} from \"../redux/actions/Preferences\";\nimport { showXHRErrorNotification } from \"../redux/actions/Notification\";\n\nimport { handleError } from \"../redux/actions/Error\";\nimport { loginSuccess } from \"../redux/actions/SignIn\";\n\nimport { locationChange } from \"../redux/_router/RouterActions\";\n\nimport { JsonParseException, FetchException } from \"../exceptions\";\n\nimport Init from \"./Init\";\n\nimport { handleBeforeRenderHooks } from \"../redux/store/beforeRenderHooks\";\n\nimport type { ComponentType } from \"react\";\nimport type { Theme } from \"../react-theme/types\";\nimport type { CustomReducers, ReduxStore } from \"../redux/types\";\nimport type { RouterHistory } from \"react-router\";\nimport type { BeforeRenderHook } from \"../redux/store/beforeRenderHooks\";\nimport type { Props as FallbackProps } from \"../react/ErrorBoundaryFallback\";\nexport type Props = {\n customReducers?: CustomReducers,\n theme?: Theme | Array<Theme>,\n render: Function,\n beforeRenderHooks?: Array<BeforeRenderHook>,\n ErrorFallbackComponent?: ComponentType<FallbackProps>,\n};\n\n/*\n * deserialize serialized data from the server to provide a smooth dehydration.\n */\n/**\n */\nconst parseDataToJSON = (data: string) => {\n try {\n return JSON.parse(data);\n } catch (error) {\n throw new JsonParseException(`Error parsing content ${data}`);\n }\n};\n\n/**\n * Mount the webapplication to the DOM, used client side when JavaScript is enabled.\n */\nconst client = (props: Props) => {\n if (typeof window.contextPath === \"undefined\") {\n throw new Error(\"Missing contextPath on window object\");\n }\n\n const dataElement = document.querySelector(\n 'script[type=\"application/json\"][data-app-state=\"app-json\"]'\n );\n if (!dataElement) {\n throw new Error(\"Error loading state, json not found\");\n } else if (dataElement.textContent.trim() === \"\") {\n return;\n }\n\n const data = parseDataToJSON(dataElement.textContent);\n\n // remove all resources from cache\n Cache.clear(\"^res:\");\n\n // $FlowExpectedError\n const browserHistory: RouterHistory = createBrowserHistory({\n basename: BASE,\n });\n const { history, store } = configureStore(\n browserHistory,\n props.customReducers ?? {},\n rehydrate(data)\n );\n\n setAllContentInDataSetting(store.getState());\n setLoginPreferences(store.getState());\n\n // load existing cache from other browser tabs\n Cache.loadOtherBrowserTabs(() => {\n if (Cache.getItem(\"auth\")) {\n store.dispatch(loginSuccess());\n }\n });\n\n if (has(data, \"error.name\")) {\n const error = new FetchException(data.error.response);\n store.dispatch(handleError(error));\n }\n\n if (Cache.getItem(\"auth\")) {\n store.dispatch(loginSuccess());\n }\n\n // listen to history change and update the redux router store\n history.listen((location, action) => {\n store.dispatch(locationChange(location, action));\n });\n\n /**\n */\n window.onunhandledrejection = (event) => {\n if (event.detail) {\n return setImmediate(() => {\n const errorMessage = event.detail.reason.message.toString();\n\n store.dispatch(showXHRErrorNotification(errorMessage));\n throw event.detail.reason;\n });\n }\n\n return event;\n };\n\n if (document.body) {\n document.body.className = \"js\";\n }\n\n if (props.beforeRenderHooks) {\n handleBeforeRenderHooks(props.beforeRenderHooks, { store });\n }\n\n addContentLoadedEvent(\n store,\n history,\n props.theme,\n props.render,\n props.ErrorFallbackComponent\n );\n};\n\n/**\n */\nconst addContentLoadedEvent = (\n store: ReduxStore,\n history: RouterHistory,\n theme?: Theme | Array<Theme>,\n render: Function,\n ErrorFallbackComponent?: ComponentType<FallbackProps>\n) => {\n window.addEventListener(\"DOMContentLoaded\", () => {\n const applicationNode = document.querySelector(\"#application\");\n if (applicationNode) {\n const isSSR = applicationNode.querySelector(\".application\");\n const mount = isSSR ? hydrate : reactRender;\n mount(\n <Init\n store={store}\n history={history}\n contextPath={window.contextPath}\n theme={theme}\n ErrorFallbackComponent={ErrorFallbackComponent}\n >\n {render()}\n </Init>,\n applicationNode\n );\n } else {\n throw new Error(\n \"No DOM element with id application found to attach client to\"\n );\n }\n });\n};\n\nexport default client;\n"],"mappings":";AACA;AACA,OAAOA,cAAc,MAAM,iBAAiB;AAC5CA,cAAc,CAACC,MAAM,CAAC;;AAEtB;AACA,OAAO,eAAe;AAEtB,SAASC,OAAO,EAAEC,MAAM,IAAIC,WAAW,QAAQ,WAAW;AAE1D,SAASC,GAAG,QAAQ,0BAA0B;AAC9C,OAAOC,YAAY,MAAM,cAAc;AAEvC,OAAOC,KAAK,MAAM,wBAAwB;AAE1C,SAASC,oBAAoB,QAAQ,SAAS;AAC9C,OAAOC,cAAc,MAAM,+BAA+B;AAE1D,OAAOC,SAAS,MAAM,aAAa;AACnC,SAASC,IAAI,QAAQ,wBAAwB;AAE7C,SACEC,0BAA0B,EAC1BC,mBAAmB,QACd,8BAA8B;AACrC,SAASC,wBAAwB,QAAQ,+BAA+B;AAExE,SAASC,WAAW,QAAQ,wBAAwB;AACpD,SAASC,YAAY,QAAQ,yBAAyB;AAEtD,SAASC,cAAc,QAAQ,gCAAgC;AAE/D,SAASC,kBAAkB,EAAEC,cAAc,QAAQ,eAAe;AAElE,OAAOC,IAAI,MAAM,QAAQ;AAEzB,SAASC,uBAAuB,QAAQ,kCAAkC;AAAC;AAgB3E;AACA;AACA;AACA;AACA;AACA,MAAMC,eAAe,GAAIC,IAAY,IAAK;EACxC,IAAI;IACF,OAAOC,IAAI,CAACC,KAAK,CAACF,IAAI,CAAC;EACzB,CAAC,CAAC,OAAOG,KAAK,EAAE;IACd,MAAM,IAAIR,kBAAkB,CAAE,yBAAwBK,IAAK,EAAC,CAAC;EAC/D;AACF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AAC6D,gBAAgB,CAAC,kBAAkB,EAAE,MAAM;IAChD,MAAMC,eAAe,GAAG/B,QAAQ,CAACC,aAAa,CAAC,cAAc,CAAC;IAC9D,IAAI8B,eAAe,EAAE;MACnB,MAAMC,KAAK,GAAGD,eAAe,CAAC9B,aAAa,CAAC,cAAc,CAAC;MAC3D,MAAMgC,KAAK,GAAGD,KAAK,GAAG9D,OAAO,GAAGE,WAAW;MAC3C6D,KAAK,eACH,KAAC,IAAI;QACH,KAAK,EAAE1B,KAAM;QACb,OAAO,EAAED,OAAQ;QACjB,WAAW,EAAErC,MAAM,CAAC4B,WAAY;QAChC,KAAK,EAAE+B,KAAM;QACb,sBAAsB,EAAEC,sBAAuB;QAAA,UAE9C1D,MAAM;MAAE,EACJ,EACP4D,eAAe,CAChB;IACH,CAAC,MAAM;MACL,MAAM,IAAIjC,KAAK,CACb,8DAA8D,CAC/D;IACH;EACF,CAAC,CAAC;AACJ,CAAC;AAED,eAAeH,MAAM"}
1
+ {"version":3,"file":"client.js","names":["elementClosest","window","hydrate","render","reactRender","has","setImmediate","Cache","createBrowserHistory","configureStore","rehydrate","getBasePath","setAllContentInDataSetting","setLoginPreferences","showXHRErrorNotification","handleError","loginSuccess","locationChange","JsonParseException","FetchException","Init","handleBeforeRenderHooks","parseDataToJSON","data","JSON","parse","error","client","props","contextPath","Error","dataElement","document","querySelector","textContent","clear","browserHistory","basename","history","store","customReducers","getState","loadOtherBrowserTabs","getItem","dispatch","response","listen","location","action","onunhandledrejection","event","detail","errorMessage","reason","message","toString","body","className","beforeRenderHooks","addContentLoadedEvent","theme","ErrorFallbackComponent","addEventListener","applicationNode","isSSR","mount"],"sources":["../../src/react-client/client.js"],"sourcesContent":["// @flow\n/* polyfills needed for ie11 */\nimport elementClosest from \"element-closest\";\nelementClosest(window);\n\n/* polyfill for focus-visible */\nimport \"focus-visible\";\n\nimport { hydrate, render as reactRender } from \"react-dom\";\n\nimport { has } from \"../utils/helpers/objects\";\nimport setImmediate from \"setimmediate\";\n\nimport Cache from \"../utils/browser/Cache\";\n\nimport { createBrowserHistory } from \"history\";\nimport configureStore from \"../redux/store/configureStore\";\n\nimport rehydrate from \"./rehydrate\";\nimport { getBasePath } from \"../constants/Settings\";\n\nimport {\n setAllContentInDataSetting,\n setLoginPreferences,\n} from \"../redux/actions/Preferences\";\nimport { showXHRErrorNotification } from \"../redux/actions/Notification\";\n\nimport { handleError } from \"../redux/actions/Error\";\nimport { loginSuccess } from \"../redux/actions/SignIn\";\n\nimport { locationChange } from \"../redux/_router/RouterActions\";\n\nimport { JsonParseException, FetchException } from \"../exceptions\";\n\nimport Init from \"./Init\";\n\nimport { handleBeforeRenderHooks } from \"../redux/store/beforeRenderHooks\";\n\nimport type { ComponentType } from \"react\";\nimport type { Theme } from \"../react-theme/types\";\nimport type { CustomReducers, ReduxStore } from \"../redux/types\";\nimport type { RouterHistory } from \"react-router\";\nimport type { BeforeRenderHook } from \"../redux/store/beforeRenderHooks\";\nimport type { Props as FallbackProps } from \"../react/ErrorBoundaryFallback\";\nexport type Props = {\n customReducers?: CustomReducers,\n theme?: Theme | Array<Theme>,\n render: Function,\n beforeRenderHooks?: Array<BeforeRenderHook>,\n ErrorFallbackComponent?: ComponentType<FallbackProps>,\n};\n\n/*\n * deserialize serialized data from the server to provide a smooth dehydration.\n */\n/**\n */\nconst parseDataToJSON = (data: string) => {\n try {\n return JSON.parse(data);\n } catch (error) {\n throw new JsonParseException(`Error parsing content ${data}`);\n }\n};\n\n/**\n * Mount the webapplication to the DOM, used client side when JavaScript is enabled.\n */\nconst client = (props: Props) => {\n if (typeof window.contextPath === \"undefined\") {\n throw new Error(\"Missing contextPath on window object\");\n }\n\n const dataElement = document.querySelector(\n 'script[type=\"application/json\"][data-app-state=\"app-json\"]'\n );\n if (!dataElement) {\n throw new Error(\"Error loading state, json not found\");\n } else if (dataElement.textContent.trim() === \"\") {\n return;\n }\n\n const data = parseDataToJSON(dataElement.textContent);\n\n // remove all resources from cache\n Cache.clear(\"^res:\");\n\n // $FlowExpectedError\n const browserHistory: RouterHistory = createBrowserHistory({\n basename: getBasePath(),\n });\n const { history, store } = configureStore(\n browserHistory,\n props.customReducers ?? {},\n rehydrate(data)\n );\n\n setAllContentInDataSetting(store.getState());\n setLoginPreferences(store.getState());\n\n // load existing cache from other browser tabs\n Cache.loadOtherBrowserTabs(() => {\n if (Cache.getItem(\"auth\")) {\n store.dispatch(loginSuccess());\n }\n });\n\n if (has(data, \"error.name\")) {\n const error = new FetchException(data.error.response);\n store.dispatch(handleError(error));\n }\n\n if (Cache.getItem(\"auth\")) {\n store.dispatch(loginSuccess());\n }\n\n // listen to history change and update the redux router store\n history.listen((location, action) => {\n store.dispatch(locationChange(location, action));\n });\n\n /**\n */\n window.onunhandledrejection = (event) => {\n if (event.detail) {\n return setImmediate(() => {\n const errorMessage = event.detail.reason.message.toString();\n\n store.dispatch(showXHRErrorNotification(errorMessage));\n throw event.detail.reason;\n });\n }\n\n return event;\n };\n\n if (document.body) {\n document.body.className = \"js\";\n }\n\n if (props.beforeRenderHooks) {\n handleBeforeRenderHooks(props.beforeRenderHooks, { store });\n }\n\n addContentLoadedEvent(\n store,\n history,\n props.theme,\n props.render,\n props.ErrorFallbackComponent\n );\n};\n\n/**\n */\nconst addContentLoadedEvent = (\n store: ReduxStore,\n history: RouterHistory,\n theme?: Theme | Array<Theme>,\n render: Function,\n ErrorFallbackComponent?: ComponentType<FallbackProps>\n) => {\n window.addEventListener(\"DOMContentLoaded\", () => {\n const applicationNode = document.querySelector(\"#application\");\n if (applicationNode) {\n const isSSR = applicationNode.querySelector(\".application\");\n const mount = isSSR ? hydrate : reactRender;\n mount(\n <Init\n store={store}\n history={history}\n contextPath={window.contextPath}\n theme={theme}\n ErrorFallbackComponent={ErrorFallbackComponent}\n >\n {render()}\n </Init>,\n applicationNode\n );\n } else {\n throw new Error(\n \"No DOM element with id application found to attach client to\"\n );\n }\n });\n};\n\nexport default client;\n"],"mappings":";AACA;AACA,OAAOA,cAAc,MA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B,KAAM;QACb,OAAO,EAAED,OAAQ;QACjB,WAAW,EAAErC,MAAM,CAAC4B,WAAY;QAChC,KAAK,EAAE+B,KAAM;QACb,sBAAsB,EAAEC,sBAAuB;QAAA,UAE9C1D,MAAM;MAAE,EACJ,EACP4D,eAAe,CAChB;IACH,CAAC,MAAM;MACL,MAAM,IAAIjC,KAAK,CACb,8DAA8D,CAC/D;IACH;EACF,CAAC,CAAC;AACJ,CAAC;AAED,eAAeH,MAAM"}
@@ -1,6 +1,6 @@
1
- import { BASE } from "../constants/Constants";
1
+ import { getBasePath } from "../constants/Settings";
2
2
  (function x() {
3
- __webpack_public_path__ = `${BASE}/`; // NOSONAR
3
+ __webpack_public_path__ = `${getBasePath()}/`; // NOSONAR
4
4
  })();
5
5
 
6
6
  export {};
@@ -1 +1 @@
1
- {"version":3,"file":"contextPath.js","names":["BASE","x","__webpack_public_path__"],"sources":["../../src/react-server/contextPath.js"],"sourcesContent":["// @flow\nimport { BASE } from \"../constants/Constants\";\n\n(function x() {\n __webpack_public_path__ = `${BASE}/`; // NOSONAR\n})();\n\nexport {};\n"],"mappings":"AACA,SAASA,IAAI,QAAQ,wBAAwB;AAE7C,CAAC,SAASC,CAAC,GAAG;EACZC,uBAAuB,GAAI,GAAEF,IAAK,GAAE,CAAC,CAAC;AACxC,CAAC,GAAG;;AAEJ"}
1
+ {"version":3,"file":"contextPath.js","names":["getBasePath","x","__webpack_public_path__"],"sources":["../../src/react-server/contextPath.js"],"sourcesContent":["// @flow\nimport { getBasePath } from \"../constants/Settings\";\n\n(function x() {\n __webpack_public_path__ = `${getBasePath()}/`; // NOSONAR\n})();\n\nexport {};\n"],"mappings":"AACA,SAASA,WAAW,QAAQ,uBAAuB;AAEnD,CAAC,SAASC,CAAC,GAAG;EACZC,uBAAuB,GAAI,GAAEF,WAAW,EAAG,GAAE,CAAC,CAAC;AACjD,CAAC,GAAG;;AAEJ"}
@@ -5,7 +5,7 @@ import { HelmetProvider } from "react-helmet-async";
5
5
  import { ServerStyleSheet, StyleSheetManager } from "styled-components";
6
6
  import createSSRComplete from "./createSSRComplete";
7
7
  import htmlpage from "./htmlpage";
8
- import { BASE } from "../constants/Constants";
8
+ import { getBasePath } from "../constants/Settings";
9
9
  import ThemeProvider from "../react-theme/ThemeProvider";
10
10
  import ErrorBoundary from "../react/ErrorBoundary";
11
11
  import { createHead, handleErrors, dehydrate } from "./serverUtil";
@@ -31,6 +31,7 @@ const renderSSRComplete = _ref => {
31
31
  // $FlowFixMe[incompatible-type]
32
32
  // $FlowFixMe[prop-missing]
33
33
  const location = requestHref.toLocation();
34
+ const basePath = getBasePath();
34
35
  return createSSRComplete(store, () => renderToString( /*#__PURE__*/_jsx(Provider, {
35
36
  store: store,
36
37
  children: /*#__PURE__*/_jsx(StyleSheetManager, {
@@ -41,7 +42,7 @@ const renderSSRComplete = _ref => {
41
42
  context: helmetContext,
42
43
  children: /*#__PURE__*/_jsx(ErrorBoundary, {
43
44
  children: /*#__PURE__*/_jsx(Router, {
44
- basename: BASE,
45
+ basename: basePath,
45
46
  location: location,
46
47
  context: routerContext,
47
48
  children: render()
@@ -54,14 +55,14 @@ const renderSSRComplete = _ref => {
54
55
  handleErrors(store);
55
56
  const head = createHead(sheet, UUID, helmetContext);
56
57
  return template({
57
- contextPath: BASE,
58
+ contextPath: basePath,
58
59
  html: appHTML,
59
60
  head,
60
61
  state: dehydrate(store),
61
62
  UUID
62
63
  });
63
64
  }).catch(error => template({
64
- contextPath: BASE,
65
+ contextPath: basePath,
65
66
  html: renderToString( /*#__PURE__*/_jsx(StyleSheetManager, {
66
67
  sheet: sheet.instance,
67
68
  children: /*#__PURE__*/_jsx(ThemeProvider, {
@@ -1 +1 @@
1
- {"version":3,"file":"renderSSRComplete.js","names":["renderToString","Provider","StaticRouter","Router","HelmetProvider","ServerStyleSheet","StyleSheetManager","createSSRComplete","htmlpage","BASE","ThemeProvider","ErrorBoundary","createHead","handleErrors","dehydrate","renderSSRComplete","store","theme","UUID","requestHref","render","ErrorPage","template","helmetContext","helmet","routerContext","sheet","location","toLocation","instance","then","appHTML","head","contextPath","html","state","catch","error","message","fileName","lineNumber","stack"],"sources":["../../src/react-server/renderSSRComplete.js"],"sourcesContent":["// @flow\nimport { renderToString } from \"react-dom/server\";\nimport { Provider } from \"react-redux\";\nimport { StaticRouter as Router } from \"react-router\";\n\nimport { HelmetProvider } from \"react-helmet-async\";\n\nimport { ServerStyleSheet, StyleSheetManager } from \"styled-components\";\n\nimport createSSRComplete from \"./createSSRComplete\";\nimport htmlpage from \"./htmlpage\";\n\nimport { BASE } from \"../constants/Constants\";\n\nimport ThemeProvider from \"../react-theme/ThemeProvider\";\nimport ErrorBoundary from \"../react/ErrorBoundary\";\n\nimport { createHead, handleErrors, dehydrate } from \"./serverUtil\";\n\nimport type { Theme } from \"../react-theme/types\";\nimport type { ReduxStore } from \"../redux/types\";\nimport type Href from \"../models/href/Href\";\nimport type { TemplateProps } from \"./htmlpage\";\nimport type { Location } from \"react-router\";\n\ntype Props = {\n store: ReduxStore,\n theme: Theme,\n UUID: string,\n requestHref: Href,\n render: Function,\n ErrorPage: any,\n template?: (TemplateProps) => string,\n};\n/**\n */\nconst renderSSRComplete = ({\n store,\n theme,\n UUID = \"\",\n requestHref,\n render,\n ErrorPage,\n template = htmlpage,\n}: Props): Promise<string> => {\n const helmetContext = { helmet: {} };\n const routerContext = {};\n\n const sheet = new ServerStyleSheet();\n\n // $FlowFixMe[incompatible-type]\n // $FlowFixMe[prop-missing]\n const location: Location = requestHref.toLocation();\n\n return createSSRComplete(store, () =>\n renderToString(\n <Provider store={store}>\n <StyleSheetManager sheet={sheet.instance}>\n <ThemeProvider theme={theme}>\n <HelmetProvider context={helmetContext}>\n <ErrorBoundary>\n <Router\n basename={BASE}\n location={location}\n context={routerContext}\n >\n {render()}\n </Router>\n </ErrorBoundary>\n </HelmetProvider>\n </ThemeProvider>\n </StyleSheetManager>\n </Provider>\n )\n )\n .then((appHTML) => {\n handleErrors(store);\n const head = createHead(sheet, UUID, helmetContext);\n return template({\n contextPath: BASE,\n html: appHTML,\n head,\n state: dehydrate(store),\n UUID,\n });\n })\n .catch((error) =>\n template({\n contextPath: BASE,\n html: renderToString(\n <StyleSheetManager sheet={sheet.instance}>\n <ThemeProvider theme={theme}>\n <ErrorPage\n errorMessage={error.message}\n errorResource={error.fileName}\n errorLine={error.lineNumber}\n errorStack={error.stack}\n />\n </ThemeProvider>\n </StyleSheetManager>\n ),\n head: helmetContext.helmet,\n state: \"\",\n UUID,\n })\n );\n};\n\nexport default renderSSRComplete;\n"],"mappings":"AACA,SAASA,cAAc,QAAQ,kBAAkB;AACjD,SAASC,QAAQ,QAAQ,aAAa;AACtC,SAASC,YAAY,IAAIC,MAAM,QAAQ,cAAc;AAErD,SAASC,cAAc,QAAQ,oBAAoB;AAEnD,SAASC,gBAAgB,EAAEC,iBAAiB,QAAQ,mBAAmB;AAEvE,OAAOC,iBAAiB,MAAM,qBAAqB;AACnD,OAAOC,QAAQ,MAAM,YAAY;AAEjC,SAASC,IAAI,QAAQ,wBAAwB;AAE7C,OAAOC,aAAa,MAAM,8BAA8B;AACxD,OAAOC,aAAa,MAAM,wBAAwB;AAElD,SAASC,UAAU,EAAEC,YAAY,EAAEC,SAAS,QAAQ,cAAc;AAAC;AAiBnE;AACA;AACA,MAAMC,iBAAiB,GAAG,QAQI;EAAA,IARH;IACzBC,KAAK;IACLC,KAAK;IACLC,IAAI,GAAG,EAAE;IACTC,WAAW;IACXC,MAAM;IACNC,SAAS;IACTC,QAAQ,GAAGd;EACN,CAAC;EACN,MAAMe,aAAa,GAAG;IAAEC,MAAM,EAAE,CAAC;EAAE,CAAC;EACpC,MAAMC,aAAa,GAAG,CAAC,CAAC;EAExB,MAAMC,KAAK,GAAG,IAAIrB,gBAAgB,EAAE;;EAEpC;EACA;EACA,MAAMsB,QAAkB,GAAGR,WAAW,CAACS,UAAU,EAAE;EAEnD,OAAOrB,iBAAiB,CAACS,KAAK,EAAE,MAC9BhB,cAAc,eACZ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;AAED,eAAeH,iBAAiB"}
1
+ {"version":3,"file":"renderSSRComplete.js","names":["renderToString","Provider","StaticRouter","Router","HelmetProvider","ServerStyleSheet","StyleSheetManager","createSSRComplete","htmlpage","getBasePath","ThemeProvider","ErrorBoundary","createHead","handleErrors","dehydrate","renderSSRComplete","store","theme","UUID","requestHref","render","ErrorPage","template","helmetContext","helmet","routerContext","sheet","location","toLocation","basePath","instance","then","appHTML","head","contextPath","html","state","catch","error","message","fileName","lineNumber","stack"],"sources":["../../src/react-server/renderSSRComplete.js"],"sourcesContent":["// @flow\nimport { renderToString } from \"react-dom/server\";\nimport { Provider } from \"react-redux\";\nimport { StaticRouter as Router } from \"react-router\";\n\nimport { HelmetProvider } from \"react-helmet-async\";\n\nimport { ServerStyleSheet, StyleSheetManager } from \"styled-components\";\n\nimport createSSRComplete from \"./createSSRComplete\";\nimport htmlpage from \"./htmlpage\";\n\nimport { getBasePath } from \"../constants/Settings\";\n\nimport ThemeProvider from \"../react-theme/ThemeProvider\";\nimport ErrorBoundary from \"../react/ErrorBoundary\";\n\nimport { createHead, handleErrors, dehydrate } from \"./serverUtil\";\n\nimport type { Theme } from \"../react-theme/types\";\nimport type { ReduxStore } from \"../redux/types\";\nimport type Href from \"../models/href/Href\";\nimport type { TemplateProps } from \"./htmlpage\";\nimport type { Location } from \"react-router\";\n\ntype Props = {\n store: ReduxStore,\n theme: Theme,\n UUID: string,\n requestHref: Href,\n render: Function,\n ErrorPage: any,\n template?: (TemplateProps) => string,\n};\n/**\n */\nconst renderSSRComplete = ({\n store,\n theme,\n UUID = \"\",\n requestHref,\n render,\n ErrorPage,\n template = htmlpage,\n}: Props): Promise<string> => {\n const helmetContext = { helmet: {} };\n const routerContext = {};\n\n const sheet = new ServerStyleSheet();\n\n // $FlowFixMe[incompatible-type]\n // $FlowFixMe[prop-missing]\n const location: Location = requestHref.toLocation();\n\n const basePath = getBasePath();\n\n return createSSRComplete(store, () =>\n renderToString(\n <Provider store={store}>\n <StyleSheetManager sheet={sheet.instance}>\n <ThemeProvider theme={theme}>\n <HelmetProvider context={helmetContext}>\n <ErrorBoundary>\n <Router\n basename={basePath}\n location={location}\n context={routerContext}\n >\n {render()}\n </Router>\n </ErrorBoundary>\n </HelmetProvider>\n </ThemeProvider>\n </StyleSheetManager>\n </Provider>\n )\n )\n .then((appHTML) => {\n handleErrors(store);\n const head = createHead(sheet, UUID, helmetContext);\n return template({\n contextPath: basePath,\n html: appHTML,\n head,\n state: dehydrate(store),\n UUID,\n });\n })\n .catch((error) =>\n template({\n contextPath: basePath,\n html: renderToString(\n <StyleSheetManager sheet={sheet.instance}>\n <ThemeProvider theme={theme}>\n <ErrorPage\n errorMessage={error.message}\n errorResource={error.fileName}\n errorLine={error.lineNumber}\n errorStack={error.stack}\n />\n </ThemeProvider>\n </StyleSheetManager>\n ),\n head: helmetContext.helmet,\n state: \"\",\n UUID,\n })\n );\n};\n\nexport default renderSSRComplete;\n"],"mappings":"AACA,SAASA,cAAc,QAAQ,kBAAkB;AACjD,SAASC,QAAQ,QAAQ,aAAa;AACtC,SAASC,YAAY,IAAIC,MAAM,QAAQ,cAAc;AAErD,SAASC,cAAc,QAAQ,oBAAoB;AAEnD,SAASC,gBAAgB,EAAEC,iBAAiB,QAAQ,mBAAmB;AAEvE,OAAOC,iBAAiB,MAAM,qBAAqB;AACnD,OAAOC,QAAQ,MAAM,YAAY;AAEjC,SAASC,WAAW,QAAQ,uBAAuB;AAEnD,OAAOC,aAAa,MAAM,8BAA8B;AACxD,OAAOC,aAAa,MAAM,wBAAwB;AAElD,SAASC,UAAU,EAAEC,YAAY,EAAEC,SAAS,QAAQ,cAAc;AAAC;AAiBnE;AACA;AACA,MAAMC,iBAAiB,GAAG,QAQI;EAAA,IARH;IACzBC,KAAK;IACLC,KAAK;IACLC,IAAI,GAAG,EAAE;IACTC,WAAW;IACXC,MAAM;IACNC,SAAS;IACTC,QAAQ,GAAGd;EACN,CAAC;EACN,MAAMe,aAAa,GAAG;IAAEC,MAAM,E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AS;UACR,YAAY,EAAEqB,KAAK,CAACC,OAAQ;UAC5B,aAAa,EAAED,KAAK,CAACE,QAAS;UAC9B,SAAS,EAAEF,KAAK,CAACG,UAAW;UAC5B,UAAU,EAAEH,KAAK,CAACI;QAAM;MACxB;IACY,EACE,CACrB;IACDT,IAAI,EAAEV,aAAa,CAACC,MAAM;IAC1BY,KAAK,EAAE,EAAE;IACTlB;EACF,CAAC,CAAC,CACH;AACL,CAAC;AAED,eAAeH,iBAAiB"}
@@ -2,7 +2,7 @@ import { renderToString } from "react-dom/server";
2
2
  import { Provider } from "react-redux";
3
3
  import { ServerStyleSheet, StyleSheetManager } from "styled-components";
4
4
  import ThemeProvider from "../react-theme/ThemeProvider";
5
- import { BASE } from "../constants/Constants";
5
+ import { getBasePath } from "../constants/Settings";
6
6
  import { createHead, dehydrate } from "./serverUtil";
7
7
  import htmlpage from "./htmlpage";
8
8
  import { jsx as _jsx } from "react/jsx-runtime";
@@ -29,7 +29,7 @@ const renderSSRMinimal = _ref => {
29
29
  }));
30
30
  const head = createHead(sheet, UUID);
31
31
  return template({
32
- contextPath: BASE,
32
+ contextPath: getBasePath(),
33
33
  html: appHTML,
34
34
  head,
35
35
  state: dehydrate(store),
@@ -1 +1 @@
1
- {"version":3,"file":"renderSSRMinimal.js","names":["renderToString","Provider","ServerStyleSheet","StyleSheetManager","ThemeProvider","BASE","createHead","dehydrate","htmlpage","renderSSRMinimal","store","theme","UUID","render","template","sheet","appHTML","instance","head","contextPath","html","state"],"sources":["../../src/react-server/renderSSRMinimal.js"],"sourcesContent":["// @flow\nimport { renderToString } from \"react-dom/server\";\n\nimport { Provider } from \"react-redux\";\n\nimport { ServerStyleSheet, StyleSheetManager } from \"styled-components\";\nimport ThemeProvider from \"../react-theme/ThemeProvider\";\n\nimport { BASE } from \"../constants/Constants\";\n\nimport { createHead, dehydrate } from \"./serverUtil\";\nimport htmlpage from \"./htmlpage\";\n\nimport type { Theme } from \"../react-theme/types\";\nimport type { ReduxStore } from \"../redux/types\";\nimport type { TemplateProps } from \"./htmlpage\";\ntype Props = {\n store: ReduxStore,\n theme?: Theme | Array<Theme>,\n UUID: string,\n render: Function,\n template?: (TemplateProps) => string,\n};\n\n/**\n */\nconst renderSSRMinimal = ({\n store,\n theme,\n UUID = \"\",\n render,\n template = htmlpage,\n}: Props): string => {\n const sheet = new ServerStyleSheet();\n\n const appHTML = renderToString(\n <Provider store={store}>\n <StyleSheetManager sheet={sheet.instance}>\n <ThemeProvider theme={theme}>{render()}</ThemeProvider>\n </StyleSheetManager>\n </Provider>\n );\n\n const head = createHead(sheet, UUID);\n return template({\n contextPath: BASE,\n html: appHTML,\n head,\n state: dehydrate(store),\n UUID,\n });\n};\n\nexport default renderSSRMinimal;\n"],"mappings":"AACA,SAASA,cAAc,QAAQ,kBAAkB;AAEjD,SAASC,QAAQ,QAAQ,aAAa;AAEtC,SAASC,gBAAgB,EAAEC,iBAAiB,QAAQ,mBAAmB;AACvE,OAAOC,aAAa,MAAM,8BAA8B;AAExD,SAASC,IAAI,QAAQ,wBAAwB;AAE7C,SAASC,UAAU,EAAEC,SAAS,QAAQ,cAAc;AACpD,OAAOC,QAAQ,MAAM,YAAY;AAAC;AAalC;AACA;AACA,MAAMC,gBAAgB,GAAG,QAMJ;EAAA,IANK;IACxBC,KAAK;IACLC,KAAK;IACLC,IAAI,GAAG,EAAE;IACTC,MAAM;IACNC,QAAQ,GAAGN;EACN,CAAC;EACN,MAAMO,KAAK,GAAG,IAAIb,gBAAgB,EAAE;EAEpC,MAAMc,OAAO,GAAGhB,cAAc,eAC5B,KAAC,QAAQ;IAAC,KAAK,EAAEU,KAAM;IAAA,uBACrB,KAAC,iBAAiB;MAAC,KAAK,EAAEK,KAAK,CAACE,QAAS;MAAA,uBACvC,KAAC,aAAa;QAAC,KAAK,EAAEN,KAAM;QAAA,UAAEE,MAAM;MAAE;IAAiB;EACrC,EACX,CACZ;EAED,MAAMK,IAAI,GAAGZ,UAAU,CAACS,KAAK,EAAEH,IAAI,CAAC;EACpC,OAAOE,QAAQ,CAAC;IACdK,WAAW,EAAEd,IAAI;IACjBe,IAAI,EAAEJ,OAAO;IACbE,IAAI;IACJG,KAAK,EAAEd,SAAS,CAACG,KAAK,CAAC;IACvBE;EACF,CAAC,CAAC;AACJ,CAAC;AAED,eAAeH,gBAAgB"}
1
+ {"version":3,"file":"renderSSRMinimal.js","names":["renderToString","Provider","ServerStyleSheet","StyleSheetManager","ThemeProvider","getBasePath","createHead","dehydrate","htmlpage","renderSSRMinimal","store","theme","UUID","render","template","sheet","appHTML","instance","head","contextPath","html","state"],"sources":["../../src/react-server/renderSSRMinimal.js"],"sourcesContent":["// @flow\nimport { renderToString } from \"react-dom/server\";\n\nimport { Provider } from \"react-redux\";\n\nimport { ServerStyleSheet, StyleSheetManager } from \"styled-components\";\nimport ThemeProvider from \"../react-theme/ThemeProvider\";\n\nimport { getBasePath } from \"../constants/Settings\";\n\nimport { createHead, dehydrate } from \"./serverUtil\";\nimport htmlpage from \"./htmlpage\";\n\nimport type { Theme } from \"../react-theme/types\";\nimport type { ReduxStore } from \"../redux/types\";\nimport type { TemplateProps } from \"./htmlpage\";\ntype Props = {\n store: ReduxStore,\n theme?: Theme | Array<Theme>,\n UUID: string,\n render: Function,\n template?: (TemplateProps) => string,\n};\n\n/**\n */\nconst renderSSRMinimal = ({\n store,\n theme,\n UUID = \"\",\n render,\n template = htmlpage,\n}: Props): string => {\n const sheet = new ServerStyleSheet();\n\n const appHTML = renderToString(\n <Provider store={store}>\n <StyleSheetManager sheet={sheet.instance}>\n <ThemeProvider theme={theme}>{render()}</ThemeProvider>\n </StyleSheetManager>\n </Provider>\n );\n\n const head = createHead(sheet, UUID);\n return template({\n contextPath: getBasePath(),\n html: appHTML,\n head,\n state: dehydrate(store),\n UUID,\n });\n};\n\nexport default renderSSRMinimal;\n"],"mappings":"AACA,SAASA,cAAc,QAAQ,kBAAkB;AAEjD,SAASC,QAAQ,QAAQ,aAAa;AAEtC,SAASC,gBAAgB,EAAEC,iBAAiB,QAAQ,mBAAmB;AACvE,OAAOC,aAAa,MAAM,8BAA8B;AAExD,SAASC,WAAW,QAAQ,uBAAuB;AAEnD,SAASC,UAAU,EAAEC,SAAS,QAAQ,cAAc;AACpD,OAAOC,QAAQ,MAAM,YAAY;AAAC;AAalC;AACA;AACA,MAAMC,gBAAgB,GAAG,QAMJ;EAAA,IANK;IACxBC,KAAK;IACLC,KAAK;IACLC,IAAI,GAAG,EAAE;IACTC,MAAM;IACNC,QAAQ,GAAGN;EACN,CAAC;EACN,MAAMO,KAAK,GAAG,IAAIb,gBAAgB,EAAE;EAEpC,MAAMc,OAAO,GAAGhB,cAAc,eAC5B,KAAC,QAAQ;IAAC,KAAK,EAAEU,KAAM;IAAA,uBACrB,KAAC,iBAAiB;MAAC,KAAK,EAAEK,KAAK,CAACE,QAAS;MAAA,uBACvC,KAAC,aAAa;QAAC,KAAK,EAAEN,KAAM;QAAA,UAAEE,MAAM;MAAE;IAAiB;EACrC,EACX,CACZ;EAED,MAAMK,IAAI,GAAGZ,UAAU,CAACS,KAAK,EAAEH,IAAI,CAAC;EACpC,OAAOE,QAAQ,CAAC;IACdK,WAAW,EAAEd,WAAW,EAAE;IAC1Be,IAAI,EAAEJ,OAAO;IACbE,IAAI;IACJG,KAAK,EAAEd,SAAS,CAACG,KAAK,CAAC;IACvBE;EACF,CAAC,CAAC;AACJ,CAAC;AAED,eAAeH,gBAAgB"}
@@ -1 +1 @@
1
- {"version":3,"file":"ModularUIMiddleware.js","names":["ModularUIRequest","HTTP_METHODS","startProgress","finishProgress","handleError","createRequest","modularui","request","href","method","GET","data","locale","childmodels","isReload","targetModel","forceTargetModel","responseHandler","next","dispatch","successAction","model","successResult","then","result","catch","error","Error","errorHandler","errorAction","err","errorResult","handleFetch","action","requestOptions","payload","modularuiRequest","fetch","modularUIMiddleware","api","type","getState","i18n"],"sources":["../../../src/redux/_modularui/ModularUIMiddleware.js"],"sourcesContent":["// @flow\nimport ModularUIRequest from \"../../modularui/ModularUIRequest\";\nimport { HTTP_METHODS } from \"../../constants/Constants\";\n\nimport { startProgress, finishProgress } from \"../actions/ProgressIndicator\";\n\nimport { handleError } from \"../actions/Error\";\n\nimport type { Middleware, MiddlewareAPI } from \"redux\";\nimport type {\n ReduxAction,\n ReduxState,\n Dispatch,\n PossibleAction,\n} from \"../types\";\nimport type { ModularUIModel } from \"../../models/types\";\nimport type Href from \"../../models/href/Href\";\nimport type { ModularUIAction, SuccessAction, ErrorAction } from \"./types\";\nimport type { TargetModel } from \"../../modularui/types\";\n\ntype RequestOptions = {\n href: Href,\n method?: $Keys<typeof HTTP_METHODS>,\n data?: string | { [key: string]: string },\n locale: string,\n childmodels?: boolean,\n targetModel?: TargetModel,\n forceTargetModel?: boolean,\n isReload?: boolean,\n};\n\n/**\n * Symbol key that carries API call info interpreted by this Redux middleware.\n */\nconst createRequest = (modularui: RequestOptions): ModularUIRequest => {\n const request = new ModularUIRequest(modularui.href, {\n method: modularui.method || HTTP_METHODS.GET,\n data: modularui.data || {},\n locale: modularui.locale,\n childmodels: modularui.childmodels ?? true,\n isReload: modularui.isReload,\n });\n\n if (modularui.targetModel) {\n request.targetModel = modularui.targetModel;\n request.forceTargetModel = modularui.forceTargetModel ?? false;\n }\n\n return request;\n};\n\n/**\n */\nconst responseHandler = (\n next: Dispatch,\n dispatch: Dispatch,\n successAction: SuccessAction,\n model: ModularUIModel\n) => {\n if (successAction) {\n const successResult = successAction(model);\n\n if (successResult instanceof Promise) {\n successResult\n .then((result) => {\n dispatch(result);\n })\n .catch((error) => {\n next(handleError(error));\n });\n } else {\n try {\n dispatch(successResult);\n } catch (error) {\n throw new Error(\n `Result of successResult is not a valid redux action: ${error}`\n );\n }\n }\n }\n\n return next(finishProgress());\n};\n\n/**\n */\nconst errorHandler = (\n next: Dispatch,\n dispatch: Dispatch,\n errorAction: ?ErrorAction,\n err: any\n) => {\n dispatch(finishProgress());\n\n if (errorAction) {\n const errorResult = errorAction(err);\n\n if (errorResult instanceof Promise) {\n errorResult.then((result) => dispatch(result));\n } else {\n dispatch(errorResult);\n }\n }\n\n return next(handleError(err));\n};\n\n/**\n */\nconst handleFetch = (\n action: ModularUIAction,\n locale: string,\n dispatch: Dispatch,\n next: Dispatch\n) => {\n dispatch(startProgress());\n\n const { successAction, errorAction, ...requestOptions } = action.payload;\n requestOptions.locale = locale;\n\n const modularuiRequest = createRequest(requestOptions);\n\n return modularuiRequest\n .fetch()\n .then((model) => responseHandler(next, dispatch, successAction, model))\n .catch((error) => errorHandler(next, dispatch, errorAction, error));\n};\n\n/**\n */\nexport const modularUIMiddleware: Middleware<\n ReduxState,\n ReduxAction,\n Dispatch\n> =\n (api: MiddlewareAPI<ReduxState, ReduxAction, Dispatch>) =>\n (next: Dispatch) =>\n (action: PossibleAction) => {\n if (action.type === \"MODULARUI/FETCH\") {\n return handleFetch(\n // $FlowExpectedError[incompatible-exact]\n action,\n api.getState().i18n.locale,\n api.dispatch,\n next\n );\n }\n\n return next(action);\n };\n"],"mappings":";AACA,OAAOA,gBAAgB,MAAM,kCAAkC;AAC/D,SAASC,YAAY,QAAQ,2BAA2B;AAExD,SAASC,aAAa,EAAEC,cAAc,QAAQ,8BAA8B;AAE5E,SAASC,WAAW,QAAQ,kBAAkB;AAyB9C;AACA;AACA;AACA,MAAMC,aAAa,GAAIC,SAAyB,IAAuB;EACrE,MAAMC,OAAO,GAAG,IAAIP,gBAAgB,CAACM,SAAS,CAACE,IAAI,EAAE;IACnDC,MAAM,EAAEH,SAAS,CAACG,MAAM,IAAIR,YAAY,CAACS,GAAG;IAC5CC,IAAI,EAAEL,SAAS,CAACK,IAAI,IAAI,CAAC,CAAC;IAC1BC,MAAM,EAAEN,SAAS,CAACM,MAAM;IACxBC,WAAW,EAAEP,SAAS,CAACO,WAAW,IAAI,IAAI;IAC1CC,QAAQ,EAAER,SAAS,CAACQ;EACtB,CAAC,CAAC;EAEF,IAAIR,SAAS,CAACS,WAAW,EAAE;IACzBR,OAAO,CAACQ,WAAW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,WAAW,GAAG,CAClBC,MAAuB,EACvBrB,MAAc,EACdO,QAAkB,EAClBD,IAAc,KACX;EACHC,QAAQ,CAACjB,aAAa,EAAE,CAAC;EAEzB,MAAM;IAAEkB,aAAa;IAAES,WAAW;IAAE,GAAGK;EAAe,CAAC,GAAGD,MAAM,CAACE,OAAO;EACxED,cAAc,CAACtB,MAAM,GAAGA,MAAM;EAE9B,MAAMwB,gBAAgB,GAAG/B,aAAa,CAAC6B,cAAc,CAAC;EAEtD,OAAOE,gBAAgB,CACpBC,KAAK,EAAE,CACPd,IAAI,CAAEF,KAAK,IAAKJ,eAAe,CAACC,IAAI,EAAEC,QAAQ,EAAEC,aAAa,EAAEC,KAAK,CAAC,CAAC,CACtEI,KAAK,CAAEC,KAAK,IAAKE,YAAY,CAACV,IAAI,EAAEC,QAAQ,EAAEU,WAAW,EAAEH,KAAK,CAAC,CAAC;AACvE,CAAC;;AAED;AACA;AACA,OAAO,MAAMY,mBAIZ,GACEC,GAAqD,IACrDrB,IAAc,IACde,MAAsB,IAAK;EAC1B,IAAIA,MAAM,CAACO,IAAI,KAAK,iBAAiB,EAAE;IACrC,OAAOR,WAAW;IAChB;IACAC,MAAM,EACNM,GAAG,CAACE,QAAQ,EAAE,CAACC,IAAI,CAAC9B,MAAM,EAC1B2B,GAAG,CAACpB,QAAQ,EACZD,IAAI,CACL;EACH;EAEA,OAAOA,IAAI,CAACe,MAAM,CAAC;AACrB,CAAC"}
1
+ {"version":3,"file":"ModularUIMiddleware.js","names":["ModularUIRequest","HTTP_METHODS","startProgress","finishProgress","handleError","createRequest","modularui","request","href","method","GET","data","locale","childmodels","isReload","targetModel","forceTargetModel","responseHandler","next","dispatch","successAction","model","successResult","then","result","catch","error","Error","errorHandler","errorAction","err","errorResult","handleFetch","action","requestOptions","payload","modularuiRequest","fetch","modularUIMiddleware","api","type","getState","i18n"],"sources":["../../../src/redux/_modularui/ModularUIMiddleware.js"],"sourcesContent":["// @flow\nimport ModularUIRequest from \"../../modularui/ModularUIRequest\";\nimport { HTTP_METHODS } from \"../../constants/Constants\";\n\nimport { startProgress, finishProgress } from \"../actions/ProgressIndicator\";\n\nimport { handleError } from \"../actions/Error\";\n\nimport type { Middleware, MiddlewareAPI } from \"redux\";\nimport type {\n ReduxAction,\n ReduxState,\n Dispatch,\n PossibleAction,\n} from \"../types\";\nimport type { ModularUIModel } from \"../../models/types\";\nimport type Href from \"../../models/href/Href\";\nimport type { ModularUIAction, SuccessAction, ErrorAction } from \"./types\";\nimport type { TargetModel } from \"../../modularui/types\";\n\ntype RequestOptions = {\n href: Href,\n method?: $Keys<typeof HTTP_METHODS>,\n data?: any,\n locale: string,\n childmodels?: boolean,\n targetModel?: TargetModel,\n forceTargetModel?: boolean,\n isReload?: boolean,\n};\n\n/**\n * Symbol key that carries API call info interpreted by this Redux middleware.\n */\nconst createRequest = (modularui: RequestOptions): ModularUIRequest => {\n const request = new ModularUIRequest(modularui.href, {\n method: modularui.method || HTTP_METHODS.GET,\n data: modularui.data || {},\n locale: modularui.locale,\n childmodels: modularui.childmodels ?? true,\n isReload: modularui.isReload,\n });\n\n if (modularui.targetModel) {\n request.targetModel = modularui.targetModel;\n request.forceTargetModel = modularui.forceTargetModel ?? false;\n }\n\n return request;\n};\n\n/**\n */\nconst responseHandler = (\n next: Dispatch,\n dispatch: Dispatch,\n successAction: SuccessAction,\n model: ModularUIModel\n) => {\n if (successAction) {\n const successResult = successAction(model);\n\n if (successResult instanceof Promise) {\n successResult\n .then((result) => {\n dispatch(result);\n })\n .catch((error) => {\n next(handleError(error));\n });\n } else {\n try {\n dispatch(successResult);\n } catch (error) {\n throw new Error(\n `Result of successResult is not a valid redux action: ${error}`\n );\n }\n }\n }\n\n return next(finishProgress());\n};\n\n/**\n */\nconst errorHandler = (\n next: Dispatch,\n dispatch: Dispatch,\n errorAction: ?ErrorAction,\n err: any\n) => {\n dispatch(finishProgress());\n\n if (errorAction) {\n const errorResult = errorAction(err);\n\n if (errorResult instanceof Promise) {\n errorResult.then((result) => dispatch(result));\n } else {\n dispatch(errorResult);\n }\n }\n\n return next(handleError(err));\n};\n\n/**\n */\nconst handleFetch = (\n action: ModularUIAction,\n locale: string,\n dispatch: Dispatch,\n next: Dispatch\n) => {\n dispatch(startProgress());\n\n const { successAction, errorAction, ...requestOptions } = action.payload;\n requestOptions.locale = locale;\n\n const modularuiRequest = createRequest(requestOptions);\n\n return modularuiRequest\n .fetch()\n .then((model) => responseHandler(next, dispatch, successAction, model))\n .catch((error) => errorHandler(next, dispatch, errorAction, error));\n};\n\n/**\n */\nexport const modularUIMiddleware: Middleware<\n ReduxState,\n ReduxAction,\n Dispatch\n> =\n (api: MiddlewareAPI<ReduxState, ReduxAction, Dispatch>) =>\n (next: Dispatch) =>\n (action: PossibleAction) => {\n if (action.type === \"MODULARUI/FETCH\") {\n return handleFetch(\n // $FlowExpectedError[incompatible-exact]\n action,\n api.getState().i18n.locale,\n api.dispatch,\n next\n );\n }\n\n return next(action);\n };\n"],"mappings":";AACA,OAAOA,gBAAgB,MAAM,kCAAkC;AAC/D,SAASC,YAAY,QAAQ,2BAA2B;AAExD,SAASC,aAAa,EAAEC,cAAc,QAAQ,8BAA8B;AAE5E,SAASC,WAAW,QAAQ,kBAAkB;AAyB9C;AACA;AACA;AACA,MAAMC,aAAa,GAAIC,SAAyB,IAAuB;EACrE,MAAMC,OAAO,GAAG,IAAIP,gBAAgB,CAACM,SAAS,CAACE,IAAI,EAAE;IACnDC,MAAM,EAAEH,SAAS,CAACG,MAAM,IAAIR,YAAY,CAACS,GAAG;IAC5CC,IAAI,EAAEL,SAAS,CAACK,IAAI,IAAI,CAAC,CAAC;IAC1BC,MAAM,EAAEN,SAAS,CAACM,MAAM;IACxBC,WAAW,EAAEP,SAAS,CAACO,WAAW,IAAI,IAAI;IAC1CC,QAAQ,EAAER,SAAS,CAACQ;EACtB,CAAC,CAAC;EAEF,IAAIR,SAAS,CAACS,WAAW,EAAE;IACzBR,OAAO,CAACQ,WAAW,GAAGT,SAAS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CAClBC,MAAuB,EACvBrB,MAAc,EACdO,QAAkB,EAClBD,IAAc,KACX;EACHC,QAAQ,CAACjB,aAAa,EAAE,CAAC;EAEzB,MAAM;IAAEkB,aAAa;IAAES,WAAW;IAAE,GAAGK;EAAe,CAAC,GAAGD,MAAM,CAACE,OAAO;EACxED,cAAc,CAACtB,MAAM,GAAGA,MAAM;EAE9B,MAAMwB,gBAAgB,GAAG/B,aAAa,CAAC6B,cAAc,CAAC;EAEtD,OAAOE,gBAAgB,CACpBC,KAAK,EAAE,CACPd,IAAI,CAAEF,KAAK,IAAKJ,eAAe,CAACC,IAAI,EAAEC,QAAQ,EAAEC,aAAa,EAAEC,KAAK,CAAC,CAAC,CACtEI,KAAK,CAAEC,KAAK,IAAKE,YAAY,CAACV,IAAI,EAAEC,QAAQ,EAAEU,WAAW,EAAEH,KAAK,CAAC,CAAC;AACvE,CAAC;;AAED;AACA;AACA,OAAO,MAAMY,mBAIZ,GACEC,GAAqD,IACrDrB,IAAc,IACde,MAAsB,IAAK;EAC1B,IAAIA,MAAM,CAACO,IAAI,KAAK,iBAAiB,EAAE;IACrC,OAAOR,WAAW;IAChB;IACAC,MAAM,EACNM,GAAG,CAACE,QAAQ,EAAE,CAACC,IAAI,CAAC9B,MAAM,EAC1B2B,GAAG,CAACpB,QAAQ,EACZD,IAAI,CACL;EACH;EAEA,OAAOA,IAAI,CAACe,MAAM,CAAC;AACrB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","names":[],"sources":["../../../src/redux/_modularui/types.js"],"sourcesContent":["// @flow\nimport type { ModularUIModel } from \"../../models/types\";\nimport type Href from \"../../models/href/Href\";\nimport type { FetchException } from \"../../exceptions\";\nimport type { NoAction } from \"../types\";\nimport typeof {\n HTTP_METHODS,\n MODULARUI_STATUS,\n} from \"../../constants/Constants\";\nimport type { ComponentType } from \"react\";\nimport type { TargetModel } from \"../../modularui/types\";\nimport type { RequestModularUIOptions } from \"../../utils/fetch/types\";\n\nexport type ModularUIOptions = {\n propName?: string,\n removeOnUnmount?: boolean,\n ...RequestModularUIOptions,\n};\n\nexport type ModelEntry = {\n +status: string,\n +model: ModularUIModel,\n +lastModification: number,\n};\n\nexport type ModularUIState = {\n [string]: ModelEntry,\n ...\n};\n\nexport type SetModelAction = {\n type: \"MODULARUI/SET\",\n payload: {\n key: string,\n model: ?ModularUIModel,\n },\n};\n\nexport type InitModelAction = {\n type: \"MODULARUI/INIT\",\n payload: Array<{\n key: string,\n model: ModularUIModel,\n }>,\n};\n\nexport type UpdateModelAction = {\n type: \"MODULARUI/UPDATE\",\n payload: ModularUIModel,\n};\n\nexport type SuccessAction = (\n model: ModularUIModel\n) => UpdateModelAction | SetModelAction;\n\nexport type ErrorAction = (\n error: FetchException\n) => UpdateStatusAction | RemoveModelByKeyAction | NoAction;\n\nexport type ModularUIAction = {\n type: \"MODULARUI/FETCH\",\n payload: {\n href: Href,\n method?: $Keys<HTTP_METHODS>,\n data?: string | { [key: string]: string },\n locale: string,\n childmodels?: boolean,\n targetModel?: TargetModel,\n forceTargetModel?: boolean,\n successAction: (\n model: ModularUIModel\n ) => UpdateModelAction | SetModelAction,\n errorAction?: ErrorAction,\n },\n};\n\nexport type RemoveModelByKeyAction = {\n type: \"MODULARUI/REMOVE_KEY\",\n payload: string,\n};\n\nexport type ResetModularUIAction = {\n type: \"MODULARUI/RESET\",\n};\n\nexport type UpdateStatusAction = {\n type: \"MODULARUI/STATUS\",\n payload: {\n key: string,\n status: $Keys<MODULARUI_STATUS>,\n },\n};\n\nexport type ModularUIConnector = (\n Component: ComponentType<any>\n) => ComponentType<any>;\n"],"mappings":""}
1
+ {"version":3,"file":"types.js","names":[],"sources":["../../../src/redux/_modularui/types.js"],"sourcesContent":["// @flow\nimport type { ModularUIModel } from \"../../models/types\";\nimport type Href from \"../../models/href/Href\";\nimport type { FetchException } from \"../../exceptions\";\nimport type { NoAction } from \"../types\";\nimport typeof {\n HTTP_METHODS,\n MODULARUI_STATUS,\n} from \"../../constants/Constants\";\nimport type { ComponentType } from \"react\";\nimport type { TargetModel } from \"../../modularui/types\";\nimport type { RequestModularUIOptions } from \"../../utils/fetch/types\";\n\nexport type ModularUIOptions = {\n propName?: string,\n removeOnUnmount?: boolean,\n ...RequestModularUIOptions,\n};\n\nexport type ModelEntry = {\n +status: string,\n +model: ModularUIModel,\n +lastModification: number,\n};\n\nexport type ModularUIState = {\n [string]: ModelEntry,\n ...\n};\n\nexport type SetModelAction = {\n type: \"MODULARUI/SET\",\n payload: {\n key: string,\n model: ?ModularUIModel,\n },\n};\n\nexport type InitModelAction = {\n type: \"MODULARUI/INIT\",\n payload: Array<{\n key: string,\n model: ModularUIModel,\n }>,\n};\n\nexport type UpdateModelAction = {\n type: \"MODULARUI/UPDATE\",\n payload: ModularUIModel,\n};\n\nexport type SuccessAction = (\n model: ModularUIModel\n) => UpdateModelAction | SetModelAction;\n\nexport type ErrorAction = (\n error: FetchException\n) => UpdateStatusAction | RemoveModelByKeyAction | NoAction;\n\nexport type ModularUIAction = {\n type: \"MODULARUI/FETCH\",\n payload: {\n href: Href,\n method?: $Keys<HTTP_METHODS>,\n data?: any,\n locale: string,\n childmodels?: boolean,\n targetModel?: TargetModel,\n forceTargetModel?: boolean,\n successAction: (\n model: ModularUIModel\n ) => UpdateModelAction | SetModelAction,\n errorAction?: ErrorAction,\n },\n};\n\nexport type RemoveModelByKeyAction = {\n type: \"MODULARUI/REMOVE_KEY\",\n payload: string,\n};\n\nexport type ResetModularUIAction = {\n type: \"MODULARUI/RESET\",\n};\n\nexport type UpdateStatusAction = {\n type: \"MODULARUI/STATUS\",\n payload: {\n key: string,\n status: $Keys<MODULARUI_STATUS>,\n },\n};\n\nexport type ModularUIConnector = (\n Component: ComponentType<any>\n) => ComponentType<any>;\n"],"mappings":""}
@@ -1,16 +1,16 @@
1
1
  import Cookies from "js-cookie";
2
- import { BASE } from "../../constants/Constants";
2
+ import { getBasePath } from "../../constants/Settings";
3
3
  /**
4
4
  */
5
- const getCookie = name => {
5
+ export const getCookie = name => {
6
6
  return Cookies.get(name);
7
7
  };
8
8
 
9
9
  /**
10
10
  */
11
- const setCookie = (name, value, options) => {
11
+ export const setCookie = (name, value, options) => {
12
12
  const attributes = {
13
- path: BASE
13
+ path: getBasePath()
14
14
  };
15
15
  attributes.expires = options?.days;
16
16
  attributes.sameSite = options?.sameSite ?? "Strict";
@@ -20,10 +20,9 @@ const setCookie = (name, value, options) => {
20
20
 
21
21
  /**
22
22
  */
23
- const clearCookie = name => {
23
+ export const clearCookie = name => {
24
24
  Cookies.remove(name, {
25
- path: BASE
25
+ path: getBasePath()
26
26
  });
27
27
  };
28
- export { getCookie, setCookie, clearCookie };
29
28
  //# sourceMappingURL=Cookies.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Cookies.js","names":["Cookies","BASE","getCookie","name","get","setCookie","value","options","attributes","path","expires","days","sameSite","secure","set","clearCookie","remove"],"sources":["../../../src/utils/browser/Cookies.js"],"sourcesContent":["// @flow\nimport Cookies from \"js-cookie\";\n\nimport { BASE } from \"../../constants/Constants\";\n\ntype CookieOptions = {\n days?: number,\n sameSite?: \"None\" | \"Lax\" | \"Strict\",\n secure?: boolean,\n};\n\ntype CookieAttributes = {\n path: string,\n expires?: number,\n sameSite?: string,\n secure?: boolean,\n};\n\n/**\n */\nconst getCookie = (name: string): null | string => {\n return Cookies.get(name);\n};\n\n/**\n */\nconst setCookie = (name: string, value: any, options?: CookieOptions) => {\n const attributes: CookieAttributes = { path: BASE };\n attributes.expires = options?.days;\n attributes.sameSite = options?.sameSite ?? \"Strict\";\n attributes.secure = options?.secure;\n\n Cookies.set(name, value, attributes);\n};\n\n/**\n */\nconst clearCookie = (name: string) => {\n Cookies.remove(name, { path: BASE });\n};\n\nexport { getCookie, setCookie, clearCookie };\n"],"mappings":"AACA,OAAOA,OAAO,MAAM,WAAW;AAE/B,SAASC,IAAI,QAAQ,2BAA2B;AAehD;AACA;AACA,MAAMC,SAAS,GAAIC,IAAY,IAAoB;EACjD,OAAOH,OAAO,CAACI,GAAG,CAACD,IAAI,CAAC;AAC1B,CAAC;;AAED;AACA;AACA,MAAME,SAAS,GAAG,CAACF,IAAY,EAAEG,KAAU,EAAEC,OAAuB,KAAK;EACvE,MAAMC,UAA4B,GAAG;IAAEC,IAAI,EAAER;EAAK,CAAC;EACnDO,UAAU,CAACE,OAAO,GAAGH,OAAO,EAAEI,IAAI;EAClCH,UAAU,CAACI,QAAQ,GAAGL,OAAO,EAAEK,QAAQ,IAAI,QAAQ;EACnDJ,UAAU,CAACK,MAAM,GAAGN,OAAO,EAAEM,MAAM;EAEnCb,OAAO,CAACc,GAAG,CAACX,IAAI,EAAEG,KAAK,EAAEE,UAAU,CAAC;AACtC,CAAC;;AAED;AACA;AACA,MAAMO,WAAW,GAAIZ,IAAY,IAAK;EACpCH,OAAO,CAACgB,MAAM,CAACb,IAAI,EAAE;IAAEM,IAAI,EAAER;EAAK,CAAC,CAAC;AACtC,CAAC;AAED,SAASC,SAAS,EAAEG,SAAS,EAAEU,WAAW"}
1
+ {"version":3,"file":"Cookies.js","names":["Cookies","getBasePath","getCookie","name","get","setCookie","value","options","attributes","path","expires","days","sameSite","secure","set","clearCookie","remove"],"sources":["../../../src/utils/browser/Cookies.js"],"sourcesContent":["// @flow\nimport Cookies from \"js-cookie\";\n\nimport { getBasePath } from \"../../constants/Settings\";\n\ntype CookieOptions = {\n days?: number,\n sameSite?: \"None\" | \"Lax\" | \"Strict\",\n secure?: boolean,\n};\n\ntype CookieAttributes = {\n path: string,\n expires?: number,\n sameSite?: string,\n secure?: boolean,\n};\n\n/**\n */\nexport const getCookie = (name: string): null | string => {\n return Cookies.get(name);\n};\n\n/**\n */\nexport const setCookie = (\n name: string,\n value: any,\n options?: CookieOptions\n) => {\n const attributes: CookieAttributes = { path: getBasePath() };\n attributes.expires = options?.days;\n attributes.sameSite = options?.sameSite ?? \"Strict\";\n attributes.secure = options?.secure;\n\n Cookies.set(name, value, attributes);\n};\n\n/**\n */\nexport const clearCookie = (name: string) => {\n Cookies.remove(name, { path: getBasePath() });\n};\n"],"mappings":"AACA,OAAOA,OAAO,MAAM,WAAW;AAE/B,SAASC,WAAW,QAAQ,0BAA0B;AAetD;AACA;AACA,OAAO,MAAMC,SAAS,GAAIC,IAAY,IAAoB;EACxD,OAAOH,OAAO,CAACI,GAAG,CAACD,IAAI,CAAC;AAC1B,CAAC;;AAED;AACA;AACA,OAAO,MAAME,SAAS,GAAG,CACvBF,IAAY,EACZG,KAAU,EACVC,OAAuB,KACpB;EACH,MAAMC,UAA4B,GAAG;IAAEC,IAAI,EAAER,WAAW;EAAG,CAAC;EAC5DO,UAAU,CAACE,OAAO,GAAGH,OAAO,EAAEI,IAAI;EAClCH,UAAU,CAACI,QAAQ,GAAGL,OAAO,EAAEK,QAAQ,IAAI,QAAQ;EACnDJ,UAAU,CAACK,MAAM,GAAGN,OAAO,EAAEM,MAAM;EAEnCb,OAAO,CAACc,GAAG,CAACX,IAAI,EAAEG,KAAK,EAAEE,UAAU,CAAC;AACtC,CAAC;;AAED;AACA;AACA,OAAO,MAAMO,WAAW,GAAIZ,IAAY,IAAK;EAC3CH,OAAO,CAACgB,MAAM,CAACb,IAAI,EAAE;IAAEM,IAAI,EAAER,WAAW;EAAG,CAAC,CAAC;AAC/C,CAAC"}
@@ -1,6 +1,6 @@
1
1
  import _includesInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/includes";
2
2
  import _Promise from "@babel/runtime-corejs3/core-js-stable/promise";
3
- import { BASE } from "../../constants/Constants";
3
+ import { getBasePath } from "../../constants/Settings";
4
4
  import { FetchException } from "../../exceptions";
5
5
  /**
6
6
  * Fetch data from server (uses nashorn and datafetcher).
@@ -8,7 +8,7 @@ import { FetchException } from "../../exceptions";
8
8
  export default function serverFetch(args) {
9
9
  var _context;
10
10
  // remove contextPath of url, when the request is internal the context path is not needed
11
- const urlNoBase = _includesInstanceProperty(_context = args.url).call(_context, "http") ? args.url : args.url.replace(BASE, "");
11
+ const urlNoBase = _includesInstanceProperty(_context = args.url).call(_context, "http") ? args.url : args.url.replace(getBasePath(), "");
12
12
  const params = args.params ? args.params.replace("includeContext=true", "") : "";
13
13
  const url = params === "" ? urlNoBase : `${urlNoBase}?${params}`;
14
14
  const data = dataFetcher.fetch(url, args);
@@ -1 +1 @@
1
- {"version":3,"file":"serverFetch.js","names":["BASE","FetchException","serverFetch","args","urlNoBase","url","replace","params","data","dataFetcher","fetch","jsonData","JSON","parse","error","reject","resolve"],"sources":["../../../src/utils/fetch/serverFetch.js"],"sourcesContent":["// @flow\nimport { BASE } from \"../../constants/Constants\";\nimport { FetchException } from \"../../exceptions\";\n\nimport type { RequestOptions } from \"./types\";\n\n/**\n * Fetch data from server (uses nashorn and datafetcher).\n */\nexport default function serverFetch(args: RequestOptions): Promise<any> {\n // remove contextPath of url, when the request is internal the context path is not needed\n const urlNoBase = args.url.includes(\"http\")\n ? args.url\n : args.url.replace(BASE, \"\");\n const params = args.params\n ? args.params.replace(\"includeContext=true\", \"\")\n : \"\";\n const url = params === \"\" ? urlNoBase : `${urlNoBase}?${params}`;\n\n const data = dataFetcher.fetch(url, args);\n\n try {\n const jsonData = JSON.parse(data);\n\n if (jsonData.error) {\n return Promise.reject(new FetchException(jsonData, null, args));\n }\n\n return Promise.resolve(jsonData);\n } catch (error) {\n return Promise.reject(error);\n }\n}\n"],"mappings":";;AACA,SAASA,IAAI,QAAQ,2BAA2B;AAChD,SAASC,cAAc,QAAQ,kBAAkB;AAIjD;AACA;AACA;AACA,eAAe,SAASC,WAAW,CAACC,IAAoB,EAAgB;EAAA;EACtE;EACA,MAAMC,SAAS,GAAG,qCAAAD,IAAI,CAACE,GAAG,iBAAU,MAAM,CAAC,GACvCF,IAAI,CAACE,GAAG,GACRF,IAAI,CAACE,GAAG,CAACC,OAAO,CAACN,IAAI,EAAE,EAAE,CAAC;EAC9B,MAAMO,MAAM,GAAGJ,IAAI,CAACI,MAAM,GACtBJ,IAAI,CAACI,MAAM,CAACD,OAAO,CAAC,qBAAqB,EAAE,EAAE,CAAC,GAC9C,EAAE;EACN,MAAMD,GAAG,GAAGE,MAAM,KAAK,EAAE,GAAGH,SAAS,GAAI,GAAEA,SAAU,IAAGG,MAAO,EAAC;EAEhE,MAAMC,IAAI,GAAGC,WAAW,CAACC,KAAK,CAACL,GAAG,EAAEF,IAAI,CAAC;EAEzC,IAAI;IACF,MAAMQ,QAAQ,GAAGC,IAAI,CAACC,KAAK,CAACL,IAAI,CAAC;IAEjC,IAAIG,QAAQ,CAACG,KAAK,EAAE;MAClB,OAAO,SAAQC,MAAM,CAAC,IAAId,cAAc,CAACU,QAAQ,EAAE,IAAI,EAAER,IAAI,CAAC,CAAC;IACjE;IAEA,OAAO,SAAQa,OAAO,CAACL,QAAQ,CAAC;EAClC,CAAC,CAAC,OAAOG,KAAK,EAAE;IACd,OAAO,SAAQC,MAAM,CAACD,KAAK,CAAC;EAC9B;AACF"}
1
+ {"version":3,"file":"serverFetch.js","names":["getBasePath","FetchException","serverFetch","args","urlNoBase","url","replace","params","data","dataFetcher","fetch","jsonData","JSON","parse","error","reject","resolve"],"sources":["../../../src/utils/fetch/serverFetch.js"],"sourcesContent":["// @flow\nimport { getBasePath } from \"../../constants/Settings\";\nimport { FetchException } from \"../../exceptions\";\n\nimport type { RequestOptions } from \"./types\";\n\n/**\n * Fetch data from server (uses nashorn and datafetcher).\n */\nexport default function serverFetch(args: RequestOptions): Promise<any> {\n // remove contextPath of url, when the request is internal the context path is not needed\n const urlNoBase = args.url.includes(\"http\")\n ? args.url\n : args.url.replace(getBasePath(), \"\");\n const params = args.params\n ? args.params.replace(\"includeContext=true\", \"\")\n : \"\";\n const url = params === \"\" ? urlNoBase : `${urlNoBase}?${params}`;\n\n const data = dataFetcher.fetch(url, args);\n\n try {\n const jsonData = JSON.parse(data);\n\n if (jsonData.error) {\n return Promise.reject(new FetchException(jsonData, null, args));\n }\n\n return Promise.resolve(jsonData);\n } catch (error) {\n return Promise.reject(error);\n }\n}\n"],"mappings":";;AACA,SAASA,WAAW,QAAQ,0BAA0B;AACtD,SAASC,cAAc,QAAQ,kBAAkB;AAIjD;AACA;AACA;AACA,eAAe,SAASC,WAAW,CAACC,IAAoB,EAAgB;EAAA;EACtE;EACA,MAAMC,SAAS,GAAG,qCAAAD,IAAI,CAACE,GAAG,iBAAU,MAAM,CAAC,GACvCF,IAAI,CAACE,GAAG,GACRF,IAAI,CAACE,GAAG,CAACC,OAAO,CAACN,WAAW,EAAE,EAAE,EAAE,CAAC;EACvC,MAAMO,MAAM,GAAGJ,IAAI,CAACI,MAAM,GACtBJ,IAAI,CAACI,MAAM,CAACD,OAAO,CAAC,qBAAqB,EAAE,EAAE,CAAC,GAC9C,EAAE;EACN,MAAMD,GAAG,GAAGE,MAAM,KAAK,EAAE,GAAGH,SAAS,GAAI,GAAEA,SAAU,IAAGG,MAAO,EAAC;EAEhE,MAAMC,IAAI,GAAGC,WAAW,CAACC,KAAK,CAACL,GAAG,EAAEF,IAAI,CAAC;EAEzC,IAAI;IACF,MAAMQ,QAAQ,GAAGC,IAAI,CAACC,KAAK,CAACL,IAAI,CAAC;IAEjC,IAAIG,QAAQ,CAACG,KAAK,EAAE;MAClB,OAAO,SAAQC,MAAM,CAAC,IAAId,cAAc,CAACU,QAAQ,EAAE,IAAI,EAAER,IAAI,CAAC,CAAC;IACjE;IAEA,OAAO,SAAQa,OAAO,CAACL,QAAQ,CAAC;EAClC,CAAC,CAAC,OAAOG,KAAK,EAAE;IACd,OAAO,SAAQC,MAAM,CAACD,KAAK,CAAC;EAC9B;AACF"}
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","names":[],"sources":["../../../src/utils/fetch/types.js"],"sourcesContent":["// @flow\nimport typeof { HTTP_METHODS } from \"../../constants/Constants\";\nimport type { ModularUIModel } from \"../../models/types\";\nimport type { TargetModel } from \"../../modularui/types\";\n\nexport type RequestURLOptions = {\n url: string,\n};\n\nexport type RequestBaseOptions = {\n method?: $Keys<HTTP_METHODS>,\n params?: string,\n data?: string | { [key: string]: string },\n timeout?: number,\n responseType?: string,\n headers?: {\n [headerName: string]: string,\n Accept?: string,\n \"Accept-Language\"?: string,\n \"Content-Type\"?: string,\n \"x-filename\"?: string,\n \"x-filesize\"?: string,\n },\n events?: { [eventName: string]: () => void },\n onProgress?: ProgressEventHandler,\n includeContext?: boolean,\n locale?: string,\n cache?: boolean,\n isReload?: boolean,\n};\n\nexport type RequestOptions = { ...RequestURLOptions, ...RequestBaseOptions };\n\nexport type RequestModularUIOptions = {\n ...RequestBaseOptions,\n targetModel?: TargetModel,\n forceTargetModel?: boolean,\n updateModel?: ModularUIModel,\n childmodels?: boolean,\n isValidationRequest?: boolean,\n removeOnUnmount?: boolean,\n};\n"],"mappings":""}
1
+ {"version":3,"file":"types.js","names":[],"sources":["../../../src/utils/fetch/types.js"],"sourcesContent":["// @flow\nimport typeof { HTTP_METHODS } from \"../../constants/Constants\";\nimport type { ModularUIModel } from \"../../models/types\";\nimport type { TargetModel } from \"../../modularui/types\";\n\nexport type RequestURLOptions = {\n url: string,\n};\n\nexport type RequestBaseOptions = {\n method?: $Keys<HTTP_METHODS>,\n params?: string,\n data?: any,\n timeout?: number,\n responseType?: string,\n headers?: {\n [headerName: string]: string,\n Accept?: string,\n \"Accept-Language\"?: string,\n \"Content-Type\"?: string,\n \"x-filename\"?: string,\n \"x-filesize\"?: string,\n },\n events?: { [eventName: string]: () => void },\n onProgress?: ProgressEventHandler,\n includeContext?: boolean,\n locale?: string,\n cache?: boolean,\n isReload?: boolean,\n};\n\nexport type RequestOptions = { ...RequestURLOptions, ...RequestBaseOptions };\n\nexport type RequestModularUIOptions = {\n ...RequestBaseOptions,\n targetModel?: TargetModel,\n forceTargetModel?: boolean,\n updateModel?: ModularUIModel,\n childmodels?: boolean,\n isValidationRequest?: boolean,\n removeOnUnmount?: boolean,\n};\n"],"mappings":""}
@@ -1,6 +1,7 @@
1
1
  import _Promise from "@babel/runtime-corejs3/core-js-stable/promise";
2
2
  import { isPlainObject } from "../helpers/objects";
3
- import { IS_SYNC, USE_CACHE } from "../../constants/Constants";
3
+ import { IS_SYNC } from "../../constants/Constants";
4
+ import { cacheContributions } from "../../constants";
4
5
  import serverFetch from "./serverFetch";
5
6
  import xhr from "./xhr";
6
7
  import Cache from "../browser/Cache";
@@ -37,7 +38,7 @@ const waitForCachedItem = cacheKey => {
37
38
  * @private
38
39
  */
39
40
  const browserFetch = args => {
40
- if (USE_CACHE && args.cache) {
41
+ if (cacheContributions() && args.cache) {
41
42
  const cacheKey = Cache.createResourceKey(args);
42
43
  if (Cache.hasItem(cacheKey)) {
43
44
  const cacheItem = Cache.getItem(cacheKey);
@@ -52,7 +53,7 @@ const browserFetch = args => {
52
53
  Cache.addItem(cacheKey, IS_FETCHING);
53
54
  }
54
55
  return xhr(args).then(response => {
55
- if (USE_CACHE && args.cache) {
56
+ if (cacheContributions() && args.cache) {
56
57
  const cacheKey = Cache.createResourceKey(args);
57
58
  Cache.addItem(cacheKey, response);
58
59
  }
@@ -1 +1 @@
1
- {"version":3,"file":"universalFetch.js","names":["isPlainObject","IS_SYNC","USE_CACHE","serverFetch","xhr","Cache","IS_FETCHING","waitForCachedItem","cacheKey","TIMEOUT","CHECK_TIMEOUT","resolve","reject","check","getItem","cachedItem","Error","setTimeout","browserFetch","args","cache","createResourceKey","hasItem","cacheItem","addItem","then","response","universalFetch","locale","headers","includeContext","url"],"sources":["../../../src/utils/fetch/universalFetch.js"],"sourcesContent":["// @flow\nimport { isPlainObject } from \"../helpers/objects\";\n\nimport { IS_SYNC, USE_CACHE } from \"../../constants/Constants\";\nimport serverFetch from \"./serverFetch\";\nimport xhr from \"./xhr\";\nimport Cache from \"../browser/Cache\";\n\nimport type { RequestOptions } from \"./types\";\n\ntype CachedResponse = any;\n\nconst IS_FETCHING = \"is-fetching\";\n\n/**\n * Checks each x ms if a cache item is set after fetching the item.\n * @private\n */\nconst waitForCachedItem = (cacheKey: string) => {\n let TIMEOUT = 3000;\n const CHECK_TIMEOUT = 100;\n\n return new Promise<CachedResponse>((resolve, reject) => {\n const check = () => {\n if (Cache.getItem(cacheKey) !== IS_FETCHING) {\n const cachedItem = Cache.getItem(cacheKey);\n if (cachedItem != null) {\n resolve(cachedItem);\n } else {\n reject(new Error(\"Empty cached item\"));\n }\n } else if (TIMEOUT <= 0) {\n reject(new Error(\"Empty cached item\"));\n } else {\n TIMEOUT = TIMEOUT - CHECK_TIMEOUT;\n setTimeout(check, CHECK_TIMEOUT);\n }\n };\n\n setTimeout(check, CHECK_TIMEOUT);\n });\n};\n\n/**\n * @private\n */\nconst browserFetch = (args: RequestOptions) => {\n if (USE_CACHE && args.cache) {\n const cacheKey = Cache.createResourceKey(args);\n\n if (Cache.hasItem(cacheKey)) {\n const cacheItem = Cache.getItem(cacheKey);\n\n if (cacheItem != null) {\n if (cacheItem === IS_FETCHING) {\n return waitForCachedItem(cacheKey);\n } else if (isPlainObject(cacheItem)) {\n return Promise.resolve(cacheItem);\n }\n }\n }\n\n Cache.addItem(cacheKey, IS_FETCHING);\n }\n\n return xhr(args).then((response) => {\n if (USE_CACHE && args.cache) {\n const cacheKey = Cache.createResourceKey(args);\n\n Cache.addItem(cacheKey, response);\n }\n\n return response;\n });\n};\n\n/**\n * Request data from server, uses server datafetcher or xhr in browser.\n */\nconst universalFetch = (\n args: RequestOptions\n): Promise<CachedResponse> | Promise<any> => {\n // Set locale as Accept-Language header\n if (args.locale) {\n args.headers = {\n \"Accept-Language\": args.locale,\n };\n }\n\n if (args.includeContext) {\n args.url = `${args.url}?includeContext=true`;\n }\n\n // server side no access to the browser cache apis, no cache available\n if (IS_SYNC) {\n return serverFetch(args);\n }\n\n return browserFetch(args);\n};\n\nexport default universalFetch;\n"],"mappings":";AACA,SAASA,aAAa,QAAQ,oBAAoB;AAElD,SAASC,OAAO,EAAEC,SAAS,QAAQ,2BAA2B;AAC9D,OAAOC,WAAW,MAAM,eAAe;AACvC,OAAOC,GAAG,MAAM,OAAO;AACvB,OAAOC,KAAK,MAAM,kBAAkB;AAMpC,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,QAAQ,CAAC;QACpC,CAAC,MAAM,IAAIR,aAAa,CAACuB,SAAS,CAAC,EAAE;UACnC,OAAO,SAAQZ,OAAO,CAACY,SAAS,CAAC;QACnC;MACF;IACF;IAEAlB,KAAK,CAACmB,OAAO,CAAChB,QAAQ,EAAEF,WAAW,CAAC;EACtC;EAEA,OAAOF,GAAG,CAACe,IAAI,CAAC,CAACM,IAAI,CAAEC,QAAQ,IAAK;IAClC,IAAIxB,SAAS,IAAIiB,IAAI,CAACC,KAAK,EAAE;MAC3B,MAAMZ,QAAQ,GAAGH,KAAK,CAACgB,iBAAiB,CAACF,IAAI,CAAC;MAE9Cd,KAAK,CAACmB,OAAO,CAAChB,QAAQ,EAAEkB,QAAQ,CAAC;IACnC;IAEA,OAAOA,QAAQ;EACjB,CAAC,CAAC;AACJ,CAAC;;AAED;AACA;AACA;AACA,MAAMC,cAAc,GAClBR,IAAoB,IACuB;EAC3C;EACA,IAAIA,IAAI,CAACS,MAAM,EAAE;IACfT,IAAI,CAACU,OAAO,GAAG;MACb,iBAAiB,EAAEV,IAAI,CAACS;IAC1B,CAAC;EACH;EAEA,IAAIT,IAAI,CAACW,cAAc,EAAE;IACvBX,IAAI,CAACY,GAAG,GAAI,GAAEZ,IAAI,CAACY,GAAI,sBAAqB;EAC9C;;EAEA;EACA,IAAI9B,OAAO,EAAE;IACX,OAAOE,WAAW,CAACgB,IAAI,CAAC;EAC1B;EAEA,OAAOD,YAAY,CAACC,IAAI,CAAC;AAC3B,CAAC;AAED,eAAeQ,cAAc"}
1
+ {"version":3,"file":"universalFetch.js","names":["isPlainObject","IS_SYNC","cacheContributions","serverFetch","xhr","Cache","IS_FETCHING","waitForCachedItem","cacheKey","TIMEOUT","CHECK_TIMEOUT","resolve","reject","check","getItem","cachedItem","Error","setTimeout","browserFetch","args","cache","createResourceKey","hasItem","cacheItem","addItem","then","response","universalFetch","locale","headers","includeContext","url"],"sources":["../../../src/utils/fetch/universalFetch.js"],"sourcesContent":["// @flow\nimport { isPlainObject } from \"../helpers/objects\";\n\nimport { IS_SYNC } from \"../../constants/Constants\";\nimport { cacheContributions } from \"../../constants\";\n\nimport serverFetch from \"./serverFetch\";\nimport xhr from \"./xhr\";\nimport Cache from \"../browser/Cache\";\n\nimport type { RequestOptions } from \"./types\";\n\ntype CachedResponse = any;\n\nconst IS_FETCHING = \"is-fetching\";\n\n/**\n * Checks each x ms if a cache item is set after fetching the item.\n * @private\n */\nconst waitForCachedItem = (cacheKey: string) => {\n let TIMEOUT = 3000;\n const CHECK_TIMEOUT = 100;\n\n return new Promise<CachedResponse>((resolve, reject) => {\n const check = () => {\n if (Cache.getItem(cacheKey) !== IS_FETCHING) {\n const cachedItem = Cache.getItem(cacheKey);\n if (cachedItem != null) {\n resolve(cachedItem);\n } else {\n reject(new Error(\"Empty cached item\"));\n }\n } else if (TIMEOUT <= 0) {\n reject(new Error(\"Empty cached item\"));\n } else {\n TIMEOUT = TIMEOUT - CHECK_TIMEOUT;\n setTimeout(check, CHECK_TIMEOUT);\n }\n };\n\n setTimeout(check, CHECK_TIMEOUT);\n });\n};\n\n/**\n * @private\n */\nconst browserFetch = (args: RequestOptions) => {\n if (cacheContributions() && args.cache) {\n const cacheKey = Cache.createResourceKey(args);\n\n if (Cache.hasItem(cacheKey)) {\n const cacheItem = Cache.getItem(cacheKey);\n\n if (cacheItem != null) {\n if (cacheItem === IS_FETCHING) {\n return waitForCachedItem(cacheKey);\n } else if (isPlainObject(cacheItem)) {\n return Promise.resolve(cacheItem);\n }\n }\n }\n\n Cache.addItem(cacheKey, IS_FETCHING);\n }\n\n return xhr(args).then((response) => {\n if (cacheContributions() && args.cache) {\n const cacheKey = Cache.createResourceKey(args);\n\n Cache.addItem(cacheKey, response);\n }\n\n return response;\n });\n};\n\n/**\n * Request data from server, uses server datafetcher or xhr in browser.\n */\nconst universalFetch = (\n args: RequestOptions\n): Promise<CachedResponse> | Promise<any> => {\n // Set locale as Accept-Language header\n if (args.locale) {\n args.headers = {\n \"Accept-Language\": args.locale,\n };\n }\n\n if (args.includeContext) {\n args.url = `${args.url}?includeContext=true`;\n }\n\n // server side no access to the browser cache apis, no cache available\n if (IS_SYNC) {\n return serverFetch(args);\n }\n\n return browserFetch(args);\n};\n\nexport default universalFetch;\n"],"mappings":";AACA,SAASA,aAAa,QAAQ,oBAAoB;AAElD,SAASC,OAAO,QAAQ,2BAA2B;AACnD,SAASC,kBAAkB,QAAQ,iBAAiB;AAEpD,OAAOC,WAAW,MAAM,eAAe;AACvC,OAAOC,GAAG,MAAM,OAAO;AACvB,OAAOC,KAAK,MAAM,kBAAkB;AAMpC,MAAMC,WAAW,GAAG,aAAa;;AAEjC;AACA;AACA;AACA;AACA,MAAMC,iBAAiB,GAAIC,QAAgB,IAAK;EAC9C,IAAIC,OAAO,GAAG,IAAI;EAClB,MAAMC,aAAa,GAAG,GAAG;EAEzB,OAAO,aAA4B,CAACC,OAAO,EAAEC,MAAM,KAAK;IACtD,MAAMC,KAAK,GAAG,MAAM;MAClB,IAAIR,KAAK,CAACS,OAAO,CAACN,QAAQ,CAAC,KAAKF,WAAW,EAAE;QAC3C,MAAMS,UAAU,GAAGV,KAAK,CAACS,OAAO,CAACN,QAAQ,CAAC;QAC1C,IAAIO,UAAU,IAAI,IAAI,EAAE;UACtBJ,OAAO,CAACI,UAAU,CAAC;QACrB,CAAC,MAAM;UACLH,MAAM,CAAC,IAAII,KAAK,CAAC,mBAAmB,CAAC,CAAC;QACxC;MACF,CAAC,MAAM,IAAIP,OAAO,IAAI,CAAC,EAAE;QACvBG,MAAM,CAAC,IAAII,KAAK,CAAC,mBAAmB,CAAC,CAAC;MACxC,CAAC,MAAM;QACLP,OAAO,GAAGA,OAAO,GAAGC,aAAa;QACjCO,UAAU,CAACJ,KAAK,EAAEH,aAAa,CAAC;MAClC;IACF,CAAC;IAEDO,UAAU,CAACJ,KAAK,EAAEH,aAAa,CAAC;EAClC,CAAC,CAAC;AACJ,CAAC;;AAED;AACA;AACA;AACA,MAAMQ,YAAY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