ordering-ui-react-native 0.15.74 → 0.15.75-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 (221) hide show
  1. package/package.json +7 -3
  2. package/src/DeliveryApp.tsx +43 -1
  3. package/src/components/ActiveOrders/index.tsx +61 -63
  4. package/src/components/ActiveOrders/styles.tsx +1 -1
  5. package/src/components/AddressForm/index.tsx +18 -2
  6. package/src/components/BusinessBasicInformation/index.tsx +11 -19
  7. package/src/components/BusinessController/index.tsx +16 -8
  8. package/src/components/BusinessInformation/index.tsx +14 -0
  9. package/src/components/BusinessTypeFilter/index.tsx +1 -2
  10. package/src/components/BusinessesListing/index.tsx +1 -1
  11. package/src/components/Checkout/index.tsx +25 -3
  12. package/src/components/DriverTips/index.tsx +11 -6
  13. package/src/components/LanguageSelector/index.tsx +6 -2
  14. package/src/components/LoginForm/index.tsx +120 -30
  15. package/src/components/LoginForm/styles.tsx +6 -0
  16. package/src/components/NotificationSetting/index.tsx +85 -0
  17. package/src/components/OrderDetails/index.tsx +7 -21
  18. package/src/components/PaymentOptions/index.tsx +335 -365
  19. package/src/components/PaymentOptionsWebView/index.tsx +120 -121
  20. package/src/components/ReviewDriver/index.tsx +1 -1
  21. package/src/components/ReviewOrder/index.tsx +2 -1
  22. package/src/components/ReviewProducts/index.tsx +11 -0
  23. package/src/components/SignupForm/index.tsx +145 -61
  24. package/src/components/SingleProductCard/index.tsx +16 -4
  25. package/src/components/SingleProductReview/index.tsx +1 -1
  26. package/src/components/StripeElementsForm/index.tsx +25 -16
  27. package/src/components/StripeMethodForm/index.tsx +22 -24
  28. package/src/components/UpsellingProducts/index.tsx +1 -1
  29. package/src/components/UserProfileForm/index.tsx +63 -6
  30. package/src/components/UserProfileForm/styles.tsx +8 -0
  31. package/src/components/VerifyPhone/styles.tsx +1 -2
  32. package/src/components/shared/OBottomPopup.tsx +6 -2
  33. package/src/components/shared/OModal.tsx +1 -1
  34. package/src/hooks/useCountdownTimer.tsx +26 -0
  35. package/src/index.tsx +2 -0
  36. package/src/navigators/CheckoutNavigator.tsx +6 -0
  37. package/src/navigators/HomeNavigator.tsx +12 -0
  38. package/src/pages/BusinessesListing.tsx +7 -6
  39. package/src/pages/MultiCheckout.tsx +31 -0
  40. package/src/pages/MultiOrdersDetails.tsx +27 -0
  41. package/src/pages/OrderDetails.tsx +1 -1
  42. package/src/pages/ReviewDriver.tsx +2 -2
  43. package/src/pages/ReviewOrder.tsx +2 -2
  44. package/src/pages/Sessions.tsx +22 -0
  45. package/src/theme.json +0 -1
  46. package/src/types/index.tsx +18 -11
  47. package/src/utils/index.tsx +68 -2
  48. package/themes/business/index.tsx +4 -0
  49. package/themes/business/src/components/AcceptOrRejectOrder/index.tsx +103 -15
  50. package/themes/business/src/components/AcceptOrRejectOrder/styles.tsx +6 -0
  51. package/themes/business/src/components/Chat/index.tsx +51 -91
  52. package/themes/business/src/components/DriverMap/index.tsx +6 -5
  53. package/themes/business/src/components/DriverSchedule/index.tsx +71 -0
  54. package/themes/business/src/components/DriverSchedule/styles.tsx +6 -0
  55. package/themes/business/src/components/LoginForm/index.tsx +89 -2
  56. package/themes/business/src/components/LoginForm/styles.tsx +6 -0
  57. package/themes/business/src/components/LogoutButton/index.tsx +1 -1
  58. package/themes/business/src/components/NewOrderNotification/index.tsx +26 -13
  59. package/themes/business/src/components/OrderDetails/Business.tsx +1 -1
  60. package/themes/business/src/components/OrderDetails/Delivery.tsx +28 -11
  61. package/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +9 -2
  62. package/themes/business/src/components/OrderDetails/OrderHeaderComponent.tsx +6 -0
  63. package/themes/business/src/components/OrdersListManager/index.tsx +11 -4
  64. package/themes/business/src/components/OrdersOption/index.tsx +16 -4
  65. package/themes/business/src/components/PreviousOrders/index.tsx +7 -7
  66. package/themes/business/src/components/ProductItemAccordion/index.tsx +2 -2
  67. package/themes/business/src/components/ScheduleBlocked/index.tsx +53 -0
  68. package/themes/business/src/components/UserFormDetails/index.tsx +5 -2
  69. package/themes/business/src/components/UserProfileForm/index.tsx +28 -4
  70. package/themes/business/src/components/shared/OModal.tsx +41 -38
  71. package/themes/business/src/types/index.tsx +14 -7
  72. package/themes/doordash/src/components/BusinessesListing/index.tsx +1 -1
  73. package/themes/doordash/src/components/LoginForm/index.tsx +1 -2
  74. package/themes/instacart/src/components/BusinessesListing/index.tsx +1 -1
  75. package/themes/kiosk/src/components/BusinessMenu/index.tsx +39 -28
  76. package/themes/kiosk/src/components/BusinessesListing/index.tsx +2 -3
  77. package/themes/kiosk/src/components/Cart/index.tsx +11 -12
  78. package/themes/kiosk/src/components/CartBottomSheet/index.tsx +9 -2
  79. package/themes/kiosk/src/components/CartContent/index.tsx +0 -11
  80. package/themes/kiosk/src/components/CartItem/index.tsx +4 -3
  81. package/themes/kiosk/src/components/CategoriesMenu/index.tsx +107 -62
  82. package/themes/kiosk/src/components/Checkout/index.tsx +40 -22
  83. package/themes/kiosk/src/components/CustomerName/index.tsx +0 -6
  84. package/themes/kiosk/src/components/DrawerView/index.tsx +1 -0
  85. package/themes/kiosk/src/components/DrawerView/styles.tsx +2 -2
  86. package/themes/kiosk/src/components/NavBar/index.tsx +29 -20
  87. package/themes/kiosk/src/components/OptionCard/index.tsx +1 -1
  88. package/themes/kiosk/src/components/OrderDetails/index.tsx +32 -27
  89. package/themes/kiosk/src/components/OrderTypeCardSelector/index.tsx +9 -11
  90. package/themes/kiosk/src/components/PaymentOptions/index.tsx +56 -54
  91. package/themes/kiosk/src/components/ProductForm/index.tsx +7 -8
  92. package/themes/kiosk/src/components/ProductItemAccordion/index.tsx +2 -2
  93. package/themes/kiosk/src/components/ProductOption/index.tsx +1 -1
  94. package/themes/kiosk/src/components/ProductOptionSubOption/index.tsx +3 -1
  95. package/themes/kiosk/src/components/UpsellingProducts/index.tsx +16 -5
  96. package/themes/kiosk/src/components/shared/OButton.tsx +5 -18
  97. package/themes/kiosk/src/types/index.d.ts +1 -0
  98. package/themes/original/index.tsx +24 -0
  99. package/themes/original/src/components/ActiveOrders/index.tsx +15 -132
  100. package/themes/original/src/components/ActiveOrders/styles.tsx +0 -54
  101. package/themes/original/src/components/AddressForm/index.tsx +7 -6
  102. package/themes/original/src/components/AddressList/index.tsx +2 -2
  103. package/themes/original/src/components/AppleLogin/index.tsx +6 -8
  104. package/themes/original/src/components/BusinessBasicInformation/index.tsx +287 -150
  105. package/themes/original/src/components/BusinessBasicInformation/styles.tsx +6 -2
  106. package/themes/original/src/components/BusinessController/index.tsx +201 -96
  107. package/themes/original/src/components/BusinessController/styles.tsx +5 -0
  108. package/themes/original/src/components/BusinessItemAccordion/index.tsx +8 -5
  109. package/themes/original/src/components/BusinessItemAccordion/styles.tsx +3 -1
  110. package/themes/original/src/components/BusinessListingSearch/index.tsx +234 -64
  111. package/themes/original/src/components/BusinessListingSearch/styles.tsx +22 -2
  112. package/themes/original/src/components/BusinessPreorder/index.tsx +1 -1
  113. package/themes/original/src/components/BusinessProductsCategories/index.tsx +2 -2
  114. package/themes/original/src/components/BusinessProductsList/CategoryDescription/index.tsx +44 -0
  115. package/themes/original/src/components/BusinessProductsList/SubcategoriesComponent/index.tsx +87 -0
  116. package/themes/original/src/components/BusinessProductsList/SubcategoriesComponent/styles.tsx +12 -0
  117. package/themes/original/src/components/BusinessProductsList/index.tsx +65 -73
  118. package/themes/original/src/components/BusinessProductsList/styles.tsx +0 -3
  119. package/themes/original/src/components/BusinessProductsListing/index.tsx +313 -176
  120. package/themes/original/src/components/BusinessProductsListing/styles.tsx +11 -0
  121. package/themes/original/src/components/BusinessReviews/index.tsx +6 -1
  122. package/themes/original/src/components/BusinessTypeFilter/index.tsx +106 -38
  123. package/themes/original/src/components/BusinessTypeFilter/styles.tsx +2 -0
  124. package/themes/original/src/components/BusinessesListing/Layout/Appointment/index.tsx +560 -0
  125. package/themes/original/src/components/BusinessesListing/{styles.tsx → Layout/Appointment/styles.tsx} +24 -2
  126. package/themes/original/src/components/BusinessesListing/Layout/Original/index.tsx +661 -0
  127. package/themes/original/src/components/BusinessesListing/Layout/Original/styles.tsx +137 -0
  128. package/themes/original/src/components/BusinessesListing/index.tsx +104 -462
  129. package/themes/original/src/components/Cart/index.tsx +83 -39
  130. package/themes/original/src/components/Cart/styles.tsx +4 -0
  131. package/themes/original/src/components/Checkout/index.tsx +90 -40
  132. package/themes/original/src/components/Checkout/styles.tsx +0 -1
  133. package/themes/original/src/components/DriverTips/index.tsx +17 -12
  134. package/themes/original/src/components/Favorite/index.tsx +92 -0
  135. package/themes/original/src/components/Favorite/styles.tsx +22 -0
  136. package/themes/original/src/components/FavoriteList/index.tsx +298 -0
  137. package/themes/original/src/components/FavoriteList/styles.tsx +5 -0
  138. package/themes/original/src/components/ForgotPasswordForm/index.tsx +84 -4
  139. package/themes/original/src/components/GPSButton/index.tsx +15 -8
  140. package/themes/original/src/components/GoogleMap/index.tsx +11 -11
  141. package/themes/original/src/components/Help/index.tsx +21 -4
  142. package/themes/original/src/components/HighestRatedBusinesses/index.tsx +18 -1
  143. package/themes/original/src/components/LastOrders/index.tsx +12 -1
  144. package/themes/original/src/components/LoginForm/Otp/index.tsx +91 -0
  145. package/themes/original/src/components/LoginForm/Otp/styles.tsx +7 -0
  146. package/themes/original/src/components/LoginForm/index.tsx +332 -164
  147. package/themes/original/src/components/LoginForm/styles.tsx +1 -3
  148. package/themes/original/src/components/Messages/index.tsx +1 -1
  149. package/themes/original/src/components/MomentSelector/index.tsx +197 -0
  150. package/themes/original/src/components/MomentSelector/styles.tsx +6 -0
  151. package/themes/original/src/components/MultiCartsPaymethodsAndWallets/index.tsx +243 -0
  152. package/themes/original/src/components/MultiCartsPaymethodsAndWallets/styles.tsx +46 -0
  153. package/themes/original/src/components/MultiCheckout/index.tsx +298 -0
  154. package/themes/original/src/components/MultiCheckout/styles.tsx +59 -0
  155. package/themes/original/src/components/MultiOrdersDetails/SingleOrderCard.tsx +372 -0
  156. package/themes/original/src/components/MultiOrdersDetails/index.tsx +258 -0
  157. package/themes/original/src/components/MultiOrdersDetails/styles.tsx +50 -0
  158. package/themes/original/src/components/MyOrders/index.tsx +132 -27
  159. package/themes/original/src/components/MyOrders/styles.tsx +8 -1
  160. package/themes/original/src/components/NavBar/index.tsx +4 -4
  161. package/themes/original/src/components/OrderDetails/OrderHistory.tsx +167 -0
  162. package/themes/original/src/components/OrderDetails/index.tsx +148 -63
  163. package/themes/original/src/components/OrderDetails/styles.tsx +1 -2
  164. package/themes/original/src/components/OrderItAgain/index.tsx +72 -0
  165. package/themes/original/src/components/OrderItAgain/styles.tsx +10 -0
  166. package/themes/original/src/components/OrderSummary/index.tsx +5 -5
  167. package/themes/original/src/components/OrderTypeSelector/index.tsx +77 -35
  168. package/themes/original/src/components/OrderTypeSelector/styles.tsx +19 -1
  169. package/themes/original/src/components/OrdersOption/PreviousBusinessOrdered/index.tsx +153 -0
  170. package/themes/original/src/components/OrdersOption/PreviousBusinessOrdered/styles.tsx +6 -0
  171. package/themes/original/src/components/OrdersOption/PreviousProductsOrdered/index.tsx +53 -0
  172. package/themes/original/src/components/OrdersOption/PreviousProductsOrdered/styles.tsx +6 -0
  173. package/themes/original/src/components/OrdersOption/index.tsx +139 -46
  174. package/themes/original/src/components/OrdersOption/styles.tsx +4 -1
  175. package/themes/original/src/components/PaymentOptionCash/index.tsx +2 -2
  176. package/themes/original/src/components/PaymentOptionWallet/index.tsx +15 -22
  177. package/themes/original/src/components/PaymentOptions/index.tsx +57 -37
  178. package/themes/original/src/components/PhoneInputNumber/index.tsx +5 -11
  179. package/themes/original/src/components/PreviousOrders/index.tsx +18 -147
  180. package/themes/original/src/components/ProductForm/index.tsx +712 -673
  181. package/themes/original/src/components/ProductForm/styles.tsx +9 -7
  182. package/themes/original/src/components/ProductItemAccordion/index.tsx +2 -2
  183. package/themes/original/src/components/ProductOption/index.tsx +1 -1
  184. package/themes/original/src/components/ProductOptionSubOption/index.tsx +13 -9
  185. package/themes/original/src/components/ProfessionalFilter/index.tsx +128 -0
  186. package/themes/original/src/components/ProfessionalFilter/styles.tsx +0 -0
  187. package/themes/original/src/components/ProfessionalProfile/index.tsx +298 -0
  188. package/themes/original/src/components/ProfessionalProfile/styles.tsx +46 -0
  189. package/themes/original/src/components/Promotions/index.tsx +151 -133
  190. package/themes/original/src/components/Promotions/styles.tsx +2 -1
  191. package/themes/original/src/components/ReviewDriver/index.tsx +6 -6
  192. package/themes/original/src/components/ReviewOrder/index.tsx +1 -1
  193. package/themes/original/src/components/ReviewTrigger/index.tsx +118 -0
  194. package/themes/original/src/components/ReviewTrigger/styles.tsx +34 -0
  195. package/themes/original/src/components/SearchBar/index.tsx +13 -5
  196. package/themes/original/src/components/ServiceForm/index.tsx +579 -0
  197. package/themes/original/src/components/ServiceForm/styles.tsx +50 -0
  198. package/themes/original/src/components/Sessions/index.tsx +160 -0
  199. package/themes/original/src/components/Sessions/styles.tsx +15 -0
  200. package/themes/original/src/components/SignupForm/index.tsx +237 -126
  201. package/themes/original/src/components/SingleOrderCard/index.tsx +316 -0
  202. package/themes/original/src/components/SingleOrderCard/styles.tsx +54 -0
  203. package/themes/original/src/components/SingleProductCard/index.tsx +220 -94
  204. package/themes/original/src/components/SingleProductCard/styles.tsx +2 -2
  205. package/themes/original/src/components/StripeElementsForm/index.tsx +25 -9
  206. package/themes/original/src/components/StripeElementsForm/naked.tsx +2 -2
  207. package/themes/original/src/components/UpsellingProducts/index.tsx +2 -6
  208. package/themes/original/src/components/UserDetails/index.tsx +32 -18
  209. package/themes/original/src/components/UserFormDetails/index.tsx +108 -74
  210. package/themes/original/src/components/UserProfile/index.tsx +10 -1
  211. package/themes/original/src/components/UserProfileForm/index.tsx +14 -9
  212. package/themes/original/src/components/UserVerification/index.tsx +178 -192
  213. package/themes/original/src/components/Wallets/index.tsx +2 -2
  214. package/themes/original/src/components/shared/OBottomPopup.tsx +47 -14
  215. package/themes/original/src/components/shared/OButton.tsx +2 -0
  216. package/themes/original/src/components/shared/OInput.tsx +3 -2
  217. package/themes/original/src/components/shared/OModal.tsx +4 -2
  218. package/themes/original/src/layouts/FloatingBottomContainer.tsx +5 -1
  219. package/themes/original/src/types/index.tsx +199 -36
  220. package/themes/original/src/utils/index.tsx +94 -1
  221. package/themes/uber-eats/src/components/BusinessesListing/index.tsx +1 -1
