ordering-ui-react-native 0.15.45 → 0.15.46-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 (190) 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 +16 -8
  5. package/src/components/BusinessTypeFilter/index.tsx +3 -1
  6. package/src/components/BusinessesListing/index.tsx +1 -1
  7. package/src/components/Checkout/index.tsx +23 -2
  8. package/src/components/DriverTips/index.tsx +11 -6
  9. package/src/components/LanguageSelector/index.tsx +7 -2
  10. package/src/components/LoginForm/index.tsx +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 +1 -1
  48. package/themes/business/src/components/OrdersOption/index.tsx +5 -2
  49. package/themes/business/src/components/PreviousOrders/index.tsx +10 -9
  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 +169 -4
  82. package/themes/original/src/components/ActiveOrders/index.tsx +15 -132
  83. package/themes/original/src/components/ActiveOrders/styles.tsx +0 -54
  84. package/themes/original/src/components/AddressForm/index.tsx +1 -1
  85. package/themes/original/src/components/AddressList/index.tsx +30 -18
  86. package/themes/original/src/components/AppleLogin/index.tsx +117 -78
  87. package/themes/original/src/components/BusinessBasicInformation/index.tsx +1 -1
  88. package/themes/original/src/components/BusinessController/index.tsx +48 -11
  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 +1 -1
  97. package/themes/original/src/components/BusinessProductsCategories/index.tsx +2 -2
  98. package/themes/original/src/components/BusinessProductsList/CategoryDescription/index.tsx +44 -0
  99. package/themes/original/src/components/BusinessProductsList/index.tsx +119 -35
  100. package/themes/original/src/components/BusinessProductsList/styles.tsx +12 -4
  101. package/themes/original/src/components/BusinessProductsListing/index.tsx +109 -21
  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 -41
  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 -42
  140. package/themes/original/src/components/OrderDetails/styles.tsx +1 -2
  141. package/themes/original/src/components/OrderProgress/index.tsx +1 -1
  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 +16 -14
  155. package/themes/original/src/components/PhoneInputNumber/index.tsx +1 -1
  156. package/themes/original/src/components/PreviousOrders/index.tsx +18 -147
  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 +16 -8
  171. package/themes/original/src/components/StripeElementsForm/naked.tsx +2 -2
  172. package/themes/original/src/components/UpsellingProducts/index.tsx +86 -74
  173. package/themes/original/src/components/UserDetails/index.tsx +5 -96
  174. package/themes/original/src/components/UserFormDetails/index.tsx +34 -24
  175. package/themes/original/src/components/UserProfile/index.tsx +59 -5
  176. package/themes/original/src/components/UserProfileForm/index.tsx +20 -18
  177. package/themes/original/src/components/UserVerification/index.tsx +178 -192
  178. package/themes/original/src/components/VerifyPhone/index.tsx +10 -7
  179. package/themes/original/src/components/VerifyPhone/styles.tsx +2 -1
  180. package/themes/original/src/components/Wallets/index.tsx +76 -9
  181. package/themes/original/src/components/Wallets/styles.tsx +21 -0
  182. package/themes/original/src/components/shared/HeaderTitle.tsx +2 -1
  183. package/themes/original/src/components/shared/OModal.tsx +4 -2
  184. package/themes/original/src/config/constants.tsx +6 -6
  185. package/themes/original/src/types/index.tsx +132 -9
  186. package/themes/original/src/utils/index.tsx +19 -2
  187. package/themes/single-business/src/components/AddressList/index.tsx +1 -1
  188. package/themes/single-business/src/components/OrderTypeSelector/index.tsx +1 -1
  189. package/themes/single-business/src/components/UserProfile/index.tsx +1 -1
  190. package/themes/uber-eats/src/components/BusinessesListing/index.tsx +1 -1
