ordering-ui-react-native 0.14.85 → 0.14.86-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 (134) hide show
  1. package/package.json +6 -3
  2. package/src/DeliveryApp.tsx +34 -2
  3. package/src/assets/images/no-network.png +0 -0
  4. package/src/components/BusinessTypeFilter/index.tsx +9 -2
  5. package/src/components/BusinessTypeFilter/styles.tsx +1 -1
  6. package/src/components/BusinessesListing/index.tsx +1 -1
  7. package/src/components/Cart/index.tsx +1 -1
  8. package/src/components/Checkout/index.tsx +0 -1
  9. package/src/components/Home/index.tsx +3 -5
  10. package/src/components/LanguageSelector/index.tsx +65 -97
  11. package/src/components/LanguageSelector/styles.tsx +4 -17
  12. package/src/components/Messages/index.tsx +38 -30
  13. package/src/components/MomentOption/index.tsx +3 -1
  14. package/src/components/OrderDetails/index.tsx +26 -5
  15. package/src/components/PaymentOptions/index.tsx +7 -16
  16. package/src/components/PaymentOptionsWebView/index.tsx +123 -124
  17. package/src/components/ProductForm/index.tsx +1 -1
  18. package/src/components/ProductForm/styles.tsx +1 -0
  19. package/src/components/StripeElementsForm/index.tsx +27 -48
  20. package/src/components/UserProfileForm/index.tsx +35 -1
  21. package/src/components/VerifyPhone/styles.tsx +1 -2
  22. package/src/config.json +0 -2
  23. package/src/pages/Checkout.tsx +1 -1
  24. package/src/providers/AlertProvider.tsx +4 -1
  25. package/src/theme.json +2 -1
  26. package/src/types/index.tsx +2 -9
  27. package/src/utils/index.tsx +196 -1
  28. package/themes/business/index.tsx +4 -0
  29. package/themes/business/src/components/Chat/index.tsx +32 -31
  30. package/themes/business/src/components/NetworkError/index.tsx +61 -0
  31. package/themes/business/src/components/NetworkError/styles.tsx +11 -0
  32. package/themes/business/src/components/OrderDetails/Business.tsx +1 -0
  33. package/themes/business/src/components/OrderDetails/OrderHeaderComponent.tsx +85 -17
  34. package/themes/business/src/components/OrdersListManager/index.tsx +871 -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 +351 -59
  38. package/themes/business/src/components/OrdersOption/styles.tsx +95 -7
  39. package/themes/business/src/components/PreviousOrders/index.tsx +65 -46
  40. package/themes/business/src/components/PreviousOrders/styles.tsx +5 -10
  41. package/themes/business/src/components/ReviewCustomer/index.tsx +11 -8
  42. package/themes/business/src/types/index.tsx +4 -0
  43. package/themes/doordash/src/components/BusinessesListing/index.tsx +1 -1
  44. package/themes/doordash/src/components/LoginForm/index.tsx +1 -2
  45. package/themes/instacart/src/components/BusinessesListing/index.tsx +1 -1
  46. package/themes/kiosk/index.tsx +2 -0
  47. package/themes/kiosk/src/components/BusinessController/index.tsx +27 -6
  48. package/themes/kiosk/src/components/BusinessController/styles.tsx +1 -1
  49. package/themes/kiosk/src/components/BusinessProductsListing/index.tsx +51 -24
  50. package/themes/kiosk/src/components/Cart/index.tsx +1 -1
  51. package/themes/kiosk/src/components/CartBottomSheet/index.tsx +1 -1
  52. package/themes/kiosk/src/components/CartBottomSheet/styles.tsx +1 -1
  53. package/themes/kiosk/src/components/CartContent/index.tsx +13 -3
  54. package/themes/kiosk/src/components/CartItem/index.tsx +20 -8
  55. package/themes/kiosk/src/components/CategoriesMenu/index.tsx +7 -5
  56. package/themes/kiosk/src/components/CustomerName/index.tsx +89 -88
  57. package/themes/kiosk/src/components/Intro/index.tsx +13 -13
  58. package/themes/kiosk/src/components/LanguageSelector/index.tsx +12 -8
  59. package/themes/kiosk/src/components/NavBar/index.tsx +14 -14
  60. package/themes/kiosk/src/components/NetworkError/index.tsx +60 -0
  61. package/themes/kiosk/src/components/NetworkError/styles.tsx +11 -0
  62. package/themes/kiosk/src/components/OptionCard/index.tsx +1 -1
  63. package/themes/kiosk/src/components/OrderDetails/index.tsx +2 -2
  64. package/themes/kiosk/src/components/OrderSummary/index.tsx +1 -1
  65. package/themes/kiosk/src/components/OrderTypeCardSelector/index.tsx +10 -12
  66. package/themes/kiosk/src/components/ProductForm/index.tsx +172 -124
  67. package/themes/kiosk/src/components/ProductForm/styles.tsx +1 -1
  68. package/themes/kiosk/src/components/ProductOption/index.tsx +1 -0
  69. package/themes/kiosk/src/components/ProductOption/styles.tsx +1 -0
  70. package/themes/kiosk/src/components/UpsellingProducts/index.tsx +48 -34
  71. package/themes/kiosk/src/components/shared/OButton.tsx +5 -18
  72. package/themes/kiosk/src/components/shared/OCard.tsx +112 -78
  73. package/themes/kiosk/src/types/index.d.ts +4 -0
  74. package/themes/original/index.tsx +26 -6
  75. package/themes/original/src/components/AnalyticsSegment/index.tsx +127 -0
  76. package/themes/original/src/components/BusinessBasicInformation/index.tsx +11 -7
  77. package/themes/original/src/components/BusinessController/index.tsx +3 -3
  78. package/themes/original/src/components/BusinessMenuList/index.tsx +4 -2
  79. package/themes/original/src/components/BusinessPreorder/index.tsx +142 -121
  80. package/themes/original/src/components/BusinessProductsList/index.tsx +50 -6
  81. package/themes/original/src/components/BusinessProductsListing/index.tsx +13 -10
  82. package/themes/original/src/components/BusinessReviews/index.tsx +4 -3
  83. package/themes/original/src/components/BusinessesListing/index.tsx +23 -22
  84. package/themes/original/src/components/Cart/index.tsx +43 -10
  85. package/themes/original/src/components/Checkout/index.tsx +54 -17
  86. package/themes/original/src/components/Checkout/styles.tsx +7 -0
  87. package/themes/original/src/components/CouponControl/index.tsx +1 -0
  88. package/themes/original/src/components/DriverTips/index.tsx +1 -1
  89. package/themes/original/src/components/ForgotPasswordForm/index.tsx +8 -12
  90. package/themes/original/src/components/HighestRatedBusinesses/index.tsx +9 -2
  91. package/themes/original/src/components/LoginForm/index.tsx +83 -68
  92. package/themes/original/src/components/Messages/index.tsx +19 -21
  93. package/themes/original/src/components/MomentOption/index.tsx +127 -152
  94. package/themes/original/src/components/MomentOption/styles.tsx +42 -18
  95. package/themes/original/src/components/NetworkError/index.tsx +61 -0
  96. package/themes/original/src/components/NetworkError/styles.tsx +11 -0
  97. package/themes/original/src/components/OrderDetails/index.tsx +103 -124
  98. package/themes/original/src/components/OrderProgress/index.tsx +2 -3
  99. package/themes/original/src/components/OrderSummary/index.tsx +34 -1
  100. package/themes/original/src/components/OrdersOption/index.tsx +16 -40
  101. package/themes/original/src/components/OrdersOption/styles.tsx +0 -5
  102. package/themes/original/src/components/PaymentOptionWallet/index.tsx +1 -1
  103. package/themes/original/src/components/PaymentOptions/index.tsx +20 -23
  104. package/themes/original/src/components/PhoneInputNumber/index.tsx +15 -8
  105. package/themes/original/src/components/PlaceSpot/index.tsx +114 -0
  106. package/themes/original/src/components/PlaceSpot/styles.tsx +11 -0
  107. package/themes/original/src/components/PreviousOrders/index.tsx +4 -0
  108. package/themes/original/src/components/ProductForm/index.tsx +35 -20
  109. package/themes/original/src/components/ProductForm/styles.tsx +0 -1
  110. package/themes/original/src/components/ProductOptionSubOption/index.tsx +81 -74
  111. package/themes/original/src/components/ReviewDriver/index.tsx +315 -0
  112. package/themes/original/src/components/ReviewDriver/styles.tsx +38 -0
  113. package/themes/original/src/components/ReviewOrder/index.tsx +307 -186
  114. package/themes/original/src/components/ReviewOrder/styles.tsx +24 -13
  115. package/themes/original/src/components/ReviewProducts/index.tsx +116 -0
  116. package/themes/original/src/components/ReviewProducts/styles.tsx +16 -0
  117. package/themes/original/src/components/SignupForm/index.tsx +173 -154
  118. package/themes/original/src/components/SingleProductCard/index.tsx +6 -13
  119. package/themes/original/src/components/SingleProductCard/styles.tsx +1 -1
  120. package/themes/original/src/components/SingleProductReview/index.tsx +166 -0
  121. package/themes/original/src/components/SingleProductReview/styles.tsx +27 -0
  122. package/themes/original/src/components/StripeElementsForm/index.tsx +55 -72
  123. package/themes/original/src/components/UpsellingProducts/index.tsx +6 -6
  124. package/themes/original/src/components/UserDetails/index.tsx +4 -95
  125. package/themes/original/src/components/UserFormDetails/index.tsx +2 -14
  126. package/themes/original/src/components/UserProfile/index.tsx +13 -6
  127. package/themes/original/src/components/UserProfileForm/index.tsx +16 -8
  128. package/themes/original/src/components/VerifyPhone/index.tsx +10 -7
  129. package/themes/original/src/components/VerifyPhone/styles.tsx +2 -1
  130. package/themes/original/src/layouts/FloatingBottomContainer.tsx +26 -0
  131. package/themes/original/src/types/index.tsx +47 -10
  132. package/themes/single-business/src/components/OrderTypeSelector/index.tsx +5 -5
  133. package/themes/uber-eats/src/components/BusinessesListing/index.tsx +1 -1
  134. package/src/components/StripeMethodForm/index.tsx +0 -163
