Skip to content

Commit 0002347

Browse files
committed
WLMAI-1653 - External Gen Ai support internalization for Prod
1 parent 784f784 commit 0002347

File tree

25 files changed

+5858
-2309
lines changed

25 files changed

+5858
-2309
lines changed

AI/GenAI-ChatBot-application-sample/package-lock.json

Lines changed: 5733 additions & 2092 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

AI/GenAI-ChatBot-application-sample/package.json

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -9,31 +9,30 @@
99
"lint": "next lint"
1010
},
1111
"dependencies": {
12-
"@clerk/nextjs": "^5.7.2",
13-
"@reduxjs/toolkit": "^2.2.8",
12+
"@clerk/nextjs": "^6.12.5",
13+
"@reduxjs/toolkit": "^2.6.1",
1414
"@types/react-redux": "^7.1.34",
1515
"aws-amplify": "5.3.11",
1616
"cross-env": "^7.0.3",
17-
"html-react-parser": "^5.1.18",
18-
"i18next": "^24.2.2",
17+
"html-react-parser": "^5.2.2",
18+
"i18next": "^24.2.3",
1919
"i18next-resources-to-backend": "^1.2.1",
2020
"moment": "^2.30.1",
21-
"next": "14.2.15",
21+
"next": "15.2.2",
2222
"next-i18n-router": "^5.5.1",
23-
"react": "^18",
24-
"react-dom": "^18",
23+
"react": "^19",
24+
"react-dom": "^19",
2525
"react-i18next": "^15.4.1",
26-
"react-popper-tooltip": "^4.4.2",
27-
"react-redux": "^9.1.2",
28-
"sass": "^1.79.5"
26+
"react-redux": "^9.2.0",
27+
"sass": "^1.85.1"
2928
},
3029
"devDependencies": {
3130
"@svgr/webpack": "^8.1.0",
3231
"@types/node": "^22",
33-
"@types/react": "^18",
34-
"@types/react-dom": "^18",
35-
"eslint": "^8",
36-
"eslint-config-next": "14.2.15",
32+
"@types/react": "^19",
33+
"@types/react-dom": "^19",
34+
"eslint": "^9",
35+
"eslint-config-next": "15.2.2",
3736
"typescript": "^5"
3837
}
3938
}

AI/GenAI-ChatBot-application-sample/src/app/[locale]/components/chatbot/chatBotHeader/chatBotHeader.tsx

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ import AddIcon from '@/app/[locale]/svgs/chatbot/add.svg';
55
import NotificationIcon from '@/app/[locale]/svgs/notification.svg';
66
import { KnowledgeBase } from '@/lib/api/api.types';
77
import { DsTypography } from '../../dsComponents/dsTypography/dsTypography';
8-
import { Popover } from '../../dsComponents/Popover';
98
import { useTranslation } from 'react-i18next';
9+
import { DsPopover } from '../../dsComponents/dsPopover/dsPopover';
1010

1111
export type PanelType = 'history' | 'info'
1212

