ordering-ui-react-native 0.22.47-map → 0.22.47-test

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 (75) hide show
  1. package/package.json +4 -4
  2. package/themes/business/src/components/AcceptOrRejectOrder/index.tsx +4 -3
  3. package/themes/business/src/components/NewOrderNotification/index.tsx +3 -4
  4. package/themes/business/src/components/OrderDetails/Delivery.tsx +14 -2
  5. package/themes/business/src/components/OrderDetails/OrderContentComponent.tsx +9 -9
  6. package/themes/business/src/types/index.tsx +1 -0
  7. package/themes/original/src/components/AddressForm/index.tsx +10 -12
  8. package/themes/original/src/components/AddressList/index.tsx +0 -13
  9. package/themes/original/src/components/BusinessItemAccordion/index.tsx +4 -2
  10. package/themes/original/src/components/BusinessListingSearch/BusinessSearchHeader.tsx +1 -3
  11. package/themes/original/src/components/BusinessListingSearch/index.tsx +1 -2
  12. package/themes/original/src/components/BusinessPreorder/index.tsx +20 -17
  13. package/themes/original/src/components/Cart/index.tsx +1 -2
  14. package/themes/original/src/components/CartContent/index.tsx +1 -2
  15. package/themes/original/src/components/Checkout/index.tsx +29 -17
  16. package/themes/original/src/components/CitiesControl/index.tsx +0 -3
  17. package/themes/original/src/components/CouponControl/index.tsx +1 -3
  18. package/themes/original/src/components/DriverTips/index.tsx +1 -3
  19. package/themes/original/src/components/Favorite/index.tsx +0 -5
  20. package/themes/original/src/components/FavoriteList/index.tsx +0 -1
  21. package/themes/original/src/components/ForgotPasswordForm/index.tsx +4 -10
  22. package/themes/original/src/components/GiftCard/GiftCardUI/index.tsx +15 -17
  23. package/themes/original/src/components/GiftCard/PurchaseGiftCard/index.tsx +3 -7
  24. package/themes/original/src/components/GiftCard/RedeemGiftCard/index.tsx +24 -32
  25. package/themes/original/src/components/GiftCard/SendGiftCard/index.tsx +7 -9
  26. package/themes/original/src/components/GiftCard/VerticalGiftCardOrdersLayout/index.tsx +11 -12
  27. package/themes/original/src/components/GoogleMap/index.tsx +4 -3
  28. package/themes/original/src/components/Help/index.tsx +0 -5
  29. package/themes/original/src/components/HelpAccountAndPayment/index.tsx +0 -5
  30. package/themes/original/src/components/HelpGuide/index.tsx +0 -5
  31. package/themes/original/src/components/HelpOrder/index.tsx +0 -5
  32. package/themes/original/src/components/Home/index.tsx +1 -10
  33. package/themes/original/src/components/LoginForm/Otp/index.tsx +0 -3
  34. package/themes/original/src/components/LoginForm/index.tsx +1 -9
  35. package/themes/original/src/components/MessageListing/index.tsx +0 -5
  36. package/themes/original/src/components/MomentOption/index.tsx +6 -10
  37. package/themes/original/src/components/MultiCartsPaymethodsAndWallets/index.tsx +1 -0
  38. package/themes/original/src/components/MultiCheckout/index.tsx +0 -1
  39. package/themes/original/src/components/MultiOrdersDetails/index.tsx +1 -0
  40. package/themes/original/src/components/MyOrders/index.tsx +0 -5
  41. package/themes/original/src/components/NavBar/index.tsx +1 -4
  42. package/themes/original/src/components/NetworkError/index.tsx +0 -5
  43. package/themes/original/src/components/NotFoundSource/index.tsx +0 -3
  44. package/themes/original/src/components/Notifications/index.tsx +0 -5
  45. package/themes/original/src/components/OrderDetails/OrderHistory.tsx +5 -7
  46. package/themes/original/src/components/OrderDetails/index.tsx +1 -2
  47. package/themes/original/src/components/OrderTypeSelector/index.tsx +3 -8
  48. package/themes/original/src/components/PaymentOptionStripe/index.tsx +0 -5
  49. package/themes/original/src/components/PaymentOptions/index.tsx +0 -2
  50. package/themes/original/src/components/PlaceSpot/index.tsx +1 -3
  51. package/themes/original/src/components/PreviousOrders/index.tsx +1 -4
  52. package/themes/original/src/components/ProductForm/ActionButton.tsx +4 -5
  53. package/themes/original/src/components/ProductOptionSubOption/index.tsx +8 -1
  54. package/themes/original/src/components/ProfessionalProfile/index.tsx +4 -5
  55. package/themes/original/src/components/Promotions/index.tsx +2 -7
  56. package/themes/original/src/components/ReviewDriver/index.tsx +1 -6
  57. package/themes/original/src/components/ReviewOrder/index.tsx +2 -7
  58. package/themes/original/src/components/ReviewProducts/index.tsx +1 -6
  59. package/themes/original/src/components/ReviewTrigger/index.tsx +2 -2
  60. package/themes/original/src/components/ServiceForm/index.tsx +52 -54
  61. package/themes/original/src/components/Sessions/index.tsx +3 -8
  62. package/themes/original/src/components/SignupForm/index.tsx +4 -13
  63. package/themes/original/src/components/SingleOrderCard/index.tsx +0 -1
  64. package/themes/original/src/components/SingleProductCard/index.tsx +2 -2
  65. package/themes/original/src/components/StripeCardForm/index.tsx +0 -3
  66. package/themes/original/src/components/StripeCardsList/index.tsx +9 -1
  67. package/themes/original/src/components/StripeElementsForm/index.tsx +4 -2
  68. package/themes/original/src/components/StripeRedirectForm/index.tsx +0 -3
  69. package/themes/original/src/components/UpsellingProducts/UpsellingContent.tsx +1 -3
  70. package/themes/original/src/components/UserFormDetails/index.tsx +8 -10
  71. package/themes/original/src/components/UserProfileForm/index.tsx +0 -5
  72. package/themes/original/src/components/Wallets/index.tsx +1 -3
  73. package/themes/original/src/components/WebsocketStatus/index.tsx +1 -4
  74. package/themes/original/src/components/shared/OButton.tsx +3 -2
  75. package/themes/original/src/types/index.tsx +2 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ordering-ui-react-native",
