ordering-ui-react-native 0.17.89 → 0.17.90-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 (216) hide show
  1. package/package.json +8 -7
  2. package/src/DeliveryApp.tsx +43 -1
  3. package/src/components/BusinessInformation/index.tsx +10 -9
  4. package/src/components/BusinessesListing/index.tsx +1 -1
  5. package/src/components/OrderCreating/index.tsx +1 -21
  6. package/src/components/PaymentOptionsWebView/index.tsx +29 -8
  7. package/src/components/PhoneInputNumber/index.tsx +6 -2
  8. package/src/components/StripeMethodForm/index.tsx +136 -102
  9. package/src/components/VerifyPhone/styles.tsx +1 -2
  10. package/src/components/shared/OToast.tsx +3 -2
  11. package/src/types/index.tsx +5 -0
  12. package/src/utils/index.tsx +5 -0
  13. package/themes/business/index.tsx +2 -0
  14. package/themes/business/src/components/AcceptOrRejectOrder/index.tsx +37 -27
  15. package/themes/business/src/components/BusinessController/index.tsx +0 -1
  16. package/themes/business/src/components/Chat/index.tsx +163 -123
  17. package/themes/business/src/components/DriverMap/index.tsx +17 -6
  18. package/themes/business/src/components/DriverSchedule/index.tsx +45 -8
  19. package/themes/business/src/components/FloatingButton/index.tsx +34 -31
  20. package/themes/business/src/components/GoogleMap/index.tsx +58 -57
  21. package/themes/business/src/components/LoginForm/Otp/index.tsx +31 -3
  22. package/themes/business/src/components/LoginForm/index.tsx +15 -22
  23. package/themes/business/src/components/MapView/index.tsx +14 -10
  24. package/themes/business/src/components/MessagesOption/index.tsx +20 -93
  25. package/themes/business/src/components/NewOrderNotification/index.tsx +123 -96
  26. package/themes/business/src/components/NotFoundSource/index.tsx +2 -2
  27. package/themes/business/src/components/OrderDetails/Business.tsx +1 -1
  28. package/themes/business/src/components/OrderDetails/Delivery.tsx +202 -12
  29. package/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +84 -37
  30. package/themes/business/src/components/OrderDetails/OrderHeaderComponent.tsx +81 -66
  31. package/themes/business/src/components/OrderDetailsLogistic/index.tsx +200 -0
  32. package/themes/business/src/components/OrderDetailsLogistic/styles.tsx +5 -0
  33. package/themes/business/src/components/OrderMessage/index.tsx +19 -18
  34. package/themes/business/src/components/OrderSummary/index.tsx +114 -123
  35. package/themes/business/src/components/OrdersOption/index.tsx +22 -22
  36. package/themes/business/src/components/PreviousMessages/FooterMessageComponent.tsx +103 -0
  37. package/themes/business/src/components/PreviousMessages/index.tsx +97 -55
  38. package/themes/business/src/components/PreviousOrders/OrderItem.tsx +17 -12
  39. package/themes/business/src/components/PreviousOrders/OrderList.tsx +93 -0
  40. package/themes/business/src/components/PreviousOrders/OrdersGroupedItem.tsx +1 -1
  41. package/themes/business/src/components/PreviousOrders/index.tsx +198 -221
  42. package/themes/business/src/components/ProductItemAccordion/index.tsx +7 -1
  43. package/themes/business/src/components/ReviewCustomer/index.tsx +18 -13
  44. package/themes/business/src/components/StoresList/index.tsx +3 -4
  45. package/themes/business/src/components/UserProfileForm/index.tsx +14 -15
  46. package/themes/business/src/components/shared/OModal.tsx +16 -9
  47. package/themes/business/src/types/index.tsx +25 -10
  48. package/themes/business/src/utils/index.tsx +29 -2
  49. package/themes/doordash/src/components/BusinessesListing/index.tsx +1 -1
  50. package/themes/doordash/src/components/LoginForm/index.tsx +1 -2
  51. package/themes/instacart/src/components/BusinessesListing/index.tsx +1 -1
  52. package/themes/kiosk/src/components/Checkout/index.tsx +6 -0
  53. package/themes/kiosk/src/components/Intro/index.tsx +16 -1
  54. package/themes/kiosk/src/components/LoginForm/index.tsx +7 -9
  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/PhoneInputNumber/index.tsx +2 -2
  59. package/themes/kiosk/src/components/shared/OButton.tsx +5 -18
  60. package/themes/original/index.tsx +1 -1
  61. package/themes/original/src/components/AddressDetails/index.tsx +19 -3
  62. package/themes/original/src/components/AddressForm/index.tsx +35 -17
  63. package/themes/original/src/components/AddressList/index.tsx +5 -8
  64. package/themes/original/src/components/AnalyticsSegment/index.tsx +193 -10
  65. package/themes/original/src/components/AppleLogin/index.tsx +4 -4
  66. package/themes/original/src/components/AppleLogin/styles.tsx +3 -1
  67. package/themes/original/src/components/BusinessBasicInformation/index.tsx +73 -37
  68. package/themes/original/src/components/BusinessBasicInformation/styles.tsx +10 -12
  69. package/themes/original/src/components/BusinessController/index.tsx +35 -44
  70. package/themes/original/src/components/BusinessController/styles.tsx +12 -5
  71. package/themes/original/src/components/BusinessFeaturedController/index.tsx +21 -54
  72. package/themes/original/src/components/BusinessFeaturedController/styles.tsx +8 -0
  73. package/themes/original/src/components/BusinessInformation/index.tsx +140 -85
  74. package/themes/original/src/components/BusinessItemAccordion/index.tsx +15 -20
  75. package/themes/original/src/components/BusinessListingSearch/index.tsx +347 -336
  76. package/themes/original/src/components/BusinessListingSearch/styles.tsx +0 -18
  77. package/themes/original/src/components/BusinessPreorder/index.tsx +103 -19
  78. package/themes/original/src/components/BusinessProductsCategories/index.tsx +1 -2
  79. package/themes/original/src/components/BusinessProductsList/index.tsx +15 -7
  80. package/themes/original/src/components/BusinessProductsList/styles.tsx +8 -3
  81. package/themes/original/src/components/BusinessProductsListing/UpsellingRedirect.tsx +1 -1
  82. package/themes/original/src/components/BusinessProductsListing/index.tsx +663 -556
  83. package/themes/original/src/components/BusinessProductsListing/styles.tsx +2 -3
  84. package/themes/original/src/components/BusinessReviews/index.tsx +3 -1
  85. package/themes/original/src/components/BusinessesListing/Layout/Original/FlatListBusinessListFooter.tsx +69 -0
  86. package/themes/original/src/components/BusinessesListing/Layout/Original/FlatListBusinessListHeader.tsx +406 -0
  87. package/themes/original/src/components/BusinessesListing/Layout/Original/FlatListBusinessListing.tsx +76 -0
  88. package/themes/original/src/components/BusinessesListing/Layout/Original/index.tsx +38 -405
  89. package/themes/original/src/components/BusinessesListing/index.tsx +0 -1
  90. package/themes/original/src/components/Cart/index.tsx +60 -51
  91. package/themes/original/src/components/CartContent/index.tsx +102 -58
  92. package/themes/original/src/components/CartContent/styles.tsx +6 -6
  93. package/themes/original/src/components/Checkout/index.tsx +280 -35
  94. package/themes/original/src/components/CitiesControl/index.tsx +1 -1
  95. package/themes/original/src/components/CouponControl/index.tsx +10 -3
  96. package/themes/original/src/components/DriverTips/index.tsx +52 -34
  97. package/themes/original/src/components/FacebookLogin/styles.tsx +3 -1
  98. package/themes/original/src/components/Favorite/index.tsx +1 -5
  99. package/themes/original/src/components/GPSButton/index.tsx +6 -4
  100. package/themes/original/src/components/GiftCard/GiftCardUI/index.tsx +8 -3
  101. package/themes/original/src/components/GiftCard/PurchaseGiftCard/index.tsx +42 -5
  102. package/themes/original/src/components/GiftCard/PurchaseGiftCard/styles.tsx +2 -0
  103. package/themes/original/src/components/GiftCard/RedeemGiftCard/index.tsx +86 -10
  104. package/themes/original/src/components/GoogleLogin/styles.tsx +1 -1
  105. package/themes/original/src/components/GoogleMap/index.tsx +63 -7
  106. package/themes/original/src/components/Home/index.tsx +13 -4
  107. package/themes/original/src/components/LastOrder/index.tsx +2 -1
  108. package/themes/original/src/components/LastOrders/index.tsx +2 -1
  109. package/themes/original/src/components/LoginForm/Otp/index.tsx +91 -25
  110. package/themes/original/src/components/LoginForm/index.tsx +64 -34
  111. package/themes/original/src/components/LottieAnimation/index.tsx +88 -63
  112. package/themes/original/src/components/MessageListing/index.tsx +9 -2
  113. package/themes/original/src/components/Messages/index.tsx +15 -4
  114. package/themes/original/src/components/MomentOption/index.tsx +193 -92
  115. package/themes/original/src/components/MomentSelector/index.tsx +1 -1
  116. package/themes/original/src/components/MultiCartsPaymethodsAndWallets/index.tsx +162 -50
  117. package/themes/original/src/components/MultiCheckout/index.tsx +385 -46
  118. package/themes/original/src/components/MultiCheckout/styles.tsx +3 -1
  119. package/themes/original/src/components/MultiOrdersDetails/index.tsx +23 -19
  120. package/themes/original/src/components/MyOrders/index.tsx +25 -16
  121. package/themes/original/src/components/NavBar/index.tsx +20 -13
  122. package/themes/original/src/components/NotFoundSource/index.tsx +14 -10
  123. package/themes/original/src/components/OrderDetails/OrderEta.tsx +76 -0
  124. package/themes/original/src/components/OrderDetails/OrderHistory.tsx +21 -5
  125. package/themes/original/src/components/OrderDetails/index.tsx +50 -38
  126. package/themes/original/src/components/OrderDetails/styles.tsx +0 -1
  127. package/themes/original/src/components/OrderItAgain/index.tsx +3 -1
  128. package/themes/original/src/components/OrderProgress/index.tsx +34 -25
  129. package/themes/original/src/components/OrderSummary/index.tsx +83 -57
  130. package/themes/original/src/components/OrderTypeSelector/index.tsx +5 -6
  131. package/themes/original/src/components/OrdersOption/PreviousProductsOrdered/index.tsx +14 -14
  132. package/themes/original/src/components/OrdersOption/index.tsx +59 -48
  133. package/themes/original/src/components/OrdersOption/styles.tsx +1 -1
  134. package/themes/original/src/components/PageBanner/index.tsx +65 -29
  135. package/themes/original/src/components/PageBanner/styles.tsx +0 -3
  136. package/themes/original/src/components/PaymentOptionCard/index.tsx +180 -0
  137. package/themes/original/src/components/PaymentOptionStripe/styles.tsx +3 -0
  138. package/themes/original/src/components/PaymentOptionWallet/index.tsx +56 -56
  139. package/themes/original/src/components/PaymentOptions/index.tsx +100 -34
  140. package/themes/original/src/components/PhoneInputNumber/index.tsx +18 -4
  141. package/themes/original/src/components/ProductForm/index.tsx +87 -31
  142. package/themes/original/src/components/ProductForm/styles.tsx +3 -3
  143. package/themes/original/src/components/ProductItemAccordion/index.tsx +8 -6
  144. package/themes/original/src/components/ProductOptionSubOption/index.tsx +49 -20
  145. package/themes/original/src/components/ProductOptionSubOption/styles.tsx +10 -9
  146. package/themes/original/src/components/ProfessionalFilter/SingleProfessionalCard/index.tsx +108 -0
  147. package/themes/original/src/components/ProfessionalFilter/index.tsx +20 -50
  148. package/themes/original/src/components/ProfessionalProfile/index.tsx +36 -7
  149. package/themes/original/src/components/Promotions/index.tsx +2 -2
  150. package/themes/original/src/components/Promotions/styles.tsx +3 -1
  151. package/themes/original/src/components/ReviewProducts/index.tsx +16 -7
  152. package/themes/original/src/components/ScheduleAccordion/index.tsx +3 -3
  153. package/themes/original/src/components/ServiceForm/index.tsx +63 -20
  154. package/themes/original/src/components/Sessions/styles.tsx +1 -0
  155. package/themes/original/src/components/SignupForm/index.tsx +43 -27
  156. package/themes/original/src/components/SingleOrderCard/index.tsx +42 -19
  157. package/themes/original/src/components/SingleOrderCard/styles.tsx +1 -1
  158. package/themes/original/src/components/SingleProductCard/index.tsx +14 -11
  159. package/themes/original/src/components/SingleProductCard/styles.tsx +8 -3
  160. package/themes/original/src/components/SingleProductReview/styles.tsx +1 -1
  161. package/themes/original/src/components/StripeCardsList/index.tsx +61 -5
  162. package/themes/original/src/components/StripeElementsForm/index.tsx +48 -34
  163. package/themes/original/src/components/StripeElementsForm/naked.tsx +12 -1
  164. package/themes/original/src/components/UpsellingProducts/index.tsx +5 -10
  165. package/themes/original/src/components/UserDetails/index.tsx +3 -1
  166. package/themes/original/src/components/UserFormDetails/index.tsx +78 -9
  167. package/themes/original/src/components/UserFormDetails/styles.tsx +1 -1
  168. package/themes/original/src/components/UserProfile/index.tsx +8 -26
  169. package/themes/original/src/components/UserProfileForm/index.tsx +30 -31
  170. package/themes/original/src/components/UserVerification/index.tsx +55 -50
  171. package/themes/original/src/components/WalletTransactionItem/index.tsx +2 -2
  172. package/themes/original/src/components/WalletTransactions/index.tsx +3 -3
  173. package/themes/original/src/components/Wallets/index.tsx +52 -62
  174. package/themes/original/src/components/Wallets/styles.tsx +2 -4
  175. package/themes/original/src/components/shared/OButton.tsx +3 -3
  176. package/themes/original/src/components/shared/OInput.tsx +4 -5
  177. package/themes/original/src/components/shared/OModal.tsx +3 -3
  178. package/themes/original/src/types/index.tsx +37 -10
  179. package/themes/original/src/utils/index.tsx +185 -13
  180. package/themes/uber-eats/src/components/BusinessesListing/index.tsx +1 -1
  181. package/src/navigators/BottomNavigator.tsx +0 -117
  182. package/src/navigators/CheckoutNavigator.tsx +0 -66
  183. package/src/navigators/HomeNavigator.tsx +0 -202
  184. package/src/navigators/NavigationRef.tsx +0 -7
  185. package/src/navigators/RootNavigator.tsx +0 -269
  186. package/src/pages/Account.tsx +0 -34
  187. package/src/pages/AddressForm.tsx +0 -62
  188. package/src/pages/AddressList.tsx +0 -24
  189. package/src/pages/BusinessProductsList.tsx +0 -81
  190. package/src/pages/BusinessesListing.tsx +0 -43
  191. package/src/pages/CartList.tsx +0 -49
  192. package/src/pages/Checkout.tsx +0 -101
  193. package/src/pages/ForgotPassword.tsx +0 -24
  194. package/src/pages/Help.tsx +0 -23
  195. package/src/pages/HelpAccountAndPayment.tsx +0 -23
  196. package/src/pages/HelpGuide.tsx +0 -23
  197. package/src/pages/HelpOrder.tsx +0 -23
  198. package/src/pages/Home.tsx +0 -36
  199. package/src/pages/IntroductoryTutorial.tsx +0 -170
  200. package/src/pages/Login.tsx +0 -47
  201. package/src/pages/MomentOption.tsx +0 -30
  202. package/src/pages/MultiCheckout.tsx +0 -31
  203. package/src/pages/MultiOrdersDetails.tsx +0 -27
  204. package/src/pages/MyOrders.tsx +0 -40
  205. package/src/pages/NetworkError.tsx +0 -24
  206. package/src/pages/NotFound.tsx +0 -22
  207. package/src/pages/OrderDetails.tsx +0 -25
  208. package/src/pages/ProductDetails.tsx +0 -55
  209. package/src/pages/Profile.tsx +0 -36
  210. package/src/pages/ReviewDriver.tsx +0 -30
  211. package/src/pages/ReviewOrder.tsx +0 -32
  212. package/src/pages/ReviewProducts.tsx +0 -30
  213. package/src/pages/Sessions.tsx +0 -22
  214. package/src/pages/Signup.tsx +0 -53
  215. package/src/pages/SpinnerLoader.tsx +0 -10
  216. package/src/pages/Splash.tsx +0 -21
