ordering-ui-react-native 0.17.93 → 0.17.94-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 (215) hide show
  1. package/package.json +8 -7
  2. package/src/DeliveryApp.tsx +43 -1
  3. package/src/components/BusinessInformation/index.tsx +10 -9
  4. package/src/components/BusinessesListing/index.tsx +1 -1
  5. package/src/components/OrderCreating/index.tsx +0 -20
  6. package/src/components/PaymentOptionsWebView/index.tsx +29 -8
  7. package/src/components/PhoneInputNumber/index.tsx +6 -2
  8. package/src/components/StripeMethodForm/index.tsx +136 -102
  9. package/src/components/VerifyPhone/styles.tsx +1 -2
  10. package/src/components/shared/OToast.tsx +3 -2
  11. package/src/types/index.tsx +5 -0
  12. package/src/utils/index.tsx +5 -0
  13. package/themes/business/index.tsx +2 -0
  14. package/themes/business/src/components/AcceptOrRejectOrder/index.tsx +36 -26
  15. package/themes/business/src/components/BusinessController/index.tsx +0 -1
  16. package/themes/business/src/components/Chat/index.tsx +163 -123
  17. package/themes/business/src/components/DriverMap/index.tsx +17 -6
  18. package/themes/business/src/components/DriverSchedule/index.tsx +45 -8
  19. package/themes/business/src/components/FloatingButton/index.tsx +34 -31
  20. package/themes/business/src/components/GoogleMap/index.tsx +58 -57
  21. package/themes/business/src/components/LoginForm/index.tsx +5 -2
  22. package/themes/business/src/components/MapView/index.tsx +14 -10
  23. package/themes/business/src/components/MessagesOption/index.tsx +20 -93
  24. package/themes/business/src/components/NewOrderNotification/index.tsx +123 -96
  25. package/themes/business/src/components/NotFoundSource/index.tsx +2 -2
  26. package/themes/business/src/components/OrderDetails/Business.tsx +1 -1
  27. package/themes/business/src/components/OrderDetails/Delivery.tsx +202 -12
  28. package/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +84 -37
  29. package/themes/business/src/components/OrderDetails/OrderHeaderComponent.tsx +87 -66
  30. package/themes/business/src/components/OrderDetailsLogistic/index.tsx +200 -0
  31. package/themes/business/src/components/OrderDetailsLogistic/styles.tsx +5 -0
  32. package/themes/business/src/components/OrderMessage/index.tsx +19 -18
  33. package/themes/business/src/components/OrderSummary/index.tsx +114 -123
  34. package/themes/business/src/components/OrdersOption/index.tsx +41 -46
  35. package/themes/business/src/components/PreviousMessages/FooterMessageComponent.tsx +103 -0
  36. package/themes/business/src/components/PreviousMessages/index.tsx +97 -55
  37. package/themes/business/src/components/PreviousOrders/OrderItem.tsx +21 -29
  38. package/themes/business/src/components/PreviousOrders/OrderList.tsx +93 -0
  39. package/themes/business/src/components/PreviousOrders/OrdersGroupedItem.tsx +1 -1
  40. package/themes/business/src/components/PreviousOrders/index.tsx +198 -221
  41. package/themes/business/src/components/PreviousOrders/styles.tsx +10 -0
  42. package/themes/business/src/components/ProductItemAccordion/index.tsx +7 -1
  43. package/themes/business/src/components/ReviewCustomer/index.tsx +18 -13
  44. package/themes/business/src/components/StoresList/index.tsx +3 -4
  45. package/themes/business/src/components/UserProfileForm/index.tsx +14 -15
  46. package/themes/business/src/components/shared/OModal.tsx +16 -9
  47. package/themes/business/src/types/index.tsx +24 -10
  48. package/themes/business/src/utils/index.tsx +29 -2
  49. package/themes/doordash/src/components/BusinessesListing/index.tsx +1 -1
  50. package/themes/doordash/src/components/LoginForm/index.tsx +1 -2
  51. package/themes/instacart/src/components/BusinessesListing/index.tsx +1 -1
  52. package/themes/kiosk/src/components/Checkout/index.tsx +6 -0
  53. package/themes/kiosk/src/components/Intro/index.tsx +16 -1
  54. package/themes/kiosk/src/components/LoginForm/index.tsx +7 -5
  55. package/themes/kiosk/src/components/NavBar/index.tsx +14 -14
  56. package/themes/kiosk/src/components/OptionCard/index.tsx +1 -1
  57. package/themes/kiosk/src/components/OrderTypeCardSelector/index.tsx +8 -10
  58. package/themes/kiosk/src/components/PhoneInputNumber/index.tsx +2 -2
  59. package/themes/kiosk/src/components/shared/OButton.tsx +5 -18
  60. package/themes/original/index.tsx +1 -1
  61. package/themes/original/src/components/AddressDetails/index.tsx +19 -3
  62. package/themes/original/src/components/AddressForm/index.tsx +35 -17
  63. package/themes/original/src/components/AddressList/index.tsx +5 -8
  64. package/themes/original/src/components/AnalyticsSegment/index.tsx +193 -10
  65. package/themes/original/src/components/AppleLogin/index.tsx +4 -4
  66. package/themes/original/src/components/AppleLogin/styles.tsx +3 -1
  67. package/themes/original/src/components/BusinessBasicInformation/index.tsx +72 -36
  68. package/themes/original/src/components/BusinessBasicInformation/styles.tsx +10 -12
  69. package/themes/original/src/components/BusinessController/index.tsx +35 -44
  70. package/themes/original/src/components/BusinessController/styles.tsx +12 -5
  71. package/themes/original/src/components/BusinessFeaturedController/index.tsx +21 -54
  72. package/themes/original/src/components/BusinessFeaturedController/styles.tsx +8 -0
  73. package/themes/original/src/components/BusinessInformation/index.tsx +140 -85
  74. package/themes/original/src/components/BusinessItemAccordion/index.tsx +15 -20
  75. package/themes/original/src/components/BusinessListingSearch/index.tsx +346 -340
  76. package/themes/original/src/components/BusinessListingSearch/styles.tsx +0 -18
  77. package/themes/original/src/components/BusinessPreorder/index.tsx +103 -19
  78. package/themes/original/src/components/BusinessProductsCategories/index.tsx +1 -2
  79. package/themes/original/src/components/BusinessProductsList/index.tsx +15 -7
  80. package/themes/original/src/components/BusinessProductsList/styles.tsx +8 -3
  81. package/themes/original/src/components/BusinessProductsListing/UpsellingRedirect.tsx +1 -1
  82. package/themes/original/src/components/BusinessProductsListing/index.tsx +136 -31
  83. package/themes/original/src/components/BusinessProductsListing/styles.tsx +2 -3
  84. package/themes/original/src/components/BusinessReviews/index.tsx +3 -1
  85. package/themes/original/src/components/BusinessesListing/Layout/Original/FlatListBusinessListFooter.tsx +69 -0
  86. package/themes/original/src/components/BusinessesListing/Layout/Original/FlatListBusinessListHeader.tsx +406 -0
  87. package/themes/original/src/components/BusinessesListing/Layout/Original/FlatListBusinessListing.tsx +76 -0
  88. package/themes/original/src/components/BusinessesListing/Layout/Original/index.tsx +37 -404
  89. package/themes/original/src/components/BusinessesListing/index.tsx +0 -1
  90. package/themes/original/src/components/Cart/index.tsx +52 -55
  91. package/themes/original/src/components/CartContent/index.tsx +99 -58
  92. package/themes/original/src/components/CartContent/styles.tsx +6 -6
  93. package/themes/original/src/components/Checkout/index.tsx +276 -32
  94. package/themes/original/src/components/CitiesControl/index.tsx +1 -1
  95. package/themes/original/src/components/CouponControl/index.tsx +10 -3
  96. package/themes/original/src/components/DriverTips/index.tsx +12 -4
  97. package/themes/original/src/components/FacebookLogin/styles.tsx +3 -1
  98. package/themes/original/src/components/Favorite/index.tsx +1 -5
  99. package/themes/original/src/components/GPSButton/index.tsx +6 -4
  100. package/themes/original/src/components/GiftCard/GiftCardUI/index.tsx +8 -3
  101. package/themes/original/src/components/GiftCard/PurchaseGiftCard/index.tsx +42 -5
  102. package/themes/original/src/components/GiftCard/PurchaseGiftCard/styles.tsx +2 -0
  103. package/themes/original/src/components/GiftCard/RedeemGiftCard/index.tsx +86 -10
  104. package/themes/original/src/components/GoogleLogin/styles.tsx +1 -1
  105. package/themes/original/src/components/GoogleMap/index.tsx +63 -7
  106. package/themes/original/src/components/Home/index.tsx +13 -4
  107. package/themes/original/src/components/LastOrder/index.tsx +2 -1
  108. package/themes/original/src/components/LastOrders/index.tsx +2 -1
  109. package/themes/original/src/components/LoginForm/Otp/index.tsx +91 -25
  110. package/themes/original/src/components/LoginForm/index.tsx +64 -34
  111. package/themes/original/src/components/LottieAnimation/index.tsx +88 -63
  112. package/themes/original/src/components/MessageListing/index.tsx +9 -2
  113. package/themes/original/src/components/Messages/index.tsx +15 -4
  114. package/themes/original/src/components/MomentOption/index.tsx +193 -92
  115. package/themes/original/src/components/MomentSelector/index.tsx +1 -1
  116. package/themes/original/src/components/MultiCartsPaymethodsAndWallets/index.tsx +161 -49
  117. package/themes/original/src/components/MultiCheckout/index.tsx +347 -69
  118. package/themes/original/src/components/MultiCheckout/styles.tsx +3 -1
  119. package/themes/original/src/components/MultiOrdersDetails/index.tsx +1 -1
  120. package/themes/original/src/components/MyOrders/index.tsx +12 -1
  121. package/themes/original/src/components/NavBar/index.tsx +20 -13
  122. package/themes/original/src/components/NotFoundSource/index.tsx +14 -10
  123. package/themes/original/src/components/OrderDetails/OrderEta.tsx +76 -0
  124. package/themes/original/src/components/OrderDetails/OrderHistory.tsx +21 -5
  125. package/themes/original/src/components/OrderDetails/index.tsx +50 -38
  126. package/themes/original/src/components/OrderDetails/styles.tsx +0 -1
  127. package/themes/original/src/components/OrderItAgain/index.tsx +3 -1
  128. package/themes/original/src/components/OrderProgress/index.tsx +34 -25
  129. package/themes/original/src/components/OrderSummary/index.tsx +83 -57
  130. package/themes/original/src/components/OrderTypeSelector/index.tsx +5 -6
  131. package/themes/original/src/components/OrdersOption/PreviousProductsOrdered/index.tsx +13 -13
  132. package/themes/original/src/components/OrdersOption/index.tsx +43 -20
  133. package/themes/original/src/components/OrdersOption/styles.tsx +1 -1
  134. package/themes/original/src/components/PageBanner/index.tsx +65 -29
  135. package/themes/original/src/components/PageBanner/styles.tsx +0 -3
  136. package/themes/original/src/components/PaymentOptionCard/index.tsx +180 -0
  137. package/themes/original/src/components/PaymentOptionStripe/styles.tsx +3 -0
  138. package/themes/original/src/components/PaymentOptionWallet/index.tsx +56 -56
  139. package/themes/original/src/components/PaymentOptions/index.tsx +100 -34
  140. package/themes/original/src/components/PhoneInputNumber/index.tsx +18 -4
  141. package/themes/original/src/components/ProductForm/index.tsx +86 -30
  142. package/themes/original/src/components/ProductForm/styles.tsx +3 -3
  143. package/themes/original/src/components/ProductItemAccordion/index.tsx +8 -6
  144. package/themes/original/src/components/ProductOptionSubOption/index.tsx +49 -20
  145. package/themes/original/src/components/ProductOptionSubOption/styles.tsx +10 -9
  146. package/themes/original/src/components/ProfessionalFilter/SingleProfessionalCard/index.tsx +108 -0
  147. package/themes/original/src/components/ProfessionalFilter/index.tsx +20 -50
  148. package/themes/original/src/components/ProfessionalProfile/index.tsx +36 -7
  149. package/themes/original/src/components/Promotions/index.tsx +2 -2
  150. package/themes/original/src/components/Promotions/styles.tsx +3 -1
  151. package/themes/original/src/components/ReviewProducts/index.tsx +16 -7
  152. package/themes/original/src/components/ScheduleAccordion/index.tsx +3 -3
  153. package/themes/original/src/components/ServiceForm/index.tsx +63 -20
  154. package/themes/original/src/components/SignupForm/index.tsx +43 -27
  155. package/themes/original/src/components/SingleOrderCard/index.tsx +44 -20
  156. package/themes/original/src/components/SingleOrderCard/styles.tsx +1 -1
  157. package/themes/original/src/components/SingleProductCard/index.tsx +13 -10
  158. package/themes/original/src/components/SingleProductCard/styles.tsx +8 -3
  159. package/themes/original/src/components/SingleProductReview/styles.tsx +1 -1
  160. package/themes/original/src/components/StripeCardsList/index.tsx +61 -5
  161. package/themes/original/src/components/StripeElementsForm/index.tsx +48 -34
  162. package/themes/original/src/components/StripeElementsForm/naked.tsx +12 -1
  163. package/themes/original/src/components/UpsellingProducts/index.tsx +5 -10
  164. package/themes/original/src/components/UserDetails/index.tsx +3 -1
  165. package/themes/original/src/components/UserFormDetails/index.tsx +78 -9
  166. package/themes/original/src/components/UserFormDetails/styles.tsx +1 -1
  167. package/themes/original/src/components/UserProfile/index.tsx +7 -25
  168. package/themes/original/src/components/UserProfileForm/index.tsx +30 -31
  169. package/themes/original/src/components/UserVerification/index.tsx +55 -50
  170. package/themes/original/src/components/WalletTransactionItem/index.tsx +2 -2
  171. package/themes/original/src/components/WalletTransactions/index.tsx +3 -3
  172. package/themes/original/src/components/Wallets/index.tsx +51 -61
  173. package/themes/original/src/components/Wallets/styles.tsx +2 -4
  174. package/themes/original/src/components/shared/OButton.tsx +3 -3
  175. package/themes/original/src/components/shared/OInput.tsx +4 -5
  176. package/themes/original/src/components/shared/OModal.tsx +3 -3
  177. package/themes/original/src/types/index.tsx +37 -10
  178. package/themes/original/src/utils/index.tsx +185 -13
  179. package/themes/uber-eats/src/components/BusinessesListing/index.tsx +1 -1
  180. package/src/navigators/BottomNavigator.tsx +0 -117
  181. package/src/navigators/CheckoutNavigator.tsx +0 -66
  182. package/src/navigators/HomeNavigator.tsx +0 -202
  183. package/src/navigators/NavigationRef.tsx +0 -7
  184. package/src/navigators/RootNavigator.tsx +0 -269
  185. package/src/pages/Account.tsx +0 -34
  186. package/src/pages/AddressForm.tsx +0 -62
  187. package/src/pages/AddressList.tsx +0 -24
  188. package/src/pages/BusinessProductsList.tsx +0 -81
  189. package/src/pages/BusinessesListing.tsx +0 -43
  190. package/src/pages/CartList.tsx +0 -49
  191. package/src/pages/Checkout.tsx +0 -101
  192. package/src/pages/ForgotPassword.tsx +0 -24
  193. package/src/pages/Help.tsx +0 -23
  194. package/src/pages/HelpAccountAndPayment.tsx +0 -23
  195. package/src/pages/HelpGuide.tsx +0 -23
  196. package/src/pages/HelpOrder.tsx +0 -23
  197. package/src/pages/Home.tsx +0 -36
  198. package/src/pages/IntroductoryTutorial.tsx +0 -170
  199. package/src/pages/Login.tsx +0 -47
  200. package/src/pages/MomentOption.tsx +0 -30
  201. package/src/pages/MultiCheckout.tsx +0 -31
  202. package/src/pages/MultiOrdersDetails.tsx +0 -27
  203. package/src/pages/MyOrders.tsx +0 -40
  204. package/src/pages/NetworkError.tsx +0 -24
  205. package/src/pages/NotFound.tsx +0 -22
  206. package/src/pages/OrderDetails.tsx +0 -25
  207. package/src/pages/ProductDetails.tsx +0 -55
  208. package/src/pages/Profile.tsx +0 -36
  209. package/src/pages/ReviewDriver.tsx +0 -30
  210. package/src/pages/ReviewOrder.tsx +0 -32
  211. package/src/pages/ReviewProducts.tsx +0 -30
  212. package/src/pages/Sessions.tsx +0 -22
  213. package/src/pages/Signup.tsx +0 -53
  214. package/src/pages/SpinnerLoader.tsx +0 -10
  215. package/src/pages/Splash.tsx +0 -21
