ordering-ui-react-native 0.21.55 → 0.21.56-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 (165) hide show
  1. package/package.json +8 -9
  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/themes/business/index.tsx +4 -0
  9. package/themes/business/src/components/AcceptOrRejectOrder/index.tsx +4 -3
  10. package/themes/business/src/components/BusinessProductList/ProductList.tsx +2 -1
  11. package/themes/business/src/components/BusinessProductList/index.tsx +2 -1
  12. package/themes/business/src/components/DriverMap/index.tsx +36 -23
  13. package/themes/business/src/components/GoogleMap/index.tsx +15 -8
  14. package/themes/business/src/components/Home/index.tsx +5 -1
  15. package/themes/business/src/components/LanguageSelector/index.tsx +1 -2
  16. package/themes/business/src/components/LanguageSelector/lang_country.json +515 -70
  17. package/themes/business/src/components/LogoutButton/index.tsx +1 -1
  18. package/themes/business/src/components/MapView/index.tsx +30 -15
  19. package/themes/business/src/components/NewOrderNotification/index.tsx +66 -26
  20. package/themes/business/src/components/OrderDetails/Business.tsx +52 -2
  21. package/themes/business/src/components/OrderDetails/Delivery.tsx +43 -24
  22. package/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +68 -61
  23. package/themes/business/src/components/OrderDetails/OrderHeaderComponent.tsx +35 -21
  24. package/themes/business/src/components/OrderDetails/usePrinterCommands.tsx +220 -0
  25. package/themes/business/src/components/OrderSummary/index.tsx +240 -76
  26. package/themes/business/src/components/OrdersOption/index.tsx +229 -112
  27. package/themes/business/src/components/PhoneInputNumber/index.tsx +8 -5
  28. package/themes/business/src/components/PreviousOrders/OrderItem.tsx +29 -19
  29. package/themes/business/src/components/PreviousOrders/index.tsx +5 -3
  30. package/themes/business/src/components/PrinterEdition/index.tsx +363 -0
  31. package/themes/business/src/components/PrinterEdition/styles.tsx +61 -0
  32. package/themes/business/src/components/PrinterSettings/index.tsx +267 -0
  33. package/themes/business/src/components/PrinterSettings/styles.tsx +30 -0
  34. package/themes/business/src/components/ProductItemAccordion/index.tsx +2 -2
  35. package/themes/business/src/components/ReviewCustomer/index.tsx +2 -0
  36. package/themes/business/src/components/SearchBar/index.tsx +2 -1
  37. package/themes/business/src/components/Sessions/index.tsx +187 -0
  38. package/themes/business/src/components/Sessions/styles.tsx +20 -0
  39. package/themes/business/src/components/StoresList/index.tsx +4 -3
  40. package/themes/business/src/components/UserFormDetails/index.tsx +111 -107
  41. package/themes/business/src/components/UserProfileForm/index.tsx +106 -54
  42. package/themes/business/src/components/WebsocketStatus/index.tsx +2 -2
  43. package/themes/business/src/components/shared/OInput.tsx +2 -0
  44. package/themes/business/src/components/shared/OTextarea.tsx +8 -9
  45. package/themes/business/src/hooks/useLocation.tsx +5 -4
  46. package/themes/business/src/types/index.tsx +22 -5
  47. package/themes/business/src/utils/index.tsx +5 -0
  48. package/themes/doordash/src/components/BusinessesListing/index.tsx +1 -1
  49. package/themes/doordash/src/components/LoginForm/index.tsx +1 -2
  50. package/themes/instacart/src/components/BusinessesListing/index.tsx +1 -1
  51. package/themes/kiosk/src/components/Checkout/index.tsx +6 -0
  52. package/themes/kiosk/src/components/NavBar/index.tsx +14 -14
  53. package/themes/kiosk/src/components/OptionCard/index.tsx +1 -1
  54. package/themes/kiosk/src/components/OrderTypeCardSelector/index.tsx +8 -10
  55. package/themes/kiosk/src/components/shared/OButton.tsx +5 -18
  56. package/themes/original/index.tsx +6 -2
  57. package/themes/original/src/components/AddressDetails/index.tsx +20 -10
  58. package/themes/original/src/components/AddressForm/index.tsx +32 -17
  59. package/themes/original/src/components/AddressList/index.tsx +8 -7
  60. package/themes/original/src/components/AnalyticsSegment/index.tsx +6 -6
  61. package/themes/original/src/components/AppleLogin/index.tsx +4 -4
  62. package/themes/original/src/components/BusinessBasicInformation/index.tsx +6 -9
  63. package/themes/original/src/components/BusinessController/index.tsx +18 -10
  64. package/themes/original/src/components/BusinessController/styles.tsx +8 -7
  65. package/themes/original/src/components/BusinessItemAccordion/index.tsx +15 -7
  66. package/themes/original/src/components/BusinessListingSearch/BusinessSearchFooter.tsx +316 -0
  67. package/themes/original/src/components/BusinessListingSearch/BusinessSearchHeader.tsx +94 -0
  68. package/themes/original/src/components/BusinessListingSearch/index.tsx +48 -359
  69. package/themes/original/src/components/BusinessPreorder/index.tsx +20 -16
  70. package/themes/original/src/components/BusinessProductsList/SubcategoriesComponent/index.tsx +5 -5
  71. package/themes/original/src/components/BusinessProductsList/index.tsx +3 -3
  72. package/themes/original/src/components/BusinessProductsList/styles.tsx +0 -3
  73. package/themes/original/src/components/BusinessProductsListing/index.tsx +29 -14
  74. package/themes/original/src/components/BusinessTypeFilter/index.tsx +9 -8
  75. package/themes/original/src/components/BusinessesListing/Layout/Appointment/index.tsx +2 -1
  76. package/themes/original/src/components/BusinessesListing/Layout/Original/index.tsx +1 -1
  77. package/themes/original/src/components/BusinessesListing/index.tsx +0 -1
  78. package/themes/original/src/components/Cart/index.tsx +26 -9
  79. package/themes/original/src/components/CartContent/index.tsx +60 -45
  80. package/themes/original/src/components/Checkout/index.tsx +106 -64
  81. package/themes/original/src/components/CitiesControl/index.tsx +0 -3
  82. package/themes/original/src/components/CouponControl/index.tsx +1 -3
  83. package/themes/original/src/components/DatePicker/index.tsx +18 -2
  84. package/themes/original/src/components/DriverTips/index.tsx +1 -3
  85. package/themes/original/src/components/Favorite/index.tsx +1 -5
  86. package/themes/original/src/components/FavoriteList/index.tsx +0 -1
  87. package/themes/original/src/components/ForgotPasswordForm/index.tsx +5 -7
  88. package/themes/original/src/components/GiftCard/GiftCardOrdersList/index.tsx +64 -0
  89. package/themes/original/src/components/GiftCard/GiftCardOrdersList/styles.tsx +8 -0
  90. package/themes/original/src/components/GiftCard/GiftCardUI/index.tsx +15 -17
  91. package/themes/original/src/components/GiftCard/PurchaseGiftCard/index.tsx +3 -7
  92. package/themes/original/src/components/GiftCard/RedeemGiftCard/index.tsx +24 -32
  93. package/themes/original/src/components/GiftCard/SendGiftCard/index.tsx +9 -11
  94. package/themes/original/src/components/GiftCard/SingleGiftCard/index.tsx +101 -0
  95. package/themes/original/src/components/GiftCard/SingleGiftCard/styles.tsx +4 -0
  96. package/themes/original/src/components/GiftCard/VerticalGiftCardOrdersLayout/index.tsx +82 -0
  97. package/themes/original/src/components/GiftCard/VerticalGiftCardOrdersLayout/styles.tsx +9 -0
  98. package/themes/original/src/components/GoogleMap/index.tsx +39 -18
  99. package/themes/original/src/components/Help/index.tsx +2 -0
  100. package/themes/original/src/components/HighestRatedBusinesses/index.tsx +2 -2
  101. package/themes/original/src/components/Home/index.tsx +2 -10
  102. package/themes/original/src/components/LoginForm/Otp/index.tsx +4 -19
  103. package/themes/original/src/components/LoginForm/index.tsx +4 -7
  104. package/themes/original/src/components/MessageListing/index.tsx +1 -0
  105. package/themes/original/src/components/Messages/index.tsx +8 -7
  106. package/themes/original/src/components/MomentOption/index.tsx +13 -2
  107. package/themes/original/src/components/MultiCartsPaymethodsAndWallets/index.tsx +7 -3
  108. package/themes/original/src/components/MultiCheckout/index.tsx +124 -63
  109. package/themes/original/src/components/MultiCheckout/styles.tsx +17 -0
  110. package/themes/original/src/components/MultiOrdersDetails/index.tsx +20 -14
  111. package/themes/original/src/components/MyOrders/index.tsx +21 -26
  112. package/themes/original/src/components/NavBar/index.tsx +4 -2
  113. package/themes/original/src/components/NetworkError/index.tsx +2 -8
  114. package/themes/original/src/components/NotFoundSource/index.tsx +0 -3
  115. package/themes/original/src/components/Notifications/index.tsx +2 -4
  116. package/themes/original/src/components/OrderDetails/OrderHistory.tsx +5 -7
  117. package/themes/original/src/components/OrderDetails/index.tsx +5 -7
  118. package/themes/original/src/components/OrderDetails/styles.tsx +0 -1
  119. package/themes/original/src/components/OrderProgress/index.tsx +22 -3
  120. package/themes/original/src/components/OrderTypeSelector/index.tsx +7 -6
  121. package/themes/original/src/components/OrdersOption/index.tsx +2 -4
  122. package/themes/original/src/components/PaymentOptionCard/index.tsx +4 -2
  123. package/themes/original/src/components/PaymentOptionStripe/index.tsx +0 -5
  124. package/themes/original/src/components/PaymentOptionWallet/index.tsx +56 -56
  125. package/themes/original/src/components/PaymentOptions/index.tsx +47 -6
  126. package/themes/original/src/components/PlaceSpot/index.tsx +1 -3
  127. package/themes/original/src/components/PreviousOrders/index.tsx +1 -2
  128. package/themes/original/src/components/ProductForm/ActionButton.tsx +16 -19
  129. package/themes/original/src/components/ProductForm/index.tsx +123 -112
  130. package/themes/original/src/components/ProductItemAccordion/index.tsx +55 -49
  131. package/themes/original/src/components/ProductItemAccordion/styles.tsx +3 -4
  132. package/themes/original/src/components/ProductOptionSubOption/index.tsx +112 -91
  133. package/themes/original/src/components/ProfessionalProfile/index.tsx +4 -5
  134. package/themes/original/src/components/Promotions/index.tsx +6 -9
  135. package/themes/original/src/components/ReviewDriver/index.tsx +1 -1
  136. package/themes/original/src/components/ReviewOrder/index.tsx +2 -2
  137. package/themes/original/src/components/ReviewProducts/index.tsx +1 -1
  138. package/themes/original/src/components/ReviewTrigger/index.tsx +2 -2
  139. package/themes/original/src/components/ServiceForm/index.tsx +52 -54
  140. package/themes/original/src/components/Sessions/index.tsx +3 -3
  141. package/themes/original/src/components/SignupForm/index.tsx +65 -67
  142. package/themes/original/src/components/SingleOrderCard/index.tsx +1 -2
  143. package/themes/original/src/components/SingleProductCard/index.tsx +5 -6
  144. package/themes/original/src/components/SingleProductCard/styles.tsx +0 -3
  145. package/themes/original/src/components/StripeCardForm/index.tsx +0 -3
  146. package/themes/original/src/components/StripeCardsList/index.tsx +12 -36
  147. package/themes/original/src/components/StripeElementsForm/index.tsx +78 -59
  148. package/themes/original/src/components/StripeElementsForm/naked.tsx +48 -1
  149. package/themes/original/src/components/StripeRedirectForm/index.tsx +0 -3
  150. package/themes/original/src/components/UpsellingProducts/UpsellingContent.tsx +10 -7
  151. package/themes/original/src/components/UpsellingProducts/UpsellingLayout.tsx +8 -3
  152. package/themes/original/src/components/UserFormDetails/index.tsx +88 -91
  153. package/themes/original/src/components/UserFormDetails/styles.tsx +7 -0
  154. package/themes/original/src/components/UserProfile/index.tsx +11 -2
  155. package/themes/original/src/components/Wallets/index.tsx +7 -4
  156. package/themes/original/src/components/Wallets/styles.tsx +1 -1
  157. package/themes/original/src/components/WebsocketStatus/index.tsx +169 -0
  158. package/themes/original/src/components/WebsocketStatus/styles.tsx +28 -0
  159. package/themes/original/src/components/shared/OAlert.tsx +2 -1
  160. package/themes/original/src/components/shared/OButton.tsx +8 -7
  161. package/themes/original/src/components/shared/OInput.tsx +1 -4
  162. package/themes/original/src/layouts/Container.tsx +4 -2
  163. package/themes/original/src/types/index.tsx +5 -1
  164. package/themes/original/src/utils/index.tsx +12 -1
  165. package/themes/uber-eats/src/components/BusinessesListing/index.tsx +1 -1
