diff --git a/src/App.tsx b/src/App.tsx index 86efcd9..c00c435 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -49,6 +49,7 @@ Sentry.init({ dsn: DSN, debug: true, environment: 'dev', + enableLogs: true, beforeSend: (event) => { if (SE === 'tda') { // Make issues unique to the release (app version) for Release Health @@ -73,6 +74,7 @@ Sentry.init({ maskAllImages: true, maskAllText: true, }), + Sentry.consoleLoggingIntegration({levels: ['log', 'warn', 'error']}), reactNavigationIntegration, ], tracesSampleRate: 1.0, @@ -109,6 +111,14 @@ const App = () => { let email = Math.random().toString(36).substring(2, 6) + '@yahoo.com'; scope.setUser({email: email}); + // Log app initialization + Sentry.logger.info('App initialized', { + customerType, + email, + se: SE, + version: packageJson.version, + }); + return ( @@ -119,6 +129,7 @@ const App = () => { reactNavigationIntegration.registerNavigationContainer( navigation, ); + Sentry.logger.info('Navigation container ready'); }}> {/* */} diff --git a/src/components/StyledCartProductCard.tsx b/src/components/StyledCartProductCard.tsx index 51816c7..480eb42 100644 --- a/src/components/StyledCartProductCard.tsx +++ b/src/components/StyledCartProductCard.tsx @@ -14,6 +14,15 @@ export const StyledCartProductCard = (props: { title: string; }): React.ReactElement => { const deleteItem = (id: string) => { + Sentry.logger.info( + Sentry.logger.fmt`'${props.title}' removed from cart`, + { + productId: props.id, + productTitle: props.title, + price: props.price, + quantity: props.quantity, + }, + ); props.appDispatch({type: 'DELETE_FROM_CART', payload: id}); }; diff --git a/src/components/StyledProductCard.tsx b/src/components/StyledProductCard.tsx index ce19f3e..3e0ec3f 100644 --- a/src/components/StyledProductCard.tsx +++ b/src/components/StyledProductCard.tsx @@ -34,6 +34,15 @@ export const StyledProductCard = (props: { text1: 'Added to Cart', visibilityTime: visibilityTimeMs, }); + Sentry.logger.info( + Sentry.logger.fmt`'${props.title}' added to cart`, + { + productId: props.id, + productTitle: props.title, + price: props.price, + productType: props.type, + }, + ); }; return ( diff --git a/src/components/UserFeedbackModal.tsx b/src/components/UserFeedbackModal.tsx index 1d37a08..654cacc 100644 --- a/src/components/UserFeedbackModal.tsx +++ b/src/components/UserFeedbackModal.tsx @@ -36,6 +36,7 @@ export const SentryUserFeedbackActionButton = () => { : [style.container, style.shadowProp]; const onGiveFeedbackButtonPress = () => { + Sentry.logger.info('User feedback modal opened'); setFromVisibility(true); }; @@ -111,6 +112,11 @@ export function UserFeedbackModal(props: {onDismiss: () => void}) { message: comments, }; + Sentry.logger.info('User feedback submitted', { + eventId: sentryId, + messageLength: comments.length, + }); + Sentry.captureFeedback(userFeedback); clearComments(); dispatch(hideFeedbackActionButton()); diff --git a/src/reduxApp.ts b/src/reduxApp.ts index 3fbfdfc..8d269e4 100644 --- a/src/reduxApp.ts +++ b/src/reduxApp.ts @@ -45,17 +45,29 @@ const reducer = (state = initialState, action) => { } case 'ADD_TO_CART': if (state.cart[payload.id]) { + const newQuantity = state.cart[payload.id].quantity + 1; + Sentry.logger.info(`Adding quantity: ${newQuantity}`, { + productId: payload.id, + productTitle: payload.title, + previousQuantity: state.cart[payload.id].quantity, + newQuantity: newQuantity, + }); return { ...state, cart: { ...state.cart, [payload.id]: { ...state.cart[payload.id], - quantity: state.cart[payload.id].quantity + 1, + quantity: newQuantity, }, }, }; } + Sentry.logger.info('Adding new item to cart', { + productId: payload.id, + productTitle: payload.title, + quantity: payload.quantity, + }); return { ...state, cart: {...state.cart, [action.payload.id]: action.payload}, diff --git a/src/screens/CartScreen.tsx b/src/screens/CartScreen.tsx index bd9592f..348f0f4 100644 --- a/src/screens/CartScreen.tsx +++ b/src/screens/CartScreen.tsx @@ -28,6 +28,7 @@ const CheckoutButton = ({ return (