ordering-ui-react-native 0.21.50 → 0.21.51

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 (82) hide show
  1. package/package.json +1 -1
  2. package/themes/business/src/components/OrderDetails/OrderHeaderComponent.tsx +6 -0
  3. package/themes/original/src/components/AddressForm/index.tsx +2 -2
  4. package/themes/original/src/components/AddressForm/styles.tsx +1 -1
  5. package/themes/original/src/components/AddressList/styles.tsx +4 -4
  6. package/themes/original/src/components/BusinessBasicInformation/index.tsx +2 -2
  7. package/themes/original/src/components/BusinessBasicInformation/styles.tsx +1 -1
  8. package/themes/original/src/components/BusinessInformation/styles.tsx +2 -2
  9. package/themes/original/src/components/BusinessItemAccordion/index.tsx +4 -3
  10. package/themes/original/src/components/BusinessListingSearch/index.tsx +4 -5
  11. package/themes/original/src/components/BusinessListingSearch/styles.tsx +1 -1
  12. package/themes/original/src/components/BusinessPreorder/index.tsx +2 -2
  13. package/themes/original/src/components/BusinessProductsCategories/index.tsx +1 -1
  14. package/themes/original/src/components/BusinessProductsListing/index.tsx +7 -7
  15. package/themes/original/src/components/BusinessProductsListing/styles.tsx +2 -2
  16. package/themes/original/src/components/BusinessReviews/index.tsx +1 -1
  17. package/themes/original/src/components/BusinessesListing/Layout/Appointment/index.tsx +1 -1
  18. package/themes/original/src/components/BusinessesListing/Layout/Appointment/styles.tsx +5 -5
  19. package/themes/original/src/components/BusinessesListing/Layout/Original/FlatListBusinessListFooter.tsx +1 -1
  20. package/themes/original/src/components/BusinessesListing/Layout/Original/FlatListBusinessListHeader.tsx +7 -7
  21. package/themes/original/src/components/BusinessesListing/Layout/Original/index.tsx +1 -1
  22. package/themes/original/src/components/BusinessesListing/Layout/Original/styles.tsx +1 -1
  23. package/themes/original/src/components/Cart/index.tsx +13 -4
  24. package/themes/original/src/components/CartContent/index.tsx +59 -38
  25. package/themes/original/src/components/CartStoresListing/styles.tsx +2 -2
  26. package/themes/original/src/components/Checkout/index.tsx +42 -8
  27. package/themes/original/src/components/Checkout/styles.tsx +17 -0
  28. package/themes/original/src/components/CitiesControl/styles.tsx +1 -1
  29. package/themes/original/src/components/Favorite/index.tsx +3 -4
  30. package/themes/original/src/components/Favorite/styles.tsx +0 -2
  31. package/themes/original/src/components/FloatingButton/styles.tsx +1 -1
  32. package/themes/original/src/components/GPSButton/index.tsx +1 -1
  33. package/themes/original/src/components/GiftCard/PurchaseGiftCard/styles.tsx +1 -1
  34. package/themes/original/src/components/GiftCard/RedeemGiftCard/styles.tsx +1 -1
  35. package/themes/original/src/components/GiftCard/SendGiftCard/styles.tsx +1 -1
  36. package/themes/original/src/components/HighestRatedBusinesses/index.tsx +1 -1
  37. package/themes/original/src/components/HighestRatedBusinesses/styles.tsx +1 -1
  38. package/themes/original/src/components/Home/index.tsx +1 -1
  39. package/themes/original/src/components/Messages/styles.tsx +1 -1
  40. package/themes/original/src/components/MomentOption/index.tsx +3 -3
  41. package/themes/original/src/components/MultiCart/index.tsx +1 -1
  42. package/themes/original/src/components/MultiCheckout/index.tsx +4 -4
  43. package/themes/original/src/components/MultiOrdersDetails/index.tsx +1 -1
  44. package/themes/original/src/components/MyOrders/index.tsx +5 -5
  45. package/themes/original/src/components/NetworkError/styles.tsx +2 -2
  46. package/themes/original/src/components/Notifications/index.tsx +2 -4
  47. package/themes/original/src/components/Notifications/styles.tsx +0 -1
  48. package/themes/original/src/components/OrderDetails/OrderHistory.tsx +1 -1
  49. package/themes/original/src/components/OrderDetails/index.tsx +702 -661
  50. package/themes/original/src/components/OrderDetails/styles.tsx +24 -7
  51. package/themes/original/src/components/OrderProgress/styles.tsx +1 -1
  52. package/themes/original/src/components/OrderSummary/index.tsx +3 -1
  53. package/themes/original/src/components/OrdersOption/PreviousBusinessOrdered/styles.tsx +1 -1
  54. package/themes/original/src/components/OrdersOption/PreviousProductsOrdered/styles.tsx +1 -1
  55. package/themes/original/src/components/OrdersOption/index.tsx +1 -1
  56. package/themes/original/src/components/OrdersOption/styles.tsx +1 -1
  57. package/themes/original/src/components/ProductForm/ActionButton.tsx +117 -0
  58. package/themes/original/src/components/ProductForm/ExtraOptions.tsx +56 -0
  59. package/themes/original/src/components/ProductForm/index.tsx +52 -145
  60. package/themes/original/src/components/ProductItemAccordion/index.tsx +5 -0
  61. package/themes/original/src/components/ProductOptionSubOption/index.tsx +1 -1
  62. package/themes/original/src/components/ProfessionalProfile/styles.tsx +3 -3
  63. package/themes/original/src/components/Promotions/index.tsx +4 -4
  64. package/themes/original/src/components/Promotions/styles.tsx +0 -2
  65. package/themes/original/src/components/ReviewDriver/styles.tsx +1 -1
  66. package/themes/original/src/components/ReviewOrder/styles.tsx +1 -1
  67. package/themes/original/src/components/ReviewProducts/styles.tsx +1 -1
  68. package/themes/original/src/components/ServiceForm/index.tsx +1 -1
  69. package/themes/original/src/components/ServiceForm/styles.tsx +4 -4
  70. package/themes/original/src/components/StripeElementsForm/index.tsx +1 -1
  71. package/themes/original/src/components/UpsellingProducts/UpsellingContent.tsx +170 -0
  72. package/themes/original/src/components/UpsellingProducts/UpsellingLayout.tsx +86 -0
  73. package/themes/original/src/components/UpsellingProducts/index.tsx +15 -199
  74. package/themes/original/src/components/UpsellingProducts/styles.tsx +19 -0
  75. package/themes/original/src/components/UserFormDetails/index.tsx +16 -3
  76. package/themes/original/src/components/UserProfile/index.tsx +1 -1
  77. package/themes/original/src/components/WalletTransactions/styles.tsx +1 -0
  78. package/themes/original/src/components/Wallets/index.tsx +1 -3
  79. package/themes/original/src/components/Wallets/styles.tsx +1 -0
  80. package/themes/original/src/components/shared/HeaderTitle.tsx +1 -1
  81. package/themes/original/src/components/shared/OModal.tsx +12 -14
  82. package/themes/original/src/layouts/Container.tsx +1 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ordering-ui-react-native",
