ordering-ui-react-native 0.14.50 → 0.14.51

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.50",
3
+ "version": "0.14.51",
4
4
  "description": "Reusable components made in react native",
5
5
  "main": "src/index.tsx",
6
6
  "author": "ordering.inc",
@@ -453,7 +453,7 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
453
453
  {order?.offer_type === 1 ? (
454
454
  <OText>
455
455
  {t('DISCOUNT', theme?.defaultLanguages?.DISCOUNT || 'Discount')}{' '}
456
- <span>{`(${verifyDecimals(order?.offer_rate, parsePrice)}%)`}</span>
456
+ <OText>{`(${verifyDecimals(order?.offer_rate, parsePrice)}%)`}</OText>
457
457
  </OText>
458
458
  ) : (
459
459
  <OText>{t('DISCOUNT', theme?.defaultLanguages?.DISCOUNT || 'Discount')}</OText>
@@ -24,7 +24,7 @@ const CustomerName = (props: Props): React.ReactElement => {
24
24
  const [orientationState] = useDeviceOrientation();
25
25
 
26
26
  const onSubmit = (values: any) => {
27
- _setStoreData('customer_name', {customerName: values.name});
27
+ _setStoreData('customer_name', { customerName: values.name });
28
28
  onProceedToPay()
29
29
  };
30
30
 
@@ -52,27 +52,31 @@ const CustomerName = (props: Props): React.ReactElement => {
52
52
 
53
53
  const goToBack = () => navigation?.goBack();
54
54
 
55
- const submitButton = (<OButton
56
- text={t('PROCEED_TO_PAY', 'Proceed to Pay')}
57
- onClick={handleSubmit(onSubmit)}
58
- textStyle={{color: theme.colors.primaryContrast, fontSize: 20}}
59
- parentStyle={{
60
- height: orientationState?.orientation === PORTRAIT
61
- ? 50 : 100
62
- }}
63
- style={{
64
- width: orientationState?.orientation === PORTRAIT
65
- ? orientationState?.dimensions.width - 40
66
- : orientationState?.dimensions.width * 0.5,
67
- }}
68
- />);
55
+ const submitButton = (
56
+ <View style={{ flex: 1, alignItems: 'center' }}>
57
+ <OButton
58
+ text={t('PROCEED_TO_PAY', 'Proceed to Pay')}
59
+ onClick={handleSubmit(onSubmit)}
60
+ textStyle={{ color: theme.colors.primaryContrast, fontSize: 20 }}
61
+ parentStyle={{
62
+ height: orientationState?.orientation === PORTRAIT
63
+ ? 50 : 100
64
+ }}
65
+ style={{
66
+ width: orientationState?.orientation === PORTRAIT
67
+ ? orientationState?.dimensions.width * 0.5
68
+ : orientationState?.dimensions.width * 0.5
69
+ }}
70
+ />
71
+ </View>
72
+ );
69
73
 
70
- const skipButton = (
71
- <View style={{flex:1, left: orientationState?.dimensions.width * 0.2,}}>
74
+ const skipButton = (
75
+ <View style={{ flex: 1, alignItems: 'center' }}>
72
76
  <OButton
73
77
  text={t('SKIP', 'Skip')}
74
78
  onClick={onProceedToPay}
75
- textStyle={{color: theme.colors.primary, fontSize: 20}}
79
+ textStyle={{ color: theme.colors.primary, fontSize: 20 }}
76
80
  parentStyle={{
77
81
  height: orientationState?.orientation === PORTRAIT
78
82
  ? 50 : 100
@@ -80,7 +84,7 @@ const CustomerName = (props: Props): React.ReactElement => {
80
84
  style={{
81
85
  backgroundColor: theme.colors.white,
82
86
  width: orientationState?.orientation === PORTRAIT
83
- ? orientationState?.dimensions.width - 40
87
+ ? orientationState?.dimensions.width * 0.2
84
88
  : orientationState?.dimensions.width * 0.1,
85
89
  }}
86
90
  />
@@ -89,78 +93,78 @@ const CustomerName = (props: Props): React.ReactElement => {
89
93
 
90
94
  return (
91
95
  <>
92
- <Container>
93
- <NavBar
94
- title={t('YOUR_NAME', 'Your name')}
95
- onActionLeft={goToBack}
96
- btnStyle={{paddingLeft: 0}}
97
- />
98
- <View style={{
99
- marginVertical: orientationState?.dimensions?.height * 0.08,
100
- paddingLeft: orientationState?.dimensions?.width * 0.25
101
- }}>
102
- <OText
103
- size={orientationState?.dimensions?.width * 0.05}
104
- style={{bottom: 20}}
105
- >
106
- {t('WHATS_YOUR_NAME', "What's your name?")}
107
- {/* <OText
96
+ <Container>
97
+ <NavBar
98
+ title={t('YOUR_NAME', 'Your name')}
99
+ onActionLeft={goToBack}
100
+ btnStyle={{ paddingLeft: 0 }}
101
+ />
102
+ <View style={{
103
+ marginVertical: orientationState?.dimensions?.height * 0.08,
104
+ alignItems: 'center'
105
+ }}>
106
+ <OText
107
+ size={orientationState?.dimensions?.width * 0.05}
108
+ style={{ bottom: 20 }}
109
+ >
110
+ {t('WHATS_YOUR_NAME', "What's your name?")}
111
+ {/* <OText
108
112
  size={orientationState?.dimensions?.width * 0.05}
109
113
  weight={'700'}
110
114
  >
111
115
  {`${t('ORDER_BE_FOR', 'order be for?')}`}
112
116
  </OText> */}
113
- </OText>
114
- <Controller
115
- control={control}
116
- render={({ onChange, value }: any) => (
117
- <OInput
118
- placeholder={t('WRITE_YOUR_NAME', 'Write your name')}
119
- style={{
120
- ...styles.inputStyle,
121
- width: orientationState?.orientation === PORTRAIT
122
- ? orientationState?.dimensions.width - 40
123
- : orientationState?.dimensions.width * 0.5,
124
- }}
125
- value={value}
126
- autoCapitalize="words"
127
- autoCorrect={false}
128
- onChange={(val: any) => onChange(val)}
129
- onSubmitEditing={handleSubmit(onSubmit)}
130
- />
131
- )}
132
- name="name"
133
- rules={{
134
- required: t(
135
- 'VALIDATION_ERROR_REQUIRED',
136
- 'The field Customer Name is required',
137
- ).replace('_attribute_', t('REQUEST_COLLECTION_CUSTOMER_NAME', 'Customer Name')),
138
- pattern: {
139
- value: /^[a-zA-Z áéíóúüñçÁÉÍÓÚÜÑÇ]+$/i,
140
- message: t(
141
- 'INVALID_ERROR',
142
- 'Invalid name',
143
- ).replace('_attribute_', t('NAME', 'Name')),
144
- }
117
+ </OText>
118
+ <Controller
119
+ control={control}
120
+ render={({ onChange, value }: any) => (
121
+ <OInput
122
+ placeholder={t('WRITE_YOUR_NAME', 'Write your name')}
123
+ style={{
124
+ ...styles.inputStyle,
125
+ width: orientationState?.orientation === PORTRAIT
126
+ ? orientationState?.dimensions.width * 0.5
127
+ : orientationState?.dimensions.width * 0.5,
145
128
  }}
146
- defaultValue=""
129
+ value={value}
130
+ autoCapitalize="words"
131
+ autoCorrect={false}
132
+ onChange={(val: any) => onChange(val)}
133
+ onSubmitEditing={handleSubmit(onSubmit)}
147
134
  />
135
+ )}
136
+ name="name"
137
+ rules={{
138
+ required: t(
139
+ 'VALIDATION_ERROR_REQUIRED',
140
+ 'The field Customer Name is required',
141
+ ).replace('_attribute_', t('REQUEST_COLLECTION_CUSTOMER_NAME', 'Customer Name')),
142
+ pattern: {
143
+ value: /^[a-zA-Z áéíóúüñçÁÉÍÓÚÜÑÇ]+$/i,
144
+ message: t(
145
+ 'INVALID_ERROR',
146
+ 'Invalid name',
147
+ ).replace('_attribute_', t('NAME', 'Name')),
148
+ }
149
+ }}
150
+ defaultValue=""
151
+ />
148
152
 
149
- {orientationState?.orientation === LANDSCAPE && submitButton}
150
- {orientationState?.orientation === LANDSCAPE && skipButton}
151
- {(orientationState?.orientation === PORTRAIT) && (
152
- <OSActions>
153
- {submitButton}
154
- </OSActions>
155
- )}
156
- {(orientationState?.orientation === PORTRAIT) && (
157
- <OSActions>
158
- {skipButton}
159
- </OSActions>
160
- )}
161
- </View>
162
- </Container>
163
- </>
153
+ {orientationState?.orientation === LANDSCAPE && submitButton}
154
+ {orientationState?.orientation === LANDSCAPE && skipButton}
155
+ {(orientationState?.orientation === PORTRAIT) && (
156
+ <OSActions>
157
+ {submitButton}
158
+ </OSActions>
159
+ )}
160
+ {(orientationState?.orientation === PORTRAIT) && (
161
+ <OSActions>
162
+ {skipButton}
163
+ </OSActions>
164
+ )}
165
+ </View>
166
+ </Container>
167
+ </>
164
168
  );
165
169
  };
166
170
 
@@ -65,7 +65,7 @@ const Intro = (props: any): React.ReactElement => {
65
65
  />
66
66
 
67
67
  <OButton
68
- text={t('TOUCH_TO_ORDER', 'Touch to order')}
68
+ text={t('TOUCH_ANYWHERE_TO_ORDER', 'Touch anywhere to order')}
69
69
  parentStyle={{
70
70
  alignItems: 'center',
71
71
  width: orientationState?.dimensions?.width - _offset
@@ -5,7 +5,6 @@ import { ImageStyle, TextStyle, View, Platform } from 'react-native'
5
5
  import { OrderTypeSelector } from '../OrderTypeSelector'
6
6
  import { useConfig, useLanguage } from 'ordering-components/native'
7
7
  import { useTheme } from 'styled-components/native'
8
-
9
8
  const Wrapper = styled.View`
10
9
  background-color: ${(props: any) => props.theme.colors.white};
11
10
  padding: 10px 0px 20px 0px;
@@ -65,27 +64,28 @@ const NavBar = (props: Props) => {
65
64
 
66
65
  return (
67
66
  <Wrapper style={{ paddingTop: props.paddingTop, ...props.style }}>
68
- {(props?.onActionLeft || props?.leftImg) && (
67
+ {(props?.onActionLeft) && (
69
68
  <OButton
70
- imgLeftSrc={props.leftImg || theme.images.general.arrow_left}
69
+ imgLeftSrc={props.leftImg}
71
70
  imgRightSrc={null}
72
71
  style={{ ...btnBackArrow, ...props.btnStyle }}
73
72
  onClick={props.onActionLeft}
74
- imgLeftStyle= {props.imgLeftStyle}
73
+ imgLeftStyle={props.imgLeftStyle}
74
+ {...(!props.leftImg && { iconProps: { name: 'arrowleft', size: 28, color: props.btnStyle?.color } })}
75
75
  />)
76
76
  }
77
77
  <TitleTopWrapper>
78
78
  {props.withIcon
79
79
  ? (
80
- <OIcon
81
- url={props.icon}
82
- style={{
83
- borderColor: theme.colors.lightGray,
84
- borderRadius: 20,
85
- }}
86
- width={60}
87
- height={60}
88
- />
80
+ <OIcon
81
+ url={props.icon}
82
+ style={{
83
+ borderColor: theme.colors.lightGray,
84
+ borderRadius: 20,
85
+ }}
86
+ width={60}
87
+ height={60}
88
+ />
89
89
  )
90
90
  : null
91
91
  }
@@ -125,7 +125,7 @@ const NavBar = (props: Props) => {
125
125
  </View>
126
126
  )}
127
127
 
128
- { props.rightComponent }
128
+ {props.rightComponent}
129
129
  </Wrapper>
130
130
  )
131
131
  }
@@ -69,7 +69,7 @@ export const ProductOptionsUI = (props: any) => {
69
69
 
70
70
  const { product, loading, error } = productObject;
71
71
 
72
- const HEADER_EXPANDED_HEIGHT = Platform.OS === 'ios' ? orientationState?.dimensions?.height * 0.65 : orientationState?.dimensions?.height * 0.4;
72
+ const HEADER_EXPANDED_HEIGHT = Platform.OS === 'ios' ? orientationState?.dimensions?.height * 0.65 : orientationState?.dimensions?.height * 0.4;
73
73
  const HEADER_COLLAPSED_HEIGHT = orientationState?.dimensions?.height * 0.2;
74
74
 
75
75
  const isError = (id: number) => {
@@ -100,35 +100,35 @@ export const ProductOptionsUI = (props: any) => {
100
100
  const saveErrors = orderState.loading || maxProductQuantity === 0 || Object.keys(errors)?.length > 0
101
101
 
102
102
  const [scrollY] = useState(new Animated.Value(0));
103
-
103
+
104
104
  const headerHeight = scrollY.interpolate({
105
- inputRange: [0, HEADER_EXPANDED_HEIGHT-HEADER_COLLAPSED_HEIGHT],
105
+ inputRange: [0, HEADER_EXPANDED_HEIGHT - HEADER_COLLAPSED_HEIGHT],
106
106
  outputRange: [HEADER_EXPANDED_HEIGHT, HEADER_COLLAPSED_HEIGHT],
107
107
  extrapolate: 'clamp'
108
108
  });
109
109
  const heroContainerOpacity = scrollY.interpolate({
110
- inputRange: [0, HEADER_EXPANDED_HEIGHT-HEADER_COLLAPSED_HEIGHT],
110
+ inputRange: [0, HEADER_EXPANDED_HEIGHT - HEADER_COLLAPSED_HEIGHT],
111
111
  outputRange: [1, 0],
112
112
  extrapolate: 'clamp'
113
113
  });
114
114
  const heroTranslateY = scrollY.interpolate({
115
- inputRange: [0, HEADER_EXPANDED_HEIGHT-HEADER_COLLAPSED_HEIGHT],
116
- outputRange: [0, -(HEADER_EXPANDED_HEIGHT-HEADER_COLLAPSED_HEIGHT)],
115
+ inputRange: [0, HEADER_EXPANDED_HEIGHT - HEADER_COLLAPSED_HEIGHT],
116
+ outputRange: [0, -(HEADER_EXPANDED_HEIGHT - HEADER_COLLAPSED_HEIGHT)],
117
117
  extrapolate: 'clamp'
118
118
  });
119
119
  const navBar1ContainerOpacity = scrollY.interpolate({
120
- inputRange: [0, HEADER_EXPANDED_HEIGHT-HEADER_COLLAPSED_HEIGHT],
120
+ inputRange: [0, HEADER_EXPANDED_HEIGHT - HEADER_COLLAPSED_HEIGHT],
121
121
  outputRange: [1, 0],
122
122
  extrapolate: 'clamp'
123
123
  });
124
124
  const navBar2ContainerOpacity = scrollY.interpolate({
125
- inputRange: [0, HEADER_EXPANDED_HEIGHT-HEADER_COLLAPSED_HEIGHT],
125
+ inputRange: [0, HEADER_EXPANDED_HEIGHT - HEADER_COLLAPSED_HEIGHT],
126
126
  outputRange: [0, 1],
127
127
  extrapolate: 'clamp'
128
128
  });
129
129
 
130
130
  const collapsedBarContainerOpacity = scrollY.interpolate({
131
- inputRange: [HEADER_EXPANDED_HEIGHT-HEADER_COLLAPSED_HEIGHT - ((HEADER_EXPANDED_HEIGHT-HEADER_COLLAPSED_HEIGHT) * 0.08), HEADER_EXPANDED_HEIGHT-HEADER_COLLAPSED_HEIGHT],
131
+ inputRange: [HEADER_EXPANDED_HEIGHT - HEADER_COLLAPSED_HEIGHT - ((HEADER_EXPANDED_HEIGHT - HEADER_COLLAPSED_HEIGHT) * 0.08), HEADER_EXPANDED_HEIGHT - HEADER_COLLAPSED_HEIGHT],
132
132
  outputRange: [0, 1],
133
133
  extrapolate: 'clamp'
134
134
  });
@@ -223,7 +223,7 @@ export const ProductOptionsUI = (props: any) => {
223
223
  shadow: {
224
224
  shadowColor: '#000',
225
225
  shadowOffset: { width: 1, height: 1 },
226
- shadowOpacity: 0.4,
226
+ shadowOpacity: 0.4,
227
227
  shadowRadius: 3,
228
228
  elevation: 5,
229
229
  }
@@ -235,33 +235,31 @@ export const ProductOptionsUI = (props: any) => {
235
235
  style={styles.mainContainer}
236
236
  contentContainerStyle={styles.scrollContainer}
237
237
  onScroll={Animated.event(
238
- [{ nativeEvent: { contentOffset: { y: scrollY }} }],
239
- {useNativeDriver: false})
238
+ [{ nativeEvent: { contentOffset: { y: scrollY } } }],
239
+ { useNativeDriver: false })
240
240
  }
241
241
  scrollEventThrottle={16}
242
242
  >
243
243
  <Animated.View style={[styles.header, { height: headerHeight }]}>
244
244
  {!isDrawer && (<Animated.View style={{ opacity: navBar1ContainerOpacity }}>
245
- <NavBar
246
- {...navBarProps}
247
- titleColor={theme.colors.white}
248
- {...((navigation || onClose) && { leftImg: theme.images.general.arrow_left_white })}
249
- btnStyle={{
250
- width: 55,
251
- height: 55,
252
- backgroundColor: 'black',
253
- borderRadius: 100,
254
- opacity: 0.8,
255
- left: 20,
256
- }}
257
- imgLeftStyle={{ width: 27, height: 27 }}
258
- />
259
- </Animated.View>
245
+ <NavBar
246
+ {...navBarProps}
247
+ titleColor={theme.colors.white}
248
+ btnStyle={{
249
+ width: 66,
250
+ height: 66,
251
+ backgroundColor: 'black',
252
+ borderRadius: 100,
253
+ color: 'white',
254
+ opacity: 0.8,
255
+ left: 20,
256
+ }}
257
+ />
258
+ </Animated.View>
260
259
  )}
261
260
  <Animated.View style={{ opacity: navBar2ContainerOpacity, position: 'absolute' }}>
262
261
  <NavBar
263
262
  {...navBarProps}
264
- {...((navigation || onClose) && { leftImg: theme.images.general.arrow_left })}
265
263
  btnStyle={{
266
264
  width: 55,
267
265
  height: 55,
@@ -269,7 +267,6 @@ export const ProductOptionsUI = (props: any) => {
269
267
  borderRadius: 100,
270
268
  left: 20,
271
269
  }}
272
- imgLeftStyle={{ width: 27, height: 27 }}
273
270
  />
274
271
  </Animated.View>
275
272
 
@@ -288,7 +285,7 @@ export const ProductOptionsUI = (props: any) => {
288
285
  }}
289
286
  >
290
287
  <OImage
291
- source={{uri: product?.images}}
288
+ source={{ uri: product?.images }}
292
289
  width={70}
293
290
  height={70}
294
291
  resizeMode="cover"
@@ -319,7 +316,7 @@ export const ProductOptionsUI = (props: any) => {
319
316
  opacity: heroContainerOpacity,
320
317
  position: 'absolute',
321
318
  zIndex: -100,
322
- transform: [{translateY: heroTranslateY }],
319
+ transform: [{ translateY: heroTranslateY }],
323
320
  }}>
324
321
  <View
325
322
  style={{
@@ -330,13 +327,13 @@ export const ProductOptionsUI = (props: any) => {
330
327
  backgroundColor: 'rgba(24, 28, 50, 0.4)',
331
328
  }}
332
329
  >
333
- <ImageBackground source={{ uri: product?.images }} resizeMode='cover' style={{ flex:1, justifyContent: 'center' }} />
330
+ <ImageBackground source={{ uri: product?.images }} resizeMode='cover' style={{ flex: 1, justifyContent: 'center' }} />
334
331
 
335
332
  </View>
336
333
 
337
334
  <Animated.View
338
335
  style={{
339
- transform: [{translateY: heroTranslateY }],
336
+ transform: [{ translateY: heroTranslateY }],
340
337
  width: orientationState?.dimensions?.width * 0.75,
341
338
  height: HEADER_EXPANDED_HEIGHT / 2,
342
339
  position: 'relative',
@@ -347,7 +344,7 @@ export const ProductOptionsUI = (props: any) => {
347
344
  >
348
345
  <OText
349
346
  color={theme.colors.white}
350
- size={orientationState?.dimensions?.width * 0.048}
347
+ size={orientationState?.dimensions?.width * 0.038}
351
348
  weight="bold"
352
349
  mBottom={10}
353
350
  numberOfLines={2}
@@ -369,18 +366,18 @@ export const ProductOptionsUI = (props: any) => {
369
366
  <Spinner visible={loading} />
370
367
  )} */}
371
368
  {!loading && !error && product && (
372
- <View style={{ paddingTop: isDrawer ? 10 : 20, paddingBottom: 80 }}>
369
+ <View style={{ paddingTop: isDrawer ? 10 : 20, paddingBottom: 80 }}>
373
370
  <WrapContent isDrawer={isDrawer}>
374
371
  <ProductDescription>
375
372
  {(
376
373
  (product?.sku && product?.sku !== '-1' && product?.sku !== '1') ||
377
374
  (productCart?.sku && productCart?.sku !== '-1' && productCart?.sku !== '1')
378
- ) &&(
379
- <>
380
- <OText size={20}>{t('SKU', 'Sku')}</OText>
381
- <OText>{product?.sku || productCart?.sku}</OText>
382
- </>
383
- )}
375
+ ) && (
376
+ <>
377
+ <OText size={20}>{t('SKU', 'Sku')}</OText>
378
+ <OText>{product?.sku || productCart?.sku}</OText>
379
+ </>
380
+ )}
384
381
  </ProductDescription>
385
382
  <ProductEditions>
386
383
  {product?.ingredients.length > 0 && (
@@ -504,7 +501,7 @@ export const ProductOptionsUI = (props: any) => {
504
501
  </TouchableOpacity>
505
502
  </View>
506
503
  )}
507
- <View style={{ width: isSoldOut || maxProductQuantity <= 0 ? '100%' : isDrawer ? '70%':'80%' }}>
504
+ <View style={{ width: isSoldOut || maxProductQuantity <= 0 ? '100%' : isDrawer ? '70%' : '80%' }}>
508
505
  {productCart && !isSoldOut && maxProductQuantity > 0 && auth && orderState.options?.address_id && (
509
506
  <OButton
510
507
  onClick={() => handleSaveProduct()}