@@ -3,7 +3,6 @@ import { useLanguage, useUtils, useToast, ToastType, useConfig, MultiOrdersDetai
3
3
  import { View, StyleSheet, BackHandler, TouchableOpacity } from 'react-native'
4
4
  import { useTheme } from 'styled-components/native'
5
5
  import { OText, OButton } from '../shared'
6
- import { Container } from '../../layouts/Container'
7
6
  import { Placeholder, PlaceholderLine, Fade } from 'rn-placeholder'
8
7
  import { SingleOrderCard } from './SingleOrderCard'
9
8
  import AntDesignIcon from 'react-native-vector-icons/AntDesign'
@@ -53,6 +52,7 @@ export const MultiOrdersDetailsUI = (props: any) => {
53
52
  const [, { showToast }] = useToast();
54
53
  const [{ configs }] = useConfig()
55
54
 
55
+ const isTaxIncludedOnPrice = orders.every((_order: any) => _order.taxes?.length ? _order.taxes?.every((_tax: any) => _tax.type === 1) : true)
56
56
  const progressBarStyle = configs.multi_business_checkout_progress_bar_style?.value
57
57
  const showBarInOrder = ['group', 'both']
58
58
  const showBarInIndividual = ['individual', 'both']
@@ -166,7 +166,7 @@ export const MultiOrdersDetailsUI = (props: any) => {
166
166
  <OText key={event.id} size={12} lineHeight={18} color={theme.colors.textNormal}>
167
167
  {event?.wallet_event
168
168
  ? walletName[event?.wallet_event?.wallet?.type]?.name
169
- : event?.paymethod?.name}
169
+ : t(event?.paymethod?.name.toUpperCase()?.replace(/ /g, '_'), event?.paymethod?.name)}
170
170
  </OText>
171
171
  ))}