3
- "version": "0.21.50",
3
+ "version": "0.21.51",
4
4
  "description": "Reusable components made in react native",
5
5
  "main": "src/index.tsx",
6
6
  "author": "ordering.inc",
@@ -263,6 +263,12 @@ export const OrderHeaderComponent = (props: OrderHeader) => {
263
263
  )}
264
264
  </>
265
265
  </OText>
266
+ {order?.external_id && (
267
+ <OText size={13}>
268
+ <OText size={13} weight='bold'>{`${t('EXTERNAL_ID', 'External ID :')} `}</OText>
269
+ {order?.external_id}id_de_prueba
270
+ </OText>
271
+ )}
266
272
  {!order?.isLogistic && !!order?.delivery_type && (!order?.order_group_id || !logisticOrderStatus?.includes(order?.status)) && (
267
273
  <>
268
274
  <OText size={13}>
@@ -122,8 +122,8 @@ const AddressFormUI = (props: AddressFormParams) => {
122
122
  width: 16
123
123
  },
124
124
  wrapperNavbar: Platform.OS === 'ios'
125
- ? { paddingVertical: 0, paddingLeft: 40, paddingRight: 20 }
126
- : { paddingVertical: 10, paddingLeft: 40, paddingRight: 20 }
125
+ ? { paddingVertical: 0, paddingLeft: 20, paddingRight: 20 }
126
+ : { paddingVertical: 10, paddingLeft: 20, paddingRight: 20 }
127
127
  });
128
128
 
129
129
  const [, t] = useLanguage();
@@ -2,7 +2,7 @@ import styled from 'styled-components/native'
2
2
 
3
3
  export const AddressFormContainer = styled.View`
4
4
  flex: 1;
5
- padding: 0px 40px 20px;
5
+ padding: 0px 20px 20px;
6
6
  background-color: ${(props: any) => props.theme.colors.backgroundPage};
7
7
  justify-content: space-between;
8
8
  `
@@ -3,10 +3,10 @@ import styled from 'styled-components/native'
3
3
  export const Container = styled.ScrollView`
4
4
  position: relative;
5
5
  flex: 1;
6
- paddingLeft: 40px;
7
- paddingRight: 40px;
8
- margin-bottom: 40px;
9
- padding-top: 10px;
6
+ paddingLeft: 20px;
7
+ paddingRight: 20px;
8
+ margin-bottom: 40px;
9
+ padding-top: 10px;
10
10
  `
11
11
 
12
12
  export const AddressItem = styled.TouchableOpacity`
@@ -72,7 +72,7 @@ export const BusinessBasicInformation = (
72
72
  alignItems: 'flex-start'
73
73
  },
74
74
  businessInfo: {
75
- paddingHorizontal: 40,
75
+ paddingHorizontal: 20,
76
76
  paddingTop: isChewLayout ? 0 : 56,
77
77
  },
78
78
  bullet: {
@@ -95,7 +95,7 @@ export const BusinessBasicInformation = (
95
95
  width: '100%',
96
96
  top: 0,
97
97
  zIndex: 100,
98
- left: 40
98
+ left: 20
99
99
  },
100
100
  socialIcon: {
101
101
  borderRadius: 3,
@@ -11,7 +11,7 @@ export const BusinessHeader = styled.ImageBackground`
11
11
  `;
12
12
  export const BusinessLogo = styled.View`
