ordering-ui-react-native 0.17.63 → 0.17.64-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 (206) 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 +2 -2
  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 +270 -245
  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 +123 -111
  17. package/themes/business/src/components/DriverMap/index.tsx +17 -6
  18. package/themes/business/src/components/DriverSchedule/index.tsx +42 -5
  19. package/themes/business/src/components/GoogleMap/index.tsx +58 -57
  20. package/themes/business/src/components/LoginForm/Otp/index.tsx +31 -3
  21. package/themes/business/src/components/LoginForm/index.tsx +15 -22
  22. package/themes/business/src/components/MapView/index.tsx +10 -10
  23. package/themes/business/src/components/NewOrderNotification/index.tsx +35 -21
  24. package/themes/business/src/components/NotFoundSource/index.tsx +2 -2
  25. package/themes/business/src/components/OrderDetails/Business.tsx +1 -1
  26. package/themes/business/src/components/OrderDetails/Delivery.tsx +191 -6
  27. package/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +133 -65
  28. package/themes/business/src/components/OrderDetails/OrderHeaderComponent.tsx +64 -63
  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 +19 -18
  32. package/themes/business/src/components/OrderSummary/index.tsx +114 -123
  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 +444 -242
  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 +3 -4
  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 +28 -12
  46. package/themes/business/src/utils/index.tsx +29 -2
  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/Intro/index.tsx +16 -1
  52. package/themes/kiosk/src/components/LoginForm/index.tsx +7 -9
  53. package/themes/kiosk/src/components/NavBar/index.tsx +14 -14
  54. package/themes/kiosk/src/components/OptionCard/index.tsx +1 -1
  55. package/themes/kiosk/src/components/OrderTypeCardSelector/index.tsx +8 -10
  56. package/themes/kiosk/src/components/PhoneInputNumber/index.tsx +2 -2
  57. package/themes/kiosk/src/components/shared/OButton.tsx +5 -18
  58. package/themes/original/index.tsx +4 -0
  59. package/themes/original/src/components/AddressDetails/index.tsx +19 -3
  60. package/themes/original/src/components/AddressForm/index.tsx +61 -39
  61. package/themes/original/src/components/AddressList/index.tsx +27 -22
  62. package/themes/original/src/components/AddressList/styles.tsx +4 -2
  63. package/themes/original/src/components/AnalyticsSegment/index.tsx +193 -10
  64. package/themes/original/src/components/AppleLogin/index.tsx +4 -4
  65. package/themes/original/src/components/AppleLogin/styles.tsx +3 -1
  66. package/themes/original/src/components/BusinessBasicInformation/index.tsx +153 -96
  67. package/themes/original/src/components/BusinessBasicInformation/styles.tsx +10 -12
  68. package/themes/original/src/components/BusinessController/index.tsx +94 -66
  69. package/themes/original/src/components/BusinessController/styles.tsx +22 -3
  70. package/themes/original/src/components/BusinessFeaturedController/index.tsx +21 -54
  71. package/themes/original/src/components/BusinessFeaturedController/styles.tsx +8 -0
  72. package/themes/original/src/components/BusinessInformation/index.tsx +142 -109
  73. package/themes/original/src/components/BusinessItemAccordion/index.tsx +15 -20
  74. package/themes/original/src/components/BusinessListingSearch/index.tsx +349 -339
  75. package/themes/original/src/components/BusinessListingSearch/styles.tsx +0 -18
  76. package/themes/original/src/components/BusinessPreorder/index.tsx +103 -19
  77. package/themes/original/src/components/BusinessProductsCategories/index.tsx +1 -2
  78. package/themes/original/src/components/BusinessProductsList/index.tsx +15 -7
  79. package/themes/original/src/components/BusinessProductsList/styles.tsx +8 -3
  80. package/themes/original/src/components/BusinessProductsListing/UpsellingRedirect.tsx +1 -1
  81. package/themes/original/src/components/BusinessProductsListing/index.tsx +684 -555
  82. package/themes/original/src/components/BusinessProductsListing/styles.tsx +2 -2
  83. package/themes/original/src/components/BusinessReviews/index.tsx +3 -1
  84. package/themes/original/src/components/BusinessesListing/Layout/Appointment/index.tsx +1 -1
  85. package/themes/original/src/components/BusinessesListing/Layout/Original/index.tsx +88 -49
  86. package/themes/original/src/components/BusinessesListing/Layout/Original/styles.tsx +0 -1
  87. package/themes/original/src/components/BusinessesListing/index.tsx +0 -1
  88. package/themes/original/src/components/Cart/index.tsx +77 -50
  89. package/themes/original/src/components/CartContent/index.tsx +117 -20
  90. package/themes/original/src/components/CartContent/styles.tsx +17 -7
  91. package/themes/original/src/components/Checkout/index.tsx +356 -124
  92. package/themes/original/src/components/CitiesControl/index.tsx +1 -1
  93. package/themes/original/src/components/CouponControl/index.tsx +10 -3
  94. package/themes/original/src/components/DriverTips/index.tsx +52 -34
  95. package/themes/original/src/components/FacebookLogin/styles.tsx +3 -1
  96. package/themes/original/src/components/Favorite/index.tsx +8 -9
  97. package/themes/original/src/components/Favorite/styles.tsx +1 -1
  98. package/themes/original/src/components/FavoriteList/index.tsx +1 -35
  99. package/themes/original/src/components/FloatingButton/index.tsx +1 -2
  100. package/themes/original/src/components/FloatingButton/styles.tsx +1 -1
  101. package/themes/original/src/components/GPSButton/index.tsx +6 -4
  102. package/themes/original/src/components/GiftCard/GiftCardUI/index.tsx +96 -0
  103. package/themes/original/src/components/GiftCard/GiftCardUI/styles.tsx +5 -0
  104. package/themes/original/src/components/GiftCard/PurchaseGiftCard/index.tsx +100 -0
  105. package/themes/original/src/components/GiftCard/PurchaseGiftCard/styles.tsx +8 -0
  106. package/themes/original/src/components/GiftCard/RedeemGiftCard/index.tsx +191 -0
  107. package/themes/original/src/components/GiftCard/RedeemGiftCard/styles.tsx +8 -0
  108. package/themes/original/src/components/GiftCard/SendGiftCard/index.tsx +165 -0
  109. package/themes/original/src/components/GiftCard/SendGiftCard/styles.tsx +9 -0
  110. package/themes/original/src/components/GoogleLogin/styles.tsx +1 -1
  111. package/themes/original/src/components/GoogleMap/index.tsx +60 -5
  112. package/themes/original/src/components/Help/index.tsx +8 -8
  113. package/themes/original/src/components/HelpAccountAndPayment/index.tsx +10 -31
  114. package/themes/original/src/components/HelpAccountAndPayment/styles.tsx +5 -3
  115. package/themes/original/src/components/HelpGuide/index.tsx +6 -6
  116. package/themes/original/src/components/HelpGuide/styles.tsx +6 -0
  117. package/themes/original/src/components/HelpOrder/index.tsx +6 -15
  118. package/themes/original/src/components/HelpOrder/styles.tsx +8 -1
  119. package/themes/original/src/components/Home/index.tsx +13 -4
  120. package/themes/original/src/components/LastOrder/index.tsx +1 -34
  121. package/themes/original/src/components/LoginForm/Otp/index.tsx +55 -13
  122. package/themes/original/src/components/LoginForm/Otp/styles.tsx +0 -1
  123. package/themes/original/src/components/LoginForm/index.tsx +59 -34
  124. package/themes/original/src/components/LottieAnimation/index.tsx +89 -55
  125. package/themes/original/src/components/MessageListing/index.tsx +16 -42
  126. package/themes/original/src/components/Messages/index.tsx +29 -7
  127. package/themes/original/src/components/MomentOption/index.tsx +195 -90
  128. package/themes/original/src/components/MomentSelector/index.tsx +1 -1
  129. package/themes/original/src/components/MultiCart/index.tsx +50 -0
  130. package/themes/original/src/components/MultiCartsPaymethodsAndWallets/index.tsx +162 -51
  131. package/themes/original/src/components/MultiCheckout/index.tsx +308 -88
  132. package/themes/original/src/components/MultiCheckout/styles.tsx +3 -1
  133. package/themes/original/src/components/MultiOrdersDetails/SingleOrderCard.tsx +37 -224
  134. package/themes/original/src/components/MultiOrdersDetails/index.tsx +68 -21
  135. package/themes/original/src/components/MultiOrdersDetails/styles.tsx +1 -1
  136. package/themes/original/src/components/MyOrders/index.tsx +40 -29
  137. package/themes/original/src/components/NavBar/index.tsx +20 -17
  138. package/themes/original/src/components/NotFoundSource/index.tsx +14 -10
  139. package/themes/original/src/components/Notifications/index.tsx +46 -50
  140. package/themes/original/src/components/Notifications/styles.tsx +6 -3
  141. package/themes/original/src/components/OrderDetails/OrderEta.tsx +76 -0
  142. package/themes/original/src/components/OrderDetails/OrderHistory.tsx +15 -3
  143. package/themes/original/src/components/OrderDetails/index.tsx +190 -363
  144. package/themes/original/src/components/OrderDetails/styles.tsx +0 -1
  145. package/themes/original/src/components/OrderItAgain/index.tsx +3 -1
  146. package/themes/original/src/components/OrderProgress/index.tsx +33 -56
  147. package/themes/original/src/components/OrderSummary/index.tsx +88 -59
  148. package/themes/original/src/components/OrderTypeSelector/index.tsx +2 -1
  149. package/themes/original/src/components/OrdersOption/PreviousBusinessOrdered/index.tsx +24 -19
  150. package/themes/original/src/components/OrdersOption/PreviousProductsOrdered/index.tsx +14 -14
  151. package/themes/original/src/components/OrdersOption/index.tsx +78 -67
  152. package/themes/original/src/components/OrdersOption/styles.tsx +1 -1
  153. package/themes/original/src/components/PageBanner/index.tsx +106 -31
  154. package/themes/original/src/components/PageBanner/styles.tsx +4 -4
  155. package/themes/original/src/components/PaymentOptionCard/index.tsx +180 -0
  156. package/themes/original/src/components/PaymentOptionStripe/styles.tsx +1 -1
  157. package/themes/original/src/components/PaymentOptionWallet/index.tsx +56 -56
  158. package/themes/original/src/components/PaymentOptions/index.tsx +78 -35
  159. package/themes/original/src/components/PhoneInputNumber/index.tsx +3 -3
  160. package/themes/original/src/components/ProductForm/index.tsx +105 -30
  161. package/themes/original/src/components/ProductForm/styles.tsx +5 -5
  162. package/themes/original/src/components/ProductItemAccordion/index.tsx +14 -11
  163. package/themes/original/src/components/ProductOptionSubOption/index.tsx +20 -18
  164. package/themes/original/src/components/ProductOptionSubOption/styles.tsx +5 -9
  165. package/themes/original/src/components/ProfessionalFilter/SingleProfessionalCard/index.tsx +108 -0
  166. package/themes/original/src/components/ProfessionalFilter/index.tsx +20 -50
  167. package/themes/original/src/components/ProfessionalProfile/index.tsx +36 -7
  168. package/themes/original/src/components/Promotions/index.tsx +5 -4
  169. package/themes/original/src/components/Promotions/styles.tsx +3 -1
  170. package/themes/original/src/components/ReviewOrder/index.tsx +26 -9
  171. package/themes/original/src/components/ReviewOrder/styles.tsx +7 -0
  172. package/themes/original/src/components/ReviewProducts/index.tsx +16 -7
  173. package/themes/original/src/components/ReviewTrigger/index.tsx +27 -9
  174. package/themes/original/src/components/ReviewTrigger/styles.tsx +8 -1
  175. package/themes/original/src/components/ScheduleAccordion/index.tsx +68 -0
  176. package/themes/original/src/components/ScheduleAccordion/styles.tsx +14 -0
  177. package/themes/original/src/components/ServiceForm/index.tsx +66 -17
  178. package/themes/original/src/components/Sessions/index.tsx +11 -8
  179. package/themes/original/src/components/Sessions/styles.tsx +5 -0
  180. package/themes/original/src/components/SignupForm/index.tsx +43 -27
  181. package/themes/original/src/components/SingleOrderCard/index.tsx +130 -56
  182. package/themes/original/src/components/SingleOrderCard/styles.tsx +11 -2
  183. package/themes/original/src/components/SingleProductCard/index.tsx +72 -31
  184. package/themes/original/src/components/SingleProductCard/styles.tsx +20 -4
  185. package/themes/original/src/components/SingleProductReview/styles.tsx +1 -1
  186. package/themes/original/src/components/StripeCardsList/index.tsx +49 -5
  187. package/themes/original/src/components/StripeElementsForm/index.tsx +48 -34
  188. package/themes/original/src/components/StripeElementsForm/naked.tsx +12 -1
  189. package/themes/original/src/components/UpsellingProducts/index.tsx +238 -224
  190. package/themes/original/src/components/UpsellingProducts/styles.tsx +12 -1
  191. package/themes/original/src/components/UserDetails/index.tsx +3 -1
  192. package/themes/original/src/components/UserFormDetails/index.tsx +76 -7
  193. package/themes/original/src/components/UserFormDetails/styles.tsx +1 -1
  194. package/themes/original/src/components/UserProfile/index.tsx +88 -79
  195. package/themes/original/src/components/UserProfileForm/index.tsx +27 -29
  196. package/themes/original/src/components/UserProfileForm/styles.tsx +7 -0
  197. package/themes/original/src/components/WalletTransactionItem/index.tsx +2 -2
  198. package/themes/original/src/components/WalletTransactions/index.tsx +3 -3
  199. package/themes/original/src/components/Wallets/index.tsx +66 -30
  200. package/themes/original/src/components/Wallets/styles.tsx +3 -4
  201. package/themes/original/src/components/shared/OButton.tsx +6 -2
  202. package/themes/original/src/components/shared/OInput.tsx +6 -1
  203. package/themes/original/src/components/shared/OModal.tsx +3 -3
  204. package/themes/original/src/types/index.tsx +36 -10
  205. package/themes/original/src/utils/index.tsx +273 -1
  206. package/themes/uber-eats/src/components/BusinessesListing/index.tsx +1 -1
