ordering-ui-react-native 0.15.52 → 0.15.54-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 (188) hide show
  1. package/package.json +5 -3
  2. package/src/DeliveryApp.tsx +43 -1
  3. package/src/components/AddressForm/index.tsx +18 -2
  4. package/src/components/BusinessController/index.tsx +16 -8
  5. package/src/components/BusinessTypeFilter/index.tsx +3 -1
  6. package/src/components/BusinessesListing/index.tsx +1 -1
  7. package/src/components/Checkout/index.tsx +23 -2
  8. package/src/components/DriverTips/index.tsx +11 -6
  9. package/src/components/LanguageSelector/index.tsx +7 -2
  10. package/src/components/LoginForm/index.tsx +120 -30
  11. package/src/components/LoginForm/styles.tsx +6 -0
  12. package/src/components/OrderDetails/index.tsx +9 -23
  13. package/src/components/PaymentOptions/index.tsx +67 -50
  14. package/src/components/PaymentOptionsWebView/index.tsx +123 -124
  15. package/src/components/SignupForm/index.tsx +145 -61
  16. package/src/components/SingleProductCard/index.tsx +16 -4
  17. package/src/components/StripeMethodForm/index.tsx +1 -2
  18. package/src/components/UpsellingProducts/index.tsx +1 -1
  19. package/src/components/UserProfileForm/index.tsx +63 -6
  20. package/src/components/UserProfileForm/styles.tsx +8 -0
  21. package/src/components/VerifyPhone/styles.tsx +1 -2
  22. package/src/components/shared/OModal.tsx +1 -1
  23. package/src/hooks/useCountdownTimer.tsx +26 -0
  24. package/src/navigators/CheckoutNavigator.tsx +6 -0
  25. package/src/navigators/HomeNavigator.tsx +12 -0
  26. package/src/pages/BusinessesListing.tsx +1 -1
  27. package/src/pages/MultiCheckout.tsx +31 -0
  28. package/src/pages/MultiOrdersDetails.tsx +27 -0
  29. package/src/pages/Sessions.tsx +22 -0
  30. package/src/theme.json +0 -1
  31. package/src/types/index.tsx +18 -11
  32. package/src/utils/index.tsx +68 -1
  33. package/themes/business/src/components/AcceptOrRejectOrder/index.tsx +103 -15
  34. package/themes/business/src/components/AcceptOrRejectOrder/styles.tsx +6 -0
  35. package/themes/business/src/components/Chat/index.tsx +42 -90
  36. package/themes/business/src/components/DriverMap/index.tsx +6 -5
  37. package/themes/business/src/components/Home/index.tsx +128 -55
  38. package/themes/business/src/components/Home/styles.tsx +8 -1
  39. package/themes/business/src/components/LoginForm/index.tsx +89 -2
  40. package/themes/business/src/components/LoginForm/styles.tsx +6 -0
  41. package/themes/business/src/components/LogoutButton/index.tsx +1 -1
  42. package/themes/business/src/components/NewOrderNotification/index.tsx +79 -105
  43. package/themes/business/src/components/OrderDetails/Business.tsx +2 -2
  44. package/themes/business/src/components/OrderDetails/Delivery.tsx +35 -18
  45. package/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +159 -91
  46. package/themes/business/src/components/OrderDetails/OrderHeaderComponent.tsx +6 -0
  47. package/themes/business/src/components/OrderDetails/styles.tsx +7 -0
  48. package/themes/business/src/components/OrdersListManager/index.tsx +1 -1
  49. package/themes/business/src/components/OrdersOption/index.tsx +5 -2
  50. package/themes/business/src/components/ProductItemAccordion/index.tsx +2 -2
  51. package/themes/business/src/components/shared/OModal.tsx +1 -1
  52. package/themes/business/src/types/index.tsx +5 -1
  53. package/themes/doordash/src/components/BusinessesListing/index.tsx +1 -1
  54. package/themes/doordash/src/components/LoginForm/index.tsx +1 -2
  55. package/themes/instacart/src/components/BusinessesListing/index.tsx +1 -1
  56. package/themes/kiosk/src/components/BusinessMenu/index.tsx +39 -28
  57. package/themes/kiosk/src/components/BusinessesListing/index.tsx +2 -3
  58. package/themes/kiosk/src/components/Cart/index.tsx +99 -26
  59. package/themes/kiosk/src/components/Cart/styles.tsx +6 -0
  60. package/themes/kiosk/src/components/CartBottomSheet/index.tsx +9 -2
  61. package/themes/kiosk/src/components/CartContent/index.tsx +0 -11
  62. package/themes/kiosk/src/components/CartItem/index.tsx +4 -3
  63. package/themes/kiosk/src/components/CategoriesMenu/index.tsx +107 -62
  64. package/themes/kiosk/src/components/Checkout/index.tsx +40 -22
  65. package/themes/kiosk/src/components/CustomerName/index.tsx +0 -6
  66. package/themes/kiosk/src/components/DrawerView/index.tsx +1 -0
  67. package/themes/kiosk/src/components/DrawerView/styles.tsx +2 -2
  68. package/themes/kiosk/src/components/NavBar/index.tsx +29 -20
  69. package/themes/kiosk/src/components/OptionCard/index.tsx +1 -1
  70. package/themes/kiosk/src/components/OrderDetails/index.tsx +165 -65
  71. package/themes/kiosk/src/components/OrderDetails/styles.tsx +5 -0
  72. package/themes/kiosk/src/components/OrderTypeCardSelector/index.tsx +9 -11
  73. package/themes/kiosk/src/components/PaymentOptions/index.tsx +56 -54
  74. package/themes/kiosk/src/components/ProductForm/index.tsx +7 -8
  75. package/themes/kiosk/src/components/ProductItemAccordion/index.tsx +2 -2
  76. package/themes/kiosk/src/components/ProductOption/index.tsx +1 -1
  77. package/themes/kiosk/src/components/ProductOptionSubOption/index.tsx +3 -1
  78. package/themes/kiosk/src/components/UpsellingProducts/index.tsx +16 -5
  79. package/themes/kiosk/src/components/shared/OButton.tsx +5 -18
  80. package/themes/kiosk/src/types/index.d.ts +3 -0
  81. package/themes/original/index.tsx +169 -4
  82. package/themes/original/src/components/ActiveOrders/index.tsx +15 -132
  83. package/themes/original/src/components/ActiveOrders/styles.tsx +0 -54
  84. package/themes/original/src/components/AddressForm/index.tsx +1 -1
  85. package/themes/original/src/components/AddressList/index.tsx +30 -18
  86. package/themes/original/src/components/AppleLogin/index.tsx +54 -21
  87. package/themes/original/src/components/BusinessBasicInformation/index.tsx +136 -45
  88. package/themes/original/src/components/BusinessBasicInformation/styles.tsx +4 -0
  89. package/themes/original/src/components/BusinessController/index.tsx +48 -11
  90. package/themes/original/src/components/BusinessController/styles.tsx +27 -0
  91. package/themes/original/src/components/BusinessFeaturedController/index.tsx +20 -1
  92. package/themes/original/src/components/BusinessFeaturedController/styles.tsx +23 -0
  93. package/themes/original/src/components/BusinessItemAccordion/index.tsx +8 -5
  94. package/themes/original/src/components/BusinessItemAccordion/styles.tsx +3 -1
  95. package/themes/original/src/components/BusinessListingSearch/index.tsx +196 -58
  96. package/themes/original/src/components/BusinessListingSearch/styles.tsx +22 -2
  97. package/themes/original/src/components/BusinessPreorder/index.tsx +1 -1
  98. package/themes/original/src/components/BusinessProductsCategories/index.tsx +2 -2
  99. package/themes/original/src/components/BusinessProductsList/CategoryDescription/index.tsx +44 -0
  100. package/themes/original/src/components/BusinessProductsList/index.tsx +119 -35
  101. package/themes/original/src/components/BusinessProductsList/styles.tsx +12 -4
  102. package/themes/original/src/components/BusinessProductsListing/index.tsx +109 -21
  103. package/themes/original/src/components/BusinessProductsListing/styles.tsx +22 -0
  104. package/themes/original/src/components/BusinessReviews/index.tsx +10 -26
  105. package/themes/original/src/components/BusinessTypeFilter/index.tsx +1 -2
  106. package/themes/original/src/components/BusinessesListing/index.tsx +127 -66
  107. package/themes/original/src/components/BusinessesListing/styles.tsx +11 -3
  108. package/themes/original/src/components/Cart/index.tsx +60 -41
  109. package/themes/original/src/components/Checkout/index.tsx +48 -32
  110. package/themes/original/src/components/DriverTips/index.tsx +17 -12
  111. package/themes/original/src/components/Favorite/index.tsx +92 -0
  112. package/themes/original/src/components/Favorite/styles.tsx +22 -0
  113. package/themes/original/src/components/FavoriteList/index.tsx +298 -0
  114. package/themes/original/src/components/FavoriteList/styles.tsx +5 -0
  115. package/themes/original/src/components/ForgotPasswordForm/index.tsx +84 -4
  116. package/themes/original/src/components/GPSButton/index.tsx +15 -8
  117. package/themes/original/src/components/GoogleMap/index.tsx +1 -0
  118. package/themes/original/src/components/Help/index.tsx +21 -4
  119. package/themes/original/src/components/HighestRatedBusinesses/index.tsx +18 -1
  120. package/themes/original/src/components/Home/index.tsx +1 -1
  121. package/themes/original/src/components/LastOrders/index.tsx +12 -1
  122. package/themes/original/src/components/LoginForm/Otp/index.tsx +91 -0
  123. package/themes/original/src/components/LoginForm/Otp/styles.tsx +7 -0
  124. package/themes/original/src/components/LoginForm/index.tsx +332 -164
  125. package/themes/original/src/components/LoginForm/styles.tsx +1 -3
  126. package/themes/original/src/components/MessageListing/index.tsx +10 -1
  127. package/themes/original/src/components/Messages/index.tsx +1 -1
  128. package/themes/original/src/components/MomentOption/index.tsx +10 -1
  129. package/themes/original/src/components/MomentOption/styles.tsx +1 -1
  130. package/themes/original/src/components/MultiCartsPaymethodsAndWallets/index.tsx +243 -0
  131. package/themes/original/src/components/MultiCartsPaymethodsAndWallets/styles.tsx +46 -0
  132. package/themes/original/src/components/MultiCheckout/index.tsx +298 -0
  133. package/themes/original/src/components/MultiCheckout/styles.tsx +59 -0
  134. package/themes/original/src/components/MultiOrdersDetails/SingleOrderCard.tsx +372 -0
  135. package/themes/original/src/components/MultiOrdersDetails/index.tsx +258 -0
  136. package/themes/original/src/components/MultiOrdersDetails/styles.tsx +50 -0
  137. package/themes/original/src/components/MyOrders/index.tsx +120 -32
  138. package/themes/original/src/components/MyOrders/styles.tsx +8 -1
  139. package/themes/original/src/components/OrderDetails/OrderHistory.tsx +167 -0
  140. package/themes/original/src/components/OrderDetails/index.tsx +117 -46
  141. package/themes/original/src/components/OrderDetails/styles.tsx +1 -2
  142. package/themes/original/src/components/OrderSummary/index.tsx +3 -3
  143. package/themes/original/src/components/OrderTypeSelector/index.tsx +4 -2
  144. package/themes/original/src/components/OrdersOption/PreviousBusinessOrdered/index.tsx +153 -0
  145. package/themes/original/src/components/OrdersOption/PreviousBusinessOrdered/styles.tsx +6 -0
  146. package/themes/original/src/components/OrdersOption/PreviousProductsOrdered/index.tsx +53 -0
  147. package/themes/original/src/components/OrdersOption/PreviousProductsOrdered/styles.tsx +6 -0
  148. package/themes/original/src/components/OrdersOption/index.tsx +130 -38
  149. package/themes/original/src/components/OrdersOption/styles.tsx +4 -1
  150. package/themes/original/src/components/PaymentOptionCash/index.tsx +2 -2
  151. package/themes/original/src/components/PaymentOptionWallet/index.tsx +17 -23
  152. package/themes/original/src/components/PaymentOptionWallet/styles.tsx +1 -1
  153. package/themes/original/src/components/PaymentOptions/index.tsx +57 -36
  154. package/themes/original/src/components/PhoneInputNumber/index.tsx +1 -1
  155. package/themes/original/src/components/PreviousOrders/index.tsx +18 -147
  156. package/themes/original/src/components/ProductForm/index.tsx +70 -62
  157. package/themes/original/src/components/ProductForm/styles.tsx +0 -1
  158. package/themes/original/src/components/ProductItemAccordion/index.tsx +2 -2
  159. package/themes/original/src/components/ProductOptionSubOption/index.tsx +18 -12
  160. package/themes/original/src/components/Promotions/index.tsx +151 -133
  161. package/themes/original/src/components/Promotions/styles.tsx +3 -23
  162. package/themes/original/src/components/SearchBar/index.tsx +10 -4
  163. package/themes/original/src/components/Sessions/index.tsx +160 -0
  164. package/themes/original/src/components/Sessions/styles.tsx +15 -0
  165. package/themes/original/src/components/SignupForm/index.tsx +335 -128
  166. package/themes/original/src/components/SingleOrderCard/index.tsx +282 -0
  167. package/themes/original/src/components/SingleOrderCard/styles.tsx +54 -0
  168. package/themes/original/src/components/SingleProductCard/index.tsx +59 -17
  169. package/themes/original/src/components/StripeElementsForm/index.tsx +16 -8
  170. package/themes/original/src/components/StripeElementsForm/naked.tsx +2 -2
  171. package/themes/original/src/components/UpsellingProducts/index.tsx +86 -74
  172. package/themes/original/src/components/UserDetails/index.tsx +5 -96
  173. package/themes/original/src/components/UserFormDetails/index.tsx +34 -24
  174. package/themes/original/src/components/UserProfile/index.tsx +53 -6
  175. package/themes/original/src/components/UserProfileForm/index.tsx +20 -18
  176. package/themes/original/src/components/UserVerification/index.tsx +178 -192
  177. package/themes/original/src/components/VerifyPhone/index.tsx +10 -7
  178. package/themes/original/src/components/VerifyPhone/styles.tsx +2 -1
  179. package/themes/original/src/components/Wallets/index.tsx +76 -9
  180. package/themes/original/src/components/Wallets/styles.tsx +21 -0
  181. package/themes/original/src/components/shared/OModal.tsx +4 -2
  182. package/themes/original/src/config/constants.tsx +6 -6
  183. package/themes/original/src/types/index.tsx +193 -32
  184. package/themes/original/src/utils/index.tsx +85 -2
  185. package/themes/single-business/src/components/AddressList/index.tsx +1 -1
  186. package/themes/single-business/src/components/OrderTypeSelector/index.tsx +1 -1
  187. package/themes/single-business/src/components/UserProfile/index.tsx +1 -1
  188. package/themes/uber-eats/src/components/BusinessesListing/index.tsx +1 -1
