ordering-ui-react-native 0.14.92 → 0.14.93-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 (121) hide show
  1. package/package.json +6 -3
  2. package/src/DeliveryApp.tsx +32 -1
  3. package/src/components/BusinessTypeFilter/index.tsx +9 -2
  4. package/src/components/BusinessTypeFilter/styles.tsx +1 -1
  5. package/src/components/BusinessesListing/index.tsx +1 -1
  6. package/src/components/Cart/index.tsx +1 -1
  7. package/src/components/Checkout/index.tsx +0 -1
  8. package/src/components/Home/index.tsx +3 -5
  9. package/src/components/LanguageSelector/index.tsx +65 -97
  10. package/src/components/LanguageSelector/styles.tsx +4 -17
  11. package/src/components/Messages/index.tsx +38 -30
  12. package/src/components/MomentOption/index.tsx +3 -1
  13. package/src/components/OrderDetails/index.tsx +26 -5
  14. package/src/components/PaymentOptions/index.tsx +7 -16
  15. package/src/components/PaymentOptionsWebView/index.tsx +123 -124
  16. package/src/components/ProductForm/index.tsx +1 -1
  17. package/src/components/ProductForm/styles.tsx +1 -0
  18. package/src/components/StripeElementsForm/index.tsx +27 -48
  19. package/src/components/UserProfileForm/index.tsx +35 -1
  20. package/src/components/VerifyPhone/styles.tsx +1 -2
  21. package/src/config.json +0 -2
  22. package/src/pages/Checkout.tsx +1 -1
  23. package/src/providers/AlertProvider.tsx +4 -1
  24. package/src/types/index.tsx +2 -9
  25. package/src/utils/index.tsx +2 -1
  26. package/themes/business/index.tsx +2 -0
  27. package/themes/business/src/components/Chat/index.tsx +32 -31
  28. package/themes/business/src/components/OrderDetails/Business.tsx +1 -0
  29. package/themes/business/src/components/OrderDetails/OrderHeaderComponent.tsx +85 -17
  30. package/themes/business/src/components/OrdersListManager/index.tsx +871 -0
  31. package/themes/business/src/components/OrdersListManager/styles.tsx +123 -0
  32. package/themes/business/src/components/OrdersListManager/utils.tsx +216 -0
  33. package/themes/business/src/components/OrdersOption/index.tsx +18 -68
  34. package/themes/business/src/components/OrdersOption/styles.tsx +2 -5
  35. package/themes/business/src/components/PreviousOrders/index.tsx +80 -23
  36. package/themes/doordash/src/components/BusinessesListing/index.tsx +1 -1
  37. package/themes/doordash/src/components/LoginForm/index.tsx +1 -2
  38. package/themes/instacart/src/components/BusinessesListing/index.tsx +1 -1
  39. package/themes/kiosk/src/components/BusinessController/index.tsx +27 -6
  40. package/themes/kiosk/src/components/BusinessController/styles.tsx +1 -1
  41. package/themes/kiosk/src/components/BusinessProductsListing/index.tsx +51 -24
  42. package/themes/kiosk/src/components/Cart/index.tsx +1 -1
  43. package/themes/kiosk/src/components/CartBottomSheet/index.tsx +1 -1
  44. package/themes/kiosk/src/components/CartBottomSheet/styles.tsx +1 -1
  45. package/themes/kiosk/src/components/CartContent/index.tsx +13 -3
  46. package/themes/kiosk/src/components/CartItem/index.tsx +20 -8
  47. package/themes/kiosk/src/components/CategoriesMenu/index.tsx +7 -5
  48. package/themes/kiosk/src/components/CustomerName/index.tsx +89 -88
  49. package/themes/kiosk/src/components/Intro/index.tsx +13 -13
  50. package/themes/kiosk/src/components/LanguageSelector/index.tsx +12 -8
  51. package/themes/kiosk/src/components/NavBar/index.tsx +14 -14
  52. package/themes/kiosk/src/components/OptionCard/index.tsx +1 -1
  53. package/themes/kiosk/src/components/OrderDetails/index.tsx +2 -2
  54. package/themes/kiosk/src/components/OrderSummary/index.tsx +1 -1
  55. package/themes/kiosk/src/components/OrderTypeCardSelector/index.tsx +10 -12
  56. package/themes/kiosk/src/components/ProductForm/index.tsx +172 -124
  57. package/themes/kiosk/src/components/ProductForm/styles.tsx +1 -1
  58. package/themes/kiosk/src/components/ProductOption/index.tsx +1 -0
  59. package/themes/kiosk/src/components/ProductOption/styles.tsx +1 -0
  60. package/themes/kiosk/src/components/UpsellingProducts/index.tsx +48 -34
  61. package/themes/kiosk/src/components/shared/OButton.tsx +5 -18
  62. package/themes/kiosk/src/components/shared/OCard.tsx +112 -78
  63. package/themes/original/index.tsx +34 -6
  64. package/themes/original/src/components/AddressForm/index.tsx +15 -10
  65. package/themes/original/src/components/AddressList/index.tsx +27 -1
  66. package/themes/original/src/components/AnalyticsSegment/index.tsx +127 -0
  67. package/themes/original/src/components/BusinessBasicInformation/index.tsx +75 -40
  68. package/themes/original/src/components/BusinessController/index.tsx +34 -18
  69. package/themes/original/src/components/BusinessMenuList/index.tsx +14 -5
  70. package/themes/original/src/components/BusinessPreorder/index.tsx +142 -121
  71. package/themes/original/src/components/BusinessProductsCategories/index.tsx +7 -5
  72. package/themes/original/src/components/BusinessProductsList/index.tsx +52 -8
  73. package/themes/original/src/components/BusinessProductsListing/index.tsx +21 -15
  74. package/themes/original/src/components/BusinessReviews/index.tsx +4 -3
  75. package/themes/original/src/components/BusinessesListing/index.tsx +39 -52
  76. package/themes/original/src/components/Cart/index.tsx +42 -9
  77. package/themes/original/src/components/CartContent/index.tsx +2 -2
  78. package/themes/original/src/components/Checkout/index.tsx +56 -32
  79. package/themes/original/src/components/Checkout/styles.tsx +7 -0
  80. package/themes/original/src/components/CouponControl/index.tsx +1 -0
  81. package/themes/original/src/components/DriverTips/index.tsx +1 -1
  82. package/themes/original/src/components/ForgotPasswordForm/index.tsx +8 -12
  83. package/themes/original/src/components/HighestRatedBusinesses/index.tsx +105 -90
  84. package/themes/original/src/components/LoginForm/index.tsx +83 -68
  85. package/themes/original/src/components/Messages/index.tsx +52 -45
  86. package/themes/original/src/components/Messages/styles.tsx +1 -3
  87. package/themes/original/src/components/MomentOption/index.tsx +127 -152
  88. package/themes/original/src/components/MomentOption/styles.tsx +42 -18
  89. package/themes/original/src/components/OrderDetails/index.tsx +103 -124
  90. package/themes/original/src/components/OrderDetails/styles.tsx +3 -1
  91. package/themes/original/src/components/OrderProgress/index.tsx +5 -6
  92. package/themes/original/src/components/OrderSummary/index.tsx +34 -1
  93. package/themes/original/src/components/OrdersOption/index.tsx +15 -46
  94. package/themes/original/src/components/OrdersOption/styles.tsx +0 -6
  95. package/themes/original/src/components/PaymentOptions/index.tsx +24 -25
  96. package/themes/original/src/components/PhoneInputNumber/index.tsx +15 -8
  97. package/themes/original/src/components/PlaceSpot/index.tsx +114 -0
  98. package/themes/original/src/components/PlaceSpot/styles.tsx +11 -0
  99. package/themes/original/src/components/PreviousOrders/index.tsx +19 -13
  100. package/themes/original/src/components/ProductForm/index.tsx +154 -105
  101. package/themes/original/src/components/ProductForm/styles.tsx +5 -3
  102. package/themes/original/src/components/ProductOptionSubOption/index.tsx +6 -1
  103. package/themes/original/src/components/ReviewOrder/index.tsx +10 -9
  104. package/themes/original/src/components/ReviewProducts/index.tsx +1 -1
  105. package/themes/original/src/components/SignupForm/index.tsx +173 -154
  106. package/themes/original/src/components/SingleProductCard/index.tsx +6 -13
  107. package/themes/original/src/components/SingleProductCard/styles.tsx +1 -1
  108. package/themes/original/src/components/StripeElementsForm/index.tsx +55 -72
  109. package/themes/original/src/components/UpsellingProducts/index.tsx +6 -6
  110. package/themes/original/src/components/UserDetails/index.tsx +4 -95
  111. package/themes/original/src/components/UserFormDetails/index.tsx +2 -14
  112. package/themes/original/src/components/UserProfile/index.tsx +16 -11
  113. package/themes/original/src/components/UserProfileForm/index.tsx +16 -8
  114. package/themes/original/src/components/VerifyPhone/index.tsx +10 -7
  115. package/themes/original/src/components/VerifyPhone/styles.tsx +2 -1
  116. package/themes/original/src/components/shared/HeaderTitle.tsx +20 -0
  117. package/themes/original/src/components/shared/index.tsx +2 -0
  118. package/themes/original/src/types/index.tsx +25 -9
  119. package/themes/single-business/src/components/OrderTypeSelector/index.tsx +5 -5
  120. package/themes/uber-eats/src/components/BusinessesListing/index.tsx +1 -1
  121. package/src/components/StripeMethodForm/index.tsx +0 -163
