ordering-ui-react-native 0.15.59 → 0.15.60-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 (207) 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/BusinessInformation/index.tsx +14 -0
  6. package/src/components/BusinessTypeFilter/index.tsx +1 -2
  7. package/src/components/BusinessesListing/index.tsx +1 -1
  8. package/src/components/Checkout/index.tsx +23 -2
  9. package/src/components/DriverTips/index.tsx +11 -6
  10. package/src/components/LanguageSelector/index.tsx +7 -2
  11. package/src/components/LoginForm/index.tsx +120 -30
  12. package/src/components/LoginForm/styles.tsx +6 -0
  13. package/src/components/OrderDetails/index.tsx +7 -21
  14. package/src/components/PaymentOptions/index.tsx +67 -50
  15. package/src/components/PaymentOptionsWebView/index.tsx +120 -121
  16. package/src/components/ReviewDriver/index.tsx +1 -1
  17. package/src/components/ReviewOrder/index.tsx +2 -1
  18. package/src/components/ReviewProducts/index.tsx +11 -0
  19. package/src/components/SignupForm/index.tsx +145 -61
  20. package/src/components/SingleProductCard/index.tsx +16 -4
  21. package/src/components/SingleProductReview/index.tsx +1 -1
  22. package/src/components/StripeMethodForm/index.tsx +1 -2
  23. package/src/components/UpsellingProducts/index.tsx +1 -1
  24. package/src/components/UserProfileForm/index.tsx +63 -6
  25. package/src/components/UserProfileForm/styles.tsx +8 -0
  26. package/src/components/VerifyPhone/styles.tsx +1 -2
  27. package/src/components/shared/OModal.tsx +1 -1
  28. package/src/hooks/useCountdownTimer.tsx +26 -0
  29. package/src/navigators/CheckoutNavigator.tsx +6 -0
  30. package/src/navigators/HomeNavigator.tsx +12 -0
  31. package/src/pages/BusinessesListing.tsx +7 -6
  32. package/src/pages/MultiCheckout.tsx +31 -0
  33. package/src/pages/MultiOrdersDetails.tsx +27 -0
  34. package/src/pages/OrderDetails.tsx +1 -1
  35. package/src/pages/ReviewDriver.tsx +2 -2
  36. package/src/pages/ReviewOrder.tsx +2 -2
  37. package/src/pages/Sessions.tsx +22 -0
  38. package/src/theme.json +0 -1
  39. package/src/types/index.tsx +18 -11
  40. package/src/utils/index.tsx +68 -1
  41. package/themes/business/src/components/AcceptOrRejectOrder/index.tsx +103 -15
  42. package/themes/business/src/components/AcceptOrRejectOrder/styles.tsx +6 -0
  43. package/themes/business/src/components/Chat/index.tsx +42 -90
  44. package/themes/business/src/components/DriverMap/index.tsx +6 -5
  45. package/themes/business/src/components/LoginForm/index.tsx +89 -2
  46. package/themes/business/src/components/LoginForm/styles.tsx +6 -0
  47. package/themes/business/src/components/LogoutButton/index.tsx +1 -1
  48. package/themes/business/src/components/NewOrderNotification/index.tsx +26 -13
  49. package/themes/business/src/components/OrderDetails/Business.tsx +2 -2
  50. package/themes/business/src/components/OrderDetails/Delivery.tsx +28 -11
  51. package/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +14 -7
  52. package/themes/business/src/components/OrderDetails/OrderHeaderComponent.tsx +6 -0
  53. package/themes/business/src/components/OrdersListManager/index.tsx +1 -1
  54. package/themes/business/src/components/OrdersOption/index.tsx +5 -2
  55. package/themes/business/src/components/PreviousOrders/index.tsx +7 -7
  56. package/themes/business/src/components/ProductItemAccordion/index.tsx +2 -2
  57. package/themes/business/src/components/UserFormDetails/index.tsx +5 -2
  58. package/themes/business/src/components/UserProfileForm/index.tsx +2 -0
  59. package/themes/business/src/components/shared/OModal.tsx +1 -1
  60. package/themes/business/src/types/index.tsx +6 -1
  61. package/themes/doordash/src/components/BusinessesListing/index.tsx +1 -1
  62. package/themes/doordash/src/components/LoginForm/index.tsx +1 -2
  63. package/themes/instacart/src/components/BusinessesListing/index.tsx +1 -1
  64. package/themes/kiosk/src/components/BusinessMenu/index.tsx +39 -28
  65. package/themes/kiosk/src/components/BusinessesListing/index.tsx +2 -3
  66. package/themes/kiosk/src/components/Cart/index.tsx +11 -12
  67. package/themes/kiosk/src/components/CartBottomSheet/index.tsx +9 -2
  68. package/themes/kiosk/src/components/CartContent/index.tsx +0 -11
  69. package/themes/kiosk/src/components/CartItem/index.tsx +4 -3
  70. package/themes/kiosk/src/components/CategoriesMenu/index.tsx +107 -62
  71. package/themes/kiosk/src/components/Checkout/index.tsx +40 -22
  72. package/themes/kiosk/src/components/CustomerName/index.tsx +0 -6
  73. package/themes/kiosk/src/components/DrawerView/index.tsx +1 -0
  74. package/themes/kiosk/src/components/DrawerView/styles.tsx +2 -2
  75. package/themes/kiosk/src/components/NavBar/index.tsx +29 -20
  76. package/themes/kiosk/src/components/OptionCard/index.tsx +1 -1
  77. package/themes/kiosk/src/components/OrderDetails/index.tsx +32 -27
  78. package/themes/kiosk/src/components/OrderTypeCardSelector/index.tsx +9 -11
  79. package/themes/kiosk/src/components/PaymentOptions/index.tsx +56 -54
  80. package/themes/kiosk/src/components/ProductForm/index.tsx +7 -8
  81. package/themes/kiosk/src/components/ProductItemAccordion/index.tsx +2 -2
  82. package/themes/kiosk/src/components/ProductOption/index.tsx +1 -1
  83. package/themes/kiosk/src/components/ProductOptionSubOption/index.tsx +3 -1
  84. package/themes/kiosk/src/components/UpsellingProducts/index.tsx +16 -5
  85. package/themes/kiosk/src/components/shared/OButton.tsx +5 -18
  86. package/themes/kiosk/src/types/index.d.ts +1 -0
  87. package/themes/original/index.tsx +30 -8
  88. package/themes/original/src/components/ActiveOrders/index.tsx +15 -132
  89. package/themes/original/src/components/ActiveOrders/styles.tsx +0 -54
  90. package/themes/original/src/components/AddressForm/index.tsx +7 -6
  91. package/themes/original/src/components/AddressList/index.tsx +30 -18
  92. package/themes/original/src/components/AppleLogin/index.tsx +9 -13
  93. package/themes/original/src/components/BusinessBasicInformation/index.tsx +137 -46
  94. package/themes/original/src/components/BusinessBasicInformation/styles.tsx +4 -0
  95. package/themes/original/src/components/BusinessController/index.tsx +29 -11
  96. package/themes/original/src/components/BusinessController/styles.tsx +5 -0
  97. package/themes/original/src/components/BusinessItemAccordion/index.tsx +8 -5
  98. package/themes/original/src/components/BusinessItemAccordion/styles.tsx +3 -1
  99. package/themes/original/src/components/BusinessListingSearch/index.tsx +205 -61
  100. package/themes/original/src/components/BusinessListingSearch/styles.tsx +22 -2
  101. package/themes/original/src/components/BusinessPreorder/index.tsx +1 -1
  102. package/themes/original/src/components/BusinessProductsCategories/index.tsx +2 -2
  103. package/themes/original/src/components/BusinessProductsList/CategoryDescription/index.tsx +44 -0
  104. package/themes/original/src/components/BusinessProductsList/index.tsx +51 -53
  105. package/themes/original/src/components/BusinessProductsList/styles.tsx +0 -3
  106. package/themes/original/src/components/BusinessProductsListing/index.tsx +301 -170
  107. package/themes/original/src/components/BusinessProductsListing/styles.tsx +27 -0
  108. package/themes/original/src/components/BusinessReviews/index.tsx +6 -1
  109. package/themes/original/src/components/BusinessTypeFilter/index.tsx +106 -39
  110. package/themes/original/src/components/BusinessTypeFilter/styles.tsx +2 -0
  111. package/themes/original/src/components/BusinessesListing/Layout/Appointment/index.tsx +557 -0
  112. package/themes/original/src/components/BusinessesListing/Layout/Appointment/styles.tsx +107 -0
  113. package/themes/original/src/components/BusinessesListing/Layout/Original/index.tsx +519 -0
  114. package/themes/original/src/components/BusinessesListing/{styles.tsx → Layout/Original/styles.tsx} +11 -3
  115. package/themes/original/src/components/BusinessesListing/index.tsx +97 -457
  116. package/themes/original/src/components/Cart/index.tsx +61 -42
  117. package/themes/original/src/components/Checkout/index.tsx +88 -38
  118. package/themes/original/src/components/DriverTips/index.tsx +17 -12
  119. package/themes/original/src/components/Favorite/index.tsx +92 -0
  120. package/themes/original/src/components/Favorite/styles.tsx +22 -0
  121. package/themes/original/src/components/FavoriteList/index.tsx +298 -0
  122. package/themes/original/src/components/FavoriteList/styles.tsx +5 -0
  123. package/themes/original/src/components/ForgotPasswordForm/index.tsx +84 -4
  124. package/themes/original/src/components/GPSButton/index.tsx +15 -8
  125. package/themes/original/src/components/GoogleMap/index.tsx +11 -11
  126. package/themes/original/src/components/Help/index.tsx +21 -4
  127. package/themes/original/src/components/HighestRatedBusinesses/index.tsx +18 -1
  128. package/themes/original/src/components/LastOrders/index.tsx +12 -1
  129. package/themes/original/src/components/LoginForm/Otp/index.tsx +91 -0
  130. package/themes/original/src/components/LoginForm/Otp/styles.tsx +7 -0
  131. package/themes/original/src/components/LoginForm/index.tsx +332 -164
  132. package/themes/original/src/components/LoginForm/styles.tsx +1 -3
  133. package/themes/original/src/components/MessageListing/index.tsx +10 -1
  134. package/themes/original/src/components/Messages/index.tsx +1 -1
  135. package/themes/original/src/components/MomentOption/index.tsx +10 -1
  136. package/themes/original/src/components/MomentOption/styles.tsx +1 -1
  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 +243 -0
  140. package/themes/original/src/components/MultiCartsPaymethodsAndWallets/styles.tsx +46 -0
  141. package/themes/original/src/components/MultiCheckout/index.tsx +298 -0
  142. package/themes/original/src/components/MultiCheckout/styles.tsx +59 -0
  143. package/themes/original/src/components/MultiOrdersDetails/SingleOrderCard.tsx +372 -0
  144. package/themes/original/src/components/MultiOrdersDetails/index.tsx +258 -0
  145. package/themes/original/src/components/MultiOrdersDetails/styles.tsx +50 -0
  146. package/themes/original/src/components/MyOrders/index.tsx +120 -32
  147. package/themes/original/src/components/MyOrders/styles.tsx +8 -1
  148. package/themes/original/src/components/NavBar/index.tsx +4 -4
  149. package/themes/original/src/components/OrderDetails/OrderHistory.tsx +167 -0
  150. package/themes/original/src/components/OrderDetails/index.tsx +151 -65
  151. package/themes/original/src/components/OrderDetails/styles.tsx +1 -2
  152. package/themes/original/src/components/OrderSummary/index.tsx +3 -3
  153. package/themes/original/src/components/OrderTypeSelector/index.tsx +4 -2
  154. package/themes/original/src/components/OrdersOption/PreviousBusinessOrdered/index.tsx +153 -0
  155. package/themes/original/src/components/OrdersOption/PreviousBusinessOrdered/styles.tsx +6 -0
  156. package/themes/original/src/components/OrdersOption/PreviousProductsOrdered/index.tsx +53 -0
  157. package/themes/original/src/components/OrdersOption/PreviousProductsOrdered/styles.tsx +6 -0
  158. package/themes/original/src/components/OrdersOption/index.tsx +130 -38
  159. package/themes/original/src/components/OrdersOption/styles.tsx +4 -1
  160. package/themes/original/src/components/PaymentOptionCash/index.tsx +2 -2
  161. package/themes/original/src/components/PaymentOptionWallet/index.tsx +17 -23
  162. package/themes/original/src/components/PaymentOptionWallet/styles.tsx +1 -1
  163. package/themes/original/src/components/PaymentOptions/index.tsx +58 -37
  164. package/themes/original/src/components/PhoneInputNumber/index.tsx +5 -11
  165. package/themes/original/src/components/PreviousOrders/index.tsx +18 -147
  166. package/themes/original/src/components/ProductForm/index.tsx +70 -62
  167. package/themes/original/src/components/ProductForm/styles.tsx +0 -1
  168. package/themes/original/src/components/ProductItemAccordion/index.tsx +2 -2
  169. package/themes/original/src/components/ProductOptionSubOption/index.tsx +18 -12
  170. package/themes/original/src/components/ProfessionalFilter/index.tsx +128 -0
  171. package/themes/original/src/components/ProfessionalFilter/styles.tsx +0 -0
  172. package/themes/original/src/components/ProfessionalProfile/index.tsx +298 -0
  173. package/themes/original/src/components/ProfessionalProfile/styles.tsx +46 -0
  174. package/themes/original/src/components/Promotions/index.tsx +151 -133
  175. package/themes/original/src/components/Promotions/styles.tsx +3 -23
  176. package/themes/original/src/components/ReviewDriver/index.tsx +6 -6
  177. package/themes/original/src/components/ReviewOrder/index.tsx +1 -1
  178. package/themes/original/src/components/ReviewTrigger/index.tsx +118 -0
  179. package/themes/original/src/components/ReviewTrigger/styles.tsx +34 -0
  180. package/themes/original/src/components/SearchBar/index.tsx +10 -4
  181. package/themes/original/src/components/ServiceForm/index.tsx +579 -0
  182. package/themes/original/src/components/ServiceForm/styles.tsx +50 -0
  183. package/themes/original/src/components/Sessions/index.tsx +160 -0
  184. package/themes/original/src/components/Sessions/styles.tsx +15 -0
  185. package/themes/original/src/components/SignupForm/index.tsx +237 -126
  186. package/themes/original/src/components/SingleOrderCard/index.tsx +282 -0
  187. package/themes/original/src/components/SingleOrderCard/styles.tsx +54 -0
  188. package/themes/original/src/components/SingleProductCard/index.tsx +59 -17
  189. package/themes/original/src/components/StripeElementsForm/index.tsx +16 -8
  190. package/themes/original/src/components/StripeElementsForm/naked.tsx +2 -2
  191. package/themes/original/src/components/UpsellingProducts/index.tsx +86 -74
  192. package/themes/original/src/components/UserDetails/index.tsx +15 -81
  193. package/themes/original/src/components/UserFormDetails/index.tsx +98 -66
  194. package/themes/original/src/components/UserProfile/index.tsx +52 -5
  195. package/themes/original/src/components/UserProfileForm/index.tsx +20 -18
  196. package/themes/original/src/components/UserVerification/index.tsx +178 -192
  197. package/themes/original/src/components/VerifyPhone/index.tsx +10 -7
  198. package/themes/original/src/components/VerifyPhone/styles.tsx +2 -1
  199. package/themes/original/src/components/Wallets/index.tsx +76 -9
  200. package/themes/original/src/components/Wallets/styles.tsx +21 -0
  201. package/themes/original/src/components/shared/OBottomPopup.tsx +44 -13
  202. package/themes/original/src/components/shared/OModal.tsx +4 -2
  203. package/themes/original/src/layouts/FloatingBottomContainer.tsx +5 -1
  204. package/themes/original/src/types/index.tsx +186 -35
  205. package/themes/original/src/utils/index.tsx +96 -2
  206. package/themes/single-business/src/components/OrderTypeSelector/index.tsx +1 -1
  207. package/themes/uber-eats/src/components/BusinessesListing/index.tsx +1 -1