@@ -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,38 +16,41 @@ import {
16
16
  DivideView,
17
17
  MediaWrapper,
18
18
  } from './styles';
19
- import { Platform, 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
+ import { ScheduleAccordion } from '../ScheduleAccordion';
25
+ import moment from 'moment';
26
+ import { DeviceOrientationMethods } from '../../../../../src/hooks/DeviceOrientation'
27
+ const { useDeviceOrientation } = DeviceOrientationMethods
28
+
24
29
  const BusinessInformationUI = (props: BusinessInformationParams) => {
25
30
  const { businessState, businessSchedule, businessLocation } = props;
26
31
 
27
32
  const theme = useTheme();
28
33
  const [, t] = useLanguage();
29
34
  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
- };
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
+ }
53
+
51
54
  const businessCoordinate = {
52
55
  lat: businessState?.business?.location?.lat,
53
56
  lng: businessState?.business?.location?.lng,
@@ -78,6 +81,10 @@ const BusinessInformationUI = (props: BusinessInformationParams) => {
78
81
  return iAry;
79
82
  };
80
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
+
81
88
  return (
82
89
  <BusinessInformationContainer>
83
90
  <WrapMainContent contentContainerStyle={{}}>
@@ -85,101 +92,127 @@ const BusinessInformationUI = (props: BusinessInformationParams) => {
85
92
  <OText size={24} weight={'600'}>
86
93
  {businessState?.business?.name}
87
94
  </OText>
88
- <GrayBackground>
89
- <OText size={16} weight="500">
90
- {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
+ />
109
+ </WrapBusinessMap>
110
+ )}
111
+ </>
112
+ )}
113
+ {!hideAddress && (
114
+ <OText size={12} mBottom={10}>
115
+ {businessState?.business?.address}
91
116
  </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
117
  )}