@@ -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,16 +86,8 @@ 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;
@@ -293,18 +279,18 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
293
279
  percentage: 95,
294
280
  image: theme.images.order.status7,
295
281
  },
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
282
+ {
283
+ key: 22,
284
+ value: t('ORDER_LOOKING_FOR_DRIVER', 'Looking for driver'),
285
+ slug: 'ORDER_LOOKING_FOR_DRIVER',
286
+ percentage: 35,
287
+ image: theme.images.order.status8
302
288
  },
303
- {
304
- key: 23,
305
- value: t('ORDER_DRIVER_ON_WAY', 'Driver on way'),
306
- slug: 'ORDER_DRIVER_ON_WAY',
307
- percentage: 45,
289
+ {
290
+ key: 23,
291
+ value: t('ORDER_DRIVER_ON_WAY', 'Driver on way'),
292
+ slug: 'ORDER_DRIVER_ON_WAY',
293
+ percentage: 45,
308
294
  image: theme.images.order.status8
309
295
  }
310
296
  ];
@@ -314,38 +300,24 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
314
300
  return objectStatus && objectStatus;
315
301
  };
316
302
 
317
- const handleOpenMessagesForBusiness = () => {
318
- setOpenModalForBusiness(true);
319
- readMessages && readMessages();
320
- setUnreadAlert({ ...unreadAlert, business: false });
321
- };
322
-
323
- const handleOpenMessagesForDriver = () => {
324
- setOpenModalForDriver(true);
303
+ const handleGoToMessages = (type: string) => {
325
304
  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
- };
305
+ navigation.navigate(
306
+ 'MessageDetails',
307
+ {
308
+ type,
309
+ order,
310
+ messages,
311
+ setMessages,
312
+ orderId: order?.id,
313
+ business: type === 'business',
314
+ driver: type === 'driver',
315
+ onClose: () => navigation?.canGoBack()
316
+ ? navigation.goBack()
317
+ : navigation.navigate('BottomTab', { screen: 'MyOrders' }),
318
+ }
319
+ )
320
+ }
349
321
 
