@pega/constellationjs 24.1.1 → 24.1.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/LICENSE CHANGED
File without changes
package/README.md CHANGED
@@ -1,55 +1,65 @@
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 used in conjunction with a Pega SDK that needs the correct version of the ConstellationJS files to properly interact with the Constellation UI model first introduced in Pega Infinity 8.6.
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
- In your project's **package.json** dependencies, specify the package name **and**
8
- the **version** of the ConstellationJS files that your project needs.
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
+
9
+ > "@pega/constellationjs": "npm version or tag name"
10
+
11
+ **Note**:
12
+
13
+ - Ensure that you specify the npm version or tag name corresponding to the version of Pega Infinity used in your environment.
14
+ - If you are using Pega Infinity 23.1.1 or later versions, specify the [corresponding npm version](#npm-versions).
15
+ - If you are using Pega Infinity 23.1.0 or earlier versions, specify the [corresponding tag name](#tag-names).
9
16
 
10
17
  For example:
11
18
 
12
- - **"@pega/constellationjs": "24.1.1"** <br>
13
- will get the ConstellationJS files associated with Pega Infinity version 24.1.1
19
+ - If your project requires the ConstellationJS files associated with Pega Infinity 24.2.2, specify
14
20
 
15
- - **"@pega/constellationjs": "23.1.2"** <br>
16
- will get the ConstellationJS files associated with Pega Infinity version 23.1.2
21
+ > "@pega/constellationjs": "24.2.2"
17
22
 
18
- You must **always** use the appropriate Constellation files that match your Infinity deployment. Please check your Infinity version and choose the correct version.
23
+ - If your project requires the ConstellationJS files associated with Pega Infinity 23.1.0, specify
24
+ > "@pega/constellationjs": "SDK-8.23.0"
19
25
 
20
26
  <br>
21
27
 
22
- ## Currently available versions
23
-
24
- The **@pega/constellationjs** package distributes specific versions of the ConstellationJS files using npm versions.
25
-
26
- - v24.1.1 - associated with Infinity 24.1.1
27
- - v24.1.0 - associated with Infinity 24.1.0
28
- - v23.1.2 - associated with Infinity 23.1.2
29
- - v23.1.1 - associated with Infinity 23.1.1
30
- <br><br>
31
-
32
-
33
- For Infinity versions below 23.1.0, use tag names instead of version numbers:
34
- - SDK-8.23.0 (v1.0.39 - associated with Infinity 23.1.0)
35
- - SDK-8.8.4 (v1.0.41)
36
- - SDK-8.8.3 (v1.0.36)
37
- - SDK-8.8.2 (v1.0.34)
38
- - SDK-8.8.1 (v1.0.26)
39
- - SDK-8.8.0 (v1.0.25)
40
- <br><br>
41
-
42
- - SDK-8.7.5 (v1.0.30)
43
- - SDK-8.7.4 (v1.0.18)
44
- - SDK-8.7.3 (v1.0.14)
45
- - SDK-8.7.2 (v1.0.12)
46
- - SDK-8.7.1 (v1.0.10)
47
- - SDK-8.7.0 (v1.0.9)
48
- <br><br>
49
-
50
- - SDK-8.6.5 (v1.0.15)
51
- - SDK-8.6.4 (v1.0.8)
52
- - SDK-8.6.3 (v1.0.7)
53
- - SDK-8.6.2 (v1.0.6)
54
- - SDK-8.6.1 (v1.0.5)
55
- - SDK-8.6.0 (v1.0.4)
28
+ ## npm versions
29
+
30
+ If you are using Pega Infinity 23.1.1 or later, use the corresponding npm version mentioned in the following table:
31
+
32
+ | Pega Infinity version | npm version |
33
+ | --------------------- | ----------- |
34
+ | 24.2.2 | 24.2.2 |
35
+ | 24.2.1 | 24.2.1 |
36
+ | 24.2.0 | 24.2.0 |
37
+ | 24.1.3 | 24.1.3 |
38
+ | 24.1.2 | 24.1.2 |
39
+ | 24.1.1 | 24.1.1 |
40
+ | 24.1.0 | 24.1.0 |
41
+ | 23.1.2 | 23.1.2 |
42
+ | 23.1.1 | 23.1.1 |
43
+
44
+ <br>
45
+
46
+ ## Tag names
47
+
48
+ If you are using Pega Infinity 23.1.0 or earlier, use the corresponding tag name mentioned in the following table:
49
+
50
+ | Pega Infinity version | Tag name |
51
+ | --------------------- | ---------- |
52
+ | 23.1.0 | SDK-8.23.0 |
53
+ | 8.8.4 | SDK-8.8.4 |
54
+ | 8.8.3 | SDK-8.8.3 |
55
+ | 8.8.2 | SDK-8.8.2 |
56
+ | 8.8.1 | SDK-8.8.1 |
57
+ | 8.8.0 | SDK-8.8.0 |
58
+ | 8.7.5 | SDK-8.7.5 |
59
+ | 8.7.4 | SDK-8.7.4 |
60
+ | 8.7.3 | SDK-8.7.3 |
61
+ | 8.7.2 | SDK-8.7.2 |
62
+ | 8.7.1 | SDK-8.7.1 |
63
+ | 8.7.0 | SDK-8.7.0 |
64
+
65
+ <br><br>
package/SECURITY.md CHANGED
File without changes
package/dist/README.md CHANGED
@@ -1,55 +1,60 @@
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 used in conjunction with a Pega SDK that needs the correct version of the ConstellationJS files to properly interact with the Constellation UI model first introduced in Pega Infinity 8.6.
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
- In your project's **package.json** dependencies, specify the package name **and**
8
- the **version** of the ConstellationJS files that your project needs.
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
- - **"@pega/constellationjs": "24.1.1"** <br>
13
- will get the ConstellationJS files associated with Pega Infinity version 24.1.1
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.2"** <br>
16
- will get the ConstellationJS files associated with Pega Infinity version 23.1.2
17
16
 
18
- You must **always** use the appropriate Constellation files that match your Infinity deployment. Please check your Infinity version and choose the correct version.
17
+ For example:
18
+ - If your project requires the ConstellationJS files associated with Pega Infinity 24.2.0, specify
19
+ >"@pega/constellationjs": "24.2.0"
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.0 | 24.2.0 |
34
+ | 24.1.2 | 24.1.2 |
35
+ | 24.1.1 | 24.1.1 |
36
+ | 24.1.0 | 24.1.0 |
37
+ | 23.1.2 | 23.1.2 |
38
+ | 23.1.1 | 23.1.1 |
19
39
 
20
40
  <br>
21
41
 
22
- ## Currently available versions
23
-
24
- The **@pega/constellationjs** package distributes specific versions of the ConstellationJS files using npm versions.
25
-
26
- - v24.1.1 - associated with Infinity 24.1.1
27
- - v24.1.0 - associated with Infinity 24.1.0
28
- - v23.1.2 - associated with Infinity 23.1.2
29
- - v23.1.1 - associated with Infinity 23.1.1
30
- <br><br>
31
-
32
-
33
- For Infinity versions below 23.1.0, use tag names instead of version numbers:
34
- - SDK-8.23.0 (v1.0.39 - associated with Infinity 23.1.0)
35
- - SDK-8.8.4 (v1.0.41)
36
- - SDK-8.8.3 (v1.0.36)
37
- - SDK-8.8.2 (v1.0.34)
38
- - SDK-8.8.1 (v1.0.26)
39
- - SDK-8.8.0 (v1.0.25)
40
- <br><br>
41
-
42
- - SDK-8.7.5 (v1.0.30)
43
- - SDK-8.7.4 (v1.0.18)
44
- - SDK-8.7.3 (v1.0.14)
45
- - SDK-8.7.2 (v1.0.12)
46
- - SDK-8.7.1 (v1.0.10)
47
- - SDK-8.7.0 (v1.0.9)
48
- <br><br>
49
-
50
- - SDK-8.6.5 (v1.0.15)
51
- - SDK-8.6.4 (v1.0.8)
52
- - SDK-8.6.3 (v1.0.7)
53
- - SDK-8.6.2 (v1.0.6)
54
- - SDK-8.6.1 (v1.0.5)
55
- - SDK-8.6.0 (v1.0.4)
42
+ ## Tag names
43
+ If you are using Pega Infinity 23.1.0 or earlier, use the corresponding tag name mentioned in the following table:
44
+
45
+ | Pega Infinity version | Tag name |
46
+ |-----------------------|-------------|
47
+ | 23.1.0 | SDK-8.23.0 |
48
+ | 8.8.4 | SDK-8.8.4 |
49
+ | 8.8.3 | SDK-8.8.3 |
50
+ | 8.8.2 | SDK-8.8.2 |
51
+ | 8.8.1 | SDK-8.8.1 |
52
+ | 8.8.0 | SDK-8.8.0 |
53
+ | 8.7.5 | SDK-8.7.5 |
54
+ | 8.7.4 | SDK-8.7.4 |
55
+ | 8.7.3 | SDK-8.7.3 |
56
+ | 8.7.2 | SDK-8.7.2 |
57
+ | 8.7.1 | SDK-8.7.1 |
58
+ | 8.7.0 | SDK-8.7.0 |
59
+
60
+ <br><br>
@@ -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 r=new URLSearchParams(t);let a=!1;"true"===o&&(a=!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 a=!1;let C=n;s&&(C=`${C}/${s}`),l&&(C=`${C}/${l}`),a&&(!r.has("noPortal")&&r.append("noPortal",!0),l&&i&&r.append("view",i));const c=r.toString();return C+=c?`?${c}`:"",C};let containerCount=0;const loadView=(e,t,o=[],n,i,r,a)=>{const s=("hybrid"===a?"hybrid_"+ ++containerCount:a)||"mashup"+ ++containerCount,l={type:"RootContainer",config:{renderingMode:"portal",viewConfig,name:s}};window.PCore.getRuntimeParamsAPI().setRuntimeParams(n),PCore.getBootstrapUtils().loadRootComponent(e,l,o,i,r).then((()=>PCore.getBootstrapUtils().updateStoreWithUiRoot(t,s)))},loadPortal=(e,t,o=[],n)=>{const i=n||"portal"+ ++containerCount,r={type:"RootContainer",config:{viewConfig,renderingMode:"portal",skeleton:"LoadingComponent",name:i}};o.push(r.config.skeleton),PCore.getEnvironmentInfo().isPortalLoaded=!0,PCore.getBootstrapUtils().loadRootComponent(e,r,o).then((()=>PCore.getBootstrapUtils().loadPortalView(t,i)))},loadComponent=(e,t,o)=>PCore.getBootstrapUtils().loadComponent(t,e,o),loadViewByName=(e,t,o,n,i,r,a,s)=>{const l=s||"mashup"+ ++containerCount,C={type:"RootContainer",config:{viewConfig,renderingMode:"view",name:l}};PCore.getBootstrapUtils().loadRootComponent(e,C,i,r,a).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,r={})=>{const{isCaseLocked:a=!1}=r;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((()=>{a&&PCore.getPubSubUtils().publish(PCore.getEvents().getCaseEvent().CASE_LOCK_EVENT),PCore.getCoexistenceManager().getEventUtils().publishConstellationLoadedEvent()}))},loadPreview=(e,t,o=[],n,i)=>{const{caseID:r,caseClass:a}=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(r,a))))},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:r,isReloadAssignment:a,caseId:s,acTertiary:l,uiKitConstellationCaseInCreateStage:C})=>{if(r){const e=PCore.getEnvironmentInfo().getCoexistenceMeta();e.isCoexistence=!0,e.appType=PCore.getConstants().APP_TYPE.UIKIT,PCore.getEnvironmentInfo().setCoexistenceMeta(e)}if(a)PCore.getBootstrapUtils().loadRootComponent(e,rootContainerWithHybrid,o,n,i).then((()=>(PCore.getInitialiser().initCoreContainers(),JSON.parse(C)&&r?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),r)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 r=l?rootContainerWithHybridAcTertiary:rootContainerWithHybrid;PCore.getBootstrapUtils().loadRootComponent(e,r,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{routingInfo:t,actionModel:o,serviceConfig:n,additionalHeaders:i,tokens:r,semanticUrl:a,queryParams:s,noPortal:l,timezone:C,noHistory:c,viewName:g,theme:p,fieldDefaults:d,restServerConfig:m,dynamicLoadComponents:P=!0,dynamicSemanticUrl:u=!0,enableRouting:h=!0,locale:f,environmentInfo:y,renderingMode:I="FULL_PORTAL",remoteCaseMapping:v={},envType:w}=e,{appAlias:E,googleMapKey:A,staticContentServer:b,appStaticContentServer:R=null,contextPath:S,messagingService:U=null,reAuthUrl:M=null}=n;let T=location.origin;const B={};if(void 0!==m&&(T=m),S&&(T=`${T}${S}`),E&&"LAUNCHPAD"!==w&&(T=`${T}/${E}`),e.restServerConfig=T,!0===u){const e=buildSemanticUrl(a,s,l,T,g);!c&&e&&history.pushState({},"home",e)}else if("HYBRID"!==I){let e=window.location.href;e.indexOf("?")>0&&(e=e.substring(0,e.indexOf("?")),history.pushState({},"home",e)),B.dynamicSemanticUrl=!1}!0!==P&&(B.dynamicLoadComponents=!1);let N=null;if(E){const e=E.indexOf("/app/");N=e>=0?E.substring(e+1):E}if(Object.keys(B).length>0&&PCore.setBehaviorOverrides(B),e.appAlias=N,p){let t="object"==typeof p?p:null;if(null===t)try{t=JSON.parse(p)}catch{t={}}e.theme=t}const D={...t,domain:`${window.location.protocol}//${window.location.host}`,searchParams:window.location.search};e.routingInfo=D,e.initBroadcast="true"===PCore.getEnvironmentInfo().environmentInfoObject?.pxMashupDetails?.pyIsTraditionalCoexistence,!e.noPortal||"true"!==e.noPortal&&!0!==e.noPortal||(e.renderingMode="EMBED"),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 r;const a=Object.keys(t)[0];if(o){const e=Object.values(t)[0];r=e.endsWith("/")?`${e}prerequisite/${a}`:`${e}/prerequisite/${a}`}else r=e.endsWith("/")?`${e}prerequisite/${a}`:`${e}/prerequisite/${a}`;return n&&(r=`${e?.endsWith("/")?e.slice(0,-1):e}/prerequisite/${a.startsWith("/")?a.slice(1):a}`),import(r).then((t=>{PCore.getAssetLoader().initServer(e,"no-appstatic");for(let t=1;t<i.length;t+=1){const n=i[t],r=Object.keys(n)[0];if(o){const e=Object.values(n)[0];import(`${e}prerequisite/${r}`).then((e=>{console.log(e)}))}else import(`${e}prerequisite/${r}`).then((e=>{console.log(e)}))}}))}return null},importExternals=async e=>{const{isDevServerMode:t}=e,o=PCore.getEnvironmentInfo().getLocale();if("en-US"!==o)try{const e=[PCore.getLocaleUtils().GENERIC_BUNDLE_KEY,PCore.getLocaleUtils().MESSAGE_BUNDLE_KEY].map((async e=>{const t=await PCore.getAssetLoader().getSvcLocale(o,`${e}.json`);if(t.ok){const o=await t.json();PCore.getLocaleUtils().setLocaleForRule(o,e)}}));await Promise.allSettled(e)}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:r,environmentId:a,isAlternateDesignSystemEnabled:s,alternateDesignSystemName:l}=e,C=await importAssetsJson(n);await importConstellationCore(n,C),initCoreConfig(e);const c=async()=>{await importReactRoot(),r&&await PCore.getAssetLoader().importCustomComponentMap(r),"true"===s&&"other"!==l&&await importDesignSystemComponentMap(i,a,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),PCore.getEnvironmentInfo().setCookieComplianceMethod(e.cookieComplianceMethod??"none")},getBootstrapConfig=async(e,t)=>fetch(`${e}/api/application/v2/data_views/D_pxBootstrapConfig`,{method:"GET",headers:new Headers({Authorization:t})}).then((e=>{if(e.ok)return e.json();throw Error("D_pxBootstrapConfig load failed.",{cause:e.status})})),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{restServerUrl:r,customRendering:a=!1,onPCoreReadyCallback:s,staticContentServerUrl:l,dynamicSetCookie:C=!1,authInfo:c={},theme:g={},renderingMode:p,locale:d}=e;let m,{authorizationHeader:P,appAlias:u}=e;if(P&&0===Object.keys(c).length&&(c.authType="custom"),!P&&c.tokenInfo){const{tokenInfo:e}=c;P=`${e.token_type} ${e.access_token}`}u?(u=-1!==u.indexOf("/")?u:`app/${u}`,m=await getBootstrapConfig(`${r}/${u}`,P)):m=await getBootstrapConfig(`${r}`,P);const h=JSON.parse(m.pyConfigJSON);h.restServerConfig=r,h.dynamicSemanticUrl=!1,h.dynamicSetCookie=C,h.enableRouting=!1,h.serviceConfig.contextPath="",h.serviceConfig.appAlias=u,h.additionalHeaders={Authorization:P},h.dynamicLoadComponents=!a,h.dynamicSemanticUrl=!a,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)&&PCore.getBootstrapUtils().setFetchAuthInfo(c),y.isSdk&&a&&await importExternals(y),!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(y),"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};
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 r=new URLSearchParams(t);let a=!1;"true"===o&&(a=!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 a=!1;let C=n;s&&(C=`${C}/${s}`),l&&(C=`${C}/${l}`),a&&(!r.has("noPortal")&&r.append("noPortal",!0),l&&i&&r.append("view",i));const c=r.toString();return C+=c?`?${c}`:"",C};let containerCount=0;const loadView=(e,t,o=[],n,i,r,a)=>{const s=("hybrid"===a?"hybrid_"+ ++containerCount:a)||"mashup"+ ++containerCount,l={type:"RootContainer",config:{renderingMode:"portal",viewConfig,name:s}};window.PCore.getRuntimeParamsAPI().setRuntimeParams(n),PCore.getBootstrapUtils().loadRootComponent(e,l,o,i,r).then((()=>PCore.getBootstrapUtils().updateStoreWithUiRoot(t,s)))},loadPortal=(e,t,o=[],n)=>{const i=n||"portal"+ ++containerCount,r={type:"RootContainer",config:{viewConfig,renderingMode:"portal",skeleton:"LoadingComponent",name:i}};o.push(r.config.skeleton),PCore.getEnvironmentInfo().isPortalLoaded=!0,PCore.getBootstrapUtils().loadRootComponent(e,r,o).then((()=>PCore.getBootstrapUtils().loadPortalView(t,i)))},loadComponent=(e,t,o)=>PCore.getBootstrapUtils().loadComponent(t,e,o),loadViewByName=(e,t,o,n,i,r,a,s)=>{const l=s||"mashup"+ ++containerCount,C={type:"RootContainer",config:{viewConfig,renderingMode:"view",name:l}};PCore.getBootstrapUtils().loadRootComponent(e,C,i,r,a).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,r={})=>{const{isCaseLocked:a=!1}=r;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((()=>{a&&PCore.getPubSubUtils().publish(PCore.getEvents().getCaseEvent().CASE_LOCK_EVENT),PCore.getCoexistenceManager().getEventUtils().publishConstellationLoadedEvent()}))},loadPreview=(e,t,o=[],n,i)=>{const{caseID:r,caseClass:a}=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(r,a))))},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:r,isReloadAssignment:a,caseId:s,acTertiary:l,uiKitConstellationCaseInCreateStage:C})=>{if(r){const e=PCore.getEnvironmentInfo().getCoexistenceMeta();e.isCoexistence=!0,e.appType=PCore.getConstants().APP_TYPE.UIKIT,PCore.getEnvironmentInfo().setCoexistenceMeta(e)}if(a)PCore.getBootstrapUtils().loadRootComponent(e,rootContainerWithHybrid,o,n,i).then((()=>(PCore.getInitialiser().initCoreContainers(),JSON.parse(C)&&r?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),r)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 r=l?rootContainerWithHybridAcTertiary:rootContainerWithHybrid;PCore.getBootstrapUtils().loadRootComponent(e,r,o,n,i).then((()=>(PCore.getInitialiser().initCoreContainers(),PCore.getBootstrapUtils().getCaseApi().openAssignment(t,PCore.getConstants().APP.APP,PCore.getConstants().PRIMARY,{acTertiary:l,skipFlowNameCheck:!0})))).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:r,semanticUrl:a,queryParams:s,noPortal:l,timezone:C,noHistory:c,viewName:g,theme:p,fieldDefaults:d,restServerConfig:m,dynamicLoadComponents:P=!0,dynamicSemanticUrl:u=!0,enableRouting:h=!0,locale:f,environmentInfo:y,renderingMode:I="FULL_PORTAL",remoteCaseMapping:w={},envType:v,extras:E}=e,{appAlias:A,googleMapKey:b,staticContentServer:R,appStaticContentServer:S=null,contextPath:M,messagingService:U=null,reAuthUrl:N=null}=n;let B=location.origin;const T={};if(void 0!==m&&(B=m),M&&(B=`${B}${M}`),A&&"LAUNCHPAD"!==v&&(B=`${B}/${A}`),e.restServerConfig=B,!0===u){const e=buildSemanticUrl(a,s,l,B,g);!c&&e&&history.pushState({},"home",e)}else if("HYBRID"!==I){let e=window.location.href;e.indexOf("?")>0&&(e=e.substring(0,e.indexOf("?")),history.pushState({},"home",e)),T.dynamicSemanticUrl=!1}!0!==P&&(T.dynamicLoadComponents=!1);let D=null;if(A){const e=A.indexOf("/app/");D=e>=0?A.substring(e+1):A}if(Object.keys(T).length>0&&PCore.setBehaviorOverrides(T),E?.cspNonce&&(window.__webpack_nonce__=E.cspNonce),e.appAlias=D,p){let t="object"==typeof p?p:null;if(null===t)try{t=JSON.parse(p)}catch{t={}}e.theme=t}const L={...t,domain:`${window.location.protocol}//${window.location.host}`,searchParams:window.location.search};e.routingInfo=L,e.initBroadcast="true"===PCore.getEnvironmentInfo().environmentInfoObject?.pxMashupDetails?.pyIsTraditionalCoexistence,!e.noPortal||"true"!==e.noPortal&&!0!==e.noPortal||"HYBRID"===e.renderingMode||(e.renderingMode="EMBED"),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 r;const a=Object.keys(t)[0];if(o){const e=Object.values(t)[0];r=e.endsWith("/")?`${e}prerequisite/${a}`:`${e}/prerequisite/${a}`}else r=e.endsWith("/")?`${e}prerequisite/${a}`:`${e}/prerequisite/${a}`;return n&&(r=`${e?.endsWith("/")?e.slice(0,-1):e}/prerequisite/${a.startsWith("/")?a.slice(1):a}`),import(r).then((t=>{PCore.getAssetLoader().initServer(e,"no-appstatic");for(let t=1;t<i.length;t+=1){const n=i[t],r=Object.keys(n)[0];if(o){const e=Object.values(n)[0];import(`${e}prerequisite/${r}`).then((e=>{console.log(e)}))}else import(`${e}prerequisite/${r}`).then((e=>{console.log(e)}))}}))}return null},importExternals=async e=>{const{isDevServerMode:t}=e,o=PCore.getEnvironmentInfo().getLocale();if("en-US"!==o)try{const e=[PCore.getLocaleUtils().GENERIC_BUNDLE_KEY,PCore.getLocaleUtils().MESSAGE_BUNDLE_KEY].map((async e=>{const t=await PCore.getAssetLoader().getSvcLocale(o,`${e}.json`);if(t.ok){const o=await t.json();PCore.getLocaleUtils().setLocaleForRule(o,e)}}));await Promise.allSettled(e)}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:r,environmentId:a,isAlternateDesignSystemEnabled:s,alternateDesignSystemName:l}=e,C=await importAssetsJson(n);await importConstellationCore(n,C),initCoreConfig(e);const c=async()=>{await importReactRoot(),r&&await PCore.getAssetLoader().importCustomComponentMap(r),"true"===s&&"other"!==l&&await importDesignSystemComponentMap(i,a,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),PCore.getEnvironmentInfo().setCookieComplianceMethod(e.cookieComplianceMethod??"none")},getBootstrapConfig=async(e,t)=>fetch(`${e}/api/application/v2/data_views/D_pxBootstrapConfig`,{method:"GET",headers:new Headers({Authorization:t})}).then((e=>{if(e.ok)return e.json();throw Error("D_pxBootstrapConfig load failed.",{cause:e.status})})),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{restServerUrl:r,customRendering:a=!1,onPCoreReadyCallback:s,staticContentServerUrl:l,dynamicSetCookie:C=!1,authInfo:c={},theme:g={},renderingMode:p,locale:d}=e;let m,{authorizationHeader:P,appAlias:u}=e;if(P&&0===Object.keys(c).length&&(c.authType="custom"),!P&&c.tokenInfo){const{tokenInfo:e}=c;P=`${e.token_type} ${e.access_token}`}u?(u=-1!==u.indexOf("/")?u:`app/${u}`,m=await getBootstrapConfig(`${r}/${u}`,P)):m=await getBootstrapConfig(`${r}`,P);const h=JSON.parse(m.pyConfigJSON);h.restServerConfig=r,h.dynamicSemanticUrl=!1,h.dynamicSetCookie=C,h.enableRouting=!1,h.serviceConfig.contextPath="",h.serviceConfig.appAlias=u,h.additionalHeaders={Authorization:P},h.dynamicLoadComponents=!a,h.dynamicSemanticUrl=!a,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)&&PCore.getBootstrapUtils().setFetchAuthInfo(c),y.isSdk&&a&&await importExternals(y),!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(y),"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