ordering-ui-react-native 0.18.55 → 0.18.56-crash-driver-1

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 (266) hide show
  1. package/package.json +6 -4
  2. package/src/components/BusinessInformation/index.tsx +10 -9
  3. package/src/components/PaymentOptionsWebView/index.tsx +30 -8
  4. package/src/components/PhoneInputNumber/index.tsx +6 -2
  5. package/src/components/StripeMethodForm/index.tsx +60 -55
  6. package/src/components/shared/OToast.tsx +3 -2
  7. package/src/types/index.tsx +3 -1
  8. package/src/utils/index.tsx +2 -2
  9. package/themes/business/index.tsx +6 -0
  10. package/themes/business/src/components/AcceptOrRejectOrder/index.tsx +15 -8
  11. package/themes/business/src/components/BusinessController/index.tsx +19 -17
  12. package/themes/business/src/components/BusinessProductList/AccordionDropdown.tsx +63 -0
  13. package/themes/business/src/components/BusinessProductList/IterateCategories.tsx +108 -0
  14. package/themes/business/src/components/BusinessProductList/ProductList.tsx +196 -0
  15. package/themes/business/src/components/BusinessProductList/index.tsx +196 -0
  16. package/themes/business/src/components/BusinessProductList/styles.tsx +10 -0
  17. package/themes/business/src/components/Chat/index.tsx +48 -19
  18. package/themes/business/src/components/DriverMap/index.tsx +36 -23
  19. package/themes/business/src/components/DriverSchedule/index.tsx +45 -8
  20. package/themes/business/src/components/FloatingButton/index.tsx +34 -31
  21. package/themes/business/src/components/GoogleMap/index.tsx +15 -8
  22. package/themes/business/src/components/Home/index.tsx +5 -1
  23. package/themes/business/src/components/LanguageSelector/index.tsx +1 -2
  24. package/themes/business/src/components/LanguageSelector/lang_country.json +515 -70
  25. package/themes/business/src/components/LoginForm/index.tsx +2 -2
  26. package/themes/business/src/components/LogoutButton/index.tsx +1 -1
  27. package/themes/business/src/components/MapView/index.tsx +28 -17
  28. package/themes/business/src/components/MessagesOption/index.tsx +22 -94
  29. package/themes/business/src/components/NewOrderNotification/index.tsx +162 -106
  30. package/themes/business/src/components/NotFoundSource/index.tsx +2 -2
  31. package/themes/business/src/components/OrderDetails/Business.tsx +53 -3
  32. package/themes/business/src/components/OrderDetails/Delivery.tsx +209 -13
  33. package/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +107 -75
  34. package/themes/business/src/components/OrderDetails/OrderHeaderComponent.tsx +79 -41
  35. package/themes/business/src/components/OrderDetails/usePrinterCommands.tsx +220 -0
  36. package/themes/business/src/components/OrderDetailsLogistic/index.tsx +7 -2
  37. package/themes/business/src/components/OrderMessage/index.tsx +1 -1
  38. package/themes/business/src/components/OrderSummary/index.tsx +245 -82
  39. package/themes/business/src/components/OrdersListManager/index.tsx +7 -2
  40. package/themes/business/src/components/OrdersListManager/utils.tsx +1 -1
  41. package/themes/business/src/components/OrdersOption/index.tsx +125 -48
  42. package/themes/business/src/components/PhoneInputNumber/index.tsx +8 -5
  43. package/themes/business/src/components/PreviousMessages/FooterMessageComponent.tsx +103 -0
  44. package/themes/business/src/components/PreviousMessages/index.tsx +97 -55
  45. package/themes/business/src/components/PreviousOrders/OrderItem.tsx +43 -41
  46. package/themes/business/src/components/PreviousOrders/OrderList.tsx +93 -0
  47. package/themes/business/src/components/PreviousOrders/OrdersGroupedItem.tsx +1 -1
  48. package/themes/business/src/components/PreviousOrders/index.tsx +195 -221
  49. package/themes/business/src/components/PreviousOrders/styles.tsx +10 -0
  50. package/themes/business/src/components/PrinterEdition/index.tsx +363 -0
  51. package/themes/business/src/components/PrinterEdition/styles.tsx +61 -0
  52. package/themes/business/src/components/PrinterSettings/index.tsx +267 -0
  53. package/themes/business/src/components/PrinterSettings/styles.tsx +30 -0
  54. package/themes/business/src/components/ProductItemAccordion/index.tsx +2 -2
  55. package/themes/business/src/components/ReviewCustomer/index.tsx +1 -1
  56. package/themes/business/src/components/SearchBar/index.tsx +2 -1
  57. package/themes/business/src/components/Sessions/index.tsx +187 -0
  58. package/themes/business/src/components/Sessions/styles.tsx +20 -0
  59. package/themes/business/src/components/StoresList/index.tsx +4 -3
  60. package/themes/business/src/components/UserFormDetails/index.tsx +111 -107
  61. package/themes/business/src/components/UserProfileForm/index.tsx +103 -53
  62. package/themes/business/src/components/WebsocketStatus/index.tsx +171 -0
  63. package/themes/business/src/components/WebsocketStatus/styles.tsx +28 -0
  64. package/themes/business/src/components/shared/OInput.tsx +2 -0
  65. package/themes/business/src/hooks/useLocation.tsx +5 -4
  66. package/themes/business/src/types/index.tsx +21 -1
  67. package/themes/business/src/utils/index.tsx +5 -0
  68. package/themes/kiosk/src/components/Checkout/index.tsx +5 -3
  69. package/themes/kiosk/src/components/CustomerName/index.tsx +1 -1
  70. package/themes/kiosk/src/components/Intro/index.tsx +16 -1
  71. package/themes/kiosk/src/components/LoginForm/index.tsx +131 -101
  72. package/themes/kiosk/src/components/PaymentOptions/index.tsx +57 -121
  73. package/themes/original/index.tsx +11 -3
  74. package/themes/original/src/components/AddressDetails/index.tsx +20 -10
  75. package/themes/original/src/components/AddressForm/index.tsx +41 -20
  76. package/themes/original/src/components/AddressForm/styles.tsx +1 -1
  77. package/themes/original/src/components/AddressList/index.tsx +22 -11
  78. package/themes/original/src/components/AddressList/styles.tsx +4 -4
  79. package/themes/original/src/components/AnalyticsSegment/index.tsx +10 -7
  80. package/themes/original/src/components/AppleLogin/styles.tsx +3 -1
  81. package/themes/original/src/components/BusinessBasicInformation/index.tsx +8 -11
  82. package/themes/original/src/components/BusinessBasicInformation/styles.tsx +1 -1
  83. package/themes/original/src/components/BusinessController/index.tsx +40 -43
  84. package/themes/original/src/components/BusinessController/styles.tsx +12 -12
  85. package/themes/original/src/components/BusinessInformation/index.tsx +45 -17
  86. package/themes/original/src/components/BusinessInformation/styles.tsx +2 -2
  87. package/themes/original/src/components/BusinessItemAccordion/index.tsx +11 -7
  88. package/themes/original/src/components/BusinessListingSearch/BusinessSearchFooter.tsx +317 -0
  89. package/themes/original/src/components/BusinessListingSearch/BusinessSearchHeader.tsx +96 -0
  90. package/themes/original/src/components/BusinessListingSearch/MaxSectionItem/index.tsx +1 -1
  91. package/themes/original/src/components/BusinessListingSearch/index.tsx +57 -361
  92. package/themes/original/src/components/BusinessListingSearch/styles.tsx +1 -1
  93. package/themes/original/src/components/BusinessPreorder/index.tsx +9 -7
  94. package/themes/original/src/components/BusinessProductsCategories/index.tsx +2 -3
  95. package/themes/original/src/components/BusinessProductsList/index.tsx +5 -4
  96. package/themes/original/src/components/BusinessProductsListing/index.tsx +67 -28
  97. package/themes/original/src/components/BusinessProductsListing/styles.tsx +3 -4
  98. package/themes/original/src/components/BusinessReviews/index.tsx +1 -1
  99. package/themes/original/src/components/BusinessesListing/Layout/Appointment/index.tsx +1 -1
  100. package/themes/original/src/components/BusinessesListing/Layout/Appointment/styles.tsx +5 -5
  101. package/themes/original/src/components/BusinessesListing/Layout/Original/FlatListBusinessListFooter.tsx +69 -0
  102. package/themes/original/src/components/BusinessesListing/Layout/Original/FlatListBusinessListHeader.tsx +406 -0
  103. package/themes/original/src/components/BusinessesListing/Layout/Original/FlatListBusinessListing.tsx +76 -0
  104. package/themes/original/src/components/BusinessesListing/Layout/Original/index.tsx +30 -404
  105. package/themes/original/src/components/BusinessesListing/Layout/Original/styles.tsx +2 -2
  106. package/themes/original/src/components/Cart/index.tsx +51 -40
  107. package/themes/original/src/components/CartContent/index.tsx +98 -54
  108. package/themes/original/src/components/CartStoresListing/styles.tsx +2 -2
  109. package/themes/original/src/components/Checkout/index.tsx +308 -75
  110. package/themes/original/src/components/Checkout/styles.tsx +17 -0
  111. package/themes/original/src/components/CitiesControl/styles.tsx +1 -1
  112. package/themes/original/src/components/DatePicker/index.tsx +33 -0
  113. package/themes/original/src/components/DatePicker/styles.tsx +20 -0
  114. package/themes/original/src/components/DriverTips/index.tsx +6 -3
  115. package/themes/original/src/components/FacebookLogin/styles.tsx +3 -1
  116. package/themes/original/src/components/Favorite/index.tsx +8 -4
  117. package/themes/original/src/components/Favorite/styles.tsx +0 -2
  118. package/themes/original/src/components/FloatingButton/styles.tsx +1 -1
  119. package/themes/original/src/components/ForgotPasswordForm/index.tsx +5 -0
  120. package/themes/original/src/components/GPSButton/index.tsx +7 -5
  121. package/themes/original/src/components/GiftCard/GiftCardOrdersList/index.tsx +64 -0
  122. package/themes/original/src/components/GiftCard/GiftCardOrdersList/styles.tsx +8 -0
  123. package/themes/original/src/components/GiftCard/GiftCardUI/index.tsx +8 -3
  124. package/themes/original/src/components/GiftCard/PurchaseGiftCard/index.tsx +36 -3
  125. package/themes/original/src/components/GiftCard/PurchaseGiftCard/styles.tsx +1 -1
  126. package/themes/original/src/components/GiftCard/RedeemGiftCard/index.tsx +84 -8
  127. package/themes/original/src/components/GiftCard/RedeemGiftCard/styles.tsx +1 -1
  128. package/themes/original/src/components/GiftCard/SendGiftCard/index.tsx +2 -2
  129. package/themes/original/src/components/GiftCard/SendGiftCard/styles.tsx +1 -1
  130. package/themes/original/src/components/GiftCard/SingleGiftCard/index.tsx +101 -0
  131. package/themes/original/src/components/GiftCard/SingleGiftCard/styles.tsx +4 -0
  132. package/themes/original/src/components/GiftCard/VerticalGiftCardOrdersLayout/index.tsx +83 -0
  133. package/themes/original/src/components/GiftCard/VerticalGiftCardOrdersLayout/styles.tsx +9 -0
  134. package/themes/original/src/components/GoogleLogin/styles.tsx +1 -1
  135. package/themes/original/src/components/GoogleMap/index.tsx +52 -5
  136. package/themes/original/src/components/Help/index.tsx +7 -0
  137. package/themes/original/src/components/HelpAccountAndPayment/index.tsx +5 -0
  138. package/themes/original/src/components/HelpGuide/index.tsx +5 -0
  139. package/themes/original/src/components/HelpOrder/index.tsx +5 -0
  140. package/themes/original/src/components/HighestRatedBusinesses/index.tsx +1 -1
  141. package/themes/original/src/components/HighestRatedBusinesses/styles.tsx +1 -1
  142. package/themes/original/src/components/Home/index.tsx +3 -2
  143. package/themes/original/src/components/LastOrder/index.tsx +2 -1
  144. package/themes/original/src/components/LastOrders/index.tsx +2 -1
  145. package/themes/original/src/components/LoginForm/Otp/index.tsx +79 -25
  146. package/themes/original/src/components/LoginForm/index.tsx +38 -14
  147. package/themes/original/src/components/MessageListing/index.tsx +6 -0
  148. package/themes/original/src/components/Messages/index.tsx +9 -3
  149. package/themes/original/src/components/Messages/styles.tsx +1 -1
  150. package/themes/original/src/components/MomentOption/index.tsx +20 -5
  151. package/themes/original/src/components/MomentSelector/index.tsx +1 -1
  152. package/themes/original/src/components/MultiCart/index.tsx +1 -1
  153. package/themes/original/src/components/MultiCartsPaymethodsAndWallets/index.tsx +48 -15
  154. package/themes/original/src/components/MultiCheckout/index.tsx +295 -56
  155. package/themes/original/src/components/MultiCheckout/styles.tsx +20 -1
  156. package/themes/original/src/components/MultiOrdersDetails/index.tsx +21 -16
  157. package/themes/original/src/components/MyOrders/index.tsx +37 -39
  158. package/themes/original/src/components/NavBar/index.tsx +15 -14
  159. package/themes/original/src/components/NetworkError/index.tsx +2 -3
  160. package/themes/original/src/components/NetworkError/styles.tsx +2 -2
  161. package/themes/original/src/components/Notifications/index.tsx +9 -8
  162. package/themes/original/src/components/Notifications/styles.tsx +0 -1
  163. package/themes/original/src/components/OrderDetails/OrderEta.tsx +21 -6
  164. package/themes/original/src/components/OrderDetails/OrderHistory.tsx +14 -5
  165. package/themes/original/src/components/OrderDetails/index.tsx +718 -667
  166. package/themes/original/src/components/OrderDetails/styles.tsx +24 -7
  167. package/themes/original/src/components/OrderProgress/index.tsx +50 -14
  168. package/themes/original/src/components/OrderProgress/styles.tsx +1 -1
  169. package/themes/original/src/components/OrderSummary/index.tsx +26 -34
  170. package/themes/original/src/components/OrderTypeSelector/index.tsx +5 -0
  171. package/themes/original/src/components/OrdersOption/PreviousBusinessOrdered/styles.tsx +1 -1
  172. package/themes/original/src/components/OrdersOption/PreviousProductsOrdered/styles.tsx +1 -1
  173. package/themes/original/src/components/OrdersOption/index.tsx +14 -6
  174. package/themes/original/src/components/OrdersOption/styles.tsx +1 -1
  175. package/themes/original/src/components/PageBanner/index.tsx +3 -0
  176. package/themes/original/src/components/PaymentOptionCard/index.tsx +182 -0
  177. package/themes/original/src/components/PaymentOptionStripe/styles.tsx +3 -0
  178. package/themes/original/src/components/PaymentOptions/index.tsx +118 -37
  179. package/themes/original/src/components/PhoneInputNumber/index.tsx +15 -1
  180. package/themes/original/src/components/PreviousOrders/index.tsx +2 -0
  181. package/themes/original/src/components/ProductForm/ActionButton.tsx +122 -0
  182. package/themes/original/src/components/ProductForm/ExtraOptions.tsx +56 -0
  183. package/themes/original/src/components/ProductForm/index.tsx +193 -267
  184. package/themes/original/src/components/ProductForm/styles.tsx +1 -1
  185. package/themes/original/src/components/ProductItemAccordion/index.tsx +55 -42
  186. package/themes/original/src/components/ProductItemAccordion/styles.tsx +3 -4
  187. package/themes/original/src/components/ProductOptionSubOption/index.tsx +120 -79
  188. package/themes/original/src/components/ProductOptionSubOption/styles.tsx +10 -9
  189. package/themes/original/src/components/ProfessionalProfile/styles.tsx +3 -3
  190. package/themes/original/src/components/Promotions/index.tsx +13 -11
  191. package/themes/original/src/components/Promotions/styles.tsx +0 -2
  192. package/themes/original/src/components/ReviewDriver/index.tsx +5 -0
  193. package/themes/original/src/components/ReviewDriver/styles.tsx +1 -1
  194. package/themes/original/src/components/ReviewOrder/index.tsx +5 -0
  195. package/themes/original/src/components/ReviewOrder/styles.tsx +1 -1
  196. package/themes/original/src/components/ReviewProducts/index.tsx +5 -0
  197. package/themes/original/src/components/ReviewProducts/styles.tsx +1 -1
  198. package/themes/original/src/components/ScheduleAccordion/index.tsx +3 -3
  199. package/themes/original/src/components/ServiceForm/index.tsx +2 -2
  200. package/themes/original/src/components/ServiceForm/styles.tsx +4 -4
  201. package/themes/original/src/components/Sessions/index.tsx +5 -0
  202. package/themes/original/src/components/SignupForm/index.tsx +76 -60
  203. package/themes/original/src/components/SingleOrderCard/index.tsx +6 -5
  204. package/themes/original/src/components/SingleProductCard/index.tsx +5 -4
  205. package/themes/original/src/components/SingleProductCard/styles.tsx +0 -5
  206. package/themes/original/src/components/StripeCardsList/index.tsx +26 -8
  207. package/themes/original/src/components/StripeElementsForm/index.tsx +80 -62
  208. package/themes/original/src/components/StripeElementsForm/naked.tsx +59 -1
  209. package/themes/original/src/components/UpsellingProducts/UpsellingContent.tsx +170 -0
  210. package/themes/original/src/components/UpsellingProducts/UpsellingLayout.tsx +91 -0
  211. package/themes/original/src/components/UpsellingProducts/index.tsx +15 -199
  212. package/themes/original/src/components/UpsellingProducts/styles.tsx +19 -0
  213. package/themes/original/src/components/UserFormDetails/index.tsx +128 -79
  214. package/themes/original/src/components/UserFormDetails/styles.tsx +8 -1
  215. package/themes/original/src/components/UserProfile/index.tsx +5 -4
  216. package/themes/original/src/components/UserProfileForm/index.tsx +35 -36
  217. package/themes/original/src/components/UserVerification/index.tsx +55 -50
  218. package/themes/original/src/components/WalletTransactionItem/index.tsx +2 -2
  219. package/themes/original/src/components/WalletTransactions/styles.tsx +1 -0
  220. package/themes/original/src/components/Wallets/index.tsx +35 -49
  221. package/themes/original/src/components/Wallets/styles.tsx +3 -4
  222. package/themes/original/src/components/WebsocketStatus/index.tsx +172 -0
  223. package/themes/original/src/components/WebsocketStatus/styles.tsx +28 -0
  224. package/themes/original/src/components/shared/HeaderTitle.tsx +1 -1
  225. package/themes/original/src/components/shared/OButton.tsx +5 -5
  226. package/themes/original/src/components/shared/OInput.tsx +7 -4
  227. package/themes/original/src/components/shared/OModal.tsx +12 -14
  228. package/themes/original/src/layouts/Container.tsx +5 -3
  229. package/themes/original/src/types/index.tsx +13 -2
  230. package/themes/original/src/utils/index.tsx +124 -22
  231. package/src/navigators/BottomNavigator.tsx +0 -117
  232. package/src/navigators/CheckoutNavigator.tsx +0 -66
  233. package/src/navigators/HomeNavigator.tsx +0 -202
  234. package/src/navigators/NavigationRef.tsx +0 -7
  235. package/src/navigators/RootNavigator.tsx +0 -269
  236. package/src/pages/Account.tsx +0 -34
  237. package/src/pages/AddressForm.tsx +0 -62
  238. package/src/pages/AddressList.tsx +0 -24
  239. package/src/pages/BusinessProductsList.tsx +0 -81
  240. package/src/pages/BusinessesListing.tsx +0 -43
  241. package/src/pages/CartList.tsx +0 -49
  242. package/src/pages/Checkout.tsx +0 -101
  243. package/src/pages/ForgotPassword.tsx +0 -24
  244. package/src/pages/Help.tsx +0 -23
  245. package/src/pages/HelpAccountAndPayment.tsx +0 -23
  246. package/src/pages/HelpGuide.tsx +0 -23
  247. package/src/pages/HelpOrder.tsx +0 -23
  248. package/src/pages/Home.tsx +0 -36
  249. package/src/pages/IntroductoryTutorial.tsx +0 -170
  250. package/src/pages/Login.tsx +0 -47
  251. package/src/pages/MomentOption.tsx +0 -30
  252. package/src/pages/MultiCheckout.tsx +0 -31
  253. package/src/pages/MultiOrdersDetails.tsx +0 -27
  254. package/src/pages/MyOrders.tsx +0 -40
  255. package/src/pages/NetworkError.tsx +0 -24
  256. package/src/pages/NotFound.tsx +0 -22
  257. package/src/pages/OrderDetails.tsx +0 -25
  258. package/src/pages/ProductDetails.tsx +0 -55
  259. package/src/pages/Profile.tsx +0 -36
  260. package/src/pages/ReviewDriver.tsx +0 -30
  261. package/src/pages/ReviewOrder.tsx +0 -32
  262. package/src/pages/ReviewProducts.tsx +0 -30
  263. package/src/pages/Sessions.tsx +0 -22
  264. package/src/pages/Signup.tsx +0 -53
  265. package/src/pages/SpinnerLoader.tsx +0 -10
  266. package/src/pages/Splash.tsx +0 -21
