react-native-srschat 0.1.83 ā 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.
- package/lib/commonjs/components/email.js +5 -9
- package/lib/commonjs/components/email.js.map +1 -1
- package/lib/commonjs/components/productCard.js +91 -86
- package/lib/commonjs/components/productCard.js.map +1 -1
- package/lib/commonjs/components/welcomeButton.js +4 -4
- package/lib/commonjs/components/welcomeButton.js.map +1 -1
- package/lib/commonjs/contexts/AppContext.js +46 -45
- package/lib/commonjs/contexts/AppContext.js.map +1 -1
- package/lib/commonjs/hooks/Stream.js +399 -74
- package/lib/commonjs/hooks/Stream.js.map +1 -1
- package/lib/commonjs/layout/disclaimer.js +36 -32
- package/lib/commonjs/layout/disclaimer.js.map +1 -1
- package/lib/commonjs/layout/welcome.js +8 -7
- package/lib/commonjs/layout/welcome.js.map +1 -1
- package/lib/commonjs/layout/window.js +152 -131
- package/lib/commonjs/layout/window.js.map +1 -1
- package/lib/commonjs/utils/audioRecorder.js.map +1 -1
- package/lib/commonjs/utils/storage.js +1 -1
- package/lib/module/components/email.js +5 -9
- package/lib/module/components/email.js.map +1 -1
- package/lib/module/components/productCard.js +94 -89
- package/lib/module/components/productCard.js.map +1 -1
- package/lib/module/components/welcomeButton.js +4 -4
- package/lib/module/components/welcomeButton.js.map +1 -1
- package/lib/module/contexts/AppContext.js +47 -46
- package/lib/module/contexts/AppContext.js.map +1 -1
- package/lib/module/hooks/Stream.js +400 -75
- package/lib/module/hooks/Stream.js.map +1 -1
- package/lib/module/layout/disclaimer.js +41 -37
- package/lib/module/layout/disclaimer.js.map +1 -1
- package/lib/module/layout/welcome.js +8 -7
- package/lib/module/layout/welcome.js.map +1 -1
- package/lib/module/layout/window.js +152 -131
- package/lib/module/layout/window.js.map +1 -1
- package/lib/module/utils/audioRecorder.js.map +1 -1
- package/lib/module/utils/storage.js +1 -1
- package/lib/typescript/components/email.d.ts.map +1 -1
- package/lib/typescript/components/productCard.d.ts +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 +2 -2
- package/lib/typescript/contexts/AppContext.d.ts.map +1 -1
- package/lib/typescript/hooks/Stream.d.ts.map +1 -1
- package/lib/typescript/layout/disclaimer.d.ts +1 -1
- package/lib/typescript/layout/disclaimer.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/audioRecorder.d.ts.map +1 -1
- package/package.json +2 -1
- package/src/components/email.js +4 -16
- package/src/components/productCard.js +279 -203
- package/src/components/welcomeButton.js +10 -10
- package/src/contexts/AppContext.js +185 -106
- package/src/hooks/Stream.js +607 -237
- package/src/layout/disclaimer.js +125 -78
- package/src/layout/welcome.js +58 -20
- package/src/layout/window.js +279 -140
- package/src/utils/audioRecorder.js +40 -34
- package/src/utils/storage.ts +2 -2
package/src/layout/disclaimer.js
CHANGED
|
@@ -1,82 +1,129 @@
|
|
|
1
|
-
import React, { useContext } from
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
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
|
|
12
|
+
import { Testing } from '../components/testing';
|
|
7
13
|
|
|
8
14
|
export const Disclaimer = ({ panHandlers }) => {
|
|
9
|
-
const {
|
|
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:
|
|
14
|
-
details:
|
|
15
|
-
|
|
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:
|
|
19
|
-
details:
|
|
20
|
-
|
|
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:
|
|
24
|
-
details:
|
|
25
|
-
|
|
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
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
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
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
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
|
-
|
|
50
|
-
|
|
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
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
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
|
|
79
|
-
|
|
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:
|
|
99
|
-
alignItems:
|
|
145
|
+
flexDirection: 'row',
|
|
146
|
+
alignItems: 'center',
|
|
100
147
|
marginBottom: 10,
|
|
101
148
|
},
|
|
102
149
|
welcomeTitle: {
|
|
103
150
|
fontSize: 18,
|
|
104
|
-
fontWeight:
|
|
105
|
-
color:
|
|
151
|
+
fontWeight: '500',
|
|
152
|
+
color: '#161616',
|
|
106
153
|
},
|
|
107
154
|
betaTag: {
|
|
108
|
-
backgroundColor:
|
|
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:
|
|
162
|
+
color: '#ffffff',
|
|
116
163
|
fontSize: 11,
|
|
117
|
-
fontWeight:
|
|
164
|
+
fontWeight: '500',
|
|
118
165
|
},
|
|
119
166
|
disclaimerText: {
|
|
120
167
|
fontSize: 13,
|
|
121
|
-
color:
|
|
168
|
+
color: '#505050',
|
|
122
169
|
lineHeight: 18,
|
|
123
170
|
marginBottom: 8,
|
|
124
171
|
},
|
|
125
172
|
boldText: {
|
|
126
|
-
fontWeight:
|
|
173
|
+
fontWeight: 'bold',
|
|
127
174
|
},
|
|
128
175
|
sectionContainer: {
|
|
129
|
-
flexDirection:
|
|
130
|
-
alignItems:
|
|
131
|
-
backgroundColor:
|
|
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:
|
|
141
|
-
justifyContent:
|
|
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:
|
|
150
|
-
color:
|
|
196
|
+
fontWeight: '500',
|
|
197
|
+
color: '#161616',
|
|
151
198
|
marginBottom: 3,
|
|
152
199
|
},
|
|
153
200
|
sectionDetails: {
|
|
154
201
|
fontSize: 12,
|
|
155
|
-
color:
|
|
202
|
+
color: '#505050',
|
|
156
203
|
lineHeight: 18,
|
|
157
204
|
},
|
|
158
205
|
confirmArea: {
|
|
159
|
-
alignItems:
|
|
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:
|
|
214
|
+
width: '100%',
|
|
168
215
|
paddingVertical: 12,
|
|
169
216
|
borderRadius: 5,
|
|
170
|
-
alignItems:
|
|
217
|
+
alignItems: 'center',
|
|
171
218
|
marginBottom: 10,
|
|
172
219
|
},
|
|
173
220
|
buttonText: {
|
|
174
|
-
color:
|
|
221
|
+
color: '#FFFFFF',
|
|
175
222
|
fontSize: 16,
|
|
176
|
-
fontWeight:
|
|
223
|
+
fontWeight: '500',
|
|
177
224
|
},
|
|
178
225
|
confirmText: {
|
|
179
226
|
fontSize: 11,
|
|
180
|
-
color:
|
|
227
|
+
color: 'gray',
|
|
181
228
|
lineHeight: 16,
|
|
182
229
|
paddingHorizontal: 10,
|
|
183
230
|
},
|
package/src/layout/welcome.js
CHANGED
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
// Welcome.js
|
|
2
2
|
import React, { useContext } from 'react';
|
|
3
|
-
import {
|
|
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 {
|
|
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(
|
|
30
|
+
setShowModal('Off');
|
|
16
31
|
} else {
|
|
17
|
-
setShowModal(
|
|
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
|
|
42
|
+
<View
|
|
43
|
+
style={[
|
|
44
|
+
styles.parentContainer,
|
|
45
|
+
{ backgroundColor: theme.primaryColor },
|
|
46
|
+
]}>
|
|
28
47
|
{/* Top section */}
|
|
29
|
-
<View
|
|
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
|
|
56
|
+
<CloudinaryImage
|
|
57
|
+
cldImg={brandLogo}
|
|
58
|
+
imageStyle={{ width: 150, height: 35 }}
|
|
59
|
+
/>
|
|
34
60
|
</View>
|
|
35
|
-
<TouchableOpacity
|
|
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
|
|
41
|
-
|
|
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
|
|
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}>
|
|
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:
|
|
160
|
+
backgroundColor: '#f6f6f6',
|
|
123
161
|
paddingTop: 30,
|
|
124
162
|
},
|
|
125
163
|
welcomeBody: {
|