102
- <OText size={12} mBottom={20}>
103
- {businessState?.business?.address}
104
- </OText>
118
+ {businessState?.business?.address_notes && (
119
+ <>
120
+ <OText
121
+ size={12}
122
+ mBottom={10}
123
+ numberOfLines={isReadMore ? 20 : 3}
124
+ onTextLayout={onTextLayout}
125
+ >
126
+ {businessState?.business?.address_notes}
127
+ </OText>
128
+ {lengthMore && (
129
+ <TouchableOpacity
130
+ onPress={() => setIsReadMore(!isReadMore)}
131
+ >
132
+ <OText size={12} mBottom={20} color={theme.colors.primary}>{isReadMore ? t('SHOW_LESS', 'Show less') : t('READ_MORE', 'Read more')}</OText>
133
+ </TouchableOpacity>
134
+ )}
135
+ </>
136
+ )}
105
137
  <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>
138
+ {!hideSchedule && (
139
+ <>
140
+ <GrayBackground>
141
+ <OText size={16} weight="500">
142
+ {t('OPENING_TIME', 'Opening Time')}
143
+ </OText>
144
+ </GrayBackground>
145
+ {businessSchedule && businessSchedule?.length > 0 && (
146
+ <WrapScheduleBlock>
147
+ {businessSchedule.map((schedule: any, i: number) => (
148
+ <ScheduleBlock key={i}>
149
+ <ScheduleAccordion
150
+ weekIndex={i}
151
+ timeFormated={timeFormated}
152
+ schedule={schedule}
153
+ />
154
+ </ScheduleBlock>
155
+ ))}
156
+ </WrapScheduleBlock>
157
+ )}
158
+ </>
137
159
  )}
