ordering-ui-react-native 0.15.42 → 0.15.44-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 (191) hide show
  1. package/package.json +6 -3
  2. package/src/DeliveryApp.tsx +43 -1
  3. package/src/components/AddressForm/index.tsx +18 -2
  4. package/src/components/BusinessController/index.tsx +8 -2
  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 +3 -1
  11. package/src/components/OrderDetails/index.tsx +9 -23
  12. package/src/components/PaymentOptions/index.tsx +1 -1
  13. package/src/components/PaymentOptionsWebView/index.tsx +123 -124
  14. package/src/components/SignupForm/index.tsx +3 -1
  15. package/src/components/SingleProductCard/index.tsx +16 -4
  16. package/src/components/StripeMethodForm/index.tsx +1 -2
  17. package/src/components/UpsellingProducts/index.tsx +1 -1
  18. package/src/components/UserProfileForm/index.tsx +63 -6
  19. package/src/components/UserProfileForm/styles.tsx +8 -0
  20. package/src/components/VerifyPhone/styles.tsx +1 -2
  21. package/src/components/shared/OModal.tsx +1 -1
  22. package/src/hooks/useCountdownTimer.tsx +26 -0
  23. package/src/navigators/CheckoutNavigator.tsx +6 -0
  24. package/src/navigators/HomeNavigator.tsx +12 -0
  25. package/src/pages/BusinessesListing.tsx +1 -1
  26. package/src/pages/MultiCheckout.tsx +31 -0
  27. package/src/pages/MultiOrdersDetails.tsx +27 -0
  28. package/src/pages/Sessions.tsx +22 -0
  29. package/src/theme.json +0 -1
  30. package/src/types/index.tsx +5 -2
  31. package/src/utils/index.tsx +68 -1
  32. package/themes/business/src/components/AcceptOrRejectOrder/index.tsx +103 -15
  33. package/themes/business/src/components/AcceptOrRejectOrder/styles.tsx +6 -0
  34. package/themes/business/src/components/Chat/index.tsx +42 -90
  35. package/themes/business/src/components/DriverMap/index.tsx +6 -5
  36. package/themes/business/src/components/Home/index.tsx +128 -55
  37. package/themes/business/src/components/Home/styles.tsx +8 -1
  38. package/themes/business/src/components/LoginForm/index.tsx +89 -2
  39. package/themes/business/src/components/LoginForm/styles.tsx +6 -0
  40. package/themes/business/src/components/LogoutButton/index.tsx +1 -1
  41. package/themes/business/src/components/NewOrderNotification/index.tsx +79 -105
  42. package/themes/business/src/components/OrderDetails/Business.tsx +1 -1
  43. package/themes/business/src/components/OrderDetails/Delivery.tsx +35 -18
  44. package/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +159 -91
  45. package/themes/business/src/components/OrderDetails/OrderHeaderComponent.tsx +6 -0
  46. package/themes/business/src/components/OrderDetails/styles.tsx +7 -0
  47. package/themes/business/src/components/OrdersListManager/index.tsx +52 -49
  48. package/themes/business/src/components/OrdersOption/index.tsx +57 -50
  49. package/themes/business/src/components/PreviousOrders/index.tsx +50 -14
  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 +8 -9
  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 +180 -3
  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 +117 -78
  87. package/themes/original/src/components/BusinessBasicInformation/index.tsx +70 -41
  88. package/themes/original/src/components/BusinessController/index.tsx +50 -12
  89. package/themes/original/src/components/BusinessController/styles.tsx +27 -0
  90. package/themes/original/src/components/BusinessFeaturedController/index.tsx +20 -1
  91. package/themes/original/src/components/BusinessFeaturedController/styles.tsx +23 -0
  92. package/themes/original/src/components/BusinessItemAccordion/index.tsx +8 -5
  93. package/themes/original/src/components/BusinessItemAccordion/styles.tsx +3 -1
  94. package/themes/original/src/components/BusinessListingSearch/index.tsx +196 -58
  95. package/themes/original/src/components/BusinessListingSearch/styles.tsx +22 -2
  96. package/themes/original/src/components/BusinessPreorder/index.tsx +2 -2
  97. package/themes/original/src/components/BusinessProductsCategories/index.tsx +8 -6
  98. package/themes/original/src/components/BusinessProductsList/CategoryDescription/index.tsx +44 -0
  99. package/themes/original/src/components/BusinessProductsList/index.tsx +120 -36
  100. package/themes/original/src/components/BusinessProductsList/styles.tsx +12 -4
  101. package/themes/original/src/components/BusinessProductsListing/index.tsx +116 -26
  102. package/themes/original/src/components/BusinessProductsListing/styles.tsx +22 -0
  103. package/themes/original/src/components/BusinessReviews/index.tsx +4 -25
  104. package/themes/original/src/components/BusinessTypeFilter/index.tsx +1 -2
  105. package/themes/original/src/components/BusinessesListing/index.tsx +127 -66
  106. package/themes/original/src/components/BusinessesListing/styles.tsx +11 -3
  107. package/themes/original/src/components/Cart/index.tsx +60 -43
  108. package/themes/original/src/components/Checkout/index.tsx +50 -33
  109. package/themes/original/src/components/DriverTips/index.tsx +17 -12
  110. package/themes/original/src/components/Favorite/index.tsx +91 -0
  111. package/themes/original/src/components/Favorite/styles.tsx +22 -0
  112. package/themes/original/src/components/FavoriteList/index.tsx +287 -0
  113. package/themes/original/src/components/FavoriteList/styles.tsx +5 -0
  114. package/themes/original/src/components/ForgotPasswordForm/index.tsx +84 -4
  115. package/themes/original/src/components/GPSButton/index.tsx +15 -8
  116. package/themes/original/src/components/GoogleMap/index.tsx +1 -0
  117. package/themes/original/src/components/Help/index.tsx +21 -4
  118. package/themes/original/src/components/HighestRatedBusinesses/index.tsx +18 -1
  119. package/themes/original/src/components/Home/index.tsx +1 -1
  120. package/themes/original/src/components/LastOrders/index.tsx +12 -1
  121. package/themes/original/src/components/LoginForm/Otp/index.tsx +90 -0
  122. package/themes/original/src/components/LoginForm/Otp/styles.tsx +7 -0
  123. package/themes/original/src/components/LoginForm/index.tsx +394 -155
  124. package/themes/original/src/components/LoginForm/styles.tsx +7 -4
  125. package/themes/original/src/components/LogoutButton/index.tsx +7 -1
  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/index.tsx +64 -44
  140. package/themes/original/src/components/OrderDetails/styles.tsx +1 -2
  141. package/themes/original/src/components/OrderProgress/index.tsx +3 -3
  142. package/themes/original/src/components/OrderProgress/styles.tsx +1 -0
  143. package/themes/original/src/components/OrderSummary/index.tsx +3 -3
  144. package/themes/original/src/components/OrderTypeSelector/index.tsx +4 -2
  145. package/themes/original/src/components/OrdersOption/PreviousBusinessOrdered/index.tsx +153 -0
  146. package/themes/original/src/components/OrdersOption/PreviousBusinessOrdered/styles.tsx +6 -0
  147. package/themes/original/src/components/OrdersOption/PreviousProductsOrdered/index.tsx +53 -0
  148. package/themes/original/src/components/OrdersOption/PreviousProductsOrdered/styles.tsx +6 -0
  149. package/themes/original/src/components/OrdersOption/index.tsx +133 -41
  150. package/themes/original/src/components/OrdersOption/styles.tsx +4 -7
  151. package/themes/original/src/components/PaymentOptionCash/index.tsx +2 -2
  152. package/themes/original/src/components/PaymentOptionWallet/index.tsx +22 -24
  153. package/themes/original/src/components/PaymentOptionWallet/styles.tsx +1 -1
  154. package/themes/original/src/components/PaymentOptions/index.tsx +19 -15
  155. package/themes/original/src/components/PhoneInputNumber/index.tsx +1 -1
  156. package/themes/original/src/components/PreviousOrders/index.tsx +18 -145
  157. package/themes/original/src/components/ProductForm/index.tsx +74 -66
  158. package/themes/original/src/components/ProductForm/styles.tsx +0 -1
  159. package/themes/original/src/components/ProductItemAccordion/index.tsx +2 -2
  160. package/themes/original/src/components/ProductOptionSubOption/index.tsx +18 -12
  161. package/themes/original/src/components/Promotions/index.tsx +250 -0
  162. package/themes/original/src/components/Promotions/styles.tsx +60 -0
  163. package/themes/original/src/components/SearchBar/index.tsx +10 -4
  164. package/themes/original/src/components/Sessions/index.tsx +160 -0
  165. package/themes/original/src/components/Sessions/styles.tsx +15 -0
  166. package/themes/original/src/components/SignupForm/index.tsx +79 -6
  167. package/themes/original/src/components/SingleOrderCard/index.tsx +282 -0
  168. package/themes/original/src/components/SingleOrderCard/styles.tsx +54 -0
  169. package/themes/original/src/components/SingleProductCard/index.tsx +59 -17
  170. package/themes/original/src/components/StripeElementsForm/index.tsx +10 -2
  171. package/themes/original/src/components/StripeElementsForm/naked.tsx +2 -2
  172. package/themes/original/src/components/TaxInformation/index.tsx +10 -4
  173. package/themes/original/src/components/UpsellingProducts/index.tsx +86 -74
  174. package/themes/original/src/components/UserDetails/index.tsx +5 -96
  175. package/themes/original/src/components/UserFormDetails/index.tsx +34 -24
  176. package/themes/original/src/components/UserProfile/index.tsx +59 -5
  177. package/themes/original/src/components/UserProfileForm/index.tsx +20 -18
  178. package/themes/original/src/components/UserVerification/index.tsx +178 -192
  179. package/themes/original/src/components/VerifyPhone/index.tsx +10 -7
  180. package/themes/original/src/components/VerifyPhone/styles.tsx +2 -1
  181. package/themes/original/src/components/Wallets/index.tsx +76 -9
  182. package/themes/original/src/components/Wallets/styles.tsx +21 -0
  183. package/themes/original/src/components/shared/HeaderTitle.tsx +2 -1
  184. package/themes/original/src/components/shared/OModal.tsx +4 -2
  185. package/themes/original/src/config/constants.tsx +6 -6
  186. package/themes/original/src/types/index.tsx +132 -9
  187. package/themes/original/src/utils/index.tsx +19 -2
  188. package/themes/single-business/src/components/AddressList/index.tsx +1 -1
  189. package/themes/single-business/src/components/OrderTypeSelector/index.tsx +1 -1
  190. package/themes/single-business/src/components/UserProfile/index.tsx +1 -1
  191. package/themes/uber-eats/src/components/BusinessesListing/index.tsx +1 -1