@@ -26,10 +26,13 @@ import {
26
26
  import { Fade, Placeholder, PlaceholderLine } from 'rn-placeholder';
27
27
  const types = ['food', 'laundry', 'alcohol', 'groceries'];
28
28
 
29
+ let BusinessInformation: null | React.ElementType = null
30
+ let BusinessReviews: null | React.ElementType = null
31
+
29
32
  export const BusinessBasicInformation = (
30
33
  props: BusinessBasicInformationParams,
31
34
  ) => {
32
- const { navigation, businessState, isBusinessInfoShow, logo, header } = props;
35
+ const { navigation, businessState, isBusinessInfoShow, logo, header, isPreOrder } = props;
33
36
  const { business, loading } = businessState;
34
37
 
35
38
  const theme = useTheme();
@@ -38,6 +41,25 @@ export const BusinessBasicInformation = (
38
41
  const [{ parsePrice, parseDistance, optimizeImage }] = useUtils();
39
42
  const [openBusinessInformation, setOpenBusinessInformation] = useState(false);
40
43
  const [openBusinessReviews, setOpenBusinessReviews] = useState(false);
44
+ const [businessInformationObtained, setBusinessInformationObtained] = useState(false)
45
+ const [businessReviewsObtained, setBusinessReviewsObtainedbtained] = useState(false)
46
+
47
+ const handleClickBusinessInformation = () => {
48
+ if (!businessInformationObtained) {
49
+ BusinessInformation = require('../BusinessInformation').BusinessInformation
50
+ setBusinessInformationObtained(true)
51
+ }
52
+ setOpenBusinessInformation(true)
53
+ }
54
+
55
+ const handleClickBusinessReviews = () => {
56
+ if (!businessReviewsObtained) {
57
+ BusinessReviews = require('../BusinessReviews').BusinessReviews
58
+ setBusinessReviewsObtainedbtained(true)
59
+ }
60
+ setOpenBusinessReviews(true)
61
+ }
62
+
41
63
  const getBusinessType = () => {
42
64
  if (Object.keys(business).length <= 0) return t('GENERAL', 'General');
43
65
  const _types: any = [];
@@ -51,7 +73,7 @@ export const BusinessBasicInformation = (
51
73
  return _types.join(', ');
52
74
  };
53
75
 
54
-
76
+
55
77
  useEffect(() => {
56
78
  if (businessState?.loading) return
57
79
  let timeout: any = null
@@ -65,16 +87,16 @@ export const BusinessBasicInformation = (
65
87
  })
66
88
  }
67
89
  if (lapse) {
68
- const to = currentDate.hour(lapse.close.hour).minute(lapse.close.minute)
69
- const timeToClose = (to.unix() - currentDate.unix()) * 1000
70
- timeout = setTimeout(() => {
71
- navigation.navigate('BusinessPreorder', { business: businessState?.business, handleBusinessClick: () => navigation?.goBack() })
72
- }, timeToClose)
90
+ const to = currentDate.hour(lapse.close.hour).minute(lapse.close.minute)
91
+ const timeToClose = (to.unix() - currentDate.unix()) * 1000
92
+ timeout = setTimeout(() => {
93
+ navigation.navigate('BusinessPreorder', { business: businessState?.business, handleBusinessClick: () => navigation?.goBack() })
94
+ }, timeToClose)
73
95
  }
74
96
  return () => {
75
- timeout && clearTimeout(timeout)
97
+ timeout && clearTimeout(timeout)
76
98
  }
77
- }, [businessState?.business])
99
+ }, [businessState?.business])
78
100
 
