@magmamath/students-features 0.11.0-rc.0 → 0.11.0-rc.12
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/dist/commonjs/features/chatbot/components/Chat/BottomFade.js +36 -0
- package/dist/commonjs/features/chatbot/components/Chat/BottomFade.js.map +1 -0
- package/dist/commonjs/features/chatbot/components/Chat/Chat.js +88 -83
- package/dist/commonjs/features/chatbot/components/Chat/Chat.js.map +1 -1
- package/dist/commonjs/features/chatbot/components/Chat/ChatIcon.js +34 -0
- package/dist/commonjs/features/chatbot/components/Chat/ChatIcon.js.map +1 -0
- package/dist/commonjs/features/chatbot/components/Chat/ChatInputBlock.js +39 -0
- package/dist/commonjs/features/chatbot/components/Chat/ChatInputBlock.js.map +1 -0
- package/dist/commonjs/features/chatbot/components/Chat/CloseButton.js +1 -23
- package/dist/commonjs/features/chatbot/components/Chat/CloseButton.js.map +1 -1
- package/dist/commonjs/features/chatbot/components/Chat/GradientFade.js +44 -0
- package/dist/commonjs/features/chatbot/components/Chat/GradientFade.js.map +1 -0
- package/dist/commonjs/features/chatbot/components/Chat/MessageItem.js +84 -0
- package/dist/commonjs/features/chatbot/components/Chat/MessageItem.js.map +1 -0
- package/dist/commonjs/features/chatbot/components/Chat/constants.js +32 -0
- package/dist/commonjs/features/chatbot/components/Chat/constants.js.map +1 -0
- package/dist/commonjs/features/chatbot/components/ChatControls/ChatControls.js +3 -1
- package/dist/commonjs/features/chatbot/components/ChatControls/ChatControls.js.map +1 -1
- package/dist/commonjs/features/chatbot/components/ChatInput/ChatInput.js +0 -2
- package/dist/commonjs/features/chatbot/components/ChatInput/ChatInput.js.map +1 -1
- package/dist/commonjs/features/chatbot/components/ChatMessage/AnimatedMessage.js +41 -0
- package/dist/commonjs/features/chatbot/components/ChatMessage/AnimatedMessage.js.map +1 -0
- package/dist/commonjs/features/chatbot/components/ChatMessage/MessageLoader.js +11 -23
- package/dist/commonjs/features/chatbot/components/ChatMessage/MessageLoader.js.map +1 -1
- package/dist/commonjs/features/chatbot/components/ChatMessage/ReceivedMessage.js +8 -8
- package/dist/commonjs/features/chatbot/components/ChatMessage/ReceivedMessage.js.map +1 -1
- package/dist/commonjs/features/chatbot/components/Chatbot.js +2 -1
- package/dist/commonjs/features/chatbot/components/Chatbot.js.map +1 -1
- package/dist/commonjs/features/chatbot/model/ChatBotModel.js +6 -0
- package/dist/commonjs/features/chatbot/model/ChatBotModel.js.map +1 -1
- package/dist/commonjs/features/chatbot/model/ChatBoxTextManager.js +2 -1
- package/dist/commonjs/features/chatbot/model/ChatBoxTextManager.js.map +1 -1
- package/dist/commonjs/features/chatbot/model/ChatbotTranslation.js +1 -1
- package/dist/commonjs/features/chatbot/model/ChatbotTranslation.js.map +1 -1
- package/dist/commonjs/features/chatbot/types/model.types.js.map +1 -1
- package/dist/commonjs/shared/translation/localization/ca.json +2 -1
- package/dist/commonjs/shared/translation/localization/de.json +2 -1
- package/dist/commonjs/shared/translation/localization/en.json +2 -1
- package/dist/commonjs/shared/translation/localization/gb.json +2 -1
- package/dist/commonjs/shared/translation/localization/sct.json +2 -1
- package/dist/commonjs/shared/translation/localization/sw.json +2 -1
- package/dist/module/features/chatbot/components/Chat/BottomFade.js +30 -0
- package/dist/module/features/chatbot/components/Chat/BottomFade.js.map +1 -0
- package/dist/module/features/chatbot/components/Chat/Chat.js +89 -84
- package/dist/module/features/chatbot/components/Chat/Chat.js.map +1 -1
- package/dist/module/features/chatbot/components/Chat/ChatIcon.js +28 -0
- package/dist/module/features/chatbot/components/Chat/ChatIcon.js.map +1 -0
- package/dist/module/features/chatbot/components/Chat/ChatInputBlock.js +33 -0
- package/dist/module/features/chatbot/components/Chat/ChatInputBlock.js.map +1 -0
- package/dist/module/features/chatbot/components/Chat/CloseButton.js +2 -24
- package/dist/module/features/chatbot/components/Chat/CloseButton.js.map +1 -1
- package/dist/module/features/chatbot/components/Chat/GradientFade.js +39 -0
- package/dist/module/features/chatbot/components/Chat/GradientFade.js.map +1 -0
- package/dist/module/features/chatbot/components/Chat/MessageItem.js +78 -0
- package/dist/module/features/chatbot/components/Chat/MessageItem.js.map +1 -0
- package/dist/module/features/chatbot/components/Chat/constants.js +28 -0
- package/dist/module/features/chatbot/components/Chat/constants.js.map +1 -0
- package/dist/module/features/chatbot/components/ChatControls/ChatControls.js +3 -1
- package/dist/module/features/chatbot/components/ChatControls/ChatControls.js.map +1 -1
- package/dist/module/features/chatbot/components/ChatInput/ChatInput.js +0 -2
- package/dist/module/features/chatbot/components/ChatInput/ChatInput.js.map +1 -1
- package/dist/module/features/chatbot/components/ChatMessage/AnimatedMessage.js +34 -0
- package/dist/module/features/chatbot/components/ChatMessage/AnimatedMessage.js.map +1 -0
- package/dist/module/features/chatbot/components/ChatMessage/MessageLoader.js +13 -24
- package/dist/module/features/chatbot/components/ChatMessage/MessageLoader.js.map +1 -1
- package/dist/module/features/chatbot/components/ChatMessage/ReceivedMessage.js +8 -8
- package/dist/module/features/chatbot/components/ChatMessage/ReceivedMessage.js.map +1 -1
- package/dist/module/features/chatbot/components/Chatbot.js +2 -1
- package/dist/module/features/chatbot/components/Chatbot.js.map +1 -1
- package/dist/module/features/chatbot/model/ChatBotModel.js +6 -0
- package/dist/module/features/chatbot/model/ChatBotModel.js.map +1 -1
- package/dist/module/features/chatbot/model/ChatBoxTextManager.js +2 -1
- package/dist/module/features/chatbot/model/ChatBoxTextManager.js.map +1 -1
- package/dist/module/features/chatbot/model/ChatbotTranslation.js +1 -1
- package/dist/module/features/chatbot/model/ChatbotTranslation.js.map +1 -1
- package/dist/module/features/chatbot/types/model.types.js.map +1 -1
- package/dist/module/shared/translation/localization/ca.json +2 -1
- package/dist/module/shared/translation/localization/de.json +2 -1
- package/dist/module/shared/translation/localization/en.json +2 -1
- package/dist/module/shared/translation/localization/gb.json +2 -1
- package/dist/module/shared/translation/localization/sct.json +2 -1
- package/dist/module/shared/translation/localization/sw.json +2 -1
- package/dist/typescript/commonjs/features/chatbot/components/Chat/BottomFade.d.ts +7 -0
- package/dist/typescript/commonjs/features/chatbot/components/Chat/BottomFade.d.ts.map +1 -0
- package/dist/typescript/commonjs/features/chatbot/components/Chat/Chat.d.ts +1 -1
- package/dist/typescript/commonjs/features/chatbot/components/Chat/Chat.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/chatbot/components/Chat/ChatIcon.d.ts +7 -0
- package/dist/typescript/commonjs/features/chatbot/components/Chat/ChatIcon.d.ts.map +1 -0
- package/dist/typescript/commonjs/features/chatbot/components/Chat/ChatInputBlock.d.ts +12 -0
- package/dist/typescript/commonjs/features/chatbot/components/Chat/ChatInputBlock.d.ts.map +1 -0
- package/dist/typescript/commonjs/features/chatbot/components/Chat/CloseButton.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/chatbot/components/Chat/GradientFade.d.ts +10 -0
- package/dist/typescript/commonjs/features/chatbot/components/Chat/GradientFade.d.ts.map +1 -0
- package/dist/typescript/commonjs/features/chatbot/components/Chat/MessageItem.d.ts +17 -0
- package/dist/typescript/commonjs/features/chatbot/components/Chat/MessageItem.d.ts.map +1 -0
- package/dist/typescript/commonjs/features/chatbot/components/Chat/constants.d.ts +9 -0
- package/dist/typescript/commonjs/features/chatbot/components/Chat/constants.d.ts.map +1 -0
- package/dist/typescript/commonjs/features/chatbot/components/ChatControls/ChatControls.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/chatbot/components/ChatMessage/AnimatedMessage.d.ts +7 -0
- package/dist/typescript/commonjs/features/chatbot/components/ChatMessage/AnimatedMessage.d.ts.map +1 -0
- package/dist/typescript/commonjs/features/chatbot/components/ChatMessage/ChatMessage.d.ts +1 -1
- package/dist/typescript/commonjs/features/chatbot/components/ChatMessage/ChatMessage.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/chatbot/components/ChatMessage/MessageLoader.d.ts +5 -1
- package/dist/typescript/commonjs/features/chatbot/components/ChatMessage/MessageLoader.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/chatbot/components/ChatMessage/ReceivedMessage.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/chatbot/components/Chatbot.d.ts +2 -1
- package/dist/typescript/commonjs/features/chatbot/components/Chatbot.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/chatbot/model/ChatBotModel.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/chatbot/model/ChatBoxTextManager.d.ts.map +1 -1
- package/dist/typescript/commonjs/features/chatbot/types/model.types.d.ts +1 -0
- package/dist/typescript/commonjs/features/chatbot/types/model.types.d.ts.map +1 -1
- package/dist/typescript/commonjs/shared/translation/constants.d.ts +6 -0
- package/dist/typescript/commonjs/shared/translation/constants.d.ts.map +1 -1
- package/dist/typescript/commonjs/shared/translation/model.d.ts +2 -0
- package/dist/typescript/commonjs/shared/translation/model.d.ts.map +1 -1
- package/dist/typescript/module/features/chatbot/components/Chat/BottomFade.d.ts +7 -0
- package/dist/typescript/module/features/chatbot/components/Chat/BottomFade.d.ts.map +1 -0
- package/dist/typescript/module/features/chatbot/components/Chat/Chat.d.ts +1 -1
- package/dist/typescript/module/features/chatbot/components/Chat/Chat.d.ts.map +1 -1
- package/dist/typescript/module/features/chatbot/components/Chat/ChatIcon.d.ts +7 -0
- package/dist/typescript/module/features/chatbot/components/Chat/ChatIcon.d.ts.map +1 -0
- package/dist/typescript/module/features/chatbot/components/Chat/ChatInputBlock.d.ts +12 -0
- package/dist/typescript/module/features/chatbot/components/Chat/ChatInputBlock.d.ts.map +1 -0
- package/dist/typescript/module/features/chatbot/components/Chat/CloseButton.d.ts.map +1 -1
- package/dist/typescript/module/features/chatbot/components/Chat/GradientFade.d.ts +10 -0
- package/dist/typescript/module/features/chatbot/components/Chat/GradientFade.d.ts.map +1 -0
- package/dist/typescript/module/features/chatbot/components/Chat/MessageItem.d.ts +17 -0
- package/dist/typescript/module/features/chatbot/components/Chat/MessageItem.d.ts.map +1 -0
- package/dist/typescript/module/features/chatbot/components/Chat/constants.d.ts +9 -0
- package/dist/typescript/module/features/chatbot/components/Chat/constants.d.ts.map +1 -0
- package/dist/typescript/module/features/chatbot/components/ChatControls/ChatControls.d.ts.map +1 -1
- package/dist/typescript/module/features/chatbot/components/ChatMessage/AnimatedMessage.d.ts +7 -0
- package/dist/typescript/module/features/chatbot/components/ChatMessage/AnimatedMessage.d.ts.map +1 -0
- package/dist/typescript/module/features/chatbot/components/ChatMessage/ChatMessage.d.ts +1 -1
- package/dist/typescript/module/features/chatbot/components/ChatMessage/ChatMessage.d.ts.map +1 -1
- package/dist/typescript/module/features/chatbot/components/ChatMessage/MessageLoader.d.ts +5 -1
- package/dist/typescript/module/features/chatbot/components/ChatMessage/MessageLoader.d.ts.map +1 -1
- package/dist/typescript/module/features/chatbot/components/ChatMessage/ReceivedMessage.d.ts.map +1 -1
- package/dist/typescript/module/features/chatbot/components/Chatbot.d.ts +2 -1
- package/dist/typescript/module/features/chatbot/components/Chatbot.d.ts.map +1 -1
- package/dist/typescript/module/features/chatbot/model/ChatBotModel.d.ts.map +1 -1
- package/dist/typescript/module/features/chatbot/model/ChatBoxTextManager.d.ts.map +1 -1
- package/dist/typescript/module/features/chatbot/types/model.types.d.ts +1 -0
- package/dist/typescript/module/features/chatbot/types/model.types.d.ts.map +1 -1
- package/dist/typescript/module/shared/translation/constants.d.ts +6 -0
- package/dist/typescript/module/shared/translation/constants.d.ts.map +1 -1
- package/dist/typescript/module/shared/translation/model.d.ts +2 -0
- package/dist/typescript/module/shared/translation/model.d.ts.map +1 -1
- package/package.json +3 -1
- package/src/features/chatbot/components/Chat/BottomFade.tsx +31 -0
- package/src/features/chatbot/components/Chat/Chat.tsx +122 -100
- package/src/features/chatbot/components/Chat/ChatIcon.tsx +27 -0
- package/src/features/chatbot/components/Chat/ChatInputBlock.tsx +43 -0
- package/src/features/chatbot/components/Chat/CloseButton.tsx +1 -30
- package/src/features/chatbot/components/Chat/GradientFade.tsx +43 -0
- package/src/features/chatbot/components/Chat/MessageItem.tsx +92 -0
- package/src/features/chatbot/components/Chat/constants.ts +16 -0
- package/src/features/chatbot/components/ChatControls/ChatControls.tsx +3 -1
- package/src/features/chatbot/components/ChatInput/ChatInput.tsx +0 -1
- package/src/features/chatbot/components/ChatMessage/AnimatedMessage.tsx +30 -0
- package/src/features/chatbot/components/ChatMessage/ChatMessage.tsx +1 -1
- package/src/features/chatbot/components/ChatMessage/MessageLoader.tsx +16 -20
- package/src/features/chatbot/components/ChatMessage/ReceivedMessage.tsx +7 -9
- package/src/features/chatbot/components/Chatbot.tsx +3 -1
- package/src/features/chatbot/model/ChatBotModel.ts +7 -0
- package/src/features/chatbot/model/ChatBoxTextManager.ts +1 -0
- package/src/features/chatbot/model/ChatbotTranslation.ts +1 -1
- package/src/features/chatbot/types/model.types.ts +1 -0
- package/src/shared/translation/localization/ca.json +2 -1
- package/src/shared/translation/localization/de.json +2 -1
- package/src/shared/translation/localization/en.json +2 -1
- package/src/shared/translation/localization/gb.json +2 -1
- package/src/shared/translation/localization/sct.json +2 -1
- package/src/shared/translation/localization/sw.json +2 -1
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.BottomFade = void 0;
|
|
7
|
+
var _react = _interopRequireDefault(require("react"));
|
|
8
|
+
var _reactNative = require("react-native");
|
|
9
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
10
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
11
|
+
const BottomFade = ({
|
|
12
|
+
visible
|
|
13
|
+
}) => /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
14
|
+
style: [styles.container, {
|
|
15
|
+
opacity: visible ? 1 : 0
|
|
16
|
+
}],
|
|
17
|
+
pointerEvents: "none"
|
|
18
|
+
});
|
|
19
|
+
exports.BottomFade = BottomFade;
|
|
20
|
+
const styles = _reactNative.StyleSheet.create({
|
|
21
|
+
container: {
|
|
22
|
+
position: 'absolute',
|
|
23
|
+
bottom: 52,
|
|
24
|
+
right: 0,
|
|
25
|
+
width: 370,
|
|
26
|
+
height: 40,
|
|
27
|
+
transition: 'opacity 0.2s ease-in-out',
|
|
28
|
+
..._reactNative.Platform.select({
|
|
29
|
+
web: {
|
|
30
|
+
backgroundImage: 'linear-gradient(to top, rgba(255,255,255,1) 10%, rgba(255,255,255,0.8) 40%, transparent 100%)'
|
|
31
|
+
},
|
|
32
|
+
default: {}
|
|
33
|
+
})
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
//# sourceMappingURL=BottomFade.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_react","_interopRequireDefault","require","_reactNative","_jsxRuntime","e","__esModule","default","BottomFade","visible","jsx","View","style","styles","container","opacity","pointerEvents","exports","StyleSheet","create","position","bottom","right","width","height","transition","Platform","select","web","backgroundImage"],"sourceRoot":"../../../../../../src","sources":["features/chatbot/components/Chat/BottomFade.tsx"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AAAyD,IAAAE,WAAA,GAAAF,OAAA;AAAA,SAAAD,uBAAAI,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAMlD,MAAMG,UAAU,GAAGA,CAAC;EAAEC;AAAyB,CAAC,kBACrD,IAAAL,WAAA,CAAAM,GAAA,EAACP,YAAA,CAAAQ,IAAI;EACHC,KAAK,EAAE,CAACC,MAAM,CAACC,SAAS,EAAE;IAAEC,OAAO,EAAEN,OAAO,GAAG,CAAC,GAAG;EAAE,CAAC,CAAE;EACxDO,aAAa,EAAC;AAAM,CACrB,CACF;AAAAC,OAAA,CAAAT,UAAA,GAAAA,UAAA;AAED,MAAMK,MAAM,GAAGK,uBAAU,CAACC,MAAM,CAAC;EAC/BL,SAAS,EAAE;IACTM,QAAQ,EAAE,UAAU;IACpBC,MAAM,EAAE,EAAE;IACVC,KAAK,EAAE,CAAC;IACRC,KAAK,EAAE,GAAG;IACVC,MAAM,EAAE,EAAE;IACVC,UAAU,EAAE,0BAA0B;IACtC,GAAGC,qBAAQ,CAACC,MAAM,CAAC;MACjBC,GAAG,EAAE;QACHC,eAAe,EACb;MACJ,CAAC;MACDtB,OAAO,EAAE,CAAC;IACZ,CAAC;EACH;AACF,CAAC,CAAC","ignoreList":[]}
|
|
@@ -8,21 +8,19 @@ var _react = _interopRequireWildcard(require("react"));
|
|
|
8
8
|
var _reactNative = require("react-native");
|
|
9
9
|
var _effectorReact = require("effector-react");
|
|
10
10
|
var _reactNativeUi = require("@magmamath/react-native-ui");
|
|
11
|
-
var _ChatMessage = require("../ChatMessage/ChatMessage.js");
|
|
12
11
|
var _MessageLoader = require("../ChatMessage/MessageLoader.js");
|
|
13
|
-
var _ChatInput = require("../ChatInput/ChatInput.js");
|
|
14
|
-
var _CloseButton = require("./CloseButton.js");
|
|
15
|
-
var _modelTypes = require("../../types/model.types.js");
|
|
16
12
|
var _styleTypes = require("../../types/style.types.js");
|
|
17
|
-
var
|
|
13
|
+
var _ChatIcon = require("./ChatIcon.js");
|
|
14
|
+
var _ChatInputBlock = require("./ChatInputBlock.js");
|
|
15
|
+
var _MessageItem = require("./MessageItem.js");
|
|
16
|
+
var _constants = require("./constants.js");
|
|
18
17
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
19
18
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
20
19
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
21
|
-
const
|
|
22
|
-
|
|
23
|
-
web: 265,
|
|
24
|
-
default: 294
|
|
20
|
+
const Separator = () => /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
21
|
+
style: styles.separator
|
|
25
22
|
});
|
|
23
|
+
const keyExtractor = (item, index) => `${item.id}-${index}`;
|
|
26
24
|
const Chat = ({
|
|
27
25
|
model,
|
|
28
26
|
isHintFeedback,
|
|
@@ -33,79 +31,92 @@ const Chat = ({
|
|
|
33
31
|
TTSHighlightRenderer,
|
|
34
32
|
onPressClose
|
|
35
33
|
}) => {
|
|
36
|
-
const dimensions = (0, _reactNative.useWindowDimensions)();
|
|
37
34
|
const ref = (0, _react.useRef)(null);
|
|
35
|
+
const [isScrollable, setIsScrollable] = (0, _react.useState)(false);
|
|
36
|
+
const [isScrolledUp, setIsScrolledUp] = (0, _react.useState)(false);
|
|
37
|
+
const [isAtTop, setIsAtTop] = (0, _react.useState)(false);
|
|
38
|
+
const maxHeightRef = (0, _react.useRef)(0);
|
|
39
|
+
const dimensions = (0, _reactNative.useWindowDimensions)();
|
|
38
40
|
const isOpen = (0, _effectorReact.useUnit)(model.$isOpen);
|
|
39
41
|
const isHelpRequestPending = (0, _effectorReact.useUnit)(model.sendHelpRequestFx.pending);
|
|
40
|
-
const isTextToSpeechPending = (0, _effectorReact.useUnit)(model.api.textToSpeechTextFx.pending);
|
|
41
|
-
const audioStatus = (0, _effectorReact.useUnit)(model.t2s.$status);
|
|
42
|
-
const currentPlayingId = (0, _effectorReact.useUnit)(model.t2s.$currentPlayingId);
|
|
43
|
-
const highlightedWordIndex = (0, _effectorReact.useUnit)(model.t2s.wordHighlight.$highlightedWordIndex);
|
|
44
|
-
const isScrollActive = (0, _effectorReact.useUnit)(model.$isScrollActive);
|
|
45
|
-
const isTranslated = (0, _effectorReact.useUnit)(model.translation.$isTranslated);
|
|
46
|
-
const errorSpottingEnabled = (0, _effectorReact.useUnit)(model.errorSpotting.$isEnabled);
|
|
47
42
|
const messages = (0, _effectorReact.useStoreMap)(model.$currentChatData, ({
|
|
48
43
|
messages
|
|
49
44
|
}) => messages);
|
|
50
|
-
const
|
|
51
|
-
const MAX_HEIGHT = dimensions.height - TOOLBAR_HEIGHT - BOTTOM_OFFSET;
|
|
52
|
-
const shouldWrapMessage = MessageWrapper && isInputDisabled && messages.length === 1;
|
|
45
|
+
const lastBotMessageId = messages.findLast(m => !m.isOwnMessage)?.id;
|
|
46
|
+
const MAX_HEIGHT = dimensions.height - _constants.TOOLBAR_HEIGHT - _constants.BOTTOM_OFFSET;
|
|
47
|
+
const shouldWrapMessage = !!MessageWrapper && !!isInputDisabled && messages.length === 1;
|
|
48
|
+
const reversedMessages = (0, _react.useMemo)(() => [...messages].reverse(), [messages]);
|
|
49
|
+
const showBotIcon = !isScrolledUp && !isInputDisabled;
|
|
50
|
+
const fadeMask = (() => {
|
|
51
|
+
if (!isScrollable) return undefined;
|
|
52
|
+
if (isAtTop) return _constants.FADE_MASKS.bottom;
|
|
53
|
+
if (isScrolledUp) return _constants.FADE_MASKS.both;
|
|
54
|
+
return _constants.FADE_MASKS.top;
|
|
55
|
+
})();
|
|
56
|
+
maxHeightRef.current = MAX_HEIGHT;
|
|
57
|
+
const renderMessage = (0, _react.useCallback)(({
|
|
58
|
+
item: message
|
|
59
|
+
}) => {
|
|
60
|
+
const withInlineIcon = !message.isOwnMessage && isScrolledUp && message.id === lastBotMessageId;
|
|
61
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_MessageItem.MessageItem, {
|
|
62
|
+
message: message,
|
|
63
|
+
withInlineIcon: withInlineIcon,
|
|
64
|
+
colorScheme: colorScheme,
|
|
65
|
+
isInputDisabled: isInputDisabled,
|
|
66
|
+
isTextToSpeechEnabled: isTextToSpeechEnabled,
|
|
67
|
+
shouldWrapMessage: shouldWrapMessage,
|
|
68
|
+
MessageWrapper: MessageWrapper,
|
|
69
|
+
TTSHighlightRenderer: TTSHighlightRenderer
|
|
70
|
+
});
|
|
71
|
+
}, [isScrolledUp, lastBotMessageId, colorScheme, isInputDisabled, isTextToSpeechEnabled, shouldWrapMessage]);
|
|
72
|
+
const handleScroll = (0, _react.useCallback)(e => {
|
|
73
|
+
const {
|
|
74
|
+
contentOffset,
|
|
75
|
+
contentSize,
|
|
76
|
+
layoutMeasurement
|
|
77
|
+
} = e.nativeEvent;
|
|
78
|
+
setIsScrolledUp(contentOffset.y > _constants.SCROLL_BOTTOM_THRESHOLD);
|
|
79
|
+
setIsAtTop(contentOffset.y >= contentSize.height - layoutMeasurement.height - _constants.SCROLL_BOTTOM_THRESHOLD);
|
|
80
|
+
}, []);
|
|
81
|
+
const handleContentSizeChange = (0, _react.useCallback)((_, contentHeight) => {
|
|
82
|
+
setIsScrollable(contentHeight >= maxHeightRef.current);
|
|
83
|
+
}, []);
|
|
84
|
+
(0, _react.useEffect)(() => {
|
|
85
|
+
if (!isOpen) {
|
|
86
|
+
setIsScrollable(false);
|
|
87
|
+
setIsScrolledUp(false);
|
|
88
|
+
setIsAtTop(false);
|
|
89
|
+
}
|
|
90
|
+
}, [isOpen]);
|
|
91
|
+
if (!isOpen) return null;
|
|
53
92
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
54
93
|
style: [styles.container, {
|
|
55
94
|
maxHeight: MAX_HEIGHT
|
|
56
95
|
}],
|
|
57
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.
|
|
96
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.FlatList, {
|
|
58
97
|
ref: ref,
|
|
98
|
+
inverted: true,
|
|
59
99
|
bounces: false,
|
|
100
|
+
style: [styles.flatList, fadeMask],
|
|
101
|
+
data: reversedMessages,
|
|
102
|
+
keyExtractor: keyExtractor,
|
|
103
|
+
renderItem: renderMessage,
|
|
60
104
|
contentContainerStyle: styles.list,
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_ConditionalWrapper.ConditionalWrapper, {
|
|
77
|
-
withWrapper: shouldWrapMessage,
|
|
78
|
-
Wrapper: MessageWrapper,
|
|
79
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChatMessage.ChatMessage, {
|
|
80
|
-
isTranslated: isTranslated,
|
|
81
|
-
withIcon: !message.isOwnMessage && message.id === lastMessageId,
|
|
82
|
-
message: message,
|
|
83
|
-
variant: message.isOwnMessage ? _modelTypes.MessageVariant.SENT : _modelTypes.MessageVariant.RECEIVED,
|
|
84
|
-
colorScheme: colorScheme,
|
|
85
|
-
withErrorSpotting: errorSpottingEnabled && !message.isOwnMessage,
|
|
86
|
-
highlightedWordIndex: messageHighlightIndex,
|
|
87
|
-
TTSHighlightRenderer: TTSHighlightRenderer,
|
|
88
|
-
t2sState: {
|
|
89
|
-
isEnabled: isTextToSpeechEnabled && !message.isOwnMessage,
|
|
90
|
-
isActive: isPlayingMessage,
|
|
91
|
-
isLoading: isTextToSpeechPending,
|
|
92
|
-
status: audioStatus,
|
|
93
|
-
disabled: isTextToSpeechPending
|
|
94
|
-
}
|
|
95
|
-
})
|
|
96
|
-
})
|
|
97
|
-
}, key);
|
|
98
|
-
}), isHelpRequestPending && /*#__PURE__*/(0, _jsxRuntime.jsx)(_MessageLoader.MessageLoader, {})]
|
|
99
|
-
})
|
|
100
|
-
}), isOpen && /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
101
|
-
style: styles.inputRow,
|
|
102
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_CloseButton.CloseButton, {
|
|
103
|
-
onPress: onPressClose
|
|
104
|
-
}), !isInputDisabled && /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChatInput.ChatInput, {
|
|
105
|
-
isHintFeedback: isHintFeedback,
|
|
106
|
-
colorScheme: colorScheme,
|
|
107
|
-
hasMessages: messages.length > 1
|
|
108
|
-
})]
|
|
105
|
+
onScroll: handleScroll,
|
|
106
|
+
scrollEventThrottle: 16,
|
|
107
|
+
onContentSizeChange: handleContentSizeChange,
|
|
108
|
+
ListHeaderComponent: /*#__PURE__*/(0, _jsxRuntime.jsx)(_MessageLoader.MessageLoader, {
|
|
109
|
+
isLoading: isHelpRequestPending
|
|
110
|
+
}),
|
|
111
|
+
ItemSeparatorComponent: Separator
|
|
112
|
+
}), showBotIcon && /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChatIcon.ChatIcon, {
|
|
113
|
+
isLoading: isHelpRequestPending
|
|
114
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChatInputBlock.ChatInputBlock, {
|
|
115
|
+
isHintFeedback: isHintFeedback,
|
|
116
|
+
isInputDisabled: isInputDisabled,
|
|
117
|
+
colorScheme: colorScheme,
|
|
118
|
+
hasMessages: messages.length > 1,
|
|
119
|
+
onPressClose: onPressClose
|
|
109
120
|
})]
|
|
110
121
|
});
|
|
111
122
|
};
|
|
@@ -114,25 +125,19 @@ const styles = _reactNative.StyleSheet.create({
|
|
|
114
125
|
container: {
|
|
115
126
|
flex: 1,
|
|
116
127
|
alignItems: 'flex-end',
|
|
117
|
-
width:
|
|
128
|
+
width: 374,
|
|
118
129
|
height: '100%',
|
|
119
|
-
paddingRight: _reactNativeUi.SPACING['
|
|
130
|
+
paddingRight: _reactNativeUi.SPACING['100']
|
|
131
|
+
},
|
|
132
|
+
flatList: {
|
|
133
|
+
alignSelf: 'stretch',
|
|
134
|
+
paddingTop: _reactNativeUi.SPACING['300']
|
|
120
135
|
},
|
|
121
136
|
list: {
|
|
122
|
-
alignItems: 'flex-end',
|
|
123
137
|
paddingVertical: 2
|
|
124
138
|
},
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
},
|
|
128
|
-
inputRow: {
|
|
129
|
-
flexDirection: 'row',
|
|
130
|
-
alignItems: 'center',
|
|
131
|
-
gap: _reactNativeUi.SPACING['200']
|
|
132
|
-
},
|
|
133
|
-
gap: {
|
|
134
|
-
flex: 1,
|
|
135
|
-
gap: _reactNativeUi.SPACING['200']
|
|
139
|
+
separator: {
|
|
140
|
+
height: _reactNativeUi.SPACING['200']
|
|
136
141
|
}
|
|
137
142
|
});
|
|
138
143
|
//# sourceMappingURL=Chat.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_react","_interopRequireWildcard","require","_reactNative","_effectorReact","_reactNativeUi","
|
|
1
|
+
{"version":3,"names":["_react","_interopRequireWildcard","require","_reactNative","_effectorReact","_reactNativeUi","_MessageLoader","_styleTypes","_ChatIcon","_ChatInputBlock","_MessageItem","_constants","_jsxRuntime","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","Separator","jsx","View","style","styles","separator","keyExtractor","item","index","id","Chat","model","isHintFeedback","isTextToSpeechEnabled","isInputDisabled","colorScheme","ColorScheme","Blue","MessageWrapper","TTSHighlightRenderer","onPressClose","ref","useRef","isScrollable","setIsScrollable","useState","isScrolledUp","setIsScrolledUp","isAtTop","setIsAtTop","maxHeightRef","dimensions","useWindowDimensions","isOpen","useUnit","$isOpen","isHelpRequestPending","sendHelpRequestFx","pending","messages","useStoreMap","$currentChatData","lastBotMessageId","findLast","m","isOwnMessage","MAX_HEIGHT","height","TOOLBAR_HEIGHT","BOTTOM_OFFSET","shouldWrapMessage","length","reversedMessages","useMemo","reverse","showBotIcon","fadeMask","undefined","FADE_MASKS","bottom","both","top","current","renderMessage","useCallback","message","withInlineIcon","MessageItem","handleScroll","contentOffset","contentSize","layoutMeasurement","nativeEvent","y","SCROLL_BOTTOM_THRESHOLD","handleContentSizeChange","_","contentHeight","useEffect","jsxs","container","maxHeight","children","FlatList","inverted","bounces","flatList","data","renderItem","contentContainerStyle","list","onScroll","scrollEventThrottle","onContentSizeChange","ListHeaderComponent","MessageLoader","isLoading","ItemSeparatorComponent","ChatIcon","ChatInputBlock","hasMessages","exports","StyleSheet","create","flex","alignItems","width","paddingRight","SPACING","alignSelf","paddingTop","paddingVertical"],"sourceRoot":"../../../../../../src","sources":["features/chatbot/components/Chat/Chat.tsx"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AASA,IAAAC,YAAA,GAAAD,OAAA;AASA,IAAAE,cAAA,GAAAF,OAAA;AACA,IAAAG,cAAA,GAAAH,OAAA;AAIA,IAAAI,cAAA,GAAAJ,OAAA;AACA,IAAAK,WAAA,GAAAL,OAAA;AAEA,IAAAM,SAAA,GAAAN,OAAA;AACA,IAAAO,eAAA,GAAAP,OAAA;AACA,IAAAQ,YAAA,GAAAR,OAAA;AACA,IAAAS,UAAA,GAAAT,OAAA;AAAgG,IAAAU,WAAA,GAAAV,OAAA;AAAA,SAAAW,yBAAAC,CAAA,6BAAAC,OAAA,mBAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,CAAAC,CAAA,WAAAA,CAAA,GAAAG,CAAA,GAAAD,CAAA,KAAAF,CAAA;AAAA,SAAAb,wBAAAa,CAAA,EAAAE,CAAA,SAAAA,CAAA,IAAAF,CAAA,IAAAA,CAAA,CAAAI,UAAA,SAAAJ,CAAA,eAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,WAAAK,OAAA,EAAAL,CAAA,QAAAG,CAAA,GAAAJ,wBAAA,CAAAG,CAAA,OAAAC,CAAA,IAAAA,CAAA,CAAAG,GAAA,CAAAN,CAAA,UAAAG,CAAA,CAAAI,GAAA,CAAAP,CAAA,OAAAQ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WAAY;MACzBqF,WAAW,EAAE7D,QAAQ,CAACY,MAAM,GAAG,CAAE;MACjC/B,YAAY,EAAEA;IAAa,CAC5B,CAAC;EAAA,CACE,CAAC;AAEX,CAAC;AAAAiF,OAAA,CAAA3F,IAAA,GAAAA,IAAA;AAED,MAAMN,MAAM,GAAGkG,uBAAU,CAACC,MAAM,CAAC;EAC/BvB,SAAS,EAAE;IACTwB,IAAI,EAAE,CAAC;IACPC,UAAU,EAAE,UAAU;IACtBC,KAAK,EAAE,GAAG;IACV3D,MAAM,EAAE,MAAM;IACd4D,YAAY,EAAEC,sBAAO,CAAC,KAAK;EAC7B,CAAC;EACDtB,QAAQ,EAAE;IACRuB,SAAS,EAAE,SAAS;IACpBC,UAAU,EAAEF,sBAAO,CAAC,KAAK;EAC3B,CAAC;EACDlB,IAAI,EAAE;IACJqB,eAAe,EAAE;EACnB,CAAC;EACD1G,SAAS,EAAE;IACT0C,MAAM,EAAE6D,sBAAO,CAAC,KAAK;EACvB;AACF,CAAC,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.ChatIcon = void 0;
|
|
7
|
+
var _react = _interopRequireDefault(require("react"));
|
|
8
|
+
var _reactNative = require("react-native");
|
|
9
|
+
var _ChatbotIcon = require("../../../../shared/icons/ChatbotIcon.js");
|
|
10
|
+
var _LavaIconInGlasses = require("../../../../shared/icons/LavaIconInGlasses.js");
|
|
11
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
12
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
13
|
+
const ChatIcon = ({
|
|
14
|
+
isLoading
|
|
15
|
+
}) => /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
16
|
+
style: styles.container,
|
|
17
|
+
children: isLoading ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_LavaIconInGlasses.LavaIconInGlasses, {
|
|
18
|
+
width: 53,
|
|
19
|
+
height: 73
|
|
20
|
+
}) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChatbotIcon.ChatbotIcon, {
|
|
21
|
+
width: 53,
|
|
22
|
+
height: 73,
|
|
23
|
+
color: 'blue'
|
|
24
|
+
})
|
|
25
|
+
});
|
|
26
|
+
exports.ChatIcon = ChatIcon;
|
|
27
|
+
const styles = _reactNative.StyleSheet.create({
|
|
28
|
+
container: {
|
|
29
|
+
position: 'absolute',
|
|
30
|
+
bottom: 65,
|
|
31
|
+
left: 4
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
//# sourceMappingURL=ChatIcon.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_react","_interopRequireDefault","require","_reactNative","_ChatbotIcon","_LavaIconInGlasses","_jsxRuntime","e","__esModule","default","ChatIcon","isLoading","jsx","View","style","styles","container","children","LavaIconInGlasses","width","height","ChatbotIcon","color","exports","StyleSheet","create","position","bottom","left"],"sourceRoot":"../../../../../../src","sources":["features/chatbot/components/Chat/ChatIcon.tsx"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AAEA,IAAAE,YAAA,GAAAF,OAAA;AACA,IAAAG,kBAAA,GAAAH,OAAA;AAA8E,IAAAI,WAAA,GAAAJ,OAAA;AAAA,SAAAD,uBAAAM,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAMvE,MAAMG,QAAQ,GAAGA,CAAC;EAAEC;AAAyB,CAAC,kBACnD,IAAAL,WAAA,CAAAM,GAAA,EAACT,YAAA,CAAAU,IAAI;EAACC,KAAK,EAAEC,MAAM,CAACC,SAAU;EAAAC,QAAA,EAC3BN,SAAS,gBACR,IAAAL,WAAA,CAAAM,GAAA,EAACP,kBAAA,CAAAa,iBAAiB;IAACC,KAAK,EAAE,EAAG;IAACC,MAAM,EAAE;EAAG,CAAE,CAAC,gBAE5C,IAAAd,WAAA,CAAAM,GAAA,EAACR,YAAA,CAAAiB,WAAW;IAACF,KAAK,EAAE,EAAG;IAACC,MAAM,EAAE,EAAG;IAACE,KAAK,EAAE;EAAO,CAAE;AACrD,CACG,CACP;AAAAC,OAAA,CAAAb,QAAA,GAAAA,QAAA;AAED,MAAMK,MAAM,GAAGS,uBAAU,CAACC,MAAM,CAAC;EAC/BT,SAAS,EAAE;IACTU,QAAQ,EAAE,UAAU;IACpBC,MAAM,EAAE,EAAE;IACVC,IAAI,EAAE;EACR;AACF,CAAC,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.ChatInputBlock = void 0;
|
|
7
|
+
var _react = _interopRequireDefault(require("react"));
|
|
8
|
+
var _reactNative = require("react-native");
|
|
9
|
+
var _reactNativeUi = require("@magmamath/react-native-ui");
|
|
10
|
+
var _ChatInput = require("../ChatInput/ChatInput.js");
|
|
11
|
+
var _CloseButton = require("./CloseButton.js");
|
|
12
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
13
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
14
|
+
const ChatInputBlock = ({
|
|
15
|
+
isHintFeedback,
|
|
16
|
+
isInputDisabled,
|
|
17
|
+
colorScheme,
|
|
18
|
+
hasMessages,
|
|
19
|
+
onPressClose
|
|
20
|
+
}) => /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
21
|
+
style: styles.container,
|
|
22
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_CloseButton.CloseButton, {
|
|
23
|
+
onPress: onPressClose
|
|
24
|
+
}), !isInputDisabled && /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChatInput.ChatInput, {
|
|
25
|
+
isHintFeedback: isHintFeedback,
|
|
26
|
+
colorScheme: colorScheme,
|
|
27
|
+
hasMessages: hasMessages
|
|
28
|
+
})]
|
|
29
|
+
});
|
|
30
|
+
exports.ChatInputBlock = ChatInputBlock;
|
|
31
|
+
const styles = _reactNative.StyleSheet.create({
|
|
32
|
+
container: {
|
|
33
|
+
flexDirection: 'row',
|
|
34
|
+
alignItems: 'center',
|
|
35
|
+
gap: _reactNativeUi.SPACING['200'],
|
|
36
|
+
minHeight: 52
|
|
37
|
+
}
|
|
38
|
+
});
|
|
39
|
+
//# sourceMappingURL=ChatInputBlock.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_react","_interopRequireDefault","require","_reactNative","_reactNativeUi","_ChatInput","_CloseButton","_jsxRuntime","e","__esModule","default","ChatInputBlock","isHintFeedback","isInputDisabled","colorScheme","hasMessages","onPressClose","jsxs","View","style","styles","container","children","jsx","CloseButton","onPress","ChatInput","exports","StyleSheet","create","flexDirection","alignItems","gap","SPACING","minHeight"],"sourceRoot":"../../../../../../src","sources":["features/chatbot/components/Chat/ChatInputBlock.tsx"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AACA,IAAAE,cAAA,GAAAF,OAAA;AAEA,IAAAG,UAAA,GAAAH,OAAA;AACA,IAAAI,YAAA,GAAAJ,OAAA;AAA2C,IAAAK,WAAA,GAAAL,OAAA;AAAA,SAAAD,uBAAAO,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAWpC,MAAMG,cAAc,GAAGA,CAAC;EAC7BC,cAAc;EACdC,eAAe;EACfC,WAAW;EACXC,WAAW;EACXC;AACmB,CAAC,kBACpB,IAAAT,WAAA,CAAAU,IAAA,EAACd,YAAA,CAAAe,IAAI;EAACC,KAAK,EAAEC,MAAM,CAACC,SAAU;EAAAC,QAAA,gBAC5B,IAAAf,WAAA,CAAAgB,GAAA,EAACjB,YAAA,CAAAkB,WAAW;IAACC,OAAO,EAAET;EAAa,CAAE,CAAC,EACrC,CAACH,eAAe,iBACf,IAAAN,WAAA,CAAAgB,GAAA,EAAClB,UAAA,CAAAqB,SAAS;IACRd,cAAc,EAAEA,cAAe;IAC/BE,WAAW,EAAEA,WAAY;IACzBC,WAAW,EAAEA;EAAY,CAC1B,CACF;AAAA,CACG,CACP;AAAAY,OAAA,CAAAhB,cAAA,GAAAA,cAAA;AAED,MAAMS,MAAM,GAAGQ,uBAAU,CAACC,MAAM,CAAC;EAC/BR,SAAS,EAAE;IACTS,aAAa,EAAE,KAAK;IACpBC,UAAU,EAAE,QAAQ;IACpBC,GAAG,EAAEC,sBAAO,CAAC,KAAK,CAAC;IACnBC,SAAS,EAAE;EACb;AACF,CAAC,CAAC","ignoreList":[]}
|
|
@@ -10,26 +10,6 @@ var _reactNativeUi = require("@magmamath/react-native-ui");
|
|
|
10
10
|
var _CloseIcon = require("../../../../shared/icons/CloseIcon.js");
|
|
11
11
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
12
12
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
13
|
-
const COLOR_SCHEME = {
|
|
14
|
-
[_reactNativeUi.ButtonStates.DEFAULT]: {
|
|
15
|
-
backgroundColor: _reactNativeUi.COLORS.NEUTRAL_1,
|
|
16
|
-
borderColor: _reactNativeUi.COLORS.NEUTRAL_5,
|
|
17
|
-
raiseColor: _reactNativeUi.COLORS.NEUTRAL_5,
|
|
18
|
-
color: _reactNativeUi.COLORS.NEUTRAL_10
|
|
19
|
-
},
|
|
20
|
-
[_reactNativeUi.ButtonStates.PRESSED]: {
|
|
21
|
-
backgroundColor: _reactNativeUi.COLORS.NEUTRAL_4,
|
|
22
|
-
borderColor: _reactNativeUi.COLORS.NEUTRAL_5,
|
|
23
|
-
raiseColor: _reactNativeUi.COLORS.NEUTRAL_5,
|
|
24
|
-
color: _reactNativeUi.COLORS.NEUTRAL_1
|
|
25
|
-
},
|
|
26
|
-
[_reactNativeUi.ButtonStates.HOVER]: {
|
|
27
|
-
backgroundColor: _reactNativeUi.COLORS.NEUTRAL_3,
|
|
28
|
-
borderColor: _reactNativeUi.COLORS.NEUTRAL_5,
|
|
29
|
-
raiseColor: _reactNativeUi.COLORS.NEUTRAL_5,
|
|
30
|
-
color: _reactNativeUi.COLORS.NEUTRAL_10
|
|
31
|
-
}
|
|
32
|
-
};
|
|
33
13
|
const CloseButton = ({
|
|
34
14
|
onPress
|
|
35
15
|
}) => /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNativeUi.Button, {
|
|
@@ -40,9 +20,7 @@ const CloseButton = ({
|
|
|
40
20
|
variant: _reactNativeUi.ButtonVariant.PRIMARY,
|
|
41
21
|
size: _reactNativeUi.ButtonSize.MEDIUM,
|
|
42
22
|
colorScheme: _reactNativeUi.ButtonColor.WHITE,
|
|
43
|
-
raiseLevel: 5
|
|
44
|
-
// customColorScheme={COLOR_SCHEME}
|
|
45
|
-
,
|
|
23
|
+
raiseLevel: 5,
|
|
46
24
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_CloseIcon.CloseIcon, {
|
|
47
25
|
width: 18,
|
|
48
26
|
height: 18
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_react","_interopRequireDefault","require","_reactNative","_reactNativeUi","_CloseIcon","_jsxRuntime","e","__esModule","default","
|
|
1
|
+
{"version":3,"names":["_react","_interopRequireDefault","require","_reactNative","_reactNativeUi","_CloseIcon","_jsxRuntime","e","__esModule","default","CloseButton","onPress","jsx","Button","style","button","styles","variant","ButtonVariant","PRIMARY","size","ButtonSize","MEDIUM","colorScheme","ButtonColor","WHITE","raiseLevel","children","CloseIcon","width","height","exports","StyleSheet","create","borderRadius","paddingHorizontal","borderColor","COLORS","NEUTRAL_5"],"sourceRoot":"../../../../../../src","sources":["features/chatbot/components/Chat/CloseButton.tsx"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AACA,IAAAE,cAAA,GAAAF,OAAA;AACA,IAAAG,UAAA,GAAAH,OAAA;AAA8D,IAAAI,WAAA,GAAAJ,OAAA;AAAA,SAAAD,uBAAAM,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAMvD,MAAMG,WAAW,GAAGA,CAAC;EAAEC;AAA0B,CAAC,kBACvD,IAAAL,WAAA,CAAAM,GAAA,EAACR,cAAA,CAAAS,MAAM;EACLF,OAAO,EAAEA,OAAQ;EACjBG,KAAK,EAAE;IAAEC,MAAM,EAAEC,MAAM,CAACD;EAAO,CAAE;EACjCE,OAAO,EAAEC,4BAAa,CAACC,OAAQ;EAC/BC,IAAI,EAAEC,yBAAU,CAACC,MAAO;EACxBC,WAAW,EAAEC,0BAAW,CAACC,KAAM;EAC/BC,UAAU,EAAE,CAAE;EAAAC,QAAA,eAEd,IAAArB,WAAA,CAAAM,GAAA,EAACP,UAAA,CAAAuB,SAAS;IAACC,KAAK,EAAE,EAAG;IAACC,MAAM,EAAE;EAAG,CAAE;AAAC,CAC9B,CACT;AAAAC,OAAA,CAAArB,WAAA,GAAAA,WAAA;AAED,MAAMM,MAAM,GAAGgB,uBAAU,CAACC,MAAM,CAAC;EAC/BlB,MAAM,EAAE;IACNc,KAAK,EAAE,EAAE;IACTC,MAAM,EAAE,EAAE;IACVI,YAAY,EAAE,EAAE;IAChBC,iBAAiB,EAAE,CAAC;IACpBC,WAAW,EAAEC,qBAAM,CAACC;EACtB;AACF,CAAC,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.GradientFade = void 0;
|
|
7
|
+
var _react = _interopRequireDefault(require("react"));
|
|
8
|
+
var _reactNative = require("react-native");
|
|
9
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
10
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
11
|
+
const WebGradient = ({
|
|
12
|
+
colors,
|
|
13
|
+
locations,
|
|
14
|
+
style
|
|
15
|
+
}) => {
|
|
16
|
+
const stops = colors.map((color, i) => {
|
|
17
|
+
const position = locations ? `${locations[i] * 100}%` : undefined;
|
|
18
|
+
return position ? `${color} ${position}` : color;
|
|
19
|
+
}).join(', ');
|
|
20
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
21
|
+
style: [_reactNative.StyleSheet.absoluteFill, style, {
|
|
22
|
+
backgroundImage: `linear-gradient(to bottom, ${stops})`
|
|
23
|
+
}]
|
|
24
|
+
});
|
|
25
|
+
};
|
|
26
|
+
const NativeGradient = ({
|
|
27
|
+
colors,
|
|
28
|
+
locations,
|
|
29
|
+
style
|
|
30
|
+
}) => {
|
|
31
|
+
const {
|
|
32
|
+
LinearGradient
|
|
33
|
+
} = require('expo-linear-gradient');
|
|
34
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(LinearGradient, {
|
|
35
|
+
colors: colors,
|
|
36
|
+
locations: locations,
|
|
37
|
+
style: [_reactNative.StyleSheet.absoluteFill, style]
|
|
38
|
+
});
|
|
39
|
+
};
|
|
40
|
+
const GradientFade = exports.GradientFade = _reactNative.Platform.select({
|
|
41
|
+
web: WebGradient,
|
|
42
|
+
default: NativeGradient
|
|
43
|
+
});
|
|
44
|
+
//# sourceMappingURL=GradientFade.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_react","_interopRequireDefault","require","_reactNative","_jsxRuntime","e","__esModule","default","WebGradient","colors","locations","style","stops","map","color","i","position","undefined","join","jsx","View","StyleSheet","absoluteFill","backgroundImage","NativeGradient","LinearGradient","GradientFade","exports","Platform","select","web"],"sourceRoot":"../../../../../../src","sources":["features/chatbot/components/Chat/GradientFade.tsx"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AAAoE,IAAAE,WAAA,GAAAF,OAAA;AAAA,SAAAD,uBAAAI,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAQpE,MAAMG,WAAW,GAAGA,CAAC;EAAEC,MAAM;EAAEC,SAAS;EAAEC;AAAyB,CAAC,KAAK;EACvE,MAAMC,KAAK,GAAGH,MAAM,CACjBI,GAAG,CAAC,CAACC,KAAK,EAAEC,CAAC,KAAK;IACjB,MAAMC,QAAQ,GAAGN,SAAS,GAAG,GAAGA,SAAS,CAACK,CAAC,CAAC,GAAG,GAAG,GAAG,GAAGE,SAAS;IACjE,OAAOD,QAAQ,GAAG,GAAGF,KAAK,IAAIE,QAAQ,EAAE,GAAGF,KAAK;EAClD,CAAC,CAAC,CACDI,IAAI,CAAC,IAAI,CAAC;EAEb,oBACE,IAAAd,WAAA,CAAAe,GAAA,EAAChB,YAAA,CAAAiB,IAAI;IACHT,KAAK,EAAE,CACLU,uBAAU,CAACC,YAAY,EACvBX,KAAK,EACL;MAAEY,eAAe,EAAE,8BAA8BX,KAAK;IAAI,CAAC;EAC3D,CACH,CAAC;AAEN,CAAC;AAED,MAAMY,cAAc,GAAGA,CAAC;EAAEf,MAAM;EAAEC,SAAS;EAAEC;AAAyB,CAAC,KAAK;EAC1E,MAAM;IAAEc;EAAe,CAAC,GAAGvB,OAAO,CAAC,sBAAsB,CAAC;EAC1D,oBACE,IAAAE,WAAA,CAAAe,GAAA,EAACM,cAAc;IACbhB,MAAM,EAAEA,MAAO;IACfC,SAAS,EAAEA,SAAU;IACrBC,KAAK,EAAE,CAACU,uBAAU,CAACC,YAAY,EAAEX,KAAK;EAAE,CACzC,CAAC;AAEN,CAAC;AAEM,MAAMe,YAAY,GAAAC,OAAA,CAAAD,YAAA,GAAGE,qBAAQ,CAACC,MAAM,CAAC;EAC1CC,GAAG,EAAEtB,WAAW;EAChBD,OAAO,EAAEiB;AACX,CAAC,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.MessageItem = void 0;
|
|
7
|
+
var _react = _interopRequireDefault(require("react"));
|
|
8
|
+
var _reactNative = require("react-native");
|
|
9
|
+
var _effectorReact = require("effector-react");
|
|
10
|
+
var _ChatbotIcon = require("../../../../shared/icons/ChatbotIcon.js");
|
|
11
|
+
var _AnimatedMessage = require("../ChatMessage/AnimatedMessage.js");
|
|
12
|
+
var _ChatMessage = require("../ChatMessage/ChatMessage.js");
|
|
13
|
+
var _modelTypes = require("../../types/model.types.js");
|
|
14
|
+
var _ConditionalWrapper = require("../../../../lib/components/ConditionalWrapper.js");
|
|
15
|
+
var _ChatBotModelContext = require("../../context/ChatBotModelContext.js");
|
|
16
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
17
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
18
|
+
const MessageItem = ({
|
|
19
|
+
message,
|
|
20
|
+
withInlineIcon,
|
|
21
|
+
colorScheme,
|
|
22
|
+
isInputDisabled,
|
|
23
|
+
isTextToSpeechEnabled,
|
|
24
|
+
shouldWrapMessage,
|
|
25
|
+
MessageWrapper,
|
|
26
|
+
TTSHighlightRenderer
|
|
27
|
+
}) => {
|
|
28
|
+
const model = (0, _ChatBotModelContext.useChatModel)();
|
|
29
|
+
const isTranslated = (0, _effectorReact.useUnit)(model.translation.$isTranslated);
|
|
30
|
+
const errorSpottingEnabled = (0, _effectorReact.useUnit)(model.errorSpotting.$isEnabled);
|
|
31
|
+
const audioStatus = (0, _effectorReact.useUnit)(model.t2s.$status);
|
|
32
|
+
const currentPlayingId = (0, _effectorReact.useUnit)(model.t2s.$currentPlayingId);
|
|
33
|
+
const highlightedWordIndex = (0, _effectorReact.useUnit)(model.t2s.wordHighlight.$highlightedWordIndex);
|
|
34
|
+
const isTextToSpeechPending = (0, _effectorReact.useUnit)(model.api.textToSpeechTextFx.pending);
|
|
35
|
+
const isPlayingMessage = message.id === currentPlayingId;
|
|
36
|
+
const messageHighlightIndex = model.t2s.isWordHighlightEnabled && isPlayingMessage ? highlightedWordIndex : -1;
|
|
37
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
38
|
+
style: [styles.container, withInlineIcon && styles.withInlineIcon],
|
|
39
|
+
children: [withInlineIcon && /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
40
|
+
style: styles.inlineIcon,
|
|
41
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChatbotIcon.ChatbotIcon, {
|
|
42
|
+
width: 53,
|
|
43
|
+
height: 73
|
|
44
|
+
})
|
|
45
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_AnimatedMessage.AnimatedMessage, {
|
|
46
|
+
animate: !isInputDisabled,
|
|
47
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_ConditionalWrapper.ConditionalWrapper, {
|
|
48
|
+
withWrapper: shouldWrapMessage,
|
|
49
|
+
Wrapper: MessageWrapper,
|
|
50
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChatMessage.ChatMessage, {
|
|
51
|
+
withIcon: isInputDisabled,
|
|
52
|
+
isTranslated: isTranslated,
|
|
53
|
+
message: message,
|
|
54
|
+
variant: message.isOwnMessage ? _modelTypes.MessageVariant.SENT : _modelTypes.MessageVariant.RECEIVED,
|
|
55
|
+
colorScheme: colorScheme,
|
|
56
|
+
withErrorSpotting: errorSpottingEnabled && !message.isOwnMessage,
|
|
57
|
+
highlightedWordIndex: messageHighlightIndex,
|
|
58
|
+
TTSHighlightRenderer: TTSHighlightRenderer,
|
|
59
|
+
t2sState: {
|
|
60
|
+
isEnabled: isTextToSpeechEnabled && !message.isOwnMessage,
|
|
61
|
+
isActive: isPlayingMessage,
|
|
62
|
+
isLoading: isTextToSpeechPending,
|
|
63
|
+
status: audioStatus,
|
|
64
|
+
disabled: isTextToSpeechPending
|
|
65
|
+
}
|
|
66
|
+
})
|
|
67
|
+
})
|
|
68
|
+
})]
|
|
69
|
+
});
|
|
70
|
+
};
|
|
71
|
+
exports.MessageItem = MessageItem;
|
|
72
|
+
const styles = _reactNative.StyleSheet.create({
|
|
73
|
+
container: {
|
|
74
|
+
alignSelf: 'flex-end'
|
|
75
|
+
},
|
|
76
|
+
withInlineIcon: {
|
|
77
|
+
flexDirection: 'row',
|
|
78
|
+
alignItems: 'flex-end'
|
|
79
|
+
},
|
|
80
|
+
inlineIcon: {
|
|
81
|
+
marginRight: 8
|
|
82
|
+
}
|
|
83
|
+
});
|
|
84
|
+
//# sourceMappingURL=MessageItem.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_react","_interopRequireDefault","require","_reactNative","_effectorReact","_ChatbotIcon","_AnimatedMessage","_ChatMessage","_modelTypes","_ConditionalWrapper","_ChatBotModelContext","_jsxRuntime","e","__esModule","default","MessageItem","message","withInlineIcon","colorScheme","isInputDisabled","isTextToSpeechEnabled","shouldWrapMessage","MessageWrapper","TTSHighlightRenderer","model","useChatModel","isTranslated","useUnit","translation","$isTranslated","errorSpottingEnabled","errorSpotting","$isEnabled","audioStatus","t2s","$status","currentPlayingId","$currentPlayingId","highlightedWordIndex","wordHighlight","$highlightedWordIndex","isTextToSpeechPending","api","textToSpeechTextFx","pending","isPlayingMessage","id","messageHighlightIndex","isWordHighlightEnabled","jsxs","View","style","styles","container","children","jsx","inlineIcon","ChatbotIcon","width","height","AnimatedMessage","animate","ConditionalWrapper","withWrapper","Wrapper","ChatMessage","withIcon","variant","isOwnMessage","MessageVariant","SENT","RECEIVED","withErrorSpotting","t2sState","isEnabled","isActive","isLoading","status","disabled","exports","StyleSheet","create","alignSelf","flexDirection","alignItems","marginRight"],"sourceRoot":"../../../../../../src","sources":["features/chatbot/components/Chat/MessageItem.tsx"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AACA,IAAAE,cAAA,GAAAF,OAAA;AAGA,IAAAG,YAAA,GAAAH,OAAA;AACA,IAAAI,gBAAA,GAAAJ,OAAA;AACA,IAAAK,YAAA,GAAAL,OAAA;AACA,IAAAM,WAAA,GAAAN,OAAA;AAEA,IAAAO,mBAAA,GAAAP,OAAA;AAEA,IAAAQ,oBAAA,GAAAR,OAAA;AAAgE,IAAAS,WAAA,GAAAT,OAAA;AAAA,SAAAD,uBAAAW,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAazD,MAAMG,WAAW,GAAGA,CAAC;EAC1BC,OAAO;EACPC,cAAc;EACdC,WAAW;EACXC,eAAe;EACfC,qBAAqB;EACrBC,iBAAiB;EACjBC,cAAc;EACdC;AACgB,CAAC,KAAK;EACtB,MAAMC,KAAK,GAAG,IAAAC,iCAAY,EAAC,CAAC;EAE5B,MAAMC,YAAY,GAAG,IAAAC,sBAAO,EAACH,KAAK,CAACI,WAAW,CAACC,aAAa,CAAC;EAC7D,MAAMC,oBAAoB,GAAG,IAAAH,sBAAO,EAACH,KAAK,CAACO,aAAa,CAACC,UAAU,CAAC;EACpE,MAAMC,WAAW,GAAG,IAAAN,sBAAO,EAACH,KAAK,CAACU,GAAG,CAACC,OAAO,CAAC;EAC9C,MAAMC,gBAAgB,GAAG,IAAAT,sBAAO,EAACH,KAAK,CAACU,GAAG,CAACG,iBAAiB,CAAC;EAC7D,MAAMC,oBA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