@@ -110,6 +110,7 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
110
110
  const theme = useTheme();
111
111
  const [, t] = useLanguage();
112
112
  const [{ parseDate }] = useUtils()
113
+ const [configState] = useConfig()
113
114
  const [orientationState] = useDeviceOrientation();
114
115
  const [, { showToast }] = useToast();
115
116
  const [openSearchModal, setOpenSearchModal] = useState(false)
@@ -439,55 +440,57 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
439
440
  />
440
441
  </IconWrapper>
441
442
  </View>
442
- <View style={styles.SLAwrapper}>
443
- <View style={{ flex: 0.5 }}>
444
- <OButton
445
- text={t('SLA_SETTING', 'SLA’s Settings')}
446
- textStyle={{ color: theme.colors.backArrow }}
447
- imgRightSrc={null}
448
- style={{
449
- backgroundColor: theme.colors.inputChat,
450
- borderRadius: 7.6,
451
- zIndex: 10,
452
- borderWidth: 0,
453
- minHeight: 40
454
- }}
455
- onClick={onClickSetting}
456
- />
457
- </View>
458
- <View style={{ width: 10, height: '100%' }} />
459
- <View style={{ flex: 0.5, justifyContent: 'center' }}>
460
- <SelectDropdown
461
- defaultButtonText={t('SLA', 'SLA\'s')}
462
- data={preorderTypeList}
463
- onSelect={(selectedItem, index) => {
464
- onFiltered && onFiltered({ ...search, timeStatus: selectedItem?.key })
465
- }}
466
- buttonTextAfterSelection={(selectedItem, index) => {
467
- return selectedItem.name
468
- }}
469
- rowTextForSelection={(item, index) => {
470
- return item.key
471
- }}
472
- buttonStyle={styles.selectOption}
473
- buttonTextStyle={styles.buttonTextStyle}
474
- renderDropdownIcon={isOpened => {
475
- return <FeatherIcon name={isOpened ? 'chevron-up' : 'chevron-down'} color={'#444'} size={18} />;
476
- }}
477
- dropdownStyle={styles.dropdownStyle}
478
- dropdownOverlayColor='transparent'
479
- rowStyle={styles.rowStyle}
480
- renderCustomizedRowChild={(item, index) => {
481
- return (
482
- <SlaOption>
483
- {index !== 0 && <OrderStatus timeState={item?.key} />}
484
- <View><OText size={14} color={'#748194'} >{item?.name}</OText></View>
485
- </SlaOption>
486
- );
487
- }}
488
- />
443
+ {configState?.configs?.order_deadlines_enabled?.value === '1' && (
444
+ <View style={styles.SLAwrapper}>
445
+ <View style={{ flex: 0.5 }}>
446
+ <OButton
447
+ text={t('SLA_SETTING', 'SLA’s Settings')}
448
+ textStyle={{ color: theme.colors.backArrow }}
449
+ imgRightSrc={null}
450
+ style={{
451
+ backgroundColor: theme.colors.inputChat,
452
+ borderRadius: 7.6,
453
+ zIndex: 10,
454
+ borderWidth: 0,
455
+ minHeight: 40
456
+ }}
457
+ onClick={onClickSetting}
458
+ />
459
+ </View>
460
+ <View style={{ width: 10, height: '100%' }} />
461
+ <View style={{ flex: 0.5, justifyContent: 'center' }}>
462
+ <SelectDropdown
463
+ defaultButtonText={t('SLA', 'SLA\'s')}
464
+ data={preorderTypeList}
465
+ onSelect={(selectedItem, index) => {
466
+ onFiltered && onFiltered({ ...search, timeStatus: selectedItem?.key })
467
+ }}
468
+ buttonTextAfterSelection={(selectedItem, index) => {
469
+ return selectedItem.name
470
+ }}
471
+ rowTextForSelection={(item, index) => {
472
+ return item.key
473
+ }}
474
+ buttonStyle={styles.selectOption}
475
+ buttonTextStyle={styles.buttonTextStyle}
476
+ renderDropdownIcon={isOpened => {
477
+ return <FeatherIcon name={isOpened ? 'chevron-up' : 'chevron-down'} color={'#444'} size={18} />;
478
+ }}
479
+ dropdownStyle={styles.dropdownStyle}
480
+ dropdownOverlayColor='transparent'
481
+ rowStyle={styles.rowStyle}
482
+ renderCustomizedRowChild={(item, index) => {
483
+ return (
484
+ <SlaOption>
485
+ {index !== 0 && <OrderStatus timeState={item?.key} />}
486
+ <View><OText size={14} color={'#748194'} >{item?.name}</OText></View>
487
+ </SlaOption>
488
+ );
489
+ }}
490
+ />
491
+ </View>
489
492
  </View>
490
- </View>
493
+ )}
491
494
  <FiltersTab>
