ordering-ui-react-native 0.22.76 → 0.22.77-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.
Files changed (137) hide show
  1. package/package.json +5 -7
  2. package/src/components/BusinessesListing/index.tsx +1 -1
  3. package/src/components/Checkout/index.tsx +40 -39
  4. package/src/components/VerifyPhone/styles.tsx +1 -2
  5. package/src/context/OfflineActions/index.tsx +236 -0
  6. package/src/providers/AlertProvider.tsx +3 -1
  7. package/themes/business/src/components/AcceptOrRejectOrder/index.tsx +5 -3
  8. package/themes/business/src/components/AcceptOrRejectOrder/styles.tsx +1 -0
  9. package/themes/business/src/components/BusinessController/index.tsx +8 -3
  10. package/themes/business/src/components/BusinessProductList/index.tsx +3 -2
  11. package/themes/business/src/components/Chat/index.tsx +15 -3
  12. package/themes/business/src/components/DriverMap/index.tsx +44 -33
  13. package/themes/business/src/components/FloatingButton/index.tsx +3 -2
  14. package/themes/business/src/components/LanguageSelector/index.tsx +1 -1
  15. package/themes/business/src/components/LoginForm/index.tsx +123 -98
  16. package/themes/business/src/components/LogoutButton/index.tsx +13 -4
  17. package/themes/business/src/components/MapView/RenderMarker.tsx +146 -0
  18. package/themes/business/src/components/MapView/index.tsx +68 -142
  19. package/themes/business/src/components/NewOrderNotification/index.tsx +38 -54
  20. package/themes/business/src/components/OrderDetails/Business.tsx +56 -20
  21. package/themes/business/src/components/OrderDetails/Delivery.tsx +111 -42
  22. package/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +146 -36
  23. package/themes/business/src/components/OrderDetails/OrderHeaderComponent.tsx +51 -28
  24. package/themes/business/src/components/OrderDetails/styles.tsx +39 -3
  25. package/themes/business/src/components/OrderDetails/usePrinterCommands.tsx +17 -16
  26. package/themes/business/src/components/OrderDetailsLogistic/index.tsx +3 -2
  27. package/themes/business/src/components/OrderSummary/index.tsx +271 -176
  28. package/themes/business/src/components/OrdersListManager/index.tsx +13 -1
  29. package/themes/business/src/components/OrdersOption/index.tsx +207 -144
  30. package/themes/business/src/components/OrdersOption/styles.tsx +14 -0
  31. package/themes/business/src/components/PreviousMessages/index.tsx +26 -3
  32. package/themes/business/src/components/PreviousOrders/OrderItem.tsx +20 -8
  33. package/themes/business/src/components/PreviousOrders/index.tsx +74 -66
  34. package/themes/business/src/components/PreviousOrders/styles.tsx +2 -1
  35. package/themes/business/src/components/PrinterEdition/MessageAlert.tsx +33 -0
  36. package/themes/business/src/components/PrinterEdition/index.tsx +143 -75
  37. package/themes/business/src/components/PrinterEdition/printerList.tsx +23 -0
  38. package/themes/business/src/components/PrinterSettings/index.tsx +1 -1
  39. package/themes/business/src/components/ProductItemAccordion/index.tsx +15 -16
  40. package/themes/business/src/components/ReviewCustomer/index.tsx +2 -0
  41. package/themes/business/src/components/StoresList/index.tsx +2 -2
  42. package/themes/business/src/components/UserProfileForm/index.tsx +48 -10
  43. package/themes/business/src/components/UserProfileForm/styles.tsx +7 -0
  44. package/themes/business/src/components/WebsocketStatus/index.tsx +2 -2
  45. package/themes/business/src/config/currency.tsx +1010 -0
  46. package/themes/business/src/hooks/useLocation.tsx +16 -12
  47. package/themes/business/src/layouts/SafeAreaContainer.tsx +35 -19
  48. package/themes/business/src/types/index.tsx +26 -4
  49. package/themes/business/src/utils/index.tsx +26 -2
  50. package/themes/doordash/src/components/BusinessesListing/index.tsx +1 -1
  51. package/themes/doordash/src/components/LoginForm/index.tsx +1 -2
  52. package/themes/instacart/src/components/BusinessesListing/index.tsx +1 -1
  53. package/themes/kiosk/src/components/Checkout/index.tsx +9 -5
  54. package/themes/kiosk/src/components/CustomerName/index.tsx +1 -1
  55. package/themes/kiosk/src/components/NavBar/index.tsx +14 -14
  56. package/themes/kiosk/src/components/OptionCard/index.tsx +1 -1
  57. package/themes/kiosk/src/components/OrderTypeCardSelector/index.tsx +8 -10
  58. package/themes/kiosk/src/components/PaymentOptions/index.tsx +121 -57
  59. package/themes/kiosk/src/components/shared/OButton.tsx +5 -18
  60. package/themes/original/index.tsx +223 -219
  61. package/themes/original/src/components/AddressForm/index.tsx +76 -17
  62. package/themes/original/src/components/AppleLogin/index.tsx +3 -4
  63. package/themes/original/src/components/BusinessController/index.tsx +4 -2
  64. package/themes/original/src/components/BusinessItemAccordion/index.tsx +1 -1
  65. package/themes/original/src/components/BusinessListingSearch/BusinessSearchFooter.tsx +102 -90
  66. package/themes/original/src/components/BusinessListingSearch/BusinessSearchHeader.tsx +7 -3
  67. package/themes/original/src/components/BusinessListingSearch/index.tsx +8 -13
  68. package/themes/original/src/components/BusinessPreorder/index.tsx +30 -17
  69. package/themes/original/src/components/BusinessProductsList/SubcategoriesComponent/index.tsx +72 -69
  70. package/themes/original/src/components/BusinessProductsList/index.tsx +4 -5
  71. package/themes/original/src/components/BusinessProductsList/styles.tsx +0 -3
  72. package/themes/original/src/components/BusinessProductsListing/index.tsx +5 -4
  73. package/themes/original/src/components/BusinessesListing/Layout/Appointment/styles.tsx +1 -0
  74. package/themes/original/src/components/BusinessesListing/Layout/Original/styles.tsx +2 -1
  75. package/themes/original/src/components/Cart/index.tsx +42 -12
  76. package/themes/original/src/components/Checkout/index.tsx +126 -98
  77. package/themes/original/src/components/FloatingButton/index.tsx +1 -1
  78. package/themes/original/src/components/GPSButton/index.tsx +2 -1
  79. package/themes/original/src/components/GoogleMap/index.tsx +3 -2
  80. package/themes/original/src/components/Help/functions.tsx +76 -0
  81. package/themes/original/src/components/Help/index.tsx +74 -29
  82. package/themes/original/src/components/Help/styles.tsx +4 -1
  83. package/themes/original/src/components/HelpOptions/index.tsx +53 -0
  84. package/themes/original/src/components/HighestRatedBusinesses/index.tsx +1 -1
  85. package/themes/original/src/components/Home/index.tsx +36 -11
  86. package/themes/original/src/components/LastOrder/index.tsx +1 -1
  87. package/themes/original/src/components/LoginForm/Otp/index.tsx +1 -1
  88. package/themes/original/src/components/LoginForm/index.tsx +883 -852
  89. package/themes/original/src/components/MessageListing/index.tsx +1 -1
  90. package/themes/original/src/components/Messages/index.tsx +562 -555
  91. package/themes/original/src/components/MomentOption/TimeListItem.tsx +56 -0
  92. package/themes/original/src/components/MomentOption/index.tsx +141 -61
  93. package/themes/original/src/components/MomentOption/styles.tsx +1 -1
  94. package/themes/original/src/components/MomentSelector/index.tsx +5 -2
  95. package/themes/original/src/components/MultiCheckout/index.tsx +78 -33
  96. package/themes/original/src/components/MultiOrdersDetails/SingleOrderCard.tsx +2 -2
  97. package/themes/original/src/components/MultiOrdersDetails/index.tsx +2 -2
  98. package/themes/original/src/components/NavBar/index.tsx +6 -2
  99. package/themes/original/src/components/NotFoundSource/index.tsx +40 -39
  100. package/themes/original/src/components/NotFoundSource/styles.tsx +18 -9
  101. package/themes/original/src/components/OrderDetails/OrderEta.tsx +4 -3
  102. package/themes/original/src/components/OrderDetails/OrderHistory.tsx +11 -4
  103. package/themes/original/src/components/OrderDetails/index.tsx +44 -20
  104. package/themes/original/src/components/OrderDetails/styles.tsx +0 -1
  105. package/themes/original/src/components/OrderProgress/index.tsx +5 -4
  106. package/themes/original/src/components/OrderSummary/index.tsx +32 -11
  107. package/themes/original/src/components/OrderTypeSelector/index.tsx +120 -120
  108. package/themes/original/src/components/OrdersOption/index.tsx +325 -325
  109. package/themes/original/src/components/PaymentOptionWallet/index.tsx +1 -0
  110. package/themes/original/src/components/PaymentOptions/index.tsx +471 -459
  111. package/themes/original/src/components/PhoneInputNumber/index.tsx +92 -7
  112. package/themes/original/src/components/ProductItemAccordion/index.tsx +28 -37
  113. package/themes/original/src/components/ProductOptionSubOption/index.tsx +15 -14
  114. package/themes/original/src/components/ServiceForm/index.tsx +2 -2
  115. package/themes/original/src/components/SignupForm/index.tsx +1010 -971
  116. package/themes/original/src/components/SingleOrderCard/index.tsx +8 -5
  117. package/themes/original/src/components/SingleProductCard/index.tsx +2 -1
  118. package/themes/original/src/components/SingleProductCard/styles.tsx +0 -3
  119. package/themes/original/src/components/StripeCardsList/index.tsx +7 -1
  120. package/themes/original/src/components/StripeElementsForm/index.tsx +2 -2
  121. package/themes/original/src/components/TaxInformation/index.tsx +3 -2
  122. package/themes/original/src/components/UserDetails/index.tsx +17 -16
  123. package/themes/original/src/components/UserFormDetails/index.tsx +109 -67
  124. package/themes/original/src/components/UserVerification/index.tsx +70 -23
  125. package/themes/original/src/components/VerifyPhone/index.tsx +1 -1
  126. package/themes/original/src/components/shared/OInput.tsx +97 -97
  127. package/themes/original/src/components/shared/OModal.tsx +7 -2
  128. package/themes/original/src/providers/AlertProvider.tsx +1 -1
  129. package/themes/original/src/types/index.tsx +700 -695
  130. package/themes/original/src/utils/index.tsx +50 -34
  131. package/themes/uber-eats/src/components/BusinessesListing/index.tsx +1 -1
  132. package/themes/original/src/components/HelpAccountAndPayment/index.tsx +0 -62
  133. package/themes/original/src/components/HelpAccountAndPayment/styles.tsx +0 -12
  134. package/themes/original/src/components/HelpGuide/index.tsx +0 -68
  135. package/themes/original/src/components/HelpGuide/styles.tsx +0 -12
  136. package/themes/original/src/components/HelpOrder/index.tsx +0 -71
  137. package/themes/original/src/components/HelpOrder/styles.tsx +0 -13
