1.6.5-main.cf61c9e • Published 4 days ago

@microsoft/omnichannel-chat-widget v1.6.5-main.cf61c9e

Weekly downloads
-
License
MIT
Repository
github
Last release
4 days ago

Omnichannel Live Chat Widget UI Components

Release CI npm version npm\ Release CI npm version npm

@microsoft/omnichannel-chat-widget is a React-based UI component library which allows you to build your own live chat widget experience using @microsoft/omnichannel-chat-sdk.

NEW! Check out our new Developer Guide, which has detailed explanations of all component interfaces accompanied with sample code.

Table of Contents

  1. Introduction
  2. Installation
  3. Example Usage
  4. Components
  5. See Also

Introduction

Omnichannel Live Chat Widget UI Components offers a re-usable component-based library to help create a custom chat widget that can be connected to the Dynamics 365 Customer Service experience.

For more information about Live Chat Widget, see here.

Installation

npm i @microsoft/omnichannel-chat-sdk
npm i @microsoft/omnichannel-chat-widget

or

yarn add @microsoft/omnichannel-chat-sdk
yarn add @microsoft/omnichannel-chat-widget

The repo also contains the @microsoft/omnichannel-chat-components package, which is a collection of UI components. The @microsoft/omnichannel-chat-widget package is an integration of the Chat SDK and the UI components. To install the UI components separately, do

npm i @microsoft/omnichannel-chat-components

or

yarn add @microsoft/omnichannel-chat-components

Example Usage

The basic example below takes in the <LiveChatWidget/> component along with the Chat SDK to create a customized Omnichannel chat widget.

:warning: The Chat SDK has to be initialized before being passed in.

import * as React from "react";

import { LiveChatWidget } from "@microsoft/omnichannel-chat-widget";
import { OmnichannelChatSDK } from "@microsoft/omnichannel-chat-sdk";
import ReactDOM from "react-dom";
//Below version numbers will help us to troubleshoot issues with specific package
import { version as chatSdkVersion } from "@microsoft/omnichannel-chat-sdk/package.json";
import { version as chatWidgetVersion } from "@microsoft/omnichannel-chat-widget/package.json";
import { version as chatComponentVersion } from "@microsoft/omnichannel-chat-components/package.json";

const render = async () => {
    const omnichannelConfig = {
        orgId: "00000000-0000-0000-0000-000000000000", // dummy config
        orgUrl: "https://www.org-url.com", // dummy config
        widgetId: "00000000-0000-0000-0000-000000000000" // dummy config
    };
    const chatSDK = new OmnichannelChatSDK(omnichannelConfig);
    await chatSDK.initialize(); // mandatory
    const chatConfig = await chatSDK.getLiveChatConfig();
    const liveChatWidgetProps = {
        styleProps: {
            generalStyles: {
                width: "700px",
                height: "800px"
            }
        },
        headerProps: {
            controlProps: {
                hideMinimizeButton: true
            }
        },
        chatSDK: chatSDK, // mandatory
        chatConfig: chatConfig // mandatory
    };

    ReactDOM.render(
        <LiveChatWidget {...liveChatWidgetProps}/>,
        document.getElementById("my-container")
    );
};

render();

A javascript sample widget can be found in this repo here. To build it, do yarn build-sample or yarn build-sample:dev from chat-widget project root.

A typescript sample widget can be found here. To build it, do yarn install then yarn build then yarn start from typescript sample project root. See Create LiveChatWidget with Webpack5 and TypeScript for additional typescript sample project resources.

Components

For a detailed guide on how to customize each component with sample usages, please see our new Developer Guide.

Stateless UI Components

These are components that are included in the @microsoft/omnichannel-chat-components package.

ComponentUsageInterface
CallingContainerPaneThe container for voice and video feature in the chat widgetICallingContainerProps
ChatButtonThe button that appears on the user's portal that is designed to be the entry point for the user to initate chatIChatButtonProps
CommandButtonA customizable button component that can be injected to the header and/or footerICommandButtonProps
ConfirmationPaneThe default pane used when the Header close button is launchedIConfirmationPaneProps
FooterThe bottom container of the chat containing the download transcript, notification sound and email transcript buttons by default.IFooterProps
HeaderThe top container of the chat containing the default minimize, close and title of the chat widgetIHeaderProps
InputValidationPaneA pop-up input pane with validation. In the default widget this is used as part of EmailTranscriptPaneIInputValidationPaneProps
LoadingPaneThe default pane used after the chat button is clicked and before the chat loads completelyILoadingPaneProps
OutOfOfficeHoursPaneThe pane that is displayed when the chat is outside of operating hours set on admin sideIOOOHPaneProps
PostChatSurveyPaneThe pane that holds the Customer Voice survey which would be used by the customer to input their chat experience, provide user ratings etc. It uses an IFrame to render the survey URL fetched from getPostChatSurveyContext call from OmniChannel ChatSDK.IPostChatSurveyPaneProps
PreChatSurveyPaneThe pane that holds the form which would be used by the customer to input helpful information for using the Support Chat before starting up the Chat Process. Makes use of AdaptiveCardsIPreChatSurveyPaneProps
ProactiveChatSurveyPaneA pane that holds more information than a normal chat button and can be configured to proactively pop upIProactiveChatPaneProps
ReconnectChatPaneThe pane that shows up when the customer is re-connecting to the chat to add additional conversationIReconnectChatPaneProps