@@ -42,7 +42,8 @@ import { OSRow } from '../OrderSummary/styles';
42
42
  import AntIcon from 'react-native-vector-icons/AntDesign'
43
43
  import { TaxInformation } from '../TaxInformation';
44
44
  import { Placeholder, PlaceholderLine } from 'rn-placeholder';
45
-
45
+ import NavBar from '../NavBar'
46
+ import { OrderHistory } from './OrderHistory';
46
47
  export const OrderDetailsUI = (props: OrderDetailsParams) => {
47
48
  const {
48
49
  navigation,
@@ -82,8 +83,14 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
82
83
  justifyContent: 'flex-start',
83
84
  paddingLeft: 0,
84
85
  height: 30,
85
- width: 40,
86
+ width: 30,
87
+ marginTop: Platform.OS === 'ios' ? 0 : 30
86
88
  },
89
+ linkWrapper: {
90
+ display: 'flex',
91
+ alignItems: 'center',
92
+ flexDirection: 'row'
93
+ }
87
94
  });
88
95
 
89
96
  const [, t] = useLanguage();
@@ -92,8 +99,10 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
92
99
  const [{ carts }] = useOrder()
93
100
 
94
101
  const [isReviewed, setIsReviewed] = useState(false)
102
+ const [isOrderHistory, setIsOrderHistory] = useState(false)
95
103
  const [openTaxModal, setOpenTaxModal] = useState<any>({ open: false, tax: null, type: '' })
