ordering-ui-react-native 0.18.30 → 0.18.32

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.18.30",
3
+ "version": "0.18.32",
4
4
  "description": "Reusable components made in react native",
5
5
  "main": "src/index.tsx",
6
6
  "author": "ordering.inc",
@@ -154,6 +154,11 @@ export const transformCountryCode = (countryCode : number) => {
154
154
  return code?.countryCode
155
155
  }
156
156
 
157
+ export const verifyCountryCode = (countryCode : string) => {
158
+ const code = CODES.find((code : any) => code.countryCode === (countryCode || '').toUpperCase())
159
+ return code?.countryCode
160
+ }
161
+
157
162
  /**
158
163
  * Function to check if a number is decimal or not
159
164
  * @param {*} value number to check if decimal or not
@@ -7,7 +7,7 @@ import { Wrapper } from './styles'
7
7
 
8
8
  import { PhoneInputParams } from '../../../../../src/types';
9
9
  import { OText } from '../shared';
10
- import {transformCountryCode} from '../../../../../src/utils'
10
+ import { transformCountryCode, verifyCountryCode } from '../../../../../src/utils'
11
11
  import {I18nManager} from 'react-native'
12
12
  import { useTheme } from 'styled-components/native';
13
13
 
@@ -89,7 +89,7 @@ export const PhoneInputNumber = (props: PhoneInputParams) => {
89
89
  containerStyle={{ width: '100%' }}
90
90
  ref={phoneInput}
91
91
  defaultValue={userphoneNumber || defaultValue}
92
- defaultCode={defaultCode ? transformCountryCode(defaultCode) : configs?.default_country_code?.value}
92
+ defaultCode={defaultCode ? transformCountryCode(defaultCode) : verifyCountryCode(configs?.default_country_code?.value)}
93
93
  onChangeFormattedText={(text : string) => handleChangeNumber(text)}
94
94
  withDarkTheme
95
95
  textInputStyle={{textAlign: I18nManager.isRTL ? 'right' : 'left'}}
@@ -1,5 +1,6 @@
1
1
  import React from 'react';
2
- import { TouchableOpacity, View } from 'react-native';
2
+ import FastImage from 'react-native-fast-image'
3
+ import { StyleSheet, TouchableOpacity, View } from 'react-native';
3
4
  import {
4
5
  AddressDetails as AddressDetailsController,
5
6
  useOrder,
@@ -21,6 +22,14 @@ const AddressDetailsUI = (props: any) => {
21
22
  const [, t] = useLanguage();
22
23
  const { width } = useWindowDimensions();
23
24
 
25
+ const styles = StyleSheet.create({
26
+ productStyle: {
27
+ width: width,
28
+ height: 151,
29
+ marginVertical: 10
30
+ }
31
+ })
32
+
24
33
  return (
25
34
  <ADContainer>
26
35
  <ADHeader>
@@ -34,10 +43,17 @@ const AddressDetailsUI = (props: any) => {
34
43
  </OText>
35
44
  )}
36
45
  </ADHeader>
37
- {!!apiKey && (
46
+ {!!apiKey && googleMapsUrl && (
38
47
  <ADMap
39
48
  style={{ marginStart: -40, marginEnd: -40, width: width, flex: 1 }}>
40
- <OIcon url={googleMapsUrl} height={151} width={width} />
49
+ <FastImage
50
+ style={styles.productStyle}
51
+ source={{
52
+ uri: googleMapsUrl,
53
+ priority: FastImage.priority.normal,
54
+ }}
55
+ resizeMode={FastImage.resizeMode.cover}
56
+ />
41
57
  </ADMap>
42
58
  )}
43
59
  <ADAddress>
@@ -18,9 +18,9 @@ export const AnalyticsSegment = (props: any) => {
18
18
 
19
19
  const handleProductListViewed = (category: any) => {
20
20
  segmentClient.track('Product List Viewed', {
21
- business_id: category.business_id,
22
- category_id: category.id,
23
- category: category.name,
21
+ business_id: category?.business_id,
22
+ category_id: category?.id,
23
+ category: category?.name,
24
24
  products: category?.products
25
25
  })
26
26
  }
@@ -224,7 +224,7 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
224
224
 
225
225
  useEffect(() => {
226
226
  if (!businessesList?.loading) {
227
- const fb = businessesList.businesses.filter((b) => b.featured === true && b?.open);
227
+ const fb = businessesList.businesses.filter((b) => b?.featured === true && b?.open);
228
228
  const ary = [];
229
229
  while (fb.length > 0) {
230
230
  ary.push(fb.splice(0, 2));
@@ -588,7 +588,7 @@ const CheckoutUI = (props: any) => {
588
588
  ) : (
589
589
  <AddressDetails
590
590
  navigation={navigation}
591
- location={businessDetails?.business?.location}
591
+ location={options?.address?.location}
592
592
  businessLogo={businessDetails?.business?.logo}
593
593
  isCartPending={cart?.status === 2}
594
594
  uuid={cartUuid}
@@ -181,6 +181,12 @@ const MultiCheckoutUI = (props: any) => {
181
181
  }
182
182
  }, [walletState.error])
183
183
 
184
+ useEffect(() => {
185
+ if (!cartUuid) {
186
+ onNavigationRedirectReplace('BottomTab', { screen: 'Cart' })
187
+ }
188
+ }, [cartUuid])
189
+
184
190
  return (
185
191
  <>
186
192
  <Container noPadding>
@@ -7,7 +7,7 @@ import { Wrapper } from './styles'
7
7
 
8
8
  import { PhoneInputParams } from '../../types';
9
9
  import { OIcon, OText } from '../shared';
10
- import { transformCountryCode } from '../../utils'
10
+ import { findExitingCode, transformCountryCode } from '../../utils'
11
11
 
12
12
  export const PhoneInputNumber = (props: PhoneInputParams) => {
13
13
  const {
@@ -113,7 +113,7 @@ export const PhoneInputNumber = (props: PhoneInputParams) => {
113
113
  !isNaN(defaultCode)
114
114
  ? transformCountryCode(defaultCode)
115
115
  : defaultCode
116
- : configs?.default_country_code?.value?.toUpperCase()}
116
+ : findExitingCode(configs?.default_country_code?.value?.toUpperCase())}
117
117
  onChangeFormattedText={(text: string) => handleChangeNumber(text)}
118
118
  withDarkTheme
119
119
  onChangeCountry={(country) => changeCountry?.(country)}
@@ -271,6 +271,11 @@ export const transformCountryCode = (countryCode: number) => {
271
271
  return code?.countryCode
272
272
  }
273
273
 
274
+ export const findExitingCode = (countryCode: string) => {
275
+ const code = CODES.find((code: any) => code.countryCode === countryCode)
276
+ return code?.countryCode
277
+ }
278
+
274
279
  /**
275
280
  * Function to check if a number is decimal or not
276
281
  * @param {*} value number to check if decimal or not