:warning: Because the components extend Microsoft's Fluent UI components, the base interface for all the styleProps in the above table is IStyle, which extends the IRawStyleBase interface, which is the most useful reference.

Stateful Components

ComponentDefault UsageInterface
WebChatContainerThe default wrapper around BotFramework's WebChat, which is the message container we are usingIWebChatContainerStatefulProps
LiveChatWidgetThe default widget that stitches the UI components with Chat SDKILiveChatWidgetProps
PostChatLoadingPaneThe default loading pane used after the chat is ended and before the post chat pane loads completelyILoadingPaneProps

Some of the interfaces listed in the Stateless table have Stateful counterparts defined in the @microsoft/omnichannel-chat-widget package. For example, IConfirmationPaneStatefulProps extends IConfirmationPaneProps with additional attributes that only makes sense in the stateful context.

Custom Components

There are two ways to custom the components provided in the library - 1) Replacing components using ComponentOverrides, and 2) Adding custom components in header and footer.

ComponentOverrides

Most sub-components and the default panes provided can be overriden. Components have "componentOverrides" as part of props interface, which consists of ReactNodes or strings for each part of the component. For example, the "ProactiveChatPane" component has a close button, and the close button can be overriden by creating a custom react node and setting it to the "closeButton" attribute of "componentOverrides" interface that is part of the props.

const customButton = (
    <button style={{
        background: "green",
        height: "80px",
        margin: "30px 15px 0 0",
        padding: "10px",
        width: "160px"
    }}>
        This is a custom button
    </button>
);

const liveChatWidgetProps = {
    proactiveChatPaneProps: {
        componentOverrides: {
            closeButton: customButton
        };
    };
}

Custom Components in Header and Footer

Header's and Footer's child components consist of three parts:

  1. "leftGroup" - adding child components at the left of the Header/Footer
  2. "middleGroup" - adding child components in the middle of the Header/Footer
  3. "rightGroup" - adding child components at the right of the Header/Footer

By default Header has the header icon and title on the left and minimize and close buttons on the right, and Footer has Download Transcript and Email Transcript buttons on the left and audio notification button on the right. These components can be overriden with ComponentOverrides. In addition, other custom child components can be added to both Header and Footer by creating custom react nodes and adding them to attributes "leftGroup", "middleGroup" or "rightGroup" of "controlProps".

const buttonStyleProps: IButtonStyles = {
    root: {
        color: "blue",
        height: 25,
        width: 25,
    }
};

const calendarIcon: IIconProps = { iconName: "Calendar" };
const calendarIconButton = <IconButton
    key="calendarIconButton"
    iconProps={calendarIcon}
    styles={buttonStyleProps}
    title="Calendar">
</IconButton>;

const emojiIcon: IIconProps = { iconName: "Emoji2" };
const emojiIconButton = <IconButton
    key="emojiIconButton"
    iconProps={emojiIcon}
    styles={buttonStyleProps}
    title="Sentiment">
</IconButton>;

const uploadIcon: IIconProps = { iconName: "Upload" };
const uploadIconButton = <IconButton
    key="uploadIconButton"
    iconProps={uploadIcon}
    styles={buttonStyleProps}
    title="Upload">
</IconButton>;

const customizedFooterProp: IFooterProps = {
    controlProps: {
        leftGroup: { children: [uploadIconButton] },
        middleGroup: { children: [calendarIconButton] },
        rightGroup: { children: [emojiIconButton] }
    }
};

:pushpin: Note that WebChat hooks can also be used in any custom components.

See Also

Customizations Dev Guide\ Telemetry\ Create LiveChatWidget with Webpack5 and TypeScript\ Omnichannel Features\ How to Add Visual Regression Tests\ Security\ Third Party Cookie Support\ Storybook

1.6.4

7 days ago

1.6.3

1 month ago

1.6.3-main.d18adce

2 months ago

1.6.3-main.24dce14

2 months ago

1.6.3-main.6248890

2 months ago

1.6.3-main.5c53935

