cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Using complex components in SCCO Quick Service

RicardoRenteria
Participant
0 Kudos
592

Hi guys,

I was checking some development workshops in which are using a class named cco.BasicPluginComponent for creation of "complex" components inside SCCO screen.

When I run SCCO with the plugin, I got the following error in the console:

I'm using FP09 and the plugin looks like this: (It's an example provided by SAP):

class PluginComponent6 extends cco.BasicPluginComponent {
    constructor(pluginServiceImpl, cdr) {
        super(pluginServiceImpl, cdr);       
        this.init();
    }
    handleEvent(event) {    
    switch(event.getType()) {
    case 'YT':
     //If event YT is received, take the media id from the payload and update the iframSrc field
     this.iframeSrc = 'https://www.youtube.com/embed/' + event.getPayload() + "?mute=1&autoplay=1";
     //Change detection has to be triggered manually
     this.cdr.detectChanges();
     break;
    case 'YT_MEDIA_ID':
     //This event will display a popup to enter the media id
     this.getMediaId();
     break;
}
    }
    init() {    

    this.iframeSrc = '';

    //Get the event bus from the context
    const eventBus = this.getPluginService().getContextInstance("EventBus");
    //Subscribe to the event bus    
    eventBus.subscribe(this);

    this.eventBus = eventBus;
    }
    getMediaId() {

    //Display a generic input popup with one input field to get the media id
    const mediaInputModel = new cco.InputModel();

     this.eventBus.push('SHOW_GENERIC_INPUT', {
             'configuration': [
                 new cco.GenericInputConfiguration('Youtube Media Id', '0', 'Input', mediaInputModel, null)
             ],
             'title': 'Enter youtube media id',
             'callback': (positive) => {
                 if (positive) {
                 //If user clicked the OK button, fire the YT event with the media id entered
                 this.eventBus.push('YT', mediaInputModel.getValue());
                 } 
             }
         });
    }
    ngOnDestroy() {
    //When the component was destroyed it has to be removed as event bus subscriber
    const eventBus = this.getPluginService().getContextInstance("EventBus");       
    eventBus.unsubscribe(this);
    }
}
Plugin.MyPlugin6 = class MyPlugin6 {
    constructor(pluginService, eventBus) {
    this.pluginService = pluginService;
        this.eventBus = eventBus;
    this.init();
    }
    init() {

    }
    getDynamicComponents() {
    //The method is called by the plugin framework. All custom components have to be returned.
        return [{        
        //Class of the component
            class: PluginComponent6, 
            //Component options. Will contain e.g. the template
            options: {template: '<div [style.width.px]="width" [style.height.px]="height"><iframe width="100%" height="100%" [src]="iframeSrc | urlSanitizer" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe></div>'}
        }];
    }
};

According the error message, it seems to be something wrong with the class cco.BasicPluginComponent

Any suggestions?

Thanks a lot.

Accepted Solutions (0)

Answers (2)

Answers (2)

JoergAldinger
Active Contributor
0 Kudos

We have also been trying to get the Youtube workshop example to work in FP10, FP11 and FP12 with no success. Something must have changed, probably in FP09.

Have you managed to get it working ricardo.renteria2 ?

Thanks,

Joerg.

RicardoRenteria
Participant
0 Kudos

Hello joerg.ceo

the workshop never work for me, so I can´t help you 😞

JoergAldinger
Active Contributor
0 Kudos

Thank you for confirming ricardo.renteria2 .

elena.vavitsa would you mind assigning this to somebody on the team who could assist us?

Or maybe rzieschang (the one who knows it all ☺) can help us out?

Thanks and best regards!

Joerg.

R_Zieschang
Contributor
0 Kudos

Hi joerg.ceo , Hi ricardo.renteria2,

there was no change in CCOs coding introduced after FP10 but the Angular version changed. FP09 was running with Angular 8.3. Current version (FP12) is Angular 11.1.2. With this update there were some necessary changes to the JIT compilation (just-in-time). Therefore it is currently not possible to implement your own Components.

Regards

Robert

JoergAldinger
Active Contributor
0 Kudos

Thank you for the information rzieschang .

I have submitted an improvement request to see if we can get that functionality back, since we need it for several reasons. Here is the link: Improvement Request Details - Customer Influence (sap.com)

Please make sure to vote, ricardo.renteria2 🙂.

Best regards,

Joerg.

R_Zieschang
Contributor
0 Kudos

Dear ricardo.renteria2,

what line in your code is line 28, because this is mentioned in the stacktrace.
If you have more than one plugin running, than please check in the developer console of chrome -> sources what line 28 is.

Regards

Robert

RicardoRenteria
Participant
0 Kudos

Hello rzieschang

the line 28 is the first one of the plugin:

class PluginComponent6 extends cco.BasicPluginComponent {

This plugin was running in FP08 as Marco showed us at the development training, but I don't know if in FP09 there are any change that maybe affect it.

What do you think?