@@ -30,6 +30,7 @@ import Swiper from 'react-native-swiper'
30
30
  import FastImage from 'react-native-fast-image';
31
31
  import IconAntDesign from 'react-native-vector-icons/AntDesign';
32
32
  import YoutubePlayer from "react-native-youtube-iframe"
33
+ import ReactNativeHapticFeedback from "react-native-haptic-feedback";
33
34
 
34
35
  import {
35
36
  WrapHeader,
@@ -54,7 +55,11 @@ import { ProductOptionSubOption } from '../ProductOptionSubOption';
54
55
  import { NotFoundSource } from '../NotFoundSource';
55
56
  import { Placeholder, PlaceholderLine, Fade } from 'rn-placeholder';
56
57
  import NavBar from '../NavBar';
57
- import { orderTypeList, vibrateApp } from '../../utils';
58
+ import { orderTypeList } from '../../utils';
59
+ import { ActionButton } from './ActionButton'
60
+ import { ExtraOptions } from './ExtraOptions'
61
+ import { IOScrollView } from 'react-native-intersection-observer';
62
+
58
63
  const windowWidth = Dimensions.get('window').width;
59
64
 
60
65
  export const ProductOptionsUI = (props: any) => {
@@ -78,12 +83,12 @@ export const ProductOptionsUI = (props: any) => {
78
83
  actionStatus,
79
84
  handleCreateGuestUser
80
85
  } = props;
81
-
82
86
  const theme = useTheme();
83
87
  const [, { showToast }] = useToast()
84
88
  const [events] = useEvent()
85
-
89
+ const commentRef = useRef()
86
90
  const isChewLayout = theme?.header?.components?.layout?.type?.toLowerCase() === 'chew'
91
+ const hideProductDummyLogo = theme?.business_view?.components?.products?.components?.product?.components?.dummy?.hidden
87
92
 
88
93
  const styles = StyleSheet.create({
89
94
  mainContainer: {
@@ -136,7 +141,8 @@ export const ProductOptionsUI = (props: any) => {
136
141
  },
137
142
  slide1: {
138
143
  flex: 1,
139
- alignItems: 'center'
144
+ alignItems: 'center',
145
+ width: '100%'
140
146
  },
141
147
  mainSwiper: {
142
148
  height: 258,
@@ -175,7 +181,7 @@ export const ProductOptionsUI = (props: any) => {
175
181
  marginTop: 10
176
182
  },
177
183
  wrapperNavbar: {
178
- paddingHorizontal: 40,
184
+ paddingHorizontal: 20,
179
185
  paddingTop: 0,
180
186
  }
181
187
  });
@@ -206,9 +212,17 @@ export const ProductOptionsUI = (props: any) => {
206
212
  const [editionsLayoutY, setEditionsLayoutY] = useState(null)
207
213
  const [viewedProduct, setViewedProduct] = useState<any>(null)
208
214
  const [showTitle, setShowTitle] = useState(false)
209
-
215
+ const productOptionsMounted = useRef(false)
210
216
  const guestCheckoutEnabled = configs?.guest_checkout_enabled?.value === '1'
211
- const orderTypeEnabled = !orderTypeList[orderState?.options?.type - 1] || configs?.allowed_order_types_guest_checkout?.value?.includes(orderTypeList[orderState?.options?.type - 1])
217
+ const orderTypeEnabled = !orderTypeList[orderState?.options?.type - 1] || configs?.allowed_order_types_guest_checkout?.value?.includes(orderTypeList[orderState?.options?.type - 1])
218
+
219
+ const vibrateApp = (impact?: string) => {
220
+ const options = {
221
+ enableVibrateFallback: true,
222
+ ignoreAndroidSystemSettings: false
223
+ };
224
+ ReactNativeHapticFeedback.trigger(impact || "impactLight", options);
225
+ }
212
226
 
213
227
  const isError = (id: number) => {
214
228
  let bgColor = theme.colors.white;
@@ -273,14 +287,14 @@ export const ProductOptionsUI = (props: any) => {
273
287
  setQtyBy({ [val]: true, [!val]: false })
274
288
  }
275
289
 
276
- const onStateChange = useCallback((state) => {
290
+ const onStateChange = useCallback((state : string) => {
277
291
  if (state === "ended") {
278
292
  setPlaying(false);
279
293
  }
280
294
  }, []);
281
295
 
282
296
  const togglePlaying = useCallback(() => {
283
- setPlaying((prev) => !prev);
297
+ setPlaying((prev : any) => !prev);
284
298
  }, []);
285
299
 
286
300
  const onChangeProductCartQuantity = (quantity: number) => {
@@ -311,63 +325,22 @@ export const ProductOptionsUI = (props: any) => {
311
325
  if (guestToken) handleCreateGuestUser({ guest_token: guestToken })
312
326
  }
313
327
 
314
- const handleOnLayout = (event: any, optionId: any) => {
315
- const _optionLayout = { ...optionLayout }
328
+ let _optionLayout: any = {}
329
+
330
+ const handleOnLayout = (event: any, optionId: any, lastMounts: boolean) => {
331
+ if (suboptionsLength >= 200) {
332
+ return
333
+ }
334
+ _optionLayout = { ..._optionLayout }
316
335
  const optionKey = 'id:' + optionId
317
336
  _optionLayout[optionKey] = { y: event.nativeEvent.layout?.y }
318
- setOptionLayout(_optionLayout)
337
+ if (lastMounts) {
338
+ setOptionLayout(_optionLayout)
339
+ }
319
340
  }
320
341
 
321
- const saveErrors =
322
- orderState.loading ||
323
- maxProductQuantity === 0 ||
324
- Object.keys(errors)?.length > 0;
325
-
326
-
327
- const ExtraOptions = ({ eID, options }: any) => (
328
- <>
329
- {options.map(({ id, name, respect_to, suboptions }: any) => (
330
- <React.Fragment key={`cont_key_${id}`}>
331
- {respect_to == null && suboptions?.length > 0 && (
332
- <TouchableOpacity
333
- key={`eopt_key_${id}`}
334
- onPress={() => {
335
- setSelectedOpt(id)
336
- scrollViewRef?.current?.scrollTo && scrollViewRef.current.scrollTo({
337
- y: optionLayout[`id:${id}`]?.y + editionsLayoutY - 50,
338
- animated: true
339
- })
340
- }}
341
- style={[
342
- styles.extraItem,
343
- {
344
- borderBottomColor:
345
- selOpt == id ? theme.colors.textNormal : theme.colors.backgroundPage,
346
- },
347
- ]}>
348
- <OText
349
- color={
350
- selOpt == id ? theme.colors.textNormal : theme.colors.textSecondary
351
- }
352
- size={12}
353
- weight={selOpt == id ? '600' : 'normal'}
354
- style={{ maxWidth: 150 }}
355
- numberOfLines={1}>
356
- {name}
357
- </OText>
358
- </TouchableOpacity>
359
- )}
360
- </React.Fragment>
361
- ))}
362
- </>
363
- );
364
-
365
- const handleScroll = ({ nativeEvent: { contentOffset, layoutMeasurement } }: any) => {
342
+ const handleScroll = ({ nativeEvent: { contentOffset } }: any) => {
366
343
  setShowTitle(contentOffset.y > 30)
367
- const _topOption = Object.keys(optionLayout).find(((option: any) => Math.abs(contentOffset?.y - layoutMeasurement?.height - optionLayout[option]?.y) < 20))
368
- if (_topOption) {
369
- const _topOptionId = Number(_topOption.replace('id:', ''))
370
- }
371
344
  }
372
345
 
373
346
  const handleGoBack = navigation?.canGoBack()
@@ -425,90 +398,6 @@ export const ProductOptionsUI = (props: any) => {
425
398
  }
426
399
  }, [product])
427
400
 
428
- const ActionButton = () => {
429
- return (
430
- <View
431
- style={{
432
- width: isHaveWeight ? '100%' : ((isSoldOut || maxProductQuantity <= 0) ? '60%' : '40%'),
433
- }}>
434
- {((productCart &&
435
- auth &&
436
- orderState.options?.address_id) || (isSoldOut || maxProductQuantity <= 0)) && (
437
- <OButton
438
- onClick={() => handleSaveProduct()}
439
- imgRightSrc=""
440
- text={`${orderState.loading
441
- ? t('LOADING', 'Loading')
442
- : (isSoldOut || maxProductQuantity <= 0)
443
- ? t('SOLD_OUT', 'Sold out')
444
- : editMode
445
- ? t('UPDATE', 'Update')
446
- : t('ADD', 'Add')
447
- }`}
448
- isDisabled={isSoldOut || maxProductQuantity <= 0 || (product?.minimum_per_order && ((productCart?.quantity + productAddedToCartLength) < product?.minimum_per_order)) || (product?.maximum_per_order && ((productCart?.quantity + productAddedToCartLength) > product?.maximum_per_order))}
449
- textStyle={{
450
- color: saveErrors || isSoldOut || maxProductQuantity <= 0 ? theme.colors.primary : theme.colors.white,
451
- fontSize: orderState.loading || editMode ? 10 : 14
452
- }}
453
- style={{
454
- backgroundColor: saveErrors || isSoldOut || maxProductQuantity <= 0 || (product?.minimum_per_order && ((productCart?.quantity + productAddedToCartLength) < product?.minimum_per_order)) || (product?.maximum_per_order && ((productCart?.quantity + productAddedToCartLength) > product?.maximum_per_order)) ? theme.colors.lightGray : theme.colors.primary,
455
- borderColor: saveErrors || isSoldOut || maxProductQuantity <= 0 || (product?.minimum_per_order && ((productCart?.quantity + productAddedToCartLength) < product?.minimum_per_order)) || (product?.maximum_per_order && ((productCart?.quantity + productAddedToCartLength) > product?.maximum_per_order)) ? theme.colors.white : theme.colors.primary,
456
- opacity: saveErrors || isSoldOut || maxProductQuantity <= 0 ? 0.3 : 1,
457
- borderRadius: 7.6,
458
- height: 44,
459
- shadowOpacity: 0,
460
- borderWidth: 1,
461
- marginTop: isHaveWeight ? 10 : 0
462
- }}
463
- />
464
- )}
465
- {auth &&
466
- !orderState.options?.address_id &&
467
- (orderState.loading ? (
468
- <OButton
469
- isDisabled
470
- text={t('LOADING', 'Loading')}
471
- imgRightSrc=""
472
- textStyle={{ fontSize: 10 }}
473
- />
474
- ) : (
475
- <OButton onClick={navigation.navigate('AddressList')} />
476
- ))}
477
- {!auth && (
478
- <OButton
479
- isDisabled={isSoldOut || maxProductQuantity <= 0}
480
- onClick={() => handleRedirectLogin()}
481
- text={
482
- isSoldOut || maxProductQuantity <= 0
483
- ? t('SOLD_OUT', 'Sold out')
484
- : t('LOGIN_SIGNUP', 'Login / Sign Up')
485
- }
486
- imgRightSrc=""
487
- textStyle={{ color: theme.colors.primary, fontSize: 13, textAlign: 'center' }}
488
- style={{
489
- height: 42,
490
- borderColor: theme.colors.primary,
491
- backgroundColor: theme.colors.white,
492
- paddingLeft: 0,
493
- paddingRight: 0
494
- }}
495
- />
496
- )}
497
- {!auth && guestCheckoutEnabled && orderTypeEnabled && (
498
- <TouchableOpacity style={{ marginTop: 10 }} onPress={handleUpdateGuest}>
499
- {actionStatus?.loading ? (
500
- <Placeholder Animation={Fade}>
501
- <PlaceholderLine width={60} height={20} />
502
- </Placeholder>
503
- ) : (
504
- <OText color={theme.colors.primary} size={13} style={{ textAlign: 'center' }}>{t('WITH_GUEST_USER', 'With Guest user')}</OText>
505
- )}
506
- </TouchableOpacity>
507
- )}
508
- </View>
509
- )
510
- }
511
-
512
401
  useEffect(() => {
513
402
  const keyboardDidShowListener = Keyboard.addListener('keyboardDidShow', () => {
514
403
  scrollViewRef.current.scrollToEnd({ animated: true })
@@ -524,13 +413,45 @@ export const ProductOptionsUI = (props: any) => {
524
413
  events.emit('product_viewed', product)
525
414
  }, [product?.id, viewedProduct])
526
415
 
416
+ const actionButtonProps = {
417
+ navigation,
418
+ isHaveWeight,
419
+ isSoldOut,
420
+ maxProductQuantity,
421
+ productCart,
422
+ handleSaveProduct,
423
+ editMode,
424
+ product,
425
+ errors,
426
+ productAddedToCartLength,
427
+ handleRedirectLogin,
428
+ guestCheckoutEnabled,
429
+ orderTypeEnabled,
430
+ handleUpdateGuest,
431
+ actionStatus
432
+ }
433
+
434
+ const extraOptionsProps = {
435
+ setSelectedOpt,
436
+ scrollViewRef,
437
+ optionLayout,
438
+ editionsLayoutY,
439
+ styles,
440
+ selOpt
441
+ }
442
+
443
+ const suboptionsLength = product?.extras?.reduce((acc : number, extras : any) => acc + extras?.options?.reduce((accSuboptions : number, options: any) => accSuboptions + options?.suboptions?.length, 0), 0)
444
+
527
445
  return (
528
446
  <SafeAreaView style={{ flex: 1 }}>
529
447
  <View style={styles.wrapperNavbar}>
530
448
  <TopHeader>
531
449
  <>
532
450
  <TopActions onPress={() => handleGoBack()}>
533
- <OIcon src={theme.images.general.arrow_left} color={theme.colors.textNormal} />
451
+ <IconAntDesign
452
+ name='arrowleft'
453
+ size={26}
454
+ />
534
455
  </TopActions>
535
456
  {showTitle && (
536
457
  <OText
@@ -547,10 +468,11 @@ export const ProductOptionsUI = (props: any) => {
547
468
  </TopHeader>
548
469
  </View>
549
470
  {!error && (
550
- <ScrollView
471
+ <IOScrollView
551
472
  ref={scrollViewRef}
552
473
  contentContainerStyle={{ paddingBottom: 80 }}
553
474
  stickyHeaderIndices={[2]}
475
+ scrollEventThrottle={100}
554
476
  onScroll={handleScroll}
555
477
  >
556
478
  <WrapHeader onLayout={(event: any) => setHeaderRefHeight(event.nativeEvent.layout?.height)}>
@@ -566,119 +488,123 @@ export const ProductOptionsUI = (props: any) => {
566
488
  </View>
567
489
  ) : (
568
490
  <>
569
- <Swiper
570
- loop={false}
571
- ref={swiperRef}
572
- showsButtons={true}
573
- style={styles.mainSwiper}
574
- showsPagination={false}
575
- onIndexChanged={(index) => handleChangeMainIndex(index)}
576
- prevButton={
577
- <View style={styles.swiperButton}>
578
- <IconAntDesign
579
- name="caretleft"
580
- color={theme.colors.white}
581
- size={13}
582
- // style={styles.starIcon}
583
- />
584
- </View>
585
- }
586
- nextButton={
587
- <View style={styles.swiperButton}>
588
- <IconAntDesign
589
- name="caretright"
590
- color={theme.colors.white}
591
- size={13}
592
- // style={styles.starIcon}
593
- />
594
- </View>
595
- }
596
- >
597
- {gallery && gallery?.length > 0 && gallery.map((img, i) => (
598
- <View
599
- style={styles.slide1}
600
- key={i}
601
- >
602
- {(String(img).includes('http') || typeof img === 'number') ? (
603
- <FastImage
604
- style={{ height: '100%', opacity: isSoldOut ? 0.5 : 1, aspectRatio: 16 / 9 }}
605
- source={typeof img !== 'number' ? {
606
- uri: optimizeImage(img, 'h_1024,c_limit'),
607
- priority: FastImage.priority.normal,
608
- } : img}
609
- />
610
- ) : (
611
- <>
612
- <YoutubePlayer
613
- height={'100%'}
614
- width={'100%'}
615
- play={playing}
616
- videoId={img}
617
- onChangeState={onStateChange}
491
+ {(product?.images || !hideProductDummyLogo) && (
492
+ <>
493
+ <Swiper
494
+ loop={false}
495
+ ref={swiperRef}
496
+ showsButtons={true}
497
+ style={styles.mainSwiper}
498
+ showsPagination={false}
499
+ onIndexChanged={(index : any) => handleChangeMainIndex(index)}
500
+ prevButton={
501
+ <View style={styles.swiperButton}>
502
+ <IconAntDesign
503
+ name="caretleft"
504
+ color={theme.colors.white}
505
+ size={13}
506
+ // style={styles.starIcon}
618
507
  />
619
- <Button title={playing ? "pause" : "play"} onPress={togglePlaying} />
620
- </>
621
- )}
622
- </View>
623
- ))}
624
- </Swiper>
625
- <ScrollView
626
- horizontal
627
- contentContainerStyle={{
628
- paddingHorizontal: 30,
629
- paddingVertical: 15
630
- }}
631
- >
632
- {gallery?.length > 1 && gallery.map((img, index) => (
633
- <TouchableOpacity
634
- key={index}
635
- onPress={() => handleClickThumb(index)}
636
- >
637
- <View
638
- style={{
639
- height: 56,
640
- borderRadius: 8,
641
- margin: 8,
642
- opacity: index === thumbsSwiper ? 1 : 0.8
643
- }}
644
- >
645
- {String(img).includes('http') ? (
646
- <OIcon
647
- url={img}
648
- style={{
649
- borderColor: theme.colors.lightGray,
650
- borderRadius: 8,
651
- minHeight: '100%',
652
- opacity: isSoldOut ? 0.5 : 1
653
- }}
654
- width={56}
655
- height={56}
656
- cover
508
+ </View>
509
+ }
510
+ nextButton={
511
+ <View style={styles.swiperButton}>
512
+ <IconAntDesign
513
+ name="caretright"
514
+ color={theme.colors.white}
515
+ size={13}
516
+ // style={styles.starIcon}
657
517
  />
658
- ) : (
659
- <OIcon
660
- url={'https://img.youtube.com/vi/' + img + '/0.jpg'}
518
+ </View>
519
+ }
520
+ >
521
+ {gallery && gallery?.length > 0 && gallery.map((img : any, i: number) => (
522
+ <View
523
+ style={styles.slide1}
524
+ key={i}
525
+ >
526
+ {(String(img).includes('http') || typeof img === 'number') ? (
527
+ <FastImage
528
+ style={{ height: '100%', opacity: isSoldOut ? 0.5 : 1, aspectRatio: 16 / 9 }}
529
+ source={typeof img !== 'number' ? {
530
+ uri: optimizeImage(img, 'h_1024,c_limit'),
531
+ priority: FastImage.priority.normal,
532
+ } : img}
533
+ />
534
+ ) : (
535
+ <>
536
+ <YoutubePlayer
537
+ height={'100%'}
538
+ width={'100%'}
539
+ play={playing}
540
+ videoId={img}
541
+ onChangeState={onStateChange}
542
+ />
543
+ <Button title={playing ? "pause" : "play"} onPress={togglePlaying} />
544
+ </>
545
+ )}
546
+ </View>
547
+ ))}
548
+ </Swiper>
549
+ <ScrollView
550
+ horizontal
551
+ contentContainerStyle={{
552
+ paddingHorizontal: 20,
553
+ paddingVertical: 15
554
+ }}
555
+ >
556
+ {gallery?.length > 1 && gallery.map((img: any, index: number) => (
557
+ <TouchableOpacity
558
+ key={index}
559
+ onPress={() => handleClickThumb(index)}
560
+ >
561
+ <View
661
562
  style={{
662
- borderColor: theme.colors.lightGray,
563
+ height: 56,
663
564
  borderRadius: 8,
664
- minHeight: '100%',
665
- opacity: isSoldOut ? 0.5 : 1
565
+ margin: 8,
566
+ opacity: index === thumbsSwiper ? 1 : 0.8
666
567
  }}
667
- width={56}
668
- height={56}
669
- cover
670
- />
671
- )}
672
- </View>
673
- </TouchableOpacity>
568
+ >
569
+ {String(img).includes('http') ? (
570
+ <OIcon
571
+ url={img}
572
+ style={{
573
+ borderColor: theme.colors.lightGray,
574
+ borderRadius: 8,
575
+ minHeight: '100%',
576
+ opacity: isSoldOut ? 0.5 : 1
577
+ }}
578
+ width={56}
579
+ height={56}
580
+ cover
581
+ />
582
+ ) : (
583
+ <OIcon
584
+ url={'https://img.youtube.com/vi/' + img + '/0.jpg'}
585
+ style={{
586
+ borderColor: theme.colors.lightGray,
587
+ borderRadius: 8,
588
+ minHeight: '100%',
589
+ opacity: isSoldOut ? 0.5 : 1
590
+ }}
591
+ width={56}
592
+ height={56}
593
+ cover
594
+ />
595
+ )}
596
+ </View>
597
+ </TouchableOpacity>
674
598
 
675
- ))}
676
- </ScrollView>
599
+ ))}
600
+ </ScrollView>
601
+ </>
602
+ )}
677
603
  </>
678
604
  )}
679
605
  </WrapHeader>
680
606
  <ProductSummary
681
- ph={isChewLayout ? 20 : 40}
607
+ ph={20}
682
608
  onLayout={(event: any) => setSummaryRefHeight(event.nativeEvent.layout?.height)}
683
609
  >
684
610
  <ProductTitle>
@@ -748,6 +674,7 @@ export const ProductOptionsUI = (props: any) => {
748
674
  </ProductDescription>
749
675
  <ScrollView
750
676
  horizontal
677
+ scrollEventThrottle={100}
751
678
  showsHorizontalScrollIndicator={false}
752
679
  contentContainerStyle={{ paddingBottom: 30 }}
753
680
  >
@@ -775,12 +702,13 @@ export const ProductOptionsUI = (props: any) => {
775
702
  {(!loading && product) && (
776
703
  <ExtraOptionWrap
777
704
  horizontal
705
+ scrollEventThrottle={100}
778
706
  showsHorizontalScrollIndicator={false}
779
707
  style={{
780
708
  marginBottom: 20,
781
709
  borderBottomWidth: 1,
782
710
  borderBottomColor: theme.colors.border,
783
- marginHorizontal: isChewLayout ? 20 : 30,
711
+ marginHorizontal: 20,
784
712
  backgroundColor: theme.colors.backgroundPage,
785
713
  }}
786
714
  >
@@ -809,8 +737,8 @@ export const ProductOptionsUI = (props: any) => {
809
737
  </OText>
810
738
  </TouchableOpacity>
811
739
  )}
812
- {product?.extras?.map((extra: any) =>
813
- <ExtraOptions key={extra.id} options={extra.options} />
740
+ {suboptionsLength < 200 && product?.extras?.map((extra: any) =>
741
+ <ExtraOptions key={extra.id} options={extra.options} {...extraOptionsProps} />
814
742
  )}
815
743
  </ExtraOptionWrap>
816
744
  )}
@@ -854,14 +782,14 @@ export const ProductOptionsUI = (props: any) => {
854
782
  </>
855
783
  ) : (
856
784
  <ProductEditions
857
- style={{ paddingHorizontal: isChewLayout ? 20 : 40 }}
785
+ style={{ paddingHorizontal: 20 }}
858
786
  onLayout={(event: any) => {
859
787
  setEditionsLayoutY(event.nativeEvent.layout?.y)
860
788
  }}
861
789
  >
862
790
  <>
863
791
  {product?.ingredients?.length > 0 && (
864
- <View style={styles.optionContainer} onLayout={(event: any) => handleOnLayout(event, 0)}>
792
+ <View style={styles.optionContainer} onLayout={(event: any) => handleOnLayout(event, 0, true)}>
865
793
  <SectionTitle>
866
794
  <OText size={16}>
867
795
  {t('INGREDIENTS', 'Ingredients')}
@@ -883,13 +811,13 @@ export const ProductOptionsUI = (props: any) => {
883
811
  </View>
884
812
  )}
885
813
  {product?.extras?.sort((a: any, b: any) => a.rank - b.rank).map((extra: any) =>
886
- extra.options?.sort((a: any, b: any) => a.rank - b.rank).map((option: any) => {
814
+ extra.options?.sort((a: any, b: any) => a.rank - b.rank).map((option: any, i: number) => {
887
815
  const currentState =
888
816
  productCart.options[`id:${option.id}`] || {};
889
817
  return (
890
818
  <React.Fragment key={`popt_${option.id}`}>
891
819
  {showOption(option) && (
892
- <View style={styles.optionContainer} onLayout={(event: any) => handleOnLayout(event, option?.id)}>
820
+ <View style={styles.optionContainer} onLayout={(event: any) => handleOnLayout(event, option?.id, extra.options?.length <= i + 2)}>
893
821
  <ProductOption
894
822
  option={option}
895
823
  currentState={currentState}
@@ -901,12 +829,7 @@ export const ProductOptionsUI = (props: any) => {
901
829
  }}>
902
830
  {option?.suboptions?.sort((a: any, b: any) => a.rank - b.rank).map(
903
831
  (suboption: any) => {
904
- const currentState =
905
- productCart.options[
906
- `id:${option.id}`
907
- ]?.suboptions[
908
- `id:${suboption.id}`
909
- ] || {};
832
+ const currentState = productCart.options[`id:${option.id}`]?.suboptions[`id:${suboption.id}`] || {};
910
833
  const balance =
911
834
  productCart.options[
912
835
  `id:${option.id}`
@@ -921,6 +844,7 @@ export const ProductOptionsUI = (props: any) => {
921
844
  balance={balance}
922
845
  option={option}
923
846
  suboption={suboption}
847
+ image={suboption.image}
924
848
  state={currentState}
925
849
  disabled={
926
850
  isSoldOut ||
@@ -928,6 +852,7 @@ export const ProductOptionsUI = (props: any) => {
928
852
  }
929
853
  setIsScrollAvailable={setIsScrollAvailable}
930
854
  error={errors[`id:${option.id}`]}
855
+ enableIntersection={suboptionsLength >= 200}
931
856
  />
932
857
  );
933
858
  },
@@ -945,7 +870,7 @@ export const ProductOptionsUI = (props: any) => {
945
870
  <ProductComment>
946
871
  <SectionTitle>
947
872
  <OText size={16} weight={'600'} lineHeight={24}>
948
- {t('SPECIAL_COMMENT', 'Special comment')}
873
+ {t('COMMENTS', 'Special comment')}
949
874
  </OText>
950
875
  </SectionTitle>
951
876
  <OInput
@@ -959,6 +884,7 @@ export const ProductOptionsUI = (props: any) => {
959
884
  !(productCart && !isSoldOut && maxProductQuantity)
960
885
  }
961
886
  style={styles.comment}
887
+ forwardRef={commentRef}
962
888
  />
963
889
  </ProductComment>
964
890
  )}
@@ -967,7 +893,7 @@ export const ProductOptionsUI = (props: any) => {
967
893
  {!!error && error?.length > 0 && (
968
894
  <NotFoundSource content={error[0]?.message || error[0]} />
969
895
  )}
970
- </ScrollView>
896
+ </IOScrollView>
971
897
  )}
972
898
  {!loading && !error && product && (
973
899
  <ProductActions ios={Platform?.OS === 'ios'} isColumn={isHaveWeight}>
@@ -1078,9 +1004,9 @@ export const ProductOptionsUI = (props: any) => {
1078
1004
  )}
1079
1005
  </>
1080
1006
  )}
1081
- {!isHaveWeight && <ActionButton />}
1007
+ {!isHaveWeight && <ActionButton {...actionButtonProps} />}
1082
1008
  </View>
1083
- {isHaveWeight && <ActionButton />}
1009
+ {isHaveWeight && <ActionButton {...actionButtonProps} />}
1084
1010
  </ProductActions>
1085
1011
  )}
1086
1012
  </SafeAreaView>
@@ -70,7 +70,7 @@ export const ProductActions = styled.View`
70
70
  position: absolute;
71
71
  bottom: 0px;
72
72
  padding-top: ${(props: any) => props.ios ? '20px' : '0'};
73
- padding-horizontal: 40px;
73
+ padding-horizontal: 30px;
74
74
  padding-vertical: 20px;
75
75
  width: 100%;
76
76
  flex-direction: ${(props: any) => props.isColumn ? 'column' : 'row'};