3
- "version": "0.22.47-map",
3
+ "version": "0.22.47-test",
4
4
  "description": "Reusable components made in react native",
5
5
  "main": "src/index.tsx",
6
6
  "author": "ordering.inc",
@@ -46,7 +46,7 @@
46
46
  "@react-native-firebase/app": "^12.9.3",
47
47
  "@react-native-google-signin/google-signin": "^7.0.1",
48
48
  "@react-navigation/drawer": "^5.10.2",
49
- "@react-navigation/material-bottom-tabs": "^5.3.14",
49
+ "@react-navigation/material-bottom-tabs": "^6.2.17",
50
50
  "@react-navigation/native": "^5.7.6",
51
51
  "@react-navigation/stack": "^5.9.3",
52
52
  "@segment/analytics-react-native": "2.1.11",
@@ -86,7 +86,7 @@
86
86
  "react-native-gesture-handler": "^1.8.0",
87
87
  "react-native-get-random-values": "1.8.0",
88
88
  "react-native-gifted-chat": "^0.16.3",
89
- "react-native-google-places-autocomplete": "^2.1.3",
89
+ "react-native-google-places-autocomplete": "2.1.3",
90
90
  "react-native-html-to-pdf": "^0.10.0",
91
91
  "react-native-image-picker": "^4.0.6",
92
92
  "react-native-intersection-observer": "^0.0.9",
@@ -94,7 +94,7 @@
94
94
  "react-native-linear-gradient": "^2.5.6",
95
95
  "react-native-loading-spinner-overlay": "^2.0.0",
96
96
  "react-native-map-link": "^2.8.2",
97
- "react-native-maps": "0.31.0",
97
+ "react-native-maps": "^0.28.0",
98
98
  "react-native-modal-dropdown": "^1.0.1",
99
99
  "react-native-onesignal": "^4.1.1",
100
100
  "react-native-paper": "^4.7.2",
@@ -31,6 +31,7 @@ export const AcceptOrRejectOrder = (props: AcceptOrRejectOrderParams) => {
31
31
  notShowCustomerPhone,
32
32
  orderTitle,
33
33
  appTitle,
34
+ isLoadingOrder
34
35
  } = props;
35
36
 
36
37
  const [, t] = useLanguage();
@@ -277,7 +278,7 @@ export const AcceptOrRejectOrder = (props: AcceptOrRejectOrderParams) => {
277
278
  }
278
279
 
279
280
  bodyToSend.id = orderId;
280
- handleUpdateOrder && handleUpdateOrder(bodyToSend.status, bodyToSend);
281
+ handleUpdateOrder?.(bodyToSend.status, bodyToSend);
281
282
  };
282
283
 
283
284
  useEffect(() => {
@@ -517,7 +518,7 @@ export const AcceptOrRejectOrder = (props: AcceptOrRejectOrderParams) => {
517
518
  ...styles.bottomParent,
518
519
  marginBottom: Platform.OS === 'ios'
519
520
  ? 30 : (keyboardState.height === 0)
520
- ? isPage ? 0 : 30
521
+ ? isPage ? 0 : 40
521
522
  : keyboardState.height - (isPage ? 20 : -10)
522
523
  }}
523
524
  >
@@ -529,7 +530,7 @@ export const AcceptOrRejectOrder = (props: AcceptOrRejectOrderParams) => {
529
530
  style={{ borderRadius: 7, height: 45 }}
530
531
  parentStyle={{ width: '100%' }}
531
532
  textStyle={{ color: '#FFF', fontSize: 18 }}
532
- isDisabled={showTextArea && !comments}
533
+ isDisabled={(showTextArea && !comments) || isLoadingOrder}
533
534
  onClick={() => handleAcceptOrReject()}
534
535
  />
535
536
  </View>
@@ -75,7 +75,7 @@ const SoundPlayerComponent = (props: any) => {
75
75
  setIsEnabledReadStorage(true)
76
76
  }
77
77
  }
78
- checkSoundMedia()
78
+ // checkSoundMedia()
79
79
 
80
80
  }, [])