@@ -56,9 +56,10 @@ const CartItem = (props: CartItemProps) => {
56
56
  return product
57
57
  }
58
58
  const isProductIngredients = productInfo()?.ingredients.length > 0 || productInfo()?.options.length > 0 || product?.comment
59
- const getFormattedSubOptionName = ({ quantity, name, position, price }: { quantity: number, name: string, position: string, price: number }) => {
59
+ const getFormattedSubOptionName = ({ quantity, name, position, price }: { quantity: number, name: string, position: string, price: any }) => {
60
60
  const pos = position ? `(${position})` : ''
61
- return `${quantity} x ${name} ${pos} +${price}`
61
+ const str = `${quantity} x ${name} ${pos}`
62
+ return price ? `${str} ${price}` : str
62
63
  }
63
64
 
64
65
  return (
@@ -184,7 +185,7 @@ const CartItem = (props: CartItemProps) => {
184
185
  quantity: suboption.quantity,
185
186
  name: suboption.name,
186
187
  position: (suboption.position !== 'whole') ? t(suboption.position.toUpperCase(), suboption.position) : '',
187
- price: parsePrice(suboption.price)
188
+ price: suboption.price > 0 && `+${parsePrice(suboption.price)}`
188
189
  })}
189
190
  </OText>
190
191
  </ProductSubOption>
