The communications platform that puts data protection first.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
Rocket.Chat/client/contexts/OmnichannelContext.ts

27 lines
1.2 KiB

import { createContext, useContext } from 'react';
import { OmichannelRoutingConfig, Inquiries } from '../../definition/OmichannelRoutingConfig';
export type OmnichannelContextValue = {
inquiries: Inquiries;
enabled: boolean;
agentAvailable: boolean;
routeConfig?: OmichannelRoutingConfig;
showOmnichannelQueueLink: boolean;
};
export const OmnichannelContext = createContext<OmnichannelContextValue>({
inquiries: { enabled: false },
enabled: false,
agentAvailable: false,
showOmnichannelQueueLink: false,
});
export const useOmnichannel = (): OmnichannelContextValue => useContext(OmnichannelContext);
export const useOmnichannelShowQueueLink = (): boolean => useOmnichannel().showOmnichannelQueueLink;
export const useOmnichannelRouteConfig = (): OmichannelRoutingConfig | undefined => useOmnichannel().routeConfig;
export const useOmnichannelAgentAvailable = (): boolean => useOmnichannel().agentAvailable;
export const useQueuedInquiries = (): Inquiries => useOmnichannel().inquiries;
export const useOmnichannelQueueLink = (): string => '/livechat-queue';
export const useOmnichannelDirectoryLink = (): string => '/omnichannel-directory';
export const useOmnichannelEnabled = (): boolean => useOmnichannel().enabled;