ordering-ui-react-native 0.15.25 → 0.15.27-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 (165) hide show
  1. package/package.json +3 -2
  2. package/src/DeliveryApp.tsx +43 -1
  3. package/src/components/BusinessController/index.tsx +8 -2
  4. package/src/components/BusinessTypeFilter/index.tsx +4 -1
  5. package/src/components/BusinessesListing/index.tsx +1 -1
  6. package/src/components/Checkout/index.tsx +23 -3
  7. package/src/components/DriverTips/index.tsx +11 -6
  8. package/src/components/LanguageSelector/index.tsx +7 -2
  9. package/src/components/OrderDetails/index.tsx +2 -2
  10. package/src/components/PaymentOptions/index.tsx +9 -16
  11. package/src/components/PaymentOptionsWebView/index.tsx +123 -124
  12. package/src/components/SingleProductCard/index.tsx +16 -4
  13. package/src/components/StripeElementsForm/index.tsx +27 -48
  14. package/src/components/UpsellingProducts/index.tsx +1 -1
  15. package/src/components/UserProfileForm/index.tsx +63 -6
  16. package/src/components/UserProfileForm/styles.tsx +8 -0
  17. package/src/components/VerifyPhone/styles.tsx +1 -2
  18. package/src/components/shared/OModal.tsx +1 -1
  19. package/src/config.json +0 -2
  20. package/src/hooks/useCountdownTimer.tsx +26 -0
  21. package/src/navigators/HomeNavigator.tsx +6 -0
  22. package/src/pages/BusinessProductsList.tsx +1 -0
  23. package/src/pages/BusinessesListing.tsx +1 -1
  24. package/src/pages/Checkout.tsx +1 -1
  25. package/src/pages/Sessions.tsx +22 -0
  26. package/src/types/index.tsx +5 -11
  27. package/src/utils/index.tsx +68 -1
  28. package/themes/business/index.tsx +2 -0
  29. package/themes/business/src/components/AcceptOrRejectOrder/index.tsx +103 -15
  30. package/themes/business/src/components/AcceptOrRejectOrder/styles.tsx +6 -0
  31. package/themes/business/src/components/Chat/index.tsx +38 -86
  32. package/themes/business/src/components/Home/index.tsx +128 -55
  33. package/themes/business/src/components/Home/styles.tsx +8 -1
  34. package/themes/business/src/components/LoginForm/index.tsx +89 -2
  35. package/themes/business/src/components/LoginForm/styles.tsx +6 -0
  36. package/themes/business/src/components/LogoutButton/index.tsx +1 -1
  37. package/themes/business/src/components/NewOrderNotification/index.tsx +79 -105
  38. package/themes/business/src/components/OrderDetails/Business.tsx +2 -1
  39. package/themes/business/src/components/OrderDetails/Delivery.tsx +32 -15
  40. package/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +151 -89
  41. package/themes/business/src/components/OrderDetails/OrderHeaderComponent.tsx +91 -17
  42. package/themes/business/src/components/OrderDetails/styles.tsx +7 -0
  43. package/themes/business/src/components/OrdersListManager/index.tsx +874 -0
  44. package/themes/business/src/components/OrdersListManager/styles.tsx +123 -0
  45. package/themes/business/src/components/OrdersListManager/utils.tsx +216 -0
  46. package/themes/business/src/components/OrdersOption/index.tsx +58 -51
  47. package/themes/business/src/components/PreviousOrders/index.tsx +75 -22
  48. package/themes/business/src/components/shared/OModal.tsx +1 -1
  49. package/themes/business/src/types/index.tsx +5 -1
  50. package/themes/doordash/src/components/BusinessesListing/index.tsx +1 -1
  51. package/themes/doordash/src/components/LoginForm/index.tsx +1 -2
  52. package/themes/instacart/src/components/BusinessesListing/index.tsx +1 -1
  53. package/themes/kiosk/src/components/Cart/index.tsx +98 -24
  54. package/themes/kiosk/src/components/Cart/styles.tsx +6 -0
  55. package/themes/kiosk/src/components/CartBottomSheet/index.tsx +1 -1
  56. package/themes/kiosk/src/components/CartBottomSheet/styles.tsx +1 -1
  57. package/themes/kiosk/src/components/CartContent/index.tsx +13 -3
  58. package/themes/kiosk/src/components/CartItem/index.tsx +20 -8
  59. package/themes/kiosk/src/components/CustomerName/index.tsx +89 -88
  60. package/themes/kiosk/src/components/Intro/index.tsx +13 -13
  61. package/themes/kiosk/src/components/NavBar/index.tsx +14 -14
  62. package/themes/kiosk/src/components/OptionCard/index.tsx +1 -1
  63. package/themes/kiosk/src/components/OrderDetails/index.tsx +136 -41
  64. package/themes/kiosk/src/components/OrderDetails/styles.tsx +5 -0
  65. package/themes/kiosk/src/components/OrderSummary/index.tsx +1 -1
  66. package/themes/kiosk/src/components/OrderTypeCardSelector/index.tsx +10 -12
  67. package/themes/kiosk/src/components/ProductForm/index.tsx +174 -125
  68. package/themes/kiosk/src/components/ProductForm/styles.tsx +1 -1
  69. package/themes/kiosk/src/components/ProductOption/index.tsx +1 -0
  70. package/themes/kiosk/src/components/ProductOption/styles.tsx +1 -0
  71. package/themes/kiosk/src/components/UpsellingProducts/index.tsx +48 -34
  72. package/themes/kiosk/src/components/shared/OButton.tsx +5 -18
  73. package/themes/kiosk/src/types/index.d.ts +2 -0
  74. package/themes/original/index.tsx +178 -1
  75. package/themes/original/src/components/AddressForm/index.tsx +15 -10
  76. package/themes/original/src/components/AddressList/index.tsx +56 -18
  77. package/themes/original/src/components/AppleLogin/index.tsx +117 -78
  78. package/themes/original/src/components/BusinessBasicInformation/index.tsx +96 -45
  79. package/themes/original/src/components/BusinessBasicInformation/styles.tsx +28 -1
  80. package/themes/original/src/components/BusinessController/index.tsx +52 -22
  81. package/themes/original/src/components/BusinessController/styles.tsx +22 -0
  82. package/themes/original/src/components/BusinessFeaturedController/index.tsx +20 -1
  83. package/themes/original/src/components/BusinessFeaturedController/styles.tsx +23 -0
  84. package/themes/original/src/components/BusinessListingSearch/index.tsx +121 -7
  85. package/themes/original/src/components/BusinessListingSearch/styles.tsx +14 -1
  86. package/themes/original/src/components/BusinessMenuList/index.tsx +11 -4
  87. package/themes/original/src/components/BusinessPreorder/index.tsx +142 -122
  88. package/themes/original/src/components/BusinessProductsCategories/index.tsx +9 -7
  89. package/themes/original/src/components/BusinessProductsList/index.tsx +127 -20
  90. package/themes/original/src/components/BusinessProductsList/styles.tsx +29 -2
  91. package/themes/original/src/components/BusinessProductsListing/index.tsx +118 -37
  92. package/themes/original/src/components/BusinessProductsListing/styles.tsx +22 -0
  93. package/themes/original/src/components/BusinessReviews/index.tsx +4 -25
  94. package/themes/original/src/components/BusinessTypeFilter/index.tsx +1 -2
  95. package/themes/original/src/components/BusinessesListing/index.tsx +53 -60
  96. package/themes/original/src/components/Cart/index.tsx +21 -17
  97. package/themes/original/src/components/CartContent/index.tsx +2 -2
  98. package/themes/original/src/components/Checkout/index.tsx +58 -45
  99. package/themes/original/src/components/DriverTips/index.tsx +17 -12
  100. package/themes/original/src/components/ForgotPasswordForm/index.tsx +84 -4
  101. package/themes/original/src/components/GoogleMap/index.tsx +1 -0
  102. package/themes/original/src/components/Help/index.tsx +21 -4
  103. package/themes/original/src/components/HighestRatedBusinesses/index.tsx +97 -89
  104. package/themes/original/src/components/Home/index.tsx +1 -1
  105. package/themes/original/src/components/LastOrders/index.tsx +12 -1
  106. package/themes/original/src/components/LoginForm/Otp/index.tsx +90 -0
  107. package/themes/original/src/components/LoginForm/Otp/styles.tsx +7 -0
  108. package/themes/original/src/components/LoginForm/index.tsx +389 -156
  109. package/themes/original/src/components/LoginForm/styles.tsx +7 -4
  110. package/themes/original/src/components/LogoutButton/index.tsx +7 -1
  111. package/themes/original/src/components/MessageListing/index.tsx +10 -1
  112. package/themes/original/src/components/Messages/index.tsx +34 -25
  113. package/themes/original/src/components/Messages/styles.tsx +1 -3
  114. package/themes/original/src/components/MomentOption/index.tsx +10 -1
  115. package/themes/original/src/components/MomentOption/styles.tsx +1 -1
  116. package/themes/original/src/components/OrderDetails/index.tsx +56 -33
  117. package/themes/original/src/components/OrderDetails/styles.tsx +1 -2
  118. package/themes/original/src/components/OrderProgress/index.tsx +4 -4
  119. package/themes/original/src/components/OrderProgress/styles.tsx +1 -0
  120. package/themes/original/src/components/OrderSummary/index.tsx +3 -3
  121. package/themes/original/src/components/OrderTypeSelector/index.tsx +4 -2
  122. package/themes/original/src/components/OrdersOption/index.tsx +55 -58
  123. package/themes/original/src/components/OrdersOption/styles.tsx +0 -6
  124. package/themes/original/src/components/PaymentOptionCash/index.tsx +2 -2
  125. package/themes/original/src/components/PaymentOptionWallet/index.tsx +22 -24
  126. package/themes/original/src/components/PaymentOptionWallet/styles.tsx +1 -1
  127. package/themes/original/src/components/PaymentOptions/index.tsx +9 -19
  128. package/themes/original/src/components/PhoneInputNumber/index.tsx +1 -1
  129. package/themes/original/src/components/PreviousOrders/index.tsx +20 -14
  130. package/themes/original/src/components/ProductForm/index.tsx +76 -61
  131. package/themes/original/src/components/ProductForm/styles.tsx +2 -2
  132. package/themes/original/src/components/ProductItemAccordion/index.tsx +2 -2
  133. package/themes/original/src/components/ProductOptionSubOption/index.tsx +18 -12
  134. package/themes/original/src/components/Promotions/index.tsx +250 -0
  135. package/themes/original/src/components/Promotions/styles.tsx +60 -0
  136. package/themes/original/src/components/ReviewOrder/index.tsx +10 -9
  137. package/themes/original/src/components/ReviewProducts/index.tsx +1 -1
  138. package/themes/original/src/components/SearchBar/index.tsx +4 -1
  139. package/themes/original/src/components/Sessions/index.tsx +160 -0
  140. package/themes/original/src/components/Sessions/styles.tsx +15 -0
  141. package/themes/original/src/components/SingleProductCard/index.tsx +47 -21
  142. package/themes/original/src/components/SingleProductCard/styles.tsx +28 -1
  143. package/themes/original/src/components/StripeElementsForm/index.tsx +55 -72
  144. package/themes/original/src/components/TaxInformation/index.tsx +10 -4
  145. package/themes/original/src/components/UpsellingProducts/index.tsx +87 -75
  146. package/themes/original/src/components/UserDetails/index.tsx +4 -95
  147. package/themes/original/src/components/UserFormDetails/index.tsx +34 -24
  148. package/themes/original/src/components/UserProfile/index.tsx +62 -14
  149. package/themes/original/src/components/UserProfileForm/index.tsx +20 -18
  150. package/themes/original/src/components/UserVerification/index.tsx +178 -192
  151. package/themes/original/src/components/VerifyPhone/index.tsx +10 -7
  152. package/themes/original/src/components/VerifyPhone/styles.tsx +2 -1
  153. package/themes/original/src/components/Wallets/index.tsx +76 -9
  154. package/themes/original/src/components/Wallets/styles.tsx +21 -0
  155. package/themes/original/src/components/shared/HeaderTitle.tsx +21 -0
  156. package/themes/original/src/components/shared/OModal.tsx +1 -1
  157. package/themes/original/src/components/shared/index.tsx +2 -0
  158. package/themes/original/src/config/constants.tsx +6 -6
  159. package/themes/original/src/types/index.tsx +68 -6
  160. package/themes/original/src/utils/index.tsx +28 -2
  161. package/themes/single-business/src/components/AddressList/index.tsx +1 -1
  162. package/themes/single-business/src/components/OrderTypeSelector/index.tsx +6 -6
  163. package/themes/single-business/src/components/UserProfile/index.tsx +1 -1
  164. package/themes/uber-eats/src/components/BusinessesListing/index.tsx +1 -1
  165. package/src/components/StripeMethodForm/index.tsx +0 -168