@@ -0,0 +1,53 @@
1
+ import React from 'react'
2
+ import { ScrollView, StyleSheet, Dimensions } from 'react-native'
3
+ import {
4
+ ListWrapper
5
+ } from './styles'
6
+
7
+ import { SingleProductCard } from '../../SingleProductCard'
8
+ import { PreviousProductsOrderedParams } from '../../../types'
9
+
10
+ export const PreviousProductsOrdered = (props: PreviousProductsOrderedParams) => {
11
+ const {
12
+ products,
13
+ onProductClick,
14
+ isBusinessesSearchList
15
+ } = props
16
+
17
+ const windowWidth = Dimensions.get('window').width;
18
+
19
+ const styles = StyleSheet.create({
20
+ container: {
21
+ marginBottom: 0,
22
+ },
23
+ });
24
+
25
+ const ProductList = ({ style }: any) => {
26
+ return (
27
+ <>
28
+ {products?.map((product: any) => (
29
+ <SingleProductCard
30
+ key={product?.id}
31
+ isSoldOut={(product.inventoried && !product.quantity)}
32
+ product={product}
33
+ businessId={product?.business?.id}
34
+ onProductClick={onProductClick}
35
+ style={style}
36
+ productAddedToCartLength={0}
37
+ />
38
+ ))}
39
+ </>
40
+ )
41
+ }
42
+ return (
43
+ <ScrollView horizontal={isBusinessesSearchList} style={styles.container} showsVerticalScrollIndicator={false}>
44
+ {isBusinessesSearchList ? (
45
+ <ProductList style={{ width: windowWidth - 80, marginRight: 20 }} />
46
+ ) : (
47
+ <ListWrapper isBusinessesSearchList={isBusinessesSearchList}>
48
+ <ProductList />
49
+ </ListWrapper>
50
+ )}
51
+ </ScrollView>
52
+ )
53
+ }
@@ -0,0 +1,6 @@
1
+ import styled from 'styled-components/native'
2
+
3
+ export const ListWrapper = styled.View`
4
+ background-color: ${(props: any) => props.theme.colors.backgroundLight};
5
+ padding-horizontal: ${(props : any) => props.isBusinessesSearchList ? '0' : '40px'};
6
+ `;
@@ -2,14 +2,15 @@ import React, { useState, useEffect } from 'react'
2
2
  import { OrderList, useLanguage, useOrder, ToastType, useToast } from 'ordering-components/native'
3
3
  import { useTheme } from 'styled-components/native';
4
4
  import { useFocusEffect } from '@react-navigation/native'
5
- import { OText, OButton } from '../shared'
5
+ import { OText } from '../shared'
6
6
  import { NotFoundSource } from '../NotFoundSource'
7
7
  import { ActiveOrders } from '../ActiveOrders'
8
8
  import { PreviousOrders } from '../PreviousOrders'
9
-
9
+ import { PreviousBusinessOrdered } from './PreviousBusinessOrdered'
10
+ import { PreviousProductsOrdered } from './PreviousProductsOrdered'
10
11
  import { OptionTitle, NoOrdersWrapper } from './styles'
11
12
  import { OrdersOptionParams } from '../../types'
12
-
13
+ import { _setStoreData } from '../../providers/StoreUtil';
13
14
  import {
14
15
  Placeholder,
15
16
  PlaceholderLine,
@@ -33,15 +34,28 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
33
34
  loadMoreOrders,
34
35
  loadOrders,
35
36
  setOrdersLength,
36
- ordersLength
37
+ ordersLength,
38
+ refreshOrders,
39
+ setRefreshOrders,
40
+ reorderState,
41
+ handleReorder,
42
+ handleUpdateOrderList,
43
+ isBusiness,
44
+ isProducts,
45
+ businessOrderIds,
46
+ products,
47
+ businessesSearchList,
48
+ hideOrders,
49
+ BusinessControllerSkeletons,
37
50
  } = props
38
51
 
39
52
  const theme = useTheme();
40
53
 
41
54
  const [, t] = useLanguage()
42
- const [, { reorder }] = useOrder()
43
- const { showToast } = useToast()
55
+ const [{ carts }] = useOrder()
56
+ const [, { showToast }] = useToast()
44
57
  const { loading, error, orders: values } = orderList
58
+ const [businessLoading, setBusinessLoading] = useState(true)
45
59
 
46
60
  const imageFails = activeOrders
47
61
  ? theme.images.general.emptyActiveOrders
@@ -49,26 +63,6 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
49
63
 
50
64
  const orders = customArray || values || []
51
65
 