13
13
  position: absolute;
14
- start: 40px;
14
+ start: 20px;
15
15
  top: -36px;
16
16
  z-index: 50;
17
17
  box-shadow: 0 0 2px ${Platform.OS == 'android' ? '#000000DD' : '#0000001A'};
@@ -17,7 +17,7 @@ export const MediaWrapper = styled.ScrollView`
17
17
  height: 127px;
18
18
  `
19
19
  export const InnerContent = styled.View`
20
- padding: 20px 40px;
20
+ padding: 20px;
21
21
  `
22
22
  export const WrapScheduleBlock = styled.View`
23
23
  margin: 20px 0;
@@ -36,4 +36,4 @@ export const DivideView = styled.View`
36
36
  height: 8px;
37
37
  background-color: ${(props: any) => props.theme.colors.backgroundGray100};
38
38
  margin-horizontal: -40px;
39
- `;
39
+ `;
@@ -24,6 +24,8 @@ export const BusinessItemAccordion = (props: any) => {
24
24
  checkoutButtonDisabled,
25
25
  isMultiCheckout,
26
26
  isFromUpselling,
27
+ changeActiveState,
28
+ isActive,
27
29
  isGiftCart
28
30
  } = props
29
31
 
@@ -39,14 +41,13 @@ export const BusinessItemAccordion = (props: any) => {
39
41
  const isProducts = cart?.products?.length
40
42
  const isBusinessChangeEnabled = configs?.cart_change_business_validation?.value === '1'
41
43
 
42
- const [isActive, setActiveState] = useState(!!singleBusiness)
43
44
  const [viewedCart, setViewedCart] = useState<any>(null)
44
45
 
45
46
  useEffect(() => {
46
47
  const cartsArray = Object.values(orderState?.carts)
47
48
  const cartsLength = cartsArray.filter((cart: any) => cart.products.length > 0).length ?? 0
48
49
  if (cartsLength === 1) {
49
- setActiveState(!isClosed)
50
+ changeActiveState(!isClosed, cart?.uuid)
50
51
  }
51
52
  }, [orderState?.carts, isClosed])
52
53
 
@@ -69,7 +70,7 @@ export const BusinessItemAccordion = (props: any) => {
69
70
  <BIContainer isClosed={isClosed} isMultiCheckout={isMultiCheckout} checkoutVisible={!isActive && !isClosed && !!isProducts && !checkoutButtonDisabled}>
70
71
  <BIHeader
71
72
  isClosed={isClosed}
72
- onPress={() => !isClosed ? setActiveState(!isActive) : isClosed}
73
+ onPress={() => !isClosed ? changeActiveState(!isClosed, cart?.uuid) : isClosed}
73
74
  activeOpacity={1}
74
75
  >
75
76
  <BIInfo>
@@ -1,6 +1,6 @@
1
1
  import React, { useEffect, useState } from 'react'
2
2
  import { useLanguage, BusinessSearchList, useOrder, useUtils, useEvent, showToast, ToastType } from 'ordering-components/native'
3
- import { ScrollView, StyleSheet, TouchableOpacity, View, Dimensions } from 'react-native'
3
+ import { ScrollView, StyleSheet, TouchableOpacity, View, Dimensions, Platform } from 'react-native'
4
4
  import { useSafeAreaInsets } from 'react-native-safe-area-context'
5
5
  import { useTheme } from 'styled-components/native'
6
6
  import { HeaderTitle, OButton, OModal, OText } from '../shared'
@@ -92,7 +92,7 @@ export const BusinessListingSearchUI = (props: BusinessSearchParams) => {
92
92
  },
93
93
  filterContainer: {
94
94
  maxHeight: screenHeight - 150,
95
- paddingHorizontal: 40,
95
+ paddingHorizontal: 20,
96
96
  width: '100%'
97
97
  },
98
98
  searchInput: {
@@ -259,7 +259,6 @@ export const BusinessListingSearchUI = (props: BusinessSearchParams) => {
259
259
  display: 'flex',
260
260
  flexDirection: 'row',
261
261
  alignItems: 'center',
262
- paddingHorizontal: hideBrowse && !isChewLayout ? 40 : 20,
263
262
  }}>
264
263
  {hideBrowse && !isChewLayout && (
265
264
  <OButton
@@ -285,10 +284,10 @@ export const BusinessListingSearchUI = (props: BusinessSearchParams) => {
285
284
  />
286
285
  )}
287
286
  <HeaderTitle ph={20} text={t('SEARCH', 'Search')} />
288
- <AntDesignIcon name='filter' size={18} style={{ marginLeft: 'auto', marginTop: 55, paddingHorizontal: 20 }} onPress={() => handleOpenfilters()} />
287
+ <AntDesignIcon name='filter' size={18} style={{ marginLeft: 'auto', marginTop: Platform.OS === 'ios' ? 35 : 55, paddingHorizontal: 20 }} onPress={() => handleOpenfilters()} />
289
288
  </View>
290
289
  <BContainer
291
- style={{ paddingHorizontal: isChewLayout ? 20 : 40 }}
290
+ style={{ paddingHorizontal: 20 }}
292
291
  >
293
292
  <SearchWrapper>
294
293
  <SearchBar
@@ -1,7 +1,7 @@
1
1
  import styled, { css } from 'styled-components/native'
2
2
 
3
3
  export const BContainer = styled.View`
4
- padding: 20px 40px;
4
+ padding: 20px;
5
5
  `
6
6
 
7
7
  export const SearchWrapper = styled.View`
@@ -64,7 +64,7 @@ const BusinessPreorderUI = (props: BusinessPreorderParams) => {
64
64
  container: {
65
65
  height: windowHeight,
66
66
  paddingVertical: 30,
67
- paddingHorizontal: 40
67
+ paddingHorizontal: 20
68
68
  },
69
69
  businessLogo: {
70
70
  backgroundColor: 'white',
@@ -319,7 +319,7 @@ const BusinessPreorderUI = (props: BusinessPreorderParams) => {
319
319
 
320
320
  return (
321
321
  <>
322
- <PreOrderContainer contentContainerStyle={{ paddingVertical: 32, paddingHorizontal: 40 }}>
322
+ <PreOrderContainer contentContainerStyle={{ paddingVertical: 32, paddingHorizontal: 20 }}>
323
323
  <TouchableOpacity onPress={() => goToBack && goToBack()} style={{ marginBottom: 12 }}>
324
324
  <IconAntDesign
325
325
  name='close'
@@ -92,7 +92,7 @@ const BusinessProductsCategoriesUI = (props: any) => {
92
92
  ref={tabsRef}
93
93
  horizontal
94
94
  style={{ ...styles.container, borderBottomWidth: loading ? 0 : 1 }}
95
- contentContainerStyle={{ paddingHorizontal: 40 }}
95
+ contentContainerStyle={{ paddingHorizontal: 20 }}
96
96
  showsHorizontalScrollIndicator={false}
97
97
  onScroll={(e: any) => setScrollOffsetX(e.nativeEvent.contentOffset.x)}
98
98
  scrollEventThrottle={16}
@@ -114,7 +114,7 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
114
114
  },
115
115
  searchIcon: {
116
116
  borderWidth: 0,
117
- padding: 15,
117
+ padding: 10,
118
118
  justifyContent: 'center',
119
119
  shadowColor: theme.colors.clear,
120
120
  },
@@ -194,7 +194,8 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
194
194
  product: product,
195
195
  businessSlug: business.slug,
196
196
  businessId: business.id || product?.category?.business_id,
197
- productAddedToCartLength
197
+ productAddedToCartLength,
198
+ isRedirect: false
198
199
  })
199
200
  }
200
201
  events.emit('product_clicked', product)
@@ -529,9 +530,6 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
529
530
  </View>
530
531
  </FiltProductsContainer>
531
532
  )}
532
- {isOpenFiltProducts && (
533
- <BackgroundGray isIos={Platform.OS === 'ios'} />
534
- )}
535
533
  <IOScrollView
536
534
  stickyHeaderIndices={[business?.professionals?.length > 0 ? 4 : 3]}
537
535
  style={{
@@ -600,7 +598,7 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
600
598
  <>
601
599
  <WrapContent
602
600
  onLayout={(event: any) => setProductListLayout(event.nativeEvent.layout)}
603
- style={{ paddingHorizontal: isChewLayout ? 20 : 40 }}
601
+ style={{ paddingHorizontal: 20 }}
604
602
  >
605
603
  <BusinessProductsList
606
604
  categories={[
@@ -657,6 +655,9 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
657
655
  </WrapContent>
658
656
  </>
659
657
  )}
658
+ {isOpenFiltProducts && (
659
+ <BackgroundGray isIos={Platform.OS === 'ios'} />
660
+ )}
660
661
  </IOScrollView>
661
662
  {viewOrderButtonVisible && (
662
663
  <View style={{ marginBottom: 0 }}>
@@ -714,7 +715,6 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
714
715
  professionalList={business?.professionals}
715
716
  professionalSelected={professionalSelected}
716
717
  handleChangeProfessional={handleChangeProfessionalSelected}
717
- handleChangeProfessional={handleChangeProfessionalSelected}
718
718
  handleUpdateProfessionals={handleUpdateProfessionals}
719
719
  onSave={() => setOpenService(false)}
720
720
  onClose={() => setOpenService(false)}
@@ -50,7 +50,7 @@ export const BackgroundGray = styled.View`
50
50
  `
51
51
 
52
52
  export const ProfessionalFilterWrapper = styled.View`
53
- padding-left: 40px;
53
+ padding-left: 20px;
54
54
  margin-bottom: 35px;
55
55
  `
56
56
 
@@ -63,6 +63,6 @@ export const NearBusiness = styled.View`
63
63
  export const TopActions = styled.TouchableOpacity`
64
64
  height: 60px;
65
65
  justify-content: center;
66
- padding-horizontal: 30px;
66
+ padding-horizontal: 20px;
67
67
  width: 100px;
68
68
  `;
@@ -109,7 +109,7 @@ const BusinessReviewsUI = (props: BusinessReviewsParams) => {
109
109
  return (
110
110
  <BusinessReviewsContainer>
111
111
  <BusinessReviewContent
112
- contentContainerStyle={{ paddingHorizontal: 40, paddingVertical: 27 }}>
112
+ contentContainerStyle={{ paddingHorizontal: 20, paddingVertical: 27 }}>
113
113
  {reviewsList.error ? (
114
114
  <OText size={16}>{t('ERROR_UNKNOWN', 'An error has ocurred')}</OText>
115
115
  ) : (
@@ -415,7 +415,7 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
415
415
  <ScrollView
416
416
  showsHorizontalScrollIndicator={false}
417
417
  nestedScrollEnabled
418
- horizontal contentContainerStyle={{ paddingHorizontal: 40 }}>
418
+ horizontal contentContainerStyle={{ paddingHorizontal: 20 }}>
419
419
  {featuredBusiness.map((bAry: any, idx) => (
420
420
  <View key={'f-listing_' + idx}>
421
421
  <BusinessFeaturedController
@@ -54,13 +54,13 @@ export const WrapMomentOption = styled.TouchableOpacity`
54
54
  export const HeaderWrapper = styled.ImageBackground`
55
55
  width: 100%;
56
56
  height: 370px;
57
- padding: 20px 40px;
57
+ padding: 20px;
58
58
  background-color: transparent;
59
59
  `;
60
60
 
61
61
  export const ListWrapper = styled.View`
62
62
  background-color: ${(props: any) => props.theme.colors.backgroundLight};
63
- padding-horizontal: 40px;
63
+ padding-horizontal: 20px;
64
64
  `;
65
65
 
66
66
  export const FeaturedWrapper = styled.View`
@@ -72,7 +72,7 @@ export const FeaturedWrapper = styled.View`
72
72
  export const OrderProgressWrapper = styled.View`
73
73
  margin-top: 37px;
74
74
  margin-bottom: 20px;
75
- padding-horizontal: 40px;
75
+ padding-horizontal: 20px;
76
76
  `
77
77
 
78
78
  export const FarAwayMessage = styled.View`
@@ -98,10 +98,10 @@ export const FilterWrapper = styled.View`
98
98
  `
99
99
 
100
100
  export const ServiceWrapper = styled.View`
101
- padding-horizontal: 40px;
101
+ padding-horizontal: 20px;
102
102
  `
103
103
 
104
104
  export const PriceWrapper = styled.View`
105
- padding-horizontal: 40px;
105
+ padding-horizontal: 20px;
106
106
  margin-top: 30px;
107
107
  `
@@ -11,7 +11,7 @@ export const FlatListBusinessListFooter = (props : any) => {
11
11
  } = props
12
12
  return (
13
13
  <>
14
- <ListWrapper style={{ paddingHorizontal: isChewLayout ? 20 : 40 }}>
14
+ <ListWrapper style={{ paddingHorizontal: 20 }}>
15
15
  {(businessesList.loading || !businessesList?.fetched) && (
16
16
  <>
17
17
  {[
@@ -133,7 +133,7 @@ export const FlatListBusinessListHeader = (props: any) => {
133
133
  backgroundColor: theme.colors.white,
134
134
  borderColor: theme.colors.backgroundGray,
135
135
  borderRadius: 8,
136
- marginHorizontal: 40,
136
+ marginHorizontal: 20,
137
137
  minHeight: 45,
138
138
  paddingVertical: 5,
139
139
  paddingHorizontal: 20,
@@ -165,7 +165,7 @@ export const FlatListBusinessListHeader = (props: any) => {
165
165
  )}
166
166
  <View style={{
167
167
  height: !isPreOrderSetting && isChewLayout ? 150 : isChewLayout ? 200 : isFarAway ? 150 : 100,
168
- marginTop: isChewLayout ? 0 : Platform.OS == 'ios' ? 0 : 50,
168
+ marginTop: 0,
169
169
  backgroundColor: isChewLayout ? theme?.colors?.chew : theme.colors?.white
170
170
  }}
171
171
  >
@@ -276,7 +276,7 @@ export const FlatListBusinessListHeader = (props: any) => {
276
276
  bgHeaderHeight={bgHeaderHeight}
277
277
  >
278
278
  {!auth && (
279
- <TouchableOpacity onPress={() => navigation?.canGoBack() && navigation.goBack()} style={{ position: 'absolute', marginStart: 40, paddingVertical: 20 }}>
279
+ <TouchableOpacity onPress={() => navigation?.canGoBack() && navigation.goBack()} style={{ position: 'absolute', marginStart: 20, paddingVertical: 20 }}>
280
280
  <OIcon src={theme.images.general.arrow_left} color={theme.colors.textNormal} />
281
281
  </TouchableOpacity>
282
282
  )}
@@ -284,7 +284,7 @@ export const FlatListBusinessListHeader = (props: any) => {
284
284
  ) : (
285
285
  <>
286
286
  {!auth && (
287
- <TouchableOpacity onPress={() => navigation?.canGoBack() && navigation.goBack()} style={{ position: 'absolute', marginStart: 40, paddingVertical: 20 }}>
287
+ <TouchableOpacity onPress={() => navigation?.canGoBack() && navigation.goBack()} style={{ position: 'absolute', marginStart: 20, paddingVertical: 20 }}>
288
288
  <OIcon src={theme.images.general.arrow_left} color={theme.colors.textNormal} />
289
289
  </TouchableOpacity>
290
290
  )}
@@ -324,12 +324,12 @@ export const FlatListBusinessListHeader = (props: any) => {
324
324
  {
325
325
  !businessId && !props.franchiseId && featuredBusiness && featuredBusiness.length > 0 && (
326
326
  <FeaturedWrapper>
327
- <OText size={16} style={{ marginLeft: 40 }} weight={Platform.OS === 'ios' ? '600' : 'bold'}>{t('BUSINESS_FEATURE', 'Featured business')}</OText>
327
+ <OText size={16} style={{ marginLeft: 20 }} weight={Platform.OS === 'ios' ? '600' : 'bold'}>{t('BUSINESS_FEATURE', 'Featured business')}</OText>
328
328
  <ScrollView
329
329
  showsHorizontalScrollIndicator={false}
330
330
  nestedScrollEnabled
331
331
  horizontal
332
- contentContainerStyle={{ paddingHorizontal: 40 }}
332
+ contentContainerStyle={{ paddingHorizontal: 20 }}
333
333
  >
334
334
  {featuredBusiness.map((bAry: any, idx: number) => (
335
335
  <View key={'f-listing_' + idx}>
@@ -372,7 +372,7 @@ export const FlatListBusinessListHeader = (props: any) => {
372
372
  <PageBanner position='app_business_listing' navigation={navigation} />
373
373
  <View style={{ height: 8, backgroundColor: theme.colors.backgroundGray100 }} />
374
374
 
375
- <ListWrapper style={{ paddingHorizontal: isChewLayout ? 20 : 40 }}>
375
+ <ListWrapper style={{ paddingHorizontal: 20 }}>
376
376
  {!businessId && !isAllCategoriesHidden && (
377
377
  <BusinessTypeFilter
378
378
  images={props.images}
@@ -94,7 +94,7 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
94
94
  backgroundColor: theme.colors.white,
95
95
  borderColor: theme.colors.backgroundGray,
96
96
  borderRadius: 8,
97
- marginHorizontal: 40,
97
+ marginHorizontal: 20,
98
98
  minHeight: 45,
99
99
  paddingVertical: 5,
100
100
  paddingHorizontal: 20,
@@ -61,7 +61,7 @@ export const WrapMomentOption = styled.TouchableOpacity`
61
61
  export const HeaderWrapper = styled.ImageBackground`
62
62
  width: 100%;
63
63
  height: 270px;
64
- padding: 20px 40px;
64
+ padding: 20px;
65
65
  background-color: transparent;
66
66
  `;
67
67
 
@@ -1,4 +1,4 @@
1
- import React, { useEffect, useState } from 'react';
1
+ import React, { useEffect, useState, useRef } from 'react';
2
2
  import {
3
3
  Cart as CartController,
4
4
  useOrder,
@@ -52,7 +52,11 @@ const CartUI = (props: any) => {
52
52
  preorderMaximumDays,
53
53
  preorderMinimumDays,
54
54
  cateringTypes,
55
- isFromUpselling
55
+ isFromUpselling,
56
+ cartsOpened,
57
+ setCartsOpened,
58
+ changeActiveState,
59
+ isActive
56
60
  } = props
57
61
 
58
62
  const theme = useTheme();
@@ -62,7 +66,7 @@ const CartUI = (props: any) => {
62
66
  const [{ configs }] = useConfig();
63
67
  const [{ parsePrice, parseNumber, parseDate }] = useUtils()
64
68
  const [validationFields] = useValidationFields()
65
-
69
+ const commentRef = useRef()
66
70
  const [openUpselling, setOpenUpselling] = useState(false)
67
71
  const [openChangeStore, setOpenChangeStore] = useState(false)
68
72
  const [canOpenUpselling, setCanOpenUpselling] = useState(false)
@@ -109,7 +113,7 @@ const CartUI = (props: any) => {
109
113
  }
110
114
  }
111
115
 
112
- const handleUpsellingPage = (individualCart : any) => {
116
+ const handleUpsellingPage = (individualCart: any) => {
113
117
  const isProductCartParam = !!individualCart?.products?.length
114
118
  setOpenUpselling(false)
115
119
  setCanOpenUpselling(false)
@@ -232,6 +236,10 @@ const CartUI = (props: any) => {
232
236
  checkoutButtonDisabled={(openUpselling && !canOpenUpselling) || subtotalWithTaxes < cart?.minimum || !cart?.valid_address}
233
237
  isMultiCheckout={isMultiCheckout}
234
238
  isFromUpselling={isFromUpselling}
239
+ cartsOpened={cartsOpened}
240
+ setCartsOpened={setCartsOpened}
241
+ changeActiveState={changeActiveState}
242
+ isActive={isActive}
235
243
  isGiftCart={!cart?.business_id}
236
244
  >
237
245
  {cart?.products?.length > 0 && cart?.products.map((product: any, i: number) => (
@@ -491,6 +499,7 @@ const CartUI = (props: any) => {
491
499
  marginTop: 10,
492
500
  borderRadius: 7.6
493
501
  }}
502
+ forwardRef={commentRef}
494
503
  multiline
495
504
  />
496
505
  {commentState?.loading && (
@@ -1,6 +1,6 @@
1
- import React, { useState } from 'react';
1
+ import React, { useCallback, useState } from 'react';
2
2
  import { View } from 'react-native';
3
- import { useLanguage, useConfig, useUtils } from 'ordering-components/native';
3
+ import { useLanguage, useConfig, useUtils, useOrder } from 'ordering-components/native';
4
4
  import { useTheme } from 'styled-components/native';
5
5
  import { CCContainer, CCNotCarts, CCList, CheckoutAction, ChCartsTotal } from './styles';
6
6
 
@@ -11,10 +11,9 @@ import { NotFoundSource } from '../NotFoundSource';
11
11
 
12
12
  export const CartContent = (props: any) => {
13
13
  const {
14
- carts,
15
- isOrderStateCarts,
16
14
  onNavigationRedirect,
17
- singleBusiness
15
+ singleBusiness,
16
+ businessSlug
18
17
  } = props
19
18
 
20
19
  const theme = useTheme();
@@ -22,16 +21,22 @@ export const CartContent = (props: any) => {
22
21
  const [{ configs }] = useConfig()
23
22
  const [{ parsePrice }] = useUtils();
24
23
  const [isCartsLoading, setIsCartsLoading] = useState(false)
25
-
26
- const isChewLayout = theme?.header?.components?.layout?.type === 'chew'
24
+ const [cartsOpened, setCartsOpened] = useState([])
25
+ const [{ carts: cartsContext }] = useOrder();
26
+ const cartsList =
27
+ (cartsContext &&
28
+ Object.values(cartsContext).filter((cart: any) => cart.products.length > 0)) ??
29
+ [];
30
+ const carts = businessSlug
31
+ ? cartsList.filter((cart: any) => cart?.business?.slug === businessSlug || parseInt(businessSlug) === cart?.business_id)
32
+ : cartsList
33
+ const isOrderStateCarts = !!carts
27
34
  const isMultiCheckout = configs?.checkout_multi_business_enabled?.value === '1'
28
- const cartsAvailable: any = Object.values(carts)?.filter((cart: any) => cart?.valid && cart?.status !== 2)
29
-
35
+ const cartsAvailable: any = Object.values(carts || {})?.filter((cart: any) => cart?.valid && cart?.status !== 2)
30
36
  const totalCartsPrice = cartsAvailable?.length && cartsAvailable.reduce((total: any, cart: any) => { return total + cart?.total }, 0)
31
37
  const totalCartsFee = cartsAvailable?.length && cartsAvailable
32
38
  ?.filter((cart: any) => cart?.status !== 1 && cart?.valid && cart?.products?.length)
33
39
  ?.reduce((total: any, cart: any) => { return total + (cart?.delivery_price_with_discount) }, 0)
34
-
35
40
  const handleCheckoutRedirect = () => {
36
41
  if (cartsAvailable.length === 1) {
37
42
  onNavigationRedirect('CheckoutNavigator', {
@@ -66,9 +71,21 @@ export const CartContent = (props: any) => {
66
71
  }
67
72
  }
68
73
 
74
+ const changeActiveState = useCallback((isClosed : boolean, uuid : string) => {
75
+ const isActive = cartsOpened?.includes?.(uuid) || !!singleBusiness
76
+ if (isActive || !isClosed) {
77
+ setCartsOpened(cartsOpened?.filter?.((_uuid) => _uuid !== uuid))
78
+ } else {
79
+ setCartsOpened([
80
+ ...cartsOpened,
81
+ uuid
82
+ ])
83
+ }
84
+ }, [cartsOpened])
85
+
69
86
  return (
70
87
  <CCContainer
71
- style={{ paddingHorizontal: isChewLayout ? 20 : 40 }}
88
+ style={{ paddingHorizontal: 20 }}
72
89
  >
73
90
  {isOrderStateCarts && carts?.length > 0 && (
74
91
  <>
@@ -88,8 +105,12 @@ export const CartContent = (props: any) => {
88
105
  hideUpselling
89
106
  businessConfigs={cart?.business?.configs}
90
107
  hideCouponInput={configs?.multi_business_checkout_coupon_input_style?.value === 'group'}
91
- hideDeliveryFee={configs?.multi_business_checkout_show_combined_delivery_fee?.value === '1'}
108
+ hideDeliveryFee={configs?.multi_business_checkout_show_combined_delivery_fee?.value === '1'}
92
109
  hideDriverTip={configs?.multi_business_checkout_show_combined_driver_tip?.value === '1'}
110
+ cartsOpened={cartsOpened}
111
+ setCartsOpened={setCartsOpened}
112
+ changeActiveState={changeActiveState}
113
+ isActive={cartsOpened?.includes?.(cart?.uuid) || !!singleBusiness}
93
114
  />
94
115
  <View style={{ height: 8, backgroundColor: theme.colors.backgroundGray100, marginHorizontal: -40, marginTop: 20 }} />
95
116
  </>
@@ -101,32 +122,32 @@ export const CartContent = (props: any) => {
101
122
  {!!cartsAvailable.length && (
102
123
  <ChCartsTotal>
103
124
  {!!totalCartsFee && configs?.multi_business_checkout_show_combined_delivery_fee?.value === '1' && (
104
- <View style={{ flexDirection: 'row', justifyContent: 'space-between' }}>
105
- <OText size={14} lineHeight={24} color={theme.colors.textNormal} weight={'400'}>
106
- {t('TOTAL_DELIVERY_FEE', 'Total delivery fee')}
107
- </OText>
108
- <OText size={14} lineHeight={24} color={theme.colors.textNormal} weight={'400'}>
109
- {parsePrice(totalCartsFee)}
110
- </OText>
111
- </View>
112
- )}
113
- {cartsAvailable.reduce((sum: any, cart: any) => sum + cart?.driver_tip, 0) > 0 &&
114
- configs?.multi_business_checkout_show_combined_driver_tip?.value === '1' && (
115
- <View style={{ flexDirection: 'row', justifyContent: 'space-between' }}>
116
- <OText size={14} lineHeight={24} color={theme.colors.textNormal} weight={'400'}>
117
- {t('DRIVER_TIP', 'Driver tip')}
118
- </OText>
119
- <OText size={14} lineHeight={24} color={theme.colors.textNormal} weight={'400'}>
120
- {parsePrice(cartsAvailable.reduce((sum: any, cart: any) => sum + cart?.driver_tip, 0))}
121
- </OText>
122
- </View>
123
- )}
124
- <View style={{ flexDirection: 'row', justifyContent: 'space-between' }}>
125
- <OText size={16} lineHeight={24} color={theme.colors.textNormal} weight={'500'}>
126
- {t('TOTAL_FOR_ALL_CARTS', 'Total for all Carts')}
127
- </OText>
128
- <OText size={16} lineHeight={24} color={theme.colors.textNormal} weight={'500'}>{parsePrice(totalCartsPrice)}</OText>
129
- </View>
125
+ <View style={{ flexDirection: 'row', justifyContent: 'space-between' }}>
126
+ <OText size={14} lineHeight={24} color={theme.colors.textNormal} weight={'400'}>
127
+ {t('TOTAL_DELIVERY_FEE', 'Total delivery fee')}
128
+ </OText>
129
+ <OText size={14} lineHeight={24} color={theme.colors.textNormal} weight={'400'}>
130
+ {parsePrice(totalCartsFee)}
131
+ </OText>
132
+ </View>
133
+ )}
134
+ {cartsAvailable.reduce((sum: any, cart: any) => sum + cart?.driver_tip, 0) > 0 &&
135
+ configs?.multi_business_checkout_show_combined_driver_tip?.value === '1' && (
136
+ <View style={{ flexDirection: 'row', justifyContent: 'space-between' }}>
137
+ <OText size={14} lineHeight={24} color={theme.colors.textNormal} weight={'400'}>
138
+ {t('DRIVER_TIP', 'Driver tip')}
139
+ </OText>
140
+ <OText size={14} lineHeight={24} color={theme.colors.textNormal} weight={'400'}>
141
+ {parsePrice(cartsAvailable.reduce((sum: any, cart: any) => sum + cart?.driver_tip, 0))}
142
+ </OText>
143
+ </View>
144
+ )}
145
+ <View style={{ flexDirection: 'row', justifyContent: 'space-between' }}>
146
+ <OText size={16} lineHeight={24} color={theme.colors.textNormal} weight={'500'}>
147
+ {t('TOTAL_FOR_ALL_CARTS', 'Total for all Carts')}
148
+ </OText>
149
+ <OText size={16} lineHeight={24} color={theme.colors.textNormal} weight={'500'}>{parsePrice(totalCartsPrice)}</OText>
150
+ </View>
130
151
  <View style={{ flexDirection: 'row', justifyContent: 'center', marginVertical: 20 }}>
131
152
  <OText size={14} color={theme.colors.textNormal} weight={'300'} style={{ textAlign: 'center' }}>
132
153
  {t('CART_GROUP_MESSAGE_ALERT', 'Discounts may be applied at the time of payment for this group.')}