react-native-srschat 0.1.81 → 0.1.85

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 (59) hide show
  1. package/lib/commonjs/components/email.js +4 -8
  2. package/lib/commonjs/components/email.js.map +1 -1
  3. package/lib/commonjs/components/productCard.js +91 -86
  4. package/lib/commonjs/components/productCard.js.map +1 -1
  5. package/lib/commonjs/components/welcomeButton.js +4 -4
  6. package/lib/commonjs/components/welcomeButton.js.map +1 -1
  7. package/lib/commonjs/contexts/AppContext.js +46 -45
  8. package/lib/commonjs/contexts/AppContext.js.map +1 -1
  9. package/lib/commonjs/hooks/Stream.js +399 -74
  10. package/lib/commonjs/hooks/Stream.js.map +1 -1
  11. package/lib/commonjs/layout/disclaimer.js +36 -32
  12. package/lib/commonjs/layout/disclaimer.js.map +1 -1
  13. package/lib/commonjs/layout/welcome.js +8 -7
  14. package/lib/commonjs/layout/welcome.js.map +1 -1
  15. package/lib/commonjs/layout/window.js +152 -131
  16. package/lib/commonjs/layout/window.js.map +1 -1
  17. package/lib/commonjs/utils/audioRecorder.js.map +1 -1
  18. package/lib/commonjs/utils/storage.js +1 -1
  19. package/lib/module/components/email.js +4 -8
  20. package/lib/module/components/email.js.map +1 -1
  21. package/lib/module/components/productCard.js +94 -89
  22. package/lib/module/components/productCard.js.map +1 -1
  23. package/lib/module/components/welcomeButton.js +4 -4
  24. package/lib/module/components/welcomeButton.js.map +1 -1
  25. package/lib/module/contexts/AppContext.js +47 -46
  26. package/lib/module/contexts/AppContext.js.map +1 -1
  27. package/lib/module/hooks/Stream.js +400 -75
  28. package/lib/module/hooks/Stream.js.map +1 -1
  29. package/lib/module/layout/disclaimer.js +41 -37
  30. package/lib/module/layout/disclaimer.js.map +1 -1
  31. package/lib/module/layout/welcome.js +8 -7
  32. package/lib/module/layout/welcome.js.map +1 -1
  33. package/lib/module/layout/window.js +152 -131
  34. package/lib/module/layout/window.js.map +1 -1
  35. package/lib/module/utils/audioRecorder.js.map +1 -1
  36. package/lib/module/utils/storage.js +1 -1
  37. package/lib/typescript/components/email.d.ts.map +1 -1
  38. package/lib/typescript/components/productCard.d.ts +1 -1
  39. package/lib/typescript/components/productCard.d.ts.map +1 -1
  40. package/lib/typescript/components/welcomeButton.d.ts.map +1 -1
  41. package/lib/typescript/contexts/AppContext.d.ts +2 -2
  42. package/lib/typescript/contexts/AppContext.d.ts.map +1 -1
  43. package/lib/typescript/hooks/Stream.d.ts.map +1 -1
  44. package/lib/typescript/layout/disclaimer.d.ts +1 -1
  45. package/lib/typescript/layout/disclaimer.d.ts.map +1 -1
  46. package/lib/typescript/layout/welcome.d.ts.map +1 -1
  47. package/lib/typescript/layout/window.d.ts.map +1 -1
  48. package/lib/typescript/utils/audioRecorder.d.ts.map +1 -1
  49. package/package.json +2 -1
  50. package/src/components/email.js +3 -15
  51. package/src/components/productCard.js +279 -203
  52. package/src/components/welcomeButton.js +10 -10
  53. package/src/contexts/AppContext.js +185 -106
  54. package/src/hooks/Stream.js +607 -237
  55. package/src/layout/disclaimer.js +125 -78
  56. package/src/layout/welcome.js +58 -20
  57. package/src/layout/window.js +279 -140
  58. package/src/utils/audioRecorder.js +40 -34
  59. package/src/utils/storage.ts +2 -2
