ordering-ui-react-native 0.21.45 → 0.21.46-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 (208) 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/PaymentOptionsWebView/index.tsx +1 -0
  5. package/src/components/StripeMethodForm/index.tsx +6 -4
  6. package/src/components/VerifyPhone/styles.tsx +1 -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 +7 -3
  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/DriverMap/index.tsx +36 -23
  18. package/themes/business/src/components/GoogleMap/index.tsx +15 -8
  19. package/themes/business/src/components/Home/index.tsx +5 -1
  20. package/themes/business/src/components/LanguageSelector/index.tsx +1 -2
  21. package/themes/business/src/components/LanguageSelector/lang_country.json +515 -70
  22. package/themes/business/src/components/LogoutButton/index.tsx +1 -1
  23. package/themes/business/src/components/MapView/index.tsx +30 -15
  24. package/themes/business/src/components/MessagesOption/index.tsx +2 -1
  25. package/themes/business/src/components/NewOrderNotification/index.tsx +66 -26
  26. package/themes/business/src/components/OrderDetails/Business.tsx +52 -2
  27. package/themes/business/src/components/OrderDetails/Delivery.tsx +30 -11
  28. package/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +68 -61
  29. package/themes/business/src/components/OrderDetails/OrderHeaderComponent.tsx +40 -20
  30. package/themes/business/src/components/OrderDetails/usePrinterCommands.tsx +220 -0
  31. package/themes/business/src/components/OrderSummary/index.tsx +240 -76
  32. package/themes/business/src/components/OrdersListManager/index.tsx +7 -2
  33. package/themes/business/src/components/OrdersListManager/utils.tsx +1 -1
  34. package/themes/business/src/components/OrdersOption/index.tsx +125 -46
  35. package/themes/business/src/components/PhoneInputNumber/index.tsx +8 -5
  36. package/themes/business/src/components/PreviousOrders/OrderItem.tsx +37 -40
  37. package/themes/business/src/components/PreviousOrders/OrderList.tsx +1 -1
  38. package/themes/business/src/components/PreviousOrders/index.tsx +5 -3
  39. package/themes/business/src/components/PreviousOrders/styles.tsx +10 -0
  40. package/themes/business/src/components/PrinterEdition/index.tsx +363 -0
  41. package/themes/business/src/components/PrinterEdition/styles.tsx +61 -0
  42. package/themes/business/src/components/PrinterSettings/index.tsx +267 -0
  43. package/themes/business/src/components/PrinterSettings/styles.tsx +30 -0
  44. package/themes/business/src/components/ProductItemAccordion/index.tsx +2 -2
  45. package/themes/business/src/components/ReviewCustomer/index.tsx +2 -0
  46. package/themes/business/src/components/SearchBar/index.tsx +2 -1
  47. package/themes/business/src/components/Sessions/index.tsx +187 -0
  48. package/themes/business/src/components/Sessions/styles.tsx +20 -0
  49. package/themes/business/src/components/StoresList/index.tsx +5 -3
  50. package/themes/business/src/components/UserFormDetails/index.tsx +111 -107
  51. package/themes/business/src/components/UserProfileForm/index.tsx +106 -54
  52. package/themes/business/src/components/WebsocketStatus/index.tsx +171 -0
  53. package/themes/business/src/components/WebsocketStatus/styles.tsx +28 -0
  54. package/themes/business/src/components/shared/OInput.tsx +2 -0
  55. package/themes/business/src/components/shared/OTextarea.tsx +8 -9
  56. package/themes/business/src/hooks/useLocation.tsx +5 -4
  57. package/themes/business/src/types/index.tsx +16 -2
  58. package/themes/business/src/utils/index.tsx +5 -0
  59. package/themes/doordash/src/components/BusinessesListing/index.tsx +1 -1
  60. package/themes/doordash/src/components/LoginForm/index.tsx +1 -2
  61. package/themes/instacart/src/components/BusinessesListing/index.tsx +1 -1
  62. package/themes/kiosk/src/components/Checkout/index.tsx +6 -0
  63. package/themes/kiosk/src/components/NavBar/index.tsx +14 -14
  64. package/themes/kiosk/src/components/OptionCard/index.tsx +1 -1
  65. package/themes/kiosk/src/components/OrderTypeCardSelector/index.tsx +8 -10
  66. package/themes/kiosk/src/components/shared/OButton.tsx +5 -18
  67. package/themes/original/index.tsx +12 -4
  68. package/themes/original/src/components/AddressDetails/index.tsx +20 -10
  69. package/themes/original/src/components/AddressForm/index.tsx +41 -12
  70. package/themes/original/src/components/AddressForm/styles.tsx +1 -1
  71. package/themes/original/src/components/AddressList/index.tsx +18 -4
  72. package/themes/original/src/components/AddressList/styles.tsx +4 -4
  73. package/themes/original/src/components/AnalyticsSegment/index.tsx +6 -6
  74. package/themes/original/src/components/AppleLogin/index.tsx +4 -4
  75. package/themes/original/src/components/BusinessBasicInformation/index.tsx +7 -10
  76. package/themes/original/src/components/BusinessBasicInformation/styles.tsx +1 -1
  77. package/themes/original/src/components/BusinessController/index.tsx +18 -10
  78. package/themes/original/src/components/BusinessController/styles.tsx +8 -7
  79. package/themes/original/src/components/BusinessInformation/styles.tsx +2 -2
  80. package/themes/original/src/components/BusinessItemAccordion/index.tsx +11 -7
  81. package/themes/original/src/components/BusinessListingSearch/BusinessSearchFooter.tsx +317 -0
  82. package/themes/original/src/components/BusinessListingSearch/BusinessSearchHeader.tsx +96 -0
  83. package/themes/original/src/components/BusinessListingSearch/MaxSectionItem/index.tsx +1 -1
  84. package/themes/original/src/components/BusinessListingSearch/index.tsx +47 -358
  85. package/themes/original/src/components/BusinessListingSearch/styles.tsx +1 -1
  86. package/themes/original/src/components/BusinessPreorder/index.tsx +4 -3
  87. package/themes/original/src/components/BusinessProductsCategories/index.tsx +1 -1
  88. package/themes/original/src/components/BusinessProductsList/index.tsx +1 -1
  89. package/themes/original/src/components/BusinessProductsList/styles.tsx +0 -3
  90. package/themes/original/src/components/BusinessProductsListing/index.tsx +34 -19
  91. package/themes/original/src/components/BusinessProductsListing/styles.tsx +2 -2
  92. package/themes/original/src/components/BusinessReviews/index.tsx +1 -1
  93. package/themes/original/src/components/BusinessesListing/Layout/Appointment/index.tsx +1 -1
  94. package/themes/original/src/components/BusinessesListing/Layout/Appointment/styles.tsx +5 -5
  95. package/themes/original/src/components/BusinessesListing/Layout/Original/FlatListBusinessListFooter.tsx +1 -1
  96. package/themes/original/src/components/BusinessesListing/Layout/Original/FlatListBusinessListHeader.tsx +7 -7
  97. package/themes/original/src/components/BusinessesListing/Layout/Original/index.tsx +2 -2
  98. package/themes/original/src/components/BusinessesListing/Layout/Original/styles.tsx +1 -1
  99. package/themes/original/src/components/BusinessesListing/index.tsx +0 -1
  100. package/themes/original/src/components/Cart/index.tsx +32 -9
  101. package/themes/original/src/components/CartContent/index.tsx +96 -58
  102. package/themes/original/src/components/CartStoresListing/styles.tsx +2 -2
  103. package/themes/original/src/components/Checkout/index.tsx +144 -62
  104. package/themes/original/src/components/Checkout/styles.tsx +17 -0
  105. package/themes/original/src/components/CitiesControl/styles.tsx +1 -1
  106. package/themes/original/src/components/DatePicker/index.tsx +33 -0
  107. package/themes/original/src/components/DatePicker/styles.tsx +20 -0
  108. package/themes/original/src/components/Favorite/index.tsx +9 -9
  109. package/themes/original/src/components/Favorite/styles.tsx +0 -2
  110. package/themes/original/src/components/FloatingButton/styles.tsx +1 -1
  111. package/themes/original/src/components/ForgotPasswordForm/index.tsx +5 -0
  112. package/themes/original/src/components/GPSButton/index.tsx +1 -1
  113. package/themes/original/src/components/GiftCard/GiftCardOrdersList/index.tsx +64 -0
  114. package/themes/original/src/components/GiftCard/GiftCardOrdersList/styles.tsx +8 -0
  115. package/themes/original/src/components/GiftCard/PurchaseGiftCard/styles.tsx +1 -1
  116. package/themes/original/src/components/GiftCard/RedeemGiftCard/styles.tsx +1 -1
  117. package/themes/original/src/components/GiftCard/SendGiftCard/index.tsx +2 -2
  118. package/themes/original/src/components/GiftCard/SendGiftCard/styles.tsx +1 -1
  119. package/themes/original/src/components/GiftCard/SingleGiftCard/index.tsx +101 -0
  120. package/themes/original/src/components/GiftCard/SingleGiftCard/styles.tsx +4 -0
  121. package/themes/original/src/components/GiftCard/VerticalGiftCardOrdersLayout/index.tsx +83 -0
  122. package/themes/original/src/components/GiftCard/VerticalGiftCardOrdersLayout/styles.tsx +9 -0
  123. package/themes/original/src/components/GoogleMap/index.tsx +39 -18
  124. package/themes/original/src/components/Help/index.tsx +7 -0
  125. package/themes/original/src/components/HelpAccountAndPayment/index.tsx +5 -0
  126. package/themes/original/src/components/HelpGuide/index.tsx +5 -0
  127. package/themes/original/src/components/HelpOrder/index.tsx +5 -0
  128. package/themes/original/src/components/HighestRatedBusinesses/index.tsx +2 -2
  129. package/themes/original/src/components/HighestRatedBusinesses/styles.tsx +1 -1
  130. package/themes/original/src/components/Home/index.tsx +3 -8
  131. package/themes/original/src/components/LoginForm/Otp/index.tsx +4 -16
  132. package/themes/original/src/components/LoginForm/index.tsx +9 -3
  133. package/themes/original/src/components/MessageListing/index.tsx +6 -0
  134. package/themes/original/src/components/Messages/index.tsx +8 -7
  135. package/themes/original/src/components/Messages/styles.tsx +1 -1
  136. package/themes/original/src/components/MomentOption/index.tsx +19 -4
  137. package/themes/original/src/components/MultiCart/index.tsx +1 -1
  138. package/themes/original/src/components/MultiCartsPaymethodsAndWallets/index.tsx +7 -3
  139. package/themes/original/src/components/MultiCheckout/index.tsx +126 -61
  140. package/themes/original/src/components/MultiCheckout/styles.tsx +17 -0
  141. package/themes/original/src/components/MultiOrdersDetails/index.tsx +20 -15
  142. package/themes/original/src/components/MyOrders/index.tsx +28 -28
  143. package/themes/original/src/components/NavBar/index.tsx +5 -0
  144. package/themes/original/src/components/NetworkError/index.tsx +2 -3
  145. package/themes/original/src/components/NetworkError/styles.tsx +2 -2
  146. package/themes/original/src/components/Notifications/index.tsx +9 -8
  147. package/themes/original/src/components/Notifications/styles.tsx +0 -1
  148. package/themes/original/src/components/OrderDetails/OrderHistory.tsx +1 -1
  149. package/themes/original/src/components/OrderDetails/index.tsx +708 -663
  150. package/themes/original/src/components/OrderDetails/styles.tsx +24 -8
  151. package/themes/original/src/components/OrderProgress/index.tsx +22 -3
  152. package/themes/original/src/components/OrderProgress/styles.tsx +1 -1
  153. package/themes/original/src/components/OrderSummary/index.tsx +3 -1
  154. package/themes/original/src/components/OrderTypeSelector/index.tsx +10 -6
  155. package/themes/original/src/components/OrdersOption/PreviousBusinessOrdered/styles.tsx +1 -1
  156. package/themes/original/src/components/OrdersOption/PreviousProductsOrdered/styles.tsx +1 -1
  157. package/themes/original/src/components/OrdersOption/index.tsx +3 -5
  158. package/themes/original/src/components/OrdersOption/styles.tsx +1 -1
  159. package/themes/original/src/components/PaymentOptionCard/index.tsx +4 -2
  160. package/themes/original/src/components/PaymentOptionWallet/index.tsx +56 -56
  161. package/themes/original/src/components/PaymentOptions/index.tsx +47 -4
  162. package/themes/original/src/components/PreviousOrders/index.tsx +2 -0
  163. package/themes/original/src/components/ProductForm/ActionButton.tsx +122 -0
  164. package/themes/original/src/components/ProductForm/ExtraOptions.tsx +56 -0
  165. package/themes/original/src/components/ProductForm/index.tsx +170 -252
  166. package/themes/original/src/components/ProductItemAccordion/index.tsx +55 -44
  167. package/themes/original/src/components/ProductItemAccordion/styles.tsx +3 -4
  168. package/themes/original/src/components/ProductOptionSubOption/index.tsx +112 -91
  169. package/themes/original/src/components/ProfessionalProfile/styles.tsx +3 -3
  170. package/themes/original/src/components/Promotions/index.tsx +13 -11
  171. package/themes/original/src/components/Promotions/styles.tsx +0 -2
  172. package/themes/original/src/components/ReviewDriver/index.tsx +5 -0
  173. package/themes/original/src/components/ReviewDriver/styles.tsx +1 -1
  174. package/themes/original/src/components/ReviewOrder/index.tsx +5 -0
  175. package/themes/original/src/components/ReviewOrder/styles.tsx +1 -1
  176. package/themes/original/src/components/ReviewProducts/index.tsx +5 -0
  177. package/themes/original/src/components/ReviewProducts/styles.tsx +1 -1
  178. package/themes/original/src/components/ServiceForm/index.tsx +1 -1
  179. package/themes/original/src/components/ServiceForm/styles.tsx +4 -4
  180. package/themes/original/src/components/Sessions/index.tsx +5 -0
  181. package/themes/original/src/components/SignupForm/index.tsx +67 -59
  182. package/themes/original/src/components/SingleOrderCard/index.tsx +3 -2
  183. package/themes/original/src/components/SingleProductCard/index.tsx +4 -3
  184. package/themes/original/src/components/SingleProductCard/styles.tsx +0 -3
  185. package/themes/original/src/components/StripeCardsList/index.tsx +12 -35
  186. package/themes/original/src/components/StripeElementsForm/index.tsx +79 -59
  187. package/themes/original/src/components/StripeElementsForm/naked.tsx +47 -0
  188. package/themes/original/src/components/UpsellingProducts/UpsellingContent.tsx +170 -0
  189. package/themes/original/src/components/UpsellingProducts/UpsellingLayout.tsx +91 -0
  190. package/themes/original/src/components/UpsellingProducts/index.tsx +15 -199
  191. package/themes/original/src/components/UpsellingProducts/styles.tsx +19 -0
  192. package/themes/original/src/components/UserFormDetails/index.tsx +123 -75
  193. package/themes/original/src/components/UserFormDetails/styles.tsx +7 -0
  194. package/themes/original/src/components/UserProfile/index.tsx +3 -2
  195. package/themes/original/src/components/UserProfileForm/index.tsx +5 -0
  196. package/themes/original/src/components/WalletTransactions/styles.tsx +1 -0
  197. package/themes/original/src/components/Wallets/index.tsx +7 -4
  198. package/themes/original/src/components/Wallets/styles.tsx +2 -1
  199. package/themes/original/src/components/WebsocketStatus/index.tsx +172 -0
  200. package/themes/original/src/components/WebsocketStatus/styles.tsx +28 -0
  201. package/themes/original/src/components/shared/HeaderTitle.tsx +1 -1
  202. package/themes/original/src/components/shared/OButton.tsx +5 -5
  203. package/themes/original/src/components/shared/OInput.tsx +1 -4
  204. package/themes/original/src/components/shared/OModal.tsx +12 -14
  205. package/themes/original/src/layouts/Container.tsx +5 -3
  206. package/themes/original/src/types/index.tsx +4 -1
  207. package/themes/original/src/utils/index.tsx +12 -1
  208. package/themes/uber-eats/src/components/BusinessesListing/index.tsx +1 -1
