react-native-srschat 0.1.66 → 0.1.68

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/README.md +9 -1
  2. package/lib/commonjs/components/email.js +35 -20
  3. package/lib/commonjs/components/email.js.map +1 -1
  4. package/lib/commonjs/components/header.js +2 -2
  5. package/lib/commonjs/components/header.js.map +1 -1
  6. package/lib/commonjs/components/productCard.js +9 -6
  7. package/lib/commonjs/components/productCard.js.map +1 -1
  8. package/lib/commonjs/components/welcomeButton.js +5 -5
  9. package/lib/commonjs/components/welcomeButton.js.map +1 -1
  10. package/lib/commonjs/contexts/AppContext.js +6 -6
  11. package/lib/commonjs/contexts/AppContext.js.map +1 -1
  12. package/lib/commonjs/hooks/Stream.js +1 -0
  13. package/lib/commonjs/hooks/Stream.js.map +1 -1
  14. package/lib/commonjs/layout/disclaimer.js +1 -1
  15. package/lib/commonjs/layout/disclaimer.js.map +1 -1
  16. package/lib/commonjs/layout/ex.js +2 -2
  17. package/lib/commonjs/layout/welcome.js +5 -5
  18. package/lib/commonjs/layout/welcome.js.map +1 -1
  19. package/lib/commonjs/layout/window.js +4 -4
  20. package/lib/commonjs/utils/cloudinary.js +3 -3
  21. package/lib/commonjs/utils/cloudinary.js.map +1 -1
  22. package/lib/commonjs/utils/storage.js +1 -1
  23. package/lib/module/components/email.js +35 -20
  24. package/lib/module/components/email.js.map +1 -1
  25. package/lib/module/components/header.js +2 -2
  26. package/lib/module/components/header.js.map +1 -1
  27. package/lib/module/components/productCard.js +9 -6
  28. package/lib/module/components/productCard.js.map +1 -1
  29. package/lib/module/components/welcomeButton.js +5 -5
  30. package/lib/module/components/welcomeButton.js.map +1 -1
  31. package/lib/module/contexts/AppContext.js +6 -6
  32. package/lib/module/contexts/AppContext.js.map +1 -1
  33. package/lib/module/hooks/Stream.js +1 -0
  34. package/lib/module/hooks/Stream.js.map +1 -1
  35. package/lib/module/layout/disclaimer.js +1 -1
  36. package/lib/module/layout/disclaimer.js.map +1 -1
  37. package/lib/module/layout/ex.js +2 -2
  38. package/lib/module/layout/welcome.js +5 -5
  39. package/lib/module/layout/welcome.js.map +1 -1
  40. package/lib/module/layout/window.js +4 -4
  41. package/lib/module/utils/cloudinary.js +3 -3
  42. package/lib/module/utils/cloudinary.js.map +1 -1
  43. package/lib/module/utils/storage.js +1 -1
  44. package/lib/typescript/components/email.d.ts.map +1 -1
  45. package/lib/typescript/components/productCard.d.ts.map +1 -1
  46. package/lib/typescript/hooks/Stream.d.ts.map +1 -1
  47. package/package.json +1 -1
  48. package/src/components/email.js +34 -17
  49. package/src/components/header.js +2 -2
  50. package/src/components/productCard.js +9 -5
  51. package/src/components/welcomeButton.js +5 -5
  52. package/src/contexts/AppContext.js +7 -7
  53. package/src/hooks/Stream.js +1 -0
  54. package/src/layout/disclaimer.js +1 -1
  55. package/src/layout/ex.js +2 -2
  56. package/src/layout/welcome.js +5 -5
  57. package/src/layout/window.js +4 -4
  58. package/src/utils/cloudinary.js +3 -3
  59. package/src/utils/storage.ts +1 -1
@@ -16,7 +16,7 @@ import { Header } from "./header";
16
16
  import { KeyboardAwareScrollView } from "react-native-keyboard-aware-scroll-view";
17
17
 