@@ -1,82 +1,129 @@
1
- import React, { useContext } from "react";
2
- import { View, Text, ScrollView, StyleSheet, TouchableOpacity } from "react-native";
3
- import { AppContext } from "../contexts/AppContext";
4
- import Feather from "react-native-vector-icons/Feather";
1
+ import React, { useContext } from 'react';
2
+ import {
3
+ View,
4
+ Text,
5
+ ScrollView,
6
+ StyleSheet,
7
+ TouchableOpacity,
8
+ } from 'react-native';
9
+ import { AppContext } from '../contexts/AppContext';
10
+ import Feather from 'react-native-vector-icons/Feather';
5
11
  import { Header } from '../components/header';
6
- import { Testing } from "../components/testing";
12
+ import { Testing } from '../components/testing';
7
13
 
8
14
  export const Disclaimer = ({ panHandlers }) => {
9
- const { setShowModal, confirmDisclaimer, uiConfig, onAddToCartClick, onProductCardClick, theme } = useContext(AppContext);
15
+ const {
16
+ version,
17
+ setShowModal,
18
+ confirmDisclaimer,
19
+ uiConfig,
20
+ onAddToCartClick,
21
+ onProductCardClick,
22
+ theme,
23
+ } = useContext(AppContext);
10
24
 
11
25
  const sections = [
12
26
  {
13
- title: "General Information",
14
- details: "The AI agent is an automated system powered by Instalily. It is designed to provide information and assistance based on HeritagePool+ Suppliers and documentation in product brand manuals. While we strive to provide accurate information through the AI agent, we cannot guarantee the accuracy, completeness, or up-to-date nature of the information provided. We recommend that you use responses as a starting point and verify the information in the linked public documentation sources.",
15
- icon: "file-text"
27
+ title: 'General Information',
28
+ details:
29
+ 'The AI agent is an automated system powered by Instalily. It is designed to provide information and assistance based on HeritagePool+ Suppliers and documentation in product brand manuals. While we strive to provide accurate information through the AI agent, we cannot guarantee the accuracy, completeness, or up-to-date nature of the information provided. We recommend that you use responses as a starting point and verify the information in the linked public documentation sources.',
30
+ icon: 'file-text',
16
31
  },
17
32
  {
18
- title: "User Responsibility",
19
- details: "Users of the AI agent bear sole responsibility for their interactions and reliance on the information provided. It is important to exercise caution and use your discretion while interpreting and acting upon the agent's responses. We cannot be held liable for any actions, losses, or damages resulting from the use of the agent.",
20
- icon: "thumbs-up"
33
+ title: 'User Responsibility',
34
+ details:
35
+ "Users of the AI agent bear sole responsibility for their interactions and reliance on the information provided. It is important to exercise caution and use your discretion while interpreting and acting upon the agent's responses. We cannot be held liable for any actions, losses, or damages resulting from the use of the agent.",
36
+ icon: 'thumbs-up',
21
37
  },
22
38
  {
23
- title: "Data Privacy and Security",
24
- details: "We prioritize the privacy and security of our users' information. Be aware that agent conversations are recorded and stored for later review and quality monitoring by SRS Distribution and its contractors, including by SRS’ content team to improve results. While SRS and the vendor retain logs of these conversations, this data is not used to train their AI models.",
25
- icon: "lock"
26
- }
39
+ title: 'Data Privacy and Security',
40
+ details:
41
+ "We prioritize the privacy and security of our users' information. Be aware that agent conversations are recorded and stored for later review and quality monitoring by SRS Distribution and its contractors, including by SRS’ content team to improve results. While SRS and the vendor retain logs of these conversations, this data is not used to train their AI models.",
42
+ icon: 'lock',
43
+ },
27
44
  ];
28
45
 
