ordering-ui-react-native 0.14.7 → 0.14.11

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.14.7",
3
+ "version": "0.14.11",
4
4
  "description": "Reusable components made in react native",
5
5
  "main": "src/index.tsx",
6
6
  "author": "ordering.inc",
@@ -22,7 +22,6 @@ export const AppleLogin = (props: AppleLoginParams) => {
22
22
  const [ordering] = useApi()
23
23
  const [, t] = useLanguage()
24
24
  const theme = useTheme()
25
- const [errors, setError] = useState<any>({type: '', message: ''})
26
25
  const buttonText = t('LOGIN_WITH_APPLE', 'Login with Apple');
27
26
 
28
27
  const onAppleButtonPress = async () => {
@@ -47,14 +46,12 @@ export const AppleLogin = (props: AppleLoginParams) => {
47
46
  } = appleAuthRequestResponse
48
47
  if (identityToken) {
49
48
  console.log('auth code: ', authorizationCode)
50
- handleLoginApple(identityToken)
51
- console.warn(`Apple Authentication Completed, ${user}, ${email}`);
49
+ handleLoginApple(authorizationCode)
52
50
  } else {
53
51
  handleErrors && handleErrors(t('ERROR_LOGIN_APPLE', 'Error login with apple'))
54
52
  }
55
53
 
56
54
  } catch (error: any) {
57
- setError({ type: 'FROM_APPLE', message: error?.message })
58
55
  handleErrors && handleErrors(error.message)
59
56
  }
60
57
  } else {
@@ -74,7 +71,7 @@ export const AppleLogin = (props: AppleLoginParams) => {
74
71
  }
75
72
  }
76
73
  }
