react-native-srschat 0.1.13 → 0.1.15

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.
Files changed (140) hide show
  1. package/lib/commonjs/components/email.js +243 -0
  2. package/lib/commonjs/components/email.js.map +1 -0
  3. package/lib/commonjs/components/feedback.js +115 -0
  4. package/lib/commonjs/components/feedback.js.map +1 -0
  5. package/lib/commonjs/components/header.js +35 -17
  6. package/lib/commonjs/components/header.js.map +1 -1
  7. package/lib/commonjs/components/input.js +106 -0
  8. package/lib/commonjs/components/input.js.map +1 -0
  9. package/lib/commonjs/components/productCard.js +234 -0
  10. package/lib/commonjs/components/productCard.js.map +1 -0
  11. package/lib/commonjs/components/testing.js +19 -6
  12. package/lib/commonjs/components/testing.js.map +1 -1
  13. package/lib/commonjs/{layout/chatIcon.js → components/welcomeButton.js} +40 -37
  14. package/lib/commonjs/components/welcomeButton.js.map +1 -0
  15. package/lib/commonjs/components/welcomeInput.js +87 -0
  16. package/lib/commonjs/components/welcomeInput.js.map +1 -0
  17. package/lib/commonjs/contexts/AppContext.js +272 -56
  18. package/lib/commonjs/contexts/AppContext.js.map +1 -1
  19. package/lib/commonjs/hooks/{Stream.js → stream.js} +107 -39
  20. package/lib/commonjs/hooks/stream.js.map +1 -0
  21. package/lib/commonjs/hooks/useAsyncStorage.js +36 -0
  22. package/lib/commonjs/hooks/useAsyncStorage.js.map +1 -0
  23. package/lib/commonjs/index.js +13 -6
  24. package/lib/commonjs/index.js.map +1 -1
  25. package/lib/commonjs/layout/disclaimer.js +200 -0
  26. package/lib/commonjs/layout/disclaimer.js.map +1 -0
  27. package/lib/commonjs/layout/ex.js +272 -0
  28. package/lib/commonjs/layout/ex.js.map +1 -0
  29. package/lib/commonjs/layout/icon.js +114 -0
  30. package/lib/commonjs/layout/icon.js.map +1 -0
  31. package/lib/commonjs/layout/layout.js +148 -14
  32. package/lib/commonjs/layout/layout.js.map +1 -1
  33. package/lib/commonjs/layout/welcome.js +135 -0
  34. package/lib/commonjs/layout/welcome.js.map +1 -0
  35. package/lib/commonjs/layout/window.js +205 -0
  36. package/lib/commonjs/layout/window.js.map +1 -0
  37. package/lib/module/components/email.js +233 -0
  38. package/lib/module/components/email.js.map +1 -0
  39. package/lib/module/components/feedback.js +105 -0
  40. package/lib/module/components/feedback.js.map +1 -0
  41. package/lib/module/components/header.js +35 -17
  42. package/lib/module/components/header.js.map +1 -1
  43. package/lib/module/components/input.js +96 -0
  44. package/lib/module/components/input.js.map +1 -0
  45. package/lib/module/components/productCard.js +225 -0
  46. package/lib/module/components/productCard.js.map +1 -0
  47. package/lib/module/components/testing.js +20 -7
  48. package/lib/module/components/testing.js.map +1 -1
  49. package/lib/module/components/welcomeButton.js +48 -0
  50. package/lib/module/components/welcomeButton.js.map +1 -0
  51. package/lib/module/components/welcomeInput.js +77 -0
  52. package/lib/module/components/welcomeInput.js.map +1 -0
  53. package/lib/module/contexts/AppContext.js +272 -57
  54. package/lib/module/contexts/AppContext.js.map +1 -1
  55. package/lib/module/hooks/{Stream.js → stream.js} +107 -39
  56. package/lib/module/hooks/stream.js.map +1 -0
  57. package/lib/module/hooks/useAsyncStorage.js +29 -0
  58. package/lib/module/hooks/useAsyncStorage.js.map +1 -0
  59. package/lib/module/index.js +13 -6
  60. package/lib/module/index.js.map +1 -1
  61. package/lib/module/layout/disclaimer.js +190 -0
  62. package/lib/module/layout/disclaimer.js.map +1 -0
  63. package/lib/module/layout/ex.js +262 -0
  64. package/lib/module/layout/ex.js.map +1 -0
  65. package/lib/module/layout/icon.js +104 -0
  66. package/lib/module/layout/icon.js.map +1 -0
  67. package/lib/module/layout/layout.js +150 -16
  68. package/lib/module/layout/layout.js.map +1 -1
  69. package/lib/module/layout/welcome.js +126 -0
  70. package/lib/module/layout/welcome.js.map +1 -0
  71. package/lib/module/layout/window.js +195 -0
  72. package/lib/module/layout/window.js.map +1 -0
  73. package/lib/typescript/components/email.d.ts +5 -0
  74. package/lib/typescript/components/email.d.ts.map +1 -0
  75. package/lib/typescript/components/feedback.d.ts +6 -0
  76. package/lib/typescript/components/feedback.d.ts.map +1 -0
  77. package/lib/typescript/components/header.d.ts.map +1 -1
  78. package/lib/typescript/components/input.d.ts +6 -0
  79. package/lib/typescript/components/input.d.ts.map +1 -0
  80. package/lib/typescript/components/productCard.d.ts +5 -0
  81. package/lib/typescript/components/productCard.d.ts.map +1 -0
  82. package/lib/typescript/components/testing.d.ts.map +1 -1
  83. package/lib/typescript/components/welcomeButton.d.ts +4 -0
  84. package/lib/typescript/components/welcomeButton.d.ts.map +1 -0
  85. package/lib/typescript/components/welcomeInput.d.ts +6 -0
  86. package/lib/typescript/components/welcomeInput.d.ts.map +1 -0
  87. package/lib/typescript/contexts/AppContext.d.ts +5 -1
  88. package/lib/typescript/contexts/AppContext.d.ts.map +1 -1
  89. package/lib/typescript/hooks/{Stream.d.ts → stream.d.ts} +1 -1
  90. package/lib/typescript/hooks/stream.d.ts.map +1 -0
  91. package/lib/typescript/hooks/useAsyncStorage.d.ts +2 -0
  92. package/lib/typescript/hooks/useAsyncStorage.d.ts.map +1 -0
  93. package/lib/typescript/index.d.ts +2 -1
  94. package/lib/typescript/index.d.ts.map +1 -1
  95. package/lib/typescript/layout/disclaimer.d.ts +5 -0
  96. package/lib/typescript/layout/disclaimer.d.ts.map +1 -0
  97. package/lib/typescript/layout/ex.d.ts +3 -0
  98. package/lib/typescript/layout/ex.d.ts.map +1 -0
  99. package/lib/typescript/layout/{chatIcon.d.ts → icon.d.ts} +1 -1
  100. package/lib/typescript/layout/icon.d.ts.map +1 -0
  101. package/lib/typescript/layout/layout.d.ts +1 -4
  102. package/lib/typescript/layout/layout.d.ts.map +1 -1
  103. package/lib/typescript/layout/welcome.d.ts +5 -0
  104. package/lib/typescript/layout/welcome.d.ts.map +1 -0
  105. package/lib/typescript/layout/window.d.ts +5 -0
  106. package/lib/typescript/layout/window.d.ts.map +1 -0
  107. package/package.json +7 -1
  108. package/src/components/email.js +210 -0
  109. package/src/components/feedback.js +114 -0
  110. package/src/components/header.js +32 -17
  111. package/src/components/input.js +95 -0
  112. package/src/components/productCard.js +240 -0
  113. package/src/components/testing.js +17 -4
  114. package/src/components/welcomeButton.js +51 -0
  115. package/src/components/welcomeInput.js +81 -0
  116. package/src/contexts/AppContext.js +237 -52
  117. package/src/hooks/{Stream.js → stream.js} +123 -41
  118. package/src/hooks/useAsyncStorage.js +33 -0
  119. package/src/index.js +7 -3
  120. package/src/layout/disclaimer.js +187 -0
  121. package/src/layout/ex.js +251 -0
  122. package/src/layout/icon.js +96 -0
  123. package/src/layout/layout.js +137 -10
  124. package/src/layout/welcome.js +124 -0
  125. package/src/layout/window.js +194 -0
  126. package/lib/commonjs/hooks/Stream.js.map +0 -1
  127. package/lib/commonjs/layout/chatIcon.js.map +0 -1
  128. package/lib/commonjs/layout/chatWindow.js +0 -214
  129. package/lib/commonjs/layout/chatWindow.js.map +0 -1
  130. package/lib/module/hooks/Stream.js.map +0 -1
  131. package/lib/module/layout/chatIcon.js +0 -44
  132. package/lib/module/layout/chatIcon.js.map +0 -1
  133. package/lib/module/layout/chatWindow.js +0 -204
  134. package/lib/module/layout/chatWindow.js.map +0 -1
  135. package/lib/typescript/hooks/Stream.d.ts.map +0 -1
  136. package/lib/typescript/layout/chatIcon.d.ts.map +0 -1
  137. package/lib/typescript/layout/chatWindow.d.ts +0 -6
  138. package/lib/typescript/layout/chatWindow.d.ts.map +0 -1
  139. package/src/layout/chatIcon.js +0 -38
  140. package/src/layout/chatWindow.js +0 -207
