ordering-ui-react-native 0.16.8 → 0.16.9-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 (219) hide show
  1. package/package.json +8 -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 +22 -0
  9. package/src/components/BusinessTypeFilter/index.tsx +1 -2
  10. package/src/components/BusinessesListing/index.tsx +1 -1
  11. package/src/components/Checkout/index.tsx +2 -1
  12. package/src/components/LanguageSelector/index.tsx +21 -16
  13. package/src/components/LoginForm/index.tsx +118 -30
  14. package/src/components/LoginForm/styles.tsx +6 -0
  15. package/src/components/Messages/index.tsx +2 -2
  16. package/src/components/NotificationSetting/index.tsx +85 -0
  17. package/src/components/OrderDetails/index.tsx +7 -21
  18. package/src/components/OrdersOption/index.tsx +54 -56
  19. package/src/components/PaymentOptions/index.tsx +335 -365
  20. package/src/components/PaymentOptionsWebView/index.tsx +120 -121
  21. package/src/components/ReviewDriver/index.tsx +1 -1
  22. package/src/components/ReviewOrder/index.tsx +2 -1
  23. package/src/components/ReviewProducts/index.tsx +11 -0
  24. package/src/components/SignupForm/index.tsx +143 -61
  25. package/src/components/SingleProductReview/index.tsx +8 -5
  26. package/src/components/StripeElementsForm/index.tsx +25 -16
  27. package/src/components/StripeMethodForm/index.tsx +1 -2
  28. package/src/components/VerifyPhone/styles.tsx +1 -2
  29. package/src/components/shared/OBottomPopup.tsx +6 -2
  30. package/src/index.tsx +2 -0
  31. package/src/navigators/CheckoutNavigator.tsx +6 -0
  32. package/src/navigators/HomeNavigator.tsx +6 -0
  33. package/src/pages/BusinessesListing.tsx +7 -6
  34. package/src/pages/MultiCheckout.tsx +31 -0
  35. package/src/pages/MultiOrdersDetails.tsx +27 -0
  36. package/src/pages/OrderDetails.tsx +1 -1
  37. package/src/pages/ReviewDriver.tsx +2 -2
  38. package/src/pages/ReviewOrder.tsx +2 -2
  39. package/src/theme.json +0 -1
  40. package/src/types/@fatnlazycat/react-native-recaptcha-v3/index.d.ts +1 -0
  41. package/src/types/index.tsx +13 -9
  42. package/src/utils/index.tsx +0 -1
  43. package/themes/business/index.tsx +4 -0
  44. package/themes/business/src/components/BusinessController/index.tsx +2 -2
  45. package/themes/business/src/components/Chat/index.tsx +42 -34
  46. package/themes/business/src/components/DriverMap/index.tsx +13 -10
  47. package/themes/business/src/components/DriverSchedule/index.tsx +71 -0
  48. package/themes/business/src/components/DriverSchedule/styles.tsx +6 -0
  49. package/themes/business/src/components/LoginForm/index.tsx +111 -74
  50. package/themes/business/src/components/MapView/index.tsx +1 -1
  51. package/themes/business/src/components/MessagesOption/index.tsx +11 -1
  52. package/themes/business/src/components/OrderDetails/Business.tsx +1 -1
  53. package/themes/business/src/components/OrderDetails/Delivery.tsx +3 -3
  54. package/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +19 -18
  55. package/themes/business/src/components/OrdersListManager/index.tsx +10 -3
  56. package/themes/business/src/components/OrdersOption/index.tsx +65 -21
  57. package/themes/business/src/components/OrdersOption/styles.tsx +5 -1
  58. package/themes/business/src/components/OrdersOptionBusiness/index.tsx +15 -1
  59. package/themes/business/src/components/OrdersOptionCity/index.tsx +15 -1
  60. package/themes/business/src/components/OrdersOptionDate/index.tsx +19 -6
  61. package/themes/business/src/components/OrdersOptionDelivery/index.tsx +15 -1
  62. package/themes/business/src/components/OrdersOptionDriver/index.tsx +15 -1
  63. package/themes/business/src/components/OrdersOptionPaymethod/index.tsx +15 -1
  64. package/themes/business/src/components/OrdersOptionStatus/index.tsx +10 -1
  65. package/themes/business/src/components/PreviousMessages/index.tsx +17 -18
  66. package/themes/business/src/components/PreviousOrders/index.tsx +21 -23
  67. package/themes/business/src/components/ProductItemAccordion/index.tsx +5 -4
  68. package/themes/business/src/components/ReviewCustomer/index.tsx +1 -1
  69. package/themes/business/src/components/ScheduleBlocked/index.tsx +53 -0
  70. package/themes/business/src/components/UserFormDetails/index.tsx +5 -2
  71. package/themes/business/src/components/UserProfileForm/index.tsx +28 -4
  72. package/themes/business/src/components/shared/ODropDown.tsx +42 -8
  73. package/themes/business/src/components/shared/ODropDownCalendar.tsx +36 -7
  74. package/themes/business/src/components/shared/OModal.tsx +40 -37
  75. package/themes/business/src/types/index.tsx +14 -9
  76. package/themes/business/src/utils/index.tsx +10 -0
  77. package/themes/doordash/src/components/BusinessesListing/index.tsx +1 -1
  78. package/themes/doordash/src/components/LoginForm/index.tsx +1 -2
  79. package/themes/instacart/src/components/BusinessesListing/index.tsx +1 -1
  80. package/themes/kiosk/src/components/BusinessMenu/index.tsx +2 -1
  81. package/themes/kiosk/src/components/CartItem/index.tsx +4 -3
  82. package/themes/kiosk/src/components/CategoriesMenu/index.tsx +1 -0
  83. package/themes/kiosk/src/components/Checkout/index.tsx +6 -0
  84. package/themes/kiosk/src/components/DrawerView/index.tsx +1 -0
  85. package/themes/kiosk/src/components/DrawerView/styles.tsx +2 -2
  86. package/themes/kiosk/src/components/LoginForm/index.tsx +121 -10
  87. package/themes/kiosk/src/components/LoginForm/styles.tsx +5 -0
  88. package/themes/kiosk/src/components/NavBar/index.tsx +14 -14
  89. package/themes/kiosk/src/components/OptionCard/index.tsx +1 -1
  90. package/themes/kiosk/src/components/OrderTypeCardSelector/index.tsx +8 -10
  91. package/themes/kiosk/src/components/shared/OButton.tsx +5 -18
  92. package/themes/kiosk/src/types/index.d.ts +2 -0
  93. package/themes/original/index.tsx +22 -0
  94. package/themes/original/src/components/ActiveOrders/index.tsx +15 -132
  95. package/themes/original/src/components/ActiveOrders/styles.tsx +0 -54
  96. package/themes/original/src/components/AddressForm/index.tsx +136 -133
  97. package/themes/original/src/components/AddressList/index.tsx +1 -1
  98. package/themes/original/src/components/AppleLogin/index.tsx +4 -4
  99. package/themes/original/src/components/BusinessBasicInformation/index.tsx +302 -160
  100. package/themes/original/src/components/BusinessBasicInformation/styles.tsx +6 -2
  101. package/themes/original/src/components/BusinessController/index.tsx +179 -96
  102. package/themes/original/src/components/BusinessController/styles.tsx +5 -0
  103. package/themes/original/src/components/BusinessItemAccordion/index.tsx +12 -9
  104. package/themes/original/src/components/BusinessItemAccordion/styles.tsx +3 -1
  105. package/themes/original/src/components/BusinessListingSearch/BusinessControllerSkeletons/index.tsx +57 -0
  106. package/themes/original/src/components/BusinessListingSearch/MaxSectionItem/index.tsx +59 -0
  107. package/themes/original/src/components/BusinessListingSearch/MaxSectionItem/styles.tsx +13 -0
  108. package/themes/original/src/components/BusinessListingSearch/index.tsx +106 -126
  109. package/themes/original/src/components/BusinessListingSearch/styles.tsx +18 -13
  110. package/themes/original/src/components/BusinessProductsList/CategoryDescription/index.tsx +44 -0
  111. package/themes/original/src/components/BusinessProductsList/SubcategoriesComponent/index.tsx +87 -0
  112. package/themes/original/src/components/BusinessProductsList/SubcategoriesComponent/styles.tsx +12 -0
  113. package/themes/original/src/components/BusinessProductsList/index.tsx +66 -73
  114. package/themes/original/src/components/BusinessProductsList/styles.tsx +0 -3
  115. package/themes/original/src/components/BusinessProductsListing/index.tsx +290 -178
  116. package/themes/original/src/components/BusinessProductsListing/styles.tsx +18 -0
  117. package/themes/original/src/components/BusinessReviews/index.tsx +6 -1
  118. package/themes/original/src/components/BusinessTypeFilter/index.tsx +106 -38
  119. package/themes/original/src/components/BusinessTypeFilter/styles.tsx +2 -0
  120. package/themes/original/src/components/BusinessesListing/Layout/Appointment/index.tsx +561 -0
  121. package/themes/original/src/components/BusinessesListing/{styles.tsx → Layout/Appointment/styles.tsx} +24 -2
  122. package/themes/original/src/components/BusinessesListing/Layout/Original/index.tsx +673 -0
  123. package/themes/original/src/components/BusinessesListing/Layout/Original/styles.tsx +137 -0
  124. package/themes/original/src/components/BusinessesListing/index.tsx +102 -464
  125. package/themes/original/src/components/Cart/index.tsx +81 -36
  126. package/themes/original/src/components/Cart/styles.tsx +4 -0
  127. package/themes/original/src/components/CartContent/index.tsx +22 -16
  128. package/themes/original/src/components/Checkout/index.tsx +106 -66
  129. package/themes/original/src/components/Checkout/styles.tsx +0 -1
  130. package/themes/original/src/components/DriverTips/index.tsx +4 -4
  131. package/themes/original/src/components/DriverTips/styles.tsx +2 -1
  132. package/themes/original/src/components/Favorite/index.tsx +92 -0
  133. package/themes/original/src/components/Favorite/styles.tsx +22 -0
  134. package/themes/original/src/components/FavoriteList/index.tsx +317 -0
  135. package/themes/original/src/components/FavoriteList/styles.tsx +5 -0
  136. package/themes/original/src/components/GPSButton/index.tsx +25 -17
  137. package/themes/original/src/components/GoogleMap/index.tsx +20 -12
  138. package/themes/original/src/components/HelpAccountAndPayment/index.tsx +8 -3
  139. package/themes/original/src/components/HelpGuide/index.tsx +8 -3
  140. package/themes/original/src/components/HelpOrder/index.tsx +8 -3
  141. package/themes/original/src/components/HighestRatedBusinesses/index.tsx +18 -1
  142. package/themes/original/src/components/LoginForm/Otp/index.tsx +3 -2
  143. package/themes/original/src/components/LoginForm/index.tsx +83 -42
  144. package/themes/original/src/components/Messages/index.tsx +17 -17
  145. package/themes/original/src/components/MomentSelector/index.tsx +197 -0
  146. package/themes/original/src/components/MomentSelector/styles.tsx +6 -0
  147. package/themes/original/src/components/MultiCartsPaymethodsAndWallets/index.tsx +243 -0
  148. package/themes/original/src/components/MultiCartsPaymethodsAndWallets/styles.tsx +46 -0
  149. package/themes/original/src/components/MultiCheckout/index.tsx +304 -0
  150. package/themes/original/src/components/MultiCheckout/styles.tsx +59 -0
  151. package/themes/original/src/components/MultiOrdersDetails/SingleOrderCard.tsx +372 -0
  152. package/themes/original/src/components/MultiOrdersDetails/index.tsx +262 -0
  153. package/themes/original/src/components/MultiOrdersDetails/styles.tsx +50 -0
  154. package/themes/original/src/components/MyOrders/index.tsx +177 -27
  155. package/themes/original/src/components/MyOrders/styles.tsx +8 -1
  156. package/themes/original/src/components/NavBar/index.tsx +11 -5
  157. package/themes/original/src/components/NotFoundSource/index.tsx +2 -1
  158. package/themes/original/src/components/OrderDetails/OrderHistory.tsx +167 -0
  159. package/themes/original/src/components/OrderDetails/index.tsx +125 -40
  160. package/themes/original/src/components/OrderDetails/styles.tsx +5 -2
  161. package/themes/original/src/components/OrderItAgain/index.tsx +75 -0
  162. package/themes/original/src/components/OrderItAgain/styles.tsx +10 -0
  163. package/themes/original/src/components/OrderProgress/index.tsx +8 -2
  164. package/themes/original/src/components/OrderSummary/index.tsx +1 -34
  165. package/themes/original/src/components/OrderTypeSelector/index.tsx +84 -36
  166. package/themes/original/src/components/OrderTypeSelector/styles.tsx +19 -1
  167. package/themes/original/src/components/OrdersOption/PreviousBusinessOrdered/index.tsx +144 -0
  168. package/themes/original/src/components/OrdersOption/PreviousBusinessOrdered/styles.tsx +6 -0
  169. package/themes/original/src/components/OrdersOption/PreviousProductsOrdered/index.tsx +56 -0
  170. package/themes/original/src/components/OrdersOption/PreviousProductsOrdered/styles.tsx +6 -0
  171. package/themes/original/src/components/OrdersOption/index.tsx +130 -37
  172. package/themes/original/src/components/OrdersOption/styles.tsx +4 -1
  173. package/themes/original/src/components/PaymentOptions/index.tsx +57 -37
  174. package/themes/original/src/components/PhoneInputNumber/index.tsx +4 -10
  175. package/themes/original/src/components/PlaceSpot/index.tsx +243 -47
  176. package/themes/original/src/components/PlaceSpot/styles.tsx +0 -2
  177. package/themes/original/src/components/PreviousOrders/index.tsx +18 -147
  178. package/themes/original/src/components/ProductForm/index.tsx +698 -650
  179. package/themes/original/src/components/ProductForm/styles.tsx +9 -7
  180. package/themes/original/src/components/ProductItemAccordion/index.tsx +37 -24
  181. package/themes/original/src/components/ProductOption/index.tsx +1 -1
  182. package/themes/original/src/components/ProfessionalFilter/index.tsx +129 -0
  183. package/themes/original/src/components/ProfessionalFilter/styles.tsx +0 -0
  184. package/themes/original/src/components/ProfessionalProfile/index.tsx +309 -0
  185. package/themes/original/src/components/ProfessionalProfile/styles.tsx +46 -0
  186. package/themes/original/src/components/ReviewDriver/index.tsx +6 -6
  187. package/themes/original/src/components/ReviewOrder/index.tsx +18 -3
  188. package/themes/original/src/components/ReviewProducts/index.tsx +1 -1
  189. package/themes/original/src/components/ReviewTrigger/index.tsx +118 -0
  190. package/themes/original/src/components/ReviewTrigger/styles.tsx +34 -0
  191. package/themes/original/src/components/SearchBar/index.tsx +10 -5
  192. package/themes/original/src/components/ServiceForm/index.tsx +608 -0
  193. package/themes/original/src/components/ServiceForm/styles.tsx +50 -0
  194. package/themes/original/src/components/SignupForm/index.tsx +305 -158
  195. package/themes/original/src/components/SingleOrderCard/index.tsx +316 -0
  196. package/themes/original/src/components/SingleOrderCard/styles.tsx +54 -0
  197. package/themes/original/src/components/SingleProductCard/index.tsx +215 -95
  198. package/themes/original/src/components/SingleProductCard/styles.tsx +2 -2
  199. package/themes/original/src/components/SingleProductReview/index.tsx +30 -3
  200. package/themes/original/src/components/SingleProductReview/styles.tsx +12 -0
  201. package/themes/original/src/components/StripeElementsForm/index.tsx +25 -9
  202. package/themes/original/src/components/StripeElementsForm/naked.tsx +2 -2
  203. package/themes/original/src/components/UpsellingProducts/index.tsx +14 -4
  204. package/themes/original/src/components/UserDetails/index.tsx +32 -18
  205. package/themes/original/src/components/UserFormDetails/index.tsx +107 -73
  206. package/themes/original/src/components/UserProfile/index.tsx +12 -1
  207. package/themes/original/src/components/UserProfileForm/index.tsx +15 -10
  208. package/themes/original/src/components/WalletTransactions/index.tsx +76 -0
  209. package/themes/original/src/components/WalletTransactions/styles.tsx +13 -0
  210. package/themes/original/src/components/Wallets/index.tsx +176 -162
  211. package/themes/original/src/components/Wallets/styles.tsx +10 -8
  212. package/themes/original/src/components/shared/OBottomPopup.tsx +47 -14
  213. package/themes/original/src/components/shared/OButton.tsx +10 -3
  214. package/themes/original/src/components/shared/OInput.tsx +3 -2
  215. package/themes/original/src/components/shared/OModal.tsx +3 -1
  216. package/themes/original/src/layouts/FloatingBottomContainer.tsx +5 -1
  217. package/themes/original/src/types/index.tsx +200 -46
  218. package/themes/original/src/utils/index.tsx +77 -0
  219. package/themes/uber-eats/src/components/BusinessesListing/index.tsx +1 -1