160
+
138
161
  {/* {businessState?.business?.gallery?.length > 0 && ( */}
162
+
139
163
  <>
140
- {bVideos().length > 0 && (
164
+ {!hideVideos && (
141
165
  <>
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>
166
+ {bVideos().length > 0 && (
167
+ <>
168
+ <DivideView />
169
+ <GrayBackground>
170
+ <OText size={16} weight="500">
171
+ {t('VIDEOS', 'Videos')}
172
+ </OText>
173
+ </GrayBackground>
174
+ <MediaWrapper horizontal>
175
+ {bVideos().map((v: any) => (
176
+ <WebView
177
+ key={`vid_id_${v.id}`}
178
+ style={{ width: 210, height: 127, borderRadius: 7.6 }}
179
+ javaScriptEnabled={true}
180
+ domStorageEnabled={true}
181
+ source={{
182
+ html: `
183
+ <iframe width='80%' height='80%' src="${formatUrlVideo(v.video)}" frameBorder='0' allow='autoplay; encrypted-media' allowFullScreen />
184
+ `,
185
+ }}
186
+ mediaPlaybackRequiresUserAction={true}
187
+ />
188
+ ))}
189
+ </MediaWrapper>
190
+ </>
191
+ )}
164
192
  </>
165
193
  )}
166
- {bImages().length > 0 && (
194
+
195
+ {!hideImages && (
167
196
  <>
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>
197
+ {bImages().length > 0 && (
198
+ <>
199
+ <DivideView />
200
+ <GrayBackground>
201
+ <OText size={16} weight="500">
202
+ {t('IMAGES', 'Images')}
203
+ </OText>
204
+ </GrayBackground>
205
+ <MediaWrapper horizontal>
206
+ {bImages().map((i: any) => (
207
+ i.file != null &&
208
+ <View key={i.id} style={{ width: 210, height: 127, borderRadius: 7.6, marginEnd: 20, overflow: 'hidden' }}>
209
+ <OIcon cover url={optimizeImage(i?.file, 'h_150,c_limit')} width={210} height={127} />
210
+ {/* <OText size={12} color={colors.red} style={{position: 'absolute'}}>{i.file}</OText> */}
211
+ </View>
212
+ ))}
213
+ </MediaWrapper>
214
+ </>
215
+ )}
183
216
  </>
184
217
  )}
185
218
  </>
@@ -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