ordering-ui-react-native 0.16.15 → 0.16.16-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 (205) hide show
  1. package/package.json +7 -4
  2. package/src/DeliveryApp.tsx +43 -1
  3. package/src/components/ActiveOrders/index.tsx +61 -63
  4. package/src/components/ActiveOrders/styles.tsx +8 -14
  5. package/src/components/AddressForm/index.tsx +18 -2
  6. package/src/components/BusinessBasicInformation/index.tsx +11 -19
  7. package/src/components/BusinessController/index.tsx +10 -8
  8. package/src/components/BusinessInformation/index.tsx +33 -4
  9. package/src/components/BusinessInformation/styles.tsx +2 -2
  10. package/src/components/BusinessProductsList/index.tsx +10 -10
  11. package/src/components/BusinessTypeFilter/index.tsx +1 -2
  12. package/src/components/BusinessesListing/index.tsx +1 -1
  13. package/src/components/Checkout/index.tsx +2 -1
  14. package/src/components/LanguageSelector/index.tsx +21 -16
  15. package/src/components/LoginForm/index.tsx +118 -30
  16. package/src/components/LoginForm/styles.tsx +6 -0
  17. package/src/components/Messages/index.tsx +2 -2
  18. package/src/components/NotificationSetting/index.tsx +85 -0
  19. package/src/components/OrderDetails/index.tsx +7 -21
  20. package/src/components/OrdersOption/index.tsx +54 -56
  21. package/src/components/PaymentOptions/index.tsx +335 -365
  22. package/src/components/PaymentOptionsWebView/index.tsx +120 -121
  23. package/src/components/ReviewDriver/index.tsx +1 -1
  24. package/src/components/ReviewOrder/index.tsx +2 -1
  25. package/src/components/ReviewProducts/index.tsx +11 -0
  26. package/src/components/SignupForm/index.tsx +143 -61
  27. package/src/components/SingleProductReview/index.tsx +8 -5
  28. package/src/components/StripeElementsForm/index.tsx +25 -16
  29. package/src/components/VerifyPhone/styles.tsx +1 -2
  30. package/src/components/shared/OBottomPopup.tsx +6 -2
  31. package/src/index.tsx +2 -0
  32. package/src/pages/BusinessesListing.tsx +7 -6
  33. package/src/pages/OrderDetails.tsx +1 -1
  34. package/src/pages/ReviewDriver.tsx +2 -2
  35. package/src/pages/ReviewOrder.tsx +2 -2
  36. package/src/theme.json +0 -1
  37. package/src/types/@fatnlazycat/react-native-recaptcha-v3/index.d.ts +1 -0
  38. package/src/types/index.tsx +13 -9
  39. package/src/utils/index.tsx +0 -1
  40. package/themes/business/index.tsx +4 -0
  41. package/themes/business/src/components/BusinessController/index.tsx +2 -2
  42. package/themes/business/src/components/Chat/index.tsx +42 -34
  43. package/themes/business/src/components/DriverMap/index.tsx +7 -5
  44. package/themes/business/src/components/DriverSchedule/index.tsx +71 -0
  45. package/themes/business/src/components/DriverSchedule/styles.tsx +6 -0
  46. package/themes/business/src/components/LoginForm/index.tsx +111 -74
  47. package/themes/business/src/components/MapView/index.tsx +12 -1
  48. package/themes/business/src/components/MessagesOption/index.tsx +11 -1
  49. package/themes/business/src/components/OrderDetails/Business.tsx +1 -1
  50. package/themes/business/src/components/OrderDetails/Delivery.tsx +3 -3
  51. package/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +27 -21
  52. package/themes/business/src/components/OrdersListManager/index.tsx +10 -3
  53. package/themes/business/src/components/OrdersOption/index.tsx +65 -21
  54. package/themes/business/src/components/OrdersOption/styles.tsx +5 -1
  55. package/themes/business/src/components/OrdersOptionBusiness/index.tsx +15 -1
  56. package/themes/business/src/components/OrdersOptionCity/index.tsx +15 -1
  57. package/themes/business/src/components/OrdersOptionDate/index.tsx +19 -6
  58. package/themes/business/src/components/OrdersOptionDelivery/index.tsx +15 -1
  59. package/themes/business/src/components/OrdersOptionDriver/index.tsx +15 -1
  60. package/themes/business/src/components/OrdersOptionPaymethod/index.tsx +15 -1
  61. package/themes/business/src/components/OrdersOptionStatus/index.tsx +10 -1
  62. package/themes/business/src/components/PreviousMessages/index.tsx +17 -18
  63. package/themes/business/src/components/PreviousOrders/index.tsx +21 -23
  64. package/themes/business/src/components/ProductItemAccordion/index.tsx +5 -4
  65. package/themes/business/src/components/ReviewCustomer/index.tsx +1 -1
  66. package/themes/business/src/components/ScheduleBlocked/index.tsx +53 -0
  67. package/themes/business/src/components/UserFormDetails/index.tsx +5 -2
  68. package/themes/business/src/components/UserProfileForm/index.tsx +28 -4
  69. package/themes/business/src/components/shared/ODropDown.tsx +42 -8
  70. package/themes/business/src/components/shared/ODropDownCalendar.tsx +36 -7
  71. package/themes/business/src/components/shared/OModal.tsx +40 -37
  72. package/themes/business/src/types/index.tsx +15 -9
  73. package/themes/business/src/utils/index.tsx +10 -0
  74. package/themes/doordash/src/components/BusinessesListing/index.tsx +1 -1
  75. package/themes/doordash/src/components/LoginForm/index.tsx +1 -2
  76. package/themes/instacart/src/components/BusinessesListing/index.tsx +1 -1
  77. package/themes/kiosk/src/components/BusinessMenu/index.tsx +2 -1
  78. package/themes/kiosk/src/components/CartItem/index.tsx +4 -3
  79. package/themes/kiosk/src/components/CategoriesMenu/index.tsx +1 -0
  80. package/themes/kiosk/src/components/Checkout/index.tsx +6 -0
  81. package/themes/kiosk/src/components/DrawerView/index.tsx +1 -0
  82. package/themes/kiosk/src/components/DrawerView/styles.tsx +2 -2
  83. package/themes/kiosk/src/components/LoginForm/index.tsx +121 -10
  84. package/themes/kiosk/src/components/LoginForm/styles.tsx +5 -0
  85. package/themes/kiosk/src/components/NavBar/index.tsx +14 -14
  86. package/themes/kiosk/src/components/OptionCard/index.tsx +1 -1
  87. package/themes/kiosk/src/components/OrderTypeCardSelector/index.tsx +8 -10
  88. package/themes/kiosk/src/components/shared/OButton.tsx +5 -18
  89. package/themes/kiosk/src/types/index.d.ts +2 -0
  90. package/themes/original/index.tsx +12 -0
  91. package/themes/original/src/components/AddressForm/index.tsx +136 -133
  92. package/themes/original/src/components/AddressList/index.tsx +1 -1
  93. package/themes/original/src/components/AppleLogin/index.tsx +4 -4
  94. package/themes/original/src/components/BusinessBasicInformation/index.tsx +302 -160
  95. package/themes/original/src/components/BusinessBasicInformation/styles.tsx +6 -2
  96. package/themes/original/src/components/BusinessController/index.tsx +173 -108
  97. package/themes/original/src/components/BusinessItemAccordion/index.tsx +9 -7
  98. package/themes/original/src/components/BusinessItemAccordion/styles.tsx +4 -0
  99. package/themes/original/src/components/BusinessListingSearch/BusinessControllerSkeletons/index.tsx +57 -0
  100. package/themes/original/src/components/BusinessListingSearch/MaxSectionItem/index.tsx +59 -0
  101. package/themes/original/src/components/BusinessListingSearch/MaxSectionItem/styles.tsx +13 -0
  102. package/themes/original/src/components/BusinessListingSearch/index.tsx +106 -126
  103. package/themes/original/src/components/BusinessListingSearch/styles.tsx +18 -13
  104. package/themes/original/src/components/BusinessProductsList/SubcategoriesComponent/index.tsx +87 -0
  105. package/themes/original/src/components/BusinessProductsList/SubcategoriesComponent/styles.tsx +12 -0
  106. package/themes/original/src/components/BusinessProductsList/index.tsx +53 -53
  107. package/themes/original/src/components/BusinessProductsList/styles.tsx +0 -3
  108. package/themes/original/src/components/BusinessProductsListing/index.tsx +280 -175
  109. package/themes/original/src/components/BusinessProductsListing/styles.tsx +18 -4
  110. package/themes/original/src/components/BusinessReviews/index.tsx +6 -1
  111. package/themes/original/src/components/BusinessTypeFilter/index.tsx +109 -40
  112. package/themes/original/src/components/BusinessTypeFilter/styles.tsx +2 -0
  113. package/themes/original/src/components/BusinessesListing/Layout/Appointment/index.tsx +561 -0
  114. package/themes/original/src/components/BusinessesListing/{styles.tsx → Layout/Appointment/styles.tsx} +24 -2
  115. package/themes/original/src/components/BusinessesListing/Layout/Original/index.tsx +676 -0
  116. package/themes/original/src/components/BusinessesListing/Layout/Original/styles.tsx +137 -0
  117. package/themes/original/src/components/BusinessesListing/index.tsx +100 -495
  118. package/themes/original/src/components/Cart/index.tsx +70 -34
  119. package/themes/original/src/components/Cart/styles.tsx +4 -0
  120. package/themes/original/src/components/CartContent/index.tsx +22 -16
  121. package/themes/original/src/components/Checkout/index.tsx +106 -66
  122. package/themes/original/src/components/Checkout/styles.tsx +0 -1
  123. package/themes/original/src/components/DriverTips/index.tsx +4 -4
  124. package/themes/original/src/components/DriverTips/styles.tsx +2 -1
  125. package/themes/original/src/components/Favorite/index.tsx +1 -0
  126. package/themes/original/src/components/Favorite/styles.tsx +1 -0
  127. package/themes/original/src/components/FavoriteList/index.tsx +143 -94
  128. package/themes/original/src/components/GPSButton/index.tsx +20 -19
  129. package/themes/original/src/components/GoogleMap/index.tsx +20 -12
  130. package/themes/original/src/components/HelpAccountAndPayment/index.tsx +8 -3
  131. package/themes/original/src/components/HelpGuide/index.tsx +8 -3
  132. package/themes/original/src/components/HelpOrder/index.tsx +8 -3
  133. package/themes/original/src/components/LanguageSelector/index.tsx +19 -14
  134. package/themes/original/src/components/LoginForm/Otp/index.tsx +3 -2
  135. package/themes/original/src/components/LoginForm/index.tsx +79 -42
  136. package/themes/original/src/components/Messages/index.tsx +17 -17
  137. package/themes/original/src/components/MomentSelector/index.tsx +197 -0
  138. package/themes/original/src/components/MomentSelector/styles.tsx +6 -0
  139. package/themes/original/src/components/MultiCartsPaymethodsAndWallets/index.tsx +2 -2
  140. package/themes/original/src/components/MultiCheckout/index.tsx +14 -1
  141. package/themes/original/src/components/MultiOrdersDetails/SingleOrderCard.tsx +13 -11
  142. package/themes/original/src/components/MultiOrdersDetails/index.tsx +31 -19
  143. package/themes/original/src/components/MyOrders/index.tsx +68 -6
  144. package/themes/original/src/components/NavBar/index.tsx +11 -5
  145. package/themes/original/src/components/NetworkError/index.tsx +5 -3
  146. package/themes/original/src/components/NotFoundSource/index.tsx +2 -1
  147. package/themes/original/src/components/Notifications/index.tsx +148 -0
  148. package/themes/original/src/components/Notifications/styles.tsx +17 -0
  149. package/themes/original/src/components/OrderDetails/OrderHistory.tsx +167 -0
  150. package/themes/original/src/components/OrderDetails/index.tsx +209 -49
  151. package/themes/original/src/components/OrderDetails/styles.tsx +15 -2
  152. package/themes/original/src/components/OrderItAgain/index.tsx +75 -0
  153. package/themes/original/src/components/OrderItAgain/styles.tsx +10 -0
  154. package/themes/original/src/components/OrderProgress/index.tsx +8 -2
  155. package/themes/original/src/components/OrderSummary/index.tsx +1 -34
  156. package/themes/original/src/components/OrderTypeSelector/index.tsx +84 -36
  157. package/themes/original/src/components/OrderTypeSelector/styles.tsx +19 -1
  158. package/themes/original/src/components/OrdersOption/PreviousBusinessOrdered/index.tsx +100 -106
  159. package/themes/original/src/components/OrdersOption/PreviousProductsOrdered/index.tsx +17 -12
  160. package/themes/original/src/components/OrdersOption/index.tsx +38 -23
  161. package/themes/original/src/components/PaymentOptionWallet/index.tsx +56 -56
  162. package/themes/original/src/components/PaymentOptions/index.tsx +57 -37
  163. package/themes/original/src/components/PhoneInputNumber/index.tsx +4 -10
  164. package/themes/original/src/components/PlaceSpot/index.tsx +243 -47
  165. package/themes/original/src/components/PlaceSpot/styles.tsx +0 -2
  166. package/themes/original/src/components/ProductForm/index.tsx +712 -655
  167. package/themes/original/src/components/ProductForm/styles.tsx +9 -7
  168. package/themes/original/src/components/ProductItemAccordion/index.tsx +170 -128
  169. package/themes/original/src/components/ProductOption/index.tsx +1 -1
  170. package/themes/original/src/components/ProfessionalFilter/index.tsx +129 -0
  171. package/themes/original/src/components/ProfessionalFilter/styles.tsx +0 -0
  172. package/themes/original/src/components/ProfessionalProfile/index.tsx +309 -0
  173. package/themes/original/src/components/ProfessionalProfile/styles.tsx +46 -0
  174. package/themes/original/src/components/ReviewDriver/index.tsx +6 -6
  175. package/themes/original/src/components/ReviewOrder/index.tsx +18 -3
  176. package/themes/original/src/components/ReviewProducts/index.tsx +1 -1
  177. package/themes/original/src/components/ReviewTrigger/index.tsx +118 -0
  178. package/themes/original/src/components/ReviewTrigger/styles.tsx +34 -0
  179. package/themes/original/src/components/SearchBar/index.tsx +10 -5
  180. package/themes/original/src/components/ServiceForm/index.tsx +631 -0
  181. package/themes/original/src/components/ServiceForm/styles.tsx +50 -0
  182. package/themes/original/src/components/SignupForm/index.tsx +301 -158
  183. package/themes/original/src/components/SingleOrderCard/index.tsx +213 -177
  184. package/themes/original/src/components/SingleProductCard/index.tsx +198 -110
  185. package/themes/original/src/components/SingleProductCard/styles.tsx +2 -2
  186. package/themes/original/src/components/SingleProductReview/index.tsx +30 -3
  187. package/themes/original/src/components/SingleProductReview/styles.tsx +12 -0
  188. package/themes/original/src/components/StripeElementsForm/index.tsx +15 -7
  189. package/themes/original/src/components/UpsellingProducts/index.tsx +14 -4
  190. package/themes/original/src/components/UserDetails/index.tsx +31 -17
  191. package/themes/original/src/components/UserFormDetails/index.tsx +74 -81
  192. package/themes/original/src/components/UserProfile/index.tsx +57 -29
  193. package/themes/original/src/components/UserProfile/styles.ts +17 -0
  194. package/themes/original/src/components/UserProfileForm/index.tsx +15 -10
  195. package/themes/original/src/components/WalletTransactions/index.tsx +76 -0
  196. package/themes/original/src/components/WalletTransactions/styles.tsx +13 -0
  197. package/themes/original/src/components/Wallets/index.tsx +174 -162
  198. package/themes/original/src/components/Wallets/styles.tsx +10 -8
  199. package/themes/original/src/components/shared/OBottomPopup.tsx +47 -14
  200. package/themes/original/src/components/shared/OButton.tsx +10 -3
  201. package/themes/original/src/components/shared/OInput.tsx +3 -2
  202. package/themes/original/src/layouts/FloatingBottomContainer.tsx +5 -1
  203. package/themes/original/src/types/index.tsx +123 -29
  204. package/themes/original/src/utils/index.tsx +77 -0
  205. package/themes/uber-eats/src/components/BusinessesListing/index.tsx +1 -1