350
322
  const handleArrowBack: any = () => {
351
323
  if (!isFromCheckout) {
@@ -387,6 +359,16 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
387
359
  )
388
360
  }
389
361
 
362
+
363
+ useEffect(() => {
364
+ if (reorderState?.error) {
365
+ navigation.navigate('Business', { store: businessData?.slug })
366
+ }
367
+ if (!reorderState?.error && reorderState?.result?.uuid) {
368
+ onNavigationRedirect && onNavigationRedirect('CheckoutNavigator', { cartUuid: reorderState?.result.uuid })
369
+ }
370
+ }, [reorderState])
371
+
390
372
  useEffect(() => {
391
373
  BackHandler.addEventListener('hardwareBackPress', handleArrowBack);
392
374
  return () => {
@@ -394,14 +376,6 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
394
376
  };
395
377
  }, []);
396
378
 
397
- useEffect(() => {
398
- if (messagesReadList?.length) {
399
- openModalForBusiness
400
- ? setUnreadAlert({ ...unreadAlert, business: false })
401
- : setUnreadAlert({ ...unreadAlert, driver: false });
402
- }
403
- }, [messagesReadList]);
404
-
405
379
  const locations = [
406
380
  {
407
381
  ...order?.driver?.location,
@@ -430,10 +404,6 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
430
404
  }
431
405
  }, [driverLocation]);