@@ -0,0 +1,144 @@
1
+ import React from 'react'
2
+ import { useOrder } from 'ordering-components/native'
3
+ import { BusinessController } from '../../BusinessController'
4
+ import { Fade, Placeholder, PlaceholderLine } from 'rn-placeholder';
5
+
6
+ import { ListWrapper } from './styles'
7
+ import {
8
+ View,
9
+ StyleSheet,
10
+ ScrollView,
11
+ Dimensions
12
+ } from 'react-native';
13
+ import { PreviousBusinessOrderedParams } from '../../../types';
14
+
15
+ const BusinessControllerList = ({ businesses, onBusinessClick, navigation, orderState, handleCustomUpdate, style }: any) => {
16
+ return (
17
+ <>
18
+ {businesses?.result?.map((business: any, i: number) => (
19
+ <BusinessController
20
+ key={`${business.id}_` + i}
21
+ business={business}
22
+ isBusinessOpen={business.open}
23
+ handleCustomClick={() => onBusinessClick(business)}
24
+ orderType={orderState?.options?.type}
25
+ navigation={navigation}
26
+ businessHeader={business?.header}
27
+ businessFeatured={business?.featured}
28
+ businessLogo={business?.logo}
29
+ businessReviews={business?.reviews}
30
+ businessDeliveryPrice={business?.delivery_price}
31
+ businessDeliveryTime={business?.delivery_time}
32
+ businessPickupTime={business?.pickup_time}
33
+ businessDistance={business?.distance}
34
+ handleCustomUpdate={handleCustomUpdate}
35
+ style={style}
36
+ />
37
+ ))}
38
+ </>
39
+ )
40
+ }
41
+
42
+ const BusinessSkeletons = () => {
43
+ return (
44
+ <>
45
+ {[...Array(4).keys()].map((item, i) => (
46
+ <Placeholder
47
+ Animation={Fade}
48
+ key={i}
49
+ style={{ marginBottom: 20 }}>
50
+ <View style={{ width: '100%' }}>
51
+ <PlaceholderLine
52
+ height={200}
53
+ style={{ marginBottom: 20, borderRadius: 25 }}
54
+ />
55
+ <View style={{ paddingHorizontal: 10 }}>
56
+ <View
57
+ style={{
58
+ flexDirection: 'row',
59
+ justifyContent: 'space-between',
60
+ }}>
61
+ <PlaceholderLine
62
+ height={25}
63
+ width={40}
64
+ style={{ marginBottom: 10 }}
65
+ />
66
+ <PlaceholderLine
67
+ height={25}
68
+ width={20}
69
+ style={{ marginBottom: 10 }}
70
+ />
71
+ </View>
72
+ <PlaceholderLine
73
+ height={20}
74
+ width={30}
75
+ style={{ marginBottom: 10 }}
76
+ />
77
+ <PlaceholderLine
78
+ height={20}
79
+ width={80}
80
+ style={{ marginBottom: 10 }}
81
+ />
82
+ </View>
83
+ </View>
84
+ </Placeholder>
85
+ ))}
86
+ </>
87
+ )
88
+ }
89
+
90
+ export const PreviousBusinessOrdered = (props: PreviousBusinessOrderedParams) => {
91
+ const {
92
+ navigation,
93
+ businesses,
94
+ onNavigationRedirect,
95
+ isBusinessesSearchList,
96
+ handleUpdateBusinesses,
97
+ } = props
98
+
99
+ const [orderState] = useOrder()
100
+ const windowWidth = Dimensions.get('window').width;
101
+ const onBusinessClick = (business: any) => {
102
+ onNavigationRedirect('Business', { store: business.slug, logo: business.logo, header: business.header })
103
+ }
104
+
105
+ const styles = StyleSheet.create({
106
+ container: {
107
+ marginBottom: 0,
108
+ },
109
+ });
110
+
111
+ return (
112
+ <ScrollView horizontal={isBusinessesSearchList} style={styles.container} showsVerticalScrollIndicator={false}>
113
+ {isBusinessesSearchList ? (
114
+ <>
115
+ {!businesses?.loading && (
116
+ <BusinessControllerList
117
+ style={{ width: windowWidth - 120, marginRight: 20 }}
118
+ onBusinessClick={onBusinessClick}
119
+ orderState={orderState}
120
+ navigation={navigation}
121
+ businesses={businesses}
122
+ handleCustomUpdate={handleUpdateBusinesses}
123
+ />
124
+ )}
125
+ </>
126
+ ) : (
127
+ <ListWrapper>
128
+ {businesses?.loading ? (
129
+ <BusinessSkeletons />
130
+ ) : (
131
+ <BusinessControllerList
132
+ onBusinessClick={onBusinessClick}
133
+ orderState={orderState}
134
+ navigation={navigation}
135
+ businesses={businesses}
136
+ handleCustomUpdate={handleUpdateBusinesses}
137
+ />
138
+ )}
139
+ </ListWrapper>
140
+ )}
141
+
142
+ </ScrollView>
143
+ )
144
+ }
@@ -0,0 +1,6 @@
1
+ import styled, { css } from 'styled-components/native'
2
+
3
+ export const ListWrapper = styled.View`
4
+ background-color: ${(props: any) => props.theme.colors.backgroundLight};
5
+ padding-horizontal: ${(props : any) => props.isBusinessesSearchList ? '0' : '40px'};
6
+ `;
@@ -0,0 +1,56 @@
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
+ handleUpdateProducts,
15
+ isBusinessesSearchList
16
+ } = props
17
+
18
+ const windowWidth = Dimensions.get('window').width;
19
+
20
+ const styles = StyleSheet.create({
21
+ container: {
22
+ marginBottom: 0,
23
+ },
24
+ });
25
+
26
+ const ProductList = ({ style }: any) => {
27
+ return (
28
+ <>
29
+ {products?.map((product: any) => (
30
+ <SingleProductCard
31
+ key={product?.id}
32
+ isProductId
33
+ isSoldOut={(product.inventoried && !product.quantity)}
34
+ product={product}
35
+ businessId={product?.business?.id}
36
+ onProductClick={onProductClick}
37
+ style={style}
38
+ productAddedToCartLength={0}
39
+ handleUpdateProducts={handleUpdateProducts}
40
+ />
41
+ ))}
42
+ </>
43
+ )
44
+ }
45
+ return (
46
+ <ScrollView horizontal={isBusinessesSearchList} style={styles.container} showsVerticalScrollIndicator={false}>
47
+ {isBusinessesSearchList ? (
48
+ <ProductList style={{ width: windowWidth - 80, marginRight: 20 }} />
49
+ ) : (
50
+ <ListWrapper isBusinessesSearchList={isBusinessesSearchList}>
51
+ <ProductList />
52
+ </ListWrapper>
53
+ )}
54
+ </ScrollView>
55
+ )
56
+ }
@@ -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
+ `;
@@ -6,7 +6,8 @@ import { OText, OButton } 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';
@@ -37,15 +38,28 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
37
38
  refreshOrders,
38
39
  setRefreshOrders,
39
40
  reorderState,
40
- handleReorder
41
+ handleReorder,
42
+ handleUpdateOrderList,
43
+ isBusiness,
44
+ isProducts,
45
+ businessOrderIds,
46
+ products,
47
+ businessesSearchList,
48
+ hideOrders,
49
+ BusinessControllerSkeletons,
50
+ businesses,
51
+ businessPaginationProps,
52
+ handleUpdateProducts,
53
+ handleUpdateBusinesses
41
54
  } = props
42
55
 
43
56
  const theme = useTheme();
44
57
 
45
58
  const [, t] = useLanguage()
46
59
  const [{ carts }] = useOrder()
47
- const { showToast } = useToast()
60
+ const [, { showToast }] = useToast()
48
61
  const { loading, error, orders: values } = orderList
62
+ const [businessLoading, setBusinessLoading] = useState(true)
49
63
 
50
64
  const imageFails = activeOrders
51
65
  ? theme.images.general.emptyActiveOrders
@@ -87,32 +101,53 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
87
101
  return objectStatus && objectStatus
88
102
  }
89
103
 
104
+ const onProductClick = (product: any) => {
105
+ if (product?.product_id && product?.category_id && product?.businessId &&
106
+ product?.business.slug && product?.business.header && product?.business.logo) {
107
+ onNavigationRedirect('ProductDetails', {
108
+ isRedirect: 'business',
109
+ businessId: product?.businessId,
110
+ categoryId: product?.category_id,
111
+ productId: product?.product_id,
112
+ business: {
113
+ store: product?.business.slug,
114
+ header: product?.business.header,
115
+ logo: product?.business.logo,
116
+ }
117
+ })
118
+ } else {
119
+ showToast(ToastType.Error, t('ERROR_FAILED_REDIRECT_IDS', 'Failed to redirect product for ids'))
120
+ }
121
+ }
122
+
90
123
  useEffect(() => {
91
124
  const _businessId = 'businessId:' + reorderState?.result?.business_id
92
125
  if (reorderState?.error) {
93
- if (reorderState?.result?.business_id) {
94
- _setStoreData('adjust-cart-products', JSON.stringify(_businessId))
95
- navigation.navigate('Business', { store: reorderState?.result?.business?.slug })
96
- }
126
+ if (reorderState?.result?.business_id) {
127
+ _setStoreData('adjust-cart-products', JSON.stringify(_businessId))
128
+ navigation.navigate('Business', { store: reorderState?.result?.business?.slug })
129
+ }
97
130
  }
98
131
  if (!reorderState?.error && reorderState.loading === false && reorderState?.result?.business_id) {
99
- const cartProducts = carts?.[_businessId]?.products
100
- const available = cartProducts.every((product: any) => product.valid === true)
101
- const orderProducts = orders.find((order: any) => order?.id === reorderState?.result?.orderId)?.products
132
+ const cartProducts = carts?.[_businessId]?.products
133
+ const available = cartProducts.every((product: any) => product.valid === true)
134
+ const orderProducts = orders.find((order: any) => order?.id === reorderState?.result?.orderId)?.products
102
135
 
103
- if (available && reorderState?.result?.uuid && (cartProducts?.length === orderProducts?.length)) {
104
- onNavigationRedirect && onNavigationRedirect('CheckoutNavigator', { cartUuid: reorderState?.result.uuid })
105
- } else {
106
- _setStoreData('adjust-cart-products', JSON.stringify(_businessId))
107
- cartProducts?.length !== orderProducts?.length && _setStoreData('already-removed', JSON.stringify('removed'))
108
- navigation.navigate('Business', { store: reorderState?.result?.business?.slug })
109
- }
136
+ if (available && reorderState?.result?.uuid && (cartProducts?.length === orderProducts?.length)) {
137
+ onNavigationRedirect && onNavigationRedirect('CheckoutNavigator', { cartUuid: reorderState?.result.uuid })
138
+ } else {
139
+ _setStoreData('adjust-cart-products', JSON.stringify(_businessId))
140
+ cartProducts?.length !== orderProducts?.length && _setStoreData('already-removed', JSON.stringify('removed'))
141
+ navigation.navigate('Business', { store: reorderState?.result?.business?.slug })
142
+ }
110
143
  }
111
- }, [reorderState])
144
+ }, [reorderState])
112
145
 
113
146
  useFocusEffect(
114
147
  React.useCallback(() => {
115
- loadOrders(false, false, false, true)
148
+ if (!businessesSearchList) {
149
+ loadOrders(false, false, false, true)
150
+ }
116
151
  }, [navigation])
117
152
  )
118
153
 
@@ -133,10 +168,10 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
133
168
  } else if (!preOrders) {
134
169
  setOrdersLength && setOrdersLength({ ...ordersLength, previousOrdersLength: updateOrders?.length })
135
170
  }
136
- }, [orders, activeOrders])
171
+ }, [orders, activeOrders, preOrders])
137
172
 
138
173
  useEffect(() => {
139
- if(refreshOrders){
174
+ if (refreshOrders) {
140
175
  loadOrders(false, false, false, true)
141
176
  setRefreshOrders && setRefreshOrders(false)
142
177
  }
@@ -158,18 +193,21 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
158
193
 
159
194
  </NoOrdersWrapper>
160
195
  )}
161
- {(ordersLength.activeOrdersLength > 0 || ordersLength.previousOrdersLength > 0) && (
196
+ {(ordersLength?.activeOrdersLength > 0 || ordersLength?.previousOrdersLength > 0) && (
162
197
  <>
163
- <OptionTitle>
164
- <OText size={16} lineHeight={24} weight={'500'} color={theme.colors.textNormal} mBottom={10} >
165
- {titleContent || (activeOrders
166
- ? t('ACTIVE', 'Active')
167
- : preOrders
168
- ? t('PREORDERS', 'Preorders')
169
- : t('PAST', 'Past'))}
170
- </OText>
171
- </OptionTitle>
172
- {!(ordersLength.activeOrdersLength === 0 && ordersLength.previousOrdersLength === 0) &&
198
+ {((titleContent && ((isBusiness && businessOrderIds?.length > 0) || isProducts)) || !titleContent) && (
199
+ <OptionTitle titleContent={!!titleContent} isBusinessesSearchList={!!businessesSearchList}>
200
+ <OText size={16} lineHeight={24} weight={'500'} color={theme.colors.textNormal} mBottom={10} >
201
+ {titleContent || (activeOrders
202
+ ? t('ACTIVE', 'Active')
203
+ : preOrders
204
+ ? t('PREORDERS', 'Preorders')
205
+ : t('PAST', 'Past'))}
206
+ </OText>
207
+ </OptionTitle>
208
+ )}
209
+
210
+ {!(ordersLength?.activeOrdersLength === 0 && ordersLength?.previousOrdersLength === 0) &&
173
211
  !loading &&
174
212
  orders.filter((order: any) => orderStatus.includes(order.status)).length === 0 &&
175
213
  (
@@ -181,7 +219,50 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
181
219
  )}
182
220
  </>
183
221
  )}
184
- {loading && (
222
+ {isBusiness && !!businessesSearchList && businesses?.loading && (
223
+ <ScrollView horizontal>
224
+ <BusinessControllerSkeletons paginationProps={businessPaginationProps} />
225
+ </ScrollView>
226
+ )}
227
+ {isBusiness && (
228
+ <PreviousBusinessOrdered
229
+ onNavigationRedirect={onNavigationRedirect}
230
+ isBusinessesSearchList={!!businessesSearchList}
231
+ businesses={businesses}
232
+ handleUpdateBusinesses={handleUpdateBusinesses}
233
+ />
234
+ )}
235
+
236
+ {isProducts && !loading && (
237
+ <PreviousProductsOrdered
238
+ products={products}
239
+ onProductClick={onProductClick}
240
+ handleUpdateProducts={handleUpdateProducts}
241
+ isBusinessesSearchList={!!businessesSearchList}
242
+ />
243
+ )}
244
+ {(loading && isProducts) && (
245
+ <>
246
+ {[...Array(!!businessesSearchList ? 1 : 4).keys()].map(
247
+ (item, i) => (
248
+ <Placeholder key={i} style={{ padding: 5, paddingLeft: !!businessesSearchList ? 0 : 40, marginBottom: !!businessesSearchList ? 38 : 0 }} Animation={Fade}>
249
+ <View style={{ flexDirection: 'row' }}>
250
+ <PlaceholderLine
251
+ width={24}
252
+ height={70}
253
+ style={{ marginRight: 10, marginBottom: 10 }}
254
+ />
255
+ <Placeholder style={{ paddingVertical: 10 }}>
256
+ <PlaceholderLine width={60} style={{ marginBottom: 25 }} />
257
+ <PlaceholderLine width={20} />
258
+ </Placeholder>
259
+ </View>
260
+ </Placeholder>
261
+ ),
262
+ )}
263
+ </>
264
+ )}
265
+ {loading && !hideOrders && (
185
266
  <>
186
267
  {!activeOrders ? (
187
268
  <Placeholder style={{ marginTop: 30 }} Animation={Fade}>
@@ -212,7 +293,7 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
212
293
  )}
213
294
  </>
214
295
  )}
215
- {!loading && !error && orders.length > 0 && (
296
+ {!loading && !error && orders.length > 0 && !hideOrders && (
216
297
  preOrders ? (
217
298
  <ActiveOrders
218
299
  orders={orders.filter((order: any) => orderStatus.includes(order.status))}
@@ -222,6 +303,7 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
222
303
  customArray={customArray}
223
304
  getOrderStatus={getOrderStatus}
224
305
  onNavigationRedirect={onNavigationRedirect}
306
+ handleUpdateOrderList={handleUpdateOrderList}
225
307
  />
226
308
  ) : activeOrders ? (
227
309
  <ActiveOrders
@@ -231,6 +313,7 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
231
313
  customArray={customArray}
232
314
  getOrderStatus={getOrderStatus}
233
315
  onNavigationRedirect={onNavigationRedirect}
316
+ handleUpdateOrderList={handleUpdateOrderList}
234
317
  />
235
318
  ) : (
236
319
  <PreviousOrders
@@ -241,6 +324,7 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
241
324
  getOrderStatus={getOrderStatus}
242
325
  onNavigationRedirect={onNavigationRedirect}
243
326
  handleReorder={handleReorder}
327
+ handleUpdateOrderList={handleUpdateOrderList}
244
328
  />
245
329
  )
246
330
  )}
@@ -249,13 +333,22 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
249
333
  }
250
334
 
251
335
  export const OrdersOption = (props: OrdersOptionParams) => {
336
+ const getAllOrders = props.activeOrders && props.pastOrders && props.preOrders
337
+
252
338
  const MyOrdersProps = {
253
339
  ...props,
254
340
  UIComponent: OrdersOptionUI,
255
- orderStatus: props.preOrders ? [13] : props.activeOrders
256
- ? [0, 3, 4, 7, 8, 9, 14, 18, 19, 20, 21, 22, 23]
257
- : [1, 2, 5, 6, 10, 11, 12, 15, 16, 17],
341
+ orderStatus: getAllOrders
342
+ ? [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23]
343
+ : props.preOrders ? [13] : props.activeOrders
344
+ ? [0, 3, 4, 7, 8, 9, 14, 18, 19, 20, 21, 22, 23]
345
+ : [1, 2, 5, 6, 10, 11, 12, 15, 16, 17],
258
346
  useDefualtSessionManager: true,
347
+ paginationSettings: {
348
+ initialPage: 1,
349
+ pageSize: getAllOrders ? 30 : 10,
350
+ controlType: 'infinity'
351
+ }
259
352
  }
260
353
 
261
354
  return <OrderList {...MyOrdersProps} />
@@ -1,7 +1,10 @@
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
+ ${(props : any) => props.titleContent && css`
6
+ margin-left: ${() => props.isBusinessesSearchList ? '0' : '40px'};
7
+ `}
5
8
  `