172
172
  </Section>
@@ -225,23 +225,27 @@ export const MultiOrdersDetailsUI = (props: any) => {
225
225
  </Row>
226
226
  ))}
227
227
  <BorderLine />
228
- <Row>
229
- <OText size={12} lineHeight={18} weight={'400'} color={theme.colors.textNormal}>
230
- {t('TOTAL_BEFORE_TAX', 'Total before tax')}:
231
- </OText>
232
- <OText size={12} lineHeight={18} weight={'400'} color={theme.colors.textNormal}>
233
- {parsePrice(ordersSummary?.subtotal)}
234
- </OText>
235
- </Row>
236
- <Row>
237
- <OText size={12} lineHeight={18} weight={'400'} color={theme.colors.textNormal}>
238
- {t('ESTIMATED_TAX_TO_BE_COLLECTED', 'Estimated tax to be collected')}:
239
- </OText>
240
- <OText size={12} lineHeight={18} weight={'400'} color={theme.colors.textNormal}>
241
- {parsePrice(ordersSummary?.tax)}
242
- </OText>
243
- </Row>
244
- <BorderLine />
228
+ {!isTaxIncludedOnPrice && (
229
+ <>
230
+ <Row>
231
+ <OText size={12} lineHeight={18} weight={'400'} color={theme.colors.textNormal}>
232
+ {t('TOTAL_BEFORE_TAX', 'Total before tax')}:
233
+ </OText>
234
+ <OText size={12} lineHeight={18} weight={'400'} color={theme.colors.textNormal}>
235
+ {parsePrice(ordersSummary?.subtotal)}
236
+ </OText>
237
+ </Row>
238
+ <Row>
239
+ <OText size={12} lineHeight={18} weight={'400'} color={theme.colors.textNormal}>
240
+ {t('ESTIMATED_TAX_TO_BE_COLLECTED', 'Estimated tax to be collected')}:
241
+ </OText>
242
+ <OText size={12} lineHeight={18} weight={'400'} color={theme.colors.textNormal}>
243
+ {parsePrice(ordersSummary?.tax)}
244
+ </OText>
245
+ </Row>
246
+ <BorderLine />
247
+ </>
248
+ )}
245
249
  <Row style={{ marginTop: 10 }}>
