@beinformed/ui 1.41.8 → 1.42.1
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 +35 -0
- package/esm/models/concepts/BusinessScenarioModel.js +2 -1
- package/esm/models/concepts/BusinessScenarioModel.js.map +1 -1
- package/esm/models/href/Href.js +1 -2
- package/esm/models/href/Href.js.map +1 -1
- package/lib/models/actions/__tests__/ActionModel.spec.js.flow +1 -1
- package/lib/models/attributes/__tests__/AttributeContent.spec.js.flow +1 -1
- package/lib/models/attributes/__tests__/AttributeDataHelper.spec.js.flow +1 -1
- package/lib/models/attributes/__tests__/AttributeModel.spec.js.flow +4 -4
- package/lib/models/concepts/BusinessScenarioModel.js +2 -1
- package/lib/models/concepts/BusinessScenarioModel.js.flow +2 -1
- package/lib/models/concepts/BusinessScenarioModel.js.map +1 -1
- package/lib/models/content/__tests__/ContentModel.spec.js.flow +4 -4
- package/lib/models/href/Href.js +1 -2
- package/lib/models/href/Href.js.flow +3 -5
- package/lib/models/href/Href.js.map +1 -1
- package/lib/models/href/__tests__/Href.spec.js.flow +2 -2
- package/package.json +11 -11
- package/src/models/actions/__tests__/ActionModel.spec.js +1 -1
- package/src/models/attributes/__mock__/_InstrumentQuestionContributions.json +1 -1
- package/src/models/attributes/__mock__/_TreeFormAttributeContribution.json +1 -1
- package/src/models/attributes/__tests__/AttributeContent.spec.js +1 -1
- package/src/models/attributes/__tests__/AttributeDataHelper.spec.js +1 -1
- package/src/models/attributes/__tests__/AttributeModel.spec.js +4 -4
- package/src/models/concepts/BusinessScenarioModel.js +2 -1
- package/src/models/concepts/__mock__/business_scenario_data.json +4 -4
- package/src/models/content/__tests__/ContentModel.spec.js +4 -4
- package/src/models/href/Href.js +3 -5
- package/src/models/href/__tests__/Href.spec.js +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,41 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file. See [commit-and-tag-version](https://github.com/absolute-version/commit-and-tag-version) for commit guidelines.
|
|
4
4
|
|
|
5
|
+
## [1.42.1](https://git.beinformed.com/public/nl.beinformed.bi.layout.lib.ui/compare/v1.42.0...v1.42.1) (2024-03-05)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
* **href:** path of href should not be decoded ([49974b1](https://git.beinformed.com/public/nl.beinformed.bi.layout.lib.ui/commit/49974b19b2cbc407351e66b7e3124808ce506ab3))
|
|
11
|
+
|
|
12
|
+
## [1.42.0](https://git.beinformed.com/public/nl.beinformed.bi.layout.lib.ui/compare/v1.41.0...v1.42.0) (2024-03-05)
|
|
13
|
+
|
|
14
|
+
## [1.41.8](https://git.beinformed.com/public/nl.beinformed.bi.layout.lib.ui/compare/v1.41.7...v1.41.8) (2024-03-04)
|
|
15
|
+
|
|
16
|
+
## [1.41.7](https://git.beinformed.com/public/nl.beinformed.bi.layout.lib.ui/compare/v1.41.6...v1.41.7) (2024-03-04)
|
|
17
|
+
|
|
18
|
+
## [1.41.6](https://git.beinformed.com/public/nl.beinformed.bi.layout.lib.ui/compare/v1.41.5...v1.41.6) (2024-03-04)
|
|
19
|
+
|
|
20
|
+
## [1.41.5](https://git.beinformed.com/public/nl.beinformed.bi.layout.lib.ui/compare/v1.41.4...v1.41.5) (2024-03-04)
|
|
21
|
+
|
|
22
|
+
## [1.41.4](https://git.beinformed.com/public/nl.beinformed.bi.layout.lib.ui/compare/v1.41.3...v1.41.4) (2024-02-28)
|
|
23
|
+
|
|
24
|
+
## [1.41.3](https://git.beinformed.com/public/nl.beinformed.bi.layout.lib.ui/compare/v1.41.2...v1.41.3) (2024-02-20)
|
|
25
|
+
|
|
26
|
+
## [1.41.2](https://git.beinformed.com/public/nl.beinformed.bi.layout.lib.ui/compare/v1.41.1...v1.41.2) (2024-02-20)
|
|
27
|
+
|
|
28
|
+
## [1.41.1](https://git.beinformed.com/public/nl.beinformed.bi.layout.lib.ui/compare/v1.40.0...v1.41.1) (2024-02-19)
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
### Features
|
|
32
|
+
|
|
33
|
+
* **avatarForTitleAttribute:** added avatarForTitleAttribute ([319e1e9](https://git.beinformed.com/public/nl.beinformed.bi.layout.lib.ui/commit/319e1e9e91615bc86aec7b5efae5b46cb41684f4))
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
### Bug Fixes
|
|
37
|
+
|
|
38
|
+
* **avatarForTitleAttribute:** changed LayoutHint AVATAR_FOR_TITLE to AVATAR_IN_TITLE ([2a87110](https://git.beinformed.com/public/nl.beinformed.bi.layout.lib.ui/commit/2a87110bcbe3d9d1c08551afcd8b6ebbe3f94042))
|
|
39
|
+
|
|
5
40
|
## [1.41.8](https://git.beinformed.com/public/nl.beinformed.bi.layout.lib.ui/compare/v1.41.7...v1.41.8) (2024-03-04)
|
|
6
41
|
|
|
7
42
|
## [1.41.7](https://git.beinformed.com/public/nl.beinformed.bi.layout.lib.ui/compare/v1.41.6...v1.41.7) (2024-03-04)
|
|
@@ -43,7 +43,8 @@ class BusinessScenarioModel extends ConceptDetailModel {
|
|
|
43
43
|
PERSONA: getSetting("BUSINESS_SCENARIO_PERSONA_CONCEPT_TYPE", [`${pathToKmt}/Persona`]),
|
|
44
44
|
SCENARIO: getSetting("BUSINESS_SCENARIO_CONCEPT_TYPE", [`${pathToKmt}/BusinessScenario`])
|
|
45
45
|
};
|
|
46
|
-
|
|
46
|
+
const decodedConceptTypeHref = decodeURIComponent(conceptTypeHref);
|
|
47
|
+
return Array.isArray(conceptTypeSettings[settingName]) && conceptTypeSettings[settingName].some(conceptTypeSetting => _endsWithInstanceProperty(decodedConceptTypeHref).call(decodedConceptTypeHref, conceptTypeSetting));
|
|
47
48
|
}
|
|
48
49
|
|
|
49
50
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BusinessScenarioModel.js","names":["ConceptDetailModel","ConceptTypeDetailModel","getSetting","BusinessScenarioModel","constructor","arguments","_defineProperty","type","modelName","isApplicableModel","data","isOfConceptType","_links","concepttype","href","conceptTypeHref","settingName","pathToKmt","conceptTypeSettings","STEP","PERSONA","SCENARIO","Array","isArray","some","conceptTypeSetting","_endsWithInstanceProperty","call","getInitialChildModelLinks","_context","_context2","childModelLinks","scenarioStepLinks","_mapInstanceProperty","_filterInstanceProperty","relationsCollection","all","relation","direction","concept","concepttypeHref","path","asLinkModel","length","push","setChildModels","models","conceptTypeModel","_findInstanceProperty","model","conceptType","scenarioSteps","i","selfhref","_scenarioSteps","actors","forEach","scenarioStep","_context3","relationsToActor","newRelationToActor","actor","key"],"sources":["../../../src/models/concepts/BusinessScenarioModel.js"],"sourcesContent":["// @flow\nimport ConceptDetailModel from \"./ConceptDetailModel\";\nimport ConceptTypeDetailModel from \"./ConceptTypeDetailModel\";\nimport { getSetting } from \"../../constants/Settings\";\n\nimport type { ModularUIResponse } from \"../../modularui\";\nimport type { ModularUIModel } from \"../types\";\nimport type LinkModel from \"../links/LinkModel\";\nimport type ConceptLinkModel from \"./ConceptLinkModel\";\n\n/**\n */\nclass BusinessScenarioModel extends ConceptDetailModel {\n _scenarioSteps: Array<ConceptDetailModel>;\n\n /**\n */\n get type(): string {\n return \"BusinessScenario\";\n }\n\n /**\n */\n static get modelName(): string {\n return \"BusinessScenario\";\n }\n\n /**\n */\n static isApplicableModel(data: ModularUIResponse): boolean {\n return BusinessScenarioModel.isOfConceptType(\n data?.data?._links?.concepttype?.href,\n \"SCENARIO\",\n );\n }\n\n /**\n */\n static isOfConceptType(\n conceptTypeHref: ?string,\n settingName: \"STEP\" | \"PERSONA\" | \"SCENARIO\",\n ): boolean {\n if (!conceptTypeHref) {\n return false;\n }\n\n const pathToKmt = \"/Library/KMTs/Business scenarios.bixml\";\n\n const conceptTypeSettings = {\n STEP: getSetting(\"BUSINESS_SCENARIO_STEP_CONCEPT_TYPE\", [\n `${pathToKmt}/ScenarioStep`,\n ]),\n PERSONA: getSetting(\"BUSINESS_SCENARIO_PERSONA_CONCEPT_TYPE\", [\n `${pathToKmt}/Persona`,\n ]),\n SCENARIO: getSetting(\"BUSINESS_SCENARIO_CONCEPT_TYPE\", [\n `${pathToKmt}/BusinessScenario`,\n ]),\n };\n\n return (\n Array.isArray(conceptTypeSettings[settingName]) &&\n conceptTypeSettings[settingName].some((conceptTypeSetting) =>\n
|
|
1
|
+
{"version":3,"file":"BusinessScenarioModel.js","names":["ConceptDetailModel","ConceptTypeDetailModel","getSetting","BusinessScenarioModel","constructor","arguments","_defineProperty","type","modelName","isApplicableModel","data","isOfConceptType","_links","concepttype","href","conceptTypeHref","settingName","pathToKmt","conceptTypeSettings","STEP","PERSONA","SCENARIO","decodedConceptTypeHref","decodeURIComponent","Array","isArray","some","conceptTypeSetting","_endsWithInstanceProperty","call","getInitialChildModelLinks","_context","_context2","childModelLinks","scenarioStepLinks","_mapInstanceProperty","_filterInstanceProperty","relationsCollection","all","relation","direction","concept","concepttypeHref","path","asLinkModel","length","push","setChildModels","models","conceptTypeModel","_findInstanceProperty","model","conceptType","scenarioSteps","i","selfhref","_scenarioSteps","actors","forEach","scenarioStep","_context3","relationsToActor","newRelationToActor","actor","key"],"sources":["../../../src/models/concepts/BusinessScenarioModel.js"],"sourcesContent":["// @flow\nimport ConceptDetailModel from \"./ConceptDetailModel\";\nimport ConceptTypeDetailModel from \"./ConceptTypeDetailModel\";\nimport { getSetting } from \"../../constants/Settings\";\n\nimport type { ModularUIResponse } from \"../../modularui\";\nimport type { ModularUIModel } from \"../types\";\nimport type LinkModel from \"../links/LinkModel\";\nimport type ConceptLinkModel from \"./ConceptLinkModel\";\n\n/**\n */\nclass BusinessScenarioModel extends ConceptDetailModel {\n _scenarioSteps: Array<ConceptDetailModel>;\n\n /**\n */\n get type(): string {\n return \"BusinessScenario\";\n }\n\n /**\n */\n static get modelName(): string {\n return \"BusinessScenario\";\n }\n\n /**\n */\n static isApplicableModel(data: ModularUIResponse): boolean {\n return BusinessScenarioModel.isOfConceptType(\n data?.data?._links?.concepttype?.href,\n \"SCENARIO\",\n );\n }\n\n /**\n */\n static isOfConceptType(\n conceptTypeHref: ?string,\n settingName: \"STEP\" | \"PERSONA\" | \"SCENARIO\",\n ): boolean {\n if (!conceptTypeHref) {\n return false;\n }\n\n const pathToKmt = \"/Library/KMTs/Business scenarios.bixml\";\n\n const conceptTypeSettings = {\n STEP: getSetting(\"BUSINESS_SCENARIO_STEP_CONCEPT_TYPE\", [\n `${pathToKmt}/ScenarioStep`,\n ]),\n PERSONA: getSetting(\"BUSINESS_SCENARIO_PERSONA_CONCEPT_TYPE\", [\n `${pathToKmt}/Persona`,\n ]),\n SCENARIO: getSetting(\"BUSINESS_SCENARIO_CONCEPT_TYPE\", [\n `${pathToKmt}/BusinessScenario`,\n ]),\n };\n\n const decodedConceptTypeHref = decodeURIComponent(conceptTypeHref);\n return (\n Array.isArray(conceptTypeSettings[settingName]) &&\n conceptTypeSettings[settingName].some((conceptTypeSetting) =>\n decodedConceptTypeHref.endsWith(conceptTypeSetting),\n )\n );\n }\n\n /**\n */\n getInitialChildModelLinks(): Array<LinkModel> {\n const childModelLinks = super.getInitialChildModelLinks();\n\n const scenarioStepLinks = this.relationsCollection.all\n .filter(\n (relation) =>\n relation.direction === \"outgoing\" &&\n BusinessScenarioModel.isOfConceptType(\n relation.concept.concepttypeHref?.path,\n \"STEP\",\n ),\n )\n .map((relation) => relation.concept.asLinkModel());\n\n if (scenarioStepLinks.length > 0) {\n childModelLinks.push(...scenarioStepLinks);\n }\n\n return childModelLinks;\n }\n\n /**\n */\n setChildModels(models: Array<ModularUIModel>) {\n // $FlowExpectedError[incompatible-type]\n const conceptTypeModel: ?ConceptTypeDetailModel = models.find(\n (model) => model instanceof ConceptTypeDetailModel,\n );\n\n if (conceptTypeModel) {\n this.conceptType = conceptTypeModel;\n }\n\n this.relationsCollection.setChildModels(models);\n\n const scenarioSteps = [];\n for (let i = 0; i < models.length; i++) {\n const model = models[i];\n\n if (\n model instanceof ConceptDetailModel &&\n BusinessScenarioModel.isOfConceptType(\n model.conceptType?.selfhref.path,\n \"STEP\",\n )\n ) {\n scenarioSteps.push(model);\n }\n }\n\n this.scenarioSteps = scenarioSteps;\n }\n\n /**\n */\n set scenarioSteps(models: Array<ConceptDetailModel>) {\n this._scenarioSteps = models;\n }\n\n /**\n */\n get scenarioSteps(): Array<ConceptDetailModel> {\n return this._scenarioSteps;\n }\n\n /**\n */\n get actors(): Array<ConceptLinkModel> {\n const actors = [];\n\n this.scenarioSteps.forEach((scenarioStep) => {\n const relationsToActor = scenarioStep.relationsCollection.find(\n (relation) =>\n relation.direction === \"outgoing\" &&\n BusinessScenarioModel.isOfConceptType(\n relation.concept.concepttypeHref?.path,\n \"PERSONA\",\n ),\n );\n\n const newRelationToActor =\n relationsToActor &&\n !actors.some((actor) => actor.key === relationsToActor.concept.key);\n\n if (relationsToActor && newRelationToActor) {\n actors.push(relationsToActor.concept);\n }\n });\n\n return actors;\n }\n}\n\nexport default BusinessScenarioModel;\n"],"mappings":";;;;;AACA,OAAOA,kBAAkB,MAAM,sBAAsB;AACrD,OAAOC,sBAAsB,MAAM,0BAA0B;AAC7D,SAASC,UAAU,QAAQ,0BAA0B;AAOrD;AACA;AACA,MAAMC,qBAAqB,SAASH,kBAAkB,CAAC;EAAAI,YAAA;IAAA,SAAAC,SAAA;IAAAC,eAAA;EAAA;EAGrD;AACF;EACE,IAAIC,IAAIA,CAAA,EAAW;IACjB,OAAO,kBAAkB;EAC3B;;EAEA;AACF;EACE,WAAWC,SAASA,CAAA,EAAW;IAC7B,OAAO,kBAAkB;EAC3B;;EAEA;AACF;EACE,OAAOC,iBAAiBA,CAACC,IAAuB,EAAW;IACzD,OAAOP,qBAAqB,CAACQ,eAAe,CAC1CD,IAAI,EAAEA,IAAI,EAAEE,MAAM,EAAEC,WAAW,EAAEC,IAAI,EACrC,UACF,CAAC;EACH;;EAEA;AACF;EACE,OAAOH,eAAeA,CACpBI,eAAwB,EACxBC,WAA4C,EACnC;IACT,I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R,IAAA,CAAA+B,SAAA,EACtDrB,QAAQ,IACPA,QAAQ,CAACC,SAAS,KAAK,UAAU,IACjCrC,qBAAqB,CAACQ,eAAe,CACnC4B,QAAQ,CAACE,OAAO,CAACC,eAAe,EAAEC,IAAI,EACtC,SACF,CACJ,CAAC;MAED,MAAMmB,kBAAkB,GACtBD,gBAAgB,IAChB,CAACJ,MAAM,CAAC/B,IAAI,CAAEqC,KAAK,IAAKA,KAAK,CAACC,GAAG,KAAKH,gBAAgB,CAACpB,OAAO,CAACuB,GAAG,CAAC;MAErE,IAAIH,gBAAgB,IAAIC,kBAAkB,EAAE;QAC1CL,MAAM,CAACX,IAAI,CAACe,gBAAgB,CAACpB,OAAO,CAAC;MACvC;IACF,CAAC,CAAC;IAEF,OAAOgB,MAAM;EACf;AACF;AAEA,eAAetD,qBAAqB"}
|
package/esm/models/href/Href.js
CHANGED
|
@@ -110,8 +110,7 @@ class Href {
|
|
|
110
110
|
* Retrieve the relative path part of a href string, e.g. https://www.beinformed.com/BeInformed/tab/view?q=url => /tab/view
|
|
111
111
|
*/
|
|
112
112
|
static getPathFromString(href) {
|
|
113
|
-
const
|
|
114
|
-
const hrefNoHash = _includesInstanceProperty(decodedHref).call(decodedHref, "#") ? decodedHref.substr(0, decodedHref.indexOf("#")) : decodedHref;
|
|
113
|
+
const hrefNoHash = _includesInstanceProperty(href).call(href, "#") ? href.substring(0, href.indexOf("#")) : href;
|
|
115
114
|
return _includesInstanceProperty(hrefNoHash).call(hrefNoHash, "?") ? hrefNoHash.split("?")[0] : hrefNoHash;
|
|
116
115
|
}
|
|
117
116
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Href.js","names":["getBasePath","HTTP_METHODS","CONTENT_PATH","Parameter","IllegalArgumentException","Href","constructor","href","resourcetype","_defineProperty","GET","setFromHref","setFromString","setFromLocationOrObject","path","parameters","hash","state","pathname","_path","search","addParametersFromString","Array","isArray","_parameters","_context","_mapInstanceProperty","call","param","addParameter","_name","_value","_prefix","getHashFromString","_hash","_state","getPathFromString","isChangePassword","_context2","_includesInstanceProperty","isCamelRoute","_startsWithInstanceProperty","checkAbsoluteUrl","checkAbsolute","RegExp","test","isExternal","decodedHref","decodeURI","hrefNoHash","substr","indexOf","split","arguments","length","undefined","forEach","paramFromString","fromString","setParameter","name","value","prefix","removeParameter","push","getParameter","_context3","_findInstanceProperty","hasParameter","method","_method","_context4","valueToRemove","newValue","filter","val","join","_context5","_filterInstanceProperty","getQuerystring","_context6","_context7","withPrefix","toQuerystring","getQuerystringForModularUI","_context8","_context9","isModUIParameter","querystring","setState","_resourcetype","absolutepath","absolutehref","absolutehrefPrefixedQuerystring","startsWith","thisPath","otherPath","equals","equalsWithParameters","_context10","thisParams","toString","every","isContent","_context11","getReferenceHash","_referenceHash","setReferenceHash","referenceHash","toLocation"],"sources":["../../../src/models/href/Href.js"],"sourcesContent":["// @flow\nimport { getBasePath, HTTP_METHODS, CONTENT_PATH } from \"../../constants\";\n\nimport Parameter from \"../parameter/Parameter\";\nimport { IllegalArgumentException } from \"../../exceptions\";\n\nimport type { LocationShape } from \"react-router\";\n\ntype HrefObject = {\n _path: string,\n _hash: string,\n _parameters: Array<Parameter>,\n _resourcetype: string,\n _method: $Keys<typeof HTTP_METHODS>,\n _state: ?{ [key: string]: any },\n pathname: ?string,\n};\n\nexport type HrefInput = Href | HrefObject | LocationShape | string;\n\n/**\n * Defines a Href with the parameters\n */\nclass Href {\n _path: string = \"\";\n _hash: string = \"\";\n _parameters: Array<Parameter> = [];\n _resourcetype: string = \"\";\n _method: $Keys<typeof HTTP_METHODS> = HTTP_METHODS.GET;\n _state: any = null;\n _referenceHash: ?number;\n\n /**\n * Create a Href\n */\n constructor(href?: HrefInput, resourcetype?: string) {\n this.resourcetype = resourcetype ?? \"\";\n\n if (href instanceof Href) {\n this.setFromHref(href);\n } else if (typeof href === \"string\") {\n this.setFromString(href);\n } else if (typeof href === \"object\") {\n this.setFromLocationOrObject(href);\n }\n }\n\n /**\n * Set parameters from Href model input\n */\n setFromHref(href: Href) {\n this.path = href.path;\n this.parameters = href.parameters;\n this.hash = href.hash;\n this.state = href.state;\n }\n\n /**\n */\n setFromLocationOrObject(href: LocationShape | HrefObject) {\n if (typeof href[\"pathname\"] === \"string\") {\n this.path = href.pathname;\n } else if (typeof href._path === \"string\") {\n this.path = href._path;\n }\n\n if (href.search) {\n this.addParametersFromString(href.search);\n } else if (Array.isArray(href._parameters)) {\n // $FlowExpectedError[incompatible-call]\n href._parameters.map((param: Parameter) =>\n this.addParameter(param._name, param._value, param._prefix),\n );\n }\n\n if (href.hash) {\n this.hash = Href.getHashFromString(href.hash);\n } else if (typeof href._hash === \"string\") {\n this.hash = href._hash;\n }\n\n if (href.state) {\n this.state = href.state || null;\n } else if (typeof href._state === \"object\") {\n this.state = href._state;\n }\n }\n\n /**\n * Set parameters from string input\n */\n setFromString(href: string) {\n this.path = Href.getPathFromString(href);\n this.addParametersFromString(href);\n this.hash = Href.getHashFromString(href);\n }\n\n /**\n */\n get isChangePassword(): boolean {\n return this._path.includes(\"/change-password\");\n }\n\n /**\n * check if the path is referencing a camel route\n */\n static isCamelRoute(path: string): boolean {\n return (\n path.startsWith(\"/restServices\") && !path.startsWith(\"/restServices/ui\")\n );\n }\n\n /**\n */\n static checkAbsoluteUrl(href: string): boolean {\n const checkAbsolute = new RegExp(\"^(?:[a-z]+:)?//\", \"i\");\n return checkAbsolute.test(href);\n }\n\n // Check if url is relative (not checking for absolute urls with same domain)\n /**\n */\n get isExternal(): boolean {\n return Href.checkAbsoluteUrl(this.path);\n }\n\n /**\n * Retrieve the relative path part of a href string, e.g. https://www.beinformed.com/BeInformed/tab/view?q=url => /tab/view\n */\n static getPathFromString(href: string): string {\n const decodedHref = decodeURI(href);\n\n const hrefNoHash = decodedHref.includes(\"#\")\n ? decodedHref.substr(0, decodedHref.indexOf(\"#\"))\n : decodedHref;\n\n return hrefNoHash.includes(\"?\") ? hrefNoHash.split(\"?\")[0] : hrefNoHash;\n }\n\n /**\n * Retrieve hash of href string\n */\n static getHashFromString(href: string = \"\"): string {\n return href.includes(\"#\") ? href.substr(href.indexOf(\"#\") + 1) : \"\";\n }\n\n /**\n * Add a parameter for each parameter found in the querystring of an URL string, e.g. https://www.beinformed.com?q=url => q=url\n */\n addParametersFromString(href: string): Href {\n if (href.includes(\"?\")) {\n href\n .split(\"?\")[1]\n .split(\"&\")\n .forEach((param) => {\n const paramFromString = Parameter.fromString(param);\n if (paramFromString) {\n this.setParameter(\n paramFromString.name,\n paramFromString.value,\n paramFromString.prefix,\n );\n }\n });\n }\n\n return this;\n }\n\n /**\n * Add a querystring parameter to the parameter collection of this Href, skips parameters that have a value of null\n */\n addParameter(name: string, value: ?string, prefix: ?string): Href {\n if (value !== null) {\n this.removeParameter(name, prefix);\n this._parameters.push(new Parameter(prefix, name, value));\n }\n\n return this;\n }\n\n /**\n * Adds or overwrites a parameter when it exists and value is not null.\n * Removes the parameter when the value is null\n */\n setParameter(name: string, value: ?string, prefix: ?string): Href {\n if (value === null) {\n this.removeParameter(name, prefix);\n } else {\n this.addParameter(name, value, prefix);\n }\n\n return this;\n }\n\n /**\n * Retrieve a parameter by it's name and (optionally) prefix\n */\n getParameter(name: string, prefix: ?string): ?Parameter {\n return this._parameters.find(\n (param) => param.prefix === prefix && param.name === name,\n );\n }\n\n /**\n */\n hasParameter(name: string, prefix: ?string): boolean {\n return this.getParameter(name, prefix) !== undefined;\n }\n\n /**\n * Get request method\n */\n get method(): $Keys<typeof HTTP_METHODS> {\n return this._method;\n }\n\n /**\n * Set request method\n */\n set method(method: $Keys<typeof HTTP_METHODS>) {\n this._method = method || HTTP_METHODS.GET;\n }\n\n /**\n * Retrieve all paremters\n */\n get parameters(): Array<Parameter> {\n return this._parameters;\n }\n\n /**\n * Replace parameters of Href\n */\n set parameters(parameters: Array<Parameter>) {\n this._parameters = parameters;\n }\n\n /**\n * Remove a parameter from the parameter collection\n */\n removeParameter(name: string, prefix: ?string, value: ?string): Href {\n if (value !== undefined) {\n const valueToRemove = value;\n\n this._parameters = this._parameters.map((param) => {\n if (param.prefix === prefix && param.name === name) {\n const newValue = param.value\n ?.split(\",\")\n .filter((val) => val !== valueToRemove)\n .join(\",\");\n return new Parameter(param.prefix, param.name, newValue);\n }\n return param;\n });\n } else {\n this._parameters = this._parameters.filter(\n (param) => param.prefix !== prefix || param.name !== name,\n );\n }\n\n return this;\n }\n\n /**\n * Get the parameters as a querystring, e.g. param1=value1¶m2=value2, optionally with prefix\n */\n getQuerystring(withPrefix: boolean = false): string {\n return this.parameters\n .filter((param) => param.value != null && param.value !== \"\")\n .map((param) => param.toQuerystring(withPrefix))\n .join(\"&\");\n }\n\n /**\n * Retrieve a querystring that only contains parameter that can be send to the modular ui, parameters are filtered by prefix\n */\n getQuerystringForModularUI(prefix: string = \"\"): string {\n return this.parameters\n .filter(\n (param) =>\n param.isModUIParameter &&\n (!prefix || !param.prefix || param.prefix === prefix) &&\n param.value != null,\n )\n .map((param) => param.toQuerystring(false))\n .join(\"&\");\n }\n\n /**\n * Retrieve all parameters from the parameter collection in a querystring style name1=value1&name2=value2, without the prefix\n */\n get querystring(): string {\n return this.getQuerystring(false);\n }\n\n /**\n * Set the path of the Href, the part before the querystring question mark\n */\n set path(path: string) {\n this._path = path;\n }\n\n /**\n * Retrieve the path\n */\n get path(): string {\n return this._path || \"\";\n }\n\n /**\n * Set hash\n */\n set hash(hash: string) {\n this._hash = hash;\n }\n\n /**\n * Retrieve hash\n */\n get hash(): string {\n return this._hash;\n }\n\n /**\n */\n set state(state: any) {\n this._state = state;\n }\n\n /**\n */\n get state(): any {\n return this._state;\n }\n\n /**\n */\n setState(state: any): Href {\n this.state = state;\n\n return this;\n }\n\n /**\n * Set resourctype\n */\n set resourcetype(resourcetype: string) {\n this._resourcetype = resourcetype;\n }\n\n /**\n * Retrieve resourceType\n */\n get resourcetype(): string {\n return this._resourcetype;\n }\n\n /**\n * Retrieve the path combined with the base path (context-path) of the application, e.g. /BeInformed\n */\n get absolutepath(): string {\n if (this.isExternal) {\n return this.path;\n }\n\n return getBasePath() + this.path;\n }\n\n /**\n * Retrieves the combination of the path and the querystring\n */\n get href(): string {\n return this.querystring.length > 0\n ? [this.path, this.querystring].join(\"?\")\n : this.path;\n }\n\n /**\n * Getting the URL including the base path, querystring is prefixed\n */\n get absolutehref(): string {\n const querystring = this.getQuerystring(false);\n\n return querystring.length > 0\n ? [this.absolutepath, querystring].join(\"?\")\n : this.absolutepath;\n }\n\n /**\n * Getting the URL including the base path, the querystring is prefixed\n */\n get absolutehrefPrefixedQuerystring(): string {\n const querystring = this.getQuerystring(true);\n\n return querystring.length > 0\n ? [this.absolutepath, querystring].join(\"?\")\n : this.absolutepath;\n }\n\n /**\n * Checks if the URL starts within the given href\n */\n startsWith(href: Href | string): boolean {\n const thisPath = `${this.path}/`;\n const otherPath = href instanceof Href ? `${href.path}/` : href;\n\n return thisPath.startsWith(otherPath);\n }\n\n /**\n * Checks if the given Href equals this Href\n */\n equals(href: Href | string): boolean {\n if (href instanceof Href) {\n return this.path === href.path;\n }\n\n return this.path === href;\n }\n\n /**\n */\n equalsWithParameters(href: Href): boolean {\n if (!this.equals(href)) {\n return false;\n }\n\n if (href instanceof Href) {\n if (this.parameters.length !== href.parameters.length) {\n return false;\n }\n\n if (this.parameters.length === 0 && href.parameters.length === 0) {\n return true;\n }\n\n const thisParams = this.parameters.map((param) => param.toString());\n\n return href.parameters.every((param) =>\n thisParams.includes(param.toString()),\n );\n }\n\n throw new IllegalArgumentException(`${href} is not an instance of Href`);\n }\n\n /**\n * Indicates if the link is a content link\n */\n get isContent(): boolean {\n return this.absolutepath.startsWith(`${getBasePath()}${CONTENT_PATH}`);\n }\n\n /**\n */\n getReferenceHash(): ?number {\n return this._referenceHash;\n }\n\n /**\n */\n setReferenceHash(referenceHash: number) {\n this._referenceHash = referenceHash;\n }\n\n /**\n * Returns a complete url from the Href\n */\n toString(): string {\n return this.href;\n }\n\n /**\n */\n toLocation(): LocationShape {\n return {\n pathname: this.path,\n search: this.querystring.length > 0 ? `?${this.querystring}` : \"\",\n hash: this.hash.length > 0 ? `#${this.hash}` : \"\",\n state: this.state,\n };\n }\n}\n\nexport default Href;\n"],"mappings":";;;;;;AACA,SAASA,WAAW,EAAEC,YAAY,EAAEC,YAAY,QAAQ,iBAAiB;AAEzE,OAAOC,SAAS,MAAM,wBAAwB;AAC9C,SAASC,wBAAwB,QAAQ,kBAAkB;AAgB3D;AACA;AACA;AACA,MAAMC,IAAI,CAAC;EAST;AACF;AACA;EACEC,WAAWA,CAACC,IAAgB,EAAEC,YAAqB,EAAE;IAAAC,eAAA,gBAXrC,EAAE;IAAAA,eAAA,gBACF,EAAE;IAAAA,eAAA,sBACc,EAAE;IAAAA,eAAA,wBACV,EAAE;IAAAA,eAAA,kBACYR,YAAY,CAACS,GAAG;IAAAD,eAAA,iBACxC,IAAI;IAAAA,eAAA;IAOhB,IAAI,CAACD,YAAY,GAAGA,YAAY,IAAI,EAAE;IAEtC,IAAID,IAAI,YAAYF,IAAI,EAAE;MACxB,IAAI,CAACM,WAAW,CAACJ,IAAI,CAAC;IACxB,CAAC,MAAM,IAAI,OAAOA,IAAI,KAAK,QAAQ,EAAE;MACnC,IAAI,CAACK,aAAa,CAACL,IAAI,CAAC;IAC1B,CAAC,MAAM,IAAI,OAAOA,IAAI,KAAK,QAAQ,EAAE;MACnC,IAAI,CAACM,uBAAuB,CAACN,IAAI,CAAC;IACpC;EACF;;EAEA;AACF;AACA;EACEI,WAAWA,CAACJ,IAAU,EAAE;IACtB,IAAI,CAACO,IAAI,GAAGP,IAAI,CAACO,IAAI;IACrB,IAAI,CAACC,UAAU,GAAGR,IAAI,CAACQ,UAAU;IACjC,IAAI,CAACC,IAAI,GAAGT,IAAI,CAACS,IAAI;IACrB,IAAI,CAACC,KAAK,GAAGV,IAAI,CAACU,KAAK;EACzB;;EAEA;AACF;EACEJ,uBAAuBA,CAACN,IAAgC,EAAE;IACxD,IAAI,OAAOA,IAAI,CAAC,UAA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ENT_PATH","Parameter","IllegalArgumentException","Href","constructor","href","resourcetype","_defineProperty","GET","setFromHref","setFromString","setFromLocationOrObject","path","parameters","hash","state","pathname","_path","search","addParametersFromString","Array","isArray","_parameters","_context","_mapInstanceProperty","call","param","addParameter","_name","_value","_prefix","getHashFromString","_hash","_state","getPathFromString","isChangePassword","_context2","_includesInstanceProperty","isCamelRoute","_startsWithInstanceProperty","checkAbsoluteUrl","checkAbsolute","RegExp","test","isExternal","hrefNoHash","substring","indexOf","split","arguments","length","undefined","substr","forEach","paramFromString","fromString","setParameter","name","value","prefix","removeParameter","push","getParameter","_context3","_findInstanceProperty","hasParameter","method","_method","_context4","valueToRemove","newValue","filter","val","join","_context5","_filterInstanceProperty","getQuerystring","_context6","_context7","withPrefix","toQuerystring","getQuerystringForModularUI","_context8","_context9","isModUIParameter","querystring","setState","_resourcetype","absolutepath","absolutehref","absolutehrefPrefixedQuerystring","startsWith","thisPath","otherPath","equals","equalsWithParameters","_context10","thisParams","toString","every","isContent","_context11","getReferenceHash","_referenceHash","setReferenceHash","referenceHash","toLocation"],"sources":["../../../src/models/href/Href.js"],"sourcesContent":["// @flow\nimport { getBasePath, HTTP_METHODS, CONTENT_PATH } from \"../../constants\";\n\nimport Parameter from \"../parameter/Parameter\";\nimport { IllegalArgumentException } from \"../../exceptions\";\n\nimport type { LocationShape } from \"react-router\";\n\ntype HrefObject = {\n _path: string,\n _hash: string,\n _parameters: Array<Parameter>,\n _resourcetype: string,\n _method: $Keys<typeof HTTP_METHODS>,\n _state: ?{ [key: string]: any },\n pathname: ?string,\n};\n\nexport type HrefInput = Href | HrefObject | LocationShape | string;\n\n/**\n * Defines a Href with the parameters\n */\nclass Href {\n _path: string = \"\";\n _hash: string = \"\";\n _parameters: Array<Parameter> = [];\n _resourcetype: string = \"\";\n _method: $Keys<typeof HTTP_METHODS> = HTTP_METHODS.GET;\n _state: any = null;\n _referenceHash: ?number;\n\n /**\n * Create a Href\n */\n constructor(href?: HrefInput, resourcetype?: string) {\n this.resourcetype = resourcetype ?? \"\";\n\n if (href instanceof Href) {\n this.setFromHref(href);\n } else if (typeof href === \"string\") {\n this.setFromString(href);\n } else if (typeof href === \"object\") {\n this.setFromLocationOrObject(href);\n }\n }\n\n /**\n * Set parameters from Href model input\n */\n setFromHref(href: Href) {\n this.path = href.path;\n this.parameters = href.parameters;\n this.hash = href.hash;\n this.state = href.state;\n }\n\n /**\n */\n setFromLocationOrObject(href: LocationShape | HrefObject) {\n if (typeof href[\"pathname\"] === \"string\") {\n this.path = href.pathname;\n } else if (typeof href._path === \"string\") {\n this.path = href._path;\n }\n\n if (href.search) {\n this.addParametersFromString(href.search);\n } else if (Array.isArray(href._parameters)) {\n // $FlowExpectedError[incompatible-call]\n href._parameters.map((param: Parameter) =>\n this.addParameter(param._name, param._value, param._prefix),\n );\n }\n\n if (href.hash) {\n this.hash = Href.getHashFromString(href.hash);\n } else if (typeof href._hash === \"string\") {\n this.hash = href._hash;\n }\n\n if (href.state) {\n this.state = href.state || null;\n } else if (typeof href._state === \"object\") {\n this.state = href._state;\n }\n }\n\n /**\n * Set parameters from string input\n */\n setFromString(href: string) {\n this.path = Href.getPathFromString(href);\n this.addParametersFromString(href);\n this.hash = Href.getHashFromString(href);\n }\n\n /**\n */\n get isChangePassword(): boolean {\n return this._path.includes(\"/change-password\");\n }\n\n /**\n * check if the path is referencing a camel route\n */\n static isCamelRoute(path: string): boolean {\n return (\n path.startsWith(\"/restServices\") && !path.startsWith(\"/restServices/ui\")\n );\n }\n\n /**\n */\n static checkAbsoluteUrl(href: string): boolean {\n const checkAbsolute = new RegExp(\"^(?:[a-z]+:)?//\", \"i\");\n return checkAbsolute.test(href);\n }\n\n // Check if url is relative (not checking for absolute urls with same domain)\n /**\n */\n get isExternal(): boolean {\n return Href.checkAbsoluteUrl(this.path);\n }\n\n /**\n * Retrieve the relative path part of a href string, e.g. https://www.beinformed.com/BeInformed/tab/view?q=url => /tab/view\n */\n static getPathFromString(href: string): string {\n const hrefNoHash = href.includes(\"#\")\n ? href.substring(0, href.indexOf(\"#\"))\n : href;\n\n return hrefNoHash.includes(\"?\") ? hrefNoHash.split(\"?\")[0] : hrefNoHash;\n }\n\n /**\n * Retrieve hash of href string\n */\n static getHashFromString(href: string = \"\"): string {\n return href.includes(\"#\") ? href.substr(href.indexOf(\"#\") + 1) : \"\";\n }\n\n /**\n * Add a parameter for each parameter found in the querystring of an URL string, e.g. https://www.beinformed.com?q=url => q=url\n */\n addParametersFromString(href: string): Href {\n if (href.includes(\"?\")) {\n href\n .split(\"?\")[1]\n .split(\"&\")\n .forEach((param) => {\n const paramFromString = Parameter.fromString(param);\n if (paramFromString) {\n this.setParameter(\n paramFromString.name,\n paramFromString.value,\n paramFromString.prefix,\n );\n }\n });\n }\n\n return this;\n }\n\n /**\n * Add a querystring parameter to the parameter collection of this Href, skips parameters that have a value of null\n */\n addParameter(name: string, value: ?string, prefix: ?string): Href {\n if (value !== null) {\n this.removeParameter(name, prefix);\n this._parameters.push(new Parameter(prefix, name, value));\n }\n\n return this;\n }\n\n /**\n * Adds or overwrites a parameter when it exists and value is not null.\n * Removes the parameter when the value is null\n */\n setParameter(name: string, value: ?string, prefix: ?string): Href {\n if (value === null) {\n this.removeParameter(name, prefix);\n } else {\n this.addParameter(name, value, prefix);\n }\n\n return this;\n }\n\n /**\n * Retrieve a parameter by it's name and (optionally) prefix\n */\n getParameter(name: string, prefix: ?string): ?Parameter {\n return this._parameters.find(\n (param) => param.prefix === prefix && param.name === name,\n );\n }\n\n /**\n */\n hasParameter(name: string, prefix: ?string): boolean {\n return this.getParameter(name, prefix) !== undefined;\n }\n\n /**\n * Get request method\n */\n get method(): $Keys<typeof HTTP_METHODS> {\n return this._method;\n }\n\n /**\n * Set request method\n */\n set method(method: $Keys<typeof HTTP_METHODS>) {\n this._method = method || HTTP_METHODS.GET;\n }\n\n /**\n * Retrieve all paremters\n */\n get parameters(): Array<Parameter> {\n return this._parameters;\n }\n\n /**\n * Replace parameters of Href\n */\n set parameters(parameters: Array<Parameter>) {\n this._parameters = parameters;\n }\n\n /**\n * Remove a parameter from the parameter collection\n */\n removeParameter(name: string, prefix: ?string, value: ?string): Href {\n if (value !== undefined) {\n const valueToRemove = value;\n\n this._parameters = this._parameters.map((param) => {\n if (param.prefix === prefix && param.name === name) {\n const newValue = param.value\n ?.split(\",\")\n .filter((val) => val !== valueToRemove)\n .join(\",\");\n return new Parameter(param.prefix, param.name, newValue);\n }\n return param;\n });\n } else {\n this._parameters = this._parameters.filter(\n (param) => param.prefix !== prefix || param.name !== name,\n );\n }\n\n return this;\n }\n\n /**\n * Get the parameters as a querystring, e.g. param1=value1¶m2=value2, optionally with prefix\n */\n getQuerystring(withPrefix: boolean = false): string {\n return this.parameters\n .filter((param) => param.value != null && param.value !== \"\")\n .map((param) => param.toQuerystring(withPrefix))\n .join(\"&\");\n }\n\n /**\n * Retrieve a querystring that only contains parameter that can be send to the modular ui, parameters are filtered by prefix\n */\n getQuerystringForModularUI(prefix: string = \"\"): string {\n return this.parameters\n .filter(\n (param) =>\n param.isModUIParameter &&\n (!prefix || !param.prefix || param.prefix === prefix) &&\n param.value != null,\n )\n .map((param) => param.toQuerystring(false))\n .join(\"&\");\n }\n\n /**\n * Retrieve all parameters from the parameter collection in a querystring style name1=value1&name2=value2, without the prefix\n */\n get querystring(): string {\n return this.getQuerystring(false);\n }\n\n /**\n * Set the path of the Href, the part before the querystring question mark\n */\n set path(path: string) {\n this._path = path;\n }\n\n /**\n * Retrieve the path\n */\n get path(): string {\n return this._path || \"\";\n }\n\n /**\n * Set hash\n */\n set hash(hash: string) {\n this._hash = hash;\n }\n\n /**\n * Retrieve hash\n */\n get hash(): string {\n return this._hash;\n }\n\n /**\n */\n set state(state: any) {\n this._state = state;\n }\n\n /**\n */\n get state(): any {\n return this._state;\n }\n\n /**\n */\n setState(state: any): Href {\n this.state = state;\n\n return this;\n }\n\n /**\n * Set resourctype\n */\n set resourcetype(resourcetype: string) {\n this._resourcetype = resourcetype;\n }\n\n /**\n * Retrieve resourceType\n */\n get resourcetype(): string {\n return this._resourcetype;\n }\n\n /**\n * Retrieve the path combined with the base path (context-path) of the application, e.g. /BeInformed\n */\n get absolutepath(): string {\n if (this.isExternal) {\n return this.path;\n }\n\n return getBasePath() + this.path;\n }\n\n /**\n * Retrieves the combination of the path and the querystring\n */\n get href(): string {\n return this.querystring.length > 0\n ? [this.path, this.querystring].join(\"?\")\n : this.path;\n }\n\n /**\n * Getting the URL including the base path, querystring is prefixed\n */\n get absolutehref(): string {\n const querystring = this.getQuerystring(false);\n\n return querystring.length > 0\n ? [this.absolutepath, querystring].join(\"?\")\n : this.absolutepath;\n }\n\n /**\n * Getting the URL including the base path, the querystring is prefixed\n */\n get absolutehrefPrefixedQuerystring(): string {\n const querystring = this.getQuerystring(true);\n\n return querystring.length > 0\n ? [this.absolutepath, querystring].join(\"?\")\n : this.absolutepath;\n }\n\n /**\n * Checks if the URL starts within the given href\n */\n startsWith(href: Href | string): boolean {\n const thisPath = `${this.path}/`;\n const otherPath = href instanceof Href ? `${href.path}/` : href;\n\n return thisPath.startsWith(otherPath);\n }\n\n /**\n * Checks if the given Href equals this Href\n */\n equals(href: Href | string): boolean {\n if (href instanceof Href) {\n return this.path === href.path;\n }\n\n return this.path === href;\n }\n\n /**\n */\n equalsWithParameters(href: Href): boolean {\n if (!this.equals(href)) {\n return false;\n }\n\n if (href instanceof Href) {\n if (this.parameters.length !== href.parameters.length) {\n return false;\n }\n\n if (this.parameters.length === 0 && href.parameters.length === 0) {\n return true;\n }\n\n const thisParams = this.parameters.map((param) => param.toString());\n\n return href.parameters.every((param) =>\n thisParams.includes(param.toString()),\n );\n }\n\n throw new IllegalArgumentException(`${href} is not an instance of Href`);\n }\n\n /**\n * Indicates if the link is a content link\n */\n get isContent(): boolean {\n return this.absolutepath.startsWith(`${getBasePath()}${CONTENT_PATH}`);\n }\n\n /**\n */\n getReferenceHash(): ?number {\n return this._referenceHash;\n }\n\n /**\n */\n setReferenceHash(referenceHash: number) {\n this._referenceHash = referenceHash;\n }\n\n /**\n * Returns a complete url from the Href\n */\n toString(): string {\n return this.href;\n }\n\n /**\n */\n toLocation(): LocationShape {\n return {\n pathname: this.path,\n search: this.querystring.length > 0 ? `?${this.querystring}` : \"\",\n hash: this.hash.length > 0 ? `#${this.hash}` : \"\",\n state: this.state,\n };\n }\n}\n\nexport default Href;\n"],"mappings":";;;;;;AACA,SAASA,WAAW,EAAEC,YAAY,EAAEC,YAAY,QAAQ,iBAAiB;AAEzE,OAAOC,SAAS,MAAM,wBAAwB;AAC9C,SAASC,wBAAwB,QAAQ,kBAAkB;AAgB3D;AACA;AACA;AACA,MAAMC,IAAI,CAAC;EAST;AACF;AACA;EACEC,WAAWA,CAACC,IAAgB,EAAEC,YAAqB,EAAE;IAAAC,eAAA,gBAXrC,EAAE;IAAAA,eAAA,gBACF,EAAE;IAAAA,eAAA,sBACc,EAAE;IAAAA,eAAA,wBACV,EAAE;IAAAA,eAAA,kBACYR,YAAY,CAACS,GAAG;IAAAD,eAAA,iBACxC,IAAI;IAAAA,eAAA;IAOhB,IAAI,CAACD,YAAY,GAAGA,YAAY,IAAI,EAAE;IAEtC,IAAID,IAAI,YAAYF,IAAI,EAAE;MACxB,IAAI,CAACM,WAAW,CAACJ,IAAI,CAAC;IACxB,CAAC,MAAM,IAAI,OAAOA,IAAI,KAAK,QAAQ,EAAE;MACnC,IAAI,CAACK,aAAa,CAACL,IAAI,CAAC;IAC1B,CAAC,MAAM,IAAI,OAAOA,IAAI,KAAK,QAAQ,EAAE;MACnC,IAAI,CAACM,uBAAuB,CAACN,IAAI,CAAC;IACpC;EACF;;EAEA;AACF;AACA;EACEI,WAAWA,CAACJ,IAAU,EAAE;IACtB,IAAI,CAACO,IAAI,GAAGP,IAAI,CAACO,IAAI;IACrB,IAAI,CAACC,UAAU,GAAGR,IAAI,CAACQ,UAAU;IACjC,IAAI,CAACC,IAAI,GAAGT,IAAI,CAACS,IAAI;IACrB,IAAI,CAACC,KAAK,GAAGV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"}
|
|
@@ -45,7 +45,7 @@ describe("actionModel", () => {
|
|
|
45
45
|
processTask: {
|
|
46
46
|
_links: {
|
|
47
47
|
concept: {
|
|
48
|
-
href: "/concepts
|
|
48
|
+
href: "/concepts/%2FResearch%20grant%2FBusiness%20design%2FConstraints%2FEligible%20for%20research%20grant.bixml/EligibleResearchGrant",
|
|
49
49
|
},
|
|
50
50
|
},
|
|
51
51
|
consequenceType: "Decision",
|
|
@@ -200,7 +200,7 @@ describe("AttributeContent", () => {
|
|
|
200
200
|
"/content/_Context/Police incident decisions/Content/Breath analysis/Breathalyzer test.formalsource/Alert",
|
|
201
201
|
);
|
|
202
202
|
expect(firstSection.selfContentLink.encodedHref.toString()).toBe(
|
|
203
|
-
"/content/_Context%2FPolice
|
|
203
|
+
"/content/_Context%2FPolice%20incident%20decisions%2FContent%2FBreath%20analysis%2FBreathalyzer%20test.formalsource/Alert",
|
|
204
204
|
);
|
|
205
205
|
|
|
206
206
|
expect(firstSection.childSections).toHaveLength(2);
|
|
@@ -395,7 +395,7 @@ describe("attributeDataHelper", () => {
|
|
|
395
395
|
label: "Driving ban",
|
|
396
396
|
_links: {
|
|
397
397
|
concept: {
|
|
398
|
-
href: "/concepts
|
|
398
|
+
href: "/concepts/%2F_Context%2FPolice incident%20decisions%2FModels%2FSanctions%2FSanctions.bixml/DrivingBan",
|
|
399
399
|
},
|
|
400
400
|
},
|
|
401
401
|
content: {
|
|
@@ -177,7 +177,7 @@ describe("attributeModel", () => {
|
|
|
177
177
|
{
|
|
178
178
|
_links: {
|
|
179
179
|
concept: {
|
|
180
|
-
href: "/concepts
|
|
180
|
+
href: "/concepts/%2FIncident%2FBusiness%20design%2FProcess%20elementen%2FEerste%20contact.bixml/UitslagBlaastestType",
|
|
181
181
|
},
|
|
182
182
|
},
|
|
183
183
|
},
|
|
@@ -190,7 +190,7 @@ describe("attributeModel", () => {
|
|
|
190
190
|
setSetting(ALL_CONTENT_IN_DATA_SETTING, true);
|
|
191
191
|
|
|
192
192
|
expect(attribute.conceptLink.href.path).toBe(
|
|
193
|
-
"/concepts
|
|
193
|
+
"/concepts/%2FIncident%2FBusiness%20design%2FProcess%20elementen%2FEerste%20contact.bixml/UitslagBlaastestType",
|
|
194
194
|
);
|
|
195
195
|
|
|
196
196
|
expect(attribute.referenceDate).toBe("2010-09-10");
|
|
@@ -216,7 +216,7 @@ describe("attributeModel", () => {
|
|
|
216
216
|
{
|
|
217
217
|
_links: {
|
|
218
218
|
concept: {
|
|
219
|
-
href: "/concepts
|
|
219
|
+
href: "/concepts/%2FIncident%2FBusiness%20design%2FProcess%20elementen%2FEerste%20contact.bixml/UitslagBlaastestType",
|
|
220
220
|
},
|
|
221
221
|
},
|
|
222
222
|
},
|
|
@@ -226,7 +226,7 @@ describe("attributeModel", () => {
|
|
|
226
226
|
data: {
|
|
227
227
|
_links: {
|
|
228
228
|
self: {
|
|
229
|
-
href: "/concepts
|
|
229
|
+
href: "/concepts/%2FIncident%2FBusiness%20design%2FProcess%20elementen%2FEerste%20contact.bixml/UitslagBlaastestType",
|
|
230
230
|
},
|
|
231
231
|
},
|
|
232
232
|
filter: {
|
|
@@ -50,7 +50,8 @@ class BusinessScenarioModel extends _ConceptDetailModel.default {
|
|
|
50
50
|
PERSONA: (0, _Settings.getSetting)("BUSINESS_SCENARIO_PERSONA_CONCEPT_TYPE", [`${pathToKmt}/Persona`]),
|
|
51
51
|
SCENARIO: (0, _Settings.getSetting)("BUSINESS_SCENARIO_CONCEPT_TYPE", [`${pathToKmt}/BusinessScenario`])
|
|
52
52
|
};
|
|
53
|
-
|
|
53
|
+
const decodedConceptTypeHref = decodeURIComponent(conceptTypeHref);
|
|
54
|
+
return Array.isArray(conceptTypeSettings[settingName]) && conceptTypeSettings[settingName].some(conceptTypeSetting => (0, _endsWith.default)(decodedConceptTypeHref).call(decodedConceptTypeHref, conceptTypeSetting));
|
|
54
55
|
}
|
|
55
56
|
|
|
56
57
|
/**
|
|
@@ -58,10 +58,11 @@ class BusinessScenarioModel extends ConceptDetailModel {
|
|
|
58
58
|
]),
|
|
59
59
|
};
|
|
60
60
|
|
|
61
|
+
const decodedConceptTypeHref = decodeURIComponent(conceptTypeHref);
|
|
61
62
|
return (
|
|
62
63
|
Array.isArray(conceptTypeSettings[settingName]) &&
|
|
63
64
|
conceptTypeSettings[settingName].some((conceptTypeSetting) =>
|
|
64
|
-
|
|
65
|
+
decodedConceptTypeHref.endsWith(conceptTypeSetting),
|
|
65
66
|
)
|
|
66
67
|
);
|
|
67
68
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BusinessScenarioModel.js","names":["_ConceptDetailModel","_interopRequireDefault","require","_ConceptTypeDetailModel","_Settings","BusinessScenarioModel","ConceptDetailModel","constructor","arguments","_defineProperty2","default","type","modelName","isApplicableModel","data","isOfConceptType","_links","concepttype","href","conceptTypeHref","settingName","pathToKmt","conceptTypeSettings","STEP","getSetting","PERSONA","SCENARIO","Array","isArray","some","conceptTypeSetting","_endsWith","call","getInitialChildModelLinks","_context","_context2","childModelLinks","scenarioStepLinks","_map","_filter","relationsCollection","all","relation","direction","concept","concepttypeHref","path","asLinkModel","length","push","setChildModels","models","conceptTypeModel","_find","model","ConceptTypeDetailModel","conceptType","scenarioSteps","i","selfhref","_scenarioSteps","actors","forEach","scenarioStep","_context3","relationsToActor","newRelationToActor","actor","key","_default","exports"],"sources":["../../../src/models/concepts/BusinessScenarioModel.js"],"sourcesContent":["// @flow\nimport ConceptDetailModel from \"./ConceptDetailModel\";\nimport ConceptTypeDetailModel from \"./ConceptTypeDetailModel\";\nimport { getSetting } from \"../../constants/Settings\";\n\nimport type { ModularUIResponse } from \"../../modularui\";\nimport type { ModularUIModel } from \"../types\";\nimport type LinkModel from \"../links/LinkModel\";\nimport type ConceptLinkModel from \"./ConceptLinkModel\";\n\n/**\n */\nclass BusinessScenarioModel extends ConceptDetailModel {\n _scenarioSteps: Array<ConceptDetailModel>;\n\n /**\n */\n get type(): string {\n return \"BusinessScenario\";\n }\n\n /**\n */\n static get modelName(): string {\n return \"BusinessScenario\";\n }\n\n /**\n */\n static isApplicableModel(data: ModularUIResponse): boolean {\n return BusinessScenarioModel.isOfConceptType(\n data?.data?._links?.concepttype?.href,\n \"SCENARIO\",\n );\n }\n\n /**\n */\n static isOfConceptType(\n conceptTypeHref: ?string,\n settingName: \"STEP\" | \"PERSONA\" | \"SCENARIO\",\n ): boolean {\n if (!conceptTypeHref) {\n return false;\n }\n\n const pathToKmt = \"/Library/KMTs/Business scenarios.bixml\";\n\n const conceptTypeSettings = {\n STEP: getSetting(\"BUSINESS_SCENARIO_STEP_CONCEPT_TYPE\", [\n `${pathToKmt}/ScenarioStep`,\n ]),\n PERSONA: getSetting(\"BUSINESS_SCENARIO_PERSONA_CONCEPT_TYPE\", [\n `${pathToKmt}/Persona`,\n ]),\n SCENARIO: getSetting(\"BUSINESS_SCENARIO_CONCEPT_TYPE\", [\n `${pathToKmt}/BusinessScenario`,\n ]),\n };\n\n return (\n Array.isArray(conceptTypeSettings[settingName]) &&\n conceptTypeSettings[settingName].some((conceptTypeSetting) =>\n
|
|
1
|
+
{"version":3,"file":"BusinessScenarioModel.js","names":["_ConceptDetailModel","_interopRequireDefault","require","_ConceptTypeDetailModel","_Settings","BusinessScenarioModel","ConceptDetailModel","constructor","arguments","_defineProperty2","default","type","modelName","isApplicableModel","data","isOfConceptType","_links","concepttype","href","conceptTypeHref","settingName","pathToKmt","conceptTypeSettings","STEP","getSetting","PERSONA","SCENARIO","decodedConceptTypeHref","decodeURIComponent","Array","isArray","some","conceptTypeSetting","_endsWith","call","getInitialChildModelLinks","_context","_context2","childModelLinks","scenarioStepLinks","_map","_filter","relationsCollection","all","relation","direction","concept","concepttypeHref","path","asLinkModel","length","push","setChildModels","models","conceptTypeModel","_find","model","ConceptTypeDetailModel","conceptType","scenarioSteps","i","selfhref","_scenarioSteps","actors","forEach","scenarioStep","_context3","relationsToActor","newRelationToActor","actor","key","_default","exports"],"sources":["../../../src/models/concepts/BusinessScenarioModel.js"],"sourcesContent":["// @flow\nimport ConceptDetailModel from \"./ConceptDetailModel\";\nimport ConceptTypeDetailModel from \"./ConceptTypeDetailModel\";\nimport { getSetting } from \"../../constants/Settings\";\n\nimport type { ModularUIResponse } from \"../../modularui\";\nimport type { ModularUIModel } from \"../types\";\nimport type LinkModel from \"../links/LinkModel\";\nimport type ConceptLinkModel from \"./ConceptLinkModel\";\n\n/**\n */\nclass BusinessScenarioModel extends ConceptDetailModel {\n _scenarioSteps: Array<ConceptDetailModel>;\n\n /**\n */\n get type(): string {\n return \"BusinessScenario\";\n }\n\n /**\n */\n static get modelName(): string {\n return \"BusinessScenario\";\n }\n\n /**\n */\n static isApplicableModel(data: ModularUIResponse): boolean {\n return BusinessScenarioModel.isOfConceptType(\n data?.data?._links?.concepttype?.href,\n \"SCENARIO\",\n );\n }\n\n /**\n */\n static isOfConceptType(\n conceptTypeHref: ?string,\n settingName: \"STEP\" | \"PERSONA\" | \"SCENARIO\",\n ): boolean {\n if (!conceptTypeHref) {\n return false;\n }\n\n const pathToKmt = \"/Library/KMTs/Business scenarios.bixml\";\n\n const conceptTypeSettings = {\n STEP: getSetting(\"BUSINESS_SCENARIO_STEP_CONCEPT_TYPE\", [\n `${pathToKmt}/ScenarioStep`,\n ]),\n PERSONA: getSetting(\"BUSINESS_SCENARIO_PERSONA_CONCEPT_TYPE\", [\n `${pathToKmt}/Persona`,\n ]),\n SCENARIO: getSetting(\"BUSINESS_SCENARIO_CONCEPT_TYPE\", [\n `${pathToKmt}/BusinessScenario`,\n ]),\n };\n\n const decodedConceptTypeHref = decodeURIComponent(conceptTypeHref);\n return (\n Array.isArray(conceptTypeSettings[settingName]) &&\n conceptTypeSettings[settingName].some((conceptTypeSetting) =>\n decodedConceptTypeHref.endsWith(conceptTypeSetting),\n )\n );\n }\n\n /**\n */\n getInitialChildModelLinks(): Array<LinkModel> {\n const childModelLinks = super.getInitialChildModelLinks();\n\n const scenarioStepLinks = this.relationsCollection.all\n .filter(\n (relation) =>\n relation.direction === \"outgoing\" &&\n BusinessScenarioModel.isOfConceptType(\n relation.concept.concepttypeHref?.path,\n \"STEP\",\n ),\n )\n .map((relation) => relation.concept.asLinkModel());\n\n if (scenarioStepLinks.length > 0) {\n childModelLinks.push(...scenarioStepLinks);\n }\n\n return childModelLinks;\n }\n\n /**\n */\n setChildModels(models: Array<ModularUIModel>) {\n // $FlowExpectedError[incompatible-type]\n const conceptTypeModel: ?ConceptTypeDetailModel = models.find(\n (model) => model instanceof ConceptTypeDetailModel,\n );\n\n if (conceptTypeModel) {\n this.conceptType = conceptTypeModel;\n }\n\n this.relationsCollection.setChildModels(models);\n\n const scenarioSteps = [];\n for (let i = 0; i < models.length; i++) {\n const model = models[i];\n\n if (\n model instanceof ConceptDetailModel &&\n BusinessScenarioModel.isOfConceptType(\n model.conceptType?.selfhref.path,\n \"STEP\",\n )\n ) {\n scenarioSteps.push(model);\n }\n }\n\n this.scenarioSteps = scenarioSteps;\n }\n\n /**\n */\n set scenarioSteps(models: Array<ConceptDetailModel>) {\n this._scenarioSteps = models;\n }\n\n /**\n */\n get scenarioSteps(): Array<ConceptDetailModel> {\n return this._scenarioSteps;\n }\n\n /**\n */\n get actors(): Array<ConceptLinkModel> {\n const actors = [];\n\n this.scenarioSteps.forEach((scenarioStep) => {\n const relationsToActor = scenarioStep.relationsCollection.find(\n (relation) =>\n relation.direction === \"outgoing\" &&\n BusinessScenarioModel.isOfConceptType(\n relation.concept.concepttypeHref?.path,\n \"PERSONA\",\n ),\n );\n\n const newRelationToActor =\n relationsToActor &&\n !actors.some((actor) => actor.key === relationsToActor.concept.key);\n\n if (relationsToActor && newRelationToActor) {\n actors.push(relationsToActor.concept);\n }\n });\n\n return actors;\n }\n}\n\nexport default BusinessScenarioModel;\n"],"mappings":";;;;;;;;;;;;AACA,IAAAA,mBAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,uBAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,SAAA,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entmodel", () => {
|
|
|
58
58
|
"/content/Incident/Business design/Content/Blaastest.bixml/67beed02?entryDate=2021-08-31",
|
|
59
59
|
);
|
|
60
60
|
expect(contentModel.selfContentLink.encodedHref.toString()).toBe(
|
|
61
|
-
"/content/Incident%2FBusiness
|
|
61
|
+
"/content/Incident%2FBusiness%20design%2FContent%2FBlaastest.bixml/67beed02?entryDate=2021-08-31",
|
|
62
62
|
);
|
|
63
63
|
expect(contentModel.childSections).toHaveLength(0);
|
|
64
64
|
expect(contentModel.subSections).toHaveLength(0);
|
|
@@ -97,7 +97,7 @@ describe("contentmodel", () => {
|
|
|
97
97
|
"/content/Incident/Business design/Content/Blaastest.textilesource/uitslag?entryDate=2021-08-31",
|
|
98
98
|
);
|
|
99
99
|
expect(contentModel.selfContentLink.encodedHref.toString()).toBe(
|
|
100
|
-
"/content/Incident%2FBusiness
|
|
100
|
+
"/content/Incident%2FBusiness%20design%2FContent%2FBlaastest.textilesource/uitslag?entryDate=2021-08-31",
|
|
101
101
|
);
|
|
102
102
|
expect(contentModel.childSections).toHaveLength(0);
|
|
103
103
|
expect(contentModel.subSections).toHaveLength(0);
|
|
@@ -114,7 +114,7 @@ describe("contentmodel", () => {
|
|
|
114
114
|
expect(firstChildSectionLink.label).toBe("Pass");
|
|
115
115
|
expect(firstChildSectionLink.sourceLabel).toBeNull();
|
|
116
116
|
expect(firstChildSectionLink.encodedHref.toString()).toBe(
|
|
117
|
-
"/content/Incident%2FBusiness
|
|
117
|
+
"/content/Incident%2FBusiness%20design%2FContent%2FBlaastest.textilesource/pass?entryDate=2021-08-31",
|
|
118
118
|
);
|
|
119
119
|
});
|
|
120
120
|
|
|
@@ -146,7 +146,7 @@ describe("contentmodel", () => {
|
|
|
146
146
|
"/content/Incident/Business design/Content/Blaastest subsections.formalsource/BlaastestOpties?entryDate=2021-08-31",
|
|
147
147
|
);
|
|
148
148
|
expect(contentModel.selfContentLink.encodedHref.toString()).toBe(
|
|
149
|
-
"/content/Incident%2FBusiness
|
|
149
|
+
"/content/Incident%2FBusiness%20design%2FContent%2FBlaastest%20subsections.formalsource/BlaastestOpties?entryDate=2021-08-31",
|
|
150
150
|
);
|
|
151
151
|
expect(contentModel.childSections).toHaveLength(0);
|
|
152
152
|
expect(contentModel.subSections).toHaveLength(4);
|
package/lib/models/href/Href.js
CHANGED
|
@@ -117,8 +117,7 @@ class Href {
|
|
|
117
117
|
* Retrieve the relative path part of a href string, e.g. https://www.beinformed.com/BeInformed/tab/view?q=url => /tab/view
|
|
118
118
|
*/
|
|
119
119
|
static getPathFromString(href) {
|
|
120
|
-
const
|
|
121
|
-
const hrefNoHash = (0, _includes.default)(decodedHref).call(decodedHref, "#") ? decodedHref.substr(0, decodedHref.indexOf("#")) : decodedHref;
|
|
120
|
+
const hrefNoHash = (0, _includes.default)(href).call(href, "#") ? href.substring(0, href.indexOf("#")) : href;
|
|
122
121
|
return (0, _includes.default)(hrefNoHash).call(hrefNoHash, "?") ? hrefNoHash.split("?")[0] : hrefNoHash;
|
|
123
122
|
}
|
|
124
123
|
|
|
@@ -128,11 +128,9 @@ class Href {
|
|
|
128
128
|
* Retrieve the relative path part of a href string, e.g. https://www.beinformed.com/BeInformed/tab/view?q=url => /tab/view
|
|
129
129
|
*/
|
|
130
130
|
static getPathFromString(href: string): string {
|
|
131
|
-
const
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
? decodedHref.substr(0, decodedHref.indexOf("#"))
|
|
135
|
-
: decodedHref;
|
|
131
|
+
const hrefNoHash = href.includes("#")
|
|
132
|
+
? href.substring(0, href.indexOf("#"))
|
|
133
|
+
: href;
|
|
136
134
|
|
|
137
135
|
return hrefNoHash.includes("?") ? hrefNoHash.split("?")[0] : hrefNoHash;
|
|
138
136
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Href.js","names":["_constants","require","_Parameter","_interopRequireDefault","_exceptions","Href","constructor","href","resourcetype","_defineProperty2","default","HTTP_METHODS","GET","setFromHref","setFromString","setFromLocationOrObject","path","parameters","hash","state","pathname","_path","search","addParametersFromString","Array","isArray","_parameters","_context","_map","call","param","addParameter","_name","_value","_prefix","getHashFromString","_hash","_state","getPathFromString","isChangePassword","_context2","_includes","isCamelRoute","_startsWith","checkAbsoluteUrl","checkAbsolute","RegExp","test","isExternal","decodedHref","decodeURI","hrefNoHash","substr","indexOf","split","arguments","length","undefined","forEach","paramFromString","Parameter","fromString","setParameter","name","value","prefix","removeParameter","push","getParameter","_context3","_find","hasParameter","method","_method","_context4","valueToRemove","newValue","filter","val","join","_context5","_filter","getQuerystring","_context6","_context7","withPrefix","toQuerystring","getQuerystringForModularUI","_context8","_context9","isModUIParameter","querystring","setState","_resourcetype","absolutepath","getBasePath","absolutehref","absolutehrefPrefixedQuerystring","startsWith","thisPath","otherPath","equals","equalsWithParameters","_context10","thisParams","toString","every","IllegalArgumentException","isContent","_context11","CONTENT_PATH","getReferenceHash","_referenceHash","setReferenceHash","referenceHash","toLocation","_default","exports"],"sources":["../../../src/models/href/Href.js"],"sourcesContent":["// @flow\nimport { getBasePath, HTTP_METHODS, CONTENT_PATH } from \"../../constants\";\n\nimport Parameter from \"../parameter/Parameter\";\nimport { IllegalArgumentException } from \"../../exceptions\";\n\nimport type { LocationShape } from \"react-router\";\n\ntype HrefObject = {\n _path: string,\n _hash: string,\n _parameters: Array<Parameter>,\n _resourcetype: string,\n _method: $Keys<typeof HTTP_METHODS>,\n _state: ?{ [key: string]: any },\n pathname: ?string,\n};\n\nexport type HrefInput = Href | HrefObject | LocationShape | string;\n\n/**\n * Defines a Href with the parameters\n */\nclass Href {\n _path: string = \"\";\n _hash: string = \"\";\n _parameters: Array<Parameter> = [];\n _resourcetype: string = \"\";\n _method: $Keys<typeof HTTP_METHODS> = HTTP_METHODS.GET;\n _state: any = null;\n _referenceHash: ?number;\n\n /**\n * Create a Href\n */\n constructor(href?: HrefInput, resourcetype?: string) {\n this.resourcetype = resourcetype ?? \"\";\n\n if (href instanceof Href) {\n this.setFromHref(href);\n } else if (typeof href === \"string\") {\n this.setFromString(href);\n } else if (typeof href === \"object\") {\n this.setFromLocationOrObject(href);\n }\n }\n\n /**\n * Set parameters from Href model input\n */\n setFromHref(href: Href) {\n this.path = href.path;\n this.parameters = href.parameters;\n this.hash = href.hash;\n this.state = href.state;\n }\n\n /**\n */\n setFromLocationOrObject(href: LocationShape | HrefObject) {\n if (typeof href[\"pathname\"] === \"string\") {\n this.path = href.pathname;\n } else if (typeof href._path === \"string\") {\n this.path = href._path;\n }\n\n if (href.search) {\n this.addParametersFromString(href.search);\n } else if (Array.isArray(href._parameters)) {\n // $FlowExpectedError[incompatible-call]\n href._parameters.map((param: Parameter) =>\n this.addParameter(param._name, param._value, param._prefix),\n );\n }\n\n if (href.hash) {\n this.hash = Href.getHashFromString(href.hash);\n } else if (typeof href._hash === \"string\") {\n this.hash = href._hash;\n }\n\n if (href.state) {\n this.state = href.state || null;\n } else if (typeof href._state === \"object\") {\n this.state = href._state;\n }\n }\n\n /**\n * Set parameters from string input\n */\n setFromString(href: string) {\n this.path = Href.getPathFromString(href);\n this.addParametersFromString(href);\n this.hash = Href.getHashFromString(href);\n }\n\n /**\n */\n get isChangePassword(): boolean {\n return this._path.includes(\"/change-password\");\n }\n\n /**\n * check if the path is referencing a camel route\n */\n static isCamelRoute(path: string): boolean {\n return (\n path.startsWith(\"/restServices\") && !path.startsWith(\"/restServices/ui\")\n );\n }\n\n /**\n */\n static checkAbsoluteUrl(href: string): boolean {\n const checkAbsolute = new RegExp(\"^(?:[a-z]+:)?//\", \"i\");\n return checkAbsolute.test(href);\n }\n\n // Check if url is relative (not checking for absolute urls with same domain)\n /**\n */\n get isExternal(): boolean {\n return Href.checkAbsoluteUrl(this.path);\n }\n\n /**\n * Retrieve the relative path part of a href string, e.g. https://www.beinformed.com/BeInformed/tab/view?q=url => /tab/view\n */\n static getPathFromString(href: string): string {\n const decodedHref = decodeURI(href);\n\n const hrefNoHash = decodedHref.includes(\"#\")\n ? decodedHref.substr(0, decodedHref.indexOf(\"#\"))\n : decodedHref;\n\n return hrefNoHash.includes(\"?\") ? hrefNoHash.split(\"?\")[0] : hrefNoHash;\n }\n\n /**\n * Retrieve hash of href string\n */\n static getHashFromString(href: string = \"\"): string {\n return href.includes(\"#\") ? href.substr(href.indexOf(\"#\") + 1) : \"\";\n }\n\n /**\n * Add a parameter for each parameter found in the querystring of an URL string, e.g. https://www.beinformed.com?q=url => q=url\n */\n addParametersFromString(href: string): Href {\n if (href.includes(\"?\")) {\n href\n .split(\"?\")[1]\n .split(\"&\")\n .forEach((param) => {\n const paramFromString = Parameter.fromString(param);\n if (paramFromString) {\n this.setParameter(\n paramFromString.name,\n paramFromString.value,\n paramFromString.prefix,\n );\n }\n });\n }\n\n return this;\n }\n\n /**\n * Add a querystring parameter to the parameter collection of this Href, skips parameters that have a value of null\n */\n addParameter(name: string, value: ?string, prefix: ?string): Href {\n if (value !== null) {\n this.removeParameter(name, prefix);\n this._parameters.push(new Parameter(prefix, name, value));\n }\n\n return this;\n }\n\n /**\n * Adds or overwrites a parameter when it exists and value is not null.\n * Removes the parameter when the value is null\n */\n setParameter(name: string, value: ?string, prefix: ?string): Href {\n if (value === null) {\n this.removeParameter(name, prefix);\n } else {\n this.addParameter(name, value, prefix);\n }\n\n return this;\n }\n\n /**\n * Retrieve a parameter by it's name and (optionally) prefix\n */\n getParameter(name: string, prefix: ?string): ?Parameter {\n return this._parameters.find(\n (param) => param.prefix === prefix && param.name === name,\n );\n }\n\n /**\n */\n hasParameter(name: string, prefix: ?string): boolean {\n return this.getParameter(name, prefix) !== undefined;\n }\n\n /**\n * Get request method\n */\n get method(): $Keys<typeof HTTP_METHODS> {\n return this._method;\n }\n\n /**\n * Set request method\n */\n set method(method: $Keys<typeof HTTP_METHODS>) {\n this._method = method || HTTP_METHODS.GET;\n }\n\n /**\n * Retrieve all paremters\n */\n get parameters(): Array<Parameter> {\n return this._parameters;\n }\n\n /**\n * Replace parameters of Href\n */\n set parameters(parameters: Array<Parameter>) {\n this._parameters = parameters;\n }\n\n /**\n * Remove a parameter from the parameter collection\n */\n removeParameter(name: string, prefix: ?string, value: ?string): Href {\n if (value !== undefined) {\n const valueToRemove = value;\n\n this._parameters = this._parameters.map((param) => {\n if (param.prefix === prefix && param.name === name) {\n const newValue = param.value\n ?.split(\",\")\n .filter((val) => val !== valueToRemove)\n .join(\",\");\n return new Parameter(param.prefix, param.name, newValue);\n }\n return param;\n });\n } else {\n this._parameters = this._parameters.filter(\n (param) => param.prefix !== prefix || param.name !== name,\n );\n }\n\n return this;\n }\n\n /**\n * Get the parameters as a querystring, e.g. param1=value1¶m2=value2, optionally with prefix\n */\n getQuerystring(withPrefix: boolean = false): string {\n return this.parameters\n .filter((param) => param.value != null && param.value !== \"\")\n .map((param) => param.toQuerystring(withPrefix))\n .join(\"&\");\n }\n\n /**\n * Retrieve a querystring that only contains parameter that can be send to the modular ui, parameters are filtered by prefix\n */\n getQuerystringForModularUI(prefix: string = \"\"): string {\n return this.parameters\n .filter(\n (param) =>\n param.isModUIParameter &&\n (!prefix || !param.prefix || param.prefix === prefix) &&\n param.value != null,\n )\n .map((param) => param.toQuerystring(false))\n .join(\"&\");\n }\n\n /**\n * Retrieve all parameters from the parameter collection in a querystring style name1=value1&name2=value2, without the prefix\n */\n get querystring(): string {\n return this.getQuerystring(false);\n }\n\n /**\n * Set the path of the Href, the part before the querystring question mark\n */\n set path(path: string) {\n this._path = path;\n }\n\n /**\n * Retrieve the path\n */\n get path(): string {\n return this._path || \"\";\n }\n\n /**\n * Set hash\n */\n set hash(hash: string) {\n this._hash = hash;\n }\n\n /**\n * Retrieve hash\n */\n get hash(): string {\n return this._hash;\n }\n\n /**\n */\n set state(state: any) {\n this._state = state;\n }\n\n /**\n */\n get state(): any {\n return this._state;\n }\n\n /**\n */\n setState(state: any): Href {\n this.state = state;\n\n return this;\n }\n\n /**\n * Set resourctype\n */\n set resourcetype(resourcetype: string) {\n this._resourcetype = resourcetype;\n }\n\n /**\n * Retrieve resourceType\n */\n get resourcetype(): string {\n return this._resourcetype;\n }\n\n /**\n * Retrieve the path combined with the base path (context-path) of the application, e.g. /BeInformed\n */\n get absolutepath(): string {\n if (this.isExternal) {\n return this.path;\n }\n\n return getBasePath() + this.path;\n }\n\n /**\n * Retrieves the combination of the path and the querystring\n */\n get href(): string {\n return this.querystring.length > 0\n ? [this.path, this.querystring].join(\"?\")\n : this.path;\n }\n\n /**\n * Getting the URL including the base path, querystring is prefixed\n */\n get absolutehref(): string {\n const querystring = this.getQuerystring(false);\n\n return querystring.length > 0\n ? [this.absolutepath, querystring].join(\"?\")\n : this.absolutepath;\n }\n\n /**\n * Getting the URL including the base path, the querystring is prefixed\n */\n get absolutehrefPrefixedQuerystring(): string {\n const querystring = this.getQuerystring(true);\n\n return querystring.length > 0\n ? [this.absolutepath, querystring].join(\"?\")\n : this.absolutepath;\n }\n\n /**\n * Checks if the URL starts within the given href\n */\n startsWith(href: Href | string): boolean {\n const thisPath = `${this.path}/`;\n const otherPath = href instanceof Href ? `${href.path}/` : href;\n\n return thisPath.startsWith(otherPath);\n }\n\n /**\n * Checks if the given Href equals this Href\n */\n equals(href: Href | string): boolean {\n if (href instanceof Href) {\n return this.path === href.path;\n }\n\n return this.path === href;\n }\n\n /**\n */\n equalsWithParameters(href: Href): boolean {\n if (!this.equals(href)) {\n return false;\n }\n\n if (href instanceof Href) {\n if (this.parameters.length !== href.parameters.length) {\n return false;\n }\n\n if (this.parameters.length === 0 && href.parameters.length === 0) {\n return true;\n }\n\n const thisParams = this.parameters.map((param) => param.toString());\n\n return href.parameters.every((param) =>\n thisParams.includes(param.toString()),\n );\n }\n\n throw new IllegalArgumentException(`${href} is not an instance of Href`);\n }\n\n /**\n * Indicates if the link is a content link\n */\n get isContent(): boolean {\n return this.absolutepath.startsWith(`${getBasePath()}${CONTENT_PATH}`);\n }\n\n /**\n */\n getReferenceHash(): ?number {\n return this._referenceHash;\n }\n\n /**\n */\n setReferenceHash(referenceHash: number) {\n this._referenceHash = referenceHash;\n }\n\n /**\n * Returns a complete url from the Href\n */\n toString(): string {\n return this.href;\n }\n\n /**\n */\n toLocation(): LocationShape {\n return {\n pathname: this.path,\n search: this.querystring.length > 0 ? `?${this.querystring}` : \"\",\n hash: this.hash.length > 0 ? `#${this.hash}` : \"\",\n state: this.state,\n };\n }\n}\n\nexport default Href;\n"],"mappings":";;;;;;;;;;;;;AACA,IAAAA,UAAA,GAAAC,OAAA;AAEA,IAAAC,UAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,WAAA,GAAAH,OAAA;AAgBA;AACA;AACA;AACA,MAAMI,IAAI,CAAC;EAST;AACF;AACA;EACEC,WAAWA,CAACC,IAAgB,EAAEC,YAAqB,EAAE;IAAA,IAAAC,gBAAA,CAAAC,OAAA,iBAXrC,EAAE;IAAA,IAAAD,gBAAA,CAAAC,OAAA,iBACF,EAAE;IAAA,IAAAD,gBAAA,CAAAC,OAAA,uBACc,EAAE;IAAA,IAAAD,gBAAA,CAAAC,OAAA,yBACV,EAAE;IAAA,IAAAD,gBAAA,CAAAC,OAAA,mBACYC,uBAAY,CAACC,GAAG;IAAA,IAAAH,gBAAA,CAAAC,OAAA,kBACxC,IAAI;IAAA,IAAAD,gBAAA,CAAAC,OAAA;IAOhB,IAAI,CAACF,YAAY,GAAGA,YAAY,IAAI,EAAE;IAEtC,IAAID,IAAI,YAAYF,IAAI,EAAE;MACxB,IAAI,CAACQ,WAAW,CAACN,IAAI,CAAC;IACxB,CAAC,MAAM,IAAI,OAAOA,IAAI,KAAK,QAAQ,EAAE;MACnC,IAAI,CAACO,aAAa,CAACP,IAAI,CAAC;IAC1B,CAAC,MAAM,IAAI,OAAOA,IAAI,KAAK,QAAQ,EAAE;MACnC,IAAI,CAACQ,uBAAuB,CAACR,IAAI,CAAC;IACpC;EACF;;EAEA;AACF;AACA;EACEM,WAAWA,CAACN,IAAU,EAAE;IACtB,IAAI,CAACS,IAAI,GAAGT,IAAI,CAACS,IAAI;IACrB,IAAI,CAACC,UAAU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AqB,EAAE;IACtC,IAAI,CAACF,cAAc,GAAGE,aAAa;EACrC;;EAEA;AACF;AACA;EACET,QAAQA,CAAA,EAAW;IACjB,OAAO,IAAI,CAAClG,IAAI;EAClB;;EAEA;AACF;EACE4G,UAAUA,CAAA,EAAkB;IAC1B,OAAO;MACL/F,QAAQ,EAAE,IAAI,CAACJ,IAAI;MACnBM,MAAM,EAAE,IAAI,CAACqE,WAAW,CAACnC,MAAM,GAAG,CAAC,GAAI,IAAG,IAAI,CAACmC,WAAY,EAAC,GAAG,EAAE;MACjEzE,IAAI,EAAE,IAAI,CAACA,IAAI,CAACsC,MAAM,GAAG,CAAC,GAAI,IAAG,IAAI,CAACtC,IAAK,EAAC,GAAG,EAAE;MACjDC,KAAK,EAAE,IAAI,CAACA;IACd,CAAC;EACH;AACF;AAAC,IAAAiG,QAAA,GAAAC,OAAA,CAAA3G,OAAA,GAEcL,IAAI"}
|
|
1
|
+
{"version":3,"file":"Href.js","names":["_constants","require","_Parameter","_interopRequireDefault","_exceptions","Href","constructor","href","resourcetype","_defineProperty2","default","HTTP_METHODS","GET","setFromHref","setFromString","setFromLocationOrObject","path","parameters","hash","state","pathname","_path","search","addParametersFromString","Array","isArray","_parameters","_context","_map","call","param","addParameter","_name","_value","_prefix","getHashFromString","_hash","_state","getPathFromString","isChangePassword","_context2","_includes","isCamelRoute","_startsWith","checkAbsoluteUrl","checkAbsolute","RegExp","test","isExternal","hrefNoHash","substring","indexOf","split","arguments","length","undefined","substr","forEach","paramFromString","Parameter","fromString","setParameter","name","value","prefix","removeParameter","push","getParameter","_context3","_find","hasParameter","method","_method","_context4","valueToRemove","newValue","filter","val","join","_context5","_filter","getQuerystring","_context6","_context7","withPrefix","toQuerystring","getQuerystringForModularUI","_context8","_context9","isModUIParameter","querystring","setState","_resourcetype","absolutepath","getBasePath","absolutehref","absolutehrefPrefixedQuerystring","startsWith","thisPath","otherPath","equals","equalsWithParameters","_context10","thisParams","toString","every","IllegalArgumentException","isContent","_context11","CONTENT_PATH","getReferenceHash","_referenceHash","setReferenceHash","referenceHash","toLocation","_default","exports"],"sources":["../../../src/models/href/Href.js"],"sourcesContent":["// @flow\nimport { getBasePath, HTTP_METHODS, CONTENT_PATH } from \"../../constants\";\n\nimport Parameter from \"../parameter/Parameter\";\nimport { IllegalArgumentException } from \"../../exceptions\";\n\nimport type { LocationShape } from \"react-router\";\n\ntype HrefObject = {\n _path: string,\n _hash: string,\n _parameters: Array<Parameter>,\n _resourcetype: string,\n _method: $Keys<typeof HTTP_METHODS>,\n _state: ?{ [key: string]: any },\n pathname: ?string,\n};\n\nexport type HrefInput = Href | HrefObject | LocationShape | string;\n\n/**\n * Defines a Href with the parameters\n */\nclass Href {\n _path: string = \"\";\n _hash: string = \"\";\n _parameters: Array<Parameter> = [];\n _resourcetype: string = \"\";\n _method: $Keys<typeof HTTP_METHODS> = HTTP_METHODS.GET;\n _state: any = null;\n _referenceHash: ?number;\n\n /**\n * Create a Href\n */\n constructor(href?: HrefInput, resourcetype?: string) {\n this.resourcetype = resourcetype ?? \"\";\n\n if (href instanceof Href) {\n this.setFromHref(href);\n } else if (typeof href === \"string\") {\n this.setFromString(href);\n } else if (typeof href === \"object\") {\n this.setFromLocationOrObject(href);\n }\n }\n\n /**\n * Set parameters from Href model input\n */\n setFromHref(href: Href) {\n this.path = href.path;\n this.parameters = href.parameters;\n this.hash = href.hash;\n this.state = href.state;\n }\n\n /**\n */\n setFromLocationOrObject(href: LocationShape | HrefObject) {\n if (typeof href[\"pathname\"] === \"string\") {\n this.path = href.pathname;\n } else if (typeof href._path === \"string\") {\n this.path = href._path;\n }\n\n if (href.search) {\n this.addParametersFromString(href.search);\n } else if (Array.isArray(href._parameters)) {\n // $FlowExpectedError[incompatible-call]\n href._parameters.map((param: Parameter) =>\n this.addParameter(param._name, param._value, param._prefix),\n );\n }\n\n if (href.hash) {\n this.hash = Href.getHashFromString(href.hash);\n } else if (typeof href._hash === \"string\") {\n this.hash = href._hash;\n }\n\n if (href.state) {\n this.state = href.state || null;\n } else if (typeof href._state === \"object\") {\n this.state = href._state;\n }\n }\n\n /**\n * Set parameters from string input\n */\n setFromString(href: string) {\n this.path = Href.getPathFromString(href);\n this.addParametersFromString(href);\n this.hash = Href.getHashFromString(href);\n }\n\n /**\n */\n get isChangePassword(): boolean {\n return this._path.includes(\"/change-password\");\n }\n\n /**\n * check if the path is referencing a camel route\n */\n static isCamelRoute(path: string): boolean {\n return (\n path.startsWith(\"/restServices\") && !path.startsWith(\"/restServices/ui\")\n );\n }\n\n /**\n */\n static checkAbsoluteUrl(href: string): boolean {\n const checkAbsolute = new RegExp(\"^(?:[a-z]+:)?//\", \"i\");\n return checkAbsolute.test(href);\n }\n\n // Check if url is relative (not checking for absolute urls with same domain)\n /**\n */\n get isExternal(): boolean {\n return Href.checkAbsoluteUrl(this.path);\n }\n\n /**\n * Retrieve the relative path part of a href string, e.g. https://www.beinformed.com/BeInformed/tab/view?q=url => /tab/view\n */\n static getPathFromString(href: string): string {\n const hrefNoHash = href.includes(\"#\")\n ? href.substring(0, href.indexOf(\"#\"))\n : href;\n\n return hrefNoHash.includes(\"?\") ? hrefNoHash.split(\"?\")[0] : hrefNoHash;\n }\n\n /**\n * Retrieve hash of href string\n */\n static getHashFromString(href: string = \"\"): string {\n return href.includes(\"#\") ? href.substr(href.indexOf(\"#\") + 1) : \"\";\n }\n\n /**\n * Add a parameter for each parameter found in the querystring of an URL string, e.g. https://www.beinformed.com?q=url => q=url\n */\n addParametersFromString(href: string): Href {\n if (href.includes(\"?\")) {\n href\n .split(\"?\")[1]\n .split(\"&\")\n .forEach((param) => {\n const paramFromString = Parameter.fromString(param);\n if (paramFromString) {\n this.setParameter(\n paramFromString.name,\n paramFromString.value,\n paramFromString.prefix,\n );\n }\n });\n }\n\n return this;\n }\n\n /**\n * Add a querystring parameter to the parameter collection of this Href, skips parameters that have a value of null\n */\n addParameter(name: string, value: ?string, prefix: ?string): Href {\n if (value !== null) {\n this.removeParameter(name, prefix);\n this._parameters.push(new Parameter(prefix, name, value));\n }\n\n return this;\n }\n\n /**\n * Adds or overwrites a parameter when it exists and value is not null.\n * Removes the parameter when the value is null\n */\n setParameter(name: string, value: ?string, prefix: ?string): Href {\n if (value === null) {\n this.removeParameter(name, prefix);\n } else {\n this.addParameter(name, value, prefix);\n }\n\n return this;\n }\n\n /**\n * Retrieve a parameter by it's name and (optionally) prefix\n */\n getParameter(name: string, prefix: ?string): ?Parameter {\n return this._parameters.find(\n (param) => param.prefix === prefix && param.name === name,\n );\n }\n\n /**\n */\n hasParameter(name: string, prefix: ?string): boolean {\n return this.getParameter(name, prefix) !== undefined;\n }\n\n /**\n * Get request method\n */\n get method(): $Keys<typeof HTTP_METHODS> {\n return this._method;\n }\n\n /**\n * Set request method\n */\n set method(method: $Keys<typeof HTTP_METHODS>) {\n this._method = method || HTTP_METHODS.GET;\n }\n\n /**\n * Retrieve all paremters\n */\n get parameters(): Array<Parameter> {\n return this._parameters;\n }\n\n /**\n * Replace parameters of Href\n */\n set parameters(parameters: Array<Parameter>) {\n this._parameters = parameters;\n }\n\n /**\n * Remove a parameter from the parameter collection\n */\n removeParameter(name: string, prefix: ?string, value: ?string): Href {\n if (value !== undefined) {\n const valueToRemove = value;\n\n this._parameters = this._parameters.map((param) => {\n if (param.prefix === prefix && param.name === name) {\n const newValue = param.value\n ?.split(\",\")\n .filter((val) => val !== valueToRemove)\n .join(\",\");\n return new Parameter(param.prefix, param.name, newValue);\n }\n return param;\n });\n } else {\n this._parameters = this._parameters.filter(\n (param) => param.prefix !== prefix || param.name !== name,\n );\n }\n\n return this;\n }\n\n /**\n * Get the parameters as a querystring, e.g. param1=value1¶m2=value2, optionally with prefix\n */\n getQuerystring(withPrefix: boolean = false): string {\n return this.parameters\n .filter((param) => param.value != null && param.value !== \"\")\n .map((param) => param.toQuerystring(withPrefix))\n .join(\"&\");\n }\n\n /**\n * Retrieve a querystring that only contains parameter that can be send to the modular ui, parameters are filtered by prefix\n */\n getQuerystringForModularUI(prefix: string = \"\"): string {\n return this.parameters\n .filter(\n (param) =>\n param.isModUIParameter &&\n (!prefix || !param.prefix || param.prefix === prefix) &&\n param.value != null,\n )\n .map((param) => param.toQuerystring(false))\n .join(\"&\");\n }\n\n /**\n * Retrieve all parameters from the parameter collection in a querystring style name1=value1&name2=value2, without the prefix\n */\n get querystring(): string {\n return this.getQuerystring(false);\n }\n\n /**\n * Set the path of the Href, the part before the querystring question mark\n */\n set path(path: string) {\n this._path = path;\n }\n\n /**\n * Retrieve the path\n */\n get path(): string {\n return this._path || \"\";\n }\n\n /**\n * Set hash\n */\n set hash(hash: string) {\n this._hash = hash;\n }\n\n /**\n * Retrieve hash\n */\n get hash(): string {\n return this._hash;\n }\n\n /**\n */\n set state(state: any) {\n this._state = state;\n }\n\n /**\n */\n get state(): any {\n return this._state;\n }\n\n /**\n */\n setState(state: any): Href {\n this.state = state;\n\n return this;\n }\n\n /**\n * Set resourctype\n */\n set resourcetype(resourcetype: string) {\n this._resourcetype = resourcetype;\n }\n\n /**\n * Retrieve resourceType\n */\n get resourcetype(): string {\n return this._resourcetype;\n }\n\n /**\n * Retrieve the path combined with the base path (context-path) of the application, e.g. /BeInformed\n */\n get absolutepath(): string {\n if (this.isExternal) {\n return this.path;\n }\n\n return getBasePath() + this.path;\n }\n\n /**\n * Retrieves the combination of the path and the querystring\n */\n get href(): string {\n return this.querystring.length > 0\n ? [this.path, this.querystring].join(\"?\")\n : this.path;\n }\n\n /**\n * Getting the URL including the base path, querystring is prefixed\n */\n get absolutehref(): string {\n const querystring = this.getQuerystring(false);\n\n return querystring.length > 0\n ? [this.absolutepath, querystring].join(\"?\")\n : this.absolutepath;\n }\n\n /**\n * Getting the URL including the base path, the querystring is prefixed\n */\n get absolutehrefPrefixedQuerystring(): string {\n const querystring = this.getQuerystring(true);\n\n return querystring.length > 0\n ? [this.absolutepath, querystring].join(\"?\")\n : this.absolutepath;\n }\n\n /**\n * Checks if the URL starts within the given href\n */\n startsWith(href: Href | string): boolean {\n const thisPath = `${this.path}/`;\n const otherPath = href instanceof Href ? `${href.path}/` : href;\n\n return thisPath.startsWith(otherPath);\n }\n\n /**\n * Checks if the given Href equals this Href\n */\n equals(href: Href | string): boolean {\n if (href instanceof Href) {\n return this.path === href.path;\n }\n\n return this.path === href;\n }\n\n /**\n */\n equalsWithParameters(href: Href): boolean {\n if (!this.equals(href)) {\n return false;\n }\n\n if (href instanceof Href) {\n if (this.parameters.length !== href.parameters.length) {\n return false;\n }\n\n if (this.parameters.length === 0 && href.parameters.length === 0) {\n return true;\n }\n\n const thisParams = this.parameters.map((param) => param.toString());\n\n return href.parameters.every((param) =>\n thisParams.includes(param.toString()),\n );\n }\n\n throw new IllegalArgumentException(`${href} is not an instance of Href`);\n }\n\n /**\n * Indicates if the link is a content link\n */\n get isContent(): boolean {\n return this.absolutepath.startsWith(`${getBasePath()}${CONTENT_PATH}`);\n }\n\n /**\n */\n getReferenceHash(): ?number {\n return this._referenceHash;\n }\n\n /**\n */\n setReferenceHash(referenceHash: number) {\n this._referenceHash = referenceHash;\n }\n\n /**\n * Returns a complete url from the Href\n */\n toString(): string {\n return this.href;\n }\n\n /**\n */\n toLocation(): LocationShape {\n return {\n pathname: this.path,\n search: this.querystring.length > 0 ? `?${this.querystring}` : \"\",\n hash: this.hash.length > 0 ? `#${this.hash}` : \"\",\n state: this.state,\n };\n }\n}\n\nexport default Href;\n"],"mappings":";;;;;;;;;;;;;AACA,IAAAA,UAAA,GAAAC,OAAA;AAEA,IAAAC,UAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,WAAA,GAAAH,OAAA;AAgBA;AACA;AACA;AACA,MAAMI,IAAI,CAAC;EAST;AACF;AACA;EACEC,WAAWA,CAACC,IAAgB,EAAEC,YAAqB,EAAE;IAAA,IAAAC,gBAAA,CAAAC,OAAA,iBAXrC,EAAE;IAAA,IAAAD,gBAAA,CAAAC,OAAA,iBACF,EAAE;IAAA,IAAAD,gBAAA,CAAAC,OAAA,uBACc,EAAE;IAAA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|
|
|
67
67
|
const href2 = new Href(
|
|
68
|
-
"/concepts
|
|
68
|
+
"/concepts/%2FContent%2FKnowledge%20models%2FAll%20source%20types.bixml/AllKindOfSources",
|
|
69
69
|
);
|
|
70
70
|
|
|
71
71
|
expect(href2.path).toBe(
|
|
72
|
-
"/concepts
|
|
72
|
+
"/concepts/%2FContent%2FKnowledge%20models%2FAll%20source%20types.bixml/AllKindOfSources",
|
|
73
73
|
);
|
|
74
74
|
});
|
|
75
75
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@beinformed/ui",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.42.1",
|
|
4
4
|
"description": "Toolbox for be informed javascript layouts",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE.md",
|
|
6
6
|
"bugs": "http://support.beinformed.com",
|
|
@@ -82,14 +82,14 @@
|
|
|
82
82
|
"styled-components": "^5.0.0"
|
|
83
83
|
},
|
|
84
84
|
"dependencies": {
|
|
85
|
-
"@babel/runtime-corejs3": "^7.
|
|
85
|
+
"@babel/runtime-corejs3": "^7.24.0",
|
|
86
86
|
"big.js": "^6.2.1",
|
|
87
87
|
"date-fns": "^3.3.1",
|
|
88
88
|
"deepmerge": "^4.3.1",
|
|
89
89
|
"dequal": "^2.0.3",
|
|
90
90
|
"file-size": "^1.0.0",
|
|
91
91
|
"format-message": "^6.2.4",
|
|
92
|
-
"html-entities": "^2.
|
|
92
|
+
"html-entities": "^2.5.2",
|
|
93
93
|
"iban": "^0.0.14",
|
|
94
94
|
"js-cookie": "^3.0.5",
|
|
95
95
|
"klona": "^2.0.6",
|
|
@@ -99,14 +99,14 @@
|
|
|
99
99
|
},
|
|
100
100
|
"devDependencies": {
|
|
101
101
|
"@babel/cli": "^7.23.4",
|
|
102
|
-
"@babel/core": "^7.
|
|
102
|
+
"@babel/core": "^7.24.0",
|
|
103
103
|
"@babel/eslint-parser": "^7.23.3",
|
|
104
104
|
"@babel/eslint-plugin": "^7.23.5",
|
|
105
105
|
"@babel/plugin-proposal-class-properties": "^7.18.6",
|
|
106
106
|
"@babel/plugin-syntax-dynamic-import": "^7.8.3",
|
|
107
|
-
"@babel/plugin-transform-runtime": "^7.
|
|
108
|
-
"@babel/preset-env": "^7.
|
|
109
|
-
"@babel/preset-flow": "^7.
|
|
107
|
+
"@babel/plugin-transform-runtime": "^7.24.0",
|
|
108
|
+
"@babel/preset-env": "^7.24.0",
|
|
109
|
+
"@babel/preset-flow": "^7.24.0",
|
|
110
110
|
"@babel/preset-react": "^7.23.3",
|
|
111
111
|
"@commitlint/cli": "^18.5.0",
|
|
112
112
|
"@commitlint/config-conventional": "^18.5.0",
|
|
@@ -118,14 +118,14 @@
|
|
|
118
118
|
"commit-and-tag-version": "^12.2.0",
|
|
119
119
|
"cross-env": "^7.0.3",
|
|
120
120
|
"documentation": "^14.0.2",
|
|
121
|
-
"eslint": "^8.
|
|
121
|
+
"eslint": "^8.57.0",
|
|
122
122
|
"eslint-config-prettier": "^9.1.0",
|
|
123
123
|
"eslint-plugin-babel": "^5.3.1",
|
|
124
|
-
"eslint-plugin-ft-flow": "^3.0.
|
|
124
|
+
"eslint-plugin-ft-flow": "^3.0.7",
|
|
125
125
|
"eslint-plugin-import": "^2.29.1",
|
|
126
|
-
"eslint-plugin-jest": "^27.
|
|
126
|
+
"eslint-plugin-jest": "^27.9.0",
|
|
127
127
|
"eslint-plugin-jsdoc": "^46.9.0",
|
|
128
|
-
"eslint-plugin-react": "^7.
|
|
128
|
+
"eslint-plugin-react": "^7.34.0",
|
|
129
129
|
"eslint-plugin-react-hooks": "^4.5.0",
|
|
130
130
|
"eslint-plugin-you-dont-need-lodash-underscore": "^6.13.0",
|
|
131
131
|
"flow-bin": "^0.200.1",
|
|
@@ -45,7 +45,7 @@ describe("actionModel", () => {
|
|
|
45
45
|
processTask: {
|
|
46
46
|
_links: {
|
|
47
47
|
concept: {
|
|
48
|
-
href: "/concepts
|
|
48
|
+
href: "/concepts/%2FResearch%20grant%2FBusiness%20design%2FConstraints%2FEligible%20for%20research%20grant.bixml/EligibleResearchGrant",
|
|
49
49
|
},
|
|
50
50
|
},
|
|
51
51
|
consequenceType: "Decision",
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
"multiplechoice": true,
|
|
41
41
|
"_links": {
|
|
42
42
|
"concept": {
|
|
43
|
-
"href": "/concepts
|
|
43
|
+
"href": "/concepts/%2FIncident%2FBusiness%20design%2FUrgenties%2FLevensbedreigende%20situaties.bixml/LevensbedreigendeSituaties"
|
|
44
44
|
}
|
|
45
45
|
},
|
|
46
46
|
"layouthint": ["checkbox"],
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
"decimalSeparator": ",",
|
|
9
9
|
"_links": {
|
|
10
10
|
"concept": {
|
|
11
|
-
"href": "/concepts
|
|
11
|
+
"href": "/concepts/%2FIncident%2FBusiness%20design%2FProcess%20elementen%2FBoete%20berekenen.bixml/TotaleBoeteBedrag"
|
|
12
12
|
}
|
|
13
13
|
},
|
|
14
14
|
"format": "#.##",
|
|
@@ -200,7 +200,7 @@ describe("AttributeContent", () => {
|
|
|
200
200
|
"/content/_Context/Police incident decisions/Content/Breath analysis/Breathalyzer test.formalsource/Alert",
|
|
201
201
|
);
|
|
202
202
|
expect(firstSection.selfContentLink.encodedHref.toString()).toBe(
|
|
203
|
-
"/content/_Context%2FPolice
|
|
203
|
+
"/content/_Context%2FPolice%20incident%20decisions%2FContent%2FBreath%20analysis%2FBreathalyzer%20test.formalsource/Alert",
|
|
204
204
|
);
|
|
205
205
|
|
|
206
206
|
expect(firstSection.childSections).toHaveLength(2);
|
|
@@ -395,7 +395,7 @@ describe("attributeDataHelper", () => {
|
|
|
395
395
|
label: "Driving ban",
|
|
396
396
|
_links: {
|
|
397
397
|
concept: {
|
|
398
|
-
href: "/concepts
|
|
398
|
+
href: "/concepts/%2F_Context%2FPolice incident%20decisions%2FModels%2FSanctions%2FSanctions.bixml/DrivingBan",
|
|
399
399
|
},
|
|
400
400
|
},
|
|
401
401
|
content: {
|
|
@@ -177,7 +177,7 @@ describe("attributeModel", () => {
|
|
|
177
177
|
{
|
|
178
178
|
_links: {
|
|
179
179
|
concept: {
|
|
180
|
-
href: "/concepts
|
|
180
|
+
href: "/concepts/%2FIncident%2FBusiness%20design%2FProcess%20elementen%2FEerste%20contact.bixml/UitslagBlaastestType",
|
|
181
181
|
},
|
|
182
182
|
},
|
|
183
183
|
},
|
|
@@ -190,7 +190,7 @@ describe("attributeModel", () => {
|
|
|
190
190
|
setSetting(ALL_CONTENT_IN_DATA_SETTING, true);
|
|
191
191
|
|
|
192
192
|
expect(attribute.conceptLink.href.path).toBe(
|
|
193
|
-
"/concepts
|
|
193
|
+
"/concepts/%2FIncident%2FBusiness%20design%2FProcess%20elementen%2FEerste%20contact.bixml/UitslagBlaastestType",
|
|
194
194
|
);
|
|
195
195
|
|
|
196
196
|
expect(attribute.referenceDate).toBe("2010-09-10");
|
|
@@ -216,7 +216,7 @@ describe("attributeModel", () => {
|
|
|
216
216
|
{
|
|
217
217
|
_links: {
|
|
218
218
|
concept: {
|
|
219
|
-
href: "/concepts
|
|
219
|
+
href: "/concepts/%2FIncident%2FBusiness%20design%2FProcess%20elementen%2FEerste%20contact.bixml/UitslagBlaastestType",
|
|
220
220
|
},
|
|
221
221
|
},
|
|
222
222
|
},
|
|
@@ -226,7 +226,7 @@ describe("attributeModel", () => {
|
|
|
226
226
|
data: {
|
|
227
227
|
_links: {
|
|
228
228
|
self: {
|
|
229
|
-
href: "/concepts
|
|
229
|
+
href: "/concepts/%2FIncident%2FBusiness%20design%2FProcess%20elementen%2FEerste%20contact.bixml/UitslagBlaastestType",
|
|
230
230
|
},
|
|
231
231
|
},
|
|
232
232
|
filter: {
|
|
@@ -58,10 +58,11 @@ class BusinessScenarioModel extends ConceptDetailModel {
|
|
|
58
58
|
]),
|
|
59
59
|
};
|
|
60
60
|
|
|
61
|
+
const decodedConceptTypeHref = decodeURIComponent(conceptTypeHref);
|
|
61
62
|
return (
|
|
62
63
|
Array.isArray(conceptTypeSettings[settingName]) &&
|
|
63
64
|
conceptTypeSettings[settingName].some((conceptTypeSetting) =>
|
|
64
|
-
|
|
65
|
+
decodedConceptTypeHref.endsWith(conceptTypeSetting),
|
|
65
66
|
)
|
|
66
67
|
);
|
|
67
68
|
}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"_id": "ScenarioIncident",
|
|
4
4
|
"_links": {
|
|
5
5
|
"self": {
|
|
6
|
-
"href": "/concepts
|
|
6
|
+
"href": "/concepts/%2FIncident%2FBusiness+design%2FBusiness+scenario%2FScenario incident.bixml/ScenarioIncident"
|
|
7
7
|
},
|
|
8
8
|
"api_doc": {
|
|
9
9
|
"href": "/api-docs/v3/concepts/(knowledge-model-identifier)/(concept-identifier)"
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
"href": "/contributions/concepts/(knowledge-model-identifier)/(concept-identifier)"
|
|
13
13
|
},
|
|
14
14
|
"concepttype": {
|
|
15
|
-
"href": "/concepttypes
|
|
15
|
+
"href": "/concepttypes/%2FLibrary%2FKMTs%2FBusiness%20scenarios.bixml/BusinessScenario"
|
|
16
16
|
}
|
|
17
17
|
},
|
|
18
18
|
"filter": {
|
|
@@ -32,10 +32,10 @@
|
|
|
32
32
|
"concept": {
|
|
33
33
|
"_links": {
|
|
34
34
|
"self": {
|
|
35
|
-
"href": "/concepts
|
|
35
|
+
"href": "/concepts/%2FIncident%2FBusiness+design%2FBusiness+scenario%2FScenario+incident.bixml/StaandehoudingScSt"
|
|
36
36
|
},
|
|
37
37
|
"concepttype": {
|
|
38
|
-
"href": "/concepttypes
|
|
38
|
+
"href": "/concepttypes/%2FLibrary%2FKMTs%2FBusiness%20scenarios.bixml/ScenarioStep"
|
|
39
39
|
}
|
|
40
40
|
},
|
|
41
41
|
"conceptLabel": "Staandehouding",
|
|
@@ -58,7 +58,7 @@ describe("contentmodel", () => {
|
|
|
58
58
|
"/content/Incident/Business design/Content/Blaastest.bixml/67beed02?entryDate=2021-08-31",
|
|
59
59
|
);
|
|
60
60
|
expect(contentModel.selfContentLink.encodedHref.toString()).toBe(
|
|
61
|
-
"/content/Incident%2FBusiness
|
|
61
|
+
"/content/Incident%2FBusiness%20design%2FContent%2FBlaastest.bixml/67beed02?entryDate=2021-08-31",
|
|
62
62
|
);
|
|
63
63
|
expect(contentModel.childSections).toHaveLength(0);
|
|
64
64
|
expect(contentModel.subSections).toHaveLength(0);
|
|
@@ -97,7 +97,7 @@ describe("contentmodel", () => {
|
|
|
97
97
|
"/content/Incident/Business design/Content/Blaastest.textilesource/uitslag?entryDate=2021-08-31",
|
|
98
98
|
);
|
|
99
99
|
expect(contentModel.selfContentLink.encodedHref.toString()).toBe(
|
|
100
|
-
"/content/Incident%2FBusiness
|
|
100
|
+
"/content/Incident%2FBusiness%20design%2FContent%2FBlaastest.textilesource/uitslag?entryDate=2021-08-31",
|
|
101
101
|
);
|
|
102
102
|
expect(contentModel.childSections).toHaveLength(0);
|
|
103
103
|
expect(contentModel.subSections).toHaveLength(0);
|
|
@@ -114,7 +114,7 @@ describe("contentmodel", () => {
|
|
|
114
114
|
expect(firstChildSectionLink.label).toBe("Pass");
|
|
115
115
|
expect(firstChildSectionLink.sourceLabel).toBeNull();
|
|
116
116
|
expect(firstChildSectionLink.encodedHref.toString()).toBe(
|
|
117
|
-
"/content/Incident%2FBusiness
|
|
117
|
+
"/content/Incident%2FBusiness%20design%2FContent%2FBlaastest.textilesource/pass?entryDate=2021-08-31",
|
|
118
118
|
);
|
|
119
119
|
});
|
|
120
120
|
|
|
@@ -146,7 +146,7 @@ describe("contentmodel", () => {
|
|
|
146
146
|
"/content/Incident/Business design/Content/Blaastest subsections.formalsource/BlaastestOpties?entryDate=2021-08-31",
|
|
147
147
|
);
|
|
148
148
|
expect(contentModel.selfContentLink.encodedHref.toString()).toBe(
|
|
149
|
-
"/content/Incident%2FBusiness
|
|
149
|
+
"/content/Incident%2FBusiness%20design%2FContent%2FBlaastest%20subsections.formalsource/BlaastestOpties?entryDate=2021-08-31",
|
|
150
150
|
);
|
|
151
151
|
expect(contentModel.childSections).toHaveLength(0);
|
|
152
152
|
expect(contentModel.subSections).toHaveLength(4);
|
package/src/models/href/Href.js
CHANGED
|
@@ -128,11 +128,9 @@ class Href {
|
|
|
128
128
|
* Retrieve the relative path part of a href string, e.g. https://www.beinformed.com/BeInformed/tab/view?q=url => /tab/view
|
|
129
129
|
*/
|
|
130
130
|
static getPathFromString(href: string): string {
|
|
131
|
-
const
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
? decodedHref.substr(0, decodedHref.indexOf("#"))
|
|
135
|
-
: decodedHref;
|
|
131
|
+
const hrefNoHash = href.includes("#")
|
|
132
|
+
? href.substring(0, href.indexOf("#"))
|
|
133
|
+
: href;
|
|
136
134
|
|
|
137
135
|
return hrefNoHash.includes("?") ? hrefNoHash.split("?")[0] : hrefNoHash;
|
|
138
136
|
}
|
|
@@ -65,11 +65,11 @@ describe("href spec", () => {
|
|
|
65
65
|
);
|
|
66
66
|
|
|
67
67
|
const href2 = new Href(
|
|
68
|
-
"/concepts
|
|
68
|
+
"/concepts/%2FContent%2FKnowledge%20models%2FAll%20source%20types.bixml/AllKindOfSources",
|
|
69
69
|
);
|
|
70
70
|
|
|
71
71
|
expect(href2.path).toBe(
|
|
72
|
-
"/concepts
|
|
72
|
+
"/concepts/%2FContent%2FKnowledge%20models%2FAll%20source%20types.bixml/AllKindOfSources",
|
|
73
73
|
);
|
|
74
74
|
});
|
|
75
75
|
|