6
9
 
7
10
  export const NoOrdersWrapper = styled.View`
@@ -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) {
@@ -80,6 +82,8 @@ const PaymentOptionsUI = (props: any) => {
80
82
  return theme.images.general.stripes
81
83
  case 'stripe_redirect':
82
84
  return theme.images.general.stripesb
85
+ case 'apple_pay':
86
+ return theme.images.general.applePayMark
83
87
  default:
84
88
  return theme.images.general.creditCard
85
89
  }
@@ -98,18 +102,18 @@ const PaymentOptionsUI = (props: any) => {
98
102
  // ]
99
103
 
100
104
  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(
105
+ if (cart?.balance > 0) {
106
+ const isPopupMethod = ['stripe', 'stripe_direct', 'stripe_connect', 'stripe_redirect', 'paypal'].includes(paymethod?.gateway)
107
+ if (webViewPaymentGateway.includes(paymethod?.gateway)) {
108
+ handlePaymentMethodClickCustom(paymethod)
109
+ }
110
+ handlePaymethodClick(paymethod, isPopupMethod)
111
+ return
112
+ }
113
+ showToast(
110
114
  ToastType.Error,
111
115
  t('CART_BALANCE_ZERO', 'Sorry, the amount to pay is equal to zero and it is not necessary to select a payment method'))
112
- ;
116
+ ;
113
117
  }
114
118
 
115
119
  useEffect(() => {
@@ -134,39 +138,55 @@ const PaymentOptionsUI = (props: any) => {
134
138
 
135
139
  useEffect(() => {
136
140
  if (methodsPay.includes(paymethodSelected?.gateway) && paymethodData?.id && paymethodSelected?.data?.card) {
137
- handlePlaceOrder()
141
+ handlePlaceOrder(confirmApplePayPayment)
138
142
  }
139
143
  }, [paymethodData, paymethodSelected])
140
144
 
141
145
  const renderPaymethods = ({ item }: any) => {
142
146
  return (
143
- <TouchableOpacity
144
- onPress={() => handlePaymentMethodClick(item)}
145
- >
146
- <PMItem
147
- key={item.id}
148
- isDisabled={isDisabled}
149
- isActive={paymethodSelected?.id === item.id}
150
- >
151
- <OIcon
152
- src={getPayIcon(item.gateway)}
153
- width={20}
154
- height={20}
155
- color={paymethodSelected?.id === item.id ? theme.colors.white : theme.colors.backgroundDark}
156
- />
157
- <OText
158
- size={10}
159
- style={{ margin: 0, marginTop: 4 }}
160
- color={paymethodSelected?.id === item.id ? theme.colors.white : '#000'}
147
+ <>
148
+ {item?.gateway === 'apple_pay' ? (
149
+ <TouchableOpacity
150
+ onPress={() => handlePaymentMethodClick(item)}
161
151
  >
162
- {t(item.gateway.toUpperCase(), item.name)}
163
- </OText>
164
- </PMItem>
165
- </TouchableOpacity>
152
+ <OIcon
153
+ src={getPayIcon(item.gateway)}
154
+ width={70}
155
+ height={70}
156
+ style={{ marginRight: 10 }}
157
+ />
158
+ </TouchableOpacity>
159
+ ) : (
160
+ <TouchableOpacity
161
+ onPress={() => handlePaymentMethodClick(item)}
162
+ >
163
+ <PMItem
164
+ key={item.id}
165
+ isDisabled={isDisabled}
166
+ isActive={paymethodSelected?.id === item.id}
167
+ >
168
+ <OIcon
169
+ src={getPayIcon(item.gateway)}
170
+ width={20}
171
+ height={20}
172
+ color={item?.gateway === 'apple_pay' ? '' : paymethodSelected?.id === item.id ? theme.colors.white : theme.colors.backgroundDark}
173
+ />
174
+ <OText
175
+ size={10}
176
+ style={{ margin: 0, marginTop: 4 }}
177
+ color={paymethodSelected?.id === item.id ? theme.colors.white : '#000'}
178
+ >
179
+ {t(item.gateway.toUpperCase(), item.name)}
180
+ </OText>
181
+ </PMItem>
182
+ </TouchableOpacity>
183
+ )}
184
+ </>
185
+
166
186
  )
167
187
  }
168
188
 
169
- const excludeIds: any = [32]; //exclude paypal & connect & redirect
189
+ const excludeIds: any = [32, 66]; //exclude paypal & connect & redirect
170
190
 
171
191
  return (
172
192
  <PMContainer>
@@ -214,7 +234,7 @@ const PaymentOptionsUI = (props: any) => {
214
234
 
215
235
  {paymethodSelected?.gateway === 'cash' && (
216
236
  <PaymentOptionCash
217
- orderTotal={cart.total}
237
+ orderTotal={cart.balance ?? cart.total}
218
238
  defaultValue={paymethodSelected?.data?.cash}
219
239
  onChangeData={handlePaymethodDataChange}
220
240
  setErrorCash={props.setErrorCash}
@@ -22,9 +22,8 @@ export const PhoneInputNumber = (props: PhoneInputParams) => {
22
22
  textStyle,
23
23
  flagStyle,
24
24
  noDropIcon,
25
- isDisabled,
26
- isStartValidation,
27
- changeCountry
25
+ isDisabled,
26
+ isStartValidation
28
27
  } = props
29
28
 
30
29
  const theme = useTheme();
@@ -107,16 +106,11 @@ export const PhoneInputNumber = (props: PhoneInputParams) => {
107
106
  )}
108
107
  <PhoneInput
109
108
  ref={phoneInput}
110
- disabled={isDisabled}
109
+ disabled={isDisabled}
111
110
  defaultValue={userphoneNumber || defaultValue}
112
- defaultCode={defaultCode ?
113
- !isNaN(defaultCode)
114
- ? transformCountryCode(defaultCode)
115
- : defaultCode
116
- : configs?.default_country_code?.value}
111
+ defaultCode={defaultCode ? transformCountryCode(defaultCode) : configs?.default_country_code?.value}
117
112
  onChangeFormattedText={(text: string) => handleChangeNumber(text)}
118
113
  withDarkTheme
119
- onChangeCountry={(country) => changeCountry?.(country)}
120
114
  countryPickerProps={{ withAlphaFilter: true }}
121
115
  textContainerStyle={{ ...style.input, ...inputStyle ? inputStyle : {} }}
122
116
  textInputStyle={textStyle}