@beinformed/ui 1.25.1 → 1.25.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +18 -0
- package/esm/constants/Constants.js +5 -0
- package/esm/constants/Constants.js.map +1 -1
- package/esm/hooks/useAuthentication.js +5 -5
- package/esm/hooks/useAuthentication.js.map +1 -1
- package/esm/hooks/useModularUI.js.map +1 -1
- package/esm/hooks/useModularUIBasic.js +3 -0
- package/esm/hooks/useModularUIBasic.js.map +1 -1
- package/esm/hooks/useModularUIModel.js +7 -0
- package/esm/hooks/useModularUIModel.js.map +1 -1
- package/esm/hooks/useModularUIRequest.js +5 -7
- package/esm/hooks/useModularUIRequest.js.map +1 -1
- package/esm/models/application/ApplicationModel.js +9 -1
- package/esm/models/application/ApplicationModel.js.map +1 -1
- package/esm/models/base/BaseModel.js +11 -2
- package/esm/models/base/BaseModel.js.map +1 -1
- package/esm/models/base/ResourceModel.js +8 -1
- package/esm/models/base/ResourceModel.js.map +1 -1
- package/esm/models/caseview/CaseViewModel.js +6 -0
- package/esm/models/caseview/CaseViewModel.js.map +1 -1
- package/esm/models/concepts/BusinessScenarioModel.js +6 -0
- package/esm/models/concepts/BusinessScenarioModel.js.map +1 -1
- package/esm/models/concepts/ConceptDetailModel.js +6 -0
- package/esm/models/concepts/ConceptDetailModel.js.map +1 -1
- package/esm/models/concepts/ConceptIndexModel.js +6 -0
- package/esm/models/concepts/ConceptIndexModel.js.map +1 -1
- package/esm/models/concepts/ConceptTypeDetailModel.js +6 -0
- package/esm/models/concepts/ConceptTypeDetailModel.js.map +1 -1
- package/esm/models/content/ContentIndexModel.js +6 -0
- package/esm/models/content/ContentIndexModel.js.map +1 -1
- package/esm/models/content/ContentModel.js +6 -0
- package/esm/models/content/ContentModel.js.map +1 -1
- package/esm/models/content/ContentTOCModel.js +6 -0
- package/esm/models/content/ContentTOCModel.js.map +1 -1
- package/esm/models/content/ContentTypeModel.js +6 -0
- package/esm/models/content/ContentTypeModel.js.map +1 -1
- package/esm/models/detail/DetailModel.js +6 -0
- package/esm/models/detail/DetailModel.js.map +1 -1
- package/esm/models/form/FormModel.js +6 -0
- package/esm/models/form/FormModel.js.map +1 -1
- package/esm/models/form/FormObjectModel.js +45 -16
- package/esm/models/form/FormObjectModel.js.map +1 -1
- package/esm/models/list/ListDetailModel.js +6 -0
- package/esm/models/list/ListDetailModel.js.map +1 -1
- package/esm/models/list/ListModel.js +6 -0
- package/esm/models/list/ListModel.js.map +1 -1
- package/esm/models/lookup/LookupOptionsModel.js +6 -0
- package/esm/models/lookup/LookupOptionsModel.js.map +1 -1
- package/esm/models/modelcatalog/ModelCatalogModel.js +6 -0
- package/esm/models/modelcatalog/ModelCatalogModel.js.map +1 -1
- package/esm/models/panels/GroupingPanelModel.js +6 -0
- package/esm/models/panels/GroupingPanelModel.js.map +1 -1
- package/esm/models/resolveModel.js +4 -4
- package/esm/models/resolveModel.js.map +1 -1
- package/esm/models/search/CaseSearchModel.js +6 -0
- package/esm/models/search/CaseSearchModel.js.map +1 -1
- package/esm/models/tab/TabModel.js +6 -0
- package/esm/models/tab/TabModel.js.map +1 -1
- package/esm/models/taskgroup/TaskGroupModel.js +6 -0
- package/esm/models/taskgroup/TaskGroupModel.js.map +1 -1
- package/esm/models/types.js.map +1 -1
- package/esm/models/user/UserModel.js +6 -0
- package/esm/models/user/UserModel.js.map +1 -1
- package/esm/models/user/UserProfileModel.js +6 -0
- package/esm/models/user/UserProfileModel.js.map +1 -1
- package/esm/models/user/UserServicesModel.js +6 -0
- package/esm/models/user/UserServicesModel.js.map +1 -1
- package/esm/modularui/ModularUIRequest.js +38 -11
- package/esm/modularui/ModularUIRequest.js.map +1 -1
- package/esm/modularui/types.js +2 -0
- package/esm/modularui/types.js.map +1 -0
- package/esm/redux/_modularui/ModularUIActions.js.map +1 -1
- package/esm/redux/_modularui/ModularUIMiddleware.js.map +1 -1
- package/esm/redux/_modularui/types.js.map +1 -1
- package/esm/redux/_modularui/withModularUI.js.map +1 -1
- package/esm/utils/fetch/types.js.map +1 -1
- package/lib/constants/Constants.js +7 -1
- package/lib/constants/Constants.js.flow +6 -0
- package/lib/constants/Constants.js.map +1 -1
- package/lib/hooks/__tests__/UseModularUIModel.spec.js.flow +1 -1
- package/lib/hooks/__tests__/useModelCatalog.spec.js.flow +1 -1
- package/lib/hooks/__tests__/useModularUIBasic.spec.js.flow +2 -2
- package/lib/hooks/useAuthentication.js +4 -4
- package/lib/hooks/useAuthentication.js.flow +17 -5
- package/lib/hooks/useAuthentication.js.map +1 -1
- package/lib/hooks/useModularUI.js.flow +2 -2
- package/lib/hooks/useModularUI.js.map +1 -1
- package/lib/hooks/useModularUIBasic.js +3 -0
- package/lib/hooks/useModularUIBasic.js.flow +6 -3
- package/lib/hooks/useModularUIBasic.js.map +1 -1
- package/lib/hooks/useModularUIModel.js +9 -1
- package/lib/hooks/useModularUIModel.js.flow +18 -10
- package/lib/hooks/useModularUIModel.js.map +1 -1
- package/lib/hooks/useModularUIRequest.js +5 -7
- package/lib/hooks/useModularUIRequest.js.flow +12 -11
- package/lib/hooks/useModularUIRequest.js.map +1 -1
- package/lib/models/application/ApplicationModel.js +8 -1
- package/lib/models/application/ApplicationModel.js.flow +10 -1
- package/lib/models/application/ApplicationModel.js.map +1 -1
- package/lib/models/base/BaseModel.js +11 -2
- package/lib/models/base/BaseModel.js.flow +12 -3
- package/lib/models/base/BaseModel.js.map +1 -1
- package/lib/models/base/ResourceModel.js +8 -1
- package/lib/models/base/ResourceModel.js.flow +8 -1
- package/lib/models/base/ResourceModel.js.map +1 -1
- package/lib/models/caseview/CaseViewModel.js +6 -0
- package/lib/models/caseview/CaseViewModel.js.flow +6 -0
- package/lib/models/caseview/CaseViewModel.js.map +1 -1
- package/lib/models/concepts/BusinessScenarioModel.js +6 -0
- package/lib/models/concepts/BusinessScenarioModel.js.flow +6 -0
- package/lib/models/concepts/BusinessScenarioModel.js.map +1 -1
- package/lib/models/concepts/ConceptDetailModel.js +6 -0
- package/lib/models/concepts/ConceptDetailModel.js.flow +6 -0
- package/lib/models/concepts/ConceptDetailModel.js.map +1 -1
- package/lib/models/concepts/ConceptIndexModel.js +6 -0
- package/lib/models/concepts/ConceptIndexModel.js.flow +6 -0
- package/lib/models/concepts/ConceptIndexModel.js.map +1 -1
- package/lib/models/concepts/ConceptTypeDetailModel.js +6 -0
- package/lib/models/concepts/ConceptTypeDetailModel.js.flow +6 -0
- package/lib/models/concepts/ConceptTypeDetailModel.js.map +1 -1
- package/lib/models/content/ContentIndexModel.js +6 -0
- package/lib/models/content/ContentIndexModel.js.flow +6 -0
- package/lib/models/content/ContentIndexModel.js.map +1 -1
- package/lib/models/content/ContentModel.js +6 -0
- package/lib/models/content/ContentModel.js.flow +6 -0
- package/lib/models/content/ContentModel.js.map +1 -1
- package/lib/models/content/ContentTOCModel.js +6 -0
- package/lib/models/content/ContentTOCModel.js.flow +6 -0
- package/lib/models/content/ContentTOCModel.js.map +1 -1
- package/lib/models/content/ContentTypeModel.js +6 -0
- package/lib/models/content/ContentTypeModel.js.flow +6 -0
- package/lib/models/content/ContentTypeModel.js.map +1 -1
- package/lib/models/detail/DetailModel.js +6 -0
- package/lib/models/detail/DetailModel.js.flow +6 -0
- package/lib/models/detail/DetailModel.js.map +1 -1
- package/lib/models/form/FormModel.js +6 -0
- package/lib/models/form/FormModel.js.flow +6 -0
- package/lib/models/form/FormModel.js.map +1 -1
- package/lib/models/form/FormObjectModel.js +45 -16
- package/lib/models/form/FormObjectModel.js.flow +71 -24
- package/lib/models/form/FormObjectModel.js.map +1 -1
- package/lib/models/form/__tests__/FormModel.repeating.spec.js.flow +4 -0
- package/lib/models/list/ListDetailModel.js +6 -0
- package/lib/models/list/ListDetailModel.js.flow +6 -0
- package/lib/models/list/ListDetailModel.js.map +1 -1
- package/lib/models/list/ListModel.js +6 -0
- package/lib/models/list/ListModel.js.flow +6 -0
- package/lib/models/list/ListModel.js.map +1 -1
- package/lib/models/lookup/LookupOptionsModel.js +6 -0
- package/lib/models/lookup/LookupOptionsModel.js.flow +6 -0
- package/lib/models/lookup/LookupOptionsModel.js.map +1 -1
- package/lib/models/modelcatalog/ModelCatalogModel.js +6 -0
- package/lib/models/modelcatalog/ModelCatalogModel.js.flow +6 -0
- package/lib/models/modelcatalog/ModelCatalogModel.js.map +1 -1
- package/lib/models/panels/GroupingPanelModel.js +6 -0
- package/lib/models/panels/GroupingPanelModel.js.flow +6 -0
- package/lib/models/panels/GroupingPanelModel.js.map +1 -1
- package/lib/models/resolveModel.js +4 -3
- package/lib/models/resolveModel.js.flow +6 -4
- package/lib/models/resolveModel.js.map +1 -1
- package/lib/models/search/CaseSearchModel.js +6 -0
- package/lib/models/search/CaseSearchModel.js.flow +6 -0
- package/lib/models/search/CaseSearchModel.js.map +1 -1
- package/lib/models/tab/TabModel.js +6 -0
- package/lib/models/tab/TabModel.js.flow +6 -0
- package/lib/models/tab/TabModel.js.map +1 -1
- package/lib/models/taskgroup/TaskGroupModel.js +6 -0
- package/lib/models/taskgroup/TaskGroupModel.js.flow +6 -0
- package/lib/models/taskgroup/TaskGroupModel.js.map +1 -1
- package/lib/models/types.js.flow +1 -1
- package/lib/models/types.js.map +1 -1
- package/lib/models/user/UserModel.js +6 -0
- package/lib/models/user/UserModel.js.flow +6 -0
- package/lib/models/user/UserModel.js.map +1 -1
- package/lib/models/user/UserProfileModel.js +6 -0
- package/lib/models/user/UserProfileModel.js.flow +6 -0
- package/lib/models/user/UserProfileModel.js.map +1 -1
- package/lib/models/user/UserServicesModel.js +6 -0
- package/lib/models/user/UserServicesModel.js.flow +6 -0
- package/lib/models/user/UserServicesModel.js.map +1 -1
- package/lib/modularui/ModularUIRequest.js +38 -11
- package/lib/modularui/ModularUIRequest.js.flow +65 -17
- package/lib/modularui/ModularUIRequest.js.map +1 -1
- package/lib/modularui/__tests__/ModularUIRequest.spec.js.flow +4 -9
- package/lib/modularui/types.js +2 -0
- package/lib/modularui/types.js.flow +4 -0
- package/lib/modularui/types.js.map +1 -0
- package/lib/redux/_modularui/ModularUIActions.js.flow +4 -4
- package/lib/redux/_modularui/ModularUIActions.js.map +1 -1
- package/lib/redux/_modularui/ModularUIMiddleware.js.flow +3 -2
- package/lib/redux/_modularui/ModularUIMiddleware.js.map +1 -1
- package/lib/redux/_modularui/types.js.flow +4 -3
- package/lib/redux/_modularui/types.js.map +1 -1
- package/lib/redux/_modularui/withModularUI.js.flow +2 -2
- package/lib/redux/_modularui/withModularUI.js.map +1 -1
- package/lib/utils/fetch/types.js.flow +12 -4
- package/lib/utils/fetch/types.js.map +1 -1
- package/package.json +7 -7
- package/src/constants/Constants.js +6 -0
- package/src/hooks/__tests__/UseModularUIModel.spec.js +1 -1
- package/src/hooks/__tests__/useModelCatalog.spec.js +1 -1
- package/src/hooks/__tests__/useModularUIBasic.spec.js +2 -2
- package/src/hooks/useAuthentication.js +17 -5
- package/src/hooks/useModularUI.js +2 -2
- package/src/hooks/useModularUIBasic.js +6 -3
- package/src/hooks/useModularUIModel.js +18 -10
- package/src/hooks/useModularUIRequest.js +12 -11
- package/src/models/application/ApplicationModel.js +10 -1
- package/src/models/base/BaseModel.js +12 -3
- package/src/models/base/ResourceModel.js +8 -1
- package/src/models/caseview/CaseViewModel.js +6 -0
- package/src/models/concepts/BusinessScenarioModel.js +6 -0
- package/src/models/concepts/ConceptDetailModel.js +6 -0
- package/src/models/concepts/ConceptIndexModel.js +6 -0
- package/src/models/concepts/ConceptTypeDetailModel.js +6 -0
- package/src/models/content/ContentIndexModel.js +6 -0
- package/src/models/content/ContentModel.js +6 -0
- package/src/models/content/ContentTOCModel.js +6 -0
- package/src/models/content/ContentTypeModel.js +6 -0
- package/src/models/detail/DetailModel.js +6 -0
- package/src/models/form/FormModel.js +6 -0
- package/src/models/form/FormObjectModel.js +71 -24
- package/src/models/form/__tests__/FormModel.repeating.spec.js +4 -0
- package/src/models/list/ListDetailModel.js +6 -0
- package/src/models/list/ListModel.js +6 -0
- package/src/models/lookup/LookupOptionsModel.js +6 -0
- package/src/models/modelcatalog/ModelCatalogModel.js +6 -0
- package/src/models/panels/GroupingPanelModel.js +6 -0
- package/src/models/resolveModel.js +6 -4
- package/src/models/search/CaseSearchModel.js +6 -0
- package/src/models/tab/TabModel.js +6 -0
- package/src/models/taskgroup/TaskGroupModel.js +6 -0
- package/src/models/types.js +1 -1
- package/src/models/user/UserModel.js +6 -0
- package/src/models/user/UserProfileModel.js +6 -0
- package/src/models/user/UserServicesModel.js +6 -0
- package/src/modularui/ModularUIRequest.js +65 -17
- package/src/modularui/__tests__/ModularUIRequest.spec.js +4 -9
- package/src/modularui/types.js +4 -0
- package/src/redux/_modularui/ModularUIActions.js +4 -4
- package/src/redux/_modularui/ModularUIMiddleware.js +3 -2
- package/src/redux/_modularui/types.js +4 -3
- package/src/redux/_modularui/withModularUI.js +2 -2
- package/src/utils/fetch/types.js +12 -4
- package/types/constants/Constants.d.ts +5 -0
- package/types/models/base/BaseModel.d.ts +12 -3
- package/types/models/base/ResourceModel.d.ts +5 -1
- package/types/models/form/FormObjectModel.d.ts +28 -0
- package/types/models/resolveModel.d.ts +1 -1
- package/types/models/types.d.ts +1 -1
- package/types/modularui/ModularUIRequest.d.ts +15 -7
- package/types/modularui/types.d.ts +2 -0
- package/types/redux/_modularui/types.d.ts +2 -2
- package/types/utils/fetch/types.d.ts +8 -5
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ModularUIRequest.js","names":["ModularUIRequest","constructor","href","options","HTTP_METHODS","GET","IllegalArgumentException","_response","ModularUIResponse","Href","locale","parameters","targetModel","method","contributionsHref","_contributionsHref","_locale","response","_href","_method","_options","withChildModels","childmodels","_targetModel","createModel","Model","resolveModel","isApplicableModel","IllegalStateException","processContributionsService","contributionsData","isPlainObject","contributionsKey","error","handleContributionsError","key","contributions","errorMessage","properties","message","ModularUIError","handleDataError","path","toString","handleData","data","links","_links","Array","isArray","processDataService","fetchContributionsService","universalFetch","url","BASE","cache","fetchDataService","params","getQuerystringForModularUI","onProgress","processAsyncLayoutHints","getSetting","processApplicationLinks","processTabLinks","processPanelLinks","resolve","contributionLinks","dataLinks","contributionTabLink","tab","dataTabLinks","dataLink","name","processLinks","components","then","newLinks","replaceApplicationLinks","tabName","tabLink","component","panel","dataLinksPerName","linksPerName","hideWhenEmptyLinks","contributionLink","layouthint","includes","HIDE_WHEN_EMPTY","isHiddenListChecks","push","isHiddenList","all","hiddenLinks","newDataLinks","dataLinkKey","HIDE_WHEN_EMPTY_IGNORE_TASKS","_embedded","actions","noListItems","noActions","isHidden","catch","progressEvent","_progressEvent","getDynamicValidationData","model","prevData","JSON","parse","FormModel","newData","validationData","deepmerge","loadDynamicValidations","isValidationRequest","currentFormObject","hasDynamicValidations","validationHref","setParameter","updateValidations","fetch","Error","fetchChildModels","fetchFromCache","childModelLinks","getInitialChildModelLinks","childModelRequests","childModelLink","request","isCacheable","allSettled","childModels","resolvedChildModels","forEach","childModel","status","reason","console","value","addChildModels","fetchContent","withChildSections","ContentModel","childSectionLinks","length","fetchContentChildSections","contentModel","newContentModel","clone","childSectionLink","contentHrefWithEntryDate","selfhref","addParameter","TIMEVERSION_FILTER_NAME","entryDate","sectionModels","childSections","post","POST","postForm","form","formdata","update"],"sources":["../../src/modularui/ModularUIRequest.js"],"sourcesContent":["// @flow\nimport deepmerge from \"deepmerge\";\n\nimport {\n BASE,\n HTTP_METHODS,\n TIMEVERSION_FILTER_NAME,\n} from \"../constants/Constants\";\n\nimport { HIDE_WHEN_EMPTY } from \"../constants/LayoutHints\";\n\nimport { getSetting } from \"../constants/Settings\";\n\nimport Href from \"../models/href/Href\";\n\nimport universalFetch from \"../utils/fetch/universalFetch\";\nimport resolveModel from \"../models/resolveModel\";\nimport FormModel from \"../models/form/FormModel\";\nimport ContentModel from \"../models/content/ContentModel\";\n\nimport ModularUIResponse from \"./ModularUIResponse\";\n\nimport ModularUIError from \"./ModularUIError\";\nimport { IllegalArgumentException, IllegalStateException } from \"../exceptions\";\n\nimport { isPlainObject } from \"../utils/helpers/objects\";\n\nimport type { RequestBaseOptions } from \"../utils/fetch/types\";\nimport type { ModularUIModel } from \"../models/types\";\n\n/**\n * Helper for fetching data and contributions from the Be Informed modular ui\n * and merge it into a target or resolvable model.\n */\nclass ModularUIRequest {\n _response: ModularUIResponse;\n\n _href: Href;\n _options: RequestBaseOptions;\n _targetModel: ?Class<ModularUIModel>;\n _contributionsHref: string;\n _locale: string;\n _method: $Keys<typeof HTTP_METHODS> = HTTP_METHODS.GET;\n\n _progressEvent: ProgressEventHandler;\n\n /**\n */\n constructor(href: Href | string, options: $Shape<RequestBaseOptions> = {}) {\n if (!href) {\n throw new IllegalArgumentException(\n \"You must pass a href to the resource that is requested\"\n );\n }\n\n this.options = options;\n\n this._response = new ModularUIResponse();\n\n this.href = typeof href === \"string\" ? new Href(href) : href;\n this.locale = options.locale ?? \"en\";\n\n // copy request parameters to response, to be able to use them in the models\n // self links are missing the request parameters\n this._response.parameters = this.href.parameters;\n\n if (options.targetModel) {\n this.targetModel = options.targetModel;\n }\n\n if (options.method) {\n this.method = options.method;\n } else {\n this.method = this.href.method;\n }\n }\n\n /**\n */\n get contributionsHref(): string {\n return this._contributionsHref;\n }\n\n /**\n */\n set contributionsHref(contributionsHref: string) {\n this._contributionsHref = contributionsHref;\n }\n\n /**\n */\n set locale(locale: string) {\n this._locale = locale;\n this._response.locale = locale;\n }\n\n /**\n */\n get locale(): string {\n return this._locale;\n }\n\n /**\n */\n get response(): ModularUIResponse {\n return this._response;\n }\n\n /**\n */\n set href(href: Href) {\n this._href = href;\n }\n\n /**\n */\n get href(): Href {\n return this._href;\n }\n\n /**\n */\n set method(method: $Keys<typeof HTTP_METHODS>) {\n this._method = method;\n }\n\n /**\n */\n get method(): $Keys<typeof HTTP_METHODS> {\n return this._method;\n }\n\n /**\n */\n get options(): RequestBaseOptions {\n return {\n ...this._options,\n locale: this.locale,\n method: this.method,\n };\n }\n\n /**\n */\n set options(options: RequestBaseOptions) {\n this._options = options;\n }\n\n /**\n */\n get withChildModels(): boolean {\n return (\n !(\"childmodels\" in this.options) || this.options.childmodels === true\n );\n }\n\n /**\n */\n set targetModel(targetModel: ?Class<ModularUIModel>) {\n this._targetModel = targetModel;\n }\n\n /**\n */\n get targetModel(): ?Class<ModularUIModel> {\n return this._targetModel;\n }\n\n /**\n */\n createModel(): ModularUIModel {\n const Model = this.targetModel || resolveModel(this.response);\n\n // check for ResourceModel\n if (Model && Model.isApplicableModel) {\n return new Model(this.response);\n }\n\n throw new IllegalStateException(\n `No model available for data: ${JSON.stringify(this.response)}`\n );\n }\n\n /**\n */\n processContributionsService(contributionsData: Object): void {\n if (!isPlainObject(contributionsData)) {\n throw new IllegalArgumentException(\n \"Missing contributions data or contributions is not JSON\"\n );\n }\n\n const [contributionsKey] = Object.keys(contributionsData);\n\n if (contributionsData.error && contributionsKey === \"error\") {\n this.handleContributionsError(contributionsData.error);\n }\n\n // The key of the data service is different from the contributions service for forms\n if (!(this.response.key in contributionsData)) {\n this.response.key = contributionsKey;\n }\n\n this.response.contributions = contributionsData[this.response.key];\n }\n\n /**\n */\n handleContributionsError(error: Object): void {\n const errorMessage = error.properties?.message ?? \"Error in contribution\";\n throw new ModularUIError(errorMessage, error, this.contributionsHref);\n }\n\n /**\n */\n handleDataError(error: Object): void {\n if (error.properties) {\n const errorMessage = error.properties?.message ?? \"Error in data\";\n throw new ModularUIError(errorMessage, error, this.href.path.toString());\n }\n\n throw new IllegalArgumentException(error);\n }\n\n /**\n */\n handleData(key: string, data: Object): void {\n this.response.key = key;\n this.response.data = data;\n\n const links = data._links;\n\n if (links && links.contributions) {\n this.contributionsHref = links.contributions.href;\n } else if (Array.isArray(links) && links[0].contributions) {\n this.contributionsHref = links[0].contributions.href;\n } else {\n throw new IllegalArgumentException(\n `Contributions link not found for data with key ${key}`\n );\n }\n }\n\n /**\n */\n processDataService(data: Object): void {\n if (!isPlainObject(data)) {\n throw new IllegalArgumentException(\"Missing data or data is not JSON\");\n }\n\n if (data.error) {\n this.handleDataError(data.error);\n } else {\n const [key] = Object.keys(data);\n this.handleData(key, data[key]);\n }\n }\n\n /**\n */\n fetchContributionsService(): Promise<any> {\n if (!this.contributionsHref) {\n throw new IllegalStateException(\"Missing a contributions href\");\n }\n\n return universalFetch({\n url: `${BASE}${this.contributionsHref}`,\n cache: true,\n locale: this.options.locale,\n });\n }\n\n /**\n */\n fetchDataService(): Promise<any> {\n return universalFetch({\n ...this.options,\n url: `${BASE}${this.href.path}`,\n params: this.href.getQuerystringForModularUI(),\n locale: this.options.locale,\n onProgress: this.onProgress,\n });\n }\n\n /**\n * Check if links contain a 'hide-when-empty' layout hint and remove the link from\n * the component when it exists and no results are available\n */\n async processAsyncLayoutHints(): Promise<void> {\n if (getSetting(\"ALLOW_HIDE_WHEN_EMPTY_ON_TABS\")) {\n await this.processApplicationLinks();\n await this.processTabLinks();\n }\n await this.processPanelLinks();\n\n return Promise.resolve();\n }\n\n /**\n * hide application links<br>\n * _links on application data contains an extra level of tab links\n */\n processApplicationLinks(): Promise<void> {\n const contributionLinks = this.response.contributions._links;\n const dataLinks = this.response.data._links;\n if (!contributionLinks || !dataLinks) {\n return Promise.resolve();\n }\n\n if (\"tab\" in contributionLinks && \"tab\" in dataLinks) {\n for (const contributionTabLink of contributionLinks.tab) {\n if (\"components\" in contributionTabLink) {\n const dataTabLinks = dataLinks.tab.find(\n (dataLink) => dataLink.name === contributionTabLink.name\n );\n\n if (dataTabLinks && \"components\" in dataTabLinks) {\n return this.processLinks(\n dataTabLinks.components,\n contributionTabLink.components\n ).then((newLinks) =>\n this.replaceApplicationLinks(contributionTabLink.name, newLinks)\n );\n }\n }\n }\n }\n\n return Promise.resolve();\n }\n\n /**\n * Replace hidden link in application link tree\n */\n replaceApplicationLinks(tabName: string, newLinks: Array<Object>): void {\n this.response.data._links.tab = this.response.data._links.tab.map(\n (tabLink) => {\n const key = tabLink.name;\n if (tabName === key) {\n tabLink.components = newLinks;\n }\n return tabLink;\n }\n );\n }\n\n /**\n */\n processTabLinks(): Promise<void> {\n const contributionLinks = this.response.contributions._links;\n\n if (!contributionLinks) {\n return Promise.resolve();\n }\n\n if (\"component\" in contributionLinks) {\n return this.processLinks(\n this.response.data._links.component,\n contributionLinks.component\n ).then((newLinks) => {\n this.response.data._links.component = newLinks;\n });\n }\n\n return Promise.resolve();\n }\n\n /**\n */\n processPanelLinks(): Promise<void> {\n const contributionLinks = this.response.contributions._links;\n\n if (!contributionLinks) {\n return Promise.resolve();\n }\n\n if (\"panel\" in contributionLinks) {\n return this.processLinks(\n this.response.data._links,\n contributionLinks.panel\n ).then((newLinks) => {\n this.response.data._links = newLinks;\n });\n }\n\n return Promise.resolve();\n }\n\n /**\n * Retrieve an object of key: link\n */\n dataLinksPerName(dataLinks: any): { [linkName: string]: any } {\n if (Array.isArray(dataLinks)) {\n const links = {};\n for (const dataLink of dataLinks) {\n links[dataLink.name] = dataLink;\n }\n return links;\n }\n return dataLinks;\n }\n\n /**\n * Check if links are empty and hide them when hide-when-empty hint exists\n */\n processLinks(\n dataLinks: any,\n contributionLinks: any\n ): Promise<Object | Array<Object>> {\n const linksPerName = this.dataLinksPerName(dataLinks);\n const hideWhenEmptyLinks = contributionLinks.filter((contributionLink) =>\n contributionLink.layouthint?.includes(HIDE_WHEN_EMPTY)\n );\n\n const isHiddenListChecks = [];\n\n for (const contributionLink of hideWhenEmptyLinks) {\n const dataLink = linksPerName[contributionLink.name];\n if (dataLink?.href) {\n isHiddenListChecks.push(\n this.isHiddenList(contributionLink.name, dataLink.href)\n );\n }\n }\n\n return Promise.all(isHiddenListChecks).then(\n (hiddenLinks: Array<string>) => {\n if (Array.isArray(dataLinks)) {\n return dataLinks.filter(\n (dataLink) => !hiddenLinks.includes(dataLink.name)\n );\n }\n\n const newDataLinks: { [string]: any } = {};\n for (const dataLinkKey in dataLinks) {\n if (!hiddenLinks.includes(dataLinkKey)) {\n newDataLinks[dataLinkKey] = dataLinks[dataLinkKey];\n }\n }\n return newDataLinks;\n }\n );\n }\n\n /**\n */\n isHiddenList(name: string, href: string): Promise<string> {\n const HIDE_WHEN_EMPTY_IGNORE_TASKS = getSetting(\n \"HIDE_WHEN_EMPTY_IGNORE_TASKS\",\n false\n );\n\n return universalFetch({\n ...this.options,\n url: `${BASE}${href}`,\n })\n .then((response: Object) => {\n if (isPlainObject(response)) {\n const [key] = Object.keys(response);\n const { _embedded, actions } = response[key];\n\n const noListItems = _embedded === null;\n const noActions = actions == null || HIDE_WHEN_EMPTY_IGNORE_TASKS;\n\n const isHidden = noListItems && noActions;\n if (isHidden) {\n return name;\n }\n }\n return \"\";\n })\n .catch(() => {\n return \"\";\n });\n }\n\n /**\n */\n set onProgress(progressEvent: ProgressEventHandler) {\n this._progressEvent = progressEvent;\n }\n\n /**\n */\n get onProgress(): ProgressEventHandler {\n return this._progressEvent || null;\n }\n\n /**\n * Combine previous send request data with new validation data to create a complete request object\n * The received model is new FormModel containing ONLY the current question, not the previously entered questions\n * to create a complete request we append the originally send form objects\n */\n getDynamicValidationData(model: ModularUIModel): string {\n const prevData =\n typeof this.options.data === \"string\"\n ? JSON.parse(this.options.data)\n : this.options.data;\n\n if (model instanceof FormModel) {\n const newData = JSON.parse(model.validationData);\n // $FlowFixMe incompatible-call\n return JSON.stringify(deepmerge(prevData || {}, newData));\n }\n\n return JSON.stringify(prevData) ?? \"{}\";\n }\n\n /**\n * First load of dynamic values when a form is loaded\n */\n loadDynamicValidations(model: ModularUIModel): Promise<ModularUIModel> {\n if (\n !this.options.isValidationRequest &&\n getSetting(\"USE_INSTANT_SERVER_VALIDATION\") &&\n model instanceof FormModel &&\n model.currentFormObject &&\n model.currentFormObject.hasDynamicValidations\n ) {\n const validationHref = this.href.setParameter(\"commit\", \"false\");\n return universalFetch({\n ...this.options,\n url: `${BASE}${this.href.path}`,\n params: validationHref.getQuerystringForModularUI(),\n childmodels: false,\n data: this.getDynamicValidationData(model),\n }).then((data) => {\n if (data == null || typeof data !== \"object\") {\n return model;\n }\n\n const [key] = Object.keys(data);\n return model.updateValidations(data[key]);\n });\n }\n\n return Promise.resolve(model);\n }\n\n /**\n */\n fetch(): Promise<ModularUIModel> {\n return this.fetchDataService()\n .then((data) => {\n if (data == null) {\n throw new Error(`No data received for ${this.href.toString()}`);\n }\n\n this.processDataService(data);\n return this.fetchContributionsService();\n })\n .then((contributionsData) => {\n if (contributionsData == null) {\n throw new Error(\n `No contributions data received for ${this.contributionsHref}`\n );\n }\n\n this.processContributionsService(contributionsData);\n return this.processAsyncLayoutHints();\n })\n .then(() => Promise.resolve(this.createModel()))\n .then((model) => this.loadDynamicValidations(model))\n .then((model) => {\n if (this.withChildModels) {\n return this.fetchChildModels(model);\n }\n\n return Promise.resolve(model);\n });\n }\n\n /**\n */\n fetchFromCache(): Promise<ModularUIModel> {\n this.options = {\n ...this.options,\n cache: true,\n };\n\n return this.fetch();\n }\n\n /**\n */\n fetchChildModels(model: ModularUIModel): Promise<ModularUIModel> {\n const childModelLinks = model.getInitialChildModelLinks();\n\n const childModelRequests = childModelLinks.map((childModelLink) => {\n const request = new ModularUIRequest(childModelLink.href, {\n locale: this.locale,\n });\n\n if (childModelLink.targetModel) {\n request.targetModel = childModelLink.targetModel;\n }\n\n if (childModelLink.isCacheable) {\n return request.fetchFromCache();\n }\n\n return request.fetch();\n });\n\n return Promise.allSettled(childModelRequests).then((childModels) => {\n const resolvedChildModels = [];\n\n childModels.forEach((childModel) => {\n if (childModel.status === \"rejected\") {\n const { reason } = childModel;\n if (reason.name !== \"Error.ChangePasswordRequired\") {\n console.error(\n \"Unexpected error when retrieving child model:\",\n reason\n );\n }\n } else {\n resolvedChildModels.push(childModel.value);\n }\n });\n\n model.addChildModels(resolvedChildModels);\n\n return model;\n });\n }\n\n /**\n */\n fetchContent(withChildSections: boolean): Promise<mixed> {\n return this.fetchFromCache().then((model) => {\n if (\n withChildSections &&\n model instanceof ContentModel &&\n model.childSectionLinks.length > 0\n ) {\n return this.fetchContentChildSections(model);\n }\n\n return Promise.resolve(model);\n });\n }\n\n /**\n * Recursively return child sections defined on the content model\n */\n fetchContentChildSections(contentModel: ContentModel): Promise<mixed> {\n const newContentModel = contentModel.clone();\n\n return Promise.all(\n contentModel.childSectionLinks.map((childSectionLink) => {\n const contentHrefWithEntryDate = childSectionLink.selfhref.addParameter(\n TIMEVERSION_FILTER_NAME,\n contentModel.entryDate\n );\n\n const request = new ModularUIRequest(contentHrefWithEntryDate, {\n locale: this.locale,\n });\n\n return request.fetchContent(true);\n })\n ).then((sectionModels) => {\n newContentModel.childSections = sectionModels;\n\n return newContentModel;\n });\n }\n\n /**\n * Make a post request with optionally data to send\n * @param data\n */\n post(data?: string | { [key: string]: string }): Promise<ModularUIModel> {\n this.method = HTTP_METHODS.POST;\n this.options = {\n ...this.options,\n data,\n };\n\n return this.fetch();\n }\n\n /**\n * Make a POST request using the form, an updated form is returned (merge of old and new form)\n * @param form\n * @returns {Promise<FormModel>}\n */\n postForm(form: FormModel): Promise<FormModel> {\n this.method = HTTP_METHODS.POST;\n this.options = {\n ...this.options,\n data: form.formdata,\n };\n\n return this.fetch().then((response) => {\n return form.update(response);\n });\n }\n}\n\nexport default ModularUIRequest;\n"],"mappings":";;;;;;;;;;;;;;;AACA;AAEA;AAMA;AAEA;AAEA;AAEA;AACA;AACA;AACA;AAEA;AAEA;AACA;AAEA;AAKA;AACA;AACA;AACA;AACA,MAAMA,gBAAgB,CAAC;EAYrB;AACF;EACEC,WAAW,CAACC,IAAmB,EAA4C;IAAA,IAA1CC,OAAmC,uEAAG,CAAC,CAAC;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA;IAAA,+CANnCC,uBAAY,CAACC,GAAG;IAAA;IAOpD,IAAI,CAACH,IAAI,EAAE;MACT,MAAM,IAAII,oCAAwB,CAChC,wDAAwD,CACzD;IACH;IAEA,IAAI,CAACH,OAAO,GAAGA,OAAO;IAEtB,IAAI,CAACI,SAAS,GAAG,IAAIC,0BAAiB,EAAE;IAExC,IAAI,CAACN,IAAI,GAAG,OAAOA,IAAI,KAAK,QAA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GAAGD,aAAa;MAE7C,OAAOR,eAAe;IACxB,CAAC,CAAC;EACJ;;EAEA;AACF;AACA;AACA;EACEU,IAAI,CAACjH,IAAyC,EAA2B;IACvE,IAAI,CAAChC,MAAM,GAAGT,uBAAY,CAAC2J,IAAI;IAC/B,IAAI,CAAC5J,OAAO,GAAG;MACb,GAAG,IAAI,CAACA,OAAO;MACf0C;IACF,CAAC;IAED,OAAO,IAAI,CAAC4E,KAAK,EAAE;EACrB;;EAEA;AACF;AACA;AACA;AACA;EACEuC,QAAQ,CAACC,IAAe,EAAsB;IAC5C,IAAI,CAACpJ,MAAM,GAAGT,uBAAY,CAAC2J,IAAI;IAC/B,IAAI,CAAC5J,OAAO,GAAG;MACb,GAAG,IAAI,CAACA,OAAO;MACf0C,IAAI,EAAEoH,IAAI,CAACC;IACb,CAAC;IAED,OAAO,IAAI,CAACzC,KAAK,EAAE,CAAC9C,IAAI,CAAE1D,QAAQ,IAAK;MACrC,OAAOgJ,IAAI,CAACE,MAAM,CAAClJ,QAAQ,CAAC;IAC9B,CAAC,CAAC;EACJ;AACF;AAAC,eAEcjB,gBAAgB;AAAA"}
|
|
1
|
+
{"version":3,"file":"ModularUIRequest.js","names":["ModularUIRequest","constructor","href","options","HTTP_METHODS","GET","IllegalArgumentException","_response","ModularUIResponse","Href","locale","parameters","targetModel","method","contributionsHref","_contributionsHref","_locale","response","_href","_method","_options","requestOptions","updateModel","childmodels","isValidationRequest","removeOnUnmount","withChildModels","_targetModel","resolveModel","availableModels","Array","isArray","Model","isApplicableModel","IllegalStateException","m","modelName","join","createModel","processContributionsService","contributionsData","isPlainObject","contributionsKey","error","handleContributionsError","key","contributions","errorMessage","properties","message","ModularUIError","handleDataError","path","toString","handleData","data","links","_links","processDataService","fetchContributionsService","universalFetch","url","BASE","cache","fetchDataService","params","getQuerystringForModularUI","onProgress","processAsyncLayoutHints","getSetting","processApplicationLinks","processTabLinks","processPanelLinks","resolve","contributionLinks","dataLinks","contributionTabLink","tab","dataTabLinks","dataLink","name","processLinks","components","then","newLinks","replaceApplicationLinks","tabName","tabLink","component","panel","dataLinksPerName","linksPerName","hideWhenEmptyLinks","contributionLink","layouthint","includes","HIDE_WHEN_EMPTY","isHiddenListChecks","push","isHiddenList","all","hiddenLinks","newDataLinks","dataLinkKey","HIDE_WHEN_EMPTY_IGNORE_TASKS","_embedded","actions","noListItems","noActions","isHidden","catch","progressEvent","_progressEvent","getDynamicValidationData","model","prevData","JSON","parse","FormModel","newData","validationData","deepmerge","loadDynamicValidations","currentFormObject","hasDynamicValidations","validationHref","setParameter","updateValidations","fetch","Error","fetchChildModels","fetchFromCache","childModelLinks","getInitialChildModelLinks","childModelRequests","childModelLink","request","isCacheable","allSettled","childModels","resolvedChildModels","forEach","childModel","status","reason","console","value","addChildModels","fetchContent","withChildSections","ContentModel","childSectionLinks","length","fetchContentChildSections","contentModel","newContentModel","clone","childSectionLink","contentHrefWithEntryDate","selfhref","addParameter","TIMEVERSION_FILTER_NAME","entryDate","sectionModels","childSections","post","POST","postForm","form","formdata","update"],"sources":["../../src/modularui/ModularUIRequest.js"],"sourcesContent":["// @flow\nimport deepmerge from \"deepmerge\";\n\nimport {\n BASE,\n HTTP_METHODS,\n TIMEVERSION_FILTER_NAME,\n} from \"../constants/Constants\";\n\nimport { HIDE_WHEN_EMPTY } from \"../constants/LayoutHints\";\n\nimport { getSetting } from \"../constants/Settings\";\n\nimport Href from \"../models/href/Href\";\n\nimport universalFetch from \"../utils/fetch/universalFetch\";\nimport resolveModel from \"../models/resolveModel\";\nimport FormModel from \"../models/form/FormModel\";\nimport ContentModel from \"../models/content/ContentModel\";\n\nimport ModularUIResponse from \"./ModularUIResponse\";\n\nimport ModularUIError from \"./ModularUIError\";\nimport { IllegalArgumentException, IllegalStateException } from \"../exceptions\";\n\nimport { isPlainObject } from \"../utils/helpers/objects\";\n\nimport type { TargetModel } from \"./types\";\nimport type {\n RequestBaseOptions,\n RequestModularUIOptions,\n} from \"../utils/fetch/types\";\nimport type { ModularUIModel } from \"../models/types\";\n\n/**\n * Helper for fetching data and contributions from the Be Informed modular ui\n * and merge it into a target or resolvable model.\n */\nclass ModularUIRequest {\n _response: ModularUIResponse;\n\n _href: Href;\n _options: RequestModularUIOptions;\n _targetModel: ?TargetModel;\n _contributionsHref: string;\n _locale: string;\n _method: $Keys<typeof HTTP_METHODS> = HTTP_METHODS.GET;\n\n _progressEvent: ProgressEventHandler;\n\n /**\n */\n constructor(\n href: Href | string,\n options: $Shape<RequestModularUIOptions> = {}\n ) {\n if (!href) {\n throw new IllegalArgumentException(\n \"You must pass a href to the resource that is requested\"\n );\n }\n\n this.options = options;\n\n this._response = new ModularUIResponse();\n\n this.href = typeof href === \"string\" ? new Href(href) : href;\n this.locale = options.locale ?? \"en\";\n\n // copy request parameters to response, to be able to use them in the models\n // self links are missing the request parameters\n this._response.parameters = this.href.parameters;\n\n if (options.targetModel) {\n this.targetModel = options.targetModel;\n }\n\n if (options.method) {\n this.method = options.method;\n } else {\n this.method = this.href.method;\n }\n }\n\n /**\n */\n get contributionsHref(): string {\n return this._contributionsHref;\n }\n\n /**\n */\n set contributionsHref(contributionsHref: string) {\n this._contributionsHref = contributionsHref;\n }\n\n /**\n */\n set locale(locale: string) {\n this._locale = locale;\n this._response.locale = locale;\n }\n\n /**\n */\n get locale(): string {\n return this._locale;\n }\n\n /**\n */\n get response(): ModularUIResponse {\n return this._response;\n }\n\n /**\n */\n set href(href: Href) {\n this._href = href;\n }\n\n /**\n */\n get href(): Href {\n return this._href;\n }\n\n /**\n */\n set method(method: $Keys<typeof HTTP_METHODS>) {\n this._method = method;\n }\n\n /**\n */\n get method(): $Keys<typeof HTTP_METHODS> {\n return this._method;\n }\n\n /**\n */\n get options(): RequestModularUIOptions {\n return {\n ...this._options,\n locale: this.locale,\n method: this.method,\n };\n }\n\n /**\n */\n get requestOptions(): RequestBaseOptions {\n /* eslint-disable no-unused-vars */\n const {\n targetModel,\n updateModel,\n childmodels,\n isValidationRequest,\n removeOnUnmount,\n ...requestOptions\n } = this.options;\n /* eslint-enable no-unused-vars */\n return requestOptions;\n }\n\n /**\n */\n set options(options: RequestModularUIOptions) {\n this._options = options;\n }\n\n /**\n */\n get withChildModels(): boolean {\n return (\n !(\"childmodels\" in this.options) || this.options.childmodels === true\n );\n }\n\n /**\n */\n set targetModel(targetModel: TargetModel) {\n this._targetModel = targetModel;\n }\n\n /**\n */\n get targetModel(): ?TargetModel {\n return this._targetModel;\n }\n\n /**\n */\n resolveModel(): Class<ModularUIModel> {\n let availableModels;\n if (this.targetModel) {\n availableModels = Array.isArray(this.targetModel)\n ? [...this.targetModel]\n : [this.targetModel];\n }\n\n const Model: Class<ModularUIModel> | null = resolveModel(\n this.response,\n availableModels\n );\n\n if (Model && Model.isApplicableModel) {\n return Model;\n }\n\n if (availableModels) {\n throw new IllegalStateException(\n `data is not applicable for model(s): ${availableModels\n .map((m) => m.modelName)\n .join(\", \")}`\n );\n }\n\n throw new IllegalStateException(\n `no javascript model is applicable for received response: ${JSON.stringify(\n this.response\n )}`\n );\n }\n\n /**\n */\n createModel(): ModularUIModel {\n const Model = this.resolveModel();\n return new Model(this.response);\n }\n\n /**\n */\n processContributionsService(contributionsData: Object): void {\n if (!isPlainObject(contributionsData)) {\n throw new IllegalArgumentException(\n \"Missing contributions data or contributions is not JSON\"\n );\n }\n\n const [contributionsKey] = Object.keys(contributionsData);\n\n if (contributionsData.error && contributionsKey === \"error\") {\n this.handleContributionsError(contributionsData.error);\n }\n\n // The key of the data service is different from the contributions service for forms\n if (!(this.response.key in contributionsData)) {\n this.response.key = contributionsKey;\n }\n\n this.response.contributions = contributionsData[this.response.key];\n }\n\n /**\n */\n handleContributionsError(error: Object): void {\n const errorMessage = error.properties?.message ?? \"Error in contribution\";\n throw new ModularUIError(errorMessage, error, this.contributionsHref);\n }\n\n /**\n */\n handleDataError(error: Object): void {\n if (error.properties) {\n const errorMessage = error.properties?.message ?? \"Error in data\";\n throw new ModularUIError(errorMessage, error, this.href.path.toString());\n }\n\n throw new IllegalArgumentException(error);\n }\n\n /**\n */\n handleData(key: string, data: Object): void {\n this.response.key = key;\n this.response.data = data;\n\n const links = data._links;\n\n if (links && links.contributions) {\n this.contributionsHref = links.contributions.href;\n } else if (Array.isArray(links) && links[0].contributions) {\n this.contributionsHref = links[0].contributions.href;\n } else {\n throw new IllegalArgumentException(\n `Contributions link not found for data with key ${key}`\n );\n }\n }\n\n /**\n */\n processDataService(data: Object): void {\n if (!isPlainObject(data)) {\n throw new IllegalArgumentException(\"Missing data or data is not JSON\");\n }\n\n if (data.error) {\n this.handleDataError(data.error);\n } else {\n const [key] = Object.keys(data);\n this.handleData(key, data[key]);\n }\n }\n\n /**\n */\n fetchContributionsService(): Promise<any> {\n if (!this.contributionsHref) {\n throw new IllegalStateException(\"Missing a contributions href\");\n }\n\n return universalFetch({\n url: `${BASE}${this.contributionsHref}`,\n cache: true,\n locale: this.options.locale,\n });\n }\n\n /**\n */\n fetchDataService(): Promise<any> {\n return universalFetch({\n ...this.requestOptions,\n url: `${BASE}${this.href.path}`,\n params: this.href.getQuerystringForModularUI(),\n locale: this.options.locale,\n onProgress: this.onProgress,\n });\n }\n\n /**\n * Check if links contain a 'hide-when-empty' layout hint and remove the link from\n * the component when it exists and no results are available\n */\n async processAsyncLayoutHints(): Promise<void> {\n if (getSetting(\"ALLOW_HIDE_WHEN_EMPTY_ON_TABS\")) {\n await this.processApplicationLinks();\n await this.processTabLinks();\n }\n await this.processPanelLinks();\n\n return Promise.resolve();\n }\n\n /**\n * hide application links<br>\n * _links on application data contains an extra level of tab links\n */\n processApplicationLinks(): Promise<void> {\n const contributionLinks = this.response.contributions._links;\n const dataLinks = this.response.data._links;\n if (!contributionLinks || !dataLinks) {\n return Promise.resolve();\n }\n\n if (\"tab\" in contributionLinks && \"tab\" in dataLinks) {\n for (const contributionTabLink of contributionLinks.tab) {\n if (\"components\" in contributionTabLink) {\n const dataTabLinks = dataLinks.tab.find(\n (dataLink) => dataLink.name === contributionTabLink.name\n );\n\n if (dataTabLinks && \"components\" in dataTabLinks) {\n return this.processLinks(\n dataTabLinks.components,\n contributionTabLink.components\n ).then((newLinks) =>\n this.replaceApplicationLinks(contributionTabLink.name, newLinks)\n );\n }\n }\n }\n }\n\n return Promise.resolve();\n }\n\n /**\n * Replace hidden link in application link tree\n */\n replaceApplicationLinks(tabName: string, newLinks: Array<Object>): void {\n this.response.data._links.tab = this.response.data._links.tab.map(\n (tabLink) => {\n const key = tabLink.name;\n if (tabName === key) {\n tabLink.components = newLinks;\n }\n return tabLink;\n }\n );\n }\n\n /**\n */\n processTabLinks(): Promise<void> {\n const contributionLinks = this.response.contributions._links;\n\n if (!contributionLinks) {\n return Promise.resolve();\n }\n\n if (\"component\" in contributionLinks) {\n return this.processLinks(\n this.response.data._links.component,\n contributionLinks.component\n ).then((newLinks) => {\n this.response.data._links.component = newLinks;\n });\n }\n\n return Promise.resolve();\n }\n\n /**\n */\n processPanelLinks(): Promise<void> {\n const contributionLinks = this.response.contributions._links;\n\n if (!contributionLinks) {\n return Promise.resolve();\n }\n\n if (\"panel\" in contributionLinks) {\n return this.processLinks(\n this.response.data._links,\n contributionLinks.panel\n ).then((newLinks) => {\n this.response.data._links = newLinks;\n });\n }\n\n return Promise.resolve();\n }\n\n /**\n * Retrieve an object of key: link\n */\n dataLinksPerName(dataLinks: any): { [linkName: string]: any } {\n if (Array.isArray(dataLinks)) {\n const links = {};\n for (const dataLink of dataLinks) {\n links[dataLink.name] = dataLink;\n }\n return links;\n }\n return dataLinks;\n }\n\n /**\n * Check if links are empty and hide them when hide-when-empty hint exists\n */\n processLinks(\n dataLinks: any,\n contributionLinks: any\n ): Promise<Object | Array<Object>> {\n const linksPerName = this.dataLinksPerName(dataLinks);\n const hideWhenEmptyLinks = contributionLinks.filter((contributionLink) =>\n contributionLink.layouthint?.includes(HIDE_WHEN_EMPTY)\n );\n\n const isHiddenListChecks = [];\n\n for (const contributionLink of hideWhenEmptyLinks) {\n const dataLink = linksPerName[contributionLink.name];\n if (dataLink?.href) {\n isHiddenListChecks.push(\n this.isHiddenList(contributionLink.name, dataLink.href)\n );\n }\n }\n\n return Promise.all(isHiddenListChecks).then(\n (hiddenLinks: Array<string>) => {\n if (Array.isArray(dataLinks)) {\n return dataLinks.filter(\n (dataLink) => !hiddenLinks.includes(dataLink.name)\n );\n }\n\n const newDataLinks: { [string]: any } = {};\n for (const dataLinkKey in dataLinks) {\n if (!hiddenLinks.includes(dataLinkKey)) {\n newDataLinks[dataLinkKey] = dataLinks[dataLinkKey];\n }\n }\n return newDataLinks;\n }\n );\n }\n\n /**\n */\n isHiddenList(name: string, href: string): Promise<string> {\n const HIDE_WHEN_EMPTY_IGNORE_TASKS = getSetting(\n \"HIDE_WHEN_EMPTY_IGNORE_TASKS\",\n false\n );\n\n return universalFetch({\n ...this.requestOptions,\n url: `${BASE}${href}`,\n })\n .then((response: Object) => {\n if (isPlainObject(response)) {\n const [key] = Object.keys(response);\n const { _embedded, actions } = response[key];\n\n const noListItems = _embedded === null;\n const noActions = actions == null || HIDE_WHEN_EMPTY_IGNORE_TASKS;\n\n const isHidden = noListItems && noActions;\n if (isHidden) {\n return name;\n }\n }\n return \"\";\n })\n .catch(() => {\n return \"\";\n });\n }\n\n /**\n */\n set onProgress(progressEvent: ProgressEventHandler) {\n this._progressEvent = progressEvent;\n }\n\n /**\n */\n get onProgress(): ProgressEventHandler {\n return this._progressEvent || null;\n }\n\n /**\n * Combine previous send request data with new validation data to create a complete request object\n * The received model is new FormModel containing ONLY the current question, not the previously entered questions\n * to create a complete request we append the originally send form objects\n */\n getDynamicValidationData(model: ModularUIModel): string {\n const prevData =\n typeof this.options.data === \"string\"\n ? JSON.parse(this.options.data)\n : this.options.data;\n\n if (model instanceof FormModel) {\n const newData = JSON.parse(model.validationData);\n // $FlowFixMe incompatible-call\n return JSON.stringify(deepmerge(prevData || {}, newData));\n }\n\n return JSON.stringify(prevData) ?? \"{}\";\n }\n\n /**\n * First load of dynamic values when a form is loaded\n */\n loadDynamicValidations(model: ModularUIModel): Promise<ModularUIModel> {\n if (\n !this.options.isValidationRequest &&\n getSetting(\"USE_INSTANT_SERVER_VALIDATION\") &&\n model instanceof FormModel &&\n model.currentFormObject &&\n model.currentFormObject.hasDynamicValidations\n ) {\n const validationHref = this.href.setParameter(\"commit\", \"false\");\n return universalFetch({\n ...this.requestOptions,\n url: `${BASE}${this.href.path}`,\n params: validationHref.getQuerystringForModularUI(),\n data: this.getDynamicValidationData(model),\n }).then((data) => {\n if (data == null || typeof data !== \"object\") {\n return model;\n }\n\n const [key] = Object.keys(data);\n return model.updateValidations(data[key]);\n });\n }\n\n return Promise.resolve(model);\n }\n\n /**\n */\n fetch(): Promise<ModularUIModel> {\n return this.fetchDataService()\n .then((data) => {\n if (data == null) {\n throw new Error(`No data received for ${this.href.toString()}`);\n }\n\n this.processDataService(data);\n return this.fetchContributionsService();\n })\n .then((contributionsData) => {\n if (contributionsData == null) {\n throw new Error(\n `No contributions data received for ${this.contributionsHref}`\n );\n }\n\n this.processContributionsService(contributionsData);\n return this.processAsyncLayoutHints();\n })\n .then(() => Promise.resolve(this.createModel()))\n .then((model) => this.loadDynamicValidations(model))\n .then((model) => {\n if (this.withChildModels) {\n return this.fetchChildModels(model);\n }\n\n return Promise.resolve(model);\n });\n }\n\n /**\n */\n fetchFromCache(): Promise<ModularUIModel> {\n this.options = {\n ...this.options,\n cache: true,\n };\n\n return this.fetch();\n }\n\n /**\n */\n fetchChildModels(model: ModularUIModel): Promise<ModularUIModel> {\n const childModelLinks = model.getInitialChildModelLinks();\n\n const childModelRequests = childModelLinks.map((childModelLink) => {\n const request = new ModularUIRequest(childModelLink.href, {\n locale: this.locale,\n });\n\n if (childModelLink.targetModel) {\n request.targetModel = childModelLink.targetModel;\n }\n\n if (childModelLink.isCacheable) {\n return request.fetchFromCache();\n }\n\n return request.fetch();\n });\n\n return Promise.allSettled(childModelRequests).then((childModels) => {\n const resolvedChildModels = [];\n\n childModels.forEach((childModel) => {\n if (childModel.status === \"rejected\") {\n const { reason } = childModel;\n if (reason.name !== \"Error.ChangePasswordRequired\") {\n console.error(\n \"Unexpected error when retrieving child model:\",\n reason\n );\n }\n } else {\n resolvedChildModels.push(childModel.value);\n }\n });\n\n model.addChildModels(resolvedChildModels);\n\n return model;\n });\n }\n\n /**\n */\n fetchContent(withChildSections: boolean): Promise<mixed> {\n return this.fetchFromCache().then((model) => {\n if (\n withChildSections &&\n model instanceof ContentModel &&\n model.childSectionLinks.length > 0\n ) {\n return this.fetchContentChildSections(model);\n }\n\n return Promise.resolve(model);\n });\n }\n\n /**\n * Recursively return child sections defined on the content model\n */\n fetchContentChildSections(contentModel: ContentModel): Promise<mixed> {\n const newContentModel = contentModel.clone();\n\n return Promise.all(\n contentModel.childSectionLinks.map((childSectionLink) => {\n const contentHrefWithEntryDate = childSectionLink.selfhref.addParameter(\n TIMEVERSION_FILTER_NAME,\n contentModel.entryDate\n );\n\n const request = new ModularUIRequest(contentHrefWithEntryDate, {\n locale: this.locale,\n });\n\n return request.fetchContent(true);\n })\n ).then((sectionModels) => {\n newContentModel.childSections = sectionModels;\n\n return newContentModel;\n });\n }\n\n /**\n * Make a post request with optionally data to send\n * @param data\n */\n post(data?: string | { [key: string]: string }): Promise<ModularUIModel> {\n this.method = HTTP_METHODS.POST;\n this.options = {\n ...this.options,\n data,\n };\n\n return this.fetch();\n }\n\n /**\n * Make a POST request using the form, an updated form is returned (merge of old and new form)\n * @param form\n * @returns {Promise<FormModel>}\n */\n postForm(form: FormModel): Promise<FormModel> {\n this.method = HTTP_METHODS.POST;\n this.options = {\n ...this.options,\n data: form.formdata,\n };\n\n return this.fetch().then((response) => {\n return form.update(response);\n });\n }\n}\n\nexport default ModularUIRequest;\n"],"mappings":";;;;;;;;;;;;;;;AACA;AAEA;AAMA;AAEA;AAEA;AAEA;AACA;AACA;AACA;AAEA;AAEA;AACA;AAEA;AASA;AACA;AACA;AACA;AACA,MAAMA,gBAAgB,CAAC;EAYrB;AACF;EACEC,WAAW,CACTC,I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ACnK,OAAO,GAAG;MACb,GAAG,IAAI,CAACA,OAAO;MACfoD;IACF,CAAC;IAED,OAAO,IAAI,CAACyE,KAAK,EAAE;EACrB;;EAEA;AACF;AACA;AACA;AACA;EACEuC,QAAQ,CAACC,IAAe,EAAsB;IAC5C,IAAI,CAAC3J,MAAM,GAAGT,uBAAY,CAACkK,IAAI;IAC/B,IAAI,CAACnK,OAAO,GAAG;MACb,GAAG,IAAI,CAACA,OAAO;MACfoD,IAAI,EAAEiH,IAAI,CAACC;IACb,CAAC;IAED,OAAO,IAAI,CAACzC,KAAK,EAAE,CAAC7C,IAAI,CAAElE,QAAQ,IAAK;MACrC,OAAOuJ,IAAI,CAACE,MAAM,CAACzJ,QAAQ,CAAC;IAC9B,CAAC,CAAC;EACJ;AACF;AAAC,eAEcjB,gBAAgB;AAAA"}
|
|
@@ -115,17 +115,12 @@ describe("modularUIRequest", () => {
|
|
|
115
115
|
expect(requestWithChildModels.withChildModels).toBe(true);
|
|
116
116
|
});
|
|
117
117
|
|
|
118
|
-
it("
|
|
118
|
+
it("Throws when data is missing", () => {
|
|
119
119
|
const requestWithTargetModel = new ModularUIRequest("/");
|
|
120
120
|
requestWithTargetModel.targetModel = ApplicationModel;
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
const wrongTargetModel = new ModularUIRequest("/");
|
|
126
|
-
wrongTargetModel.targetModel = Href;
|
|
127
|
-
|
|
128
|
-
expect(() => wrongTargetModel.createModel()).toThrow(IllegalStateException);
|
|
121
|
+
expect(() => requestWithTargetModel.createModel()).toThrow(
|
|
122
|
+
IllegalArgumentException
|
|
123
|
+
);
|
|
129
124
|
});
|
|
130
125
|
|
|
131
126
|
it("creates a model from a response", () => {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","names":[],"sources":["../../src/modularui/types.js"],"sourcesContent":["// @flow\nimport type { ModularUIModel } from \"../models\";\n\nexport type TargetModel = Class<ModularUIModel> | Array<Class<ModularUIModel>>;\n"],"mappings":""}
|
|
@@ -15,7 +15,7 @@ import type {
|
|
|
15
15
|
ResetModularUIAction,
|
|
16
16
|
UpdateStatusAction,
|
|
17
17
|
} from "./types";
|
|
18
|
-
import type {
|
|
18
|
+
import type { RequestModularUIOptions } from "../../utils/fetch/types";
|
|
19
19
|
|
|
20
20
|
/**
|
|
21
21
|
*/
|
|
@@ -94,7 +94,7 @@ const loadModelSuccessAction = (
|
|
|
94
94
|
export const loadModel = (
|
|
95
95
|
key: string,
|
|
96
96
|
href: Href | string,
|
|
97
|
-
options?:
|
|
97
|
+
options?: RequestModularUIOptions
|
|
98
98
|
): ModularUIAction => ({
|
|
99
99
|
type: "MODULARUI/FETCH",
|
|
100
100
|
payload: {
|
|
@@ -131,7 +131,7 @@ export const loadModularUI =
|
|
|
131
131
|
(
|
|
132
132
|
key: string,
|
|
133
133
|
href: Href | string,
|
|
134
|
-
options?:
|
|
134
|
+
options?: RequestModularUIOptions
|
|
135
135
|
): ThunkAction =>
|
|
136
136
|
(dispatch: Dispatch) => {
|
|
137
137
|
dispatch(updateStatus(key, MODULARUI_STATUS.LOADING));
|
|
@@ -154,7 +154,7 @@ export const loadModularUI =
|
|
|
154
154
|
*/
|
|
155
155
|
export const reloadModel = (
|
|
156
156
|
model: ModularUIModel,
|
|
157
|
-
options?:
|
|
157
|
+
options?: RequestModularUIOptions
|
|
158
158
|
): ThunkAction =>
|
|
159
159
|
loadModularUI(model.connectKey, model.selfhref, {
|
|
160
160
|
...options,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ModularUIActions.js","names":["setModel","key","model","connectKey","type","payload","updateModel","removeModelByKey","resetModularUI","updateStatus","status","loadModelSuccessAction","modelToUpdate","clonedModel","clone","update","Error","loadModel","href","options","Href","method","HTTP_METHODS","GET","data","locale","childmodels","targetModel","successAction","errorAction","error","errorResponse","ErrorResponse","isChangePassword","isResourceNotFoundAfterReload","MODULARUI_STATUS","ERROR","loadModularUI","dispatch","LOADING","startProgress","loadModelPromise","resolve","then","response","FINISHED","finishProgress","catch","handleError","reloadModel","selfhref","isReload"],"sources":["../../../src/redux/_modularui/ModularUIActions.js"],"sourcesContent":["// @flow\nimport { HTTP_METHODS, MODULARUI_STATUS } from \"../../constants/Constants\";\nimport Href from \"../../models/href/Href\";\nimport ErrorResponse from \"../../models/error/ErrorResponse\";\nimport { finishProgress, startProgress } from \"../actions/ProgressIndicator\";\nimport { handleError } from \"../actions/Error\";\n\nimport type { ModularUIModel } from \"../../models/types\";\nimport type { Dispatch, ThunkAction } from \"../types\";\nimport type {\n ModularUIAction,\n SetModelAction,\n UpdateModelAction,\n RemoveModelByKeyAction,\n ResetModularUIAction,\n UpdateStatusAction,\n} from \"./types\";\nimport type {
|
|
1
|
+
{"version":3,"file":"ModularUIActions.js","names":["setModel","key","model","connectKey","type","payload","updateModel","removeModelByKey","resetModularUI","updateStatus","status","loadModelSuccessAction","modelToUpdate","clonedModel","clone","update","Error","loadModel","href","options","Href","method","HTTP_METHODS","GET","data","locale","childmodels","targetModel","successAction","errorAction","error","errorResponse","ErrorResponse","isChangePassword","isResourceNotFoundAfterReload","MODULARUI_STATUS","ERROR","loadModularUI","dispatch","LOADING","startProgress","loadModelPromise","resolve","then","response","FINISHED","finishProgress","catch","handleError","reloadModel","selfhref","isReload"],"sources":["../../../src/redux/_modularui/ModularUIActions.js"],"sourcesContent":["// @flow\nimport { HTTP_METHODS, MODULARUI_STATUS } from \"../../constants/Constants\";\nimport Href from \"../../models/href/Href\";\nimport ErrorResponse from \"../../models/error/ErrorResponse\";\nimport { finishProgress, startProgress } from \"../actions/ProgressIndicator\";\nimport { handleError } from \"../actions/Error\";\n\nimport type { ModularUIModel } from \"../../models/types\";\nimport type { Dispatch, ThunkAction } from \"../types\";\nimport type {\n ModularUIAction,\n SetModelAction,\n UpdateModelAction,\n RemoveModelByKeyAction,\n ResetModularUIAction,\n UpdateStatusAction,\n} from \"./types\";\nimport type { RequestModularUIOptions } from \"../../utils/fetch/types\";\n\n/**\n */\nexport const setModel = (\n key: string,\n model: ModularUIModel\n): SetModelAction => {\n // set key on model for later reference\n model.connectKey = key;\n return {\n type: \"MODULARUI/SET\",\n payload: {\n key,\n model,\n },\n };\n};\n\n/**\n */\nexport const updateModel = (model: ModularUIModel): UpdateModelAction => ({\n type: \"MODULARUI/UPDATE\",\n payload: model,\n});\n\n/**\n */\nexport const removeModelByKey = (key: string): RemoveModelByKeyAction => ({\n type: \"MODULARUI/REMOVE_KEY\",\n payload: key,\n});\n\n/**\n * Removes all models except the application model from the modular ui reducer\n */\nexport const resetModularUI = (): ResetModularUIAction => ({\n type: \"MODULARUI/RESET\",\n});\n\n/**\n */\nexport const updateStatus = (\n key: string,\n status: $Keys<typeof MODULARUI_STATUS>\n): UpdateStatusAction => ({\n type: \"MODULARUI/STATUS\",\n payload: { key, status },\n});\n\n/**\n */\nconst loadModelSuccessAction = (\n key: string,\n model: ModularUIModel,\n modelToUpdate: ?ModularUIModel\n): UpdateModelAction | SetModelAction => {\n if (modelToUpdate) {\n // $FlowFixMe[prop-missing]\n if (typeof modelToUpdate[\"update\"] === \"function\") {\n const clonedModel = modelToUpdate.clone();\n clonedModel.update(model);\n\n return updateModel(clonedModel);\n }\n\n throw new Error(\n `loadModel action: updateModel is set as option for ${key}, but the model is missing an update methode`\n );\n }\n\n return setModel(key, model);\n};\n\n/**\n */\nexport const loadModel = (\n key: string,\n href: Href | string,\n options?: RequestModularUIOptions\n): ModularUIAction => ({\n type: \"MODULARUI/FETCH\",\n payload: {\n href: href instanceof Href ? href : new Href(href),\n method: options?.method ?? HTTP_METHODS.GET,\n data: options?.data,\n locale: options?.locale ?? \"en\",\n childmodels: options?.childmodels,\n targetModel: options?.targetModel,\n /**\n */\n successAction: (model) =>\n loadModelSuccessAction(key, model, options?.updateModel),\n /**\n */\n errorAction: (error) => {\n const errorResponse = new ErrorResponse(error, key);\n if (errorResponse.isChangePassword) {\n return {\n type: \"NO_ACTION\",\n };\n } else if (errorResponse.isResourceNotFoundAfterReload) {\n return removeModelByKey(key);\n }\n\n return updateStatus(key, MODULARUI_STATUS.ERROR);\n },\n },\n});\n\n/**\n */\nexport const loadModularUI =\n (\n key: string,\n href: Href | string,\n options?: RequestModularUIOptions\n ): ThunkAction =>\n (dispatch: Dispatch) => {\n dispatch(updateStatus(key, MODULARUI_STATUS.LOADING));\n dispatch(startProgress());\n\n const loadModelPromise = dispatch(loadModel(key, href, options));\n\n return Promise.resolve(loadModelPromise)\n .then((response) => {\n if (response?.type === \"FINISH_PROGRESS\") {\n dispatch(updateStatus(key, MODULARUI_STATUS.FINISHED));\n }\n\n return dispatch(finishProgress());\n })\n .catch((error) => dispatch(handleError(error)));\n };\n\n/**\n */\nexport const reloadModel = (\n model: ModularUIModel,\n options?: RequestModularUIOptions\n): ThunkAction =>\n loadModularUI(model.connectKey, model.selfhref, {\n ...options,\n isReload: true,\n });\n"],"mappings":";;;;;;;;AACA;AACA;AACA;AACA;AACA;AAcA;AACA;AACO,MAAMA,QAAQ,GAAG,CACtBC,GAAW,EACXC,KAAqB,KACF;EACnB;EACAA,KAAK,CAACC,UAAU,GAAGF,GAAG;EACtB,OAAO;IACLG,IAAI,EAAE,eAAe;IACrBC,OAAO,EAAE;MACPJ,GAAG;MACHC;IACF;EACF,CAAC;AACH,CAAC;;AAED;AACA;AADA;AAEO,MAAMI,WAAW,GAAIJ,KAAqB,KAAyB;EACxEE,IAAI,EAAE,kBAAkB;EACxBC,OAAO,EAAEH;AACX,CAAC,CAAC;;AAEF;AACA;AADA;AAEO,MAAMK,gBAAgB,GAAIN,GAAW,KAA8B;EACxEG,IAAI,EAAE,sBAAsB;EAC5BC,OAAO,EAAEJ;AACX,CAAC,CAAC;;AAEF;AACA;AACA;AAFA;AAGO,MAAMO,cAAc,GAAG,OAA6B;EACzDJ,IAAI,EAAE;AACR,CAAC,CAAC;;AAEF;AACA;AADA;AAEO,MAAMK,YAAY,GAAG,CAC1BR,GAAW,EACXS,MAAsC,MACd;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;AAAC"}
|
|
@@ -16,6 +16,7 @@ import type {
|
|
|
16
16
|
import type { ModularUIModel } from "../../models/types";
|
|
17
17
|
import type Href from "../../models/href/Href";
|
|
18
18
|
import type { ModularUIAction, SuccessAction, ErrorAction } from "./types";
|
|
19
|
+
import type { TargetModel } from "../../modularui/types";
|
|
19
20
|
|
|
20
21
|
type RequestOptions = {
|
|
21
22
|
href: Href,
|
|
@@ -23,14 +24,14 @@ type RequestOptions = {
|
|
|
23
24
|
data?: string | { [key: string]: string },
|
|
24
25
|
locale: string,
|
|
25
26
|
childmodels?: boolean,
|
|
26
|
-
targetModel?:
|
|
27
|
+
targetModel?: TargetModel,
|
|
27
28
|
isReload?: boolean,
|
|
28
29
|
};
|
|
29
30
|
|
|
30
31
|
/**
|
|
31
32
|
* Symbol key that carries API call info interpreted by this Redux middleware.
|
|
32
33
|
*/
|
|
33
|
-
const createRequest = (modularui: RequestOptions) => {
|
|
34
|
+
const createRequest = (modularui: RequestOptions): ModularUIRequest => {
|
|
34
35
|
const request = new ModularUIRequest(modularui.href, {
|
|
35
36
|
method: modularui.method || HTTP_METHODS.GET,
|
|
36
37
|
data: modularui.data || {},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ModularUIMiddleware.js","names":["createRequest","modularui","request","ModularUIRequest","href","method","HTTP_METHODS","GET","data","locale","childmodels","isReload","targetModel","responseHandler","next","dispatch","successAction","model","successResult","then","result","catch","error","handleError","Error","finishProgress","errorHandler","errorAction","err","errorResult","handleFetch","action","startProgress","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\";\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?:
|
|
1
|
+
{"version":3,"file":"ModularUIMiddleware.js","names":["createRequest","modularui","request","ModularUIRequest","href","method","HTTP_METHODS","GET","data","locale","childmodels","isReload","targetModel","responseHandler","next","dispatch","successAction","model","successResult","then","result","catch","error","handleError","Error","finishProgress","errorHandler","errorAction","err","errorResult","handleFetch","action","startProgress","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 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 }\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;AACA;AAEA;AAEA;AAwBA;AACA;AACA;AACA,MAAMA,aAAa,GAAIC,S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AAOA,IAAI,CAACiB,MAAM,CAAC;AACrB,CAAC;AAAC"}
|
|
@@ -7,13 +7,14 @@ import typeof {
|
|
|
7
7
|
HTTP_METHODS,
|
|
8
8
|
MODULARUI_STATUS,
|
|
9
9
|
} from "../../constants/Constants";
|
|
10
|
-
import type { RequestBaseOptions } from "../../utils/fetch/types";
|
|
11
10
|
import type { ComponentType } from "react";
|
|
11
|
+
import type { TargetModel } from "../../modularui/types";
|
|
12
|
+
import type { RequestModularUIOptions } from "../../utils/fetch/types";
|
|
12
13
|
|
|
13
14
|
export type ModularUIOptions = {
|
|
14
15
|
propName?: string,
|
|
15
16
|
removeOnUnmount?: boolean,
|
|
16
|
-
...
|
|
17
|
+
...RequestModularUIOptions,
|
|
17
18
|
};
|
|
18
19
|
|
|
19
20
|
export type ModelEntry = {
|
|
@@ -56,7 +57,7 @@ export type ModularUIAction = {
|
|
|
56
57
|
data?: string | { [key: string]: string },
|
|
57
58
|
locale: string,
|
|
58
59
|
childmodels?: boolean,
|
|
59
|
-
targetModel?:
|
|
60
|
+
targetModel?: TargetModel,
|
|
60
61
|
successAction: (
|
|
61
62
|
model: ModularUIModel
|
|
62
63
|
) => UpdateModelAction | SetModelAction,
|
|
@@ -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 {
|
|
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 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 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":""}
|
|
@@ -21,9 +21,9 @@ import type {
|
|
|
21
21
|
} from "../types";
|
|
22
22
|
import type Href from "../../models/href/Href";
|
|
23
23
|
import type { ModularUIModel } from "../../models/types";
|
|
24
|
-
import type { RequestBaseOptions } from "../../utils/fetch/types";
|
|
25
24
|
import type FetchException from "../../exceptions/FetchException";
|
|
26
25
|
import type { ComponentType } from "react";
|
|
26
|
+
import type { RequestModularUIOptions } from "../../utils/fetch/types";
|
|
27
27
|
|
|
28
28
|
type StateProps = {
|
|
29
29
|
modularui: (href: Href, options: any) => ModularUIRequest,
|
|
@@ -35,7 +35,7 @@ type DispatchProps = {
|
|
|
35
35
|
finishProgress: () => FinishProgressAction,
|
|
36
36
|
reloadModel: (
|
|
37
37
|
model: ModularUIModel,
|
|
38
|
-
options?:
|
|
38
|
+
options?: RequestModularUIOptions
|
|
39
39
|
) => ThunkAction,
|
|
40
40
|
handleError: (error: Error | FetchException) => ThunkAction,
|
|
41
41
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"withModularUI.js","names":["modularui","createSelector","getLocale","localeCode","href","options","modularuiRequest","ModularUIRequest","locale","mapStateToProps","state","i18n","mapDispatchToProps","startProgress","finishProgress","reloadModel","handleError","withModularui","connect"],"sources":["../../../src/redux/_modularui/withModularUI.js"],"sourcesContent":["// @flow\nimport { connect } from \"react-redux\";\n\nimport { createSelector } from \"reselect\";\n\nimport ModularUIRequest from \"../../modularui/ModularUIRequest\";\n\nimport { startProgress, finishProgress } from \"../actions/ProgressIndicator\";\n\nimport { handleError } from \"../actions/Error\";\n\nimport { getLocale } from \"../selectors/i18n\";\n\nimport { reloadModel } from \"./ModularUIActions\";\n\nimport type {\n ReduxState,\n StartProgressAction,\n FinishProgressAction,\n ThunkAction,\n} from \"../types\";\nimport type Href from \"../../models/href/Href\";\nimport type { ModularUIModel } from \"../../models/types\";\nimport type
|
|
1
|
+
{"version":3,"file":"withModularUI.js","names":["modularui","createSelector","getLocale","localeCode","href","options","modularuiRequest","ModularUIRequest","locale","mapStateToProps","state","i18n","mapDispatchToProps","startProgress","finishProgress","reloadModel","handleError","withModularui","connect"],"sources":["../../../src/redux/_modularui/withModularUI.js"],"sourcesContent":["// @flow\nimport { connect } from \"react-redux\";\n\nimport { createSelector } from \"reselect\";\n\nimport ModularUIRequest from \"../../modularui/ModularUIRequest\";\n\nimport { startProgress, finishProgress } from \"../actions/ProgressIndicator\";\n\nimport { handleError } from \"../actions/Error\";\n\nimport { getLocale } from \"../selectors/i18n\";\n\nimport { reloadModel } from \"./ModularUIActions\";\n\nimport type {\n ReduxState,\n StartProgressAction,\n FinishProgressAction,\n ThunkAction,\n} from \"../types\";\nimport type Href from \"../../models/href/Href\";\nimport type { ModularUIModel } from \"../../models/types\";\nimport type FetchException from \"../../exceptions/FetchException\";\nimport type { ComponentType } from \"react\";\nimport type { RequestModularUIOptions } from \"../../utils/fetch/types\";\n\ntype StateProps = {\n modularui: (href: Href, options: any) => ModularUIRequest,\n locale: string,\n};\n\ntype DispatchProps = {\n startProgress: () => StartProgressAction,\n finishProgress: () => FinishProgressAction,\n reloadModel: (\n model: ModularUIModel,\n options?: RequestModularUIOptions\n ) => ThunkAction,\n handleError: (error: Error | FetchException) => ThunkAction,\n};\n\ntype Props = {\n ...StateProps,\n ...DispatchProps,\n};\n\nconst modularui = createSelector(\n [getLocale],\n (localeCode) =>\n (href, options = {}) => {\n const modularuiRequest = new ModularUIRequest(href, options);\n modularuiRequest.locale = localeCode;\n return modularuiRequest;\n }\n);\n\n/**\n */\nconst mapStateToProps = (state: ReduxState): StateProps => ({\n modularui: modularui(state),\n locale: state.i18n.locale,\n});\n\nconst mapDispatchToProps: DispatchProps = {\n startProgress,\n finishProgress,\n reloadModel,\n handleError,\n};\n\n/**\n * Injects the modular ui service and the progress start and finish actions\n * This can be used to request modular ui services inside react view components\n */\nconst withModularui: ComponentType<any> = connect<\n Props,\n {},\n StateProps,\n _,\n _,\n _\n>(mapStateToProps, mapDispatchToProps);\n\nexport default withModularui;\n"],"mappings":";;;;;;;AACA;AAEA;AAEA;AAEA;AAEA;AAEA;AAEA;AAkCA,MAAMA,SAAS,GAAG,IAAAC,wBAAc,EAC9B,CAACC,eAAS,CAAC,EACVC,UAAU,IACT,UAACC,IAAI,EAAmB;EAAA,IAAjBC,OAAO,uEAAG,CAAC,CAAC;EACjB,MAAMC,gBAAgB,GAAG,IAAIC,yBAAgB,CAACH,IAAI,EAAEC,OAAO,CAAC;EAC5DC,gBAAgB,CAACE,MAAM,GAAGL,UAAU;EACpC,OAAOG,gBAAgB;AACzB,CAAC,CACJ;;AAED;AACA;AACA,MAAMG,eAAe,GAAIC,KAAiB,KAAkB;EAC1DV,SAAS,EAAEA,SAAS,CAACU,KAAK,CAAC;EAC3BF,MAAM,EAAEE,KAAK,CAACC,IAAI,CAACH;AACrB,CAAC,CAAC;AAEF,MAAMI,kBAAiC,GAAG;EACxCC,aAAa,EAAbA,gCAAa;EACbC,cAAc,EAAdA,iCAAc;EACdC,WAAW,EAAXA,6BAAW;EACXC,WAAW,EAAXA;AACF,CAAC;;AAED;AACA;AACA;AACA;AACA,MAAMC,aAAiC,GAAG,IAAAC,mBAAO,EAO/CT,eAAe,EAAEG,kBAAkB,CAAC;AAAC,eAExBK,aAAa;AAAA"}
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
// @flow
|
|
2
2
|
import typeof { HTTP_METHODS } from "../../constants/Constants";
|
|
3
3
|
import type { ModularUIModel } from "../../models/types";
|
|
4
|
+
import type { TargetModel } from "../../modularui/types";
|
|
4
5
|
|
|
5
6
|
export type RequestURLOptions = {
|
|
6
7
|
url: string,
|
|
7
8
|
};
|
|
9
|
+
|
|
8
10
|
export type RequestBaseOptions = {
|
|
9
11
|
method?: $Keys<HTTP_METHODS>,
|
|
10
12
|
params?: string,
|
|
@@ -24,11 +26,17 @@ export type RequestBaseOptions = {
|
|
|
24
26
|
includeContext?: boolean,
|
|
25
27
|
locale?: string,
|
|
26
28
|
cache?: boolean,
|
|
29
|
+
isReload?: boolean,
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
export type RequestOptions = { ...RequestURLOptions, ...RequestBaseOptions };
|
|
33
|
+
|
|
34
|
+
export type RequestModularUIOptions = {
|
|
35
|
+
...RequestBaseOptions,
|
|
36
|
+
targetModel?: TargetModel,
|
|
37
|
+
updateModel?: ModularUIModel,
|
|
27
38
|
childmodels?: boolean,
|
|
28
39
|
isValidationRequest?: boolean,
|
|
29
|
-
|
|
30
|
-
updateModel?: ModularUIModel,
|
|
31
|
-
isReload?: boolean,
|
|
40
|
+
|
|
32
41
|
removeOnUnmount?: boolean,
|
|
33
42
|
};
|
|
34
|
-
export type RequestOptions = { ...RequestURLOptions, ...RequestBaseOptions };
|
|
@@ -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\";\n\nexport type RequestURLOptions = {\n url: string,\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
|
|
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 updateModel?: ModularUIModel,\n childmodels?: boolean,\n isValidationRequest?: boolean,\n\n removeOnUnmount?: boolean,\n};\n"],"mappings":""}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@beinformed/ui",
|
|
3
|
-
"version": "1.25.
|
|
3
|
+
"version": "1.25.4",
|
|
4
4
|
"description": "Toolbox for be informed javascript layouts",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE.md",
|
|
6
6
|
"bugs": "http://support.beinformed.com",
|
|
@@ -100,7 +100,7 @@
|
|
|
100
100
|
},
|
|
101
101
|
"devDependencies": {
|
|
102
102
|
"@babel/cli": "^7.20.7",
|
|
103
|
-
"@babel/core": "^7.20.
|
|
103
|
+
"@babel/core": "^7.20.12",
|
|
104
104
|
"@babel/eslint-parser": "^7.19.1",
|
|
105
105
|
"@babel/eslint-plugin": "^7.19.1",
|
|
106
106
|
"@babel/plugin-proposal-class-properties": "^7.18.6",
|
|
@@ -109,8 +109,8 @@
|
|
|
109
109
|
"@babel/preset-env": "^7.20.2",
|
|
110
110
|
"@babel/preset-flow": "^7.18.6",
|
|
111
111
|
"@babel/preset-react": "^7.18.6",
|
|
112
|
-
"@commitlint/cli": "^17.
|
|
113
|
-
"@commitlint/config-conventional": "^17.
|
|
112
|
+
"@commitlint/cli": "^17.4.1",
|
|
113
|
+
"@commitlint/config-conventional": "^17.4.0",
|
|
114
114
|
"@testing-library/react": "^13.4.0",
|
|
115
115
|
"auditjs": "^4.0.39",
|
|
116
116
|
"babel-jest": "^29.3.1",
|
|
@@ -123,7 +123,7 @@
|
|
|
123
123
|
"eslint-plugin-babel": "^5.3.1",
|
|
124
124
|
"eslint-plugin-ft-flow": "^2.0.3",
|
|
125
125
|
"eslint-plugin-import": "^2.26.0",
|
|
126
|
-
"eslint-plugin-jest": "^27.2.
|
|
126
|
+
"eslint-plugin-jest": "^27.2.1",
|
|
127
127
|
"eslint-plugin-jsdoc": "^39.6.4",
|
|
128
128
|
"eslint-plugin-react": "^7.31.11",
|
|
129
129
|
"eslint-plugin-react-hooks": "^4.5.0",
|
|
@@ -133,7 +133,7 @@
|
|
|
133
133
|
"flow-typed": "^3.8.0",
|
|
134
134
|
"glob": "^8.0.3",
|
|
135
135
|
"history": "^4.0.0",
|
|
136
|
-
"husky": "^8.0.
|
|
136
|
+
"husky": "^8.0.3",
|
|
137
137
|
"jest": "^29.3.1",
|
|
138
138
|
"jest-environment-jsdom": "^29.3.1",
|
|
139
139
|
"jest-junit": "^15.0.0",
|
|
@@ -141,7 +141,7 @@
|
|
|
141
141
|
"jscodeshift": "^0.14.0",
|
|
142
142
|
"lint-staged": "^13.1.0",
|
|
143
143
|
"polished": "^4.0.0",
|
|
144
|
-
"prettier": "^2.8.
|
|
144
|
+
"prettier": "^2.8.2",
|
|
145
145
|
"react": "^18.0.0",
|
|
146
146
|
"react-dom": "^18.0.0",
|
|
147
147
|
"react-helmet-async": "^1.0.0",
|
|
@@ -193,3 +193,9 @@ export const LOGIN_PATH_SETTING = "FormClient.login_url";
|
|
|
193
193
|
export const LOGIN_USERNAME_SETTING = "FormClient.username_field_name";
|
|
194
194
|
export const LOGIN_PASSWORD_SETTING = "FormClient.password_field_name";
|
|
195
195
|
export const LOGOUT_PATH_SETTING = "FormClient.logout_url";
|
|
196
|
+
|
|
197
|
+
export const fallbackDefaultAuthenticationType = {
|
|
198
|
+
name: "Form based authentication",
|
|
199
|
+
authentication: "DefaultFormClient",
|
|
200
|
+
isPrimary: true,
|
|
201
|
+
};
|
|
@@ -54,7 +54,7 @@ describe("modularui hooks", () => {
|
|
|
54
54
|
}
|
|
55
55
|
);
|
|
56
56
|
|
|
57
|
-
expect(result.current).
|
|
57
|
+
expect(result.current).toBeNull();
|
|
58
58
|
|
|
59
59
|
expect(store.getActions()).toStrictEqual([
|
|
60
60
|
{
|
|
@@ -104,7 +104,7 @@ describe("modularui hooks", () => {
|
|
|
104
104
|
}
|
|
105
105
|
);
|
|
106
106
|
|
|
107
|
-
expect(result.current).
|
|
107
|
+
expect(result.current).toBeNull();
|
|
108
108
|
|
|
109
109
|
expect(store.getActions()).toStrictEqual([
|
|
110
110
|
{
|