@clikvn/agent-widget-embedded 1.1.5-dev-10 → 1.1.5-dev-13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.rollup.cache/Users/tungthai/Desktop/Develop/clik-ai-chatbot-embedded/dist/commons/constants/bookMeeting.d.ts +14 -0
- package/.rollup.cache/Users/tungthai/Desktop/Develop/clik-ai-chatbot-embedded/dist/commons/constants/bookMeeting.d.ts.map +1 -0
- package/.rollup.cache/Users/tungthai/Desktop/Develop/clik-ai-chatbot-embedded/dist/commons/constants/bookMeeting.js +70 -0
- package/.rollup.cache/Users/tungthai/Desktop/Develop/clik-ai-chatbot-embedded/dist/commons/constants/bookMeeting.js.map +1 -0
- package/.rollup.cache/Users/tungthai/Desktop/Develop/clik-ai-chatbot-embedded/dist/commons/constants/index.d.ts +1 -0
- package/.rollup.cache/Users/tungthai/Desktop/Develop/clik-ai-chatbot-embedded/dist/commons/constants/index.d.ts.map +1 -1
- package/.rollup.cache/Users/tungthai/Desktop/Develop/clik-ai-chatbot-embedded/dist/commons/constants/index.js +1 -0
- package/.rollup.cache/Users/tungthai/Desktop/Develop/clik-ai-chatbot-embedded/dist/commons/constants/index.js.map +1 -1
- package/.rollup.cache/Users/tungthai/Desktop/Develop/clik-ai-chatbot-embedded/dist/components/Chat/BookMeetingForm.d.ts +4 -0
- package/.rollup.cache/Users/tungthai/Desktop/Develop/clik-ai-chatbot-embedded/dist/components/Chat/BookMeetingForm.d.ts.map +1 -0
- package/.rollup.cache/Users/tungthai/Desktop/Develop/clik-ai-chatbot-embedded/dist/components/Chat/BookMeetingForm.js +135 -0
- package/.rollup.cache/Users/tungthai/Desktop/Develop/clik-ai-chatbot-embedded/dist/components/Chat/BookMeetingForm.js.map +1 -0
- package/.rollup.cache/Users/tungthai/Desktop/Develop/clik-ai-chatbot-embedded/dist/components/Chat/Chat.d.ts.map +1 -1
- package/.rollup.cache/Users/tungthai/Desktop/Develop/clik-ai-chatbot-embedded/dist/components/Chat/Chat.js +9 -3
- package/.rollup.cache/Users/tungthai/Desktop/Develop/clik-ai-chatbot-embedded/dist/components/Chat/Chat.js.map +1 -1
- package/.rollup.cache/Users/tungthai/Desktop/Develop/clik-ai-chatbot-embedded/dist/components/Chat/Icons.d.ts +82 -76
- package/.rollup.cache/Users/tungthai/Desktop/Develop/clik-ai-chatbot-embedded/dist/components/Chat/Icons.d.ts.map +1 -1
- package/.rollup.cache/Users/tungthai/Desktop/Develop/clik-ai-chatbot-embedded/dist/components/Chat/Icons.js +101 -82
- package/.rollup.cache/Users/tungthai/Desktop/Develop/clik-ai-chatbot-embedded/dist/components/Chat/Icons.js.map +1 -1
- package/.rollup.cache/Users/tungthai/Desktop/Develop/clik-ai-chatbot-embedded/dist/components/Chat/Message.d.ts.map +1 -1
- package/.rollup.cache/Users/tungthai/Desktop/Develop/clik-ai-chatbot-embedded/dist/components/Chat/Message.js +5 -3
- package/.rollup.cache/Users/tungthai/Desktop/Develop/clik-ai-chatbot-embedded/dist/components/Chat/Message.js.map +1 -1
- package/.rollup.cache/Users/tungthai/Desktop/Develop/clik-ai-chatbot-embedded/dist/components/Chat/UserContactForm.d.ts.map +1 -1
- package/.rollup.cache/Users/tungthai/Desktop/Develop/clik-ai-chatbot-embedded/dist/components/Chat/UserContactForm.js +72 -17
- package/.rollup.cache/Users/tungthai/Desktop/Develop/clik-ai-chatbot-embedded/dist/components/Chat/UserContactForm.js.map +1 -1
- package/.rollup.cache/Users/tungthai/Desktop/Develop/clik-ai-chatbot-embedded/dist/components/Chat/ui/Button.d.ts +1 -1
- package/.rollup.cache/Users/tungthai/Desktop/Develop/clik-ai-chatbot-embedded/dist/components/Chat/ui/DataPickerCustom.d.ts +9 -0
- package/.rollup.cache/Users/tungthai/Desktop/Develop/clik-ai-chatbot-embedded/dist/components/Chat/ui/DataPickerCustom.d.ts.map +1 -0
- package/.rollup.cache/Users/tungthai/Desktop/Develop/clik-ai-chatbot-embedded/dist/components/Chat/ui/DataPickerCustom.js +32 -0
- package/.rollup.cache/Users/tungthai/Desktop/Develop/clik-ai-chatbot-embedded/dist/components/Chat/ui/DataPickerCustom.js.map +1 -0
- package/.rollup.cache/Users/tungthai/Desktop/Develop/clik-ai-chatbot-embedded/dist/components/Chat/ui/PhoneNumberInput.d.ts +11 -0
- package/.rollup.cache/Users/tungthai/Desktop/Develop/clik-ai-chatbot-embedded/dist/components/Chat/ui/PhoneNumberInput.d.ts.map +1 -0
- package/.rollup.cache/Users/tungthai/Desktop/Develop/clik-ai-chatbot-embedded/dist/components/Chat/ui/PhoneNumberInput.js +8 -0
- package/.rollup.cache/Users/tungthai/Desktop/Develop/clik-ai-chatbot-embedded/dist/components/Chat/ui/PhoneNumberInput.js.map +1 -0
- package/.rollup.cache/Users/tungthai/Desktop/Develop/clik-ai-chatbot-embedded/dist/components/Chat/ui/SelectBox.d.ts +19 -0
- package/.rollup.cache/Users/tungthai/Desktop/Develop/clik-ai-chatbot-embedded/dist/components/Chat/ui/SelectBox.d.ts.map +1 -0
- package/.rollup.cache/Users/tungthai/Desktop/Develop/clik-ai-chatbot-embedded/dist/components/Chat/ui/SelectBox.js +33 -0
- package/.rollup.cache/Users/tungthai/Desktop/Develop/clik-ai-chatbot-embedded/dist/components/Chat/ui/SelectBox.js.map +1 -0
- package/.rollup.cache/Users/tungthai/Desktop/Develop/clik-ai-chatbot-embedded/dist/components/Chat/ui/SelectBoxWithIcon.d.ts +19 -0
- package/.rollup.cache/Users/tungthai/Desktop/Develop/clik-ai-chatbot-embedded/dist/components/Chat/ui/SelectBoxWithIcon.d.ts.map +1 -0
- package/.rollup.cache/Users/tungthai/Desktop/Develop/clik-ai-chatbot-embedded/dist/components/Chat/ui/SelectBoxWithIcon.js +71 -0
- package/.rollup.cache/Users/tungthai/Desktop/Develop/clik-ai-chatbot-embedded/dist/components/Chat/ui/SelectBoxWithIcon.js.map +1 -0
- package/.rollup.cache/Users/tungthai/Desktop/Develop/clik-ai-chatbot-embedded/dist/constants/form.d.ts +13 -0
- package/.rollup.cache/Users/tungthai/Desktop/Develop/clik-ai-chatbot-embedded/dist/constants/form.d.ts.map +1 -0
- package/.rollup.cache/Users/tungthai/Desktop/Develop/clik-ai-chatbot-embedded/dist/constants/form.js +2 -0
- package/.rollup.cache/Users/tungthai/Desktop/Develop/clik-ai-chatbot-embedded/dist/constants/form.js.map +1 -0
- package/.rollup.cache/Users/tungthai/Desktop/Develop/clik-ai-chatbot-embedded/dist/features/AgentWidget/index.d.ts.map +1 -1
- package/.rollup.cache/Users/tungthai/Desktop/Develop/clik-ai-chatbot-embedded/dist/features/AgentWidget/index.js +3 -1
- package/.rollup.cache/Users/tungthai/Desktop/Develop/clik-ai-chatbot-embedded/dist/features/AgentWidget/index.js.map +1 -1
- package/.rollup.cache/Users/tungthai/Desktop/Develop/clik-ai-chatbot-embedded/dist/hooks/useAudioMesseagePlayer.js +2 -2
- package/.rollup.cache/Users/tungthai/Desktop/Develop/clik-ai-chatbot-embedded/dist/hooks/useAudioMesseagePlayer.js.map +1 -1
- package/.rollup.cache/Users/tungthai/Desktop/Develop/clik-ai-chatbot-embedded/dist/hooks/useConfiguration.d.ts +15 -0
- package/.rollup.cache/Users/tungthai/Desktop/Develop/clik-ai-chatbot-embedded/dist/hooks/useConfiguration.d.ts.map +1 -1
- package/.rollup.cache/Users/tungthai/Desktop/Develop/clik-ai-chatbot-embedded/dist/hooks/useConfiguration.js.map +1 -1
- package/.rollup.cache/Users/tungthai/Desktop/Develop/clik-ai-chatbot-embedded/dist/hooks/useScrollContainer.d.ts +9 -0
- package/.rollup.cache/Users/tungthai/Desktop/Develop/clik-ai-chatbot-embedded/dist/hooks/useScrollContainer.d.ts.map +1 -0
- package/.rollup.cache/Users/tungthai/Desktop/Develop/clik-ai-chatbot-embedded/dist/hooks/useScrollContainer.js +64 -0
- package/.rollup.cache/Users/tungthai/Desktop/Develop/clik-ai-chatbot-embedded/dist/hooks/useScrollContainer.js.map +1 -0
- package/.rollup.cache/Users/tungthai/Desktop/Develop/clik-ai-chatbot-embedded/dist/hooks/useScrollToBottom.d.ts +4 -2
- package/.rollup.cache/Users/tungthai/Desktop/Develop/clik-ai-chatbot-embedded/dist/hooks/useScrollToBottom.d.ts.map +1 -1
- package/.rollup.cache/Users/tungthai/Desktop/Develop/clik-ai-chatbot-embedded/dist/hooks/useScrollToBottom.js +38 -3
- package/.rollup.cache/Users/tungthai/Desktop/Develop/clik-ai-chatbot-embedded/dist/hooks/useScrollToBottom.js.map +1 -1
- package/.rollup.cache/Users/tungthai/Desktop/Develop/clik-ai-chatbot-embedded/dist/services/apis.d.ts +2 -0
- package/.rollup.cache/Users/tungthai/Desktop/Develop/clik-ai-chatbot-embedded/dist/services/apis.d.ts.map +1 -1
- package/.rollup.cache/Users/tungthai/Desktop/Develop/clik-ai-chatbot-embedded/dist/services/apis.js +2 -0
- package/.rollup.cache/Users/tungthai/Desktop/Develop/clik-ai-chatbot-embedded/dist/services/apis.js.map +1 -1
- package/.rollup.cache/Users/tungthai/Desktop/Develop/clik-ai-chatbot-embedded/dist/services/bookMeeting.service.d.ts +3 -0
- package/.rollup.cache/Users/tungthai/Desktop/Develop/clik-ai-chatbot-embedded/dist/services/bookMeeting.service.d.ts.map +1 -0
- package/.rollup.cache/Users/tungthai/Desktop/Develop/clik-ai-chatbot-embedded/dist/services/bookMeeting.service.js +15 -0
- package/.rollup.cache/Users/tungthai/Desktop/Develop/clik-ai-chatbot-embedded/dist/services/bookMeeting.service.js.map +1 -0
- package/.rollup.cache/Users/tungthai/Desktop/Develop/clik-ai-chatbot-embedded/dist/services/userContact.service.d.ts +7 -0
- package/.rollup.cache/Users/tungthai/Desktop/Develop/clik-ai-chatbot-embedded/dist/services/userContact.service.d.ts.map +1 -0
- package/.rollup.cache/Users/tungthai/Desktop/Develop/clik-ai-chatbot-embedded/dist/services/userContact.service.js +26 -0
- package/.rollup.cache/Users/tungthai/Desktop/Develop/clik-ai-chatbot-embedded/dist/services/userContact.service.js.map +1 -0
- package/.rollup.cache/Users/tungthai/Desktop/Develop/clik-ai-chatbot-embedded/dist/types/bookMeeting.type.d.ts +9 -0
- package/.rollup.cache/Users/tungthai/Desktop/Develop/clik-ai-chatbot-embedded/dist/types/bookMeeting.type.d.ts.map +1 -0
- package/.rollup.cache/Users/tungthai/Desktop/Develop/clik-ai-chatbot-embedded/dist/types/bookMeeting.type.js +2 -0
- package/.rollup.cache/Users/tungthai/Desktop/Develop/clik-ai-chatbot-embedded/dist/types/bookMeeting.type.js.map +1 -0
- package/.rollup.cache/Users/tungthai/Desktop/Develop/clik-ai-chatbot-embedded/dist/types/userContact.type.d.ts +16 -0
- package/.rollup.cache/Users/tungthai/Desktop/Develop/clik-ai-chatbot-embedded/dist/types/userContact.type.d.ts.map +1 -0
- package/.rollup.cache/Users/tungthai/Desktop/Develop/clik-ai-chatbot-embedded/dist/types/userContact.type.js +2 -0
- package/.rollup.cache/Users/tungthai/Desktop/Develop/clik-ai-chatbot-embedded/dist/types/userContact.type.js.map +1 -0
- package/.rollup.cache/Users/tungthai/Desktop/Develop/clik-ai-chatbot-embedded/dist/utils/functionUtils.d.ts +1 -0
- package/.rollup.cache/Users/tungthai/Desktop/Develop/clik-ai-chatbot-embedded/dist/utils/functionUtils.d.ts.map +1 -1
- package/.rollup.cache/Users/tungthai/Desktop/Develop/clik-ai-chatbot-embedded/dist/utils/functionUtils.js +4 -0
- package/.rollup.cache/Users/tungthai/Desktop/Develop/clik-ai-chatbot-embedded/dist/utils/functionUtils.js.map +1 -1
- package/.rollup.cache/Users/tungthai/Desktop/Develop/clik-ai-chatbot-embedded/dist/utils/toolUtils.d.ts.map +1 -1
- package/.rollup.cache/Users/tungthai/Desktop/Develop/clik-ai-chatbot-embedded/dist/utils/toolUtils.js +4 -2
- package/.rollup.cache/Users/tungthai/Desktop/Develop/clik-ai-chatbot-embedded/dist/utils/toolUtils.js.map +1 -1
- package/dist/components/Chat/Chat.d.ts.map +1 -1
- package/dist/hooks/useScrollContainer.d.ts +9 -0
- package/dist/hooks/useScrollContainer.d.ts.map +1 -0
- package/dist/hooks/useScrollToBottom.d.ts +4 -2
- package/dist/hooks/useScrollToBottom.d.ts.map +1 -1
- package/dist/utils/toolUtils.d.ts.map +1 -1
- package/dist/web.js +1 -1
- package/dist/web.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { Fragment as _Fragment, jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { cloneElement, useEffect, useRef, useState } from 'react';
|
|
3
|
+
import { ChevronDownIcon } from '../Icons';
|
|
4
|
+
export const SelectBoxWithIcon = ({ options, defaultValue, onChange, placeholder = 'Select an option', optionClassName = '', optionContainerClassName = '', name, disabled = false, }) => {
|
|
5
|
+
const [isOpen, setIsOpen] = useState(false);
|
|
6
|
+
const [selectedOption, setSelectedOption] = useState(options.find((opt) => opt.value === defaultValue) || null);
|
|
7
|
+
const wrapperRef = useRef(null);
|
|
8
|
+
const firstOptionRef = useRef(null);
|
|
9
|
+
const toggleDropdown = () => {
|
|
10
|
+
if (disabled)
|
|
11
|
+
return;
|
|
12
|
+
setIsOpen(!isOpen);
|
|
13
|
+
if (!isOpen && firstOptionRef.current) {
|
|
14
|
+
firstOptionRef.current.focus();
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
const selectOption = (option) => {
|
|
18
|
+
setSelectedOption(option);
|
|
19
|
+
setIsOpen(false);
|
|
20
|
+
onChange?.(option.value, name);
|
|
21
|
+
};
|
|
22
|
+
useEffect(() => {
|
|
23
|
+
const handleClickOutside = (event) => {
|
|
24
|
+
if (wrapperRef.current &&
|
|
25
|
+
!wrapperRef.current.contains(event.target)) {
|
|
26
|
+
setIsOpen(false);
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
document.addEventListener('mousedown', handleClickOutside);
|
|
30
|
+
return () => document.removeEventListener('mousedown', handleClickOutside);
|
|
31
|
+
}, []);
|
|
32
|
+
const handleKeyDown = (e) => {
|
|
33
|
+
if (e.key === 'Enter' || e.key === ' ') {
|
|
34
|
+
e.preventDefault();
|
|
35
|
+
toggleDropdown();
|
|
36
|
+
}
|
|
37
|
+
else if (e.key === 'Escape' && isOpen) {
|
|
38
|
+
e.preventDefault();
|
|
39
|
+
setIsOpen(false);
|
|
40
|
+
wrapperRef.current?.focus();
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
const handleOptionKeyDown = (e, option) => {
|
|
44
|
+
if (e.key === 'Enter' || e.key === ' ') {
|
|
45
|
+
e.preventDefault();
|
|
46
|
+
selectOption(option);
|
|
47
|
+
}
|
|
48
|
+
else if (e.key === 'ArrowDown') {
|
|
49
|
+
e.preventDefault();
|
|
50
|
+
const nextOption = e.currentTarget.nextElementSibling;
|
|
51
|
+
if (nextOption)
|
|
52
|
+
nextOption.focus();
|
|
53
|
+
else
|
|
54
|
+
e.currentTarget.parentElement?.firstElementChild?.focus();
|
|
55
|
+
}
|
|
56
|
+
else if (e.key === 'ArrowUp') {
|
|
57
|
+
e.preventDefault();
|
|
58
|
+
const prevOption = e.currentTarget
|
|
59
|
+
.previousElementSibling;
|
|
60
|
+
if (prevOption)
|
|
61
|
+
prevOption.focus();
|
|
62
|
+
else
|
|
63
|
+
e.currentTarget.parentElement?.lastElementChild?.focus();
|
|
64
|
+
}
|
|
65
|
+
};
|
|
66
|
+
return (_jsxs("div", { className: "relative w-full", role: "combobox", "aria-expanded": isOpen, "aria-haspopup": "listbox", tabIndex: 0, ref: wrapperRef, onKeyDown: handleKeyDown, children: [_jsxs("div", { className: `flex justify-between items-center p-2 border rounded-lg bg-white cursor-pointer focus:outline focus:outline-2 focus:outline-blue-500 h-[40px]
|
|
67
|
+
${disabled ? '!cursor-not-allowed !bg-gray-100 !text-gray-500 hover:!border-gray-300' : ''}`, role: "button", "aria-label": "Select an option", onClick: toggleDropdown, children: [_jsx("span", { className: "selected-text flex items-center gap-2", children: selectedOption ? (_jsxs(_Fragment, { children: [selectedOption.icon, selectedOption.label] })) : (placeholder) }), _jsx(ChevronDownIcon, {})] }), _jsx("ul", { className: `absolute w-full mt-1 border rounded-md bg-white shadow-lg z-10 max-h-48 overflow-auto py-4 px-3 overflow-y-scroll [scrollbar-width:none] [&::-webkit-scrollbar]:hidden bottom-11 flex flex-col gap-2 ${isOpen ? 'block' : 'hidden'} ${optionContainerClassName}`, role: "listbox", "aria-labelledby": "selected-text", children: options.map((option, index) => (_jsxs("li", { className: `flex items-center gap-2 text-[#18181B] font-normal text-sm leading-6 h-[40px] py-2 pr-2 pl-3 border rounded-lg bg-white hover:bg-[#1E6EB4] hover:text-[#F8FAFC] focus:bg-gray-100 focus:outline focus:outline-2 focus:outline-blue-500 ${selectedOption?.value === option.value ? '!bg-[#1E6EB4] !text-[#F8FAFC]' : ''} ${optionClassName}`, role: "option", "aria-selected": selectedOption?.value === option.value, tabIndex: -1, ref: index === 0 ? firstOptionRef : null, onClick: () => selectOption(option), onKeyDown: (e) => handleOptionKeyDown(e, option), children: [cloneElement(option.icon, {
|
|
68
|
+
color: selectedOption?.value === option.value ? '#F8FAFC' : '#18181B',
|
|
69
|
+
}), _jsx("span", { children: option.label })] }, option.value))) }), _jsx("input", { type: "hidden", name: "selected_option", value: selectedOption?.value || '' })] }));
|
|
70
|
+
};
|
|
71
|
+
//# sourceMappingURL=SelectBoxWithIcon.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SelectBoxWithIcon.js","sourceRoot":"","sources":["../../../../src/components/Chat/ui/SelectBoxWithIcon.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,YAAY,EAAM,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACtE,OAAO,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAmB3C,MAAM,CAAC,MAAM,iBAAiB,GAA+B,CAAC,EAC5D,OAAO,EACP,YAAY,EACZ,QAAQ,EACR,WAAW,GAAG,kBAAkB,EAChC,eAAe,GAAG,EAAE,EACpB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AC,CAAC,IAAI,EACxC,OAAO,EAAE,GAAG,EAAE,CAAC,YAAY,CAAC,MAAM,CAAC,EACnC,SAAS,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,mBAAmB,CAAC,CAAC,EAAE,MAAM,CAAC,aAE/C,YAAY,CAAC,MAAM,CAAC,IAA0B,EAAE;4BAC/C,KAAK,EACH,cAAc,EAAE,KAAK,KAAK,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,SAAS;yBACjE,CAAC,EACF,yBAAO,MAAM,CAAC,KAAK,GAAQ,KAbtB,MAAM,CAAC,KAAK,CAcd,CACN,CAAC,GACC,EACL,gBACE,IAAI,EAAC,QAAQ,EACb,IAAI,EAAC,iBAAiB,EACtB,KAAK,EAAE,cAAc,EAAE,KAAK,IAAI,EAAE,GAClC,IACE,CACP,CAAC;AACJ,CAAC,CAAC","sourcesContent":["import { cloneElement, FC, useEffect, useRef, useState } from 'react';\nimport { ChevronDownIcon } from '../Icons';\n\ninterface SelectBoxWithIconProps {\n options: Option[];\n defaultValue?: string;\n onChange?: (value: string, name: string) => void;\n placeholder?: string;\n optionClassName?: string;\n optionContainerClassName?: string;\n name: string;\n disabled?: boolean;\n}\n\ninterface Option {\n value: string;\n label: string;\n icon: React.ReactNode;\n}\n\nexport const SelectBoxWithIcon: FC<SelectBoxWithIconProps> = ({\n options,\n defaultValue,\n onChange,\n placeholder = 'Select an option',\n optionClassName = '',\n optionContainerClassName = '',\n name,\n disabled = false,\n}: SelectBoxWithIconProps) => {\n const [isOpen, setIsOpen] = useState(false);\n const [selectedOption, setSelectedOption] = useState<Option | null>(\n options.find((opt) => opt.value === defaultValue) || null\n );\n const wrapperRef = useRef<HTMLDivElement>(null);\n const firstOptionRef = useRef<HTMLLIElement>(null);\n\n const toggleDropdown = () => {\n if (disabled) return;\n\n setIsOpen(!isOpen);\n if (!isOpen && firstOptionRef.current) {\n firstOptionRef.current.focus();\n }\n };\n\n const selectOption = (option: Option) => {\n setSelectedOption(option);\n setIsOpen(false);\n onChange?.(option.value, name);\n };\n\n useEffect(() => {\n const handleClickOutside = (event: MouseEvent) => {\n if (\n wrapperRef.current &&\n !wrapperRef.current.contains(event.target as Node)\n ) {\n setIsOpen(false);\n }\n };\n document.addEventListener('mousedown', handleClickOutside);\n return () => document.removeEventListener('mousedown', handleClickOutside);\n }, []);\n\n const handleKeyDown = (e: React.KeyboardEvent<HTMLDivElement>) => {\n if (e.key === 'Enter' || e.key === ' ') {\n e.preventDefault();\n toggleDropdown();\n } else if (e.key === 'Escape' && isOpen) {\n e.preventDefault();\n setIsOpen(false);\n wrapperRef.current?.focus();\n }\n };\n\n const handleOptionKeyDown = (\n e: React.KeyboardEvent<HTMLLIElement>,\n option: Option\n ) => {\n if (e.key === 'Enter' || e.key === ' ') {\n e.preventDefault();\n selectOption(option);\n } else if (e.key === 'ArrowDown') {\n e.preventDefault();\n const nextOption = e.currentTarget.nextElementSibling as HTMLLIElement;\n if (nextOption) nextOption.focus();\n else\n (\n e.currentTarget.parentElement?.firstElementChild as HTMLLIElement\n )?.focus();\n } else if (e.key === 'ArrowUp') {\n e.preventDefault();\n const prevOption = e.currentTarget\n .previousElementSibling as HTMLLIElement;\n if (prevOption) prevOption.focus();\n else\n (\n e.currentTarget.parentElement?.lastElementChild as HTMLLIElement\n )?.focus();\n }\n };\n\n return (\n <div\n className=\"relative w-full\"\n role=\"combobox\"\n aria-expanded={isOpen}\n aria-haspopup=\"listbox\"\n tabIndex={0}\n ref={wrapperRef}\n onKeyDown={handleKeyDown}\n >\n <div\n className={`flex justify-between items-center p-2 border rounded-lg bg-white cursor-pointer focus:outline focus:outline-2 focus:outline-blue-500 h-[40px] \n ${disabled ? '!cursor-not-allowed !bg-gray-100 !text-gray-500 hover:!border-gray-300' : ''}`}\n role=\"button\"\n aria-label=\"Select an option\"\n onClick={toggleDropdown}\n >\n <span className=\"selected-text flex items-center gap-2\">\n {selectedOption ? (\n <>\n {selectedOption.icon}\n {selectedOption.label}\n </>\n ) : (\n placeholder\n )}\n </span>\n <ChevronDownIcon />\n </div>\n <ul\n className={`absolute w-full mt-1 border rounded-md bg-white shadow-lg z-10 max-h-48 overflow-auto py-4 px-3 overflow-y-scroll [scrollbar-width:none] [&::-webkit-scrollbar]:hidden bottom-11 flex flex-col gap-2 ${isOpen ? 'block' : 'hidden'} ${optionContainerClassName}`}\n role=\"listbox\"\n aria-labelledby=\"selected-text\"\n >\n {options.map((option, index) => (\n <li\n key={option.value}\n className={`flex items-center gap-2 text-[#18181B] font-normal text-sm leading-6 h-[40px] py-2 pr-2 pl-3 border rounded-lg bg-white hover:bg-[#1E6EB4] hover:text-[#F8FAFC] focus:bg-gray-100 focus:outline focus:outline-2 focus:outline-blue-500 ${selectedOption?.value === option.value ? '!bg-[#1E6EB4] !text-[#F8FAFC]' : ''} ${optionClassName}`}\n role=\"option\"\n aria-selected={selectedOption?.value === option.value}\n tabIndex={-1}\n ref={index === 0 ? firstOptionRef : null}\n onClick={() => selectOption(option)}\n onKeyDown={(e) => handleOptionKeyDown(e, option)}\n >\n {cloneElement(option.icon as React.ReactElement, {\n color:\n selectedOption?.value === option.value ? '#F8FAFC' : '#18181B',\n })}\n <span>{option.label}</span>\n </li>\n ))}\n </ul>\n <input\n type=\"hidden\"\n name=\"selected_option\"\n value={selectedOption?.value || ''}\n />\n </div>\n );\n};\n"]}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export interface StatusSubmitType {
|
|
2
|
+
message: string;
|
|
3
|
+
status: number;
|
|
4
|
+
}
|
|
5
|
+
export interface FormErrors {
|
|
6
|
+
name?: string;
|
|
7
|
+
contact?: string;
|
|
8
|
+
host?: string;
|
|
9
|
+
startTime?: string;
|
|
10
|
+
duration?: string;
|
|
11
|
+
channel?: string;
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=form.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"form.d.ts","sourceRoot":"","sources":["../../src/constants/form.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,gBAAgB;IAC/B,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,UAAU;IACzB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"form.js","sourceRoot":"","sources":["../../src/constants/form.ts"],"names":[],"mappings":"","sourcesContent":["export interface StatusSubmitType {\n message: string;\n status: number;\n}\n\nexport interface FormErrors {\n name?: string;\n contact?: string;\n host?: string;\n startTime?: string;\n duration?: string;\n channel?: string;\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/features/AgentWidget/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/features/AgentWidget/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAQ3B,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,iBAAiB,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAE5E,MAAM,MAAM,QAAQ,GAAG;IACrB,QAAQ,EAAE,CAAC,IAAI,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;IAClC,cAAc,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;CACrC,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG;IAC5B,OAAO,EAAE,MAAM,CAAC;IAChB,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rC,CAAC;AACF,QAAA,MAAM,WAAW,EAAE,EAAE,CAAC,eAAe,CA+BpC,CAAC;AAEF,eAAe,WAAW,CAAC"}
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import reactDatepickerStyle from 'react-datepicker/dist/react-datepicker.css';
|
|
3
|
+
import reactPhoneNumberInputStyle from 'react-phone-number-input/style.css';
|
|
2
4
|
import commonStyles from '../../assets/common.css';
|
|
3
5
|
import Agent from '../../components/Agent';
|
|
4
6
|
import { AudioMessagePlayerProvider } from '../../hooks/useAudioMesseagePlayer';
|
|
5
7
|
import { ChatDataProvider } from '../../hooks/useChatData';
|
|
6
8
|
import { ConfigurationProvider } from '../../hooks/useConfiguration';
|
|
7
9
|
const AgentWidget = (props) => {
|
|
8
|
-
return (_jsxs("div", { className: "w-full h-full", children: [_jsx("style", { children: commonStyles }), _jsx(ConfigurationProvider, { config: {
|
|
10
|
+
return (_jsxs("div", { className: "w-full h-full", children: [_jsx("style", { children: commonStyles }), _jsx("style", { children: reactPhoneNumberInputStyle }), _jsx("style", { children: reactDatepickerStyle }), _jsx(ConfigurationProvider, { config: {
|
|
9
11
|
apiHost: props.apiHost,
|
|
10
12
|
agentId: props.agentId,
|
|
11
13
|
voice: props.voice,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/features/AgentWidget/index.tsx"],"names":[],"mappings":";AACA,OAAO,YAAY,MAAM,yBAAyB,CAAC;AACnD,OAAO,KAAK,MAAM,wBAAwB,CAAC;AAC3C,OAAO,EAAE,0BAA0B,EAAE,MAAM,oCAAoC,CAAC;AAChF,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAC;AA+CrE,MAAM,WAAW,GAAwB,CAAC,KAAsB,EAAE,EAAE;IAClE,OAAO,CACL,eAAK,SAAS,EAAC,eAAe,aAC5B,0BAAQ,YAAY,GAAS,EAC7B,KAAC,qBAAqB,IACpB,MAAM,EAAE;oBACN,OAAO,EAAE,KAAK,CAAC,OAAO;oBACtB,OAAO,EAAE,KAAK,CAAC,OAAO;oBACtB,KAAK,EAAE,KAAK,CAAC,KAAK;oBAClB,cAAc,EAAE,KAAK,CAAC,cAAc,EAAE,cAAc;oBACpD,KAAK,EAAE,KAAK,CAAC,KAAK;oBAClB,cAAc,EAAE,KAAK,CAAC,cAAc,EAAE,cAAc;oBACpD,QAAQ,EAAE,KAAK,CAAC,QAAQ;iBACzB,YAED,KAAC,gBAAgB,IACf,IAAI,EAAE;wBACJ,MAAM,EAAE,KAAK,CAAC,cAAc,EAAE,MAAM;wBACpC,gBAAgB,EAAE,KAAK,CAAC,cAAc,EAAE,gBAAgB;wBACxD,SAAS,EAAE,KAAK,CAAC,SAAS;qBAC3B,YAED,KAAC,0BAA0B,cACzB,KAAC,KAAK,KAAG,GACkB,GACZ,GACG,IACpB,CACP,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,WAAW,CAAC","sourcesContent":["import { FC } from 'react';\nimport commonStyles from '../../assets/common.css';\nimport Agent from '../../components/Agent';\nimport { AudioMessagePlayerProvider } from '../../hooks/useAudioMesseagePlayer';\nimport { ChatDataProvider } from '../../hooks/useChatData';\nimport { ConfigurationProvider } from '../../hooks/useConfiguration';\nimport { EVENT_TYPE } from '../../models';\nimport { ConfigMessageType, SuggestionType } from '../../types/common.type';\n\nexport type ToolType = {\n setInput: (text?: string) => void;\n startRecording: () => Promise<void>;\n};\n\nexport type AgentWidgetType = {\n apiHost: string;\n agentId: string;\n voice?: {\n enable?: boolean;\n livekitUrl: string;\n };\n overrideConfig?: {\n chatId?: string | undefined;\n overrideConfig?: Record<string, unknown>;\n suggestedActions?: SuggestionType[];\n skipSuggestion?: boolean;\n } & Record<string, unknown>;\n theme?: {\n botMessage?: ConfigMessageType;\n userMessage?: ConfigMessageType;\n suggestion?: {\n defaultRows?: number; // only for scroll mode\n expandedRows?: number; // only for scroll mode\n layoutMode?: 'grid' | 'scroll';\n };\n input?: {\n placeholder?: string;\n recordingPlaceholder?: string;\n transcribingPlaceholder?: string;\n };\n overview?: {\n title: string;\n description?: string;\n };\n buttons?: {\n textBtnSpeak?: string;\n textBtnTalk?: string;\n };\n } & Record<string, unknown>;\n listeners?: Record<EVENT_TYPE, (props: any) => void>;\n onLoaded?: (tool: ToolType) => void;\n};\nconst AgentWidget: FC<AgentWidgetType> = (props: AgentWidgetType) => {\n return (\n <div className=\"w-full h-full\">\n <style>{commonStyles}</style>\n <ConfigurationProvider\n config={{\n apiHost: props.apiHost,\n agentId: props.agentId,\n voice: props.voice,\n overrideConfig: props.overrideConfig?.overrideConfig,\n theme: props.theme,\n skipSuggestion: props.overrideConfig?.skipSuggestion,\n onLoaded: props.onLoaded,\n }}\n >\n <ChatDataProvider\n data={{\n chatId: props.overrideConfig?.chatId,\n suggestedActions: props.overrideConfig?.suggestedActions,\n listeners: props.listeners,\n }}\n >\n <AudioMessagePlayerProvider>\n <Agent />\n </AudioMessagePlayerProvider>\n </ChatDataProvider>\n </ConfigurationProvider>\n </div>\n );\n};\n\nexport default AgentWidget;\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/features/AgentWidget/index.tsx"],"names":[],"mappings":";AACA,OAAO,oBAAoB,MAAM,4CAA4C,CAAC;AAC9E,OAAO,0BAA0B,MAAM,oCAAoC,CAAC;AAC5E,OAAO,YAAY,MAAM,yBAAyB,CAAC;AACnD,OAAO,KAAK,MAAM,wBAAwB,CAAC;AAC3C,OAAO,EAAE,0BAA0B,EAAE,MAAM,oCAAoC,CAAC;AAChF,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAC;AA+CrE,MAAM,WAAW,GAAwB,CAAC,KAAsB,EAAE,EAAE;IAClE,OAAO,CACL,eAAK,SAAS,EAAC,eAAe,aAC5B,0BAAQ,YAAY,GAAS,EAC7B,0BAAQ,0BAA0B,GAAS,EAC3C,0BAAQ,oBAAoB,GAAS,EACrC,KAAC,qBAAqB,IACpB,MAAM,EAAE;oBACN,OAAO,EAAE,KAAK,CAAC,OAAO;oBACtB,OAAO,EAAE,KAAK,CAAC,OAAO;oBACtB,KAAK,EAAE,KAAK,CAAC,KAAK;oBAClB,cAAc,EAAE,KAAK,CAAC,cAAc,EAAE,cAAc;oBACpD,KAAK,EAAE,KAAK,CAAC,KAAK;oBAClB,cAAc,EAAE,KAAK,CAAC,cAAc,EAAE,cAAc;oBACpD,QAAQ,EAAE,KAAK,CAAC,QAAQ;iBACzB,YAED,KAAC,gBAAgB,IACf,IAAI,EAAE;wBACJ,MAAM,EAAE,KAAK,CAAC,cAAc,EAAE,MAAM;wBACpC,gBAAgB,EAAE,KAAK,CAAC,cAAc,EAAE,gBAAgB;wBACxD,SAAS,EAAE,KAAK,CAAC,SAAS;qBAC3B,YAED,KAAC,0BAA0B,cACzB,KAAC,KAAK,KAAG,GACkB,GACZ,GACG,IACpB,CACP,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,WAAW,CAAC","sourcesContent":["import { FC } from 'react';\nimport reactDatepickerStyle from 'react-datepicker/dist/react-datepicker.css';\nimport reactPhoneNumberInputStyle from 'react-phone-number-input/style.css';\nimport commonStyles from '../../assets/common.css';\nimport Agent from '../../components/Agent';\nimport { AudioMessagePlayerProvider } from '../../hooks/useAudioMesseagePlayer';\nimport { ChatDataProvider } from '../../hooks/useChatData';\nimport { ConfigurationProvider } from '../../hooks/useConfiguration';\nimport { EVENT_TYPE } from '../../models';\nimport { ConfigMessageType, SuggestionType } from '../../types/common.type';\n\nexport type ToolType = {\n setInput: (text?: string) => void;\n startRecording: () => Promise<void>;\n};\n\nexport type AgentWidgetType = {\n apiHost: string;\n agentId: string;\n voice?: {\n enable?: boolean;\n livekitUrl: string;\n };\n overrideConfig?: {\n chatId?: string | undefined;\n overrideConfig?: Record<string, unknown>;\n suggestedActions?: SuggestionType[];\n skipSuggestion?: boolean;\n } & Record<string, unknown>;\n theme?: {\n botMessage?: ConfigMessageType;\n userMessage?: ConfigMessageType;\n suggestion?: {\n defaultRows?: number; // only for scroll mode\n expandedRows?: number; // only for scroll mode\n layoutMode?: 'grid' | 'scroll';\n };\n input?: {\n placeholder?: string;\n recordingPlaceholder?: string;\n transcribingPlaceholder?: string;\n };\n overview?: {\n title: string;\n description?: string;\n };\n buttons?: {\n textBtnSpeak?: string;\n textBtnTalk?: string;\n };\n } & Record<string, unknown>;\n listeners?: Record<EVENT_TYPE, (props: any) => void>;\n onLoaded?: (tool: ToolType) => void;\n};\nconst AgentWidget: FC<AgentWidgetType> = (props: AgentWidgetType) => {\n return (\n <div className=\"w-full h-full\">\n <style>{commonStyles}</style>\n <style>{reactPhoneNumberInputStyle}</style>\n <style>{reactDatepickerStyle}</style>\n <ConfigurationProvider\n config={{\n apiHost: props.apiHost,\n agentId: props.agentId,\n voice: props.voice,\n overrideConfig: props.overrideConfig?.overrideConfig,\n theme: props.theme,\n skipSuggestion: props.overrideConfig?.skipSuggestion,\n onLoaded: props.onLoaded,\n }}\n >\n <ChatDataProvider\n data={{\n chatId: props.overrideConfig?.chatId,\n suggestedActions: props.overrideConfig?.suggestedActions,\n listeners: props.listeners,\n }}\n >\n <AudioMessagePlayerProvider>\n <Agent />\n </AudioMessagePlayerProvider>\n </ChatDataProvider>\n </ConfigurationProvider>\n </div>\n );\n};\n\nexport default AgentWidget;\n"]}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import React, { createContext, useEffect, useRef, useState } from 'react';
|
|
3
|
-
import {
|
|
3
|
+
import { useScrollContainer } from './useScrollContainer';
|
|
4
4
|
const AudioMessagePlayerContext = createContext(undefined);
|
|
5
5
|
export const AudioMessagePlayerProvider = ({ children, }) => {
|
|
6
6
|
const [playingId, setPlayingId] = useState(null);
|
|
7
7
|
const [disable, setDisabled] = useState(false);
|
|
8
8
|
const timeoutRef = useRef(null);
|
|
9
|
-
const scroll =
|
|
9
|
+
const scroll = useScrollContainer();
|
|
10
10
|
const onPlay = (messageId, stopping = false) => {
|
|
11
11
|
if (!timeoutRef.current) {
|
|
12
12
|
scroll[2](false);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useAudioMesseagePlayer.js","sourceRoot":"","sources":["../../src/hooks/useAudioMesseagePlayer.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,EAAE,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC1E,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"useAudioMesseagePlayer.js","sourceRoot":"","sources":["../../src/hooks/useAudioMesseagePlayer.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,EAAE,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC1E,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAS1D,MAAM,yBAAyB,GAAG,aAAa,CAE7C,SAAS,CAAC,CAAC;AAEb,MAAM,CAAC,MAAM,0BAA0B,GAAG,CAAC,EACzC,QAAQ,GAGT,EAAE,EAAE;IACH,MAAM,CAAC,SAAS,EAAE,YAAY,CAAC,GAAG,QAAQ,CAAgB,IAAI,CAAC,CAAC;IAChE,MAAM,CAAC,OAAO,EAAE,WAAW,CAAC,GAAG,QAAQ,CAAU,KAAK,CAAC,CAAC;IACxD,MAAM,UAAU,GAAG,MAAM,CAAwB,IAAI,CAAC,CAAC;IACvD,MAAM,MAAM,GAAG,kBAAkB,EAAkB,CAAC;IAEpD,MAAM,MAAM,GAAG,CAAC,SAAwB,EAAE,WAAoB,KAAK,EAAE,EAAE;QACrE,IAAI,CAAC,UAAU,CAAC,OAAO,EAAE,CAAC;YACxB,MAAM,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;YACjB,UAAU,CAAC,OAAO,GAAG,UAAU,CAAC,GAAG,EAAE;gBACnC,MAAM,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;gBAChB,UAAU,CAAC,OAAO,GAAG,IAAI,CAAC;YAC5B,CAAC,EAAE,GAAG,CAAC,CAAC;QACV,CAAC;QAED,IAAI,QAAQ,IAAI,SAAS,KAAK,SAAS,EAAE,CAAC;YACxC,OAAO;QACT,CAAC;QAED,MAAM,KAAK,GAAG,QAAQ,IAAI,SAAS,KAAK,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC;QACrE,YAAY,CAAC,KAAK,CAAC,CAAC;IACtB,CAAC,CAAC;IAEF,SAAS,CAAC,GAAG,EAAE,GAAE,CAAC,EAAE,EAAE,CAAC,CAAC;IAExB,OAAO,CACL,KAAC,yBAAyB,CAAC,QAAQ,IACjC,KAAK,EAAE;YACL,SAAS;YACT,MAAM;YACN,OAAO;YACP,WAAW;SACZ,YAEA,QAAQ,GAC0B,CACtC,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,eAAe,GAAG,GAAG,EAAE;IAClC,MAAM,OAAO,GAAG,KAAK,CAAC,UAAU,CAAC,yBAAyB,CAAC,CAAC;IAC5D,IAAI,OAAO,KAAK,SAAS,EAAE,CAAC;QAC1B,MAAM,IAAI,KAAK,CACb,iEAAiE,CAClE,CAAC;IACJ,CAAC;IACD,OAAO,OAAO,CAAC;AACjB,CAAC,CAAC","sourcesContent":["import React, { createContext, useEffect, useRef, useState } from 'react';\nimport { useScrollContainer } from './useScrollContainer';\n\ntype AudioMessagePlayerData = {\n playingId: string | null;\n disable: boolean;\n onPlay: (messageId: string | null, stopping?: boolean) => void;\n setDisabled: (value: boolean) => void;\n};\n\nconst AudioMessagePlayerContext = createContext<\n AudioMessagePlayerData | undefined\n>(undefined);\n\nexport const AudioMessagePlayerProvider = ({\n children,\n}: {\n children: React.ReactNode;\n}) => {\n const [playingId, setPlayingId] = useState<string | null>(null);\n const [disable, setDisabled] = useState<boolean>(false);\n const timeoutRef = useRef<NodeJS.Timeout | null>(null);\n const scroll = useScrollContainer<HTMLDivElement>();\n\n const onPlay = (messageId: string | null, stopping: boolean = false) => {\n if (!timeoutRef.current) {\n scroll[2](false);\n timeoutRef.current = setTimeout(() => {\n scroll[2](true);\n timeoutRef.current = null;\n }, 300);\n }\n\n if (stopping && messageId !== playingId) {\n return;\n }\n\n const msgId = stopping && messageId === playingId ? null : messageId;\n setPlayingId(msgId);\n };\n\n useEffect(() => {}, []);\n\n return (\n <AudioMessagePlayerContext.Provider\n value={{\n playingId,\n onPlay,\n disable,\n setDisabled,\n }}\n >\n {children}\n </AudioMessagePlayerContext.Provider>\n );\n};\n\nexport const useAudioMessage = () => {\n const context = React.useContext(AudioMessagePlayerContext);\n if (context === undefined) {\n throw new Error(\n 'useAudioMessage must be used within a AudioMessagePlayerContext'\n );\n }\n return context;\n};\n"]}
|
|
@@ -66,6 +66,21 @@ type ConfigurationData = {
|
|
|
66
66
|
needFillContactOrEmail?: string;
|
|
67
67
|
};
|
|
68
68
|
};
|
|
69
|
+
bookMeetingForm?: {
|
|
70
|
+
title?: string;
|
|
71
|
+
labelDate?: string;
|
|
72
|
+
labelTime?: string;
|
|
73
|
+
labelDuration?: string;
|
|
74
|
+
labelChannel?: string;
|
|
75
|
+
labelHost?: string;
|
|
76
|
+
messages?: {
|
|
77
|
+
submitError?: string;
|
|
78
|
+
submitSuccess?: string;
|
|
79
|
+
startTimeError?: string;
|
|
80
|
+
durationError?: string;
|
|
81
|
+
channelError?: string;
|
|
82
|
+
};
|
|
83
|
+
};
|
|
69
84
|
} & Record<string, unknown>;
|
|
70
85
|
skipSuggestion?: boolean;
|
|
71
86
|
onLoaded?: (tool: ToolType) => void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useConfiguration.d.ts","sour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EAAE,MAAM,CAAC;YACvB,YAAY,CAAC,EAAE,MAAM,CAAC;YACtB,SAAS,CAAC,EAAE,MAAM,CAAC;YACnB,QAAQ,CAAC,EAAE;gBACT,WAAW,CAAC,EAAE,MAAM,CAAC;gBACrB,aAAa,CAAC,EAAE,MAAM,CAAC;gBACvB,cAAc,CAAC,EAAE,MAAM,CAAC;gBACxB,aAAa,CAAC,EAAE,MAAM,CAAC;gBACvB,YAAY,CAAC,EAAE,MAAM,CAAC;aACvB,CAAC;SACH,CAAC;KACH,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC5B,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,QAAQ,KAAK,IAAI,CAAC;CACrC,CAAC;AAMF,eAAO,MAAM,qBAAqB,0BAG/B;IACD,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,MAAM,EAAE,iBAAiB,CAAC;CAC3B,4CAiBA,CAAC;AAEF,eAAO,MAAM,gBAAgB,yBAQ5B,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useConfiguration.js","sourceRoot":"","sources":["../../src/hooks/useConfiguration.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,EAAE,EAAE,aAAa,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"useConfiguration.js","sourceRoot":"","sources":["../../src/hooks/useConfiguration.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,EAAE,EAAE,aAAa,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAyFlE,MAAM,oBAAoB,GAAG,aAAa,CACxC,SAAS,CACV,CAAC;AAEF,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,EACpC,QAAQ,EACR,MAAM,GAIP,EAAE,EAAE;IACH,MAAM,CAAC,aAAa,EAAE,gBAAgB,CAAC,GAAG,QAAQ,CAAoB;QACpE,GAAG,MAAM;KACV,CAAC,CAAC;IAEH,SAAS,CAAC,GAAG,EAAE;QACb,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;YACpB,MAAM,IAAI,KAAK,CAAC,qBAAqB,CAAC,CAAC;QACzC,CAAC;QACD,gBAAgB,CAAC,MAAM,CAAC,CAAC;IAC3B,CAAC,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC;IAEb,OAAO,CACL,KAAC,oBAAoB,CAAC,QAAQ,IAAC,KAAK,EAAE,aAAa,YAChD,QAAQ,GACqB,CACjC,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,gBAAgB,GAAG,GAAG,EAAE;IACnC,MAAM,OAAO,GAAG,KAAK,CAAC,UAAU,CAAC,oBAAoB,CAAC,CAAC;IACvD,IAAI,OAAO,KAAK,SAAS,EAAE,CAAC;QAC1B,MAAM,IAAI,KAAK,CACb,8DAA8D,CAC/D,CAAC;IACJ,CAAC;IACD,OAAO,OAAO,CAAC;AACjB,CAAC,CAAC","sourcesContent":["import React, { createContext, useEffect, useState } from 'react';\nimport { ConfigMessageType } from 'types/common.type';\nimport { ToolType } from '../features/AgentWidget';\n\ntype ConfigurationData = {\n apiHost: string;\n agentId: string;\n voice?: {\n enable?: boolean;\n livekitUrl: string;\n };\n overrideConfig?: Record<string, any>;\n theme?: {\n simplified?: boolean;\n modeButtonChat?: boolean;\n gapInput?: number;\n welcomeMessage?: string;\n noAutoplayMessage?: boolean;\n autoCloseAudioPlayer?: boolean;\n hideAudioMetadata?: boolean;\n suggestion?: {\n defaultRows?: number; // only for scroll mode\n expandedRows?: number; // only for scroll mode\n layoutMode?: 'grid' | 'scroll';\n };\n botMessage?: ConfigMessageType;\n userMessage?: ConfigMessageType;\n input?: {\n placeholder?: string;\n recordingPlaceholder?: string;\n transcribingPlaceholder?: string;\n };\n overview?: {\n title: string;\n description?: string;\n };\n buttons?: {\n textBtnSpeak?: string;\n textBtnTalk?: string;\n textBtnSubmit?: string;\n };\n header?: {\n title?: string;\n };\n language?: {\n code?: string;\n options?: {\n code?: string;\n name?: string;\n icon?: string;\n }[];\n };\n userContactForm?: {\n title?: string;\n labelName?: string;\n labelContact?: string;\n labelEmail?: string;\n orConnect?: string;\n messages?: {\n submitError?: string;\n submitSuccess?: string;\n nameError?: string;\n contactError?: string;\n invalidContact?: string;\n emailError?: string;\n invalidEmail?: string;\n needFillContactOrEmail?: string;\n };\n };\n bookMeetingForm?: {\n title?: string;\n labelDate?: string;\n labelTime?: string;\n labelDuration?: string;\n labelChannel?: string;\n labelHost?: string;\n messages?: {\n submitError?: string;\n submitSuccess?: string;\n startTimeError?: string;\n durationError?: string;\n channelError?: string;\n };\n };\n } & Record<string, unknown>;\n skipSuggestion?: boolean;\n onLoaded?: (tool: ToolType) => void;\n};\n\nconst ConfigurationContext = createContext<ConfigurationData | undefined>(\n undefined\n);\n\nexport const ConfigurationProvider = ({\n children,\n config,\n}: {\n children: React.ReactNode;\n config: ConfigurationData;\n}) => {\n const [configuration, setConfiguration] = useState<ConfigurationData>({\n ...config,\n });\n\n useEffect(() => {\n if (!config.apiHost) {\n throw new Error('apiHost is required');\n }\n setConfiguration(config);\n }, [config]);\n\n return (\n <ConfigurationContext.Provider value={configuration}>\n {children}\n </ConfigurationContext.Provider>\n );\n};\n\nexport const useConfiguration = () => {\n const context = React.useContext(ConfigurationContext);\n if (context === undefined) {\n throw new Error(\n 'useConfiguration must be used within a ConfigurationProvider'\n );\n }\n return context;\n};\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useScrollContainer.d.ts","sourceRoot":"","sources":["../../src/hooks/useScrollContainer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,SAAS,EAA+B,MAAM,OAAO,CAAC;AAEpE,wBAAgB,kBAAkB,CAAC,CAAC,SAAS,WAAW,KAAK;IAC3D,SAAS,CAAC,CAAC,CAAC;IACZ,SAAS,CAAC,CAAC,CAAC;IACZ,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI;IACvB,OAAO;IACP,MAAM,IAAI;CACX,CA0EA"}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { useEffect, useRef, useState } from 'react';
|
|
2
|
+
export function useScrollContainer() {
|
|
3
|
+
const containerRef = useRef(null);
|
|
4
|
+
const endRef = useRef(null);
|
|
5
|
+
const disabledRef = useRef(false);
|
|
6
|
+
const [showScrollToTop, setShowScrollToTop] = useState(false);
|
|
7
|
+
const toggleScrollToBottom = (bool) => {
|
|
8
|
+
disabledRef.current = !bool;
|
|
9
|
+
};
|
|
10
|
+
const scrollToTop = () => {
|
|
11
|
+
const container = containerRef.current;
|
|
12
|
+
if (container) {
|
|
13
|
+
container.scrollTo({ top: 0, behavior: 'smooth' });
|
|
14
|
+
}
|
|
15
|
+
};
|
|
16
|
+
useEffect(() => {
|
|
17
|
+
const container = containerRef.current;
|
|
18
|
+
const end = endRef.current;
|
|
19
|
+
if (container && end) {
|
|
20
|
+
const observer = new MutationObserver(() => {
|
|
21
|
+
if (!disabledRef.current) {
|
|
22
|
+
end.scrollIntoView({ behavior: 'instant', block: 'end' });
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
observer.observe(container, {
|
|
26
|
+
childList: true,
|
|
27
|
+
subtree: true,
|
|
28
|
+
attributes: true,
|
|
29
|
+
characterData: true,
|
|
30
|
+
});
|
|
31
|
+
return () => observer.disconnect();
|
|
32
|
+
}
|
|
33
|
+
}, []);
|
|
34
|
+
// Detect scroll state to show/hide scroll to top button
|
|
35
|
+
useEffect(() => {
|
|
36
|
+
const container = containerRef.current;
|
|
37
|
+
if (!container)
|
|
38
|
+
return;
|
|
39
|
+
const handleScroll = () => {
|
|
40
|
+
const { scrollTop, scrollHeight, clientHeight } = container;
|
|
41
|
+
const isScrollable = scrollHeight > clientHeight;
|
|
42
|
+
const isScrolledDown = scrollTop > 100; // Show button when scrolled down 100px
|
|
43
|
+
setShowScrollToTop(isScrollable && isScrolledDown);
|
|
44
|
+
};
|
|
45
|
+
// Initial check
|
|
46
|
+
handleScroll();
|
|
47
|
+
container.addEventListener('scroll', handleScroll);
|
|
48
|
+
// Also check on resize
|
|
49
|
+
const resizeObserver = new ResizeObserver(handleScroll);
|
|
50
|
+
resizeObserver.observe(container);
|
|
51
|
+
return () => {
|
|
52
|
+
container.removeEventListener('scroll', handleScroll);
|
|
53
|
+
resizeObserver.disconnect();
|
|
54
|
+
};
|
|
55
|
+
}, []);
|
|
56
|
+
return [
|
|
57
|
+
containerRef,
|
|
58
|
+
endRef,
|
|
59
|
+
toggleScrollToBottom,
|
|
60
|
+
showScrollToTop,
|
|
61
|
+
scrollToTop,
|
|
62
|
+
];
|
|
63
|
+
}
|
|
64
|
+
//# sourceMappingURL=useScrollContainer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useScrollContainer.js","sourceRoot":"","sources":["../../src/hooks/useScrollContainer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkB,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAEpE,MAAM,UAAU,kBAAkB;IAOhC,MAAM,YAAY,GAAG,MAAM,CAAI,IAAI,CAAC,CAAC;IACrC,MAAM,MAAM,GAAG,MAAM,CAAI,IAAI,CAAC,CAAC;IAC/B,MAAM,WAAW,GAAG,MAAM,CAAU,KAAK,CAAC,CAAC;IAC3C,MAAM,CAAC,eAAe,EAAE,kBAAkB,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;IAE9D,MAAM,oBAAoB,GAAG,CAAC,IAAa,EAAE,EAAE;QAC7C,WAAW,CAAC,OAAO,GAAG,CAAC,IAAI,CAAC;IAC9B,CAAC,CAAC;IAEF,MAAM,WAAW,GAAG,GAAG,EAAE;QACvB,MAAM,SAAS,GAAG,YAAY,CAAC,OAAO,CAAC;QACvC,IAAI,SAAS,EAAE,CAAC;YACd,SAAS,CAAC,QAAQ,CAAC,EA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;QAEf,SAAS,CAAC,gBAAgB,CAAC,QAAQ,EAAE,YAAY,CAAC,CAAC;QAEnD,uBAAuB;QACvB,MAAM,cAAc,GAAG,IAAI,cAAc,CAAC,YAAY,CAAC,CAAC;QACxD,cAAc,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;QAElC,OAAO,GAAG,EAAE;YACV,SAAS,CAAC,mBAAmB,CAAC,QAAQ,EAAE,YAAY,CAAC,CAAC;YACtD,cAAc,CAAC,UAAU,EAAE,CAAC;QAC9B,CAAC,CAAC;IACJ,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,OAAO;QACL,YAAY;QACZ,MAAM;QACN,oBAAoB;QACpB,eAAe;QACf,WAAW;KACZ,CAAC;AACJ,CAAC","sourcesContent":["import { type RefObject, useEffect, useRef, useState } from 'react';\n\nexport function useScrollContainer<T extends HTMLElement>(): [\n RefObject<T>,\n RefObject<T>,\n (bool: boolean) => void,\n boolean,\n () => void,\n] {\n const containerRef = useRef<T>(null);\n const endRef = useRef<T>(null);\n const disabledRef = useRef<boolean>(false);\n const [showScrollToTop, setShowScrollToTop] = useState(false);\n\n const toggleScrollToBottom = (bool: boolean) => {\n disabledRef.current = !bool;\n };\n\n const scrollToTop = () => {\n const container = containerRef.current;\n if (container) {\n container.scrollTo({ top: 0, behavior: 'smooth' });\n }\n };\n\n useEffect(() => {\n const container = containerRef.current;\n const end = endRef.current;\n\n if (container && end) {\n const observer = new MutationObserver(() => {\n if (!disabledRef.current) {\n end.scrollIntoView({ behavior: 'instant', block: 'end' });\n }\n });\n\n observer.observe(container, {\n childList: true,\n subtree: true,\n attributes: true,\n characterData: true,\n });\n\n return () => observer.disconnect();\n }\n }, []);\n\n // Detect scroll state to show/hide scroll to top button\n useEffect(() => {\n const container = containerRef.current;\n if (!container) return;\n\n const handleScroll = () => {\n const { scrollTop, scrollHeight, clientHeight } = container;\n const isScrollable = scrollHeight > clientHeight;\n const isScrolledDown = scrollTop > 100; // Show button when scrolled down 100px\n\n setShowScrollToTop(isScrollable && isScrolledDown);\n };\n\n // Initial check\n handleScroll();\n\n container.addEventListener('scroll', handleScroll);\n\n // Also check on resize\n const resizeObserver = new ResizeObserver(handleScroll);\n resizeObserver.observe(container);\n\n return () => {\n container.removeEventListener('scroll', handleScroll);\n resizeObserver.disconnect();\n };\n }, []);\n\n return [\n containerRef,\n endRef,\n toggleScrollToBottom,\n showScrollToTop,\n scrollToTop,\n ];\n}\n"]}
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { type RefObject } from 'react';
|
|
2
|
-
export declare function
|
|
2
|
+
export declare function useScrollContainer<T extends HTMLElement>(): [
|
|
3
3
|
RefObject<T>,
|
|
4
4
|
RefObject<T>,
|
|
5
|
-
(bool: boolean) => void
|
|
5
|
+
(bool: boolean) => void,
|
|
6
|
+
boolean,
|
|
7
|
+
() => void
|
|
6
8
|
];
|
|
7
9
|
//# sourceMappingURL=useScrollToBottom.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useScrollToBottom.d.ts","sourceRoot":"","sources":["../../src/hooks/useScrollToBottom.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,SAAS,
|
|
1
|
+
{"version":3,"file":"useScrollToBottom.d.ts","sourceRoot":"","sources":["../../src/hooks/useScrollToBottom.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,SAAS,EAA+B,MAAM,OAAO,CAAC;AAEpE,wBAAgB,kBAAkB,CAAC,CAAC,SAAS,WAAW,KAAK;IAC3D,SAAS,CAAC,CAAC,CAAC;IACZ,SAAS,CAAC,CAAC,CAAC;IACZ,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI;IACvB,OAAO;IACP,MAAM,IAAI;CACX,CA0EA"}
|
|
@@ -1,11 +1,18 @@
|
|
|
1
|
-
import { useEffect, useRef } from 'react';
|
|
2
|
-
export function
|
|
1
|
+
import { useEffect, useRef, useState } from 'react';
|
|
2
|
+
export function useScrollContainer() {
|
|
3
3
|
const containerRef = useRef(null);
|
|
4
4
|
const endRef = useRef(null);
|
|
5
5
|
const disabledRef = useRef(false);
|
|
6
|
+
const [showScrollToTop, setShowScrollToTop] = useState(false);
|
|
6
7
|
const toggleScrollToBottom = (bool) => {
|
|
7
8
|
disabledRef.current = !bool;
|
|
8
9
|
};
|
|
10
|
+
const scrollToTop = () => {
|
|
11
|
+
const container = containerRef.current;
|
|
12
|
+
if (container) {
|
|
13
|
+
container.scrollTo({ top: 0, behavior: 'smooth' });
|
|
14
|
+
}
|
|
15
|
+
};
|
|
9
16
|
useEffect(() => {
|
|
10
17
|
const container = containerRef.current;
|
|
11
18
|
const end = endRef.current;
|
|
@@ -24,6 +31,34 @@ export function useScrollToBottom() {
|
|
|
24
31
|
return () => observer.disconnect();
|
|
25
32
|
}
|
|
26
33
|
}, []);
|
|
27
|
-
|
|
34
|
+
// Detect scroll state to show/hide scroll to top button
|
|
35
|
+
useEffect(() => {
|
|
36
|
+
const container = containerRef.current;
|
|
37
|
+
if (!container)
|
|
38
|
+
return;
|
|
39
|
+
const handleScroll = () => {
|
|
40
|
+
const { scrollTop, scrollHeight, clientHeight } = container;
|
|
41
|
+
const isScrollable = scrollHeight > clientHeight;
|
|
42
|
+
const isScrolledDown = scrollTop > 100; // Show button when scrolled down 100px
|
|
43
|
+
setShowScrollToTop(isScrollable && isScrolledDown);
|
|
44
|
+
};
|
|
45
|
+
// Initial check
|
|
46
|
+
handleScroll();
|
|
47
|
+
container.addEventListener('scroll', handleScroll);
|
|
48
|
+
// Also check on resize
|
|
49
|
+
const resizeObserver = new ResizeObserver(handleScroll);
|
|
50
|
+
resizeObserver.observe(container);
|
|
51
|
+
return () => {
|
|
52
|
+
container.removeEventListener('scroll', handleScroll);
|
|
53
|
+
resizeObserver.disconnect();
|
|
54
|
+
};
|
|
55
|
+
}, []);
|
|
56
|
+
return [
|
|
57
|
+
containerRef,
|
|
58
|
+
endRef,
|
|
59
|
+
toggleScrollToBottom,
|
|
60
|
+
showScrollToTop,
|
|
61
|
+
scrollToTop,
|
|
62
|
+
];
|
|
28
63
|
}
|
|
29
64
|
//# sourceMappingURL=useScrollToBottom.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useScrollToBottom.js","sourceRoot":"","sources":["../../src/hooks/useScrollToBottom.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkB,SAAS,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"useScrollToBottom.js","sourceRoot":"","sources":["../../src/hooks/useScrollToBottom.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkB,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAEpE,MAAM,UAAU,kBAAkB;IAOhC,MAAM,YAAY,GAAG,MAAM,CAAI,IAAI,CAAC,CAAC;IACrC,MAAM,MAAM,GAAG,MAAM,CAAI,IAAI,CAAC,CAAC;IAC/B,MAAM,WAAW,GAAG,MAAM,CAAU,KAAK,CAAC,CAAC;IAC3C,MAAM,CAAC,eAAe,EAAE,kBAAkB,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;IAE9D,MAAM,oBAAoB,GAAG,CAAC,IAAa,EAAE,EAAE;QAC7C,WAAW,CAAC,OAAO,GAAG,CAAC,IAAI,CAAC;IAC9B,CAAC,CAAC;IAEF,MAAM,WAAW,GAAG,GAAG,EAAE;QACvB,MAAM,SAAS,GAAG,YAAY,CAAC,OAAO,CAAC;QACvC,IAAI,SAAS,EAAE,CAAC;YACd,SAAS,CAAC,QAAQ,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,QAAQ,EAAE,QAAQ,EAAE,CAAC,CAAC;QACrD,CAAC;IACH,CAAC,CAAC;IAEF,SAAS,CAAC,GAAG,EAAE;QACb,MAAM,SAAS,GAAG,YAAY,CAAC,OAAO,CAAC;QACvC,MAAM,GAAG,GAAG,MAAM,CAAC,OAAO,CAAC;QAE3B,IAAI,SAAS,IAAI,GAAG,EAA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E,YAAY,CAAC,CAAC;YACtD,cAAc,CAAC,UAAU,EAAE,CAAC;QAC9B,CAAC,CAAC;IACJ,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,OAAO;QACL,YAAY;QACZ,MAAM;QACN,oBAAoB;QACpB,eAAe;QACf,WAAW;KACZ,CAAC;AACJ,CAAC","sourcesContent":["import { type RefObject, useEffect, useRef, useState } from 'react';\n\nexport function useScrollContainer<T extends HTMLElement>(): [\n RefObject<T>,\n RefObject<T>,\n (bool: boolean) => void,\n boolean,\n () => void,\n] {\n const containerRef = useRef<T>(null);\n const endRef = useRef<T>(null);\n const disabledRef = useRef<boolean>(false);\n const [showScrollToTop, setShowScrollToTop] = useState(false);\n\n const toggleScrollToBottom = (bool: boolean) => {\n disabledRef.current = !bool;\n };\n\n const scrollToTop = () => {\n const container = containerRef.current;\n if (container) {\n container.scrollTo({ top: 0, behavior: 'smooth' });\n }\n };\n\n useEffect(() => {\n const container = containerRef.current;\n const end = endRef.current;\n\n if (container && end) {\n const observer = new MutationObserver(() => {\n if (!disabledRef.current) {\n end.scrollIntoView({ behavior: 'instant', block: 'end' });\n }\n });\n\n observer.observe(container, {\n childList: true,\n subtree: true,\n attributes: true,\n characterData: true,\n });\n\n return () => observer.disconnect();\n }\n }, []);\n\n // Detect scroll state to show/hide scroll to top button\n useEffect(() => {\n const container = containerRef.current;\n if (!container) return;\n\n const handleScroll = () => {\n const { scrollTop, scrollHeight, clientHeight } = container;\n const isScrollable = scrollHeight > clientHeight;\n const isScrolledDown = scrollTop > 100; // Show button when scrolled down 100px\n\n setShowScrollToTop(isScrollable && isScrolledDown);\n };\n\n // Initial check\n handleScroll();\n\n container.addEventListener('scroll', handleScroll);\n\n // Also check on resize\n const resizeObserver = new ResizeObserver(handleScroll);\n resizeObserver.observe(container);\n\n return () => {\n container.removeEventListener('scroll', handleScroll);\n resizeObserver.disconnect();\n };\n }, []);\n\n return [\n containerRef,\n endRef,\n toggleScrollToBottom,\n showScrollToTop,\n scrollToTop,\n ];\n}\n"]}
|
|
@@ -5,4 +5,6 @@ export declare const API_PREDICTION = "/chats/prediction";
|
|
|
5
5
|
export declare const API_CHATBOTS = "/ext/v1/bots";
|
|
6
6
|
export declare const API_CREATE_ATTACHMENTS = "/chats/attachments";
|
|
7
7
|
export declare const API_SUGGESTIONS = "/chats/suggestions";
|
|
8
|
+
export declare const API_USER_CONTACTS = "/ext/v1/user-contacts";
|
|
9
|
+
export declare const API_BOOK_MEETING = "/ext/v1/book-meetings";
|
|
8
10
|
//# sourceMappingURL=apis.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"apis.d.ts","sourceRoot":"","sources":["../../src/services/apis.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,WAAW,YAAY,CAAC;AACrC,eAAO,MAAM,SAAS,WAAW,CAAC;AAElC,eAAO,MAAM,gBAAgB,uBAA6B,CAAC;AAE3D,eAAO,MAAM,cAAc,sBAA4B,CAAC;AAExD,eAAO,MAAM,YAAY,iBAAwB,CAAC;AAElD,eAAO,MAAM,sBAAsB,uBAA6B,CAAC;AAEjE,eAAO,MAAM,eAAe,uBAA6B,CAAC"}
|
|
1
|
+
{"version":3,"file":"apis.d.ts","sourceRoot":"","sources":["../../src/services/apis.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,WAAW,YAAY,CAAC;AACrC,eAAO,MAAM,SAAS,WAAW,CAAC;AAElC,eAAO,MAAM,gBAAgB,uBAA6B,CAAC;AAE3D,eAAO,MAAM,cAAc,sBAA4B,CAAC;AAExD,eAAO,MAAM,YAAY,iBAAwB,CAAC;AAElD,eAAO,MAAM,sBAAsB,uBAA6B,CAAC;AAEjE,eAAO,MAAM,eAAe,uBAA6B,CAAC;AAE1D,eAAO,MAAM,iBAAiB,0BAAiC,CAAC;AAEhE,eAAO,MAAM,gBAAgB,0BAAiC,CAAC"}
|
package/.rollup.cache/Users/tungthai/Desktop/Develop/clik-ai-chatbot-embedded/dist/services/apis.js
CHANGED
|
@@ -5,4 +5,6 @@ export const API_PREDICTION = `${API_CHATS}/prediction`;
|
|
|
5
5
|
export const API_CHATBOTS = `${API_VERSION}/bots`;
|
|
6
6
|
export const API_CREATE_ATTACHMENTS = `${API_CHATS}/attachments`;
|
|
7
7
|
export const API_SUGGESTIONS = `${API_CHATS}/suggestions`;
|
|
8
|
+
export const API_USER_CONTACTS = `${API_VERSION}/user-contacts`;
|
|
9
|
+
export const API_BOOK_MEETING = `${API_VERSION}/book-meetings`;
|
|
8
10
|
//# sourceMappingURL=apis.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"apis.js","sourceRoot":"","sources":["../../src/services/apis.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,WAAW,GAAG,SAAS,CAAC;AACrC,MAAM,CAAC,MAAM,SAAS,GAAG,QAAQ,CAAC;AAElC,MAAM,CAAC,MAAM,gBAAgB,GAAG,GAAG,SAAS,cAAc,CAAC;AAE3D,MAAM,CAAC,MAAM,cAAc,GAAG,GAAG,SAAS,aAAa,CAAC;AAExD,MAAM,CAAC,MAAM,YAAY,GAAG,GAAG,WAAW,OAAO,CAAC;AAElD,MAAM,CAAC,MAAM,sBAAsB,GAAG,GAAG,SAAS,cAAc,CAAC;AAEjE,MAAM,CAAC,MAAM,eAAe,GAAG,GAAG,SAAS,cAAc,CAAC","sourcesContent":["export const API_VERSION = '/ext/v1';\nexport const API_CHATS = `/chats`;\n\nexport const API_CHAT_MESSAGE = `${API_CHATS}/chatmessage`;\n\nexport const API_PREDICTION = `${API_CHATS}/prediction`;\n\nexport const API_CHATBOTS = `${API_VERSION}/bots`;\n\nexport const API_CREATE_ATTACHMENTS = `${API_CHATS}/attachments`;\n\nexport const API_SUGGESTIONS = `${API_CHATS}/suggestions`;\n"]}
|
|
1
|
+
{"version":3,"file":"apis.js","sourceRoot":"","sources":["../../src/services/apis.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,WAAW,GAAG,SAAS,CAAC;AACrC,MAAM,CAAC,MAAM,SAAS,GAAG,QAAQ,CAAC;AAElC,MAAM,CAAC,MAAM,gBAAgB,GAAG,GAAG,SAAS,cAAc,CAAC;AAE3D,MAAM,CAAC,MAAM,cAAc,GAAG,GAAG,SAAS,aAAa,CAAC;AAExD,MAAM,CAAC,MAAM,YAAY,GAAG,GAAG,WAAW,OAAO,CAAC;AAElD,MAAM,CAAC,MAAM,sBAAsB,GAAG,GAAG,SAAS,cAAc,CAAC;AAEjE,MAAM,CAAC,MAAM,eAAe,GAAG,GAAG,SAAS,cAAc,CAAC;AAE1D,MAAM,CAAC,MAAM,iBAAiB,GAAG,GAAG,WAAW,gBAAgB,CAAC;AAEhE,MAAM,CAAC,MAAM,gBAAgB,GAAG,GAAG,WAAW,gBAAgB,CAAC","sourcesContent":["export const API_VERSION = '/ext/v1';\nexport const API_CHATS = `/chats`;\n\nexport const API_CHAT_MESSAGE = `${API_CHATS}/chatmessage`;\n\nexport const API_PREDICTION = `${API_CHATS}/prediction`;\n\nexport const API_CHATBOTS = `${API_VERSION}/bots`;\n\nexport const API_CREATE_ATTACHMENTS = `${API_CHATS}/attachments`;\n\nexport const API_SUGGESTIONS = `${API_CHATS}/suggestions`;\n\nexport const API_USER_CONTACTS = `${API_VERSION}/user-contacts`;\n\nexport const API_BOOK_MEETING = `${API_VERSION}/book-meetings`;\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bookMeeting.service.d.ts","sourceRoot":"","sources":["../../src/services/bookMeeting.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAI5D,eAAO,MAAM,iBAAiB,SACtB,eAAe,WACZ,MAAM,KACd,OAAO,CAAC,GAAG,CAYb,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { request } from '../utils/requestUtils';
|
|
2
|
+
import { API_BOOK_MEETING } from './apis';
|
|
3
|
+
export const createBookMeeting = async (data, apiHost) => {
|
|
4
|
+
const headers = {
|
|
5
|
+
'Content-Type': 'application/json',
|
|
6
|
+
};
|
|
7
|
+
return request({
|
|
8
|
+
host: apiHost,
|
|
9
|
+
url: `${API_BOOK_MEETING}`,
|
|
10
|
+
headers,
|
|
11
|
+
method: 'POST',
|
|
12
|
+
body: JSON.stringify(data),
|
|
13
|
+
});
|
|
14
|
+
};
|
|
15
|
+
//# sourceMappingURL=bookMeeting.service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bookMeeting.service.js","sourceRoot":"","sources":["../../src/services/bookMeeting.service.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAChD,OAAO,EAAE,gBAAgB,EAAE,MAAM,QAAQ,CAAC;AAE1C,MAAM,CAAC,MAAM,iBAAiB,GAAG,KAAK,EACpC,IAAqB,EACrB,OAAe,EACD,EAAE;IAChB,MAAM,OAAO,GAAG;QACd,cAAc,EAAE,kBAAkB;KACnC,CAAC;IAEF,OAAO,OAAO,CAAC;QACb,IAAI,EAAE,OAAO;QACb,GAAG,EAAE,GAAG,gBAAgB,EAAE;QAC1B,OAAO;QACP,MAAM,EAAE,MAAM;QACd,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC;KAC3B,CAAC,CAAC;AACL,CAAC,CAAC","sourcesContent":["import { BookMeetingType } from '../types/bookMeeting.type';\nimport { request } from '../utils/requestUtils';\nimport { API_BOOK_MEETING } from './apis';\n\nexport const createBookMeeting = async (\n data: BookMeetingType,\n apiHost: string\n): Promise<any> => {\n const headers = {\n 'Content-Type': 'application/json',\n };\n\n return request({\n host: apiHost,\n url: `${API_BOOK_MEETING}`,\n headers,\n method: 'POST',\n body: JSON.stringify(data),\n });\n};\n"]}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { UserContactType } from '../types/userContact.type';
|
|
2
|
+
export declare const createUserContact: (data: UserContactType, apiHost: string) => Promise<any>;
|
|
3
|
+
export declare const getUserContact: (apiHost: string, params: {
|
|
4
|
+
sessionId?: string;
|
|
5
|
+
email?: string;
|
|
6
|
+
}) => Promise<any>;
|
|
7
|
+
//# sourceMappingURL=userContact.service.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"userContact.service.d.ts","sourceRoot":"","sources":["../../src/services/userContact.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAI5D,eAAO,MAAM,iBAAiB,SACtB,eAAe,WACZ,MAAM,KACd,OAAO,CAAC,GAAG,CAYb,CAAC;AAEF,eAAO,MAAM,cAAc,YAChB,MAAM,UACP;IACN,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,KACA,OAAO,CAAC,GAAG,CAUb,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { request } from '../utils/requestUtils';
|
|
2
|
+
import { API_USER_CONTACTS } from './apis';
|
|
3
|
+
export const createUserContact = async (data, apiHost) => {
|
|
4
|
+
const headers = {
|
|
5
|
+
'Content-Type': 'application/json',
|
|
6
|
+
};
|
|
7
|
+
return request({
|
|
8
|
+
host: apiHost,
|
|
9
|
+
url: `${API_USER_CONTACTS}`,
|
|
10
|
+
headers,
|
|
11
|
+
method: 'POST',
|
|
12
|
+
body: JSON.stringify(data),
|
|
13
|
+
});
|
|
14
|
+
};
|
|
15
|
+
export const getUserContact = async (apiHost, params) => {
|
|
16
|
+
return request({
|
|
17
|
+
host: apiHost,
|
|
18
|
+
url: `${API_USER_CONTACTS}/search`,
|
|
19
|
+
method: 'GET',
|
|
20
|
+
params: {
|
|
21
|
+
sessionId: params?.sessionId || undefined,
|
|
22
|
+
email: params?.email || undefined,
|
|
23
|
+
},
|
|
24
|
+
});
|
|
25
|
+
};
|
|
26
|
+
//# sourceMappingURL=userContact.service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"userContact.service.js","sourceRoot":"","sources":["../../src/services/userContact.service.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAChD,OAAO,EAAE,iBAAiB,EAAE,MAAM,QAAQ,CAAC;AAE3C,MAAM,CAAC,MAAM,iBAAiB,GAAG,KAAK,EACpC,IAAqB,EACrB,OAAe,EACD,EAAE;IAChB,MAAM,OAAO,GAAG;QACd,cAAc,EAAE,kBAAkB;KACnC,CAAC;IAEF,OAAO,OAAO,CAAC;QACb,IAAI,EAAE,OAAO;QACb,GAAG,EAAE,GAAG,iBAAiB,EAAE;QAC3B,OAAO;QACP,MAAM,EAAE,MAAM;QACd,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC;KAC3B,CAAC,CAAC;AACL,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,cAAc,GAAG,KAAK,EACjC,OAAe,EACf,MAGC,EACa,EAAE;IAChB,OAAO,OAAO,CAAC;QACb,IAAI,EAAE,OAAO;QACb,GAAG,EAAE,GAAG,iBAAiB,SAAS;QAClC,MAAM,EAAE,KAAK;QACb,MAAM,EAAE;YACN,SAAS,EAAE,MAAM,EAAE,SAAS,IAAI,SAAS;YACzC,KAAK,EAAE,MAAM,EAAE,KAAK,IAAI,SAAS;SAClC;KACF,CAAC,CAAC;AACL,CAAC,CAAC","sourcesContent":["import { UserContactType } from '../types/userContact.type';\nimport { request } from '../utils/requestUtils';\nimport { API_USER_CONTACTS } from './apis';\n\nexport const createUserContact = async (\n data: UserContactType,\n apiHost: string\n): Promise<any> => {\n const headers = {\n 'Content-Type': 'application/json',\n };\n\n return request({\n host: apiHost,\n url: `${API_USER_CONTACTS}`,\n headers,\n method: 'POST',\n body: JSON.stringify(data),\n });\n};\n\nexport const getUserContact = async (\n apiHost: string,\n params: {\n sessionId?: string;\n email?: string;\n }\n): Promise<any> => {\n return request({\n host: apiHost,\n url: `${API_USER_CONTACTS}/search`,\n method: 'GET',\n params: {\n sessionId: params?.sessionId || undefined,\n email: params?.email || undefined,\n },\n });\n};\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bookMeeting.type.d.ts","sourceRoot":"","sources":["../../src/types/bookMeeting.type.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,eAAe;IAC9B,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;CACf"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bookMeeting.type.js","sourceRoot":"","sources":["../../src/types/bookMeeting.type.ts"],"names":[],"mappings":"","sourcesContent":["export interface BookMeetingType {\n startDate: string;\n startTime: string;\n duration: string;\n channel: string;\n host: string;\n title: string;\n}\n"]}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export interface UserContactType {
|
|
2
|
+
sessionId: string;
|
|
3
|
+
name: {
|
|
4
|
+
firstName: string;
|
|
5
|
+
lastName?: string;
|
|
6
|
+
};
|
|
7
|
+
emails?: {
|
|
8
|
+
primaryEmail?: string;
|
|
9
|
+
};
|
|
10
|
+
phones?: {
|
|
11
|
+
primaryPhoneNumber?: string;
|
|
12
|
+
primaryPhoneCountryCode?: string;
|
|
13
|
+
primaryPhoneCallingCode?: string;
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=userContact.type.d.ts.map
|