@pega/constellationjs 1.0.32 → 1.0.34
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/README.md
CHANGED
package/dist/bootstrap-shell.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const rootContainerWithHybrid={type:"RootContainer",config:{renderingMode:"hybrid"},children:[{type:"HybridViewContainer",config:{routingInfo:"@ROUTING_INFO",name:"primary",contextName:"app"},children:[]}]},buildSemanticUrl=(e,o,
|
|
1
|
+
const rootContainerWithHybrid={type:"RootContainer",config:{renderingMode:"hybrid"},children:[{type:"HybridViewContainer",config:{routingInfo:"@ROUTING_INFO",name:"primary",contextName:"app"},children:[]}]},buildSemanticUrl=(e,t,o,n,i)=>{const a=new URLSearchParams(t);let r=!1;"true"===o&&(r=!0);let s=null,l=null;if(e){e.startsWith("/")&&(e=e.substring(1));const t=e.split("/");t.length>0&&t[0]&&(s=t[0]),t.length>1&&t[1]&&(l=t[1])}else r=!1;let c=n;s&&(c=`${c}/${s}`),l&&(c=`${c}/${l}`),r&&(!a.has("noPortal")&&a.append("noPortal",!0),l&&i&&a.append("view",i));const C=a.toString();return c+=C?`?${C}`:"",c};let containerCount=0;const loadView=(e,t,o=[],n,i,a,r)=>{const s=("hybrid"===r?"hybrid_"+ ++containerCount:r)||"mashup"+ ++containerCount,l={type:"RootContainer",config:{renderingMode:"portal",viewConfig:"@P .viewConfig",name:s}};window.PCore.getRuntimeParamsAPI().setRuntimeParams(n),constellationCore.loadRootComponent(e,l,o,i,a).then((()=>constellationCore.updateStoreWithUiRoot(t,s)))},loadPortal=(e,t,o=[],n)=>{const i=n||"portal"+ ++containerCount,a={type:"RootContainer",config:{viewConfig:"@P .viewConfig",renderingMode:"portal",skeleton:"LoadingComponent",name:i}};o.push(a.config.skeleton),PCore.getEnvironmentInfo().isPortalLoaded=!0,constellationCore.loadRootComponent(e,a,o).then((()=>constellationCore.loadPortalView(t,i)))},loadComponent=(e,t,o)=>constellationCore.loadComponent(t,e,o),loadViewByName=(e,t,o,n,i,a,r,s)=>{const l=s||"mashup"+ ++containerCount,c={type:"RootContainer",config:{viewConfig:"@P .viewConfig",renderingMode:"view",name:l}};constellationCore.loadRootComponent(e,c,i,a,r).then((()=>constellationCore.loadViewByName(t,o,n,l)))},loadMashup=(e,t=!0)=>{if(t){const t=document.getElementsByTagName(e)[0]&&document.getElementsByTagName(e)[0].parentNode;if(t){const e=document.createElement("style");e.setAttribute("id","portal-less-styles"),e.innerHTML="app-root.mashup > .case-view, app-root.mashup > .page-view { min-height: 0px !important; }",t.appendChild(e)}}constellationCore.loadRootComponent(e,{type:"RootContainer",config:{renderingMode:"noPortal"},children:[{type:"ViewContainer",config:{routingInfo:"@ROUTING_INFO",name:"primary"}}]},["View","ViewContainer"]),window.parent!==window&&import(`${constellationCore.PCoreInstance.getAssetLoader().getStaticServerUrl()}constellation-mashup-bridge.js`).then((e=>{e.mashup.init({resizing:"stretch"})}))},loadCase=(e,t,o=[],n,i)=>{o.push("HybridViewContainer","View"),constellationCore.loadRootComponent(e,rootContainerWithHybrid,o,n,i).then((()=>constellationCore.getCaseApi().openCase(t,"app","primary")))},createCase=(e,t,o=[],n,i)=>{o.push("HybridViewContainer","View"),constellationCore.loadRootComponent(e,rootContainerWithHybrid,o,n,i).then((()=>constellationCore.getCaseApi().createCase(t,"app","primary")))},loadAssignment=(e,t,o=[],n,i)=>{o.push("HybridViewContainer","View"),constellationCore.loadRootComponent(e,rootContainerWithHybrid,o,n,i).then((()=>constellationCore.getCaseApi().openAssignment(t,"app","primary")))},initCoreConfig=e=>{const{routingInfo:t,actionModel:o,serviceConfig:n,additionalHeaders:i,tokens:a,semanticUrl:r,queryParams:s,noPortal:l,timezone:c,noHistory:C,viewName:d,theme:p,fieldDefaults:m,restServerConfig:g,dynamicLoadComponents:h=!0,dynamicSemanticUrl:u=!0,enableRouting:f=!0,locale:w,environmentInfo:y,renderingMode:v="FULL_PORTAL",remoteCaseMapping:P={}}=e,{appAlias:S,googleMapKey:R,staticContentServer:b,appStaticContentServer:$=null,contextPath:A,messagingService:I=null}=n,U={...y,renderingMode:v};let L=location.origin;const M={};if(void 0!==g&&(L=g),A&&(L=`${L}${A}`),S&&(L=`${L}/${S}`),!0===u){const e=buildSemanticUrl(r,s,l,L,d);!C&&e&&history.pushState({},"home",e)}else if("HYBRID"!==v){let e=window.location.href;e.indexOf("?")>0&&(e=e.substring(0,e.indexOf("?")),history.pushState({},"home",e)),M.dynamicSemanticUrl=!1}!0!==h&&(M.dynamicLoadComponents=!1);let E=null;if(S){const e=S.indexOf("/app/");E=e>=0?S.substring(e+1):S}if(constellationCore.enableAppRouting(f),Object.keys(M).length>0&&PCore.setBehaviorOverrides(M),constellationCore.initStore(),p){let e="object"==typeof p?p:null;if(null===e)try{e=JSON.parse(p)}catch{e={}}PCore.getEnvironmentInfo().setTheme(e)}constellationCore.setFieldsDefaultConfigs(m),constellationCore.setFetchDefaultHeaders(i);const H={...t,domain:`${window.location.protocol}//${window.location.host}`,searchParams:window.location.search};constellationCore.initAppShell(H,o,{server:L}),constellationCore.setAppAlias(E),constellationCore.setGoogleMapsAPIKey(R),constellationCore.setStaticServerUrl(b,$,a.C11NB2S),constellationCore.PCoreInstance.getLocaleUtils().setTimezone(c),PCore.getEnvironmentInfo().setLocale(w),PCore.getRemoteCaseUtils().setRemoteCaseMapping(P),PCore.getEnvironmentInfo().setEnvironmentInfo(U),PCore.getMessagingServiceManager().setConnectionConfig({messagingService:I}),PCore.getNavigationUtils().init()},importConstellationCore=async(e,t)=>{const{isDevServerMode:o,isSdk:n}=t,{prerequisite:i}=t;if(i&&i.length>0){const t=i[0];let a;const r=Object.keys(t)[0];if(o){const e=Object.values(t)[0];a=e.endsWith("/")?`${e}prerequisite/${r}`:`${e}/prerequisite/${r}`}else a=e.endsWith("/")?`${e}prerequisite/${r}`:`${e}/prerequisite/${r}`;return n&&(a=`${e.endsWith("/")?e.slice(0,-1):e}/prerequisite/${r.startsWith("/")?r.slice(1):r}`),import(a).then((t=>{window.constellationCore=t,constellationCore.setStaticServerUrl(e,"no-appstatic"),void 0!==window.constellationCore.PCoreInstance&&(window.PCore=window.constellationCore.PCoreInstance);for(let t=1;t<i.length;t+=1){const n=i[t],a=Object.keys(n)[0];if(o){const e=Object.values(n)[0];import(`${e}prerequisite/${a}`).then((e=>{console.log(e)}))}else import(`${e}prerequisite/${a}`).then((e=>{console.log(e)}))}}))}return null},importExternals=async e=>{const{isDevServerMode:t}=e,o=constellationCore.PCoreInstance,n=o.getEnvironmentInfo().getLocale();if("en-US"!==n)try{const e=o.getLocaleUtils().GENERIC_BUNDLE_KEY,t=await o.getAssetLoader().getSvcLocale(n,`${e}.json`);if(t.ok){const n=await t.json();o.getLocaleUtils().setLocaleForRule(n,e)}}catch(e){console.warn(e)}await o.getAssetLoader().loadAssets(e.externals,{isDevServerMode:t}),await o.getAssetLoader().loadAssets(e.entry,{isDevServerMode:t})},importAssetsJson=async e=>{const t=(new Date).getTime();return fetch(`${e}lib_asset.json?v=${t}`).then((e=>e.json()))},importReactRoot=async()=>{const e=[];return PCore.getComponentsRegistry().getComponent("ReactRoot").modules.forEach((t=>{e.push(t())})),Promise.allSettled(e)},bootstrap=async(e,t)=>new Promise((async(o,n)=>{try{const{staticContentServer:n}=e.serviceConfig,i=await importAssetsJson(n);await importConstellationCore(n,i),initCoreConfig(e);const a=async()=>{await importReactRoot(),t&&t(),o(!0)};PCore.getPubSubUtils().subscribe("component-map-loaded",a),await importExternals(i),"ReactRoot"in PCore.getComponentsRegistry().getLazyMap()&&o(!0)}catch(e){n(e)}})),getBootstrapConfig=async(e,t)=>fetch(`${e}/api/application/v2/data_views/D_pxBootstrapConfig`,{method:"GET",headers:new Headers({Authorization:t})}).then((e=>e.json())),loadRootContainer=(e,t=[],o,n)=>(t.push("HybridViewContainer","View"),constellationCore.loadRootComponent(e,rootContainerWithHybrid,t,o,n)),bootstrapWithAuthHeader=async(e,t,o=[],n,i)=>{const{restServerUrl:a,customRendering:r=!1,onPCoreReadyCallback:s,staticContentServerUrl:l,dynamicSetCookie:c=!1,authInfo:C={},theme:d={},renderingMode:p}=e;let m,{authorizationHeader:g,appAlias:h}=e;if(g&&0===Object.keys(C).length&&(C.authType="custom"),!g&&C.tokenInfo){const{tokenInfo:e}=C;g=`${e.token_type} ${e.access_token}`}h?(h=-1!==h.indexOf("/")?h:`app/${h}`,m=await getBootstrapConfig(`${a}/${h}`,g)):m=await getBootstrapConfig(`${a}`,g);const u=JSON.parse(m.pyConfigJSON);u.restServerConfig=a,u.dynamicSemanticUrl=!1,u.dynamicSetCookie=c,u.enableRouting=!1,u.serviceConfig.contextPath="",u.serviceConfig.appAlias=h,u.additionalHeaders={Authorization:g},u.dynamicLoadComponents=!r,u.dynamicSemanticUrl=!r,u.noHistory=!0,u.theme=d??{},u.renderingMode=p??u.renderingMode;const f=u.serviceConfig.staticContentServer,w=l||u.serviceConfig.staticContentServer;u.serviceConfig.staticContentServer=w;const y=await importAssetsJson(w);if(await importConstellationCore(w,y),y.isSdk&&(u.serviceConfig.staticContentServer=f),initCoreConfig(u),s&&window.PCore.onPCoreReady(s),C&&["OAuth2.0","custom"].includes(C?.authType)&&constellationCore.setFetchAuthInfo(C),y.isSdk&&r&&await importExternals(y),!r){const e=new Promise((async(e,t)=>{try{const t=async()=>{await importReactRoot(),e(!0)};PCore.getPubSubUtils().subscribe("component-map-loaded",t),await importExternals(y),"ReactRoot"in PCore.getComponentsRegistry().getLazyMap()&&e(!0)}catch(e){t(e)}}));await e,await loadRootContainer(t,o,n,i)}},initConstellationCore=async e=>{const t=await importAssetsJson(e);await importConstellationCore(e,t)},loadDefaultPortal=(e,t=[],o)=>{const n=PCore.getEnvironmentInfo().getDefaultPortal();loadPortal(e,n,t,o)},isNewUnifiedBuild=()=>!1,updateLocale=e=>{PCore.getEnvironmentInfo().setLocale(e)};export{bootstrap,loadView,loadPortal,loadDefaultPortal,loadComponent,loadMashup,loadViewByName,loadCase,createCase,loadAssignment,bootstrapWithAuthHeader,initConstellationCore,isNewUnifiedBuild,updateLocale};
|
|
Binary file
|
|
Binary file
|
package/package.json
CHANGED
|
File without changes
|