ordering-ui-react-native 0.16.53-release → 0.16.54-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.53-release",
3
+ "version": "0.16.54-release",
4
4
  "description": "Reusable components made in react native",
5
5
  "main": "src/index.tsx",
6
6
  "author": "ordering.inc",
@@ -11,7 +11,7 @@ import {
11
11
  ToastType
12
12
  } from 'ordering-components/native';
13
13
  import { OIcon, OText } from '../shared';
14
- import { Dimensions, StyleSheet, View } from 'react-native';
14
+ import { Dimensions, StyleSheet, Vibration, View } from 'react-native';
15
15
  import { InView } from 'react-native-intersection-observer'
16
16
  import { BusinessControllerParams } from '../../types';
17
17
  import { convertHoursToMinutes, shape } from '../../utils';
@@ -142,6 +142,7 @@ export const BusinessControllerUI = (props: BusinessControllerParams) => {
142
142
  };
143
143
 
144
144
  const handleBusinessClick = (selectedBusiness: any) => {
145
+ Vibration.vibrate()
145
146
  if (business?.open) handleClick && handleClick(selectedBusiness)
146
147
  else {
147
148
  if (configState?.configs?.preorder_status_enabled?.value === '1') {
@@ -190,6 +190,7 @@ const CheckoutUI = (props: any) => {
190
190
 
191
191
  const handlePlaceOrder = (confirmPayment: any, forcePlace: boolean = false) => {
192
192
  if (!userErrors.length && !requiredFields?.length || forcePlace) {
193
+ Vibration.vibrate()
193
194
  handlerClickPlaceOrder && handlerClickPlaceOrder(null, null, confirmPayment)
194
195
  return
195
196
  }
@@ -72,9 +72,9 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
72
72
 
73
73
  useEffect(() => {
74
74
  if (loading || error) return
75
- const orders = _orders.map((order: any) => order?.cart_group_id
76
- ? _orders
77
- .filter((_order : any) => _order?.cart_group_id === order?.cart_group_id)
75
+ 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
78
  ?.reduce((orderCompleted : any, currentOrder : any) => ({
79
79
  ...orderCompleted,
80
80
  total: orderCompleted.summary?.total + currentOrder?.summary?.total,
@@ -84,17 +84,19 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
84
84
  review: orderCompleted.review && currentOrder.review,
85
85
  user_review: orderCompleted.user_review && currentOrder.user_review,
86
86
  products: [orderCompleted.products, currentOrder.products].flat()
87
- })).filter((order: any) => {
88
- const isDuplicate = uniqueOrders.includes(order?.cart_group_id)
89
- if (!isDuplicate) {
90
- uniqueOrders.push(order?.cart_group_id)
91
- return true
92
- }
93
- return false
94
- })
95
- : order)
87
+ }))
88
+ : order)
89
+ const orders = ordersReduced?.filter((order: any) => {
90
+ if (!order?.cart_group_id) return true
91
+ const isDuplicate = uniqueOrders.includes(order?.cart_group_id)
92
+ if (!isDuplicate) {
93
+ uniqueOrders.push(order?.cart_group_id)
94
+ return true
95
+ }
96
+ return false
97
+ })
96
98
  setOrders(orders)
97
- }, [JSON.stringify(_orders)])
99
+ }, [_orders?.length])
98
100
 
99
101
  const getOrderStatus = (s: string) => {
100
102
  const status = parseInt(s)
@@ -9,7 +9,8 @@ import {
9
9
  I18nManager,
10
10
  SafeAreaView,
11
11
  Platform,
12
- Button
12
+ Button,
13
+ Vibration
13
14
  } from 'react-native';
14
15
  import {
15
16
  ProductForm as ProductOptions,
@@ -207,6 +208,7 @@ export const ProductOptionsUI = (props: any) => {
207
208
  };
208
209
 
209
210
  const handleSaveProduct = () => {
211
+ Vibration.vibrate()
210
212
  if (!productCart.quantity) {
211
213
  showToast(ToastType.Error, t('VALIDATION_ERROR_REQUIRED', 'The quantity field is required').replace('_attribute_', t('PRODUCT_POTIONS_QUANTITY', 'Quantity')))
212
214
  return