432
406
 
433
- useEffect(() => {
434
- console.log('order: ', order)
435
- }, [order]);
436
-
437
407
  return (
438
408
  <OrderDetailsContainer keyboardShouldPersistTaps="handled">
439
409
  {(!order || Object.keys(order).length === 0) && (
@@ -481,7 +451,7 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
481
451
  <PlaceholderLine width={65} height={10} />
482
452
  <PlaceholderLine width={80} height={10} />
483
453
  <PlaceholderLine width={70} height={10} />
484
- <View style={{marginTop: 10}}>
454
+ <View style={{ marginTop: 10 }}>
485
455
  <PlaceholderLine width={60} height={20} />
486
456
  <PlaceholderLine width={40} height={10} />
487
457
  </View>
@@ -594,21 +564,23 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
594
564
  {order?.business?.name}
595
565
  </OText>
596
566
  <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>
567
+ {!!order?.business?.cellphone && (
568
+ <TouchableOpacity
569
+ onPress={() => order?.business?.cellphone &&
570
+ Linking.openURL(`tel:${order?.business?.cellphone}`)
571
+ }
572
+ style={{ paddingEnd: 5 }}
573
+ >
574
+ <OIcon
575
+ src={theme.images.general.phone}
576
+ width={16}
577
+ color={theme.colors.disabled}
578
+ />
579
+ </TouchableOpacity>
580
+ )}
609
581
  <TouchableOpacity
610
582
  style={{ paddingStart: 5 }}
611
- onPress={() => handleOpenMessagesForBusiness()}>
583
+ onPress={() => handleGoToMessages('business')}>
612
584
  <OIcon
613
585
  src={theme.images.general.chat}
614
586
  width={16}
@@ -624,13 +596,15 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
624
596
  mBottom={2}>
625
597
  {order?.business?.email}
626
598
  </OText>
627
- <OText
628
- size={12}
629
- lineHeight={18}
630
- color={theme.colors.textNormal}
631
- mBottom={2}>
632
- {order?.business?.cellphone}
633
- </OText>
599
+ {!!order?.business?.cellphone && (
600
+ <OText
601
+ size={12}
602
+ lineHeight={18}
603
+ color={theme.colors.textNormal}
604
+ mBottom={2}>
605
+ {order?.business?.cellphone}
606
+ </OText>
607
+ )}
634
608
  <OText size={12} lineHeight={18} color={theme.colors.textNormal}>
635
609
  {order?.business?.address}
636
610
  </OText>
@@ -735,7 +709,7 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
735
709
  </OText>
736
710
  <Icons>
737
711
  <TouchableOpacity
738
- onPress={() => handleOpenMessagesForDriver()}>
712
+ onPress={() => handleGoToMessages('driver')}>
739
713
  <OIcon
740
714
  src={theme.images.general.chat}
741
715
  width={16}
@@ -776,16 +750,37 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
776
750
  'Once business accepts your order, we will send you an email, thank you!',
777
751
  )}
778
752
  </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
- />
753
+ <OrderAction>
754
+ <OButton
755
+ text={t('YOUR_ORDERS', 'Your Orders')}
756
+ textStyle={{ fontSize: 14, color: theme.colors.primary }}
757
+ imgRightSrc={null}
758
+ borderColor={theme.colors.primary}
759
+ bgColor={theme.colors.clear}
760
+ style={{ borderRadius: 7.6, borderWidth: 1, height: 44, shadowOpacity: 0 }}
761
+ parentStyle={{ marginTop: 29, marginEnd: 15 }}
762
+ onClick={() => navigation.navigate('BottomTab', { screen: 'MyOrders' })}
763
+ />
764
+ {(
765
+ parseInt(order?.status) === 1 ||
766
+ parseInt(order?.status) === 2 ||
767
+ parseInt(order?.status) === 5 ||
768
+ parseInt(order?.status) === 6 ||
769
+ parseInt(order?.status) === 10 ||
770
+ parseInt(order?.status) === 11 ||
771
+ parseInt(order?.status) === 12
772
+ ) && (
773
+ <OButton
774
+ text={order.id === reorderState?.loading ? t('LOADING', 'Loading..') : t('REORDER', 'Reorder')}
775
+ textStyle={{ fontSize: 14, color: theme.colors.primary }}
776
+ imgRightSrc={null}
777
+ borderColor='transparent'
778
+ bgColor={theme.colors.primary + 10}
779
+ style={{ borderRadius: 7.6, borderWidth: 1, height: 44, shadowOpacity: 0, marginTop: 29 }}
780
+ onClick={() => handleReorder && handleReorder(order.id)}
781
+ />
782
+ )}
783
+ </OrderAction>
789
784
  </HeaderInfo>
790
785
  <OrderProducts>
791
786
  {order?.products?.length &&
@@ -895,7 +890,7 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
895
890
  <OSRow>
896
891
  <OText size={12} lineHeight={18} weight={'400'} color={theme.colors.textNormal} numberOfLines={1}>
897
892
  {fee.name || t('INHERIT_FROM_BUSINESS', 'Inherit from business')}
898
- ({parsePrice(fee?.fixed)} + {fee.percentage}%){' '}
893
+ ({fee?.fixed > 0 && `${parsePrice(fee?.fixed)} + `}{fee.percentage}%){' '}
899
894
  </OText>
900
895
  <TouchableOpacity onPress={() => setOpenTaxModal({ open: true, data: fee, type: 'fee' })}>
901
896
  <AntIcon name='infocirlceo' size={16} color={theme.colors.primary} />
@@ -978,7 +973,7 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
978
973
  marginTop: 10
979
974
  }}
