ordering-ui-react-native 0.15.37 → 0.15.38-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 +4 -2
  2. package/src/DeliveryApp.tsx +43 -1
  3. package/src/components/AddressForm/index.tsx +18 -2
  4. package/src/components/BusinessController/index.tsx +8 -2
  5. package/src/components/BusinessTypeFilter/index.tsx +4 -1
  6. package/src/components/BusinessesListing/index.tsx +1 -1
  7. package/src/components/Checkout/index.tsx +23 -3
  8. package/src/components/DriverTips/index.tsx +11 -6
  9. package/src/components/LanguageSelector/index.tsx +7 -2
  10. package/src/components/LoginForm/index.tsx +3 -1
  11. package/src/components/OrderDetails/index.tsx +2 -2
  12. package/src/components/PaymentOptions/index.tsx +9 -16
  13. package/src/components/PaymentOptionsWebView/index.tsx +123 -124
  14. package/src/components/SignupForm/index.tsx +3 -1
  15. package/src/components/SingleProductCard/index.tsx +16 -4
  16. package/src/components/StripeElementsForm/index.tsx +27 -48
  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/config.json +0 -2
  24. package/src/hooks/useCountdownTimer.tsx +26 -0
  25. package/src/navigators/CheckoutNavigator.tsx +6 -0
  26. package/src/navigators/HomeNavigator.tsx +12 -0
  27. package/src/pages/BusinessProductsList.tsx +1 -0
  28. package/src/pages/BusinessesListing.tsx +1 -1
  29. package/src/pages/Checkout.tsx +1 -1
  30. package/src/pages/MultiCheckout.tsx +31 -0
  31. package/src/pages/MultiOrdersDetails.tsx +27 -0
  32. package/src/pages/Sessions.tsx +22 -0
  33. package/src/theme.json +0 -1
  34. package/src/types/index.tsx +5 -11
  35. package/src/utils/index.tsx +68 -1
  36. package/themes/business/src/components/AcceptOrRejectOrder/index.tsx +103 -15
  37. package/themes/business/src/components/AcceptOrRejectOrder/styles.tsx +6 -0
  38. package/themes/business/src/components/Chat/index.tsx +38 -86
  39. package/themes/business/src/components/DriverMap/index.tsx +6 -5
  40. package/themes/business/src/components/Home/index.tsx +128 -55
  41. package/themes/business/src/components/Home/styles.tsx +8 -1
  42. package/themes/business/src/components/LoginForm/index.tsx +89 -2
  43. package/themes/business/src/components/LoginForm/styles.tsx +6 -0
  44. package/themes/business/src/components/LogoutButton/index.tsx +1 -1
  45. package/themes/business/src/components/NewOrderNotification/index.tsx +79 -105
  46. package/themes/business/src/components/OrderDetails/Business.tsx +1 -1
  47. package/themes/business/src/components/OrderDetails/Delivery.tsx +32 -15
  48. package/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +157 -89
  49. package/themes/business/src/components/OrderDetails/OrderHeaderComponent.tsx +6 -0
  50. package/themes/business/src/components/OrderDetails/styles.tsx +7 -0
  51. package/themes/business/src/components/OrdersListManager/index.tsx +52 -49
  52. package/themes/business/src/components/OrdersOption/index.tsx +57 -50
  53. package/themes/business/src/components/PreviousOrders/index.tsx +50 -14
  54. package/themes/business/src/components/ProductItemAccordion/index.tsx +2 -2
  55. package/themes/business/src/components/shared/OModal.tsx +1 -1
  56. package/themes/business/src/types/index.tsx +5 -1
  57. package/themes/doordash/src/components/BusinessesListing/index.tsx +1 -1
  58. package/themes/doordash/src/components/LoginForm/index.tsx +1 -2
  59. package/themes/instacart/src/components/BusinessesListing/index.tsx +1 -1
  60. package/themes/kiosk/src/components/Cart/index.tsx +99 -25
  61. package/themes/kiosk/src/components/Cart/styles.tsx +6 -0
  62. package/themes/kiosk/src/components/Checkout/index.tsx +34 -22
  63. package/themes/kiosk/src/components/CustomerName/index.tsx +0 -6
  64. package/themes/kiosk/src/components/NavBar/index.tsx +14 -14
  65. package/themes/kiosk/src/components/OptionCard/index.tsx +1 -1
  66. package/themes/kiosk/src/components/OrderDetails/index.tsx +165 -65
  67. package/themes/kiosk/src/components/OrderDetails/styles.tsx +5 -0
  68. package/themes/kiosk/src/components/OrderTypeCardSelector/index.tsx +10 -12
  69. package/themes/kiosk/src/components/PaymentOptions/index.tsx +1 -1
  70. package/themes/kiosk/src/components/ProductForm/index.tsx +2 -2
  71. package/themes/kiosk/src/components/shared/OButton.tsx +5 -18
  72. package/themes/kiosk/src/types/index.d.ts +2 -0
  73. package/themes/original/index.tsx +180 -1
  74. package/themes/original/src/components/ActiveOrders/index.tsx +15 -132
  75. package/themes/original/src/components/ActiveOrders/styles.tsx +0 -54
  76. package/themes/original/src/components/AddressForm/index.tsx +15 -10
  77. package/themes/original/src/components/AddressList/index.tsx +56 -18
  78. package/themes/original/src/components/AppleLogin/index.tsx +117 -78
  79. package/themes/original/src/components/BusinessBasicInformation/index.tsx +96 -45
  80. package/themes/original/src/components/BusinessBasicInformation/styles.tsx +28 -1
  81. package/themes/original/src/components/BusinessController/index.tsx +56 -19
  82. package/themes/original/src/components/BusinessController/styles.tsx +27 -0
  83. package/themes/original/src/components/BusinessFeaturedController/index.tsx +20 -1
  84. package/themes/original/src/components/BusinessFeaturedController/styles.tsx +23 -0
  85. package/themes/original/src/components/BusinessItemAccordion/index.tsx +8 -5
  86. package/themes/original/src/components/BusinessItemAccordion/styles.tsx +3 -1
  87. package/themes/original/src/components/BusinessListingSearch/index.tsx +200 -58
  88. package/themes/original/src/components/BusinessListingSearch/styles.tsx +22 -2
  89. package/themes/original/src/components/BusinessMenuList/index.tsx +11 -4
  90. package/themes/original/src/components/BusinessPreorder/index.tsx +142 -122
  91. package/themes/original/src/components/BusinessProductsCategories/index.tsx +9 -7
  92. package/themes/original/src/components/BusinessProductsList/CategoryDescription/index.tsx +44 -0
  93. package/themes/original/src/components/BusinessProductsList/index.tsx +139 -36
  94. package/themes/original/src/components/BusinessProductsList/styles.tsx +29 -2
  95. package/themes/original/src/components/BusinessProductsListing/index.tsx +116 -26
  96. package/themes/original/src/components/BusinessProductsListing/styles.tsx +22 -0
  97. package/themes/original/src/components/BusinessReviews/index.tsx +4 -25
  98. package/themes/original/src/components/BusinessTypeFilter/index.tsx +1 -2
  99. package/themes/original/src/components/BusinessesListing/index.tsx +127 -67
  100. package/themes/original/src/components/BusinessesListing/styles.tsx +11 -3
  101. package/themes/original/src/components/Cart/index.tsx +60 -43
  102. package/themes/original/src/components/CartContent/index.tsx +2 -2
  103. package/themes/original/src/components/Checkout/index.tsx +49 -35
  104. package/themes/original/src/components/DriverTips/index.tsx +17 -12
  105. package/themes/original/src/components/Favorite/index.tsx +91 -0
  106. package/themes/original/src/components/Favorite/styles.tsx +22 -0
  107. package/themes/original/src/components/FavoriteList/index.tsx +287 -0
  108. package/themes/original/src/components/FavoriteList/styles.tsx +5 -0
  109. package/themes/original/src/components/ForgotPasswordForm/index.tsx +84 -4
  110. package/themes/original/src/components/GPSButton/index.tsx +15 -8
  111. package/themes/original/src/components/GoogleMap/index.tsx +1 -0
  112. package/themes/original/src/components/Help/index.tsx +21 -4
  113. package/themes/original/src/components/HighestRatedBusinesses/index.tsx +18 -1
  114. package/themes/original/src/components/Home/index.tsx +1 -1
  115. package/themes/original/src/components/LastOrders/index.tsx +12 -1
  116. package/themes/original/src/components/LoginForm/Otp/index.tsx +90 -0
  117. package/themes/original/src/components/LoginForm/Otp/styles.tsx +7 -0
  118. package/themes/original/src/components/LoginForm/index.tsx +394 -155
  119. package/themes/original/src/components/LoginForm/styles.tsx +7 -4
  120. package/themes/original/src/components/LogoutButton/index.tsx +7 -1
  121. package/themes/original/src/components/MessageListing/index.tsx +10 -1
  122. package/themes/original/src/components/Messages/index.tsx +6 -1
  123. package/themes/original/src/components/Messages/styles.tsx +1 -3
  124. package/themes/original/src/components/MomentOption/index.tsx +10 -1
  125. package/themes/original/src/components/MomentOption/styles.tsx +1 -1
  126. package/themes/original/src/components/MultiCartsPaymethodsAndWallets/index.tsx +243 -0
  127. package/themes/original/src/components/MultiCartsPaymethodsAndWallets/styles.tsx +46 -0
  128. package/themes/original/src/components/MultiCheckout/index.tsx +298 -0
  129. package/themes/original/src/components/MultiCheckout/styles.tsx +59 -0
  130. package/themes/original/src/components/MultiOrdersDetails/SingleOrderCard.tsx +372 -0
  131. package/themes/original/src/components/MultiOrdersDetails/index.tsx +258 -0
  132. package/themes/original/src/components/MultiOrdersDetails/styles.tsx +50 -0
  133. package/themes/original/src/components/MyOrders/index.tsx +120 -32
  134. package/themes/original/src/components/MyOrders/styles.tsx +8 -1
  135. package/themes/original/src/components/OrderDetails/index.tsx +50 -35
  136. package/themes/original/src/components/OrderDetails/styles.tsx +1 -2
  137. package/themes/original/src/components/OrderProgress/index.tsx +3 -3
  138. package/themes/original/src/components/OrderProgress/styles.tsx +1 -0
  139. package/themes/original/src/components/OrderSummary/index.tsx +3 -3
  140. package/themes/original/src/components/OrderTypeSelector/index.tsx +4 -2
  141. package/themes/original/src/components/OrdersOption/PreviousBusinessOrdered/index.tsx +153 -0
  142. package/themes/original/src/components/OrdersOption/PreviousBusinessOrdered/styles.tsx +6 -0
  143. package/themes/original/src/components/OrdersOption/PreviousProductsOrdered/index.tsx +53 -0
  144. package/themes/original/src/components/OrdersOption/PreviousProductsOrdered/styles.tsx +6 -0
  145. package/themes/original/src/components/OrdersOption/index.tsx +133 -41
  146. package/themes/original/src/components/OrdersOption/styles.tsx +4 -7
  147. package/themes/original/src/components/PaymentOptionCash/index.tsx +2 -2
  148. package/themes/original/src/components/PaymentOptionWallet/index.tsx +22 -24
  149. package/themes/original/src/components/PaymentOptionWallet/styles.tsx +1 -1
  150. package/themes/original/src/components/PaymentOptions/index.tsx +9 -21
  151. package/themes/original/src/components/PhoneInputNumber/index.tsx +1 -1
  152. package/themes/original/src/components/PreviousOrders/index.tsx +18 -145
  153. package/themes/original/src/components/ProductForm/index.tsx +74 -66
  154. package/themes/original/src/components/ProductForm/styles.tsx +0 -1
  155. package/themes/original/src/components/ProductItemAccordion/index.tsx +2 -2
  156. package/themes/original/src/components/ProductOptionSubOption/index.tsx +18 -12
  157. package/themes/original/src/components/Promotions/index.tsx +250 -0
  158. package/themes/original/src/components/Promotions/styles.tsx +60 -0
  159. package/themes/original/src/components/SearchBar/index.tsx +10 -4
  160. package/themes/original/src/components/Sessions/index.tsx +160 -0
  161. package/themes/original/src/components/Sessions/styles.tsx +15 -0
  162. package/themes/original/src/components/SignupForm/index.tsx +9 -4
  163. package/themes/original/src/components/SingleOrderCard/index.tsx +282 -0
  164. package/themes/original/src/components/SingleOrderCard/styles.tsx +54 -0
  165. package/themes/original/src/components/SingleProductCard/index.tsx +95 -32
  166. package/themes/original/src/components/SingleProductCard/styles.tsx +28 -1
  167. package/themes/original/src/components/StripeElementsForm/index.tsx +10 -2
  168. package/themes/original/src/components/StripeElementsForm/naked.tsx +2 -2
  169. package/themes/original/src/components/TaxInformation/index.tsx +10 -4
  170. package/themes/original/src/components/UpsellingProducts/index.tsx +86 -74
  171. package/themes/original/src/components/UserDetails/index.tsx +5 -96
  172. package/themes/original/src/components/UserFormDetails/index.tsx +34 -24
  173. package/themes/original/src/components/UserProfile/index.tsx +62 -8
  174. package/themes/original/src/components/UserProfileForm/index.tsx +20 -18
  175. package/themes/original/src/components/UserVerification/index.tsx +178 -192
  176. package/themes/original/src/components/VerifyPhone/index.tsx +10 -7
  177. package/themes/original/src/components/VerifyPhone/styles.tsx +2 -1
  178. package/themes/original/src/components/Wallets/index.tsx +76 -9
  179. package/themes/original/src/components/Wallets/styles.tsx +21 -0
  180. package/themes/original/src/components/shared/HeaderTitle.tsx +21 -0
  181. package/themes/original/src/components/shared/OModal.tsx +4 -2
  182. package/themes/original/src/components/shared/index.tsx +2 -0
  183. package/themes/original/src/config/constants.tsx +6 -6
  184. package/themes/original/src/types/index.tsx +132 -9
  185. package/themes/original/src/utils/index.tsx +28 -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
