ordering-ui-react-native 0.15.48 → 0.15.49-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 (189) 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 +120 -30
  11. package/src/components/LoginForm/styles.tsx +6 -0
  12. package/src/components/OrderDetails/index.tsx +9 -23
  13. package/src/components/PaymentOptions/index.tsx +1 -1
  14. package/src/components/PaymentOptionsWebView/index.tsx +123 -124
  15. package/src/components/SignupForm/index.tsx +145 -61
  16. package/src/components/SingleProductCard/index.tsx +16 -4
  17. package/src/components/StripeMethodForm/index.tsx +1 -2
  18. package/src/components/UpsellingProducts/index.tsx +1 -1
  19. package/src/components/UserProfileForm/index.tsx +63 -6
  20. package/src/components/UserProfileForm/styles.tsx +8 -0
  21. package/src/components/VerifyPhone/styles.tsx +1 -2
  22. package/src/components/shared/OModal.tsx +1 -1
  23. package/src/hooks/useCountdownTimer.tsx +26 -0
  24. package/src/navigators/CheckoutNavigator.tsx +6 -0
  25. package/src/navigators/HomeNavigator.tsx +12 -0
  26. package/src/pages/BusinessesListing.tsx +1 -1
  27. package/src/pages/MultiCheckout.tsx +31 -0
  28. package/src/pages/MultiOrdersDetails.tsx +27 -0
  29. package/src/pages/Sessions.tsx +22 -0
  30. package/src/theme.json +0 -1
  31. package/src/types/index.tsx +18 -11
  32. package/src/utils/index.tsx +68 -1
  33. package/themes/business/src/components/AcceptOrRejectOrder/index.tsx +103 -15
  34. package/themes/business/src/components/AcceptOrRejectOrder/styles.tsx +6 -0
  35. package/themes/business/src/components/Chat/index.tsx +42 -90
  36. package/themes/business/src/components/DriverMap/index.tsx +6 -5
  37. package/themes/business/src/components/Home/index.tsx +128 -55
  38. package/themes/business/src/components/Home/styles.tsx +8 -1
  39. package/themes/business/src/components/LoginForm/index.tsx +89 -2
  40. package/themes/business/src/components/LoginForm/styles.tsx +6 -0
  41. package/themes/business/src/components/LogoutButton/index.tsx +1 -1
  42. package/themes/business/src/components/NewOrderNotification/index.tsx +79 -105
  43. package/themes/business/src/components/OrderDetails/Business.tsx +1 -1
  44. package/themes/business/src/components/OrderDetails/Delivery.tsx +35 -18
  45. package/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +159 -91
  46. package/themes/business/src/components/OrderDetails/OrderHeaderComponent.tsx +6 -0
  47. package/themes/business/src/components/OrderDetails/styles.tsx +7 -0
  48. package/themes/business/src/components/OrdersListManager/index.tsx +1 -1
  49. package/themes/business/src/components/OrdersOption/index.tsx +5 -2
  50. package/themes/business/src/components/PreviousOrders/index.tsx +7 -5
  51. package/themes/business/src/components/ProductItemAccordion/index.tsx +2 -2
  52. package/themes/business/src/components/shared/OModal.tsx +1 -1
  53. package/themes/business/src/types/index.tsx +5 -1
  54. package/themes/doordash/src/components/BusinessesListing/index.tsx +1 -1
  55. package/themes/doordash/src/components/LoginForm/index.tsx +1 -2
  56. package/themes/instacart/src/components/BusinessesListing/index.tsx +1 -1
  57. package/themes/kiosk/src/components/BusinessMenu/index.tsx +39 -28
  58. package/themes/kiosk/src/components/BusinessesListing/index.tsx +2 -3
  59. package/themes/kiosk/src/components/Cart/index.tsx +99 -26
  60. package/themes/kiosk/src/components/Cart/styles.tsx +6 -0
  61. package/themes/kiosk/src/components/CartBottomSheet/index.tsx +9 -2
  62. package/themes/kiosk/src/components/CartContent/index.tsx +0 -11
  63. package/themes/kiosk/src/components/CartItem/index.tsx +4 -3
  64. package/themes/kiosk/src/components/CategoriesMenu/index.tsx +107 -62
  65. package/themes/kiosk/src/components/Checkout/index.tsx +40 -22
  66. package/themes/kiosk/src/components/CustomerName/index.tsx +0 -6
  67. package/themes/kiosk/src/components/DrawerView/index.tsx +1 -0
  68. package/themes/kiosk/src/components/DrawerView/styles.tsx +2 -2
  69. package/themes/kiosk/src/components/NavBar/index.tsx +29 -20
  70. package/themes/kiosk/src/components/OptionCard/index.tsx +1 -1
  71. package/themes/kiosk/src/components/OrderDetails/index.tsx +165 -65
  72. package/themes/kiosk/src/components/OrderDetails/styles.tsx +5 -0
  73. package/themes/kiosk/src/components/OrderTypeCardSelector/index.tsx +9 -11
  74. package/themes/kiosk/src/components/PaymentOptions/index.tsx +56 -54
  75. package/themes/kiosk/src/components/ProductForm/index.tsx +7 -8
  76. package/themes/kiosk/src/components/ProductItemAccordion/index.tsx +2 -2
  77. package/themes/kiosk/src/components/ProductOption/index.tsx +1 -1
  78. package/themes/kiosk/src/components/ProductOptionSubOption/index.tsx +3 -1
  79. package/themes/kiosk/src/components/UpsellingProducts/index.tsx +16 -5
  80. package/themes/kiosk/src/components/shared/OButton.tsx +5 -18
  81. package/themes/kiosk/src/types/index.d.ts +3 -0
  82. package/themes/original/index.tsx +169 -4
  83. package/themes/original/src/components/ActiveOrders/index.tsx +15 -132
  84. package/themes/original/src/components/ActiveOrders/styles.tsx +0 -54
  85. package/themes/original/src/components/AddressForm/index.tsx +1 -1
  86. package/themes/original/src/components/AddressList/index.tsx +30 -18
  87. package/themes/original/src/components/AppleLogin/index.tsx +117 -78
  88. package/themes/original/src/components/BusinessBasicInformation/index.tsx +136 -45
  89. package/themes/original/src/components/BusinessBasicInformation/styles.tsx +4 -0
  90. package/themes/original/src/components/BusinessController/index.tsx +48 -11
  91. package/themes/original/src/components/BusinessController/styles.tsx +27 -0
  92. package/themes/original/src/components/BusinessFeaturedController/index.tsx +20 -1
  93. package/themes/original/src/components/BusinessFeaturedController/styles.tsx +23 -0
  94. package/themes/original/src/components/BusinessItemAccordion/index.tsx +8 -5
  95. package/themes/original/src/components/BusinessItemAccordion/styles.tsx +3 -1
  96. package/themes/original/src/components/BusinessListingSearch/index.tsx +196 -58
  97. package/themes/original/src/components/BusinessListingSearch/styles.tsx +22 -2
  98. package/themes/original/src/components/BusinessPreorder/index.tsx +1 -1
  99. package/themes/original/src/components/BusinessProductsCategories/index.tsx +2 -2
  100. package/themes/original/src/components/BusinessProductsList/CategoryDescription/index.tsx +44 -0
  101. package/themes/original/src/components/BusinessProductsList/index.tsx +119 -35
  102. package/themes/original/src/components/BusinessProductsList/styles.tsx +12 -4
  103. package/themes/original/src/components/BusinessProductsListing/index.tsx +109 -21
  104. package/themes/original/src/components/BusinessProductsListing/styles.tsx +22 -0
  105. package/themes/original/src/components/BusinessReviews/index.tsx +4 -25
  106. package/themes/original/src/components/BusinessTypeFilter/index.tsx +1 -2
  107. package/themes/original/src/components/BusinessesListing/index.tsx +127 -66
  108. package/themes/original/src/components/BusinessesListing/styles.tsx +11 -3
  109. package/themes/original/src/components/Cart/index.tsx +60 -41
  110. package/themes/original/src/components/Checkout/index.tsx +48 -32
  111. package/themes/original/src/components/DriverTips/index.tsx +17 -12
  112. package/themes/original/src/components/Favorite/index.tsx +92 -0
  113. package/themes/original/src/components/Favorite/styles.tsx +22 -0
  114. package/themes/original/src/components/FavoriteList/index.tsx +298 -0
  115. package/themes/original/src/components/FavoriteList/styles.tsx +5 -0
  116. package/themes/original/src/components/ForgotPasswordForm/index.tsx +84 -4
  117. package/themes/original/src/components/GPSButton/index.tsx +15 -8
  118. package/themes/original/src/components/GoogleMap/index.tsx +1 -0
  119. package/themes/original/src/components/Help/index.tsx +21 -4
  120. package/themes/original/src/components/HighestRatedBusinesses/index.tsx +18 -1
  121. package/themes/original/src/components/Home/index.tsx +1 -1
  122. package/themes/original/src/components/LastOrders/index.tsx +12 -1
  123. package/themes/original/src/components/LoginForm/Otp/index.tsx +91 -0
  124. package/themes/original/src/components/LoginForm/Otp/styles.tsx +7 -0
  125. package/themes/original/src/components/LoginForm/index.tsx +394 -155
  126. package/themes/original/src/components/LoginForm/styles.tsx +7 -4
  127. package/themes/original/src/components/LogoutButton/index.tsx +7 -1
  128. package/themes/original/src/components/MessageListing/index.tsx +10 -1
  129. package/themes/original/src/components/Messages/index.tsx +1 -1
  130. package/themes/original/src/components/MomentOption/index.tsx +10 -1
  131. package/themes/original/src/components/MomentOption/styles.tsx +1 -1
  132. package/themes/original/src/components/MultiCartsPaymethodsAndWallets/index.tsx +243 -0
  133. package/themes/original/src/components/MultiCartsPaymethodsAndWallets/styles.tsx +46 -0
  134. package/themes/original/src/components/MultiCheckout/index.tsx +298 -0
  135. package/themes/original/src/components/MultiCheckout/styles.tsx +59 -0
  136. package/themes/original/src/components/MultiOrdersDetails/SingleOrderCard.tsx +372 -0
  137. package/themes/original/src/components/MultiOrdersDetails/index.tsx +258 -0
  138. package/themes/original/src/components/MultiOrdersDetails/styles.tsx +50 -0
  139. package/themes/original/src/components/MyOrders/index.tsx +120 -32
  140. package/themes/original/src/components/MyOrders/styles.tsx +8 -1
  141. package/themes/original/src/components/OrderDetails/index.tsx +64 -42
  142. package/themes/original/src/components/OrderDetails/styles.tsx +1 -2
  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 +17 -23
  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 +70 -62
  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 +333 -128
  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/OModal.tsx +4 -2
  183. package/themes/original/src/config/constants.tsx +6 -6
  184. package/themes/original/src/types/index.tsx +144 -9
  185. package/themes/original/src/utils/index.tsx +19 -2
  186. package/themes/single-business/src/components/AddressList/index.tsx +1 -1
  187. package/themes/single-business/src/components/OrderTypeSelector/index.tsx +1 -1
  188. package/themes/single-business/src/components/UserProfile/index.tsx +1 -1
  189. package/themes/uber-eats/src/components/BusinessesListing/index.tsx +1 -1
