ordering-ui-react-native 0.16.92 → 0.16.93

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.16.92",
3
+ "version": "0.16.93",
4
4
  "description": "Reusable components made in react native",
5
5
  "main": "src/index.tsx",
6
6
  "author": "ordering.inc",
@@ -46,7 +46,7 @@ export const BusinessBasicInformation = (
46
46
  const [openBusinessReviews, setOpenBusinessReviews] = useState(false);
47
47
  const [businessInformationObtained, setBusinessInformationObtained] = useState(false)
48
48
  const [businessReviewsObtained, setBusinessReviewsObtainedbtained] = useState(false)
49
- const isChewLayout = theme?.business_view?.components?.header?.components?.layout?.type === 'original'
49
+ const isChewLayout = theme?.business_view?.components?.header?.components?.layout?.type === 'chew'
50
50
  const showLogo = !theme?.business_view?.components?.header?.components?.business?.components?.logo?.hidden
51
51
 
52
52
  const styles = StyleSheet.create({
@@ -272,7 +272,7 @@ export const BusinessBasicInformation = (
272
272
  : { ...styles.headerStyle, backgroundColor: theme.colors.backgroundGray }
273
273
  }
274
274
  {...(!loading && { source: {
275
- uri: header || optimizeImage(businessState?.business?.header, 'h_250,c_limit')
275
+ uri: header || optimizeImage(businessState?.business?.header || theme?.images?.dummies?.businessHeader, 'h_250,c_limit')
276
276
  }})}
277
277
  imageStyle={{ opacity: isChewLayout ? 0.5 : 1 }}
278
278
  >
@@ -304,7 +304,7 @@ export const BusinessBasicInformation = (
304
304
  <FastImage
305
305
  style={styles.logoStyle}
306
306
  source={{
307
- uri: logo || optimizeImage(businessState?.business?.logo, 'h_70,c_limit'),
307
+ uri: logo || optimizeImage(businessState?.business?.logo || theme?.images?.dummies?.businessLogo, 'h_70,c_limit'),
308
308
  priority: FastImage.priority.high,
309
309
  cache:FastImage.cacheControl.web
310
310
  }}
@@ -175,7 +175,7 @@ export const BusinessControllerUI = (props: BusinessControllerParams) => {
175
175
  <FastImage
176
176
  style={{ height: 120 }}
177
177
  source={{
178
- uri: optimizeImage(businessHeader || business?.header, 'h_500,c_limit'),
178
+ uri: optimizeImage(businessHeader || business?.header || theme.images.dummies.businessHeader, 'h_500,c_limit'),
179
179
  priority: FastImage.priority.normal,
180
180
  }}
181
181
  resizeMode={FastImage.resizeMode.cover}
@@ -204,7 +204,7 @@ export const BusinessControllerUI = (props: BusinessControllerParams) => {
204
204
  <FastImage
205
205
  style={{ width: 56, height: 56 }}
206
206
  source={{
207
- uri: optimizeImage(businessLogo || business?.logo, 'h_150,c_limit'),
207
+ uri: optimizeImage(businessLogo || business?.logo || theme.images.dummies.businessLogo, 'h_150,c_limit'),
208
208
  priority: FastImage.priority.normal,
209
209
  }}
210
210
  resizeMode={FastImage.resizeMode.cover}
@@ -38,6 +38,7 @@ export const BusinessTypeFilterUI = (props: BusinessTypeFilterParams) => {
38
38
 
39
39
  const theme = useTheme();
40
40
  const [isOpenAllCategories, setIsOpenAllCategories] = useState(false)
41
+ const defaultImage = (name : string) => theme.images?.categories?.[name.toLowerCase()]
41
42
 
42
43
  useEffect(() => {
43
44
  if(typesState?.types?.length > 0){
@@ -197,9 +198,9 @@ export const BusinessTypeFilterUI = (props: BusinessTypeFilterParams) => {
197
198
  isOpenAllCategories && setIsOpenAllCategories(false)
198
199
  }}
199
200
  >
200
- {item.image ? (
201
+ {(item.image || defaultImage(item.name)) ? (
201
202
  <OIcon
202
- url={item.image}
203
+ url={item.image || defaultImage(item.name)}
203
204
  style={styles.logo}
204
205
  />
205
206
  ) : (
@@ -18,7 +18,8 @@ import {
18
18
  useSession,
19
19
  useOrder,
20
20
  useConfig,
21
- useUtils
21
+ useUtils,
22
+ useOrderingTheme
22
23
  } from 'ordering-components/native';
23
24
  import { useTheme } from 'styled-components/native';
24
25
  import Ionicons from 'react-native-vector-icons/Ionicons'
@@ -75,13 +76,15 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
75
76
  logosLayout
76
77
  } = props;
77
78
  const theme = useTheme();
79
+ const [orderingTheme] = useOrderingTheme()
78
80
  const isFocused = useIsFocused();
79
81
  const appState = useRef(AppState.currentState)
80
82
  const searchBarRef = useRef<any>()
81
83
  const [appStateVisible, setAppStateVisible] = useState(appState.current);
82
- const isChewLayout = theme?.header?.components?.layout?.type === 'original'
84
+ const isChewLayout = theme?.header?.components?.layout?.type === 'chew'
83
85
  const hideCities = theme?.business_listing_view?.components?.cities?.hidden ?? true
84
86
  const [refreshing] = useState(false);
87
+ const bgHeader = orderingTheme?.theme?.business_listing_view?.components?.business_hero?.components?.image
85
88
  const styles = StyleSheet.create({
86
89
  container: {
87
90
  marginBottom: 0,
@@ -455,7 +458,7 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
455
458
  </View>
456
459
  {!isChewLayout ? (
457
460
  <HeaderWrapper
458
- source={theme.images.backgrounds.business_list_header}
461
+ source={bgHeader ? {uri: bgHeader} : theme.images.backgrounds.business_list_header}
459
462
  style={{ paddingTop: top + 20 }}
460
463
  resizeMode='cover'
461
464
  >
@@ -1,5 +1,5 @@
1
1
  import React from 'react'
2
- import { useLanguage } from 'ordering-components/native'
2
+ import { useLanguage, useOrderingTheme } from 'ordering-components/native'
3
3
  import { Dimensions } from 'react-native'
4
4
  import RNRestart from 'react-native-restart'
5
5
  import { OText, OIcon, OButton } from '../shared'
@@ -16,7 +16,8 @@ export const NetworkError = (props: NoNetworkParams) => {
16
16
  } = props
17
17
  const theme = useTheme()
18
18
  const [, t] = useLanguage()
19
-
19
+ const [orderingTheme] = useOrderingTheme()
20
+ const urlimage = orderingTheme?.theme?.no_internet?.components?.image
20
21
  const noNetworkImage = image || theme.images.general.noNetwork
21
22
  const deviceWidth = Dimensions.get('screen').width
22
23
 
@@ -38,7 +39,8 @@ export const NetworkError = (props: NoNetworkParams) => {
38
39
  </OText>
39
40
  <ImageContainer>
40
41
  <OIcon
41
- src={noNetworkImage}
42
+ src={!urlimage && noNetworkImage}
43
+ url={urlimage}
42
44
  width={(deviceWidth - 80) * 0.9}
43
45
  height={(deviceWidth - 80) * 0.8}
44
46
  />
@@ -20,12 +20,13 @@ export const NotFoundSource = (props: NotFoundSourceParams) => {
20
20
  const theme = useTheme();
21
21
 
22
22
  const errorImage = image || theme.images.general.notFound
23
+ const isUrl = errorImage.includes('http')
23
24
 
24
25
  return (
25
26
  <NotFound>
26
27
  {errorImage && (
27
28
  <NotFoundImage>
28
- <OIcon src={errorImage} width={260} height={220} />
29
+ <OIcon url={isUrl && errorImage} src={!isUrl && errorImage} width={260} height={220} />
29
30
  </NotFoundImage>
30
31
  )}
31
32
  {content && conditioned && !errorImage && <OText color={theme.colors.disabled} size={18} style={{ textAlign: 'center' }}>{content}</OText>}
@@ -346,7 +346,7 @@ export const ProductOptionsUI = (props: any) => {
346
346
  useEffect(() => {
347
347
  const imageList: any = []
348
348
  const videoList: any = []
349
- product?.images && imageList.push(product.images)
349
+ product?.images?.length > 0 ? imageList.push(product.images) : imageList.push(theme?.images?.dummies?.product)
350
350
  if (product?.gallery && product?.gallery.length > 0) {
351
351
  for (const img of product?.gallery) {
352
352
  if (img?.file) {
@@ -143,12 +143,12 @@ export const ProductItemAccordion = (props: ProductItemAccordionParams) => {
143
143
  >
144
144
  <View style={{ flexDirection: 'row', alignItems: 'flex-start' }}>
145
145
  <ContentInfo>
146
- {product?.images && (
146
+ {(product?.images || theme?.images?.dummies?.product) && (
147
147
  <ProductImage>
148
148
  {isFromCheckout ? (
149
- <OIcon url={optimizeImage(product?.images, 'h_100,c_limit')} style={{ ...styles.productImage, ...{ width: 82, height: 82 } }} />
149
+ <OIcon url={optimizeImage(product?.images || theme?.images?.dummies?.product, 'h_100,c_limit')} style={{ ...styles.productImage, ...{ width: 82, height: 82 } }} />
150
150
  ) : (
151
- <OIcon url={optimizeImage(product?.images, 'h_100,c_limit')} style={styles.productImage} />
151
+ <OIcon url={optimizeImage(product?.images || theme?.images?.dummies?.product, 'h_100,c_limit')} style={styles.productImage} />
152
152
  )}
153
153
  </ProductImage>
154
154
  )}
@@ -170,10 +170,10 @@ const SingleOrderCardUI = (props: SingleOrderCardParams) => {
170
170
  activeOpacity={0.7}
171
171
  >
172
172
  <InnerContainer>
173
- {!!order.business?.logo && (
173
+ {(!!order.business?.logo || theme?.images?.dummies?.businessLogo) && (
174
174
  <Logo style={styles.logoWrapper}>
175
175
  <OIcon
176
- url={optimizeImage(order.business?.logo, 'h_300,c_limit')}
176
+ url={optimizeImage(order.business?.logo || theme?.images?.dummies?.businessLogo, 'h_300,c_limit')}
177
177
  style={styles.logo}
178
178
  />
179
179
  </Logo>
@@ -222,11 +222,11 @@ const SingleProductCardUI = React.memo((props: SingleProductCardParams) => {
222
222
  </OText>
223
223
  </RibbonBox>
224
224
  )}
225
- {product?.images && (
225
+ {(product?.images || theme?.images?.dummies?.product) && (
226
226
  <FastImage
227
227
  style={styles.productStyle}
228
228
  source={{
229
- uri: optimizeImage(product?.images, 'h_250,c_limit'),
229
+ uri: optimizeImage(product?.images || theme?.images?.dummies?.product, 'h_250,c_limit'),
230
230
  priority: FastImage.priority.normal,
231
231
  }}
232
232
  resizeMode={FastImage.resizeMode.cover}
@@ -48,8 +48,6 @@ const WalletsUI = (props: any) => {
48
48
  const [{ parsePrice }] = useUtils()
49
49
  const [{ configs }] = useConfig()
50
50
 
51
- console.log(theme)
52
-
53
51
  const styles = StyleSheet.create({
54
52
  logoStyle: {
55
53
  width: 120,
@@ -65,7 +63,7 @@ const WalletsUI = (props: any) => {
65
63
 
66
64
  const [tabSelected, setTabSelected] = useState(isWalletCashEnabled ? 'cash' : 'credit_point')
67
65
  const [openHistory, setOpenHistory] = useState(false)
68
- const isChewLayout = theme?.wallets_view?.components?.layout?.type === 'original'
66
+ const isChewLayout = theme?.wallets_view?.components?.layout?.type === 'chew'
69
67
 
70
68
  const isWalletEnabled = configs?.cash_wallet?.value && configs?.wallet_enabled?.value === '1' && (isWalletCashEnabled || isWalletPointsEnabled)
71
69