2 months ago

1.6.3-main.cd40716

3 months ago

1.6.3-main.25307f2

3 months ago

1.6.3-main.e6221d5

3 months ago

1.6.3-main.18ee949

3 months ago

1.6.2

4 months ago

1.6.2-main.c7d45e8

4 months ago

1.6.1

5 months ago

1.6.0

5 months ago

1.5.1-main.7897747

5 months ago

1.5.1-main.6b98130

5 months ago

1.5.1-main.ee4453c

5 months ago

1.5.1-main.8614a75

5 months ago

1.5.1-main.b37ad3d

5 months ago

1.5.1-main.e2be12d

5 months ago

1.5.1-main.c3533cf

5 months ago

1.3.1-main.2c329a2

7 months ago

1.4.1-main.d29da65

6 months ago

1.2.3-main.f8e3363

9 months ago

1.2.2-main.03f3121

9 months ago

1.1.1-main.fb181a2

10 months ago

1.2.4-main.46521cb

8 months ago

1.2.2-main.ea7e6ed

9 months ago

1.4.1-main.e64f91f

6 months ago

1.2.1-main.dd977a7

10 months ago

1.5.1-main.76c6a71

5 months ago

1.3.1-main.a91ba9b

8 months ago

1.1.1-main.1f4a6a7

10 months ago

1.5.0

6 months ago

1.4.1-main.a860a86

6 months ago

1.3.1-main.c1cf6d6

7 months ago

1.4.1-main.cfe8ebd

6 months ago

1.4.1-main.2575376

6 months ago

1.2.3-main.000f886

9 months ago

1.2.2-main.9c5ff6c

9 months ago

1.4.0

6 months ago

1.2.3-main.fc07b68

9 months ago

1.2.4-main.489bb82

8 months ago

1.1.1-main.75135c5

10 months ago

1.4.1-main.4e8dedc

6 months ago

1.4.1-main.c45e3b0

6 months ago

1.3.0

8 months ago

1.2.4-main.00bcd4e

8 months ago

1.2.2-main.a09cee4

10 months ago

1.3.1-main.57e27d3

7 months ago

1.2.2-main.f0135ab

10 months ago

1.3.1-main.57aa509

7 months ago

1.2.2-main.581b2ad

9 months ago

1.2.4-main.55d3b5a

8 months ago

1.5.1-main.132e1c6

6 months ago

1.2.0

10 months ago

1.2.3

8 months ago

1.2.2

9 months ago

1.2.1

10 months ago

1.2.3-main.2ce131d

8 months ago

1.2.3-main.d27a359

8 months ago

1.4.1-main.22cb7d3

6 months ago

1.3.1-main.cb0a057

7 months ago

1.2.2-main.26c48a5

9 months ago

1.2.4-main.5cf122d

8 months ago

1.3.1-main.da9dc59

8 months ago

1.2.4-main.6b298de

8 months ago

1.2.2-main.3881884

9 months ago

1.3.1-main.0ab8965

7 months ago

1.2.4-main.9847fc4

8 months ago

1.4.1-main.e6586cc

6 months ago

1.2.4-main.984388f

8 months ago

1.2.1-main.c28bf7d

10 months ago

1.4.1-main.d4130ad

6 months ago

1.4.1-main.f29a6ae

6 months ago

1.4.1-main.3c12a8b

6 months ago

1.2.3-main.e804943

8 months ago

1.4.1-main.9949bfd

6 months ago

1.4.1-main.9bf5e75

6 months ago

1.1.1-main.691fe30

11 months ago

1.1.1-main.9164f12

10 months ago

1.1.1-main.c2e1b5a

10 months ago

1.0.4-main.337860d

12 months ago

1.0.4-main.884685f

12 months ago

1.0.5-main.53e6741

12 months ago

1.0.5-main.545bb43

12 months ago

1.1.0

11 months ago

1.0.6-main.ec7a5f0

11 months ago

1.0.5-main.b47afe8

12 months ago

1.0.6-main.886ccec

11 months ago

1.0.6-main.0c19ff3

11 months ago

1.1.1-main.d37310c

11 months ago

1.0.6-main.ffb4e2a

11 months ago

1.0.6-main.3aba33c

12 months ago

1.0.5

12 months ago

1.0.4

12 months ago

1.0.6-main.e676788

11 months ago

1.1.1-main.d246ee0

11 months ago

1.0.6-main.88cc13d

11 months ago

1.0.5-main.09afcbb

12 months ago

1.0.5-main.b771061

12 months ago

1.1.1-main.45472ff

11 months ago

1.1.1-main.d9ea24e

11 months ago

1.0.5-main.d908c85

12 months ago

1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago

1.0.3

1 year ago