29
46
  return (
30
- <View style={styles.container}>
31
- <View>
32
- <Header />
33
- </View>
34
- <ScrollView contentContainerStyle={styles.scrollContainer}>
35
- <View style={styles.header}>
36
- <Text style={styles.welcomeTitle}>Welcome to your AI Agent</Text>
37
- <View style={styles.betaTag}>
38
- <Text style={styles.betaText}>BETA</Text>
39
- </View>
47
+ <View style={styles.container}>
48
+ <View>
49
+ <Header />
50
+ </View>
51
+ <ScrollView contentContainerStyle={styles.scrollContainer}>
52
+ <View style={styles.header}>
53
+ <Text style={styles.welcomeTitle}>Welcome to your AI Agent</Text>
54
+ <View style={styles.betaTag}>
55
+ <Text style={styles.betaText}>BETA</Text>
40
56
  </View>
57
+ </View>
41
58
 
42
- <Text style={styles.disclaimerText}>
43
- The following disclaimer is intended to inform users of the limitations and usage guidelines of the AI agent.
44
- </Text>
45
- <Text style={styles.disclaimerText}>
46
- Please read this disclaimer carefully before engaging with the agent.
47
- </Text>
59
+ <Text style={styles.disclaimerText}>
60
+ The following disclaimer is intended to inform users of the
61
+ limitations and usage guidelines of the AI agent.
62
+ </Text>
63
+ <Text style={styles.disclaimerText}>
64
+ Please read this disclaimer carefully before engaging with the agent.
65
+ </Text>
48
66
 
49
- {sections.map((section, index) => (
50
- <Paragraph key={index} title={section.title} details={section.details} icon={section.icon} theme={theme} />
51
- ))}
67
+ {sections.map((section, index) => (
68
+ <Paragraph
69
+ key={index}
70
+ title={section.title}
71
+ details={section.details}
72
+ icon={section.icon}
73
+ theme={theme}
74
+ />
75
+ ))}
52
76
 
53
- <Text style={styles.disclaimerText}>
54
- Do not share any sensitive or personal information in your conversations.
55
- </Text>
56
- <Text style={styles.disclaimerText}>
57
- By using our AI agent, you indicate your acceptance and understanding of the above disclaimer. If you do not agree with any part of this disclaimer, we recommend refraining from using the agent. For further assistance or inquiries, please contact <Text style={styles.boldText}>srs@instalily.ai</Text>.
58
- </Text>
59
- </ScrollView>
60
- {uiConfig.testButtons &&
61
- <Testing onProductCardClick={onProductCardClick} onAddToCartClick={onAddToCartClick} />
62
- }
63
- <View style={styles.confirmArea}>
64
- <TouchableOpacity style={[styles.button, { backgroundColor: theme.primaryColor }]} onPress={confirmDisclaimer}>
65
- <Text style={styles.buttonText}>Confirm</Text>
66
- </TouchableOpacity>
67
- <Text style={styles.confirmText}>
68
- By clicking the "Confirm" button above, you understand and confirm that your use of Heritage Pool+ AI Agent is subject to our current Terms of Service and Privacy Policy, and you confirm your understanding of the above.
69
- </Text>
70
- </View>
77
+ <Text style={styles.disclaimerText}>
78
+ Do not share any sensitive or personal information in your
79
+ conversations.
80
+ </Text>
81
+ <Text style={styles.disclaimerText}>
82
+ By using our AI agent, you indicate your acceptance and understanding
83
+ of the above disclaimer. If you do not agree with any part of this
84
+ disclaimer, we recommend refraining from using the agent. For further
85
+ assistance or inquiries, please contact{' '}
86
+ <Text style={styles.boldText}>srs@instalily.ai</Text>.
87
+ </Text>
88
+ </ScrollView>
89
+ {uiConfig.testButtons && (
90
+ <Testing
91
+ onProductCardClick={onProductCardClick}
92
+ onAddToCartClick={onAddToCartClick}
93
+ />
94
+ )}
95
+ <View style={styles.confirmArea}>
96
+ <TouchableOpacity
97
+ style={[styles.button, { backgroundColor: theme.primaryColor }]}
98
+ onPress={confirmDisclaimer}>
99
+ <Text style={styles.buttonText}>Confirm</Text>
100
+ </TouchableOpacity>
101
+ <Text style={styles.confirmText}>
102
+ {`By clicking the "Confirm" button above, you understand and confirm
103
+ that your use of ${
104
+ version === 'pool' ? 'HeritagePool+' : 'Heritage+'
105
+ } AI Agent is subject to our current Terms of
106
+ Service and Privacy Policy, and you confirm your understanding of the
107
+ above.`}
108
+ </Text>
71
109
  </View>
110
+ </View>
72
111
  );
