@beinformed/ui 2.0.0-beta.2 → 2.0.0-beta.3
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 +6 -0
- package/dist/{FormModel-Cmzm2g7k.d.ts → FormModel-D-1KaExN.d.ts} +1 -1
- package/dist/{FormModel-Qa655sE-.d.cts → FormModel-DZLGZU6B.d.cts} +1 -1
- package/dist/{chunk-CPYNQW3X.js → chunk-DUTPBVXD.js} +1 -1
- package/dist/{chunk-CPYNQW3X.js.map → chunk-DUTPBVXD.js.map} +1 -1
- package/dist/{chunk-RI2O4J7J.js → chunk-FKIQBPXP.js} +2 -2
- package/dist/chunk-FKIQBPXP.js.map +1 -0
- package/dist/{chunk-VLKSMXSB.js → chunk-J2QT7BB2.js} +2 -2
- package/dist/{chunk-GHQP5QNP.js → chunk-S3X2VJQL.js} +1 -1
- package/dist/{chunk-GHQP5QNP.js.map → chunk-S3X2VJQL.js.map} +1 -1
- package/dist/{chunk-GDEYM54A.js → chunk-SBDXU5FX.js} +2 -2
- package/dist/{chunk-Y3XZHSPE.js → chunk-TDCALIXY.js} +2 -2
- package/dist/exceptions/index.d.cts +2 -2
- package/dist/exceptions/index.d.ts +2 -2
- package/dist/{index-RuAoNZgc.d.cts → index-CvHISgQi.d.cts} +1 -1
- package/dist/{index-BxJE8Lob.d.ts → index-SO4eiir8.d.ts} +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +1 -1
- package/dist/layouthints/index.cjs.map +1 -1
- package/dist/layouthints/index.d.cts +1 -2
- package/dist/layouthints/index.d.ts +1 -2
- package/dist/layouthints/index.js +1 -1
- package/dist/models/index.cjs.map +1 -1
- package/dist/models/index.d.cts +4 -4
- package/dist/models/index.d.ts +4 -4
- package/dist/models/index.js +1 -1
- package/dist/modularui/index.cjs.map +1 -1
- package/dist/modularui/index.d.cts +3 -3
- package/dist/modularui/index.d.ts +3 -3
- package/dist/modularui/index.js +1 -1
- package/dist/types/index.d.cts +1 -1
- package/dist/types/index.d.ts +1 -1
- package/dist/utils/index.cjs.map +1 -1
- package/dist/utils/index.d.cts +3 -5
- package/dist/utils/index.d.ts +3 -5
- package/dist/utils/index.js +1 -1
- package/package.json +2 -2
- package/dist/chunk-RI2O4J7J.js.map +0 -1
- /package/dist/{chunk-VLKSMXSB.js.map → chunk-J2QT7BB2.js.map} +0 -0
- /package/dist/{chunk-GDEYM54A.js.map → chunk-SBDXU5FX.js.map} +0 -0
- /package/dist/{chunk-Y3XZHSPE.js.map → chunk-TDCALIXY.js.map} +0 -0
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as N}from"./chunk-Y3XZHSPE.js";import{b as m,c}from"./chunk-VLKSMXSB.js";import{f as D}from"./chunk-WHWNPOV6.js";import{Ea as z,Fa as V,Ga as G,Ia as W,Ka as Y,La as Q,Ua as K,Wa as X,Xa as C,Ya as Z,bb as _,db as u,e as I,eb as tt,j as v,k as J,o as q,pb as et,rb as ot,s as j,t as x,ub as it,vb as rt,wb as nt,x as B,xb as st,yb as at}from"./chunk-RI2O4J7J.js";import{l as $}from"./chunk-QTZ77JJN.js";import{a as F,b as p}from"./chunk-GHQP5QNP.js";import{a}from"./chunk-VGAPPKHA.js";import{A as U,B as w,h as f,o as T,p as S,q as O,r as k,s as L,v as h,x as l}from"./chunk-SFI46XCV.js";import{g as M}from"./chunk-NOB2I3DW.js";import{b as A,h as R,q as H}from"./chunk-4BYHEGUN.js";var lt=class{_isBasicAuthentication;_authenticationType;constructor(){this._isBasicAuthentication=!1,this._authenticationType=this.getAuthenticationType()}getAuthenticationType(){let t=T(),e=H[t];return!e||e==="JAAS"?"JAAS":e==="PAC4J_FORM"||t.includes("FormClient")?"PAC4J_FORM":e==="PAC4J_BASIC"||t.includes("IndirectBasicClient")?"PAC4J_BASIC":"PAC4J_INDIRECT"}get authenticationType(){return this._authenticationType}set authenticationType(t){this._authenticationType=t}get isBasicAuthentication(){return this._isBasicAuthentication||this.authenticationType==="PAC4J_BASIC"}set isBasicAuthentication(t){this._isBasicAuthentication=t}requestLogin(){return c({url:`${h()}/login`,method:"GET",headers:{Accept:"application/json","Content-Type":"application/x-www-form-urlencoded"}})}initLogin(t){return this.isBasicAuthentication||!t?Promise.resolve(!0):this.requestLogin().catch(e=>(e instanceof D&&(this.isBasicAuthentication=!0),Promise.resolve({})))}login(t,e){switch(this.authenticationType){case"PAC4J_FORM":return this.doFormLogin(t,e);case"PAC4J_BASIC":return this.doBasicAuthentication(t,e);case"PAC4J_INDIRECT":return Promise.resolve();default:return this.doJaasAuthentication(t,e)}}getFormLoginUrl(){switch(this.authenticationType){case"PAC4J_BASIC":return`${h()}${S("DirectBasicAuthClient")}`;case"PAC4J_FORM":return`${h()}${S("FormClient")}`;case"PAC4J_INDIRECT":return"";default:return`${h()}/j_security_check`}}getFormLoginData(t,e){let i=encodeURIComponent(t),r=encodeURIComponent(e);switch(this.authenticationType){case"PAC4J_BASIC":case"PAC4J_FORM":return`${O()}=${i}&${k()}=${r}`;case"JAAS":return`j_username=${i}&j_password=${r}`;default:return""}}doFormLogin(t,e){return c({url:this.getFormLoginUrl(),method:"POST",headers:{Accept:"application/json","Content-Type":"application/x-www-form-urlencoded"},data:this.getFormLoginData(t,e)})}doBasicAuthentication(t,e){return p.addItem("basic",btoa(`${t}:${e}`)),this.requestLogin()}doJaasAuthentication(t,e){return this.initLogin(!0).then(()=>this.isBasicAuthentication?(p.removeItem("basic-ok"),this.doBasicAuthentication(t,e).then(()=>{p.addItem("basic-ok",!0)})):this.doFormLogin(t,e))}getLogoutUrl(){let t=T();return!t||t==="JAAS"?`${h()}/Logoff`:`${h()}${L()}`}redirectToLogout(t){p.clear();let e=window.location.origin,i=t?.startsWith("http")?t:`${e}${h()}`;window.location.assign(this.getLogoutUrl()+"?url="+i)}logout(){return c({url:this.getLogoutUrl()}).then(t=>(p.clear(),t))}};var ht=class{_tokenId;_image;_origin="";_contextPath=l();CaptchaRequest(t){this._origin=t?.origin||"",this._contextPath=t?.contextPath||l()}captchaResponse(t){return this._tokenId="tokenId"in t?t.tokenId:this._tokenId,this._image="image"in t?t.image:this._image,{tokenId:this._tokenId,image:this._image,valid:"valid"in t?t.valid:!1,error:"error"in t?t.error:null}}init(){return m({url:w(this._contextPath,this._origin)}).then(t=>this.captchaResponse(t))}send(t){return m({url:w(this._contextPath,this._origin),method:"POST",data:{tokenId:this._tokenId??"",answer:t??""}}).then(e=>this.captchaResponse(e)).catch(e=>this.captchaResponse(e.response))}refresh(){return this.init()}};var g=class o extends Error{response;href;constructor(t,e,i){super(t),Object.setPrototypeOf(this,o.prototype),this.response=e,this.href=i,"captureStackTrace"in Error&&typeof Error.captureStackTrace=="function"?Error.captureStackTrace(this,this.constructor):this.stack=new Error(t).stack}get resource(){return this.href}};var ct=A(F(),1);var E=[{name:"Application",isMatch:({resourcetype:o})=>o==="Application",Model:G},{name:"Tab",isMatch:({resourcetype:o})=>o.endsWith("Tab")||o.endsWith("KnowledgeBank"),Model:st},{name:"ListDetail",isMatch:({resourcetype:o})=>{let t=o.toLowerCase();return t.endsWith("listdetail")||t.endsWith("listpaneldetail")||t.endsWith("datastorepaneldetail")},Model:tt},{name:"List",isMatch:({resourcetype:o})=>o.endsWith("List")||o.endsWith("ListPanel")||o.endsWith("RelatedDataStorePanel")||o.endsWith("RelatedDatastorePanel")||["list-related-cases","RecordPanel","EventHistoryPanel","NotePanel","AppointmentPanel","DocumentPanel","AssignmentPanel"].includes(o),Model:et},{name:"GroupingPanel",isMatch:({resourcetype:o})=>["GroupingPanel","CaseTabGroupingPanel","TabGroupingPanel"].includes(o),Model:rt},{name:"CaseSearch",isMatch:({resourcetype:o})=>o==="CaseSearch",Model:nt},{name:"CaseView",isMatch:({resourcetype:o})=>o==="CaseView",Model:Q},{name:"Detail",isMatch:({resourcetype:o})=>o.endsWith("DetailPanel")||["Detail","CasePropertiesPanel","CasePropertiesPanelDetail"].includes(o),Model:W},{name:"TaskGroup",isMatch:({resourcetype:o})=>o==="TaskGroup",Model:Y},{name:"Form",isMatch:({resourcetype:o})=>o==="Form",Model:u},{name:"User",isMatch:({resourcetype:o})=>o==="userdata",Model:z},{name:"UserProfile",isMatch:({resourcetype:o})=>o==="userdata",Model:at},{name:"UserServices",isMatch:({resourcetype:o})=>o==="user_services",Model:V},{name:"ModelCatalog",isMatch:({resourcetype:o})=>o==="ModelCatalog",Model:it},{name:"ConceptIndex",isMatch:({resourcetype:o})=>o==="ConceptSearch"||o.toLowerCase()==="relatedconcepts",Model:K},{name:"ConceptDetail",isMatch:({resourcetype:o})=>o==="ConceptDetail",Model:j},{name:"ConceptTypeDetail",isMatch:({resourcetype:o})=>o==="ConceptTypeDetail",Model:J},{name:"ContentIndex",isMatch:({resourcetype:o})=>o==="ContentSearch",Model:X},{name:"ContentTOC",isMatch:({resourcetype:o})=>o==="ContentTOC",Model:Z},{name:"Content",isMatch:({resourcetype:o})=>o==="ContentDetail",Model:C},{name:"ContentType",isMatch:({resourcetype:o})=>o==="ContentTypeDetail",Model:q},{name:"LookupOptions",isMatch:({resourcetype:o})=>o==="lookupOptions",Model:ot}];var y=class{static resolve(t,e,i=!1){if(!t)throw new a("No data or contribution available, cannot resolve model");if(!(0,ct.has)(t.contributions,"resourcetype"))throw new a(`Contributions has wrong format, missing resourcetype property in contributions of ${t.requestHref?.toString()}`);if(e){let n=Array.isArray(e)?e:[e];return n.length===1||i?n[0]:E.find(s=>s.isMatch(t)&&n.includes(s.Model))?.Model}return E.find(n=>n.isMatch(t))?.Model}};var pt=A(F(),1);import ft from"deepmerge";import{klona as mt}from"klona/full";var dt=class o{_response=new I;_href;_options;_targetModel;_forceTargetModel=!1;_contributionsHref;_locale="en";_method="GET";_progressEvent;_origin="";_contextPath=l();_layoutHintProcessor;constructor(t,e={}){if(!t)throw new a("You must pass a href to the resource that is requested");this._href=typeof t=="string"?new $(t):t,this._options=e,this._layoutHintProcessor=new N(this._origin,this._contextPath,this.options),this._response=new I,this._response.requestHref=this.href,this.locale=this.getRequestLocale(e.locale),this._response.parameters=this.href.parameters.all,this.contextPath=e.contextPath||this.href.contextPath,this.origin=e.origin||this.href.origin,this._targetModel=e.targetModel,this.method=e.method||this.href.method}getRequestLocale(t){return t||typeof navigator<"u"&&navigator?.language&&navigator.language.split("-")[0]||"en"}get origin(){return this._origin}set origin(t){this._origin=t??"",this._response.origin=t??"",this._layoutHintProcessor.setOrigin(this._origin)}get contextPath(){return this._contextPath}set contextPath(t){let e=t??l();this._contextPath=e,this._response.contextPath=e,this._layoutHintProcessor.setContextPath(e)}get contributionsHref(){return this._contributionsHref}set contributionsHref(t){this._contributionsHref=t}set locale(t){this._locale=t,this._response.locale=t,this._layoutHintProcessor.setRequestOptions(this.options)}get locale(){return this._locale}get response(){return this._response}set href(t){this._href=t}get href(){return this._href}set method(t){this._method=t}get method(){return this._method}get options(){return{...this._options,locale:this.locale,method:this.method}}set options(t){this._options=t,this._layoutHintProcessor.setRequestOptions(t)}get requestOptions(){let{targetModel:t,forceTargetModel:e,updateHandler:i,childmodels:r,isValidationRequest:n,removeOnUnmount:d,...s}=this.options;return s}get withChildModels(){return!("childmodels"in this.options)||this.options.childmodels===!0}set targetModel(t){this._targetModel=t}get targetModel(){return this._targetModel}set forceTargetModel(t){this._forceTargetModel=t??!1}get forceTargetModel(){return this._forceTargetModel}resolveModel(){let t=y.resolve(this.response,this.targetModel,this.forceTargetModel);if(t)return t;let e=this.href.toString(),i=this.response?.resourcetype||"unknown";if(this.targetModel){let r=Array.isArray(this.targetModel)?this.targetModel.map(n=>n.type||n.name).join(", "):this.targetModel.type||this.targetModel.name;throw new M(`Cannot find a matching model for URL: '${e}', resourcetype: '${i}'. Available overrides: [${r}]`)}throw new M(`No JavaScript model is applicable for the request to ${e}. Response resourcetype: '${i}'.`)}createModel(){let t=this.resolveModel();return new t(this.response)}processContributionsService(t){if(!(0,pt.isPlainObject)(t))throw new a("Missing contributions data or contributions is not JSON");if(typeof t=="object"&&t!=null){let e=t,[i]=Object.keys(e),r=e[i];i==="error"&&this.handleContributionsError(r),typeof r=="object"&&r!=null&&(this.response.key in r||(this.response.key=i),this.response.contributions=r)}}handleContributionsError(t){let e=t.properties?.message??"Error in contribution";throw new g(e,t,this.contributionsHref)}handleDataError(t){if(typeof t=="object"&&t.properties){let e=t.properties?.message??"Error in data";throw new g(e,t,this.href.absolutepath.toString())}throw new a(JSON.stringify(t))}handleData(t,e){this.response.key=t,this.response.data=e;let i=e?._links;if(!i)throw new a(`No _links object found in the data of ${this.href.toString()}`);if(i?.contributions)this.contributionsHref=i.contributions.href;else if(Array.isArray(i)&&i[0].contributions)this.contributionsHref=i[0].contributions.href;else throw new a(`Contributions link not found for data with key ${t}`)}processDataService(t){if(typeof t!="object"||t===null)throw new a("Missing data or data is not JSON");let e=t,[i]=Object.keys(e),r=e[i];if(i==="error")this.handleDataError(r);else{let[n]=Object.keys(t);this.handleData(n,r)}}fetchContributionsService(){if(!this.contributionsHref)throw new M("Missing a contributions href");return c({url:`${this.origin}${this.contextPath}${this.contributionsHref}`,cache:!0,locale:this.options.locale})}fetchDataService(){return c({...this.requestOptions,url:`${this.origin}${this.contextPath}${this.href.path}`,params:this.href.getQuerystringForModularUI(),locale:this.options.locale,onProgress:this.onProgress})}set onProgress(t){this._progressEvent=t}get onProgress(){return this._progressEvent}getDynamicValidationData(t){let e=typeof this.options.data=="string"?JSON.parse(this.options.data):this.options.data;if(t instanceof u){let i=JSON.parse(t.validationData);return JSON.stringify(ft(e||{},i))}return JSON.stringify(e)??"{}"}async loadDynamicValidations(t){if(!this.options.isValidationRequest&&f("USE_INSTANT_SERVER_VALIDATION")&&t instanceof u&&t.currentFormObject?.hasDynamicValidations){let e=this.href.setParameter("commit","false"),i=await c({...this.requestOptions,url:`${this.origin}${this.contextPath}${this.href.path}`,params:e.getQuerystringForModularUI(),data:this.getDynamicValidationData(t)});if(i==null||typeof i!="object")return t;let r=i,[n]=Object.keys(r);return t.updateValidations(r[n])}return t}fetchFromCache(){return this.options={...this.options,cache:!0},this.fetch()}fetchChildModels(t){let i=t.getInitialChildModelLinks().map(r=>{let n=new o(r.href,{locale:this.locale});return r.targetModel&&(n.targetModel=r.targetModel),r.isCacheable?n.fetchFromCache():n.fetch()});return Promise.allSettled(i).then(r=>{let n=[],d=[];return r.forEach(s=>{if(s.status==="rejected"){let{reason:P}=s;P.name!=="Error.ChangePasswordRequired"&&console.debug("Unexpected error when retrieving child model:",P),d.push(new _(P,"",{origin:this.origin,contextPath:this.contextPath}))}else n.push(s.value)}),t instanceof v&&t.addChildModels(n,d),t})}async fetchContent(t){let e=await this.fetchFromCache();return t&&e instanceof C&&e.childSectionLinks.length>0?this.fetchContentChildSections(e):e}async fetchContentChildSections(t){let e=mt(t),i=await Promise.all(t.childSectionLinks.map(r=>{let n=r.selfhref.addParameter(R,t.entryDate);return new o(n,{locale:this.locale}).fetchContent(!0)}));return e.childSections=i.filter(r=>r instanceof B),e}async fetch(){let t=await this.fetchDataService();if(t==null)throw new Error(`No data received for ${this.href.toString()}`);this.processDataService(t);let e=await this.fetchContributionsService();if(e==null)throw new Error(`No contributions data received for ${this.contributionsHref}`);this.processContributionsService(e),await this._layoutHintProcessor.processAsyncLayoutHints(this.response);let i=this.createModel(),r=await this.loadDynamicValidations(i);return this.withChildModels?await this.fetchChildModels(r):r}post(t){return this.method="POST",this.options={...this.options,data:t},this.fetch()}postForm(t){return this.method="POST",this.options={...this.options,data:t.formdata},this.fetch().then(e=>e instanceof u?t.update(e):t)}fetchSync(){let t={headers:{"Accept-Language":this.locale}},e=dataFetcher.fetch(this.href.toString(),t);if(e==null)throw new Error(`No data received for ${this.href.toString()}`);if(this.processDataService(JSON.parse(e)),this.contributionsHref==null)throw new Error(`No constributions received for ${this.href.toString()}`);let i=dataFetcher.fetch(this.contributionsHref.toString(),t);if(i==null)throw new Error(`No constributions received for ${this.contributionsHref.toString()}`);this.processContributionsService(JSON.parse(i));let r=this.createModel(),d=r.getInitialChildModelLinks().map(s=>new o(s.href,{locale:this.locale}).fetchSync());return r instanceof v&&r.addChildModels(d,[]),r}};var ut=class{_uploadConstraints;_progressHandler;_origin="";_contextPath=l();constructor(t,e,i){this._uploadConstraints=t,this._progressHandler=e,this._origin=i?.origin||"",this._contextPath=i?.contextPath||l()}getFileExtension(t){return t.name.split(".").pop()?.toLowerCase()||""}isNotAllowedFileType(t){let e=this._uploadConstraints.fileTypes;if(e.length>0){let i=this.getFileExtension(t);return!e.some(r=>r.extensions.includes(i))}return!1}exceedsMaxFileSize(t){let e=this._uploadConstraints?.maxFileSize?.fileSize??-1;return e>-1&&t.size>e}uploadFile(t){let e=this._uploadConstraints?.maxFileSize?.fileSize??-1;return f("USE_CLIENTSIDE_VALIDATION")&&this.exceedsMaxFileSize(t)?(this._progressHandler&&this._progressHandler(t,{error:"errorExceedsMaxFileSize"}),Promise.reject(new x("Constraint.File.MaxFileSizeExceeded","Maximum file upload size is ${max-filesize}",{"max-filesize":e},!0))):f("USE_CLIENTSIDE_VALIDATION")&&this.isNotAllowedFileType(t)?(this._progressHandler&&this._progressHandler(t,{error:"errorExtensionNotAllowed"}),Promise.reject(new x("Constraint.File.InvalidExtension","Allowed extensions are: ${extensions}",{extension:this.getFileExtension(t),extensions:this._uploadConstraints.fileTypes.join(", ")},!0))):m({url:U(this._contextPath,this._origin),method:"POST",headers:{"Content-Type":t.type,"x-filename":encodeURIComponent(t.name),"x-filesize":t.size.toString()},onProgress:i=>{this._progressHandler&&i.lengthComputable&&this._progressHandler(t,{progress:Math.ceil(i.loaded/i.total*100)})},data:t}).then(i=>(this._progressHandler&&this._progressHandler(t,{progress:100,token:i.token}),i)).catch(i=>Promise.reject(new _(i)))}};export{lt as a,ht as b,g as c,y as d,dt as e,ut as f};
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{a as N}from"./chunk-TDCALIXY.js";import{b as m,c}from"./chunk-J2QT7BB2.js";import{f as D}from"./chunk-WHWNPOV6.js";import{Ea as z,Fa as V,Ga as G,Ia as W,Ka as Y,La as Q,Ua as K,Wa as X,Xa as C,Ya as Z,bb as _,db as u,e as I,eb as tt,j as v,k as J,o as q,pb as et,rb as ot,s as j,t as x,ub as it,vb as rt,wb as nt,x as B,xb as st,yb as at}from"./chunk-FKIQBPXP.js";import{l as $}from"./chunk-QTZ77JJN.js";import{a as F,b as p}from"./chunk-S3X2VJQL.js";import{a}from"./chunk-VGAPPKHA.js";import{A as U,B as w,h as f,o as T,p as S,q as O,r as k,s as L,v as h,x as l}from"./chunk-SFI46XCV.js";import{g as M}from"./chunk-NOB2I3DW.js";import{b as A,h as R,q as H}from"./chunk-4BYHEGUN.js";var lt=class{_isBasicAuthentication;_authenticationType;constructor(){this._isBasicAuthentication=!1,this._authenticationType=this.getAuthenticationType()}getAuthenticationType(){let t=T(),e=H[t];return!e||e==="JAAS"?"JAAS":e==="PAC4J_FORM"||t.includes("FormClient")?"PAC4J_FORM":e==="PAC4J_BASIC"||t.includes("IndirectBasicClient")?"PAC4J_BASIC":"PAC4J_INDIRECT"}get authenticationType(){return this._authenticationType}set authenticationType(t){this._authenticationType=t}get isBasicAuthentication(){return this._isBasicAuthentication||this.authenticationType==="PAC4J_BASIC"}set isBasicAuthentication(t){this._isBasicAuthentication=t}requestLogin(){return c({url:`${h()}/login`,method:"GET",headers:{Accept:"application/json","Content-Type":"application/x-www-form-urlencoded"}})}initLogin(t){return this.isBasicAuthentication||!t?Promise.resolve(!0):this.requestLogin().catch(e=>(e instanceof D&&(this.isBasicAuthentication=!0),Promise.resolve({})))}login(t,e){switch(this.authenticationType){case"PAC4J_FORM":return this.doFormLogin(t,e);case"PAC4J_BASIC":return this.doBasicAuthentication(t,e);case"PAC4J_INDIRECT":return Promise.resolve();default:return this.doJaasAuthentication(t,e)}}getFormLoginUrl(){switch(this.authenticationType){case"PAC4J_BASIC":return`${h()}${S("DirectBasicAuthClient")}`;case"PAC4J_FORM":return`${h()}${S("FormClient")}`;case"PAC4J_INDIRECT":return"";default:return`${h()}/j_security_check`}}getFormLoginData(t,e){let i=encodeURIComponent(t),r=encodeURIComponent(e);switch(this.authenticationType){case"PAC4J_BASIC":case"PAC4J_FORM":return`${O()}=${i}&${k()}=${r}`;case"JAAS":return`j_username=${i}&j_password=${r}`;default:return""}}doFormLogin(t,e){return c({url:this.getFormLoginUrl(),method:"POST",headers:{Accept:"application/json","Content-Type":"application/x-www-form-urlencoded"},data:this.getFormLoginData(t,e)})}doBasicAuthentication(t,e){return p.addItem("basic",btoa(`${t}:${e}`)),this.requestLogin()}doJaasAuthentication(t,e){return this.initLogin(!0).then(()=>this.isBasicAuthentication?(p.removeItem("basic-ok"),this.doBasicAuthentication(t,e).then(()=>{p.addItem("basic-ok",!0)})):this.doFormLogin(t,e))}getLogoutUrl(){let t=T();return!t||t==="JAAS"?`${h()}/Logoff`:`${h()}${L()}`}redirectToLogout(t){p.clear();let e=window.location.origin,i=t?.startsWith("http")?t:`${e}${h()}`;window.location.assign(this.getLogoutUrl()+"?url="+i)}logout(){return c({url:this.getLogoutUrl()}).then(t=>(p.clear(),t))}};var ht=class{_tokenId;_image;_origin="";_contextPath=l();CaptchaRequest(t){this._origin=t?.origin||"",this._contextPath=t?.contextPath||l()}captchaResponse(t){return this._tokenId="tokenId"in t?t.tokenId:this._tokenId,this._image="image"in t?t.image:this._image,{tokenId:this._tokenId,image:this._image,valid:"valid"in t?t.valid:!1,error:"error"in t?t.error:null}}init(){return m({url:w(this._contextPath,this._origin)}).then(t=>this.captchaResponse(t))}send(t){return m({url:w(this._contextPath,this._origin),method:"POST",data:{tokenId:this._tokenId??"",answer:t??""}}).then(e=>this.captchaResponse(e)).catch(e=>this.captchaResponse(e.response))}refresh(){return this.init()}};var g=class o extends Error{response;href;constructor(t,e,i){super(t),Object.setPrototypeOf(this,o.prototype),this.response=e,this.href=i,"captureStackTrace"in Error&&typeof Error.captureStackTrace=="function"?Error.captureStackTrace(this,this.constructor):this.stack=new Error(t).stack}get resource(){return this.href}};var ct=A(F(),1);var E=[{name:"Application",isMatch:({resourcetype:o})=>o==="Application",Model:G},{name:"Tab",isMatch:({resourcetype:o})=>o.endsWith("Tab")||o.endsWith("KnowledgeBank"),Model:st},{name:"ListDetail",isMatch:({resourcetype:o})=>{let t=o.toLowerCase();return t.endsWith("listdetail")||t.endsWith("listpaneldetail")||t.endsWith("datastorepaneldetail")},Model:tt},{name:"List",isMatch:({resourcetype:o})=>o.endsWith("List")||o.endsWith("ListPanel")||o.endsWith("RelatedDataStorePanel")||o.endsWith("RelatedDatastorePanel")||["list-related-cases","RecordPanel","EventHistoryPanel","NotePanel","AppointmentPanel","DocumentPanel","AssignmentPanel"].includes(o),Model:et},{name:"GroupingPanel",isMatch:({resourcetype:o})=>["GroupingPanel","CaseTabGroupingPanel","TabGroupingPanel"].includes(o),Model:rt},{name:"CaseSearch",isMatch:({resourcetype:o})=>o==="CaseSearch",Model:nt},{name:"CaseView",isMatch:({resourcetype:o})=>o==="CaseView",Model:Q},{name:"Detail",isMatch:({resourcetype:o})=>o.endsWith("DetailPanel")||["Detail","CasePropertiesPanel","CasePropertiesPanelDetail"].includes(o),Model:W},{name:"TaskGroup",isMatch:({resourcetype:o})=>o==="TaskGroup",Model:Y},{name:"Form",isMatch:({resourcetype:o})=>o==="Form",Model:u},{name:"User",isMatch:({resourcetype:o})=>o==="userdata",Model:z},{name:"UserProfile",isMatch:({resourcetype:o})=>o==="userdata",Model:at},{name:"UserServices",isMatch:({resourcetype:o})=>o==="user_services",Model:V},{name:"ModelCatalog",isMatch:({resourcetype:o})=>o==="ModelCatalog",Model:it},{name:"ConceptIndex",isMatch:({resourcetype:o})=>o==="ConceptSearch"||o.toLowerCase()==="relatedconcepts",Model:K},{name:"ConceptDetail",isMatch:({resourcetype:o})=>o==="ConceptDetail",Model:j},{name:"ConceptTypeDetail",isMatch:({resourcetype:o})=>o==="ConceptTypeDetail",Model:J},{name:"ContentIndex",isMatch:({resourcetype:o})=>o==="ContentSearch",Model:X},{name:"ContentTOC",isMatch:({resourcetype:o})=>o==="ContentTOC",Model:Z},{name:"Content",isMatch:({resourcetype:o})=>o==="ContentDetail",Model:C},{name:"ContentType",isMatch:({resourcetype:o})=>o==="ContentTypeDetail",Model:q},{name:"LookupOptions",isMatch:({resourcetype:o})=>o==="lookupOptions",Model:ot}];var y=class{static resolve(t,e,i=!1){if(!t)throw new a("No data or contribution available, cannot resolve model");if(!(0,ct.has)(t.contributions,"resourcetype"))throw new a(`Contributions has wrong format, missing resourcetype property in contributions of ${t.requestHref?.toString()}`);if(e){let n=Array.isArray(e)?e:[e];return n.length===1||i?n[0]:E.find(s=>s.isMatch(t)&&n.includes(s.Model))?.Model}return E.find(n=>n.isMatch(t))?.Model}};var pt=A(F(),1);import ft from"deepmerge";import{klona as mt}from"klona/full";var dt=class o{_response=new I;_href;_options;_targetModel;_forceTargetModel=!1;_contributionsHref;_locale="en";_method="GET";_progressEvent;_origin="";_contextPath=l();_layoutHintProcessor;constructor(t,e={}){if(!t)throw new a("You must pass a href to the resource that is requested");this._href=typeof t=="string"?new $(t):t,this._options=e,this._layoutHintProcessor=new N(this._origin,this._contextPath,this.options),this._response=new I,this._response.requestHref=this.href,this.locale=this.getRequestLocale(e.locale),this._response.parameters=this.href.parameters.all,this.contextPath=e.contextPath||this.href.contextPath,this.origin=e.origin||this.href.origin,this._targetModel=e.targetModel,this.method=e.method||this.href.method}getRequestLocale(t){return t||typeof navigator<"u"&&navigator?.language&&navigator.language.split("-")[0]||"en"}get origin(){return this._origin}set origin(t){this._origin=t??"",this._response.origin=t??"",this._layoutHintProcessor.setOrigin(this._origin)}get contextPath(){return this._contextPath}set contextPath(t){let e=t??l();this._contextPath=e,this._response.contextPath=e,this._layoutHintProcessor.setContextPath(e)}get contributionsHref(){return this._contributionsHref}set contributionsHref(t){this._contributionsHref=t}set locale(t){this._locale=t,this._response.locale=t,this._layoutHintProcessor.setRequestOptions(this.options)}get locale(){return this._locale}get response(){return this._response}set href(t){this._href=t}get href(){return this._href}set method(t){this._method=t}get method(){return this._method}get options(){return{...this._options,locale:this.locale,method:this.method}}set options(t){this._options=t,this._layoutHintProcessor.setRequestOptions(t)}get requestOptions(){let{targetModel:t,forceTargetModel:e,updateHandler:i,childmodels:r,isValidationRequest:n,removeOnUnmount:d,...s}=this.options;return s}get withChildModels(){return!("childmodels"in this.options)||this.options.childmodels===!0}set targetModel(t){this._targetModel=t}get targetModel(){return this._targetModel}set forceTargetModel(t){this._forceTargetModel=t??!1}get forceTargetModel(){return this._forceTargetModel}resolveModel(){let t=y.resolve(this.response,this.targetModel,this.forceTargetModel);if(t)return t;let e=this.href.toString(),i=this.response?.resourcetype||"unknown";if(this.targetModel){let r=Array.isArray(this.targetModel)?this.targetModel.map(n=>n.type||n.name).join(", "):this.targetModel.type||this.targetModel.name;throw new M(`Cannot find a matching model for URL: '${e}', resourcetype: '${i}'. Available overrides: [${r}]`)}throw new M(`No JavaScript model is applicable for the request to ${e}. Response resourcetype: '${i}'.`)}createModel(){let t=this.resolveModel();return new t(this.response)}processContributionsService(t){if(!(0,pt.isPlainObject)(t))throw new a("Missing contributions data or contributions is not JSON");if(typeof t=="object"&&t!=null){let e=t,[i]=Object.keys(e),r=e[i];i==="error"&&this.handleContributionsError(r),typeof r=="object"&&r!=null&&(this.response.key in r||(this.response.key=i),this.response.contributions=r)}}handleContributionsError(t){let e=t.properties?.message??"Error in contribution";throw new g(e,t,this.contributionsHref)}handleDataError(t){if(typeof t=="object"&&t.properties){let e=t.properties?.message??"Error in data";throw new g(e,t,this.href.absolutepath.toString())}throw new a(JSON.stringify(t))}handleData(t,e){this.response.key=t,this.response.data=e;let i=e?._links;if(!i)throw new a(`No _links object found in the data of ${this.href.toString()}`);if(i?.contributions)this.contributionsHref=i.contributions.href;else if(Array.isArray(i)&&i[0].contributions)this.contributionsHref=i[0].contributions.href;else throw new a(`Contributions link not found for data with key ${t}`)}processDataService(t){if(typeof t!="object"||t===null)throw new a("Missing data or data is not JSON");let e=t,[i]=Object.keys(e),r=e[i];if(i==="error")this.handleDataError(r);else{let[n]=Object.keys(t);this.handleData(n,r)}}fetchContributionsService(){if(!this.contributionsHref)throw new M("Missing a contributions href");return c({url:`${this.origin}${this.contextPath}${this.contributionsHref}`,cache:!0,locale:this.options.locale})}fetchDataService(){return c({...this.requestOptions,url:`${this.origin}${this.contextPath}${this.href.path}`,params:this.href.getQuerystringForModularUI(),locale:this.options.locale,onProgress:this.onProgress})}set onProgress(t){this._progressEvent=t}get onProgress(){return this._progressEvent}getDynamicValidationData(t){let e=typeof this.options.data=="string"?JSON.parse(this.options.data):this.options.data;if(t instanceof u){let i=JSON.parse(t.validationData);return JSON.stringify(ft(e||{},i))}return JSON.stringify(e)??"{}"}async loadDynamicValidations(t){if(!this.options.isValidationRequest&&f("USE_INSTANT_SERVER_VALIDATION")&&t instanceof u&&t.currentFormObject?.hasDynamicValidations){let e=this.href.setParameter("commit","false"),i=await c({...this.requestOptions,url:`${this.origin}${this.contextPath}${this.href.path}`,params:e.getQuerystringForModularUI(),data:this.getDynamicValidationData(t)});if(i==null||typeof i!="object")return t;let r=i,[n]=Object.keys(r);return t.updateValidations(r[n])}return t}fetchFromCache(){return this.options={...this.options,cache:!0},this.fetch()}fetchChildModels(t){let i=t.getInitialChildModelLinks().map(r=>{let n=new o(r.href,{locale:this.locale});return r.targetModel&&(n.targetModel=r.targetModel),r.isCacheable?n.fetchFromCache():n.fetch()});return Promise.allSettled(i).then(r=>{let n=[],d=[];return r.forEach(s=>{if(s.status==="rejected"){let{reason:P}=s;P.name!=="Error.ChangePasswordRequired"&&console.debug("Unexpected error when retrieving child model:",P),d.push(new _(P,"",{origin:this.origin,contextPath:this.contextPath}))}else n.push(s.value)}),t instanceof v&&t.addChildModels(n,d),t})}async fetchContent(t){let e=await this.fetchFromCache();return t&&e instanceof C&&e.childSectionLinks.length>0?this.fetchContentChildSections(e):e}async fetchContentChildSections(t){let e=mt(t),i=await Promise.all(t.childSectionLinks.map(r=>{let n=r.selfhref.addParameter(R,t.entryDate);return new o(n,{locale:this.locale}).fetchContent(!0)}));return e.childSections=i.filter(r=>r instanceof B),e}async fetch(){let t=await this.fetchDataService();if(t==null)throw new Error(`No data received for ${this.href.toString()}`);this.processDataService(t);let e=await this.fetchContributionsService();if(e==null)throw new Error(`No contributions data received for ${this.contributionsHref}`);this.processContributionsService(e),await this._layoutHintProcessor.processAsyncLayoutHints(this.response);let i=this.createModel(),r=await this.loadDynamicValidations(i);return this.withChildModels?await this.fetchChildModels(r):r}post(t){return this.method="POST",this.options={...this.options,data:t},this.fetch()}postForm(t){return this.method="POST",this.options={...this.options,data:t.formdata},this.fetch().then(e=>e instanceof u?t.update(e):t)}fetchSync(){let t={headers:{"Accept-Language":this.locale}},e=dataFetcher.fetch(this.href.toString(),t);if(e==null)throw new Error(`No data received for ${this.href.toString()}`);if(this.processDataService(JSON.parse(e)),this.contributionsHref==null)throw new Error(`No constributions received for ${this.href.toString()}`);let i=dataFetcher.fetch(this.contributionsHref.toString(),t);if(i==null)throw new Error(`No constributions received for ${this.contributionsHref.toString()}`);this.processContributionsService(JSON.parse(i));let r=this.createModel(),d=r.getInitialChildModelLinks().map(s=>new o(s.href,{locale:this.locale}).fetchSync());return r instanceof v&&r.addChildModels(d,[]),r}};var ut=class{_uploadConstraints;_progressHandler;_origin="";_contextPath=l();constructor(t,e,i){this._uploadConstraints=t,this._progressHandler=e,this._origin=i?.origin||"",this._contextPath=i?.contextPath||l()}getFileExtension(t){return t.name.split(".").pop()?.toLowerCase()||""}isNotAllowedFileType(t){let e=this._uploadConstraints.fileTypes;if(e.length>0){let i=this.getFileExtension(t);return!e.some(r=>r.extensions.includes(i))}return!1}exceedsMaxFileSize(t){let e=this._uploadConstraints?.maxFileSize?.fileSize??-1;return e>-1&&t.size>e}uploadFile(t){let e=this._uploadConstraints?.maxFileSize?.fileSize??-1;return f("USE_CLIENTSIDE_VALIDATION")&&this.exceedsMaxFileSize(t)?(this._progressHandler&&this._progressHandler(t,{error:"errorExceedsMaxFileSize"}),Promise.reject(new x("Constraint.File.MaxFileSizeExceeded","Maximum file upload size is ${max-filesize}",{"max-filesize":e},!0))):f("USE_CLIENTSIDE_VALIDATION")&&this.isNotAllowedFileType(t)?(this._progressHandler&&this._progressHandler(t,{error:"errorExtensionNotAllowed"}),Promise.reject(new x("Constraint.File.InvalidExtension","Allowed extensions are: ${extensions}",{extension:this.getFileExtension(t),extensions:this._uploadConstraints.fileTypes.join(", ")},!0))):m({url:U(this._contextPath,this._origin),method:"POST",headers:{"Content-Type":t.type,"x-filename":encodeURIComponent(t.name),"x-filesize":t.size.toString()},onProgress:i=>{this._progressHandler&&i.lengthComputable&&this._progressHandler(t,{progress:Math.ceil(i.loaded/i.total*100)})},data:t}).then(i=>(this._progressHandler&&this._progressHandler(t,{progress:100,token:i.token}),i)).catch(i=>Promise.reject(new _(i)))}};export{lt as a,ht as b,g as c,y as d,dt as e,ut as f};
|
|
2
|
+
//# sourceMappingURL=chunk-SBDXU5FX.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{c as d}from"./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import{c as d}from"./chunk-J2QT7BB2.js";import{p as l}from"./chunk-DUTPBVXD.js";import{a as f}from"./chunk-S3X2VJQL.js";import{h as p}from"./chunk-SFI46XCV.js";import{b as L}from"./chunk-4BYHEGUN.js";var u=L(f(),1);var k=class{_origin;_contextPath;_requestOptions;constructor(t,n,i){this._origin=t,this._contextPath=n,this._requestOptions=i}setOrigin(t){this._origin=t}setContextPath(t){this._contextPath=t}setRequestOptions(t){this._requestOptions=t}async processAsyncLayoutHints(t){p("ALLOW_HIDE_WHEN_EMPTY_ON_TABS")&&(await this.processApplicationLinks(t),await this.processTabLinks(t)),await this.processPanelLinks(t)}async processApplicationLinks(t){let n=t.contributions?._links,i=t.data?._links;if(typeof n=="object"&&typeof i=="object"&&n!=null&&i!=null&&"tab"in n&&"tab"in i){let s=n,a=i;await Promise.all(s.tab.map(async e=>{if("components"in e){let r=a.tab.find(o=>o.name===e.name);if(typeof r?.components=="object"){let o=await this.processLinks(r.components,e.components);Array.isArray(o)&&this.replaceApplicationLinks(t,e.name,o)}}}))}}replaceApplicationLinks(t,n,i){let s=t.data?._links;s&&Array.isArray(s.tab)&&(s.tab=s.tab.map(a=>a.name===n?{...a,components:i}:a))}async processTabLinks(t){let n=t.contributions?._links;if(!n)return;let i=n;if("component"in i){let s=t.data?._links;if(Array.isArray(s?.component)){let a=await this.processLinks(s.component,i.component);Array.isArray(a)&&(s.component=a)}}}async processPanelLinks(t){let n=t.contributions?._links;if(!(!t.data||!n)&&typeof n.panel<"u"){let i=t.data._links,s=await this.processLinks(i,n.panel);t.data&&(t.data._links=s)}}dataLinksPerName(t){let n={};if(Array.isArray(t)){for(let i of t)i.name&&(n[i.name]=i);return n}return t||n}async processLinks(t,n){let i=this.dataLinksPerName(t),s=n.filter(o=>o.layouthint?.includes(l)),a=[];for(let o of s){let c=i?.[o.name];c?.href&&a.push(this.isHiddenList(o.name,c.href))}let e=await Promise.all(a);if(Array.isArray(t))return t.filter(o=>!e.includes(o.name));let r={};for(let o in i)if(o in i&&!e.includes(o)){let c=i[o];c&&(r[o]=c)}return r}async isHiddenList(t,n){let i=p("HIDE_WHEN_EMPTY_IGNORE_TASKS",!1);try{let s=await d({...this._requestOptions,url:`${this._origin}${this._contextPath}${n}`});if((0,u.isPlainObject)(s)){let a=s,[e]=Object.keys(a),{_embedded:r,actions:o}=a[e],c=r===null||Array.isArray(r)&&r.length===0,m=o==null||i;if(c&&m)return t}return""}catch{return""}}};export{k as a};
|
|
2
|
+
//# sourceMappingURL=chunk-TDCALIXY.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { M as ModularUIErrorJSON } from '../index-
|
|
2
|
-
export { F as FetchException } from '../index-
|
|
1
|
+
import { M as ModularUIErrorJSON } from '../index-CvHISgQi.cjs';
|
|
2
|
+
export { F as FetchException } from '../index-CvHISgQi.cjs';
|
|
3
3
|
import { immerable } from 'immer';
|
|
4
4
|
import '../Constants-CYAEbTZ4.cjs';
|
|
5
5
|
import '@date-fns/tz/date';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { M as ModularUIErrorJSON } from '../index-
|
|
2
|
-
export { F as FetchException } from '../index-
|
|
1
|
+
import { M as ModularUIErrorJSON } from '../index-SO4eiir8.js';
|
|
2
|
+
export { F as FetchException } from '../index-SO4eiir8.js';
|
|
3
3
|
import { immerable } from 'immer';
|
|
4
4
|
import '../Constants-CYAEbTZ4.js';
|
|
5
5
|
import '@date-fns/tz/date';
|
|
@@ -3398,7 +3398,7 @@ declare class AttributeSetModel extends BaseModel<Data, AttributeSetContribution
|
|
|
3398
3398
|
set attributeCollection(collection: AttributeCollection);
|
|
3399
3399
|
private createChildAttributeSetModel;
|
|
3400
3400
|
/**
|
|
3401
|
-
* Retrieve child
|
|
3401
|
+
* Retrieve child AttributeSetModels
|
|
3402
3402
|
*/
|
|
3403
3403
|
getChildAttributeSets(): AttributeSetModel[];
|
|
3404
3404
|
}
|
|
@@ -3398,7 +3398,7 @@ declare class AttributeSetModel extends BaseModel<Data, AttributeSetContribution
|
|
|
3398
3398
|
set attributeCollection(collection: AttributeCollection);
|
|
3399
3399
|
private createChildAttributeSetModel;
|
|
3400
3400
|
/**
|
|
3401
|
-
* Retrieve child
|
|
3401
|
+
* Retrieve child AttributeSetModels
|
|
3402
3402
|
*/
|
|
3403
3403
|
getChildAttributeSets(): AttributeSetModel[];
|
|
3404
3404
|
}
|