@pega/constellationjs 1.0.41 → 23.1.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 CHANGED
@@ -1,6 +1,6 @@
1
1
  # @pega/constellationjs
2
2
 
3
- This node package is provided as an easy way to get the appropriate version of the Pega ConstellationJS files into your project. It is intended to be
3
+ This node package is provided as an easy way to get the appropriate version of the Pega ConstellationJS files into your project. It is intended to be
4
4
  used in conjunction with a Pega SDK that needs the correct version of the
5
5
  ConstellationJS files to properly interact with the Constellation UI model
6
6
  first introduced in Pega Infinity 8.6.
@@ -12,17 +12,16 @@ the **tag** of the version of the ConstellationJS files that your project needs.
12
12
 
13
13
  For example:
14
14
 
15
- * **"@pega/constellationjs": "SDK-8.8.0"** <br>
16
- will get the ConstellationJS files associated with Pega Infinity version
17
- 8.8.0
15
+ - **"@pega/constellationjs": "SDK-8.8.0"** <br>
16
+ will get the ConstellationJS files associated with Pega Infinity version
17
+ 8.8.0
18
18
 
19
- * **"@pega/constellationjs": "SDK-8.7.1"** <br>
20
- will get the ConstellationJS files associated with Pega Infinity version
21
- 8.7.1
19
+ - **"@pega/constellationjs": "SDK-8.7.1"** <br>
20
+ will get the ConstellationJS files associated with Pega Infinity version
21
+ 8.7.1
22
22
 
23
23
  You must **always** use the appropriate Constellation files that match your Infinity deployment. Please check your Infinity version and choose the correct version.
24
24
 
25
-
26
25
  <br>
27
26
 
28
27
  ## Currently available versions
@@ -32,28 +31,28 @@ of the ConstellationJS files.
32
31
 
33
32
  These are the currently available tags/versions:
34
33
 
