@pega/constellation-corejs 10.0.0-build.16.4 → 10.0.0-build.16.5

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.
Files changed (42) hide show
  1. package/dist/bootstrap-shell.js +1 -1
  2. package/dist/constellation-corejs.esm.js +8 -8
  3. package/dist/constellation-corejs.global.js +8 -8
  4. package/lib/bootstrap/bootstrap-shell.d.ts.map +1 -1
  5. package/lib/bootstrap/bootstrap-shell.js +6 -4
  6. package/lib/bootstrap/bootstrap-shell.js.map +1 -1
  7. package/lib/bootstrap/bootstrap-utils.d.ts.map +1 -1
  8. package/lib/bootstrap/bootstrap-utils.js +6 -4
  9. package/lib/bootstrap/bootstrap-utils.js.map +1 -1
  10. package/lib/environment-info/index.d.ts +2 -2
  11. package/lib/environment-info/index.js +2 -2
  12. package/lib/environment-info/index.js.map +1 -1
  13. package/lib/initialiser/configurations/index.d.ts +3 -0
  14. package/lib/initialiser/configurations/index.d.ts.map +1 -1
  15. package/lib/initialiser/configurations/index.js +2 -0
  16. package/lib/initialiser/configurations/index.js.map +1 -1
  17. package/lib/initialiser/index.d.ts.map +1 -1
  18. package/lib/initialiser/index.js +4 -1
  19. package/lib/initialiser/index.js.map +1 -1
  20. package/lib/initialiser/init-localization/index.d.ts +5 -1
  21. package/lib/initialiser/init-localization/index.d.ts.map +1 -1
  22. package/lib/initialiser/init-localization/index.js +7 -5
  23. package/lib/initialiser/init-localization/index.js.map +1 -1
  24. package/lib/rest-client/index.d.ts +1 -1
  25. package/lib/rest-client/index.d.ts.map +1 -1
  26. package/lib/rest-client/index.js +3 -2
  27. package/lib/rest-client/index.js.map +1 -1
  28. package/lib/rest-client/types.d.ts +2 -0
  29. package/lib/rest-client/types.d.ts.map +1 -1
  30. package/lib/rest-client/types.js.map +1 -1
  31. package/lib/service_broker/fetch.js +2 -2
  32. package/lib/service_broker/fetch.js.map +1 -1
  33. package/package.json +1 -1
  34. package/src/bootstrap/bootstrap-shell.js +7 -5
  35. package/src/bootstrap/bootstrap-utils.ts +8 -5
  36. package/src/environment-info/index.ts +2 -2
  37. package/src/initialiser/configurations/index.ts +4 -0
  38. package/src/initialiser/index.ts +4 -1
  39. package/src/initialiser/init-localization/index.ts +15 -5
  40. package/src/rest-client/index.ts +3 -2
  41. package/src/rest-client/types.ts +2 -0
  42. package/src/service_broker/fetch.ts +2 -2