@@ -1,11 +1,12 @@
1
1
  import React, { useEffect } from 'react'
2
- import { useLanguage, useUtils, useToast, ToastType, MultiOrdersDetails as MultiOrdersDetailsController } from 'ordering-components/native'
3
- import { View, StyleSheet } from 'react-native'
2
+ import { useLanguage, useUtils, useToast, ToastType, MultiOrdersDetails as MultiOrdersDetailsController } from 'ordering-components/native'
3
+ import { View, StyleSheet, BackHandler, TouchableOpacity } from 'react-native'
4
4
  import { useTheme } from 'styled-components/native'
5
5
  import { OText, OButton } from '../shared'
6
6
  import { Container } from '../../layouts/Container'
7
7
  import { Placeholder, PlaceholderLine, Fade } from 'rn-placeholder'
8
8
  import { SingleOrderCard } from './SingleOrderCard'
9
+ import AntDesignIcon from 'react-native-vector-icons/AntDesign'
9
10
 
10
11
  import {
11
12
  OrdersDetailsContainer,
@@ -29,20 +30,20 @@ export const MultiOrdersDetailsUI = (props: any) => {
29
30
  } = props
30
31
 
31
32
  const theme = useTheme()
32
- const styles = StyleSheet.create({
33
+ const styles = StyleSheet.create({
33
34
  btnBackArrow: {
34
- borderWidth: 0,
35
- backgroundColor: theme.colors.clear,
36
- shadowColor: theme.colors.clear,
37
- padding: 0,
35
+ borderWidth: 0,
36
+ backgroundColor: theme.colors.clear,
37
+ shadowColor: theme.colors.clear,
38
+ padding: 0,
38
39
  marginLeft: -20
39
- },
40
- })
41
-
40
+ },
41
+ })
42
+
42
43
  const { loading, orders, error } = props.ordersList
