widget-chatbot 1.0.5 → 2.0.0-alpha.2
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/README.md +84 -77
- package/dist/index.d.ts +24 -35
- package/dist/vite.svg +1 -0
- package/dist/widget-chatbot.css +1 -0
- package/dist/widget-chatbot.es.js +3614 -0
- package/package.json +51 -200
- package/LICENSE +0 -177
- package/dist/index.js +0 -1
package/README.md
CHANGED
|
@@ -1,77 +1,84 @@
|
|
|
1
|
-
### Built With
|
|
2
|
-
|
|
3
|
-
-
|
|
4
|
-
-
|
|
5
|
-
-
|
|
6
|
-
|
|
7
|
-
### Requirements
|
|
8
|
-
|
|
9
|
-
-
|
|
10
|
-
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
##
|
|
19
|
-
|
|
20
|
-
```sh
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
[
|
|
73
|
-
|
|
74
|
-
[
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
1
|
+
### Built With
|
|
2
|
+
|
|
3
|
+
- [![React][react.js]][react-url]
|
|
4
|
+
- [![Socket-io][socket-io-img]][socket-io-url]
|
|
5
|
+
- [![Chart.js][chart.js-img]][chart.js-url]
|
|
6
|
+
|
|
7
|
+
### Requirements
|
|
8
|
+
|
|
9
|
+
- react : >=^17.0.2
|
|
10
|
+
- react-dom : >=^17.0.2
|
|
11
|
+
- @emoji-mart/react
|
|
12
|
+
- @ant-design/plots
|
|
13
|
+
- antd
|
|
14
|
+
- axios
|
|
15
|
+
- react-markdown
|
|
16
|
+
- remark-gfm
|
|
17
|
+
|
|
18
|
+
## Getting Started
|
|
19
|
+
|
|
20
|
+
```sh
|
|
21
|
+
npm i widget-chatbot
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
## Usage
|
|
25
|
+
|
|
26
|
+
```sh
|
|
27
|
+
import Widget from 'widget-chatbot';
|
|
28
|
+
import { createBrowserHistory } from 'history';
|
|
29
|
+
import 'widget-chatbot/dist/widget-chatbot.css';
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
const history = createBrowserHistory();
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
const App = ()=>{
|
|
36
|
+
const initPayload = {
|
|
37
|
+
access_token: 'jwt token',
|
|
38
|
+
refresh_token: 'refresh token',
|
|
39
|
+
uagent: window.navigator.userAgent,
|
|
40
|
+
uriBackend: 'uri backend',
|
|
41
|
+
uriService: 'uri open ai service chatbot',
|
|
42
|
+
companyid: 'coid',
|
|
43
|
+
companycode:'companycode',
|
|
44
|
+
lang:'EN',
|
|
45
|
+
uriBackendEnt: 'uri backend go',
|
|
46
|
+
uriBackendHRMGO: 'uri backend hrm go',
|
|
47
|
+
config: cookies?.CHATBOT?.config,
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
const textSayHiAndGetStarted = 'Hi and get started';
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
return (
|
|
54
|
+
<Widget
|
|
55
|
+
getStartedPayload={getInitPayload()}
|
|
56
|
+
history={history}
|
|
57
|
+
keyEncrypt={keyEncrypt}
|
|
58
|
+
onPayslipFn={{
|
|
59
|
+
onCheckPYAccess,
|
|
60
|
+
onSubmitPYPwd,
|
|
61
|
+
}}
|
|
62
|
+
socketPath={socketPath || ''}
|
|
63
|
+
socketURL={socketUrl}
|
|
64
|
+
subTitle={textSayHiAndGetStarted}
|
|
65
|
+
title={textSunfishAssistantTitle}
|
|
66
|
+
isSF
|
|
67
|
+
/>
|
|
68
|
+
)
|
|
69
|
+
}
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
## [Click this for Publish Process](./publish_process/README.md)
|
|
73
|
+
|
|
74
|
+
<!-- Read [This](./publish_process/README.md) -->
|
|
75
|
+
|
|
76
|
+
<!-- MARKDOWN LINKS & IMAGES -->
|
|
77
|
+
<!-- https://www.markdownguide.org/basic-syntax/#reference-style-links -->
|
|
78
|
+
|
|
79
|
+
[react.js]: https://img.shields.io/badge/React-20232A?style=for-the-badge&logo=react&logoColor=61DAFB
|
|
80
|
+
[react-url]: https://reactjs.org/
|
|
81
|
+
[socket-io-url]: https://socket.io/
|
|
82
|
+
[socket-io-img]: https://img.shields.io/badge/Socket-io?logo=socketdotio&label=Socket.io
|
|
83
|
+
[chart.js-url]: https://www.chartjs.org/
|
|
84
|
+
[chart.js-img]: https://img.shields.io/badge/Chart-js?logo=chartdotjs&logoColor=%23FF6384&label=Chart.js&labelColor=white&color=%23FF6384
|
package/dist/index.d.ts
CHANGED
|
@@ -1,36 +1,25 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
const closeImage: string;
|
|
26
|
-
const docViewer: boolean;
|
|
27
|
-
const customComponent: () => void;
|
|
28
|
-
const displayUnreadCount: boolean;
|
|
29
|
-
const showMessageDate: any;
|
|
30
|
-
const customMessageDelay: () => void;
|
|
31
|
-
const tooltipPayload: string;
|
|
32
|
-
const tooltipDelay: number;
|
|
33
|
-
const withRules: boolean;
|
|
34
|
-
const rules: any;
|
|
35
|
-
const triggerEventListenerUpdateRate: number;
|
|
1
|
+
import { Axios } from "axios";
|
|
2
|
+
import { ReactNode } from "react";
|
|
3
|
+
|
|
4
|
+
declare module "widget-chatbot" {
|
|
5
|
+
type PayslipFn = {
|
|
6
|
+
onSubmitPYPwd: () => Axios;
|
|
7
|
+
onCheckPYAccess: () => void;
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
export type WidgetChatbotProps = {
|
|
11
|
+
getStartedPayload: string;
|
|
12
|
+
socketURL: string;
|
|
13
|
+
socketPath: string;
|
|
14
|
+
onPayslipFn: PayslipFn;
|
|
15
|
+
title: string;
|
|
16
|
+
subTitle: string;
|
|
17
|
+
keyEncrypt: string;
|
|
18
|
+
history: Object;
|
|
19
|
+
isSF?: boolean;
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
const WidgetChatbot: (props: WidgetChatbotProps) => ReactNode;
|
|
23
|
+
|
|
24
|
+
export default WidgetChatbot;
|
|
36
25
|
}
|
package/dist/vite.svg
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" class="iconify iconify--logos" width="31.88" height="32" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 257"><defs><linearGradient id="IconifyId1813088fe1fbc01fb466" x1="-.828%" x2="57.636%" y1="7.652%" y2="78.411%"><stop offset="0%" stop-color="#41D1FF"></stop><stop offset="100%" stop-color="#BD34FE"></stop></linearGradient><linearGradient id="IconifyId1813088fe1fbc01fb467" x1="43.376%" x2="50.316%" y1="2.242%" y2="89.03%"><stop offset="0%" stop-color="#FFEA83"></stop><stop offset="8.333%" stop-color="#FFDD35"></stop><stop offset="100%" stop-color="#FFA800"></stop></linearGradient></defs><path fill="url(#IconifyId1813088fe1fbc01fb466)" d="M255.153 37.938L134.897 252.976c-2.483 4.44-8.862 4.466-11.382.048L.875 37.958c-2.746-4.814 1.371-10.646 6.827-9.67l120.385 21.517a6.537 6.537 0 0 0 2.322-.004l117.867-21.483c5.438-.991 9.574 4.796 6.877 9.62Z"></path><path fill="url(#IconifyId1813088fe1fbc01fb467)" d="M185.432.063L96.44 17.501a3.268 3.268 0 0 0-2.634 3.014l-5.474 92.456a3.268 3.268 0 0 0 3.997 3.378l24.777-5.718c2.318-.535 4.413 1.507 3.936 3.838l-7.361 36.047c-.495 2.426 1.782 4.5 4.151 3.78l15.304-4.649c2.372-.72 4.652 1.36 4.15 3.788l-11.698 56.621c-.732 3.542 3.979 5.473 5.943 2.437l1.313-2.028l72.516-144.72c1.215-2.423-.88-5.186-3.54-4.672l-25.505 4.922c-2.396.462-4.435-1.77-3.759-4.114l16.646-57.705c.677-2.35-1.37-4.583-3.769-4.113Z"></path></svg>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.w-modal-container-feedback{width:100%}.w-modal-container-feedback .ant-modal-content{background-image:url(https://res.cloudinary.com/dcvolkyfb/image/upload/v1740108579/svg/modal_feedback_image_smgsc0.svg);background-repeat:no-repeat;background-size:cover}.w-list-feedback-suggestion{display:flex!important;flex-wrap:wrap;gap:8px!important}.w-list-feedback-suggestion .ant-radio-button-wrapper{border-width:1px;border-radius:10px!important;font-size:10px!important}.w-list-feedback-suggestion .ant-radio-button-wrapper:before{content:none}.lds-ellipsis,.lds-ellipsis div{box-sizing:border-box}.lds-ellipsis{display:inline-block;position:relative;width:48px;height:70px}.lds-ellipsis div{position:absolute;top:33.33333px;width:8px;height:8px;border-radius:50%;background:#00000080;animation-timing-function:cubic-bezier(0,1,1,0)}.lds-ellipsis div:nth-child(1){left:8px;animation:lds-ellipsis1 .6s infinite}.lds-ellipsis div:nth-child(2){left:8px;animation:lds-ellipsis2 .6s infinite}.lds-ellipsis div:nth-child(3){left:22px;animation:lds-ellipsis2 .6s infinite}.lds-ellipsis div:nth-child(4){left:37px;animation:lds-ellipsis3 .6s infinite}@keyframes lds-ellipsis1{0%{transform:scale(0)}to{transform:scale(1)}}@keyframes lds-ellipsis3{0%{transform:scale(1)}to{transform:scale(0)}}@keyframes lds-ellipsis2{0%{transform:translate(0)}to{transform:translate(13px)}}.w-bubble-chat-container{display:flex;flex-direction:column;gap:18px}.w-bubble-chat{padding:11px 15px;box-shadow:0 2px 8px #00000026}.w-bubble-chat-regenerate{width:100%;max-width:250px!important}.w-bubble-chat-regenerate-expand{width:100%;max-width:750px!important}.w-response{background-color:#fff;border-radius:0 15px 15px;width:fit-content;max-width:calc(100% - 20px)}.w-client{background-color:#ebeff8;align-self:flex-end;border-radius:15px 0 15px 15px;max-width:250px}.w-regenerate-chat-last{padding:1px;background:linear-gradient(71.62deg,#395ebc 24.16%,#a8d8f3 76.78%);border-radius:0 15px 15px;animation:gradient 5s ease infinite;background-size:400% 400%;max-width:300px;margin-bottom:10px;transition:all .3s}.w-regenerate-chat-last-expand{max-width:100%}.w-bubble-chat .ant-table-content{max-width:100%!important}@keyframes gradient{0%{background-position:0% 50%}50%{background-position:100% 50%}to{background-position:0% 50%}}.w-input-container{border:1px solid rgba(217,217,217,1);border-radius:8px;display:flex;justify-content:space-between;align-items:flex-end;padding:10px 5px 5px;margin:0 10px}.w-input-widget,.w-input-helpdesk{overflow:auto;resize:none!important;width:100%;border:none}.w-input-widget.ant-input,.w-input-widget.ant-input-focused,.w-input-widget.ant-input:focus,.w-input-widget.ant-input-outlined:focus,.w-input-widget.ant-input-outlined:focus-within{box-shadow:none;border:none!important}.w-input-helpdesk.ant-mentions,.w-input-helpdesk.ant-mentions-focused,.w-input-helpdesk.ant-mentions:hover{border:none!important;box-shadow:none}.w-input-helpdesk.ant-mentions-outlined:focus,.w-input-helpdesk.ant-mentions-outlined:focus-within{box-shadow:none}.w-send-btn{background-color:var(--primary-color, #395ebc)}.w-send-btn-disabled{background-color:#0006!important}.w-list-ticket-container{display:flex;flex-direction:column;gap:12px;height:calc(100vh - 320px);overflow-y:auto;position:relative}.w-list-ticket-container-sf{height:calc(100vh - 250px)}.w-list-ticket-container-mobile{height:calc(100vh - 190px)}.w-ticket-card-container{box-shadow:0 0 8px #a8d8f34d;padding:8px 12px;border-radius:10px;cursor:pointer;transition:all .3s}.w-ticket-card-container:hover{box-shadow:0 3px 6px -4px #a8d8f31a,0 6px 16px #a8d8f330,0 9px 28px 8px #a8d8f32b;border:none}.w-ticket-card-content-container{display:flex;justify-content:space-between}.w-ticket-card-cat-code{display:flex;flex-direction:column}.w-ticket-card-status-date{display:flex;flex-direction:column;align-items:flex-end}.w-ticket-list-advance-filter-form-container{overflow-y:auto;height:calc(100% - 50px);padding:18px 12px}.w-ticket-list-advance-filter-footer{display:flex;gap:8px;align-items:flex-end;justify-content:flex-end;flex:auto}.w-drawer-container{background-color:#fff;height:100%;right:0;bottom:0;left:0;position:absolute;z-index:1;top:62px;padding:15px 12px 12px;display:flex;flex-direction:column}.w-show-animate{animation:show .3s cubic-bezier(.4,0,.2,1) 0ms 1}.w-close-animate{animation:close .3s cubic-bezier(.4,0,.2,1) 0ms 1}.w-slide-left-animate{animation:slide_left .3s cubic-bezier(.4,0,.2,1) 0ms 1}.w-slide-right-animate{animation:slide_right .3s cubic-bezier(.4,0,.2,1) 0ms 1}.w-fade-in-animate{animation:fade-in .3s cubic-bezier(.4,0,.2,1) 0ms 1}.w-fade-out-animate{animation:fade-out .3s cubic-bezier(.4,0,.2,1) 0ms 1;height:0;visibility:hidden;padding:0;margin:0}.w-slide-up-animate{animation:slide-up .3s cubic-bezier(.4,0,.2,1) 0ms 1}.w-spin-animate{animation:spin 1s infinite forwards}@keyframes show{0%{transform:scale(0);overflow:hidden;transform-origin:right}to{transform:scale(1);overflow:visible}}@keyframes close{0%{transform:scale(1);overflow:visible}to{transform:scale(0);overflow:hidden;transform-origin:right}}@keyframes slide_left{0%{transform:translate(-500px);overflow:hidden}to{transform:translate(0);overflow:visible}}@keyframes slide_right{0%{transform:translate(500px);overflow:hidden}to{transform:translate(0);overflow:visible}}@keyframes fade-in{0%{opacity:0}to{opacity:1}}@keyframes fade-out{0%{opacity:1}to{opacity:0}}@keyframes slide-up{0%{transform:translateY(500px)}to{transform:translateY(-100px)}}@keyframes spin{0%{transform:rotate(0)}to{transform:rotate(360deg)}}.w-wrapper-body-helpdesk{padding:24px 12px;position:relative;overflow:hidden;height:calc(100vh - 230px)}.w-wrapper-body-helpdesk-sf{height:calc(100vh - 190px)}.w-wrapper-body-helpdesk-mobile,.w-wrapper-body-helpdesk-sf-mobile{height:calc(100vh - 115px)}.w-wrapper-body-helpdesk .ant-drawer{position:absolute!important;height:100%}.w-wrapper-body-helpdesk .ant-drawer-content-wrapper{height:100%!important}.w-wrapper-body-helpdesk .ant-drawer-body{overflow:hidden;padding:12px 0 0!important}.w-ticket-detail-content-container{height:calc(100% - 130px);overflow-y:auto;padding:0 24px 20px;position:relative}.w-ticket-detail-content-container-sf-mobile{height:calc(100% - 110px)}.w-ticket-detail-content-container-mobile{height:calc(100% - 120px);padding:0 12px 20px}.w-datekey-chats{color:gray;border-bottom:1px solid rgb(221,221,221);background-color:#fff;border-radius:8px;margin:24px auto 12px;text-align:center;padding:5px 15px;width:fit-content;position:sticky;top:10px;z-index:1}.w-ticket-info-chat-container{display:flex;flex-direction:column;-webkit-box-align:center;align-items:center;text-align:center;margin:auto;padding:4px;background:#fafafa;border:1px solid rgb(217,217,217);border-radius:8px;width:80%;font-size:14px}.w-ticket-detail-header-container{display:flex;gap:8px;border-bottom:1px solid rgba(0,0,0,.05);align-items:center;justify-content:space-between}.w-ticket-detail-header-text{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.w-ticket-detail-loading-chats{display:flex;flex-direction:column;gap:24px;padding:0}.w-banner-container{position:absolute;top:0;left:0;right:0;background-color:#00000080;width:100%;padding:8px 0;border-radius:0 0 8px 8px}.w-banner-container span{color:#fff}.w-banner-container .w-reconnect-manual{color:#69b1ff!important}.w-banner-container .w-banner-content{position:relative;display:flex;gap:4px;text-align:center;flex-direction:column}.w-banner-container .w-banner-subtitle{display:flex;gap:8px;justify-content:center}.w-banner-container .w-banner-close-btn{position:absolute;top:10px;right:10px}.w-launcher-container{cursor:pointer;display:flex;position:fixed;right:0;top:30%;gap:8px;align-items:center;transform:rotate(-90deg);transform-origin:bottom right;background-color:var(--primary-color, #395ebc);color:#fff;padding:15px;border-radius:8px 8px 0 0;transition:all .3s}.w-container-widget{position:fixed;right:2%;top:60px;width:360px;border-radius:8px;box-shadow:0 1px 1.5px -1px #0000000c,0 2.5px 3.7px -1px #00000012,0 5px 7px -1px #00000016,0 9.7px 12.5px -1px #0000001a,0 19.7px 23.4px -1px #0000001f,0 54px 56px -1px #0000002b;z-index:999;transition:all .25s}.w-container-widget-mobile{width:100vw;border-radius:0;top:0;right:0;bottom:0;left:0}.w-container-widget.w-container-widget-expand{width:800px}#w-widget-content .ant-modal-mask,#w-widget-content .ant-modal-wrap{position:absolute}.w-widget-content-container{position:relative;height:100%;background-color:#fff;overflow:hidden}.w-widget-content-container-mobile,.w-widget-content-container-sf-mobile{height:calc(100vh - 120px)}.w-wrapper-body{overflow-y:auto;height:calc(100vh - 300px);padding:24px 12px;position:relative}.w-wrapper-body-sf{height:calc(100vh - 260px)}.w-wrapper-body-sf-mobile{height:calc(100vh - 190px)}.w-wrapper-body-mobile{height:calc(100vh - 195px)}.w-widget-tab-footer-container{width:100%;background-color:#fff;border-radius:0 0 8px 8px}.w-widget-tab-footer-container .ant-tabs-nav{width:100%!important;margin:0}.w-widget-tab-footer-container .ant-tabs-nav>div:nth-of-type(1){display:unset!important;width:100%!important}.w-widget-tab-footer-container .ant-tabs-tab{display:block;flex:1;text-align:center}.w-widget-tab-footer-container .ant-tabs-nav-operations{display:none!important}.w-header-container{display:flex;justify-content:space-between;padding:0 15px;border-radius:8px 8px 0 0;align-items:center;background-color:var(--primary-color, #395ebc);color:#fff}.w-header-text{display:flex;flex-direction:column;gap:8px;padding:12px 0}.w-header-title{font-size:14px;font-weight:600;margin:0!important;color:#fff}.w-header-subtitle{font-size:12px;color:#fff}.w-header-action{display:flex;gap:12px}.w-widget-content-container .ant-notification{position:absolute!important}.w-widget-content-container .w-notification-content{width:300px!important}
|