@@ -1,7 +1,7 @@
1
- import React from 'react';
1
+ import React, { useState, useCallback } from 'react';
2
2
  import {
3
3
  BusinessInformation as BusinessInformationController,
4
- useLanguage, useUtils
4
+ useLanguage, useUtils, useConfig,
5
5
  } from 'ordering-components/native';
6
6
  import { useTheme } from 'styled-components/native';
7
7
  import { OIcon, OText } from '../shared';
@@ -16,31 +16,41 @@ import {
16
16
  DivideView,
17
17
  MediaWrapper,
18
18
  } from './styles';
19
- import { StyleSheet, View } from 'react-native';
19
+ import { StyleSheet, View, TouchableOpacity } from 'react-native';
20
20
  import { BusinessInformationParams } from '../../types';
21
21
  import { GoogleMap } from '../GoogleMap';
22
22
  import { WebView } from 'react-native-webview';
23
23
  import { formatUrlVideo } from '../../utils'
24
24
  import { ScheduleAccordion } from '../ScheduleAccordion';
25
+ import moment from 'moment';
26
+ import { DeviceOrientationMethods } from '../../../../../src/hooks/DeviceOrientation'
27
+ const { useDeviceOrientation } = DeviceOrientationMethods
28
+
25
29
  const BusinessInformationUI = (props: BusinessInformationParams) => {
26
30
  const { businessState, businessSchedule, businessLocation } = props;
27
31
 
28
32
  const theme = useTheme();
29
33
  const [, t] = useLanguage();
30
34
  const [{ optimizeImage }] = useUtils();
35
+ const [{ configs }] = useConfig()
36
+ const [orientationState] = useDeviceOrientation();
37
+
38
+ const [isReadMore, setIsReadMore] = useState(false)
39
+ const [lengthMore, setLengthMore] = useState(false)
40
+ const WIDTH_SCREEN = orientationState?.dimensions?.width
41
+
42
+ const hideLocation = theme?.business_view?.components?.information?.components?.location?.hidden
43
+ const hideSchedule = theme?.business_view?.components?.information?.components?.schedule?.hidden
44
+ const hideVideos = theme?.business_view?.components?.information?.components?.videos?.hidden
45
+ const hideImages = theme?.business_view?.components?.information?.components?.images?.hidden
46
+ const hideAddress = theme?.business_view?.components?.information?.components?.address?.hidden
47
+ const formatTime = configs?.general_hour_format?.value
48
+
49
+ const checkTime = (val: number) => (val < 10 ? `0${val}` : val);
50
+ const timeFormated = (time: any) => {
51
+ return moment(`1900-01-01 ${checkTime(time.hour)}:${checkTime(time.minute)}`).format(formatTime)
52
+ }
31
53
 
32
- const scheduleFormatted = ({
33
- hour,
34
- minute,
35
- }: {
36
- hour: number | string;
37
- minute: number | string;
38
- }) => {
39
- const checkTime = (val: number | string) => (val < 10 ? `0${val}` : val);
40
- const zz = hour > 12 ? 'PM' : 'AM';
41
- const h = parseInt(`${hour}`);
42
- return `${h > 12 ? h - 12 : h}:${checkTime(minute)} ${zz}`;
43
- };
44
54
  const businessCoordinate = {
45
55
  lat: businessState?.business?.location?.lat,
46
56
  lng: businessState?.business?.location?.lng,
@@ -71,6 +81,10 @@ const BusinessInformationUI = (props: BusinessInformationParams) => {
71
81
  return iAry;
72
82
  };
73
83
 
84
+ const onTextLayout = useCallback((e: any) => {
85
+ setLengthMore((e.nativeEvent.lines.length == 3 && e.nativeEvent.lines[2].width > WIDTH_SCREEN * .76) || e.nativeEvent.lines.length > 3)
86
+ }, [])
87
+
74
88
  return (
75
89
  <BusinessInformationContainer>
76
90
  <WrapMainContent contentContainerStyle={{}}>
@@ -78,87 +92,128 @@ const BusinessInformationUI = (props: BusinessInformationParams) => {
78
92
  <OText size={24} weight={'600'}>
79
93
  {businessState?.business?.name}
80
94
  </OText>
81
- <GrayBackground>
82
- <OText size={16} weight="500">
83
- {t('BUSINESS_LOCATION', 'Business Location')}
95
+ {!hideLocation && (
96
+ <>
97
+ <GrayBackground>
98
+ <OText size={16} weight="500">
99
+ {t('BUSINESS_LOCATION', 'Business Location')}
100
+ </OText>
101
+ </GrayBackground>
102
+ {businessLocation.location && (
103
+ <WrapBusinessMap style={styles.wrapMapStyle}>
104
+ <GoogleMap
105
+ readOnly
106
+ location={businessLocation.location}
107
+ markerTitle={businessState?.business?.name}
108
+ businessZones={businessState?.business?.zones}
109
+ />
110
+ </WrapBusinessMap>
111
+ )}
112
+ </>
113
+ )}
114
+ {!hideAddress && (
115
+ <OText size={12} mBottom={10}>
116
+ {businessState?.business?.address}
84
117
  </OText>
85
- </GrayBackground>
86
- {businessLocation.location && (
87
- <WrapBusinessMap style={styles.wrapMapStyle}>
88
- <GoogleMap
89
- readOnly
90
- location={businessLocation.location}
91
- markerTitle={businessState?.business?.name}
92
- />
93
- </WrapBusinessMap>
94
118
  )}
95
- <OText size={12} mBottom={20}>
96
- {businessState?.business?.address}
97
- </OText>
119
+ {businessState?.business?.address_notes && (
120
+ <>
121
+ <OText
122
+ size={12}
123
+ mBottom={10}
124
+ numberOfLines={isReadMore ? 20 : 3}
125
+ onTextLayout={onTextLayout}
126
+ >
127
+ {businessState?.business?.address_notes}
128
+ </OText>
129
+ {lengthMore && (
130
+ <TouchableOpacity
131
+ onPress={() => setIsReadMore(!isReadMore)}
132
+ >
133
+ <OText size={12} mBottom={20} color={theme.colors.primary}>{isReadMore ? t('SHOW_LESS', 'Show less') : t('READ_MORE', 'Read more')}</OText>
134
+ </TouchableOpacity>
135
+ )}
136
+ </>
137
+ )}
98
138
  <DivideView />
99
- <GrayBackground>
100
- <OText size={16} weight="500">
101
- {t('OPENING_TIME', 'Opening Time')}
102
- </OText>
103
- </GrayBackground>
104
- {businessSchedule && businessSchedule?.length > 0 && (
105
- <WrapScheduleBlock>
106
- {businessSchedule.map((schedule: any, i: number) => (
107
- <ScheduleBlock key={i}>
108
- <ScheduleAccordion
109
- weekIndex={i}
110
- scheduleFormatted={scheduleFormatted}
111
- schedule={schedule}
112
- />
113
- </ScheduleBlock>
114
- ))}
115
- </WrapScheduleBlock>
139
+ {!hideSchedule && (
140
+ <>
141
+ <GrayBackground>
142
+ <OText size={16} weight="500">
143
+ {t('OPENING_TIME', 'Opening Time')}
144
+ </OText>
145
+ </GrayBackground>
146
+ {businessSchedule && businessSchedule?.length > 0 && (
147
+ <WrapScheduleBlock>
148
+ {businessSchedule.map((schedule: any, i: number) => (
149
+ <ScheduleBlock key={i}>
150
+ <ScheduleAccordion
151
+ weekIndex={i}
152
+ timeFormated={timeFormated}
153
+ schedule={schedule}
154
+ />
155
+ </ScheduleBlock>
156
+ ))}
157
+ </WrapScheduleBlock>
158
+ )}
159
+ </>
116
160
  )}
161
+
117
162
  {/* {businessState?.business?.gallery?.length > 0 && ( */}
163
+
118
164
  <>
119
- {bVideos().length > 0 && (
165
+ {!hideVideos && (
120
166
  <>
121
- <DivideView />
122
- <GrayBackground>
123
- <OText size={16} weight="500">
124
- {t('VIDEOS', 'Videos')}
125
- </OText>
126
- </GrayBackground>
127
- <MediaWrapper horizontal>
128
- {bVideos().map((v: any) => (
129
- <WebView
130
- key={`vid_id_${v.id}`}
131
- style={{ width: 210, height: 127, borderRadius: 7.6 }}
132
- javaScriptEnabled={true}
133
- domStorageEnabled={true}
134
- source={{
135
- html: `
136
- <iframe width='80%' height='80%' src="${formatUrlVideo(v.video)}" frameBorder='0' allow='autoplay; encrypted-media' allowFullScreen />
167
+ {bVideos().length > 0 && (
168
+ <>
169
+ <DivideView />
170
+ <GrayBackground>
171
+ <OText size={16} weight="500">
172
+ {t('VIDEOS', 'Videos')}
173
+ </OText>
174
+ </GrayBackground>
175
+ <MediaWrapper horizontal>
176
+ {bVideos().map((v: any) => (
177
+ <WebView
178
+ key={`vid_id_${v.id}`}
179
+ style={{ width: 210, height: 127, borderRadius: 7.6 }}
180
+ javaScriptEnabled={true}
181
+ domStorageEnabled={true}
182
+ source={{
183
+ html: `
184
+ <iframe width='80%' height='80%' src="${formatUrlVideo(v.video)}" frameBorder='0' allow='autoplay; encrypted-media' allowFullScreen />
137
185
  `,
138
- }}
139
- mediaPlaybackRequiresUserAction={true}
140
- />
141
- ))}
142
- </MediaWrapper>
186
+ }}
187
+ mediaPlaybackRequiresUserAction={true}
188
+ />
189
+ ))}
190
+ </MediaWrapper>
191
+ </>
192
+ )}
143
193
  </>
144
194
  )}
145
- {bImages().length > 0 && (
195
+
196
+ {!hideImages && (
146
197
  <>
147
- <DivideView />
148
- <GrayBackground>
149
- <OText size={16} weight="500">
150
- {t('IMAGES', 'Images')}
151
- </OText>
152
- </GrayBackground>
153
- <MediaWrapper horizontal>
154
- {bImages().map((i: any) => (
155
- i.file != null &&
156
- <View key={i.id} style={{ width: 210, height: 127, borderRadius: 7.6, marginEnd: 20, overflow: 'hidden' }}>
157
- <OIcon cover url={optimizeImage(i?.file, 'h_150,c_limit')} width={210} height={127} />
158
- {/* <OText size={12} color={colors.red} style={{position: 'absolute'}}>{i.file}</OText> */}
159
- </View>
160
- ))}
161
- </MediaWrapper>
198
+ {bImages().length > 0 && (
199
+ <>
200
+ <DivideView />
201
+ <GrayBackground>
202
+ <OText size={16} weight="500">
203
+ {t('IMAGES', 'Images')}
204
+ </OText>
205
+ </GrayBackground>
206
+ <MediaWrapper horizontal>
207
+ {bImages().map((i: any) => (
208
+ i.file != null &&
209
+ <View key={i.id} style={{ width: 210, height: 127, borderRadius: 7.6, marginEnd: 20, overflow: 'hidden' }}>
210
+ <OIcon cover url={optimizeImage(i?.file, 'h_150,c_limit')} width={210} height={127} />
211
+ {/* <OText size={12} color={colors.red} style={{position: 'absolute'}}>{i.file}</OText> */}
212
+ </View>
213
+ ))}
214
+ </MediaWrapper>
215
+ </>
216
+ )}
162
217
  </>
163
218
  )}
164
219
  </>
@@ -1,6 +1,6 @@
1
1
  import React, { useState, useRef, useEffect } from 'react';
2
2
  import { TouchableOpacity, View } from 'react-native';
3
- import { useOrder, useLanguage, useUtils, useConfig } from 'ordering-components/native';
3
+ import { useOrder, useLanguage, useUtils, useConfig, useEvent } from 'ordering-components/native';
4
4
  import { useTheme } from 'styled-components/native';
5
5
  import {
6
6
  BIContainer,
@@ -22,7 +22,8 @@ export const BusinessItemAccordion = (props: any) => {
22
22
  handleClearProducts,
23
23
  handleClickCheckout,
24
24
  checkoutButtonDisabled,
25
- isMultiCheckout
25
+ isMultiCheckout,
26
+ isFromUpselling
26
27
  } = props
27
28
 
28
29
  const [orderState] = useOrder();
@@ -30,6 +31,7 @@ export const BusinessItemAccordion = (props: any) => {
30
31
  const [{ parsePrice }] = useUtils();
31
32
  const [{ configs }] = useConfig()
32
33
  const theme = useTheme();
34
+ const [events] = useEvent()
33
35
 
34
36
  const isCartPending = cart?.status === 2
35
37
  const isClosed = !cart?.valid_schedule
@@ -37,6 +39,7 @@ export const BusinessItemAccordion = (props: any) => {
37
39
  const isBusinessChangeEnabled = configs?.cart_change_business_validation?.value === '1'
38
40
 
39
41
  const [isActive, setActiveState] = useState(!!singleBusiness)
42
+ const [viewedCart, setViewedCart] = useState<any>(null)
40
43
 
41
44
  useEffect(() => {
42
45
  const cartsArray = Object.values(orderState?.carts)
@@ -52,6 +55,15 @@ export const BusinessItemAccordion = (props: any) => {
52
55
  return acc = acc
53
56
  }, cart?.subtotal)
54
57
 
58
+ useEffect(() => {
59
+ if (isActive && !isFromUpselling) {
60
+ if (cart?.uuid !== viewedCart?.uuid) {
61
+ setViewedCart(cart)
62
+ events.emit('cart_viewed', cart)
63
+ }
64
+ }
65
+ }, [isActive, viewedCart])
66
+
55
67
  return (
56
68
  <BIContainer isClosed={isClosed} isMultiCheckout={isMultiCheckout} checkoutVisible={!isActive && !isClosed && !!isProducts && !checkoutButtonDisabled}>
57
69
  <BIHeader
@@ -62,23 +74,6 @@ export const BusinessItemAccordion = (props: any) => {
62
74
  <BIInfo>
63
75
  <BIContentInfo>
64
76
  <OText size={16} lineHeight={24} weight={'600'}>{cart?.business?.name}</OText>
65
- {/* {orderState?.options?.type === 1 ? (
66
- <View style={{ display: 'flex', flexDirection: 'row', alignItems: 'center' }}>
67
- <MaterialCommunityIcon
68
- name='clock-outline'
69
- size={24}
70
- />
71
- <OText>{convertHoursToMinutes(cart?.business?.delivery_time)}</OText>
72
- </View>
73
- ) : (
74
- <View style={{ display: 'flex', flexDirection: 'row', alignItems: 'center' }}>
75
- <MaterialCommunityIcon
76
- name='clock-outline'
77
- size={24}
78
- />
79
- <OText>{convertHoursToMinutes(cart?.business?.pickup_time)}</OText>
80
- </View>
81
- )} */}
82
77
  <View style={{ flexDirection: 'row' }}>
83
78
  {props.onNavigationRedirect && !isClosed && (
84
79
  <>
@@ -87,7 +82,7 @@ export const BusinessItemAccordion = (props: any) => {
87
82
  </TouchableOpacity>
88
83
  </>
89
84
  )}
90
- {!isCartPending && !isClosed && (
85
+ {!isCartPending && (
91
86
  <>
92
87
  <OText color={theme.colors.textSecondary}>{' \u2022 '}</OText>
93
88
  <OAlert