@@ -12,11 +12,9 @@ export const FormSide = styled.View`
12
12
  margin: auto;
13
13
  `;
14
14
 
15
- export const OTabs = styled.View`
15
+ export const OTabs = styled.ScrollView`
16
16
  flex-direction: row;
17
17
  width: 100%;
18
- flex-wrap: wrap;
19
- justify-content: flex-start;
20
18
  margin-bottom: -1px;
21
19
  `;
22
20
 
@@ -36,7 +34,7 @@ export const LoginWith = styled.View`
36
34
  width: 100%;
37
35
  align-items: flex-start;
38
36
  border-bottom-width: 1px;
39
- border-bottom-color: ${(props: any) => props.theme.colors.border}
37
+ border-bottom-color: ${(props: any) => props.theme.colors.border};
40
38
  `;
41
39
 
42
40
  export const FormInput = styled.View`
@@ -80,3 +78,8 @@ export const LineSeparator = styled.View`
80
78
  export const SkeletonWrapper = styled.View`
81
79
  width: 90%;
82
80
  `
81
+ export const RecaptchaButton = styled.View`
82
+ flex-direction: row;
83
+ align-items: center;
84
+ margin-bottom: 10px;
85
+ `
@@ -3,14 +3,20 @@ import { TouchableOpacity } from 'react-native';
3
3
  import { LogoutAction } from 'ordering-components/native';
4
4
  import { useTheme } from 'styled-components/native';
5
5
  import { OIcon, OText } from '../shared';
6
+ import { _retrieveStoreData } from '../../providers/StoreUtil';
6
7
 
7
8
  const LogoutButtonUI = (props: any) => {
8
9
  const { handleLogoutClick, text, color, iconSize } = props
9
10
  const theme = useTheme();
10
11
 
12
+ const handleClick = async () => {
13
+ const data = await _retrieveStoreData('notification_state');
14
+ handleLogoutClick(data)
15
+ };
16
+
11
17
  return (
12
18
  <TouchableOpacity
13
- onPress={() => handleLogoutClick()}
19
+ onPress={() => handleClick()}
14
20
  style={{ flexDirection: 'row', alignItems: 'center' }}
15
21
  >
16
22
  <OIcon
@@ -36,7 +36,9 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
36
36
  loadOrders,
37
37
  setSelectedOrderId,
38
38
  setOrderList,
39
- setOpenMessges
39
+ setOpenMessges,
40
+ setRefreshOrders,
41
+ refreshOrders
40
42
  } = props
41
43
 
42
44
  const theme = useTheme();
@@ -99,6 +101,13 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
99
101
  setOrderList(orderList)
100
102
  }, [orderList, loading])
101
103
 
104
+ useEffect(() => {
105
+ if(refreshOrders){
106
+ loadOrders(false, false, false, true)
107
+ setRefreshOrders && setRefreshOrders(false)
108
+ }
109
+ }, [refreshOrders])
110
+
102
111
  return (
103
112
  <>
104
113
  {!loading && orders.length === 0 && (
@@ -39,7 +39,7 @@ const ORDER_STATUS: any = {
39
39
  23: 'ORDER_DRIVER_ON_WAY'
40
40
  }
41
41
 
42
- const filterSpecialStatus = ['prepared_in', 'delivered_in']
42
+ const filterSpecialStatus = ['prepared_in', 'delivered_in', 'delivery_datetime']
43
43
 
44
44
 
45
45
  const MessagesUI = (props: MessagesParams) => {
@@ -332,30 +332,34 @@ const MessagesUI = (props: MessagesParams) => {
332
332
  )
333
333
  )
334
334
 
335
- const renderSend = (props: any) => (
336
- <Send
337
- {...props}
338
- disabled={(sendMessage?.loading || (message === '' && !image) || messages?.loading)}
339
- alwaysShowSend
340
- containerStyle={styles.containerSend}
341
- >
342
- <OIconButton
343
- onClick={onSubmit}
344
- style={{
345
- height: 44,
346
- width: 44,
347
- borderRadius: 7.6,
348
- opacity: (sendMessage?.loading || (message === '' && !image) || messages?.loading) ? 0.4 : 1,
349
- borderColor: theme.colors.primary,
350
- backgroundColor: theme.colors.primary,
351
- }}
352
- iconStyle={{ marginTop: 3, marginRight: 2 }}
353
- icon={theme.images.general.enter}
354
- disabled={(sendMessage?.loading || (message === '' && !image) || messages?.loading)}
355
- disabledColor={theme.colors.white}
356
- />
357
- </Send>
358
- )
335
+ const renderSend = (props: any) => {
336
+ const isDisabled = (sendMessage?.loading || (message === '' && !image) || messages?.loading)
337
+ return (
338
+ <Send
339
+ {...props}
340
+ disabled={isDisabled}
341
+ alwaysShowSend
342
+ containerStyle={styles.containerSend}
343
+ >
344
+ <OIconButton
345
+ onClick={onSubmit}
346
+ style={{
347
+ height: 44,
348
+ width: 44,
349
+ borderRadius: 7.6,
350
+ opacity: isDisabled ? 0.2 : 1,
351
+ borderColor: isDisabled ? theme.colors.secondary : theme.colors.primary,
352
+ backgroundColor: isDisabled ? theme.colors.secondary : theme.colors.primary,
353
+ }}
354
+ iconStyle={{ marginTop: 3, marginRight: 2 }}
355
+ icon={theme.images.general.enter}
356
+ iconColor={isDisabled ? '#000' : '#fff'}
357
+ disabled={isDisabled}
358
+ disabledColor={theme.colors.secondary}
359
+ />
360
+ </Send>
361
+ )
362
+ }
359
363
 
360
364
  const renderBubble = (props: any) => (
361
365
  <Bubble
@@ -536,6 +540,11 @@ const styles = StyleSheet.create({
536
540
 
537
541
  export const Messages = (props: MessagesParams) => {
538
542
  const [allMessages, setAllMessages] = useState(props.messages)
543
+
544
+ useEffect(() => {
545
+ setAllMessages(props.messages)
546
+ }, [props.messages])
547
+
539
548
  const MessagesProps = {
540
549
  ...props,
541
550
  UIComponent: MessagesUI,
@@ -1,7 +1,5 @@
1
-
2
1
  import styled, { css } from 'styled-components/native'
3
2
 
4
-
5
3
  export const Wrapper = styled.View`
