ordering-ui-react-native 0.17.52 → 0.17.53-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 (217) hide show
  1. package/package.json +8 -7
  2. package/src/DeliveryApp.tsx +43 -1
  3. package/src/components/BusinessesListing/index.tsx +1 -1
  4. package/src/components/OrderCreating/index.tsx +1 -21
  5. package/src/components/PaymentOptionsWebView/index.tsx +29 -8
  6. package/src/components/PhoneInputNumber/index.tsx +6 -2
  7. package/src/components/StripeMethodForm/index.tsx +136 -102
  8. package/src/components/VerifyPhone/styles.tsx +1 -2
  9. package/src/components/shared/OToast.tsx +4 -4
  10. package/src/types/index.tsx +5 -0
  11. package/src/utils/index.tsx +5 -0
  12. package/themes/business/index.tsx +2 -0
  13. package/themes/business/src/components/AcceptOrRejectOrder/index.tsx +265 -240
  14. package/themes/business/src/components/AcceptOrRejectOrder/styles.tsx +6 -4
  15. package/themes/business/src/components/BusinessController/index.tsx +0 -1
  16. package/themes/business/src/components/Chat/index.tsx +125 -113
  17. package/themes/business/src/components/DriverMap/index.tsx +17 -6
  18. package/themes/business/src/components/DriverSchedule/index.tsx +29 -2
  19. package/themes/business/src/components/GoogleMap/index.tsx +58 -57
  20. package/themes/business/src/components/LoginForm/Otp/index.tsx +120 -0
  21. package/themes/business/src/components/LoginForm/Otp/styles.tsx +7 -0
  22. package/themes/business/src/components/LoginForm/index.tsx +238 -80
  23. package/themes/business/src/components/LoginForm/styles.tsx +10 -0
  24. package/themes/business/src/components/MapView/index.tsx +10 -10
  25. package/themes/business/src/components/NewOrderNotification/index.tsx +35 -21
  26. package/themes/business/src/components/OrderDetails/Delivery.tsx +191 -6
  27. package/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +93 -50
  28. package/themes/business/src/components/OrderDetails/OrderHeaderComponent.tsx +63 -62
  29. package/themes/business/src/components/OrderDetailsLogistic/index.tsx +195 -0
  30. package/themes/business/src/components/OrderDetailsLogistic/styles.tsx +5 -0
  31. package/themes/business/src/components/OrderMessage/index.tsx +18 -17
  32. package/themes/business/src/components/OrderSummary/index.tsx +113 -121
  33. package/themes/business/src/components/OrdersOption/index.tsx +32 -75
  34. package/themes/business/src/components/PreviousOrders/OrderItem.tsx +249 -0
  35. package/themes/business/src/components/PreviousOrders/OrdersGroupedItem.tsx +115 -0
  36. package/themes/business/src/components/PreviousOrders/index.tsx +445 -243
  37. package/themes/business/src/components/PreviousOrders/styles.tsx +31 -3
  38. package/themes/business/src/components/ProductItemAccordion/index.tsx +27 -3
  39. package/themes/business/src/components/ReviewCustomer/index.tsx +30 -15
  40. package/themes/business/src/components/StoresList/index.tsx +2 -2
  41. package/themes/business/src/components/UserProfileForm/index.tsx +11 -13
  42. package/themes/business/src/components/shared/OLink.tsx +33 -13
  43. package/themes/business/src/components/shared/OModal.tsx +16 -9
  44. package/themes/business/src/components/shared/OText.tsx +8 -2
  45. package/themes/business/src/types/index.tsx +32 -2
  46. package/themes/business/src/utils/index.tsx +44 -1
  47. package/themes/doordash/src/components/BusinessesListing/index.tsx +1 -1
  48. package/themes/doordash/src/components/LoginForm/index.tsx +1 -2
  49. package/themes/instacart/src/components/BusinessesListing/index.tsx +1 -1
  50. package/themes/kiosk/src/components/Checkout/index.tsx +6 -0
  51. package/themes/kiosk/src/components/LoginForm/Otp/index.tsx +92 -0
  52. package/themes/kiosk/src/components/LoginForm/Otp/styles.tsx +7 -0
  53. package/themes/kiosk/src/components/LoginForm/index.tsx +480 -156
  54. package/themes/kiosk/src/components/LoginForm/styles.tsx +14 -1
  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 +3 -2
  59. package/themes/kiosk/src/components/PhoneInputNumber/styles.tsx +1 -3
  60. package/themes/kiosk/src/components/shared/OButton.tsx +5 -18
  61. package/themes/kiosk/src/components/shared/OModal.tsx +14 -11
  62. package/themes/kiosk/src/layouts/Container.tsx +7 -1
  63. package/themes/kiosk/src/types/index.d.ts +13 -0
  64. package/themes/kiosk/src/utils/index.tsx +15 -0
  65. package/themes/original/index.tsx +4 -0
  66. package/themes/original/src/components/AddressDetails/index.tsx +28 -10
  67. package/themes/original/src/components/AddressForm/index.tsx +73 -42
  68. package/themes/original/src/components/AddressList/index.tsx +27 -22
  69. package/themes/original/src/components/AddressList/styles.tsx +4 -2
  70. package/themes/original/src/components/AnalyticsSegment/index.tsx +193 -10
  71. package/themes/original/src/components/AppleLogin/index.tsx +4 -4
  72. package/themes/original/src/components/AppleLogin/styles.tsx +3 -1
  73. package/themes/original/src/components/BusinessBasicInformation/index.tsx +160 -91
  74. package/themes/original/src/components/BusinessBasicInformation/styles.tsx +9 -7
  75. package/themes/original/src/components/BusinessController/index.tsx +122 -68
  76. package/themes/original/src/components/BusinessController/styles.tsx +23 -4
  77. package/themes/original/src/components/BusinessFeaturedController/index.tsx +21 -54
  78. package/themes/original/src/components/BusinessFeaturedController/styles.tsx +8 -0
  79. package/themes/original/src/components/BusinessInformation/index.tsx +110 -108
  80. package/themes/original/src/components/BusinessItemAccordion/index.tsx +23 -22
  81. package/themes/original/src/components/BusinessListingSearch/index.tsx +352 -326
  82. package/themes/original/src/components/BusinessPreorder/index.tsx +103 -19
  83. package/themes/original/src/components/BusinessProductsCategories/index.tsx +1 -2
  84. package/themes/original/src/components/BusinessProductsList/index.tsx +25 -15
  85. package/themes/original/src/components/BusinessProductsList/styles.tsx +8 -3
  86. package/themes/original/src/components/BusinessProductsListing/UpsellingRedirect.tsx +1 -1
  87. package/themes/original/src/components/BusinessProductsListing/index.tsx +668 -514
  88. package/themes/original/src/components/BusinessProductsListing/styles.tsx +2 -2
  89. package/themes/original/src/components/BusinessReviews/index.tsx +3 -1
  90. package/themes/original/src/components/BusinessesListing/Layout/Appointment/index.tsx +1 -1
  91. package/themes/original/src/components/BusinessesListing/Layout/Original/index.tsx +97 -91
  92. package/themes/original/src/components/BusinessesListing/Layout/Original/styles.tsx +1 -4
  93. package/themes/original/src/components/BusinessesListing/index.tsx +0 -1
  94. package/themes/original/src/components/Cart/index.tsx +100 -67
  95. package/themes/original/src/components/CartContent/index.tsx +115 -19
  96. package/themes/original/src/components/CartContent/styles.tsx +17 -7
  97. package/themes/original/src/components/Checkout/index.tsx +367 -174
  98. package/themes/original/src/components/Checkout/styles.tsx +4 -2
  99. package/themes/original/src/components/CitiesControl/index.tsx +89 -0
  100. package/themes/original/src/components/CitiesControl/styles.tsx +17 -0
  101. package/themes/original/src/components/CouponControl/index.tsx +10 -3
  102. package/themes/original/src/components/DriverTips/index.tsx +52 -34
  103. package/themes/original/src/components/FacebookLogin/styles.tsx +3 -1
  104. package/themes/original/src/components/Favorite/index.tsx +8 -9
  105. package/themes/original/src/components/Favorite/styles.tsx +1 -1
  106. package/themes/original/src/components/FavoriteList/index.tsx +51 -80
  107. package/themes/original/src/components/FloatingButton/index.tsx +1 -2
  108. package/themes/original/src/components/FloatingButton/styles.tsx +1 -1
  109. package/themes/original/src/components/GPSButton/index.tsx +6 -4
  110. package/themes/original/src/components/GPSButton/styles.ts +3 -3
  111. package/themes/original/src/components/GiftCard/GiftCardUI/index.tsx +96 -0
  112. package/themes/original/src/components/GiftCard/GiftCardUI/styles.tsx +5 -0
  113. package/themes/original/src/components/GiftCard/PurchaseGiftCard/index.tsx +100 -0
  114. package/themes/original/src/components/GiftCard/PurchaseGiftCard/styles.tsx +8 -0
  115. package/themes/original/src/components/GiftCard/RedeemGiftCard/index.tsx +191 -0
  116. package/themes/original/src/components/GiftCard/RedeemGiftCard/styles.tsx +8 -0
  117. package/themes/original/src/components/GiftCard/SendGiftCard/index.tsx +165 -0
  118. package/themes/original/src/components/GiftCard/SendGiftCard/styles.tsx +9 -0
  119. package/themes/original/src/components/GoogleLogin/styles.tsx +1 -1
  120. package/themes/original/src/components/GoogleMap/index.tsx +15 -4
  121. package/themes/original/src/components/Help/index.tsx +8 -8
  122. package/themes/original/src/components/HelpAccountAndPayment/index.tsx +10 -31
  123. package/themes/original/src/components/HelpAccountAndPayment/styles.tsx +5 -3
  124. package/themes/original/src/components/HelpGuide/index.tsx +6 -6
  125. package/themes/original/src/components/HelpGuide/styles.tsx +6 -0
  126. package/themes/original/src/components/HelpOrder/index.tsx +6 -15
  127. package/themes/original/src/components/HelpOrder/styles.tsx +8 -1
  128. package/themes/original/src/components/Home/index.tsx +13 -4
  129. package/themes/original/src/components/LastOrder/index.tsx +1 -34
  130. package/themes/original/src/components/LoginForm/Otp/index.tsx +55 -13
  131. package/themes/original/src/components/LoginForm/Otp/styles.tsx +0 -1
  132. package/themes/original/src/components/LoginForm/index.tsx +64 -26
  133. package/themes/original/src/components/LottieAnimation/index.tsx +89 -55
  134. package/themes/original/src/components/MessageListing/index.tsx +16 -42
  135. package/themes/original/src/components/Messages/index.tsx +32 -10
  136. package/themes/original/src/components/MomentOption/index.tsx +195 -88
  137. package/themes/original/src/components/MultiCart/index.tsx +50 -0
  138. package/themes/original/src/components/MultiCartsPaymethodsAndWallets/index.tsx +151 -49
  139. package/themes/original/src/components/MultiCheckout/index.tsx +308 -88
  140. package/themes/original/src/components/MultiCheckout/styles.tsx +3 -1
  141. package/themes/original/src/components/MultiOrdersDetails/SingleOrderCard.tsx +37 -224
  142. package/themes/original/src/components/MultiOrdersDetails/index.tsx +68 -21
  143. package/themes/original/src/components/MultiOrdersDetails/styles.tsx +1 -1
  144. package/themes/original/src/components/MyOrders/index.tsx +77 -52
  145. package/themes/original/src/components/NavBar/index.tsx +18 -18
  146. package/themes/original/src/components/NotFoundSource/index.tsx +14 -10
  147. package/themes/original/src/components/Notifications/index.tsx +46 -50
  148. package/themes/original/src/components/Notifications/styles.tsx +6 -3
  149. package/themes/original/src/components/OrderDetails/OrderEta.tsx +76 -0
  150. package/themes/original/src/components/OrderDetails/OrderHistory.tsx +15 -3
  151. package/themes/original/src/components/OrderDetails/index.tsx +190 -358
  152. package/themes/original/src/components/OrderDetails/styles.tsx +0 -1
  153. package/themes/original/src/components/OrderItAgain/index.tsx +3 -1
  154. package/themes/original/src/components/OrderProgress/index.tsx +33 -59
  155. package/themes/original/src/components/OrderSummary/index.tsx +85 -57
  156. package/themes/original/src/components/OrderTypeSelector/index.tsx +1 -1
  157. package/themes/original/src/components/OrdersOption/PreviousBusinessOrdered/index.tsx +24 -19
  158. package/themes/original/src/components/OrdersOption/PreviousProductsOrdered/index.tsx +14 -14
  159. package/themes/original/src/components/OrdersOption/index.tsx +76 -66
  160. package/themes/original/src/components/OrdersOption/styles.tsx +1 -1
  161. package/themes/original/src/components/PageBanner/index.tsx +107 -40
  162. package/themes/original/src/components/PageBanner/styles.tsx +4 -1
  163. package/themes/original/src/components/PaymentOptionCard/index.tsx +180 -0
  164. package/themes/original/src/components/PaymentOptionStripe/styles.tsx +1 -1
  165. package/themes/original/src/components/PaymentOptionWallet/index.tsx +56 -56
  166. package/themes/original/src/components/PaymentOptions/index.tsx +64 -7
  167. package/themes/original/src/components/PhoneInputNumber/index.tsx +3 -3
  168. package/themes/original/src/components/PlaceSpot/index.tsx +12 -6
  169. package/themes/original/src/components/ProductForm/index.tsx +110 -33
  170. package/themes/original/src/components/ProductForm/styles.tsx +5 -7
  171. package/themes/original/src/components/ProductItemAccordion/index.tsx +22 -19
  172. package/themes/original/src/components/ProductOptionSubOption/index.tsx +24 -14
  173. package/themes/original/src/components/ProductOptionSubOption/styles.tsx +3 -4
  174. package/themes/original/src/components/ProfessionalFilter/SingleProfessionalCard/index.tsx +108 -0
  175. package/themes/original/src/components/ProfessionalFilter/index.tsx +20 -50
  176. package/themes/original/src/components/ProfessionalProfile/index.tsx +36 -7
  177. package/themes/original/src/components/Promotions/index.tsx +234 -220
  178. package/themes/original/src/components/Promotions/styles.tsx +10 -3
  179. package/themes/original/src/components/ReviewDriver/index.tsx +3 -3
  180. package/themes/original/src/components/ReviewOrder/index.tsx +26 -9
  181. package/themes/original/src/components/ReviewOrder/styles.tsx +7 -0
  182. package/themes/original/src/components/ReviewProducts/index.tsx +23 -11
  183. package/themes/original/src/components/ReviewTrigger/index.tsx +27 -9
  184. package/themes/original/src/components/ReviewTrigger/styles.tsx +8 -1
  185. package/themes/original/src/components/ScheduleAccordion/index.tsx +68 -0
  186. package/themes/original/src/components/ScheduleAccordion/styles.tsx +14 -0
  187. package/themes/original/src/components/ServiceForm/index.tsx +66 -17
  188. package/themes/original/src/components/Sessions/index.tsx +11 -8
  189. package/themes/original/src/components/Sessions/styles.tsx +5 -0
  190. package/themes/original/src/components/SignupForm/index.tsx +43 -20
  191. package/themes/original/src/components/SingleOrderCard/index.tsx +130 -52
  192. package/themes/original/src/components/SingleOrderCard/styles.tsx +11 -2
  193. package/themes/original/src/components/SingleProductCard/index.tsx +71 -34
  194. package/themes/original/src/components/SingleProductCard/styles.tsx +21 -4
  195. package/themes/original/src/components/SingleProductReview/styles.tsx +1 -1
  196. package/themes/original/src/components/StripeCardsList/index.tsx +13 -3
  197. package/themes/original/src/components/StripeElementsForm/index.tsx +48 -34
  198. package/themes/original/src/components/UpsellingProducts/index.tsx +238 -224
  199. package/themes/original/src/components/UpsellingProducts/styles.tsx +12 -1
  200. package/themes/original/src/components/UserDetails/index.tsx +8 -4
  201. package/themes/original/src/components/UserFormDetails/index.tsx +76 -7
  202. package/themes/original/src/components/UserFormDetails/styles.tsx +1 -1
  203. package/themes/original/src/components/UserProfile/index.tsx +88 -79
  204. package/themes/original/src/components/UserProfileForm/index.tsx +27 -29
  205. package/themes/original/src/components/UserProfileForm/styles.tsx +7 -0
  206. package/themes/original/src/components/WalletTransactionItem/index.tsx +2 -2
  207. package/themes/original/src/components/WalletTransactions/index.tsx +3 -3
  208. package/themes/original/src/components/Wallets/index.tsx +67 -24
  209. package/themes/original/src/components/Wallets/styles.tsx +3 -4
  210. package/themes/original/src/components/shared/HeaderTitle.tsx +8 -3
  211. package/themes/original/src/components/shared/OButton.tsx +6 -2
  212. package/themes/original/src/components/shared/OInput.tsx +6 -1
  213. package/themes/original/src/components/shared/OModal.tsx +3 -3
  214. package/themes/original/src/layouts/Container.tsx +1 -1
  215. package/themes/original/src/types/index.tsx +40 -11
  216. package/themes/original/src/utils/index.tsx +375 -58
  217. package/themes/uber-eats/src/components/BusinessesListing/index.tsx +1 -1