@@ -1,10 +1,11 @@
1
- import React, { useState, useEffect, useCallback } from 'react';
2
- import { View, StyleSheet, TouchableOpacity, Platform, I18nManager, ScrollView, SafeAreaView } 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
7
  import IconAntDesign from 'react-native-vector-icons/AntDesign';
8
+ import { useIsFocused } from '@react-navigation/native';
8
9
 
9
10
  import ReactNativeHapticFeedback from "react-native-haptic-feedback";
10
11
  import {
@@ -100,10 +101,13 @@ const CheckoutUI = (props: any) => {
100
101
  currency,
101
102
  merchantId,
102
103
  setPlaceSpotNumber,
103
- maxDate
104
+ maxDate,
105
+ androidAppId,
106
+ urlscheme
104
107
  } = props
105
108
 
106
109
  const theme = useTheme();
110
+ const isFocused = useIsFocused();
107
111
 
108
112
  const styles = StyleSheet.create({
109
113
  btnBackArrow: {
@@ -159,7 +163,7 @@ const CheckoutUI = (props: any) => {
159
163
  const [phoneUpdate, setPhoneUpdate] = useState(false);
160
164
  const [openChangeStore, setOpenChangeStore] = useState(false)
161
165
  const [isDeliveryOptionModalVisible, setIsDeliveryOptionModalVisible] = useState(false)
162
- const [showGateway, setShowGateway] = useState<any>({ closedByUsed: false, open: false });
166
+ const [showGateway, setShowGateway] = useState<any>({ closedByUser: false, open: false });
163
167
  const [webviewPaymethod, setWebviewPaymethod] = useState<any>(null)
164
168
  const [isOpen, setIsOpen] = useState(false)
165
169
  const [requiredFields, setRequiredFields] = useState<any>([])
@@ -170,11 +174,12 @@ const CheckoutUI = (props: any) => {
170
174
  const [paymethodClicked, setPaymethodClicked] = useState<any>(null)
171
175
  const [showTitle, setShowTitle] = useState(false)
172
176
  const [cardList, setCardList] = useState<any>({ cards: [], loading: false, error: null })
177
+ const [isGiftCardCart, setIsGiftCardCart] = useState(!cart?.business_id)
178
+ const containerRef = useRef<any>()
173
179
  const cardsMethods = ['credomatic']
174
180
  const stripePaymethods: any = ['stripe', 'stripe_direct', 'stripe_connect', 'stripe_redirect']
175
181
  const placeSpotTypes = [3, 4, 5]
176
182
  const placeSpotsEnabled = placeSpotTypes.includes(options?.type)
177
- const isGiftCardCart = !cart?.business_id
178
183
  const businessConfigs = businessDetails?.business?.configs ?? []
179
184
  const isWalletCashEnabled = businessConfigs.find((config: any) => config.key === 'wallet_cash_enabled')?.value === '1'
180
185
  const isWalletCreditPointsEnabled = businessConfigs.find((config: any) => config.key === 'wallet_credit_point_enabled')?.value === '1'
@@ -207,7 +212,7 @@ const CheckoutUI = (props: any) => {
207
212
  const isDisabledButtonPlace = loading || !cart?.valid || (!paymethodSelected && cart?.balance > 0) ||
208
213
  placing || errorCash || subtotalWithTaxes < cart?.minimum ||
209
214
  (cardsMethods.includes(paymethodSelected?.gateway) && cardList?.cards?.length === 0) ||
210
- (options.type === 1 &&
215
+ (options.type === 1 && !isGiftCardCart &&
211
216
  validationFields?.fields?.checkout?.driver_tip?.enabled &&
212
217
  validationFields?.fields?.checkout?.driver_tip?.required &&
213
218
  (Number(cart?.driver_tip) <= 0)) ||
@@ -356,13 +361,23 @@ const CheckoutUI = (props: any) => {
356
361
 
357
362
  useEffect(() => {
358
363
  if (cart?.products?.length === 0) {
359
- if (cart?.business?.slug) {
364
+ if (cart?.business_id !== null) {
360
365
  onNavigationRedirect('Business', { store: cart?.business?.slug, header: null, logo: null, fromMulti: props.fromMulti })
361
- } else {
366
+ } else if (isGiftCardCart) {
362
367
  onNavigationRedirect('Wallets')
363
368
  }
364
369
  }
365
- }, [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])
366
381
 
367
382
  useEffect(() => {
368
383
  onFailPaypal()
@@ -402,6 +417,7 @@ const CheckoutUI = (props: any) => {
402
417
  }, [])
403
418
 
404
419
  useEffect(() => {
420
+ if (!isFocused) return
405
421
  if (!cartState?.loading && (cartState?.error || typeof cartState?.cart === 'string')) {
406
422
  const error = cartState?.error || typeof cartState.cart === 'string' && cartState.cart
407
423
  if (error) {
@@ -409,13 +425,37 @@ const CheckoutUI = (props: any) => {
409
425
  navigation.navigate('BusinessList')
410
426
  }
411
427
  }
412
- }, [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])
413
453
 
414
454
  return (
415
455
  <>
416
- <View style={styles.wrapperNavbar}>
417
- <TopHeader>
418
- <>
456
+ <SafeAreaView style={{ backgroundColor: theme.colors.backgroundPage }}>
457
+ <View style={styles.wrapperNavbar}>
458
+ <TopHeader>
419
459
  <TopActions onPress={() => onNavigationRedirect('BottomTab', { screen: 'Cart' }, !props.fromMulti)}>
420
460
  <IconAntDesign
421
461
  name='arrowleft'
@@ -433,10 +473,10 @@ const CheckoutUI = (props: any) => {
433
473
  {t('CHECKOUT', 'Checkout')}
434
474
  </OText>
435
475
  )}
436
- </>
437
- </TopHeader>
438
- </View>
439
- <Container noPadding onScroll={handleScroll}>
476
+ </TopHeader>
477
+ </View>
478
+ </SafeAreaView>
479
+ <Container pt={0} forwardRef={containerRef} showsVerticalScrollIndicator={false} noPadding onScroll={handleScroll}>
440
480
  <View style={styles.wrapperNavbar}>
441
481
  <NavBar
442
482
  hideArrowLeft
@@ -451,44 +491,46 @@ const CheckoutUI = (props: any) => {
451
491
  />
452
492
  </View>
453
493
  <ChContainer style={styles.pagePadding}>
454
- <ChSection style={{ paddingTop: 0 }}>
455
- <ChHeader>
456
- <CHMomentWrapper isCustomColor={isChewLayout} onPress={() => navigation.navigate('OrderTypes', { configTypes: configTypes })}>
457
- <OText
458
- size={12}
459
- numberOfLines={1}
460
- ellipsizeMode={'tail'}
461
- color={theme.colors?.[isChewLayout ? 'white' : 'textSecondary']}
462
- >
463
- {t(getTypesText(options?.type || 1), 'Delivery')}
464
- </OText>
465
- <OIcon
466
- src={theme.images.general.arrow_down}
467
- width={10}
468
- style={{ marginStart: 8 }}
469
- {...(isChewLayout && { color: 'white' })}
470
- />
471
- </CHMomentWrapper>
472
- <CHMomentWrapper
473
- onPress={() => handleMomentClick()}
474
- disabled={loading}
475
- >
476
- <OText size={12} numberOfLines={1} ellipsizeMode='tail' color={theme.colors.textSecondary}>
477
- {options?.moment
478
- ? parseDate(options?.moment, { outputFormat: configs?.dates_moment_format?.value })
479
- : t('ASAP_ABBREVIATION', 'ASAP')}
480
- </OText>
481
- {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>
482
506
  <OIcon
483
507
  src={theme.images.general.arrow_down}
484
508
  width={10}
485
509
  style={{ marginStart: 8 }}
510
+ {...(isChewLayout && { color: 'white' })}
486
511
  />
487
- )}
488
- </CHMomentWrapper>
489
- </ChHeader>
490
- <View style={{ height: 8, backgroundColor: theme.colors.backgroundGray100, marginTop: 18, marginHorizontal: -40 }} />
491
- </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
+ )}
492
534
 
493
535
  {!isGiftCardCart && !hideBusinessDetails && (
494
536
  <ChSection>
@@ -577,15 +619,11 @@ const CheckoutUI = (props: any) => {
577
619
  <HeaderTitle text={t('CUSTOMER_DETAILS', 'Customer details')} />
578
620
  <OButton
579
621
  text={t('SIGN_UP', 'Sign up')}
580
- textStyle={{ color: theme.colors.white }}
581
622
  style={{ borderRadius: 7.6, marginTop: 20 }}
582
623
  onClick={() => setOpenModal({ ...openModal, signup: true })}
583
624
  />
584
625
  <OButton
585
626
  text={t('LOGIN', 'Login')}
586
- textStyle={{ color: theme.colors.primary }}
587
- bgColor={theme.colors.white}
588
- borderColor={theme.colors.primary}
589
627
  style={{ borderRadius: 7.6, marginTop: 20 }}
590
628
  onClick={() => setOpenModal({ ...openModal, login: true })}
591
629
  />
@@ -729,7 +767,7 @@ const CheckoutUI = (props: any) => {
729
767
  cart?.status !== 2 &&
730
768
  validationFields?.fields?.checkout?.driver_tip?.enabled &&
731
769
  driverTipsOptions && driverTipsOptions?.length > 0 &&
732
- !isGiftCardCart &&
770
+ cart?.business_id &&
733
771
  (
734
772
  <ChSection>
735
773
  <ChDriverTips>
@@ -777,6 +815,8 @@ const CheckoutUI = (props: any) => {
777
815
  handlePaymentMethodClickCustom={handlePaymentMethodClick}
778
816
  handlePlaceOrder={handlePlaceOrder}
779
817
  merchantId={merchantId}
818
+ urlscheme={urlscheme}
819
+ androidAppId={androidAppId}
780
820
  setMethodPaySupported={setMethodPaySupported}
781
821
  methodPaySupported={methodPaySupported}
782
822
  placeByMethodPay={placeByMethodPay}
@@ -822,7 +862,7 @@ const CheckoutUI = (props: any) => {
822
862
  {!cartState.loading && cart && (
823
863
  <ChSection>
824
864
  <ChCart>
825
- {cartsWithProducts && cart?.products?.length === 0 ? (
865
+ {cartsWithProducts?.length > 0 && cart?.products?.length === 0 ? (
826
866
  <NotFoundSource
827
867
  content={t('NOT_FOUND_CARTS', 'Sorry, You don\'t seem to have any carts.')}
828
868
  btnTitle={t('SEARCH_REDIRECT', 'Go to Businesses')}
@@ -900,13 +940,15 @@ const CheckoutUI = (props: any) => {
900
940
  </OText>
901
941
  )}
902
942
 
903
- {!cart?.valid_products && cart?.status !== 2 && (
904
- <OText
905
- color={theme.colors.error}
906
- size={12}
907
- >
908
- {t('WARNING_INVALID_PRODUCTS_CHECKOUT', 'To continue with your checkout, please remove from your cart the products that are not available.')}
909
- </OText>
943
+ {!cart?.valid_products && cart?.status !== 2 && cart?.total !== 0 && (
944
+ <>
945
+ <OText
946
+ color={theme.colors.error}
947
+ size={12}
948
+ >
949
+ {t('WARNING_INVALID_PRODUCTS_CHECKOUT', 'To continue with your checkout, please remove from your cart the products that are not available.')}
950
+ </OText>
951
+ </>
910
952
  )}
911
953
  {cart?.valid_preorder !== undefined && !cart?.valid_preorder && (
912
954
  <OText
@@ -916,7 +958,7 @@ const CheckoutUI = (props: any) => {
916
958
  {t('INVALID_CART_MOMENT', 'Selected schedule time is invalid, please select a schedule into the business schedule interval.')}
917
959
  </OText>
918
960
  )}
919
- {options.type === 1 &&
961
+ {options.type === 1 && !isGiftCardCart &&
920
962
  validationFields?.fields?.checkout?.driver_tip?.enabled &&
921
963
  validationFields?.fields?.checkout?.driver_tip?.required &&
922
964
  (Number(cart?.driver_tip) <= 0) && (
@@ -69,10 +69,7 @@ export const CitiesControl = (props: any) => {
69
69
  </View>
70
70
  <OButton
71
71
  text={t('CONTINUE', 'Continue')}
72
- bgColor={theme.colors.primary}
73
- borderColor={theme.colors.primary}
74
72
  style={styles.btnStyle}
75
- textStyle={{ color: 'white' }}
76
73
  onClick={() => handleClick()}
77
74
  />
78
75
  </Container>
@@ -102,9 +102,7 @@ const CouponControlUI = (props: any) => {
102
102
  />
103
103
  <OButton
104
104
  onClick={() => onButtonApplyClick()}
105
- bgColor={theme.colors.primary}
106
- borderColor={theme.colors.primary}
107
- textStyle={{ color: 'white', fontSize: 12 }}
105
+ textStyle={{ fontSize: 12 }}
108
106
  imgRightSrc={null}
109
107
  text={t('APPLY', 'Apply')}
110
108
  isDisabled={!couponInput}
@@ -1,16 +1,32 @@
1
1
  import React from 'react';
2
2
  import DatePicker from 'react-native-date-picker'
3
3
  import { DateContainer } from './styles';
4
+ import { useLanguage } from 'ordering-components/native';
4
5
 
5
6
  export const DatePickerUI = (props: any) => {
6
7
  const {
7
8
  birthdate,
8
- handleChangeDate
9
+ onConfirm,
10
+ onCancel,
11
+ open,
9
12
  } = props;
10
13
 
14
+ const [, t] = useLanguage();
15
+
11
16
  return (
12
17
  <DateContainer>
13
- <DatePicker mode="date" date={birthdate ? new Date(birthdate) : new Date()} onDateChange={handleChangeDate} />
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
+ />
14
30
  </DateContainer>
15
31
  );
16
32
  };
@@ -125,9 +125,7 @@ const DriverTipsUI = (props: any) => {
125
125
  />
126
126
  <OButton
127
127
  text={t('APPLY_TIP', 'Apply Tip')}
128
- bgColor={theme.colors.primary}
129
- borderColor={theme.colors.primary}
130
- textStyle={{ color: 'white', fontSize: 14 }}
128
+ textStyle={{ fontSize: 14 }}
131
129
  imgRightSrc={null}
132
130
  style={{ borderRadius: 5, height: 44 }}
133
131
  isDisabled={parseFloat(value || '0') < 0 || parseFloat(value || '0') === driverTip || value === ''}
@@ -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()
@@ -72,7 +71,6 @@ export const Favorite = (props: any) => {
72
71
  originalURL='business'
73
72
  location={`${orderState.options?.address?.location?.lat},${orderState.options?.address?.location?.lng}`}
74
73
  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']}
75
- franchiseId={franchiseId}
76
74
  />
77
75
  )}
78
76
  {tabSelected === 'products' && (
@@ -81,7 +79,6 @@ export const Favorite = (props: any) => {
81
79
  originalURL='products'
82
80
  onNavigationRedirect={onRedirect}
83
81
  isProduct
84
- franchiseId={franchiseId}
85
82
  />
86
83
  )}
87
84
  {tabSelected === 'orders' && (
@@ -90,7 +87,6 @@ export const Favorite = (props: any) => {
90
87
  favoriteURL='favorite_orders'
91
88
  originalURL='orders'
92
89
  isOrder
93
- franchiseId={franchiseId}
94
90
  />
95
91
  )}
96
92
  </Container>
@@ -270,7 +270,6 @@ const FavoriteListUI = (props: FavoriteParams) => {
270
270
  onClick={() => getFavoriteList(pagination?.currentPage + 1)}
271
271
  text={t('LOAD_MORE_ITEMS', 'Load more items')}
272
272
  imgRightSrc={null}
273
- textStyle={{ color: theme.colors.white }}
274
273
  style={{ borderRadius: 7.6, shadowOpacity: 0, marginTop: 20 }}
275
274
  />
276
275
  </WrappButton>
@@ -64,7 +64,7 @@ const ForgotPasswordUI = (props: any) => {
64
64
  handleReCaptcha(null)
65
65
  if (reCaptchaValue) return
66
66
 
67
- if (!recaptchaConfig?.siteKey) {
67
+ if (!recaptchaConfig?.siteKey) {
68
68
  showToast(ToastType.Error, t('NO_RECAPTCHA_SITE_KEY', 'The config doesn\'t have recaptcha site key'));
69
69
  return
70
70
  }
@@ -73,7 +73,7 @@ const ForgotPasswordUI = (props: any) => {
73
73
  return
74
74
  }
75
75
  recaptchaRef.current.open()
76
- }
76
+ }
77
77
 
78
78
  const onRecaptchaVerify = (token: any) => {
79
79
  setRecaptchaVerified(true)
@@ -92,8 +92,8 @@ const ForgotPasswordUI = (props: any) => {
92
92
  formState.result?.result && showToast(
93
93
  ToastType.Error,
94
94
  typeof formState.result?.result === 'string'
95
- ? formState.result?.result
96
- : formState.result?.result[0]
95
+ ? formState.result?.result
96
+ : formState.result?.result[0]
97
97
  )
98
98
  return
99
99
  }
@@ -208,9 +208,7 @@ const ForgotPasswordUI = (props: any) => {
208
208
 
209
209
  <OButton
210
210
  text={emailSent && !formState.result?.error ? t('LINK_SEND_FORGOT_PASSWORD', 'Link Sent') : t('FRONT_RECOVER_PASSWORD', 'Recover Password')}
211
- textStyle={{ color: 'white' }}
212
- bgColor={emailSent && !formState.result?.error ? theme.colors.disabled : theme.colors.primary}
213
- borderColor={emailSent && !formState.result?.error ? theme.colors.disabled : theme.colors.primary}
211
+ isDisabled={formState.loading || emailSent && !formState.result?.error}
214
212
  isLoading={formState.loading}
215
213
  imgRightSrc={null}
216
214
  onClick={emailSent && !formState.result?.error ? () => { } : handleSubmit(onSubmit)}
@@ -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
+ `
@@ -12,7 +12,7 @@ import {
12
12
  Container
13
13
  } from './styles'
14
14
 
15
- export const GiftCardUI = React.memo((props: any) => {
15
+ export const GiftCardUI = React.memo((props: any) => {
16
16
  const {
17
17
  navigation
18
18
  } = props
@@ -57,9 +57,7 @@ export const GiftCardUI = React.memo((props: any) => {
57
57
  <OButton
58
58
  onClick={() => setOpenModal('purchase')}
59
59
  text={t('PURCHASE', 'Purchase')}
60
- bgColor={theme.colors.primary}
61
- borderColor={theme.colors.primary}
62
- textStyle={{ color: 'white', fontSize: 13 }}
60
+ textStyle={{ fontSize: 13 }}
63
61
  imgRightSrc={null}
64
62
  style={{ ...style.btnStyle, marginRight: 14 }}
65
63
  />
@@ -76,26 +74,26 @@ export const GiftCardUI = React.memo((props: any) => {
76
74
  </View>
77
75
 
78
76
  <OModal
79
- open={openModal === 'purchase'}
80
- onClose={() => setOpenModal(null)}
81
- entireModal
77
+ open={openModal === 'purchase'}
78
+ onClose={() => setOpenModal(null)}
79
+ entireModal
82
80
  customClose
83
- >
84
- <PurchaseGiftCard
81
+ >
82
+ <PurchaseGiftCard
85
83
  handleCustomGoToCheckout={handleCustomGoToCheckout}
86
84
  onClose={() => setOpenModal(null)}
87
85
  />
88
- </OModal>
86
+ </OModal>
89
87
  <OModal
90
- open={openModal === 'redeem'}
91
- onClose={() => setOpenModal(null)}
92
- entireModal
88
+ open={openModal === 'redeem'}
89
+ onClose={() => setOpenModal(null)}
90
+ entireModal
93
91
  customClose
94
- >
95
- <RedeemGiftCard
92
+ >
93
+ <RedeemGiftCard
96
94
  onClose={() => setOpenModal(null)}
97
95
  />
98
- </OModal>
96
+ </OModal>
99
97
  </Container>
100
98
  )
101
- })
99
+ })
@@ -58,12 +58,10 @@ const PurchaseGiftCardUI = (props: any) => {
58
58
  borderWidth: 0,
59
59
  width: 26,
60
60
  height: 26,
61
- backgroundColor: '#FFF',
62
- borderColor: '#FFF',
63
- shadowColor: '#FFF',
64
61
  paddingLeft: 0,
65
62
  paddingRight: 0,
66
63
  }}
64
+ useArrow
67
65
  onClick={onClose}
68
66
  icon={AntDesignIcon}
69
67
  iconProps={{
@@ -113,9 +111,7 @@ const PurchaseGiftCardUI = (props: any) => {
113
111
  <OButton
114
112
  onClick={() => handleAccept()}
115
113
  text={t('ACCEPT', 'Accept')}
116
- bgColor={theme.colors.primary}
117
- borderColor={theme.colors.primary}
118
- textStyle={{ color: 'white', fontSize: 13 }}
114
+ textStyle={{ fontSize: 13 }}
119
115
  imgRightSrc={null}
120
116
  style={style.btnStyle}
121
117
  isDisabled={!selectedProduct}
@@ -130,4 +126,4 @@ export const PurchaseGiftCard = (props: any) => {
130
126
  UIComponent: PurchaseGiftCardUI
131
127
  }
132
128
  return <PurchaseGiftCardController {...purchaseGiftCardProps} />
133
- }
129
+ }