ordering-ui-react-native 0.15.14 → 0.15.15-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 (151) hide show
  1. package/package.json +5 -3
  2. package/src/DeliveryApp.tsx +43 -1
  3. package/src/components/BusinessTypeFilter/index.tsx +12 -2
  4. package/src/components/BusinessTypeFilter/styles.tsx +1 -1
  5. package/src/components/BusinessesListing/index.tsx +1 -1
  6. package/src/components/Checkout/index.tsx +0 -1
  7. package/src/components/LanguageSelector/index.tsx +1 -0
  8. package/src/components/OrderDetails/index.tsx +26 -5
  9. package/src/components/PaymentOptions/index.tsx +9 -16
  10. package/src/components/PaymentOptionsWebView/index.tsx +123 -124
  11. package/src/components/ProductForm/index.tsx +1 -1
  12. package/src/components/ProductForm/styles.tsx +1 -0
  13. package/src/components/StripeElementsForm/index.tsx +27 -48
  14. package/src/components/VerifyPhone/styles.tsx +1 -2
  15. package/src/config.json +0 -2
  16. package/src/navigators/HomeNavigator.tsx +6 -0
  17. package/src/pages/BusinessProductsList.tsx +1 -0
  18. package/src/pages/BusinessesListing.tsx +1 -1
  19. package/src/pages/Checkout.tsx +1 -1
  20. package/src/pages/Sessions.tsx +22 -0
  21. package/src/types/index.tsx +1 -9
  22. package/src/utils/index.tsx +68 -1
  23. package/themes/business/index.tsx +2 -0
  24. package/themes/business/src/components/AcceptOrRejectOrder/index.tsx +56 -8
  25. package/themes/business/src/components/AcceptOrRejectOrder/styles.tsx +5 -0
  26. package/themes/business/src/components/Home/index.tsx +128 -55
  27. package/themes/business/src/components/Home/styles.tsx +8 -1
  28. package/themes/business/src/components/NewOrderNotification/index.tsx +59 -98
  29. package/themes/business/src/components/OrderDetails/Business.tsx +2 -1
  30. package/themes/business/src/components/OrderDetails/Delivery.tsx +19 -12
  31. package/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +150 -89
  32. package/themes/business/src/components/OrderDetails/OrderHeaderComponent.tsx +91 -17
  33. package/themes/business/src/components/OrderDetails/styles.tsx +7 -0
  34. package/themes/business/src/components/OrdersListManager/index.tsx +874 -0
  35. package/themes/business/src/components/OrdersListManager/styles.tsx +123 -0
  36. package/themes/business/src/components/OrdersListManager/utils.tsx +216 -0
  37. package/themes/business/src/components/OrdersOption/index.tsx +70 -116
  38. package/themes/business/src/components/OrdersOption/styles.tsx +2 -5
  39. package/themes/business/src/components/PreviousOrders/index.tsx +82 -23
  40. package/themes/business/src/types/index.tsx +2 -1
  41. package/themes/doordash/src/components/BusinessesListing/index.tsx +1 -1
  42. package/themes/doordash/src/components/LoginForm/index.tsx +1 -2
  43. package/themes/instacart/src/components/BusinessesListing/index.tsx +1 -1
  44. package/themes/kiosk/src/components/BusinessController/index.tsx +27 -6
  45. package/themes/kiosk/src/components/BusinessController/styles.tsx +1 -1
  46. package/themes/kiosk/src/components/BusinessProductsListing/index.tsx +48 -21
  47. package/themes/kiosk/src/components/Cart/index.tsx +98 -24
  48. package/themes/kiosk/src/components/Cart/styles.tsx +6 -0
  49. package/themes/kiosk/src/components/CartBottomSheet/index.tsx +1 -1
  50. package/themes/kiosk/src/components/CartBottomSheet/styles.tsx +1 -1
  51. package/themes/kiosk/src/components/CartContent/index.tsx +13 -3
  52. package/themes/kiosk/src/components/CartItem/index.tsx +20 -8
  53. package/themes/kiosk/src/components/CategoriesMenu/index.tsx +6 -5
  54. package/themes/kiosk/src/components/CustomerName/index.tsx +89 -88
  55. package/themes/kiosk/src/components/Intro/index.tsx +13 -13
  56. package/themes/kiosk/src/components/LanguageSelector/index.tsx +12 -8
  57. package/themes/kiosk/src/components/NavBar/index.tsx +14 -14
  58. package/themes/kiosk/src/components/OptionCard/index.tsx +1 -1
  59. package/themes/kiosk/src/components/OrderDetails/index.tsx +136 -41
  60. package/themes/kiosk/src/components/OrderDetails/styles.tsx +5 -0
  61. package/themes/kiosk/src/components/OrderSummary/index.tsx +1 -1
  62. package/themes/kiosk/src/components/OrderTypeCardSelector/index.tsx +10 -12
  63. package/themes/kiosk/src/components/ProductForm/index.tsx +174 -125
  64. package/themes/kiosk/src/components/ProductForm/styles.tsx +1 -1
  65. package/themes/kiosk/src/components/ProductOption/index.tsx +1 -0
  66. package/themes/kiosk/src/components/ProductOption/styles.tsx +1 -0
  67. package/themes/kiosk/src/components/UpsellingProducts/index.tsx +48 -34
  68. package/themes/kiosk/src/components/shared/OButton.tsx +5 -18
  69. package/themes/kiosk/src/components/shared/OCard.tsx +112 -78
  70. package/themes/kiosk/src/types/index.d.ts +2 -0
  71. package/themes/original/index.tsx +179 -0
  72. package/themes/original/src/components/AddressForm/index.tsx +15 -10
  73. package/themes/original/src/components/AddressList/index.tsx +56 -18
  74. package/themes/original/src/components/AppleLogin/index.tsx +117 -78
  75. package/themes/original/src/components/BusinessBasicInformation/index.tsx +96 -45
  76. package/themes/original/src/components/BusinessBasicInformation/styles.tsx +28 -1
  77. package/themes/original/src/components/BusinessController/index.tsx +52 -22
  78. package/themes/original/src/components/BusinessController/styles.tsx +22 -0
  79. package/themes/original/src/components/BusinessFeaturedController/index.tsx +20 -1
  80. package/themes/original/src/components/BusinessFeaturedController/styles.tsx +23 -0
  81. package/themes/original/src/components/BusinessListingSearch/index.tsx +4 -0
  82. package/themes/original/src/components/BusinessMenuList/index.tsx +11 -4
  83. package/themes/original/src/components/BusinessPreorder/index.tsx +141 -121
  84. package/themes/original/src/components/BusinessProductsCategories/index.tsx +7 -5
  85. package/themes/original/src/components/BusinessProductsList/index.tsx +129 -22
  86. package/themes/original/src/components/BusinessProductsList/styles.tsx +29 -2
  87. package/themes/original/src/components/BusinessProductsListing/index.tsx +92 -37
  88. package/themes/original/src/components/BusinessProductsListing/styles.tsx +22 -0
  89. package/themes/original/src/components/BusinessReviews/index.tsx +4 -25
  90. package/themes/original/src/components/BusinessTypeFilter/index.tsx +1 -2
  91. package/themes/original/src/components/BusinessesListing/index.tsx +49 -58
  92. package/themes/original/src/components/Cart/index.tsx +58 -21
  93. package/themes/original/src/components/CartContent/index.tsx +2 -2
  94. package/themes/original/src/components/Checkout/index.tsx +24 -28
  95. package/themes/original/src/components/CouponControl/index.tsx +1 -0
  96. package/themes/original/src/components/DriverTips/index.tsx +1 -1
  97. package/themes/original/src/components/HighestRatedBusinesses/index.tsx +97 -89
  98. package/themes/original/src/components/Home/index.tsx +1 -1
  99. package/themes/original/src/components/LoginForm/index.tsx +73 -2
  100. package/themes/original/src/components/LoginForm/styles.tsx +6 -1
  101. package/themes/original/src/components/MessageListing/index.tsx +10 -1
  102. package/themes/original/src/components/Messages/index.tsx +50 -45
  103. package/themes/original/src/components/Messages/styles.tsx +1 -3
  104. package/themes/original/src/components/MomentOption/index.tsx +10 -1
  105. package/themes/original/src/components/MomentOption/styles.tsx +1 -1
  106. package/themes/original/src/components/OrderDetails/index.tsx +105 -127
  107. package/themes/original/src/components/OrderDetails/styles.tsx +3 -1
  108. package/themes/original/src/components/OrderProgress/index.tsx +4 -4
  109. package/themes/original/src/components/OrderProgress/styles.tsx +1 -0
  110. package/themes/original/src/components/OrderSummary/index.tsx +35 -2
  111. package/themes/original/src/components/OrderTypeSelector/index.tsx +4 -2
  112. package/themes/original/src/components/OrdersOption/index.tsx +25 -33
  113. package/themes/original/src/components/OrdersOption/styles.tsx +0 -6
  114. package/themes/original/src/components/PaymentOptionWallet/index.tsx +9 -4
  115. package/themes/original/src/components/PaymentOptionWallet/styles.tsx +1 -1
  116. package/themes/original/src/components/PaymentOptions/index.tsx +9 -19
  117. package/themes/original/src/components/PlaceSpot/index.tsx +114 -0
  118. package/themes/original/src/components/PlaceSpot/styles.tsx +11 -0
  119. package/themes/original/src/components/PreviousOrders/index.tsx +19 -13
  120. package/themes/original/src/components/ProductForm/index.tsx +47 -36
  121. package/themes/original/src/components/ProductForm/styles.tsx +2 -2
  122. package/themes/original/src/components/ProductOptionSubOption/index.tsx +5 -3
  123. package/themes/original/src/components/Promotions/index.tsx +234 -0
  124. package/themes/original/src/components/Promotions/styles.tsx +60 -0
  125. package/themes/original/src/components/ReviewOrder/index.tsx +10 -9
  126. package/themes/original/src/components/ReviewProducts/index.tsx +1 -1
  127. package/themes/original/src/components/Sessions/index.tsx +160 -0
  128. package/themes/original/src/components/Sessions/styles.tsx +15 -0
  129. package/themes/original/src/components/SingleProductCard/index.tsx +47 -21
  130. package/themes/original/src/components/SingleProductCard/styles.tsx +28 -1
  131. package/themes/original/src/components/StripeElementsForm/index.tsx +55 -72
  132. package/themes/original/src/components/TaxInformation/index.tsx +17 -7
  133. package/themes/original/src/components/UpsellingProducts/index.tsx +87 -71
  134. package/themes/original/src/components/UserDetails/index.tsx +4 -95
  135. package/themes/original/src/components/UserFormDetails/index.tsx +32 -31
  136. package/themes/original/src/components/UserProfile/index.tsx +70 -20
  137. package/themes/original/src/components/UserProfileForm/index.tsx +28 -24
  138. package/themes/original/src/components/VerifyPhone/index.tsx +10 -7
  139. package/themes/original/src/components/VerifyPhone/styles.tsx +2 -1
  140. package/themes/original/src/components/Wallets/index.tsx +75 -8
  141. package/themes/original/src/components/Wallets/styles.tsx +21 -0
  142. package/themes/original/src/components/shared/HeaderTitle.tsx +21 -0
  143. package/themes/original/src/components/shared/index.tsx +2 -0
  144. package/themes/original/src/config/constants.tsx +6 -6
  145. package/themes/original/src/types/index.tsx +78 -25
  146. package/themes/original/src/utils/index.tsx +12 -2
  147. package/themes/single-business/src/components/AddressList/index.tsx +1 -1
  148. package/themes/single-business/src/components/OrderTypeSelector/index.tsx +6 -6
  149. package/themes/single-business/src/components/UserProfile/index.tsx +1 -1
  150. package/themes/uber-eats/src/components/BusinessesListing/index.tsx +1 -1
  151. package/src/components/StripeMethodForm/index.tsx +0 -168