@@ -1,9 +1,12 @@
1
- import React, { useState, useEffect, useCallback } from 'react';
2
- import { View, StyleSheet, TouchableOpacity, Platform, I18nManager, ScrollView } from 'react-native';
1
+ import React, { useState, useEffect, useCallback, useRef } from 'react';
2
+ import { View, StyleSheet, TouchableOpacity, Platform, I18nManager, ScrollView, Keyboard, BackHandler, SafeAreaView } from 'react-native';
3
3
  import { initStripe, useConfirmPayment } from '@stripe/stripe-react-native';
4
4
  import NativeStripeSdk from '@stripe/stripe-react-native/src/NativeStripeSdk'
5
5
  import Picker from 'react-native-country-picker-modal';
6
6
  import MaterialIcons from 'react-native-vector-icons/MaterialIcons'
7
+ import IconAntDesign from 'react-native-vector-icons/AntDesign';
8
+ import { useIsFocused } from '@react-navigation/native';
9
+
7
10
  import ReactNativeHapticFeedback from "react-native-haptic-feedback";
8
11
  import {
9
12
  Checkout as CheckoutController,
@@ -46,7 +49,9 @@ import {
46
49
  DeliveryOptionsContainer,
47
50
  DeliveryOptionItem,
48
51
  WalletPaymentOptionContainer,
49
- CartHeader
52
+ CartHeader,
53
+ TopHeader,
54
+ TopActions
50
55
  } from './styles';
51
56
  import { Fade, Placeholder, PlaceholderLine } from 'rn-placeholder';
52
57
  import { FloatingButton } from '../FloatingButton';
@@ -96,10 +101,13 @@ const CheckoutUI = (props: any) => {
96
101
  currency,
97
102
  merchantId,
98
103
  setPlaceSpotNumber,
99
- maxDate
104
+ maxDate,
105
+ androidAppId,
106
+ urlscheme
100
107
  } = props
101
108
 
102
109
  const theme = useTheme();
110
+ const isFocused = useIsFocused();
103
111
 
104
112
  const styles = StyleSheet.create({
105
113
  btnBackArrow: {
@@ -115,7 +123,7 @@ const CheckoutUI = (props: any) => {
115
123
  padding: 20
116
124
  },
117
125
  pagePadding: {
118
- paddingHorizontal: 40
126
+ paddingHorizontal: 20
119
127
  },
120
128
  icon: {
121
129
  top: 15,
@@ -124,13 +132,14 @@ const CheckoutUI = (props: any) => {
124
132
  fontSize: 20
125
133
  },
126
134
  detailWrapper: {
127
- paddingHorizontal: 40,
135
+ paddingHorizontal: 20,
128
136
  width: '100%'
129
137
  },
130
138
  wrapperNavbar: {
131
- paddingVertical: 0,
132
- paddingHorizontal: 40,
133
- marginVertical: 2
139
+ paddingVertical: 2,
140
+ paddingHorizontal: 20,
141
+ backgroundColor: theme?.colors?.white,
142
+ borderWidth: 0
134
143
  }
135
144
  })
136
145
 
@@ -154,7 +163,7 @@ const CheckoutUI = (props: any) => {
154
163
  const [phoneUpdate, setPhoneUpdate] = useState(false);
155
164
  const [openChangeStore, setOpenChangeStore] = useState(false)
156
165
  const [isDeliveryOptionModalVisible, setIsDeliveryOptionModalVisible] = useState(false)
157
- const [showGateway, setShowGateway] = useState<any>({ closedByUsed: false, open: false });
166
+ const [showGateway, setShowGateway] = useState<any>({ closedByUser: false, open: false });
158
167
  const [webviewPaymethod, setWebviewPaymethod] = useState<any>(null)
159
168
  const [isOpen, setIsOpen] = useState(false)
160
169
  const [requiredFields, setRequiredFields] = useState<any>([])
@@ -163,12 +172,14 @@ const CheckoutUI = (props: any) => {
163
172
  const [placeByMethodPay, setPlaceByMethodPay] = useState(false)
164
173
  const [methodPaySupported, setMethodPaySupported] = useState({ enabled: false, message: null, loading: true })
165
174
  const [paymethodClicked, setPaymethodClicked] = useState<any>(null)
175
+ const [showTitle, setShowTitle] = useState(false)
166
176
  const [cardList, setCardList] = useState<any>({ cards: [], loading: false, error: null })
177
+ const [isGiftCardCart, setIsGiftCardCart] = useState(!cart?.business_id)
178
+ const containerRef = useRef<any>()
167
179
  const cardsMethods = ['credomatic']
168
180
  const stripePaymethods: any = ['stripe', 'stripe_direct', 'stripe_connect', 'stripe_redirect']
169
181
  const placeSpotTypes = [3, 4, 5]
170
182
  const placeSpotsEnabled = placeSpotTypes.includes(options?.type)
171
- const isGiftCardCart = !cart?.business_id
172
183
  const businessConfigs = businessDetails?.business?.configs ?? []
173
184
  const isWalletCashEnabled = businessConfigs.find((config: any) => config.key === 'wallet_cash_enabled')?.value === '1'
174
185
  const isWalletCreditPointsEnabled = businessConfigs.find((config: any) => config.key === 'wallet_credit_point_enabled')?.value === '1'
@@ -201,7 +212,7 @@ const CheckoutUI = (props: any) => {
201
212
  const isDisabledButtonPlace = loading || !cart?.valid || (!paymethodSelected && cart?.balance > 0) ||
202
213
  placing || errorCash || subtotalWithTaxes < cart?.minimum ||
203
214
  (cardsMethods.includes(paymethodSelected?.gateway) && cardList?.cards?.length === 0) ||
204
- (options.type === 1 &&
215
+ (options.type === 1 && !isGiftCardCart &&
205
216
  validationFields?.fields?.checkout?.driver_tip?.enabled &&
206
217
  validationFields?.fields?.checkout?.driver_tip?.required &&
207
218
  (Number(cart?.driver_tip) <= 0)) ||
@@ -331,6 +342,10 @@ const CheckoutUI = (props: any) => {
331
342
  setPhoneUpdate(val)
332
343
  }
333
344
 
345
+ const handleScroll = ({ nativeEvent: { contentOffset } }: any) => {
346
+ setShowTitle(contentOffset.y > 30)
347
+ }
348
+
334
349
  useEffect(() => {
335
350
  if (validationFields && validationFields?.fields?.checkout) {
336
351
  checkValidationFields()
@@ -346,13 +361,23 @@ const CheckoutUI = (props: any) => {
346
361
 
347
362
  useEffect(() => {
348
363
  if (cart?.products?.length === 0) {
349
- if (cart?.business?.slug) {
364
+ if (cart?.business_id !== null) {
350
365
  onNavigationRedirect('Business', { store: cart?.business?.slug, header: null, logo: null, fromMulti: props.fromMulti })
351
- } else {
366
+ } else if (isGiftCardCart) {
352
367
  onNavigationRedirect('Wallets')
353
368
  }
354
369
  }
355
- }, [cart?.products])
370
+ }, [cart?.products?.length])
371
+
372
+ useEffect(() => {
373
+ if (cart?.products?.length > 0) {
374
+ if (cart?.uuid && cart?.business_id === null) {
375
+ setIsGiftCardCart(true)
376
+ } else {
377
+ setIsGiftCardCart(false)
378
+ }
379
+ }
380
+ }, [cart?.uuid, cart?.products?.length])
356
381
 
357
382
  useEffect(() => {
358
383
  onFailPaypal()
@@ -392,6 +417,7 @@ const CheckoutUI = (props: any) => {
392
417
  }, [])
393
418
 
394
419
  useEffect(() => {
420
+ if (!isFocused) return
395
421
  if (!cartState?.loading && (cartState?.error || typeof cartState?.cart === 'string')) {
396
422
  const error = cartState?.error || typeof cartState.cart === 'string' && cartState.cart
397
423
  if (error) {
@@ -399,13 +425,61 @@ const CheckoutUI = (props: any) => {
399
425
  navigation.navigate('BusinessList')
400
426
  }
401
427
  }
402
- }, [cartState?.error, cartState?.cart, cartState?.loading])
428
+ }, [cartState?.error, cartState?.cart, cartState?.loading, isFocused])
429
+
430
+ useEffect(() => {
431
+ const keyboardDidShowListener = Keyboard.addListener('keyboardDidShow', () => {
432
+ containerRef?.current?.scrollToEnd && containerRef.current.scrollToEnd({ animated: true })
433
+ })
434
+ return () => {
435
+ keyboardDidShowListener.remove()
436
+ }
437
+ }, [])
438
+
439
+ useEffect(() => {
440
+ const onBackFunction = () => {
441
+ if (webviewPaymethod?.gateway === 'paypal' && showGateway.open) {
442
+ setShowGateway({ open: false, closedByUser: true })
443
+ return true
444
+ } else {
445
+ return false
446
+ }
447
+ }
448
+ BackHandler.addEventListener('hardwareBackPress', onBackFunction)
449
+ return () => {
450
+ BackHandler.removeEventListener('hardwareBackPress', onBackFunction)
451
+ }
452
+ }, [BackHandler, webviewPaymethod?.gateway, showGateway.open])
403
453
 
404
454
  return (
405
455
  <>
406
- <Container noPadding>
456
+ <SafeAreaView style={{ backgroundColor: theme.colors.backgroundPage }}>
457
+ <View style={styles.wrapperNavbar}>
458
+ <TopHeader>
459
+ <TopActions onPress={() => onNavigationRedirect('BottomTab', { screen: 'Cart' }, !props.fromMulti)}>
460
+ <IconAntDesign
461
+ name='arrowleft'
462
+ size={26}
463
+ />
464
+ </TopActions>
465
+ {showTitle && (
466
+ <OText
467
+ size={16}
468
+ style={{ flex: 1, textAlign: 'center', right: 15 }}
469
+ weight={Platform.OS === 'ios' ? '600' : 'bold'}
470
+ numberOfLines={2}
471
+ ellipsizeMode='tail'
472
+ >
473
+ {t('CHECKOUT', 'Checkout')}
474
+ </OText>
475
+ )}
476
+ </TopHeader>
477
+ </View>
478
+ </SafeAreaView>
479
+ <Container pt={0} forwardRef={containerRef} showsVerticalScrollIndicator={false} noPadding onScroll={handleScroll}>
407
480
  <View style={styles.wrapperNavbar}>
408
481
  <NavBar
482
+ hideArrowLeft
409
483
  title={t('CHECKOUT', 'Checkout')}
410
484
  titleAlign={'center'}
411
485
  onActionLeft={() => onNavigationRedirect('BottomTab', { screen: 'Cart' }, !props.fromMulti)}
@@ -417,44 +491,46 @@ const CheckoutUI = (props: any) => {
417
491
  />
418
492
  </View>
419
493
  <ChContainer style={styles.pagePadding}>
420
- <ChSection style={{ paddingTop: 0 }}>
421
- <ChHeader>
422
- <CHMomentWrapper isCustomColor={isChewLayout} onPress={() => navigation.navigate('OrderTypes', { configTypes: configTypes })}>
423
- <OText
424
- size={12}
425
- numberOfLines={1}
426
- ellipsizeMode={'tail'}
427
- color={theme.colors?.[isChewLayout ? 'white' : 'textSecondary']}
428
- >
429
- {t(getTypesText(options?.type || 1), 'Delivery')}
430
- </OText>
431
- <OIcon
432
- src={theme.images.general.arrow_down}
433
- width={10}
434
- style={{ marginStart: 8 }}
435
- {...(isChewLayout && { color: 'white' })}
436
- />
437
- </CHMomentWrapper>
438
- <CHMomentWrapper
439
- onPress={() => handleMomentClick()}
440
- disabled={loading}
441
- >
442
- <OText size={12} numberOfLines={1} ellipsizeMode='tail' color={theme.colors.textSecondary}>
443
- {options?.moment
444
- ? parseDate(options?.moment, { outputFormat: configs?.dates_moment_format?.value })
445
- : t('ASAP_ABBREVIATION', 'ASAP')}
446
- </OText>
447
- {isPreOrder && (
494
+ {!isGiftCardCart && (
495
+ <ChSection style={{ paddingTop: 0 }}>
496
+ <ChHeader>
497
+ <CHMomentWrapper isCustomColor={isChewLayout} onPress={() => navigation.navigate('OrderTypes', { configTypes: configTypes })}>
498
+ <OText
499
+ size={12}
500
+ numberOfLines={1}
501
+ ellipsizeMode={'tail'}
502
+ color={theme.colors?.[isChewLayout ? 'white' : 'textSecondary']}
503
+ >
504
+ {t(getTypesText(options?.type || 1), 'Delivery')}
505
+ </OText>
448
506
  <OIcon
449
507
  src={theme.images.general.arrow_down}
450
508
  width={10}
451
509
  style={{ marginStart: 8 }}
510
+ {...(isChewLayout && { color: 'white' })}
452
511
  />
453
- )}
454
- </CHMomentWrapper>
455
- </ChHeader>
456
- <View style={{ height: 8, backgroundColor: theme.colors.backgroundGray100, marginTop: 18, marginHorizontal: -40 }} />
457
- </ChSection>
512
+ </CHMomentWrapper>
513
+ <CHMomentWrapper
514
+ onPress={() => handleMomentClick()}
515
+ disabled={loading}
516
+ >
517
+ <OText size={12} numberOfLines={1} ellipsizeMode='tail' color={theme.colors.textSecondary}>
518
+ {options?.moment
519
+ ? parseDate(options?.moment, { outputFormat: configs?.dates_moment_format?.value })
520
+ : t('ASAP_ABBREVIATION', 'ASAP')}
521
+ </OText>
522
+ {isPreOrder && (
523
+ <OIcon
524
+ src={theme.images.general.arrow_down}
525
+ width={10}
526
+ style={{ marginStart: 8 }}
527
+ />
528
+ )}
529
+ </CHMomentWrapper>
530
+ </ChHeader>
531
+ <View style={{ height: 8, backgroundColor: theme.colors.backgroundGray100, marginTop: 18, marginHorizontal: -40 }} />
532
+ </ChSection>
533
+ )}
458
534
 
459
535
  {!isGiftCardCart && !hideBusinessDetails && (
460
536
  <ChSection>
@@ -544,13 +620,15 @@ const CheckoutUI = (props: any) => {
544
620
  <OButton
545
621
  text={t('SIGN_UP', 'Sign up')}
546
622
  textStyle={{ color: theme.colors.white }}
623
+ bgColor={theme.colors.primary}
624
+ borderColor={theme.colors.primary}
547
625
  style={{ borderRadius: 7.6, marginTop: 20 }}
548
626
  onClick={() => setOpenModal({ ...openModal, signup: true })}
549
627
  />
550
628
  <OButton
551
629
  text={t('LOGIN', 'Login')}
552
- textStyle={{ color: theme.colors.primary }}
553
- bgColor={theme.colors.white}
630
+ textStyle={{ color: theme.colors.white }}
631
+ bgColor={theme.colors.primary}
554
632
  borderColor={theme.colors.primary}
555
633
  style={{ borderRadius: 7.6, marginTop: 20 }}
556
634
  onClick={() => setOpenModal({ ...openModal, login: true })}
@@ -695,7 +773,7 @@ const CheckoutUI = (props: any) => {
695
773
  cart?.status !== 2 &&
696
774
  validationFields?.fields?.checkout?.driver_tip?.enabled &&
697
775
  driverTipsOptions && driverTipsOptions?.length > 0 &&
698
- !isGiftCardCart &&
776
+ cart?.business_id &&
699
777
  (
700
778
  <ChSection>
701
779
  <ChDriverTips>
@@ -743,6 +821,8 @@ const CheckoutUI = (props: any) => {
743
821
  handlePaymentMethodClickCustom={handlePaymentMethodClick}
744
822
  handlePlaceOrder={handlePlaceOrder}
745
823
  merchantId={merchantId}
824
+ urlscheme={urlscheme}
825
+ androidAppId={androidAppId}
746
826
  setMethodPaySupported={setMethodPaySupported}
747
827
  methodPaySupported={methodPaySupported}
748
828
  placeByMethodPay={placeByMethodPay}
@@ -788,7 +868,7 @@ const CheckoutUI = (props: any) => {
788
868
  {!cartState.loading && cart && (
789
869
  <ChSection>
790
870
  <ChCart>
791
- {cartsWithProducts && cart?.products?.length === 0 ? (
871
+ {cartsWithProducts?.length > 0 && cart?.products?.length === 0 ? (
792
872
  <NotFoundSource
793
873
  content={t('NOT_FOUND_CARTS', 'Sorry, You don\'t seem to have any carts.')}
794
874
  btnTitle={t('SEARCH_REDIRECT', 'Go to Businesses')}
@@ -866,13 +946,15 @@ const CheckoutUI = (props: any) => {
866
946
  </OText>
867
947
  )}
868
948
 
869
- {!cart?.valid_products && cart?.status !== 2 && (
870
- <OText
871
- color={theme.colors.error}
872
- size={12}
873
- >
874
- {t('WARNING_INVALID_PRODUCTS_CHECKOUT', 'To continue with your checkout, please remove from your cart the products that are not available.')}
875
- </OText>
949
+ {!cart?.valid_products && cart?.status !== 2 && cart?.total !== 0 && (
950
+ <>
951
+ <OText
952
+ color={theme.colors.error}
953
+ size={12}
954
+ >
955
+ {t('WARNING_INVALID_PRODUCTS_CHECKOUT', 'To continue with your checkout, please remove from your cart the products that are not available.')}
956
+ </OText>
957
+ </>
876
958
  )}
877
959
  {cart?.valid_preorder !== undefined && !cart?.valid_preorder && (
878
960
  <OText
@@ -882,7 +964,7 @@ const CheckoutUI = (props: any) => {
882
964
  {t('INVALID_CART_MOMENT', 'Selected schedule time is invalid, please select a schedule into the business schedule interval.')}
883
965
  </OText>
884
966
  )}
885
- {options.type === 1 &&
967
+ {options.type === 1 && !isGiftCardCart &&
886
968
  validationFields?.fields?.checkout?.driver_tip?.enabled &&
887
969
  validationFields?.fields?.checkout?.driver_tip?.required &&
888
970
  (Number(cart?.driver_tip) <= 0) && (
@@ -113,3 +113,20 @@ export const CartHeader = styled.View`
113
113
  justify-content: space-between;
114
114
  margin-bottom: 10px;
115
115
  `
116
+
117
+ export const TopActions = styled.TouchableOpacity`
118
+ height: 60px;
119
+ justify-content: center;
120
+ min-width: 30px;
121
+ padding-right: 15px;
122
+ `;
123
+
124
+ export const TopHeader = styled.View`
125
+ width: 100%;
126
+ flex-direction: row;
127
+ align-items: center;
128
+ justify-content: space-between;
129
+ z-index: 1;
130
+ height: 60px;
131
+ min-height: 60px;
132
+ `
@@ -2,7 +2,7 @@ import styled, { css } from 'styled-components/native'
2
2
 
3
3
  export const Container = styled.View`
4
4
  width: 100%;
5
- padding: 0 40px;
5
+ padding: 0 20px;
6
6
  justify-content: space-between;
7
7
  padding-bottom: 12px;
8
8
 
@@ -0,0 +1,33 @@
1
+ import React from 'react';
2
+ import DatePicker from 'react-native-date-picker'
3
+ import { DateContainer } from './styles';
4
+ import { useLanguage } from 'ordering-components/native';
5
+
6
+ export const DatePickerUI = (props: any) => {
7
+ const {
8
+ birthdate,
9
+ onConfirm,
10
+ onCancel,
11
+ open,
12
+ } = props;
13
+
14
+ const [, t] = useLanguage();
15
+
16
+ return (
17
+ <DateContainer>
18
+ <DatePicker
19
+ modal
20
+ mode="date"
21
+ open={open}
22
+ title={t('SELECT_A_DATE', 'Select a date')}
23
+ confirmText={t('CONFIRM', 'Confirm')}
24
+ cancelText={t('CANCEL', 'Cancel')}
25
+ date={birthdate ? new Date(birthdate) : new Date()}
26
+ onConfirm={date => onConfirm(date)}
27
+ onCancel={onCancel}
28
+ maximumDate={new Date()}
29
+ />
30
+ </DateContainer>
31
+ );
32
+ };
33
+
@@ -0,0 +1,20 @@
1
+ import styled from 'styled-components/native';
2
+
3
+ export const DateContainer = styled.View`
4
+ display: flex;
5
+ align-items: center;
6
+ margin-bottom: 20px;
7
+
8
+ input {
9
+ border-radius: 20px;
10
+ width: 140px;
11
+ outline: none;
12
+ padding: 10px 15px;
13
+ border: 1px solid #E9ECEF;
14
+ }
15
+
16
+ .react-datepicker__triangle {
17
+ transform: translate(40px, 0px) !important;
18
+ }
19
+
20
+ `
@@ -14,8 +14,7 @@ import {
14
14
 
15
15
  export const Favorite = (props: any) => {
16
16
  const {
17
- navigation,
18
- franchiseId
17
+ navigation
19
18
  } = props
20
19
  const [, t] = useLanguage()
21
20
  const theme = useTheme()
@@ -35,16 +34,20 @@ export const Favorite = (props: any) => {
35
34
  }
36
35
 
37
36
  return (
38
- <Container
39
- pdng={Platform.OS === 'ios' ? '10px' : '20px'}
40
- >
37
+ <Container>
41
38
  <NavBar
42
39
  title={t('FAVORITE', 'Favorite')}
43
40
  titleAlign={'center'}
44
41
  onActionLeft={goToBack}
45
42
  showCall={false}
46
- paddingTop={10}
43
+ paddingTop={Platform.OS === 'ios' ? 20 : 10}
44
+ style={{ paddingVertical: 0 }}
47
45
  btnStyle={{ paddingLeft: 0 }}
46
+ buttonProps={{
47
+ bgColor: theme.colors.white,
48
+ borderColor: theme.colors.white,
49
+ textStyle: { color: theme.colors.btnFont }
50
+ }}
48
51
  />
49
52
  <TabContainer>
50
53
  {tabList.map((menu, i) => (
@@ -73,7 +76,6 @@ export const Favorite = (props: any) => {
73
76
  originalURL='business'
74
77
  location={`${orderState.options?.address?.location?.lat},${orderState.options?.address?.location?.lng}`}
75
78
  propsToFetch={['id', 'name', 'header', 'logo', 'location', 'address', 'ribbon', 'timezone', 'schedule', 'open', 'delivery_price', 'distance', 'delivery_time', 'pickup_time', 'reviews', 'featured', 'offers', 'food', 'laundry', 'alcohol', 'groceries', 'slug']}
76
- franchiseId={franchiseId}
77
79
  />
78
80
  )}
79
81
  {tabSelected === 'products' && (
@@ -82,7 +84,6 @@ export const Favorite = (props: any) => {
82
84
  originalURL='products'
83
85
  onNavigationRedirect={onRedirect}
84
86
  isProduct
85
- franchiseId={franchiseId}
86
87
  />
87
88
  )}
88
89
  {tabSelected === 'orders' && (
@@ -91,7 +92,6 @@ export const Favorite = (props: any) => {
91
92
  favoriteURL='favorite_orders'
92
93
  originalURL='orders'
93
94
  isOrder
94
- franchiseId={franchiseId}
95
95
  />
96
96
  )}
97
97
  </Container>
@@ -16,7 +16,5 @@ export const Tab = styled.TouchableOpacity`
16
16
  `
17
17
 
18
18
  export const Container = styled.View`
19
- padding-horizontal: 40px;
20
19
  padding-bottom: 20px;
21
- padding-top: ${(props: any) => props.pdng};
22
20
  `
@@ -5,7 +5,7 @@ export const Container = styled.View`
5
5
  bottom: 0px;
6
6
  left: 0;
7
7
  right: 0;
8
- padding: 12px 40px;
8
+ padding: 12px 20px;
9
9
  flex-direction: row;
10
10
  border-top-width: 1px;
11
11
  border-color: ${(props: any) => props.theme.colors.border};
@@ -125,6 +125,11 @@ const ForgotPasswordUI = (props: any) => {
125
125
  style={{ flexDirection: 'column', alignItems: 'flex-start' }}
126
126
  titleStyle={{ width: '100%', marginLeft: 0, paddingLeft: 0 }}
127
127
  titleWrapStyle={{ paddingHorizontal: 0, paddingStart: 0, flex: 1 }}
128
+ buttonProps={{
129
+ bgColor: theme.colors.white,
130
+ borderColor: theme.colors.white,
131
+ textStyle: { color: theme.colors.btnFont }
132
+ }}
128
133
  />
129
134
  <FormSide>
130
135
  <OText
@@ -61,7 +61,7 @@ export const GPSButton = (props: any) => {
61
61
  if (trackingStatus === 'not-determined') {
62
62
  trackingStatus = await requestTrackingPermission()
63
63
  }
64
- if (trackingStatus === 'authorized' || trackingStatus === 'unavailable') {
64
+ if ( trackingStatus === 'authorized' || trackingStatus === 'denied' || trackingStatus === 'unavailable') {
65
65
  setLoading(true)
66
66
  Geolocation.getCurrentPosition((pos) => {
67
67
  geoCodePosition(pos.coords)
@@ -0,0 +1,64 @@
1
+ import React, { useState } from 'react';
2
+ import { useLanguage } from 'ordering-components/native';
3
+ import { useTheme } from 'styled-components/native';
4
+ import { View } from 'react-native';
5
+ import { OText } from '../../shared'
6
+ import { VerticalGiftCardOrdersLayout } from '../VerticalGiftCardOrdersLayout'
7
+
8
+ import {
9
+ Container,
10
+ NoOrdersWrapper
11
+ } from './styles'
12
+
13
+ export const GiftCardOrdersList = (props: any) => {
14
+ const {
15
+ onNavigationRedirect
16
+ } = props;
17
+
18
+ const theme = useTheme();
19
+ const [, t] = useLanguage();
20
+ const [isEmptyPending, setIsEmptyPending] = useState(false);
21
+ const [isEmptySent, setIsEmptySent] = useState(false);
22
+ const [isEmptyRedeemed, setIsEmptyRedeemed] = useState(false);
23
+
24
+ return (
25
+ <Container>
26
+ <VerticalGiftCardOrdersLayout
27
+ title={t('PENDING', 'Pending')}
28
+ defaultStatus='pending'
29
+ setIsEmpty={setIsEmptyPending}
30
+ onNavigationRedirect={onNavigationRedirect}
31
+ />
32
+
33
+ {!isEmptyPending && (
34
+ <View
35
+ style={{
36
+ height: 8,
37
+ backgroundColor: theme.colors.backgroundGray100,
38
+ marginHorizontal: -40,
39
+ }}
40
+ />
41
+ )}
42
+
43
+ <VerticalGiftCardOrdersLayout
44
+ title={t('SENT', 'Sent')}
45
+ defaultStatus='sent'
46
+ setIsEmpty={setIsEmptySent}
47
+ onNavigationRedirect={onNavigationRedirect}
48
+ />
49
+
50
+ <VerticalGiftCardOrdersLayout
51
+ title={t('REDEEMED', 'Redeemed')}
52
+ defaultStatus='activated'
53
+ setIsEmpty={setIsEmptyRedeemed}
54
+ onNavigationRedirect={onNavigationRedirect}
55
+ />
56
+
57
+ {isEmptyPending && isEmptySent && isEmptyRedeemed && (
58
+ <NoOrdersWrapper>
59
+ <OText size={16} color={theme.colors.textNormal}>{t('YOU_DONT_HAVE_CARDS', 'You don\'t have cards')}</OText>
60
+ </NoOrdersWrapper>
61
+ )}
62
+ </Container>
63
+ )
64
+ }
@@ -0,0 +1,8 @@
1
+ import styled from 'styled-components/native';
2
+
3
+ export const Container = styled.View`
4
+ `
5
+
6
+ export const NoOrdersWrapper = styled.View`
7
+ margin-vertical: 20px;
8
+ `
@@ -2,7 +2,7 @@ import styled from 'styled-components/native'
2
2
 
3
3
  export const Container = styled.View`
4
4
  width: 100%;
5
- padding-horizontal: 40px;
5
+ padding-horizontal: 20px;
6
6
  flex: 1;
7
7
  padding-bottom: 30px;
8
8
  `
@@ -1,7 +1,7 @@
1
1
  import styled from 'styled-components/native'
2
2
 
3
3
  export const Container = styled.View`
4
- padding-horizontal: 40px;
4
+ padding-horizontal: 20px;
5
5
  `
6
6
  export const FormController = styled.View`
7
7
  margin-bottom: 25px;
@@ -84,12 +84,12 @@ const SendGiftCardUI = (props: any) => {
84
84
  />
85
85
  </FormController>
86
86
  <FormController>
87
- <OText color={theme.colors.textNormal} size={14} mBottom={10}>{t('FROM', 'From')}</OText>
87
+ <OText color={theme.colors.textNormal} size={14} mBottom={10}>{t('NAME', 'Name')}</OText>
88
88
  <Controller
89
89
  control={control}
90
90
  render={({ onChange, value }: any) => (
91
91
  <OInput
92
- placeholder={t('WRITE_YOUR_NAME', 'Write your name')}
92
+ placeholder={t('WRITE_A_NAME', 'Write a name')}
93
93
  value={value}
94
94
  onChange={(val: any) => onChange(val)}
95
95
  autoCapitalize='none'
@@ -1,7 +1,7 @@
1
1
  import styled from 'styled-components/native'
2
2
 
3
3
  export const Container = styled.View`
4
- padding-horizontal: 40px;
4
+ padding-horizontal: 20px;
5
5
  margin-bottom: 30px;
6
6
  `
7
7
  export const FormController = styled.View`