systemrobotassistant 3.0.8
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.
Potentially problematic release.
This version of systemrobotassistant might be problematic. Click here for more details.
- package/.eslintignore +6 -0
- package/.eslintrc +45 -0
- package/.gitlab-ci.yml +52 -0
- package/.lecprc.ts +76 -0
- package/.yarnrc +1 -0
- package/CHANGELOG.md +114 -0
- package/README.md +14 -0
- package/custom-amd-plugin.ts +46 -0
- package/es/component/answer-itme/index.d.ts +20 -0
- package/es/component/answer-itme/index.d.ts.map +1 -0
- package/es/component/answer-itme/index.js +41 -0
- package/es/component/answer-itme/style.css +35 -0
- package/es/component/data-container/index.d.ts +19 -0
- package/es/component/data-container/index.d.ts.map +1 -0
- package/es/component/data-container/index.js +37 -0
- package/es/component/data-container/style.css +26 -0
- package/es/component/days-tab/index.d.ts +6 -0
- package/es/component/days-tab/index.d.ts.map +1 -0
- package/es/component/days-tab/index.js +119 -0
- package/es/component/days-tab/style.css +43 -0
- package/es/component/days-tab/utils.d.ts +32 -0
- package/es/component/days-tab/utils.d.ts.map +1 -0
- package/es/component/days-tab/utils.js +98 -0
- package/es/component/error-boundary/index.d.ts +2 -0
- package/es/component/error-boundary/index.d.ts.map +1 -0
- package/es/component/error-boundary/index.js +33 -0
- package/es/component/it-notice-modal/columns.d.ts +11 -0
- package/es/component/it-notice-modal/columns.d.ts.map +1 -0
- package/es/component/it-notice-modal/columns.js +108 -0
- package/es/component/it-notice-modal/double-tab.d.ts +6 -0
- package/es/component/it-notice-modal/double-tab.d.ts.map +1 -0
- package/es/component/it-notice-modal/double-tab.js +94 -0
- package/es/component/it-notice-modal/index.d.ts +6 -0
- package/es/component/it-notice-modal/index.d.ts.map +1 -0
- package/es/component/it-notice-modal/index.js +488 -0
- package/es/component/it-notice-modal/server.d.ts +8 -0
- package/es/component/it-notice-modal/server.d.ts.map +1 -0
- package/es/component/it-notice-modal/server.js +43 -0
- package/es/component/it-notice-modal/single-tab.d.ts +6 -0
- package/es/component/it-notice-modal/single-tab.d.ts.map +1 -0
- package/es/component/it-notice-modal/single-tab.js +82 -0
- package/es/component/it-notice-modal/style.css +301 -0
- package/es/component/it-notice-modal/utils.d.ts +2 -0
- package/es/component/it-notice-modal/utils.d.ts.map +1 -0
- package/es/component/it-notice-modal/utils.js +8 -0
- package/es/component/it-notice-tab/index.d.ts +6 -0
- package/es/component/it-notice-tab/index.d.ts.map +1 -0
- package/es/component/it-notice-tab/index.js +206 -0
- package/es/component/it-notice-tab/server.d.ts +3 -0
- package/es/component/it-notice-tab/server.d.ts.map +1 -0
- package/es/component/it-notice-tab/server.js +13 -0
- package/es/component/it-notice-tab/style.css +103 -0
- package/es/component/mail-list-modal/index.d.ts +2 -0
- package/es/component/mail-list-modal/index.d.ts.map +1 -0
- package/es/component/mail-list-modal/index.js +306 -0
- package/es/component/mail-list-modal/server.d.ts +7 -0
- package/es/component/mail-list-modal/server.d.ts.map +1 -0
- package/es/component/mail-list-modal/server.js +38 -0
- package/es/component/mail-list-modal/style.css +132 -0
- package/es/component/myself-chat-card/index.d.ts +15 -0
- package/es/component/myself-chat-card/index.d.ts.map +1 -0
- package/es/component/myself-chat-card/index.js +25 -0
- package/es/component/myself-chat-card/style.css +22 -0
- package/es/component/need-answer/index.d.ts +15 -0
- package/es/component/need-answer/index.d.ts.map +1 -0
- package/es/component/need-answer/index.js +60 -0
- package/es/component/need-answer/style.css +19 -0
- package/es/component/opppsition-chat-card/index.d.ts +11 -0
- package/es/component/opppsition-chat-card/index.d.ts.map +1 -0
- package/es/component/opppsition-chat-card/index.js +25 -0
- package/es/component/opppsition-chat-card/style.css +23 -0
- package/es/component/question-library/index.d.ts +10 -0
- package/es/component/question-library/index.d.ts.map +1 -0
- package/es/component/question-library/index.js +291 -0
- package/es/component/question-library/server.d.ts +4 -0
- package/es/component/question-library/server.d.ts.map +1 -0
- package/es/component/question-library/server.js +19 -0
- package/es/component/question-library/style.css +75 -0
- package/es/component/question-tag/index.d.ts +11 -0
- package/es/component/question-tag/index.d.ts.map +1 -0
- package/es/component/question-tag/index.js +23 -0
- package/es/component/question-tag/style.css +12 -0
- package/es/component/recommend-questions-card/index.d.ts +10 -0
- package/es/component/recommend-questions-card/index.d.ts.map +1 -0
- package/es/component/recommend-questions-card/index.js +104 -0
- package/es/component/recommend-questions-card/style.css +54 -0
- package/es/component/scroll-view/index.d.ts +3 -0
- package/es/component/scroll-view/index.d.ts.map +1 -0
- package/es/component/scroll-view/index.js +2 -0
- package/es/component/scroll-view/scroll-view.d.ts +18 -0
- package/es/component/scroll-view/scroll-view.d.ts.map +1 -0
- package/es/component/scroll-view/scroll-view.js +66 -0
- package/es/component/scroll-view/style.css +34 -0
- package/es/component/tab/index.d.ts +2 -0
- package/es/component/tab/index.d.ts.map +1 -0
- package/es/component/tab/index.js +18 -0
- package/es/component/tab/style.css +26 -0
- package/es/component/tips-answer/index.d.ts +15 -0
- package/es/component/tips-answer/index.d.ts.map +1 -0
- package/es/component/tips-answer/index.js +28 -0
- package/es/component/tips-answer/style.css +10 -0
- package/es/images/expire-robot.svg +16 -0
- package/es/images/pc-invalid.svg +11 -0
- package/es/images/screenshot-5.png +0 -0
- package/es/index.d.ts +92 -0
- package/es/index.d.ts.map +1 -0
- package/es/index.js +506 -0
- package/es/js/const.d.ts +41 -0
- package/es/js/const.d.ts.map +1 -0
- package/es/js/const.js +46 -0
- package/es/js/gen-render-promise.d.ts +9 -0
- package/es/js/gen-render-promise.d.ts.map +1 -0
- package/es/js/gen-render-promise.js +30 -0
- package/es/js/get-time.d.ts +15 -0
- package/es/js/get-time.d.ts.map +1 -0
- package/es/js/get-time.js +35 -0
- package/es/js/hfc-space.d.ts +16 -0
- package/es/js/hfc-space.d.ts.map +1 -0
- package/es/js/hfc-space.js +71 -0
- package/es/js/render-special.d.ts +16 -0
- package/es/js/render-special.d.ts.map +1 -0
- package/es/js/render-special.js +53 -0
- package/es/js/request/fetch.d.ts +10 -0
- package/es/js/request/fetch.d.ts.map +1 -0
- package/es/js/request/fetch.js +81 -0
- package/es/js/request/request.d.ts +3 -0
- package/es/js/request/request.d.ts.map +1 -0
- package/es/js/request/request.js +63 -0
- package/es/js/showMessage.d.ts +15 -0
- package/es/js/showMessage.d.ts.map +1 -0
- package/es/js/showMessage.js +75 -0
- package/es/js/state-immer.d.ts +3 -0
- package/es/js/state-immer.d.ts.map +1 -0
- package/es/js/state-immer.js +19 -0
- package/es/js/timer-executor.d.ts +3 -0
- package/es/js/timer-executor.d.ts.map +1 -0
- package/es/js/timer-executor.js +83 -0
- package/es/js/to-hfc.d.ts +2 -0
- package/es/js/to-hfc.d.ts.map +1 -0
- package/es/js/to-hfc.js +8 -0
- package/es/js/utils.d.ts +3 -0
- package/es/js/utils.d.ts.map +1 -0
- package/es/js/utils.js +11 -0
- package/es/jsx/chat-modal.d.ts +16 -0
- package/es/jsx/chat-modal.d.ts.map +1 -0
- package/es/jsx/chat-modal.js +268 -0
- package/es/server.d.ts +8 -0
- package/es/server.d.ts.map +1 -0
- package/es/server.js +44 -0
- package/es/style.css +174 -0
- package/lib/component/answer-itme/index.d.ts +20 -0
- package/lib/component/answer-itme/index.d.ts.map +1 -0
- package/lib/component/answer-itme/index.js +51 -0
- package/lib/component/answer-itme/style.css +35 -0
- package/lib/component/data-container/index.d.ts +19 -0
- package/lib/component/data-container/index.d.ts.map +1 -0
- package/lib/component/data-container/index.js +45 -0
- package/lib/component/data-container/style.css +26 -0
- package/lib/component/days-tab/index.d.ts +6 -0
- package/lib/component/days-tab/index.d.ts.map +1 -0
- package/lib/component/days-tab/index.js +129 -0
- package/lib/component/days-tab/style.css +43 -0
- package/lib/component/days-tab/utils.d.ts +32 -0
- package/lib/component/days-tab/utils.d.ts.map +1 -0
- package/lib/component/days-tab/utils.js +110 -0
- package/lib/component/error-boundary/index.d.ts +2 -0
- package/lib/component/error-boundary/index.d.ts.map +1 -0
- package/lib/component/error-boundary/index.js +40 -0
- package/lib/component/it-notice-modal/columns.d.ts +11 -0
- package/lib/component/it-notice-modal/columns.d.ts.map +1 -0
- package/lib/component/it-notice-modal/columns.js +116 -0
- package/lib/component/it-notice-modal/double-tab.d.ts +6 -0
- package/lib/component/it-notice-modal/double-tab.d.ts.map +1 -0
- package/lib/component/it-notice-modal/double-tab.js +104 -0
- package/lib/component/it-notice-modal/index.d.ts +6 -0
- package/lib/component/it-notice-modal/index.d.ts.map +1 -0
- package/lib/component/it-notice-modal/index.js +499 -0
- package/lib/component/it-notice-modal/server.d.ts +8 -0
- package/lib/component/it-notice-modal/server.d.ts.map +1 -0
- package/lib/component/it-notice-modal/server.js +55 -0
- package/lib/component/it-notice-modal/single-tab.d.ts +6 -0
- package/lib/component/it-notice-modal/single-tab.d.ts.map +1 -0
- package/lib/component/it-notice-modal/single-tab.js +92 -0
- package/lib/component/it-notice-modal/style.css +301 -0
- package/lib/component/it-notice-modal/utils.d.ts +2 -0
- package/lib/component/it-notice-modal/utils.d.ts.map +1 -0
- package/lib/component/it-notice-modal/utils.js +15 -0
- package/lib/component/it-notice-tab/index.d.ts +6 -0
- package/lib/component/it-notice-tab/index.d.ts.map +1 -0
- package/lib/component/it-notice-tab/index.js +216 -0
- package/lib/component/it-notice-tab/server.d.ts +3 -0
- package/lib/component/it-notice-tab/server.d.ts.map +1 -0
- package/lib/component/it-notice-tab/server.js +20 -0
- package/lib/component/it-notice-tab/style.css +103 -0
- package/lib/component/mail-list-modal/index.d.ts +2 -0
- package/lib/component/mail-list-modal/index.d.ts.map +1 -0
- package/lib/component/mail-list-modal/index.js +316 -0
- package/lib/component/mail-list-modal/server.d.ts +7 -0
- package/lib/component/mail-list-modal/server.d.ts.map +1 -0
- package/lib/component/mail-list-modal/server.js +50 -0
- package/lib/component/mail-list-modal/style.css +132 -0
- package/lib/component/myself-chat-card/index.d.ts +15 -0
- package/lib/component/myself-chat-card/index.d.ts.map +1 -0
- package/lib/component/myself-chat-card/index.js +35 -0
- package/lib/component/myself-chat-card/style.css +22 -0
- package/lib/component/need-answer/index.d.ts +15 -0
- package/lib/component/need-answer/index.d.ts.map +1 -0
- package/lib/component/need-answer/index.js +70 -0
- package/lib/component/need-answer/style.css +19 -0
- package/lib/component/opppsition-chat-card/index.d.ts +11 -0
- package/lib/component/opppsition-chat-card/index.d.ts.map +1 -0
- package/lib/component/opppsition-chat-card/index.js +35 -0
- package/lib/component/opppsition-chat-card/style.css +23 -0
- package/lib/component/question-library/index.d.ts +10 -0
- package/lib/component/question-library/index.d.ts.map +1 -0
- package/lib/component/question-library/index.js +301 -0
- package/lib/component/question-library/server.d.ts +4 -0
- package/lib/component/question-library/server.d.ts.map +1 -0
- package/lib/component/question-library/server.js +27 -0
- package/lib/component/question-library/style.css +75 -0
- package/lib/component/question-tag/index.d.ts +11 -0
- package/lib/component/question-tag/index.d.ts.map +1 -0
- package/lib/component/question-tag/index.js +33 -0
- package/lib/component/question-tag/style.css +12 -0
- package/lib/component/recommend-questions-card/index.d.ts +10 -0
- package/lib/component/recommend-questions-card/index.d.ts.map +1 -0
- package/lib/component/recommend-questions-card/index.js +114 -0
- package/lib/component/recommend-questions-card/style.css +54 -0
- package/lib/component/scroll-view/index.d.ts +3 -0
- package/lib/component/scroll-view/index.d.ts.map +1 -0
- package/lib/component/scroll-view/index.js +10 -0
- package/lib/component/scroll-view/scroll-view.d.ts +18 -0
- package/lib/component/scroll-view/scroll-view.d.ts.map +1 -0
- package/lib/component/scroll-view/scroll-view.js +76 -0
- package/lib/component/scroll-view/style.css +34 -0
- package/lib/component/tab/index.d.ts +2 -0
- package/lib/component/tab/index.d.ts.map +1 -0
- package/lib/component/tab/index.js +28 -0
- package/lib/component/tab/style.css +26 -0
- package/lib/component/tips-answer/index.d.ts +15 -0
- package/lib/component/tips-answer/index.d.ts.map +1 -0
- package/lib/component/tips-answer/index.js +38 -0
- package/lib/component/tips-answer/style.css +10 -0
- package/lib/images/expire-robot.svg +16 -0
- package/lib/images/pc-invalid.svg +11 -0
- package/lib/images/screenshot-5.png +0 -0
- package/lib/index.d.ts +92 -0
- package/lib/index.d.ts.map +1 -0
- package/lib/index.js +516 -0
- package/lib/js/const.d.ts +41 -0
- package/lib/js/const.d.ts.map +1 -0
- package/lib/js/const.js +55 -0
- package/lib/js/gen-render-promise.d.ts +9 -0
- package/lib/js/gen-render-promise.d.ts.map +1 -0
- package/lib/js/gen-render-promise.js +37 -0
- package/lib/js/get-time.d.ts +15 -0
- package/lib/js/get-time.d.ts.map +1 -0
- package/lib/js/get-time.js +43 -0
- package/lib/js/hfc-space.d.ts +16 -0
- package/lib/js/hfc-space.d.ts.map +1 -0
- package/lib/js/hfc-space.js +91 -0
- package/lib/js/render-special.d.ts +16 -0
- package/lib/js/render-special.d.ts.map +1 -0
- package/lib/js/render-special.js +61 -0
- package/lib/js/request/fetch.d.ts +10 -0
- package/lib/js/request/fetch.d.ts.map +1 -0
- package/lib/js/request/fetch.js +88 -0
- package/lib/js/request/request.d.ts +3 -0
- package/lib/js/request/request.d.ts.map +1 -0
- package/lib/js/request/request.js +71 -0
- package/lib/js/showMessage.d.ts +15 -0
- package/lib/js/showMessage.d.ts.map +1 -0
- package/lib/js/showMessage.js +83 -0
- package/lib/js/state-immer.d.ts +3 -0
- package/lib/js/state-immer.d.ts.map +1 -0
- package/lib/js/state-immer.js +27 -0
- package/lib/js/timer-executor.d.ts +3 -0
- package/lib/js/timer-executor.d.ts.map +1 -0
- package/lib/js/timer-executor.js +91 -0
- package/lib/js/to-hfc.d.ts +2 -0
- package/lib/js/to-hfc.d.ts.map +1 -0
- package/lib/js/to-hfc.js +14 -0
- package/lib/js/utils.d.ts +3 -0
- package/lib/js/utils.d.ts.map +1 -0
- package/lib/js/utils.js +19 -0
- package/lib/jsx/chat-modal.d.ts +16 -0
- package/lib/jsx/chat-modal.d.ts.map +1 -0
- package/lib/jsx/chat-modal.js +278 -0
- package/lib/server.d.ts +8 -0
- package/lib/server.d.ts.map +1 -0
- package/lib/server.js +58 -0
- package/lib/style.css +174 -0
- package/package.json +57 -0
- package/rct.config.js +8 -0
- package/src/component/answer-itme/index.jsx +64 -0
- package/src/component/answer-itme/style.less +37 -0
- package/src/component/data-container/index.jsx +45 -0
- package/src/component/data-container/style.less +27 -0
- package/src/component/days-tab/index.jsx +114 -0
- package/src/component/days-tab/style.less +55 -0
- package/src/component/days-tab/utils.js +87 -0
- package/src/component/error-boundary/index.jsx +39 -0
- package/src/component/it-notice-modal/columns.js +102 -0
- package/src/component/it-notice-modal/double-tab.jsx +83 -0
- package/src/component/it-notice-modal/index.jsx +404 -0
- package/src/component/it-notice-modal/server.js +43 -0
- package/src/component/it-notice-modal/single-tab.jsx +70 -0
- package/src/component/it-notice-modal/style.less +367 -0
- package/src/component/it-notice-modal/utils.js +8 -0
- package/src/component/it-notice-tab/index.jsx +196 -0
- package/src/component/it-notice-tab/server.js +14 -0
- package/src/component/it-notice-tab/style.less +120 -0
- package/src/component/mail-list-modal/index.jsx +270 -0
- package/src/component/mail-list-modal/server.js +38 -0
- package/src/component/mail-list-modal/style.less +154 -0
- package/src/component/myself-chat-card/index.jsx +27 -0
- package/src/component/myself-chat-card/style.less +30 -0
- package/src/component/need-answer/index.jsx +56 -0
- package/src/component/need-answer/style.less +21 -0
- package/src/component/opppsition-chat-card/index.jsx +25 -0
- package/src/component/opppsition-chat-card/style.less +33 -0
- package/src/component/question-library/index.jsx +316 -0
- package/src/component/question-library/server.js +19 -0
- package/src/component/question-library/style.less +102 -0
- package/src/component/question-tag/index.jsx +27 -0
- package/src/component/question-tag/style.less +15 -0
- package/src/component/recommend-questions-card/index.jsx +111 -0
- package/src/component/recommend-questions-card/style.less +66 -0
- package/src/component/scroll-view/index.js +3 -0
- package/src/component/scroll-view/scroll-view.jsx +74 -0
- package/src/component/scroll-view/style.less +37 -0
- package/src/component/tab/index.jsx +17 -0
- package/src/component/tab/style.less +26 -0
- package/src/component/tips-answer/index.jsx +38 -0
- package/src/component/tips-answer/style.less +11 -0
- package/src/images/expire-robot.svg +16 -0
- package/src/images/pc-invalid.svg +11 -0
- package/src/images/screenshot-5.png +0 -0
- package/src/index.jsx +554 -0
- package/src/js/const.js +48 -0
- package/src/js/gen-render-promise.js +32 -0
- package/src/js/get-time.js +35 -0
- package/src/js/hfc-space.js +91 -0
- package/src/js/render-special.js +64 -0
- package/src/js/request/fetch.js +87 -0
- package/src/js/request/request.js +74 -0
- package/src/js/showMessage.js +81 -0
- package/src/js/state-immer.js +12 -0
- package/src/js/timer-executor.js +37 -0
- package/src/js/to-hfc.js +9 -0
- package/src/js/utils.js +13 -0
- package/src/jsx/chat-modal.jsx +254 -0
- package/src/main.js +1 -0
- package/src/server.js +45 -0
- package/src/style.less +229 -0
- package/test/cases/case-01.assert.js +6 -0
- package/test/cases/case-01.source.jsx +17 -0
- package/test/cases/case-02.assert.js +6 -0
- package/test/cases/case-02.source.jsx +25 -0
- package/test/cases/case-02.style.less +15 -0
- package/test/cases/case-03.source.jsx +69 -0
- package/test/cases/case-03.style.less +3 -0
- package/tsconfig.json +48 -0
- package/typings.d.ts +5 -0
- package/umd/b415d90208c277ba3703.png +0 -0
- package/umd/index.css +1753 -0
- package/umd/index.js +36258 -0
- package/umd/index.min.css +1 -0
- package/umd/index.min.js +657 -0
package/es/index.d.ts
ADDED
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
|
|
3
|
+
export type SystemRobotAssistantRenderIcon = React.ReactElement<any> | ((...args: any[])=>any);
|
|
4
|
+
|
|
5
|
+
export interface SystemRobotAssistantProps {
|
|
6
|
+
/**
|
|
7
|
+
* 系统 code,跟后端要或者在帮助中心后台端的系统配置页面查看
|
|
8
|
+
*/
|
|
9
|
+
hfcSpace: string;
|
|
10
|
+
/**
|
|
11
|
+
* 开发环境 可选 'dev'|'test'|'sit'|'online'
|
|
12
|
+
*/
|
|
13
|
+
env: string;
|
|
14
|
+
/**
|
|
15
|
+
* 菜单栏名称
|
|
16
|
+
*/
|
|
17
|
+
menusTitle?: string;
|
|
18
|
+
/**
|
|
19
|
+
* 层级,默认 100
|
|
20
|
+
*/
|
|
21
|
+
zIndex?: number;
|
|
22
|
+
/**
|
|
23
|
+
* 帮助中心登录失效回调
|
|
24
|
+
*/
|
|
25
|
+
tokenInvalidCallback?: (...args: any[])=>any;
|
|
26
|
+
/**
|
|
27
|
+
* 企微唤醒前置判断
|
|
28
|
+
*/
|
|
29
|
+
checkBeforeCallWechat?: (...args: any[])=>any;
|
|
30
|
+
/**
|
|
31
|
+
* 最外层样式
|
|
32
|
+
*/
|
|
33
|
+
iconWrapperClassName?: string;
|
|
34
|
+
/**
|
|
35
|
+
* icon 样式
|
|
36
|
+
*/
|
|
37
|
+
iconClassName?: string;
|
|
38
|
+
/**
|
|
39
|
+
* 文字样式
|
|
40
|
+
*/
|
|
41
|
+
textClassName?: string;
|
|
42
|
+
/**
|
|
43
|
+
* 加载中的 spin 大小 -- 2.3.0 后废弃
|
|
44
|
+
*/
|
|
45
|
+
spinSize?: number;
|
|
46
|
+
/**
|
|
47
|
+
* 位置,right
|
|
48
|
+
*/
|
|
49
|
+
right?: number;
|
|
50
|
+
/**
|
|
51
|
+
* 位置,bottom
|
|
52
|
+
*/
|
|
53
|
+
bottom?: number;
|
|
54
|
+
/**
|
|
55
|
+
* 自定义 icon
|
|
56
|
+
*/
|
|
57
|
+
renderIcon?: SystemRobotAssistantRenderIcon;
|
|
58
|
+
/**
|
|
59
|
+
* 是否可移动
|
|
60
|
+
*/
|
|
61
|
+
draggable?: boolean;
|
|
62
|
+
/**
|
|
63
|
+
* 是否显示过期提示
|
|
64
|
+
*/
|
|
65
|
+
expireTipUse?: boolean;
|
|
66
|
+
/**
|
|
67
|
+
* 是否使用 chatgpt
|
|
68
|
+
*/
|
|
69
|
+
chatgptUse?: boolean;
|
|
70
|
+
/**
|
|
71
|
+
* 分组 id 列表
|
|
72
|
+
*/
|
|
73
|
+
nodeIdList?: string[];
|
|
74
|
+
/**
|
|
75
|
+
* 是否登录
|
|
76
|
+
*/
|
|
77
|
+
isLogin?: boolean;
|
|
78
|
+
/**
|
|
79
|
+
* 多语言翻译函数
|
|
80
|
+
*/
|
|
81
|
+
t?: (...args: any[])=>any;
|
|
82
|
+
/**
|
|
83
|
+
* 多语言
|
|
84
|
+
*/
|
|
85
|
+
lang?: string;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
export default class SystemRobotAssistant extends React.PureComponent<SystemRobotAssistantProps, any> {
|
|
89
|
+
render(): JSX.Element;
|
|
90
|
+
|
|
91
|
+
}
|
|
92
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.jsx"],"names":[],"mappings":";AAiCA;;;;GAIG;AACH;IACE,wBAqBC;IAjBC;;;;;;;;;;MAAwB;IACxB,8BAA0B;IAC1B,+BAA2B;IAC3B,sCAAkC;IAyNpC,mBAUC;IA/ID,wBA4CC;IAzDD,oBAKC;IAED,kBAIC;IAqGD,wCA0BC;IAxED,wBAcC;IA4DD,qBAIC;IA4BD,2BAqBC;IAtFD,wBAEC;IAlBD,8BAcC;IAvBD,qBAOC;IA2GD,+BASC;IApQD,0BAsBC;IAED,yDAkBC;IAED,6BASC;IADC,yCAAiB;IA8DnB,0BAIC;IA+FD,+BAWC;IAuCD,kDAkJC;CACF;;;QAGuB,6CAAU"}
|
package/es/index.js
ADDED
|
@@ -0,0 +1,506 @@
|
|
|
1
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
2
|
+
function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, defineProperty = Object.defineProperty || function (obj, key, desc) { obj[key] = desc.value; }, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return defineProperty(generator, "_invoke", { value: makeInvokeMethod(innerFn, self, context) }), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == typeof value && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; defineProperty(this, "_invoke", { value: function value(method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; } function maybeInvokeDelegate(delegate, context) { var method = delegate.iterator[context.method]; if (undefined === method) { if (context.delegate = null, "throw" === context.method) { if (delegate.iterator.return && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method)) return ContinueSentinel; context.method = "throw", context.arg = new TypeError("The iterator does not provide a 'throw' method"); } return ContinueSentinel; } var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), defineProperty(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (val) { var object = Object(val), keys = []; for (var key in object) keys.push(key); return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, catch: function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }
|
|
3
|
+
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
|
4
|
+
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
5
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
6
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
7
|
+
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
8
|
+
import classNames from 'classnames';
|
|
9
|
+
import React, { PureComponent, createRef } from 'react';
|
|
10
|
+
import Proptypes from 'prop-types';
|
|
11
|
+
import { Popover } from 'shineout';
|
|
12
|
+
import Icon from '@shein-components/Icon';
|
|
13
|
+
import { format as bblFormat } from '@shein-bbl/core';
|
|
14
|
+
import * as Server from "./server";
|
|
15
|
+
import ChatModal from "./jsx/chat-modal";
|
|
16
|
+
import "./style.css";
|
|
17
|
+
var styles = {
|
|
18
|
+
"renderIconWrapper": "shein-components_systemrobotassistant_renderIconWrapper",
|
|
19
|
+
"draggableIcon": "shein-components_systemrobotassistant_draggableIcon",
|
|
20
|
+
"iconWrapper": "shein-components_systemrobotassistant_iconWrapper",
|
|
21
|
+
"avatarWrap": "shein-components_systemrobotassistant_avatarWrap",
|
|
22
|
+
"avatarBorder": "shein-components_systemrobotassistant_avatarBorder",
|
|
23
|
+
"collapseRobotBox": "shein-components_systemrobotassistant_collapseRobotBox",
|
|
24
|
+
"collapseIcon": "shein-components_systemrobotassistant_collapseIcon",
|
|
25
|
+
"redDot": "shein-components_systemrobotassistant_redDot",
|
|
26
|
+
"chatModalWrapper": "shein-components_systemrobotassistant_chatModalWrapper",
|
|
27
|
+
"header": "shein-components_systemrobotassistant_header",
|
|
28
|
+
"midlleWrapper": "shein-components_systemrobotassistant_midlleWrapper",
|
|
29
|
+
"tabItem": "shein-components_systemrobotassistant_tabItem",
|
|
30
|
+
"leftTitle": "shein-components_systemrobotassistant_leftTitle",
|
|
31
|
+
"tabIcon": "shein-components_systemrobotassistant_tabIcon",
|
|
32
|
+
"title": "shein-components_systemrobotassistant_title",
|
|
33
|
+
"avatarClass": "shein-components_systemrobotassistant_avatarClass",
|
|
34
|
+
"suggestion": "shein-components_systemrobotassistant_suggestion",
|
|
35
|
+
"link": "shein-components_systemrobotassistant_link",
|
|
36
|
+
"closedIcon": "shein-components_systemrobotassistant_closedIcon",
|
|
37
|
+
"chatContentWrapper": "shein-components_systemrobotassistant_chatContentWrapper",
|
|
38
|
+
"switch": "shein-components_systemrobotassistant_switch",
|
|
39
|
+
"robotImg": "shein-components_systemrobotassistant_robotImg",
|
|
40
|
+
"robotGif": "shein-components_systemrobotassistant_robotGif",
|
|
41
|
+
"expireStatus": "shein-components_systemrobotassistant_expireStatus",
|
|
42
|
+
"none": "shein-components_systemrobotassistant_none",
|
|
43
|
+
"modalMask": "shein-components_systemrobotassistant_modalMask"
|
|
44
|
+
};
|
|
45
|
+
import { setHfcSpace, setHfcEnv, clearAll, setTokenInvalidCallback, getHfcToken as hfcIsLogin, setLocalStorage, setTranslateFn } from "./js/hfc-space";
|
|
46
|
+
import ErrorBoundary from "./component/error-boundary";
|
|
47
|
+
import { openITNoticeModal } from "./component/it-notice-modal";
|
|
48
|
+
var defaultSate = {
|
|
49
|
+
isHover: false,
|
|
50
|
+
isMoving: false,
|
|
51
|
+
bottom: 12,
|
|
52
|
+
right: 32,
|
|
53
|
+
modalVisible: false,
|
|
54
|
+
// 记录按下去的时间戳
|
|
55
|
+
mouseDownTime: 0,
|
|
56
|
+
messageCount: 0,
|
|
57
|
+
isCollapse: false,
|
|
58
|
+
showExpirePopover: false
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* @cn 帮助中心机器人组件
|
|
63
|
+
* @desc 帮助中心机器人组件,不需要安装,不能直接使用,@shein-components/hfc-robot 内部调用,安装 @shein-components/hfc-robot 即可使用
|
|
64
|
+
* @author -
|
|
65
|
+
*/
|
|
66
|
+
class SystemRobotAssistant extends PureComponent {
|
|
67
|
+
constructor(props) {
|
|
68
|
+
super(props);
|
|
69
|
+
setHfcSpace(props.hfcSpace);
|
|
70
|
+
setHfcEnv(props.env);
|
|
71
|
+
this.state = defaultSate;
|
|
72
|
+
this.iconRef = /*#__PURE__*/createRef();
|
|
73
|
+
this.modalRef = /*#__PURE__*/createRef();
|
|
74
|
+
this.popoverTimerRef = /*#__PURE__*/createRef();
|
|
75
|
+
this.handleInit = this.handleInit.bind(this);
|
|
76
|
+
this.setMoving = this.setMoving.bind(this);
|
|
77
|
+
this.onMouseDown = this.onMouseDown.bind(this);
|
|
78
|
+
this.onMouseUp = this.onMouseUp.bind(this);
|
|
79
|
+
this.handleTokenInvalid = this.handleTokenInvalid.bind(this);
|
|
80
|
+
this.setModalVisible = this.setModalVisible.bind(this);
|
|
81
|
+
this.closeVisible = this.closeVisible.bind(this);
|
|
82
|
+
this.adjustIconPosition = this.adjustIconPosition.bind(this);
|
|
83
|
+
this.addMoveListener = this.addMoveListener.bind(this);
|
|
84
|
+
this.mouseupListener = this.mouseupListener.bind(this);
|
|
85
|
+
this.getRenderIcon = this.getRenderIcon.bind(this);
|
|
86
|
+
this.isPopITInform = this.isPopITInform.bind(this);
|
|
87
|
+
}
|
|
88
|
+
componentDidMount() {
|
|
89
|
+
var _this$props = this.props,
|
|
90
|
+
bottom = _this$props.bottom,
|
|
91
|
+
right = _this$props.right,
|
|
92
|
+
draggable = _this$props.draggable,
|
|
93
|
+
isLogin = _this$props.isLogin,
|
|
94
|
+
t = _this$props.t,
|
|
95
|
+
hfcSpace = _this$props.hfcSpace,
|
|
96
|
+
lang = _this$props.lang;
|
|
97
|
+
setTranslateFn(t);
|
|
98
|
+
setLocalStorage({
|
|
99
|
+
[`${hfcSpace}-lang`]: lang || 'CN'
|
|
100
|
+
});
|
|
101
|
+
window.addEventListener('mouseup', this.mouseupListener);
|
|
102
|
+
// draggable 为 true 时,才处理图标位置
|
|
103
|
+
if (draggable) {
|
|
104
|
+
window.addEventListener('mousedown', this.addMoveListener);
|
|
105
|
+
}
|
|
106
|
+
if (isLogin) {
|
|
107
|
+
this.handleInit();
|
|
108
|
+
}
|
|
109
|
+
// 登录失效的回调
|
|
110
|
+
setTokenInvalidCallback(this.handleTokenInvalid);
|
|
111
|
+
this.setState({
|
|
112
|
+
bottom,
|
|
113
|
+
right
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
componentDidUpdate(prevProps, prevState) {
|
|
117
|
+
var _this$props2 = this.props,
|
|
118
|
+
draggable = _this$props2.draggable,
|
|
119
|
+
isLogin = _this$props2.isLogin,
|
|
120
|
+
t = _this$props2.t,
|
|
121
|
+
hfcSpace = _this$props2.hfcSpace,
|
|
122
|
+
lang = _this$props2.lang;
|
|
123
|
+
var isCollapse = this.state.isCollapse;
|
|
124
|
+
// draggable 为 true 时,才处理图标位置
|
|
125
|
+
if (draggable && !isCollapse && isCollapse !== prevState.isCollapse) {
|
|
126
|
+
// 如果当前 icon 在临界点时,不让图标超出外面
|
|
127
|
+
this.adjustIconPosition();
|
|
128
|
+
}
|
|
129
|
+
if (isLogin !== prevProps.isLogin && isLogin) {
|
|
130
|
+
this.handleInit();
|
|
131
|
+
}
|
|
132
|
+
if (t !== prevProps.t || hfcSpace !== prevProps.hfcSpace || lang !== prevProps.lang) {
|
|
133
|
+
setTranslateFn(t);
|
|
134
|
+
setLocalStorage({
|
|
135
|
+
[`${hfcSpace}-lang`]: lang || 'CN'
|
|
136
|
+
});
|
|
137
|
+
}
|
|
138
|
+
setTokenInvalidCallback(this.handleTokenInvalid);
|
|
139
|
+
}
|
|
140
|
+
componentWillUnmount() {
|
|
141
|
+
clearAll();
|
|
142
|
+
clearInterval(this.timer);
|
|
143
|
+
var draggable = this.props.draggable;
|
|
144
|
+
if (draggable) {
|
|
145
|
+
window.removeEventListener('mousedown', this.addMoveListener);
|
|
146
|
+
}
|
|
147
|
+
window.removeEventListener('mouseup', this.mouseupListener);
|
|
148
|
+
this.timer = null;
|
|
149
|
+
}
|
|
150
|
+
onMouseDown() {
|
|
151
|
+
this.setState({
|
|
152
|
+
isMoving: true,
|
|
153
|
+
mouseDownTime: new Date().getTime()
|
|
154
|
+
});
|
|
155
|
+
}
|
|
156
|
+
onMouseUp() {
|
|
157
|
+
this.setState({
|
|
158
|
+
isMoving: false
|
|
159
|
+
});
|
|
160
|
+
}
|
|
161
|
+
setMoving(e) {
|
|
162
|
+
var isMoving = this.state.isMoving;
|
|
163
|
+
if (!isMoving) return;
|
|
164
|
+
e.preventDefault();
|
|
165
|
+
var _this$state = this.state,
|
|
166
|
+
right = _this$state.right,
|
|
167
|
+
bottom = _this$state.bottom;
|
|
168
|
+
var movementX = e.movementX,
|
|
169
|
+
movementY = e.movementY;
|
|
170
|
+
var _this$iconRef$current = this.iconRef.current.getBoundingClientRect(),
|
|
171
|
+
width = _this$iconRef$current.width,
|
|
172
|
+
height = _this$iconRef$current.height;
|
|
173
|
+
var rightBound = window.innerWidth - width;
|
|
174
|
+
var topBound = window.innerHeight - height;
|
|
175
|
+
var x = 0;
|
|
176
|
+
if (right - movementX >= window.innerWidth) {
|
|
177
|
+
x = window.innerWidth;
|
|
178
|
+
} else {
|
|
179
|
+
x = right - movementX;
|
|
180
|
+
}
|
|
181
|
+
var y = 0;
|
|
182
|
+
if (bottom - movementY >= window.innerHeight) {
|
|
183
|
+
y = window.innerHeight;
|
|
184
|
+
} else {
|
|
185
|
+
y = bottom - movementY;
|
|
186
|
+
}
|
|
187
|
+
// 当前图标超出边界
|
|
188
|
+
if (x < 0 || x > rightBound || y < 0 || y > topBound) {
|
|
189
|
+
this.setState({
|
|
190
|
+
isCollapse: true,
|
|
191
|
+
modalVisible: false
|
|
192
|
+
});
|
|
193
|
+
return;
|
|
194
|
+
}
|
|
195
|
+
this.setState({
|
|
196
|
+
right: x,
|
|
197
|
+
bottom: y
|
|
198
|
+
});
|
|
199
|
+
}
|
|
200
|
+
setHover(bool) {
|
|
201
|
+
this.setState({
|
|
202
|
+
isHover: bool
|
|
203
|
+
});
|
|
204
|
+
}
|
|
205
|
+
setModalVisible() {
|
|
206
|
+
var _this$state2 = this.state,
|
|
207
|
+
modalVisible = _this$state2.modalVisible,
|
|
208
|
+
mouseDownTime = _this$state2.mouseDownTime;
|
|
209
|
+
var isLogin = this.props.isLogin;
|
|
210
|
+
var draggable = this.props.draggable;
|
|
211
|
+
if (!isLogin) return;
|
|
212
|
+
// 大于 170 豪秒就不要处理点击事件且 draggable 为 true 时,不处理
|
|
213
|
+
if (draggable && new Date().getTime() - mouseDownTime > 170) return;
|
|
214
|
+
this.setState({
|
|
215
|
+
modalVisible: !modalVisible,
|
|
216
|
+
messageCount: 0
|
|
217
|
+
});
|
|
218
|
+
}
|
|
219
|
+
getRenderIcon() {
|
|
220
|
+
var renderIcon = this.props.renderIcon;
|
|
221
|
+
var isLogin = this.props.isLogin;
|
|
222
|
+
if (typeof renderIcon === 'function') {
|
|
223
|
+
return renderIcon(isLogin);
|
|
224
|
+
}
|
|
225
|
+
return renderIcon;
|
|
226
|
+
}
|
|
227
|
+
mouseupListener(e) {
|
|
228
|
+
var _this$modalRef, _this$modalRef$curren, _this$iconRef, _this$iconRef$current2;
|
|
229
|
+
if (!(this !== null && this !== void 0 && (_this$modalRef = this.modalRef) !== null && _this$modalRef !== void 0 && (_this$modalRef$curren = _this$modalRef.current) !== null && _this$modalRef$curren !== void 0 && _this$modalRef$curren.contains(e.target)) && !(this !== null && this !== void 0 && (_this$iconRef = this.iconRef) !== null && _this$iconRef !== void 0 && (_this$iconRef$current2 = _this$iconRef.current) !== null && _this$iconRef$current2 !== void 0 && _this$iconRef$current2.contains(e.target))) {
|
|
230
|
+
this.setState({
|
|
231
|
+
modalVisible: false
|
|
232
|
+
});
|
|
233
|
+
}
|
|
234
|
+
var draggable = this.props.draggable;
|
|
235
|
+
// draggable 为 false 时,不处理
|
|
236
|
+
if (!draggable) return;
|
|
237
|
+
this.setState({
|
|
238
|
+
isMoving: false
|
|
239
|
+
});
|
|
240
|
+
document.body.removeEventListener('mousemove', this.setMoving);
|
|
241
|
+
}
|
|
242
|
+
addMoveListener() {
|
|
243
|
+
document.body.addEventListener('mousemove', this.setMoving);
|
|
244
|
+
}
|
|
245
|
+
handleTokenInvalid(argument) {
|
|
246
|
+
var _this$props3 = this.props,
|
|
247
|
+
bottom = _this$props3.bottom,
|
|
248
|
+
right = _this$props3.right,
|
|
249
|
+
expireTipUse = _this$props3.expireTipUse;
|
|
250
|
+
// 登录失效要关掉窗口
|
|
251
|
+
this.setState(_objectSpread(_objectSpread({}, defaultSate), {}, {
|
|
252
|
+
modalVisible: false,
|
|
253
|
+
bottom,
|
|
254
|
+
right
|
|
255
|
+
}), () => {
|
|
256
|
+
if (expireTipUse) {
|
|
257
|
+
this.setState({
|
|
258
|
+
showExpirePopover: true
|
|
259
|
+
});
|
|
260
|
+
}
|
|
261
|
+
});
|
|
262
|
+
if (expireTipUse) {
|
|
263
|
+
// eslint-disable-next-line no-unused-expressions
|
|
264
|
+
this.popoverTimerRef && clearTimeout(this.popoverTimerRef);
|
|
265
|
+
this.popoverTimerRef = setTimeout(() => {
|
|
266
|
+
this.setState({
|
|
267
|
+
showExpirePopover: false
|
|
268
|
+
});
|
|
269
|
+
}, 15000);
|
|
270
|
+
}
|
|
271
|
+
var tokenInvalidCallback = this.props.tokenInvalidCallback;
|
|
272
|
+
tokenInvalidCallback(argument);
|
|
273
|
+
}
|
|
274
|
+
closeVisible() {
|
|
275
|
+
this.setState({
|
|
276
|
+
modalVisible: false
|
|
277
|
+
});
|
|
278
|
+
}
|
|
279
|
+
handleInit() {
|
|
280
|
+
this.setState({
|
|
281
|
+
showExpirePopover: false
|
|
282
|
+
});
|
|
283
|
+
this.statisticsMessageCount();
|
|
284
|
+
this.isPopITInform();
|
|
285
|
+
clearInterval(this.timer);
|
|
286
|
+
this.timer = setInterval(() => {
|
|
287
|
+
this.statisticsMessageCount();
|
|
288
|
+
}, 1000 * 60 * 10);
|
|
289
|
+
}
|
|
290
|
+
statisticsMessageCount() {
|
|
291
|
+
var isLogin = this.props.isLogin;
|
|
292
|
+
if (!isLogin) return;
|
|
293
|
+
Server.statisticsMessageCount().then(res => {
|
|
294
|
+
if (res) {
|
|
295
|
+
this.setState({
|
|
296
|
+
messageCount: res.info && res.info.messageCount
|
|
297
|
+
});
|
|
298
|
+
}
|
|
299
|
+
});
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
// 校正大图标的位置
|
|
303
|
+
adjustIconPosition() {
|
|
304
|
+
var _this$iconRef$current3 = this.iconRef.current.getBoundingClientRect(),
|
|
305
|
+
width = _this$iconRef$current3.width,
|
|
306
|
+
height = _this$iconRef$current3.height,
|
|
307
|
+
top = _this$iconRef$current3.top,
|
|
308
|
+
left = _this$iconRef$current3.left,
|
|
309
|
+
iconRight = _this$iconRef$current3.right,
|
|
310
|
+
iconBottom = _this$iconRef$current3.bottom;
|
|
311
|
+
var _this$state3 = this.state,
|
|
312
|
+
bottom = _this$state3.bottom,
|
|
313
|
+
right = _this$state3.right;
|
|
314
|
+
var x = right;
|
|
315
|
+
var y = bottom;
|
|
316
|
+
if (top < 0) {
|
|
317
|
+
y = window.innerHeight - height;
|
|
318
|
+
} else if (iconBottom < 0) {
|
|
319
|
+
y = 0;
|
|
320
|
+
}
|
|
321
|
+
if (left < 0) {
|
|
322
|
+
x = window.innerWidth - width;
|
|
323
|
+
} else if (iconRight < 0) {
|
|
324
|
+
x = 0;
|
|
325
|
+
}
|
|
326
|
+
this.setState({
|
|
327
|
+
right: x,
|
|
328
|
+
bottom: y
|
|
329
|
+
});
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
// eslint-disable-next-line class-methods-use-this
|
|
333
|
+
isPopITInform() {
|
|
334
|
+
var _this = this;
|
|
335
|
+
return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
336
|
+
var _this$props4, zIndex, t, res;
|
|
337
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
338
|
+
while (1) switch (_context.prev = _context.next) {
|
|
339
|
+
case 0:
|
|
340
|
+
_this$props4 = _this.props, zIndex = _this$props4.zIndex, t = _this$props4.t;
|
|
341
|
+
_context.next = 3;
|
|
342
|
+
return Server.isPopITInform();
|
|
343
|
+
case 3:
|
|
344
|
+
res = _context.sent;
|
|
345
|
+
if (res !== null && res !== void 0 && res.info) {
|
|
346
|
+
openITNoticeModal({
|
|
347
|
+
zIndex,
|
|
348
|
+
t
|
|
349
|
+
});
|
|
350
|
+
}
|
|
351
|
+
case 5:
|
|
352
|
+
case "end":
|
|
353
|
+
return _context.stop();
|
|
354
|
+
}
|
|
355
|
+
}, _callee);
|
|
356
|
+
}))();
|
|
357
|
+
}
|
|
358
|
+
render() {
|
|
359
|
+
var _this$iconRef2;
|
|
360
|
+
var _this$state4 = this.state,
|
|
361
|
+
isHover = _this$state4.isHover,
|
|
362
|
+
bottom = _this$state4.bottom,
|
|
363
|
+
right = _this$state4.right,
|
|
364
|
+
modalVisible = _this$state4.modalVisible,
|
|
365
|
+
messageCount = _this$state4.messageCount,
|
|
366
|
+
isCollapse = _this$state4.isCollapse,
|
|
367
|
+
showExpirePopover = _this$state4.showExpirePopover;
|
|
368
|
+
var _this$props5 = this.props,
|
|
369
|
+
zIndex = _this$props5.zIndex,
|
|
370
|
+
iconWrapperClassName = _this$props5.iconWrapperClassName,
|
|
371
|
+
iconClassName = _this$props5.iconClassName,
|
|
372
|
+
textClassName = _this$props5.textClassName,
|
|
373
|
+
renderIcon = _this$props5.renderIcon,
|
|
374
|
+
draggable = _this$props5.draggable,
|
|
375
|
+
nodeIdList = _this$props5.nodeIdList,
|
|
376
|
+
isLogin = _this$props5.isLogin,
|
|
377
|
+
t = _this$props5.t;
|
|
378
|
+
var actualRenderIcon = renderIcon ? /*#__PURE__*/React.cloneElement(this.getRenderIcon(renderIcon), _objectSpread({
|
|
379
|
+
onClick: this.setModalVisible
|
|
380
|
+
}, draggable ? {
|
|
381
|
+
onMouseDown: this.onMouseDown,
|
|
382
|
+
onMouseUp: this.onMouseUp
|
|
383
|
+
} : {})) : null;
|
|
384
|
+
return /*#__PURE__*/React.createElement(ErrorBoundary, null, 'renderIcon' in this.props ? /*#__PURE__*/React.createElement("div", {
|
|
385
|
+
className: classNames(styles.renderIconWrapper, draggable && styles.draggableIcon, iconWrapperClassName),
|
|
386
|
+
style: {
|
|
387
|
+
zIndex,
|
|
388
|
+
bottom,
|
|
389
|
+
right
|
|
390
|
+
}
|
|
391
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
392
|
+
ref: this.iconRef
|
|
393
|
+
}, actualRenderIcon), messageCount && isLogin ? /*#__PURE__*/React.createElement("div", {
|
|
394
|
+
className: styles.redDot
|
|
395
|
+
}, messageCount) : null) : /*#__PURE__*/React.createElement("div", {
|
|
396
|
+
className: classNames(styles.iconWrapper, isCollapse && styles.collapseRobotBox, iconWrapperClassName),
|
|
397
|
+
style: {
|
|
398
|
+
bottom,
|
|
399
|
+
right,
|
|
400
|
+
zIndex
|
|
401
|
+
},
|
|
402
|
+
ref: this.iconRef,
|
|
403
|
+
onMouseDown: draggable ? this.onMouseDown : undefined,
|
|
404
|
+
onMouseUp: draggable ? this.onMouseUp : undefined,
|
|
405
|
+
onClick: this.setModalVisible
|
|
406
|
+
}, /*#__PURE__*/React.createElement(Popover, {
|
|
407
|
+
zIndex: zIndex,
|
|
408
|
+
visible: showExpirePopover
|
|
409
|
+
}, t('有事找 TA 登陆已失效,请刷新页面重试')), !isCollapse ? /*#__PURE__*/React.createElement("div", {
|
|
410
|
+
className: classNames(styles.avatarWrap)
|
|
411
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
412
|
+
className: classNames(styles.avatarBorder, isHover && styles.hover),
|
|
413
|
+
onMouseOver: () => {
|
|
414
|
+
this.setHover(true);
|
|
415
|
+
},
|
|
416
|
+
onMouseOut: () => {
|
|
417
|
+
this.setHover(false);
|
|
418
|
+
}
|
|
419
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
420
|
+
className: classNames(styles.robotImg, !isLogin && styles.expireStatus, iconClassName)
|
|
421
|
+
})), /*#__PURE__*/React.createElement("span", {
|
|
422
|
+
className: classNames(styles.switch, textClassName)
|
|
423
|
+
}, modalVisible ? t('戳我关闭') : t('有事找TA'))) : /*#__PURE__*/React.createElement(Icon, {
|
|
424
|
+
className: styles.collapseIcon,
|
|
425
|
+
name: "round-arrow-right",
|
|
426
|
+
onClick: e => {
|
|
427
|
+
e.stopPropagation();
|
|
428
|
+
e.preventDefault();
|
|
429
|
+
this.setState({
|
|
430
|
+
isCollapse: !isCollapse
|
|
431
|
+
});
|
|
432
|
+
}
|
|
433
|
+
}), messageCount && isLogin ? /*#__PURE__*/React.createElement("div", {
|
|
434
|
+
className: styles.redDot
|
|
435
|
+
}, messageCount) : null), modalVisible ? /*#__PURE__*/React.createElement(ChatModal, _extends({
|
|
436
|
+
modalRef: this.modalRef,
|
|
437
|
+
iconRef: (_this$iconRef2 = this.iconRef) === null || _this$iconRef2 === void 0 ? void 0 : _this$iconRef2.current,
|
|
438
|
+
onClose: this.closeVisible,
|
|
439
|
+
nodeIdList: nodeIdList
|
|
440
|
+
}, this.props)) : null);
|
|
441
|
+
}
|
|
442
|
+
}
|
|
443
|
+
SystemRobotAssistant.defaultProps = {
|
|
444
|
+
tokenInvalidCallback: () => null,
|
|
445
|
+
zIndex: 100,
|
|
446
|
+
iconWrapperClassName: '',
|
|
447
|
+
iconClassName: '',
|
|
448
|
+
textClassName: '',
|
|
449
|
+
spinSize: 40,
|
|
450
|
+
bottom: 12,
|
|
451
|
+
right: 32,
|
|
452
|
+
draggable: true,
|
|
453
|
+
expireTipUse: true,
|
|
454
|
+
chatgptUse: true,
|
|
455
|
+
lang: 'CN',
|
|
456
|
+
t: bblFormat
|
|
457
|
+
};
|
|
458
|
+
SystemRobotAssistant.propTypes = {
|
|
459
|
+
/** 系统 code,跟后端要或者在帮助中心后台端的系统配置页面查看 */
|
|
460
|
+
hfcSpace: Proptypes.string.isRequired,
|
|
461
|
+
/** 开发环境 可选 'dev'|'test'|'sit'|'online' */
|
|
462
|
+
env: Proptypes.string.isRequired,
|
|
463
|
+
/** 菜单栏名称 */
|
|
464
|
+
menusTitle: Proptypes.string,
|
|
465
|
+
/** 层级,默认 100 */
|
|
466
|
+
zIndex: Proptypes.number,
|
|
467
|
+
/** 帮助中心登录失效回调 */
|
|
468
|
+
tokenInvalidCallback: Proptypes.func,
|
|
469
|
+
/** 企微唤醒前置判断 */
|
|
470
|
+
checkBeforeCallWechat: Proptypes.func,
|
|
471
|
+
/** 最外层样式 */
|
|
472
|
+
iconWrapperClassName: Proptypes.string,
|
|
473
|
+
/** icon 样式 */
|
|
474
|
+
iconClassName: Proptypes.string,
|
|
475
|
+
/** 文字样式 */
|
|
476
|
+
textClassName: Proptypes.string,
|
|
477
|
+
/** 加载中的 spin 大小 -- 2.3.0 后废弃 */
|
|
478
|
+
spinSize: Proptypes.number,
|
|
479
|
+
/** 位置,right */
|
|
480
|
+
right: Proptypes.number,
|
|
481
|
+
/** 位置,bottom */
|
|
482
|
+
bottom: Proptypes.number,
|
|
483
|
+
/** 自定义 icon */
|
|
484
|
+
renderIcon: Proptypes.oneOfType([Proptypes.element, Proptypes.func]),
|
|
485
|
+
/** 是否可移动 */
|
|
486
|
+
draggable: Proptypes.bool,
|
|
487
|
+
/** 是否显示过期提示 */
|
|
488
|
+
expireTipUse: Proptypes.bool,
|
|
489
|
+
/** 是否使用 chatgpt */
|
|
490
|
+
chatgptUse: Proptypes.bool,
|
|
491
|
+
/** 分组 id 列表 */
|
|
492
|
+
nodeIdList: Proptypes.arrayOf(Proptypes.string),
|
|
493
|
+
/** 是否登录 */
|
|
494
|
+
isLogin: Proptypes.bool,
|
|
495
|
+
/** 多语言翻译函数 */
|
|
496
|
+
t: Proptypes.func,
|
|
497
|
+
/** 多语言 */
|
|
498
|
+
lang: Proptypes.string
|
|
499
|
+
};
|
|
500
|
+
SystemRobotAssistant.hfcIsLogin = hfcIsLogin;
|
|
501
|
+
|
|
502
|
+
// 暴露到 window, HFC Bot 组件会用到
|
|
503
|
+
window.SystemRobotAssistant = {
|
|
504
|
+
default: SystemRobotAssistant
|
|
505
|
+
};
|
|
506
|
+
export default SystemRobotAssistant;
|
package/es/js/const.d.ts
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
export namespace contentType {
|
|
2
|
+
const OPPOSITION: number;
|
|
3
|
+
const MYSELF: number;
|
|
4
|
+
const TIPS: number;
|
|
5
|
+
const NEEDANSWER: number;
|
|
6
|
+
}
|
|
7
|
+
export namespace TIPS {
|
|
8
|
+
namespace globalCount {
|
|
9
|
+
const content: string;
|
|
10
|
+
const link: string;
|
|
11
|
+
}
|
|
12
|
+
namespace guideCount {
|
|
13
|
+
const content_1: string;
|
|
14
|
+
export { content_1 as content };
|
|
15
|
+
const link_1: string;
|
|
16
|
+
export { link_1 as link };
|
|
17
|
+
}
|
|
18
|
+
namespace problemCount {
|
|
19
|
+
const content_2: string;
|
|
20
|
+
export { content_2 as content };
|
|
21
|
+
const link_2: string;
|
|
22
|
+
export { link_2 as link };
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
export const TABS: ({
|
|
26
|
+
label: string;
|
|
27
|
+
value: number;
|
|
28
|
+
icon: string;
|
|
29
|
+
popoverContent?: undefined;
|
|
30
|
+
} | {
|
|
31
|
+
label: string;
|
|
32
|
+
value: number;
|
|
33
|
+
icon?: undefined;
|
|
34
|
+
popoverContent?: undefined;
|
|
35
|
+
} | {
|
|
36
|
+
label: string;
|
|
37
|
+
value: number;
|
|
38
|
+
icon: string;
|
|
39
|
+
popoverContent: string;
|
|
40
|
+
})[];
|
|
41
|
+
//# sourceMappingURL=const.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"const.d.ts","sourceRoot":"","sources":["../../src/js/const.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AA0BA;;;;;;;;;;;;;;;KAqBC"}
|