52
- const [reorderLoading, setReorderLoading] = useState(false)
53
-
54
-
55
- const handleReorder = async (orderId: number) => {
56
- setReorderLoading(true)
57
- try {
58
- const { error, result } = await reorder(orderId)
59
- if (!error) {
60
- onNavigationRedirect && onNavigationRedirect('CheckoutNavigator', { cartUuid: result.uuid })
61
- setReorderLoading(false)
62
- return
63
- }
64
- setReorderLoading(false)
65
-
66
- } catch (err: any) {
67
- showToast(ToastType.Error, t('ERROR', err.message))
68
- setReorderLoading(false)
69
- }
70
- }
71
-
72
66
  const getOrderStatus = (s: string) => {
73
67
  const status = parseInt(s)
74
68
  const orderStatus = [
@@ -95,7 +89,7 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
95
89
  { key: 20, value: t('ORDER_CUSTOMER_ALMOST_ARRIVED_BUSINESS', 'Customer almost arrived to business') },
96
90
  { key: 21, value: t('ORDER_CUSTOMER_ARRIVED_BUSINESS', 'Customer arrived to business') },
97
91
  { key: 22, value: t('ORDER_LOOKING_FOR_DRIVER', 'Looking for driver') },
98
- { key: 23, value: t('ORDER_DRIVER_ON_WAY', 'Driver on way') }
92
+ { key: 23, value: t('ORDER_DRIVER_ON_WAY', 'Driver on way') }
99
93
  ]
100
94
 
101
95
  const objectStatus = orderStatus.find((o) => o.key === status)
@@ -103,11 +97,46 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
103
97
  return objectStatus && objectStatus
104
98
  }
105
99
 
100
+ const onProductClick = (product: any) => {
101
+ if (product?.product_id && product?.category_id && product?.businessId) {
102
+ onNavigationRedirect('ProductDetails', {
103
+ productId: product?.product_id,
104
+ categoryId: product?.category_id,
105
+ businessId: product?.businessId,
106
+ })
107
+ } else {
108
+ showToast(ToastType.Error, t('ERROR_FAILED_REDIRECT_IDS', 'Failed to redirect product for ids'))
109
+ }
110
+ }
111
+
112
+ useEffect(() => {
113
+ const _businessId = 'businessId:' + reorderState?.result?.business_id
114
+ if (reorderState?.error) {
115
+ if (reorderState?.result?.business_id) {
116
+ _setStoreData('adjust-cart-products', JSON.stringify(_businessId))
117
+ navigation.navigate('Business', { store: reorderState?.result?.business?.slug })
118
+ }
119
+ }
120
+ if (!reorderState?.error && reorderState.loading === false && reorderState?.result?.business_id) {
121
+ const cartProducts = carts?.[_businessId]?.products
122
+ const available = cartProducts.every((product: any) => product.valid === true)
123
+ const orderProducts = orders.find((order: any) => order?.id === reorderState?.result?.orderId)?.products
124
+
125
+ if (available && reorderState?.result?.uuid && (cartProducts?.length === orderProducts?.length)) {
126
+ onNavigationRedirect && onNavigationRedirect('CheckoutNavigator', { cartUuid: reorderState?.result.uuid })
127
+ } else {
128
+ _setStoreData('adjust-cart-products', JSON.stringify(_businessId))
129
+ cartProducts?.length !== orderProducts?.length && _setStoreData('already-removed', JSON.stringify('removed'))
130
+ navigation.navigate('Business', { store: reorderState?.result?.business?.slug })
131
+ }
132
+ }
133
+ }, [reorderState])
134
+
106
135
  useFocusEffect(
107
136
  React.useCallback(() => {
108
- loadOrders()
137
+ loadOrders(false, false, false, true)
109
138
  }, [navigation])
110
- )
139
+ )
111
140
 
112
141
  useEffect(() => {
113
142
  const hasMore = pagination?.totalPages && pagination?.currentPage !== pagination?.totalPages
@@ -126,7 +155,14 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
126
155
  } else if (!preOrders) {
127
156
  setOrdersLength && setOrdersLength({ ...ordersLength, previousOrdersLength: updateOrders?.length })
128
157
  }
129
- }, [orders, activeOrders])
158
+ }, [orders, activeOrders, preOrders])
159
+
160
+ useEffect(() => {
161
+ if (refreshOrders) {
162
+ loadOrders(false, false, false, true)
163
+ setRefreshOrders && setRefreshOrders(false)
164
+ }
165
+ }, [refreshOrders])
130
166
 