79
101
  return (
80
102
  <BusinessContainer>
@@ -90,7 +112,7 @@ export const BusinessBasicInformation = (
90
112
  optimizeImage(businessState?.business?.header, 'h_250,c_limit'),
91
113
  }}>
92
114
  {!isBusinessInfoShow && (
93
- <WrapBusinessInfo onPress={() => setOpenBusinessInformation(true)}>
115
+ <WrapBusinessInfo onPress={() => handleClickBusinessInformation()}>
94
116
  <OIcon src={theme.images.general.info} width={24} />
95
117
  </WrapBusinessInfo>
96
118
  )}
@@ -181,13 +203,17 @@ export const BusinessBasicInformation = (
181
203
  <WrapReviews>
182
204
  {!isBusinessInfoShow && (
183
205
  <>
184
- <TouchableOpacity onPress={() => navigation.navigate('BusinessPreorder', { business: businessState?.business, handleBusinessClick: () => navigation?.goBack() })}>
185
- <OText color={theme.colors.textSecondary} style={{ textDecorationLine: 'underline' }}>
186
- {t('PRE_ORDER', 'Preorder')}
187
- </OText>
188
- </TouchableOpacity>
189
- <OText size={12} color={theme.colors.textSecondary}>{' \u2022 '}</OText>
190
- <TouchableOpacity onPress={() => setOpenBusinessReviews(true)}>
206
+ {isPreOrder && (
207
+ <>
208
+ <TouchableOpacity onPress={() => navigation.navigate('BusinessPreorder', { business: businessState?.business, handleBusinessClick: () => navigation?.goBack() })}>
209
+ <OText color={theme.colors.textSecondary} style={{ textDecorationLine: 'underline' }}>
210
+ {t('PRE_ORDER', 'Preorder')}
211
+ </OText>
212
+ </TouchableOpacity>
213
+ <OText size={12} color={theme.colors.textSecondary}>{' \u2022 '}</OText>
214
+ </>
215
+ )}
216
+ <TouchableOpacity onPress={() => handleClickBusinessReviews()}>
191
217
  <OText color={theme.colors.textSecondary} style={{ textDecorationLine: 'underline' }}>
192
218
  {t('REVIEWS', 'Reviews')}
193
219
  </OText>
@@ -196,28 +222,37 @@ export const BusinessBasicInformation = (
196
222
  )}
197
223
  </WrapReviews>
198
224
  </BusinessInfo>
199
- <OModal
200
- titleSectionStyle={styles.modalTitleSectionStyle}
201
- open={openBusinessInformation}
202
- onClose={() => setOpenBusinessInformation(false)}
203
- isNotDecoration>
204
- <BusinessInformation
205
- businessState={businessState}
206
- business={business}
207
- />
208
- </OModal>
209
- <OModal
210
- entireModal
211
- titleSectionStyle={styles.modalTitleSectionStyle}
212
- open={openBusinessReviews}
213
- onClose={() => setOpenBusinessReviews(false)}
214
- isNotDecoration>
215
- <BusinessReviews
216
- businessState={businessState}
217
- businessId={business.id}
218
- reviews={business.reviews?.reviews}
219
- />
220
- </OModal>
225
+ {businessInformationObtained ? (
226
+ <OModal
227
+ titleSectionStyle={styles.modalTitleSectionStyle}
228
+ open={openBusinessInformation}
229
+ onClose={() => setOpenBusinessInformation(false)}
230
+ isNotDecoration>
231
+ {BusinessInformation && (
232
+ <BusinessInformation
233
+ businessState={businessState}
234
+ business={business}
235
+ />
236
+ )}
237
+ </OModal>
238
+ ) : null}
239
+ {businessReviewsObtained ? (
240
+ <OModal
241
+ entireModal
242
+ titleSectionStyle={styles.modalTitleSectionStyle}
243
+ open={openBusinessReviews}
244
+ onClose={() => setOpenBusinessReviews(false)}
245
+ isNotDecoration
246
+ >
247
+ {BusinessReviews && (
248
+ <BusinessReviews
249
+ businessState={businessState}
250
+ businessId={business.id}
251
+ reviews={business.reviews?.reviews}
252
+ />
253
+ )}
254
+ </OModal>
255
+ ) : null}
221
256
  </BusinessContainer>
222
257
  );
223
258
  };
