react-native-srschat 0.1.55 → 0.1.57
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 +112 -3
- package/lib/commonjs/components/email.js.map +1 -1
- package/lib/commonjs/components/productCard.js +91 -39
- package/lib/commonjs/components/productCard.js.map +1 -1
- package/lib/commonjs/components/testProductCard.js +60 -0
- package/lib/commonjs/components/testProductCard.js.map +1 -0
- package/lib/commonjs/components/testing.js +35 -8
- package/lib/commonjs/components/testing.js.map +1 -1
- package/lib/commonjs/contexts/AppContext.js +17 -1
- package/lib/commonjs/contexts/AppContext.js.map +1 -1
- package/lib/commonjs/layout/window.js +12 -5
- package/lib/commonjs/layout/window.js.map +1 -1
- package/lib/module/components/email.js +112 -3
- package/lib/module/components/email.js.map +1 -1
- package/lib/module/components/productCard.js +91 -39
- package/lib/module/components/productCard.js.map +1 -1
- package/lib/module/components/testProductCard.js +52 -0
- package/lib/module/components/testProductCard.js.map +1 -0
- package/lib/module/components/testing.js +36 -9
- package/lib/module/components/testing.js.map +1 -1
- package/lib/module/contexts/AppContext.js +17 -1
- package/lib/module/contexts/AppContext.js.map +1 -1
- package/lib/module/layout/window.js +12 -5
- package/lib/module/layout/window.js.map +1 -1
- package/lib/typescript/components/email.d.ts.map +1 -1
- package/lib/typescript/components/productCard.d.ts.map +1 -1
- package/lib/typescript/components/testProductCard.d.ts +3 -0
- package/lib/typescript/components/testProductCard.d.ts.map +1 -0
- package/lib/typescript/components/testing.d.ts.map +1 -1
- package/lib/typescript/contexts/AppContext.d.ts.map +1 -1
- package/lib/typescript/layout/window.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/components/email.js +108 -2
- package/src/components/productCard.js +91 -42
- package/src/components/testProductCard.js +55 -0
- package/src/components/testing.js +45 -14
- package/src/contexts/AppContext.js +20 -1
- package/src/layout/window.js +11 -5
|
@@ -337,6 +337,25 @@ export const AppProvider = ({ data, onProductCardClick, onAddToCartClick, uiConf
|
|
|
337
337
|
handleSend(transcription)
|
|
338
338
|
}
|
|
339
339
|
|
|
340
|
+
// Wrapper function for onAddToCartClick to add middle message
|
|
341
|
+
const handleAddToCartWithMessage = (cartData) => {
|
|
342
|
+
// Add middle message indicating item is being added to cart
|
|
343
|
+
setMessages((prevMessages) => [
|
|
344
|
+
...prevMessages,
|
|
345
|
+
{
|
|
346
|
+
type: "middle",
|
|
347
|
+
text: `${cartData.quantity} ${cartData.selectedUom} of item ${cartData.product.product_details.product_name} added to cart`,
|
|
348
|
+
products: [],
|
|
349
|
+
product_cards: "False",
|
|
350
|
+
},
|
|
351
|
+
]);
|
|
352
|
+
|
|
353
|
+
// Call the original onAddToCartClick function
|
|
354
|
+
if (onAddToCartClick) {
|
|
355
|
+
onAddToCartClick(cartData);
|
|
356
|
+
}
|
|
357
|
+
};
|
|
358
|
+
|
|
340
359
|
return (
|
|
341
360
|
<AppContext.Provider
|
|
342
361
|
value={{ showModal, setShowModal, messages, setMessages, handleSend, input, setInput, defaultMessage, typingIndicator, setTypingIndicator,
|
|
@@ -344,7 +363,7 @@ export const AppProvider = ({ data, onProductCardClick, onAddToCartClick, uiConf
|
|
|
344
363
|
ghostMessage, setGhostMessage, ghostCard, setGhostCard, stopActivated, setStopActivated, disclaimer, setDisclaimer,
|
|
345
364
|
startStreaming, setStartStreaming, maintenance, setMaintenance, feedback, setFeedback, handleFeedback, feedbackOpen, setFeedbackOpen,
|
|
346
365
|
writeFeedback, setWriteFeedback, writeAnswer, setWriteAnswer, BASE_URL, lastMessageId, setLastMessageId,
|
|
347
|
-
onProductCardClick, onAddToCartClick, data, sessionId, setSessionId, handleWrittenFeedback, switchFeedbackOpen, confirmDisclaimer,
|
|
366
|
+
onProductCardClick, onAddToCartClick: handleAddToCartWithMessage, data, sessionId, setSessionId, handleWrittenFeedback, switchFeedbackOpen, confirmDisclaimer,
|
|
348
367
|
formatChatHistory, uiConfig, handleVoiceSend, TRACK_CLICK_URL, ADD_TO_CART_URL
|
|
349
368
|
}}
|
|
350
369
|
>
|
package/src/layout/window.js
CHANGED
|
@@ -118,10 +118,12 @@ export const ChatWindow = ({ panHandlers }) => {
|
|
|
118
118
|
|
|
119
119
|
{msg.type == "middle" && (
|
|
120
120
|
<View style={[styles.middleMessageBubble, styles.middleMessage]}>
|
|
121
|
-
<Ionicons name="sparkles-outline" size={
|
|
122
|
-
<
|
|
123
|
-
|
|
124
|
-
|
|
121
|
+
<Ionicons name="sparkles-outline" size={16} style={{marginRight: 10, marginTop: 10}}/>
|
|
122
|
+
<View style={styles.middleMessageText}>
|
|
123
|
+
<Markdown style={{ body: { color: msg.type === "user" ? "#ffffff" : "#161616",fontSize: 16, lineHeight: 22 }}}>
|
|
124
|
+
{typeof msg.text === 'string' ? msg.text : String(msg.text || '')}
|
|
125
|
+
</Markdown>
|
|
126
|
+
</View>
|
|
125
127
|
</View>
|
|
126
128
|
)}
|
|
127
129
|
|
|
@@ -302,13 +304,17 @@ const styles = StyleSheet.create({
|
|
|
302
304
|
borderRadius: 12,
|
|
303
305
|
marginBottom: 5,
|
|
304
306
|
flexDirection: 'row',
|
|
305
|
-
alignItems: '
|
|
307
|
+
alignItems: 'flex-start'
|
|
306
308
|
},
|
|
307
309
|
middleMessage:{
|
|
308
310
|
color: '#161616',
|
|
309
311
|
alignSelf: 'flex-start',
|
|
310
312
|
backgroundColor: '#e0f4fc', //'#e0f4fc',
|
|
311
313
|
width: '100%',
|
|
314
|
+
},
|
|
315
|
+
middleMessageText: {
|
|
316
|
+
flex: 1,
|
|
317
|
+
flexShrink: 1
|
|
312
318
|
}
|
|
313
319
|
});
|
|
314
320
|
|