react-native-srschat 0.1.14 → 0.1.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +54 -14
- package/lib/commonjs/components/email.js +243 -0
- package/lib/commonjs/components/email.js.map +1 -0
- package/lib/commonjs/components/feedback.js +115 -0
- package/lib/commonjs/components/feedback.js.map +1 -0
- package/lib/commonjs/components/header.js +33 -17
- package/lib/commonjs/components/header.js.map +1 -1
- package/lib/commonjs/components/input.js +106 -0
- package/lib/commonjs/components/input.js.map +1 -0
- package/lib/commonjs/components/productCard.js +234 -0
- package/lib/commonjs/components/productCard.js.map +1 -0
- package/lib/commonjs/components/testing.js +19 -6
- package/lib/commonjs/components/testing.js.map +1 -1
- package/lib/commonjs/{layout/chatIcon.js → components/welcomeButton.js} +40 -37
- package/lib/commonjs/components/welcomeButton.js.map +1 -0
- package/lib/commonjs/components/welcomeInput.js +87 -0
- package/lib/commonjs/components/welcomeInput.js.map +1 -0
- package/lib/commonjs/contexts/AppContext.js +269 -55
- package/lib/commonjs/contexts/AppContext.js.map +1 -1
- package/lib/commonjs/hooks/{Stream.js → stream.js} +107 -39
- package/lib/commonjs/hooks/stream.js.map +1 -0
- package/lib/commonjs/hooks/useAsyncStorage.js +36 -0
- package/lib/commonjs/hooks/useAsyncStorage.js.map +1 -0
- package/lib/commonjs/index.js +13 -6
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/layout/disclaimer.js +200 -0
- package/lib/commonjs/layout/disclaimer.js.map +1 -0
- package/lib/commonjs/layout/ex.js +272 -0
- package/lib/commonjs/layout/ex.js.map +1 -0
- package/lib/commonjs/layout/icon.js +114 -0
- package/lib/commonjs/layout/icon.js.map +1 -0
- package/lib/commonjs/layout/layout.js +148 -14
- package/lib/commonjs/layout/layout.js.map +1 -1
- package/lib/commonjs/layout/welcome.js +135 -0
- package/lib/commonjs/layout/welcome.js.map +1 -0
- package/lib/commonjs/layout/window.js +205 -0
- package/lib/commonjs/layout/window.js.map +1 -0
- package/lib/module/components/email.js +233 -0
- package/lib/module/components/email.js.map +1 -0
- package/lib/module/components/feedback.js +105 -0
- package/lib/module/components/feedback.js.map +1 -0
- package/lib/module/components/header.js +33 -17
- package/lib/module/components/header.js.map +1 -1
- package/lib/module/components/input.js +96 -0
- package/lib/module/components/input.js.map +1 -0
- package/lib/module/components/productCard.js +225 -0
- package/lib/module/components/productCard.js.map +1 -0
- package/lib/module/components/testing.js +20 -7
- package/lib/module/components/testing.js.map +1 -1
- package/lib/module/components/welcomeButton.js +48 -0
- package/lib/module/components/welcomeButton.js.map +1 -0
- package/lib/module/components/welcomeInput.js +77 -0
- package/lib/module/components/welcomeInput.js.map +1 -0
- package/lib/module/contexts/AppContext.js +269 -56
- package/lib/module/contexts/AppContext.js.map +1 -1
- package/lib/module/hooks/{Stream.js → stream.js} +107 -39
- package/lib/module/hooks/stream.js.map +1 -0
- package/lib/module/hooks/useAsyncStorage.js +29 -0
- package/lib/module/hooks/useAsyncStorage.js.map +1 -0
- package/lib/module/index.js +13 -6
- package/lib/module/index.js.map +1 -1
- package/lib/module/layout/disclaimer.js +190 -0
- package/lib/module/layout/disclaimer.js.map +1 -0
- package/lib/module/layout/ex.js +262 -0
- package/lib/module/layout/ex.js.map +1 -0
- package/lib/module/layout/icon.js +104 -0
- package/lib/module/layout/icon.js.map +1 -0
- package/lib/module/layout/layout.js +150 -16
- package/lib/module/layout/layout.js.map +1 -1
- package/lib/module/layout/welcome.js +126 -0
- package/lib/module/layout/welcome.js.map +1 -0
- package/lib/module/layout/window.js +195 -0
- package/lib/module/layout/window.js.map +1 -0
- package/lib/typescript/components/email.d.ts +5 -0
- package/lib/typescript/components/email.d.ts.map +1 -0
- package/lib/typescript/components/feedback.d.ts +6 -0
- package/lib/typescript/components/feedback.d.ts.map +1 -0
- package/lib/typescript/components/header.d.ts.map +1 -1
- package/lib/typescript/components/input.d.ts +6 -0
- package/lib/typescript/components/input.d.ts.map +1 -0
- package/lib/typescript/components/productCard.d.ts +5 -0
- package/lib/typescript/components/productCard.d.ts.map +1 -0
- package/lib/typescript/components/testing.d.ts.map +1 -1
- package/lib/typescript/components/welcomeButton.d.ts +4 -0
- package/lib/typescript/components/welcomeButton.d.ts.map +1 -0
- package/lib/typescript/components/welcomeInput.d.ts +6 -0
- package/lib/typescript/components/welcomeInput.d.ts.map +1 -0
- package/lib/typescript/contexts/AppContext.d.ts +5 -1
- package/lib/typescript/contexts/AppContext.d.ts.map +1 -1
- package/lib/typescript/hooks/{Stream.d.ts → stream.d.ts} +1 -1
- package/lib/typescript/hooks/stream.d.ts.map +1 -0
- package/lib/typescript/hooks/useAsyncStorage.d.ts +2 -0
- package/lib/typescript/hooks/useAsyncStorage.d.ts.map +1 -0
- package/lib/typescript/index.d.ts +2 -1
- package/lib/typescript/index.d.ts.map +1 -1
- package/lib/typescript/layout/disclaimer.d.ts +5 -0
- package/lib/typescript/layout/disclaimer.d.ts.map +1 -0
- package/lib/typescript/layout/ex.d.ts +3 -0
- package/lib/typescript/layout/ex.d.ts.map +1 -0
- package/lib/typescript/layout/{chatIcon.d.ts → icon.d.ts} +1 -1
- package/lib/typescript/layout/icon.d.ts.map +1 -0
- package/lib/typescript/layout/layout.d.ts +1 -4
- package/lib/typescript/layout/layout.d.ts.map +1 -1
- package/lib/typescript/layout/welcome.d.ts +5 -0
- package/lib/typescript/layout/welcome.d.ts.map +1 -0
- package/lib/typescript/layout/window.d.ts +5 -0
- package/lib/typescript/layout/window.d.ts.map +1 -0
- package/package.json +6 -1
- package/src/components/email.js +210 -0
- package/src/components/feedback.js +114 -0
- package/src/components/header.js +32 -17
- package/src/components/input.js +95 -0
- package/src/components/productCard.js +240 -0
- package/src/components/testing.js +17 -4
- package/src/components/welcomeButton.js +51 -0
- package/src/components/welcomeInput.js +81 -0
- package/src/contexts/AppContext.js +235 -52
- package/src/hooks/{Stream.js → stream.js} +123 -41
- package/src/hooks/useAsyncStorage.js +33 -0
- package/src/index.js +7 -3
- package/src/layout/disclaimer.js +187 -0
- package/src/layout/ex.js +251 -0
- package/src/layout/icon.js +96 -0
- package/src/layout/layout.js +137 -10
- package/src/layout/welcome.js +124 -0
- package/src/layout/window.js +194 -0
- package/lib/commonjs/hooks/Stream.js.map +0 -1
- package/lib/commonjs/layout/chatIcon.js.map +0 -1
- package/lib/commonjs/layout/chatWindow.js +0 -199
- package/lib/commonjs/layout/chatWindow.js.map +0 -1
- package/lib/module/hooks/Stream.js.map +0 -1
- package/lib/module/layout/chatIcon.js +0 -44
- package/lib/module/layout/chatIcon.js.map +0 -1
- package/lib/module/layout/chatWindow.js +0 -189
- package/lib/module/layout/chatWindow.js.map +0 -1
- package/lib/typescript/hooks/Stream.d.ts.map +0 -1
- package/lib/typescript/layout/chatIcon.d.ts.map +0 -1
- package/lib/typescript/layout/chatWindow.d.ts +0 -6
- package/lib/typescript/layout/chatWindow.d.ts.map +0 -1
- package/src/layout/chatIcon.js +0 -38
- package/src/layout/chatWindow.js +0 -211
|
@@ -1,189 +0,0 @@
|
|
|
1
|
-
import React, { useState, useEffect, useContext, useRef } from 'react';
|
|
2
|
-
import { Text, StyleSheet, View, TextInput, TouchableOpacity, Platform, KeyboardAvoidingView, Keyboard } from 'react-native';
|
|
3
|
-
import { Header } from '../components/header';
|
|
4
|
-
import { AppContext } from '../contexts/AppContext';
|
|
5
|
-
import Ionicons from 'react-native-vector-icons/Ionicons';
|
|
6
|
-
import { KeyboardAwareScrollView } from 'react-native-keyboard-aware-scroll-view';
|
|
7
|
-
import { Testing } from '../components/testing';
|
|
8
|
-
const theme = {
|
|
9
|
-
primaryColor: '#003764',
|
|
10
|
-
backgroundColor: '#f6f6f6',
|
|
11
|
-
textColor: '#000000',
|
|
12
|
-
inputBackgroundColor: '#FFFFFF'
|
|
13
|
-
};
|
|
14
|
-
export const ChatWindow = ({
|
|
15
|
-
onProductCardClick,
|
|
16
|
-
onAddToCartClick
|
|
17
|
-
}) => {
|
|
18
|
-
const {
|
|
19
|
-
handleSend,
|
|
20
|
-
messages,
|
|
21
|
-
input,
|
|
22
|
-
setInput
|
|
23
|
-
} = useContext(AppContext);
|
|
24
|
-
const scrollViewRef = useRef(null);
|
|
25
|
-
useEffect(() => {
|
|
26
|
-
if (scrollViewRef.current) {
|
|
27
|
-
setTimeout(() => {
|
|
28
|
-
scrollViewRef.current.scrollToEnd({
|
|
29
|
-
animated: false
|
|
30
|
-
});
|
|
31
|
-
}, 100);
|
|
32
|
-
}
|
|
33
|
-
}, []);
|
|
34
|
-
return /*#__PURE__*/React.createElement(View, {
|
|
35
|
-
style: styles.container
|
|
36
|
-
}, /*#__PURE__*/React.createElement(Header, null), /*#__PURE__*/React.createElement(KeyboardAwareScrollView, {
|
|
37
|
-
ref: scrollViewRef,
|
|
38
|
-
contentContainerStyle: styles.messagesContent,
|
|
39
|
-
enableOnAndroid: true,
|
|
40
|
-
contentInsetAdjustmentBehavior: "never",
|
|
41
|
-
automaticallyAdjustContentInsets: false,
|
|
42
|
-
contentInset: {
|
|
43
|
-
bottom: 0
|
|
44
|
-
},
|
|
45
|
-
keyboardShouldPersistTaps: "always",
|
|
46
|
-
showsVerticalScrollIndicator: false,
|
|
47
|
-
extraScrollHeight: 0,
|
|
48
|
-
onContentSizeChange: () => {
|
|
49
|
-
var _scrollViewRef$curren;
|
|
50
|
-
(_scrollViewRef$curren = scrollViewRef.current) === null || _scrollViewRef$curren === void 0 || _scrollViewRef$curren.scrollToEnd({
|
|
51
|
-
animated: true
|
|
52
|
-
});
|
|
53
|
-
}
|
|
54
|
-
}, messages.map((msg, i) => /*#__PURE__*/React.createElement(View, {
|
|
55
|
-
key: i,
|
|
56
|
-
style: styles.messageWrapper
|
|
57
|
-
}, /*#__PURE__*/React.createElement(View, {
|
|
58
|
-
style: [styles.messageBubble, msg.type === 'user' ? styles.userMessage : styles.aiMessage]
|
|
59
|
-
}, /*#__PURE__*/React.createElement(Text, {
|
|
60
|
-
style: [styles.messageText, {
|
|
61
|
-
color: msg.type === 'user' ? '#fff' : theme.textColor
|
|
62
|
-
}]
|
|
63
|
-
}, msg.text))))), /*#__PURE__*/React.createElement(Testing, {
|
|
64
|
-
onProductCardClick: onProductCardClick,
|
|
65
|
-
onAddToCartClick: onAddToCartClick
|
|
66
|
-
}), /*#__PURE__*/React.createElement(KeyboardAvoidingView, {
|
|
67
|
-
behavior: Platform.OS === 'ios' ? 'padding' : undefined,
|
|
68
|
-
keyboardVerticalOffset: Platform.OS === 'ios' ? 80 : 60
|
|
69
|
-
}, /*#__PURE__*/React.createElement(View, {
|
|
70
|
-
style: styles.inputWrapper
|
|
71
|
-
}, /*#__PURE__*/React.createElement(View, {
|
|
72
|
-
style: styles.inputContainer
|
|
73
|
-
}, /*#__PURE__*/React.createElement(TextInput, {
|
|
74
|
-
style: styles.input,
|
|
75
|
-
value: input,
|
|
76
|
-
onChangeText: setInput,
|
|
77
|
-
placeholder: "Ask a question...",
|
|
78
|
-
placeholderTextColor: "#999",
|
|
79
|
-
multiline: true
|
|
80
|
-
}), /*#__PURE__*/React.createElement(TouchableOpacity, {
|
|
81
|
-
style: styles.inputButton
|
|
82
|
-
}, /*#__PURE__*/React.createElement(Ionicons, {
|
|
83
|
-
name: "mic-outline",
|
|
84
|
-
size: 24,
|
|
85
|
-
color: "#8E8E93"
|
|
86
|
-
})), /*#__PURE__*/React.createElement(TouchableOpacity, {
|
|
87
|
-
style: [styles.sendButton, !input.trim() && styles.disabledButton],
|
|
88
|
-
onPress: handleSend,
|
|
89
|
-
disabled: !input.trim()
|
|
90
|
-
}, /*#__PURE__*/React.createElement(Ionicons, {
|
|
91
|
-
name: "paper-plane-outline",
|
|
92
|
-
size: 24,
|
|
93
|
-
color: input.trim() ? theme.primaryColor : '#8E8E93'
|
|
94
|
-
}))))));
|
|
95
|
-
};
|
|
96
|
-
const styles = StyleSheet.create({
|
|
97
|
-
container: {
|
|
98
|
-
flex: 1,
|
|
99
|
-
backgroundColor: theme.backgroundColor,
|
|
100
|
-
position: 'absolute',
|
|
101
|
-
zIndex: 1000,
|
|
102
|
-
left: 0,
|
|
103
|
-
right: 0,
|
|
104
|
-
bottom: 0,
|
|
105
|
-
top: 100,
|
|
106
|
-
pointerEvents: 'box-none',
|
|
107
|
-
borderTopWidth: 1,
|
|
108
|
-
borderTopColor: '#DDD',
|
|
109
|
-
borderTopLeftRadius: 16,
|
|
110
|
-
borderTopRightRadius: 16,
|
|
111
|
-
overflow: 'hidden'
|
|
112
|
-
},
|
|
113
|
-
messagesContent: {
|
|
114
|
-
padding: 16,
|
|
115
|
-
justifyContent: 'flex-end'
|
|
116
|
-
},
|
|
117
|
-
messageWrapper: {
|
|
118
|
-
marginBottom: 0
|
|
119
|
-
},
|
|
120
|
-
messageBubble: {
|
|
121
|
-
maxWidth: '90%',
|
|
122
|
-
padding: 12,
|
|
123
|
-
paddingHorizontal: 16,
|
|
124
|
-
borderRadius: 12
|
|
125
|
-
},
|
|
126
|
-
userMessage: {
|
|
127
|
-
alignSelf: 'flex-end',
|
|
128
|
-
backgroundColor: theme.primaryColor
|
|
129
|
-
},
|
|
130
|
-
aiMessage: {
|
|
131
|
-
alignSelf: 'flex-start',
|
|
132
|
-
backgroundColor: '#FFFFFF',
|
|
133
|
-
width: '90%'
|
|
134
|
-
},
|
|
135
|
-
messageText: {
|
|
136
|
-
fontSize: 16,
|
|
137
|
-
lineHeight: 22
|
|
138
|
-
},
|
|
139
|
-
inputWrapper: {
|
|
140
|
-
backgroundColor: '#f6f6f6',
|
|
141
|
-
paddingHorizontal: 6,
|
|
142
|
-
paddingVertical: 6,
|
|
143
|
-
borderTopWidth: 1,
|
|
144
|
-
borderTopColor: 'rgba(0, 0, 0, 0.1)',
|
|
145
|
-
paddingBottom: 25
|
|
146
|
-
},
|
|
147
|
-
inputContainer: {
|
|
148
|
-
flexDirection: 'row',
|
|
149
|
-
alignItems: 'center',
|
|
150
|
-
paddingHorizontal: 8,
|
|
151
|
-
paddingVertical: 8,
|
|
152
|
-
backgroundColor: '#FFFFFF',
|
|
153
|
-
borderRadius: 16,
|
|
154
|
-
margin: 8,
|
|
155
|
-
shadowColor: '#000',
|
|
156
|
-
shadowOffset: {
|
|
157
|
-
width: 0,
|
|
158
|
-
height: 2
|
|
159
|
-
},
|
|
160
|
-
shadowOpacity: 0.1,
|
|
161
|
-
shadowRadius: 4,
|
|
162
|
-
elevation: 3
|
|
163
|
-
},
|
|
164
|
-
input: {
|
|
165
|
-
flex: 1,
|
|
166
|
-
fontSize: 16,
|
|
167
|
-
paddingVertical: 8,
|
|
168
|
-
paddingHorizontal: 12,
|
|
169
|
-
color: '#000000'
|
|
170
|
-
},
|
|
171
|
-
inputButton: {
|
|
172
|
-
padding: 6
|
|
173
|
-
},
|
|
174
|
-
sendButton: {
|
|
175
|
-
padding: 6,
|
|
176
|
-
marginLeft: 'auto'
|
|
177
|
-
},
|
|
178
|
-
disabledButton: {
|
|
179
|
-
opacity: 0.7
|
|
180
|
-
}
|
|
181
|
-
});
|
|
182
|
-
|
|
183
|
-
/*
|
|
184
|
-
<Testing
|
|
185
|
-
onProductCardClick={onProductCardClick}
|
|
186
|
-
onAddToCartClick={onAddToCartClick}
|
|
187
|
-
/>
|
|
188
|
-
*/
|
|
189
|
-
//# sourceMappingURL=chatWindow.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["React","useState","useEffect","useContext","useRef","Text","StyleSheet","View","TextInput","TouchableOpacity","Platform","KeyboardAvoidingView","Keyboard","Header","AppContext","Ionicons","KeyboardAwareScrollView","Testing","theme","primaryColor","backgroundColor","textColor","inputBackgroundColor","ChatWindow","onProductCardClick","onAddToCartClick","handleSend","messages","input","setInput","scrollViewRef","current","setTimeout","scrollToEnd","animated","createElement","style","styles","container","ref","contentContainerStyle","messagesContent","enableOnAndroid","contentInsetAdjustmentBehavior","automaticallyAdjustContentInsets","contentInset","bottom","keyboardShouldPersistTaps","showsVerticalScrollIndicator","extraScrollHeight","onContentSizeChange","_scrollViewRef$curren","map","msg","i","key","messageWrapper","messageBubble","type","userMessage","aiMessage","messageText","color","text","behavior","OS","undefined","keyboardVerticalOffset","inputWrapper","inputContainer","value","onChangeText","placeholder","placeholderTextColor","multiline","inputButton","name","size","sendButton","trim","disabledButton","onPress","disabled","create","flex","position","zIndex","left","right","top","pointerEvents","borderTopWidth","borderTopColor","borderTopLeftRadius","borderTopRightRadius","overflow","padding","justifyContent","marginBottom","maxWidth","paddingHorizontal","borderRadius","alignSelf","width","fontSize","lineHeight","paddingVertical","paddingBottom","flexDirection","alignItems","margin","shadowColor","shadowOffset","height","shadowOpacity","shadowRadius","elevation","marginLeft","opacity"],"sourceRoot":"../../../src","sources":["layout/chatWindow.js"],"mappings":"AAAA,OAAOA,KAAK,IAAIC,QAAQ,EAAEC,SAAS,EAAEC,UAAU,EAAEC,MAAM,QAAQ,OAAO;AACtE,SACEC,IAAI,EACJC,UAAU,EACVC,IAAI,EACJC,SAAS,EACTC,gBAAgB,EAChBC,QAAQ,EACRC,oBAAoB,EACpBC,QAAQ,QACH,cAAc;AACrB,SAASC,MAAM,QAAQ,sBAAsB;AAC7C,SAASC,UAAU,QAAQ,wBAAwB;AACnD,OAAOC,QAAQ,MAAM,oCAAoC;AACzD,SAASC,uBAAuB,QAAQ,yCAAyC;AACjF,SAASC,OAAO,QAAQ,uBAAuB;AAE/C,MAAMC,KAAK,GAAG;EACZC,YAAY,EAAE,SAAS;EACvBC,eAAe,EAAE,SAAS;EAC1BC,SAAS,EAAE,SAAS;EACpBC,oBAAoB,EAAE;AACxB,CAAC;AAED,OAAO,MAAMC,UAAU,GAAGA,CAAC;EAAEC,kBAAkB;EAAEC;AAAiB,CAAC,KAAK;EACtE,MAAM;IAAEC,UAAU;IAAEC,QAAQ;IAAEC,KAAK;IAAEC;EAAS,CAAC,GAAG1B,UAAU,CAACW,UAAU,CAAC;EACxE,MAAMgB,aAAa,GAAG1B,MAAM,CAAC,IAAI,CAAC;EAElCF,SAAS,CAAC,MAAM;IACd,IAAI4B,aAAa,CAACC,OAAO,EAAE;MACzBC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SAAS,EAAE,YAAY;IACvBlF,eAAe,EAAE,SAAS;IAC1BmF,KAAK,EAAE;EACT,CAAC;EACD1C,WAAW,EAAE;IACX2C,QAAQ,EAAE,EAAE;IACZC,UAAU,EAAE;EACd,CAAC;EACDrC,YAAY,EAAE;IACZhD,eAAe,EAAE,SAAS;IAC1BgF,iBAAiB,EAAE,CAAC;IACpBM,eAAe,EAAE,CAAC;IAClBf,cAAc,EAAE,CAAC;IACjBC,cAAc,EAAE,oBAAoB;IACpCe,aAAa,EAAE;EACjB,CAAC;EACDtC,cAAc,EAAE;IACduC,aAAa,EAAE,KAAK;IACpBC,UAAU,EAAE,QAAQ;IACpBT,iBAAiB,EAAE,CAAC;IACpBM,eAAe,EAAE,CAAC;IAClBtF,eAAe,EAAE,SAAS;IAC1BiF,YAAY,EAAE,EAAE;IAChBS,MAAM,EAAE,CAAC;IACTC,WAAW,EAAE,MAAM;IACnBC,YAAY,EAAE;MACZT,KAAK,EAAE,CAAC;MACRU,MAAM,EAAE;IACV,CAAC;IACDC,aAAa,EAAE,GAAG;IAClBC,YAAY,EAAE,CAAC;IACfC,SAAS,EAAE;EACb,CAAC;EACDxF,KAAK,EAAE;IACLwD,IAAI,EAAE,CAAC;IACPoB,QAAQ,EAAE,EAAE;IACZE,eAAe,EAAE,CAAC;IAClBN,iBAAiB,EAAE,EAAE;IACrBtC,KAAK,EAAE;EACT,CAAC;EACDa,WAAW,EAAE;IACXqB,OAAO,EAAE;EACX,CAAC;EACDlB,UAAU,EAAE;IACVkB,OAAO,EAAE,CAAC;IACVqB,UAAU,EAAE;EACd,CAAC;EACDrC,cAAc,EAAE;IACdsC,OAAO,EAAE;EACX;AACF,CAAC,CAAC;;AAEF;AACA;AACA;AACA;AACA;AACA","ignoreList":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Stream.d.ts","sourceRoot":"","sources":["../../../src/hooks/Stream.js"],"names":[],"mappings":"AAGA,4CAkMC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"chatIcon.d.ts","sourceRoot":"","sources":["../../../src/layout/chatIcon.js"],"names":[],"mappings":"AAKO,8CAUN;kBAfiC,OAAO"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"chatWindow.d.ts","sourceRoot":"","sources":["../../../src/layout/chatWindow.js"],"names":[],"mappings":"AAwBO;;;sBA4FN;kBApH8D,OAAO"}
|
package/src/layout/chatIcon.js
DELETED
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import React, { useContext } from 'react';
|
|
2
|
-
import { TouchableOpacity, View, StyleSheet } from 'react-native';
|
|
3
|
-
import { AppContext } from '../contexts/AppContext';
|
|
4
|
-
import Ionicons from 'react-native-vector-icons/Ionicons';
|
|
5
|
-
|
|
6
|
-
export const ChatIcon = () => {
|
|
7
|
-
const { setShowModal } = useContext(AppContext);
|
|
8
|
-
|
|
9
|
-
return (
|
|
10
|
-
<TouchableOpacity style={styles.iconContainer} onPress={() => setShowModal("ChatWindow")}>
|
|
11
|
-
<View style={styles.icon}>
|
|
12
|
-
<Ionicons name="chatbubble-ellipses" size={28} color="white" />
|
|
13
|
-
</View>
|
|
14
|
-
</TouchableOpacity>
|
|
15
|
-
);
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
const styles = StyleSheet.create({
|
|
19
|
-
iconContainer: {
|
|
20
|
-
position: 'absolute',
|
|
21
|
-
bottom: 80,
|
|
22
|
-
right: 20,
|
|
23
|
-
zIndex: 10,
|
|
24
|
-
},
|
|
25
|
-
icon: {
|
|
26
|
-
backgroundColor: '#FFA500',
|
|
27
|
-
width: 60,
|
|
28
|
-
height: 60,
|
|
29
|
-
borderRadius: 30,
|
|
30
|
-
alignItems: 'center',
|
|
31
|
-
justifyContent: 'center',
|
|
32
|
-
shadowColor: '#000',
|
|
33
|
-
shadowOffset: { width: 0, height: 2 },
|
|
34
|
-
shadowOpacity: 0.2,
|
|
35
|
-
shadowRadius: 3,
|
|
36
|
-
elevation: 5,
|
|
37
|
-
},
|
|
38
|
-
});
|
package/src/layout/chatWindow.js
DELETED
|
@@ -1,211 +0,0 @@
|
|
|
1
|
-
import React, { useState, useEffect, useContext, useRef } from 'react';
|
|
2
|
-
import {
|
|
3
|
-
Text,
|
|
4
|
-
StyleSheet,
|
|
5
|
-
View,
|
|
6
|
-
TextInput,
|
|
7
|
-
TouchableOpacity,
|
|
8
|
-
Platform,
|
|
9
|
-
KeyboardAvoidingView,
|
|
10
|
-
Keyboard
|
|
11
|
-
} from 'react-native';
|
|
12
|
-
import { Header } from '../components/header';
|
|
13
|
-
import { AppContext } from '../contexts/AppContext';
|
|
14
|
-
import Ionicons from 'react-native-vector-icons/Ionicons';
|
|
15
|
-
import { KeyboardAwareScrollView } from 'react-native-keyboard-aware-scroll-view';
|
|
16
|
-
import { Testing } from '../components/testing';
|
|
17
|
-
|
|
18
|
-
const theme = {
|
|
19
|
-
primaryColor: '#003764',
|
|
20
|
-
backgroundColor: '#f6f6f6',
|
|
21
|
-
textColor: '#000000',
|
|
22
|
-
inputBackgroundColor: '#FFFFFF',
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
export const ChatWindow = ({ onProductCardClick, onAddToCartClick }) => {
|
|
26
|
-
const { handleSend, messages, input, setInput } = useContext(AppContext);
|
|
27
|
-
const scrollViewRef = useRef(null);
|
|
28
|
-
|
|
29
|
-
useEffect(() => {
|
|
30
|
-
if (scrollViewRef.current) {
|
|
31
|
-
setTimeout(() => {
|
|
32
|
-
scrollViewRef.current.scrollToEnd({ animated: false });
|
|
33
|
-
}, 100);
|
|
34
|
-
}
|
|
35
|
-
}, []);
|
|
36
|
-
|
|
37
|
-
return (
|
|
38
|
-
<View style={styles.container}>
|
|
39
|
-
<Header />
|
|
40
|
-
|
|
41
|
-
{/* Messages area */}
|
|
42
|
-
<KeyboardAwareScrollView
|
|
43
|
-
ref={scrollViewRef}
|
|
44
|
-
contentContainerStyle={styles.messagesContent}
|
|
45
|
-
enableOnAndroid
|
|
46
|
-
contentInsetAdjustmentBehavior="never"
|
|
47
|
-
automaticallyAdjustContentInsets={false}
|
|
48
|
-
contentInset={{ bottom: 0 }}
|
|
49
|
-
keyboardShouldPersistTaps="always"
|
|
50
|
-
showsVerticalScrollIndicator={false}
|
|
51
|
-
extraScrollHeight={0}
|
|
52
|
-
onContentSizeChange={() => {
|
|
53
|
-
scrollViewRef.current?.scrollToEnd({ animated: true });
|
|
54
|
-
}}
|
|
55
|
-
>
|
|
56
|
-
{messages.map((msg, i) => (
|
|
57
|
-
<View key={i} style={styles.messageWrapper}>
|
|
58
|
-
<View
|
|
59
|
-
style={[
|
|
60
|
-
styles.messageBubble,
|
|
61
|
-
msg.type === 'user' ? styles.userMessage : styles.aiMessage,
|
|
62
|
-
]}
|
|
63
|
-
>
|
|
64
|
-
<Text
|
|
65
|
-
style={[
|
|
66
|
-
styles.messageText,
|
|
67
|
-
{ color: msg.type === 'user' ? '#fff' : theme.textColor },
|
|
68
|
-
]}
|
|
69
|
-
>
|
|
70
|
-
{msg.text}
|
|
71
|
-
</Text>
|
|
72
|
-
</View>
|
|
73
|
-
</View>
|
|
74
|
-
))}
|
|
75
|
-
</KeyboardAwareScrollView>
|
|
76
|
-
|
|
77
|
-
<Testing
|
|
78
|
-
onProductCardClick={onProductCardClick}
|
|
79
|
-
onAddToCartClick={onAddToCartClick}
|
|
80
|
-
/>
|
|
81
|
-
<KeyboardAvoidingView
|
|
82
|
-
behavior={Platform.OS === 'ios' ? 'padding' : undefined}
|
|
83
|
-
keyboardVerticalOffset={Platform.OS === 'ios' ? 80 : 60}
|
|
84
|
-
>
|
|
85
|
-
<View style={styles.inputWrapper}>
|
|
86
|
-
<View style={styles.inputContainer}>
|
|
87
|
-
<TextInput
|
|
88
|
-
style={styles.input}
|
|
89
|
-
value={input}
|
|
90
|
-
onChangeText={setInput}
|
|
91
|
-
placeholder="Ask a question..."
|
|
92
|
-
placeholderTextColor="#999"
|
|
93
|
-
multiline
|
|
94
|
-
/>
|
|
95
|
-
<TouchableOpacity style={styles.inputButton}>
|
|
96
|
-
<Ionicons name="mic-outline" size={24} color="#8E8E93" />
|
|
97
|
-
</TouchableOpacity>
|
|
98
|
-
<TouchableOpacity
|
|
99
|
-
style={[
|
|
100
|
-
styles.sendButton,
|
|
101
|
-
!input.trim() && styles.disabledButton,
|
|
102
|
-
]}
|
|
103
|
-
onPress={handleSend}
|
|
104
|
-
disabled={!input.trim()}
|
|
105
|
-
>
|
|
106
|
-
<Ionicons
|
|
107
|
-
name="paper-plane-outline"
|
|
108
|
-
size={24}
|
|
109
|
-
color={input.trim() ? theme.primaryColor : '#8E8E93'}
|
|
110
|
-
/>
|
|
111
|
-
</TouchableOpacity>
|
|
112
|
-
</View>
|
|
113
|
-
</View>
|
|
114
|
-
</KeyboardAvoidingView>
|
|
115
|
-
</View>
|
|
116
|
-
);
|
|
117
|
-
};
|
|
118
|
-
|
|
119
|
-
const styles = StyleSheet.create({
|
|
120
|
-
container: {
|
|
121
|
-
flex: 1,
|
|
122
|
-
backgroundColor: theme.backgroundColor,
|
|
123
|
-
position: 'absolute',
|
|
124
|
-
zIndex: 1000,
|
|
125
|
-
left: 0,
|
|
126
|
-
right: 0,
|
|
127
|
-
bottom: 0,
|
|
128
|
-
top: 100,
|
|
129
|
-
pointerEvents: 'box-none',
|
|
130
|
-
borderTopWidth: 1,
|
|
131
|
-
borderTopColor: '#DDD',
|
|
132
|
-
borderTopLeftRadius: 16,
|
|
133
|
-
borderTopRightRadius: 16,
|
|
134
|
-
overflow: 'hidden',
|
|
135
|
-
},
|
|
136
|
-
messagesContent: {
|
|
137
|
-
padding: 16,
|
|
138
|
-
justifyContent: 'flex-end'
|
|
139
|
-
},
|
|
140
|
-
messageWrapper: {
|
|
141
|
-
marginBottom: 0,
|
|
142
|
-
},
|
|
143
|
-
messageBubble: {
|
|
144
|
-
maxWidth: '90%',
|
|
145
|
-
padding: 12,
|
|
146
|
-
paddingHorizontal: 16,
|
|
147
|
-
borderRadius: 12,
|
|
148
|
-
},
|
|
149
|
-
userMessage: {
|
|
150
|
-
alignSelf: 'flex-end',
|
|
151
|
-
backgroundColor: theme.primaryColor,
|
|
152
|
-
},
|
|
153
|
-
aiMessage: {
|
|
154
|
-
alignSelf: 'flex-start',
|
|
155
|
-
backgroundColor: '#FFFFFF',
|
|
156
|
-
width: '90%',
|
|
157
|
-
},
|
|
158
|
-
messageText: {
|
|
159
|
-
fontSize: 16,
|
|
160
|
-
lineHeight: 22,
|
|
161
|
-
},
|
|
162
|
-
inputWrapper: {
|
|
163
|
-
backgroundColor: '#f6f6f6',
|
|
164
|
-
paddingHorizontal: 6,
|
|
165
|
-
paddingVertical: 6,
|
|
166
|
-
borderTopWidth: 1,
|
|
167
|
-
borderTopColor: 'rgba(0, 0, 0, 0.1)',
|
|
168
|
-
paddingBottom: 25,
|
|
169
|
-
},
|
|
170
|
-
inputContainer: {
|
|
171
|
-
flexDirection: 'row',
|
|
172
|
-
alignItems: 'center',
|
|
173
|
-
paddingHorizontal: 8,
|
|
174
|
-
paddingVertical: 8,
|
|
175
|
-
backgroundColor: '#FFFFFF',
|
|
176
|
-
borderRadius: 16,
|
|
177
|
-
margin: 8,
|
|
178
|
-
shadowColor: '#000',
|
|
179
|
-
shadowOffset: {
|
|
180
|
-
width: 0,
|
|
181
|
-
height: 2,
|
|
182
|
-
},
|
|
183
|
-
shadowOpacity: 0.1,
|
|
184
|
-
shadowRadius: 4,
|
|
185
|
-
elevation: 3,
|
|
186
|
-
},
|
|
187
|
-
input: {
|
|
188
|
-
flex: 1,
|
|
189
|
-
fontSize: 16,
|
|
190
|
-
paddingVertical: 8,
|
|
191
|
-
paddingHorizontal: 12,
|
|
192
|
-
color: '#000000',
|
|
193
|
-
},
|
|
194
|
-
inputButton: {
|
|
195
|
-
padding: 6,
|
|
196
|
-
},
|
|
197
|
-
sendButton: {
|
|
198
|
-
padding: 6,
|
|
199
|
-
marginLeft: 'auto',
|
|
200
|
-
},
|
|
201
|
-
disabledButton: {
|
|
202
|
-
opacity: 0.7,
|
|
203
|
-
},
|
|
204
|
-
});
|
|
205
|
-
|
|
206
|
-
/*
|
|
207
|
-
<Testing
|
|
208
|
-
onProductCardClick={onProductCardClick}
|
|
209
|
-
onAddToCartClick={onAddToCartClick}
|
|
210
|
-
/>
|
|
211
|
-
*/
|