ordering-ui-react-native 0.23.11 → 0.23.13

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.23.11",
3
+ "version": "0.23.13",
4
4
  "description": "Reusable components made in react native",
5
5
  "main": "src/index.tsx",
6
6
  "author": "ordering.inc",
@@ -156,7 +156,7 @@ const NewOrderNotificationUI = (props: any) => {
156
156
  setCurrentEvent({ evt: 2, orderId: value?.id ?? value?.order_id })
157
157
  }
158
158
  }
159
- if ((!orderStatus.includes(value.status) && evtType !== 1 && isBusinessApp) || value?.author_id === user.id) return
159
+ if ((!orderStatus.includes(value.status) && evtType !== 1 && isBusinessApp && orderStatus?.length > 0) || value?.author_id === user.id) return
160
160
  setCurrentEvent({
161
161
  evt: evtType,
162
162
  orderId: value?.driver
@@ -566,7 +566,7 @@ export const OrderSummary = ({ order, navigation, orderStatus, askBluetoothPermi
566
566
  </OText>
567
567
  )}
568
568
 
569
- {order?.customer?.address_notes && (
569
+ {!!order?.customer?.address_notes && (
570
570
  <OText style={{ marginBottom: 5 }}>
571
571
  {`${t('NOTES', 'Notes')}: ${order?.customer?.address_notes}`}
572
572
  </OText>
@@ -665,7 +665,7 @@ export const OrderSummary = ({ order, navigation, orderStatus, askBluetoothPermi
665
665
  {t('ORDER_DETAILS', 'Order Details')}
666
666
  </OText>
667
667
 
668
- {order?.comment && (
668
+ {!!order?.comment && (
669
669
  <OText style={{ marginBottom: 5 }}>
670
670
  {`${t('ORDER_COMMENT', 'Order Comment')}: ${order?.comment}`}
671
671
  </OText>
@@ -129,8 +129,9 @@ const CartUI = (props: any) => {
129
129
  cartUuid: cart?.uuid,
130
130
  businessLogo: cart?.business?.logo,
131
131
  businessName: cart?.business?.name,
132
- cartTotal: cart?.total
133
- }, true)
132
+ cartTotal: cart?.total,
133
+ fromProductsList: isFromUpselling
134
+ })
134
135
  } else {
135
136
  const groupKeys: any = {}
136
137
  cartsAvailable.forEach((_cart: any) => {
@@ -146,12 +147,12 @@ const CartUI = (props: any) => {
146
147
  onNavigationRedirect('CheckoutNavigator', {
147
148
  screen: 'MultiCheckout',
148
149
  checkCarts: true
149
- }, true)
150
+ })
150
151
  } else {
151
152
  onNavigationRedirect('CheckoutNavigator', {
152
153
  screen: 'MultiCheckout',
153
154
  cartUuid: cartsAvailable[0]?.group?.uuid
154
- }, true)
155
+ })
155
156
  }
156
157
  }
157
158
  }
@@ -36,10 +36,16 @@ export const ProductOptionSubOptionUI = (props: any) => {
36
36
  setIsScrollAvailable,
37
37
  image,
38
38
  enableIntersection,
39
- onChange
39
+ usePizzaValidation,
40
+ pizzaState
40
41
  } = props
41
42
 
42
- const disableIncrement = option?.limit_suboptions_by_max ? balance === option?.max || state.quantity === suboption?.max : state.quantity === suboption?.max || (!state.selected && balance === option?.max)
43
+ const disableIncrement =
44
+ option?.with_half_option
45
+ ? pizzaState?.[`option:${option?.id}`]?.value === option?.max
46
+ : option?.limit_suboptions_by_max
47
+ ? (balance === option?.max || state.quantity === suboption.max)
48
+ : state.quantity === suboption?.max || (!state.selected && balance === option?.max)
43
49
  const price = option?.with_half_option && suboption?.half_price && state.position !== 'whole' ? suboption?.half_price : suboption?.price
44
50
 
45
51
  const theme = useTheme();
@@ -66,8 +72,9 @@ export const ProductOptionSubOptionUI = (props: any) => {
66
72
  const handleSuboptionClick = () => {
67
73
  toggleSelect()
68
74
  setIsDirty(true)
75
+ const minMaxValidation = option?.with_half_option ? usePizzaValidation : (balance === option?.max && option?.suboptions?.length > balance && !(option?.min === 1 && option?.max === 1))
69
76
 
70
- if (balance === option?.max && option?.suboptions?.length > balance && !(option?.min === 1 && option?.max === 1)) {
77
+ if (!state.selected && minMaxValidation) {
71
78
  setShowMessage(true)
72
79
  }
73
80
  }
@@ -87,13 +94,7 @@ export const ProductOptionSubOptionUI = (props: any) => {
87
94
  if (!(balance === option?.max && option?.suboptions?.length > balance && !(option?.min === 1 && option?.max === 1))) {
88
95
  setShowMessage(false)
89
96
  }
90
- }, [balance])
91
-
92
- useEffect(() => {
93
- if (!suboption?.preselected || !option?.respect_to) return
94
- const newState = { ...state, selected: suboption?.preselected, quantity: state.selected ? 0 : 1 }
95
- onChange(newState, suboption, option)
96
- }, [suboption, option])
97
+ }, [balance, pizzaState?.[`option:${option?.id}`]?.value])
97
98
 
98
99
  return (
99
100
  <InView onChange={(inView: boolean) => handleChangeInterSection(inView)} triggerOnce={true}>
@@ -129,7 +130,7 @@ export const ProductOptionSubOptionUI = (props: any) => {
129
130
  {suboption?.name}
130
131
  </OText>
131
132
  </IconControl>
132
- {option?.allow_suboption_quantity && state?.selected && (
133
+ {!(option?.max === 1 && option?.min === 1) && option?.allow_suboption_quantity && state?.selected && (
133
134
  <QuantityControl>
134
135
  <>
135
136
  <Checkbox disabled={disabled || state.quantity === 0} onPress={decrement}>
@@ -142,11 +143,11 @@ export const ProductOptionSubOptionUI = (props: any) => {
142
143
  <OText size={12}>
143
144
  {state.quantity}
144
145
  </OText>
145
- <Checkbox disabled={disabled || disableIncrement} onPress={increment}>
146
+ <Checkbox disabled={disabled || disableIncrement || usePizzaValidation} onPress={increment}>
146
147
  <IconAntDesign
147
148
  name='pluscircleo'
148
149
  size={iconsSize}
149
- color={disableIncrement || disabled ? theme.colors.disabled : theme.colors.primary}
150
+ color={disableIncrement || disabled || usePizzaValidation ? theme.colors.disabled : theme.colors.primary}
150
151
  />
151
152
  </Checkbox>
152
153
  </>
@@ -164,7 +165,7 @@ export const ProductOptionSubOptionUI = (props: any) => {
164
165
  style={styles.inverse}
165
166
  />
166
167
  </Circle>
167
- <Circle disabled={disabled} onPress={() => changePosition('whole')}>
168
+ <Circle disabled={disabled || (pizzaState?.[`option:${option?.id}`]?.value === option?.max)} onPress={() => changePosition('whole')}>
168
169
  <OIcon
169
170
  src={theme.images.general.half_f}
170
171
  color={state.selected && state.position === 'whole' ? theme.colors.primary : '#cbcbcb'}