@@ -1,4 +1,4 @@
1
- import React, { useEffect, useState } from 'react';
1
+ import React, { useCallback, useState } from 'react';
2
2
  import { Dimensions, Platform, View } from 'react-native';
3
3
  import { useLanguage, useOrder, useUtils } from 'ordering-components/native';
4
4
  import MaterialIcon from 'react-native-vector-icons/MaterialCommunityIcons'
@@ -12,6 +12,7 @@ import {
12
12
  OText
13
13
  } from '../../components/shared';
14
14
  import { CartBottomSheet } from '../../components/CartBottomSheet';
15
+ import { NotFoundSource } from '../NotFoundSource';
15
16
  import { Category } from '../../types';
16
17
  import { CartContent } from '../../components/CartContent';
17
18
  import { TouchableOpacity } from 'react-native-gesture-handler';
@@ -40,20 +41,22 @@ const CategoriesMenu = (props: any): React.ReactElement => {
40
41
 
41
42
  const theme = useTheme()
42
43
  const [, t] = useLanguage();
43
- const [curIndexCateg, setIndexCateg] = useState(categories.indexOf(category));
44
44
  const [{ parsePrice }] = useUtils();
45
45
  const [orientationState] = useDeviceOrientation();
46
46
  const [bottomSheetVisibility, { showCartBottomSheet, hideCartBottomSheet }] = useCartBottomSheet();
47
- const [productSelected, setProductSelected] = useState({})
47
+
48
+ const [productState, setProductState] = useState<any>(null)
49
+ const [productSelected, setProductSelected] = useState<any>({})
50
+ const [curIndexCateg, setIndexCateg] = useState(categories.indexOf(category));
48
51
  const [drawerState, setDrawerState] = useState({ isOpen: false, data: { order: null } });
49
52
 
50
53
  const width_dimension = Dimensions.get('window').width;
51
54
  const height_dimension = Dimensions.get('window').height;
52
-
55
+
53
56
  const KeyboardView = styled.KeyboardAvoidingView`
54
57
  flex: 1;
55
58
  `;
56
-
59
+
57
60
  const onChangeTabs = (idx: number) => {
58
61
  resetInactivityTimeout();
59
62
  setIndexCateg(idx);
@@ -75,6 +78,16 @@ const CategoriesMenu = (props: any): React.ReactElement => {
75
78
  cart = cartsList?.find((item: any) => item.business_id == businessId);
76
79
  }
77
80
 
81
+ const onEditProduct = (product: any) => {
82
+ setProductSelected({ ...product, _isEditProduct: true })
83
+ setDrawerValues({ isOpen: true, data: null })
84
+ }
85
+
86
+ const onAddProduct = (product: any) => {
87
+ setProductSelected(product)
88
+ setDrawerValues({ isOpen: true, data: null })
89
+ }
90
+
78
91
  const cartProps = {
79
92
  ...props,
80
93
  cart,
@@ -87,16 +100,32 @@ const CategoriesMenu = (props: any): React.ReactElement => {
87
100
  visible: bottomSheetVisibility,
88
101
  clearInactivityTimeout,
89
102
  resetInactivityTimeout,
103
+ onEditProduct,
104
+ onAddProduct
90
105
  },
91
106
  showNotFound: false,
92
107
  showCartBottomSheet,
93
108
  }
94
109
 
110
+ const onClickDrawer = () => {
111
+ setDrawerValues({ isOpen: !drawerState.isOpen, data: null })
112
+ setProductState(null)
113
+ }
114
+
115
+ const onSaveProductForm = () => {
116
+ showCartBottomSheet()
117
+ onClickDrawer()
118
+ }
119
+
95
120
  const onToggleCart = () => {
96
121
  if (bottomSheetVisibility) hideCartBottomSheet();
97
122
  else showCartBottomSheet();
98
123
  }
99
124
 
125
+ const onProductStateChange = useCallback((val: any) => {
126
+ setProductState({ ...productState, ...val })
127
+ }, [setProductState])
128
+
100
129
  return (
101
130
  <>
102
131
  <View style={{
@@ -112,44 +141,46 @@ const CategoriesMenu = (props: any): React.ReactElement => {
112
141
  }}
113
142
  >
114
143
  <Container nopadding nestedScrollEnabled>
115
- <View style={{ paddingTop: 20 }}>
116
- <NavBar
117
- title={categories[curIndexCateg].name}
118
- onActionLeft={goToBack}
119
- rightComponent={cart && (
120
- <TouchableOpacity
121
- style={{ paddingHorizontal: 20, flexDirection: 'row', alignItems: 'center' }}
122
- onPress={onToggleCart}
144
+ {Platform.OS === 'android' && (<View style={{ paddingTop: 20 }} />)}
145
+ <NavBar
146
+ title={categories[curIndexCateg].name}
147
+ onActionLeft={goToBack}
148
+ rightComponent={cart && (
149
+ <TouchableOpacity
150
+ style={{ paddingHorizontal: 20, flexDirection: 'row', alignItems: 'center' }}
151
+ onPress={onToggleCart}
152
+ >
153
+ <OText
154
+ color={theme.colors.mediumGray}
123
155
  >
124
- <OText
125
- color={theme.colors.mediumGray}
126
- >
127
- {`${cart?.products?.length || 0} ${t('ITEMS', 'items')}`} {parsePrice(cart?.total || 0)} {' '}
128
- </OText>
129
-
130
- <MaterialIcon
131
- name={bottomSheetVisibility ? "cart-off" : "cart-outline"}
132
- color={theme.colors.primary}
133
- size={30}
134
- />
135
- </TouchableOpacity>
136
- )}
137
- />
138
- <OSegment
139
- items={categories.map((category) => ({
140
- text: category.name
141
- }))}
142
- selectedIdx={curIndexCateg}
143
- onSelectItem={onChangeTabs}
144
- />
145
- </View>
146
-
147
- <GridContainer
148
- style={{
149
- marginTop: 20,
156
+ {`${cart?.products?.length || 0} ${t('ITEMS', 'items')}`} {parsePrice(cart?.total || 0)} {' '}
157
+ </OText>
158
+
159
+ <MaterialIcon
160
+ name={bottomSheetVisibility ? "cart-off" : "cart-outline"}
161
+ color={theme.colors.primary}
162
+ size={30}
163
+ />
164
+ </TouchableOpacity>
165
+ )}
166
+ />
167
+
168
+ <OSegment
169
+ items={categories.map((category) => ({
170
+ text: category.name
171
+ }))}
172
+ selectedIdx={curIndexCateg}
173
+ onSelectItem={onChangeTabs}
174
+ />
175
+
176
+ <GridContainer
177
+ style={{
178
+ marginTop: 20,
150
179
  paddingLeft: orientationState?.orientation === LANDSCAPE
151
- ? bottomSheetVisibility ? orientationState?.dimensions?.width * 0.004 :orientationState?.dimensions?.width * 0.008
152
- : 0
180
+ ? bottomSheetVisibility
181
+ ? orientationState?.dimensions?.width * 0.004
182
+ : orientationState?.dimensions?.width * 0.008
183
+ : 0
153
184
  }}
154
185
  >
155
186
  {categories[curIndexCateg].products.map((product) => (
@@ -170,8 +201,7 @@ const CategoriesMenu = (props: any): React.ReactElement => {
170
201
  onPress={() => {
171
202
  resetInactivityTimeout()
172
203
  if (isDrawer) {
173
- setProductSelected(product)
174
- setDrawerValues({ isOpen: true, data: null })
204
+ onAddProduct && onAddProduct(product)
175
205
  } else {
176
206
  navigation.navigate('ProductDetails', {
177
207
  businessId,
@@ -182,26 +212,31 @@ const CategoriesMenu = (props: any): React.ReactElement => {
182
212
  }}
183
213
  />
184
214
  ))}
215
+
216
+ {categories[curIndexCateg].products.length === 0 && (
217
+ <NotFoundSource
218
+ content={t('ERROR_NOT_FOUND_PRODUCTS_TIME', 'No products found at this time')}
219
+ />
220
+ )}
185
221
  </GridContainer>
186
222
  </Container>
187
223
  </View>
188
-
189
- <View
190
- style={{
191
- flex: bottomSheetVisibility && orientationState?.orientation === PORTRAIT ? 0 : 0.8,
192
- display: bottomSheetVisibility ? 'flex' : 'none'
193
- }}
194
- >
195
- <CartContent
196
- {...cartProps}
197
- />
198
- </View>
224
+ <View
225
+ style={{
226
+ flex: bottomSheetVisibility && orientationState?.orientation === PORTRAIT ? 0 : 0.8,
227
+ display: bottomSheetVisibility ? 'flex' : 'none'
228
+ }}
229
+ >
230
+ <CartContent
231
+ {...cartProps}
232
+ />
233
+ </View>
199
234
  </View>
200
235
  <DrawerView
201
236
  isOpen={drawerState.isOpen}
202
237
  width={width_dimension - (width_dimension * 0.4)}
203
238
  height={height_dimension}
204
- onClickIcon={() => setDrawerValues({ isOpen: !drawerState.isOpen, data: null })}
239
+ onClickIcon={onClickDrawer}
205
240
  >
206
241
  <KeyboardView
207
242
  enabled
@@ -209,14 +244,24 @@ const CategoriesMenu = (props: any): React.ReactElement => {
209
244
  >
210
245
  <ProductForm
211
246
  isDrawer
212
- product={productSelected}
213
- businessId={parseInt(businessId, 10)}
214
- businessSlug={businessSlug}
215
- onSave={() => {
216
- showCartBottomSheet()
217
- setDrawerValues({ isOpen: !drawerState.isOpen, data: null })
218
- }}
219
247
  navigation={navigation}
248
+ {...(productSelected?._isEditProduct ? {
249
+ isEdit: true,
250
+ productCart: productState?.productCart ?? productSelected,
251
+ product: productState?.product,
252
+ businessSlug: cart?.business?.slug,
253
+ businessId: cart?.business_id,
254
+ categoryId: productSelected?.category_id,
255
+ productId: productSelected?.id,
256
+ } : {
257
+ product: productSelected,
258
+ businessSlug: businessSlug,
259
+ businessId: parseInt(businessId, 10),
260
+ productState: productState,
261
+ productCart: productState,
262
+ })}
263
+ onSave={onSaveProductForm}
264
+ onProductStateChange={onProductStateChange}
220
265
  />
221
266
  </KeyboardView>
222
267
  </DrawerView>
@@ -1,5 +1,5 @@
1
1
  import React, { useState, useEffect } from 'react';
2
-
2
+ import { _retrieveStoreData } from '../../../../../src/providers/StoreUtil';
3
3
  import {
4
4
  Checkout as CheckoutController,
5
5
  useOrder,
@@ -35,28 +35,46 @@ const CheckoutUI = (props: any) => {
35
35
  } = props
36
36
 
37
37
  const [errorCash, setErrorCash] = useState(false);
38
+ const [customerName, setCustomerName] = useState(null);
39
+
40
+ const getCustomerName = async () => {
41
+ const data = await _retrieveStoreData('customer_name');
42
+ setCustomerName(data?.customerName)
43
+ }
44
+
45
+ useEffect(() => {
46
+ if (!cartState.loading && cart && !cart?.valid && cart?.status === 2) {
47
+ navigation?.canGoBack() && navigation.goBack()
48
+ } else {
49
+ getCustomerName()
50
+ }
51
+ }, [cart])
52
+
53
+ useEffect(() => {
54
+ if (!cartState.loading && cart && !cart?.valid && cart?.status === 2) {
55
+ navigation?.canGoBack() && navigation.goBack()
56
+ }
57
+ }, [cart])
38
58
 
39
59
  return (
40
60
  <>
41
- {!cartState.loading && cart && cart?.status !== 2 && cart?.valid && (
42
- <PaymentOptions
43
- navigation={navigation}
44
- cart={cart}
45
- errors={errors}
46
- onPaymentChange={handlePaymethodChange}
47
- onNavigationRedirect={onNavigationRedirect}
48
- paySelected={paymethodSelected}
49
- handlerClickPlaceOrder={handlerClickPlaceOrder}
50
- placing={placing}
51
-
52
- errorCash={errorCash}
53
- isDisabled={cart?.status === 2}
54
- businessId={businessDetails?.business?.id}
55
- isLoading={businessDetails.loading}
56
- paymethods={businessDetails?.business?.paymethods}
57
- setErrorCash={setErrorCash}
58
- />
59
- )}
61
+ <PaymentOptions
62
+ navigation={navigation}
63
+ cart={cart}
64
+ errors={errors}
65
+ customerName={customerName}
66
+ onPaymentChange={handlePaymethodChange}
67
+ onNavigationRedirect={onNavigationRedirect}
68
+ paySelected={paymethodSelected}
69
+ handlerClickPlaceOrder={handlerClickPlaceOrder}
70
+ placing={placing}
71
+ errorCash={errorCash}
72
+ isDisabled={cart?.status === 2}
73
+ businessId={businessDetails?.business?.id}
74
+ isLoading={cartState.loading || businessDetails.loading}
75
+ paymethods={businessDetails?.business?.paymethods}
76
+ setErrorCash={setErrorCash}
77
+ />
60
78
  </>
61
79
  )
62
80
  }
@@ -107,7 +125,7 @@ export const Checkout = (props: any) => {
107
125
  loading: false,
108
126
  cart: result
109
127
  })
110
- } catch (error) {
128
+ } catch (error: any) {
111
129
  showToast(ToastType.Error, error?.toString() || error.message)
112
130
  }
113
131
  } else {
@@ -119,7 +137,7 @@ export const Checkout = (props: any) => {
119
137
  error: cart ? null : result
120
138
  })
121
139
  }
122
- } catch (e) {
140
+ } catch (e: any) {
123
141
  setCartState({
124
142
  ...cartState,
125
143
  loading: false,
@@ -113,12 +113,6 @@ const CustomerName = (props: Props): React.ReactElement => {
113
113
  style={{ bottom: 20 }}
114
114
  >
115
115
  {t('WHATS_YOUR_NAME', "What's your name?")}
116
- {/* <OText
117
- size={orientationState?.dimensions?.width * 0.05}
118
- weight={'700'}
119
- >
120
- {`${t('ORDER_BE_FOR', 'order be for?')}`}
121
- </OText> */}
122
116
  </OText>
123
117
  <Controller
124
118
  control={control}
@@ -53,5 +53,6 @@ const styles = StyleSheet.create({
53
53
  },
54
54
  shadowOpacity: 0.21,
55
55
  shadowRadius: 5,
56
+ elevation: 16
56
57
  }
57
58
  })
@@ -19,12 +19,12 @@ export const WrapperFloatBtn = styled.View`
19
19
  top: 10%;
20
20
  right: ${(props: any) => props.outside ? 11 : 58}%;
21
21
  z-index: 20002;
22
- elevation: 11;
22
+ elevation: 17;
23
23
  `;
24
24
 
25
25
  export const IconControl = styled.TouchableOpacity`
26
26
  background-color: ${(props: any) => props.theme.colors.white};
27
27
  padding: 10px;
28
28
  border-radius: 8px;
29
- elevation: 11;
29
+ elevation: 17;
30
30
  `;
@@ -1,10 +1,10 @@
1
1
  import * as React from 'react'
2
2
  import styled from 'styled-components/native'
3
3
  import { OIcon, OButton, OText } from '../shared'
4
- import { ImageStyle, TextStyle, View, Platform } from 'react-native'
5
- import { OrderTypeSelector } from '../OrderTypeSelector'
6
- import { useConfig, useLanguage } from 'ordering-components/native'
4
+ import { ImageStyle, TextStyle, View, Platform, TouchableOpacity } from 'react-native'
5
+ import { useConfig, useLanguage, useOrder } from 'ordering-components/native'
7
6
  import { useTheme } from 'styled-components/native'
7
+
8
8
  const Wrapper = styled.View`
9
9
  background-color: ${(props: any) => props.theme.colors.white};
10
10
  padding: 10px 0px 20px 0px;
@@ -54,38 +54,39 @@ interface Props {
54
54
  paddingTop?: number,
55
55
  includeOrderTypeSelector?: boolean,
56
56
  imgLeftStyle?: ImageStyle
57
+ onClickTypes?: any
57
58
  }
58
59
 
59
60
  const NavBar = (props: Props) => {
60
61
  const theme = useTheme();
61
- const [{ configs }] = useConfig();
62
+ const [orderState] = useOrder()
62
63
  const [, t] = useLanguage();
63
- const configTypes = configs?.order_types_allowed?.value.split('|').map((value: any) => Number(value)) || [];
64
+
65
+ const selectedOrderType = orderState?.options?.type;
64
66
 
65
67
  return (
66
68
  <Wrapper style={{ paddingTop: props.paddingTop, ...props.style }}>
67
- {(props?.onActionLeft) && (
69
+ {(props?.onActionLeft || props?.leftImg) && (
68
70
  <OButton
69
- imgLeftSrc={props.leftImg}
71
+ imgLeftSrc={props.leftImg || theme.images.general.arrow_left}
70
72
  imgRightSrc={null}
71
73
  style={{ ...btnBackArrow, ...props.btnStyle }}
72
74
  onClick={props.onActionLeft}
73
- imgLeftStyle={props.imgLeftStyle}
74
- {...(!props.leftImg && { iconProps: { name: 'arrowleft', size: 28, color: props.btnStyle?.color } })}
75
+ imgLeftStyle= {props.imgLeftStyle}
75
76
  />)
76
77
  }
77
78
  <TitleTopWrapper>
78
79
  {props.withIcon
79
80
  ? (
80
- <OIcon
81
- url={props.icon}
82
- style={{
83
- borderColor: theme.colors.lightGray,
84
- borderRadius: 20,
85
- }}
86
- width={60}
87
- height={60}
88
- />
81
+ <OIcon
82
+ url={props.icon}
83
+ style={{
84
+ borderColor: theme.colors.lightGray,
85
+ borderRadius: 20,
86
+ }}
87
+ width={60}
88
+ height={60}
89
+ />
89
90
  )
90
91
  : null
91
92
  }
@@ -121,11 +122,19 @@ const NavBar = (props: Props) => {
121
122
  }}
122
123
  >
123
124
  <OText style={{ paddingRight: 5 }}>{t('THIS_ORDER_IS_TO', 'This order is to')}</OText>
124
- <OrderTypeSelector configTypes={configTypes} />
125
+ <TouchableOpacity
126
+ activeOpacity={1}
127
+ onPress={props.onClickTypes}
128
+ >
129
+ <OText color={theme.colors.primary}>
130
+ {selectedOrderType === 2 && t('TAKE_OUT', 'Take out')}
131
+ {selectedOrderType === 3 && t('EAT_IN', 'Eat in')}
132
+ </OText>
133
+ </TouchableOpacity>
125
134
  </View>
126
135
  )}
127
136
 
128
- {props.rightComponent}
137
+ { props.rightComponent }
129
138
  </Wrapper>
130
139
  )
131
140
  }
@@ -95,7 +95,7 @@ interface Props {
95
95
  style?: ViewStyle;
96
96
  bgImage: ImageSourcePropType;
97
97
  innerStyle?: ViewStyle;
98
- icon?: ImageSourcePropType;
98
+ icon: ImageSourcePropType;
99
99
  iconStyle?: ImageStyle;
100
100
  callToActionText: string;
101
101
  callToActionTextStyle?: TextStyle;
@@ -395,9 +395,14 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
395
395
  </View>
396
396
  </OSTable>
397
397
 
398
- {order?.products?.length && (
399
- <OSTable>
400
- <View>
398
+ {order?.products?.length > 0 && (
399
+ <>
400
+ <View
401
+ style={{
402
+ flexDirection: 'row',
403
+ justifyContent: 'space-between'
404
+ }}
405
+ >
401
406
  <OText
402
407
  weight="bold"
403
408
  mBottom={15}
@@ -405,29 +410,29 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
405
410
  {`${order?.products?.length} ${t('ITEMS', 'items')}`}
406
411
  </OText>
407
412
 
408
- <GridContainer style={{ maxWidth: orientationState?.dimensions?.width * 0.6 }}>
409
- {order?.products.map((product: Product, i: number) => (
410
- <OImage
411
- key={product?.id || i}
412
- source={{ uri: product?.images || '' }}
413
- resizeMode="cover"
414
- height={80}
415
- width={80}
416
- borderRadius={8}
417
- style={{ marginEnd: 10, marginBottom: 10 }}
418
- />
419
- ))}
420
- </GridContainer>
413
+ <OText
414
+ color={theme.colors.primary}
415
+ weight="bold"
416
+ >
417
+ {parsePrice((order?.summary?.total || order?.total) - (order?.summary?.discount || order?.discount))}
418
+ </OText>
421
419
  </View>
422
-
423
- <OText
424
- color={theme.colors.primary}
425
- weight="bold"
426
- mRight={30}
427
- >
428
- {parsePrice((order?.summary?.total || order?.total) - (order?.summary?.discount || order?.discount))}
429
- </OText>
430
- </OSTable>
420
+ <OSTable>
421
+ <GridContainer style={{ maxWidth: orientationState?.dimensions?.width * 0.6 }}>
422
+ {order?.products.map((product: Product, i: number) => (
423
+ <OImage
424
+ key={product?.id || i}
425
+ source={{ uri: product?.images || '' }}
426
+ resizeMode="cover"
427
+ height={80}
428
+ width={80}
429
+ borderRadius={8}
430
+ style={{ marginEnd: 10, marginBottom: 10 }}
431
+ />
432
+ ))}
433
+ </GridContainer>
434
+ </OSTable>
435
+ </>
431
436
  )}
432
437
 
433
438
  <OrderBill>
@@ -520,7 +525,7 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
520
525
  <OSRow>
521
526
  <OText>
522
527
  {fee.name || t('INHERIT_FROM_BUSINESS', 'Inherit from business')}
523
- ({fee?.fixed > 0 && `${parsePrice(fee?.fixed)} + `}{fee.percentage}%){' '}
528
+ ({fee?.fixed > 0 && `${parsePrice(fee?.fixed)}${fee.percentage > 0 ? ' + ' : ''}`}{fee.percentage > 0 && `${fee.percentage}%`}){' '}
524
529
  </OText>
525
530
  </OSRow>
526
531
  <OText>{parsePrice(fee?.summary?.fixed + (fee?.summary?.percentage_after_discount ?? fee?.summary?.percentage) ?? 0)}</OText>
@@ -593,7 +598,7 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
593
598
  <>
594
599
  <Spinner visible={!order || Object.keys(order).length === 0} />
595
600
 
596
- {order && Object.keys(order).length > 0 && (
601
+ {!!order && Object.keys(order).length > 0 && (
597
602
  <>
598
603
  <Container>
599
604
  <NavBar
@@ -15,8 +15,6 @@ import { Container } from '../../layouts/Container'
15
15
  import NavBar from '../NavBar'
16
16
  import { LANDSCAPE, PORTRAIT, useDeviceOrientation } from '../../../../../src/hooks/DeviceOrientation'
17
17
  import GridContainer from '../../layouts/GridContainer'
18
- import AntDesignIcon from 'react-native-vector-icons/AntDesign'
19
- import MaterialIcon from 'react-native-vector-icons/MaterialCommunityIcons'
20
18
 
21
19
  const OrderTypeSelectorCardUI = (props: OrderTypeSelectParams) => {
22
20
  const {
@@ -29,7 +27,7 @@ const OrderTypeSelectorCardUI = (props: OrderTypeSelectParams) => {
29
27
  callback
30
28
  } = props
31
29
 
32
- const theme = useTheme();
30
+ const theme = useTheme();
33
31
  const [, t] = useLanguage();
34
32
  const [orientationState] = useDeviceOrientation();
35
33
  const [orderState] = useOrder()
@@ -47,7 +45,7 @@ const OrderTypeSelectorCardUI = (props: OrderTypeSelectParams) => {
47
45
  }
48
46
 
49
47
  useEffect(() => {
50
- if (isCardCliked) {
48
+ if(isCardCliked){
51
49
  callback?.()
52
50
  setIsCardClicked(false)
53
51
  setIsLoadingCard(null)
@@ -59,7 +57,7 @@ const OrderTypeSelectorCardUI = (props: OrderTypeSelectParams) => {
59
57
  <Container>
60
58
  <NavBar
61
59
  title={t('ORDER_TYPE_X_ID', 'Order type')}
62
- {...(goBack && { onActionLeft: goBack })}
60
+ onActionLeft={goBack}
63
61
  btnStyle={{ paddingLeft: 0 }}
64
62
  />
65
63
 
@@ -85,13 +83,13 @@ const OrderTypeSelectorCardUI = (props: OrderTypeSelectParams) => {
85
83
  style={cardStyle}
86
84
  isDisabled={isCardCliked}
87
85
  isLoading={isLoadingCard === 'Eat In'}
88
- title={t('EAT_IN', 'Eat In')}
86
+ title={t('EAT_IN','Eat In')}
89
87
  description={t('EAT_IN_DESCRIPTION', 'We are very glad to have you here. Bon appetit!')}
90
88
  bgImage={theme.images.general.eatIn}
91
- VectorIcon={() => <MaterialIcon name='pin-outline' size={28} color='white' style={{ marginBottom: 10 }} />}
89
+ icon={theme.images.general.pushPin}
92
90
  callToActionText={t('START_MY_ORDER', 'Start my order')}
93
91
  onClick={() => {
94
- if (_eatIn?.value !== orderState?.options?.type) {
92
+ if(_eatIn?.value !== orderState?.options?.type){
95
93
  handleChangeOrderType(_eatIn?.value);
96
94
  setIsCardClicked(true)
97
95
  setIsLoadingCard('Eat In')
@@ -108,15 +106,15 @@ const OrderTypeSelectorCardUI = (props: OrderTypeSelectParams) => {
108
106
 
109
107
  <OptionCard
110
108
  style={cardStyle}
111
- title={t('TAKE_OUT', 'Take out')}
109
+ title={t('TAKE_OUT','Take out')}
112
110
  isDisabled={isCardCliked}
113
111
  isLoading={isLoadingCard === 'Take out'}
114
112
  description={t('TAKE_OUT_DESCRIPTION', 'You are very welcome anytime you visit us!')}
115
113
  bgImage={theme.images.general.takeOut}
116
- VectorIcon={() => <AntDesignIcon name='shoppingcart' size={28} color='white' style={{ marginBottom: 10 }} />}
114
+ icon={theme.images.general.shoppingCart}
117
115
  callToActionText={t('START_MY_ORDER', 'Start my order')}
118
116
  onClick={() => {
119
- if (_takeOut?.value !== orderState?.options?.type) {
117
+ if(_takeOut?.value !== orderState?.options?.type){
120
118
  handleChangeOrderType(_takeOut?.value);
121
119
  setIsCardClicked(true)
122
120
  setIsLoadingCard('Take out')