-
Notifications
You must be signed in to change notification settings - Fork 199
Closed
Description
Hi! 👋
Firstly, thanks for your work on this project! 🙂
Today I used patch-package to patch @segment/analytics-react-native-plugin-firebase@0.3.9 for the project I'm working on.
The string type check was causing issues and so we updated the check accordingly and the Cart Viewed event was not being mapped correctly to the view_cart event in Firebase.
Here is the diff that solved my problem:
diff --git a/node_modules/@segment/analytics-react-native-plugin-firebase/src/methods/parameterMapping.ts b/node_modules/@segment/analytics-react-native-plugin-firebase/src/methods/parameterMapping.ts
index 7229fb0..943cabe 100644
--- a/node_modules/@segment/analytics-react-native-plugin-firebase/src/methods/parameterMapping.ts
+++ b/node_modules/@segment/analytics-react-native-plugin-firebase/src/methods/parameterMapping.ts
@@ -1,5 +1,3 @@
-import { isString } from '@segment/analytics-react-native';
-
const mapEventNames: { [key: string]: string } = {
'Product Clicked': 'select_content',
'Product Viewed': 'view_item',
@@ -15,6 +13,7 @@ const mapEventNames: { [key: string]: string } = {
'Product Shared': 'share',
'Cart Shared': 'share',
'Products Searched': 'search',
+ 'Cart Viewed': 'view_cart'
};
export const mapEventProps: { [key: string]: string } = {
@@ -30,7 +29,7 @@ export const mapEventProps: { [key: string]: string } = {
export const transformMap: { [key: string]: (value: unknown) => unknown } = {
event: (value: unknown) => {
- if (isString(value) && value in mapEventNames) {
+ if (typeof value === 'string' && value in mapEventNames) {
return mapEventNames[value];
}
return value;This issue body was partially generated by patch-package.
Metadata
Metadata
Assignees
Labels
No labels