ordering-ui-react-native 0.21.63 → 0.21.65

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.21.63",
3
+ "version": "0.21.65",
4
4
  "description": "Reusable components made in react native",
5
5
  "main": "src/index.tsx",
6
6
  "author": "ordering.inc",
@@ -1,6 +1,7 @@
1
1
  import React, { useState, useCallback } from 'react'
2
2
 
3
3
  import { Platform, StyleSheet, View, TouchableOpacity, ScrollView } from 'react-native';
4
+ import AntDesignIcon from 'react-native-vector-icons/AntDesign'
4
5
 
5
6
  import { OButton, OText, OLink, OModal } from '../shared'
6
7
  import {
@@ -53,6 +54,7 @@ export const OrderContentComponent = (props: OrderContent) => {
53
54
  const WIDTH_SCREEN = orientationState?.dimensions?.width
54
55
 
55
56
  const [openReviewModal, setOpenReviewModal] = useState(false)
57
+ const [showCustomFields, setShowCustomFields] = useState<boolean>(false);
56
58
 
57
59
  const [isReadMore, setIsReadMore] = useState({
58
60
  customerAddress: false,
@@ -134,27 +136,36 @@ export const OrderContentComponent = (props: OrderContent) => {
134
136
 
135
137
  {order?.metafields?.length > 0 && (
136
138
  <OrderBusiness>
137
- <OText style={{ marginBottom: 5 }} size={16} weight="600">
138
- {t('CUSTOM_FIELDS', 'Custom fields')}
139
- </OText>
140
-
141
- {order.metafields.map((field: any) => (
142
- <View
143
- key={field.id}
144
- style={{
145
- width: '100%',
146
- flexDirection: 'row',
147
- marginBottom: 5
148
- }}
149
- >
150
- <OText style={{ width: '50%' }}>
151
- {field.key}
152
- </OText>
153
- <OText style={{ width: '45%', textAlign: 'right' }}>
154
- {field.value}
155
- </OText>
156
- </View>
157
- ))}
139
+ <TouchableOpacity onPress={() => setShowCustomFields((prev: boolean) => !prev)} style={{ flexDirection: 'row', width: '100%', justifyContent: 'space-between', alignItems: 'flex-start' }}>
140
+ <OText style={{ marginBottom: 5 }} size={16} weight="600">
141
+ {t('CUSTOM_FIELDS', 'Custom fields')}
142
+ </OText>
143
+ <AntDesignIcon
144
+ name={showCustomFields ? 'up' : 'down'}
145
+ size={14}
146
+ />
147
+ </TouchableOpacity>
148
+ {showCustomFields && (
149
+ <>
150
+ {order.metafields.map((field: any) => (
151
+ <View
152
+ key={field.id}
153
+ style={{
154
+ width: '100%',
155
+ flexDirection: 'row',
156
+ marginBottom: 5
157
+ }}
158
+ >
159
+ <OText style={{ width: '50%' }}>
160
+ {field.key}
161
+ </OText>
162
+ <OText style={{ width: '45%', textAlign: 'right' }}>
163
+ {field.value}
164
+ </OText>
165
+ </View>
166
+ ))}
167
+ </>
168
+ )}
158
169
  </OrderBusiness>
159
170
  )}
160
171
 
@@ -39,7 +39,6 @@ import { NotFoundSource } from '../NotFoundSource';
39
39
  import AntDesignIcon from 'react-native-vector-icons/AntDesign'
40
40
  const ProfileUI = (props: ProfileParams) => {
41
41
  const {
42
- navigation,
43
42
  formState,
44
43
  isEdit,
45
44
  validationFields,
@@ -48,9 +47,7 @@ const ProfileUI = (props: ProfileParams) => {
48
47
  cleanFormState,
49
48
  handleToggleAvalaibleStatusDriver,
50
49
  userState,
51
- isAvailableLoading,
52
- isAlsea,
53
- isHideDriverStatus
50
+ isAlsea
54
51
  } = props;
55
52
 
56
53
  const [{ user }] = useSession();
@@ -60,6 +57,8 @@ const ProfileUI = (props: ProfileParams) => {
60
57
  const { errors } = useForm();
61
58
  const theme = useTheme();
62
59
 
60
+ const isShowDriverStatus = user?.level === 4 && (props.isShowDriverStatus || (!props.isShowDriverStatus && !userState?.result?.result?.available))
61
+
63
62
  const [phoneInputData, setPhoneInputData] = useState({
64
63
  error: '',
65
64
  phone: {
@@ -116,7 +115,8 @@ const ProfileUI = (props: ProfileParams) => {
116
115
  maxWidth: 200,
117
116
  includeBase64: true,
118
117
  },
119
- (response: any) => {
118
+ (image: any) => {
119
+ const response = image?.assets[0];
120
120
  if (response.didCancel) {
121
121
  console.log('User cancelled image picker');
122
122
  } else if (response.errorMessage) {
@@ -346,7 +346,7 @@ const ProfileUI = (props: ProfileParams) => {
346
346
  />
347
347
  </CenterView>
348
348
 
349
- {user?.level === 4 && !isHideDriverStatus && (
349
+ {isShowDriverStatus && (
350
350
  <EnabledStatusDriver>
351
351
  <View style={{ flex: 1 }}>
352
352
  <OText
@@ -374,7 +374,7 @@ const ProfileUI = (props: ProfileParams) => {
374
374
  !userState?.result?.result?.available,
375
375
  )
376
376
  }
377
- disabled={userState?.loading}
377
+ disabled={userState?.loading || userState?.result?.result?.available}
378
378
  animationSpeed={200}
379
379
  />
380
380
  )}
@@ -57,7 +57,7 @@ export interface ProfileParams {
57
57
  showField?: any;
58
58
  isRequiredField?: any;
59
59
  isAlsea?: boolean;
60
- isHideDriverStatus?: boolean;
60
+ isShowDriverStatus?: boolean;
61
61
  }
62
62
 
63
63
  export interface AddressListParams {
@@ -76,7 +76,7 @@ export const BusinessControllerUI = (props: BusinessControllerParams) => {
76
76
  const hideBusinessFavoriteBadge = theme?.business_listing_view?.components?.business?.components?.featured_badge?.hidden
77
77
 
78
78
  const textSize = 12
79
- const cardHeight = windowHeight * 0.3
79
+ const cardHeight = windowHeight * 0.34
80
80
 
81
81
  const styles = StyleSheet.create({
82
82
  container: {
@@ -256,7 +256,7 @@ export const BusinessControllerUI = (props: BusinessControllerParams) => {
256
256
  </BusinessState>
257
257
  </BusinessHero>
258
258
  <BusinessContent>
259
- <BusinessInfo style={{ position: 'absolute', bottom: 85, left: 15 }}>
259
+ <BusinessInfo style={{ position: 'absolute', top: -26, left: 15 }}>
260
260
  {!hideBusinessLogo && (
261
261
  <BusinessLogo style={styles.businessLogo}>
262
262
  <FastImage
@@ -8,13 +8,14 @@ export const BusinessHero = styled.View`
8
8
  `
9
9
 
10
10
  export const BusinessContent = styled.View`
11
- padding-horizontal: 18px;
12
- padding-bottom: 10px;
13
- border-bottom-left-radius: 7.6px;
14
- border-bottom-right-radius: 7.6px;
15
- border-width: 1px;
16
- border-color: ${(props: any) => props.theme.colors.border};
17
- overflow: visible;
11
+ position: relative;
12
+ padding-horizontal: 18px;
13
+ padding-bottom: 10px;
14
+ border-bottom-left-radius: 7.6px;
15
+ border-bottom-right-radius: 7.6px;
16
+ border-width: 1px;
17
+ border-color: ${(props: any) => props.theme.colors.border};
18
+ overflow: visible;
18
19
  `;
19
20
 
20
21
  export const BusinessInfo = styled.View`
@@ -196,6 +196,14 @@ const CartUI = (props: any) => {
196
196
  return acc = acc
197
197
  }, cart?.subtotal)
198
198
 
199
+ const handleClickCheckout = () => {
200
+ if (cart?.business_id) {
201
+ setOpenUpselling(true)
202
+ } else {
203
+ handleUpsellingPage(cart)
204
+ }
205
+ }
206
+
199
207
  useEffect(() => {
200
208
  const limitDays = parseInt(preorderMaximumDays ?? configs?.max_days_preorder?.value, 10)
201
209
  const currentDate = new Date()
@@ -232,7 +240,7 @@ const CartUI = (props: any) => {
232
240
  handleCartOpen={handleCartOpen}
233
241
  onNavigationRedirect={props.onNavigationRedirect}
234
242
  handleChangeStore={() => setOpenChangeStore(true)}
235
- handleClickCheckout={() => setOpenUpselling(true)}
243
+ handleClickCheckout={() => handleClickCheckout()}
236
244
  checkoutButtonDisabled={(openUpselling && !canOpenUpselling) || subtotalWithTaxes < cart?.minimum || !cart?.valid_address}
237
245
  isMultiCheckout={isMultiCheckout}
238
246
  isFromUpselling={isFromUpselling}
@@ -549,7 +557,7 @@ const CartUI = (props: any) => {
549
557
  borderColor={theme.colors.primary}
550
558
  imgRightSrc={null}
551
559
  textStyle={{ color: '#fff', textAlign: 'center', flex: 1 }}
552
- onClick={() => setOpenUpselling(true)}
560
+ onClick={() => handleClickCheckout()}
553
561
  style={{ width: '100%', flexDirection: 'row', justifyContent: 'center', borderRadius: 7.6, shadowOpacity: 0 }}
554
562
  />
555
563
  </CheckoutAction>
@@ -56,7 +56,7 @@ const HighestRatedBusinessesUI = (props: HighestRatedBusinessesParams) => {
56
56
  showsHorizontalScrollIndicator={false}
57
57
  nestedScrollEnabled
58
58
  horizontal
59
- style={{ height: 300, paddingHorizontal: 20 }}
59
+ style={{ height: 325, paddingHorizontal: 20 }}
60
60
  >
61
61
  {[
62
62
  ...Array(10).keys()
@@ -40,19 +40,19 @@ export const Otp = (props: otpParams) => {
40
40
  onSubmit()
41
41
  }
42
42
 
43
- const handleChangeCode = (code : string) => {
43
+ const handleChangeCode = (code: string) => {
44
44
  if (code?.length === pinCount) {
45
- setCheckingCode(true)
45
+ setCheckingCode && setCheckingCode(true)
46
46
  handleLoginOtp(code)
47
47
  inputRef.current?.reset && inputRef.current.reset()
48
48
  setTimeout(() => inputRef.current?.focus && inputRef.current.focus(), 100)
49
49
  }
50
- setOtpError(null)
50
+ setOtpError && setOtpError(null)
51
51
  }
52
52
 
53
53
  const handleCloseOtp = () => {
54
54
  setWillVerifyOtpState(false)
55
- setOtpError(null)
55
+ setOtpError && setOtpError(null)
56
56
  }
57
57
 
58
58
  useEffect(() => {
@@ -108,18 +108,6 @@ export const Otp = (props: otpParams) => {
108
108
  return (
109
109
  <SafeAreaView style={{ flex: 1, backgroundColor: theme.colors.backgroundPage }}>
110
110
  <OTPContainer>
111
- <View
112
- style={loginStyle.closeContainer}>
113
- <TouchableOpacity onPress={() => handleCloseOtp()} style={loginStyle.wrapperIcon}>
114
- <OIcon
115
- src={theme.images.general.close}
116
- width={22}
117
- />
118
- </TouchableOpacity>
119
- <OText size={22}>
120
- {t('ENTER_VERIFICATION_CODE', 'Enter verification code')}
121
- </OText>
122
- </View>
123
111
  <OText size={24}>
124
112
  {formatSeconds(otpLeftTime)}
125
113
  </OText>