246
250
  <OText size={14} lineHeight={18} weight={'500'} color={theme.colors.textNormal}>
247
251
  {t('PAYMENT_TOTAL', 'Payment total')}:
@@ -25,13 +25,14 @@ export const MyOrders = (props: any) => {
25
25
  const [ordersLength, setOrdersLength] = useState({
26
26
  activeOrdersLength: null,
27
27
  previousOrdersLength: 0,
28
+ preordersLength: 0
28
29
  });
29
30
  const [selectedOption, setSelectedOption] = useState(!hideOrders ? 'orders' : 'business')
30
31
 
31
32
  const notOrderOptions = ['business', 'products']
32
- const allEmpty = (ordersLength?.activeOrdersLength === 0 && ordersLength?.previousOrdersLength === 0) || ((isEmptyBusinesses || businessOrderIds?.length === 0) && hideOrders)
33
+ const allEmpty = (ordersLength?.activeOrdersLength === 0 && ordersLength?.previousOrdersLength === 0 && ordersLength?.preordersLength === 0) || ((isEmptyBusinesses || businessOrderIds?.length === 0) && hideOrders)
33
34
 
34
- const isChewLayout = theme?.header?.components?.layout?.type === 'chew'
35
+ const isChewLayout = theme?.header?.components?.layout?.type?.toLowerCase() === 'chew'
35
36
  const showNavbar = theme?.bar_menu?.components?.orders?.hidden
36
37
  const hideOrdersTheme = theme?.bar_menu?.components?.orders?.hidden
37
38
  const hideProductsTab = theme?.orders?.components?.products_tab?.hidden
@@ -90,7 +91,7 @@ export const MyOrders = (props: any) => {
90
91
  },
91
92
  ...props.titleStyle
92
93
  }}>