@@ -1,204 +0,0 @@
1
- import React, { useState, useCallback, useContext } from 'react';
2
- import { SafeAreaView, Text, StyleSheet, View, TextInput, ScrollView, KeyboardAvoidingView, Platform, TouchableOpacity, RefreshControl } from 'react-native';
3
- import { Header } from '../components/header';
4
- import { AppContext } from '../contexts/AppContext';
5
- import { Testing } from '../components/testing';
6
- import Ionicons from 'react-native-vector-icons/Ionicons';
7
- const theme = {
8
- primaryColor: '#003764',
9
- backgroundColor: '#f6f6f6',
10
- textColor: '#000000',
11
- inputBackgroundColor: '#f6f6f6'
12
- };
13
- export const ChatWindow = ({
14
- onProductCardClick,
15
- onAddToCartClick
16
- }) => {
17
- const {
18
- handleSend,
19
- messages,
20
- setMessages,
21
- onSendMessage,
22
- input,
23
- setInput
24
- } = useContext(AppContext);
25
- const [refreshing, setRefreshing] = useState(false);
26
- const onRefresh = useCallback(async () => {
27
- setRefreshing(true);
28
- try {
29
- const response = await onSendMessage("Hi, I'm refreshing the chat!");
30
- setMessages(prev => [...prev, {
31
- text: response,
32
- isUser: false
33
- }]);
34
- } catch (error) {
35
- console.error('Error refreshing chat:', error);
36
- } finally {
37
- setRefreshing(false);
38
- }
39
- }, []);
40
- const getMessageStyle = type => [styles.messageBubble, type === "user" ? styles.userMessage : styles.aiMessage, {
41
- backgroundColor: type === "user" ? theme.primaryColor : '#E8E8E8'
42
- }];
43
- const getTextStyle = type => [styles.messageText, {
44
- color: type === "user" ? '#fff' : theme.textColor
45
- }];
46
- return /*#__PURE__*/React.createElement(View, {
47
- style: styles.container
48
- }, /*#__PURE__*/React.createElement(View, {
49
- style: styles.chatWindow
50
- }, /*#__PURE__*/React.createElement(Header, null), /*#__PURE__*/React.createElement(KeyboardAvoidingView, {
51
- behavior: Platform.OS === 'ios' ? 'padding' : 'height',
52
- style: styles.content,
53
- keyboardVerticalOffset: Platform.OS === 'ios' ? 40 : 0
54
- }, /*#__PURE__*/React.createElement(ScrollView, {
55
- style: styles.messagesContainer,
56
- contentContainerStyle: styles.messagesContent,
57
- refreshControl: /*#__PURE__*/React.createElement(RefreshControl, {
58
- refreshing: refreshing,
59
- onRefresh: onRefresh,
60
- tintColor: theme.primaryColor,
61
- colors: [theme.primaryColor],
62
- progressBackgroundColor: "#ffffff"
63
- })
64
- }, messages.map((msg, i) => /*#__PURE__*/React.createElement(View, {
65
- key: i,
66
- style: styles.messageWrapper
67
- }, /*#__PURE__*/React.createElement(View, {
68
- style: [getMessageStyle(msg.type), styles.messageShadow]
69
- }, /*#__PURE__*/React.createElement(Text, {
70
- style: getTextStyle(msg.type)
71
- }, msg.text))))), /*#__PURE__*/React.createElement(Testing, {
72
- onProductCardClick: onProductCardClick,
73
- onAddToCartClick: onAddToCartClick
74
- }), /*#__PURE__*/React.createElement(View, {
75
- style: styles.inputWrapper
76
- }, /*#__PURE__*/React.createElement(View, {
77
- style: styles.inputContainer
78
- }, /*#__PURE__*/React.createElement(TextInput, {
79
- style: styles.input,
80
- value: input,
81
- onChangeText: setInput,
82
- placeholder: "Ask a question...",
83
- placeholderTextColor: "#999",
84
- multiline: true
85
- }), /*#__PURE__*/React.createElement(TouchableOpacity, {
86
- style: styles.inputButton
87
- }, /*#__PURE__*/React.createElement(Ionicons, {
88
- name: "mic-outline",
89
- size: 24,
90
- color: "#8E8E93"
91
- })), /*#__PURE__*/React.createElement(TouchableOpacity, {
92
- style: [styles.sendButton, !input.trim() && styles.disabledButton],
93
- onPress: handleSend,
94
- disabled: !input.trim()
95
- }, /*#__PURE__*/React.createElement(Ionicons, {
96
- name: "paper-plane-outline",
97
- size: 24,
98
- color: input.trim() ? theme.primaryColor : '#8E8E93'
99
- })))))));
100
- };
101
- const styles = StyleSheet.create({
102
- container: {
103
- flex: 1,
104
- backgroundColor: '#FFFFFF',
105
- position: 'absolute',
106
- zIndex: 1000,
107
- left: 0,
108
- right: 0,
109
- bottom: 0,
110
- top: 100,
111
- pointerEvents: 'box-none'
112
- },
113
- chatWindow: {
114
- zIndex: 1,
115
- flex: 1,
116
- borderTopWidth: 1,
117
- borderTopColor: '#DDD',
118
- borderTopLeftRadius: 16,
119
- borderTopRightRadius: 16,
120
- overflow: 'hidden',
121
- backgroundColor: theme.backgroundColor
122
- },
123
- content: {
124
- flex: 1
125
- },
126
- messagesContainer: {
127
- flex: 1
128
- },
129
- messagesContent: {
130
- padding: 16,
131
- paddingBottom: 32
132
- },
133
- messageWrapper: {
134
- marginBottom: 16
135
- },
136
- messageBubble: {
137
- maxWidth: '90%',
138
- padding: 12,
139
- paddingHorizontal: 16,
140
- borderRadius: 20
141
- },
142
- messageShadow: {
143
- shadowColor: '#000',
144
- shadowOffset: {
145
- width: 0,
146
- height: 1
147
- },
148
- shadowOpacity: 0.08,
149
- shadowRadius: 2,
150
- elevation: 2
151
- },
152
- userMessage: {
153
- alignSelf: 'flex-end',
154
- backgroundColor: theme.primaryColor
155
- },
156
- aiMessage: {
157
- alignSelf: 'flex-start',
158
- backgroundColor: '#F2F2F7'
159
- },
160
- messageText: {
161
- fontSize: 16,
162
- lineHeight: 22
163
- },
164
- inputWrapper: {
165
- backgroundColor: '#f6f6f6',
166
- paddingHorizontal: 8,
167
- paddingVertical: 8,
168
- borderTopWidth: 1,
169
- borderTopColor: 'rgba(0, 0, 0, 0.1)',
170
- paddingBottom: 40
171
- },
172
- inputContainer: {
173
- flexDirection: 'row',
174
- alignItems: 'center',
175
- paddingHorizontal: 8,
176
- paddingVertical: 8,
177
- backgroundColor: '#FFFFFF',
178
- borderRadius: 16,
179
- margin: 8,
180
- shadowColor: '#000',
181
- shadowOffset: {
182
- width: 0,
183
- height: 2
184
- },
185
- shadowOpacity: 0.1,
186
- shadowRadius: 4,
187
- elevation: 3
188
- },
189
- input: {
190
- flex: 1,
191
- fontSize: 16,
192
- paddingVertical: 8,
193
- paddingHorizontal: 12,
194
- color: '#000000'
195
- },
196
- sendButton: {
197
- padding: 6,
198
- marginLeft: 'auto'
199
- },
200
- disabledButton: {
201
- opacity: 0.7
202
- }
203
- });
204
- //# sourceMappingURL=chatWindow.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["React","useState","useCallback","useContext","SafeAreaView","Text","StyleSheet","View","TextInput","ScrollView","KeyboardAvoidingView","Platform","TouchableOpacity","RefreshControl","Header","AppContext","Testing","Ionicons","theme","primaryColor","backgroundColor","textColor","inputBackgroundColor","ChatWindow","onProductCardClick","onAddToCartClick","handleSend","messages","setMessages","onSendMessage","input","setInput","refreshing","setRefreshing","onRefresh","response","prev","text","isUser","error","console","getMessageStyle","type","styles","messageBubble","userMessage","aiMessage","getTextStyle","messageText","color","createElement","style","container","chatWindow","behavior","OS","content","keyboardVerticalOffset","messagesContainer","contentContainerStyle","messagesContent","refreshControl","tintColor","colors","progressBackgroundColor","map","msg","i","key","messageWrapper","messageShadow","inputWrapper","inputContainer","value","onChangeText","placeholder","placeholderTextColor","multiline","inputButton","name","size","sendButton","trim","disabledButton","onPress","disabled","create","flex","position","zIndex","left","right","bottom","top","pointerEvents","borderTopWidth","borderTopColor","borderTopLeftRadius","borderTopRightRadius","overflow","padding","paddingBottom","marginBottom","maxWidth","paddingHorizontal","borderRadius","shadowColor","shadowOffset","width","height","shadowOpacity","shadowRadius","elevation","alignSelf","fontSize","lineHeight","paddingVertical","flexDirection","alignItems","margin","marginLeft","opacity"],"sourceRoot":"../../../src","sources":["layout/chatWindow.js"],"mappings":"AAAA,OAAOA,KAAK,IAAIC,QAAQ,EAAEC,WAAW,EAAEC,UAAU,QAAQ,OAAO;AAChE,SAASC,YAAY,EAAEC,IAAI,EAAEC,UAAU,EAAEC,IAAI,EAAEC,SAAS,EAAEC,UAAU,EAAEC,oBAAoB,EACtFC,QAAQ,EAAEC,gBAAgB,EAAEC,cAAc,QAAS,cAAc;AACrE,SAASC,MAAM,QAAQ,sBAAsB;AAC7C,SAASC,UAAU,QAAQ,wBAAwB;AACnD,SAASC,OAAO,QAAQ,uBAAuB;AAC/C,OAAOC,QAAQ,MAAM,oCAAoC;AAEzD,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,WAAW;IAAEC,aAAa;IAAEC,KAAK;IAAEC;EAAS,CAAC,GAAG5B,UAAU,CAAC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C;IACpBY,eAAe,EAAE,CAAC;IAClBrB,cAAc,EAAE,CAAC;IACjBC,cAAc,EAAE,oBAAoB;IACpCK,aAAa,EAAE;EACjB,CAAC;EACD7B,cAAc,EAAE;IACd6C,aAAa,EAAE,KAAK;IACpBC,UAAU,EAAE,QAAQ;IACpBd,iBAAiB,EAAE,CAAC;IACpBY,eAAe,EAAE,CAAC;IAClBhG,eAAe,EAAE,SAAS;IAC1BqF,YAAY,EAAE,EAAE;IAChBc,MAAM,EAAE,CAAC;IACTb,WAAW,EAAE,MAAM;IACnBC,YAAY,EAAE;MACZC,KAAK,EAAE,CAAC;MACRC,MAAM,EAAE;IACV,CAAC;IACDC,aAAa,EAAE,GAAG;IAClBC,YAAY,EAAE,CAAC;IACfC,SAAS,EAAE;EACb,CAAC;EACDlF,KAAK,EAAE;IACLyD,IAAI,EAAE,CAAC;IACP2B,QAAQ,EAAE,EAAE;IACZE,eAAe,EAAE,CAAC;IAClBZ,iBAAiB,EAAE,EAAE;IACrBvD,KAAK,EAAE;EACT,CAAC;EACDgC,UAAU,EAAE;IACVmB,OAAO,EAAE,CAAC;IACVoB,UAAU,EAAE;EACd,CAAC;EACDrC,cAAc,EAAE;IACdsC,OAAO,EAAE;EACX;AACF,CAAC,CAAC","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,6 +0,0 @@
1
- export function ChatWindow({ onProductCardClick, onAddToCartClick }: {
2
- onProductCardClick: any;
3
- onAddToCartClick: any;
4
- }): React.JSX.Element;
5
- import React from 'react';
6
- //# sourceMappingURL=chatWindow.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"chatWindow.d.ts","sourceRoot":"","sources":["../../../src/layout/chatWindow.js"],"names":[],"mappings":"AAeO;;;sBA0FN;kBAzGwD,OAAO"}
@@ -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
- });
@@ -1,207 +0,0 @@
1
- import React, { useState, useCallback, useContext } from 'react';
2
- import { SafeAreaView, Text, StyleSheet, View, TextInput, ScrollView, KeyboardAvoidingView,
3
- Platform, TouchableOpacity, RefreshControl, } from 'react-native';
4
- import { Header } from '../components/header';
5
- import { AppContext } from '../contexts/AppContext';
6
- import { Testing } from '../components/testing';
7
- import Ionicons from 'react-native-vector-icons/Ionicons';
8
-
9
- const theme = {
10
- primaryColor: '#003764',
11
- backgroundColor: '#f6f6f6',
12
- textColor: '#000000',
13
- inputBackgroundColor: '#f6f6f6',
14
- };
15
-
16
- export const ChatWindow = ({ onProductCardClick, onAddToCartClick }) => {
17
- const { handleSend, messages, setMessages, onSendMessage, input, setInput } = useContext(AppContext)
18
-
19
- const [refreshing, setRefreshing] = useState(false);
20
-
21
- const onRefresh = useCallback(async () => {
22
- setRefreshing(true);
23
- try {
24
- const response = await onSendMessage("Hi, I'm refreshing the chat!");
25
- setMessages((prev) => [...prev, { text: response, isUser: false }]);
26
- } catch (error) {
27
- console.error('Error refreshing chat:', error);
28
- } finally {
29
- setRefreshing(false);
30
- }
31
- }, []);
32
-
33
- const getMessageStyle = (type) => [
34
- styles.messageBubble,
35
- type === "user" ? styles.userMessage : styles.aiMessage,
36
- { backgroundColor: type === "user" ? theme.primaryColor : '#E8E8E8' },
37
- ];
38
-
39
- const getTextStyle = (type) => [
40
- styles.messageText,
41
- { color: type === "user" ? '#fff' : theme.textColor },
42
- ];
43
-
44
- return (
45
- <View style={styles.container}>
46
- <View style={styles.chatWindow}>
47
- <Header />
48
-
49
- <KeyboardAvoidingView
50
- behavior={Platform.OS === 'ios' ? 'padding' : 'height'}
51
- style={styles.content}
52
- keyboardVerticalOffset={Platform.OS === 'ios' ? 40 : 0}
53
- >
54
- <ScrollView
55
- style={styles.messagesContainer}
56
- contentContainerStyle={styles.messagesContent}
57
- refreshControl={
58
- <RefreshControl
59
- refreshing={refreshing}
60
- onRefresh={onRefresh}
61
- tintColor={theme.primaryColor}
62
- colors={[theme.primaryColor]}
63
- progressBackgroundColor="#ffffff"
64
- />
65
- }
66
- >
67
- {messages.map((msg, i) => (
68
- <View key={i} style={styles.messageWrapper}>
69
- <View style={[getMessageStyle(msg.type), styles.messageShadow]}>
70
- <Text style={getTextStyle(msg.type)}>{msg.text}</Text>
71
- </View>
72
- </View>
73
- ))}
74
- </ScrollView>
75
-
76
- <Testing
77
- onProductCardClick={onProductCardClick}
78
- onAddToCartClick={onAddToCartClick}
79
- />
80
- <View style={styles.inputWrapper}>
81
- <View style={styles.inputContainer}>
82
- <TextInput
83
- style={styles.input}
84
- value={input}
85
- onChangeText={setInput}
86
- placeholder="Ask a question..."
87
- placeholderTextColor="#999"
88
- multiline
89
- />
90
- <TouchableOpacity style={styles.inputButton}>
91
- <Ionicons name="mic-outline" size={24} color="#8E8E93" />
92
- </TouchableOpacity>
93
- <TouchableOpacity
94
- style={[styles.sendButton, !input.trim() && styles.disabledButton]}
95
- onPress={handleSend}
96
- disabled={!input.trim()}
97
- >
98
- <Ionicons name="paper-plane-outline" size={24} color={input.trim() ? theme.primaryColor : '#8E8E93'} />
99
- </TouchableOpacity>
100
- </View>
101
- </View>
102
- </KeyboardAvoidingView>
103
- </View>
104
- </View>
105
- );
106
- };
107
-
108
- const styles = StyleSheet.create({
109
- container: {
110
- flex: 1,
111
- backgroundColor: '#FFFFFF',
112
- position: 'absolute',
113
- zIndex: 1000,
114
- left: 0,
115
- right: 0,
116
- bottom: 0,
117
- top: 100,
118
- pointerEvents: 'box-none'
119
- },
120
- chatWindow: {
121
- zIndex: 1,
122
- flex: 1,
123
- borderTopWidth: 1,
124
- borderTopColor: '#DDD',
125
- borderTopLeftRadius: 16,
126
- borderTopRightRadius: 16,
127
- overflow: 'hidden',
128
- backgroundColor: theme.backgroundColor,
129
- },
130
- content: {
131
- flex: 1,
132
- },
133
- messagesContainer: {
134
- flex: 1,
135
- },
136
- messagesContent: {
137
- padding: 16,
138
- paddingBottom: 32,
139
- },
140
- messageWrapper: {
141
- marginBottom: 16,
142
- },
143
- messageBubble: {
144
- maxWidth: '90%',
145
- padding: 12,
146
- paddingHorizontal: 16,
147
- borderRadius: 20,
148
- },
149
- messageShadow: {
150
- shadowColor: '#000',
151
- shadowOffset: { width: 0, height: 1 },
152
- shadowOpacity: 0.08,
153
- shadowRadius: 2,
154
- elevation: 2,
155
- },
156
- userMessage: {
157
- alignSelf: 'flex-end',
158
- backgroundColor: theme.primaryColor,
159
- },
160
- aiMessage: {
161
- alignSelf: 'flex-start',
162
- backgroundColor: '#F2F2F7',
163
- },
164
- messageText: {
165
- fontSize: 16,
166
- lineHeight: 22,
167
- },
168
- inputWrapper: {
169
- backgroundColor: '#f6f6f6',
170
- paddingHorizontal: 8,
171
- paddingVertical: 8,
172
- borderTopWidth: 1,
173
- borderTopColor: 'rgba(0, 0, 0, 0.1)',
174
- paddingBottom: 40,
175
- },
176
- inputContainer: {
177
- flexDirection: 'row',
178
- alignItems: 'center',
179
- paddingHorizontal: 8,
180
- paddingVertical: 8,
181
- backgroundColor: '#FFFFFF',
182
- borderRadius: 16,
183
- margin: 8,
184
- shadowColor: '#000',
185
- shadowOffset: {
186
- width: 0,
187
- height: 2,
188
- },
189
- shadowOpacity: 0.1,
190
- shadowRadius: 4,
191
- elevation: 3,
192
- },
193
- input: {
194
- flex: 1,
195
- fontSize: 16,
196
- paddingVertical: 8,
197
- paddingHorizontal: 12,
198
- color: '#000000',
199
- },
200
- sendButton: {
201
- padding: 6,
202
- marginLeft: 'auto',
203
- },
204
- disabledButton: {
205
- opacity: 0.7,
206
- },
207
- });