6
4
  flex: 1;
7
5
  background-color: ${(props: any) => props.theme.colors.white};
@@ -39,4 +37,4 @@ export const MessageTypeItem = styled.View`
39
37
  ${({ active }: any) => active && css`
40
38
  background-color: ${(props: any) => props.theme.colors.whiteGray};
41
39
  `}
42
- `
40
+ `
@@ -4,6 +4,7 @@ import CalendarStrip from 'react-native-calendar-strip'
4
4
  import {
5
5
  useLanguage,
6
6
  useConfig,
7
+ useUtils,
7
8
  useOrder,
8
9
  MomentOption as MomentOptionController,
9
10
  } from 'ordering-components/native';
@@ -132,6 +133,7 @@ const MomentOptionUI = (props: MomentOptionParams) => {
132
133
 
133
134
  const [, t] = useLanguage();
134
135
  const [{ configs }] = useConfig();
136
+ const [{ parseTime }] = useUtils()
135
137
  const [orderState] = useOrder();
136
138
  const [optionSelected, setOptionSelected] = useState({
137
139
  isAsap: false,
@@ -143,6 +145,8 @@ const MomentOptionUI = (props: MomentOptionParams) => {
143
145
  });
144
146
  const { bottom } = useSafeAreaInsets();
145
147
 
148
+ const is12hours = configs?.dates_moment_format?.value?.includes('hh:mm')
149
+
146
150
  const [selectedTime, setSelectedTime] = useState(null);
147
151
  const [datesWhitelist, setDateWhitelist] = useState<any>([{ start: null, end: null }])
148
152
  const [selectDate, setSelectedDate] = useState<any>(null)
@@ -338,7 +342,12 @@ const MomentOptionUI = (props: MomentOptionParams) => {
338
342
  style={{
339
343
  lineHeight: 24
340
344
  }}
341
- >{time.startTime}</OText>
345
+ >{is12hours ? (
346
+ time.startTime.includes('12')
347
+ ? `${time.startTime}PM`
348
+ : parseTime(moment(time.startTime, 'HH:mm'), { outputFormat: 'hh:mma' })
349
+ ) : time.startTime
350
+ }</OText>
342
351
  </TimeItem>
343
352
  </TouchableOpacity>
344
353
  ))}
@@ -18,7 +18,7 @@ export const OrderTimeWrapper = styled.View`
18
18
 