@@ -1,12 +1,13 @@
1
1
  import React, { useEffect, useRef, useState } from 'react';
2
2
  import PhoneInput from "react-native-phone-number-input";
3
- import { StyleSheet, View } from 'react-native';
3
+ import { Pressable, StyleSheet, View } from 'react-native';
4
4
  import { useLanguage, useConfig } from 'ordering-components/native';
5
5
  import { useTheme } from 'styled-components/native';
6
6
  import { Wrapper } from './styles'
7
7
 
8
8
  import { PhoneInputParams } from '../../types';
9
9
  import { OIcon, OText } from '../shared';
10
+ import { OModal } from '../../../../../src/components/shared'
10
11
  import { findExitingCode, transformCountryCode } from '../../utils'
11
12
 
12
13
  export const PhoneInputNumber = (props: PhoneInputParams) => {
@@ -25,7 +26,8 @@ export const PhoneInputNumber = (props: PhoneInputParams) => {
25
26
  isDisabled,
26
27
  isStartValidation,
27
28
  changeCountry,
28
- updateStateWithSubmit
29
+ updateStateWithSubmit,
30
+ defaultCodeFallback
29
31
  } = props
30
32
 
31
33
  const theme = useTheme();
@@ -34,6 +36,13 @@ export const PhoneInputNumber = (props: PhoneInputParams) => {
34
36
  const [{ configs }] = useConfig()
35
37
  const phoneInput = useRef<PhoneInput>(null);
36
38
  const [userphoneNumber, setUserphoneNumber] = useState('');
39
+ const [countryPhoneSuboptions, setCountryPhoneSuboptions] = useState({
40
+ open: false,
41
+ options: []
42
+ })
43
+ const isDisableNumberValidation = parseInt(configs?.validation_phone_number_lib?.value ?? 1, 10)
44
+ const countriesWithSubOptions = ['PR']
45
+ const codesStartsWithZero: any = ['44']
37
46
 
38
47
  const style = StyleSheet.create({
39
48
  input: {
@@ -62,13 +71,22 @@ export const PhoneInputNumber = (props: PhoneInputParams) => {
62
71
  useEffect(() => {
63
72
  if ((defaultValue && userphoneNumber) || !defaultValue) {
64
73
  if (userphoneNumber) {
65
- const checkValid = phoneInput.current?.isValidNumber(userphoneNumber);
74
+ const validationsForUK = ['01', '02', '07', '0800', '0808', '0845', '0870', '0871']
75
+
76
+ let isPossibly = false
77
+ let numberWithoutCountryCode = ''
66
78
  const callingCode = phoneInput.current?.getCallingCode();
79
+ const cellphone = userphoneNumber.slice(0, 0) + userphoneNumber.slice(1, userphoneNumber.length)
80
+ if (codesStartsWithZero.includes(callingCode)) {
81
+ numberWithoutCountryCode = cellphone.replace(callingCode || '', '')
82
+ const result = validationsForUK.some(areaCode => numberWithoutCountryCode?.startsWith(areaCode))
83
+ isPossibly = result && numberWithoutCountryCode?.length >= 10 && numberWithoutCountryCode?.length < 12
84
+ }
85
+ const checkValid = phoneInput.current?.isValidNumber(userphoneNumber);
67
86
  const formattedNumber = phoneInput.current?.getNumberAfterPossiblyEliminatingZero();
68
87
  const regex = /^[0-9]*$/
69
- const cellphone = userphoneNumber.slice(0, 0) + userphoneNumber.slice(1, userphoneNumber.length)
70
88
  const validNumber = regex.test(cellphone)
71
- if ((!checkValid && formattedNumber?.number) || !validNumber) {
89
+ if (((!checkValid && formattedNumber?.number && !isPossibly) || !validNumber) && !!isDisableNumberValidation) {
72
90
  handleData && handleData({
73
91
  ...data,
74
92
  error: t('INVALID_ERROR_PHONE_NUMBER', 'The Phone Number field is invalid')
@@ -80,8 +98,11 @@ export const PhoneInputNumber = (props: PhoneInputParams) => {
80
98
  error: '',
81
99
  phone: {
82
100
  country_phone_code: callingCode,
83
- cellphone: formattedNumber?.number
101
+ cellphone: !isDisableNumberValidation ? cellphone.slice(callingCode?.length) : formattedNumber?.number
84
102
  }
103
+ }, {
104
+ countryCallingCode: callingCode,
105
+ number: numberWithoutCountryCode,
85
106
  })
86
107
  } else {
87
108
  handleData && handleData({
@@ -109,6 +130,37 @@ export const PhoneInputNumber = (props: PhoneInputParams) => {
109
130
  }
110
131
  }, [defaultValue])
111
132
 
133
+ useEffect(() => {
134
+ if (defaultCodeFallback && countriesWithSubOptions.includes(defaultCode) && phoneInput.current) {
135
+ phoneInput.current?.setState({
136
+ ...phoneInput.current.state,
137
+ code: `${defaultCodeFallback}`
138
+ })
139
+ }
140
+ }, [phoneInput.current])
141
+
142
+ const _changeCountry = (c) => {
143
+ changeCountry?.(c)
144
+ if (c.callingCode?.length > 1) {
145
+ setCountryPhoneSuboptions({
146
+ open: true,
147
+ options: c.callingCode
148
+ })
149
+ }
150
+ }
151
+
152
+ const handleSelectCallingCode = (option: any) => {
153
+ setCountryPhoneSuboptions({
154
+ open: false,
155
+ options: []
156
+ })
157
+ handleChangeNumber(`+${option}`)
158
+ phoneInput.current?.setState({
159
+ ...phoneInput.current.state,
160
+ code: `${option}`
161
+ })
162
+ }
163
+
112
164
  return (
113
165
  <Wrapper onPress={() => forwardRef?.current?.focus?.()}>
114
166
  {(isStartValidation && userphoneNumber === '') && (
@@ -130,7 +182,7 @@ export const PhoneInputNumber = (props: PhoneInputParams) => {
130
182
  : findExitingCode(configs?.default_country_code?.value?.toUpperCase())}
131
183
  onChangeFormattedText={(text: string) => handleChangeNumber(text)}
132
184
  withDarkTheme
133
- onChangeCountry={(country) => changeCountry?.(country)}
185
+ onChangeCountry={(country: any) => _changeCountry?.(country)}
134
186
  countryPickerProps={{ withAlphaFilter: true }}
135
187
  textContainerStyle={{ ...style.input, ...inputStyle ? inputStyle : {} }}
136
188
  textInputStyle={textStyle}
@@ -151,6 +203,39 @@ export const PhoneInputNumber = (props: PhoneInputParams) => {
151
203
  {data.error}
152
204
  </OText>
153
205
  )}
206
+ <OModal
207
+ open={countryPhoneSuboptions.open}
208
+ onClose={() => setCountryPhoneSuboptions({
209
+ open: false,
210
+ options: []
211
+ })}
212
+ title={t('SELECT_THE_PHONE_CODE', 'Select the phone code')}
213
+ entireModal
214
+ >
215
+ <View
216
+ style={{
217
+ alignItems: 'center'
218
+ }}
219
+ >
220
+ {countryPhoneSuboptions.options.map((option: any) => (
221
+ <Pressable
222
+ style={{
223
+ margin: 10,
224
+ padding: 10,
225
+ borderBottomColor: '#ccc',
226
+ borderBottomWidth: 1,
227
+ width: '100%'
228
+ }}
229
+ key={option}
230
+ onPress={() => handleSelectCallingCode(option)}
231
+ >
232
+ <OText>
233
+ {`+${option}`}
234
+ </OText>
235
+ </Pressable>
236
+ ))}
237
+ </View>
238
+ </OModal>
154
239
  </Wrapper>
155
240
  )
156
241
  }
@@ -1,6 +1,6 @@
1
1
  import React, { useEffect, useState } from 'react'
2
2
  import { View, Animated, StyleSheet, TouchableOpacity } from 'react-native'
3
- import { useUtils, useLanguage, useOrder } from 'ordering-components/native'
3
+ import { useUtils, useLanguage, useOrder, ProductItemAccordion as ProductItemAccordionController } from 'ordering-components/native'
4
4
  import { useTheme } from 'styled-components/native';
5
5
  import MaterialCommunityIcon from 'react-native-vector-icons/MaterialCommunityIcons'
6
6
  import RNPickerSelect from 'react-native-picker-select'
@@ -24,7 +24,7 @@ import { OIcon, OText, OAlert, OModal } from '../shared'
24
24
 
25
25
  import { ProductItemAccordionParams } from '../../types'
26
26
 
27
- export const ProductItemAccordion = (props: ProductItemAccordionParams) => {
27
+ export const ProductItemAccordionUI = (props: ProductItemAccordionParams) => {
28
28
 
29
29
  const {
30
30
  isDisabledEdit,
@@ -36,6 +36,7 @@ export const ProductItemAccordion = (props: ProductItemAccordionParams) => {
36
36
  onDeleteProduct,
37
37
  onEditProduct,
38
38
  isFromCheckout,
39
+ productInfo
39
40
  } = props
40
41
 
41
42
  const theme = useTheme();
@@ -46,6 +47,14 @@ export const ProductItemAccordion = (props: ProductItemAccordionParams) => {
46
47
  const hideProductDummyLogo = theme?.business_view?.components?.products?.components?.product?.components?.dummy?.hidden
47
48
  const hideProductCommentHide = isFromCheckout && theme?.checkout?.components?.cart?.components?.product?.components?.comments?.hidden
48
49
 
50
+ const styles = StyleSheet.create({
51
+ productImage: {
52
+ borderRadius: 7.6,
53
+ width: 48,
54
+ height: 48
55
+ }
56
+ })
57
+
49
58
  const pickerStyle = StyleSheet.create({
50
59
  inputAndroid: {
51
60
  width: 45,
@@ -91,24 +100,6 @@ export const ProductItemAccordion = (props: ProductItemAccordionParams) => {
91
100
  const [isServiceOpen, setIsServiceOpen] = useState(false)
92
101
  const [productQuantityState, setProductQuantityState] = useState<any>(product.quantity.toString())
93
102
 
94
- const productInfo = () => {
95
- if (isCartProduct) {
96
- const ingredients = JSON.parse(JSON.stringify(Object.values(product.ingredients ?? {})))
97
- let options = JSON.parse(JSON.stringify(Object.values(product.options ?? {})))
98
-
99
- options = options.map((option: any) => {
100
- option.suboptions = Object.values(option.suboptions ?? {})
101
- return option
102
- })
103
- return {
104
- ...productInfo,
105
- ingredients,
106
- options
107
- }
108
- }
109
- return product
110
- }
111
-
112
103
  const handleEditProduct = (curProduct: any) => {
113
104
  if (!curProduct?.calendar_event) {
114
105
  onEditProduct && onEditProduct(curProduct)
@@ -154,8 +145,8 @@ export const ProductItemAccordion = (props: ProductItemAccordionParams) => {
154
145
  isValid={product?.valid ?? true}
155
146
  onPress={
156
147
  (!product?.valid_menu && isCartProduct) ||
157
- !(productInfo().ingredients.length > 0 || productInfo().options.length > 0 || !!product.comment)
158
- ? null : () => setActiveState(!isActive)
148
+ !(productInfo.ingredients.length > 0 || productInfo.options.length > 0 || !!product.comment)
149
+ ? null : () => setActiveState(!isActive)
159
150
  }
160
151
  >
161
152
  <View style={{ flexDirection: 'row', alignItems: 'flex-start' }}>
@@ -246,7 +237,7 @@ export const ProductItemAccordion = (props: ProductItemAccordionParams) => {
246
237
  <View style={{ display: 'flex', flexDirection: 'column', flex: 1, alignItems: 'flex-end', maxWidth: 100 }}>
247
238
  <View style={{ flexDirection: 'row' }}>
248
239
  <OText size={12} lineHeight={18} weight={'400'}>{parsePrice(product.total || product.price)}</OText>
249
- {(productInfo().ingredients.length > 0 || productInfo().options.length > 0 || !!product.comment) && (
240
+ {(productInfo.ingredients.length > 0 || productInfo.options.length > 0 || !!product.comment) && (
250
241
  <MaterialCommunityIcon name='chevron-down' size={18} />
251
242
  )}
252
243
  </View>
@@ -290,20 +281,20 @@ export const ProductItemAccordion = (props: ProductItemAccordionParams) => {
290
281
  <View style={{ display: isActive ? 'flex' : 'none', paddingStart: isFromCheckout ? 100 : 40, marginTop: isFromCheckout ? -80 : -30 }}>
291
282
  <Animated.View>
292
283
  <AccordionContent>
293
- {productInfo().ingredients.length > 0 && productInfo().ingredients.some((ingredient: any) => !ingredient.selected) && (
284
+ {productInfo.ingredients.length > 0 && productInfo.ingredients.some((ingredient: any) => !ingredient.selected) && (
294
285
  <ProductOptionsList>
295
286
  <OText size={10} color={theme.colors.textSecondary}>{t('INGREDIENTS', 'Ingredients')}</OText>
296
- {productInfo().ingredients.map((ingredient: any, i) => !ingredient.selected && (
287
+ {productInfo.ingredients.map((ingredient: any, i) => !ingredient.selected && (
297
288
  <OText size={10} color={theme.colors.textThird} key={ingredient.id + i} style={{ marginLeft: 10 }}>{t('NO', 'No')} {ingredient.name}</OText>
298
289
  ))}
299
290
  </ProductOptionsList>
300
291
  )}
301
- {productInfo().options.length > 0 && (
292
+ {productInfo.options.length > 0 && (
302
293
  <ProductOptionsList>
303
- {productInfo().options.sort((a: any, b: any) => a.rank - b.rank).map((option: any) => (
294
+ {productInfo.options.map((option: any) => (
304
295
  <ProductOption key={option.id}>
305
296
  <OText size={10} color={theme.colors.textSecondary}>{option.name}</OText>
306
- {option.suboptions.map((suboption: any) => (
297
+ {option.suboptions.sort((a: any, b: any) => a.rank - b.rank).map((suboption: any) => (
307
298
  <ProductSubOption key={suboption.id}>
308
299
  <OText size={10} color={theme.colors.textThird}>
309
300
  {getFormattedSubOptionName({
@@ -350,13 +341,13 @@ export const ProductItemAccordion = (props: ProductItemAccordionParams) => {
350
341
  )
351
342
  }
352
343
 
353
- const styles = StyleSheet.create({
354
- productImage: {
355
- borderRadius: 7.6,
356
- width: 48,
357
- height: 48
358
- },
359
- test: {
360
- overflow: 'hidden',
344
+ export const ProductItemAccordion = (props: any) => {
345
+ const productItemAccordionProps = {
346
+ ...props,
347
+ UIComponent: ProductItemAccordionUI
361
348
  }
362
- })
349
+
350
+ return (
351
+ <ProductItemAccordionController {...productItemAccordionProps} />
352
+ )
353
+ }
@@ -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'}
@@ -143,7 +143,7 @@ const ServiceFormUI = (props: ServiceFormParams) => {
143
143
  const valid = busyTimes.some(item => {
144
144
  return (moment.utc(item?.start).local().valueOf() <= moment(selectedMoment).valueOf() &&
145
145
  moment(selectedMoment).valueOf() < moment.utc(item?.end).local().valueOf()) ||
146
- (moment.utc(item?.start).local().valueOf() < moment(selectedMoment).add(duration, 'minutes').valueOf() &&
146
+ (moment.utc(item?.start).local().valueOf() < moment(selectedMoment).valueOf() &&
147
147
  moment(selectedMoment).add(duration, 'minutes').valueOf() < moment.utc(item?.end).local().valueOf())
148
148
  })
149
149
  return valid
@@ -259,7 +259,7 @@ const ServiceFormUI = (props: ServiceFormParams) => {
259
259
  }
260
260
 
261
261
  useEffect(() => {
262
- if (selectDate === null || currentProfessional === null) return
262
+ if (selectDate === null || !currentProfessional?.schedule) return
263
263
  const _times = getTimes(selectDate, currentProfessional)
264
264
  setTimeList(_times)
265
265
  }, [selectDate, currentProfessional])