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.
Files changed (61) hide show
  1. package/README.md +10 -1
  2. package/lib/commonjs/components/header.js +11 -7
  3. package/lib/commonjs/components/header.js.map +1 -1
  4. package/lib/commonjs/components/productCard.js +9 -6
  5. package/lib/commonjs/components/productCard.js.map +1 -1
  6. package/lib/commonjs/components/welcomeButton.js +25 -6
  7. package/lib/commonjs/components/welcomeButton.js.map +1 -1
  8. package/lib/commonjs/contexts/AppContext.js +39 -13
  9. package/lib/commonjs/contexts/AppContext.js.map +1 -1
  10. package/lib/commonjs/hooks/Stream.js +1 -0
  11. package/lib/commonjs/hooks/Stream.js.map +1 -1
  12. package/lib/commonjs/layout/disclaimer.js +1 -1
  13. package/lib/commonjs/layout/disclaimer.js.map +1 -1
  14. package/lib/commonjs/layout/ex.js +2 -2
  15. package/lib/commonjs/layout/welcome.js +17 -9
  16. package/lib/commonjs/layout/welcome.js.map +1 -1
  17. package/lib/commonjs/layout/window.js +15 -8
  18. package/lib/commonjs/layout/window.js.map +1 -1
  19. package/lib/commonjs/utils/cloudinary.js +13 -5
  20. package/lib/commonjs/utils/cloudinary.js.map +1 -1
  21. package/lib/commonjs/utils/storage.js +1 -1
  22. package/lib/module/components/header.js +11 -7
  23. package/lib/module/components/header.js.map +1 -1
  24. package/lib/module/components/productCard.js +9 -6
  25. package/lib/module/components/productCard.js.map +1 -1
  26. package/lib/module/components/welcomeButton.js +25 -6
  27. package/lib/module/components/welcomeButton.js.map +1 -1
  28. package/lib/module/contexts/AppContext.js +39 -13
  29. package/lib/module/contexts/AppContext.js.map +1 -1
  30. package/lib/module/hooks/Stream.js +1 -0
  31. package/lib/module/hooks/Stream.js.map +1 -1
  32. package/lib/module/layout/disclaimer.js +1 -1
  33. package/lib/module/layout/disclaimer.js.map +1 -1
  34. package/lib/module/layout/ex.js +2 -2
  35. package/lib/module/layout/welcome.js +17 -9
  36. package/lib/module/layout/welcome.js.map +1 -1
  37. package/lib/module/layout/window.js +15 -8
  38. package/lib/module/layout/window.js.map +1 -1
  39. package/lib/module/utils/cloudinary.js +11 -4
  40. package/lib/module/utils/cloudinary.js.map +1 -1
  41. package/lib/module/utils/storage.js +1 -1
  42. package/lib/typescript/components/header.d.ts.map +1 -1
  43. package/lib/typescript/components/productCard.d.ts.map +1 -1
  44. package/lib/typescript/components/welcomeButton.d.ts.map +1 -1
  45. package/lib/typescript/contexts/AppContext.d.ts.map +1 -1
  46. package/lib/typescript/hooks/Stream.d.ts.map +1 -1
  47. package/lib/typescript/layout/welcome.d.ts.map +1 -1
  48. package/lib/typescript/layout/window.d.ts.map +1 -1
  49. package/lib/typescript/utils/cloudinary.d.ts.map +1 -1
  50. package/package.json +1 -1
  51. package/src/components/header.js +7 -10
  52. package/src/components/productCard.js +9 -5
  53. package/src/components/welcomeButton.js +16 -6
  54. package/src/contexts/AppContext.js +44 -15
  55. package/src/hooks/Stream.js +1 -0
  56. package/src/layout/disclaimer.js +1 -1
  57. package/src/layout/ex.js +2 -2
  58. package/src/layout/welcome.js +9 -12
  59. package/src/layout/window.js +12 -9
  60. package/src/utils/cloudinary.js +7 -4
  61. package/src/utils/storage.ts +1 -1
@@ -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 key={index} style={styles.suggestedQuestionButton}
153
- onPress={() => handleButtonClick(question)}>
154
- <Text style={styles.suggestedQuestionText}>{question}</Text>
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: "#003764",
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: "#004687",
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: "#004687",
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: '#e0f4fc', //'#e0f4fc',
325
+ backgroundColor: '#e7decd', //'#e0f4fc',
323
326
  width: '100%',
324
327
  },
325
328
  middleMessageText: {
@@ -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: 'heritageplus'
12
+ cloudName: brandCloudName || 'mktg'
11
13
  }
12
14
  });
13
15
 
14
- const myImage = Platform.OS === 'ios' ? cld.image(`mobileapp/${cldImg}`) : cld.image(`mobileapp/${cldImg}`).format('png');
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: 'heritageplus'
40
+ cloudName: brandCloudName || 'mktg'
38
41
  }
39
42
  });
40
43
  const myImage = cld.image(`${cldImg}`);
@@ -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 Pool+ 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?"
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,