@@ -1 +1 @@
1
- const O="@P .viewConfig",k="@ROUTING_INFO",E={type:"RootContainer",config:{renderingMode:"hybrid"},children:[{type:"HybridViewContainer",config:{routingInfo:k,name:"primary",contextName:"app"},children:[]}]},W={type:"RootContainer",config:{renderingMode:"hybrid",acTertiary:!0},children:[{type:"HybridViewContainer",config:{routingInfo:k,name:"primary",contextName:"app",acTertiary:!0},children:[]}]},q=(e,t,o,i,n)=>{const r=new URLSearchParams(t);let l=!1;o==="true"&&(l=!0);let c=null,s=null;if(e){e.startsWith("/")&&(e=e.substring(1));const d=e.split("/");d.length>0&&d[0]&&(c=d[0]),d.length>1&&d[1]&&(s=d[1])}else l=!1;let p=i;c&&(p=`${p}/${c}`),s&&(p=`${p}/${s}`),l&&(r.has("noPortal")||r.append("noPortal",!0),s&&n&&r.append("view",n));const C=r.toString();return p+=C?`?${C}`:"",p};let U=0;const F=(e,t,o=[],i,n,r,l)=>{const s=(l==="hybrid"?`hybrid_${U+=1}`:l)||`mashup${U+=1}`,p={type:"RootContainer",config:{renderingMode:"portal",viewConfig:O,name:s}};globalThis.PCore.getRuntimeParamsAPI().setRuntimeParams(i),PCore.getBootstrapUtils().loadRootComponent(e,p,o,n,r).then(()=>PCore.getBootstrapUtils().updateStoreWithUiRoot(t,s))},H=(e,t,o=[],i)=>{const n=i||`portal${U+=1}`,r={type:"RootContainer",config:{viewConfig:O,renderingMode:"portal",skeleton:"LoadingComponent",name:n}};o.push(r.config.skeleton),PCore.getEnvironmentInfo().isPortalLoaded=!0,PCore.getBootstrapUtils().loadRootComponent(e,r,o).then(()=>PCore.getBootstrapUtils().loadPortalView(t,n))},G=(e,t,o)=>PCore.getBootstrapUtils().loadComponent(t,e,o),J=(e,t,o,i,n,r,l,c)=>{const s=c||`mashup${U+=1}`,p={type:"RootContainer",config:{viewConfig:O,renderingMode:"view",name:s}};PCore.getBootstrapUtils().loadRootComponent(e,p,n,r,l).then(()=>PCore.getBootstrapUtils().loadViewByName(t,o,i,s))},K=(e,t=!0)=>{const o={type:"RootContainer",config:{renderingMode:"noPortal"},children:[{type:"ViewContainer",config:{routingInfo:k,name:"primary"}}]};if(t){const i=document.getElementsByTagName(e)[0]&&document.getElementsByTagName(e)[0].parentNode;if(i){const n=document.createElement("style");n.setAttribute("id","portal-less-styles"),n.innerHTML="app-root.mashup > .case-view, app-root.mashup > .page-view { min-height: 0px !important; }",i.appendChild(n)}}PCore.getBootstrapUtils().loadRootComponent(e,o,[PCore.getConstants().LOAD_VIEW_STRING,"ViewContainer"]),globalThis.parent!==globalThis&&import(`${PCore.getAssetLoader().getStaticServerUrl()}constellation-mashup-bridge.js`).then(i=>{i.mashup.init({resizing:"stretch"})})},z=(e,t,o=[],i,n,r={})=>{const{isCaseLocked:l=!1}=r;o.push(PCore.getConstants().CONTAINER_TYPE.HYBRID,PCore.getConstants().LOAD_VIEW_STRING),PCore.getBootstrapUtils().loadRootComponent(e,E,o,i,n).then(()=>(PCore.getInitialiser().initCoreContainers(),PCore.getBootstrapUtils().getCaseApi().openCase(t,PCore.getConstants().APP.APP,PCore.getConstants().PRIMARY))).then(()=>{l&&PCore.getPubSubUtils().publish(PCore.getEvents().getCaseEvent().CASE_LOCK_EVENT),PCore.getCoexistenceManager().getEventUtils().publishConstellationLoadedEvent()})},Z=(e,t,o=[],i,n)=>{const{caseID:r,caseClass:l}=t;o.push(PCore.getConstants().CONTAINER_TYPE.HYBRID,PCore.getConstants().LOAD_VIEW_STRING),E.config.name="hybrid_preview",PCore.getBootstrapUtils().loadRootComponent(e,E,o,i,n).then(()=>(PCore.getInitialiser().initCoreContainers(),PCore.getCoexistenceManager().showCasePreview(r,l)))},X=(e,t,o=[],i,n)=>{o.push(PCore.getConstants().CONTAINER_TYPE.HYBRID,PCore.getConstants().LOAD_VIEW_STRING),PCore.getBootstrapUtils().loadRootComponent(e,E,o,i,n).then(()=>(PCore.getInitialiser().initCoreContainers(),PCore.getBootstrapUtils().getCaseApi().createCase(t,PCore.getConstants().APP.APP,PCore.getConstants().PRIMARY)))},Q=(e,t,o=[],i,n,{isUIkit:r,isReloadAssignment:l,caseId:c,acTertiary:s,uiKitConstellationCaseInCreateStage:p})=>{if(r){const C=PCore.getEnvironmentInfo().getCoexistenceMeta();C.isCoexistence=!0,C.appType=PCore.getConstants().APP_TYPE.UIKIT,PCore.getEnvironmentInfo().setCoexistenceMeta(C)}if(l)PCore.getBootstrapUtils().loadRootComponent(e,E,o,i,n).then(()=>(PCore.getInitialiser().initCoreContainers(),JSON.parse(p)&&r?PCore.getMashupApi().openCase(c,PCore.getConstants().APP.APP,{pageName:PCore.getConstants().VIEW_TYPE.PY_EMBEDASSIGNMENT}):PCore.getBootstrapUtils().getCaseApi().openCase(c,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,E,o,i,n).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 C=s?W:E;PCore.getBootstrapUtils().loadRootComponent(e,C,o,i,n).then(()=>(PCore.getInitialiser().initCoreContainers(),PCore.getBootstrapUtils().getCaseApi().openAssignment(t,PCore.getConstants().APP.APP,PCore.getConstants().PRIMARY,{acTertiary:s,skipFlowNameCheck:!0}))).then(()=>{PCore.getCoexistenceManager().getEventUtils().publishConstellationLoadedEvent()})}},ee=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")},te=e=>{e.addEventListener("message",async t=>{t?.data?.enableTracer?PCore.getDebugger().enableTracer():PCore.getDebugger().disableTracer()})},_=async e=>{const{serviceConfig:t,semanticUrl:o,queryParams:i,noPortal:n,noHistory:r,viewName:l,theme:c,restServerConfig:s,dynamicLoadComponents:p=!0,dynamicSemanticUrl:C=!0,renderingMode:d="FULL_PORTAL",envType:u,extras:I}=e,{appAlias:P,contextPath:f}=t;let m=globalThis.location.origin;const v={};if(s!==void 0&&(m=s),f&&(m=`${m}${f}`),P&&u!=="LAUNCHPAD"&&(m=`${m}/${P}`),e.restServerConfig=m,C===!0){const g=q(o,i,n,m,l);!r&&g&&globalThis.history.replaceState({},"home",g)}else if(d!=="HYBRID"){let g=globalThis.location.href;g.indexOf("?")>0&&(g=g.substring(0,g.indexOf("?")),globalThis.history.pushState({},"home",g)),v.dynamicSemanticUrl=!1}p!==!0&&(v.dynamicLoadComponents=!1);let h=null;if(P){const g=P.indexOf("/app/");h=g>=0?P.substring(g+1):P}if(Object.keys(v).length>0&&PCore.setBehaviorOverrides(v),e.appAlias=h,c){let g=typeof c=="object"?c:null;if(g===null)try{g=JSON.parse(c)}catch{g={}}e.theme=g}const b=typeof globalThis.location=="object"?globalThis.location:void 0;let y=b?.protocol&&b?.host?`${b.protocol}//${b.host}`:e.routingInfo?.domain;if(d==="EMBED")try{y=new URL(e.restServerConfig).origin}catch{}const N={...e.routingInfo,domain:y,searchParams:b?.search??"",embedQueryParams:e.semanticUrlArgs};e.routingInfo=N,e.noPortal&&(e.noPortal==="true"||e.noPortal===!0)&&e.renderingMode!=="HYBRID"&&(e.renderingMode="EMBED"),e.initBroadcast=PCore.getEnvironmentInfo().environmentInfoObject?.pxMashupDetails?.pyIsTraditionalCoexistence==="true"&&e.renderingMode!=="EMBED",I?.cspNonce&&(globalThis.__webpack_nonce__=I.cspNonce),e.keyMapping&&PCore.getEnvironmentInfo().setKeyMapping(e.keyMapping),await PCore.getInitialiser().init(e)},T=async(e,t)=>{const{isDevServerMode:o,isSdk:i}=t,{prerequisite:n}=t;if(n&&n.length>0){const r=n[0];let l;const c=Object.keys(r)[0];if(o){const s=Object.values(r)[0];l=s.endsWith("/")?`${s}prerequisite/${c}`:`${s}/prerequisite/${c}`}else l=e.endsWith("/")?`${e}prerequisite/${c}`:`${e}/prerequisite/${c}`;if(i){const s=e?.endsWith("/")?e.slice(0,-1):e,p=c.startsWith("/")?c.slice(1):c;l=`${s}/prerequisite/${p}`}return import(l).then(()=>{PCore.getAssetLoader().initServer(e,"no-appstatic");for(let s=1;s<n.length;s+=1){const p=n[s],C=Object.keys(p)[0];o?import(`${Object.values(p)[0]}prerequisite/${C}`).then(u=>{console.log(u)}):import(`${e}prerequisite/${C}`).then(d=>{console.log(d)})}})}return null},x=async e=>{const{isDevServerMode:t}=e;await PCore.getAssetLoader().loadAssets(e.externals,{isDevServerMode:t}),await PCore.getAssetLoader().loadAssets(e.entry,{isDevServerMode:t})},w=async e=>{const t=new Date().getTime();return fetch(`${e}lib_asset.json?v=${t}`).then(o=>o.json())},j=async()=>{const e=[];return PCore.getComponentsRegistry().getComponent("ReactRoot").modules.forEach(t=>{e.push(t())}),Promise.allSettled(e)},oe=async(e,t,o)=>{function i(n,r=!0){return new Promise((l,c)=>{const s=document.createElement("script");s.setAttribute("type","text/javascript"),s.setAttribute("src",n),s.setAttribute("async",r),s.onload=l(),s.onerror=()=>c(new Error("Failed to load resource from Design System")),document.body.appendChild(s)})}try{await i(`${e}component/project/${t}/designsystems/${o}/componentsmap.js?v=${Date.now()}`)}catch(n){console.log(n)}},ne=async(e,t)=>{const o=async(i,n)=>{try{const{staticContentServer:r,appStaticContentServer:l}=e.serviceConfig,{ccV2LibId:c,environmentId:s,isAlternateDesignSystemEnabled:p,alternateDesignSystemName:C}=e,d=await w(r);await T(r,d),await _(e);const u=async()=>{await j(),c&&await PCore.getAssetLoader().importCustomComponentMap(c),p==="true"&&C!=="other"&&await oe(l,s,C),t&&t(),i(!0)};PCore.getPubSubUtils().subscribe("component-map-loaded",u),await x(d),"ReactRoot"in PCore.getComponentsRegistry().getLazyMap()&&i(!0)}catch(r){n(r)}};return new Promise(o)},re=async e=>{if(e.theme&&(!globalThis.pms||globalThis.pms.device.systemName!=="Android"))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({})}if(e.darkTheme&&(!globalThis.pms||globalThis.pms.device.systemName!=="Android"))try{const t=JSON.parse(e.darkTheme.definition);PCore.getEnvironmentInfo().setBrandingInfo(t.Branding,{type:"dark"}),PCore.getEnvironmentInfo().setTheme(t.Theme,{type:"dark"})}catch{PCore.getEnvironmentInfo().setBrandingInfo({},{type:"dark"}),PCore.getEnvironmentInfo().setTheme(void 0,{type:"dark"})}e.keyMapping&&PCore.getEnvironmentInfo().setKeyMapping(e.keyMapping),PCore.getEnvironmentInfo().setCookieComplianceMethod(e.cookieComplianceMethod??"none"),PCore.getEnvironmentInfo().setIsExtraCallRequiredForDefaultHome(e.isExtraCallRequiredForDefaultHome??"false"),PCore.getEnvironmentInfo().setEnablePriorityAndUrgencyImprovements(e.enablePriorityAndUrgencyImprovements??!1)},ie=async(e,t,o,i,n,r)=>{const l={};i&&(l.themeID=i),r&&(l.locale=r);const c=i||r?`?dataViewParameters=${encodeURIComponent(JSON.stringify(l))}`:"",s=`${e}/api/application/v2/data_views/D_pxBootstrapConfig${c}`,p=t?{Authorization:t,...o}:o;return fetch(s,{method:"GET",headers:new Headers(p),credentials:t&&!n?"same-origin":"include"}).then(C=>{if(C.ok)return C.json();throw Error("D_pxBootstrapConfig load failed.",{cause:C.status})})},se=async e=>{const{environmentInfo:t,pyCaseTypeList:o,theme:i,keyMapping:n}=e,{pxApplication:r,features:l,pxLocale:c}=t,s={simpleTable:{pageInstructionUUIDGeneration:!1},...l},p=Intl.DateTimeFormat().resolvedOptions().timeZone.toUpperCase(),C=p==="ETC/UNKNOWN"?"America/New_York":p;e.environmentInfo={...t,pxApplication:{...r},features:s,pyCaseTypeList:o,pxLocale:{...c,pyTimeZone:C}},e.timezone=C;const d=Object.keys(e.environmentInfo);return{isEnvInfoValid:["pxOperator","pxLocale","pxApplication"].every(P=>d.includes(P)),theme:i,keyMapping:n,features:s}},ae=async(e,t,o,i)=>{const n=new Headers({...o,...t&&{Authorization:t}}),r=await fetch(e,{method:"GET",headers:n,credentials:t&&!i?"same-origin":"include"});if(!r.ok)throw new Error("environmentInfo load failed.",{cause:r.status});return r.json()},le=async(e,t,o,i)=>{const{restServerUrl:n,customRendering:r=!1,staticContentServerUrl:l,dynamicSetCookie:c=!1,authInfo:s,renderingMode:p,locale:C,timezone:d="America/New_York",envType:u,theme:I={}}=e,P=i??null,f={restServerUrl:n,restServerConfig:n,dynamicSetCookie:c,enableRouting:!1,serviceConfig:{contextPath:"",appAlias:t,staticContentServer:l,appStaticContentServer:"no-appstatic"},additionalHeaders:{...o},envType:u,dynamicLoadComponents:!r,dynamicSemanticUrl:!r,noHistory:!0,themeIDObj:P,theme:P||I,renderingMode:p,locale:C,timezone:d,tokens:{C11NB2S:""}},m=await w(l);return await T(l,m),await _(f),s&&["OAuth2.0","custom"].includes(s?.authType)&&PCore.getBootstrapUtils().setFetchAuthInfo(s),PCore.getBootstrapUtils().getBootstrapConfigViaSB(t?`${n}/${t}`:`${n}`,o,i)},ce=(e,t=[],o,i)=>(t.push(PCore.getConstants().CONTAINER_TYPE.HYBRID,PCore.getConstants().LOAD_VIEW_STRING),PCore.getBootstrapUtils().loadRootComponent(e,E,t,o,i)),pe=async(e,t,o=[],i,n)=>{const{customRendering:r=!1,onPCoreReadyCallback:l,staticContentServerUrl:c,dynamicSetCookie:s=!1,renderingMode:p,locale:C,envType:d,themeID:u,customCookies:I=!1,enableRouting:P}=e;let{restServerUrl:f,authInfo:m,authorizationHeader:v,appAlias:h,theme:b={}}=e,y=e.additionalHeaders?{...e.additionalHeaders}:{};const N=e.extras?.defaultPortalName;N&&(y={...y,"X-Pega-Portal-Name":N});let g=null;const L=!v&&m&&!m.authType;if(m||(e.authInfo={},m=e.authInfo),(v&&Object.keys(m).length===0||I&&!L&&!m.authType)&&(m.authType="custom"),m.customCookies=I,!v&&m.tokenInfo?.access_token){const{tokenInfo:R}=m;v=`${R.token_type} ${R.access_token}`}if(m.tokenInfo?.csrf&&(y={...y,pzCTkn:m.tokenInfo.csrf}),h&&!h.startsWith("app/")&&(h=`app/${h}`),d==="LAUNCHPAD"){y={...y,"X-Constellation-App":"Pega"},f=f.endsWith("/dx")?f:`${f}/dx`;const R=u?`?themeID=${u}`:"";g=await ae(`${f}/api/application/v2/environmentInfo${R}`,v,y,I),Object.keys(b).length===0&&g.theme?.definition&&(b=JSON.parse(g.theme.definition).Theme)}else L?g=await le(e,h,y,u):g=await ie(h?`${f}/${h}`:`${f}`,v,y,u,I,C);const a=g?.pyConfigJSON?JSON.parse(g.pyConfigJSON):{...g};d==="LAUNCHPAD"&&await se(a),a.restServerConfig=f,a.dynamicSemanticUrl=!1,a.dynamicSetCookie=s,a.enableRouting=!1,d==="LAUNCHPAD"&&e.serviceConfig?a.serviceConfig={...e.serviceConfig,contextPath:"",appAlias:h}:a.serviceConfig?Object.assign(a.serviceConfig,{contextPath:"",appAlias:h}):a.serviceConfig={contextPath:"",appAlias:h,staticContentServer:c,appStaticContentServer:"no-appstatic"},a.additionalHeaders={Authorization:v,...y},a.envType=d,a.dynamicLoadComponents=!r,a.dynamicSemanticUrl=!r,a.noHistory=!0,a.theme=b??{};const V=u&&a?.themeObject?a.themeObject:null;a.theme=V||b,a.renderingMode=p??a.renderingMode,a.locale=C||a.locale,e.semanticUrlArgs&&(a.semanticUrlArgs=e.semanticUrlArgs);const M=c||a.serviceConfig.staticContentServer,S=await w(M);if(S.isSdk?(a.enableRouting=P,a.dynamicSemanticUrl=a.enableRouting,a.environmentInfo||(a.environmentInfo={}),a.environmentInfo.pyExecutionRuntimeName="SDK",await T(c,S)):(a.serviceConfig.staticContentServer=M,a.serviceConfig.appStaticContentServer=a.serviceConfig.appStaticContentServer||"no-appstatic",await T(M,S)),a.renderingMode==="EMBED"&&m?.authentication_service&&m.authentication_service!=="pega"&&(a.routingInfo||(a.routingInfo={}),a.routingInfo.authServiceAlias=m.authentication_service),await _(a),l&&globalThis.PCore.onPCoreReady(l),a.envType==="LAUNCHPAD"&&a.renderingMode==="EMBED"&&PCore.getEnvironmentInfo().setIsWebEmbed(!0),m&&["OAuth2.0","custom"].includes(m?.authType)&&PCore.getBootstrapUtils().setFetchAuthInfo(m),S.isSdk&&r&&await x(S),!r){const R=PCore.getEnvironmentInfo().environmentInfoObject?.pyInfinityStaticService;let D=null;if(R){const A=await PCore.getDataPageUtils().getDataAsync("D_pxGetComponentLibraryListAndMap","",{});Array.isArray(A.data)&&A.data.length>0&&(D=A.data)}const Y=async(A,B)=>{try{const $=async()=>{await j(),A(!0)};PCore.getPubSubUtils().subscribe("component-map-loaded",$),await x(S),"ReactRoot"in PCore.getComponentsRegistry().getLazyMap()&&A(!0)}catch($){B($)}};await new Promise(Y),PCore.getInitialiser().initCoreContainers(),await ce(t,o,i,n),D&&await Promise.all(D.map(({pyComponentMap:A,pxUpdateDateTime:B})=>PCore.getAssetLoader().importCustomComponentMap(A,B)))}},Ce=async e=>{const t=await w(e);await T(e,t)},me=(e,t=[],o)=>{const i=PCore.getEnvironmentInfo().getDefaultPortal();H(e,i,t,o)},ge=()=>!1,de=e=>{PCore.getEnvironmentInfo().setLocale(e)};export{ne as bootstrap,pe as bootstrapWithAuthHeader,X as createCase,Ce as initConstellationCore,ge as isNewUnifiedBuild,Q as loadAssignment,z as loadCase,G as loadComponent,me as loadDefaultPortal,re as loadEnvironmentInfo,K as loadMashup,H as loadPortal,Z as loadPreview,F as loadView,J as loadViewByName,ee as registerForDebugInfo,te as toggleTracerHeaders,de as updateLocale};
1
+ const O="@P .viewConfig",k="@ROUTING_INFO",E={type:"RootContainer",config:{renderingMode:"hybrid"},children:[{type:"HybridViewContainer",config:{routingInfo:k,name:"primary",contextName:"app"},children:[]}]},W={type:"RootContainer",config:{renderingMode:"hybrid",acTertiary:!0},children:[{type:"HybridViewContainer",config:{routingInfo:k,name:"primary",contextName:"app",acTertiary:!0},children:[]}]},q=(e,t,o,s,n)=>{const r=new URLSearchParams(t);let l=!1;o==="true"&&(l=!0);let c=null,i=null;if(e){e.startsWith("/")&&(e=e.substring(1));const d=e.split("/");d.length>0&&d[0]&&(c=d[0]),d.length>1&&d[1]&&(i=d[1])}else l=!1;let p=s;c&&(p=`${p}/${c}`),i&&(p=`${p}/${i}`),l&&(r.has("noPortal")||r.append("noPortal",!0),i&&n&&r.append("view",n));const C=r.toString();return p+=C?`?${C}`:"",p};let U=0;const F=(e,t,o=[],s,n,r,l)=>{const i=(l==="hybrid"?`hybrid_${U+=1}`:l)||`mashup${U+=1}`,p={type:"RootContainer",config:{renderingMode:"portal",viewConfig:O,name:i}};globalThis.PCore.getRuntimeParamsAPI().setRuntimeParams(s),PCore.getBootstrapUtils().loadRootComponent(e,p,o,n,r).then(()=>PCore.getBootstrapUtils().updateStoreWithUiRoot(t,i))},H=(e,t,o=[],s)=>{const n=s||`portal${U+=1}`,r={type:"RootContainer",config:{viewConfig:O,renderingMode:"portal",skeleton:"LoadingComponent",name:n}};o.push(r.config.skeleton),PCore.getEnvironmentInfo().isPortalLoaded=!0,PCore.getBootstrapUtils().loadRootComponent(e,r,o).then(()=>PCore.getBootstrapUtils().loadPortalView(t,n))},G=(e,t,o)=>PCore.getBootstrapUtils().loadComponent(t,e,o),J=(e,t,o,s,n,r,l,c)=>{const i=c||`mashup${U+=1}`,p={type:"RootContainer",config:{viewConfig:O,renderingMode:"view",name:i}};PCore.getBootstrapUtils().loadRootComponent(e,p,n,r,l).then(()=>PCore.getBootstrapUtils().loadViewByName(t,o,s,i))},K=(e,t=!0)=>{const o={type:"RootContainer",config:{renderingMode:"noPortal"},children:[{type:"ViewContainer",config:{routingInfo:k,name:"primary"}}]};if(t){const s=document.getElementsByTagName(e)[0]&&document.getElementsByTagName(e)[0].parentNode;if(s){const n=document.createElement("style");n.setAttribute("id","portal-less-styles"),n.innerHTML="app-root.mashup > .case-view, app-root.mashup > .page-view { min-height: 0px !important; }",s.appendChild(n)}}PCore.getBootstrapUtils().loadRootComponent(e,o,[PCore.getConstants().LOAD_VIEW_STRING,"ViewContainer"]),globalThis.parent!==globalThis&&import(`${PCore.getAssetLoader().getStaticServerUrl()}constellation-mashup-bridge.js`).then(s=>{s.mashup.init({resizing:"stretch"})})},z=(e,t,o=[],s,n,r={})=>{const{isCaseLocked:l=!1}=r;o.push(PCore.getConstants().CONTAINER_TYPE.HYBRID,PCore.getConstants().LOAD_VIEW_STRING),PCore.getBootstrapUtils().loadRootComponent(e,E,o,s,n).then(()=>(PCore.getInitialiser().initCoreContainers(),PCore.getBootstrapUtils().getCaseApi().openCase(t,PCore.getConstants().APP.APP,PCore.getConstants().PRIMARY))).then(()=>{l&&PCore.getPubSubUtils().publish(PCore.getEvents().getCaseEvent().CASE_LOCK_EVENT),PCore.getCoexistenceManager().getEventUtils().publishConstellationLoadedEvent()})},Z=(e,t,o=[],s,n)=>{const{caseID:r,caseClass:l}=t;o.push(PCore.getConstants().CONTAINER_TYPE.HYBRID,PCore.getConstants().LOAD_VIEW_STRING),E.config.name="hybrid_preview",PCore.getBootstrapUtils().loadRootComponent(e,E,o,s,n).then(()=>(PCore.getInitialiser().initCoreContainers(),PCore.getCoexistenceManager().showCasePreview(r,l)))},X=(e,t,o=[],s,n)=>{o.push(PCore.getConstants().CONTAINER_TYPE.HYBRID,PCore.getConstants().LOAD_VIEW_STRING),PCore.getBootstrapUtils().loadRootComponent(e,E,o,s,n).then(()=>(PCore.getInitialiser().initCoreContainers(),PCore.getBootstrapUtils().getCaseApi().createCase(t,PCore.getConstants().APP.APP,PCore.getConstants().PRIMARY)))},Q=(e,t,o=[],s,n,{isUIkit:r,isReloadAssignment:l,caseId:c,acTertiary:i,uiKitConstellationCaseInCreateStage:p})=>{if(r){const C=PCore.getEnvironmentInfo().getCoexistenceMeta();C.isCoexistence=!0,C.appType=PCore.getConstants().APP_TYPE.UIKIT,PCore.getEnvironmentInfo().setCoexistenceMeta(C)}if(l)PCore.getBootstrapUtils().loadRootComponent(e,E,o,s,n).then(()=>(PCore.getInitialiser().initCoreContainers(),JSON.parse(p)&&r?PCore.getMashupApi().openCase(c,PCore.getConstants().APP.APP,{pageName:PCore.getConstants().VIEW_TYPE.PY_EMBEDASSIGNMENT}):PCore.getBootstrapUtils().getCaseApi().openCase(c,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,E,o,s,n).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 C=i?W:E;PCore.getBootstrapUtils().loadRootComponent(e,C,o,s,n).then(()=>(PCore.getInitialiser().initCoreContainers(),PCore.getBootstrapUtils().getCaseApi().openAssignment(t,PCore.getConstants().APP.APP,PCore.getConstants().PRIMARY,{acTertiary:i,skipFlowNameCheck:!0}))).then(()=>{PCore.getCoexistenceManager().getEventUtils().publishConstellationLoadedEvent()})}},ee=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")},te=e=>{e.addEventListener("message",async t=>{t?.data?.enableTracer?PCore.getDebugger().enableTracer():PCore.getDebugger().disableTracer()})},_=async e=>{const{serviceConfig:t,semanticUrl:o,queryParams:s,noPortal:n,noHistory:r,viewName:l,theme:c,restServerConfig:i,dynamicLoadComponents:p=!0,dynamicSemanticUrl:C=!0,renderingMode:d="FULL_PORTAL",envType:u,extras:I}=e,{appAlias:P,contextPath:f}=t;let m=globalThis.location.origin;const v={};if(i!==void 0&&(m=i),f&&(m=`${m}${f}`),P&&u!=="LAUNCHPAD"&&(m=`${m}/${P}`),e.restServerConfig=m,C===!0){const g=q(o,s,n,m,l);!r&&g&&globalThis.history.replaceState({},"home",g)}else if(d!=="HYBRID"){let g=globalThis.location.href;g.indexOf("?")>0&&(g=g.substring(0,g.indexOf("?")),globalThis.history.pushState({},"home",g)),v.dynamicSemanticUrl=!1}p!==!0&&(v.dynamicLoadComponents=!1);let h=null;if(P){const g=P.indexOf("/app/");h=g>=0?P.substring(g+1):P}if(Object.keys(v).length>0&&PCore.setBehaviorOverrides(v),e.appAlias=h,c){let g=typeof c=="object"?c:null;if(g===null)try{g=JSON.parse(c)}catch{g={}}e.theme=g}const b=typeof globalThis.location=="object"?globalThis.location:void 0;let y=b?.protocol&&b?.host?`${b.protocol}//${b.host}`:e.routingInfo?.domain;if(d==="EMBED")try{y=new URL(e.restServerConfig).origin}catch{}const N={...e.routingInfo,domain:y,searchParams:b?.search??"",embedQueryParams:e.semanticUrlArgs};e.routingInfo=N,e.noPortal&&(e.noPortal==="true"||e.noPortal===!0)&&e.renderingMode!=="HYBRID"&&(e.renderingMode="EMBED"),e.initBroadcast=PCore.getEnvironmentInfo().environmentInfoObject?.pxMashupDetails?.pyIsTraditionalCoexistence==="true"&&e.renderingMode!=="EMBED",I?.cspNonce&&(globalThis.__webpack_nonce__=I.cspNonce),e.keyMapping&&PCore.getEnvironmentInfo().setKeyMapping(e.keyMapping),await PCore.getInitialiser().init(e)},T=async(e,t)=>{const{isDevServerMode:o,isSdk:s}=t,{prerequisite:n}=t;if(n&&n.length>0){const r=n[0];let l;const c=Object.keys(r)[0];if(o){const i=Object.values(r)[0];l=i.endsWith("/")?`${i}prerequisite/${c}`:`${i}/prerequisite/${c}`}else l=e.endsWith("/")?`${e}prerequisite/${c}`:`${e}/prerequisite/${c}`;if(s){const i=e?.endsWith("/")?e.slice(0,-1):e,p=c.startsWith("/")?c.slice(1):c;l=`${i}/prerequisite/${p}`}return import(l).then(()=>{PCore.getAssetLoader().initServer(e,"no-appstatic");for(let i=1;i<n.length;i+=1){const p=n[i],C=Object.keys(p)[0];o?import(`${Object.values(p)[0]}prerequisite/${C}`).then(u=>{console.log(u)}):import(`${e}prerequisite/${C}`).then(d=>{console.log(d)})}})}return null},x=async e=>{const{isDevServerMode:t}=e;await PCore.getAssetLoader().loadAssets(e.externals,{isDevServerMode:t}),await PCore.getAssetLoader().loadAssets(e.entry,{isDevServerMode:t})},w=async e=>{const t=new Date().getTime();return fetch(`${e}lib_asset.json?v=${t}`).then(o=>o.json())},j=async()=>{const e=[];return PCore.getComponentsRegistry().getComponent("ReactRoot").modules.forEach(t=>{e.push(t())}),Promise.allSettled(e)},oe=async(e,t,o)=>{function s(n,r=!0){return new Promise((l,c)=>{const i=document.createElement("script");i.setAttribute("type","text/javascript"),i.setAttribute("src",n),i.setAttribute("async",r),i.onload=l(),i.onerror=()=>c(new Error("Failed to load resource from Design System")),document.body.appendChild(i)})}try{await s(`${e}component/project/${t}/designsystems/${o}/componentsmap.js?v=${Date.now()}`)}catch(n){console.log(n)}},ne=async(e,t)=>{const o=async(s,n)=>{try{const{staticContentServer:r,appStaticContentServer:l}=e.serviceConfig,{ccV2LibId:c,environmentId:i,isAlternateDesignSystemEnabled:p,alternateDesignSystemName:C}=e,d=await w(r);await T(r,d),await _(e);const u=async()=>{await j(),c&&await PCore.getAssetLoader().importCustomComponentMap(c),p==="true"&&C!=="other"&&await oe(l,i,C),t&&t(),s(!0)};PCore.getPubSubUtils().subscribe("component-map-loaded",u),await x(d),"ReactRoot"in PCore.getComponentsRegistry().getLazyMap()&&s(!0)}catch(r){n(r)}};return new Promise(o)},re=async e=>{if(e.theme&&(!globalThis.pms||globalThis.pms.device.systemName!=="Android"))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({})}if(e.darkTheme&&(!globalThis.pms||globalThis.pms.device.systemName!=="Android"))try{const t=JSON.parse(e.darkTheme.definition);PCore.getEnvironmentInfo().setBrandingInfo(t.Branding,{type:"dark"}),PCore.getEnvironmentInfo().setTheme(t.Theme,{type:"dark"})}catch{PCore.getEnvironmentInfo().setBrandingInfo({},{type:"dark"}),PCore.getEnvironmentInfo().setTheme(void 0,{type:"dark"})}e.keyMapping&&PCore.getEnvironmentInfo().setKeyMapping(e.keyMapping),PCore.getEnvironmentInfo().setCookieComplianceMethod(e.cookieComplianceMethod??"none"),PCore.getEnvironmentInfo().setIsExtraCallRequiredForDefaultHome(e.isExtraCallRequiredForDefaultHome??"false"),PCore.getEnvironmentInfo().setEnablePriorityAndUrgencyImprovements(e.enablePriorityAndUrgencyImprovements??!1)},se=async(e,t,o,s,n,r)=>{const l={};s&&(l.themeID=s),r&&(l.locale=r);const c=s||r?`?dataViewParameters=${encodeURIComponent(JSON.stringify(l))}`:"",i=`${e}/api/application/v2/data_views/D_pxBootstrapConfig${c}`,p=t?{Authorization:t,...o}:o;return fetch(i,{method:"GET",headers:new Headers(p),credentials:t&&!n?"same-origin":"include"}).then(C=>{if(C.ok)return C.json();throw Error("D_pxBootstrapConfig load failed.",{cause:C.status})})},ie=async e=>{const{environmentInfo:t,pyCaseTypeList:o,theme:s,keyMapping:n}=e,{pxApplication:r,features:l,pxLocale:c}=t,i={simpleTable:{pageInstructionUUIDGeneration:!1},...l},p=Intl.DateTimeFormat().resolvedOptions().timeZone.toUpperCase(),C=p==="ETC/UNKNOWN"?"America/New_York":p;e.environmentInfo={...t,pxApplication:{...r},features:i,pyCaseTypeList:o,pxLocale:{...c,pyTimeZone:C}},e.timezone=C;const d=Object.keys(e.environmentInfo);return{isEnvInfoValid:["pxOperator","pxLocale","pxApplication"].every(P=>d.includes(P)),theme:s,keyMapping:n,features:i}},ae=async(e,t,o,s)=>{const n=new Headers({...o,...t&&{Authorization:t}}),r=await fetch(e,{method:"GET",headers:n,credentials:t&&!s?"same-origin":"include"});if(!r.ok)throw new Error("environmentInfo load failed.",{cause:r.status});return r.json()},le=async(e,t,o,s)=>{const{restServerUrl:n,customRendering:r=!1,staticContentServerUrl:l,dynamicSetCookie:c=!1,authInfo:i,renderingMode:p,locale:C,timezone:d="America/New_York",envType:u,theme:I={}}=e,P=s??null,f={restServerUrl:n,restServerConfig:n,dynamicSetCookie:c,enableRouting:!1,serviceConfig:{contextPath:"",appAlias:t,staticContentServer:l,appStaticContentServer:"no-appstatic"},additionalHeaders:{...o},envType:u,dynamicLoadComponents:!r,dynamicSemanticUrl:!r,noHistory:!0,themeIDObj:P,theme:P||I,renderingMode:p,locale:C,timezone:d,tokens:{C11NB2S:""}},m=await w(l);return await T(l,m),i&&["OAuth2.0","custom"].includes(i?.authType)&&PCore.getBootstrapUtils().setFetchAuthInfo(i),await _(f),PCore.getBootstrapUtils().getBootstrapConfigViaSB(t?`${n}/${t}`:`${n}`,o,s)},ce=(e,t=[],o,s)=>(t.push(PCore.getConstants().CONTAINER_TYPE.HYBRID,PCore.getConstants().LOAD_VIEW_STRING),PCore.getBootstrapUtils().loadRootComponent(e,E,t,o,s)),pe=async(e,t,o=[],s,n)=>{const{customRendering:r=!1,onPCoreReadyCallback:l,staticContentServerUrl:c,dynamicSetCookie:i=!1,renderingMode:p,locale:C,envType:d,themeID:u,customCookies:I=!1,enableRouting:P}=e;let{restServerUrl:f,authInfo:m,authorizationHeader:v,appAlias:h,theme:b={}}=e,y=e.additionalHeaders?{...e.additionalHeaders}:{};const N=e.extras?.defaultPortalName;N&&(y={...y,"X-Pega-Portal-Name":N});let g=null;const L=!v&&m&&!m.authType;if(m||(e.authInfo={},m=e.authInfo),(v&&Object.keys(m).length===0||I&&!L&&!m.authType)&&(m.authType="custom"),m.customCookies=I,!v&&m.tokenInfo?.access_token){const{tokenInfo:R}=m;v=`${R.token_type} ${R.access_token}`}if(m.tokenInfo?.csrf&&(y={...y,pzCTkn:m.tokenInfo.csrf}),h&&!h.startsWith("app/")&&(h=`app/${h}`),d==="LAUNCHPAD"){y={...y,"X-Constellation-App":"Pega"},f=f.endsWith("/dx")?f:`${f}/dx`;const R=u?`?themeID=${u}`:"";g=await ae(`${f}/api/application/v2/environmentInfo${R}`,v,y,I),Object.keys(b).length===0&&g.theme?.definition&&(b=JSON.parse(g.theme.definition).Theme)}else L?g=await le(e,h,y,u):g=await se(h?`${f}/${h}`:`${f}`,v,y,u,I,C);const a=g?.pyConfigJSON?JSON.parse(g.pyConfigJSON):{...g};d==="LAUNCHPAD"&&await ie(a),a.restServerConfig=f,a.dynamicSemanticUrl=!1,a.dynamicSetCookie=i,a.enableRouting=!1,d==="LAUNCHPAD"&&e.serviceConfig?a.serviceConfig={...e.serviceConfig,contextPath:"",appAlias:h}:a.serviceConfig?Object.assign(a.serviceConfig,{contextPath:"",appAlias:h}):a.serviceConfig={contextPath:"",appAlias:h,staticContentServer:c,appStaticContentServer:"no-appstatic"},a.additionalHeaders={Authorization:v,...y},a.customCookies=I,a.envType=d,a.dynamicLoadComponents=!r,a.dynamicSemanticUrl=!r,a.noHistory=!0,a.theme=b??{};const V=u&&a?.themeObject?a.themeObject:null;a.theme=V||b,a.renderingMode=p??a.renderingMode,a.locale=C||a.locale,e.semanticUrlArgs&&(a.semanticUrlArgs=e.semanticUrlArgs);const M=c||a.serviceConfig.staticContentServer,S=await w(M);if(S.isSdk?(a.enableRouting=P,a.dynamicSemanticUrl=a.enableRouting,a.environmentInfo||(a.environmentInfo={}),a.environmentInfo.pyExecutionRuntimeName="SDK",await T(c,S)):(a.serviceConfig.staticContentServer=M,a.serviceConfig.appStaticContentServer=a.serviceConfig.appStaticContentServer||"no-appstatic",await T(M,S)),a.renderingMode==="EMBED"&&m?.authentication_service&&m.authentication_service!=="pega"&&(a.routingInfo||(a.routingInfo={}),a.routingInfo.authServiceAlias=m.authentication_service),m&&["OAuth2.0","custom"].includes(m?.authType)&&PCore.getBootstrapUtils().setFetchAuthInfo(m),await _(a),l&&globalThis.PCore.onPCoreReady(l),a.envType==="LAUNCHPAD"&&a.renderingMode==="EMBED"&&PCore.getEnvironmentInfo().setIsWebEmbed(!0),S.isSdk&&r&&await x(S),!r){const R=PCore.getEnvironmentInfo().environmentInfoObject?.pyInfinityStaticService;let D=null;if(R){const A=await PCore.getDataPageUtils().getDataAsync("D_pxGetComponentLibraryListAndMap","",{});Array.isArray(A.data)&&A.data.length>0&&(D=A.data)}const Y=async(A,B)=>{try{const $=async()=>{await j(),A(!0)};PCore.getPubSubUtils().subscribe("component-map-loaded",$),await x(S),"ReactRoot"in PCore.getComponentsRegistry().getLazyMap()&&A(!0)}catch($){B($)}};await new Promise(Y),PCore.getInitialiser().initCoreContainers(),await ce(t,o,s,n),D&&await Promise.all(D.map(({pyComponentMap:A,pxUpdateDateTime:B})=>PCore.getAssetLoader().importCustomComponentMap(A,B)))}},Ce=async e=>{const t=await w(e);await T(e,t)},me=(e,t=[],o)=>{const s=PCore.getEnvironmentInfo().getDefaultPortal();H(e,s,t,o)},ge=()=>!1,de=e=>{PCore.getEnvironmentInfo().setLocale(e)};export{ne as bootstrap,pe as bootstrapWithAuthHeader,X as createCase,Ce as initConstellationCore,ge as isNewUnifiedBuild,Q as loadAssignment,z as loadCase,G as loadComponent,me as loadDefaultPortal,re as loadEnvironmentInfo,K as loadMashup,H as loadPortal,Z as loadPreview,F as loadView,J as loadViewByName,ee as registerForDebugInfo,te as toggleTracerHeaders,de as updateLocale};