on 2021 Feb 17 10:58 PM
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.
Request clarification before answering.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
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.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
| User | Count |
|---|---|
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.