@@ -53,5 +53,6 @@ const styles = StyleSheet.create({
53
53
  },
54
54
  shadowOpacity: 0.21,
55
55
  shadowRadius: 5,
56
+ elevation: 16
56
57
  }
57
58
  })
@@ -19,12 +19,12 @@ export const WrapperFloatBtn = styled.View`
19
19
  top: 10%;
20
20
  right: ${(props: any) => props.outside ? 11 : 58}%;
21
21
  z-index: 20002;
22
- elevation: 11;
22
+ elevation: 17;
23
23
  `;
24
24
 
25
25
  export const IconControl = styled.TouchableOpacity`
26
26
  background-color: ${(props: any) => props.theme.colors.white};
27
27
  padding: 10px;
28
28
  border-radius: 8px;
29
- elevation: 11;
29
+ elevation: 17;
30
30
  `;
@@ -1,10 +1,10 @@
1
1
  import * as React from 'react'
2
2
  import styled from 'styled-components/native'
3
3
  import { OIcon, OButton, OText } from '../shared'
4
- import { ImageStyle, TextStyle, View, Platform } from 'react-native'
5
- import { OrderTypeSelector } from '../OrderTypeSelector'
6
- import { useConfig, useLanguage } from 'ordering-components/native'
4
+ import { ImageStyle, TextStyle, View, Platform, TouchableOpacity } from 'react-native'
5
+ import { useConfig, useLanguage, useOrder } from 'ordering-components/native'
7
6
  import { useTheme } from 'styled-components/native'