77
- const handleLoginApple = async (code: string) => {
74
+ const handleLoginApple = async (code: string | null) => {
78
75
  let body: any
79
76
  if (Platform.OS === 'ios') {
80
77
  body = {
@@ -106,7 +103,6 @@ export const AppleLogin = (props: AppleLoginParams) => {
106
103
  handleErrors && handleErrors(result || t('ERROR_LOGIN_AUTH_APPLE', 'Error login auth with apple'))
107
104
  }
108
105
  } catch (error: any) {
109
- setError({ type: 'FROM_API', message: error?.message })
110
106
  handleLoading && handleLoading(false)
111
107
  handleErrors && handleErrors(error?.message)
112
108
  }
@@ -121,11 +117,6 @@ export const AppleLogin = (props: AppleLoginParams) => {
121
117
 
122
118
  return (
123
119
  <Container>
124
- {!!errors?.message && !!errors?.type && (
125
- <OText>
126
- {errors?.type} {errors?.message}
127
- </OText>
128
- )}
129
120
  <AppleButton
130
121
  onPress={onAppleButtonPress}
131
122
  >
@@ -34,7 +34,7 @@ const BusinessProductsListUI = (props: BusinessProductsListParams) => {
34
34
  return (
35
35
  <ProductsContainer>
36
36
  {category.id && (
37
- categoryState.products?.map((product: any) => (
37
+ categoryState.products?.sort((a: any, b: any) => a.rank - b.rank).map((product: any) => (
38
38
  <SingleProductCard
39
39
  key={product.id}
40
40
  isSoldOut={(product.inventoried && !product.quantity)}
@@ -51,7 +51,7 @@ const BusinessProductsListUI = (props: BusinessProductsListParams) => {
51
51
  <>
52
52
  <OText size={18} weight='bold' mBottom={10}>{t('FEATURED', 'Featured')}</OText>
53
53
  <>
54
- {categoryState.products?.map((product: any) => product.featured && (
54
+ {categoryState.products?.sort((a: any, b: any) => a.rank - b.rank).map((product: any) => product.featured && (
55
55
  <SingleProductCard
56
56
  key={product.id}
57
57
  isSoldOut={(product.inventoried && !product.quantity)}
@@ -77,7 +77,7 @@ const BusinessProductsListUI = (props: BusinessProductsListParams) => {
77
77
  <OText size={18} weight='bold' mBottom={10}>{category.name}</OText>
78
78
  <>
79
79
  {
80
- products.map((product: any) => (
80
+ products?.sort((a: any, b: any) => a.rank - b.rank).map((product: any) => (
81
81
  <SingleProductCard
82
82
  key={product.id}
83
83
  isSoldOut={product.inventoried && !product.quantity}
@@ -133,9 +133,8 @@ export const ProductOptionsUI = (props: any) => {
133
133
  <>
134
134
  <View style={{ flexDirection: 'column', width: '100%' }}>
135
135
  <OText size={20} style={{ flex: I18nManager.isRTL ? 0 : 1, marginBottom: 10 }}>{product?.name || productCart.name}</OText>
136
- <View style={{ flexDirection: 'row', justifyContent: 'space-between', marginBottom: 10 }}>
137
- <OText size={16} style={{ flex: I18nManager.isRTL ? 1 : 0 }} color={theme.colors.primary}>{productCart.price ? parsePrice(productCart.price) : ''}</OText>
138
- <OText size={14} style={{ flex: I18nManager.isRTL ? 1 : 0 }} color={'#909BA9'}>
136
+ {(product?.estimated_person || (product?.sku && product?.sku !== '-1' && product?.sku !== '1')) && (
137
+ <OText size={14} style={{ flex: I18nManager.isRTL ? 1 : 0, marginBottom: 10 }} color={'#909BA9'}>
139
138
  {
140
139
  ((product?.sku && product?.sku !== '-1' && product?.sku !== '1') || (productCart?.sku && productCart?.sku !== '-1' && productCart?.sku !== '1'))
141
140
  && <>{t('SKU', 'Sku')}{' '}{product?.sku || productCart?.sku}</>
@@ -147,6 +146,12 @@ export const ProductOptionsUI = (props: any) => {
147
146
  && <>{product?.estimated_person}{' '}{t('ESTIMATED_PERSONS', 'persons')}</>
148
147
  }
149
148
  </OText>
149
+ )}
150
+ <View style={{ flexDirection: 'row', marginBottom: 10}}>
151
+ <OText size={16} style={{ flex: I18nManager.isRTL ? 1 : 0 }} color={theme.colors.primary}>{productCart.price ? parsePrice(productCart.price) : ''}</OText>
152
+ {product?.offer_price && (
153
+ <OText style={styles.regularPriceStyle}>{parsePrice(product?.offer_price)}</OText>
154
+ )}
150
155
  </View>
151
156
  </View>
152
157
  </>
@@ -369,6 +374,13 @@ const styles = StyleSheet.create({
369
374
  resizeMode: 'cover',
370
375
  minHeight: 200,
371
376
  zIndex: 0
377
+ },
378
+ regularPriceStyle: {
379
+ fontSize: 14,
380
+ color: '#808080',
381
+ textDecorationLine: 'line-through',
382
+ marginLeft: 7,
383
+ marginRight: 7
372
384
  }
373
385
  })
374
386
 
@@ -4,7 +4,8 @@ import { SingleProductCardParams } from '../../types'
4
4
  import {
5
5
  CardContainer,
6
6
  CardInfo,
7
- SoldOut
7
+ SoldOut,
8
+ PricesContainer
8
9
  } from './styles'
9
10
  import { StyleSheet } from 'react-native'
10
11
  import { OText, OIcon } from '../shared'
@@ -40,6 +41,13 @@ export const SingleProductCard = (props: SingleProductCardParams) => {
40
41
  width: 75,
41
42
  height: 75,
42
43
  borderRadius: 10,
44
+ },
45
+ regularPriceStyle: {
46
+ fontSize: 12,
47
+ color: '#808080',
48
+ textDecorationLine: 'line-through',
49
+ marginLeft: 7,
50
+ marginRight: 7
43
51
  }
44
52
  })
45
53
 
@@ -76,7 +84,12 @@ export const SingleProductCard = (props: SingleProductCardParams) => {
76
84
  <CardInfo>
77
85
  <OText numberOfLines={1} ellipsizeMode='tail' style={styles.textStyle}>{product?.name}</OText>
78
86
  <OText size={12} numberOfLines={2} ellipsizeMode='tail' style={styles.textStyle}>{product?.description}</OText>
79
- <OText color={theme.colors.primary}>{parsePrice(product?.price)}</OText>
87
+ <PricesContainer>
88
+ <OText color={theme.colors.primary}>{parsePrice(product?.price)}</OText>
89
+ {product?.offer_price && (
90
+ <OText style={styles.regularPriceStyle}>{parsePrice(product?.offer_price)}</OText>
91
+ )}
92
+ </PricesContainer>
80
93
  </CardInfo>
81
94
 
82
95
  {(isSoldOut || maxProductQuantity <= 0) && (
@@ -22,3 +22,7 @@ export const SoldOut = styled.View`
22
22
  bottom: 5px;
23
23
  right: 5px;
24
24
  `
25
+ export const PricesContainer = styled.View`
26
+ flex-direction: row;
27
+ align-items: center;
28
+ `
@@ -2,7 +2,7 @@ import styled from 'styled-components/native';
2
2
 
3
3
  export const Container = styled.View`
4
4
  width: 100%;
5
- padding: 0 30px;
5
+ padding: 0 43px;
6
6
  `
7
7
 
8
8
  export const CountDownContainer = styled.View`
@@ -20,6 +20,7 @@ export const ResendSection = styled.View`
20
20
  display: flex;
21
21
  flex-direction: row;
22
22
  justify-content: center;
23
+ flex-wrap: wrap;
23
24
  `
24
25
 
25
26
  export const WrappCountdown = styled.View`
@@ -210,7 +210,7 @@ const BusinessReviewsUI = (props: BusinessReviewsParams) => {
210
210
  </View>
211
211
  </ReviewProgressView>
212
212
  <PrincipalWrapView>
213
- <OText style={{ marginBottom: 6 }}>
213
+ {/* <OText style={{ marginBottom: 6 }}>
214
214
  {t('PRINCIPAL_COMMENTS', 'Principal comments')}
215
215
  </OText>
216
216
  <PrincipalComments
@@ -220,7 +220,7 @@ const BusinessReviewsUI = (props: BusinessReviewsParams) => {
220
220
  'Too slow',
221
221
  'It isn’t worth what it costs',
222
222
  ]}
223
- />
223
+ /> */}
224
224
  </PrincipalWrapView>
225
225
 
226
226
  {reviewsList?.reviews.map((review: any) => (
@@ -224,7 +224,7 @@ export const UserFormDetailsUI = (props: any) => {
224
224
  render={() => (
225
225
  <>
226
226
  <OText size={14} lineHeight={21} color={theme.colors.textNormal} weight={'500'} style={{ textTransform: 'capitalize', alignSelf: 'flex-start' }}>
227
- {field?.code}
227
+ {t(field?.code?.toUpperCase(), field?.name)}
228
228
  </OText>
229
229
  <OInput
230
230
  name={field.code}
@@ -47,6 +47,11 @@ const ProfileUI = (props: ProfileParams) => {
47
47
  pagePadding: {
48
48
  paddingLeft: 40,
49
49
  paddingRight: 40
50
+ },
51
+ navBarStyle: {
52
+ paddingLeft: 40,
53
+ paddingRight: 40,
54
+ paddingTop: 15
50
55
  }
51
56
  });
52
57
 
@@ -216,7 +221,7 @@ const ProfileUI = (props: ProfileParams) => {
216
221
  btnStyle={{ paddingStart: 0 }}
217
222
  title={t('ACCOUNT', 'Account')}
218
223
  isVertical
219
- style={styles.pagePadding}
224
+ style={styles.navBarStyle}
220
225
  />
221
226
  <CenterView style={styles.pagePadding}>
222
227
  <View style={styles.photo}>
@@ -216,7 +216,7 @@ const BusinessReviewsUI = (props: BusinessReviewsParams) => {
216
216
  </View>
217
217
  </ReviewProgressView>
218
218
  <PrincipalWrapView>
219
- <OText style={{ marginBottom: 6 }}>
219
+ {/* <OText style={{ marginBottom: 6 }}>
220
220
  {t('PRINCIPAL_COMMENTS', 'Principal comments')}
221
221
  </OText>
222
222
  <PrincipalComments
@@ -226,7 +226,7 @@ const BusinessReviewsUI = (props: BusinessReviewsParams) => {
226
226
  'Too slow',
227
227
  'It isn’t worth what it costs',
228
228
  ]}
229
- />
229
+ /> */}
230
230
  </PrincipalWrapView>
231
231
 
232
232
  {reviewsList?.reviews.map((review: any) => (
@@ -90,8 +90,9 @@ const MessagesUI = (props: MessagesParams) => {
90
90
  console.log('ImagePicker Error: ', response.errorMessage);
91
91
  showToast(ToastType.Error, response.errorMessage);
92
92
  } else {
93
- if (response.uri) {
94
- const url = `data:${response.type};base64,${response.base64}`
93
+ if (response?.assets?.length > 0) {
94
+ const image = response?.assets[0]
95
+ const url = `data:${image.type};base64,${image.base64}`
95
96
  setImage && setImage(url);
96
97
  } else {
97
98
  showToast(ToastType.Error, t('IMAGE_NOT_FOUND', 'Image not found'));
@@ -109,7 +110,7 @@ const MessagesUI = (props: MessagesParams) => {
109
110
  const messageConsole = (message: any) => {
110
111
  return message.change?.attribute !== 'driver_id'
111
112
  ?
112
- `${t('ORDER', 'Order')} ${message.change.attribute} ${t('CHANGED_FROM', 'Changed from')} ${message.change.old !== null && t(ORDER_STATUS[parseInt(message.change.old, 10)])} ${t('TO', 'to')} ${t(ORDER_STATUS[parseInt(message.change.new, 10)])}`
113
+ `${t('ORDER', 'Order')} ${t(message.change.attribute.toUpperCase(), message.change.attribute.replace('_', ' '))} ${t('CHANGED_FROM', 'Changed from')} ${message.change.old !== null && t(ORDER_STATUS[parseInt(message.change.old, 10)])} ${t('TO', 'to')} ${t(ORDER_STATUS[parseInt(message.change.new, 10)])}`
113
114
  : message.change.new
114
115
  ?
115
116
  `${message.driver?.name} ${message.driver?.lastname !== null ? message.driver.lastname : ''} ${t('WAS_ASSIGNED_AS_DRIVER', 'Was assigned as driver')} ${message.comment ? message.comment.length : ''}`
@@ -233,11 +234,11 @@ const MessagesUI = (props: MessagesParams) => {
233
234
  <InputToolbar
234
235
  {...props}
235
236
  containerStyle={{
236
- padding: Platform.OS === 'ios' && isKeyboardShow ? 0 : 10,
237
- flexDirection: 'column-reverse'
237
+ marginBottom: Platform.OS === 'ios' && isKeyboardShow ? 0 : 10,
238
+ flexDirection: Platform.OS === 'ios' && isKeyboardShow ? 'column' : 'column-reverse'
238
239
  }}
239
240
  primaryStyle={{ alignItems: 'center', justifyContent: 'flex-start' }}
240
- renderAccessory={() => renderAccessory()}
241
+ renderAccessory={() => !isKeyboardShow && renderAccessory()}
241
242
  />
242
243
  )
243
244
 
@@ -76,18 +76,18 @@ const OBottomPopup = (props: Props) => {
76
76
  visible={open}
77
77
  onRequestClose={() => onClose()}
78
78
  >
79
- <View style={styles.container}>
80
- <TouchableWithoutFeedback
81
- style={styles.touchableOutsideStyle}
82
- onPress={() => onClose()}
83
- >
84
- <View style={styles.touchableOutsideStyle} />
85
- </TouchableWithoutFeedback>
86
- <View style={styles.bottomContainer}>
87
- <KeyboardView
88
- enabled
89
- behavior={Platform.OS === 'ios' ? 'padding' : 'height'}
79
+ <KeyboardView
80
+ enabled
81
+ behavior={Platform.OS === 'ios' ? 'padding' : 'height'}
82
+ >
83
+ <View style={styles.container}>
84
+ <TouchableWithoutFeedback
85
+ style={styles.touchableOutsideStyle}
86
+ onPress={() => onClose()}
90
87
  >
88
+ <View style={styles.touchableOutsideStyle} />
89
+ </TouchableWithoutFeedback>
90
+ <View style={styles.bottomContainer}>
91
91
  <ScrollView showsVerticalScrollIndicator={false} >
92
92
  {customHeaderShow ? (
93
93
  <View style={styles.customHeaderStyle}>
@@ -108,9 +108,9 @@ const OBottomPopup = (props: Props) => {
108
108
  )}
109
109
  {children}
110
110
  </ScrollView>
111
- </KeyboardView>
111
+ </View>
112
112
  </View>
113
- </View>
113
+ </KeyboardView>
114
114
  </Modal>
115
115
  )
116
116
  }