131
167
  return (
132
168
  <>
@@ -144,9 +180,9 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
144
180
 
145
181
  </NoOrdersWrapper>
146
182
  )}
147
- {(ordersLength.activeOrdersLength > 0 || ordersLength.previousOrdersLength > 0) && (
183
+ {(ordersLength?.activeOrdersLength > 0 || ordersLength?.previousOrdersLength > 0) && (
148
184
  <>
149
- <OptionTitle>
185
+ <OptionTitle titleContent={!!titleContent} isBusinessesSearchList={!!businessesSearchList}>
150
186
  <OText size={16} lineHeight={24} weight={'500'} color={theme.colors.textNormal} mBottom={10} >
151
187
  {titleContent || (activeOrders
152
188
  ? t('ACTIVE', 'Active')
@@ -155,7 +191,7 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
155
191
  : t('PAST', 'Past'))}
156
192
  </OText>
157
193
  </OptionTitle>
158
- {!(ordersLength.activeOrdersLength === 0 && ordersLength.previousOrdersLength === 0) &&
194
+ {!(ordersLength?.activeOrdersLength === 0 && ordersLength?.previousOrdersLength === 0) &&
159
195
  !loading &&
160
196
  orders.filter((order: any) => orderStatus.includes(order.status)).length === 0 &&
161
197
  (
@@ -167,7 +203,51 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
167
203
  )}
168
204
  </>
169
205
  )}
170
- {loading && (
206
+ {isBusiness && !!businessesSearchList && businessLoading && (
207
+ <ScrollView horizontal>
208
+ <BusinessControllerSkeletons />
209
+ </ScrollView>
210
+ )}
211
+ {isBusiness && businessOrderIds?.length > 0 && (
212
+ <PreviousBusinessOrdered
213
+ businessId={businessOrderIds}
214
+ businessLoading={businessLoading}
215
+ setBusinessLoading={setBusinessLoading}
216
+ onNavigationRedirect={onNavigationRedirect}
217
+ isLoadingOrders={loading}
218
+ isBusinessesSearchList={!!businessesSearchList}
219
+ />
220
+ )}
221
+
222
+ {isProducts && (
223
+ <PreviousProductsOrdered
224
+ products={products}
225
+ onProductClick={onProductClick}
226
+ isBusinessesSearchList={!!businessesSearchList}
227
+ />
228
+ )}
229
+ {(loading && isProducts) && (
230
+ <>
231
+ {[...Array(4).keys()].map(
232
+ (item, i) => (
233
+ <Placeholder key={i} style={{ padding: 5, paddingLeft: 40 }} Animation={Fade}>
234
+ <View style={{ flexDirection: 'row' }}>
235
+ <PlaceholderLine
236
+ width={24}
237
+ height={70}
238
+ style={{ marginRight: 10, marginBottom: 10 }}
239
+ />
240
+ <Placeholder style={{ paddingVertical: 10 }}>
241
+ <PlaceholderLine width={60} style={{ marginBottom: 25 }} />
242
+ <PlaceholderLine width={20} />
243
+ </Placeholder>
244
+ </View>
245
+ </Placeholder>
246
+ ),
247
+ )}
248
+ </>
249
+ )}
250
+ {loading && !hideOrders && (
171
251
  <>
172
252
  {!activeOrders ? (
173
253
  <Placeholder style={{ marginTop: 30 }} Animation={Fade}>
@@ -198,35 +278,38 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
198
278
  )}
199
279
  </>
200
280
  )}
201
- {!loading && !error && orders.length > 0 && (
281
+ {!loading && !error && orders.length > 0 && !hideOrders && (
202
282
  preOrders ? (
203
283
  <ActiveOrders
204
284
  orders={orders.filter((order: any) => orderStatus.includes(order.status))}
205
285
  pagination={pagination}
206
286
  loadMoreOrders={loadMoreOrders}
207
- reorderLoading={reorderLoading}
287
+ reorderLoading={reorderState?.loading}
208
288
  customArray={customArray}
209
289
  getOrderStatus={getOrderStatus}
210
290
  onNavigationRedirect={onNavigationRedirect}
291
+ handleUpdateOrderList={handleUpdateOrderList}
211
292
  />
212
293
  ) : activeOrders ? (
213
294
  <ActiveOrders
214
295
  orders={orders.filter((order: any) => orderStatus.includes(order.status))}
215
296
  pagination={pagination}
216
- reorderLoading={reorderLoading}
297
+ reorderLoading={reorderState?.loading}
217
298
  customArray={customArray}
218
299
  getOrderStatus={getOrderStatus}
219
300
  onNavigationRedirect={onNavigationRedirect}
301
+ handleUpdateOrderList={handleUpdateOrderList}
220
302
  />
221
303
  ) : (
222
304
  <PreviousOrders
223
- reorderLoading={reorderLoading}
305
+ reorderLoading={reorderState?.loading}
224
306
  orders={orders.filter((order: any) => orderStatus.includes(order.status)).sort((a: any, b: any) => a?.id < b?.id)}
225
307
  pagination={pagination}
226
308
  loadMoreOrders={loadMoreOrders}
227
309
  getOrderStatus={getOrderStatus}
228
310
  onNavigationRedirect={onNavigationRedirect}
229
311
  handleReorder={handleReorder}
312
+ handleUpdateOrderList={handleUpdateOrderList}
230
313
  />
231
314
  )
232
315
  )}
@@ -235,13 +318,22 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
235
318
  }
236
319
 
237
320
  export const OrdersOption = (props: OrdersOptionParams) => {
321
+ const getAllOrders = props.activeOrders && props.pastOrders && props.preOrders
322
+
238
323
  const MyOrdersProps = {
239
324
  ...props,
240
325
  UIComponent: OrdersOptionUI,
241
- orderStatus: props.preOrders ? [13] : props.activeOrders
242
- ? [0, 3, 4, 7, 8, 9, 14, 18, 19, 20, 21, 22, 23]
243
- : [1, 2, 5, 6, 10, 11, 12, 15, 16, 17],
326
+ orderStatus: getAllOrders
327
+ ? [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23]
328
+ : props.preOrders ? [13] : props.activeOrders
329
+ ? [0, 3, 4, 7, 8, 9, 14, 18, 19, 20, 21, 22, 23]
330
+ : [1, 2, 5, 6, 10, 11, 12, 15, 16, 17],
244
331
  useDefualtSessionManager: true,
332
+ paginationSettings: {
333
+ initialPage: 1,
334
+ pageSize: getAllOrders ? 30 : 10,
335
+ controlType: 'infinity'
336
+ }
245
337
  }
246
338
 
247
339
  return <OrderList {...MyOrdersProps} />
@@ -1,11 +1,8 @@
1
- import styled from 'styled-components/native'
1
+ import styled, { css } from 'styled-components/native'
2
2
 
3
3
  export const OptionTitle = styled.View`
4
4
  margin-top: 24px;
5
- `
6
-
7
- export const NoOrdersWrapper = styled.View`
8
- flex-direction: column;
9
- align-items: center;
10
- margin-top: 50px;
5
+ ${(props : any) => props.titleContent && css`
6
+ margin-left: ${() => props.isBusinessesSearchList ? '0' : '40px'};
7
+ `}
11
8
  `
@@ -23,8 +23,8 @@ export const PaymentOptionCash = (props: any) => {
23
23
  borderRadius: 7.6,
24
24
  marginTop: 10,
25
25
  width: '100%',
26
- height: 44,
27
- maxHeight: 44
26
+ height: 50,
27
+ maxHeight: 50
28
28
  },
29
29
  errorMsg: {
30
30
  marginTop: 10,
@@ -1,8 +1,8 @@
1
1
  import React, { useState, useEffect } from 'react'
2
- import { Platform, StyleSheet, View } from 'react-native'
2
+ import { View } from 'react-native'
3
3
  import { Fade, Placeholder, PlaceholderLine } from 'rn-placeholder';
4
4
  import { useTheme } from 'styled-components/native'
5
- import CheckBox from '@react-native-community/checkbox';
5
+ import MaterialCommunityIcons from 'react-native-vector-icons/MaterialCommunityIcons';
6
6
  import {
7
7
  PaymentOptionWallet as PaymentOptionWalletController,
8
8
  useLanguage,
@@ -20,6 +20,7 @@ import { OText } from '../shared'
20
20
 
21
21
  const PaymentOptionWalletUI = (props: any) => {
22
22
  const {
23
+ businessConfigs,
23
24
  businessId,
24
25
  walletsState,
25
26
  selectWallet,
@@ -37,12 +38,8 @@ const PaymentOptionWalletUI = (props: any) => {
37
38
  const isWalletCashEnabled = configs?.wallet_cash_enabled?.value === '1'
38
39
  const isWalletPointsEnabled = configs?.wallet_credit_point_enabled?.value === '1'
39
40
 
40
- const styles = StyleSheet.create({
41
- checkBoxStyle: {
42
- width: 25,
43
- height: 25,
44
- }
45
- });
41
+ const isBusinessWalletCashEnabled = businessConfigs.find((config: any) => config.key === 'wallet_cash_enabled')?.value === '1'
42
+ const isBusinessWalletPointsEnabled = businessConfigs.find((config: any) => config.key === 'wallet_credit_point_enabled')?.value === '1'
46
43
 
47
44
  const [checkedState, setCheckedState] = useState(
48
45
  new Array(walletsState.result?.length).fill(false)
@@ -53,11 +50,11 @@ const PaymentOptionWalletUI = (props: any) => {
53
50
  const walletName: any = {
54
51
  cash: {
55
52
  name: t('PAY_WITH_CASH_WALLET', 'Pay with Cash Wallet'),
56
- isActive: isWalletCashEnabled
53
+ isActive: isWalletCashEnabled && isBusinessWalletCashEnabled
57
54
  },
58
55
  credit_point: {
59
56
  name: t('PAY_WITH_CREDITS_POINTS_WALLET', 'Pay with Credit Points Wallet'),
60
- isActive: isWalletPointsEnabled
57
+ isActive: isWalletPointsEnabled && isBusinessWalletPointsEnabled
61
58
  }
62
59
  }
63
60
 
@@ -96,22 +93,23 @@ const PaymentOptionWalletUI = (props: any) => {
96
93
  <Container
97
94
  key={wallet.id}
98
95
  isBottomBorder={idx === walletsState.result?.filter((wallet: any) => wallet.valid)?.length - 1}
96
+ onPress={() => handleOnChange(idx, wallet)}
97
+ disabled={(cart?.balance === 0 && !checkedState[idx]) || wallet.balance === 0}
99
98
  >
100
99
  <SectionLeft>
101
- <CheckBox
102
- value={checkedState[idx]}
103
- onValueChange={() => handleOnChange(idx, wallet)}
104
- disabled={(cart?.balance === 0 && !checkedState[idx]) || wallet.balance === 0 }
105
- boxType={'square'}
106
- tintColors={{
107
- true: theme.colors.primary,
108
- false: theme.colors.disabled
109
- }}
110
- tintColor={theme.colors.disabled}
111
- onCheckColor={theme.colors.primary}
112
- onTintColor={theme.colors.primary}
113
- style={Platform.OS === 'ios' && styles.checkBoxStyle}
114
- />
100
+ {checkedState[idx] ? (
101
+ <MaterialCommunityIcons
102
+ name="checkbox-marked"
103
+ size={25}
104
+ color={theme.colors.primary}
105
+ />
106
+ ) : (
107
+ <MaterialCommunityIcons
108
+ name="checkbox-blank-outline"
109
+ size={25}
110
+ color={theme.colors.disabled}
111
+ />
112
+ )}
115
113
  <View style={{ alignItems: 'baseline', marginLeft: 5 }}>
116
114
  <View>
117
115
  <OText
@@ -1,6 +1,6 @@
1
1
  import styled, { css } from 'styled-components/native'
2
2
 
3
- export const Container = styled.View`
3
+ export const Container = styled.TouchableOpacity`
4
4
  width: 100%;
5
5
  display: flex;
6
6
  padding: 20px 0;
@@ -9,7 +9,7 @@ import {
9
9
  import {
10
10
  PaymentOptions as PaymentOptionsController,
11
11
  useLanguage,
12
- ToastType,
12
+ ToastType,
13
13
  useToast,
14
14
  } from 'ordering-components/native';
15
15
  import { useTheme } from 'styled-components/native';
@@ -30,6 +30,7 @@ import {
30
30
  PMCardItemContent
31
31
  } from './styles'
32
32
  import { getIconCard, flatArray } from '../../utils';
33
+ import { useApplePay } from '@stripe/stripe-react-native';
33
34
 
34
35
  const stripeOptions: any = ['stripe_direct', 'stripe', 'stripe_connect']
35
36
  const methodsPay = ['google_pay', 'apple_pay']
@@ -62,7 +63,8 @@ const PaymentOptionsUI = (props: any) => {
62
63
  } = props
63
64
 
64
65
  const theme = useTheme();
65
- const [, { showToast }] = useToast();
66
+ const [, { showToast }] = useToast();
67
+ const { confirmApplePayPayment } = useApplePay()
66
68
 
67
69
  const getPayIcon = (method: string) => {
68
70
  switch (method) {
@@ -98,18 +100,18 @@ const PaymentOptionsUI = (props: any) => {
98
100
  // ]
99
101
 
100
102
  const handlePaymentMethodClick = (paymethod: any) => {
101
- if (cart?.balance > 0) {
102
- const isPopupMethod = ['stripe', 'stripe_direct', 'stripe_connect', 'stripe_redirect', 'paypal'].includes(paymethod?.gateway)
103
- if (webViewPaymentGateway.includes(paymethod?.gateway)) {
104
- handlePaymentMethodClickCustom(paymethod)
105
- }
106
- handlePaymethodClick(paymethod, isPopupMethod)
107
- return
108
- }
109
- showToast(
103
+ if (cart?.balance > 0) {
104
+ const isPopupMethod = ['stripe', 'stripe_direct', 'stripe_connect', 'stripe_redirect', 'paypal'].includes(paymethod?.gateway)
105
+ if (webViewPaymentGateway.includes(paymethod?.gateway)) {
106
+ handlePaymentMethodClickCustom(paymethod)
107
+ }
108
+ handlePaymethodClick(paymethod, isPopupMethod)
109
+ return
110
+ }
111
+ showToast(
110
112
  ToastType.Error,
111
113
  t('CART_BALANCE_ZERO', 'Sorry, the amount to pay is equal to zero and it is not necessary to select a payment method'))
112
- ;
114
+ ;
113
115
  }
114
116
 
115
117
  useEffect(() => {
@@ -134,7 +136,7 @@ const PaymentOptionsUI = (props: any) => {
134
136
 
135
137
  useEffect(() => {
136
138
  if (methodsPay.includes(paymethodSelected?.gateway) && paymethodData?.id && paymethodSelected?.data?.card) {
137
- handlePlaceOrder()
139
+ handlePlaceOrder(confirmApplePayPayment)
138
140
  }
139
141
  }, [paymethodData, paymethodSelected])
140
142
 
@@ -166,7 +168,7 @@ const PaymentOptionsUI = (props: any) => {
166
168
  )
167
169
  }
168
170
 
169
- const excludeIds: any = [32]; //exclude paypal & connect & redirect
171
+ const excludeIds: any = [32, 66]; //exclude paypal & connect & redirect
170
172
 
171
173
  return (
172
174
  <PMContainer>
@@ -58,7 +58,7 @@ export const PhoneInputNumber = (props: PhoneInputParams) => {
58
58
  }
59
59
 
60
60
  useEffect(() => {
61
- if ((defaultValue && userphoneNumber) || defaultValue === undefined || defaultValue === '') {
61
+ if ((defaultValue && userphoneNumber) || !defaultValue) {
62
62
  if (userphoneNumber) {
63
63
  const checkValid = phoneInput.current?.isValidNumber(userphoneNumber);
64
64
  const callingCode = phoneInput.current?.getCallingCode();