ISetChannelAvailabilityRequest

Functions

setChannel

Enables or disables the phone icon.

setAvailability: (isAvailable: boolean) => void;

Here's an example in Typescript:

// init framework and get globalContext
const frameworkProvider: IUiEventsFrameworkProvider = await CX_SVC_UI_EVENTS_FRAMEWORK.uiEventsFramework.initialize('MyFirstExtensionID''v1');
const globalContext: IGlobalContext = await frameworkProvider.getGlobalContext();  

// create request object
const request: ISetChannelAvailabilityRequest = frameworkProvider.requestHelper.createPublishRequest('SetChannelAvailability') as ISetChannelAvailabilityRequest;
request.setAvailability(isAvailable);
request.setChannel(channelType);

// publish request on globalContext
globalContext.publish(request).then((response: IOperationResponse) => {
    const isSuccess: boolean = (response as ISetChannelAvailabilityResponse).isSuccess();
    if (!isSuccess) {
        console.log('error', (response as ISetChannelAvailabilityResponse).getError())
    } else {
        console.log('success');
    }
}).catch(e => console.log(e));     

Here's an example in JavaScript:

// init framework and get globalContext
const frameworkProvider = await CX_SVC_UI_EVENTS_FRAMEWORK.uiEventsFramework.initialize('MyFirstExtensionID''v1');
const globalContext = await frameworkProvider.getGlobalContext();  

// create request object
const request = frameworkProvider.requestHelper.createPublishRequest('SetChannelAvailability');
request.setAvailability(isAvailable);
request.setChannel(channelType);

// publish request on globalContext
globalContext.publish(request).then((response) => {
    const isSuccess = response.isSuccess();
    if (!isSuccess) {
        console.log('error', response.getError())
    } else {
        console.log('success');
    }
}).catch(e => console.log(e));    

getError

Set the communication channel type, such as PHONE.

setChannel: (channel: string) => void;

Here's an example in Typescript:

// init framework and get globalContext
const frameworkProvider: IUiEventsFrameworkProvider = await CX_SVC_UI_EVENTS_FRAMEWORK.uiEventsFramework.initialize('MyFirstExtensionID''v1');
const globalContext: IGlobalContext = await frameworkProvider.getGlobalContext();  

// create request object
const request: ISetChannelAvailabilityRequest = frameworkProvider.requestHelper.createPublishRequest('SetChannelAvailability') as ISetChannelAvailabilityRequest;
request.setAvailability(isAvailable);
request.setChannel(channelType);

// publish request on globalContext
globalContext.publish(request).then((response: IOperationResponse) => {
    const isSuccess: boolean = (response as ISetChannelAvailabilityResponse).isSuccess();
    if (!isSuccess) {
        console.log('error', (response as ISetChannelAvailabilityResponse).getError())
    } else {
        console.log('success');
    }
}).catch(e => console.log(e));    

Here's an example in JavaScript:

// init framework and get globalContext
const frameworkProvider = await CX_SVC_UI_EVENTS_FRAMEWORK.uiEventsFramework.initialize('MyFirstExtensionID''v1');
const globalContext = await frameworkProvider.getGlobalContext();  

// create request object
const request = frameworkProvider.requestHelper.createPublishRequest('SetChannelAvailability');
request.setAvailability(isAvailable);
request.setChannel(channelType);

// publish request on globalContext
globalContext.publish(request).then((response) => {
    const isSuccess = response.isSuccess();
    if (!isSuccess) {
        console.log('error', response.getError())
    } else {
        console.log('success');
    }
}).catch(e => console.log(e));