@@ -0,0 +1,282 @@
1
+ import React, { useState } from 'react';
2
+ import moment from 'moment';
3
+ import {
4
+ SingleOrderCard as SingleOrderCardController,
5
+ useUtils,
6
+ useLanguage
7
+ } from 'ordering-components/native';
8
+ import { StyleSheet, TouchableOpacity, View } from 'react-native';
9
+ import { useTheme } from 'styled-components/native';
10
+ import { OIcon, OText, OButton } from '../shared';
11
+ import IconAntDesign from 'react-native-vector-icons/AntDesign'
12
+ import { SingleOrderCardParams } from '../../types';
13
+
14
+ import {
15
+ Container,
16
+ InnerContainer,
17
+ Logo,
18
+ CardInfoWrapper,
19
+ ContentHeader,
20
+ ButtonWrapper,
21
+ ContentFooter,
22
+ UnreadMessageCounter,
23
+ Price
24
+ } from './styles';
25
+
26
+ const SingleOrderCardUI = (props: SingleOrderCardParams) => {
27
+ const {
28
+ order,
29
+ reorderLoading,
30
+ handleReorder,
31
+ getOrderStatus,
32
+ handleFavoriteOrder,
33
+ onNavigationRedirect,
34
+ pastOrders,
35
+ isMessageView,
36
+ handleClickOrder
37
+ } = props;
38
+
39
+ const [{ parsePrice, optimizeImage }] = useUtils();
40
+ const [, t] = useLanguage();
41
+ const theme = useTheme();
42
+
43
+ const [reorderSelected, setReorderSelected] = useState<number | null>(null);
44
+
45
+ const allowedOrderStatus = [1, 2, 5, 6, 10, 11, 12];
46
+
47
+ const styles = StyleSheet.create({
48
+ logo: {
49
+ borderRadius: 8,
50
+ width: 64,
51
+ height: 64
52
+ },
53
+ logoWrapper: {
54
+ overflow: 'hidden',
55
+ backgroundColor: 'white',
56
+ borderRadius: 8,
57
+ shadowColor: '#000000',
58
+ shadowOffset: { width: 1, height: 1 },
59
+ shadowOpacity: 0.1,
60
+ shadowRadius: 1,
61
+ elevation: 3
62
+ },
63
+ buttonText: {
64
+ color: theme.colors.primary,
65
+ fontSize: 10,
66
+ marginLeft: 2,
67
+ marginRight: 2,
68
+ },
69
+ reorderLoading: {
70
+ width: 80,
71
+ height: 40,
72
+ borderRadius: 10,
73
+ },
74
+ reorderbutton: {
75
+ height: 23,
76
+ paddingLeft: 10,
77
+ paddingRight: 10,
78
+ borderRadius: 23,
79
+ shadowOpacity: 0,
80
+ backgroundColor: theme.colors.primaryContrast,
81
+ borderWidth: 0,
82
+ },
83
+ reviewButton: {
84
+ height: 23,
85
+ maxHeight: 23,
86
+ backgroundColor: theme.colors.white,
87
+ alignItems: 'center',
88
+ justifyContent: 'center',
89
+ paddingHorizontal: 10,
90
+ borderRadius: 23,
91
+ borderWidth: 1,
92
+ borderColor: theme.colors.primaryContrast,
93
+ marginRight: 2
94
+ },
95
+ infoText: {
96
+ flexDirection: 'row',
97
+ alignItems: 'center'
98
+ }
99
+ });
100
+
101
+ const handleReorderClick = (id: number) => {
102
+ setReorderSelected(id);
103
+ handleReorder && handleReorder(id);
104
+ };
105
+
106
+ const handleClickOrderReview = (order: any) => {
107
+ if (pastOrders) {
108
+ onNavigationRedirect &&
109
+ onNavigationRedirect('ReviewOrder', {
110
+ order: {
111
+ id: order?.id,
112
+ business_id: order?.business_id,
113
+ logo: order?.business?.logo,
114
+ driver: order?.driver,
115
+ products: order?.products,
116
+ review: order?.review,
117
+ user_review: order?.user_review
118
+ },
119
+ });
120
+ return
121
+ }
122
+ if (isMessageView) {
123
+ handleClickOrder(order?.uuid)
124
+ return
125
+ }
126
+ onNavigationRedirect &&
127
+ onNavigationRedirect('OrderDetails', { orderId: order?.uuid });
128
+ };
129
+
130
+ const handleClickViewOrder = (uuid: string) => {
131
+ onNavigationRedirect &&
132
+ onNavigationRedirect('OrderDetails', { orderId: uuid });
133
+ };
134
+
135
+ const formatDate = (date: string, option?: any) => {
136
+ return option?.utc ? moment.utc(date).format('DD/MM/YY \u2022 h:m a') : moment(date).format('DD/MM/YY \u2022 h:m a');
137
+ };
138
+
139
+ const handleChangeFavorite = () => {
140
+ handleFavoriteOrder && handleFavoriteOrder(!order?.favorite)
141
+ };
142
+
143
+ return (
144
+ <Container
145
+ onPress={() => handleClickViewOrder(order?.uuid)}
146
+ activeOpacity={0.7}
147
+ >
148
+ <InnerContainer>
149
+ {!!order.business?.logo && (
150
+ <Logo style={styles.logoWrapper}>
151
+ <OIcon
152
+ url={optimizeImage(order.business?.logo, 'h_300,c_limit')}
153
+ style={styles.logo}
154
+ />
155
+ </Logo>
156
+ )}
157
+ <CardInfoWrapper>
158
+ <ContentHeader>
159
+ <View style={{ flex: 1 }}>
160
+ <OText size={12} lineHeight={18} weight={'600'} numberOfLines={1} ellipsizeMode={'tail'}>
161
+ {order.business?.name}
162
+ </OText>
163
+ </View>
164
+ {!!!pastOrders && (
165
+ <>
166
+ {isMessageView ? (
167
+ <>
168
+ {order?.unread_count > 0 && (
169
+ <UnreadMessageCounter>
170
+ <OText size={12} color={theme.colors.primary} lineHeight={18} >
171
+ {order?.unread_count}
172
+ </OText>
173
+ </UnreadMessageCounter>
174
+ )}
175
+ </>
176
+ ) : (
177
+ <Price>
178
+ <OText size={12} lineHeight={18}>
179
+ {parsePrice(order?.summary?.total || order?.total)}
180
+ </OText>
181
+ </Price>
182
+ )}
183
+ </>
184
+ )}
185
+ {!!pastOrders && (
186
+ <ButtonWrapper>
187
+ {allowedOrderStatus.includes(parseInt(order?.status)) &&
188
+ !order.review && (
189
+ <TouchableOpacity
190
+ onPress={() => handleClickOrderReview(order)}
191
+ style={styles.reviewButton}>
192
+ <OText size={10} color={theme.colors.primary} numberOfLines={1}>
193
+ {t('REVIEW', 'Review')}
194
+ </OText>
195
+ </TouchableOpacity>
196
+ )}
197
+ {order.cart && (
198
+ <OButton
199
+ text={t('REORDER', 'Reorder')}
200
+ imgRightSrc={''}
201
+ textStyle={styles.buttonText}
202
+ style={
203
+ reorderLoading && order.id === reorderSelected
204
+ ? styles.reorderLoading
205
+ : styles.reorderbutton
206
+ }
207
+ onClick={() => handleReorderClick(order.id)}
208
+ isLoading={reorderLoading && order.id === reorderSelected}
209
+ />
210
+ )}
211
+ </ButtonWrapper>
212
+ )}
213
+ </ContentHeader>
214
+ <ContentFooter>
215
+ <View style={{ flex: 1 }}>
216
+ <View style={styles.infoText}>
217
+ {!!!pastOrders && (
218
+ <>
219
+ <OText
220
+ size={10}
221
+ space
222
+ color={theme.colors.textSecondary}
223
+ style={{ marginVertical: 3 }}
224
+ lineHeight={15}
225
+ numberOfLines={1}
226
+ >
227
+ {t('ORDER_NO', 'Order No') + '.'}
228
+ </OText>
229
+ <OText
230
+ size={10}
231
+ color={theme.colors.textSecondary}
232
+ style={{ marginVertical: 3 }}
233
+ lineHeight={15}
234
+ numberOfLines={1}
235
+ >
236
+ {order.id + ` \u2022 `}
237
+ </OText>
238
+ </>
239
+ )}
240
+ <OText
241
+ size={10}
242
+ lineHeight={15}
243
+ color={theme.colors.textSecondary}
244
+ style={{ marginVertical: 3 }}
245
+ numberOfLines={1}>
246
+ {order?.delivery_datetime_utc
247
+ ? formatDate(order?.delivery_datetime_utc)
248
+ : formatDate(order?.delivery_datetime, { utc: false })}
249
+ </OText>
250
+ </View>
251
+ <OText
252
+ color={theme.colors.primary}
253
+ size={10}
254
+ lineHeight={15}
255
+ numberOfLines={1}>
256
+ {getOrderStatus(order.status)?.value}
257
+ </OText>
258
+ </View>
259
+ <TouchableOpacity
260
+ onPress={handleChangeFavorite}
261
+ style={{ marginTop: 5 }}
262
+ >
263
+ <IconAntDesign
264
+ name={order?.favorite ? 'heart' : 'hearto'}
265
+ color={theme.colors.danger5}
266
+ size={16}
267
+ />
268
+ </TouchableOpacity>
269
+ </ContentFooter>
270
+ </CardInfoWrapper>
271
+ </InnerContainer>
272
+ </Container>
273
+ )
274
+ }
275
+
276
+ export const SingleOrderCard = (props: any) => {
277
+ const singleOrderCardProps = {
278
+ ...props,
279
+ UIComponent: SingleOrderCardUI
280
+ }
281
+ return <SingleOrderCardController {...singleOrderCardProps} />
282
+ }
@@ -0,0 +1,54 @@
1
+ import styled from 'styled-components/native'
2
+
3
+ export const Container = styled.TouchableOpacity`
4
+ border-radius: 7.6px;
5
+ box-shadow: 0 1px 2px #0000001A;
6
+ margin-bottom: 10px;
7
+ padding-vertical: 5px;
8
+ `
9
+
10
+ export const InnerContainer = styled.View`
11
+ flex-direction: row;
12
+ width: 100%;
13
+ `
14
+
15
+ export const Logo = styled.View`
16
+ border-radius: 7.6px;
17
+ margin-right: 12px;
18
+ `
19
+
20
+ export const CardInfoWrapper = styled.View`
21
+ flex: 1;
22
+ `
23
+
24
+ export const ContentHeader = styled.View`
25
+ flex-direction: row;
26
+ justify-content: space-between;
27
+ `
28
+
29
+ export const ButtonWrapper = styled.View`
30
+ flex-direction: row;
31
+ align-items: center;
32
+ `
33
+
34
+ export const ContentFooter = styled.View`
35
+ flex-direction: row;
36
+ width: 100%;
37
+ `
38
+
39
+ export const UnreadMessageCounter = styled.View`
40
+ justify-content: center;
41
+ align-items: center;
42
+ margin-left: 10px;
43
+ width: 24px;
44
+ height: 24px;
45
+ border-radius: 7.6px;
46
+ background-color: ${(props: any) => props.theme.colors.primaryContrast};
47
+ `
48
+
49
+ export const Price = styled.View`
50
+ justify-content: space-between;
51
+ align-items: flex-end;
52
+ margin-left: 10px;
53
+ width: 30%;
54
+ `
@@ -4,23 +4,32 @@ import {
4
4
  useConfig,
5
5
  useOrder,
6
6
  useUtils,
7
+ SingleProductCard as SingleProductCardController
7
8
  } from 'ordering-components/native';