81
81
  return (
@@ -152,12 +152,11 @@ const NewOrderNotificationUI = (props: any) => {
152
152
  } catch { }
153
153
  const duration = moment.duration(moment().diff(moment.utc(value?.last_driver_assigned_at)))
154
154
  const assignedSecondsDiff = duration.asSeconds()
155
- if (assignedSecondsDiff < 5 && !isBusinessApp && !value?.logistic_status && orderStatus.includes(value.status)) {
155
+ if (assignedSecondsDiff < 5 && !isBusinessApp && !value?.logistic_status) {
156
156
  setCurrentEvent({ evt: 2, orderId: value?.id ?? value?.order_id })
157
157
  }
158
158
  }
159
- if (!orderStatus.includes(value.status) || value?.author_id === user.id) return
160
- setCurrentEvent({
159
+ if ((!orderStatus.includes(value.status) && evtType !== 1 && isBusinessApp) || value?.author_id === user.id) return setCurrentEvent({
161
160
  evt: evtType,
162
161
  orderId: value?.driver
163
162
  ? value?.order_id ?? value?.id
@@ -428,6 +428,16 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
428
428
  forceUpdate && handleViewActionOrder && handleViewActionOrder(forceUpdate === 9 ? 'forcePickUp' : 'forceDelivery')
429
429
  }, [forceUpdate])
430
430
 
431
+ useEffect(() => {
432
+ if (!!props.order?.error || props.order?.error?.length > 0) {
433
+ showToast(ToastType.Error,
434
+ props.order?.error?.[0] ||
435
+ props.order?.error ||
436
+ t('NETWORK_ERROR', 'Network Error'),
437
+ 5000)
438
+ }
439
+ }, [props.order?.error])
440
+
431
441
  const styles = StyleSheet.create({
432
442
  btnPickUp: {
433
443
  borderWidth: 0,
@@ -478,7 +488,7 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
478
488
  isOrderGroup={isOrderGroup}
479
489
  lastOrder={lastOrder}
480
490
  />
481
- {(order?.status === 8 || order?.status === 18) && order?.delivery_type === 1 && (
491
+ {(order?.status === 8 || order?.status === 18) && order?.delivery_type === 1 && !props.order?.loading && (
482
492
  <Pickup>
483
493
  <OButton
484
494
  style={styles.btnPickUp}
@@ -491,7 +501,7 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
491
501
  />
492
502
  </Pickup>
493
503
  )}
494
- {order?.status === 3 && order?.delivery_type === 1 && !isHideRejectButtons && isEnabledOrderNotReady && (
504
+ {order?.status === 3 && order?.delivery_type === 1 && !isHideRejectButtons && isEnabledOrderNotReady && !props.order?.loading && (
495
505
  <View style={{ paddingVertical: 20, marginBottom: 20 }}>
496
506
  <OButton
497
507
  style={styles.btnPickUp}
@@ -613,6 +623,7 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
613
623
  )}
614
624
  {showFloatButtonsAcceptOrReject[order?.status] && (
615
625
  <FloatingButton
626
+ disabled={props.order?.loading}
616
627
  btnText={t('REJECT', 'Reject')}
617
628
  isSecondaryBtn={false}
618
629
  secondButtonClick={() => hideTimer ? handleChangeOrderStatus && handleChangeOrderStatus(8) : (order?.isLogistic && (order?.order_group || logisticOrderStatus.includes(order?.status))) ? handleAcceptLogisticOrder(order) : handleViewActionOrder('accept')}
@@ -687,6 +698,7 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
687
698
  actions={actions}
688
699
  orderTitle={orderTitle}
689
700
  appTitle={appTitle}
701
+ isLoadingOrder={props.order?.loading}
690
702
  />
691
703
  </OModal>
692
704
  )}
@@ -230,7 +230,7 @@ export const OrderContentComponent = (props: OrderContent) => {
230
230
  )}
231
231
  {!!order?.business?.location && order?.customer?.location && (
232
232
  <OText>
233
- {t('DISTANCE_TO_THE_BUSINESS', 'Distance to the business')}: {transformDistance(calculateDistance(order?.business?.location, { latitude: order?.customer?.location?.lat, longitude: order?.customer?.location?.lng }), distanceUnit)} {t(distanceUnit.toUpperCase(), distanceUnit)}
233
+ {t('DISTANCE_TO_THE_BUSINESS', 'Distance to the business')}: {transformDistance(calculateDistance(order?.business?.location, { latitude: order?.customer?.location?.lat, longitude: order?.customer?.location?.lng }), distanceUnit)} {t(distanceUnit?.toUpperCase?.(), distanceUnit)}
234
234
  </OText>
235
235
  )}
236
236
  {!!order?.business?.address_notes && (
@@ -412,7 +412,7 @@ export const OrderContentComponent = (props: OrderContent) => {
412
412
  <View style={{ marginTop: 10 }}>
413
413
  {order?.delivery_option !== undefined && order?.delivery_type === 1 && (
414
414
  <OText>
415
- {t(order?.delivery_option?.name?.toUpperCase()?.replace(/ /g, '_'), order?.delivery_option?.name)}
415
+ {t(order?.delivery_option?.name?.toUpperCase?.()?.replace(/ /g, '_'), order?.delivery_option?.name)}
416
416
  </OText>
417
417
  )}
418
418
  </View>
@@ -474,7 +474,7 @@ export const OrderContentComponent = (props: OrderContent) => {
474
474
  <Table key={offer.id}>
475
475
  <OSRow>
476
476
  <OText mBottom={4}>
477
- {t(offer.name?.toUpperCase()?.replace(/ /g, '_'), offer.name)}
477
+ {t(offer.name?.toUpperCase?.()?.replace(/ /g, '_'), offer.name)}
478
478
  {offer.rate_type === 1 && (
479
479
  <OText>{`(${verifyDecimals(offer?.rate, parsePrice)}%)`}</OText>
480
480
  )}
@@ -520,7 +520,7 @@ export const OrderContentComponent = (props: OrderContent) => {
520
520
  <Table key={tax.id}>
521
521
  <OSRow>
522
522
  <OText mBottom={4}>
523
- {t(tax?.name?.toUpperCase()?.replace(/ /g, '_'), tax?.name) || t('INHERIT_FROM_BUSINESS', 'Inherit from business')}
523
+ {t(tax?.name?.toUpperCase?.()?.replace(/ /g, '_'), tax?.name) || t('INHERIT_FROM_BUSINESS', 'Inherit from business')}
524
524
  {`(${verifyDecimals(tax?.rate, parseNumber)}%)`}{' '}
525
525
  </OText>
526
526
  </OSRow>
@@ -533,7 +533,7 @@ export const OrderContentComponent = (props: OrderContent) => {
533
533
  <Table key={fee.id}>
534
534
  <OSRow>
535
535
  <OText mBottom={4}>
536
- {t(fee?.name?.toUpperCase()?.replace(/ /g, '_'), fee?.name) || t('INHERIT_FROM_BUSINESS', 'Inherit from business')}
536
+ {t(fee?.name?.toUpperCase?.()?.replace(/ /g, '_'), fee?.name) || t('INHERIT_FROM_BUSINESS', 'Inherit from business')}
537
537
  ({fee?.fixed > 0 && `${parsePrice(fee?.fixed, { currency: order?.currency })} + `}{fee.percentage}%){' '}
538
538
  </OText>
539
539
  </OSRow>
@@ -546,7 +546,7 @@ export const OrderContentComponent = (props: OrderContent) => {
546
546
  <Table key={offer.id}>
547
547
  <OSRow>
548
548
  <OText mBottom={4}>
549
- {t(offer.name?.toUpperCase()?.replace(/ /g, '_'), offer.name)}
549
+ {t(offer.name?.toUpperCase?.()?.replace(/ /g, '_'), offer.name)}
550
550
  {offer.rate_type === 1 && (
551
551
  <OText>{`(${verifyDecimals(offer?.rate, parsePrice)}%)`}</OText>
552
552
  )}
@@ -574,7 +574,7 @@ export const OrderContentComponent = (props: OrderContent) => {
574
574
  <Table key={offer.id}>
575
575
  <OSRow>
576
576
  <OText mBottom={4}>
577
- {t(offer.name?.toUpperCase()?.replace(/ /g, '_'), offer.name)}
577
+ {t(offer.name?.toUpperCase?.()?.replace(/ /g, '_'), offer.name)}
578
578
  {offer.rate_type === 1 && (
579
579
  <OText>{`(${verifyDecimals(offer?.rate, parsePrice)}%)`}</OText>
580
580
  )}
@@ -643,9 +643,9 @@ export const OrderContentComponent = (props: OrderContent) => {
643
643
  {event?.wallet_event
644
644
  ? walletName[event?.wallet_event?.wallet?.type]?.name
645
645
  : event?.paymethod?.gateway
646
- ? t(event?.paymethod?.gateway?.toUpperCase(), event?.paymethod?.name)
646
+ ? t(event?.paymethod?.gateway?.toUpperCase?.(), event?.paymethod?.name)
647
647
  : order?.paymethod?.id === event?.paymethod_id
648
- ? t(order?.paymethod?.gateway?.toUpperCase(), order?.paymethod?.name)
648
+ ? t(order?.paymethod?.gateway?.toUpperCase?.(), order?.paymethod?.name)
649
649
  : ''}
650
650
  </OText>
651
651
  </View>
@@ -597,6 +597,7 @@ export interface AcceptOrRejectOrderParams {
597
597
  isPage?: boolean
598
598
  navigation?: any
599
599
  route?: any
600
+ isLoadingOrder?: boolean
600
601
  }
601
602
 
602
603
  export interface MapViewParams {
@@ -67,7 +67,8 @@ const AddressFormUI = (props: AddressFormParams) => {
67
67
  hasAddressDefault,
68
68
  afterSignup,
69
69
  businessSlug,
70
- isFromCheckout
70
+ isFromCheckout,
71
+ onNavigationRedirect
71
72
  } = props;
72
73
 
73
74
  const theme = useTheme();
@@ -173,6 +174,8 @@ const AddressFormUI = (props: AddressFormParams) => {
173
174
  const isHideMap = theme?.address?.components?.map?.hidden
174
175
  const isHideIcons = theme?.address?.components?.icons?.hidden
175
176
  const continueAsGuest = () => navigation.navigate(!!businessSlug ? 'Business' : 'BusinessList', { isGuestUser: true });
177
+ const unaddressedTypes = configState?.configs?.unaddressed_order_types_allowed?.value.split('|').map((value: any) => Number(value)) || []
178
+ const isAllowUnaddressOrderType = unaddressedTypes.includes(orderState?.options?.type)
176
179
  const goToBack = () => navigation?.canGoBack() && navigation.goBack();
177
180
 
178
181
  const getAddressFormatted = (address: any) => {
@@ -527,6 +530,12 @@ const AddressFormUI = (props: AddressFormParams) => {
527
530
  setIsSignUpEffect(true);
528
531
  }, [orderState.loading]);
529
532
 
533
+ useEffect(() => {
534
+ if (isAllowUnaddressOrderType) {
535
+ onNavigationRedirect && onNavigationRedirect(!!businessSlug ? 'Business' : 'BusinessList')
536
+ }
537
+ }, [isAllowUnaddressOrderType])
538
+
530
539
  return (
531
540
  <ScrollView
532
541
  keyboardShouldPersistTaps='always'
@@ -542,11 +551,6 @@ const AddressFormUI = (props: AddressFormParams) => {
542
551
  style={{ marginTop: Platform.OS === 'ios' ? 0 : 10 }}
543
552
  titleWrapStyle={{ paddingHorizontal: 0, width: '100%' }}
544
553
  titleStyle={{ marginRight: 0, marginLeft: 0, paddingRight: 5 }}
545
- buttonProps={{
546
- bgColor: theme.colors.white,
547
- borderColor: theme.colors.white,
548
- textStyle: { color: theme.colors.btnFont }
549
- }}
550
554
  />
551
555
  </View>
552
556
  <TouchableWithoutFeedback onPress={Keyboard.dismiss}>
@@ -857,9 +861,6 @@ const AddressFormUI = (props: AddressFormParams) => {
857
861
  : t('LOADING', 'Loading')
858
862
  }
859
863
  onClick={handleSubmit(onSubmit)}
860
- bgColor={theme.colors.primary}
861
- borderColor={theme.colors.primary}
862
- textStyle={{ color: theme.colors.white }}
863
864
  isDisabled={formState.loading}
864
865
  style={{ borderRadius: 7.6, shadowOpacity: 0 }}
865
866
  showNextIcon
@@ -895,9 +896,6 @@ const AddressFormUI = (props: AddressFormParams) => {
895
896
  )}
896
897
  <OButton
897
898
  text={t('SAVE', 'Save')}
898
- textStyle={{ color: theme.colors.white }}
899
- bgColor={theme.colors.primary}
900
- borderColor={theme.colors.primary}
901
899
  imgRightSrc={null}
902
900
  style={{ marginHorizontal: 30, marginBottom: 10 }}
903
901
  onClick={() => setSaveMapLocation(true)}
@@ -152,11 +152,6 @@ const AddressListUI = (props: AddressListParams) => {
152
152
  showCall={false}
153
153
  paddingTop={10}
154
154
  btnStyle={{ paddingLeft: 0 }}
155
- buttonProps={{
156
- bgColor: theme.colors.white,
157
- borderColor: theme.colors.white,
158
- textStyle: { color: theme.colors.btnFont }
159
- }}
160
155
  />
161
156
  )}
162
157
  {
@@ -178,11 +173,6 @@ const AddressListUI = (props: AddressListParams) => {
178
173
  style={{ marginTop: 0 }}
179
174
  titleWrapStyle={{ paddingHorizontal: 0 }}
180
175
  titleStyle={{ marginLeft: 0, marginRight: 0 }}
181
- buttonProps={{
182
- bgColor: theme.colors.white,
183
- borderColor: theme.colors.white,
184
- textStyle: { color: theme.colors.btnFont }
185
- }}
186
176
  />
187
177
  )}
188
178
  {addressList.loading && addressList?.addresses?.length === 0 && (
@@ -305,10 +295,7 @@ const AddressListUI = (props: AddressListParams) => {
305
295
  <OButton
306
296
  text={t('ADD_NEW_ADDRESS', 'Add new Address')}
307
297
  imgRightSrc=''
308
- bgColor={theme.colors.primary}
309
- textStyle={{ color: theme.colors.white }}
310
298
  style={styles.button}
311
- borderColor={theme.colors.primary}
312
299
  onClick={() => !afterSignup ? onNavigationRedirect(
313
300
  'AddressForm',
314
301
  {
@@ -57,6 +57,8 @@ export const BusinessItemAccordion = (props: any) => {
57
57
  return acc = acc
58
58
  }, cart?.subtotal)
59
59
 
60
+ const bgStyle = (subtotalWithTaxes < cart?.minimum || !cart?.valid_address) ? theme.colors.secundary : theme.colors.primary
61
+
60
62
  useEffect(() => {
61
63
  if (isActive && !isFromUpselling) {
62
64
  if (cart?.uuid !== viewedCart?.uuid) {
@@ -156,8 +158,8 @@ export const BusinessItemAccordion = (props: any) => {
156
158
  textStyle={{ color: 'white', textAlign: 'center', flex: 1 }}
157
159
  style={{ width: 180, flexDirection: 'row', justifyContent: 'center', borderRadius: 7.6, shadowOpacity: 0 }}
158
160
  text={t('CHECKOUT', 'Checkout')}
159
- bgColor={(subtotalWithTaxes < cart?.minimum || !cart?.valid_address) ? theme.colors.secundary : theme.colors.primary}
160
- borderColor={theme.colors.primary}
161
+ bgColor={bgStyle}
162
+ borderColor={bgStyle}
161
163
  isDisabled={checkoutButtonDisabled}
162
164
  />
163
165
  )}
@@ -47,13 +47,11 @@ export const BusinessSearchHeader = (props: any) => {
47
47
  borderWidth: 0,
48
48
  width: 26,
49
49
  height: 26,
50
- backgroundColor: '#FFF',
51
- borderColor: '#FFF',
52
- shadowColor: '#FFF',
53
50
  paddingLeft: 0,
54
51
  paddingRight: 0,
55
52
  marginTop: 50,
56
53
  }}
54
+ useArrow
57
55
  onClick={() => props.navigation.goBack()}
58
56
  icon={AntDesignIcon}
59
57
  iconProps={{
@@ -230,7 +230,7 @@ export const BusinessListingSearchUI = (props: BusinessSearchParams) => {
230
230
  </BusinessInfoItem>
231
231
  <OButton
232
232
  onClick={() => onBusinessClick(business)}
233
- textStyle={{ color: theme.colors.primary, fontSize: 10 }}
233
+ textStyle={{ fontSize: 10 }}
234
234
  text={t('GO_TO_STORE', 'Go to store')}
235
235
  style={{
236
236
  borderRadius: 23,
@@ -238,7 +238,6 @@ export const BusinessListingSearchUI = (props: BusinessSearchParams) => {
238
238
  paddingRight: 10,
239
239
  height: 23,
240
240
  shadowOpacity: 0,
241
- backgroundColor: theme.colors.primaryContrast,
242
241
  borderWidth: 0
243
242
  }}
244
243
  />
@@ -11,6 +11,8 @@ import { BusinessMenuList } from '../BusinessMenuList'
11
11
  import Spinner from 'react-native-loading-spinner-overlay'
12
12
  import { BusinessPreorderParams } from '../../types'
13
13
  import moment from 'moment'
14
+ import { setLocalMoment } from '../../utils';
15
+
14
16
  import SelectDropdown from 'react-native-select-dropdown'
15
17
  import {
16
18
  PreOrderContainer,
@@ -311,6 +313,10 @@ const BusinessPreorderUI = (props: BusinessPreorderParams) => {
311
313
  }
312
314
  }, [dateSelected])
313
315
 
316
+ useEffect(() => {
317
+ setLocalMoment(moment, t)
318
+ }, [])
319
+
314
320
  useFocusEffect(
315
321
  React.useCallback(() => {
316
322
  handleAsap && handleAsap()
@@ -527,9 +533,6 @@ const BusinessPreorderUI = (props: BusinessPreorderParams) => {
527
533
  )}
528
534
  <OButton
529
535
  text={t('GO_TO_MENU', 'Go to menu')}
530
- textStyle={{ color: 'white' }}
531
- bgColor={theme.colors.primary}
532
- borderColor={theme.colors.primary}
533
536
  style={{ borderRadius: 7.6, marginBottom: 20, marginTop: 30 }}
534
537
  onClick={() => handleClickBusiness()}
535
538
  isDisabled={isAsap || !(dateSelected && timeSelected)}
@@ -555,21 +558,21 @@ export const BusinessPreorder = (props: any) => {
555
558
  currentDate.setMinutes(59)
556
559
 
557
560
  const cateringTypeString = orderState?.options?.type === 7
558
- ? 'catering_delivery'
559
- : orderState?.options?.type === 8
560
- ? 'catering_pickup'
561
- : null
561
+ ? 'catering_delivery'
562
+ : orderState?.options?.type === 8
563
+ ? 'catering_pickup'
564
+ : null
562
565
 
563
- const splitCateringValue = (configName : string) =>
564
- Object.values(props?.business?.configs || {})
565
- ?.find(config => config?.key === configName)
566
- ?.value?.split('|')
567
- ?.find(val => val.includes(cateringTypeString || ''))?.split(',')[1]
568
- const preorderSlotInterval = parseInt(splitCateringValue('preorder_slot_interval'))
569
- const preorderLeadTime = parseInt(splitCateringValue('preorder_lead_time'))
570
- const preorderTimeRange = parseInt(splitCateringValue('preorder_time_range'))
571
- const preorderMaximumDays = parseInt(splitCateringValue('preorder_maximum_days'))
572
- const preorderMinimumDays = parseInt(splitCateringValue('preorder_minimum_days'))
566
+ const splitCateringValue = (configName: string) =>
567
+ Object.values(props?.business?.configs || {})
568
+ ?.find(config => config?.key === configName)
569
+ ?.value?.split('|')
570
+ ?.find(val => val.includes(cateringTypeString || ''))?.split(',')[1]
571
+ const preorderSlotInterval = parseInt(splitCateringValue('preorder_slot_interval'))
572
+ const preorderLeadTime = parseInt(splitCateringValue('preorder_lead_time'))
573
+ const preorderTimeRange = parseInt(splitCateringValue('preorder_time_range'))
574
+ const preorderMaximumDays = parseInt(splitCateringValue('preorder_maximum_days'))
575
+ const preorderMinimumDays = parseInt(splitCateringValue('preorder_minimum_days'))
573
576
 
574
577
  const businessPreorderProps = {
575
578
  ...props,
@@ -558,9 +558,8 @@ const CartUI = (props: any) => {
558
558
  )}
559
559
  bgColor={(subtotalWithTaxes < cart?.minimum || !cart?.valid_address) ? theme.colors.secundary : theme.colors.primary}
560
560
  isDisabled={(openUpselling && !canOpenUpselling) || subtotalWithTaxes < cart?.minimum || !cart?.valid_address}
561
- borderColor={theme.colors.primary}
562
561
  imgRightSrc={null}
563
- textStyle={{ color: '#fff', textAlign: 'center', flex: 1 }}
562
+ textStyle={{ textAlign: 'center', flex: 1 }}
564
563
  onClick={() => handleClickCheckout()}
565
564
  style={{ width: '100%', flexDirection: 'row', justifyContent: 'center', borderRadius: 7.6, shadowOpacity: 0 }}
566
565
  />
@@ -175,9 +175,8 @@ export const CartContent = (props: any) => {
175
175
  text={t('CHECKOUT', 'Checkout')}
176
176
  bgColor={!cartsAvailable.length ? theme.colors.secundary : theme.colors.primary}
177
177
  isDisabled={!cartsAvailable.length}
178
- borderColor={theme.colors.primary}
178
+ borderColor={!cartsAvailable.length ? theme.colors.secundary : theme.colors.primary}
179
179
  imgRightSrc={null}
180
- textStyle={{ color: 'white', textAlign: 'center', flex: 1 }}
181
180
  onClick={() => handleCheckoutRedirect()}
182
181
  style={{ width: '100%', flexDirection: 'row', justifyContent: 'center', borderRadius: 7.6, shadowOpacity: 0 }}
183
182
  />
@@ -1,4 +1,4 @@
1
- import React, { useState, useEffect, useCallback, useRef } from 'react';
1
+ import React, { useState, useEffect, useCallback, useRef, useMemo } from 'react';
2
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'
@@ -168,6 +168,7 @@ const CheckoutUI = (props: any) => {
168
168
  const [webviewPaymethod, setWebviewPaymethod] = useState<any>(null)
169
169
  const [isOpen, setIsOpen] = useState(false)
170
170
  const [requiredFields, setRequiredFields] = useState<any>([])
171
+ const [orderTypeValidationFields, setOrderTypeValidationFields] = useState<any>([])
171
172
  const [openModal, setOpenModal] = useState({ login: false, signup: false, isGuest: false })
172
173
  const [allowedGuest, setAllowedGuest] = useState(false)
173
174
  const [placeByMethodPay, setPlaceByMethodPay] = useState(false)
@@ -180,6 +181,10 @@ const CheckoutUI = (props: any) => {
180
181
  const cardsMethods = ['credomatic']
181
182
  const stripePaymethods: any = ['stripe', 'stripe_direct', 'stripe_connect', 'stripe_redirect']
182
183
  const notFields = ['coupon', 'driver_tip', 'mobile_phone', 'address', 'zipcode', 'address_notes', 'comments']
184
+
185
+ const guestCheckoutDriveTip = checkoutFieldsState?.fields?.find(field => field.order_type_id === 1 && field?.validation_field?.code === 'driver_tip')
186
+ const guestCheckoutComment = useMemo(() => checkoutFieldsState?.fields?.find(field => field.order_type_id === options?.type && field?.validation_field?.code === 'comments'), [checkoutFieldsState, options])
187
+
183
188
  const placeSpotTypes = [3, 4, 5]
184
189
  const placeSpotsEnabled = placeSpotTypes.includes(options?.type)
185
190
  const businessConfigs = businessDetails?.business?.configs ?? []
@@ -204,7 +209,9 @@ const CheckoutUI = (props: any) => {
204
209
  return acc = acc
205
210
  }, cart?.subtotal)
206
211
 
207
- const validateCommentsCartField = validationFields?.fields?.checkout?.comments?.enabled && validationFields?.fields?.checkout?.comments?.required && (cart?.comment === null || cart?.comment?.trim().length === 0)
212
+ const validateCommentsCartField = (!user?.guest_id ? (validationFields?.fields?.checkout?.comments?.enabled && validationFields?.fields?.checkout?.comments?.required) : (guestCheckoutComment?.enabled && guestCheckoutComment?.required_with_guest)) && (cart?.comment === null || cart?.comment?.trim().length === 0)
213
+ const validateDriverTipField = options.type === 1 && (!user?.guest_id ? (validationFields?.fields?.checkout?.driver_tip?.enabled && validationFields?.fields?.checkout?.driver_tip?.required) : (guestCheckoutDriveTip?.enabled && guestCheckoutDriveTip?.required_with_guest)) && (Number(cart?.driver_tip) <= 0)
214
+
208
215
  const validateZipcodeCard = validationFields?.fields?.card?.zipcode?.enabled &&
209
216
  validationFields?.fields?.card?.zipcode?.required &&
210
217
  paymethodSelected?.data?.card &&
@@ -219,8 +226,9 @@ const CheckoutUI = (props: any) => {
219
226
  validationFields?.fields?.checkout?.driver_tip?.required &&
220
227
  (Number(cart?.driver_tip) <= 0)) ||
221
228
  (validateCommentsCartField) ||
222
- (validateZipcodeCard)
223
- || (methodsPay.includes(paymethodSelected?.gateway) && (!methodPaySupported.enabled || methodPaySupported.loading))
229
+ (validateDriverTipField && !isGiftCardCart) ||
230
+ (validateZipcodeCard) ||
231
+ (methodsPay.includes(paymethodSelected?.gateway) && (!methodPaySupported.enabled || methodPaySupported.loading))
224
232
 
225
233
  const driverTipsOptions = typeof configs?.driver_tip_options?.value === 'string'
226
234
  ? JSON.parse(configs?.driver_tip_options?.value) || []
@@ -342,22 +350,22 @@ const CheckoutUI = (props: any) => {
342
350
  const checkGuestValidationFields = () => {
343
351
  const userSelected = user
344
352
  const _requiredFields = checkoutFieldsState?.fields
345
- .filter((field: any) => (field?.order_type_id === options?.type) && field?.enabled && field?.required &&
353
+ .filter((field: any) => (field?.order_type_id === options?.type) && field?.enabled && field?.required_with_guest &&
346
354
  !notFields.includes(field?.validation_field?.code) &&
347
355
  userSelected && !userSelected[field?.validation_field?.code])
348
- .map((item: any) => item?.validation_field?.code)
356
+ const requiredFieldsCode = _requiredFields.map((item: any) => item?.validation_field?.code)
349
357
  const guestCheckoutCellPhone = checkoutFieldsState?.fields?.find((field: any) => field.order_type_id === options?.type && field?.validation_field?.code === 'mobile_phone')
350
-
351
358
  if (
352
359
  userSelected &&
353
360
  !userSelected?.cellphone &&
354
361
  ((guestCheckoutCellPhone?.enabled &&
355
- guestCheckoutCellPhone?.required) ||
362
+ guestCheckoutCellPhone?.required_with_guest) ||
356
363
  configs?.verification_phone_required?.value === '1')
357
364
  ) {
358
- _requiredFields.push('cellphone')
365
+ requiredFieldsCode.push('cellphone')
359
366
  }
360
- setRequiredFields(_requiredFields)
367
+ setRequiredFields(requiredFieldsCode)
368
+ setOrderTypeValidationFields(_requiredFields)
361
369
  }
362
370
 
363
371
  const togglePhoneUpdate = (val: boolean) => {
@@ -646,17 +654,11 @@ const CheckoutUI = (props: any) => {
646
654
  <HeaderTitle text={t('CUSTOMER_DETAILS', 'Customer details')} />
647
655
  <OButton
648
656
  text={t('SIGN_UP', 'Sign up')}
649
- textStyle={{ color: theme.colors.white }}
650
- bgColor={theme.colors.primary}
651
- borderColor={theme.colors.primary}
652
657
  style={{ borderRadius: 7.6, marginTop: 20 }}
653
658
  onClick={() => setOpenModal({ ...openModal, signup: true })}
654
659
  />
655
660
  <OButton
656
661
  text={t('LOGIN', 'Login')}
657
- textStyle={{ color: theme.colors.white }}
658
- bgColor={theme.colors.primary}
659
- borderColor={theme.colors.primary}
660
662
  style={{ borderRadius: 7.6, marginTop: 20 }}
661
663
  onClick={() => setOpenModal({ ...openModal, login: true })}
662
664
  />
@@ -1002,7 +1004,15 @@ const CheckoutUI = (props: any) => {
1002
1004
  {t('WARNING_INVALID_DRIVER_TIP', 'Driver Tip is required.')}
1003
1005
  </OText>
1004
1006
  )}
1005
-
1007
+ {validateDriverTipField && !isGiftCardCart &&
1008
+ (
1009
+ <OText
1010
+ color={theme.colors.error}
1011
+ size={12}
1012
+ >
1013
+ {t('WARNING_INVALID_DRIVER_TIP', 'Driver Tip is required.')}
1014
+ </OText>
1015
+ )}
1006
1016
  {validateCommentsCartField && (
1007
1017
  <OText
1008
1018
  color={theme.colors.error}
@@ -1051,8 +1061,10 @@ const CheckoutUI = (props: any) => {
1051
1061
  phoneUpdate={phoneUpdate}
1052
1062
  togglePhoneUpdate={togglePhoneUpdate}
1053
1063
  requiredFields={requiredFields}
1064
+ orderTypeValidationFields={orderTypeValidationFields}
1054
1065
  hideUpdateButton
1055
1066
  handlePlaceOrderAsGuest={handlePlaceOrderAsGuest}
1067
+ isGuest={!!user?.guest_id}
1056
1068
  onClose={() => {
1057
1069
  setIsOpen(false)
1058
1070
  if (paymethodClicked) {
@@ -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}
@@ -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 === ''}
@@ -44,11 +44,6 @@ export const Favorite = (props: any) => {
44
44
  paddingTop={Platform.OS === 'ios' ? 20 : 10}
45
45
  style={{ paddingVertical: 0 }}
46
46
  btnStyle={{ paddingLeft: 0 }}
47
- buttonProps={{
48
- bgColor: theme.colors.white,
49
- borderColor: theme.colors.white,
50
- textStyle: { color: theme.colors.btnFont }
51
- }}
52
47
  />
53
48
  <TabContainer>
54
49
  {tabList.map((menu, i) => (
@@ -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>