@@ -1,7 +1,7 @@
1
1
  import React 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,38 +16,33 @@ import {
16
16
  DivideView,
17
17
  MediaWrapper,
18
18
  } from './styles';
19
- import { Platform, StyleSheet, View } from 'react-native';
19
+ import { StyleSheet, View } 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
+ import { ScheduleAccordion } from '../ScheduleAccordion';
25
+ import moment from 'moment';
24
26
  const BusinessInformationUI = (props: BusinessInformationParams) => {
25
27
  const { businessState, businessSchedule, businessLocation } = props;
26
28
 
27
29
  const theme = useTheme();
28
30
  const [, t] = useLanguage();
29
31
  const [{ optimizeImage }] = useUtils();
30
- const daysOfWeek = [
31
- t('SUNDAY_ABBREVIATION', 'Sun'),
32
- t('MONDAY_ABBREVIATION', 'Mon'),
33
- t('TUESDAY_ABBREVIATION', 'Tues'),
34
- t('WEDNESDAY_ABBREVIATION', 'Wed'),
35
- t('THURSDAY_ABBREVIATION', 'Thur'),
36
- t('FRIDAY_ABBREVIATION', 'Fri'),
37
- t('SATURDAY_ABBREVIATION', 'Sat'),
38
- ];
39
- const scheduleFormatted = ({
40
- hour,
41
- minute,
42
- }: {
43
- hour: number | string;
44
- minute: number | string;
45
- }) => {
46
- const checkTime = (val: number | string) => (val < 10 ? `0${val}` : val);
47
- const zz = hour > 12 ? 'PM' : 'AM';
48
- const h = parseInt(`${hour}`);
49
- return `${h > 12 ? h - 12 : h}:${checkTime(minute)} ${zz}`;
50
- };
32
+ const [{ configs }] = useConfig()
33
+
34
+ const hideLocation = theme?.business_view?.components?.information?.components?.location?.hidden
35
+ const hideSchedule = theme?.business_view?.components?.information?.components?.schedule?.hidden
36
+ const hideVideos = theme?.business_view?.components?.information?.components?.videos?.hidden
37
+ const hideImages = theme?.business_view?.components?.information?.components?.images?.hidden
38
+ const hideAddress = theme?.business_view?.components?.information?.components?.address?.hidden
39
+ const formatTime = configs?.general_hour_format?.value
40
+
41
+ const checkTime = (val: number) => (val < 10 ? `0${val}` : val);
42
+ const timeFormated = (time: any) => {
43
+ return moment(`1900-01-01 ${checkTime(time.hour)}:${checkTime(time.minute)}`).format(formatTime)
44
+ }
45
+
51
46
  const businessCoordinate = {
52
47
  lat: businessState?.business?.location?.lat,
53
48
  lng: businessState?.business?.location?.lng,
@@ -85,101 +80,108 @@ const BusinessInformationUI = (props: BusinessInformationParams) => {
85
80
  <OText size={24} weight={'600'}>
86
81
  {businessState?.business?.name}
87
82
  </OText>
88
- <GrayBackground>
89
- <OText size={16} weight="500">
90
- {t('BUSINESS_LOCATION', 'Business Location')}
83
+ {!hideLocation && (
84
+ <>
85
+ <GrayBackground>
86
+ <OText size={16} weight="500">
87
+ {t('BUSINESS_LOCATION', 'Business Location')}
88
+ </OText>
89
+ </GrayBackground>
90
+ {businessLocation.location && (
91
+ <WrapBusinessMap style={styles.wrapMapStyle}>
92
+ <GoogleMap
93
+ readOnly
94
+ location={businessLocation.location}
95
+ markerTitle={businessState?.business?.name}
96
+ />
97
+ </WrapBusinessMap>
98
+ )}
99
+ </>
100
+ )}
101
+ {!hideAddress && (
102
+ <OText size={12} mBottom={20}>
103
+ {businessState?.business?.address}
91
104
  </OText>
92
- </GrayBackground>
93
- {businessLocation.location && (
94
- <WrapBusinessMap style={styles.wrapMapStyle}>
95
- <GoogleMap
96
- readOnly
97
- location={businessLocation.location}
98
- markerTitle={businessState?.business?.name}
99
- />
100
- </WrapBusinessMap>
101
105
  )}
102
- <OText size={12} mBottom={20}>
103
- {businessState?.business?.address}
104
- </OText>
105
106
  <DivideView />
106
- <GrayBackground>
107
- <OText size={16} weight="500">
108
- {t('OPENING_TIME', 'Opening Time')}
109
- </OText>
110
- </GrayBackground>
111
- {businessSchedule && businessSchedule?.length > 0 && (
112
- <WrapScheduleBlock>
113
- {businessSchedule.map((schedule: any, i: number) => (
114
- <ScheduleBlock key={i}>
115
- <OText
116
- lineHeight={21}
117
- mBottom={16}
118
- size={14}
119
- weight={Platform.OS === 'android' ? 'bold' : '600'}
120
- style={{ flexBasis: '20%' }}>
121
- {daysOfWeek[i].toUpperCase()}
122
- </OText>
123
- {schedule.enabled ? (
124
- <OText mBottom={16}>
125
- {scheduleFormatted(schedule.lapses[0].open) +
126
- ' - ' +
127
- scheduleFormatted(schedule.lapses[0].close)}
128
- </OText>
129
- ) : (
130
- <OText color={theme.colors.red} mBottom={16}>
131
- {t('CLOSED', 'Closed')}
132
- </OText>
133
- )}
134
- </ScheduleBlock>
135
- ))}
136
- </WrapScheduleBlock>
107
+ {!hideSchedule && (
108
+ <>
109
+ <GrayBackground>
110
+ <OText size={16} weight="500">
111
+ {t('OPENING_TIME', 'Opening Time')}
112
+ </OText>
113
+ </GrayBackground>
114
+ {businessSchedule && businessSchedule?.length > 0 && (
115
+ <WrapScheduleBlock>
116
+ {businessSchedule.map((schedule: any, i: number) => (
117
+ <ScheduleBlock key={i}>
118
+ <ScheduleAccordion
119
+ weekIndex={i}
120
+ timeFormated={timeFormated}
121
+ schedule={schedule}
122
+ />
123
+ </ScheduleBlock>
124
+ ))}
125
+ </WrapScheduleBlock>
126
+ )}
127
+ </>
137
128
  )}
129
+
138
130
  {/* {businessState?.business?.gallery?.length > 0 && ( */}
131
+
139
132
  <>
140
- {bVideos().length > 0 && (
133
+ {!hideVideos && (
141
134
  <>
142
- <DivideView />
143
- <GrayBackground>
144
- <OText size={16} weight="500">
145
- {t('VIDEOS', 'Videos')}
146
- </OText>
147
- </GrayBackground>
148
- <MediaWrapper horizontal>
149
- {bVideos().map((v: any) => (
150
- <WebView
151
- key={`vid_id_${v.id}`}
152
- style={{ width: 210, height: 127, borderRadius: 7.6 }}
153
- javaScriptEnabled={true}
154
- domStorageEnabled={true}
155
- source={{
156
- html: `
157
- <iframe width='80%' height='80%' src="${formatUrlVideo(v.video)}" frameBorder='0' allow='autoplay; encrypted-media' allowFullScreen />
158
- `,
159
- }}
160
- mediaPlaybackRequiresUserAction={true}
161
- />
162
- ))}
163
- </MediaWrapper>
135
+ {bVideos().length > 0 && (
136
+ <>
137
+ <DivideView />
138
+ <GrayBackground>
139
+ <OText size={16} weight="500">
140
+ {t('VIDEOS', 'Videos')}
141
+ </OText>
142
+ </GrayBackground>
143
+ <MediaWrapper horizontal>
144
+ {bVideos().map((v: any) => (
145
+ <WebView
146
+ key={`vid_id_${v.id}`}
147
+ style={{ width: 210, height: 127, borderRadius: 7.6 }}
148
+ javaScriptEnabled={true}
149
+ domStorageEnabled={true}
150
+ source={{
151
+ html: `
152
+ <iframe width='80%' height='80%' src="${formatUrlVideo(v.video)}" frameBorder='0' allow='autoplay; encrypted-media' allowFullScreen />
153
+ `,
154
+ }}
155
+ mediaPlaybackRequiresUserAction={true}
156
+ />
157
+ ))}
158
+ </MediaWrapper>
159
+ </>
160
+ )}
164
161
  </>
165
162
  )}
166
- {bImages().length > 0 && (
163
+
164
+ {!hideImages && (
167
165
  <>
168
- <DivideView />
169
- <GrayBackground>
170
- <OText size={16} weight="500">
171
- {t('IMAGES', 'Images')}
172
- </OText>
173
- </GrayBackground>
174
- <MediaWrapper horizontal>
175
- {bImages().map((i: any) => (
176
- i.file != null &&
177
- <View key={i.id} style={{ width: 210, height: 127, borderRadius: 7.6, marginEnd: 20, overflow: 'hidden' }}>
178
- <OIcon cover url={optimizeImage(i?.file, 'h_150,c_limit')} width={210} height={127} />
179
- {/* <OText size={12} color={colors.red} style={{position: 'absolute'}}>{i.file}</OText> */}
180
- </View>
181
- ))}
182
- </MediaWrapper>
166
+ {bImages().length > 0 && (
167
+ <>
168
+ <DivideView />
169
+ <GrayBackground>
170
+ <OText size={16} weight="500">
171
+ {t('IMAGES', 'Images')}
172
+ </OText>
173
+ </GrayBackground>
174
+ <MediaWrapper horizontal>
175
+ {bImages().map((i: any) => (
176
+ i.file != null &&
177
+ <View key={i.id} style={{ width: 210, height: 127, borderRadius: 7.6, marginEnd: 20, overflow: 'hidden' }}>
178
+ <OIcon cover url={optimizeImage(i?.file, 'h_150,c_limit')} width={210} height={127} />
179
+ {/* <OText size={12} color={colors.red} style={{position: 'absolute'}}>{i.file}</OText> */}
180
+ </View>
181
+ ))}
182
+ </MediaWrapper>
183
+ </>
184
+ )}
183
185
  </>
184
186
  )}
185
187
  </>
@@ -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)
@@ -46,6 +49,21 @@ export const BusinessItemAccordion = (props: any) => {
46
49
  }
47
50
  }, [orderState?.carts, isClosed])
48
51
 
52
+ const subtotalWithTaxes = cart?.taxes?.reduce((acc: any, item: any) => {
53
+ if (item?.type === 1)
54
+ return acc = acc + item?.summary?.tax
55
+ return acc = acc
56
+ }, cart?.subtotal)
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
+
49
67
  return (
50
68
  <BIContainer isClosed={isClosed} isMultiCheckout={isMultiCheckout} checkoutVisible={!isActive && !isClosed && !!isProducts && !checkoutButtonDisabled}>
51
69
  <BIHeader
@@ -56,23 +74,6 @@ export const BusinessItemAccordion = (props: any) => {
56
74
  <BIInfo>
57
75
  <BIContentInfo>
58
76
  <OText size={16} lineHeight={24} weight={'600'}>{cart?.business?.name}</OText>
59
- {/* {orderState?.options?.type === 1 ? (
60
- <View style={{ display: 'flex', flexDirection: 'row', alignItems: 'center' }}>
61
- <MaterialCommunityIcon
62
- name='clock-outline'
63
- size={24}
64
- />
65
- <OText>{convertHoursToMinutes(cart?.business?.delivery_time)}</OText>
66
- </View>
67
- ) : (
68
- <View style={{ display: 'flex', flexDirection: 'row', alignItems: 'center' }}>
69
- <MaterialCommunityIcon
70
- name='clock-outline'
71
- size={24}
72
- />
73
- <OText>{convertHoursToMinutes(cart?.business?.pickup_time)}</OText>
74
- </View>
75
- )} */}
76
77
  <View style={{ flexDirection: 'row' }}>
77
78
  {props.onNavigationRedirect && !isClosed && (
78
79
  <>
@@ -81,7 +82,7 @@ export const BusinessItemAccordion = (props: any) => {
81
82
  </TouchableOpacity>
82
83
  </>
83
84
  )}
84
- {!isCartPending && !isClosed && (
85
+ {!isCartPending && (
85
86
  <>
86
87
  <OText color={theme.colors.textSecondary}>{' \u2022 '}</OText>
87
88
  <OAlert
@@ -102,7 +103,7 @@ export const BusinessItemAccordion = (props: any) => {
102
103
  <OText
103
104
  size={12}
104
105
  lineHeight={18}
105
- color={theme.colors.textSecondary}
106
+ color={theme.colors.primary}
106
107
  style={{ textDecorationLine: 'underline' }}
107
108
  >
108
109
  {t('CHANGE_STORE', 'Change store')}
@@ -151,7 +152,7 @@ export const BusinessItemAccordion = (props: any) => {
151
152
  textStyle={{ color: 'white', textAlign: 'center', flex: 1 }}
152
153
  style={{ width: 180, flexDirection: 'row', justifyContent: 'center', borderRadius: 7.6, shadowOpacity: 0 }}
153
154
  text={t('CHECKOUT', 'Checkout')}
154
- bgColor={(cart?.subtotal < cart?.minimum || !cart?.valid_address) ? theme.colors.secundary : theme.colors.primary}
155
+ bgColor={(subtotalWithTaxes < cart?.minimum || !cart?.valid_address) ? theme.colors.secundary : theme.colors.primary}
155
156
  borderColor={theme.colors.primary}
156
157
  isDisabled={checkoutButtonDisabled}
157
158
  />