93
- {(!props.hideBackBtn || !hideOrdersTheme) && !isChewLayout && (
94
+ {!props.hideBackBtn && (!isChewLayout || (isChewLayout && hideOrdersTheme)) && (
94
95
  <OButton
95
96
  imgLeftStyle={{ width: 18 }}
96
97
  imgRightSrc={null}
@@ -103,7 +104,7 @@ export const MyOrders = (props: any) => {
103
104
  shadowColor: '#FFF',
104
105
  paddingLeft: 0,
105
106
  paddingRight: 0,
106
- marginTop: 50,
107
+ marginTop: 30,
107
108
  }}
108
109
  onClick={goToBack}
109
110
  icon={AntDesignIcon}
@@ -147,18 +148,26 @@ export const MyOrders = (props: any) => {
147
148
  )}
148
149
  {selectedOption === 'orders' && (
149
150
  <>
150
- {ordersLength?.activeOrdersLength !== 0 && (
151
- <View style={{ paddingHorizontal: isChewLayout ? 20 : 40 }}>
152
- <OrdersOption
153
- {...props}
154
- activeOrders
155
- ordersLength={ordersLength}
156
- setOrdersLength={setOrdersLength}
157
- setRefreshOrders={setRefreshOrders}
158
- refreshOrders={refreshOrders}
159
- />
160
- </View>
161
- )}
151
+ <View style={{ paddingHorizontal: isChewLayout ? 20 : 40 }}>
152
+ <OrdersOption
153
+ {...props}
154
+ preOrders
155
+ ordersLength={ordersLength}
156
+ setOrdersLength={setOrdersLength}
157
+ setRefreshOrders={setRefreshOrders}
158
+ refreshOrders={refreshOrders}
159
+ />
160
+ </View>
161
+ <View style={{ paddingHorizontal: isChewLayout ? 20 : 40 }}>
162
+ <OrdersOption
163
+ {...props}
164
+ activeOrders
165
+ ordersLength={ordersLength}
166
+ setOrdersLength={setOrdersLength}
167
+ setRefreshOrders={setRefreshOrders}
168
+ refreshOrders={refreshOrders}
169
+ />
170
+ </View>
162
171
  <View style={{ paddingHorizontal: isChewLayout ? 20 : 40 }}>
163
172
  <OrdersOption
164
173
  {...props}
@@ -1,3 +1,6 @@
1
+
2
+
3
+
1
4
  import * as React from 'react'
2
5
  import styled, { useTheme } from 'styled-components/native'
3
6
  import { OButton, OIcon, OText } from '../shared'
@@ -9,7 +12,6 @@ const TitleWrapper = styled.View`
9
12
  padding-horizontal: 10px;
10
13
  `
11
14
  const TitleTopWrapper = styled.View`
12
- flex: 1;
13
15
  flex-direction: row;
14
16
  align-items: center;
15
17
  `
@@ -17,8 +19,10 @@ const TitleTopWrapper = styled.View`
17
19
  const btnBackArrow = {
18
20
  borderWidth: 0,
19
21
  backgroundColor: '#FFF',
20
- borderColor: '#FFF',
21
- shadowColor: '#FFF'
22
+ borderColor: '#fff',
23
+ shadowColor: '#FFF',
24
+ paddingLeft: 30,
25
+ paddingRight: 30
22
26
  }
23
27
 
24
28
  interface Props {
@@ -42,6 +46,7 @@ interface Props {
42
46
  paddingTop?: number,
43
47
  isVertical?: boolean,
44
48
  noMargin?: any
49
+ hideArrowLeft?: boolean
45
50
  }
46
51
 
47
52
  const NavBar = (props: Props) => {
@@ -52,8 +57,6 @@ const NavBar = (props: Props) => {
52
57
  background-color: ${theme.colors.white};
53
58
  padding: 10px 20px 20px 0px;
54
59
  flex-direction: row;
55
- justify-content: center;
56
- align-items: center;
57
60
  position: relative;
58
61
  `
59
62
 
@@ -62,13 +65,18 @@ const NavBar = (props: Props) => {
62
65
  }
63
66
  return (
64
67
  <Wrapper style={{ paddingTop: props.paddingTop, ...{ flexDirection: props.isVertical ? 'column' : 'row', alignItems: props.isVertical ? 'flex-start' : 'center' }, ...props.style }}>
65
- <OButton
66
- imgLeftSrc={theme.images.general.arrow_left}
67
- imgLeftStyle={{ width: 26 }}
68
- imgRightSrc={null}
69
- style={{ ...btnBackArrow, ...props.btnStyle, ...props.isVertical ? (I18nManager.isRTL ? { paddingRight: 0 } : { paddingLeft: 0 }) : {} }}
70
- onClick={props?.onActionLeft}
71
- />
68
+ {!props.hideArrowLeft && (
69
+ <OButton
70
+ iconProps={{
71
+ name: 'arrowleft',
72
+ size: 26
73
+ }}
74
+ icon={AntDesignIcon}
75
+ imgRightSrc={null}
76
+ style={{ ...btnBackArrow, ...props.btnStyle, ...props.isVertical ? (I18nManager.isRTL ? { paddingRight: 0 } : { paddingLeft: 0 }) : {} }}
77
+ onClick={props?.onActionLeft}
78
+ />
79
+ )}
72
80
  <TitleTopWrapper>
73
81
  {props.withIcon
74
82
  ? (
@@ -87,7 +95,6 @@ const NavBar = (props: Props) => {
87
95
  <TitleWrapper style={{ ...{ paddingHorizontal: props.isVertical ? 0 : 10 }, ...props.titleWrapStyle }}>
88
96
  <OText
89
97
  size={20}
90
- lineHeight={36}
91
98
  weight={Platform.OS === 'ios' ? '600' : 'bold'}
92
99
  style={
93
100
  {
@@ -1,8 +1,9 @@
1
1
  import React from 'react'
2
2
  import { View } from 'react-native'
3
- import { OButton, OIcon, OText } from '../shared'
3
+ import { OButton, OText } from '../shared'
4
4
  import { NotFoundSourceParams } from '../../types'
5
5
  import { useTheme } from 'styled-components/native';
6
+ import Foundation from 'react-native-vector-icons/Foundation'
6
7
  import {
7
8
  NotFound,
8
9
  NotFoundImage
@@ -10,34 +11,37 @@ import {
10
11
 
11
12
  export const NotFoundSource = (props: NotFoundSourceParams) => {
12
13
  const {
13
- image,
14
+ hideImage,
14
15
  content,
15
16
  btnTitle,
17
+ btnStyle,
16
18
  conditioned,
17
19
  onClickButton
18
20
  } = props
19
21
 
20
22
  const theme = useTheme();
21
23
 
22
- const errorImage = image || theme.images.general.notFound
23
- const isUrl = typeof errorImage === 'string' && errorImage.includes('http')
24
-
25
24
  return (
26
25
  <NotFound>
27
- {errorImage && (
26
+ {!hideImage && (
28
27
  <NotFoundImage>
29
- <OIcon url={isUrl && errorImage} src={!isUrl && errorImage} width={260} height={220} />
28
+ <Foundation
29
+ name='page-search'
30
+ color={theme.colors.primary}
31
+ size={60}
32
+ style={{ marginBottom: 10 }}
33
+ />
30
34
  </NotFoundImage>
31
35
  )}
32
- {content && conditioned && !errorImage && <OText color={theme.colors.disabled} size={18} style={{ textAlign: 'center' }}>{content}</OText>}
33
- {content && !conditioned && <OText color={theme.colors.disabled} size={18} style={{ textAlign: 'center' }}>{content}</OText>}
36
+ {content && conditioned && <OText color={theme.colors.disabled} size={16} style={{ textAlign: 'center' }}>{content}</OText>}
37
+ {content && !conditioned && <OText color={theme.colors.disabled} size={16} style={{ textAlign: 'center' }}>{content}</OText>}
34
38
  {!onClickButton && props.children && (
35
39
  props.children
36
40
  )}
37
41
  {onClickButton && (
38
42
  <View style={{ marginTop: 10, width: '100%' }}>
39
43
  <OButton
40
- style={{ width: '100%', height: 50 }}
44
+ style={{ width: '100%', height: 50, ...btnStyle }}
41
45
  bgColor={theme.colors.primary}
42
46
  borderColor={theme.colors.primary}
43
47
  onClick={() => onClickButton()}
@@ -0,0 +1,76 @@
1
+ import React, { useEffect, useState } from 'react'
2
+ import { useUtils } from 'ordering-components/native'
3
+ import moment from 'moment'
4
+
5
+ export const OrderEta = (props: any) => {
6
+ const {
7
+ order,
8
+ outputFormat
9
+ } = props
10
+
11
+ const [{ parseDate }] = useUtils()
12
+ const [estimatedDeliveryTime, setEstimatedDeliveryTime] = useState(null)
13
+
14
+ const getEstimatedDeliveryTime = () => {
15
+ let estimatedUtcTime = null
16
+ let totalEta = 0
17
+ if (order?.delivered_in) totalEta += order?.delivered_in
18
+ if (order?.prepared_in) totalEta += order?.prepared_in
19
+ if (order?.delivery_type === 1 && order?.eta_drive_time) {
20
+ totalEta += order?.eta_drive_time
21
+ }
22
+
23
+ const _delivery = order?.delivery_datetime_utc
24
+ ? order?.delivery_datetime_utc
25
+ : order?.delivery_datetime
26
+
27
+ if (order?.eta_current_status_time) {
28
+ const currentStatueEta = order?.eta_current_status_time
29
+ totalEta += currentStatueEta
30
+ let previousStatusTimes = 0
31
+ if (order?.eta_previous_status_times) {
32
+ Object.keys(order.eta_previous_status_times).map(key => {
33
+ if (!key.includes('status_penalty')) {
34
+ previousStatusTimes += order.eta_previous_status_times[key]
35
+ }
36
+ })
37
+ }
38
+ totalEta += previousStatusTimes
39
+
40
+ let nextStatusTimes = 0
41
+ if (order?.eta_next_status_times) {
42
+ Object.keys(order.eta_next_status_times).map(key => {
43
+ if (!key.includes('status_penalty')) {
44
+ nextStatusTimes += order.eta_next_status_times[key]
45
+ }
46
+ })
47
+ }
48
+ totalEta += nextStatusTimes
49
+
50
+ const diffTimeAsSeconds = moment.utc(order?.reporting_data?.at[`status:${order.status}`]).add(order?.eta_current_status_time, 'minutes').diff(moment().utc(), 'seconds')
51
+ const diffTimeAsMinutes = Math.ceil(diffTimeAsSeconds / 60)
52
+ if (diffTimeAsMinutes <= 0) {
53
+ totalEta += (Math.floor(Math.abs(diffTimeAsMinutes / order?.eta_current_status_time) + 1) * order?.eta_current_status_penalty_time)
54
+ }
55
+ } else {
56
+ totalEta = order?.eta_time + totalEta
57
+ }
58
+ estimatedUtcTime = moment.utc(_delivery).add(totalEta, 'minutes')
59
+ const _estimatedTime = outputFormat ? moment(estimatedUtcTime).local().format(outputFormat) : parseDate(estimatedUtcTime, { utc: false })
60
+ setEstimatedDeliveryTime(_estimatedTime)
61
+ }
62
+
63
+ useEffect(() => {
64
+ getEstimatedDeliveryTime()
65
+ const interval = setInterval(() => {
66
+ getEstimatedDeliveryTime()
67
+ }, 1000)
68
+ return () => clearInterval(interval)
69
+ }, [order, outputFormat])
70
+
71
+ return (
72
+ <>
73
+ {estimatedDeliveryTime}
74
+ </>
75
+ )
76
+ }
@@ -4,6 +4,7 @@ import { ScrollView, StyleSheet, View } from 'react-native'
4
4
  import { useLanguage, useUtils } from 'ordering-components/native'
5
5
  import MaterialCommunityIcons from 'react-native-vector-icons/MaterialCommunityIcons'
6
6
  import { OText, OButton } from '../shared'
7
+ import { formatSeconds } from '../../utils'
7
8
 
8
9
  export const OrderHistory = (props: any) => {
9
10
  const {
@@ -61,7 +62,7 @@ export const OrderHistory = (props: any) => {
61
62
  20: 'ORDER_CUSTOMER_ALMOST_ARRIVED_BUSINESS',
62
63
  21: 'ORDER_CUSTOMER_ARRIVED_BUSINESS',
63
64
  22: 'ORDER_LOOKING_FOR_DRIVER',
64
- 23: 'ORDER_DRIVER_ON_WAY'
65
+ 23: 'ORDER_DRIVER_ON_WAY'
65
66
  }
66
67
 
67
68
  const getLogisticTagStatus = (status: any) => {
@@ -106,8 +107,12 @@ export const OrderHistory = (props: any) => {
106
107
  ellipsizeMode='tail'
107
108
  >
108
109
  {t('ORDER_PLACED', 'Order placed')} {' '}
109
- {t('VIA', 'Via')}{' '}
110
- {order.app_id ? t(order.app_id.toUpperCase(), order.app_id) : t('OTHER', 'Other')}
110
+ {!props.hideViaText && (
111
+ <>
112
+ {t('VIA', 'Via')}{' '}
113
+ {order.app_id ? t(order.app_id.toUpperCase(), order.app_id) : t('OTHER', 'Other')}
114
+ </>
115
+ )}
111
116
  </OText>
112
117
  <OText size={12}>{parseDate(order?.created_at, { outputFormat: 'MMM DD, hh:mm A' })}</OText>
113
118
  </View>
@@ -128,12 +133,23 @@ export const OrderHistory = (props: any) => {
128
133
  <OText
129
134
  size={14}
130
135
  weight='bold'
131
- numberOfLines={1}
136
+ numberOfLines={message.change?.attribute.includes(['delivered_in', 'prepared_in']) ? 2 : 1}
132
137
  ellipsizeMode='tail'
133
138
  >
134
139
  {message.change?.attribute === 'logistic_status'
135
140
  ? getLogisticTagStatus(parseInt(message.change.new, 10))
136
- : t(ORDER_STATUS[parseInt(message.change.new, 10)])
141
+ : message.change?.attribute === 'delivered_in' ? (
142
+ <>
143
+ {t('TIME_ADDED_BY_DRIVER', 'Time added by driver')}{'\n'}
144
+ {formatSeconds(parseInt(message.change.new, 10))}
145
+ </>
146
+ )
147
+ : message.change?.attribute === 'prepared_in' ? (
148
+ <>
149
+ {t('TIME_ADDED_BY_BUSINESS', 'Time added by business')}{'\n'}
150
+ {formatSeconds(parseInt(message.change.new, 10))}
151
+ </>
152
+ ) : t(ORDER_STATUS[parseInt(message.change.new, 10)])
137
153
  }
138
154
  </OText>
139
155
  ) : (
@@ -7,7 +7,9 @@ import {
7
7
  OrderDetails as OrderDetailsConTableoller,
8
8
  useUtils,
9
9
  useOrder,
10
- useConfig
10
+ useConfig,
11
+ useToast,
12
+ ToastType
11
13
  } from 'ordering-components/native';
12
14
  import { useTheme } from 'styled-components/native';
13
15
  import { showLocation } from 'react-native-map-link';
@@ -40,7 +42,7 @@ import { ProductItemAccordion } from '../ProductItemAccordion';
40
42
  import { TouchableOpacity } from 'react-native-gesture-handler';
41
43
  import { OrderDetailsParams } from '../../types';
42
44
  import { GoogleMap } from '../GoogleMap';
43
- import { verifyDecimals, getOrderStatus } from '../../utils';
45
+ import { verifyDecimals, getOrderStatus, getOrderStatuPickUp } from '../../utils';
44
46
  import { OSRow } from '../OrderSummary/styles';
45
47
  import AntIcon from 'react-native-vector-icons/AntDesign'
46
48
  import { TaxInformation } from '../TaxInformation';
@@ -49,6 +51,7 @@ import NavBar from '../NavBar'
49
51
  import { OrderHistory } from './OrderHistory';
50
52
  import { PlaceSpot } from '../PlaceSpot'
51
53
  import { SendGiftCard } from '../GiftCard/SendGiftCard'
54
+ import { OrderEta } from './OrderEta'
52
55
  export const OrderDetailsUI = (props: OrderDetailsParams) => {
53
56
  const {
54
57
  navigation,
@@ -64,7 +67,7 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
64
67
  } = props;
65
68
 
66
69
  const theme = useTheme();
67
-
70
+ const [, { showToast }] = useToast()
68
71
  const styles = StyleSheet.create({
69
72
  rowDirection: {
70
73
  flexDirection: 'row',
@@ -120,7 +123,9 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
120
123
  const mapValidStatuses = [9, 19, 23]
121
124
  const placeSpotTypes = [3, 4, 5]
122
125
  const directionTypes = [2, 3, 4, 5]
123
- const activeStatus = [0, 3, 4, 7, 8, 9, 14, 18, 19, 20, 21, 22, 23]
126
+ const activeStatus = [0, 3, 4, 7, 8, 9, 13, 14, 18, 19, 20, 21, 22, 23]
127
+ const reorderStatus = [1, 2, 5, 6, 10, 11, 12]
128
+ const [isPickup, setIsPickup] = useState(order?.delivery_type === 2)
124
129
  const enabledPoweredByOrdering = configs?.powered_by_ordering_module?.value
125
130
  const isGiftCardOrder = !order?.business_id
126
131
  const hideDeliveryDate = theme?.confirmation?.components?.order?.components?.date?.hidden
@@ -134,6 +139,7 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
134
139
  const hideDriverMessages = theme?.confirmation?.components?.driver?.components?.messages?.hidden
135
140
  const hideCustomerPhone = theme?.confirmation?.components?.customer?.components?.phone?.hidden
136
141
  const hideCustomerAddress = theme?.confirmation?.components?.customer?.components?.address?.hidden
142
+ const progressBarObjt = isPickup ? getOrderStatuPickUp : getOrderStatus
137
143
  const walletName: any = {
138
144
  cash: {
139
145
  name: t('PAY_WITH_CASH_WALLET', 'Pay with Cash Wallet'),
@@ -191,7 +197,7 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
191
197
  order: {
192
198
  id: order?.id,
193
199
  business_id: order?.business_id,
194
- logo: order.business?.logo,
200
+ logo: order.business?.logo || theme.images.dummies.businessLogo,
195
201
  driver: order?.driver,
196
202
  products: order?.products,
197
203
  review: order?.review,
@@ -335,6 +341,19 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
335
341
  }
336
342
  }, [driverLocation]);
337
343
 
344
+ useEffect(() => {
345
+ if (props?.order?.error && !props?.order?.loading) {
346
+ showToast(ToastType.Error, props?.order?.error)
347
+ navigation.navigate('BusinessList')
348
+ }
349
+ }, [props?.order?.error, props?.order?.loading])
350
+
351
+
352
+ useEffect(() => {
353
+ if (!order?.delivery_type) return
354
+ setIsPickup(order?.delivery_type === 2)
355
+ }, [order?.delivery_type])
356
+
338
357
  return (
339
358
  <OrderDetailsContainer
340
359
  keyboardShouldPersistTaps="handled"
@@ -410,13 +429,11 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
410
429
  titleWrapStyle={{ paddingHorizontal: 0 }}
411
430
  titleStyle={{ marginRight: 0, marginLeft: 0 }}
412
431
  subTitle={!hideDeliveryDate && <OText size={12} lineHeight={18} color={theme.colors.textNormal}>
413
- {
414
- activeStatus.includes(order?.status)
415
- ? order?.eta_time + 'min'
416
- : order?.delivery_datetime_utc
417
- ? parseDate(order?.delivery_datetime_utc)
418
- : parseDate(order?.delivery_datetime, { utc: false })
419
- }
432
+ {activeStatus.includes(order?.status) ? (
433
+ <OrderEta order={order} />
434
+ ) : (
435
+ parseDate(order?.reporting_data?.at[`status:${order.status}`])
436
+ )}
420
437
  </OText>}
421
438
  />
422
439
  {enabledPoweredByOrdering && (
@@ -472,7 +489,7 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
472
489
  <LinearGradient
473
490
  start={{ x: 0.0, y: 0.0 }}
474
491
  end={{
475
- x: getOrderStatus(order?.status)?.percentage || 0,
492
+ x: progressBarObjt(order?.status)?.percentage || 0,
476
493
  y: 0,
477
494
  }}
478
495
  locations={[0.9999, 0.9999]}
@@ -485,7 +502,7 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
485
502
  lineHeight={24}
486
503
  weight={'600'}
487
504
  color={theme.colors.textNormal}>
488
- {getOrderStatus(order?.status)?.value}
505
+ {progressBarObjt(order?.status)?.value}
489
506
  </OText>
490
507
  </>
491
508
  )}
@@ -783,25 +800,17 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
783
800
  parentStyle={{ marginTop: 29, marginEnd: 15 }}
784
801
  onClick={() => navigation.navigate('BottomTab', { screen: 'MyOrders' })}
785
802
  />
786
- {(
787
- parseInt(order?.status) === 1 ||
788
- parseInt(order?.status) === 2 ||
789
- parseInt(order?.status) === 5 ||
790
- parseInt(order?.status) === 6 ||
791
- parseInt(order?.status) === 10 ||
792
- parseInt(order?.status) === 11 ||
793
- parseInt(order?.status) === 12
794
- ) && (
795
- <OButton
796
- text={order.id === reorderState?.loading ? t('LOADING', 'Loading..') : t('REORDER', 'Reorder')}
797
- textStyle={{ fontSize: 14, color: theme.colors.primary }}
798
- imgRightSrc={null}
799
- borderColor='transparent'
800
- bgColor={theme.colors.primary + 10}
801
- style={{ borderRadius: 7.6, borderWidth: 1, height: 44, shadowOpacity: 0, marginTop: 29 }}
802
- onClick={() => handleReorder && handleReorder(order.id)}
803
- />
804
- )}
803
+ {(reorderStatus?.includes(parseInt(order?.status)) && order?.cart) && (
804
+ <OButton
805
+ text={order.id === reorderState?.loading ? t('LOADING', 'Loading..') : t('REORDER', 'Reorder')}
806
+ textStyle={{ fontSize: 14, color: theme.colors.primary }}
807
+ imgRightSrc={null}
808
+ borderColor='transparent'
809
+ bgColor={theme.colors.primary + 10}
810
+ style={{ borderRadius: 7.6, borderWidth: 1, height: 44, shadowOpacity: 0, marginTop: 29 }}
811
+ onClick={() => handleReorder && handleReorder(order.id)}
812
+ />
813
+ )}
805
814
  </OrderAction>
806
815
  </HeaderInfo>
807
816
  <OrderProducts>
@@ -935,7 +944,7 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
935
944
  </Table>
936
945
  ))
937
946
  }
938
- {order?.summary?.delivery_price > 0 && (
947
+ {typeof order?.summary?.delivery_price === 'number' && (
939
948
  <Table>
940
949
  <OText size={12} lineHeight={18} weight={'400'} color={theme.colors.textNormal}>{t('DELIVERY_FEE', 'Delivery Fee')}</OText>
941
950
  <OText size={12} lineHeight={18} weight={'400'} color={theme.colors.textNormal}>{parsePrice(order?.summary?.delivery_price)}</OText>
@@ -1010,16 +1019,18 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
1010
1019
  <OText>
1011
1020
  {event?.wallet_event
1012
1021
  ? walletName[event?.wallet_event?.wallet?.type]?.name
1013
- : event?.paymethod?.name}
1022
+ : t(event?.paymethod?.name.toUpperCase()?.replace(/ /g, '_'), event?.paymethod?.name)}
1014
1023
  </OText>
1015
- {event?.data?.charge_id && (
1024
+ {/* {event?.data?.charge_id && (
1016
1025
  <OText>
1017
1026
  {`${t('CODE', 'Code')}: ${event?.data?.charge_id}`}
1018
1027
  </OText>
1019
- )}
1028
+ )} */}
1020
1029
  </View>
1021
1030
  <OText>
1022
- -{parsePrice(event.amount, { isTruncable: true })}
1031
+ {configs.currency_position?.value === 'left'
1032
+ ? `${configs.format_number_currency?.value} -${parseNumber(event.amount, { isTruncable: true })}`
1033
+ : `-${parsePrice(event.amount, { isTruncable: true })}`}
1023
1034
  </OText>
1024
1035
  </View>
1025
1036
  ))}
@@ -1065,6 +1076,7 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
1065
1076
  >
1066
1077
  <OrderHistory
1067
1078
  order={order}
1079
+ hideViaText={props.hideViaText}
1068
1080
  messages={messages}
1069
1081
  enableReview={(
1070
1082
  parseInt(order?.status) === 1 ||
@@ -5,7 +5,6 @@ export const OrderDetailsContainer = styled.ScrollView`
5
5
  `
6
6
 
7
7
  export const NavBack = styled.TouchableOpacity`
8
-
9
8
  `
10
9
 
11
10
 
@@ -20,7 +20,8 @@ export const OrderItAgain = (props: OrderItAgainParams) => {
20
20
  currentCart,
21
21
  handleUpdateProducts,
22
22
  navigation,
23
- searchValue
23
+ searchValue,
24
+ businessSingleId
24
25
  } = props
25
26
 
26
27
  const [, t] = useLanguage()
@@ -65,6 +66,7 @@ export const OrderItAgain = (props: OrderItAgainParams) => {
65
66
  handleUpdateProducts={handleUpdateProducts}
66
67
  navigation={navigation}
67
68
  isPreviously
69
+ businessSingleId={businessSingleId}
68
70
  />
69
71
  </ProductWrapper>
70
72
  ))}