Not able to use: driver.activateApp() or driver.launchApp()

How can i switch from one app to another? I have tried a couple of solutions however, i am not able to find a solution for appium with webdriverio(javascript) anywhere on the internet

I tried adding this in the config:

const { join } = require('path');
require('@babel/register')

exports.config = {
    runner: 'local',

    maxInstances: 2,
    //
    specs: [
        './tests/App/specs//test.spec.js'
    ],
    //
    exclude: [
        // 'path/to/excluded/files'
    ],
    //
    //
    baseUrl: 'http://localhost:9174/',

    capabilities: {


        consumerApp: {
            port: 4723,
            capabilities: {
                platformName: 'iOS',
                'appium:platformVersion': '12.4',
                'appium:orientation': 'PORTRAIT',
                'appium:noReset': false,
                'appium:newCommandTimeout': 240,
                "appium:platformName": "iOS",
                "appium:deviceName": "iPhone 8",
                "appium:bundleId": "com.app",
            }
        },

        shopfloorApp: {
            port: 4723,
            capabilities: {
                platformName: 'iOS',
                'appium:platformVersion': '12.4',
                'appium:orientation': 'PORTRAIT',
                'appium:noReset': false,
                'appium:newCommandTimeout': 240,
                "appium:platformName": "iOS",
                "appium:deviceName": "iPhone 8",
                "appium:bundleId": "com.app2",
            }
        },
    },

    services: ['appium'],
    /* appium: {

        args: {
            address: '127.0.0.1',
        }
    }, */

    //
    //logLevel: 'trace',
    //
    //deprecationWarnings: true,
    //
    //bail: 0,
    //
    waitforTimeout: 20000,
    //
    connectionRetryTimeout: 90000,
    //
    connectionRetryCount: 3,
    //
    services: ['selenium-standalone'],
    //
    framework: 'jasmine',
    jasmineNodeOpts: 
    {   
    // Jasmine default timeout
    defaultTimeoutInterval: 90000,
    expectationResultHandler(passed, assertion) 
    {
      // do something
    }
}
    //
    //
}

and used like this in my test:

describe('Sending the recommendaton to the customer,', () => {

    beforeEach(() => {
        ShopfloorCommonPage.login()
        ConsumerCommonPage.login()
    });

    afterEach(() => {
        ConsumerCommonPage.login()
        ShopfloorCommonPage.logout()
    });

    it('should be able to send the recommendaton to the customer', () => {
        ShopfloorCommonPage.assignClient('[email protected]')
        shopfloorApp.$(HomeScreen.productsearchButton).click();
        driver.pause(3000)
        shopfloorApp.$(SearchScreen.handbags).click();
        driver.pause(3000)
        shopfloorApp.$(SearchScreen.viewAllDresses).click();
        shopfloorApp.$(SearchScreen.firstimageProduct).click();
        shopfloorApp.$(SearchScreen.productDetails).click();
        shopfloorApp.$(SearchScreen.threedotsMenu).click();
        shopfloorApp.$(SearchScreen.sendRecommendations).click();
        if (shopfloorApp.$(SearchScreen.sendtoClientAlert).waitForExist(5000)){
            shopfloorApp.$(SearchScreen.resendButton).click();
        };
        // verify the recommendation on the consumer app
        consumerApp.$(HomeScreen.recommendationsText).waitForExist(7000)
        consumerApp.$(HomeScreen.noOfProducts).waitForExist(7000)
        consumerApp.$(HomeScreen.recommendationImage).click()
        consumerApp.$(HomeScreen.deleteRecommendation).click()
        consumerApp.$(HomeScreen.recommendationsText).waitForDisplayed(undefined, true);
        consumerApp.$(HomeScreen.noOfProducts).waitForDisplayed(undefined, true);
    });

});

I have also used another method like this, however, I get the error - TypeError: Cannot read property ‘driver’ of undefined

import ClientScreen from '../../screenobjects/client.screen';
import SearchScreen from '../../screenobjects/search.screen';
import HomeScreen from '../../screenobjects/home.screen';
import FormScreen from '../../screenobjects/forms.screen';
import ConsumerCommonPage from '../../../ConsumerApp/pageobjects/consumercommon.page';
import ShopfloorCommonPage from '../../pageobjects/shopfloorcommon.page';

var productName;

describe('Sending the recommendaton to the customer,', () => {

    beforeEach(() => {
        this.driver.activateApp('com.abc.app');
        ShopfloorCommonPage.login()
        this.driver.activateApp('com.xyz')
        ConsumerCommonPage.login()
    });

    afterEach(() => {
        this.driver.activateApp('com.xyz')
        ConsumerCommonPage.login()
        this.driver.activateApp('com.abc.app');
        ShopfloorCommonPage.logout()
    });

    it('should be able to send the recommendaton to the customer', () => {
        this.driver.activateApp('com.farfetch.enterprise.sof.shopfloor.chanel.in-house')
        ShopfloorCommonPage.assignClient('[email protected]')
        shopfloorApp.$(HomeScreen.productsearchButton).click();
        driver.pause(3000)
        shopfloorApp.$(SearchScreen.handbags).click();
        driver.pause(3000)
        shopfloorApp.$(SearchScreen.viewAllDresses).click();
        shopfloorApp.$(SearchScreen.firstimageProduct).click();
        shopfloorApp.$(SearchScreen.productDetails).click();
        shopfloorApp.$(SearchScreen.threedotsMenu).click();
        shopfloorApp.$(SearchScreen.sendRecommendations).click();
        if (shopfloorApp.$(SearchScreen.sendtoClientAlert).waitForExist(5000)){
            shopfloorApp.$(SearchScreen.resendButton).click();
        };
        // verify the recommendation on the consumer app
        this.driver.activateApp('com.farfetch.enterprise.sof.consumerapp.tage.in-house')
        consumerApp.$(HomeScreen.recommendationsText).waitForExist(7000)
        consumerApp.$(HomeScreen.noOfProducts).waitForExist(7000)
        consumerApp.$(HomeScreen.recommendationImage).click()
        consumerApp.$(HomeScreen.deleteRecommendation).click()
        consumerApp.$(HomeScreen.recommendationsText).waitForDisplayed(undefined, true);
        consumerApp.$(HomeScreen.noOfProducts).waitForDisplayed(undefined, true);
    });

});