19
19
  export const TimeListWrapper = styled.ScrollView`
20
20
  margin-top: 30px;
21
- max-height: 160px;
21
+ max-height: 210px;
22
22
  `
23
23
 
24
24
  export const TimeContentWrapper = styled.View`
@@ -1,10 +1,12 @@
1
1
  import React, { useState, useEffect } from 'react';
2
2
  import { View, StyleSheet, BackHandler, Platform, Linking } from 'react-native';
3
3
  import LinearGradient from 'react-native-linear-gradient';
4
+ import { _setStoreData } from '../../providers/StoreUtil';
4
5
  import {
5
6
  useLanguage,
6
7
  OrderDetails as OrderDetailsConTableoller,
7
8
  useUtils,
9
+ useOrder,
8
10
  useConfig
9
11
  } from 'ordering-components/native';
10
12
  import { useTheme } from 'styled-components/native';
@@ -40,7 +42,7 @@ import { OSRow } from '../OrderSummary/styles';
40
42
  import AntIcon from 'react-native-vector-icons/AntDesign'
41
43
  import { TaxInformation } from '../TaxInformation';
42
44
  import { Placeholder, PlaceholderLine } from 'rn-placeholder';
43
-
45
+ import NavBar from '../NavBar'
44
46
  export const OrderDetailsUI = (props: OrderDetailsParams) => {
45
47
  const {
46
48
  navigation,
@@ -80,17 +82,20 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
80
82
  justifyContent: 'flex-start',
81
83
  paddingLeft: 0,
82
84
  height: 30,
83
- width: 40,
85
+ width: 30,
86
+ marginTop: Platform.OS === 'ios' ? 0 : 30
84
87
  },
85
88
  });
86
89
 
87
90
  const [, t] = useLanguage();
88
91
  const [{ parsePrice, parseNumber, parseDate }] = useUtils();
89
92
  const [{ configs }] = useConfig();
93
+ const [{ carts }] = useOrder()
94
+
90
95
  const [isReviewed, setIsReviewed] = useState(false)
91
96
  const [openTaxModal, setOpenTaxModal] = useState<any>({ open: false, tax: null, type: '' })
92
-
93
97
  const { order, businessData } = props.order;
98
+ const mapValidStatuses = [9, 19, 23]
94
99
 
95
100
  const walletName: any = {
96
101
  cash: {
@@ -328,7 +333,7 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
328
333
  };
329
334
 
330
335
  const getIncludedTaxes = () => {
331
- if (order?.taxes?.length === 0) {
336
+ if (order?.taxes?.length === 0 || !order?.taxes) {
332
337
  return order.tax_type === 1 ? order?.summary?.tax ?? 0 : 0
333
338
  } else {
334
339
  return order?.taxes.reduce((taxIncluded: number, tax: any) => {
@@ -361,11 +366,24 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
361
366
 
362
367
 
363
368
  useEffect(() => {
369
+ const _businessId = 'businessId:' + businessData?.id
364
370
  if (reorderState?.error) {
365
- navigation.navigate('Business', { store: businessData?.slug })
371
+ if (businessData?.id) {
372
+ _setStoreData('adjust-cart-products', JSON.stringify(_businessId))
373
+ navigation.navigate('Business', { store: businessData?.slug })
374
+ }
366
375
  }
367
- if (!reorderState?.error && reorderState?.result?.uuid) {
368
- onNavigationRedirect && onNavigationRedirect('CheckoutNavigator', { cartUuid: reorderState?.result.uuid })
376
+ if (!reorderState?.error && reorderState.loading === false && businessData?.id) {
377
+ const products = carts?.[_businessId]?.products
378
+ const available = products.every((product: any) => product.valid === true)
379
+
380
+ if (available && reorderState?.result?.uuid && (products?.length === order?.products.length)) {
381
+ onNavigationRedirect && onNavigationRedirect('CheckoutNavigator', { cartUuid: reorderState?.result.uuid })
382
+ } else {
383
+ _setStoreData('adjust-cart-products', JSON.stringify(_businessId))
384
+ products?.length !== order?.products.length && _setStoreData('already-removed', JSON.stringify('removed'))
385
+ navigation.navigate('Business', { store: businessData?.slug })
386
+ }
369
387
  }
370
388
  }, [reorderState])
371
389
 
@@ -397,6 +415,12 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
397
415
  'https://res.cloudinary.com/demo/image/upload/c_thumb,g_face,r_max/d_avatar.png/non_existing_id.png',
398
416
  },
399
417
  ];
418
+ const driverLocationString = typeof order?.driver?.location?.location === 'string' && order?.driver?.location?.location?.split(',').map((l: string) => l.replace(/[^-.0-9]/g, ''))
419
+ const parsedLocations = locations.map(location => typeof location?.location === 'string' ? {
420
+ ...location,
421
+ lat: parseFloat(location?.location?.split(',')[0].replace(/[^-.0-9]/g, '')),
422
+ lng: parseFloat(location?.location?.split(',')[1].replace(/[^-.0-9]/g, ''))
423
+ } : location)
400
424
 
401
425
  useEffect(() => {
402
426
  if (driverLocation) {
@@ -461,27 +485,23 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
461
485
  {order && Object.keys(order).length > 0 && (
462
486
  <>
463
487
  <Header>
464
- <OButton
465
- imgLeftSrc={theme.images.general.arrow_left}
466
- imgRightSrc={null}
467
- style={styles.btnBackArrow}
468
- onClick={() => handleArrowBack()}
469
- imgLeftStyle={{ tintColor: theme.colors.disabled }}
488
+ <NavBar
489
+ title={`${t('ORDER', 'Order')} #${order?.id}`}
490
+ titleAlign={'center'}
491
+ onActionLeft={handleArrowBack}
492
+ showCall={false}
493
+ btnStyle={{ paddingLeft: 0 }}
494
+ style={{ marginTop: Platform.OS === 'ios' ? 0 : 20 }}
495
+ titleWrapStyle={{ paddingHorizontal: 0 }}
496
+ titleStyle={{ marginRight: 0, marginLeft: 0 }}
497
+ subTitle={<OText size={12} lineHeight={18} color={theme.colors.textNormal}>
498
+ {order?.delivery_datetime_utc
499
+ ? parseDate(order?.delivery_datetime_utc)
500
+ : parseDate(order?.delivery_datetime, { utc: false })}
501
+ </OText>}
470
502
  />