7
+
8
8
  const Wrapper = styled.View`
9
9
  background-color: ${(props: any) => props.theme.colors.white};
10
10
  padding: 10px 0px 20px 0px;
@@ -54,38 +54,39 @@ interface Props {
54
54
  paddingTop?: number,
55
55
  includeOrderTypeSelector?: boolean,
56
56
  imgLeftStyle?: ImageStyle
57
+ onClickTypes?: any
57
58
  }
58
59
 
59
60
  const NavBar = (props: Props) => {
60
61
  const theme = useTheme();
61
- const [{ configs }] = useConfig();
62
+ const [orderState] = useOrder()
62
63
  const [, t] = useLanguage();
63
- const configTypes = configs?.order_types_allowed?.value.split('|').map((value: any) => Number(value)) || [];
64
+
65
+ const selectedOrderType = orderState?.options?.type;
64
66
 
65
67
  return (
66
68
  <Wrapper style={{ paddingTop: props.paddingTop, ...props.style }}>
67
- {(props?.onActionLeft) && (
69
+ {(props?.onActionLeft || props?.leftImg) && (
68
70
  <OButton
69
- imgLeftSrc={props.leftImg}
71
+ imgLeftSrc={props.leftImg || theme.images.general.arrow_left}
70
72
  imgRightSrc={null}
71
73
  style={{ ...btnBackArrow, ...props.btnStyle }}
72
74
  onClick={props.onActionLeft}
73
- imgLeftStyle={props.imgLeftStyle}
74
- {...(!props.leftImg && { iconProps: { name: 'arrowleft', size: 28, color: props.btnStyle?.color } })}
75
+ imgLeftStyle= {props.imgLeftStyle}
75
76
  />)
76
77
  }
77
78
  <TitleTopWrapper>
78
79
  {props.withIcon
79
80
  ? (
80
- <OIcon
81
- url={props.icon}
82
- style={{
83
- borderColor: theme.colors.lightGray,
84
- borderRadius: 20,
85
- }}
86
- width={60}
87
- height={60}
88
- />
81
+ <OIcon
82
+ url={props.icon}
83
+ style={{
84
+ borderColor: theme.colors.lightGray,
85
+ borderRadius: 20,
86
+ }}
87
+ width={60}
88
+ height={60}
89
+ />
89
90
  )
90
91
  : null
91
92
  }
@@ -121,11 +122,19 @@ const NavBar = (props: Props) => {
121
122
  }}
122
123
  >
123
124
  <OText style={{ paddingRight: 5 }}>{t('THIS_ORDER_IS_TO', 'This order is to')}</OText>
124
- <OrderTypeSelector configTypes={configTypes} />
125
+ <TouchableOpacity
126
+ activeOpacity={1}
127
+ onPress={props.onClickTypes}
128
+ >
129
+ <OText color={theme.colors.primary}>
130
+ {selectedOrderType === 2 && t('TAKE_OUT', 'Take out')}
131
+ {selectedOrderType === 3 && t('EAT_IN', 'Eat in')}
132
+ </OText>
133
+ </TouchableOpacity>
125
134
  </View>
126
135
  )}
127
136
 
128
- {props.rightComponent}
137
+ { props.rightComponent }
129
138
  </Wrapper>
130
139
  )
131
140
  }
@@ -95,7 +95,7 @@ interface Props {
95
95
  style?: ViewStyle;
96
96
  bgImage: ImageSourcePropType;
97
97
  innerStyle?: ViewStyle;
98
- icon?: ImageSourcePropType;
98
+ icon: ImageSourcePropType;
99
99
  iconStyle?: ImageStyle;
100
100
  callToActionText: string;
101
101
  callToActionTextStyle?: TextStyle;
@@ -23,6 +23,7 @@ import {
23
23
  Table,
24
24
  OrderBill,
25
25
  Total,
26
+ OSRow,
26
27
  } from './styles'
27
28
  import { OrderDetailsParams, Product } from '../../types'
28
29
  import { Container } from '../../layouts/Container';
@@ -178,6 +179,20 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
178
179
  setIsLoading(false)
179
180
  }
180
181
 
182
+ const getIncludedTaxes = () => {
183
+ if (order?.taxes?.length === 0) {
184
+ return order.tax_type === 1 ? order?.summary?.tax ?? 0 : 0
185
+ } else {
186
+ return order?.taxes.reduce((taxIncluded: number, tax: any) => {
187
+ return taxIncluded + (tax.type === 1 ? tax.summary?.tax : 0)
188
+ }, 0)
189
+ }
190
+ }
191
+
192
+ const getIncludedTaxesDiscounts = () => {
193
+ return order?.taxes?.filter((tax: any) => tax?.type === 1)?.reduce((carry: number, tax: any) => carry + (tax?.summary?.tax_after_discount ?? tax?.summary?.tax), 0)
194
+ }
195
+
181
196
  useEffect(() => {
182
197
  const backAction = () => {
183
198
  Alert.alert(`${t('HOLD_ON', 'Hold on')}!`, `${t('ARE_YOU_SURE_YOU_WANT_TO_GO_BACK', 'Are you sure you want to go back')}?`, [
@@ -209,7 +224,7 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
209
224
  const getCustomerName = async () => {
210
225
  try {
211
226
  const { customerName: name } = await _retrieveStoreData('customer_name')
212
- setCustomerName(name)
227
+ setCustomerName(name)
213
228
  } catch (e) {
214
229
  if (e) {
215
230
  setCustomerName(null)
@@ -217,8 +232,8 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
217
232
  }
218
233
  }
219
234
  getCustomerName()
220
- const redirectHome = setTimeout(() =>{
221
- _setStoreData('customer_name', {customerName: ''});
235
+ const redirectHome = setTimeout(() => {
236
+ _setStoreData('customer_name', { customerName: '' });
222
237
  navigation.reset({
223
238
  routes: [{ name: 'Intro' }],
224
239
  });
@@ -345,7 +360,7 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
345
360
  <OButton
346
361
  text={`${t('YOU_ARE_DONE', 'You are done! Click to close')}!`}
347
362
  onClick={() => {
348
- _setStoreData('customer_name', {customerName: ''});
363
+ _setStoreData('customer_name', { customerName: '' });
349
364
  navigation.reset({
350
365
  routes: [{ name: 'Intro' }],
351
366
  });
@@ -380,9 +395,14 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
380
395
  </View>
381
396
  </OSTable>
382
397
 
383
- {order?.products?.length && (
384
- <OSTable>
385
- <View>
398
+ {order?.products?.length > 0 && (
399
+ <>
400
+ <View
401
+ style={{
402
+ flexDirection: 'row',
403
+ justifyContent: 'space-between'
404
+ }}
405
+ >
386
406
  <OText
387
407
  weight="bold"
388
408
  mBottom={15}
@@ -390,75 +410,164 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
390
410
  {`${order?.products?.length} ${t('ITEMS', 'items')}`}
391
411
  </OText>
392
412
 
393
- <GridContainer style={{ maxWidth: orientationState?.dimensions?.width * 0.6 }}>
394
- {order?.products.map((product: Product, i: number) => (
395
- <OImage
396
- key={product?.id || i}
397
- source={{ uri: product?.images || '' }}
398
- resizeMode="cover"
399
- height={80}
400
- width={80}
401
- borderRadius={8}
402
- style={{ marginEnd: 10, marginBottom: 10 }}
403
- />
404
- ))}
405
- </GridContainer>
413
+ <OText
414
+ color={theme.colors.primary}
415
+ weight="bold"
416
+ >
417
+ {parsePrice((order?.summary?.total || order?.total) - (order?.summary?.discount || order?.discount))}
418
+ </OText>
406
419
  </View>
407
-
408
- <OText
409
- color={theme.colors.primary}
410
- weight="bold"
411
- mRight={30}
412
- >
413
- {parsePrice((order?.summary?.total || order?.total) - (order?.summary?.discount || order?.discount))}
414
- </OText>
415
- </OSTable>
420
+ <OSTable>
421
+ <GridContainer style={{ maxWidth: orientationState?.dimensions?.width * 0.6 }}>
422
+ {order?.products.map((product: Product, i: number) => (
423
+ <OImage
424
+ key={product?.id || i}
425
+ source={{ uri: product?.images || '' }}
426
+ resizeMode="cover"
427
+ height={80}
428
+ width={80}
429
+ borderRadius={8}
430
+ style={{ marginEnd: 10, marginBottom: 10 }}
431
+ />
432
+ ))}
433
+ </GridContainer>
434
+ </OSTable>
435
+ </>
416
436
  )}
417
437
 
418
438
  <OrderBill>
419
439
  <Table>
420
440
  <OText>{t('SUBTOTAL', 'Subtotal')}</OText>
421
441
  <OText>
422
- {parsePrice(isTaxIncluded
423
- ? (order?.summary?.subtotal + order?.summary?.tax) ?? 0
424
- : order?.summary?.subtotal ?? 0
425
- )}
442
+ {parsePrice(((order?.summary?.subtotal ?? order?.subtotal) + getIncludedTaxes()))}
426
443
  </OText>
427
444
  </Table>
428
- {order?.summary?.discount > 0 && (
445
+ {(order?.summary?.discount > 0 ?? order?.discount > 0) && order?.offers?.length === 0 && (
429
446
  <Table>
430
447
  {order?.offer_type === 1 ? (
431
448
  <OText>
432
449
  {t('DISCOUNT', 'Discount')}
433
- <OText>{`(${verifyDecimals(order?.offer_rate, parsePrice)}%)`}</OText>
450
+ <OText>{`(${verifyDecimals(
451
+ order?.offer_rate,
452
+ parsePrice,
453
+ )}%)`}</OText>
434
454
  </OText>
435
455
  ) : (
436
456
  <OText>{t('DISCOUNT', 'Discount')}</OText>
437
457
  )}
438
- <OText>- {parsePrice(order?.summary?.discount)}</OText>
458
+ <OText>
459
+ - {parsePrice(order?.summary?.discount || order?.discount)}
460
+ </OText>
439
461
  </Table>
440
462
  )}
463
+ {
464
+ order?.offers?.length > 0 && order?.offers?.filter((offer: any) => offer?.target === 1)?.map((offer: any) => (
465
+ <Table key={offer.id}>
466
+ <OSRow>
467
+ <OText>
468
+ {offer.name}
469
+ {offer.rate_type === 1 && (
470
+ <OText>{`(${verifyDecimals(offer?.rate, parsePrice)}%)`}</OText>
471
+ )}
472
+ </OText>
473
+ </OSRow>
474
+ <OText>- {parsePrice(offer?.summary?.discount)}</OText>
475
+ </Table>
476
+ ))
477
+ }
441
478
  {order?.summary?.subtotal_with_discount > 0 && order?.summary?.discount > 0 && order?.summary?.total >= 0 && (
442
479
  <Table>
443
480
  <OText>{t('SUBTOTAL_WITH_DISCOUNT', 'Subtotal with discount')}</OText>
444
- <OText>{parsePrice(order?.summary?.subtotal_with_discount ?? 0)}</OText>
445
- </Table>
446
- )}
447
- {order?.tax_type !== 1 && (
448
- <Table>
449
- <OText>
450
- {t('TAX', 'Tax')}
451
- {`(${verifyDecimals(order?.summary?.tax_rate, parseNumber)}%)`}
452
- </OText>
453
- <OText>{parsePrice(order?.summary?.tax)}</OText>
481
+ {order?.tax_type === 1 ? (
482
+ <OText>{parsePrice((order?.summary?.subtotal_with_discount + getIncludedTaxesDiscounts() ?? 0))}</OText>
483
+ ) : (
484
+ <OText>{parsePrice(order?.summary?.subtotal_with_discount ?? 0)}</OText>
485
+ )}
454
486
  </Table>
455
487
  )}
488
+ {
489
+ order?.taxes?.length === 0 && order?.tax_type === 2 && (
490
+ <Table>
491
+ <OText>
492
+ {t('TAX', 'Tax')} {`(${verifyDecimals(order?.tax, parseNumber)}%)`}
493
+ </OText>
494
+ <OText>{parsePrice(order?.summary?.tax || 0)}</OText>
495
+ </Table>
496
+ )
497
+ }
498
+ {
499
+ order?.fees?.length === 0 && (
500
+ <Table>
501
+ <OText>
502
+ {t('SERVICE_FEE', 'Service fee')}
503
+ {`(${verifyDecimals(order?.service_fee, parseNumber)}%)`}
504
+ </OText>
505
+ <OText>{parsePrice(order?.summary?.service_fee || 0)}</OText>
506
+ </Table>
507
+ )
508
+ }
509
+ {
510
+ order?.taxes?.length > 0 && order?.taxes?.filter((tax: any) => tax?.type === 2 && tax?.rate !== 0).map((tax: any) => (
511
+ <Table key={tax.id}>
512
+ <OSRow>
513
+ <OText>
514
+ {tax.name || t('INHERIT_FROM_BUSINESS', 'Inherit from business')}
515
+ {`(${verifyDecimals(tax?.rate, parseNumber)}%)`}{' '}
516
+ </OText>
517
+ </OSRow>
518
+ <OText>{parsePrice(tax?.summary?.tax_after_discount ?? tax?.summary?.tax ?? 0)}</OText>
519
+ </Table>
520
+ ))
521
+ }
522
+ {
523
+ order?.fees?.length > 0 && order?.fees?.filter((fee: any) => !(fee.fixed === 0 && fee.percentage === 0))?.map((fee: any) => (
524
+ <Table key={fee.id}>
525
+ <OSRow>
526
+ <OText>
527
+ {fee.name || t('INHERIT_FROM_BUSINESS', 'Inherit from business')}
528
+ ({fee?.fixed > 0 && `${parsePrice(fee?.fixed)}${fee.percentage > 0 ? ' + ' : ''}`}{fee.percentage > 0 && `${fee.percentage}%`}){' '}
529
+ </OText>
530
+ </OSRow>
531
+ <OText>{parsePrice(fee?.summary?.fixed + (fee?.summary?.percentage_after_discount ?? fee?.summary?.percentage) ?? 0)}</OText>
532
+ </Table>
533
+ ))
534
+ }
535
+ {
536
+ order?.offers?.length > 0 && order?.offers?.filter((offer: any) => offer?.target === 3)?.map((offer: any) => (
537
+ <Table key={offer.id}>
538
+ <OSRow>
539
+ <OText>
540
+ {offer.name}
541
+ {offer.rate_type === 1 && (
542
+ <OText>{`(${verifyDecimals(offer?.rate, parsePrice)}%)`}</OText>
543
+ )}
544
+ </OText>
545
+ </OSRow>
546
+ <OText>- {parsePrice(offer?.summary?.discount)}</OText>
547
+ </Table>
548
+ ))
549
+ }
456
550
  {order?.summary?.delivery_price > 0 && (
457
551
  <Table>
458
552
  <OText>{t('DELIVERY_FEE', 'Delivery Fee')}</OText>
459
553
  <OText>{parsePrice(order?.summary?.delivery_price)}</OText>
460
554
  </Table>
461
555
  )}
556
+ {
557
+ order?.offers?.length > 0 && order?.offers?.filter((offer: any) => offer?.target === 2)?.map((offer: any) => (
558
+ <Table key={offer.id}>
559
+ <OSRow>
560
+ <OText>
561
+ {offer.name}
562
+ {offer.rate_type === 1 && (
563
+ <OText>{`(${verifyDecimals(offer?.rate, parsePrice)}%)`}</OText>
564
+ )}
565
+ </OText>
566
+ </OSRow>
567
+ <OText>- {parsePrice(offer?.summary?.discount)}</OText>
568
+ </Table>
569
+ ))
570
+ }
462
571
  {order?.summary?.driver_tip > 0 && (
463
572
  <Table>
464
573
  <OText>
@@ -470,23 +579,14 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
470
579
  `(${verifyDecimals(order?.summary?.driver_tip, parseNumber)}%)`
471
580
  )}
472
581
  </OText>
473
- <OText>{parsePrice(order?.summary?.driver_tip ?? 0)}</OText>
474
- </Table>
475
- )}
476
- {order?.summary?.service_fee > 0 && (
477
- <Table>
478
- <OText>
479
- {t('SERVICE_FEE', 'Service Fee')}
480
- {`(${verifyDecimals(order?.summary?.service_fee, parseNumber)}%)`}
481
- </OText>
482
- <OText>{parsePrice(order?.summary?.service_fee)}</OText>
582
+ <OText>{parsePrice(order?.summary?.driver_tip ?? order?.totalDriverTip)}</OText>
483
583
  </Table>
484
584
  )}
485
585
  <Total>
486
586
  <Table>
487
587
  <OText style={styles.textBold}>{t('TOTAL', 'Total')}</OText>
488
588
  <OText style={styles.textBold} color={theme.colors.primary}>
489
- {parsePrice(order?.summary?.total ?? 0)}
589
+ {parsePrice(order?.summary?.total ?? order?.total)}
490
590
  </OText>
491
591
  </Table>
492
592
  </Total>
@@ -498,7 +598,7 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
498
598
  <>
499
599
  <Spinner visible={!order || Object.keys(order).length === 0} />
500
600
 
501
- {order && Object.keys(order).length > 0 && (
601
+ {!!order && Object.keys(order).length > 0 && (
502
602
  <>
503
603
  <Container>
504
604
  <NavBar
@@ -508,14 +608,14 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
508
608
  <OIconButton
509
609
  bgColor="transparent"
510
610
  borderColor="transparent"
511
- RenderIcon={() =>
512
- <EvilIcons
513
- name={'close'}
514
- size={40}
515
- color={theme.colors.primary}
516
- />
611
+ RenderIcon={() =>
612
+ <EvilIcons
613
+ name={'close'}
614
+ size={40}
615
+ color={theme.colors.primary}
616
+ />
517
617
  }
518
- style={{ flex:1, justifyContent: 'flex-end', left: 30 }}
618
+ style={{ flex: 1, justifyContent: 'flex-end', left: 30 }}
519
619
  onClick={() => {
520
620
  navigation.reset({
521
621
  routes: [{ name: 'Intro' }],
@@ -51,3 +51,8 @@ export const Total = styled.View`
51
51
  padding-vertical: 10px;
