@beinformed/ui 1.18.5 → 1.18.7

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 (70) hide show
  1. package/CHANGELOG.md +11 -0
  2. package/esm/models/list/ListModel.js +3 -2
  3. package/esm/models/list/ListModel.js.map +1 -1
  4. package/esm/react-client/Init.js.map +1 -1
  5. package/esm/react-client/client.js +10 -16
  6. package/esm/react-client/client.js.map +1 -1
  7. package/esm/react-server/htmlpage.js +11 -18
  8. package/esm/react-server/htmlpage.js.map +1 -1
  9. package/esm/react-server/renderSSRMinimal.js +1 -2
  10. package/esm/react-server/renderSSRMinimal.js.map +1 -1
  11. package/esm/react-server/serverNoSSR.js +2 -3
  12. package/esm/react-server/serverNoSSR.js.map +1 -1
  13. package/esm/react-theme/ThemeProvider.js +2 -1
  14. package/esm/react-theme/ThemeProvider.js.map +1 -1
  15. package/esm/utils/browser/Cookies.js +5 -19
  16. package/esm/utils/browser/Cookies.js.map +1 -1
  17. package/lib/hooks/__tests__/UseModularUIModel.spec.js.flow +1 -1
  18. package/lib/hooks/__tests__/useAuthentication.spec.js.flow +1 -1
  19. package/lib/hooks/__tests__/useForm.spec.js.flow +1 -1
  20. package/lib/hooks/__tests__/useModal.spec.js.flow +1 -1
  21. package/lib/hooks/__tests__/useModelCatalog.spec.js.flow +1 -1
  22. package/lib/hooks/__tests__/useModels.spec.js.flow +1 -1
  23. package/lib/hooks/__tests__/useModularUIBasic.spec.js.flow +1 -18
  24. package/lib/hooks/__tests__/useNotification.spec.js.flow +1 -1
  25. package/lib/hooks/__tests__/usePreference.spec.js.flow +1 -1
  26. package/lib/hooks/__tests__/useProgressIndicator.spec.js.flow +1 -1
  27. package/lib/models/list/ListModel.js +3 -2
  28. package/lib/models/list/ListModel.js.flow +14 -13
  29. package/lib/models/list/ListModel.js.map +1 -1
  30. package/lib/react-client/Init.js.flow +1 -1
  31. package/lib/react-client/Init.js.map +1 -1
  32. package/lib/react-client/client.js +10 -16
  33. package/lib/react-client/client.js.flow +12 -10
  34. package/lib/react-client/client.js.map +1 -1
  35. package/lib/react-server/htmlpage.js +10 -18
  36. package/lib/react-server/htmlpage.js.flow +9 -13
  37. package/lib/react-server/htmlpage.js.map +1 -1
  38. package/lib/react-server/renderSSRMinimal.js +1 -2
  39. package/lib/react-server/renderSSRMinimal.js.flow +2 -2
  40. package/lib/react-server/renderSSRMinimal.js.map +1 -1
  41. package/lib/react-server/serverNoSSR.js +2 -3
  42. package/lib/react-server/serverNoSSR.js.flow +4 -3
  43. package/lib/react-server/serverNoSSR.js.map +1 -1
  44. package/lib/react-theme/ThemeProvider.js +2 -1
  45. package/lib/react-theme/ThemeProvider.js.flow +2 -2
  46. package/lib/react-theme/ThemeProvider.js.map +1 -1
  47. package/lib/redux/_router/__tests__/hooks.spec.js.flow +1 -1
  48. package/lib/utils/browser/Cookies.js +5 -18
  49. package/lib/utils/browser/Cookies.js.flow +4 -14
  50. package/lib/utils/browser/Cookies.js.map +1 -1
  51. package/package.json +20 -20
  52. package/src/hooks/__tests__/UseModularUIModel.spec.js +1 -1
  53. package/src/hooks/__tests__/useAuthentication.spec.js +1 -1
  54. package/src/hooks/__tests__/useForm.spec.js +1 -1
  55. package/src/hooks/__tests__/useModal.spec.js +1 -1
  56. package/src/hooks/__tests__/useModelCatalog.spec.js +1 -1
  57. package/src/hooks/__tests__/useModels.spec.js +1 -1
  58. package/src/hooks/__tests__/useModularUIBasic.spec.js +1 -18
  59. package/src/hooks/__tests__/useNotification.spec.js +1 -1
  60. package/src/hooks/__tests__/usePreference.spec.js +1 -1
  61. package/src/hooks/__tests__/useProgressIndicator.spec.js +1 -1
  62. package/src/models/list/ListModel.js +14 -13
  63. package/src/react-client/Init.js +1 -1
  64. package/src/react-client/client.js +12 -10
  65. package/src/react-server/htmlpage.js +9 -13
  66. package/src/react-server/renderSSRMinimal.js +2 -2
  67. package/src/react-server/serverNoSSR.js +4 -3
  68. package/src/react-theme/ThemeProvider.js +2 -2
  69. package/src/redux/_router/__tests__/hooks.spec.js +1 -1
  70. package/src/utils/browser/Cookies.js +4 -14
@@ -526,9 +526,10 @@ var ListModel = /*#__PURE__*/function (_ResourceModel) {
526
526
  }], [{
527
527
  key: "isApplicableModel",
528
528
  value: function isApplicableModel(data) {
529
- var _context6, _context7, _context8, _context9;
529
+ var _data$contributions$r, _data$contributions, _context6;
530
530
 
531
- return data.contributions.resourcetype && ((0, _endsWith.default)(_context6 = data.contributions.resourcetype).call(_context6, "List") || (0, _endsWith.default)(_context7 = data.contributions.resourcetype).call(_context7, "ListPanel") || (0, _endsWith.default)(_context8 = data.contributions.resourcetype).call(_context8, "RelatedDataStorePanel") || (0, _includes.default)(_context9 = ["list-related-cases", "RecordPanel", "EventHistoryPanel", "NotePanel", "AppointmentPanel", "DocumentPanel", "AssignmentPanel"]).call(_context9, data.contributions.resourcetype));
531
+ var resourceType = (_data$contributions$r = (_data$contributions = data.contributions) === null || _data$contributions === void 0 ? void 0 : _data$contributions.resourcetype) !== null && _data$contributions$r !== void 0 ? _data$contributions$r : "";
532
+ return (0, _endsWith.default)(resourceType).call(resourceType, "List") || (0, _endsWith.default)(resourceType).call(resourceType, "ListPanel") || (0, _endsWith.default)(resourceType).call(resourceType, "RelatedDataStorePanel") || (0, _endsWith.default)(resourceType).call(resourceType, "RelatedDatastorePanel") || (0, _includes.default)(_context6 = ["list-related-cases", "RecordPanel", "EventHistoryPanel", "NotePanel", "AppointmentPanel", "DocumentPanel", "AssignmentPanel"]).call(_context6, resourceType);
532
533
  }
533
534
  }]);
534
535
  return ListModel;
