In shopware 6 there is this B2B plugin that delivers javascript functionality to the storefront in form of typescript plugin files. These typescript plugins are extremely similar to the regular js plugins in storefront.
This is an example of a filename of a ts plugin of the B2B suite: order-list-new-positions.plugin.ts
.
And this is an example of a typescript plugin class definition:
...
interface Endpoints {
productName: string,
unitPrice: string,
create: string,
}
@EventInterface
export default class OrderListNewPositionsPlugin extends window.PluginBaseClass {
public static options = {
SELECTOR_ROW: '.new-line-item__row',
SELECTOR_ROWS: '.new-line-item__rows',
...
So, I try to perform an override on some of the functions on these typescript plugins. The only relevant resource I found on this is here. In the Javascript section they say typescript plugins can be overriden in two ways:
Like in this code snippet here. I tried this and it doesn't work because the plugins just don't exist in the scope of the jquery object. I called the plugins as like $.orderlistMultiEdit
, $.orderListMultiEdit
, $.orderlistMultiEditPlugin
, $.orderListMultiEditPlugin
. The plugins are just not registered in the jquery object it seems.
The second option is to try and override them as the regular storefront plugin classes. var OrderlistMultiEditPlugin = require("/var/www/html/custom/plugins/SwagB2bPlatform/SwagB2bPlatform/Resources/app/storefront/src/js/plugins/orderlist-multi-edit.plugin.ts");
. Of course this fails and we get syntax errors. Even though (in 2020) they said it will be possible to override these classes as we override shopware storefront js classes. Maybe I can modify the build storefront script to be able to import and process ts files, but it feels wrong.
Thus, the question is: does anyone know how to override b2b storefront ts plugins ? Did anyone have this problem ? Is there a workaround ?
Final answer: it seems this is a known issue, but we don't have much hope of getting a fix anytime soon.