96
104
  const { order, businessData } = props.order;
105
+ const mapValidStatuses = [9, 19, 23]
97
106
 
98
107
  const walletName: any = {
99
108
  cash: {
@@ -331,7 +340,7 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
331
340
  };
332
341
 
333
342
  const getIncludedTaxes = () => {
334
- if (order?.taxes?.length === 0) {
343
+ if (order?.taxes?.length === 0 || !order?.taxes) {
335
344
  return order.tax_type === 1 ? order?.summary?.tax ?? 0 : 0
336
345
  } else {
337
346
  return order?.taxes.reduce((taxIncluded: number, tax: any) => {
@@ -362,18 +371,34 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
362
371
  )
363
372
  }
364
373
 
374
+ const handleTriggerReview = () => {
375
+ setIsOrderHistory(false);
376
+ (
377
+ parseInt(order?.status) === 1 ||
378
+ parseInt(order?.status) === 11 ||
379
+ parseInt(order?.status) === 15
380
+ ) && !order.review && !isReviewed && handleClickOrderReview(order)
381
+ }
365
382
 
366
383
  useEffect(() => {
384
+ const _businessId = 'businessId:' + businessData?.id
367
385
  if (reorderState?.error) {
368
- const _businessId = 'businessId:' + businessData?.id
369
- const _uuid = carts[_businessId]?.uuid
370
- if (_uuid) {
371
- _setStoreData('remove-cartId', JSON.stringify(_uuid))
386
+ if (businessData?.id) {
387
+ _setStoreData('adjust-cart-products', JSON.stringify(_businessId))
372
388
  navigation.navigate('Business', { store: businessData?.slug })
373
389
  }
374
390
  }
375
- if (!reorderState?.error && reorderState?.result?.uuid) {
376
- onNavigationRedirect && onNavigationRedirect('CheckoutNavigator', { cartUuid: reorderState?.result.uuid })
391
+ if (!reorderState?.error && reorderState.loading === false && businessData?.id) {
392
+ const products = carts?.[_businessId]?.products
393
+ const available = products?.every((product: any) => product.valid === true)
394
+
395
+ if (available && reorderState?.result?.uuid && (products?.length === order?.products.length)) {
396
+ onNavigationRedirect && onNavigationRedirect('CheckoutNavigator', { cartUuid: reorderState?.result.uuid })
397
+ } else {
398
+ _setStoreData('adjust-cart-products', JSON.stringify(_businessId))
399
+ products?.length !== order?.products.length && _setStoreData('already-removed', JSON.stringify('removed'))
400
+ navigation.navigate('Business', { store: businessData?.slug })
401
+ }
377
402
  }
378
403
  }, [reorderState])
379
404
 
@@ -405,10 +430,19 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
405
430
  'https://res.cloudinary.com/demo/image/upload/c_thumb,g_face,r_max/d_avatar.png/non_existing_id.png',
406
431
  },
407
432
  ];
433
+ const driverLocationString = typeof order?.driver?.location?.location === 'string' && order?.driver?.location?.location?.split(',').map((l: string) => l.replace(/[^-.0-9]/g, ''))
434
+ const parsedLocations = locations.map(location => typeof location?.location === 'string' ? {
435
+ ...location,
436
+ lat: parseFloat(location?.location?.split(',')[0].replace(/[^-.0-9]/g, '')),
437
+ lng: parseFloat(location?.location?.split(',')[1].replace(/[^-.0-9]/g, ''))
438
+ } : location)
408
439
 
409
440
  useEffect(() => {
410
441
  if (driverLocation) {
411
- locations[0] = driverLocation;
442
+ parsedLocations[0] = {
443
+ ...locations[0],
444
+ ...driverLocation
445
+ }
412
446
  }
413
447
  }, [driverLocation]);
414
448
 
@@ -469,28 +503,25 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
469
503
  {order && Object.keys(order).length > 0 && (
470
504
  <>
471
505
  <Header>
472
- <OButton
473
- imgLeftSrc={theme.images.general.arrow_left}
474
- imgRightSrc={null}
475
- style={styles.btnBackArrow}
476
- onClick={() => handleArrowBack()}
477
- imgLeftStyle={{ tintColor: theme.colors.disabled }}
506
+ <NavBar
507
+ title={`${t('ORDER', 'Order')} #${order?.id}`}
508
+ titleAlign={'center'}
509
+ onActionLeft={handleArrowBack}
510
+ showCall={false}
511
+ btnStyle={{ paddingLeft: 0 }}
512
+ style={{ marginTop: Platform.OS === 'ios' ? 0 : 20 }}
513
+ titleWrapStyle={{ paddingHorizontal: 0 }}
514
+ titleStyle={{ marginRight: 0, marginLeft: 0 }}
515
+ subTitle={<OText size={12} lineHeight={18} color={theme.colors.textNormal}>
516
+ {order?.delivery_datetime_utc
517
+ ? parseDate(order?.delivery_datetime_utc)
518
+ : parseDate(order?.delivery_datetime, { utc: false })}
519
+ </OText>}
478
520
  />
479
521
  <OrderInfo>
480
522
  <OrderData>
481
- <OText
482
- size={20}
483
- lineHeight={30}
484
- weight={'600'}
485
- color={theme.colors.textNormal}>
486
- {t('ORDER', 'Order')} #{order?.id}
487
- </OText>
488
- <OText size={12} lineHeight={18} color={theme.colors.textNormal}>
489
- {order?.delivery_datetime_utc
490
- ? parseDate(order?.delivery_datetime_utc)
491
- : parseDate(order?.delivery_datetime, { utc: false })}
492
- </OText>
493
- {
523
+ <View style={styles.linkWrapper}>
524
+ {
494
525
  (
495
526
  parseInt(order?.status) === 1 ||
496
527
  parseInt(order?.status) === 11 ||
@@ -498,20 +529,36 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
498
529
  ) && !order.review && !isReviewed && (
499
530
  <TouchableOpacity
500
531
  activeOpacity={0.7}
501
- style={{ marginTop: 6 }}
532
+ style={{ marginTop: 6, marginRight: 10 }}
502
533
  onPress={() => handleClickOrderReview(order)}
503
-
504
534
  >
505
535
  <OText
506
536
  size={10}
507
537
  lineHeight={15}
508
- color={theme.colors.textSecondary}
538
+ color={theme.colors.primary}
509
539
  style={{ textDecorationLine: 'underline' }}
510
540
  >
511
541
  {t('REVIEW_YOUR_ORDER', 'Review your order')}
512
542
  </OText>
513
543
  </TouchableOpacity>
514
544
  )}
545
+ <TouchableOpacity
546
+ activeOpacity={0.7}
547
+ style={{ marginTop: 6 }}
548
+ onPress={() => setIsOrderHistory(true)}
549
+
550
+ >
551
+ <OText
552
+ size={10}
553
+ lineHeight={15}
554
+ color={theme.colors.primary}
555
+ style={{ textDecorationLine: 'underline', textTransform: 'capitalize' }}
556
+ >
557
+ {t('VIEW_DETAILS', 'View Details')}
558
+ </OText>
559
+ </TouchableOpacity>
560
+ </View>
561
+
515
562
  <StaturBar>
516
563
  <LinearGradient
517
564
  start={{ x: 0.0, y: 0.0 }}
@@ -651,13 +698,15 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
651
698
  mBottom={2}>
652
699
  {order?.customer?.address}
653
700
  </OText>
654
- <OText
655
- size={12}
656
- lineHeight={18}
657
- color={theme.colors.textNormal}
658
- mBottom={2}>
659
- {order?.customer?.cellphone}
660
- </OText>
701
+ {(!!order?.customer?.cellphone) && (
702
+ <OText
703
+ size={12}
704
+ lineHeight={18}
705
+ color={theme.colors.textNormal}
706
+ mBottom={2}>
707
+ {`${!!order?.customer?.country_phone_code ? '+' + order?.customer?.country_phone_code : ''} ${order?.customer?.cellphone}`}
708
+ </OText>
709
+ )}
661
710
  </InfoBlock>
662
711
  </Customer>
663
712
  {order?.delivery_option !== undefined && order?.delivery_type === 1 && (
@@ -670,7 +719,7 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
670
719
  </OText>
671
720
  </View>
672
721
  )}
673
- {order?.comment && (
722
+ {!!order?.comment && (
674
723
  <View style={{ marginTop: 15 }}>
675
724
  <OText size={16} style={{ textAlign: 'left' }} color={theme.colors.textNormal}>
676
725
  {t('COMMENT', 'Comment')}
@@ -680,11 +729,16 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
680
729
  )}
681
730
  {order?.driver && (
682
731
  <>
683
- {order?.driver?.location && parseInt(order?.status) === 9 && (
732
+ {order?.driver?.location && mapValidStatuses.includes(parseInt(order?.status)) && (
684
733
  <Map>
685
- <GoogleMap
686
- location={order?.driver?.location}
687
- locations={locations}
734
+ <GoogleMap
735
+ location={typeof order?.driver?.location?.location === 'string'
736
+ ? {
737
+ lat: parseFloat(driverLocationString[0]),
738
+ lng: parseFloat(driverLocationString[1]),
739
+ } : driverLocation ?? order?.driver?.location
740
+ }
741
+ locations={parsedLocations}
688
742
  readOnly
689
743
  />
690
744
  </Map>
@@ -898,7 +952,7 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
898
952
  <OSRow>
899
953
  <OText size={12} lineHeight={18} weight={'400'} color={theme.colors.textNormal} numberOfLines={1}>
900
954
  {fee.name || t('INHERIT_FROM_BUSINESS', 'Inherit from business')}
901
- ({fee?.fixed > 0 && `${parsePrice(fee?.fixed)} + `}{fee.percentage}%){' '}
955
+ ({fee?.fixed > 0 && `${parsePrice(fee?.fixed)}${fee.percentage > 0 ? ' + ' : ''}`}{fee.percentage > 0 && `${fee.percentage}%`}){' '}
902
956
  </OText>
903
957
  <TouchableOpacity onPress={() => setOpenTaxModal({ open: true, data: fee, type: 'fee' })}>
904
958
  <AntIcon name='infocirlceo' size={16} color={theme.colors.primary} />
@@ -1010,7 +1064,7 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
1010
1064
  )}
1011
1065
  </View>
1012
1066
  <OText>
1013
- -{parsePrice(event.amount)}
1067
+ -{parsePrice(event.amount, { isTruncable: true })}
1014
1068
  </OText>
1015
1069
  </View>
1016
1070
  ))}
@@ -1032,6 +1086,23 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
1032
1086
  products={order?.products}
1033
1087
  />
1034
1088
  </OModal>
1089
+ <OModal
1090
+ open={isOrderHistory}
1091
+ onClose={() => setIsOrderHistory(false)}
1092
+ entireModal
1093
+ >
1094
+ <OrderHistory
1095
+ order={order}
1096
+ messages={messages}
1097
+ enableReview={(
1098
+ parseInt(order?.status) === 1 ||
1099
+ parseInt(order?.status) === 11 ||
1100
+ parseInt(order?.status) === 15
1101
+ ) && !order.review && !isReviewed}
1102
+ onClose={() => setIsOrderHistory(false)}
1103
+ handleTriggerReview={handleTriggerReview}
1104
+ />
1105
+ </OModal>
1035
1106
  </OrderDetailsContainer>
1036
1107
  );
1037
1108
  };
@@ -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
 
@@ -127,4 +126,4 @@ export const Divider = styled.View`
127
126
  `
128
127
  export const OrderAction = styled.View`
129
128
  flex-direction: row;
130
- `
129
+ `
@@ -71,7 +71,7 @@ const OrderSummaryUI = (props: any) => {
71
71
  }
72
72
 
73
73
  const getIncludedTaxes = () => {
74
- if (cart?.taxes === null) {
74
+ if (cart?.taxes === null || !cart?.taxes) {
75
75
  return cart.business.tax_type === 1 ? cart?.tax : 0
76
76
  } else {
77
77
  return cart?.taxes.reduce((taxIncluded: number, tax: any) => {
@@ -112,7 +112,7 @@ const OrderSummaryUI = (props: any) => {
112
112
  {cart?.products?.length > 0 && (
113
113
  <>
114
114
  <OSProductList>
115
- {cart?.products.map((product: any) => (
115
+ {cart?.products?.map((product: any) => (
116
116
  <ProductItemAccordion
117
117
  key={product.code}
118
118
  product={product}
@@ -202,7 +202,7 @@ const OrderSummaryUI = (props: any) => {
202
202
  <OSRow>
203
203
  <OText size={12} numberOfLines={1}>
204
204
  {fee.name || t('INHERIT_FROM_BUSINESS', 'Inherit from business')}{' '}
205
- ({fee?.fixed > 0 && `${parsePrice(fee?.fixed)} + `}{fee.percentage}%)
205
+ ({fee?.fixed > 0 && `${parsePrice(fee?.fixed)}${fee.percentage > 0 ? ' + ' : ''}`}{fee.percentage > 0 && `${fee.percentage}%`}){' '}
206
206
  </OText>
207
207
  <TouchableOpacity onPress={() => setOpenTaxModal({ open: true, data: fee, type: 'fee' })} >
208
208
  <AntIcon name='infocirlceo' size={16} color={theme.colors.primary} />
@@ -19,7 +19,8 @@ const OrderTypeSelectorUI = (props: OrderTypeSelectParams) => {
19
19
  typeSelected,
20
20
  defaultValue,
21
21
  configTypes,
22
- orderTypes
22
+ orderTypes,
23
+ setOrderTypeValue
23
24
  } = props
24
25
 
25
26
  const theme = useTheme();
@@ -39,6 +40,7 @@ const OrderTypeSelectorUI = (props: OrderTypeSelectParams) => {
39
40
 
40
41
  const handleChangeOrderTypeCallback = (orderType: number) => {
41
42
  if (!orderState.loading) {
43
+ setOrderTypeValue && setOrderTypeValue(orderType)
42
44
  handleChangeOrderType(orderType)
43
45
  goToBack();
44
46
  }
@@ -51,7 +53,7 @@ const OrderTypeSelectorUI = (props: OrderTypeSelectParams) => {
51
53
  btnStyle={{ paddingLeft: 0 }}
52
54
  paddingTop={0}
53
55
  style={{ paddingBottom: 0 }}
54
- title={t('HOW_WILL_YOUR_ORDER_TYPE', 'How will your order type?')}
56
+ title={t('HOW_WILL_YOU_DELIVERY_TYPE', 'How will your order type?')}
55
57
  titleAlign={'center'}
56
58
  titleStyle={{ fontSize: 14 }}
57
59
  />
@@ -0,0 +1,153 @@
1
+ import React, { useEffect } from 'react'
2
+ import { BusinessList as BusinessListController, useOrder } from 'ordering-components/native'
3
+ import { BusinessController } from '../../BusinessController'
4
+ import { Fade, Placeholder, PlaceholderLine } from 'rn-placeholder';
5
+
6
+ import { ListWrapper } from './styles'
7
+ import {
8
+ View,
9
+ StyleSheet,
10
+ ScrollView,
11
+ Dimensions
12
+ } from 'react-native';
13
+ import { PreviousBusinessOrderedParams } from '../../../types';
14
+
15
+ export const PreviousBusinessOrderedUI = (props: PreviousBusinessOrderedParams) => {
16
+ const {
17
+ navigation,
18
+ businessesList,
19
+ setBusinessLoading,
20
+ businessId,
21
+ onNavigationRedirect,
22
+ isBusinessesSearchList,
23
+ businessLoading
24
+ } = props
25
+
26
+ const [orderState] = useOrder()
27
+ const windowWidth = Dimensions.get('window').width;
28
+
29
+ const onBusinessClick = (business: any) => {
30
+ onNavigationRedirect('Business', { store: business.slug })
31
+ }
32
+ useEffect(() => {
33
+ if (businessesList?.loading && businessesList?.businesses?.length === 0) {
34
+ setBusinessLoading(true)
35
+ } else {
36
+ setBusinessLoading(false)
37
+ }
38
+ }, [businessesList?.loading])
39
+
40
+ const styles = StyleSheet.create({
41
+ container: {
42
+ marginBottom: 0,
43
+ },
44
+ });
45
+
46
+ const BusinessControllerList = ({ style }: any) => {
47
+ return (
48
+ <>
49
+ {businessesList.businesses?.filter((business: any) => businessId?.includes(business?.id))?.map((business: any, i: number) => (
50
+ <BusinessController
51
+ key={`${business.id}_` + i}
52
+ business={business}
53
+ isBusinessOpen={business.open}
54
+ handleCustomClick={() => onBusinessClick(business)}
55
+ orderType={orderState?.options?.type}
56
+ navigation={navigation}
57
+ businessHeader={business?.header}
58
+ businessFeatured={business?.featured}
59
+ businessLogo={business?.logo}
60
+ businessReviews={business?.reviews}
61
+ businessDeliveryPrice={business?.delivery_price}
62
+ businessDeliveryTime={business?.delivery_time}
63
+ businessPickupTime={business?.pickup_time}
64
+ businessDistance={business?.distance}
65
+ style={style}
66
+ />
67
+ ))}
68
+ </>
69
+ )
70
+ }
71
+
72
+ const BusinessSkeletons = () => {
73
+ return (
74
+ <>
75
+ {[...Array(4).keys()].map((item, i) => (
76
+ <Placeholder
77
+ Animation={Fade}
78
+ key={i}
79
+ style={{ marginBottom: 20 }}>
80
+ <View style={{ width: '100%' }}>
81
+ <PlaceholderLine
82
+ height={200}
83
+ style={{ marginBottom: 20, borderRadius: 25 }}
84
+ />
85
+ <View style={{ paddingHorizontal: 10 }}>
86
+ <View
87
+ style={{
88
+ flexDirection: 'row',
89
+ justifyContent: 'space-between',
90
+ }}>
91
+ <PlaceholderLine
92
+ height={25}
93
+ width={40}
94
+ style={{ marginBottom: 10 }}
95
+ />
96
+ <PlaceholderLine
97
+ height={25}
98
+ width={20}
99
+ style={{ marginBottom: 10 }}
100
+ />
101
+ </View>
102
+ <PlaceholderLine
103
+ height={20}
104
+ width={30}
105
+ style={{ marginBottom: 10 }}
106
+ />
107
+ <PlaceholderLine
108
+ height={20}
109
+ width={80}
110
+ style={{ marginBottom: 10 }}
111
+ />
112
+ </View>
113
+ </View>
114
+ </Placeholder>
115
+ ))}
116
+ </>
117
+ )
118
+ }
119
+
120
+ return (
121
+ <ScrollView horizontal={isBusinessesSearchList} style={styles.container} showsVerticalScrollIndicator={false}>
122
+ {isBusinessesSearchList ? (
123
+ <>
124
+ {!businessLoading && (
125
+ <BusinessControllerList
126
+ style={{ width: windowWidth - 80, marginRight: 20 }}
127
+ />
128
+ )}
129
+ </>
130
+ ) : (
131
+ <ListWrapper>
132
+ <BusinessControllerList />
133
+ {businessesList.loading && (
134
+ <BusinessSkeletons />
135
+ )}
136
+ </ListWrapper>
137
+ )}
138
+
139
+ </ScrollView>
140
+ )
141
+ }
142
+
143
+ export const PreviousBusinessOrdered = (props: PreviousBusinessOrderedParams) => {
144
+ const previousBusinessOrderedController = {
145
+ ...props,
146
+ UIComponent: PreviousBusinessOrderedUI,
147
+ paginationSettings: { initialPage: 1, pageSize: 50, controlType: 'infinity' }
148
+ }
149
+
150
+ return (
151
+ <BusinessListController {...previousBusinessOrderedController} />
152
+ )
153
+ }
@@ -0,0 +1,6 @@
1
+ import styled, { css } from 'styled-components/native'
2
+
3
+ export const ListWrapper = styled.View`
4
+ background-color: ${(props: any) => props.theme.colors.backgroundLight};
5
+ padding-horizontal: ${(props : any) => props.isBusinessesSearchList ? '0' : '40px'};
6
+ `;
@@ -0,0 +1,53 @@
1
+ import React from 'react'
2
+ import { ScrollView, StyleSheet, Dimensions } from 'react-native'
3
+ import {
4
+ ListWrapper
5
+ } from './styles'
6
+
7
+ import { SingleProductCard } from '../../SingleProductCard'
8
+ import { PreviousProductsOrderedParams } from '../../../types'
9
+
10
+ export const PreviousProductsOrdered = (props: PreviousProductsOrderedParams) => {
11
+ const {
12
+ products,
13
+ onProductClick,
14
+ isBusinessesSearchList
15
+ } = props
16
+
17
+ const windowWidth = Dimensions.get('window').width;
18
+
19
+ const styles = StyleSheet.create({
20
+ container: {
21
+ marginBottom: 0,
22
+ },
23
+ });
24
+
25
+ const ProductList = ({ style }: any) => {
26
+ return (
27
+ <>
28
+ {products?.map((product: any) => (
29
+ <SingleProductCard
30
+ key={product?.id}
31
+ isSoldOut={(product.inventoried && !product.quantity)}
32
+ product={product}
33
+ businessId={product?.business?.id}
34
+ onProductClick={onProductClick}
35
+ style={style}
36
+ productAddedToCartLength={0}
37
+ />
38
+ ))}
39
+ </>
40
+ )
41
+ }
42
+ return (
43
+ <ScrollView horizontal={isBusinessesSearchList} style={styles.container} showsVerticalScrollIndicator={false}>
44
+ {isBusinessesSearchList ? (
45
+ <ProductList style={{ width: windowWidth - 80, marginRight: 20 }} />
46
+ ) : (
47
+ <ListWrapper isBusinessesSearchList={isBusinessesSearchList}>
48
+ <ProductList />
49
+ </ListWrapper>
50
+ )}
51
+ </ScrollView>
52
+ )
53
+ }
@@ -0,0 +1,6 @@
1
+ import styled from 'styled-components/native'
2
+
3
+ export const ListWrapper = styled.View`
4
+ background-color: ${(props: any) => props.theme.colors.backgroundLight};
5
+ padding-horizontal: ${(props : any) => props.isBusinessesSearchList ? '0' : '40px'};
6
+ `;