ordering-ui-react-native 0.14.49 → 0.14.50

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ordering-ui-react-native",
3
- "version": "0.14.49",
3
+ "version": "0.14.50",
4
4
  "description": "Reusable components made in react native",
5
5
  "main": "src/index.tsx",
6
6
  "author": "ordering.inc",
@@ -33,8 +33,8 @@ const UpsellingProductsUI = (props: UpsellingProductsParams) => {
33
33
  canOpenUpselling,
34
34
  setCanOpenUpselling,
35
35
  isFromCart,
36
- onNavigationRedirect,
37
- onGoBack
36
+ onNavigationRedirect,
37
+ onGoBack
38
38
  } = props
39
39
 
40
40
  const theme = useTheme();
@@ -71,16 +71,16 @@ const UpsellingProductsUI = (props: UpsellingProductsParams) => {
71
71
  const [, t] = useLanguage()
72
72
  const { bottom } = useSafeAreaInsets()
73
73
 
74
- const cart = carts?.[`businessId:${props.businessId}`] ?? {}
75
- const cartProducts = cart?.products?.length
76
- ? cart?.products.map((product: any) => product.id)
77
- : []
74
+ const cart = carts?.[`businessId:${props.businessId}`] ?? {}
75
+ const cartProducts = cart?.products?.length
76
+ ? cart?.products.map((product: any) => product.id)
77
+ : []
78
78
 
79
- const productsList = !upsellingProducts.loading && !upsellingProducts.error
80
- ? upsellingProducts?.products?.length
81
- ? upsellingProducts?.products.filter((product: any) => !cartProducts.includes(product.id))
82
- : (props?.products ?? []).filter((product: any) => !cartProducts.includes(product.id)) ?? []
83
- : []
79
+ const productsList = !upsellingProducts.loading && !upsellingProducts.error
80
+ ? upsellingProducts?.products?.length
81
+ ? upsellingProducts?.products.filter((product: any) => !cartProducts.includes(product.id))
82
+ : (props?.products ?? []).filter((product: any) => !cartProducts.includes(product.id)) ?? []
83
+ : []
84
84
 
85
85
  useEffect(() => {
86
86
  if (!isCustomMode && !props.products) {
@@ -94,6 +94,10 @@ const UpsellingProductsUI = (props: UpsellingProductsParams) => {
94
94
  }
95
95
  }, [upsellingProducts.loading, upsellingProducts?.products.length])
96
96
 
97
+ useEffect(() => {
98
+ Object.keys(cart).length === 0 && onNavigationRedirect && onNavigationRedirect('MyOrders')
99
+ }, [cart])
100
+
97
101
  const handleFormProduct = (product: any) => {
98
102
  onNavigationRedirect && onNavigationRedirect('ProductDetails', {
99
103
  product: product,