35
- * SDK-8.23.0 (v1.0.39 - associated with Infinity 23.1.0)
36
- <br><br>
37
-
38
- * SDK-8.8.4 (v1.0.41)
39
- * SDK-8.8.3 (v1.0.36)
40
- * SDK-8.8.2 (v1.0.34)
41
- * SDK-8.8.1 (v1.0.26)
42
- * SDK-8.8.0 (v1.0.25)
43
- <br><br>
44
-
45
- * SDK-8.7.5 (v1.0.30)
46
- * SDK-8.7.4 (v1.0.18)
47
- * SDK-8.7.3 (v1.0.14)
48
- * SDK-8.7.2 (v1.0.12)
49
- * SDK-8.7.1 (v1.0.10)
50
- * SDK-8.7.0 (v1.0.9)
51
- <br><br>
52
-
53
- * SDK-8.6.5 (v1.0.15)
54
- * SDK-8.6.4 (v1.0.8)
55
- * SDK-8.6.3 (v1.0.7)
56
- * SDK-8.6.2 (v1.0.6)
57
- * SDK-8.6.1 (v1.0.5)
58
- * SDK-8.6.0 (v1.0.4)
59
-
34
+ - SDK-23.1.1 (v23.1.1 - associated with Infinity 23.1.1)
35
+ - SDK-8.23.0 (v1.0.39 - associated with Infinity 23.1.0)
36
+ <br><br>
37
+
38
+ - SDK-8.8.4 (v1.0.41)
39
+ - SDK-8.8.3 (v1.0.36)
40
+ - SDK-8.8.2 (v1.0.34)
41
+ - SDK-8.8.1 (v1.0.26)
42
+ - SDK-8.8.0 (v1.0.25)
43
+ <br><br>
44
+
45
+ - SDK-8.7.5 (v1.0.30)
46
+ - SDK-8.7.4 (v1.0.18)
47
+ - SDK-8.7.3 (v1.0.14)
48
+ - SDK-8.7.2 (v1.0.12)
49
+ - SDK-8.7.1 (v1.0.10)
50
+ - SDK-8.7.0 (v1.0.9)
51
+ <br><br>
52
+
53
+ - SDK-8.6.5 (v1.0.15)
54
+ - SDK-8.6.4 (v1.0.8)
55
+ - SDK-8.6.3 (v1.0.7)
56
+ - SDK-8.6.2 (v1.0.6)
57
+ - SDK-8.6.1 (v1.0.5)
58
+ - SDK-8.6.0 (v1.0.4)
package/dist/README.md ADDED
@@ -0,0 +1,58 @@
1
+ # @pega/constellationjs
2
+
3
+ This node package is provided as an easy way to get the appropriate version of the Pega ConstellationJS files into your project. It is intended to be
4
+ used in conjunction with a Pega SDK that needs the correct version of the
5
+ ConstellationJS files to properly interact with the Constellation UI model
6
+ first introduced in Pega Infinity 8.6.
7
+
8
+ ## Usage
9
+
10
+ In your project's **package.json** dependencies, specify the package name **and**
11
+ the **tag** of the version of the ConstellationJS files that your project needs.
12
+
13
+ For example:
14
+
15
+ - **"@pega/constellationjs": "SDK-8.8.0"** <br>
16
+ will get the ConstellationJS files associated with Pega Infinity version
17
+ 8.8.0
18
+
19
+ - **"@pega/constellationjs": "SDK-8.7.1"** <br>
20
+ will get the ConstellationJS files associated with Pega Infinity version
21
+ 8.7.1
22
+
23
+ You must **always** use the appropriate Constellation files that match your Infinity deployment. Please check your Infinity version and choose the correct version.
24
+
25
+ <br>
26
+
27
+ ## Currently available versions
28
+
29
+ The **@pega/constellationjs** package uses npm tags to distribute specific versions
30
+ of the ConstellationJS files.
31
+
32
+ These are the currently available tags/versions:
33
+
34
+ - SDK-23.1.1 (v23.1.1 - associated with Infinity 23.1.1)
35
+ - SDK-8.23.0 (v1.0.39 - associated with Infinity 23.1.0)
36
+ <br><br>
37
+
38
+ - SDK-8.8.4 (v1.0.41)
39
+ - SDK-8.8.3 (v1.0.36)
40
+ - SDK-8.8.2 (v1.0.34)
41
+ - SDK-8.8.1 (v1.0.26)
42
+ - SDK-8.8.0 (v1.0.25)
43
+ <br><br>
44
+
45
+ - SDK-8.7.5 (v1.0.30)
46
+ - SDK-8.7.4 (v1.0.18)
47
+ - SDK-8.7.3 (v1.0.14)
48
+ - SDK-8.7.2 (v1.0.12)
49
+ - SDK-8.7.1 (v1.0.10)
50
+ - SDK-8.7.0 (v1.0.9)
51
+ <br><br>
52
+
53
+ - SDK-8.6.5 (v1.0.15)
54
+ - SDK-8.6.4 (v1.0.8)
55
+ - SDK-8.6.3 (v1.0.7)
56
+ - SDK-8.6.2 (v1.0.6)
57
+ - SDK-8.6.1 (v1.0.5)
58
+ - SDK-8.6.0 (v1.0.4)
@@ -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,t,n,i)=>{const a=new URLSearchParams(o);let r=!1;"true"===t&&(r=!0);let s=null,l=null;if(e){e.startsWith("/")&&(e=e.substring(1));const o=e.split("/");o.length>0&&o[0]&&(s=o[0]),o.length>1&&o[1]&&(l=o[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,o,t=[],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,t,i,a).then((()=>constellationCore.updateStoreWithUiRoot(o,s)))},loadPortal=(e,o,t=[],n)=>{const i=n||"portal"+ ++containerCount,a={type:"RootContainer",config:{viewConfig:"@P .viewConfig",renderingMode:"portal",skeleton:"LoadingComponent",name:i}};t.push(a.config.skeleton),PCore.getEnvironmentInfo().isPortalLoaded=!0,constellationCore.loadRootComponent(e,a,t).then((()=>constellationCore.loadPortalView(o,i)))},loadComponent=(e,o,t)=>constellationCore.loadComponent(o,e,t),loadViewByName=(e,o,t,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(o,t,n,l)))},loadMashup=(e,o=!0)=>{if(o){const o=document.getElementsByTagName(e)[0]&&document.getElementsByTagName(e)[0].parentNode;if(o){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; }",o.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,o,t=[],n,i)=>{t.push("HybridViewContainer","View"),constellationCore.loadRootComponent(e,rootContainerWithHybrid,t,n,i).then((()=>constellationCore.getCaseApi().openCase(o,"app","primary")))},createCase=(e,o,t=[],n,i)=>{t.push("HybridViewContainer","View"),constellationCore.loadRootComponent(e,rootContainerWithHybrid,t,n,i).then((()=>constellationCore.getCaseApi().createCase(o,"app","primary")))},loadAssignment=(e,o,t=[],n,i)=>{t.push("HybridViewContainer","View"),constellationCore.loadRootComponent(e,rootContainerWithHybrid,t,n,i).then((()=>constellationCore.getCaseApi().openAssignment(o,"app","primary")))},initCoreConfig=e=>{const{routingInfo:o,actionModel:t,serviceConfig:n,additionalHeaders:i,tokens:a,semanticUrl:r,queryParams:s,noPortal:l,timezone:c,noHistory:C,viewName:p,theme:d,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,p);!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(),d){let e="object"==typeof d?d:null;if(null===e)try{e=JSON.parse(d)}catch{e={}}PCore.getEnvironmentInfo().setTheme(e)}constellationCore.setFieldsDefaultConfigs(m),constellationCore.setFetchDefaultHeaders(i);const H={...o,domain:`${window.location.protocol}//${window.location.host}`,searchParams:window.location.search};constellationCore.initAppShell(H,t,{server:L}),constellationCore.setAppAlias(E),constellationCore.setGoogleMapsAPIKey(R),constellationCore.setStaticServerUrl(b,$,a.C11NB2S),constellationCore.PCoreInstance.getLocaleUtils().setTimezone(c),PCore.getRemoteCaseUtils().setRemoteCaseMapping(P),PCore.getEnvironmentInfo().setEnvironmentInfo(U),PCore.getEnvironmentInfo().setLocale(w),PCore.getMessagingServiceManager().setConnectionConfig({messagingService:I}),PCore.getNavigationUtils().init()},importConstellationCore=async(e,o)=>{const{isDevServerMode:t,isSdk:n}=o,{prerequisite:i}=o;if(i&&i.length>0){const o=i[0];let a;const r=Object.keys(o)[0];if(t){const e=Object.values(o)[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((o=>{window.constellationCore=o,constellationCore.setStaticServerUrl(e,"no-appstatic"),void 0!==window.constellationCore.PCoreInstance&&(window.PCore=window.constellationCore.PCoreInstance);for(let o=1;o<i.length;o+=1){const n=i[o],a=Object.keys(n)[0];if(t){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:o}=e,t=constellationCore.PCoreInstance,n=t.getEnvironmentInfo().getLocale();if("en-US"!==n)try{const e=t.getLocaleUtils().GENERIC_BUNDLE_KEY,o=await t.getAssetLoader().getSvcLocale(n,`${e}.json`);if(o.ok){const n=await o.json();t.getLocaleUtils().setLocaleForRule(n,e)}}catch(e){console.warn(e)}await t.getAssetLoader().loadAssets(e.externals,{isDevServerMode:o}),await t.getAssetLoader().loadAssets(e.entry,{isDevServerMode:o})},importAssetsJson=async e=>{const o=(new Date).getTime();return fetch(`${e}lib_asset.json?v=${o}`).then((e=>e.json()))},importReactRoot=async()=>{const e=[];return PCore.getComponentsRegistry().getComponent("ReactRoot").modules.forEach((o=>{e.push(o())})),Promise.allSettled(e)},bootstrap=async(e,o)=>new Promise((async(t,n)=>{try{const{staticContentServer:n}=e.serviceConfig,i=await importAssetsJson(n);await importConstellationCore(n,i),initCoreConfig(e);const a=async()=>{await importReactRoot(),o&&o(),t(!0)};PCore.getPubSubUtils().subscribe("component-map-loaded",a),await importExternals(i),"ReactRoot"in PCore.getComponentsRegistry().getLazyMap()&&t(!0)}catch(e){n(e)}})),getBootstrapConfig=async(e,o)=>fetch(`${e}/api/application/v2/data_views/D_pxBootstrapConfig`,{method:"GET",headers:new Headers({Authorization:o})}).then((e=>e.json())),loadRootContainer=(e,o=[],t,n)=>(o.push("HybridViewContainer","View"),constellationCore.loadRootComponent(e,rootContainerWithHybrid,o,t,n)),bootstrapWithAuthHeader=async(e,o,t=[],n,i)=>{const{restServerUrl:a,customRendering:r=!1,onPCoreReadyCallback:s,staticContentServerUrl:l,dynamicSetCookie:c=!1,authInfo:C={},theme:p={},renderingMode:d,locale:m}=e;let g,{authorizationHeader:h,appAlias:u}=e;if(h&&0===Object.keys(C).length&&(C.authType="custom"),!h&&C.tokenInfo){const{tokenInfo:e}=C;h=`${e.token_type} ${e.access_token}`}u?(u=-1!==u.indexOf("/")?u:`app/${u}`,g=await getBootstrapConfig(`${a}/${u}`,h)):g=await getBootstrapConfig(`${a}`,h);const f=JSON.parse(g.pyConfigJSON);f.restServerConfig=a,f.dynamicSemanticUrl=!1,f.dynamicSetCookie=c,f.enableRouting=!1,f.serviceConfig.contextPath="",f.serviceConfig.appAlias=u,f.additionalHeaders={Authorization:h},f.dynamicLoadComponents=!r,f.dynamicSemanticUrl=!r,f.noHistory=!0,f.theme=p??{},f.renderingMode=d??f.renderingMode,f.locale=m||f.locale;const w=l||f.serviceConfig.staticContentServer,y=await importAssetsJson(w);if(y.isSdk?await importConstellationCore(l,y):(f.serviceConfig.staticContentServer=w,await importConstellationCore(w,y)),initCoreConfig(f),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,o)=>{try{const o=async()=>{await importReactRoot(),e(!0)};PCore.getPubSubUtils().subscribe("component-map-loaded",o),await importExternals(y),"ReactRoot"in PCore.getComponentsRegistry().getLazyMap()&&e(!0)}catch(e){o(e)}}));await e,await loadRootContainer(o,t,n,i)}},initConstellationCore=async e=>{const o=await importAssetsJson(e);await importConstellationCore(e,o)},loadDefaultPortal=(e,o=[],t)=>{const n=PCore.getEnvironmentInfo().getDefaultPortal();loadPortal(e,n,o,t)},isNewUnifiedBuild=()=>!1,updateLocale=e=>{PCore.getEnvironmentInfo().setLocale(e)};export{bootstrap,loadView,loadPortal,loadDefaultPortal,loadComponent,loadMashup,loadViewByName,loadCase,createCase,loadAssignment,bootstrapWithAuthHeader,initConstellationCore,isNewUnifiedBuild,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: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};
Binary file
Binary file