@@ -262,4 +297,4 @@ const styles = StyleSheet.create({
262
297
  zIndex: 100,
263
298
  left: 40
264
299
  },
265
- });
300
+ });
@@ -4,6 +4,7 @@ import {
4
4
  useUtils,
5
5
  useOrder,
6
6
  useLanguage,
7
+ useConfig
7
8
  } from 'ordering-components/native';
8
9
  import { OIcon, OText } from '../shared';
9
10
  import { StyleSheet, View } from 'react-native';
@@ -25,13 +26,26 @@ import FontAwesomeIcon from 'react-native-vector-icons/FontAwesome5';
25
26
  import FastImage from 'react-native-fast-image'
26
27
 
27
28
  export const BusinessControllerUI = (props: BusinessControllerParams) => {
28
- const { business, handleClick, navigation, isBusinessOpen } = props;
29
- const [{ parsePrice, parseDistance, parseNumber, optimizeImage }] =
30
- useUtils();
29
+ const {
30
+ business,
31
+ handleClick,
32
+ navigation,
33
+ isBusinessOpen,
34
+ style,
35
+ businessHeader,
36
+ businessFeatured,
37
+ businessLogo,
38
+ businessReviews,
39
+ businessDeliveryPrice,
40
+ businessDeliveryTime,
41
+ businessPickupTime,
42
+ businessDistance
43
+ } = props;
44
+ const [{ parsePrice, parseDistance, parseNumber, optimizeImage }] = useUtils();
31
45
  const [orderState] = useOrder();
46
+ const [configState] = useConfig();
32
47
  const [, t] = useLanguage();
33
48
  const theme = useTheme()
34
-
35
49
  const styles = StyleSheet.create({
36
50
  headerStyle: {
37
51
  borderTopLeftRadius: 7.6,
@@ -111,18 +125,18 @@ export const BusinessControllerUI = (props: BusinessControllerParams) => {
111
125
  <FastImage
112
126
  style={{ height: 120 }}
113
127
  source={{
114
- uri: optimizeImage(business?.header, 'h_120,c_limit'),
115
- priority: FastImage.priority.normal,
128
+ uri: optimizeImage(businessHeader || business?.header, 'h_500,c_limit'),
129
+ priority: FastImage.priority.normal,
116
130
  }}
117
131
  resizeMode={FastImage.resizeMode.cover}
118
132
  />
119
- {business?.featured && (
133
+ {(businessFeatured ?? business?.featured) && (
120
134
  <View style={styles.featured}>
121
135
  <FontAwesomeIcon name="crown" size={26} color="gold" />
122
136
  </View>
123
137
  )}
124
138
  <BusinessState>
125
- {!isBusinessOpen && (
139
+ {!isBusinessOpen && (configState?.configs?.preorder_status_enabled?.value === '1') && (
126
140
  <View style={styles.businessStateView}>
127
141
  <OText
128
142
  color={theme.colors.textThird}
@@ -140,17 +154,17 @@ export const BusinessControllerUI = (props: BusinessControllerParams) => {
140
154
  <FastImage
141
155
  style={{ width: 56, height: 56 }}
142
156
  source={{
143
- uri: optimizeImage(business?.logo, 'h_60,c_limit'),
144
- priority: FastImage.priority.normal,
157
+ uri: optimizeImage(businessLogo || business?.logo, 'h_150,c_limit'),
158
+ priority: FastImage.priority.normal,
145
159
  }}
146
160
  resizeMode={FastImage.resizeMode.cover}
147
161
  />
148
162
  </BusinessLogo>
149
- {business?.reviews?.total > 0 && (
163
+ {(businessReviews?.reviews?.total > 0 ?? business?.reviews?.total > 0) && (
150
164
  <Reviews>
151
165
  <OIcon src={theme.images.general.star} width={12} style={styles.starIcon} />
152
166
  <OText size={10} style={{ lineHeight: 15 }}>
153
- {parseNumber(business?.reviews?.total, { separator: '.' })}
167
+ {parseNumber(businessReviews?.reviews?.total ?? business?.reviews?.total, { separator: '.' })}
154
168
  </OText>
155
169
  </Reviews>
156
170
  )}
@@ -176,15 +190,17 @@ export const BusinessControllerUI = (props: BusinessControllerParams) => {
176
190
  </View>
177
191
  ) : (
178
192
  <View style={styles.bullet}>
179
- <OText size={10} color={theme.colors.textSecondary}>
180
- {`${t('DELIVERY_FEE', 'Delivery fee')} ${parsePrice(business?.delivery_price) + ' \u2022 '}`}
181
- </OText>
193
+ {orderState?.options?.type === 1 && (
194
+ <OText size={10} color={theme.colors.textSecondary}>
195
+ {`${t('DELIVERY_FEE', 'Delivery fee')} ${parsePrice(businessDeliveryPrice ?? business?.delivery_price) + ' \u2022 '}`}
196
+ </OText>
197
+ )}
182
198
  <OText size={10} color={theme.colors.textSecondary}>{`${convertHoursToMinutes(
183
199
  orderState?.options?.type === 1
184
- ? business?.delivery_time
185
- : business?.pickup_time,
200
+ ? (businessDeliveryTime ?? business?.delivery_time)
201
+ : (businessPickupTime ?? business?.pickup_time),
186
202
  )} \u2022 `}</OText>
187
- <OText size={10} color={theme.colors.textSecondary}>{parseDistance(business?.distance)}</OText>
203
+ <OText size={10} color={theme.colors.textSecondary}>{parseDistance(businessDistance ?? business?.distance)}</OText>
188
204
  </View>
189
205
  )}
190
206
  </Metadata>
@@ -1,4 +1,4 @@
1
- import React from 'react'
1
+ import React, { useEffect } from 'react'
2
2
  import { useLanguage, BusinessMenuListing } from 'ordering-components/native'
3
3
  import { OText } from '../shared'
4
4
  import { BusinessMenuListParams } from '../../types'
@@ -7,6 +7,7 @@ import { useTheme } from 'styled-components/native'
7
7
  import IconAntDesign from 'react-native-vector-icons/AntDesign'
8
8
  import { Fade, Placeholder, PlaceholderLine } from 'rn-placeholder'
9
9
  import SelectDropdown from 'react-native-select-dropdown'
10
+ import { useSafeAreaInsets } from 'react-native-safe-area-context';
10
11
 
11
12
  const windowHeight = Dimensions.get('window').height;
12
13
 
@@ -18,6 +19,7 @@ const BusinessMenuListUI = (props: BusinessMenuListParams) => {
18
19
 
19
20
  const [, t] = useLanguage()
20
21
  const theme = useTheme()
22
+ const { top } = useSafeAreaInsets()
21
23
 
22
24
  const styles = StyleSheet.create({
23
25
  container: {
@@ -34,7 +36,7 @@ const BusinessMenuListUI = (props: BusinessMenuListParams) => {
34
36
  height: 44,
35
37
  width: '100%'
36
38
  }
37
- })
39
+ })
38
40
 
39
41
  const dropDownIcon = () => {
40
42
  return (
@@ -46,12 +48,18 @@ const BusinessMenuListUI = (props: BusinessMenuListParams) => {
46
48
  )
47
49
  }
48
50
 
51
+ useEffect(() => {
52
+ if (!businessMenuList?.loading && businessMenuList?.menus?.length === 1){
53
+ setMenu(businessMenuList?.menus[0])
54
+ }
55
+ }, [businessMenuList?.menus])
56
+
49
57
  return (
50
58
  <>
51
59
  {businessMenuList.loading ? (
52
60
  <Placeholder Animation={Fade}>
53
61
  <View>
54
- <PlaceholderLine height={44}/>
62
+ <PlaceholderLine height={44} />
55
63
  </View>
56
64
  </Placeholder>
57
65
  ) : (
@@ -65,6 +73,7 @@ const BusinessMenuListUI = (props: BusinessMenuListParams) => {
65
73
  onSelect={(selectedItem, index) => {
66
74
  setMenu(selectedItem)
67
75
  }}
76
+ defaultValue={businessMenuList?.menus?.length === 1 && businessMenuList?.menus[0]}
68
77
  buttonTextAfterSelection={(selectedItem, index) => {
69
78
  return selectedItem.name
70
79
  }}
@@ -81,7 +90,7 @@ const BusinessMenuListUI = (props: BusinessMenuListParams) => {
81
90
  dropdownStyle={{
82
91
  borderRadius: 8,
83
92
  borderColor: theme.colors.lightGray,
84
- marginTop: Platform.OS === 'ios' ? 12 : -15,
93
+ marginTop: Platform.OS === 'ios' ? 12 : -top,
85
94
  maxHeight: 160
86
95
  }}
87
96
  rowStyle={{
@@ -123,4 +132,4 @@ export const BusinessMenuList = (props: any) => {
123
132
  };
124
133
 
125
134
  return <BusinessMenuListing {...businessMenuListProps} />;
126
- };
135
+ };
@@ -21,6 +21,7 @@ import {
21
21
  TimeContentWrapper,
22
22
  TimeItem
23
23
  } from './styles'
24
+ import { useSafeAreaInsets } from 'react-native-safe-area-context';
24
25
 
25
26
  const windowHeight = Dimensions.get('window').height;
26
27
 
@@ -50,7 +51,9 @@ const BusinessPreorderUI = (props: BusinessPreorderParams) => {
50
51
  const [selectDate, setSelectedDate] = useState<any>(null)
51
52
  const [datesWhitelist, setDateWhitelist] = useState<any>([{ start: null, end: null }])
52
53
  const [isEnabled, setIsEnabled] = useState(false)
53
-
54
+ const { top } = useSafeAreaInsets()
55
+ const showOrderTime = (selectedPreorderType === 1 && Object.keys(menu)?.length > 0) || selectedPreorderType === 0
56
+ const isPreOrderSetting = configs?.preorder_status_enabled?.value === '1'
54
57
  const styles = StyleSheet.create({
55
58
  container: {
56
59
  height: windowHeight,
@@ -299,60 +302,62 @@ const BusinessPreorderUI = (props: BusinessPreorderParams) => {
299
302
  />
300
303
  </View>
301
304
  </BusinessInfoWrapper>
302
- <PreorderTypeWrapper>
303
- <OText
304
- size={16}
305
- style={{
306
- fontWeight: '600',
307
- lineHeight: 24,
308
- marginBottom: 12
309
- }}
310
- >
311
- {t('PREORDER_TYPE', 'Preorder type')}
312
- </OText>
313
- <SelectDropdown
314
- defaultValueByIndex={selectedPreorderType}
315
- data={preorderTypeList}
316
- // disabled={orderState.loading}
317
- onSelect={(selectedItem, index) => {
318
- setSelectedPreorderType(index)
319
- }}
320
- buttonTextAfterSelection={(selectedItem, index) => {
321
- return selectedItem.name
322
- }}
323
- rowTextForSelection={(item, index) => {
324
- return item.name
325
- }}
326
- buttonStyle={styles.selectOption}
327
- buttonTextStyle={{
328
- color: theme.colors.disabled,
329
- fontSize: 14,
330
- textAlign: 'left',
331
- marginHorizontal: 0
332
- }}
333
- dropdownStyle={{
334
- borderRadius: 8,
335
- borderColor: theme.colors.lightGray,
336
- marginTop: Platform.OS === 'ios' ? 12 : -15
337
- }}
338
- rowStyle={{
339
- borderBottomColor: theme.colors.backgroundGray100,
340
- backgroundColor: theme.colors.backgroundGray100,
341
- height: 40,
342
- flexDirection: 'column',
343
- alignItems: 'flex-start',
344
- paddingTop: 8,
345
- paddingHorizontal: 14
346
- }}
347
- rowTextStyle={{
348
- color: theme.colors.disabled,
349
- fontSize: 14,
350
- marginHorizontal: 0
351
- }}
352
- renderDropdownIcon={() => dropDownIcon()}
353
- dropdownOverlayColor='transparent'
354
- />
355
- </PreorderTypeWrapper>
305
+ {isPreOrderSetting && (
306
+ <PreorderTypeWrapper>
307
+ <OText
308
+ size={16}
309
+ style={{
310
+ fontWeight: '600',
311
+ lineHeight: 24,
312
+ marginBottom: 12
313
+ }}
314
+ >
315
+ {t('PREORDER_TYPE', 'Preorder type')}
316
+ </OText>
317
+ <SelectDropdown
318
+ defaultValueByIndex={selectedPreorderType}
319
+ data={preorderTypeList}
320
+ // disabled={orderState.loading}
321
+ onSelect={(selectedItem, index) => {
322
+ setSelectedPreorderType(index)
323
+ }}
324
+ buttonTextAfterSelection={(selectedItem, index) => {
325
+ return selectedItem.name
326
+ }}
327
+ rowTextForSelection={(item, index) => {
328
+ return item.name
329
+ }}
330
+ buttonStyle={styles.selectOption}
331
+ buttonTextStyle={{
332
+ color: theme.colors.disabled,
333
+ fontSize: 14,
334
+ textAlign: 'left',
335
+ marginHorizontal: 0
336
+ }}
337
+ dropdownStyle={{
338
+ borderRadius: 8,
339
+ borderColor: theme.colors.lightGray,
340
+ marginTop: Platform.OS === 'ios' ? 12 : -top
341
+ }}
342
+ rowStyle={{
343
+ borderBottomColor: theme.colors.backgroundGray100,
344
+ backgroundColor: theme.colors.backgroundGray100,
345
+ height: 40,
346
+ flexDirection: 'column',
347
+ alignItems: 'flex-start',
348
+ paddingTop: 8,
349
+ paddingHorizontal: 14
350
+ }}
351
+ rowTextStyle={{
352
+ color: theme.colors.disabled,
353
+ fontSize: 14,
354
+ marginHorizontal: 0
355
+ }}
356
+ renderDropdownIcon={() => dropDownIcon()}
357
+ dropdownOverlayColor='transparent'
358
+ />
359
+ </PreorderTypeWrapper>
360
+ )}
356
361
  {selectedPreorderType === 1 && (
357
362
  <MenuWrapper>
358
363
  <OText
@@ -372,78 +377,94 @@ const BusinessPreorderUI = (props: BusinessPreorderParams) => {
372
377
  />
373
378
  </MenuWrapper>
374
379
  )}
375
- <OrderTimeWrapper>
380
+ {isPreOrderSetting && showOrderTime && (
381
+ <OrderTimeWrapper>
382
+ <OText
383
+ size={16}
384
+ style={{
385
+ fontWeight: '600',
386
+ lineHeight: 24
387
+ }}
388
+ >
389
+ {t('ORDER_TIME', 'Order time')}
390
+ </OText>
391
+ <View style={{ flex: 1 }}>
392
+ {selectDate && datesWhitelist[0]?.start !== null && (
393
+ <CalendarStrip
394
+ scrollable
395
+ style={styles.calendar}
396
+ calendarHeaderContainerStyle={styles.calendarHeaderContainer}
397
+ calendarHeaderStyle={styles.calendarHeader}
398
+ dateNumberStyle={styles.dateNumber}
399
+ dateNameStyle={styles.dateName}
400
+ iconContainer={{ flex: 0.1 }}
401
+ highlightDateNameStyle={styles.highlightDateName}
402
+ highlightDateNumberStyle={styles.highlightDateNumber}
403
+ dayContainerStyle={{ height: '100%' }}
404
+ highlightDateContainerStyle={{ height: '100%' }}
405
+ calendarHeaderFormat='MMMM, YYYY'
406
+ iconStyle={{ borderWidth: 1 }}
407
+ selectedDate={selectDate}
408
+ datesWhitelist={datesWhitelist}
409
+ disabledDateNameStyle={styles.disabledDateName}
410
+ disabledDateNumberStyle={styles.disabledDateNumber}
411
+ disabledDateOpacity={0.6}
412
+ onDateSelected={(date) => onSelectDate(date)}
413
+ leftSelector={<LeftSelector />}
414
+ rightSelector={<RightSelector />}
415
+ />
416
+ )}
417
+ </View>
418
+ <TimeListWrapper nestedScrollEnabled={true}>
419
+ {(isEnabled && timeList?.length > 0) ? (
420
+ <TimeContentWrapper>
421
+ {timeList.map((time: any, i: number) => (
422
+ <TouchableOpacity key={i} onPress={() => handleChangeTime(time.value)}>
423
+ <TimeItem active={timeSelected === time.value}>
424
+ <OText
425
+ size={14}
426
+ color={timeSelected === time.value ? theme.colors.primary : theme.colors.textNormal}
427
+ style={{
428
+ lineHeight: 24
429
+ }}
430
+ >{time.text}</OText>
431
+ </TimeItem>
432
+ </TouchableOpacity>
433
+ ))}
434
+ {timeList.length % 3 === 2 && (
435
+ <TimeItem style={{ backgroundColor: 'transparent' }} />
436
+ )}
437
+ </TimeContentWrapper>
438
+ ) : (
439
+ <OText
440
+ size={16}
441
+ style={{
442
+ fontWeight: '600',
443
+ lineHeight: 24,
444
+ marginBottom: 12,
445
+ textAlign: 'center'
446
+ }}
447
+ >
448
+ {t('ERROR_ADD_PRODUCT_BUSINESS_CLOSED', 'The business is closed at the moment')}
449
+ </OText>
450
+ )}
451
+ </TimeListWrapper>
452
+ </OrderTimeWrapper>
453
+ )}
454
+ {!isPreOrderSetting && (
376
455
  <OText
377
456
  size={16}
378
457
  style={{
379
458
  fontWeight: '600',
380
- lineHeight: 24
459
+ lineHeight: 24,
460
+ marginTop: 30,
461
+ marginBottom: 12,
462
+ textAlign: 'center'
381
463
  }}
382
- >
383
- {t('ORDER_TIME', 'Order time')}
464
+ >
465
+ {t('ERROR_ADD_PRODUCT_BUSINESS_CLOSED', 'The business is closed at the moment')}
384
466
  </OText>
385
- <View style={{ flex: 1 }}>
386
- {selectDate && datesWhitelist[0]?.start !== null && (
387
- <CalendarStrip
388
- scrollable
389
- style={styles.calendar}
390
- calendarHeaderContainerStyle={styles.calendarHeaderContainer}
391
- calendarHeaderStyle={styles.calendarHeader}
392
- dateNumberStyle={styles.dateNumber}
393
- dateNameStyle={styles.dateName}
394
- iconContainer={{ flex: 0.1 }}
395
- highlightDateNameStyle={styles.highlightDateName}
396
- highlightDateNumberStyle={styles.highlightDateNumber}
397
- dayContainerStyle={{ height: '100%' }}
398
- highlightDateContainerStyle={{ height: '100%' }}
399
- calendarHeaderFormat='MMMM, YYYY'
400
- iconStyle={{ borderWidth: 1 }}
401
- selectedDate={selectDate}
402
- datesWhitelist={datesWhitelist}
403
- disabledDateNameStyle={styles.disabledDateName}
404
- disabledDateNumberStyle={styles.disabledDateNumber}
405
- disabledDateOpacity={0.6}
406
- onDateSelected={(date) => onSelectDate(date)}
407
- leftSelector={<LeftSelector />}
408
- rightSelector={<RightSelector />}
409
- />
410
- )}
411
- </View>
412
- <TimeListWrapper nestedScrollEnabled={true}>
413
- {(isEnabled && timeList?.length > 0) ? (
414
- <TimeContentWrapper>
415
- {timeList.map((time: any, i: number) => (
416
- <TouchableOpacity key={i} onPress={() => handleChangeTime(time.value)}>
417
- <TimeItem active={timeSelected === time.value}>
418
- <OText
419
- size={14}
420
- color={timeSelected === time.value ? theme.colors.primary : theme.colors.textNormal}
421
- style={{
422
- lineHeight: 24
423
- }}
424
- >{time.text}</OText>
425
- </TimeItem>
426
- </TouchableOpacity>
427
- ))}
428
- {timeList.length % 3 === 2 && (
429
- <TimeItem style={{ backgroundColor: 'transparent' }} />
430
- )}
431
- </TimeContentWrapper>
432
- ) : (
433
- <OText
434
- size={16}
435
- style={{
436
- fontWeight: '600',
437
- lineHeight: 24,
438
- marginBottom: 12,
439
- textAlign: 'center'
440
- }}
441
- >
442
- {t('ERROR_ADD_PRODUCT_BUSINESS_CLOSED', 'The business is closed at the moment')}
443
- </OText>
444
- )}
445
- </TimeListWrapper>
446
- </OrderTimeWrapper>
467
+ )}
447
468
  <OButton
448
469
  text={t('GO_TO_MENU', 'Go to menu')}
449
470
  textStyle={{ color: 'white' }}
@@ -44,11 +44,11 @@ const BusinessProductsCategoriesUI = (props: any) => {
44
44
  borderTopStartRadius: 4,
45
45
  borderTopEndRadius: 4,
46
46
  backgroundColor: theme.colors.textPrimary,
47
- },
48
- tabDeactived: {
47
+ },
48
+ tabDeactived: {
49
49
  marginTop: 10,
50
50
  height: 4
51
- }
51
+ }
52
52
  });
53
53
 
54
54
  const handleCategoryScroll = (category: any) => {
@@ -111,8 +111,10 @@ const BusinessProductsCategoriesUI = (props: any) => {
111
111
  categories.length &&
112
112
  categories.map((category: any) => (
113
113
  <Tab
114
- key={category.name}
115
- onPress={() => handleCategoryScroll(category)}
114
+ key={category.id}
115
+ onPress={() => requestAnimationFrame(() => {
116
+ handleCategoryScroll(category)
117
+ })}
116
118
  style={[
117
119
  category.id === 'featured' && !featured && styles.featuredStyle,
118
120
  {