@pega/constellationjs 0.2311.1 → 0.2421.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/README.md +49 -44
- package/dist/bootstrap-shell.js +1 -1
- package/dist/bootstrap-shell.js.br +0 -0
- package/dist/bootstrap-shell.js.gz +0 -0
- package/dist/constellation-core-web.js +2 -0
- package/dist/constellation-core-web.js.br +0 -0
- package/dist/constellation-core-web.js.gz +0 -0
- package/dist/constellation-core-web.js.map +1 -0
- package/dist/constellation-core.7517791f.js +2 -0
- package/dist/constellation-core.7517791f.js.br +0 -0
- package/dist/constellation-core.7517791f.js.gz +0 -0
- package/dist/constellation-core.7517791f.js.map +1 -0
- package/dist/constellation-core.json +1 -0
- package/dist/js/531-web.js +2 -0
- package/dist/js/531-web.js.br +0 -0
- package/dist/js/531-web.js.gz +0 -0
- package/dist/js/531-web.js.map +1 -0
- package/dist/js/531.177c98ad.js +2 -0
- package/dist/js/531.177c98ad.js.br +0 -0
- package/dist/js/531.177c98ad.js.gz +0 -0
- package/dist/js/531.177c98ad.js.map +1 -0
- package/dist/lib_asset.json +1 -1
- package/package.json +8 -15
- package/dist/README.md +0 -56
- package/dist/constellation-core.f61b1513.js +0 -2
- package/dist/constellation-core.f61b1513.js.br +0 -0
- package/dist/constellation-core.f61b1513.js.gz +0 -0
- package/dist/constellation-core.f61b1513.js.map +0 -1
- /package/dist/{constellation-core.f61b1513.js.LICENSE.txt → constellation-core.7517791f.js.LICENSE.txt} +0 -0
package/README.md
CHANGED
|
@@ -1,56 +1,61 @@
|
|
|
1
1
|
# @pega/constellationjs
|
|
2
2
|
|
|
3
|
-
This
|
|
3
|
+
This npm package delivers the ConstellationJS files associated with a specific version of Pega Infinity to your project as an npm package. These ConstellationJS files enable interaction with the Constellation UI model, providing essential services such as data, metadata, and orchestration.
|
|
4
4
|
|
|
5
5
|
## Usage
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
Open your project's **package.json** file and in the **dependencies** section, specify the version of the ConstellationJS files required by your project in the following format:
|
|
8
|
+
>"@pega/constellationjs": "npm version or tag name"
|
|
9
9
|
|
|
10
|
-
For example:
|
|
11
10
|
|
|
12
|
-
|
|
13
|
-
|
|
11
|
+
**Note**:
|
|
12
|
+
- Ensure that you specify the npm version or tag name corresponding to the version of Pega Infinity used in your environment.
|
|
13
|
+
- If you are using Pega Infinity 23.1.1 or later versions, specify the [corresponding npm version](#npm-versions).
|
|
14
|
+
- If you are using Pega Infinity 23.1.0 or earlier versions, specify the [corresponding tag name](#tag-names).
|
|
14
15
|
|
|
15
|
-
- **"@pega/constellationjs": "23.1.3"** <br>
|
|
16
|
-
will get the ConstellationJS files associated with Pega Infinity version 23.1.3
|
|
17
16
|
|
|
18
|
-
|
|
17
|
+
For example:
|
|
18
|
+
- If your project requires the ConstellationJS files associated with Pega Infinity 24.2.1, specify
|
|
19
|
+
>"@pega/constellationjs": "24.2.1"
|
|
20
|
+
|
|
21
|
+
- If your project requires the ConstellationJS files associated with Pega Infinity 23.1.0, specify
|
|
22
|
+
>"@pega/constellationjs": "SDK-8.23.0"
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
<br>
|
|
26
|
+
|
|
27
|
+
## npm versions
|
|
28
|
+
|
|
29
|
+
If you are using Pega Infinity 23.1.1 or later, use the corresponding npm version mentioned in the following table:
|
|
30
|
+
|
|
31
|
+
| Pega Infinity version | npm version |
|
|
32
|
+
|-----------------------|---------------|
|
|
33
|
+
| 24.2.1 | 24.2.1 |
|
|
34
|
+
| 24.2.0 | 24.2.0 |
|
|
35
|
+
| 24.1.2 | 24.1.2 |
|
|
36
|
+
| 24.1.1 | 24.1.1 |
|
|
37
|
+
| 24.1.0 | 24.1.0 |
|
|
38
|
+
| 23.1.2 | 23.1.2 |
|
|
39
|
+
| 23.1.1 | 23.1.1 |
|
|
19
40
|
|
|
20
41
|
<br>
|
|
21
42
|
|
|
22
|
-
##
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
<br><br>
|
|
42
|
-
|
|
43
|
-
- SDK-8.7.5 (v1.0.30)
|
|
44
|
-
- SDK-8.7.4 (v1.0.18)
|
|
45
|
-
- SDK-8.7.3 (v1.0.14)
|
|
46
|
-
- SDK-8.7.2 (v1.0.12)
|
|
47
|
-
- SDK-8.7.1 (v1.0.10)
|
|
48
|
-
- SDK-8.7.0 (v1.0.9)
|
|
49
|
-
<br><br>
|
|
50
|
-
|
|
51
|
-
- SDK-8.6.5 (v1.0.15)
|
|
52
|
-
- SDK-8.6.4 (v1.0.8)
|
|
53
|
-
- SDK-8.6.3 (v1.0.7)
|
|
54
|
-
- SDK-8.6.2 (v1.0.6)
|
|
55
|
-
- SDK-8.6.1 (v1.0.5)
|
|
56
|
-
- SDK-8.6.0 (v1.0.4)
|
|
43
|
+
## Tag names
|
|
44
|
+
If you are using Pega Infinity 23.1.0 or earlier, use the corresponding tag name mentioned in the following table:
|
|
45
|
+
|
|
46
|
+
| Pega Infinity version | Tag name |
|
|
47
|
+
|-----------------------|-------------|
|
|
48
|
+
| 23.1.0 | SDK-8.23.0 |
|
|
49
|
+
| 8.8.4 | SDK-8.8.4 |
|
|
50
|
+
| 8.8.3 | SDK-8.8.3 |
|
|
51
|
+
| 8.8.2 | SDK-8.8.2 |
|
|
52
|
+
| 8.8.1 | SDK-8.8.1 |
|
|
53
|
+
| 8.8.0 | SDK-8.8.0 |
|
|
54
|
+
| 8.7.5 | SDK-8.7.5 |
|
|
55
|
+
| 8.7.4 | SDK-8.7.4 |
|
|
56
|
+
| 8.7.3 | SDK-8.7.3 |
|
|
57
|
+
| 8.7.2 | SDK-8.7.2 |
|
|
58
|
+
| 8.7.1 | SDK-8.7.1 |
|
|
59
|
+
| 8.7.0 | SDK-8.7.0 |
|
|
60
|
+
|
|
61
|
+
<br><br>
|
package/dist/bootstrap-shell.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const viewConfig="@P .viewConfig",routingInfo="@ROUTING_INFO",rootContainerWithHybrid={type:"RootContainer",config:{renderingMode:"hybrid"},children:[{type:"HybridViewContainer",config:{routingInfo,name:"primary",contextName:"app"},children:[]}]},rootContainerWithHybridAcTertiary={type:"RootContainer",config:{renderingMode:"hybrid",acTertiary:!0},children:[{type:"HybridViewContainer",config:{routingInfo,name:"primary",contextName:"app",acTertiary:!0},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,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,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,renderingMode:"view",name:l}};constellationCore.loadRootComponent(e,c,i,a,r).then((()=>constellationCore.loadViewByName(t,o,n,l)))},loadMashup=(e,t=!0)=>{const o={type:"RootContainer",config:{renderingMode:"noPortal"},children:[{type:"ViewContainer",config:{routingInfo,name:"primary"}}]};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,o,[PCore.getConstants().LOAD_VIEW_STRING,"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,a={})=>{const{isCaseLocked:r=!1}=a;o.push(PCore.getConstants().CONTAINER_TYPE.HYBRID,PCore.getConstants().LOAD_VIEW_STRING),constellationCore.loadRootComponent(e,rootContainerWithHybrid,o,n,i).then((()=>constellationCore.getCaseApi().openCase(t,PCore.getConstants().APP.APP,PCore.getConstants().PRIMARY))).then((()=>{r&&PCore.getPubSubUtils().publish(PCore.getEvents().getCaseEvent().CASE_LOCK_EVENT),PCore.getCoexistenceManager().getEventUtils().publishConstellationLoadedEvent()}))},loadPreview=(e,t,o=[],n,i)=>{const{caseID:a,caseClass:r}=t;o.push(PCore.getConstants().CONTAINER_TYPE.HYBRID,PCore.getConstants().LOAD_VIEW_STRING),rootContainerWithHybrid.config.name="hybrid_preview",constellationCore.loadRootComponent(e,rootContainerWithHybrid,o,n,i).then((()=>PCore.getCoexistenceManager().showCasePreview(a,r)))},createCase=(e,t,o=[],n,i)=>{o.push(PCore.getConstants().CONTAINER_TYPE.HYBRID,PCore.getConstants().LOAD_VIEW_STRING),constellationCore.loadRootComponent(e,rootContainerWithHybrid,o,n,i).then((()=>constellationCore.getCaseApi().createCase(t,PCore.getConstants().APP.APP,PCore.getConstants().PRIMARY)))},loadAssignment=(e,t,o=[],n,i,{isUIkit:a,isReloadAssignment:r,caseId:s,acTertiary:l,uiKitConstellationCaseInCreateStage:c})=>{if(a){const e=PCore.getEnvironmentInfo().getCoexistenceMeta();e.isCoexistence=!0,e.appType=PCore.getConstants().APP_TYPE.UIKIT,PCore.getEnvironmentInfo().setCoexistenceMeta(e)}if(r)constellationCore.loadRootComponent(e,rootContainerWithHybrid,o,n,i).then((()=>JSON.parse(c)&&a?constellationCore.getMashupApi().openCase(s,PCore.getConstants().APP.APP,{pageName:PCore.getConstants().VIEW_TYPE.PY_EMBEDASSIGNMENT}):constellationCore.getCaseApi().openCase(s,PCore.getConstants().APP.APP,PCore.getConstants().PRIMARY))).then((()=>{PCore.getCoexistenceManager().getEventUtils().publishConstellationLoadedEvent()}));else if(o.push(PCore.getConstants().CONTAINER_TYPE.HYBRID,PCore.getConstants().LOAD_VIEW_STRING),a)constellationCore.loadRootComponent(e,rootContainerWithHybrid,o,n,i).then((()=>constellationCore.getMashupApi().openAssignment(t,PCore.getConstants().APP.APP,{pageName:PCore.getConstants().VIEW_TYPE.PY_EMBEDASSIGNMENT}))).then((()=>{PCore.getCoexistenceManager().getEventUtils().publishConstellationLoadedEvent()}));else{const a=l?rootContainerWithHybridAcTertiary:rootContainerWithHybrid;constellationCore.loadRootComponent(e,a,o,n,i).then((()=>constellationCore.getCaseApi().openAssignment(t,PCore.getConstants().APP.APP,PCore.getConstants().PRIMARY,{acTertiary:l}))).then((()=>{PCore.getCoexistenceManager().getEventUtils().publishConstellationLoadedEvent()}))}},registerForDebugInfo=e=>{PCore.getEnvironmentInfo().setPreviewMode(),e&&PCore.getPubSubUtils().subscribe("fetchSuccess",(({debugInfo:t})=>{const o=t&&t["X-Pega-App-Debug-ID"];e.postMessage({appDebugID:o})}),"fetchSuccess")},toggleTracerHeaders=e=>{e.addEventListener("message",(async e=>{const t=e?.data?.enableTracer;t?PCore.getDebugger().enableTracer():PCore.getDebugger().disableTracer()}))},initCoreConfig=e=>{const{routingInfo:t,actionModel:o,serviceConfig:n,additionalHeaders:i,tokens:a,semanticUrl:r,queryParams:s,noPortal:l,timezone:c,noHistory:C,viewName:g,theme:p,fieldDefaults:d,restServerConfig:m,dynamicLoadComponents:u=!0,dynamicSemanticUrl:P=!0,enableRouting:h=!0,locale:f,environmentInfo:y,renderingMode:v="FULL_PORTAL",remoteCaseMapping:w={},envType:I}=e,{appAlias:A,googleMapKey:b,staticContentServer:E,appStaticContentServer:R=null,contextPath:S,messagingService:M=null,reAuthUrl:T=null}=n,N={...y,renderingMode:v};let D=location.origin;const $={};if(void 0!==m&&(D=m),S&&(D=`${D}${S}`),A&&"LAUNCHPAD"!==I&&(D=`${D}/${A}`),!0===P){const e=buildSemanticUrl(r,s,l,D,g);!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)),$.dynamicSemanticUrl=!1}!0!==u&&($.dynamicLoadComponents=!1);let L=null;if(A){const e=A.indexOf("/app/");L=e>=0?A.substring(e+1):A}if(constellationCore.enableAppRouting(h),Object.keys($).length>0&&PCore.setBehaviorOverrides($),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(d),constellationCore.setFetchDefaultHeaders(i);const U={...t,domain:`${window.location.protocol}//${window.location.host}`,searchParams:window.location.search};constellationCore.initAppShell(U,o,{server:D,reAuthUrl:T}),constellationCore.setAppAlias(L),constellationCore.setGoogleMapsAPIKey(b),constellationCore.setStaticServerUrl(E,R,a.C11NB2S),constellationCore.PCoreInstance.getLocaleUtils().setTimezone(c),PCore.getRemoteCaseUtils().setRemoteCaseMapping(w),PCore.getEnvironmentInfo().setEnvironmentInfo(N),PCore.getEnvironmentInfo().setLocale(f),PCore.getMessagingServiceManager().setConnectionConfig({messagingService:M}),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)},importCustomComponentMap=async(e,t)=>{try{!function(e,t=!0){const o=document.createElement("script");o.setAttribute("src",e),o.setAttribute("type","text/javascript"),o.setAttribute("async",t),document.body.appendChild(o)}(`${e}component/project/${t}/componentsmap.js?v=${Date.now()}`)}catch(e){console.log(e)}},importDesignSystemComponentMap=async(e,t,o)=>{try{await function(e,t=!0){return new Promise(((o,n)=>{const i=document.createElement("script");i.setAttribute("type","text/javascript"),i.setAttribute("src",e),i.setAttribute("async",t),i.onload=o(),i.onerror=()=>n(new Error("Failed to load resource from Design System")),document.body.appendChild(i)}))}(`${e}component/project/${t}/designsystems/${o}/componentsmap.js?v=${Date.now()}`)}catch(e){console.log(e)}},bootstrap=async(e,t)=>new Promise((async(o,n)=>{try{const{staticContentServer:n,appStaticContentServer:i}=e.serviceConfig,{isC11nGenAIEnabled:a,environmentId:r,isAlternateDesignSystemEnabled:s,alternateDesignSystemName:l}=e,c=await importAssetsJson(n);await importConstellationCore(n,c),initCoreConfig(e);const C=async()=>{await importReactRoot(),a&&await importCustomComponentMap(i,r),"true"===s&&"other"!==l&&await importDesignSystemComponentMap(i,r,l),t&&t(),o(!0)};PCore.getPubSubUtils().subscribe("component-map-loaded",C),await importExternals(c),"ReactRoot"in PCore.getComponentsRegistry().getLazyMap()&&o(!0)}catch(e){n(e)}})),loadEnvironmentInfo=async e=>{if(e.theme?.definition&&(!window.pms||"Android"!==window.pms.device.systemName))try{const t=JSON.parse(e.theme.definition);PCore.getEnvironmentInfo().setBrandingInfo(t.Branding),PCore.getEnvironmentInfo().setTheme(t.Theme)}catch{PCore.getEnvironmentInfo().setBrandingInfo({}),PCore.getEnvironmentInfo().setTheme({})}e.keyMapping&&PCore.getEnvironmentInfo().setKeyMapping(e.keyMapping)},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(PCore.getConstants().CONTAINER_TYPE.HYBRID,PCore.getConstants().LOAD_VIEW_STRING),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:g={},renderingMode:p,locale:d}=e;let m,{authorizationHeader:u,appAlias:P}=e;if(u&&0===Object.keys(C).length&&(C.authType="custom"),!u&&C.tokenInfo){const{tokenInfo:e}=C;u=`${e.token_type} ${e.access_token}`}P?(P=-1!==P.indexOf("/")?P:`app/${P}`,m=await getBootstrapConfig(`${a}/${P}`,u)):m=await getBootstrapConfig(`${a}`,u);const h=JSON.parse(m.pyConfigJSON);h.restServerConfig=a,h.dynamicSemanticUrl=!1,h.dynamicSetCookie=c,h.enableRouting=!1,h.serviceConfig.contextPath="",h.serviceConfig.appAlias=P,h.additionalHeaders={Authorization:u},h.dynamicLoadComponents=!r,h.dynamicSemanticUrl=!r,h.noHistory=!0,h.theme=g??{},h.renderingMode=p??h.renderingMode,h.locale=d||h.locale;const f=l||h.serviceConfig.staticContentServer,y=await importAssetsJson(f);if(y.isSdk?await importConstellationCore(l,y):(h.serviceConfig.staticContentServer=f,await importConstellationCore(f,y)),initCoreConfig(h),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,loadPreview,bootstrapWithAuthHeader,initConstellationCore,isNewUnifiedBuild,registerForDebugInfo,toggleTracerHeaders,loadEnvironmentInfo,updateLocale};
|
|
1
|
+
const viewConfig="@P .viewConfig",routingInfo="@ROUTING_INFO",rootContainerWithHybrid={type:"RootContainer",config:{renderingMode:"hybrid"},children:[{type:"HybridViewContainer",config:{routingInfo,name:"primary",contextName:"app"},children:[]}]},rootContainerWithHybridAcTertiary={type:"RootContainer",config:{renderingMode:"hybrid",acTertiary:!0},children:[{type:"HybridViewContainer",config:{routingInfo,name:"primary",contextName:"app",acTertiary:!0},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+=1}`:r)||`mashup${containerCount+=1}`,l={type:"RootContainer",config:{renderingMode:"portal",viewConfig,name:s}};window.PCore.getRuntimeParamsAPI().setRuntimeParams(n),PCore.getBootstrapUtils().loadRootComponent(e,l,o,i,a).then((()=>PCore.getBootstrapUtils().updateStoreWithUiRoot(t,s)))},loadPortal=(e,t,o=[],n)=>{const i=n||`portal${containerCount+=1}`,a={type:"RootContainer",config:{viewConfig,renderingMode:"portal",skeleton:"LoadingComponent",name:i}};o.push(a.config.skeleton),PCore.getEnvironmentInfo().isPortalLoaded=!0,PCore.getBootstrapUtils().loadRootComponent(e,a,o).then((()=>PCore.getBootstrapUtils().loadPortalView(t,i)))},loadComponent=(e,t,o)=>PCore.getBootstrapUtils().loadComponent(t,e,o),loadViewByName=(e,t,o,n,i,a,r,s)=>{const l=s||`mashup${containerCount+=1}`,c={type:"RootContainer",config:{viewConfig,renderingMode:"view",name:l}};PCore.getBootstrapUtils().loadRootComponent(e,c,i,a,r).then((()=>PCore.getBootstrapUtils().loadViewByName(t,o,n,l)))},loadMashup=(e,t=!0)=>{const o={type:"RootContainer",config:{renderingMode:"noPortal"},children:[{type:"ViewContainer",config:{routingInfo,name:"primary"}}]};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)}}PCore.getBootstrapUtils().loadRootComponent(e,o,[PCore.getConstants().LOAD_VIEW_STRING,"ViewContainer"]),window.parent!==window&&import(`${PCore.getAssetLoader().getStaticServerUrl()}constellation-mashup-bridge.js`).then((e=>{e.mashup.init({resizing:"stretch"})}))},loadCase=(e,t,o=[],n,i,a={})=>{const{isCaseLocked:r=!1}=a;o.push(PCore.getConstants().CONTAINER_TYPE.HYBRID,PCore.getConstants().LOAD_VIEW_STRING),PCore.getBootstrapUtils().loadRootComponent(e,rootContainerWithHybrid,o,n,i).then((()=>(PCore.getInitialiser().initCoreContainers(),PCore.getBootstrapUtils().getCaseApi().openCase(t,PCore.getConstants().APP.APP,PCore.getConstants().PRIMARY)))).then((()=>{r&&PCore.getPubSubUtils().publish(PCore.getEvents().getCaseEvent().CASE_LOCK_EVENT),PCore.getCoexistenceManager().getEventUtils().publishConstellationLoadedEvent()}))},loadPreview=(e,t,o=[],n,i)=>{const{caseID:a,caseClass:r}=t;o.push(PCore.getConstants().CONTAINER_TYPE.HYBRID,PCore.getConstants().LOAD_VIEW_STRING),rootContainerWithHybrid.config.name="hybrid_preview",PCore.getBootstrapUtils().loadRootComponent(e,rootContainerWithHybrid,o,n,i).then((()=>(PCore.getInitialiser().initCoreContainers(),PCore.getCoexistenceManager().showCasePreview(a,r))))},createCase=(e,t,o=[],n,i)=>{o.push(PCore.getConstants().CONTAINER_TYPE.HYBRID,PCore.getConstants().LOAD_VIEW_STRING),PCore.getBootstrapUtils().loadRootComponent(e,rootContainerWithHybrid,o,n,i).then((()=>(PCore.getInitialiser().initCoreContainers(),PCore.getBootstrapUtils().getCaseApi().createCase(t,PCore.getConstants().APP.APP,PCore.getConstants().PRIMARY))))},loadAssignment=(e,t,o=[],n,i,{isUIkit:a,isReloadAssignment:r,caseId:s,acTertiary:l,uiKitConstellationCaseInCreateStage:c})=>{if(a){const e=PCore.getEnvironmentInfo().getCoexistenceMeta();e.isCoexistence=!0,e.appType=PCore.getConstants().APP_TYPE.UIKIT,PCore.getEnvironmentInfo().setCoexistenceMeta(e)}if(r)PCore.getBootstrapUtils().loadRootComponent(e,rootContainerWithHybrid,o,n,i).then((()=>(PCore.getInitialiser().initCoreContainers(),JSON.parse(c)&&a?PCore.getMashupApi().openCase(s,PCore.getConstants().APP.APP,{pageName:PCore.getConstants().VIEW_TYPE.PY_EMBEDASSIGNMENT}):PCore.getBootstrapUtils().getCaseApi().openCase(s,PCore.getConstants().APP.APP,PCore.getConstants().PRIMARY)))).then((()=>{PCore.getCoexistenceManager().getEventUtils().publishConstellationLoadedEvent()}));else if(o.push(PCore.getConstants().CONTAINER_TYPE.HYBRID,PCore.getConstants().LOAD_VIEW_STRING),a)PCore.getBootstrapUtils().loadRootComponent(e,rootContainerWithHybrid,o,n,i).then((()=>(PCore.getInitialiser().initCoreContainers(),PCore.getMashupApi().openAssignment(t,PCore.getConstants().APP.APP,{pageName:PCore.getConstants().VIEW_TYPE.PY_EMBEDASSIGNMENT})))).then((()=>{PCore.getCoexistenceManager().getEventUtils().publishConstellationLoadedEvent()}));else{const a=l?rootContainerWithHybridAcTertiary:rootContainerWithHybrid;PCore.getBootstrapUtils().loadRootComponent(e,a,o,n,i).then((()=>(PCore.getInitialiser().initCoreContainers(),PCore.getBootstrapUtils().getCaseApi().openAssignment(t,PCore.getConstants().APP.APP,PCore.getConstants().PRIMARY,{acTertiary:l})))).then((()=>{PCore.getCoexistenceManager().getEventUtils().publishConstellationLoadedEvent()}))}},registerForDebugInfo=e=>{PCore.getEnvironmentInfo().setPreviewMode(),e&&PCore.getPubSubUtils().subscribe("fetchSuccess",(({debugInfo:t})=>{const o=t&&t["X-Pega-App-Debug-ID"];e.postMessage({appDebugID:o})}),"fetchSuccess")},toggleTracerHeaders=e=>{e.addEventListener("message",(async e=>{const t=e?.data?.enableTracer;t?PCore.getDebugger().enableTracer():PCore.getDebugger().disableTracer()}))},initCoreConfig=e=>{const{serviceConfig:t,semanticUrl:o,queryParams:n,noPortal:i,noHistory:a,viewName:r,theme:s,restServerConfig:l,dynamicLoadComponents:c=!0,dynamicSemanticUrl:C=!0,renderingMode:p="FULL_PORTAL",envType:g,extras:d}=e,{appAlias:m,contextPath:P}=t;let u=location.origin;const h={};if(void 0!==l&&(u=l),P&&(u=`${u}${P}`),m&&"LAUNCHPAD"!==g&&(u=`${u}/${m}`),e.restServerConfig=u,!0===C){const e=buildSemanticUrl(o,n,i,u,r);!a&&e&&history.pushState({},"home",e)}else if("HYBRID"!==p){let e=window.location.href;e.indexOf("?")>0&&(e=e.substring(0,e.indexOf("?")),history.pushState({},"home",e)),h.dynamicSemanticUrl=!1}!0!==c&&(h.dynamicLoadComponents=!1);let f=null;if(m){const e=m.indexOf("/app/");f=e>=0?m.substring(e+1):m}if(Object.keys(h).length>0&&PCore.setBehaviorOverrides(h),e.appAlias=f,s){let t="object"==typeof s?s:null;if(null===t)try{t=JSON.parse(s)}catch{t={}}e.theme=t}const y={...e.routingInfo,domain:`${window.location.protocol}//${window.location.host}`,searchParams:window.location.search};e.routingInfo=y,e.initBroadcast="true"===PCore.getEnvironmentInfo().environmentInfoObject?.pxMashupDetails?.pyIsTraditionalCoexistence,!e.noPortal||"true"!==e.noPortal&&!0!==e.noPortal||"HYBRID"===e.renderingMode||(e.renderingMode="EMBED"),d?.cspNonce&&(window.__webpack_nonce__=d.cspNonce),PCore.getInitialiser().init(e)},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}`;if(n){a=`${e?.endsWith("/")?e.slice(0,-1):e}/prerequisite/${r.startsWith("/")?r.slice(1):r}`}return import(a).then((()=>{PCore.getAssetLoader().initServer(e,"no-appstatic");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},importLocalizationAssets=async(e,t)=>{const o=await PCore.getAssetLoader().getSvcLocale(t,`${e}.json`);if(o.ok){const t=await o.json();PCore.getLocaleUtils().setLocaleForRule(t,e)}},importLocalizationV2Assets=async e=>{if(!(PCore.getEnvironmentInfo().getFeatureMap().availableLanguagePacks||[]).includes(e))return void console.warn(`current locale ${e} is not supported by application.`);const t={locale:e},o=await PCore.getRestClient().invokeRestApi("getLocalizationPack",{queryPayload:t});if((201===o.status||200===o.status)&&o.data){const e=o.data;Object.keys(e).forEach((t=>{PCore.getLocaleUtils().setLocaleForRule(e[t],t)}))}},importExternals=async e=>{const{isDevServerMode:t}=e,o=PCore.getEnvironmentInfo().getLocale(),n=PCore.getEnvironmentInfo().getFeatureMap().localizationVersion||1;if("en-US"!==o)try{let e;e=2===n?[o]:[PCore.getLocaleUtils().GENERIC_BUNDLE_KEY,PCore.getLocaleUtils().MESSAGE_BUNDLE_KEY,PCore.getLocaleUtils().FIELD_LABELS_BUNDLE_KEY,...PCore.getLocaleUtils().getCaseTypeLocaleReferences()];const t=await PCore.getLocaleUtils().isCurrentLocalePackAvailable(),i=e.map((async e=>{2===n?await importLocalizationV2Assets(e):t&&await importLocalizationAssets(e,o)}));await Promise.allSettled(i)}catch(e){console.warn(e)}await PCore.getAssetLoader().loadAssets(e.externals,{isDevServerMode:t}),await PCore.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)},importDesignSystemComponentMap=async(e,t,o)=>{try{await function(e,t=!0){return new Promise(((o,n)=>{const i=document.createElement("script");i.setAttribute("type","text/javascript"),i.setAttribute("src",e),i.setAttribute("async",t),i.onload=o(),i.onerror=()=>n(new Error("Failed to load resource from Design System")),document.body.appendChild(i)}))}(`${e}component/project/${t}/designsystems/${o}/componentsmap.js?v=${Date.now()}`)}catch(e){console.log(e)}},bootstrap=async(e,t)=>new Promise((async(o,n)=>{try{const{staticContentServer:n,appStaticContentServer:i}=e.serviceConfig,{ccV2LibId:a,environmentId:r,isAlternateDesignSystemEnabled:s,alternateDesignSystemName:l}=e,c=await importAssetsJson(n);await importConstellationCore(n,c),initCoreConfig(e);const C=async()=>{await importReactRoot(),a&&await PCore.getAssetLoader().importCustomComponentMap(a),"true"===s&&"other"!==l&&await importDesignSystemComponentMap(i,r,l),t&&t(),o(!0)};PCore.getPubSubUtils().subscribe("component-map-loaded",C),await importExternals(c),"ReactRoot"in PCore.getComponentsRegistry().getLazyMap()&&o(!0)}catch(e){n(e)}})),loadEnvironmentInfo=async e=>{if(e.theme&&(!window.pms||"Android"!==window.pms.device.systemName))try{const t=JSON.parse(e.theme.definition);PCore.getEnvironmentInfo().setBrandingInfo(t.Branding),PCore.getEnvironmentInfo().setTheme(t.Theme)}catch{PCore.getEnvironmentInfo().setBrandingInfo({}),PCore.getEnvironmentInfo().setTheme({})}e.keyMapping&&PCore.getEnvironmentInfo().setKeyMapping(e.keyMapping),PCore.getEnvironmentInfo().setCookieComplianceMethod(e.cookieComplianceMethod??"none"),PCore.getEnvironmentInfo().setIsExtraCallRequiredForDefaultHome(e.isExtraCallRequiredForDefaultHome??"false")},getBootstrapConfig=async(e,t,o,n,i)=>{const a=`${e}/api/application/v2/data_views/D_pxBootstrapConfig${n?`?dataViewParameters=${encodeURIComponent(JSON.stringify({themeID:n}))}`:""}`,r=t?{Authorization:t,...o}:o;return fetch(a,{method:"GET",headers:new Headers(r),credentials:t&&!i?"omit":"include"}).then((e=>{if(e.ok)return e.json();throw Error("D_pxBootstrapConfig load failed.",{cause:e.status})}))},applyEnvironmentInfoResponse=async e=>{const{environmentInfo:t,pyCaseTypeList:o,theme:n,keyMapping:i}=e,{pxApplication:a,features:r,pxLocale:s}=t,l={simpleTable:{pageInstructionUUIDGeneration:!1},...r},c=Intl.DateTimeFormat().resolvedOptions().timeZone.toUpperCase(),C="ETC/UNKNOWN"===c?"America/New_York":c;e.environmentInfo={...t,pxApplication:{...a},features:l,pyCaseTypeList:o,pxLocale:{...s,pyTimeZone:C}},e.timezone=C;const p=Object.keys(e.environmentInfo);return{isEnvInfoValid:["pxOperator","pxLocale","pxApplication"].every((e=>p.includes(e))),theme:n,keyMapping:i,features:l}},getLPConfig=async(e,t,o,n)=>{const i=new Headers({...o,...t&&{Authorization:t}}),a=await fetch(e,{method:"GET",headers:i,credentials:t&&!n?"omit":"include"});if(!a.ok)throw new Error("environmentInfo load failed.",{cause:a.status});return a.json()},loadRootContainer=(e,t=[],o,n)=>(t.push(PCore.getConstants().CONTAINER_TYPE.HYBRID,PCore.getConstants().LOAD_VIEW_STRING),PCore.getBootstrapUtils().loadRootComponent(e,rootContainerWithHybrid,t,o,n)),bootstrapWithAuthHeader=async(e,t,o=[],n,i)=>{const{customRendering:a=!1,onPCoreReadyCallback:r,staticContentServerUrl:s,dynamicSetCookie:l=!1,authInfo:c={},theme:C={},renderingMode:p,locale:g,envType:d,themeID:m,customCookies:P}=e;let{restServerUrl:u,authorizationHeader:h,appAlias:f}=e,y=e.additionalHeaders?{...e.additionalHeaders}:{},I=null;if((h&&0===Object.keys(c).length||P)&&(c.authType="custom",c.customCookies=P),!h&&c.tokenInfo?.access_token){const{tokenInfo:e}=c;h=`${e.token_type} ${e.access_token}`}c.tokenInfo?.csrf&&(y={...y,pzCTkn:c.tokenInfo.csrf}),f&&-1===f.indexOf("/")&&(f=`app/${f}`),"LAUNCHPAD"===d?(y={...y,"X-Constellation-App":"Pega"},u=u.endsWith("/dx")?u:`${u}/dx`,I=await getLPConfig(`${u}/api/application/v2/environmentInfo`,h,y,P)):I=await getBootstrapConfig(f?`${u}/${f}`:`${u}`,h,y,m,P);const v=I?.pyConfigJSON?JSON.parse(I.pyConfigJSON):{...I};v.restServerConfig=u,v.dynamicSemanticUrl=!1,v.dynamicSetCookie=l,v.enableRouting=!1,v.serviceConfig.contextPath="",v.serviceConfig.appAlias=f,v.additionalHeaders={Authorization:h,...y},v.envType=d,v.dynamicLoadComponents=!a,v.dynamicSemanticUrl=!a,v.noHistory=!0,v.theme=C??{};const w=m&&v?.themeObject?v.themeObject:null;v.theme=w||C,v.renderingMode=p??v.renderingMode,v.locale=g||v.locale;const E=s||v.serviceConfig.staticContentServer,A=await importAssetsJson(E);if(A.isSdk?await importConstellationCore(s,A):(v.serviceConfig.staticContentServer=E,v.serviceConfig.appStaticContentServer=v.serviceConfig.appStaticContentServer||"no-appstatic",await importConstellationCore(E,A)),initCoreConfig(v),r&&window.PCore.onPCoreReady(r),c&&["OAuth2.0","custom"].includes(c?.authType)&&PCore.getBootstrapUtils().setFetchAuthInfo(c),"LAUNCHPAD"===d&&await applyEnvironmentInfoResponse(v),A.isSdk&&a&&await importExternals(A),!a){const e=new Promise((async(e,t)=>{try{const t=async()=>{await importReactRoot(),e(!0)};PCore.getPubSubUtils().subscribe("component-map-loaded",t),await importExternals(A),"ReactRoot"in PCore.getComponentsRegistry().getLazyMap()&&e(!0)}catch(e){t(e)}}));await e,PCore.getInitialiser().initCoreContainers(),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,loadPreview,bootstrapWithAuthHeader,initConstellationCore,isNewUnifiedBuild,registerForDebugInfo,toggleTracerHeaders,loadEnvironmentInfo,updateLocale};
|
|
Binary file
|
|
Binary file
|