@@ -5,6 +5,7 @@ import { ImageStyle, TextStyle, View, Platform } from 'react-native'
5
5
  import { OrderTypeSelector } from '../OrderTypeSelector'
6
6
  import { useConfig, useLanguage } from 'ordering-components/native'
7
7
  import { useTheme } from 'styled-components/native'
8
+
8
9
  const Wrapper = styled.View`
9
10
  background-color: ${(props: any) => props.theme.colors.white};
10
11
  padding: 10px 0px 20px 0px;
@@ -64,28 +65,27 @@ const NavBar = (props: Props) => {
64
65
 
65
66
  return (
66
67
  <Wrapper style={{ paddingTop: props.paddingTop, ...props.style }}>
67
- {(props?.onActionLeft) && (
68
+ {(props?.onActionLeft || props?.leftImg) && (
68
69
  <OButton
69
- imgLeftSrc={props.leftImg}
70
+ imgLeftSrc={props.leftImg || theme.images.general.arrow_left}
70
71
  imgRightSrc={null}
71
72
  style={{ ...btnBackArrow, ...props.btnStyle }}
72
73
  onClick={props.onActionLeft}
73
- imgLeftStyle={props.imgLeftStyle}
74
- {...(!props.leftImg && { iconProps: { name: 'arrowleft', size: 28, color: props.btnStyle?.color } })}
74
+ imgLeftStyle= {props.imgLeftStyle}
75
75
  />)
76
76
  }
77
77
  <TitleTopWrapper>
78
78
  {props.withIcon
79
79
  ? (
80
- <OIcon
81
- url={props.icon}
82
- style={{
83
- borderColor: theme.colors.lightGray,
84
- borderRadius: 20,
85
- }}
86
- width={60}
87
- height={60}
88
- />
80
+ <OIcon
81
+ url={props.icon}
82
+ style={{
83
+ borderColor: theme.colors.lightGray,
84
+ borderRadius: 20,
85
+ }}
86
+ width={60}
87
+ height={60}
88
+ />
89
89
  )
90
90
  : null
91
91
  }
@@ -125,7 +125,7 @@ const NavBar = (props: Props) => {
125
125
  </View>
126
126
  )}
127
127
 
128
- {props.rightComponent}
128
+ { props.rightComponent }
129
129
  </Wrapper>
130
130
  )
131
131
  }
@@ -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,8 +57,8 @@ const OrderTypeSelectorCardUI = (props: OrderTypeSelectParams) => {
59
57
  <Container>
60
58
  <NavBar
61
59
  title={t('ORDER_TYPE_X_ID', 'Order type')}
62
- {...(goBack && { onActionLeft: goBack })}
63
- btnStyle={{ paddingLeft: 0 }}
60
+ {...(goBack && { onActionLeft: goBack } )}
61
+ btnStyle={{paddingLeft: 0}}
64
62
  />
65
63
 
66
64
  <View style={{ marginVertical: orientationState?.dimensions?.height * 0.03 }}>
@@ -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 = '';
@@ -446,7 +446,7 @@ export const ProductOptionsUI = (props: any) => {
446
446
  </WrapperIngredients>
447
447
  </View>
448
448
  )}
449
- {product?.extras.map((extra: any) => extra.options.map((option: any) => {
449
+ {product?.extras.sort((a: any, b: any) => a.rank - b.rank).map((extra: any) => extra.options.sort((a: any, b: any) => a.rank - b.rank).map((option: any) => {
450
450
  const currentState = productCart.options[`id:${option.id}`] || {}
451
451
  return (
452
452
  <React.Fragment key={option.id}>
@@ -460,7 +460,7 @@ export const ProductOptionsUI = (props: any) => {
460
460
  >
461
461
  <WrapperSubOption style={{ backgroundColor: isError(option.id) }}>
462
462
  {
463
- option.suboptions.map((suboption: any) => {
463
+ option.suboptions.sort((a: any, b: any) => a.rank - b.rank).map((suboption: any) => {
464
464
  const currentState = productCart.options[`id:${option.id}`]?.suboptions[`id:${suboption.id}`] || {}
465
465
  const balance = productCart.options[`id:${option.id}`]?.balance || 0
466
466
  return (
@@ -10,8 +10,6 @@ import {
10
10
 
11
11
  import * as React from 'react';
12
12
  import styled from 'styled-components/native';
13
- import AntDesignIcon from 'react-native-vector-icons/AntDesign'
14
- import { Icon, IconProps } from 'react-native-vector-icons/Icon';
15
13
 
16
14
  const StyledButton = styled.View<Props>`