492
495
  <ScrollView
493
496
  ref={scrollRefTab}
@@ -722,8 +725,11 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
722
725
  </ScrollView>
723
726
  </View>
724
727
  {/* </GestureRecognizer> */}
725
-
726
- <NewOrderNotification />
728
+
729
+ {isBusinessApp && (
730
+ <NewOrderNotification isBusinessApp={isBusinessApp} />
731
+ )}
732
+
727
733
  {(openSearchModal || openSLASettingModal) && (
728
734
  <OModal open={openSearchModal || openSLASettingModal} entireModal customClose>
729
735
  <ModalContainer
@@ -926,6 +932,7 @@ export const Timer = () => {
926
932
 
927
933
  export const OrdersOption = (props: OrdersOptionParams) => {
928
934
  const [, t] = useLanguage();
935
+ const [configState] = useConfig()
929
936
  const theme = useTheme()
930
937
  const ordersProps = {
931
938
  ...props,
@@ -2,7 +2,7 @@ import React, { useState, useEffect } from 'react';
2
2
  import { StyleSheet, TouchableOpacity, View, Platform, PlatformIOSStatic } from 'react-native';
3
3
  import { useTheme } from 'styled-components/native';
4
4
  import moment from 'moment'
5
- import { useLanguage, useUtils } from 'ordering-components/native';
5
+ import { useLanguage, useUtils, useConfig } from 'ordering-components/native';
6
6
  import { OButton, OIcon, OText } from '../shared';
7
7
  import {
8
8
  Card, Logo, Information, MyOrderOptions, NotificationIcon, AcceptOrRejectOrder, Timestatus
@@ -27,8 +27,14 @@ export const PreviousOrders = (props: any) => {
27
27
  } = props;
28
28
  const [, t] = useLanguage();
29
29
  const [{ parseDate, optimizeImage }] = useUtils();
30
+ const [configState] = useConfig()
30
31
  const theme = useTheme();
31
- const [currentTime, setCurrentTime] = useState()
32
+ const [, setCurrentTime] = useState()
33
+ const [allowColumns, setAllowColumns] = useState({
34
+ timer: true,
35
+ slaBar: true,
36
+ })
37
+
32
38
  const [orientationState] = useDeviceOrientation();
33
39
 
34
40
  const IS_PORTRAIT = orientationState.orientation === PORTRAIT
@@ -93,23 +99,42 @@ export const PreviousOrders = (props: any) => {
93
99
  },
94
100
  });
95
101
 
96
- const getDelayTime = (order: any) => {
102
+ const getDelayMinutes = (order: any) => {
97
103
  // targetMin = delivery_datetime + eta_time - now()
104
+ const offset = 300
105
+ const cdtToutc = moment(order?.delivery_datetime).add(offset, 'minutes').format('YYYY-MM-DD HH:mm:ss')
98
106
  const _delivery = order?.delivery_datetime_utc
107
+ ? parseDate(order?.delivery_datetime_utc)
108
+ : parseDate(cdtToutc)
99
109
  const _eta = order?.eta_time
100
- const tagetedMin = moment(_delivery).add(_eta, 'minutes').diff(moment().utc(), 'minutes')
101
- let day = Math.floor(tagetedMin / 1440)
110
+ const diffTimeAsSeconds = moment(_delivery, 'YYYY-MM-DD hh:mm A').add(_eta, 'minutes').diff(moment().utc(), 'seconds')
111
+ return Math.ceil(diffTimeAsSeconds / 60)
112
+ }
113
+
114
+ const displayDelayedTime = (order: any) => {
115
+ let tagetedMin = getDelayMinutes(order)
116
+ // get day, hour and minutes
117
+ const sign = tagetedMin >= 0 ? '' : '- '
118
+ tagetedMin = Math.abs(tagetedMin)
119
+ let day: string | number = Math.floor(tagetedMin / 1440)
102
120
  const restMinOfTargetedMin = tagetedMin - 1440 * day
103
- let restHours: any = Math.floor(restMinOfTargetedMin / 60)
104
- let restMins: any = restMinOfTargetedMin - 60 * restHours
121
+ let restHours: string | number = Math.floor(restMinOfTargetedMin / 60)
122
+ let restMins: string | number = restMinOfTargetedMin - 60 * restHours
123
+ // make standard time format
124
+ day = day === 0 ? '' : day + 'day '
125
+ restHours = restHours < 10 ? '0' + restHours : restHours
126
+ restMins = restMins < 10 ? '0' + restMins : restMins
105
127
 
106
- if (order?.time_status === 'in_time' || order?.time_status === 'at_risk') day = Math.abs(day)
107
- if (restHours < 10) restHours = ('0' + restHours)
108
- if (restMins < 10) restMins = ('0' + restMins)
109
- const finalTaget = day + 'day ' + restHours + ':' + restMins
128
+ const finalTaget = sign + day + restHours + ':' + restMins
110
129
  return finalTaget
111
130
  }
112
131
 
132
+ const getStatusClassName = (minutes: number) => {
133
+ if (isNaN(Number(minutes))) return 'in_time'
134
+ const delayTime = configState?.configs?.order_deadlines_delayed_time?.value
135
+ return minutes > 0 ? 'in_time' : Math.abs(minutes) <= delayTime ? 'at_risk' : 'delayed'
136
+ }
137
+
113
138
  useEffect(() => {
114
139
  const interval = setInterval(() => {
115
140
  const date: any = Date.now()
@@ -119,6 +144,15 @@ export const PreviousOrders = (props: any) => {
119
144
  return () => clearInterval(interval)
120
145
  }, [])
121
146
 
147
+ useEffect(() => {
148
+ const slaSettings = configState?.configs?.order_deadlines_enabled?.value === '1'
149
+ setAllowColumns({
150
+ ...allowColumns,
151
+ timer: slaSettings,
152
+ slaBar: slaSettings
153
+ })
154
+ }, [configState.loading])
155
+
122
156
  let hash: any = {};
123
157
 
124
158
  return (
@@ -144,7 +178,9 @@ export const PreviousOrders = (props: any) => {
144
178
  activeOpacity={1}
145
179
  >
146
180
  <Card key={order.id}>
147
- <Timestatus style={{ backgroundColor: order?.time_status === 'in_time' ? '#00D27A' : order?.time_status === 'at_risk' ? '#FFC700' : order?.time_status === 'delayed' ? '#E63757' : '' }} />
181
+ {allowColumns?.slaBar && (
182
+ <Timestatus style={{ backgroundColor: getStatusClassName(getDelayMinutes(order)) === 'in_time' ? '#00D27A' : getStatusClassName(getDelayMinutes(order)) === 'at_risk' ? '#FFC700' : getStatusClassName(getDelayMinutes(order)) === 'delayed' ? '#E63757' : '' }} />
183
+ )}
148
184
  {
149
185
  order.business?.logo && (
150
186
  <Logo style={styles.logo}>
@@ -189,10 +225,10 @@ export const PreviousOrders = (props: any) => {
189
225
  ? parseDate(order?.delivery_datetime_utc, { outputFormat: 'MM/DD/YY · HH:mm a' })
190
226
  : parseDate(order?.delivery_datetime, { utc: false })}
191
227
  </OText>
192
- {(currentTabSelected === 'pending' || currentTabSelected === 'inProgress') && (
228
+ {((currentTabSelected === 'pending' || currentTabSelected === 'inProgress') && allowColumns?.timer) && (
193
229
  <>
194
230
  <OText> · </OText>
195
- <OText style={styles.date} color={order?.time_status === 'in_time' ? '#00D27A' : order?.time_status === 'at_risk' ? '#FFC700' : order?.time_status === 'delayed' ? '#E63757' : ''} >{getDelayTime(order)}</OText>
231
+ <OText style={styles.date} color={getStatusClassName(getDelayMinutes(order)) === 'in_time' ? '#00D27A' : getStatusClassName(getDelayMinutes(order)) === 'at_risk' ? '#FFC700' : getStatusClassName(getDelayMinutes(order)) === 'delayed' ? '#E63757' : ''} >{displayDelayedTime(order)}</OText>
196
232
  </>
197
233
  )}
198
234
  </View>
@@ -153,7 +153,7 @@ export const ProductItemAccordion = (props: ProductItemAccordionParams) => {
153
153
  {(
154
154
  productInfo?.()?.ingredients?.length > 0 ||
155
155
  productInfo?.()?.options?.length > 0 ||
156
- product.comment
156
+ !!product.comment
157
157
  ) && !isClickableEvent && (
158
158
  <MaterialCommunityIcon name="chevron-down" size={12} />
159
159
  )}
@@ -278,7 +278,7 @@ export const ProductItemAccordion = (props: ProductItemAccordionParams) => {
278
278
  </ProductOptionsList>
279
279
  )}
280
280
 
281
- {product.comment && (
281
+ {!!product.comment && (
282
282
  <ProductComment>
283
283
  <OText
284
284
  size={12}
@@ -165,7 +165,7 @@ const OModal = (props: Props): React.ReactElement => {
165
165
  transparent={isTransparent}
166
166
  visible={open}
167
167
  onRequestClose={() => {
168
- onClose();
168
+ onClose && onClose();
169
169
  }}
170
170
  style={{
171
171
  height: '100%',
@@ -20,6 +20,9 @@ export interface LoginParams {
20
20
  passwordInputIcon?: any;
21
21
  allowedLevels?: any;
22
22
  useRootPoint?: any;
23
+ notificationState?: any;
24
+ handleReCaptcha?: any;
25
+ enableReCaptcha?: any;
23
26
  }
24
27
  export interface ProfileParams {
25
28
  navigation?: any;
@@ -373,6 +376,7 @@ export interface OrderDetailsParams {
373
376
  handleClickLogisticOrder?: (status: number, orderId: number) => void;
374
377
  orderTitle?: any;
375
378
  forceUpdate?: number;
379
+ getPermissions?: any
376
380
  }
377
381
  export interface ProductItemAccordionParams {
378
382
  isCartPending?: boolean;
@@ -578,4 +582,4 @@ export interface ReviewCustomerParams {
578
582
 
579
583
  export interface NoNetworkParams {
580
584
  image?: any;
581
- }
585
+ }
@@ -197,7 +197,7 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
197
197
  {isFarAway && (
198
198
  <FarAwayMessage style={styles.farAwayMsg}>
199
199
  <Ionicons name='md-warning-outline' style={styles.iconStyle} />
200
- <OText size={12} numberOfLines={1} ellipsizeMode={'tail'} color={theme.colors.textNormal}>{t('YOU_ARE_FAR_FROM_ADDRESS', 'You are far from this address')}</OText>
200
+ <OText size={12} numberOfLines={1} ellipsizeMode={'tail'} color={theme.colors.textNormal}>{t('YOU_ARE_FAR_FROM_ADDRESS', 'Your are far from this address')}</OText>
201
201
  </FarAwayMessage>
202
202
  )}
203
203
  {!auth && (
@@ -410,8 +410,7 @@ const LoginFormUI = (props: LoginParams) => {
410
410
  textInputProps={{
411
411
  returnKeyType: 'next',
412
412
  onSubmitEditing: () => inputRef?.current?.focus?.(),
413
- style: { borderWidth: 0, fontSize: 12 },
414
- maxLength: 10
413
+ style: { borderWidth: 0, fontSize: 12 }
415
414
  }}
416
415
  textWrapStyle={{ borderColor: theme.colors.clear, borderWidth: 0, height: 40, paddingStart: 0 }}
417
416
  />
@@ -155,7 +155,7 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
155
155
  {isFarAway && (
156
156
  <FarAwayMessage style={styles.farAwayMsg}>
157
157
  <Ionicons name='md-warning-outline' style={styles.iconStyle} />
158
- <OText size={12} numberOfLines={1} ellipsizeMode={'tail'} color={theme.colors.textNormal}>{t('YOU_ARE_FAR_FROM_ADDRESS', 'You are far from this address')}</OText>
158
+ <OText size={12} numberOfLines={1} ellipsizeMode={'tail'} color={theme.colors.textNormal}>{t('YOU_ARE_FAR_FROM_ADDRESS', 'Your are far from this address')}</OText>
159
159
  </FarAwayMessage>
160
160
  )}
161
161
  <View style={styles.wrapperOrderOptions}>
@@ -1,5 +1,5 @@
1
1
  import React, { useCallback, useEffect, useRef, useState } from 'react';
2
- import { PanResponder, TouchableOpacity, View } from 'react-native';
2
+ import { PanResponder, Platform, TouchableOpacity, View } from 'react-native';
3
3
  import {
4
4
  useLanguage,
5
5
  useOrder,
@@ -40,7 +40,7 @@ const BusinessMenu = (props:any): React.ReactElement => {
40
40
  const clearCartWhenTimeOut = () => {
41
41
  if (cart?.uuid) clearCart(cart?.uuid)
42
42
  }
43
- const timerId = useRef(false);
43
+ const timerId: any = useRef(false);
44
44
 
45
45
  const clearInactivityTimeout = () =>{
46
46
  clearTimeout(timerId.current);
@@ -93,6 +93,17 @@ const BusinessMenu = (props:any): React.ReactElement => {
93
93
  else showCartBottomSheet();
94
94
  }
95
95
 
96
+ const handleRedirect = () => {
97
+ navigation.navigate('DeliveryType', {
98
+ callback: () => {
99
+ navigation.navigate('Business');
100
+ },
101
+ goBack: () => {
102
+ navigation.goBack();
103
+ },
104
+ });
105
+ };
106
+
96
107
  return (
97
108
  <View style={{
98
109
  flex: 1,
@@ -109,31 +120,31 @@ const BusinessMenu = (props:any): React.ReactElement => {
109
120
  }}
110
121
  >
111
122
  <Container nopadding nestedScrollEnabled>
112
- <View style={{ paddingTop: 20 }}>
113
- <NavBar
114
- title={t('MENU_V21', 'Menu')}
115
- onActionLeft={goToBack}
116
- includeOrderTypeSelector
117
- rightComponent={cart && (
118
- <TouchableOpacity
119
- style={{ paddingHorizontal: 20, flexDirection: 'row', alignItems: 'center' }}
120
- onPress={onToggleCart}
123
+ {Platform.OS === 'android' && (<View style={{ paddingTop: 20 }} />)}
124
+ <NavBar
125
+ title={t('MENU_V21', 'Menu')}
126
+ onActionLeft={goToBack}
127
+ includeOrderTypeSelector
128
+ onClickTypes={handleRedirect}
129
+ rightComponent={cart && (
130
+ <TouchableOpacity
131
+ style={{ flexDirection: 'row', alignItems: 'center' }}
132
+ onPress={onToggleCart}
133
+ >
134
+ <OText
135
+ color={theme.colors.mediumGray}
121
136
  >
122
- <OText
123
- color={theme.colors.mediumGray}
124
- >
125
- {`${cart?.products?.length || 0} ${t('ITEMS', 'items')}`} {parsePrice(cart?.total || 0)} {' '}
126
- </OText>
127
-
128
- <MaterialIcon
129
- name={bottomSheetVisibility ? "cart-off" : "cart-outline"}
130
- color={theme.colors.primary}
131
- size={30}
132
- />
133
- </TouchableOpacity>
134
- )}
135
- />
136
- </View>
137
+ {`${cart?.products?.length || 0} ${t('ITEMS', 'items')}`} {parsePrice(cart?.total || 0)} {' '}
138
+ </OText>
139
+
140
+ <MaterialIcon
141
+ name={bottomSheetVisibility ? "cart-off" : "cart-outline"}
142
+ color={theme.colors.primary}
143
+ size={30}
144
+ />
145
+ </TouchableOpacity>
146
+ )}
147
+ />
137
148
 
138
149
  <BusinessProductsListing
139
150
  { ...businessProductsListingProps }
@@ -144,7 +155,7 @@ const BusinessMenu = (props:any): React.ReactElement => {
144
155
  </Container>
145
156
  </View>
146
157
 
147
- <View
158
+ {/* <View
148
159
  style={{
149
160
  flex: bottomSheetVisibility && orientationState?.orientation === PORTRAIT ? 0 : 0.8,
150
161
  display: bottomSheetVisibility ? 'flex' : 'none'
@@ -155,7 +166,7 @@ const BusinessMenu = (props:any): React.ReactElement => {
155
166
  resetInactivityTimeout={resetInactivityTimeout}
156
167
  clearInactivityTimeout={clearInactivityTimeout}
157
168
  />
158
- </View>
169
+ </View> */}
159
170
  </View>
160
171
  );
161
172
  };
@@ -1,5 +1,5 @@
1
- import React, { useEffect, useState } from 'react';
2
- import { Fade, Placeholder, PlaceholderLine } from 'rn-placeholder';
1
+ import React from 'react';
2
+ import { PlaceholderLine } from 'rn-placeholder';
3
3
  import { View, ScrollView, Platform } from 'react-native';
4
4
  import { useTheme } from 'styled-components/native';
5
5
  import { useDeviceOrientation } from '../../../../../src/hooks/DeviceOrientation';
@@ -21,7 +21,6 @@ const BusinessesListingUI = (props: any) => {
21
21
  navigation,
22
22
  businessesList,
23
23
  handleBusinessClick,
24
- paginationProps,
25
24
  } = props;
26
25
 
27
26
  const theme = useTheme();
@@ -10,7 +10,7 @@ import {
10
10
  useValidationFields,
11
11
  } from 'ordering-components/native';
12
12
 
13
- import { CheckoutAction, OrderTypeWrapper, FloatingLayout } from './styles';
13
+ import { CheckoutAction, OrderTypeWrapper, FloatingLayout, OSRow } from './styles';
14
14
 
15
15
  import { OSBill, OSCoupon, OSTable } from '../OrderSummary/styles';
16
16
 
@@ -90,13 +90,26 @@ const CartUI = (props: any) => {
90
90
 
91
91
  const goToBack = () => navigation.goBack();
92
92
 
93
+ const getIncludedTaxes = () => {
94
+ if (cart?.taxes === null) {
95
+ return cart.business.tax_type === 1 ? cart?.tax : 0
96
+ } else {
97
+ return cart?.taxes.reduce((taxIncluded: number, tax: any) => {
98
+ return taxIncluded + (tax.type === 1 ? tax.summary?.tax : 0)
99
+ }, 0)
100
+ }
101
+ }
102
+
103
+ const getIncludedTaxesDiscounts = () => {
104
+ return cart?.taxes?.filter((tax: any) => tax?.type === 1)?.reduce((carry: number, tax: any) => carry + (tax?.summary?.tax_after_discount ?? tax?.summary?.tax), 0)
105
+ }
106
+
93
107
  return (
94
108
  <>
95
109
  <Container>
96
110
  <NavBar
97
111
  title={t('CONFIRM_YOUR_ORDER', 'Confirm your order')}
98
112
  onActionLeft={goToBack}
99
- style={{ height: orientationState?.dimensions?.height * 0.08 }}
100
113
  btnStyle={{ paddingLeft: 0 }}
101
114
  rightComponent={(
102
115
  <OButton
@@ -177,13 +190,10 @@ const CartUI = (props: any) => {
177
190
  <OSTable>
178
191
  <OText>{t('SUBTOTAL', 'Subtotal')}</OText>
179
192
  <OText>
180
- {cart.business.tax_type === 1
181
- ? parsePrice((cart?.subtotal + cart?.tax) || 0)
182
- : parsePrice(cart?.subtotal || 0)}
193
+ {parsePrice(cart?.subtotal + getIncludedTaxes())}
183
194
  </OText>
184
195
  </OSTable>
185
- {cart?.discount > 0 && cart?.total >= 0 && orientationState?.orientation == PORTRAIT && (
186
-
196
+ {cart?.discount > 0 && cart?.total >= 0 && cart?.offers?.length === 0 && orientationState?.orientation == PORTRAIT && (
187
197
  <OSTable
188
198
  style={{
189
199
  backgroundColor: theme.colors.success,
@@ -226,44 +236,107 @@ const CartUI = (props: any) => {
226
236
  </OText>
227
237
  </OSTable>
228
238
  )}
229
- {cart.business.tax_type !== 1 && (
239
+ {
240
+ cart?.offers?.length > 0 && cart?.offers?.filter((offer: any) => offer?.target === 1)?.map((offer: any, i: number) => (
241
+ <OSTable key={`${offer?.id}_${i}`}>
242
+ <OSRow>
243
+ <OText>{offer.name}</OText>
244
+ {offer.rate_type === 1 && (
245
+ <OText>{`(${verifyDecimals(offer?.rate, parsePrice)}%)`}</OText>
246
+ )}
247
+ </OSRow>
248
+ <OText>
249
+ - {parsePrice(offer?.summary?.discount)}
250
+ </OText>
251
+ </OSTable>
252
+ ))
253
+ }
254
+ {cart?.subtotal_with_discount > 0 && cart?.discount > 0 && cart?.total >= 0 && (
230
255
  <OSTable>
231
- <OText>
232
- {t('TAX', 'Tax')}
233
- {`(${verifyDecimals(cart?.business?.tax, parseNumber)}%)`}
234
- </OText>
235
- <OText>{parsePrice(cart?.tax || 0)}</OText>
256
+ <OText numberOfLines={1}>{t('SUBTOTAL_WITH_DISCOUNT', 'Subtotal with discount')}</OText>
257
+ {cart?.business?.tax_type === 1 ? (
258
+ <OText>{parsePrice(cart?.subtotal_with_discount + getIncludedTaxesDiscounts() ?? 0)}</OText>
259
+ ) : (
260
+ <OText>{parsePrice(cart?.subtotal_with_discount ?? 0)}</OText>
261
+ )}
236
262
  </OSTable>
237
263
  )}
264
+ {
265
+ cart.taxes?.length > 0 && cart.taxes.filter((tax: any) => tax.type === 2 && tax?.rate !== 0).map((tax: any, i: number) => (
266
+ <OSTable key={`${tax?.id}_${i}`}>
267
+ <OSRow>
268
+ <OText>
269
+ {tax.name || t('INHERIT_FROM_BUSINESS', 'Inherit from business')}{' '}
270
+ {`(${verifyDecimals(tax?.rate, parseNumber)}%)`}{' '}
271
+ </OText>
272
+ </OSRow>
273
+ <OText>{parsePrice(tax?.summary?.tax_after_discount ?? tax?.summary?.tax ?? 0)}</OText>
274
+ </OSTable>
275
+ ))
276
+ }
277
+ {
278
+ cart?.fees?.length > 0 && cart?.fees?.filter((fee: any) => !(fee.fixed === 0 && fee.percentage === 0)).map((fee: any, i: number) => (
279
+ <OSTable key={`${fee?.id}_${i}`}>
280
+ <OSRow>
281
+ <OText>
282
+ {fee.name || t('INHERIT_FROM_BUSINESS', 'Inherit from business')}{' '}
283
+ ({fee?.fixed > 0 && `${parsePrice(fee?.fixed)}${fee.percentage > 0 ? ' + ' : ''}`}{fee.percentage > 0 && `${fee.percentage}%`}){' '}
284
+ </OText>
285
+ </OSRow>
286
+ <OText>{parsePrice(fee?.summary?.fixed + (fee?.summary?.percentage_after_discount ?? fee?.summary?.percentage) ?? 0)}</OText>
287
+ </OSTable>
288
+ ))
289
+ }
290
+ {
291
+ cart?.offers?.length > 0 && cart?.offers?.filter((offer: any) => offer?.target === 3)?.map((offer: any, i: number) => (
292
+ <OSTable key={`${offer?.id}_${i}`}>
293
+ <OSRow>
294
+ <OText>{offer.name}</OText>
295
+ {offer.rate_type === 1 && (
296
+ <OText>{`(${verifyDecimals(offer?.rate, parsePrice)}%)`}</OText>
297
+ )}
298
+ </OSRow>
299
+ <OText>
300
+ - {parsePrice(offer?.summary?.discount)}
301
+ </OText>
302
+ </OSTable>
303
+ ))
304
+ }
238
305
  {selectedOrderType === 1 && cart?.delivery_price > 0 && (
239
306
  <OSTable>
240
307
  <OText>{t('DELIVERY_FEE', 'Delivery Fee')}</OText>
241
308
  <OText>{parsePrice(cart?.delivery_price)}</OText>
242
309
  </OSTable>
243
310
  )}
311
+ {
312
+ cart?.offers?.length > 0 && cart?.offers?.filter((offer: any) => offer?.target === 2)?.map((offer: any, i: number) => (
313
+ <OSTable key={`${offer?.id}_${i}`}>
314
+ <OSRow>
315
+ <OText>{offer.name}</OText>
316
+ {offer.rate_type === 1 && (
317
+ <OText>{`(${verifyDecimals(offer?.rate, parsePrice)}%)`}</OText>
318
+ )}
319
+ </OSRow>
320
+ <OText>
321
+ - {parsePrice(offer?.summary?.discount)}
322
+ </OText>
323
+ </OSTable>
324
+ ))
325
+ }
244
326
  {cart?.driver_tip > 0 && (
245
327
  <OSTable>
246
328
  <OText>
247
329
  {t('DRIVER_TIP', 'Driver tip')}
248
330
  {cart?.driver_tip_rate > 0 &&
249
331
  parseInt(configs?.driver_tip_type?.value, 10) === 2 &&
250
- !!!parseInt(configs?.driver_tip_use_custom?.value, 10) &&
332
+ !parseInt(configs?.driver_tip_use_custom?.value, 10) &&
251
333
  (
252
- `(${parseNumber(cart?.driver_tip_rate)}%)`
334
+ `(${verifyDecimals(cart?.driver_tip_rate, parseNumber)}%)`
253
335
  )}
254
336
  </OText>
255
337
  <OText>{parsePrice(cart?.driver_tip)}</OText>
256
338
  </OSTable>
257
339
  )}
258
- {cart?.service_fee > 0 && (
259
- <OSTable>
260
- <OText>
261
- {t('SERVICE_FEE', 'Service Fee')}
262
- {`(${verifyDecimals(cart?.business?.service_fee, parseNumber)}%)`}
263
- </OText>
264
- <OText>{parsePrice(cart?.service_fee)}</OText>
265
- </OSTable>
266
- )}
267
340
  {!cart?.discount_type && isCouponEnabled && !isCartPending && orientationState?.orientation == PORTRAIT && (
268
341
  <OSTable>
269
342
  <OSCoupon>
@@ -279,7 +352,7 @@ const CartUI = (props: any) => {
279
352
  {t('TOTAL', 'Total')}
280
353
  </OText>
281
354
  <OText weight='bold' color={theme.colors.primary}>
282
- {cart?.total >= 1 && parsePrice(cart?.total)}
355
+ {parsePrice(cart?.total >= 0 ? cart?.total : 0)}
283
356
  </OText>
284
357
  </OSTable>
285
358
  </OSBill>
@@ -379,7 +452,7 @@ const CartUI = (props: any) => {
379
452
  <ProductForm
380
453
  productCart={curProduct}
381
454
  businessSlug={cart?.business?.slug}
382
- businessId={cart?.business_id}
455
+ businessId={curProduct?.business_id}
383
456
  categoryId={curProduct?.category_id}
384
457
  productId={curProduct?.id}
385
458
  onSave={handlerProductAction}