@@ -27,13 +27,13 @@ const ChatBotHeader = ({ isDisabled, knowledgebase, isSendMessageDisabled, setNe
2727
<DsTypography isDisabled={isDisabled} variant='Regular_20' title={knowledgebase?.id ? knowledgebase.name : undefined} className={_Classes(styles.knowledgebaseName)}>{`${knowledgebase ? `"${knowledgebase?.name}"` : ''} ${t('genAI.chatBot.title')}`}</DsTypography>
2828
</div>
2929
<div className={_Classes(styles.right, { [styles.isDisabled]: isDisabled })}>
30-
<Popover placement="bottom-start" trigger={"hover"} container={<AddIcon width={18} title={t('genAI.chatBot.newChat')} className={_Classes(styles.headerIcon, styles.addChatIcon, { [styles.disabled]: isSendMessageDisabled || isDisabled })} onClick={() => setNewChatId(Date.now().toString())} />}>
31-
<DsTypography variant="Regular_14">{t('genAI.chatBot.newChat')}</DsTypography>
32-
</Popover>
30+
<DsPopover placement="bottomLeft" trigger='hover' title={t('genAI.chatBot.newChat')}>
31+
<AddIcon width={18} title={t('genAI.chatBot.newChat')} className={_Classes(styles.headerIcon, styles.addChatIcon, { [styles.disabled]: isSendMessageDisabled || isDisabled })} onClick={() => setNewChatId(Date.now().toString())} />
32+
</DsPopover>
3333
<NotificationIcon width={24} className={_Classes(styles.headerIcon, styles.infoIcon, { [styles.disabled]: isDisabled })} onClick={() => setIsExpanded('info')} />
34-
<Popover placement="bottom-start" trigger={"hover"} className={_Classes(styles.headerIcon, styles.historyIcon)} container={<HistoryIcon alt={t('genAI.chatBot.history.view')} title={t('genAI.chatBot.history.view')} width={22} onClick={() => setIsExpanded('history')} />}>
35-
<DsTypography variant="Regular_14">{t('genAI.chatBot.history.view')}</DsTypography>
36-
</Popover>
34+
<DsPopover placement="bottomLeft" trigger='hover' className={_Classes(styles.headerIcon, styles.historyIcon)} title={t('genAI.chatBot.history.view')}>
35+
<HistoryIcon alt={t('genAI.chatBot.history.view')} title={t('genAI.chatBot.history.view')} width={22} onClick={() => setIsExpanded('history')} />
36+
</DsPopover>
3737
</div>
3838
</div>
3939
)

AI/GenAI-ChatBot-application-sample/src/app/[locale]/components/chatbot/chatbot.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -398,7 +398,7 @@
398398

399399
.dsTextFieldFrame {
400400
width: 100%;
401-
height: 100%;
401+
height: 60px;
402402

403403
.inputTextContainer {
404404
height: 100%;

AI/GenAI-ChatBot-application-sample/src/app/[locale]/components/chatbot/chatbot.tsx

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
'use client';
22

3-
import React, { KeyboardEvent, useEffect, useMemo, useRef, useState } from 'react';
3+
import React, { KeyboardEvent, ReactElement, useEffect, useMemo, useRef, useState } from 'react';
44
import './chatbot.scss'
55
import SendIcon from "@/app/[locale]/svgs/chatbot/send.svg";
66
import EnterpriseChatIcon from "@/app/[locale]/svgs/chatbot/enterpriseChat.svg";
@@ -154,8 +154,8 @@ const Chatbot = () => {
154154
}, [messageListFromHistory, promptList]);
155155

156156
const emptyChatContent = useMemo((): {
157-
svg: JSX.Element,
158-
description: JSX.Element
157+
svg: ReactElement,
158+
description: ReactElement
159159
} => {
160160
const descriptionForNoStarters = () => {
161161
return (
@@ -258,7 +258,7 @@ const Chatbot = () => {
258258
}
259259

260260
const ConversationStarterPrompts = () => {
261-
const conversationPrompts: JSX.Element[] = [];
261+
const conversationPrompts: ReactElement[] = [];
262262
const listLength = randomStarters.length;
263263

264264
for (let i = 0; i < listLength; i++) {
@@ -364,7 +364,6 @@ const Chatbot = () => {
364364
onChange={event => setMessageInput(event!.target.value)}
365365
onKeyDown={(event: KeyboardEvent<HTMLInputElement>) => event.key === 'Enter' && sendMessage()} />
366366
<div className='sendContainer'>
367-
368367
<SendIcon width={28} className={`sendButton ${isSendMessageDisabled || !knowledgebase ? 'disabled' : ''}`} onClick={() => sendMessage()} />
369368
</div>
370369
</div>

AI/GenAI-ChatBot-application-sample/src/app/[locale]/components/dsComponents/Dialog/index.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ export interface DialogContextProviderProps {
1414

1515
export type DialogContextProps = {
1616
/** Callback used to show a dialog */
17-
setDialog: (dialog: ReactNode,isDisableClose?:boolean) => Promise<unknown> | undefined,
17+
setDialog: (dialog: ReactNode, isDisableClose?: boolean) => Promise<unknown> | undefined,
1818
/** Callback used to change the ability to close with click outside or using escape */
1919
setDisableClose: (isClosingAllowed: boolean) => void,
2020
/** Callback used to close the dialog, and pass data */
@@ -43,12 +43,12 @@ export const DialogContextProvider = ({ children }: DialogContextProviderProps)
4343
style: undefined,
4444
columns: undefined
4545
});
46-
const promise = useRef<(data?: any) => Promise<any>>();
46+
const promise = useRef<(data?: any) => Promise<any>>(null);
4747

4848
const closeDialog = useCallback((props?: DialogAnswer) => {
4949
setShownDialog({ dialog: null });
5050
promise?.current && promise.current(props);
51-
},[]);
51+
}, []);
5252

5353
const closeDialogHandler = useCallback((e: KeyboardEvent) => {
5454
if (shownDialog.isDisableClose) {
@@ -71,7 +71,7 @@ export const DialogContextProvider = ({ children }: DialogContextProviderProps)
7171
return () => {
7272
document.removeEventListener('keydown', closeDialogHandler);
7373
};
74-
}, [shownDialog,closeDialogHandler]);
74+
}, [shownDialog, closeDialogHandler]);
7575

7676
const setDialog = (dialog: ReactNode, isDisableClose?: boolean) => {
7777
if (shownDialog.dialog === dialog) {
@@ -108,7 +108,7 @@ export const DialogContextProvider = ({ children }: DialogContextProviderProps)
108108
<div className={styles.mask} onClick={shownDialog.isDisableClose ? () => {
109109
} : closeDialog} />
110110
<FlexLayout className={styles.modal} ref={modalRef} columns={shownDialog.columns || 6}
111-
style={shownDialog.style}>
111+
style={shownDialog.style}>
112112
{content}
113113
</FlexLayout>
114114
</FlexLayout>) : null}

AI/GenAI-ChatBot-application-sample/src/app/[locale]/components/dsComponents/Popover/Popover.module.scss

Lines changed: 0 additions & 19 deletions
This file was deleted.

AI/GenAI-ChatBot-application-sample/src/app/[locale]/components/dsComponents/Popover/index.tsx

Lines changed: 0 additions & 86 deletions
This file was deleted.

AI/GenAI-ChatBot-application-sample/src/app/[locale]/components/dsComponents/dsButton/dsButton.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import React, { MouseEvent, SyntheticEvent, forwardRef, useEffect, useRef, useState } from "react";
1+
import React, { MouseEvent, ReactElement, SyntheticEvent, forwardRef, useEffect, useRef, useState } from "react";
22
import './dsButton.scss';
33
import { DropDownCustomeItem, DsComponentProps, TriggerType } from "../dsTypes";
44
import { DsTypography } from "../dsTypography/dsTypography";
@@ -23,7 +23,7 @@ interface Dropdown extends DropDownCustomeItem<DsDropDownListItemProps> {
2323
}
2424

2525
export interface DsButtonProps extends DsBaseButton {
26-
icon?: JSX.Element,
26+
icon?: ReactElement,
2727
/** Used with the link button. Will open a new tab with the provided link */
2828
externalLink?: string,
2929
dropDown?: Dropdown,

AI/GenAI-ChatBot-application-sample/src/app/[locale]/components/dsComponents/dsDropDownList/dsDropDownList.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { MouseEvent, RefObject, SyntheticEvent, forwardRef, useEffect, useMemo, useRef, useState } from "react";
1+
import { MouseEvent, ReactElement, RefObject, SyntheticEvent, forwardRef, useEffect, useMemo, useRef, useState } from "react";
22
import './dsDropDownList.scss';
33
import { DropDownCustomeItem, DsBaseComponentProps, MonitorPosition, TriggerType } from "../dsTypes";
44
import { useOutsideClick } from "@/app/[locale]/hooks/useOutsideClick";
@@ -23,7 +23,7 @@ export interface DsDropDownSearch {
2323
}
2424

2525
interface DsDropDownListContainerProps {
26-
boundariesComponent: JSX.Element,
26+
boundariesComponent: ReactElement,
2727
dropdownlist: DsDropDownListProps
2828
onClickChild: (event: SyntheticEvent) => void,
2929
isDisabled: boolean,
@@ -108,7 +108,7 @@ export interface DsDropDownListProps extends DsBaseComponentProps, DropDownCusto
108108
isExpanded?: boolean,
109109
onExpandChange?: (isExpanded: boolean, dropWidth?: number) => void
110110
/** Element reference (useRef) that define the boundaries of the action list */
111-
boundariesRef: RefObject<HTMLDivElement>
111+
boundariesRef: RefObject<HTMLDivElement | null>
112112
/** Maximum dropdown height. Extra items will be visible by scroll */
113113
maxHeight?: string,
114114
options: DsDropDownListItemProps[],

0 commit comments

Comments
 (0)