@@ -44,20 +44,21 @@ export default class ListModel extends ResourceModel {
44
44
  /**
45
45
  */
46
46
  static isApplicableModel(data: ModularUIResponse): boolean {
47
+ const resourceType = data.contributions?.resourcetype ?? "";
47
48
  return (
48
- data.contributions.resourcetype &&
49
- (data.contributions.resourcetype.endsWith("List") ||
50
- data.contributions.resourcetype.endsWith("ListPanel") ||
51
- data.contributions.resourcetype.endsWith("RelatedDataStorePanel") ||
52
- [
53
- "list-related-cases",
54
- "RecordPanel",
55
- "EventHistoryPanel",
56
- "NotePanel",
57
- "AppointmentPanel",
58
- "DocumentPanel",
59
- "AssignmentPanel",
60
- ].includes(data.contributions.resourcetype))
49
+ resourceType.endsWith("List") ||
50
+ resourceType.endsWith("ListPanel") ||
51
+ resourceType.endsWith("RelatedDataStorePanel") ||
52
+ resourceType.endsWith("RelatedDatastorePanel") ||
53
+ [
54
+ "list-related-cases",
55
+ "RecordPanel",
56
+ "EventHistoryPanel",
57
+ "NotePanel",
58
+ "AppointmentPanel",
59
+ "DocumentPanel",
60
+ "AssignmentPanel",
61
+ ].includes(resourceType)
61
62
  );
62
63
  }
63
64
 
@@ -1 +1 @@
1
- {"version":3,"file":"ListModel.js","names":["ListModel","layouthint","has","SHOW_ONE_RESULT_AS_DETAIL","listItemCollection","length","listItem","listDetailLink","selflink","targetModel","ListDetailModel","models","detail","childModel","type","contributions","label","data","content","text","message","Array","isArray","texts","_listItemCollection","ListItemCollection","createFromList","_detail","listitemHref","selfhref","listitem","equals","setSelfHref","_grouping","setGrouping","GroupingModel","grouping","dynamicschema","contexts","hasGroups","hasItems","HIDE_WHEN_EMPTY","hasResults","actionCollection","isEmpty","filterCollection","hasActiveFilters","id","decodedId","decodeURIComponent","toString","result","href","_paging","setPaging","PagingModel","paging","_sorting","setSorting","SortingModel","getSortingLabels","sorting","_filterCollection","setFilters","FilterCollection","listkey","key","filter","_actionCollection","setActionCollection","ActionCollection","actions","selfLink","links","getLinkByKey","ListHref","_selfhref","_headers","setHeaders","tempHeaders","results","forEach","attributes","attribute","listHeader","ListHeaderModel","exists","some","tempHeader","CASEVIEW_LINK","push","sortingLabels","attributeKey","actionType","getActionsByType","resourcetype","ResourceModel"],"sources":["../../../src/models/list/ListModel.js"],"sourcesContent":["// @flow\nimport ModularUIResponse from \"../../modularui/ModularUIResponse\";\n\nimport ListItemCollection from \"../list/ListItemCollection\";\nimport ListDetailModel from \"../list/ListDetailModel\";\nimport ActionCollection from \"../actions/ActionCollection\";\nimport FilterCollection from \"../filters/FilterCollection\";\nimport GroupingModel from \"../grouping/GroupingModel\";\nimport ListHeaderModel from \"../list/ListHeaderModel\";\nimport ListHref from \"../href/ListHref\";\nimport ListItemModel from \"../list/ListItemModel\";\nimport PagingModel from \"../paging/PagingModel\";\nimport ResourceModel from \"../base/ResourceModel\";\nimport SortingModel from \"../sorting/SortingModel\";\nimport {\n CASEVIEW_LINK,\n HIDE_WHEN_EMPTY,\n SHOW_ONE_RESULT_AS_DETAIL,\n} from \"../../constants/LayoutHints\";\n\nimport type { ModularUIModel } from \"../types\";\nimport type LinkModel from \"../links/LinkModel\";\n\n/**\n * Defines a list object\n */\nexport default class ListModel extends ResourceModel {\n _detail: ?ListDetailModel = null;\n _headers: Array<ListHeaderModel>;\n _paging: PagingModel;\n _filterCollection: FilterCollection;\n _sorting: SortingModel;\n _actionCollection: ActionCollection;\n _listItemCollection: ListItemCollection;\n _grouping: GroupingModel;\n _selfhref: ListHref;\n\n /**\n */\n get type(): string {\n return \"List\";\n }\n\n /**\n */\n static isApplicableModel(data: ModularUIResponse): boolean {\n return (\n data.contributions.resourcetype &&\n (data.contributions.resourcetype.endsWith(\"List\") ||\n data.contributions.resourcetype.endsWith(\"ListPanel\") ||\n data.contributions.resourcetype.endsWith(\"RelatedDataStorePanel\") ||\n [\n \"list-related-cases\",\n \"RecordPanel\",\n \"EventHistoryPanel\",\n \"NotePanel\",\n \"AppointmentPanel\",\n \"DocumentPanel\",\n \"AssignmentPanel\",\n ].includes(data.contributions.resourcetype))\n );\n }\n\n /**\n */\n getInitialChildModelLinks(): Array<LinkModel> {\n if (\n this.layouthint.has(SHOW_ONE_RESULT_AS_DETAIL) &&\n this.listItemCollection.length === 1\n ) {\n return this.listItemCollection.map((listItem) => {\n const listDetailLink = listItem.selflink;\n listDetailLink.targetModel = ListDetailModel;\n return listDetailLink;\n });\n }\n\n return [];\n }\n\n /**\n */\n setChildModels(models: Array<ModularUIModel>) {\n this.detail = models.find((childModel) => childModel.type === \"ListDetail\");\n }\n\n /**\n * Getting the label of the list\n */\n get label(): string {\n return this.contributions.label;\n }\n\n /**\n * Getting the introduction text\n */\n get introtext(): string {\n if (this.data.content) {\n return this.data.content.text.message;\n }\n\n if (this.contributions.text) {\n return this.contributions.text.message ?? this.contributions.text;\n }\n\n if (Array.isArray(this.contributions.texts)) {\n return this.contributions.texts[0].text;\n }\n\n return \"\";\n }\n\n /**\n * Getting the results\n */\n get listItemCollection(): ListItemCollection {\n if (!this._listItemCollection) {\n this._listItemCollection = ListItemCollection.createFromList(this);\n }\n\n return this._listItemCollection;\n }\n\n /**\n * Set results\n */\n set listItemCollection(listItemCollection: ListItemCollection) {\n this._listItemCollection = listItemCollection;\n }\n\n /**\n * Getting the detail\n */\n get detail(): ?ListDetailModel {\n return this._detail;\n }\n\n /**\n * Add detail model to the {ListModel}\n */\n set detail(detail: ?ModularUIModel) {\n if (detail instanceof ListDetailModel) {\n const listitemHref = detail.selfhref;\n\n const listitem = this.listItemCollection.find((listItem) =>\n listItem.selfhref.equals(listitemHref)\n );\n\n if (listitem) {\n detail.listitem = listitem;\n }\n\n this._detail = detail;\n }\n\n this.setSelfHref();\n }\n\n /**\n * Retrieve grouping information\n */\n get grouping(): GroupingModel {\n if (!this._grouping) {\n this._grouping = this.setGrouping();\n }\n\n return this._grouping;\n }\n\n /**\n */\n setGrouping(): GroupingModel {\n return new GroupingModel(\n { ...this.data.grouping, dynamicschema: this.data.dynamicschema },\n this.contributions.contexts\n );\n }\n\n /**\n */\n hasGrouping(): boolean {\n return this.grouping.hasGroups();\n }\n\n /**\n * Check if list has results\n */\n hasResults(): boolean {\n return this.listItemCollection.hasItems;\n }\n\n /**\n */\n get shouldHide(): boolean {\n return (\n this.layouthint.has(HIDE_WHEN_EMPTY) &&\n !this.hasResults() &&\n this.actionCollection.isEmpty &&\n !this.filterCollection.hasActiveFilters()\n );\n }\n\n /**\n * Get list item by ID\n */\n getListItemById(id: string | number): ListItemModel | null {\n const decodedId = decodeURIComponent(id.toString());\n return this.listItemCollection.find(\n (result) => result.id.toString() === decodedId\n );\n }\n\n /**\n * Get list item by Href\n */\n getListItemByHref(href: ListHref): ListItemModel | null {\n return this.listItemCollection.find((result) =>\n result.selfhref.equals(href)\n );\n }\n\n /**\n * Getting paging information\n */\n get paging(): PagingModel {\n if (!this._paging) {\n this._paging = this.setPaging();\n }\n return this._paging;\n }\n\n /**\n */\n setPaging(): PagingModel {\n return new PagingModel(this.data.paging, this.contributions.paging);\n }\n\n /**\n * Getting sorting information\n */\n get sorting(): SortingModel {\n if (!this._sorting) {\n this._sorting = this.setSorting();\n }\n\n return this._sorting;\n }\n\n /**\n */\n setSorting(): SortingModel {\n return new SortingModel(\n this.contributions,\n this.getSortingLabels(),\n this.grouping,\n this.data.sorting\n );\n }\n\n /**\n * Getting the filters\n */\n get filterCollection(): FilterCollection {\n if (!this._filterCollection) {\n this._filterCollection = this.setFilters();\n }\n\n return this._filterCollection;\n }\n\n /**\n * Set filterCollection\n */\n set filterCollection(filterCollection: FilterCollection) {\n this._filterCollection = filterCollection;\n }\n\n /**\n */\n setFilters(): FilterCollection {\n return new FilterCollection(this.data.filter, {\n listkey: this.key,\n filter: this.contributions.filter,\n contexts: this.contributions.contexts,\n dynamicschema: this.data.dynamicschema,\n });\n }\n\n /**\n * Indicates if list results are filtered\n */\n isFiltered(): boolean {\n return this.filterCollection.hasActiveFilters();\n }\n\n /**\n * Getting actions\n */\n get actionCollection(): ActionCollection {\n if (!this._actionCollection) {\n this._actionCollection = this.setActionCollection();\n }\n return this._actionCollection;\n }\n\n /**\n */\n setActionCollection(): ActionCollection {\n return new ActionCollection(this.data.actions, this.contributions.actions);\n }\n\n /**\n * Contains this model list data\n */\n hasList(): boolean {\n return this.key != null;\n }\n\n /**\n * Sets self href from links collection\n */\n setSelfHref(): ListHref {\n const selfLink = this.links ? this.links.getLinkByKey(\"self\") : null;\n\n if (selfLink !== null) {\n return new ListHref(selfLink.href, this);\n }\n\n return new ListHref();\n }\n\n /**\n * Getting the self link of this list\n */\n get selfhref(): ListHref {\n if (!this._selfhref) {\n this._selfhref = this.setSelfHref();\n }\n return this._selfhref;\n }\n\n /**\n * Getting the headers of this list\n */\n get headers(): Array<ListHeaderModel> {\n if (!this._headers) {\n this._headers = this.setHeaders();\n }\n\n return this._headers;\n }\n\n /**\n * Set initial headers of list\n */\n setHeaders(): Array<ListHeaderModel> {\n const tempHeaders = [];\n\n if (this.contributions.results) {\n const { results } = this.contributions;\n\n Object.keys(results).forEach((key) => {\n results[key].attributes.forEach((attribute) => {\n const listHeader = new ListHeaderModel(attribute, this.sorting);\n\n const exists = tempHeaders.some((tempHeader) =>\n tempHeader.equals(listHeader)\n );\n\n if (!exists && !listHeader.layouthint.has(CASEVIEW_LINK)) {\n tempHeaders.push(listHeader);\n }\n });\n });\n }\n\n return tempHeaders;\n }\n\n /**\n */\n getSortingLabels(): { [string]: string } {\n const sortingLabels = {};\n\n if (this.contributions.results) {\n const { results } = this.contributions;\n Object.keys(results).forEach((key) => {\n results[key].attributes.forEach((attribute) => {\n const attributeKey = Object.keys(attribute)[0];\n sortingLabels[attributeKey] = attribute[attributeKey].label;\n });\n });\n }\n\n return sortingLabels;\n }\n\n /**\n * Retrieve all actions by type\n */\n getActionsByType(actionType: string): ActionCollection {\n return this.actionCollection.getActionsByType(actionType);\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA;;AAEA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;;;;;;;AASA;AACA;AACA;IACqBA,S;;;;;;;;;;;;;;;;;0FACS,I;;;;;;;;;;;;;;;IAU5B;AACF;IACE,eAAmB;MACjB,OAAO,MAAP;IACD;IAED;AACF;;;;;IAmBE;AACF;IACE,qCAA8C;MAC5C,IACE,KAAKC,UAAL,CAAgBC,GAAhB,CAAoBC,sCAApB,K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AAO,CAACd,GAAD,CAAP,CAAagB,UAAb,CAAwBD,OAAxB,CAAgC,UAACE,SAAD,EAAe;YAC7C,IAAMS,YAAY,GAAG,mBAAYT,SAAZ,EAAuB,CAAvB,CAArB;YACAQ,aAAa,CAACC,YAAD,CAAb,GAA8BT,SAAS,CAACS,YAAD,CAAT,CAAwB5E,KAAtD;UACD,CAHD;QAID,CALD;MAMD;;MAED,OAAO2E,aAAP;IACD;IAED;AACF;AACA;;;;WACE,0BAAiBE,UAAjB,EAAuD;MACrD,OAAO,KAAKlD,gBAAL,CAAsBmD,gBAAtB,CAAuCD,UAAvC,CAAP;IACD;;;WArWD,2BAAyB5E,IAAzB,EAA2D;MAAA;;MACzD,OACEA,IAAI,CAACF,aAAL,CAAmBgF,YAAnB,KACC,mCAAA9E,IAAI,CAACF,aAAL,CAAmBgF,YAAnB,kBAAyC,MAAzC,KACC,mCAAA9E,IAAI,CAACF,aAAL,CAAmBgF,YAAnB,kBAAyC,WAAzC,CADD,IAEC,mCAAA9E,IAAI,CAACF,aAAL,CAAmBgF,YAAnB,kBAAyC,uBAAzC,CAFD,IAGC,oCACE,oBADF,EAEE,aAFF,EAGE,mBAHF,EAIE,WAJF,EAKE,kBALF,EAME,eANF,EAOE,iBAPF,mBAQW9E,IAAI,CAACF,aAAL,CAAmBgF,YAR9B,CAJF,CADF;IAeD;;;EAnCoCC,uB"}
1
+ {"version":3,"file":"ListModel.js","names":["ListModel","layouthint","has","SHOW_ONE_RESULT_AS_DETAIL","listItemCollection","length","listItem","listDetailLink","selflink","targetModel","ListDetailModel","models","detail","childModel","type","contributions","label","data","content","text","message","Array","isArray","texts","_listItemCollection","ListItemCollection","createFromList","_detail","listitemHref","selfhref","listitem","equals","setSelfHref","_grouping","setGrouping","GroupingModel","grouping","dynamicschema","contexts","hasGroups","hasItems","HIDE_WHEN_EMPTY","hasResults","actionCollection","isEmpty","filterCollection","hasActiveFilters","id","decodedId","decodeURIComponent","toString","result","href","_paging","setPaging","PagingModel","paging","_sorting","setSorting","SortingModel","getSortingLabels","sorting","_filterCollection","setFilters","FilterCollection","listkey","key","filter","_actionCollection","setActionCollection","ActionCollection","actions","selfLink","links","getLinkByKey","ListHref","_selfhref","_headers","setHeaders","tempHeaders","results","forEach","attributes","attribute","listHeader","ListHeaderModel","exists","some","tempHeader","CASEVIEW_LINK","push","sortingLabels","attributeKey","actionType","getActionsByType","resourceType","resourcetype","ResourceModel"],"sources":["../../../src/models/list/ListModel.js"],"sourcesContent":["// @flow\nimport ModularUIResponse from \"../../modularui/ModularUIResponse\";\n\nimport ListItemCollection from \"../list/ListItemCollection\";\nimport ListDetailModel from \"../list/ListDetailModel\";\nimport ActionCollection from \"../actions/ActionCollection\";\nimport FilterCollection from \"../filters/FilterCollection\";\nimport GroupingModel from \"../grouping/GroupingModel\";\nimport ListHeaderModel from \"../list/ListHeaderModel\";\nimport ListHref from \"../href/ListHref\";\nimport ListItemModel from \"../list/ListItemModel\";\nimport PagingModel from \"../paging/PagingModel\";\nimport ResourceModel from \"../base/ResourceModel\";\nimport SortingModel from \"../sorting/SortingModel\";\nimport {\n CASEVIEW_LINK,\n HIDE_WHEN_EMPTY,\n SHOW_ONE_RESULT_AS_DETAIL,\n} from \"../../constants/LayoutHints\";\n\nimport type { ModularUIModel } from \"../types\";\nimport type LinkModel from \"../links/LinkModel\";\n\n/**\n * Defines a list object\n */\nexport default class ListModel extends ResourceModel {\n _detail: ?ListDetailModel = null;\n _headers: Array<ListHeaderModel>;\n _paging: PagingModel;\n _filterCollection: FilterCollection;\n _sorting: SortingModel;\n _actionCollection: ActionCollection;\n _listItemCollection: ListItemCollection;\n _grouping: GroupingModel;\n _selfhref: ListHref;\n\n /**\n */\n get type(): string {\n return \"List\";\n }\n\n /**\n */\n static isApplicableModel(data: ModularUIResponse): boolean {\n const resourceType = data.contributions?.resourcetype ?? \"\";\n return (\n resourceType.endsWith(\"List\") ||\n resourceType.endsWith(\"ListPanel\") ||\n resourceType.endsWith(\"RelatedDataStorePanel\") ||\n resourceType.endsWith(\"RelatedDatastorePanel\") ||\n [\n \"list-related-cases\",\n \"RecordPanel\",\n \"EventHistoryPanel\",\n \"NotePanel\",\n \"AppointmentPanel\",\n \"DocumentPanel\",\n \"AssignmentPanel\",\n ].includes(resourceType)\n );\n }\n\n /**\n */\n getInitialChildModelLinks(): Array<LinkModel> {\n if (\n this.layouthint.has(SHOW_ONE_RESULT_AS_DETAIL) &&\n this.listItemCollection.length === 1\n ) {\n return this.listItemCollection.map((listItem) => {\n const listDetailLink = listItem.selflink;\n listDetailLink.targetModel = ListDetailModel;\n return listDetailLink;\n });\n }\n\n return [];\n }\n\n /**\n */\n setChildModels(models: Array<ModularUIModel>) {\n this.detail = models.find((childModel) => childModel.type === \"ListDetail\");\n }\n\n /**\n * Getting the label of the list\n */\n get label(): string {\n return this.contributions.label;\n }\n\n /**\n * Getting the introduction text\n */\n get introtext(): string {\n if (this.data.content) {\n return this.data.content.text.message;\n }\n\n if (this.contributions.text) {\n return this.contributions.text.message ?? this.contributions.text;\n }\n\n if (Array.isArray(this.contributions.texts)) {\n return this.contributions.texts[0].text;\n }\n\n return \"\";\n }\n\n /**\n * Getting the results\n */\n get listItemCollection(): ListItemCollection {\n if (!this._listItemCollection) {\n this._listItemCollection = ListItemCollection.createFromList(this);\n }\n\n return this._listItemCollection;\n }\n\n /**\n * Set results\n */\n set listItemCollection(listItemCollection: ListItemCollection) {\n this._listItemCollection = listItemCollection;\n }\n\n /**\n * Getting the detail\n */\n get detail(): ?ListDetailModel {\n return this._detail;\n }\n\n /**\n * Add detail model to the {ListModel}\n */\n set detail(detail: ?ModularUIModel) {\n if (detail instanceof ListDetailModel) {\n const listitemHref = detail.selfhref;\n\n const listitem = this.listItemCollection.find((listItem) =>\n listItem.selfhref.equals(listitemHref)\n );\n\n if (listitem) {\n detail.listitem = listitem;\n }\n\n this._detail = detail;\n }\n\n this.setSelfHref();\n }\n\n /**\n * Retrieve grouping information\n */\n get grouping(): GroupingModel {\n if (!this._grouping) {\n this._grouping = this.setGrouping();\n }\n\n return this._grouping;\n }\n\n /**\n */\n setGrouping(): GroupingModel {\n return new GroupingModel(\n { ...this.data.grouping, dynamicschema: this.data.dynamicschema },\n this.contributions.contexts\n );\n }\n\n /**\n */\n hasGrouping(): boolean {\n return this.grouping.hasGroups();\n }\n\n /**\n * Check if list has results\n */\n hasResults(): boolean {\n return this.listItemCollection.hasItems;\n }\n\n /**\n */\n get shouldHide(): boolean {\n return (\n this.layouthint.has(HIDE_WHEN_EMPTY) &&\n !this.hasResults() &&\n this.actionCollection.isEmpty &&\n !this.filterCollection.hasActiveFilters()\n );\n }\n\n /**\n * Get list item by ID\n */\n getListItemById(id: string | number): ListItemModel | null {\n const decodedId = decodeURIComponent(id.toString());\n return this.listItemCollection.find(\n (result) => result.id.toString() === decodedId\n );\n }\n\n /**\n * Get list item by Href\n */\n getListItemByHref(href: ListHref): ListItemModel | null {\n return this.listItemCollection.find((result) =>\n result.selfhref.equals(href)\n );\n }\n\n /**\n * Getting paging information\n */\n get paging(): PagingModel {\n if (!this._paging) {\n this._paging = this.setPaging();\n }\n return this._paging;\n }\n\n /**\n */\n setPaging(): PagingModel {\n return new PagingModel(this.data.paging, this.contributions.paging);\n }\n\n /**\n * Getting sorting information\n */\n get sorting(): SortingModel {\n if (!this._sorting) {\n this._sorting = this.setSorting();\n }\n\n return this._sorting;\n }\n\n /**\n */\n setSorting(): SortingModel {\n return new SortingModel(\n this.contributions,\n this.getSortingLabels(),\n this.grouping,\n this.data.sorting\n );\n }\n\n /**\n * Getting the filters\n */\n get filterCollection(): FilterCollection {\n if (!this._filterCollection) {\n this._filterCollection = this.setFilters();\n }\n\n return this._filterCollection;\n }\n\n /**\n * Set filterCollection\n */\n set filterCollection(filterCollection: FilterCollection) {\n this._filterCollection = filterCollection;\n }\n\n /**\n */\n setFilters(): FilterCollection {\n return new FilterCollection(this.data.filter, {\n listkey: this.key,\n filter: this.contributions.filter,\n contexts: this.contributions.contexts,\n dynamicschema: this.data.dynamicschema,\n });\n }\n\n /**\n * Indicates if list results are filtered\n */\n isFiltered(): boolean {\n return this.filterCollection.hasActiveFilters();\n }\n\n /**\n * Getting actions\n */\n get actionCollection(): ActionCollection {\n if (!this._actionCollection) {\n this._actionCollection = this.setActionCollection();\n }\n return this._actionCollection;\n }\n\n /**\n */\n setActionCollection(): ActionCollection {\n return new ActionCollection(this.data.actions, this.contributions.actions);\n }\n\n /**\n * Contains this model list data\n */\n hasList(): boolean {\n return this.key != null;\n }\n\n /**\n * Sets self href from links collection\n */\n setSelfHref(): ListHref {\n const selfLink = this.links ? this.links.getLinkByKey(\"self\") : null;\n\n if (selfLink !== null) {\n return new ListHref(selfLink.href, this);\n }\n\n return new ListHref();\n }\n\n /**\n * Getting the self link of this list\n */\n get selfhref(): ListHref {\n if (!this._selfhref) {\n this._selfhref = this.setSelfHref();\n }\n return this._selfhref;\n }\n\n /**\n * Getting the headers of this list\n */\n get headers(): Array<ListHeaderModel> {\n if (!this._headers) {\n this._headers = this.setHeaders();\n }\n\n return this._headers;\n }\n\n /**\n * Set initial headers of list\n */\n setHeaders(): Array<ListHeaderModel> {\n const tempHeaders = [];\n\n if (this.contributions.results) {\n const { results } = this.contributions;\n\n Object.keys(results).forEach((key) => {\n results[key].attributes.forEach((attribute) => {\n const listHeader = new ListHeaderModel(attribute, this.sorting);\n\n const exists = tempHeaders.some((tempHeader) =>\n tempHeader.equals(listHeader)\n );\n\n if (!exists && !listHeader.layouthint.has(CASEVIEW_LINK)) {\n tempHeaders.push(listHeader);\n }\n });\n });\n }\n\n return tempHeaders;\n }\n\n /**\n */\n getSortingLabels(): { [string]: string } {\n const sortingLabels = {};\n\n if (this.contributions.results) {\n const { results } = this.contributions;\n Object.keys(results).forEach((key) => {\n results[key].attributes.forEach((attribute) => {\n const attributeKey = Object.keys(attribute)[0];\n sortingLabels[attributeKey] = attribute[attributeKey].label;\n });\n });\n }\n\n return sortingLabels;\n }\n\n /**\n * Retrieve all actions by type\n */\n getActionsByType(actionType: string): ActionCollection {\n return this.actionCollection.getActionsByType(actionType);\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA;;AAEA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;;;;;;;AASA;AACA;AACA;IACqBA,S;;;;;;;;;;;;;;;;;0FACS,I;;;;;;;;;;;;;;;IAU5B;AACF;IACE,eAAmB;MACjB,OAAO,MAAP;IACD;IAED;AACF;;;;;IAoBE;AACF;IACE,qCAA8C;MAC5C,IACE,KAAKC,UAAL,CAAgBC,GAAhB,CAAoBC,sCAApB,KACA,KAAKC,kBAAL,CAAwBC,MAAxB,KAAmC,CAFrC,EAGE;QAAA;;QACA,OAAO,mCAAKD,kBAAL,kBAA4B,UAACE,QAAD,EAAc;UAC/C,IAAMC,cAAc,GAAGD,QAAQ,CAACE,QAAhC;UACAD,cAAc,CAACE,WAAf,GAA6BC,wBAA7B;UACA,OAAOH,cAAP;QACD,CAJM,CAAP;MAKD;;MAED,OAAO,EAAP;IACD;IAED;AACF;;;;WACE,wBAAeI,MAAf,EAA8C;MAC5C,KAAKC,MAAL,GAAc,mBAAAD,MAAM,MAAN,CAAAA,MAAM,EAAM,UAACE,UAAD;QAAA,OAAgBA,UAAU,CAACC,IAAX,KAAoB,YAApC;MAAA,CAAN,CAApB;IACD;IAED;AACF;AACA;;;;SACE,eAAoB;MAClB,OAAO,KAAKC,aAAL,CAAmBC,KAA1B;IACD;IAED;AACF;AACA;;;;SACE,eAAwB;MACtB,IAAI,KAAKC,IAAL,CAAUC,OAAd,EAAuB;QACrB,OAAO,KAAKD,IAAL,CAAUC,OAAV,CAAkBC,IAAlB,CAAuBC,OAA9B;MACD;;MAED,IAAI,KAAKL,aAAL,CAAmBI,IAAvB,EAA6B;QAAA;;QAC3B,gCAAO,KAAKJ,aAAL,CAAmBI,IAAnB,CAAwBC,OAA/B,yEAA0C,KAAKL,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AIE,WAJF,EAKE,kBALF,EAME,eANF,EAOE,iBAPF,mBAQWA,YARX,CALF;IAeD;;;EApCoCE,uB"}
@@ -16,7 +16,7 @@ export type Props = {
16
16
  +store: ReduxStore,
17
17
  +history: RouterHistory,
18
18
  +contextPath: string,
19
- +theme: Theme | Array<Theme>,
19
+ +theme?: Theme | Array<Theme>,
20
20
  +children: ?Node,
21
21
  +ErrorFallbackComponent?: ComponentType<FallbackProps>,
22
22
  };
@@ -1 +1 @@
1
- {"version":3,"file":"Init.js","names":["Init","store","history","contextPath","theme","children","ErrorFallbackComponent","displayName"],"sources":["../../src/react-client/Init.js"],"sourcesContent":["// @flow\nimport { Provider } from \"react-redux\";\nimport { HelmetProvider } from \"react-helmet-async\";\nimport { Router } from \"react-router\";\n\nimport ThemeProvider from \"../react-theme/ThemeProvider\";\nimport ErrorBoundary from \"../react/ErrorBoundary\";\n\nimport type { ComponentType, Node } from \"react\";\nimport type { RouterHistory } from \"react-router\";\nimport type { Theme } from \"../react-theme/types\";\nimport type { ReduxStore } from \"../redux/types\";\nimport type { Props as FallbackProps } from \"../react/ErrorBoundaryFallback\";\n\nexport type Props = {\n +store: ReduxStore,\n +history: RouterHistory,\n +contextPath: string,\n +theme: Theme | Array<Theme>,\n +children: ?Node,\n +ErrorFallbackComponent?: ComponentType<FallbackProps>,\n};\n\n/**\n */\nconst Init = ({\n store,\n history,\n contextPath,\n theme,\n children,\n ErrorFallbackComponent,\n}: Props): Node => (\n <Provider store={store}>\n <ThemeProvider theme={theme}>\n <HelmetProvider>\n <ErrorBoundary FallbackComponent={ErrorFallbackComponent}>\n <Router history={history} basename={contextPath}>\n {children}\n </Router>\n </ErrorBoundary>\n </HelmetProvider>\n </ThemeProvider>\n </Provider>\n);\n\nInit.displayName = \"BI.Init\";\n\nexport default Init;\n"],"mappings":";;;;;;;;;AACA;;AACA;;AACA;;AAEA;;AACA;;;;AAiBA;AACA;AACA,IAAMA,IAAI,GAAG,SAAPA,IAAO;EAAA,IACXC,KADW,QACXA,KADW;EAAA,IAEXC,OAFW,QAEXA,OAFW;EAAA,IAGXC,WAHW,QAGXA,WAHW;EAAA,IAIXC,KAJW,QAIXA,KAJW;EAAA,IAKXC,QALW,QAKXA,QALW;EAAA,IAMXC,sBANW,QAMXA,sBANW;EAAA,oBAQX,qBAAC,oBAAD;IAAU,KAAK,EAAEL,KAAjB;IAAA,uBACE,qBAAC,sBAAD;MAAe,KAAK,EAAEG,KAAtB;MAAA,uBACE,qBAAC,gCAAD;QAAA,uBACE,qBAAC,sBAAD;UAAe,iBAAiB,EAAEE,sBAAlC;UAAA,uBACE,qBAAC,mBAAD;YAAQ,OAAO,EAAEJ,OAAjB;YAA0B,QAAQ,EAAEC,WAApC;YAAA,UACGE;UADH;QADF;MADF;IADF;EADF,EARW;AAAA,CAAb;;AAqBAL,IAAI,CAACO,WAAL,GAAmB,SAAnB;eAEeP,I"}
1
+ {"version":3,"file":"Init.js","names":["Init","store","history","contextPath","theme","children","ErrorFallbackComponent","displayName"],"sources":["../../src/react-client/Init.js"],"sourcesContent":["// @flow\nimport { Provider } from \"react-redux\";\nimport { HelmetProvider } from \"react-helmet-async\";\nimport { Router } from \"react-router\";\n\nimport ThemeProvider from \"../react-theme/ThemeProvider\";\nimport ErrorBoundary from \"../react/ErrorBoundary\";\n\nimport type { ComponentType, Node } from \"react\";\nimport type { RouterHistory } from \"react-router\";\nimport type { Theme } from \"../react-theme/types\";\nimport type { ReduxStore } from \"../redux/types\";\nimport type { Props as FallbackProps } from \"../react/ErrorBoundaryFallback\";\n\nexport type Props = {\n +store: ReduxStore,\n +history: RouterHistory,\n +contextPath: string,\n +theme?: Theme | Array<Theme>,\n +children: ?Node,\n +ErrorFallbackComponent?: ComponentType<FallbackProps>,\n};\n\n/**\n */\nconst Init = ({\n store,\n history,\n contextPath,\n theme,\n children,\n ErrorFallbackComponent,\n}: Props): Node => (\n <Provider store={store}>\n <ThemeProvider theme={theme}>\n <HelmetProvider>\n <ErrorBoundary FallbackComponent={ErrorFallbackComponent}>\n <Router history={history} basename={contextPath}>\n {children}\n </Router>\n </ErrorBoundary>\n </HelmetProvider>\n </ThemeProvider>\n </Provider>\n);\n\nInit.displayName = \"BI.Init\";\n\nexport default Init;\n"],"mappings":";;;;;;;;;AACA;;AACA;;AACA;;AAEA;;AACA;;;;AAiBA;AACA;AACA,IAAMA,IAAI,GAAG,SAAPA,IAAO;EAAA,IACXC,KADW,QACXA,KADW;EAAA,IAEXC,OAFW,QAEXA,OAFW;EAAA,IAGXC,WAHW,QAGXA,WAHW;EAAA,IAIXC,KAJW,QAIXA,KAJW;EAAA,IAKXC,QALW,QAKXA,QALW;EAAA,IAMXC,sBANW,QAMXA,sBANW;EAAA,oBAQX,qBAAC,oBAAD;IAAU,KAAK,EAAEL,KAAjB;IAAA,uBACE,qBAAC,sBAAD;MAAe,KAAK,EAAEG,KAAtB;MAAA,uBACE,qBAAC,gCAAD;QAAA,uBACE,qBAAC,sBAAD;UAAe,iBAAiB,EAAEE,sBAAlC;UAAA,uBACE,qBAAC,mBAAD;YAAQ,OAAO,EAAEJ,OAAjB;YAA0B,QAAQ,EAAEC,WAApC;YAAA,UACGE;UADH;QADF;MADF;IADF;EADF,EARW;AAAA,CAAb;;AAqBAL,IAAI,CAACO,WAAL,GAAmB,SAAnB;eAEeP,I"}
@@ -69,17 +69,8 @@ var parseDataToJSON = function parseDataToJSON(data) {
69
69
  */
70
70
 
71
71
 
72
- var client = function client() {
73
- var _context;
74
-
75
- var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
76
- _ref$customReducers = _ref.customReducers,
77
- customReducers = _ref$customReducers === void 0 ? {} : _ref$customReducers,
78
- _ref$theme = _ref.theme,
79
- theme = _ref$theme === void 0 ? {} : _ref$theme,
80
- render = _ref.render,
81
- beforeRenderHooks = _ref.beforeRenderHooks,
82
- ErrorFallbackComponent = _ref.ErrorFallbackComponent;
72
+ var client = function client(props) {
73
+ var _context, _props$customReducers;
83
74
 
84
75
  if (typeof window.contextPath === "undefined") {
85
76
  throw new Error("Missing contextPath on window object");
@@ -102,7 +93,7 @@ var client = function client() {
102
93
  basename: _Constants.BASE
103
94
  });
104
95
 
105
- var _configureStore = (0, _configureStore2.default)(browserHistory, customReducers, (0, _rehydrate.default)(data)),
96
+ var _configureStore = (0, _configureStore2.default)(browserHistory, (_props$customReducers = props.customReducers) !== null && _props$customReducers !== void 0 ? _props$customReducers : {}, (0, _rehydrate.default)(data)),
106
97
  history = _configureStore.history,
107
98
  store = _configureStore.store;
108
99
 
@@ -147,10 +138,13 @@ var client = function client() {
147
138
  document.body.className = "js";
148
139
  }
149
140
 
150
- (0, _beforeRenderHooks.handleBeforeRenderHooks)(beforeRenderHooks, {
151
- store: store
152
- });
153
- addContentLoadedEvent(store, history, theme, render, ErrorFallbackComponent);
141
+ if (props.beforeRenderHooks) {
142
+ (0, _beforeRenderHooks.handleBeforeRenderHooks)(props.beforeRenderHooks, {
143
+ store: store
144
+ });
145
+ }
146
+
147
+ addContentLoadedEvent(store, history, props.theme, props.render, props.ErrorFallbackComponent);
154
148
  };
155
149
  /**
156
150
  */
@@ -66,13 +66,7 @@ const parseDataToJSON = (data) => {
66
66
  /**
67
67
  * Mount the webapplication to the DOM, used client side when JavaScript is enabled.
68
68
  */
69
- const client = ({
70
- customReducers = {},
71
- theme = {},
72
- render,
73
- beforeRenderHooks,
74
- ErrorFallbackComponent,
75
- }: Props = {}) => {
69
+ const client = (props: Props) => {
76
70
  if (typeof window.contextPath === "undefined") {
77
71
  throw new Error("Missing contextPath on window object");
78
72
  }
@@ -97,7 +91,7 @@ const client = ({
97
91
  });
98
92
  const { history, store } = configureStore(
99
93
  browserHistory,
100
- customReducers,
94
+ props.customReducers ?? {},
101
95
  rehydrate(data)
102
96
  );
103
97
 
@@ -144,9 +138,17 @@ const client = ({
144
138
  document.body.className = "js";
145
139
  }
146
140
 
147
- handleBeforeRenderHooks(beforeRenderHooks, { store });
141
+ if (props.beforeRenderHooks) {
142
+ handleBeforeRenderHooks(props.beforeRenderHooks, { store });
143
+ }
148
144
 
149
- addContentLoadedEvent(store, history, theme, render, ErrorFallbackComponent);
145
+ addContentLoadedEvent(
146
+ store,
147
+ history,
148
+ props.theme,
149
+ props.render,
150
+ props.ErrorFallbackComponent
151
+ );
150
152
  };
151
153
 
152
154
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"client.js","names":["elementClosest","window","parseDataToJSON","data","JSON","parse","error","JsonParseException","client","customReducers","theme","render","beforeRenderHooks","ErrorFallbackComponent","contextPath","Error","dataElement","document","querySelector","textContent","Cache","clear","browserHistory","createBrowserHistory","basename","BASE","configureStore","rehydrate","history","store","setAllContentInDataSetting","getState","setLoginPreferences","loadOtherBrowserTabs","getItem","dispatch","loginSuccess","has","FetchException","response","handleError","listen","location","action","locationChange","onunhandledrejection","event","detail","setImmediate","errorMessage","reason","message","toString","showXHRErrorNotification","body","className","handleBeforeRenderHooks","addContentLoadedEvent","addEventListener","applicationNode","isSSR","mount","hydrate","reactRender"],"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/actions\";\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 } 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) => {\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 = ({\n customReducers = {},\n theme = {},\n render,\n beforeRenderHooks,\n ErrorFallbackComponent,\n}: 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 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 handleBeforeRenderHooks(beforeRenderHooks, { store });\n\n addContentLoadedEvent(store, history, theme, render, ErrorFallbackComponent);\n};\n\n/**\n */\nconst addContentLoadedEvent = (\n store,\n history,\n theme,\n render,\n ErrorFallbackComponent\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":";;;;;;;;;;;AAEA;;AAIA;;AAEA;;AAEA;;AACA;;AAEA;;AAEA;;AACA;;AAEA;;AACA;;AAEA;;AAIA;;AAEA;;AACA;;AAEA;;AAEA;;AAEA;;AAEA;;;;AAnCA;AAEA,IAAAA,uBAAA,EAAeC,MAAf;AAEA;;AA+CA;AACA;AACA;;AACA;AACA;AACA,IAAMC,eAAe,GAAG,SAAlBA,eAAkB,CAACC,IAAD,EAAU;EAChC,IAAI;IACF,OAAOC,IAAI,CAACC,KAAL,CAAWF,IAAX,CAAP;EACD,CAFD,CAEE,OAAOG,KAAP,EAAc;IACd,MAAM,IAAIC,8BAAJ,iCAAgDJ,IAAhD,EAAN;EACD;AACF,CAND;AAQA;AACA;AACA;;;AACA,IAAMK,MAAM,GAAG,SAATA,MAAS,GAMG;EAA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EAAwBC,MAAxB,EAAgCE,sBAAhC,CAArB;AACD,CAjFD;AAmFA;AACA;;;AACA,IAAM4C,qBAAqB,GAAG,SAAxBA,qBAAwB,CAC5B5B,KAD4B,EAE5BD,OAF4B,EAG5BlB,KAH4B,EAI5BC,MAJ4B,EAK5BE,sBAL4B,EAMzB;EACHZ,MAAM,CAACyD,gBAAP,CAAwB,kBAAxB,EAA4C,YAAM;IAChD,IAAMC,eAAe,GAAG1C,QAAQ,CAACC,aAAT,CAAuB,cAAvB,CAAxB;;IACA,IAAIyC,eAAJ,EAAqB;MACnB,IAAMC,KAAK,GAAGD,eAAe,CAACzC,aAAhB,CAA8B,cAA9B,CAAd;MACA,IAAM2C,KAAK,GAAGD,KAAK,GAAGE,iBAAH,GAAaC,gBAAhC;MACAF,KAAK,eACH,qBAAC,aAAD;QACE,KAAK,EAAEhC,KADT;QAEE,OAAO,EAAED,OAFX;QAGE,WAAW,EAAE3B,MAAM,CAACa,WAHtB;QAIE,KAAK,EAAEJ,KAJT;QAKE,sBAAsB,EAAEG,sBAL1B;QAAA,UAOGF,MAAM;MAPT,EADG,EAUHgD,eAVG,CAAL;IAYD,CAfD,MAeO;MACL,MAAM,IAAI5C,KAAJ,CACJ,8DADI,CAAN;IAGD;EACF,CAtBD;AAuBD,CA9BD;;eAgCeP,M"}
1
+ {"version":3,"file":"client.js","names":["elementClosest","window","parseDataToJSON","data","JSON","parse","error","JsonParseException","client","props","contextPath","Error","dataElement","document","querySelector","textContent","Cache","clear","browserHistory","createBrowserHistory","basename","BASE","configureStore","customReducers","rehydrate","history","store","setAllContentInDataSetting","getState","setLoginPreferences","loadOtherBrowserTabs","getItem","dispatch","loginSuccess","has","FetchException","response","handleError","listen","location","action","locationChange","onunhandledrejection","event","detail","setImmediate","errorMessage","reason","message","toString","showXHRErrorNotification","body","className","beforeRenderHooks","handleBeforeRenderHooks","addContentLoadedEvent","theme","render","ErrorFallbackComponent","addEventListener","applicationNode","isSSR","mount","hydrate","reactRender"],"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/actions\";\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 } 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) => {\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,\n history,\n theme,\n render,\n ErrorFallbackComponent\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":";;;;;;;;;;;AAEA;;AAIA;;AAEA;;AAEA;;AACA;;AAEA;;AAEA;;AACA;;AAEA;;AACA;;AAEA;;AAIA;;AAEA;;AACA;;AAEA;;AAEA;;AAEA;;AAEA;;;;AAnCA;AAEA,IAAAA,uBAAA,EAAeC,MAAf;AAEA;;AA+CA;AACA;AACA;;AACA;AACA;AACA,IAAMC,eAAe,GAAG,SAAlBA,eAAkB,CAACC,IAAD,EAAU;EAChC,IAAI;IACF,OAAOC,IAAI,CAACC,KAAL,CAAWF,IAAX,CAAP;EACD,CAFD,CAEE,OAAOG,KAAP,EAAc;IACd,MAAM,IAAIC,8BAAJ,iCAAgDJ,IAAhD,EAAN;EACD;AACF,CAND;AAQA;AACA;AACA;;;AACA,IAAMK,MAAM,GAAG,SAATA,MAAS,CAACC,KAAD,EAAkB;EAAA;;EAC/B,IAAI,OAAOR,MAAM,CAACS,WAAd,KAA8B,WAAlC,EAA+C;IAC7C,MAAM,IAAIC,KAAJ,CAAU,sCAAV,CAAN;EACD;;EAED,IAAMC,WAAW,GAAGC,QAAQ,CAACC,aAAT,CAClB,4DADkB,CAApB;;EAGA,IAAI,CAACF,WAAL,EAAkB;IAChB,MAAM,IAAID,KAAJ,CAAU,qCAAV,CAAN;EACD,CAFD,MAEO,IAAI,8BAAAC,WAAW,CAACG,WAAZ,qBAAmC,EAAvC,EAA2C;IAChD;EACD;;EAED,IAAMZ,IAAI,GAAGD,eAAe,CAACU,WAAW,CAACG,WAAb,CAA5B,CAd+B,CAgB/B;;EACAC,cAAA,CAAMC,KAAN,CAAY,OAAZ,EAjB+B,CAmB/B;;;EACA,IAAMC,cAA6B,GAAG,IAAAC,6BAAA,EAAqB;IACzDC,QAAQ,EAAEC;EAD+C,CAArB,CAAtC;;EAGA,sBAA2B,IAAAC,wBAAA,EACzBJ,cADyB,2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AM,IAAIjD,KAAJ,CACJ,8DADI,CAAN;IAGD;EACF,CAtBD;AAuBD,CA9BD;;eAgCeH,M"}
@@ -21,36 +21,28 @@ var _exceptions = require("../exceptions");
21
21
 
22
22
  /**
23
23
  */
24
- var htmlpage = function htmlpage() {
25
- var _context, _context2, _context3, _context4, _context5, _context6, _context7;
26
-
27
- var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
28
- contextPath = _ref.contextPath,
29
- html = _ref.html,
30
- _ref$head = _ref.head,
31
- head = _ref$head === void 0 ? {} : _ref$head,
32
- _ref$state = _ref.state,
33
- state = _ref$state === void 0 ? "" : _ref$state,
34
- _ref$UUID = _ref.UUID,
35
- UUID = _ref$UUID === void 0 ? "" : _ref$UUID;
36
-
37
- if (contextPath === undefined) {
24
+ var htmlpage = function htmlpage(props) {
25
+ var _context, _context2, _context3, _context4, _context5, _context6, _props$UUID, _props$state, _context7;
26
+
27
+ if ((props === null || props === void 0 ? void 0 : props.contextPath) === undefined) {
38
28
  throw new _exceptions.IllegalArgumentException("Missing contextPath argument");
39
29
  }
40
30
 
41
- if (html === undefined) {
31
+ if (props.html === undefined) {
42
32
  throw new _exceptions.IllegalArgumentException("Missing html for server");
43
33
  }
44
34
 
45
- var template = (0, _concat.default)(_context = (0, _concat.default)(_context2 = (0, _concat.default)(_context3 = (0, _concat.default)(_context4 = "\n <!doctype html>\n <html ".concat(head && head.htmlAttributes ? head.htmlAttributes.toString() : "", ">\n <head>\n <meta charset=\"utf-8\" />\n ")).call(_context4, (0, _map.default)(_context5 = (0, _filter.default)(_context6 = (0, _keys.default)(head)).call(_context6, function (key) {
35
+ var _props$head = props.head,
36
+ head = _props$head === void 0 ? {} : _props$head;
37
+ var template = (0, _concat.default)(_context = (0, _concat.default)(_context2 = (0, _concat.default)(_context3 = (0, _concat.default)(_context4 = "\n <!doctype html>\n <html ".concat(head.htmlAttributes ? head.htmlAttributes.toString() : "", ">\n <head>\n <meta charset=\"utf-8\" />\n ")).call(_context4, (0, _map.default)(_context5 = (0, _filter.default)(_context6 = (0, _keys.default)(head)).call(_context6, function (key) {
46
38
  return key !== "htmlAttributes";
47
39
  })).call(_context5, function (key) {
48
40
  return head[key].toString();
49
- }).join(""), "\n {CSSASSETS:<link rel=\"stylesheet\" type=\"text/css\" href=\"{CONTEXT_PATH}/{FILE}\" />:CSSASSETS}\n </head>\n <body class=\"nojs\">\n <div id=\"application\">")).call(_context3, html, "</div>\n <div id=\"portal\"></div>\n <script\n type=\"application/json\"\n data-app-state=\"app-json\"\n data-app-contextpath=\"{CONTEXT_PATH}\"\n data-app-filepath=\"{FILEPATH}\"\n data-app-nonce=\"")).call(_context2, UUID, "\">")).call(_context, state, "</script>\n {JSASSETS:<script src=\"{CONTEXT_PATH}/{FILE}\"></script>:JSASSETS}\n </body>\n </html>\n"); // It is important to replace the context afterwards,
41
+ }).join(""), "\n {CSSASSETS:<link rel=\"stylesheet\" type=\"text/css\" href=\"{CONTEXT_PATH}/{FILE}\" />:CSSASSETS}\n </head>\n <body class=\"nojs\">\n <div id=\"application\">")).call(_context3, props.html, "</div>\n <div id=\"portal\"></div>\n <script\n type=\"application/json\"\n data-app-state=\"app-json\"\n data-app-contextpath=\"{CONTEXT_PATH}\"\n data-app-filepath=\"{FILEPATH}\"\n data-app-nonce=\"")).call(_context2, (_props$UUID = props.UUID) !== null && _props$UUID !== void 0 ? _props$UUID : "", "\">")).call(_context, (_props$state = props.state) !== null && _props$state !== void 0 ? _props$state : "", "</script>\n {JSASSETS:<script src=\"{CONTEXT_PATH}/{FILE}\"></script>:JSASSETS}\n </body>\n </html>\n"); // It is important to replace the context afterwards,
50
42
  // the JSASSESTS and CSSASSETS parts act as a small template for all generated javascript and css files
51
43
  // these templates must be pure strings to make it possible to add the context path in all situations
52
44
 
53
- return (0, _trim.default)(_context7 = template.replace(/{CONTEXT_PATH}/g, contextPath)).call(_context7);
45
+ return (0, _trim.default)(_context7 = template.replace(/{CONTEXT_PATH}/g, props.contextPath)).call(_context7);
54
46
  };
55
47
 
56
48
  var _default = htmlpage;
@@ -11,23 +11,19 @@ export type TemplateProps = {
11
11
 
12
12
  /**
13
13
  */
14
- const htmlpage = ({
15
- contextPath,
16
- html,
17
- head = {},
18
- state = "",
19
- UUID = "",
20
- }: TemplateProps = {}): string => {
21
- if (contextPath === undefined) {
14
+ const htmlpage = (props: TemplateProps): string => {
15
+ if (props?.contextPath === undefined) {
22
16
  throw new IllegalArgumentException("Missing contextPath argument");
23
17
  }
24
- if (html === undefined) {
18
+ if (props.html === undefined) {
25
19
  throw new IllegalArgumentException("Missing html for server");
26
20
  }
27
21
 
22
+ const { head = {} } = props;
23
+
28
24
  const template = `
29
25
  <!doctype html>
30
- <html ${head && head.htmlAttributes ? head.htmlAttributes.toString() : ""}>
26
+ <html ${head.htmlAttributes ? head.htmlAttributes.toString() : ""}>
31
27
  <head>
32
28
  <meta charset="utf-8" />
33
29
  ${Object.keys(head)
@@ -37,14 +33,14 @@ const htmlpage = ({
37
33
  {CSSASSETS:<link rel="stylesheet" type="text/css" href="{CONTEXT_PATH}/{FILE}" />:CSSASSETS}
38
34
  </head>
39
35
  <body class="nojs">
40
- <div id="application">${html}</div>
36
+ <div id="application">${props.html}</div>
41
37
  <div id="portal"></div>
42
38
  <script
43
39
  type="application/json"
44
40
  data-app-state="app-json"
45
41
  data-app-contextpath="{CONTEXT_PATH}"
46
42
  data-app-filepath="{FILEPATH}"
47
- data-app-nonce="${UUID}">${state}</script>
43
+ data-app-nonce="${props.UUID ?? ""}">${props.state ?? ""}</script>
48
44
  {JSASSETS:<script src="{CONTEXT_PATH}/{FILE}"></script>:JSASSETS}
49
45
  </body>
50
46
  </html>
@@ -53,7 +49,7 @@ const htmlpage = ({
53
49
  // It is important to replace the context afterwards,
54
50
  // the JSASSESTS and CSSASSETS parts act as a small template for all generated javascript and css files
55
51
  // these templates must be pure strings to make it possible to add the context path in all situations
56
- return template.replace(/{CONTEXT_PATH}/g, contextPath).trim();
52
+ return template.replace(/{CONTEXT_PATH}/g, props.contextPath).trim();
57
53
  };
58
54
 
59
55
  export default htmlpage;
@@ -1 +1 @@
1
- {"version":3,"file":"htmlpage.js","names":["htmlpage","contextPath","html","head","state","UUID","undefined","IllegalArgumentException","template","htmlAttributes","toString","key","join","replace"],"sources":["../../src/react-server/htmlpage.js"],"sourcesContent":["// @flow\nimport { IllegalArgumentException } from \"../exceptions\";\n\nexport type TemplateProps = {\n contextPath: string,\n html: string,\n head: Object,\n state: string,\n UUID: string,\n};\n\n/**\n */\nconst htmlpage = ({\n contextPath,\n html,\n head = {},\n state = \"\",\n UUID = \"\",\n}: TemplateProps = {}): string => {\n if (contextPath === undefined) {\n throw new IllegalArgumentException(\"Missing contextPath argument\");\n }\n if (html === undefined) {\n throw new IllegalArgumentException(\"Missing html for server\");\n }\n\n const template = `\n <!doctype html>\n <html ${head && head.htmlAttributes ? head.htmlAttributes.toString() : \"\"}>\n <head>\n <meta charset=\"utf-8\" />\n ${Object.keys(head)\n .filter((key) => key !== \"htmlAttributes\")\n .map((key) => head[key].toString())\n .join(\"\")}\n {CSSASSETS:<link rel=\"stylesheet\" type=\"text/css\" href=\"{CONTEXT_PATH}/{FILE}\" />:CSSASSETS}\n </head>\n <body class=\"nojs\">\n <div id=\"application\">${html}</div>\n <div id=\"portal\"></div>\n <script\n type=\"application/json\"\n data-app-state=\"app-json\"\n data-app-contextpath=\"{CONTEXT_PATH}\"\n data-app-filepath=\"{FILEPATH}\"\n data-app-nonce=\"${UUID}\">${state}</script>\n {JSASSETS:<script src=\"{CONTEXT_PATH}/{FILE}\"></script>:JSASSETS}\n </body>\n </html>\n`;\n\n // It is important to replace the context afterwards,\n // the JSASSESTS and CSSASSETS parts act as a small template for all generated javascript and css files\n // these templates must be pure strings to make it possible to add the context path in all situations\n return template.replace(/{CONTEXT_PATH}/g, contextPath).trim();\n};\n\nexport default htmlpage;\n"],"mappings":";;;;;;;;;;;;;;;;;;;AACA;;AAUA;AACA;AACA,IAAMA,QAAQ,GAAG,SAAXA,QAAW,GAMiB;EAAA;;EAAA,+EAAf,EAAe;EAAA,IALhCC,WAKgC,QALhCA,WAKgC;EAAA,IAJhCC,IAIgC,QAJhCA,IAIgC;EAAA,qBAHhCC,IAGgC;EAAA,IAHhCA,IAGgC,0BAHzB,EAGyB;EAAA,sBAFhCC,KAEgC;EAAA,IAFhCA,KAEgC,2BAFxB,EAEwB;EAAA,qBADhCC,IACgC;EAAA,IADhCA,IACgC,0BADzB,EACyB;;EAChC,IAAIJ,WAAW,KAAKK,SAApB,EAA+B;IAC7B,MAAM,IAAIC,oCAAJ,CAA6B,8BAA7B,CAAN;EACD;;EACD,IAAIL,IAAI,KAAKI,SAAb,EAAwB;IACtB,MAAM,IAAIC,oCAAJ,CAA6B,yBAA7B,CAAN;EACD;;EAED,IAAMC,QAAQ,6KAENL,IAAI,IAAIA,IAAI,CAACM,cAAb,GAA8BN,IAAI,CAACM,cAAL,CAAoBC,QAApB,EAA9B,GAA+D,EAFzD,8EAKR,kFAAYP,IAAZ,mBACQ,UAACQ,GAAD;IAAA,OAASA,GAAG,KAAK,gBAAjB;EAAA,CADR,mBAEK,UAACA,GAAD;IAAA,OAASR,IAAI,CAACQ,GAAD,CAAJ,CAAUD,QAAV,EAAT;EAAA,CAFL,EAGCE,IAHD,CAGM,EAHN,CALQ,yMAYcV,IAZd,2QAmBUG,IAnBV,yBAmBmBD,KAnBnB,mHAAd,CARgC,CAiChC;EACA;EACA;;EACA,OAAO,+BAAAI,QAAQ,CAACK,OAAT,CAAiB,iBAAjB,EAAoCZ,WAApC,kBAAP;AACD,CA3CD;;eA6CeD,Q"}
1
+ {"version":3,"file":"htmlpage.js","names":["htmlpage","props","contextPath","undefined","IllegalArgumentException","html","head","template","htmlAttributes","toString","key","join","UUID","state","replace"],"sources":["../../src/react-server/htmlpage.js"],"sourcesContent":["// @flow\nimport { IllegalArgumentException } from \"../exceptions\";\n\nexport type TemplateProps = {\n contextPath: string,\n html: string,\n head: Object,\n state: string,\n UUID: string,\n};\n\n/**\n */\nconst htmlpage = (props: TemplateProps): string => {\n if (props?.contextPath === undefined) {\n throw new IllegalArgumentException(\"Missing contextPath argument\");\n }\n if (props.html === undefined) {\n throw new IllegalArgumentException(\"Missing html for server\");\n }\n\n const { head = {} } = props;\n\n const template = `\n <!doctype html>\n <html ${head.htmlAttributes ? head.htmlAttributes.toString() : \"\"}>\n <head>\n <meta charset=\"utf-8\" />\n ${Object.keys(head)\n .filter((key) => key !== \"htmlAttributes\")\n .map((key) => head[key].toString())\n .join(\"\")}\n {CSSASSETS:<link rel=\"stylesheet\" type=\"text/css\" href=\"{CONTEXT_PATH}/{FILE}\" />:CSSASSETS}\n </head>\n <body class=\"nojs\">\n <div id=\"application\">${props.html}</div>\n <div id=\"portal\"></div>\n <script\n type=\"application/json\"\n data-app-state=\"app-json\"\n data-app-contextpath=\"{CONTEXT_PATH}\"\n data-app-filepath=\"{FILEPATH}\"\n data-app-nonce=\"${props.UUID ?? \"\"}\">${props.state ?? \"\"}</script>\n {JSASSETS:<script src=\"{CONTEXT_PATH}/{FILE}\"></script>:JSASSETS}\n </body>\n </html>\n`;\n\n // It is important to replace the context afterwards,\n // the JSASSESTS and CSSASSETS parts act as a small template for all generated javascript and css files\n // these templates must be pure strings to make it possible to add the context path in all situations\n return template.replace(/{CONTEXT_PATH}/g, props.contextPath).trim();\n};\n\nexport default htmlpage;\n"],"mappings":";;;;;;;;;;;;;;;;;;;AACA;;AAUA;AACA;AACA,IAAMA,QAAQ,GAAG,SAAXA,QAAW,CAACC,KAAD,EAAkC;EAAA;;EACjD,IAAI,CAAAA,KAAK,SAAL,IAAAA,KAAK,WAAL,YAAAA,KAAK,CAAEC,WAAP,MAAuBC,SAA3B,EAAsC;IACpC,MAAM,IAAIC,oCAAJ,CAA6B,8BAA7B,CAAN;EACD;;EACD,IAAIH,KAAK,CAACI,IAAN,KAAeF,SAAnB,EAA8B;IAC5B,MAAM,IAAIC,oCAAJ,CAA6B,yBAA7B,CAAN;EACD;;EAED,kBAAsBH,KAAtB,CAAQK,IAAR;EAAA,IAAQA,IAAR,4BAAe,EAAf;EAEA,IAAMC,QAAQ,6KAEND,IAAI,CAACE,cAAL,GAAsBF,IAAI,CAACE,cAAL,CAAoBC,QAApB,EAAtB,GAAuD,EAFjD,8EAKR,kFAAYH,IAAZ,mBACQ,UAACI,GAAD;IAAA,OAASA,GAAG,KAAK,gBAAjB;EAAA,CADR,mBAEK,UAACA,GAAD;IAAA,OAASJ,IAAI,CAACI,GAAD,CAAJ,CAAUD,QAAV,EAAT;EAAA,CAFL,EAGCE,IAHD,CAGM,EAHN,CALQ,yMAYcV,KAAK,CAACI,IAZpB,0RAmBUJ,KAAK,CAACW,IAnBhB,qDAmBwB,EAnBxB,yCAmB+BX,KAAK,CAACY,KAnBrC,uDAmB8C,EAnB9C,mHAAd,CAViD,CAmCjD;EACA;EACA;;EACA,OAAO,+BAAAN,QAAQ,CAACO,OAAT,CAAiB,iBAAjB,EAAoCb,KAAK,CAACC,WAA1C,kBAAP;AACD,CAvCD;;eAyCeF,Q"}
@@ -27,8 +27,7 @@ var _jsxRuntime = require("react/jsx-runtime");
27
27
  */
28
28
  var renderSSRMinimal = function renderSSRMinimal(_ref) {
29
29
  var store = _ref.store,
30
- _ref$theme = _ref.theme,
31
- theme = _ref$theme === void 0 ? {} : _ref$theme,
30
+ theme = _ref.theme,
32
31
  _ref$UUID = _ref.UUID,
33
32
  UUID = _ref$UUID === void 0 ? "" : _ref$UUID,
34
33
  render = _ref.render,
@@ -16,7 +16,7 @@ import type { ReduxStore } from "../redux/types";
16
16
  import type { TemplateProps } from "./htmlpage";
17
17
  type Props = {
18
18
  store: ReduxStore,
19
- theme: Theme,
19
+ theme?: Theme | Array<Theme>,
20
20
  UUID: string,
21
21
  render: Function,
22
22
  template?: (TemplateProps) => string,
@@ -26,7 +26,7 @@ type Props = {
26
26
  */
27
27
  const renderSSRMinimal = ({
28
28
  store,
29
- theme = {},
29
+ theme,
30
30
  UUID = "",
31
31
  render,
32
32
  template = htmlpage,
@@ -1 +1 @@
1
- {"version":3,"file":"renderSSRMinimal.js","names":["renderSSRMinimal","store","theme","UUID","render","template","htmlpage","sheet","ServerStyleSheet","appHTML","renderToString","instance","head","createHead","contextPath","BASE","html","state","dehydrate"],"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,\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;;AAEA;;AAEA;;AACA;;AAEA;;AAEA;;AACA;;;;AAaA;AACA;AACA,IAAMA,gBAAgB,GAAG,SAAnBA,gBAAmB,OAMJ;EAAA,IALnBC,KAKmB,QALnBA,KAKmB;EAAA,sBAJnBC,KAImB;EAAA,IAJnBA,KAImB,2BAJX,EAIW;EAAA,qBAHnBC,IAGmB;EAAA,IAHnBA,IAGmB,0BAHZ,EAGY;EAAA,IAFnBC,MAEmB,QAFnBA,MAEmB;EAAA,yBADnBC,QACmB;EAAA,IADnBA,QACmB,8BADRC,iBACQ;EACnB,IAAMC,KAAK,GAAG,IAAIC,kCAAJ,EAAd;EAEA,IAAMC,OAAO,GAAG,IAAAC,sBAAA,gBACd,qBAAC,oBAAD;IAAU,KAAK,EAAET,KAAjB;IAAA,uBACE,qBAAC,mCAAD;MAAmB,KAAK,EAAEM,KAAK,CAACI,QAAhC;MAAA,uBACE,qBAAC,sBAAD;QAAe,KAAK,EAAET,KAAtB;QAAA,UAA8BE,MAAM;MAApC;IADF;EADF,EADc,CAAhB;EAQA,IAAMQ,IAAI,GAAG,IAAAC,sBAAA,EAAWN,KAAX,EAAkBJ,IAAlB,CAAb;EACA,OAAOE,QAAQ,CAAC;IACdS,WAAW,EAAEC,eADC;IAEdC,IAAI,EAAEP,OAFQ;IAGdG,IAAI,EAAJA,IAHc;IAIdK,KAAK,EAAE,IAAAC,qBAAA,EAAUjB,KAAV,CAJO;IAKdE,IAAI,EAAJA;EALc,CAAD,CAAf;AAOD,CAzBD;;eA2BeH,gB"}
1
+ {"version":3,"file":"renderSSRMinimal.js","names":["renderSSRMinimal","store","theme","UUID","render","template","htmlpage","sheet","ServerStyleSheet","appHTML","renderToString","instance","head","createHead","contextPath","BASE","html","state","dehydrate"],"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;;AAEA;;AAEA;;AACA;;AAEA;;AAEA;;AACA;;;;AAaA;AACA;AACA,IAAMA,gBAAgB,GAAG,SAAnBA,gBAAmB,OAMJ;EAAA,IALnBC,KAKmB,QALnBA,KAKmB;EAAA,IAJnBC,KAImB,QAJnBA,KAImB;EAAA,qBAHnBC,IAGmB;EAAA,IAHnBA,IAGmB,0BAHZ,EAGY;EAAA,IAFnBC,MAEmB,QAFnBA,MAEmB;EAAA,yBADnBC,QACmB;EAAA,IADnBA,QACmB,8BADRC,iBACQ;EACnB,IAAMC,KAAK,GAAG,IAAIC,kCAAJ,EAAd;EAEA,IAAMC,OAAO,GAAG,IAAAC,sBAAA,gBACd,qBAAC,oBAAD;IAAU,KAAK,EAAET,KAAjB;IAAA,uBACE,qBAAC,mCAAD;MAAmB,KAAK,EAAEM,KAAK,CAACI,QAAhC;MAAA,uBACE,qBAAC,sBAAD;QAAe,KAAK,EAAET,KAAtB;QAAA,UAA8BE,MAAM;MAApC;IADF;EADF,EADc,CAAhB;EAQA,IAAMQ,IAAI,GAAG,IAAAC,sBAAA,EAAWN,KAAX,EAAkBJ,IAAlB,CAAb;EACA,OAAOE,QAAQ,CAAC;IACdS,WAAW,EAAEC,eADC;IAEdC,IAAI,EAAEP,OAFQ;IAGdG,IAAI,EAAJA,IAHc;IAIdK,KAAK,EAAE,IAAAC,qBAAA,EAAUjB,KAAV,CAJO;IAKdE,IAAI,EAAJA;EALc,CAAD,CAAf;AAOD,CAzBD;;eA2BeH,gB"}
@@ -29,8 +29,7 @@ var serverNoSSR = function serverNoSSR(_ref) {
29
29
  customReducers = _ref.customReducers,
30
30
  _ref$serverPreference = _ref.serverPreferences,
31
31
  serverPreferences = _ref$serverPreference === void 0 ? [] : _ref$serverPreference,
32
- _ref$theme = _ref.theme,
33
- theme = _ref$theme === void 0 ? null : _ref$theme,
32
+ theme = _ref.theme,
34
33
  render = _ref.render,
35
34
  template = _ref.template,
36
35
  beforeRenderHooks = _ref.beforeRenderHooks;
@@ -45,7 +44,7 @@ var serverNoSSR = function serverNoSSR(_ref) {
45
44
  if (theme) {
46
45
  var _store$getState, _store$getState$prefe;
47
46
 
48
- var storedTheme = (_store$getState = store.getState()) === null || _store$getState === void 0 ? void 0 : (_store$getState$prefe = _store$getState.preferences) === null || _store$getState$prefe === void 0 ? void 0 : _store$getState$prefe.theme; // $FlowFixMe[incompatible-call]
47
+ var storedTheme = (_store$getState = store.getState()) === null || _store$getState === void 0 ? void 0 : (_store$getState$prefe = _store$getState.preferences) === null || _store$getState$prefe === void 0 ? void 0 : _store$getState$prefe.theme; //$FlowFixMe[incompatible-call]
49
48
 
50
49
  (0, _createTheme.default)(storedTheme, theme);
51
50
  }
@@ -22,11 +22,12 @@ import type { TemplateProps } from "./htmlpage";
22
22
  import type { BeforeRenderHook } from "../redux/store/beforeRenderHooks";
23
23
  import type { PreferenceValue } from "./serverUtil";
24
24
  import type { LocaleConfiguration } from "../i18n/types";
25
+ import type { Theme } from "../react-theme/types";
25
26
  type serverProps = {
26
27
  request: HttpServletRequestJava,
27
28
  locales?: Array<LocaleConfiguration>,
28
29
  customReducers?: Object,
29
- theme?: Object,
30
+ theme?: Theme | Array<Theme>,
30
31
  serverPreferences?: Array<string | PreferenceValue>,
31
32
  render: Function,
32
33
  template?: (TemplateProps) => string,
@@ -40,7 +41,7 @@ const serverNoSSR = ({
40
41
  locales,
41
42
  customReducers,
42
43
  serverPreferences = [],
43
- theme = null,
44
+ theme,
44
45
  render,
45
46
  template,
46
47
  beforeRenderHooks,
@@ -56,7 +57,7 @@ const serverNoSSR = ({
56
57
 
57
58
  if (theme) {
58
59
  const storedTheme = store.getState()?.preferences?.theme;
59
- // $FlowFixMe[incompatible-call]
60
+ //$FlowFixMe[incompatible-call]
60
61
  createTheme(storedTheme, theme);
61
62
  }
62
63
 
@@ -1 +1 @@
1
- {"version":3,"file":"serverNoSSR.js","names":["serverNoSSR","request","locales","customReducers","serverPreferences","theme","render","template","beforeRenderHooks","UUID","createUUID","__webpack_nonce__","requestHref","getFullRequestHref","store","createReduxStore","setServerPreferences","setConfigurationTheme","storedTheme","getState","preferences","createTheme","setI18n","handleErrors","handleBeforeRenderHooks","renderSSRMinimal"],"sources":["../../src/react-server/serverNoSSR.js"],"sourcesContent":["// @flow\nimport \"./contextPath\";\n\nimport createUUID from \"../utils/helpers/createUUID\";\nimport { getFullRequestHref } from \"./requestInformation\";\n\nimport {\n createReduxStore,\n setI18n,\n setServerPreferences,\n setConfigurationTheme,\n handleErrors,\n} from \"./serverUtil\";\n\nimport { handleBeforeRenderHooks } from \"../redux/store/beforeRenderHooks\";\n\nimport renderSSRMinimal from \"./renderSSRMinimal\";\n\nimport createTheme from \"../react-theme/createTheme\";\n\nimport type { TemplateProps } from \"./htmlpage\";\nimport type { BeforeRenderHook } from \"../redux/store/beforeRenderHooks\";\nimport type { PreferenceValue } from \"./serverUtil\";\nimport type { LocaleConfiguration } from \"../i18n/types\";\ntype serverProps = {\n request: HttpServletRequestJava,\n locales?: Array<LocaleConfiguration>,\n customReducers?: Object,\n theme?: Object,\n serverPreferences?: Array<string | PreferenceValue>,\n render: Function,\n template?: (TemplateProps) => string,\n beforeRenderHooks?: Array<BeforeRenderHook>,\n};\n\n/**\n */\nconst serverNoSSR = ({\n request,\n locales,\n customReducers,\n serverPreferences = [],\n theme = null,\n render,\n template,\n beforeRenderHooks,\n}: serverProps): string => {\n const UUID = createUUID();\n __webpack_nonce__ = UUID; // NOSONAR\n\n const requestHref = getFullRequestHref(request);\n const store = createReduxStore(requestHref, customReducers);\n\n setServerPreferences(store, serverPreferences);\n setConfigurationTheme(store);\n\n if (theme) {\n const storedTheme = store.getState()?.preferences?.theme;\n // $FlowFixMe[incompatible-call]\n createTheme(storedTheme, theme);\n }\n\n setI18n(store, locales, request);\n\n handleErrors(store);\n\n handleBeforeRenderHooks(beforeRenderHooks, { store, request });\n\n return renderSSRMinimal({ store, theme, UUID, render, template });\n};\n\nexport default serverNoSSR;\n"],"mappings":";;;;;;;;;AACA;;AAEA;;AACA;;AAEA;;AAQA;;AAEA;;AAEA;;AAiBA;AACA;AACA,IAAMA,WAAW,GAAG,SAAdA,WAAc,OASO;EAAA,IARzBC,OAQyB,QARzBA,OAQyB;EAAA,IAPzBC,OAOyB,QAPzBA,OAOyB;EAAA,IANzBC,cAMyB,QANzBA,cAMyB;EAAA,iCALzBC,iBAKyB;EAAA,IALzBA,iBAKyB,sCALL,EAKK;EAAA,sBAJzBC,KAIyB;EAAA,IAJzBA,KAIyB,2BAJjB,IAIiB;EAAA,IAHzBC,MAGyB,QAHzBA,MAGyB;EAAA,IAFzBC,QAEyB,QAFzBA,QAEyB;EAAA,IADzBC,iBACyB,QADzBA,iBACyB;EACzB,IAAMC,IAAI,GAAG,IAAAC,mBAAA,GAAb;EACAC,iBAAiB,GAAGF,IAApB,CAFyB,CAEC;;EAE1B,IAAMG,WAAW,GAAG,IAAAC,sCAAA,EAAmBZ,OAAnB,CAApB;EACA,IAAMa,KAAK,GAAG,IAAAC,4BAAA,EAAiBH,WAAjB,EAA8BT,cAA9B,CAAd;EAEA,IAAAa,gCAAA,EAAqBF,KAArB,EAA4BV,iBAA5B;EACA,IAAAa,iCAAA,EAAsBH,KAAtB;;EAEA,IAAIT,KAAJ,EAAW;IAAA;;IACT,IAAMa,WAAW,sBAAGJ,KAAK,CAACK,QAAN,EAAH,6EAAG,gBAAkBC,WAArB,0DAAG,sBAA+Bf,KAAnD,CADS,CAET;;IACA,IAAAgB,oBAAA,EAAYH,WAAZ,EAAyBb,KAAzB;EACD;;EAED,IAAAiB,mBAAA,EAAQR,KAAR,EAAeZ,OAAf,EAAwBD,OAAxB;EAEA,IAAAsB,wBAAA,EAAaT,KAAb;EAEA,IAAAU,0CAAA,EAAwBhB,iBAAxB,EAA2C;IAAEM,KAAK,EAALA,KAAF;IAASb,OAAO,EAAPA;EAAT,CAA3C;EAEA,OAAO,IAAAwB,yBAAA,EAAiB;IAAEX,KAAK,EAALA,KAAF;IAAST,KAAK,EAALA,KAAT;IAAgBI,IAAI,EAAJA,IAAhB;IAAsBH,MAAM,EAANA,MAAtB;IAA8BC,QAAQ,EAARA;EAA9B,CAAjB,CAAP;AACD,CAhCD;;eAkCeP,W"}
1
+ {"version":3,"file":"serverNoSSR.js","names":["serverNoSSR","request","locales","customReducers","serverPreferences","theme","render","template","beforeRenderHooks","UUID","createUUID","__webpack_nonce__","requestHref","getFullRequestHref","store","createReduxStore","setServerPreferences","setConfigurationTheme","storedTheme","getState","preferences","createTheme","setI18n","handleErrors","handleBeforeRenderHooks","renderSSRMinimal"],"sources":["../../src/react-server/serverNoSSR.js"],"sourcesContent":["// @flow\nimport \"./contextPath\";\n\nimport createUUID from \"../utils/helpers/createUUID\";\nimport { getFullRequestHref } from \"./requestInformation\";\n\nimport {\n createReduxStore,\n setI18n,\n setServerPreferences,\n setConfigurationTheme,\n handleErrors,\n} from \"./serverUtil\";\n\nimport { handleBeforeRenderHooks } from \"../redux/store/beforeRenderHooks\";\n\nimport renderSSRMinimal from \"./renderSSRMinimal\";\n\nimport createTheme from \"../react-theme/createTheme\";\n\nimport type { TemplateProps } from \"./htmlpage\";\nimport type { BeforeRenderHook } from \"../redux/store/beforeRenderHooks\";\nimport type { PreferenceValue } from \"./serverUtil\";\nimport type { LocaleConfiguration } from \"../i18n/types\";\nimport type { Theme } from \"../react-theme/types\";\ntype serverProps = {\n request: HttpServletRequestJava,\n locales?: Array<LocaleConfiguration>,\n customReducers?: Object,\n theme?: Theme | Array<Theme>,\n serverPreferences?: Array<string | PreferenceValue>,\n render: Function,\n template?: (TemplateProps) => string,\n beforeRenderHooks?: Array<BeforeRenderHook>,\n};\n\n/**\n */\nconst serverNoSSR = ({\n request,\n locales,\n customReducers,\n serverPreferences = [],\n theme,\n render,\n template,\n beforeRenderHooks,\n}: serverProps): string => {\n const UUID = createUUID();\n __webpack_nonce__ = UUID; // NOSONAR\n\n const requestHref = getFullRequestHref(request);\n const store = createReduxStore(requestHref, customReducers);\n\n setServerPreferences(store, serverPreferences);\n setConfigurationTheme(store);\n\n if (theme) {\n const storedTheme = store.getState()?.preferences?.theme;\n //$FlowFixMe[incompatible-call]\n createTheme(storedTheme, theme);\n }\n\n setI18n(store, locales, request);\n\n handleErrors(store);\n\n handleBeforeRenderHooks(beforeRenderHooks, { store, request });\n\n return renderSSRMinimal({ store, theme, UUID, render, template });\n};\n\nexport default serverNoSSR;\n"],"mappings":";;;;;;;;;AACA;;AAEA;;AACA;;AAEA;;AAQA;;AAEA;;AAEA;;AAkBA;AACA;AACA,IAAMA,WAAW,GAAG,SAAdA,WAAc,OASO;EAAA,IARzBC,OAQyB,QARzBA,OAQyB;EAAA,IAPzBC,OAOyB,QAPzBA,OAOyB;EAAA,IANzBC,cAMyB,QANzBA,cAMyB;EAAA,iCALzBC,iBAKyB;EAAA,IALzBA,iBAKyB,sCALL,EAKK;EAAA,IAJzBC,KAIyB,QAJzBA,KAIyB;EAAA,IAHzBC,MAGyB,QAHzBA,MAGyB;EAAA,IAFzBC,QAEyB,QAFzBA,QAEyB;EAAA,IADzBC,iBACyB,QADzBA,iBACyB;EACzB,IAAMC,IAAI,GAAG,IAAAC,mBAAA,GAAb;EACAC,iBAAiB,GAAGF,IAApB,CAFyB,CAEC;;EAE1B,IAAMG,WAAW,GAAG,IAAAC,sCAAA,EAAmBZ,OAAnB,CAApB;EACA,IAAMa,KAAK,GAAG,IAAAC,4BAAA,EAAiBH,WAAjB,EAA8BT,cAA9B,CAAd;EAEA,IAAAa,gCAAA,EAAqBF,KAArB,EAA4BV,iBAA5B;EACA,IAAAa,iCAAA,EAAsBH,KAAtB;;EAEA,IAAIT,KAAJ,EAAW;IAAA;;IACT,IAAMa,WAAW,sBAAGJ,KAAK,CAACK,QAAN,EAAH,6EAAG,gBAAkBC,WAArB,0DAAG,sBAA+Bf,KAAnD,CADS,CAET;;IACA,IAAAgB,oBAAA,EAAYH,WAAZ,EAAyBb,KAAzB;EACD;;EAED,IAAAiB,mBAAA,EAAQR,KAAR,EAAeZ,OAAf,EAAwBD,OAAxB;EAEA,IAAAsB,wBAAA,EAAaT,KAAb;EAEA,IAAAU,0CAAA,EAAwBhB,iBAAxB,EAA2C;IAAEM,KAAK,EAALA,KAAF;IAASb,OAAO,EAAPA;EAAT,CAA3C;EAEA,OAAO,IAAAwB,yBAAA,EAAiB;IAAEX,KAAK,EAALA,KAAF;IAAST,KAAK,EAALA,KAAT;IAAgBI,IAAI,EAAJA,IAAhB;IAAsBH,MAAM,EAANA,MAAtB;IAA8BC,QAAQ,EAARA;EAA9B,CAAjB,CAAP;AACD,CAhCD;;eAkCeP,W"}
@@ -18,7 +18,8 @@ var _jsxRuntime = require("react/jsx-runtime");
18
18
  /**
19
19
  */
20
20
  var ThemeProvider = function ThemeProvider(_ref) {
21
- var theme = _ref.theme,
21
+ var _ref$theme = _ref.theme,
22
+ theme = _ref$theme === void 0 ? {} : _ref$theme,
22
23
  children = _ref.children;
23
24
  var storedTheme = (0, _reactRedux.useSelector)(function (_ref2) {
24
25
  var preferences = _ref2.preferences;
@@ -8,13 +8,13 @@ import type { Node } from "react";
8
8
  import type { Theme } from "./types";
9
9
 
10
10
  export type Props = {
11
- +theme: Theme | Array<Theme>,
11
+ +theme?: Theme | Array<Theme>,
12
12
  +children: Node,
13
13
  };
14
14
 
15
15
  /**
16
16
  */
17
- const ThemeProvider = ({ theme, children }: Props): Node => {
17
+ const ThemeProvider = ({ theme = {}, children }: Props): Node => {
18
18
  const storedTheme = useSelector(({ preferences }) => preferences.theme);
19
19
  const finalTheme = createTheme(storedTheme, theme);
20
20
 
@@ -1 +1 @@
1
- {"version":3,"file":"ThemeProvider.js","names":["ThemeProvider","theme","children","storedTheme","useSelector","preferences","finalTheme","createTheme","displayName"],"sources":["../../src/react-theme/ThemeProvider.js"],"sourcesContent":["// @flow\nimport { useSelector } from \"react-redux\";\nimport { ThemeProvider as SCThemeProvider } from \"styled-components\";\n\nimport createTheme from \"./createTheme\";\n\nimport type { Node } from \"react\";\nimport type { Theme } from \"./types\";\n\nexport type Props = {\n +theme: Theme | Array<Theme>,\n +children: Node,\n};\n\n/**\n */\nconst ThemeProvider = ({ theme, children }: Props): Node => {\n const storedTheme = useSelector(({ preferences }) => preferences.theme);\n const finalTheme = createTheme(storedTheme, theme);\n\n return <SCThemeProvider theme={finalTheme}>{children}</SCThemeProvider>;\n};\nThemeProvider.displayName = \"BI.ThemeProvider\";\n\nexport default ThemeProvider;\n"],"mappings":";;;;;;;;;AACA;;AACA;;AAEA;;;;AAUA;AACA;AACA,IAAMA,aAAa,GAAG,SAAhBA,aAAgB,OAAsC;EAAA,IAAnCC,KAAmC,QAAnCA,KAAmC;EAAA,IAA5BC,QAA4B,QAA5BA,QAA4B;EAC1D,IAAMC,WAAW,GAAG,IAAAC,uBAAA,EAAY;IAAA,IAAGC,WAAH,SAAGA,WAAH;IAAA,OAAqBA,WAAW,CAACJ,KAAjC;EAAA,CAAZ,CAApB;EACA,IAAMK,UAAU,GAAG,IAAAC,oBAAA,EAAYJ,WAAZ,EAAyBF,KAAzB,CAAnB;EAEA,oBAAO,qBAAC,+BAAD;IAAiB,KAAK,EAAEK,UAAxB;IAAA,UAAqCJ;EAArC,EAAP;AACD,CALD;;AAMAF,aAAa,CAACQ,WAAd,GAA4B,kBAA5B;eAEeR,a"}
1
+ {"version":3,"file":"ThemeProvider.js","names":["ThemeProvider","theme","children","storedTheme","useSelector","preferences","finalTheme","createTheme","displayName"],"sources":["../../src/react-theme/ThemeProvider.js"],"sourcesContent":["// @flow\nimport { useSelector } from \"react-redux\";\nimport { ThemeProvider as SCThemeProvider } from \"styled-components\";\n\nimport createTheme from \"./createTheme\";\n\nimport type { Node } from \"react\";\nimport type { Theme } from \"./types\";\n\nexport type Props = {\n +theme?: Theme | Array<Theme>,\n +children: Node,\n};\n\n/**\n */\nconst ThemeProvider = ({ theme = {}, children }: Props): Node => {\n const storedTheme = useSelector(({ preferences }) => preferences.theme);\n const finalTheme = createTheme(storedTheme, theme);\n\n return <SCThemeProvider theme={finalTheme}>{children}</SCThemeProvider>;\n};\nThemeProvider.displayName = \"BI.ThemeProvider\";\n\nexport default ThemeProvider;\n"],"mappings":";;;;;;;;;AACA;;AACA;;AAEA;;;;AAUA;AACA;AACA,IAAMA,aAAa,GAAG,SAAhBA,aAAgB,OAA2C;EAAA,sBAAxCC,KAAwC;EAAA,IAAxCA,KAAwC,2BAAhC,EAAgC;EAAA,IAA5BC,QAA4B,QAA5BA,QAA4B;EAC/D,IAAMC,WAAW,GAAG,IAAAC,uBAAA,EAAY;IAAA,IAAGC,WAAH,SAAGA,WAAH;IAAA,OAAqBA,WAAW,CAACJ,KAAjC;EAAA,CAAZ,CAApB;EACA,IAAMK,UAAU,GAAG,IAAAC,oBAAA,EAAYJ,WAAZ,EAAyBF,KAAzB,CAAnB;EAEA,oBAAO,qBAAC,+BAAD;IAAiB,KAAK,EAAEK,UAAxB;IAAA,UAAqCJ;EAArC,EAAP;AACD,CALD;;AAMAF,aAAa,CAACQ,WAAd,GAA4B,kBAA5B;eAEeR,a"}
@@ -1,6 +1,6 @@
1
1
  import configureMockStore from "redux-mock-store";
2
2
  import { Provider } from "react-redux";
3
- import { renderHook } from "@testing-library/react-hooks";
3
+ import { renderHook } from "@testing-library/react";
4
4
  import {
5
5
  useLocation,
6
6
  useLocationKey,