react-native-srschat 0.1.67 → 0.1.69
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 +10 -1
- package/lib/commonjs/components/header.js +11 -7
- package/lib/commonjs/components/header.js.map +1 -1
- package/lib/commonjs/components/productCard.js +9 -6
- package/lib/commonjs/components/productCard.js.map +1 -1
- package/lib/commonjs/components/welcomeButton.js +25 -6
- package/lib/commonjs/components/welcomeButton.js.map +1 -1
- package/lib/commonjs/contexts/AppContext.js +39 -13
- package/lib/commonjs/contexts/AppContext.js.map +1 -1
- package/lib/commonjs/hooks/Stream.js +1 -0
- package/lib/commonjs/hooks/Stream.js.map +1 -1
- package/lib/commonjs/layout/disclaimer.js +1 -1
- package/lib/commonjs/layout/disclaimer.js.map +1 -1
- package/lib/commonjs/layout/ex.js +2 -2
- package/lib/commonjs/layout/welcome.js +17 -9
- package/lib/commonjs/layout/welcome.js.map +1 -1
- package/lib/commonjs/layout/window.js +15 -8
- package/lib/commonjs/layout/window.js.map +1 -1
- package/lib/commonjs/utils/cloudinary.js +13 -5
- package/lib/commonjs/utils/cloudinary.js.map +1 -1
- package/lib/commonjs/utils/storage.js +1 -1
- package/lib/module/components/header.js +11 -7
- package/lib/module/components/header.js.map +1 -1
- package/lib/module/components/productCard.js +9 -6
- package/lib/module/components/productCard.js.map +1 -1
- package/lib/module/components/welcomeButton.js +25 -6
- package/lib/module/components/welcomeButton.js.map +1 -1
- package/lib/module/contexts/AppContext.js +39 -13
- package/lib/module/contexts/AppContext.js.map +1 -1
- package/lib/module/hooks/Stream.js +1 -0
- package/lib/module/hooks/Stream.js.map +1 -1
- package/lib/module/layout/disclaimer.js +1 -1
- package/lib/module/layout/disclaimer.js.map +1 -1
- package/lib/module/layout/ex.js +2 -2
- package/lib/module/layout/welcome.js +17 -9
- package/lib/module/layout/welcome.js.map +1 -1
- package/lib/module/layout/window.js +15 -8
- package/lib/module/layout/window.js.map +1 -1
- package/lib/module/utils/cloudinary.js +11 -4
- package/lib/module/utils/cloudinary.js.map +1 -1
- package/lib/module/utils/storage.js +1 -1
- package/lib/typescript/components/header.d.ts.map +1 -1
- package/lib/typescript/components/productCard.d.ts.map +1 -1
- package/lib/typescript/components/welcomeButton.d.ts.map +1 -1
- package/lib/typescript/contexts/AppContext.d.ts.map +1 -1
- package/lib/typescript/hooks/Stream.d.ts.map +1 -1
- package/lib/typescript/layout/welcome.d.ts.map +1 -1
- package/lib/typescript/layout/window.d.ts.map +1 -1
- package/lib/typescript/utils/cloudinary.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/components/header.js +7 -10
- package/src/components/productCard.js +9 -5
- package/src/components/welcomeButton.js +16 -6
- package/src/contexts/AppContext.js +44 -15
- package/src/hooks/Stream.js +1 -0
- package/src/layout/disclaimer.js +1 -1
- package/src/layout/ex.js +2 -2
- package/src/layout/welcome.js +9 -12
- package/src/layout/window.js +12 -9
- package/src/utils/cloudinary.js +7 -4
- package/src/utils/storage.ts +1 -1
package/src/layout/window.js
CHANGED
|
@@ -15,7 +15,7 @@ import { ProgressCircle } from '../components/progressCircle';
|
|
|
15
15
|
|
|
16
16
|
export const ChatWindow = ({ panHandlers }) => {
|
|
17
17
|
const { handleSend, messages, input, setInput, ghostMessage, handleButtonClick,
|
|
18
|
-
onProductCardClick, onAddToCartClick, uiConfig, ghostCard, typingIndicator, feedbackOpen, setFeedbackOpen
|
|
18
|
+
onProductCardClick, onAddToCartClick, uiConfig, ghostCard, typingIndicator, feedbackOpen, setFeedbackOpen, theme
|
|
19
19
|
} = useContext(AppContext);
|
|
20
20
|
|
|
21
21
|
const scrollViewRef = useRef(null);
|
|
@@ -106,7 +106,7 @@ export const ChatWindow = ({ panHandlers }) => {
|
|
|
106
106
|
|
|
107
107
|
<View key={msg.id || msg.message_id || i} style={styles.messageWrapper}>
|
|
108
108
|
{msg.type !== "middle" && (
|
|
109
|
-
<View style={[ styles.messageBubble, msg.type === "user" ? styles.userMessage : styles.aiMessage,]}>
|
|
109
|
+
<View style={[ styles.messageBubble, msg.type === "user" ? [styles.userMessage, { backgroundColor: theme.userMessage }] : styles.aiMessage,]}>
|
|
110
110
|
|
|
111
111
|
<Markdown style={{ body: { color: msg.type === "user" ? "#ffffff" : "#161616",fontSize: 16, lineHeight: 22, includeFontPadding: false, textAlignVertical: 'center' }}}>
|
|
112
112
|
{typeof msg.text === 'string' ? msg.text : String(msg.text || '')}
|
|
@@ -149,9 +149,12 @@ export const ChatWindow = ({ panHandlers }) => {
|
|
|
149
149
|
|
|
150
150
|
{msg.suggested_questions && Array.isArray(msg.questions) && msg.questions.length > 0 &&
|
|
151
151
|
msg.questions.map((question, index) => (
|
|
152
|
-
<TouchableOpacity
|
|
153
|
-
|
|
154
|
-
|
|
152
|
+
<TouchableOpacity
|
|
153
|
+
key={index}
|
|
154
|
+
style={[styles.suggestedQuestionButton, { borderColor: theme.primaryColor }]}
|
|
155
|
+
onPress={() => handleButtonClick(question)}
|
|
156
|
+
>
|
|
157
|
+
<Text style={[styles.suggestedQuestionText, { color: theme.primaryColor }]}>{question}</Text>
|
|
155
158
|
</TouchableOpacity>
|
|
156
159
|
))}
|
|
157
160
|
|
|
@@ -218,7 +221,7 @@ const styles = StyleSheet.create({
|
|
|
218
221
|
},
|
|
219
222
|
userMessage: {
|
|
220
223
|
alignSelf: 'flex-end',
|
|
221
|
-
backgroundColor: "#
|
|
224
|
+
backgroundColor: "#437D3D",
|
|
222
225
|
color: "#ffffff",
|
|
223
226
|
borderTopRightRadius: 0,
|
|
224
227
|
},
|
|
@@ -233,7 +236,7 @@ const styles = StyleSheet.create({
|
|
|
233
236
|
suggestedQuestionButton: {
|
|
234
237
|
backgroundColor: "white",
|
|
235
238
|
borderWidth: 1,
|
|
236
|
-
borderColor: "#
|
|
239
|
+
borderColor: "#437D3D",
|
|
237
240
|
borderRadius: 18,
|
|
238
241
|
paddingVertical: 10,
|
|
239
242
|
paddingHorizontal: 16,
|
|
@@ -241,7 +244,7 @@ const styles = StyleSheet.create({
|
|
|
241
244
|
alignSelf: "flex-start",
|
|
242
245
|
},
|
|
243
246
|
suggestedQuestionText: {
|
|
244
|
-
color: "#
|
|
247
|
+
color: "#437D3D",
|
|
245
248
|
fontSize: 13,
|
|
246
249
|
textAlign: "left",
|
|
247
250
|
includeFontPadding: false,
|
|
@@ -319,7 +322,7 @@ const styles = StyleSheet.create({
|
|
|
319
322
|
middleMessage:{
|
|
320
323
|
color: '#161616',
|
|
321
324
|
alignSelf: 'flex-start',
|
|
322
|
-
backgroundColor: '#
|
|
325
|
+
backgroundColor: '#e7decd', //'#e0f4fc',
|
|
323
326
|
width: '100%',
|
|
324
327
|
},
|
|
325
328
|
middleMessageText: {
|
package/src/utils/cloudinary.js
CHANGED
|
@@ -1,17 +1,19 @@
|
|
|
1
|
-
import React from 'react';
|
|
1
|
+
import React, { useContext } from 'react';
|
|
2
2
|
import { Cloudinary } from '@cloudinary/url-gen';
|
|
3
3
|
import { Platform, View } from 'react-native';
|
|
4
4
|
import { AdvancedImage } from 'cloudinary-react-native';
|
|
5
5
|
import { scale } from '@cloudinary/url-gen/actions/resize';
|
|
6
|
+
import { AppContext } from '../contexts/AppContext';
|
|
6
7
|
|
|
7
8
|
const CloudinaryImage = ({ cldImg, imageStyle, accessibilityLabel, testID }) => {
|
|
9
|
+
const { brandCloudName } = useContext(AppContext);
|
|
8
10
|
const cld = new Cloudinary({
|
|
9
11
|
cloud: {
|
|
10
|
-
cloudName: '
|
|
12
|
+
cloudName: brandCloudName || 'mktg'
|
|
11
13
|
}
|
|
12
14
|
});
|
|
13
15
|
|
|
14
|
-
const myImage = Platform.OS === 'ios' ? cld.image(
|
|
16
|
+
const myImage = Platform.OS === 'ios' ? cld.image(`${cldImg}`) : cld.image(`${cldImg}`).format('png');
|
|
15
17
|
return (
|
|
16
18
|
<View>
|
|
17
19
|
<AdvancedImage
|
|
@@ -32,9 +34,10 @@ export const CloudinaryBannerImage = ({
|
|
|
32
34
|
width = 345,
|
|
33
35
|
height = 100
|
|
34
36
|
}) => {
|
|
37
|
+
const { brandCloudName } = useContext(AppContext);
|
|
35
38
|
const cld = new Cloudinary({
|
|
36
39
|
cloud: {
|
|
37
|
-
cloudName: '
|
|
40
|
+
cloudName: brandCloudName || 'mktg'
|
|
38
41
|
}
|
|
39
42
|
});
|
|
40
43
|
const myImage = cld.image(`${cldImg}`);
|
package/src/utils/storage.ts
CHANGED
|
@@ -33,7 +33,7 @@ export const defaultState: ChatState = {
|
|
|
33
33
|
startStreaming: false,
|
|
34
34
|
messages: [{
|
|
35
35
|
type: "ai",
|
|
36
|
-
text: "Hi there 👋 Hi there 👋 I'm your Heritage
|
|
36
|
+
text: "Hi there 👋 Hi there 👋 I'm your Heritage+ AI Assistant. I'm here to help you with Product and Account information during your online visit. I'm still learning and growing - the more we interact and the more feedback you share, the better I can assist you. How can I help you today?"
|
|
37
37
|
}],
|
|
38
38
|
showIcon: true,
|
|
39
39
|
toggleChat: false,
|