Skip to content

Commit

Permalink
Merge pull request #423 from Cognigy/bug/61922-implement-source-direc…
Browse files Browse the repository at this point in the history
…tion-mapping-v3

Bug/61922 implement source direction mapping v3
  • Loading branch information
sushmi21 authored May 24, 2024
2 parents 2b541b7 + 0062bde commit 556e852
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 6 deletions.
1 change: 0 additions & 1 deletion docs/embedding.md
Original file line number Diff line number Diff line change
Expand Up @@ -546,7 +546,6 @@ interface IWebchatSettings {
sourceDirectionMapping: {
agent: TSourceDirection;
bot: TSourceDirection;
engagement: TSourceDirection;
user: TSourceDirection;
};
sourceColorMapping: {
Expand Down
1 change: 0 additions & 1 deletion src/common/interfaces/webchat-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,6 @@ export interface IWebchatSettings {
sourceDirectionMapping: {
agent: TSourceDirection;
bot: TSourceDirection;
engagement: TSourceDirection;
user: TSourceDirection;
};
sourceColorMapping: {
Expand Down
2 changes: 1 addition & 1 deletion src/webchat-ui/components/WebchatUI.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1314,7 +1314,7 @@ export class WebchatUI extends React.PureComponent<
/>
)}
{enableTypingIndicator && (
<TypingIndicator active={isTyping} delay={messageDelay} />
<TypingIndicator active={isTyping} delay={messageDelay} direction={config?.settings?.widgetSettings?.sourceDirectionMapping?.bot || "incoming"}/>
)}
</>
);
Expand Down
6 changes: 4 additions & 2 deletions src/webchat-ui/components/history/TypingIndicator.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,12 @@ import styled from "@emotion/styled";
import { TypingIndicator as ComponentsTypingIndicator } from "@cognigy/chat-components";

import { useIsMounted } from "../../utils/is-mounted";
import { TSourceDirection } from "../../../common/interfaces/webchat-config";

interface ITypingIndicatorProps {
active: boolean;
delay?: number;
direction?: TSourceDirection;
}

const ChatTypingIndicator = styled(ComponentsTypingIndicator)({
Expand All @@ -18,7 +20,7 @@ const HiddenChatTypingIndicator = styled(ChatTypingIndicator)({
});

const TypingIndicator: FC<ITypingIndicatorProps> = props => {
const { active, delay } = props;
const { active, delay, direction } = props;

const isMounted = useIsMounted();

Expand Down Expand Up @@ -52,7 +54,7 @@ const TypingIndicator: FC<ITypingIndicatorProps> = props => {

if (!isVisible) return <HiddenChatTypingIndicator />;

return <ChatTypingIndicator />;
return <ChatTypingIndicator direction={direction} />;
};

export default TypingIndicator;
1 change: 0 additions & 1 deletion src/webchat/store/config/config-reducer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,6 @@ Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod
sourceDirectionMapping: {
agent: 'incoming',
bot: 'incoming',
engagement: 'incoming',
user: 'outgoing',
},
sourceColorMapping: {
Expand Down

0 comments on commit 556e852

Please sign in to comment.