980
975
  >
981
- {order?.payment_events?.map((event: any) => (
976
+ {order?.payment_events?.map((event: any) => event.amount > 0 && (
982
977
  <View
983
978
  key={event.id}
984
979
  style={{
@@ -1018,22 +1013,6 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
1018
1013
  </OrderContent>
1019
1014
  </>
1020
1015
  )}
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
1016
  <OModal
1038
1017
  open={openTaxModal.open}
1039
1018
  onClose={() => setOpenTaxModal({ open: false, data: null, type: '' })}
@@ -9,7 +9,7 @@ import IconAntDesign from 'react-native-vector-icons/AntDesign'
9
9
  import moment from 'moment';
10
10
  import { OText } from '../shared'
11
11
  import { NotFoundSource } from '../NotFoundSource'
12
- import { View, StyleSheet, TouchableOpacity } from 'react-native'
12
+ import { View, StyleSheet, TouchableOpacity, Platform } from 'react-native'
13
13
  import { Placeholder, Fade, PlaceholderLine } from "rn-placeholder";
14
14
  import FastImage from 'react-native-fast-image'
15
15
  import {
@@ -19,7 +19,6 @@ import {
19
19
  ProgressTextWrapper,
20
20
  OrderInfoWrapper
21
21
  } from './styles'
22
-
23
22
  const OrderProgressUI = (props: any) => {
24
23
  const {
25
24
  orderList,
@@ -139,7 +138,7 @@ const OrderProgressUI = (props: any) => {
139
138
  return (
140
139
  <>
141
140
  {orderList?.loading && (
142
- <Placeholder Animation={Fade} height={160}>
141
+ <Placeholder Animation={Fade} height={Platform.OS === 'ios' ? 147.5 : 158}>
143
142
  <PlaceholderLine height={60} style={{ borderRadius: 8, marginBottom: 10 }} />
144
143
  <PlaceholderLine height={20} style={{ marginBottom: 10 }} />
145
144
  <PlaceholderLine height={40} style={{ borderRadius: 8, marginBottom: 10 }} />
@@ -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)
@@ -276,7 +279,7 @@ const OrderSummaryUI = (props: any) => {
276
279
  <OText size={12} numberOfLines={1}>
277
280
  {walletName[cart?.wallets?.find((wallet: any) => wallet.id === event.wallet_id)?.type]?.name}
278
281
  </OText>
279
- <OText size={12}>-{parsePrice(event.amount)}</OText>
282
+ <OText size={12}>-{parsePrice(event.amount, { isTruncable: true })}</OText>
280
283
  </OSTable>
281
284
  ))}
282
285
  {isCouponEnabled && !isCartPending && (
@@ -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}
@@ -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 {
@@ -32,8 +32,6 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
32
32
  loadMoreStatus,
33
33
  loadMoreOrders,
34
34
  loadOrders,
35
- setOrdersLength,
36
- ordersLength
37
35
  } = props
38
36
 
39
37
  const theme = useTheme();
@@ -116,50 +114,28 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
116
114
  }
117
115
  }, [loadMoreStatus, loading, pagination])
118
116
 
119
- useEffect(() => {
120
- if (loading) return
121
-
122
- const updateOrders = orders.filter((order: any) => orderStatus.includes(order.status))
123
-
124
- if (activeOrders) {
125
- setOrdersLength && setOrdersLength({ ...ordersLength, activeOrdersLength: updateOrders?.length })
126
- } else if (!preOrders) {
127
- setOrdersLength && setOrdersLength({ ...ordersLength, previousOrdersLength: updateOrders?.length })
128
- }
129
- }, [orders?.length])
130
-
131
117
  return (
132
118
  <>
133
- <OptionTitle>
134
- <OText size={16} lineHeight={24} weight={'500'} color={theme.colors.textNormal} mBottom={10} >
135
- {titleContent || (activeOrders
136
- ? t('ACTIVE', 'Active')
137
- : preOrders
138
- ? t('PREORDERS', 'Preorders')
139
- : t('PAST', 'Past'))}
140
- </OText>
141
- </OptionTitle>
142
- {!(activeOrders && ordersLength.activeOrdersLength === 0 && ordersLength.previousOrdersLength === 0) && !loading && orders.length === 0 && (
119
+ {(orders.length > 0) && (
120
+ <>
121
+ <OptionTitle>
122
+ <OText size={16} lineHeight={24} weight={'500'} color={theme.colors.textNormal} mBottom={10} >
123
+ {titleContent || (activeOrders
124
+ ? t('ACTIVE', 'Active')
125
+ : preOrders
126
+ ? t('PREORDERS', 'Preorders')
127
+ : t('PAST', 'Past'))}
128
+ </OText>
129
+ </OptionTitle>
130
+ </>
131
+ )}
132
+ {!loading && orders.length === 0 && (
143
133
  <NotFoundSource
144
134
  content={t('NO_RESULTS_FOUND', 'Sorry, no results found')}
145
135
  image={imageFails}
146
136
  conditioned
147
137
  />
148
138
  )}
149
- {!loading && ordersLength.activeOrdersLength === 0 && ordersLength.previousOrdersLength === 0 && activeOrders && (
150
- <NoOrdersWrapper>
151
- <OText size={14} numberOfLines={1}>
152
- {t('YOU_DONT_HAVE_ORDERS', 'You don\'t have any orders')}
153
- </OText>
154
- <OButton
155
- text={t('ORDER_NOW', 'Order now')}
156
- onClick={() => onNavigationRedirect && onNavigationRedirect('BusinessList')}
157
- textStyle={{ color: 'white', fontSize: 14 }}
158
- style={{ borderRadius: 7.6, marginBottom: 10, marginTop: 10, height: 44, paddingLeft: 10, paddingRight: 10 }}
159
- />
160
-
161
- </NoOrdersWrapper>
162
- )}
163
139
  {loading && (
164
140
  <>
165
141
  {!activeOrders ? (
@@ -3,8 +3,3 @@ import styled from 'styled-components/native'
3
3
  export const OptionTitle = styled.View`
4
4
  margin-top: 24px;
5
5
  `
6
-
7
- export const NoOrdersWrapper = styled.View`
8
- flex-direction: column;
9
- align-items: center;
10
- `
@@ -48,7 +48,7 @@ const PaymentOptionWalletUI = (props: any) => {
48
48
  new Array(walletsState.result?.length).fill(false)
49
49
  );
50
50
 
51
- const creditBalance: any = (wallet: any) => ` = ${parsePrice((wallet.balance * wallet.redemption_rate) / 100)}`
51
+ const creditBalance: any = (wallet: any) => ` = ${parsePrice(wallet.balance / wallet.redemption_rate)}`
52
52
 
53
53
  const walletName: any = {
54
54
  cash: {
@@ -9,6 +9,8 @@ import {
9
9
  import {
10
10
  PaymentOptions as PaymentOptionsController,
11
11
  useLanguage,
12
+ ToastType,
13
+ useToast,
12
14
  } from 'ordering-components/native';
13
15
  import { useTheme } from 'styled-components/native';
14
16
  import { PaymentOptionCash } from '../PaymentOptionCash';
@@ -30,8 +32,6 @@ import {
30
32
  import { getIconCard, flatArray } from '../../utils';
31
33
 
32
34
  const stripeOptions: any = ['stripe_direct', 'stripe', 'stripe_connect']
33
- const methodsPay = ['google_pay', 'apple_pay']
34
- const stripeDirectMethods = ['stripe_direct', ...methodsPay]
35
35
  // const stripeRedirectOptions = [
36
36
  // { name: 'Bancontact', value: 'bancontact' },
37
37
  // { name: 'Alipay', value: 'alipay' },
@@ -54,12 +54,11 @@ const PaymentOptionsUI = (props: any) => {
54
54
  handlePaymethodClick,
55
55
  handlePaymethodDataChange,
56
56
  isOpenMethod,
57
- handlePaymentMethodClickCustom,
58
- handlePlaceOrder
57
+ handlePaymentMethodClickCustom
59
58
  } = props
60
59
 
61
60
  const theme = useTheme();
62
-
61
+ const [, { showToast }] = useToast();
63
62
 
64
63
  const getPayIcon = (method: string) => {
65
64
  switch (method) {
@@ -95,11 +94,18 @@ const PaymentOptionsUI = (props: any) => {
95
94
  // ]
96
95
 
97
96
  const handlePaymentMethodClick = (paymethod: any) => {
98
- const isPopupMethod = ['stripe', 'stripe_direct', 'stripe_connect', 'stripe_redirect', 'paypal'].includes(paymethod?.gateway)
99
- if (webViewPaymentGateway.includes(paymethod?.gateway)) {
100
- handlePaymentMethodClickCustom(paymethod)
101
- }
102
- handlePaymethodClick(paymethod, isPopupMethod)
97
+ if (cart?.balance > 0) {
98
+ const isPopupMethod = ['stripe', 'stripe_direct', 'stripe_connect', 'stripe_redirect', 'paypal'].includes(paymethod?.gateway)
99
+ if (webViewPaymentGateway.includes(paymethod?.gateway)) {
100
+ handlePaymentMethodClickCustom(paymethod)
101
+ }
102
+ handlePaymethodClick(paymethod, isPopupMethod)
103
+ return
104
+ }
105
+ showToast(
106
+ ToastType.Error,
107
+ t('CART_BALANCE_ZERO', 'Sorry, the amount to pay is equal to zero and it is not necessary to select a payment method'))
108
+ ;
103
109
  }
104
110
 
105
111
  useEffect(() => {
@@ -120,12 +126,6 @@ const PaymentOptionsUI = (props: any) => {
120
126
  }
121
127
  }, [props.paySelected])
122
128
 
123
- useEffect(() => {
124
- if (methodsPay.includes(paymethodSelected?.gateway) && paymethodData?.id && paymethodSelected?.data?.card) {
125
- handlePlaceOrder()
126
- }
127
- }, [paymethodData, paymethodSelected])
128
-
129
129
  const renderPaymethods = ({ item }: any) => {
130
130
  return (
131
131
  <TouchableOpacity
@@ -287,11 +287,11 @@ const PaymentOptionsUI = (props: any) => {
287
287
  </KeyboardAvoidingView>
288
288
  </OModal>
289
289
 
290
- {/* Stripe direct, Google pay, Apple pay */}
290
+ {/* Stripe direct */}
291
291
  <OModal
292
292
  entireModal
293
293
  title={t('ADD_CREDIT_OR_DEBIT_CARD', 'Add credit or debit card')}
294
- open={stripeDirectMethods?.includes(isOpenMethod?.paymethod?.gateway) && !paymethodData.id}
294
+ open={isOpenMethod?.paymethod?.gateway === 'stripe_direct' && !paymethodData?.id}
295
295
  onClose={() => handlePaymethodClick(null)}
296
296
  >
297
297
  <KeyboardAvoidingView
@@ -300,13 +300,10 @@ const PaymentOptionsUI = (props: any) => {
300
300
  enabled={Platform.OS === 'ios' ? true : false}
301
301
  >
302
302
  <StripeElementsForm
303
- cart={cart}
304
- paymethod={isOpenMethod?.paymethod?.gateway}
305
- methodsPay={methodsPay}
306
303
  businessId={props.businessId}
307
- publicKey={isOpenMethod?.paymethod?.credentials?.publishable || isOpenMethod?.paymethod?.credentials?.publishable_key}
304
+ publicKey={isOpenMethod?.paymethod?.credentials?.publishable}
308
305
  handleSource={handlePaymethodDataChange}
309
- onCancel={() => handlePaymethodClick(null)}
306
+ onCancel={() => handlePaymethodClick(false)}
310
307
  />
311
308
  </KeyboardAvoidingView>
312
309
  </OModal>