43
44
  const [, t] = useLanguage()
44
45
  const [{ parsePrice, parseNumber, parseDate }] = useUtils();
45
- const [, { showToast }] = useToast();
46
+ const [, { showToast }] = useToast();
46
47
 
47
48
  const walletName: any = {
48
49
  cash: {
@@ -53,13 +54,14 @@ export const MultiOrdersDetailsUI = (props: any) => {
53
54
  }
54
55
  }
55
56
 
56
- const handleBackNavigation = () => {
57
+ const handleArrowBack: any = () => {
57
58
  if (!isFromMultiCheckout) {
58
59
  navigation?.canGoBack() && navigation.goBack();
59
60
  return;
60
61
  }
61
- navigation.navigate('BottomTab');
62
- }
62
+ navigation.navigate('BusinessList');
63
+ return true
64
+ }
63
65
 
64
66
  const handleGoToOrderDetails = (uuid: any) => {
65
67
  navigation.navigate('OrderDetails', { orderId: uuid })
@@ -67,19 +69,29 @@ export const MultiOrdersDetailsUI = (props: any) => {
67
69
 
68
70
  useEffect(() => {
69
71
  if (error) {
70
- showToast(ToastType.Error, error)
72
+ showToast(ToastType.Error, error)
71
73
  }
72
74
  }, [error])
73
75
 
76
+ useEffect(() => {
77
+ BackHandler.addEventListener('hardwareBackPress', handleArrowBack)
78
+ return () => {
79
+ BackHandler.removeEventListener('hardwareBackPress', handleArrowBack)
80
+ }
81
+ }, [])
82
+
74
83
  return (
75
84
  <OrdersDetailsContainer keyboardShouldPersistTaps="handled" contentContainerStyle={{ paddingHorizontal: 40 }}>
76
85
  <View style={{ flexDirection: 'row' }}>
77
86
  <OButton
78
- imgLeftSrc={theme.images.general.arrow_left}
79
87
  imgRightSrc={null}
80
88
  style={styles.btnBackArrow}
81
- onClick={() => handleBackNavigation()}
82
- imgLeftStyle={{ tintColor: theme.colors.textNormal, width: 16 }}
89
+ onClick={() => handleArrowBack()}
90
+ icon={AntDesignIcon}
91
+ iconProps={{
92
+ name: 'arrowleft',
93
+ size: 26
94
+ }}
83
95
  />
84
96
  </View>
85
97
  <Header>
@@ -194,7 +206,7 @@ export const MultiOrdersDetailsUI = (props: any) => {
194
206
  </Row>
195
207
  <Row>
196
208
  <OText size={12} lineHeight={18} weight={'400'} color={theme.colors.textNormal}>
197
- {t('ESTIMATED_TAX_TO_BE_COLLECTED', 'Estimated tax to be collected')}:
209
+ {t('ESTIMATED_TAX_TO_BE_COLLECTED', 'Estimated tax to be collected')}:
198
210
  </OText>
199
211
  <OText size={12} lineHeight={18} weight={'400'} color={theme.colors.textNormal}>
200
212
  {parsePrice(ordersSummary?.tax)}
@@ -1,9 +1,10 @@
1
1
  import React, { useState, useEffect } from 'react'
2
2
  import { useLanguage } from 'ordering-components/native';
3
- import { View, StyleSheet, RefreshControl } from 'react-native';
3
+ import { View, StyleSheet, RefreshControl, Platform } from 'react-native';
4
+ import AntDesignIcon from 'react-native-vector-icons/AntDesign'
4
5
 
5
6
  import { OrdersOption } from '../OrdersOption'
6
- import { HeaderTitle, OText } from '../shared'
7
+ import { HeaderTitle, OButton, OText } from '../shared'
7
8
  import { ScrollView } from 'react-native-gesture-handler';
8
9
  import { Tab } from './styles'
9
10
  import { useTheme } from 'styled-components/native';
@@ -11,6 +12,7 @@ import { Container } from '../../layouts/Container';
11
12
 
12
13
  export const MyOrders = (props: any) => {
13
14
  const {
15
+ navigation,
14
16
  hideOrders,
15
17
  businessesSearchList
16
18
  } = props
@@ -33,6 +35,9 @@ export const MyOrders = (props: any) => {
33
35
  { key: 'business', value: t('BUSINESS', 'Business') },
34
36
  { key: 'products', value: t('PRODUCTS', 'Products') }
35
37
  ]
38
+ const isChewLayout = theme?.business_view?.components?.header?.components?.layout?.type === 'chew'
39
+
40
+ const goToBack = () => navigation?.canGoBack() && navigation.goBack()
36
41
 
37
42
  const handleOnRefresh = () => {
38
43
  setRefreshOrders(true);
@@ -67,7 +72,47 @@ export const MyOrders = (props: any) => {
67
72
  onRefresh={() => handleOnRefresh()}
68
73
  />
69
74
  }>
70
- {!hideOrders && (
75
+ {isChewLayout && (
76
+ <View style={{
77
+ width: '100%',
78
+ display: 'flex',
79
+ flexDirection: 'row',
80
+ alignItems: 'center',
81
+ paddingHorizontal: 40
82
+ }}>
83
+ <OText
84
+ size={24}
85
+ style={{
86
+ marginTop: Platform.OS === 'android' ? 50 : 30,
87
+ paddingHorizontal: 20,
88
+ textTransform: 'capitalize'
89
+ }}
90
+ >
91
+ <OButton
92
+ imgLeftStyle={{ width: 18 }}
93
+ imgRightSrc={null}
94
+ style={{
95
+ borderWidth: 0,
96
+ width: 26,
97
+ height: 26,
98
+ backgroundColor: '#FFF',
99
+ borderColor: '#FFF',
100
+ shadowColor: '#FFF',
101
+ paddingLeft: 0,
102
+ paddingRight: 0,
103
+ }}
104
+ onClick={goToBack}
105
+ icon={AntDesignIcon}
106
+ iconProps={{
107
+ name: 'arrowleft',
108
+ size: 26
109
+ }}
110
+ />
111
+ {t('MY_ORDERS', 'My Orders')}
112
+ </OText>
113
+ </View>
114
+ )}
115
+ {!hideOrders && !isChewLayout && (
71
116
  <HeaderTitle text={t('MY_ORDERS', 'My Orders')} />
72
117
  )}
73
118
  {!allEmpty && (
@@ -119,14 +164,31 @@ export const MyOrders = (props: any) => {
119
164
  </View>
120
165
  </>
121
166
  )}
122
- {notOrderOptions.includes(selectedOption) && (
167
+ {selectedOption === 'business' && (
168
+ <OrdersOption
169
+ {...props}
170
+ isBusiness
171
+ titleContent={t('PREVIOUSLY_ORDERED', 'Previously ordered')}
172
+ hideOrders
173
+ horizontal
174
+ activeOrders
175
+ pastOrders
176
+ preOrders
177
+ businessesSearchList={businessesSearchList}
178
+ setIsEmptyBusinesses={setIsEmptyBusinesses}
179
+ businessOrderIds={businessOrderIds}
180
+ setBusinessOrderIds={setBusinessOrderIds}
181
+ ordersLength={ordersLength}
182
+ setOrdersLength={setOrdersLength}
183
+ />
184
+ )}
185
+ {selectedOption === 'products' && (
123
186
  <OrdersOption
124
187
  {...props}
188
+ isProducts
125
189
  titleContent={t('PREVIOUSLY_ORDERED', 'Previously ordered')}
126
190
  hideOrders
127
191
  horizontal
128
- isBusiness={selectedOption === 'business'}
129
- isProducts={selectedOption === 'products'}
130
192
  activeOrders
131
193
  pastOrders
132
194
  preOrders
@@ -2,6 +2,7 @@ import * as React from 'react'
2
2
  import styled, { useTheme } from 'styled-components/native'
3
3
  import { OButton, OIcon, OText } from '../shared'
4
4
  import { Platform, TextStyle, ViewStyle, I18nManager, TouchableOpacity } from 'react-native'
5
+ import AntDesignIcon from 'react-native-vector-icons/AntDesign'
5
6
 
6
7
  const TitleWrapper = styled.View`
7
8
  flex-direction: column;
@@ -61,11 +62,16 @@ const NavBar = (props: Props) => {
61
62
  return (
62
63
  <Wrapper style={{ paddingTop: props.paddingTop, ...{ flexDirection: props.isVertical ? 'column' : 'row', alignItems: props.isVertical ? 'flex-start' : 'center' }, ...props.style }}>
63
64
  <OButton
64
- imgLeftSrc={props.leftImg || theme.images.general.arrow_left}
65
- imgLeftStyle={{width: 18}}
65
+ imgLeftSrc={props.leftImg}
66
+ imgLeftStyle={{ width: 18 }}
66
67
  imgRightSrc={null}
67
68
  style={{ ...btnBackArrow, ...props.btnStyle, ...props.isVertical ? (I18nManager.isRTL ? { paddingRight: 0 } : { paddingLeft: 0 }) : {} }}
68
69
  onClick={props?.onActionLeft}
70
+ icon={AntDesignIcon}
71
+ iconProps={{
72
+ name: 'arrowleft',
73
+ size: 26
74
+ }}
69
75
  />
70
76
  <TitleTopWrapper>
71
77
  {props.withIcon
@@ -126,9 +132,9 @@ NavBar.defaultProps = {
126
132
  textAlign: 'center'
127
133
  };
128
134
 
129
- const areEqual=(prevProps: { route?: any; }, nextProps: { route?: any; })=>{
130
- return prevProps.route === nextProps.route
131
- return true
135
+ const areEqual = (prevProps: { route?: any; }, nextProps: { route?: any; }) => {
136
+ return prevProps.route === nextProps.route
137
+ return true
132
138
  }
133
139
 
134
140
  export default React.memo(NavBar, areEqual);
@@ -1,5 +1,5 @@
1
1
  import React from 'react'
2
- import { useLanguage } from 'ordering-components/native'
2
+ import { useLanguage, useOrderingTheme } from 'ordering-components/native'
3
3
  import { Dimensions } from 'react-native'
4
4
  import RNRestart from 'react-native-restart'
5
5
  import { OText, OIcon, OButton } from '../shared'
@@ -16,7 +16,8 @@ export const NetworkError = (props: NoNetworkParams) => {
16
16
  } = props
17
17
  const theme = useTheme()
18
18
  const [, t] = useLanguage()
19
-
19
+ const [orderingTheme] = useOrderingTheme()
20
+ const urlimage = orderingTheme?.theme?.no_internet?.components?.image
20
21
  const noNetworkImage = image || theme.images.general.noNetwork
21
22
  const deviceWidth = Dimensions.get('screen').width
22
23
 
@@ -38,7 +39,8 @@ export const NetworkError = (props: NoNetworkParams) => {
38
39
  </OText>
39
40
  <ImageContainer>
40
41
  <OIcon
41
- src={noNetworkImage}
42
+ src={!urlimage && noNetworkImage}
43
+ url={urlimage}
42
44
  width={(deviceWidth - 80) * 0.9}
43
45
  height={(deviceWidth - 80) * 0.8}
44
46
  />
@@ -20,12 +20,13 @@ export const NotFoundSource = (props: NotFoundSourceParams) => {
20
20
  const theme = useTheme();
21
21
 
22
22
  const errorImage = image || theme.images.general.notFound
23
+ const isUrl = typeof errorImage === 'string' && errorImage.includes('http')
23
24
 
24
25
  return (
25
26
  <NotFound>
26
27
  {errorImage && (
27
28
  <NotFoundImage>
28
- <OIcon src={errorImage} width={260} height={220} />
29
+ <OIcon url={isUrl && errorImage} src={!isUrl && errorImage} width={260} height={220} />
29
30
  </NotFoundImage>
30
31
  )}
31
32
  {content && conditioned && !errorImage && <OText color={theme.colors.disabled} size={18} style={{ textAlign: 'center' }}>{content}</OText>}
@@ -0,0 +1,148 @@
1
+ import React, { useEffect } from 'react'
2
+ import {
3
+ UserFormDetails as NotificationsController,
4
+ useLanguage,
5
+ useSession,
6
+ useOrderingTheme,
7
+ useToast,
8
+ ToastType,
9
+ } from 'ordering-components/native'
10
+ import { NotificationsGroupSwitchWrapper, SwitchWrapper } from './styles'
11
+ import { Platform, StyleSheet, View } from 'react-native'
12
+ import { useState } from 'react'
13
+ import { useTheme } from 'styled-components/native';
14
+ import Spinner from 'react-native-loading-spinner-overlay';
15
+ import ToggleSwitch from 'toggle-switch-react-native'
16
+ import { Container } from '../../layouts/Container'
17
+ import NavBar from '../NavBar'
18
+ import { OText } from '../shared'
19
+
20
+ const NotificationsUI = (props: any) => {
21
+ const {
22
+ navigation,
23
+ singleNotifications,
24
+ handleChangePromotions,
25
+ userData
26
+ } = props
27
+
28
+ const theme = useTheme();
29
+ const [{ user: userSession }] = useSession()
30
+ const [, t] = useLanguage();
31
+ const [, { showToast }] = useToast();
32
+ const [orderingTheme] = useOrderingTheme()
33
+
34
+ const user = userData || userSession
35
+
36
+ const [notificationsList, setNotificationsList] = useState({
37
+ email: singleNotifications?.result?.result
38
+ ? !!singleNotifications?.result?.result?.settings?.email?.newsletter
39
+ : !!(singleNotifications?.changes?.settings?.email?.newsletter ?? (user && user?.settings?.email?.newsletter)),
40
+ sms: singleNotifications?.result?.result
41
+ ? !!singleNotifications?.result?.result?.settings?.sms?.newsletter
42
+ : !!(singleNotifications?.changes?.settings?.sms?.newsletter ?? (user && user?.settings?.sms?.newsletter)),
43
+ notification: singleNotifications?.result?.result
44
+ ? !!singleNotifications?.result?.result?.settings?.notification?.newsletter
45
+ : !!(singleNotifications?.changes?.settings?.notification?.newsletter ?? (user && user?.settings?.notification?.newsletter))
46
+ })
47
+
48
+ const goToBack = () => navigation?.canGoBack() && navigation.goBack()
49
+ const showCustomerPromotions = !orderingTheme?.theme?.profile?.components?.promotions?.hidden
50
+ const showNotifications = !orderingTheme?.theme?.profile?.components?.notification_settings?.hidden
51
+
52
+ const handleEditNotifications = (key: any, value: any) => {
53
+ setNotificationsList({
54
+ ...notificationsList,
55
+ [key]: value
56
+ })
57
+ }
58
+
59
+ useEffect(() => {
60
+ if (singleNotifications.result.result && !singleNotifications.loading) {
61
+ if (!singleNotifications.result?.error) {
62
+ showToast(ToastType.Success, t('UPDATE_SUCCESSFULLY', 'Update successfully'));
63
+ }
64
+ }
65
+ }, [singleNotifications.result])
66
+
67
+ useEffect(() => {
68
+ const isSingle = true
69
+ handleChangePromotions(notificationsList, isSingle)
70
+ }, [notificationsList])
71
+
72
+ return (
73
+ <Container noPadding>
74
+ <NavBar
75
+ title={t('NOTIFICATIONS', 'Notifications')}
76
+ titleAlign={'center'}
77
+ onActionLeft={goToBack}
78
+ showCall={false}
79
+ style={{ paddingHorizontal: 40, paddingVertical: Platform.OS === 'ios' ? 0 : 20, marginTop: Platform.OS === 'ios' ? 0 : 30 }}
80
+ />
81
+ {showCustomerPromotions && showNotifications && (
82
+ <>
83
+ <Spinner visible={singleNotifications?.loading} />
84
+ <View style={{ ...styles.pagePadding }}>
85
+ <NotificationsGroupSwitchWrapper>
86
+ <OText style={{ ...styles.title }}>{t('MARKETING_NOTIFICATIONS', 'Marketing Notifications')}</OText>
87
+ <SwitchWrapper>
88
+ <OText>{t('EMAILS', 'Emails')}</OText>
89
+ <ToggleSwitch
90
+ isOn={notificationsList?.email}
91
+ onColor={theme.colors.primary}
92
+ size="small"
93
+ disabled={singleNotifications?.loading}
94
+ offColor={theme.colors.disabled}
95
+ animationSpeed={400}
96
+ onToggle={() => handleEditNotifications('email', !notificationsList?.email)}
97
+ />
98
+ </SwitchWrapper>
99
+ <SwitchWrapper>
100
+ <OText>{t('SMS', 'Sms')}</OText>
101
+ <ToggleSwitch
102
+ isOn={notificationsList?.sms}
103
+ onColor={theme.colors.primary}
104
+ size="small"
105
+ disabled={singleNotifications?.loading}
106
+ offColor={theme.colors.disabled}
107
+ animationSpeed={400}
108
+ onToggle={() => handleEditNotifications('sms', !notificationsList?.sms)}
109
+ />
110
+ </SwitchWrapper>
111
+ <SwitchWrapper>
112
+ <OText>{t('PUSH_NOTIFICATIONS', 'Push Notifications')}</OText>
113
+ <ToggleSwitch
114
+ isOn={notificationsList?.notification}
115
+ onColor={theme.colors.primary}
116
+ size="small"
117
+ disabled={singleNotifications?.loading}
118
+ offColor={theme.colors.disabled}
119
+ animationSpeed={400}
120
+ onToggle={() => handleEditNotifications('notification', !notificationsList?.notification)}
121
+ />
122
+ </SwitchWrapper>
123
+ </NotificationsGroupSwitchWrapper>
124
+ </View>
125
+ </>
126
+ )}
127
+ </Container>
128
+ )
129
+ }
130
+
131
+ const styles = StyleSheet.create({
132
+ title: {
133
+ marginBottom: 24,
134
+ fontWeight: 'bold',
135
+ },
136
+ pagePadding: {
137
+ paddingLeft: 40,
138
+ paddingRight: 40
139
+ }
140
+ });
141
+
142
+ export const NotificationsList = (props: any) => {
143
+ const notificationsListProps = {
144
+ ...props,
145
+ UIComponent: NotificationsUI
146
+ }
147
+ return <NotificationsController {...notificationsListProps} />
148
+ }
@@ -0,0 +1,17 @@
1
+ import styled from 'styled-components/native'
2
+
3
+ export const ContainerButtons = styled.View`
4
+ margin-vertical: 50px
5
+ `
6
+
7
+ export const NotificationsGroupSwitchWrapper = styled.View`
8
+ flex-grow: 1;
9
+ justify-content: space-between;
10
+ `
11
+
12
+ export const SwitchWrapper = styled.View`
13
+ flex-direction: row;
14
+ justify-content: space-between;
15
+ align-items: center;
16
+ margin-bottom: 12px;
17
+ `
@@ -0,0 +1,167 @@
1
+ import React from 'react'
2
+ import { useTheme } from 'styled-components/native'
3
+ import { ScrollView, StyleSheet, View } from 'react-native'
4
+ import { useLanguage, useUtils } from 'ordering-components/native'
5
+ import MaterialCommunityIcons from 'react-native-vector-icons/MaterialCommunityIcons'
6
+ import { OText, OButton } from '../shared'
7
+
8
+ export const OrderHistory = (props: any) => {
9
+ const {
10
+ order,
11
+ messages,
12
+ enableReview,
13
+ onClose,
14
+ handleTriggerReview
15
+ } = props
16
+
17
+ const [, t] = useLanguage()
18
+ const [{ parseDate }] = useUtils()
19
+ const theme = useTheme()
20
+
21
+ const styles = StyleSheet.create({
22
+ historyItem: {
23
+ display: 'flex',
24
+ alignItems: 'center',
25
+ flexDirection: 'row',
26
+ borderBottomWidth: 1,
27
+ borderColor: theme.colors.border
28
+ },
29
+ detailWrapper: {
30
+ marginLeft: 20,
31
+ paddingHorizontal: 13,
32
+ paddingVertical: 16
33
+ },
34
+ container: {
35
+ paddingHorizontal: 40,
36
+ paddingVertical: 15
37
+ }
38
+ });
39
+
40
+ const ORDER_STATUS: any = {
41
+ 0: 'ORDER_STATUS_PENDING',
42
+ 1: 'ORDERS_COMPLETED',
43
+ 2: 'ORDER_REJECTED',
44
+ 3: 'ORDER_STATUS_IN_BUSINESS',
45
+ 4: 'ORDER_READY',
46
+ 5: 'ORDER_REJECTED_RESTAURANT',
47
+ 6: 'ORDER_STATUS_CANCELLEDBYDRIVER',
48
+ 7: 'ORDER_STATUS_ACCEPTEDBYRESTAURANT',
49
+ 8: 'ORDER_CONFIRMED_ACCEPTED_BY_DRIVER',
50
+ 9: 'ORDER_PICKUP_COMPLETED_BY_DRIVER',
51
+ 10: 'ORDER_PICKUP_FAILED_BY_DRIVER',
52
+ 11: 'ORDER_DELIVERY_COMPLETED_BY_DRIVER',
53
+ 12: 'ORDER_DELIVERY_FAILED_BY_DRIVER',
54
+ 13: 'PREORDER',
55
+ 14: 'ORDER_NOT_READY',
56
+ 15: 'ORDER_PICKEDUP_COMPLETED_BY_CUSTOMER',
57
+ 16: 'ORDER_STATUS_CANCELLED_BY_CUSTOMER',
58
+ 17: 'ORDER_NOT_PICKEDUP_BY_CUSTOMER',
59
+ 18: 'ORDER_DRIVER_ALMOST_ARRIVED_BUSINESS',
60
+ 19: 'ORDER_DRIVER_ALMOST_ARRIVED_CUSTOMER',
61
+ 20: 'ORDER_CUSTOMER_ALMOST_ARRIVED_BUSINESS',
62
+ 21: 'ORDER_CUSTOMER_ARRIVED_BUSINESS',
63
+ 22: 'ORDER_LOOKING_FOR_DRIVER',
64
+ 23: 'ORDER_DRIVER_ON_WAY'
65
+ }
66
+
67
+ const getLogisticTagStatus = (status: any) => {
68
+ switch (status) {
69
+ case 0:
70
+ return t('PENDING', 'Pending')
71
+ case 1:
72
+ return t('IN_PROGRESS', 'In Progress')
73
+ case 2:
74
+ return t('IN_QUEUE', 'In Queue')
75
+ case 3:
76
+ return t('EXPIRED', 'Logistic expired')
77
+ case 4:
78
+ return t('RESOLVED', 'Resolved')
79
+ default:
80
+ return status
81
+ }
82
+ }
83
+
84
+ const handleReview = () => {
85
+ if (enableReview) handleTriggerReview()
86
+ else onClose()
87
+ }
88
+
89
+ return (
90
+ <ScrollView contentContainerStyle={styles.container}>
91
+ <OText size={20} style={{ alignSelf: 'center', textAlign: 'center' }} mBottom={10}>
92
+ {t('DETAILS_OF_ORDER', 'Details of Order_NUMBER_').replace('_NUMBER_', ` # ${order?.id}`)}
93
+ </OText>
94
+ {!messages?.loading && order && (
95
+ <View style={styles.historyItem}>
96
+ <MaterialCommunityIcons
97
+ name="checkbox-marked-circle"
98
+ size={20}
99
+ color={theme.colors.primary}
100
+ />
101
+ <View style={styles.detailWrapper}>
102
+ <OText
103
+ size={14}
104
+ weight='bold'
105
+ numberOfLines={1}
106
+ ellipsizeMode='tail'
107
+ >
108
+ {t('ORDER_PLACED', 'Order placed')} {' '}
109
+ {t('VIA', 'Via')}{' '}
110
+ {order.app_id ? t(order.app_id.toUpperCase(), order.app_id) : t('OTHER', 'Other')}
111
+ </OText>
112
+ <OText size={12}>{parseDate(order?.created_at, { outputFormat: 'MMM DD, hh:mm A' })}</OText>
113
+ </View>
114
+ </View>
115
+ )}
116
+ {messages && messages?.messages.map((message: any, i: number) => message.type === 1 && (
117
+ <View
118
+ style={styles.historyItem}
119
+ key={i}
120
+ >
121
+ <MaterialCommunityIcons
122
+ name="checkbox-marked-circle"
123
+ size={20}
124
+ color={theme.colors.primary}
125
+ />
126
+ <View style={styles.detailWrapper}>
127
+ {message.change?.attribute !== 'driver_id' ? (
128
+ <OText
129
+ size={14}
130
+ weight='bold'
131
+ numberOfLines={1}
132
+ ellipsizeMode='tail'
133
+ >
134
+ {message.change?.attribute === 'logistic_status'
135
+ ? getLogisticTagStatus(parseInt(message.change.new, 10))
136
+ : t(ORDER_STATUS[parseInt(message.change.new, 10)])
137
+ }
138
+ </OText>
139
+ ) : (
140
+ <OText
141
+ size={14}
142
+ weight='bold'
143
+ numberOfLines={1}
144
+ ellipsizeMode='tail'
145
+ >
146
+ {message.change.new
147
+ ? (`${message.driver?.name} ${!!message.driver?.lastname ? message.driver.lastname : ''} ${t('WAS_ASSIGNED_AS_DRIVER', 'Was assigned as driver')}`)
148
+ : t('DRIVER_UNASSIGNED', 'Driver unassigned')}
149
+ </OText>
150
+ )}
151
+ <OText size={12}>{parseDate(message?.created_at, { outputFormat: 'MMM DD, hh:mm A' })}</OText>
152
+ </View>
153
+ </View>
154
+ ))}
155
+ <OButton
156
+ text={enableReview ? t('REVIEW_ORDER', 'Review order') : t('CONTINUE', 'Continue')}
157
+ textStyle={{ fontSize: 14, color: theme.colors.white }}
158
+ imgRightSrc={theme.images.general.arrow_right}
159
+ imgRightStyle={{ tintColor: theme.colors.white, right: 5, margin: 5 }}
160
+ borderColor='transparent'
161
+ bgColor={theme.colors.primary}
162
+ style={{ borderRadius: 7.6, borderWidth: 1, height: 44, shadowOpacity: 0, marginBottom: 30, marginTop: 20 }}
163
+ onClick={() => handleReview()}
164
+ />
165
+ </ScrollView>
166
+ )
167
+ }