ordering-ui-react-native 0.17.70 → 0.17.72

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ordering-ui-react-native",
3
- "version": "0.17.70",
3
+ "version": "0.17.72",
4
4
  "description": "Reusable components made in react native",
5
5
  "main": "src/index.tsx",
6
6
  "author": "ordering.inc",
@@ -138,7 +138,8 @@ const AddressListUI = (props: AddressListParams) => {
138
138
  }, [])
139
139
 
140
140
  return (
141
- <Container
141
+ <Container
142
+ pt={20}
142
143
  noPadding
143
144
  refreshControl={
144
145
  <RefreshControl
@@ -153,7 +154,10 @@ const AddressListUI = (props: AddressListParams) => {
153
154
  titleAlign={'center'}
154
155
  onActionLeft={goToBack}
155
156
  showCall={false}
156
- style={{ paddingHorizontal: 40, paddingVertical: Platform.OS === 'ios' ? 0 : 20, marginTop: Platform.OS === 'ios' ? 0 : 30 }}
157
+ style={{
158
+ paddingHorizontal: 40,
159
+ marginTop: Platform.OS === 'ios' ? 0 : 10
160
+ }}
157
161
  />
158
162
  )}
159
163
  {(!addressList.loading || (isFromProductsList || isFromBusinesses || isFromProfile || isProfile)) && (
@@ -174,7 +178,7 @@ const AddressListUI = (props: AddressListParams) => {
174
178
  showCall={false}
175
179
  btnStyle={{ paddingLeft: 0 }}
176
180
  paddingTop={0}
177
- style={{ marginTop: Platform.OS === 'ios' ? 0 : 40 }}
181
+ style={{ marginTop: 0 }}
178
182
  titleWrapStyle={{ paddingHorizontal: 0 }}
179
183
  titleStyle={{ marginLeft: 0, marginRight: 0 }}
180
184
  />
@@ -30,7 +30,6 @@ import {
30
30
  WrapSearchBar,
31
31
  WrapContent,
32
32
  FiltProductsContainer,
33
- ContainerSafeAreaView,
34
33
  BackgroundGray,
35
34
  ProfessionalFilterWrapper,
36
35
  NearBusiness,
@@ -67,6 +66,7 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
67
66
  getNextProducts,
68
67
  handleUpdateProducts,
69
68
  professionalSelected,
69
+ handleUpdateProfessionals,
70
70
  handleChangeProfessionalSelected,
71
71
  onBusinessClick
72
72
  } = props
@@ -353,7 +353,7 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
353
353
  <FiltProductsContainer
354
354
  style={{
355
355
  height: Dimensions.get('window').height - filtProductsHeight,
356
- top: Platform.OS === 'ios' ? searchBarHeight + insets.top : searchBarHeight
356
+ top: Platform.OS === 'ios' ? (searchBarHeight - 10) + insets.top : searchBarHeight
357
357
  }}
358
358
  contentContainerStyle={{ flexGrow: 1 }}
359
359
  >
@@ -515,7 +515,7 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
515
515
  )}
516
516
  </IOScrollView>
517
517
  {!loading && auth && currentCart?.products?.length > 0 && categoryState.products.length !== 0 && (
518
- <View style={{ marginBottom: Platform.OS === 'ios' ? 20 : 0 }}>
518
+ <View style={{ marginBottom: 0, zIndex: 20000 }}>
519
519
  <FloatingButton
520
520
  btnText={
521
521
  openUpselling
@@ -571,6 +571,7 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
571
571
  professionalList={business?.professionals}
572
572
  professionalSelected={professionalSelected}
573
573
  handleChangeProfessional={handleChangeProfessionalSelected}
574
+ handleUpdateProfessionals={handleUpdateProfessionals}
574
575
  onSave={() => setOpenService(false)}
575
576
  onClose={() => setOpenService(false)}
576
577
  />
@@ -284,7 +284,7 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
284
284
  style={{ paddingTop: top + 20 }}>
285
285
  {!auth && (
286
286
  <TouchableOpacity onPress={() => navigation?.canGoBack() && navigation.goBack()} style={{ position: 'absolute', marginStart: 40, paddingVertical: 20 }}>
287
- <IconAntDesign name='arrowleft' size={26} />
287
+ <OIcon src={theme.images.general.arrow_left} color={theme.colors.textNormal} />
288
288
  </TouchableOpacity>
289
289
  )}
290
290
  <Search>
@@ -80,7 +80,7 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
80
80
  const isChewLayout = theme?.header?.components?.layout?.type === 'chew'
81
81
  const hideCities = theme?.business_listing_view?.components?.cities?.hidden ?? true
82
82
  const [refreshing] = useState(false);
83
- const bgHeader = orderingTheme?.theme?.business_listing_view?.components?.business_hero?.components?.image
83
+ const bgHeader = orderingTheme?.theme?.business_listing_view?.components?.business_hero?.components?.image
84
84
  const styles = StyleSheet.create({
85
85
  container: {
86
86
  marginBottom: 0,
@@ -474,7 +474,7 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
474
474
  {!auth && (
475
475
 
476
476
  <TouchableOpacity onPress={() => navigation?.canGoBack() && navigation.goBack()} style={{ position: 'absolute', marginStart: 40, paddingVertical: 20 }}>
477
- <IconAntDesign name='arrowleft' size={26} />
477
+ <OIcon src={theme.images.general.arrow_left} color={theme.colors.textNormal} />
478
478
  </TouchableOpacity>
479
479
  )}
480
480
  </HeaderWrapper>
@@ -452,7 +452,7 @@ const CheckoutUI = (props: any) => {
452
452
  <OText
453
453
  size={14}
454
454
  >
455
- {deliveryOptions.find((option: any) => option.value === deliveryOptionSelected).label}
455
+ {deliveryOptions.find((option: any) => option.value === deliveryOptionSelected)?.label}
456
456
  </OText>
457
457
  <MaterialIcons name='keyboard-arrow-down' style={styles.icon} />
458
458
  </DeliveryOptionItem>
@@ -1,6 +1,7 @@
1
1
  import React, { useState } from 'react'
2
2
  import { useLanguage, useOrder } from 'ordering-components/native'
3
3
  import { useTheme } from 'styled-components/native'
4
+ import { Platform } from 'react-native'
4
5
  import { FavoriteList } from '../FavoriteList'
5
6
  import NavBar from '../NavBar'
6
7
  import { OText } from '../shared'
@@ -34,7 +35,9 @@ export const Favorite = (props: any) => {
34
35
  }
35
36
 
36
37
  return (
37
- <Container>
38
+ <Container
39
+ pdng={Platform.OS === 'ios' ? '20px' : '30px'}
40
+ >
38
41
  <NavBar
39
42
  title={t('FAVORITE', 'Favorite')}
40
43
  titleAlign={'center'}
@@ -52,9 +55,9 @@ export const Favorite = (props: any) => {
52
55
  >
53
56
  <OText
54
57
  color={menu.key === tabSelected ? theme.colors.textNormal : theme.colors.disabled}
55
- size={14}
56
- weight={menu.key === tabSelected ? '500' : '400'}
57
- style={{ marginBottom: 12 }}
58
+ size={14}
59
+ weight={menu.key === tabSelected ? '500' : '400'}
60
+ style={{ marginBottom: 12 }}
58
61
  >
59
62
  {menu.name}
60
63
  </OText>
@@ -18,5 +18,5 @@ export const Tab = styled.TouchableOpacity`
18
18
  export const Container = styled.View`
19
19
  padding-horizontal: 40px;
20
20
  padding-bottom: 20px;
21
- padding-top: 30px;
21
+ padding-top: ${(props: any) => props.pdng};
22
22
  `
@@ -63,7 +63,7 @@ const FloatingButtonUI = (props: FloatingButtonParams) => {
63
63
  return (
64
64
  <Container
65
65
  style={{
66
- paddingBottom: Platform.OS === 'ios' ? iosBottom ?? 0 : bottom + 16
66
+ paddingBottom: Platform.OS === 'ios' ? 20 : bottom + 16
67
67
  }}>
68
68
 
69
69
  <View style={styles.infoCont}>
@@ -12,7 +12,7 @@ export const Container = styled.View`
12
12
  width: 100%;
13
13
  justify-content: space-between;
14
14
  background-color: #FFF;
15
- z-index: 9999;
15
+ z-index: 20001;
16
16
  justify-content: space-between;
17
17
  `
18
18
 
@@ -31,20 +31,20 @@ export const Help = (props: HelpParams) => {
31
31
 
32
32
  return (
33
33
  <Container
34
+ pt={10}
34
35
  noPadding
35
36
  refreshControl={
36
- <RefreshControl
37
- refreshing={refreshing}
38
- onRefresh={() => handleOnRefresh()}
39
- />
40
- }
37
+ <RefreshControl
38
+ refreshing={refreshing}
39
+ onRefresh={() => handleOnRefresh()}
40
+ />
41
+ }
41
42
  >
42
43
  <NavBar
43
44
  title={t('HELP', 'Help')}
44
45
  titleAlign={'center'}
45
46
  onActionLeft={goToBack}
46
47
  showCall={false}
47
- paddingTop={10}
48
48
  btnStyle={{ paddingLeft: 0 }}
49
49
  />
50
50
  <HelpSubItem
@@ -53,7 +53,7 @@ export const Help = (props: HelpParams) => {
53
53
  <OText size={14}>{t('HELP_WITH_ORDER', 'Help with an order')}</OText>
54
54
  </HelpSubItem>
55
55
  <HelpSubItem
56
- onPress={() => onRedirect('HelpAccountAndPayment')}
56
+ onPress={() => onRedirect('HelpAccountAndPayment')}
57
57
  >
58
58
  <OText size={14}>{t('ACCOUNT_PAYMENT_OPTIONS', 'Account and Payment Options')}</OText>
59
59
  </HelpSubItem>
@@ -1,4 +1,4 @@
1
- import React, { useRef } from 'react'
1
+ import React, { useRef, useState } from 'react'
2
2
  import Lottie from 'lottie-react-native';
3
3
  import { TouchableOpacity, Easing, ViewStyle, Animated } from 'react-native';
4
4
  import IconAntDesign from 'react-native-vector-icons/AntDesign'
@@ -13,9 +13,9 @@ interface Props {
13
13
  duration?: number,
14
14
  type: 'favorite', // animation types
15
15
  isActive: boolean,
16
- animationType?: ((value : number) => number);
16
+ animationType?: ((value: number) => number);
17
17
  useNativeDriver?: boolean,
18
- iconProps?: {color?: string, size?: number, style?: ViewStyle}
18
+ iconProps?: { color?: string, size?: number, style?: ViewStyle }
19
19
  }
20
20
 
21
21
  export const LottieAnimation = (props: Props) => {
@@ -34,30 +34,39 @@ export const LottieAnimation = (props: Props) => {
34
34
  } = props
35
35
  const theme = useTheme()
36
36
  const animationProgress = useRef(new Animated.Value(initialValue))
37
+ const [isHide, setIsHide] = useState(true)
37
38
  const favoriteArray = ['heart', 'hearto']
38
39
  const icon = type === 'favorite' ? favoriteArray : []
39
40
  const animationGif = type === 'favorite' ? theme.images?.general?.heart : ''
40
41
  const onPressLottie = () => {
41
42
  if (!disableAnimation) {
43
+ setIsHide(false)
42
44
  Animated.timing(animationProgress.current, {
43
45
  toValue,
44
46
  duration: duration || 5000,
45
47
  easing: animationType || Easing.linear,
46
48
  useNativeDriver: useNativeDriver ?? true
47
49
  }).start();
50
+ hideLottie()
48
51
  }
49
52
  onClick()
50
53
  }
51
54
 
55
+ const hideLottie = () => {
56
+ setTimeout(() => setIsHide(true), 4500)
57
+ }
58
+
52
59
  return (
53
60
  <TouchableOpacity
54
61
  onPress={onPressLottie}
55
62
  style={style}
56
63
  >
57
- <Lottie
58
- progress={animationProgress.current}
59
- source={animationGif}
60
- />
64
+ {!isHide &&
65
+ <Lottie
66
+ progress={animationProgress.current}
67
+ source={animationGif}
68
+ />
69
+ }
61
70
  <IconAntDesign
62
71
  name={isActive ? icon[0] : icon[1]}
63
72
  color={iconProps?.color || theme.colors.danger5}
@@ -253,19 +253,21 @@ const MomentOptionUI = (props: MomentOptionParams) => {
253
253
 
254
254
  return (
255
255
  <>
256
- <Container style={{ paddingLeft: 40, paddingRight: 40 }}>
257
- <View style={{ paddingBottom: 90 }}>
256
+ <Container
257
+ style={{
258
+ paddingLeft: 40,
259
+ paddingRight: 40
260
+ }}>
261
+ <View style={{ paddingBottom: 90, paddingRight: 20 }}>
258
262
  <NavBar
259
263
  onActionLeft={() => goToBack()}
260
264
  btnStyle={{ paddingLeft: 0 }}
261
- paddingTop={0}
262
265
  style={{ paddingBottom: 0 }}
263
266
  title={t('QUESTION_WHEN_ORDER', 'When do you want your order?')}
264
267
  titleAlign={'center'}
265
268
  titleStyle={{ fontSize: 20, marginRight: 0, marginLeft: 0 }}
266
269
  titleWrapStyle={{ paddingHorizontal: 0 }}
267
270
  />
268
-
269
271
  <WrapSelectOption
270
272
  onPress={() => _handleAsap()}
271
273
  disabled={orderState.loading} style={{ alignItems: 'flex-start' }}>
@@ -70,13 +70,19 @@ const NotificationsUI = (props: any) => {
70
70
  }, [notificationsList])
71
71
 
72
72
  return (
73
- <Container noPadding>
73
+ <Container
74
+ noPadding
75
+ pt={10}
76
+ >
74
77
  <NavBar
75
78
  title={t('NOTIFICATIONS', 'Notifications')}
76
79
  titleAlign={'center'}
77
80
  onActionLeft={goToBack}
78
81
  showCall={false}
79
- style={{ paddingHorizontal: 40, paddingVertical: Platform.OS === 'ios' ? 0 : 20, marginTop: Platform.OS === 'ios' ? 0 : 30 }}
82
+ style={{
83
+ paddingHorizontal: 40,
84
+ paddingVertical: 0,
85
+ }}
80
86
  />
81
87
  {showCustomerPromotions && showNotifications && (
82
88
  <>
@@ -84,16 +84,15 @@ const OrdersOptionUI = (props: OrdersOptionParams) => {
84
84
  review: orderCompleted.review && currentOrder.review,
85
85
  user_review: orderCompleted.user_review && currentOrder.user_review,
86
86
  products: [orderCompleted.products, currentOrder.products].flat()
87
- }))
87
+ })).filter((order: any) => {
88
+ const isDuplicate = uniqueOrders.includes(order?.cart_group_id)
89
+ if (!isDuplicate) {
90
+ uniqueOrders.push(order?.cart_group_id)
91
+ return true
92
+ }
93
+ return false
94
+ })
88
95
  : order)
89
- .filter((order: any) => {
90
- const isDuplicate = uniqueOrders.includes(order?.cart_group_id)
91
- if (!isDuplicate) {
92
- uniqueOrders.push(order?.cart_group_id)
93
- return true
94
- }
95
- return false
96
- })
97
96
  setOrders(orders)
98
97
  }, [JSON.stringify(_orders)])
99
98
 
@@ -297,7 +297,7 @@ export const ProductOptionsUI = (props: any) => {
297
297
  maxProductQuantity === 0 ||
298
298
  Object.keys(errors).length > 0;
299
299
 
300
-
300
+
301
301
  const ExtraOptions = ({ eID, options }: any) => (
302
302
  <>
303
303
  {options.map(({ id, name, respect_to, suboptions }: any) => (
@@ -484,7 +484,7 @@ export const ProductOptionsUI = (props: any) => {
484
484
  <SafeAreaView style={{ flex: 1 }}>
485
485
  <TopHeader>
486
486
  <TopActions onPress={() => handleGoBack()}>
487
- <IconAntDesign name='arrowleft' size={26} />
487
+ <OIcon src={theme.images.general.arrow_left} color={theme.colors.textNormal} />
488
488
  </TopActions>
489
489
  </TopHeader>
490
490
  {!error && (
@@ -68,7 +68,7 @@ export const ProductOptionSubOptionUI = (props: any) => {
68
68
 
69
69
  return (
70
70
  <View>
71
- <Container onPress={() => handleSuboptionClick()}>
71
+ <Container>
72
72
  <IconControl disabled={disabled} onPress={() => handleSuboptionClick()}>
73
73
  {((option?.min === 0 && option?.max === 1) || option?.max > 1) ? (
74
74
  state?.selected ? (
@@ -19,7 +19,7 @@ import { useTheme } from 'styled-components/native';
19
19
  import { OButton, OIcon, OModal, OText } from '../shared'
20
20
  import { Placeholder, PlaceholderLine } from 'rn-placeholder'
21
21
  import { NotFoundSource } from '../NotFoundSource'
22
- import { View, StyleSheet, ScrollView, Platform, RefreshControl } from 'react-native'
22
+ import { View, StyleSheet, ScrollView, RefreshControl } from 'react-native'
23
23
  import { PromotionParams } from '../../types'
24
24
  import { Container } from '../../layouts/Container'
25
25
 
@@ -99,6 +99,7 @@ const PromotionsUI = (props: PromotionParams) => {
99
99
  return (
100
100
  <Container
101
101
  noPadding
102
+ pt={20}
102
103
  refreshControl={
103
104
  <RefreshControl
104
105
  refreshing={refreshing}
@@ -111,7 +112,7 @@ const PromotionsUI = (props: PromotionParams) => {
111
112
  titleAlign={'center'}
112
113
  onActionLeft={() => navigation.goBack()}
113
114
  showCall={false}
114
- style={{ paddingVertical: Platform.OS === 'ios' ? 0 : 20, marginLeft: 20 }}
115
+ style={{ paddingVertical: 0, marginLeft: 20 }}
115
116
  />
116
117
  <PromotionsContainer>
117
118
  <SearchBarContainer>
@@ -111,9 +111,15 @@ const ServiceFormUI = (props: ServiceFormParams) => {
111
111
 
112
112
  const isBusyTime = (professional: any) => {
113
113
  if (professional?.busy_times?.length === 0 || !dateSelected) return false
114
- const valid = professional?.busy_times.some((item: any) => {
115
- return moment(item?.start).valueOf() <= moment(dateSelected).valueOf() &&
116
- moment(dateSelected).valueOf() <= moment(item?.end).valueOf()
114
+ const duration = product?.duration ?? 0
115
+ const busyTimes = isCartProduct
116
+ ? professional?.busy_times.filter((item: any) => !(item.start === productCart?.calendar_event?.start && item.end === productCart?.calendar_event?.end))
117
+ : [...professional?.busy_times]
118
+ const valid = busyTimes.some((item: any) => {
119
+ return (moment.utc(item?.start).local().valueOf() <= moment(dateSelected).valueOf() &&
120
+ moment(dateSelected).valueOf() <= moment.utc(item?.end).local().valueOf()) ||
121
+ (moment.utc(item?.start).local().valueOf() <= moment(dateSelected).add(duration, 'minutes').valueOf() &&
122
+ moment(dateSelected).add(duration, 'minutes').valueOf() <= moment.utc(item?.end).local().valueOf())
117
123
  })
118
124
  return valid
119
125
  }
@@ -523,7 +529,7 @@ const ServiceFormUI = (props: ServiceFormParams) => {
523
529
  ? t('SOLD_OUT', 'Sold out')
524
530
  : t('BOOK', 'Book'))}
525
531
  style={styles.buttonStyle}
526
- isDisabled={isSoldOut || maxProductQuantity <= 0 || !currentProfessional?.id || !dateSelected}
532
+ isDisabled={isSoldOut || maxProductQuantity <= 0 || !currentProfessional?.id || !dateSelected || isBusyTime(currentProfessional)}
527
533
  textStyle={{ fontSize: 14, color: theme.colors.white }}
528
534
  />
529
535
  )}
@@ -284,16 +284,18 @@ const ProfileUI = (props: ProfileParams) => {
284
284
 
285
285
  return (
286
286
  <>
287
- <NavBar
288
- title={t('ACCOUNT', 'Account')}
289
- titleAlign={'center'}
290
- onActionLeft={() => navigation.goBack()}
291
- showCall={false}
292
- style={{ paddingHorizontal: 40, paddingVertical: Platform.OS === 'ios' ? 0 : 30 }}
293
- />
294
- <KeyboardAvoidingView behavior={Platform.OS == 'ios' ? 'padding' : 'height'} enabled style={{ flex: 1, flexDirection: 'column', justifyContent: 'center' }}>
295
- <Container noPadding>
296
-
287
+ <Container
288
+ pt={15}
289
+ noPadding
290
+ >
291
+ <NavBar
292
+ title={t('ACCOUNT', 'Account')}
293
+ titleAlign={'center'}
294
+ onActionLeft={() => navigation.goBack()}
295
+ showCall={false}
296
+ style={{ paddingHorizontal: 40 }}
297
+ />
298
+ <KeyboardAvoidingView behavior={Platform.OS == 'ios' ? 'padding' : 'height'} enabled style={{ flex: 1, flexDirection: 'column', justifyContent: 'center' }}>
297
299
  <CenterView style={styles.pagePadding}>
298
300
  <View style={styles.photo}>
299
301
  {user?.photo ? (
@@ -326,8 +328,8 @@ const ProfileUI = (props: ProfileParams) => {
326
328
  setWillVerifyOtpState={setWillVerifyOtpState}
327
329
  />
328
330
  </View>
329
- </Container>
330
- </KeyboardAvoidingView>
331
+ </KeyboardAvoidingView>
332
+ </Container>
331
333
  <OModal
332
334
  open={isModalVisible}
333
335
  onClose={() => setIsModalVisible(false)}
@@ -249,6 +249,8 @@ export interface BusinessProductsListingParams {
249
249
  handleUpdateProducts?: any;
250
250
  professionalSelected?: any;
251
251
  handleChangeProfessionalSelected?: any;
252
+ handleUpdateProfessionals?: any;
253
+ onBusinessClick?: any;
252
254
  }
253
255
  export interface BusinessBasicInformationParams {
254
256
  navigation?: any;