52
52
  `
53
53
 
54
+ export const OSRow = styled.View`
55
+ flex-direction: row;
56
+ overflow: hidden;
57
+ width: 80%;
58
+ `
@@ -15,8 +15,6 @@ import { Container } from '../../layouts/Container'
15
15
  import NavBar from '../NavBar'
16
16
  import { LANDSCAPE, PORTRAIT, useDeviceOrientation } from '../../../../../src/hooks/DeviceOrientation'
17
17
  import GridContainer from '../../layouts/GridContainer'
18
- import AntDesignIcon from 'react-native-vector-icons/AntDesign'
19
- import MaterialIcon from 'react-native-vector-icons/MaterialCommunityIcons'
20
18
 
21
19
  const OrderTypeSelectorCardUI = (props: OrderTypeSelectParams) => {
22
20
  const {
@@ -29,7 +27,7 @@ const OrderTypeSelectorCardUI = (props: OrderTypeSelectParams) => {
29
27
  callback
30
28
  } = props
31
29
 
32
- const theme = useTheme();
30
+ const theme = useTheme();
33
31
  const [, t] = useLanguage();
34
32
  const [orientationState] = useDeviceOrientation();
35
33
  const [orderState] = useOrder()
@@ -47,7 +45,7 @@ const OrderTypeSelectorCardUI = (props: OrderTypeSelectParams) => {
47
45
  }
48
46
 
49
47
  useEffect(() => {
50
- if (isCardCliked) {
48
+ if(isCardCliked){
51
49
  callback?.()
52
50
  setIsCardClicked(false)
53
51
  setIsLoadingCard(null)
@@ -59,7 +57,7 @@ const OrderTypeSelectorCardUI = (props: OrderTypeSelectParams) => {
59
57
  <Container>
60
58
  <NavBar
61
59
  title={t('ORDER_TYPE_X_ID', 'Order type')}
62
- {...(goBack && { onActionLeft: goBack })}
60
+ onActionLeft={goBack}
63
61
  btnStyle={{ paddingLeft: 0 }}
64
62
  />
65
63
 
@@ -85,13 +83,13 @@ const OrderTypeSelectorCardUI = (props: OrderTypeSelectParams) => {
85
83
  style={cardStyle}
86
84
  isDisabled={isCardCliked}
87
85
  isLoading={isLoadingCard === 'Eat In'}
88
- title={t('EAT_IN', 'Eat In')}
86
+ title={t('EAT_IN','Eat In')}
89
87
  description={t('EAT_IN_DESCRIPTION', 'We are very glad to have you here. Bon appetit!')}
90
88
  bgImage={theme.images.general.eatIn}
91
- VectorIcon={() => <MaterialIcon name='pin-outline' size={28} color='white' style={{ marginBottom: 10 }} />}
89
+ icon={theme.images.general.pushPin}
92
90
  callToActionText={t('START_MY_ORDER', 'Start my order')}
93
91
  onClick={() => {
94
- if (_eatIn?.value !== orderState?.options?.type) {
92
+ if(_eatIn?.value !== orderState?.options?.type){
95
93
  handleChangeOrderType(_eatIn?.value);
96
94
  setIsCardClicked(true)
97
95
  setIsLoadingCard('Eat In')
@@ -108,15 +106,15 @@ const OrderTypeSelectorCardUI = (props: OrderTypeSelectParams) => {
108
106
 
109
107
  <OptionCard
110
108
  style={cardStyle}
111
- title={t('TAKE_OUT', 'Take out')}
109
+ title={t('TAKE_OUT','Take out')}
112
110
  isDisabled={isCardCliked}
113
111
  isLoading={isLoadingCard === 'Take out'}
114
112
  description={t('TAKE_OUT_DESCRIPTION', 'You are very welcome anytime you visit us!')}
115
113
  bgImage={theme.images.general.takeOut}
116
- VectorIcon={() => <AntDesignIcon name='shoppingcart' size={28} color='white' style={{ marginBottom: 10 }} />}
114
+ icon={theme.images.general.shoppingCart}
117
115
  callToActionText={t('START_MY_ORDER', 'Start my order')}
118
116
  onClick={() => {
119
- if (_takeOut?.value !== orderState?.options?.type) {
117
+ if(_takeOut?.value !== orderState?.options?.type){
120
118
  handleChangeOrderType(_takeOut?.value);
121
119
  setIsCardClicked(true)
122
120
  setIsLoadingCard('Take out')
@@ -107,7 +107,7 @@ const PaymentOptionsUI = (props: any) => {
107
107
 
108
108
  const handlePlaceOrder = () => {
109
109
  if (!userErrors.length) {
110
- handlerClickPlaceOrder && handlerClickPlaceOrder();
110
+ handlerClickPlaceOrder && handlerClickPlaceOrder(null, { on_behalf_of: props.customerName });
111
111
  return;
112
112
  }
113
113
  let stringError = '';
@@ -189,67 +189,69 @@ const PaymentOptionsUI = (props: any) => {
189
189
 
190
190
  return (
191
191
  <>
192
- <Spinner visible={isLoading || placing} />
192
+ <Spinner visible={isLoading || placing || paymethodsList?.loading} />
193
193
 
194
194
  <Container nestedScrollEnabled>
195
- <NavBar
196
- title={t('PAYMENT_METHODS', 'Payment methods')}
197
- onActionLeft={goToBack}
198
- btnStyle={{ paddingLeft: 0 }}
199
- />
200
-
201
- <View
202
- style={{ marginVertical: orientationState?.dimensions?.height * 0.03 }}>
203
- <OText size={orientationState?.dimensions?.width * 0.048}>
204
- {t('HOW_WOULD_YOU', 'How would you')} {'\n'}
205
- <OText
206
- size={orientationState?.dimensions?.width * 0.048}
207
- weight={'700'}>
208
- {`${t('LIKE_TO_PAY', 'like to pay')}?`}
209
- </OText>
210
- </OText>
211
- </View>
212
-
213
195
  {supportedMethods?.length > 0 && (
214
- <GridContainer style={{ justifyContent: 'space-between' }}>
215
- {propsOfItems.CARD_ON_DELIVERY_ID && (
216
- <View style={{ marginBottom: orientationState?.orientation === LANDSCAPE ? 20 : 0 }}>
217
- <OptionCard {...propsOfItems?.CARD_ON_DELIVERY_ID} styke />
218
- </View>
219
- )}
196
+ <>
197
+ <NavBar
198
+ title={t('PAYMENT_METHODS', 'Payment methods')}
199
+ onActionLeft={goToBack}
200
+ btnStyle={{ paddingLeft: 0 }}
201
+ />
220
202
 
221
203
  <View
222
- style={{
223
- width:
224
- orientationState?.orientation === LANDSCAPE
225
- ? orientationState?.dimensions?.width * 0.0016
226
- : 1,
227
- height:
228
- orientationState?.orientation === PORTRAIT
229
- ? orientationState?.dimensions?.height * 0.018
230
- : 1,
231
- }}
232
- />
204
+ style={{ marginVertical: orientationState?.dimensions?.height * 0.03 }}>
205
+ <OText size={orientationState?.dimensions?.width * 0.048}>
206
+ {t('HOW_WOULD_YOU', 'How would you')} {'\n'}
207
+ <OText
208
+ size={orientationState?.dimensions?.width * 0.048}
209
+ weight={'700'}>
210
+ {`${t('LIKE_TO_PAY', 'like to pay')}?`}
211
+ </OText>
212
+ </OText>
213
+ </View>
233
214
 
234
- {propsOfItems?.CASH_ID && <OptionCard {...propsOfItems?.CASH_ID} />}
215
+ <GridContainer style={{ justifyContent: 'space-between' }}>
216
+ {propsOfItems.CARD_ON_DELIVERY_ID && (
217
+ <View style={{ marginBottom: orientationState?.orientation === LANDSCAPE ? 20 : 0 }}>
218
+ <OptionCard {...propsOfItems?.CARD_ON_DELIVERY_ID} styke />
219
+ </View>
220
+ )}
235
221
 
236
- <View
237
- style={{
238
- width:
239
- orientationState?.orientation === LANDSCAPE
240
- ? orientationState?.dimensions?.width * 0.0016
241
- : 1,
242
- height:
243
- orientationState?.orientation === PORTRAIT
244
- ? orientationState?.dimensions?.height * 0.018
245
- : 1,
246
- }}
247
- />
222
+ <View
223
+ style={{
224
+ width:
225
+ orientationState?.orientation === LANDSCAPE
226
+ ? orientationState?.dimensions?.width * 0.0016
227
+ : 1,
228
+ height:
229
+ orientationState?.orientation === PORTRAIT
230
+ ? orientationState?.dimensions?.height * 0.018
231
+ : 1,
232
+ }}
233
+ />
234
+
235
+ {propsOfItems?.CASH_ID && <OptionCard {...propsOfItems?.CASH_ID} />}
236
+
237
+ <View
238
+ style={{
239
+ width:
240
+ orientationState?.orientation === LANDSCAPE
241
+ ? orientationState?.dimensions?.width * 0.0016
242
+ : 1,
243
+ height:
244
+ orientationState?.orientation === PORTRAIT
245
+ ? orientationState?.dimensions?.height * 0.018
246
+ : 1,
247
+ }}
248
+ />
248
249
 
249
- {propsOfItems.STRIPE && (
250
- <OptionCard {...propsOfItems?.STRIPE} />
251
- )}
252
- </GridContainer>
250
+ {propsOfItems.STRIPE && (
251
+ <OptionCard {...propsOfItems?.STRIPE} />
252
+ )}
253
+ </GridContainer>
254
+ </>
253
255
  )}
254
256
  <View style={{ height: orientationState?.dimensions?.height * 0.05 }} />
255
257
  <OModal