18
18
  export const EmailForm = ({ panHandlers }) => {
19
- const { data, BASE_URL, setShowModal, messages, formatChatHistory, conversationStartTime } = useContext(AppContext);
19
+ const { data, BASE_URL, setShowModal, formatChatHistory, conversationStartTime, sessionId } = useContext(AppContext);
20
20
  const [subject, setSubject] = useState("");
21
21
  const [message, setMessage] = useState("");
22
22
  const [userEmail, setUserEmail] = useState(data?.user_email || "");
@@ -140,6 +140,15 @@ export const EmailForm = ({ panHandlers }) => {
140
140
  return "";
141
141
  };
142
142
 
143
+ const buildEmailRequestPayload = (chatHistory) => ({
144
+ chat_history: chatHistory,
145
+ conversation_start_time: conversationStartTime ?? null,
146
+ customer_name: data?.customer_name ?? null,
147
+ user_id: data?.user_id ?? null,
148
+ session_id: data?.session_id ?? data?.session ?? sessionId ?? null,
149
+ branch_email: branchEmail ?? "",
150
+ });
151
+
143
152
  const handleComposeEmail = async () => {
144
153
  setIsComposing(true);
145
154
  setError("");
@@ -147,15 +156,7 @@ export const EmailForm = ({ panHandlers }) => {
147
156
 
148
157
  try {
149
158
  const chatHistory = formatChatHistory();
150
- const customerName = data?.customer_name || "";
151
- const payload = {
152
- chat_history: chatHistory,
153
- conversation_start_time: conversationStartTime,
154
- customer_name: data?.customer_name || "",
155
- user_id : data?.user_id || "",
156
- session_id : data.session_id || data.session || sessionId,
157
- };
158
- console.log(payload)
159
+ const payload = buildEmailRequestPayload(chatHistory);
159
160
 
160
161
  const response = await axios.post(`https://${BASE_URL}/compose-email`, payload);
161
162
  // Use customer name from data if available, otherwise leave blank
@@ -189,17 +190,17 @@ export const EmailForm = ({ panHandlers }) => {
189
190
 
190
191
  try {
191
192
  const chatHistory = formatChatHistory();
192
- await axios.post(`https://${BASE_URL}/send-email`, {
193
+ const payload = {
194
+ ...buildEmailRequestPayload(chatHistory),
193
195
  user_email: userEmail,
194
196
  subject,
195
197
  message,
196
- chat_history: chatHistory,
197
- conversation_start_time: conversationStartTime,
198
- customer_name: "",
199
198
  branch_email: branchEmail,
200
- user_id : data?.user_id || "",
201
- session_id : data.session_id || data.session || sessionId,
202
- });
199
+ customer_name: data?.customer_name ?? null,
200
+ conversation_start_time: conversationStartTime ?? null,
201
+ };
202
+
203
+ await axios.post(`https://${BASE_URL}/send-email`, payload);
203
204
 
204
205
  setSuccess(true);
205
206
  setError("");
@@ -208,6 +209,22 @@ export const EmailForm = ({ panHandlers }) => {
208
209
  setShowModal("ChatWindow");
209
210
  }, 2000);
210
211
  } catch (error) {
212
+ console.error("Email send error:", {
213
+ status: error.response?.status,
214
+ statusText: error.response?.statusText,
215
+ errorMessage: error.response?.data?.message,
216
+ errorDetails: error.response?.data,
217
+ requestPayload: {
218
+ user_email: userEmail,
219
+ subject,
220
+ message_length: message?.length,
221
+ branch_email: branchEmail,
222
+ customer_name: data?.customer_name,
223
+ conversation_start_time: conversationStartTime,
224
+ session_id: data?.session_id || data?.session || sessionId,
225
+ chat_history_length: chatHistory?.length
226
+ }
227
+ });
211
228
  setError(error.response?.data?.message || "Failed to send email");
212
229
  setSuccess(false);
213
230
  } finally {
@@ -32,7 +32,7 @@ export const Header = () => {
32
32
  height={35}
33
33
  /> */}
34
34
  <CloudinaryImage
35
- cldImg="logos/HPSG_HPlus_Logo_White"
35
+ cldImg="logos/HLSG_Logo_Lockup_Color"
36
36
  imageStyle={{ width: 150, height: 35 }}
37
37
  />
38
38
  </View>
@@ -71,7 +71,7 @@ const styles = StyleSheet.create({
71
71
  header: {
72
72
  flexDirection: 'row',
73
73
  alignItems: 'center',
74
- backgroundColor: '#004687',
74
+ backgroundColor: '#437D3D',
75
75
  padding: 16,
76
76
  paddingTop: 60,
77
77
  borderBottomWidth: 1,
@@ -362,11 +362,14 @@ export const ProductCard = ({ prod, onFocusQuantityInput, messageId }) => {
362
362
  <>
363
363
  <Text style={styles.originalPrice} allowFontScaling={false}>${Number(grossPrice).toFixed(2)}</Text>
364
364
  <Text style={styles.salePrice} allowFontScaling={false}>${Number(netPrice).toFixed(2)}</Text>
365
+ <Text style={styles.perUnit}>/ {selectedUom}</Text>
365
366
  </>
366
367
  ) : (
367
- <Text style={styles.price} allowFontScaling={false}>${Number(grossPrice).toFixed(2)}</Text>
368
+ <>
369
+ <Text style={styles.price} allowFontScaling={false}>${Number(grossPrice).toFixed(2)}</Text>
370
+ <Text style={styles.perUnit}>/ {selectedUom}</Text>
371
+ </>
368
372
  )}
369
- <Text style={styles.perUnit}> / {selectedUom}</Text>
370
373
  </View>
371
374
  <Text style={styles.availability}>
372
375
  {maxQuantity === 0 ? "0 available" : maxQuantity > 1000 ? "1000+ available" : `${maxQuantity} available`}
@@ -537,9 +540,8 @@ const styles = StyleSheet.create({
537
540
  textAlignVertical: 'center',
538
541
  },
539
542
  priceContainer: {
540
- flexDirection: "row",
543
+ flexDirection: "column",
541
544
  alignItems: "center",
542
- flexWrap: "nowrap",
543
545
  justifyContent: "center",
544
546
  paddingHorizontal: 2,
545
547
  },
@@ -547,7 +549,7 @@ const styles = StyleSheet.create({
547
549
  fontSize: 14,
548
550
  textDecorationLine: "line-through",
549
551
  color: "gray",
550
- marginRight: 5,
552
+ textAlign: "center",
551
553
  textBreakStrategy: "simple",
552
554
  lineHeight: 20,
553
555
  includeFontPadding: false,
@@ -557,6 +559,7 @@ const styles = StyleSheet.create({
557
559
  fontSize: 16,
558
560
  fontWeight: "bold",
559
561
  color: "red",
562
+ textAlign: "center",
560
563
  textBreakStrategy: "simple",
561
564
  lineHeight: 22,
562
565
  includeFontPadding: false,
@@ -565,6 +568,7 @@ const styles = StyleSheet.create({
565
568
  perUnit: {
566
569
  fontSize: 12,
567
570
  color: "gray",
571
+ textAlign: "center",
568
572
  },
569
573
  availability: {
570
574
  fontSize: 12,
@@ -5,9 +5,9 @@ import { AppContext } from '../contexts/AppContext';
5
5
 
6
6
  const suggestedQuestions = [
7
7
  { text: 'What are the hours of my current branch?' },
8
- { text: 'Do you have part # JNDDEV48 in stock?' },
9
- { text: 'Do you carry Hayward super pumps?' },
10
- { text: 'Which grid assembly goes with the Hayward DE4820 filter?' },
8
+ { text: 'Do you have part # RBLESPLXME2 in stock?' },
9
+ { text: 'How do I install the seal on B82456?' },
10
+ { text: 'Where can I find my POs?' },
11
11
  { text: 'ĀæPuedes ayudarme en espaƱol?' }
12
12
  ];
13
13
 
@@ -34,7 +34,7 @@ const styles = StyleSheet.create({
34
34
  },
35
35
  button: {
36
36
  backgroundColor: 'white',
37
- borderColor: '#004687',
37
+ borderColor: '#437D3D',
38
38
  borderWidth: 1,
39
39
  borderRadius: 18,
40
40
  paddingVertical: 12,
@@ -42,7 +42,7 @@ const styles = StyleSheet.create({
42
42
  marginBottom: 16,
43
43
  },
44
44
  buttonText: {
45
- color: '#004687',
45
+ color: '#437D3D',
46
46
  fontSize: 13,
47
47
  fontWeight: '400',
48
48
  },
@@ -17,22 +17,22 @@ export const AppProvider = ({ data, onProductCardClick, onAddToCartClick, uiConf
17
17
  primaryColor: '#161616'
18
18
  };
19
19
 
20
- const TRACK_CLICK_URL = "https://srs-external-agent-logging-586731320826.us-central1.run.app/track-click"
21
- const ADD_TO_CART_URL = "https://srs-external-agent-logging-586731320826.us-central1.run.app/add-to-cart"
20
+ const TRACK_CLICK_URL = "https://srs-external-agent-landscape-logging-586731320826.us-central1.run.app/track-click"
21
+ const ADD_TO_CART_URL = "https://srs-external-agent-landscape-logging-586731320826.us-central1.run.app/add-to-cart"
22
22
 
23
23
  // Backend URLs
24
24
  const BASE_URL = data.env === "stage"
25
- ? "pool-stage-external-agent-adk-586731320826.us-east1.run.app"
26
- : "pool-prod-external-agent-adk-586731320826.us-east1.run.app";
27
- const LOGGING_URL = "srs-external-agent-logging-ve7hwyltsq-uc.a.run.app";
25
+ ? "landscape-stage-external-agent-adk-586731320826.us-east1.run.app"
26
+ : "landscape-prod-external-agent-adk-586731320826.us-east1.run.app";
27
+ const LOGGING_URL = "srs-external-agent-landscape-logging-586731320826.us-central1.run.app";
28
28
  const API_PREFIX = "https://";
29
29
 
30
30
  // Default Messages
31
31
  const defaultMessage = [
32
- {type: "ai", text: "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?"}
32
+ {type: "ai", text: "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?"}
33
33
  ]
34
34
  const maintenanceMessage = [
35
- { type: "ai", text: "Hi there šŸ‘‹ I'm your Heritage Pool+ AI Agent. I'm currently undergoing maintenance to improve my services. Thank you for your patience and understanding!",},
35
+ { type: "ai", text: "Hi there šŸ‘‹ I'm your Heritage+ AI Agent. I'm currently undergoing maintenance to improve my services. Thank you for your patience and understanding!",},
36
36
  ];
37
37
 
38
38
 
@@ -41,6 +41,7 @@ export function useWebSocketMessage() {
41
41
  "secondarySalesPersonName": "",
42
42
  "secondarySalesPersonEmail": null */
43
43
  },
44
+ branch_details: data.branch_details,
44
45
  /* branch_details: {
45
46
  "active_branch_business_hours": "8:00 AM - 4:30 PM",
46
47
  "active_branch_email": "OrdersHarrisburg@bel-aqua.com",
@@ -65,7 +65,7 @@ export const Disclaimer = ({ panHandlers }) => {
65
65
  <Text style={styles.buttonText}>Confirm</Text>
66
66
  </TouchableOpacity>
67
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.
68
+ By clicking the "Confirm" button above, you understand and confirm that your use of Heritage+ AI Agent is subject to our current Terms of Service and Privacy Policy, and you confirm your understanding of the above.
69
69
  </Text>
70
70
  </View>
71
71
  </View>
package/src/layout/ex.js CHANGED
@@ -208,7 +208,7 @@
208
208
  // suggestedQuestionButton: {
209
209
  // backgroundColor: "white",
210
210
  // borderWidth: 1,
211
- // borderColor: "#004687",
211
+ // borderColor: "#437D3D",
212
212
  // borderRadius: 18,
213
213
  // paddingVertical: 10,
214
214
  // paddingHorizontal: 16,
@@ -216,7 +216,7 @@
216
216
  // alignSelf: "flex-start",
217
217
  // },
218
218
  // suggestedQuestionText: {
219
- // color: "#004687",
219
+ // color: "#437D3D",
220
220
  // fontSize: 13,
221
221
  // textAlign: "left",
222
222
  // },
@@ -31,7 +31,7 @@ export const Welcome = ({ panHandlers }) => {
31
31
  {/* Logo container with absolute positioning */}
32
32
  <View style={styles.logoContainer}>
33
33
  <CloudinaryImage
34
- cldImg="logos/HPSG_HPlus_Logo_White"
34
+ cldImg="logos/HLSG_Logo_Lockup_Color"
35
35
  imageStyle={{ width: 150, height: 35 }}
36
36
  />
37
37
  </View>
@@ -43,7 +43,7 @@ export const Welcome = ({ panHandlers }) => {
43
43
  <View style={styles.blueContainer}>
44
44
  <Text style={styles.welcomeHeader}>Hi {data?.customer_name || ""} šŸ‘‹</Text>
45
45
  <Text style={styles.welcomeBody2}>
46
- I’m your Heritage Pool+ AI Agent. I can help you during your online visit with Product and Account information.
46
+ I’m your Heritage+ AI Agent. I can help you during your online visit with Product and Account information.
47
47
  </Text>
48
48
  <WelcomeInput />
49
49
  <Text style={styles.textBeta}>Beta version. AI Assistant is still learning!</Text>
@@ -66,11 +66,11 @@ const styles = StyleSheet.create({
66
66
  },
67
67
  parentContainer: {
68
68
  flexGrow: 1,
69
- backgroundColor: '#004687',
69
+ backgroundColor: '#437D3D',
70
70
  paddingTop: 60,
71
71
  },
72
72
  topContainer: {
73
- backgroundColor: '#004687',
73
+ backgroundColor: '#437D3D',
74
74
  paddingBottom: 5,
75
75
  },
76
76
  topHeader: {
@@ -95,7 +95,7 @@ const styles = StyleSheet.create({
95
95
  alignItems: 'center',
96
96
  },
97
97
  blueContainer: {
98
- backgroundColor: '#004687',
98
+ backgroundColor: '#437D3D',
99
99
  padding: 15,
100
100
  margin: 10,
101
101
  borderRadius: 20,
@@ -218,7 +218,7 @@ const styles = StyleSheet.create({
218
218
  },
219
219
  userMessage: {
220
220
  alignSelf: 'flex-end',
221
- backgroundColor: "#003764",
221
+ backgroundColor: "#437D3D",
222
222
  color: "#ffffff",
223
223
  borderTopRightRadius: 0,
224
224
  },
@@ -233,7 +233,7 @@ const styles = StyleSheet.create({
233
233
  suggestedQuestionButton: {
234
234
  backgroundColor: "white",
235
235
  borderWidth: 1,
236
- borderColor: "#004687",
236
+ borderColor: "#437D3D",
237
237
  borderRadius: 18,
238
238
  paddingVertical: 10,
239
239
  paddingHorizontal: 16,
@@ -241,7 +241,7 @@ const styles = StyleSheet.create({
241
241
  alignSelf: "flex-start",
242
242
  },
243
243
  suggestedQuestionText: {
244
- color: "#004687",
244
+ color: "#437D3D",
245
245
  fontSize: 13,
246
246
  textAlign: "left",
247
247
  includeFontPadding: false,
@@ -319,7 +319,7 @@ const styles = StyleSheet.create({
319
319
  middleMessage:{
320
320
  color: '#161616',
321
321
  alignSelf: 'flex-start',
322
- backgroundColor: '#e0f4fc', //'#e0f4fc',
322
+ backgroundColor: '#e7decd', //'#e0f4fc',
323
323
  width: '100%',
324
324
  },
325
325
  middleMessageText: {
@@ -7,11 +7,11 @@ import { scale } from '@cloudinary/url-gen/actions/resize';
7
7
  const CloudinaryImage = ({ cldImg, imageStyle, accessibilityLabel, testID }) => {
8
8
  const cld = new Cloudinary({
9
9
  cloud: {
10
- cloudName: 'heritageplus'
10
+ cloudName: 'mktg'
11
11
  }
12
12
  });
13
13
 
14
- const myImage = Platform.OS === 'ios' ? cld.image(`mobileapp/${cldImg}`) : cld.image(`mobileapp/${cldImg}`).format('png');
14
+ const myImage = Platform.OS === 'ios' ? cld.image(`${cldImg}`) : cld.image(`${cldImg}`).format('png');
15
15
  return (
16
16
  <View>
17
17
  <AdvancedImage
@@ -34,7 +34,7 @@ export const CloudinaryBannerImage = ({
34
34
  }) => {
35
35
  const cld = new Cloudinary({
36
36
  cloud: {
37
- cloudName: 'heritageplus'
37
+ cloudName: 'mktg'
38
38
  }
39
39
  });
40
40
  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,