471
503
  <OrderInfo>
472
504
  <OrderData>
473
- <OText
474
- size={20}
475
- lineHeight={30}
476
- weight={'600'}
477
- color={theme.colors.textNormal}>
478
- {t('ORDER', 'Order')} #{order?.id}
479
- </OText>
480
- <OText size={12} lineHeight={18} color={theme.colors.textNormal}>
481
- {order?.delivery_datetime_utc
482
- ? parseDate(order?.delivery_datetime_utc)
483
- : parseDate(order?.delivery_datetime, { utc: false })}
484
- </OText>
485
505
  {
486
506
  (
487
507
  parseInt(order?.status) === 1 ||
@@ -662,7 +682,7 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
662
682
  </OText>
663
683
  </View>
664
684
  )}
665
- {order?.comment && (
685
+ {!!order?.comment && (
666
686
  <View style={{ marginTop: 15 }}>
667
687
  <OText size={16} style={{ textAlign: 'left' }} color={theme.colors.textNormal}>
668
688
  {t('COMMENT', 'Comment')}
@@ -672,11 +692,16 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
672
692
  )}
673
693
  {order?.driver && (
674
694
  <>
675
- {order?.driver?.location && parseInt(order?.status) === 9 && (
695
+ {order?.driver?.location && mapValidStatuses.includes(parseInt(order?.status)) && (
676
696
  <Map>
677
- <GoogleMap
678
- location={order?.driver?.location}
679
- locations={locations}
697
+ <GoogleMap
698
+ location={typeof order?.driver?.location?.location === 'string'
699
+ ? {
700
+ lat: parseFloat(driverLocationString[0]),
701
+ lng: parseFloat(driverLocationString[1]),
702
+ } : driverLocation ?? order?.driver?.location
703
+ }
704
+ locations={parsedLocations}
680
705
  readOnly
681
706
  />
682
707
  </Map>
@@ -890,7 +915,7 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
890
915
  <OSRow>
891
916
  <OText size={12} lineHeight={18} weight={'400'} color={theme.colors.textNormal} numberOfLines={1}>
892
917
  {fee.name || t('INHERIT_FROM_BUSINESS', 'Inherit from business')}
893
- ({fee?.fixed > 0 && `${parsePrice(fee?.fixed)} + `}{fee.percentage}%){' '}
918
+ ({fee?.fixed > 0 && `${parsePrice(fee?.fixed)}${fee.percentage > 0 ? ' + ' : ''}`}{fee.percentage > 0 && `${fee.percentage}%`}){' '}
894
919
  </OText>
895
920
  <TouchableOpacity onPress={() => setOpenTaxModal({ open: true, data: fee, type: 'fee' })}>
896
921
  <AntIcon name='infocirlceo' size={16} color={theme.colors.primary} />
@@ -1017,8 +1042,6 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
1017
1042
  open={openTaxModal.open}
1018
1043
  onClose={() => setOpenTaxModal({ open: false, data: null, type: '' })}
1019
1044
  entireModal
1020
- title={`${openTaxModal.data?.name ||
1021
- t('INHERIT_FROM_BUSINESS', 'Inherit from business')} ${openTaxModal.data?.rate_type !== 2 ? `(${typeof openTaxModal.data?.rate === 'number' ? `${openTaxModal.data?.rate}%` : `${parsePrice(openTaxModal.data?.fixed ?? 0)} + ${openTaxModal.data?.percentage}%`})` : ''} `}
1022
1045
  >
1023
1046
  <TaxInformation
1024
1047
  type={openTaxModal.type}
@@ -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
+ `
@@ -98,7 +98,7 @@ const OrderProgressUI = (props: any) => {
98
98
  { key: 20, value: t('ORDER_CUSTOMER_ALMOST_ARRIVED_BUSINESS', theme?.defaultLanguages?.ORDER_CUSTOMER_ALMOST_ARRIVED_BUSINESS || 'Customer almost arrived to business'), slug: 'ORDER_CUSTOMER_ALMOST_ARRIVED_BUSINESS', percentage: 90 },
99
99
  { key: 21, value: t('ORDER_CUSTOMER_ARRIVED_BUSINESS', theme?.defaultLanguages?.ORDER_CUSTOMER_ARRIVED_BUSINESS || 'Customer arrived to business'), slug: 'ORDER_CUSTOMER_ARRIVED_BUSINESS', percentage: 95 },
100
100
  { key: 22, value: t('ORDER_LOOKING_FOR_DRIVER', theme?.defaultLanguages?.ORDER_LOOKING_FOR_DRIVER || 'Looking for driver'), slug: 'ORDER_LOOKING_FOR_DRIVER', percentage: 35 },
101
- { key: 23, value: t('ORDER_DRIVER_ON_WAY', theme?.defaultLanguages?.ORDER_DRIVER_ON_WAY || 'Driver on way'), slug: 'ORDER_DRIVER_ON_WAY', percentage: 45 }
101
+ { key: 23, value: t('ORDER_DRIVER_ON_WAY', theme?.defaultLanguages?.ORDER_DRIVER_ON_WAY || 'Driver on way'), slug: 'ORDER_DRIVER_ON_WAY', percentage: 45 }
102
102
  ]
103
103
 
104
104
  const objectStatus = orderStatus.find((o) => o.key === status)
@@ -131,7 +131,7 @@ const OrderProgressUI = (props: any) => {
131
131
 
132
132
  useEffect(() => {
133
133
  if (isFocused) {
134
- loadOrders()
134
+ loadOrders(false, false, false, true)
135
135
  }
136
136
  }, [isFocused])
137
137
 
@@ -188,7 +188,7 @@ const OrderProgressUI = (props: any) => {
188
188
  <ProgressBar style={{ width: getOrderStatus(lastOrder.status)?.percentage ? `${getOrderStatus(lastOrder.status)?.percentage}%` : '0%' }} />
189
189
  </ProgressContentWrapper>
190
190
  <ProgressTextWrapper>
191
- <OText size={12}>{getOrderStatus(lastOrder.status)?.value}</OText>
191
+ <OText size={12} style={{ width: '50%' }}>{getOrderStatus(lastOrder.status)?.value}</OText>
192
192
  <TimeWrapper>
193
193
  <OText size={11}>{t('ESTIMATED_DELIVERY', 'Estimated delivery')}</OText>
194
194
  <OText size={11}>
@@ -218,7 +218,7 @@ export const OrderProgress = (props: any) => {
218
218
  const orderProgressProps = {
219
219
  ...props,
220
220
  UIComponent: OrderProgressUI,
221
- orderStatus: [0, 3, 4, 7, 8, 9, 13, 14, 15, 18, 19, 20, 21, 22, 23],
221
+ orderStatus: [0, 3, 4, 7, 8, 9, 13, 14, 18, 19, 20, 21, 22, 23],
222
222
  useDefualtSessionManager: true,
223
223
  paginationSettings: {
224
224
  initialPage: 1,
@@ -20,6 +20,7 @@ export const ProgressTextWrapper = styled.View`
20
20
  flex-direction: row;
21
21
  justify-content: space-between;
22
22
  align-items: center;
23
+ width: 100%;
23
24
  `
24
25
 
25
26
  export const OrderInfoWrapper = styled.View`
@@ -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
- ({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
  />