ordering-ui-react-native 0.16.62-release → 0.16.63-release

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.16.62-release",
3
+ "version": "0.16.63-release",
4
4
  "description": "Reusable components made in react native",
5
5
  "main": "src/index.tsx",
6
6
  "author": "ordering.inc",
@@ -69,23 +69,25 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
69
69
  const _orders = customArray || values || []
70
70
  const uniqueOrders: any = []
71
71
 
72
-
73
72
  useEffect(() => {
74
73
  if (loading || error) return
75
74
  const ordersReduced = _orders.map((order: any) => order?.cart_group_id
76
- ? _orders
77
- ?.filter((_order : any) => _order?.cart_group_id === order?.cart_group_id)
78
- ?.reduce((orderCompleted : any, currentOrder : any) => ({
79
- ...orderCompleted,
80
- total: orderCompleted.summary?.total + currentOrder?.summary?.total,
81
- business: [orderCompleted.business, currentOrder.business].flat(),
82
- business_id: [orderCompleted.business_id, currentOrder.business_id].flat(),
83
- id: [orderCompleted.id, currentOrder.id].flat(),
84
- review: orderCompleted.review && currentOrder.review,
85
- user_review: orderCompleted.user_review && currentOrder.user_review,
86
- products: [orderCompleted.products, currentOrder.products].flat()
87
- }))
88
- : order)
75
+ ? _orders
76
+ .filter((_order: any) => _order?.cart_group_id === order?.cart_group_id)
77
+ .map((_o: any, _: any, _ordersList: any) => {
78
+ const obj = {
79
+ ..._o,
80
+ id: _ordersList.map(o => o.id),
81
+ review: _o.review,
82
+ user_review: _o.user_review,
83
+ total: _ordersList.reduce((acc: any, o: any) => acc + o.summary.total, 0),
84
+ business: _ordersList.map((o: any) => o.business),
85
+ business_id: _ordersList.map((o: any) => o.business_id),
86
+ products: _ordersList.map((o: any) => o.products)
87
+ }
88
+ return obj
89
+ }).find((o: any) => o)
90
+ : order)
89
91
  const orders = ordersReduced?.filter((order: any) => {
90
92
  if (!order?.cart_group_id) return true
91
93
  const isDuplicate = uniqueOrders.includes(order?.cart_group_id)