8
9
  import { useTheme } from 'styled-components/native';
9
10
  import { SingleProductCardParams } from '../../types';
10
11
  import { CardContainer, CardInfo, SoldOut, QuantityContainer, PricesContainer, RibbonBox, LogoWrapper } from './styles';
11
- import { StyleSheet } from 'react-native';
12
- import { OText, OIcon } from '../shared';
12
+ import { StyleSheet, View, TouchableOpacity, Image } from 'react-native';
13
+ import { OText } from '../shared';
13
14
  import FastImage from 'react-native-fast-image'
15
+ import IconAntDesign from 'react-native-vector-icons/AntDesign'
14
16
  import { shape } from '../../utils';
15
17
 
16
- export const SingleProductCard = (props: SingleProductCardParams) => {
18
+ function SingleProductCardPropsAreEqual(prevProps: any, nextProps: any) {
19
+ return JSON.stringify(prevProps.product) === JSON.stringify(nextProps.product) &&
20
+ prevProps.isSoldOut === nextProps.isSoldOut &&
21
+ prevProps.productAddedToCartLength === nextProps.productAddedToCartLength &&
22
+ prevProps.categoryState === nextProps.categoryState
23
+ }
24
+
25
+ const SinguleProductCardUI = React.memo((props: SingleProductCardParams) => {
17
26
  const {
18
- businessId,
19
27
  product,
20
28
  isSoldOut,
21
29
  onProductClick,
22
30
  productAddedToCartLength,
23
- style
31
+ style,
32
+ handleFavoriteProduct
24
33
  } = props;
25
34
 
26
35
  const theme = useTheme();
@@ -32,6 +41,11 @@ export const SingleProductCard = (props: SingleProductCardParams) => {
32
41
  borderColor: theme.colors.border,
33
42
  marginBottom: 28,
34
43
  },
44
+ titleWrapper: {
45
+ flexDirection: 'row',
46
+ alignItems: 'center',
47
+ justifyContent: 'space-between'
48
+ },
35
49
  line18: {
36
50
  lineHeight: 18,
37
51
  },
@@ -97,6 +111,11 @@ export const SingleProductCard = (props: SingleProductCardParams) => {
97
111
  maxCartProductConfig,
98
112
  maxCartProductInventory,
99
113
  );
114
+
115
+ const handleChangeFavorite = () => {
116
+ handleFavoriteProduct && handleFavoriteProduct(!product?.favorite)
117
+ }
118
+
100
119
  return (
101
120
  <CardContainer
102
121
  style={[
@@ -113,14 +132,25 @@ export const SingleProductCard = (props: SingleProductCardParams) => {
113
132
  </QuantityContainer>
114
133
  )}
115
134
  <CardInfo>
116
- <OText
117
- size={12}
118
- weight={'500'}
119
- numberOfLines={1}
120
- ellipsizeMode="tail"
121
- style={styles.line18}>
122
- {product?.name}
123
- </OText>
135
+ <View style={styles.titleWrapper}>
136
+ <OText
137
+ size={12}
138
+ weight={'500'}
139
+ numberOfLines={1}
140
+ ellipsizeMode="tail"
141
+ style={styles.line18}>
142
+ {product?.name}
143
+ </OText>
144
+ <TouchableOpacity
145
+ onPress={handleChangeFavorite}
146
+ >
147
+ <IconAntDesign
148
+ name={product?.favorite ? 'heart' : 'hearto'}
149
+ color={theme.colors.danger5}
150
+ size={18}
151
+ />
152
+ </TouchableOpacity>
153
+ </View>
124
154
  <PricesContainer>
125
155
  <OText color={theme.colors.primary}>{product?.price ? parsePrice(product?.price) : ''}</OText>
126
156
  {product?.offer_price !== null && product?.in_offer && (
@@ -148,7 +178,7 @@ export const SingleProductCard = (props: SingleProductCardParams) => {
148
178
  weight={'400'}
149
179
  color={theme.colors.white}
150
180
  numberOfLines={2}
151
- ellipsizeMode='tail'
181
+ ellipsizeMode='tail'
152
182
  lineHeight={13}
153
183
  >
154
184
  {product?.ribbon?.text}
@@ -165,9 +195,13 @@ export const SingleProductCard = (props: SingleProductCardParams) => {
165
195
  resizeMode={FastImage.resizeMode.cover}
166
196
  />
167
197
  ) : (
168
- <OIcon
169
- src={theme?.images?.dummies?.product}
198
+ <FastImage
170
199
  style={styles.productStyle}
200
+ source={{
201
+ uri: Image.resolveAssetSource(theme.images.dummies.product).uri,
202
+ priority: FastImage.priority.normal,
203
+ }}
204
+ resizeMode={FastImage.resizeMode.cover}
171
205
  />
172
206
  )}
173
207
  </LogoWrapper>
@@ -181,4 +215,12 @@ export const SingleProductCard = (props: SingleProductCardParams) => {
181
215
  )}
182
216
  </CardContainer>
183
217
  );
184
- };
218
+ }, SingleProductCardPropsAreEqual);
219
+
220
+ export const SingleProductCard = (props: SingleProductCardParams) => {
221
+ const singleProductCardProps = {
222
+ ...props,
223
+ UIComponent: SinguleProductCardUI
224
+ }
225
+ return <SingleProductCardController {...singleProductCardProps} />
226
+ }
@@ -27,7 +27,8 @@ const StripeElementsFormUI = (props: any) => {
27
27
  paymethod,
28
28
  onCancel,
29
29
  cart,
30
- merchantId
30
+ merchantId,
31
+ businessIds
31
32
  } = props;
32
33
 
33
34
  const theme = useTheme();
@@ -60,13 +61,13 @@ const StripeElementsFormUI = (props: any) => {
60
61
  }
61
62
 
62
63
  if (user?.address) {
63
- billingDetails.addressLine1 = user?.address
64
+ billingDetails.address.line1 = user?.address
64
65
  }
65
66
 
66
67
  const createPayMethod = async () => {
67
- const params: any = { type: 'Card' }
68
+ const params: any = { paymentMethodType: 'Card', paymentMethodData: {} }
68
69
  if (Object.keys(billingDetails).length > 0) {
69
- params.billingDetails = billingDetails
70
+ params.paymentMethodData.billingDetails = {...billingDetails, token: card?.last4}
70
71
  }
71
72
  try {
72
73
  setCreatePmLoading(true)
@@ -93,22 +94,29 @@ const StripeElementsFormUI = (props: any) => {
93
94
  setErrors(error?.message || error?.toString());
94
95
  }
95
96
  }
96
-
97
+
97
98
  const handleSaveCard = async () => {
98
99
  setErrors('');
99
100
  if (!requirements) {
100
101
  createPayMethod();
101
102
  return
102
103
  }
103
- const params: any = { type: 'Card' }
104
+ const params: any = { paymentMethodType: 'Card', paymentMethodData: {} }
104
105
  if (Object.keys(billingDetails).length > 0) {
105
- params.billingDetails = billingDetails
106
+ params.paymentMethodData.billingDetails = {...billingDetails, token: card?.last4}
106
107
  }
107
108
  try {
108
109
  const { setupIntent, error } = await confirmSetupIntent(requirements, params);
109
110
 
110
111
  if (setupIntent?.status === 'Succeeded') {
111
- stripeTokenHandler(setupIntent?.paymentMethodId, user, businessId);
112
+ if (businessIds) {
113
+ businessIds.forEach((_businessId: any, index: any) => {
114
+ const _isNewCard = index === 0
115
+ stripeTokenHandler(setupIntent?.paymentMethodId, user, businessId, _isNewCard);
116
+ })
117
+ } else {
118
+ stripeTokenHandler(setupIntent?.paymentMethodId, user, businessId);
119
+ }
112
120
  }
113
121
 
114
122
  if (error) {
@@ -40,7 +40,7 @@ export const StripeElementsForm = (props: any) => {
40
40
  }
41
41
  }
42
42
 
43
- const stripeTokenHandler = async (tokenId: string, user: any, businessId: string) => {
43
+ const stripeTokenHandler = async (tokenId: string, user: any, businessId: string, isNewCard: any = true) => {
44
44
  try {
45
45
  setState({
46
46
  ...state,
@@ -60,7 +60,7 @@ export const StripeElementsForm = (props: any) => {
60
60
  })
61
61
  })
62
62
  const response = await result.json();
63
- props.onSelectCard && props.onSelectCard(response.result);
63
+ isNewCard && props.onSelectCard && props.onSelectCard(response.result);
64
64
  setState({
65
65
  ...state,
66
66
  loadingAdd: false