diff --git a/projects/angular-test-app/src/app/_samples/embedded/main-screen/main-screen.component.html b/projects/angular-test-app/src/app/_samples/embedded/main-screen/main-screen.component.html index 43281b5f..4291c5d3 100644 --- a/projects/angular-test-app/src/app/_samples/embedded/main-screen/main-screen.component.html +++ b/projects/angular-test-app/src/app/_samples/embedded/main-screen/main-screen.component.html @@ -10,7 +10,7 @@
-
+
* - required fields
diff --git a/projects/angular-test-app/src/app/_samples/embedded/main-screen/main-screen.component.ts b/projects/angular-test-app/src/app/_samples/embedded/main-screen/main-screen.component.ts index ba68aa08..104cd53e 100644 --- a/projects/angular-test-app/src/app/_samples/embedded/main-screen/main-screen.component.ts +++ b/projects/angular-test-app/src/app/_samples/embedded/main-screen/main-screen.component.ts @@ -14,7 +14,7 @@ import { ComponentMapperComponent } from '../../../../../../../packages/angular- imports: [CommonModule, BundleSwatchComponent, ComponentMapperComponent, ResolutionScreenComponent] }) export class MainScreenComponent implements OnInit, OnDestroy { - @Input() pConn$: typeof PConnect; + @Input() pConn$: typeof PConnect | null; firstConfig$: any; secondConfig$: any; @@ -126,7 +126,27 @@ export class MainScreenComponent implements OnInit, OnDestroy { }); } + openAssignment() { + this.showTriplePlayOptions$ = false; + this.showPega$ = true; + this.scservice.getSdkConfig().then(sdkConfig => { + const mashupAssignmentID = sdkConfig.serverConfig.appMashupAssignmentID; + const options: any = { + pageName: 'pyEmbedAssignment' + }; + PCore.getMashupApi() + .openAssignment(mashupAssignmentID, PCore.getConstants().APP.APP, options) + .then(() => { + console.log('openAssignment rendering is complete'); + }); + }); + } + onShopNow(sLevel: string) { - this.createWork(sLevel); + if (sLevel === 'Basic') { + this.createWork(sLevel); + } else { + this.openAssignment(); + } } } diff --git a/projects/angular-test-app/src/app/_samples/embedded/mc-nav/mc-nav.component.ts b/projects/angular-test-app/src/app/_samples/embedded/mc-nav/mc-nav.component.ts index 0e4bf4e7..1c05be95 100644 --- a/projects/angular-test-app/src/app/_samples/embedded/mc-nav/mc-nav.component.ts +++ b/projects/angular-test-app/src/app/_samples/embedded/mc-nav/mc-nav.component.ts @@ -36,7 +36,7 @@ declare global { }) export class MCNavComponent implements OnInit, OnDestroy { starterPackVersion$: string = endpoints.SP_VERSION; - pConn$: typeof PConnect; + pConn$: typeof PConnect | null; applicationLabel = ''; bLoggedIn$ = false; @@ -67,6 +67,7 @@ export class MCNavComponent implements OnInit, OnDestroy { ngOnDestroy() { this.progressSpinnerSubscription.unsubscribe(); this.resetPConnectSubscription.unsubscribe(); + PCore.getPubSubUtils().unsubscribe(PCore.getConstants().PUB_SUB_EVENTS.EVENT_CANCEL, 'cancelAssignment'); } async initialize() { @@ -100,6 +101,17 @@ export class MCNavComponent implements OnInit, OnDestroy { // Add event listener for when logged in and constellation bootstrap is loaded document.addEventListener('SdkConstellationReady', () => { this.bLoggedIn$ = true; + + PCore.getPubSubUtils().subscribe( + PCore.getConstants().PUB_SUB_EVENTS.EVENT_CANCEL, + () => { + // reset store and start mashup freshely when assignment is cancelled + PCore.resetStore(); + this.pConn$ = null; + this.startMashup(); + }, + 'cancelAssignment' + ); // start the portal this.startMashup(); }); @@ -187,7 +199,7 @@ export class MCNavComponent implements OnInit, OnDestroy { this.pConn$ = props.getPConnect(); - this.pConn$.getContainerManager().initializeContainers({ + this.pConn$?.getContainerManager().initializeContainers({ type: 'multiple', name: 'modal', context: 'app'