@@ -1,14 +1,11 @@
1
1
  import React, { useState, useEffect } from 'react';
2
- import { View, StyleSheet, BackHandler, KeyboardAvoidingView, Platform, Linking } from 'react-native';
3
- import Spinner from 'react-native-loading-spinner-overlay';
2
+ import { View, StyleSheet, BackHandler, Platform, Linking } from 'react-native';
4
3
  import LinearGradient from 'react-native-linear-gradient';
5
- import { Messages } from '../Messages';
6
4
  import {
7
5
  useLanguage,
8
6
  OrderDetails as OrderDetailsConTableoller,
9
7
  useUtils,
10
- useConfig,
11
- useSession,
8
+ useConfig
12
9
  } from 'ordering-components/native';
13
10
  import { useTheme } from 'styled-components/native';
14
11
  import {
@@ -16,14 +13,10 @@ import {
16
13
  Header,
17
14
  OrderContent,
18
15
  OrderBusiness,
19
- Logo,
20
16
  OrderData,
21
17
  OrderInfo,
22
- OrderStatus,
23
18
  StaturBar,
24
- StatusImage,
25
19
  OrderCustomer,
26
- CustomerPhoto,
27
20
  InfoBlock,
28
21
  HeaderInfo,
29
22
  Customer,
@@ -31,17 +24,16 @@ import {
31
24
  Table,
32
25
  OrderBill,
33
26
  Total,
34
- NavBack,
35
27
  Icons,
36
28
  OrderDriver,
37
29
  Map,
38
30
  Divider,
31
+ OrderAction
39
32
  } from './styles';
40
33
  import { OButton, OIcon, OModal, OText } from '../shared';
41
34
  import { ProductItemAccordion } from '../ProductItemAccordion';
42
35
  import { TouchableOpacity } from 'react-native-gesture-handler';
43
36
  import { OrderDetailsParams } from '../../types';
44
- import { USER_TYPE } from '../../config/constants';
45
37
  import { GoogleMap } from '../GoogleMap';
46
38
  import { verifyDecimals } from '../../utils';
47
39
  import { OSRow } from '../OrderSummary/styles';
@@ -55,9 +47,11 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
55
47
  messages,
56
48
  setMessages,
57
49
  readMessages,
58
- messagesReadList,
59
50
  isFromCheckout,
60
51
  driverLocation,
52
+ onNavigationRedirect,
53
+ reorderState,
54
+ handleReorder
61
55
  } = props;
62
56
 
63
57
  const theme = useTheme();
@@ -92,19 +86,12 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
92
86
 
93
87
  const [, t] = useLanguage();
94
88
  const [{ parsePrice, parseNumber, parseDate }] = useUtils();
95
- const [{ user }] = useSession();
96
89
  const [{ configs }] = useConfig();
97
-
98
- const [openModalForBusiness, setOpenModalForBusiness] = useState(false);
99
- const [openModalForDriver, setOpenModalForDriver] = useState(false);
100
90
  const [isReviewed, setIsReviewed] = useState(false)
101
- const [unreadAlert, setUnreadAlert] = useState({
102
- business: false,
103
- driver: false,
104
- });
105
91
  const [openTaxModal, setOpenTaxModal] = useState<any>({ open: false, tax: null, type: '' })
106
92
 
107
93
  const { order, businessData } = props.order;
94
+ const mapValidStatuses = [9, 19, 23]
108
95
 
109
96
  const walletName: any = {
110
97
  cash: {
@@ -293,18 +280,18 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
293
280
  percentage: 95,
294
281
  image: theme.images.order.status7,
295
282
  },
296
- {
297
- key: 22,
298
- value: t('ORDER_LOOKING_FOR_DRIVER', 'Looking for driver'),
299
- slug: 'ORDER_LOOKING_FOR_DRIVER',
300
- percentage: 35,
301
- image: theme.images.order.status8
283
+ {
284
+ key: 22,
285
+ value: t('ORDER_LOOKING_FOR_DRIVER', 'Looking for driver'),
286
+ slug: 'ORDER_LOOKING_FOR_DRIVER',
287
+ percentage: 35,
288
+ image: theme.images.order.status8
302
289
  },
303
- {
304
- key: 23,
305
- value: t('ORDER_DRIVER_ON_WAY', 'Driver on way'),
306
- slug: 'ORDER_DRIVER_ON_WAY',
307
- percentage: 45,
290
+ {
291
+ key: 23,
292
+ value: t('ORDER_DRIVER_ON_WAY', 'Driver on way'),
293
+ slug: 'ORDER_DRIVER_ON_WAY',
294
+ percentage: 45,
308
295
  image: theme.images.order.status8
309
296
  }
310
297
  ];
@@ -314,38 +301,24 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
314
301
  return objectStatus && objectStatus;
315
302
  };
316
303
 
317
- const handleOpenMessagesForBusiness = () => {
318
- setOpenModalForBusiness(true);
319
- readMessages && readMessages();
320
- setUnreadAlert({ ...unreadAlert, business: false });
321
- };
322
-
323
- const handleOpenMessagesForDriver = () => {
324
- setOpenModalForDriver(true);
304
+ const handleGoToMessages = (type: string) => {
325
305
  readMessages && readMessages();
326
- setUnreadAlert({ ...unreadAlert, driver: false });
327
- };
328
-
329
- const unreadMessages = () => {
330
- const length = messages?.messages.length;
331
- const unreadLength = order?.unread_count;
332
- const unreadedMessages = messages.messages.slice(
333
- length - unreadLength,
334
- length,
335
- );
336
- const business = unreadedMessages.some((message: any) =>
337
- message?.can_see?.includes(2),
338
- );
339
- const driver = unreadedMessages.some((message: any) =>
340
- message?.can_see?.includes(4),
341
- );
342
- setUnreadAlert({ business, driver });
343
- };
344
-
345
- const handleCloseModal = () => {
346
- setOpenModalForBusiness(false);
347
- setOpenModalForDriver(false);
348
- };
306
+ navigation.navigate(
307
+ 'MessageDetails',
308
+ {
309
+ type,
310
+ order,
311
+ messages,
312
+ setMessages,
313
+ orderId: order?.id,
314
+ business: type === 'business',
315
+ driver: type === 'driver',
316
+ onClose: () => navigation?.canGoBack()
317
+ ? navigation.goBack()
318
+ : navigation.navigate('BottomTab', { screen: 'MyOrders' }),
319
+ }
320
+ )
321
+ }
349
322
 
350
323
  const handleArrowBack: any = () => {
351
324
  if (!isFromCheckout) {
@@ -387,6 +360,16 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
387
360
  )
388
361
  }
389
362
 
363
+
364
+ useEffect(() => {
365
+ if (reorderState?.error) {
366
+ navigation.navigate('Business', { store: businessData?.slug })
367
+ }
368
+ if (!reorderState?.error && reorderState?.result?.uuid) {
369
+ onNavigationRedirect && onNavigationRedirect('CheckoutNavigator', { cartUuid: reorderState?.result.uuid })
370
+ }
371
+ }, [reorderState])
372
+
390
373
  useEffect(() => {
391
374
  BackHandler.addEventListener('hardwareBackPress', handleArrowBack);
392
375
  return () => {
@@ -394,14 +377,6 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
394
377
  };
395
378
  }, []);
396
379
 
397
- useEffect(() => {
398
- if (messagesReadList?.length) {
399
- openModalForBusiness
400
- ? setUnreadAlert({ ...unreadAlert, business: false })
401
- : setUnreadAlert({ ...unreadAlert, driver: false });
402
- }
403
- }, [messagesReadList]);
404
-
405
380
  const locations = [
406
381
  {
407
382
  ...order?.driver?.location,
@@ -430,10 +405,6 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
430
405
  }
431
406
  }, [driverLocation]);
432
407
 
433
- useEffect(() => {
434
- console.log('order: ', order)
435
- }, [order]);
436
-
437
408
  return (
438
409
  <OrderDetailsContainer keyboardShouldPersistTaps="handled">
439
410
  {(!order || Object.keys(order).length === 0) && (
@@ -481,7 +452,7 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
481
452
  <PlaceholderLine width={65} height={10} />
482
453
  <PlaceholderLine width={80} height={10} />
483
454
  <PlaceholderLine width={70} height={10} />
484
- <View style={{marginTop: 10}}>
455
+ <View style={{ marginTop: 10 }}>
485
456
  <PlaceholderLine width={60} height={20} />
486
457
  <PlaceholderLine width={40} height={10} />
487
458
  </View>
@@ -594,21 +565,23 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
594
565
  {order?.business?.name}
595
566
  </OText>
596
567
  <Icons>
597
- <TouchableOpacity
598
- onPress={() => order?.business?.cellphone &&
599
- Linking.openURL(`tel:${order?.business?.cellphone}`)
600
- }
601
- style={{ paddingEnd: 5 }}
602
- >
603
- <OIcon
604
- src={theme.images.general.phone}
605
- width={16}
606
- color={theme.colors.disabled}
607
- />
608
- </TouchableOpacity>
568
+ {!!order?.business?.cellphone && (
569
+ <TouchableOpacity
570
+ onPress={() => order?.business?.cellphone &&
571
+ Linking.openURL(`tel:${order?.business?.cellphone}`)
572
+ }
573
+ style={{ paddingEnd: 5 }}
574
+ >
575
+ <OIcon
576
+ src={theme.images.general.phone}
577
+ width={16}
578
+ color={theme.colors.disabled}
579
+ />
580
+ </TouchableOpacity>
581
+ )}
609
582
  <TouchableOpacity
610
583
  style={{ paddingStart: 5 }}
611
- onPress={() => handleOpenMessagesForBusiness()}>
584
+ onPress={() => handleGoToMessages('business')}>
612
585
  <OIcon
613
586
  src={theme.images.general.chat}
614
587
  width={16}
@@ -624,13 +597,15 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
624
597
  mBottom={2}>
625
598
  {order?.business?.email}
626
599
  </OText>
627
- <OText
628
- size={12}
629
- lineHeight={18}
630
- color={theme.colors.textNormal}
631
- mBottom={2}>
632
- {order?.business?.cellphone}
633
- </OText>
600
+ {!!order?.business?.cellphone && (
601
+ <OText
602
+ size={12}
603
+ lineHeight={18}
604
+ color={theme.colors.textNormal}
605
+ mBottom={2}>
606
+ {order?.business?.cellphone}
607
+ </OText>
608
+ )}
634
609
  <OText size={12} lineHeight={18} color={theme.colors.textNormal}>
635
610
  {order?.business?.address}
636
611
  </OText>
@@ -698,7 +673,7 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
698
673
  )}
699
674
  {order?.driver && (
700
675
  <>
701
- {order?.driver?.location && parseInt(order?.status) === 9 && (
676
+ {order?.driver?.location && mapValidStatuses.includes(parseInt(order?.status)) && (
702
677
  <Map>
703
678
  <GoogleMap
704
679
  location={order?.driver?.location}
@@ -735,7 +710,7 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
735
710
  </OText>
736
711
  <Icons>
737
712
  <TouchableOpacity
738
- onPress={() => handleOpenMessagesForDriver()}>
713
+ onPress={() => handleGoToMessages('driver')}>
739
714
  <OIcon
740
715
  src={theme.images.general.chat}
741
716
  width={16}
@@ -776,16 +751,37 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
776
751
  'Once business accepts your order, we will send you an email, thank you!',
777
752
  )}
778
753
  </OText>
779
- <OButton
780
- text={t('YOUR_ORDERS', 'Your Orders')}
781
- textStyle={{ fontSize: 14, color: theme.colors.primary }}
782
- imgRightSrc={null}
783
- borderColor={theme.colors.primary}
784
- bgColor={theme.colors.clear}
785
- style={{ borderRadius: 7.6, borderWidth: 1, height: 44, shadowOpacity: 0 }}
786
- parentStyle={{ marginTop: 29, width: '50%' }}
787
- onClick={() => navigation.navigate('BottomTab', { screen: 'MyOrders' })}
788
- />
754
+ <OrderAction>
755
+ <OButton
756
+ text={t('YOUR_ORDERS', 'Your Orders')}
757
+ textStyle={{ fontSize: 14, color: theme.colors.primary }}
758
+ imgRightSrc={null}
759
+ borderColor={theme.colors.primary}
760
+ bgColor={theme.colors.clear}
761
+ style={{ borderRadius: 7.6, borderWidth: 1, height: 44, shadowOpacity: 0 }}
762
+ parentStyle={{ marginTop: 29, marginEnd: 15 }}
763
+ onClick={() => navigation.navigate('BottomTab', { screen: 'MyOrders' })}
764
+ />
765
+ {(
766
+ parseInt(order?.status) === 1 ||
767
+ parseInt(order?.status) === 2 ||
768
+ parseInt(order?.status) === 5 ||
769
+ parseInt(order?.status) === 6 ||
770
+ parseInt(order?.status) === 10 ||
771
+ parseInt(order?.status) === 11 ||
772
+ parseInt(order?.status) === 12
773
+ ) && (
774
+ <OButton
775
+ text={order.id === reorderState?.loading ? t('LOADING', 'Loading..') : t('REORDER', 'Reorder')}
776
+ textStyle={{ fontSize: 14, color: theme.colors.primary }}
777
+ imgRightSrc={null}
778
+ borderColor='transparent'
779
+ bgColor={theme.colors.primary + 10}
780
+ style={{ borderRadius: 7.6, borderWidth: 1, height: 44, shadowOpacity: 0, marginTop: 29 }}
781
+ onClick={() => handleReorder && handleReorder(order.id)}
782
+ />
783
+ )}
784
+ </OrderAction>
789
785
  </HeaderInfo>
790
786
  <OrderProducts>
791
787
  {order?.products?.length &&
@@ -895,7 +891,7 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
895
891
  <OSRow>
896
892
  <OText size={12} lineHeight={18} weight={'400'} color={theme.colors.textNormal} numberOfLines={1}>
897
893
  {fee.name || t('INHERIT_FROM_BUSINESS', 'Inherit from business')}
898
- ({fee?.fixed > 0 && `${parsePrice(fee?.fixed)} + `}{fee.percentage}%){' '}
894
+ ({fee?.fixed > 0 && `${parsePrice(fee?.fixed)}${fee.percentage > 0 ? ' + ' : ''}`}{fee.percentage > 0 && `${fee.percentage}%`}){' '}
899
895
  </OText>
900
896
  <TouchableOpacity onPress={() => setOpenTaxModal({ open: true, data: fee, type: 'fee' })}>
901
897
  <AntIcon name='infocirlceo' size={16} color={theme.colors.primary} />
@@ -978,7 +974,7 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
978
974
  marginTop: 10
979
975
  }}
980
976
  >
981
- {order?.payment_events?.map((event: any) => (
977
+ {order?.payment_events?.map((event: any) => event.amount > 0 && (
982
978
  <View
983
979
  key={event.id}
984
980
  style={{
@@ -1018,28 +1014,10 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
1018
1014
  </OrderContent>
1019
1015
  </>
1020
1016
  )}
1021
- <OModal
1022
- open={openModalForBusiness || openModalForDriver}
1023
- entireModal
1024
- customClose
1025
- onClose={() => handleCloseModal()}>
1026
- <Messages
1027
- type={openModalForBusiness ? USER_TYPE.BUSINESS : USER_TYPE.DRIVER}
1028
- orderId={order?.id}
1029
- messages={messages}
1030
- order={order}
1031
- business={openModalForBusiness}
1032
- driver={openModalForDriver}
1033
- setMessages={setMessages}
1034
- onClose={handleCloseModal}
1035
- />
1036
- </OModal>
1037
1017
  <OModal
1038
1018
  open={openTaxModal.open}
1039
1019
  onClose={() => setOpenTaxModal({ open: false, data: null, type: '' })}
1040
1020
  entireModal
1041
- title={`${openTaxModal.data?.name ||
1042
- t('INHERIT_FROM_BUSINESS', 'Inherit from business')} ${openTaxModal.data?.rate_type !== 2 ? `(${typeof openTaxModal.data?.rate === 'number' ? `${openTaxModal.data?.rate}%` : `${parsePrice(openTaxModal.data?.fixed ?? 0)} + ${openTaxModal.data?.percentage}%`})` : ''} `}
1043
1021
  >
1044
1022
  <TaxInformation
1045
1023
  type={openTaxModal.type}
@@ -5,7 +5,6 @@ export const OrderDetailsContainer = styled.ScrollView`
5
5
  `
6
6
 
7
7
  export const NavBack = styled.TouchableOpacity`
8
-
9
8
  `
10
9
 
11
10
 
@@ -125,3 +124,6 @@ export const Divider = styled.View`
125
124
  margin-top: 5px;
126
125
  margin-bottom: 5px;
127
126
  `
127
+ export const OrderAction = styled.View`
128
+ flex-direction: row;
129
+ `
@@ -98,7 +98,7 @@ const OrderProgressUI = (props: any) => {
98
98
  { key: 20, value: t('ORDER_CUSTOMER_ALMOST_ARRIVED_BUSINESS', theme?.defaultLanguages?.ORDER_CUSTOMER_ALMOST_ARRIVED_BUSINESS || 'Customer almost arrived to business'), slug: 'ORDER_CUSTOMER_ALMOST_ARRIVED_BUSINESS', percentage: 90 },
99
99
  { key: 21, value: t('ORDER_CUSTOMER_ARRIVED_BUSINESS', theme?.defaultLanguages?.ORDER_CUSTOMER_ARRIVED_BUSINESS || 'Customer arrived to business'), slug: 'ORDER_CUSTOMER_ARRIVED_BUSINESS', percentage: 95 },
100
100
  { key: 22, value: t('ORDER_LOOKING_FOR_DRIVER', theme?.defaultLanguages?.ORDER_LOOKING_FOR_DRIVER || 'Looking for driver'), slug: 'ORDER_LOOKING_FOR_DRIVER', percentage: 35 },
101
- { key: 23, value: t('ORDER_DRIVER_ON_WAY', theme?.defaultLanguages?.ORDER_DRIVER_ON_WAY || 'Driver on way'), slug: 'ORDER_DRIVER_ON_WAY', percentage: 45 }
101
+ { key: 23, value: t('ORDER_DRIVER_ON_WAY', theme?.defaultLanguages?.ORDER_DRIVER_ON_WAY || 'Driver on way'), slug: 'ORDER_DRIVER_ON_WAY', percentage: 45 }
102
102
  ]
103
103
 
104
104
  const objectStatus = orderStatus.find((o) => o.key === status)
@@ -131,7 +131,7 @@ const OrderProgressUI = (props: any) => {
131
131
 
132
132
  useEffect(() => {
133
133
  if (isFocused) {
134
- loadOrders()
134
+ loadOrders(false, false, false, true)
135
135
  }
136
136
  }, [isFocused])
137
137
 
@@ -188,7 +188,7 @@ const OrderProgressUI = (props: any) => {
188
188
  <ProgressBar style={{ width: getOrderStatus(lastOrder.status)?.percentage ? `${getOrderStatus(lastOrder.status)?.percentage}%` : '0%' }} />
189
189
  </ProgressContentWrapper>
190
190
  <ProgressTextWrapper>
191
- <OText size={12}>{getOrderStatus(lastOrder.status)?.value}</OText>
191
+ <OText size={12} style={{ width: '50%' }}>{getOrderStatus(lastOrder.status)?.value}</OText>
192
192
  <TimeWrapper>
193
193
  <OText size={11}>{t('ESTIMATED_DELIVERY', 'Estimated delivery')}</OText>
194
194
  <OText size={11}>
@@ -218,7 +218,7 @@ export const OrderProgress = (props: any) => {
218
218
  const orderProgressProps = {
219
219
  ...props,
220
220
  UIComponent: OrderProgressUI,
221
- orderStatus: [0, 3, 4, 7, 8, 9, 13, 14, 15, 18, 19, 20, 21, 22, 23],
221
+ orderStatus: [0, 3, 4, 7, 8, 9, 13, 14, 18, 19, 20, 21, 22, 23],
222
222
  useDefualtSessionManager: true,
223
223
  paginationSettings: {
224
224
  initialPage: 1,
@@ -20,6 +20,7 @@ export const ProgressTextWrapper = styled.View`
20
20
  flex-direction: row;
21
21
  justify-content: space-between;
22
22
  align-items: center;
23
+ width: 100%;
23
24
  `
24
25
 
25
26
  export const OrderInfoWrapper = styled.View`
@@ -26,6 +26,7 @@ import AntIcon from 'react-native-vector-icons/AntDesign'
26
26
  import { TaxInformation } from '../TaxInformation';
27
27
  import { TouchableOpacity } from 'react-native';
28
28
  import { OAlert } from '../../../../../src/components/shared'
29
+ import { PlaceSpot } from '../PlaceSpot'
29
30
 
30
31
  const OrderSummaryUI = (props: any) => {
31
32
  const {
@@ -49,7 +50,9 @@ const OrderSummaryUI = (props: any) => {
49
50
  const [validationFields] = useValidationFields();
50
51
  const [openTaxModal, setOpenTaxModal] = useState<any>({ open: false, data: null, type: '' })
51
52
  const [confirm, setConfirm] = useState<any>({ open: false, content: null, handleOnAccept: null, id: null, title: null })
53
+ const [openPlaceModal, setOpenPlaceModal] = useState(false)
52
54
  const isCouponEnabled = validationFields?.fields?.checkout?.coupon?.enabled;
55
+ const placeSpotTypes = [3, 4]
53
56
 
54
57
  const handleDeleteClick = (product: any) => {
55
58
  removeProduct(product, cart)
@@ -109,7 +112,7 @@ const OrderSummaryUI = (props: any) => {
109
112
  {cart?.products?.length > 0 && (
110
113
  <>
111
114
  <OSProductList>
112
- {cart?.products.map((product: any) => (
115
+ {cart?.products?.map((product: any) => (
113
116
  <ProductItemAccordion
114
117
  key={product.code}
115
118
  product={product}
@@ -199,7 +202,7 @@ const OrderSummaryUI = (props: any) => {
199
202
  <OSRow>
200
203
  <OText size={12} numberOfLines={1}>
201
204
  {fee.name || t('INHERIT_FROM_BUSINESS', 'Inherit from business')}{' '}
202
- ({parsePrice(fee?.fixed)} + {fee?.percentage}%){' '}
205
+ ({fee?.fixed > 0 && `${parsePrice(fee?.fixed)}${fee.percentage > 0 ? ' + ' : ''}`}{fee.percentage > 0 && `${fee.percentage}%`}){' '}
203
206
  </OText>
204
207
  <TouchableOpacity onPress={() => setOpenTaxModal({ open: true, data: fee, type: 'fee' })} >
205
208
  <AntIcon name='infocirlceo' size={16} color={theme.colors.primary} />
@@ -301,6 +304,24 @@ const OrderSummaryUI = (props: any) => {
301
304
  </OSTable>
302
305
  </View>
303
306
  )}
307
+ {placeSpotTypes.includes(orderState?.options?.type) && (
308
+ <OSTable style={{ marginTop: 15 }}>
309
+ <OText size={14} lineHeight={21} weight={'600'}>
310
+ {t('SPOT', 'Spot')}: {cart?.place?.name || t('NO_SELECTED', 'No selected')}
311
+ </OText>
312
+ <TouchableOpacity onPress={() => setOpenPlaceModal(true)}>
313
+ <OText
314
+ size={14}
315
+ lineHeight={21}
316
+ weight={'600'}
317
+ color={theme.colors.primary}
318
+ style={{ textDecorationLine: 'underline' }}
319
+ >
320
+ {t('EDIT', 'Edit')}
321
+ </OText>
322
+ </TouchableOpacity>
323
+ </OSTable>
324
+ )}
304
325
  {cart?.status !== 2 && (
305
326
  <OSTable>
306
327
  <View style={{ width: '100%', marginTop: 20 }}>
@@ -349,6 +370,18 @@ const OrderSummaryUI = (props: any) => {
349
370
  products={cart?.products}
350
371
  />
351
372
  </OModal>
373
+ <OModal
374
+ open={openPlaceModal}
375
+ title={t('CHOOSE_YOUR_SPOT', 'Choose your spot')}
376
+ onClose={() => setOpenPlaceModal(false)}
377
+ entireModal
378
+ >
379
+ <PlaceSpot
380
+ cart={cart}
381
+ isOpenPlaceSpot={openPlaceModal}
382
+ setOpenPlaceModal={setOpenPlaceModal}
383
+ />
384
+ </OModal>
352
385
  <OAlert
353
386
  open={confirm.open}
354
387
  title={confirm.title}
@@ -19,7 +19,8 @@ const OrderTypeSelectorUI = (props: OrderTypeSelectParams) => {
19
19
  typeSelected,
20
20
  defaultValue,
21
21
  configTypes,
22
- orderTypes
22
+ orderTypes,
23
+ setOrderTypeValue
23
24
  } = props
24
25
 
25
26
  const theme = useTheme();
@@ -39,6 +40,7 @@ const OrderTypeSelectorUI = (props: OrderTypeSelectParams) => {
39
40
 
40
41
  const handleChangeOrderTypeCallback = (orderType: number) => {
41
42
  if (!orderState.loading) {
43
+ setOrderTypeValue && setOrderTypeValue(orderType)
42
44
  handleChangeOrderType(orderType)
43
45
  goToBack();
44
46
  }
@@ -51,7 +53,7 @@ const OrderTypeSelectorUI = (props: OrderTypeSelectParams) => {
51
53
  btnStyle={{ paddingLeft: 0 }}
52
54
  paddingTop={0}
53
55
  style={{ paddingBottom: 0 }}
54
- title={t('HOW_WILL_YOUR_ORDER_TYPE', 'How will your order type?')}
56
+ title={t('HOW_WILL_YOU_DELIVERY_TYPE', 'How will your order type?')}
55
57
  titleAlign={'center'}
56
58
  titleStyle={{ fontSize: 14 }}
57
59
  />
@@ -2,12 +2,12 @@ import React, { useState, useEffect } from 'react'
2
2
  import { OrderList, useLanguage, useOrder, ToastType, useToast } from 'ordering-components/native'
3
3
  import { useTheme } from 'styled-components/native';
4
4
  import { useFocusEffect } from '@react-navigation/native'
5
- import { OText, OButton } from '../shared'
5
+ import { OText } from '../shared'
6
6
  import { NotFoundSource } from '../NotFoundSource'
7
7
  import { ActiveOrders } from '../ActiveOrders'
8
8
  import { PreviousOrders } from '../PreviousOrders'
9
9
 
10
- import { OptionTitle, NoOrdersWrapper } from './styles'
10
+ import { OptionTitle } from './styles'
11
11
  import { OrdersOptionParams } from '../../types'
12
12
 
13
13
  import {
@@ -33,7 +33,9 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
33
33
  loadMoreOrders,
34
34
  loadOrders,
35
35
  setOrdersLength,
36
- ordersLength
36
+ ordersLength,
37
+ refreshOrders,
38
+ setRefreshOrders
37
39
  } = props
38
40
 
39
41
  const theme = useTheme();
@@ -95,7 +97,7 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
95
97
  { key: 20, value: t('ORDER_CUSTOMER_ALMOST_ARRIVED_BUSINESS', 'Customer almost arrived to business') },
96
98
  { key: 21, value: t('ORDER_CUSTOMER_ARRIVED_BUSINESS', 'Customer arrived to business') },
97
99
  { key: 22, value: t('ORDER_LOOKING_FOR_DRIVER', 'Looking for driver') },
98
- { key: 23, value: t('ORDER_DRIVER_ON_WAY', 'Driver on way') }
100
+ { key: 23, value: t('ORDER_DRIVER_ON_WAY', 'Driver on way') }
99
101
  ]
100
102
 
101
103
  const objectStatus = orderStatus.find((o) => o.key === status)
@@ -105,9 +107,9 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
105
107
 
106
108
  useFocusEffect(
107
109
  React.useCallback(() => {
108
- loadOrders()
110
+ loadOrders(false, false, false, true)
109
111
  }, [navigation])
110
- )
112
+ )
111
113
 
112
114
  useEffect(() => {
113
115
  const hasMore = pagination?.totalPages && pagination?.currentPage !== pagination?.totalPages
@@ -128,23 +130,16 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
128
130
  }
129
131
  }, [orders, activeOrders])
130
132
 
133
+ useEffect(() => {
134
+ if(refreshOrders){
135
+ loadOrders(false, false, false, true)
136
+ setRefreshOrders && setRefreshOrders(false)
137
+ }
138
+ }, [refreshOrders])
139
+
131
140
  return (
132
141
  <>
133
- {!loading && ordersLength.activeOrdersLength === 0 && ordersLength.previousOrdersLength === 0 && !activeOrders && (
134
- <NoOrdersWrapper>
135
- <OText size={14} numberOfLines={1}>
136
- {t('YOU_DONT_HAVE_ORDERS', 'You don\'t have any orders')}
137
- </OText>
138
- <OButton
139
- text={t('ORDER_NOW', 'Order now')}
140
- onClick={() => onNavigationRedirect && onNavigationRedirect('BusinessList')}
141
- textStyle={{ color: 'white', fontSize: 14 }}
142
- style={{ borderRadius: 7.6, marginBottom: 10, marginTop: 10, height: 44, paddingLeft: 10, paddingRight: 10 }}
143
- />
144
-
145
- </NoOrdersWrapper>
146
- )}
147
- {(ordersLength.activeOrdersLength > 0 || ordersLength.previousOrdersLength > 0) && (
142
+ {(orders.length > 0) && (
148
143
  <>
149
144
  <OptionTitle>
150
145
  <OText size={16} lineHeight={24} weight={'500'} color={theme.colors.textNormal} mBottom={10} >
@@ -155,18 +150,15 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
155
150
  : t('PAST', 'Past'))}
156
151
  </OText>
157
152
  </OptionTitle>
158
- {!(ordersLength.activeOrdersLength === 0 && ordersLength.previousOrdersLength === 0) &&
159
- !loading &&
160
- orders.filter((order: any) => orderStatus.includes(order.status)).length === 0 &&
161
- (
162
- <NotFoundSource
163
- content={t('NO_RESULTS_FOUND', 'Sorry, no results found')}
164
- image={imageFails}
165
- conditioned
166
- />
167
- )}
168
153
  </>
169
154
  )}
155
+ {!loading && orders.length === 0 && (
156
+ <NotFoundSource
157
+ content={t('NO_RESULTS_FOUND', 'Sorry, no results found')}
158
+ image={imageFails}
159
+ conditioned
160
+ />
161
+ )}
170
162
  {loading && (
171
163
  <>
172
164
  {!activeOrders ? (
@@ -239,8 +231,8 @@ export const OrdersOption = (props: OrdersOptionParams) => {
239
231
  ...props,
240
232
  UIComponent: OrdersOptionUI,
241
233
  orderStatus: props.preOrders ? [13] : props.activeOrders
242
- ? [0, 3, 4, 7, 8, 9, 14, 15, 18, 19, 20, 21, 22, 23]
243
- : [1, 2, 5, 6, 10, 11, 12, 16, 17],
234
+ ? [0, 3, 4, 7, 8, 9, 14, 18, 19, 20, 21, 22, 23]
235
+ : [1, 2, 5, 6, 10, 11, 12, 15, 16, 17],
244
236
  useDefualtSessionManager: true,
245
237
  }
246
238