17
15
  background-color: ${(props: any) => props.theme.colors.primary};
@@ -79,19 +77,17 @@ interface Props {
79
77
  isCircle?: boolean;
80
78
  bgColor?: string;
81
79
  borderColor?: string;
82
- iconProps?: IconProps;
83
- IconCustom?: React.FunctionComponent
84
80
  }
85
81
 
86
82
  const OButton = (props: Props): React.ReactElement => {
87
83
  if (props.isDisabled) {
88
84
  return (
89
85
  <View style={props.parentStyle}>
90
- <StyledButtonDisabled style={props.style}>
91
- <StyledTextDisabled style={props.disabledTextStyle ? props.disabledTextStyle : props.textStyle}>
92
- {props.text}
93
- </StyledTextDisabled>
94
- </StyledButtonDisabled>
86
+ <StyledButtonDisabled style={props.style}>
87
+ <StyledTextDisabled style={props.disabledTextStyle ? props.disabledTextStyle : props.textStyle}>
88
+ {props.text}
89
+ </StyledTextDisabled>
90
+ </StyledButtonDisabled>
95
91
  </View>
96
92
  );
97
93
  }
@@ -115,15 +111,6 @@ const OButton = (props: Props): React.ReactElement => {
115
111
  {props.imgLeftSrc ? (
116
112
  <StyledImage style={props.imgLeftStyle} source={props.imgLeftSrc} />
117
113
  ) : null}
118
- {props.iconProps ? (
119
- <>
120
- {props?.IconCustom ? (
121
- <props.IconCustom {...props.iconProps} />
122
- ) : (
123
- <AntDesignIcon {...props.iconProps} />
124
- )}
125
- </>
126
- ) : null}
127
114
  {props.text ? (
128
115
  <StyledText style={props.textStyle}>{props.text}</StyledText>
129
116
  ) : null}
@@ -472,6 +472,8 @@ export interface Cart {
472
472
  delivery_price_with_discount: number;
473
473
  total: number;
474
474
  clearInactivityTimeout: any;
475
+ taxes: Array<any>;
476
+ fees: Array<any>;
475
477
  }
476
478
 
477
479
  export interface NoNetworkParams {