73
112
  };
74
113
 
75
114
  const Paragraph = ({ title, details, icon, theme }) => {
76
115
  return (
77
116
  <View style={styles.sectionContainer}>
78
- <View style={[styles.iconContainer, { backgroundColor: `${theme.primaryColor}20` }]}>
79
- <Feather name={icon} size={18} color={theme?.primaryColor || '#1976d2'} />
117
+ <View
118
+ style={[
119
+ styles.iconContainer,
120
+ { backgroundColor: `${theme.primaryColor}20` },
121
+ ]}>
122
+ <Feather
123
+ name={icon}
124
+ size={18}
125
+ color={theme?.primaryColor || '#1976d2'}
126
+ />
80
127
  </View>
81
128
  <View style={styles.textContainer}>
82
129
  <Text style={styles.sectionTitle}>{title}</Text>
@@ -95,40 +142,40 @@ const styles = StyleSheet.create({
95
142
  padding: 20,
96
143
  },
97
144
  header: {
98
- flexDirection: "row",
99
- alignItems: "center",
145
+ flexDirection: 'row',
146
+ alignItems: 'center',
100
147
  marginBottom: 10,
101
148
  },
102
149
  welcomeTitle: {
103
150
  fontSize: 18,
104
- fontWeight: "500",
105
- color: "#161616",
151
+ fontWeight: '500',
152
+ color: '#161616',
106
153
  },
107
154
  betaTag: {
108
- backgroundColor: "#f6921e",
155
+ backgroundColor: '#f6921e',
109
156
  borderRadius: 8,
110
157
  paddingHorizontal: 10,
111
158
  paddingVertical: 4,
112
159
  marginLeft: 10,
113
160
  },
114
161
  betaText: {
115
- color: "#ffffff",
162
+ color: '#ffffff',
116
163
  fontSize: 11,
117
- fontWeight: "500",
164
+ fontWeight: '500',
118
165
  },
119
166
  disclaimerText: {
120
167
  fontSize: 13,
121
- color: "#505050",
168
+ color: '#505050',
122
169
  lineHeight: 18,
123
170
  marginBottom: 8,
124
171
  },
125
172
  boldText: {
126
- fontWeight: "bold",
173
+ fontWeight: 'bold',
127
174
  },
128
175
  sectionContainer: {
129
- flexDirection: "row",
130
- alignItems: "flex-start",
131
- backgroundColor: "#fff",
176
+ flexDirection: 'row',
177
+ alignItems: 'flex-start',
178
+ backgroundColor: '#fff',
132
179
  padding: 12,
133
180
  marginBottom: 10,
134
181
  borderRadius: 10,
@@ -137,8 +184,8 @@ const styles = StyleSheet.create({
137
184
  iconContainer: {
138
185
  borderRadius: 10,
139
186
  padding: 10,
140
- alignItems: "center",
141
- justifyContent: "center",
187
+ alignItems: 'center',
188
+ justifyContent: 'center',
142
189
  marginRight: 10,
143
190
  },
144
191
  textContainer: {
@@ -146,17 +193,17 @@ const styles = StyleSheet.create({
146
193
  },
147
194
  sectionTitle: {
148
195
  fontSize: 14,
149
- fontWeight: "500",
150
- color: "#161616",
196
+ fontWeight: '500',
197
+ color: '#161616',
151
198
  marginBottom: 3,
152
199
  },
153
200
  sectionDetails: {
154
201
  fontSize: 12,
155
- color: "#505050",
202
+ color: '#505050',
156
203
  lineHeight: 18,
157
204
  },
158
205
  confirmArea: {
159
- alignItems: "center",
206
+ alignItems: 'center',
160
207
  padding: 20,
161
208
  backgroundColor: '#f6f6f6',
162
209
  borderTopWidth: 1,
@@ -164,20 +211,20 @@ const styles = StyleSheet.create({
164
211
  paddingBottom: 25,
165
212
  },
166
213
  button: {
167
- width: "100%",
214
+ width: '100%',
168
215
  paddingVertical: 12,
169
216
  borderRadius: 5,
170
- alignItems: "center",
217
+ alignItems: 'center',
171
218
  marginBottom: 10,
172
219
  },
173
220
  buttonText: {
174
- color: "#FFFFFF",
221
+ color: '#FFFFFF',
175
222
  fontSize: 16,
176
- fontWeight: "500",
223
+ fontWeight: '500',
177
224
  },
178
225
  confirmText: {
179
226
  fontSize: 11,
180
- color: "gray",
227
+ color: 'gray',
181
228
  lineHeight: 16,
182
229
  paddingHorizontal: 10,
183
230
  },
@@ -1,6 +1,12 @@
1
1
  // Welcome.js
2
2
  import React, { useContext } from 'react';
3
- import { View, Text, TouchableOpacity, ScrollView, StyleSheet } from 'react-native';
3
+ import {
4
+ View,
5
+ Text,
6
+ TouchableOpacity,
7
+ ScrollView,
8
+ StyleSheet,
9
+ } from 'react-native';
4
10
  import Ionicons from 'react-native-vector-icons/Ionicons';
5
11
  import { AppContext } from '../contexts/AppContext';
6
12
  import { WelcomeInput } from '../components/welcomeInput';
@@ -8,15 +14,24 @@ import ButtonComponent from '../components/welcomeButton';
8
14
  import CloudinaryImage from '../utils/cloudinary';
9
15
 
10
16
  export const Welcome = ({ panHandlers }) => {
11
- const { setShowModal, uiConfig, onProductCardClick, onAddToCartClick, data, theme, brandLogo } = useContext(AppContext);
17
+ const {
18
+ setShowModal,
19
+ uiConfig,
20
+ onProductCardClick,
21
+ onAddToCartClick,
22
+ data,
23
+ theme,
24
+ brandLogo,
25
+ version,
26
+ } = useContext(AppContext);
12
27
 
13
28
  const handleClick = () => {
14
29
  if ((uiConfig.showIcon ?? true) !== true) {
15
- setShowModal("Off");
30
+ setShowModal('Off');
16
31
  } else {
17
- setShowModal("Icon");
32
+ setShowModal('Icon');
18
33
  }
19
-
34
+
20
35
  if (typeof uiConfig.setToggleChat === 'function') {
21
36
  uiConfig.setToggleChat(false);
22
37
  }
@@ -24,26 +39,49 @@ export const Welcome = ({ panHandlers }) => {
24
39
 
25
40
  return (
26
41
  <View style={styles.container}>
27
- <View style={[styles.parentContainer, { backgroundColor: theme.primaryColor }]}>
42
+ <View
43
+ style={[
44
+ styles.parentContainer,
45
+ { backgroundColor: theme.primaryColor },
46
+ ]}>
28
47
  {/* Top section */}
29
- <View style={[styles.topContainer, { backgroundColor: theme.primaryColor }]}>
48
+ <View
49
+ style={[
50
+ styles.topContainer,
51
+ { backgroundColor: theme.primaryColor },
52
+ ]}>
30
53
  <View style={styles.topHeader}>
31
54
  {/* Logo container with absolute positioning */}
32
55
  <View style={styles.logoContainer}>
33
- <CloudinaryImage cldImg={brandLogo} imageStyle={{ width: 150, height: 35 }} />
56
+ <CloudinaryImage
57
+ cldImg={brandLogo}
58
+ imageStyle={{ width: 150, height: 35 }}
59
+ />
34
60
  </View>
35
- <TouchableOpacity onPress={handleClick} style={styles.collapseButton}>
61
+ <TouchableOpacity
62
+ onPress={handleClick}
63
+ style={styles.collapseButton}>
36
64
  <Ionicons name="close" size={26} color="white" />
37
65
  </TouchableOpacity>
38
66
  </View>
39
-
40
- <View style={[styles.blueContainer, { backgroundColor: theme.primaryColor }]}>
41
- <Text style={styles.welcomeHeader}>Hi {data?.customer_name || ""} šŸ‘‹</Text>
67
+
68
+ <View
69
+ style={[
70
+ styles.blueContainer,
71
+ { backgroundColor: theme.primaryColor },
72
+ ]}>
73
+ <Text style={styles.welcomeHeader}>
74
+ Hi {data?.customer_name || ''} šŸ‘‹
75
+ </Text>
42
76
  <Text style={styles.welcomeBody2}>
43
- I’m your Heritage Pool+ AI Agent. I can help you during your online visit with Product and Account information.
77
+ {`I’m your ${
78
+ version === 'pool' ? 'HeritagePool+' : 'Heritage+'
79
+ } AI Agent. I can help you during your online visit with Product and Account information.`}
44
80
  </Text>
45
81
  <WelcomeInput />
46
- <Text style={styles.textBeta}>Beta version. AI Assistant is still learning!</Text>
82
+ <Text style={styles.textBeta}>
83
+ Beta version. AI Assistant is still learning!
84
+ </Text>
47
85
  </View>
48
86
  </View>
49
87
 
@@ -68,7 +106,7 @@ const styles = StyleSheet.create({
68
106
  },
69
107
  topContainer: {
70
108
  backgroundColor: '#437D3D',
71
- paddingBottom: 5,
109
+ paddingBottom: 5,
72
110
  },
73
111
  topHeader: {
74
112
  flexDirection: 'row',
@@ -76,15 +114,15 @@ const styles = StyleSheet.create({
76
114
  paddingHorizontal: 15,
77
115
  paddingTop: 10,
78
116
  justifyContent: 'flex-end',
79
- position: 'relative',
117
+ position: 'relative',
80
118
  },
81
119
  logoContainer: {
82
120
  position: 'absolute',
83
- left: 15,
121
+ left: 15,
84
122
  top: 10,
85
123
  // left: '50%',
86
124
  // transform: [{ translateX: -65 }],
87
- // top: 10,
125
+ // top: 10,
88
126
  },
89
127
  collapseButton: {
90
128
  paddingHorizontal: 15,
@@ -111,7 +149,7 @@ const styles = StyleSheet.create({
111
149
  marginBottom: 15,
112
150
  },
113
151
  textBeta: {
114
- textAlign: 'center',
152
+ textAlign: 'center',
115
153
  fontSize: 11,
116
154
  color: '#f6f6f6',
117
155
  fontWeight: '400',
@@ -119,7 +157,7 @@ const styles = StyleSheet.create({
119
157
  },
120
158
  bottomContainer: {
121
159
  paddingHorizontal: 25,
122
- backgroundColor: "#f6f6f6",
160
+ backgroundColor: '#f6f6f6',
123
161
  paddingTop: 30,
124
162
  },
125
163
  welcomeBody: {